diff --git a/.yarn/releases/yarn-4.7.0.cjs b/.yarn/releases/yarn-4.7.0.cjs deleted file mode 100755 index 04022e16fc..0000000000 --- a/.yarn/releases/yarn-4.7.0.cjs +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable */ -//prettier-ignore -(()=>{var j3e=Object.create;var gT=Object.defineProperty;var G3e=Object.getOwnPropertyDescriptor;var W3e=Object.getOwnPropertyNames;var Y3e=Object.getPrototypeOf,V3e=Object.prototype.hasOwnProperty;var ve=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var It=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Vt=(t,e)=>{for(var r in e)gT(t,r,{get:e[r],enumerable:!0})},K3e=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of W3e(e))!V3e.call(t,a)&&a!==r&&gT(t,a,{get:()=>e[a],enumerable:!(o=G3e(e,a))||o.enumerable});return t};var et=(t,e,r)=>(r=t!=null?j3e(Y3e(t)):{},K3e(e||!t||!t.__esModule?gT(r,"default",{value:t,enumerable:!0}):r,t));var Si={};Vt(Si,{SAFE_TIME:()=>cW,S_IFDIR:()=>KD,S_IFLNK:()=>JD,S_IFMT:()=>Hu,S_IFREG:()=>ow});var Hu,KD,ow,JD,cW,uW=It(()=>{Hu=61440,KD=16384,ow=32768,JD=40960,cW=456789e3});var sr={};Vt(sr,{EBADF:()=>ho,EBUSY:()=>J3e,EEXIST:()=>t_e,EINVAL:()=>X3e,EISDIR:()=>e_e,ENOENT:()=>Z3e,ENOSYS:()=>z3e,ENOTDIR:()=>$3e,ENOTEMPTY:()=>n_e,EOPNOTSUPP:()=>i_e,EROFS:()=>r_e,ERR_DIR_CLOSED:()=>dT});function Nl(t,e){return Object.assign(new Error(`${t}: ${e}`),{code:t})}function J3e(t){return Nl("EBUSY",t)}function z3e(t,e){return Nl("ENOSYS",`${t}, ${e}`)}function X3e(t){return Nl("EINVAL",`invalid argument, ${t}`)}function ho(t){return Nl("EBADF",`bad file descriptor, ${t}`)}function Z3e(t){return Nl("ENOENT",`no such file or directory, ${t}`)}function $3e(t){return Nl("ENOTDIR",`not a directory, ${t}`)}function e_e(t){return Nl("EISDIR",`illegal operation on a directory, ${t}`)}function t_e(t){return Nl("EEXIST",`file already exists, ${t}`)}function r_e(t){return Nl("EROFS",`read-only filesystem, ${t}`)}function n_e(t){return Nl("ENOTEMPTY",`directory not empty, ${t}`)}function i_e(t){return Nl("EOPNOTSUPP",`operation not supported, ${t}`)}function dT(){return Nl("ERR_DIR_CLOSED","Directory handle was closed")}var zD=It(()=>{});var wa={};Vt(wa,{BigIntStatsEntry:()=>cm,DEFAULT_MODE:()=>ET,DirEntry:()=>mT,StatEntry:()=>lm,areStatsEqual:()=>CT,clearStats:()=>XD,convertToBigIntStats:()=>o_e,makeDefaultStats:()=>AW,makeEmptyStats:()=>s_e});function AW(){return new lm}function s_e(){return XD(AW())}function XD(t){for(let e in t)if(Object.hasOwn(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):yT.types.isDate(r)&&(t[e]=new Date(0))}return t}function o_e(t){let e=new cm;for(let r in t)if(Object.hasOwn(t,r)){let o=t[r];typeof o=="number"?e[r]=BigInt(o):yT.types.isDate(o)&&(e[r]=new Date(o))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthtimeNs=e.birthtimeMs*BigInt(1e6),e}function CT(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||t.isFIFO()!==e.isFIFO()||t.isFile()!==e.isFile()||t.isSocket()!==e.isSocket()||t.isSymbolicLink()!==e.isSymbolicLink()||t.mode!==e.mode||t.mtimeMs!==e.mtimeMs||t.nlink!==e.nlink||t.rdev!==e.rdev||t.size!==e.size||t.uid!==e.uid)return!1;let r=t,o=e;return!(r.atimeNs!==o.atimeNs||r.mtimeNs!==o.mtimeNs||r.ctimeNs!==o.ctimeNs||r.birthtimeNs!==o.birthtimeNs)}var yT,ET,mT,lm,cm,IT=It(()=>{yT=et(ve("util")),ET=33188,mT=class{constructor(){this.name="";this.path="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},lm=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=ET;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},cm=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=BigInt(0);this.ino=BigInt(0);this.mode=BigInt(ET);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&BigInt(61440))===BigInt(16384)}isFIFO(){return!1}isFile(){return(this.mode&BigInt(61440))===BigInt(32768)}isSocket(){return!1}isSymbolicLink(){return(this.mode&BigInt(61440))===BigInt(40960)}}});function A_e(t){let e,r;if(e=t.match(c_e))t=e[1];else if(r=t.match(u_e))t=`\\\\${r[1]?".\\":""}${r[2]}`;else return t;return t.replace(/\//g,"\\")}function f_e(t){t=t.replace(/\\/g,"/");let e,r;return(e=t.match(a_e))?t=`/${e[1]}`:(r=t.match(l_e))&&(t=`/unc/${r[1]?".dot/":""}${r[2]}`),t}function ZD(t,e){return t===Ae?pW(e):wT(e)}var aw,Bt,mr,Ae,V,fW,a_e,l_e,c_e,u_e,wT,pW,Ba=It(()=>{aw=et(ve("path")),Bt={root:"/",dot:".",parent:".."},mr={home:"~",nodeModules:"node_modules",manifest:"package.json",lockfile:"yarn.lock",virtual:"__virtual__",pnpJs:".pnp.js",pnpCjs:".pnp.cjs",pnpData:".pnp.data.json",pnpEsmLoader:".pnp.loader.mjs",rc:".yarnrc.yml",env:".env"},Ae=Object.create(aw.default),V=Object.create(aw.default.posix);Ae.cwd=()=>process.cwd();V.cwd=process.platform==="win32"?()=>wT(process.cwd()):process.cwd;process.platform==="win32"&&(V.resolve=(...t)=>t.length>0&&V.isAbsolute(t[0])?aw.default.posix.resolve(...t):aw.default.posix.resolve(V.cwd(),...t));fW=function(t,e,r){return e=t.normalize(e),r=t.normalize(r),e===r?".":(e.endsWith(t.sep)||(e=e+t.sep),r.startsWith(e)?r.slice(e.length):null)};Ae.contains=(t,e)=>fW(Ae,t,e);V.contains=(t,e)=>fW(V,t,e);a_e=/^([a-zA-Z]:.*)$/,l_e=/^\/\/(\.\/)?(.*)$/,c_e=/^\/([a-zA-Z]:.*)$/,u_e=/^\/unc\/(\.dot\/)?(.*)$/;wT=process.platform==="win32"?f_e:t=>t,pW=process.platform==="win32"?A_e:t=>t;Ae.fromPortablePath=pW;Ae.toPortablePath=wT});async function $D(t,e){let r="0123456789abcdef";await t.mkdirPromise(e.indexPath,{recursive:!0});let o=[];for(let a of r)for(let n of r)o.push(t.mkdirPromise(t.pathUtils.join(e.indexPath,`${a}${n}`),{recursive:!0}));return await Promise.all(o),e.indexPath}async function hW(t,e,r,o,a){let n=t.pathUtils.normalize(e),u=r.pathUtils.normalize(o),A=[],p=[],{atime:h,mtime:E}=a.stableTime?{atime:H0,mtime:H0}:await r.lstatPromise(u);await t.mkdirpPromise(t.pathUtils.dirname(e),{utimes:[h,E]}),await BT(A,p,t,n,r,u,{...a,didParentExist:!0});for(let w of A)await w();await Promise.all(p.map(w=>w()))}async function BT(t,e,r,o,a,n,u){let A=u.didParentExist?await gW(r,o):null,p=await a.lstatPromise(n),{atime:h,mtime:E}=u.stableTime?{atime:H0,mtime:H0}:p,w;switch(!0){case p.isDirectory():w=await h_e(t,e,r,o,A,a,n,p,u);break;case p.isFile():w=await m_e(t,e,r,o,A,a,n,p,u);break;case p.isSymbolicLink():w=await y_e(t,e,r,o,A,a,n,p,u);break;default:throw new Error(`Unsupported file type (${p.mode})`)}return(u.linkStrategy?.type!=="HardlinkFromIndex"||!p.isFile())&&((w||A?.mtime?.getTime()!==E.getTime()||A?.atime?.getTime()!==h.getTime())&&(e.push(()=>r.lutimesPromise(o,h,E)),w=!0),(A===null||(A.mode&511)!==(p.mode&511))&&(e.push(()=>r.chmodPromise(o,p.mode&511)),w=!0)),w}async function gW(t,e){try{return await t.lstatPromise(e)}catch{return null}}async function h_e(t,e,r,o,a,n,u,A,p){if(a!==null&&!a.isDirectory())if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;let h=!1;a===null&&(t.push(async()=>{try{await r.mkdirPromise(o,{mode:A.mode})}catch(D){if(D.code!=="EEXIST")throw D}}),h=!0);let E=await n.readdirPromise(u),w=p.didParentExist&&!a?{...p,didParentExist:!1}:p;if(p.stableSort)for(let D of E.sort())await BT(t,e,r,r.pathUtils.join(o,D),n,n.pathUtils.join(u,D),w)&&(h=!0);else(await Promise.all(E.map(async b=>{await BT(t,e,r,r.pathUtils.join(o,b),n,n.pathUtils.join(u,b),w)}))).some(b=>b)&&(h=!0);return h}async function g_e(t,e,r,o,a,n,u,A,p,h){let E=await n.checksumFilePromise(u,{algorithm:"sha1"}),w=420,D=A.mode&511,b=`${E}${D!==w?D.toString(8):""}`,C=r.pathUtils.join(h.indexPath,E.slice(0,2),`${b}.dat`),T;(ue=>(ue[ue.Lock=0]="Lock",ue[ue.Rename=1]="Rename"))(T||={});let N=1,U=await gW(r,C);if(a){let le=U&&a.dev===U.dev&&a.ino===U.ino,ce=U?.mtimeMs!==p_e;if(le&&ce&&h.autoRepair&&(N=0,U=null),!le)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1}let J=!U&&N===1?`${C}.${Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0")}`:null,te=!1;return t.push(async()=>{if(!U&&(N===0&&await r.lockPromise(C,async()=>{let le=await n.readFilePromise(u);await r.writeFilePromise(C,le)}),N===1&&J)){let le=await n.readFilePromise(u);await r.writeFilePromise(J,le);try{await r.linkPromise(J,C)}catch(ce){if(ce.code==="EEXIST")te=!0,await r.unlinkPromise(J);else throw ce}}a||await r.linkPromise(C,o)}),e.push(async()=>{U||(await r.lutimesPromise(C,H0,H0),D!==w&&await r.chmodPromise(C,D)),J&&!te&&await r.unlinkPromise(J)}),!1}async function d_e(t,e,r,o,a,n,u,A,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;return t.push(async()=>{let h=await n.readFilePromise(u);await r.writeFilePromise(o,h)}),!0}async function m_e(t,e,r,o,a,n,u,A,p){return p.linkStrategy?.type==="HardlinkFromIndex"?g_e(t,e,r,o,a,n,u,A,p,p.linkStrategy):d_e(t,e,r,o,a,n,u,A,p)}async function y_e(t,e,r,o,a,n,u,A,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;return t.push(async()=>{await r.symlinkPromise(ZD(r.pathUtils,await n.readlinkPromise(u)),o)}),!0}var H0,p_e,vT=It(()=>{Ba();H0=new Date(456789e3*1e3),p_e=H0.getTime()});function eS(t,e,r,o){let a=()=>{let n=r.shift();if(typeof n>"u")return null;let u=t.pathUtils.join(e,n);return Object.assign(t.statSync(u),{name:n,path:void 0})};return new lw(e,a,o)}var lw,dW=It(()=>{zD();lw=class{constructor(e,r,o={}){this.path=e;this.nextDirent=r;this.opts=o;this.closed=!1}throwIfClosed(){if(this.closed)throw dT()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.read())!==null;)yield e}finally{await this.close()}}read(e){let r=this.readSync();return typeof e<"u"?e(null,r):Promise.resolve(r)}readSync(){return this.throwIfClosed(),this.nextDirent()}close(e){return this.closeSync(),typeof e<"u"?e(null):Promise.resolve()}closeSync(){this.throwIfClosed(),this.opts.onClose?.(),this.closed=!0}}});function mW(t,e){if(t!==e)throw new Error(`Invalid StatWatcher status: expected '${e}', got '${t}'`)}var yW,tS,EW=It(()=>{yW=ve("events");IT();tS=class t extends yW.EventEmitter{constructor(r,o,{bigint:a=!1}={}){super();this.status="ready";this.changeListeners=new Map;this.startTimeout=null;this.fakeFs=r,this.path=o,this.bigint=a,this.lastStats=this.stat()}static create(r,o,a){let n=new t(r,o,a);return n.start(),n}start(){mW(this.status,"ready"),this.status="running",this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.fakeFs.existsSync(this.path)||this.emit("change",this.lastStats,this.lastStats)},3)}stop(){mW(this.status,"running"),this.status="stopped",this.startTimeout!==null&&(clearTimeout(this.startTimeout),this.startTimeout=null),this.emit("stop")}stat(){try{return this.fakeFs.statSync(this.path,{bigint:this.bigint})}catch{let r=this.bigint?new cm:new lm;return XD(r)}}makeInterval(r){let o=setInterval(()=>{let a=this.stat(),n=this.lastStats;CT(a,n)||(this.lastStats=a,this.emit("change",a,n))},r.interval);return r.persistent?o:o.unref()}registerChangeListener(r,o){this.addListener("change",r),this.changeListeners.set(r,this.makeInterval(o))}unregisterChangeListener(r){this.removeListener("change",r);let o=this.changeListeners.get(r);typeof o<"u"&&clearInterval(o),this.changeListeners.delete(r)}unregisterAllChangeListeners(){for(let r of this.changeListeners.keys())this.unregisterChangeListener(r)}hasChangeListeners(){return this.changeListeners.size>0}ref(){for(let r of this.changeListeners.values())r.ref();return this}unref(){for(let r of this.changeListeners.values())r.unref();return this}}});function um(t,e,r,o){let a,n,u,A;switch(typeof r){case"function":a=!1,n=!0,u=5007,A=r;break;default:({bigint:a=!1,persistent:n=!0,interval:u=5007}=r),A=o;break}let p=rS.get(t);typeof p>"u"&&rS.set(t,p=new Map);let h=p.get(e);return typeof h>"u"&&(h=tS.create(t,e,{bigint:a}),p.set(e,h)),h.registerChangeListener(A,{persistent:n,interval:u}),h}function q0(t,e,r){let o=rS.get(t);if(typeof o>"u")return;let a=o.get(e);typeof a>"u"||(typeof r>"u"?a.unregisterAllChangeListeners():a.unregisterChangeListener(r),a.hasChangeListeners()||(a.stop(),o.delete(e)))}function j0(t){let e=rS.get(t);if(!(typeof e>"u"))for(let r of e.keys())q0(t,r)}var rS,DT=It(()=>{EW();rS=new WeakMap});function E_e(t){let e=t.match(/\r?\n/g);if(e===null)return IW.EOL;let r=e.filter(a=>a===`\r -`).length,o=e.length-r;return r>o?`\r -`:` -`}function G0(t,e){return e.replace(/\r?\n/g,E_e(t))}var CW,IW,hf,qu,W0=It(()=>{CW=ve("crypto"),IW=ve("os");vT();Ba();hf=class{constructor(e){this.pathUtils=e}async*genTraversePromise(e,{stableSort:r=!1}={}){let o=[e];for(;o.length>0;){let a=o.shift();if((await this.lstatPromise(a)).isDirectory()){let u=await this.readdirPromise(a);if(r)for(let A of u.sort())o.push(this.pathUtils.join(a,A));else throw new Error("Not supported")}else yield a}}async checksumFilePromise(e,{algorithm:r="sha512"}={}){let o=await this.openPromise(e,"r");try{let n=Buffer.allocUnsafeSlow(65536),u=(0,CW.createHash)(r),A=0;for(;(A=await this.readPromise(o,n,0,65536))!==0;)u.update(A===65536?n:n.slice(0,A));return u.digest("hex")}finally{await this.closePromise(o)}}async removePromise(e,{recursive:r=!0,maxRetries:o=5}={}){let a;try{a=await this.lstatPromise(e)}catch(n){if(n.code==="ENOENT")return;throw n}if(a.isDirectory()){if(r){let n=await this.readdirPromise(e);await Promise.all(n.map(u=>this.removePromise(this.pathUtils.resolve(e,u))))}for(let n=0;n<=o;n++)try{await this.rmdirPromise(e);break}catch(u){if(u.code!=="EBUSY"&&u.code!=="ENOTEMPTY")throw u;nsetTimeout(A,n*100))}}else await this.unlinkPromise(e)}removeSync(e,{recursive:r=!0}={}){let o;try{o=this.lstatSync(e)}catch(a){if(a.code==="ENOENT")return;throw a}if(o.isDirectory()){if(r)for(let a of this.readdirSync(e))this.removeSync(this.pathUtils.resolve(e,a));this.rmdirSync(e)}else this.unlinkSync(e)}async mkdirpPromise(e,{chmod:r,utimes:o}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let u=2;u<=a.length;++u){let A=a.slice(0,u).join(this.pathUtils.sep);if(!this.existsSync(A)){try{await this.mkdirPromise(A)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=A,r!=null&&await this.chmodPromise(A,r),o!=null)await this.utimesPromise(A,o[0],o[1]);else{let p=await this.statPromise(this.pathUtils.dirname(A));await this.utimesPromise(A,p.atime,p.mtime)}}}return n}mkdirpSync(e,{chmod:r,utimes:o}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let u=2;u<=a.length;++u){let A=a.slice(0,u).join(this.pathUtils.sep);if(!this.existsSync(A)){try{this.mkdirSync(A)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=A,r!=null&&this.chmodSync(A,r),o!=null)this.utimesSync(A,o[0],o[1]);else{let p=this.statSync(this.pathUtils.dirname(A));this.utimesSync(A,p.atime,p.mtime)}}}return n}async copyPromise(e,r,{baseFs:o=this,overwrite:a=!0,stableSort:n=!1,stableTime:u=!1,linkStrategy:A=null}={}){return await hW(this,e,o,r,{overwrite:a,stableSort:n,stableTime:u,linkStrategy:A})}copySync(e,r,{baseFs:o=this,overwrite:a=!0}={}){let n=o.lstatSync(r),u=this.existsSync(e);if(n.isDirectory()){this.mkdirpSync(e);let p=o.readdirSync(r);for(let h of p)this.copySync(this.pathUtils.join(e,h),o.pathUtils.join(r,h),{baseFs:o,overwrite:a})}else if(n.isFile()){if(!u||a){u&&this.removeSync(e);let p=o.readFileSync(r);this.writeFileSync(e,p)}}else if(n.isSymbolicLink()){if(!u||a){u&&this.removeSync(e);let p=o.readlinkSync(r);this.symlinkSync(ZD(this.pathUtils,p),e)}}else throw new Error(`Unsupported file type (file: ${r}, mode: 0o${n.mode.toString(8).padStart(6,"0")})`);let A=n.mode&511;this.chmodSync(e,A)}async changeFilePromise(e,r,o={}){return Buffer.isBuffer(r)?this.changeFileBufferPromise(e,r,o):this.changeFileTextPromise(e,r,o)}async changeFileBufferPromise(e,r,{mode:o}={}){let a=Buffer.alloc(0);try{a=await this.readFilePromise(e)}catch{}Buffer.compare(a,r)!==0&&await this.writeFilePromise(e,r,{mode:o})}async changeFileTextPromise(e,r,{automaticNewlines:o,mode:a}={}){let n="";try{n=await this.readFilePromise(e,"utf8")}catch{}let u=o?G0(n,r):r;n!==u&&await this.writeFilePromise(e,u,{mode:a})}changeFileSync(e,r,o={}){return Buffer.isBuffer(r)?this.changeFileBufferSync(e,r,o):this.changeFileTextSync(e,r,o)}changeFileBufferSync(e,r,{mode:o}={}){let a=Buffer.alloc(0);try{a=this.readFileSync(e)}catch{}Buffer.compare(a,r)!==0&&this.writeFileSync(e,r,{mode:o})}changeFileTextSync(e,r,{automaticNewlines:o=!1,mode:a}={}){let n="";try{n=this.readFileSync(e,"utf8")}catch{}let u=o?G0(n,r):r;n!==u&&this.writeFileSync(e,u,{mode:a})}async movePromise(e,r){try{await this.renamePromise(e,r)}catch(o){if(o.code==="EXDEV")await this.copyPromise(r,e),await this.removePromise(e);else throw o}}moveSync(e,r){try{this.renameSync(e,r)}catch(o){if(o.code==="EXDEV")this.copySync(r,e),this.removeSync(e);else throw o}}async lockPromise(e,r){let o=`${e}.flock`,a=1e3/60,n=Date.now(),u=null,A=async()=>{let p;try{[p]=await this.readJsonPromise(o)}catch{return Date.now()-n<500}try{return process.kill(p,0),!0}catch{return!1}};for(;u===null;)try{u=await this.openPromise(o,"wx")}catch(p){if(p.code==="EEXIST"){if(!await A())try{await this.unlinkPromise(o);continue}catch{}if(Date.now()-n<60*1e3)await new Promise(h=>setTimeout(h,a));else throw new Error(`Couldn't acquire a lock in a reasonable time (via ${o})`)}else throw p}await this.writePromise(u,JSON.stringify([process.pid]));try{return await r()}finally{try{await this.closePromise(u),await this.unlinkPromise(o)}catch{}}}async readJsonPromise(e){let r=await this.readFilePromise(e,"utf8");try{return JSON.parse(r)}catch(o){throw o.message+=` (in ${e})`,o}}readJsonSync(e){let r=this.readFileSync(e,"utf8");try{return JSON.parse(r)}catch(o){throw o.message+=` (in ${e})`,o}}async writeJsonPromise(e,r,{compact:o=!1}={}){let a=o?0:2;return await this.writeFilePromise(e,`${JSON.stringify(r,null,a)} -`)}writeJsonSync(e,r,{compact:o=!1}={}){let a=o?0:2;return this.writeFileSync(e,`${JSON.stringify(r,null,a)} -`)}async preserveTimePromise(e,r){let o=await this.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await this.lutimesPromise(e,o.atime,o.mtime)}async preserveTimeSync(e,r){let o=this.lstatSync(e),a=r();typeof a<"u"&&(e=a),this.lutimesSync(e,o.atime,o.mtime)}},qu=class extends hf{constructor(){super(V)}}});var ws,gf=It(()=>{W0();ws=class extends hf{getExtractHint(e){return this.baseFs.getExtractHint(e)}resolve(e){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(e)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(e,r,o){return this.baseFs.openPromise(this.mapToBase(e),r,o)}openSync(e,r,o){return this.baseFs.openSync(this.mapToBase(e),r,o)}async opendirPromise(e,r){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(e),r),{path:e})}opendirSync(e,r){return Object.assign(this.baseFs.opendirSync(this.mapToBase(e),r),{path:e})}async readPromise(e,r,o,a,n){return await this.baseFs.readPromise(e,r,o,a,n)}readSync(e,r,o,a,n){return this.baseFs.readSync(e,r,o,a,n)}async writePromise(e,r,o,a,n){return typeof r=="string"?await this.baseFs.writePromise(e,r,o):await this.baseFs.writePromise(e,r,o,a,n)}writeSync(e,r,o,a,n){return typeof r=="string"?this.baseFs.writeSync(e,r,o):this.baseFs.writeSync(e,r,o,a,n)}async closePromise(e){return this.baseFs.closePromise(e)}closeSync(e){this.baseFs.closeSync(e)}createReadStream(e,r){return this.baseFs.createReadStream(e!==null?this.mapToBase(e):e,r)}createWriteStream(e,r){return this.baseFs.createWriteStream(e!==null?this.mapToBase(e):e,r)}async realpathPromise(e){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(e)))}realpathSync(e){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(e)))}async existsPromise(e){return this.baseFs.existsPromise(this.mapToBase(e))}existsSync(e){return this.baseFs.existsSync(this.mapToBase(e))}accessSync(e,r){return this.baseFs.accessSync(this.mapToBase(e),r)}async accessPromise(e,r){return this.baseFs.accessPromise(this.mapToBase(e),r)}async statPromise(e,r){return this.baseFs.statPromise(this.mapToBase(e),r)}statSync(e,r){return this.baseFs.statSync(this.mapToBase(e),r)}async fstatPromise(e,r){return this.baseFs.fstatPromise(e,r)}fstatSync(e,r){return this.baseFs.fstatSync(e,r)}lstatPromise(e,r){return this.baseFs.lstatPromise(this.mapToBase(e),r)}lstatSync(e,r){return this.baseFs.lstatSync(this.mapToBase(e),r)}async fchmodPromise(e,r){return this.baseFs.fchmodPromise(e,r)}fchmodSync(e,r){return this.baseFs.fchmodSync(e,r)}async chmodPromise(e,r){return this.baseFs.chmodPromise(this.mapToBase(e),r)}chmodSync(e,r){return this.baseFs.chmodSync(this.mapToBase(e),r)}async fchownPromise(e,r,o){return this.baseFs.fchownPromise(e,r,o)}fchownSync(e,r,o){return this.baseFs.fchownSync(e,r,o)}async chownPromise(e,r,o){return this.baseFs.chownPromise(this.mapToBase(e),r,o)}chownSync(e,r,o){return this.baseFs.chownSync(this.mapToBase(e),r,o)}async renamePromise(e,r){return this.baseFs.renamePromise(this.mapToBase(e),this.mapToBase(r))}renameSync(e,r){return this.baseFs.renameSync(this.mapToBase(e),this.mapToBase(r))}async copyFilePromise(e,r,o=0){return this.baseFs.copyFilePromise(this.mapToBase(e),this.mapToBase(r),o)}copyFileSync(e,r,o=0){return this.baseFs.copyFileSync(this.mapToBase(e),this.mapToBase(r),o)}async appendFilePromise(e,r,o){return this.baseFs.appendFilePromise(this.fsMapToBase(e),r,o)}appendFileSync(e,r,o){return this.baseFs.appendFileSync(this.fsMapToBase(e),r,o)}async writeFilePromise(e,r,o){return this.baseFs.writeFilePromise(this.fsMapToBase(e),r,o)}writeFileSync(e,r,o){return this.baseFs.writeFileSync(this.fsMapToBase(e),r,o)}async unlinkPromise(e){return this.baseFs.unlinkPromise(this.mapToBase(e))}unlinkSync(e){return this.baseFs.unlinkSync(this.mapToBase(e))}async utimesPromise(e,r,o){return this.baseFs.utimesPromise(this.mapToBase(e),r,o)}utimesSync(e,r,o){return this.baseFs.utimesSync(this.mapToBase(e),r,o)}async lutimesPromise(e,r,o){return this.baseFs.lutimesPromise(this.mapToBase(e),r,o)}lutimesSync(e,r,o){return this.baseFs.lutimesSync(this.mapToBase(e),r,o)}async mkdirPromise(e,r){return this.baseFs.mkdirPromise(this.mapToBase(e),r)}mkdirSync(e,r){return this.baseFs.mkdirSync(this.mapToBase(e),r)}async rmdirPromise(e,r){return this.baseFs.rmdirPromise(this.mapToBase(e),r)}rmdirSync(e,r){return this.baseFs.rmdirSync(this.mapToBase(e),r)}async rmPromise(e,r){return this.baseFs.rmPromise(this.mapToBase(e),r)}rmSync(e,r){return this.baseFs.rmSync(this.mapToBase(e),r)}async linkPromise(e,r){return this.baseFs.linkPromise(this.mapToBase(e),this.mapToBase(r))}linkSync(e,r){return this.baseFs.linkSync(this.mapToBase(e),this.mapToBase(r))}async symlinkPromise(e,r,o){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkPromise(this.mapToBase(e),a,o);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),u=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkPromise(u,a,o)}symlinkSync(e,r,o){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkSync(this.mapToBase(e),a,o);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),u=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkSync(u,a,o)}async readFilePromise(e,r){return this.baseFs.readFilePromise(this.fsMapToBase(e),r)}readFileSync(e,r){return this.baseFs.readFileSync(this.fsMapToBase(e),r)}readdirPromise(e,r){return this.baseFs.readdirPromise(this.mapToBase(e),r)}readdirSync(e,r){return this.baseFs.readdirSync(this.mapToBase(e),r)}async readlinkPromise(e){return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(e)))}readlinkSync(e){return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(e)))}async truncatePromise(e,r){return this.baseFs.truncatePromise(this.mapToBase(e),r)}truncateSync(e,r){return this.baseFs.truncateSync(this.mapToBase(e),r)}async ftruncatePromise(e,r){return this.baseFs.ftruncatePromise(e,r)}ftruncateSync(e,r){return this.baseFs.ftruncateSync(e,r)}watch(e,r,o){return this.baseFs.watch(this.mapToBase(e),r,o)}watchFile(e,r,o){return this.baseFs.watchFile(this.mapToBase(e),r,o)}unwatchFile(e,r){return this.baseFs.unwatchFile(this.mapToBase(e),r)}fsMapToBase(e){return typeof e=="number"?e:this.mapToBase(e)}}});var ju,wW=It(()=>{gf();ju=class extends ws{constructor(e,{baseFs:r,pathUtils:o}){super(o),this.target=e,this.baseFs=r}getRealPath(){return this.target}getBaseFs(){return this.baseFs}mapFromBase(e){return e}mapToBase(e){return e}}});function BW(t){let e=t;return typeof t.path=="string"&&(e.path=Ae.toPortablePath(t.path)),e}var vW,_n,Y0=It(()=>{vW=et(ve("fs"));W0();Ba();_n=class extends qu{constructor(e=vW.default){super(),this.realFs=e}getExtractHint(){return!1}getRealPath(){return Bt.root}resolve(e){return V.resolve(e)}async openPromise(e,r,o){return await new Promise((a,n)=>{this.realFs.open(Ae.fromPortablePath(e),r,o,this.makeCallback(a,n))})}openSync(e,r,o){return this.realFs.openSync(Ae.fromPortablePath(e),r,o)}async opendirPromise(e,r){return await new Promise((o,a)=>{typeof r<"u"?this.realFs.opendir(Ae.fromPortablePath(e),r,this.makeCallback(o,a)):this.realFs.opendir(Ae.fromPortablePath(e),this.makeCallback(o,a))}).then(o=>{let a=o;return Object.defineProperty(a,"path",{value:e,configurable:!0,writable:!0}),a})}opendirSync(e,r){let a=typeof r<"u"?this.realFs.opendirSync(Ae.fromPortablePath(e),r):this.realFs.opendirSync(Ae.fromPortablePath(e));return Object.defineProperty(a,"path",{value:e,configurable:!0,writable:!0}),a}async readPromise(e,r,o=0,a=0,n=-1){return await new Promise((u,A)=>{this.realFs.read(e,r,o,a,n,(p,h)=>{p?A(p):u(h)})})}readSync(e,r,o,a,n){return this.realFs.readSync(e,r,o,a,n)}async writePromise(e,r,o,a,n){return await new Promise((u,A)=>typeof r=="string"?this.realFs.write(e,r,o,this.makeCallback(u,A)):this.realFs.write(e,r,o,a,n,this.makeCallback(u,A)))}writeSync(e,r,o,a,n){return typeof r=="string"?this.realFs.writeSync(e,r,o):this.realFs.writeSync(e,r,o,a,n)}async closePromise(e){await new Promise((r,o)=>{this.realFs.close(e,this.makeCallback(r,o))})}closeSync(e){this.realFs.closeSync(e)}createReadStream(e,r){let o=e!==null?Ae.fromPortablePath(e):e;return this.realFs.createReadStream(o,r)}createWriteStream(e,r){let o=e!==null?Ae.fromPortablePath(e):e;return this.realFs.createWriteStream(o,r)}async realpathPromise(e){return await new Promise((r,o)=>{this.realFs.realpath(Ae.fromPortablePath(e),{},this.makeCallback(r,o))}).then(r=>Ae.toPortablePath(r))}realpathSync(e){return Ae.toPortablePath(this.realFs.realpathSync(Ae.fromPortablePath(e),{}))}async existsPromise(e){return await new Promise(r=>{this.realFs.exists(Ae.fromPortablePath(e),r)})}accessSync(e,r){return this.realFs.accessSync(Ae.fromPortablePath(e),r)}async accessPromise(e,r){return await new Promise((o,a)=>{this.realFs.access(Ae.fromPortablePath(e),r,this.makeCallback(o,a))})}existsSync(e){return this.realFs.existsSync(Ae.fromPortablePath(e))}async statPromise(e,r){return await new Promise((o,a)=>{r?this.realFs.stat(Ae.fromPortablePath(e),r,this.makeCallback(o,a)):this.realFs.stat(Ae.fromPortablePath(e),this.makeCallback(o,a))})}statSync(e,r){return r?this.realFs.statSync(Ae.fromPortablePath(e),r):this.realFs.statSync(Ae.fromPortablePath(e))}async fstatPromise(e,r){return await new Promise((o,a)=>{r?this.realFs.fstat(e,r,this.makeCallback(o,a)):this.realFs.fstat(e,this.makeCallback(o,a))})}fstatSync(e,r){return r?this.realFs.fstatSync(e,r):this.realFs.fstatSync(e)}async lstatPromise(e,r){return await new Promise((o,a)=>{r?this.realFs.lstat(Ae.fromPortablePath(e),r,this.makeCallback(o,a)):this.realFs.lstat(Ae.fromPortablePath(e),this.makeCallback(o,a))})}lstatSync(e,r){return r?this.realFs.lstatSync(Ae.fromPortablePath(e),r):this.realFs.lstatSync(Ae.fromPortablePath(e))}async fchmodPromise(e,r){return await new Promise((o,a)=>{this.realFs.fchmod(e,r,this.makeCallback(o,a))})}fchmodSync(e,r){return this.realFs.fchmodSync(e,r)}async chmodPromise(e,r){return await new Promise((o,a)=>{this.realFs.chmod(Ae.fromPortablePath(e),r,this.makeCallback(o,a))})}chmodSync(e,r){return this.realFs.chmodSync(Ae.fromPortablePath(e),r)}async fchownPromise(e,r,o){return await new Promise((a,n)=>{this.realFs.fchown(e,r,o,this.makeCallback(a,n))})}fchownSync(e,r,o){return this.realFs.fchownSync(e,r,o)}async chownPromise(e,r,o){return await new Promise((a,n)=>{this.realFs.chown(Ae.fromPortablePath(e),r,o,this.makeCallback(a,n))})}chownSync(e,r,o){return this.realFs.chownSync(Ae.fromPortablePath(e),r,o)}async renamePromise(e,r){return await new Promise((o,a)=>{this.realFs.rename(Ae.fromPortablePath(e),Ae.fromPortablePath(r),this.makeCallback(o,a))})}renameSync(e,r){return this.realFs.renameSync(Ae.fromPortablePath(e),Ae.fromPortablePath(r))}async copyFilePromise(e,r,o=0){return await new Promise((a,n)=>{this.realFs.copyFile(Ae.fromPortablePath(e),Ae.fromPortablePath(r),o,this.makeCallback(a,n))})}copyFileSync(e,r,o=0){return this.realFs.copyFileSync(Ae.fromPortablePath(e),Ae.fromPortablePath(r),o)}async appendFilePromise(e,r,o){return await new Promise((a,n)=>{let u=typeof e=="string"?Ae.fromPortablePath(e):e;o?this.realFs.appendFile(u,r,o,this.makeCallback(a,n)):this.realFs.appendFile(u,r,this.makeCallback(a,n))})}appendFileSync(e,r,o){let a=typeof e=="string"?Ae.fromPortablePath(e):e;o?this.realFs.appendFileSync(a,r,o):this.realFs.appendFileSync(a,r)}async writeFilePromise(e,r,o){return await new Promise((a,n)=>{let u=typeof e=="string"?Ae.fromPortablePath(e):e;o?this.realFs.writeFile(u,r,o,this.makeCallback(a,n)):this.realFs.writeFile(u,r,this.makeCallback(a,n))})}writeFileSync(e,r,o){let a=typeof e=="string"?Ae.fromPortablePath(e):e;o?this.realFs.writeFileSync(a,r,o):this.realFs.writeFileSync(a,r)}async unlinkPromise(e){return await new Promise((r,o)=>{this.realFs.unlink(Ae.fromPortablePath(e),this.makeCallback(r,o))})}unlinkSync(e){return this.realFs.unlinkSync(Ae.fromPortablePath(e))}async utimesPromise(e,r,o){return await new Promise((a,n)=>{this.realFs.utimes(Ae.fromPortablePath(e),r,o,this.makeCallback(a,n))})}utimesSync(e,r,o){this.realFs.utimesSync(Ae.fromPortablePath(e),r,o)}async lutimesPromise(e,r,o){return await new Promise((a,n)=>{this.realFs.lutimes(Ae.fromPortablePath(e),r,o,this.makeCallback(a,n))})}lutimesSync(e,r,o){this.realFs.lutimesSync(Ae.fromPortablePath(e),r,o)}async mkdirPromise(e,r){return await new Promise((o,a)=>{this.realFs.mkdir(Ae.fromPortablePath(e),r,this.makeCallback(o,a))})}mkdirSync(e,r){return this.realFs.mkdirSync(Ae.fromPortablePath(e),r)}async rmdirPromise(e,r){return await new Promise((o,a)=>{r?this.realFs.rmdir(Ae.fromPortablePath(e),r,this.makeCallback(o,a)):this.realFs.rmdir(Ae.fromPortablePath(e),this.makeCallback(o,a))})}rmdirSync(e,r){return this.realFs.rmdirSync(Ae.fromPortablePath(e),r)}async rmPromise(e,r){return await new Promise((o,a)=>{r?this.realFs.rm(Ae.fromPortablePath(e),r,this.makeCallback(o,a)):this.realFs.rm(Ae.fromPortablePath(e),this.makeCallback(o,a))})}rmSync(e,r){return this.realFs.rmSync(Ae.fromPortablePath(e),r)}async linkPromise(e,r){return await new Promise((o,a)=>{this.realFs.link(Ae.fromPortablePath(e),Ae.fromPortablePath(r),this.makeCallback(o,a))})}linkSync(e,r){return this.realFs.linkSync(Ae.fromPortablePath(e),Ae.fromPortablePath(r))}async symlinkPromise(e,r,o){return await new Promise((a,n)=>{this.realFs.symlink(Ae.fromPortablePath(e.replace(/\/+$/,"")),Ae.fromPortablePath(r),o,this.makeCallback(a,n))})}symlinkSync(e,r,o){return this.realFs.symlinkSync(Ae.fromPortablePath(e.replace(/\/+$/,"")),Ae.fromPortablePath(r),o)}async readFilePromise(e,r){return await new Promise((o,a)=>{let n=typeof e=="string"?Ae.fromPortablePath(e):e;this.realFs.readFile(n,r,this.makeCallback(o,a))})}readFileSync(e,r){let o=typeof e=="string"?Ae.fromPortablePath(e):e;return this.realFs.readFileSync(o,r)}async readdirPromise(e,r){return await new Promise((o,a)=>{r?r.recursive&&process.platform==="win32"?r.withFileTypes?this.realFs.readdir(Ae.fromPortablePath(e),r,this.makeCallback(n=>o(n.map(BW)),a)):this.realFs.readdir(Ae.fromPortablePath(e),r,this.makeCallback(n=>o(n.map(Ae.toPortablePath)),a)):this.realFs.readdir(Ae.fromPortablePath(e),r,this.makeCallback(o,a)):this.realFs.readdir(Ae.fromPortablePath(e),this.makeCallback(o,a))})}readdirSync(e,r){return r?r.recursive&&process.platform==="win32"?r.withFileTypes?this.realFs.readdirSync(Ae.fromPortablePath(e),r).map(BW):this.realFs.readdirSync(Ae.fromPortablePath(e),r).map(Ae.toPortablePath):this.realFs.readdirSync(Ae.fromPortablePath(e),r):this.realFs.readdirSync(Ae.fromPortablePath(e))}async readlinkPromise(e){return await new Promise((r,o)=>{this.realFs.readlink(Ae.fromPortablePath(e),this.makeCallback(r,o))}).then(r=>Ae.toPortablePath(r))}readlinkSync(e){return Ae.toPortablePath(this.realFs.readlinkSync(Ae.fromPortablePath(e)))}async truncatePromise(e,r){return await new Promise((o,a)=>{this.realFs.truncate(Ae.fromPortablePath(e),r,this.makeCallback(o,a))})}truncateSync(e,r){return this.realFs.truncateSync(Ae.fromPortablePath(e),r)}async ftruncatePromise(e,r){return await new Promise((o,a)=>{this.realFs.ftruncate(e,r,this.makeCallback(o,a))})}ftruncateSync(e,r){return this.realFs.ftruncateSync(e,r)}watch(e,r,o){return this.realFs.watch(Ae.fromPortablePath(e),r,o)}watchFile(e,r,o){return this.realFs.watchFile(Ae.fromPortablePath(e),r,o)}unwatchFile(e,r){return this.realFs.unwatchFile(Ae.fromPortablePath(e),r)}makeCallback(e,r){return(o,a)=>{o?r(o):e(a)}}}});var En,DW=It(()=>{Y0();gf();Ba();En=class extends ws{constructor(e,{baseFs:r=new _n}={}){super(V),this.target=this.pathUtils.normalize(e),this.baseFs=r}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.target)}resolve(e){return this.pathUtils.isAbsolute(e)?V.normalize(e):this.baseFs.resolve(V.join(this.target,e))}mapFromBase(e){return e}mapToBase(e){return this.pathUtils.isAbsolute(e)?e:this.pathUtils.join(this.target,e)}}});var SW,Gu,PW=It(()=>{Y0();gf();Ba();SW=Bt.root,Gu=class extends ws{constructor(e,{baseFs:r=new _n}={}){super(V),this.target=this.pathUtils.resolve(Bt.root,e),this.baseFs=r}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.pathUtils.relative(Bt.root,this.target))}getTarget(){return this.target}getBaseFs(){return this.baseFs}mapToBase(e){let r=this.pathUtils.normalize(e);if(this.pathUtils.isAbsolute(e))return this.pathUtils.resolve(this.target,this.pathUtils.relative(SW,e));if(r.match(/^\.\.\/?/))throw new Error(`Resolving this path (${e}) would escape the jail`);return this.pathUtils.resolve(this.target,e)}mapFromBase(e){return this.pathUtils.resolve(SW,this.pathUtils.relative(this.target,e))}}});var Am,xW=It(()=>{gf();Am=class extends ws{constructor(r,o){super(o);this.instance=null;this.factory=r}get baseFs(){return this.instance||(this.instance=this.factory()),this.instance}set baseFs(r){this.instance=r}mapFromBase(r){return r}mapToBase(r){return r}}});var V0,va,Gp,bW=It(()=>{V0=ve("fs");W0();Y0();DT();zD();Ba();va=4278190080,Gp=class extends qu{constructor({baseFs:r=new _n,filter:o=null,magicByte:a=42,maxOpenFiles:n=1/0,useCache:u=!0,maxAge:A=5e3,typeCheck:p=V0.constants.S_IFREG,getMountPoint:h,factoryPromise:E,factorySync:w}){if(Math.floor(a)!==a||!(a>1&&a<=127))throw new Error("The magic byte must be set to a round value between 1 and 127 included");super();this.fdMap=new Map;this.nextFd=3;this.isMount=new Set;this.notMount=new Set;this.realPaths=new Map;this.limitOpenFilesTimeout=null;this.baseFs=r,this.mountInstances=u?new Map:null,this.factoryPromise=E,this.factorySync=w,this.filter=o,this.getMountPoint=h,this.magic=a<<24,this.maxAge=A,this.maxOpenFiles=n,this.typeCheck=p}getExtractHint(r){return this.baseFs.getExtractHint(r)}getRealPath(){return this.baseFs.getRealPath()}saveAndClose(){if(j0(this),this.mountInstances)for(let[r,{childFs:o}]of this.mountInstances.entries())o.saveAndClose?.(),this.mountInstances.delete(r)}discardAndClose(){if(j0(this),this.mountInstances)for(let[r,{childFs:o}]of this.mountInstances.entries())o.discardAndClose?.(),this.mountInstances.delete(r)}resolve(r){return this.baseFs.resolve(r)}remapFd(r,o){let a=this.nextFd++|this.magic;return this.fdMap.set(a,[r,o]),a}async openPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.openPromise(r,o,a),async(n,{subPath:u})=>this.remapFd(n,await n.openPromise(u,o,a)))}openSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.openSync(r,o,a),(n,{subPath:u})=>this.remapFd(n,n.openSync(u,o,a)))}async opendirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.opendirPromise(r,o),async(a,{subPath:n})=>await a.opendirPromise(n,o),{requireSubpath:!1})}opendirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.opendirSync(r,o),(a,{subPath:n})=>a.opendirSync(n,o),{requireSubpath:!1})}async readPromise(r,o,a,n,u){if((r&va)!==this.magic)return await this.baseFs.readPromise(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw ho("read");let[p,h]=A;return await p.readPromise(h,o,a,n,u)}readSync(r,o,a,n,u){if((r&va)!==this.magic)return this.baseFs.readSync(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw ho("readSync");let[p,h]=A;return p.readSync(h,o,a,n,u)}async writePromise(r,o,a,n,u){if((r&va)!==this.magic)return typeof o=="string"?await this.baseFs.writePromise(r,o,a):await this.baseFs.writePromise(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw ho("write");let[p,h]=A;return typeof o=="string"?await p.writePromise(h,o,a):await p.writePromise(h,o,a,n,u)}writeSync(r,o,a,n,u){if((r&va)!==this.magic)return typeof o=="string"?this.baseFs.writeSync(r,o,a):this.baseFs.writeSync(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw ho("writeSync");let[p,h]=A;return typeof o=="string"?p.writeSync(h,o,a):p.writeSync(h,o,a,n,u)}async closePromise(r){if((r&va)!==this.magic)return await this.baseFs.closePromise(r);let o=this.fdMap.get(r);if(typeof o>"u")throw ho("close");this.fdMap.delete(r);let[a,n]=o;return await a.closePromise(n)}closeSync(r){if((r&va)!==this.magic)return this.baseFs.closeSync(r);let o=this.fdMap.get(r);if(typeof o>"u")throw ho("closeSync");this.fdMap.delete(r);let[a,n]=o;return a.closeSync(n)}createReadStream(r,o){return r===null?this.baseFs.createReadStream(r,o):this.makeCallSync(r,()=>this.baseFs.createReadStream(r,o),(a,{archivePath:n,subPath:u})=>{let A=a.createReadStream(u,o);return A.path=Ae.fromPortablePath(this.pathUtils.join(n,u)),A})}createWriteStream(r,o){return r===null?this.baseFs.createWriteStream(r,o):this.makeCallSync(r,()=>this.baseFs.createWriteStream(r,o),(a,{subPath:n})=>a.createWriteStream(n,o))}async realpathPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.realpathPromise(r),async(o,{archivePath:a,subPath:n})=>{let u=this.realPaths.get(a);return typeof u>"u"&&(u=await this.baseFs.realpathPromise(a),this.realPaths.set(a,u)),this.pathUtils.join(u,this.pathUtils.relative(Bt.root,await o.realpathPromise(n)))})}realpathSync(r){return this.makeCallSync(r,()=>this.baseFs.realpathSync(r),(o,{archivePath:a,subPath:n})=>{let u=this.realPaths.get(a);return typeof u>"u"&&(u=this.baseFs.realpathSync(a),this.realPaths.set(a,u)),this.pathUtils.join(u,this.pathUtils.relative(Bt.root,o.realpathSync(n)))})}async existsPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.existsPromise(r),async(o,{subPath:a})=>await o.existsPromise(a))}existsSync(r){return this.makeCallSync(r,()=>this.baseFs.existsSync(r),(o,{subPath:a})=>o.existsSync(a))}async accessPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.accessPromise(r,o),async(a,{subPath:n})=>await a.accessPromise(n,o))}accessSync(r,o){return this.makeCallSync(r,()=>this.baseFs.accessSync(r,o),(a,{subPath:n})=>a.accessSync(n,o))}async statPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.statPromise(r,o),async(a,{subPath:n})=>await a.statPromise(n,o))}statSync(r,o){return this.makeCallSync(r,()=>this.baseFs.statSync(r,o),(a,{subPath:n})=>a.statSync(n,o))}async fstatPromise(r,o){if((r&va)!==this.magic)return this.baseFs.fstatPromise(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw ho("fstat");let[n,u]=a;return n.fstatPromise(u,o)}fstatSync(r,o){if((r&va)!==this.magic)return this.baseFs.fstatSync(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw ho("fstatSync");let[n,u]=a;return n.fstatSync(u,o)}async lstatPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.lstatPromise(r,o),async(a,{subPath:n})=>await a.lstatPromise(n,o))}lstatSync(r,o){return this.makeCallSync(r,()=>this.baseFs.lstatSync(r,o),(a,{subPath:n})=>a.lstatSync(n,o))}async fchmodPromise(r,o){if((r&va)!==this.magic)return this.baseFs.fchmodPromise(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw ho("fchmod");let[n,u]=a;return n.fchmodPromise(u,o)}fchmodSync(r,o){if((r&va)!==this.magic)return this.baseFs.fchmodSync(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw ho("fchmodSync");let[n,u]=a;return n.fchmodSync(u,o)}async chmodPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.chmodPromise(r,o),async(a,{subPath:n})=>await a.chmodPromise(n,o))}chmodSync(r,o){return this.makeCallSync(r,()=>this.baseFs.chmodSync(r,o),(a,{subPath:n})=>a.chmodSync(n,o))}async fchownPromise(r,o,a){if((r&va)!==this.magic)return this.baseFs.fchownPromise(r,o,a);let n=this.fdMap.get(r);if(typeof n>"u")throw ho("fchown");let[u,A]=n;return u.fchownPromise(A,o,a)}fchownSync(r,o,a){if((r&va)!==this.magic)return this.baseFs.fchownSync(r,o,a);let n=this.fdMap.get(r);if(typeof n>"u")throw ho("fchownSync");let[u,A]=n;return u.fchownSync(A,o,a)}async chownPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.chownPromise(r,o,a),async(n,{subPath:u})=>await n.chownPromise(u,o,a))}chownSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.chownSync(r,o,a),(n,{subPath:u})=>n.chownSync(u,o,a))}async renamePromise(r,o){return await this.makeCallPromise(r,async()=>await this.makeCallPromise(o,async()=>await this.baseFs.renamePromise(r,o),async()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})}),async(a,{subPath:n})=>await this.makeCallPromise(o,async()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})},async(u,{subPath:A})=>{if(a!==u)throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"});return await a.renamePromise(n,A)}))}renameSync(r,o){return this.makeCallSync(r,()=>this.makeCallSync(o,()=>this.baseFs.renameSync(r,o),()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})}),(a,{subPath:n})=>this.makeCallSync(o,()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})},(u,{subPath:A})=>{if(a!==u)throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"});return a.renameSync(n,A)}))}async copyFilePromise(r,o,a=0){let n=async(u,A,p,h)=>{if(a&V0.constants.COPYFILE_FICLONE_FORCE)throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${A}' -> ${h}'`),{code:"EXDEV"});if(a&V0.constants.COPYFILE_EXCL&&await this.existsPromise(A))throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${A}' -> '${h}'`),{code:"EEXIST"});let E;try{E=await u.readFilePromise(A)}catch{throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${A}' -> '${h}'`),{code:"EINVAL"})}await p.writeFilePromise(h,E)};return await this.makeCallPromise(r,async()=>await this.makeCallPromise(o,async()=>await this.baseFs.copyFilePromise(r,o,a),async(u,{subPath:A})=>await n(this.baseFs,r,u,A)),async(u,{subPath:A})=>await this.makeCallPromise(o,async()=>await n(u,A,this.baseFs,o),async(p,{subPath:h})=>u!==p?await n(u,A,p,h):await u.copyFilePromise(A,h,a)))}copyFileSync(r,o,a=0){let n=(u,A,p,h)=>{if(a&V0.constants.COPYFILE_FICLONE_FORCE)throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${A}' -> ${h}'`),{code:"EXDEV"});if(a&V0.constants.COPYFILE_EXCL&&this.existsSync(A))throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${A}' -> '${h}'`),{code:"EEXIST"});let E;try{E=u.readFileSync(A)}catch{throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${A}' -> '${h}'`),{code:"EINVAL"})}p.writeFileSync(h,E)};return this.makeCallSync(r,()=>this.makeCallSync(o,()=>this.baseFs.copyFileSync(r,o,a),(u,{subPath:A})=>n(this.baseFs,r,u,A)),(u,{subPath:A})=>this.makeCallSync(o,()=>n(u,A,this.baseFs,o),(p,{subPath:h})=>u!==p?n(u,A,p,h):u.copyFileSync(A,h,a)))}async appendFilePromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.appendFilePromise(r,o,a),async(n,{subPath:u})=>await n.appendFilePromise(u,o,a))}appendFileSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.appendFileSync(r,o,a),(n,{subPath:u})=>n.appendFileSync(u,o,a))}async writeFilePromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.writeFilePromise(r,o,a),async(n,{subPath:u})=>await n.writeFilePromise(u,o,a))}writeFileSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.writeFileSync(r,o,a),(n,{subPath:u})=>n.writeFileSync(u,o,a))}async unlinkPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.unlinkPromise(r),async(o,{subPath:a})=>await o.unlinkPromise(a))}unlinkSync(r){return this.makeCallSync(r,()=>this.baseFs.unlinkSync(r),(o,{subPath:a})=>o.unlinkSync(a))}async utimesPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.utimesPromise(r,o,a),async(n,{subPath:u})=>await n.utimesPromise(u,o,a))}utimesSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.utimesSync(r,o,a),(n,{subPath:u})=>n.utimesSync(u,o,a))}async lutimesPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.lutimesPromise(r,o,a),async(n,{subPath:u})=>await n.lutimesPromise(u,o,a))}lutimesSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.lutimesSync(r,o,a),(n,{subPath:u})=>n.lutimesSync(u,o,a))}async mkdirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.mkdirPromise(r,o),async(a,{subPath:n})=>await a.mkdirPromise(n,o))}mkdirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.mkdirSync(r,o),(a,{subPath:n})=>a.mkdirSync(n,o))}async rmdirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.rmdirPromise(r,o),async(a,{subPath:n})=>await a.rmdirPromise(n,o))}rmdirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.rmdirSync(r,o),(a,{subPath:n})=>a.rmdirSync(n,o))}async rmPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.rmPromise(r,o),async(a,{subPath:n})=>await a.rmPromise(n,o))}rmSync(r,o){return this.makeCallSync(r,()=>this.baseFs.rmSync(r,o),(a,{subPath:n})=>a.rmSync(n,o))}async linkPromise(r,o){return await this.makeCallPromise(o,async()=>await this.baseFs.linkPromise(r,o),async(a,{subPath:n})=>await a.linkPromise(r,n))}linkSync(r,o){return this.makeCallSync(o,()=>this.baseFs.linkSync(r,o),(a,{subPath:n})=>a.linkSync(r,n))}async symlinkPromise(r,o,a){return await this.makeCallPromise(o,async()=>await this.baseFs.symlinkPromise(r,o,a),async(n,{subPath:u})=>await n.symlinkPromise(r,u))}symlinkSync(r,o,a){return this.makeCallSync(o,()=>this.baseFs.symlinkSync(r,o,a),(n,{subPath:u})=>n.symlinkSync(r,u))}async readFilePromise(r,o){return this.makeCallPromise(r,async()=>await this.baseFs.readFilePromise(r,o),async(a,{subPath:n})=>await a.readFilePromise(n,o))}readFileSync(r,o){return this.makeCallSync(r,()=>this.baseFs.readFileSync(r,o),(a,{subPath:n})=>a.readFileSync(n,o))}async readdirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.readdirPromise(r,o),async(a,{subPath:n})=>await a.readdirPromise(n,o),{requireSubpath:!1})}readdirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.readdirSync(r,o),(a,{subPath:n})=>a.readdirSync(n,o),{requireSubpath:!1})}async readlinkPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.readlinkPromise(r),async(o,{subPath:a})=>await o.readlinkPromise(a))}readlinkSync(r){return this.makeCallSync(r,()=>this.baseFs.readlinkSync(r),(o,{subPath:a})=>o.readlinkSync(a))}async truncatePromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.truncatePromise(r,o),async(a,{subPath:n})=>await a.truncatePromise(n,o))}truncateSync(r,o){return this.makeCallSync(r,()=>this.baseFs.truncateSync(r,o),(a,{subPath:n})=>a.truncateSync(n,o))}async ftruncatePromise(r,o){if((r&va)!==this.magic)return this.baseFs.ftruncatePromise(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw ho("ftruncate");let[n,u]=a;return n.ftruncatePromise(u,o)}ftruncateSync(r,o){if((r&va)!==this.magic)return this.baseFs.ftruncateSync(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw ho("ftruncateSync");let[n,u]=a;return n.ftruncateSync(u,o)}watch(r,o,a){return this.makeCallSync(r,()=>this.baseFs.watch(r,o,a),(n,{subPath:u})=>n.watch(u,o,a))}watchFile(r,o,a){return this.makeCallSync(r,()=>this.baseFs.watchFile(r,o,a),()=>um(this,r,o,a))}unwatchFile(r,o){return this.makeCallSync(r,()=>this.baseFs.unwatchFile(r,o),()=>q0(this,r,o))}async makeCallPromise(r,o,a,{requireSubpath:n=!0}={}){if(typeof r!="string")return await o();let u=this.resolve(r),A=this.findMount(u);return A?n&&A.subPath==="/"?await o():await this.getMountPromise(A.archivePath,async p=>await a(p,A)):await o()}makeCallSync(r,o,a,{requireSubpath:n=!0}={}){if(typeof r!="string")return o();let u=this.resolve(r),A=this.findMount(u);return!A||n&&A.subPath==="/"?o():this.getMountSync(A.archivePath,p=>a(p,A))}findMount(r){if(this.filter&&!this.filter.test(r))return null;let o="";for(;;){let a=r.substring(o.length),n=this.getMountPoint(a,o);if(!n)return null;if(o=this.pathUtils.join(o,n),!this.isMount.has(o)){if(this.notMount.has(o))continue;try{if(this.typeCheck!==null&&(this.baseFs.statSync(o).mode&V0.constants.S_IFMT)!==this.typeCheck){this.notMount.add(o);continue}}catch{return null}this.isMount.add(o)}return{archivePath:o,subPath:this.pathUtils.join(Bt.root,r.substring(o.length))}}}limitOpenFiles(r){if(this.mountInstances===null)return;let o=Date.now(),a=o+this.maxAge,n=r===null?0:this.mountInstances.size-r;for(let[u,{childFs:A,expiresAt:p,refCount:h}]of this.mountInstances.entries())if(!(h!==0||A.hasOpenFileHandles?.())){if(o>=p){A.saveAndClose?.(),this.mountInstances.delete(u),n-=1;continue}else if(r===null||n<=0){a=p;break}A.saveAndClose?.(),this.mountInstances.delete(u),n-=1}this.limitOpenFilesTimeout===null&&(r===null&&this.mountInstances.size>0||r!==null)&&isFinite(a)&&(this.limitOpenFilesTimeout=setTimeout(()=>{this.limitOpenFilesTimeout=null,this.limitOpenFiles(null)},a-o).unref())}async getMountPromise(r,o){if(this.mountInstances){let a=this.mountInstances.get(r);if(!a){let n=await this.factoryPromise(this.baseFs,r);a=this.mountInstances.get(r),a||(a={childFs:n(),expiresAt:0,refCount:0})}this.mountInstances.delete(r),this.limitOpenFiles(this.maxOpenFiles-1),this.mountInstances.set(r,a),a.expiresAt=Date.now()+this.maxAge,a.refCount+=1;try{return await o(a.childFs)}finally{a.refCount-=1}}else{let a=(await this.factoryPromise(this.baseFs,r))();try{return await o(a)}finally{a.saveAndClose?.()}}}getMountSync(r,o){if(this.mountInstances){let a=this.mountInstances.get(r);return a||(a={childFs:this.factorySync(this.baseFs,r),expiresAt:0,refCount:0}),this.mountInstances.delete(r),this.limitOpenFiles(this.maxOpenFiles-1),this.mountInstances.set(r,a),a.expiresAt=Date.now()+this.maxAge,o(a.childFs)}else{let a=this.factorySync(this.baseFs,r);try{return o(a)}finally{a.saveAndClose?.()}}}}});var $t,nS,kW=It(()=>{W0();Ba();$t=()=>Object.assign(new Error("ENOSYS: unsupported filesystem access"),{code:"ENOSYS"}),nS=class t extends hf{static{this.instance=new t}constructor(){super(V)}getExtractHint(){throw $t()}getRealPath(){throw $t()}resolve(){throw $t()}async openPromise(){throw $t()}openSync(){throw $t()}async opendirPromise(){throw $t()}opendirSync(){throw $t()}async readPromise(){throw $t()}readSync(){throw $t()}async writePromise(){throw $t()}writeSync(){throw $t()}async closePromise(){throw $t()}closeSync(){throw $t()}createWriteStream(){throw $t()}createReadStream(){throw $t()}async realpathPromise(){throw $t()}realpathSync(){throw $t()}async readdirPromise(){throw $t()}readdirSync(){throw $t()}async existsPromise(e){throw $t()}existsSync(e){throw $t()}async accessPromise(){throw $t()}accessSync(){throw $t()}async statPromise(){throw $t()}statSync(){throw $t()}async fstatPromise(e){throw $t()}fstatSync(e){throw $t()}async lstatPromise(e){throw $t()}lstatSync(e){throw $t()}async fchmodPromise(){throw $t()}fchmodSync(){throw $t()}async chmodPromise(){throw $t()}chmodSync(){throw $t()}async fchownPromise(){throw $t()}fchownSync(){throw $t()}async chownPromise(){throw $t()}chownSync(){throw $t()}async mkdirPromise(){throw $t()}mkdirSync(){throw $t()}async rmdirPromise(){throw $t()}rmdirSync(){throw $t()}async rmPromise(){throw $t()}rmSync(){throw $t()}async linkPromise(){throw $t()}linkSync(){throw $t()}async symlinkPromise(){throw $t()}symlinkSync(){throw $t()}async renamePromise(){throw $t()}renameSync(){throw $t()}async copyFilePromise(){throw $t()}copyFileSync(){throw $t()}async appendFilePromise(){throw $t()}appendFileSync(){throw $t()}async writeFilePromise(){throw $t()}writeFileSync(){throw $t()}async unlinkPromise(){throw $t()}unlinkSync(){throw $t()}async utimesPromise(){throw $t()}utimesSync(){throw $t()}async lutimesPromise(){throw $t()}lutimesSync(){throw $t()}async readFilePromise(){throw $t()}readFileSync(){throw $t()}async readlinkPromise(){throw $t()}readlinkSync(){throw $t()}async truncatePromise(){throw $t()}truncateSync(){throw $t()}async ftruncatePromise(e,r){throw $t()}ftruncateSync(e,r){throw $t()}watch(){throw $t()}watchFile(){throw $t()}unwatchFile(){throw $t()}}});var Wp,QW=It(()=>{gf();Ba();Wp=class extends ws{constructor(e){super(Ae),this.baseFs=e}mapFromBase(e){return Ae.fromPortablePath(e)}mapToBase(e){return Ae.toPortablePath(e)}}});var C_e,ST,I_e,qs,FW=It(()=>{Y0();gf();Ba();C_e=/^[0-9]+$/,ST=/^(\/(?:[^/]+\/)*?(?:\$\$virtual|__virtual__))((?:\/((?:[^/]+-)?[a-f0-9]+)(?:\/([^/]+))?)?((?:\/.*)?))$/,I_e=/^([^/]+-)?[a-f0-9]+$/,qs=class t extends ws{static makeVirtualPath(e,r,o){if(V.basename(e)!=="__virtual__")throw new Error('Assertion failed: Virtual folders must be named "__virtual__"');if(!V.basename(r).match(I_e))throw new Error("Assertion failed: Virtual components must be ended by an hexadecimal hash");let n=V.relative(V.dirname(e),o).split("/"),u=0;for(;u{PT=et(ve("buffer")),RW=ve("url"),TW=ve("util");gf();Ba();iS=class extends ws{constructor(e){super(Ae),this.baseFs=e}mapFromBase(e){return e}mapToBase(e){if(typeof e=="string")return e;if(e instanceof URL)return(0,RW.fileURLToPath)(e);if(Buffer.isBuffer(e)){let r=e.toString();if(!w_e(e,r))throw new Error("Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942");return r}throw new Error(`Unsupported path type: ${(0,TW.inspect)(e)}`)}}});var _W,go,df,Yp,sS,oS,fm,_c,Hc,NW,OW,MW,UW,cw,HW=It(()=>{_W=ve("readline"),go=Symbol("kBaseFs"),df=Symbol("kFd"),Yp=Symbol("kClosePromise"),sS=Symbol("kCloseResolve"),oS=Symbol("kCloseReject"),fm=Symbol("kRefs"),_c=Symbol("kRef"),Hc=Symbol("kUnref"),cw=class{constructor(e,r){this[UW]=1;this[MW]=void 0;this[OW]=void 0;this[NW]=void 0;this[go]=r,this[df]=e}get fd(){return this[df]}async appendFile(e,r){try{this[_c](this.appendFile);let o=(typeof r=="string"?r:r?.encoding)??void 0;return await this[go].appendFilePromise(this.fd,e,o?{encoding:o}:void 0)}finally{this[Hc]()}}async chown(e,r){try{return this[_c](this.chown),await this[go].fchownPromise(this.fd,e,r)}finally{this[Hc]()}}async chmod(e){try{return this[_c](this.chmod),await this[go].fchmodPromise(this.fd,e)}finally{this[Hc]()}}createReadStream(e){return this[go].createReadStream(null,{...e,fd:this.fd})}createWriteStream(e){return this[go].createWriteStream(null,{...e,fd:this.fd})}datasync(){throw new Error("Method not implemented.")}sync(){throw new Error("Method not implemented.")}async read(e,r,o,a){try{this[_c](this.read);let n;return Buffer.isBuffer(e)?n=e:(e??={},n=e.buffer??Buffer.alloc(16384),r=e.offset||0,o=e.length??n.byteLength,a=e.position??null),r??=0,o??=0,o===0?{bytesRead:o,buffer:n}:{bytesRead:await this[go].readPromise(this.fd,n,r,o,a),buffer:n}}finally{this[Hc]()}}async readFile(e){try{this[_c](this.readFile);let r=(typeof e=="string"?e:e?.encoding)??void 0;return await this[go].readFilePromise(this.fd,r)}finally{this[Hc]()}}readLines(e){return(0,_W.createInterface)({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){try{return this[_c](this.stat),await this[go].fstatPromise(this.fd,e)}finally{this[Hc]()}}async truncate(e){try{return this[_c](this.truncate),await this[go].ftruncatePromise(this.fd,e)}finally{this[Hc]()}}utimes(e,r){throw new Error("Method not implemented.")}async writeFile(e,r){try{this[_c](this.writeFile);let o=(typeof r=="string"?r:r?.encoding)??void 0;await this[go].writeFilePromise(this.fd,e,o)}finally{this[Hc]()}}async write(...e){try{if(this[_c](this.write),ArrayBuffer.isView(e[0])){let[r,o,a,n]=e;return{bytesWritten:await this[go].writePromise(this.fd,r,o??void 0,a??void 0,n??void 0),buffer:r}}else{let[r,o,a]=e;return{bytesWritten:await this[go].writePromise(this.fd,r,o,a),buffer:r}}}finally{this[Hc]()}}async writev(e,r){try{this[_c](this.writev);let o=0;if(typeof r<"u")for(let a of e){let n=await this.write(a,void 0,void 0,r);o+=n.bytesWritten,r+=n.bytesWritten}else for(let a of e){let n=await this.write(a);o+=n.bytesWritten}return{buffers:e,bytesWritten:o}}finally{this[Hc]()}}readv(e,r){throw new Error("Method not implemented.")}close(){if(this[df]===-1)return Promise.resolve();if(this[Yp])return this[Yp];if(this[fm]--,this[fm]===0){let e=this[df];this[df]=-1,this[Yp]=this[go].closePromise(e).finally(()=>{this[Yp]=void 0})}else this[Yp]=new Promise((e,r)=>{this[sS]=e,this[oS]=r}).finally(()=>{this[Yp]=void 0,this[oS]=void 0,this[sS]=void 0});return this[Yp]}[(go,df,UW=fm,MW=Yp,OW=sS,NW=oS,_c)](e){if(this[df]===-1){let r=new Error("file closed");throw r.code="EBADF",r.syscall=e.name,r}this[fm]++}[Hc](){if(this[fm]--,this[fm]===0){let e=this[df];this[df]=-1,this[go].closePromise(e).then(this[sS],this[oS])}}}});function uw(t,e){e=new iS(e);let r=(o,a,n)=>{let u=o[a];o[a]=n,typeof u?.[pm.promisify.custom]<"u"&&(n[pm.promisify.custom]=u[pm.promisify.custom])};{r(t,"exists",(o,...a)=>{let u=typeof a[a.length-1]=="function"?a.pop():()=>{};process.nextTick(()=>{e.existsPromise(o).then(A=>{u(A)},()=>{u(!1)})})}),r(t,"read",(...o)=>{let[a,n,u,A,p,h]=o;if(o.length<=3){let E={};o.length<3?h=o[1]:(E=o[1],h=o[2]),{buffer:n=Buffer.alloc(16384),offset:u=0,length:A=n.byteLength,position:p}=E}if(u==null&&(u=0),A|=0,A===0){process.nextTick(()=>{h(null,0,n)});return}p==null&&(p=-1),process.nextTick(()=>{e.readPromise(a,n,u,A,p).then(E=>{h(null,E,n)},E=>{h(E,0,n)})})});for(let o of qW){let a=o.replace(/Promise$/,"");if(typeof t[a]>"u")continue;let n=e[o];if(typeof n>"u")continue;r(t,a,(...A)=>{let h=typeof A[A.length-1]=="function"?A.pop():()=>{};process.nextTick(()=>{n.apply(e,A).then(E=>{h(null,E)},E=>{h(E)})})})}t.realpath.native=t.realpath}{r(t,"existsSync",o=>{try{return e.existsSync(o)}catch{return!1}}),r(t,"readSync",(...o)=>{let[a,n,u,A,p]=o;return o.length<=3&&({offset:u=0,length:A=n.byteLength,position:p}=o[2]||{}),u==null&&(u=0),A|=0,A===0?0:(p==null&&(p=-1),e.readSync(a,n,u,A,p))});for(let o of B_e){let a=o;if(typeof t[a]>"u")continue;let n=e[o];typeof n>"u"||r(t,a,n.bind(e))}t.realpathSync.native=t.realpathSync}{let o=t.promises;for(let a of qW){let n=a.replace(/Promise$/,"");if(typeof o[n]>"u")continue;let u=e[a];typeof u>"u"||a!=="open"&&r(o,n,(A,...p)=>A instanceof cw?A[n].apply(A,p):u.call(e,A,...p))}r(o,"open",async(...a)=>{let n=await e.openPromise(...a);return new cw(n,e)})}t.read[pm.promisify.custom]=async(o,a,...n)=>({bytesRead:await e.readPromise(o,a,...n),buffer:a}),t.write[pm.promisify.custom]=async(o,a,...n)=>({bytesWritten:await e.writePromise(o,a,...n),buffer:a})}function aS(t,e){let r=Object.create(t);return uw(r,e),r}var pm,B_e,qW,jW=It(()=>{pm=ve("util");LW();HW();B_e=new Set(["accessSync","appendFileSync","createReadStream","createWriteStream","chmodSync","fchmodSync","chownSync","fchownSync","closeSync","copyFileSync","linkSync","lstatSync","fstatSync","lutimesSync","mkdirSync","openSync","opendirSync","readlinkSync","readFileSync","readdirSync","readlinkSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","ftruncateSync","unlinkSync","unwatchFile","utimesSync","watch","watchFile","writeFileSync","writeSync"]),qW=new Set(["accessPromise","appendFilePromise","fchmodPromise","chmodPromise","fchownPromise","chownPromise","closePromise","copyFilePromise","linkPromise","fstatPromise","lstatPromise","lutimesPromise","mkdirPromise","openPromise","opendirPromise","readdirPromise","realpathPromise","readFilePromise","readdirPromise","readlinkPromise","renamePromise","rmdirPromise","rmPromise","statPromise","symlinkPromise","truncatePromise","ftruncatePromise","unlinkPromise","utimesPromise","writeFilePromise","writeSync"])});function GW(t){let e=Math.ceil(Math.random()*4294967296).toString(16).padStart(8,"0");return`${t}${e}`}function WW(){if(xT)return xT;let t=Ae.toPortablePath(YW.default.tmpdir()),e=ae.realpathSync(t);return process.once("exit",()=>{ae.rmtempSync()}),xT={tmpdir:t,realTmpdir:e}}var YW,qc,xT,ae,VW=It(()=>{YW=et(ve("os"));Y0();Ba();qc=new Set,xT=null;ae=Object.assign(new _n,{detachTemp(t){qc.delete(t)},mktempSync(t){let{tmpdir:e,realTmpdir:r}=WW();for(;;){let o=GW("xfs-");try{this.mkdirSync(V.join(e,o))}catch(n){if(n.code==="EEXIST")continue;throw n}let a=V.join(r,o);if(qc.add(a),typeof t>"u")return a;try{return t(a)}finally{if(qc.has(a)){qc.delete(a);try{this.removeSync(a)}catch{}}}}},async mktempPromise(t){let{tmpdir:e,realTmpdir:r}=WW();for(;;){let o=GW("xfs-");try{await this.mkdirPromise(V.join(e,o))}catch(n){if(n.code==="EEXIST")continue;throw n}let a=V.join(r,o);if(qc.add(a),typeof t>"u")return a;try{return await t(a)}finally{if(qc.has(a)){qc.delete(a);try{await this.removePromise(a)}catch{}}}}},async rmtempPromise(){await Promise.all(Array.from(qc.values()).map(async t=>{try{await ae.removePromise(t,{maxRetries:0}),qc.delete(t)}catch{}}))},rmtempSync(){for(let t of qc)try{ae.removeSync(t),qc.delete(t)}catch{}}})});var Aw={};Vt(Aw,{AliasFS:()=>ju,BasePortableFakeFS:()=>qu,CustomDir:()=>lw,CwdFS:()=>En,FakeFS:()=>hf,Filename:()=>mr,JailFS:()=>Gu,LazyFS:()=>Am,MountFS:()=>Gp,NoFS:()=>nS,NodeFS:()=>_n,PortablePath:()=>Bt,PosixFS:()=>Wp,ProxiedFS:()=>ws,VirtualFS:()=>qs,constants:()=>Si,errors:()=>sr,extendFs:()=>aS,normalizeLineEndings:()=>G0,npath:()=>Ae,opendir:()=>eS,patchFs:()=>uw,ppath:()=>V,setupCopyIndex:()=>$D,statUtils:()=>wa,unwatchAllFiles:()=>j0,unwatchFile:()=>q0,watchFile:()=>um,xfs:()=>ae});var St=It(()=>{uW();zD();IT();vT();dW();DT();W0();Ba();Ba();wW();W0();DW();PW();xW();bW();kW();Y0();QW();gf();FW();jW();VW()});var ZW=_((qPt,XW)=>{XW.exports=zW;zW.sync=D_e;var KW=ve("fs");function v_e(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o{rY.exports=eY;eY.sync=S_e;var $W=ve("fs");function eY(t,e,r){$W.stat(t,function(o,a){r(o,o?!1:tY(a,e))})}function S_e(t,e){return tY($W.statSync(t),e)}function tY(t,e){return t.isFile()&&P_e(t,e)}function P_e(t,e){var r=t.mode,o=t.uid,a=t.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),u=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),A=parseInt("100",8),p=parseInt("010",8),h=parseInt("001",8),E=A|p,w=r&h||r&p&&a===u||r&A&&o===n||r&E&&n===0;return w}});var sY=_((WPt,iY)=>{var GPt=ve("fs"),lS;process.platform==="win32"||global.TESTING_WINDOWS?lS=ZW():lS=nY();iY.exports=bT;bT.sync=x_e;function bT(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,a){bT(t,e||{},function(n,u){n?a(n):o(u)})})}lS(t,e||{},function(o,a){o&&(o.code==="EACCES"||e&&e.ignoreErrors)&&(o=null,a=!1),r(o,a)})}function x_e(t,e){try{return lS.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var fY=_((YPt,AY)=>{var hm=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",oY=ve("path"),b_e=hm?";":":",aY=sY(),lY=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),cY=(t,e)=>{let r=e.colon||b_e,o=t.match(/\//)||hm&&t.match(/\\/)?[""]:[...hm?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],a=hm?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=hm?a.split(r):[""];return hm&&t.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:o,pathExt:n,pathExtExe:a}},uY=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:o,pathExt:a,pathExtExe:n}=cY(t,e),u=[],A=h=>new Promise((E,w)=>{if(h===o.length)return e.all&&u.length?E(u):w(lY(t));let D=o[h],b=/^".*"$/.test(D)?D.slice(1,-1):D,C=oY.join(b,t),T=!b&&/^\.[\\\/]/.test(t)?t.slice(0,2)+C:C;E(p(T,h,0))}),p=(h,E,w)=>new Promise((D,b)=>{if(w===a.length)return D(A(E+1));let C=a[w];aY(h+C,{pathExt:n},(T,N)=>{if(!T&&N)if(e.all)u.push(h+C);else return D(h+C);return D(p(h,E,w+1))})});return r?A(0).then(h=>r(null,h),r):A(0)},k_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:o,pathExtExe:a}=cY(t,e),n=[];for(let u=0;u{"use strict";var pY=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};kT.exports=pY;kT.exports.default=pY});var yY=_((KPt,mY)=>{"use strict";var gY=ve("path"),Q_e=fY(),F_e=hY();function dY(t,e){let r=t.options.env||process.env,o=process.cwd(),a=t.options.cwd!=null,n=a&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(t.options.cwd)}catch{}let u;try{u=Q_e.sync(t.command,{path:r[F_e({env:r})],pathExt:e?gY.delimiter:void 0})}catch{}finally{n&&process.chdir(o)}return u&&(u=gY.resolve(a?t.options.cwd:"",u)),u}function R_e(t){return dY(t)||dY(t,!0)}mY.exports=R_e});var EY=_((JPt,FT)=>{"use strict";var QT=/([()\][%!^"`<>&|;, *?])/g;function T_e(t){return t=t.replace(QT,"^$1"),t}function L_e(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(QT,"^$1"),e&&(t=t.replace(QT,"^$1")),t}FT.exports.command=T_e;FT.exports.argument=L_e});var IY=_((zPt,CY)=>{"use strict";CY.exports=/^#!(.*)/});var BY=_((XPt,wY)=>{"use strict";var N_e=IY();wY.exports=(t="")=>{let e=t.match(N_e);if(!e)return null;let[r,o]=e[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return a==="env"?o:o?`${a} ${o}`:a}});var DY=_((ZPt,vY)=>{"use strict";var RT=ve("fs"),O_e=BY();function M_e(t){let r=Buffer.alloc(150),o;try{o=RT.openSync(t,"r"),RT.readSync(o,r,0,150,0),RT.closeSync(o)}catch{}return O_e(r.toString())}vY.exports=M_e});var bY=_(($Pt,xY)=>{"use strict";var U_e=ve("path"),SY=yY(),PY=EY(),__e=DY(),H_e=process.platform==="win32",q_e=/\.(?:com|exe)$/i,j_e=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function G_e(t){t.file=SY(t);let e=t.file&&__e(t.file);return e?(t.args.unshift(t.file),t.command=e,SY(t)):t.file}function W_e(t){if(!H_e)return t;let e=G_e(t),r=!q_e.test(e);if(t.options.forceShell||r){let o=j_e.test(e);t.command=U_e.normalize(t.command),t.command=PY.command(t.command),t.args=t.args.map(n=>PY.argument(n,o));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Y_e(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let o={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?o:W_e(o)}xY.exports=Y_e});var FY=_((ext,QY)=>{"use strict";var TT=process.platform==="win32";function LT(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function V_e(t,e){if(!TT)return;let r=t.emit;t.emit=function(o,a){if(o==="exit"){let n=kY(a,e);if(n)return r.call(t,"error",n)}return r.apply(t,arguments)}}function kY(t,e){return TT&&t===1&&!e.file?LT(e.original,"spawn"):null}function K_e(t,e){return TT&&t===1&&!e.file?LT(e.original,"spawnSync"):null}QY.exports={hookChildProcess:V_e,verifyENOENT:kY,verifyENOENTSync:K_e,notFoundError:LT}});var MT=_((txt,gm)=>{"use strict";var RY=ve("child_process"),NT=bY(),OT=FY();function TY(t,e,r){let o=NT(t,e,r),a=RY.spawn(o.command,o.args,o.options);return OT.hookChildProcess(a,o),a}function J_e(t,e,r){let o=NT(t,e,r),a=RY.spawnSync(o.command,o.args,o.options);return a.error=a.error||OT.verifyENOENTSync(a.status,o),a}gm.exports=TY;gm.exports.spawn=TY;gm.exports.sync=J_e;gm.exports._parse=NT;gm.exports._enoent=OT});var NY=_((rxt,LY)=>{"use strict";function z_e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function K0(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,K0)}z_e(K0,Error);K0.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",w;for(w=0;w0){for(w=1,D=1;w>",P=cr(">>",!1),y=">&",R=cr(">&",!1),z=">",X=cr(">",!1),$="<<<",se=cr("<<<",!1),be="<&",Fe=cr("<&",!1),lt="<",Et=cr("<",!1),qt=function(L){return{type:"argument",segments:[].concat(...L)}},nr=function(L){return L},Pt="$'",cn=cr("$'",!1),Sr="'",yr=cr("'",!1),Rr=function(L){return[{type:"text",text:L}]},Xr='""',$n=cr('""',!1),Xs=function(){return{type:"text",text:""}},Hi='"',Qs=cr('"',!1),Zs=function(L){return L},bi=function(L){return{type:"arithmetic",arithmetic:L,quoted:!0}},Fs=function(L){return{type:"shell",shell:L,quoted:!0}},$s=function(L){return{type:"variable",...L,quoted:!0}},PA=function(L){return{type:"text",text:L}},gu=function(L){return{type:"arithmetic",arithmetic:L,quoted:!1}},op=function(L){return{type:"shell",shell:L,quoted:!1}},ap=function(L){return{type:"variable",...L,quoted:!1}},Rs=function(L){return{type:"glob",pattern:L}},Nn=/^[^']/,hs=Ni(["'"],!0,!1),Ts=function(L){return L.join("")},pc=/^[^$"]/,hc=Ni(["$",'"'],!0,!1),gc=`\\ -`,xA=cr(`\\ -`,!1),bA=function(){return""},Ro="\\",To=cr("\\",!1),kA=/^[\\$"`]/,pr=Ni(["\\","$",'"',"`"],!1,!1),Me=function(L){return L},ia="\\a",dc=cr("\\a",!1),Er=function(){return"a"},du="\\b",QA=cr("\\b",!1),FA=function(){return"\b"},mc=/^[Ee]/,yc=Ni(["E","e"],!1,!1),Il=function(){return"\x1B"},we="\\f",Tt=cr("\\f",!1),wl=function(){return"\f"},Bi="\\n",Ls=cr("\\n",!1),Ft=function(){return` -`},Bn="\\r",Lo=cr("\\r",!1),ki=function(){return"\r"},vi="\\t",sa=cr("\\t",!1),un=function(){return" "},qn="\\v",Ec=cr("\\v",!1),lp=function(){return"\v"},oa=/^[\\'"?]/,aa=Ni(["\\","'",'"',"?"],!1,!1),la=function(L){return String.fromCharCode(parseInt(L,16))},Ze="\\x",ca=cr("\\x",!1),mu="\\u",Bl=cr("\\u",!1),dn="\\U",No=cr("\\U",!1),RA=function(L){return String.fromCodePoint(parseInt(L,16))},TA=/^[0-7]/,Oo=Ni([["0","7"]],!1,!1),qa=/^[0-9a-fA-f]/,Ot=Ni([["0","9"],["a","f"],["A","f"]],!1,!1),vn=Iu(),Mo="{}",ua=cr("{}",!1),qi=function(){return"{}"},vl="-",Cc=cr("-",!1),Dl="+",Aa=cr("+",!1),Di=".",rs=cr(".",!1),ja=function(L,K,re){return{type:"number",value:(L==="-"?-1:1)*parseFloat(K.join("")+"."+re.join(""))}},yu=function(L,K){return{type:"number",value:(L==="-"?-1:1)*parseInt(K.join(""))}},Sl=function(L){return{type:"variable",...L}},pi=function(L){return{type:"variable",name:L}},Dn=function(L){return L},Pl="*",Je=cr("*",!1),st="/",vt=cr("/",!1),ar=function(L,K,re){return{type:K==="*"?"multiplication":"division",right:re}},ee=function(L,K){return K.reduce((re,ge)=>({left:re,...ge}),L)},ye=function(L,K,re){return{type:K==="+"?"addition":"subtraction",right:re}},Ne="$((",gt=cr("$((",!1),mt="))",Dt=cr("))",!1),er=function(L){return L},sn="$(",ei=cr("$(",!1),Qi=function(L){return L},Sn="${",fa=cr("${",!1),wd=":-",BI=cr(":-",!1),eo=function(L,K){return{name:L,defaultValue:K}},Bd=":-}",cp=cr(":-}",!1),vI=function(L){return{name:L,defaultValue:[]}},to=":+",up=cr(":+",!1),Ap=function(L,K){return{name:L,alternativeValue:K}},Ic=":+}",fp=cr(":+}",!1),s0=function(L){return{name:L,alternativeValue:[]}},o0=function(L){return{name:L}},a0="$",vd=cr("$",!1),Eu=function(L){return e.isGlobPattern(L)},ro=function(L){return L},Ga=/^[a-zA-Z0-9_]/,pp=Ni([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),l0=function(){return xd()},Wa=/^[$@*?#a-zA-Z0-9_\-]/,Ya=Ni(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),Dd=/^[()}<>$|&; \t"']/,LA=Ni(["(",")","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),Sd=/^[<>&; \t"']/,Pd=Ni(["<",">","&",";"," "," ",'"',"'"],!1,!1),NA=/^[ \t]/,OA=Ni([" "," "],!1,!1),W=0,xt=0,MA=[{line:1,column:1}],no=0,Cu=[],dt=0,wc;if("startRule"in e){if(!(e.startRule in o))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=o[e.startRule]}function xd(){return t.substring(xt,W)}function c0(){return wu(xt,W)}function DI(L,K){throw K=K!==void 0?K:wu(xt,W),UA([u0(L)],t.substring(xt,W),K)}function hp(L,K){throw K=K!==void 0?K:wu(xt,W),oi(L,K)}function cr(L,K){return{type:"literal",text:L,ignoreCase:K}}function Ni(L,K,re){return{type:"class",parts:L,inverted:K,ignoreCase:re}}function Iu(){return{type:"any"}}function pa(){return{type:"end"}}function u0(L){return{type:"other",description:L}}function Bc(L){var K=MA[L],re;if(K)return K;for(re=L-1;!MA[re];)re--;for(K=MA[re],K={line:K.line,column:K.column};reno&&(no=W,Cu=[]),Cu.push(L))}function oi(L,K){return new K0(L,null,null,K)}function UA(L,K,re){return new K0(K0.buildMessage(L,K),L,K,re)}function ha(){var L,K,re;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();return K!==r?(re=Uo(),re===r&&(re=null),re!==r?(xt=L,K=n(re),L=K):(W=L,L=r)):(W=L,L=r),L}function Uo(){var L,K,re,ge,Ye;if(L=W,K=gp(),K!==r){for(re=[],ge=bt();ge!==r;)re.push(ge),ge=bt();re!==r?(ge=A0(),ge!==r?(Ye=ga(),Ye===r&&(Ye=null),Ye!==r?(xt=L,K=u(K,ge,Ye),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r)}else W=L,L=r;if(L===r)if(L=W,K=gp(),K!==r){for(re=[],ge=bt();ge!==r;)re.push(ge),ge=bt();re!==r?(ge=A0(),ge===r&&(ge=null),ge!==r?(xt=L,K=A(K,ge),L=K):(W=L,L=r)):(W=L,L=r)}else W=L,L=r;return L}function ga(){var L,K,re,ge,Ye;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r)if(re=Uo(),re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();ge!==r?(xt=L,K=p(re),L=K):(W=L,L=r)}else W=L,L=r;else W=L,L=r;return L}function A0(){var L;return t.charCodeAt(W)===59?(L=h,W++):(L=r,dt===0&&wt(E)),L===r&&(t.charCodeAt(W)===38?(L=w,W++):(L=r,dt===0&&wt(D))),L}function gp(){var L,K,re;return L=W,K=_A(),K!==r?(re=f0(),re===r&&(re=null),re!==r?(xt=L,K=b(K,re),L=K):(W=L,L=r)):(W=L,L=r),L}function f0(){var L,K,re,ge,Ye,At,hr;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r)if(re=bd(),re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();if(ge!==r)if(Ye=gp(),Ye!==r){for(At=[],hr=bt();hr!==r;)At.push(hr),hr=bt();At!==r?(xt=L,K=C(re,Ye),L=K):(W=L,L=r)}else W=L,L=r;else W=L,L=r}else W=L,L=r;else W=L,L=r;return L}function bd(){var L;return t.substr(W,2)===T?(L=T,W+=2):(L=r,dt===0&&wt(N)),L===r&&(t.substr(W,2)===U?(L=U,W+=2):(L=r,dt===0&&wt(J))),L}function _A(){var L,K,re;return L=W,K=Bu(),K!==r?(re=p0(),re===r&&(re=null),re!==r?(xt=L,K=te(K,re),L=K):(W=L,L=r)):(W=L,L=r),L}function p0(){var L,K,re,ge,Ye,At,hr;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r)if(re=vc(),re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();if(ge!==r)if(Ye=_A(),Ye!==r){for(At=[],hr=bt();hr!==r;)At.push(hr),hr=bt();At!==r?(xt=L,K=le(re,Ye),L=K):(W=L,L=r)}else W=L,L=r;else W=L,L=r}else W=L,L=r;else W=L,L=r;return L}function vc(){var L;return t.substr(W,2)===ce?(L=ce,W+=2):(L=r,dt===0&&wt(ue)),L===r&&(t.charCodeAt(W)===124?(L=Ie,W++):(L=r,dt===0&&wt(he))),L}function Dc(){var L,K,re,ge,Ye,At;if(L=W,K=yp(),K!==r)if(t.charCodeAt(W)===61?(re=De,W++):(re=r,dt===0&&wt(Ee)),re!==r)if(ge=HA(),ge!==r){for(Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();Ye!==r?(xt=L,K=g(K,ge),L=K):(W=L,L=r)}else W=L,L=r;else W=L,L=r;else W=L,L=r;if(L===r)if(L=W,K=yp(),K!==r)if(t.charCodeAt(W)===61?(re=De,W++):(re=r,dt===0&&wt(Ee)),re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();ge!==r?(xt=L,K=me(K),L=K):(W=L,L=r)}else W=L,L=r;else W=L,L=r;return L}function Bu(){var L,K,re,ge,Ye,At,hr,Ir,Rn,ai,ns;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r)if(t.charCodeAt(W)===40?(re=Ce,W++):(re=r,dt===0&&wt(fe)),re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();if(ge!==r)if(Ye=Uo(),Ye!==r){for(At=[],hr=bt();hr!==r;)At.push(hr),hr=bt();if(At!==r)if(t.charCodeAt(W)===41?(hr=ie,W++):(hr=r,dt===0&&wt(Z)),hr!==r){for(Ir=[],Rn=bt();Rn!==r;)Ir.push(Rn),Rn=bt();if(Ir!==r){for(Rn=[],ai=On();ai!==r;)Rn.push(ai),ai=On();if(Rn!==r){for(ai=[],ns=bt();ns!==r;)ai.push(ns),ns=bt();ai!==r?(xt=L,K=Se(Ye,Rn),L=K):(W=L,L=r)}else W=L,L=r}else W=L,L=r}else W=L,L=r;else W=L,L=r}else W=L,L=r;else W=L,L=r}else W=L,L=r;else W=L,L=r;if(L===r){for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r)if(t.charCodeAt(W)===123?(re=Re,W++):(re=r,dt===0&&wt(ht)),re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();if(ge!==r)if(Ye=Uo(),Ye!==r){for(At=[],hr=bt();hr!==r;)At.push(hr),hr=bt();if(At!==r)if(t.charCodeAt(W)===125?(hr=q,W++):(hr=r,dt===0&&wt(nt)),hr!==r){for(Ir=[],Rn=bt();Rn!==r;)Ir.push(Rn),Rn=bt();if(Ir!==r){for(Rn=[],ai=On();ai!==r;)Rn.push(ai),ai=On();if(Rn!==r){for(ai=[],ns=bt();ns!==r;)ai.push(ns),ns=bt();ai!==r?(xt=L,K=Le(Ye,Rn),L=K):(W=L,L=r)}else W=L,L=r}else W=L,L=r}else W=L,L=r;else W=L,L=r}else W=L,L=r;else W=L,L=r}else W=L,L=r;else W=L,L=r;if(L===r){for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r){for(re=[],ge=Dc();ge!==r;)re.push(ge),ge=Dc();if(re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();if(ge!==r){if(Ye=[],At=Sc(),At!==r)for(;At!==r;)Ye.push(At),At=Sc();else Ye=r;if(Ye!==r){for(At=[],hr=bt();hr!==r;)At.push(hr),hr=bt();At!==r?(xt=L,K=Te(re,Ye),L=K):(W=L,L=r)}else W=L,L=r}else W=L,L=r}else W=L,L=r}else W=L,L=r;if(L===r){for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r){if(re=[],ge=Dc(),ge!==r)for(;ge!==r;)re.push(ge),ge=Dc();else re=r;if(re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();ge!==r?(xt=L,K=ke(re),L=K):(W=L,L=r)}else W=L,L=r}else W=L,L=r}}}return L}function gs(){var L,K,re,ge,Ye;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r){if(re=[],ge=Ci(),ge!==r)for(;ge!==r;)re.push(ge),ge=Ci();else re=r;if(re!==r){for(ge=[],Ye=bt();Ye!==r;)ge.push(Ye),Ye=bt();ge!==r?(xt=L,K=Ke(re),L=K):(W=L,L=r)}else W=L,L=r}else W=L,L=r;return L}function Sc(){var L,K,re;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();if(K!==r?(re=On(),re!==r?(xt=L,K=xe(re),L=K):(W=L,L=r)):(W=L,L=r),L===r){for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();K!==r?(re=Ci(),re!==r?(xt=L,K=xe(re),L=K):(W=L,L=r)):(W=L,L=r)}return L}function On(){var L,K,re,ge,Ye;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();return K!==r?(tt.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(He)),re===r&&(re=null),re!==r?(ge=ji(),ge!==r?(Ye=Ci(),Ye!==r?(xt=L,K=x(re,ge,Ye),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L}function ji(){var L;return t.substr(W,2)===I?(L=I,W+=2):(L=r,dt===0&&wt(P)),L===r&&(t.substr(W,2)===y?(L=y,W+=2):(L=r,dt===0&&wt(R)),L===r&&(t.charCodeAt(W)===62?(L=z,W++):(L=r,dt===0&&wt(X)),L===r&&(t.substr(W,3)===$?(L=$,W+=3):(L=r,dt===0&&wt(se)),L===r&&(t.substr(W,2)===be?(L=be,W+=2):(L=r,dt===0&&wt(Fe)),L===r&&(t.charCodeAt(W)===60?(L=lt,W++):(L=r,dt===0&&wt(Et))))))),L}function Ci(){var L,K,re;for(L=W,K=[],re=bt();re!==r;)K.push(re),re=bt();return K!==r?(re=HA(),re!==r?(xt=L,K=xe(re),L=K):(W=L,L=r)):(W=L,L=r),L}function HA(){var L,K,re;if(L=W,K=[],re=vu(),re!==r)for(;re!==r;)K.push(re),re=vu();else K=r;return K!==r&&(xt=L,K=qt(K)),L=K,L}function vu(){var L,K;return L=W,K=An(),K!==r&&(xt=L,K=nr(K)),L=K,L===r&&(L=W,K=h0(),K!==r&&(xt=L,K=nr(K)),L=K,L===r&&(L=W,K=g0(),K!==r&&(xt=L,K=nr(K)),L=K,L===r&&(L=W,K=Gi(),K!==r&&(xt=L,K=nr(K)),L=K))),L}function An(){var L,K,re,ge;return L=W,t.substr(W,2)===Pt?(K=Pt,W+=2):(K=r,dt===0&&wt(cn)),K!==r?(re=fn(),re!==r?(t.charCodeAt(W)===39?(ge=Sr,W++):(ge=r,dt===0&&wt(yr)),ge!==r?(xt=L,K=Rr(re),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L}function h0(){var L,K,re,ge;return L=W,t.charCodeAt(W)===39?(K=Sr,W++):(K=r,dt===0&&wt(yr)),K!==r?(re=Du(),re!==r?(t.charCodeAt(W)===39?(ge=Sr,W++):(ge=r,dt===0&&wt(yr)),ge!==r?(xt=L,K=Rr(re),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L}function g0(){var L,K,re,ge;if(L=W,t.substr(W,2)===Xr?(K=Xr,W+=2):(K=r,dt===0&&wt($n)),K!==r&&(xt=L,K=Xs()),L=K,L===r)if(L=W,t.charCodeAt(W)===34?(K=Hi,W++):(K=r,dt===0&&wt(Qs)),K!==r){for(re=[],ge=Va();ge!==r;)re.push(ge),ge=Va();re!==r?(t.charCodeAt(W)===34?(ge=Hi,W++):(ge=r,dt===0&&wt(Qs)),ge!==r?(xt=L,K=Zs(re),L=K):(W=L,L=r)):(W=L,L=r)}else W=L,L=r;return L}function Gi(){var L,K,re;if(L=W,K=[],re=io(),re!==r)for(;re!==r;)K.push(re),re=io();else K=r;return K!==r&&(xt=L,K=Zs(K)),L=K,L}function Va(){var L,K;return L=W,K=Vr(),K!==r&&(xt=L,K=bi(K)),L=K,L===r&&(L=W,K=mp(),K!==r&&(xt=L,K=Fs(K)),L=K,L===r&&(L=W,K=jA(),K!==r&&(xt=L,K=$s(K)),L=K,L===r&&(L=W,K=Su(),K!==r&&(xt=L,K=PA(K)),L=K))),L}function io(){var L,K;return L=W,K=Vr(),K!==r&&(xt=L,K=gu(K)),L=K,L===r&&(L=W,K=mp(),K!==r&&(xt=L,K=op(K)),L=K,L===r&&(L=W,K=jA(),K!==r&&(xt=L,K=ap(K)),L=K,L===r&&(L=W,K=kd(),K!==r&&(xt=L,K=Rs(K)),L=K,L===r&&(L=W,K=dp(),K!==r&&(xt=L,K=PA(K)),L=K)))),L}function Du(){var L,K,re;for(L=W,K=[],Nn.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(hs));re!==r;)K.push(re),Nn.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(hs));return K!==r&&(xt=L,K=Ts(K)),L=K,L}function Su(){var L,K,re;if(L=W,K=[],re=Ka(),re===r&&(pc.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(hc))),re!==r)for(;re!==r;)K.push(re),re=Ka(),re===r&&(pc.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(hc)));else K=r;return K!==r&&(xt=L,K=Ts(K)),L=K,L}function Ka(){var L,K,re;return L=W,t.substr(W,2)===gc?(K=gc,W+=2):(K=r,dt===0&&wt(xA)),K!==r&&(xt=L,K=bA()),L=K,L===r&&(L=W,t.charCodeAt(W)===92?(K=Ro,W++):(K=r,dt===0&&wt(To)),K!==r?(kA.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(pr)),re!==r?(xt=L,K=Me(re),L=K):(W=L,L=r)):(W=L,L=r)),L}function fn(){var L,K,re;for(L=W,K=[],re=so(),re===r&&(Nn.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(hs)));re!==r;)K.push(re),re=so(),re===r&&(Nn.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(hs)));return K!==r&&(xt=L,K=Ts(K)),L=K,L}function so(){var L,K,re;return L=W,t.substr(W,2)===ia?(K=ia,W+=2):(K=r,dt===0&&wt(dc)),K!==r&&(xt=L,K=Er()),L=K,L===r&&(L=W,t.substr(W,2)===du?(K=du,W+=2):(K=r,dt===0&&wt(QA)),K!==r&&(xt=L,K=FA()),L=K,L===r&&(L=W,t.charCodeAt(W)===92?(K=Ro,W++):(K=r,dt===0&&wt(To)),K!==r?(mc.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(yc)),re!==r?(xt=L,K=Il(),L=K):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===we?(K=we,W+=2):(K=r,dt===0&&wt(Tt)),K!==r&&(xt=L,K=wl()),L=K,L===r&&(L=W,t.substr(W,2)===Bi?(K=Bi,W+=2):(K=r,dt===0&&wt(Ls)),K!==r&&(xt=L,K=Ft()),L=K,L===r&&(L=W,t.substr(W,2)===Bn?(K=Bn,W+=2):(K=r,dt===0&&wt(Lo)),K!==r&&(xt=L,K=ki()),L=K,L===r&&(L=W,t.substr(W,2)===vi?(K=vi,W+=2):(K=r,dt===0&&wt(sa)),K!==r&&(xt=L,K=un()),L=K,L===r&&(L=W,t.substr(W,2)===qn?(K=qn,W+=2):(K=r,dt===0&&wt(Ec)),K!==r&&(xt=L,K=lp()),L=K,L===r&&(L=W,t.charCodeAt(W)===92?(K=Ro,W++):(K=r,dt===0&&wt(To)),K!==r?(oa.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(aa)),re!==r?(xt=L,K=Me(re),L=K):(W=L,L=r)):(W=L,L=r),L===r&&(L=Pc()))))))))),L}function Pc(){var L,K,re,ge,Ye,At,hr,Ir,Rn,ai,ns,GA;return L=W,t.charCodeAt(W)===92?(K=Ro,W++):(K=r,dt===0&&wt(To)),K!==r?(re=_o(),re!==r?(xt=L,K=la(re),L=K):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===Ze?(K=Ze,W+=2):(K=r,dt===0&&wt(ca)),K!==r?(re=W,ge=W,Ye=_o(),Ye!==r?(At=ds(),At!==r?(Ye=[Ye,At],ge=Ye):(W=ge,ge=r)):(W=ge,ge=r),ge===r&&(ge=_o()),ge!==r?re=t.substring(re,W):re=ge,re!==r?(xt=L,K=la(re),L=K):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===mu?(K=mu,W+=2):(K=r,dt===0&&wt(Bl)),K!==r?(re=W,ge=W,Ye=ds(),Ye!==r?(At=ds(),At!==r?(hr=ds(),hr!==r?(Ir=ds(),Ir!==r?(Ye=[Ye,At,hr,Ir],ge=Ye):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r),ge!==r?re=t.substring(re,W):re=ge,re!==r?(xt=L,K=la(re),L=K):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===dn?(K=dn,W+=2):(K=r,dt===0&&wt(No)),K!==r?(re=W,ge=W,Ye=ds(),Ye!==r?(At=ds(),At!==r?(hr=ds(),hr!==r?(Ir=ds(),Ir!==r?(Rn=ds(),Rn!==r?(ai=ds(),ai!==r?(ns=ds(),ns!==r?(GA=ds(),GA!==r?(Ye=[Ye,At,hr,Ir,Rn,ai,ns,GA],ge=Ye):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r)):(W=ge,ge=r),ge!==r?re=t.substring(re,W):re=ge,re!==r?(xt=L,K=RA(re),L=K):(W=L,L=r)):(W=L,L=r)))),L}function _o(){var L;return TA.test(t.charAt(W))?(L=t.charAt(W),W++):(L=r,dt===0&&wt(Oo)),L}function ds(){var L;return qa.test(t.charAt(W))?(L=t.charAt(W),W++):(L=r,dt===0&&wt(Ot)),L}function dp(){var L,K,re,ge,Ye;if(L=W,K=[],re=W,t.charCodeAt(W)===92?(ge=Ro,W++):(ge=r,dt===0&&wt(To)),ge!==r?(t.length>W?(Ye=t.charAt(W),W++):(Ye=r,dt===0&&wt(vn)),Ye!==r?(xt=re,ge=Me(Ye),re=ge):(W=re,re=r)):(W=re,re=r),re===r&&(re=W,t.substr(W,2)===Mo?(ge=Mo,W+=2):(ge=r,dt===0&&wt(ua)),ge!==r&&(xt=re,ge=qi()),re=ge,re===r&&(re=W,ge=W,dt++,Ye=Qd(),dt--,Ye===r?ge=void 0:(W=ge,ge=r),ge!==r?(t.length>W?(Ye=t.charAt(W),W++):(Ye=r,dt===0&&wt(vn)),Ye!==r?(xt=re,ge=Me(Ye),re=ge):(W=re,re=r)):(W=re,re=r))),re!==r)for(;re!==r;)K.push(re),re=W,t.charCodeAt(W)===92?(ge=Ro,W++):(ge=r,dt===0&&wt(To)),ge!==r?(t.length>W?(Ye=t.charAt(W),W++):(Ye=r,dt===0&&wt(vn)),Ye!==r?(xt=re,ge=Me(Ye),re=ge):(W=re,re=r)):(W=re,re=r),re===r&&(re=W,t.substr(W,2)===Mo?(ge=Mo,W+=2):(ge=r,dt===0&&wt(ua)),ge!==r&&(xt=re,ge=qi()),re=ge,re===r&&(re=W,ge=W,dt++,Ye=Qd(),dt--,Ye===r?ge=void 0:(W=ge,ge=r),ge!==r?(t.length>W?(Ye=t.charAt(W),W++):(Ye=r,dt===0&&wt(vn)),Ye!==r?(xt=re,ge=Me(Ye),re=ge):(W=re,re=r)):(W=re,re=r)));else K=r;return K!==r&&(xt=L,K=Ts(K)),L=K,L}function qA(){var L,K,re,ge,Ye,At;if(L=W,t.charCodeAt(W)===45?(K=vl,W++):(K=r,dt===0&&wt(Cc)),K===r&&(t.charCodeAt(W)===43?(K=Dl,W++):(K=r,dt===0&&wt(Aa))),K===r&&(K=null),K!==r){if(re=[],tt.test(t.charAt(W))?(ge=t.charAt(W),W++):(ge=r,dt===0&&wt(He)),ge!==r)for(;ge!==r;)re.push(ge),tt.test(t.charAt(W))?(ge=t.charAt(W),W++):(ge=r,dt===0&&wt(He));else re=r;if(re!==r)if(t.charCodeAt(W)===46?(ge=Di,W++):(ge=r,dt===0&&wt(rs)),ge!==r){if(Ye=[],tt.test(t.charAt(W))?(At=t.charAt(W),W++):(At=r,dt===0&&wt(He)),At!==r)for(;At!==r;)Ye.push(At),tt.test(t.charAt(W))?(At=t.charAt(W),W++):(At=r,dt===0&&wt(He));else Ye=r;Ye!==r?(xt=L,K=ja(K,re,Ye),L=K):(W=L,L=r)}else W=L,L=r;else W=L,L=r}else W=L,L=r;if(L===r){if(L=W,t.charCodeAt(W)===45?(K=vl,W++):(K=r,dt===0&&wt(Cc)),K===r&&(t.charCodeAt(W)===43?(K=Dl,W++):(K=r,dt===0&&wt(Aa))),K===r&&(K=null),K!==r){if(re=[],tt.test(t.charAt(W))?(ge=t.charAt(W),W++):(ge=r,dt===0&&wt(He)),ge!==r)for(;ge!==r;)re.push(ge),tt.test(t.charAt(W))?(ge=t.charAt(W),W++):(ge=r,dt===0&&wt(He));else re=r;re!==r?(xt=L,K=yu(K,re),L=K):(W=L,L=r)}else W=L,L=r;if(L===r&&(L=W,K=jA(),K!==r&&(xt=L,K=Sl(K)),L=K,L===r&&(L=W,K=xl(),K!==r&&(xt=L,K=pi(K)),L=K,L===r)))if(L=W,t.charCodeAt(W)===40?(K=Ce,W++):(K=r,dt===0&&wt(fe)),K!==r){for(re=[],ge=bt();ge!==r;)re.push(ge),ge=bt();if(re!==r)if(ge=Ns(),ge!==r){for(Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();Ye!==r?(t.charCodeAt(W)===41?(At=ie,W++):(At=r,dt===0&&wt(Z)),At!==r?(xt=L,K=Dn(ge),L=K):(W=L,L=r)):(W=L,L=r)}else W=L,L=r;else W=L,L=r}else W=L,L=r}return L}function Pu(){var L,K,re,ge,Ye,At,hr,Ir;if(L=W,K=qA(),K!==r){for(re=[],ge=W,Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();if(Ye!==r)if(t.charCodeAt(W)===42?(At=Pl,W++):(At=r,dt===0&&wt(Je)),At===r&&(t.charCodeAt(W)===47?(At=st,W++):(At=r,dt===0&&wt(vt))),At!==r){for(hr=[],Ir=bt();Ir!==r;)hr.push(Ir),Ir=bt();hr!==r?(Ir=qA(),Ir!==r?(xt=ge,Ye=ar(K,At,Ir),ge=Ye):(W=ge,ge=r)):(W=ge,ge=r)}else W=ge,ge=r;else W=ge,ge=r;for(;ge!==r;){for(re.push(ge),ge=W,Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();if(Ye!==r)if(t.charCodeAt(W)===42?(At=Pl,W++):(At=r,dt===0&&wt(Je)),At===r&&(t.charCodeAt(W)===47?(At=st,W++):(At=r,dt===0&&wt(vt))),At!==r){for(hr=[],Ir=bt();Ir!==r;)hr.push(Ir),Ir=bt();hr!==r?(Ir=qA(),Ir!==r?(xt=ge,Ye=ar(K,At,Ir),ge=Ye):(W=ge,ge=r)):(W=ge,ge=r)}else W=ge,ge=r;else W=ge,ge=r}re!==r?(xt=L,K=ee(K,re),L=K):(W=L,L=r)}else W=L,L=r;return L}function Ns(){var L,K,re,ge,Ye,At,hr,Ir;if(L=W,K=Pu(),K!==r){for(re=[],ge=W,Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();if(Ye!==r)if(t.charCodeAt(W)===43?(At=Dl,W++):(At=r,dt===0&&wt(Aa)),At===r&&(t.charCodeAt(W)===45?(At=vl,W++):(At=r,dt===0&&wt(Cc))),At!==r){for(hr=[],Ir=bt();Ir!==r;)hr.push(Ir),Ir=bt();hr!==r?(Ir=Pu(),Ir!==r?(xt=ge,Ye=ye(K,At,Ir),ge=Ye):(W=ge,ge=r)):(W=ge,ge=r)}else W=ge,ge=r;else W=ge,ge=r;for(;ge!==r;){for(re.push(ge),ge=W,Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();if(Ye!==r)if(t.charCodeAt(W)===43?(At=Dl,W++):(At=r,dt===0&&wt(Aa)),At===r&&(t.charCodeAt(W)===45?(At=vl,W++):(At=r,dt===0&&wt(Cc))),At!==r){for(hr=[],Ir=bt();Ir!==r;)hr.push(Ir),Ir=bt();hr!==r?(Ir=Pu(),Ir!==r?(xt=ge,Ye=ye(K,At,Ir),ge=Ye):(W=ge,ge=r)):(W=ge,ge=r)}else W=ge,ge=r;else W=ge,ge=r}re!==r?(xt=L,K=ee(K,re),L=K):(W=L,L=r)}else W=L,L=r;return L}function Vr(){var L,K,re,ge,Ye,At;if(L=W,t.substr(W,3)===Ne?(K=Ne,W+=3):(K=r,dt===0&&wt(gt)),K!==r){for(re=[],ge=bt();ge!==r;)re.push(ge),ge=bt();if(re!==r)if(ge=Ns(),ge!==r){for(Ye=[],At=bt();At!==r;)Ye.push(At),At=bt();Ye!==r?(t.substr(W,2)===mt?(At=mt,W+=2):(At=r,dt===0&&wt(Dt)),At!==r?(xt=L,K=er(ge),L=K):(W=L,L=r)):(W=L,L=r)}else W=L,L=r;else W=L,L=r}else W=L,L=r;return L}function mp(){var L,K,re,ge;return L=W,t.substr(W,2)===sn?(K=sn,W+=2):(K=r,dt===0&&wt(ei)),K!==r?(re=Uo(),re!==r?(t.charCodeAt(W)===41?(ge=ie,W++):(ge=r,dt===0&&wt(Z)),ge!==r?(xt=L,K=Qi(re),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L}function jA(){var L,K,re,ge,Ye,At;return L=W,t.substr(W,2)===Sn?(K=Sn,W+=2):(K=r,dt===0&&wt(fa)),K!==r?(re=xl(),re!==r?(t.substr(W,2)===wd?(ge=wd,W+=2):(ge=r,dt===0&&wt(BI)),ge!==r?(Ye=gs(),Ye!==r?(t.charCodeAt(W)===125?(At=q,W++):(At=r,dt===0&&wt(nt)),At!==r?(xt=L,K=eo(re,Ye),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===Sn?(K=Sn,W+=2):(K=r,dt===0&&wt(fa)),K!==r?(re=xl(),re!==r?(t.substr(W,3)===Bd?(ge=Bd,W+=3):(ge=r,dt===0&&wt(cp)),ge!==r?(xt=L,K=vI(re),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===Sn?(K=Sn,W+=2):(K=r,dt===0&&wt(fa)),K!==r?(re=xl(),re!==r?(t.substr(W,2)===to?(ge=to,W+=2):(ge=r,dt===0&&wt(up)),ge!==r?(Ye=gs(),Ye!==r?(t.charCodeAt(W)===125?(At=q,W++):(At=r,dt===0&&wt(nt)),At!==r?(xt=L,K=Ap(re,Ye),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===Sn?(K=Sn,W+=2):(K=r,dt===0&&wt(fa)),K!==r?(re=xl(),re!==r?(t.substr(W,3)===Ic?(ge=Ic,W+=3):(ge=r,dt===0&&wt(fp)),ge!==r?(xt=L,K=s0(re),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.substr(W,2)===Sn?(K=Sn,W+=2):(K=r,dt===0&&wt(fa)),K!==r?(re=xl(),re!==r?(t.charCodeAt(W)===125?(ge=q,W++):(ge=r,dt===0&&wt(nt)),ge!==r?(xt=L,K=o0(re),L=K):(W=L,L=r)):(W=L,L=r)):(W=L,L=r),L===r&&(L=W,t.charCodeAt(W)===36?(K=a0,W++):(K=r,dt===0&&wt(vd)),K!==r?(re=xl(),re!==r?(xt=L,K=o0(re),L=K):(W=L,L=r)):(W=L,L=r)))))),L}function kd(){var L,K,re;return L=W,K=d0(),K!==r?(xt=W,re=Eu(K),re?re=void 0:re=r,re!==r?(xt=L,K=ro(K),L=K):(W=L,L=r)):(W=L,L=r),L}function d0(){var L,K,re,ge,Ye;if(L=W,K=[],re=W,ge=W,dt++,Ye=Ep(),dt--,Ye===r?ge=void 0:(W=ge,ge=r),ge!==r?(t.length>W?(Ye=t.charAt(W),W++):(Ye=r,dt===0&&wt(vn)),Ye!==r?(xt=re,ge=Me(Ye),re=ge):(W=re,re=r)):(W=re,re=r),re!==r)for(;re!==r;)K.push(re),re=W,ge=W,dt++,Ye=Ep(),dt--,Ye===r?ge=void 0:(W=ge,ge=r),ge!==r?(t.length>W?(Ye=t.charAt(W),W++):(Ye=r,dt===0&&wt(vn)),Ye!==r?(xt=re,ge=Me(Ye),re=ge):(W=re,re=r)):(W=re,re=r);else K=r;return K!==r&&(xt=L,K=Ts(K)),L=K,L}function yp(){var L,K,re;if(L=W,K=[],Ga.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(pp)),re!==r)for(;re!==r;)K.push(re),Ga.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(pp));else K=r;return K!==r&&(xt=L,K=l0()),L=K,L}function xl(){var L,K,re;if(L=W,K=[],Wa.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(Ya)),re!==r)for(;re!==r;)K.push(re),Wa.test(t.charAt(W))?(re=t.charAt(W),W++):(re=r,dt===0&&wt(Ya));else K=r;return K!==r&&(xt=L,K=l0()),L=K,L}function Qd(){var L;return Dd.test(t.charAt(W))?(L=t.charAt(W),W++):(L=r,dt===0&&wt(LA)),L}function Ep(){var L;return Sd.test(t.charAt(W))?(L=t.charAt(W),W++):(L=r,dt===0&&wt(Pd)),L}function bt(){var L,K;if(L=[],NA.test(t.charAt(W))?(K=t.charAt(W),W++):(K=r,dt===0&&wt(OA)),K!==r)for(;K!==r;)L.push(K),NA.test(t.charAt(W))?(K=t.charAt(W),W++):(K=r,dt===0&&wt(OA));else L=r;return L}if(wc=a(),wc!==r&&W===t.length)return wc;throw wc!==r&&W!1}){try{return(0,OY.parse)(t,e)}catch(r){throw r.location&&(r.message=r.message.replace(/(\.)?$/,` (line ${r.location.start.line}, column ${r.location.start.column})$1`)),r}}function dm(t,{endSemicolon:e=!1}={}){return t.map(({command:r,type:o},a)=>`${AS(r)}${o===";"?a!==t.length-1||e?";":"":" &"}`).join(" ")}function AS(t){return`${mm(t.chain)}${t.then?` ${UT(t.then)}`:""}`}function UT(t){return`${t.type} ${AS(t.line)}`}function mm(t){return`${HT(t)}${t.then?` ${_T(t.then)}`:""}`}function _T(t){return`${t.type} ${mm(t.chain)}`}function HT(t){switch(t.type){case"command":return`${t.envs.length>0?`${t.envs.map(e=>cS(e)).join(" ")} `:""}${t.args.map(e=>qT(e)).join(" ")}`;case"subshell":return`(${dm(t.subshell)})${t.args.length>0?` ${t.args.map(e=>fw(e)).join(" ")}`:""}`;case"group":return`{ ${dm(t.group,{endSemicolon:!0})} }${t.args.length>0?` ${t.args.map(e=>fw(e)).join(" ")}`:""}`;case"envs":return t.envs.map(e=>cS(e)).join(" ");default:throw new Error(`Unsupported command type: "${t.type}"`)}}function cS(t){return`${t.name}=${t.args[0]?J0(t.args[0]):""}`}function qT(t){switch(t.type){case"redirection":return fw(t);case"argument":return J0(t);default:throw new Error(`Unsupported argument type: "${t.type}"`)}}function fw(t){return`${t.subtype} ${t.args.map(e=>J0(e)).join(" ")}`}function J0(t){return t.segments.map(e=>jT(e)).join("")}function jT(t){let e=(o,a)=>a?`"${o}"`:o,r=o=>o===""?"''":o.match(/[()}<>$|&;"'\n\t ]/)?o.match(/['\t\p{C}]/u)?o.match(/'/)?`"${o.replace(/["$\t\p{C}]/u,$_e)}"`:`$'${o.replace(/[\t\p{C}]/u,UY)}'`:`'${o}'`:o;switch(t.type){case"text":return r(t.text);case"glob":return t.pattern;case"shell":return e(`$(${dm(t.shell)})`,t.quoted);case"variable":return e(typeof t.defaultValue>"u"?typeof t.alternativeValue>"u"?`\${${t.name}}`:t.alternativeValue.length===0?`\${${t.name}:+}`:`\${${t.name}:+${t.alternativeValue.map(o=>J0(o)).join(" ")}}`:t.defaultValue.length===0?`\${${t.name}:-}`:`\${${t.name}:-${t.defaultValue.map(o=>J0(o)).join(" ")}}`,t.quoted);case"arithmetic":return`$(( ${fS(t.arithmetic)} ))`;default:throw new Error(`Unsupported argument segment type: "${t.type}"`)}}function fS(t){let e=a=>{switch(a){case"addition":return"+";case"subtraction":return"-";case"multiplication":return"*";case"division":return"/";default:throw new Error(`Can't extract operator from arithmetic expression of type "${a}"`)}},r=(a,n)=>n?`( ${a} )`:a,o=a=>r(fS(a),!["number","variable"].includes(a.type));switch(t.type){case"number":return String(t.value);case"variable":return t.name;default:return`${o(t.left)} ${e(t.type)} ${o(t.right)}`}}var OY,MY,Z_e,UY,$_e,_Y=It(()=>{OY=et(NY());MY=new Map([["\f","\\f"],[` -`,"\\n"],["\r","\\r"],[" ","\\t"],["\v","\\v"],["\0","\\0"]]),Z_e=new Map([["\\","\\\\"],["$","\\$"],['"','\\"'],...Array.from(MY,([t,e])=>[t,`"$'${e}'"`])]),UY=t=>MY.get(t)??`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`,$_e=t=>Z_e.get(t)??`"$'${UY(t)}'"`});var qY=_((dxt,HY)=>{"use strict";function e8e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function z0(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z0)}e8e(z0,Error);z0.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",w;for(w=0;w0){for(w=1,D=1;wce&&(ce=J,ue=[]),ue.push(He))}function nt(He,x){return new z0(He,null,null,x)}function Le(He,x,I){return new z0(z0.buildMessage(He,x),He,x,I)}function Te(){var He,x,I,P;return He=J,x=ke(),x!==r?(t.charCodeAt(J)===47?(I=n,J++):(I=r,Ie===0&&q(u)),I!==r?(P=ke(),P!==r?(te=He,x=A(x,P),He=x):(J=He,He=r)):(J=He,He=r)):(J=He,He=r),He===r&&(He=J,x=ke(),x!==r&&(te=He,x=p(x)),He=x),He}function ke(){var He,x,I,P;return He=J,x=Ke(),x!==r?(t.charCodeAt(J)===64?(I=h,J++):(I=r,Ie===0&&q(E)),I!==r?(P=tt(),P!==r?(te=He,x=w(x,P),He=x):(J=He,He=r)):(J=He,He=r)):(J=He,He=r),He===r&&(He=J,x=Ke(),x!==r&&(te=He,x=D(x)),He=x),He}function Ke(){var He,x,I,P,y;return He=J,t.charCodeAt(J)===64?(x=h,J++):(x=r,Ie===0&&q(E)),x!==r?(I=xe(),I!==r?(t.charCodeAt(J)===47?(P=n,J++):(P=r,Ie===0&&q(u)),P!==r?(y=xe(),y!==r?(te=He,x=b(),He=x):(J=He,He=r)):(J=He,He=r)):(J=He,He=r)):(J=He,He=r),He===r&&(He=J,x=xe(),x!==r&&(te=He,x=b()),He=x),He}function xe(){var He,x,I;if(He=J,x=[],C.test(t.charAt(J))?(I=t.charAt(J),J++):(I=r,Ie===0&&q(T)),I!==r)for(;I!==r;)x.push(I),C.test(t.charAt(J))?(I=t.charAt(J),J++):(I=r,Ie===0&&q(T));else x=r;return x!==r&&(te=He,x=b()),He=x,He}function tt(){var He,x,I;if(He=J,x=[],N.test(t.charAt(J))?(I=t.charAt(J),J++):(I=r,Ie===0&&q(U)),I!==r)for(;I!==r;)x.push(I),N.test(t.charAt(J))?(I=t.charAt(J),J++):(I=r,Ie===0&&q(U));else x=r;return x!==r&&(te=He,x=b()),He=x,He}if(he=a(),he!==r&&J===t.length)return he;throw he!==r&&J{jY=et(qY())});var Z0=_((yxt,X0)=>{"use strict";function WY(t){return typeof t>"u"||t===null}function r8e(t){return typeof t=="object"&&t!==null}function n8e(t){return Array.isArray(t)?t:WY(t)?[]:[t]}function i8e(t,e){var r,o,a,n;if(e)for(n=Object.keys(e),r=0,o=n.length;r{"use strict";function pw(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}pw.prototype=Object.create(Error.prototype);pw.prototype.constructor=pw;pw.prototype.toString=function(e){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!e&&this.mark&&(r+=" "+this.mark.toString()),r};YY.exports=pw});var JY=_((Cxt,KY)=>{"use strict";var VY=Z0();function GT(t,e,r,o,a){this.name=t,this.buffer=e,this.position=r,this.line=o,this.column=a}GT.prototype.getSnippet=function(e,r){var o,a,n,u,A;if(!this.buffer)return null;for(e=e||4,r=r||75,o="",a=this.position;a>0&&`\0\r -\x85\u2028\u2029`.indexOf(this.buffer.charAt(a-1))===-1;)if(a-=1,this.position-a>r/2-1){o=" ... ",a+=5;break}for(n="",u=this.position;ur/2-1){n=" ... ",u-=5;break}return A=this.buffer.slice(a,u),VY.repeat(" ",e)+o+A+n+` -`+VY.repeat(" ",e+this.position-a+o.length)+"^"};GT.prototype.toString=function(e){var r,o="";return this.name&&(o+='in "'+this.name+'" '),o+="at line "+(this.line+1)+", column "+(this.column+1),e||(r=this.getSnippet(),r&&(o+=`: -`+r)),o};KY.exports=GT});var as=_((Ixt,XY)=>{"use strict";var zY=ym(),a8e=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],l8e=["scalar","sequence","mapping"];function c8e(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(o){e[String(o)]=r})}),e}function u8e(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(a8e.indexOf(r)===-1)throw new zY('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=c8e(e.styleAliases||null),l8e.indexOf(this.kind)===-1)throw new zY('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}XY.exports=u8e});var $0=_((wxt,$Y)=>{"use strict";var ZY=Z0(),gS=ym(),A8e=as();function WT(t,e,r){var o=[];return t.include.forEach(function(a){r=WT(a,e,r)}),t[e].forEach(function(a){r.forEach(function(n,u){n.tag===a.tag&&n.kind===a.kind&&o.push(u)}),r.push(a)}),r.filter(function(a,n){return o.indexOf(n)===-1})}function f8e(){var t={scalar:{},sequence:{},mapping:{},fallback:{}},e,r;function o(a){t[a.kind][a.tag]=t.fallback[a.tag]=a}for(e=0,r=arguments.length;e{"use strict";var p8e=as();eV.exports=new p8e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var nV=_((vxt,rV)=>{"use strict";var h8e=as();rV.exports=new h8e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var sV=_((Dxt,iV)=>{"use strict";var g8e=as();iV.exports=new g8e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var dS=_((Sxt,oV)=>{"use strict";var d8e=$0();oV.exports=new d8e({explicit:[tV(),nV(),sV()]})});var lV=_((Pxt,aV)=>{"use strict";var m8e=as();function y8e(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function E8e(){return null}function C8e(t){return t===null}aV.exports=new m8e("tag:yaml.org,2002:null",{kind:"scalar",resolve:y8e,construct:E8e,predicate:C8e,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var uV=_((xxt,cV)=>{"use strict";var I8e=as();function w8e(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function B8e(t){return t==="true"||t==="True"||t==="TRUE"}function v8e(t){return Object.prototype.toString.call(t)==="[object Boolean]"}cV.exports=new I8e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:w8e,construct:B8e,predicate:v8e,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var fV=_((bxt,AV)=>{"use strict";var D8e=Z0(),S8e=as();function P8e(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function x8e(t){return 48<=t&&t<=55}function b8e(t){return 48<=t&&t<=57}function k8e(t){if(t===null)return!1;var e=t.length,r=0,o=!1,a;if(!e)return!1;if(a=t[r],(a==="-"||a==="+")&&(a=t[++r]),a==="0"){if(r+1===e)return!0;if(a=t[++r],a==="b"){for(r++;r=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var gV=_((kxt,hV)=>{"use strict";var pV=Z0(),R8e=as(),T8e=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function L8e(t){return!(t===null||!T8e.test(t)||t[t.length-1]==="_")}function N8e(t){var e,r,o,a;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,a=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(n){a.unshift(parseFloat(n,10))}),e=0,o=1,a.forEach(function(n){e+=n*o,o*=60}),r*e):r*parseFloat(e,10)}var O8e=/^[-+]?[0-9]+e/;function M8e(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(pV.isNegativeZero(t))return"-0.0";return r=t.toString(10),O8e.test(r)?r.replace("e",".e"):r}function U8e(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||pV.isNegativeZero(t))}hV.exports=new R8e("tag:yaml.org,2002:float",{kind:"scalar",resolve:L8e,construct:N8e,predicate:U8e,represent:M8e,defaultStyle:"lowercase"})});var YT=_((Qxt,dV)=>{"use strict";var _8e=$0();dV.exports=new _8e({include:[dS()],implicit:[lV(),uV(),fV(),gV()]})});var VT=_((Fxt,mV)=>{"use strict";var H8e=$0();mV.exports=new H8e({include:[YT()]})});var IV=_((Rxt,CV)=>{"use strict";var q8e=as(),yV=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),EV=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function j8e(t){return t===null?!1:yV.exec(t)!==null||EV.exec(t)!==null}function G8e(t){var e,r,o,a,n,u,A,p=0,h=null,E,w,D;if(e=yV.exec(t),e===null&&(e=EV.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],o=+e[2]-1,a=+e[3],!e[4])return new Date(Date.UTC(r,o,a));if(n=+e[4],u=+e[5],A=+e[6],e[7]){for(p=e[7].slice(0,3);p.length<3;)p+="0";p=+p}return e[9]&&(E=+e[10],w=+(e[11]||0),h=(E*60+w)*6e4,e[9]==="-"&&(h=-h)),D=new Date(Date.UTC(r,o,a,n,u,A,p)),h&&D.setTime(D.getTime()-h),D}function W8e(t){return t.toISOString()}CV.exports=new q8e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:j8e,construct:G8e,instanceOf:Date,represent:W8e})});var BV=_((Txt,wV)=>{"use strict";var Y8e=as();function V8e(t){return t==="<<"||t===null}wV.exports=new Y8e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:V8e})});var SV=_((Lxt,DV)=>{"use strict";var eg;try{vV=ve,eg=vV("buffer").Buffer}catch{}var vV,K8e=as(),KT=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= -\r`;function J8e(t){if(t===null)return!1;var e,r,o=0,a=t.length,n=KT;for(r=0;r64)){if(e<0)return!1;o+=6}return o%8===0}function z8e(t){var e,r,o=t.replace(/[\r\n=]/g,""),a=o.length,n=KT,u=0,A=[];for(e=0;e>16&255),A.push(u>>8&255),A.push(u&255)),u=u<<6|n.indexOf(o.charAt(e));return r=a%4*6,r===0?(A.push(u>>16&255),A.push(u>>8&255),A.push(u&255)):r===18?(A.push(u>>10&255),A.push(u>>2&255)):r===12&&A.push(u>>4&255),eg?eg.from?eg.from(A):new eg(A):A}function X8e(t){var e="",r=0,o,a,n=t.length,u=KT;for(o=0;o>18&63],e+=u[r>>12&63],e+=u[r>>6&63],e+=u[r&63]),r=(r<<8)+t[o];return a=n%3,a===0?(e+=u[r>>18&63],e+=u[r>>12&63],e+=u[r>>6&63],e+=u[r&63]):a===2?(e+=u[r>>10&63],e+=u[r>>4&63],e+=u[r<<2&63],e+=u[64]):a===1&&(e+=u[r>>2&63],e+=u[r<<4&63],e+=u[64],e+=u[64]),e}function Z8e(t){return eg&&eg.isBuffer(t)}DV.exports=new K8e("tag:yaml.org,2002:binary",{kind:"scalar",resolve:J8e,construct:z8e,predicate:Z8e,represent:X8e})});var xV=_((Oxt,PV)=>{"use strict";var $8e=as(),eHe=Object.prototype.hasOwnProperty,tHe=Object.prototype.toString;function rHe(t){if(t===null)return!0;var e=[],r,o,a,n,u,A=t;for(r=0,o=A.length;r{"use strict";var iHe=as(),sHe=Object.prototype.toString;function oHe(t){if(t===null)return!0;var e,r,o,a,n,u=t;for(n=new Array(u.length),e=0,r=u.length;e{"use strict";var lHe=as(),cHe=Object.prototype.hasOwnProperty;function uHe(t){if(t===null)return!0;var e,r=t;for(e in r)if(cHe.call(r,e)&&r[e]!==null)return!1;return!0}function AHe(t){return t!==null?t:{}}QV.exports=new lHe("tag:yaml.org,2002:set",{kind:"mapping",resolve:uHe,construct:AHe})});var Cm=_((_xt,RV)=>{"use strict";var fHe=$0();RV.exports=new fHe({include:[VT()],implicit:[IV(),BV()],explicit:[SV(),xV(),kV(),FV()]})});var LV=_((Hxt,TV)=>{"use strict";var pHe=as();function hHe(){return!0}function gHe(){}function dHe(){return""}function mHe(t){return typeof t>"u"}TV.exports=new pHe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:hHe,construct:gHe,predicate:mHe,represent:dHe})});var OV=_((qxt,NV)=>{"use strict";var yHe=as();function EHe(t){if(t===null||t.length===0)return!1;var e=t,r=/\/([gim]*)$/.exec(t),o="";return!(e[0]==="/"&&(r&&(o=r[1]),o.length>3||e[e.length-o.length-1]!=="/"))}function CHe(t){var e=t,r=/\/([gim]*)$/.exec(t),o="";return e[0]==="/"&&(r&&(o=r[1]),e=e.slice(1,e.length-o.length-1)),new RegExp(e,o)}function IHe(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}function wHe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}NV.exports=new yHe("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:EHe,construct:CHe,predicate:wHe,represent:IHe})});var _V=_((jxt,UV)=>{"use strict";var mS;try{MV=ve,mS=MV("esprima")}catch{typeof window<"u"&&(mS=window.esprima)}var MV,BHe=as();function vHe(t){if(t===null)return!1;try{var e="("+t+")",r=mS.parse(e,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function DHe(t){var e="("+t+")",r=mS.parse(e,{range:!0}),o=[],a;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(n){o.push(n.name)}),a=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(o,e.slice(a[0]+1,a[1]-1)):new Function(o,"return "+e.slice(a[0],a[1]))}function SHe(t){return t.toString()}function PHe(t){return Object.prototype.toString.call(t)==="[object Function]"}UV.exports=new BHe("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:vHe,construct:DHe,predicate:PHe,represent:SHe})});var hw=_((Wxt,qV)=>{"use strict";var HV=$0();qV.exports=HV.DEFAULT=new HV({include:[Cm()],explicit:[LV(),OV(),_V()]})});var aK=_((Yxt,gw)=>{"use strict";var mf=Z0(),JV=ym(),xHe=JY(),zV=Cm(),bHe=hw(),Kp=Object.prototype.hasOwnProperty,yS=1,XV=2,ZV=3,ES=4,JT=1,kHe=2,jV=3,QHe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,FHe=/[\x85\u2028\u2029]/,RHe=/[,\[\]\{\}]/,$V=/^(?:!|!!|![a-z\-]+!)$/i,eK=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function GV(t){return Object.prototype.toString.call(t)}function Wu(t){return t===10||t===13}function rg(t){return t===9||t===32}function Da(t){return t===9||t===32||t===10||t===13}function Im(t){return t===44||t===91||t===93||t===123||t===125}function THe(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function LHe(t){return t===120?2:t===117?4:t===85?8:0}function NHe(t){return 48<=t&&t<=57?t-48:-1}function WV(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?` -`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"\x85":t===95?"\xA0":t===76?"\u2028":t===80?"\u2029":""}function OHe(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}var tK=new Array(256),rK=new Array(256);for(tg=0;tg<256;tg++)tK[tg]=WV(tg)?1:0,rK[tg]=WV(tg);var tg;function MHe(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||bHe,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function nK(t,e){return new JV(e,new xHe(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function Qr(t,e){throw nK(t,e)}function CS(t,e){t.onWarning&&t.onWarning.call(null,nK(t,e))}var YV={YAML:function(e,r,o){var a,n,u;e.version!==null&&Qr(e,"duplication of %YAML directive"),o.length!==1&&Qr(e,"YAML directive accepts exactly one argument"),a=/^([0-9]+)\.([0-9]+)$/.exec(o[0]),a===null&&Qr(e,"ill-formed argument of the YAML directive"),n=parseInt(a[1],10),u=parseInt(a[2],10),n!==1&&Qr(e,"unacceptable YAML version of the document"),e.version=o[0],e.checkLineBreaks=u<2,u!==1&&u!==2&&CS(e,"unsupported YAML version of the document")},TAG:function(e,r,o){var a,n;o.length!==2&&Qr(e,"TAG directive accepts exactly two arguments"),a=o[0],n=o[1],$V.test(a)||Qr(e,"ill-formed tag handle (first argument) of the TAG directive"),Kp.call(e.tagMap,a)&&Qr(e,'there is a previously declared suffix for "'+a+'" tag handle'),eK.test(n)||Qr(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[a]=n}};function Vp(t,e,r,o){var a,n,u,A;if(e1&&(t.result+=mf.repeat(` -`,e-1))}function UHe(t,e,r){var o,a,n,u,A,p,h,E,w=t.kind,D=t.result,b;if(b=t.input.charCodeAt(t.position),Da(b)||Im(b)||b===35||b===38||b===42||b===33||b===124||b===62||b===39||b===34||b===37||b===64||b===96||(b===63||b===45)&&(a=t.input.charCodeAt(t.position+1),Da(a)||r&&Im(a)))return!1;for(t.kind="scalar",t.result="",n=u=t.position,A=!1;b!==0;){if(b===58){if(a=t.input.charCodeAt(t.position+1),Da(a)||r&&Im(a))break}else if(b===35){if(o=t.input.charCodeAt(t.position-1),Da(o))break}else{if(t.position===t.lineStart&&IS(t)||r&&Im(b))break;if(Wu(b))if(p=t.line,h=t.lineStart,E=t.lineIndent,Yi(t,!1,-1),t.lineIndent>=e){A=!0,b=t.input.charCodeAt(t.position);continue}else{t.position=u,t.line=p,t.lineStart=h,t.lineIndent=E;break}}A&&(Vp(t,n,u,!1),XT(t,t.line-p),n=u=t.position,A=!1),rg(b)||(u=t.position+1),b=t.input.charCodeAt(++t.position)}return Vp(t,n,u,!1),t.result?!0:(t.kind=w,t.result=D,!1)}function _He(t,e){var r,o,a;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,o=a=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(Vp(t,o,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)o=t.position,t.position++,a=t.position;else return!0;else Wu(r)?(Vp(t,o,a,!0),XT(t,Yi(t,!1,e)),o=a=t.position):t.position===t.lineStart&&IS(t)?Qr(t,"unexpected end of the document within a single quoted scalar"):(t.position++,a=t.position);Qr(t,"unexpected end of the stream within a single quoted scalar")}function HHe(t,e){var r,o,a,n,u,A;if(A=t.input.charCodeAt(t.position),A!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=o=t.position;(A=t.input.charCodeAt(t.position))!==0;){if(A===34)return Vp(t,r,t.position,!0),t.position++,!0;if(A===92){if(Vp(t,r,t.position,!0),A=t.input.charCodeAt(++t.position),Wu(A))Yi(t,!1,e);else if(A<256&&tK[A])t.result+=rK[A],t.position++;else if((u=LHe(A))>0){for(a=u,n=0;a>0;a--)A=t.input.charCodeAt(++t.position),(u=THe(A))>=0?n=(n<<4)+u:Qr(t,"expected hexadecimal character");t.result+=OHe(n),t.position++}else Qr(t,"unknown escape sequence");r=o=t.position}else Wu(A)?(Vp(t,r,o,!0),XT(t,Yi(t,!1,e)),r=o=t.position):t.position===t.lineStart&&IS(t)?Qr(t,"unexpected end of the document within a double quoted scalar"):(t.position++,o=t.position)}Qr(t,"unexpected end of the stream within a double quoted scalar")}function qHe(t,e){var r=!0,o,a=t.tag,n,u=t.anchor,A,p,h,E,w,D={},b,C,T,N;if(N=t.input.charCodeAt(t.position),N===91)p=93,w=!1,n=[];else if(N===123)p=125,w=!0,n={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=n),N=t.input.charCodeAt(++t.position);N!==0;){if(Yi(t,!0,e),N=t.input.charCodeAt(t.position),N===p)return t.position++,t.tag=a,t.anchor=u,t.kind=w?"mapping":"sequence",t.result=n,!0;r||Qr(t,"missed comma between flow collection entries"),C=b=T=null,h=E=!1,N===63&&(A=t.input.charCodeAt(t.position+1),Da(A)&&(h=E=!0,t.position++,Yi(t,!0,e))),o=t.line,Bm(t,e,yS,!1,!0),C=t.tag,b=t.result,Yi(t,!0,e),N=t.input.charCodeAt(t.position),(E||t.line===o)&&N===58&&(h=!0,N=t.input.charCodeAt(++t.position),Yi(t,!0,e),Bm(t,e,yS,!1,!0),T=t.result),w?wm(t,n,D,C,b,T):h?n.push(wm(t,null,D,C,b,T)):n.push(b),Yi(t,!0,e),N=t.input.charCodeAt(t.position),N===44?(r=!0,N=t.input.charCodeAt(++t.position)):r=!1}Qr(t,"unexpected end of the stream within a flow collection")}function jHe(t,e){var r,o,a=JT,n=!1,u=!1,A=e,p=0,h=!1,E,w;if(w=t.input.charCodeAt(t.position),w===124)o=!1;else if(w===62)o=!0;else return!1;for(t.kind="scalar",t.result="";w!==0;)if(w=t.input.charCodeAt(++t.position),w===43||w===45)JT===a?a=w===43?jV:kHe:Qr(t,"repeat of a chomping mode identifier");else if((E=NHe(w))>=0)E===0?Qr(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?Qr(t,"repeat of an indentation width identifier"):(A=e+E-1,u=!0);else break;if(rg(w)){do w=t.input.charCodeAt(++t.position);while(rg(w));if(w===35)do w=t.input.charCodeAt(++t.position);while(!Wu(w)&&w!==0)}for(;w!==0;){for(zT(t),t.lineIndent=0,w=t.input.charCodeAt(t.position);(!u||t.lineIndentA&&(A=t.lineIndent),Wu(w)){p++;continue}if(t.lineIndente)&&p!==0)Qr(t,"bad indentation of a sequence entry");else if(t.lineIndente)&&(Bm(t,e,ES,!0,a)&&(C?D=t.result:b=t.result),C||(wm(t,h,E,w,D,b,n,u),w=D=b=null),Yi(t,!0,-1),N=t.input.charCodeAt(t.position)),t.lineIndent>e&&N!==0)Qr(t,"bad indentation of a mapping entry");else if(t.lineIndente?p=1:t.lineIndent===e?p=0:t.lineIndente?p=1:t.lineIndent===e?p=0:t.lineIndent tag; it should be "scalar", not "'+t.kind+'"'),w=0,D=t.implicitTypes.length;w tag; it should be "'+b.kind+'", not "'+t.kind+'"'),b.resolve(t.result)?(t.result=b.construct(t.result),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):Qr(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):Qr(t,"unknown tag !<"+t.tag+">");return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||E}function KHe(t){var e=t.position,r,o,a,n=!1,u;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};(u=t.input.charCodeAt(t.position))!==0&&(Yi(t,!0,-1),u=t.input.charCodeAt(t.position),!(t.lineIndent>0||u!==37));){for(n=!0,u=t.input.charCodeAt(++t.position),r=t.position;u!==0&&!Da(u);)u=t.input.charCodeAt(++t.position);for(o=t.input.slice(r,t.position),a=[],o.length<1&&Qr(t,"directive name must not be less than one character in length");u!==0;){for(;rg(u);)u=t.input.charCodeAt(++t.position);if(u===35){do u=t.input.charCodeAt(++t.position);while(u!==0&&!Wu(u));break}if(Wu(u))break;for(r=t.position;u!==0&&!Da(u);)u=t.input.charCodeAt(++t.position);a.push(t.input.slice(r,t.position))}u!==0&&zT(t),Kp.call(YV,o)?YV[o](t,o,a):CS(t,'unknown document directive "'+o+'"')}if(Yi(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,Yi(t,!0,-1)):n&&Qr(t,"directives end mark is expected"),Bm(t,t.lineIndent-1,ES,!1,!0),Yi(t,!0,-1),t.checkLineBreaks&&FHe.test(t.input.slice(e,t.position))&&CS(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&IS(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Yi(t,!0,-1));return}if(t.position"u"&&(r=e,e=null);var o=iK(t,r);if(typeof e!="function")return o;for(var a=0,n=o.length;a"u"&&(r=e,e=null),sK(t,e,mf.extend({schema:zV},r))}function zHe(t,e){return oK(t,mf.extend({schema:zV},e))}gw.exports.loadAll=sK;gw.exports.load=oK;gw.exports.safeLoadAll=JHe;gw.exports.safeLoad=zHe});var kK=_((Vxt,tL)=>{"use strict";var mw=Z0(),yw=ym(),XHe=hw(),ZHe=Cm(),gK=Object.prototype.toString,dK=Object.prototype.hasOwnProperty,$He=9,dw=10,e6e=13,t6e=32,r6e=33,n6e=34,mK=35,i6e=37,s6e=38,o6e=39,a6e=42,yK=44,l6e=45,EK=58,c6e=61,u6e=62,A6e=63,f6e=64,CK=91,IK=93,p6e=96,wK=123,h6e=124,BK=125,mo={};mo[0]="\\0";mo[7]="\\a";mo[8]="\\b";mo[9]="\\t";mo[10]="\\n";mo[11]="\\v";mo[12]="\\f";mo[13]="\\r";mo[27]="\\e";mo[34]='\\"';mo[92]="\\\\";mo[133]="\\N";mo[160]="\\_";mo[8232]="\\L";mo[8233]="\\P";var g6e=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function d6e(t,e){var r,o,a,n,u,A,p;if(e===null)return{};for(r={},o=Object.keys(e),a=0,n=o.length;a0?t.charCodeAt(n-1):null,D=D&&uK(u,A)}else{for(n=0;no&&t[w+1]!==" ",w=n);else if(!vm(u))return wS;A=n>0?t.charCodeAt(n-1):null,D=D&&uK(u,A)}h=h||E&&n-w-1>o&&t[w+1]!==" "}return!p&&!h?D&&!a(t)?DK:SK:r>9&&vK(t)?wS:h?xK:PK}function w6e(t,e,r,o){t.dump=function(){if(e.length===0)return"''";if(!t.noCompatMode&&g6e.indexOf(e)!==-1)return"'"+e+"'";var a=t.indent*Math.max(1,r),n=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),u=o||t.flowLevel>-1&&r>=t.flowLevel;function A(p){return y6e(t,p)}switch(I6e(e,u,t.indent,n,A)){case DK:return e;case SK:return"'"+e.replace(/'/g,"''")+"'";case PK:return"|"+AK(e,t.indent)+fK(cK(e,a));case xK:return">"+AK(e,t.indent)+fK(cK(B6e(e,n),a));case wS:return'"'+v6e(e,n)+'"';default:throw new yw("impossible error: invalid scalar style")}}()}function AK(t,e){var r=vK(t)?String(e):"",o=t[t.length-1]===` -`,a=o&&(t[t.length-2]===` -`||t===` -`),n=a?"+":o?"":"-";return r+n+` -`}function fK(t){return t[t.length-1]===` -`?t.slice(0,-1):t}function B6e(t,e){for(var r=/(\n+)([^\n]*)/g,o=function(){var h=t.indexOf(` -`);return h=h!==-1?h:t.length,r.lastIndex=h,pK(t.slice(0,h),e)}(),a=t[0]===` -`||t[0]===" ",n,u;u=r.exec(t);){var A=u[1],p=u[2];n=p[0]===" ",o+=A+(!a&&!n&&p!==""?` -`:"")+pK(p,e),a=n}return o}function pK(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,o,a=0,n,u=0,A=0,p="";o=r.exec(t);)A=o.index,A-a>e&&(n=u>a?u:A,p+=` -`+t.slice(a,n),a=n+1),u=A;return p+=` -`,t.length-a>e&&u>a?p+=t.slice(a,u)+` -`+t.slice(u+1):p+=t.slice(a),p.slice(1)}function v6e(t){for(var e="",r,o,a,n=0;n=55296&&r<=56319&&(o=t.charCodeAt(n+1),o>=56320&&o<=57343)){e+=lK((r-55296)*1024+o-56320+65536),n++;continue}a=mo[r],e+=!a&&vm(r)?t[n]:a||lK(r)}return e}function D6e(t,e,r){var o="",a=t.tag,n,u;for(n=0,u=r.length;n1024&&(E+="? "),E+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),ng(t,e,h,!1,!1)&&(E+=t.dump,o+=E));t.tag=a,t.dump="{"+o+"}"}function x6e(t,e,r,o){var a="",n=t.tag,u=Object.keys(r),A,p,h,E,w,D;if(t.sortKeys===!0)u.sort();else if(typeof t.sortKeys=="function")u.sort(t.sortKeys);else if(t.sortKeys)throw new yw("sortKeys must be a boolean or a function");for(A=0,p=u.length;A1024,w&&(t.dump&&dw===t.dump.charCodeAt(0)?D+="?":D+="? "),D+=t.dump,w&&(D+=ZT(t,e)),ng(t,e+1,E,!0,w)&&(t.dump&&dw===t.dump.charCodeAt(0)?D+=":":D+=": ",D+=t.dump,a+=D));t.tag=n,t.dump=a||"{}"}function hK(t,e,r){var o,a,n,u,A,p;for(a=r?t.explicitTypes:t.implicitTypes,n=0,u=a.length;n tag resolver accepts not "'+p+'" style');t.dump=o}return!0}return!1}function ng(t,e,r,o,a,n){t.tag=null,t.dump=r,hK(t,r,!1)||hK(t,r,!0);var u=gK.call(t.dump);o&&(o=t.flowLevel<0||t.flowLevel>e);var A=u==="[object Object]"||u==="[object Array]",p,h;if(A&&(p=t.duplicates.indexOf(r),h=p!==-1),(t.tag!==null&&t.tag!=="?"||h||t.indent!==2&&e>0)&&(a=!1),h&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(A&&h&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),u==="[object Object]")o&&Object.keys(t.dump).length!==0?(x6e(t,e,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(P6e(t,e,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump));else if(u==="[object Array]"){var E=t.noArrayIndent&&e>0?e-1:e;o&&t.dump.length!==0?(S6e(t,E,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(D6e(t,E,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump))}else if(u==="[object String]")t.tag!=="?"&&w6e(t,t.dump,e,n);else{if(t.skipInvalid)return!1;throw new yw("unacceptable kind of an object to dump "+u)}t.tag!==null&&t.tag!=="?"&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function b6e(t,e){var r=[],o=[],a,n;for($T(t,r,o),a=0,n=o.length;a{"use strict";var BS=aK(),QK=kK();function vS(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}Fi.exports.Type=as();Fi.exports.Schema=$0();Fi.exports.FAILSAFE_SCHEMA=dS();Fi.exports.JSON_SCHEMA=YT();Fi.exports.CORE_SCHEMA=VT();Fi.exports.DEFAULT_SAFE_SCHEMA=Cm();Fi.exports.DEFAULT_FULL_SCHEMA=hw();Fi.exports.load=BS.load;Fi.exports.loadAll=BS.loadAll;Fi.exports.safeLoad=BS.safeLoad;Fi.exports.safeLoadAll=BS.safeLoadAll;Fi.exports.dump=QK.dump;Fi.exports.safeDump=QK.safeDump;Fi.exports.YAMLException=ym();Fi.exports.MINIMAL_SCHEMA=dS();Fi.exports.SAFE_SCHEMA=Cm();Fi.exports.DEFAULT_SCHEMA=hw();Fi.exports.scan=vS("scan");Fi.exports.parse=vS("parse");Fi.exports.compose=vS("compose");Fi.exports.addConstructor=vS("addConstructor")});var TK=_((Jxt,RK)=>{"use strict";var Q6e=FK();RK.exports=Q6e});var NK=_((zxt,LK)=>{"use strict";function F6e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function ig(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ig)}F6e(ig,Error);ig.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",w;for(w=0;w0){for(w=1,D=1;w({[gt]:Ne})))},ce=function(ee){return ee},ue=function(ee){return ee},Ie=oa("correct indentation"),he=" ",De=un(" ",!1),Ee=function(ee){return ee.length===ar*vt},g=function(ee){return ee.length===(ar+1)*vt},me=function(){return ar++,!0},Ce=function(){return ar--,!0},fe=function(){return Lo()},ie=oa("pseudostring"),Z=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,Se=qn(["\r",` -`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),Re=/^[^\r\n\t ,\][{}:#"']/,ht=qn(["\r",` -`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),q=function(){return Lo().replace(/^ *| *$/g,"")},nt="--",Le=un("--",!1),Te=/^[a-zA-Z\/0-9]/,ke=qn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),Ke=/^[^\r\n\t :,]/,xe=qn(["\r",` -`," "," ",":",","],!0,!1),tt="null",He=un("null",!1),x=function(){return null},I="true",P=un("true",!1),y=function(){return!0},R="false",z=un("false",!1),X=function(){return!1},$=oa("string"),se='"',be=un('"',!1),Fe=function(){return""},lt=function(ee){return ee},Et=function(ee){return ee.join("")},qt=/^[^"\\\0-\x1F\x7F]/,nr=qn(['"',"\\",["\0",""],"\x7F"],!0,!1),Pt='\\"',cn=un('\\"',!1),Sr=function(){return'"'},yr="\\\\",Rr=un("\\\\",!1),Xr=function(){return"\\"},$n="\\/",Xs=un("\\/",!1),Hi=function(){return"/"},Qs="\\b",Zs=un("\\b",!1),bi=function(){return"\b"},Fs="\\f",$s=un("\\f",!1),PA=function(){return"\f"},gu="\\n",op=un("\\n",!1),ap=function(){return` -`},Rs="\\r",Nn=un("\\r",!1),hs=function(){return"\r"},Ts="\\t",pc=un("\\t",!1),hc=function(){return" "},gc="\\u",xA=un("\\u",!1),bA=function(ee,ye,Ne,gt){return String.fromCharCode(parseInt(`0x${ee}${ye}${Ne}${gt}`))},Ro=/^[0-9a-fA-F]/,To=qn([["0","9"],["a","f"],["A","F"]],!1,!1),kA=oa("blank space"),pr=/^[ \t]/,Me=qn([" "," "],!1,!1),ia=oa("white space"),dc=/^[ \t\n\r]/,Er=qn([" "," ",` -`,"\r"],!1,!1),du=`\r -`,QA=un(`\r -`,!1),FA=` -`,mc=un(` -`,!1),yc="\r",Il=un("\r",!1),we=0,Tt=0,wl=[{line:1,column:1}],Bi=0,Ls=[],Ft=0,Bn;if("startRule"in e){if(!(e.startRule in o))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=o[e.startRule]}function Lo(){return t.substring(Tt,we)}function ki(){return la(Tt,we)}function vi(ee,ye){throw ye=ye!==void 0?ye:la(Tt,we),mu([oa(ee)],t.substring(Tt,we),ye)}function sa(ee,ye){throw ye=ye!==void 0?ye:la(Tt,we),ca(ee,ye)}function un(ee,ye){return{type:"literal",text:ee,ignoreCase:ye}}function qn(ee,ye,Ne){return{type:"class",parts:ee,inverted:ye,ignoreCase:Ne}}function Ec(){return{type:"any"}}function lp(){return{type:"end"}}function oa(ee){return{type:"other",description:ee}}function aa(ee){var ye=wl[ee],Ne;if(ye)return ye;for(Ne=ee-1;!wl[Ne];)Ne--;for(ye=wl[Ne],ye={line:ye.line,column:ye.column};NeBi&&(Bi=we,Ls=[]),Ls.push(ee))}function ca(ee,ye){return new ig(ee,null,null,ye)}function mu(ee,ye,Ne){return new ig(ig.buildMessage(ee,ye),ee,ye,Ne)}function Bl(){var ee;return ee=RA(),ee}function dn(){var ee,ye,Ne;for(ee=we,ye=[],Ne=No();Ne!==r;)ye.push(Ne),Ne=No();return ye!==r&&(Tt=ee,ye=n(ye)),ee=ye,ee}function No(){var ee,ye,Ne,gt,mt;return ee=we,ye=qa(),ye!==r?(t.charCodeAt(we)===45?(Ne=u,we++):(Ne=r,Ft===0&&Ze(A)),Ne!==r?(gt=Dn(),gt!==r?(mt=Oo(),mt!==r?(Tt=ee,ye=p(mt),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r),ee}function RA(){var ee,ye,Ne;for(ee=we,ye=[],Ne=TA();Ne!==r;)ye.push(Ne),Ne=TA();return ye!==r&&(Tt=ee,ye=h(ye)),ee=ye,ee}function TA(){var ee,ye,Ne,gt,mt,Dt,er,sn,ei;if(ee=we,ye=Dn(),ye===r&&(ye=null),ye!==r){if(Ne=we,t.charCodeAt(we)===35?(gt=E,we++):(gt=r,Ft===0&&Ze(w)),gt!==r){if(mt=[],Dt=we,er=we,Ft++,sn=st(),Ft--,sn===r?er=void 0:(we=er,er=r),er!==r?(t.length>we?(sn=t.charAt(we),we++):(sn=r,Ft===0&&Ze(D)),sn!==r?(er=[er,sn],Dt=er):(we=Dt,Dt=r)):(we=Dt,Dt=r),Dt!==r)for(;Dt!==r;)mt.push(Dt),Dt=we,er=we,Ft++,sn=st(),Ft--,sn===r?er=void 0:(we=er,er=r),er!==r?(t.length>we?(sn=t.charAt(we),we++):(sn=r,Ft===0&&Ze(D)),sn!==r?(er=[er,sn],Dt=er):(we=Dt,Dt=r)):(we=Dt,Dt=r);else mt=r;mt!==r?(gt=[gt,mt],Ne=gt):(we=Ne,Ne=r)}else we=Ne,Ne=r;if(Ne===r&&(Ne=null),Ne!==r){if(gt=[],mt=Je(),mt!==r)for(;mt!==r;)gt.push(mt),mt=Je();else gt=r;gt!==r?(Tt=ee,ye=b(),ee=ye):(we=ee,ee=r)}else we=ee,ee=r}else we=ee,ee=r;if(ee===r&&(ee=we,ye=qa(),ye!==r?(Ne=ua(),Ne!==r?(gt=Dn(),gt===r&&(gt=null),gt!==r?(t.charCodeAt(we)===58?(mt=C,we++):(mt=r,Ft===0&&Ze(T)),mt!==r?(Dt=Dn(),Dt===r&&(Dt=null),Dt!==r?(er=Oo(),er!==r?(Tt=ee,ye=N(Ne,er),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r),ee===r&&(ee=we,ye=qa(),ye!==r?(Ne=qi(),Ne!==r?(gt=Dn(),gt===r&&(gt=null),gt!==r?(t.charCodeAt(we)===58?(mt=C,we++):(mt=r,Ft===0&&Ze(T)),mt!==r?(Dt=Dn(),Dt===r&&(Dt=null),Dt!==r?(er=Oo(),er!==r?(Tt=ee,ye=N(Ne,er),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r),ee===r))){if(ee=we,ye=qa(),ye!==r)if(Ne=qi(),Ne!==r)if(gt=Dn(),gt!==r)if(mt=Cc(),mt!==r){if(Dt=[],er=Je(),er!==r)for(;er!==r;)Dt.push(er),er=Je();else Dt=r;Dt!==r?(Tt=ee,ye=N(Ne,mt),ee=ye):(we=ee,ee=r)}else we=ee,ee=r;else we=ee,ee=r;else we=ee,ee=r;else we=ee,ee=r;if(ee===r)if(ee=we,ye=qa(),ye!==r)if(Ne=qi(),Ne!==r){if(gt=[],mt=we,Dt=Dn(),Dt===r&&(Dt=null),Dt!==r?(t.charCodeAt(we)===44?(er=U,we++):(er=r,Ft===0&&Ze(J)),er!==r?(sn=Dn(),sn===r&&(sn=null),sn!==r?(ei=qi(),ei!==r?(Tt=mt,Dt=te(Ne,ei),mt=Dt):(we=mt,mt=r)):(we=mt,mt=r)):(we=mt,mt=r)):(we=mt,mt=r),mt!==r)for(;mt!==r;)gt.push(mt),mt=we,Dt=Dn(),Dt===r&&(Dt=null),Dt!==r?(t.charCodeAt(we)===44?(er=U,we++):(er=r,Ft===0&&Ze(J)),er!==r?(sn=Dn(),sn===r&&(sn=null),sn!==r?(ei=qi(),ei!==r?(Tt=mt,Dt=te(Ne,ei),mt=Dt):(we=mt,mt=r)):(we=mt,mt=r)):(we=mt,mt=r)):(we=mt,mt=r);else gt=r;gt!==r?(mt=Dn(),mt===r&&(mt=null),mt!==r?(t.charCodeAt(we)===58?(Dt=C,we++):(Dt=r,Ft===0&&Ze(T)),Dt!==r?(er=Dn(),er===r&&(er=null),er!==r?(sn=Oo(),sn!==r?(Tt=ee,ye=le(Ne,gt,sn),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)}else we=ee,ee=r;else we=ee,ee=r}return ee}function Oo(){var ee,ye,Ne,gt,mt,Dt,er;if(ee=we,ye=we,Ft++,Ne=we,gt=st(),gt!==r?(mt=Ot(),mt!==r?(t.charCodeAt(we)===45?(Dt=u,we++):(Dt=r,Ft===0&&Ze(A)),Dt!==r?(er=Dn(),er!==r?(gt=[gt,mt,Dt,er],Ne=gt):(we=Ne,Ne=r)):(we=Ne,Ne=r)):(we=Ne,Ne=r)):(we=Ne,Ne=r),Ft--,Ne!==r?(we=ye,ye=void 0):ye=r,ye!==r?(Ne=Je(),Ne!==r?(gt=vn(),gt!==r?(mt=dn(),mt!==r?(Dt=Mo(),Dt!==r?(Tt=ee,ye=ce(mt),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r),ee===r&&(ee=we,ye=st(),ye!==r?(Ne=vn(),Ne!==r?(gt=RA(),gt!==r?(mt=Mo(),mt!==r?(Tt=ee,ye=ce(gt),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r),ee===r))if(ee=we,ye=vl(),ye!==r){if(Ne=[],gt=Je(),gt!==r)for(;gt!==r;)Ne.push(gt),gt=Je();else Ne=r;Ne!==r?(Tt=ee,ye=ue(ye),ee=ye):(we=ee,ee=r)}else we=ee,ee=r;return ee}function qa(){var ee,ye,Ne;for(Ft++,ee=we,ye=[],t.charCodeAt(we)===32?(Ne=he,we++):(Ne=r,Ft===0&&Ze(De));Ne!==r;)ye.push(Ne),t.charCodeAt(we)===32?(Ne=he,we++):(Ne=r,Ft===0&&Ze(De));return ye!==r?(Tt=we,Ne=Ee(ye),Ne?Ne=void 0:Ne=r,Ne!==r?(ye=[ye,Ne],ee=ye):(we=ee,ee=r)):(we=ee,ee=r),Ft--,ee===r&&(ye=r,Ft===0&&Ze(Ie)),ee}function Ot(){var ee,ye,Ne;for(ee=we,ye=[],t.charCodeAt(we)===32?(Ne=he,we++):(Ne=r,Ft===0&&Ze(De));Ne!==r;)ye.push(Ne),t.charCodeAt(we)===32?(Ne=he,we++):(Ne=r,Ft===0&&Ze(De));return ye!==r?(Tt=we,Ne=g(ye),Ne?Ne=void 0:Ne=r,Ne!==r?(ye=[ye,Ne],ee=ye):(we=ee,ee=r)):(we=ee,ee=r),ee}function vn(){var ee;return Tt=we,ee=me(),ee?ee=void 0:ee=r,ee}function Mo(){var ee;return Tt=we,ee=Ce(),ee?ee=void 0:ee=r,ee}function ua(){var ee;return ee=ja(),ee===r&&(ee=Dl()),ee}function qi(){var ee,ye,Ne;if(ee=ja(),ee===r){if(ee=we,ye=[],Ne=Aa(),Ne!==r)for(;Ne!==r;)ye.push(Ne),Ne=Aa();else ye=r;ye!==r&&(Tt=ee,ye=fe()),ee=ye}return ee}function vl(){var ee;return ee=Di(),ee===r&&(ee=rs(),ee===r&&(ee=ja(),ee===r&&(ee=Dl()))),ee}function Cc(){var ee;return ee=Di(),ee===r&&(ee=ja(),ee===r&&(ee=Aa())),ee}function Dl(){var ee,ye,Ne,gt,mt,Dt;if(Ft++,ee=we,Z.test(t.charAt(we))?(ye=t.charAt(we),we++):(ye=r,Ft===0&&Ze(Se)),ye!==r){for(Ne=[],gt=we,mt=Dn(),mt===r&&(mt=null),mt!==r?(Re.test(t.charAt(we))?(Dt=t.charAt(we),we++):(Dt=r,Ft===0&&Ze(ht)),Dt!==r?(mt=[mt,Dt],gt=mt):(we=gt,gt=r)):(we=gt,gt=r);gt!==r;)Ne.push(gt),gt=we,mt=Dn(),mt===r&&(mt=null),mt!==r?(Re.test(t.charAt(we))?(Dt=t.charAt(we),we++):(Dt=r,Ft===0&&Ze(ht)),Dt!==r?(mt=[mt,Dt],gt=mt):(we=gt,gt=r)):(we=gt,gt=r);Ne!==r?(Tt=ee,ye=q(),ee=ye):(we=ee,ee=r)}else we=ee,ee=r;return Ft--,ee===r&&(ye=r,Ft===0&&Ze(ie)),ee}function Aa(){var ee,ye,Ne,gt,mt;if(ee=we,t.substr(we,2)===nt?(ye=nt,we+=2):(ye=r,Ft===0&&Ze(Le)),ye===r&&(ye=null),ye!==r)if(Te.test(t.charAt(we))?(Ne=t.charAt(we),we++):(Ne=r,Ft===0&&Ze(ke)),Ne!==r){for(gt=[],Ke.test(t.charAt(we))?(mt=t.charAt(we),we++):(mt=r,Ft===0&&Ze(xe));mt!==r;)gt.push(mt),Ke.test(t.charAt(we))?(mt=t.charAt(we),we++):(mt=r,Ft===0&&Ze(xe));gt!==r?(Tt=ee,ye=q(),ee=ye):(we=ee,ee=r)}else we=ee,ee=r;else we=ee,ee=r;return ee}function Di(){var ee,ye;return ee=we,t.substr(we,4)===tt?(ye=tt,we+=4):(ye=r,Ft===0&&Ze(He)),ye!==r&&(Tt=ee,ye=x()),ee=ye,ee}function rs(){var ee,ye;return ee=we,t.substr(we,4)===I?(ye=I,we+=4):(ye=r,Ft===0&&Ze(P)),ye!==r&&(Tt=ee,ye=y()),ee=ye,ee===r&&(ee=we,t.substr(we,5)===R?(ye=R,we+=5):(ye=r,Ft===0&&Ze(z)),ye!==r&&(Tt=ee,ye=X()),ee=ye),ee}function ja(){var ee,ye,Ne,gt;return Ft++,ee=we,t.charCodeAt(we)===34?(ye=se,we++):(ye=r,Ft===0&&Ze(be)),ye!==r?(t.charCodeAt(we)===34?(Ne=se,we++):(Ne=r,Ft===0&&Ze(be)),Ne!==r?(Tt=ee,ye=Fe(),ee=ye):(we=ee,ee=r)):(we=ee,ee=r),ee===r&&(ee=we,t.charCodeAt(we)===34?(ye=se,we++):(ye=r,Ft===0&&Ze(be)),ye!==r?(Ne=yu(),Ne!==r?(t.charCodeAt(we)===34?(gt=se,we++):(gt=r,Ft===0&&Ze(be)),gt!==r?(Tt=ee,ye=lt(Ne),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)),Ft--,ee===r&&(ye=r,Ft===0&&Ze($)),ee}function yu(){var ee,ye,Ne;if(ee=we,ye=[],Ne=Sl(),Ne!==r)for(;Ne!==r;)ye.push(Ne),Ne=Sl();else ye=r;return ye!==r&&(Tt=ee,ye=Et(ye)),ee=ye,ee}function Sl(){var ee,ye,Ne,gt,mt,Dt;return qt.test(t.charAt(we))?(ee=t.charAt(we),we++):(ee=r,Ft===0&&Ze(nr)),ee===r&&(ee=we,t.substr(we,2)===Pt?(ye=Pt,we+=2):(ye=r,Ft===0&&Ze(cn)),ye!==r&&(Tt=ee,ye=Sr()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===yr?(ye=yr,we+=2):(ye=r,Ft===0&&Ze(Rr)),ye!==r&&(Tt=ee,ye=Xr()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===$n?(ye=$n,we+=2):(ye=r,Ft===0&&Ze(Xs)),ye!==r&&(Tt=ee,ye=Hi()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===Qs?(ye=Qs,we+=2):(ye=r,Ft===0&&Ze(Zs)),ye!==r&&(Tt=ee,ye=bi()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===Fs?(ye=Fs,we+=2):(ye=r,Ft===0&&Ze($s)),ye!==r&&(Tt=ee,ye=PA()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===gu?(ye=gu,we+=2):(ye=r,Ft===0&&Ze(op)),ye!==r&&(Tt=ee,ye=ap()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===Rs?(ye=Rs,we+=2):(ye=r,Ft===0&&Ze(Nn)),ye!==r&&(Tt=ee,ye=hs()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===Ts?(ye=Ts,we+=2):(ye=r,Ft===0&&Ze(pc)),ye!==r&&(Tt=ee,ye=hc()),ee=ye,ee===r&&(ee=we,t.substr(we,2)===gc?(ye=gc,we+=2):(ye=r,Ft===0&&Ze(xA)),ye!==r?(Ne=pi(),Ne!==r?(gt=pi(),gt!==r?(mt=pi(),mt!==r?(Dt=pi(),Dt!==r?(Tt=ee,ye=bA(Ne,gt,mt,Dt),ee=ye):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)):(we=ee,ee=r)))))))))),ee}function pi(){var ee;return Ro.test(t.charAt(we))?(ee=t.charAt(we),we++):(ee=r,Ft===0&&Ze(To)),ee}function Dn(){var ee,ye;if(Ft++,ee=[],pr.test(t.charAt(we))?(ye=t.charAt(we),we++):(ye=r,Ft===0&&Ze(Me)),ye!==r)for(;ye!==r;)ee.push(ye),pr.test(t.charAt(we))?(ye=t.charAt(we),we++):(ye=r,Ft===0&&Ze(Me));else ee=r;return Ft--,ee===r&&(ye=r,Ft===0&&Ze(kA)),ee}function Pl(){var ee,ye;if(Ft++,ee=[],dc.test(t.charAt(we))?(ye=t.charAt(we),we++):(ye=r,Ft===0&&Ze(Er)),ye!==r)for(;ye!==r;)ee.push(ye),dc.test(t.charAt(we))?(ye=t.charAt(we),we++):(ye=r,Ft===0&&Ze(Er));else ee=r;return Ft--,ee===r&&(ye=r,Ft===0&&Ze(ia)),ee}function Je(){var ee,ye,Ne,gt,mt,Dt;if(ee=we,ye=st(),ye!==r){for(Ne=[],gt=we,mt=Dn(),mt===r&&(mt=null),mt!==r?(Dt=st(),Dt!==r?(mt=[mt,Dt],gt=mt):(we=gt,gt=r)):(we=gt,gt=r);gt!==r;)Ne.push(gt),gt=we,mt=Dn(),mt===r&&(mt=null),mt!==r?(Dt=st(),Dt!==r?(mt=[mt,Dt],gt=mt):(we=gt,gt=r)):(we=gt,gt=r);Ne!==r?(ye=[ye,Ne],ee=ye):(we=ee,ee=r)}else we=ee,ee=r;return ee}function st(){var ee;return t.substr(we,2)===du?(ee=du,we+=2):(ee=r,Ft===0&&Ze(QA)),ee===r&&(t.charCodeAt(we)===10?(ee=FA,we++):(ee=r,Ft===0&&Ze(mc)),ee===r&&(t.charCodeAt(we)===13?(ee=yc,we++):(ee=r,Ft===0&&Ze(Il)))),ee}let vt=2,ar=0;if(Bn=a(),Bn!==r&&we===t.length)return Bn;throw Bn!==r&&we"u"?!0:typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.keys(t).every(e=>_K(t[e])):!1}function rL(t,e,r){if(t===null)return`null -`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()} -`;if(typeof t=="string")return`${MK(t)} -`;if(Array.isArray(t)){if(t.length===0)return`[] -`;let o=" ".repeat(e);return` -${t.map(n=>`${o}- ${rL(n,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let[o,a]=t instanceof DS?[t.data,!1]:[t,!0],n=" ".repeat(e),u=Object.keys(o);a&&u.sort((p,h)=>{let E=OK.indexOf(p),w=OK.indexOf(h);return E===-1&&w===-1?ph?1:0:E!==-1&&w===-1?-1:E===-1&&w!==-1?1:E-w});let A=u.filter(p=>!_K(o[p])).map((p,h)=>{let E=o[p],w=MK(p),D=rL(E,e+1,!0),b=h>0||r?n:"",C=w.length>1024?`? ${w} -${b}:`:`${w}:`,T=D.startsWith(` -`)?D:` ${D}`;return`${b}${C}${T}`}).join(e===0?` -`:"")||` -`;return r?` -${A}`:`${A}`}throw new Error(`Unsupported value type (${t})`)}function Sa(t){try{let e=rL(t,0,!1);return e!==` -`?e:""}catch(e){throw e.location&&(e.message=e.message.replace(/(\.)?$/,` (line ${e.location.start.line}, column ${e.location.start.column})$1`)),e}}function L6e(t){return t.endsWith(` -`)||(t+=` -`),(0,UK.parse)(t)}function O6e(t){if(N6e.test(t))return L6e(t);let e=(0,SS.safeLoad)(t,{schema:SS.FAILSAFE_SCHEMA,json:!0});if(e==null)return{};if(typeof e!="object")throw new Error(`Expected an indexed object, got a ${typeof e} instead. Does your file follow Yaml's rules?`);if(Array.isArray(e))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return e}function Vi(t){return O6e(t)}var SS,UK,T6e,OK,DS,N6e,HK=It(()=>{SS=et(TK()),UK=et(NK()),T6e=/^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/,OK=["__metadata","version","resolution","dependencies","peerDependencies","dependenciesMeta","peerDependenciesMeta","binaries"],DS=class{constructor(e){this.data=e}};Sa.PreserveOrdering=DS;N6e=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i});var Ew={};Vt(Ew,{parseResolution:()=>pS,parseShell:()=>uS,parseSyml:()=>Vi,stringifyArgument:()=>qT,stringifyArgumentSegment:()=>jT,stringifyArithmeticExpression:()=>fS,stringifyCommand:()=>HT,stringifyCommandChain:()=>mm,stringifyCommandChainThen:()=>_T,stringifyCommandLine:()=>AS,stringifyCommandLineThen:()=>UT,stringifyEnvSegment:()=>cS,stringifyRedirectArgument:()=>fw,stringifyResolution:()=>hS,stringifyShell:()=>dm,stringifyShellLine:()=>dm,stringifySyml:()=>Sa,stringifyValueArgument:()=>J0});var Ol=It(()=>{_Y();GY();HK()});var jK=_((tbt,nL)=>{"use strict";var M6e=t=>{let e=!1,r=!1,o=!1;for(let a=0;a{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let r=a=>e.pascalCase?a.charAt(0).toUpperCase()+a.slice(1):a;return Array.isArray(t)?t=t.map(a=>a.trim()).filter(a=>a.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=M6e(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(a,n)=>n.toUpperCase()).replace(/\d+(\w|$)/g,a=>a.toUpperCase()),r(t))};nL.exports=qK;nL.exports.default=qK});var GK=_((rbt,U6e)=>{U6e.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var sg=_(nl=>{"use strict";var YK=GK(),ls=process.env;Object.defineProperty(nl,"_vendors",{value:YK.map(function(t){return t.constant})});nl.name=null;nl.isPR=null;YK.forEach(function(t){let r=(Array.isArray(t.env)?t.env:[t.env]).every(function(o){return WK(o)});if(nl[t.constant]=r,!!r)switch(nl.name=t.name,typeof t.pr){case"string":nl.isPR=!!ls[t.pr];break;case"object":"env"in t.pr?nl.isPR=t.pr.env in ls&&ls[t.pr.env]!==t.pr.ne:"any"in t.pr?nl.isPR=t.pr.any.some(function(o){return!!ls[o]}):nl.isPR=WK(t.pr);break;default:nl.isPR=null}});nl.isCI=!!(ls.CI!=="false"&&(ls.BUILD_ID||ls.BUILD_NUMBER||ls.CI||ls.CI_APP_ID||ls.CI_BUILD_ID||ls.CI_BUILD_NUMBER||ls.CI_NAME||ls.CONTINUOUS_INTEGRATION||ls.RUN_ID||nl.name));function WK(t){return typeof t=="string"?!!ls[t]:"env"in t?ls[t.env]&&ls[t.env].includes(t.includes):"any"in t?t.any.some(function(e){return!!ls[e]}):Object.keys(t).every(function(e){return ls[e]===t[e]})}});var Vn,pn,og,iL,PS,VK,sL,oL,xS=It(()=>{(function(t){t.StartOfInput="\0",t.EndOfInput="",t.EndOfPartialInput=""})(Vn||(Vn={}));(function(t){t[t.InitialNode=0]="InitialNode",t[t.SuccessNode=1]="SuccessNode",t[t.ErrorNode=2]="ErrorNode",t[t.CustomNode=3]="CustomNode"})(pn||(pn={}));og=-1,iL=/^(-h|--help)(?:=([0-9]+))?$/,PS=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,VK=/^-[a-zA-Z]{2,}$/,sL=/^([^=]+)=([\s\S]*)$/,oL=process.env.DEBUG_CLI==="1"});var it,Dm,bS,aL,kS=It(()=>{xS();it=class extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}},Dm=class extends Error{constructor(e,r){if(super(),this.input=e,this.candidates=r,this.clipanion={type:"none"},this.name="UnknownSyntaxError",this.candidates.length===0)this.message="Command not found, but we're not sure what's the alternative.";else if(this.candidates.every(o=>o.reason!==null&&o.reason===r[0].reason)){let[{reason:o}]=this.candidates;this.message=`${o} - -${this.candidates.map(({usage:a})=>`$ ${a}`).join(` -`)}`}else if(this.candidates.length===1){let[{usage:o}]=this.candidates;this.message=`Command not found; did you mean: - -$ ${o} -${aL(e)}`}else this.message=`Command not found; did you mean one of: - -${this.candidates.map(({usage:o},a)=>`${`${a}.`.padStart(4)} ${o}`).join(` -`)} - -${aL(e)}`}},bS=class extends Error{constructor(e,r){super(),this.input=e,this.usages=r,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives: - -${this.usages.map((o,a)=>`${`${a}.`.padStart(4)} ${o}`).join(` -`)} - -${aL(e)}`}},aL=t=>`While running ${t.filter(e=>e!==Vn.EndOfInput&&e!==Vn.EndOfPartialInput).map(e=>{let r=JSON.stringify(e);return e.match(/\s/)||e.length===0||r!==`"${e}"`?r:e}).join(" ")}`});function _6e(t){let e=t.split(` -`),r=e.filter(a=>a.match(/\S/)),o=r.length>0?r.reduce((a,n)=>Math.min(a,n.length-n.trimStart().length),Number.MAX_VALUE):0;return e.map(a=>a.slice(o).trimRight()).join(` -`)}function yo(t,{format:e,paragraphs:r}){return t=t.replace(/\r\n?/g,` -`),t=_6e(t),t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2 - -`),t=t.replace(/\n(\n)?\n*/g,(o,a)=>a||" "),r&&(t=t.split(/\n/).map(o=>{let a=o.match(/^\s*[*-][\t ]+(.*)/);if(!a)return o.match(/(.{1,80})(?: |$)/g).join(` -`);let n=o.length-o.trimStart().length;return a[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map((u,A)=>" ".repeat(n)+(A===0?"- ":" ")+u).join(` -`)}).join(` - -`)),t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(o,a,n)=>e.code(a+n+a)),t=t.replace(/(\*\*)((?:.|[\n])*?)\1/g,(o,a,n)=>e.bold(a+n+a)),t?`${t} -`:""}var lL,KK,JK,cL=It(()=>{lL=Array(80).fill("\u2501");for(let t=0;t<=24;++t)lL[lL.length-t]=`\x1B[38;5;${232+t}m\u2501`;KK={header:t=>`\x1B[1m\u2501\u2501\u2501 ${t}${t.length<75?` ${lL.slice(t.length+5).join("")}`:":"}\x1B[0m`,bold:t=>`\x1B[1m${t}\x1B[22m`,error:t=>`\x1B[31m\x1B[1m${t}\x1B[22m\x1B[39m`,code:t=>`\x1B[36m${t}\x1B[39m`},JK={header:t=>t,bold:t=>t,error:t=>t,code:t=>t}});function Wo(t){return{...t,[Cw]:!0}}function Yu(t,e){return typeof t>"u"?[t,e]:typeof t=="object"&&t!==null&&!Array.isArray(t)?[void 0,t]:[t,e]}function QS(t,{mergeName:e=!1}={}){let r=t.match(/^([^:]+): (.*)$/m);if(!r)return"validation failed";let[,o,a]=r;return e&&(a=a[0].toLowerCase()+a.slice(1)),a=o!=="."||!e?`${o.replace(/^\.(\[|$)/,"$1")}: ${a}`:`: ${a}`,a}function Iw(t,e){return e.length===1?new it(`${t}${QS(e[0],{mergeName:!0})}`):new it(`${t}: -${e.map(r=>` -- ${QS(r)}`).join("")}`)}function ag(t,e,r){if(typeof r>"u")return e;let o=[],a=[],n=A=>{let p=e;return e=A,n.bind(null,p)};if(!r(e,{errors:o,coercions:a,coercion:n}))throw Iw(`Invalid value for ${t}`,o);for(let[,A]of a)A();return e}var Cw,yf=It(()=>{kS();Cw=Symbol("clipanion/isOption")});var Yo={};Vt(Yo,{KeyRelationship:()=>Vu,TypeAssertionError:()=>zp,applyCascade:()=>vw,as:()=>sqe,assert:()=>rqe,assertWithErrors:()=>nqe,cascade:()=>NS,fn:()=>oqe,hasAtLeastOneKey:()=>dL,hasExactLength:()=>eJ,hasForbiddenKeys:()=>Dqe,hasKeyRelationship:()=>Sw,hasMaxLength:()=>lqe,hasMinLength:()=>aqe,hasMutuallyExclusiveKeys:()=>Sqe,hasRequiredKeys:()=>vqe,hasUniqueItems:()=>cqe,isArray:()=>RS,isAtLeast:()=>hL,isAtMost:()=>fqe,isBase64:()=>Cqe,isBoolean:()=>K6e,isDate:()=>z6e,isDict:()=>$6e,isEnum:()=>js,isHexColor:()=>Eqe,isISO8601:()=>yqe,isInExclusiveRange:()=>hqe,isInInclusiveRange:()=>pqe,isInstanceOf:()=>tqe,isInteger:()=>gL,isJSON:()=>Iqe,isLiteral:()=>XK,isLowerCase:()=>gqe,isMap:()=>Z6e,isNegative:()=>uqe,isNullable:()=>Bqe,isNumber:()=>fL,isObject:()=>ZK,isOneOf:()=>pL,isOptional:()=>wqe,isPartial:()=>eqe,isPayload:()=>J6e,isPositive:()=>Aqe,isRecord:()=>LS,isSet:()=>X6e,isString:()=>Pm,isTuple:()=>TS,isUUID4:()=>mqe,isUnknown:()=>AL,isUpperCase:()=>dqe,makeTrait:()=>$K,makeValidator:()=>qr,matchesRegExp:()=>Bw,softAssert:()=>iqe});function Kn(t){return t===null?"null":t===void 0?"undefined":t===""?"an empty string":typeof t=="symbol"?`<${t.toString()}>`:Array.isArray(t)?"an array":JSON.stringify(t)}function Sm(t,e){if(t.length===0)return"nothing";if(t.length===1)return Kn(t[0]);let r=t.slice(0,-1),o=t[t.length-1],a=t.length>2?`, ${e} `:` ${e} `;return`${r.map(n=>Kn(n)).join(", ")}${a}${Kn(o)}`}function Jp(t,e){var r,o,a;return typeof e=="number"?`${(r=t?.p)!==null&&r!==void 0?r:"."}[${e}]`:H6e.test(e)?`${(o=t?.p)!==null&&o!==void 0?o:""}.${e}`:`${(a=t?.p)!==null&&a!==void 0?a:"."}[${JSON.stringify(e)}]`}function uL(t,e,r){return t===1?e:r}function gr({errors:t,p:e}={},r){return t?.push(`${e??"."}: ${r}`),!1}function Y6e(t,e){return r=>{t[e]=r}}function Ku(t,e){return r=>{let o=t[e];return t[e]=r,Ku(t,e).bind(null,o)}}function ww(t,e,r){let o=()=>(t(r()),a),a=()=>(t(e),o);return o}function AL(){return qr({test:(t,e)=>!0})}function XK(t){return qr({test:(e,r)=>e!==t?gr(r,`Expected ${Kn(t)} (got ${Kn(e)})`):!0})}function Pm(){return qr({test:(t,e)=>typeof t!="string"?gr(e,`Expected a string (got ${Kn(t)})`):!0})}function js(t){let e=Array.isArray(t)?t:Object.values(t),r=e.every(a=>typeof a=="string"||typeof a=="number"),o=new Set(e);return o.size===1?XK([...o][0]):qr({test:(a,n)=>o.has(a)?!0:r?gr(n,`Expected one of ${Sm(e,"or")} (got ${Kn(a)})`):gr(n,`Expected a valid enumeration value (got ${Kn(a)})`)})}function K6e(){return qr({test:(t,e)=>{var r;if(typeof t!="boolean"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return gr(e,"Unbound coercion result");let o=V6e.get(t);if(typeof o<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,o)]),!0}return gr(e,`Expected a boolean (got ${Kn(t)})`)}return!0}})}function fL(){return qr({test:(t,e)=>{var r;if(typeof t!="number"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return gr(e,"Unbound coercion result");let o;if(typeof t=="string"){let a;try{a=JSON.parse(t)}catch{}if(typeof a=="number")if(JSON.stringify(a)===t)o=a;else return gr(e,`Received a number that can't be safely represented by the runtime (${t})`)}if(typeof o<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,o)]),!0}return gr(e,`Expected a number (got ${Kn(t)})`)}return!0}})}function J6e(t){return qr({test:(e,r)=>{var o;if(typeof r?.coercions>"u")return gr(r,"The isPayload predicate can only be used with coercion enabled");if(typeof r.coercion>"u")return gr(r,"Unbound coercion result");if(typeof e!="string")return gr(r,`Expected a string (got ${Kn(e)})`);let a;try{a=JSON.parse(e)}catch{return gr(r,`Expected a JSON string (got ${Kn(e)})`)}let n={value:a};return t(a,Object.assign(Object.assign({},r),{coercion:Ku(n,"value")}))?(r.coercions.push([(o=r.p)!==null&&o!==void 0?o:".",r.coercion.bind(null,n.value)]),!0):!1}})}function z6e(){return qr({test:(t,e)=>{var r;if(!(t instanceof Date)){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return gr(e,"Unbound coercion result");let o;if(typeof t=="string"&&zK.test(t))o=new Date(t);else{let a;if(typeof t=="string"){let n;try{n=JSON.parse(t)}catch{}typeof n=="number"&&(a=n)}else typeof t=="number"&&(a=t);if(typeof a<"u")if(Number.isSafeInteger(a)||!Number.isSafeInteger(a*1e3))o=new Date(a*1e3);else return gr(e,`Received a timestamp that can't be safely represented by the runtime (${t})`)}if(typeof o<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,o)]),!0}return gr(e,`Expected a date (got ${Kn(t)})`)}return!0}})}function RS(t,{delimiter:e}={}){return qr({test:(r,o)=>{var a;let n=r;if(typeof r=="string"&&typeof e<"u"&&typeof o?.coercions<"u"){if(typeof o?.coercion>"u")return gr(o,"Unbound coercion result");r=r.split(e)}if(!Array.isArray(r))return gr(o,`Expected an array (got ${Kn(r)})`);let u=!0;for(let A=0,p=r.length;A{var n,u;if(Object.getPrototypeOf(o).toString()==="[object Set]")if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return gr(a,"Unbound coercion result");let A=[...o],p=[...o];if(!r(p,Object.assign(Object.assign({},a),{coercion:void 0})))return!1;let h=()=>p.some((E,w)=>E!==A[w])?new Set(p):o;return a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",ww(a.coercion,o,h)]),!0}else{let A=!0;for(let p of o)if(A=t(p,Object.assign({},a))&&A,!A&&a?.errors==null)break;return A}if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return gr(a,"Unbound coercion result");let A={value:o};return r(o,Object.assign(Object.assign({},a),{coercion:Ku(A,"value")}))?(a.coercions.push([(u=a.p)!==null&&u!==void 0?u:".",ww(a.coercion,o,()=>new Set(A.value))]),!0):!1}return gr(a,`Expected a set (got ${Kn(o)})`)}})}function Z6e(t,e){let r=RS(TS([t,e])),o=LS(e,{keys:t});return qr({test:(a,n)=>{var u,A,p;if(Object.getPrototypeOf(a).toString()==="[object Map]")if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return gr(n,"Unbound coercion result");let h=[...a],E=[...a];if(!r(E,Object.assign(Object.assign({},n),{coercion:void 0})))return!1;let w=()=>E.some((D,b)=>D[0]!==h[b][0]||D[1]!==h[b][1])?new Map(E):a;return n.coercions.push([(u=n.p)!==null&&u!==void 0?u:".",ww(n.coercion,a,w)]),!0}else{let h=!0;for(let[E,w]of a)if(h=t(E,Object.assign({},n))&&h,!h&&n?.errors==null||(h=e(w,Object.assign(Object.assign({},n),{p:Jp(n,E)}))&&h,!h&&n?.errors==null))break;return h}if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return gr(n,"Unbound coercion result");let h={value:a};return Array.isArray(a)?r(a,Object.assign(Object.assign({},n),{coercion:void 0}))?(n.coercions.push([(A=n.p)!==null&&A!==void 0?A:".",ww(n.coercion,a,()=>new Map(h.value))]),!0):!1:o(a,Object.assign(Object.assign({},n),{coercion:Ku(h,"value")}))?(n.coercions.push([(p=n.p)!==null&&p!==void 0?p:".",ww(n.coercion,a,()=>new Map(Object.entries(h.value)))]),!0):!1}return gr(n,`Expected a map (got ${Kn(a)})`)}})}function TS(t,{delimiter:e}={}){let r=eJ(t.length);return qr({test:(o,a)=>{var n;if(typeof o=="string"&&typeof e<"u"&&typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return gr(a,"Unbound coercion result");o=o.split(e),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,o)])}if(!Array.isArray(o))return gr(a,`Expected a tuple (got ${Kn(o)})`);let u=r(o,Object.assign({},a));for(let A=0,p=o.length;A{var n;if(Array.isArray(o)&&typeof a?.coercions<"u")return typeof a?.coercion>"u"?gr(a,"Unbound coercion result"):r(o,Object.assign(Object.assign({},a),{coercion:void 0}))?(o=Object.fromEntries(o),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,o)]),!0):!1;if(typeof o!="object"||o===null)return gr(a,`Expected an object (got ${Kn(o)})`);let u=Object.keys(o),A=!0;for(let p=0,h=u.length;p{if(typeof a!="object"||a===null)return gr(n,`Expected an object (got ${Kn(a)})`);let u=new Set([...r,...Object.keys(a)]),A={},p=!0;for(let h of u){if(h==="constructor"||h==="__proto__")p=gr(Object.assign(Object.assign({},n),{p:Jp(n,h)}),"Unsafe property name");else{let E=Object.prototype.hasOwnProperty.call(t,h)?t[h]:void 0,w=Object.prototype.hasOwnProperty.call(a,h)?a[h]:void 0;typeof E<"u"?p=E(w,Object.assign(Object.assign({},n),{p:Jp(n,h),coercion:Ku(a,h)}))&&p:e===null?p=gr(Object.assign(Object.assign({},n),{p:Jp(n,h)}),`Extraneous property (got ${Kn(w)})`):Object.defineProperty(A,h,{enumerable:!0,get:()=>w,set:Y6e(a,h)})}if(!p&&n?.errors==null)break}return e!==null&&(p||n?.errors!=null)&&(p=e(A,n)&&p),p}});return Object.assign(o,{properties:t})}function eqe(t){return ZK(t,{extra:LS(AL())})}function $K(t){return()=>t}function qr({test:t}){return $K(t)()}function rqe(t,e){if(!e(t))throw new zp}function nqe(t,e){let r=[];if(!e(t,{errors:r}))throw new zp({errors:r})}function iqe(t,e){}function sqe(t,e,{coerce:r=!1,errors:o,throw:a}={}){let n=o?[]:void 0;if(!r){if(e(t,{errors:n}))return a?t:{value:t,errors:void 0};if(a)throw new zp({errors:n});return{value:void 0,errors:n??!0}}let u={value:t},A=Ku(u,"value"),p=[];if(!e(t,{errors:n,coercion:A,coercions:p})){if(a)throw new zp({errors:n});return{value:void 0,errors:n??!0}}for(let[,h]of p)h();return a?u.value:{value:u.value,errors:void 0}}function oqe(t,e){let r=TS(t);return(...o)=>{if(!r(o))throw new zp;return e(...o)}}function aqe(t){return qr({test:(e,r)=>e.length>=t?!0:gr(r,`Expected to have a length of at least ${t} elements (got ${e.length})`)})}function lqe(t){return qr({test:(e,r)=>e.length<=t?!0:gr(r,`Expected to have a length of at most ${t} elements (got ${e.length})`)})}function eJ(t){return qr({test:(e,r)=>e.length!==t?gr(r,`Expected to have a length of exactly ${t} elements (got ${e.length})`):!0})}function cqe({map:t}={}){return qr({test:(e,r)=>{let o=new Set,a=new Set;for(let n=0,u=e.length;nt<=0?!0:gr(e,`Expected to be negative (got ${t})`)})}function Aqe(){return qr({test:(t,e)=>t>=0?!0:gr(e,`Expected to be positive (got ${t})`)})}function hL(t){return qr({test:(e,r)=>e>=t?!0:gr(r,`Expected to be at least ${t} (got ${e})`)})}function fqe(t){return qr({test:(e,r)=>e<=t?!0:gr(r,`Expected to be at most ${t} (got ${e})`)})}function pqe(t,e){return qr({test:(r,o)=>r>=t&&r<=e?!0:gr(o,`Expected to be in the [${t}; ${e}] range (got ${r})`)})}function hqe(t,e){return qr({test:(r,o)=>r>=t&&re!==Math.round(e)?gr(r,`Expected to be an integer (got ${e})`):!t&&!Number.isSafeInteger(e)?gr(r,`Expected to be a safe integer (got ${e})`):!0})}function Bw(t){return qr({test:(e,r)=>t.test(e)?!0:gr(r,`Expected to match the pattern ${t.toString()} (got ${Kn(e)})`)})}function gqe(){return qr({test:(t,e)=>t!==t.toLowerCase()?gr(e,`Expected to be all-lowercase (got ${t})`):!0})}function dqe(){return qr({test:(t,e)=>t!==t.toUpperCase()?gr(e,`Expected to be all-uppercase (got ${t})`):!0})}function mqe(){return qr({test:(t,e)=>W6e.test(t)?!0:gr(e,`Expected to be a valid UUID v4 (got ${Kn(t)})`)})}function yqe(){return qr({test:(t,e)=>zK.test(t)?!0:gr(e,`Expected to be a valid ISO 8601 date string (got ${Kn(t)})`)})}function Eqe({alpha:t=!1}){return qr({test:(e,r)=>(t?q6e.test(e):j6e.test(e))?!0:gr(r,`Expected to be a valid hexadecimal color string (got ${Kn(e)})`)})}function Cqe(){return qr({test:(t,e)=>G6e.test(t)?!0:gr(e,`Expected to be a valid base 64 string (got ${Kn(t)})`)})}function Iqe(t=AL()){return qr({test:(e,r)=>{let o;try{o=JSON.parse(e)}catch{return gr(r,`Expected to be a valid JSON string (got ${Kn(e)})`)}return t(o,r)}})}function NS(t,...e){let r=Array.isArray(e[0])?e[0]:e;return qr({test:(o,a)=>{var n,u;let A={value:o},p=typeof a?.coercions<"u"?Ku(A,"value"):void 0,h=typeof a?.coercions<"u"?[]:void 0;if(!t(o,Object.assign(Object.assign({},a),{coercion:p,coercions:h})))return!1;let E=[];if(typeof h<"u")for(let[,w]of h)E.push(w());try{if(typeof a?.coercions<"u"){if(A.value!==o){if(typeof a?.coercion>"u")return gr(a,"Unbound coercion result");a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,A.value)])}(u=a?.coercions)===null||u===void 0||u.push(...h)}return r.every(w=>w(A.value,a))}finally{for(let w of E)w()}}})}function vw(t,...e){let r=Array.isArray(e[0])?e[0]:e;return NS(t,r)}function wqe(t){return qr({test:(e,r)=>typeof e>"u"?!0:t(e,r)})}function Bqe(t){return qr({test:(e,r)=>e===null?!0:t(e,r)})}function vqe(t,e){var r;let o=new Set(t),a=Dw[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return qr({test:(n,u)=>{let A=new Set(Object.keys(n)),p=[];for(let h of o)a(A,h,n)||p.push(h);return p.length>0?gr(u,`Missing required ${uL(p.length,"property","properties")} ${Sm(p,"and")}`):!0}})}function dL(t,e){var r;let o=new Set(t),a=Dw[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return qr({test:(n,u)=>Object.keys(n).some(h=>a(o,h,n))?!0:gr(u,`Missing at least one property from ${Sm(Array.from(o),"or")}`)})}function Dqe(t,e){var r;let o=new Set(t),a=Dw[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return qr({test:(n,u)=>{let A=new Set(Object.keys(n)),p=[];for(let h of o)a(A,h,n)&&p.push(h);return p.length>0?gr(u,`Forbidden ${uL(p.length,"property","properties")} ${Sm(p,"and")}`):!0}})}function Sqe(t,e){var r;let o=new Set(t),a=Dw[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return qr({test:(n,u)=>{let A=new Set(Object.keys(n)),p=[];for(let h of o)a(A,h,n)&&p.push(h);return p.length>1?gr(u,`Mutually exclusive properties ${Sm(p,"and")}`):!0}})}function Sw(t,e,r,o){var a,n;let u=new Set((a=o?.ignore)!==null&&a!==void 0?a:[]),A=Dw[(n=o?.missingIf)!==null&&n!==void 0?n:"missing"],p=new Set(r),h=Pqe[e],E=e===Vu.Forbids?"or":"and";return qr({test:(w,D)=>{let b=new Set(Object.keys(w));if(!A(b,t,w)||u.has(w[t]))return!0;let C=[];for(let T of p)(A(b,T,w)&&!u.has(w[T]))!==h.expect&&C.push(T);return C.length>=1?gr(D,`Property "${t}" ${h.message} ${uL(C.length,"property","properties")} ${Sm(C,E)}`):!0}})}var H6e,q6e,j6e,G6e,W6e,zK,V6e,tqe,pL,zp,Dw,Vu,Pqe,il=It(()=>{H6e=/^[a-zA-Z_][a-zA-Z0-9_]*$/;q6e=/^#[0-9a-f]{6}$/i,j6e=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i,G6e=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,W6e=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i,zK=/^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/;V6e=new Map([["true",!0],["True",!0],["1",!0],[1,!0],["false",!1],["False",!1],["0",!1],[0,!1]]);tqe=t=>qr({test:(e,r)=>e instanceof t?!0:gr(r,`Expected an instance of ${t.name} (got ${Kn(e)})`)}),pL=(t,{exclusive:e=!1}={})=>qr({test:(r,o)=>{var a,n,u;let A=[],p=typeof o?.errors<"u"?[]:void 0;for(let h=0,E=t.length;h1?gr(o,`Expected to match exactly a single predicate (matched ${A.join(", ")})`):(u=o?.errors)===null||u===void 0||u.push(...p),!1}});zp=class extends Error{constructor({errors:e}={}){let r="Type mismatch";if(e&&e.length>0){r+=` -`;for(let o of e)r+=` -- ${o}`}super(r)}};Dw={missing:(t,e)=>t.has(e),undefined:(t,e,r)=>t.has(e)&&typeof r[e]<"u",nil:(t,e,r)=>t.has(e)&&r[e]!=null,falsy:(t,e,r)=>t.has(e)&&!!r[e]};(function(t){t.Forbids="Forbids",t.Requires="Requires"})(Vu||(Vu={}));Pqe={[Vu.Forbids]:{expect:!1,message:"forbids using"},[Vu.Requires]:{expect:!0,message:"requires using"}}});var ot,Xp=It(()=>{yf();ot=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let r=this.constructor.schema;if(Array.isArray(r)){let{isDict:a,isUnknown:n,applyCascade:u}=await Promise.resolve().then(()=>(il(),Yo)),A=u(a(n()),r),p=[],h=[];if(!A(this,{errors:p,coercions:h}))throw Iw("Invalid option schema",p);for(let[,w]of h)w()}else if(r!=null)throw new Error("Invalid command schema");let o=await this.execute();return typeof o<"u"?o:0}};ot.isOption=Cw;ot.Default=[]});function Pa(t){oL&&console.log(t)}function rJ(){let t={nodes:[]};for(let e=0;e{if(e.has(o))return;e.add(o);let a=t.nodes[o];for(let u of Object.values(a.statics))for(let{to:A}of u)r(A);for(let[,{to:u}]of a.dynamics)r(u);for(let{to:u}of a.shortcuts)r(u);let n=new Set(a.shortcuts.map(({to:u})=>u));for(;a.shortcuts.length>0;){let{to:u}=a.shortcuts.shift(),A=t.nodes[u];for(let[p,h]of Object.entries(A.statics)){let E=Object.prototype.hasOwnProperty.call(a.statics,p)?a.statics[p]:a.statics[p]=[];for(let w of h)E.some(({to:D})=>w.to===D)||E.push(w)}for(let[p,h]of A.dynamics)a.dynamics.some(([E,{to:w}])=>p===E&&h.to===w)||a.dynamics.push([p,h]);for(let p of A.shortcuts)n.has(p.to)||(a.shortcuts.push(p),n.add(p.to))}};r(pn.InitialNode)}function kqe(t,{prefix:e=""}={}){if(oL){Pa(`${e}Nodes are:`);for(let r=0;rE!==pn.ErrorNode).map(({state:E})=>({usage:E.candidateUsage,reason:null})));if(h.every(({node:E})=>E===pn.ErrorNode))throw new Dm(e,h.map(({state:E})=>({usage:E.candidateUsage,reason:E.errorMessage})));o=Rqe(h)}if(o.length>0){Pa(" Results:");for(let n of o)Pa(` - ${n.node} -> ${JSON.stringify(n.state)}`)}else Pa(" No results");return o}function Fqe(t,e,{endToken:r=Vn.EndOfInput}={}){let o=Qqe(t,[...e,r]);return Tqe(e,o.map(({state:a})=>a))}function Rqe(t){let e=0;for(let{state:r}of t)r.path.length>e&&(e=r.path.length);return t.filter(({state:r})=>r.path.length===e)}function Tqe(t,e){let r=e.filter(D=>D.selectedIndex!==null),o=r.filter(D=>!D.partial);if(o.length>0&&(r=o),r.length===0)throw new Error;let a=r.filter(D=>D.selectedIndex===og||D.requiredOptions.every(b=>b.some(C=>D.options.find(T=>T.name===C))));if(a.length===0)throw new Dm(t,r.map(D=>({usage:D.candidateUsage,reason:null})));let n=0;for(let D of a)D.path.length>n&&(n=D.path.length);let u=a.filter(D=>D.path.length===n),A=D=>D.positionals.filter(({extra:b})=>!b).length+D.options.length,p=u.map(D=>({state:D,positionalCount:A(D)})),h=0;for(let{positionalCount:D}of p)D>h&&(h=D);let E=p.filter(({positionalCount:D})=>D===h).map(({state:D})=>D),w=Lqe(E);if(w.length>1)throw new bS(t,w.map(D=>D.candidateUsage));return w[0]}function Lqe(t){let e=[],r=[];for(let o of t)o.selectedIndex===og?r.push(o):e.push(o);return r.length>0&&e.push({...tJ,path:nJ(...r.map(o=>o.path)),options:r.reduce((o,a)=>o.concat(a.options),[])}),e}function nJ(t,e,...r){return e===void 0?Array.from(t):nJ(t.filter((o,a)=>o===e[a]),...r)}function sl(){return{dynamics:[],shortcuts:[],statics:{}}}function iJ(t){return t===pn.SuccessNode||t===pn.ErrorNode}function mL(t,e=0){return{to:iJ(t.to)?t.to:t.to>=pn.CustomNode?t.to+e-pn.CustomNode+1:t.to+e,reducer:t.reducer}}function Nqe(t,e=0){let r=sl();for(let[o,a]of t.dynamics)r.dynamics.push([o,mL(a,e)]);for(let o of t.shortcuts)r.shortcuts.push(mL(o,e));for(let[o,a]of Object.entries(t.statics))r.statics[o]=a.map(n=>mL(n,e));return r}function Bs(t,e,r,o,a){t.nodes[e].dynamics.push([r,{to:o,reducer:a}])}function xm(t,e,r,o){t.nodes[e].shortcuts.push({to:r,reducer:o})}function Vo(t,e,r,o,a){(Object.prototype.hasOwnProperty.call(t.nodes[e].statics,r)?t.nodes[e].statics[r]:t.nodes[e].statics[r]=[]).push({to:o,reducer:a})}function OS(t,e,r,o,a){if(Array.isArray(e)){let[n,...u]=e;return t[n](r,o,a,...u)}else return t[e](r,o,a)}var tJ,Oqe,yL,ol,EL,MS,US=It(()=>{xS();kS();tJ={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:og,partial:!1,tokens:[]};Oqe={always:()=>!0,isOptionLike:(t,e)=>!t.ignoreOptions&&e!=="-"&&e.startsWith("-"),isNotOptionLike:(t,e)=>t.ignoreOptions||e==="-"||!e.startsWith("-"),isOption:(t,e,r,o)=>!t.ignoreOptions&&e===o,isBatchOption:(t,e,r,o)=>!t.ignoreOptions&&VK.test(e)&&[...e.slice(1)].every(a=>o.has(`-${a}`)),isBoundOption:(t,e,r,o,a)=>{let n=e.match(sL);return!t.ignoreOptions&&!!n&&PS.test(n[1])&&o.has(n[1])&&a.filter(u=>u.nameSet.includes(n[1])).every(u=>u.allowBinding)},isNegatedOption:(t,e,r,o)=>!t.ignoreOptions&&e===`--no-${o.slice(2)}`,isHelp:(t,e)=>!t.ignoreOptions&&iL.test(e),isUnsupportedOption:(t,e,r,o)=>!t.ignoreOptions&&e.startsWith("-")&&PS.test(e)&&!o.has(e),isInvalidOption:(t,e)=>!t.ignoreOptions&&e.startsWith("-")&&!PS.test(e)},yL={setCandidateState:(t,e,r,o)=>({...t,...o}),setSelectedIndex:(t,e,r,o)=>({...t,selectedIndex:o}),setPartialIndex:(t,e,r,o)=>({...t,selectedIndex:o,partial:!0}),pushBatch:(t,e,r,o)=>{let a=t.options.slice(),n=t.tokens.slice();for(let u=1;u{let[,o,a]=e.match(sL),n=t.options.concat({name:o,value:a}),u=t.tokens.concat([{segmentIndex:r,type:"option",slice:[0,o.length],option:o},{segmentIndex:r,type:"assign",slice:[o.length,o.length+1]},{segmentIndex:r,type:"value",slice:[o.length+1,o.length+a.length+1]}]);return{...t,options:n,tokens:u}},pushPath:(t,e,r)=>{let o=t.path.concat(e),a=t.tokens.concat({segmentIndex:r,type:"path"});return{...t,path:o,tokens:a}},pushPositional:(t,e,r)=>{let o=t.positionals.concat({value:e,extra:!1}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:o,tokens:a}},pushExtra:(t,e,r)=>{let o=t.positionals.concat({value:e,extra:!0}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:o,tokens:a}},pushExtraNoLimits:(t,e,r)=>{let o=t.positionals.concat({value:e,extra:ol}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:o,tokens:a}},pushTrue:(t,e,r,o)=>{let a=t.options.concat({name:o,value:!0}),n=t.tokens.concat({segmentIndex:r,type:"option",option:o});return{...t,options:a,tokens:n}},pushFalse:(t,e,r,o)=>{let a=t.options.concat({name:o,value:!1}),n=t.tokens.concat({segmentIndex:r,type:"option",option:o});return{...t,options:a,tokens:n}},pushUndefined:(t,e,r,o)=>{let a=t.options.concat({name:e,value:void 0}),n=t.tokens.concat({segmentIndex:r,type:"option",option:e});return{...t,options:a,tokens:n}},pushStringValue:(t,e,r)=>{var o;let a=t.options[t.options.length-1],n=t.options.slice(),u=t.tokens.concat({segmentIndex:r,type:"value"});return a.value=((o=a.value)!==null&&o!==void 0?o:[]).concat([e]),{...t,options:n,tokens:u}},setStringValue:(t,e,r)=>{let o=t.options[t.options.length-1],a=t.options.slice(),n=t.tokens.concat({segmentIndex:r,type:"value"});return o.value=e,{...t,options:a,tokens:n}},inhibateOptions:t=>({...t,ignoreOptions:!0}),useHelp:(t,e,r,o)=>{let[,,a]=e.match(iL);return typeof a<"u"?{...t,options:[{name:"-c",value:String(o)},{name:"-i",value:a}]}:{...t,options:[{name:"-c",value:String(o)}]}},setError:(t,e,r,o)=>e===Vn.EndOfInput||e===Vn.EndOfPartialInput?{...t,errorMessage:`${o}.`}:{...t,errorMessage:`${o} ("${e}").`},setOptionArityError:(t,e)=>{let r=t.options[t.options.length-1];return{...t,errorMessage:`Not enough arguments to option ${r.name}.`}}},ol=Symbol(),EL=class{constructor(e,r){this.allOptionNames=new Map,this.arity={leading:[],trailing:[],extra:[],proxy:!1},this.options=[],this.paths=[],this.cliIndex=e,this.cliOpts=r}addPath(e){this.paths.push(e)}setArity({leading:e=this.arity.leading,trailing:r=this.arity.trailing,extra:o=this.arity.extra,proxy:a=this.arity.proxy}){Object.assign(this.arity,{leading:e,trailing:r,extra:o,proxy:a})}addPositional({name:e="arg",required:r=!0}={}){if(!r&&this.arity.extra===ol)throw new Error("Optional parameters cannot be declared when using .rest() or .proxy()");if(!r&&this.arity.trailing.length>0)throw new Error("Optional parameters cannot be declared after the required trailing positional arguments");!r&&this.arity.extra!==ol?this.arity.extra.push(e):this.arity.extra!==ol&&this.arity.extra.length===0?this.arity.leading.push(e):this.arity.trailing.push(e)}addRest({name:e="arg",required:r=0}={}){if(this.arity.extra===ol)throw new Error("Infinite lists cannot be declared multiple times in the same command");if(this.arity.trailing.length>0)throw new Error("Infinite lists cannot be declared after the required trailing positional arguments");for(let o=0;o1)throw new Error("The arity cannot be higher than 1 when the option only supports the --arg=value syntax");if(!Number.isInteger(o))throw new Error(`The arity must be an integer, got ${o}`);if(o<0)throw new Error(`The arity must be positive, got ${o}`);let A=e.reduce((p,h)=>h.length>p.length?h:p,"");for(let p of e)this.allOptionNames.set(p,A);this.options.push({preferredName:A,nameSet:e,description:r,arity:o,hidden:a,required:n,allowBinding:u})}setContext(e){this.context=e}usage({detailed:e=!0,inlineOptions:r=!0}={}){let o=[this.cliOpts.binaryName],a=[];if(this.paths.length>0&&o.push(...this.paths[0]),e){for(let{preferredName:u,nameSet:A,arity:p,hidden:h,description:E,required:w}of this.options){if(h)continue;let D=[];for(let C=0;C`:`[${b}]`)}o.push(...this.arity.leading.map(u=>`<${u}>`)),this.arity.extra===ol?o.push("..."):o.push(...this.arity.extra.map(u=>`[${u}]`)),o.push(...this.arity.trailing.map(u=>`<${u}>`))}return{usage:o.join(" "),options:a}}compile(){if(typeof this.context>"u")throw new Error("Assertion failed: No context attached");let e=rJ(),r=pn.InitialNode,o=this.usage().usage,a=this.options.filter(A=>A.required).map(A=>A.nameSet);r=jc(e,sl()),Vo(e,pn.InitialNode,Vn.StartOfInput,r,["setCandidateState",{candidateUsage:o,requiredOptions:a}]);let n=this.arity.proxy?"always":"isNotOptionLike",u=this.paths.length>0?this.paths:[[]];for(let A of u){let p=r;if(A.length>0){let D=jc(e,sl());xm(e,p,D),this.registerOptions(e,D),p=D}for(let D=0;D0||!this.arity.proxy){let D=jc(e,sl());Bs(e,p,"isHelp",D,["useHelp",this.cliIndex]),Bs(e,D,"always",D,"pushExtra"),Vo(e,D,Vn.EndOfInput,pn.SuccessNode,["setSelectedIndex",og]),this.registerOptions(e,p)}this.arity.leading.length>0&&(Vo(e,p,Vn.EndOfInput,pn.ErrorNode,["setError","Not enough positional arguments"]),Vo(e,p,Vn.EndOfPartialInput,pn.SuccessNode,["setPartialIndex",this.cliIndex]));let h=p;for(let D=0;D0||D+1!==this.arity.leading.length)&&(Vo(e,b,Vn.EndOfInput,pn.ErrorNode,["setError","Not enough positional arguments"]),Vo(e,b,Vn.EndOfPartialInput,pn.SuccessNode,["setPartialIndex",this.cliIndex])),Bs(e,h,"isNotOptionLike",b,"pushPositional"),h=b}let E=h;if(this.arity.extra===ol||this.arity.extra.length>0){let D=jc(e,sl());if(xm(e,h,D),this.arity.extra===ol){let b=jc(e,sl());this.arity.proxy||this.registerOptions(e,b),Bs(e,h,n,b,"pushExtraNoLimits"),Bs(e,b,n,b,"pushExtraNoLimits"),xm(e,b,D)}else for(let b=0;b0)&&this.registerOptions(e,C),Bs(e,E,n,C,"pushExtra"),xm(e,C,D),E=C}E=D}this.arity.trailing.length>0&&(Vo(e,E,Vn.EndOfInput,pn.ErrorNode,["setError","Not enough positional arguments"]),Vo(e,E,Vn.EndOfPartialInput,pn.SuccessNode,["setPartialIndex",this.cliIndex]));let w=E;for(let D=0;D=0&&e{let u=n?Vn.EndOfPartialInput:Vn.EndOfInput;return Fqe(o,a,{endToken:u})}}}}});function oJ(){return _S.default&&"getColorDepth"in _S.default.WriteStream.prototype?_S.default.WriteStream.prototype.getColorDepth():process.env.FORCE_COLOR==="0"?1:process.env.FORCE_COLOR==="1"||typeof process.stdout<"u"&&process.stdout.isTTY?8:1}function aJ(t){let e=sJ;if(typeof e>"u"){if(t.stdout===process.stdout&&t.stderr===process.stderr)return null;let{AsyncLocalStorage:r}=ve("async_hooks");e=sJ=new r;let o=process.stdout._write;process.stdout._write=function(n,u,A){let p=e.getStore();return typeof p>"u"?o.call(this,n,u,A):p.stdout.write(n,u,A)};let a=process.stderr._write;process.stderr._write=function(n,u,A){let p=e.getStore();return typeof p>"u"?a.call(this,n,u,A):p.stderr.write(n,u,A)}}return r=>e.run(t,r)}var _S,sJ,lJ=It(()=>{_S=et(ve("tty"),1)});var HS,cJ=It(()=>{Xp();HS=class t extends ot{constructor(e){super(),this.contexts=e,this.commands=[]}static from(e,r){let o=new t(r);o.path=e.path;for(let a of e.options)switch(a.name){case"-c":o.commands.push(Number(a.value));break;case"-i":o.index=Number(a.value);break}return o}async execute(){let e=this.commands;if(typeof this.index<"u"&&this.index>=0&&this.index1){this.context.stdout.write(`Multiple commands match your selection: -`),this.context.stdout.write(` -`);let r=0;for(let o of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[o].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(` -`),this.context.stdout.write(`Run again with -h= to see the longer details of any of those commands. -`)}}}});async function fJ(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:o,resolvedContext:a}=hJ(t);return Ko.from(r,e).runExit(o,a)}async function pJ(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:o,resolvedContext:a}=hJ(t);return Ko.from(r,e).run(o,a)}function hJ(t){let e,r,o,a;switch(typeof process<"u"&&typeof process.argv<"u"&&(o=process.argv.slice(2)),t.length){case 1:r=t[0];break;case 2:t[0]&&t[0].prototype instanceof ot||Array.isArray(t[0])?(r=t[0],Array.isArray(t[1])?o=t[1]:a=t[1]):(e=t[0],r=t[1]);break;case 3:Array.isArray(t[2])?(e=t[0],r=t[1],o=t[2]):t[0]&&t[0].prototype instanceof ot||Array.isArray(t[0])?(r=t[0],o=t[1],a=t[2]):(e=t[0],r=t[1],a=t[2]);break;default:e=t[0],r=t[1],o=t[2],a=t[3];break}if(typeof o>"u")throw new Error("The argv parameter must be provided when running Clipanion outside of a Node context");return{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:o,resolvedContext:a}}function AJ(t){return t()}var uJ,Ko,gJ=It(()=>{xS();US();cL();lJ();Xp();cJ();uJ=Symbol("clipanion/errorCommand");Ko=class t{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:o,enableCapture:a=!1,enableColors:n}={}){this.registrations=new Map,this.builder=new MS({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=o,this.enableCapture=a,this.enableColors=n}static from(e,r={}){let o=new t(r),a=Array.isArray(e)?e:[e];for(let n of a)o.register(n);return o}register(e){var r;let o=new Map,a=new e;for(let p in a){let h=a[p];typeof h=="object"&&h!==null&&h[ot.isOption]&&o.set(p,h)}let n=this.builder.command(),u=n.cliIndex,A=(r=e.paths)!==null&&r!==void 0?r:a.paths;if(typeof A<"u")for(let p of A)n.addPath(p);this.registrations.set(e,{specs:o,builder:n,index:u});for(let[p,{definition:h}]of o.entries())h(n,p);n.setContext({commandClass:e})}process(e,r){let{input:o,context:a,partial:n}=typeof e=="object"&&Array.isArray(e)?{input:e,context:r}:e,{contexts:u,process:A}=this.builder.compile(),p=A(o,{partial:n}),h={...t.defaultContext,...a};switch(p.selectedIndex){case og:{let E=HS.from(p,u);return E.context=h,E.tokens=p.tokens,E}default:{let{commandClass:E}=u[p.selectedIndex],w=this.registrations.get(E);if(typeof w>"u")throw new Error("Assertion failed: Expected the command class to have been registered.");let D=new E;D.context=h,D.tokens=p.tokens,D.path=p.path;try{for(let[b,{transformer:C}]of w.specs.entries())D[b]=C(w.builder,b,p,h);return D}catch(b){throw b[uJ]=D,b}}break}}async run(e,r){var o,a;let n,u={...t.defaultContext,...r},A=(o=this.enableColors)!==null&&o!==void 0?o:u.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e,u)}catch(E){return u.stdout.write(this.error(E,{colored:A})),1}if(n.help)return u.stdout.write(this.usage(n,{colored:A,detailed:!0})),0;n.context=u,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),definition:E=>this.definition(E),error:(E,w)=>this.error(E,w),format:E=>this.format(E),process:(E,w)=>this.process(E,{...u,...w}),run:(E,w)=>this.run(E,{...u,...w}),usage:(E,w)=>this.usage(E,w)};let p=this.enableCapture&&(a=aJ(u))!==null&&a!==void 0?a:AJ,h;try{h=await p(()=>n.validateAndExecute().catch(E=>n.catch(E).then(()=>0)))}catch(E){return u.stdout.write(this.error(E,{colored:A,command:n})),1}return h}async runExit(e,r){process.exitCode=await this.run(e,r)}definition(e,{colored:r=!1}={}){if(!e.usage)return null;let{usage:o}=this.getUsageByRegistration(e,{detailed:!1}),{usage:a,options:n}=this.getUsageByRegistration(e,{detailed:!0,inlineOptions:!1}),u=typeof e.usage.category<"u"?yo(e.usage.category,{format:this.format(r),paragraphs:!1}):void 0,A=typeof e.usage.description<"u"?yo(e.usage.description,{format:this.format(r),paragraphs:!1}):void 0,p=typeof e.usage.details<"u"?yo(e.usage.details,{format:this.format(r),paragraphs:!0}):void 0,h=typeof e.usage.examples<"u"?e.usage.examples.map(([E,w])=>[yo(E,{format:this.format(r),paragraphs:!1}),w.replace(/\$0/g,this.binaryName)]):void 0;return{path:o,usage:a,category:u,description:A,details:p,examples:h,options:n}}definitions({colored:e=!1}={}){let r=[];for(let o of this.registrations.keys()){let a=this.definition(o,{colored:e});a&&r.push(a)}return r}usage(e=null,{colored:r,detailed:o=!1,prefix:a="$ "}={}){var n;if(e===null){for(let p of this.registrations.keys()){let h=p.paths,E=typeof p.usage<"u";if(!h||h.length===0||h.length===1&&h[0].length===0||((n=h?.some(b=>b.length===0))!==null&&n!==void 0?n:!1))if(e){e=null;break}else e=p;else if(E){e=null;continue}}e&&(o=!0)}let u=e!==null&&e instanceof ot?e.constructor:e,A="";if(u)if(o){let{description:p="",details:h="",examples:E=[]}=u.usage||{};p!==""&&(A+=yo(p,{format:this.format(r),paragraphs:!1}).replace(/^./,b=>b.toUpperCase()),A+=` -`),(h!==""||E.length>0)&&(A+=`${this.format(r).header("Usage")} -`,A+=` -`);let{usage:w,options:D}=this.getUsageByRegistration(u,{inlineOptions:!1});if(A+=`${this.format(r).bold(a)}${w} -`,D.length>0){A+=` -`,A+=`${this.format(r).header("Options")} -`;let b=D.reduce((C,T)=>Math.max(C,T.definition.length),0);A+=` -`;for(let{definition:C,description:T}of D)A+=` ${this.format(r).bold(C.padEnd(b))} ${yo(T,{format:this.format(r),paragraphs:!1})}`}if(h!==""&&(A+=` -`,A+=`${this.format(r).header("Details")} -`,A+=` -`,A+=yo(h,{format:this.format(r),paragraphs:!0})),E.length>0){A+=` -`,A+=`${this.format(r).header("Examples")} -`;for(let[b,C]of E)A+=` -`,A+=yo(b,{format:this.format(r),paragraphs:!1}),A+=`${C.replace(/^/m,` ${this.format(r).bold(a)}`).replace(/\$0/g,this.binaryName)} -`}}else{let{usage:p}=this.getUsageByRegistration(u);A+=`${this.format(r).bold(a)}${p} -`}else{let p=new Map;for(let[D,{index:b}]of this.registrations.entries()){if(typeof D.usage>"u")continue;let C=typeof D.usage.category<"u"?yo(D.usage.category,{format:this.format(r),paragraphs:!1}):null,T=p.get(C);typeof T>"u"&&p.set(C,T=[]);let{usage:N}=this.getUsageByIndex(b);T.push({commandClass:D,usage:N})}let h=Array.from(p.keys()).sort((D,b)=>D===null?-1:b===null?1:D.localeCompare(b,"en",{usage:"sort",caseFirst:"upper"})),E=typeof this.binaryLabel<"u",w=typeof this.binaryVersion<"u";E||w?(E&&w?A+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)} - -`:E?A+=`${this.format(r).header(`${this.binaryLabel}`)} -`:A+=`${this.format(r).header(`${this.binaryVersion}`)} -`,A+=` ${this.format(r).bold(a)}${this.binaryName} -`):A+=`${this.format(r).bold(a)}${this.binaryName} -`;for(let D of h){let b=p.get(D).slice().sort((T,N)=>T.usage.localeCompare(N.usage,"en",{usage:"sort",caseFirst:"upper"})),C=D!==null?D.trim():"General commands";A+=` -`,A+=`${this.format(r).header(`${C}`)} -`;for(let{commandClass:T,usage:N}of b){let U=T.usage.description||"undocumented";A+=` -`,A+=` ${this.format(r).bold(N)} -`,A+=` ${yo(U,{format:this.format(r),paragraphs:!1})}`}}A+=` -`,A+=yo("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return A}error(e,r){var o,{colored:a,command:n=(o=e[uJ])!==null&&o!==void 0?o:null}=r===void 0?{}:r;(!e||typeof e!="object"||!("stack"in e))&&(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let u="",A=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");A==="Error"&&(A="Internal Error"),u+=`${this.format(a).error(A)}: ${e.message} -`;let p=e.clipanion;return typeof p<"u"?p.type==="usage"&&(u+=` -`,u+=this.usage(n)):e.stack&&(u+=`${e.stack.replace(/^.*\n/,"")} -`),u}format(e){var r;return((r=e??this.enableColors)!==null&&r!==void 0?r:t.defaultContext.colorDepth>1)?KK:JK}getUsageByRegistration(e,r){let o=this.registrations.get(e);if(typeof o>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(o.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}};Ko.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:oJ()}});var Pw,dJ=It(()=>{Xp();Pw=class extends ot{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)} -`)}};Pw.paths=[["--clipanion=definitions"]]});var xw,mJ=It(()=>{Xp();xw=class extends ot{async execute(){this.context.stdout.write(this.cli.usage())}};xw.paths=[["-h"],["--help"]]});function qS(t={}){return Wo({definition(e,r){var o;e.addProxy({name:(o=t.name)!==null&&o!==void 0?o:r,required:t.required})},transformer(e,r,o){return o.positionals.map(({value:a})=>a)}})}var CL=It(()=>{yf()});var bw,yJ=It(()=>{Xp();CL();bw=class extends ot{constructor(){super(...arguments),this.args=qS()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)} -`)}};bw.paths=[["--clipanion=tokens"]]});var kw,EJ=It(()=>{Xp();kw=class extends ot{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:""} -`)}};kw.paths=[["-v"],["--version"]]});var IL={};Vt(IL,{DefinitionsCommand:()=>Pw,HelpCommand:()=>xw,TokensCommand:()=>bw,VersionCommand:()=>kw});var CJ=It(()=>{dJ();mJ();yJ();EJ()});function IJ(t,e,r){let[o,a]=Yu(e,r??{}),{arity:n=1}=a,u=t.split(","),A=new Set(u);return Wo({definition(p){p.addOption({names:u,arity:n,hidden:a?.hidden,description:a?.description,required:a.required})},transformer(p,h,E){let w,D=typeof o<"u"?[...o]:void 0;for(let{name:b,value:C}of E.options)A.has(b)&&(w=b,D=D??[],D.push(C));return typeof D<"u"?ag(w??h,D,a.validator):D}})}var wJ=It(()=>{yf()});function BJ(t,e,r){let[o,a]=Yu(e,r??{}),n=t.split(","),u=new Set(n);return Wo({definition(A){A.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(A,p,h){let E=o;for(let{name:w,value:D}of h.options)u.has(w)&&(E=D);return E}})}var vJ=It(()=>{yf()});function DJ(t,e,r){let[o,a]=Yu(e,r??{}),n=t.split(","),u=new Set(n);return Wo({definition(A){A.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(A,p,h){let E=o;for(let{name:w,value:D}of h.options)u.has(w)&&(E??(E=0),D?E+=1:E=0);return E}})}var SJ=It(()=>{yf()});function PJ(t={}){return Wo({definition(e,r){var o;e.addRest({name:(o=t.name)!==null&&o!==void 0?o:r,required:t.required})},transformer(e,r,o){let a=u=>{let A=o.positionals[u];return A.extra===ol||A.extra===!1&&uu)}})}var xJ=It(()=>{US();yf()});function Mqe(t,e,r){let[o,a]=Yu(e,r??{}),{arity:n=1}=a,u=t.split(","),A=new Set(u);return Wo({definition(p){p.addOption({names:u,arity:a.tolerateBoolean?0:n,hidden:a.hidden,description:a.description,required:a.required})},transformer(p,h,E,w){let D,b=o;typeof a.env<"u"&&w.env[a.env]&&(D=a.env,b=w.env[a.env]);for(let{name:C,value:T}of E.options)A.has(C)&&(D=C,b=T);return typeof b=="string"?ag(D??h,b,a.validator):b}})}function Uqe(t={}){let{required:e=!0}=t;return Wo({definition(r,o){var a;r.addPositional({name:(a=t.name)!==null&&a!==void 0?a:o,required:t.required})},transformer(r,o,a){var n;for(let u=0;u{US();yf()});var de={};Vt(de,{Array:()=>IJ,Boolean:()=>BJ,Counter:()=>DJ,Proxy:()=>qS,Rest:()=>PJ,String:()=>bJ,applyValidator:()=>ag,cleanValidationError:()=>QS,formatError:()=>Iw,isOptionSymbol:()=>Cw,makeCommandOption:()=>Wo,rerouteArguments:()=>Yu});var QJ=It(()=>{yf();CL();wJ();vJ();SJ();xJ();kJ()});var Qw={};Vt(Qw,{Builtins:()=>IL,Cli:()=>Ko,Command:()=>ot,Option:()=>de,UsageError:()=>it,formatMarkdownish:()=>yo,run:()=>pJ,runExit:()=>fJ});var Gt=It(()=>{kS();cL();Xp();gJ();CJ();QJ()});var FJ=_((ckt,_qe)=>{_qe.exports={name:"dotenv",version:"16.3.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://github.com/motdotla/dotenv?sponsor=1",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var NJ=_((ukt,Ef)=>{var RJ=ve("fs"),BL=ve("path"),Hqe=ve("os"),qqe=ve("crypto"),jqe=FJ(),vL=jqe.version,Gqe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Wqe(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,` -`);let o;for(;(o=Gqe.exec(r))!=null;){let a=o[1],n=o[2]||"";n=n.trim();let u=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),u==='"'&&(n=n.replace(/\\n/g,` -`),n=n.replace(/\\r/g,"\r")),e[a]=n}return e}function Yqe(t){let e=LJ(t),r=vs.configDotenv({path:e});if(!r.parsed)throw new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);let o=TJ(t).split(","),a=o.length,n;for(let u=0;u=a)throw A}return vs.parse(n)}function Vqe(t){console.log(`[dotenv@${vL}][INFO] ${t}`)}function Kqe(t){console.log(`[dotenv@${vL}][WARN] ${t}`)}function wL(t){console.log(`[dotenv@${vL}][DEBUG] ${t}`)}function TJ(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Jqe(t,e){let r;try{r=new URL(e)}catch(A){throw A.code==="ERR_INVALID_URL"?new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development"):A}let o=r.password;if(!o)throw new Error("INVALID_DOTENV_KEY: Missing key part");let a=r.searchParams.get("environment");if(!a)throw new Error("INVALID_DOTENV_KEY: Missing environment part");let n=`DOTENV_VAULT_${a.toUpperCase()}`,u=t.parsed[n];if(!u)throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);return{ciphertext:u,key:o}}function LJ(t){let e=BL.resolve(process.cwd(),".env");return t&&t.path&&t.path.length>0&&(e=t.path),e.endsWith(".vault")?e:`${e}.vault`}function zqe(t){return t[0]==="~"?BL.join(Hqe.homedir(),t.slice(1)):t}function Xqe(t){Vqe("Loading env from encrypted .env.vault");let e=vs._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),vs.populate(r,e,t),{parsed:e}}function Zqe(t){let e=BL.resolve(process.cwd(),".env"),r="utf8",o=!!(t&&t.debug);t&&(t.path!=null&&(e=zqe(t.path)),t.encoding!=null&&(r=t.encoding));try{let a=vs.parse(RJ.readFileSync(e,{encoding:r})),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),vs.populate(n,a,t),{parsed:a}}catch(a){return o&&wL(`Failed to load ${e} ${a.message}`),{error:a}}}function $qe(t){let e=LJ(t);return TJ(t).length===0?vs.configDotenv(t):RJ.existsSync(e)?vs._configVault(t):(Kqe(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),vs.configDotenv(t))}function eje(t,e){let r=Buffer.from(e.slice(-64),"hex"),o=Buffer.from(t,"base64"),a=o.slice(0,12),n=o.slice(-16);o=o.slice(12,-16);try{let u=qqe.createDecipheriv("aes-256-gcm",r,a);return u.setAuthTag(n),`${u.update(o)}${u.final()}`}catch(u){let A=u instanceof RangeError,p=u.message==="Invalid key length",h=u.message==="Unsupported state or unable to authenticate data";if(A||p){let E="INVALID_DOTENV_KEY: It must be 64 characters long (or more)";throw new Error(E)}else if(h){let E="DECRYPTION_FAILED: Please check your DOTENV_KEY";throw new Error(E)}else throw console.error("Error: ",u.code),console.error("Error: ",u.message),u}}function tje(t,e,r={}){let o=!!(r&&r.debug),a=!!(r&&r.override);if(typeof e!="object")throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");for(let n of Object.keys(e))Object.prototype.hasOwnProperty.call(t,n)?(a===!0&&(t[n]=e[n]),o&&wL(a===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):t[n]=e[n]}var vs={configDotenv:Zqe,_configVault:Xqe,_parseVault:Yqe,config:$qe,decrypt:eje,parse:Wqe,populate:tje};Ef.exports.configDotenv=vs.configDotenv;Ef.exports._configVault=vs._configVault;Ef.exports._parseVault=vs._parseVault;Ef.exports.config=vs.config;Ef.exports.decrypt=vs.decrypt;Ef.exports.parse=vs.parse;Ef.exports.populate=vs.populate;Ef.exports=vs});var MJ=_((Akt,OJ)=>{"use strict";OJ.exports=(t,...e)=>new Promise(r=>{r(t(...e))})});var lg=_((fkt,DL)=>{"use strict";var rje=MJ(),UJ=t=>{if(t<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],r=0,o=()=>{r--,e.length>0&&e.shift()()},a=(A,p,...h)=>{r++;let E=rje(A,...h);p(E),E.then(o,o)},n=(A,p,...h)=>{rnew Promise(h=>n(A,h,...p));return Object.defineProperties(u,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length}}),u};DL.exports=UJ;DL.exports.default=UJ});function Ju(t){return`YN${t.toString(10).padStart(4,"0")}`}function jS(t){let e=Number(t.slice(2));if(typeof vr[e]>"u")throw new Error(`Unknown message name: "${t}"`);return e}var vr,GS=It(()=>{vr=(Me=>(Me[Me.UNNAMED=0]="UNNAMED",Me[Me.EXCEPTION=1]="EXCEPTION",Me[Me.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",Me[Me.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",Me[Me.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",Me[Me.BUILD_DISABLED=5]="BUILD_DISABLED",Me[Me.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",Me[Me.MUST_BUILD=7]="MUST_BUILD",Me[Me.MUST_REBUILD=8]="MUST_REBUILD",Me[Me.BUILD_FAILED=9]="BUILD_FAILED",Me[Me.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",Me[Me.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",Me[Me.LINKER_NOT_FOUND=12]="LINKER_NOT_FOUND",Me[Me.FETCH_NOT_CACHED=13]="FETCH_NOT_CACHED",Me[Me.YARN_IMPORT_FAILED=14]="YARN_IMPORT_FAILED",Me[Me.REMOTE_INVALID=15]="REMOTE_INVALID",Me[Me.REMOTE_NOT_FOUND=16]="REMOTE_NOT_FOUND",Me[Me.RESOLUTION_PACK=17]="RESOLUTION_PACK",Me[Me.CACHE_CHECKSUM_MISMATCH=18]="CACHE_CHECKSUM_MISMATCH",Me[Me.UNUSED_CACHE_ENTRY=19]="UNUSED_CACHE_ENTRY",Me[Me.MISSING_LOCKFILE_ENTRY=20]="MISSING_LOCKFILE_ENTRY",Me[Me.WORKSPACE_NOT_FOUND=21]="WORKSPACE_NOT_FOUND",Me[Me.TOO_MANY_MATCHING_WORKSPACES=22]="TOO_MANY_MATCHING_WORKSPACES",Me[Me.CONSTRAINTS_MISSING_DEPENDENCY=23]="CONSTRAINTS_MISSING_DEPENDENCY",Me[Me.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY=24]="CONSTRAINTS_INCOMPATIBLE_DEPENDENCY",Me[Me.CONSTRAINTS_EXTRANEOUS_DEPENDENCY=25]="CONSTRAINTS_EXTRANEOUS_DEPENDENCY",Me[Me.CONSTRAINTS_INVALID_DEPENDENCY=26]="CONSTRAINTS_INVALID_DEPENDENCY",Me[Me.CANT_SUGGEST_RESOLUTIONS=27]="CANT_SUGGEST_RESOLUTIONS",Me[Me.FROZEN_LOCKFILE_EXCEPTION=28]="FROZEN_LOCKFILE_EXCEPTION",Me[Me.CROSS_DRIVE_VIRTUAL_LOCAL=29]="CROSS_DRIVE_VIRTUAL_LOCAL",Me[Me.FETCH_FAILED=30]="FETCH_FAILED",Me[Me.DANGEROUS_NODE_MODULES=31]="DANGEROUS_NODE_MODULES",Me[Me.NODE_GYP_INJECTED=32]="NODE_GYP_INJECTED",Me[Me.AUTHENTICATION_NOT_FOUND=33]="AUTHENTICATION_NOT_FOUND",Me[Me.INVALID_CONFIGURATION_KEY=34]="INVALID_CONFIGURATION_KEY",Me[Me.NETWORK_ERROR=35]="NETWORK_ERROR",Me[Me.LIFECYCLE_SCRIPT=36]="LIFECYCLE_SCRIPT",Me[Me.CONSTRAINTS_MISSING_FIELD=37]="CONSTRAINTS_MISSING_FIELD",Me[Me.CONSTRAINTS_INCOMPATIBLE_FIELD=38]="CONSTRAINTS_INCOMPATIBLE_FIELD",Me[Me.CONSTRAINTS_EXTRANEOUS_FIELD=39]="CONSTRAINTS_EXTRANEOUS_FIELD",Me[Me.CONSTRAINTS_INVALID_FIELD=40]="CONSTRAINTS_INVALID_FIELD",Me[Me.AUTHENTICATION_INVALID=41]="AUTHENTICATION_INVALID",Me[Me.PROLOG_UNKNOWN_ERROR=42]="PROLOG_UNKNOWN_ERROR",Me[Me.PROLOG_SYNTAX_ERROR=43]="PROLOG_SYNTAX_ERROR",Me[Me.PROLOG_EXISTENCE_ERROR=44]="PROLOG_EXISTENCE_ERROR",Me[Me.STACK_OVERFLOW_RESOLUTION=45]="STACK_OVERFLOW_RESOLUTION",Me[Me.AUTOMERGE_FAILED_TO_PARSE=46]="AUTOMERGE_FAILED_TO_PARSE",Me[Me.AUTOMERGE_IMMUTABLE=47]="AUTOMERGE_IMMUTABLE",Me[Me.AUTOMERGE_SUCCESS=48]="AUTOMERGE_SUCCESS",Me[Me.AUTOMERGE_REQUIRED=49]="AUTOMERGE_REQUIRED",Me[Me.DEPRECATED_CLI_SETTINGS=50]="DEPRECATED_CLI_SETTINGS",Me[Me.PLUGIN_NAME_NOT_FOUND=51]="PLUGIN_NAME_NOT_FOUND",Me[Me.INVALID_PLUGIN_REFERENCE=52]="INVALID_PLUGIN_REFERENCE",Me[Me.CONSTRAINTS_AMBIGUITY=53]="CONSTRAINTS_AMBIGUITY",Me[Me.CACHE_OUTSIDE_PROJECT=54]="CACHE_OUTSIDE_PROJECT",Me[Me.IMMUTABLE_INSTALL=55]="IMMUTABLE_INSTALL",Me[Me.IMMUTABLE_CACHE=56]="IMMUTABLE_CACHE",Me[Me.INVALID_MANIFEST=57]="INVALID_MANIFEST",Me[Me.PACKAGE_PREPARATION_FAILED=58]="PACKAGE_PREPARATION_FAILED",Me[Me.INVALID_RANGE_PEER_DEPENDENCY=59]="INVALID_RANGE_PEER_DEPENDENCY",Me[Me.INCOMPATIBLE_PEER_DEPENDENCY=60]="INCOMPATIBLE_PEER_DEPENDENCY",Me[Me.DEPRECATED_PACKAGE=61]="DEPRECATED_PACKAGE",Me[Me.INCOMPATIBLE_OS=62]="INCOMPATIBLE_OS",Me[Me.INCOMPATIBLE_CPU=63]="INCOMPATIBLE_CPU",Me[Me.FROZEN_ARTIFACT_EXCEPTION=64]="FROZEN_ARTIFACT_EXCEPTION",Me[Me.TELEMETRY_NOTICE=65]="TELEMETRY_NOTICE",Me[Me.PATCH_HUNK_FAILED=66]="PATCH_HUNK_FAILED",Me[Me.INVALID_CONFIGURATION_VALUE=67]="INVALID_CONFIGURATION_VALUE",Me[Me.UNUSED_PACKAGE_EXTENSION=68]="UNUSED_PACKAGE_EXTENSION",Me[Me.REDUNDANT_PACKAGE_EXTENSION=69]="REDUNDANT_PACKAGE_EXTENSION",Me[Me.AUTO_NM_SUCCESS=70]="AUTO_NM_SUCCESS",Me[Me.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK=71]="NM_CANT_INSTALL_EXTERNAL_SOFT_LINK",Me[Me.NM_PRESERVE_SYMLINKS_REQUIRED=72]="NM_PRESERVE_SYMLINKS_REQUIRED",Me[Me.UPDATE_LOCKFILE_ONLY_SKIP_LINK=73]="UPDATE_LOCKFILE_ONLY_SKIP_LINK",Me[Me.NM_HARDLINKS_MODE_DOWNGRADED=74]="NM_HARDLINKS_MODE_DOWNGRADED",Me[Me.PROLOG_INSTANTIATION_ERROR=75]="PROLOG_INSTANTIATION_ERROR",Me[Me.INCOMPATIBLE_ARCHITECTURE=76]="INCOMPATIBLE_ARCHITECTURE",Me[Me.GHOST_ARCHITECTURE=77]="GHOST_ARCHITECTURE",Me[Me.RESOLUTION_MISMATCH=78]="RESOLUTION_MISMATCH",Me[Me.PROLOG_LIMIT_EXCEEDED=79]="PROLOG_LIMIT_EXCEEDED",Me[Me.NETWORK_DISABLED=80]="NETWORK_DISABLED",Me[Me.NETWORK_UNSAFE_HTTP=81]="NETWORK_UNSAFE_HTTP",Me[Me.RESOLUTION_FAILED=82]="RESOLUTION_FAILED",Me[Me.AUTOMERGE_GIT_ERROR=83]="AUTOMERGE_GIT_ERROR",Me[Me.CONSTRAINTS_CHECK_FAILED=84]="CONSTRAINTS_CHECK_FAILED",Me[Me.UPDATED_RESOLUTION_RECORD=85]="UPDATED_RESOLUTION_RECORD",Me[Me.EXPLAIN_PEER_DEPENDENCIES_CTA=86]="EXPLAIN_PEER_DEPENDENCIES_CTA",Me[Me.MIGRATION_SUCCESS=87]="MIGRATION_SUCCESS",Me[Me.VERSION_NOTICE=88]="VERSION_NOTICE",Me[Me.TIPS_NOTICE=89]="TIPS_NOTICE",Me[Me.OFFLINE_MODE_ENABLED=90]="OFFLINE_MODE_ENABLED",Me))(vr||{})});var Fw=_((hkt,_J)=>{var nje="2.0.0",ije=Number.MAX_SAFE_INTEGER||9007199254740991,sje=16,oje=250,aje=["major","premajor","minor","preminor","patch","prepatch","prerelease"];_J.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:sje,MAX_SAFE_BUILD_LENGTH:oje,MAX_SAFE_INTEGER:ije,RELEASE_TYPES:aje,SEMVER_SPEC_VERSION:nje,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Rw=_((gkt,HJ)=>{var lje=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};HJ.exports=lje});var bm=_((Cf,qJ)=>{var{MAX_SAFE_COMPONENT_LENGTH:SL,MAX_SAFE_BUILD_LENGTH:cje,MAX_LENGTH:uje}=Fw(),Aje=Rw();Cf=qJ.exports={};var fje=Cf.re=[],pje=Cf.safeRe=[],tr=Cf.src=[],rr=Cf.t={},hje=0,PL="[a-zA-Z0-9-]",gje=[["\\s",1],["\\d",uje],[PL,cje]],dje=t=>{for(let[e,r]of gje)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Gr=(t,e,r)=>{let o=dje(e),a=hje++;Aje(t,a,e),rr[t]=a,tr[a]=e,fje[a]=new RegExp(e,r?"g":void 0),pje[a]=new RegExp(o,r?"g":void 0)};Gr("NUMERICIDENTIFIER","0|[1-9]\\d*");Gr("NUMERICIDENTIFIERLOOSE","\\d+");Gr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${PL}*`);Gr("MAINVERSION",`(${tr[rr.NUMERICIDENTIFIER]})\\.(${tr[rr.NUMERICIDENTIFIER]})\\.(${tr[rr.NUMERICIDENTIFIER]})`);Gr("MAINVERSIONLOOSE",`(${tr[rr.NUMERICIDENTIFIERLOOSE]})\\.(${tr[rr.NUMERICIDENTIFIERLOOSE]})\\.(${tr[rr.NUMERICIDENTIFIERLOOSE]})`);Gr("PRERELEASEIDENTIFIER",`(?:${tr[rr.NUMERICIDENTIFIER]}|${tr[rr.NONNUMERICIDENTIFIER]})`);Gr("PRERELEASEIDENTIFIERLOOSE",`(?:${tr[rr.NUMERICIDENTIFIERLOOSE]}|${tr[rr.NONNUMERICIDENTIFIER]})`);Gr("PRERELEASE",`(?:-(${tr[rr.PRERELEASEIDENTIFIER]}(?:\\.${tr[rr.PRERELEASEIDENTIFIER]})*))`);Gr("PRERELEASELOOSE",`(?:-?(${tr[rr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${tr[rr.PRERELEASEIDENTIFIERLOOSE]})*))`);Gr("BUILDIDENTIFIER",`${PL}+`);Gr("BUILD",`(?:\\+(${tr[rr.BUILDIDENTIFIER]}(?:\\.${tr[rr.BUILDIDENTIFIER]})*))`);Gr("FULLPLAIN",`v?${tr[rr.MAINVERSION]}${tr[rr.PRERELEASE]}?${tr[rr.BUILD]}?`);Gr("FULL",`^${tr[rr.FULLPLAIN]}$`);Gr("LOOSEPLAIN",`[v=\\s]*${tr[rr.MAINVERSIONLOOSE]}${tr[rr.PRERELEASELOOSE]}?${tr[rr.BUILD]}?`);Gr("LOOSE",`^${tr[rr.LOOSEPLAIN]}$`);Gr("GTLT","((?:<|>)?=?)");Gr("XRANGEIDENTIFIERLOOSE",`${tr[rr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Gr("XRANGEIDENTIFIER",`${tr[rr.NUMERICIDENTIFIER]}|x|X|\\*`);Gr("XRANGEPLAIN",`[v=\\s]*(${tr[rr.XRANGEIDENTIFIER]})(?:\\.(${tr[rr.XRANGEIDENTIFIER]})(?:\\.(${tr[rr.XRANGEIDENTIFIER]})(?:${tr[rr.PRERELEASE]})?${tr[rr.BUILD]}?)?)?`);Gr("XRANGEPLAINLOOSE",`[v=\\s]*(${tr[rr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${tr[rr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${tr[rr.XRANGEIDENTIFIERLOOSE]})(?:${tr[rr.PRERELEASELOOSE]})?${tr[rr.BUILD]}?)?)?`);Gr("XRANGE",`^${tr[rr.GTLT]}\\s*${tr[rr.XRANGEPLAIN]}$`);Gr("XRANGELOOSE",`^${tr[rr.GTLT]}\\s*${tr[rr.XRANGEPLAINLOOSE]}$`);Gr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${SL}})(?:\\.(\\d{1,${SL}}))?(?:\\.(\\d{1,${SL}}))?`);Gr("COERCE",`${tr[rr.COERCEPLAIN]}(?:$|[^\\d])`);Gr("COERCEFULL",tr[rr.COERCEPLAIN]+`(?:${tr[rr.PRERELEASE]})?(?:${tr[rr.BUILD]})?(?:$|[^\\d])`);Gr("COERCERTL",tr[rr.COERCE],!0);Gr("COERCERTLFULL",tr[rr.COERCEFULL],!0);Gr("LONETILDE","(?:~>?)");Gr("TILDETRIM",`(\\s*)${tr[rr.LONETILDE]}\\s+`,!0);Cf.tildeTrimReplace="$1~";Gr("TILDE",`^${tr[rr.LONETILDE]}${tr[rr.XRANGEPLAIN]}$`);Gr("TILDELOOSE",`^${tr[rr.LONETILDE]}${tr[rr.XRANGEPLAINLOOSE]}$`);Gr("LONECARET","(?:\\^)");Gr("CARETTRIM",`(\\s*)${tr[rr.LONECARET]}\\s+`,!0);Cf.caretTrimReplace="$1^";Gr("CARET",`^${tr[rr.LONECARET]}${tr[rr.XRANGEPLAIN]}$`);Gr("CARETLOOSE",`^${tr[rr.LONECARET]}${tr[rr.XRANGEPLAINLOOSE]}$`);Gr("COMPARATORLOOSE",`^${tr[rr.GTLT]}\\s*(${tr[rr.LOOSEPLAIN]})$|^$`);Gr("COMPARATOR",`^${tr[rr.GTLT]}\\s*(${tr[rr.FULLPLAIN]})$|^$`);Gr("COMPARATORTRIM",`(\\s*)${tr[rr.GTLT]}\\s*(${tr[rr.LOOSEPLAIN]}|${tr[rr.XRANGEPLAIN]})`,!0);Cf.comparatorTrimReplace="$1$2$3";Gr("HYPHENRANGE",`^\\s*(${tr[rr.XRANGEPLAIN]})\\s+-\\s+(${tr[rr.XRANGEPLAIN]})\\s*$`);Gr("HYPHENRANGELOOSE",`^\\s*(${tr[rr.XRANGEPLAINLOOSE]})\\s+-\\s+(${tr[rr.XRANGEPLAINLOOSE]})\\s*$`);Gr("STAR","(<|>)?=?\\s*\\*");Gr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Gr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var WS=_((dkt,jJ)=>{var mje=Object.freeze({loose:!0}),yje=Object.freeze({}),Eje=t=>t?typeof t!="object"?mje:t:yje;jJ.exports=Eje});var xL=_((mkt,YJ)=>{var GJ=/^[0-9]+$/,WJ=(t,e)=>{let r=GJ.test(t),o=GJ.test(e);return r&&o&&(t=+t,e=+e),t===e?0:r&&!o?-1:o&&!r?1:tWJ(e,t);YJ.exports={compareIdentifiers:WJ,rcompareIdentifiers:Cje}});var Eo=_((ykt,zJ)=>{var YS=Rw(),{MAX_LENGTH:VJ,MAX_SAFE_INTEGER:VS}=Fw(),{safeRe:KJ,t:JJ}=bm(),Ije=WS(),{compareIdentifiers:km}=xL(),bL=class t{constructor(e,r){if(r=Ije(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>VJ)throw new TypeError(`version is longer than ${VJ} characters`);YS("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let o=e.trim().match(r.loose?KJ[JJ.LOOSE]:KJ[JJ.FULL]);if(!o)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>VS||this.major<0)throw new TypeError("Invalid major version");if(this.minor>VS||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>VS||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map(a=>{if(/^[0-9]+$/.test(a)){let n=+a;if(n>=0&&n=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(r===this.prerelease.join(".")&&o===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(a)}}if(r){let n=[r,a];o===!1&&(n=[r]),km(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};zJ.exports=bL});var cg=_((Ekt,ZJ)=>{var XJ=Eo(),wje=(t,e,r=!1)=>{if(t instanceof XJ)return t;try{return new XJ(t,e)}catch(o){if(!r)return null;throw o}};ZJ.exports=wje});var ez=_((Ckt,$J)=>{var Bje=cg(),vje=(t,e)=>{let r=Bje(t,e);return r?r.version:null};$J.exports=vje});var rz=_((Ikt,tz)=>{var Dje=cg(),Sje=(t,e)=>{let r=Dje(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};tz.exports=Sje});var sz=_((wkt,iz)=>{var nz=Eo(),Pje=(t,e,r,o,a)=>{typeof r=="string"&&(a=o,o=r,r=void 0);try{return new nz(t instanceof nz?t.version:t,r).inc(e,o,a).version}catch{return null}};iz.exports=Pje});var lz=_((Bkt,az)=>{var oz=cg(),xje=(t,e)=>{let r=oz(t,null,!0),o=oz(e,null,!0),a=r.compare(o);if(a===0)return null;let n=a>0,u=n?r:o,A=n?o:r,p=!!u.prerelease.length;if(!!A.prerelease.length&&!p)return!A.patch&&!A.minor?"major":u.patch?"patch":u.minor?"minor":"major";let E=p?"pre":"";return r.major!==o.major?E+"major":r.minor!==o.minor?E+"minor":r.patch!==o.patch?E+"patch":"prerelease"};az.exports=xje});var uz=_((vkt,cz)=>{var bje=Eo(),kje=(t,e)=>new bje(t,e).major;cz.exports=kje});var fz=_((Dkt,Az)=>{var Qje=Eo(),Fje=(t,e)=>new Qje(t,e).minor;Az.exports=Fje});var hz=_((Skt,pz)=>{var Rje=Eo(),Tje=(t,e)=>new Rje(t,e).patch;pz.exports=Tje});var dz=_((Pkt,gz)=>{var Lje=cg(),Nje=(t,e)=>{let r=Lje(t,e);return r&&r.prerelease.length?r.prerelease:null};gz.exports=Nje});var Ml=_((xkt,yz)=>{var mz=Eo(),Oje=(t,e,r)=>new mz(t,r).compare(new mz(e,r));yz.exports=Oje});var Cz=_((bkt,Ez)=>{var Mje=Ml(),Uje=(t,e,r)=>Mje(e,t,r);Ez.exports=Uje});var wz=_((kkt,Iz)=>{var _je=Ml(),Hje=(t,e)=>_je(t,e,!0);Iz.exports=Hje});var KS=_((Qkt,vz)=>{var Bz=Eo(),qje=(t,e,r)=>{let o=new Bz(t,r),a=new Bz(e,r);return o.compare(a)||o.compareBuild(a)};vz.exports=qje});var Sz=_((Fkt,Dz)=>{var jje=KS(),Gje=(t,e)=>t.sort((r,o)=>jje(r,o,e));Dz.exports=Gje});var xz=_((Rkt,Pz)=>{var Wje=KS(),Yje=(t,e)=>t.sort((r,o)=>Wje(o,r,e));Pz.exports=Yje});var Tw=_((Tkt,bz)=>{var Vje=Ml(),Kje=(t,e,r)=>Vje(t,e,r)>0;bz.exports=Kje});var JS=_((Lkt,kz)=>{var Jje=Ml(),zje=(t,e,r)=>Jje(t,e,r)<0;kz.exports=zje});var kL=_((Nkt,Qz)=>{var Xje=Ml(),Zje=(t,e,r)=>Xje(t,e,r)===0;Qz.exports=Zje});var QL=_((Okt,Fz)=>{var $je=Ml(),eGe=(t,e,r)=>$je(t,e,r)!==0;Fz.exports=eGe});var zS=_((Mkt,Rz)=>{var tGe=Ml(),rGe=(t,e,r)=>tGe(t,e,r)>=0;Rz.exports=rGe});var XS=_((Ukt,Tz)=>{var nGe=Ml(),iGe=(t,e,r)=>nGe(t,e,r)<=0;Tz.exports=iGe});var FL=_((_kt,Lz)=>{var sGe=kL(),oGe=QL(),aGe=Tw(),lGe=zS(),cGe=JS(),uGe=XS(),AGe=(t,e,r,o)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return sGe(t,r,o);case"!=":return oGe(t,r,o);case">":return aGe(t,r,o);case">=":return lGe(t,r,o);case"<":return cGe(t,r,o);case"<=":return uGe(t,r,o);default:throw new TypeError(`Invalid operator: ${e}`)}};Lz.exports=AGe});var Oz=_((Hkt,Nz)=>{var fGe=Eo(),pGe=cg(),{safeRe:ZS,t:$S}=bm(),hGe=(t,e)=>{if(t instanceof fGe)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?ZS[$S.COERCEFULL]:ZS[$S.COERCE]);else{let p=e.includePrerelease?ZS[$S.COERCERTLFULL]:ZS[$S.COERCERTL],h;for(;(h=p.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),p.lastIndex=h.index+h[1].length+h[2].length;p.lastIndex=-1}if(r===null)return null;let o=r[2],a=r[3]||"0",n=r[4]||"0",u=e.includePrerelease&&r[5]?`-${r[5]}`:"",A=e.includePrerelease&&r[6]?`+${r[6]}`:"";return pGe(`${o}.${a}.${n}${u}${A}`,e)};Nz.exports=hGe});var Uz=_((qkt,Mz)=>{"use strict";Mz.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var eP=_((jkt,_z)=>{"use strict";_z.exports=xn;xn.Node=ug;xn.create=xn;function xn(t){var e=this;if(e instanceof xn||(e=new xn),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(a){e.push(a)});else if(arguments.length>0)for(var r=0,o=arguments.length;r1)r=e;else if(this.head)o=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;o!==null;a++)r=t(r,o.value,a),o=o.next;return r};xn.prototype.reduceReverse=function(t,e){var r,o=this.tail;if(arguments.length>1)r=e;else if(this.tail)o=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;o!==null;a--)r=t(r,o.value,a),o=o.prev;return r};xn.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};xn.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};xn.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new xn;if(ethis.length&&(e=this.length);for(var o=0,a=this.head;a!==null&&othis.length&&(e=this.length);for(var o=this.length,a=this.tail;a!==null&&o>e;o--)a=a.prev;for(;a!==null&&o>t;o--,a=a.prev)r.push(a.value);return r};xn.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var o=0,a=this.head;a!==null&&o{"use strict";var yGe=eP(),Ag=Symbol("max"),wf=Symbol("length"),Qm=Symbol("lengthCalculator"),Nw=Symbol("allowStale"),fg=Symbol("maxAge"),If=Symbol("dispose"),Hz=Symbol("noDisposeOnSet"),Ds=Symbol("lruList"),Gc=Symbol("cache"),jz=Symbol("updateAgeOnGet"),RL=()=>1,LL=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[Ag]=e.max||1/0,o=e.length||RL;if(this[Qm]=typeof o!="function"?RL:o,this[Nw]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[fg]=e.maxAge||0,this[If]=e.dispose,this[Hz]=e.noDisposeOnSet||!1,this[jz]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[Ag]=e||1/0,Lw(this)}get max(){return this[Ag]}set allowStale(e){this[Nw]=!!e}get allowStale(){return this[Nw]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[fg]=e,Lw(this)}get maxAge(){return this[fg]}set lengthCalculator(e){typeof e!="function"&&(e=RL),e!==this[Qm]&&(this[Qm]=e,this[wf]=0,this[Ds].forEach(r=>{r.length=this[Qm](r.value,r.key),this[wf]+=r.length})),Lw(this)}get lengthCalculator(){return this[Qm]}get length(){return this[wf]}get itemCount(){return this[Ds].length}rforEach(e,r){r=r||this;for(let o=this[Ds].tail;o!==null;){let a=o.prev;qz(this,e,o,r),o=a}}forEach(e,r){r=r||this;for(let o=this[Ds].head;o!==null;){let a=o.next;qz(this,e,o,r),o=a}}keys(){return this[Ds].toArray().map(e=>e.key)}values(){return this[Ds].toArray().map(e=>e.value)}reset(){this[If]&&this[Ds]&&this[Ds].length&&this[Ds].forEach(e=>this[If](e.key,e.value)),this[Gc]=new Map,this[Ds]=new yGe,this[wf]=0}dump(){return this[Ds].map(e=>tP(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[Ds]}set(e,r,o){if(o=o||this[fg],o&&typeof o!="number")throw new TypeError("maxAge must be a number");let a=o?Date.now():0,n=this[Qm](r,e);if(this[Gc].has(e)){if(n>this[Ag])return Fm(this,this[Gc].get(e)),!1;let p=this[Gc].get(e).value;return this[If]&&(this[Hz]||this[If](e,p.value)),p.now=a,p.maxAge=o,p.value=r,this[wf]+=n-p.length,p.length=n,this.get(e),Lw(this),!0}let u=new NL(e,r,n,a,o);return u.length>this[Ag]?(this[If]&&this[If](e,r),!1):(this[wf]+=u.length,this[Ds].unshift(u),this[Gc].set(e,this[Ds].head),Lw(this),!0)}has(e){if(!this[Gc].has(e))return!1;let r=this[Gc].get(e).value;return!tP(this,r)}get(e){return TL(this,e,!0)}peek(e){return TL(this,e,!1)}pop(){let e=this[Ds].tail;return e?(Fm(this,e),e.value):null}del(e){Fm(this,this[Gc].get(e))}load(e){this.reset();let r=Date.now();for(let o=e.length-1;o>=0;o--){let a=e[o],n=a.e||0;if(n===0)this.set(a.k,a.v);else{let u=n-r;u>0&&this.set(a.k,a.v,u)}}}prune(){this[Gc].forEach((e,r)=>TL(this,r,!1))}},TL=(t,e,r)=>{let o=t[Gc].get(e);if(o){let a=o.value;if(tP(t,a)){if(Fm(t,o),!t[Nw])return}else r&&(t[jz]&&(o.value.now=Date.now()),t[Ds].unshiftNode(o));return a.value}},tP=(t,e)=>{if(!e||!e.maxAge&&!t[fg])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[fg]&&r>t[fg]},Lw=t=>{if(t[wf]>t[Ag])for(let e=t[Ds].tail;t[wf]>t[Ag]&&e!==null;){let r=e.prev;Fm(t,e),e=r}},Fm=(t,e)=>{if(e){let r=e.value;t[If]&&t[If](r.key,r.value),t[wf]-=r.length,t[Gc].delete(r.key),t[Ds].removeNode(e)}},NL=class{constructor(e,r,o,a,n){this.key=e,this.value=r,this.length=o,this.now=a,this.maxAge=n||0}},qz=(t,e,r,o)=>{let a=r.value;tP(t,a)&&(Fm(t,r),t[Nw]||(a=void 0)),a&&e.call(o,a.value,a.key,t)};Gz.exports=LL});var Ul=_((Wkt,Jz)=>{var OL=class t{constructor(e,r){if(r=CGe(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof ML)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(o=>this.parseRange(o.trim())).filter(o=>o.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let o=this.set[0];if(this.set=this.set.filter(a=>!Vz(a[0])),this.set.length===0)this.set=[o];else if(this.set.length>1){for(let a of this.set)if(a.length===1&&PGe(a[0])){this.set=[a];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let o=((this.options.includePrerelease&&DGe)|(this.options.loose&&SGe))+":"+e,a=Yz.get(o);if(a)return a;let n=this.options.loose,u=n?xa[Jo.HYPHENRANGELOOSE]:xa[Jo.HYPHENRANGE];e=e.replace(u,OGe(this.options.includePrerelease)),gi("hyphen replace",e),e=e.replace(xa[Jo.COMPARATORTRIM],wGe),gi("comparator trim",e),e=e.replace(xa[Jo.TILDETRIM],BGe),gi("tilde trim",e),e=e.replace(xa[Jo.CARETTRIM],vGe),gi("caret trim",e);let A=e.split(" ").map(w=>xGe(w,this.options)).join(" ").split(/\s+/).map(w=>NGe(w,this.options));n&&(A=A.filter(w=>(gi("loose invalid filter",w,this.options),!!w.match(xa[Jo.COMPARATORLOOSE])))),gi("range list",A);let p=new Map,h=A.map(w=>new ML(w,this.options));for(let w of h){if(Vz(w))return[w];p.set(w.value,w)}p.size>1&&p.has("")&&p.delete("");let E=[...p.values()];return Yz.set(o,E),E}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(o=>Kz(o,r)&&e.set.some(a=>Kz(a,r)&&o.every(n=>a.every(u=>n.intersects(u,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new IGe(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",PGe=t=>t.value==="",Kz=(t,e)=>{let r=!0,o=t.slice(),a=o.pop();for(;r&&o.length;)r=o.every(n=>a.intersects(n,e)),a=o.pop();return r},xGe=(t,e)=>(gi("comp",t,e),t=QGe(t,e),gi("caret",t),t=bGe(t,e),gi("tildes",t),t=RGe(t,e),gi("xrange",t),t=LGe(t,e),gi("stars",t),t),zo=t=>!t||t.toLowerCase()==="x"||t==="*",bGe=(t,e)=>t.trim().split(/\s+/).map(r=>kGe(r,e)).join(" "),kGe=(t,e)=>{let r=e.loose?xa[Jo.TILDELOOSE]:xa[Jo.TILDE];return t.replace(r,(o,a,n,u,A)=>{gi("tilde",t,o,a,n,u,A);let p;return zo(a)?p="":zo(n)?p=`>=${a}.0.0 <${+a+1}.0.0-0`:zo(u)?p=`>=${a}.${n}.0 <${a}.${+n+1}.0-0`:A?(gi("replaceTilde pr",A),p=`>=${a}.${n}.${u}-${A} <${a}.${+n+1}.0-0`):p=`>=${a}.${n}.${u} <${a}.${+n+1}.0-0`,gi("tilde return",p),p})},QGe=(t,e)=>t.trim().split(/\s+/).map(r=>FGe(r,e)).join(" "),FGe=(t,e)=>{gi("caret",t,e);let r=e.loose?xa[Jo.CARETLOOSE]:xa[Jo.CARET],o=e.includePrerelease?"-0":"";return t.replace(r,(a,n,u,A,p)=>{gi("caret",t,a,n,u,A,p);let h;return zo(n)?h="":zo(u)?h=`>=${n}.0.0${o} <${+n+1}.0.0-0`:zo(A)?n==="0"?h=`>=${n}.${u}.0${o} <${n}.${+u+1}.0-0`:h=`>=${n}.${u}.0${o} <${+n+1}.0.0-0`:p?(gi("replaceCaret pr",p),n==="0"?u==="0"?h=`>=${n}.${u}.${A}-${p} <${n}.${u}.${+A+1}-0`:h=`>=${n}.${u}.${A}-${p} <${n}.${+u+1}.0-0`:h=`>=${n}.${u}.${A}-${p} <${+n+1}.0.0-0`):(gi("no pr"),n==="0"?u==="0"?h=`>=${n}.${u}.${A}${o} <${n}.${u}.${+A+1}-0`:h=`>=${n}.${u}.${A}${o} <${n}.${+u+1}.0-0`:h=`>=${n}.${u}.${A} <${+n+1}.0.0-0`),gi("caret return",h),h})},RGe=(t,e)=>(gi("replaceXRanges",t,e),t.split(/\s+/).map(r=>TGe(r,e)).join(" ")),TGe=(t,e)=>{t=t.trim();let r=e.loose?xa[Jo.XRANGELOOSE]:xa[Jo.XRANGE];return t.replace(r,(o,a,n,u,A,p)=>{gi("xRange",t,o,a,n,u,A,p);let h=zo(n),E=h||zo(u),w=E||zo(A),D=w;return a==="="&&D&&(a=""),p=e.includePrerelease?"-0":"",h?a===">"||a==="<"?o="<0.0.0-0":o="*":a&&D?(E&&(u=0),A=0,a===">"?(a=">=",E?(n=+n+1,u=0,A=0):(u=+u+1,A=0)):a==="<="&&(a="<",E?n=+n+1:u=+u+1),a==="<"&&(p="-0"),o=`${a+n}.${u}.${A}${p}`):E?o=`>=${n}.0.0${p} <${+n+1}.0.0-0`:w&&(o=`>=${n}.${u}.0${p} <${n}.${+u+1}.0-0`),gi("xRange return",o),o})},LGe=(t,e)=>(gi("replaceStars",t,e),t.trim().replace(xa[Jo.STAR],"")),NGe=(t,e)=>(gi("replaceGTE0",t,e),t.trim().replace(xa[e.includePrerelease?Jo.GTE0PRE:Jo.GTE0],"")),OGe=t=>(e,r,o,a,n,u,A,p,h,E,w,D,b)=>(zo(o)?r="":zo(a)?r=`>=${o}.0.0${t?"-0":""}`:zo(n)?r=`>=${o}.${a}.0${t?"-0":""}`:u?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,zo(h)?p="":zo(E)?p=`<${+h+1}.0.0-0`:zo(w)?p=`<${h}.${+E+1}.0-0`:D?p=`<=${h}.${E}.${w}-${D}`:t?p=`<${h}.${E}.${+w+1}-0`:p=`<=${p}`,`${r} ${p}`.trim()),MGe=(t,e,r)=>{for(let o=0;o0){let a=t[o].semver;if(a.major===e.major&&a.minor===e.minor&&a.patch===e.patch)return!0}return!1}return!0}});var Ow=_((Ykt,tX)=>{var Mw=Symbol("SemVer ANY"),HL=class t{static get ANY(){return Mw}constructor(e,r){if(r=zz(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_L("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Mw?this.value="":this.value=this.operator+this.semver.version,_L("comp",this)}parse(e){let r=this.options.loose?Xz[Zz.COMPARATORLOOSE]:Xz[Zz.COMPARATOR],o=e.match(r);if(!o)throw new TypeError(`Invalid comparator: ${e}`);this.operator=o[1]!==void 0?o[1]:"",this.operator==="="&&(this.operator=""),o[2]?this.semver=new $z(o[2],this.options.loose):this.semver=Mw}toString(){return this.value}test(e){if(_L("Comparator.test",e,this.options.loose),this.semver===Mw||e===Mw)return!0;if(typeof e=="string")try{e=new $z(e,this.options)}catch{return!1}return UL(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new eX(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new eX(this.value,r).test(e.semver):(r=zz(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||UL(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||UL(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};tX.exports=HL;var zz=WS(),{safeRe:Xz,t:Zz}=bm(),UL=FL(),_L=Rw(),$z=Eo(),eX=Ul()});var Uw=_((Vkt,rX)=>{var UGe=Ul(),_Ge=(t,e,r)=>{try{e=new UGe(e,r)}catch{return!1}return e.test(t)};rX.exports=_Ge});var iX=_((Kkt,nX)=>{var HGe=Ul(),qGe=(t,e)=>new HGe(t,e).set.map(r=>r.map(o=>o.value).join(" ").trim().split(" "));nX.exports=qGe});var oX=_((Jkt,sX)=>{var jGe=Eo(),GGe=Ul(),WGe=(t,e,r)=>{let o=null,a=null,n=null;try{n=new GGe(e,r)}catch{return null}return t.forEach(u=>{n.test(u)&&(!o||a.compare(u)===-1)&&(o=u,a=new jGe(o,r))}),o};sX.exports=WGe});var lX=_((zkt,aX)=>{var YGe=Eo(),VGe=Ul(),KGe=(t,e,r)=>{let o=null,a=null,n=null;try{n=new VGe(e,r)}catch{return null}return t.forEach(u=>{n.test(u)&&(!o||a.compare(u)===1)&&(o=u,a=new YGe(o,r))}),o};aX.exports=KGe});var AX=_((Xkt,uX)=>{var qL=Eo(),JGe=Ul(),cX=Tw(),zGe=(t,e)=>{t=new JGe(t,e);let r=new qL("0.0.0");if(t.test(r)||(r=new qL("0.0.0-0"),t.test(r)))return r;r=null;for(let o=0;o{let A=new qL(u.semver.version);switch(u.operator){case">":A.prerelease.length===0?A.patch++:A.prerelease.push(0),A.raw=A.format();case"":case">=":(!n||cX(A,n))&&(n=A);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${u.operator}`)}}),n&&(!r||cX(r,n))&&(r=n)}return r&&t.test(r)?r:null};uX.exports=zGe});var pX=_((Zkt,fX)=>{var XGe=Ul(),ZGe=(t,e)=>{try{return new XGe(t,e).range||"*"}catch{return null}};fX.exports=ZGe});var rP=_(($kt,mX)=>{var $Ge=Eo(),dX=Ow(),{ANY:e5e}=dX,t5e=Ul(),r5e=Uw(),hX=Tw(),gX=JS(),n5e=XS(),i5e=zS(),s5e=(t,e,r,o)=>{t=new $Ge(t,o),e=new t5e(e,o);let a,n,u,A,p;switch(r){case">":a=hX,n=n5e,u=gX,A=">",p=">=";break;case"<":a=gX,n=i5e,u=hX,A="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(r5e(t,e,o))return!1;for(let h=0;h{b.semver===e5e&&(b=new dX(">=0.0.0")),w=w||b,D=D||b,a(b.semver,w.semver,o)?w=b:u(b.semver,D.semver,o)&&(D=b)}),w.operator===A||w.operator===p||(!D.operator||D.operator===A)&&n(t,D.semver))return!1;if(D.operator===p&&u(t,D.semver))return!1}return!0};mX.exports=s5e});var EX=_((eQt,yX)=>{var o5e=rP(),a5e=(t,e,r)=>o5e(t,e,">",r);yX.exports=a5e});var IX=_((tQt,CX)=>{var l5e=rP(),c5e=(t,e,r)=>l5e(t,e,"<",r);CX.exports=c5e});var vX=_((rQt,BX)=>{var wX=Ul(),u5e=(t,e,r)=>(t=new wX(t,r),e=new wX(e,r),t.intersects(e,r));BX.exports=u5e});var SX=_((nQt,DX)=>{var A5e=Uw(),f5e=Ml();DX.exports=(t,e,r)=>{let o=[],a=null,n=null,u=t.sort((E,w)=>f5e(E,w,r));for(let E of u)A5e(E,e,r)?(n=E,a||(a=E)):(n&&o.push([a,n]),n=null,a=null);a&&o.push([a,null]);let A=[];for(let[E,w]of o)E===w?A.push(E):!w&&E===u[0]?A.push("*"):w?E===u[0]?A.push(`<=${w}`):A.push(`${E} - ${w}`):A.push(`>=${E}`);let p=A.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return p.length{var PX=Ul(),WL=Ow(),{ANY:jL}=WL,_w=Uw(),YL=Ml(),p5e=(t,e,r={})=>{if(t===e)return!0;t=new PX(t,r),e=new PX(e,r);let o=!1;e:for(let a of t.set){for(let n of e.set){let u=g5e(a,n,r);if(o=o||u!==null,u)continue e}if(o)return!1}return!0},h5e=[new WL(">=0.0.0-0")],xX=[new WL(">=0.0.0")],g5e=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===jL){if(e.length===1&&e[0].semver===jL)return!0;r.includePrerelease?t=h5e:t=xX}if(e.length===1&&e[0].semver===jL){if(r.includePrerelease)return!0;e=xX}let o=new Set,a,n;for(let b of t)b.operator===">"||b.operator===">="?a=bX(a,b,r):b.operator==="<"||b.operator==="<="?n=kX(n,b,r):o.add(b.semver);if(o.size>1)return null;let u;if(a&&n){if(u=YL(a.semver,n.semver,r),u>0)return null;if(u===0&&(a.operator!==">="||n.operator!=="<="))return null}for(let b of o){if(a&&!_w(b,String(a),r)||n&&!_w(b,String(n),r))return null;for(let C of e)if(!_w(b,String(C),r))return!1;return!0}let A,p,h,E,w=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1,D=a&&!r.includePrerelease&&a.semver.prerelease.length?a.semver:!1;w&&w.prerelease.length===1&&n.operator==="<"&&w.prerelease[0]===0&&(w=!1);for(let b of e){if(E=E||b.operator===">"||b.operator===">=",h=h||b.operator==="<"||b.operator==="<=",a){if(D&&b.semver.prerelease&&b.semver.prerelease.length&&b.semver.major===D.major&&b.semver.minor===D.minor&&b.semver.patch===D.patch&&(D=!1),b.operator===">"||b.operator===">="){if(A=bX(a,b,r),A===b&&A!==a)return!1}else if(a.operator===">="&&!_w(a.semver,String(b),r))return!1}if(n){if(w&&b.semver.prerelease&&b.semver.prerelease.length&&b.semver.major===w.major&&b.semver.minor===w.minor&&b.semver.patch===w.patch&&(w=!1),b.operator==="<"||b.operator==="<="){if(p=kX(n,b,r),p===b&&p!==n)return!1}else if(n.operator==="<="&&!_w(n.semver,String(b),r))return!1}if(!b.operator&&(n||a)&&u!==0)return!1}return!(a&&h&&!n&&u!==0||n&&E&&!a&&u!==0||D||w)},bX=(t,e,r)=>{if(!t)return e;let o=YL(t.semver,e.semver,r);return o>0?t:o<0||e.operator===">"&&t.operator===">="?e:t},kX=(t,e,r)=>{if(!t)return e;let o=YL(t.semver,e.semver,r);return o<0?t:o>0||e.operator==="<"&&t.operator==="<="?e:t};QX.exports=p5e});var ni=_((sQt,LX)=>{var VL=bm(),RX=Fw(),d5e=Eo(),TX=xL(),m5e=cg(),y5e=ez(),E5e=rz(),C5e=sz(),I5e=lz(),w5e=uz(),B5e=fz(),v5e=hz(),D5e=dz(),S5e=Ml(),P5e=Cz(),x5e=wz(),b5e=KS(),k5e=Sz(),Q5e=xz(),F5e=Tw(),R5e=JS(),T5e=kL(),L5e=QL(),N5e=zS(),O5e=XS(),M5e=FL(),U5e=Oz(),_5e=Ow(),H5e=Ul(),q5e=Uw(),j5e=iX(),G5e=oX(),W5e=lX(),Y5e=AX(),V5e=pX(),K5e=rP(),J5e=EX(),z5e=IX(),X5e=vX(),Z5e=SX(),$5e=FX();LX.exports={parse:m5e,valid:y5e,clean:E5e,inc:C5e,diff:I5e,major:w5e,minor:B5e,patch:v5e,prerelease:D5e,compare:S5e,rcompare:P5e,compareLoose:x5e,compareBuild:b5e,sort:k5e,rsort:Q5e,gt:F5e,lt:R5e,eq:T5e,neq:L5e,gte:N5e,lte:O5e,cmp:M5e,coerce:U5e,Comparator:_5e,Range:H5e,satisfies:q5e,toComparators:j5e,maxSatisfying:G5e,minSatisfying:W5e,minVersion:Y5e,validRange:V5e,outside:K5e,gtr:J5e,ltr:z5e,intersects:X5e,simplifyRange:Z5e,subset:$5e,SemVer:d5e,re:VL.re,src:VL.src,tokens:VL.t,SEMVER_SPEC_VERSION:RX.SEMVER_SPEC_VERSION,RELEASE_TYPES:RX.RELEASE_TYPES,compareIdentifiers:TX.compareIdentifiers,rcompareIdentifiers:TX.rcompareIdentifiers}});var OX=_((oQt,NX)=>{"use strict";function e9e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function pg(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,pg)}e9e(pg,Error);pg.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",w;for(w=0;w0){for(w=1,D=1;w{switch(Fe[1]){case"|":return be|Fe[3];case"&":return be&Fe[3];case"^":return be^Fe[3]}},$)},D="!",b=Le("!",!1),C=function($){return!$},T="(",N=Le("(",!1),U=")",J=Le(")",!1),te=function($){return $},le=/^[^ \t\n\r()!|&\^]/,ce=Te([" "," ",` -`,"\r","(",")","!","|","&","^"],!0,!1),ue=function($){return e.queryPattern.test($)},Ie=function($){return e.checkFn($)},he=xe("whitespace"),De=/^[ \t\n\r]/,Ee=Te([" "," ",` -`,"\r"],!1,!1),g=0,me=0,Ce=[{line:1,column:1}],fe=0,ie=[],Z=0,Se;if("startRule"in e){if(!(e.startRule in o))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=o[e.startRule]}function Re(){return t.substring(me,g)}function ht(){return He(me,g)}function q($,se){throw se=se!==void 0?se:He(me,g),P([xe($)],t.substring(me,g),se)}function nt($,se){throw se=se!==void 0?se:He(me,g),I($,se)}function Le($,se){return{type:"literal",text:$,ignoreCase:se}}function Te($,se,be){return{type:"class",parts:$,inverted:se,ignoreCase:be}}function ke(){return{type:"any"}}function Ke(){return{type:"end"}}function xe($){return{type:"other",description:$}}function tt($){var se=Ce[$],be;if(se)return se;for(be=$-1;!Ce[be];)be--;for(se=Ce[be],se={line:se.line,column:se.column};be<$;)t.charCodeAt(be)===10?(se.line++,se.column=1):se.column++,be++;return Ce[$]=se,se}function He($,se){var be=tt($),Fe=tt(se);return{start:{offset:$,line:be.line,column:be.column},end:{offset:se,line:Fe.line,column:Fe.column}}}function x($){gfe&&(fe=g,ie=[]),ie.push($))}function I($,se){return new pg($,null,null,se)}function P($,se,be){return new pg(pg.buildMessage($,se),$,se,be)}function y(){var $,se,be,Fe,lt,Et,qt,nr;if($=g,se=R(),se!==r){for(be=[],Fe=g,lt=X(),lt!==r?(t.charCodeAt(g)===124?(Et=n,g++):(Et=r,Z===0&&x(u)),Et===r&&(t.charCodeAt(g)===38?(Et=A,g++):(Et=r,Z===0&&x(p)),Et===r&&(t.charCodeAt(g)===94?(Et=h,g++):(Et=r,Z===0&&x(E)))),Et!==r?(qt=X(),qt!==r?(nr=R(),nr!==r?(lt=[lt,Et,qt,nr],Fe=lt):(g=Fe,Fe=r)):(g=Fe,Fe=r)):(g=Fe,Fe=r)):(g=Fe,Fe=r);Fe!==r;)be.push(Fe),Fe=g,lt=X(),lt!==r?(t.charCodeAt(g)===124?(Et=n,g++):(Et=r,Z===0&&x(u)),Et===r&&(t.charCodeAt(g)===38?(Et=A,g++):(Et=r,Z===0&&x(p)),Et===r&&(t.charCodeAt(g)===94?(Et=h,g++):(Et=r,Z===0&&x(E)))),Et!==r?(qt=X(),qt!==r?(nr=R(),nr!==r?(lt=[lt,Et,qt,nr],Fe=lt):(g=Fe,Fe=r)):(g=Fe,Fe=r)):(g=Fe,Fe=r)):(g=Fe,Fe=r);be!==r?(me=$,se=w(se,be),$=se):(g=$,$=r)}else g=$,$=r;return $}function R(){var $,se,be,Fe,lt,Et;return $=g,t.charCodeAt(g)===33?(se=D,g++):(se=r,Z===0&&x(b)),se!==r?(be=R(),be!==r?(me=$,se=C(be),$=se):(g=$,$=r)):(g=$,$=r),$===r&&($=g,t.charCodeAt(g)===40?(se=T,g++):(se=r,Z===0&&x(N)),se!==r?(be=X(),be!==r?(Fe=y(),Fe!==r?(lt=X(),lt!==r?(t.charCodeAt(g)===41?(Et=U,g++):(Et=r,Z===0&&x(J)),Et!==r?(me=$,se=te(Fe),$=se):(g=$,$=r)):(g=$,$=r)):(g=$,$=r)):(g=$,$=r)):(g=$,$=r),$===r&&($=z())),$}function z(){var $,se,be,Fe,lt;if($=g,se=X(),se!==r){if(be=g,Fe=[],le.test(t.charAt(g))?(lt=t.charAt(g),g++):(lt=r,Z===0&&x(ce)),lt!==r)for(;lt!==r;)Fe.push(lt),le.test(t.charAt(g))?(lt=t.charAt(g),g++):(lt=r,Z===0&&x(ce));else Fe=r;Fe!==r?be=t.substring(be,g):be=Fe,be!==r?(me=g,Fe=ue(be),Fe?Fe=void 0:Fe=r,Fe!==r?(me=$,se=Ie(be),$=se):(g=$,$=r)):(g=$,$=r)}else g=$,$=r;return $}function X(){var $,se;for(Z++,$=[],De.test(t.charAt(g))?(se=t.charAt(g),g++):(se=r,Z===0&&x(Ee));se!==r;)$.push(se),De.test(t.charAt(g))?(se=t.charAt(g),g++):(se=r,Z===0&&x(Ee));return Z--,$===r&&(se=r,Z===0&&x(he)),$}if(Se=a(),Se!==r&&g===t.length)return Se;throw Se!==r&&g{var{parse:r9e}=OX();nP.makeParser=(t=/[a-z]+/)=>(e,r)=>r9e(e,{queryPattern:t,checkFn:r});nP.parse=nP.makeParser()});var _X=_((lQt,UX)=>{"use strict";UX.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var KL=_((cQt,qX)=>{var Hw=_X(),HX={};for(let t of Object.keys(Hw))HX[Hw[t]]=t;var fr={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};qX.exports=fr;for(let t of Object.keys(fr)){if(!("channels"in fr[t]))throw new Error("missing channels property: "+t);if(!("labels"in fr[t]))throw new Error("missing channel labels property: "+t);if(fr[t].labels.length!==fr[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=fr[t];delete fr[t].channels,delete fr[t].labels,Object.defineProperty(fr[t],"channels",{value:e}),Object.defineProperty(fr[t],"labels",{value:r})}fr.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(e,r,o),n=Math.max(e,r,o),u=n-a,A,p;n===a?A=0:e===n?A=(r-o)/u:r===n?A=2+(o-e)/u:o===n&&(A=4+(e-r)/u),A=Math.min(A*60,360),A<0&&(A+=360);let h=(a+n)/2;return n===a?p=0:h<=.5?p=u/(n+a):p=u/(2-n-a),[A,p*100,h*100]};fr.rgb.hsv=function(t){let e,r,o,a,n,u=t[0]/255,A=t[1]/255,p=t[2]/255,h=Math.max(u,A,p),E=h-Math.min(u,A,p),w=function(D){return(h-D)/6/E+1/2};return E===0?(a=0,n=0):(n=E/h,e=w(u),r=w(A),o=w(p),u===h?a=o-r:A===h?a=1/3+e-o:p===h&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[a*360,n*100,h*100]};fr.rgb.hwb=function(t){let e=t[0],r=t[1],o=t[2],a=fr.rgb.hsl(t)[0],n=1/255*Math.min(e,Math.min(r,o));return o=1-1/255*Math.max(e,Math.max(r,o)),[a,n*100,o*100]};fr.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(1-e,1-r,1-o),n=(1-e-a)/(1-a)||0,u=(1-r-a)/(1-a)||0,A=(1-o-a)/(1-a)||0;return[n*100,u*100,A*100,a*100]};function n9e(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}fr.rgb.keyword=function(t){let e=HX[t];if(e)return e;let r=1/0,o;for(let a of Object.keys(Hw)){let n=Hw[a],u=n9e(t,n);u.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;let a=e*.4124+r*.3576+o*.1805,n=e*.2126+r*.7152+o*.0722,u=e*.0193+r*.1192+o*.9505;return[a*100,n*100,u*100]};fr.rgb.lab=function(t){let e=fr.rgb.xyz(t),r=e[0],o=e[1],a=e[2];r/=95.047,o/=100,a/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;let n=116*o-16,u=500*(r-o),A=200*(o-a);return[n,u,A]};fr.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,o=t[2]/100,a,n,u;if(r===0)return u=o*255,[u,u,u];o<.5?a=o*(1+r):a=o+r-o*r;let A=2*o-a,p=[0,0,0];for(let h=0;h<3;h++)n=e+1/3*-(h-1),n<0&&n++,n>1&&n--,6*n<1?u=A+(a-A)*6*n:2*n<1?u=a:3*n<2?u=A+(a-A)*(2/3-n)*6:u=A,p[h]=u*255;return p};fr.hsl.hsv=function(t){let e=t[0],r=t[1]/100,o=t[2]/100,a=r,n=Math.max(o,.01);o*=2,r*=o<=1?o:2-o,a*=n<=1?n:2-n;let u=(o+r)/2,A=o===0?2*a/(n+a):2*r/(o+r);return[e,A*100,u*100]};fr.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,o=t[2]/100,a=Math.floor(e)%6,n=e-Math.floor(e),u=255*o*(1-r),A=255*o*(1-r*n),p=255*o*(1-r*(1-n));switch(o*=255,a){case 0:return[o,p,u];case 1:return[A,o,u];case 2:return[u,o,p];case 3:return[u,A,o];case 4:return[p,u,o];case 5:return[o,u,A]}};fr.hsv.hsl=function(t){let e=t[0],r=t[1]/100,o=t[2]/100,a=Math.max(o,.01),n,u;u=(2-r)*o;let A=(2-r)*a;return n=r*a,n/=A<=1?A:2-A,n=n||0,u/=2,[e,n*100,u*100]};fr.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,o=t[2]/100,a=r+o,n;a>1&&(r/=a,o/=a);let u=Math.floor(6*e),A=1-o;n=6*e-u,u&1&&(n=1-n);let p=r+n*(A-r),h,E,w;switch(u){default:case 6:case 0:h=A,E=p,w=r;break;case 1:h=p,E=A,w=r;break;case 2:h=r,E=A,w=p;break;case 3:h=r,E=p,w=A;break;case 4:h=p,E=r,w=A;break;case 5:h=A,E=r,w=p;break}return[h*255,E*255,w*255]};fr.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,o=t[2]/100,a=t[3]/100,n=1-Math.min(1,e*(1-a)+a),u=1-Math.min(1,r*(1-a)+a),A=1-Math.min(1,o*(1-a)+a);return[n*255,u*255,A*255]};fr.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,o=t[2]/100,a,n,u;return a=e*3.2406+r*-1.5372+o*-.4986,n=e*-.9689+r*1.8758+o*.0415,u=e*.0557+r*-.204+o*1.057,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,u=u>.0031308?1.055*u**(1/2.4)-.055:u*12.92,a=Math.min(Math.max(0,a),1),n=Math.min(Math.max(0,n),1),u=Math.min(Math.max(0,u),1),[a*255,n*255,u*255]};fr.xyz.lab=function(t){let e=t[0],r=t[1],o=t[2];e/=95.047,r/=100,o/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let a=116*r-16,n=500*(e-r),u=200*(r-o);return[a,n,u]};fr.lab.xyz=function(t){let e=t[0],r=t[1],o=t[2],a,n,u;n=(e+16)/116,a=r/500+n,u=n-o/200;let A=n**3,p=a**3,h=u**3;return n=A>.008856?A:(n-16/116)/7.787,a=p>.008856?p:(a-16/116)/7.787,u=h>.008856?h:(u-16/116)/7.787,a*=95.047,n*=100,u*=108.883,[a,n,u]};fr.lab.lch=function(t){let e=t[0],r=t[1],o=t[2],a;a=Math.atan2(o,r)*360/2/Math.PI,a<0&&(a+=360);let u=Math.sqrt(r*r+o*o);return[e,u,a]};fr.lch.lab=function(t){let e=t[0],r=t[1],a=t[2]/360*2*Math.PI,n=r*Math.cos(a),u=r*Math.sin(a);return[e,n,u]};fr.rgb.ansi16=function(t,e=null){let[r,o,a]=t,n=e===null?fr.rgb.hsv(t)[2]:e;if(n=Math.round(n/50),n===0)return 30;let u=30+(Math.round(a/255)<<2|Math.round(o/255)<<1|Math.round(r/255));return n===2&&(u+=60),u};fr.hsv.ansi16=function(t){return fr.rgb.ansi16(fr.hsv.rgb(t),t[2])};fr.rgb.ansi256=function(t){let e=t[0],r=t[1],o=t[2];return e===r&&r===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)};fr.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,o=(e&1)*r*255,a=(e>>1&1)*r*255,n=(e>>2&1)*r*255;return[o,a,n]};fr.ansi256.rgb=function(t){if(t>=232){let n=(t-232)*10+8;return[n,n,n]}t-=16;let e,r=Math.floor(t/36)/5*255,o=Math.floor((e=t%36)/6)/5*255,a=e%6/5*255;return[r,o,a]};fr.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};fr.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(A=>A+A).join(""));let o=parseInt(r,16),a=o>>16&255,n=o>>8&255,u=o&255;return[a,n,u]};fr.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.max(Math.max(e,r),o),n=Math.min(Math.min(e,r),o),u=a-n,A,p;return u<1?A=n/(1-u):A=0,u<=0?p=0:a===e?p=(r-o)/u%6:a===r?p=2+(o-e)/u:p=4+(e-r)/u,p/=6,p%=1,[p*360,u*100,A*100]};fr.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,o=r<.5?2*e*r:2*e*(1-r),a=0;return o<1&&(a=(r-.5*o)/(1-o)),[t[0],o*100,a*100]};fr.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,o=e*r,a=0;return o<1&&(a=(r-o)/(1-o)),[t[0],o*100,a*100]};fr.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,o=t[2]/100;if(r===0)return[o*255,o*255,o*255];let a=[0,0,0],n=e%1*6,u=n%1,A=1-u,p=0;switch(Math.floor(n)){case 0:a[0]=1,a[1]=u,a[2]=0;break;case 1:a[0]=A,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=u;break;case 3:a[0]=0,a[1]=A,a[2]=1;break;case 4:a[0]=u,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=A}return p=(1-r)*o,[(r*a[0]+p)*255,(r*a[1]+p)*255,(r*a[2]+p)*255]};fr.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,o=e+r*(1-e),a=0;return o>0&&(a=e/o),[t[0],a*100,o*100]};fr.hcg.hsl=function(t){let e=t[1]/100,o=t[2]/100*(1-e)+.5*e,a=0;return o>0&&o<.5?a=e/(2*o):o>=.5&&o<1&&(a=e/(2*(1-o))),[t[0],a*100,o*100]};fr.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,o=e+r*(1-e);return[t[0],(o-e)*100,(1-o)*100]};fr.hwb.hcg=function(t){let e=t[1]/100,o=1-t[2]/100,a=o-e,n=0;return a<1&&(n=(o-a)/(1-a)),[t[0],a*100,n*100]};fr.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};fr.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};fr.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};fr.gray.hsl=function(t){return[0,0,t[0]]};fr.gray.hsv=fr.gray.hsl;fr.gray.hwb=function(t){return[0,100,t[0]]};fr.gray.cmyk=function(t){return[0,0,0,t[0]]};fr.gray.lab=function(t){return[t[0],0,0]};fr.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,o=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(o.length)+o};fr.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var GX=_((uQt,jX)=>{var iP=KL();function i9e(){let t={},e=Object.keys(iP);for(let r=e.length,o=0;o{var JL=KL(),l9e=GX(),Rm={},c9e=Object.keys(JL);function u9e(t){let e=function(...r){let o=r[0];return o==null?o:(o.length>1&&(r=o),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function A9e(t){let e=function(...r){let o=r[0];if(o==null)return o;o.length>1&&(r=o);let a=t(r);if(typeof a=="object")for(let n=a.length,u=0;u{Rm[t]={},Object.defineProperty(Rm[t],"channels",{value:JL[t].channels}),Object.defineProperty(Rm[t],"labels",{value:JL[t].labels});let e=l9e(t);Object.keys(e).forEach(o=>{let a=e[o];Rm[t][o]=A9e(a),Rm[t][o].raw=u9e(a)})});WX.exports=Rm});var qw=_((fQt,XX)=>{"use strict";var VX=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,KX=(t,e)=>(...r)=>{let o=t(...r);return`\x1B[${38+e};5;${o}m`},JX=(t,e)=>(...r)=>{let o=t(...r);return`\x1B[${38+e};2;${o[0]};${o[1]};${o[2]}m`},sP=t=>t,zX=(t,e,r)=>[t,e,r],Tm=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let o=r();return Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0}),o},enumerable:!0,configurable:!0})},zL,Lm=(t,e,r,o)=>{zL===void 0&&(zL=YX());let a=o?10:0,n={};for(let[u,A]of Object.entries(zL)){let p=u==="ansi16"?"ansi":u;u===e?n[p]=t(r,a):typeof A=="object"&&(n[p]=t(A[e],a))}return n};function f9e(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,o]of Object.entries(e)){for(let[a,n]of Object.entries(o))e[a]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},o[a]=e[a],t.set(n[0],n[1]);Object.defineProperty(e,r,{value:o,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Tm(e.color,"ansi",()=>Lm(VX,"ansi16",sP,!1)),Tm(e.color,"ansi256",()=>Lm(KX,"ansi256",sP,!1)),Tm(e.color,"ansi16m",()=>Lm(JX,"rgb",zX,!1)),Tm(e.bgColor,"ansi",()=>Lm(VX,"ansi16",sP,!0)),Tm(e.bgColor,"ansi256",()=>Lm(KX,"ansi256",sP,!0)),Tm(e.bgColor,"ansi16m",()=>Lm(JX,"rgb",zX,!0)),e}Object.defineProperty(XX,"exports",{enumerable:!0,get:f9e})});var $X=_((pQt,ZX)=>{"use strict";ZX.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),a=e.indexOf("--");return o!==-1&&(a===-1||o{"use strict";var p9e=ve("os"),eZ=ve("tty"),_l=$X(),{env:cs}=process,Zp;_l("no-color")||_l("no-colors")||_l("color=false")||_l("color=never")?Zp=0:(_l("color")||_l("colors")||_l("color=true")||_l("color=always"))&&(Zp=1);"FORCE_COLOR"in cs&&(cs.FORCE_COLOR==="true"?Zp=1:cs.FORCE_COLOR==="false"?Zp=0:Zp=cs.FORCE_COLOR.length===0?1:Math.min(parseInt(cs.FORCE_COLOR,10),3));function XL(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function ZL(t,e){if(Zp===0)return 0;if(_l("color=16m")||_l("color=full")||_l("color=truecolor"))return 3;if(_l("color=256"))return 2;if(t&&!e&&Zp===void 0)return 0;let r=Zp||0;if(cs.TERM==="dumb")return r;if(process.platform==="win32"){let o=p9e.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in cs)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(o=>o in cs)||cs.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in cs)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(cs.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in cs)return 1;if(cs.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in cs){let o=parseInt((cs.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(cs.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(cs.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(cs.TERM)||"COLORTERM"in cs?1:r}function h9e(t){let e=ZL(t,t&&t.isTTY);return XL(e)}tZ.exports={supportsColor:h9e,stdout:XL(ZL(!0,eZ.isatty(1))),stderr:XL(ZL(!0,eZ.isatty(2)))}});var nZ=_((gQt,rZ)=>{"use strict";var g9e=(t,e,r)=>{let o=t.indexOf(e);if(o===-1)return t;let a=e.length,n=0,u="";do u+=t.substr(n,o-n)+e+r,n=o+a,o=t.indexOf(e,n);while(o!==-1);return u+=t.substr(n),u},d9e=(t,e,r,o)=>{let a=0,n="";do{let u=t[o-1]==="\r";n+=t.substr(a,(u?o-1:o)-a)+e+(u?`\r -`:` -`)+r,a=o+1,o=t.indexOf(` -`,a)}while(o!==-1);return n+=t.substr(a),n};rZ.exports={stringReplaceAll:g9e,stringEncaseCRLFWithFirstIndex:d9e}});var lZ=_((dQt,aZ)=>{"use strict";var m9e=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,iZ=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,y9e=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,E9e=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,C9e=new Map([["n",` -`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function oZ(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):C9e.get(t)||t}function I9e(t,e){let r=[],o=e.trim().split(/\s*,\s*/g),a;for(let n of o){let u=Number(n);if(!Number.isNaN(u))r.push(u);else if(a=n.match(y9e))r.push(a[2].replace(E9e,(A,p,h)=>p?oZ(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function w9e(t){iZ.lastIndex=0;let e=[],r;for(;(r=iZ.exec(t))!==null;){let o=r[1];if(r[2]){let a=I9e(o,r[2]);e.push([o].concat(a))}else e.push([o])}return e}function sZ(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let o=t;for(let[a,n]of Object.entries(r))if(Array.isArray(n)){if(!(a in o))throw new Error(`Unknown Chalk style: ${a}`);o=n.length>0?o[a](...n):o[a]}return o}aZ.exports=(t,e)=>{let r=[],o=[],a=[];if(e.replace(m9e,(n,u,A,p,h,E)=>{if(u)a.push(oZ(u));else if(p){let w=a.join("");a=[],o.push(r.length===0?w:sZ(t,r)(w)),r.push({inverse:A,styles:w9e(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");o.push(sZ(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),o.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return o.join("")}});var sN=_((mQt,fZ)=>{"use strict";var jw=qw(),{stdout:tN,stderr:rN}=$L(),{stringReplaceAll:B9e,stringEncaseCRLFWithFirstIndex:v9e}=nZ(),cZ=["ansi","ansi","ansi256","ansi16m"],Nm=Object.create(null),D9e=(t,e={})=>{if(e.level>3||e.level<0)throw new Error("The `level` option should be an integer from 0 to 3");let r=tN?tN.level:0;t.level=e.level===void 0?r:e.level},nN=class{constructor(e){return uZ(e)}},uZ=t=>{let e={};return D9e(e,t),e.template=(...r)=>x9e(e.template,...r),Object.setPrototypeOf(e,oP.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=nN,e.template};function oP(t){return uZ(t)}for(let[t,e]of Object.entries(jw))Nm[t]={get(){let r=aP(this,iN(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};Nm.visible={get(){let t=aP(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var AZ=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of AZ)Nm[t]={get(){let{level:e}=this;return function(...r){let o=iN(jw.color[cZ[e]][t](...r),jw.color.close,this._styler);return aP(this,o,this._isEmpty)}}};for(let t of AZ){let e="bg"+t[0].toUpperCase()+t.slice(1);Nm[e]={get(){let{level:r}=this;return function(...o){let a=iN(jw.bgColor[cZ[r]][t](...o),jw.bgColor.close,this._styler);return aP(this,a,this._isEmpty)}}}}var S9e=Object.defineProperties(()=>{},{...Nm,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),iN=(t,e,r)=>{let o,a;return r===void 0?(o=t,a=e):(o=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:o,closeAll:a,parent:r}},aP=(t,e,r)=>{let o=(...a)=>P9e(o,a.length===1?""+a[0]:a.join(" "));return o.__proto__=S9e,o._generator=t,o._styler=e,o._isEmpty=r,o},P9e=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:o,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=B9e(e,r.close,r.open),r=r.parent;let n=e.indexOf(` -`);return n!==-1&&(e=v9e(e,a,o,n)),o+e+a},eN,x9e=(t,...e)=>{let[r]=e;if(!Array.isArray(r))return e.join(" ");let o=e.slice(1),a=[r.raw[0]];for(let n=1;n{"use strict";Hl.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Hl.find=(t,e)=>t.nodes.find(r=>r.type===e);Hl.exceedsLimit=(t,e,r=1,o)=>o===!1||!Hl.isInteger(t)||!Hl.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=o;Hl.escapeNode=(t,e=0,r)=>{let o=t.nodes[e];o&&(r&&o.type===r||o.type==="open"||o.type==="close")&&o.escaped!==!0&&(o.value="\\"+o.value,o.escaped=!0)};Hl.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);Hl.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Hl.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Hl.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Hl.flatten=(...t)=>{let e=[],r=o=>{for(let a=0;a{"use strict";var pZ=lP();hZ.exports=(t,e={})=>{let r=(o,a={})=>{let n=e.escapeInvalid&&pZ.isInvalidBrace(a),u=o.invalid===!0&&e.escapeInvalid===!0,A="";if(o.value)return(n||u)&&pZ.isOpenOrClose(o)?"\\"+o.value:o.value;if(o.value)return o.value;if(o.nodes)for(let p of o.nodes)A+=r(p);return A};return r(t)}});var dZ=_((CQt,gZ)=>{"use strict";gZ.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var DZ=_((IQt,vZ)=>{"use strict";var mZ=dZ(),hg=(t,e,r)=>{if(mZ(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(mZ(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let o={relaxZeros:!0,...r};typeof o.strictZeros=="boolean"&&(o.relaxZeros=o.strictZeros===!1);let a=String(o.relaxZeros),n=String(o.shorthand),u=String(o.capture),A=String(o.wrap),p=t+":"+e+"="+a+n+u+A;if(hg.cache.hasOwnProperty(p))return hg.cache[p].result;let h=Math.min(t,e),E=Math.max(t,e);if(Math.abs(h-E)===1){let T=t+"|"+e;return o.capture?`(${T})`:o.wrap===!1?T:`(?:${T})`}let w=BZ(t)||BZ(e),D={min:t,max:e,a:h,b:E},b=[],C=[];if(w&&(D.isPadded=w,D.maxLen=String(D.max).length),h<0){let T=E<0?Math.abs(E):1;C=yZ(T,Math.abs(h),D,o),h=D.a=0}return E>=0&&(b=yZ(h,E,D,o)),D.negatives=C,D.positives=b,D.result=b9e(C,b,o),o.capture===!0?D.result=`(${D.result})`:o.wrap!==!1&&b.length+C.length>1&&(D.result=`(?:${D.result})`),hg.cache[p]=D,D.result};function b9e(t,e,r){let o=oN(t,e,"-",!1,r)||[],a=oN(e,t,"",!1,r)||[],n=oN(t,e,"-?",!0,r)||[];return o.concat(n).concat(a).join("|")}function k9e(t,e){let r=1,o=1,a=CZ(t,r),n=new Set([e]);for(;t<=a&&a<=e;)n.add(a),r+=1,a=CZ(t,r);for(a=IZ(e+1,o)-1;t1&&A.count.pop(),A.count.push(E.count[0]),A.string=A.pattern+wZ(A.count),u=h+1;continue}r.isPadded&&(w=L9e(h,r,o)),E.string=w+E.pattern+wZ(E.count),n.push(E),u=h+1,A=E}return n}function oN(t,e,r,o,a){let n=[];for(let u of t){let{string:A}=u;!o&&!EZ(e,"string",A)&&n.push(r+A),o&&EZ(e,"string",A)&&n.push(r+A)}return n}function F9e(t,e){let r=[];for(let o=0;oe?1:e>t?-1:0}function EZ(t,e,r){return t.some(o=>o[e]===r)}function CZ(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function IZ(t,e){return t-t%Math.pow(10,e)}function wZ(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function T9e(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function BZ(t){return/^-?(0+)\d/.test(t)}function L9e(t,e,r){if(!e.isPadded)return t;let o=Math.abs(e.maxLen-String(t).length),a=r.relaxZeros!==!1;switch(o){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:return a?`0{0,${o}}`:`0{${o}}`}}hg.cache={};hg.clearCache=()=>hg.cache={};vZ.exports=hg});var cN=_((wQt,RZ)=>{"use strict";var N9e=ve("util"),xZ=DZ(),SZ=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),O9e=t=>e=>t===!0?Number(e):String(e),aN=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ww=t=>Number.isInteger(+t),lN=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},M9e=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,U9e=(t,e,r)=>{if(e>0){let o=t[0]==="-"?"-":"";o&&(t=t.slice(1)),t=o+t.padStart(o?e-1:e,"0")}return r===!1?String(t):t},PZ=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length{t.negatives.sort((u,A)=>uA?1:0),t.positives.sort((u,A)=>uA?1:0);let r=e.capture?"":"?:",o="",a="",n;return t.positives.length&&(o=t.positives.join("|")),t.negatives.length&&(a=`-(${r}${t.negatives.join("|")})`),o&&a?n=`${o}|${a}`:n=o||a,e.wrap?`(${r}${n})`:n},bZ=(t,e,r,o)=>{if(r)return xZ(t,e,{wrap:!1,...o});let a=String.fromCharCode(t);if(t===e)return a;let n=String.fromCharCode(e);return`[${a}-${n}]`},kZ=(t,e,r)=>{if(Array.isArray(t)){let o=r.wrap===!0,a=r.capture?"":"?:";return o?`(${a}${t.join("|")})`:t.join("|")}return xZ(t,e,r)},QZ=(...t)=>new RangeError("Invalid range arguments: "+N9e.inspect(...t)),FZ=(t,e,r)=>{if(r.strictRanges===!0)throw QZ([t,e]);return[]},H9e=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},q9e=(t,e,r=1,o={})=>{let a=Number(t),n=Number(e);if(!Number.isInteger(a)||!Number.isInteger(n)){if(o.strictRanges===!0)throw QZ([t,e]);return[]}a===0&&(a=0),n===0&&(n=0);let u=a>n,A=String(t),p=String(e),h=String(r);r=Math.max(Math.abs(r),1);let E=lN(A)||lN(p)||lN(h),w=E?Math.max(A.length,p.length,h.length):0,D=E===!1&&M9e(t,e,o)===!1,b=o.transform||O9e(D);if(o.toRegex&&r===1)return bZ(PZ(t,w),PZ(e,w),!0,o);let C={negatives:[],positives:[]},T=J=>C[J<0?"negatives":"positives"].push(Math.abs(J)),N=[],U=0;for(;u?a>=n:a<=n;)o.toRegex===!0&&r>1?T(a):N.push(U9e(b(a,U),w,D)),a=u?a-r:a+r,U++;return o.toRegex===!0?r>1?_9e(C,o):kZ(N,null,{wrap:!1,...o}):N},j9e=(t,e,r=1,o={})=>{if(!Ww(t)&&t.length>1||!Ww(e)&&e.length>1)return FZ(t,e,o);let a=o.transform||(D=>String.fromCharCode(D)),n=`${t}`.charCodeAt(0),u=`${e}`.charCodeAt(0),A=n>u,p=Math.min(n,u),h=Math.max(n,u);if(o.toRegex&&r===1)return bZ(p,h,!1,o);let E=[],w=0;for(;A?n>=u:n<=u;)E.push(a(n,w)),n=A?n-r:n+r,w++;return o.toRegex===!0?kZ(E,null,{wrap:!1,options:o}):E},uP=(t,e,r,o={})=>{if(e==null&&aN(t))return[t];if(!aN(t)||!aN(e))return FZ(t,e,o);if(typeof r=="function")return uP(t,e,1,{transform:r});if(SZ(r))return uP(t,e,0,r);let a={...o};return a.capture===!0&&(a.wrap=!0),r=r||a.step||1,Ww(r)?Ww(t)&&Ww(e)?q9e(t,e,r,a):j9e(t,e,Math.max(Math.abs(r),1),a):r!=null&&!SZ(r)?H9e(r,a):uP(t,e,1,r)};RZ.exports=uP});var NZ=_((BQt,LZ)=>{"use strict";var G9e=cN(),TZ=lP(),W9e=(t,e={})=>{let r=(o,a={})=>{let n=TZ.isInvalidBrace(a),u=o.invalid===!0&&e.escapeInvalid===!0,A=n===!0||u===!0,p=e.escapeInvalid===!0?"\\":"",h="";if(o.isOpen===!0||o.isClose===!0)return p+o.value;if(o.type==="open")return A?p+o.value:"(";if(o.type==="close")return A?p+o.value:")";if(o.type==="comma")return o.prev.type==="comma"?"":A?o.value:"|";if(o.value)return o.value;if(o.nodes&&o.ranges>0){let E=TZ.reduce(o.nodes),w=G9e(...E,{...e,wrap:!1,toRegex:!0});if(w.length!==0)return E.length>1&&w.length>1?`(${w})`:w}if(o.nodes)for(let E of o.nodes)h+=r(E,o);return h};return r(t)};LZ.exports=W9e});var UZ=_((vQt,MZ)=>{"use strict";var Y9e=cN(),OZ=cP(),Om=lP(),gg=(t="",e="",r=!1)=>{let o=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Om.flatten(e).map(a=>`{${a}}`):e;for(let a of t)if(Array.isArray(a))for(let n of a)o.push(gg(n,e,r));else for(let n of e)r===!0&&typeof n=="string"&&(n=`{${n}}`),o.push(Array.isArray(n)?gg(a,n,r):a+n);return Om.flatten(o)},V9e=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,o=(a,n={})=>{a.queue=[];let u=n,A=n.queue;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,A=u.queue;if(a.invalid||a.dollar){A.push(gg(A.pop(),OZ(a,e)));return}if(a.type==="brace"&&a.invalid!==!0&&a.nodes.length===2){A.push(gg(A.pop(),["{}"]));return}if(a.nodes&&a.ranges>0){let w=Om.reduce(a.nodes);if(Om.exceedsLimit(...w,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let D=Y9e(...w,e);D.length===0&&(D=OZ(a,e)),A.push(gg(A.pop(),D)),a.nodes=[];return}let p=Om.encloseBrace(a),h=a.queue,E=a;for(;E.type!=="brace"&&E.type!=="root"&&E.parent;)E=E.parent,h=E.queue;for(let w=0;w{"use strict";_Z.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` -`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var YZ=_((SQt,WZ)=>{"use strict";var K9e=cP(),{MAX_LENGTH:qZ,CHAR_BACKSLASH:uN,CHAR_BACKTICK:J9e,CHAR_COMMA:z9e,CHAR_DOT:X9e,CHAR_LEFT_PARENTHESES:Z9e,CHAR_RIGHT_PARENTHESES:$9e,CHAR_LEFT_CURLY_BRACE:e7e,CHAR_RIGHT_CURLY_BRACE:t7e,CHAR_LEFT_SQUARE_BRACKET:jZ,CHAR_RIGHT_SQUARE_BRACKET:GZ,CHAR_DOUBLE_QUOTE:r7e,CHAR_SINGLE_QUOTE:n7e,CHAR_NO_BREAK_SPACE:i7e,CHAR_ZERO_WIDTH_NOBREAK_SPACE:s7e}=HZ(),o7e=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},o=typeof r.maxLength=="number"?Math.min(qZ,r.maxLength):qZ;if(t.length>o)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${o})`);let a={type:"root",input:t,nodes:[]},n=[a],u=a,A=a,p=0,h=t.length,E=0,w=0,D,b={},C=()=>t[E++],T=N=>{if(N.type==="text"&&A.type==="dot"&&(A.type="text"),A&&A.type==="text"&&N.type==="text"){A.value+=N.value;return}return u.nodes.push(N),N.parent=u,N.prev=A,A=N,N};for(T({type:"bos"});E0){if(u.ranges>0){u.ranges=0;let N=u.nodes.shift();u.nodes=[N,{type:"text",value:K9e(u)}]}T({type:"comma",value:D}),u.commas++;continue}if(D===X9e&&w>0&&u.commas===0){let N=u.nodes;if(w===0||N.length===0){T({type:"text",value:D});continue}if(A.type==="dot"){if(u.range=[],A.value+=D,A.type="range",u.nodes.length!==3&&u.nodes.length!==5){u.invalid=!0,u.ranges=0,A.type="text";continue}u.ranges++,u.args=[];continue}if(A.type==="range"){N.pop();let U=N[N.length-1];U.value+=A.value+D,A=U,u.ranges--;continue}T({type:"dot",value:D});continue}T({type:"text",value:D})}do if(u=n.pop(),u.type!=="root"){u.nodes.forEach(J=>{J.nodes||(J.type==="open"&&(J.isOpen=!0),J.type==="close"&&(J.isClose=!0),J.nodes||(J.type="text"),J.invalid=!0)});let N=n[n.length-1],U=N.nodes.indexOf(u);N.nodes.splice(U,1,...u.nodes)}while(n.length>0);return T({type:"eos"}),a};WZ.exports=o7e});var JZ=_((PQt,KZ)=>{"use strict";var VZ=cP(),a7e=NZ(),l7e=UZ(),c7e=YZ(),al=(t,e={})=>{let r=[];if(Array.isArray(t))for(let o of t){let a=al.create(o,e);Array.isArray(a)?r.push(...a):r.push(a)}else r=[].concat(al.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};al.parse=(t,e={})=>c7e(t,e);al.stringify=(t,e={})=>VZ(typeof t=="string"?al.parse(t,e):t,e);al.compile=(t,e={})=>(typeof t=="string"&&(t=al.parse(t,e)),a7e(t,e));al.expand=(t,e={})=>{typeof t=="string"&&(t=al.parse(t,e));let r=l7e(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};al.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?al.compile(t,e):al.expand(t,e);KZ.exports=al});var Yw=_((xQt,e$)=>{"use strict";var u7e=ve("path"),zu="\\\\/",zZ=`[^${zu}]`,Bf="\\.",A7e="\\+",f7e="\\?",AP="\\/",p7e="(?=.)",XZ="[^/]",AN=`(?:${AP}|$)`,ZZ=`(?:^|${AP})`,fN=`${Bf}{1,2}${AN}`,h7e=`(?!${Bf})`,g7e=`(?!${ZZ}${fN})`,d7e=`(?!${Bf}{0,1}${AN})`,m7e=`(?!${fN})`,y7e=`[^.${AP}]`,E7e=`${XZ}*?`,$Z={DOT_LITERAL:Bf,PLUS_LITERAL:A7e,QMARK_LITERAL:f7e,SLASH_LITERAL:AP,ONE_CHAR:p7e,QMARK:XZ,END_ANCHOR:AN,DOTS_SLASH:fN,NO_DOT:h7e,NO_DOTS:g7e,NO_DOT_SLASH:d7e,NO_DOTS_SLASH:m7e,QMARK_NO_DOT:y7e,STAR:E7e,START_ANCHOR:ZZ},C7e={...$Z,SLASH_LITERAL:`[${zu}]`,QMARK:zZ,STAR:`${zZ}*?`,DOTS_SLASH:`${Bf}{1,2}(?:[${zu}]|$)`,NO_DOT:`(?!${Bf})`,NO_DOTS:`(?!(?:^|[${zu}])${Bf}{1,2}(?:[${zu}]|$))`,NO_DOT_SLASH:`(?!${Bf}{0,1}(?:[${zu}]|$))`,NO_DOTS_SLASH:`(?!${Bf}{1,2}(?:[${zu}]|$))`,QMARK_NO_DOT:`[^.${zu}]`,START_ANCHOR:`(?:^|[${zu}])`,END_ANCHOR:`(?:[${zu}]|$)`},I7e={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};e$.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:I7e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:u7e.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?C7e:$Z}}});var Vw=_(ba=>{"use strict";var w7e=ve("path"),B7e=process.platform==="win32",{REGEX_BACKSLASH:v7e,REGEX_REMOVE_BACKSLASH:D7e,REGEX_SPECIAL_CHARS:S7e,REGEX_SPECIAL_CHARS_GLOBAL:P7e}=Yw();ba.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ba.hasRegexChars=t=>S7e.test(t);ba.isRegexChar=t=>t.length===1&&ba.hasRegexChars(t);ba.escapeRegex=t=>t.replace(P7e,"\\$1");ba.toPosixSlashes=t=>t.replace(v7e,"/");ba.removeBackslashes=t=>t.replace(D7e,e=>e==="\\"?"":e);ba.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};ba.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:B7e===!0||w7e.sep==="\\";ba.escapeLast=(t,e,r)=>{let o=t.lastIndexOf(e,r);return o===-1?t:t[o-1]==="\\"?ba.escapeLast(t,e,o-1):`${t.slice(0,o)}\\${t.slice(o)}`};ba.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};ba.wrapOutput=(t,e={},r={})=>{let o=r.contains?"":"^",a=r.contains?"":"$",n=`${o}(?:${t})${a}`;return e.negated===!0&&(n=`(?:^(?!${n}).*$)`),n}});var l$=_((kQt,a$)=>{"use strict";var t$=Vw(),{CHAR_ASTERISK:pN,CHAR_AT:x7e,CHAR_BACKWARD_SLASH:Kw,CHAR_COMMA:b7e,CHAR_DOT:hN,CHAR_EXCLAMATION_MARK:gN,CHAR_FORWARD_SLASH:o$,CHAR_LEFT_CURLY_BRACE:dN,CHAR_LEFT_PARENTHESES:mN,CHAR_LEFT_SQUARE_BRACKET:k7e,CHAR_PLUS:Q7e,CHAR_QUESTION_MARK:r$,CHAR_RIGHT_CURLY_BRACE:F7e,CHAR_RIGHT_PARENTHESES:n$,CHAR_RIGHT_SQUARE_BRACKET:R7e}=Yw(),i$=t=>t===o$||t===Kw,s$=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},T7e=(t,e)=>{let r=e||{},o=t.length-1,a=r.parts===!0||r.scanToEnd===!0,n=[],u=[],A=[],p=t,h=-1,E=0,w=0,D=!1,b=!1,C=!1,T=!1,N=!1,U=!1,J=!1,te=!1,le=!1,ce=!1,ue=0,Ie,he,De={value:"",depth:0,isGlob:!1},Ee=()=>h>=o,g=()=>p.charCodeAt(h+1),me=()=>(Ie=he,p.charCodeAt(++h));for(;h0&&(fe=p.slice(0,E),p=p.slice(E),w-=E),Ce&&C===!0&&w>0?(Ce=p.slice(0,w),ie=p.slice(w)):C===!0?(Ce="",ie=p):Ce=p,Ce&&Ce!==""&&Ce!=="/"&&Ce!==p&&i$(Ce.charCodeAt(Ce.length-1))&&(Ce=Ce.slice(0,-1)),r.unescape===!0&&(ie&&(ie=t$.removeBackslashes(ie)),Ce&&J===!0&&(Ce=t$.removeBackslashes(Ce)));let Z={prefix:fe,input:t,start:E,base:Ce,glob:ie,isBrace:D,isBracket:b,isGlob:C,isExtglob:T,isGlobstar:N,negated:te,negatedExtglob:le};if(r.tokens===!0&&(Z.maxDepth=0,i$(he)||u.push(De),Z.tokens=u),r.parts===!0||r.tokens===!0){let Se;for(let Re=0;Re{"use strict";var fP=Yw(),ll=Vw(),{MAX_LENGTH:pP,POSIX_REGEX_SOURCE:L7e,REGEX_NON_SPECIAL_CHARS:N7e,REGEX_SPECIAL_CHARS_BACKREF:O7e,REPLACEMENTS:c$}=fP,M7e=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(a=>ll.escapeRegex(a)).join("..")}return r},Mm=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,yN=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=c$[t]||t;let r={...e},o=typeof r.maxLength=="number"?Math.min(pP,r.maxLength):pP,a=t.length;if(a>o)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${o}`);let n={type:"bos",value:"",output:r.prepend||""},u=[n],A=r.capture?"":"?:",p=ll.isWindows(e),h=fP.globChars(p),E=fP.extglobChars(h),{DOT_LITERAL:w,PLUS_LITERAL:D,SLASH_LITERAL:b,ONE_CHAR:C,DOTS_SLASH:T,NO_DOT:N,NO_DOT_SLASH:U,NO_DOTS_SLASH:J,QMARK:te,QMARK_NO_DOT:le,STAR:ce,START_ANCHOR:ue}=h,Ie=x=>`(${A}(?:(?!${ue}${x.dot?T:w}).)*?)`,he=r.dot?"":N,De=r.dot?te:le,Ee=r.bash===!0?Ie(r):ce;r.capture&&(Ee=`(${Ee})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let g={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:u};t=ll.removePrefix(t,g),a=t.length;let me=[],Ce=[],fe=[],ie=n,Z,Se=()=>g.index===a-1,Re=g.peek=(x=1)=>t[g.index+x],ht=g.advance=()=>t[++g.index]||"",q=()=>t.slice(g.index+1),nt=(x="",I=0)=>{g.consumed+=x,g.index+=I},Le=x=>{g.output+=x.output!=null?x.output:x.value,nt(x.value)},Te=()=>{let x=1;for(;Re()==="!"&&(Re(2)!=="("||Re(3)==="?");)ht(),g.start++,x++;return x%2===0?!1:(g.negated=!0,g.start++,!0)},ke=x=>{g[x]++,fe.push(x)},Ke=x=>{g[x]--,fe.pop()},xe=x=>{if(ie.type==="globstar"){let I=g.braces>0&&(x.type==="comma"||x.type==="brace"),P=x.extglob===!0||me.length&&(x.type==="pipe"||x.type==="paren");x.type!=="slash"&&x.type!=="paren"&&!I&&!P&&(g.output=g.output.slice(0,-ie.output.length),ie.type="star",ie.value="*",ie.output=Ee,g.output+=ie.output)}if(me.length&&x.type!=="paren"&&(me[me.length-1].inner+=x.value),(x.value||x.output)&&Le(x),ie&&ie.type==="text"&&x.type==="text"){ie.value+=x.value,ie.output=(ie.output||"")+x.value;return}x.prev=ie,u.push(x),ie=x},tt=(x,I)=>{let P={...E[I],conditions:1,inner:""};P.prev=ie,P.parens=g.parens,P.output=g.output;let y=(r.capture?"(":"")+P.open;ke("parens"),xe({type:x,value:I,output:g.output?"":C}),xe({type:"paren",extglob:!0,value:ht(),output:y}),me.push(P)},He=x=>{let I=x.close+(r.capture?")":""),P;if(x.type==="negate"){let y=Ee;if(x.inner&&x.inner.length>1&&x.inner.includes("/")&&(y=Ie(r)),(y!==Ee||Se()||/^\)+$/.test(q()))&&(I=x.close=`)$))${y}`),x.inner.includes("*")&&(P=q())&&/^\.[^\\/.]+$/.test(P)){let R=yN(P,{...e,fastpaths:!1}).output;I=x.close=`)${R})${y})`}x.prev.type==="bos"&&(g.negatedExtglob=!0)}xe({type:"paren",extglob:!0,value:Z,output:I}),Ke("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let x=!1,I=t.replace(O7e,(P,y,R,z,X,$)=>z==="\\"?(x=!0,P):z==="?"?y?y+z+(X?te.repeat(X.length):""):$===0?De+(X?te.repeat(X.length):""):te.repeat(R.length):z==="."?w.repeat(R.length):z==="*"?y?y+z+(X?Ee:""):Ee:y?P:`\\${P}`);return x===!0&&(r.unescape===!0?I=I.replace(/\\/g,""):I=I.replace(/\\+/g,P=>P.length%2===0?"\\\\":P?"\\":"")),I===t&&r.contains===!0?(g.output=t,g):(g.output=ll.wrapOutput(I,g,e),g)}for(;!Se();){if(Z=ht(),Z==="\0")continue;if(Z==="\\"){let P=Re();if(P==="/"&&r.bash!==!0||P==="."||P===";")continue;if(!P){Z+="\\",xe({type:"text",value:Z});continue}let y=/^\\+/.exec(q()),R=0;if(y&&y[0].length>2&&(R=y[0].length,g.index+=R,R%2!==0&&(Z+="\\")),r.unescape===!0?Z=ht():Z+=ht(),g.brackets===0){xe({type:"text",value:Z});continue}}if(g.brackets>0&&(Z!=="]"||ie.value==="["||ie.value==="[^")){if(r.posix!==!1&&Z===":"){let P=ie.value.slice(1);if(P.includes("[")&&(ie.posix=!0,P.includes(":"))){let y=ie.value.lastIndexOf("["),R=ie.value.slice(0,y),z=ie.value.slice(y+2),X=L7e[z];if(X){ie.value=R+X,g.backtrack=!0,ht(),!n.output&&u.indexOf(ie)===1&&(n.output=C);continue}}}(Z==="["&&Re()!==":"||Z==="-"&&Re()==="]")&&(Z=`\\${Z}`),Z==="]"&&(ie.value==="["||ie.value==="[^")&&(Z=`\\${Z}`),r.posix===!0&&Z==="!"&&ie.value==="["&&(Z="^"),ie.value+=Z,Le({value:Z});continue}if(g.quotes===1&&Z!=='"'){Z=ll.escapeRegex(Z),ie.value+=Z,Le({value:Z});continue}if(Z==='"'){g.quotes=g.quotes===1?0:1,r.keepQuotes===!0&&xe({type:"text",value:Z});continue}if(Z==="("){ke("parens"),xe({type:"paren",value:Z});continue}if(Z===")"){if(g.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Mm("opening","("));let P=me[me.length-1];if(P&&g.parens===P.parens+1){He(me.pop());continue}xe({type:"paren",value:Z,output:g.parens?")":"\\)"}),Ke("parens");continue}if(Z==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Mm("closing","]"));Z=`\\${Z}`}else ke("brackets");xe({type:"bracket",value:Z});continue}if(Z==="]"){if(r.nobracket===!0||ie&&ie.type==="bracket"&&ie.value.length===1){xe({type:"text",value:Z,output:`\\${Z}`});continue}if(g.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Mm("opening","["));xe({type:"text",value:Z,output:`\\${Z}`});continue}Ke("brackets");let P=ie.value.slice(1);if(ie.posix!==!0&&P[0]==="^"&&!P.includes("/")&&(Z=`/${Z}`),ie.value+=Z,Le({value:Z}),r.literalBrackets===!1||ll.hasRegexChars(P))continue;let y=ll.escapeRegex(ie.value);if(g.output=g.output.slice(0,-ie.value.length),r.literalBrackets===!0){g.output+=y,ie.value=y;continue}ie.value=`(${A}${y}|${ie.value})`,g.output+=ie.value;continue}if(Z==="{"&&r.nobrace!==!0){ke("braces");let P={type:"brace",value:Z,output:"(",outputIndex:g.output.length,tokensIndex:g.tokens.length};Ce.push(P),xe(P);continue}if(Z==="}"){let P=Ce[Ce.length-1];if(r.nobrace===!0||!P){xe({type:"text",value:Z,output:Z});continue}let y=")";if(P.dots===!0){let R=u.slice(),z=[];for(let X=R.length-1;X>=0&&(u.pop(),R[X].type!=="brace");X--)R[X].type!=="dots"&&z.unshift(R[X].value);y=M7e(z,r),g.backtrack=!0}if(P.comma!==!0&&P.dots!==!0){let R=g.output.slice(0,P.outputIndex),z=g.tokens.slice(P.tokensIndex);P.value=P.output="\\{",Z=y="\\}",g.output=R;for(let X of z)g.output+=X.output||X.value}xe({type:"brace",value:Z,output:y}),Ke("braces"),Ce.pop();continue}if(Z==="|"){me.length>0&&me[me.length-1].conditions++,xe({type:"text",value:Z});continue}if(Z===","){let P=Z,y=Ce[Ce.length-1];y&&fe[fe.length-1]==="braces"&&(y.comma=!0,P="|"),xe({type:"comma",value:Z,output:P});continue}if(Z==="/"){if(ie.type==="dot"&&g.index===g.start+1){g.start=g.index+1,g.consumed="",g.output="",u.pop(),ie=n;continue}xe({type:"slash",value:Z,output:b});continue}if(Z==="."){if(g.braces>0&&ie.type==="dot"){ie.value==="."&&(ie.output=w);let P=Ce[Ce.length-1];ie.type="dots",ie.output+=Z,ie.value+=Z,P.dots=!0;continue}if(g.braces+g.parens===0&&ie.type!=="bos"&&ie.type!=="slash"){xe({type:"text",value:Z,output:w});continue}xe({type:"dot",value:Z,output:w});continue}if(Z==="?"){if(!(ie&&ie.value==="(")&&r.noextglob!==!0&&Re()==="("&&Re(2)!=="?"){tt("qmark",Z);continue}if(ie&&ie.type==="paren"){let y=Re(),R=Z;if(y==="<"&&!ll.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(ie.value==="("&&!/[!=<:]/.test(y)||y==="<"&&!/<([!=]|\w+>)/.test(q()))&&(R=`\\${Z}`),xe({type:"text",value:Z,output:R});continue}if(r.dot!==!0&&(ie.type==="slash"||ie.type==="bos")){xe({type:"qmark",value:Z,output:le});continue}xe({type:"qmark",value:Z,output:te});continue}if(Z==="!"){if(r.noextglob!==!0&&Re()==="("&&(Re(2)!=="?"||!/[!=<:]/.test(Re(3)))){tt("negate",Z);continue}if(r.nonegate!==!0&&g.index===0){Te();continue}}if(Z==="+"){if(r.noextglob!==!0&&Re()==="("&&Re(2)!=="?"){tt("plus",Z);continue}if(ie&&ie.value==="("||r.regex===!1){xe({type:"plus",value:Z,output:D});continue}if(ie&&(ie.type==="bracket"||ie.type==="paren"||ie.type==="brace")||g.parens>0){xe({type:"plus",value:Z});continue}xe({type:"plus",value:D});continue}if(Z==="@"){if(r.noextglob!==!0&&Re()==="("&&Re(2)!=="?"){xe({type:"at",extglob:!0,value:Z,output:""});continue}xe({type:"text",value:Z});continue}if(Z!=="*"){(Z==="$"||Z==="^")&&(Z=`\\${Z}`);let P=N7e.exec(q());P&&(Z+=P[0],g.index+=P[0].length),xe({type:"text",value:Z});continue}if(ie&&(ie.type==="globstar"||ie.star===!0)){ie.type="star",ie.star=!0,ie.value+=Z,ie.output=Ee,g.backtrack=!0,g.globstar=!0,nt(Z);continue}let x=q();if(r.noextglob!==!0&&/^\([^?]/.test(x)){tt("star",Z);continue}if(ie.type==="star"){if(r.noglobstar===!0){nt(Z);continue}let P=ie.prev,y=P.prev,R=P.type==="slash"||P.type==="bos",z=y&&(y.type==="star"||y.type==="globstar");if(r.bash===!0&&(!R||x[0]&&x[0]!=="/")){xe({type:"star",value:Z,output:""});continue}let X=g.braces>0&&(P.type==="comma"||P.type==="brace"),$=me.length&&(P.type==="pipe"||P.type==="paren");if(!R&&P.type!=="paren"&&!X&&!$){xe({type:"star",value:Z,output:""});continue}for(;x.slice(0,3)==="/**";){let se=t[g.index+4];if(se&&se!=="/")break;x=x.slice(3),nt("/**",3)}if(P.type==="bos"&&Se()){ie.type="globstar",ie.value+=Z,ie.output=Ie(r),g.output=ie.output,g.globstar=!0,nt(Z);continue}if(P.type==="slash"&&P.prev.type!=="bos"&&!z&&Se()){g.output=g.output.slice(0,-(P.output+ie.output).length),P.output=`(?:${P.output}`,ie.type="globstar",ie.output=Ie(r)+(r.strictSlashes?")":"|$)"),ie.value+=Z,g.globstar=!0,g.output+=P.output+ie.output,nt(Z);continue}if(P.type==="slash"&&P.prev.type!=="bos"&&x[0]==="/"){let se=x[1]!==void 0?"|$":"";g.output=g.output.slice(0,-(P.output+ie.output).length),P.output=`(?:${P.output}`,ie.type="globstar",ie.output=`${Ie(r)}${b}|${b}${se})`,ie.value+=Z,g.output+=P.output+ie.output,g.globstar=!0,nt(Z+ht()),xe({type:"slash",value:"/",output:""});continue}if(P.type==="bos"&&x[0]==="/"){ie.type="globstar",ie.value+=Z,ie.output=`(?:^|${b}|${Ie(r)}${b})`,g.output=ie.output,g.globstar=!0,nt(Z+ht()),xe({type:"slash",value:"/",output:""});continue}g.output=g.output.slice(0,-ie.output.length),ie.type="globstar",ie.output=Ie(r),ie.value+=Z,g.output+=ie.output,g.globstar=!0,nt(Z);continue}let I={type:"star",value:Z,output:Ee};if(r.bash===!0){I.output=".*?",(ie.type==="bos"||ie.type==="slash")&&(I.output=he+I.output),xe(I);continue}if(ie&&(ie.type==="bracket"||ie.type==="paren")&&r.regex===!0){I.output=Z,xe(I);continue}(g.index===g.start||ie.type==="slash"||ie.type==="dot")&&(ie.type==="dot"?(g.output+=U,ie.output+=U):r.dot===!0?(g.output+=J,ie.output+=J):(g.output+=he,ie.output+=he),Re()!=="*"&&(g.output+=C,ie.output+=C)),xe(I)}for(;g.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Mm("closing","]"));g.output=ll.escapeLast(g.output,"["),Ke("brackets")}for(;g.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Mm("closing",")"));g.output=ll.escapeLast(g.output,"("),Ke("parens")}for(;g.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Mm("closing","}"));g.output=ll.escapeLast(g.output,"{"),Ke("braces")}if(r.strictSlashes!==!0&&(ie.type==="star"||ie.type==="bracket")&&xe({type:"maybe_slash",value:"",output:`${b}?`}),g.backtrack===!0){g.output="";for(let x of g.tokens)g.output+=x.output!=null?x.output:x.value,x.suffix&&(g.output+=x.suffix)}return g};yN.fastpaths=(t,e)=>{let r={...e},o=typeof r.maxLength=="number"?Math.min(pP,r.maxLength):pP,a=t.length;if(a>o)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${o}`);t=c$[t]||t;let n=ll.isWindows(e),{DOT_LITERAL:u,SLASH_LITERAL:A,ONE_CHAR:p,DOTS_SLASH:h,NO_DOT:E,NO_DOTS:w,NO_DOTS_SLASH:D,STAR:b,START_ANCHOR:C}=fP.globChars(n),T=r.dot?w:E,N=r.dot?D:E,U=r.capture?"":"?:",J={negated:!1,prefix:""},te=r.bash===!0?".*?":b;r.capture&&(te=`(${te})`);let le=he=>he.noglobstar===!0?te:`(${U}(?:(?!${C}${he.dot?h:u}).)*?)`,ce=he=>{switch(he){case"*":return`${T}${p}${te}`;case".*":return`${u}${p}${te}`;case"*.*":return`${T}${te}${u}${p}${te}`;case"*/*":return`${T}${te}${A}${p}${N}${te}`;case"**":return T+le(r);case"**/*":return`(?:${T}${le(r)}${A})?${N}${p}${te}`;case"**/*.*":return`(?:${T}${le(r)}${A})?${N}${te}${u}${p}${te}`;case"**/.*":return`(?:${T}${le(r)}${A})?${u}${p}${te}`;default:{let De=/^(.*?)\.(\w+)$/.exec(he);if(!De)return;let Ee=ce(De[1]);return Ee?Ee+u+De[2]:void 0}}},ue=ll.removePrefix(t,J),Ie=ce(ue);return Ie&&r.strictSlashes!==!0&&(Ie+=`${A}?`),Ie};u$.exports=yN});var p$=_((FQt,f$)=>{"use strict";var U7e=ve("path"),_7e=l$(),EN=A$(),CN=Vw(),H7e=Yw(),q7e=t=>t&&typeof t=="object"&&!Array.isArray(t),Mi=(t,e,r=!1)=>{if(Array.isArray(t)){let E=t.map(D=>Mi(D,e,r));return D=>{for(let b of E){let C=b(D);if(C)return C}return!1}}let o=q7e(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!o)throw new TypeError("Expected pattern to be a non-empty string");let a=e||{},n=CN.isWindows(e),u=o?Mi.compileRe(t,e):Mi.makeRe(t,e,!1,!0),A=u.state;delete u.state;let p=()=>!1;if(a.ignore){let E={...e,ignore:null,onMatch:null,onResult:null};p=Mi(a.ignore,E,r)}let h=(E,w=!1)=>{let{isMatch:D,match:b,output:C}=Mi.test(E,u,e,{glob:t,posix:n}),T={glob:t,state:A,regex:u,posix:n,input:E,output:C,match:b,isMatch:D};return typeof a.onResult=="function"&&a.onResult(T),D===!1?(T.isMatch=!1,w?T:!1):p(E)?(typeof a.onIgnore=="function"&&a.onIgnore(T),T.isMatch=!1,w?T:!1):(typeof a.onMatch=="function"&&a.onMatch(T),w?T:!0)};return r&&(h.state=A),h};Mi.test=(t,e,r,{glob:o,posix:a}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let n=r||{},u=n.format||(a?CN.toPosixSlashes:null),A=t===o,p=A&&u?u(t):t;return A===!1&&(p=u?u(t):t,A=p===o),(A===!1||n.capture===!0)&&(n.matchBase===!0||n.basename===!0?A=Mi.matchBase(t,e,r,a):A=e.exec(p)),{isMatch:!!A,match:A,output:p}};Mi.matchBase=(t,e,r,o=CN.isWindows(r))=>(e instanceof RegExp?e:Mi.makeRe(e,r)).test(U7e.basename(t));Mi.isMatch=(t,e,r)=>Mi(e,r)(t);Mi.parse=(t,e)=>Array.isArray(t)?t.map(r=>Mi.parse(r,e)):EN(t,{...e,fastpaths:!1});Mi.scan=(t,e)=>_7e(t,e);Mi.compileRe=(t,e,r=!1,o=!1)=>{if(r===!0)return t.output;let a=e||{},n=a.contains?"":"^",u=a.contains?"":"$",A=`${n}(?:${t.output})${u}`;t&&t.negated===!0&&(A=`^(?!${A}).*$`);let p=Mi.toRegex(A,e);return o===!0&&(p.state=t),p};Mi.makeRe=(t,e={},r=!1,o=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(a.output=EN.fastpaths(t,e)),a.output||(a=EN(t,e)),Mi.compileRe(a,e,r,o)};Mi.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Mi.constants=H7e;f$.exports=Mi});var g$=_((RQt,h$)=>{"use strict";h$.exports=p$()});var Xo=_((TQt,E$)=>{"use strict";var m$=ve("util"),y$=JZ(),Xu=g$(),IN=Vw(),d$=t=>t===""||t==="./",Ii=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let o=new Set,a=new Set,n=new Set,u=0,A=E=>{n.add(E.output),r&&r.onResult&&r.onResult(E)};for(let E=0;E!o.has(E));if(r&&h.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(E=>E.replace(/\\/g,"")):e}return h};Ii.match=Ii;Ii.matcher=(t,e)=>Xu(t,e);Ii.isMatch=(t,e,r)=>Xu(e,r)(t);Ii.any=Ii.isMatch;Ii.not=(t,e,r={})=>{e=[].concat(e).map(String);let o=new Set,a=[],n=A=>{r.onResult&&r.onResult(A),a.push(A.output)},u=new Set(Ii(t,e,{...r,onResult:n}));for(let A of a)u.has(A)||o.add(A);return[...o]};Ii.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${m$.inspect(t)}"`);if(Array.isArray(e))return e.some(o=>Ii.contains(t,o,r));if(typeof e=="string"){if(d$(t)||d$(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Ii.isMatch(t,e,{...r,contains:!0})};Ii.matchKeys=(t,e,r)=>{if(!IN.isObject(t))throw new TypeError("Expected the first argument to be an object");let o=Ii(Object.keys(t),e,r),a={};for(let n of o)a[n]=t[n];return a};Ii.some=(t,e,r)=>{let o=[].concat(t);for(let a of[].concat(e)){let n=Xu(String(a),r);if(o.some(u=>n(u)))return!0}return!1};Ii.every=(t,e,r)=>{let o=[].concat(t);for(let a of[].concat(e)){let n=Xu(String(a),r);if(!o.every(u=>n(u)))return!1}return!0};Ii.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${m$.inspect(t)}"`);return[].concat(e).every(o=>Xu(o,r)(t))};Ii.capture=(t,e,r)=>{let o=IN.isWindows(r),n=Xu.makeRe(String(t),{...r,capture:!0}).exec(o?IN.toPosixSlashes(e):e);if(n)return n.slice(1).map(u=>u===void 0?"":u)};Ii.makeRe=(...t)=>Xu.makeRe(...t);Ii.scan=(...t)=>Xu.scan(...t);Ii.parse=(t,e)=>{let r=[];for(let o of[].concat(t||[]))for(let a of y$(String(o),e))r.push(Xu.parse(a,e));return r};Ii.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(t)?[t]:y$(t,e)};Ii.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Ii.braces(t,{...e,expand:!0})};E$.exports=Ii});var I$=_((LQt,C$)=>{"use strict";C$.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var hP=_((NQt,w$)=>{"use strict";var j7e=I$();w$.exports=t=>typeof t=="string"?t.replace(j7e(),""):t});var v$=_((OQt,B$)=>{function G7e(){this.__data__=[],this.size=0}B$.exports=G7e});var Um=_((MQt,D$)=>{function W7e(t,e){return t===e||t!==t&&e!==e}D$.exports=W7e});var Jw=_((UQt,S$)=>{var Y7e=Um();function V7e(t,e){for(var r=t.length;r--;)if(Y7e(t[r][0],e))return r;return-1}S$.exports=V7e});var x$=_((_Qt,P$)=>{var K7e=Jw(),J7e=Array.prototype,z7e=J7e.splice;function X7e(t){var e=this.__data__,r=K7e(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():z7e.call(e,r,1),--this.size,!0}P$.exports=X7e});var k$=_((HQt,b$)=>{var Z7e=Jw();function $7e(t){var e=this.__data__,r=Z7e(e,t);return r<0?void 0:e[r][1]}b$.exports=$7e});var F$=_((qQt,Q$)=>{var eWe=Jw();function tWe(t){return eWe(this.__data__,t)>-1}Q$.exports=tWe});var T$=_((jQt,R$)=>{var rWe=Jw();function nWe(t,e){var r=this.__data__,o=rWe(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}R$.exports=nWe});var zw=_((GQt,L$)=>{var iWe=v$(),sWe=x$(),oWe=k$(),aWe=F$(),lWe=T$();function _m(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var cWe=zw();function uWe(){this.__data__=new cWe,this.size=0}N$.exports=uWe});var U$=_((YQt,M$)=>{function AWe(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}M$.exports=AWe});var H$=_((VQt,_$)=>{function fWe(t){return this.__data__.get(t)}_$.exports=fWe});var j$=_((KQt,q$)=>{function pWe(t){return this.__data__.has(t)}q$.exports=pWe});var wN=_((JQt,G$)=>{var hWe=typeof global=="object"&&global&&global.Object===Object&&global;G$.exports=hWe});var ql=_((zQt,W$)=>{var gWe=wN(),dWe=typeof self=="object"&&self&&self.Object===Object&&self,mWe=gWe||dWe||Function("return this")();W$.exports=mWe});var dg=_((XQt,Y$)=>{var yWe=ql(),EWe=yWe.Symbol;Y$.exports=EWe});var z$=_((ZQt,J$)=>{var V$=dg(),K$=Object.prototype,CWe=K$.hasOwnProperty,IWe=K$.toString,Xw=V$?V$.toStringTag:void 0;function wWe(t){var e=CWe.call(t,Xw),r=t[Xw];try{t[Xw]=void 0;var o=!0}catch{}var a=IWe.call(t);return o&&(e?t[Xw]=r:delete t[Xw]),a}J$.exports=wWe});var Z$=_(($Qt,X$)=>{var BWe=Object.prototype,vWe=BWe.toString;function DWe(t){return vWe.call(t)}X$.exports=DWe});var mg=_((eFt,tee)=>{var $$=dg(),SWe=z$(),PWe=Z$(),xWe="[object Null]",bWe="[object Undefined]",eee=$$?$$.toStringTag:void 0;function kWe(t){return t==null?t===void 0?bWe:xWe:eee&&eee in Object(t)?SWe(t):PWe(t)}tee.exports=kWe});var cl=_((tFt,ree)=>{function QWe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}ree.exports=QWe});var gP=_((rFt,nee)=>{var FWe=mg(),RWe=cl(),TWe="[object AsyncFunction]",LWe="[object Function]",NWe="[object GeneratorFunction]",OWe="[object Proxy]";function MWe(t){if(!RWe(t))return!1;var e=FWe(t);return e==LWe||e==NWe||e==TWe||e==OWe}nee.exports=MWe});var see=_((nFt,iee)=>{var UWe=ql(),_We=UWe["__core-js_shared__"];iee.exports=_We});var lee=_((iFt,aee)=>{var BN=see(),oee=function(){var t=/[^.]+$/.exec(BN&&BN.keys&&BN.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function HWe(t){return!!oee&&oee in t}aee.exports=HWe});var vN=_((sFt,cee)=>{var qWe=Function.prototype,jWe=qWe.toString;function GWe(t){if(t!=null){try{return jWe.call(t)}catch{}try{return t+""}catch{}}return""}cee.exports=GWe});var Aee=_((oFt,uee)=>{var WWe=gP(),YWe=lee(),VWe=cl(),KWe=vN(),JWe=/[\\^$.*+?()[\]{}|]/g,zWe=/^\[object .+?Constructor\]$/,XWe=Function.prototype,ZWe=Object.prototype,$We=XWe.toString,eYe=ZWe.hasOwnProperty,tYe=RegExp("^"+$We.call(eYe).replace(JWe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function rYe(t){if(!VWe(t)||YWe(t))return!1;var e=WWe(t)?tYe:zWe;return e.test(KWe(t))}uee.exports=rYe});var pee=_((aFt,fee)=>{function nYe(t,e){return t?.[e]}fee.exports=nYe});var $p=_((lFt,hee)=>{var iYe=Aee(),sYe=pee();function oYe(t,e){var r=sYe(t,e);return iYe(r)?r:void 0}hee.exports=oYe});var dP=_((cFt,gee)=>{var aYe=$p(),lYe=ql(),cYe=aYe(lYe,"Map");gee.exports=cYe});var Zw=_((uFt,dee)=>{var uYe=$p(),AYe=uYe(Object,"create");dee.exports=AYe});var Eee=_((AFt,yee)=>{var mee=Zw();function fYe(){this.__data__=mee?mee(null):{},this.size=0}yee.exports=fYe});var Iee=_((fFt,Cee)=>{function pYe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}Cee.exports=pYe});var Bee=_((pFt,wee)=>{var hYe=Zw(),gYe="__lodash_hash_undefined__",dYe=Object.prototype,mYe=dYe.hasOwnProperty;function yYe(t){var e=this.__data__;if(hYe){var r=e[t];return r===gYe?void 0:r}return mYe.call(e,t)?e[t]:void 0}wee.exports=yYe});var Dee=_((hFt,vee)=>{var EYe=Zw(),CYe=Object.prototype,IYe=CYe.hasOwnProperty;function wYe(t){var e=this.__data__;return EYe?e[t]!==void 0:IYe.call(e,t)}vee.exports=wYe});var Pee=_((gFt,See)=>{var BYe=Zw(),vYe="__lodash_hash_undefined__";function DYe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=BYe&&e===void 0?vYe:e,this}See.exports=DYe});var bee=_((dFt,xee)=>{var SYe=Eee(),PYe=Iee(),xYe=Bee(),bYe=Dee(),kYe=Pee();function Hm(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var kee=bee(),QYe=zw(),FYe=dP();function RYe(){this.size=0,this.__data__={hash:new kee,map:new(FYe||QYe),string:new kee}}Qee.exports=RYe});var Tee=_((yFt,Ree)=>{function TYe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}Ree.exports=TYe});var $w=_((EFt,Lee)=>{var LYe=Tee();function NYe(t,e){var r=t.__data__;return LYe(e)?r[typeof e=="string"?"string":"hash"]:r.map}Lee.exports=NYe});var Oee=_((CFt,Nee)=>{var OYe=$w();function MYe(t){var e=OYe(this,t).delete(t);return this.size-=e?1:0,e}Nee.exports=MYe});var Uee=_((IFt,Mee)=>{var UYe=$w();function _Ye(t){return UYe(this,t).get(t)}Mee.exports=_Ye});var Hee=_((wFt,_ee)=>{var HYe=$w();function qYe(t){return HYe(this,t).has(t)}_ee.exports=qYe});var jee=_((BFt,qee)=>{var jYe=$w();function GYe(t,e){var r=jYe(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}qee.exports=GYe});var mP=_((vFt,Gee)=>{var WYe=Fee(),YYe=Oee(),VYe=Uee(),KYe=Hee(),JYe=jee();function qm(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var zYe=zw(),XYe=dP(),ZYe=mP(),$Ye=200;function eVe(t,e){var r=this.__data__;if(r instanceof zYe){var o=r.__data__;if(!XYe||o.length<$Ye-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ZYe(o)}return r.set(t,e),this.size=r.size,this}Wee.exports=eVe});var yP=_((SFt,Vee)=>{var tVe=zw(),rVe=O$(),nVe=U$(),iVe=H$(),sVe=j$(),oVe=Yee();function jm(t){var e=this.__data__=new tVe(t);this.size=e.size}jm.prototype.clear=rVe;jm.prototype.delete=nVe;jm.prototype.get=iVe;jm.prototype.has=sVe;jm.prototype.set=oVe;Vee.exports=jm});var Jee=_((PFt,Kee)=>{var aVe="__lodash_hash_undefined__";function lVe(t){return this.__data__.set(t,aVe),this}Kee.exports=lVe});var Xee=_((xFt,zee)=>{function cVe(t){return this.__data__.has(t)}zee.exports=cVe});var $ee=_((bFt,Zee)=>{var uVe=mP(),AVe=Jee(),fVe=Xee();function EP(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new uVe;++e{function pVe(t,e){for(var r=-1,o=t==null?0:t.length;++r{function hVe(t,e){return t.has(e)}rte.exports=hVe});var DN=_((FFt,ite)=>{var gVe=$ee(),dVe=tte(),mVe=nte(),yVe=1,EVe=2;function CVe(t,e,r,o,a,n){var u=r&yVe,A=t.length,p=e.length;if(A!=p&&!(u&&p>A))return!1;var h=n.get(t),E=n.get(e);if(h&&E)return h==e&&E==t;var w=-1,D=!0,b=r&EVe?new gVe:void 0;for(n.set(t,e),n.set(e,t);++w{var IVe=ql(),wVe=IVe.Uint8Array;ste.exports=wVe});var ate=_((TFt,ote)=>{function BVe(t){var e=-1,r=Array(t.size);return t.forEach(function(o,a){r[++e]=[a,o]}),r}ote.exports=BVe});var cte=_((LFt,lte)=>{function vVe(t){var e=-1,r=Array(t.size);return t.forEach(function(o){r[++e]=o}),r}lte.exports=vVe});var hte=_((NFt,pte)=>{var ute=dg(),Ate=SN(),DVe=Um(),SVe=DN(),PVe=ate(),xVe=cte(),bVe=1,kVe=2,QVe="[object Boolean]",FVe="[object Date]",RVe="[object Error]",TVe="[object Map]",LVe="[object Number]",NVe="[object RegExp]",OVe="[object Set]",MVe="[object String]",UVe="[object Symbol]",_Ve="[object ArrayBuffer]",HVe="[object DataView]",fte=ute?ute.prototype:void 0,PN=fte?fte.valueOf:void 0;function qVe(t,e,r,o,a,n,u){switch(r){case HVe:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case _Ve:return!(t.byteLength!=e.byteLength||!n(new Ate(t),new Ate(e)));case QVe:case FVe:case LVe:return DVe(+t,+e);case RVe:return t.name==e.name&&t.message==e.message;case NVe:case MVe:return t==e+"";case TVe:var A=PVe;case OVe:var p=o&bVe;if(A||(A=xVe),t.size!=e.size&&!p)return!1;var h=u.get(t);if(h)return h==e;o|=kVe,u.set(t,e);var E=SVe(A(t),A(e),o,a,n,u);return u.delete(t),E;case UVe:if(PN)return PN.call(t)==PN.call(e)}return!1}pte.exports=qVe});var CP=_((OFt,gte)=>{function jVe(t,e){for(var r=-1,o=e.length,a=t.length;++r{var GVe=Array.isArray;dte.exports=GVe});var xN=_((UFt,mte)=>{var WVe=CP(),YVe=jl();function VVe(t,e,r){var o=e(t);return YVe(t)?o:WVe(o,r(t))}mte.exports=VVe});var Ete=_((_Ft,yte)=>{function KVe(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r{function JVe(){return[]}Cte.exports=JVe});var IP=_((qFt,wte)=>{var zVe=Ete(),XVe=bN(),ZVe=Object.prototype,$Ve=ZVe.propertyIsEnumerable,Ite=Object.getOwnPropertySymbols,eKe=Ite?function(t){return t==null?[]:(t=Object(t),zVe(Ite(t),function(e){return $Ve.call(t,e)}))}:XVe;wte.exports=eKe});var vte=_((jFt,Bte)=>{function tKe(t,e){for(var r=-1,o=Array(t);++r{function rKe(t){return t!=null&&typeof t=="object"}Dte.exports=rKe});var Pte=_((WFt,Ste)=>{var nKe=mg(),iKe=Zu(),sKe="[object Arguments]";function oKe(t){return iKe(t)&&nKe(t)==sKe}Ste.exports=oKe});var e1=_((YFt,kte)=>{var xte=Pte(),aKe=Zu(),bte=Object.prototype,lKe=bte.hasOwnProperty,cKe=bte.propertyIsEnumerable,uKe=xte(function(){return arguments}())?xte:function(t){return aKe(t)&&lKe.call(t,"callee")&&!cKe.call(t,"callee")};kte.exports=uKe});var Fte=_((VFt,Qte)=>{function AKe(){return!1}Qte.exports=AKe});var r1=_((t1,Gm)=>{var fKe=ql(),pKe=Fte(),Lte=typeof t1=="object"&&t1&&!t1.nodeType&&t1,Rte=Lte&&typeof Gm=="object"&&Gm&&!Gm.nodeType&&Gm,hKe=Rte&&Rte.exports===Lte,Tte=hKe?fKe.Buffer:void 0,gKe=Tte?Tte.isBuffer:void 0,dKe=gKe||pKe;Gm.exports=dKe});var n1=_((KFt,Nte)=>{var mKe=9007199254740991,yKe=/^(?:0|[1-9]\d*)$/;function EKe(t,e){var r=typeof t;return e=e??mKe,!!e&&(r=="number"||r!="symbol"&&yKe.test(t))&&t>-1&&t%1==0&&t{var CKe=9007199254740991;function IKe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=CKe}Ote.exports=IKe});var Ute=_((zFt,Mte)=>{var wKe=mg(),BKe=wP(),vKe=Zu(),DKe="[object Arguments]",SKe="[object Array]",PKe="[object Boolean]",xKe="[object Date]",bKe="[object Error]",kKe="[object Function]",QKe="[object Map]",FKe="[object Number]",RKe="[object Object]",TKe="[object RegExp]",LKe="[object Set]",NKe="[object String]",OKe="[object WeakMap]",MKe="[object ArrayBuffer]",UKe="[object DataView]",_Ke="[object Float32Array]",HKe="[object Float64Array]",qKe="[object Int8Array]",jKe="[object Int16Array]",GKe="[object Int32Array]",WKe="[object Uint8Array]",YKe="[object Uint8ClampedArray]",VKe="[object Uint16Array]",KKe="[object Uint32Array]",di={};di[_Ke]=di[HKe]=di[qKe]=di[jKe]=di[GKe]=di[WKe]=di[YKe]=di[VKe]=di[KKe]=!0;di[DKe]=di[SKe]=di[MKe]=di[PKe]=di[UKe]=di[xKe]=di[bKe]=di[kKe]=di[QKe]=di[FKe]=di[RKe]=di[TKe]=di[LKe]=di[NKe]=di[OKe]=!1;function JKe(t){return vKe(t)&&BKe(t.length)&&!!di[wKe(t)]}Mte.exports=JKe});var BP=_((XFt,_te)=>{function zKe(t){return function(e){return t(e)}}_te.exports=zKe});var vP=_((i1,Wm)=>{var XKe=wN(),Hte=typeof i1=="object"&&i1&&!i1.nodeType&&i1,s1=Hte&&typeof Wm=="object"&&Wm&&!Wm.nodeType&&Wm,ZKe=s1&&s1.exports===Hte,kN=ZKe&&XKe.process,$Ke=function(){try{var t=s1&&s1.require&&s1.require("util").types;return t||kN&&kN.binding&&kN.binding("util")}catch{}}();Wm.exports=$Ke});var DP=_((ZFt,Gte)=>{var eJe=Ute(),tJe=BP(),qte=vP(),jte=qte&&qte.isTypedArray,rJe=jte?tJe(jte):eJe;Gte.exports=rJe});var QN=_(($Ft,Wte)=>{var nJe=vte(),iJe=e1(),sJe=jl(),oJe=r1(),aJe=n1(),lJe=DP(),cJe=Object.prototype,uJe=cJe.hasOwnProperty;function AJe(t,e){var r=sJe(t),o=!r&&iJe(t),a=!r&&!o&&oJe(t),n=!r&&!o&&!a&&lJe(t),u=r||o||a||n,A=u?nJe(t.length,String):[],p=A.length;for(var h in t)(e||uJe.call(t,h))&&!(u&&(h=="length"||a&&(h=="offset"||h=="parent")||n&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||aJe(h,p)))&&A.push(h);return A}Wte.exports=AJe});var SP=_((eRt,Yte)=>{var fJe=Object.prototype;function pJe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||fJe;return t===r}Yte.exports=pJe});var FN=_((tRt,Vte)=>{function hJe(t,e){return function(r){return t(e(r))}}Vte.exports=hJe});var Jte=_((rRt,Kte)=>{var gJe=FN(),dJe=gJe(Object.keys,Object);Kte.exports=dJe});var Xte=_((nRt,zte)=>{var mJe=SP(),yJe=Jte(),EJe=Object.prototype,CJe=EJe.hasOwnProperty;function IJe(t){if(!mJe(t))return yJe(t);var e=[];for(var r in Object(t))CJe.call(t,r)&&r!="constructor"&&e.push(r);return e}zte.exports=IJe});var o1=_((iRt,Zte)=>{var wJe=gP(),BJe=wP();function vJe(t){return t!=null&&BJe(t.length)&&!wJe(t)}Zte.exports=vJe});var PP=_((sRt,$te)=>{var DJe=QN(),SJe=Xte(),PJe=o1();function xJe(t){return PJe(t)?DJe(t):SJe(t)}$te.exports=xJe});var RN=_((oRt,ere)=>{var bJe=xN(),kJe=IP(),QJe=PP();function FJe(t){return bJe(t,QJe,kJe)}ere.exports=FJe});var nre=_((aRt,rre)=>{var tre=RN(),RJe=1,TJe=Object.prototype,LJe=TJe.hasOwnProperty;function NJe(t,e,r,o,a,n){var u=r&RJe,A=tre(t),p=A.length,h=tre(e),E=h.length;if(p!=E&&!u)return!1;for(var w=p;w--;){var D=A[w];if(!(u?D in e:LJe.call(e,D)))return!1}var b=n.get(t),C=n.get(e);if(b&&C)return b==e&&C==t;var T=!0;n.set(t,e),n.set(e,t);for(var N=u;++w{var OJe=$p(),MJe=ql(),UJe=OJe(MJe,"DataView");ire.exports=UJe});var are=_((cRt,ore)=>{var _Je=$p(),HJe=ql(),qJe=_Je(HJe,"Promise");ore.exports=qJe});var cre=_((uRt,lre)=>{var jJe=$p(),GJe=ql(),WJe=jJe(GJe,"Set");lre.exports=WJe});var Are=_((ARt,ure)=>{var YJe=$p(),VJe=ql(),KJe=YJe(VJe,"WeakMap");ure.exports=KJe});var a1=_((fRt,yre)=>{var TN=sre(),LN=dP(),NN=are(),ON=cre(),MN=Are(),mre=mg(),Ym=vN(),fre="[object Map]",JJe="[object Object]",pre="[object Promise]",hre="[object Set]",gre="[object WeakMap]",dre="[object DataView]",zJe=Ym(TN),XJe=Ym(LN),ZJe=Ym(NN),$Je=Ym(ON),eze=Ym(MN),yg=mre;(TN&&yg(new TN(new ArrayBuffer(1)))!=dre||LN&&yg(new LN)!=fre||NN&&yg(NN.resolve())!=pre||ON&&yg(new ON)!=hre||MN&&yg(new MN)!=gre)&&(yg=function(t){var e=mre(t),r=e==JJe?t.constructor:void 0,o=r?Ym(r):"";if(o)switch(o){case zJe:return dre;case XJe:return fre;case ZJe:return pre;case $Je:return hre;case eze:return gre}return e});yre.exports=yg});var Sre=_((pRt,Dre)=>{var UN=yP(),tze=DN(),rze=hte(),nze=nre(),Ere=a1(),Cre=jl(),Ire=r1(),ize=DP(),sze=1,wre="[object Arguments]",Bre="[object Array]",xP="[object Object]",oze=Object.prototype,vre=oze.hasOwnProperty;function aze(t,e,r,o,a,n){var u=Cre(t),A=Cre(e),p=u?Bre:Ere(t),h=A?Bre:Ere(e);p=p==wre?xP:p,h=h==wre?xP:h;var E=p==xP,w=h==xP,D=p==h;if(D&&Ire(t)){if(!Ire(e))return!1;u=!0,E=!1}if(D&&!E)return n||(n=new UN),u||ize(t)?tze(t,e,r,o,a,n):rze(t,e,p,r,o,a,n);if(!(r&sze)){var b=E&&vre.call(t,"__wrapped__"),C=w&&vre.call(e,"__wrapped__");if(b||C){var T=b?t.value():t,N=C?e.value():e;return n||(n=new UN),a(T,N,r,o,n)}}return D?(n||(n=new UN),nze(t,e,r,o,a,n)):!1}Dre.exports=aze});var kre=_((hRt,bre)=>{var lze=Sre(),Pre=Zu();function xre(t,e,r,o,a){return t===e?!0:t==null||e==null||!Pre(t)&&!Pre(e)?t!==t&&e!==e:lze(t,e,r,o,xre,a)}bre.exports=xre});var Fre=_((gRt,Qre)=>{var cze=kre();function uze(t,e){return cze(t,e)}Qre.exports=uze});var _N=_((dRt,Rre)=>{var Aze=$p(),fze=function(){try{var t=Aze(Object,"defineProperty");return t({},"",{}),t}catch{}}();Rre.exports=fze});var bP=_((mRt,Lre)=>{var Tre=_N();function pze(t,e,r){e=="__proto__"&&Tre?Tre(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}Lre.exports=pze});var HN=_((yRt,Nre)=>{var hze=bP(),gze=Um();function dze(t,e,r){(r!==void 0&&!gze(t[e],r)||r===void 0&&!(e in t))&&hze(t,e,r)}Nre.exports=dze});var Mre=_((ERt,Ore)=>{function mze(t){return function(e,r,o){for(var a=-1,n=Object(e),u=o(e),A=u.length;A--;){var p=u[t?A:++a];if(r(n[p],p,n)===!1)break}return e}}Ore.exports=mze});var _re=_((CRt,Ure)=>{var yze=Mre(),Eze=yze();Ure.exports=Eze});var qN=_((l1,Vm)=>{var Cze=ql(),Gre=typeof l1=="object"&&l1&&!l1.nodeType&&l1,Hre=Gre&&typeof Vm=="object"&&Vm&&!Vm.nodeType&&Vm,Ize=Hre&&Hre.exports===Gre,qre=Ize?Cze.Buffer:void 0,jre=qre?qre.allocUnsafe:void 0;function wze(t,e){if(e)return t.slice();var r=t.length,o=jre?jre(r):new t.constructor(r);return t.copy(o),o}Vm.exports=wze});var kP=_((IRt,Yre)=>{var Wre=SN();function Bze(t){var e=new t.constructor(t.byteLength);return new Wre(e).set(new Wre(t)),e}Yre.exports=Bze});var jN=_((wRt,Vre)=>{var vze=kP();function Dze(t,e){var r=e?vze(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}Vre.exports=Dze});var QP=_((BRt,Kre)=>{function Sze(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r{var Pze=cl(),Jre=Object.create,xze=function(){function t(){}return function(e){if(!Pze(e))return{};if(Jre)return Jre(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();zre.exports=xze});var FP=_((DRt,Zre)=>{var bze=FN(),kze=bze(Object.getPrototypeOf,Object);Zre.exports=kze});var GN=_((SRt,$re)=>{var Qze=Xre(),Fze=FP(),Rze=SP();function Tze(t){return typeof t.constructor=="function"&&!Rze(t)?Qze(Fze(t)):{}}$re.exports=Tze});var tne=_((PRt,ene)=>{var Lze=o1(),Nze=Zu();function Oze(t){return Nze(t)&&Lze(t)}ene.exports=Oze});var WN=_((xRt,nne)=>{var Mze=mg(),Uze=FP(),_ze=Zu(),Hze="[object Object]",qze=Function.prototype,jze=Object.prototype,rne=qze.toString,Gze=jze.hasOwnProperty,Wze=rne.call(Object);function Yze(t){if(!_ze(t)||Mze(t)!=Hze)return!1;var e=Uze(t);if(e===null)return!0;var r=Gze.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&rne.call(r)==Wze}nne.exports=Yze});var YN=_((bRt,ine)=>{function Vze(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}ine.exports=Vze});var RP=_((kRt,sne)=>{var Kze=bP(),Jze=Um(),zze=Object.prototype,Xze=zze.hasOwnProperty;function Zze(t,e,r){var o=t[e];(!(Xze.call(t,e)&&Jze(o,r))||r===void 0&&!(e in t))&&Kze(t,e,r)}sne.exports=Zze});var Eg=_((QRt,one)=>{var $ze=RP(),eXe=bP();function tXe(t,e,r,o){var a=!r;r||(r={});for(var n=-1,u=e.length;++n{function rXe(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}ane.exports=rXe});var une=_((RRt,cne)=>{var nXe=cl(),iXe=SP(),sXe=lne(),oXe=Object.prototype,aXe=oXe.hasOwnProperty;function lXe(t){if(!nXe(t))return sXe(t);var e=iXe(t),r=[];for(var o in t)o=="constructor"&&(e||!aXe.call(t,o))||r.push(o);return r}cne.exports=lXe});var Km=_((TRt,Ane)=>{var cXe=QN(),uXe=une(),AXe=o1();function fXe(t){return AXe(t)?cXe(t,!0):uXe(t)}Ane.exports=fXe});var pne=_((LRt,fne)=>{var pXe=Eg(),hXe=Km();function gXe(t){return pXe(t,hXe(t))}fne.exports=gXe});var Ene=_((NRt,yne)=>{var hne=HN(),dXe=qN(),mXe=jN(),yXe=QP(),EXe=GN(),gne=e1(),dne=jl(),CXe=tne(),IXe=r1(),wXe=gP(),BXe=cl(),vXe=WN(),DXe=DP(),mne=YN(),SXe=pne();function PXe(t,e,r,o,a,n,u){var A=mne(t,r),p=mne(e,r),h=u.get(p);if(h){hne(t,r,h);return}var E=n?n(A,p,r+"",t,e,u):void 0,w=E===void 0;if(w){var D=dne(p),b=!D&&IXe(p),C=!D&&!b&&DXe(p);E=p,D||b||C?dne(A)?E=A:CXe(A)?E=yXe(A):b?(w=!1,E=dXe(p,!0)):C?(w=!1,E=mXe(p,!0)):E=[]:vXe(p)||gne(p)?(E=A,gne(A)?E=SXe(A):(!BXe(A)||wXe(A))&&(E=EXe(p))):w=!1}w&&(u.set(p,E),a(E,p,o,n,u),u.delete(p)),hne(t,r,E)}yne.exports=PXe});var wne=_((ORt,Ine)=>{var xXe=yP(),bXe=HN(),kXe=_re(),QXe=Ene(),FXe=cl(),RXe=Km(),TXe=YN();function Cne(t,e,r,o,a){t!==e&&kXe(e,function(n,u){if(a||(a=new xXe),FXe(n))QXe(t,e,u,r,Cne,o,a);else{var A=o?o(TXe(t,u),n,u+"",t,e,a):void 0;A===void 0&&(A=n),bXe(t,u,A)}},RXe)}Ine.exports=Cne});var VN=_((MRt,Bne)=>{function LXe(t){return t}Bne.exports=LXe});var Dne=_((URt,vne)=>{function NXe(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}vne.exports=NXe});var KN=_((_Rt,Pne)=>{var OXe=Dne(),Sne=Math.max;function MXe(t,e,r){return e=Sne(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Sne(o.length-e,0),u=Array(n);++a{function UXe(t){return function(){return t}}xne.exports=UXe});var Fne=_((qRt,Qne)=>{var _Xe=bne(),kne=_N(),HXe=VN(),qXe=kne?function(t,e){return kne(t,"toString",{configurable:!0,enumerable:!1,value:_Xe(e),writable:!0})}:HXe;Qne.exports=qXe});var Tne=_((jRt,Rne)=>{var jXe=800,GXe=16,WXe=Date.now;function YXe(t){var e=0,r=0;return function(){var o=WXe(),a=GXe-(o-r);if(r=o,a>0){if(++e>=jXe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}Rne.exports=YXe});var JN=_((GRt,Lne)=>{var VXe=Fne(),KXe=Tne(),JXe=KXe(VXe);Lne.exports=JXe});var One=_((WRt,Nne)=>{var zXe=VN(),XXe=KN(),ZXe=JN();function $Xe(t,e){return ZXe(XXe(t,e,zXe),t+"")}Nne.exports=$Xe});var Une=_((YRt,Mne)=>{var eZe=Um(),tZe=o1(),rZe=n1(),nZe=cl();function iZe(t,e,r){if(!nZe(r))return!1;var o=typeof e;return(o=="number"?tZe(r)&&rZe(e,r.length):o=="string"&&e in r)?eZe(r[e],t):!1}Mne.exports=iZe});var Hne=_((VRt,_ne)=>{var sZe=One(),oZe=Une();function aZe(t){return sZe(function(e,r){var o=-1,a=r.length,n=a>1?r[a-1]:void 0,u=a>2?r[2]:void 0;for(n=t.length>3&&typeof n=="function"?(a--,n):void 0,u&&oZe(r[0],r[1],u)&&(n=a<3?void 0:n,a=1),e=Object(e);++o{var lZe=wne(),cZe=Hne(),uZe=cZe(function(t,e,r,o){lZe(t,e,r,o)});qne.exports=uZe});var qe={};Vt(qe,{AsyncActions:()=>ZN,BufferStream:()=>XN,CachingStrategy:()=>tie,DefaultStream:()=>$N,allSettledSafe:()=>Wc,assertNever:()=>tO,bufferStream:()=>Xm,buildIgnorePattern:()=>mZe,convertMapsToIndexableObjects:()=>LP,dynamicRequire:()=>vf,escapeRegExp:()=>fZe,getArrayWithDefault:()=>u1,getFactoryWithDefault:()=>Al,getMapWithDefault:()=>A1,getSetWithDefault:()=>Jm,groupBy:()=>CZe,isIndexableObject:()=>zN,isPathLike:()=>yZe,isTaggedYarnVersion:()=>AZe,makeDeferred:()=>Zne,mapAndFilter:()=>ul,mapAndFind:()=>eh,mergeIntoTarget:()=>nie,overrideType:()=>pZe,parseBoolean:()=>f1,parseInt:()=>Zm,parseOptionalBoolean:()=>rie,plural:()=>TP,prettifyAsyncErrors:()=>zm,prettifySyncErrors:()=>rO,releaseAfterUseAsync:()=>gZe,replaceEnvVariables:()=>NP,sortMap:()=>Ss,toMerged:()=>EZe,tryParseOptionalBoolean:()=>nO,validateEnum:()=>hZe});function AZe(t){return!!(Jne.default.valid(t)&&t.match(/^[^-]+(-rc\.[0-9]+)?$/))}function TP(t,{one:e,more:r,zero:o=r}){return t===0?o:t===1?e:r}function fZe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pZe(t){}function tO(t){throw new Error(`Assertion failed: Unexpected object '${t}'`)}function hZe(t,e){let r=Object.values(t);if(!r.includes(e))throw new it(`Invalid value for enumeration: ${JSON.stringify(e)} (expected one of ${r.map(o=>JSON.stringify(o)).join(", ")})`);return e}function ul(t,e){let r=[];for(let o of t){let a=e(o);a!==zne&&r.push(a)}return r}function eh(t,e){for(let r of t){let o=e(r);if(o!==Xne)return o}}function zN(t){return typeof t=="object"&&t!==null}async function Wc(t){let e=await Promise.allSettled(t),r=[];for(let o of e){if(o.status==="rejected")throw o.reason;r.push(o.value)}return r}function LP(t){if(t instanceof Map&&(t=Object.fromEntries(t)),zN(t))for(let e of Object.keys(t)){let r=t[e];zN(r)&&(t[e]=LP(r))}return t}function Al(t,e,r){let o=t.get(e);return typeof o>"u"&&t.set(e,o=r()),o}function u1(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=[]),r}function Jm(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=new Set),r}function A1(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=new Map),r}async function gZe(t,e){if(e==null)return await t();try{return await t()}finally{await e()}}async function zm(t,e){try{return await t()}catch(r){throw r.message=e(r.message),r}}function rO(t,e){try{return t()}catch(r){throw r.message=e(r.message),r}}async function Xm(t){return await new Promise((e,r)=>{let o=[];t.on("error",a=>{r(a)}),t.on("data",a=>{o.push(a)}),t.on("end",()=>{e(Buffer.concat(o))})})}function Zne(){let t,e;return{promise:new Promise((o,a)=>{t=o,e=a}),resolve:t,reject:e}}function $ne(t){return c1(Ae.fromPortablePath(t))}function eie(path){let physicalPath=Ae.fromPortablePath(path),currentCacheEntry=c1.cache[physicalPath];delete c1.cache[physicalPath];let result;try{result=$ne(physicalPath);let freshCacheEntry=c1.cache[physicalPath],dynamicModule=eval("module"),freshCacheIndex=dynamicModule.children.indexOf(freshCacheEntry);freshCacheIndex!==-1&&dynamicModule.children.splice(freshCacheIndex,1)}finally{c1.cache[physicalPath]=currentCacheEntry}return result}function dZe(t){let e=Gne.get(t),r=ae.statSync(t);if(e?.mtime===r.mtimeMs)return e.instance;let o=eie(t);return Gne.set(t,{mtime:r.mtimeMs,instance:o}),o}function vf(t,{cachingStrategy:e=2}={}){switch(e){case 0:return eie(t);case 1:return dZe(t);case 2:return $ne(t);default:throw new Error("Unsupported caching strategy")}}function Ss(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let o=[];for(let n of e)o.push(r.map(u=>n(u)));let a=r.map((n,u)=>u);return a.sort((n,u)=>{for(let A of o){let p=A[n]A[u]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function mZe(t){return t.length===0?null:t.map(e=>`(${Vne.default.makeRe(e,{windows:!1,dot:!0}).source})`).join("|")}function NP(t,{env:e}){let r=/\${(?[\d\w_]+)(?:)?(?:-(?[^}]*))?}/g;return t.replace(r,(...o)=>{let{variableName:a,colon:n,fallback:u}=o[o.length-1],A=Object.hasOwn(e,a),p=e[a];if(p||A&&!n)return p;if(u!=null)return u;throw new it(`Environment variable not found (${a})`)})}function f1(t){switch(t){case"true":case"1":case 1:case!0:return!0;case"false":case"0":case 0:case!1:return!1;default:throw new Error(`Couldn't parse "${t}" as a boolean`)}}function rie(t){return typeof t>"u"?t:f1(t)}function nO(t){try{return rie(t)}catch{return null}}function yZe(t){return!!(Ae.isAbsolute(t)||t.match(/^(\.{1,2}|~)\//))}function nie(t,...e){let r=u=>({value:u}),o=r(t),a=e.map(u=>r(u)),{value:n}=(0,Yne.default)(o,...a,(u,A)=>{if(Array.isArray(u)&&Array.isArray(A)){for(let p of A)u.find(h=>(0,Wne.default)(h,p))||u.push(p);return u}});return n}function EZe(...t){return nie({},...t)}function CZe(t,e){let r=Object.create(null);for(let o of t){let a=o[e];r[a]??=[],r[a].push(o)}return r}function Zm(t){return typeof t=="string"?Number.parseInt(t,10):t}var Wne,Yne,Vne,Kne,Jne,eO,zne,Xne,XN,ZN,$N,c1,Gne,tie,Gl=It(()=>{St();Gt();Wne=et(Fre()),Yne=et(jne()),Vne=et(Xo()),Kne=et(lg()),Jne=et(ni()),eO=ve("stream");zne=Symbol();ul.skip=zne;Xne=Symbol();eh.skip=Xne;XN=class extends eO.Transform{constructor(){super(...arguments);this.chunks=[]}_transform(r,o,a){if(o!=="buffer"||!Buffer.isBuffer(r))throw new Error("Assertion failed: BufferStream only accept buffers");this.chunks.push(r),a(null,null)}_flush(r){r(null,Buffer.concat(this.chunks))}};ZN=class{constructor(e){this.deferred=new Map;this.promises=new Map;this.limit=(0,Kne.default)(e)}set(e,r){let o=this.deferred.get(e);typeof o>"u"&&this.deferred.set(e,o=Zne());let a=this.limit(()=>r());return this.promises.set(e,a),a.then(()=>{this.promises.get(e)===a&&o.resolve()},n=>{this.promises.get(e)===a&&o.reject(n)}),o.promise}reduce(e,r){let o=this.promises.get(e)??Promise.resolve();this.set(e,()=>r(o))}async wait(){await Promise.all(this.promises.values())}},$N=class extends eO.Transform{constructor(r=Buffer.alloc(0)){super();this.active=!0;this.ifEmpty=r}_transform(r,o,a){if(o!=="buffer"||!Buffer.isBuffer(r))throw new Error("Assertion failed: DefaultStream only accept buffers");this.active=!1,a(null,r)}_flush(r){this.active&&this.ifEmpty.length>0?r(null,this.ifEmpty):r(null)}},c1=eval("require");Gne=new Map;tie=(o=>(o[o.NoCache=0]="NoCache",o[o.FsTime=1]="FsTime",o[o.Node=2]="Node",o))(tie||{})});var $m,iO,sO,iie=It(()=>{$m=(r=>(r.HARD="HARD",r.SOFT="SOFT",r))($m||{}),iO=(o=>(o.Dependency="Dependency",o.PeerDependency="PeerDependency",o.PeerDependencyMeta="PeerDependencyMeta",o))(iO||{}),sO=(o=>(o.Inactive="inactive",o.Redundant="redundant",o.Active="active",o))(sO||{})});var pe={};Vt(pe,{LogLevel:()=>HP,Style:()=>MP,Type:()=>Ct,addLogFilterSupport:()=>g1,applyColor:()=>Gs,applyHyperlink:()=>ty,applyStyle:()=>Cg,json:()=>Ig,jsonOrPretty:()=>BZe,mark:()=>uO,pretty:()=>Ut,prettyField:()=>$u,prettyList:()=>cO,prettyTruncatedLocatorList:()=>_P,stripAnsi:()=>ey.default,supportsColor:()=>UP,supportsHyperlinks:()=>lO,tuple:()=>Yc});function sie(t){let e=["KiB","MiB","GiB","TiB"],r=e.length;for(;r>1&&t<1024**r;)r-=1;let o=1024**r;return`${Math.floor(t*100/o)/100} ${e[r-1]}`}function Yc(t,e){return[e,t]}function Cg(t,e,r){return t.get("enableColors")&&r&2&&(e=h1.default.bold(e)),e}function Gs(t,e,r){if(!t.get("enableColors"))return e;let o=IZe.get(r);if(o===null)return e;let a=typeof o>"u"?r:aO.level>=3?o[0]:o[1],n=typeof a=="number"?oO.ansi256(a):a.startsWith("#")?oO.hex(a):oO[a];if(typeof n!="function")throw new Error(`Invalid format type ${a}`);return n(e)}function ty(t,e,r){return t.get("enableHyperlinks")?wZe?`\x1B]8;;${r}\x1B\\${e}\x1B]8;;\x1B\\`:`\x1B]8;;${r}\x07${e}\x1B]8;;\x07`:e}function Ut(t,e,r){if(e===null)return Gs(t,"null",Ct.NULL);if(Object.hasOwn(OP,r))return OP[r].pretty(t,e);if(typeof e!="string")throw new Error(`Assertion failed: Expected the value to be a string, got ${typeof e}`);return Gs(t,e,r)}function cO(t,e,r,{separator:o=", "}={}){return[...e].map(a=>Ut(t,a,r)).join(o)}function Ig(t,e){if(t===null)return null;if(Object.hasOwn(OP,e))return OP[e].json(t);if(typeof t!="string")throw new Error(`Assertion failed: Expected the value to be a string, got ${typeof t}`);return t}function BZe(t,e,[r,o]){return t?Ig(r,o):Ut(e,r,o)}function uO(t){return{Check:Gs(t,"\u2713","green"),Cross:Gs(t,"\u2718","red"),Question:Gs(t,"?","cyan")}}function $u(t,{label:e,value:[r,o]}){return`${Ut(t,e,Ct.CODE)}: ${Ut(t,r,o)}`}function _P(t,e,r){let o=[],a=[...e],n=r;for(;a.length>0;){let h=a[0],E=`${jr(t,h)}, `,w=AO(h).length+2;if(o.length>0&&nh).join("").slice(0,-2);let u="X".repeat(a.length.toString().length),A=`and ${u} more.`,p=a.length;for(;o.length>1&&nh).join(""),A.replace(u,Ut(t,p,Ct.NUMBER))].join("")}function g1(t,{configuration:e}){let r=e.get("logFilters"),o=new Map,a=new Map,n=[];for(let w of r){let D=w.get("level");if(typeof D>"u")continue;let b=w.get("code");typeof b<"u"&&o.set(b,D);let C=w.get("text");typeof C<"u"&&a.set(C,D);let T=w.get("pattern");typeof T<"u"&&n.push([oie.default.matcher(T,{contains:!0}),D])}n.reverse();let u=(w,D,b)=>{if(w===null||w===0)return b;let C=a.size>0||n.length>0?(0,ey.default)(D):D;if(a.size>0){let T=a.get(C);if(typeof T<"u")return T??b}if(n.length>0){for(let[T,N]of n)if(T(C))return N??b}if(o.size>0){let T=o.get(Ju(w));if(typeof T<"u")return T??b}return b},A=t.reportInfo,p=t.reportWarning,h=t.reportError,E=function(w,D,b,C){switch(u(D,b,C)){case"info":A.call(w,D,b);break;case"warning":p.call(w,D??0,b);break;case"error":h.call(w,D??0,b);break}};t.reportInfo=function(...w){return E(this,...w,"info")},t.reportWarning=function(...w){return E(this,...w,"warning")},t.reportError=function(...w){return E(this,...w,"error")}}var h1,p1,oie,ey,aie,Ct,MP,aO,UP,lO,oO,IZe,Co,OP,wZe,HP,Wl=It(()=>{St();h1=et(sN()),p1=et(sg());Gt();oie=et(Xo()),ey=et(hP()),aie=ve("util");GS();Io();Ct={NO_HINT:"NO_HINT",ID:"ID",NULL:"NULL",SCOPE:"SCOPE",NAME:"NAME",RANGE:"RANGE",REFERENCE:"REFERENCE",NUMBER:"NUMBER",PATH:"PATH",URL:"URL",ADDED:"ADDED",REMOVED:"REMOVED",CODE:"CODE",INSPECT:"INSPECT",DURATION:"DURATION",SIZE:"SIZE",SIZE_DIFF:"SIZE_DIFF",IDENT:"IDENT",DESCRIPTOR:"DESCRIPTOR",LOCATOR:"LOCATOR",RESOLUTION:"RESOLUTION",DEPENDENT:"DEPENDENT",PACKAGE_EXTENSION:"PACKAGE_EXTENSION",SETTING:"SETTING",MARKDOWN:"MARKDOWN",MARKDOWN_INLINE:"MARKDOWN_INLINE"},MP=(e=>(e[e.BOLD=2]="BOLD",e))(MP||{}),aO=p1.default.GITHUB_ACTIONS?{level:2}:h1.default.supportsColor?{level:h1.default.supportsColor.level}:{level:0},UP=aO.level!==0,lO=UP&&!p1.default.GITHUB_ACTIONS&&!p1.default.CIRCLE&&!p1.default.GITLAB,oO=new h1.default.Instance(aO),IZe=new Map([[Ct.NO_HINT,null],[Ct.NULL,["#a853b5",129]],[Ct.SCOPE,["#d75f00",166]],[Ct.NAME,["#d7875f",173]],[Ct.RANGE,["#00afaf",37]],[Ct.REFERENCE,["#87afff",111]],[Ct.NUMBER,["#ffd700",220]],[Ct.PATH,["#d75fd7",170]],[Ct.URL,["#d75fd7",170]],[Ct.ADDED,["#5faf00",70]],[Ct.REMOVED,["#ff3131",160]],[Ct.CODE,["#87afff",111]],[Ct.SIZE,["#ffd700",220]]]),Co=t=>t;OP={[Ct.ID]:Co({pretty:(t,e)=>typeof e=="number"?Gs(t,`${e}`,Ct.NUMBER):Gs(t,e,Ct.CODE),json:t=>t}),[Ct.INSPECT]:Co({pretty:(t,e)=>(0,aie.inspect)(e,{depth:1/0,colors:t.get("enableColors"),compact:!0,breakLength:1/0}),json:t=>t}),[Ct.NUMBER]:Co({pretty:(t,e)=>Gs(t,`${e}`,Ct.NUMBER),json:t=>t}),[Ct.IDENT]:Co({pretty:(t,e)=>Ui(t,e),json:t=>rn(t)}),[Ct.LOCATOR]:Co({pretty:(t,e)=>jr(t,e),json:t=>Qa(t)}),[Ct.DESCRIPTOR]:Co({pretty:(t,e)=>Jn(t,e),json:t=>ka(t)}),[Ct.RESOLUTION]:Co({pretty:(t,{descriptor:e,locator:r})=>d1(t,e,r),json:({descriptor:t,locator:e})=>({descriptor:ka(t),locator:e!==null?Qa(e):null})}),[Ct.DEPENDENT]:Co({pretty:(t,{locator:e,descriptor:r})=>fO(t,e,r),json:({locator:t,descriptor:e})=>({locator:Qa(t),descriptor:ka(e)})}),[Ct.PACKAGE_EXTENSION]:Co({pretty:(t,e)=>{switch(e.type){case"Dependency":return`${Ui(t,e.parentDescriptor)} \u27A4 ${Gs(t,"dependencies",Ct.CODE)} \u27A4 ${Ui(t,e.descriptor)}`;case"PeerDependency":return`${Ui(t,e.parentDescriptor)} \u27A4 ${Gs(t,"peerDependencies",Ct.CODE)} \u27A4 ${Ui(t,e.descriptor)}`;case"PeerDependencyMeta":return`${Ui(t,e.parentDescriptor)} \u27A4 ${Gs(t,"peerDependenciesMeta",Ct.CODE)} \u27A4 ${Ui(t,Zo(e.selector))} \u27A4 ${Gs(t,e.key,Ct.CODE)}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${e.type}`)}},json:t=>{switch(t.type){case"Dependency":return`${rn(t.parentDescriptor)} > ${rn(t.descriptor)}`;case"PeerDependency":return`${rn(t.parentDescriptor)} >> ${rn(t.descriptor)}`;case"PeerDependencyMeta":return`${rn(t.parentDescriptor)} >> ${t.selector} / ${t.key}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${t.type}`)}}}),[Ct.SETTING]:Co({pretty:(t,e)=>(t.get(e),ty(t,Gs(t,e,Ct.CODE),`https://yarnpkg.com/configuration/yarnrc#${e}`)),json:t=>t}),[Ct.DURATION]:Co({pretty:(t,e)=>{if(e>1e3*60){let r=Math.floor(e/1e3/60),o=Math.ceil((e-r*60*1e3)/1e3);return o===0?`${r}m`:`${r}m ${o}s`}else{let r=Math.floor(e/1e3),o=e-r*1e3;return o===0?`${r}s`:`${r}s ${o}ms`}},json:t=>t}),[Ct.SIZE]:Co({pretty:(t,e)=>Gs(t,sie(e),Ct.NUMBER),json:t=>t}),[Ct.SIZE_DIFF]:Co({pretty:(t,e)=>{let r=e>=0?"+":"-",o=r==="+"?Ct.REMOVED:Ct.ADDED;return Gs(t,`${r} ${sie(Math.max(Math.abs(e),1))}`,o)},json:t=>t}),[Ct.PATH]:Co({pretty:(t,e)=>Gs(t,Ae.fromPortablePath(e),Ct.PATH),json:t=>Ae.fromPortablePath(t)}),[Ct.MARKDOWN]:Co({pretty:(t,{text:e,format:r,paragraphs:o})=>yo(e,{format:r,paragraphs:o}),json:({text:t})=>t}),[Ct.MARKDOWN_INLINE]:Co({pretty:(t,e)=>(e=e.replace(/(`+)((?:.|[\n])*?)\1/g,(r,o,a)=>Ut(t,o+a+o,Ct.CODE)),e=e.replace(/(\*\*)((?:.|[\n])*?)\1/g,(r,o,a)=>Cg(t,a,2)),e),json:t=>t})};wZe=!!process.env.KONSOLE_VERSION;HP=(a=>(a.Error="error",a.Warning="warning",a.Info="info",a.Discard="discard",a))(HP||{})});var lie=_(ry=>{"use strict";Object.defineProperty(ry,"__esModule",{value:!0});ry.splitWhen=ry.flatten=void 0;function vZe(t){return t.reduce((e,r)=>[].concat(e,r),[])}ry.flatten=vZe;function DZe(t,e){let r=[[]],o=0;for(let a of t)e(a)?(o++,r[o]=[]):r[o].push(a);return r}ry.splitWhen=DZe});var cie=_(qP=>{"use strict";Object.defineProperty(qP,"__esModule",{value:!0});qP.isEnoentCodeError=void 0;function SZe(t){return t.code==="ENOENT"}qP.isEnoentCodeError=SZe});var uie=_(jP=>{"use strict";Object.defineProperty(jP,"__esModule",{value:!0});jP.createDirentFromStats=void 0;var pO=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function PZe(t,e){return new pO(t,e)}jP.createDirentFromStats=PZe});var hie=_(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.convertPosixPathToPattern=Ki.convertWindowsPathToPattern=Ki.convertPathToPattern=Ki.escapePosixPath=Ki.escapeWindowsPath=Ki.escape=Ki.removeLeadingDotSegment=Ki.makeAbsolute=Ki.unixify=void 0;var xZe=ve("os"),bZe=ve("path"),Aie=xZe.platform()==="win32",kZe=2,QZe=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,FZe=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,RZe=/^\\\\([.?])/,TZe=/\\(?![!()+@[\]{}])/g;function LZe(t){return t.replace(/\\/g,"/")}Ki.unixify=LZe;function NZe(t,e){return bZe.resolve(t,e)}Ki.makeAbsolute=NZe;function OZe(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(kZe)}return t}Ki.removeLeadingDotSegment=OZe;Ki.escape=Aie?hO:gO;function hO(t){return t.replace(FZe,"\\$2")}Ki.escapeWindowsPath=hO;function gO(t){return t.replace(QZe,"\\$2")}Ki.escapePosixPath=gO;Ki.convertPathToPattern=Aie?fie:pie;function fie(t){return hO(t).replace(RZe,"//$1").replace(TZe,"/")}Ki.convertWindowsPathToPattern=fie;function pie(t){return gO(t)}Ki.convertPosixPathToPattern=pie});var die=_((cTt,gie)=>{gie.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Eie=_((uTt,yie)=>{var MZe=die(),mie={"{":"}","(":")","[":"]"},UZe=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,o=-2,a=-2,n=-2,u=-2;ee&&(u===-1||u>o||(u=t.indexOf("\\",e),u===-1||u>o)))||a!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(a=t.indexOf("}",e),a>e&&(u=t.indexOf("\\",e),u===-1||u>a))||n!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(n=t.indexOf(")",e),n>e&&(u=t.indexOf("\\",e),u===-1||u>n))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(rr&&(u=t.indexOf("\\",r),u===-1||u>n))))return!0;if(t[e]==="\\"){var A=t[e+1];e+=2;var p=mie[A];if(p){var h=t.indexOf(p,e);h!==-1&&(e=h+1)}if(t[e]==="!")return!0}else e++}return!1},_Ze=function(t){if(t[0]==="!")return!0;for(var e=0;e{"use strict";var HZe=Eie(),qZe=ve("path").posix.dirname,jZe=ve("os").platform()==="win32",dO="/",GZe=/\\/g,WZe=/[\{\[].*[\}\]]$/,YZe=/(^|[^\\])([\{\[]|\([^\)]+$)/,VZe=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Cie.exports=function(e,r){var o=Object.assign({flipBackslashes:!0},r);o.flipBackslashes&&jZe&&e.indexOf(dO)<0&&(e=e.replace(GZe,dO)),WZe.test(e)&&(e+=dO),e+="a";do e=qZe(e);while(HZe(e)||YZe.test(e));return e.replace(VZe,"$1")}});var bie=_(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.removeDuplicateSlashes=Mr.matchAny=Mr.convertPatternsToRe=Mr.makeRe=Mr.getPatternParts=Mr.expandBraceExpansion=Mr.expandPatternsWithBraceExpansion=Mr.isAffectDepthOfReadingPattern=Mr.endsWithSlashGlobStar=Mr.hasGlobStar=Mr.getBaseDirectory=Mr.isPatternRelatedToParentDirectory=Mr.getPatternsOutsideCurrentDirectory=Mr.getPatternsInsideCurrentDirectory=Mr.getPositivePatterns=Mr.getNegativePatterns=Mr.isPositivePattern=Mr.isNegativePattern=Mr.convertToNegativePattern=Mr.convertToPositivePattern=Mr.isDynamicPattern=Mr.isStaticPattern=void 0;var KZe=ve("path"),JZe=Iie(),mO=Xo(),wie="**",zZe="\\",XZe=/[*?]|^!/,ZZe=/\[[^[]*]/,$Ze=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,e$e=/[!*+?@]\([^(]*\)/,t$e=/,|\.\./,r$e=/(?!^)\/{2,}/g;function Bie(t,e={}){return!vie(t,e)}Mr.isStaticPattern=Bie;function vie(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(zZe)||XZe.test(t)||ZZe.test(t)||$Ze.test(t)||e.extglob!==!1&&e$e.test(t)||e.braceExpansion!==!1&&n$e(t))}Mr.isDynamicPattern=vie;function n$e(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let o=t.slice(e,r);return t$e.test(o)}function i$e(t){return GP(t)?t.slice(1):t}Mr.convertToPositivePattern=i$e;function s$e(t){return"!"+t}Mr.convertToNegativePattern=s$e;function GP(t){return t.startsWith("!")&&t[1]!=="("}Mr.isNegativePattern=GP;function Die(t){return!GP(t)}Mr.isPositivePattern=Die;function o$e(t){return t.filter(GP)}Mr.getNegativePatterns=o$e;function a$e(t){return t.filter(Die)}Mr.getPositivePatterns=a$e;function l$e(t){return t.filter(e=>!yO(e))}Mr.getPatternsInsideCurrentDirectory=l$e;function c$e(t){return t.filter(yO)}Mr.getPatternsOutsideCurrentDirectory=c$e;function yO(t){return t.startsWith("..")||t.startsWith("./..")}Mr.isPatternRelatedToParentDirectory=yO;function u$e(t){return JZe(t,{flipBackslashes:!1})}Mr.getBaseDirectory=u$e;function A$e(t){return t.includes(wie)}Mr.hasGlobStar=A$e;function Sie(t){return t.endsWith("/"+wie)}Mr.endsWithSlashGlobStar=Sie;function f$e(t){let e=KZe.basename(t);return Sie(t)||Bie(e)}Mr.isAffectDepthOfReadingPattern=f$e;function p$e(t){return t.reduce((e,r)=>e.concat(Pie(r)),[])}Mr.expandPatternsWithBraceExpansion=p$e;function Pie(t){let e=mO.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,o)=>r.length-o.length),e.filter(r=>r!=="")}Mr.expandBraceExpansion=Pie;function h$e(t,e){let{parts:r}=mO.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}Mr.getPatternParts=h$e;function xie(t,e){return mO.makeRe(t,e)}Mr.makeRe=xie;function g$e(t,e){return t.map(r=>xie(r,e))}Mr.convertPatternsToRe=g$e;function d$e(t,e){return e.some(r=>r.test(t))}Mr.matchAny=d$e;function m$e(t){return t.replace(r$e,"/")}Mr.removeDuplicateSlashes=m$e});var Rie=_((pTt,Fie)=>{"use strict";var y$e=ve("stream"),kie=y$e.PassThrough,E$e=Array.prototype.slice;Fie.exports=C$e;function C$e(){let t=[],e=E$e.call(arguments),r=!1,o=e[e.length-1];o&&!Array.isArray(o)&&o.pipe==null?e.pop():o={};let a=o.end!==!1,n=o.pipeError===!0;o.objectMode==null&&(o.objectMode=!0),o.highWaterMark==null&&(o.highWaterMark=64*1024);let u=kie(o);function A(){for(let E=0,w=arguments.length;E0||(r=!1,p())}function b(C){function T(){C.removeListener("merge2UnpipeEnd",T),C.removeListener("end",T),n&&C.removeListener("error",N),D()}function N(U){u.emit("error",U)}if(C._readableState.endEmitted)return D();C.on("merge2UnpipeEnd",T),C.on("end",T),n&&C.on("error",N),C.pipe(u,{end:!1}),C.resume()}for(let C=0;C{"use strict";Object.defineProperty(WP,"__esModule",{value:!0});WP.merge=void 0;var I$e=Rie();function w$e(t){let e=I$e(t);return t.forEach(r=>{r.once("error",o=>e.emit("error",o))}),e.once("close",()=>Tie(t)),e.once("end",()=>Tie(t)),e}WP.merge=w$e;function Tie(t){t.forEach(e=>e.emit("close"))}});var Nie=_(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});ny.isEmpty=ny.isString=void 0;function B$e(t){return typeof t=="string"}ny.isString=B$e;function v$e(t){return t===""}ny.isEmpty=v$e});var Df=_(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.string=wo.stream=wo.pattern=wo.path=wo.fs=wo.errno=wo.array=void 0;var D$e=lie();wo.array=D$e;var S$e=cie();wo.errno=S$e;var P$e=uie();wo.fs=P$e;var x$e=hie();wo.path=x$e;var b$e=bie();wo.pattern=b$e;var k$e=Lie();wo.stream=k$e;var Q$e=Nie();wo.string=Q$e});var _ie=_(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.convertPatternGroupToTask=Bo.convertPatternGroupsToTasks=Bo.groupPatternsByBaseDirectory=Bo.getNegativePatternsAsPositive=Bo.getPositivePatterns=Bo.convertPatternsToTasks=Bo.generate=void 0;var Vc=Df();function F$e(t,e){let r=Oie(t,e),o=Oie(e.ignore,e),a=Mie(r),n=Uie(r,o),u=a.filter(E=>Vc.pattern.isStaticPattern(E,e)),A=a.filter(E=>Vc.pattern.isDynamicPattern(E,e)),p=EO(u,n,!1),h=EO(A,n,!0);return p.concat(h)}Bo.generate=F$e;function Oie(t,e){let r=t;return e.braceExpansion&&(r=Vc.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(o=>o.includes("/")?o:`**/${o}`)),r.map(o=>Vc.pattern.removeDuplicateSlashes(o))}function EO(t,e,r){let o=[],a=Vc.pattern.getPatternsOutsideCurrentDirectory(t),n=Vc.pattern.getPatternsInsideCurrentDirectory(t),u=CO(a),A=CO(n);return o.push(...IO(u,e,r)),"."in A?o.push(wO(".",n,e,r)):o.push(...IO(A,e,r)),o}Bo.convertPatternsToTasks=EO;function Mie(t){return Vc.pattern.getPositivePatterns(t)}Bo.getPositivePatterns=Mie;function Uie(t,e){return Vc.pattern.getNegativePatterns(t).concat(e).map(Vc.pattern.convertToPositivePattern)}Bo.getNegativePatternsAsPositive=Uie;function CO(t){let e={};return t.reduce((r,o)=>{let a=Vc.pattern.getBaseDirectory(o);return a in r?r[a].push(o):r[a]=[o],r},e)}Bo.groupPatternsByBaseDirectory=CO;function IO(t,e,r){return Object.keys(t).map(o=>wO(o,t[o],e,r))}Bo.convertPatternGroupsToTasks=IO;function wO(t,e,r,o){return{dynamic:o,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Vc.pattern.convertToNegativePattern))}}Bo.convertPatternGroupToTask=wO});var qie=_(YP=>{"use strict";Object.defineProperty(YP,"__esModule",{value:!0});YP.read=void 0;function R$e(t,e,r){e.fs.lstat(t,(o,a)=>{if(o!==null){Hie(r,o);return}if(!a.isSymbolicLink()||!e.followSymbolicLink){BO(r,a);return}e.fs.stat(t,(n,u)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){Hie(r,n);return}BO(r,a);return}e.markSymbolicLink&&(u.isSymbolicLink=()=>!0),BO(r,u)})})}YP.read=R$e;function Hie(t,e){t(e)}function BO(t,e){t(null,e)}});var jie=_(VP=>{"use strict";Object.defineProperty(VP,"__esModule",{value:!0});VP.read=void 0;function T$e(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let o=e.fs.statSync(t);return e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),o}catch(o){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw o}}VP.read=T$e});var Gie=_(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.createFileSystemAdapter=th.FILE_SYSTEM_ADAPTER=void 0;var KP=ve("fs");th.FILE_SYSTEM_ADAPTER={lstat:KP.lstat,stat:KP.stat,lstatSync:KP.lstatSync,statSync:KP.statSync};function L$e(t){return t===void 0?th.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},th.FILE_SYSTEM_ADAPTER),t)}th.createFileSystemAdapter=L$e});var Wie=_(DO=>{"use strict";Object.defineProperty(DO,"__esModule",{value:!0});var N$e=Gie(),vO=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=N$e.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};DO.default=vO});var wg=_(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.statSync=rh.stat=rh.Settings=void 0;var Yie=qie(),O$e=jie(),SO=Wie();rh.Settings=SO.default;function M$e(t,e,r){if(typeof e=="function"){Yie.read(t,PO(),e);return}Yie.read(t,PO(e),r)}rh.stat=M$e;function U$e(t,e){let r=PO(e);return O$e.read(t,r)}rh.statSync=U$e;function PO(t={}){return t instanceof SO.default?t:new SO.default(t)}});var Jie=_((BTt,Kie)=>{var Vie;Kie.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(Vie||(Vie=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Xie=_((vTt,zie)=>{zie.exports=H$e;var _$e=Jie();function H$e(t,e){let r,o,a,n=!0;Array.isArray(t)?(r=[],o=t.length):(a=Object.keys(t),r={},o=a.length);function u(p){function h(){e&&e(p,r),e=null}n?_$e(h):h()}function A(p,h,E){r[p]=E,(--o===0||h)&&u(h)}o?a?a.forEach(function(p){t[p](function(h,E){A(p,h,E)})}):t.forEach(function(p,h){p(function(E,w){A(h,E,w)})}):u(null),n=!1}});var xO=_(zP=>{"use strict";Object.defineProperty(zP,"__esModule",{value:!0});zP.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var JP=process.versions.node.split(".");if(JP[0]===void 0||JP[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var Zie=Number.parseInt(JP[0],10),q$e=Number.parseInt(JP[1],10),$ie=10,j$e=10,G$e=Zie>$ie,W$e=Zie===$ie&&q$e>=j$e;zP.IS_SUPPORT_READDIR_WITH_FILE_TYPES=G$e||W$e});var ese=_(XP=>{"use strict";Object.defineProperty(XP,"__esModule",{value:!0});XP.createDirentFromStats=void 0;var bO=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function Y$e(t,e){return new bO(t,e)}XP.createDirentFromStats=Y$e});var kO=_(ZP=>{"use strict";Object.defineProperty(ZP,"__esModule",{value:!0});ZP.fs=void 0;var V$e=ese();ZP.fs=V$e});var QO=_($P=>{"use strict";Object.defineProperty($P,"__esModule",{value:!0});$P.joinPathSegments=void 0;function K$e(t,e,r){return t.endsWith(r)?t+e:t+r+e}$P.joinPathSegments=K$e});var ose=_(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.readdir=nh.readdirWithFileTypes=nh.read=void 0;var J$e=wg(),tse=Xie(),z$e=xO(),rse=kO(),nse=QO();function X$e(t,e,r){if(!e.stats&&z$e.IS_SUPPORT_READDIR_WITH_FILE_TYPES){ise(t,e,r);return}sse(t,e,r)}nh.read=X$e;function ise(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(o,a)=>{if(o!==null){ex(r,o);return}let n=a.map(A=>({dirent:A,name:A.name,path:nse.joinPathSegments(t,A.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){FO(r,n);return}let u=n.map(A=>Z$e(A,e));tse(u,(A,p)=>{if(A!==null){ex(r,A);return}FO(r,p)})})}nh.readdirWithFileTypes=ise;function Z$e(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(o,a)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){r(o);return}r(null,t);return}t.dirent=rse.fs.createDirentFromStats(t.name,a),r(null,t)})}}function sse(t,e,r){e.fs.readdir(t,(o,a)=>{if(o!==null){ex(r,o);return}let n=a.map(u=>{let A=nse.joinPathSegments(t,u,e.pathSegmentSeparator);return p=>{J$e.stat(A,e.fsStatSettings,(h,E)=>{if(h!==null){p(h);return}let w={name:u,path:A,dirent:rse.fs.createDirentFromStats(u,E)};e.stats&&(w.stats=E),p(null,w)})}});tse(n,(u,A)=>{if(u!==null){ex(r,u);return}FO(r,A)})})}nh.readdir=sse;function ex(t,e){t(e)}function FO(t,e){t(null,e)}});var Ase=_(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.readdir=ih.readdirWithFileTypes=ih.read=void 0;var $$e=wg(),eet=xO(),ase=kO(),lse=QO();function tet(t,e){return!e.stats&&eet.IS_SUPPORT_READDIR_WITH_FILE_TYPES?cse(t,e):use(t,e)}ih.read=tet;function cse(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(o=>{let a={dirent:o,name:o.name,path:lse.joinPathSegments(t,o.name,e.pathSegmentSeparator)};if(a.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let n=e.fs.statSync(a.path);a.dirent=ase.fs.createDirentFromStats(a.name,n)}catch(n){if(e.throwErrorOnBrokenSymbolicLink)throw n}return a})}ih.readdirWithFileTypes=cse;function use(t,e){return e.fs.readdirSync(t).map(o=>{let a=lse.joinPathSegments(t,o,e.pathSegmentSeparator),n=$$e.statSync(a,e.fsStatSettings),u={name:o,path:a,dirent:ase.fs.createDirentFromStats(o,n)};return e.stats&&(u.stats=n),u})}ih.readdir=use});var fse=_(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.createFileSystemAdapter=sh.FILE_SYSTEM_ADAPTER=void 0;var iy=ve("fs");sh.FILE_SYSTEM_ADAPTER={lstat:iy.lstat,stat:iy.stat,lstatSync:iy.lstatSync,statSync:iy.statSync,readdir:iy.readdir,readdirSync:iy.readdirSync};function ret(t){return t===void 0?sh.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},sh.FILE_SYSTEM_ADAPTER),t)}sh.createFileSystemAdapter=ret});var pse=_(TO=>{"use strict";Object.defineProperty(TO,"__esModule",{value:!0});var net=ve("path"),iet=wg(),set=fse(),RO=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=set.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,net.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new iet.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};TO.default=RO});var tx=_(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.Settings=oh.scandirSync=oh.scandir=void 0;var hse=ose(),oet=Ase(),LO=pse();oh.Settings=LO.default;function aet(t,e,r){if(typeof e=="function"){hse.read(t,NO(),e);return}hse.read(t,NO(e),r)}oh.scandir=aet;function cet(t,e){let r=NO(e);return oet.read(t,r)}oh.scandirSync=cet;function NO(t={}){return t instanceof LO.default?t:new LO.default(t)}});var dse=_((TTt,gse)=>{"use strict";function uet(t){var e=new t,r=e;function o(){var n=e;return n.next?e=n.next:(e=new t,r=e),n.next=null,n}function a(n){r.next=n,r=n}return{get:o,release:a}}gse.exports=uet});var yse=_((LTt,OO)=>{"use strict";var Aet=dse();function mse(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var o=Aet(fet),a=null,n=null,u=0,A=null,p={push:T,drain:Yl,saturated:Yl,pause:E,paused:!1,get concurrency(){return r},set concurrency(ce){if(!(ce>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=ce,!p.paused)for(;a&&u=r||p.paused?n?(n.next=Ie,n=Ie):(a=Ie,n=Ie,p.saturated()):(u++,e.call(t,Ie.value,Ie.worked))}function N(ce,ue){var Ie=o.get();Ie.context=t,Ie.release=U,Ie.value=ce,Ie.callback=ue||Yl,Ie.errorHandler=A,u>=r||p.paused?a?(Ie.next=a,a=Ie):(a=Ie,n=Ie,p.saturated()):(u++,e.call(t,Ie.value,Ie.worked))}function U(ce){ce&&o.release(ce);var ue=a;ue&&u<=r?p.paused?u--:(n===a&&(n=null),a=ue.next,ue.next=null,e.call(t,ue.value,ue.worked),n===null&&p.empty()):--u===0&&p.drain()}function J(){a=null,n=null,p.drain=Yl}function te(){a=null,n=null,p.drain(),p.drain=Yl}function le(ce){A=ce}}function Yl(){}function fet(){this.value=null,this.callback=Yl,this.next=null,this.release=Yl,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,o){var a=t.callback,n=t.errorHandler,u=t.value;t.value=null,t.callback=Yl,t.errorHandler&&n(r,u),a.call(t.context,r,o),t.release(t)}}function pet(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function o(E,w){e.call(this,E).then(function(D){w(null,D)},w)}var a=mse(t,o,r),n=a.push,u=a.unshift;return a.push=A,a.unshift=p,a.drained=h,a;function A(E){var w=new Promise(function(D,b){n(E,function(C,T){if(C){b(C);return}D(T)})});return w.catch(Yl),w}function p(E){var w=new Promise(function(D,b){u(E,function(C,T){if(C){b(C);return}D(T)})});return w.catch(Yl),w}function h(){if(a.idle())return new Promise(function(D){D()});var E=a.drain,w=new Promise(function(D){a.drain=function(){E(),D()}});return w}}OO.exports=mse;OO.exports.promise=pet});var rx=_(eA=>{"use strict";Object.defineProperty(eA,"__esModule",{value:!0});eA.joinPathSegments=eA.replacePathSegmentSeparator=eA.isAppliedFilter=eA.isFatalError=void 0;function het(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}eA.isFatalError=het;function get(t,e){return t===null||t(e)}eA.isAppliedFilter=get;function det(t,e){return t.split(/[/\\]/).join(e)}eA.replacePathSegmentSeparator=det;function met(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}eA.joinPathSegments=met});var _O=_(UO=>{"use strict";Object.defineProperty(UO,"__esModule",{value:!0});var yet=rx(),MO=class{constructor(e,r){this._root=e,this._settings=r,this._root=yet.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};UO.default=MO});var jO=_(qO=>{"use strict";Object.defineProperty(qO,"__esModule",{value:!0});var Eet=ve("events"),Cet=tx(),Iet=yse(),nx=rx(),wet=_O(),HO=class extends wet.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=Cet.scandir,this._emitter=new Eet.EventEmitter,this._queue=Iet(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let o={directory:e,base:r};this._queue.push(o,a=>{a!==null&&this._handleError(a)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(o,a)=>{if(o!==null){r(o,void 0);return}for(let n of a)this._handleEntry(n,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!nx.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let o=e.path;r!==void 0&&(e.path=nx.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),nx.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&nx.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(o,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};qO.default=HO});var Ese=_(WO=>{"use strict";Object.defineProperty(WO,"__esModule",{value:!0});var Bet=jO(),GO=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new Bet.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{vet(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{Det(e,this._storage)}),this._reader.read()}};WO.default=GO;function vet(t,e){t(e)}function Det(t,e){t(null,e)}});var Cse=_(VO=>{"use strict";Object.defineProperty(VO,"__esModule",{value:!0});var Pet=ve("stream"),xet=jO(),YO=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new xet.default(this._root,this._settings),this._stream=new Pet.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};VO.default=YO});var Ise=_(JO=>{"use strict";Object.defineProperty(JO,"__esModule",{value:!0});var bet=tx(),ix=rx(),ket=_O(),KO=class extends ket.default{constructor(){super(...arguments),this._scandir=bet.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let o=this._scandir(e,this._settings.fsScandirSettings);for(let a of o)this._handleEntry(a,r)}catch(o){this._handleError(o)}}_handleError(e){if(ix.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let o=e.path;r!==void 0&&(e.path=ix.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),ix.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&ix.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(o,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};JO.default=KO});var wse=_(XO=>{"use strict";Object.defineProperty(XO,"__esModule",{value:!0});var Qet=Ise(),zO=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new Qet.default(this._root,this._settings)}read(){return this._reader.read()}};XO.default=zO});var Bse=_($O=>{"use strict";Object.defineProperty($O,"__esModule",{value:!0});var Fet=ve("path"),Ret=tx(),ZO=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,Fet.sep),this.fsScandirSettings=new Ret.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};$O.default=ZO});var ox=_(tA=>{"use strict";Object.defineProperty(tA,"__esModule",{value:!0});tA.Settings=tA.walkStream=tA.walkSync=tA.walk=void 0;var vse=Ese(),Tet=Cse(),Let=wse(),eM=Bse();tA.Settings=eM.default;function Net(t,e,r){if(typeof e=="function"){new vse.default(t,sx()).read(e);return}new vse.default(t,sx(e)).read(r)}tA.walk=Net;function Oet(t,e){let r=sx(e);return new Let.default(t,r).read()}tA.walkSync=Oet;function Met(t,e){let r=sx(e);return new Tet.default(t,r).read()}tA.walkStream=Met;function sx(t={}){return t instanceof eM.default?t:new eM.default(t)}});var ax=_(rM=>{"use strict";Object.defineProperty(rM,"__esModule",{value:!0});var Uet=ve("path"),_et=wg(),Dse=Df(),tM=class{constructor(e){this._settings=e,this._fsStatSettings=new _et.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return Uet.resolve(this._settings.cwd,e)}_makeEntry(e,r){let o={name:r,path:r,dirent:Dse.fs.createDirentFromStats(r,e)};return this._settings.stats&&(o.stats=e),o}_isFatalError(e){return!Dse.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};rM.default=tM});var sM=_(iM=>{"use strict";Object.defineProperty(iM,"__esModule",{value:!0});var Het=ve("stream"),qet=wg(),jet=ox(),Get=ax(),nM=class extends Get.default{constructor(){super(...arguments),this._walkStream=jet.walkStream,this._stat=qet.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let o=e.map(this._getFullEntryPath,this),a=new Het.PassThrough({objectMode:!0});a._write=(n,u,A)=>this._getEntry(o[n],e[n],r).then(p=>{p!==null&&r.entryFilter(p)&&a.push(p),n===o.length-1&&a.end(),A()}).catch(A);for(let n=0;nthis._makeEntry(a,r)).catch(a=>{if(o.errorFilter(a))return null;throw a})}_getStat(e){return new Promise((r,o)=>{this._stat(e,this._fsStatSettings,(a,n)=>a===null?r(n):o(a))})}};iM.default=nM});var Sse=_(aM=>{"use strict";Object.defineProperty(aM,"__esModule",{value:!0});var Wet=ox(),Yet=ax(),Vet=sM(),oM=class extends Yet.default{constructor(){super(...arguments),this._walkAsync=Wet.walk,this._readerStream=new Vet.default(this._settings)}dynamic(e,r){return new Promise((o,a)=>{this._walkAsync(e,r,(n,u)=>{n===null?o(u):a(n)})})}async static(e,r){let o=[],a=this._readerStream.static(e,r);return new Promise((n,u)=>{a.once("error",u),a.on("data",A=>o.push(A)),a.once("end",()=>n(o))})}};aM.default=oM});var Pse=_(cM=>{"use strict";Object.defineProperty(cM,"__esModule",{value:!0});var m1=Df(),lM=class{constructor(e,r,o){this._patterns=e,this._settings=r,this._micromatchOptions=o,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),o=this._splitSegmentsIntoSections(r);this._storage.push({complete:o.length<=1,pattern:e,segments:r,sections:o})}}_getPatternSegments(e){return m1.pattern.getPatternParts(e,this._micromatchOptions).map(o=>m1.pattern.isDynamicPattern(o,this._settings)?{dynamic:!0,pattern:o,patternRe:m1.pattern.makeRe(o,this._micromatchOptions)}:{dynamic:!1,pattern:o})}_splitSegmentsIntoSections(e){return m1.array.splitWhen(e,r=>r.dynamic&&m1.pattern.hasGlobStar(r.pattern))}};cM.default=lM});var xse=_(AM=>{"use strict";Object.defineProperty(AM,"__esModule",{value:!0});var Ket=Pse(),uM=class extends Ket.default{match(e){let r=e.split("/"),o=r.length,a=this._storage.filter(n=>!n.complete||n.segments.length>o);for(let n of a){let u=n.sections[0];if(!n.complete&&o>u.length||r.every((p,h)=>{let E=n.segments[h];return!!(E.dynamic&&E.patternRe.test(p)||!E.dynamic&&E.pattern===p)}))return!0}return!1}};AM.default=uM});var bse=_(pM=>{"use strict";Object.defineProperty(pM,"__esModule",{value:!0});var lx=Df(),Jet=xse(),fM=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,o){let a=this._getMatcher(r),n=this._getNegativePatternsRe(o);return u=>this._filter(e,u,a,n)}_getMatcher(e){return new Jet.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(lx.pattern.isAffectDepthOfReadingPattern);return lx.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,o,a){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let n=lx.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(n,o)?!1:this._isSkippedByNegativePatterns(n,a)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let o=r.split("/").length;if(e==="")return o;let a=e.split("/").length;return o-a}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!lx.pattern.matchAny(e,r)}};pM.default=fM});var kse=_(gM=>{"use strict";Object.defineProperty(gM,"__esModule",{value:!0});var Bg=Df(),hM=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let o=Bg.pattern.convertPatternsToRe(e,this._micromatchOptions),a=Bg.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}));return n=>this._filter(n,o,a)}_filter(e,r,o){let a=Bg.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(a)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e)||this._isSkippedByAbsoluteNegativePatterns(a,o))return!1;let n=e.dirent.isDirectory(),u=this._isMatchToPatterns(a,r,n)&&!this._isMatchToPatterns(a,o,n);return this._settings.unique&&u&&this._createIndexRecord(a),u}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isSkippedByAbsoluteNegativePatterns(e,r){if(!this._settings.absolute)return!1;let o=Bg.path.makeAbsolute(this._settings.cwd,e);return Bg.pattern.matchAny(o,r)}_isMatchToPatterns(e,r,o){let a=Bg.pattern.matchAny(e,r);return!a&&o?Bg.pattern.matchAny(e+"/",r):a}};gM.default=hM});var Qse=_(mM=>{"use strict";Object.defineProperty(mM,"__esModule",{value:!0});var zet=Df(),dM=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return zet.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};mM.default=dM});var Rse=_(EM=>{"use strict";Object.defineProperty(EM,"__esModule",{value:!0});var Fse=Df(),yM=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Fse.path.makeAbsolute(this._settings.cwd,r),r=Fse.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};EM.default=yM});var cx=_(IM=>{"use strict";Object.defineProperty(IM,"__esModule",{value:!0});var Xet=ve("path"),Zet=bse(),$et=kse(),ett=Qse(),ttt=Rse(),CM=class{constructor(e){this._settings=e,this.errorFilter=new ett.default(this._settings),this.entryFilter=new $et.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Zet.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new ttt.default(this._settings)}_getRootDirectory(e){return Xet.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};IM.default=CM});var Tse=_(BM=>{"use strict";Object.defineProperty(BM,"__esModule",{value:!0});var rtt=Sse(),ntt=cx(),wM=class extends ntt.default{constructor(){super(...arguments),this._reader=new rtt.default(this._settings)}async read(e){let r=this._getRootDirectory(e),o=this._getReaderOptions(e);return(await this.api(r,e,o)).map(n=>o.transform(n))}api(e,r,o){return r.dynamic?this._reader.dynamic(e,o):this._reader.static(r.patterns,o)}};BM.default=wM});var Lse=_(DM=>{"use strict";Object.defineProperty(DM,"__esModule",{value:!0});var itt=ve("stream"),stt=sM(),ott=cx(),vM=class extends ott.default{constructor(){super(...arguments),this._reader=new stt.default(this._settings)}read(e){let r=this._getRootDirectory(e),o=this._getReaderOptions(e),a=this.api(r,e,o),n=new itt.Readable({objectMode:!0,read:()=>{}});return a.once("error",u=>n.emit("error",u)).on("data",u=>n.emit("data",o.transform(u))).once("end",()=>n.emit("end")),n.once("close",()=>a.destroy()),n}api(e,r,o){return r.dynamic?this._reader.dynamic(e,o):this._reader.static(r.patterns,o)}};DM.default=vM});var Nse=_(PM=>{"use strict";Object.defineProperty(PM,"__esModule",{value:!0});var att=wg(),ltt=ox(),ctt=ax(),SM=class extends ctt.default{constructor(){super(...arguments),this._walkSync=ltt.walkSync,this._statSync=att.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let o=[];for(let a of e){let n=this._getFullEntryPath(a),u=this._getEntry(n,a,r);u===null||!r.entryFilter(u)||o.push(u)}return o}_getEntry(e,r,o){try{let a=this._getStat(e);return this._makeEntry(a,r)}catch(a){if(o.errorFilter(a))return null;throw a}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};PM.default=SM});var Ose=_(bM=>{"use strict";Object.defineProperty(bM,"__esModule",{value:!0});var utt=Nse(),Att=cx(),xM=class extends Att.default{constructor(){super(...arguments),this._reader=new utt.default(this._settings)}read(e){let r=this._getRootDirectory(e),o=this._getReaderOptions(e);return this.api(r,e,o).map(o.transform)}api(e,r,o){return r.dynamic?this._reader.dynamic(e,o):this._reader.static(r.patterns,o)}};bM.default=xM});var Mse=_(oy=>{"use strict";Object.defineProperty(oy,"__esModule",{value:!0});oy.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var sy=ve("fs"),ftt=ve("os"),ptt=Math.max(ftt.cpus().length,1);oy.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:sy.lstat,lstatSync:sy.lstatSync,stat:sy.stat,statSync:sy.statSync,readdir:sy.readdir,readdirSync:sy.readdirSync};var kM=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,ptt),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},oy.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};oy.default=kM});var ux=_((oLt,_se)=>{"use strict";var Use=_ie(),htt=Tse(),gtt=Lse(),dtt=Ose(),QM=Mse(),Vl=Df();async function FM(t,e){Kc(t);let r=RM(t,htt.default,e),o=await Promise.all(r);return Vl.array.flatten(o)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(h,E){Kc(h);let w=RM(h,dtt.default,E);return Vl.array.flatten(w)}t.sync=e;function r(h,E){Kc(h);let w=RM(h,gtt.default,E);return Vl.stream.merge(w)}t.stream=r;function o(h,E){Kc(h);let w=[].concat(h),D=new QM.default(E);return Use.generate(w,D)}t.generateTasks=o;function a(h,E){Kc(h);let w=new QM.default(E);return Vl.pattern.isDynamicPattern(h,w)}t.isDynamicPattern=a;function n(h){return Kc(h),Vl.path.escape(h)}t.escapePath=n;function u(h){return Kc(h),Vl.path.convertPathToPattern(h)}t.convertPathToPattern=u;let A;(function(h){function E(D){return Kc(D),Vl.path.escapePosixPath(D)}h.escapePath=E;function w(D){return Kc(D),Vl.path.convertPosixPathToPattern(D)}h.convertPathToPattern=w})(A=t.posix||(t.posix={}));let p;(function(h){function E(D){return Kc(D),Vl.path.escapeWindowsPath(D)}h.escapePath=E;function w(D){return Kc(D),Vl.path.convertWindowsPathToPattern(D)}h.convertPathToPattern=w})(p=t.win32||(t.win32={}))})(FM||(FM={}));function RM(t,e,r){let o=[].concat(t),a=new QM.default(r),n=Use.generate(o,a),u=new e(a);return n.map(u.read,u)}function Kc(t){if(![].concat(t).every(o=>Vl.string.isString(o)&&!Vl.string.isEmpty(o)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}_se.exports=FM});var bn={};Vt(bn,{checksumFile:()=>fx,checksumPattern:()=>px,makeHash:()=>Ji});function Ji(...t){let e=(0,Ax.createHash)("sha512"),r="";for(let o of t)typeof o=="string"?r+=o:o&&(r&&(e.update(r),r=""),e.update(o));return r&&e.update(r),e.digest("hex")}async function fx(t,{baseFs:e,algorithm:r}={baseFs:ae,algorithm:"sha512"}){let o=await e.openPromise(t,"r");try{let n=Buffer.allocUnsafeSlow(65536),u=(0,Ax.createHash)(r),A=0;for(;(A=await e.readPromise(o,n,0,65536))!==0;)u.update(A===65536?n:n.slice(0,A));return u.digest("hex")}finally{await e.closePromise(o)}}async function px(t,{cwd:e}){let o=(await(0,TM.default)(t,{cwd:Ae.fromPortablePath(e),onlyDirectories:!0})).map(A=>`${A}/**/*`),a=await(0,TM.default)([t,...o],{cwd:Ae.fromPortablePath(e),onlyFiles:!1});a.sort();let n=await Promise.all(a.map(async A=>{let p=[Buffer.from(A)],h=V.join(e,Ae.toPortablePath(A)),E=await ae.lstatPromise(h);return E.isSymbolicLink()?p.push(Buffer.from(await ae.readlinkPromise(h))):E.isFile()&&p.push(await ae.readFilePromise(h)),p.join("\0")})),u=(0,Ax.createHash)("sha512");for(let A of n)u.update(A);return u.digest("hex")}var Ax,TM,ah=It(()=>{St();Ax=ve("crypto"),TM=et(ux())});var G={};Vt(G,{allPeerRequests:()=>P1,areDescriptorsEqual:()=>Wse,areIdentsEqual:()=>w1,areLocatorsEqual:()=>B1,areVirtualPackagesEquivalent:()=>Dtt,bindDescriptor:()=>Btt,bindLocator:()=>vtt,convertDescriptorToLocator:()=>hx,convertLocatorToDescriptor:()=>NM,convertPackageToLocator:()=>Ctt,convertToIdent:()=>Ett,convertToManifestRange:()=>Ltt,copyPackage:()=>E1,devirtualizeDescriptor:()=>C1,devirtualizeLocator:()=>I1,ensureDevirtualizedDescriptor:()=>Itt,ensureDevirtualizedLocator:()=>wtt,getIdentVendorPath:()=>_M,isPackageCompatible:()=>Ex,isVirtualDescriptor:()=>Sf,isVirtualLocator:()=>Jc,makeDescriptor:()=>kn,makeIdent:()=>rA,makeLocator:()=>Ps,makeRange:()=>mx,parseDescriptor:()=>lh,parseFileStyleRange:()=>Rtt,parseIdent:()=>Zo,parseLocator:()=>Pf,parseRange:()=>vg,prettyDependent:()=>fO,prettyDescriptor:()=>Jn,prettyIdent:()=>Ui,prettyLocator:()=>jr,prettyLocatorNoColors:()=>AO,prettyRange:()=>cy,prettyReference:()=>D1,prettyResolution:()=>d1,prettyWorkspace:()=>S1,renamePackage:()=>OM,slugifyIdent:()=>LM,slugifyLocator:()=>ly,sortDescriptors:()=>uy,stringifyDescriptor:()=>ka,stringifyIdent:()=>rn,stringifyLocator:()=>Qa,tryParseDescriptor:()=>v1,tryParseIdent:()=>Yse,tryParseLocator:()=>dx,tryParseRange:()=>Ftt,virtualizeDescriptor:()=>MM,virtualizePackage:()=>UM});function rA(t,e){if(t?.startsWith("@"))throw new Error("Invalid scope: don't prefix it with '@'");return{identHash:Ji(t,e),scope:t,name:e}}function kn(t,e){return{identHash:t.identHash,scope:t.scope,name:t.name,descriptorHash:Ji(t.identHash,e),range:e}}function Ps(t,e){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:Ji(t.identHash,e),reference:e}}function Ett(t){return{identHash:t.identHash,scope:t.scope,name:t.name}}function hx(t){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:t.descriptorHash,reference:t.range}}function NM(t){return{identHash:t.identHash,scope:t.scope,name:t.name,descriptorHash:t.locatorHash,range:t.reference}}function Ctt(t){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:t.locatorHash,reference:t.reference}}function OM(t,e){return{identHash:e.identHash,scope:e.scope,name:e.name,locatorHash:e.locatorHash,reference:e.reference,version:t.version,languageName:t.languageName,linkType:t.linkType,conditions:t.conditions,dependencies:new Map(t.dependencies),peerDependencies:new Map(t.peerDependencies),dependenciesMeta:new Map(t.dependenciesMeta),peerDependenciesMeta:new Map(t.peerDependenciesMeta),bin:new Map(t.bin)}}function E1(t){return OM(t,t)}function MM(t,e){if(e.includes("#"))throw new Error("Invalid entropy");return kn(t,`virtual:${e}#${t.range}`)}function UM(t,e){if(e.includes("#"))throw new Error("Invalid entropy");return OM(t,Ps(t,`virtual:${e}#${t.reference}`))}function Sf(t){return t.range.startsWith(y1)}function Jc(t){return t.reference.startsWith(y1)}function C1(t){if(!Sf(t))throw new Error("Not a virtual descriptor");return kn(t,t.range.replace(gx,""))}function I1(t){if(!Jc(t))throw new Error("Not a virtual descriptor");return Ps(t,t.reference.replace(gx,""))}function Itt(t){return Sf(t)?kn(t,t.range.replace(gx,"")):t}function wtt(t){return Jc(t)?Ps(t,t.reference.replace(gx,"")):t}function Btt(t,e){return t.range.includes("::")?t:kn(t,`${t.range}::${ay.default.stringify(e)}`)}function vtt(t,e){return t.reference.includes("::")?t:Ps(t,`${t.reference}::${ay.default.stringify(e)}`)}function w1(t,e){return t.identHash===e.identHash}function Wse(t,e){return t.descriptorHash===e.descriptorHash}function B1(t,e){return t.locatorHash===e.locatorHash}function Dtt(t,e){if(!Jc(t))throw new Error("Invalid package type");if(!Jc(e))throw new Error("Invalid package type");if(!w1(t,e)||t.dependencies.size!==e.dependencies.size)return!1;for(let r of t.dependencies.values()){let o=e.dependencies.get(r.identHash);if(!o||!Wse(r,o))return!1}return!0}function Zo(t){let e=Yse(t);if(!e)throw new Error(`Invalid ident (${t})`);return e}function Yse(t){let e=t.match(Stt);if(!e)return null;let[,r,o]=e;return rA(typeof r<"u"?r:null,o)}function lh(t,e=!1){let r=v1(t,e);if(!r)throw new Error(`Invalid descriptor (${t})`);return r}function v1(t,e=!1){let r=e?t.match(Ptt):t.match(xtt);if(!r)return null;let[,o,a,n]=r;if(n==="unknown")throw new Error(`Invalid range (${t})`);let u=typeof o<"u"?o:null,A=typeof n<"u"?n:"unknown";return kn(rA(u,a),A)}function Pf(t,e=!1){let r=dx(t,e);if(!r)throw new Error(`Invalid locator (${t})`);return r}function dx(t,e=!1){let r=e?t.match(btt):t.match(ktt);if(!r)return null;let[,o,a,n]=r;if(n==="unknown")throw new Error(`Invalid reference (${t})`);let u=typeof o<"u"?o:null,A=typeof n<"u"?n:"unknown";return Ps(rA(u,a),A)}function vg(t,e){let r=t.match(Qtt);if(r===null)throw new Error(`Invalid range (${t})`);let o=typeof r[1]<"u"?r[1]:null;if(typeof e?.requireProtocol=="string"&&o!==e.requireProtocol)throw new Error(`Invalid protocol (${o})`);if(e?.requireProtocol&&o===null)throw new Error(`Missing protocol (${o})`);let a=typeof r[3]<"u"?decodeURIComponent(r[2]):null;if(e?.requireSource&&a===null)throw new Error(`Missing source (${t})`);let n=typeof r[3]<"u"?decodeURIComponent(r[3]):decodeURIComponent(r[2]),u=e?.parseSelector?ay.default.parse(n):n,A=typeof r[4]<"u"?ay.default.parse(r[4]):null;return{protocol:o,source:a,selector:u,params:A}}function Ftt(t,e){try{return vg(t,e)}catch{return null}}function Rtt(t,{protocol:e}){let{selector:r,params:o}=vg(t,{requireProtocol:e,requireBindings:!0});if(typeof o.locator!="string")throw new Error(`Assertion failed: Invalid bindings for ${t}`);return{parentLocator:Pf(o.locator,!0),path:r}}function Hse(t){return t=t.replaceAll("%","%25"),t=t.replaceAll(":","%3A"),t=t.replaceAll("#","%23"),t}function Ttt(t){return t===null?!1:Object.entries(t).length>0}function mx({protocol:t,source:e,selector:r,params:o}){let a="";return t!==null&&(a+=`${t}`),e!==null&&(a+=`${Hse(e)}#`),a+=Hse(r),Ttt(o)&&(a+=`::${ay.default.stringify(o)}`),a}function Ltt(t){let{params:e,protocol:r,source:o,selector:a}=vg(t);for(let n in e)n.startsWith("__")&&delete e[n];return mx({protocol:r,source:o,params:e,selector:a})}function rn(t){return t.scope?`@${t.scope}/${t.name}`:`${t.name}`}function ka(t){return t.scope?`@${t.scope}/${t.name}@${t.range}`:`${t.name}@${t.range}`}function Qa(t){return t.scope?`@${t.scope}/${t.name}@${t.reference}`:`${t.name}@${t.reference}`}function LM(t){return t.scope!==null?`@${t.scope}-${t.name}`:t.name}function ly(t){let{protocol:e,selector:r}=vg(t.reference),o=e!==null?e.replace(Ntt,""):"exotic",a=qse.default.valid(r),n=a!==null?`${o}-${a}`:`${o}`,u=10;return t.scope?`${LM(t)}-${n}-${t.locatorHash.slice(0,u)}`:`${LM(t)}-${n}-${t.locatorHash.slice(0,u)}`}function Ui(t,e){return e.scope?`${Ut(t,`@${e.scope}/`,Ct.SCOPE)}${Ut(t,e.name,Ct.NAME)}`:`${Ut(t,e.name,Ct.NAME)}`}function yx(t){if(t.startsWith(y1)){let e=yx(t.substring(t.indexOf("#")+1)),r=t.substring(y1.length,y1.length+mtt);return`${e} [${r}]`}else return t.replace(Ott,"?[...]")}function cy(t,e){return`${Ut(t,yx(e),Ct.RANGE)}`}function Jn(t,e){return`${Ui(t,e)}${Ut(t,"@",Ct.RANGE)}${cy(t,e.range)}`}function D1(t,e){return`${Ut(t,yx(e),Ct.REFERENCE)}`}function jr(t,e){return`${Ui(t,e)}${Ut(t,"@",Ct.REFERENCE)}${D1(t,e.reference)}`}function AO(t){return`${rn(t)}@${yx(t.reference)}`}function uy(t){return Ss(t,[e=>rn(e),e=>e.range])}function S1(t,e){return Ui(t,e.anchoredLocator)}function d1(t,e,r){let o=Sf(e)?C1(e):e;return r===null?`${Jn(t,o)} \u2192 ${uO(t).Cross}`:o.identHash===r.identHash?`${Jn(t,o)} \u2192 ${D1(t,r.reference)}`:`${Jn(t,o)} \u2192 ${jr(t,r)}`}function fO(t,e,r){return r===null?`${jr(t,e)}`:`${jr(t,e)} (via ${cy(t,r.range)})`}function _M(t){return`node_modules/${rn(t)}`}function Ex(t,e){return t.conditions?ytt(t.conditions,r=>{let[,o,a]=r.match(Gse),n=e[o];return n?n.includes(a):!0}):!0}function P1(t){let e=new Set;if("children"in t)e.add(t);else for(let r of t.requests.values())e.add(r);for(let r of e)for(let o of r.children.values())e.add(o);return e}var ay,qse,jse,y1,mtt,Gse,ytt,gx,Stt,Ptt,xtt,btt,ktt,Qtt,Ntt,Ott,Io=It(()=>{ay=et(ve("querystring")),qse=et(ni()),jse=et(MX());Wl();ah();Gl();Io();y1="virtual:",mtt=5,Gse=/(os|cpu|libc)=([a-z0-9_-]+)/,ytt=(0,jse.makeParser)(Gse);gx=/^[^#]*#/;Stt=/^(?:@([^/]+?)\/)?([^@/]+)$/;Ptt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))$/,xtt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))?$/;btt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))$/,ktt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))?$/;Qtt=/^([^#:]*:)?((?:(?!::)[^#])*)(?:#((?:(?!::).)*))?(?:::(.*))?$/;Ntt=/:$/;Ott=/\?.*/});var Vse,Kse=It(()=>{Io();Vse={hooks:{reduceDependency:(t,e,r,o,{resolver:a,resolveOptions:n})=>{for(let{pattern:u,reference:A}of e.topLevelWorkspace.manifest.resolutions){if(u.from&&(u.from.fullName!==rn(r)||e.configuration.normalizeLocator(Ps(Zo(u.from.fullName),u.from.description??r.reference)).locatorHash!==r.locatorHash)||u.descriptor.fullName!==rn(t)||e.configuration.normalizeDependency(kn(Pf(u.descriptor.fullName),u.descriptor.description??t.range)).descriptorHash!==t.descriptorHash)continue;return a.bindDescriptor(e.configuration.normalizeDependency(kn(t,A)),e.topLevelWorkspace.anchoredLocator,n)}return t},validateProject:async(t,e)=>{for(let r of t.workspaces){let o=S1(t.configuration,r);await t.configuration.triggerHook(a=>a.validateWorkspace,r,{reportWarning:(a,n)=>e.reportWarning(a,`${o}: ${n}`),reportError:(a,n)=>e.reportError(a,`${o}: ${n}`)})}},validateWorkspace:async(t,e)=>{let{manifest:r}=t;r.resolutions.length&&t.cwd!==t.project.cwd&&r.errors.push(new Error("Resolutions field will be ignored"));for(let o of r.errors)e.reportWarning(57,o.message)}}}});var ci,Dg=It(()=>{ci=class t{static{this.protocol="workspace:"}supportsDescriptor(e,r){return!!(e.range.startsWith(t.protocol)||r.project.tryWorkspaceByDescriptor(e)!==null)}supportsLocator(e,r){return!!e.reference.startsWith(t.protocol)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){return[o.project.getWorkspaceByDescriptor(e).anchoredLocator]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let o=r.project.getWorkspaceByCwd(e.reference.slice(t.protocol.length));return{...e,version:o.manifest.version||"0.0.0",languageName:"unknown",linkType:"SOFT",conditions:null,dependencies:r.project.configuration.normalizeDependencyMap(new Map([...o.manifest.dependencies,...o.manifest.devDependencies])),peerDependencies:new Map([...o.manifest.peerDependencies]),dependenciesMeta:o.manifest.dependenciesMeta,peerDependenciesMeta:o.manifest.peerDependenciesMeta,bin:o.manifest.bin}}}});var Ur={};Vt(Ur,{SemVer:()=>$se.SemVer,clean:()=>Utt,getComparator:()=>Xse,mergeComparators:()=>HM,satisfiesWithPrereleases:()=>nA,simplifyRanges:()=>qM,stringifyComparator:()=>Zse,validRange:()=>Fa});function nA(t,e,r=!1){if(!t)return!1;let o=`${e}${r}`,a=Jse.get(o);if(typeof a>"u")try{a=new xf.default.Range(e,{includePrerelease:!0,loose:r})}catch{return!1}finally{Jse.set(o,a||null)}else if(a===null)return!1;let n;try{n=new xf.default.SemVer(t,a)}catch{return!1}return a.test(n)?!0:(n.prerelease&&(n.prerelease=[]),a.set.some(u=>{for(let A of u)A.semver.prerelease&&(A.semver.prerelease=[]);return u.every(A=>A.test(n))}))}function Fa(t){if(t.indexOf(":")!==-1)return null;let e=zse.get(t);if(typeof e<"u")return e;try{e=new xf.default.Range(t)}catch{e=null}return zse.set(t,e),e}function Utt(t){let e=Mtt.exec(t);return e?e[1]:null}function Xse(t){if(t.semver===xf.default.Comparator.ANY)return{gt:null,lt:null};switch(t.operator){case"":return{gt:[">=",t.semver],lt:["<=",t.semver]};case">":case">=":return{gt:[t.operator,t.semver],lt:null};case"<":case"<=":return{gt:null,lt:[t.operator,t.semver]};default:throw new Error(`Assertion failed: Unexpected comparator operator (${t.operator})`)}}function HM(t){if(t.length===0)return null;let e=null,r=null;for(let o of t){if(o.gt){let a=e!==null?xf.default.compare(o.gt[1],e[1]):null;(a===null||a>0||a===0&&o.gt[0]===">")&&(e=o.gt)}if(o.lt){let a=r!==null?xf.default.compare(o.lt[1],r[1]):null;(a===null||a<0||a===0&&o.lt[0]==="<")&&(r=o.lt)}}if(e&&r){let o=xf.default.compare(e[1],r[1]);if(o===0&&(e[0]===">"||r[0]==="<")||o>0)return null}return{gt:e,lt:r}}function Zse(t){if(t.gt&&t.lt){if(t.gt[0]===">="&&t.lt[0]==="<="&&t.gt[1].version===t.lt[1].version)return t.gt[1].version;if(t.gt[0]===">="&&t.lt[0]==="<"){if(t.lt[1].version===`${t.gt[1].major+1}.0.0-0`)return`^${t.gt[1].version}`;if(t.lt[1].version===`${t.gt[1].major}.${t.gt[1].minor+1}.0-0`)return`~${t.gt[1].version}`}}let e=[];return t.gt&&e.push(t.gt[0]+t.gt[1].version),t.lt&&e.push(t.lt[0]+t.lt[1].version),e.length?e.join(" "):"*"}function qM(t){let e=t.map(_tt).map(o=>Fa(o).set.map(a=>a.map(n=>Xse(n)))),r=e.shift().map(o=>HM(o)).filter(o=>o!==null);for(let o of e){let a=[];for(let n of r)for(let u of o){let A=HM([n,...u]);A!==null&&a.push(A)}r=a}return r.length===0?null:r.map(o=>Zse(o)).join(" || ")}function _tt(t){let e=t.split("||");if(e.length>1){let r=new Set;for(let o of e)e.some(a=>a!==o&&xf.default.subset(o,a))||r.add(o);if(r.size{xf=et(ni()),$se=et(ni()),Jse=new Map;zse=new Map;Mtt=/^(?:[\sv=]*?)((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\s*)$/});function eoe(t){let e=t.match(/^[ \t]+/m);return e?e[0]:" "}function toe(t){return t.charCodeAt(0)===65279?t.slice(1):t}function $o(t){return t.replace(/\\/g,"/")}function Cx(t,{yamlCompatibilityMode:e}){return e?nO(t):typeof t>"u"||typeof t=="boolean"?t:null}function roe(t,e){let r=e.search(/[^!]/);if(r===-1)return"invalid";let o=r%2===0?"":"!",a=e.slice(r);return`${o}${t}=${a}`}function jM(t,e){return e.length===1?roe(t,e[0]):`(${e.map(r=>roe(t,r)).join(" | ")})`}var noe,_t,Ay=It(()=>{St();Ol();noe=et(ni());Dg();Gl();bf();Io();_t=class t{constructor(){this.indent=" ";this.name=null;this.version=null;this.os=null;this.cpu=null;this.libc=null;this.type=null;this.packageManager=null;this.private=!1;this.license=null;this.main=null;this.module=null;this.browser=null;this.languageName=null;this.bin=new Map;this.scripts=new Map;this.dependencies=new Map;this.devDependencies=new Map;this.peerDependencies=new Map;this.workspaceDefinitions=[];this.dependenciesMeta=new Map;this.peerDependenciesMeta=new Map;this.resolutions=[];this.files=null;this.publishConfig=null;this.installConfig=null;this.preferUnplugged=null;this.raw={};this.errors=[]}static{this.fileName="package.json"}static{this.allDependencies=["dependencies","devDependencies","peerDependencies"]}static{this.hardDependencies=["dependencies","devDependencies"]}static async tryFind(e,{baseFs:r=new _n}={}){let o=V.join(e,"package.json");try{return await t.fromFile(o,{baseFs:r})}catch(a){if(a.code==="ENOENT")return null;throw a}}static async find(e,{baseFs:r}={}){let o=await t.tryFind(e,{baseFs:r});if(o===null)throw new Error("Manifest not found");return o}static async fromFile(e,{baseFs:r=new _n}={}){let o=new t;return await o.loadFile(e,{baseFs:r}),o}static fromText(e){let r=new t;return r.loadFromText(e),r}loadFromText(e){let r;try{r=JSON.parse(toe(e)||"{}")}catch(o){throw o.message+=` (when parsing ${e})`,o}this.load(r),this.indent=eoe(e)}async loadFile(e,{baseFs:r=new _n}){let o=await r.readFilePromise(e,"utf8"),a;try{a=JSON.parse(toe(o)||"{}")}catch(n){throw n.message+=` (when parsing ${e})`,n}this.load(a),this.indent=eoe(o)}load(e,{yamlCompatibilityMode:r=!1}={}){if(typeof e!="object"||e===null)throw new Error(`Utterly invalid manifest data (${e})`);this.raw=e;let o=[];if(this.name=null,typeof e.name=="string")try{this.name=Zo(e.name)}catch{o.push(new Error("Parsing failed for the 'name' field"))}if(typeof e.version=="string"?this.version=e.version:this.version=null,Array.isArray(e.os)){let n=[];this.os=n;for(let u of e.os)typeof u!="string"?o.push(new Error("Parsing failed for the 'os' field")):n.push(u)}else this.os=null;if(Array.isArray(e.cpu)){let n=[];this.cpu=n;for(let u of e.cpu)typeof u!="string"?o.push(new Error("Parsing failed for the 'cpu' field")):n.push(u)}else this.cpu=null;if(Array.isArray(e.libc)){let n=[];this.libc=n;for(let u of e.libc)typeof u!="string"?o.push(new Error("Parsing failed for the 'libc' field")):n.push(u)}else this.libc=null;if(typeof e.type=="string"?this.type=e.type:this.type=null,typeof e.packageManager=="string"?this.packageManager=e.packageManager:this.packageManager=null,typeof e.private=="boolean"?this.private=e.private:this.private=!1,typeof e.license=="string"?this.license=e.license:this.license=null,typeof e.languageName=="string"?this.languageName=e.languageName:this.languageName=null,typeof e.main=="string"?this.main=$o(e.main):this.main=null,typeof e.module=="string"?this.module=$o(e.module):this.module=null,e.browser!=null)if(typeof e.browser=="string")this.browser=$o(e.browser);else{this.browser=new Map;for(let[n,u]of Object.entries(e.browser))this.browser.set($o(n),typeof u=="string"?$o(u):u)}else this.browser=null;if(this.bin=new Map,typeof e.bin=="string")e.bin.trim()===""?o.push(new Error("Invalid bin field")):this.name!==null?this.bin.set(this.name.name,$o(e.bin)):o.push(new Error("String bin field, but no attached package name"));else if(typeof e.bin=="object"&&e.bin!==null)for(let[n,u]of Object.entries(e.bin)){if(typeof u!="string"||u.trim()===""){o.push(new Error(`Invalid bin definition for '${n}'`));continue}let A=Zo(n);this.bin.set(A.name,$o(u))}if(this.scripts=new Map,typeof e.scripts=="object"&&e.scripts!==null)for(let[n,u]of Object.entries(e.scripts)){if(typeof u!="string"){o.push(new Error(`Invalid script definition for '${n}'`));continue}this.scripts.set(n,u)}if(this.dependencies=new Map,typeof e.dependencies=="object"&&e.dependencies!==null)for(let[n,u]of Object.entries(e.dependencies)){if(typeof u!="string"){o.push(new Error(`Invalid dependency range for '${n}'`));continue}let A;try{A=Zo(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=kn(A,u);this.dependencies.set(p.identHash,p)}if(this.devDependencies=new Map,typeof e.devDependencies=="object"&&e.devDependencies!==null)for(let[n,u]of Object.entries(e.devDependencies)){if(typeof u!="string"){o.push(new Error(`Invalid dependency range for '${n}'`));continue}let A;try{A=Zo(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=kn(A,u);this.devDependencies.set(p.identHash,p)}if(this.peerDependencies=new Map,typeof e.peerDependencies=="object"&&e.peerDependencies!==null)for(let[n,u]of Object.entries(e.peerDependencies)){let A;try{A=Zo(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}(typeof u!="string"||!u.startsWith(ci.protocol)&&!Fa(u))&&(o.push(new Error(`Invalid dependency range for '${n}'`)),u="*");let p=kn(A,u);this.peerDependencies.set(p.identHash,p)}typeof e.workspaces=="object"&&e.workspaces!==null&&e.workspaces.nohoist&&o.push(new Error("'nohoist' is deprecated, please use 'installConfig.hoistingLimits' instead"));let a=Array.isArray(e.workspaces)?e.workspaces:typeof e.workspaces=="object"&&e.workspaces!==null&&Array.isArray(e.workspaces.packages)?e.workspaces.packages:[];this.workspaceDefinitions=[];for(let n of a){if(typeof n!="string"){o.push(new Error(`Invalid workspace definition for '${n}'`));continue}this.workspaceDefinitions.push({pattern:n})}if(this.dependenciesMeta=new Map,typeof e.dependenciesMeta=="object"&&e.dependenciesMeta!==null)for(let[n,u]of Object.entries(e.dependenciesMeta)){if(typeof u!="object"||u===null){o.push(new Error(`Invalid meta field for '${n}`));continue}let A=lh(n),p=this.ensureDependencyMeta(A),h=Cx(u.built,{yamlCompatibilityMode:r});if(h===null){o.push(new Error(`Invalid built meta field for '${n}'`));continue}let E=Cx(u.optional,{yamlCompatibilityMode:r});if(E===null){o.push(new Error(`Invalid optional meta field for '${n}'`));continue}let w=Cx(u.unplugged,{yamlCompatibilityMode:r});if(w===null){o.push(new Error(`Invalid unplugged meta field for '${n}'`));continue}Object.assign(p,{built:h,optional:E,unplugged:w})}if(this.peerDependenciesMeta=new Map,typeof e.peerDependenciesMeta=="object"&&e.peerDependenciesMeta!==null)for(let[n,u]of Object.entries(e.peerDependenciesMeta)){if(typeof u!="object"||u===null){o.push(new Error(`Invalid meta field for '${n}'`));continue}let A=lh(n),p=this.ensurePeerDependencyMeta(A),h=Cx(u.optional,{yamlCompatibilityMode:r});if(h===null){o.push(new Error(`Invalid optional meta field for '${n}'`));continue}Object.assign(p,{optional:h})}if(this.resolutions=[],typeof e.resolutions=="object"&&e.resolutions!==null)for(let[n,u]of Object.entries(e.resolutions)){if(typeof u!="string"){o.push(new Error(`Invalid resolution entry for '${n}'`));continue}try{this.resolutions.push({pattern:pS(n),reference:u})}catch(A){o.push(A);continue}}if(Array.isArray(e.files)){this.files=new Set;for(let n of e.files){if(typeof n!="string"){o.push(new Error(`Invalid files entry for '${n}'`));continue}this.files.add(n)}}else this.files=null;if(typeof e.publishConfig=="object"&&e.publishConfig!==null){if(this.publishConfig={},typeof e.publishConfig.access=="string"&&(this.publishConfig.access=e.publishConfig.access),typeof e.publishConfig.main=="string"&&(this.publishConfig.main=$o(e.publishConfig.main)),typeof e.publishConfig.module=="string"&&(this.publishConfig.module=$o(e.publishConfig.module)),e.publishConfig.browser!=null)if(typeof e.publishConfig.browser=="string")this.publishConfig.browser=$o(e.publishConfig.browser);else{this.publishConfig.browser=new Map;for(let[n,u]of Object.entries(e.publishConfig.browser))this.publishConfig.browser.set($o(n),typeof u=="string"?$o(u):u)}if(typeof e.publishConfig.registry=="string"&&(this.publishConfig.registry=e.publishConfig.registry),typeof e.publishConfig.bin=="string")this.name!==null?this.publishConfig.bin=new Map([[this.name.name,$o(e.publishConfig.bin)]]):o.push(new Error("String bin field, but no attached package name"));else if(typeof e.publishConfig.bin=="object"&&e.publishConfig.bin!==null){this.publishConfig.bin=new Map;for(let[n,u]of Object.entries(e.publishConfig.bin)){if(typeof u!="string"){o.push(new Error(`Invalid bin definition for '${n}'`));continue}this.publishConfig.bin.set(n,$o(u))}}if(Array.isArray(e.publishConfig.executableFiles)){this.publishConfig.executableFiles=new Set;for(let n of e.publishConfig.executableFiles){if(typeof n!="string"){o.push(new Error("Invalid executable file definition"));continue}this.publishConfig.executableFiles.add($o(n))}}}else this.publishConfig=null;if(typeof e.installConfig=="object"&&e.installConfig!==null){this.installConfig={};for(let n of Object.keys(e.installConfig))n==="hoistingLimits"?typeof e.installConfig.hoistingLimits=="string"?this.installConfig.hoistingLimits=e.installConfig.hoistingLimits:o.push(new Error("Invalid hoisting limits definition")):n=="selfReferences"?typeof e.installConfig.selfReferences=="boolean"?this.installConfig.selfReferences=e.installConfig.selfReferences:o.push(new Error("Invalid selfReferences definition, must be a boolean value")):o.push(new Error(`Unrecognized installConfig key: ${n}`))}else this.installConfig=null;if(typeof e.optionalDependencies=="object"&&e.optionalDependencies!==null)for(let[n,u]of Object.entries(e.optionalDependencies)){if(typeof u!="string"){o.push(new Error(`Invalid dependency range for '${n}'`));continue}let A;try{A=Zo(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=kn(A,u);this.dependencies.set(p.identHash,p);let h=kn(A,"unknown"),E=this.ensureDependencyMeta(h);Object.assign(E,{optional:!0})}typeof e.preferUnplugged=="boolean"?this.preferUnplugged=e.preferUnplugged:this.preferUnplugged=null,this.errors=o}getForScope(e){switch(e){case"dependencies":return this.dependencies;case"devDependencies":return this.devDependencies;case"peerDependencies":return this.peerDependencies;default:throw new Error(`Unsupported value ("${e}")`)}}hasConsumerDependency(e){return!!(this.dependencies.has(e.identHash)||this.peerDependencies.has(e.identHash))}hasHardDependency(e){return!!(this.dependencies.has(e.identHash)||this.devDependencies.has(e.identHash))}hasSoftDependency(e){return!!this.peerDependencies.has(e.identHash)}hasDependency(e){return!!(this.hasHardDependency(e)||this.hasSoftDependency(e))}getConditions(){let e=[];return this.os&&this.os.length>0&&e.push(jM("os",this.os)),this.cpu&&this.cpu.length>0&&e.push(jM("cpu",this.cpu)),this.libc&&this.libc.length>0&&e.push(jM("libc",this.libc)),e.length>0?e.join(" & "):null}ensureDependencyMeta(e){if(e.range!=="unknown"&&!noe.default.valid(e.range))throw new Error(`Invalid meta field range for '${ka(e)}'`);let r=rn(e),o=e.range!=="unknown"?e.range:null,a=this.dependenciesMeta.get(r);a||this.dependenciesMeta.set(r,a=new Map);let n=a.get(o);return n||a.set(o,n={}),n}ensurePeerDependencyMeta(e){if(e.range!=="unknown")throw new Error(`Invalid meta field range for '${ka(e)}'`);let r=rn(e),o=this.peerDependenciesMeta.get(r);return o||this.peerDependenciesMeta.set(r,o={}),o}setRawField(e,r,{after:o=[]}={}){let a=new Set(o.filter(n=>Object.hasOwn(this.raw,n)));if(a.size===0||Object.hasOwn(this.raw,e))this.raw[e]=r;else{let n=this.raw,u=this.raw={},A=!1;for(let p of Object.keys(n))u[p]=n[p],A||(a.delete(p),a.size===0&&(u[e]=r,A=!0))}}exportTo(e,{compatibilityMode:r=!0}={}){if(Object.assign(e,this.raw),this.name!==null?e.name=rn(this.name):delete e.name,this.version!==null?e.version=this.version:delete e.version,this.os!==null?e.os=this.os:delete e.os,this.cpu!==null?e.cpu=this.cpu:delete e.cpu,this.type!==null?e.type=this.type:delete e.type,this.packageManager!==null?e.packageManager=this.packageManager:delete e.packageManager,this.private?e.private=!0:delete e.private,this.license!==null?e.license=this.license:delete e.license,this.languageName!==null?e.languageName=this.languageName:delete e.languageName,this.main!==null?e.main=this.main:delete e.main,this.module!==null?e.module=this.module:delete e.module,this.browser!==null){let n=this.browser;typeof n=="string"?e.browser=n:n instanceof Map&&(e.browser=Object.assign({},...Array.from(n.keys()).sort().map(u=>({[u]:n.get(u)}))))}else delete e.browser;this.bin.size===1&&this.name!==null&&this.bin.has(this.name.name)?e.bin=this.bin.get(this.name.name):this.bin.size>0?e.bin=Object.assign({},...Array.from(this.bin.keys()).sort().map(n=>({[n]:this.bin.get(n)}))):delete e.bin,this.workspaceDefinitions.length>0?this.raw.workspaces&&!Array.isArray(this.raw.workspaces)?e.workspaces={...this.raw.workspaces,packages:this.workspaceDefinitions.map(({pattern:n})=>n)}:e.workspaces=this.workspaceDefinitions.map(({pattern:n})=>n):this.raw.workspaces&&!Array.isArray(this.raw.workspaces)&&Object.keys(this.raw.workspaces).length>0?e.workspaces=this.raw.workspaces:delete e.workspaces;let o=[],a=[];for(let n of this.dependencies.values()){let u=this.dependenciesMeta.get(rn(n)),A=!1;if(r&&u){let p=u.get(null);p&&p.optional&&(A=!0)}A?a.push(n):o.push(n)}o.length>0?e.dependencies=Object.assign({},...uy(o).map(n=>({[rn(n)]:n.range}))):delete e.dependencies,a.length>0?e.optionalDependencies=Object.assign({},...uy(a).map(n=>({[rn(n)]:n.range}))):delete e.optionalDependencies,this.devDependencies.size>0?e.devDependencies=Object.assign({},...uy(this.devDependencies.values()).map(n=>({[rn(n)]:n.range}))):delete e.devDependencies,this.peerDependencies.size>0?e.peerDependencies=Object.assign({},...uy(this.peerDependencies.values()).map(n=>({[rn(n)]:n.range}))):delete e.peerDependencies,e.dependenciesMeta={};for(let[n,u]of Ss(this.dependenciesMeta.entries(),([A,p])=>A))for(let[A,p]of Ss(u.entries(),([h,E])=>h!==null?`0${h}`:"1")){let h=A!==null?ka(kn(Zo(n),A)):n,E={...p};r&&A===null&&delete E.optional,Object.keys(E).length!==0&&(e.dependenciesMeta[h]=E)}if(Object.keys(e.dependenciesMeta).length===0&&delete e.dependenciesMeta,this.peerDependenciesMeta.size>0?e.peerDependenciesMeta=Object.assign({},...Ss(this.peerDependenciesMeta.entries(),([n,u])=>n).map(([n,u])=>({[n]:u}))):delete e.peerDependenciesMeta,this.resolutions.length>0?e.resolutions=Object.assign({},...this.resolutions.map(({pattern:n,reference:u})=>({[hS(n)]:u}))):delete e.resolutions,this.files!==null?e.files=Array.from(this.files):delete e.files,this.preferUnplugged!==null?e.preferUnplugged=this.preferUnplugged:delete e.preferUnplugged,this.scripts!==null&&this.scripts.size>0){e.scripts??={};for(let n of Object.keys(e.scripts))this.scripts.has(n)||delete e.scripts[n];for(let[n,u]of this.scripts.entries())e.scripts[n]=u}else delete e.scripts;return e}}});var soe=_((ILt,ioe)=>{var Htt=ql(),qtt=function(){return Htt.Date.now()};ioe.exports=qtt});var aoe=_((wLt,ooe)=>{var jtt=/\s/;function Gtt(t){for(var e=t.length;e--&&jtt.test(t.charAt(e)););return e}ooe.exports=Gtt});var coe=_((BLt,loe)=>{var Wtt=aoe(),Ytt=/^\s+/;function Vtt(t){return t&&t.slice(0,Wtt(t)+1).replace(Ytt,"")}loe.exports=Vtt});var fy=_((vLt,uoe)=>{var Ktt=mg(),Jtt=Zu(),ztt="[object Symbol]";function Xtt(t){return typeof t=="symbol"||Jtt(t)&&Ktt(t)==ztt}uoe.exports=Xtt});var hoe=_((DLt,poe)=>{var Ztt=coe(),Aoe=cl(),$tt=fy(),foe=NaN,ert=/^[-+]0x[0-9a-f]+$/i,trt=/^0b[01]+$/i,rrt=/^0o[0-7]+$/i,nrt=parseInt;function irt(t){if(typeof t=="number")return t;if($tt(t))return foe;if(Aoe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Aoe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Ztt(t);var r=trt.test(t);return r||rrt.test(t)?nrt(t.slice(2),r?2:8):ert.test(t)?foe:+t}poe.exports=irt});var moe=_((SLt,doe)=>{var srt=cl(),GM=soe(),goe=hoe(),ort="Expected a function",art=Math.max,lrt=Math.min;function crt(t,e,r){var o,a,n,u,A,p,h=0,E=!1,w=!1,D=!0;if(typeof t!="function")throw new TypeError(ort);e=goe(e)||0,srt(r)&&(E=!!r.leading,w="maxWait"in r,n=w?art(goe(r.maxWait)||0,e):n,D="trailing"in r?!!r.trailing:D);function b(ue){var Ie=o,he=a;return o=a=void 0,h=ue,u=t.apply(he,Ie),u}function C(ue){return h=ue,A=setTimeout(U,e),E?b(ue):u}function T(ue){var Ie=ue-p,he=ue-h,De=e-Ie;return w?lrt(De,n-he):De}function N(ue){var Ie=ue-p,he=ue-h;return p===void 0||Ie>=e||Ie<0||w&&he>=n}function U(){var ue=GM();if(N(ue))return J(ue);A=setTimeout(U,T(ue))}function J(ue){return A=void 0,D&&o?b(ue):(o=a=void 0,u)}function te(){A!==void 0&&clearTimeout(A),h=0,o=p=a=A=void 0}function le(){return A===void 0?u:J(GM())}function ce(){var ue=GM(),Ie=N(ue);if(o=arguments,a=this,p=ue,Ie){if(A===void 0)return C(p);if(w)return clearTimeout(A),A=setTimeout(U,e),b(p)}return A===void 0&&(A=setTimeout(U,e)),u}return ce.cancel=te,ce.flush=le,ce}doe.exports=crt});var WM=_((PLt,yoe)=>{var urt=moe(),Art=cl(),frt="Expected a function";function prt(t,e,r){var o=!0,a=!0;if(typeof t!="function")throw new TypeError(frt);return Art(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),urt(t,e,{leading:o,maxWait:e,trailing:a})}yoe.exports=prt});function grt(t){return typeof t.reportCode<"u"}var Eoe,Coe,Ioe,hrt,Jt,Ws,Kl=It(()=>{Eoe=et(WM()),Coe=ve("stream"),Ioe=ve("string_decoder"),hrt=15,Jt=class extends Error{constructor(r,o,a){super(o);this.reportExtra=a;this.reportCode=r}};Ws=class{constructor(){this.cacheHits=new Set;this.cacheMisses=new Set;this.reportedInfos=new Set;this.reportedWarnings=new Set;this.reportedErrors=new Set}getRecommendedLength(){return 180}reportCacheHit(e){this.cacheHits.add(e.locatorHash)}reportCacheMiss(e,r){this.cacheMisses.add(e.locatorHash)}static progressViaCounter(e){let r=0,o,a=new Promise(p=>{o=p}),n=p=>{let h=o;a=new Promise(E=>{o=E}),r=p,h()},u=(p=0)=>{n(r+1)},A=async function*(){for(;r{r=u}),a=(0,Eoe.default)(u=>{let A=r;o=new Promise(p=>{r=p}),e=u,A()},1e3/hrt),n=async function*(){for(;;)await o,yield{title:e}}();return{[Symbol.asyncIterator](){return n},hasProgress:!1,hasTitle:!0,setTitle:a}}async startProgressPromise(e,r){let o=this.reportProgress(e);try{return await r(e)}finally{o.stop()}}startProgressSync(e,r){let o=this.reportProgress(e);try{return r(e)}finally{o.stop()}}reportInfoOnce(e,r,o){let a=o&&o.key?o.key:r;this.reportedInfos.has(a)||(this.reportedInfos.add(a),this.reportInfo(e,r),o?.reportExtra?.(this))}reportWarningOnce(e,r,o){let a=o&&o.key?o.key:r;this.reportedWarnings.has(a)||(this.reportedWarnings.add(a),this.reportWarning(e,r),o?.reportExtra?.(this))}reportErrorOnce(e,r,o){let a=o&&o.key?o.key:r;this.reportedErrors.has(a)||(this.reportedErrors.add(a),this.reportError(e,r),o?.reportExtra?.(this))}reportExceptionOnce(e){grt(e)?this.reportErrorOnce(e.reportCode,e.message,{key:e,reportExtra:e.reportExtra}):this.reportErrorOnce(1,e.stack||e.message,{key:e})}createStreamReporter(e=null){let r=new Coe.PassThrough,o=new Ioe.StringDecoder,a="";return r.on("data",n=>{let u=o.write(n),A;do if(A=u.indexOf(` -`),A!==-1){let p=a+u.substring(0,A);u=u.substring(A+1),a="",e!==null?this.reportInfo(null,`${e} ${p}`):this.reportInfo(null,p)}while(A!==-1);a+=u}),r.on("end",()=>{let n=o.end();n!==""&&(e!==null?this.reportInfo(null,`${e} ${n}`):this.reportInfo(null,n))}),r}}});var py,YM=It(()=>{Kl();Io();py=class{constructor(e){this.fetchers=e}supports(e,r){return!!this.tryFetcher(e,r)}getLocalPath(e,r){return this.getFetcher(e,r).getLocalPath(e,r)}async fetch(e,r){return await this.getFetcher(e,r).fetch(e,r)}tryFetcher(e,r){let o=this.fetchers.find(a=>a.supports(e,r));return o||null}getFetcher(e,r){let o=this.fetchers.find(a=>a.supports(e,r));if(!o)throw new Jt(11,`${jr(r.project.configuration,e)} isn't supported by any available fetcher`);return o}}});var Sg,VM=It(()=>{Io();Sg=class{constructor(e){this.resolvers=e.filter(r=>r)}supportsDescriptor(e,r){return!!this.tryResolverByDescriptor(e,r)}supportsLocator(e,r){return!!this.tryResolverByLocator(e,r)}shouldPersistResolution(e,r){return this.getResolverByLocator(e,r).shouldPersistResolution(e,r)}bindDescriptor(e,r,o){return this.getResolverByDescriptor(e,o).bindDescriptor(e,r,o)}getResolutionDependencies(e,r){return this.getResolverByDescriptor(e,r).getResolutionDependencies(e,r)}async getCandidates(e,r,o){return await this.getResolverByDescriptor(e,o).getCandidates(e,r,o)}async getSatisfying(e,r,o,a){return this.getResolverByDescriptor(e,a).getSatisfying(e,r,o,a)}async resolve(e,r){return await this.getResolverByLocator(e,r).resolve(e,r)}tryResolverByDescriptor(e,r){let o=this.resolvers.find(a=>a.supportsDescriptor(e,r));return o||null}getResolverByDescriptor(e,r){let o=this.resolvers.find(a=>a.supportsDescriptor(e,r));if(!o)throw new Error(`${Jn(r.project.configuration,e)} isn't supported by any available resolver`);return o}tryResolverByLocator(e,r){let o=this.resolvers.find(a=>a.supportsLocator(e,r));return o||null}getResolverByLocator(e,r){let o=this.resolvers.find(a=>a.supportsLocator(e,r));if(!o)throw new Error(`${jr(r.project.configuration,e)} isn't supported by any available resolver`);return o}}});var hy,KM=It(()=>{St();Io();hy=class{supports(e){return!!e.reference.startsWith("virtual:")}getLocalPath(e,r){let o=e.reference.indexOf("#");if(o===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(o+1),n=Ps(e,a);return r.fetcher.getLocalPath(n,r)}async fetch(e,r){let o=e.reference.indexOf("#");if(o===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(o+1),n=Ps(e,a),u=await r.fetcher.fetch(n,r);return await this.ensureVirtualLink(e,u,r)}getLocatorFilename(e){return ly(e)}async ensureVirtualLink(e,r,o){let a=r.packageFs.getRealPath(),n=o.project.configuration.get("virtualFolder"),u=this.getLocatorFilename(e),A=qs.makeVirtualPath(n,u,a),p=new ju(A,{baseFs:r.packageFs,pathUtils:V});return{...r,packageFs:p}}}});var Ix,woe=It(()=>{Ix=class t{static{this.protocol="virtual:"}static isVirtualDescriptor(e){return!!e.range.startsWith(t.protocol)}static isVirtualLocator(e){return!!e.reference.startsWith(t.protocol)}supportsDescriptor(e,r){return t.isVirtualDescriptor(e)}supportsLocator(e,r){return t.isVirtualLocator(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){throw new Error('Assertion failed: calling "bindDescriptor" on a virtual descriptor is unsupported')}getResolutionDependencies(e,r){throw new Error('Assertion failed: calling "getResolutionDependencies" on a virtual descriptor is unsupported')}async getCandidates(e,r,o){throw new Error('Assertion failed: calling "getCandidates" on a virtual descriptor is unsupported')}async getSatisfying(e,r,o,a){throw new Error('Assertion failed: calling "getSatisfying" on a virtual descriptor is unsupported')}async resolve(e,r){throw new Error('Assertion failed: calling "resolve" on a virtual locator is unsupported')}}});var gy,JM=It(()=>{St();Dg();gy=class{supports(e){return!!e.reference.startsWith(ci.protocol)}getLocalPath(e,r){return this.getWorkspace(e,r).cwd}async fetch(e,r){let o=this.getWorkspace(e,r).cwd;return{packageFs:new En(o),prefixPath:Bt.dot,localPath:o}}getWorkspace(e,r){return r.project.getWorkspaceByCwd(e.reference.slice(ci.protocol.length))}}});function x1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Boe(t){return typeof t>"u"?3:x1(t)?0:Array.isArray(t)?1:2}function ZM(t,e){return Object.hasOwn(t,e)}function mrt(t){return x1(t)&&ZM(t,"onConflict")&&typeof t.onConflict=="string"}function yrt(t){if(typeof t>"u")return{onConflict:"default",value:t};if(!mrt(t))return{onConflict:"default",value:t};if(ZM(t,"value"))return t;let{onConflict:e,...r}=t;return{onConflict:e,value:r}}function voe(t,e){let r=x1(t)&&ZM(t,e)?t[e]:void 0;return yrt(r)}function dy(t,e){return[t,e,Doe]}function $M(t){return Array.isArray(t)?t[2]===Doe:!1}function zM(t,e){if(x1(t)){let r={};for(let o of Object.keys(t))r[o]=zM(t[o],e);return dy(e,r)}return Array.isArray(t)?dy(e,t.map(r=>zM(r,e))):dy(e,t)}function XM(t,e,r,o,a){let n,u=[],A=a,p=0;for(let E=a-1;E>=o;--E){let[w,D]=t[E],{onConflict:b,value:C}=voe(D,r),T=Boe(C);if(T!==3){if(n??=T,T!==n||b==="hardReset"){p=A;break}if(T===2)return dy(w,C);if(u.unshift([w,C]),b==="reset"){p=E;break}b==="extend"&&E===o&&(o=0),A=E}}if(typeof n>"u")return null;let h=u.map(([E])=>E).join(", ");switch(n){case 1:return dy(h,new Array().concat(...u.map(([E,w])=>w.map(D=>zM(D,E)))));case 0:{let E=Object.assign({},...u.map(([,T])=>T)),w=Object.keys(E),D={},b=t.map(([T,N])=>[T,voe(N,r).value]),C=drt(b,([T,N])=>{let U=Boe(N);return U!==0&&U!==3});if(C!==-1){let T=b.slice(C+1);for(let N of w)D[N]=XM(T,e,N,0,T.length)}else for(let T of w)D[T]=XM(b,e,T,p,b.length);return dy(h,D)}default:throw new Error("Assertion failed: Non-extendable value type")}}function Soe(t){return XM(t.map(([e,r])=>[e,{".":r}]),[],".",0,t.length)}function b1(t){return $M(t)?t[1]:t}function wx(t){let e=$M(t)?t[1]:t;if(Array.isArray(e))return e.map(r=>wx(r));if(x1(e)){let r={};for(let[o,a]of Object.entries(e))r[o]=wx(a);return r}return e}function e4(t){return $M(t)?t[0]:null}var drt,Doe,Poe=It(()=>{drt=(t,e,r)=>{let o=[...t];return o.reverse(),o.findIndex(e,r)};Doe=Symbol()});var Bx={};Vt(Bx,{getDefaultGlobalFolder:()=>r4,getHomeFolder:()=>my,isFolderInside:()=>n4});function r4(){if(process.platform==="win32"){let t=Ae.toPortablePath(process.env.LOCALAPPDATA||Ae.join((0,t4.homedir)(),"AppData","Local"));return V.resolve(t,"Yarn/Berry")}if(process.env.XDG_DATA_HOME){let t=Ae.toPortablePath(process.env.XDG_DATA_HOME);return V.resolve(t,"yarn/berry")}return V.resolve(my(),".yarn/berry")}function my(){return Ae.toPortablePath((0,t4.homedir)()||"/usr/local/share")}function n4(t,e){let r=V.relative(e,t);return r&&!r.startsWith("..")&&!V.isAbsolute(r)}var t4,vx=It(()=>{St();t4=ve("os")});var Qoe=_(yy=>{"use strict";var _Lt=ve("net"),Crt=ve("tls"),i4=ve("http"),xoe=ve("https"),Irt=ve("events"),HLt=ve("assert"),wrt=ve("util");yy.httpOverHttp=Brt;yy.httpsOverHttp=vrt;yy.httpOverHttps=Drt;yy.httpsOverHttps=Srt;function Brt(t){var e=new kf(t);return e.request=i4.request,e}function vrt(t){var e=new kf(t);return e.request=i4.request,e.createSocket=boe,e.defaultPort=443,e}function Drt(t){var e=new kf(t);return e.request=xoe.request,e}function Srt(t){var e=new kf(t);return e.request=xoe.request,e.createSocket=boe,e.defaultPort=443,e}function kf(t){var e=this;e.options=t||{},e.proxyOptions=e.options.proxy||{},e.maxSockets=e.options.maxSockets||i4.Agent.defaultMaxSockets,e.requests=[],e.sockets=[],e.on("free",function(o,a,n,u){for(var A=koe(a,n,u),p=0,h=e.requests.length;p=this.maxSockets){n.requests.push(u);return}n.createSocket(u,function(A){A.on("free",p),A.on("close",h),A.on("agentRemove",h),e.onSocket(A);function p(){n.emit("free",A,u)}function h(E){n.removeSocket(A),A.removeListener("free",p),A.removeListener("close",h),A.removeListener("agentRemove",h)}})};kf.prototype.createSocket=function(e,r){var o=this,a={};o.sockets.push(a);var n=s4({},o.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(n.localAddress=e.localAddress),n.proxyAuth&&(n.headers=n.headers||{},n.headers["Proxy-Authorization"]="Basic "+new Buffer(n.proxyAuth).toString("base64")),ch("making CONNECT request");var u=o.request(n);u.useChunkedEncodingByDefault=!1,u.once("response",A),u.once("upgrade",p),u.once("connect",h),u.once("error",E),u.end();function A(w){w.upgrade=!0}function p(w,D,b){process.nextTick(function(){h(w,D,b)})}function h(w,D,b){if(u.removeAllListeners(),D.removeAllListeners(),w.statusCode!==200){ch("tunneling socket could not be established, statusCode=%d",w.statusCode),D.destroy();var C=new Error("tunneling socket could not be established, statusCode="+w.statusCode);C.code="ECONNRESET",e.request.emit("error",C),o.removeSocket(a);return}if(b.length>0){ch("got illegal response body from proxy"),D.destroy();var C=new Error("got illegal response body from proxy");C.code="ECONNRESET",e.request.emit("error",C),o.removeSocket(a);return}return ch("tunneling connection has established"),o.sockets[o.sockets.indexOf(a)]=D,r(D)}function E(w){u.removeAllListeners(),ch(`tunneling socket could not be established, cause=%s -`,w.message,w.stack);var D=new Error("tunneling socket could not be established, cause="+w.message);D.code="ECONNRESET",e.request.emit("error",D),o.removeSocket(a)}};kf.prototype.removeSocket=function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var o=this.requests.shift();o&&this.createSocket(o,function(a){o.request.onSocket(a)})}};function boe(t,e){var r=this;kf.prototype.createSocket.call(r,t,function(o){var a=t.request.getHeader("host"),n=s4({},r.options,{socket:o,servername:a?a.replace(/:.*$/,""):t.host}),u=Crt.connect(0,n);r.sockets[r.sockets.indexOf(o)]=u,e(u)})}function koe(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}function s4(t){for(var e=1,r=arguments.length;e{Foe.exports=Qoe()});var Ff=_((Qf,Dx)=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});var Toe=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Prt(t){return Toe.includes(t)}var xrt=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...Toe];function brt(t){return xrt.includes(t)}var krt=["null","undefined","string","number","bigint","boolean","symbol"];function Qrt(t){return krt.includes(t)}function Ey(t){return e=>typeof e===t}var{toString:Loe}=Object.prototype,k1=t=>{let e=Loe.call(t).slice(8,-1);if(/HTML\w+Element/.test(e)&&Pe.domElement(t))return"HTMLElement";if(brt(e))return e},ii=t=>e=>k1(e)===t;function Pe(t){if(t===null)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(Pe.observable(t))return"Observable";if(Pe.array(t))return"Array";if(Pe.buffer(t))return"Buffer";let e=k1(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}Pe.undefined=Ey("undefined");Pe.string=Ey("string");var Frt=Ey("number");Pe.number=t=>Frt(t)&&!Pe.nan(t);Pe.bigint=Ey("bigint");Pe.function_=Ey("function");Pe.null_=t=>t===null;Pe.class_=t=>Pe.function_(t)&&t.toString().startsWith("class ");Pe.boolean=t=>t===!0||t===!1;Pe.symbol=Ey("symbol");Pe.numericString=t=>Pe.string(t)&&!Pe.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t));Pe.array=(t,e)=>Array.isArray(t)?Pe.function_(e)?t.every(e):!0:!1;Pe.buffer=t=>{var e,r,o,a;return(a=(o=(r=(e=t)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.isBuffer)===null||o===void 0?void 0:o.call(r,t))!==null&&a!==void 0?a:!1};Pe.blob=t=>ii("Blob")(t);Pe.nullOrUndefined=t=>Pe.null_(t)||Pe.undefined(t);Pe.object=t=>!Pe.null_(t)&&(typeof t=="object"||Pe.function_(t));Pe.iterable=t=>{var e;return Pe.function_((e=t)===null||e===void 0?void 0:e[Symbol.iterator])};Pe.asyncIterable=t=>{var e;return Pe.function_((e=t)===null||e===void 0?void 0:e[Symbol.asyncIterator])};Pe.generator=t=>{var e,r;return Pe.iterable(t)&&Pe.function_((e=t)===null||e===void 0?void 0:e.next)&&Pe.function_((r=t)===null||r===void 0?void 0:r.throw)};Pe.asyncGenerator=t=>Pe.asyncIterable(t)&&Pe.function_(t.next)&&Pe.function_(t.throw);Pe.nativePromise=t=>ii("Promise")(t);var Rrt=t=>{var e,r;return Pe.function_((e=t)===null||e===void 0?void 0:e.then)&&Pe.function_((r=t)===null||r===void 0?void 0:r.catch)};Pe.promise=t=>Pe.nativePromise(t)||Rrt(t);Pe.generatorFunction=ii("GeneratorFunction");Pe.asyncGeneratorFunction=t=>k1(t)==="AsyncGeneratorFunction";Pe.asyncFunction=t=>k1(t)==="AsyncFunction";Pe.boundFunction=t=>Pe.function_(t)&&!t.hasOwnProperty("prototype");Pe.regExp=ii("RegExp");Pe.date=ii("Date");Pe.error=ii("Error");Pe.map=t=>ii("Map")(t);Pe.set=t=>ii("Set")(t);Pe.weakMap=t=>ii("WeakMap")(t);Pe.weakSet=t=>ii("WeakSet")(t);Pe.int8Array=ii("Int8Array");Pe.uint8Array=ii("Uint8Array");Pe.uint8ClampedArray=ii("Uint8ClampedArray");Pe.int16Array=ii("Int16Array");Pe.uint16Array=ii("Uint16Array");Pe.int32Array=ii("Int32Array");Pe.uint32Array=ii("Uint32Array");Pe.float32Array=ii("Float32Array");Pe.float64Array=ii("Float64Array");Pe.bigInt64Array=ii("BigInt64Array");Pe.bigUint64Array=ii("BigUint64Array");Pe.arrayBuffer=ii("ArrayBuffer");Pe.sharedArrayBuffer=ii("SharedArrayBuffer");Pe.dataView=ii("DataView");Pe.enumCase=(t,e)=>Object.values(e).includes(t);Pe.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype;Pe.urlInstance=t=>ii("URL")(t);Pe.urlString=t=>{if(!Pe.string(t))return!1;try{return new URL(t),!0}catch{return!1}};Pe.truthy=t=>!!t;Pe.falsy=t=>!t;Pe.nan=t=>Number.isNaN(t);Pe.primitive=t=>Pe.null_(t)||Qrt(typeof t);Pe.integer=t=>Number.isInteger(t);Pe.safeInteger=t=>Number.isSafeInteger(t);Pe.plainObject=t=>{if(Loe.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};Pe.typedArray=t=>Prt(k1(t));var Trt=t=>Pe.safeInteger(t)&&t>=0;Pe.arrayLike=t=>!Pe.nullOrUndefined(t)&&!Pe.function_(t)&&Trt(t.length);Pe.inRange=(t,e)=>{if(Pe.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(Pe.array(e)&&e.length===2)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};var Lrt=1,Nrt=["innerHTML","ownerDocument","style","attributes","nodeValue"];Pe.domElement=t=>Pe.object(t)&&t.nodeType===Lrt&&Pe.string(t.nodeName)&&!Pe.plainObject(t)&&Nrt.every(e=>e in t);Pe.observable=t=>{var e,r,o,a;return t?t===((r=(e=t)[Symbol.observable])===null||r===void 0?void 0:r.call(e))||t===((a=(o=t)["@@observable"])===null||a===void 0?void 0:a.call(o)):!1};Pe.nodeStream=t=>Pe.object(t)&&Pe.function_(t.pipe)&&!Pe.observable(t);Pe.infinite=t=>t===1/0||t===-1/0;var Noe=t=>e=>Pe.integer(e)&&Math.abs(e%2)===t;Pe.evenInteger=Noe(0);Pe.oddInteger=Noe(1);Pe.emptyArray=t=>Pe.array(t)&&t.length===0;Pe.nonEmptyArray=t=>Pe.array(t)&&t.length>0;Pe.emptyString=t=>Pe.string(t)&&t.length===0;var Ort=t=>Pe.string(t)&&!/\S/.test(t);Pe.emptyStringOrWhitespace=t=>Pe.emptyString(t)||Ort(t);Pe.nonEmptyString=t=>Pe.string(t)&&t.length>0;Pe.nonEmptyStringAndNotWhitespace=t=>Pe.string(t)&&!Pe.emptyStringOrWhitespace(t);Pe.emptyObject=t=>Pe.object(t)&&!Pe.map(t)&&!Pe.set(t)&&Object.keys(t).length===0;Pe.nonEmptyObject=t=>Pe.object(t)&&!Pe.map(t)&&!Pe.set(t)&&Object.keys(t).length>0;Pe.emptySet=t=>Pe.set(t)&&t.size===0;Pe.nonEmptySet=t=>Pe.set(t)&&t.size>0;Pe.emptyMap=t=>Pe.map(t)&&t.size===0;Pe.nonEmptyMap=t=>Pe.map(t)&&t.size>0;Pe.propertyKey=t=>Pe.any([Pe.string,Pe.number,Pe.symbol],t);Pe.formData=t=>ii("FormData")(t);Pe.urlSearchParams=t=>ii("URLSearchParams")(t);var Ooe=(t,e,r)=>{if(!Pe.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(r.length===0)throw new TypeError("Invalid number of values");return t.call(r,e)};Pe.any=(t,...e)=>(Pe.array(t)?t:[t]).some(o=>Ooe(Array.prototype.some,o,e));Pe.all=(t,...e)=>Ooe(Array.prototype.every,t,e);var Mt=(t,e,r,o={})=>{if(!t){let{multipleValues:a}=o,n=a?`received values of types ${[...new Set(r.map(u=>`\`${Pe(u)}\``))].join(", ")}`:`received value of type \`${Pe(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${n}.`)}};Qf.assert={undefined:t=>Mt(Pe.undefined(t),"undefined",t),string:t=>Mt(Pe.string(t),"string",t),number:t=>Mt(Pe.number(t),"number",t),bigint:t=>Mt(Pe.bigint(t),"bigint",t),function_:t=>Mt(Pe.function_(t),"Function",t),null_:t=>Mt(Pe.null_(t),"null",t),class_:t=>Mt(Pe.class_(t),"Class",t),boolean:t=>Mt(Pe.boolean(t),"boolean",t),symbol:t=>Mt(Pe.symbol(t),"symbol",t),numericString:t=>Mt(Pe.numericString(t),"string with a number",t),array:(t,e)=>{Mt(Pe.array(t),"Array",t),e&&t.forEach(e)},buffer:t=>Mt(Pe.buffer(t),"Buffer",t),blob:t=>Mt(Pe.blob(t),"Blob",t),nullOrUndefined:t=>Mt(Pe.nullOrUndefined(t),"null or undefined",t),object:t=>Mt(Pe.object(t),"Object",t),iterable:t=>Mt(Pe.iterable(t),"Iterable",t),asyncIterable:t=>Mt(Pe.asyncIterable(t),"AsyncIterable",t),generator:t=>Mt(Pe.generator(t),"Generator",t),asyncGenerator:t=>Mt(Pe.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>Mt(Pe.nativePromise(t),"native Promise",t),promise:t=>Mt(Pe.promise(t),"Promise",t),generatorFunction:t=>Mt(Pe.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>Mt(Pe.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>Mt(Pe.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>Mt(Pe.boundFunction(t),"Function",t),regExp:t=>Mt(Pe.regExp(t),"RegExp",t),date:t=>Mt(Pe.date(t),"Date",t),error:t=>Mt(Pe.error(t),"Error",t),map:t=>Mt(Pe.map(t),"Map",t),set:t=>Mt(Pe.set(t),"Set",t),weakMap:t=>Mt(Pe.weakMap(t),"WeakMap",t),weakSet:t=>Mt(Pe.weakSet(t),"WeakSet",t),int8Array:t=>Mt(Pe.int8Array(t),"Int8Array",t),uint8Array:t=>Mt(Pe.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>Mt(Pe.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>Mt(Pe.int16Array(t),"Int16Array",t),uint16Array:t=>Mt(Pe.uint16Array(t),"Uint16Array",t),int32Array:t=>Mt(Pe.int32Array(t),"Int32Array",t),uint32Array:t=>Mt(Pe.uint32Array(t),"Uint32Array",t),float32Array:t=>Mt(Pe.float32Array(t),"Float32Array",t),float64Array:t=>Mt(Pe.float64Array(t),"Float64Array",t),bigInt64Array:t=>Mt(Pe.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>Mt(Pe.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>Mt(Pe.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>Mt(Pe.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>Mt(Pe.dataView(t),"DataView",t),enumCase:(t,e)=>Mt(Pe.enumCase(t,e),"EnumCase",t),urlInstance:t=>Mt(Pe.urlInstance(t),"URL",t),urlString:t=>Mt(Pe.urlString(t),"string with a URL",t),truthy:t=>Mt(Pe.truthy(t),"truthy",t),falsy:t=>Mt(Pe.falsy(t),"falsy",t),nan:t=>Mt(Pe.nan(t),"NaN",t),primitive:t=>Mt(Pe.primitive(t),"primitive",t),integer:t=>Mt(Pe.integer(t),"integer",t),safeInteger:t=>Mt(Pe.safeInteger(t),"integer",t),plainObject:t=>Mt(Pe.plainObject(t),"plain object",t),typedArray:t=>Mt(Pe.typedArray(t),"TypedArray",t),arrayLike:t=>Mt(Pe.arrayLike(t),"array-like",t),domElement:t=>Mt(Pe.domElement(t),"HTMLElement",t),observable:t=>Mt(Pe.observable(t),"Observable",t),nodeStream:t=>Mt(Pe.nodeStream(t),"Node.js Stream",t),infinite:t=>Mt(Pe.infinite(t),"infinite number",t),emptyArray:t=>Mt(Pe.emptyArray(t),"empty array",t),nonEmptyArray:t=>Mt(Pe.nonEmptyArray(t),"non-empty array",t),emptyString:t=>Mt(Pe.emptyString(t),"empty string",t),emptyStringOrWhitespace:t=>Mt(Pe.emptyStringOrWhitespace(t),"empty string or whitespace",t),nonEmptyString:t=>Mt(Pe.nonEmptyString(t),"non-empty string",t),nonEmptyStringAndNotWhitespace:t=>Mt(Pe.nonEmptyStringAndNotWhitespace(t),"non-empty string and not whitespace",t),emptyObject:t=>Mt(Pe.emptyObject(t),"empty object",t),nonEmptyObject:t=>Mt(Pe.nonEmptyObject(t),"non-empty object",t),emptySet:t=>Mt(Pe.emptySet(t),"empty set",t),nonEmptySet:t=>Mt(Pe.nonEmptySet(t),"non-empty set",t),emptyMap:t=>Mt(Pe.emptyMap(t),"empty map",t),nonEmptyMap:t=>Mt(Pe.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>Mt(Pe.propertyKey(t),"PropertyKey",t),formData:t=>Mt(Pe.formData(t),"FormData",t),urlSearchParams:t=>Mt(Pe.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>Mt(Pe.evenInteger(t),"even integer",t),oddInteger:t=>Mt(Pe.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>Mt(Pe.directInstanceOf(t,e),"T",t),inRange:(t,e)=>Mt(Pe.inRange(t,e),"in range",t),any:(t,...e)=>Mt(Pe.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>Mt(Pe.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})};Object.defineProperties(Pe,{class:{value:Pe.class_},function:{value:Pe.function_},null:{value:Pe.null_}});Object.defineProperties(Qf.assert,{class:{value:Qf.assert.class_},function:{value:Qf.assert.function_},null:{value:Qf.assert.null_}});Qf.default=Pe;Dx.exports=Pe;Dx.exports.default=Pe;Dx.exports.assert=Qf.assert});var Moe=_((GLt,o4)=>{"use strict";var Sx=class extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}},Px=class t{static fn(e){return(...r)=>new t((o,a,n)=>{r.push(n),e(...r).then(o,a)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,o)=>{this._reject=o;let a=A=>{this._isPending=!1,r(A)},n=A=>{this._isPending=!1,o(A)},u=A=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(A)};return Object.defineProperties(u,{shouldReject:{get:()=>this._rejectOnCancel,set:A=>{this._rejectOnCancel=A}}}),e(a,n,u)})}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r()}catch(r){this._reject(r)}this._isCanceled=!0,this._rejectOnCancel&&this._reject(new Sx(e))}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(Px.prototype,Promise.prototype);o4.exports=Px;o4.exports.CancelError=Sx});var Uoe=_((l4,c4)=>{"use strict";Object.defineProperty(l4,"__esModule",{value:!0});function Mrt(t){return t.encrypted}var a4=(t,e)=>{let r;typeof e=="function"?r={connect:e}:r=e;let o=typeof r.connect=="function",a=typeof r.secureConnect=="function",n=typeof r.close=="function",u=()=>{o&&r.connect(),Mrt(t)&&a&&(t.authorized?r.secureConnect():t.authorizationError||t.once("secureConnect",r.secureConnect)),n&&t.once("close",r.close)};t.writable&&!t.connecting?u():t.connecting?t.once("connect",u):t.destroyed&&n&&r.close(t._hadError)};l4.default=a4;c4.exports=a4;c4.exports.default=a4});var _oe=_((A4,f4)=>{"use strict";Object.defineProperty(A4,"__esModule",{value:!0});var Urt=Uoe(),_rt=Number(process.versions.node.split(".")[0]),u4=t=>{let e={start:Date.now(),socket:void 0,lookup:void 0,connect:void 0,secureConnect:void 0,upload:void 0,response:void 0,end:void 0,error:void 0,abort:void 0,phases:{wait:void 0,dns:void 0,tcp:void 0,tls:void 0,request:void 0,firstByte:void 0,download:void 0,total:void 0}};t.timings=e;let r=u=>{let A=u.emit.bind(u);u.emit=(p,...h)=>(p==="error"&&(e.error=Date.now(),e.phases.total=e.error-e.start,u.emit=A),A(p,...h))};r(t),t.prependOnceListener("abort",()=>{e.abort=Date.now(),(!e.response||_rt>=13)&&(e.phases.total=Date.now()-e.start)});let o=u=>{e.socket=Date.now(),e.phases.wait=e.socket-e.start;let A=()=>{e.lookup=Date.now(),e.phases.dns=e.lookup-e.socket};u.prependOnceListener("lookup",A),Urt.default(u,{connect:()=>{e.connect=Date.now(),e.lookup===void 0&&(u.removeListener("lookup",A),e.lookup=e.connect,e.phases.dns=e.lookup-e.socket),e.phases.tcp=e.connect-e.lookup},secureConnect:()=>{e.secureConnect=Date.now(),e.phases.tls=e.secureConnect-e.connect}})};t.socket?o(t.socket):t.prependOnceListener("socket",o);let a=()=>{var u;e.upload=Date.now(),e.phases.request=e.upload-(u=e.secureConnect,u??e.connect)};return(typeof t.writableFinished=="boolean"?t.writableFinished:t.finished&&t.outputSize===0&&(!t.socket||t.socket.writableLength===0))?a():t.prependOnceListener("finish",a),t.prependOnceListener("response",u=>{e.response=Date.now(),e.phases.firstByte=e.response-e.upload,u.timings=e,r(u),u.prependOnceListener("end",()=>{e.end=Date.now(),e.phases.download=e.end-e.response,e.phases.total=e.end-e.start})}),e};A4.default=u4;f4.exports=u4;f4.exports.default=u4});var Voe=_((WLt,g4)=>{"use strict";var{V4MAPPED:Hrt,ADDRCONFIG:qrt,ALL:Yoe,promises:{Resolver:Hoe},lookup:jrt}=ve("dns"),{promisify:p4}=ve("util"),Grt=ve("os"),Cy=Symbol("cacheableLookupCreateConnection"),h4=Symbol("cacheableLookupInstance"),qoe=Symbol("expires"),Wrt=typeof Yoe=="number",joe=t=>{if(!(t&&typeof t.createConnection=="function"))throw new Error("Expected an Agent instance as the first argument")},Yrt=t=>{for(let e of t)e.family!==6&&(e.address=`::ffff:${e.address}`,e.family=6)},Goe=()=>{let t=!1,e=!1;for(let r of Object.values(Grt.networkInterfaces()))for(let o of r)if(!o.internal&&(o.family==="IPv6"?e=!0:t=!0,t&&e))return{has4:t,has6:e};return{has4:t,has6:e}},Vrt=t=>Symbol.iterator in t,Woe={ttl:!0},Krt={all:!0},xx=class{constructor({cache:e=new Map,maxTtl:r=1/0,fallbackDuration:o=3600,errorTtl:a=.15,resolver:n=new Hoe,lookup:u=jrt}={}){if(this.maxTtl=r,this.errorTtl=a,this._cache=e,this._resolver=n,this._dnsLookup=p4(u),this._resolver instanceof Hoe?(this._resolve4=this._resolver.resolve4.bind(this._resolver),this._resolve6=this._resolver.resolve6.bind(this._resolver)):(this._resolve4=p4(this._resolver.resolve4.bind(this._resolver)),this._resolve6=p4(this._resolver.resolve6.bind(this._resolver))),this._iface=Goe(),this._pending={},this._nextRemovalTime=!1,this._hostnamesToFallback=new Set,o<1)this._fallback=!1;else{this._fallback=!0;let A=setInterval(()=>{this._hostnamesToFallback.clear()},o*1e3);A.unref&&A.unref()}this.lookup=this.lookup.bind(this),this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear(),this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,r,o){if(typeof r=="function"?(o=r,r={}):typeof r=="number"&&(r={family:r}),!o)throw new Error("Callback must be a function.");this.lookupAsync(e,r).then(a=>{r.all?o(null,a):o(null,a.address,a.family,a.expires,a.ttl)},o)}async lookupAsync(e,r={}){typeof r=="number"&&(r={family:r});let o=await this.query(e);if(r.family===6){let a=o.filter(n=>n.family===6);r.hints&Hrt&&(Wrt&&r.hints&Yoe||a.length===0)?Yrt(o):o=a}else r.family===4&&(o=o.filter(a=>a.family===4));if(r.hints&qrt){let{_iface:a}=this;o=o.filter(n=>n.family===6?a.has6:a.has4)}if(o.length===0){let a=new Error(`cacheableLookup ENOTFOUND ${e}`);throw a.code="ENOTFOUND",a.hostname=e,a}return r.all?o:o[0]}async query(e){let r=await this._cache.get(e);if(!r){let o=this._pending[e];if(o)r=await o;else{let a=this.queryAndCache(e);this._pending[e]=a,r=await a}}return r=r.map(o=>({...o})),r}async _resolve(e){let r=async h=>{try{return await h}catch(E){if(E.code==="ENODATA"||E.code==="ENOTFOUND")return[];throw E}},[o,a]=await Promise.all([this._resolve4(e,Woe),this._resolve6(e,Woe)].map(h=>r(h))),n=0,u=0,A=0,p=Date.now();for(let h of o)h.family=4,h.expires=p+h.ttl*1e3,n=Math.max(n,h.ttl);for(let h of a)h.family=6,h.expires=p+h.ttl*1e3,u=Math.max(u,h.ttl);return o.length>0?a.length>0?A=Math.min(n,u):A=n:A=u,{entries:[...o,...a],cacheTtl:A}}async _lookup(e){try{return{entries:await this._dnsLookup(e,{all:!0}),cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,r,o){if(this.maxTtl>0&&o>0){o=Math.min(o,this.maxTtl)*1e3,r[qoe]=Date.now()+o;try{await this._cache.set(e,r,o)}catch(a){this.lookupAsync=async()=>{let n=new Error("Cache Error. Please recreate the CacheableLookup instance.");throw n.cause=a,n}}Vrt(this._cache)&&this._tick(o)}}async queryAndCache(e){if(this._hostnamesToFallback.has(e))return this._dnsLookup(e,Krt);try{let r=await this._resolve(e);r.entries.length===0&&this._fallback&&(r=await this._lookup(e),r.entries.length!==0&&this._hostnamesToFallback.add(e));let o=r.entries.length===0?this.errorTtl:r.cacheTtl;return await this._set(e,r.entries,o),delete this._pending[e],r.entries}catch(r){throw delete this._pending[e],r}}_tick(e){let r=this._nextRemovalTime;(!r||e{this._nextRemovalTime=!1;let o=1/0,a=Date.now();for(let[n,u]of this._cache){let A=u[qoe];a>=A?this._cache.delete(n):A("lookup"in r||(r.lookup=this.lookup),e[Cy](r,o))}uninstall(e){if(joe(e),e[Cy]){if(e[h4]!==this)throw new Error("The agent is not owned by this CacheableLookup instance");e.createConnection=e[Cy],delete e[Cy],delete e[h4]}}updateInterfaceInfo(){let{_iface:e}=this;this._iface=Goe(),(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6)&&this._cache.clear()}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}};g4.exports=xx;g4.exports.default=xx});var zoe=_((YLt,d4)=>{"use strict";var Jrt=typeof URL>"u"?ve("url").URL:URL,zrt="text/plain",Xrt="us-ascii",Koe=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),Zrt=(t,{stripHash:e})=>{let r=t.match(/^data:([^,]*?),([^#]*?)(?:#(.*))?$/);if(!r)throw new Error(`Invalid URL: ${t}`);let o=r[1].split(";"),a=r[2],n=e?"":r[3],u=!1;o[o.length-1]==="base64"&&(o.pop(),u=!0);let A=(o.shift()||"").toLowerCase(),h=[...o.map(E=>{let[w,D=""]=E.split("=").map(b=>b.trim());return w==="charset"&&(D=D.toLowerCase(),D===Xrt)?"":`${w}${D?`=${D}`:""}`}).filter(Boolean)];return u&&h.push("base64"),(h.length!==0||A&&A!==zrt)&&h.unshift(A),`data:${h.join(";")},${u?a.trim():a}${n?`#${n}`:""}`},Joe=(t,e)=>{if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},Reflect.has(e,"normalizeHttps"))throw new Error("options.normalizeHttps is renamed to options.forceHttp");if(Reflect.has(e,"normalizeHttp"))throw new Error("options.normalizeHttp is renamed to options.forceHttps");if(Reflect.has(e,"stripFragment"))throw new Error("options.stripFragment is renamed to options.stripHash");if(t=t.trim(),/^data:/i.test(t))return Zrt(t,e);let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let a=new Jrt(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&a.protocol==="https:"&&(a.protocol="http:"),e.forceHttps&&a.protocol==="http:"&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash&&(a.hash=""),a.pathname&&(a.pathname=a.pathname.replace(/((?!:).|^)\/{2,}/g,(n,u)=>/^(?!\/)/g.test(u)?`${u}/`:"/")),a.pathname&&(a.pathname=decodeURI(a.pathname)),e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let n=a.pathname.split("/"),u=n[n.length-1];Koe(u,e.removeDirectoryIndex)&&(n=n.slice(0,n.length-1),a.pathname=n.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let n of[...a.searchParams.keys()])Koe(n,e.removeQueryParameters)&&a.searchParams.delete(n);return e.sortQueryParameters&&a.searchParams.sort(),e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,"")),t=a.toString(),(e.removeTrailingSlash||a.pathname==="/")&&a.hash===""&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t};d4.exports=Joe;d4.exports.default=Joe});var $oe=_((VLt,Zoe)=>{Zoe.exports=Xoe;function Xoe(t,e){if(t&&e)return Xoe(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(o){r[o]=t[o]}),r;function r(){for(var o=new Array(arguments.length),a=0;a{var eae=$oe();m4.exports=eae(bx);m4.exports.strict=eae(tae);bx.proto=bx(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return bx(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return tae(this)},configurable:!0})});function bx(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function tae(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}});var E4=_((JLt,nae)=>{var $rt=y4(),ent=function(){},tnt=function(t){return t.setHeader&&typeof t.abort=="function"},rnt=function(t){return t.stdio&&Array.isArray(t.stdio)&&t.stdio.length===3},rae=function(t,e,r){if(typeof e=="function")return rae(t,null,e);e||(e={}),r=$rt(r||ent);var o=t._writableState,a=t._readableState,n=e.readable||e.readable!==!1&&t.readable,u=e.writable||e.writable!==!1&&t.writable,A=function(){t.writable||p()},p=function(){u=!1,n||r.call(t)},h=function(){n=!1,u||r.call(t)},E=function(C){r.call(t,C?new Error("exited with error code: "+C):null)},w=function(C){r.call(t,C)},D=function(){if(n&&!(a&&a.ended))return r.call(t,new Error("premature close"));if(u&&!(o&&o.ended))return r.call(t,new Error("premature close"))},b=function(){t.req.on("finish",p)};return tnt(t)?(t.on("complete",p),t.on("abort",D),t.req?b():t.on("request",b)):u&&!o&&(t.on("end",A),t.on("close",A)),rnt(t)&&t.on("exit",E),t.on("end",h),t.on("finish",p),e.error!==!1&&t.on("error",w),t.on("close",D),function(){t.removeListener("complete",p),t.removeListener("abort",D),t.removeListener("request",b),t.req&&t.req.removeListener("finish",p),t.removeListener("end",A),t.removeListener("close",A),t.removeListener("finish",p),t.removeListener("exit",E),t.removeListener("end",h),t.removeListener("error",w),t.removeListener("close",D)}};nae.exports=rae});var oae=_((zLt,sae)=>{var nnt=y4(),int=E4(),C4=ve("fs"),Q1=function(){},snt=/^v?\.0/.test(process.version),kx=function(t){return typeof t=="function"},ont=function(t){return!snt||!C4?!1:(t instanceof(C4.ReadStream||Q1)||t instanceof(C4.WriteStream||Q1))&&kx(t.close)},ant=function(t){return t.setHeader&&kx(t.abort)},lnt=function(t,e,r,o){o=nnt(o);var a=!1;t.on("close",function(){a=!0}),int(t,{readable:e,writable:r},function(u){if(u)return o(u);a=!0,o()});var n=!1;return function(u){if(!a&&!n){if(n=!0,ont(t))return t.close(Q1);if(ant(t))return t.abort();if(kx(t.destroy))return t.destroy();o(u||new Error("stream was destroyed"))}}},iae=function(t){t()},cnt=function(t,e){return t.pipe(e)},unt=function(){var t=Array.prototype.slice.call(arguments),e=kx(t[t.length-1]||Q1)&&t.pop()||Q1;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r,o=t.map(function(a,n){var u=n0;return lnt(a,u,A,function(p){r||(r=p),p&&o.forEach(iae),!u&&(o.forEach(iae),e(r))})});return t.reduce(cnt)};sae.exports=unt});var lae=_((XLt,aae)=>{"use strict";var{PassThrough:Ant}=ve("stream");aae.exports=t=>{t={...t};let{array:e}=t,{encoding:r}=t,o=r==="buffer",a=!1;e?a=!(r||o):r=r||"utf8",o&&(r=null);let n=new Ant({objectMode:a});r&&n.setEncoding(r);let u=0,A=[];return n.on("data",p=>{A.push(p),a?u=A.length:u+=p.length}),n.getBufferedValue=()=>e?A:o?Buffer.concat(A,u):A.join(""),n.getBufferedLength=()=>u,n}});var cae=_((ZLt,Iy)=>{"use strict";var fnt=oae(),pnt=lae(),Qx=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function Fx(t,e){if(!t)return Promise.reject(new Error("Expected a stream"));e={maxBuffer:1/0,...e};let{maxBuffer:r}=e,o;return await new Promise((a,n)=>{let u=A=>{A&&(A.bufferedData=o.getBufferedValue()),n(A)};o=fnt(t,pnt(e),A=>{if(A){u(A);return}a()}),o.on("data",()=>{o.getBufferedLength()>r&&u(new Qx)})}),o.getBufferedValue()}Iy.exports=Fx;Iy.exports.default=Fx;Iy.exports.buffer=(t,e)=>Fx(t,{...e,encoding:"buffer"});Iy.exports.array=(t,e)=>Fx(t,{...e,array:!0});Iy.exports.MaxBufferError=Qx});var Aae=_((eNt,uae)=>{"use strict";var hnt=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),gnt=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),dnt=new Set([500,502,503,504]),mnt={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},ynt={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function Pg(t){let e=parseInt(t,10);return isFinite(e)?e:0}function Ent(t){return t?dnt.has(t.status):!0}function I4(t){let e={};if(!t)return e;let r=t.trim().split(/,/);for(let o of r){let[a,n]=o.split(/=/,2);e[a.trim()]=n===void 0?!0:n.trim().replace(/^"|"$/g,"")}return e}function Cnt(t){let e=[];for(let r in t){let o=t[r];e.push(o===!0?r:r+"="+o)}if(e.length)return e.join(", ")}uae.exports=class{constructor(e,r,{shared:o,cacheHeuristic:a,immutableMinTimeToLive:n,ignoreCargoCult:u,_fromObject:A}={}){if(A){this._fromObject(A);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(e),this._responseTime=this.now(),this._isShared=o!==!1,this._cacheHeuristic=a!==void 0?a:.1,this._immutableMinTtl=n!==void 0?n:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=I4(r.headers["cache-control"]),this._method="method"in e?e.method:"GET",this._url=e.url,this._host=e.headers.host,this._noAuthorization=!e.headers.authorization,this._reqHeaders=r.headers.vary?e.headers:null,this._reqcc=I4(e.headers["cache-control"]),u&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":Cnt(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&gnt.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||hnt.has(this._status)))}_hasExplicitExpiration(){return this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires}_assertRequestHasHeaders(e){if(!e||!e.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(e){this._assertRequestHasHeaders(e);let r=I4(e.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(e.headers.pragma)||r["max-age"]&&this.age()>r["max-age"]||r["min-fresh"]&&this.timeToLive()<1e3*r["min-fresh"]||this.stale()&&!(r["max-stale"]&&!this._rescc["must-revalidate"]&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge()))?!1:this._requestMatches(e,!1)}_requestMatches(e,r){return(!this._url||this._url===e.url)&&this._host===e.headers.host&&(!e.method||this._method===e.method||r&&e.method==="HEAD")&&this._varyMatches(e)}_allowsStoringAuthenticated(){return this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"]}_varyMatches(e){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let o of r)if(e.headers[o]!==this._reqHeaders[o])return!1;return!0}_copyWithoutHopByHopHeaders(e){let r={};for(let o in e)mnt[o]||(r[o]=e[o]);if(e.connection){let o=e.connection.trim().split(/\s*,\s*/);for(let a of o)delete r[a]}if(r.warning){let o=r.warning.split(/,/).filter(a=>!/^\s*1[0-9][0-9]/.test(a));o.length?r.warning=o.join(",").trim():delete r.warning}return r}responseHeaders(){let e=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(e.warning=(e.warning?`${e.warning}, `:"")+'113 - "rfc7234 5.5.4"'),e.age=`${Math.round(r)}`,e.date=new Date(this.now()).toUTCString(),e}date(){let e=Date.parse(this._resHeaders.date);return isFinite(e)?e:this._responseTime}age(){let e=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return e+r}_ageValue(){return Pg(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return Pg(this._rescc["s-maxage"])}if(this._rescc["max-age"])return Pg(this._rescc["max-age"]);let e=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let o=Date.parse(this._resHeaders.expires);return Number.isNaN(o)||oo)return Math.max(e,(r-o)/1e3*this._cacheHeuristic)}return e}timeToLive(){let e=this.maxAge()-this.age(),r=e+Pg(this._rescc["stale-if-error"]),o=e+Pg(this._rescc["stale-while-revalidate"]);return Math.max(0,e,r,o)*1e3}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+Pg(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){return this.maxAge()+Pg(this._rescc["stale-while-revalidate"])>this.age()}static fromObject(e){return new this(void 0,void 0,{_fromObject:e})}_fromObject(e){if(this._responseTime)throw Error("Reinitialized");if(!e||e.v!==1)throw Error("Invalid serialization");this._responseTime=e.t,this._isShared=e.sh,this._cacheHeuristic=e.ch,this._immutableMinTtl=e.imm!==void 0?e.imm:24*3600*1e3,this._status=e.st,this._resHeaders=e.resh,this._rescc=e.rescc,this._method=e.m,this._url=e.u,this._host=e.h,this._noAuthorization=e.a,this._reqHeaders=e.reqh,this._reqcc=e.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(e){this._assertRequestHasHeaders(e);let r=this._copyWithoutHopByHopHeaders(e.headers);if(delete r["if-range"],!this._requestMatches(e,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let a=r["if-none-match"].split(/,/).filter(n=>!/^\s*W\//.test(n));a.length?r["if-none-match"]=a.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(e,r){if(this._assertRequestHasHeaders(e),this._useStaleIfError()&&Ent(r))return{modified:!1,matches:!1,policy:this};if(!r||!r.headers)throw Error("Response headers missing");let o=!1;if(r.status!==void 0&&r.status!=304?o=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?o=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?o=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?o=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(o=!0),!o)return{policy:new this.constructor(e,r),modified:r.status!=304,matches:!1};let a={};for(let u in this._resHeaders)a[u]=u in r.headers&&!ynt[u]?r.headers[u]:this._resHeaders[u];let n=Object.assign({},r,{status:this._status,method:this._method,headers:a});return{policy:new this.constructor(e,n,{shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl}),modified:!1,matches:!0}}}});var Rx=_((tNt,fae)=>{"use strict";fae.exports=t=>{let e={};for(let[r,o]of Object.entries(t))e[r.toLowerCase()]=o;return e}});var hae=_((rNt,pae)=>{"use strict";var Int=ve("stream").Readable,wnt=Rx(),w4=class extends Int{constructor(e,r,o,a){if(typeof e!="number")throw new TypeError("Argument `statusCode` should be a number");if(typeof r!="object")throw new TypeError("Argument `headers` should be an object");if(!(o instanceof Buffer))throw new TypeError("Argument `body` should be a buffer");if(typeof a!="string")throw new TypeError("Argument `url` should be a string");super(),this.statusCode=e,this.headers=wnt(r),this.body=o,this.url=a}_read(){this.push(this.body),this.push(null)}};pae.exports=w4});var dae=_((nNt,gae)=>{"use strict";var Bnt=["destroy","setTimeout","socket","headers","trailers","rawHeaders","statusCode","httpVersion","httpVersionMinor","httpVersionMajor","rawTrailers","statusMessage"];gae.exports=(t,e)=>{let r=new Set(Object.keys(t).concat(Bnt));for(let o of r)o in e||(e[o]=typeof t[o]=="function"?t[o].bind(t):t[o])}});var yae=_((iNt,mae)=>{"use strict";var vnt=ve("stream").PassThrough,Dnt=dae(),Snt=t=>{if(!(t&&t.pipe))throw new TypeError("Parameter `response` must be a response stream.");let e=new vnt;return Dnt(t,e),t.pipe(e)};mae.exports=Snt});var Eae=_(B4=>{B4.stringify=function t(e){if(typeof e>"u")return e;if(e&&Buffer.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON&&(e=e.toJSON()),e&&typeof e=="object"){var r="",o=Array.isArray(e);r=o?"[":"{";var a=!0;for(var n in e){var u=typeof e[n]=="function"||!o&&typeof e[n]>"u";Object.hasOwnProperty.call(e,n)&&!u&&(a||(r+=","),a=!1,o?e[n]==null?r+="null":r+=t(e[n]):e[n]!==void 0&&(r+=t(n)+":"+t(e[n])))}return r+=o?"]":"}",r}else return typeof e=="string"?JSON.stringify(/^:/.test(e)?":"+e:e):typeof e>"u"?"null":JSON.stringify(e)};B4.parse=function(t){return JSON.parse(t,function(e,r){return typeof r=="string"?/^:base64:/.test(r)?Buffer.from(r.substring(8),"base64"):/^:/.test(r)?r.substring(1):r:r})}});var Bae=_((oNt,wae)=>{"use strict";var Pnt=ve("events"),Cae=Eae(),xnt=t=>{let e={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(t.adapter||t.uri){let r=t.adapter||/^[^:+]*/.exec(t.uri)[0];return new(ve(e[r]))(t)}return new Map},Iae=["sqlite","postgres","mysql","mongo","redis","tiered"],v4=class extends Pnt{constructor(e,{emitErrors:r=!0,...o}={}){if(super(),this.opts={namespace:"keyv",serialize:Cae.stringify,deserialize:Cae.parse,...typeof e=="string"?{uri:e}:e,...o},!this.opts.store){let n={...this.opts};this.opts.store=xnt(n)}if(this.opts.compression){let n=this.opts.compression;this.opts.serialize=n.serialize.bind(n),this.opts.deserialize=n.deserialize.bind(n)}typeof this.opts.store.on=="function"&&r&&this.opts.store.on("error",n=>this.emit("error",n)),this.opts.store.namespace=this.opts.namespace;let a=n=>async function*(){for await(let[u,A]of typeof n=="function"?n(this.opts.store.namespace):n){let p=await this.opts.deserialize(A);if(!(this.opts.store.namespace&&!u.includes(this.opts.store.namespace))){if(typeof p.expires=="number"&&Date.now()>p.expires){this.delete(u);continue}yield[this._getKeyUnprefix(u),p.value]}}};typeof this.opts.store[Symbol.iterator]=="function"&&this.opts.store instanceof Map?this.iterator=a(this.opts.store):typeof this.opts.store.iterator=="function"&&this.opts.store.opts&&this._checkIterableAdaptar()&&(this.iterator=a(this.opts.store.iterator.bind(this.opts.store)))}_checkIterableAdaptar(){return Iae.includes(this.opts.store.opts.dialect)||Iae.findIndex(e=>this.opts.store.opts.url.includes(e))>=0}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}_getKeyPrefixArray(e){return e.map(r=>`${this.opts.namespace}:${r}`)}_getKeyUnprefix(e){return e.split(":").splice(1).join(":")}get(e,r){let{store:o}=this.opts,a=Array.isArray(e),n=a?this._getKeyPrefixArray(e):this._getKeyPrefix(e);if(a&&o.getMany===void 0){let u=[];for(let A of n)u.push(Promise.resolve().then(()=>o.get(A)).then(p=>typeof p=="string"?this.opts.deserialize(p):this.opts.compression?this.opts.deserialize(p):p).then(p=>{if(p!=null)return typeof p.expires=="number"&&Date.now()>p.expires?this.delete(A).then(()=>{}):r&&r.raw?p:p.value}));return Promise.allSettled(u).then(A=>{let p=[];for(let h of A)p.push(h.value);return p})}return Promise.resolve().then(()=>a?o.getMany(n):o.get(n)).then(u=>typeof u=="string"?this.opts.deserialize(u):this.opts.compression?this.opts.deserialize(u):u).then(u=>{if(u!=null)return a?u.map((A,p)=>{if(typeof A=="string"&&(A=this.opts.deserialize(A)),A!=null){if(typeof A.expires=="number"&&Date.now()>A.expires){this.delete(e[p]).then(()=>{});return}return r&&r.raw?A:A.value}}):typeof u.expires=="number"&&Date.now()>u.expires?this.delete(e).then(()=>{}):r&&r.raw?u:u.value})}set(e,r,o){let a=this._getKeyPrefix(e);typeof o>"u"&&(o=this.opts.ttl),o===0&&(o=void 0);let{store:n}=this.opts;return Promise.resolve().then(()=>{let u=typeof o=="number"?Date.now()+o:null;return typeof r=="symbol"&&this.emit("error","symbol cannot be serialized"),r={value:r,expires:u},this.opts.serialize(r)}).then(u=>n.set(a,u,o)).then(()=>!0)}delete(e){let{store:r}=this.opts;if(Array.isArray(e)){let a=this._getKeyPrefixArray(e);if(r.deleteMany===void 0){let n=[];for(let u of a)n.push(r.delete(u));return Promise.allSettled(n).then(u=>u.every(A=>A.value===!0))}return Promise.resolve().then(()=>r.deleteMany(a))}let o=this._getKeyPrefix(e);return Promise.resolve().then(()=>r.delete(o))}clear(){let{store:e}=this.opts;return Promise.resolve().then(()=>e.clear())}has(e){let r=this._getKeyPrefix(e),{store:o}=this.opts;return Promise.resolve().then(async()=>typeof o.has=="function"?o.has(r):await o.get(r)!==void 0)}disconnect(){let{store:e}=this.opts;if(typeof e.disconnect=="function")return e.disconnect()}};wae.exports=v4});var Sae=_((lNt,Dae)=>{"use strict";var bnt=ve("events"),Tx=ve("url"),knt=zoe(),Qnt=cae(),D4=Aae(),vae=hae(),Fnt=Rx(),Rnt=yae(),Tnt=Bae(),F1=class t{constructor(e,r){if(typeof e!="function")throw new TypeError("Parameter `request` must be a function");return this.cache=new Tnt({uri:typeof r=="string"&&r,store:typeof r!="string"&&r,namespace:"cacheable-request"}),this.createCacheableRequest(e)}createCacheableRequest(e){return(r,o)=>{let a;if(typeof r=="string")a=S4(Tx.parse(r)),r={};else if(r instanceof Tx.URL)a=S4(Tx.parse(r.toString())),r={};else{let[w,...D]=(r.path||"").split("?"),b=D.length>0?`?${D.join("?")}`:"";a=S4({...r,pathname:w,search:b})}r={headers:{},method:"GET",cache:!0,strictTtl:!1,automaticFailover:!1,...r,...Lnt(a)},r.headers=Fnt(r.headers);let n=new bnt,u=knt(Tx.format(a),{stripWWW:!1,removeTrailingSlash:!1,stripAuthentication:!1}),A=`${r.method}:${u}`,p=!1,h=!1,E=w=>{h=!0;let D=!1,b,C=new Promise(N=>{b=()=>{D||(D=!0,N())}}),T=N=>{if(p&&!w.forceRefresh){N.status=N.statusCode;let J=D4.fromObject(p.cachePolicy).revalidatedPolicy(w,N);if(!J.modified){let te=J.policy.responseHeaders();N=new vae(p.statusCode,te,p.body,p.url),N.cachePolicy=J.policy,N.fromCache=!0}}N.fromCache||(N.cachePolicy=new D4(w,N,w),N.fromCache=!1);let U;w.cache&&N.cachePolicy.storable()?(U=Rnt(N),(async()=>{try{let J=Qnt.buffer(N);if(await Promise.race([C,new Promise(ue=>N.once("end",ue))]),D)return;let te=await J,le={cachePolicy:N.cachePolicy.toObject(),url:N.url,statusCode:N.fromCache?p.statusCode:N.statusCode,body:te},ce=w.strictTtl?N.cachePolicy.timeToLive():void 0;w.maxTtl&&(ce=ce?Math.min(ce,w.maxTtl):w.maxTtl),await this.cache.set(A,le,ce)}catch(J){n.emit("error",new t.CacheError(J))}})()):w.cache&&p&&(async()=>{try{await this.cache.delete(A)}catch(J){n.emit("error",new t.CacheError(J))}})(),n.emit("response",U||N),typeof o=="function"&&o(U||N)};try{let N=e(w,T);N.once("error",b),N.once("abort",b),n.emit("request",N)}catch(N){n.emit("error",new t.RequestError(N))}};return(async()=>{let w=async b=>{await Promise.resolve();let C=b.cache?await this.cache.get(A):void 0;if(typeof C>"u")return E(b);let T=D4.fromObject(C.cachePolicy);if(T.satisfiesWithoutRevalidation(b)&&!b.forceRefresh){let N=T.responseHeaders(),U=new vae(C.statusCode,N,C.body,C.url);U.cachePolicy=T,U.fromCache=!0,n.emit("response",U),typeof o=="function"&&o(U)}else p=C,b.headers=T.revalidationHeaders(b),E(b)},D=b=>n.emit("error",new t.CacheError(b));this.cache.once("error",D),n.on("response",()=>this.cache.removeListener("error",D));try{await w(r)}catch(b){r.automaticFailover&&!h&&E(r),n.emit("error",new t.CacheError(b))}})(),n}}};function Lnt(t){let e={...t};return e.path=`${t.pathname||"/"}${t.search||""}`,delete e.pathname,delete e.search,e}function S4(t){return{protocol:t.protocol,auth:t.auth,hostname:t.hostname||t.host||"localhost",port:t.port,pathname:t.pathname,search:t.search}}F1.RequestError=class extends Error{constructor(t){super(t.message),this.name="RequestError",Object.assign(this,t)}};F1.CacheError=class extends Error{constructor(t){super(t.message),this.name="CacheError",Object.assign(this,t)}};Dae.exports=F1});var xae=_((ANt,Pae)=>{"use strict";var Nnt=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];Pae.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(Nnt)),o={};for(let a of r)a in e||(o[a]={get(){let n=t[a];return typeof n=="function"?n.bind(t):n},set(n){t[a]=n},enumerable:!0,configurable:!1});return Object.defineProperties(e,o),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var kae=_((fNt,bae)=>{"use strict";var{Transform:Ont,PassThrough:Mnt}=ve("stream"),P4=ve("zlib"),Unt=xae();bae.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof P4.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let o=!0,a=new Ont({transform(A,p,h){o=!1,h(null,A)},flush(A){A()}}),n=new Mnt({autoDestroy:!1,destroy(A,p){t.destroy(),p(A)}}),u=r?P4.createBrotliDecompress():P4.createUnzip();return u.once("error",A=>{if(o&&!t.readable){n.end();return}n.destroy(A)}),Unt(t,n),t.pipe(a).pipe(u).pipe(n),n}});var b4=_((pNt,Qae)=>{"use strict";var x4=class{constructor(e={}){if(!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(e,r){if(this.cache.set(e,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(let[o,a]of this.oldCache.entries())this.onEviction(o,a);this.oldCache=this.cache,this.cache=new Map}}get(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){let r=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,r),r}}set(e,r){return this.cache.has(e)?this.cache.set(e,r):this._set(e,r),this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}delete(e){let r=this.cache.delete(e);return r&&this._size--,this.oldCache.delete(e)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache)yield e;for(let e of this.oldCache){let[r]=e;this.cache.has(r)||(yield e)}}get size(){let e=0;for(let r of this.oldCache.keys())this.cache.has(r)||e++;return Math.min(this._size+e,this.maxSize)}};Qae.exports=x4});var Q4=_((hNt,Lae)=>{"use strict";var _nt=ve("events"),Hnt=ve("tls"),qnt=ve("http2"),jnt=b4(),ea=Symbol("currentStreamsCount"),Fae=Symbol("request"),Jl=Symbol("cachedOriginSet"),wy=Symbol("gracefullyClosing"),Gnt=["maxDeflateDynamicTableSize","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","localAddress","path","rejectUnauthorized","minDHSize","ca","cert","clientCertEngine","ciphers","key","pfx","servername","minVersion","maxVersion","secureProtocol","crl","honorCipherOrder","ecdhCurve","dhparam","secureOptions","sessionIdContext"],Wnt=(t,e,r)=>{let o=0,a=t.length;for(;o>>1;r(t[n],e)?o=n+1:a=n}return o},Ynt=(t,e)=>t.remoteSettings.maxConcurrentStreams>e.remoteSettings.maxConcurrentStreams,k4=(t,e)=>{for(let r of t)r[Jl].lengthe[Jl].includes(o))&&r[ea]+e[ea]<=e.remoteSettings.maxConcurrentStreams&&Tae(r)},Vnt=(t,e)=>{for(let r of t)e[Jl].lengthr[Jl].includes(o))&&e[ea]+r[ea]<=r.remoteSettings.maxConcurrentStreams&&Tae(e)},Rae=({agent:t,isFree:e})=>{let r={};for(let o in t.sessions){let n=t.sessions[o].filter(u=>{let A=u[xg.kCurrentStreamsCount]{t[wy]=!0,t[ea]===0&&t.close()},xg=class t extends _nt{constructor({timeout:e=6e4,maxSessions:r=1/0,maxFreeSessions:o=10,maxCachedTlsSessions:a=100}={}){super(),this.sessions={},this.queue={},this.timeout=e,this.maxSessions=r,this.maxFreeSessions=o,this._freeSessionsCount=0,this._sessionsCount=0,this.settings={enablePush:!1},this.tlsSessionCache=new jnt({maxSize:a})}static normalizeOrigin(e,r){return typeof e=="string"&&(e=new URL(e)),r&&e.hostname!==r&&(e.hostname=r),e.origin}normalizeOptions(e){let r="";if(e)for(let o of Gnt)e[o]&&(r+=`:${e[o]}`);return r}_tryToCreateNewSession(e,r){if(!(e in this.queue)||!(r in this.queue[e]))return;let o=this.queue[e][r];this._sessionsCount{Array.isArray(o)?(o=[...o],a()):o=[{resolve:a,reject:n}];let u=this.normalizeOptions(r),A=t.normalizeOrigin(e,r&&r.servername);if(A===void 0){for(let{reject:E}of o)E(new TypeError("The `origin` argument needs to be a string or an URL object"));return}if(u in this.sessions){let E=this.sessions[u],w=-1,D=-1,b;for(let C of E){let T=C.remoteSettings.maxConcurrentStreams;if(T=T||C[wy]||C.destroyed)continue;b||(w=T),N>D&&(b=C,D=N)}}if(b){if(o.length!==1){for(let{reject:C}of o){let T=new Error(`Expected the length of listeners to be 1, got ${o.length}. -Please report this to https://github.com/szmarczak/http2-wrapper/`);C(T)}return}o[0].resolve(b);return}}if(u in this.queue){if(A in this.queue[u]){this.queue[u][A].listeners.push(...o),this._tryToCreateNewSession(u,A);return}}else this.queue[u]={};let p=()=>{u in this.queue&&this.queue[u][A]===h&&(delete this.queue[u][A],Object.keys(this.queue[u]).length===0&&delete this.queue[u])},h=()=>{let E=`${A}:${u}`,w=!1;try{let D=qnt.connect(e,{createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(E),...r});D[ea]=0,D[wy]=!1;let b=()=>D[ea]{this.tlsSessionCache.set(E,N)}),D.once("error",N=>{for(let{reject:U}of o)U(N);this.tlsSessionCache.delete(E)}),D.setTimeout(this.timeout,()=>{D.destroy()}),D.once("close",()=>{if(w){C&&this._freeSessionsCount--,this._sessionsCount--;let N=this.sessions[u];N.splice(N.indexOf(D),1),N.length===0&&delete this.sessions[u]}else{let N=new Error("Session closed without receiving a SETTINGS frame");N.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:U}of o)U(N);p()}this._tryToCreateNewSession(u,A)});let T=()=>{if(!(!(u in this.queue)||!b())){for(let N of D[Jl])if(N in this.queue[u]){let{listeners:U}=this.queue[u][N];for(;U.length!==0&&b();)U.shift().resolve(D);let J=this.queue[u];if(J[N].listeners.length===0&&(delete J[N],Object.keys(J).length===0)){delete this.queue[u];break}if(!b())break}}};D.on("origin",()=>{D[Jl]=D.originSet,b()&&(T(),k4(this.sessions[u],D))}),D.once("remoteSettings",()=>{if(D.ref(),D.unref(),this._sessionsCount++,h.destroyed){let N=new Error("Agent has been destroyed");for(let U of o)U.reject(N);D.destroy();return}D[Jl]=D.originSet;{let N=this.sessions;if(u in N){let U=N[u];U.splice(Wnt(U,D,Ynt),0,D)}else N[u]=[D]}this._freeSessionsCount+=1,w=!0,this.emit("session",D),T(),p(),D[ea]===0&&this._freeSessionsCount>this.maxFreeSessions&&D.close(),o.length!==0&&(this.getSession(A,r,o),o.length=0),D.on("remoteSettings",()=>{T(),k4(this.sessions[u],D)})}),D[Fae]=D.request,D.request=(N,U)=>{if(D[wy])throw new Error("The session is gracefully closing. No new streams are allowed.");let J=D[Fae](N,U);return D.ref(),++D[ea],D[ea]===D.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,J.once("close",()=>{if(C=b(),--D[ea],!D.destroyed&&!D.closed&&(Vnt(this.sessions[u],D),b()&&!D.closed)){C||(this._freeSessionsCount++,C=!0);let te=D[ea]===0;te&&D.unref(),te&&(this._freeSessionsCount>this.maxFreeSessions||D[wy])?D.close():(k4(this.sessions[u],D),T())}}),J}}catch(D){for(let b of o)b.reject(D);p()}};h.listeners=o,h.completed=!1,h.destroyed=!1,this.queue[u][A]=h,this._tryToCreateNewSession(u,A)})}request(e,r,o,a){return new Promise((n,u)=>{this.getSession(e,r,[{reject:u,resolve:A=>{try{n(A.request(o,a))}catch(p){u(p)}}}])})}createConnection(e,r){return t.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let o=e.port||443,a=e.hostname||e.host;return typeof r.servername>"u"&&(r.servername=a),Hnt.connect(o,a,r)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let r of e)r[ea]===0&&r.close()}destroy(e){for(let r of Object.values(this.sessions))for(let o of r)o.destroy(e);for(let r of Object.values(this.queue))for(let o of Object.values(r))o.destroyed=!0;this.queue={}}get freeSessions(){return Rae({agent:this,isFree:!0})}get busySessions(){return Rae({agent:this,isFree:!1})}};xg.kCurrentStreamsCount=ea;xg.kGracefullyClosing=wy;Lae.exports={Agent:xg,globalAgent:new xg}});var R4=_((gNt,Nae)=>{"use strict";var{Readable:Knt}=ve("stream"),F4=class extends Knt{constructor(e,r){super({highWaterMark:r,autoDestroy:!1}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this.connection=e,this._dumped=!1}_destroy(e){this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};Nae.exports=F4});var T4=_((dNt,Oae)=>{"use strict";Oae.exports=t=>{let e={protocol:t.protocol,hostname:typeof t.hostname=="string"&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return typeof t.port=="string"&&t.port.length!==0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var Uae=_((mNt,Mae)=>{"use strict";Mae.exports=(t,e,r)=>{for(let o of r)t.on(o,(...a)=>e.emit(o,...a))}});var Hae=_((yNt,_ae)=>{"use strict";_ae.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var jae=_((CNt,qae)=>{"use strict";var By=(t,e,r)=>{qae.exports[e]=class extends t{constructor(...a){super(typeof r=="string"?r:r(a)),this.name=`${super.name} [${e}]`,this.code=e}}};By(TypeError,"ERR_INVALID_ARG_TYPE",t=>{let e=t[0].includes(".")?"property":"argument",r=t[1],o=Array.isArray(r);return o&&(r=`${r.slice(0,-1).join(", ")} or ${r.slice(-1)}`),`The "${t[0]}" ${e} must be ${o?"one of":"of"} type ${r}. Received ${typeof t[2]}`});By(TypeError,"ERR_INVALID_PROTOCOL",t=>`Protocol "${t[0]}" not supported. Expected "${t[1]}"`);By(Error,"ERR_HTTP_HEADERS_SENT",t=>`Cannot ${t[0]} headers after they are sent to the client`);By(TypeError,"ERR_INVALID_HTTP_TOKEN",t=>`${t[0]} must be a valid HTTP token [${t[1]}]`);By(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",t=>`Invalid value "${t[0]} for header "${t[1]}"`);By(TypeError,"ERR_INVALID_CHAR",t=>`Invalid character in ${t[0]} [${t[1]}]`)});var U4=_((INt,zae)=>{"use strict";var Jnt=ve("http2"),{Writable:znt}=ve("stream"),{Agent:Gae,globalAgent:Xnt}=Q4(),Znt=R4(),$nt=T4(),eit=Uae(),tit=Hae(),{ERR_INVALID_ARG_TYPE:L4,ERR_INVALID_PROTOCOL:rit,ERR_HTTP_HEADERS_SENT:Wae,ERR_INVALID_HTTP_TOKEN:nit,ERR_HTTP_INVALID_HEADER_VALUE:iit,ERR_INVALID_CHAR:sit}=jae(),{HTTP2_HEADER_STATUS:Yae,HTTP2_HEADER_METHOD:Vae,HTTP2_HEADER_PATH:Kae,HTTP2_METHOD_CONNECT:oit}=Jnt.constants,vo=Symbol("headers"),N4=Symbol("origin"),O4=Symbol("session"),Jae=Symbol("options"),Lx=Symbol("flushedHeaders"),R1=Symbol("jobs"),ait=/^[\^`\-\w!#$%&*+.|~]+$/,lit=/[^\t\u0020-\u007E\u0080-\u00FF]/,M4=class extends znt{constructor(e,r,o){super({autoDestroy:!1});let a=typeof e=="string"||e instanceof URL;if(a&&(e=$nt(e instanceof URL?e:new URL(e))),typeof r=="function"||r===void 0?(o=r,r=a?e:{...e}):r={...e,...r},r.h2session)this[O4]=r.h2session;else if(r.agent===!1)this.agent=new Gae({maxFreeSessions:0});else if(typeof r.agent>"u"||r.agent===null)typeof r.createConnection=="function"?(this.agent=new Gae({maxFreeSessions:0}),this.agent.createConnection=r.createConnection):this.agent=Xnt;else if(typeof r.agent.request=="function")this.agent=r.agent;else throw new L4("options.agent",["Agent-like Object","undefined","false"],r.agent);if(r.protocol&&r.protocol!=="https:")throw new rit(r.protocol,"https:");let n=r.port||r.defaultPort||this.agent&&this.agent.defaultPort||443,u=r.hostname||r.host||"localhost";delete r.hostname,delete r.host,delete r.port;let{timeout:A}=r;if(r.timeout=void 0,this[vo]=Object.create(null),this[R1]=[],this.socket=null,this.connection=null,this.method=r.method||"GET",this.path=r.path,this.res=null,this.aborted=!1,this.reusedSocket=!1,r.headers)for(let[p,h]of Object.entries(r.headers))this.setHeader(p,h);r.auth&&!("authorization"in this[vo])&&(this[vo].authorization="Basic "+Buffer.from(r.auth).toString("base64")),r.session=r.tlsSession,r.path=r.socketPath,this[Jae]=r,n===443?(this[N4]=`https://${u}`,":authority"in this[vo]||(this[vo][":authority"]=u)):(this[N4]=`https://${u}:${n}`,":authority"in this[vo]||(this[vo][":authority"]=`${u}:${n}`)),A&&this.setTimeout(A),o&&this.once("response",o),this[Lx]=!1}get method(){return this[vo][Vae]}set method(e){e&&(this[vo][Vae]=e.toUpperCase())}get path(){return this[vo][Kae]}set path(e){e&&(this[vo][Kae]=e)}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write(e,r,o){if(this._mustNotHaveABody){o(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let a=()=>this._request.write(e,r,o);this._request?a():this[R1].push(a)}_final(e){if(this.destroyed)return;this.flushHeaders();let r=()=>{if(this._mustNotHaveABody){e();return}this._request.end(e)};this._request?r():this[R1].push(r)}abort(){this.res&&this.res.complete||(this.aborted||process.nextTick(()=>this.emit("abort")),this.aborted=!0,this.destroy())}_destroy(e,r){this.res&&this.res._dump(),this._request&&this._request.destroy(),r(e)}async flushHeaders(){if(this[Lx]||this.destroyed)return;this[Lx]=!0;let e=this.method===oit,r=o=>{if(this._request=o,this.destroyed){o.destroy();return}e||eit(o,this,["timeout","continue","close","error"]);let a=u=>(...A)=>{!this.writable&&!this.destroyed?u(...A):this.once("finish",()=>{u(...A)})};o.once("response",a((u,A,p)=>{let h=new Znt(this.socket,o.readableHighWaterMark);this.res=h,h.req=this,h.statusCode=u[Yae],h.headers=u,h.rawHeaders=p,h.once("end",()=>{this.aborted?(h.aborted=!0,h.emit("aborted")):(h.complete=!0,h.socket=null,h.connection=null)}),e?(h.upgrade=!0,this.emit("connect",h,o,Buffer.alloc(0))?this.emit("close"):o.destroy()):(o.on("data",E=>{!h._dumped&&!h.push(E)&&o.pause()}),o.once("end",()=>{h.push(null)}),this.emit("response",h)||h._dump())})),o.once("headers",a(u=>this.emit("information",{statusCode:u[Yae]}))),o.once("trailers",a((u,A,p)=>{let{res:h}=this;h.trailers=u,h.rawTrailers=p}));let{socket:n}=o.session;this.socket=n,this.connection=n;for(let u of this[R1])u();this.emit("socket",this.socket)};if(this[O4])try{r(this[O4].request(this[vo]))}catch(o){this.emit("error",o)}else{this.reusedSocket=!0;try{r(await this.agent.request(this[N4],this[Jae],this[vo]))}catch(o){this.emit("error",o)}}}getHeader(e){if(typeof e!="string")throw new L4("name","string",e);return this[vo][e.toLowerCase()]}get headersSent(){return this[Lx]}removeHeader(e){if(typeof e!="string")throw new L4("name","string",e);if(this.headersSent)throw new Wae("remove");delete this[vo][e.toLowerCase()]}setHeader(e,r){if(this.headersSent)throw new Wae("set");if(typeof e!="string"||!ait.test(e)&&!tit(e))throw new nit("Header name",e);if(typeof r>"u")throw new iit(r,e);if(lit.test(r))throw new sit("header content",e);this[vo][e.toLowerCase()]=r}setNoDelay(){}setSocketKeepAlive(){}setTimeout(e,r){let o=()=>this._request.setTimeout(e,r);return this._request?o():this[R1].push(o),this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize}set maxHeadersCount(e){}};zae.exports=M4});var Zae=_((wNt,Xae)=>{"use strict";var cit=ve("tls");Xae.exports=(t={},e=cit.connect)=>new Promise((r,o)=>{let a=!1,n,u=async()=>{await p,n.off("timeout",A),n.off("error",o),t.resolveSocket?(r({alpnProtocol:n.alpnProtocol,socket:n,timeout:a}),a&&(await Promise.resolve(),n.emit("timeout"))):(n.destroy(),r({alpnProtocol:n.alpnProtocol,timeout:a}))},A=async()=>{a=!0,u()},p=(async()=>{try{n=await e(t,u),n.on("error",o),n.once("timeout",A)}catch(h){o(h)}})()})});var ele=_((BNt,$ae)=>{"use strict";var uit=ve("net");$ae.exports=t=>{let e=t.host,r=t.headers&&t.headers.host;return r&&(r.startsWith("[")?r.indexOf("]")===-1?e=r:e=r.slice(1,-1):e=r.split(":",1)[0]),uit.isIP(e)?"":e}});var nle=_((vNt,H4)=>{"use strict";var tle=ve("http"),_4=ve("https"),Ait=Zae(),fit=b4(),pit=U4(),hit=ele(),git=T4(),Nx=new fit({maxSize:100}),T1=new Map,rle=(t,e,r)=>{e._httpMessage={shouldKeepAlive:!0};let o=()=>{t.emit("free",e,r)};e.on("free",o);let a=()=>{t.removeSocket(e,r)};e.on("close",a);let n=()=>{t.removeSocket(e,r),e.off("close",a),e.off("free",o),e.off("agentRemove",n)};e.on("agentRemove",n),t.emit("free",e,r)},dit=async t=>{let e=`${t.host}:${t.port}:${t.ALPNProtocols.sort()}`;if(!Nx.has(e)){if(T1.has(e))return(await T1.get(e)).alpnProtocol;let{path:r,agent:o}=t;t.path=t.socketPath;let a=Ait(t);T1.set(e,a);try{let{socket:n,alpnProtocol:u}=await a;if(Nx.set(e,u),t.path=r,u==="h2")n.destroy();else{let{globalAgent:A}=_4,p=_4.Agent.prototype.createConnection;o?o.createConnection===p?rle(o,n,t):n.destroy():A.createConnection===p?rle(A,n,t):n.destroy()}return T1.delete(e),u}catch(n){throw T1.delete(e),n}}return Nx.get(e)};H4.exports=async(t,e,r)=>{if((typeof t=="string"||t instanceof URL)&&(t=git(new URL(t))),typeof e=="function"&&(r=e,e=void 0),e={ALPNProtocols:["h2","http/1.1"],...t,...e,resolveSocket:!0},!Array.isArray(e.ALPNProtocols)||e.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");e.protocol=e.protocol||"https:";let o=e.protocol==="https:";e.host=e.hostname||e.host||"localhost",e.session=e.tlsSession,e.servername=e.servername||hit(e),e.port=e.port||(o?443:80),e._defaultAgent=o?_4.globalAgent:tle.globalAgent;let a=e.agent;if(a){if(a.addRequest)throw new Error("The `options.agent` object can contain only `http`, `https` or `http2` properties");e.agent=a[o?"https":"http"]}return o&&await dit(e)==="h2"?(a&&(e.agent=a.http2),new pit(e,r)):tle.request(e,r)};H4.exports.protocolCache=Nx});var sle=_((DNt,ile)=>{"use strict";var mit=ve("http2"),yit=Q4(),q4=U4(),Eit=R4(),Cit=nle(),Iit=(t,e,r)=>new q4(t,e,r),wit=(t,e,r)=>{let o=new q4(t,e,r);return o.end(),o};ile.exports={...mit,ClientRequest:q4,IncomingMessage:Eit,...yit,request:Iit,get:wit,auto:Cit}});var G4=_(j4=>{"use strict";Object.defineProperty(j4,"__esModule",{value:!0});var ole=Ff();j4.default=t=>ole.default.nodeStream(t)&&ole.default.function_(t.getBoundary)});var ule=_(W4=>{"use strict";Object.defineProperty(W4,"__esModule",{value:!0});var lle=ve("fs"),cle=ve("util"),ale=Ff(),Bit=G4(),vit=cle.promisify(lle.stat);W4.default=async(t,e)=>{if(e&&"content-length"in e)return Number(e["content-length"]);if(!t)return 0;if(ale.default.string(t))return Buffer.byteLength(t);if(ale.default.buffer(t))return t.length;if(Bit.default(t))return cle.promisify(t.getLength.bind(t))();if(t instanceof lle.ReadStream){let{size:r}=await vit(t.path);return r===0?void 0:r}}});var V4=_(Y4=>{"use strict";Object.defineProperty(Y4,"__esModule",{value:!0});function Dit(t,e,r){let o={};for(let a of r)o[a]=(...n)=>{e.emit(a,...n)},t.on(a,o[a]);return()=>{for(let a of r)t.off(a,o[a])}}Y4.default=Dit});var Ale=_(K4=>{"use strict";Object.defineProperty(K4,"__esModule",{value:!0});K4.default=()=>{let t=[];return{once(e,r,o){e.once(r,o),t.push({origin:e,event:r,fn:o})},unhandleAll(){for(let e of t){let{origin:r,event:o,fn:a}=e;r.removeListener(o,a)}t.length=0}}}});var ple=_(L1=>{"use strict";Object.defineProperty(L1,"__esModule",{value:!0});L1.TimeoutError=void 0;var Sit=ve("net"),Pit=Ale(),fle=Symbol("reentry"),xit=()=>{},Ox=class extends Error{constructor(e,r){super(`Timeout awaiting '${r}' for ${e}ms`),this.event=r,this.name="TimeoutError",this.code="ETIMEDOUT"}};L1.TimeoutError=Ox;L1.default=(t,e,r)=>{if(fle in t)return xit;t[fle]=!0;let o=[],{once:a,unhandleAll:n}=Pit.default(),u=(w,D,b)=>{var C;let T=setTimeout(D,w,w,b);(C=T.unref)===null||C===void 0||C.call(T);let N=()=>{clearTimeout(T)};return o.push(N),N},{host:A,hostname:p}=r,h=(w,D)=>{t.destroy(new Ox(w,D))},E=()=>{for(let w of o)w();n()};if(t.once("error",w=>{if(E(),t.listenerCount("error")===0)throw w}),t.once("close",E),a(t,"response",w=>{a(w,"end",E)}),typeof e.request<"u"&&u(e.request,h,"request"),typeof e.socket<"u"){let w=()=>{h(e.socket,"socket")};t.setTimeout(e.socket,w),o.push(()=>{t.removeListener("timeout",w)})}return a(t,"socket",w=>{var D;let{socketPath:b}=t;if(w.connecting){let C=!!(b??Sit.isIP((D=p??A)!==null&&D!==void 0?D:"")!==0);if(typeof e.lookup<"u"&&!C&&typeof w.address().address>"u"){let T=u(e.lookup,h,"lookup");a(w,"lookup",T)}if(typeof e.connect<"u"){let T=()=>u(e.connect,h,"connect");C?a(w,"connect",T()):a(w,"lookup",N=>{N===null&&a(w,"connect",T())})}typeof e.secureConnect<"u"&&r.protocol==="https:"&&a(w,"connect",()=>{let T=u(e.secureConnect,h,"secureConnect");a(w,"secureConnect",T)})}if(typeof e.send<"u"){let C=()=>u(e.send,h,"send");w.connecting?a(w,"connect",()=>{a(t,"upload-complete",C())}):a(t,"upload-complete",C())}}),typeof e.response<"u"&&a(t,"upload-complete",()=>{let w=u(e.response,h,"response");a(t,"response",w)}),E}});var gle=_(J4=>{"use strict";Object.defineProperty(J4,"__esModule",{value:!0});var hle=Ff();J4.default=t=>{t=t;let e={protocol:t.protocol,hostname:hle.default.string(t.hostname)&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return hle.default.string(t.port)&&t.port.length>0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var dle=_(z4=>{"use strict";Object.defineProperty(z4,"__esModule",{value:!0});var bit=ve("url"),kit=["protocol","host","hostname","port","pathname","search"];z4.default=(t,e)=>{var r,o;if(e.path){if(e.pathname)throw new TypeError("Parameters `path` and `pathname` are mutually exclusive.");if(e.search)throw new TypeError("Parameters `path` and `search` are mutually exclusive.");if(e.searchParams)throw new TypeError("Parameters `path` and `searchParams` are mutually exclusive.")}if(e.search&&e.searchParams)throw new TypeError("Parameters `search` and `searchParams` are mutually exclusive.");if(!t){if(!e.protocol)throw new TypeError("No URL protocol specified");t=`${e.protocol}//${(o=(r=e.hostname)!==null&&r!==void 0?r:e.host)!==null&&o!==void 0?o:""}`}let a=new bit.URL(t);if(e.path){let n=e.path.indexOf("?");n===-1?e.pathname=e.path:(e.pathname=e.path.slice(0,n),e.search=e.path.slice(n+1)),delete e.path}for(let n of kit)e[n]&&(a[n]=e[n].toString());return a}});var mle=_(Z4=>{"use strict";Object.defineProperty(Z4,"__esModule",{value:!0});var X4=class{constructor(){this.weakMap=new WeakMap,this.map=new Map}set(e,r){typeof e=="object"?this.weakMap.set(e,r):this.map.set(e,r)}get(e){return typeof e=="object"?this.weakMap.get(e):this.map.get(e)}has(e){return typeof e=="object"?this.weakMap.has(e):this.map.has(e)}};Z4.default=X4});var eU=_($4=>{"use strict";Object.defineProperty($4,"__esModule",{value:!0});var Qit=async t=>{let e=[],r=0;for await(let o of t)e.push(o),r+=Buffer.byteLength(o);return Buffer.isBuffer(e[0])?Buffer.concat(e,r):Buffer.from(e.join(""))};$4.default=Qit});var Ele=_(bg=>{"use strict";Object.defineProperty(bg,"__esModule",{value:!0});bg.dnsLookupIpVersionToFamily=bg.isDnsLookupIpVersion=void 0;var yle={auto:0,ipv4:4,ipv6:6};bg.isDnsLookupIpVersion=t=>t in yle;bg.dnsLookupIpVersionToFamily=t=>{if(bg.isDnsLookupIpVersion(t))return yle[t];throw new Error("Invalid DNS lookup IP version")}});var tU=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:!0});Mx.isResponseOk=void 0;Mx.isResponseOk=t=>{let{statusCode:e}=t,r=t.request.options.followRedirect?299:399;return e>=200&&e<=r||e===304}});var Ile=_(rU=>{"use strict";Object.defineProperty(rU,"__esModule",{value:!0});var Cle=new Set;rU.default=t=>{Cle.has(t)||(Cle.add(t),process.emitWarning(`Got: ${t}`,{type:"DeprecationWarning"}))}});var wle=_(nU=>{"use strict";Object.defineProperty(nU,"__esModule",{value:!0});var mi=Ff(),Fit=(t,e)=>{if(mi.default.null_(t.encoding))throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead");mi.assert.any([mi.default.string,mi.default.undefined],t.encoding),mi.assert.any([mi.default.boolean,mi.default.undefined],t.resolveBodyOnly),mi.assert.any([mi.default.boolean,mi.default.undefined],t.methodRewriting),mi.assert.any([mi.default.boolean,mi.default.undefined],t.isStream),mi.assert.any([mi.default.string,mi.default.undefined],t.responseType),t.responseType===void 0&&(t.responseType="text");let{retry:r}=t;if(e?t.retry={...e.retry}:t.retry={calculateDelay:o=>o.computedValue,limit:0,methods:[],statusCodes:[],errorCodes:[],maxRetryAfter:void 0},mi.default.object(r)?(t.retry={...t.retry,...r},t.retry.methods=[...new Set(t.retry.methods.map(o=>o.toUpperCase()))],t.retry.statusCodes=[...new Set(t.retry.statusCodes)],t.retry.errorCodes=[...new Set(t.retry.errorCodes)]):mi.default.number(r)&&(t.retry.limit=r),mi.default.undefined(t.retry.maxRetryAfter)&&(t.retry.maxRetryAfter=Math.min(...[t.timeout.request,t.timeout.connect].filter(mi.default.number))),mi.default.object(t.pagination)){e&&(t.pagination={...e.pagination,...t.pagination});let{pagination:o}=t;if(!mi.default.function_(o.transform))throw new Error("`options.pagination.transform` must be implemented");if(!mi.default.function_(o.shouldContinue))throw new Error("`options.pagination.shouldContinue` must be implemented");if(!mi.default.function_(o.filter))throw new TypeError("`options.pagination.filter` must be implemented");if(!mi.default.function_(o.paginate))throw new Error("`options.pagination.paginate` must be implemented")}return t.responseType==="json"&&t.headers.accept===void 0&&(t.headers.accept="application/json"),t};nU.default=Fit});var Ble=_(N1=>{"use strict";Object.defineProperty(N1,"__esModule",{value:!0});N1.retryAfterStatusCodes=void 0;N1.retryAfterStatusCodes=new Set([413,429,503]);var Rit=({attemptCount:t,retryOptions:e,error:r,retryAfter:o})=>{if(t>e.limit)return 0;let a=e.methods.includes(r.options.method),n=e.errorCodes.includes(r.code),u=r.response&&e.statusCodes.includes(r.response.statusCode);if(!a||!n&&!u)return 0;if(r.response){if(o)return e.maxRetryAfter===void 0||o>e.maxRetryAfter?0:o;if(r.response.statusCode===413)return 0}let A=Math.random()*100;return 2**(t-1)*1e3+A};N1.default=Rit});var U1=_(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.UnsupportedProtocolError=Qn.ReadError=Qn.TimeoutError=Qn.UploadError=Qn.CacheError=Qn.HTTPError=Qn.MaxRedirectsError=Qn.RequestError=Qn.setNonEnumerableProperties=Qn.knownHookEvents=Qn.withoutBody=Qn.kIsNormalizedAlready=void 0;var vle=ve("util"),Dle=ve("stream"),Tit=ve("fs"),uh=ve("url"),Sle=ve("http"),iU=ve("http"),Lit=ve("https"),Nit=_oe(),Oit=Voe(),Ple=Sae(),Mit=kae(),Uit=sle(),_it=Rx(),at=Ff(),Hit=ule(),xle=G4(),qit=V4(),ble=ple(),jit=gle(),kle=dle(),Git=mle(),Wit=eU(),Qle=Ele(),Yit=tU(),Ah=Ile(),Vit=wle(),Kit=Ble(),sU,Ys=Symbol("request"),Hx=Symbol("response"),vy=Symbol("responseSize"),Dy=Symbol("downloadedSize"),Sy=Symbol("bodySize"),Py=Symbol("uploadedSize"),Ux=Symbol("serverResponsesPiped"),Fle=Symbol("unproxyEvents"),Rle=Symbol("isFromCache"),oU=Symbol("cancelTimeouts"),Tle=Symbol("startedReading"),xy=Symbol("stopReading"),_x=Symbol("triggerRead"),fh=Symbol("body"),O1=Symbol("jobs"),Lle=Symbol("originalResponse"),Nle=Symbol("retryTimeout");Qn.kIsNormalizedAlready=Symbol("isNormalizedAlready");var Jit=at.default.string(process.versions.brotli);Qn.withoutBody=new Set(["GET","HEAD"]);Qn.knownHookEvents=["init","beforeRequest","beforeRedirect","beforeError","beforeRetry","afterResponse"];function zit(t){for(let e in t){let r=t[e];if(!at.default.string(r)&&!at.default.number(r)&&!at.default.boolean(r)&&!at.default.null_(r)&&!at.default.undefined(r))throw new TypeError(`The \`searchParams\` value '${String(r)}' must be a string, number, boolean or null`)}}function Xit(t){return at.default.object(t)&&!("statusCode"in t)}var aU=new Git.default,Zit=async t=>new Promise((e,r)=>{let o=a=>{r(a)};t.pending||e(),t.once("error",o),t.once("ready",()=>{t.off("error",o),e()})}),$it=new Set([300,301,302,303,304,307,308]),est=["context","body","json","form"];Qn.setNonEnumerableProperties=(t,e)=>{let r={};for(let o of t)if(o)for(let a of est)a in o&&(r[a]={writable:!0,configurable:!0,enumerable:!1,value:o[a]});Object.defineProperties(e,r)};var zi=class extends Error{constructor(e,r,o){var a;if(super(e),Error.captureStackTrace(this,this.constructor),this.name="RequestError",this.code=r.code,o instanceof Kx?(Object.defineProperty(this,"request",{enumerable:!1,value:o}),Object.defineProperty(this,"response",{enumerable:!1,value:o[Hx]}),Object.defineProperty(this,"options",{enumerable:!1,value:o.options})):Object.defineProperty(this,"options",{enumerable:!1,value:o}),this.timings=(a=this.request)===null||a===void 0?void 0:a.timings,at.default.string(r.stack)&&at.default.string(this.stack)){let n=this.stack.indexOf(this.message)+this.message.length,u=this.stack.slice(n).split(` -`).reverse(),A=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(` -`).reverse();for(;A.length!==0&&A[0]===u[0];)u.shift();this.stack=`${this.stack.slice(0,n)}${u.reverse().join(` -`)}${A.reverse().join(` -`)}`}}};Qn.RequestError=zi;var qx=class extends zi{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e),this.name="MaxRedirectsError"}};Qn.MaxRedirectsError=qx;var jx=class extends zi{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request),this.name="HTTPError"}};Qn.HTTPError=jx;var Gx=class extends zi{constructor(e,r){super(e.message,e,r),this.name="CacheError"}};Qn.CacheError=Gx;var Wx=class extends zi{constructor(e,r){super(e.message,e,r),this.name="UploadError"}};Qn.UploadError=Wx;var Yx=class extends zi{constructor(e,r,o){super(e.message,e,o),this.name="TimeoutError",this.event=e.event,this.timings=r}};Qn.TimeoutError=Yx;var M1=class extends zi{constructor(e,r){super(e.message,e,r),this.name="ReadError"}};Qn.ReadError=M1;var Vx=class extends zi{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e),this.name="UnsupportedProtocolError"}};Qn.UnsupportedProtocolError=Vx;var tst=["socket","connect","continue","information","upgrade","timeout"],Kx=class extends Dle.Duplex{constructor(e,r={},o){super({autoDestroy:!1,highWaterMark:0}),this[Dy]=0,this[Py]=0,this.requestInitialized=!1,this[Ux]=new Set,this.redirects=[],this[xy]=!1,this[_x]=!1,this[O1]=[],this.retryCount=0,this._progressCallbacks=[];let a=()=>this._unlockWrite(),n=()=>this._lockWrite();this.on("pipe",h=>{h.prependListener("data",a),h.on("data",n),h.prependListener("end",a),h.on("end",n)}),this.on("unpipe",h=>{h.off("data",a),h.off("data",n),h.off("end",a),h.off("end",n)}),this.on("pipe",h=>{h instanceof iU.IncomingMessage&&(this.options.headers={...h.headers,...this.options.headers})});let{json:u,body:A,form:p}=r;if((u||A||p)&&this._lockWrite(),Qn.kIsNormalizedAlready in r)this.options=r;else try{this.options=this.constructor.normalizeArguments(e,r,o)}catch(h){at.default.nodeStream(r.body)&&r.body.destroy(),this.destroy(h);return}(async()=>{var h;try{this.options.body instanceof Tit.ReadStream&&await Zit(this.options.body);let{url:E}=this.options;if(!E)throw new TypeError("Missing `url` property");if(this.requestUrl=E.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(h=this[Ys])===null||h===void 0||h.destroy();return}for(let w of this[O1])w();this[O1].length=0,this.requestInitialized=!0}catch(E){if(E instanceof zi){this._beforeError(E);return}this.destroyed||this.destroy(E)}})()}static normalizeArguments(e,r,o){var a,n,u,A,p;let h=r;if(at.default.object(e)&&!at.default.urlInstance(e))r={...o,...e,...r};else{if(e&&r&&r.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");r={...o,...r},e!==void 0&&(r.url=e),at.default.urlInstance(r.url)&&(r.url=new uh.URL(r.url.toString()))}if(r.cache===!1&&(r.cache=void 0),r.dnsCache===!1&&(r.dnsCache=void 0),at.assert.any([at.default.string,at.default.undefined],r.method),at.assert.any([at.default.object,at.default.undefined],r.headers),at.assert.any([at.default.string,at.default.urlInstance,at.default.undefined],r.prefixUrl),at.assert.any([at.default.object,at.default.undefined],r.cookieJar),at.assert.any([at.default.object,at.default.string,at.default.undefined],r.searchParams),at.assert.any([at.default.object,at.default.string,at.default.undefined],r.cache),at.assert.any([at.default.object,at.default.number,at.default.undefined],r.timeout),at.assert.any([at.default.object,at.default.undefined],r.context),at.assert.any([at.default.object,at.default.undefined],r.hooks),at.assert.any([at.default.boolean,at.default.undefined],r.decompress),at.assert.any([at.default.boolean,at.default.undefined],r.ignoreInvalidCookies),at.assert.any([at.default.boolean,at.default.undefined],r.followRedirect),at.assert.any([at.default.number,at.default.undefined],r.maxRedirects),at.assert.any([at.default.boolean,at.default.undefined],r.throwHttpErrors),at.assert.any([at.default.boolean,at.default.undefined],r.http2),at.assert.any([at.default.boolean,at.default.undefined],r.allowGetBody),at.assert.any([at.default.string,at.default.undefined],r.localAddress),at.assert.any([Qle.isDnsLookupIpVersion,at.default.undefined],r.dnsLookupIpVersion),at.assert.any([at.default.object,at.default.undefined],r.https),at.assert.any([at.default.boolean,at.default.undefined],r.rejectUnauthorized),r.https&&(at.assert.any([at.default.boolean,at.default.undefined],r.https.rejectUnauthorized),at.assert.any([at.default.function_,at.default.undefined],r.https.checkServerIdentity),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.certificateAuthority),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.key),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.certificate),at.assert.any([at.default.string,at.default.undefined],r.https.passphrase),at.assert.any([at.default.string,at.default.buffer,at.default.array,at.default.undefined],r.https.pfx)),at.assert.any([at.default.object,at.default.undefined],r.cacheOptions),at.default.string(r.method)?r.method=r.method.toUpperCase():r.method="GET",r.headers===o?.headers?r.headers={...r.headers}:r.headers=_it({...o?.headers,...r.headers}),"slashes"in r)throw new TypeError("The legacy `url.Url` has been deprecated. Use `URL` instead.");if("auth"in r)throw new TypeError("Parameter `auth` is deprecated. Use `username` / `password` instead.");if("searchParams"in r&&r.searchParams&&r.searchParams!==o?.searchParams){let b;if(at.default.string(r.searchParams)||r.searchParams instanceof uh.URLSearchParams)b=new uh.URLSearchParams(r.searchParams);else{zit(r.searchParams),b=new uh.URLSearchParams;for(let C in r.searchParams){let T=r.searchParams[C];T===null?b.append(C,""):T!==void 0&&b.append(C,T)}}(a=o?.searchParams)===null||a===void 0||a.forEach((C,T)=>{b.has(T)||b.append(T,C)}),r.searchParams=b}if(r.username=(n=r.username)!==null&&n!==void 0?n:"",r.password=(u=r.password)!==null&&u!==void 0?u:"",at.default.undefined(r.prefixUrl)?r.prefixUrl=(A=o?.prefixUrl)!==null&&A!==void 0?A:"":(r.prefixUrl=r.prefixUrl.toString(),r.prefixUrl!==""&&!r.prefixUrl.endsWith("/")&&(r.prefixUrl+="/")),at.default.string(r.url)){if(r.url.startsWith("/"))throw new Error("`input` must not start with a slash when using `prefixUrl`");r.url=kle.default(r.prefixUrl+r.url,r)}else(at.default.undefined(r.url)&&r.prefixUrl!==""||r.protocol)&&(r.url=kle.default(r.prefixUrl,r));if(r.url){"port"in r&&delete r.port;let{prefixUrl:b}=r;Object.defineProperty(r,"prefixUrl",{set:T=>{let N=r.url;if(!N.href.startsWith(T))throw new Error(`Cannot change \`prefixUrl\` from ${b} to ${T}: ${N.href}`);r.url=new uh.URL(T+N.href.slice(b.length)),b=T},get:()=>b});let{protocol:C}=r.url;if(C==="unix:"&&(C="http:",r.url=new uh.URL(`http://unix${r.url.pathname}${r.url.search}`)),r.searchParams&&(r.url.search=r.searchParams.toString()),C!=="http:"&&C!=="https:")throw new Vx(r);r.username===""?r.username=r.url.username:r.url.username=r.username,r.password===""?r.password=r.url.password:r.url.password=r.password}let{cookieJar:E}=r;if(E){let{setCookie:b,getCookieString:C}=E;at.assert.function_(b),at.assert.function_(C),b.length===4&&C.length===0&&(b=vle.promisify(b.bind(r.cookieJar)),C=vle.promisify(C.bind(r.cookieJar)),r.cookieJar={setCookie:b,getCookieString:C})}let{cache:w}=r;if(w&&(aU.has(w)||aU.set(w,new Ple((b,C)=>{let T=b[Ys](b,C);return at.default.promise(T)&&(T.once=(N,U)=>{if(N==="error")T.catch(U);else if(N==="abort")(async()=>{try{(await T).once("abort",U)}catch{}})();else throw new Error(`Unknown HTTP2 promise event: ${N}`);return T}),T},w))),r.cacheOptions={...r.cacheOptions},r.dnsCache===!0)sU||(sU=new Oit.default),r.dnsCache=sU;else if(!at.default.undefined(r.dnsCache)&&!r.dnsCache.lookup)throw new TypeError(`Parameter \`dnsCache\` must be a CacheableLookup instance or a boolean, got ${at.default(r.dnsCache)}`);at.default.number(r.timeout)?r.timeout={request:r.timeout}:o&&r.timeout!==o.timeout?r.timeout={...o.timeout,...r.timeout}:r.timeout={...r.timeout},r.context||(r.context={});let D=r.hooks===o?.hooks;r.hooks={...r.hooks};for(let b of Qn.knownHookEvents)if(b in r.hooks)if(at.default.array(r.hooks[b]))r.hooks[b]=[...r.hooks[b]];else throw new TypeError(`Parameter \`${b}\` must be an Array, got ${at.default(r.hooks[b])}`);else r.hooks[b]=[];if(o&&!D)for(let b of Qn.knownHookEvents)o.hooks[b].length>0&&(r.hooks[b]=[...o.hooks[b],...r.hooks[b]]);if("family"in r&&Ah.default('"options.family" was never documented, please use "options.dnsLookupIpVersion"'),o?.https&&(r.https={...o.https,...r.https}),"rejectUnauthorized"in r&&Ah.default('"options.rejectUnauthorized" is now deprecated, please use "options.https.rejectUnauthorized"'),"checkServerIdentity"in r&&Ah.default('"options.checkServerIdentity" was never documented, please use "options.https.checkServerIdentity"'),"ca"in r&&Ah.default('"options.ca" was never documented, please use "options.https.certificateAuthority"'),"key"in r&&Ah.default('"options.key" was never documented, please use "options.https.key"'),"cert"in r&&Ah.default('"options.cert" was never documented, please use "options.https.certificate"'),"passphrase"in r&&Ah.default('"options.passphrase" was never documented, please use "options.https.passphrase"'),"pfx"in r&&Ah.default('"options.pfx" was never documented, please use "options.https.pfx"'),"followRedirects"in r)throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.");if(r.agent){for(let b in r.agent)if(b!=="http"&&b!=="https"&&b!=="http2")throw new TypeError(`Expected the \`options.agent\` properties to be \`http\`, \`https\` or \`http2\`, got \`${b}\``)}return r.maxRedirects=(p=r.maxRedirects)!==null&&p!==void 0?p:0,Qn.setNonEnumerableProperties([o,h],r),Vit.default(r,o)}_lockWrite(){let e=()=>{throw new TypeError("The payload has been already provided")};this.write=e,this.end=e}_unlockWrite(){this.write=super.write,this.end=super.end}async _finalizeBody(){let{options:e}=this,{headers:r}=e,o=!at.default.undefined(e.form),a=!at.default.undefined(e.json),n=!at.default.undefined(e.body),u=o||a||n,A=Qn.withoutBody.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);if(this._cannotHaveBody=A,u){if(A)throw new TypeError(`The \`${e.method}\` method cannot be used with a body`);if([n,o,a].filter(p=>p).length>1)throw new TypeError("The `body`, `json` and `form` options are mutually exclusive");if(n&&!(e.body instanceof Dle.Readable)&&!at.default.string(e.body)&&!at.default.buffer(e.body)&&!xle.default(e.body))throw new TypeError("The `body` option must be a stream.Readable, string or Buffer");if(o&&!at.default.object(e.form))throw new TypeError("The `form` option must be an Object");{let p=!at.default.string(r["content-type"]);n?(xle.default(e.body)&&p&&(r["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`),this[fh]=e.body):o?(p&&(r["content-type"]="application/x-www-form-urlencoded"),this[fh]=new uh.URLSearchParams(e.form).toString()):(p&&(r["content-type"]="application/json"),this[fh]=e.stringifyJson(e.json));let h=await Hit.default(this[fh],e.headers);at.default.undefined(r["content-length"])&&at.default.undefined(r["transfer-encoding"])&&!A&&!at.default.undefined(h)&&(r["content-length"]=String(h))}}else A?this._lockWrite():this._unlockWrite();this[Sy]=Number(r["content-length"])||void 0}async _onResponseBase(e){let{options:r}=this,{url:o}=r;this[Lle]=e,r.decompress&&(e=Mit(e));let a=e.statusCode,n=e;n.statusMessage=n.statusMessage?n.statusMessage:Sle.STATUS_CODES[a],n.url=r.url.toString(),n.requestUrl=this.requestUrl,n.redirectUrls=this.redirects,n.request=this,n.isFromCache=e.fromCache||!1,n.ip=this.ip,n.retryCount=this.retryCount,this[Rle]=n.isFromCache,this[vy]=Number(e.headers["content-length"])||void 0,this[Hx]=e,e.once("end",()=>{this[vy]=this[Dy],this.emit("downloadProgress",this.downloadProgress)}),e.once("error",A=>{e.destroy(),this._beforeError(new M1(A,this))}),e.once("aborted",()=>{this._beforeError(new M1({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}),this.emit("downloadProgress",this.downloadProgress);let u=e.headers["set-cookie"];if(at.default.object(r.cookieJar)&&u){let A=u.map(async p=>r.cookieJar.setCookie(p,o.toString()));r.ignoreInvalidCookies&&(A=A.map(async p=>p.catch(()=>{})));try{await Promise.all(A)}catch(p){this._beforeError(p);return}}if(r.followRedirect&&e.headers.location&&$it.has(a)){if(e.resume(),this[Ys]&&(this[oU](),delete this[Ys],this[Fle]()),(a===303&&r.method!=="GET"&&r.method!=="HEAD"||!r.methodRewriting)&&(r.method="GET","body"in r&&delete r.body,"json"in r&&delete r.json,"form"in r&&delete r.form,this[fh]=void 0,delete r.headers["content-length"]),this.redirects.length>=r.maxRedirects){this._beforeError(new qx(this));return}try{let p=Buffer.from(e.headers.location,"binary").toString(),h=new uh.URL(p,o),E=h.toString();decodeURI(E),h.hostname!==o.hostname||h.port!==o.port?("host"in r.headers&&delete r.headers.host,"cookie"in r.headers&&delete r.headers.cookie,"authorization"in r.headers&&delete r.headers.authorization,(r.username||r.password)&&(r.username="",r.password="")):(h.username=r.username,h.password=r.password),this.redirects.push(E),r.url=h;for(let w of r.hooks.beforeRedirect)await w(r,n);this.emit("redirect",n,r),await this._makeRequest()}catch(p){this._beforeError(p);return}return}if(r.isStream&&r.throwHttpErrors&&!Yit.isResponseOk(n)){this._beforeError(new jx(n));return}e.on("readable",()=>{this[_x]&&this._read()}),this.on("resume",()=>{e.resume()}),this.on("pause",()=>{e.pause()}),e.once("end",()=>{this.push(null)}),this.emit("response",e);for(let A of this[Ux])if(!A.headersSent){for(let p in e.headers){let h=r.decompress?p!=="content-encoding":!0,E=e.headers[p];h&&A.setHeader(p,E)}A.statusCode=a}}async _onResponse(e){try{await this._onResponseBase(e)}catch(r){this._beforeError(r)}}_onRequest(e){let{options:r}=this,{timeout:o,url:a}=r;Nit.default(e),this[oU]=ble.default(e,o,a);let n=r.cache?"cacheableResponse":"response";e.once(n,p=>{this._onResponse(p)}),e.once("error",p=>{var h;e.destroy(),(h=e.res)===null||h===void 0||h.removeAllListeners("end"),p=p instanceof ble.TimeoutError?new Yx(p,this.timings,this):new zi(p.message,p,this),this._beforeError(p)}),this[Fle]=qit.default(e,this,tst),this[Ys]=e,this.emit("uploadProgress",this.uploadProgress);let u=this[fh],A=this.redirects.length===0?this:e;at.default.nodeStream(u)?(u.pipe(A),u.once("error",p=>{this._beforeError(new Wx(p,this))})):(this._unlockWrite(),at.default.undefined(u)?(this._cannotHaveBody||this._noPipe)&&(A.end(),this._lockWrite()):(this._writeRequest(u,void 0,()=>{}),A.end(),this._lockWrite())),this.emit("request",e)}async _createCacheableRequest(e,r){return new Promise((o,a)=>{Object.assign(r,jit.default(e)),delete r.url;let n,u=aU.get(r.cache)(r,async A=>{A._readableState.autoDestroy=!1,n&&(await n).emit("cacheableResponse",A),o(A)});r.url=e,u.once("error",a),u.once("request",async A=>{n=A,o(n)})})}async _makeRequest(){var e,r,o,a,n;let{options:u}=this,{headers:A}=u;for(let U in A)if(at.default.undefined(A[U]))delete A[U];else if(at.default.null_(A[U]))throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${U}\` header`);if(u.decompress&&at.default.undefined(A["accept-encoding"])&&(A["accept-encoding"]=Jit?"gzip, deflate, br":"gzip, deflate"),u.cookieJar){let U=await u.cookieJar.getCookieString(u.url.toString());at.default.nonEmptyString(U)&&(u.headers.cookie=U)}for(let U of u.hooks.beforeRequest){let J=await U(u);if(!at.default.undefined(J)){u.request=()=>J;break}}u.body&&this[fh]!==u.body&&(this[fh]=u.body);let{agent:p,request:h,timeout:E,url:w}=u;if(u.dnsCache&&!("lookup"in u)&&(u.lookup=u.dnsCache.lookup),w.hostname==="unix"){let U=/(?.+?):(?.+)/.exec(`${w.pathname}${w.search}`);if(U?.groups){let{socketPath:J,path:te}=U.groups;Object.assign(u,{socketPath:J,path:te,host:""})}}let D=w.protocol==="https:",b;u.http2?b=Uit.auto:b=D?Lit.request:Sle.request;let C=(e=u.request)!==null&&e!==void 0?e:b,T=u.cache?this._createCacheableRequest:C;p&&!u.http2&&(u.agent=p[D?"https":"http"]),u[Ys]=C,delete u.request,delete u.timeout;let N=u;if(N.shared=(r=u.cacheOptions)===null||r===void 0?void 0:r.shared,N.cacheHeuristic=(o=u.cacheOptions)===null||o===void 0?void 0:o.cacheHeuristic,N.immutableMinTimeToLive=(a=u.cacheOptions)===null||a===void 0?void 0:a.immutableMinTimeToLive,N.ignoreCargoCult=(n=u.cacheOptions)===null||n===void 0?void 0:n.ignoreCargoCult,u.dnsLookupIpVersion!==void 0)try{N.family=Qle.dnsLookupIpVersionToFamily(u.dnsLookupIpVersion)}catch{throw new Error("Invalid `dnsLookupIpVersion` option value")}u.https&&("rejectUnauthorized"in u.https&&(N.rejectUnauthorized=u.https.rejectUnauthorized),u.https.checkServerIdentity&&(N.checkServerIdentity=u.https.checkServerIdentity),u.https.certificateAuthority&&(N.ca=u.https.certificateAuthority),u.https.certificate&&(N.cert=u.https.certificate),u.https.key&&(N.key=u.https.key),u.https.passphrase&&(N.passphrase=u.https.passphrase),u.https.pfx&&(N.pfx=u.https.pfx));try{let U=await T(w,N);at.default.undefined(U)&&(U=b(w,N)),u.request=h,u.timeout=E,u.agent=p,u.https&&("rejectUnauthorized"in u.https&&delete N.rejectUnauthorized,u.https.checkServerIdentity&&delete N.checkServerIdentity,u.https.certificateAuthority&&delete N.ca,u.https.certificate&&delete N.cert,u.https.key&&delete N.key,u.https.passphrase&&delete N.passphrase,u.https.pfx&&delete N.pfx),Xit(U)?this._onRequest(U):this.writable?(this.once("finish",()=>{this._onResponse(U)}),this._unlockWrite(),this.end(),this._lockWrite()):this._onResponse(U)}catch(U){throw U instanceof Ple.CacheError?new Gx(U,this):new zi(U.message,U,this)}}async _error(e){try{for(let r of this.options.hooks.beforeError)e=await r(e)}catch(r){e=new zi(r.message,r,this)}this.destroy(e)}_beforeError(e){if(this[xy])return;let{options:r}=this,o=this.retryCount+1;this[xy]=!0,e instanceof zi||(e=new zi(e.message,e,this));let a=e,{response:n}=a;(async()=>{if(n&&!n.body){n.setEncoding(this._readableState.encoding);try{n.rawBody=await Wit.default(n),n.body=n.rawBody.toString()}catch{}}if(this.listenerCount("retry")!==0){let u;try{let A;n&&"retry-after"in n.headers&&(A=Number(n.headers["retry-after"]),Number.isNaN(A)?(A=Date.parse(n.headers["retry-after"])-Date.now(),A<=0&&(A=1)):A*=1e3),u=await r.retry.calculateDelay({attemptCount:o,retryOptions:r.retry,error:a,retryAfter:A,computedValue:Kit.default({attemptCount:o,retryOptions:r.retry,error:a,retryAfter:A,computedValue:0})})}catch(A){this._error(new zi(A.message,A,this));return}if(u){let A=async()=>{try{for(let p of this.options.hooks.beforeRetry)await p(this.options,a,o)}catch(p){this._error(new zi(p.message,e,this));return}this.destroyed||(this.destroy(),this.emit("retry",o,e))};this[Nle]=setTimeout(A,u);return}}this._error(a)})()}_read(){this[_x]=!0;let e=this[Hx];if(e&&!this[xy]){e.readableLength&&(this[_x]=!1);let r;for(;(r=e.read())!==null;){this[Dy]+=r.length,this[Tle]=!0;let o=this.downloadProgress;o.percent<1&&this.emit("downloadProgress",o),this.push(r)}}}_write(e,r,o){let a=()=>{this._writeRequest(e,r,o)};this.requestInitialized?a():this[O1].push(a)}_writeRequest(e,r,o){this[Ys].destroyed||(this._progressCallbacks.push(()=>{this[Py]+=Buffer.byteLength(e,r);let a=this.uploadProgress;a.percent<1&&this.emit("uploadProgress",a)}),this[Ys].write(e,r,a=>{!a&&this._progressCallbacks.length>0&&this._progressCallbacks.shift()(),o(a)}))}_final(e){let r=()=>{for(;this._progressCallbacks.length!==0;)this._progressCallbacks.shift()();if(!(Ys in this)){e();return}if(this[Ys].destroyed){e();return}this[Ys].end(o=>{o||(this[Sy]=this[Py],this.emit("uploadProgress",this.uploadProgress),this[Ys].emit("upload-complete")),e(o)})};this.requestInitialized?r():this[O1].push(r)}_destroy(e,r){var o;this[xy]=!0,clearTimeout(this[Nle]),Ys in this&&(this[oU](),!((o=this[Hx])===null||o===void 0)&&o.complete||this[Ys].destroy()),e!==null&&!at.default.undefined(e)&&!(e instanceof zi)&&(e=new zi(e.message,e,this)),r(e)}get _isAboutToError(){return this[xy]}get ip(){var e;return(e=this.socket)===null||e===void 0?void 0:e.remoteAddress}get aborted(){var e,r,o;return((r=(e=this[Ys])===null||e===void 0?void 0:e.destroyed)!==null&&r!==void 0?r:this.destroyed)&&!(!((o=this[Lle])===null||o===void 0)&&o.complete)}get socket(){var e,r;return(r=(e=this[Ys])===null||e===void 0?void 0:e.socket)!==null&&r!==void 0?r:void 0}get downloadProgress(){let e;return this[vy]?e=this[Dy]/this[vy]:this[vy]===this[Dy]?e=1:e=0,{percent:e,transferred:this[Dy],total:this[vy]}}get uploadProgress(){let e;return this[Sy]?e=this[Py]/this[Sy]:this[Sy]===this[Py]?e=1:e=0,{percent:e,transferred:this[Py],total:this[Sy]}}get timings(){var e;return(e=this[Ys])===null||e===void 0?void 0:e.timings}get isFromCache(){return this[Rle]}pipe(e,r){if(this[Tle])throw new Error("Failed to pipe. The response has been emitted already.");return e instanceof iU.ServerResponse&&this[Ux].add(e),super.pipe(e,r)}unpipe(e){return e instanceof iU.ServerResponse&&this[Ux].delete(e),super.unpipe(e),this}};Qn.default=Kx});var _1=_(zc=>{"use strict";var rst=zc&&zc.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),nst=zc&&zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rst(e,t,r)};Object.defineProperty(zc,"__esModule",{value:!0});zc.CancelError=zc.ParseError=void 0;var Ole=U1(),lU=class extends Ole.RequestError{constructor(e,r){let{options:o}=r.request;super(`${e.message} in "${o.url.toString()}"`,e,r.request),this.name="ParseError"}};zc.ParseError=lU;var cU=class extends Ole.RequestError{constructor(e){super("Promise was canceled",{},e),this.name="CancelError"}get isCanceled(){return!0}};zc.CancelError=cU;nst(U1(),zc)});var Ule=_(uU=>{"use strict";Object.defineProperty(uU,"__esModule",{value:!0});var Mle=_1(),ist=(t,e,r,o)=>{let{rawBody:a}=t;try{if(e==="text")return a.toString(o);if(e==="json")return a.length===0?"":r(a.toString());if(e==="buffer")return a;throw new Mle.ParseError({message:`Unknown body type '${e}'`,name:"Error"},t)}catch(n){throw new Mle.ParseError(n,t)}};uU.default=ist});var AU=_(ph=>{"use strict";var sst=ph&&ph.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),ost=ph&&ph.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sst(e,t,r)};Object.defineProperty(ph,"__esModule",{value:!0});var ast=ve("events"),lst=Ff(),cst=Moe(),Jx=_1(),_le=Ule(),Hle=U1(),ust=V4(),Ast=eU(),qle=tU(),fst=["request","response","redirect","uploadProgress","downloadProgress"];function jle(t){let e,r,o=new ast.EventEmitter,a=new cst((u,A,p)=>{let h=E=>{let w=new Hle.default(void 0,t);w.retryCount=E,w._noPipe=!0,p(()=>w.destroy()),p.shouldReject=!1,p(()=>A(new Jx.CancelError(w))),e=w,w.once("response",async C=>{var T;if(C.retryCount=E,C.request.aborted)return;let N;try{N=await Ast.default(w),C.rawBody=N}catch{return}if(w._isAboutToError)return;let U=((T=C.headers["content-encoding"])!==null&&T!==void 0?T:"").toLowerCase(),J=["gzip","deflate","br"].includes(U),{options:te}=w;if(J&&!te.decompress)C.body=N;else try{C.body=_le.default(C,te.responseType,te.parseJson,te.encoding)}catch(le){if(C.body=N.toString(),qle.isResponseOk(C)){w._beforeError(le);return}}try{for(let[le,ce]of te.hooks.afterResponse.entries())C=await ce(C,async ue=>{let Ie=Hle.default.normalizeArguments(void 0,{...ue,retry:{calculateDelay:()=>0},throwHttpErrors:!1,resolveBodyOnly:!1},te);Ie.hooks.afterResponse=Ie.hooks.afterResponse.slice(0,le);for(let De of Ie.hooks.beforeRetry)await De(Ie);let he=jle(Ie);return p(()=>{he.catch(()=>{}),he.cancel()}),he})}catch(le){w._beforeError(new Jx.RequestError(le.message,le,w));return}if(!qle.isResponseOk(C)){w._beforeError(new Jx.HTTPError(C));return}r=C,u(w.options.resolveBodyOnly?C.body:C)});let D=C=>{if(a.isCanceled)return;let{options:T}=w;if(C instanceof Jx.HTTPError&&!T.throwHttpErrors){let{response:N}=C;u(w.options.resolveBodyOnly?N.body:N);return}A(C)};w.once("error",D);let b=w.options.body;w.once("retry",(C,T)=>{var N,U;if(b===((N=T.request)===null||N===void 0?void 0:N.options.body)&&lst.default.nodeStream((U=T.request)===null||U===void 0?void 0:U.options.body)){D(T);return}h(C)}),ust.default(w,o,fst)};h(0)});a.on=(u,A)=>(o.on(u,A),a);let n=u=>{let A=(async()=>{await a;let{options:p}=r.request;return _le.default(r,u,p.parseJson,p.encoding)})();return Object.defineProperties(A,Object.getOwnPropertyDescriptors(a)),A};return a.json=()=>{let{headers:u}=e.options;return!e.writableFinished&&u.accept===void 0&&(u.accept="application/json"),n("json")},a.buffer=()=>n("buffer"),a.text=()=>n("text"),a}ph.default=jle;ost(_1(),ph)});var Gle=_(fU=>{"use strict";Object.defineProperty(fU,"__esModule",{value:!0});var pst=_1();function hst(t,...e){let r=(async()=>{if(t instanceof pst.RequestError)try{for(let a of e)if(a)for(let n of a)t=await n(t)}catch(a){t=a}throw t})(),o=()=>r;return r.json=o,r.text=o,r.buffer=o,r.on=o,r}fU.default=hst});var Vle=_(pU=>{"use strict";Object.defineProperty(pU,"__esModule",{value:!0});var Wle=Ff();function Yle(t){for(let e of Object.values(t))(Wle.default.plainObject(e)||Wle.default.array(e))&&Yle(e);return Object.freeze(t)}pU.default=Yle});var Jle=_(Kle=>{"use strict";Object.defineProperty(Kle,"__esModule",{value:!0})});var hU=_(Xl=>{"use strict";var gst=Xl&&Xl.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),dst=Xl&&Xl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gst(e,t,r)};Object.defineProperty(Xl,"__esModule",{value:!0});Xl.defaultHandler=void 0;var zle=Ff(),zl=AU(),mst=Gle(),Xx=U1(),yst=Vle(),Est={RequestError:zl.RequestError,CacheError:zl.CacheError,ReadError:zl.ReadError,HTTPError:zl.HTTPError,MaxRedirectsError:zl.MaxRedirectsError,TimeoutError:zl.TimeoutError,ParseError:zl.ParseError,CancelError:zl.CancelError,UnsupportedProtocolError:zl.UnsupportedProtocolError,UploadError:zl.UploadError},Cst=async t=>new Promise(e=>{setTimeout(e,t)}),{normalizeArguments:zx}=Xx.default,Xle=(...t)=>{let e;for(let r of t)e=zx(void 0,r,e);return e},Ist=t=>t.isStream?new Xx.default(void 0,t):zl.default(t),wst=t=>"defaults"in t&&"options"in t.defaults,Bst=["get","post","put","patch","head","delete"];Xl.defaultHandler=(t,e)=>e(t);var Zle=(t,e)=>{if(t)for(let r of t)r(e)},$le=t=>{t._rawHandlers=t.handlers,t.handlers=t.handlers.map(o=>(a,n)=>{let u,A=o(a,p=>(u=n(p),u));if(A!==u&&!a.isStream&&u){let p=A,{then:h,catch:E,finally:w}=p;Object.setPrototypeOf(p,Object.getPrototypeOf(u)),Object.defineProperties(p,Object.getOwnPropertyDescriptors(u)),p.then=h,p.catch=E,p.finally=w}return A});let e=(o,a={},n)=>{var u,A;let p=0,h=E=>t.handlers[p++](E,p===t.handlers.length?Ist:h);if(zle.default.plainObject(o)){let E={...o,...a};Xx.setNonEnumerableProperties([o,a],E),a=E,o=void 0}try{let E;try{Zle(t.options.hooks.init,a),Zle((u=a.hooks)===null||u===void 0?void 0:u.init,a)}catch(D){E=D}let w=zx(o,a,n??t.options);if(w[Xx.kIsNormalizedAlready]=!0,E)throw new zl.RequestError(E.message,E,w);return h(w)}catch(E){if(a.isStream)throw E;return mst.default(E,t.options.hooks.beforeError,(A=a.hooks)===null||A===void 0?void 0:A.beforeError)}};e.extend=(...o)=>{let a=[t.options],n=[...t._rawHandlers],u;for(let A of o)wst(A)?(a.push(A.defaults.options),n.push(...A.defaults._rawHandlers),u=A.defaults.mutableDefaults):(a.push(A),"handlers"in A&&n.push(...A.handlers),u=A.mutableDefaults);return n=n.filter(A=>A!==Xl.defaultHandler),n.length===0&&n.push(Xl.defaultHandler),$le({options:Xle(...a),handlers:n,mutableDefaults:!!u})};let r=async function*(o,a){let n=zx(o,a,t.options);n.resolveBodyOnly=!1;let u=n.pagination;if(!zle.default.object(u))throw new TypeError("`options.pagination` must be implemented");let A=[],{countLimit:p}=u,h=0;for(;h{let n=[];for await(let u of r(o,a))n.push(u);return n},e.paginate.each=r,e.stream=(o,a)=>e(o,{...a,isStream:!0});for(let o of Bst)e[o]=(a,n)=>e(a,{...n,method:o}),e.stream[o]=(a,n)=>e(a,{...n,method:o,isStream:!0});return Object.assign(e,Est),Object.defineProperty(e,"defaults",{value:t.mutableDefaults?t:yst.default(t),writable:t.mutableDefaults,configurable:t.mutableDefaults,enumerable:!0}),e.mergeOptions=Xle,e};Xl.default=$le;dst(Jle(),Xl)});var rce=_((Rf,Zx)=>{"use strict";var vst=Rf&&Rf.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),ece=Rf&&Rf.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vst(e,t,r)};Object.defineProperty(Rf,"__esModule",{value:!0});var Dst=ve("url"),tce=hU(),Sst={options:{method:"GET",retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:void 0,calculateDelay:({computedValue:t})=>t},timeout:{},headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},hooks:{init:[],beforeRequest:[],beforeRedirect:[],beforeRetry:[],beforeError:[],afterResponse:[]},cache:void 0,dnsCache:void 0,decompress:!0,throwHttpErrors:!0,followRedirect:!0,isStream:!1,responseType:"text",resolveBodyOnly:!1,maxRedirects:10,prefixUrl:"",methodRewriting:!0,ignoreInvalidCookies:!1,context:{},http2:!1,allowGetBody:!1,https:void 0,pagination:{transform:t=>t.request.options.responseType==="json"?t.body:JSON.parse(t.body),paginate:t=>{if(!Reflect.has(t.headers,"link"))return!1;let e=t.headers.link.split(","),r;for(let o of e){let a=o.split(";");if(a[1].includes("next")){r=a[0].trimStart().trim(),r=r.slice(1,-1);break}}return r?{url:new Dst.URL(r)}:!1},filter:()=>!0,shouldContinue:()=>!0,countLimit:1/0,backoff:0,requestLimit:1e4,stackAllItems:!0},parseJson:t=>JSON.parse(t),stringifyJson:t=>JSON.stringify(t),cacheOptions:{}},handlers:[tce.defaultHandler],mutableDefaults:!1},gU=tce.default(Sst);Rf.default=gU;Zx.exports=gU;Zx.exports.default=gU;Zx.exports.__esModule=!0;ece(hU(),Rf);ece(AU(),Rf)});var on={};Vt(on,{Method:()=>cce,del:()=>Qst,get:()=>EU,getNetworkSettings:()=>lce,post:()=>CU,put:()=>kst,request:()=>H1});function sce(t){let e=new URL(t),r={host:e.hostname,headers:{}};return e.port&&(r.port=Number(e.port)),e.username&&e.password&&(r.proxyAuth=`${e.username}:${e.password}`),{proxy:r}}async function dU(t){return Al(ice,t,()=>ae.readFilePromise(t).then(e=>(ice.set(t,e),e)))}function bst({statusCode:t,statusMessage:e},r){let o=Ut(r,t,Ct.NUMBER),a=`https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/${t}`;return ty(r,`${o}${e?` (${e})`:""}`,a)}async function $x(t,{configuration:e,customErrorMessage:r}){try{return await t}catch(o){if(o.name!=="HTTPError")throw o;let a=r?.(o,e)??o.response.body?.error;a==null&&(o.message.startsWith("Response code")?a="The remote server failed to provide the requested resource":a=o.message),o.code==="ETIMEDOUT"&&o.event==="socket"&&(a+=`(can be increased via ${Ut(e,"httpTimeout",Ct.SETTING)})`);let n=new Jt(35,a,u=>{o.response&&u.reportError(35,` ${$u(e,{label:"Response Code",value:Yc(Ct.NO_HINT,bst(o.response,e))})}`),o.request&&(u.reportError(35,` ${$u(e,{label:"Request Method",value:Yc(Ct.NO_HINT,o.request.options.method)})}`),u.reportError(35,` ${$u(e,{label:"Request URL",value:Yc(Ct.URL,o.request.requestUrl)})}`)),o.request.redirects.length>0&&u.reportError(35,` ${$u(e,{label:"Request Redirects",value:Yc(Ct.NO_HINT,cO(e,o.request.redirects,Ct.URL))})}`),o.request.retryCount===o.request.options.retry.limit&&u.reportError(35,` ${$u(e,{label:"Request Retry Count",value:Yc(Ct.NO_HINT,`${Ut(e,o.request.retryCount,Ct.NUMBER)} (can be increased via ${Ut(e,"httpRetry",Ct.SETTING)})`)})}`)});throw n.originalError=o,n}}function lce(t,e){let r=[...e.configuration.get("networkSettings")].sort(([u],[A])=>A.length-u.length),o={enableNetwork:void 0,httpsCaFilePath:void 0,httpProxy:void 0,httpsProxy:void 0,httpsKeyFilePath:void 0,httpsCertFilePath:void 0},a=Object.keys(o),n=typeof t=="string"?new URL(t):t;for(let[u,A]of r)if(yU.default.isMatch(n.hostname,u))for(let p of a){let h=A.get(p);h!==null&&typeof o[p]>"u"&&(o[p]=h)}for(let u of a)typeof o[u]>"u"&&(o[u]=e.configuration.get(u));return o}async function H1(t,e,{configuration:r,headers:o,jsonRequest:a,jsonResponse:n,method:u="GET",wrapNetworkRequest:A}){let p={target:t,body:e,configuration:r,headers:o,jsonRequest:a,jsonResponse:n,method:u},h=async()=>await Fst(t,e,p),E=typeof A<"u"?await A(h,p):h;return await(await r.reduceHook(D=>D.wrapNetworkRequest,E,p))()}async function EU(t,{configuration:e,jsonResponse:r,customErrorMessage:o,wrapNetworkRequest:a,...n}){let u=()=>$x(H1(t,null,{configuration:e,wrapNetworkRequest:a,...n}),{configuration:e,customErrorMessage:o}).then(p=>p.body),A=await(typeof a<"u"?u():Al(nce,t,()=>u().then(p=>(nce.set(t,p),p))));return r?JSON.parse(A.toString()):A}async function kst(t,e,{customErrorMessage:r,...o}){return(await $x(H1(t,e,{...o,method:"PUT"}),{customErrorMessage:r,configuration:o.configuration})).body}async function CU(t,e,{customErrorMessage:r,...o}){return(await $x(H1(t,e,{...o,method:"POST"}),{customErrorMessage:r,configuration:o.configuration})).body}async function Qst(t,{customErrorMessage:e,...r}){return(await $x(H1(t,null,{...r,method:"DELETE"}),{customErrorMessage:e,configuration:r.configuration})).body}async function Fst(t,e,{configuration:r,headers:o,jsonRequest:a,jsonResponse:n,method:u="GET"}){let A=typeof t=="string"?new URL(t):t,p=lce(A,{configuration:r});if(p.enableNetwork===!1)throw new Jt(80,`Request to '${A.href}' has been blocked because of your configuration settings`);if(A.protocol==="http:"&&!yU.default.isMatch(A.hostname,r.get("unsafeHttpWhitelist")))throw new Jt(81,`Unsafe http requests must be explicitly whitelisted in your configuration (${A.hostname})`);let E={agent:{http:p.httpProxy?mU.default.httpOverHttp(sce(p.httpProxy)):Pst,https:p.httpsProxy?mU.default.httpsOverHttp(sce(p.httpsProxy)):xst},headers:o,method:u};E.responseType=n?"json":"buffer",e!==null&&(Buffer.isBuffer(e)||!a&&typeof e=="string"?E.body=e:E.json=e);let w=r.get("httpTimeout"),D=r.get("httpRetry"),b=r.get("enableStrictSsl"),C=p.httpsCaFilePath,T=p.httpsCertFilePath,N=p.httpsKeyFilePath,{default:U}=await Promise.resolve().then(()=>et(rce())),J=C?await dU(C):void 0,te=T?await dU(T):void 0,le=N?await dU(N):void 0,ce=U.extend({timeout:{socket:w},retry:D,https:{rejectUnauthorized:b,certificateAuthority:J,certificate:te,key:le},...E});return r.getLimit("networkConcurrency")(()=>ce(A))}var oce,ace,yU,mU,nce,ice,Pst,xst,cce,eb=It(()=>{St();oce=ve("https"),ace=ve("http"),yU=et(Xo()),mU=et(Roe());Kl();Wl();Gl();nce=new Map,ice=new Map,Pst=new ace.Agent({keepAlive:!0}),xst=new oce.Agent({keepAlive:!0});cce=(a=>(a.GET="GET",a.PUT="PUT",a.POST="POST",a.DELETE="DELETE",a))(cce||{})});var Xi={};Vt(Xi,{availableParallelism:()=>wU,getArchitecture:()=>q1,getArchitectureName:()=>Ost,getArchitectureSet:()=>IU,getCaller:()=>Hst,major:()=>Rst,openUrl:()=>Tst});function Nst(){if(process.platform==="darwin"||process.platform==="win32")return null;let t;try{t=ae.readFileSync(Lst)}catch{}if(typeof t<"u"){if(t&&(t.includes("GLIBC")||t.includes("libc")))return"glibc";if(t&&t.includes("musl"))return"musl"}let r=(process.report?.getReport()??{}).sharedObjects??[],o=/\/(?:(ld-linux-|[^/]+-linux-gnu\/)|(libc.musl-|ld-musl-))/;return eh(r,a=>{let n=a.match(o);if(!n)return eh.skip;if(n[1])return"glibc";if(n[2])return"musl";throw new Error("Assertion failed: Expected the libc variant to have been detected")})??null}function q1(){return Ace=Ace??{os:process.platform,cpu:process.arch,libc:Nst()}}function Ost(t=q1()){return t.libc?`${t.os}-${t.cpu}-${t.libc}`:`${t.os}-${t.cpu}`}function IU(){let t=q1();return fce=fce??{os:[t.os],cpu:[t.cpu],libc:t.libc?[t.libc]:[]}}function _st(t){let e=Mst.exec(t);if(!e)return null;let r=e[2]&&e[2].indexOf("native")===0,o=e[2]&&e[2].indexOf("eval")===0,a=Ust.exec(e[2]);return o&&a!=null&&(e[2]=a[1],e[3]=a[2],e[4]=a[3]),{file:r?null:e[2],methodName:e[1]||"",arguments:r?[e[2]]:[],line:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}function Hst(){let e=new Error().stack.split(` -`)[3];return _st(e)}function wU(){return typeof tb.default.availableParallelism<"u"?tb.default.availableParallelism():Math.max(1,tb.default.cpus().length)}var tb,Rst,uce,Tst,Lst,Ace,fce,Mst,Ust,rb=It(()=>{St();tb=et(ve("os"));nb();Gl();Rst=Number(process.versions.node.split(".")[0]),uce=new Map([["darwin","open"],["linux","xdg-open"],["win32","explorer.exe"]]).get(process.platform),Tst=typeof uce<"u"?async t=>{try{return await BU(uce,[t],{cwd:V.cwd()}),!0}catch{return!1}}:void 0,Lst="/usr/bin/ldd";Mst=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ust=/\((\S*)(?::(\d+))(?::(\d+))\)/});function xU(t,e,r,o,a){let n=b1(r);if(o.isArray||o.type==="ANY"&&Array.isArray(n))return Array.isArray(n)?n.map((u,A)=>vU(t,`${e}[${A}]`,u,o,a)):String(n).split(/,/).map(u=>vU(t,e,u,o,a));if(Array.isArray(n))throw new Error(`Non-array configuration settings "${e}" cannot be an array`);return vU(t,e,r,o,a)}function vU(t,e,r,o,a){let n=b1(r);switch(o.type){case"ANY":return wx(n);case"SHAPE":return Wst(t,e,r,o,a);case"MAP":return Yst(t,e,r,o,a)}if(n===null&&!o.isNullable&&o.default!==null)throw new Error(`Non-nullable configuration settings "${e}" cannot be set to null`);if(o.values?.includes(n))return n;let A=(()=>{if(o.type==="BOOLEAN"&&typeof n!="string")return f1(n);if(typeof n!="string")throw new Error(`Expected configuration setting "${e}" to be a string, got ${typeof n}`);let p=NP(n,{env:t.env});switch(o.type){case"ABSOLUTE_PATH":{let h=a,E=e4(r);return E&&E[0]!=="<"&&(h=V.dirname(E)),V.resolve(h,Ae.toPortablePath(p))}case"LOCATOR_LOOSE":return Pf(p,!1);case"NUMBER":return parseInt(p);case"LOCATOR":return Pf(p);case"BOOLEAN":return f1(p);default:return p}})();if(o.values&&!o.values.includes(A))throw new Error(`Invalid value, expected one of ${o.values.join(", ")}`);return A}function Wst(t,e,r,o,a){let n=b1(r);if(typeof n!="object"||Array.isArray(n))throw new it(`Object configuration settings "${e}" must be an object`);let u=bU(t,o,{ignoreArrays:!0});if(n===null)return u;for(let[A,p]of Object.entries(n)){let h=`${e}.${A}`;if(!o.properties[A])throw new it(`Unrecognized configuration settings found: ${e}.${A} - run "yarn config -v" to see the list of settings supported in Yarn`);u.set(A,xU(t,h,p,o.properties[A],a))}return u}function Yst(t,e,r,o,a){let n=b1(r),u=new Map;if(typeof n!="object"||Array.isArray(n))throw new it(`Map configuration settings "${e}" must be an object`);if(n===null)return u;for(let[A,p]of Object.entries(n)){let h=o.normalizeKeys?o.normalizeKeys(A):A,E=`${e}['${h}']`,w=o.valueDefinition;u.set(h,xU(t,E,p,w,a))}return u}function bU(t,e,{ignoreArrays:r=!1}={}){switch(e.type){case"SHAPE":{if(e.isArray&&!r)return[];let o=new Map;for(let[a,n]of Object.entries(e.properties))o.set(a,bU(t,n));return o}case"MAP":return e.isArray&&!r?[]:new Map;case"ABSOLUTE_PATH":return e.default===null?null:t.projectCwd===null?Array.isArray(e.default)?e.default.map(o=>V.normalize(o)):V.isAbsolute(e.default)?V.normalize(e.default):e.isNullable?null:void 0:Array.isArray(e.default)?e.default.map(o=>V.resolve(t.projectCwd,o)):V.resolve(t.projectCwd,e.default);default:return e.default}}function sb(t,e,r){if(e.type==="SECRET"&&typeof t=="string"&&r.hideSecrets)return Gst;if(e.type==="ABSOLUTE_PATH"&&typeof t=="string"&&r.getNativePaths)return Ae.fromPortablePath(t);if(e.isArray&&Array.isArray(t)){let o=[];for(let a of t)o.push(sb(a,e,r));return o}if(e.type==="MAP"&&t instanceof Map){if(t.size===0)return;let o=new Map;for(let[a,n]of t.entries()){let u=sb(n,e.valueDefinition,r);typeof u<"u"&&o.set(a,u)}return o}if(e.type==="SHAPE"&&t instanceof Map){if(t.size===0)return;let o=new Map;for(let[a,n]of t.entries()){let u=e.properties[a],A=sb(n,u,r);typeof A<"u"&&o.set(a,A)}return o}return t}function Vst(){let t={};for(let[e,r]of Object.entries(process.env))e=e.toLowerCase(),e.startsWith(ob)&&(e=(0,hce.default)(e.slice(ob.length)),t[e]=r);return t}function SU(){let t=`${ob}rc_filename`;for(let[e,r]of Object.entries(process.env))if(e.toLowerCase()===t&&typeof r=="string")return r;return PU}async function pce(t){try{return await ae.readFilePromise(t)}catch{return Buffer.of()}}async function Kst(t,e){return Buffer.compare(...await Promise.all([pce(t),pce(e)]))===0}async function Jst(t,e){let[r,o]=await Promise.all([ae.statPromise(t),ae.statPromise(e)]);return r.dev===o.dev&&r.ino===o.ino}async function Xst({configuration:t,selfPath:e}){let r=t.get("yarnPath");return t.get("ignorePath")||r===null||r===e||await zst(r,e)?null:r}var hce,Tf,gce,dce,mce,DU,qst,j1,jst,by,ob,PU,Gst,G1,yce,ab,ib,zst,ze,W1=It(()=>{St();Ol();hce=et(jK()),Tf=et(sg());Gt();gce=et(NJ()),dce=ve("module"),mce=et(lg()),DU=ve("stream");Kse();Ay();YM();VM();KM();woe();JM();Dg();Poe();vx();Wl();ah();eb();Gl();rb();bf();Io();qst=function(){if(!Tf.GITHUB_ACTIONS||!process.env.GITHUB_EVENT_PATH)return!1;let t=Ae.toPortablePath(process.env.GITHUB_EVENT_PATH),e;try{e=ae.readJsonSync(t)}catch{return!1}return!(!("repository"in e)||!e.repository||(e.repository.private??!0))}(),j1=new Set(["@yarnpkg/plugin-constraints","@yarnpkg/plugin-exec","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"]),jst=new Set(["isTestEnv","injectNpmUser","injectNpmPassword","injectNpm2FaToken","zipDataEpilogue","cacheCheckpointOverride","cacheVersionOverride","lockfileVersionOverride","binFolder","version","flags","profile","gpg","ignoreNode","wrapOutput","home","confDir","registry","ignoreCwd"]),by=/^(?!v)[a-z0-9._-]+$/i,ob="yarn_",PU=".yarnrc.yml",Gst="********",G1=(E=>(E.ANY="ANY",E.BOOLEAN="BOOLEAN",E.ABSOLUTE_PATH="ABSOLUTE_PATH",E.LOCATOR="LOCATOR",E.LOCATOR_LOOSE="LOCATOR_LOOSE",E.NUMBER="NUMBER",E.STRING="STRING",E.SECRET="SECRET",E.SHAPE="SHAPE",E.MAP="MAP",E))(G1||{}),yce=Ct,ab=(r=>(r.JUNCTIONS="junctions",r.SYMLINKS="symlinks",r))(ab||{}),ib={lastUpdateCheck:{description:"Last timestamp we checked whether new Yarn versions were available",type:"STRING",default:null},yarnPath:{description:"Path to the local executable that must be used over the global one",type:"ABSOLUTE_PATH",default:null},ignorePath:{description:"If true, the local executable will be ignored when using the global one",type:"BOOLEAN",default:!1},globalFolder:{description:"Folder where all system-global files are stored",type:"ABSOLUTE_PATH",default:r4()},cacheFolder:{description:"Folder where the cache files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/cache"},compressionLevel:{description:"Zip files compression level, from 0 to 9 or mixed (a variant of 9, which stores some files uncompressed, when compression doesn't yield good results)",type:"NUMBER",values:["mixed",0,1,2,3,4,5,6,7,8,9],default:0},virtualFolder:{description:"Folder where the virtual packages (cf doc) will be mapped on the disk (must be named __virtual__)",type:"ABSOLUTE_PATH",default:"./.yarn/__virtual__"},installStatePath:{description:"Path of the file where the install state will be persisted",type:"ABSOLUTE_PATH",default:"./.yarn/install-state.gz"},immutablePatterns:{description:"Array of glob patterns; files matching them won't be allowed to change during immutable installs",type:"STRING",default:[],isArray:!0},rcFilename:{description:"Name of the files where the configuration can be found",type:"STRING",default:SU()},enableGlobalCache:{description:"If true, the system-wide cache folder will be used regardless of `cache-folder`",type:"BOOLEAN",default:!0},cacheMigrationMode:{description:"Defines the conditions under which Yarn upgrades should cause the cache archives to be regenerated.",type:"STRING",values:["always","match-spec","required-only"],default:"always"},enableColors:{description:"If true, the CLI is allowed to use colors in its output",type:"BOOLEAN",default:UP,defaultText:""},enableHyperlinks:{description:"If true, the CLI is allowed to use hyperlinks in its output",type:"BOOLEAN",default:lO,defaultText:""},enableInlineBuilds:{description:"If true, the CLI will print the build output on the command line",type:"BOOLEAN",default:Tf.isCI,defaultText:""},enableMessageNames:{description:"If true, the CLI will prefix most messages with codes suitable for search engines",type:"BOOLEAN",default:!0},enableProgressBars:{description:"If true, the CLI is allowed to show a progress bar for long-running events",type:"BOOLEAN",default:!Tf.isCI,defaultText:""},enableTimers:{description:"If true, the CLI is allowed to print the time spent executing commands",type:"BOOLEAN",default:!0},enableTips:{description:"If true, installs will print a helpful message every day of the week",type:"BOOLEAN",default:!Tf.isCI,defaultText:""},preferInteractive:{description:"If true, the CLI will automatically use the interactive mode when called from a TTY",type:"BOOLEAN",default:!1},preferTruncatedLines:{description:"If true, the CLI will truncate lines that would go beyond the size of the terminal",type:"BOOLEAN",default:!1},progressBarStyle:{description:"Which style of progress bar should be used (only when progress bars are enabled)",type:"STRING",default:void 0,defaultText:""},defaultLanguageName:{description:"Default language mode that should be used when a package doesn't offer any insight",type:"STRING",default:"node"},defaultProtocol:{description:"Default resolution protocol used when resolving pure semver and tag ranges",type:"STRING",default:"npm:"},enableTransparentWorkspaces:{description:"If false, Yarn won't automatically resolve workspace dependencies unless they use the `workspace:` protocol",type:"BOOLEAN",default:!0},supportedArchitectures:{description:"Architectures that Yarn will fetch and inject into the resolver",type:"SHAPE",properties:{os:{description:"Array of supported process.platform strings, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]},cpu:{description:"Array of supported process.arch strings, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]},libc:{description:"Array of supported libc libraries, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]}}},enableMirror:{description:"If true, the downloaded packages will be retrieved and stored in both the local and global folders",type:"BOOLEAN",default:!0},enableNetwork:{description:"If false, Yarn will refuse to use the network if required to",type:"BOOLEAN",default:!0},enableOfflineMode:{description:"If true, Yarn will attempt to retrieve files and metadata from the global cache rather than the network",type:"BOOLEAN",default:!1},httpProxy:{description:"URL of the http proxy that must be used for outgoing http requests",type:"STRING",default:null},httpsProxy:{description:"URL of the http proxy that must be used for outgoing https requests",type:"STRING",default:null},unsafeHttpWhitelist:{description:"List of the hostnames for which http queries are allowed (glob patterns are supported)",type:"STRING",default:[],isArray:!0},httpTimeout:{description:"Timeout of each http request in milliseconds",type:"NUMBER",default:6e4},httpRetry:{description:"Retry times on http failure",type:"NUMBER",default:3},networkConcurrency:{description:"Maximal number of concurrent requests",type:"NUMBER",default:50},taskPoolConcurrency:{description:"Maximal amount of concurrent heavy task processing",type:"NUMBER",default:wU()},taskPoolMode:{description:"Execution strategy for heavy tasks",type:"STRING",values:["async","workers"],default:"workers"},networkSettings:{description:"Network settings per hostname (glob patterns are supported)",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{httpsCaFilePath:{description:"Path to file containing one or multiple Certificate Authority signing certificates",type:"ABSOLUTE_PATH",default:null},enableNetwork:{description:"If false, the package manager will refuse to use the network if required to",type:"BOOLEAN",default:null},httpProxy:{description:"URL of the http proxy that must be used for outgoing http requests",type:"STRING",default:null},httpsProxy:{description:"URL of the http proxy that must be used for outgoing https requests",type:"STRING",default:null},httpsKeyFilePath:{description:"Path to file containing private key in PEM format",type:"ABSOLUTE_PATH",default:null},httpsCertFilePath:{description:"Path to file containing certificate chain in PEM format",type:"ABSOLUTE_PATH",default:null}}}},httpsCaFilePath:{description:"A path to a file containing one or multiple Certificate Authority signing certificates",type:"ABSOLUTE_PATH",default:null},httpsKeyFilePath:{description:"Path to file containing private key in PEM format",type:"ABSOLUTE_PATH",default:null},httpsCertFilePath:{description:"Path to file containing certificate chain in PEM format",type:"ABSOLUTE_PATH",default:null},enableStrictSsl:{description:"If false, SSL certificate errors will be ignored",type:"BOOLEAN",default:!0},logFilters:{description:"Overrides for log levels",type:"SHAPE",isArray:!0,concatenateValues:!0,properties:{code:{description:"Code of the messages covered by this override",type:"STRING",default:void 0},text:{description:"Code of the texts covered by this override",type:"STRING",default:void 0},pattern:{description:"Code of the patterns covered by this override",type:"STRING",default:void 0},level:{description:"Log level override, set to null to remove override",type:"STRING",values:Object.values(HP),isNullable:!0,default:void 0}}},enableTelemetry:{description:"If true, telemetry will be periodically sent, following the rules in https://yarnpkg.com/advanced/telemetry",type:"BOOLEAN",default:!0},telemetryInterval:{description:"Minimal amount of time between two telemetry uploads, in days",type:"NUMBER",default:7},telemetryUserId:{description:"If you desire to tell us which project you are, you can set this field. Completely optional and opt-in.",type:"STRING",default:null},enableHardenedMode:{description:"If true, automatically enable --check-resolutions --refresh-lockfile on installs",type:"BOOLEAN",default:Tf.isPR&&qst,defaultText:""},enableScripts:{description:"If true, packages are allowed to have install scripts by default",type:"BOOLEAN",default:!0},enableStrictSettings:{description:"If true, unknown settings will cause Yarn to abort",type:"BOOLEAN",default:!0},enableImmutableCache:{description:"If true, the cache is reputed immutable and actions that would modify it will throw",type:"BOOLEAN",default:!1},enableCacheClean:{description:"If false, disallows the `cache clean` command",type:"BOOLEAN",default:!0},checksumBehavior:{description:"Enumeration defining what to do when a checksum doesn't match expectations",type:"STRING",default:"throw"},injectEnvironmentFiles:{description:"List of all the environment files that Yarn should inject inside the process when it starts",type:"ABSOLUTE_PATH",default:[".env.yarn?"],isArray:!0},packageExtensions:{description:"Map of package corrections to apply on the dependency tree",type:"MAP",valueDefinition:{description:"The extension that will be applied to any package whose version matches the specified range",type:"SHAPE",properties:{dependencies:{description:"The set of dependencies that must be made available to the current package in order for it to work properly",type:"MAP",valueDefinition:{description:"A range",type:"STRING"}},peerDependencies:{description:"Inherited dependencies - the consumer of the package will be tasked to provide them",type:"MAP",valueDefinition:{description:"A semver range",type:"STRING"}},peerDependenciesMeta:{description:"Extra information related to the dependencies listed in the peerDependencies field",type:"MAP",valueDefinition:{description:"The peerDependency meta",type:"SHAPE",properties:{optional:{description:"If true, the selected peer dependency will be marked as optional by the package manager and the consumer omitting it won't be reported as an error",type:"BOOLEAN",default:!1}}}}}}}};zst=process.platform==="win32"?Kst:Jst;ze=class t{constructor(e){this.isCI=Tf.isCI;this.projectCwd=null;this.plugins=new Map;this.settings=new Map;this.values=new Map;this.sources=new Map;this.invalid=new Map;this.env={};this.limits=new Map;this.packageExtensions=null;this.startingCwd=e}static{this.deleteProperty=Symbol()}static{this.telemetry=null}static create(e,r,o){let a=new t(e);typeof r<"u"&&!(r instanceof Map)&&(a.projectCwd=r),a.importSettings(ib);let n=typeof o<"u"?o:r instanceof Map?r:new Map;for(let[u,A]of n)a.activatePlugin(u,A);return a}static async find(e,r,{strict:o=!0,usePathCheck:a=null,useRc:n=!0}={}){let u=Vst();delete u.rcFilename;let A=new t(e),p=await t.findRcFiles(e),h=await t.findFolderRcFile(my());h&&(p.find(Ie=>Ie.path===h.path)||p.unshift(h));let E=Soe(p.map(ue=>[ue.path,ue.data])),w=Bt.dot,D=new Set(Object.keys(ib)),b=({yarnPath:ue,ignorePath:Ie,injectEnvironmentFiles:he})=>({yarnPath:ue,ignorePath:Ie,injectEnvironmentFiles:he}),C=({yarnPath:ue,ignorePath:Ie,injectEnvironmentFiles:he,...De})=>{let Ee={};for(let[g,me]of Object.entries(De))D.has(g)&&(Ee[g]=me);return Ee},T=({yarnPath:ue,ignorePath:Ie,...he})=>{let De={};for(let[Ee,g]of Object.entries(he))D.has(Ee)||(De[Ee]=g);return De};if(A.importSettings(b(ib)),A.useWithSource("",b(u),e,{strict:!1}),E){let[ue,Ie]=E;A.useWithSource(ue,b(Ie),w,{strict:!1})}if(a){if(await Xst({configuration:A,selfPath:a})!==null)return A;A.useWithSource("",{ignorePath:!0},e,{strict:!1,overwrite:!0})}let N=await t.findProjectCwd(e);A.startingCwd=e,A.projectCwd=N;let U=Object.assign(Object.create(null),process.env);A.env=U;let J=await Promise.all(A.get("injectEnvironmentFiles").map(async ue=>{let Ie=ue.endsWith("?")?await ae.readFilePromise(ue.slice(0,-1),"utf8").catch(()=>""):await ae.readFilePromise(ue,"utf8");return(0,gce.parse)(Ie)}));for(let ue of J)for(let[Ie,he]of Object.entries(ue))A.env[Ie]=NP(he,{env:U});if(A.importSettings(C(ib)),A.useWithSource("",C(u),e,{strict:o}),E){let[ue,Ie]=E;A.useWithSource(ue,C(Ie),w,{strict:o})}let te=ue=>"default"in ue?ue.default:ue,le=new Map([["@@core",Vse]]);if(r!==null)for(let ue of r.plugins.keys())le.set(ue,te(r.modules.get(ue)));for(let[ue,Ie]of le)A.activatePlugin(ue,Ie);let ce=new Map([]);if(r!==null){let ue=new Map;for(let[De,Ee]of r.modules)ue.set(De,()=>Ee);let Ie=new Set,he=async(De,Ee)=>{let{factory:g,name:me}=vf(De);if(!g||Ie.has(me))return;let Ce=new Map(ue),fe=Z=>{if((0,dce.isBuiltin)(Z))return vf(Z);if(Ce.has(Z))return Ce.get(Z)();throw new it(`This plugin cannot access the package referenced via ${Z} which is neither a builtin, nor an exposed entry`)},ie=await zm(async()=>te(await g(fe)),Z=>`${Z} (when initializing ${me}, defined in ${Ee})`);ue.set(me,()=>ie),Ie.add(me),ce.set(me,ie)};if(u.plugins)for(let De of u.plugins.split(";")){let Ee=V.resolve(e,Ae.toPortablePath(De));await he(Ee,"")}for(let{path:De,cwd:Ee,data:g}of p)if(n&&Array.isArray(g.plugins))for(let me of g.plugins){let Ce=typeof me!="string"?me.path:me,fe=me?.spec??"",ie=me?.checksum??"";if(j1.has(fe))continue;let Z=V.resolve(Ee,Ae.toPortablePath(Ce));if(!await ae.existsPromise(Z)){if(!fe){let ht=Ut(A,V.basename(Z,".cjs"),Ct.NAME),q=Ut(A,".gitignore",Ct.NAME),nt=Ut(A,A.values.get("rcFilename"),Ct.NAME),Le=Ut(A,"https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored",Ct.URL);throw new it(`Missing source for the ${ht} plugin - please try to remove the plugin from ${nt} then reinstall it manually. This error usually occurs because ${q} is incorrect, check ${Le} to make sure your plugin folder isn't gitignored.`)}if(!fe.match(/^https?:/)){let ht=Ut(A,V.basename(Z,".cjs"),Ct.NAME),q=Ut(A,A.values.get("rcFilename"),Ct.NAME);throw new it(`Failed to recognize the source for the ${ht} plugin - please try to delete the plugin from ${q} then reinstall it manually.`)}let Se=await EU(fe,{configuration:A}),Re=Ji(Se);if(ie&&ie!==Re){let ht=Ut(A,V.basename(Z,".cjs"),Ct.NAME),q=Ut(A,A.values.get("rcFilename"),Ct.NAME),nt=Ut(A,`yarn plugin import ${fe}`,Ct.CODE);throw new it(`Failed to fetch the ${ht} plugin from its remote location: its checksum seems to have changed. If this is expected, please remove the plugin from ${q} then run ${nt} to reimport it.`)}await ae.mkdirPromise(V.dirname(Z),{recursive:!0}),await ae.writeFilePromise(Z,Se)}await he(Z,De)}}for(let[ue,Ie]of ce)A.activatePlugin(ue,Ie);if(A.useWithSource("",T(u),e,{strict:o}),E){let[ue,Ie]=E;A.useWithSource(ue,T(Ie),w,{strict:o})}return A.get("enableGlobalCache")&&(A.values.set("cacheFolder",`${A.get("globalFolder")}/cache`),A.sources.set("cacheFolder","")),A}static async findRcFiles(e){let r=SU(),o=[],a=e,n=null;for(;a!==n;){n=a;let u=V.join(n,r);if(ae.existsSync(u)){let A,p;try{p=await ae.readFilePromise(u,"utf8"),A=Vi(p)}catch{let h="";throw p?.match(/^\s+(?!-)[^:]+\s+\S+/m)&&(h=" (in particular, make sure you list the colons after each key name)"),new it(`Parse error when loading ${u}; please check it's proper Yaml${h}`)}o.unshift({path:u,cwd:n,data:A})}a=V.dirname(n)}return o}static async findFolderRcFile(e){let r=V.join(e,mr.rc),o;try{o=await ae.readFilePromise(r,"utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}let a=Vi(o);return{path:r,cwd:e,data:a}}static async findProjectCwd(e){let r=null,o=e,a=null;for(;o!==a;){if(a=o,ae.existsSync(V.join(a,mr.lockfile)))return a;ae.existsSync(V.join(a,mr.manifest))&&(r=a),o=V.dirname(a)}return r}static async updateConfiguration(e,r,o={}){let a=SU(),n=V.join(e,a),u=ae.existsSync(n)?Vi(await ae.readFilePromise(n,"utf8")):{},A=!1,p;if(typeof r=="function"){try{p=r(u)}catch{p=r({})}if(p===u)return!1}else{p=u;for(let h of Object.keys(r)){let E=u[h],w=r[h],D;if(typeof w=="function")try{D=w(E)}catch{D=w(void 0)}else D=w;E!==D&&(D===t.deleteProperty?delete p[h]:p[h]=D,A=!0)}if(!A)return!1}return await ae.changeFilePromise(n,Sa(p),{automaticNewlines:!0}),!0}static async addPlugin(e,r){r.length!==0&&await t.updateConfiguration(e,o=>{let a=o.plugins??[];if(a.length===0)return{...o,plugins:r};let n=[],u=[...r];for(let A of a){let p=typeof A!="string"?A.path:A,h=u.find(E=>E.path===p);h?(n.push(h),u=u.filter(E=>E!==h)):n.push(A)}return n.push(...u),{...o,plugins:n}})}static async updateHomeConfiguration(e){let r=my();return await t.updateConfiguration(r,e)}activatePlugin(e,r){this.plugins.set(e,r),typeof r.configuration<"u"&&this.importSettings(r.configuration)}importSettings(e){for(let[r,o]of Object.entries(e))if(o!=null){if(this.settings.has(r))throw new Error(`Cannot redefine settings "${r}"`);this.settings.set(r,o),this.values.set(r,bU(this,o))}}useWithSource(e,r,o,a){try{this.use(e,r,o,a)}catch(n){throw n.message+=` (in ${Ut(this,e,Ct.PATH)})`,n}}use(e,r,o,{strict:a=!0,overwrite:n=!1}={}){a=a&&this.get("enableStrictSettings");for(let u of["enableStrictSettings",...Object.keys(r)]){let A=r[u],p=e4(A);if(p&&(e=p),typeof A>"u"||u==="plugins"||e===""&&jst.has(u))continue;if(u==="rcFilename")throw new it(`The rcFilename settings can only be set via ${`${ob}RC_FILENAME`.toUpperCase()}, not via a rc file`);let h=this.settings.get(u);if(!h){let w=my(),D=e[0]!=="<"?V.dirname(e):null;if(a&&!(D!==null?w===D:!1))throw new it(`Unrecognized or legacy configuration settings found: ${u} - run "yarn config -v" to see the list of settings supported in Yarn`);this.invalid.set(u,e);continue}if(this.sources.has(u)&&!(n||h.type==="MAP"||h.isArray&&h.concatenateValues))continue;let E;try{E=xU(this,u,A,h,o)}catch(w){throw w.message+=` in ${Ut(this,e,Ct.PATH)}`,w}if(u==="enableStrictSettings"&&e!==""){a=E;continue}if(h.type==="MAP"){let w=this.values.get(u);this.values.set(u,new Map(n?[...w,...E]:[...E,...w])),this.sources.set(u,`${this.sources.get(u)}, ${e}`)}else if(h.isArray&&h.concatenateValues){let w=this.values.get(u);this.values.set(u,n?[...w,...E]:[...E,...w]),this.sources.set(u,`${this.sources.get(u)}, ${e}`)}else this.values.set(u,E),this.sources.set(u,e)}}get(e){if(!this.values.has(e))throw new Error(`Invalid configuration key "${e}"`);return this.values.get(e)}getSpecial(e,{hideSecrets:r=!1,getNativePaths:o=!1}){let a=this.get(e),n=this.settings.get(e);if(typeof n>"u")throw new it(`Couldn't find a configuration settings named "${e}"`);return sb(a,n,{hideSecrets:r,getNativePaths:o})}getSubprocessStreams(e,{header:r,prefix:o,report:a}){let n,u,A=ae.createWriteStream(e);if(this.get("enableInlineBuilds")){let p=a.createStreamReporter(`${o} ${Ut(this,"STDOUT","green")}`),h=a.createStreamReporter(`${o} ${Ut(this,"STDERR","red")}`);n=new DU.PassThrough,n.pipe(p),n.pipe(A),u=new DU.PassThrough,u.pipe(h),u.pipe(A)}else n=A,u=A,typeof r<"u"&&n.write(`${r} -`);return{stdout:n,stderr:u}}makeResolver(){let e=[];for(let r of this.plugins.values())for(let o of r.resolvers||[])e.push(new o);return new Sg([new Ix,new ci,...e])}makeFetcher(){let e=[];for(let r of this.plugins.values())for(let o of r.fetchers||[])e.push(new o);return new py([new hy,new gy,...e])}getLinkers(){let e=[];for(let r of this.plugins.values())for(let o of r.linkers||[])e.push(new o);return e}getSupportedArchitectures(){let e=q1(),r=this.get("supportedArchitectures"),o=r.get("os");o!==null&&(o=o.map(u=>u==="current"?e.os:u));let a=r.get("cpu");a!==null&&(a=a.map(u=>u==="current"?e.cpu:u));let n=r.get("libc");return n!==null&&(n=ul(n,u=>u==="current"?e.libc??ul.skip:u)),{os:o,cpu:a,libc:n}}isInteractive({interactive:e,stdout:r}){return r.isTTY?e??this.get("preferInteractive"):!1}async getPackageExtensions(){if(this.packageExtensions!==null)return this.packageExtensions;this.packageExtensions=new Map;let e=this.packageExtensions,r=(o,a,{userProvided:n=!1}={})=>{if(!Fa(o.range))throw new Error("Only semver ranges are allowed as keys for the packageExtensions setting");let u=new _t;u.load(a,{yamlCompatibilityMode:!0});let A=u1(e,o.identHash),p=[];A.push([o.range,p]);let h={status:"inactive",userProvided:n,parentDescriptor:o};for(let E of u.dependencies.values())p.push({...h,type:"Dependency",descriptor:E});for(let E of u.peerDependencies.values())p.push({...h,type:"PeerDependency",descriptor:E});for(let[E,w]of u.peerDependenciesMeta)for(let[D,b]of Object.entries(w))p.push({...h,type:"PeerDependencyMeta",selector:E,key:D,value:b})};await this.triggerHook(o=>o.registerPackageExtensions,this,r);for(let[o,a]of this.get("packageExtensions"))r(lh(o,!0),LP(a),{userProvided:!0});return e}normalizeLocator(e){return Fa(e.reference)?Ps(e,`${this.get("defaultProtocol")}${e.reference}`):by.test(e.reference)?Ps(e,`${this.get("defaultProtocol")}${e.reference}`):e}normalizeDependency(e){return Fa(e.range)?kn(e,`${this.get("defaultProtocol")}${e.range}`):by.test(e.range)?kn(e,`${this.get("defaultProtocol")}${e.range}`):e}normalizeDependencyMap(e){return new Map([...e].map(([r,o])=>[r,this.normalizeDependency(o)]))}normalizePackage(e,{packageExtensions:r}){let o=E1(e),a=r.get(e.identHash);if(typeof a<"u"){let u=e.version;if(u!==null){for(let[A,p]of a)if(nA(u,A))for(let h of p)switch(h.status==="inactive"&&(h.status="redundant"),h.type){case"Dependency":typeof o.dependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",o.dependencies.set(h.descriptor.identHash,this.normalizeDependency(h.descriptor)));break;case"PeerDependency":typeof o.peerDependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",o.peerDependencies.set(h.descriptor.identHash,h.descriptor));break;case"PeerDependencyMeta":{let E=o.peerDependenciesMeta.get(h.selector);(typeof E>"u"||!Object.hasOwn(E,h.key)||E[h.key]!==h.value)&&(h.status="active",Al(o.peerDependenciesMeta,h.selector,()=>({}))[h.key]=h.value)}break;default:tO(h)}}}let n=u=>u.scope?`${u.scope}__${u.name}`:`${u.name}`;for(let u of o.peerDependenciesMeta.keys()){let A=Zo(u);o.peerDependencies.has(A.identHash)||o.peerDependencies.set(A.identHash,kn(A,"*"))}for(let u of o.peerDependencies.values()){if(u.scope==="types")continue;let A=n(u),p=rA("types",A),h=rn(p);o.peerDependencies.has(p.identHash)||o.peerDependenciesMeta.has(h)||(o.peerDependencies.set(p.identHash,kn(p,"*")),o.peerDependenciesMeta.set(h,{optional:!0}))}return o.dependencies=new Map(Ss(o.dependencies,([,u])=>ka(u))),o.peerDependencies=new Map(Ss(o.peerDependencies,([,u])=>ka(u))),o}getLimit(e){return Al(this.limits,e,()=>(0,mce.default)(this.get(e)))}async triggerHook(e,...r){for(let o of this.plugins.values()){let a=o.hooks;if(!a)continue;let n=e(a);n&&await n(...r)}}async triggerMultipleHooks(e,r){for(let o of r)await this.triggerHook(e,...o)}async reduceHook(e,r,...o){let a=r;for(let n of this.plugins.values()){let u=n.hooks;if(!u)continue;let A=e(u);A&&(a=await A(a,...o))}return a}async firstHook(e,...r){for(let o of this.plugins.values()){let a=o.hooks;if(!a)continue;let n=e(a);if(!n)continue;let u=await n(...r);if(typeof u<"u")return u}return null}}});var Hr={};Vt(Hr,{EndStrategy:()=>RU,ExecError:()=>lb,PipeError:()=>Y1,execvp:()=>BU,pipevp:()=>Xc});function kg(t){return t!==null&&typeof t.fd=="number"}function kU(){}function QU(){for(let t of Qg)t.kill()}async function Xc(t,e,{cwd:r,env:o=process.env,strict:a=!1,stdin:n=null,stdout:u,stderr:A,end:p=2}){let h=["pipe","pipe","pipe"];n===null?h[0]="ignore":kg(n)&&(h[0]=n),kg(u)&&(h[1]=u),kg(A)&&(h[2]=A);let E=(0,FU.default)(t,e,{cwd:Ae.fromPortablePath(r),env:{...o,PWD:Ae.fromPortablePath(r)},stdio:h});Qg.add(E),Qg.size===1&&(process.on("SIGINT",kU),process.on("SIGTERM",QU)),!kg(n)&&n!==null&&n.pipe(E.stdin),kg(u)||E.stdout.pipe(u,{end:!1}),kg(A)||E.stderr.pipe(A,{end:!1});let w=()=>{for(let D of new Set([u,A]))kg(D)||D.end()};return new Promise((D,b)=>{E.on("error",C=>{Qg.delete(E),Qg.size===0&&(process.off("SIGINT",kU),process.off("SIGTERM",QU)),(p===2||p===1)&&w(),b(C)}),E.on("close",(C,T)=>{Qg.delete(E),Qg.size===0&&(process.off("SIGINT",kU),process.off("SIGTERM",QU)),(p===2||p===1&&C!==0)&&w(),C===0||!a?D({code:TU(C,T)}):b(new Y1({fileName:t,code:C,signal:T}))})})}async function BU(t,e,{cwd:r,env:o=process.env,encoding:a="utf8",strict:n=!1}){let u=["ignore","pipe","pipe"],A=[],p=[],h=Ae.fromPortablePath(r);typeof o.PWD<"u"&&(o={...o,PWD:h});let E=(0,FU.default)(t,e,{cwd:h,env:o,stdio:u});return E.stdout.on("data",w=>{A.push(w)}),E.stderr.on("data",w=>{p.push(w)}),await new Promise((w,D)=>{E.on("error",b=>{let C=ze.create(r),T=Ut(C,t,Ct.PATH);D(new Jt(1,`Process ${T} failed to spawn`,N=>{N.reportError(1,` ${$u(C,{label:"Thrown Error",value:Yc(Ct.NO_HINT,b.message)})}`)}))}),E.on("close",(b,C)=>{let T=a==="buffer"?Buffer.concat(A):Buffer.concat(A).toString(a),N=a==="buffer"?Buffer.concat(p):Buffer.concat(p).toString(a);b===0||!n?w({code:TU(b,C),stdout:T,stderr:N}):D(new lb({fileName:t,code:b,signal:C,stdout:T,stderr:N}))})})}function TU(t,e){let r=Zst.get(e);return typeof r<"u"?128+r:t??1}function $st(t,e,{configuration:r,report:o}){o.reportError(1,` ${$u(r,t!==null?{label:"Exit Code",value:Yc(Ct.NUMBER,t)}:{label:"Exit Signal",value:Yc(Ct.CODE,e)})}`)}var FU,RU,Y1,lb,Qg,Zst,nb=It(()=>{St();FU=et(MT());W1();Kl();Wl();RU=(o=>(o[o.Never=0]="Never",o[o.ErrorCode=1]="ErrorCode",o[o.Always=2]="Always",o))(RU||{}),Y1=class extends Jt{constructor({fileName:e,code:r,signal:o}){let a=ze.create(V.cwd()),n=Ut(a,e,Ct.PATH);super(1,`Child ${n} reported an error`,u=>{$st(r,o,{configuration:a,report:u})}),this.code=TU(r,o)}},lb=class extends Y1{constructor({fileName:e,code:r,signal:o,stdout:a,stderr:n}){super({fileName:e,code:r,signal:o}),this.stdout=a,this.stderr=n}};Qg=new Set;Zst=new Map([["SIGINT",2],["SIGQUIT",3],["SIGKILL",9],["SIGTERM",15]])});function Cce(t){Ece=t}function V1(){return typeof LU>"u"&&(LU=Ece()),LU}var LU,Ece,NU=It(()=>{Ece=()=>{throw new Error("Assertion failed: No libzip instance is available, and no factory was configured")}});var Ice=_((ub,MU)=>{var eot=Object.assign({},ve("fs")),OU=function(){var t=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(t=t||__filename),function(e){e=e||{};var r=typeof e<"u"?e:{},o,a;r.ready=new Promise(function(Je,st){o=Je,a=st});var n={},u;for(u in r)r.hasOwnProperty(u)&&(n[u]=r[u]);var A=[],p="./this.program",h=function(Je,st){throw st},E=!1,w=!0,D="";function b(Je){return r.locateFile?r.locateFile(Je,D):D+Je}var C,T,N,U;w&&(E?D=ve("path").dirname(D)+"/":D=__dirname+"/",C=function(st,vt){var ar=ia(st);return ar?vt?ar:ar.toString():(N||(N=eot),U||(U=ve("path")),st=U.normalize(st),N.readFileSync(st,vt?null:"utf8"))},T=function(st){var vt=C(st,!0);return vt.buffer||(vt=new Uint8Array(vt)),me(vt.buffer),vt},process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),A=process.argv.slice(2),h=function(Je){process.exit(Je)},r.inspect=function(){return"[Emscripten Module object]"});var J=r.print||console.log.bind(console),te=r.printErr||console.warn.bind(console);for(u in n)n.hasOwnProperty(u)&&(r[u]=n[u]);n=null,r.arguments&&(A=r.arguments),r.thisProgram&&(p=r.thisProgram),r.quit&&(h=r.quit);var le=0,ce=function(Je){le=Je},ue;r.wasmBinary&&(ue=r.wasmBinary);var Ie=r.noExitRuntime||!0;typeof WebAssembly!="object"&&Hi("no native wasm support detected");function he(Je,st,vt){switch(st=st||"i8",st.charAt(st.length-1)==="*"&&(st="i32"),st){case"i1":return Ke[Je>>0];case"i8":return Ke[Je>>0];case"i16":return ap((Je>>1)*2);case"i32":return Rs((Je>>2)*4);case"i64":return Rs((Je>>2)*4);case"float":return gu((Je>>2)*4);case"double":return op((Je>>3)*8);default:Hi("invalid type for getValue: "+st)}return null}var De,Ee=!1,g;function me(Je,st){Je||Hi("Assertion failed: "+st)}function Ce(Je){var st=r["_"+Je];return me(st,"Cannot call unknown function "+Je+", make sure it is exported"),st}function fe(Je,st,vt,ar,ee){var ye={string:function(Qi){var Sn=0;if(Qi!=null&&Qi!==0){var fa=(Qi.length<<2)+1;Sn=pi(fa),ht(Qi,Sn,fa)}return Sn},array:function(Qi){var Sn=pi(Qi.length);return Le(Qi,Sn),Sn}};function Ne(Qi){return st==="string"?Se(Qi):st==="boolean"?!!Qi:Qi}var gt=Ce(Je),mt=[],Dt=0;if(ar)for(var er=0;er=vt)&&xe[ar];)++ar;return Z.decode(xe.subarray(Je,ar))}function Re(Je,st,vt,ar){if(!(ar>0))return 0;for(var ee=vt,ye=vt+ar-1,Ne=0;Ne=55296&><=57343){var mt=Je.charCodeAt(++Ne);gt=65536+((gt&1023)<<10)|mt&1023}if(gt<=127){if(vt>=ye)break;st[vt++]=gt}else if(gt<=2047){if(vt+1>=ye)break;st[vt++]=192|gt>>6,st[vt++]=128|gt&63}else if(gt<=65535){if(vt+2>=ye)break;st[vt++]=224|gt>>12,st[vt++]=128|gt>>6&63,st[vt++]=128|gt&63}else{if(vt+3>=ye)break;st[vt++]=240|gt>>18,st[vt++]=128|gt>>12&63,st[vt++]=128|gt>>6&63,st[vt++]=128|gt&63}}return st[vt]=0,vt-ee}function ht(Je,st,vt){return Re(Je,xe,st,vt)}function q(Je){for(var st=0,vt=0;vt=55296&&ar<=57343&&(ar=65536+((ar&1023)<<10)|Je.charCodeAt(++vt)&1023),ar<=127?++st:ar<=2047?st+=2:ar<=65535?st+=3:st+=4}return st}function nt(Je){var st=q(Je)+1,vt=aa(st);return vt&&Re(Je,Ke,vt,st),vt}function Le(Je,st){Ke.set(Je,st)}function Te(Je,st){return Je%st>0&&(Je+=st-Je%st),Je}var ke,Ke,xe,tt,He,x,I,P,y,R;function z(Je){ke=Je,r.HEAP_DATA_VIEW=R=new DataView(Je),r.HEAP8=Ke=new Int8Array(Je),r.HEAP16=tt=new Int16Array(Je),r.HEAP32=x=new Int32Array(Je),r.HEAPU8=xe=new Uint8Array(Je),r.HEAPU16=He=new Uint16Array(Je),r.HEAPU32=I=new Uint32Array(Je),r.HEAPF32=P=new Float32Array(Je),r.HEAPF64=y=new Float64Array(Je)}var X=r.INITIAL_MEMORY||16777216,$,se=[],be=[],Fe=[],lt=!1;function Et(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Pt(r.preRun.shift());hs(se)}function qt(){lt=!0,hs(be)}function nr(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Sr(r.postRun.shift());hs(Fe)}function Pt(Je){se.unshift(Je)}function cn(Je){be.unshift(Je)}function Sr(Je){Fe.unshift(Je)}var yr=0,Rr=null,Xr=null;function $n(Je){yr++,r.monitorRunDependencies&&r.monitorRunDependencies(yr)}function Xs(Je){if(yr--,r.monitorRunDependencies&&r.monitorRunDependencies(yr),yr==0&&(Rr!==null&&(clearInterval(Rr),Rr=null),Xr)){var st=Xr;Xr=null,st()}}r.preloadedImages={},r.preloadedAudios={};function Hi(Je){r.onAbort&&r.onAbort(Je),Je+="",te(Je),Ee=!0,g=1,Je="abort("+Je+"). Build with -s ASSERTIONS=1 for more info.";var st=new WebAssembly.RuntimeError(Je);throw a(st),st}var Qs="data:application/octet-stream;base64,";function Zs(Je){return Je.startsWith(Qs)}var bi="data:application/octet-stream;base64,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QCAAKAJIIgEgASADaiADEAcaAkAgAyAAKAJsIgFNBEAgACABIANrNgJsDAELIABCADcCbAsgACAAKAJoIANrIgE2AmggACAAKAJYIANrNgJYIAEgACgChC5JBEAgACABNgKELgsgAEH8gAEoAgARAwAgAiADaiECCwJAIAAoAgAiASgCBCIERQ0AIAAoAjwhBSAAIAIgBCACIARJGyICBH8gACgCSCAAKAJoaiAFaiEFIAEgBCACazYCBAJAAkACQAJAIAEoAhwiBCgCFEEBaw4CAQACCyAEQaABaiAFIAEoAgAgAkHcgAEoAgARCAAMAgsgASABKAIwIAUgASgCACACQcSAASgCABEEADYCMAwBCyAFIAEoAgAgAhAHGgsgASABKAIAIAJqNgIAIAEgASgCCCACajYCCCAAKAI8BSAFCyACaiICNgI8AkAgACgChC4iASACakEDSQ0AIAAoAmggAWshAQJAIAAoAnRBgQhPBEAgACAAIAAoAkggAWoiAi0AACACLQABIAAoAnwRAAA2AlQMAQsgAUUNACAAIAFBAWsgACgChAERAgAaCyAAKAKELiAAKAI8IgJBAUZrIgRFDQAgACABIAQgACgCgAERBQAgACAAKAKELiAEazYChC4gACgCPCECCyACQYUCSw0AIAAoAgAoAgRFDQAgACgCMCEBDAELCwJAIAAoAkQiAiAAKAJAIgNNDQAgAAJ/IAAoAjwgACgCaGoiASADSwRAIAAoAkggAWpBACACIAFrIgNBggIgA0GCAkkbIgMQGSABIANqDAELIAFBggJqIgEgA00NASAAKAJIIANqQQAgAiADayICIAEgA2siAyACIANJGyIDEBkgACgCQCADags2AkALC50CAQF/AkAgAAJ/IAAoAqAuIgFBwABGBEAgACgCBCAAKAIQaiAAKQOYLjcAACAAQgA3A5guIAAgACgCEEEIajYCEEEADAELIAFBIE4EQCAAKAIEIAAoAhBqIAApA5guPgAAIAAgAEGcLmo1AgA3A5guIAAgACgCEEEEajYCECAAIAAoAqAuQSBrIgE2AqAuCyABQRBOBEAgACgCBCAAKAIQaiAAKQOYLj0AACAAIAAoAhBBAmo2AhAgACAAKQOYLkIQiDcDmC4gACAAKAKgLkEQayIBNgKgLgsgAUEISA0BIAAgACgCECIBQQFqNgIQ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KAJUIgEEfyABQQAgARAiEBkgACgCVAVBAAsQBiAAQQA2AlQLC9wMAgl/AX4jAEFAaiIGJAACQAJAAkACQAJAIAEoAjBBABAjIgVBAkZBACABKAI4QQAQIyIEQQFGGw0AIAVBAUZBACAEQQJGGw0AIAVBAkciAw0BIARBAkcNAQsgASABLwEMQYAQcjsBDEEAIQMMAQsgASABLwEMQf/vA3E7AQxBACEFIANFBEBB9eABIAEoAjAgAEEIahBpIgVFDQILIAJBgAJxBEAgBSEDDAELIARBAkcEQCAFIQMMAQtB9cYBIAEoAjggAEEIahBpIgNFBEAgBRAcDAILIAMgBTYCAAsgASABLwEMQf7/A3EgAS8BUiIFQQBHcjsBDAJAAkACQAJAAn8CQAJAIAEpAyhC/v///w9WDQAgASkDIEL+////D1YNACACQYAEcUUNASABKQNIQv////8PVA0BCyAFQYECa0H//wNxQQNJIQdBAQwBCyAFQYECa0H//wNxIQQgAkGACnFBgApHDQEgBEEDSSEHQQALIQkgBkIcEBciBEUEQCAAQQhqIgAEQCAAQQA2AgQgAEEONgIACyADEBwMBQsgAkGACHEhBQJAAkAgAkGAAnEEQAJAIAUNACABKQMgQv////8PVg0AIAEpAyhCgICAgBBUDQMLIAQgASkDKBAYIAEpAyAhDAwBCwJAAkACQCAFDQAgASkDIEL/////D1YNACABKQMoIgxC/////w9WDQEgASkDSEKAgICAEFQNBAsgASkDKCIMQv////8PVA0BCyAEIAwQGAsgASkDICIMQv////8PWgRAIAQgDBAYCyABKQNIIgxC/////w9UDQELIAQgDBAYCyAELQAARQRAIABBCGoiAARAIABBADYCBCAAQRQ2AgALIAQQCCADEBwMBQtBASEKQQEgBC0AAAR+IAQpAxAFQgALp0H//wNxIAYQRyEFIAQQCCAFIAM2AgAgBw0BDAILIAMhBSAEQQJLDQELIAZCBxAXIgRFBEAgAEEIaiIABEAgAEEANgIEIABBDjYCAAsgBRAcDAMLIARBAhANIARBhxJBAhAsIAQgAS0AUhBwIAQgAS8BEBANIAQtAABFBEAgAEEIaiIABEAgAEEANgIEIABBFDYCAAsgBBAIDAILQYGyAkEHIAYQRyEDIAQQCCADIAU2AgBBASEL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NgIEIABB7A42AhggGiEdDAMLIARB/wFxIgJBwABxRQRAIAggDSADLwECQQJ0aiAdp0F/IAJ0QX9zcUECdGoiAy0AASICayEIIB0gAq2IIR0gAy0AACIERQ0HDAELCyAEQSBxBEAgB0G//gA2AgQgASECDAgLIAdB0f4ANgIEIABB0A42AhggASECDAcLIB1BfyAGdEF/c62DIBt8IhunIQUgCCAEQQ9xIgNrIQggGiAErUIPg4ghHSABIBdrIgYgAjMBAiAaQX8gA3RBf3Otg3ynIgRPDQIgBCAGayIGIBlNDQEgBygCjEdFDQEgB0HR/gA2AgQgAEG5DDYCGAsgASECIAshBQwFCwJAIA5FBEAgDCARIAZraiEDDAELIAYgDk0EQCAMIA4gBmtqIQMMAQsgDCARIAYgDmsiBmtqIQMgBSAGTQ0AIAUgBmshBQJAAkAgASADTSABIA8gAWusIhogBq0iGyAaIBtUGyIapyIGaiICIANLcQ0AIAMgBmogAUsgASADT3ENACABIAMgBhAHGiACIQEMAQsgASADIAMgAWsiASABQR91IgFqIAFzIgIQByACaiEBIBogAq0iHn0iHFANACACIANqIQIDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgASACKQAANwAAIAEgAikAGDcAGCABIAIpABA3ABAgASACKQAINwAIIBpCIH0hGiACQSBqIQIgAUEgaiEBIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAEgAikAADcAACABIAIpABg3ABggASACKQAQNwAQIAEgAikACDcACCABIAIpADg3ADggASACKQAwNwAwIAEgAikAKDcAKCABIAIpACA3ACAgASACKQBYNwBYIAEgAikAUDcAUCABIAIpAEg3AEggASACKQBANwBAIAEgAikAYDcAYCABIAIpAGg3AGggASACKQBwNwBwIAEgAikAeDcAeCACQYABaiECIAFBgAFqIQEgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAEgAikAADcAACABIAIpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCABIAIpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCABIAIoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCABIAIvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCABIAItAAA6AAAgAkEBaiECIAFBAWohAQsgHEIAUg0ACwsgDiEGIAwhAwsgBSAGSwRAAkACQCABIANNIAEgDyABa6wiGiAGrSIbIBogG1QbIhqnIglqIgIgA0txDQAgAyAJaiABSyABIANPcQ0AIAEgAyAJEAcaDAELIAEgAyADIAFrIgEgAUEfdSIBaiABcyIBEAcgAWohAiAaIAGtIh59IhxQDQAgASADaiEBA0ACQCAcIB4gHCAeVBsiG0IgVARAIBshGgwBCyAbIhpCIH0iIEIFiEIBfEIDgyIfUEUEQANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCAaQiB9IRogAUEgaiEBIAJBIGohAiAfQgF9Ih9CAFINAAsLICBC4ABUDQADQCACIAEpAAA3AAAgAiABKQAYNwAYIAIgASkAEDcAECACIAEpAAg3AAggAiABKQA4NwA4IAIgASkAMDcAMCACIAEpACg3ACggAiABKQAgNwAgIAIgASkAWDcAWCACIAEpAFA3AFAgAiABKQBINwBIIAIgASkAQDcAQCACIAEpAGA3AGAgAiABKQBoNwBoIAIgASkAcDcAcCACIAEpAHg3AHggAUGAAWohASACQYABaiECIBpCgAF9IhpCH1YNAAsLIBpCEFoEQCACIAEpAAA3AAAgAiABKQAINwAIIBpCEH0hGiACQRBqIQIgAUEQaiEBCyAaQghaBEAgAiABKQAANwAAIBpCCH0hGiACQQhqIQIgAUEIaiEBCyAaQgRaBEAgAiABKAAANgAAIBpCBH0hGiACQQRqIQIgAUEEaiEBCyAaQgJaBEAgAiABLwAAOwAAIBpCAn0hGiACQQJqIQIgAUECaiEBCyAcIBt9IRwgGlBFBEAgAiABLQAAOgAAIAJBAWohAiABQQFqIQELIBxCAFINAAsLIAUgBmshAUEAIARrIQUCQCAEQQdLBEAgBCEDDAELIAEgBE0EQCAEIQMMAQsgAiAEayEFA0ACQCACIAUpAAA3AAAgBEEBdCEDIAEgBGshASACIARqIQIgBEEDSw0AIAMhBCABIANLDQELC0EAIANrIQULIAIgBWohBAJAIAUgDyACa6wiGiABrSIbIBogG1QbIhqnIgFIIAVBf0pxDQAgBUEBSCABIARqIAJLcQ0AIAIgBCABEAcgAWohAgwDCyACIAQgAyADQR91IgFqIAFzIgEQByABaiECIBogAa0iHn0iHFANAiABIARqIQEDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIBpCIH0hGiABQSBqIQEgAkEgaiECIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCACIAEpADg3ADggAiABKQAwNwAwIAIgASkAKDcAKCACIAEpACA3ACAgAiABKQBYNwBYIAIgASkAUDcAUCACIAEpAEg3AEggAiABKQBANwBAIAIgASkAYDcAYCACIAEpAGg3AGggAiABKQBwNwBwIAIgASkAeDcAeCABQYABaiEBIAJBgAFqIQIgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAIgASkAADcAACACIAEpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCACIAEpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCACIAEoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCACIAEvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCACIAEtAAA6AAAgAkEBaiECIAFBAWohAQsgHFBFDQALDAILAkAgASADTSABIA8gAWusIhogBa0iGyAaIBtUGyIapyIEaiICIANLcQ0AIAMgBGogAUsgASADT3ENACABIAMgBBAHGgwCCyABIAMgAyABayIBIAFBH3UiAWogAXMiARAHIAFqIQIgGiABrSIefSIcUA0BIAEgA2ohAQNAAkAgHCAeIBwgHlQbIhtCIFQEQCAbIRoMAQsgGyIaQiB9IiBCBYhCAXxCA4MiH1BFBEADQCACIAEpAAA3AAAgAiABKQAYNwAYIAIgASkAEDcAECACIAEpAAg3AAggGkIgfSEaIAFBIGohASACQSBqIQIgH0IBfSIfQgBSDQALCyAgQuAAVA0AA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIAIgASkAODcAOCACIAEpADA3ADAgAiABKQAoNwAoIAIgASkAIDcAICACIAEpAFg3AFggAiABKQBQNwBQIAIgASkASDcASCACIAEpAEA3AEAgAiABKQBgNwBgIAIgASkAaDcAaCACIAEpAHA3AHAgAiABKQB4NwB4IAFBgAFqIQEgAkGAAWohAiAaQoABfSIaQh9WDQALCyAaQhBaBEAgAiABKQAANwAAIAIgASkACDcACCAaQhB9IRogAkEQaiECIAFBEGohAQsgGkIIWgRAIAIgASkAADcAACAaQgh9IRogAkEIaiECIAFBCGohAQsgGkIEWgRAIAIgASgAADYAACAaQgR9IRogAkEEaiECIAFBBGohAQsgGkICWgRAIAIgAS8AADsAACAaQgJ9IRogAkECaiECIAFBAmohAQsgHCAbfSEcIBpQRQRAIAIgAS0AADoAACACQQFqIQIgAUEBaiEBCyAcUEUNAAsMAQsCQAJAIBYEQAJAIAQgBUkEQCAHKAKYRyAESw0BCyABIARrIQMCQEEAIARrIgVBf0ogDyABa6wiGiAbIBogG1QbIhqnIgIgBUpxDQAgBUEBSCACIANqIAFLcQ0AIAEgAyACEAcgAmohAgwFCyABIAMgBCAEQR91IgFqIAFzIgEQByABaiECIBogAa0iHn0iHFANBCABIANqIQEDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIBpCIH0hGiABQSBqIQEgAkEgaiECIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCACIAEpADg3ADggAiABKQAwNwAwIAIgASkAKDcAKCACIAEpACA3ACAgAiABKQBYNwBYIAIgASkAUDcAUCACIAEpAEg3AEggAiABKQBANwBAIAIgASkAYDcAYCACIAEpAGg3AGggAiABKQBwNwBwIAIgASkAeDcAeCABQYABaiEBIAJBgAFqIQIgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAIgASkAADcAACACIAEpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCACIAEpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCACIAEoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCACIAEvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCACIAEtAAA6AAAgAkEBaiECIAFBAWohAQsgHFBFDQALDAQLIBAgAWsiCUEBaiIGIAUgBSAGSxshAyABIARrIQIgAUEHcUUNAiADRQ0CIAEgAi0AADoAACACQQFqIQIgAUEBaiIGQQdxQQAgA0EBayIFGw0BIAYhASAFIQMgCSEGDAILAkAgBCAFSQRAIAcoAphHIARLDQELIAEgASAEayIGKQAANwAAIAEgBUEBa0EHcUEBaiIDaiECIAUgA2siBEUNAyADIAZqIQEDQCACIAEpAAA3AAAgAUEIaiEBIAJBCGohAiAEQQhrIgQNAAsMAwsgASAEIAUQPyECDAILIAEgAi0AADoAASAJQQFrIQYgA0ECayEFIAJBAWohAgJAIAFBAmoiCkEHcUUNACAFRQ0AIAEgAi0AADoAAiAJQQJrIQYgA0EDayEFIAJBAWohAgJAIAFBA2oiCkEHcUUNACAFRQ0AIAEgAi0AADoAAyAJQQNrIQYgA0EEayEFIAJBAWohAgJAIAFBBGoiCkEHcUUNACAFRQ0AIAEgAi0AADoABCAJQQRrIQYgA0EFayEFIAJBAWohAgJAIAFBBWoiCkEHcUUNACAFRQ0AIAEgAi0AADoABSAJQQVrIQYgA0EGayEFIAJBAWohAgJAIAFBBmoiCkEHcUUNACAFRQ0AIAEgAi0AADoABiAJQQZrIQYgA0EHayEFIAJBAWohAgJAIAFBB2oiCkEHcUUNACAFRQ0AIAEgAi0AADoAByAJQQdrIQYgA0EIayEDIAFBCGohASACQQFqIQIMBgsgCiEBIAUhAwwFCyAKIQEgBSEDDAQLIAohASAFIQMMAwsgCiEBIAUhAwwCCyAKIQEgBSEDDAELIAohASAFIQMLAkACQCAGQRdNBEAgA0UNASADQQFrIQUgA0EHcSIEBEADQCABIAItAAA6AAAgA0EBayEDIAFBAWohASACQQFqIQIgBEEBayIEDQALCyAFQQdJDQEDQCABIAItAAA6AAAgASACLQABOgABIAEgAi0AAjoAAiABIAItAAM6AAMgASACLQAEOgAEIAEgAi0ABToABSABIAItAAY6AAYgASACLQAHOgAHIAFBCGohASACQQhqIQIgA0EIayIDDQALDAELIAMNAQsgASECDAELIAEgBCADED8hAgsgCyEFDAELIAEgAy0AAjoAACABQQFqIQILIAUgFE8NACACIBNJDQELCyAAIAI2AgwgACAFIAhBA3ZrIgE2AgAgACATIAJrQYMCajYCECAAIBQgAWtBDmo2AgQgByAIQQdxIgA2AogBIAcgHUJ/IACthkJ/hYM+AoQBC+cFAQR/IAMgAiACIANLGyEEIAAgAWshAgJAIABBB3FFDQAgBEUNACAAIAItAAA6AAAgA0EBayEGIAJBAWohAiAAQQFqIgdBB3FBACAEQQFrIgUbRQRAIAchACAFIQQgBiEDDAELIAAgAi0AADoAASADQQJrIQYgBEECayEFIAJBAWohAgJAIABBAmoiB0EHcUUNACAFRQ0AIAAgAi0AADoAAiADQQNrIQYgBEEDayEFIAJBAWohAgJAIABBA2oiB0EHcUUNACAFRQ0AIAAgAi0AADoAAyADQQRrIQYgBEEEayEFIAJBAWohAgJAIABBBGoiB0EHcUUNACAFRQ0AIAAgAi0AADoABCADQQVrIQYgBEEFayEFIAJBAWohAgJAIABBBWoiB0EHcUUNACAFRQ0AIAAgAi0AADoABSADQQZrIQYgBEEGayEFIAJBAWohAgJAIABBBmoiB0EHcUUNACAFRQ0AIAAgAi0AADoABiADQQdrIQYgBEEHayEFIAJBAWohAgJAIABBB2oiB0EHcUUNACAFRQ0AIAAgAi0AADoAByADQQhrIQMgBEEIayEEIABBCGohACACQQFqIQIMBgsgByEAIAUhBCAGIQMMBQsgByEAIAUhBCAGIQMMBAsgByEAIAUhBCAGIQMMAwsgByEAIAUhBCAGIQMMAgsgByEAIAUhBCAGIQMMAQsgByEAIAUhBCAGIQMLAkAgA0EXTQRAIARFDQEgBEEBayEBIARBB3EiAwRAA0AgACACLQAAOgAAIARBAWshBCAAQQFqIQAgAkEBaiECIANBAWsi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CyAAIAMtAAAEfiADKQMQBUIAC6dB//8DcSADKAIEEEcLIQUgAxAICyAEQRBqJAAgBQvgAQICfwF+QTAQCSICRQRAIAEEQCABQQA2AgQgAUEONgIAC0EADwsgAkIANwMIIAJBADYCACACQgA3AxAgAkIANwMYIAJCADcDICACQgA3ACUgAFAEQCACDwsCQCAAQv////8AVg0AIACnQQR0EAkiA0UNACACIAM2AgBBACEBQgEhBANAIAMgAUEEdGoiAUIANwIAIAFCADcABSAAIARSBEAgBKchASAEQgF8IQQMAQsLIAIgADcDCCACIAA3AxAgAg8LIAEEQCABQQA2AgQgAUEONgIAC0EAEBAgAhAGQQAL7gECA38BfiMAQRBrIgQkAAJAIARBDGpCBBAXIgNFBEBBfyECDAELAkAgAQRAIAJBgAZxIQUDQAJAIAUgASgCBHFFDQACQCADKQMIQgBUBEAgA0EAOgAADAELIANCADcDECADQQE6AAALIAMgAS8BCBANIAMgAS8BChANIAMtAABFBEAgAEEIaiIABEAgAEEANgIEIABBFDYCAAtBfyECDAQLQX8hAiAAIARBDGpCBBAbQQBIDQMgATMBCiIGUA0AIAAgASgCDCAGEBtBAEgNAwsgASgCACIBDQALC0EAIQILIAMQCAsgBEEQaiQAIAILPAEBfyAABEAgAUGABnEhAQNAIAEgACgCBHEEQCACIAAvAQpqQQRqIQILIAAoAgAiAA0ACwsgAkH//wNxC5wBAQN/IABFBEBBAA8LIAAhAwNAAn8CQAJAIAAvAQgiAUH04AFNBEAgAUEBRg0BIAFB9cYBRg0BDAILIAFBgbICRg0AIAFB9eABRw0BCyAAKAIAIQEgAEEANgIAIAAoAgwQBiAAEAYgASADIAAgA0YbIQMCQCACRQRAQQAhAgwBCyACIAE2AgALIAEMAQsgACICKAIACyIADQALIAMLsgQCBX8BfgJAAkACQCAAIAGtEBciAQRAIAEtAAANAUEAIQAMAgsgBARAIARBADYCBCAEQQ42AgALQQAPC0EAIQADQCABLQAABH4gASkDCCABKQMQfQVCAAtCBFQNASABEAwhByABIAEQDCIGrRATIghFBEBBACECIAQEQCAEQQA2AgQgBEEVNgIACyABEAggAEUNAwNAIAAoAgAhASAAKAIMEAYg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DCAAQRg2AggLDAMLIAAgBiAFLwFqQQAgBCABEQYAIQEgBhALIAFFDQILAkAgDUUEQCABIQMMAQsgACABIAUvAWgQgQEhAyABEAsgA0UNAQsCQCAJRSAMckUEQCADIQEMAQsgACADQQEQgAEhASADEAsgAUUNAQsgASEDDAELQQAhAwsgBUHwAGokACADC4UBAQF/IAFFBEAgAEEIaiIABEAgAEEANgIEIABBEjYCAAtBAA8LQTgQCSIDRQRAIABBCGoiAARAIABBADYCBCAAQQ42AgALQQAPCyADQQA2AhAgA0IANwIIIANCADcDKCADQQA2AgQgAyACNgIAIANCADcDGCADQQA2AjAgACABQTsgAxBCCw8AIAAgASACQQBBABCCAQusAgECfyABRQRAIABBCGoiAARAIABBADYCBCAAQRI2AgALQQAPCwJAIAJBfUsNACACQf//A3FBCEYNACAAQQhqIgAEQCAAQQA2AgQgAEEQNgIAC0EADwsCQEGwwAAQCSIFBEAgBUEANgIIIAVCADcCACAFQYiBAUGogQEgAxs2AqhAIAUgAjYCFCAFIAM6ABAgBUEAOgAPIAVBADsBDCAFIAMgAkF9SyIGcToADiAFQQggAiAGG0H//wNxIAQgBUGIgQFBqIEBIAMbKAIAEQAAIgI2AqxAIAINASAFEDEgBRAGCyAAQQhqIgAEQCAAQQA2AgQgAEEONgIAC0EADwsgACABQTogBRBCIgAEfyAABSAFKAKsQCAFKAKoQCgCBBEDACAFEDEgBRAGQQALC6ABAQF/IAIgACgCBCIDIAIgA0kbIgIEQCAAIAMgAms2AgQCQAJAAkACQCAAKAIcIgMoAhRBAWsOAgEAAgsgA0GgAWogASAAKAIAIAJB3IABKAIAEQgADAILIAAgACgCMCABIAAoAgAgAkHEgAEoAgARBAA2AjAMAQsgASAAKAIAIAIQBxoLIAAgACgCACACajYCACAAIAAoAgggAmo2AggLC7cCAQR/QX4hAgJAIABFDQAgACgCIEUNACAAKAIkIgRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCICIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcN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DCABajYCDCAGIAYoAgggAWo2AgggBSAFKAIUIAFqNgIUIAUgBSgCECABazYCECAGIAYoAhAgAWsiATYCECABDQAgBiAGKAIENgIIC0EAIQRBACEJIAMoAhBFDQAMCgsgAygCHCgCJCEGIAMgAygCGCIBQQFqNgIYIAEgBmotAAAhASADIARBAWo2AhAgAygCBCAEaiABOgAAIAEEQCADKAIQIQQMAQsLIAMoAhwoAixFDQAgAygCECIGIAlNDQAgBQJ/IAUoAjAhBEEAIAMoAgQgCWoiAUUNABogBCABIAYgCWtB1IABKAIAEQAACzYCMAsgA0HnADYCIAsCQCADKAIcKAIsBEAgAygCDCADKAIQIgFBAmpJBH8gBRAKIAMoAhANAkEABSABCyADKAIEaiAFKAIwOwAAIAMgAygCEEECajYCECADQaABakHkgAEoAgARAQAaCyADQfEANgIgIAUQCiADKAIQRQ0BDAcLDAYLIAUoAgQNAQsgAygCPA0AIApFDQEgAygCIEGaBUYNAQsCfyADKAKIASIBRQRAIAMgChCFAQwBCwJAAkACQCADKAKMAUECaw4CAAECCwJ/AkADQAJAAkAgAygCPA0AIAMQLyADKAI8DQAgCg0BQQAMBAsgAygCSCADKAJoai0AACEEIAMgAygC8C0iAUEBajYC8C0gASADKALsLWpBADoAACADIAMoAvAtIgFBAWo2AvAtIAEgAygC7C1qQQA6AAAgAyADKALwLSIBQQFqNgLwLSABIAMoAuwtaiAEOgAAIAMgBEECdGoiASABLwHkAUEBajsB5AEgAyADKAI8QQFrNgI8IAMgAygCaEEBaiIBNgJoIAMoAvAtIAMoAvQtRw0BQQAhBCADIAMoAlgiBkEATgR/IAMoAkggBmoFQQALIAEgBmtBABAPIAMgAygCaDYCWCADKAIAEAogAygCACgCEA0BDAILCyADQQA2AoQuIApBBEYEQCADIAMoAlgiAUEATgR/IAMoAkggAWoFQQALIAMoAmggAWtBARAPIAMgAygCaDYCWCADKAIAEApBA0ECIAMoAgAoAhAbDAILIAMoAvAtBEBBACEEIAMgAygCWCIBQQBOBH8gAygCSCABagVBAAsgAygCaCABa0EAEA8gAyADKAJoNgJYIAMoAgAQCiADKAIAKAIQRQ0BC0EBIQQLIAQL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bGl0ZXJhbC9sZW5ndGhzIHNldABpbnZhbGlkIGNvZGUgbGVuZ3RocyBzZXQAdW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0AGludmFsaWQgZGlzdGFuY2VzIHNldABpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0AEZpbGUgYWxyZWFkeSBleGlzdHMAdG9vIG1hbnkgbGVuZ3RoIG9yIGRpc3RhbmNlIHN5bWJvbHMAaW52YWxpZCBzdG9yZWQgYmxvY2sgbGVuZ3RocwAlcyVzJXMAYnVmZmVyIGVycm9yAE5vIGVycm9yAHN0cmVhbSBlcnJvcgBUZWxsIGVycm9yAEludGVybmFsIGVycm9yAFNlZWsgZXJyb3IAV3JpdGUgZXJyb3IAZmlsZSBlcnJvcgBSZWFkIGVycm9yAFpsaWIgZXJyb3IAZGF0YSBlcnJvcgBDUkMgZXJyb3IAaW5jb21wYXRpYmxlIHZlcnNpb24AaW52YWxpZCBjb2RlIC0tIG1pc3NpbmcgZW5kLW9mLWJsb2NrAGluY29ycmVjdCBoZWFkZXIgY2hlY2sAaW5jb3JyZWN0IGxlbmd0aCBjaGVjawBpbmNvcnJlY3QgZGF0YSBjaGVjawBpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjawBoZWFkZXIgY3JjIG1pc21hdGNoADEuMi4xMy56bGliLW5nAGludmFsaWQgd2luZG93IHNpemUAUmVhZC1vbmx5IGFyY2hpdmUATm90IGEgemlwIGFyY2hpdmUAUmVzb3VyY2Ugc3RpbGwgaW4gdXNlAE1hbGxvYyBmYWlsdXJlAGludmFsaWQgYmxvY2sgdHlwZQBGYWlsdXJlIHRvIGNyZWF0ZSB0ZW1wb3JhcnkgZmlsZQBDYW4ndCBvcGVuIGZpbGUATm8gc3VjaCBmaWxlAFByZW1hdHVyZSBlbmQgb2YgZmlsZQBDYW4ndCByZW1vdmUgZmlsZQBpbnZhbGlkIGxpdGVyYWwvbGVuZ3RoIGNvZGUAaW52YWxpZCBkaXN0YW5jZSBjb2RlAHVua25vd24gY29tcHJlc3Npb24gbWV0aG9kAHN0cmVhbSBlbmQAQ29tcHJlc3NlZCBkYXRhIGludmFsaWQATXVsdGktZGlzayB6aXAgYXJjaGl2ZXMgbm90IHN1cHBvcnRl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UgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBnAQkA5wAJAOcBCQAXAAkAFwEJAJcACQCXAQkAVwAJAFcBCQDXAAkA1wEJADcACQA3AQkAtwAJALcBCQB3AAkAdwEJAPcACQD3AQkADwAJAA8BCQCPAAkAjwEJAE8ACQBPAQkAzwAJAM8BCQAvAAkALwEJAK8ACQCvAQkAbwAJAG8BCQDvAAkA7wEJAB8ACQAfAQkAnwAJAJ8BCQBfAAkAXwEJAN8ACQDfAQkAPwAJAD8BCQC/AAkA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SXMgYSBkaXJlY3RvcnkAVGV4dCBmaWxlIGJ1c3kARXhlYyBmb3JtYXQgZXJyb3IASW52YWxpZCBhcmd1bWVudABBcmd1bWVudCBsaXN0IHRvbyBsb25nAFN5bWJvbGljIGxpbmsgbG9vcABGaWxlbmFtZSB0b28gbG9uZwBUb28gbWFueSBvcGVuIGZpbGVzIGluIHN5c3RlbQBObyBmaWxlIGRlc2NyaXB0b3JzIGF2YWlsYWJsZQBCYWQgZmlsZSBkZXNjcmlwdG9yAE5vIGNoaWxkIHByb2Nlc3MAQmFkIGFkZHJlc3MARmlsZSB0b28gbGFyZ2UAVG9vIG1hbnkgbGlua3MATm8gbG9ja3MgYXZhaWxhYmxlAFJlc291cmNlIGRlYWRsb2NrIHdvdWxkIG9jY3VyAFN0YXRlIG5vdCByZWNvdmVyYWJsZQBQcmV2aW91cyBvd25lciBkaWVkAE9wZXJhdGlvbiBjYW5jZWxlZABGdW5jdGlvbiBub3QgaW1wbGVtZW50ZWQATm8gbWVzc2FnZSBvZiBkZXNpcmVkIHR5cGUASWRlbnRpZmllciByZW1vdmVkAERldmljZSBub3QgYSBzdHJlYW0ATm8gZGF0YSBhdmFpbGFibGUARGV2aWNlIHRpbWVvdXQAT3V0IG9mIHN0cmVhbXMgcmVzb3VyY2VzAExpbmsgaGFzIGJlZW4gc2V2ZXJlZABQcm90b2NvbCBlcnJvcgBCYWQgbWVzc2FnZQBGaWxlIGRlc2NyaXB0b3IgaW4gYmFkIHN0YXRlAE5vdCBhIHNvY2tldABEZXN0aW5hdGlvbiBhZGRyZXNzIHJlcXVpcmVkAE1lc3NhZ2UgdG9vIGxhcmdlAFByb3RvY29sIHdyb25nIHR5cGUgZm9yIHNvY2tldABQcm90b2NvbCBub3QgYXZhaWxhYmxlAFByb3RvY29sIG5vdCBzdXBwb3J0ZWQAU29ja2V0IHR5cGUgbm90IHN1cHBvcnRlZABOb3Qgc3VwcG9ydGVkAFByb3RvY29sIGZhbWlseSBub3Qgc3VwcG9ydGVkAEFkZHJlc3MgZmFtaWx5IG5vdCBzdXBwb3J0ZWQgYnkgcHJvdG9jb2wAQWRkcmVzcyBub3QgYXZhaWxhYmxlAE5ldHdvcmsgaXMgZG93bgBOZXR3b3JrIHVucmVhY2hhYmxlAENvbm5lY3Rpb24gcmVzZXQgYnkgbmV0d29yawBDb25uZWN0aW9uIGFib3J0ZWQATm8gYnVmZmVyIHNwYWNlIGF2YWlsYWJsZQBTb2NrZXQgaXMgY29ubmVjdGVkAFNvY2tldCBub3QgY29ubmVjdGVkAENhbm5vdCBzZW5kIGFmdGVyIHNvY2tldCBzaHV0ZG93bgBPcGVyYXRpb24gYWxyZWFkeSBpbiBwcm9ncmVzcwBPcGVyYXRpb24gaW4gcHJvZ3Jlc3MAU3RhbGUgZmlsZSBoYW5kbGUAUmVtb3RlIEkvTyBlcnJvcgBRdW90YSBleGNlZWRlZABObyBtZWRpdW0gZm91bmQAV3JvbmcgbWVkaXVtIHR5cGUATm8gZXJyb3IgaW5mb3JtYXRpb24AQcCAAQuFARMAAAAUAAAAFQAAABYAAAAXAAAAGAAAABkAAAAaAAAAGwAAABwAAAAdAAAAHgAAAB8AAAAgAAAAIQAAACIAAAAjAAAAgERQADEAAAAyAAAAMwAAADQAAAA1AAAANgAAADcAAAA4AAAAOQAAADIAAAAzAAAANAAAADUAAAA2AAAANwAAADgAQfSCAQsCXEQAQbCDAQsQ/////////////////////w==";Zs(bi)||(bi=b(bi));function Fs(Je){try{if(Je==bi&&ue)return new Uint8Array(ue);var st=ia(Je);if(st)return st;if(T)return T(Je);throw"sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)"}catch(vt){Hi(vt)}}function $s(Je,st){var vt,ar,ee;try{ee=Fs(Je),ar=new WebAssembly.Module(ee),vt=new WebAssembly.Instance(ar,st)}catch(Ne){var ye=Ne.toString();throw te("failed to compile wasm module: "+ye),(ye.includes("imported Memory")||ye.includes("memory import"))&&te("Memory size incompatibility issues may be due to changing INITIAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set INITIAL_MEMORY at runtime to something smaller than it was at compile time)."),Ne}return[vt,ar]}function PA(){var Je={a:dc};function st(ee,ye){var Ne=ee.exports;r.asm=Ne,De=r.asm.g,z(De.buffer),$=r.asm.W,cn(r.asm.h),Xs("wasm-instantiate")}if($n("wasm-instantiate"),r.instantiateWasm)try{var vt=r.instantiateWasm(Je,st);return vt}catch(ee){return te("Module.instantiateWasm callback failed with error: "+ee),!1}var ar=$s(bi,Je);return st(ar[0]),r.asm}function gu(Je){return R.getFloat32(Je,!0)}function op(Je){return R.getFloat64(Je,!0)}function ap(Je){return R.getInt16(Je,!0)}function Rs(Je){return R.getInt32(Je,!0)}function Nn(Je,st){R.setInt32(Je,st,!0)}function hs(Je){for(;Je.length>0;){var st=Je.shift();if(typeof st=="function"){st(r);continue}var vt=st.func;typeof vt=="number"?st.arg===void 0?$.get(vt)():$.get(vt)(st.arg):vt(st.arg===void 0?null:st.arg)}}function Ts(Je,st){var vt=new Date(Rs((Je>>2)*4)*1e3);Nn((st>>2)*4,vt.getUTCSeconds()),Nn((st+4>>2)*4,vt.getUTCMinutes()),Nn((st+8>>2)*4,vt.getUTCHours()),Nn((st+12>>2)*4,vt.getUTCDate()),Nn((st+16>>2)*4,vt.getUTCMonth()),Nn((st+20>>2)*4,vt.getUTCFullYear()-1900),Nn((st+24>>2)*4,vt.getUTCDay()),Nn((st+36>>2)*4,0),Nn((st+32>>2)*4,0);var ar=Date.UTC(vt.getUTCFullYear(),0,1,0,0,0,0),ee=(vt.getTime()-ar)/(1e3*60*60*24)|0;return Nn((st+28>>2)*4,ee),Ts.GMTString||(Ts.GMTString=nt("GMT")),Nn((st+40>>2)*4,Ts.GMTString),st}function pc(Je,st){return Ts(Je,st)}function hc(Je,st,vt){xe.copyWithin(Je,st,st+vt)}function gc(Je){try{return De.grow(Je-ke.byteLength+65535>>>16),z(De.buffer),1}catch{}}function xA(Je){var st=xe.length;Je=Je>>>0;var vt=2147483648;if(Je>vt)return!1;for(var ar=1;ar<=4;ar*=2){var ee=st*(1+.2/ar);ee=Math.min(ee,Je+100663296);var ye=Math.min(vt,Te(Math.max(Je,ee),65536)),Ne=gc(ye);if(Ne)return!0}return!1}function bA(Je){ce(Je)}function Ro(Je){var st=Date.now()/1e3|0;return Je&&Nn((Je>>2)*4,st),st}function To(){if(To.called)return;To.called=!0;var Je=new Date().getFullYear(),st=new Date(Je,0,1),vt=new Date(Je,6,1),ar=st.getTimezoneOffset(),ee=vt.getTimezoneOffset(),ye=Math.max(ar,ee);Nn((ja()>>2)*4,ye*60),Nn((rs()>>2)*4,+(ar!=ee));function Ne(sn){var ei=sn.toTimeString().match(/\(([A-Za-z ]+)\)$/);return ei?ei[1]:"GMT"}var gt=Ne(st),mt=Ne(vt),Dt=nt(gt),er=nt(mt);ee>2)*4,Dt),Nn((Di()+4>>2)*4,er)):(Nn((Di()>>2)*4,er),Nn((Di()+4>>2)*4,Dt))}function kA(Je){To();var st=Date.UTC(Rs((Je+20>>2)*4)+1900,Rs((Je+16>>2)*4),Rs((Je+12>>2)*4),Rs((Je+8>>2)*4),Rs((Je+4>>2)*4),Rs((Je>>2)*4),0),vt=new Date(st);Nn((Je+24>>2)*4,vt.getUTCDay());var ar=Date.UTC(vt.getUTCFullYear(),0,1,0,0,0,0),ee=(vt.getTime()-ar)/(1e3*60*60*24)|0;return Nn((Je+28>>2)*4,ee),vt.getTime()/1e3|0}var pr=typeof atob=="function"?atob:function(Je){var st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",vt="",ar,ee,ye,Ne,gt,mt,Dt,er=0;Je=Je.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ne=st.indexOf(Je.charAt(er++)),gt=st.indexOf(Je.charAt(er++)),mt=st.indexOf(Je.charAt(er++)),Dt=st.indexOf(Je.charAt(er++)),ar=Ne<<2|gt>>4,ee=(gt&15)<<4|mt>>2,ye=(mt&3)<<6|Dt,vt=vt+String.fromCharCode(ar),mt!==64&&(vt=vt+String.fromCharCode(ee)),Dt!==64&&(vt=vt+String.fromCharCode(ye));while(er0||(Et(),yr>0))return;function st(){Dn||(Dn=!0,r.calledRun=!0,!Ee&&(qt(),o(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),nr()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),st()},1)):st()}if(r.run=Pl,r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return Pl(),e}}();typeof ub=="object"&&typeof MU=="object"?MU.exports=OU:typeof define=="function"&&define.amd?define([],function(){return OU}):typeof ub=="object"&&(ub.createModule=OU)});var Lf,wce,Bce,vce=It(()=>{Lf=["number","number"],wce=(Z=>(Z[Z.ZIP_ER_OK=0]="ZIP_ER_OK",Z[Z.ZIP_ER_MULTIDISK=1]="ZIP_ER_MULTIDISK",Z[Z.ZIP_ER_RENAME=2]="ZIP_ER_RENAME",Z[Z.ZIP_ER_CLOSE=3]="ZIP_ER_CLOSE",Z[Z.ZIP_ER_SEEK=4]="ZIP_ER_SEEK",Z[Z.ZIP_ER_READ=5]="ZIP_ER_READ",Z[Z.ZIP_ER_WRITE=6]="ZIP_ER_WRITE",Z[Z.ZIP_ER_CRC=7]="ZIP_ER_CRC",Z[Z.ZIP_ER_ZIPCLOSED=8]="ZIP_ER_ZIPCLOSED",Z[Z.ZIP_ER_NOENT=9]="ZIP_ER_NOENT",Z[Z.ZIP_ER_EXISTS=10]="ZIP_ER_EXISTS",Z[Z.ZIP_ER_OPEN=11]="ZIP_ER_OPEN",Z[Z.ZIP_ER_TMPOPEN=12]="ZIP_ER_TMPOPEN",Z[Z.ZIP_ER_ZLIB=13]="ZIP_ER_ZLIB",Z[Z.ZIP_ER_MEMORY=14]="ZIP_ER_MEMORY",Z[Z.ZIP_ER_CHANGED=15]="ZIP_ER_CHANGED",Z[Z.ZIP_ER_COMPNOTSUPP=16]="ZIP_ER_COMPNOTSUPP",Z[Z.ZIP_ER_EOF=17]="ZIP_ER_EOF",Z[Z.ZIP_ER_INVAL=18]="ZIP_ER_INVAL",Z[Z.ZIP_ER_NOZIP=19]="ZIP_ER_NOZIP",Z[Z.ZIP_ER_INTERNAL=20]="ZIP_ER_INTERNAL",Z[Z.ZIP_ER_INCONS=21]="ZIP_ER_INCONS",Z[Z.ZIP_ER_REMOVE=22]="ZIP_ER_REMOVE",Z[Z.ZIP_ER_DELETED=23]="ZIP_ER_DELETED",Z[Z.ZIP_ER_ENCRNOTSUPP=24]="ZIP_ER_ENCRNOTSUPP",Z[Z.ZIP_ER_RDONLY=25]="ZIP_ER_RDONLY",Z[Z.ZIP_ER_NOPASSWD=26]="ZIP_ER_NOPASSWD",Z[Z.ZIP_ER_WRONGPASSWD=27]="ZIP_ER_WRONGPASSWD",Z[Z.ZIP_ER_OPNOTSUPP=28]="ZIP_ER_OPNOTSUPP",Z[Z.ZIP_ER_INUSE=29]="ZIP_ER_INUSE",Z[Z.ZIP_ER_TELL=30]="ZIP_ER_TELL",Z[Z.ZIP_ER_COMPRESSED_DATA=31]="ZIP_ER_COMPRESSED_DATA",Z))(wce||{}),Bce=t=>({get HEAPU8(){return t.HEAPU8},errors:wce,SEEK_SET:0,SEEK_CUR:1,SEEK_END:2,ZIP_CHECKCONS:4,ZIP_EXCL:2,ZIP_RDONLY:16,ZIP_FL_OVERWRITE:8192,ZIP_FL_COMPRESSED:4,ZIP_OPSYS_DOS:0,ZIP_OPSYS_AMIGA:1,ZIP_OPSYS_OPENVMS:2,ZIP_OPSYS_UNIX:3,ZIP_OPSYS_VM_CMS:4,ZIP_OPSYS_ATARI_ST:5,ZIP_OPSYS_OS_2:6,ZIP_OPSYS_MACINTOSH:7,ZIP_OPSYS_Z_SYSTEM:8,ZIP_OPSYS_CPM:9,ZIP_OPSYS_WINDOWS_NTFS:10,ZIP_OPSYS_MVS:11,ZIP_OPSYS_VSE:12,ZIP_OPSYS_ACORN_RISC:13,ZIP_OPSYS_VFAT:14,ZIP_OPSYS_ALTERNATE_MVS:15,ZIP_OPSYS_BEOS:16,ZIP_OPSYS_TANDEM:17,ZIP_OPSYS_OS_400:18,ZIP_OPSYS_OS_X:19,ZIP_CM_DEFAULT:-1,ZIP_CM_STORE:0,ZIP_CM_DEFLATE:8,uint08S:t._malloc(1),uint32S:t._malloc(4),malloc:t._malloc,free:t._free,getValue:t.getValue,openFromSource:t.cwrap("zip_open_from_source","number",["number","number","number"]),close:t.cwrap("zip_close","number",["number"]),discard:t.cwrap("zip_discard",null,["number"]),getError:t.cwrap("zip_get_error","number",["number"]),getName:t.cwrap("zip_get_name","string",["number","number","number"]),getNumEntries:t.cwrap("zip_get_num_entries","number",["number","number"]),delete:t.cwrap("zip_delete","number",["number","number"]),statIndex:t.cwrap("zip_stat_index","number",["number",...Lf,"number","number"]),fopenIndex:t.cwrap("zip_fopen_index","number",["number",...Lf,"number"]),fread:t.cwrap("zip_fread","number",["number","number","number","number"]),fclose:t.cwrap("zip_fclose","number",["number"]),dir:{add:t.cwrap("zip_dir_add","number",["number","string"])},file:{add:t.cwrap("zip_file_add","number",["number","string","number","number"]),getError:t.cwrap("zip_file_get_error","number",["number"]),getExternalAttributes:t.cwrap("zip_file_get_external_attributes","number",["number",...Lf,"number","number","number"]),setExternalAttributes:t.cwrap("zip_file_set_external_attributes","number",["number",...Lf,"number","number","number"]),setMtime:t.cwrap("zip_file_set_mtime","number",["number",...Lf,"number","number"]),setCompression:t.cwrap("zip_set_file_compression","number",["number",...Lf,"number","number"])},ext:{countSymlinks:t.cwrap("zip_ext_count_symlinks","number",["number"])},error:{initWithCode:t.cwrap("zip_error_init_with_code",null,["number","number"]),strerror:t.cwrap("zip_error_strerror","string",["number"])},name:{locate:t.cwrap("zip_name_locate","number",["number","string","number"])},source:{fromUnattachedBuffer:t.cwrap("zip_source_buffer_create","number",["number",...Lf,"number","number"]),fromBuffer:t.cwrap("zip_source_buffer","number",["number","number",...Lf,"number"]),free:t.cwrap("zip_source_free",null,["number"]),keep:t.cwrap("zip_source_keep",null,["number"]),open:t.cwrap("zip_source_open","number",["number"]),close:t.cwrap("zip_source_close","number",["number"]),seek:t.cwrap("zip_source_seek","number",["number",...Lf,"number"]),tell:t.cwrap("zip_source_tell","number",["number"]),read:t.cwrap("zip_source_read","number",["number","number","number"]),error:t.cwrap("zip_source_error","number",["number"])},struct:{statS:t.cwrap("zipstruct_statS","number",[]),statSize:t.cwrap("zipstruct_stat_size","number",["number"]),statCompSize:t.cwrap("zipstruct_stat_comp_size","number",["number"]),statCompMethod:t.cwrap("zipstruct_stat_comp_method","number",["number"]),statMtime:t.cwrap("zipstruct_stat_mtime","number",["number"]),statCrc:t.cwrap("zipstruct_stat_crc","number",["number"]),errorS:t.cwrap("zipstruct_errorS","number",[]),errorCodeZip:t.cwrap("zipstruct_error_code_zip","number",["number"])}})});function UU(t,e){let r=t.indexOf(e);if(r<=0)return null;let o=r;for(;r>=0&&(o=r+e.length,t[o]!==V.sep);){if(t[r-1]===V.sep)return null;r=t.indexOf(e,o)}return t.length>o&&t[o]!==V.sep?null:t.slice(0,o)}var iA,Dce=It(()=>{St();St();sA();iA=class t extends Gp{static async openPromise(e,r){let o=new t(r);try{return await e(o)}finally{o.saveAndClose()}}constructor(e={}){let r=e.fileExtensions,o=e.readOnlyArchives,a=typeof r>"u"?A=>UU(A,".zip"):A=>{for(let p of r){let h=UU(A,p);if(h)return h}return null},n=(A,p)=>new Zi(p,{baseFs:A,readOnly:o,stats:A.statSync(p)}),u=async(A,p)=>{let h={baseFs:A,readOnly:o,stats:await A.statPromise(p)};return()=>new Zi(p,h)};super({...e,factorySync:n,factoryPromise:u,getMountPoint:a})}}});function tot(t){if(typeof t=="string"&&String(+t)===t)return+t;if(typeof t=="number"&&Number.isFinite(t))return t<0?Date.now()/1e3:t;if(Sce.types.isDate(t))return t.getTime()/1e3;throw new Error("Invalid time")}function Ab(){return Buffer.from([80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])}var ta,_U,Sce,HU,Pce,fb,Zi,qU=It(()=>{St();St();St();St();St();St();ta=ve("fs"),_U=ve("stream"),Sce=ve("util"),HU=et(ve("zlib"));NU();Pce="mixed";fb=class extends Error{constructor(e,r){super(e),this.name="Libzip Error",this.code=r}},Zi=class extends qu{constructor(r,o={}){super();this.listings=new Map;this.entries=new Map;this.fileSources=new Map;this.fds=new Map;this.nextFd=0;this.ready=!1;this.readOnly=!1;let a=o;if(this.level=typeof a.level<"u"?a.level:Pce,r??=Ab(),typeof r=="string"){let{baseFs:A=new _n}=a;this.baseFs=A,this.path=r}else this.path=null,this.baseFs=null;if(o.stats)this.stats=o.stats;else if(typeof r=="string")try{this.stats=this.baseFs.statSync(r)}catch(A){if(A.code==="ENOENT"&&a.create)this.stats=wa.makeDefaultStats();else throw A}else this.stats=wa.makeDefaultStats();this.libzip=V1();let n=this.libzip.malloc(4);try{let A=0;o.readOnly&&(A|=this.libzip.ZIP_RDONLY,this.readOnly=!0),typeof r=="string"&&(r=a.create?Ab():this.baseFs.readFileSync(r));let p=this.allocateUnattachedSource(r);try{this.zip=this.libzip.openFromSource(p,A,n),this.lzSource=p}catch(h){throw this.libzip.source.free(p),h}if(this.zip===0){let h=this.libzip.struct.errorS();throw this.libzip.error.initWithCode(h,this.libzip.getValue(n,"i32")),this.makeLibzipError(h)}}finally{this.libzip.free(n)}this.listings.set(Bt.root,new Set);let u=this.libzip.getNumEntries(this.zip,0);for(let A=0;Ar)throw new Error("Overread");let n=Buffer.from(this.libzip.HEAPU8.subarray(o,o+r));return process.env.YARN_IS_TEST_ENV&&process.env.YARN_ZIP_DATA_EPILOGUE&&(n=Buffer.concat([n,Buffer.from(process.env.YARN_ZIP_DATA_EPILOGUE)])),n}finally{this.libzip.free(o)}}finally{this.libzip.source.close(this.lzSource),this.libzip.source.free(this.lzSource),this.ready=!1}}discardAndClose(){this.prepareClose(),this.libzip.discard(this.zip),this.ready=!1}saveAndClose(){if(!this.path||!this.baseFs)throw new Error("ZipFS cannot be saved and must be discarded when loaded from a buffer");if(this.readOnly){this.discardAndClose();return}let r=this.baseFs.existsSync(this.path)||this.stats.mode===wa.DEFAULT_MODE?void 0:this.stats.mode;this.baseFs.writeFileSync(this.path,this.getBufferAndClose(),{mode:r}),this.ready=!1}resolve(r){return V.resolve(Bt.root,r)}async openPromise(r,o,a){return this.openSync(r,o,a)}openSync(r,o,a){let n=this.nextFd++;return this.fds.set(n,{cursor:0,p:r}),n}hasOpenFileHandles(){return!!this.fds.size}async opendirPromise(r,o){return this.opendirSync(r,o)}opendirSync(r,o={}){let a=this.resolveFilename(`opendir '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw sr.ENOENT(`opendir '${r}'`);let n=this.listings.get(a);if(!n)throw sr.ENOTDIR(`opendir '${r}'`);let u=[...n],A=this.openSync(a,"r");return eS(this,a,u,{onClose:()=>{this.closeSync(A)}})}async readPromise(r,o,a,n,u){return this.readSync(r,o,a,n,u)}readSync(r,o,a=0,n=o.byteLength,u=-1){let A=this.fds.get(r);if(typeof A>"u")throw sr.EBADF("read");let p=u===-1||u===null?A.cursor:u,h=this.readFileSync(A.p);h.copy(o,a,p,p+n);let E=Math.max(0,Math.min(h.length-p,n));return(u===-1||u===null)&&(A.cursor+=E),E}async writePromise(r,o,a,n,u){return typeof o=="string"?this.writeSync(r,o,u):this.writeSync(r,o,a,n,u)}writeSync(r,o,a,n,u){throw typeof this.fds.get(r)>"u"?sr.EBADF("read"):new Error("Unimplemented")}async closePromise(r){return this.closeSync(r)}closeSync(r){if(typeof this.fds.get(r)>"u")throw sr.EBADF("read");this.fds.delete(r)}createReadStream(r,{encoding:o}={}){if(r===null)throw new Error("Unimplemented");let a=this.openSync(r,"r"),n=Object.assign(new _U.PassThrough({emitClose:!0,autoDestroy:!0,destroy:(A,p)=>{clearImmediate(u),this.closeSync(a),p(A)}}),{close(){n.destroy()},bytesRead:0,path:r,pending:!1}),u=setImmediate(async()=>{try{let A=await this.readFilePromise(r,o);n.bytesRead=A.length,n.end(A)}catch(A){n.destroy(A)}});return n}createWriteStream(r,{encoding:o}={}){if(this.readOnly)throw sr.EROFS(`open '${r}'`);if(r===null)throw new Error("Unimplemented");let a=[],n=this.openSync(r,"w"),u=Object.assign(new _U.PassThrough({autoDestroy:!0,emitClose:!0,destroy:(A,p)=>{try{A?p(A):(this.writeFileSync(r,Buffer.concat(a),o),p(null))}catch(h){p(h)}finally{this.closeSync(n)}}}),{close(){u.destroy()},bytesWritten:0,path:r,pending:!1});return u.on("data",A=>{let p=Buffer.from(A);u.bytesWritten+=p.length,a.push(p)}),u}async realpathPromise(r){return this.realpathSync(r)}realpathSync(r){let o=this.resolveFilename(`lstat '${r}'`,r);if(!this.entries.has(o)&&!this.listings.has(o))throw sr.ENOENT(`lstat '${r}'`);return o}async existsPromise(r){return this.existsSync(r)}existsSync(r){if(!this.ready)throw sr.EBUSY(`archive closed, existsSync '${r}'`);if(this.symlinkCount===0){let a=V.resolve(Bt.root,r);return this.entries.has(a)||this.listings.has(a)}let o;try{o=this.resolveFilename(`stat '${r}'`,r,void 0,!1)}catch{return!1}return o===void 0?!1:this.entries.has(o)||this.listings.has(o)}async accessPromise(r,o){return this.accessSync(r,o)}accessSync(r,o=ta.constants.F_OK){let a=this.resolveFilename(`access '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw sr.ENOENT(`access '${r}'`);if(this.readOnly&&o&ta.constants.W_OK)throw sr.EROFS(`access '${r}'`)}async statPromise(r,o={bigint:!1}){return o.bigint?this.statSync(r,{bigint:!0}):this.statSync(r)}statSync(r,o={bigint:!1,throwIfNoEntry:!0}){let a=this.resolveFilename(`stat '${r}'`,r,void 0,o.throwIfNoEntry);if(a!==void 0){if(!this.entries.has(a)&&!this.listings.has(a)){if(o.throwIfNoEntry===!1)return;throw sr.ENOENT(`stat '${r}'`)}if(r[r.length-1]==="/"&&!this.listings.has(a))throw sr.ENOTDIR(`stat '${r}'`);return this.statImpl(`stat '${r}'`,a,o)}}async fstatPromise(r,o){return this.fstatSync(r,o)}fstatSync(r,o){let a=this.fds.get(r);if(typeof a>"u")throw sr.EBADF("fstatSync");let{p:n}=a,u=this.resolveFilename(`stat '${n}'`,n);if(!this.entries.has(u)&&!this.listings.has(u))throw sr.ENOENT(`stat '${n}'`);if(n[n.length-1]==="/"&&!this.listings.has(u))throw sr.ENOTDIR(`stat '${n}'`);return this.statImpl(`fstat '${n}'`,u,o)}async lstatPromise(r,o={bigint:!1}){return o.bigint?this.lstatSync(r,{bigint:!0}):this.lstatSync(r)}lstatSync(r,o={bigint:!1,throwIfNoEntry:!0}){let a=this.resolveFilename(`lstat '${r}'`,r,!1,o.throwIfNoEntry);if(a!==void 0){if(!this.entries.has(a)&&!this.listings.has(a)){if(o.throwIfNoEntry===!1)return;throw sr.ENOENT(`lstat '${r}'`)}if(r[r.length-1]==="/"&&!this.listings.has(a))throw sr.ENOTDIR(`lstat '${r}'`);return this.statImpl(`lstat '${r}'`,a,o)}}statImpl(r,o,a={}){let n=this.entries.get(o);if(typeof n<"u"){let u=this.libzip.struct.statS();if(this.libzip.statIndex(this.zip,n,0,0,u)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));let p=this.stats.uid,h=this.stats.gid,E=this.libzip.struct.statSize(u)>>>0,w=512,D=Math.ceil(E/w),b=(this.libzip.struct.statMtime(u)>>>0)*1e3,C=b,T=b,N=b,U=new Date(C),J=new Date(T),te=new Date(N),le=new Date(b),ce=this.listings.has(o)?ta.constants.S_IFDIR:this.isSymbolicLink(n)?ta.constants.S_IFLNK:ta.constants.S_IFREG,ue=ce===ta.constants.S_IFDIR?493:420,Ie=ce|this.getUnixMode(n,ue)&511,he=this.libzip.struct.statCrc(u),De=Object.assign(new wa.StatEntry,{uid:p,gid:h,size:E,blksize:w,blocks:D,atime:U,birthtime:J,ctime:te,mtime:le,atimeMs:C,birthtimeMs:T,ctimeMs:N,mtimeMs:b,mode:Ie,crc:he});return a.bigint===!0?wa.convertToBigIntStats(De):De}if(this.listings.has(o)){let u=this.stats.uid,A=this.stats.gid,p=0,h=512,E=0,w=this.stats.mtimeMs,D=this.stats.mtimeMs,b=this.stats.mtimeMs,C=this.stats.mtimeMs,T=new Date(w),N=new Date(D),U=new Date(b),J=new Date(C),te=ta.constants.S_IFDIR|493,ce=Object.assign(new wa.StatEntry,{uid:u,gid:A,size:p,blksize:h,blocks:E,atime:T,birthtime:N,ctime:U,mtime:J,atimeMs:w,birthtimeMs:D,ctimeMs:b,mtimeMs:C,mode:te,crc:0});return a.bigint===!0?wa.convertToBigIntStats(ce):ce}throw new Error("Unreachable")}getUnixMode(r,o){if(this.libzip.file.getExternalAttributes(this.zip,r,0,0,this.libzip.uint08S,this.libzip.uint32S)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0!==this.libzip.ZIP_OPSYS_UNIX?o:this.libzip.getValue(this.libzip.uint32S,"i32")>>>16}registerListing(r){let o=this.listings.get(r);if(o)return o;this.registerListing(V.dirname(r)).add(V.basename(r));let n=new Set;return this.listings.set(r,n),n}registerEntry(r,o){this.registerListing(V.dirname(r)).add(V.basename(r)),this.entries.set(r,o)}unregisterListing(r){this.listings.delete(r),this.listings.get(V.dirname(r))?.delete(V.basename(r))}unregisterEntry(r){this.unregisterListing(r);let o=this.entries.get(r);this.entries.delete(r),!(typeof o>"u")&&(this.fileSources.delete(o),this.isSymbolicLink(o)&&this.symlinkCount--)}deleteEntry(r,o){if(this.unregisterEntry(r),this.libzip.delete(this.zip,o)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}resolveFilename(r,o,a=!0,n=!0){if(!this.ready)throw sr.EBUSY(`archive closed, ${r}`);let u=V.resolve(Bt.root,o);if(u==="/")return Bt.root;let A=this.entries.get(u);if(a&&A!==void 0)if(this.symlinkCount!==0&&this.isSymbolicLink(A)){let p=this.getFileSource(A).toString();return this.resolveFilename(r,V.resolve(V.dirname(u),p),!0,n)}else return u;for(;;){let p=this.resolveFilename(r,V.dirname(u),!0,n);if(p===void 0)return p;let h=this.listings.has(p),E=this.entries.has(p);if(!h&&!E){if(n===!1)return;throw sr.ENOENT(r)}if(!h)throw sr.ENOTDIR(r);if(u=V.resolve(p,V.basename(u)),!a||this.symlinkCount===0)break;let w=this.libzip.name.locate(this.zip,u.slice(1),0);if(w===-1)break;if(this.isSymbolicLink(w)){let D=this.getFileSource(w).toString();u=V.resolve(V.dirname(u),D)}else break}return u}allocateBuffer(r){Buffer.isBuffer(r)||(r=Buffer.from(r));let o=this.libzip.malloc(r.byteLength);if(!o)throw new Error("Couldn't allocate enough memory");return new Uint8Array(this.libzip.HEAPU8.buffer,o,r.byteLength).set(r),{buffer:o,byteLength:r.byteLength}}allocateUnattachedSource(r){let o=this.libzip.struct.errorS(),{buffer:a,byteLength:n}=this.allocateBuffer(r),u=this.libzip.source.fromUnattachedBuffer(a,n,0,1,o);if(u===0)throw this.libzip.free(o),this.makeLibzipError(o);return u}allocateSource(r){let{buffer:o,byteLength:a}=this.allocateBuffer(r),n=this.libzip.source.fromBuffer(this.zip,o,a,0,1);if(n===0)throw this.libzip.free(o),this.makeLibzipError(this.libzip.getError(this.zip));return n}setFileSource(r,o){let a=Buffer.isBuffer(o)?o:Buffer.from(o),n=V.relative(Bt.root,r),u=this.allocateSource(o);try{let A=this.libzip.file.add(this.zip,n,u,this.libzip.ZIP_FL_OVERWRITE);if(A===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));if(this.level!=="mixed"){let p=this.level===0?this.libzip.ZIP_CM_STORE:this.libzip.ZIP_CM_DEFLATE;if(this.libzip.file.setCompression(this.zip,A,0,p,this.level)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}return this.fileSources.set(A,a),A}catch(A){throw this.libzip.source.free(u),A}}isSymbolicLink(r){if(this.symlinkCount===0)return!1;if(this.libzip.file.getExternalAttributes(this.zip,r,0,0,this.libzip.uint08S,this.libzip.uint32S)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0!==this.libzip.ZIP_OPSYS_UNIX?!1:(this.libzip.getValue(this.libzip.uint32S,"i32")>>>16&ta.constants.S_IFMT)===ta.constants.S_IFLNK}getFileSource(r,o={asyncDecompress:!1}){let a=this.fileSources.get(r);if(typeof a<"u")return a;let n=this.libzip.struct.statS();if(this.libzip.statIndex(this.zip,r,0,0,n)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));let A=this.libzip.struct.statCompSize(n),p=this.libzip.struct.statCompMethod(n),h=this.libzip.malloc(A);try{let E=this.libzip.fopenIndex(this.zip,r,0,this.libzip.ZIP_FL_COMPRESSED);if(E===0)throw this.makeLibzipError(this.libzip.getError(this.zip));try{let w=this.libzip.fread(E,h,A,0);if(w===-1)throw this.makeLibzipError(this.libzip.file.getError(E));if(wA)throw new Error("Overread");let D=this.libzip.HEAPU8.subarray(h,h+A),b=Buffer.from(D);if(p===0)return this.fileSources.set(r,b),b;if(o.asyncDecompress)return new Promise((C,T)=>{HU.default.inflateRaw(b,(N,U)=>{N?T(N):(this.fileSources.set(r,U),C(U))})});{let C=HU.default.inflateRawSync(b);return this.fileSources.set(r,C),C}}finally{this.libzip.fclose(E)}}finally{this.libzip.free(h)}}async fchmodPromise(r,o){return this.chmodPromise(this.fdToPath(r,"fchmod"),o)}fchmodSync(r,o){return this.chmodSync(this.fdToPath(r,"fchmodSync"),o)}async chmodPromise(r,o){return this.chmodSync(r,o)}chmodSync(r,o){if(this.readOnly)throw sr.EROFS(`chmod '${r}'`);o&=493;let a=this.resolveFilename(`chmod '${r}'`,r,!1),n=this.entries.get(a);if(typeof n>"u")throw new Error(`Assertion failed: The entry should have been registered (${a})`);let A=this.getUnixMode(n,ta.constants.S_IFREG|0)&-512|o;if(this.libzip.file.setExternalAttributes(this.zip,n,0,0,this.libzip.ZIP_OPSYS_UNIX,A<<16)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}async fchownPromise(r,o,a){return this.chownPromise(this.fdToPath(r,"fchown"),o,a)}fchownSync(r,o,a){return this.chownSync(this.fdToPath(r,"fchownSync"),o,a)}async chownPromise(r,o,a){return this.chownSync(r,o,a)}chownSync(r,o,a){throw new Error("Unimplemented")}async renamePromise(r,o){return this.renameSync(r,o)}renameSync(r,o){throw new Error("Unimplemented")}async copyFilePromise(r,o,a){let{indexSource:n,indexDest:u,resolvedDestP:A}=this.prepareCopyFile(r,o,a),p=await this.getFileSource(n,{asyncDecompress:!0}),h=this.setFileSource(A,p);h!==u&&this.registerEntry(A,h)}copyFileSync(r,o,a=0){let{indexSource:n,indexDest:u,resolvedDestP:A}=this.prepareCopyFile(r,o,a),p=this.getFileSource(n),h=this.setFileSource(A,p);h!==u&&this.registerEntry(A,h)}prepareCopyFile(r,o,a=0){if(this.readOnly)throw sr.EROFS(`copyfile '${r} -> '${o}'`);if(a&ta.constants.COPYFILE_FICLONE_FORCE)throw sr.ENOSYS("unsupported clone operation",`copyfile '${r}' -> ${o}'`);let n=this.resolveFilename(`copyfile '${r} -> ${o}'`,r),u=this.entries.get(n);if(typeof u>"u")throw sr.EINVAL(`copyfile '${r}' -> '${o}'`);let A=this.resolveFilename(`copyfile '${r}' -> ${o}'`,o),p=this.entries.get(A);if(a&(ta.constants.COPYFILE_EXCL|ta.constants.COPYFILE_FICLONE_FORCE)&&typeof p<"u")throw sr.EEXIST(`copyfile '${r}' -> '${o}'`);return{indexSource:u,resolvedDestP:A,indexDest:p}}async appendFilePromise(r,o,a){if(this.readOnly)throw sr.EROFS(`open '${r}'`);return typeof a>"u"?a={flag:"a"}:typeof a=="string"?a={flag:"a",encoding:a}:typeof a.flag>"u"&&(a={flag:"a",...a}),this.writeFilePromise(r,o,a)}appendFileSync(r,o,a={}){if(this.readOnly)throw sr.EROFS(`open '${r}'`);return typeof a>"u"?a={flag:"a"}:typeof a=="string"?a={flag:"a",encoding:a}:typeof a.flag>"u"&&(a={flag:"a",...a}),this.writeFileSync(r,o,a)}fdToPath(r,o){let a=this.fds.get(r)?.p;if(typeof a>"u")throw sr.EBADF(o);return a}async writeFilePromise(r,o,a){let{encoding:n,mode:u,index:A,resolvedP:p}=this.prepareWriteFile(r,a);A!==void 0&&typeof a=="object"&&a.flag&&a.flag.includes("a")&&(o=Buffer.concat([await this.getFileSource(A,{asyncDecompress:!0}),Buffer.from(o)])),n!==null&&(o=o.toString(n));let h=this.setFileSource(p,o);h!==A&&this.registerEntry(p,h),u!==null&&await this.chmodPromise(p,u)}writeFileSync(r,o,a){let{encoding:n,mode:u,index:A,resolvedP:p}=this.prepareWriteFile(r,a);A!==void 0&&typeof a=="object"&&a.flag&&a.flag.includes("a")&&(o=Buffer.concat([this.getFileSource(A),Buffer.from(o)])),n!==null&&(o=o.toString(n));let h=this.setFileSource(p,o);h!==A&&this.registerEntry(p,h),u!==null&&this.chmodSync(p,u)}prepareWriteFile(r,o){if(typeof r=="number"&&(r=this.fdToPath(r,"read")),this.readOnly)throw sr.EROFS(`open '${r}'`);let a=this.resolveFilename(`open '${r}'`,r);if(this.listings.has(a))throw sr.EISDIR(`open '${r}'`);let n=null,u=null;typeof o=="string"?n=o:typeof o=="object"&&({encoding:n=null,mode:u=null}=o);let A=this.entries.get(a);return{encoding:n,mode:u,resolvedP:a,index:A}}async unlinkPromise(r){return this.unlinkSync(r)}unlinkSync(r){if(this.readOnly)throw sr.EROFS(`unlink '${r}'`);let o=this.resolveFilename(`unlink '${r}'`,r);if(this.listings.has(o))throw sr.EISDIR(`unlink '${r}'`);let a=this.entries.get(o);if(typeof a>"u")throw sr.EINVAL(`unlink '${r}'`);this.deleteEntry(o,a)}async utimesPromise(r,o,a){return this.utimesSync(r,o,a)}utimesSync(r,o,a){if(this.readOnly)throw sr.EROFS(`utimes '${r}'`);let n=this.resolveFilename(`utimes '${r}'`,r);this.utimesImpl(n,a)}async lutimesPromise(r,o,a){return this.lutimesSync(r,o,a)}lutimesSync(r,o,a){if(this.readOnly)throw sr.EROFS(`lutimes '${r}'`);let n=this.resolveFilename(`utimes '${r}'`,r,!1);this.utimesImpl(n,a)}utimesImpl(r,o){this.listings.has(r)&&(this.entries.has(r)||this.hydrateDirectory(r));let a=this.entries.get(r);if(a===void 0)throw new Error("Unreachable");if(this.libzip.file.setMtime(this.zip,a,0,tot(o),0)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}async mkdirPromise(r,o){return this.mkdirSync(r,o)}mkdirSync(r,{mode:o=493,recursive:a=!1}={}){if(a)return this.mkdirpSync(r,{chmod:o});if(this.readOnly)throw sr.EROFS(`mkdir '${r}'`);let n=this.resolveFilename(`mkdir '${r}'`,r);if(this.entries.has(n)||this.listings.has(n))throw sr.EEXIST(`mkdir '${r}'`);this.hydrateDirectory(n),this.chmodSync(n,o)}async rmdirPromise(r,o){return this.rmdirSync(r,o)}rmdirSync(r,{recursive:o=!1}={}){if(this.readOnly)throw sr.EROFS(`rmdir '${r}'`);if(o){this.removeSync(r);return}let a=this.resolveFilename(`rmdir '${r}'`,r),n=this.listings.get(a);if(!n)throw sr.ENOTDIR(`rmdir '${r}'`);if(n.size>0)throw sr.ENOTEMPTY(`rmdir '${r}'`);let u=this.entries.get(a);if(typeof u>"u")throw sr.EINVAL(`rmdir '${r}'`);this.deleteEntry(r,u)}async rmPromise(r,o){return this.rmSync(r,o)}rmSync(r,{recursive:o=!1}={}){if(this.readOnly)throw sr.EROFS(`rm '${r}'`);if(o){this.removeSync(r);return}let a=this.resolveFilename(`rm '${r}'`,r),n=this.listings.get(a);if(!n)throw sr.ENOTDIR(`rm '${r}'`);if(n.size>0)throw sr.ENOTEMPTY(`rm '${r}'`);let u=this.entries.get(a);if(typeof u>"u")throw sr.EINVAL(`rm '${r}'`);this.deleteEntry(r,u)}hydrateDirectory(r){let o=this.libzip.dir.add(this.zip,V.relative(Bt.root,r));if(o===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.registerListing(r),this.registerEntry(r,o),o}async linkPromise(r,o){return this.linkSync(r,o)}linkSync(r,o){throw sr.EOPNOTSUPP(`link '${r}' -> '${o}'`)}async symlinkPromise(r,o){return this.symlinkSync(r,o)}symlinkSync(r,o){if(this.readOnly)throw sr.EROFS(`symlink '${r}' -> '${o}'`);let a=this.resolveFilename(`symlink '${r}' -> '${o}'`,o);if(this.listings.has(a))throw sr.EISDIR(`symlink '${r}' -> '${o}'`);if(this.entries.has(a))throw sr.EEXIST(`symlink '${r}' -> '${o}'`);let n=this.setFileSource(a,r);if(this.registerEntry(a,n),this.libzip.file.setExternalAttributes(this.zip,n,0,0,this.libzip.ZIP_OPSYS_UNIX,(ta.constants.S_IFLNK|511)<<16)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));this.symlinkCount+=1}async readFilePromise(r,o){typeof o=="object"&&(o=o?o.encoding:void 0);let a=await this.readFileBuffer(r,{asyncDecompress:!0});return o?a.toString(o):a}readFileSync(r,o){typeof o=="object"&&(o=o?o.encoding:void 0);let a=this.readFileBuffer(r);return o?a.toString(o):a}readFileBuffer(r,o={asyncDecompress:!1}){typeof r=="number"&&(r=this.fdToPath(r,"read"));let a=this.resolveFilename(`open '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw sr.ENOENT(`open '${r}'`);if(r[r.length-1]==="/"&&!this.listings.has(a))throw sr.ENOTDIR(`open '${r}'`);if(this.listings.has(a))throw sr.EISDIR("read");let n=this.entries.get(a);if(n===void 0)throw new Error("Unreachable");return this.getFileSource(n,o)}async readdirPromise(r,o){return this.readdirSync(r,o)}readdirSync(r,o){let a=this.resolveFilename(`scandir '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw sr.ENOENT(`scandir '${r}'`);let n=this.listings.get(a);if(!n)throw sr.ENOTDIR(`scandir '${r}'`);if(o?.recursive)if(o?.withFileTypes){let u=Array.from(n,A=>Object.assign(this.statImpl("lstat",V.join(r,A)),{name:A,path:Bt.dot}));for(let A of u){if(!A.isDirectory())continue;let p=V.join(A.path,A.name),h=this.listings.get(V.join(a,p));for(let E of h)u.push(Object.assign(this.statImpl("lstat",V.join(r,p,E)),{name:E,path:p}))}return u}else{let u=[...n];for(let A of u){let p=this.listings.get(V.join(a,A));if(!(typeof p>"u"))for(let h of p)u.push(V.join(A,h))}return u}else return o?.withFileTypes?Array.from(n,u=>Object.assign(this.statImpl("lstat",V.join(r,u)),{name:u,path:void 0})):[...n]}async readlinkPromise(r){let o=this.prepareReadlink(r);return(await this.getFileSource(o,{asyncDecompress:!0})).toString()}readlinkSync(r){let o=this.prepareReadlink(r);return this.getFileSource(o).toString()}prepareReadlink(r){let o=this.resolveFilename(`readlink '${r}'`,r,!1);if(!this.entries.has(o)&&!this.listings.has(o))throw sr.ENOENT(`readlink '${r}'`);if(r[r.length-1]==="/"&&!this.listings.has(o))throw sr.ENOTDIR(`open '${r}'`);if(this.listings.has(o))throw sr.EINVAL(`readlink '${r}'`);let a=this.entries.get(o);if(a===void 0)throw new Error("Unreachable");if(!this.isSymbolicLink(a))throw sr.EINVAL(`readlink '${r}'`);return a}async truncatePromise(r,o=0){let a=this.resolveFilename(`open '${r}'`,r),n=this.entries.get(a);if(typeof n>"u")throw sr.EINVAL(`open '${r}'`);let u=await this.getFileSource(n,{asyncDecompress:!0}),A=Buffer.alloc(o,0);return u.copy(A),await this.writeFilePromise(r,A)}truncateSync(r,o=0){let a=this.resolveFilename(`open '${r}'`,r),n=this.entries.get(a);if(typeof n>"u")throw sr.EINVAL(`open '${r}'`);let u=this.getFileSource(n),A=Buffer.alloc(o,0);return u.copy(A),this.writeFileSync(r,A)}async ftruncatePromise(r,o){return this.truncatePromise(this.fdToPath(r,"ftruncate"),o)}ftruncateSync(r,o){return this.truncateSync(this.fdToPath(r,"ftruncateSync"),o)}watch(r,o,a){let n;switch(typeof o){case"function":case"string":case"undefined":n=!0;break;default:({persistent:n=!0}=o);break}if(!n)return{on:()=>{},close:()=>{}};let u=setInterval(()=>{},24*60*60*1e3);return{on:()=>{},close:()=>{clearInterval(u)}}}watchFile(r,o,a){let n=V.resolve(Bt.root,r);return um(this,n,o,a)}unwatchFile(r,o){let a=V.resolve(Bt.root,r);return q0(this,a,o)}}});function bce(t,e,r=Buffer.alloc(0),o){let a=new Zi(r),n=w=>w===e||w.startsWith(`${e}/`)?w.slice(0,e.length):null,u=async(w,D)=>()=>a,A=(w,D)=>a,p={...t},h=new _n(p),E=new Gp({baseFs:h,getMountPoint:n,factoryPromise:u,factorySync:A,magicByte:21,maxAge:1/0,typeCheck:o?.typeCheck});return uw(xce.default,new Wp(E)),a}var xce,kce=It(()=>{St();xce=et(ve("fs"));qU()});var Qce=It(()=>{Dce();qU();kce()});var K1={};Vt(K1,{DEFAULT_COMPRESSION_LEVEL:()=>Pce,LibzipError:()=>fb,ZipFS:()=>Zi,ZipOpenFS:()=>iA,getArchivePart:()=>UU,getLibzipPromise:()=>not,getLibzipSync:()=>rot,makeEmptyArchive:()=>Ab,mountMemoryDrive:()=>bce});function rot(){return V1()}async function not(){return V1()}var Fce,sA=It(()=>{NU();Fce=et(Ice());vce();Qce();Cce(()=>{let t=(0,Fce.default)();return Bce(t)})});var J1,Rce=It(()=>{St();Gt();z1();J1=class extends ot{constructor(){super(...arguments);this.cwd=de.String("--cwd",process.cwd(),{description:"The directory to run the command in"});this.commandName=de.String();this.args=de.Proxy()}static{this.usage={description:"run a command using yarn's portable shell",details:` - This command will run a command using Yarn's portable shell. - - Make sure to escape glob patterns, redirections, and other features that might be expanded by your own shell. - - Note: To escape something from Yarn's shell, you might have to escape it twice, the first time from your own shell. - - Note: Don't use this command in Yarn scripts, as Yarn's shell is automatically used. - - For a list of features, visit: https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-shell/README.md. - `,examples:[["Run a simple command","$0 echo Hello"],["Run a command with a glob pattern","$0 echo '*.js'"],["Run a command with a redirection","$0 echo Hello World '>' hello.txt"],["Run a command with an escaped glob pattern (The double escape is needed in Unix shells)",`$0 echo '"*.js"'`],["Run a command with a variable (Double quotes are needed in Unix shells, to prevent them from expanding the variable)",'$0 "GREETING=Hello echo $GREETING World"']]}}async execute(){let r=this.args.length>0?`${this.commandName} ${this.args.join(" ")}`:this.commandName;return await ky(r,[],{cwd:Ae.toPortablePath(this.cwd),stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}}});var fl,Tce=It(()=>{fl=class extends Error{constructor(e){super(e),this.name="ShellError"}}});var gb={};Vt(gb,{fastGlobOptions:()=>Oce,isBraceExpansion:()=>jU,isGlobPattern:()=>iot,match:()=>sot,micromatchOptions:()=>hb});function iot(t){if(!pb.default.scan(t,hb).isGlob)return!1;try{pb.default.parse(t,hb)}catch{return!1}return!0}function sot(t,{cwd:e,baseFs:r}){return(0,Lce.default)(t,{...Oce,cwd:Ae.fromPortablePath(e),fs:aS(Nce.default,new Wp(r))})}function jU(t){return pb.default.scan(t,hb).isBrace}var Lce,Nce,pb,hb,Oce,Mce=It(()=>{St();Lce=et(ux()),Nce=et(ve("fs")),pb=et(Xo()),hb={strictBrackets:!0},Oce={onlyDirectories:!1,onlyFiles:!1}});function GU(){}function WU(){for(let t of Fg)t.kill()}function qce(t,e,r,o){return a=>{let n=a[0]instanceof oA.Transform?"pipe":a[0],u=a[1]instanceof oA.Transform?"pipe":a[1],A=a[2]instanceof oA.Transform?"pipe":a[2],p=(0,_ce.default)(t,e,{...o,stdio:[n,u,A]});return Fg.add(p),Fg.size===1&&(process.on("SIGINT",GU),process.on("SIGTERM",WU)),a[0]instanceof oA.Transform&&a[0].pipe(p.stdin),a[1]instanceof oA.Transform&&p.stdout.pipe(a[1],{end:!1}),a[2]instanceof oA.Transform&&p.stderr.pipe(a[2],{end:!1}),{stdin:p.stdin,promise:new Promise(h=>{p.on("error",E=>{switch(Fg.delete(p),Fg.size===0&&(process.off("SIGINT",GU),process.off("SIGTERM",WU)),E.code){case"ENOENT":a[2].write(`command not found: ${t} -`),h(127);break;case"EACCES":a[2].write(`permission denied: ${t} -`),h(128);break;default:a[2].write(`uncaught error: ${E.message} -`),h(1);break}}),p.on("close",E=>{Fg.delete(p),Fg.size===0&&(process.off("SIGINT",GU),process.off("SIGTERM",WU)),h(E!==null?E:129)})})}}}function jce(t){return e=>{let r=e[0]==="pipe"?new oA.PassThrough:e[0];return{stdin:r,promise:Promise.resolve().then(()=>t({stdin:r,stdout:e[1],stderr:e[2]}))}}}function db(t,e){return VU.start(t,e)}function Uce(t,e=null){let r=new oA.PassThrough,o=new Hce.StringDecoder,a="";return r.on("data",n=>{let u=o.write(n),A;do if(A=u.indexOf(` -`),A!==-1){let p=a+u.substring(0,A);u=u.substring(A+1),a="",t(e!==null?`${e} ${p}`:p)}while(A!==-1);a+=u}),r.on("end",()=>{let n=o.end();n!==""&&t(e!==null?`${e} ${n}`:n)}),r}function Gce(t,{prefix:e}){return{stdout:Uce(r=>t.stdout.write(`${r} -`),t.stdout.isTTY?e:null),stderr:Uce(r=>t.stderr.write(`${r} -`),t.stderr.isTTY?e:null)}}var _ce,oA,Hce,Fg,Zl,YU,VU,KU=It(()=>{_ce=et(MT()),oA=ve("stream"),Hce=ve("string_decoder"),Fg=new Set;Zl=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},YU=class{constructor(){this.stream=null}close(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");this.stream.end()}attach(e){this.stream=e}get(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");return this.stream}},VU=class t{constructor(e,r){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=r}static start(e,{stdin:r,stdout:o,stderr:a}){let n=new t(null,e);return n.stdin=r,n.stdout=o,n.stderr=a,n}pipeTo(e,r=1){let o=new t(this,e),a=new YU;return o.pipe=a,o.stdout=this.stdout,o.stderr=this.stderr,(r&1)===1?this.stdout=a:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(r&2)===2?this.stderr=a:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),o}async exec(){let e=["ignore","ignore","ignore"];if(this.pipe)e[0]="pipe";else{if(this.stdin===null)throw new Error("Assertion failed: No input stream registered");e[0]=this.stdin.get()}let r;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");r=this.stdout,e[1]=r.get();let o;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");o=this.stderr,e[2]=o.get();let a=this.implementation(e);return this.pipe&&this.pipe.attach(a.stdin),await a.promise.then(n=>(r.close(),o.close(),n))}async run(){let e=[];for(let o=this;o;o=o.ancestor)e.push(o.exec());return(await Promise.all(e))[0]}}});var e2={};Vt(e2,{EntryCommand:()=>J1,ShellError:()=>fl,execute:()=>ky,globUtils:()=>gb});function Wce(t,e,r){let o=new pl.PassThrough({autoDestroy:!0});switch(t){case 0:(e&1)===1&&r.stdin.pipe(o,{end:!1}),(e&2)===2&&r.stdin instanceof pl.Writable&&o.pipe(r.stdin,{end:!1});break;case 1:(e&1)===1&&r.stdout.pipe(o,{end:!1}),(e&2)===2&&o.pipe(r.stdout,{end:!1});break;case 2:(e&1)===1&&r.stderr.pipe(o,{end:!1}),(e&2)===2&&o.pipe(r.stderr,{end:!1});break;default:throw new fl(`Bad file descriptor: "${t}"`)}return o}function yb(t,e={}){let r={...t,...e};return r.environment={...t.environment,...e.environment},r.variables={...t.variables,...e.variables},r}async function aot(t,e,r){let o=[],a=new pl.PassThrough;return a.on("data",n=>o.push(n)),await Eb(t,e,yb(r,{stdout:a})),Buffer.concat(o).toString().replace(/[\r\n]+$/,"")}async function Yce(t,e,r){let o=t.map(async n=>{let u=await Rg(n.args,e,r);return{name:n.name,value:u.join(" ")}});return(await Promise.all(o)).reduce((n,u)=>(n[u.name]=u.value,n),{})}function mb(t){return t.match(/[^ \r\n\t]+/g)||[]}async function Zce(t,e,r,o,a=o){switch(t.name){case"$":o(String(process.pid));break;case"#":o(String(e.args.length));break;case"@":if(t.quoted)for(let n of e.args)a(n);else for(let n of e.args){let u=mb(n);for(let A=0;A=0&&n"u"&&(t.defaultValue?u=(await Rg(t.defaultValue,e,r)).join(" "):t.alternativeValue&&(u="")),typeof u>"u")throw A?new fl(`Unbound argument #${n}`):new fl(`Unbound variable "${t.name}"`);if(t.quoted)o(u);else{let p=mb(u);for(let E=0;Eo.push(n));let a=Number(o.join(" "));return Number.isNaN(a)?X1({type:"variable",name:o.join(" ")},e,r):X1({type:"number",value:a},e,r)}else return lot[t.type](await X1(t.left,e,r),await X1(t.right,e,r))}async function Rg(t,e,r){let o=new Map,a=[],n=[],u=E=>{n.push(E)},A=()=>{n.length>0&&a.push(n.join("")),n=[]},p=E=>{u(E),A()},h=(E,w,D)=>{let b=JSON.stringify({type:E,fd:w}),C=o.get(b);typeof C>"u"&&o.set(b,C=[]),C.push(D)};for(let E of t){let w=!1;switch(E.type){case"redirection":{let D=await Rg(E.args,e,r);for(let b of D)h(E.subtype,E.fd,b)}break;case"argument":for(let D of E.segments)switch(D.type){case"text":u(D.text);break;case"glob":u(D.pattern),w=!0;break;case"shell":{let b=await aot(D.shell,e,r);if(D.quoted)u(b);else{let C=mb(b);for(let T=0;T"u")throw new Error("Assertion failed: Expected a glob pattern to have been set");let b=await e.glob.match(D,{cwd:r.cwd,baseFs:e.baseFs});if(b.length===0){let C=jU(D)?". Note: Brace expansion of arbitrary strings isn't currently supported. For more details, please read this issue: https://github.com/yarnpkg/berry/issues/22":"";throw new fl(`No matches found: "${D}"${C}`)}for(let C of b.sort())p(C)}}if(o.size>0){let E=[];for(let[w,D]of o.entries())E.splice(E.length,0,w,String(D.length),...D);a.splice(0,0,"__ysh_set_redirects",...E,"--")}return a}function Z1(t,e,r){e.builtins.has(t[0])||(t=["command",...t]);let o=Ae.fromPortablePath(r.cwd),a=r.environment;typeof a.PWD<"u"&&(a={...a,PWD:o});let[n,...u]=t;if(n==="command")return qce(u[0],u.slice(1),e,{cwd:o,env:a});let A=e.builtins.get(n);if(typeof A>"u")throw new Error(`Assertion failed: A builtin should exist for "${n}"`);return jce(async({stdin:p,stdout:h,stderr:E})=>{let{stdin:w,stdout:D,stderr:b}=r;r.stdin=p,r.stdout=h,r.stderr=E;try{return await A(u,e,r)}finally{r.stdin=w,r.stdout=D,r.stderr=b}})}function cot(t,e,r){return o=>{let a=new pl.PassThrough,n=Eb(t,e,yb(r,{stdin:a}));return{stdin:a,promise:n}}}function uot(t,e,r){return o=>{let a=new pl.PassThrough,n=Eb(t,e,r);return{stdin:a,promise:n}}}function Vce(t,e,r,o){if(e.length===0)return t;{let a;do a=String(Math.random());while(Object.hasOwn(o.procedures,a));return o.procedures={...o.procedures},o.procedures[a]=t,Z1([...e,"__ysh_run_procedure",a],r,o)}}async function Kce(t,e,r){let o=t,a=null,n=null;for(;o;){let u=o.then?{...r}:r,A;switch(o.type){case"command":{let p=await Rg(o.args,e,r),h=await Yce(o.envs,e,r);A=o.envs.length?Z1(p,e,yb(u,{environment:h})):Z1(p,e,u)}break;case"subshell":{let p=await Rg(o.args,e,r),h=cot(o.subshell,e,u);A=Vce(h,p,e,u)}break;case"group":{let p=await Rg(o.args,e,r),h=uot(o.group,e,u);A=Vce(h,p,e,u)}break;case"envs":{let p=await Yce(o.envs,e,r);u.environment={...u.environment,...p},A=Z1(["true"],e,u)}break}if(typeof A>"u")throw new Error("Assertion failed: An action should have been generated");if(a===null)n=db(A,{stdin:new Zl(u.stdin),stdout:new Zl(u.stdout),stderr:new Zl(u.stderr)});else{if(n===null)throw new Error("Assertion failed: The execution pipeline should have been setup");switch(a){case"|":n=n.pipeTo(A,1);break;case"|&":n=n.pipeTo(A,3);break}}o.then?(a=o.then.type,o=o.then.chain):o=null}if(n===null)throw new Error("Assertion failed: The execution pipeline should have been setup");return await n.run()}async function Aot(t,e,r,{background:o=!1}={}){function a(n){let u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],A=u[n%u.length];return Jce.default.hex(A)}if(o){let n=r.nextBackgroundJobIndex++,u=a(n),A=`[${n}]`,p=u(A),{stdout:h,stderr:E}=Gce(r,{prefix:p});return r.backgroundJobs.push(Kce(t,e,yb(r,{stdout:h,stderr:E})).catch(w=>E.write(`${w.message} -`)).finally(()=>{r.stdout.isTTY&&r.stdout.write(`Job ${p}, '${u(mm(t))}' has ended -`)})),0}return await Kce(t,e,r)}async function fot(t,e,r,{background:o=!1}={}){let a,n=A=>{a=A,r.variables["?"]=String(A)},u=async A=>{try{return await Aot(A.chain,e,r,{background:o&&typeof A.then>"u"})}catch(p){if(!(p instanceof fl))throw p;return r.stderr.write(`${p.message} -`),1}};for(n(await u(t));t.then;){if(r.exitCode!==null)return r.exitCode;switch(t.then.type){case"&&":a===0&&n(await u(t.then.line));break;case"||":a!==0&&n(await u(t.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${t.then.type}"`)}t=t.then.line}return a}async function Eb(t,e,r){let o=r.backgroundJobs;r.backgroundJobs=[];let a=0;for(let{command:n,type:u}of t){if(a=await fot(n,e,r,{background:u==="&"}),r.exitCode!==null)return r.exitCode;r.variables["?"]=String(a)}return await Promise.all(r.backgroundJobs),r.backgroundJobs=o,a}function $ce(t){switch(t.type){case"variable":return t.name==="@"||t.name==="#"||t.name==="*"||Number.isFinite(parseInt(t.name,10))||"defaultValue"in t&&!!t.defaultValue&&t.defaultValue.some(e=>$1(e))||"alternativeValue"in t&&!!t.alternativeValue&&t.alternativeValue.some(e=>$1(e));case"arithmetic":return JU(t.arithmetic);case"shell":return zU(t.shell);default:return!1}}function $1(t){switch(t.type){case"redirection":return t.args.some(e=>$1(e));case"argument":return t.segments.some(e=>$ce(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${t.type}"`)}}function JU(t){switch(t.type){case"variable":return $ce(t);case"number":return!1;default:return JU(t.left)||JU(t.right)}}function zU(t){return t.some(({command:e})=>{for(;e;){let r=e.chain;for(;r;){let o;switch(r.type){case"subshell":o=zU(r.subshell);break;case"command":o=r.envs.some(a=>a.args.some(n=>$1(n)))||r.args.some(a=>$1(a));break}if(o)return!0;if(!r.then)break;r=r.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function ky(t,e=[],{baseFs:r=new _n,builtins:o={},cwd:a=Ae.toPortablePath(process.cwd()),env:n=process.env,stdin:u=process.stdin,stdout:A=process.stdout,stderr:p=process.stderr,variables:h={},glob:E=gb}={}){let w={};for(let[C,T]of Object.entries(n))typeof T<"u"&&(w[C]=T);let D=new Map(oot);for(let[C,T]of Object.entries(o))D.set(C,T);u===null&&(u=new pl.PassThrough,u.end());let b=uS(t,E);if(!zU(b)&&b.length>0&&e.length>0){let{command:C}=b[b.length-1];for(;C.then;)C=C.then.line;let T=C.chain;for(;T.then;)T=T.then.chain;T.type==="command"&&(T.args=T.args.concat(e.map(N=>({type:"argument",segments:[{type:"text",text:N}]}))))}return await Eb(b,{args:e,baseFs:r,builtins:D,initialStdin:u,initialStdout:A,initialStderr:p,glob:E},{cwd:a,environment:w,exitCode:null,procedures:{},stdin:u,stdout:A,stderr:p,variables:Object.assign({},h,{"?":0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var Jce,zce,pl,Xce,oot,lot,z1=It(()=>{St();Ol();Jce=et(sN()),zce=ve("os"),pl=ve("stream"),Xce=ve("timers/promises");Rce();Tce();Mce();KU();KU();oot=new Map([["cd",async([t=(0,zce.homedir)(),...e],r,o)=>{let a=V.resolve(o.cwd,Ae.toPortablePath(t));if(!(await r.baseFs.statPromise(a).catch(u=>{throw u.code==="ENOENT"?new fl(`cd: no such file or directory: ${t}`):u})).isDirectory())throw new fl(`cd: not a directory: ${t}`);return o.cwd=a,0}],["pwd",async(t,e,r)=>(r.stdout.write(`${Ae.fromPortablePath(r.cwd)} -`),0)],[":",async(t,e,r)=>0],["true",async(t,e,r)=>0],["false",async(t,e,r)=>1],["exit",async([t,...e],r,o)=>o.exitCode=parseInt(t??o.variables["?"],10)],["echo",async(t,e,r)=>(r.stdout.write(`${t.join(" ")} -`),0)],["sleep",async([t],e,r)=>{if(typeof t>"u")throw new fl("sleep: missing operand");let o=Number(t);if(Number.isNaN(o))throw new fl(`sleep: invalid time interval '${t}'`);return await(0,Xce.setTimeout)(1e3*o,0)}],["unset",async(t,e,r)=>{for(let o of t)delete r.environment[o],delete r.variables[o];return 0}],["__ysh_run_procedure",async(t,e,r)=>{let o=r.procedures[t[0]];return await db(o,{stdin:new Zl(r.stdin),stdout:new Zl(r.stdout),stderr:new Zl(r.stderr)}).run()}],["__ysh_set_redirects",async(t,e,r)=>{let o=r.stdin,a=r.stdout,n=r.stderr,u=[],A=[],p=[],h=0;for(;t[h]!=="--";){let w=t[h++],{type:D,fd:b}=JSON.parse(w),C=J=>{switch(b){case null:case 0:u.push(J);break;default:throw new Error(`Unsupported file descriptor: "${b}"`)}},T=J=>{switch(b){case null:case 1:A.push(J);break;case 2:p.push(J);break;default:throw new Error(`Unsupported file descriptor: "${b}"`)}},N=Number(t[h++]),U=h+N;for(let J=h;Je.baseFs.createReadStream(V.resolve(r.cwd,Ae.toPortablePath(t[J]))));break;case"<<<":C(()=>{let te=new pl.PassThrough;return process.nextTick(()=>{te.write(`${t[J]} -`),te.end()}),te});break;case"<&":C(()=>Wce(Number(t[J]),1,r));break;case">":case">>":{let te=V.resolve(r.cwd,Ae.toPortablePath(t[J]));T(te==="/dev/null"?new pl.Writable({autoDestroy:!0,emitClose:!0,write(le,ce,ue){setImmediate(ue)}}):e.baseFs.createWriteStream(te,D===">>"?{flags:"a"}:void 0))}break;case">&":T(Wce(Number(t[J]),2,r));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${D}"`)}}if(u.length>0){let w=new pl.PassThrough;o=w;let D=b=>{if(b===u.length)w.end();else{let C=u[b]();C.pipe(w,{end:!1}),C.on("end",()=>{D(b+1)})}};D(0)}if(A.length>0){let w=new pl.PassThrough;a=w;for(let D of A)w.pipe(D)}if(p.length>0){let w=new pl.PassThrough;n=w;for(let D of p)w.pipe(D)}let E=await db(Z1(t.slice(h+1),e,r),{stdin:new Zl(o),stdout:new Zl(a),stderr:new Zl(n)}).run();return await Promise.all(A.map(w=>new Promise((D,b)=>{w.on("error",C=>{b(C)}),w.on("close",()=>{D()}),w.end()}))),await Promise.all(p.map(w=>new Promise((D,b)=>{w.on("error",C=>{b(C)}),w.on("close",()=>{D()}),w.end()}))),E}]]);lot={addition:(t,e)=>t+e,subtraction:(t,e)=>t-e,multiplication:(t,e)=>t*e,division:(t,e)=>Math.trunc(t/e)}});var Cb=_((MMt,eue)=>{function pot(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r{var tue=dg(),hot=Cb(),got=jl(),dot=fy(),mot=1/0,rue=tue?tue.prototype:void 0,nue=rue?rue.toString:void 0;function iue(t){if(typeof t=="string")return t;if(got(t))return hot(t,iue)+"";if(dot(t))return nue?nue.call(t):"";var e=t+"";return e=="0"&&1/t==-mot?"-0":e}sue.exports=iue});var t2=_((_Mt,aue)=>{var yot=oue();function Eot(t){return t==null?"":yot(t)}aue.exports=Eot});var XU=_((HMt,lue)=>{function Cot(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++o{var Iot=XU();function wot(t,e,r){var o=t.length;return r=r===void 0?o:r,!e&&r>=o?t:Iot(t,e,r)}cue.exports=wot});var ZU=_((jMt,Aue)=>{var Bot="\\ud800-\\udfff",vot="\\u0300-\\u036f",Dot="\\ufe20-\\ufe2f",Sot="\\u20d0-\\u20ff",Pot=vot+Dot+Sot,xot="\\ufe0e\\ufe0f",bot="\\u200d",kot=RegExp("["+bot+Bot+Pot+xot+"]");function Qot(t){return kot.test(t)}Aue.exports=Qot});var pue=_((GMt,fue)=>{function Fot(t){return t.split("")}fue.exports=Fot});var Iue=_((WMt,Cue)=>{var hue="\\ud800-\\udfff",Rot="\\u0300-\\u036f",Tot="\\ufe20-\\ufe2f",Lot="\\u20d0-\\u20ff",Not=Rot+Tot+Lot,Oot="\\ufe0e\\ufe0f",Mot="["+hue+"]",$U="["+Not+"]",e3="\\ud83c[\\udffb-\\udfff]",Uot="(?:"+$U+"|"+e3+")",gue="[^"+hue+"]",due="(?:\\ud83c[\\udde6-\\uddff]){2}",mue="[\\ud800-\\udbff][\\udc00-\\udfff]",_ot="\\u200d",yue=Uot+"?",Eue="["+Oot+"]?",Hot="(?:"+_ot+"(?:"+[gue,due,mue].join("|")+")"+Eue+yue+")*",qot=Eue+yue+Hot,jot="(?:"+[gue+$U+"?",$U,due,mue,Mot].join("|")+")",Got=RegExp(e3+"(?="+e3+")|"+jot+qot,"g");function Wot(t){return t.match(Got)||[]}Cue.exports=Wot});var Bue=_((YMt,wue)=>{var Yot=pue(),Vot=ZU(),Kot=Iue();function Jot(t){return Vot(t)?Kot(t):Yot(t)}wue.exports=Jot});var Due=_((VMt,vue)=>{var zot=uue(),Xot=ZU(),Zot=Bue(),$ot=t2();function eat(t){return function(e){e=$ot(e);var r=Xot(e)?Zot(e):void 0,o=r?r[0]:e.charAt(0),a=r?zot(r,1).join(""):e.slice(1);return o[t]()+a}}vue.exports=eat});var Pue=_((KMt,Sue)=>{var tat=Due(),rat=tat("toUpperCase");Sue.exports=rat});var t3=_((JMt,xue)=>{var nat=t2(),iat=Pue();function sat(t){return iat(nat(t).toLowerCase())}xue.exports=sat});var bue=_((zMt,Ib)=>{function oat(){var t=0,e=1,r=2,o=3,a=4,n=5,u=6,A=7,p=8,h=9,E=10,w=11,D=12,b=13,C=14,T=15,N=16,U=17,J=0,te=1,le=2,ce=3,ue=4;function Ie(g,me){return 55296<=g.charCodeAt(me)&&g.charCodeAt(me)<=56319&&56320<=g.charCodeAt(me+1)&&g.charCodeAt(me+1)<=57343}function he(g,me){me===void 0&&(me=0);var Ce=g.charCodeAt(me);if(55296<=Ce&&Ce<=56319&&me=1){var fe=g.charCodeAt(me-1),ie=Ce;return 55296<=fe&&fe<=56319?(fe-55296)*1024+(ie-56320)+65536:ie}return Ce}function De(g,me,Ce){var fe=[g].concat(me).concat([Ce]),ie=fe[fe.length-2],Z=Ce,Se=fe.lastIndexOf(C);if(Se>1&&fe.slice(1,Se).every(function(q){return q==o})&&[o,b,U].indexOf(g)==-1)return le;var Re=fe.lastIndexOf(a);if(Re>0&&fe.slice(1,Re).every(function(q){return q==a})&&[D,a].indexOf(ie)==-1)return fe.filter(function(q){return q==a}).length%2==1?ce:ue;if(ie==t&&Z==e)return J;if(ie==r||ie==t||ie==e)return Z==C&&me.every(function(q){return q==o})?le:te;if(Z==r||Z==t||Z==e)return te;if(ie==u&&(Z==u||Z==A||Z==h||Z==E))return J;if((ie==h||ie==A)&&(Z==A||Z==p))return J;if((ie==E||ie==p)&&Z==p)return J;if(Z==o||Z==T)return J;if(Z==n)return J;if(ie==D)return J;var ht=fe.indexOf(o)!=-1?fe.lastIndexOf(o)-1:fe.length-2;return[b,U].indexOf(fe[ht])!=-1&&fe.slice(ht+1,-1).every(function(q){return q==o})&&Z==C||ie==T&&[N,U].indexOf(Z)!=-1?J:me.indexOf(a)!=-1?le:ie==a&&Z==a?J:te}this.nextBreak=function(g,me){if(me===void 0&&(me=0),me<0)return 0;if(me>=g.length-1)return g.length;for(var Ce=Ee(he(g,me)),fe=[],ie=me+1;ie{var aat=/^(.*?)(\x1b\[[^m]+m|\x1b\]8;;.*?(\x1b\\|\u0007))/,wb;function lat(){if(wb)return wb;if(typeof Intl.Segmenter<"u"){let t=new Intl.Segmenter("en",{granularity:"grapheme"});return wb=e=>Array.from(t.segment(e),({segment:r})=>r)}else{let t=bue(),e=new t;return wb=r=>e.splitGraphemes(r)}}kue.exports=(t,e=0,r=t.length)=>{if(e<0||r<0)throw new RangeError("Negative indices aren't supported by this implementation");let o=r-e,a="",n=0,u=0;for(;t.length>0;){let A=t.match(aat)||[t,t,void 0],p=lat()(A[1]),h=Math.min(e-n,p.length);p=p.slice(h);let E=Math.min(o-u,p.length);a+=p.slice(0,E).join(""),n+=h,u+=E,typeof A[2]<"u"&&(a+=A[2]),t=t.slice(A[0].length)}return a}});var nn,r2=It(()=>{nn=process.env.YARN_IS_TEST_ENV?"0.0.0":"4.7.0"});function Oue(t,{configuration:e,json:r}){if(!e.get("enableMessageNames"))return"";let a=Ju(t===null?0:t);return!r&&t===null?Ut(e,a,"grey"):a}function r3(t,{configuration:e,json:r}){let o=Oue(t,{configuration:e,json:r});if(!o||t===null||t===0)return o;let a=vr[t],n=`https://yarnpkg.com/advanced/error-codes#${o}---${a}`.toLowerCase();return ty(e,o,n)}async function Qy({configuration:t,stdout:e,forceError:r},o){let a=await Lt.start({configuration:t,stdout:e,includeFooter:!1},async n=>{let u=!1,A=!1;for(let p of o)typeof p.option<"u"&&(p.error||r?(A=!0,n.reportError(50,p.message)):(u=!0,n.reportWarning(50,p.message)),p.callback?.());u&&!A&&n.reportSeparator()});return a.hasErrors()?a.exitCode():null}var Lue,Bb,cat,Fue,Rue,hh,Nue,Tue,uat,Aat,vb,fat,Lt,n2=It(()=>{Lue=et(Que()),Bb=et(sg());GS();Kl();r2();Wl();cat="\xB7",Fue=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Rue=80,hh=Bb.default.GITHUB_ACTIONS?{start:t=>`::group::${t} -`,end:t=>`::endgroup:: -`}:Bb.default.TRAVIS?{start:t=>`travis_fold:start:${t} -`,end:t=>`travis_fold:end:${t} -`}:Bb.default.GITLAB?{start:t=>`section_start:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}[collapsed=true]\r\x1B[0K${t} -`,end:t=>`section_end:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r\x1B[0K`}:null,Nue=hh!==null,Tue=new Date,uat=["iTerm.app","Apple_Terminal","WarpTerminal","vscode"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,Aat=t=>t,vb=Aat({patrick:{date:[17,3],chars:["\u{1F340}","\u{1F331}"],size:40},simba:{date:[19,7],chars:["\u{1F981}","\u{1F334}"],size:40},jack:{date:[31,10],chars:["\u{1F383}","\u{1F987}"],size:40},hogsfather:{date:[31,12],chars:["\u{1F389}","\u{1F384}"],size:40},default:{chars:["=","-"],size:80}}),fat=uat&&Object.keys(vb).find(t=>{let e=vb[t];return!(e.date&&(e.date[0]!==Tue.getDate()||e.date[1]!==Tue.getMonth()+1))})||"default";Lt=class extends Ws{constructor({configuration:r,stdout:o,json:a=!1,forceSectionAlignment:n=!1,includeNames:u=!0,includePrefix:A=!0,includeFooter:p=!0,includeLogs:h=!a,includeInfos:E=h,includeWarnings:w=h}){super();this.uncommitted=new Set;this.warningCount=0;this.errorCount=0;this.timerFooter=[];this.startTime=Date.now();this.indent=0;this.level=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.progressStyle=null;this.progressMaxScaledSize=null;if(g1(this,{configuration:r}),this.configuration=r,this.forceSectionAlignment=n,this.includeNames=u,this.includePrefix=A,this.includeFooter=p,this.includeInfos=E,this.includeWarnings=w,this.json=a,this.stdout=o,r.get("enableProgressBars")&&!a&&o.isTTY&&o.columns>22){let D=r.get("progressBarStyle")||fat;if(!Object.hasOwn(vb,D))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=vb[D];let b=Math.min(this.getRecommendedLength(),80);this.progressMaxScaledSize=Math.floor(this.progressStyle.size*b/80)}}static async start(r,o){let a=new this(r),n=process.emitWarning;process.emitWarning=(u,A)=>{if(typeof u!="string"){let h=u;u=h.message,A=A??h.name}let p=typeof A<"u"?`${A}: ${u}`:u;a.reportWarning(0,p)},r.includeVersion&&a.reportInfo(0,Cg(r.configuration,`Yarn ${nn}`,2));try{await o(a)}catch(u){a.reportExceptionOnce(u)}finally{await a.finalize(),process.emitWarning=n}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}getRecommendedLength(){let o=this.progressStyle!==null?this.stdout.columns-1:super.getRecommendedLength();return Math.max(40,o-12-this.indent*2)}startSectionSync({reportHeader:r,reportFooter:o,skipIfEmpty:a},n){let u={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(u):(u.action(),u.committed=!0);let A=Date.now();try{return n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(u),u.committed&&o?.(p-A)}}async startSectionPromise({reportHeader:r,reportFooter:o,skipIfEmpty:a},n){let u={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(u):(u.action(),u.committed=!0);let A=Date.now();try{return await n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(u),u.committed&&o?.(p-A)}}startTimerImpl(r,o,a){return{cb:typeof o=="function"?o:a,reportHeader:()=>{this.level+=1,this.reportInfo(null,`\u250C ${r}`),this.indent+=1,hh!==null&&!this.json&&this.includeInfos&&this.stdout.write(hh.start(r))},reportFooter:A=>{if(this.indent-=1,hh!==null&&!this.json&&this.includeInfos){this.stdout.write(hh.end(r));for(let p of this.timerFooter)p()}this.configuration.get("enableTimers")&&A>200?this.reportInfo(null,`\u2514 Completed in ${Ut(this.configuration,A,Ct.DURATION)}`):this.reportInfo(null,"\u2514 Completed"),this.level-=1},skipIfEmpty:(typeof o=="function"?{}:o).skipIfEmpty}}startTimerSync(r,o,a){let{cb:n,...u}=this.startTimerImpl(r,o,a);return this.startSectionSync(u,n)}async startTimerPromise(r,o,a){let{cb:n,...u}=this.startTimerImpl(r,o,a);return this.startSectionPromise(u,n)}reportSeparator(){this.indent===0?this.writeLine(""):this.reportInfo(null,"")}reportInfo(r,o){if(!this.includeInfos)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"",u=`${this.formatPrefix(n,"blueBright")}${o}`;this.json?this.reportJson({type:"info",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:o}):this.writeLine(u)}reportWarning(r,o){if(this.warningCount+=1,!this.includeWarnings)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"warning",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:o}):this.writeLine(`${this.formatPrefix(n,"yellowBright")}${o}`)}reportError(r,o){this.errorCount+=1,this.timerFooter.push(()=>this.reportErrorImpl(r,o)),this.reportErrorImpl(r,o)}reportErrorImpl(r,o){this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"error",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:o}):this.writeLine(`${this.formatPrefix(n,"redBright")}${o}`,{truncate:!1})}reportFold(r,o){if(!hh)return;let a=`${hh.start(r)}${o}${hh.end(r)}`;this.timerFooter.push(()=>this.stdout.write(a))}reportProgress(r){if(this.progressStyle===null)return{...Promise.resolve(),stop:()=>{}};if(r.hasProgress&&r.hasTitle)throw new Error("Unimplemented: Progress bars can't have both progress and titles.");let o=!1,a=Promise.resolve().then(async()=>{let u={progress:r.hasProgress?0:void 0,title:r.hasTitle?"":void 0};this.progress.set(r,{definition:u,lastScaledSize:r.hasProgress?-1:void 0,lastTitle:void 0}),this.refreshProgress({delta:-1});for await(let{progress:A,title:p}of r)o||u.progress===A&&u.title===p||(u.progress=A,u.title=p,this.refreshProgress());n()}),n=()=>{o||(o=!0,this.progress.delete(r),this.refreshProgress({delta:1}))};return{...a,stop:n}}reportJson(r){this.json&&this.writeLine(`${JSON.stringify(r)}`)}async finalize(){if(!this.includeFooter)return;let r="";this.errorCount>0?r="Failed with errors":this.warningCount>0?r="Done with warnings":r="Done";let o=Ut(this.configuration,Date.now()-this.startTime,Ct.DURATION),a=this.configuration.get("enableTimers")?`${r} in ${o}`:r;this.errorCount>0?this.reportError(0,a):this.warningCount>0?this.reportWarning(0,a):this.reportInfo(0,a)}writeLine(r,{truncate:o}={}){this.clearProgress({clear:!0}),this.stdout.write(`${this.truncate(r,{truncate:o})} -`),this.writeProgress()}writeLines(r,{truncate:o}={}){this.clearProgress({delta:r.length});for(let a of r)this.stdout.write(`${this.truncate(a,{truncate:o})} -`);this.writeProgress()}commit(){let r=this.uncommitted;this.uncommitted=new Set;for(let o of r)o.committed=!0,o.action()}clearProgress({delta:r=0,clear:o=!1}){this.progressStyle!==null&&this.progress.size+r>0&&(this.stdout.write(`\x1B[${this.progress.size+r}A`),(r>0||o)&&this.stdout.write("\x1B[0J"))}writeProgress(){if(this.progressStyle===null||(this.progressTimeout!==null&&clearTimeout(this.progressTimeout),this.progressTimeout=null,this.progress.size===0))return;let r=Date.now();r-this.progressTime>Rue&&(this.progressFrame=(this.progressFrame+1)%Fue.length,this.progressTime=r);let o=Fue[this.progressFrame];for(let a of this.progress.values()){let n="";if(typeof a.lastScaledSize<"u"){let h=this.progressStyle.chars[0].repeat(a.lastScaledSize),E=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-a.lastScaledSize);n=` ${h}${E}`}let u=this.formatName(null),A=u?`${u}: `:"",p=a.definition.title?` ${a.definition.title}`:"";this.stdout.write(`${Ut(this.configuration,"\u27A4","blueBright")} ${A}${o}${n}${p} -`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress({force:!0})},Rue)}refreshProgress({delta:r=0,force:o=!1}={}){let a=!1,n=!1;if(o||this.progress.size===0)a=!0;else for(let u of this.progress.values()){let A=typeof u.definition.progress<"u"?Math.trunc(this.progressMaxScaledSize*u.definition.progress):void 0,p=u.lastScaledSize;u.lastScaledSize=A;let h=u.lastTitle;if(u.lastTitle=u.definition.title,A!==p||(n=h!==u.definition.title)){a=!0;break}}a&&(this.clearProgress({delta:r,clear:n}),this.writeProgress())}truncate(r,{truncate:o}={}){return this.progressStyle===null&&(o=!1),typeof o>"u"&&(o=this.configuration.get("preferTruncatedLines")),o&&(r=(0,Lue.default)(r,0,this.stdout.columns-1)),r}formatName(r){return this.includeNames?Oue(r,{configuration:this.configuration,json:this.json}):""}formatPrefix(r,o){return this.includePrefix?`${Ut(this.configuration,"\u27A4",o)} ${r}${this.formatIndent()}`:""}formatNameWithHyperlink(r){return this.includeNames?r3(r,{configuration:this.configuration,json:this.json}):""}formatIndent(){return this.level>0||!this.forceSectionAlignment?"\u2502 ".repeat(this.indent):`${cat} `}}});var hn={};Vt(hn,{PackageManager:()=>_ue,detectPackageManager:()=>Hue,executePackageAccessibleBinary:()=>Yue,executePackageScript:()=>Db,executePackageShellcode:()=>n3,executeWorkspaceAccessibleBinary:()=>Eat,executeWorkspaceLifecycleScript:()=>Gue,executeWorkspaceScript:()=>jue,getPackageAccessibleBinaries:()=>Sb,getWorkspaceAccessibleBinaries:()=>Wue,hasPackageScript:()=>dat,hasWorkspaceScript:()=>i3,isNodeScript:()=>s3,makeScriptEnv:()=>i2,maybeExecuteWorkspaceLifecycleScript:()=>yat,prepareExternalProject:()=>gat});async function gh(t,e,r,o=[]){if(process.platform==="win32"){let a=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${r}" ${o.map(n=>`"${n.replace('"','""')}"`).join(" ")} %*`;await ae.writeFilePromise(V.format({dir:t,name:e,ext:".cmd"}),a)}await ae.writeFilePromise(V.join(t,e),`#!/bin/sh -exec "${r}" ${o.map(a=>`'${a.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@" -`,{mode:493})}async function Hue(t){let e=await _t.tryFind(t);if(e?.packageManager){let o=dx(e.packageManager);if(o?.name){let a=`found ${JSON.stringify({packageManager:e.packageManager})} in manifest`,[n]=o.reference.split(".");switch(o.name){case"yarn":return{packageManagerField:!0,packageManager:Number(n)===1?"Yarn Classic":"Yarn",reason:a};case"npm":return{packageManagerField:!0,packageManager:"npm",reason:a};case"pnpm":return{packageManagerField:!0,packageManager:"pnpm",reason:a}}}}let r;try{r=await ae.readFilePromise(V.join(t,mr.lockfile),"utf8")}catch{}return r!==void 0?r.match(/^__metadata:$/m)?{packageManager:"Yarn",reason:'"__metadata" key found in yarn.lock'}:{packageManager:"Yarn Classic",reason:'"__metadata" key not found in yarn.lock, must be a Yarn classic lockfile'}:ae.existsSync(V.join(t,"package-lock.json"))?{packageManager:"npm",reason:`found npm's "package-lock.json" lockfile`}:ae.existsSync(V.join(t,"pnpm-lock.yaml"))?{packageManager:"pnpm",reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function i2({project:t,locator:e,binFolder:r,ignoreCorepack:o,lifecycleScript:a,baseEnv:n=t?.configuration.env??process.env}){let u={};for(let[E,w]of Object.entries(n))typeof w<"u"&&(u[E.toLowerCase()!=="path"?E:"PATH"]=w);let A=Ae.fromPortablePath(r);u.BERRY_BIN_FOLDER=Ae.fromPortablePath(A);let p=process.env.COREPACK_ROOT&&!o?Ae.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([gh(r,"node",process.execPath),...nn!==null?[gh(r,"run",process.execPath,[p,"run"]),gh(r,"yarn",process.execPath,[p]),gh(r,"yarnpkg",process.execPath,[p]),gh(r,"node-gyp",process.execPath,[p,"run","--top-level","node-gyp"])]:[]]),t&&(u.INIT_CWD=Ae.fromPortablePath(t.configuration.startingCwd),u.PROJECT_CWD=Ae.fromPortablePath(t.cwd)),u.PATH=u.PATH?`${A}${Ae.delimiter}${u.PATH}`:`${A}`,u.npm_execpath=`${A}${Ae.sep}yarn`,u.npm_node_execpath=`${A}${Ae.sep}node`,e){if(!t)throw new Error("Assertion failed: Missing project");let E=t.tryWorkspaceByLocator(e),w=E?E.manifest.version??"":t.storedPackages.get(e.locatorHash).version??"";u.npm_package_name=rn(e),u.npm_package_version=w;let D;if(E)D=E.cwd;else{let b=t.storedPackages.get(e.locatorHash);if(!b)throw new Error(`Package for ${jr(t.configuration,e)} not found in the project`);let C=t.configuration.getLinkers(),T={project:t,report:new Lt({stdout:new dh.PassThrough,configuration:t.configuration})},N=C.find(U=>U.supportsPackage(b,T));if(!N)throw new Error(`The package ${jr(t.configuration,b)} isn't supported by any of the available linkers`);D=await N.findPackageLocation(b,T)}u.npm_package_json=Ae.fromPortablePath(V.join(D,mr.manifest))}let h=nn!==null?`yarn/${nn}`:`yarn/${vf("@yarnpkg/core").version}-core`;return u.npm_config_user_agent=`${h} npm/? node/${process.version} ${process.platform} ${process.arch}`,a&&(u.npm_lifecycle_event=a),t&&await t.configuration.triggerHook(E=>E.setupScriptEnvironment,t,u,async(E,w,D)=>await gh(r,E,w,D)),u}async function gat(t,e,{configuration:r,report:o,workspace:a=null,locator:n=null}){await hat(async()=>{await ae.mktempPromise(async u=>{let A=V.join(u,"pack.log"),p=null,{stdout:h,stderr:E}=r.getSubprocessStreams(A,{prefix:Ae.fromPortablePath(t),report:o}),w=n&&Jc(n)?I1(n):n,D=w?Qa(w):"an external project";h.write(`Packing ${D} from sources -`);let b=await Hue(t),C;b!==null?(h.write(`Using ${b.packageManager} for bootstrap. Reason: ${b.reason} - -`),C=b.packageManager):(h.write(`No package manager configuration detected; defaulting to Yarn - -`),C="Yarn");let T=C==="Yarn"&&!b?.packageManagerField;await ae.mktempPromise(async N=>{let U=await i2({binFolder:N,ignoreCorepack:T,baseEnv:{...process.env,COREPACK_ENABLE_AUTO_PIN:"0"}}),te=new Map([["Yarn Classic",async()=>{let ce=a!==null?["workspace",a]:[],ue=V.join(t,mr.manifest),Ie=await ae.readFilePromise(ue),he=await Xc(process.execPath,[process.argv[1],"set","version","classic","--only-if-needed","--yarn-path"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(he.code!==0)return he.code;await ae.writeFilePromise(ue,Ie),await ae.appendFilePromise(V.join(t,".npmignore"),`/.yarn -`),h.write(` -`),delete U.NODE_ENV;let De=await Xc("yarn",["install"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(De.code!==0)return De.code;h.write(` -`);let Ee=await Xc("yarn",[...ce,"pack","--filename",Ae.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return Ee.code!==0?Ee.code:0}],["Yarn",async()=>{let ce=a!==null?["workspace",a]:[];U.YARN_ENABLE_INLINE_BUILDS="1";let ue=V.join(t,mr.lockfile);await ae.existsPromise(ue)||await ae.writeFilePromise(ue,"");let Ie=await Xc("yarn",[...ce,"pack","--install-if-needed","--filename",Ae.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return Ie.code!==0?Ie.code:0}],["npm",async()=>{if(a!==null){let me=new dh.PassThrough,Ce=Xm(me);me.pipe(h,{end:!1});let fe=await Xc("npm",["--version"],{cwd:t,env:U,stdin:p,stdout:me,stderr:E,end:0});if(me.end(),fe.code!==0)return h.end(),E.end(),fe.code;let ie=(await Ce).toString().trim();if(!nA(ie,">=7.x")){let Z=rA(null,"npm"),Se=kn(Z,ie),Re=kn(Z,">=7.x");throw new Error(`Workspaces aren't supported by ${Jn(r,Se)}; please upgrade to ${Jn(r,Re)} (npm has been detected as the primary package manager for ${Ut(r,t,Ct.PATH)})`)}}let ce=a!==null?["--workspace",a]:[];delete U.npm_config_user_agent,delete U.npm_config_production,delete U.NPM_CONFIG_PRODUCTION,delete U.NODE_ENV;let ue=await Xc("npm",["install","--legacy-peer-deps"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(ue.code!==0)return ue.code;let Ie=new dh.PassThrough,he=Xm(Ie);Ie.pipe(h);let De=await Xc("npm",["pack","--silent",...ce],{cwd:t,env:U,stdin:p,stdout:Ie,stderr:E});if(De.code!==0)return De.code;let Ee=(await he).toString().trim().replace(/^.*\n/s,""),g=V.resolve(t,Ae.toPortablePath(Ee));return await ae.renamePromise(g,e),0}]]).get(C);if(typeof te>"u")throw new Error("Assertion failed: Unsupported workflow");let le=await te();if(!(le===0||typeof le>"u"))throw ae.detachTemp(u),new Jt(58,`Packing the package failed (exit code ${le}, logs can be found here: ${Ut(r,A,Ct.PATH)})`)})})})}async function dat(t,e,{project:r}){let o=r.tryWorkspaceByLocator(t);if(o!==null)return i3(o,e);let a=r.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${jr(r.configuration,t)} not found in the project`);return await iA.openPromise(async n=>{let u=r.configuration,A=r.configuration.getLinkers(),p={project:r,report:new Lt({stdout:new dh.PassThrough,configuration:u})},h=A.find(b=>b.supportsPackage(a,p));if(!h)throw new Error(`The package ${jr(r.configuration,a)} isn't supported by any of the available linkers`);let E=await h.findPackageLocation(a,p),w=new En(E,{baseFs:n});return(await _t.find(Bt.dot,{baseFs:w})).scripts.has(e)})}async function Db(t,e,r,{cwd:o,project:a,stdin:n,stdout:u,stderr:A}){return await ae.mktempPromise(async p=>{let{manifest:h,env:E,cwd:w}=await que(t,{project:a,binFolder:p,cwd:o,lifecycleScript:e}),D=h.scripts.get(e);if(typeof D>"u")return 1;let b=async()=>await ky(D,r,{cwd:w,env:E,stdin:n,stdout:u,stderr:A});return await(await a.configuration.reduceHook(T=>T.wrapScriptExecution,b,a,t,e,{script:D,args:r,cwd:w,env:E,stdin:n,stdout:u,stderr:A}))()})}async function n3(t,e,r,{cwd:o,project:a,stdin:n,stdout:u,stderr:A}){return await ae.mktempPromise(async p=>{let{env:h,cwd:E}=await que(t,{project:a,binFolder:p,cwd:o});return await ky(e,r,{cwd:E,env:h,stdin:n,stdout:u,stderr:A})})}async function mat(t,{binFolder:e,cwd:r,lifecycleScript:o}){let a=await i2({project:t.project,locator:t.anchoredLocator,binFolder:e,lifecycleScript:o});return await o3(e,await Wue(t)),typeof r>"u"&&(r=V.dirname(await ae.realpathPromise(V.join(t.cwd,"package.json")))),{manifest:t.manifest,binFolder:e,env:a,cwd:r}}async function que(t,{project:e,binFolder:r,cwd:o,lifecycleScript:a}){let n=e.tryWorkspaceByLocator(t);if(n!==null)return mat(n,{binFolder:r,cwd:o,lifecycleScript:a});let u=e.storedPackages.get(t.locatorHash);if(!u)throw new Error(`Package for ${jr(e.configuration,t)} not found in the project`);return await iA.openPromise(async A=>{let p=e.configuration,h=e.configuration.getLinkers(),E={project:e,report:new Lt({stdout:new dh.PassThrough,configuration:p})},w=h.find(N=>N.supportsPackage(u,E));if(!w)throw new Error(`The package ${jr(e.configuration,u)} isn't supported by any of the available linkers`);let D=await i2({project:e,locator:t,binFolder:r,lifecycleScript:a});await o3(r,await Sb(t,{project:e}));let b=await w.findPackageLocation(u,E),C=new En(b,{baseFs:A}),T=await _t.find(Bt.dot,{baseFs:C});return typeof o>"u"&&(o=b),{manifest:T,binFolder:r,env:D,cwd:o}})}async function jue(t,e,r,{cwd:o,stdin:a,stdout:n,stderr:u}){return await Db(t.anchoredLocator,e,r,{cwd:o,project:t.project,stdin:a,stdout:n,stderr:u})}function i3(t,e){return t.manifest.scripts.has(e)}async function Gue(t,e,{cwd:r,report:o}){let{configuration:a}=t.project,n=null;await ae.mktempPromise(async u=>{let A=V.join(u,`${e}.log`),p=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${Ae.fromPortablePath(t.cwd)}") -`,{stdout:h,stderr:E}=a.getSubprocessStreams(A,{report:o,prefix:jr(a,t.anchoredLocator),header:p});o.reportInfo(36,`Calling the "${e}" lifecycle script`);let w=await jue(t,e,[],{cwd:r,stdin:n,stdout:h,stderr:E});if(h.end(),E.end(),w!==0)throw ae.detachTemp(u),new Jt(36,`${(0,Mue.default)(e)} script failed (exit code ${Ut(a,w,Ct.NUMBER)}, logs can be found here: ${Ut(a,A,Ct.PATH)}); run ${Ut(a,`yarn ${e}`,Ct.CODE)} to investigate`)})}async function yat(t,e,r){i3(t,e)&&await Gue(t,e,r)}function s3(t){let e=V.extname(t);if(e.match(/\.[cm]?[jt]sx?$/))return!0;if(e===".exe"||e===".bin")return!1;let r=Buffer.alloc(4),o;try{o=ae.openSync(t,"r")}catch{return!0}try{ae.readSync(o,r,0,r.length,0)}finally{ae.closeSync(o)}let a=r.readUint32BE();return!(a===3405691582||a===3489328638||a===2135247942||(a&4294901760)===1297743872)}async function Sb(t,{project:e}){let r=e.configuration,o=new Map,a=e.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${jr(r,t)} not found in the project`);let n=new dh.Writable,u=r.getLinkers(),A={project:e,report:new Lt({configuration:r,stdout:n})},p=new Set([t.locatorHash]);for(let E of a.dependencies.values()){let w=e.storedResolutions.get(E.descriptorHash);if(!w)throw new Error(`Assertion failed: The resolution (${Jn(r,E)}) should have been registered`);p.add(w)}let h=await Promise.all(Array.from(p,async E=>{let w=e.storedPackages.get(E);if(!w)throw new Error(`Assertion failed: The package (${E}) should have been registered`);if(w.bin.size===0)return ul.skip;let D=u.find(C=>C.supportsPackage(w,A));if(!D)return ul.skip;let b=null;try{b=await D.findPackageLocation(w,A)}catch(C){if(C.code==="LOCATOR_NOT_INSTALLED")return ul.skip;throw C}return{dependency:w,packageLocation:b}}));for(let E of h){if(E===ul.skip)continue;let{dependency:w,packageLocation:D}=E;for(let[b,C]of w.bin){let T=V.resolve(D,C);o.set(b,[w,Ae.fromPortablePath(T),s3(T)])}}return o}async function Wue(t){return await Sb(t.anchoredLocator,{project:t.project})}async function o3(t,e){await Promise.all(Array.from(e,([r,[,o,a]])=>a?gh(t,r,process.execPath,[o]):gh(t,r,o,[])))}async function Yue(t,e,r,{cwd:o,project:a,stdin:n,stdout:u,stderr:A,nodeArgs:p=[],packageAccessibleBinaries:h}){h??=await Sb(t,{project:a});let E=h.get(e);if(!E)throw new Error(`Binary not found (${e}) for ${jr(a.configuration,t)}`);return await ae.mktempPromise(async w=>{let[,D]=E,b=await i2({project:a,locator:t,binFolder:w});await o3(b.BERRY_BIN_FOLDER,h);let C=s3(Ae.toPortablePath(D))?Xc(process.execPath,[...p,D,...r],{cwd:o,env:b,stdin:n,stdout:u,stderr:A}):Xc(D,r,{cwd:o,env:b,stdin:n,stdout:u,stderr:A}),T;try{T=await C}finally{await ae.removePromise(b.BERRY_BIN_FOLDER)}return T.code})}async function Eat(t,e,r,{cwd:o,stdin:a,stdout:n,stderr:u,packageAccessibleBinaries:A}){return await Yue(t.anchoredLocator,e,r,{project:t.project,cwd:o,stdin:a,stdout:n,stderr:u,packageAccessibleBinaries:A})}var Mue,Uue,dh,_ue,pat,hat,a3=It(()=>{St();St();sA();z1();Mue=et(t3()),Uue=et(lg()),dh=ve("stream");Ay();Kl();n2();r2();nb();Wl();Gl();bf();Io();_ue=(a=>(a.Yarn1="Yarn Classic",a.Yarn2="Yarn",a.Npm="npm",a.Pnpm="pnpm",a))(_ue||{});pat=2,hat=(0,Uue.default)(pat)});var Fy=_((y4t,Kue)=>{"use strict";var Vue=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);Kue.exports=t=>t?Object.keys(t).map(e=>[Vue.has(e)?Vue.get(e):e,t[e]]).reduce((e,r)=>(e[r[0]]=r[1],e),Object.create(null)):{}});var Ty=_((E4t,nAe)=>{"use strict";var Jue=typeof process=="object"&&process?process:{stdout:null,stderr:null},Cat=ve("events"),zue=ve("stream"),Xue=ve("string_decoder").StringDecoder,Nf=Symbol("EOF"),Of=Symbol("maybeEmitEnd"),mh=Symbol("emittedEnd"),Pb=Symbol("emittingEnd"),s2=Symbol("emittedError"),xb=Symbol("closed"),Zue=Symbol("read"),bb=Symbol("flush"),$ue=Symbol("flushChunk"),Ra=Symbol("encoding"),Mf=Symbol("decoder"),kb=Symbol("flowing"),o2=Symbol("paused"),Ry=Symbol("resume"),xs=Symbol("bufferLength"),l3=Symbol("bufferPush"),c3=Symbol("bufferShift"),Do=Symbol("objectMode"),So=Symbol("destroyed"),u3=Symbol("emitData"),eAe=Symbol("emitEnd"),A3=Symbol("emitEnd2"),Uf=Symbol("async"),a2=t=>Promise.resolve().then(t),tAe=global._MP_NO_ITERATOR_SYMBOLS_!=="1",Iat=tAe&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),wat=tAe&&Symbol.iterator||Symbol("iterator not implemented"),Bat=t=>t==="end"||t==="finish"||t==="prefinish",vat=t=>t instanceof ArrayBuffer||typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Dat=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Qb=class{constructor(e,r,o){this.src=e,this.dest=r,this.opts=o,this.ondrain=()=>e[Ry](),r.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},f3=class extends Qb{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,o){super(e,r,o),this.proxyErrors=a=>r.emit("error",a),e.on("error",this.proxyErrors)}};nAe.exports=class rAe extends zue{constructor(e){super(),this[kb]=!1,this[o2]=!1,this.pipes=[],this.buffer=[],this[Do]=e&&e.objectMode||!1,this[Do]?this[Ra]=null:this[Ra]=e&&e.encoding||null,this[Ra]==="buffer"&&(this[Ra]=null),this[Uf]=e&&!!e.async||!1,this[Mf]=this[Ra]?new Xue(this[Ra]):null,this[Nf]=!1,this[mh]=!1,this[Pb]=!1,this[xb]=!1,this[s2]=null,this.writable=!0,this.readable=!0,this[xs]=0,this[So]=!1}get bufferLength(){return this[xs]}get encoding(){return this[Ra]}set encoding(e){if(this[Do])throw new Error("cannot set encoding in objectMode");if(this[Ra]&&e!==this[Ra]&&(this[Mf]&&this[Mf].lastNeed||this[xs]))throw new Error("cannot change encoding");this[Ra]!==e&&(this[Mf]=e?new Xue(e):null,this.buffer.length&&(this.buffer=this.buffer.map(r=>this[Mf].write(r)))),this[Ra]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[Do]}set objectMode(e){this[Do]=this[Do]||!!e}get async(){return this[Uf]}set async(e){this[Uf]=this[Uf]||!!e}write(e,r,o){if(this[Nf])throw new Error("write after end");if(this[So])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(o=r,r="utf8"),r||(r="utf8");let a=this[Uf]?a2:n=>n();return!this[Do]&&!Buffer.isBuffer(e)&&(Dat(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):vat(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[Do]?(this.flowing&&this[xs]!==0&&this[bb](!0),this.flowing?this.emit("data",e):this[l3](e),this[xs]!==0&&this.emit("readable"),o&&a(o),this.flowing):e.length?(typeof e=="string"&&!(r===this[Ra]&&!this[Mf].lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Ra]&&(e=this[Mf].write(e)),this.flowing&&this[xs]!==0&&this[bb](!0),this.flowing?this.emit("data",e):this[l3](e),this[xs]!==0&&this.emit("readable"),o&&a(o),this.flowing):(this[xs]!==0&&this.emit("readable"),o&&a(o),this.flowing)}read(e){if(this[So])return null;if(this[xs]===0||e===0||e>this[xs])return this[Of](),null;this[Do]&&(e=null),this.buffer.length>1&&!this[Do]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[xs])]);let r=this[Zue](e||null,this.buffer[0]);return this[Of](),r}[Zue](e,r){return e===r.length||e===null?this[c3]():(this.buffer[0]=r.slice(e),r=r.slice(0,e),this[xs]-=e),this.emit("data",r),!this.buffer.length&&!this[Nf]&&this.emit("drain"),r}end(e,r,o){return typeof e=="function"&&(o=e,e=null),typeof r=="function"&&(o=r,r="utf8"),e&&this.write(e,r),o&&this.once("end",o),this[Nf]=!0,this.writable=!1,(this.flowing||!this[o2])&&this[Of](),this}[Ry](){this[So]||(this[o2]=!1,this[kb]=!0,this.emit("resume"),this.buffer.length?this[bb]():this[Nf]?this[Of]():this.emit("drain"))}resume(){return this[Ry]()}pause(){this[kb]=!1,this[o2]=!0}get destroyed(){return this[So]}get flowing(){return this[kb]}get paused(){return this[o2]}[l3](e){this[Do]?this[xs]+=1:this[xs]+=e.length,this.buffer.push(e)}[c3](){return this.buffer.length&&(this[Do]?this[xs]-=1:this[xs]-=this.buffer[0].length),this.buffer.shift()}[bb](e){do;while(this[$ue](this[c3]()));!e&&!this.buffer.length&&!this[Nf]&&this.emit("drain")}[$ue](e){return e?(this.emit("data",e),this.flowing):!1}pipe(e,r){if(this[So])return;let o=this[mh];return r=r||{},e===Jue.stdout||e===Jue.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,o?r.end&&e.end():(this.pipes.push(r.proxyErrors?new f3(this,e,r):new Qb(this,e,r)),this[Uf]?a2(()=>this[Ry]()):this[Ry]()),e}unpipe(e){let r=this.pipes.find(o=>o.dest===e);r&&(this.pipes.splice(this.pipes.indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let o=super.on(e,r);return e==="data"&&!this.pipes.length&&!this.flowing?this[Ry]():e==="readable"&&this[xs]!==0?super.emit("readable"):Bat(e)&&this[mh]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[s2]&&(this[Uf]?a2(()=>r.call(this,this[s2])):r.call(this,this[s2])),o}get emittedEnd(){return this[mh]}[Of](){!this[Pb]&&!this[mh]&&!this[So]&&this.buffer.length===0&&this[Nf]&&(this[Pb]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[xb]&&this.emit("close"),this[Pb]=!1)}emit(e,r,...o){if(e!=="error"&&e!=="close"&&e!==So&&this[So])return;if(e==="data")return r?this[Uf]?a2(()=>this[u3](r)):this[u3](r):!1;if(e==="end")return this[eAe]();if(e==="close"){if(this[xb]=!0,!this[mh]&&!this[So])return;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[s2]=r;let n=super.emit("error",r);return this[Of](),n}else if(e==="resume"){let n=super.emit("resume");return this[Of](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let a=super.emit(e,r,...o);return this[Of](),a}[u3](e){for(let o of this.pipes)o.dest.write(e)===!1&&this.pause();let r=super.emit("data",e);return this[Of](),r}[eAe](){this[mh]||(this[mh]=!0,this.readable=!1,this[Uf]?a2(()=>this[A3]()):this[A3]())}[A3](){if(this[Mf]){let r=this[Mf].end();if(r){for(let o of this.pipes)o.dest.write(r);super.emit("data",r)}}for(let r of this.pipes)r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[Do]||(e.dataLength=0);let r=this.promise();return this.on("data",o=>{e.push(o),this[Do]||(e.dataLength+=o.length)}),r.then(()=>e)}concat(){return this[Do]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[Do]?Promise.reject(new Error("cannot concat in objectMode")):this[Ra]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,r)=>{this.on(So,()=>r(new Error("stream destroyed"))),this.on("error",o=>r(o)),this.on("end",()=>e())})}[Iat](){return{next:()=>{let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Nf])return Promise.resolve({done:!0});let o=null,a=null,n=h=>{this.removeListener("data",u),this.removeListener("end",A),a(h)},u=h=>{this.removeListener("error",n),this.removeListener("end",A),this.pause(),o({value:h,done:!!this[Nf]})},A=()=>{this.removeListener("error",n),this.removeListener("data",u),o({done:!0})},p=()=>n(new Error("stream destroyed"));return new Promise((h,E)=>{a=E,o=h,this.once(So,p),this.once("error",n),this.once("end",A),this.once("data",u)})}}}[wat](){return{next:()=>{let r=this.read();return{value:r,done:r===null}}}}destroy(e){return this[So]?(e?this.emit("error",e):this.emit(So),this):(this[So]=!0,this.buffer.length=0,this[xs]=0,typeof this.close=="function"&&!this[xb]&&this.close(),e?this.emit("error",e):this.emit(So),this)}static isStream(e){return!!e&&(e instanceof rAe||e instanceof zue||e instanceof Cat&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}}});var sAe=_((C4t,iAe)=>{var Sat=ve("zlib").constants||{ZLIB_VERNUM:4736};iAe.exports=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Sat))});var x3=_(hl=>{"use strict";var m3=ve("assert"),yh=ve("buffer").Buffer,lAe=ve("zlib"),Tg=hl.constants=sAe(),Pat=Ty(),oAe=yh.concat,Lg=Symbol("_superWrite"),Ny=class extends Error{constructor(e){super("zlib: "+e.message),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}},xat=Symbol("opts"),l2=Symbol("flushFlag"),aAe=Symbol("finishFlushFlag"),P3=Symbol("fullFlushFlag"),ui=Symbol("handle"),Fb=Symbol("onError"),Ly=Symbol("sawError"),p3=Symbol("level"),h3=Symbol("strategy"),g3=Symbol("ended"),I4t=Symbol("_defaultFullFlush"),Rb=class extends Pat{constructor(e,r){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");super(e),this[Ly]=!1,this[g3]=!1,this[xat]=e,this[l2]=e.flush,this[aAe]=e.finishFlush;try{this[ui]=new lAe[r](e)}catch(o){throw new Ny(o)}this[Fb]=o=>{this[Ly]||(this[Ly]=!0,this.close(),this.emit("error",o))},this[ui].on("error",o=>this[Fb](new Ny(o))),this.once("end",()=>this.close)}close(){this[ui]&&(this[ui].close(),this[ui]=null,this.emit("close"))}reset(){if(!this[Ly])return m3(this[ui],"zlib binding closed"),this[ui].reset()}flush(e){this.ended||(typeof e!="number"&&(e=this[P3]),this.write(Object.assign(yh.alloc(0),{[l2]:e})))}end(e,r,o){return e&&this.write(e,r),this.flush(this[aAe]),this[g3]=!0,super.end(null,null,o)}get ended(){return this[g3]}write(e,r,o){if(typeof r=="function"&&(o=r,r="utf8"),typeof e=="string"&&(e=yh.from(e,r)),this[Ly])return;m3(this[ui],"zlib binding closed");let a=this[ui]._handle,n=a.close;a.close=()=>{};let u=this[ui].close;this[ui].close=()=>{},yh.concat=h=>h;let A;try{let h=typeof e[l2]=="number"?e[l2]:this[l2];A=this[ui]._processChunk(e,h),yh.concat=oAe}catch(h){yh.concat=oAe,this[Fb](new Ny(h))}finally{this[ui]&&(this[ui]._handle=a,a.close=n,this[ui].close=u,this[ui].removeAllListeners("error"))}this[ui]&&this[ui].on("error",h=>this[Fb](new Ny(h)));let p;if(A)if(Array.isArray(A)&&A.length>0){p=this[Lg](yh.from(A[0]));for(let h=1;h{this.flush(a),n()};try{this[ui].params(e,r)}finally{this[ui].flush=o}this[ui]&&(this[p3]=e,this[h3]=r)}}}},y3=class extends _f{constructor(e){super(e,"Deflate")}},E3=class extends _f{constructor(e){super(e,"Inflate")}},d3=Symbol("_portable"),C3=class extends _f{constructor(e){super(e,"Gzip"),this[d3]=e&&!!e.portable}[Lg](e){return this[d3]?(this[d3]=!1,e[9]=255,super[Lg](e)):super[Lg](e)}},I3=class extends _f{constructor(e){super(e,"Gunzip")}},w3=class extends _f{constructor(e){super(e,"DeflateRaw")}},B3=class extends _f{constructor(e){super(e,"InflateRaw")}},v3=class extends _f{constructor(e){super(e,"Unzip")}},Tb=class extends Rb{constructor(e,r){e=e||{},e.flush=e.flush||Tg.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Tg.BROTLI_OPERATION_FINISH,super(e,r),this[P3]=Tg.BROTLI_OPERATION_FLUSH}},D3=class extends Tb{constructor(e){super(e,"BrotliCompress")}},S3=class extends Tb{constructor(e){super(e,"BrotliDecompress")}};hl.Deflate=y3;hl.Inflate=E3;hl.Gzip=C3;hl.Gunzip=I3;hl.DeflateRaw=w3;hl.InflateRaw=B3;hl.Unzip=v3;typeof lAe.BrotliCompress=="function"?(hl.BrotliCompress=D3,hl.BrotliDecompress=S3):hl.BrotliCompress=hl.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}}});var Oy=_((v4t,cAe)=>{var bat=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;cAe.exports=bat!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/")});var Lb=_((S4t,uAe)=>{"use strict";var kat=Ty(),b3=Oy(),k3=Symbol("slurp");uAe.exports=class extends kat{constructor(e,r,o){switch(super(),this.pause(),this.extended=r,this.globalExtended=o,this.header=e,this.startBlockSize=512*Math.ceil(e.size/512),this.blockRemain=this.startBlockSize,this.remain=e.size,this.type=e.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=b3(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=e.size,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=b3(e.linkpath),this.uname=e.uname,this.gname=e.gname,r&&this[k3](r),o&&this[k3](o,!0)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");let o=this.remain,a=this.blockRemain;return this.remain=Math.max(0,o-r),this.blockRemain=Math.max(0,a-r),this.ignore?!0:o>=r?super.write(e):super.write(e.slice(0,o))}[k3](e,r){for(let o in e)e[o]!==null&&e[o]!==void 0&&!(r&&o==="path")&&(this[o]=o==="path"||o==="linkpath"?b3(e[o]):e[o])}}});var Q3=_(Nb=>{"use strict";Nb.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);Nb.code=new Map(Array.from(Nb.name).map(t=>[t[1],t[0]]))});var hAe=_((x4t,pAe)=>{"use strict";var Qat=(t,e)=>{if(Number.isSafeInteger(t))t<0?Rat(t,e):Fat(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Fat=(t,e)=>{e[0]=128;for(var r=e.length;r>1;r--)e[r-1]=t&255,t=Math.floor(t/256)},Rat=(t,e)=>{e[0]=255;var r=!1;t=t*-1;for(var o=e.length;o>1;o--){var a=t&255;t=Math.floor(t/256),r?e[o-1]=AAe(a):a===0?e[o-1]=0:(r=!0,e[o-1]=fAe(a))}},Tat=t=>{let e=t[0],r=e===128?Nat(t.slice(1,t.length)):e===255?Lat(t):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},Lat=t=>{for(var e=t.length,r=0,o=!1,a=e-1;a>-1;a--){var n=t[a],u;o?u=AAe(n):n===0?u=n:(o=!0,u=fAe(n)),u!==0&&(r-=u*Math.pow(256,e-a-1))}return r},Nat=t=>{for(var e=t.length,r=0,o=e-1;o>-1;o--){var a=t[o];a!==0&&(r+=a*Math.pow(256,e-o-1))}return r},AAe=t=>(255^t)&255,fAe=t=>(255^t)+1&255;pAe.exports={encode:Qat,parse:Tat}});var Uy=_((b4t,dAe)=>{"use strict";var F3=Q3(),My=ve("path").posix,gAe=hAe(),R3=Symbol("slurp"),gl=Symbol("type"),N3=class{constructor(e,r,o,a){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[gl]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(e)?this.decode(e,r||0,o,a):e&&this.set(e)}decode(e,r,o,a){if(r||(r=0),!e||!(e.length>=r+512))throw new Error("need 512 bytes for header");if(this.path=Ng(e,r,100),this.mode=Eh(e,r+100,8),this.uid=Eh(e,r+108,8),this.gid=Eh(e,r+116,8),this.size=Eh(e,r+124,12),this.mtime=T3(e,r+136,12),this.cksum=Eh(e,r+148,12),this[R3](o),this[R3](a,!0),this[gl]=Ng(e,r+156,1),this[gl]===""&&(this[gl]="0"),this[gl]==="0"&&this.path.substr(-1)==="/"&&(this[gl]="5"),this[gl]==="5"&&(this.size=0),this.linkpath=Ng(e,r+157,100),e.slice(r+257,r+265).toString()==="ustar\x0000")if(this.uname=Ng(e,r+265,32),this.gname=Ng(e,r+297,32),this.devmaj=Eh(e,r+329,8),this.devmin=Eh(e,r+337,8),e[r+475]!==0){let u=Ng(e,r+345,155);this.path=u+"/"+this.path}else{let u=Ng(e,r+345,130);u&&(this.path=u+"/"+this.path),this.atime=T3(e,r+476,12),this.ctime=T3(e,r+488,12)}let n=8*32;for(let u=r;u=r+512))throw new Error("need 512 bytes for header");let o=this.ctime||this.atime?130:155,a=Oat(this.path||"",o),n=a[0],u=a[1];this.needPax=a[2],this.needPax=Og(e,r,100,n)||this.needPax,this.needPax=Ch(e,r+100,8,this.mode)||this.needPax,this.needPax=Ch(e,r+108,8,this.uid)||this.needPax,this.needPax=Ch(e,r+116,8,this.gid)||this.needPax,this.needPax=Ch(e,r+124,12,this.size)||this.needPax,this.needPax=L3(e,r+136,12,this.mtime)||this.needPax,e[r+156]=this[gl].charCodeAt(0),this.needPax=Og(e,r+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",r+257,8),this.needPax=Og(e,r+265,32,this.uname)||this.needPax,this.needPax=Og(e,r+297,32,this.gname)||this.needPax,this.needPax=Ch(e,r+329,8,this.devmaj)||this.needPax,this.needPax=Ch(e,r+337,8,this.devmin)||this.needPax,this.needPax=Og(e,r+345,o,u)||this.needPax,e[r+475]!==0?this.needPax=Og(e,r+345,155,u)||this.needPax:(this.needPax=Og(e,r+345,130,u)||this.needPax,this.needPax=L3(e,r+476,12,this.atime)||this.needPax,this.needPax=L3(e,r+488,12,this.ctime)||this.needPax);let A=8*32;for(let p=r;p{let o=t,a="",n,u=My.parse(t).root||".";if(Buffer.byteLength(o)<100)n=[o,a,!1];else{a=My.dirname(o),o=My.basename(o);do Buffer.byteLength(o)<=100&&Buffer.byteLength(a)<=e?n=[o,a,!1]:Buffer.byteLength(o)>100&&Buffer.byteLength(a)<=e?n=[o.substr(0,99),a,!0]:(o=My.join(My.basename(a),o),a=My.dirname(a));while(a!==u&&!n);n||(n=[t.substr(0,99),"",!0])}return n},Ng=(t,e,r)=>t.slice(e,e+r).toString("utf8").replace(/\0.*/,""),T3=(t,e,r)=>Mat(Eh(t,e,r)),Mat=t=>t===null?null:new Date(t*1e3),Eh=(t,e,r)=>t[e]&128?gAe.parse(t.slice(e,e+r)):_at(t,e,r),Uat=t=>isNaN(t)?null:t,_at=(t,e,r)=>Uat(parseInt(t.slice(e,e+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),Hat={12:8589934591,8:2097151},Ch=(t,e,r,o)=>o===null?!1:o>Hat[r]||o<0?(gAe.encode(o,t.slice(e,e+r)),!0):(qat(t,e,r,o),!1),qat=(t,e,r,o)=>t.write(jat(o,r),e,r,"ascii"),jat=(t,e)=>Gat(Math.floor(t).toString(8),e),Gat=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",L3=(t,e,r,o)=>o===null?!1:Ch(t,e,r,o.getTime()/1e3),Wat=new Array(156).join("\0"),Og=(t,e,r,o)=>o===null?!1:(t.write(o+Wat,e,r,"utf8"),o.length!==Buffer.byteLength(o)||o.length>r);dAe.exports=N3});var Ob=_((k4t,mAe)=>{"use strict";var Yat=Uy(),Vat=ve("path"),c2=class{constructor(e,r){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=r||!1}encode(){let e=this.encodeBody();if(e==="")return null;let r=Buffer.byteLength(e),o=512*Math.ceil(1+r/512),a=Buffer.allocUnsafe(o);for(let n=0;n<512;n++)a[n]=0;new Yat({path:("PaxHeader/"+Vat.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:r,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(a),a.write(e,512,r,"utf8");for(let n=r+512;n=Math.pow(10,n)&&(n+=1),n+a+o}};c2.parse=(t,e,r)=>new c2(Kat(Jat(t),e),r);var Kat=(t,e)=>e?Object.keys(t).reduce((r,o)=>(r[o]=t[o],r),e):t,Jat=t=>t.replace(/\n$/,"").split(` -`).reduce(zat,Object.create(null)),zat=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.substr((r+" ").length);let o=e.split("="),a=o.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!a)return t;let n=o.join("=");return t[a]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(a)?new Date(n*1e3):/^[0-9]+$/.test(n)?+n:n,t};mAe.exports=c2});var _y=_((Q4t,yAe)=>{yAe.exports=t=>{let e=t.length-1,r=-1;for(;e>-1&&t.charAt(e)==="/";)r=e,e--;return r===-1?t:t.slice(0,r)}});var Mb=_((F4t,EAe)=>{"use strict";EAe.exports=t=>class extends t{warn(e,r,o={}){this.file&&(o.file=this.file),this.cwd&&(o.cwd=this.cwd),o.code=r instanceof Error&&r.code||e,o.tarCode=e,!this.strict&&o.recoverable!==!1?(r instanceof Error&&(o=Object.assign(r,o),r=r.message),this.emit("warn",o.tarCode,r,o)):r instanceof Error?this.emit("error",Object.assign(r,o)):this.emit("error",Object.assign(new Error(`${e}: ${r}`),o))}}});var M3=_((T4t,CAe)=>{"use strict";var Ub=["|","<",">","?",":"],O3=Ub.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),Xat=new Map(Ub.map((t,e)=>[t,O3[e]])),Zat=new Map(O3.map((t,e)=>[t,Ub[e]]));CAe.exports={encode:t=>Ub.reduce((e,r)=>e.split(r).join(Xat.get(r)),t),decode:t=>O3.reduce((e,r)=>e.split(r).join(Zat.get(r)),t)}});var U3=_((L4t,wAe)=>{var{isAbsolute:$at,parse:IAe}=ve("path").win32;wAe.exports=t=>{let e="",r=IAe(t);for(;$at(t)||r.root;){let o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.substr(o.length),e+=o,r=IAe(t)}return[e,t]}});var vAe=_((N4t,BAe)=>{"use strict";BAe.exports=(t,e,r)=>(t&=4095,r&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t)});var J3=_((U4t,MAe)=>{"use strict";var QAe=Ty(),FAe=Ob(),RAe=Uy(),lA=ve("fs"),DAe=ve("path"),aA=Oy(),elt=_y(),TAe=(t,e)=>e?(t=aA(t).replace(/^\.(\/|$)/,""),elt(e)+"/"+t):aA(t),tlt=16*1024*1024,SAe=Symbol("process"),PAe=Symbol("file"),xAe=Symbol("directory"),H3=Symbol("symlink"),bAe=Symbol("hardlink"),u2=Symbol("header"),_b=Symbol("read"),q3=Symbol("lstat"),Hb=Symbol("onlstat"),j3=Symbol("onread"),G3=Symbol("onreadlink"),W3=Symbol("openfile"),Y3=Symbol("onopenfile"),Ih=Symbol("close"),qb=Symbol("mode"),V3=Symbol("awaitDrain"),_3=Symbol("ondrain"),cA=Symbol("prefix"),kAe=Symbol("hadError"),LAe=Mb(),rlt=M3(),NAe=U3(),OAe=vAe(),jb=LAe(class extends QAe{constructor(e,r){if(r=r||{},super(r),typeof e!="string")throw new TypeError("path is required");this.path=aA(e),this.portable=!!r.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=r.maxReadSize||tlt,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=aA(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime||null,this.prefix=r.prefix?aA(r.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let o=!1;if(!this.preservePaths){let[a,n]=NAe(this.path);a&&(this.path=n,o=a)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=rlt.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=aA(r.absolute||DAe.resolve(this.cwd,e)),this.path===""&&(this.path="./"),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.statCache.has(this.absolute)?this[Hb](this.statCache.get(this.absolute)):this[q3]()}emit(e,...r){return e==="error"&&(this[kAe]=!0),super.emit(e,...r)}[q3](){lA.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[Hb](r)})}[Hb](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=ilt(e),this.emit("stat",e),this[SAe]()}[SAe](){switch(this.type){case"File":return this[PAe]();case"Directory":return this[xAe]();case"SymbolicLink":return this[H3]();default:return this.end()}}[qb](e){return OAe(e,this.type==="Directory",this.portable)}[cA](e){return TAe(e,this.prefix)}[u2](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new RAe({path:this[cA](this.path),linkpath:this.type==="Link"?this[cA](this.linkpath):this.linkpath,mode:this[qb](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new FAe({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[cA](this.path),linkpath:this.type==="Link"?this[cA](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[xAe](){this.path.substr(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[u2](),this.end()}[H3](){lA.readlink(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[G3](r)})}[G3](e){this.linkpath=aA(e),this[u2](),this.end()}[bAe](e){this.type="Link",this.linkpath=aA(DAe.relative(this.cwd,e)),this.stat.size=0,this[u2](),this.end()}[PAe](){if(this.stat.nlink>1){let e=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(e)){let r=this.linkCache.get(e);if(r.indexOf(this.cwd)===0)return this[bAe](r)}this.linkCache.set(e,this.absolute)}if(this[u2](),this.stat.size===0)return this.end();this[W3]()}[W3](){lA.open(this.absolute,"r",(e,r)=>{if(e)return this.emit("error",e);this[Y3](r)})}[Y3](e){if(this.fd=e,this[kAe])return this[Ih]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[_b]()}[_b](){let{fd:e,buf:r,offset:o,length:a,pos:n}=this;lA.read(e,r,o,a,n,(u,A)=>{if(u)return this[Ih](()=>this.emit("error",u));this[j3](A)})}[Ih](e){lA.close(this.fd,e)}[j3](e){if(e<=0&&this.remain>0){let a=new Error("encountered unexpected EOF");return a.path=this.absolute,a.syscall="read",a.code="EOF",this[Ih](()=>this.emit("error",a))}if(e>this.remain){let a=new Error("did not encounter expected EOF");return a.path=this.absolute,a.syscall="read",a.code="EOF",this[Ih](()=>this.emit("error",a))}if(e===this.remain)for(let a=e;athis[_3]())}[V3](e){this.once("drain",e)}write(e){if(this.blockRemaine?this.emit("error",e):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[_b]()}}),K3=class extends jb{[q3](){this[Hb](lA.lstatSync(this.absolute))}[H3](){this[G3](lA.readlinkSync(this.absolute))}[W3](){this[Y3](lA.openSync(this.absolute,"r"))}[_b](){let e=!0;try{let{fd:r,buf:o,offset:a,length:n,pos:u}=this,A=lA.readSync(r,o,a,n,u);this[j3](A),e=!1}finally{if(e)try{this[Ih](()=>{})}catch{}}}[V3](e){e()}[Ih](e){lA.closeSync(this.fd),e()}},nlt=LAe(class extends QAe{constructor(e,r){r=r||{},super(r),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.readEntry=e,this.type=e.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix||null,this.path=aA(e.path),this.mode=this[qb](e.mode),this.uid=this.portable?null:e.uid,this.gid=this.portable?null:e.gid,this.uname=this.portable?null:e.uname,this.gname=this.portable?null:e.gname,this.size=e.size,this.mtime=this.noMtime?null:r.mtime||e.mtime,this.atime=this.portable?null:e.atime,this.ctime=this.portable?null:e.ctime,this.linkpath=aA(e.linkpath),typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let o=!1;if(!this.preservePaths){let[a,n]=NAe(this.path);a&&(this.path=n,o=a)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new RAe({path:this[cA](this.path),linkpath:this.type==="Link"?this[cA](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.header.encode()&&!this.noPax&&super.write(new FAe({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[cA](this.path),linkpath:this.type==="Link"?this[cA](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),e.pipe(this)}[cA](e){return TAe(e,this.prefix)}[qb](e){return OAe(e,this.type==="Directory",this.portable)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});jb.Sync=K3;jb.Tar=nlt;var ilt=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";MAe.exports=jb});var Zb=_((H4t,WAe)=>{"use strict";var zb=class{constructor(e,r){this.path=e||"./",this.absolute=r,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}},slt=Ty(),olt=x3(),alt=Lb(),i_=J3(),llt=i_.Sync,clt=i_.Tar,ult=eP(),UAe=Buffer.alloc(1024),Yb=Symbol("onStat"),Gb=Symbol("ended"),uA=Symbol("queue"),Hy=Symbol("current"),Mg=Symbol("process"),Wb=Symbol("processing"),_Ae=Symbol("processJob"),AA=Symbol("jobs"),z3=Symbol("jobDone"),Vb=Symbol("addFSEntry"),HAe=Symbol("addTarEntry"),e_=Symbol("stat"),t_=Symbol("readdir"),Kb=Symbol("onreaddir"),Jb=Symbol("pipe"),qAe=Symbol("entry"),X3=Symbol("entryOpt"),r_=Symbol("writeEntryClass"),GAe=Symbol("write"),Z3=Symbol("ondrain"),Xb=ve("fs"),jAe=ve("path"),Alt=Mb(),$3=Oy(),s_=Alt(class extends slt{constructor(e){super(e),e=e||Object.create(null),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=$3(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this[r_]=i_,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,this.zip=null,e.gzip?(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new olt.Gzip(e.gzip),this.zip.on("data",r=>super.write(r)),this.zip.on("end",r=>super.end()),this.zip.on("drain",r=>this[Z3]()),this.on("resume",r=>this.zip.resume())):this.on("drain",this[Z3]),this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,this.filter=typeof e.filter=="function"?e.filter:r=>!0,this[uA]=new ult,this[AA]=0,this.jobs=+e.jobs||4,this[Wb]=!1,this[Gb]=!1}[GAe](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.write(e),this[Gb]=!0,this[Mg](),this}write(e){if(this[Gb])throw new Error("write after end");return e instanceof alt?this[HAe](e):this[Vb](e),this.flowing}[HAe](e){let r=$3(jAe.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let o=new zb(e.path,r,!1);o.entry=new clt(e,this[X3](o)),o.entry.on("end",a=>this[z3](o)),this[AA]+=1,this[uA].push(o)}this[Mg]()}[Vb](e){let r=$3(jAe.resolve(this.cwd,e));this[uA].push(new zb(e,r)),this[Mg]()}[e_](e){e.pending=!0,this[AA]+=1;let r=this.follow?"stat":"lstat";Xb[r](e.absolute,(o,a)=>{e.pending=!1,this[AA]-=1,o?this.emit("error",o):this[Yb](e,a)})}[Yb](e,r){this.statCache.set(e.absolute,r),e.stat=r,this.filter(e.path,r)||(e.ignore=!0),this[Mg]()}[t_](e){e.pending=!0,this[AA]+=1,Xb.readdir(e.absolute,(r,o)=>{if(e.pending=!1,this[AA]-=1,r)return this.emit("error",r);this[Kb](e,o)})}[Kb](e,r){this.readdirCache.set(e.absolute,r),e.readdir=r,this[Mg]()}[Mg](){if(!this[Wb]){this[Wb]=!0;for(let e=this[uA].head;e!==null&&this[AA]this.warn(r,o,a),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[qAe](e){this[AA]+=1;try{return new this[r_](e.path,this[X3](e)).on("end",()=>this[z3](e)).on("error",r=>this.emit("error",r))}catch(r){this.emit("error",r)}}[Z3](){this[Hy]&&this[Hy].entry&&this[Hy].entry.resume()}[Jb](e){e.piped=!0,e.readdir&&e.readdir.forEach(a=>{let n=e.path,u=n==="./"?"":n.replace(/\/*$/,"/");this[Vb](u+a)});let r=e.entry,o=this.zip;o?r.on("data",a=>{o.write(a)||r.pause()}):r.on("data",a=>{super.write(a)||r.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}}),n_=class extends s_{constructor(e){super(e),this[r_]=llt}pause(){}resume(){}[e_](e){let r=this.follow?"statSync":"lstatSync";this[Yb](e,Xb[r](e.absolute))}[t_](e,r){this[Kb](e,Xb.readdirSync(e.absolute))}[Jb](e){let r=e.entry,o=this.zip;e.readdir&&e.readdir.forEach(a=>{let n=e.path,u=n==="./"?"":n.replace(/\/*$/,"/");this[Vb](u+a)}),o?r.on("data",a=>{o.write(a)}):r.on("data",a=>{super[GAe](a)})}};s_.Sync=n_;WAe.exports=s_});var Jy=_(f2=>{"use strict";var flt=Ty(),plt=ve("events").EventEmitter,Ta=ve("fs"),l_=Ta.writev;if(!l_){let t=process.binding("fs"),e=t.FSReqWrap||t.FSReqCallback;l_=(r,o,a,n)=>{let u=(p,h)=>n(p,h,o),A=new e;A.oncomplete=u,t.writeBuffers(r,o,a,A)}}var Vy=Symbol("_autoClose"),Zc=Symbol("_close"),A2=Symbol("_ended"),zn=Symbol("_fd"),YAe=Symbol("_finished"),Bh=Symbol("_flags"),o_=Symbol("_flush"),c_=Symbol("_handleChunk"),u_=Symbol("_makeBuf"),nk=Symbol("_mode"),$b=Symbol("_needDrain"),Wy=Symbol("_onerror"),Ky=Symbol("_onopen"),a_=Symbol("_onread"),jy=Symbol("_onwrite"),vh=Symbol("_open"),Hf=Symbol("_path"),Ug=Symbol("_pos"),fA=Symbol("_queue"),Gy=Symbol("_read"),VAe=Symbol("_readSize"),wh=Symbol("_reading"),ek=Symbol("_remain"),KAe=Symbol("_size"),tk=Symbol("_write"),qy=Symbol("_writing"),rk=Symbol("_defaultFlag"),Yy=Symbol("_errored"),ik=class extends flt{constructor(e,r){if(r=r||{},super(r),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[Yy]=!1,this[zn]=typeof r.fd=="number"?r.fd:null,this[Hf]=e,this[VAe]=r.readSize||16*1024*1024,this[wh]=!1,this[KAe]=typeof r.size=="number"?r.size:1/0,this[ek]=this[KAe],this[Vy]=typeof r.autoClose=="boolean"?r.autoClose:!0,typeof this[zn]=="number"?this[Gy]():this[vh]()}get fd(){return this[zn]}get path(){return this[Hf]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[vh](){Ta.open(this[Hf],"r",(e,r)=>this[Ky](e,r))}[Ky](e,r){e?this[Wy](e):(this[zn]=r,this.emit("open",r),this[Gy]())}[u_](){return Buffer.allocUnsafe(Math.min(this[VAe],this[ek]))}[Gy](){if(!this[wh]){this[wh]=!0;let e=this[u_]();if(e.length===0)return process.nextTick(()=>this[a_](null,0,e));Ta.read(this[zn],e,0,e.length,null,(r,o,a)=>this[a_](r,o,a))}}[a_](e,r,o){this[wh]=!1,e?this[Wy](e):this[c_](r,o)&&this[Gy]()}[Zc](){if(this[Vy]&&typeof this[zn]=="number"){let e=this[zn];this[zn]=null,Ta.close(e,r=>r?this.emit("error",r):this.emit("close"))}}[Wy](e){this[wh]=!0,this[Zc](),this.emit("error",e)}[c_](e,r){let o=!1;return this[ek]-=e,e>0&&(o=super.write(ethis[Ky](e,r))}[Ky](e,r){this[rk]&&this[Bh]==="r+"&&e&&e.code==="ENOENT"?(this[Bh]="w",this[vh]()):e?this[Wy](e):(this[zn]=r,this.emit("open",r),this[o_]())}end(e,r){return e&&this.write(e,r),this[A2]=!0,!this[qy]&&!this[fA].length&&typeof this[zn]=="number"&&this[jy](null,0),this}write(e,r){return typeof e=="string"&&(e=Buffer.from(e,r)),this[A2]?(this.emit("error",new Error("write() after end()")),!1):this[zn]===null||this[qy]||this[fA].length?(this[fA].push(e),this[$b]=!0,!1):(this[qy]=!0,this[tk](e),!0)}[tk](e){Ta.write(this[zn],e,0,e.length,this[Ug],(r,o)=>this[jy](r,o))}[jy](e,r){e?this[Wy](e):(this[Ug]!==null&&(this[Ug]+=r),this[fA].length?this[o_]():(this[qy]=!1,this[A2]&&!this[YAe]?(this[YAe]=!0,this[Zc](),this.emit("finish")):this[$b]&&(this[$b]=!1,this.emit("drain"))))}[o_](){if(this[fA].length===0)this[A2]&&this[jy](null,0);else if(this[fA].length===1)this[tk](this[fA].pop());else{let e=this[fA];this[fA]=[],l_(this[zn],e,this[Ug],(r,o)=>this[jy](r,o))}}[Zc](){if(this[Vy]&&typeof this[zn]=="number"){let e=this[zn];this[zn]=null,Ta.close(e,r=>r?this.emit("error",r):this.emit("close"))}}},f_=class extends sk{[vh](){let e;if(this[rk]&&this[Bh]==="r+")try{e=Ta.openSync(this[Hf],this[Bh],this[nk])}catch(r){if(r.code==="ENOENT")return this[Bh]="w",this[vh]();throw r}else e=Ta.openSync(this[Hf],this[Bh],this[nk]);this[Ky](null,e)}[Zc](){if(this[Vy]&&typeof this[zn]=="number"){let e=this[zn];this[zn]=null,Ta.closeSync(e),this.emit("close")}}[tk](e){let r=!0;try{this[jy](null,Ta.writeSync(this[zn],e,0,e.length,this[Ug])),r=!1}finally{if(r)try{this[Zc]()}catch{}}}};f2.ReadStream=ik;f2.ReadStreamSync=A_;f2.WriteStream=sk;f2.WriteStreamSync=f_});var fk=_((G4t,tfe)=>{"use strict";var hlt=Mb(),glt=Uy(),dlt=ve("events"),mlt=eP(),ylt=1024*1024,Elt=Lb(),JAe=Ob(),Clt=x3(),p_=Buffer.from([31,139]),$l=Symbol("state"),_g=Symbol("writeEntry"),qf=Symbol("readEntry"),h_=Symbol("nextEntry"),zAe=Symbol("processEntry"),ec=Symbol("extendedHeader"),p2=Symbol("globalExtendedHeader"),Dh=Symbol("meta"),XAe=Symbol("emitMeta"),yi=Symbol("buffer"),jf=Symbol("queue"),Hg=Symbol("ended"),ZAe=Symbol("emittedEnd"),qg=Symbol("emit"),La=Symbol("unzip"),ok=Symbol("consumeChunk"),ak=Symbol("consumeChunkSub"),g_=Symbol("consumeBody"),$Ae=Symbol("consumeMeta"),efe=Symbol("consumeHeader"),lk=Symbol("consuming"),d_=Symbol("bufferConcat"),m_=Symbol("maybeEnd"),h2=Symbol("writing"),Sh=Symbol("aborted"),ck=Symbol("onDone"),jg=Symbol("sawValidEntry"),uk=Symbol("sawNullBlock"),Ak=Symbol("sawEOF"),Ilt=t=>!0;tfe.exports=hlt(class extends dlt{constructor(e){e=e||{},super(e),this.file=e.file||"",this[jg]=null,this.on(ck,r=>{(this[$l]==="begin"||this[jg]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(ck,e.ondone):this.on(ck,r=>{this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||ylt,this.filter=typeof e.filter=="function"?e.filter:Ilt,this.writable=!0,this.readable=!1,this[jf]=new mlt,this[yi]=null,this[qf]=null,this[_g]=null,this[$l]="begin",this[Dh]="",this[ec]=null,this[p2]=null,this[Hg]=!1,this[La]=null,this[Sh]=!1,this[uk]=!1,this[Ak]=!1,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onentry=="function"&&this.on("entry",e.onentry)}[efe](e,r){this[jg]===null&&(this[jg]=!1);let o;try{o=new glt(e,r,this[ec],this[p2])}catch(a){return this.warn("TAR_ENTRY_INVALID",a)}if(o.nullBlock)this[uk]?(this[Ak]=!0,this[$l]==="begin"&&(this[$l]="header"),this[qg]("eof")):(this[uk]=!0,this[qg]("nullBlock"));else if(this[uk]=!1,!o.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:o});else if(!o.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:o});else{let a=o.type;if(/^(Symbolic)?Link$/.test(a)&&!o.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:o});else if(!/^(Symbolic)?Link$/.test(a)&&o.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:o});else{let n=this[_g]=new Elt(o,this[ec],this[p2]);if(!this[jg])if(n.remain){let u=()=>{n.invalid||(this[jg]=!0)};n.on("end",u)}else this[jg]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[qg]("ignoredEntry",n),this[$l]="ignore",n.resume()):n.size>0&&(this[Dh]="",n.on("data",u=>this[Dh]+=u),this[$l]="meta"):(this[ec]=null,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[qg]("ignoredEntry",n),this[$l]=n.remain?"ignore":"header",n.resume()):(n.remain?this[$l]="body":(this[$l]="header",n.end()),this[qf]?this[jf].push(n):(this[jf].push(n),this[h_]())))}}}[zAe](e){let r=!0;return e?Array.isArray(e)?this.emit.apply(this,e):(this[qf]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",o=>this[h_]()),r=!1)):(this[qf]=null,r=!1),r}[h_](){do;while(this[zAe](this[jf].shift()));if(!this[jf].length){let e=this[qf];!e||e.flowing||e.size===e.remain?this[h2]||this.emit("drain"):e.once("drain",o=>this.emit("drain"))}}[g_](e,r){let o=this[_g],a=o.blockRemain,n=a>=e.length&&r===0?e:e.slice(r,r+a);return o.write(n),o.blockRemain||(this[$l]="header",this[_g]=null,o.end()),n.length}[$Ae](e,r){let o=this[_g],a=this[g_](e,r);return this[_g]||this[XAe](o),a}[qg](e,r,o){!this[jf].length&&!this[qf]?this.emit(e,r,o):this[jf].push([e,r,o])}[XAe](e){switch(this[qg]("meta",this[Dh]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[ec]=JAe.parse(this[Dh],this[ec],!1);break;case"GlobalExtendedHeader":this[p2]=JAe.parse(this[Dh],this[p2],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[ec]=this[ec]||Object.create(null),this[ec].path=this[Dh].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[ec]=this[ec]||Object.create(null),this[ec].linkpath=this[Dh].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Sh]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e){if(this[Sh])return;if(this[La]===null&&e){if(this[yi]&&(e=Buffer.concat([this[yi],e]),this[yi]=null),e.lengththis[ok](n)),this[La].on("error",n=>this.abort(n)),this[La].on("end",n=>{this[Hg]=!0,this[ok]()}),this[h2]=!0;let a=this[La][o?"end":"write"](e);return this[h2]=!1,a}}this[h2]=!0,this[La]?this[La].write(e):this[ok](e),this[h2]=!1;let r=this[jf].length?!1:this[qf]?this[qf].flowing:!0;return!r&&!this[jf].length&&this[qf].once("drain",o=>this.emit("drain")),r}[d_](e){e&&!this[Sh]&&(this[yi]=this[yi]?Buffer.concat([this[yi],e]):e)}[m_](){if(this[Hg]&&!this[ZAe]&&!this[Sh]&&!this[lk]){this[ZAe]=!0;let e=this[_g];if(e&&e.blockRemain){let r=this[yi]?this[yi].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${r} available)`,{entry:e}),this[yi]&&e.write(this[yi]),e.end()}this[qg](ck)}}[ok](e){if(this[lk])this[d_](e);else if(!e&&!this[yi])this[m_]();else{if(this[lk]=!0,this[yi]){this[d_](e);let r=this[yi];this[yi]=null,this[ak](r)}else this[ak](e);for(;this[yi]&&this[yi].length>=512&&!this[Sh]&&!this[Ak];){let r=this[yi];this[yi]=null,this[ak](r)}this[lk]=!1}(!this[yi]||this[Hg])&&this[m_]()}[ak](e){let r=0,o=e.length;for(;r+512<=o&&!this[Sh]&&!this[Ak];)switch(this[$l]){case"begin":case"header":this[efe](e,r),r+=512;break;case"ignore":case"body":r+=this[g_](e,r);break;case"meta":r+=this[$Ae](e,r);break;default:throw new Error("invalid state: "+this[$l])}r{"use strict";var wlt=Fy(),nfe=fk(),zy=ve("fs"),Blt=Jy(),rfe=ve("path"),y_=_y();sfe.exports=(t,e,r)=>{typeof t=="function"?(r=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),typeof e=="function"&&(r=e,e=null),e?e=Array.from(e):e=[];let o=wlt(t);if(o.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!o.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return e.length&&Dlt(o,e),o.noResume||vlt(o),o.file&&o.sync?Slt(o):o.file?Plt(o,r):ife(o)};var vlt=t=>{let e=t.onentry;t.onentry=e?r=>{e(r),r.resume()}:r=>r.resume()},Dlt=(t,e)=>{let r=new Map(e.map(n=>[y_(n),!0])),o=t.filter,a=(n,u)=>{let A=u||rfe.parse(n).root||".",p=n===A?!1:r.has(n)?r.get(n):a(rfe.dirname(n),A);return r.set(n,p),p};t.filter=o?(n,u)=>o(n,u)&&a(y_(n)):n=>a(y_(n))},Slt=t=>{let e=ife(t),r=t.file,o=!0,a;try{let n=zy.statSync(r),u=t.maxReadSize||16*1024*1024;if(n.size{let r=new nfe(t),o=t.maxReadSize||16*1024*1024,a=t.file,n=new Promise((u,A)=>{r.on("error",A),r.on("end",u),zy.stat(a,(p,h)=>{if(p)A(p);else{let E=new Blt.ReadStream(a,{readSize:o,size:h.size});E.on("error",A),E.pipe(r)}})});return e?n.then(e,e):n},ife=t=>new nfe(t)});var Afe=_((Y4t,ufe)=>{"use strict";var xlt=Fy(),hk=Zb(),ofe=Jy(),afe=pk(),lfe=ve("path");ufe.exports=(t,e,r)=>{if(typeof e=="function"&&(r=e),Array.isArray(t)&&(e=t,t={}),!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");e=Array.from(e);let o=xlt(t);if(o.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!o.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return o.file&&o.sync?blt(o,e):o.file?klt(o,e,r):o.sync?Qlt(o,e):Flt(o,e)};var blt=(t,e)=>{let r=new hk.Sync(t),o=new ofe.WriteStreamSync(t.file,{mode:t.mode||438});r.pipe(o),cfe(r,e)},klt=(t,e,r)=>{let o=new hk(t),a=new ofe.WriteStream(t.file,{mode:t.mode||438});o.pipe(a);let n=new Promise((u,A)=>{a.on("error",A),a.on("close",u),o.on("error",A)});return E_(o,e),r?n.then(r,r):n},cfe=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?afe({file:lfe.resolve(t.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:o=>t.add(o)}):t.add(r)}),t.end()},E_=(t,e)=>{for(;e.length;){let r=e.shift();if(r.charAt(0)==="@")return afe({file:lfe.resolve(t.cwd,r.substr(1)),noResume:!0,onentry:o=>t.add(o)}).then(o=>E_(t,e));t.add(r)}t.end()},Qlt=(t,e)=>{let r=new hk.Sync(t);return cfe(r,e),r},Flt=(t,e)=>{let r=new hk(t);return E_(r,e),r}});var C_=_((V4t,yfe)=>{"use strict";var Rlt=Fy(),ffe=Zb(),dl=ve("fs"),pfe=Jy(),hfe=pk(),gfe=ve("path"),dfe=Uy();yfe.exports=(t,e,r)=>{let o=Rlt(t);if(!o.file)throw new TypeError("file is required");if(o.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),o.sync?Tlt(o,e):Nlt(o,e,r)};var Tlt=(t,e)=>{let r=new ffe.Sync(t),o=!0,a,n;try{try{a=dl.openSync(t.file,"r+")}catch(p){if(p.code==="ENOENT")a=dl.openSync(t.file,"w+");else throw p}let u=dl.fstatSync(a),A=Buffer.alloc(512);e:for(n=0;nu.size)break;n+=h,t.mtimeCache&&t.mtimeCache.set(p.path,p.mtime)}o=!1,Llt(t,r,n,a,e)}finally{if(o)try{dl.closeSync(a)}catch{}}},Llt=(t,e,r,o,a)=>{let n=new pfe.WriteStreamSync(t.file,{fd:o,start:r});e.pipe(n),Olt(e,a)},Nlt=(t,e,r)=>{e=Array.from(e);let o=new ffe(t),a=(u,A,p)=>{let h=(C,T)=>{C?dl.close(u,N=>p(C)):p(null,T)},E=0;if(A===0)return h(null,0);let w=0,D=Buffer.alloc(512),b=(C,T)=>{if(C)return h(C);if(w+=T,w<512&&T)return dl.read(u,D,w,D.length-w,E+w,b);if(E===0&&D[0]===31&&D[1]===139)return h(new Error("cannot append to compressed archives"));if(w<512)return h(null,E);let N=new dfe(D);if(!N.cksumValid)return h(null,E);let U=512*Math.ceil(N.size/512);if(E+U+512>A||(E+=U+512,E>=A))return h(null,E);t.mtimeCache&&t.mtimeCache.set(N.path,N.mtime),w=0,dl.read(u,D,0,512,E,b)};dl.read(u,D,0,512,E,b)},n=new Promise((u,A)=>{o.on("error",A);let p="r+",h=(E,w)=>{if(E&&E.code==="ENOENT"&&p==="r+")return p="w+",dl.open(t.file,p,h);if(E)return A(E);dl.fstat(w,(D,b)=>{if(D)return dl.close(w,()=>A(D));a(w,b.size,(C,T)=>{if(C)return A(C);let N=new pfe.WriteStream(t.file,{fd:w,start:T});o.pipe(N),N.on("error",A),N.on("close",u),mfe(o,e)})})};dl.open(t.file,p,h)});return r?n.then(r,r):n},Olt=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?hfe({file:gfe.resolve(t.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:o=>t.add(o)}):t.add(r)}),t.end()},mfe=(t,e)=>{for(;e.length;){let r=e.shift();if(r.charAt(0)==="@")return hfe({file:gfe.resolve(t.cwd,r.substr(1)),noResume:!0,onentry:o=>t.add(o)}).then(o=>mfe(t,e));t.add(r)}t.end()}});var Cfe=_((K4t,Efe)=>{"use strict";var Mlt=Fy(),Ult=C_();Efe.exports=(t,e,r)=>{let o=Mlt(t);if(!o.file)throw new TypeError("file is required");if(o.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),_lt(o),Ult(o,e,r)};var _lt=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(r,o)=>e(r,o)&&!(t.mtimeCache.get(r)>o.mtime):(r,o)=>!(t.mtimeCache.get(r)>o.mtime)}});var Bfe=_((J4t,wfe)=>{var{promisify:Ife}=ve("util"),Ph=ve("fs"),Hlt=t=>{if(!t)t={mode:511,fs:Ph};else if(typeof t=="object")t={mode:511,fs:Ph,...t};else if(typeof t=="number")t={mode:t,fs:Ph};else if(typeof t=="string")t={mode:parseInt(t,8),fs:Ph};else throw new TypeError("invalid options argument");return t.mkdir=t.mkdir||t.fs.mkdir||Ph.mkdir,t.mkdirAsync=Ife(t.mkdir),t.stat=t.stat||t.fs.stat||Ph.stat,t.statAsync=Ife(t.stat),t.statSync=t.statSync||t.fs.statSync||Ph.statSync,t.mkdirSync=t.mkdirSync||t.fs.mkdirSync||Ph.mkdirSync,t};wfe.exports=Hlt});var Dfe=_((z4t,vfe)=>{var qlt=process.platform,{resolve:jlt,parse:Glt}=ve("path"),Wlt=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=jlt(t),qlt==="win32"){let e=/[*|"<>?:]/,{root:r}=Glt(t);if(e.test(t.substr(r.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t};vfe.exports=Wlt});var kfe=_((X4t,bfe)=>{var{dirname:Sfe}=ve("path"),Pfe=(t,e,r=void 0)=>r===e?Promise.resolve():t.statAsync(e).then(o=>o.isDirectory()?r:void 0,o=>o.code==="ENOENT"?Pfe(t,Sfe(e),e):void 0),xfe=(t,e,r=void 0)=>{if(r!==e)try{return t.statSync(e).isDirectory()?r:void 0}catch(o){return o.code==="ENOENT"?xfe(t,Sfe(e),e):void 0}};bfe.exports={findMade:Pfe,findMadeSync:xfe}});var B_=_((Z4t,Ffe)=>{var{dirname:Qfe}=ve("path"),I_=(t,e,r)=>{e.recursive=!1;let o=Qfe(t);return o===t?e.mkdirAsync(t,e).catch(a=>{if(a.code!=="EISDIR")throw a}):e.mkdirAsync(t,e).then(()=>r||t,a=>{if(a.code==="ENOENT")return I_(o,e).then(n=>I_(t,e,n));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;return e.statAsync(t).then(n=>{if(n.isDirectory())return r;throw a},()=>{throw a})})},w_=(t,e,r)=>{let o=Qfe(t);if(e.recursive=!1,o===t)try{return e.mkdirSync(t,e)}catch(a){if(a.code!=="EISDIR")throw a;return}try{return e.mkdirSync(t,e),r||t}catch(a){if(a.code==="ENOENT")return w_(t,e,w_(o,e,r));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;try{if(!e.statSync(t).isDirectory())throw a}catch{throw a}}};Ffe.exports={mkdirpManual:I_,mkdirpManualSync:w_}});var Lfe=_(($4t,Tfe)=>{var{dirname:Rfe}=ve("path"),{findMade:Ylt,findMadeSync:Vlt}=kfe(),{mkdirpManual:Klt,mkdirpManualSync:Jlt}=B_(),zlt=(t,e)=>(e.recursive=!0,Rfe(t)===t?e.mkdirAsync(t,e):Ylt(e,t).then(o=>e.mkdirAsync(t,e).then(()=>o).catch(a=>{if(a.code==="ENOENT")return Klt(t,e);throw a}))),Xlt=(t,e)=>{if(e.recursive=!0,Rfe(t)===t)return e.mkdirSync(t,e);let o=Vlt(e,t);try{return e.mkdirSync(t,e),o}catch(a){if(a.code==="ENOENT")return Jlt(t,e);throw a}};Tfe.exports={mkdirpNative:zlt,mkdirpNativeSync:Xlt}});var Ufe=_((eUt,Mfe)=>{var Nfe=ve("fs"),Zlt=process.version,v_=Zlt.replace(/^v/,"").split("."),Ofe=+v_[0]>10||+v_[0]==10&&+v_[1]>=12,$lt=Ofe?t=>t.mkdir===Nfe.mkdir:()=>!1,ect=Ofe?t=>t.mkdirSync===Nfe.mkdirSync:()=>!1;Mfe.exports={useNative:$lt,useNativeSync:ect}});var Wfe=_((tUt,Gfe)=>{var Xy=Bfe(),Zy=Dfe(),{mkdirpNative:_fe,mkdirpNativeSync:Hfe}=Lfe(),{mkdirpManual:qfe,mkdirpManualSync:jfe}=B_(),{useNative:tct,useNativeSync:rct}=Ufe(),$y=(t,e)=>(t=Zy(t),e=Xy(e),tct(e)?_fe(t,e):qfe(t,e)),nct=(t,e)=>(t=Zy(t),e=Xy(e),rct(e)?Hfe(t,e):jfe(t,e));$y.sync=nct;$y.native=(t,e)=>_fe(Zy(t),Xy(e));$y.manual=(t,e)=>qfe(Zy(t),Xy(e));$y.nativeSync=(t,e)=>Hfe(Zy(t),Xy(e));$y.manualSync=(t,e)=>jfe(Zy(t),Xy(e));Gfe.exports=$y});var Zfe=_((rUt,Xfe)=>{"use strict";var tc=ve("fs"),Gg=ve("path"),ict=tc.lchown?"lchown":"chown",sct=tc.lchownSync?"lchownSync":"chownSync",Vfe=tc.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),Yfe=(t,e,r)=>{try{return tc[sct](t,e,r)}catch(o){if(o.code!=="ENOENT")throw o}},oct=(t,e,r)=>{try{return tc.chownSync(t,e,r)}catch(o){if(o.code!=="ENOENT")throw o}},act=Vfe?(t,e,r,o)=>a=>{!a||a.code!=="EISDIR"?o(a):tc.chown(t,e,r,o)}:(t,e,r,o)=>o,D_=Vfe?(t,e,r)=>{try{return Yfe(t,e,r)}catch(o){if(o.code!=="EISDIR")throw o;oct(t,e,r)}}:(t,e,r)=>Yfe(t,e,r),lct=process.version,Kfe=(t,e,r)=>tc.readdir(t,e,r),cct=(t,e)=>tc.readdirSync(t,e);/^v4\./.test(lct)&&(Kfe=(t,e,r)=>tc.readdir(t,r));var gk=(t,e,r,o)=>{tc[ict](t,e,r,act(t,e,r,a=>{o(a&&a.code!=="ENOENT"?a:null)}))},Jfe=(t,e,r,o,a)=>{if(typeof e=="string")return tc.lstat(Gg.resolve(t,e),(n,u)=>{if(n)return a(n.code!=="ENOENT"?n:null);u.name=e,Jfe(t,u,r,o,a)});if(e.isDirectory())S_(Gg.resolve(t,e.name),r,o,n=>{if(n)return a(n);let u=Gg.resolve(t,e.name);gk(u,r,o,a)});else{let n=Gg.resolve(t,e.name);gk(n,r,o,a)}},S_=(t,e,r,o)=>{Kfe(t,{withFileTypes:!0},(a,n)=>{if(a){if(a.code==="ENOENT")return o();if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return o(a)}if(a||!n.length)return gk(t,e,r,o);let u=n.length,A=null,p=h=>{if(!A){if(h)return o(A=h);if(--u===0)return gk(t,e,r,o)}};n.forEach(h=>Jfe(t,h,e,r,p))})},uct=(t,e,r,o)=>{if(typeof e=="string")try{let a=tc.lstatSync(Gg.resolve(t,e));a.name=e,e=a}catch(a){if(a.code==="ENOENT")return;throw a}e.isDirectory()&&zfe(Gg.resolve(t,e.name),r,o),D_(Gg.resolve(t,e.name),r,o)},zfe=(t,e,r)=>{let o;try{o=cct(t,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return;if(a.code==="ENOTDIR"||a.code==="ENOTSUP")return D_(t,e,r);throw a}return o&&o.length&&o.forEach(a=>uct(t,a,e,r)),D_(t,e,r)};Xfe.exports=S_;S_.sync=zfe});var rpe=_((nUt,P_)=>{"use strict";var $fe=Wfe(),rc=ve("fs"),dk=ve("path"),epe=Zfe(),$c=Oy(),mk=class extends Error{constructor(e,r){super("Cannot extract through symbolic link"),this.path=r,this.symlink=e}get name(){return"SylinkError"}},yk=class extends Error{constructor(e,r){super(r+": Cannot cd into '"+e+"'"),this.path=e,this.code=r}get name(){return"CwdError"}},Ek=(t,e)=>t.get($c(e)),g2=(t,e,r)=>t.set($c(e),r),Act=(t,e)=>{rc.stat(t,(r,o)=>{(r||!o.isDirectory())&&(r=new yk(t,r&&r.code||"ENOTDIR")),e(r)})};P_.exports=(t,e,r)=>{t=$c(t);let o=e.umask,a=e.mode|448,n=(a&o)!==0,u=e.uid,A=e.gid,p=typeof u=="number"&&typeof A=="number"&&(u!==e.processUid||A!==e.processGid),h=e.preserve,E=e.unlink,w=e.cache,D=$c(e.cwd),b=(N,U)=>{N?r(N):(g2(w,t,!0),U&&p?epe(U,u,A,J=>b(J)):n?rc.chmod(t,a,r):r())};if(w&&Ek(w,t)===!0)return b();if(t===D)return Act(t,b);if(h)return $fe(t,{mode:a}).then(N=>b(null,N),b);let T=$c(dk.relative(D,t)).split("/");Ck(D,T,a,w,E,D,null,b)};var Ck=(t,e,r,o,a,n,u,A)=>{if(!e.length)return A(null,u);let p=e.shift(),h=$c(dk.resolve(t+"/"+p));if(Ek(o,h))return Ck(h,e,r,o,a,n,u,A);rc.mkdir(h,r,tpe(h,e,r,o,a,n,u,A))},tpe=(t,e,r,o,a,n,u,A)=>p=>{p?rc.lstat(t,(h,E)=>{if(h)h.path=h.path&&$c(h.path),A(h);else if(E.isDirectory())Ck(t,e,r,o,a,n,u,A);else if(a)rc.unlink(t,w=>{if(w)return A(w);rc.mkdir(t,r,tpe(t,e,r,o,a,n,u,A))});else{if(E.isSymbolicLink())return A(new mk(t,t+"/"+e.join("/")));A(p)}}):(u=u||t,Ck(t,e,r,o,a,n,u,A))},fct=t=>{let e=!1,r="ENOTDIR";try{e=rc.statSync(t).isDirectory()}catch(o){r=o.code}finally{if(!e)throw new yk(t,r)}};P_.exports.sync=(t,e)=>{t=$c(t);let r=e.umask,o=e.mode|448,a=(o&r)!==0,n=e.uid,u=e.gid,A=typeof n=="number"&&typeof u=="number"&&(n!==e.processUid||u!==e.processGid),p=e.preserve,h=e.unlink,E=e.cache,w=$c(e.cwd),D=N=>{g2(E,t,!0),N&&A&&epe.sync(N,n,u),a&&rc.chmodSync(t,o)};if(E&&Ek(E,t)===!0)return D();if(t===w)return fct(w),D();if(p)return D($fe.sync(t,o));let C=$c(dk.relative(w,t)).split("/"),T=null;for(let N=C.shift(),U=w;N&&(U+="/"+N);N=C.shift())if(U=$c(dk.resolve(U)),!Ek(E,U))try{rc.mkdirSync(U,o),T=T||U,g2(E,U,!0)}catch{let te=rc.lstatSync(U);if(te.isDirectory()){g2(E,U,!0);continue}else if(h){rc.unlinkSync(U),rc.mkdirSync(U,o),T=T||U,g2(E,U,!0);continue}else if(te.isSymbolicLink())return new mk(U,U+"/"+C.join("/"))}return D(T)}});var b_=_((iUt,npe)=>{var x_=Object.create(null),{hasOwnProperty:pct}=Object.prototype;npe.exports=t=>(pct.call(x_,t)||(x_[t]=t.normalize("NFKD")),x_[t])});var ape=_((sUt,ope)=>{var ipe=ve("assert"),hct=b_(),gct=_y(),{join:spe}=ve("path"),dct=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,mct=dct==="win32";ope.exports=()=>{let t=new Map,e=new Map,r=h=>h.split("/").slice(0,-1).reduce((w,D)=>(w.length&&(D=spe(w[w.length-1],D)),w.push(D||"/"),w),[]),o=new Set,a=h=>{let E=e.get(h);if(!E)throw new Error("function does not have any path reservations");return{paths:E.paths.map(w=>t.get(w)),dirs:[...E.dirs].map(w=>t.get(w))}},n=h=>{let{paths:E,dirs:w}=a(h);return E.every(D=>D[0]===h)&&w.every(D=>D[0]instanceof Set&&D[0].has(h))},u=h=>o.has(h)||!n(h)?!1:(o.add(h),h(()=>A(h)),!0),A=h=>{if(!o.has(h))return!1;let{paths:E,dirs:w}=e.get(h),D=new Set;return E.forEach(b=>{let C=t.get(b);ipe.equal(C[0],h),C.length===1?t.delete(b):(C.shift(),typeof C[0]=="function"?D.add(C[0]):C[0].forEach(T=>D.add(T)))}),w.forEach(b=>{let C=t.get(b);ipe(C[0]instanceof Set),C[0].size===1&&C.length===1?t.delete(b):C[0].size===1?(C.shift(),D.add(C[0])):C[0].delete(h)}),o.delete(h),D.forEach(b=>u(b)),!0};return{check:n,reserve:(h,E)=>{h=mct?["win32 parallelization disabled"]:h.map(D=>hct(gct(spe(D))).toLowerCase());let w=new Set(h.map(D=>r(D)).reduce((D,b)=>D.concat(b)));return e.set(E,{dirs:w,paths:h}),h.forEach(D=>{let b=t.get(D);b?b.push(E):t.set(D,[E])}),w.forEach(D=>{let b=t.get(D);b?b[b.length-1]instanceof Set?b[b.length-1].add(E):b.push(new Set([E])):t.set(D,[new Set([E])])}),u(E)}}}});var upe=_((oUt,cpe)=>{var yct=process.platform,Ect=yct==="win32",Cct=global.__FAKE_TESTING_FS__||ve("fs"),{O_CREAT:Ict,O_TRUNC:wct,O_WRONLY:Bct,UV_FS_O_FILEMAP:lpe=0}=Cct.constants,vct=Ect&&!!lpe,Dct=512*1024,Sct=lpe|wct|Ict|Bct;cpe.exports=vct?t=>t"w"});var M_=_((aUt,vpe)=>{"use strict";var Pct=ve("assert"),xct=fk(),Fn=ve("fs"),bct=Jy(),Gf=ve("path"),Ipe=rpe(),Ape=M3(),kct=ape(),Qct=U3(),ml=Oy(),Fct=_y(),Rct=b_(),fpe=Symbol("onEntry"),F_=Symbol("checkFs"),ppe=Symbol("checkFs2"),Bk=Symbol("pruneCache"),R_=Symbol("isReusable"),nc=Symbol("makeFs"),T_=Symbol("file"),L_=Symbol("directory"),vk=Symbol("link"),hpe=Symbol("symlink"),gpe=Symbol("hardlink"),dpe=Symbol("unsupported"),mpe=Symbol("checkPath"),xh=Symbol("mkdir"),Po=Symbol("onError"),Ik=Symbol("pending"),ype=Symbol("pend"),eE=Symbol("unpend"),k_=Symbol("ended"),Q_=Symbol("maybeClose"),N_=Symbol("skip"),d2=Symbol("doChown"),m2=Symbol("uid"),y2=Symbol("gid"),E2=Symbol("checkedCwd"),wpe=ve("crypto"),Bpe=upe(),Tct=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,C2=Tct==="win32",Lct=(t,e)=>{if(!C2)return Fn.unlink(t,e);let r=t+".DELETE."+wpe.randomBytes(16).toString("hex");Fn.rename(t,r,o=>{if(o)return e(o);Fn.unlink(r,e)})},Nct=t=>{if(!C2)return Fn.unlinkSync(t);let e=t+".DELETE."+wpe.randomBytes(16).toString("hex");Fn.renameSync(t,e),Fn.unlinkSync(e)},Epe=(t,e,r)=>t===t>>>0?t:e===e>>>0?e:r,Cpe=t=>Rct(Fct(ml(t))).toLowerCase(),Oct=(t,e)=>{e=Cpe(e);for(let r of t.keys()){let o=Cpe(r);(o===e||o.indexOf(e+"/")===0)&&t.delete(r)}},Mct=t=>{for(let e of t.keys())t.delete(e)},I2=class extends xct{constructor(e){if(e||(e={}),e.ondone=r=>{this[k_]=!0,this[Q_]()},super(e),this[E2]=!1,this.reservations=kct(),this.transform=typeof e.transform=="function"?e.transform:null,this.writable=!0,this.readable=!1,this[Ik]=0,this[k_]=!1,this.dirCache=e.dirCache||new Map,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||C2,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=ml(Gf.resolve(e.cwd||process.cwd())),this.strip=+e.strip||0,this.processUmask=e.noChmod?0:process.umask(),this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",r=>this[fpe](r))}warn(e,r,o={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(o.recoverable=!1),super.warn(e,r,o)}[Q_](){this[k_]&&this[Ik]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close"))}[mpe](e){if(this.strip){let r=ml(e.path).split("/");if(r.length=this.strip)e.linkpath=o.slice(this.strip).join("/");else return!1}}if(!this.preservePaths){let r=ml(e.path),o=r.split("/");if(o.includes("..")||C2&&/^[a-z]:\.\.$/i.test(o[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:r}),!1;let[a,n]=Qct(r);a&&(e.path=n,this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:e,path:r}))}if(Gf.isAbsolute(e.path)?e.absolute=ml(Gf.resolve(e.path)):e.absolute=ml(Gf.resolve(this.cwd,e.path)),!this.preservePaths&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:ml(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=Gf.win32.parse(e.absolute);e.absolute=r+Ape.encode(e.absolute.substr(r.length));let{root:o}=Gf.win32.parse(e.path);e.path=o+Ape.encode(e.path.substr(o.length))}return!0}[fpe](e){if(!this[mpe](e))return e.resume();switch(Pct.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[F_](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[dpe](e)}}[Po](e,r){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:r}),this[eE](),r.resume())}[xh](e,r,o){Ipe(ml(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r,noChmod:this.noChmod},o)}[d2](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[m2](e){return Epe(this.uid,e.uid,this.processUid)}[y2](e){return Epe(this.gid,e.gid,this.processGid)}[T_](e,r){let o=e.mode&4095||this.fmode,a=new bct.WriteStream(e.absolute,{flags:Bpe(e.size),mode:o,autoClose:!1});a.on("error",p=>{a.fd&&Fn.close(a.fd,()=>{}),a.write=()=>!0,this[Po](p,e),r()});let n=1,u=p=>{if(p){a.fd&&Fn.close(a.fd,()=>{}),this[Po](p,e),r();return}--n===0&&Fn.close(a.fd,h=>{h?this[Po](h,e):this[eE](),r()})};a.on("finish",p=>{let h=e.absolute,E=a.fd;if(e.mtime&&!this.noMtime){n++;let w=e.atime||new Date,D=e.mtime;Fn.futimes(E,w,D,b=>b?Fn.utimes(h,w,D,C=>u(C&&b)):u())}if(this[d2](e)){n++;let w=this[m2](e),D=this[y2](e);Fn.fchown(E,w,D,b=>b?Fn.chown(h,w,D,C=>u(C&&b)):u())}u()});let A=this.transform&&this.transform(e)||e;A!==e&&(A.on("error",p=>{this[Po](p,e),r()}),e.pipe(A)),A.pipe(a)}[L_](e,r){let o=e.mode&4095||this.dmode;this[xh](e.absolute,o,a=>{if(a){this[Po](a,e),r();return}let n=1,u=A=>{--n===0&&(r(),this[eE](),e.resume())};e.mtime&&!this.noMtime&&(n++,Fn.utimes(e.absolute,e.atime||new Date,e.mtime,u)),this[d2](e)&&(n++,Fn.chown(e.absolute,this[m2](e),this[y2](e),u)),u()})}[dpe](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[hpe](e,r){this[vk](e,e.linkpath,"symlink",r)}[gpe](e,r){let o=ml(Gf.resolve(this.cwd,e.linkpath));this[vk](e,o,"link",r)}[ype](){this[Ik]++}[eE](){this[Ik]--,this[Q_]()}[N_](e){this[eE](),e.resume()}[R_](e,r){return e.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!C2}[F_](e){this[ype]();let r=[e.path];e.linkpath&&r.push(e.linkpath),this.reservations.reserve(r,o=>this[ppe](e,o))}[Bk](e){e.type==="SymbolicLink"?Mct(this.dirCache):e.type!=="Directory"&&Oct(this.dirCache,e.absolute)}[ppe](e,r){this[Bk](e);let o=A=>{this[Bk](e),r(A)},a=()=>{this[xh](this.cwd,this.dmode,A=>{if(A){this[Po](A,e),o();return}this[E2]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let A=ml(Gf.dirname(e.absolute));if(A!==this.cwd)return this[xh](A,this.dmode,p=>{if(p){this[Po](p,e),o();return}u()})}u()},u=()=>{Fn.lstat(e.absolute,(A,p)=>{if(p&&(this.keep||this.newer&&p.mtime>e.mtime)){this[N_](e),o();return}if(A||this[R_](e,p))return this[nc](null,e,o);if(p.isDirectory()){if(e.type==="Directory"){let h=!this.noChmod&&e.mode&&(p.mode&4095)!==e.mode,E=w=>this[nc](w,e,o);return h?Fn.chmod(e.absolute,e.mode,E):E()}if(e.absolute!==this.cwd)return Fn.rmdir(e.absolute,h=>this[nc](h,e,o))}if(e.absolute===this.cwd)return this[nc](null,e,o);Lct(e.absolute,h=>this[nc](h,e,o))})};this[E2]?n():a()}[nc](e,r,o){if(e){this[Po](e,r),o();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[T_](r,o);case"Link":return this[gpe](r,o);case"SymbolicLink":return this[hpe](r,o);case"Directory":case"GNUDumpDir":return this[L_](r,o)}}[vk](e,r,o,a){Fn[o](r,e.absolute,n=>{n?this[Po](n,e):(this[eE](),e.resume()),a()})}},wk=t=>{try{return[null,t()]}catch(e){return[e,null]}},O_=class extends I2{[nc](e,r){return super[nc](e,r,()=>{})}[F_](e){if(this[Bk](e),!this[E2]){let n=this[xh](this.cwd,this.dmode);if(n)return this[Po](n,e);this[E2]=!0}if(e.absolute!==this.cwd){let n=ml(Gf.dirname(e.absolute));if(n!==this.cwd){let u=this[xh](n,this.dmode);if(u)return this[Po](u,e)}}let[r,o]=wk(()=>Fn.lstatSync(e.absolute));if(o&&(this.keep||this.newer&&o.mtime>e.mtime))return this[N_](e);if(r||this[R_](e,o))return this[nc](null,e);if(o.isDirectory()){if(e.type==="Directory"){let u=!this.noChmod&&e.mode&&(o.mode&4095)!==e.mode,[A]=u?wk(()=>{Fn.chmodSync(e.absolute,e.mode)}):[];return this[nc](A,e)}let[n]=wk(()=>Fn.rmdirSync(e.absolute));this[nc](n,e)}let[a]=e.absolute===this.cwd?[]:wk(()=>Nct(e.absolute));this[nc](a,e)}[T_](e,r){let o=e.mode&4095||this.fmode,a=A=>{let p;try{Fn.closeSync(n)}catch(h){p=h}(A||p)&&this[Po](A||p,e),r()},n;try{n=Fn.openSync(e.absolute,Bpe(e.size),o)}catch(A){return a(A)}let u=this.transform&&this.transform(e)||e;u!==e&&(u.on("error",A=>this[Po](A,e)),e.pipe(u)),u.on("data",A=>{try{Fn.writeSync(n,A,0,A.length)}catch(p){a(p)}}),u.on("end",A=>{let p=null;if(e.mtime&&!this.noMtime){let h=e.atime||new Date,E=e.mtime;try{Fn.futimesSync(n,h,E)}catch(w){try{Fn.utimesSync(e.absolute,h,E)}catch{p=w}}}if(this[d2](e)){let h=this[m2](e),E=this[y2](e);try{Fn.fchownSync(n,h,E)}catch(w){try{Fn.chownSync(e.absolute,h,E)}catch{p=p||w}}}a(p)})}[L_](e,r){let o=e.mode&4095||this.dmode,a=this[xh](e.absolute,o);if(a){this[Po](a,e),r();return}if(e.mtime&&!this.noMtime)try{Fn.utimesSync(e.absolute,e.atime||new Date,e.mtime)}catch{}if(this[d2](e))try{Fn.chownSync(e.absolute,this[m2](e),this[y2](e))}catch{}r(),e.resume()}[xh](e,r){try{return Ipe.sync(ml(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(o){return o}}[vk](e,r,o,a){try{Fn[o+"Sync"](r,e.absolute),a(),e.resume()}catch(n){return this[Po](n,e)}}};I2.Sync=O_;vpe.exports=I2});var bpe=_((lUt,xpe)=>{"use strict";var Uct=Fy(),Dk=M_(),Spe=ve("fs"),Ppe=Jy(),Dpe=ve("path"),U_=_y();xpe.exports=(t,e,r)=>{typeof t=="function"?(r=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),typeof e=="function"&&(r=e,e=null),e?e=Array.from(e):e=[];let o=Uct(t);if(o.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!o.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return e.length&&_ct(o,e),o.file&&o.sync?Hct(o):o.file?qct(o,r):o.sync?jct(o):Gct(o)};var _ct=(t,e)=>{let r=new Map(e.map(n=>[U_(n),!0])),o=t.filter,a=(n,u)=>{let A=u||Dpe.parse(n).root||".",p=n===A?!1:r.has(n)?r.get(n):a(Dpe.dirname(n),A);return r.set(n,p),p};t.filter=o?(n,u)=>o(n,u)&&a(U_(n)):n=>a(U_(n))},Hct=t=>{let e=new Dk.Sync(t),r=t.file,o=Spe.statSync(r),a=t.maxReadSize||16*1024*1024;new Ppe.ReadStreamSync(r,{readSize:a,size:o.size}).pipe(e)},qct=(t,e)=>{let r=new Dk(t),o=t.maxReadSize||16*1024*1024,a=t.file,n=new Promise((u,A)=>{r.on("error",A),r.on("close",u),Spe.stat(a,(p,h)=>{if(p)A(p);else{let E=new Ppe.ReadStream(a,{readSize:o,size:h.size});E.on("error",A),E.pipe(r)}})});return e?n.then(e,e):n},jct=t=>new Dk.Sync(t),Gct=t=>new Dk(t)});var kpe=_(us=>{"use strict";us.c=us.create=Afe();us.r=us.replace=C_();us.t=us.list=pk();us.u=us.update=Cfe();us.x=us.extract=bpe();us.Pack=Zb();us.Unpack=M_();us.Parse=fk();us.ReadEntry=Lb();us.WriteEntry=J3();us.Header=Uy();us.Pax=Ob();us.types=Q3()});var __,Qpe,bh,w2,B2,Fpe=It(()=>{__=et(lg()),Qpe=ve("worker_threads"),bh=Symbol("kTaskInfo"),w2=class{constructor(e,r){this.fn=e;this.limit=(0,__.default)(r.poolSize)}run(e){return this.limit(()=>this.fn(e))}},B2=class{constructor(e,r){this.source=e;this.workers=[];this.limit=(0,__.default)(r.poolSize),this.cleanupInterval=setInterval(()=>{if(this.limit.pendingCount===0&&this.limit.activeCount===0){let o=this.workers.pop();o?o.terminate():clearInterval(this.cleanupInterval)}},5e3).unref()}createWorker(){this.cleanupInterval.refresh();let e=new Qpe.Worker(this.source,{eval:!0,execArgv:[...process.execArgv,"--unhandled-rejections=strict"]});return e.on("message",r=>{if(!e[bh])throw new Error("Assertion failed: Worker sent a result without having a task assigned");e[bh].resolve(r),e[bh]=null,e.unref(),this.workers.push(e)}),e.on("error",r=>{e[bh]?.reject(r),e[bh]=null}),e.on("exit",r=>{r!==0&&e[bh]?.reject(new Error(`Worker exited with code ${r}`)),e[bh]=null}),e}run(e){return this.limit(()=>{let r=this.workers.pop()??this.createWorker();return r.ref(),new Promise((o,a)=>{r[bh]={resolve:o,reject:a},r.postMessage(e)})})}}});var Tpe=_((fUt,Rpe)=>{var H_;Rpe.exports.getContent=()=>(typeof H_>"u"&&(H_=ve("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),H_)});var $i={};Vt($i,{convertToZip:()=>Kct,convertToZipWorker:()=>G_,extractArchiveTo:()=>Upe,getDefaultTaskPool:()=>Ope,getTaskPoolForConfiguration:()=>Mpe,makeArchiveFromDirectory:()=>Vct});function Wct(t,e){switch(t){case"async":return new w2(G_,{poolSize:e});case"workers":return new B2((0,j_.getContent)(),{poolSize:e});default:throw new Error(`Assertion failed: Unknown value ${t} for taskPoolMode`)}}function Ope(){return typeof q_>"u"&&(q_=Wct("workers",Xi.availableParallelism())),q_}function Mpe(t){return typeof t>"u"?Ope():Al(Yct,t,()=>{let e=t.get("taskPoolMode"),r=t.get("taskPoolConcurrency");switch(e){case"async":return new w2(G_,{poolSize:r});case"workers":return new B2((0,j_.getContent)(),{poolSize:r});default:throw new Error(`Assertion failed: Unknown value ${e} for taskPoolMode`)}})}async function G_(t){let{tmpFile:e,tgz:r,compressionLevel:o,extractBufferOpts:a}=t,n=new Zi(e,{create:!0,level:o,stats:wa.makeDefaultStats()}),u=Buffer.from(r.buffer,r.byteOffset,r.byteLength);return await Upe(u,n,a),n.saveAndClose(),e}async function Vct(t,{baseFs:e=new _n,prefixPath:r=Bt.root,compressionLevel:o,inMemory:a=!1}={}){let n;if(a)n=new Zi(null,{level:o});else{let A=await ae.mktempPromise(),p=V.join(A,"archive.zip");n=new Zi(p,{create:!0,level:o})}let u=V.resolve(Bt.root,r);return await n.copyPromise(u,t,{baseFs:e,stableTime:!0,stableSort:!0}),n}async function Kct(t,e={}){let r=await ae.mktempPromise(),o=V.join(r,"archive.zip"),a=e.compressionLevel??e.configuration?.get("compressionLevel")??"mixed",n={prefixPath:e.prefixPath,stripComponents:e.stripComponents};return await(e.taskPool??Mpe(e.configuration)).run({tmpFile:o,tgz:t,compressionLevel:a,extractBufferOpts:n}),new Zi(o,{level:e.compressionLevel})}async function*Jct(t){let e=new Npe.default.Parse,r=new Lpe.PassThrough({objectMode:!0,autoDestroy:!0,emitClose:!0});e.on("entry",o=>{r.write(o)}),e.on("error",o=>{r.destroy(o)}),e.on("close",()=>{r.destroyed||r.end()}),e.end(t);for await(let o of r){let a=o;yield a,a.resume()}}async function Upe(t,e,{stripComponents:r=0,prefixPath:o=Bt.dot}={}){function a(n){if(n.path[0]==="/")return!0;let u=n.path.split(/\//g);return!!(u.some(A=>A==="..")||u.length<=r)}for await(let n of Jct(t)){if(a(n))continue;let u=V.normalize(Ae.toPortablePath(n.path)).replace(/\/$/,"").split(/\//g);if(u.length<=r)continue;let A=u.slice(r).join("/"),p=V.join(o,A),h=420;switch((n.type==="Directory"||(n.mode??0)&73)&&(h|=73),n.type){case"Directory":e.mkdirpSync(V.dirname(p),{chmod:493,utimes:[Si.SAFE_TIME,Si.SAFE_TIME]}),e.mkdirSync(p,{mode:h}),e.utimesSync(p,Si.SAFE_TIME,Si.SAFE_TIME);break;case"OldFile":case"File":e.mkdirpSync(V.dirname(p),{chmod:493,utimes:[Si.SAFE_TIME,Si.SAFE_TIME]}),e.writeFileSync(p,await Xm(n),{mode:h}),e.utimesSync(p,Si.SAFE_TIME,Si.SAFE_TIME);break;case"SymbolicLink":e.mkdirpSync(V.dirname(p),{chmod:493,utimes:[Si.SAFE_TIME,Si.SAFE_TIME]}),e.symlinkSync(n.linkpath,p),e.lutimesSync(p,Si.SAFE_TIME,Si.SAFE_TIME);break}}return e}var Lpe,Npe,j_,q_,Yct,_pe=It(()=>{Ve();St();sA();Lpe=ve("stream"),Npe=et(kpe());Fpe();Gl();j_=et(Tpe());Yct=new WeakMap});var qpe=_((W_,Hpe)=>{(function(t,e){typeof W_=="object"?Hpe.exports=e():typeof define=="function"&&define.amd?define(e):t.treeify=e()})(W_,function(){function t(a,n){var u=n?"\u2514":"\u251C";return a?u+="\u2500 ":u+="\u2500\u2500\u2510",u}function e(a,n){var u=[];for(var A in a)a.hasOwnProperty(A)&&(n&&typeof a[A]=="function"||u.push(A));return u}function r(a,n,u,A,p,h,E){var w="",D=0,b,C,T=A.slice(0);if(T.push([n,u])&&A.length>0&&(A.forEach(function(U,J){J>0&&(w+=(U[1]?" ":"\u2502")+" "),!C&&U[0]===n&&(C=!0)}),w+=t(a,u)+a,p&&(typeof n!="object"||n instanceof Date)&&(w+=": "+n),C&&(w+=" (circular ref.)"),E(w)),!C&&typeof n=="object"){var N=e(n,h);N.forEach(function(U){b=++D===N.length,r(U,n[U],b,T,p,h,E)})}}var o={};return o.asLines=function(a,n,u,A){var p=typeof u!="function"?u:!1;r(".",a,!1,[],n,p,A||u)},o.asTree=function(a,n,u){var A="";return r(".",a,!1,[],n,u,function(p){A+=p+` -`}),A},o})});var As={};Vt(As,{emitList:()=>zct,emitTree:()=>Ype,treeNodeToJson:()=>Wpe,treeNodeToTreeify:()=>Gpe});function Gpe(t,{configuration:e}){let r={},o=0,a=(n,u)=>{let A=Array.isArray(n)?n.entries():Object.entries(n);for(let[p,h]of A){if(!h)continue;let{label:E,value:w,children:D}=h,b=[];typeof E<"u"&&b.push(Cg(e,E,2)),typeof w<"u"&&b.push(Ut(e,w[0],w[1])),b.length===0&&b.push(Cg(e,`${p}`,2));let C=b.join(": ").trim(),T=`\0${o++}\0`,N=u[`${T}${C}`]={};typeof D<"u"&&a(D,N)}};if(typeof t.children>"u")throw new Error("The root node must only contain children");return a(t.children,r),r}function Wpe(t){let e=r=>{if(typeof r.children>"u"){if(typeof r.value>"u")throw new Error("Assertion failed: Expected a value to be set if the children are missing");return Ig(r.value[0],r.value[1])}let o=Array.isArray(r.children)?r.children.entries():Object.entries(r.children??{}),a=Array.isArray(r.children)?[]:{};for(let[n,u]of o)u&&(a[Xct(n)]=e(u));return typeof r.value>"u"?a:{value:Ig(r.value[0],r.value[1]),children:a}};return e(t)}function zct(t,{configuration:e,stdout:r,json:o}){let a=t.map(n=>({value:n}));Ype({children:a},{configuration:e,stdout:r,json:o})}function Ype(t,{configuration:e,stdout:r,json:o,separators:a=0}){if(o){let u=Array.isArray(t.children)?t.children.values():Object.values(t.children??{});for(let A of u)A&&r.write(`${JSON.stringify(Wpe(A))} -`);return}let n=(0,jpe.asTree)(Gpe(t,{configuration:e}),!1,!1);if(n=n.replace(/\0[0-9]+\0/g,""),a>=1&&(n=n.replace(/^([├└]─)/gm,`\u2502 -$1`).replace(/^│\n/,"")),a>=2)for(let u=0;u<2;++u)n=n.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502 -$2`).replace(/^│\n/,"");if(a>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");r.write(n)}function Xct(t){return typeof t=="string"?t.replace(/^\0[0-9]+\0/,""):t}var jpe,Vpe=It(()=>{jpe=et(qpe());Wl()});function v2(t){let e=t.match(Zct);if(!e?.groups)throw new Error("Assertion failed: Expected the checksum to match the requested pattern");let r=e.groups.cacheVersion?parseInt(e.groups.cacheVersion):null;return{cacheKey:e.groups.cacheKey??null,cacheVersion:r,cacheSpec:e.groups.cacheSpec??null,hash:e.groups.hash}}var Kpe,Y_,V_,Sk,Wr,Zct,K_=It(()=>{Ve();St();St();sA();Kpe=ve("crypto"),Y_=et(ve("fs"));Kl();ah();Gl();Io();V_=Zm(process.env.YARN_CACHE_CHECKPOINT_OVERRIDE??process.env.YARN_CACHE_VERSION_OVERRIDE??9),Sk=Zm(process.env.YARN_CACHE_VERSION_OVERRIDE??10),Wr=class t{constructor(e,{configuration:r,immutable:o=r.get("enableImmutableCache"),check:a=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.cacheId=`-${(0,Kpe.randomBytes)(8).toString("hex")}.tmp`;this.configuration=r,this.cwd=e,this.immutable=o,this.check=a;let{cacheSpec:n,cacheKey:u}=t.getCacheKey(r);this.cacheSpec=n,this.cacheKey=u}static async find(e,{immutable:r,check:o}={}){let a=new t(e.get("cacheFolder"),{configuration:e,immutable:r,check:o});return await a.setup(),a}static getCacheKey(e){let r=e.get("compressionLevel"),o=r!=="mixed"?`c${r}`:"";return{cacheKey:[Sk,o].join(""),cacheSpec:o}}get mirrorCwd(){if(!this.configuration.get("enableMirror"))return null;let e=`${this.configuration.get("globalFolder")}/cache`;return e!==this.cwd?e:null}getVersionFilename(e){return`${ly(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,r){let a=v2(r).hash.slice(0,10);return`${ly(e)}-${a}.zip`}isChecksumCompatible(e){if(e===null)return!1;let{cacheVersion:r,cacheSpec:o}=v2(e);if(r===null||r{let he=new Zi,De=V.join(Bt.root,_M(e));return he.mkdirSync(De,{recursive:!0}),he.writeJsonSync(V.join(De,mr.manifest),{name:rn(e),mocked:!0}),he},E=async(he,{isColdHit:De,controlPath:Ee=null})=>{if(Ee===null&&u.unstablePackages?.has(e.locatorHash))return{isValid:!0,hash:null};let g=r&&!De?v2(r).cacheKey:this.cacheKey,me=!u.skipIntegrityCheck||!r?`${g}/${await fx(he)}`:r;if(Ee!==null){let fe=!u.skipIntegrityCheck||!r?`${this.cacheKey}/${await fx(Ee)}`:r;if(me!==fe)throw new Jt(18,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}let Ce=null;switch(r!==null&&me!==r&&(this.check?Ce="throw":v2(r).cacheKey!==v2(me).cacheKey?Ce="update":Ce=this.configuration.get("checksumBehavior")),Ce){case null:case"update":return{isValid:!0,hash:me};case"ignore":return{isValid:!0,hash:r};case"reset":return{isValid:!1,hash:r};default:case"throw":throw new Jt(18,"The remote archive doesn't match the expected checksum")}},w=async he=>{if(!n)throw new Error(`Cache check required but no loader configured for ${jr(this.configuration,e)}`);let De=await n(),Ee=De.getRealPath();De.saveAndClose(),await ae.chmodPromise(Ee,420);let g=await E(he,{controlPath:Ee,isColdHit:!1});if(!g.isValid)throw new Error("Assertion failed: Expected a valid checksum");return g.hash},D=async()=>{if(A===null||!await ae.existsPromise(A)){let he=await n(),De=he.getRealPath();return he.saveAndClose(),{source:"loader",path:De}}return{source:"mirror",path:A}},b=async()=>{if(!n)throw new Error(`Cache entry required but missing for ${jr(this.configuration,e)}`);if(this.immutable)throw new Jt(56,`Cache entry required but missing for ${jr(this.configuration,e)}`);let{path:he,source:De}=await D(),{hash:Ee}=await E(he,{isColdHit:!0}),g=this.getLocatorPath(e,Ee),me=[];De!=="mirror"&&A!==null&&me.push(async()=>{let fe=`${A}${this.cacheId}`;await ae.copyFilePromise(he,fe,Y_.default.constants.COPYFILE_FICLONE),await ae.chmodPromise(fe,420),await ae.renamePromise(fe,A)}),(!u.mirrorWriteOnly||A===null)&&me.push(async()=>{let fe=`${g}${this.cacheId}`;await ae.copyFilePromise(he,fe,Y_.default.constants.COPYFILE_FICLONE),await ae.chmodPromise(fe,420),await ae.renamePromise(fe,g)});let Ce=u.mirrorWriteOnly?A??g:g;return await Promise.all(me.map(fe=>fe())),[!1,Ce,Ee]},C=async()=>{let De=(async()=>{let Ee=u.unstablePackages?.has(e.locatorHash),g=Ee||!r||this.isChecksumCompatible(r)?this.getLocatorPath(e,r):null,me=g!==null?this.markedFiles.has(g)||await p.existsPromise(g):!1,Ce=!!u.mockedPackages?.has(e.locatorHash)&&(!this.check||!me),fe=Ce||me,ie=fe?o:a;if(ie&&ie(),fe){let Z=null,Se=g;if(!Ce)if(this.check)Z=await w(Se);else{let Re=await E(Se,{isColdHit:!1});if(Re.isValid)Z=Re.hash;else return b()}return[Ce,Se,Z]}else{if(this.immutable&&Ee)throw new Jt(56,`Cache entry required but missing for ${jr(this.configuration,e)}; consider defining ${pe.pretty(this.configuration,"supportedArchitectures",pe.Type.CODE)} to cache packages for multiple systems`);return b()}})();this.mutexes.set(e.locatorHash,De);try{return await De}finally{this.mutexes.delete(e.locatorHash)}};for(let he;he=this.mutexes.get(e.locatorHash);)await he;let[T,N,U]=await C();T||this.markedFiles.add(N);let J,te=T?()=>h():()=>new Zi(N,{baseFs:p,readOnly:!0}),le=new Am(()=>rO(()=>J=te(),he=>`Failed to open the cache entry for ${jr(this.configuration,e)}: ${he}`),V),ce=new ju(N,{baseFs:le,pathUtils:V}),ue=()=>{J?.discardAndClose()},Ie=u.unstablePackages?.has(e.locatorHash)?null:U;return[ce,ue,Ie]}},Zct=/^(?:(?(?[0-9]+)(?.*))\/)?(?.*)$/});var Pk,Jpe=It(()=>{Pk=(r=>(r[r.SCRIPT=0]="SCRIPT",r[r.SHELLCODE=1]="SHELLCODE",r))(Pk||{})});var $ct,tE,J_=It(()=>{St();Ol();bf();Io();$ct=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(t,e,r,o)=>`${r}#commit=${o}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(t,e,r="",o,a)=>`https://${r}github.com/${o}.git#commit=${a}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(t,e,r="",o,a)=>`https://${r}github.com/${o}.git#commit=${a}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,t=>`npm:${t}`],[/^https?:\/\/[^/]+\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(t,e)=>mx({protocol:"npm:",source:null,selector:t,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,t=>`npm:${t}`]],tE=class{constructor(e){this.resolver=e;this.resolutions=null}async setup(e,{report:r}){let o=V.join(e.cwd,mr.lockfile);if(!ae.existsSync(o))return;let a=await ae.readFilePromise(o,"utf8"),n=Vi(a);if(Object.hasOwn(n,"__metadata"))return;let u=this.resolutions=new Map;for(let A of Object.keys(n)){let p=v1(A);if(!p){r.reportWarning(14,`Failed to parse the string "${A}" into a proper descriptor`);continue}let h=Fa(p.range)?kn(p,`npm:${p.range}`):p,{version:E,resolved:w}=n[A];if(!w)continue;let D;for(let[C,T]of $ct){let N=w.match(C);if(N){D=T(E,...N);break}}if(!D){r.reportWarning(14,`${Jn(e.configuration,h)}: Only some patterns can be imported from legacy lockfiles (not "${w}")`);continue}let b=h;try{let C=vg(h.range),T=v1(C.selector,!0);T&&(b=T)}catch{}u.set(h.descriptorHash,Ps(b,D))}}supportsDescriptor(e,r){return this.resolutions?this.resolutions.has(e.descriptorHash):!1}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!this.resolutions)throw new Error("Assertion failed: The resolution store should have been setup");let a=this.resolutions.get(e.descriptorHash);if(!a)throw new Error("Assertion failed: The resolution should have been registered");let n=NM(a),u=o.project.configuration.normalizeDependency(n);return await this.resolver.getCandidates(u,r,o)}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}}});var pA,zpe=It(()=>{Kl();n2();Wl();pA=class extends Ws{constructor({configuration:r,stdout:o,suggestInstall:a=!0}){super();this.errorCount=0;g1(this,{configuration:r}),this.configuration=r,this.stdout=o,this.suggestInstall=a}static async start(r,o){let a=new this(r);try{await o(a)}catch(n){a.reportExceptionOnce(n)}finally{await a.finalize()}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(r){}reportCacheMiss(r){}startSectionSync(r,o){return o()}async startSectionPromise(r,o){return await o()}startTimerSync(r,o,a){return(typeof o=="function"?o:a)()}async startTimerPromise(r,o,a){return await(typeof o=="function"?o:a)()}reportSeparator(){}reportInfo(r,o){}reportWarning(r,o){}reportError(r,o){this.errorCount+=1,this.stdout.write(`${Ut(this.configuration,"\u27A4","redBright")} ${this.formatNameWithHyperlink(r)}: ${o} -`)}reportProgress(r){return{...Promise.resolve().then(async()=>{for await(let{}of r);}),stop:()=>{}}}reportJson(r){}reportFold(r,o){}async finalize(){this.errorCount>0&&(this.stdout.write(` -`),this.stdout.write(`${Ut(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command. -`),this.suggestInstall&&this.stdout.write(`${Ut(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help. -`))}formatNameWithHyperlink(r){return r3(r,{configuration:this.configuration,json:!1})}}});var rE,z_=It(()=>{Io();rE=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return!!(r.project.storedResolutions.get(e.descriptorHash)||r.project.originalPackages.has(hx(e).locatorHash))}supportsLocator(e,r){return!!(r.project.originalPackages.has(e.locatorHash)&&!r.project.lockfileNeedsRefresh)}shouldPersistResolution(e,r){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,o){let a=o.project.storedResolutions.get(e.descriptorHash);if(a){let u=o.project.originalPackages.get(a);if(u)return[u]}let n=o.project.originalPackages.get(hx(e).locatorHash);if(n)return[n];throw new Error("Resolution expected from the lockfile data")}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let o=r.project.originalPackages.get(e.locatorHash);if(!o)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return o}}});function Wf(){}function eut(t,e,r,o,a){for(var n=0,u=e.length,A=0,p=0;nb.length?T:b}),h.value=t.join(E)}else h.value=t.join(r.slice(A,A+h.count));A+=h.count,h.added||(p+=h.count)}}var D=e[u-1];return u>1&&typeof D.value=="string"&&(D.added||D.removed)&&t.equals("",D.value)&&(e[u-2].value+=D.value,e.pop()),e}function tut(t){return{newPos:t.newPos,components:t.components.slice(0)}}function rut(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function $pe(t,e,r){return r=rut(r,{ignoreWhitespace:!0}),t8.diff(t,e,r)}function nut(t,e,r){return r8.diff(t,e,r)}function xk(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?xk=function(e){return typeof e}:xk=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xk(t)}function X_(t){return out(t)||aut(t)||lut(t)||cut()}function out(t){if(Array.isArray(t))return Z_(t)}function aut(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function lut(t,e){if(t){if(typeof t=="string")return Z_(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z_(t,e)}}function Z_(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r"u"&&(u.context=4);var A=nut(r,o,u);if(!A)return;A.push({value:"",lines:[]});function p(U){return U.map(function(J){return" "+J})}for(var h=[],E=0,w=0,D=[],b=1,C=1,T=function(J){var te=A[J],le=te.lines||te.value.replace(/\n$/,"").split(` -`);if(te.lines=le,te.added||te.removed){var ce;if(!E){var ue=A[J-1];E=b,w=C,ue&&(D=u.context>0?p(ue.lines.slice(-u.context)):[],E-=D.length,w-=D.length)}(ce=D).push.apply(ce,X_(le.map(function(fe){return(te.added?"+":"-")+fe}))),te.added?C+=le.length:b+=le.length}else{if(E)if(le.length<=u.context*2&&J=A.length-2&&le.length<=u.context){var g=/\n$/.test(r),me=/\n$/.test(o),Ce=le.length==0&&D.length>Ee.oldLines;!g&&Ce&&r.length>0&&D.splice(Ee.oldLines,0,"\\ No newline at end of file"),(!g&&!Ce||!me)&&D.push("\\ No newline at end of file")}h.push(Ee),E=0,w=0,D=[]}b+=le.length,C+=le.length}},N=0;N{Wf.prototype={diff:function(e,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.callback;typeof o=="function"&&(a=o,o={}),this.options=o;var n=this;function u(T){return a?(setTimeout(function(){a(void 0,T)},0),!0):T}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var A=r.length,p=e.length,h=1,E=A+p;o.maxEditLength&&(E=Math.min(E,o.maxEditLength));var w=[{newPos:-1,components:[]}],D=this.extractCommon(w[0],r,e,0);if(w[0].newPos+1>=A&&D+1>=p)return u([{value:this.join(r),count:r.length}]);function b(){for(var T=-1*h;T<=h;T+=2){var N=void 0,U=w[T-1],J=w[T+1],te=(J?J.newPos:0)-T;U&&(w[T-1]=void 0);var le=U&&U.newPos+1=A&&te+1>=p)return u(eut(n,N.components,r,e,n.useLongestToken));w[T]=N}h++}if(a)(function T(){setTimeout(function(){if(h>E)return a();b()||T()},0)})();else for(;h<=E;){var C=b();if(C)return C}},pushComponent:function(e,r,o){var a=e[e.length-1];a&&a.added===r&&a.removed===o?e[e.length-1]={count:a.count+1,added:r,removed:o}:e.push({count:1,added:r,removed:o})},extractCommon:function(e,r,o,a){for(var n=r.length,u=o.length,A=e.newPos,p=A-a,h=0;A+1"u"?r:u}:o;return typeof t=="string"?t:JSON.stringify($_(t,null,null,a),a," ")};D2.equals=function(t,e){return Wf.prototype.equals.call(D2,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};e8=new Wf;e8.tokenize=function(t){return t.slice()};e8.join=e8.removeEmpty=function(t){return t}});var rhe=_((HUt,the)=>{var Aut=jl(),fut=fy(),put=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hut=/^\w*$/;function gut(t,e){if(Aut(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||fut(t)?!0:hut.test(t)||!put.test(t)||e!=null&&t in Object(e)}the.exports=gut});var she=_((qUt,ihe)=>{var nhe=mP(),dut="Expected a function";function i8(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(dut);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],n=r.cache;if(n.has(a))return n.get(a);var u=t.apply(this,o);return r.cache=n.set(a,u)||n,u};return r.cache=new(i8.Cache||nhe),r}i8.Cache=nhe;ihe.exports=i8});var ahe=_((jUt,ohe)=>{var mut=she(),yut=500;function Eut(t){var e=mut(t,function(o){return r.size===yut&&r.clear(),o}),r=e.cache;return e}ohe.exports=Eut});var s8=_((GUt,lhe)=>{var Cut=ahe(),Iut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wut=/\\(\\)?/g,But=Cut(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Iut,function(r,o,a,n){e.push(a?n.replace(wut,"$1"):o||r)}),e});lhe.exports=But});var Wg=_((WUt,che)=>{var vut=jl(),Dut=rhe(),Sut=s8(),Put=t2();function xut(t,e){return vut(t)?t:Dut(t,e)?[t]:Sut(Put(t))}che.exports=xut});var nE=_((YUt,uhe)=>{var but=fy(),kut=1/0;function Qut(t){if(typeof t=="string"||but(t))return t;var e=t+"";return e=="0"&&1/t==-kut?"-0":e}uhe.exports=Qut});var bk=_((VUt,Ahe)=>{var Fut=Wg(),Rut=nE();function Tut(t,e){e=Fut(e,t);for(var r=0,o=e.length;t!=null&&r{var Lut=RP(),Nut=Wg(),Out=n1(),fhe=cl(),Mut=nE();function Uut(t,e,r,o){if(!fhe(t))return t;e=Nut(e,t);for(var a=-1,n=e.length,u=n-1,A=t;A!=null&&++a{var _ut=bk(),Hut=o8(),qut=Wg();function jut(t,e,r){for(var o=-1,a=e.length,n={};++o{function Gut(t,e){return t!=null&&e in Object(t)}dhe.exports=Gut});var a8=_((XUt,yhe)=>{var Wut=Wg(),Yut=e1(),Vut=jl(),Kut=n1(),Jut=wP(),zut=nE();function Xut(t,e,r){e=Wut(e,t);for(var o=-1,a=e.length,n=!1;++o{var Zut=mhe(),$ut=a8();function eAt(t,e){return t!=null&&$ut(t,e,Zut)}Ehe.exports=eAt});var whe=_(($Ut,Ihe)=>{var tAt=ghe(),rAt=Che();function nAt(t,e){return tAt(t,e,function(r,o){return rAt(t,o)})}Ihe.exports=nAt});var She=_((e3t,Dhe)=>{var Bhe=dg(),iAt=e1(),sAt=jl(),vhe=Bhe?Bhe.isConcatSpreadable:void 0;function oAt(t){return sAt(t)||iAt(t)||!!(vhe&&t&&t[vhe])}Dhe.exports=oAt});var bhe=_((t3t,xhe)=>{var aAt=CP(),lAt=She();function Phe(t,e,r,o,a){var n=-1,u=t.length;for(r||(r=lAt),a||(a=[]);++n0&&r(A)?e>1?Phe(A,e-1,r,o,a):aAt(a,A):o||(a[a.length]=A)}return a}xhe.exports=Phe});var Qhe=_((r3t,khe)=>{var cAt=bhe();function uAt(t){var e=t==null?0:t.length;return e?cAt(t,1):[]}khe.exports=uAt});var l8=_((n3t,Fhe)=>{var AAt=Qhe(),fAt=KN(),pAt=JN();function hAt(t){return pAt(fAt(t,void 0,AAt),t+"")}Fhe.exports=hAt});var c8=_((i3t,Rhe)=>{var gAt=whe(),dAt=l8(),mAt=dAt(function(t,e){return t==null?{}:gAt(t,e)});Rhe.exports=mAt});var kk,The=It(()=>{Kl();kk=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return this.resolver.supportsDescriptor(e,r)}supportsLocator(e,r){return this.resolver.supportsLocator(e,r)}shouldPersistResolution(e,r){return this.resolver.shouldPersistResolution(e,r)}bindDescriptor(e,r,o){return this.resolver.bindDescriptor(e,r,o)}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,o){throw new Jt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async getSatisfying(e,r,o,a){throw new Jt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async resolve(e,r){throw new Jt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}}});var Ri,u8=It(()=>{Kl();Ri=class extends Ws{reportCacheHit(e){}reportCacheMiss(e){}startSectionSync(e,r){return r()}async startSectionPromise(e,r){return await r()}startTimerSync(e,r,o){return(typeof r=="function"?r:o)()}async startTimerPromise(e,r,o){return await(typeof r=="function"?r:o)()}reportSeparator(){}reportInfo(e,r){}reportWarning(e,r){}reportError(e,r){}reportProgress(e){return{...Promise.resolve().then(async()=>{for await(let{}of e);}),stop:()=>{}}}reportJson(e){}reportFold(e,r){}async finalize(){}}});var Lhe,iE,A8=It(()=>{St();Lhe=et(ux());Ay();Dg();Wl();ah();bf();Io();iE=class{constructor(e,{project:r}){this.workspacesCwds=new Set;this.project=r,this.cwd=e}async setup(){this.manifest=await _t.tryFind(this.cwd)??new _t,this.relativeCwd=V.relative(this.project.cwd,this.cwd)||Bt.dot;let e=this.manifest.name?this.manifest.name:rA(null,`${this.computeCandidateName()}-${Ji(this.relativeCwd).substring(0,6)}`);this.anchoredDescriptor=kn(e,`${ci.protocol}${this.relativeCwd}`),this.anchoredLocator=Ps(e,`${ci.protocol}${this.relativeCwd}`);let r=this.manifest.workspaceDefinitions.map(({pattern:a})=>a);if(r.length===0)return;let o=await(0,Lhe.default)(r,{cwd:Ae.fromPortablePath(this.cwd),onlyDirectories:!0,ignore:["**/node_modules","**/.git","**/.yarn"]});o.sort(),await o.reduce(async(a,n)=>{let u=V.resolve(this.cwd,Ae.toPortablePath(n)),A=await ae.existsPromise(V.join(u,"package.json"));await a,A&&this.workspacesCwds.add(u)},Promise.resolve())}get anchoredPackage(){let e=this.project.storedPackages.get(this.anchoredLocator.locatorHash);if(!e)throw new Error(`Assertion failed: Expected workspace ${S1(this.project.configuration,this)} (${Ut(this.project.configuration,V.join(this.cwd,mr.manifest),Ct.PATH)}) to have been resolved. Run "yarn install" to update the lockfile`);return e}accepts(e){let r=e.indexOf(":"),o=r!==-1?e.slice(0,r+1):null,a=r!==-1?e.slice(r+1):e;if(o===ci.protocol&&V.normalize(a)===this.relativeCwd||o===ci.protocol&&(a==="*"||a==="^"||a==="~"))return!0;let n=Fa(a);return n?o===ci.protocol?n.test(this.manifest.version??"0.0.0"):this.project.configuration.get("enableTransparentWorkspaces")&&this.manifest.version!==null?n.test(this.manifest.version):!1:!1}computeCandidateName(){return this.cwd===this.project.cwd?"root-workspace":`${V.basename(this.cwd)}`||"unnamed-workspace"}getRecursiveWorkspaceDependencies({dependencies:e=_t.hardDependencies}={}){let r=new Set,o=a=>{for(let n of e)for(let u of a.manifest[n].values()){let A=this.project.tryWorkspaceByDescriptor(u);A===null||r.has(A)||(r.add(A),o(A))}};return o(this),r}getRecursiveWorkspaceDependents({dependencies:e=_t.hardDependencies}={}){let r=new Set,o=a=>{for(let n of this.project.workspaces)e.some(A=>[...n.manifest[A].values()].some(p=>{let h=this.project.tryWorkspaceByDescriptor(p);return h!==null&&B1(h.anchoredLocator,a.anchoredLocator)}))&&!r.has(n)&&(r.add(n),o(n))};return o(this),r}getRecursiveWorkspaceChildren(){let e=new Set([this]);for(let r of e)for(let o of r.workspacesCwds){let a=this.project.workspacesByCwd.get(o);a&&e.add(a)}return e.delete(this),Array.from(e)}async persistManifest(){let e={};this.manifest.exportTo(e);let r=V.join(this.cwd,_t.fileName),o=`${JSON.stringify(e,null,this.manifest.indent)} -`;await ae.changeFilePromise(r,o,{automaticNewlines:!0}),this.manifest.raw=e}}});function BAt({project:t,allDescriptors:e,allResolutions:r,allPackages:o,accessibleLocators:a=new Set,optionalBuilds:n=new Set,peerRequirements:u=new Map,peerWarnings:A=[],peerRequirementNodes:p=new Map,volatileDescriptors:h=new Set}){let E=new Map,w=[],D=new Map,b=new Map,C=new Map,T=new Map,N=new Map(t.workspaces.map(ce=>{let ue=ce.anchoredLocator.locatorHash,Ie=o.get(ue);if(typeof Ie>"u")throw new Error("Assertion failed: The workspace should have an associated package");return[ue,E1(Ie)]})),U=()=>{let ce=ae.mktempSync(),ue=V.join(ce,"stacktrace.log"),Ie=String(w.length+1).length,he=w.map((De,Ee)=>`${`${Ee+1}.`.padStart(Ie," ")} ${Qa(De)} -`).join("");throw ae.writeFileSync(ue,he),ae.detachTemp(ce),new Jt(45,`Encountered a stack overflow when resolving peer dependencies; cf ${Ae.fromPortablePath(ue)}`)},J=ce=>{let ue=r.get(ce.descriptorHash);if(typeof ue>"u")throw new Error("Assertion failed: The resolution should have been registered");let Ie=o.get(ue);if(!Ie)throw new Error("Assertion failed: The package could not be found");return Ie},te=(ce,ue,Ie,{top:he,optional:De})=>{w.length>1e3&&U(),w.push(ue);let Ee=le(ce,ue,Ie,{top:he,optional:De});return w.pop(),Ee},le=(ce,ue,Ie,{top:he,optional:De})=>{if(De||n.delete(ue.locatorHash),a.has(ue.locatorHash))return;a.add(ue.locatorHash);let Ee=o.get(ue.locatorHash);if(!Ee)throw new Error(`Assertion failed: The package (${jr(t.configuration,ue)}) should have been registered`);let g=[],me=new Map,Ce=[],fe=[],ie=[],Z=[];for(let Re of Array.from(Ee.dependencies.values())){if(Ee.peerDependencies.has(Re.identHash)&&Ee.locatorHash!==he)continue;if(Sf(Re))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");h.delete(Re.descriptorHash);let ht=De;if(!ht){let xe=Ee.dependenciesMeta.get(rn(Re));if(typeof xe<"u"){let tt=xe.get(null);typeof tt<"u"&&tt.optional&&(ht=!0)}}let q=r.get(Re.descriptorHash);if(!q)throw new Error(`Assertion failed: The resolution (${Jn(t.configuration,Re)}) should have been registered`);let nt=N.get(q)||o.get(q);if(!nt)throw new Error(`Assertion failed: The package (${q}, resolved from ${Jn(t.configuration,Re)}) should have been registered`);if(nt.peerDependencies.size===0){te(Re,nt,new Map,{top:he,optional:ht});continue}let Le,Te,ke=new Set,Ke=new Map;Ce.push(()=>{Le=MM(Re,ue.locatorHash),Te=UM(nt,ue.locatorHash),Ee.dependencies.delete(Re.identHash),Ee.dependencies.set(Le.identHash,Le),r.set(Le.descriptorHash,Te.locatorHash),e.set(Le.descriptorHash,Le),o.set(Te.locatorHash,Te),g.push([nt,Le,Te])}),fe.push(()=>{T.set(Te.locatorHash,Ke);for(let xe of Te.peerDependencies.values()){let He=Al(me,xe.identHash,()=>{let x=Ie.get(xe.identHash)??null,I=Ee.dependencies.get(xe.identHash);return!I&&w1(ue,xe)&&(ce.identHash===ue.identHash?I=ce:(I=kn(ue,ce.range),e.set(I.descriptorHash,I),r.set(I.descriptorHash,ue.locatorHash),h.delete(I.descriptorHash),x=null)),I||(I=kn(xe,"missing:")),{subject:ue,ident:xe,provided:I,root:!x,requests:new Map,hash:`p${Ji(ue.locatorHash,xe.identHash).slice(0,5)}`}}).provided;if(He.range==="missing:"&&Te.dependencies.has(xe.identHash)){Te.peerDependencies.delete(xe.identHash);continue}Ke.set(xe.identHash,{requester:Te,descriptor:xe,meta:Te.peerDependenciesMeta.get(rn(xe)),children:new Map}),Te.dependencies.set(xe.identHash,He),Sf(He)&&Jm(C,He.descriptorHash).add(Te.locatorHash),D.set(He.identHash,He),He.range==="missing:"&&ke.add(He.identHash)}Te.dependencies=new Map(Ss(Te.dependencies,([xe,tt])=>rn(tt)))}),ie.push(()=>{if(!o.has(Te.locatorHash))return;let xe=E.get(nt.locatorHash);typeof xe=="number"&&xe>=2&&U();let tt=E.get(nt.locatorHash),He=typeof tt<"u"?tt+1:1;E.set(nt.locatorHash,He),te(Le,Te,Ke,{top:he,optional:ht}),E.set(nt.locatorHash,He-1)}),Z.push(()=>{let xe=Ee.dependencies.get(Re.identHash);if(typeof xe>"u")throw new Error("Assertion failed: Expected the peer dependency to have been turned into a dependency");let tt=r.get(xe.descriptorHash);if(typeof tt>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let He=T.get(tt);if(typeof He>"u")throw new Error("Assertion failed: Expected the peer requests to be registered");for(let x of me.values()){let I=He.get(x.ident.identHash);I&&(x.requests.set(xe.descriptorHash,I),p.set(x.hash,x),x.root||Ie.get(x.ident.identHash)?.children.set(xe.descriptorHash,I))}if(o.has(Te.locatorHash))for(let x of ke)Te.dependencies.delete(x)})}for(let Re of[...Ce,...fe])Re();let Se;do{Se=!0;for(let[Re,ht,q]of g){let nt=A1(b,Re.locatorHash),Le=Ji(...[...q.dependencies.values()].map(xe=>{let tt=xe.range!=="missing:"?r.get(xe.descriptorHash):"missing:";if(typeof tt>"u")throw new Error(`Assertion failed: Expected the resolution for ${Jn(t.configuration,xe)} to have been registered`);return tt===he?`${tt} (top)`:tt}),ht.identHash),Te=nt.get(Le);if(typeof Te>"u"){nt.set(Le,ht);continue}if(Te===ht)continue;o.delete(q.locatorHash),e.delete(ht.descriptorHash),r.delete(ht.descriptorHash),a.delete(q.locatorHash);let ke=C.get(ht.descriptorHash)||[],Ke=[Ee.locatorHash,...ke];C.delete(ht.descriptorHash);for(let xe of Ke){let tt=o.get(xe);typeof tt>"u"||(tt.dependencies.get(ht.identHash).descriptorHash!==Te.descriptorHash&&(Se=!1),tt.dependencies.set(ht.identHash,Te))}for(let xe of me.values())xe.provided.descriptorHash===ht.descriptorHash&&(xe.provided=Te)}}while(!Se);for(let Re of[...ie,...Z])Re()};for(let ce of t.workspaces){let ue=ce.anchoredLocator;h.delete(ce.anchoredDescriptor.descriptorHash),te(ce.anchoredDescriptor,ue,new Map,{top:ue.locatorHash,optional:!1})}for(let ce of p.values()){if(!ce.root)continue;let ue=o.get(ce.subject.locatorHash);if(typeof ue>"u")continue;for(let he of ce.requests.values()){let De=`p${Ji(ce.subject.locatorHash,rn(ce.ident),he.requester.locatorHash).slice(0,5)}`;u.set(De,{subject:ce.subject.locatorHash,requested:ce.ident,rootRequester:he.requester.locatorHash,allRequesters:Array.from(P1(he),Ee=>Ee.requester.locatorHash)})}let Ie=[...P1(ce)];if(ce.provided.range!=="missing:"){let he=J(ce.provided),De=he.version??"0.0.0",Ee=me=>{if(me.startsWith(ci.protocol)){if(!t.tryWorkspaceByLocator(he))return null;me=me.slice(ci.protocol.length),(me==="^"||me==="~")&&(me="*")}return me},g=!0;for(let me of Ie){let Ce=Ee(me.descriptor.range);if(Ce===null){g=!1;continue}if(!nA(De,Ce)){g=!1;let fe=`p${Ji(ce.subject.locatorHash,rn(ce.ident),me.requester.locatorHash).slice(0,5)}`;A.push({type:1,subject:ue,requested:ce.ident,requester:me.requester,version:De,hash:fe,requirementCount:Ie.length})}}if(!g){let me=Ie.map(Ce=>Ee(Ce.descriptor.range));A.push({type:3,node:ce,range:me.includes(null)?null:qM(me),hash:ce.hash})}}else{let he=!0;for(let De of Ie)if(!De.meta?.optional){he=!1;let Ee=`p${Ji(ce.subject.locatorHash,rn(ce.ident),De.requester.locatorHash).slice(0,5)}`;A.push({type:0,subject:ue,requested:ce.ident,requester:De.requester,hash:Ee})}he||A.push({type:2,node:ce,hash:ce.hash})}}}function*vAt(t){let e=new Map;if("children"in t)e.set(t,t);else for(let r of t.requests.values())e.set(r,r);for(let[r,o]of e){yield{request:r,root:o};for(let a of r.children.values())e.has(a)||e.set(a,o)}}function DAt(t,e){let r=[],o=[],a=!1;for(let n of t.peerWarnings)if(!(n.type===1||n.type===0)){if(!t.tryWorkspaceByLocator(n.node.subject)){a=!0;continue}if(n.type===3){let u=t.storedResolutions.get(n.node.provided.descriptorHash);if(typeof u>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let A=t.storedPackages.get(u);if(typeof A>"u")throw new Error("Assertion failed: Expected the package to be registered");let p=eh(vAt(n.node),({request:w,root:D})=>nA(A.version??"0.0.0",w.descriptor.range)?eh.skip:w===D?Ui(t.configuration,w.requester):`${Ui(t.configuration,w.requester)} (via ${Ui(t.configuration,D.requester)})`),h=[...P1(n.node)].length>1?"and other dependencies request":"requests",E=n.range?cy(t.configuration,n.range):Ut(t.configuration,"but they have non-overlapping ranges!","redBright");r.push(`${Ui(t.configuration,n.node.ident)} is listed by your project with version ${D1(t.configuration,A.version??"0.0.0")} (${Ut(t.configuration,n.hash,Ct.CODE)}), which doesn't satisfy what ${p} ${h} (${E}).`)}if(n.type===2){let u=n.node.requests.size>1?" and other dependencies":"";o.push(`${jr(t.configuration,n.node.subject)} doesn't provide ${Ui(t.configuration,n.node.ident)} (${Ut(t.configuration,n.hash,Ct.CODE)}), requested by ${Ui(t.configuration,n.node.requests.values().next().value.requester)}${u}.`)}}e.startSectionSync({reportFooter:()=>{e.reportWarning(86,`Some peer dependencies are incorrectly met by your project; run ${Ut(t.configuration,"yarn explain peer-requirements ",Ct.CODE)} for details, where ${Ut(t.configuration,"",Ct.CODE)} is the six-letter p-prefixed code.`)},skipIfEmpty:!0},()=>{for(let n of Ss(r,u=>ey.default(u)))e.reportWarning(60,n);for(let n of Ss(o,u=>ey.default(u)))e.reportWarning(2,n)}),a&&e.reportWarning(86,`Some peer dependencies are incorrectly met by dependencies; run ${Ut(t.configuration,"yarn explain peer-requirements",Ct.CODE)} for details.`)}var Qk,Fk,Rk,Mhe,h8,p8,g8,Tk,yAt,EAt,Nhe,CAt,IAt,wAt,yl,f8,Lk,Ohe,Qt,Uhe=It(()=>{St();St();Ol();Gt();Qk=ve("crypto");n8();Fk=et(c8()),Rk=et(lg()),Mhe=et(ni()),h8=ve("util"),p8=et(ve("v8")),g8=et(ve("zlib"));K_();W1();J_();z_();Ay();VM();Kl();The();n2();u8();Dg();A8();vx();Wl();ah();Gl();rb();a3();bf();Io();Tk=Zm(process.env.YARN_LOCKFILE_VERSION_OVERRIDE??8),yAt=3,EAt=/ *, */g,Nhe=/\/$/,CAt=32,IAt=(0,h8.promisify)(g8.default.gzip),wAt=(0,h8.promisify)(g8.default.gunzip),yl=(r=>(r.UpdateLockfile="update-lockfile",r.SkipBuild="skip-build",r))(yl||{}),f8={restoreLinkersCustomData:["linkersCustomData"],restoreResolutions:["accessibleLocators","conditionalLocators","disabledLocators","optionalBuilds","storedDescriptors","storedResolutions","storedPackages","lockFileChecksum"],restoreBuildState:["skippedBuilds","storedBuildState"]},Lk=(a=>(a[a.NotProvided=0]="NotProvided",a[a.NotCompatible=1]="NotCompatible",a[a.NodeNotProvided=2]="NodeNotProvided",a[a.NodeNotCompatible=3]="NodeNotCompatible",a))(Lk||{}),Ohe=t=>Ji(`${yAt}`,t),Qt=class t{constructor(e,{configuration:r}){this.resolutionAliases=new Map;this.workspaces=[];this.workspacesByCwd=new Map;this.workspacesByIdent=new Map;this.storedResolutions=new Map;this.storedDescriptors=new Map;this.storedPackages=new Map;this.storedChecksums=new Map;this.storedBuildState=new Map;this.accessibleLocators=new Set;this.conditionalLocators=new Set;this.disabledLocators=new Set;this.originalPackages=new Map;this.optionalBuilds=new Set;this.skippedBuilds=new Set;this.lockfileLastVersion=null;this.lockfileNeedsRefresh=!1;this.peerRequirements=new Map;this.peerWarnings=[];this.peerRequirementNodes=new Map;this.linkersCustomData=new Map;this.lockFileChecksum=null;this.installStateChecksum=null;this.configuration=r,this.cwd=e}static async find(e,r){if(!e.projectCwd)throw new it(`No project found in ${r}`);let o=e.projectCwd,a=r,n=null;for(;n!==e.projectCwd;){if(n=a,ae.existsSync(V.join(n,mr.manifest))){o=n;break}a=V.dirname(n)}let u=new t(e.projectCwd,{configuration:e});ze.telemetry?.reportProject(u.cwd),await u.setupResolutions(),await u.setupWorkspaces(),ze.telemetry?.reportWorkspaceCount(u.workspaces.length),ze.telemetry?.reportDependencyCount(u.workspaces.reduce((C,T)=>C+T.manifest.dependencies.size+T.manifest.devDependencies.size,0));let A=u.tryWorkspaceByCwd(o);if(A)return{project:u,workspace:A,locator:A.anchoredLocator};let p=await u.findLocatorForLocation(`${o}/`,{strict:!0});if(p)return{project:u,locator:p,workspace:null};let h=Ut(e,u.cwd,Ct.PATH),E=Ut(e,V.relative(u.cwd,o),Ct.PATH),w=`- If ${h} isn't intended to be a project, remove any yarn.lock and/or package.json file there.`,D=`- If ${h} is intended to be a project, it might be that you forgot to list ${E} in its workspace configuration.`,b=`- Finally, if ${h} is fine and you intend ${E} to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.`;throw new it(`The nearest package directory (${Ut(e,o,Ct.PATH)}) doesn't seem to be part of the project declared in ${Ut(e,u.cwd,Ct.PATH)}. - -${[w,D,b].join(` -`)}`)}async setupResolutions(){this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=V.join(this.cwd,mr.lockfile),r=this.configuration.get("defaultLanguageName");if(ae.existsSync(e)){let o=await ae.readFilePromise(e,"utf8");this.lockFileChecksum=Ohe(o);let a=Vi(o);if(a.__metadata){let n=a.__metadata.version,u=a.__metadata.cacheKey;this.lockfileLastVersion=n,this.lockfileNeedsRefresh=n"u")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${A})`);let h=Pf(p.resolution,!0),E=new _t;E.load(p,{yamlCompatibilityMode:!0});let w=E.version,D=E.languageName||r,b=p.linkType.toUpperCase(),C=p.conditions??null,T=E.dependencies,N=E.peerDependencies,U=E.dependenciesMeta,J=E.peerDependenciesMeta,te=E.bin;if(p.checksum!=null){let ce=typeof u<"u"&&!p.checksum.includes("/")?`${u}/${p.checksum}`:p.checksum;this.storedChecksums.set(h.locatorHash,ce)}let le={...h,version:w,languageName:D,linkType:b,conditions:C,dependencies:T,peerDependencies:N,dependenciesMeta:U,peerDependenciesMeta:J,bin:te};this.originalPackages.set(le.locatorHash,le);for(let ce of A.split(EAt)){let ue=lh(ce);n<=6&&(ue=this.configuration.normalizeDependency(ue),ue=kn(ue,ue.range.replace(/^patch:[^@]+@(?!npm(:|%3A))/,"$1npm%3A"))),this.storedDescriptors.set(ue.descriptorHash,ue),this.storedResolutions.set(ue.descriptorHash,h.locatorHash)}}}else o.includes("yarn lockfile v1")&&(this.lockfileLastVersion=-1)}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=new Set,r=(0,Rk.default)(4),o=async(a,n)=>{if(e.has(n))return a;e.add(n);let u=new iE(n,{project:this});await r(()=>u.setup());let A=a.then(()=>{this.addWorkspace(u)});return Array.from(u.workspacesCwds).reduce(o,A)};await o(Promise.resolve(),this.cwd)}addWorkspace(e){let r=this.workspacesByIdent.get(e.anchoredLocator.identHash);if(typeof r<"u")throw new Error(`Duplicate workspace name ${Ui(this.configuration,e.anchoredLocator)}: ${Ae.fromPortablePath(e.cwd)} conflicts with ${Ae.fromPortablePath(r.cwd)}`);this.workspaces.push(e),this.workspacesByCwd.set(e.cwd,e),this.workspacesByIdent.set(e.anchoredLocator.identHash,e)}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){V.isAbsolute(e)||(e=V.resolve(this.cwd,e)),e=V.normalize(e).replace(/\/+$/,"");let r=this.workspacesByCwd.get(e);return r||null}getWorkspaceByCwd(e){let r=this.tryWorkspaceByCwd(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByFilePath(e){let r=null;for(let o of this.workspaces)V.relative(o.cwd,e).startsWith("../")||r&&r.cwd.length>=o.cwd.length||(r=o);return r||null}getWorkspaceByFilePath(e){let r=this.tryWorkspaceByFilePath(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByIdent(e){let r=this.workspacesByIdent.get(e.identHash);return typeof r>"u"?null:r}getWorkspaceByIdent(e){let r=this.tryWorkspaceByIdent(e);if(!r)throw new Error(`Workspace not found (${Ui(this.configuration,e)})`);return r}tryWorkspaceByDescriptor(e){if(e.range.startsWith(ci.protocol)){let o=e.range.slice(ci.protocol.length);if(o!=="^"&&o!=="~"&&o!=="*"&&!Fa(o))return this.tryWorkspaceByCwd(o)}let r=this.tryWorkspaceByIdent(e);return r===null||(Sf(e)&&(e=C1(e)),!r.accepts(e.range))?null:r}getWorkspaceByDescriptor(e){let r=this.tryWorkspaceByDescriptor(e);if(r===null)throw new Error(`Workspace not found (${Jn(this.configuration,e)})`);return r}tryWorkspaceByLocator(e){let r=this.tryWorkspaceByIdent(e);return r===null||(Jc(e)&&(e=I1(e)),r.anchoredLocator.locatorHash!==e.locatorHash)?null:r}getWorkspaceByLocator(e){let r=this.tryWorkspaceByLocator(e);if(!r)throw new Error(`Workspace not found (${jr(this.configuration,e)})`);return r}deleteDescriptor(e){this.storedResolutions.delete(e),this.storedDescriptors.delete(e)}deleteLocator(e){this.originalPackages.delete(e),this.storedPackages.delete(e),this.accessibleLocators.delete(e)}forgetResolution(e){if("descriptorHash"in e){let r=this.storedResolutions.get(e.descriptorHash);this.deleteDescriptor(e.descriptorHash);let o=new Set(this.storedResolutions.values());typeof r<"u"&&!o.has(r)&&this.deleteLocator(r)}if("locatorHash"in e){this.deleteLocator(e.locatorHash);for(let[r,o]of this.storedResolutions)o===e.locatorHash&&this.deleteDescriptor(r)}}forgetTransientResolutions(){let e=this.configuration.makeResolver(),r=new Map;for(let[o,a]of this.storedResolutions.entries()){let n=r.get(a);n||r.set(a,n=new Set),n.add(o)}for(let o of this.originalPackages.values()){let a;try{a=e.shouldPersistResolution(o,{project:this,resolver:e})}catch{a=!1}if(!a){this.deleteLocator(o.locatorHash);let n=r.get(o.locatorHash);if(n){r.delete(o.locatorHash);for(let u of n)this.deleteDescriptor(u)}}}}forgetVirtualResolutions(){for(let e of this.storedPackages.values())for(let[r,o]of e.dependencies)Sf(o)&&e.dependencies.set(r,C1(o))}getDependencyMeta(e,r){let o={},n=this.topLevelWorkspace.manifest.dependenciesMeta.get(rn(e));if(!n)return o;let u=n.get(null);if(u&&Object.assign(o,u),r===null||!Mhe.default.valid(r))return o;for(let[A,p]of n)A!==null&&A===r&&Object.assign(o,p);return o}async findLocatorForLocation(e,{strict:r=!1}={}){let o=new Ri,a=this.configuration.getLinkers(),n={project:this,report:o};for(let u of a){let A=await u.findPackageLocator(e,n);if(A){if(r&&(await u.findPackageLocation(A,n)).replace(Nhe,"")!==e.replace(Nhe,""))continue;return A}}return null}async loadUserConfig(){let e=V.join(this.cwd,".pnp.cjs");await ae.existsPromise(e)&&vf(e).setup();let r=V.join(this.cwd,"yarn.config.cjs");return await ae.existsPromise(r)?vf(r):null}async preparePackage(e,{resolver:r,resolveOptions:o}){let a=await this.configuration.getPackageExtensions(),n=this.configuration.normalizePackage(e,{packageExtensions:a});for(let[u,A]of n.dependencies){let p=await this.configuration.reduceHook(E=>E.reduceDependency,A,this,n,A,{resolver:r,resolveOptions:o});if(!w1(A,p))throw new Error("Assertion failed: The descriptor ident cannot be changed through aliases");let h=r.bindDescriptor(p,n,o);n.dependencies.set(u,h)}return n}async resolveEverything(e){if(!this.workspacesByCwd||!this.workspacesByIdent)throw new Error("Workspaces must have been setup before calling this function");this.forgetVirtualResolutions();let r=new Map(this.originalPackages),o=[];e.lockfileOnly||this.forgetTransientResolutions();let a=e.resolver||this.configuration.makeResolver(),n=new tE(a);await n.setup(this,{report:e.report});let u=e.lockfileOnly?[new kk(a)]:[n,a],A=new Sg([new rE(a),...u]),p=new Sg([...u]),h=this.configuration.makeFetcher(),E=e.lockfileOnly?{project:this,report:e.report,resolver:A}:{project:this,report:e.report,resolver:A,fetchOptions:{project:this,cache:e.cache,checksums:this.storedChecksums,report:e.report,fetcher:h,cacheOptions:{mirrorWriteOnly:!0}}},w=new Map,D=new Map,b=new Map,C=new Map,T=new Map,N=new Map,U=this.topLevelWorkspace.anchoredLocator,J=new Set,te=[],le=IU(),ce=this.configuration.getSupportedArchitectures();await e.report.startProgressPromise(Ws.progressViaTitle(),async ie=>{let Z=async nt=>{let Le=await zm(async()=>await A.resolve(nt,E),xe=>`${jr(this.configuration,nt)}: ${xe}`);if(!B1(nt,Le))throw new Error(`Assertion failed: The locator cannot be changed by the resolver (went from ${jr(this.configuration,nt)} to ${jr(this.configuration,Le)})`);C.set(Le.locatorHash,Le),!r.delete(Le.locatorHash)&&!this.tryWorkspaceByLocator(Le)&&o.push(Le);let ke=await this.preparePackage(Le,{resolver:A,resolveOptions:E}),Ke=Wc([...ke.dependencies.values()].map(xe=>q(xe)));return te.push(Ke),Ke.catch(()=>{}),D.set(ke.locatorHash,ke),ke},Se=async nt=>{let Le=T.get(nt.locatorHash);if(typeof Le<"u")return Le;let Te=Promise.resolve().then(()=>Z(nt));return T.set(nt.locatorHash,Te),Te},Re=async(nt,Le)=>{let Te=await q(Le);return w.set(nt.descriptorHash,nt),b.set(nt.descriptorHash,Te.locatorHash),Te},ht=async nt=>{ie.setTitle(Jn(this.configuration,nt));let Le=this.resolutionAliases.get(nt.descriptorHash);if(typeof Le<"u")return Re(nt,this.storedDescriptors.get(Le));let Te=A.getResolutionDependencies(nt,E),ke=Object.fromEntries(await Wc(Object.entries(Te).map(async([tt,He])=>{let x=A.bindDescriptor(He,U,E),I=await q(x);return J.add(I.locatorHash),[tt,I]}))),xe=(await zm(async()=>await A.getCandidates(nt,ke,E),tt=>`${Jn(this.configuration,nt)}: ${tt}`))[0];if(typeof xe>"u")throw new Jt(82,`${Jn(this.configuration,nt)}: No candidates found`);if(e.checkResolutions){let{locators:tt}=await p.getSatisfying(nt,ke,[xe],{...E,resolver:p});if(!tt.find(He=>He.locatorHash===xe.locatorHash))throw new Jt(78,`Invalid resolution ${d1(this.configuration,nt,xe)}`)}return w.set(nt.descriptorHash,nt),b.set(nt.descriptorHash,xe.locatorHash),Se(xe)},q=nt=>{let Le=N.get(nt.descriptorHash);if(typeof Le<"u")return Le;w.set(nt.descriptorHash,nt);let Te=Promise.resolve().then(()=>ht(nt));return N.set(nt.descriptorHash,Te),Te};for(let nt of this.workspaces){let Le=nt.anchoredDescriptor;te.push(q(Le))}for(;te.length>0;){let nt=[...te];te.length=0,await Wc(nt)}});let ue=ul(r.values(),ie=>this.tryWorkspaceByLocator(ie)?ul.skip:ie);if(o.length>0||ue.length>0){let ie=new Set(this.workspaces.flatMap(nt=>{let Le=D.get(nt.anchoredLocator.locatorHash);if(!Le)throw new Error("Assertion failed: The workspace should have been resolved");return Array.from(Le.dependencies.values(),Te=>{let ke=b.get(Te.descriptorHash);if(!ke)throw new Error("Assertion failed: The resolution should have been registered");return ke})})),Z=nt=>ie.has(nt.locatorHash)?"0":"1",Se=nt=>Qa(nt),Re=Ss(o,[Z,Se]),ht=Ss(ue,[Z,Se]),q=e.report.getRecommendedLength();Re.length>0&&e.report.reportInfo(85,`${Ut(this.configuration,"+",Ct.ADDED)} ${_P(this.configuration,Re,q)}`),ht.length>0&&e.report.reportInfo(85,`${Ut(this.configuration,"-",Ct.REMOVED)} ${_P(this.configuration,ht,q)}`)}let Ie=new Set(this.resolutionAliases.values()),he=new Set(D.keys()),De=new Set,Ee=new Map,g=[],me=new Map;BAt({project:this,accessibleLocators:De,volatileDescriptors:Ie,optionalBuilds:he,peerRequirements:Ee,peerWarnings:g,peerRequirementNodes:me,allDescriptors:w,allResolutions:b,allPackages:D});for(let ie of J)he.delete(ie);for(let ie of Ie)w.delete(ie),b.delete(ie);let Ce=new Set,fe=new Set;for(let ie of D.values())ie.conditions!=null&&he.has(ie.locatorHash)&&(Ex(ie,ce)||(Ex(ie,le)&&e.report.reportWarningOnce(77,`${jr(this.configuration,ie)}: Your current architecture (${process.platform}-${process.arch}) is supported by this package, but is missing from the ${Ut(this.configuration,"supportedArchitectures",Ct.SETTING)} setting`),fe.add(ie.locatorHash)),Ce.add(ie.locatorHash));this.storedResolutions=b,this.storedDescriptors=w,this.storedPackages=D,this.accessibleLocators=De,this.conditionalLocators=Ce,this.disabledLocators=fe,this.originalPackages=C,this.optionalBuilds=he,this.peerRequirements=Ee,this.peerWarnings=g,this.peerRequirementNodes=me}async fetchEverything({cache:e,report:r,fetcher:o,mode:a,persistProject:n=!0}){let u={mockedPackages:this.disabledLocators,unstablePackages:this.conditionalLocators},A=o||this.configuration.makeFetcher(),p={checksums:this.storedChecksums,project:this,cache:e,fetcher:A,report:r,cacheOptions:u},h=Array.from(new Set(Ss(this.storedResolutions.values(),[C=>{let T=this.storedPackages.get(C);if(!T)throw new Error("Assertion failed: The locator should have been registered");return Qa(T)}])));a==="update-lockfile"&&(h=h.filter(C=>!this.storedChecksums.has(C)));let E=!1,w=Ws.progressViaCounter(h.length);await r.reportProgress(w);let D=(0,Rk.default)(CAt);if(await Wc(h.map(C=>D(async()=>{let T=this.storedPackages.get(C);if(!T)throw new Error("Assertion failed: The locator should have been registered");if(Jc(T))return;let N;try{N=await A.fetch(T,p)}catch(U){U.message=`${jr(this.configuration,T)}: ${U.message}`,r.reportExceptionOnce(U),E=U;return}N.checksum!=null?this.storedChecksums.set(T.locatorHash,N.checksum):this.storedChecksums.delete(T.locatorHash),N.releaseFs&&N.releaseFs()}).finally(()=>{w.tick()}))),E)throw E;let b=n&&a!=="update-lockfile"?await this.cacheCleanup({cache:e,report:r}):null;if(r.cacheMisses.size>0||b){let T=(await Promise.all([...r.cacheMisses].map(async ue=>{let Ie=this.storedPackages.get(ue),he=this.storedChecksums.get(ue)??null,De=e.getLocatorPath(Ie,he);return(await ae.statPromise(De)).size}))).reduce((ue,Ie)=>ue+Ie,0)-(b?.size??0),N=r.cacheMisses.size,U=b?.count??0,J=`${TP(N,{zero:"No new packages",one:"A package was",more:`${Ut(this.configuration,N,Ct.NUMBER)} packages were`})} added to the project`,te=`${TP(U,{zero:"none were",one:"one was",more:`${Ut(this.configuration,U,Ct.NUMBER)} were`})} removed`,le=T!==0?` (${Ut(this.configuration,T,Ct.SIZE_DIFF)})`:"",ce=U>0?N>0?`${J}, and ${te}${le}.`:`${J}, but ${te}${le}.`:`${J}${le}.`;r.reportInfo(13,ce)}}async linkEverything({cache:e,report:r,fetcher:o,mode:a}){let n={mockedPackages:this.disabledLocators,unstablePackages:this.conditionalLocators,skipIntegrityCheck:!0},u=o||this.configuration.makeFetcher(),A={checksums:this.storedChecksums,project:this,cache:e,fetcher:u,report:r,cacheOptions:n},p=this.configuration.getLinkers(),h={project:this,report:r},E=new Map(p.map(Ce=>{let fe=Ce.makeInstaller(h),ie=Ce.getCustomDataKey(),Z=this.linkersCustomData.get(ie);return typeof Z<"u"&&fe.attachCustomData(Z),[Ce,fe]})),w=new Map,D=new Map,b=new Map,C=new Map(await Wc([...this.accessibleLocators].map(async Ce=>{let fe=this.storedPackages.get(Ce);if(!fe)throw new Error("Assertion failed: The locator should have been registered");return[Ce,await u.fetch(fe,A)]}))),T=[],N=new Set,U=[];for(let Ce of this.accessibleLocators){let fe=this.storedPackages.get(Ce);if(typeof fe>"u")throw new Error("Assertion failed: The locator should have been registered");let ie=C.get(fe.locatorHash);if(typeof ie>"u")throw new Error("Assertion failed: The fetch result should have been registered");let Z=[],Se=ht=>{Z.push(ht)},Re=this.tryWorkspaceByLocator(fe);if(Re!==null){let ht=[],{scripts:q}=Re.manifest;for(let Le of["preinstall","install","postinstall"])q.has(Le)&&ht.push({type:0,script:Le});try{for(let[Le,Te]of E)if(Le.supportsPackage(fe,h)&&(await Te.installPackage(fe,ie,{holdFetchResult:Se})).buildRequest!==null)throw new Error("Assertion failed: Linkers can't return build directives for workspaces; this responsibility befalls to the Yarn core")}finally{Z.length===0?ie.releaseFs?.():T.push(Wc(Z).catch(()=>{}).then(()=>{ie.releaseFs?.()}))}let nt=V.join(ie.packageFs.getRealPath(),ie.prefixPath);D.set(fe.locatorHash,nt),!Jc(fe)&&ht.length>0&&b.set(fe.locatorHash,{buildDirectives:ht,buildLocations:[nt]})}else{let ht=p.find(Le=>Le.supportsPackage(fe,h));if(!ht)throw new Jt(12,`${jr(this.configuration,fe)} isn't supported by any available linker`);let q=E.get(ht);if(!q)throw new Error("Assertion failed: The installer should have been registered");let nt;try{nt=await q.installPackage(fe,ie,{holdFetchResult:Se})}finally{Z.length===0?ie.releaseFs?.():T.push(Wc(Z).then(()=>{}).then(()=>{ie.releaseFs?.()}))}w.set(fe.locatorHash,ht),D.set(fe.locatorHash,nt.packageLocation),nt.buildRequest&&nt.packageLocation&&(nt.buildRequest.skipped?(N.add(fe.locatorHash),this.skippedBuilds.has(fe.locatorHash)||U.push([fe,nt.buildRequest.explain])):b.set(fe.locatorHash,{buildDirectives:nt.buildRequest.directives,buildLocations:[nt.packageLocation]}))}}let J=new Map;for(let Ce of this.accessibleLocators){let fe=this.storedPackages.get(Ce);if(!fe)throw new Error("Assertion failed: The locator should have been registered");let ie=this.tryWorkspaceByLocator(fe)!==null,Z=async(Se,Re)=>{let ht=D.get(fe.locatorHash);if(typeof ht>"u")throw new Error(`Assertion failed: The package (${jr(this.configuration,fe)}) should have been registered`);let q=[];for(let nt of fe.dependencies.values()){let Le=this.storedResolutions.get(nt.descriptorHash);if(typeof Le>"u")throw new Error(`Assertion failed: The resolution (${Jn(this.configuration,nt)}, from ${jr(this.configuration,fe)})should have been registered`);let Te=this.storedPackages.get(Le);if(typeof Te>"u")throw new Error(`Assertion failed: The package (${Le}, resolved from ${Jn(this.configuration,nt)}) should have been registered`);let ke=this.tryWorkspaceByLocator(Te)===null?w.get(Le):null;if(typeof ke>"u")throw new Error(`Assertion failed: The package (${Le}, resolved from ${Jn(this.configuration,nt)}) should have been registered`);ke===Se||ke===null?D.get(Te.locatorHash)!==null&&q.push([nt,Te]):!ie&&ht!==null&&u1(J,Le).push(ht)}ht!==null&&await Re.attachInternalDependencies(fe,q)};if(ie)for(let[Se,Re]of E)Se.supportsPackage(fe,h)&&await Z(Se,Re);else{let Se=w.get(fe.locatorHash);if(!Se)throw new Error("Assertion failed: The linker should have been found");let Re=E.get(Se);if(!Re)throw new Error("Assertion failed: The installer should have been registered");await Z(Se,Re)}}for(let[Ce,fe]of J){let ie=this.storedPackages.get(Ce);if(!ie)throw new Error("Assertion failed: The package should have been registered");let Z=w.get(ie.locatorHash);if(!Z)throw new Error("Assertion failed: The linker should have been found");let Se=E.get(Z);if(!Se)throw new Error("Assertion failed: The installer should have been registered");await Se.attachExternalDependents(ie,fe)}let te=new Map;for(let[Ce,fe]of E){let ie=await fe.finalizeInstall();for(let Z of ie?.records??[])Z.buildRequest.skipped?(N.add(Z.locator.locatorHash),this.skippedBuilds.has(Z.locator.locatorHash)||U.push([Z.locator,Z.buildRequest.explain])):b.set(Z.locator.locatorHash,{buildDirectives:Z.buildRequest.directives,buildLocations:Z.buildLocations});typeof ie?.customData<"u"&&te.set(Ce.getCustomDataKey(),ie.customData)}if(this.linkersCustomData=te,await Wc(T),a==="skip-build")return;for(let[,Ce]of Ss(U,([fe])=>Qa(fe)))Ce(r);let le=new Set(b.keys()),ce=(0,Qk.createHash)("sha512");ce.update(process.versions.node),await this.configuration.triggerHook(Ce=>Ce.globalHashGeneration,this,Ce=>{ce.update("\0"),ce.update(Ce)});let ue=ce.digest("hex"),Ie=new Map,he=Ce=>{let fe=Ie.get(Ce.locatorHash);if(typeof fe<"u")return fe;let ie=this.storedPackages.get(Ce.locatorHash);if(typeof ie>"u")throw new Error("Assertion failed: The package should have been registered");let Z=(0,Qk.createHash)("sha512");Z.update(Ce.locatorHash),Ie.set(Ce.locatorHash,"");for(let Se of ie.dependencies.values()){let Re=this.storedResolutions.get(Se.descriptorHash);if(typeof Re>"u")throw new Error(`Assertion failed: The resolution (${Jn(this.configuration,Se)}) should have been registered`);let ht=this.storedPackages.get(Re);if(typeof ht>"u")throw new Error("Assertion failed: The package should have been registered");Z.update(he(ht))}return fe=Z.digest("hex"),Ie.set(Ce.locatorHash,fe),fe},De=(Ce,fe)=>{let ie=(0,Qk.createHash)("sha512");ie.update(ue),ie.update(he(Ce));for(let Z of fe)ie.update(Z);return ie.digest("hex")},Ee=new Map,g=!1,me=Ce=>{let fe=new Set([Ce.locatorHash]);for(let ie of fe){let Z=this.storedPackages.get(ie);if(!Z)throw new Error("Assertion failed: The package should have been registered");for(let Se of Z.dependencies.values()){let Re=this.storedResolutions.get(Se.descriptorHash);if(!Re)throw new Error(`Assertion failed: The resolution (${Jn(this.configuration,Se)}) should have been registered`);if(Re!==Ce.locatorHash&&le.has(Re))return!1;let ht=this.storedPackages.get(Re);if(!ht)throw new Error("Assertion failed: The package should have been registered");let q=this.tryWorkspaceByLocator(ht);if(q){if(q.anchoredLocator.locatorHash!==Ce.locatorHash&&le.has(q.anchoredLocator.locatorHash))return!1;fe.add(q.anchoredLocator.locatorHash)}fe.add(Re)}}return!0};for(;le.size>0;){let Ce=le.size,fe=[];for(let ie of le){let Z=this.storedPackages.get(ie);if(!Z)throw new Error("Assertion failed: The package should have been registered");if(!me(Z))continue;let Se=b.get(Z.locatorHash);if(!Se)throw new Error("Assertion failed: The build directive should have been registered");let Re=De(Z,Se.buildLocations);if(this.storedBuildState.get(Z.locatorHash)===Re){Ee.set(Z.locatorHash,Re),le.delete(ie);continue}g||(await this.persistInstallStateFile(),g=!0),this.storedBuildState.has(Z.locatorHash)?r.reportInfo(8,`${jr(this.configuration,Z)} must be rebuilt because its dependency tree changed`):r.reportInfo(7,`${jr(this.configuration,Z)} must be built because it never has been before or the last one failed`);let ht=Se.buildLocations.map(async q=>{if(!V.isAbsolute(q))throw new Error(`Assertion failed: Expected the build location to be absolute (not ${q})`);for(let nt of Se.buildDirectives){let Le=`# This file contains the result of Yarn building a package (${Qa(Z)}) -`;switch(nt.type){case 0:Le+=`# Script name: ${nt.script} -`;break;case 1:Le+=`# Script code: ${nt.script} -`;break}let Te=null;if(!await ae.mktempPromise(async Ke=>{let xe=V.join(Ke,"build.log"),{stdout:tt,stderr:He}=this.configuration.getSubprocessStreams(xe,{header:Le,prefix:jr(this.configuration,Z),report:r}),x;try{switch(nt.type){case 0:x=await Db(Z,nt.script,[],{cwd:q,project:this,stdin:Te,stdout:tt,stderr:He});break;case 1:x=await n3(Z,nt.script,[],{cwd:q,project:this,stdin:Te,stdout:tt,stderr:He});break}}catch(y){He.write(y.stack),x=1}if(tt.end(),He.end(),x===0)return!0;ae.detachTemp(Ke);let I=`${jr(this.configuration,Z)} couldn't be built successfully (exit code ${Ut(this.configuration,x,Ct.NUMBER)}, logs can be found here: ${Ut(this.configuration,xe,Ct.PATH)})`,P=this.optionalBuilds.has(Z.locatorHash);return P?r.reportInfo(9,I):r.reportError(9,I),Nue&&r.reportFold(Ae.fromPortablePath(xe),ae.readFileSync(xe,"utf8")),P}))return!1}return!0});fe.push(...ht,Promise.allSettled(ht).then(q=>{le.delete(ie),q.every(nt=>nt.status==="fulfilled"&&nt.value===!0)&&Ee.set(Z.locatorHash,Re)}))}if(await Wc(fe),Ce===le.size){let ie=Array.from(le).map(Z=>{let Se=this.storedPackages.get(Z);if(!Se)throw new Error("Assertion failed: The package should have been registered");return jr(this.configuration,Se)}).join(", ");r.reportError(3,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${ie})`);break}}this.storedBuildState=Ee,this.skippedBuilds=N}async installWithNewReport(e,r){return(await Lt.start({configuration:this.configuration,json:e.json,stdout:e.stdout,forceSectionAlignment:!0,includeLogs:!e.json&&!e.quiet,includeVersion:!0},async a=>{await this.install({...r,report:a})})).exitCode()}async install(e){let r=this.configuration.get("nodeLinker");ze.telemetry?.reportInstall(r);let o=!1;if(await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{this.configuration.get("enableOfflineMode")&&e.report.reportWarning(90,"Offline work is enabled; Yarn won't fetch packages from the remote registry if it can avoid it"),await this.configuration.triggerHook(E=>E.validateProject,this,{reportWarning:(E,w)=>{e.report.reportWarning(E,w)},reportError:(E,w)=>{e.report.reportError(E,w),o=!0}})}),o)return;let a=await this.configuration.getPackageExtensions();for(let E of a.values())for(let[,w]of E)for(let D of w)D.status="inactive";let n=V.join(this.cwd,mr.lockfile),u=null;if(e.immutable)try{u=await ae.readFilePromise(n,"utf8")}catch(E){throw E.code==="ENOENT"?new Jt(28,"The lockfile would have been created by this install, which is explicitly forbidden."):E}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{DAt(this,e.report);for(let[,E]of a)for(let[,w]of E)for(let D of w)if(D.userProvided){let b=Ut(this.configuration,D,Ct.PACKAGE_EXTENSION);switch(D.status){case"inactive":e.report.reportWarning(68,`${b}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case"redundant":e.report.reportWarning(69,`${b}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(u!==null){let E=G0(u,this.generateLockfile());if(E!==u){let w=ehe(n,n,u,E,void 0,void 0,{maxEditLength:100});if(w){e.report.reportSeparator();for(let D of w.hunks){e.report.reportInfo(null,`@@ -${D.oldStart},${D.oldLines} +${D.newStart},${D.newLines} @@`);for(let b of D.lines)b.startsWith("+")?e.report.reportError(28,Ut(this.configuration,b,Ct.ADDED)):b.startsWith("-")?e.report.reportError(28,Ut(this.configuration,b,Ct.REMOVED)):e.report.reportInfo(null,Ut(this.configuration,b,"grey"))}e.report.reportSeparator()}throw new Jt(28,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let E of a.values())for(let[,w]of E)for(let D of w)D.userProvided&&D.status==="active"&&ze.telemetry?.reportPackageExtension(Ig(D,Ct.PACKAGE_EXTENSION));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e)});let A=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],p=await Promise.all(A.map(async E=>px(E,{cwd:this.cwd})));(typeof e.persistProject>"u"||e.persistProject)&&await this.persist(),await e.report.startTimerPromise("Link step",async()=>{if(e.mode==="update-lockfile"){e.report.reportWarning(73,`Skipped due to ${Ut(this.configuration,"mode=update-lockfile",Ct.CODE)}`);return}await this.linkEverything(e);let E=await Promise.all(A.map(async w=>px(w,{cwd:this.cwd})));for(let w=0;w{await this.configuration.triggerHook(E=>E.validateProjectAfterInstall,this,{reportWarning:(E,w)=>{e.report.reportWarning(E,w)},reportError:(E,w)=>{e.report.reportError(E,w),h=!0}})}),!h&&await this.configuration.triggerHook(E=>E.afterAllInstalled,this,e)}generateLockfile(){let e=new Map;for(let[n,u]of this.storedResolutions.entries()){let A=e.get(u);A||e.set(u,A=new Set),A.add(n)}let r={},{cacheKey:o}=Wr.getCacheKey(this.configuration);r.__metadata={version:Tk,cacheKey:o};for(let[n,u]of e.entries()){let A=this.originalPackages.get(n);if(!A)continue;let p=[];for(let w of u){let D=this.storedDescriptors.get(w);if(!D)throw new Error("Assertion failed: The descriptor should have been registered");p.push(D)}let h=p.map(w=>ka(w)).sort().join(", "),E=new _t;E.version=A.linkType==="HARD"?A.version:"0.0.0-use.local",E.languageName=A.languageName,E.dependencies=new Map(A.dependencies),E.peerDependencies=new Map(A.peerDependencies),E.dependenciesMeta=new Map(A.dependenciesMeta),E.peerDependenciesMeta=new Map(A.peerDependenciesMeta),E.bin=new Map(A.bin),r[h]={...E.exportTo({},{compatibilityMode:!1}),linkType:A.linkType.toLowerCase(),resolution:Qa(A),checksum:this.storedChecksums.get(A.locatorHash),conditions:A.conditions||void 0}}return`${[`# This file is generated by running "yarn install" inside your project. -`,`# Manual changes might be lost - proceed with caution! -`].join("")} -`+Sa(r)}async persistLockfile(){let e=V.join(this.cwd,mr.lockfile),r="";try{r=await ae.readFilePromise(e,"utf8")}catch{}let o=this.generateLockfile(),a=G0(r,o);a!==r&&(await ae.writeFilePromise(e,a),this.lockFileChecksum=Ohe(a),this.lockfileNeedsRefresh=!1)}async persistInstallStateFile(){let e=[];for(let u of Object.values(f8))e.push(...u);let r=(0,Fk.default)(this,e),o=p8.default.serialize(r),a=Ji(o);if(this.installStateChecksum===a)return;let n=this.configuration.get("installStatePath");await ae.mkdirPromise(V.dirname(n),{recursive:!0}),await ae.writeFilePromise(n,await IAt(o)),this.installStateChecksum=a}async restoreInstallState({restoreLinkersCustomData:e=!0,restoreResolutions:r=!0,restoreBuildState:o=!0}={}){let a=this.configuration.get("installStatePath"),n;try{let u=await wAt(await ae.readFilePromise(a));n=p8.default.deserialize(u),this.installStateChecksum=Ji(u)}catch{r&&await this.applyLightResolution();return}e&&typeof n.linkersCustomData<"u"&&(this.linkersCustomData=n.linkersCustomData),o&&Object.assign(this,(0,Fk.default)(n,f8.restoreBuildState)),r&&(n.lockFileChecksum===this.lockFileChecksum?Object.assign(this,(0,Fk.default)(n,f8.restoreResolutions)):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new Ri}),await this.persistInstallStateFile()}async persist(){let e=(0,Rk.default)(4);await Promise.all([this.persistLockfile(),...this.workspaces.map(r=>e(()=>r.persistManifest()))])}async cacheCleanup({cache:e,report:r}){if(this.configuration.get("enableGlobalCache"))return null;let o=new Set([".gitignore"]);if(!n4(e.cwd,this.cwd)||!await ae.existsPromise(e.cwd))return null;let a=[];for(let u of await ae.readdirPromise(e.cwd)){if(o.has(u))continue;let A=V.resolve(e.cwd,u);e.markedFiles.has(A)||(e.immutable?r.reportError(56,`${Ut(this.configuration,V.basename(A),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):a.push(ae.lstatPromise(A).then(async p=>(await ae.removePromise(A),p.size))))}if(a.length===0)return null;let n=await Promise.all(a);return{count:a.length,size:n.reduce((u,A)=>u+A,0)}}}});function SAt(t){let o=Math.floor(t.timeNow/864e5),a=t.updateInterval*864e5,n=t.state.lastUpdate??t.timeNow+a+Math.floor(a*t.randomInitialInterval),u=n+a,A=t.state.lastTips??o*864e5,p=A+864e5+8*36e5-t.timeZone,h=u<=t.timeNow,E=p<=t.timeNow,w=null;return(h||E||!t.state.lastUpdate||!t.state.lastTips)&&(w={},w.lastUpdate=h?t.timeNow:n,w.lastTips=A,w.blocks=h?{}:t.state.blocks,w.displayedTips=t.state.displayedTips),{nextState:w,triggerUpdate:h,triggerTips:E,nextTips:E?o*864e5:A}}var sE,_he=It(()=>{St();r2();ah();eb();Gl();bf();sE=class{constructor(e,r){this.values=new Map;this.hits=new Map;this.enumerators=new Map;this.nextTips=0;this.displayedTips=[];this.shouldCommitTips=!1;this.configuration=e;let o=this.getRegistryPath();this.isNew=!ae.existsSync(o),this.shouldShowTips=!1,this.sendReport(r),this.startBuffer()}commitTips(){this.shouldShowTips&&(this.shouldCommitTips=!0)}selectTip(e){let r=new Set(this.displayedTips),o=A=>A&&nn?nA(nn,A):!1,a=e.map((A,p)=>p).filter(A=>e[A]&&o(e[A]?.selector));if(a.length===0)return null;let n=a.filter(A=>!r.has(A));if(n.length===0){let A=Math.floor(a.length*.2);this.displayedTips=A>0?this.displayedTips.slice(-A):[],n=a.filter(p=>!r.has(p))}let u=n[Math.floor(Math.random()*n.length)];return this.displayedTips.push(u),this.commitTips(),e[u]}reportVersion(e){this.reportValue("version",e.replace(/-git\..*/,"-git"))}reportCommandName(e){this.reportValue("commandName",e||"")}reportPluginName(e){this.reportValue("pluginName",e)}reportProject(e){this.reportEnumerator("projectCount",e)}reportInstall(e){this.reportHit("installCount",e)}reportPackageExtension(e){this.reportValue("packageExtension",e)}reportWorkspaceCount(e){this.reportValue("workspaceCount",String(e))}reportDependencyCount(e){this.reportValue("dependencyCount",String(e))}reportValue(e,r){Jm(this.values,e).add(r)}reportEnumerator(e,r){Jm(this.enumerators,e).add(Ji(r))}reportHit(e,r="*"){let o=A1(this.hits,e),a=Al(o,r,()=>0);o.set(r,a+1)}getRegistryPath(){let e=this.configuration.get("globalFolder");return V.join(e,"telemetry.json")}sendReport(e){let r=this.getRegistryPath(),o;try{o=ae.readJsonSync(r)}catch{o={}}let{nextState:a,triggerUpdate:n,triggerTips:u,nextTips:A}=SAt({state:o,timeNow:Date.now(),timeZone:new Date().getTimezoneOffset()*60*1e3,randomInitialInterval:Math.random(),updateInterval:this.configuration.get("telemetryInterval")});if(this.nextTips=A,this.displayedTips=o.displayedTips??[],a!==null)try{ae.mkdirSync(V.dirname(r),{recursive:!0}),ae.writeJsonSync(r,a)}catch{return!1}if(u&&this.configuration.get("enableTips")&&(this.shouldShowTips=!0),n){let p=o.blocks??{};if(Object.keys(p).length===0){let h=`https://browser-http-intake.logs.datadoghq.eu/v1/input/${e}?ddsource=yarn`,E=w=>CU(h,w,{configuration:this.configuration}).catch(()=>{});for(let[w,D]of Object.entries(o.blocks??{})){if(Object.keys(D).length===0)continue;let b=D;b.userId=w,b.reportType="primary";for(let N of Object.keys(b.enumerators??{}))b.enumerators[N]=b.enumerators[N].length;E(b);let C=new Map,T=20;for(let[N,U]of Object.entries(b.values))U.length>0&&C.set(N,U.slice(0,T));for(;C.size>0;){let N={};N.userId=w,N.reportType="secondary",N.metrics={};for(let[U,J]of C)N.metrics[U]=J.shift(),J.length===0&&C.delete(U);E(N)}}}}return!0}applyChanges(){let e=this.getRegistryPath(),r;try{r=ae.readJsonSync(e)}catch{r={}}let o=this.configuration.get("telemetryUserId")??"*",a=r.blocks=r.blocks??{},n=a[o]=a[o]??{};for(let u of this.hits.keys()){let A=n.hits=n.hits??{},p=A[u]=A[u]??{};for(let[h,E]of this.hits.get(u))p[h]=(p[h]??0)+E}for(let u of["values","enumerators"])for(let A of this[u].keys()){let p=n[u]=n[u]??{};p[A]=[...new Set([...p[A]??[],...this[u].get(A)??[]])]}this.shouldCommitTips&&(r.lastTips=this.nextTips,r.displayedTips=this.displayedTips),ae.mkdirSync(V.dirname(e),{recursive:!0}),ae.writeJsonSync(e,r)}startBuffer(){process.on("exit",()=>{try{this.applyChanges()}catch{}})}}});var S2={};Vt(S2,{BuildDirectiveType:()=>Pk,CACHE_CHECKPOINT:()=>V_,CACHE_VERSION:()=>Sk,Cache:()=>Wr,Configuration:()=>ze,DEFAULT_RC_FILENAME:()=>PU,FormatType:()=>yce,InstallMode:()=>yl,LEGACY_PLUGINS:()=>j1,LOCKFILE_VERSION:()=>Tk,LegacyMigrationResolver:()=>tE,LightReport:()=>pA,LinkType:()=>$m,LockfileResolver:()=>rE,Manifest:()=>_t,MessageName:()=>vr,MultiFetcher:()=>py,PackageExtensionStatus:()=>sO,PackageExtensionType:()=>iO,PeerWarningType:()=>Lk,Project:()=>Qt,Report:()=>Ws,ReportError:()=>Jt,SettingsType:()=>G1,StreamReport:()=>Lt,TAG_REGEXP:()=>by,TelemetryManager:()=>sE,ThrowReport:()=>Ri,VirtualFetcher:()=>hy,WindowsLinkType:()=>ab,Workspace:()=>iE,WorkspaceFetcher:()=>gy,WorkspaceResolver:()=>ci,YarnVersion:()=>nn,execUtils:()=>Hr,folderUtils:()=>Bx,formatUtils:()=>pe,hashUtils:()=>bn,httpUtils:()=>on,miscUtils:()=>qe,nodeUtils:()=>Xi,parseMessageName:()=>jS,reportOptionDeprecations:()=>Qy,scriptUtils:()=>hn,semverUtils:()=>Ur,stringifyMessageName:()=>Ju,structUtils:()=>G,tgzUtils:()=>$i,treeUtils:()=>As});var Ve=It(()=>{nb();vx();Wl();ah();eb();Gl();rb();a3();bf();Io();_pe();Vpe();K_();W1();W1();Jpe();J_();zpe();z_();Ay();GS();YM();Uhe();Kl();n2();_he();u8();KM();JM();Dg();A8();r2();iie()});var Yhe=_((b_t,x2)=>{"use strict";var xAt=process.env.TERM_PROGRAM==="Hyper",bAt=process.platform==="win32",jhe=process.platform==="linux",d8={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},Ghe=Object.assign({},d8,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),Whe=Object.assign({},d8,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:jhe?"\u25B8":"\u276F",pointerSmall:jhe?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});x2.exports=bAt&&!xAt?Ghe:Whe;Reflect.defineProperty(x2.exports,"common",{enumerable:!1,value:d8});Reflect.defineProperty(x2.exports,"windows",{enumerable:!1,value:Ghe});Reflect.defineProperty(x2.exports,"other",{enumerable:!1,value:Whe})});var eu=_((k_t,m8)=>{"use strict";var kAt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),QAt=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Vhe=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=n=>{let u=n.open=`\x1B[${n.codes[0]}m`,A=n.close=`\x1B[${n.codes[1]}m`,p=n.regex=new RegExp(`\\u001b\\[${n.codes[1]}m`,"g");return n.wrap=(h,E)=>{h.includes(A)&&(h=h.replace(p,A+u));let w=u+h+A;return E?w.replace(/\r*\n/g,`${A}$&${u}`):w},n},r=(n,u,A)=>typeof n=="function"?n(u):n.wrap(u,A),o=(n,u)=>{if(n===""||n==null)return"";if(t.enabled===!1)return n;if(t.visible===!1)return"";let A=""+n,p=A.includes(` -`),h=u.length;for(h>0&&u.includes("unstyle")&&(u=[...new Set(["unstyle",...u])].reverse());h-- >0;)A=r(t.styles[u[h]],A,p);return A},a=(n,u,A)=>{t.styles[n]=e({name:n,codes:u}),(t.keys[A]||(t.keys[A]=[])).push(n),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(h){t.alias(n,h)},get(){let h=E=>o(E,h.stack);return Reflect.setPrototypeOf(h,t),h.stack=this.stack?this.stack.concat(n):[n],h}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=QAt,t.hasColor=t.hasAnsi=n=>(t.ansiRegex.lastIndex=0,typeof n=="string"&&n!==""&&t.ansiRegex.test(n)),t.alias=(n,u)=>{let A=typeof u=="string"?t[u]:u;if(typeof A!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");A.stack||(Reflect.defineProperty(A,"name",{value:n}),t.styles[n]=A,A.stack=[n]),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(p){t.alias(n,p)},get(){let p=h=>o(h,p.stack);return Reflect.setPrototypeOf(p,t),p.stack=this.stack?this.stack.concat(A.stack):A.stack,p}})},t.theme=n=>{if(!kAt(n))throw new TypeError("Expected theme to be an object");for(let u of Object.keys(n))t.alias(u,n[u]);return t},t.alias("unstyle",n=>typeof n=="string"&&n!==""?(t.ansiRegex.lastIndex=0,n.replace(t.ansiRegex,"")):""),t.alias("noop",n=>n),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=Yhe(),t.define=a,t};m8.exports=Vhe();m8.exports.create=Vhe});var xo=_(an=>{"use strict";var FAt=Object.prototype.toString,ic=eu(),Khe=!1,y8=[],Jhe={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};an.longest=(t,e)=>t.reduce((r,o)=>Math.max(r,e?o[e].length:o.length),0);an.hasColor=t=>!!t&&ic.hasColor(t);var Ok=an.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);an.nativeType=t=>FAt.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");an.isAsyncFn=t=>an.nativeType(t)==="asyncfunction";an.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";an.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;an.scrollDown=(t=[])=>[...t.slice(1),t[0]];an.scrollUp=(t=[])=>[t.pop(),...t];an.reorder=(t=[])=>{let e=t.slice();return e.sort((r,o)=>r.index>o.index?1:r.index{let o=t.length,a=r===o?0:r<0?o-1:r,n=t[e];t[e]=t[a],t[a]=n};an.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};an.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};an.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:o=` -`+r,width:a=80}=e,n=(o+r).match(/[^\S\n]/g)||[];a-=n.length;let u=`.{1,${a}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,A=t.trim(),p=new RegExp(u,"g"),h=A.match(p)||[];return h=h.map(E=>E.replace(/\n$/,"")),e.padEnd&&(h=h.map(E=>E.padEnd(a," "))),e.padStart&&(h=h.map(E=>E.padStart(a," "))),r+h.join(o)};an.unmute=t=>{let e=t.stack.find(o=>ic.keys.color.includes(o));return e?ic[e]:t.stack.find(o=>o.slice(2)==="bg")?ic[e.slice(2)]:o=>o};an.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";an.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(o=>ic.keys.color.includes(o));if(e){let o=ic["bg"+an.pascal(e)];return o?o.black:t}let r=t.stack.find(o=>o.slice(0,2)==="bg");return r?ic[r.slice(2).toLowerCase()]||t:ic.none};an.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(o=>ic.keys.color.includes(o)),r=t.stack.find(o=>o.slice(0,2)==="bg");if(e&&!r)return ic[Jhe[e]||e];if(r){let o=r.slice(2).toLowerCase(),a=Jhe[o];return a&&ic["bg"+an.pascal(a)]||t}return ic.none};an.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),o=e>=12?"pm":"am";e=e%12;let a=e===0?12:e,n=r<10?"0"+r:r;return a+":"+n+" "+o};an.set=(t={},e="",r)=>e.split(".").reduce((o,a,n,u)=>{let A=u.length-1>n?o[a]||{}:r;return!an.isObject(A)&&n{let o=t[e]==null?e.split(".").reduce((a,n)=>a&&a[n],t):t[e];return o??r};an.mixin=(t,e)=>{if(!Ok(t))return e;if(!Ok(e))return t;for(let r of Object.keys(e)){let o=Object.getOwnPropertyDescriptor(e,r);if(o.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&Ok(o.value)){let a=Object.getOwnPropertyDescriptor(t,r);Ok(a.value)?t[r]=an.merge({},t[r],e[r]):Reflect.defineProperty(t,r,o)}else Reflect.defineProperty(t,r,o);else Reflect.defineProperty(t,r,o)}return t};an.merge=(...t)=>{let e={};for(let r of t)an.mixin(e,r);return e};an.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let o of Object.keys(r)){let a=r[o];typeof a=="function"?an.define(t,o,a.bind(e)):an.define(t,o,a)}};an.onExit=t=>{let e=(r,o)=>{Khe||(Khe=!0,y8.forEach(a=>a()),r===!0&&process.exit(128+o))};y8.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),y8.push(t)};an.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};an.defineExport=(t,e,r)=>{let o;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(a){o=a},get(){return o?o():r()}})}});var zhe=_(cE=>{"use strict";cE.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};cE.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};cE.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};cE.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};cE.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var $he=_((R_t,Zhe)=>{"use strict";var Xhe=ve("readline"),RAt=zhe(),TAt=/^(?:\x1b)([a-zA-Z0-9])$/,LAt=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,NAt={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function OAt(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function MAt(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var Mk=(t="",e={})=>{let r,o={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t="\x1B"+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=o.sequence||""),o.sequence=o.sequence||t||o.name,t==="\r")o.raw=void 0,o.name="return";else if(t===` -`)o.name="enter";else if(t===" ")o.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x1B\x7F"||t==="\x1B\b")o.name="backspace",o.meta=t.charAt(0)==="\x1B";else if(t==="\x1B"||t==="\x1B\x1B")o.name="escape",o.meta=t.length===2;else if(t===" "||t==="\x1B ")o.name="space",o.meta=t.length===2;else if(t<="")o.name=String.fromCharCode(t.charCodeAt(0)+97-1),o.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")o.name="number";else if(t.length===1&&t>="a"&&t<="z")o.name=t;else if(t.length===1&&t>="A"&&t<="Z")o.name=t.toLowerCase(),o.shift=!0;else if(r=TAt.exec(t))o.meta=!0,o.shift=/^[A-Z]$/.test(r[1]);else if(r=LAt.exec(t)){let a=[...t];a[0]==="\x1B"&&a[1]==="\x1B"&&(o.option=!0);let n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),u=(r[3]||r[5]||1)-1;o.ctrl=!!(u&4),o.meta=!!(u&10),o.shift=!!(u&1),o.code=n,o.name=NAt[n],o.shift=OAt(n)||o.shift,o.ctrl=MAt(n)||o.ctrl}return o};Mk.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let o=Xhe.createInterface({terminal:!0,input:r});Xhe.emitKeypressEvents(r,o);let a=(A,p)=>e(A,Mk(A,p),o),n=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",a),o.resume(),()=>{r.isTTY&&r.setRawMode(n),r.removeListener("keypress",a),o.pause(),o.close()}};Mk.action=(t,e,r)=>{let o={...RAt,...r};return e.ctrl?(e.action=o.ctrl[e.name],e):e.option&&o.option?(e.action=o.option[e.name],e):e.shift?(e.action=o.shift[e.name],e):(e.action=o.keys[e.name],e)};Zhe.exports=Mk});var t0e=_((T_t,e0e)=>{"use strict";e0e.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(e)for(let r of Object.keys(e)){let o=e[r];typeof o=="number"&&(o={interval:o}),UAt(t,r,o)}};function UAt(t,e,r={}){let o=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},a=r.interval||120;o.frames=r.frames||[],o.loading=!0;let n=setInterval(()=>{o.ms=Date.now()-o.start,o.tick++,t.render()},a);return o.stop=()=>{o.loading=!1,clearInterval(n)},Reflect.defineProperty(o,"interval",{value:n}),t.once("close",()=>o.stop()),o.stop}});var n0e=_((L_t,r0e)=>{"use strict";var{define:_At,width:HAt}=xo(),E8=class{constructor(e){let r=e.options;_At(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=HAt(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};r0e.exports=E8});var s0e=_((N_t,i0e)=>{"use strict";var C8=xo(),Vs=eu(),I8={default:Vs.noop,noop:Vs.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||C8.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||C8.complement(this.primary)},primary:Vs.cyan,success:Vs.green,danger:Vs.magenta,strong:Vs.bold,warning:Vs.yellow,muted:Vs.dim,disabled:Vs.gray,dark:Vs.dim.gray,underline:Vs.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};I8.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(Vs.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(Vs.visible=t.styles.visible);let e=C8.merge({},I8,t.styles);delete e.merge;for(let r of Object.keys(Vs))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>Vs[r]});for(let r of Object.keys(Vs.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>Vs[r]});return e};i0e.exports=I8});var a0e=_((O_t,o0e)=>{"use strict";var w8=process.platform==="win32",Yf=eu(),qAt=xo(),B8={...Yf.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:Yf.symbols.check,leftAngle:"\u2039",mark:"\u203B",minus:"\u2212",multiplication:"\xD7",obelus:"\xF7",percent:"%",pilcrow:"\xB6",pilcrow2:"\u2761",pencilUpRight:"\u2710",pencilDownRight:"\u270E",pencilRight:"\u270F",plus:"+",plusMinus:"\xB1",pointRight:"\u261E",rightAngle:"\u203A",section:"\xA7",hexagon:{off:"\u2B21",on:"\u2B22",disabled:"\u2B22"},ballot:{on:"\u2611",off:"\u2610",disabled:"\u2612"},stars:{on:"\u2605",off:"\u2606",disabled:"\u2606"},folder:{on:"\u25BC",off:"\u25B6",disabled:"\u25B6"},prefix:{pending:Yf.symbols.question,submitted:Yf.symbols.check,cancelled:Yf.symbols.cross},separator:{pending:Yf.symbols.pointerSmall,submitted:Yf.symbols.middot,cancelled:Yf.symbols.middot},radio:{off:w8?"( )":"\u25EF",on:w8?"(*)":"\u25C9",disabled:w8?"(|)":"\u24BE"},numbers:["\u24EA","\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246A","\u246B","\u246C","\u246D","\u246E","\u246F","\u2470","\u2471","\u2472","\u2473","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325A","\u325B","\u325C","\u325D","\u325E","\u325F","\u32B1","\u32B2","\u32B3","\u32B4","\u32B5","\u32B6","\u32B7","\u32B8","\u32B9","\u32BA","\u32BB","\u32BC","\u32BD","\u32BE","\u32BF"]};B8.merge=t=>{let e=qAt.merge({},Yf.symbols,B8,t.symbols);return delete e.merge,e};o0e.exports=B8});var c0e=_((M_t,l0e)=>{"use strict";var jAt=s0e(),GAt=a0e(),WAt=xo();l0e.exports=t=>{t.options=WAt.merge({},t.options.theme,t.options),t.symbols=GAt.merge(t.options),t.styles=jAt.merge(t.options)}});var h0e=_((f0e,p0e)=>{"use strict";var u0e=process.env.TERM_PROGRAM==="Apple_Terminal",YAt=eu(),v8=xo(),tu=p0e.exports=f0e,Pi="\x1B[",A0e="\x07",D8=!1,kh=tu.code={bell:A0e,beep:A0e,beginning:`${Pi}G`,down:`${Pi}J`,esc:Pi,getPosition:`${Pi}6n`,hide:`${Pi}?25l`,line:`${Pi}2K`,lineEnd:`${Pi}K`,lineStart:`${Pi}1K`,restorePosition:Pi+(u0e?"8":"u"),savePosition:Pi+(u0e?"7":"s"),screen:`${Pi}2J`,show:`${Pi}?25h`,up:`${Pi}1J`},Yg=tu.cursor={get hidden(){return D8},hide(){return D8=!0,kh.hide},show(){return D8=!1,kh.show},forward:(t=1)=>`${Pi}${t}C`,backward:(t=1)=>`${Pi}${t}D`,nextLine:(t=1)=>`${Pi}E`.repeat(t),prevLine:(t=1)=>`${Pi}F`.repeat(t),up:(t=1)=>t?`${Pi}${t}A`:"",down:(t=1)=>t?`${Pi}${t}B`:"",right:(t=1)=>t?`${Pi}${t}C`:"",left:(t=1)=>t?`${Pi}${t}D`:"",to(t,e){return e?`${Pi}${e+1};${t+1}H`:`${Pi}${t+1}G`},move(t=0,e=0){let r="";return r+=t<0?Yg.left(-t):t>0?Yg.right(t):"",r+=e<0?Yg.up(-e):e>0?Yg.down(e):"",r},restore(t={}){let{after:e,cursor:r,initial:o,input:a,prompt:n,size:u,value:A}=t;if(o=v8.isPrimitive(o)?String(o):"",a=v8.isPrimitive(a)?String(a):"",A=v8.isPrimitive(A)?String(A):"",u){let p=tu.cursor.up(u)+tu.cursor.to(n.length),h=a.length-r;return h>0&&(p+=tu.cursor.left(h)),p}if(A||e){let p=!a&&o?-o.length:-a.length+r;return e&&(p-=e.length),a===""&&o&&!n.includes(o)&&(p+=o.length),tu.cursor.move(p)}}},S8=tu.erase={screen:kh.screen,up:kh.up,down:kh.down,line:kh.line,lineEnd:kh.lineEnd,lineStart:kh.lineStart,lines(t){let e="";for(let r=0;r{if(!e)return S8.line+Yg.to(0);let r=n=>[...YAt.unstyle(n)].length,o=t.split(/\r?\n/),a=0;for(let n of o)a+=1+Math.floor(Math.max(r(n)-1,0)/e);return(S8.line+Yg.prevLine()).repeat(a-1)+S8.line+Yg.to(0)}});var uE=_((U_t,d0e)=>{"use strict";var VAt=ve("events"),g0e=eu(),P8=$he(),KAt=t0e(),JAt=n0e(),zAt=c0e(),Na=xo(),Vg=h0e(),x8=class t extends VAt{constructor(e={}){super(),this.name=e.name,this.type=e.type,this.options=e,zAt(this),KAt(this),this.state=new JAt(this),this.initial=[e.initial,e.default].find(r=>r!=null),this.stdout=e.stdout||process.stdout,this.stdin=e.stdin||process.stdin,this.scale=e.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=ZAt(this.options.margin),this.setMaxListeners(0),XAt(this)}async keypress(e,r={}){this.keypressed=!0;let o=P8.action(e,P8(e,r),this.options.actions);this.state.keypress=o,this.emit("keypress",e,o),this.emit("state",this.state.clone());let a=this.options[o.action]||this[o.action]||this.dispatch;if(typeof a=="function")return await a.call(this,e,o);this.alert()}alert(){delete this.state.alert,this.options.show===!1?this.emit("alert"):this.stdout.write(Vg.code.beep)}cursorHide(){this.stdout.write(Vg.cursor.hide()),Na.onExit(()=>this.cursorShow())}cursorShow(){this.stdout.write(Vg.cursor.show())}write(e){e&&(this.stdout&&this.state.show!==!1&&this.stdout.write(e),this.state.buffer+=e)}clear(e=0){let r=this.state.buffer;this.state.buffer="",!(!r&&!e||this.options.show===!1)&&this.stdout.write(Vg.cursor.down(e)+Vg.clear(r,this.width))}restore(){if(this.state.closed||this.options.show===!1)return;let{prompt:e,after:r,rest:o}=this.sections(),{cursor:a,initial:n="",input:u="",value:A=""}=this,p=this.state.size=o.length,h={after:r,cursor:a,initial:n,input:u,prompt:e,size:p,value:A},E=Vg.cursor.restore(h);E&&this.stdout.write(E)}sections(){let{buffer:e,input:r,prompt:o}=this.state;o=g0e.unstyle(o);let a=g0e.unstyle(e),n=a.indexOf(o),u=a.slice(0,n),p=a.slice(n).split(` -`),h=p[0],E=p[p.length-1],D=(o+(r?" "+r:"")).length,b=De.call(this,this.value),this.result=()=>o.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let a=r.onSubmit.bind(this),n=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await a(this.name,this.value,this),n())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,o){let{options:a,state:n,symbols:u,timers:A}=this,p=A&&A[e];n.timer=p;let h=a[e]||n[e]||u[e],E=r&&r[e]!=null?r[e]:await h;if(E==="")return E;let w=await this.resolve(E,n,r,o);return!w&&r&&r[e]?this.resolve(h,n,r,o):w}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,o=this.state;return o.timer=r,Na.isObject(e)&&(e=e[o.status]||e.pending),Na.hasColor(e)?e:(this.styles[o.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return Na.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,o=this.state;o.timer=r;let a=e[o.status]||e.pending||o.separator,n=await this.resolve(a,o);return Na.isObject(n)&&(n=n[o.status]||n.pending),Na.hasColor(n)?n:this.styles.muted(n)}async pointer(e,r){let o=await this.element("pointer",e,r);if(typeof o=="string"&&Na.hasColor(o))return o;if(o){let a=this.styles,n=this.index===r,u=n?a.primary:h=>h,A=await this.resolve(o[n?"on":"off"]||o,this.state),p=Na.hasColor(A)?A:u(A);return n?p:" ".repeat(A.length)}}async indicator(e,r){let o=await this.element("indicator",e,r);if(typeof o=="string"&&Na.hasColor(o))return o;if(o){let a=this.styles,n=e.enabled===!0,u=n?a.success:a.dark,A=o[n?"on":"off"]||o;return Na.hasColor(A)?A:u(A)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return Na.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return Na.resolve(this,e,...r)}get base(){return t.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||Na.height(this.stdout,25)}get width(){return this.options.columns||Na.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,o=[r,e].find(this.isValue.bind(this));return this.isValue(o)?o:this.initial}static get prompt(){return e=>new this(e).run()}};function XAt(t){let e=a=>t[a]===void 0||typeof t[a]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],o=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let a of Object.keys(t.options)){if(r.includes(a)||/^on[A-Z]/.test(a))continue;let n=t.options[a];typeof n=="function"&&e(a)?o.includes(a)||(t[a]=n.bind(t)):typeof t[a]!="function"&&(t[a]=n)}}function ZAt(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=a=>a%2===0?` -`:" ",o=[];for(let a=0;a<4;a++){let n=r(a);e[a]?o.push(n.repeat(e[a])):o.push("")}return o}d0e.exports=x8});var E0e=_((__t,y0e)=>{"use strict";var $At=xo(),m0e={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return m0e.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};y0e.exports=(t,e={})=>{let r=$At.merge({},m0e,e.roles);return r[t]||r.default}});var b2=_((H_t,w0e)=>{"use strict";var eft=eu(),tft=uE(),rft=E0e(),Uk=xo(),{reorder:b8,scrollUp:nft,scrollDown:ift,isObject:C0e,swap:sft}=Uk,k8=class extends tft{constructor(e){super(e),this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:o,suggest:a}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(n=>n.enabled=!1),typeof a!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");C0e(r)&&(r=Object.keys(r)),Array.isArray(r)?(o!=null&&(this.index=this.findIndex(o)),r.forEach(n=>this.enable(this.find(n))),await this.render()):(o!=null&&(r=o),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let o=[],a=0,n=async(u,A)=>{typeof u=="function"&&(u=await u.call(this)),u instanceof Promise&&(u=await u);for(let p=0;p(this.state.loadingChoices=!1,u))}async toChoice(e,r,o){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let a=e.value;if(e=rft(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,Uk.define(e,"parent",o),e.level=o?o.level+1:1,e.indent==null&&(e.indent=o?o.indent+" ":e.indent||""),e.path=o?o.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,eft.unstyle(e.message).length));let u={...e};return e.reset=(A=u.input,p=u.value)=>{for(let h of Object.keys(u))e[h]=u[h];e.input=A,e.value=p},a==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,o){let a=await this.toChoice(e,r,o);return this.choices.push(a),this.index=this.choices.length-1,this.limit=this.choices.length,a}async newItem(e,r,o){let a={name:"New choice name?",editable:!0,newChoice:!0,...e},n=await this.addChoice(a,r,o);return n.updateChoice=()=>{delete n.newChoice,n.name=n.message=n.input,n.input="",n.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelectedr.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e.choices.forEach(a=>this.toggle(a,r));let o=e.parent;for(;o;){let a=o.choices.filter(n=>this.isDisabled(n));o.enabled=a.every(n=>n.enabled===!0),o=o.parent}return I0e(this,this.choices),this.emit("toggle",e,this),e}enable(e){return this.selected.length>=this.maxSelected?this.alert():(e.enabled=!this.isDisabled(e),e.choices&&e.choices.forEach(this.enable.bind(this)),e)}disable(e){return e.enabled=!1,e.choices&&e.choices.forEach(this.disable.bind(this)),e}number(e){this.num+=e;let r=o=>{let a=Number(o);if(a>this.choices.length-1)return this.alert();let n=this.focused,u=this.choices.find(A=>a===A.index);if(!u.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(u)===-1){let A=b8(this.choices),p=A.indexOf(u);if(n.index>p){let h=A.slice(p,p+this.limit),E=A.filter(w=>!h.includes(w));this.choices=h.concat(E)}else{let h=p-this.limit+1;this.choices=A.slice(h).concat(A.slice(0,h))}}return this.index=this.choices.indexOf(u),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise(o=>{let a=this.choices.length,n=this.num,u=(A=!1,p)=>{clearTimeout(this.numberTimeout),A&&(p=r(n)),this.num="",o(p)};if(n==="0"||n.length===1&&+(n+"0")>a)return u(!0);if(Number(n)>a)return u(!1,this.alert());this.numberTimeout=setTimeout(()=>u(!0),this.delay)})}home(){return this.choices=b8(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,r=b8(this.choices);return this.choices=r.slice(e).concat(r.slice(0,e)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){return this.visible.length<=1?this.alert():this.up()}next(){return this.visible.length<=1?this.alert():this.down()}right(){return this.cursor>=this.input.length?this.alert():(this.cursor++,this.render())}left(){return this.cursor<=0?this.alert():(this.cursor--,this.render())}up(){let e=this.choices.length,r=this.visible.length,o=this.index;return this.options.scroll===!1&&o===0?this.alert():e>r&&o===0?this.scrollUp():(this.index=(o-1%e+e)%e,this.isDisabled()?this.up():this.render())}down(){let e=this.choices.length,r=this.visible.length,o=this.index;return this.options.scroll===!1&&o===r-1?this.alert():e>r&&o===r-1?this.scrollDown():(this.index=(o+1)%e,this.isDisabled()?this.down():this.render())}scrollUp(e=0){return this.choices=nft(this.choices),this.index=e,this.isDisabled()?this.up():this.render()}scrollDown(e=this.visible.length-1){return this.choices=ift(this.choices),this.index=e,this.isDisabled()?this.down():this.render()}async shiftUp(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index-1),await this.up(),this.sorting=!1;return}return this.scrollUp(this.index)}async shiftDown(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index+1),await this.down(),this.sorting=!1;return}return this.scrollDown(this.index)}pageUp(){return this.visible.length<=1?this.alert():(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled()?this.up():this.render())}pageDown(){return this.visible.length>=this.choices.length?this.alert():(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled()?this.down():this.render())}swap(e){sft(this.choices,this.index,e)}isDisabled(e=this.focused){return e&&["disabled","collapsed","hidden","completing","readonly"].some(o=>e[o]===!0)?!0:e&&e.role==="heading"}isEnabled(e=this.focused){if(Array.isArray(e))return e.every(r=>this.isEnabled(r));if(e.choices){let r=e.choices.filter(o=>!this.isDisabled(o));return e.enabled&&r.every(o=>this.isEnabled(o))}return e.enabled&&!this.isDisabled(e)}isChoice(e,r){return e.name===r||e.index===Number(r)}isSelected(e){return Array.isArray(this.initial)?this.initial.some(r=>this.isChoice(e,r)):this.isChoice(e,this.initial)}map(e=[],r="value"){return[].concat(e||[]).reduce((o,a)=>(o[a]=this.find(a,r),o),{})}filter(e,r){let a=typeof e=="function"?e:(A,p)=>[A.name,p].includes(e),u=(this.options.multiple?this.state._choices:this.choices).filter(a);return r?u.map(A=>A[r]):u}find(e,r){if(C0e(e))return r?e[r]:e;let a=typeof e=="function"?e:(u,A)=>[u.name,A].includes(e),n=this.choices.find(a);if(n)return r?n[r]:n}findIndex(e){return this.choices.indexOf(this.find(e))}async submit(){let e=this.focused;if(!e)return this.alert();if(e.newChoice)return e.input?(e.updateChoice(),this.render()):this.alert();if(this.choices.some(u=>u.newChoice))return this.alert();let{reorder:r,sort:o}=this.options,a=this.multiple===!0,n=this.selected;return n===void 0?this.alert():(Array.isArray(n)&&r!==!1&&o!==!0&&(n=Uk.reorder(n)),this.value=a?n.map(u=>u.name):n.name,super.submit())}set choices(e=[]){this.state._choices=this.state._choices||[],this.state.choices=e;for(let r of e)this.state._choices.some(o=>o.name===r.name)||this.state._choices.push(r);if(!this._initial&&this.options.initial){this._initial=!0;let r=this.initial;if(typeof r=="string"||typeof r=="number"){let o=this.find(r);o&&(this.initial=o.index,this.focus(o,!0))}}}get choices(){return I0e(this,this.state.choices||[])}set visible(e){this.state.visible=e}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(e){this.state.limit=e}get limit(){let{state:e,options:r,choices:o}=this,a=e.limit||this._limit||r.limit||o.length;return Math.min(a,this.height)}set value(e){super.value=e}get value(){return typeof super.value!="string"&&super.value===this.initial?this.input:super.value}set index(e){this.state.index=e}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let e=this.choices[this.index];return e&&this.state.submitted&&this.multiple!==!0&&(e.enabled=!0),e}get selectable(){return this.choices.filter(e=>!this.isDisabled(e))}get selected(){return this.multiple?this.enabled:this.focused}};function I0e(t,e){if(e instanceof Promise)return e;if(typeof e=="function"){if(Uk.isAsyncFn(e))return e;e=e.call(t,t)}for(let r of e){if(Array.isArray(r.choices)){let o=r.choices.filter(a=>!t.isDisabled(a));r.enabled=o.every(a=>a.enabled===!0)}t.isDisabled(r)===!0&&delete r.enabled}return e}w0e.exports=k8});var Qh=_((q_t,B0e)=>{"use strict";var oft=b2(),Q8=xo(),F8=class extends oft{constructor(e){super(e),this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}separator(){if(this.options.separator)return super.separator();let e=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():e}pointer(e,r){return!this.multiple||this.options.pointer?super.pointer(e,r):""}indicator(e,r){return this.multiple?super.indicator(e,r):""}choiceMessage(e,r){let o=this.resolve(e.message,this.state,e,r);return e.role==="heading"&&!Q8.hasColor(o)&&(o=this.styles.strong(o)),this.resolve(o,this.state,e,r)}choiceSeparator(){return":"}async renderChoice(e,r){await this.onChoice(e,r);let o=this.index===r,a=await this.pointer(e,r),n=await this.indicator(e,r)+(e.pad||""),u=await this.resolve(e.hint,this.state,e,r);u&&!Q8.hasColor(u)&&(u=this.styles.muted(u));let A=this.indent(e),p=await this.choiceMessage(e,r),h=()=>[this.margin[3],A+a+n,p,this.margin[1],u].filter(Boolean).join(" ");return e.role==="heading"?h():e.disabled?(Q8.hasColor(p)||(p=this.styles.disabled(p)),h()):(o&&(p=this.styles.em(p)),h())}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(n,u)=>await this.renderChoice(n,u)),r=await Promise.all(e);r.length||r.push(this.styles.danger("No matching choices"));let o=this.margin[0]+r.join(` -`),a;return this.options.choicesHeader&&(a=await this.resolve(this.options.choicesHeader,this.state)),[a,o].filter(Boolean).join(` -`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,o="",a=await this.header(),n=await this.prefix(),u=await this.separator(),A=await this.message();this.options.promptLine!==!1&&(o=[n,A,u,""].join(" "),this.state.prompt=o);let p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),w=await this.footer();p&&(o+=p),h&&!o.includes(h)&&(o+=" "+h),e&&!p&&!E.trim()&&this.multiple&&this.emptyError!=null&&(o+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,o,E,w].filter(Boolean).join(` -`)),this.write(this.margin[2]),this.restore()}};B0e.exports=F8});var D0e=_((j_t,v0e)=>{"use strict";var aft=Qh(),lft=(t,e)=>{let r=t.toLowerCase();return o=>{let n=o.toLowerCase().indexOf(r),u=e(o.slice(n,n+r.length));return n>=0?o.slice(0,n)+u+o.slice(n+r.length):o}},R8=class extends aft{constructor(e){super(e),this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:o}=this.state;return this.input=o.slice(0,r)+e+o.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let o=e.toLowerCase();return r.filter(a=>a.message.toLowerCase().includes(o))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=lft(this.input,e),o=this.choices;this.choices=o.map(a=>({...a,message:r(a.message)})),await super.render(),this.choices=o}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};v0e.exports=R8});var L8=_((G_t,S0e)=>{"use strict";var T8=xo();S0e.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:o="",pos:a,showCursor:n=!0,color:u}=e,A=u||t.styles.placeholder,p=T8.inverse(t.styles.primary),h=T=>p(t.styles.black(T)),E=r,w=" ",D=h(w);if(t.blink&&t.blink.off===!0&&(h=T=>T,D=""),n&&a===0&&o===""&&r==="")return h(w);if(n&&a===0&&(r===o||r===""))return h(o[0])+A(o.slice(1));o=T8.isPrimitive(o)?`${o}`:"",r=T8.isPrimitive(r)?`${r}`:"";let b=o&&o.startsWith(r)&&o!==r,C=b?h(o[r.length]):D;if(a!==r.length&&n===!0&&(E=r.slice(0,a)+h(r[a])+r.slice(a+1),C=""),n===!1&&(C=""),b){let T=t.styles.unstyle(E+C);return E+C+A(o.slice(T.length))}return E+C}});var _k=_((W_t,P0e)=>{"use strict";var cft=eu(),uft=Qh(),Aft=L8(),N8=class extends uft{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:o,input:a}=r;return r.value=r.input=a.slice(0,o)+e+a.slice(o),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:o}=e;return e.value=e.input=o.slice(0,r-1)+o.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:o}=e;if(o[r]===void 0)return this.alert();let a=`${o}`.slice(0,r)+`${o}`.slice(r+1);return e.value=e.input=a,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:o}=e;return r&&r.startsWith(o)&&o!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let o=await this.resolve(e.separator,this.state,e,r)||":";return o?" "+this.styles.disabled(o):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:o,styles:a}=this,{cursor:n,initial:u="",name:A,hint:p,input:h=""}=e,{muted:E,submitted:w,primary:D,danger:b}=a,C=p,T=this.index===r,N=e.validate||(()=>!0),U=await this.choiceSeparator(e,r),J=e.message;this.align==="right"&&(J=J.padStart(this.longest+1," ")),this.align==="left"&&(J=J.padEnd(this.longest+1," "));let te=this.values[A]=h||u,le=h?"success":"dark";await N.call(e,te,this.state)!==!0&&(le="danger");let ce=a[le],ue=ce(await this.indicator(e,r))+(e.pad||""),Ie=this.indent(e),he=()=>[Ie,ue,J+U,h,C].filter(Boolean).join(" ");if(o.submitted)return J=cft.unstyle(J),h=w(h),C="",he();if(e.format)h=await e.format.call(this,h,e,r);else{let De=this.styles.muted;h=Aft(this,{input:h,initial:u,pos:n,showCursor:T,color:De})}return this.isValue(h)||(h=this.styles.muted(this.symbols.ellipsis)),e.result&&(this.values[A]=await e.result.call(this,te,e,r)),T&&(J=D(J)),e.error?h+=(h?" ":"")+b(e.error.trim()):e.hint&&(h+=(h?" ":"")+E(e.hint.trim())),he()}async submit(){return this.value=this.values,super.base.submit.call(this)}};P0e.exports=N8});var O8=_((Y_t,b0e)=>{"use strict";var fft=_k(),pft=()=>{throw new Error("expected prompt to have a custom authenticate method")},x0e=(t=pft)=>{class e extends fft{constructor(o){super(o)}async submit(){this.value=await t.call(this,this.values,this.state),super.base.submit.call(this)}static create(o){return x0e(o)}}return e};b0e.exports=x0e()});var F0e=_((V_t,Q0e)=>{"use strict";var hft=O8();function gft(t,e){return t.username===this.options.username&&t.password===this.options.password}var k0e=(t=gft)=>{let e=[{name:"username",message:"username"},{name:"password",message:"password",format(o){return this.options.showPassword?o:(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(o.length))}}];class r extends hft.create(t){constructor(a){super({...a,choices:e})}static create(a){return k0e(a)}}return r};Q0e.exports=k0e()});var Hk=_((K_t,R0e)=>{"use strict";var dft=uE(),{isPrimitive:mft,hasColor:yft}=xo(),M8=class extends dft{constructor(e){super(e),this.cursorHide()}async initialize(){let e=await this.resolve(this.initial,this.state);this.input=await this.cast(e),await super.initialize()}dispatch(e){return this.isValue(e)?(this.input=e,this.submit()):this.alert()}format(e){let{styles:r,state:o}=this;return o.submitted?r.success(e):r.primary(e)}cast(e){return this.isTrue(e)}isTrue(e){return/^[ty1]/i.test(e)}isFalse(e){return/^[fn0]/i.test(e)}isValue(e){return mft(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");return yft(e)?e:this.styles.muted(e)}}async render(){let{input:e,size:r}=this.state,o=await this.prefix(),a=await this.separator(),n=await this.message(),u=this.styles.muted(this.default),A=[o,n,u,a].filter(Boolean).join(" ");this.state.prompt=A;let p=await this.header(),h=this.value=this.cast(e),E=await this.format(h),w=await this.error()||await this.hint(),D=await this.footer();w&&!A.includes(w)&&(E+=" "+w),A+=" "+E,this.clear(r),this.write([p,A,D].filter(Boolean).join(` -`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};R0e.exports=M8});var L0e=_((J_t,T0e)=>{"use strict";var Eft=Hk(),U8=class extends Eft{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};T0e.exports=U8});var O0e=_((z_t,N0e)=>{"use strict";var Cft=Qh(),Ift=_k(),AE=Ift.prototype,_8=class extends Cft{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let o=this.focused,a=o.parent||{};return!o.editable&&!a.editable&&(e==="a"||e==="i")?super[e]():AE.dispatch.call(this,e,r)}append(e,r){return AE.append.call(this,e,r)}delete(e,r){return AE.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?AE.next.call(this):super.next()}prev(){return this.focused.editable?AE.prev.call(this):super.prev()}async indicator(e,r){let o=e.indicator||"",a=e.editable?o:super.indicator(e,r);return await this.resolve(a,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?AE.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let o=r.parent?this.value[r.parent.name]:this.value;if(r.editable?o=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(o=r.enabled===!0),e=await r.validate(o,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};N0e.exports=_8});var Kg=_((X_t,M0e)=>{"use strict";var wft=uE(),Bft=L8(),{isPrimitive:vft}=xo(),H8=class extends wft{constructor(e){super(e),this.initial=vft(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let o=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!o||o.name!=="return")?this.append(` -`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:o}=this.state;this.input=`${o}`.slice(0,r)+e+`${o}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),o=this.input.slice(e),a=r.split(" ");this.state.clipboard.push(a.pop()),this.input=a.join(" "),this.cursor=this.input.length,this.input+=o,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):Bft(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),o=await this.separator(),a=await this.message(),n=[r,a,o].filter(Boolean).join(" ");this.state.prompt=n;let u=await this.header(),A=await this.format(),p=await this.error()||await this.hint(),h=await this.footer();p&&!A.includes(p)&&(A+=" "+p),n+=" "+A,this.clear(e),this.write([u,n,h].filter(Boolean).join(` -`)),this.restore()}};M0e.exports=H8});var _0e=_((Z_t,U0e)=>{"use strict";var Dft=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),qk=t=>Dft(t).filter(Boolean);U0e.exports=(t,e={},r="")=>{let{past:o=[],present:a=""}=e,n,u;switch(t){case"prev":case"undo":return n=o.slice(0,o.length-1),u=o[o.length-1]||"",{past:qk([r,...n]),present:u};case"next":case"redo":return n=o.slice(1),u=o[0]||"",{past:qk([...n,r]),present:u};case"save":return{past:qk([...o,r]),present:""};case"remove":return u=qk(o.filter(A=>A!==r)),a="",u.length&&(a=u.pop()),{past:u,present:a};default:throw new Error(`Invalid action: "${t}"`)}}});var j8=_(($_t,q0e)=>{"use strict";var Sft=Kg(),H0e=_0e(),q8=class extends Sft{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let o=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:o},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=H0e(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){this.store&&(this.data=H0e("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};q0e.exports=q8});var G0e=_((e8t,j0e)=>{"use strict";var Pft=Kg(),G8=class extends Pft{format(){return""}};j0e.exports=G8});var Y0e=_((t8t,W0e)=>{"use strict";var xft=Kg(),W8=class extends xft{constructor(e={}){super(e),this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};W0e.exports=W8});var K0e=_((r8t,V0e)=>{"use strict";var bft=Qh(),Y8=class extends bft{constructor(e){super({...e,multiple:!0})}};V0e.exports=Y8});var K8=_((n8t,J0e)=>{"use strict";var kft=Kg(),V8=class extends kft{constructor(e={}){super({style:"number",...e}),this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,o=this.toNumber(this.input);return o>this.max+r?this.alert():(this.input=`${o+r}`,this.render())}down(e){let r=e||this.minor,o=this.toNumber(this.input);return othis.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};J0e.exports=V8});var X0e=_((i8t,z0e)=>{z0e.exports=K8()});var $0e=_((s8t,Z0e)=>{"use strict";var Qft=Kg(),J8=class extends Qft{constructor(e){super(e),this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};Z0e.exports=J8});var rge=_((o8t,tge)=>{"use strict";var Fft=eu(),Rft=b2(),ege=xo(),z8=class extends Rft{constructor(e={}){super(e),this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||` - `;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((o,a)=>({name:a+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let o=0;o=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){return this.scaleKey===!1||this.state.submitted?"":["",...this.scale.map(o=>` ${o.name} - ${o.message}`)].map(o=>this.styles.muted(o)).join(` -`)}renderScaleHeading(e){let r=this.scale.map(p=>p.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let o=this.scaleLength-r.join("").length,a=Math.round(o/(r.length-1)),u=r.map(p=>this.styles.strong(p)).join(" ".repeat(a)),A=" ".repeat(this.widths[0]);return this.margin[3]+A+this.margin[1]+u}scaleIndicator(e,r,o){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,o);let a=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):a?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let o=e.scale.map(n=>this.scaleIndicator(e,n,r)),a=this.term==="Hyper"?"":" ";return o.join(a+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let o=this.index===r,a=await this.pointer(e,r),n=await e.hint;n&&!ege.hasColor(n)&&(n=this.styles.muted(n));let u=C=>this.margin[3]+C.replace(/\s+$/,"").padEnd(this.widths[0]," "),A=this.newline,p=this.indent(e),h=await this.resolve(e.message,this.state,e,r),E=await this.renderScale(e,r),w=this.margin[1]+this.margin[3];this.scaleLength=Fft.unstyle(E).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-w.length);let b=ege.wordWrap(h,{width:this.widths[0],newline:A}).split(` -`).map(C=>u(C)+this.margin[1]);return o&&(E=this.styles.info(E),b=b.map(C=>this.styles.info(C))),b[0]+=E,this.linebreak&&b.push(""),[p+a,b.join(` -`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(a,n)=>await this.renderChoice(a,n)),r=await Promise.all(e),o=await this.renderScaleHeading();return this.margin[0]+[o,...r.map(a=>a.join(" "))].join(` -`)}async render(){let{submitted:e,size:r}=this.state,o=await this.prefix(),a=await this.separator(),n=await this.message(),u="";this.options.promptLine!==!1&&(u=[o,n,a,""].join(" "),this.state.prompt=u);let A=await this.header(),p=await this.format(),h=await this.renderScaleKey(),E=await this.error()||await this.hint(),w=await this.renderChoices(),D=await this.footer(),b=this.emptyError;p&&(u+=p),E&&!u.includes(E)&&(u+=" "+E),e&&!p&&!w.trim()&&this.multiple&&b!=null&&(u+=this.styles.danger(b)),this.clear(r),this.write([A,u,h,w,D].filter(Boolean).join(` -`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};tge.exports=z8});var sge=_((a8t,ige)=>{"use strict";var nge=eu(),Tft=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",Z8=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=Tft(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},Lft=async(t={},e={},r=o=>o)=>{let o=new Set,a=t.fields||[],n=t.template,u=[],A=[],p=[],h=1;typeof n=="function"&&(n=await n());let E=-1,w=()=>n[++E],D=()=>n[E+1],b=C=>{C.line=h,u.push(C)};for(b({type:"bos",value:""});Ele.name===U.key);U.field=a.find(le=>le.name===U.key),te||(te=new Z8(U),A.push(te)),te.lines.push(U.line-1);continue}let T=u[u.length-1];T.type==="text"&&T.line===h?T.value+=C:b({type:"text",value:C})}return b({type:"eos",value:""}),{input:n,tabstops:u,unique:o,keys:p,items:A}};ige.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),o={...e.values,...e.initial},{tabstops:a,items:n,keys:u}=await Lft(e,o),A=X8("result",t,e),p=X8("format",t,e),h=X8("validate",t,e,!0),E=t.isValue.bind(t);return async(w={},D=!1)=>{let b=0;w.required=r,w.items=n,w.keys=u,w.output="";let C=async(J,te,le,ce)=>{let ue=await h(J,te,le,ce);return ue===!1?"Invalid field "+le.name:ue};for(let J of a){let te=J.value,le=J.key;if(J.type!=="template"){te&&(w.output+=te);continue}if(J.type==="template"){let ce=n.find(Ee=>Ee.name===le);e.required===!0&&w.required.add(ce.name);let ue=[ce.input,w.values[ce.value],ce.value,te].find(E),he=(ce.field||{}).message||J.inner;if(D){let Ee=await C(w.values[le],w,ce,b);if(Ee&&typeof Ee=="string"||Ee===!1){w.invalid.set(le,Ee);continue}w.invalid.delete(le);let g=await A(w.values[le],w,ce,b);w.output+=nge.unstyle(g);continue}ce.placeholder=!1;let De=te;te=await p(te,w,ce,b),ue!==te?(w.values[le]=ue,te=t.styles.typing(ue),w.missing.delete(he)):(w.values[le]=void 0,ue=`<${he}>`,te=t.styles.primary(ue),ce.placeholder=!0,w.required.has(le)&&w.missing.add(he)),w.missing.has(he)&&w.validating&&(te=t.styles.warning(ue)),w.invalid.has(le)&&w.validating&&(te=t.styles.danger(ue)),b===w.index&&(De!==te?te=t.styles.underline(te):te=t.styles.heading(nge.unstyle(te))),b++}te&&(w.output+=te)}let T=w.output.split(` -`).map(J=>" "+J),N=n.length,U=0;for(let J of n)w.invalid.has(J.name)&&J.lines.forEach(te=>{T[te][0]===" "&&(T[te]=w.styles.danger(w.symbols.bullet)+T[te].slice(1))}),t.isValue(w.values[J.name])&&U++;return w.completed=(U/N*100).toFixed(0),w.output=T.join(` -`),w.output}};function X8(t,e,r,o){return(a,n,u,A)=>typeof u.field[t]=="function"?u.field[t].call(e,a,n,u,A):[o,a].find(p=>e.isValue(p))}});var age=_((l8t,oge)=>{"use strict";var Nft=eu(),Oft=sge(),Mft=uE(),$8=class extends Mft{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Oft(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let o=this.getItem(),a=o.input.slice(0,this.cursor),n=o.input.slice(this.cursor);this.input=o.input=`${a}${e}${n}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),o=e.input.slice(0,this.cursor-1);this.input=e.input=`${o}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:o,size:a}=this.state,n=[this.options.newline,` -`].find(J=>J!=null),u=await this.prefix(),A=await this.separator(),p=await this.message(),h=[u,p,A].filter(Boolean).join(" ");this.state.prompt=h;let E=await this.header(),w=await this.error()||"",D=await this.hint()||"",b=o?"":await this.interpolate(this.state),C=this.state.key=r[e]||"",T=await this.format(C),N=await this.footer();T&&(h+=" "+T),D&&!T&&this.state.completed===0&&(h+=" "+D),this.clear(a);let U=[E,h,b,N,w.trim()];this.write(U.filter(Boolean).join(n)),this.restore()}getItem(e){let{items:r,keys:o,index:a}=this.state,n=r.find(u=>u.name===o[a]);return n&&n.input!=null&&(this.input=n.input,this.cursor=n.cursor),n}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:o,values:a}=this.state;if(e.size){let A="";for(let[p,h]of e)A+=`Invalid ${p}: ${h} -`;return this.state.error=A,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let u=Nft.unstyle(o).split(` -`).map(A=>A.slice(1)).join(` -`);return this.value={values:a,result:u},super.submit()}};oge.exports=$8});var cge=_((c8t,lge)=>{"use strict";var Uft="(Use + to sort)",_ft=Qh(),eH=class extends _ft{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,Uft].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let o=await super.renderChoice(e,r),a=this.symbols.identicalTo+" ",n=this.index===r&&this.sorting?this.styles.muted(a):" ";return this.options.drag===!1&&(n=""),this.options.numbered===!0?n+`${r+1} - `+o:n+o}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};lge.exports=eH});var Age=_((u8t,uge)=>{"use strict";var Hft=b2(),tH=class extends Hft{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(o=>this.styles.muted(o)),this.state.header=r.join(` - `)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let o of r)o.scale=qft(5,this.options),o.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],o=r.selected;return e.scale.forEach(a=>a.selected=!1),r.selected=!o,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let o=this.index===r,a=this.term==="Hyper",n=a?9:8,u=a?"":" ",A=this.symbols.line.repeat(n),p=" ".repeat(n+(a?0:1)),h=te=>(te?this.styles.success("\u25C9"):"\u25EF")+u,E=r+1+".",w=o?this.styles.heading:this.styles.noop,D=await this.resolve(e.message,this.state,e,r),b=this.indent(e),C=b+e.scale.map((te,le)=>h(le===e.scaleIdx)).join(A),T=te=>te===e.scaleIdx?w(te):te,N=b+e.scale.map((te,le)=>T(le)).join(p),U=()=>[E,D].filter(Boolean).join(" "),J=()=>[U(),C,N," "].filter(Boolean).join(` -`);return o&&(C=this.styles.cyan(C),N=this.styles.cyan(N)),J()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(o,a)=>await this.renderChoice(o,a)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(` -`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,o=await this.prefix(),a=await this.separator(),n=await this.message(),u=[o,n,a].filter(Boolean).join(" ");this.state.prompt=u;let A=await this.header(),p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),w=await this.footer();(p||!h)&&(u+=" "+p),h&&!u.includes(h)&&(u+=" "+h),e&&!p&&!E&&this.multiple&&this.type!=="form"&&(u+=this.styles.danger(this.emptyError)),this.clear(r),this.write([u,A,E,w].filter(Boolean).join(` -`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function qft(t,e={}){if(Array.isArray(e.scale))return e.scale.map(o=>({...o}));let r=[];for(let o=1;o{fge.exports=j8()});var gge=_((f8t,hge)=>{"use strict";var jft=Hk(),rH=class extends jft{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=o=>this.styles.primary.underline(o);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),o=await this.prefix(),a=await this.separator(),n=await this.message(),u=await this.format(),A=await this.error()||await this.hint(),p=await this.footer(),h=[o,n,a,u].join(" ");this.state.prompt=h,A&&!h.includes(A)&&(h+=" "+A),this.clear(e),this.write([r,h,p].filter(Boolean).join(` -`)),this.write(this.margin[2]),this.restore()}};hge.exports=rH});var mge=_((p8t,dge)=>{"use strict";var Gft=Qh(),nH=class extends Gft{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let o=await super.toChoices(e,r);if(o.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>o.length)throw new Error("Please specify the index of the correct answer from the list of choices");return o}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};dge.exports=nH});var Ege=_(iH=>{"use strict";var yge=xo(),fs=(t,e)=>{yge.defineExport(iH,t,e),yge.defineExport(iH,t.toLowerCase(),e)};fs("AutoComplete",()=>D0e());fs("BasicAuth",()=>F0e());fs("Confirm",()=>L0e());fs("Editable",()=>O0e());fs("Form",()=>_k());fs("Input",()=>j8());fs("Invisible",()=>G0e());fs("List",()=>Y0e());fs("MultiSelect",()=>K0e());fs("Numeral",()=>X0e());fs("Password",()=>$0e());fs("Scale",()=>rge());fs("Select",()=>Qh());fs("Snippet",()=>age());fs("Sort",()=>cge());fs("Survey",()=>Age());fs("Text",()=>pge());fs("Toggle",()=>gge());fs("Quiz",()=>mge())});var Ige=_((g8t,Cge)=>{Cge.exports={ArrayPrompt:b2(),AuthPrompt:O8(),BooleanPrompt:Hk(),NumberPrompt:K8(),StringPrompt:Kg()}});var Q2=_((d8t,Bge)=>{"use strict";var wge=ve("assert"),oH=ve("events"),Fh=xo(),ru=class extends oH{constructor(e,r){super(),this.options=Fh.merge({},e),this.answers={...r}}register(e,r){if(Fh.isObject(e)){for(let a of Object.keys(e))this.register(a,e[a]);return this}wge.equal(typeof r,"function","expected a function");let o=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[o]=r:this.prompts[o]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(Fh.merge({},this.options,r))}catch(o){return Promise.reject(o)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=Fh.merge({},this.options,e),{type:o,name:a}=e,{set:n,get:u}=Fh;if(typeof o=="function"&&(o=await o.call(this,e,this.answers)),!o)return this.answers[a];wge(this.prompts[o],`Prompt "${o}" is not registered`);let A=new this.prompts[o](r),p=u(this.answers,a);A.state.answers=this.answers,A.enquirer=this,a&&A.on("submit",E=>{this.emit("answer",a,E,A),n(this.answers,a,E)});let h=A.emit.bind(A);return A.emit=(...E)=>(this.emit.call(this,...E),h(...E)),this.emit("prompt",A,this),r.autofill&&p!=null?(A.value=A.input=p,r.autofill==="show"&&await A.submit()):p=A.value=await A.run(),p}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||uE()}static get prompts(){return Ege()}static get types(){return Ige()}static get prompt(){let e=(r,...o)=>{let a=new this(...o),n=a.emit.bind(a);return a.emit=(...u)=>(e.emit(...u),n(...u)),a.prompt(r)};return Fh.mixinEmitter(e,new oH),e}};Fh.mixinEmitter(ru,new oH);var sH=ru.prompts;for(let t of Object.keys(sH)){let e=t.toLowerCase(),r=o=>new sH[t](o).run();ru.prompt[e]=r,ru[e]=r,ru[t]||Reflect.defineProperty(ru,t,{get:()=>sH[t]})}var k2=t=>{Fh.defineExport(ru,t,()=>ru.types[t])};k2("ArrayPrompt");k2("AuthPrompt");k2("BooleanPrompt");k2("NumberPrompt");k2("StringPrompt");Bge.exports=ru});var L2=_((Z8t,kge)=>{var zft=bk();function Xft(t,e,r){var o=t==null?void 0:zft(t,e);return o===void 0?r:o}kge.exports=Xft});var Rge=_((iHt,Fge)=>{function Zft(t,e){for(var r=-1,o=t==null?0:t.length;++r{var $ft=Eg(),ept=PP();function tpt(t,e){return t&&$ft(e,ept(e),t)}Tge.exports=tpt});var Oge=_((oHt,Nge)=>{var rpt=Eg(),npt=Km();function ipt(t,e){return t&&rpt(e,npt(e),t)}Nge.exports=ipt});var Uge=_((aHt,Mge)=>{var spt=Eg(),opt=IP();function apt(t,e){return spt(t,opt(t),e)}Mge.exports=apt});var fH=_((lHt,_ge)=>{var lpt=CP(),cpt=FP(),upt=IP(),Apt=bN(),fpt=Object.getOwnPropertySymbols,ppt=fpt?function(t){for(var e=[];t;)lpt(e,upt(t)),t=cpt(t);return e}:Apt;_ge.exports=ppt});var qge=_((cHt,Hge)=>{var hpt=Eg(),gpt=fH();function dpt(t,e){return hpt(t,gpt(t),e)}Hge.exports=dpt});var pH=_((uHt,jge)=>{var mpt=xN(),ypt=fH(),Ept=Km();function Cpt(t){return mpt(t,Ept,ypt)}jge.exports=Cpt});var Wge=_((AHt,Gge)=>{var Ipt=Object.prototype,wpt=Ipt.hasOwnProperty;function Bpt(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&wpt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}Gge.exports=Bpt});var Vge=_((fHt,Yge)=>{var vpt=kP();function Dpt(t,e){var r=e?vpt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}Yge.exports=Dpt});var Jge=_((pHt,Kge)=>{var Spt=/\w*$/;function Ppt(t){var e=new t.constructor(t.source,Spt.exec(t));return e.lastIndex=t.lastIndex,e}Kge.exports=Ppt});var ede=_((hHt,$ge)=>{var zge=dg(),Xge=zge?zge.prototype:void 0,Zge=Xge?Xge.valueOf:void 0;function xpt(t){return Zge?Object(Zge.call(t)):{}}$ge.exports=xpt});var rde=_((gHt,tde)=>{var bpt=kP(),kpt=Vge(),Qpt=Jge(),Fpt=ede(),Rpt=jN(),Tpt="[object Boolean]",Lpt="[object Date]",Npt="[object Map]",Opt="[object Number]",Mpt="[object RegExp]",Upt="[object Set]",_pt="[object String]",Hpt="[object Symbol]",qpt="[object ArrayBuffer]",jpt="[object DataView]",Gpt="[object Float32Array]",Wpt="[object Float64Array]",Ypt="[object Int8Array]",Vpt="[object Int16Array]",Kpt="[object Int32Array]",Jpt="[object Uint8Array]",zpt="[object Uint8ClampedArray]",Xpt="[object Uint16Array]",Zpt="[object Uint32Array]";function $pt(t,e,r){var o=t.constructor;switch(e){case qpt:return bpt(t);case Tpt:case Lpt:return new o(+t);case jpt:return kpt(t,r);case Gpt:case Wpt:case Ypt:case Vpt:case Kpt:case Jpt:case zpt:case Xpt:case Zpt:return Rpt(t,r);case Npt:return new o;case Opt:case _pt:return new o(t);case Mpt:return Qpt(t);case Upt:return new o;case Hpt:return Fpt(t)}}tde.exports=$pt});var ide=_((dHt,nde)=>{var eht=a1(),tht=Zu(),rht="[object Map]";function nht(t){return tht(t)&&eht(t)==rht}nde.exports=nht});var lde=_((mHt,ade)=>{var iht=ide(),sht=BP(),sde=vP(),ode=sde&&sde.isMap,oht=ode?sht(ode):iht;ade.exports=oht});var ude=_((yHt,cde)=>{var aht=a1(),lht=Zu(),cht="[object Set]";function uht(t){return lht(t)&&aht(t)==cht}cde.exports=uht});var hde=_((EHt,pde)=>{var Aht=ude(),fht=BP(),Ade=vP(),fde=Ade&&Ade.isSet,pht=fde?fht(fde):Aht;pde.exports=pht});var hH=_((CHt,yde)=>{var hht=yP(),ght=Rge(),dht=RP(),mht=Lge(),yht=Oge(),Eht=qN(),Cht=QP(),Iht=Uge(),wht=qge(),Bht=RN(),vht=pH(),Dht=a1(),Sht=Wge(),Pht=rde(),xht=GN(),bht=jl(),kht=r1(),Qht=lde(),Fht=cl(),Rht=hde(),Tht=PP(),Lht=Km(),Nht=1,Oht=2,Mht=4,gde="[object Arguments]",Uht="[object Array]",_ht="[object Boolean]",Hht="[object Date]",qht="[object Error]",dde="[object Function]",jht="[object GeneratorFunction]",Ght="[object Map]",Wht="[object Number]",mde="[object Object]",Yht="[object RegExp]",Vht="[object Set]",Kht="[object String]",Jht="[object Symbol]",zht="[object WeakMap]",Xht="[object ArrayBuffer]",Zht="[object DataView]",$ht="[object Float32Array]",e0t="[object Float64Array]",t0t="[object Int8Array]",r0t="[object Int16Array]",n0t="[object Int32Array]",i0t="[object Uint8Array]",s0t="[object Uint8ClampedArray]",o0t="[object Uint16Array]",a0t="[object Uint32Array]",Ai={};Ai[gde]=Ai[Uht]=Ai[Xht]=Ai[Zht]=Ai[_ht]=Ai[Hht]=Ai[$ht]=Ai[e0t]=Ai[t0t]=Ai[r0t]=Ai[n0t]=Ai[Ght]=Ai[Wht]=Ai[mde]=Ai[Yht]=Ai[Vht]=Ai[Kht]=Ai[Jht]=Ai[i0t]=Ai[s0t]=Ai[o0t]=Ai[a0t]=!0;Ai[qht]=Ai[dde]=Ai[zht]=!1;function Gk(t,e,r,o,a,n){var u,A=e&Nht,p=e&Oht,h=e&Mht;if(r&&(u=a?r(t,o,a,n):r(t)),u!==void 0)return u;if(!Fht(t))return t;var E=bht(t);if(E){if(u=Sht(t),!A)return Cht(t,u)}else{var w=Dht(t),D=w==dde||w==jht;if(kht(t))return Eht(t,A);if(w==mde||w==gde||D&&!a){if(u=p||D?{}:xht(t),!A)return p?wht(t,yht(u,t)):Iht(t,mht(u,t))}else{if(!Ai[w])return a?t:{};u=Pht(t,w,A)}}n||(n=new hht);var b=n.get(t);if(b)return b;n.set(t,u),Rht(t)?t.forEach(function(N){u.add(Gk(N,e,r,N,t,n))}):Qht(t)&&t.forEach(function(N,U){u.set(U,Gk(N,e,r,U,t,n))});var C=h?p?vht:Bht:p?Lht:Tht,T=E?void 0:C(t);return ght(T||t,function(N,U){T&&(U=N,N=t[U]),dht(u,U,Gk(N,e,r,U,t,n))}),u}yde.exports=Gk});var gH=_((IHt,Ede)=>{var l0t=hH(),c0t=1,u0t=4;function A0t(t){return l0t(t,c0t|u0t)}Ede.exports=A0t});var dH=_((wHt,Cde)=>{var f0t=o8();function p0t(t,e,r){return t==null?t:f0t(t,e,r)}Cde.exports=p0t});var Dde=_((xHt,vde)=>{var h0t=Object.prototype,g0t=h0t.hasOwnProperty;function d0t(t,e){return t!=null&&g0t.call(t,e)}vde.exports=d0t});var Pde=_((bHt,Sde)=>{var m0t=Dde(),y0t=a8();function E0t(t,e){return t!=null&&y0t(t,e,m0t)}Sde.exports=E0t});var bde=_((kHt,xde)=>{function C0t(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}xde.exports=C0t});var Qde=_((QHt,kde)=>{var I0t=bk(),w0t=XU();function B0t(t,e){return e.length<2?t:I0t(t,w0t(e,0,-1))}kde.exports=B0t});var yH=_((FHt,Fde)=>{var v0t=Wg(),D0t=bde(),S0t=Qde(),P0t=nE();function x0t(t,e){return e=v0t(e,t),t=S0t(t,e),t==null||delete t[P0t(D0t(e))]}Fde.exports=x0t});var EH=_((RHt,Rde)=>{var b0t=yH();function k0t(t,e){return t==null?!0:b0t(t,e)}Rde.exports=k0t});var Mde=_((l6t,R0t)=>{R0t.exports={name:"@yarnpkg/cli",version:"4.7.0",license:"BSD-2-Clause",main:"./sources/index.ts",exports:{".":"./sources/index.ts","./polyfills":"./sources/polyfills.ts","./package.json":"./package.json"},dependencies:{"@yarnpkg/core":"workspace:^","@yarnpkg/fslib":"workspace:^","@yarnpkg/libzip":"workspace:^","@yarnpkg/parsers":"workspace:^","@yarnpkg/plugin-compat":"workspace:^","@yarnpkg/plugin-constraints":"workspace:^","@yarnpkg/plugin-dlx":"workspace:^","@yarnpkg/plugin-essentials":"workspace:^","@yarnpkg/plugin-exec":"workspace:^","@yarnpkg/plugin-file":"workspace:^","@yarnpkg/plugin-git":"workspace:^","@yarnpkg/plugin-github":"workspace:^","@yarnpkg/plugin-http":"workspace:^","@yarnpkg/plugin-init":"workspace:^","@yarnpkg/plugin-interactive-tools":"workspace:^","@yarnpkg/plugin-link":"workspace:^","@yarnpkg/plugin-nm":"workspace:^","@yarnpkg/plugin-npm":"workspace:^","@yarnpkg/plugin-npm-cli":"workspace:^","@yarnpkg/plugin-pack":"workspace:^","@yarnpkg/plugin-patch":"workspace:^","@yarnpkg/plugin-pnp":"workspace:^","@yarnpkg/plugin-pnpm":"workspace:^","@yarnpkg/plugin-stage":"workspace:^","@yarnpkg/plugin-typescript":"workspace:^","@yarnpkg/plugin-version":"workspace:^","@yarnpkg/plugin-workspace-tools":"workspace:^","@yarnpkg/shell":"workspace:^","ci-info":"^4.0.0",clipanion:"^4.0.0-rc.2",semver:"^7.1.2",tslib:"^2.4.0",typanion:"^3.14.0"},devDependencies:{"@types/semver":"^7.1.0","@yarnpkg/builder":"workspace:^","@yarnpkg/monorepo":"workspace:^","@yarnpkg/pnpify":"workspace:^"},peerDependencies:{"@yarnpkg/core":"workspace:^"},scripts:{postpack:"rm -rf lib",prepack:'run build:compile "$(pwd)"',"build:cli+hook":"run build:pnp:hook && builder build bundle","build:cli":"builder build bundle","run:cli":"builder run","update-local":"run build:cli --no-git-hash && rsync -a --delete bundles/ bin/"},publishConfig:{main:"./lib/index.js",bin:null,exports:{".":"./lib/index.js","./package.json":"./package.json"}},files:["/lib/**/*","!/lib/pluginConfiguration.*","!/lib/cli.*"],"@yarnpkg/builder":{bundles:{standard:["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-constraints","@yarnpkg/plugin-dlx","@yarnpkg/plugin-exec","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp","@yarnpkg/plugin-pnpm","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"]}},repository:{type:"git",url:"git+https://github.com/yarnpkg/berry.git",directory:"packages/yarnpkg-cli"},engines:{node:">=18.12.0"}}});var xH=_((UGt,zde)=>{"use strict";zde.exports=function(e,r){r===!0&&(r=0);var o="";if(typeof e=="string")try{o=new URL(e).protocol}catch{}else e&&e.constructor===URL&&(o=e.protocol);var a=o.split(/\:|\+/).filter(Boolean);return typeof r=="number"?a[r]:a}});var Zde=_((_Gt,Xde)=>{"use strict";var $0t=xH();function egt(t){var e={protocols:[],protocol:null,port:null,resource:"",host:"",user:"",password:"",pathname:"",hash:"",search:"",href:t,query:{},parse_failed:!1};try{var r=new URL(t);e.protocols=$0t(r),e.protocol=e.protocols[0],e.port=r.port,e.resource=r.hostname,e.host=r.host,e.user=r.username||"",e.password=r.password||"",e.pathname=r.pathname,e.hash=r.hash.slice(1),e.search=r.search.slice(1),e.href=r.href,e.query=Object.fromEntries(r.searchParams)}catch{e.protocols=["file"],e.protocol=e.protocols[0],e.port="",e.resource="",e.user="",e.pathname="",e.hash="",e.search="",e.href=t,e.query={},e.parse_failed=!0}return e}Xde.exports=egt});var tme=_((HGt,eme)=>{"use strict";var tgt=Zde();function rgt(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ngt=rgt(tgt),igt="text/plain",sgt="us-ascii",$de=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),ogt=(t,{stripHash:e})=>{let r=/^data:(?[^,]*?),(?[^#]*?)(?:#(?.*))?$/.exec(t);if(!r)throw new Error(`Invalid URL: ${t}`);let{type:o,data:a,hash:n}=r.groups,u=o.split(";");n=e?"":n;let A=!1;u[u.length-1]==="base64"&&(u.pop(),A=!0);let p=(u.shift()||"").toLowerCase(),E=[...u.map(w=>{let[D,b=""]=w.split("=").map(C=>C.trim());return D==="charset"&&(b=b.toLowerCase(),b===sgt)?"":`${D}${b?`=${b}`:""}`}).filter(Boolean)];return A&&E.push("base64"),(E.length>0||p&&p!==igt)&&E.unshift(p),`data:${E.join(";")},${A?a.trim():a}${n?`#${n}`:""}`};function agt(t,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},t=t.trim(),/^data:/i.test(t))return ogt(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let a=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&a.protocol==="https:"&&(a.protocol="http:"),e.forceHttps&&a.protocol==="http:"&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash?a.hash="":e.stripTextFragment&&(a.hash=a.hash.replace(/#?:~:text.*?$/i,"")),a.pathname){let u=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,A=0,p="";for(;;){let E=u.exec(a.pathname);if(!E)break;let w=E[0],D=E.index,b=a.pathname.slice(A,D);p+=b.replace(/\/{2,}/g,"/"),p+=w,A=D+w.length}let h=a.pathname.slice(A,a.pathname.length);p+=h.replace(/\/{2,}/g,"/"),a.pathname=p}if(a.pathname)try{a.pathname=decodeURI(a.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let u=a.pathname.split("/"),A=u[u.length-1];$de(A,e.removeDirectoryIndex)&&(u=u.slice(0,-1),a.pathname=u.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let u of[...a.searchParams.keys()])$de(u,e.removeQueryParameters)&&a.searchParams.delete(u);if(e.removeQueryParameters===!0&&(a.search=""),e.sortQueryParameters){a.searchParams.sort();try{a.search=decodeURIComponent(a.search)}catch{}}e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,""));let n=t;return t=a.toString(),!e.removeSingleSlash&&a.pathname==="/"&&!n.endsWith("/")&&a.hash===""&&(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||a.pathname==="/")&&a.hash===""&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}var bH=(t,e=!1)=>{let r=/^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/,o=n=>{let u=new Error(n);throw u.subject_url=t,u};(typeof t!="string"||!t.trim())&&o("Invalid url."),t.length>bH.MAX_INPUT_LENGTH&&o("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH."),e&&(typeof e!="object"&&(e={stripHash:!1}),t=agt(t,e));let a=ngt.default(t);if(a.parse_failed){let n=a.href.match(r);n?(a.protocols=["ssh"],a.protocol="ssh",a.resource=n[2],a.host=n[2],a.user=n[1],a.pathname=`/${n[3]}`,a.parse_failed=!1):o("URL parsing failed.")}return a};bH.MAX_INPUT_LENGTH=2048;eme.exports=bH});var ime=_((qGt,nme)=>{"use strict";var lgt=xH();function rme(t){if(Array.isArray(t))return t.indexOf("ssh")!==-1||t.indexOf("rsync")!==-1;if(typeof t!="string")return!1;var e=lgt(t);if(t=t.substring(t.indexOf("://")+3),rme(e))return!0;var r=new RegExp(".([a-zA-Z\\d]+):(\\d+)/");return!t.match(r)&&t.indexOf("@"){"use strict";var cgt=tme(),sme=ime();function ugt(t){var e=cgt(t);return e.token="",e.password==="x-oauth-basic"?e.token=e.user:e.user==="x-token-auth"&&(e.token=e.password),sme(e.protocols)||e.protocols.length===0&&sme(t)?e.protocol="ssh":e.protocols.length?e.protocol=e.protocols[0]:(e.protocol="file",e.protocols=["file"]),e.href=e.href.replace(/\/$/,""),e}ome.exports=ugt});var cme=_((GGt,lme)=>{"use strict";var Agt=ame();function kH(t){if(typeof t!="string")throw new Error("The url must be a string.");var e=/^([a-z\d-]{1,39})\/([-\.\w]{1,100})$/i;e.test(t)&&(t="https://github.com/"+t);var r=Agt(t),o=r.resource.split("."),a=null;switch(r.toString=function(N){return kH.stringify(this,N)},r.source=o.length>2?o.slice(1-o.length).join("."):r.source=r.resource,r.git_suffix=/\.git$/.test(r.pathname),r.name=decodeURIComponent((r.pathname||r.href).replace(/(^\/)|(\/$)/g,"").replace(/\.git$/,"")),r.owner=decodeURIComponent(r.user),r.source){case"git.cloudforge.com":r.owner=r.user,r.organization=o[0],r.source="cloudforge.com";break;case"visualstudio.com":if(r.resource==="vs-ssh.visualstudio.com"){a=r.name.split("/"),a.length===4&&(r.organization=a[1],r.owner=a[2],r.name=a[3],r.full_name=a[2]+"/"+a[3]);break}else{a=r.name.split("/"),a.length===2?(r.owner=a[1],r.name=a[1],r.full_name="_git/"+r.name):a.length===3?(r.name=a[2],a[0]==="DefaultCollection"?(r.owner=a[2],r.organization=a[0],r.full_name=r.organization+"/_git/"+r.name):(r.owner=a[0],r.full_name=r.owner+"/_git/"+r.name)):a.length===4&&(r.organization=a[0],r.owner=a[1],r.name=a[3],r.full_name=r.organization+"/"+r.owner+"/_git/"+r.name);break}case"dev.azure.com":case"azure.com":if(r.resource==="ssh.dev.azure.com"){a=r.name.split("/"),a.length===4&&(r.organization=a[1],r.owner=a[2],r.name=a[3]);break}else{a=r.name.split("/"),a.length===5?(r.organization=a[0],r.owner=a[1],r.name=a[4],r.full_name="_git/"+r.name):a.length===3?(r.name=a[2],a[0]==="DefaultCollection"?(r.owner=a[2],r.organization=a[0],r.full_name=r.organization+"/_git/"+r.name):(r.owner=a[0],r.full_name=r.owner+"/_git/"+r.name)):a.length===4&&(r.organization=a[0],r.owner=a[1],r.name=a[3],r.full_name=r.organization+"/"+r.owner+"/_git/"+r.name),r.query&&r.query.path&&(r.filepath=r.query.path.replace(/^\/+/g,"")),r.query&&r.query.version&&(r.ref=r.query.version.replace(/^GB/,""));break}default:a=r.name.split("/");var n=a.length-1;if(a.length>=2){var u=a.indexOf("-",2),A=a.indexOf("blob",2),p=a.indexOf("tree",2),h=a.indexOf("commit",2),E=a.indexOf("src",2),w=a.indexOf("raw",2),D=a.indexOf("edit",2);n=u>0?u-1:A>0?A-1:p>0?p-1:h>0?h-1:E>0?E-1:w>0?w-1:D>0?D-1:n,r.owner=a.slice(0,n).join("/"),r.name=a[n],h&&(r.commit=a[n+2])}r.ref="",r.filepathtype="",r.filepath="";var b=a.length>n&&a[n+1]==="-"?n+1:n;a.length>b+2&&["raw","src","blob","tree","edit"].indexOf(a[b+1])>=0&&(r.filepathtype=a[b+1],r.ref=a[b+2],a.length>b+3&&(r.filepath=a.slice(b+3).join("/"))),r.organization=r.owner;break}r.full_name||(r.full_name=r.owner,r.name&&(r.full_name&&(r.full_name+="/"),r.full_name+=r.name)),r.owner.startsWith("scm/")&&(r.source="bitbucket-server",r.owner=r.owner.replace("scm/",""),r.organization=r.owner,r.full_name=r.owner+"/"+r.name);var C=/(projects|users)\/(.*?)\/repos\/(.*?)((\/.*$)|$)/,T=C.exec(r.pathname);return T!=null&&(r.source="bitbucket-server",T[1]==="users"?r.owner="~"+T[2]:r.owner=T[2],r.organization=r.owner,r.name=T[3],a=T[4].split("/"),a.length>1&&(["raw","browse"].indexOf(a[1])>=0?(r.filepathtype=a[1],a.length>2&&(r.filepath=a.slice(2).join("/"))):a[1]==="commits"&&a.length>2&&(r.commit=a[2])),r.full_name=r.owner+"/"+r.name,r.query.at?r.ref=r.query.at:r.ref=""),r}kH.stringify=function(t,e){e=e||(t.protocols&&t.protocols.length?t.protocols.join("+"):t.protocol);var r=t.port?":"+t.port:"",o=t.user||"git",a=t.git_suffix?".git":"";switch(e){case"ssh":return r?"ssh://"+o+"@"+t.resource+r+"/"+t.full_name+a:o+"@"+t.resource+":"+t.full_name+a;case"git+ssh":case"ssh+git":case"ftp":case"ftps":return e+"://"+o+"@"+t.resource+r+"/"+t.full_name+a;case"http":case"https":var n=t.token?fgt(t):t.user&&(t.protocols.includes("http")||t.protocols.includes("https"))?t.user+"@":"";return e+"://"+n+t.resource+r+"/"+pgt(t)+a;default:return t.href}};function fgt(t){switch(t.source){case"bitbucket.org":return"x-token-auth:"+t.token+"@";default:return t.token+"@"}}function pgt(t){switch(t.source){case"bitbucket-server":return"scm/"+t.full_name;default:return""+t.full_name}}lme.exports=kH});var Dme=_((B9t,vme)=>{var vgt=Cb(),Dgt=QP(),Sgt=jl(),Pgt=fy(),xgt=s8(),bgt=nE(),kgt=t2();function Qgt(t){return Sgt(t)?vgt(t,bgt):Pgt(t)?[t]:Dgt(xgt(kgt(t)))}vme.exports=Qgt});function Lgt(t,e){return e===1&&Tgt.has(t[0])}function q2(t){let e=Array.isArray(t)?t:(0,xme.default)(t);return e.map((o,a)=>Fgt.test(o)?`[${o}]`:Rgt.test(o)&&!Lgt(e,a)?`.${o}`:`[${JSON.stringify(o)}]`).join("").replace(/^\./,"")}function Ngt(t,e){let r=[];if(e.methodName!==null&&r.push(pe.pretty(t,e.methodName,pe.Type.CODE)),e.file!==null){let o=[];o.push(pe.pretty(t,e.file,pe.Type.PATH)),e.line!==null&&(o.push(pe.pretty(t,e.line,pe.Type.NUMBER)),e.column!==null&&o.push(pe.pretty(t,e.column,pe.Type.NUMBER))),r.push(`(${o.join(pe.pretty(t,":","grey"))})`)}return r.join(" ")}function Kk(t,{manifestUpdates:e,reportedErrors:r},{fix:o}={}){let a=new Map,n=new Map,u=[...r.keys()].map(A=>[A,new Map]);for(let[A,p]of[...u,...e]){let h=r.get(A)?.map(b=>({text:b,fixable:!1}))??[],E=!1,w=t.getWorkspaceByCwd(A),D=w.manifest.exportTo({});for(let[b,C]of p){if(C.size>1){let T=[...C].map(([N,U])=>{let J=pe.pretty(t.configuration,N,pe.Type.INSPECT),te=U.size>0?Ngt(t.configuration,U.values().next().value):null;return te!==null?` -${J} at ${te}`:` -${J}`}).join("");h.push({text:`Conflict detected in constraint targeting ${pe.pretty(t.configuration,b,pe.Type.CODE)}; conflicting values are:${T}`,fixable:!1})}else{let[[T]]=C,N=(0,Sme.default)(D,b);if(JSON.stringify(N)===JSON.stringify(T))continue;if(!o){let U=typeof N>"u"?`Missing field ${pe.pretty(t.configuration,b,pe.Type.CODE)}; expected ${pe.pretty(t.configuration,T,pe.Type.INSPECT)}`:typeof T>"u"?`Extraneous field ${pe.pretty(t.configuration,b,pe.Type.CODE)} currently set to ${pe.pretty(t.configuration,N,pe.Type.INSPECT)}`:`Invalid field ${pe.pretty(t.configuration,b,pe.Type.CODE)}; expected ${pe.pretty(t.configuration,T,pe.Type.INSPECT)}, found ${pe.pretty(t.configuration,N,pe.Type.INSPECT)}`;h.push({text:U,fixable:!0});continue}typeof T>"u"?(0,bme.default)(D,b):(0,Pme.default)(D,b,T),E=!0}E&&a.set(w,D)}h.length>0&&n.set(w,h)}return{changedWorkspaces:a,remainingErrors:n}}function kme(t,{configuration:e}){let r={children:[]};for(let[o,a]of t){let n=[];for(let A of a){let p=A.text.split(/\n/);A.fixable&&(p[0]=`${pe.pretty(e,"\u2699","gray")} ${p[0]}`),n.push({value:pe.tuple(pe.Type.NO_HINT,p[0]),children:p.slice(1).map(h=>({value:pe.tuple(pe.Type.NO_HINT,h)}))})}let u={value:pe.tuple(pe.Type.LOCATOR,o.anchoredLocator),children:qe.sortMap(n,A=>A.value[1])};r.children.push(u)}return r.children=qe.sortMap(r.children,o=>o.value[1]),r}var Sme,Pme,xme,bme,ZE,Fgt,Rgt,Tgt,j2=It(()=>{Ve();Sme=et(L2()),Pme=et(dH()),xme=et(Dme()),bme=et(EH()),ZE=class{constructor(e){this.indexedFields=e;this.items=[];this.indexes={};this.clear()}clear(){this.items=[];for(let e of this.indexedFields)this.indexes[e]=new Map}insert(e){this.items.push(e);for(let r of this.indexedFields){let o=Object.hasOwn(e,r)?e[r]:void 0;if(typeof o>"u")continue;qe.getArrayWithDefault(this.indexes[r],o).push(e)}return e}find(e){if(typeof e>"u")return this.items;let r=Object.entries(e);if(r.length===0)return this.items;let o=[],a;for(let[u,A]of r){let p=u,h=Object.hasOwn(this.indexes,p)?this.indexes[p]:void 0;if(typeof h>"u"){o.push([p,A]);continue}let E=new Set(h.get(A)??[]);if(E.size===0)return[];if(typeof a>"u")a=E;else for(let w of a)E.has(w)||a.delete(w);if(a.size===0)break}let n=[...a??[]];return o.length>0&&(n=n.filter(u=>{for(let[A,p]of o)if(!(typeof p<"u"?Object.hasOwn(u,A)&&u[A]===p:Object.hasOwn(u,A)===!1))return!1;return!0})),n}},Fgt=/^[0-9]+$/,Rgt=/^[a-zA-Z0-9_]+$/,Tgt=new Set(["scripts",..._t.allDependencies])});var Qme=_((L9t,GH)=>{var Ogt;(function(t){var e=function(){return{"append/2":[new t.type.Rule(new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("L")]),new t.type.Term("foldl",[new t.type.Term("append",[]),new t.type.Var("X"),new t.type.Term("[]",[]),new t.type.Var("L")]))],"append/3":[new t.type.Rule(new t.type.Term("append",[new t.type.Term("[]",[]),new t.type.Var("X"),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("append",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("append",[new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("S")]))],"member/2":[new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("_")])]),null),new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")])]),new t.type.Term("member",[new t.type.Var("X"),new t.type.Var("Xs")]))],"permutation/2":[new t.type.Rule(new t.type.Term("permutation",[new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("permutation",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("permutation",[new t.type.Var("T"),new t.type.Var("P")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("P")]),new t.type.Term("append",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("Y")]),new t.type.Var("S")])])]))],"maplist/2":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("X")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("Xs")])]))],"maplist/3":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs")])]))],"maplist/4":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs")])]))],"maplist/5":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds")])]))],"maplist/6":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es")])]))],"maplist/7":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")]),new t.type.Term(".",[new t.type.Var("F"),new t.type.Var("Fs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E"),new t.type.Var("F")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es"),new t.type.Var("Fs")])]))],"maplist/8":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")]),new t.type.Term(".",[new t.type.Var("F"),new t.type.Var("Fs")]),new t.type.Term(".",[new t.type.Var("G"),new t.type.Var("Gs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E"),new t.type.Var("F"),new t.type.Var("G")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es"),new t.type.Var("Fs"),new t.type.Var("Gs")])]))],"include/3":[new t.type.Rule(new t.type.Term("include",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("include",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("A")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("A"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term("[]",[])]),new t.type.Var("B")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("F"),new t.type.Var("B")]),new t.type.Term(",",[new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("F")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("L"),new t.type.Var("S")])]),new t.type.Term("include",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("S")])])])])]))],"exclude/3":[new t.type.Rule(new t.type.Term("exclude",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("exclude",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("exclude",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("E")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term("[]",[])]),new t.type.Var("Q")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("R"),new t.type.Var("Q")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("R")]),new t.type.Term(",",[new t.type.Term("!",[]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("E")])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("E")])])])])])])]))],"foldl/4":[new t.type.Rule(new t.type.Term("foldl",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Var("I"),new t.type.Var("I")]),null),new t.type.Rule(new t.type.Term("foldl",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("I"),new t.type.Var("R")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("I"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])])])]),new t.type.Var("L2")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P2"),new t.type.Var("L2")]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P2")]),new t.type.Term("foldl",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("R")])])])])]))],"select/3":[new t.type.Rule(new t.type.Term("select",[new t.type.Var("E"),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Xs")]),new t.type.Var("Xs")]),null),new t.type.Rule(new t.type.Term("select",[new t.type.Var("E"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Ys")])]),new t.type.Term("select",[new t.type.Var("E"),new t.type.Var("Xs"),new t.type.Var("Ys")]))],"sum_list/2":[new t.type.Rule(new t.type.Term("sum_list",[new t.type.Term("[]",[]),new t.type.Num(0,!1)]),null),new t.type.Rule(new t.type.Term("sum_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("sum_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term("is",[new t.type.Var("S"),new t.type.Term("+",[new t.type.Var("X"),new t.type.Var("Y")])])]))],"max_list/2":[new t.type.Rule(new t.type.Term("max_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("max_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("max_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Var("Y")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("X")]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("Y")])])]))],"min_list/2":[new t.type.Rule(new t.type.Term("min_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("min_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("min_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("=<",[new t.type.Var("X"),new t.type.Var("Y")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("X")]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("Y")])])]))],"prod_list/2":[new t.type.Rule(new t.type.Term("prod_list",[new t.type.Term("[]",[]),new t.type.Num(1,!1)]),null),new t.type.Rule(new t.type.Term("prod_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("prod_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term("is",[new t.type.Var("S"),new t.type.Term("*",[new t.type.Var("X"),new t.type.Var("Y")])])]))],"last/2":[new t.type.Rule(new t.type.Term("last",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("last",[new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")]),new t.type.Var("X")]),new t.type.Term("last",[new t.type.Var("Xs"),new t.type.Var("X")]))],"prefix/2":[new t.type.Rule(new t.type.Term("prefix",[new t.type.Var("Part"),new t.type.Var("Whole")]),new t.type.Term("append",[new t.type.Var("Part"),new t.type.Var("_"),new t.type.Var("Whole")]))],"nth0/3":[new t.type.Rule(new t.type.Term("nth0",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")])]),new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")]),new t.type.Term("!",[])])])]))],"nth1/3":[new t.type.Rule(new t.type.Term("nth1",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")])]),new t.type.Term(",",[new t.type.Term(">",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")]),new t.type.Term("!",[])])])]))],"nth0/4":[new t.type.Rule(new t.type.Term("nth0",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")])]),new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term("!",[])])])]))],"nth1/4":[new t.type.Rule(new t.type.Term("nth1",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")])]),new t.type.Term(",",[new t.type.Term(">",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term("!",[])])])]))],"nth/5":[new t.type.Rule(new t.type.Term("nth",[new t.type.Var("N"),new t.type.Var("N"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("X"),new t.type.Var("Xs")]),null),new t.type.Rule(new t.type.Term("nth",[new t.type.Var("N"),new t.type.Var("O"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("Y"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Ys")])]),new t.type.Term(",",[new t.type.Term("is",[new t.type.Var("M"),new t.type.Term("+",[new t.type.Var("N"),new t.type.Num(1,!1)])]),new t.type.Term("nth",[new t.type.Var("M"),new t.type.Var("O"),new t.type.Var("Xs"),new t.type.Var("Y"),new t.type.Var("Ys")])]))],"length/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(!t.type.is_variable(A)&&!t.type.is_integer(A))o.throw_error(t.error.type("integer",A,n.indicator));else if(t.type.is_integer(A)&&A.value<0)o.throw_error(t.error.domain("not_less_than_zero",A,n.indicator));else{var p=new t.type.Term("length",[u,new t.type.Num(0,!1),A]);t.type.is_integer(A)&&(p=new t.type.Term(",",[p,new t.type.Term("!",[])])),o.prepend([new t.type.State(a.goal.replace(p),a.substitution,a)])}},"length/3":[new t.type.Rule(new t.type.Term("length",[new t.type.Term("[]",[]),new t.type.Var("N"),new t.type.Var("N")]),null),new t.type.Rule(new t.type.Term("length",[new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("X")]),new t.type.Var("A"),new t.type.Var("N")]),new t.type.Term(",",[new t.type.Term("succ",[new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("length",[new t.type.Var("X"),new t.type.Var("B"),new t.type.Var("N")])]))],"replicate/3":function(o,a,n){var u=n.args[0],A=n.args[1],p=n.args[2];if(t.type.is_variable(A))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_integer(A))o.throw_error(t.error.type("integer",A,n.indicator));else if(A.value<0)o.throw_error(t.error.domain("not_less_than_zero",A,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))o.throw_error(t.error.type("list",p,n.indicator));else{for(var h=new t.type.Term("[]"),E=0;E0;w--)E[w].equals(E[w-1])&&E.splice(w,1);for(var D=new t.type.Term("[]"),w=E.length-1;w>=0;w--)D=new t.type.Term(".",[E[w],D]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[D,A])),a.substitution,a)])}}},"msort/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(A)&&!t.type.is_fully_list(A))o.throw_error(t.error.type("list",A,n.indicator));else{for(var p=[],h=u;h.indicator==="./2";)p.push(h.args[0]),h=h.args[1];if(t.type.is_variable(h))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_empty_list(h))o.throw_error(t.error.type("list",u,n.indicator));else{for(var E=p.sort(t.compare),w=new t.type.Term("[]"),D=E.length-1;D>=0;D--)w=new t.type.Term(".",[E[D],w]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[w,A])),a.substitution,a)])}}},"keysort/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(A)&&!t.type.is_fully_list(A))o.throw_error(t.error.type("list",A,n.indicator));else{for(var p=[],h,E=u;E.indicator==="./2";){if(h=E.args[0],t.type.is_variable(h)){o.throw_error(t.error.instantiation(n.indicator));return}else if(!t.type.is_term(h)||h.indicator!=="-/2"){o.throw_error(t.error.type("pair",h,n.indicator));return}h.args[0].pair=h.args[1],p.push(h.args[0]),E=E.args[1]}if(t.type.is_variable(E))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_empty_list(E))o.throw_error(t.error.type("list",u,n.indicator));else{for(var w=p.sort(t.compare),D=new t.type.Term("[]"),b=w.length-1;b>=0;b--)D=new t.type.Term(".",[new t.type.Term("-",[w[b],w[b].pair]),D]),delete w[b].pair;o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[D,A])),a.substitution,a)])}}},"take/3":function(o,a,n){var u=n.args[0],A=n.args[1],p=n.args[2];if(t.type.is_variable(A)||t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_list(A))o.throw_error(t.error.type("list",A,n.indicator));else if(!t.type.is_integer(u))o.throw_error(t.error.type("integer",u,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))o.throw_error(t.error.type("list",p,n.indicator));else{for(var h=u.value,E=[],w=A;h>0&&w.indicator==="./2";)E.push(w.args[0]),w=w.args[1],h--;if(h===0){for(var D=new t.type.Term("[]"),h=E.length-1;h>=0;h--)D=new t.type.Term(".",[E[h],D]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[D,p])),a.substitution,a)])}}},"drop/3":function(o,a,n){var u=n.args[0],A=n.args[1],p=n.args[2];if(t.type.is_variable(A)||t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_list(A))o.throw_error(t.error.type("list",A,n.indicator));else if(!t.type.is_integer(u))o.throw_error(t.error.type("integer",u,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))o.throw_error(t.error.type("list",p,n.indicator));else{for(var h=u.value,E=[],w=A;h>0&&w.indicator==="./2";)E.push(w.args[0]),w=w.args[1],h--;h===0&&o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[w,p])),a.substitution,a)])}},"reverse/2":function(o,a,n){var u=n.args[0],A=n.args[1],p=t.type.is_instantiated_list(u),h=t.type.is_instantiated_list(A);if(t.type.is_variable(u)&&t.type.is_variable(A))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(u)&&!t.type.is_fully_list(u))o.throw_error(t.error.type("list",u,n.indicator));else if(!t.type.is_variable(A)&&!t.type.is_fully_list(A))o.throw_error(t.error.type("list",A,n.indicator));else if(!p&&!h)o.throw_error(t.error.instantiation(n.indicator));else{for(var E=p?u:A,w=new t.type.Term("[]",[]);E.indicator==="./2";)w=new t.type.Term(".",[E.args[0],w]),E=E.args[1];o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[w,p?A:u])),a.substitution,a)])}},"list_to_set/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else{for(var p=u,h=[];p.indicator==="./2";)h.push(p.args[0]),p=p.args[1];if(t.type.is_variable(p))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_term(p)||p.indicator!=="[]/0")o.throw_error(t.error.type("list",u,n.indicator));else{for(var E=[],w=new t.type.Term("[]",[]),D,b=0;b=0;b--)w=new t.type.Term(".",[E[b],w]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[A,w])),a.substitution,a)])}}}}},r=["append/2","append/3","member/2","permutation/2","maplist/2","maplist/3","maplist/4","maplist/5","maplist/6","maplist/7","maplist/8","include/3","exclude/3","foldl/4","sum_list/2","max_list/2","min_list/2","prod_list/2","last/2","prefix/2","nth0/3","nth1/3","nth0/4","nth1/4","length/2","replicate/3","select/3","sort/2","msort/2","keysort/2","take/3","drop/3","reverse/2","list_to_set/2"];typeof GH<"u"?GH.exports=function(o){t=o,new t.type.Module("lists",e(),r)}:new t.type.Module("lists",e(),r)})(Ogt)});var Yme=_(Kr=>{"use strict";var Xg=process.platform==="win32",WH="aes-256-cbc",Mgt="sha256",Tme="The current environment doesn't support interactive reading from TTY.",Xn=ve("fs"),Fme=process.binding("tty_wrap").TTY,VH=ve("child_process"),Lh=ve("path"),KH={prompt:"> ",hideEchoBack:!1,mask:"*",limit:[],limitMessage:"Input another, please.$<( [)limit(])>",defaultInput:"",trueValue:[],falseValue:[],caseSensitive:!1,keepWhitespace:!1,encoding:"utf8",bufferSize:1024,print:void 0,history:!0,cd:!1,phContent:void 0,preCheck:void 0},Vf="none",iu,eC,Rme=!1,Th,zk,YH,Ugt=0,$H="",zg=[],Xk,Lme=!1,JH=!1,G2=!1;function Nme(t){function e(r){return r.replace(/[^\w\u0080-\uFFFF]/g,function(o){return"#"+o.charCodeAt(0)+";"})}return zk.concat(function(r){var o=[];return Object.keys(r).forEach(function(a){r[a]==="boolean"?t[a]&&o.push("--"+a):r[a]==="string"&&t[a]&&o.push("--"+a,e(t[a]))}),o}({display:"string",displayOnly:"boolean",keyIn:"boolean",hideEchoBack:"boolean",mask:"string",limit:"string",caseSensitive:"boolean"}))}function _gt(t,e){function r(U){var J,te="",le;for(YH=YH||ve("os").tmpdir();;){J=Lh.join(YH,U+te);try{le=Xn.openSync(J,"wx")}catch(ce){if(ce.code==="EEXIST"){te++;continue}else throw ce}Xn.closeSync(le);break}return J}var o,a,n,u={},A,p,h=r("readline-sync.stdout"),E=r("readline-sync.stderr"),w=r("readline-sync.exit"),D=r("readline-sync.done"),b=ve("crypto"),C,T,N;C=b.createHash(Mgt),C.update(""+process.pid+Ugt+++Math.random()),N=C.digest("hex"),T=b.createDecipher(WH,N),o=Nme(t),Xg?(a=process.env.ComSpec||"cmd.exe",process.env.Q='"',n=["/V:ON","/S","/C","(%Q%"+a+"%Q% /V:ON /S /C %Q%%Q%"+Th+"%Q%"+o.map(function(U){return" %Q%"+U+"%Q%"}).join("")+" & (echo !ERRORLEVEL!)>%Q%"+w+"%Q%%Q%) 2>%Q%"+E+"%Q% |%Q%"+process.execPath+"%Q% %Q%"+__dirname+"\\encrypt.js%Q% %Q%"+WH+"%Q% %Q%"+N+"%Q% >%Q%"+h+"%Q% & (echo 1)>%Q%"+D+"%Q%"]):(a="/bin/sh",n=["-c",'("'+Th+'"'+o.map(function(U){return" '"+U.replace(/'/g,"'\\''")+"'"}).join("")+'; echo $?>"'+w+'") 2>"'+E+'" |"'+process.execPath+'" "'+__dirname+'/encrypt.js" "'+WH+'" "'+N+'" >"'+h+'"; echo 1 >"'+D+'"']),G2&&G2("_execFileSync",o);try{VH.spawn(a,n,e)}catch(U){u.error=new Error(U.message),u.error.method="_execFileSync - spawn",u.error.program=a,u.error.args=n}for(;Xn.readFileSync(D,{encoding:t.encoding}).trim()!=="1";);return(A=Xn.readFileSync(w,{encoding:t.encoding}).trim())==="0"?u.input=T.update(Xn.readFileSync(h,{encoding:"binary"}),"hex",t.encoding)+T.final(t.encoding):(p=Xn.readFileSync(E,{encoding:t.encoding}).trim(),u.error=new Error(Tme+(p?` -`+p:"")),u.error.method="_execFileSync",u.error.program=a,u.error.args=n,u.error.extMessage=p,u.error.exitCode=+A),Xn.unlinkSync(h),Xn.unlinkSync(E),Xn.unlinkSync(w),Xn.unlinkSync(D),u}function Hgt(t){var e,r={},o,a={env:process.env,encoding:t.encoding};if(Th||(Xg?process.env.PSModulePath?(Th="powershell.exe",zk=["-ExecutionPolicy","Bypass","-File",__dirname+"\\read.ps1"]):(Th="cscript.exe",zk=["//nologo",__dirname+"\\read.cs.js"]):(Th="/bin/sh",zk=[__dirname+"/read.sh"])),Xg&&!process.env.PSModulePath&&(a.stdio=[process.stdin]),VH.execFileSync){e=Nme(t),G2&&G2("execFileSync",e);try{r.input=VH.execFileSync(Th,e,a)}catch(n){o=n.stderr?(n.stderr+"").trim():"",r.error=new Error(Tme+(o?` -`+o:"")),r.error.method="execFileSync",r.error.program=Th,r.error.args=e,r.error.extMessage=o,r.error.exitCode=n.status,r.error.code=n.code,r.error.signal=n.signal}}else r=_gt(t,a);return r.error||(r.input=r.input.replace(/^\s*'|'\s*$/g,""),t.display=""),r}function zH(t){var e="",r=t.display,o=!t.display&&t.keyIn&&t.hideEchoBack&&!t.mask;function a(){var n=Hgt(t);if(n.error)throw n.error;return n.input}return JH&&JH(t),function(){var n,u,A;function p(){return n||(n=process.binding("fs"),u=process.binding("constants")),n}if(typeof Vf=="string")if(Vf=null,Xg){if(A=function(h){var E=h.replace(/^\D+/,"").split("."),w=0;return(E[0]=+E[0])&&(w+=E[0]*1e4),(E[1]=+E[1])&&(w+=E[1]*100),(E[2]=+E[2])&&(w+=E[2]),w}(process.version),!(A>=20302&&A<40204||A>=5e4&&A<50100||A>=50600&&A<60200)&&process.stdin.isTTY)process.stdin.pause(),Vf=process.stdin.fd,eC=process.stdin._handle;else try{Vf=p().open("CONIN$",u.O_RDWR,parseInt("0666",8)),eC=new Fme(Vf,!0)}catch{}if(process.stdout.isTTY)iu=process.stdout.fd;else{try{iu=Xn.openSync("\\\\.\\CON","w")}catch{}if(typeof iu!="number")try{iu=p().open("CONOUT$",u.O_RDWR,parseInt("0666",8))}catch{}}}else{if(process.stdin.isTTY){process.stdin.pause();try{Vf=Xn.openSync("/dev/tty","r"),eC=process.stdin._handle}catch{}}else try{Vf=Xn.openSync("/dev/tty","r"),eC=new Fme(Vf,!1)}catch{}if(process.stdout.isTTY)iu=process.stdout.fd;else try{iu=Xn.openSync("/dev/tty","w")}catch{}}}(),function(){var n,u,A=!t.hideEchoBack&&!t.keyIn,p,h,E,w,D;Xk="";function b(C){return C===Rme?!0:eC.setRawMode(C)!==0?!1:(Rme=C,!0)}if(Lme||!eC||typeof iu!="number"&&(t.display||!A)){e=a();return}if(t.display&&(Xn.writeSync(iu,t.display),t.display=""),!t.displayOnly){if(!b(!A)){e=a();return}for(h=t.keyIn?1:t.bufferSize,p=Buffer.allocUnsafe&&Buffer.alloc?Buffer.alloc(h):new Buffer(h),t.keyIn&&t.limit&&(u=new RegExp("[^"+t.limit+"]","g"+(t.caseSensitive?"":"i")));;){E=0;try{E=Xn.readSync(Vf,p,0,h)}catch(C){if(C.code!=="EOF"){b(!1),e+=a();return}}if(E>0?(w=p.toString(t.encoding,0,E),Xk+=w):(w=` -`,Xk+="\0"),w&&typeof(D=(w.match(/^(.*?)[\r\n]/)||[])[1])=="string"&&(w=D,n=!0),w&&(w=w.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"")),w&&u&&(w=w.replace(u,"")),w&&(A||(t.hideEchoBack?t.mask&&Xn.writeSync(iu,new Array(w.length+1).join(t.mask)):Xn.writeSync(iu,w)),e+=w),!t.keyIn&&n||t.keyIn&&e.length>=h)break}!A&&!o&&Xn.writeSync(iu,` -`),b(!1)}}(),t.print&&!o&&t.print(r+(t.displayOnly?"":(t.hideEchoBack?new Array(e.length+1).join(t.mask):e)+` -`),t.encoding),t.displayOnly?"":$H=t.keepWhitespace||t.keyIn?e:e.trim()}function qgt(t,e){var r=[];function o(a){a!=null&&(Array.isArray(a)?a.forEach(o):(!e||e(a))&&r.push(a))}return o(t),r}function e6(t){return t.replace(/[\x00-\x7f]/g,function(e){return"\\x"+("00"+e.charCodeAt().toString(16)).substr(-2)})}function bs(){var t=Array.prototype.slice.call(arguments),e,r;return t.length&&typeof t[0]=="boolean"&&(r=t.shift(),r&&(e=Object.keys(KH),t.unshift(KH))),t.reduce(function(o,a){return a==null||(a.hasOwnProperty("noEchoBack")&&!a.hasOwnProperty("hideEchoBack")&&(a.hideEchoBack=a.noEchoBack,delete a.noEchoBack),a.hasOwnProperty("noTrim")&&!a.hasOwnProperty("keepWhitespace")&&(a.keepWhitespace=a.noTrim,delete a.noTrim),r||(e=Object.keys(a)),e.forEach(function(n){var u;if(a.hasOwnProperty(n))switch(u=a[n],n){case"mask":case"limitMessage":case"defaultInput":case"encoding":u=u!=null?u+"":"",u&&n!=="limitMessage"&&(u=u.replace(/[\r\n]/g,"")),o[n]=u;break;case"bufferSize":!isNaN(u=parseInt(u,10))&&typeof u=="number"&&(o[n]=u);break;case"displayOnly":case"keyIn":case"hideEchoBack":case"caseSensitive":case"keepWhitespace":case"history":case"cd":o[n]=!!u;break;case"limit":case"trueValue":case"falseValue":o[n]=qgt(u,function(A){var p=typeof A;return p==="string"||p==="number"||p==="function"||A instanceof RegExp}).map(function(A){return typeof A=="string"?A.replace(/[\r\n]/g,""):A});break;case"print":case"phContent":case"preCheck":o[n]=typeof u=="function"?u:void 0;break;case"prompt":case"display":o[n]=u??"";break}})),o},{})}function XH(t,e,r){return e.some(function(o){var a=typeof o;return a==="string"?r?t===o:t.toLowerCase()===o.toLowerCase():a==="number"?parseFloat(t)===o:a==="function"?o(t):o instanceof RegExp?o.test(t):!1})}function t6(t,e){var r=Lh.normalize(Xg?(process.env.HOMEDRIVE||"")+(process.env.HOMEPATH||""):process.env.HOME||"").replace(/[\/\\]+$/,"");return t=Lh.normalize(t),e?t.replace(/^~(?=\/|\\|$)/,r):t.replace(new RegExp("^"+e6(r)+"(?=\\/|\\\\|$)",Xg?"i":""),"~")}function tC(t,e){var r="(?:\\(([\\s\\S]*?)\\))?(\\w+|.-.)(?:\\(([\\s\\S]*?)\\))?",o=new RegExp("(\\$)?(\\$<"+r+">)","g"),a=new RegExp("(\\$)?(\\$\\{"+r+"\\})","g");function n(u,A,p,h,E,w){var D;return A||typeof(D=e(E))!="string"?p:D?(h||"")+D+(w||""):""}return t.replace(o,n).replace(a,n)}function Ome(t,e,r){var o,a=[],n=-1,u=0,A="",p;function h(E,w){return w.length>3?(E.push(w[0]+"..."+w[w.length-1]),p=!0):w.length&&(E=E.concat(w)),E}return o=t.reduce(function(E,w){return E.concat((w+"").split(""))},[]).reduce(function(E,w){var D,b;return e||(w=w.toLowerCase()),D=/^\d$/.test(w)?1:/^[A-Z]$/.test(w)?2:/^[a-z]$/.test(w)?3:0,r&&D===0?A+=w:(b=w.charCodeAt(0),D&&D===n&&b===u+1?a.push(w):(E=h(E,a),a=[w],n=D),u=b),E},[]),o=h(o,a),A&&(o.push(A),p=!0),{values:o,suppressed:p}}function Mme(t,e){return t.join(t.length>2?", ":e?" / ":"/")}function Ume(t,e){var r,o,a={},n;if(e.phContent&&(r=e.phContent(t,e)),typeof r!="string")switch(t){case"hideEchoBack":case"mask":case"defaultInput":case"caseSensitive":case"keepWhitespace":case"encoding":case"bufferSize":case"history":case"cd":r=e.hasOwnProperty(t)?typeof e[t]=="boolean"?e[t]?"on":"off":e[t]+"":"";break;case"limit":case"trueValue":case"falseValue":o=e[e.hasOwnProperty(t+"Src")?t+"Src":t],e.keyIn?(a=Ome(o,e.caseSensitive),o=a.values):o=o.filter(function(u){var A=typeof u;return A==="string"||A==="number"}),r=Mme(o,a.suppressed);break;case"limitCount":case"limitCountNotZero":r=e[e.hasOwnProperty("limitSrc")?"limitSrc":"limit"].length,r=r||t!=="limitCountNotZero"?r+"":"";break;case"lastInput":r=$H;break;case"cwd":case"CWD":case"cwdHome":r=process.cwd(),t==="CWD"?r=Lh.basename(r):t==="cwdHome"&&(r=t6(r));break;case"date":case"time":case"localeDate":case"localeTime":r=new Date()["to"+t.replace(/^./,function(u){return u.toUpperCase()})+"String"]();break;default:typeof(n=(t.match(/^history_m(\d+)$/)||[])[1])=="string"&&(r=zg[zg.length-n]||"")}return r}function _me(t){var e=/^(.)-(.)$/.exec(t),r="",o,a,n,u;if(!e)return null;for(o=e[1].charCodeAt(0),a=e[2].charCodeAt(0),u=o -And the length must be: $`,trueValue:null,falseValue:null,caseSensitive:!0},e,{history:!1,cd:!1,phContent:function(b){return b==="charlist"?r.text:b==="length"?o+"..."+a:null}}),u,A,p,h,E,w,D;for(e=e||{},u=tC(e.charlist?e.charlist+"":"$",_me),(isNaN(o=parseInt(e.min,10))||typeof o!="number")&&(o=12),(isNaN(a=parseInt(e.max,10))||typeof a!="number")&&(a=24),h=new RegExp("^["+e6(u)+"]{"+o+","+a+"}$"),r=Ome([u],n.caseSensitive,!0),r.text=Mme(r.values,r.suppressed),A=e.confirmMessage!=null?e.confirmMessage:"Reinput a same one to confirm it: ",p=e.unmatchMessage!=null?e.unmatchMessage:"It differs from first one. Hit only the Enter key if you want to retry from first one.",t==null&&(t="Input new password: "),E=n.limitMessage;!D;)n.limit=h,n.limitMessage=E,w=Kr.question(t,n),n.limit=[w,""],n.limitMessage=p,D=Kr.question(A,n);return w};function jme(t,e,r){var o;function a(n){return o=r(n),!isNaN(o)&&typeof o=="number"}return Kr.question(t,bs({limitMessage:"Input valid number, please."},e,{limit:a,cd:!1})),o}Kr.questionInt=function(t,e){return jme(t,e,function(r){return parseInt(r,10)})};Kr.questionFloat=function(t,e){return jme(t,e,parseFloat)};Kr.questionPath=function(t,e){var r,o="",a=bs({hideEchoBack:!1,limitMessage:`$Input valid path, please.$<( Min:)min>$<( Max:)max>`,history:!0,cd:!0},e,{keepWhitespace:!1,limit:function(n){var u,A,p;n=t6(n,!0),o="";function h(E){E.split(/\/|\\/).reduce(function(w,D){var b=Lh.resolve(w+=D+Lh.sep);if(!Xn.existsSync(b))Xn.mkdirSync(b);else if(!Xn.statSync(b).isDirectory())throw new Error("Non directory already exists: "+b);return w},"")}try{if(u=Xn.existsSync(n),r=u?Xn.realpathSync(n):Lh.resolve(n),!e.hasOwnProperty("exists")&&!u||typeof e.exists=="boolean"&&e.exists!==u)return o=(u?"Already exists":"No such file or directory")+": "+r,!1;if(!u&&e.create&&(e.isDirectory?h(r):(h(Lh.dirname(r)),Xn.closeSync(Xn.openSync(r,"w"))),r=Xn.realpathSync(r)),u&&(e.min||e.max||e.isFile||e.isDirectory)){if(A=Xn.statSync(r),e.isFile&&!A.isFile())return o="Not file: "+r,!1;if(e.isDirectory&&!A.isDirectory())return o="Not directory: "+r,!1;if(e.min&&A.size<+e.min||e.max&&A.size>+e.max)return o="Size "+A.size+" is out of range: "+r,!1}if(typeof e.validate=="function"&&(p=e.validate(r))!==!0)return typeof p=="string"&&(o=p),!1}catch(E){return o=E+"",!1}return!0},phContent:function(n){return n==="error"?o:n!=="min"&&n!=="max"?null:e.hasOwnProperty(n)?e[n]+"":""}});return e=e||{},t==null&&(t='Input path (you can "cd" and "pwd"): '),Kr.question(t,a),r};function Gme(t,e){var r={},o={};return typeof t=="object"?(Object.keys(t).forEach(function(a){typeof t[a]=="function"&&(o[e.caseSensitive?a:a.toLowerCase()]=t[a])}),r.preCheck=function(a){var n;return r.args=ZH(a),n=r.args[0]||"",e.caseSensitive||(n=n.toLowerCase()),r.hRes=n!=="_"&&o.hasOwnProperty(n)?o[n].apply(a,r.args.slice(1)):o.hasOwnProperty("_")?o._.apply(a,r.args):null,{res:a,forceNext:!1}},o.hasOwnProperty("_")||(r.limit=function(){var a=r.args[0]||"";return e.caseSensitive||(a=a.toLowerCase()),o.hasOwnProperty(a)})):r.preCheck=function(a){return r.args=ZH(a),r.hRes=typeof t=="function"?t.apply(a,r.args):!0,{res:a,forceNext:!1}},r}Kr.promptCL=function(t,e){var r=bs({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),o=Gme(t,r);return r.limit=o.limit,r.preCheck=o.preCheck,Kr.prompt(r),o.args};Kr.promptLoop=function(t,e){for(var r=bs({hideEchoBack:!1,trueValue:null,falseValue:null,caseSensitive:!1,history:!0},e);!t(Kr.prompt(r)););};Kr.promptCLLoop=function(t,e){var r=bs({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),o=Gme(t,r);for(r.limit=o.limit,r.preCheck=o.preCheck;Kr.prompt(r),!o.hRes;);};Kr.promptSimShell=function(t){return Kr.prompt(bs({hideEchoBack:!1,history:!0},t,{prompt:function(){return Xg?"$>":(process.env.USER||"")+(process.env.HOSTNAME?"@"+process.env.HOSTNAME.replace(/\..*$/,""):"")+":$$ "}()}))};function Wme(t,e,r){var o;return t==null&&(t="Are you sure? "),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s*:?\s*$/,"")+" [y/n]: "),o=Kr.keyIn(t,bs(e,{hideEchoBack:!1,limit:r,trueValue:"y",falseValue:"n",caseSensitive:!1})),typeof o=="boolean"?o:""}Kr.keyInYN=function(t,e){return Wme(t,e)};Kr.keyInYNStrict=function(t,e){return Wme(t,e,"yn")};Kr.keyInPause=function(t,e){t==null&&(t="Continue..."),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s+$/,"")+" (Hit any key)"),Kr.keyIn(t,bs({limit:null},e,{hideEchoBack:!0,mask:""}))};Kr.keyInSelect=function(t,e,r){var o=bs({hideEchoBack:!1},r,{trueValue:null,falseValue:null,caseSensitive:!1,phContent:function(p){return p==="itemsCount"?t.length+"":p==="firstItem"?(t[0]+"").trim():p==="lastItem"?(t[t.length-1]+"").trim():null}}),a="",n={},u=49,A=` -`;if(!Array.isArray(t)||!t.length||t.length>35)throw"`items` must be Array (max length: 35).";return t.forEach(function(p,h){var E=String.fromCharCode(u);a+=E,n[E]=h,A+="["+E+"] "+(p+"").trim()+` -`,u=u===57?97:u+1}),(!r||r.cancel!==!1)&&(a+="0",n[0]=-1,A+="[0] "+(r&&r.cancel!=null&&typeof r.cancel!="boolean"?(r.cancel+"").trim():"CANCEL")+` -`),o.limit=a,A+=` -`,e==null&&(e="Choose one from list: "),(e+="")&&((!r||r.guide!==!1)&&(e=e.replace(/\s*:?\s*$/,"")+" [$]: "),A+=e),n[Kr.keyIn(A,o).toLowerCase()]};Kr.getRawInput=function(){return Xk};function W2(t,e){var r;return e.length&&(r={},r[t]=e[0]),Kr.setDefaultOptions(r)[t]}Kr.setPrint=function(){return W2("print",arguments)};Kr.setPrompt=function(){return W2("prompt",arguments)};Kr.setEncoding=function(){return W2("encoding",arguments)};Kr.setMask=function(){return W2("mask",arguments)};Kr.setBufferSize=function(){return W2("bufferSize",arguments)}});var r6=_((O9t,El)=>{(function(){var t={major:0,minor:2,patch:66,status:"beta"};tau_file_system={files:{},open:function(I,P,y){var R=tau_file_system.files[I];if(!R){if(y==="read")return null;R={path:I,text:"",type:P,get:function(z,X){return X===this.text.length||X>this.text.length?"end_of_file":this.text.substring(X,X+z)},put:function(z,X){return X==="end_of_file"?(this.text+=z,!0):X==="past_end_of_file"?null:(this.text=this.text.substring(0,X)+z+this.text.substring(X+z.length),!0)},get_byte:function(z){if(z==="end_of_stream")return-1;var X=Math.floor(z/2);if(this.text.length<=X)return-1;var $=n(this.text[Math.floor(z/2)],0);return z%2===0?$&255:$/256>>>0},put_byte:function(z,X){var $=X==="end_of_stream"?this.text.length:Math.floor(X/2);if(this.text.length<$)return null;var se=this.text.length===$?-1:n(this.text[Math.floor(X/2)],0);return X%2===0?(se=se/256>>>0,se=(se&255)<<8|z&255):(se=se&255,se=(z&255)<<8|se&255),this.text.length===$?this.text+=u(se):this.text=this.text.substring(0,$)+u(se)+this.text.substring($+1),!0},flush:function(){return!0},close:function(){var z=tau_file_system.files[this.path];return z?!0:null}},tau_file_system.files[I]=R}return y==="write"&&(R.text=""),R}},tau_user_input={buffer:"",get:function(I,P){for(var y;tau_user_input.buffer.length\?\@\^\~\\]+|'(?:[^']*?(?:\\(?:x?\d+)?\\)*(?:'')*(?:\\')*)*')/,number:/^(?:0o[0-7]+|0x[0-9a-fA-F]+|0b[01]+|0'(?:''|\\[abfnrtv\\'"`]|\\x?\d+\\|[^\\])|\d+(?:\.\d+(?:[eE][+-]?\d+)?)?)/,string:/^(?:"([^"]|""|\\")*"|`([^`]|``|\\`)*`)/,l_brace:/^(?:\[)/,r_brace:/^(?:\])/,l_bracket:/^(?:\{)/,r_bracket:/^(?:\})/,bar:/^(?:\|)/,l_paren:/^(?:\()/,r_paren:/^(?:\))/};function N(I,P){return I.get_flag("char_conversion").id==="on"?P.replace(/./g,function(y){return I.get_char_conversion(y)}):P}function U(I){this.thread=I,this.text="",this.tokens=[]}U.prototype.set_last_tokens=function(I){return this.tokens=I},U.prototype.new_text=function(I){this.text=I,this.tokens=[]},U.prototype.get_tokens=function(I){var P,y=0,R=0,z=0,X=[],$=!1;if(I){var se=this.tokens[I-1];y=se.len,P=N(this.thread,this.text.substr(se.len)),R=se.line,z=se.start}else P=this.text;if(/^\s*$/.test(P))return null;for(;P!=="";){var be=[],Fe=!1;if(/^\n/.exec(P)!==null){R++,z=0,y++,P=P.replace(/\n/,""),$=!0;continue}for(var lt in T)if(T.hasOwnProperty(lt)){var Et=T[lt].exec(P);Et&&be.push({value:Et[0],name:lt,matches:Et})}if(!be.length)return this.set_last_tokens([{value:P,matches:[],name:"lexical",line:R,start:z}]);var se=r(be,function(Sr,yr){return Sr.value.length>=yr.value.length?Sr:yr});switch(se.start=z,se.line=R,P=P.replace(se.value,""),z+=se.value.length,y+=se.value.length,se.name){case"atom":se.raw=se.value,se.value.charAt(0)==="'"&&(se.value=D(se.value.substr(1,se.value.length-2),"'"),se.value===null&&(se.name="lexical",se.value="unknown escape sequence"));break;case"number":se.float=se.value.substring(0,2)!=="0x"&&se.value.match(/[.eE]/)!==null&&se.value!=="0'.",se.value=C(se.value),se.blank=Fe;break;case"string":var qt=se.value.charAt(0);se.value=D(se.value.substr(1,se.value.length-2),qt),se.value===null&&(se.name="lexical",se.value="unknown escape sequence");break;case"whitespace":var nr=X[X.length-1];nr&&(nr.space=!0),Fe=!0;continue;case"r_bracket":X.length>0&&X[X.length-1].name==="l_bracket"&&(se=X.pop(),se.name="atom",se.value="{}",se.raw="{}",se.space=!1);break;case"r_brace":X.length>0&&X[X.length-1].name==="l_brace"&&(se=X.pop(),se.name="atom",se.value="[]",se.raw="[]",se.space=!1);break}se.len=y,X.push(se),Fe=!1}var Pt=this.set_last_tokens(X);return Pt.length===0?null:Pt};function J(I,P,y,R,z){if(!P[y])return{type:A,value:x.error.syntax(P[y-1],"expression expected",!0)};var X;if(R==="0"){var $=P[y];switch($.name){case"number":return{type:p,len:y+1,value:new x.type.Num($.value,$.float)};case"variable":return{type:p,len:y+1,value:new x.type.Var($.value)};case"string":var se;switch(I.get_flag("double_quotes").id){case"atom":se=new q($.value,[]);break;case"codes":se=new q("[]",[]);for(var be=$.value.length-1;be>=0;be--)se=new q(".",[new x.type.Num(n($.value,be),!1),se]);break;case"chars":se=new q("[]",[]);for(var be=$.value.length-1;be>=0;be--)se=new q(".",[new x.type.Term($.value.charAt(be),[]),se]);break}return{type:p,len:y+1,value:se};case"l_paren":var Pt=J(I,P,y+1,I.__get_max_priority(),!0);return Pt.type!==p?Pt:P[Pt.len]&&P[Pt.len].name==="r_paren"?(Pt.len++,Pt):{type:A,derived:!0,value:x.error.syntax(P[Pt.len]?P[Pt.len]:P[Pt.len-1],") or operator expected",!P[Pt.len])};case"l_bracket":var Pt=J(I,P,y+1,I.__get_max_priority(),!0);return Pt.type!==p?Pt:P[Pt.len]&&P[Pt.len].name==="r_bracket"?(Pt.len++,Pt.value=new q("{}",[Pt.value]),Pt):{type:A,derived:!0,value:x.error.syntax(P[Pt.len]?P[Pt.len]:P[Pt.len-1],"} or operator expected",!P[Pt.len])}}var Fe=te(I,P,y,z);return Fe.type===p||Fe.derived||(Fe=le(I,P,y),Fe.type===p||Fe.derived)?Fe:{type:A,derived:!1,value:x.error.syntax(P[y],"unexpected token")}}var lt=I.__get_max_priority(),Et=I.__get_next_priority(R),qt=y;if(P[y].name==="atom"&&P[y+1]&&(P[y].space||P[y+1].name!=="l_paren")){var $=P[y++],nr=I.__lookup_operator_classes(R,$.value);if(nr&&nr.indexOf("fy")>-1){var Pt=J(I,P,y,R,z);if(Pt.type!==A)return $.value==="-"&&!$.space&&x.type.is_number(Pt.value)?{value:new x.type.Num(-Pt.value.value,Pt.value.is_float),len:Pt.len,type:p}:{value:new x.type.Term($.value,[Pt.value]),len:Pt.len,type:p};X=Pt}else if(nr&&nr.indexOf("fx")>-1){var Pt=J(I,P,y,Et,z);if(Pt.type!==A)return{value:new x.type.Term($.value,[Pt.value]),len:Pt.len,type:p};X=Pt}}y=qt;var Pt=J(I,P,y,Et,z);if(Pt.type===p){y=Pt.len;var $=P[y];if(P[y]&&(P[y].name==="atom"&&I.__lookup_operator_classes(R,$.value)||P[y].name==="bar"&&I.__lookup_operator_classes(R,"|"))){var cn=Et,Sr=R,nr=I.__lookup_operator_classes(R,$.value);if(nr.indexOf("xf")>-1)return{value:new x.type.Term($.value,[Pt.value]),len:++Pt.len,type:p};if(nr.indexOf("xfx")>-1){var yr=J(I,P,y+1,cn,z);return yr.type===p?{value:new x.type.Term($.value,[Pt.value,yr.value]),len:yr.len,type:p}:(yr.derived=!0,yr)}else if(nr.indexOf("xfy")>-1){var yr=J(I,P,y+1,Sr,z);return yr.type===p?{value:new x.type.Term($.value,[Pt.value,yr.value]),len:yr.len,type:p}:(yr.derived=!0,yr)}else if(Pt.type!==A)for(;;){y=Pt.len;var $=P[y];if($&&$.name==="atom"&&I.__lookup_operator_classes(R,$.value)){var nr=I.__lookup_operator_classes(R,$.value);if(nr.indexOf("yf")>-1)Pt={value:new x.type.Term($.value,[Pt.value]),len:++y,type:p};else if(nr.indexOf("yfx")>-1){var yr=J(I,P,++y,cn,z);if(yr.type===A)return yr.derived=!0,yr;y=yr.len,Pt={value:new x.type.Term($.value,[Pt.value,yr.value]),len:y,type:p}}else break}else break}}else X={type:A,value:x.error.syntax(P[Pt.len-1],"operator expected")};return Pt}return Pt}function te(I,P,y,R){if(!P[y]||P[y].name==="atom"&&P[y].raw==="."&&!R&&(P[y].space||!P[y+1]||P[y+1].name!=="l_paren"))return{type:A,derived:!1,value:x.error.syntax(P[y-1],"unfounded token")};var z=P[y],X=[];if(P[y].name==="atom"&&P[y].raw!==","){if(y++,P[y-1].space)return{type:p,len:y,value:new x.type.Term(z.value,X)};if(P[y]&&P[y].name==="l_paren"){if(P[y+1]&&P[y+1].name==="r_paren")return{type:A,derived:!0,value:x.error.syntax(P[y+1],"argument expected")};var $=J(I,P,++y,"999",!0);if($.type===A)return $.derived?$:{type:A,derived:!0,value:x.error.syntax(P[y]?P[y]:P[y-1],"argument expected",!P[y])};for(X.push($.value),y=$.len;P[y]&&P[y].name==="atom"&&P[y].value===",";){if($=J(I,P,y+1,"999",!0),$.type===A)return $.derived?$:{type:A,derived:!0,value:x.error.syntax(P[y+1]?P[y+1]:P[y],"argument expected",!P[y+1])};X.push($.value),y=$.len}if(P[y]&&P[y].name==="r_paren")y++;else return{type:A,derived:!0,value:x.error.syntax(P[y]?P[y]:P[y-1],", or ) expected",!P[y])}}return{type:p,len:y,value:new x.type.Term(z.value,X)}}return{type:A,derived:!1,value:x.error.syntax(P[y],"term expected")}}function le(I,P,y){if(!P[y])return{type:A,derived:!1,value:x.error.syntax(P[y-1],"[ expected")};if(P[y]&&P[y].name==="l_brace"){var R=J(I,P,++y,"999",!0),z=[R.value],X=void 0;if(R.type===A)return P[y]&&P[y].name==="r_brace"?{type:p,len:y+1,value:new x.type.Term("[]",[])}:{type:A,derived:!0,value:x.error.syntax(P[y],"] expected")};for(y=R.len;P[y]&&P[y].name==="atom"&&P[y].value===",";){if(R=J(I,P,y+1,"999",!0),R.type===A)return R.derived?R:{type:A,derived:!0,value:x.error.syntax(P[y+1]?P[y+1]:P[y],"argument expected",!P[y+1])};z.push(R.value),y=R.len}var $=!1;if(P[y]&&P[y].name==="bar"){if($=!0,R=J(I,P,y+1,"999",!0),R.type===A)return R.derived?R:{type:A,derived:!0,value:x.error.syntax(P[y+1]?P[y+1]:P[y],"argument expected",!P[y+1])};X=R.value,y=R.len}return P[y]&&P[y].name==="r_brace"?{type:p,len:y+1,value:g(z,X)}:{type:A,derived:!0,value:x.error.syntax(P[y]?P[y]:P[y-1],$?"] expected":", or | or ] expected",!P[y])}}return{type:A,derived:!1,value:x.error.syntax(P[y],"list expected")}}function ce(I,P,y){var R=P[y].line,z=J(I,P,y,I.__get_max_priority(),!1),X=null,$;if(z.type!==A)if(y=z.len,P[y]&&P[y].name==="atom"&&P[y].raw===".")if(y++,x.type.is_term(z.value)){if(z.value.indicator===":-/2"?(X=new x.type.Rule(z.value.args[0],Ee(z.value.args[1])),$={value:X,len:y,type:p}):z.value.indicator==="-->/2"?(X=he(new x.type.Rule(z.value.args[0],z.value.args[1]),I),X.body=Ee(X.body),$={value:X,len:y,type:x.type.is_rule(X)?p:A}):(X=new x.type.Rule(z.value,null),$={value:X,len:y,type:p}),X){var se=X.singleton_variables();se.length>0&&I.throw_warning(x.warning.singleton(se,X.head.indicator,R))}return $}else return{type:A,value:x.error.syntax(P[y],"callable expected")};else return{type:A,value:x.error.syntax(P[y]?P[y]:P[y-1],". or operator expected")};return z}function ue(I,P,y){y=y||{},y.from=y.from?y.from:"$tau-js",y.reconsult=y.reconsult!==void 0?y.reconsult:!0;var R=new U(I),z={},X;R.new_text(P);var $=0,se=R.get_tokens($);do{if(se===null||!se[$])break;var be=ce(I,se,$);if(be.type===A)return new q("throw",[be.value]);if(be.value.body===null&&be.value.head.indicator==="?-/1"){var Fe=new tt(I.session);Fe.add_goal(be.value.head.args[0]),Fe.answer(function(Et){x.type.is_error(Et)?I.throw_warning(Et.args[0]):(Et===!1||Et===null)&&I.throw_warning(x.warning.failed_goal(be.value.head.args[0],be.len))}),$=be.len;var lt=!0}else if(be.value.body===null&&be.value.head.indicator===":-/1"){var lt=I.run_directive(be.value.head.args[0]);$=be.len,be.value.head.args[0].indicator==="char_conversion/2"&&(se=R.get_tokens($),$=0)}else{X=be.value.head.indicator,y.reconsult!==!1&&z[X]!==!0&&!I.is_multifile_predicate(X)&&(I.session.rules[X]=a(I.session.rules[X]||[],function(qt){return qt.dynamic}),z[X]=!0);var lt=I.add_rule(be.value,y);$=be.len}if(!lt)return lt}while(!0);return!0}function Ie(I,P){var y=new U(I);y.new_text(P);var R=0;do{var z=y.get_tokens(R);if(z===null)break;var X=J(I,z,0,I.__get_max_priority(),!1);if(X.type!==A){var $=X.len,se=$;if(z[$]&&z[$].name==="atom"&&z[$].raw===".")I.add_goal(Ee(X.value));else{var be=z[$];return new q("throw",[x.error.syntax(be||z[$-1],". or operator expected",!be)])}R=X.len+1}else return new q("throw",[X.value])}while(!0);return!0}function he(I,P){I=I.rename(P);var y=P.next_free_variable(),R=De(I.body,y,P);return R.error?R.value:(I.body=R.value,I.head.args=I.head.args.concat([y,R.variable]),I.head=new q(I.head.id,I.head.args),I)}function De(I,P,y){var R;if(x.type.is_term(I)&&I.indicator==="!/0")return{value:I,variable:P,error:!1};if(x.type.is_term(I)&&I.indicator===",/2"){var z=De(I.args[0],P,y);if(z.error)return z;var X=De(I.args[1],z.variable,y);return X.error?X:{value:new q(",",[z.value,X.value]),variable:X.variable,error:!1}}else{if(x.type.is_term(I)&&I.indicator==="{}/1")return{value:I.args[0],variable:P,error:!1};if(x.type.is_empty_list(I))return{value:new q("true",[]),variable:P,error:!1};if(x.type.is_list(I)){R=y.next_free_variable();for(var $=I,se;$.indicator==="./2";)se=$,$=$.args[1];return x.type.is_variable($)?{value:x.error.instantiation("DCG"),variable:P,error:!0}:x.type.is_empty_list($)?(se.args[1]=R,{value:new q("=",[P,I]),variable:R,error:!1}):{value:x.error.type("list",I,"DCG"),variable:P,error:!0}}else return x.type.is_callable(I)?(R=y.next_free_variable(),I.args=I.args.concat([P,R]),I=new q(I.id,I.args),{value:I,variable:R,error:!1}):{value:x.error.type("callable",I,"DCG"),variable:P,error:!0}}}function Ee(I){return x.type.is_variable(I)?new q("call",[I]):x.type.is_term(I)&&[",/2",";/2","->/2"].indexOf(I.indicator)!==-1?new q(I.id,[Ee(I.args[0]),Ee(I.args[1])]):I}function g(I,P){for(var y=P||new x.type.Term("[]",[]),R=I.length-1;R>=0;R--)y=new x.type.Term(".",[I[R],y]);return y}function me(I,P){for(var y=I.length-1;y>=0;y--)I[y]===P&&I.splice(y,1)}function Ce(I){for(var P={},y=[],R=0;R=0;P--)if(I.charAt(P)==="/")return new q("/",[new q(I.substring(0,P)),new Re(parseInt(I.substring(P+1)),!1)])}function Se(I){this.id=I}function Re(I,P){this.is_float=P!==void 0?P:parseInt(I)!==I,this.value=this.is_float?I:parseInt(I)}var ht=0;function q(I,P,y){this.ref=y||++ht,this.id=I,this.args=P||[],this.indicator=I+"/"+this.args.length}var nt=0;function Le(I,P,y,R,z,X){this.id=nt++,this.stream=I,this.mode=P,this.alias=y,this.type=R!==void 0?R:"text",this.reposition=z!==void 0?z:!0,this.eof_action=X!==void 0?X:"eof_code",this.position=this.mode==="append"?"end_of_stream":0,this.output=this.mode==="write"||this.mode==="append",this.input=this.mode==="read"}function Te(I){I=I||{},this.links=I}function ke(I,P,y){P=P||new Te,y=y||null,this.goal=I,this.substitution=P,this.parent=y}function Ke(I,P,y){this.head=I,this.body=P,this.dynamic=y||!1}function xe(I){I=I===void 0||I<=0?1e3:I,this.rules={},this.src_predicates={},this.rename=0,this.modules=[],this.thread=new tt(this),this.total_threads=1,this.renamed_variables={},this.public_predicates={},this.multifile_predicates={},this.limit=I,this.streams={user_input:new Le(typeof El<"u"&&El.exports?nodejs_user_input:tau_user_input,"read","user_input","text",!1,"reset"),user_output:new Le(typeof El<"u"&&El.exports?nodejs_user_output:tau_user_output,"write","user_output","text",!1,"eof_code")},this.file_system=typeof El<"u"&&El.exports?nodejs_file_system:tau_file_system,this.standard_input=this.streams.user_input,this.standard_output=this.streams.user_output,this.current_input=this.streams.user_input,this.current_output=this.streams.user_output,this.format_success=function(P){return P.substitution},this.format_error=function(P){return P.goal},this.flag={bounded:x.flag.bounded.value,max_integer:x.flag.max_integer.value,min_integer:x.flag.min_integer.value,integer_rounding_function:x.flag.integer_rounding_function.value,char_conversion:x.flag.char_conversion.value,debug:x.flag.debug.value,max_arity:x.flag.max_arity.value,unknown:x.flag.unknown.value,double_quotes:x.flag.double_quotes.value,occurs_check:x.flag.occurs_check.value,dialect:x.flag.dialect.value,version_data:x.flag.version_data.value,nodejs:x.flag.nodejs.value},this.__loaded_modules=[],this.__char_conversion={},this.__operators={1200:{":-":["fx","xfx"],"-->":["xfx"],"?-":["fx"]},1100:{";":["xfy"]},1050:{"->":["xfy"]},1e3:{",":["xfy"]},900:{"\\+":["fy"]},700:{"=":["xfx"],"\\=":["xfx"],"==":["xfx"],"\\==":["xfx"],"@<":["xfx"],"@=<":["xfx"],"@>":["xfx"],"@>=":["xfx"],"=..":["xfx"],is:["xfx"],"=:=":["xfx"],"=\\=":["xfx"],"<":["xfx"],"=<":["xfx"],">":["xfx"],">=":["xfx"]},600:{":":["xfy"]},500:{"+":["yfx"],"-":["yfx"],"/\\":["yfx"],"\\/":["yfx"]},400:{"*":["yfx"],"/":["yfx"],"//":["yfx"],rem:["yfx"],mod:["yfx"],"<<":["yfx"],">>":["yfx"]},200:{"**":["xfx"],"^":["xfy"],"-":["fy"],"+":["fy"],"\\":["fy"]}}}function tt(I){this.epoch=Date.now(),this.session=I,this.session.total_threads++,this.total_steps=0,this.cpu_time=0,this.cpu_time_last=0,this.points=[],this.debugger=!1,this.debugger_states=[],this.level="top_level/0",this.__calls=[],this.current_limit=this.session.limit,this.warnings=[]}function He(I,P,y){this.id=I,this.rules=P,this.exports=y,x.module[I]=this}He.prototype.exports_predicate=function(I){return this.exports.indexOf(I)!==-1},Se.prototype.unify=function(I,P){if(P&&e(I.variables(),this.id)!==-1&&!x.type.is_variable(I))return null;var y={};return y[this.id]=I,new Te(y)},Re.prototype.unify=function(I,P){return x.type.is_number(I)&&this.value===I.value&&this.is_float===I.is_float?new Te:null},q.prototype.unify=function(I,P){if(x.type.is_term(I)&&this.indicator===I.indicator){for(var y=new Te,R=0;R=0){var R=this.args[0].value,z=Math.floor(R/26),X=R%26;return"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[X]+(z!==0?z:"")}switch(this.indicator){case"[]/0":case"{}/0":case"!/0":return this.id;case"{}/1":return"{"+this.args[0].toString(I)+"}";case"./2":for(var $="["+this.args[0].toString(I),se=this.args[1];se.indicator==="./2";)$+=", "+se.args[0].toString(I),se=se.args[1];return se.indicator!=="[]/0"&&($+="|"+se.toString(I)),$+="]",$;case",/2":return"("+this.args[0].toString(I)+", "+this.args[1].toString(I)+")";default:var be=this.id,Fe=I.session?I.session.lookup_operator(this.id,this.args.length):null;if(I.session===void 0||I.ignore_ops||Fe===null)return I.quoted&&!/^(!|,|;|[a-z][0-9a-zA-Z_]*)$/.test(be)&&be!=="{}"&&be!=="[]"&&(be="'"+b(be)+"'"),be+(this.args.length?"("+o(this.args,function(nr){return nr.toString(I)}).join(", ")+")":"");var lt=Fe.priority>P.priority||Fe.priority===P.priority&&(Fe.class==="xfy"&&this.indicator!==P.indicator||Fe.class==="yfx"&&this.indicator!==P.indicator||this.indicator===P.indicator&&Fe.class==="yfx"&&y==="right"||this.indicator===P.indicator&&Fe.class==="xfy"&&y==="left");Fe.indicator=this.indicator;var Et=lt?"(":"",qt=lt?")":"";return this.args.length===0?"("+this.id+")":["fy","fx"].indexOf(Fe.class)!==-1?Et+be+" "+this.args[0].toString(I,Fe)+qt:["yf","xf"].indexOf(Fe.class)!==-1?Et+this.args[0].toString(I,Fe)+" "+be+qt:Et+this.args[0].toString(I,Fe,"left")+" "+this.id+" "+this.args[1].toString(I,Fe,"right")+qt}},Le.prototype.toString=function(I){return"("+this.id+")"},Te.prototype.toString=function(I){var P="{";for(var y in this.links)this.links.hasOwnProperty(y)&&(P!=="{"&&(P+=", "),P+=y+"/"+this.links[y].toString(I));return P+="}",P},ke.prototype.toString=function(I){return this.goal===null?"<"+this.substitution.toString(I)+">":"<"+this.goal.toString(I)+", "+this.substitution.toString(I)+">"},Ke.prototype.toString=function(I){return this.body?this.head.toString(I)+" :- "+this.body.toString(I)+".":this.head.toString(I)+"."},xe.prototype.toString=function(I){for(var P="",y=0;y=0;z--)R=new q(".",[P[z],R]);return R}return new q(this.id,o(this.args,function(X){return X.apply(I)}),this.ref)},Le.prototype.apply=function(I){return this},Ke.prototype.apply=function(I){return new Ke(this.head.apply(I),this.body!==null?this.body.apply(I):null)},Te.prototype.apply=function(I){var P,y={};for(P in this.links)this.links.hasOwnProperty(P)&&(y[P]=this.links[P].apply(I));return new Te(y)},q.prototype.select=function(){for(var I=this;I.indicator===",/2";)I=I.args[0];return I},q.prototype.replace=function(I){return this.indicator===",/2"?this.args[0].indicator===",/2"?new q(",",[this.args[0].replace(I),this.args[1]]):I===null?this.args[1]:new q(",",[I,this.args[1]]):I},q.prototype.search=function(I){if(x.type.is_term(I)&&I.ref!==void 0&&this.ref===I.ref)return!0;for(var P=0;PP&&R0&&(P=this.head_point().substitution.domain());e(P,x.format_variable(this.session.rename))!==-1;)this.session.rename++;if(I.id==="_")return new Se(x.format_variable(this.session.rename));this.session.renamed_variables[I.id]=x.format_variable(this.session.rename)}return new Se(this.session.renamed_variables[I.id])},xe.prototype.next_free_variable=function(){return this.thread.next_free_variable()},tt.prototype.next_free_variable=function(){this.session.rename++;var I=[];for(this.points.length>0&&(I=this.head_point().substitution.domain());e(I,x.format_variable(this.session.rename))!==-1;)this.session.rename++;return new Se(x.format_variable(this.session.rename))},xe.prototype.is_public_predicate=function(I){return!this.public_predicates.hasOwnProperty(I)||this.public_predicates[I]===!0},tt.prototype.is_public_predicate=function(I){return this.session.is_public_predicate(I)},xe.prototype.is_multifile_predicate=function(I){return this.multifile_predicates.hasOwnProperty(I)&&this.multifile_predicates[I]===!0},tt.prototype.is_multifile_predicate=function(I){return this.session.is_multifile_predicate(I)},xe.prototype.prepend=function(I){return this.thread.prepend(I)},tt.prototype.prepend=function(I){for(var P=I.length-1;P>=0;P--)this.points.push(I[P])},xe.prototype.success=function(I,P){return this.thread.success(I,P)},tt.prototype.success=function(I,y){var y=typeof y>"u"?I:y;this.prepend([new ke(I.goal.replace(null),I.substitution,y)])},xe.prototype.throw_error=function(I){return this.thread.throw_error(I)},tt.prototype.throw_error=function(I){this.prepend([new ke(new q("throw",[I]),new Te,null,null)])},xe.prototype.step_rule=function(I,P){return this.thread.step_rule(I,P)},tt.prototype.step_rule=function(I,P){var y=P.indicator;if(I==="user"&&(I=null),I===null&&this.session.rules.hasOwnProperty(y))return this.session.rules[y];for(var R=I===null?this.session.modules:e(this.session.modules,I)===-1?[]:[I],z=0;z1)&&this.again()},xe.prototype.answers=function(I,P,y){return this.thread.answers(I,P,y)},tt.prototype.answers=function(I,P,y){var R=P||1e3,z=this;if(P<=0){y&&y();return}this.answer(function(X){I(X),X!==!1?setTimeout(function(){z.answers(I,P-1,y)},1):y&&y()})},xe.prototype.again=function(I){return this.thread.again(I)},tt.prototype.again=function(I){for(var P,y=Date.now();this.__calls.length>0;){for(this.warnings=[],I!==!1&&(this.current_limit=this.session.limit);this.current_limit>0&&this.points.length>0&&this.head_point().goal!==null&&!x.type.is_error(this.head_point().goal);)if(this.current_limit--,this.step()===!0)return;var R=Date.now();this.cpu_time_last=R-y,this.cpu_time+=this.cpu_time_last;var z=this.__calls.shift();this.current_limit<=0?z(null):this.points.length===0?z(!1):x.type.is_error(this.head_point().goal)?(P=this.session.format_error(this.points.pop()),this.points=[],z(P)):(this.debugger&&this.debugger_states.push(this.head_point()),P=this.session.format_success(this.points.pop()),z(P))}},xe.prototype.unfold=function(I){if(I.body===null)return!1;var P=I.head,y=I.body,R=y.select(),z=new tt(this),X=[];z.add_goal(R),z.step();for(var $=z.points.length-1;$>=0;$--){var se=z.points[$],be=P.apply(se.substitution),Fe=y.replace(se.goal);Fe!==null&&(Fe=Fe.apply(se.substitution)),X.push(new Ke(be,Fe))}var lt=this.rules[P.indicator],Et=e(lt,I);return X.length>0&&Et!==-1?(lt.splice.apply(lt,[Et,1].concat(X)),!0):!1},tt.prototype.unfold=function(I){return this.session.unfold(I)},Se.prototype.interpret=function(I){return x.error.instantiation(I.level)},Re.prototype.interpret=function(I){return this},q.prototype.interpret=function(I){return x.type.is_unitary_list(this)?this.args[0].interpret(I):x.operate(I,this)},Se.prototype.compare=function(I){return this.idI.id?1:0},Re.prototype.compare=function(I){if(this.value===I.value&&this.is_float===I.is_float)return 0;if(this.valueI.value)return 1},q.prototype.compare=function(I){if(this.args.lengthI.args.length||this.args.length===I.args.length&&this.id>I.id)return 1;for(var P=0;PR)return 1;if(I.constructor===Re){if(I.is_float&&P.is_float)return 0;if(I.is_float)return-1;if(P.is_float)return 1}return 0},is_substitution:function(I){return I instanceof Te},is_state:function(I){return I instanceof ke},is_rule:function(I){return I instanceof Ke},is_variable:function(I){return I instanceof Se},is_stream:function(I){return I instanceof Le},is_anonymous_var:function(I){return I instanceof Se&&I.id==="_"},is_callable:function(I){return I instanceof q},is_number:function(I){return I instanceof Re},is_integer:function(I){return I instanceof Re&&!I.is_float},is_float:function(I){return I instanceof Re&&I.is_float},is_term:function(I){return I instanceof q},is_atom:function(I){return I instanceof q&&I.args.length===0},is_ground:function(I){if(I instanceof Se)return!1;if(I instanceof q){for(var P=0;P0},is_list:function(I){return I instanceof q&&(I.indicator==="[]/0"||I.indicator==="./2")},is_empty_list:function(I){return I instanceof q&&I.indicator==="[]/0"},is_non_empty_list:function(I){return I instanceof q&&I.indicator==="./2"},is_fully_list:function(I){for(;I instanceof q&&I.indicator==="./2";)I=I.args[1];return I instanceof Se||I instanceof q&&I.indicator==="[]/0"},is_instantiated_list:function(I){for(;I instanceof q&&I.indicator==="./2";)I=I.args[1];return I instanceof q&&I.indicator==="[]/0"},is_unitary_list:function(I){return I instanceof q&&I.indicator==="./2"&&I.args[1]instanceof q&&I.args[1].indicator==="[]/0"},is_character:function(I){return I instanceof q&&(I.id.length===1||I.id.length>0&&I.id.length<=2&&n(I.id,0)>=65536)},is_character_code:function(I){return I instanceof Re&&!I.is_float&&I.value>=0&&I.value<=1114111},is_byte:function(I){return I instanceof Re&&!I.is_float&&I.value>=0&&I.value<=255},is_operator:function(I){return I instanceof q&&x.arithmetic.evaluation[I.indicator]},is_directive:function(I){return I instanceof q&&x.directive[I.indicator]!==void 0},is_builtin:function(I){return I instanceof q&&x.predicate[I.indicator]!==void 0},is_error:function(I){return I instanceof q&&I.indicator==="throw/1"},is_predicate_indicator:function(I){return I instanceof q&&I.indicator==="//2"&&I.args[0]instanceof q&&I.args[0].args.length===0&&I.args[1]instanceof Re&&I.args[1].is_float===!1},is_flag:function(I){return I instanceof q&&I.args.length===0&&x.flag[I.id]!==void 0},is_value_flag:function(I,P){if(!x.type.is_flag(I))return!1;for(var y in x.flag[I.id].allowed)if(x.flag[I.id].allowed.hasOwnProperty(y)&&x.flag[I.id].allowed[y].equals(P))return!0;return!1},is_io_mode:function(I){return x.type.is_atom(I)&&["read","write","append"].indexOf(I.id)!==-1},is_stream_option:function(I){return x.type.is_term(I)&&(I.indicator==="alias/1"&&x.type.is_atom(I.args[0])||I.indicator==="reposition/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="true"||I.args[0].id==="false")||I.indicator==="type/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="text"||I.args[0].id==="binary")||I.indicator==="eof_action/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="error"||I.args[0].id==="eof_code"||I.args[0].id==="reset"))},is_stream_position:function(I){return x.type.is_integer(I)&&I.value>=0||x.type.is_atom(I)&&(I.id==="end_of_stream"||I.id==="past_end_of_stream")},is_stream_property:function(I){return x.type.is_term(I)&&(I.indicator==="input/0"||I.indicator==="output/0"||I.indicator==="alias/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0]))||I.indicator==="file_name/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0]))||I.indicator==="position/1"&&(x.type.is_variable(I.args[0])||x.type.is_stream_position(I.args[0]))||I.indicator==="reposition/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0])&&(I.args[0].id==="true"||I.args[0].id==="false"))||I.indicator==="type/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0])&&(I.args[0].id==="text"||I.args[0].id==="binary"))||I.indicator==="mode/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0])&&(I.args[0].id==="read"||I.args[0].id==="write"||I.args[0].id==="append"))||I.indicator==="eof_action/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0])&&(I.args[0].id==="error"||I.args[0].id==="eof_code"||I.args[0].id==="reset"))||I.indicator==="end_of_stream/1"&&(x.type.is_variable(I.args[0])||x.type.is_atom(I.args[0])&&(I.args[0].id==="at"||I.args[0].id==="past"||I.args[0].id==="not")))},is_streamable:function(I){return I.__proto__.stream!==void 0},is_read_option:function(I){return x.type.is_term(I)&&["variables/1","variable_names/1","singletons/1"].indexOf(I.indicator)!==-1},is_write_option:function(I){return x.type.is_term(I)&&(I.indicator==="quoted/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="true"||I.args[0].id==="false")||I.indicator==="ignore_ops/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="true"||I.args[0].id==="false")||I.indicator==="numbervars/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="true"||I.args[0].id==="false"))},is_close_option:function(I){return x.type.is_term(I)&&I.indicator==="force/1"&&x.type.is_atom(I.args[0])&&(I.args[0].id==="true"||I.args[0].id==="false")},is_modifiable_flag:function(I){return x.type.is_flag(I)&&x.flag[I.id].changeable},is_module:function(I){return I instanceof q&&I.indicator==="library/1"&&I.args[0]instanceof q&&I.args[0].args.length===0&&x.module[I.args[0].id]!==void 0}},arithmetic:{evaluation:{"e/0":{type_args:null,type_result:!0,fn:function(I){return Math.E}},"pi/0":{type_args:null,type_result:!0,fn:function(I){return Math.PI}},"tau/0":{type_args:null,type_result:!0,fn:function(I){return 2*Math.PI}},"epsilon/0":{type_args:null,type_result:!0,fn:function(I){return Number.EPSILON}},"+/1":{type_args:null,type_result:null,fn:function(I,P){return I}},"-/1":{type_args:null,type_result:null,fn:function(I,P){return-I}},"\\/1":{type_args:!1,type_result:!1,fn:function(I,P){return~I}},"abs/1":{type_args:null,type_result:null,fn:function(I,P){return Math.abs(I)}},"sign/1":{type_args:null,type_result:null,fn:function(I,P){return Math.sign(I)}},"float_integer_part/1":{type_args:!0,type_result:!1,fn:function(I,P){return parseInt(I)}},"float_fractional_part/1":{type_args:!0,type_result:!0,fn:function(I,P){return I-parseInt(I)}},"float/1":{type_args:null,type_result:!0,fn:function(I,P){return parseFloat(I)}},"floor/1":{type_args:!0,type_result:!1,fn:function(I,P){return Math.floor(I)}},"truncate/1":{type_args:!0,type_result:!1,fn:function(I,P){return parseInt(I)}},"round/1":{type_args:!0,type_result:!1,fn:function(I,P){return Math.round(I)}},"ceiling/1":{type_args:!0,type_result:!1,fn:function(I,P){return Math.ceil(I)}},"sin/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.sin(I)}},"cos/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.cos(I)}},"tan/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.tan(I)}},"asin/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.asin(I)}},"acos/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.acos(I)}},"atan/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.atan(I)}},"atan2/2":{type_args:null,type_result:!0,fn:function(I,P,y){return Math.atan2(I,P)}},"exp/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.exp(I)}},"sqrt/1":{type_args:null,type_result:!0,fn:function(I,P){return Math.sqrt(I)}},"log/1":{type_args:null,type_result:!0,fn:function(I,P){return I>0?Math.log(I):x.error.evaluation("undefined",P.__call_indicator)}},"+/2":{type_args:null,type_result:null,fn:function(I,P,y){return I+P}},"-/2":{type_args:null,type_result:null,fn:function(I,P,y){return I-P}},"*/2":{type_args:null,type_result:null,fn:function(I,P,y){return I*P}},"//2":{type_args:null,type_result:!0,fn:function(I,P,y){return P?I/P:x.error.evaluation("zero_division",y.__call_indicator)}},"///2":{type_args:!1,type_result:!1,fn:function(I,P,y){return P?parseInt(I/P):x.error.evaluation("zero_division",y.__call_indicator)}},"**/2":{type_args:null,type_result:!0,fn:function(I,P,y){return Math.pow(I,P)}},"^/2":{type_args:null,type_result:null,fn:function(I,P,y){return Math.pow(I,P)}},"<>/2":{type_args:!1,type_result:!1,fn:function(I,P,y){return I>>P}},"/\\/2":{type_args:!1,type_result:!1,fn:function(I,P,y){return I&P}},"\\//2":{type_args:!1,type_result:!1,fn:function(I,P,y){return I|P}},"xor/2":{type_args:!1,type_result:!1,fn:function(I,P,y){return I^P}},"rem/2":{type_args:!1,type_result:!1,fn:function(I,P,y){return P?I%P:x.error.evaluation("zero_division",y.__call_indicator)}},"mod/2":{type_args:!1,type_result:!1,fn:function(I,P,y){return P?I-parseInt(I/P)*P:x.error.evaluation("zero_division",y.__call_indicator)}},"max/2":{type_args:null,type_result:null,fn:function(I,P,y){return Math.max(I,P)}},"min/2":{type_args:null,type_result:null,fn:function(I,P,y){return Math.min(I,P)}}}},directive:{"dynamic/1":function(I,P){var y=P.args[0];if(x.type.is_variable(y))I.throw_error(x.error.instantiation(P.indicator));else if(!x.type.is_compound(y)||y.indicator!=="//2")I.throw_error(x.error.type("predicate_indicator",y,P.indicator));else if(x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1]))I.throw_error(x.error.instantiation(P.indicator));else if(!x.type.is_atom(y.args[0]))I.throw_error(x.error.type("atom",y.args[0],P.indicator));else if(!x.type.is_integer(y.args[1]))I.throw_error(x.error.type("integer",y.args[1],P.indicator));else{var R=P.args[0].args[0].id+"/"+P.args[0].args[1].value;I.session.public_predicates[R]=!0,I.session.rules[R]||(I.session.rules[R]=[])}},"multifile/1":function(I,P){var y=P.args[0];x.type.is_variable(y)?I.throw_error(x.error.instantiation(P.indicator)):!x.type.is_compound(y)||y.indicator!=="//2"?I.throw_error(x.error.type("predicate_indicator",y,P.indicator)):x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1])?I.throw_error(x.error.instantiation(P.indicator)):x.type.is_atom(y.args[0])?x.type.is_integer(y.args[1])?I.session.multifile_predicates[P.args[0].args[0].id+"/"+P.args[0].args[1].value]=!0:I.throw_error(x.error.type("integer",y.args[1],P.indicator)):I.throw_error(x.error.type("atom",y.args[0],P.indicator))},"set_prolog_flag/2":function(I,P){var y=P.args[0],R=P.args[1];x.type.is_variable(y)||x.type.is_variable(R)?I.throw_error(x.error.instantiation(P.indicator)):x.type.is_atom(y)?x.type.is_flag(y)?x.type.is_value_flag(y,R)?x.type.is_modifiable_flag(y)?I.session.flag[y.id]=R:I.throw_error(x.error.permission("modify","flag",y)):I.throw_error(x.error.domain("flag_value",new q("+",[y,R]),P.indicator)):I.throw_error(x.error.domain("prolog_flag",y,P.indicator)):I.throw_error(x.error.type("atom",y,P.indicator))},"use_module/1":function(I,P){var y=P.args[0];if(x.type.is_variable(y))I.throw_error(x.error.instantiation(P.indicator));else if(!x.type.is_term(y))I.throw_error(x.error.type("term",y,P.indicator));else if(x.type.is_module(y)){var R=y.args[0].id;e(I.session.modules,R)===-1&&I.session.modules.push(R)}},"char_conversion/2":function(I,P){var y=P.args[0],R=P.args[1];x.type.is_variable(y)||x.type.is_variable(R)?I.throw_error(x.error.instantiation(P.indicator)):x.type.is_character(y)?x.type.is_character(R)?y.id===R.id?delete I.session.__char_conversion[y.id]:I.session.__char_conversion[y.id]=R.id:I.throw_error(x.error.type("character",R,P.indicator)):I.throw_error(x.error.type("character",y,P.indicator))},"op/3":function(I,P){var y=P.args[0],R=P.args[1],z=P.args[2];if(x.type.is_variable(y)||x.type.is_variable(R)||x.type.is_variable(z))I.throw_error(x.error.instantiation(P.indicator));else if(!x.type.is_integer(y))I.throw_error(x.error.type("integer",y,P.indicator));else if(!x.type.is_atom(R))I.throw_error(x.error.type("atom",R,P.indicator));else if(!x.type.is_atom(z))I.throw_error(x.error.type("atom",z,P.indicator));else if(y.value<0||y.value>1200)I.throw_error(x.error.domain("operator_priority",y,P.indicator));else if(z.id===",")I.throw_error(x.error.permission("modify","operator",z,P.indicator));else if(z.id==="|"&&(y.value<1001||R.id.length!==3))I.throw_error(x.error.permission("modify","operator",z,P.indicator));else if(["fy","fx","yf","xf","xfx","yfx","xfy"].indexOf(R.id)===-1)I.throw_error(x.error.domain("operator_specifier",R,P.indicator));else{var X={prefix:null,infix:null,postfix:null};for(var $ in I.session.__operators)if(I.session.__operators.hasOwnProperty($)){var se=I.session.__operators[$][z.id];se&&(e(se,"fx")!==-1&&(X.prefix={priority:$,type:"fx"}),e(se,"fy")!==-1&&(X.prefix={priority:$,type:"fy"}),e(se,"xf")!==-1&&(X.postfix={priority:$,type:"xf"}),e(se,"yf")!==-1&&(X.postfix={priority:$,type:"yf"}),e(se,"xfx")!==-1&&(X.infix={priority:$,type:"xfx"}),e(se,"xfy")!==-1&&(X.infix={priority:$,type:"xfy"}),e(se,"yfx")!==-1&&(X.infix={priority:$,type:"yfx"}))}var be;switch(R.id){case"fy":case"fx":be="prefix";break;case"yf":case"xf":be="postfix";break;default:be="infix";break}if(((X.prefix&&be==="prefix"||X.postfix&&be==="postfix"||X.infix&&be==="infix")&&X[be].type!==R.id||X.infix&&be==="postfix"||X.postfix&&be==="infix")&&y.value!==0)I.throw_error(x.error.permission("create","operator",z,P.indicator));else return X[be]&&(me(I.session.__operators[X[be].priority][z.id],R.id),I.session.__operators[X[be].priority][z.id].length===0&&delete I.session.__operators[X[be].priority][z.id]),y.value>0&&(I.session.__operators[y.value]||(I.session.__operators[y.value.toString()]={}),I.session.__operators[y.value][z.id]||(I.session.__operators[y.value][z.id]=[]),I.session.__operators[y.value][z.id].push(R.id)),!0}}},predicate:{"op/3":function(I,P,y){x.directive["op/3"](I,y)&&I.success(P)},"current_op/3":function(I,P,y){var R=y.args[0],z=y.args[1],X=y.args[2],$=[];for(var se in I.session.__operators)for(var be in I.session.__operators[se])for(var Fe=0;Fe/2"){var R=I.points,z=I.session.format_success,X=I.session.format_error;I.session.format_success=function(Fe){return Fe.substitution},I.session.format_error=function(Fe){return Fe.goal},I.points=[new ke(y.args[0].args[0],P.substitution,P)];var $=function(Fe){I.points=R,I.session.format_success=z,I.session.format_error=X,Fe===!1?I.prepend([new ke(P.goal.replace(y.args[1]),P.substitution,P)]):x.type.is_error(Fe)?I.throw_error(Fe.args[0]):Fe===null?(I.prepend([P]),I.__calls.shift()(null)):I.prepend([new ke(P.goal.replace(y.args[0].args[1]).apply(Fe),P.substitution.apply(Fe),P)])};I.__calls.unshift($)}else{var se=new ke(P.goal.replace(y.args[0]),P.substitution,P),be=new ke(P.goal.replace(y.args[1]),P.substitution,P);I.prepend([se,be])}},"!/0":function(I,P,y){var R,z,X=[];for(R=P,z=null;R.parent!==null&&R.parent.goal.search(y);)if(z=R,R=R.parent,R.goal!==null){var $=R.goal.select();if($&&$.id==="call"&&$.search(y)){R=z;break}}for(var se=I.points.length-1;se>=0;se--){for(var be=I.points[se],Fe=be.parent;Fe!==null&&Fe!==R.parent;)Fe=Fe.parent;Fe===null&&Fe!==R.parent&&X.push(be)}I.points=X.reverse(),I.success(P)},"\\+/1":function(I,P,y){var R=y.args[0];x.type.is_variable(R)?I.throw_error(x.error.instantiation(I.level)):x.type.is_callable(R)?I.prepend([new ke(P.goal.replace(new q(",",[new q(",",[new q("call",[R]),new q("!",[])]),new q("fail",[])])),P.substitution,P),new ke(P.goal.replace(null),P.substitution,P)]):I.throw_error(x.error.type("callable",R,I.level))},"->/2":function(I,P,y){var R=P.goal.replace(new q(",",[y.args[0],new q(",",[new q("!"),y.args[1]])]));I.prepend([new ke(R,P.substitution,P)])},"fail/0":function(I,P,y){},"false/0":function(I,P,y){},"true/0":function(I,P,y){I.success(P)},"call/1":ie(1),"call/2":ie(2),"call/3":ie(3),"call/4":ie(4),"call/5":ie(5),"call/6":ie(6),"call/7":ie(7),"call/8":ie(8),"once/1":function(I,P,y){var R=y.args[0];I.prepend([new ke(P.goal.replace(new q(",",[new q("call",[R]),new q("!",[])])),P.substitution,P)])},"forall/2":function(I,P,y){var R=y.args[0],z=y.args[1];I.prepend([new ke(P.goal.replace(new q("\\+",[new q(",",[new q("call",[R]),new q("\\+",[new q("call",[z])])])])),P.substitution,P)])},"repeat/0":function(I,P,y){I.prepend([new ke(P.goal.replace(null),P.substitution,P),P])},"throw/1":function(I,P,y){x.type.is_variable(y.args[0])?I.throw_error(x.error.instantiation(I.level)):I.throw_error(y.args[0])},"catch/3":function(I,P,y){var R=I.points;I.points=[],I.prepend([new ke(y.args[0],P.substitution,P)]);var z=I.session.format_success,X=I.session.format_error;I.session.format_success=function(se){return se.substitution},I.session.format_error=function(se){return se.goal};var $=function(se){var be=I.points;if(I.points=R,I.session.format_success=z,I.session.format_error=X,x.type.is_error(se)){for(var Fe=[],lt=I.points.length-1;lt>=0;lt--){for(var nr=I.points[lt],Et=nr.parent;Et!==null&&Et!==P.parent;)Et=Et.parent;Et===null&&Et!==P.parent&&Fe.push(nr)}I.points=Fe;var qt=I.get_flag("occurs_check").indicator==="true/0",nr=new ke,Pt=x.unify(se.args[0],y.args[1],qt);Pt!==null?(nr.substitution=P.substitution.apply(Pt),nr.goal=P.goal.replace(y.args[2]).apply(Pt),nr.parent=P,I.prepend([nr])):I.throw_error(se.args[0])}else if(se!==!1){for(var cn=se===null?[]:[new ke(P.goal.apply(se).replace(null),P.substitution.apply(se),P)],Sr=[],lt=be.length-1;lt>=0;lt--){Sr.push(be[lt]);var yr=be[lt].goal!==null?be[lt].goal.select():null;if(x.type.is_term(yr)&&yr.indicator==="!/0")break}var Rr=o(Sr,function(Xr){return Xr.goal===null&&(Xr.goal=new q("true",[])),Xr=new ke(P.goal.replace(new q("catch",[Xr.goal,y.args[1],y.args[2]])),P.substitution.apply(Xr.substitution),Xr.parent),Xr.exclude=y.args[0].variables(),Xr}).reverse();I.prepend(Rr),I.prepend(cn),se===null&&(this.current_limit=0,I.__calls.shift()(null))}};I.__calls.unshift($)},"=/2":function(I,P,y){var R=I.get_flag("occurs_check").indicator==="true/0",z=new ke,X=x.unify(y.args[0],y.args[1],R);X!==null&&(z.goal=P.goal.apply(X).replace(null),z.substitution=P.substitution.apply(X),z.parent=P,I.prepend([z]))},"unify_with_occurs_check/2":function(I,P,y){var R=new ke,z=x.unify(y.args[0],y.args[1],!0);z!==null&&(R.goal=P.goal.apply(z).replace(null),R.substitution=P.substitution.apply(z),R.parent=P,I.prepend([R]))},"\\=/2":function(I,P,y){var R=I.get_flag("occurs_check").indicator==="true/0",z=x.unify(y.args[0],y.args[1],R);z===null&&I.success(P)},"subsumes_term/2":function(I,P,y){var R=I.get_flag("occurs_check").indicator==="true/0",z=x.unify(y.args[1],y.args[0],R);z!==null&&y.args[1].apply(z).equals(y.args[1])&&I.success(P)},"findall/3":function(I,P,y){var R=y.args[0],z=y.args[1],X=y.args[2];if(x.type.is_variable(z))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(z))I.throw_error(x.error.type("callable",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_list(X))I.throw_error(x.error.type("list",X,y.indicator));else{var $=I.next_free_variable(),se=new q(",",[z,new q("=",[$,R])]),be=I.points,Fe=I.session.limit,lt=I.session.format_success;I.session.format_success=function(nr){return nr.substitution},I.add_goal(se,!0,P);var Et=[],qt=function(nr){if(nr!==!1&&nr!==null&&!x.type.is_error(nr))I.__calls.unshift(qt),Et.push(nr.links[$.id]),I.session.limit=I.current_limit;else if(I.points=be,I.session.limit=Fe,I.session.format_success=lt,x.type.is_error(nr))I.throw_error(nr.args[0]);else if(I.current_limit>0){for(var Pt=new q("[]"),cn=Et.length-1;cn>=0;cn--)Pt=new q(".",[Et[cn],Pt]);I.prepend([new ke(P.goal.replace(new q("=",[X,Pt])),P.substitution,P)])}};I.__calls.unshift(qt)}},"bagof/3":function(I,P,y){var R,z=y.args[0],X=y.args[1],$=y.args[2];if(x.type.is_variable(X))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(X))I.throw_error(x.error.type("callable",X,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_list($))I.throw_error(x.error.type("list",$,y.indicator));else{var se=I.next_free_variable(),be;X.indicator==="^/2"?(be=X.args[0].variables(),X=X.args[1]):be=[],be=be.concat(z.variables());for(var Fe=X.variables().filter(function(Rr){return e(be,Rr)===-1}),lt=new q("[]"),Et=Fe.length-1;Et>=0;Et--)lt=new q(".",[new Se(Fe[Et]),lt]);var qt=new q(",",[X,new q("=",[se,new q(",",[lt,z])])]),nr=I.points,Pt=I.session.limit,cn=I.session.format_success;I.session.format_success=function(Rr){return Rr.substitution},I.add_goal(qt,!0,P);var Sr=[],yr=function(Rr){if(Rr!==!1&&Rr!==null&&!x.type.is_error(Rr)){I.__calls.unshift(yr);var Xr=!1,$n=Rr.links[se.id].args[0],Xs=Rr.links[se.id].args[1];for(var Hi in Sr)if(Sr.hasOwnProperty(Hi)){var Qs=Sr[Hi];if(Qs.variables.equals($n)){Qs.answers.push(Xs),Xr=!0;break}}Xr||Sr.push({variables:$n,answers:[Xs]}),I.session.limit=I.current_limit}else if(I.points=nr,I.session.limit=Pt,I.session.format_success=cn,x.type.is_error(Rr))I.throw_error(Rr.args[0]);else if(I.current_limit>0){for(var Zs=[],bi=0;bi=0;$s--)Fs=new q(".",[Rr[$s],Fs]);Zs.push(new ke(P.goal.replace(new q(",",[new q("=",[lt,Sr[bi].variables]),new q("=",[$,Fs])])),P.substitution,P))}I.prepend(Zs)}};I.__calls.unshift(yr)}},"setof/3":function(I,P,y){var R,z=y.args[0],X=y.args[1],$=y.args[2];if(x.type.is_variable(X))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(X))I.throw_error(x.error.type("callable",X,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_list($))I.throw_error(x.error.type("list",$,y.indicator));else{var se=I.next_free_variable(),be;X.indicator==="^/2"?(be=X.args[0].variables(),X=X.args[1]):be=[],be=be.concat(z.variables());for(var Fe=X.variables().filter(function(Rr){return e(be,Rr)===-1}),lt=new q("[]"),Et=Fe.length-1;Et>=0;Et--)lt=new q(".",[new Se(Fe[Et]),lt]);var qt=new q(",",[X,new q("=",[se,new q(",",[lt,z])])]),nr=I.points,Pt=I.session.limit,cn=I.session.format_success;I.session.format_success=function(Rr){return Rr.substitution},I.add_goal(qt,!0,P);var Sr=[],yr=function(Rr){if(Rr!==!1&&Rr!==null&&!x.type.is_error(Rr)){I.__calls.unshift(yr);var Xr=!1,$n=Rr.links[se.id].args[0],Xs=Rr.links[se.id].args[1];for(var Hi in Sr)if(Sr.hasOwnProperty(Hi)){var Qs=Sr[Hi];if(Qs.variables.equals($n)){Qs.answers.push(Xs),Xr=!0;break}}Xr||Sr.push({variables:$n,answers:[Xs]}),I.session.limit=I.current_limit}else if(I.points=nr,I.session.limit=Pt,I.session.format_success=cn,x.type.is_error(Rr))I.throw_error(Rr.args[0]);else if(I.current_limit>0){for(var Zs=[],bi=0;bi=0;$s--)Fs=new q(".",[Rr[$s],Fs]);Zs.push(new ke(P.goal.replace(new q(",",[new q("=",[lt,Sr[bi].variables]),new q("=",[$,Fs])])),P.substitution,P))}I.prepend(Zs)}};I.__calls.unshift(yr)}},"functor/3":function(I,P,y){var R,z=y.args[0],X=y.args[1],$=y.args[2];if(x.type.is_variable(z)&&(x.type.is_variable(X)||x.type.is_variable($)))I.throw_error(x.error.instantiation("functor/3"));else if(!x.type.is_variable($)&&!x.type.is_integer($))I.throw_error(x.error.type("integer",y.args[2],"functor/3"));else if(!x.type.is_variable(X)&&!x.type.is_atomic(X))I.throw_error(x.error.type("atomic",y.args[1],"functor/3"));else if(x.type.is_integer(X)&&x.type.is_integer($)&&$.value!==0)I.throw_error(x.error.type("atom",y.args[1],"functor/3"));else if(x.type.is_variable(z)){if(y.args[2].value>=0){for(var se=[],be=0;be<$.value;be++)se.push(I.next_free_variable());var Fe=x.type.is_integer(X)?X:new q(X.id,se);I.prepend([new ke(P.goal.replace(new q("=",[z,Fe])),P.substitution,P)])}}else{var lt=x.type.is_integer(z)?z:new q(z.id,[]),Et=x.type.is_integer(z)?new Re(0,!1):new Re(z.args.length,!1),qt=new q(",",[new q("=",[lt,X]),new q("=",[Et,$])]);I.prepend([new ke(P.goal.replace(qt),P.substitution,P)])}},"arg/3":function(I,P,y){if(x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1]))I.throw_error(x.error.instantiation(y.indicator));else if(y.args[0].value<0)I.throw_error(x.error.domain("not_less_than_zero",y.args[0],y.indicator));else if(!x.type.is_compound(y.args[1]))I.throw_error(x.error.type("compound",y.args[1],y.indicator));else{var R=y.args[0].value;if(R>0&&R<=y.args[1].args.length){var z=new q("=",[y.args[1].args[R-1],y.args[2]]);I.prepend([new ke(P.goal.replace(z),P.substitution,P)])}}},"=../2":function(I,P,y){var R;if(x.type.is_variable(y.args[0])&&(x.type.is_variable(y.args[1])||x.type.is_non_empty_list(y.args[1])&&x.type.is_variable(y.args[1].args[0])))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_fully_list(y.args[1]))I.throw_error(x.error.type("list",y.args[1],y.indicator));else if(x.type.is_variable(y.args[0])){if(!x.type.is_variable(y.args[1])){var X=[];for(R=y.args[1].args[1];R.indicator==="./2";)X.push(R.args[0]),R=R.args[1];x.type.is_variable(y.args[0])&&x.type.is_variable(R)?I.throw_error(x.error.instantiation(y.indicator)):X.length===0&&x.type.is_compound(y.args[1].args[0])?I.throw_error(x.error.type("atomic",y.args[1].args[0],y.indicator)):X.length>0&&(x.type.is_compound(y.args[1].args[0])||x.type.is_number(y.args[1].args[0]))?I.throw_error(x.error.type("atom",y.args[1].args[0],y.indicator)):X.length===0?I.prepend([new ke(P.goal.replace(new q("=",[y.args[1].args[0],y.args[0]],P)),P.substitution,P)]):I.prepend([new ke(P.goal.replace(new q("=",[new q(y.args[1].args[0].id,X),y.args[0]])),P.substitution,P)])}}else{if(x.type.is_atomic(y.args[0]))R=new q(".",[y.args[0],new q("[]")]);else{R=new q("[]");for(var z=y.args[0].args.length-1;z>=0;z--)R=new q(".",[y.args[0].args[z],R]);R=new q(".",[new q(y.args[0].id),R])}I.prepend([new ke(P.goal.replace(new q("=",[R,y.args[1]])),P.substitution,P)])}},"copy_term/2":function(I,P,y){var R=y.args[0].rename(I);I.prepend([new ke(P.goal.replace(new q("=",[R,y.args[1]])),P.substitution,P.parent)])},"term_variables/2":function(I,P,y){var R=y.args[0],z=y.args[1];if(!x.type.is_fully_list(z))I.throw_error(x.error.type("list",z,y.indicator));else{var X=g(o(Ce(R.variables()),function($){return new Se($)}));I.prepend([new ke(P.goal.replace(new q("=",[z,X])),P.substitution,P)])}},"clause/2":function(I,P,y){if(x.type.is_variable(y.args[0]))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))I.throw_error(x.error.type("callable",y.args[0],y.indicator));else if(!x.type.is_variable(y.args[1])&&!x.type.is_callable(y.args[1]))I.throw_error(x.error.type("callable",y.args[1],y.indicator));else if(I.session.rules[y.args[0].indicator]!==void 0)if(I.is_public_predicate(y.args[0].indicator)){var R=[];for(var z in I.session.rules[y.args[0].indicator])if(I.session.rules[y.args[0].indicator].hasOwnProperty(z)){var X=I.session.rules[y.args[0].indicator][z];I.session.renamed_variables={},X=X.rename(I),X.body===null&&(X.body=new q("true"));var $=new q(",",[new q("=",[X.head,y.args[0]]),new q("=",[X.body,y.args[1]])]);R.push(new ke(P.goal.replace($),P.substitution,P))}I.prepend(R)}else I.throw_error(x.error.permission("access","private_procedure",y.args[0].indicator,y.indicator))},"current_predicate/1":function(I,P,y){var R=y.args[0];if(!x.type.is_variable(R)&&(!x.type.is_compound(R)||R.indicator!=="//2"))I.throw_error(x.error.type("predicate_indicator",R,y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_variable(R.args[0])&&!x.type.is_atom(R.args[0]))I.throw_error(x.error.type("atom",R.args[0],y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_variable(R.args[1])&&!x.type.is_integer(R.args[1]))I.throw_error(x.error.type("integer",R.args[1],y.indicator));else{var z=[];for(var X in I.session.rules)if(I.session.rules.hasOwnProperty(X)){var $=X.lastIndexOf("/"),se=X.substr(0,$),be=parseInt(X.substr($+1,X.length-($+1))),Fe=new q("/",[new q(se),new Re(be,!1)]),lt=new q("=",[Fe,R]);z.push(new ke(P.goal.replace(lt),P.substitution,P))}I.prepend(z)}},"asserta/1":function(I,P,y){if(x.type.is_variable(y.args[0]))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))I.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var R,z;y.args[0].indicator===":-/2"?(R=y.args[0].args[0],z=Ee(y.args[0].args[1])):(R=y.args[0],z=null),x.type.is_callable(R)?z!==null&&!x.type.is_callable(z)?I.throw_error(x.error.type("callable",z,y.indicator)):I.is_public_predicate(R.indicator)?(I.session.rules[R.indicator]===void 0&&(I.session.rules[R.indicator]=[]),I.session.public_predicates[R.indicator]=!0,I.session.rules[R.indicator]=[new Ke(R,z,!0)].concat(I.session.rules[R.indicator]),I.success(P)):I.throw_error(x.error.permission("modify","static_procedure",R.indicator,y.indicator)):I.throw_error(x.error.type("callable",R,y.indicator))}},"assertz/1":function(I,P,y){if(x.type.is_variable(y.args[0]))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))I.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var R,z;y.args[0].indicator===":-/2"?(R=y.args[0].args[0],z=Ee(y.args[0].args[1])):(R=y.args[0],z=null),x.type.is_callable(R)?z!==null&&!x.type.is_callable(z)?I.throw_error(x.error.type("callable",z,y.indicator)):I.is_public_predicate(R.indicator)?(I.session.rules[R.indicator]===void 0&&(I.session.rules[R.indicator]=[]),I.session.public_predicates[R.indicator]=!0,I.session.rules[R.indicator].push(new Ke(R,z,!0)),I.success(P)):I.throw_error(x.error.permission("modify","static_procedure",R.indicator,y.indicator)):I.throw_error(x.error.type("callable",R,y.indicator))}},"retract/1":function(I,P,y){if(x.type.is_variable(y.args[0]))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))I.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var R,z;if(y.args[0].indicator===":-/2"?(R=y.args[0].args[0],z=y.args[0].args[1]):(R=y.args[0],z=new q("true")),typeof P.retract>"u")if(I.is_public_predicate(R.indicator)){if(I.session.rules[R.indicator]!==void 0){for(var X=[],$=0;$I.get_flag("max_arity").value)I.throw_error(x.error.representation("max_arity",y.indicator));else{var R=y.args[0].args[0].id+"/"+y.args[0].args[1].value;I.is_public_predicate(R)?(delete I.session.rules[R],I.success(P)):I.throw_error(x.error.permission("modify","static_procedure",R,y.indicator))}},"atom_length/2":function(I,P,y){if(x.type.is_variable(y.args[0]))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_atom(y.args[0]))I.throw_error(x.error.type("atom",y.args[0],y.indicator));else if(!x.type.is_variable(y.args[1])&&!x.type.is_integer(y.args[1]))I.throw_error(x.error.type("integer",y.args[1],y.indicator));else if(x.type.is_integer(y.args[1])&&y.args[1].value<0)I.throw_error(x.error.domain("not_less_than_zero",y.args[1],y.indicator));else{var R=new Re(y.args[0].id.length,!1);I.prepend([new ke(P.goal.replace(new q("=",[R,y.args[1]])),P.substitution,P)])}},"atom_concat/3":function(I,P,y){var R,z,X=y.args[0],$=y.args[1],se=y.args[2];if(x.type.is_variable(se)&&(x.type.is_variable(X)||x.type.is_variable($)))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_atom(X))I.throw_error(x.error.type("atom",X,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_atom($))I.throw_error(x.error.type("atom",$,y.indicator));else if(!x.type.is_variable(se)&&!x.type.is_atom(se))I.throw_error(x.error.type("atom",se,y.indicator));else{var be=x.type.is_variable(X),Fe=x.type.is_variable($);if(!be&&!Fe)z=new q("=",[se,new q(X.id+$.id)]),I.prepend([new ke(P.goal.replace(z),P.substitution,P)]);else if(be&&!Fe)R=se.id.substr(0,se.id.length-$.id.length),R+$.id===se.id&&(z=new q("=",[X,new q(R)]),I.prepend([new ke(P.goal.replace(z),P.substitution,P)]));else if(Fe&&!be)R=se.id.substr(X.id.length),X.id+R===se.id&&(z=new q("=",[$,new q(R)]),I.prepend([new ke(P.goal.replace(z),P.substitution,P)]));else{for(var lt=[],Et=0;Et<=se.id.length;Et++){var qt=new q(se.id.substr(0,Et)),nr=new q(se.id.substr(Et));z=new q(",",[new q("=",[qt,X]),new q("=",[nr,$])]),lt.push(new ke(P.goal.replace(z),P.substitution,P))}I.prepend(lt)}}},"sub_atom/5":function(I,P,y){var R,z=y.args[0],X=y.args[1],$=y.args[2],se=y.args[3],be=y.args[4];if(x.type.is_variable(z))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_integer(X))I.throw_error(x.error.type("integer",X,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_integer($))I.throw_error(x.error.type("integer",$,y.indicator));else if(!x.type.is_variable(se)&&!x.type.is_integer(se))I.throw_error(x.error.type("integer",se,y.indicator));else if(x.type.is_integer(X)&&X.value<0)I.throw_error(x.error.domain("not_less_than_zero",X,y.indicator));else if(x.type.is_integer($)&&$.value<0)I.throw_error(x.error.domain("not_less_than_zero",$,y.indicator));else if(x.type.is_integer(se)&&se.value<0)I.throw_error(x.error.domain("not_less_than_zero",se,y.indicator));else{var Fe=[],lt=[],Et=[];if(x.type.is_variable(X))for(R=0;R<=z.id.length;R++)Fe.push(R);else Fe.push(X.value);if(x.type.is_variable($))for(R=0;R<=z.id.length;R++)lt.push(R);else lt.push($.value);if(x.type.is_variable(se))for(R=0;R<=z.id.length;R++)Et.push(R);else Et.push(se.value);var qt=[];for(var nr in Fe)if(Fe.hasOwnProperty(nr)){R=Fe[nr];for(var Pt in lt)if(lt.hasOwnProperty(Pt)){var cn=lt[Pt],Sr=z.id.length-R-cn;if(e(Et,Sr)!==-1&&R+cn+Sr===z.id.length){var yr=z.id.substr(R,cn);if(z.id===z.id.substr(0,R)+yr+z.id.substr(R+cn,Sr)){var Rr=new q("=",[new q(yr),be]),Xr=new q("=",[X,new Re(R)]),$n=new q("=",[$,new Re(cn)]),Xs=new q("=",[se,new Re(Sr)]),Hi=new q(",",[new q(",",[new q(",",[Xr,$n]),Xs]),Rr]);qt.push(new ke(P.goal.replace(Hi),P.substitution,P))}}}}I.prepend(qt)}},"atom_chars/2":function(I,P,y){var R=y.args[0],z=y.args[1];if(x.type.is_variable(R)&&x.type.is_variable(z))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_atom(R))I.throw_error(x.error.type("atom",R,y.indicator));else if(x.type.is_variable(R)){for(var se=z,be=x.type.is_variable(R),Fe="";se.indicator==="./2";){if(x.type.is_character(se.args[0]))Fe+=se.args[0].id;else if(x.type.is_variable(se.args[0])&&be){I.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_variable(se.args[0])){I.throw_error(x.error.type("character",se.args[0],y.indicator));return}se=se.args[1]}x.type.is_variable(se)&&be?I.throw_error(x.error.instantiation(y.indicator)):!x.type.is_empty_list(se)&&!x.type.is_variable(se)?I.throw_error(x.error.type("list",z,y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[new q(Fe),R])),P.substitution,P)])}else{for(var X=new q("[]"),$=R.id.length-1;$>=0;$--)X=new q(".",[new q(R.id.charAt($)),X]);I.prepend([new ke(P.goal.replace(new q("=",[z,X])),P.substitution,P)])}},"atom_codes/2":function(I,P,y){var R=y.args[0],z=y.args[1];if(x.type.is_variable(R)&&x.type.is_variable(z))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_atom(R))I.throw_error(x.error.type("atom",R,y.indicator));else if(x.type.is_variable(R)){for(var se=z,be=x.type.is_variable(R),Fe="";se.indicator==="./2";){if(x.type.is_character_code(se.args[0]))Fe+=u(se.args[0].value);else if(x.type.is_variable(se.args[0])&&be){I.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_variable(se.args[0])){I.throw_error(x.error.representation("character_code",y.indicator));return}se=se.args[1]}x.type.is_variable(se)&&be?I.throw_error(x.error.instantiation(y.indicator)):!x.type.is_empty_list(se)&&!x.type.is_variable(se)?I.throw_error(x.error.type("list",z,y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[new q(Fe),R])),P.substitution,P)])}else{for(var X=new q("[]"),$=R.id.length-1;$>=0;$--)X=new q(".",[new Re(n(R.id,$),!1),X]);I.prepend([new ke(P.goal.replace(new q("=",[z,X])),P.substitution,P)])}},"char_code/2":function(I,P,y){var R=y.args[0],z=y.args[1];if(x.type.is_variable(R)&&x.type.is_variable(z))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_character(R))I.throw_error(x.error.type("character",R,y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_integer(z))I.throw_error(x.error.type("integer",z,y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_character_code(z))I.throw_error(x.error.representation("character_code",y.indicator));else if(x.type.is_variable(z)){var X=new Re(n(R.id,0),!1);I.prepend([new ke(P.goal.replace(new q("=",[X,z])),P.substitution,P)])}else{var $=new q(u(z.value));I.prepend([new ke(P.goal.replace(new q("=",[$,R])),P.substitution,P)])}},"number_chars/2":function(I,P,y){var R,z=y.args[0],X=y.args[1];if(x.type.is_variable(z)&&x.type.is_variable(X))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_number(z))I.throw_error(x.error.type("number",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_list(X))I.throw_error(x.error.type("list",X,y.indicator));else{var $=x.type.is_variable(z);if(!x.type.is_variable(X)){var se=X,be=!0;for(R="";se.indicator==="./2";){if(x.type.is_character(se.args[0]))R+=se.args[0].id;else if(x.type.is_variable(se.args[0]))be=!1;else if(!x.type.is_variable(se.args[0])){I.throw_error(x.error.type("character",se.args[0],y.indicator));return}se=se.args[1]}if(be=be&&x.type.is_empty_list(se),!x.type.is_empty_list(se)&&!x.type.is_variable(se)){I.throw_error(x.error.type("list",X,y.indicator));return}if(!be&&$){I.throw_error(x.error.instantiation(y.indicator));return}else if(be)if(x.type.is_variable(se)&&$){I.throw_error(x.error.instantiation(y.indicator));return}else{var Fe=I.parse(R),lt=Fe.value;!x.type.is_number(lt)||Fe.tokens[Fe.tokens.length-1].space?I.throw_error(x.error.syntax_by_predicate("parseable_number",y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[z,lt])),P.substitution,P)]);return}}if(!$){R=z.toString();for(var Et=new q("[]"),qt=R.length-1;qt>=0;qt--)Et=new q(".",[new q(R.charAt(qt)),Et]);I.prepend([new ke(P.goal.replace(new q("=",[X,Et])),P.substitution,P)])}}},"number_codes/2":function(I,P,y){var R,z=y.args[0],X=y.args[1];if(x.type.is_variable(z)&&x.type.is_variable(X))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_number(z))I.throw_error(x.error.type("number",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_list(X))I.throw_error(x.error.type("list",X,y.indicator));else{var $=x.type.is_variable(z);if(!x.type.is_variable(X)){var se=X,be=!0;for(R="";se.indicator==="./2";){if(x.type.is_character_code(se.args[0]))R+=u(se.args[0].value);else if(x.type.is_variable(se.args[0]))be=!1;else if(!x.type.is_variable(se.args[0])){I.throw_error(x.error.type("character_code",se.args[0],y.indicator));return}se=se.args[1]}if(be=be&&x.type.is_empty_list(se),!x.type.is_empty_list(se)&&!x.type.is_variable(se)){I.throw_error(x.error.type("list",X,y.indicator));return}if(!be&&$){I.throw_error(x.error.instantiation(y.indicator));return}else if(be)if(x.type.is_variable(se)&&$){I.throw_error(x.error.instantiation(y.indicator));return}else{var Fe=I.parse(R),lt=Fe.value;!x.type.is_number(lt)||Fe.tokens[Fe.tokens.length-1].space?I.throw_error(x.error.syntax_by_predicate("parseable_number",y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[z,lt])),P.substitution,P)]);return}}if(!$){R=z.toString();for(var Et=new q("[]"),qt=R.length-1;qt>=0;qt--)Et=new q(".",[new Re(n(R,qt),!1),Et]);I.prepend([new ke(P.goal.replace(new q("=",[X,Et])),P.substitution,P)])}}},"upcase_atom/2":function(I,P,y){var R=y.args[0],z=y.args[1];x.type.is_variable(R)?I.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(R)?!x.type.is_variable(z)&&!x.type.is_atom(z)?I.throw_error(x.error.type("atom",z,y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[z,new q(R.id.toUpperCase(),[])])),P.substitution,P)]):I.throw_error(x.error.type("atom",R,y.indicator))},"downcase_atom/2":function(I,P,y){var R=y.args[0],z=y.args[1];x.type.is_variable(R)?I.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(R)?!x.type.is_variable(z)&&!x.type.is_atom(z)?I.throw_error(x.error.type("atom",z,y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[z,new q(R.id.toLowerCase(),[])])),P.substitution,P)]):I.throw_error(x.error.type("atom",R,y.indicator))},"atomic_list_concat/2":function(I,P,y){var R=y.args[0],z=y.args[1];I.prepend([new ke(P.goal.replace(new q("atomic_list_concat",[R,new q("",[]),z])),P.substitution,P)])},"atomic_list_concat/3":function(I,P,y){var R=y.args[0],z=y.args[1],X=y.args[2];if(x.type.is_variable(z)||x.type.is_variable(R)&&x.type.is_variable(X))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_list(R))I.throw_error(x.error.type("list",R,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_atom(X))I.throw_error(x.error.type("atom",X,y.indicator));else if(x.type.is_variable(X)){for(var se="",be=R;x.type.is_term(be)&&be.indicator==="./2";){if(!x.type.is_atom(be.args[0])&&!x.type.is_number(be.args[0])){I.throw_error(x.error.type("atomic",be.args[0],y.indicator));return}se!==""&&(se+=z.id),x.type.is_atom(be.args[0])?se+=be.args[0].id:se+=""+be.args[0].value,be=be.args[1]}se=new q(se,[]),x.type.is_variable(be)?I.throw_error(x.error.instantiation(y.indicator)):!x.type.is_term(be)||be.indicator!=="[]/0"?I.throw_error(x.error.type("list",R,y.indicator)):I.prepend([new ke(P.goal.replace(new q("=",[se,X])),P.substitution,P)])}else{var $=g(o(X.id.split(z.id),function(Fe){return new q(Fe,[])}));I.prepend([new ke(P.goal.replace(new q("=",[$,R])),P.substitution,P)])}},"@=/2":function(I,P,y){x.compare(y.args[0],y.args[1])>0&&I.success(P)},"@>=/2":function(I,P,y){x.compare(y.args[0],y.args[1])>=0&&I.success(P)},"compare/3":function(I,P,y){var R=y.args[0],z=y.args[1],X=y.args[2];if(!x.type.is_variable(R)&&!x.type.is_atom(R))I.throw_error(x.error.type("atom",R,y.indicator));else if(x.type.is_atom(R)&&["<",">","="].indexOf(R.id)===-1)I.throw_error(x.type.domain("order",R,y.indicator));else{var $=x.compare(z,X);$=$===0?"=":$===-1?"<":">",I.prepend([new ke(P.goal.replace(new q("=",[R,new q($,[])])),P.substitution,P)])}},"is/2":function(I,P,y){var R=y.args[1].interpret(I);x.type.is_number(R)?I.prepend([new ke(P.goal.replace(new q("=",[y.args[0],R],I.level)),P.substitution,P)]):I.throw_error(R)},"between/3":function(I,P,y){var R=y.args[0],z=y.args[1],X=y.args[2];if(x.type.is_variable(R)||x.type.is_variable(z))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_integer(R))I.throw_error(x.error.type("integer",R,y.indicator));else if(!x.type.is_integer(z))I.throw_error(x.error.type("integer",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_integer(X))I.throw_error(x.error.type("integer",X,y.indicator));else if(x.type.is_variable(X)){var $=[new ke(P.goal.replace(new q("=",[X,R])),P.substitution,P)];R.value=X.value&&I.success(P)},"succ/2":function(I,P,y){var R=y.args[0],z=y.args[1];x.type.is_variable(R)&&x.type.is_variable(z)?I.throw_error(x.error.instantiation(y.indicator)):!x.type.is_variable(R)&&!x.type.is_integer(R)?I.throw_error(x.error.type("integer",R,y.indicator)):!x.type.is_variable(z)&&!x.type.is_integer(z)?I.throw_error(x.error.type("integer",z,y.indicator)):!x.type.is_variable(R)&&R.value<0?I.throw_error(x.error.domain("not_less_than_zero",R,y.indicator)):!x.type.is_variable(z)&&z.value<0?I.throw_error(x.error.domain("not_less_than_zero",z,y.indicator)):(x.type.is_variable(z)||z.value>0)&&(x.type.is_variable(R)?I.prepend([new ke(P.goal.replace(new q("=",[R,new Re(z.value-1,!1)])),P.substitution,P)]):I.prepend([new ke(P.goal.replace(new q("=",[z,new Re(R.value+1,!1)])),P.substitution,P)]))},"=:=/2":function(I,P,y){var R=x.arithmetic_compare(I,y.args[0],y.args[1]);x.type.is_term(R)?I.throw_error(R):R===0&&I.success(P)},"=\\=/2":function(I,P,y){var R=x.arithmetic_compare(I,y.args[0],y.args[1]);x.type.is_term(R)?I.throw_error(R):R!==0&&I.success(P)},"/2":function(I,P,y){var R=x.arithmetic_compare(I,y.args[0],y.args[1]);x.type.is_term(R)?I.throw_error(R):R>0&&I.success(P)},">=/2":function(I,P,y){var R=x.arithmetic_compare(I,y.args[0],y.args[1]);x.type.is_term(R)?I.throw_error(R):R>=0&&I.success(P)},"var/1":function(I,P,y){x.type.is_variable(y.args[0])&&I.success(P)},"atom/1":function(I,P,y){x.type.is_atom(y.args[0])&&I.success(P)},"atomic/1":function(I,P,y){x.type.is_atomic(y.args[0])&&I.success(P)},"compound/1":function(I,P,y){x.type.is_compound(y.args[0])&&I.success(P)},"integer/1":function(I,P,y){x.type.is_integer(y.args[0])&&I.success(P)},"float/1":function(I,P,y){x.type.is_float(y.args[0])&&I.success(P)},"number/1":function(I,P,y){x.type.is_number(y.args[0])&&I.success(P)},"nonvar/1":function(I,P,y){x.type.is_variable(y.args[0])||I.success(P)},"ground/1":function(I,P,y){y.variables().length===0&&I.success(P)},"acyclic_term/1":function(I,P,y){for(var R=P.substitution.apply(P.substitution),z=y.args[0].variables(),X=0;X0?Pt[Pt.length-1]:null,Pt!==null&&(qt=J(I,Pt,0,I.__get_max_priority(),!1))}if(qt.type===p&&qt.len===Pt.length-1&&cn.value==="."){qt=qt.value.rename(I);var Sr=new q("=",[z,qt]);if(se.variables){var yr=g(o(Ce(qt.variables()),function(Rr){return new Se(Rr)}));Sr=new q(",",[Sr,new q("=",[se.variables,yr])])}if(se.variable_names){var yr=g(o(Ce(qt.variables()),function(Xr){var $n;for($n in I.session.renamed_variables)if(I.session.renamed_variables.hasOwnProperty($n)&&I.session.renamed_variables[$n]===Xr)break;return new q("=",[new q($n,[]),new Se(Xr)])}));Sr=new q(",",[Sr,new q("=",[se.variable_names,yr])])}if(se.singletons){var yr=g(o(new Ke(qt,null).singleton_variables(),function(Xr){var $n;for($n in I.session.renamed_variables)if(I.session.renamed_variables.hasOwnProperty($n)&&I.session.renamed_variables[$n]===Xr)break;return new q("=",[new q($n,[]),new Se(Xr)])}));Sr=new q(",",[Sr,new q("=",[se.singletons,yr])])}I.prepend([new ke(P.goal.replace(Sr),P.substitution,P)])}else qt.type===p?I.throw_error(x.error.syntax(Pt[qt.len],"unexpected token",!1)):I.throw_error(qt.value)}}},"write/1":function(I,P,y){var R=y.args[0];I.prepend([new ke(P.goal.replace(new q(",",[new q("current_output",[new Se("S")]),new q("write",[new Se("S"),R])])),P.substitution,P)])},"write/2":function(I,P,y){var R=y.args[0],z=y.args[1];I.prepend([new ke(P.goal.replace(new q("write_term",[R,z,new q(".",[new q("quoted",[new q("false",[])]),new q(".",[new q("ignore_ops",[new q("false")]),new q(".",[new q("numbervars",[new q("true")]),new q("[]",[])])])])])),P.substitution,P)])},"writeq/1":function(I,P,y){var R=y.args[0];I.prepend([new ke(P.goal.replace(new q(",",[new q("current_output",[new Se("S")]),new q("writeq",[new Se("S"),R])])),P.substitution,P)])},"writeq/2":function(I,P,y){var R=y.args[0],z=y.args[1];I.prepend([new ke(P.goal.replace(new q("write_term",[R,z,new q(".",[new q("quoted",[new q("true",[])]),new q(".",[new q("ignore_ops",[new q("false")]),new q(".",[new q("numbervars",[new q("true")]),new q("[]",[])])])])])),P.substitution,P)])},"write_canonical/1":function(I,P,y){var R=y.args[0];I.prepend([new ke(P.goal.replace(new q(",",[new q("current_output",[new Se("S")]),new q("write_canonical",[new Se("S"),R])])),P.substitution,P)])},"write_canonical/2":function(I,P,y){var R=y.args[0],z=y.args[1];I.prepend([new ke(P.goal.replace(new q("write_term",[R,z,new q(".",[new q("quoted",[new q("true",[])]),new q(".",[new q("ignore_ops",[new q("true")]),new q(".",[new q("numbervars",[new q("false")]),new q("[]",[])])])])])),P.substitution,P)])},"write_term/2":function(I,P,y){var R=y.args[0],z=y.args[1];I.prepend([new ke(P.goal.replace(new q(",",[new q("current_output",[new Se("S")]),new q("write_term",[new Se("S"),R,z])])),P.substitution,P)])},"write_term/3":function(I,P,y){var R=y.args[0],z=y.args[1],X=y.args[2],$=x.type.is_stream(R)?R:I.get_stream_by_alias(R.id);if(x.type.is_variable(R)||x.type.is_variable(X))I.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_list(X))I.throw_error(x.error.type("list",X,y.indicator));else if(!x.type.is_stream(R)&&!x.type.is_atom(R))I.throw_error(x.error.domain("stream_or_alias",R,y.indicator));else if(!x.type.is_stream($)||$.stream===null)I.throw_error(x.error.existence("stream",R,y.indicator));else if($.input)I.throw_error(x.error.permission("output","stream",R,y.indicator));else if($.type==="binary")I.throw_error(x.error.permission("output","binary_stream",R,y.indicator));else if($.position==="past_end_of_stream"&&$.eof_action==="error")I.throw_error(x.error.permission("output","past_end_of_stream",R,y.indicator));else{for(var se={},be=X,Fe;x.type.is_term(be)&&be.indicator==="./2";){if(Fe=be.args[0],x.type.is_variable(Fe)){I.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_write_option(Fe)){I.throw_error(x.error.domain("write_option",Fe,y.indicator));return}se[Fe.id]=Fe.args[0].id==="true",be=be.args[1]}if(be.indicator!=="[]/0"){x.type.is_variable(be)?I.throw_error(x.error.instantiation(y.indicator)):I.throw_error(x.error.type("list",X,y.indicator));return}else{se.session=I.session;var lt=z.toString(se);$.stream.put(lt,$.position),typeof $.position=="number"&&($.position+=lt.length),I.success(P)}}},"halt/0":function(I,P,y){I.points=[]},"halt/1":function(I,P,y){var R=y.args[0];x.type.is_variable(R)?I.throw_error(x.error.instantiation(y.indicator)):x.type.is_integer(R)?I.points=[]:I.throw_error(x.error.type("integer",R,y.indicator))},"current_prolog_flag/2":function(I,P,y){var R=y.args[0],z=y.args[1];if(!x.type.is_variable(R)&&!x.type.is_atom(R))I.throw_error(x.error.type("atom",R,y.indicator));else if(!x.type.is_variable(R)&&!x.type.is_flag(R))I.throw_error(x.error.domain("prolog_flag",R,y.indicator));else{var X=[];for(var $ in x.flag)if(x.flag.hasOwnProperty($)){var se=new q(",",[new q("=",[new q($),R]),new q("=",[I.get_flag($),z])]);X.push(new ke(P.goal.replace(se),P.substitution,P))}I.prepend(X)}},"set_prolog_flag/2":function(I,P,y){var R=y.args[0],z=y.args[1];x.type.is_variable(R)||x.type.is_variable(z)?I.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(R)?x.type.is_flag(R)?x.type.is_value_flag(R,z)?x.type.is_modifiable_flag(R)?(I.session.flag[R.id]=z,I.success(P)):I.throw_error(x.error.permission("modify","flag",R)):I.throw_error(x.error.domain("flag_value",new q("+",[R,z]),y.indicator)):I.throw_error(x.error.domain("prolog_flag",R,y.indicator)):I.throw_error(x.error.type("atom",R,y.indicator))}},flag:{bounded:{allowed:[new q("true"),new q("false")],value:new q("true"),changeable:!1},max_integer:{allowed:[new Re(Number.MAX_SAFE_INTEGER)],value:new Re(Number.MAX_SAFE_INTEGER),changeable:!1},min_integer:{allowed:[new Re(Number.MIN_SAFE_INTEGER)],value:new Re(Number.MIN_SAFE_INTEGER),changeable:!1},integer_rounding_function:{allowed:[new q("down"),new q("toward_zero")],value:new q("toward_zero"),changeable:!1},char_conversion:{allowed:[new q("on"),new q("off")],value:new q("on"),changeable:!0},debug:{allowed:[new q("on"),new q("off")],value:new q("off"),changeable:!0},max_arity:{allowed:[new q("unbounded")],value:new q("unbounded"),changeable:!1},unknown:{allowed:[new q("error"),new q("fail"),new q("warning")],value:new q("error"),changeable:!0},double_quotes:{allowed:[new q("chars"),new q("codes"),new q("atom")],value:new q("codes"),changeable:!0},occurs_check:{allowed:[new q("false"),new q("true")],value:new q("false"),changeable:!0},dialect:{allowed:[new q("tau")],value:new q("tau"),changeable:!1},version_data:{allowed:[new q("tau",[new Re(t.major,!1),new Re(t.minor,!1),new Re(t.patch,!1),new q(t.status)])],value:new q("tau",[new Re(t.major,!1),new Re(t.minor,!1),new Re(t.patch,!1),new q(t.status)]),changeable:!1},nodejs:{allowed:[new q("yes"),new q("no")],value:new q(typeof El<"u"&&El.exports?"yes":"no"),changeable:!1}},unify:function(I,P,y){y=y===void 0?!1:y;for(var R=[{left:I,right:P}],z={};R.length!==0;){var X=R.pop();if(I=X.left,P=X.right,x.type.is_term(I)&&x.type.is_term(P)){if(I.indicator!==P.indicator)return null;for(var $=0;$z.value?1:0:z}else return R},operate:function(I,P){if(x.type.is_operator(P)){for(var y=x.type.is_operator(P),R=[],z,X=!1,$=0;$I.get_flag("max_integer").value||z0?I.start+I.matches[0].length:I.start,z=y?new q("token_not_found"):new q("found",[new q(I.value.toString())]),X=new q(".",[new q("line",[new Re(I.line+1)]),new q(".",[new q("column",[new Re(R+1)]),new q(".",[z,new q("[]",[])])])]);return new q("error",[new q("syntax_error",[new q(P)]),X])},syntax_by_predicate:function(I,P){return new q("error",[new q("syntax_error",[new q(I)]),Z(P)])}},warning:{singleton:function(I,P,y){for(var R=new q("[]"),z=I.length-1;z>=0;z--)R=new q(".",[new Se(I[z]),R]);return new q("warning",[new q("singleton_variables",[R,Z(P)]),new q(".",[new q("line",[new Re(y,!1)]),new q("[]")])])},failed_goal:function(I,P){return new q("warning",[new q("failed_goal",[I]),new q(".",[new q("line",[new Re(P,!1)]),new q("[]")])])}},format_variable:function(I){return"_"+I},format_answer:function(I,P,R){P instanceof xe&&(P=P.thread);var R=R||{};if(R.session=P?P.session:void 0,x.type.is_error(I))return"uncaught exception: "+I.args[0].toString();if(I===!1)return"false.";if(I===null)return"limit exceeded ;";var z=0,X="";if(x.type.is_substitution(I)){var $=I.domain(!0);I=I.filter(function(Fe,lt){return!x.type.is_variable(lt)||$.indexOf(lt.id)!==-1&&Fe!==lt.id})}for(var se in I.links)I.links.hasOwnProperty(se)&&(z++,X!==""&&(X+=", "),X+=se.toString(R)+" = "+I.links[se].toString(R));var be=typeof P>"u"||P.points.length>0?" ;":".";return z===0?"true"+be:X+be},flatten_error:function(I){if(!x.type.is_error(I))return null;I=I.args[0];var P={};return P.type=I.args[0].id,P.thrown=P.type==="syntax_error"?null:I.args[1].id,P.expected=null,P.found=null,P.representation=null,P.existence=null,P.existence_type=null,P.line=null,P.column=null,P.permission_operation=null,P.permission_type=null,P.evaluation_type=null,P.type==="type_error"||P.type==="domain_error"?(P.expected=I.args[0].args[0].id,P.found=I.args[0].args[1].toString()):P.type==="syntax_error"?I.args[1].indicator==="./2"?(P.expected=I.args[0].args[0].id,P.found=I.args[1].args[1].args[1].args[0],P.found=P.found.id==="token_not_found"?P.found.id:P.found.args[0].id,P.line=I.args[1].args[0].args[0].value,P.column=I.args[1].args[1].args[0].args[0].value):P.thrown=I.args[1].id:P.type==="permission_error"?(P.found=I.args[0].args[2].toString(),P.permission_operation=I.args[0].args[0].id,P.permission_type=I.args[0].args[1].id):P.type==="evaluation_error"?P.evaluation_type=I.args[0].args[0].id:P.type==="representation_error"?P.representation=I.args[0].args[0].id:P.type==="existence_error"&&(P.existence=I.args[0].args[1].toString(),P.existence_type=I.args[0].args[0].id),P},create:function(I){return new x.type.Session(I)}};typeof El<"u"?El.exports=x:window.pl=x})()});function Vme(t,e,r){t.prepend(r.map(o=>new Oa.default.type.State(e.goal.replace(o),e.substitution,e)))}function n6(t){let e=Jme.get(t.session);if(e==null)throw new Error("Assertion failed: A project should have been registered for the active session");return e}function zme(t,e){Jme.set(t,e),t.consult(`:- use_module(library(${Wgt.id})).`)}var i6,Oa,Kme,Nh,jgt,Ggt,Jme,Wgt,Xme=It(()=>{Ve();i6=et(L2()),Oa=et(r6()),Kme=et(ve("vm")),{is_atom:Nh,is_variable:jgt,is_instantiated_list:Ggt}=Oa.default.type;Jme=new WeakMap;Wgt=new Oa.default.type.Module("constraints",{"project_workspaces_by_descriptor/3":(t,e,r)=>{let[o,a,n]=r.args;if(!Nh(o)||!Nh(a)){t.throw_error(Oa.default.error.instantiation(r.indicator));return}let u=G.parseIdent(o.id),A=G.makeDescriptor(u,a.id),h=n6(t).tryWorkspaceByDescriptor(A);jgt(n)&&h!==null&&Vme(t,e,[new Oa.default.type.Term("=",[n,new Oa.default.type.Term(String(h.relativeCwd))])]),Nh(n)&&h!==null&&h.relativeCwd===n.id&&t.success(e)},"workspace_field/3":(t,e,r)=>{let[o,a,n]=r.args;if(!Nh(o)||!Nh(a)){t.throw_error(Oa.default.error.instantiation(r.indicator));return}let A=n6(t).tryWorkspaceByCwd(o.id);if(A==null)return;let p=(0,i6.default)(A.manifest.raw,a.id);typeof p>"u"||Vme(t,e,[new Oa.default.type.Term("=",[n,new Oa.default.type.Term(typeof p=="object"?JSON.stringify(p):p)])])},"workspace_field_test/3":(t,e,r)=>{let[o,a,n]=r.args;t.prepend([new Oa.default.type.State(e.goal.replace(new Oa.default.type.Term("workspace_field_test",[o,a,n,new Oa.default.type.Term("[]",[])])),e.substitution,e)])},"workspace_field_test/4":(t,e,r)=>{let[o,a,n,u]=r.args;if(!Nh(o)||!Nh(a)||!Nh(n)||!Ggt(u)){t.throw_error(Oa.default.error.instantiation(r.indicator));return}let p=n6(t).tryWorkspaceByCwd(o.id);if(p==null)return;let h=(0,i6.default)(p.manifest.raw,a.id);if(typeof h>"u")return;let E={$$:h};for(let[D,b]of u.toJavaScript().entries())E[`$${D}`]=b;Kme.default.runInNewContext(n.id,E)&&t.success(e)}},["project_workspaces_by_descriptor/3","workspace_field/3","workspace_field_test/3","workspace_field_test/4"])});var Y2={};Vt(Y2,{Constraints:()=>o6,DependencyType:()=>tye});function Ks(t){if(t instanceof rC.default.type.Num)return t.value;if(t instanceof rC.default.type.Term)switch(t.indicator){case"throw/1":return Ks(t.args[0]);case"error/1":return Ks(t.args[0]);case"error/2":if(t.args[0]instanceof rC.default.type.Term&&t.args[0].indicator==="syntax_error/1")return Object.assign(Ks(t.args[0]),...Ks(t.args[1]));{let e=Ks(t.args[0]);return e.message+=` (in ${Ks(t.args[1])})`,e}case"syntax_error/1":return new Jt(43,`Syntax error: ${Ks(t.args[0])}`);case"existence_error/2":return new Jt(44,`Existence error: ${Ks(t.args[0])} ${Ks(t.args[1])} not found`);case"instantiation_error/0":return new Jt(75,"Instantiation error: an argument is variable when an instantiated argument was expected");case"line/1":return{line:Ks(t.args[0])};case"column/1":return{column:Ks(t.args[0])};case"found/1":return{found:Ks(t.args[0])};case"./2":return[Ks(t.args[0])].concat(Ks(t.args[1]));case"//2":return`${Ks(t.args[0])}/${Ks(t.args[1])}`;default:return t.id}throw`couldn't pretty print because of unsupported node ${t}`}function $me(t){let e;try{e=Ks(t)}catch(r){throw typeof r=="string"?new Jt(42,`Unknown error: ${t} (note: ${r})`):r}return typeof e.line<"u"&&typeof e.column<"u"&&(e.message+=` at line ${e.line}, column ${e.column}`),e}function Zg(t){return t.id==="null"?null:`${t.toJavaScript()}`}function Ygt(t){if(t.id==="null")return null;{let e=t.toJavaScript();if(typeof e!="string")return JSON.stringify(e);try{return JSON.stringify(JSON.parse(e))}catch{return JSON.stringify(e)}}}function Oh(t){return typeof t=="string"?`'${t}'`:"[]"}var eye,rC,tye,Zme,s6,o6,V2=It(()=>{Ve();Ve();St();eye=et(Qme()),rC=et(r6());j2();Xme();(0,eye.default)(rC.default);tye=(o=>(o.Dependencies="dependencies",o.DevDependencies="devDependencies",o.PeerDependencies="peerDependencies",o))(tye||{}),Zme=["dependencies","devDependencies","peerDependencies"];s6=class{constructor(e,r){let o=1e3*e.workspaces.length;this.session=rC.default.create(o),zme(this.session,e),this.session.consult(":- use_module(library(lists))."),this.session.consult(r)}fetchNextAnswer(){return new Promise(e=>{this.session.answer(r=>{e(r)})})}async*makeQuery(e){let r=this.session.query(e);if(r!==!0)throw $me(r);for(;;){let o=await this.fetchNextAnswer();if(o===null)throw new Jt(79,"Resolution limit exceeded");if(!o)break;if(o.id==="throw")throw $me(o);yield o}}};o6=class t{constructor(e){this.source="";this.project=e;let r=e.configuration.get("constraintsPath");ae.existsSync(r)&&(this.source=ae.readFileSync(r,"utf8"))}static async find(e){return new t(e)}getProjectDatabase(){let e="";for(let r of Zme)e+=`dependency_type(${r}). -`;for(let r of this.project.workspacesByCwd.values()){let o=r.relativeCwd;e+=`workspace(${Oh(o)}). -`,e+=`workspace_ident(${Oh(o)}, ${Oh(G.stringifyIdent(r.anchoredLocator))}). -`,e+=`workspace_version(${Oh(o)}, ${Oh(r.manifest.version)}). -`;for(let a of Zme)for(let n of r.manifest[a].values())e+=`workspace_has_dependency(${Oh(o)}, ${Oh(G.stringifyIdent(n))}, ${Oh(n.range)}, ${a}). -`}return e+=`workspace(_) :- false. -`,e+=`workspace_ident(_, _) :- false. -`,e+=`workspace_version(_, _) :- false. -`,e+=`workspace_has_dependency(_, _, _, _) :- false. -`,e}getDeclarations(){let e="";return e+=`gen_enforced_dependency(_, _, _, _) :- false. -`,e+=`gen_enforced_field(_, _, _) :- false. -`,e}get fullSource(){return`${this.getProjectDatabase()} -${this.source} -${this.getDeclarations()}`}createSession(){return new s6(this.project,this.fullSource)}async processClassic(){let e=this.createSession();return{enforcedDependencies:await this.genEnforcedDependencies(e),enforcedFields:await this.genEnforcedFields(e)}}async process(){let{enforcedDependencies:e,enforcedFields:r}=await this.processClassic(),o=new Map;for(let{workspace:a,dependencyIdent:n,dependencyRange:u,dependencyType:A}of e){let p=q2([A,G.stringifyIdent(n)]),h=qe.getMapWithDefault(o,a.cwd);qe.getMapWithDefault(h,p).set(u??void 0,new Set)}for(let{workspace:a,fieldPath:n,fieldValue:u}of r){let A=q2(n),p=qe.getMapWithDefault(o,a.cwd);qe.getMapWithDefault(p,A).set(JSON.parse(u)??void 0,new Set)}return{manifestUpdates:o,reportedErrors:new Map}}async genEnforcedDependencies(e){let r=[];for await(let o of e.makeQuery("workspace(WorkspaceCwd), dependency_type(DependencyType), gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType).")){let a=V.resolve(this.project.cwd,Zg(o.links.WorkspaceCwd)),n=Zg(o.links.DependencyIdent),u=Zg(o.links.DependencyRange),A=Zg(o.links.DependencyType);if(a===null||n===null)throw new Error("Invalid rule");let p=this.project.getWorkspaceByCwd(a),h=G.parseIdent(n);r.push({workspace:p,dependencyIdent:h,dependencyRange:u,dependencyType:A})}return qe.sortMap(r,[({dependencyRange:o})=>o!==null?"0":"1",({workspace:o})=>G.stringifyIdent(o.anchoredLocator),({dependencyIdent:o})=>G.stringifyIdent(o)])}async genEnforcedFields(e){let r=[];for await(let o of e.makeQuery("workspace(WorkspaceCwd), gen_enforced_field(WorkspaceCwd, FieldPath, FieldValue).")){let a=V.resolve(this.project.cwd,Zg(o.links.WorkspaceCwd)),n=Zg(o.links.FieldPath),u=Ygt(o.links.FieldValue);if(a===null||n===null)throw new Error("Invalid rule");let A=this.project.getWorkspaceByCwd(a);r.push({workspace:A,fieldPath:n,fieldValue:u})}return qe.sortMap(r,[({workspace:o})=>G.stringifyIdent(o.anchoredLocator),({fieldPath:o})=>o])}async*query(e){let r=this.createSession();for await(let o of r.makeQuery(e)){let a={};for(let[n,u]of Object.entries(o.links))n!=="_"&&(a[n]=Zg(u));yield a}}}});var uye=_(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});function lB(t){let e=[...t.caches],r=e.shift();return r===void 0?cye():{get(o,a,n={miss:()=>Promise.resolve()}){return r.get(o,a,n).catch(()=>lB({caches:e}).get(o,a,n))},set(o,a){return r.set(o,a).catch(()=>lB({caches:e}).set(o,a))},delete(o){return r.delete(o).catch(()=>lB({caches:e}).delete(o))},clear(){return r.clear().catch(()=>lB({caches:e}).clear())}}}function cye(){return{get(t,e,r={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}tQ.createFallbackableCache=lB;tQ.createNullCache=cye});var fye=_((pYt,Aye)=>{Aye.exports=uye()});var pye=_(C6=>{"use strict";Object.defineProperty(C6,"__esModule",{value:!0});function Adt(t={serializable:!0}){let e={};return{get(r,o,a={miss:()=>Promise.resolve()}){let n=JSON.stringify(r);if(n in e)return Promise.resolve(t.serializable?JSON.parse(e[n]):e[n]);let u=o(),A=a&&a.miss||(()=>Promise.resolve());return u.then(p=>A(p)).then(()=>u)},set(r,o){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(o):o,Promise.resolve(o)},delete(r){return delete e[JSON.stringify(r)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}C6.createInMemoryCache=Adt});var gye=_((gYt,hye)=>{hye.exports=pye()});var mye=_(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});function fdt(t,e,r){let o={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers(){return t===I6.WithinHeaders?o:{}},queryParameters(){return t===I6.WithinQueryParameters?o:{}}}}function pdt(t){let e=0,r=()=>(e++,new Promise(o=>{setTimeout(()=>{o(t(r))},Math.min(100*e,1e3))}));return t(r)}function dye(t,e=(r,o)=>Promise.resolve()){return Object.assign(t,{wait(r){return dye(t.then(o=>Promise.all([e(o,r),o])).then(o=>o[1]))}})}function hdt(t){let e=t.length-1;for(e;e>0;e--){let r=Math.floor(Math.random()*(e+1)),o=t[e];t[e]=t[r],t[r]=o}return t}function gdt(t,e){return e&&Object.keys(e).forEach(r=>{t[r]=e[r](t)}),t}function ddt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}var mdt="4.22.1",ydt=t=>()=>t.transporter.requester.destroy(),I6={WithinQueryParameters:0,WithinHeaders:1};su.AuthMode=I6;su.addMethods=gdt;su.createAuth=fdt;su.createRetryablePromise=pdt;su.createWaitablePromise=dye;su.destroy=ydt;su.encode=ddt;su.shuffle=hdt;su.version=mdt});var cB=_((mYt,yye)=>{yye.exports=mye()});var Eye=_(w6=>{"use strict";Object.defineProperty(w6,"__esModule",{value:!0});var Edt={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};w6.MethodEnum=Edt});var uB=_((EYt,Cye)=>{Cye.exports=Eye()});var Lye=_(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});var wye=uB();function B6(t,e){let r=t||{},o=r.data||{};return Object.keys(r).forEach(a=>{["timeout","headers","queryParameters","data","cacheable"].indexOf(a)===-1&&(o[a]=r[a])}),{data:Object.entries(o).length>0?o:void 0,timeout:r.timeout||e,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var AB={Read:1,Write:2,Any:3},fC={Up:1,Down:2,Timeouted:3},Bye=2*60*1e3;function D6(t,e=fC.Up){return{...t,status:e,lastUpdate:Date.now()}}function vye(t){return t.status===fC.Up||Date.now()-t.lastUpdate>Bye}function Dye(t){return t.status===fC.Timeouted&&Date.now()-t.lastUpdate<=Bye}function S6(t){return typeof t=="string"?{protocol:"https",url:t,accept:AB.Any}:{protocol:t.protocol||"https",url:t.url,accept:t.accept||AB.Any}}function Cdt(t,e){return Promise.all(e.map(r=>t.get(r,()=>Promise.resolve(D6(r))))).then(r=>{let o=r.filter(A=>vye(A)),a=r.filter(A=>Dye(A)),n=[...o,...a],u=n.length>0?n.map(A=>S6(A)):e;return{getTimeout(A,p){return(a.length===0&&A===0?1:a.length+3+A)*p},statelessHosts:u}})}var Idt=({isTimedOut:t,status:e})=>!t&&~~e===0,wdt=t=>{let e=t.status;return t.isTimedOut||Idt(t)||~~(e/100)!==2&&~~(e/100)!==4},Bdt=({status:t})=>~~(t/100)===2,vdt=(t,e)=>wdt(t)?e.onRetry(t):Bdt(t)?e.onSuccess(t):e.onFail(t);function Iye(t,e,r,o){let a=[],n=kye(r,o),u=Qye(t,o),A=r.method,p=r.method!==wye.MethodEnum.Get?{}:{...r.data,...o.data},h={"x-algolia-agent":t.userAgent.value,...t.queryParameters,...p,...o.queryParameters},E=0,w=(D,b)=>{let C=D.pop();if(C===void 0)throw Tye(v6(a));let T={data:n,headers:u,method:A,url:xye(C,r.path,h),connectTimeout:b(E,t.timeouts.connect),responseTimeout:b(E,o.timeout)},N=J=>{let te={request:T,response:J,host:C,triesLeft:D.length};return a.push(te),te},U={onSuccess:J=>Sye(J),onRetry(J){let te=N(J);return J.isTimedOut&&E++,Promise.all([t.logger.info("Retryable failure",P6(te)),t.hostsCache.set(C,D6(C,J.isTimedOut?fC.Timeouted:fC.Down))]).then(()=>w(D,b))},onFail(J){throw N(J),Pye(J,v6(a))}};return t.requester.send(T).then(J=>vdt(J,U))};return Cdt(t.hostsCache,e).then(D=>w([...D.statelessHosts].reverse(),D.getTimeout))}function Ddt(t){let{hostsCache:e,logger:r,requester:o,requestsCache:a,responsesCache:n,timeouts:u,userAgent:A,hosts:p,queryParameters:h,headers:E}=t,w={hostsCache:e,logger:r,requester:o,requestsCache:a,responsesCache:n,timeouts:u,userAgent:A,headers:E,queryParameters:h,hosts:p.map(D=>S6(D)),read(D,b){let C=B6(b,w.timeouts.read),T=()=>Iye(w,w.hosts.filter(J=>(J.accept&AB.Read)!==0),D,C);if((C.cacheable!==void 0?C.cacheable:D.cacheable)!==!0)return T();let U={request:D,mappedRequestOptions:C,transporter:{queryParameters:w.queryParameters,headers:w.headers}};return w.responsesCache.get(U,()=>w.requestsCache.get(U,()=>w.requestsCache.set(U,T()).then(J=>Promise.all([w.requestsCache.delete(U),J]),J=>Promise.all([w.requestsCache.delete(U),Promise.reject(J)])).then(([J,te])=>te)),{miss:J=>w.responsesCache.set(U,J)})},write(D,b){return Iye(w,w.hosts.filter(C=>(C.accept&AB.Write)!==0),D,B6(b,w.timeouts.write))}};return w}function Sdt(t){let e={value:`Algolia for JavaScript (${t})`,add(r){let o=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return e.value.indexOf(o)===-1&&(e.value=`${e.value}${o}`),e}};return e}function Sye(t){try{return JSON.parse(t.content)}catch(e){throw Rye(e.message,t)}}function Pye({content:t,status:e},r){let o=t;try{o=JSON.parse(t).message}catch{}return Fye(o,e,r)}function Pdt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}function xye(t,e,r){let o=bye(r),a=`${t.protocol}://${t.url}/${e.charAt(0)==="/"?e.substr(1):e}`;return o.length&&(a+=`?${o}`),a}function bye(t){let e=r=>Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Array]";return Object.keys(t).map(r=>Pdt("%s=%s",r,e(t[r])?JSON.stringify(t[r]):t[r])).join("&")}function kye(t,e){if(t.method===wye.MethodEnum.Get||t.data===void 0&&e.data===void 0)return;let r=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(r)}function Qye(t,e){let r={...t.headers,...e.headers},o={};return Object.keys(r).forEach(a=>{let n=r[a];o[a.toLowerCase()]=n}),o}function v6(t){return t.map(e=>P6(e))}function P6(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Fye(t,e,r){return{name:"ApiError",message:t,status:e,transporterStackTrace:r}}function Rye(t,e){return{name:"DeserializationError",message:t,response:e}}function Tye(t){return{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:t}}Ti.CallEnum=AB;Ti.HostStatusEnum=fC;Ti.createApiError=Fye;Ti.createDeserializationError=Rye;Ti.createMappedRequestOptions=B6;Ti.createRetryError=Tye;Ti.createStatefulHost=D6;Ti.createStatelessHost=S6;Ti.createTransporter=Ddt;Ti.createUserAgent=Sdt;Ti.deserializeFailure=Pye;Ti.deserializeSuccess=Sye;Ti.isStatefulHostTimeouted=Dye;Ti.isStatefulHostUp=vye;Ti.serializeData=kye;Ti.serializeHeaders=Qye;Ti.serializeQueryParameters=bye;Ti.serializeUrl=xye;Ti.stackFrameWithoutCredentials=P6;Ti.stackTraceWithoutCredentials=v6});var fB=_((IYt,Nye)=>{Nye.exports=Lye()});var Oye=_(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});var pC=cB(),xdt=fB(),pB=uB(),bdt=t=>{let e=t.region||"us",r=pC.createAuth(pC.AuthMode.WithinHeaders,t.appId,t.apiKey),o=xdt.createTransporter({hosts:[{url:`analytics.${e}.algolia.com`}],...t,headers:{...r.headers(),"content-type":"application/json",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}}),a=t.appId;return pC.addMethods({appId:a,transporter:o},t.methods)},kdt=t=>(e,r)=>t.transporter.write({method:pB.MethodEnum.Post,path:"2/abtests",data:e},r),Qdt=t=>(e,r)=>t.transporter.write({method:pB.MethodEnum.Delete,path:pC.encode("2/abtests/%s",e)},r),Fdt=t=>(e,r)=>t.transporter.read({method:pB.MethodEnum.Get,path:pC.encode("2/abtests/%s",e)},r),Rdt=t=>e=>t.transporter.read({method:pB.MethodEnum.Get,path:"2/abtests"},e),Tdt=t=>(e,r)=>t.transporter.write({method:pB.MethodEnum.Post,path:pC.encode("2/abtests/%s/stop",e)},r);Mh.addABTest=kdt;Mh.createAnalyticsClient=bdt;Mh.deleteABTest=Qdt;Mh.getABTest=Fdt;Mh.getABTests=Rdt;Mh.stopABTest=Tdt});var Uye=_((BYt,Mye)=>{Mye.exports=Oye()});var Hye=_(hB=>{"use strict";Object.defineProperty(hB,"__esModule",{value:!0});var x6=cB(),Ldt=fB(),_ye=uB(),Ndt=t=>{let e=t.region||"us",r=x6.createAuth(x6.AuthMode.WithinHeaders,t.appId,t.apiKey),o=Ldt.createTransporter({hosts:[{url:`personalization.${e}.algolia.com`}],...t,headers:{...r.headers(),"content-type":"application/json",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}});return x6.addMethods({appId:t.appId,transporter:o},t.methods)},Odt=t=>e=>t.transporter.read({method:_ye.MethodEnum.Get,path:"1/strategies/personalization"},e),Mdt=t=>(e,r)=>t.transporter.write({method:_ye.MethodEnum.Post,path:"1/strategies/personalization",data:e},r);hB.createPersonalizationClient=Ndt;hB.getPersonalizationStrategy=Odt;hB.setPersonalizationStrategy=Mdt});var jye=_((DYt,qye)=>{qye.exports=Hye()});var nEe=_(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});var Wt=cB(),Ma=fB(),Dr=uB(),Udt=ve("crypto");function rQ(t){let e=r=>t.request(r).then(o=>{if(t.batch!==void 0&&t.batch(o.hits),!t.shouldStop(o))return o.cursor?e({cursor:o.cursor}):e({page:(r.page||0)+1})});return e({})}var _dt=t=>{let e=t.appId,r=Wt.createAuth(t.authMode!==void 0?t.authMode:Wt.AuthMode.WithinHeaders,e,t.apiKey),o=Ma.createTransporter({hosts:[{url:`${e}-dsn.algolia.net`,accept:Ma.CallEnum.Read},{url:`${e}.algolia.net`,accept:Ma.CallEnum.Write}].concat(Wt.shuffle([{url:`${e}-1.algolianet.com`},{url:`${e}-2.algolianet.com`},{url:`${e}-3.algolianet.com`}])),...t,headers:{...r.headers(),"content-type":"application/x-www-form-urlencoded",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}}),a={transporter:o,appId:e,addAlgoliaAgent(n,u){o.userAgent.add({segment:n,version:u})},clearCache(){return Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then(()=>{})}};return Wt.addMethods(a,t.methods)};function Gye(){return{name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}}function Wye(){return{name:"ObjectNotFoundError",message:"Object not found."}}function Yye(){return{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."}}var Hdt=t=>(e,r)=>{let{queryParameters:o,...a}=r||{},n={acl:e,...o!==void 0?{queryParameters:o}:{}},u=(A,p)=>Wt.createRetryablePromise(h=>gB(t)(A.key,p).catch(E=>{if(E.status!==404)throw E;return h()}));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:"1/keys",data:n},a),u)},qdt=t=>(e,r,o)=>{let a=Ma.createMappedRequestOptions(o);return a.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:Dr.MethodEnum.Post,path:"1/clusters/mapping",data:{cluster:r}},a)},jdt=t=>(e,r,o)=>t.transporter.write({method:Dr.MethodEnum.Post,path:"1/clusters/mapping/batch",data:{users:e,cluster:r}},o),Gdt=t=>(e,r)=>Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(o,a)=>hC(t)(o.taskID,a)),nQ=t=>(e,r,o)=>{let a=(n,u)=>dB(t)(e,{methods:{waitTask:es}}).waitTask(n.taskID,u);return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/operation",e),data:{operation:"copy",destination:r}},o),a)},Wdt=t=>(e,r,o)=>nQ(t)(e,r,{...o,scope:[sQ.Rules]}),Ydt=t=>(e,r,o)=>nQ(t)(e,r,{...o,scope:[sQ.Settings]}),Vdt=t=>(e,r,o)=>nQ(t)(e,r,{...o,scope:[sQ.Synonyms]}),Kdt=t=>(e,r)=>e.method===Dr.MethodEnum.Get?t.transporter.read(e,r):t.transporter.write(e,r),Jdt=t=>(e,r)=>{let o=(a,n)=>Wt.createRetryablePromise(u=>gB(t)(e,n).then(u).catch(A=>{if(A.status!==404)throw A}));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Delete,path:Wt.encode("1/keys/%s",e)},r),o)},zdt=t=>(e,r,o)=>{let a=r.map(n=>({action:"deleteEntry",body:{objectID:n}}));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},o),(n,u)=>hC(t)(n.taskID,u))},Xdt=()=>(t,e)=>{let r=Ma.serializeQueryParameters(e),o=Udt.createHmac("sha256",t).update(r).digest("hex");return Buffer.from(o+r).toString("base64")},gB=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/keys/%s",e)},r),Vye=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/task/%s",e.toString())},r),Zdt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"/1/dictionaries/*/settings"},e),$dt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"1/logs"},e),emt=()=>t=>{let e=Buffer.from(t,"base64").toString("ascii"),r=/validUntil=(\d+)/,o=e.match(r);if(o===null)throw Yye();return parseInt(o[1],10)-Math.round(new Date().getTime()/1e3)},tmt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"1/clusters/mapping/top"},e),rmt=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/clusters/mapping/%s",e)},r),nmt=t=>e=>{let{retrieveMappings:r,...o}=e||{};return r===!0&&(o.getClusters=!0),t.transporter.read({method:Dr.MethodEnum.Get,path:"1/clusters/mapping/pending"},o)},dB=t=>(e,r={})=>{let o={transporter:t.transporter,appId:t.appId,indexName:e};return Wt.addMethods(o,r.methods)},imt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"1/keys"},e),smt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"1/clusters"},e),omt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"1/indexes"},e),amt=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:"1/clusters/mapping"},e),lmt=t=>(e,r,o)=>{let a=(n,u)=>dB(t)(e,{methods:{waitTask:es}}).waitTask(n.taskID,u);return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/operation",e),data:{operation:"move",destination:r}},o),a)},cmt=t=>(e,r)=>{let o=(a,n)=>Promise.all(Object.keys(a.taskID).map(u=>dB(t)(u,{methods:{waitTask:es}}).waitTask(a.taskID[u],n)));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:"1/indexes/*/batch",data:{requests:e}},r),o)},umt=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:e}},r),Amt=t=>(e,r)=>{let o=e.map(a=>({...a,params:Ma.serializeQueryParameters(a.params||{})}));return t.transporter.read({method:Dr.MethodEnum.Post,path:"1/indexes/*/queries",data:{requests:o},cacheable:!0},r)},fmt=t=>(e,r)=>Promise.all(e.map(o=>{let{facetName:a,facetQuery:n,...u}=o.params;return dB(t)(o.indexName,{methods:{searchForFacetValues:eEe}}).searchForFacetValues(a,n,{...r,...u})})),pmt=t=>(e,r)=>{let o=Ma.createMappedRequestOptions(r);return o.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:Dr.MethodEnum.Delete,path:"1/clusters/mapping"},o)},hmt=t=>(e,r,o)=>{let a=r.map(n=>({action:"addEntry",body:n}));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:a}},o),(n,u)=>hC(t)(n.taskID,u))},gmt=t=>(e,r)=>{let o=(a,n)=>Wt.createRetryablePromise(u=>gB(t)(e,n).catch(A=>{if(A.status!==404)throw A;return u()}));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/keys/%s/restore",e)},r),o)},dmt=t=>(e,r,o)=>{let a=r.map(n=>({action:"addEntry",body:n}));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},o),(n,u)=>hC(t)(n.taskID,u))},mmt=t=>(e,r,o)=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("/1/dictionaries/%s/search",e),data:{query:r},cacheable:!0},o),ymt=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Post,path:"1/clusters/mapping/search",data:{query:e}},r),Emt=t=>(e,r)=>Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Put,path:"/1/dictionaries/*/settings",data:e},r),(o,a)=>hC(t)(o.taskID,a)),Cmt=t=>(e,r)=>{let o=Object.assign({},r),{queryParameters:a,...n}=r||{},u=a?{queryParameters:a}:{},A=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"],p=E=>Object.keys(o).filter(w=>A.indexOf(w)!==-1).every(w=>{if(Array.isArray(E[w])&&Array.isArray(o[w])){let D=E[w];return D.length===o[w].length&&D.every((b,C)=>b===o[w][C])}else return E[w]===o[w]}),h=(E,w)=>Wt.createRetryablePromise(D=>gB(t)(e,w).then(b=>p(b)?Promise.resolve():D()));return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Put,path:Wt.encode("1/keys/%s",e),data:u},n),h)},hC=t=>(e,r)=>Wt.createRetryablePromise(o=>Vye(t)(e,r).then(a=>a.status!=="published"?o():void 0)),Kye=t=>(e,r)=>{let o=(a,n)=>es(t)(a.taskID,n);return Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/batch",t.indexName),data:{requests:e}},r),o)},Imt=t=>e=>rQ({shouldStop:r=>r.cursor===void 0,...e,request:r=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/browse",t.indexName),data:r},e)}),wmt=t=>e=>{let r={hitsPerPage:1e3,...e};return rQ({shouldStop:o=>o.hits.length({...a,hits:a.hits.map(n=>(delete n._highlightResult,n))}))}})},Bmt=t=>e=>{let r={hitsPerPage:1e3,...e};return rQ({shouldStop:o=>o.hits.length({...a,hits:a.hits.map(n=>(delete n._highlightResult,n))}))}})},iQ=t=>(e,r,o)=>{let{batchSize:a,...n}=o||{},u={taskIDs:[],objectIDs:[]},A=(p=0)=>{let h=[],E;for(E=p;E({action:r,body:w})),n).then(w=>(u.objectIDs=u.objectIDs.concat(w.objectIDs),u.taskIDs.push(w.taskID),E++,A(E)))};return Wt.createWaitablePromise(A(),(p,h)=>Promise.all(p.taskIDs.map(E=>es(t)(E,h))))},vmt=t=>e=>Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/clear",t.indexName)},e),(r,o)=>es(t)(r.taskID,o)),Dmt=t=>e=>{let{forwardToReplicas:r,...o}=e||{},a=Ma.createMappedRequestOptions(o);return r&&(a.queryParameters.forwardToReplicas=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/rules/clear",t.indexName)},a),(n,u)=>es(t)(n.taskID,u))},Smt=t=>e=>{let{forwardToReplicas:r,...o}=e||{},a=Ma.createMappedRequestOptions(o);return r&&(a.queryParameters.forwardToReplicas=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/synonyms/clear",t.indexName)},a),(n,u)=>es(t)(n.taskID,u))},Pmt=t=>(e,r)=>Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/deleteByQuery",t.indexName),data:e},r),(o,a)=>es(t)(o.taskID,a)),xmt=t=>e=>Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Delete,path:Wt.encode("1/indexes/%s",t.indexName)},e),(r,o)=>es(t)(r.taskID,o)),bmt=t=>(e,r)=>Wt.createWaitablePromise(Jye(t)([e],r).then(o=>({taskID:o.taskIDs[0]})),(o,a)=>es(t)(o.taskID,a)),Jye=t=>(e,r)=>{let o=e.map(a=>({objectID:a}));return iQ(t)(o,ed.DeleteObject,r)},kmt=t=>(e,r)=>{let{forwardToReplicas:o,...a}=r||{},n=Ma.createMappedRequestOptions(a);return o&&(n.queryParameters.forwardToReplicas=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Delete,path:Wt.encode("1/indexes/%s/rules/%s",t.indexName,e)},n),(u,A)=>es(t)(u.taskID,A))},Qmt=t=>(e,r)=>{let{forwardToReplicas:o,...a}=r||{},n=Ma.createMappedRequestOptions(a);return o&&(n.queryParameters.forwardToReplicas=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Delete,path:Wt.encode("1/indexes/%s/synonyms/%s",t.indexName,e)},n),(u,A)=>es(t)(u.taskID,A))},Fmt=t=>e=>zye(t)(e).then(()=>!0).catch(r=>{if(r.status!==404)throw r;return!1}),Rmt=t=>(e,r,o)=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("1/answers/%s/prediction",t.indexName),data:{query:e,queryLanguages:r},cacheable:!0},o),Tmt=t=>(e,r)=>{let{query:o,paginate:a,...n}=r||{},u=0,A=()=>$ye(t)(o||"",{...n,page:u}).then(p=>{for(let[h,E]of Object.entries(p.hits))if(e(E))return{object:E,position:parseInt(h,10),page:u};if(u++,a===!1||u>=p.nbPages)throw Wye();return A()});return A()},Lmt=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/indexes/%s/%s",t.indexName,e)},r),Nmt=()=>(t,e)=>{for(let[r,o]of Object.entries(t.hits))if(o.objectID===e)return parseInt(r,10);return-1},Omt=t=>(e,r)=>{let{attributesToRetrieve:o,...a}=r||{},n=e.map(u=>({indexName:t.indexName,objectID:u,...o?{attributesToRetrieve:o}:{}}));return t.transporter.read({method:Dr.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:n}},a)},Mmt=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/indexes/%s/rules/%s",t.indexName,e)},r),zye=t=>e=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/indexes/%s/settings",t.indexName),data:{getVersion:2}},e),Umt=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/indexes/%s/synonyms/%s",t.indexName,e)},r),Xye=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Get,path:Wt.encode("1/indexes/%s/task/%s",t.indexName,e.toString())},r),_mt=t=>(e,r)=>Wt.createWaitablePromise(Zye(t)([e],r).then(o=>({objectID:o.objectIDs[0],taskID:o.taskIDs[0]})),(o,a)=>es(t)(o.taskID,a)),Zye=t=>(e,r)=>{let{createIfNotExists:o,...a}=r||{},n=o?ed.PartialUpdateObject:ed.PartialUpdateObjectNoCreate;return iQ(t)(e,n,a)},Hmt=t=>(e,r)=>{let{safe:o,autoGenerateObjectIDIfNotExist:a,batchSize:n,...u}=r||{},A=(C,T,N,U)=>Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/operation",C),data:{operation:N,destination:T}},U),(J,te)=>es(t)(J.taskID,te)),p=Math.random().toString(36).substring(7),h=`${t.indexName}_tmp_${p}`,E=b6({appId:t.appId,transporter:t.transporter,indexName:h}),w=[],D=A(t.indexName,h,"copy",{...u,scope:["settings","synonyms","rules"]});w.push(D);let b=(o?D.wait(u):D).then(()=>{let C=E(e,{...u,autoGenerateObjectIDIfNotExist:a,batchSize:n});return w.push(C),o?C.wait(u):C}).then(()=>{let C=A(h,t.indexName,"move",u);return w.push(C),o?C.wait(u):C}).then(()=>Promise.all(w)).then(([C,T,N])=>({objectIDs:T.objectIDs,taskIDs:[C.taskID,...T.taskIDs,N.taskID]}));return Wt.createWaitablePromise(b,(C,T)=>Promise.all(w.map(N=>N.wait(T))))},qmt=t=>(e,r)=>k6(t)(e,{...r,clearExistingRules:!0}),jmt=t=>(e,r)=>Q6(t)(e,{...r,clearExistingSynonyms:!0}),Gmt=t=>(e,r)=>Wt.createWaitablePromise(b6(t)([e],r).then(o=>({objectID:o.objectIDs[0],taskID:o.taskIDs[0]})),(o,a)=>es(t)(o.taskID,a)),b6=t=>(e,r)=>{let{autoGenerateObjectIDIfNotExist:o,...a}=r||{},n=o?ed.AddObject:ed.UpdateObject;if(n===ed.UpdateObject){for(let u of e)if(u.objectID===void 0)return Wt.createWaitablePromise(Promise.reject(Gye()))}return iQ(t)(e,n,a)},Wmt=t=>(e,r)=>k6(t)([e],r),k6=t=>(e,r)=>{let{forwardToReplicas:o,clearExistingRules:a,...n}=r||{},u=Ma.createMappedRequestOptions(n);return o&&(u.queryParameters.forwardToReplicas=1),a&&(u.queryParameters.clearExistingRules=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/rules/batch",t.indexName),data:e},u),(A,p)=>es(t)(A.taskID,p))},Ymt=t=>(e,r)=>Q6(t)([e],r),Q6=t=>(e,r)=>{let{forwardToReplicas:o,clearExistingSynonyms:a,replaceExistingSynonyms:n,...u}=r||{},A=Ma.createMappedRequestOptions(u);return o&&(A.queryParameters.forwardToReplicas=1),(n||a)&&(A.queryParameters.replaceExistingSynonyms=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/synonyms/batch",t.indexName),data:e},A),(p,h)=>es(t)(p.taskID,h))},$ye=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/query",t.indexName),data:{query:e},cacheable:!0},r),eEe=t=>(e,r,o)=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/facets/%s/query",t.indexName,e),data:{facetQuery:r},cacheable:!0},o),tEe=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/rules/search",t.indexName),data:{query:e}},r),rEe=t=>(e,r)=>t.transporter.read({method:Dr.MethodEnum.Post,path:Wt.encode("1/indexes/%s/synonyms/search",t.indexName),data:{query:e}},r),Vmt=t=>(e,r)=>{let{forwardToReplicas:o,...a}=r||{},n=Ma.createMappedRequestOptions(a);return o&&(n.queryParameters.forwardToReplicas=1),Wt.createWaitablePromise(t.transporter.write({method:Dr.MethodEnum.Put,path:Wt.encode("1/indexes/%s/settings",t.indexName),data:e},n),(u,A)=>es(t)(u.taskID,A))},es=t=>(e,r)=>Wt.createRetryablePromise(o=>Xye(t)(e,r).then(a=>a.status!=="published"?o():void 0)),Kmt={AddObject:"addObject",Analytics:"analytics",Browser:"browse",DeleteIndex:"deleteIndex",DeleteObject:"deleteObject",EditSettings:"editSettings",Inference:"inference",ListIndexes:"listIndexes",Logs:"logs",Personalization:"personalization",Recommendation:"recommendation",Search:"search",SeeUnretrievableAttributes:"seeUnretrievableAttributes",Settings:"settings",Usage:"usage"},ed={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},sQ={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},Jmt={None:"none",StopIfEnoughMatches:"stopIfEnoughMatches"},zmt={Synonym:"synonym",OneWaySynonym:"oneWaySynonym",AltCorrection1:"altCorrection1",AltCorrection2:"altCorrection2",Placeholder:"placeholder"};Rt.ApiKeyACLEnum=Kmt;Rt.BatchActionEnum=ed;Rt.ScopeEnum=sQ;Rt.StrategyEnum=Jmt;Rt.SynonymEnum=zmt;Rt.addApiKey=Hdt;Rt.assignUserID=qdt;Rt.assignUserIDs=jdt;Rt.batch=Kye;Rt.browseObjects=Imt;Rt.browseRules=wmt;Rt.browseSynonyms=Bmt;Rt.chunkedBatch=iQ;Rt.clearDictionaryEntries=Gdt;Rt.clearObjects=vmt;Rt.clearRules=Dmt;Rt.clearSynonyms=Smt;Rt.copyIndex=nQ;Rt.copyRules=Wdt;Rt.copySettings=Ydt;Rt.copySynonyms=Vdt;Rt.createBrowsablePromise=rQ;Rt.createMissingObjectIDError=Gye;Rt.createObjectNotFoundError=Wye;Rt.createSearchClient=_dt;Rt.createValidUntilNotFoundError=Yye;Rt.customRequest=Kdt;Rt.deleteApiKey=Jdt;Rt.deleteBy=Pmt;Rt.deleteDictionaryEntries=zdt;Rt.deleteIndex=xmt;Rt.deleteObject=bmt;Rt.deleteObjects=Jye;Rt.deleteRule=kmt;Rt.deleteSynonym=Qmt;Rt.exists=Fmt;Rt.findAnswers=Rmt;Rt.findObject=Tmt;Rt.generateSecuredApiKey=Xdt;Rt.getApiKey=gB;Rt.getAppTask=Vye;Rt.getDictionarySettings=Zdt;Rt.getLogs=$dt;Rt.getObject=Lmt;Rt.getObjectPosition=Nmt;Rt.getObjects=Omt;Rt.getRule=Mmt;Rt.getSecuredApiKeyRemainingValidity=emt;Rt.getSettings=zye;Rt.getSynonym=Umt;Rt.getTask=Xye;Rt.getTopUserIDs=tmt;Rt.getUserID=rmt;Rt.hasPendingMappings=nmt;Rt.initIndex=dB;Rt.listApiKeys=imt;Rt.listClusters=smt;Rt.listIndices=omt;Rt.listUserIDs=amt;Rt.moveIndex=lmt;Rt.multipleBatch=cmt;Rt.multipleGetObjects=umt;Rt.multipleQueries=Amt;Rt.multipleSearchForFacetValues=fmt;Rt.partialUpdateObject=_mt;Rt.partialUpdateObjects=Zye;Rt.removeUserID=pmt;Rt.replaceAllObjects=Hmt;Rt.replaceAllRules=qmt;Rt.replaceAllSynonyms=jmt;Rt.replaceDictionaryEntries=hmt;Rt.restoreApiKey=gmt;Rt.saveDictionaryEntries=dmt;Rt.saveObject=Gmt;Rt.saveObjects=b6;Rt.saveRule=Wmt;Rt.saveRules=k6;Rt.saveSynonym=Ymt;Rt.saveSynonyms=Q6;Rt.search=$ye;Rt.searchDictionaryEntries=mmt;Rt.searchForFacetValues=eEe;Rt.searchRules=tEe;Rt.searchSynonyms=rEe;Rt.searchUserIDs=ymt;Rt.setDictionarySettings=Emt;Rt.setSettings=Vmt;Rt.updateApiKey=Cmt;Rt.waitAppTask=hC;Rt.waitTask=es});var sEe=_((PYt,iEe)=>{iEe.exports=nEe()});var oEe=_(oQ=>{"use strict";Object.defineProperty(oQ,"__esModule",{value:!0});function Xmt(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var Zmt={Debug:1,Info:2,Error:3};oQ.LogLevelEnum=Zmt;oQ.createNullLogger=Xmt});var lEe=_((bYt,aEe)=>{aEe.exports=oEe()});var fEe=_(F6=>{"use strict";Object.defineProperty(F6,"__esModule",{value:!0});var cEe=ve("http"),uEe=ve("https"),$mt=ve("url"),AEe={keepAlive:!0},eyt=new cEe.Agent(AEe),tyt=new uEe.Agent(AEe);function ryt({agent:t,httpAgent:e,httpsAgent:r,requesterOptions:o={}}={}){let a=e||t||eyt,n=r||t||tyt;return{send(u){return new Promise(A=>{let p=$mt.parse(u.url),h=p.query===null?p.pathname:`${p.pathname}?${p.query}`,E={...o,agent:p.protocol==="https:"?n:a,hostname:p.hostname,path:h,method:u.method,headers:{...o&&o.headers?o.headers:{},...u.headers},...p.port!==void 0?{port:p.port||""}:{}},w=(p.protocol==="https:"?uEe:cEe).request(E,T=>{let N=[];T.on("data",U=>{N=N.concat(U)}),T.on("end",()=>{clearTimeout(b),clearTimeout(C),A({status:T.statusCode||0,content:Buffer.concat(N).toString(),isTimedOut:!1})})}),D=(T,N)=>setTimeout(()=>{w.abort(),A({status:0,content:N,isTimedOut:!0})},T*1e3),b=D(u.connectTimeout,"Connection timeout"),C;w.on("error",T=>{clearTimeout(b),clearTimeout(C),A({status:0,content:T.message,isTimedOut:!1})}),w.once("response",()=>{clearTimeout(b),C=D(u.responseTimeout,"Socket timeout")}),u.data!==void 0&&w.write(u.data),w.end()})},destroy(){return a.destroy(),n.destroy(),Promise.resolve()}}}F6.createNodeHttpRequester=ryt});var hEe=_((QYt,pEe)=>{pEe.exports=fEe()});var yEe=_((FYt,mEe)=>{"use strict";var gEe=fye(),nyt=gye(),gC=Uye(),T6=cB(),R6=jye(),Ht=sEe(),iyt=lEe(),syt=hEe(),oyt=fB();function dEe(t,e,r){let o={appId:t,apiKey:e,timeouts:{connect:2,read:5,write:30},requester:syt.createNodeHttpRequester(),logger:iyt.createNullLogger(),responsesCache:gEe.createNullCache(),requestsCache:gEe.createNullCache(),hostsCache:nyt.createInMemoryCache(),userAgent:oyt.createUserAgent(T6.version).add({segment:"Node.js",version:process.versions.node})},a={...o,...r},n=()=>u=>R6.createPersonalizationClient({...o,...u,methods:{getPersonalizationStrategy:R6.getPersonalizationStrategy,setPersonalizationStrategy:R6.setPersonalizationStrategy}});return Ht.createSearchClient({...a,methods:{search:Ht.multipleQueries,searchForFacetValues:Ht.multipleSearchForFacetValues,multipleBatch:Ht.multipleBatch,multipleGetObjects:Ht.multipleGetObjects,multipleQueries:Ht.multipleQueries,copyIndex:Ht.copyIndex,copySettings:Ht.copySettings,copyRules:Ht.copyRules,copySynonyms:Ht.copySynonyms,moveIndex:Ht.moveIndex,listIndices:Ht.listIndices,getLogs:Ht.getLogs,listClusters:Ht.listClusters,multipleSearchForFacetValues:Ht.multipleSearchForFacetValues,getApiKey:Ht.getApiKey,addApiKey:Ht.addApiKey,listApiKeys:Ht.listApiKeys,updateApiKey:Ht.updateApiKey,deleteApiKey:Ht.deleteApiKey,restoreApiKey:Ht.restoreApiKey,assignUserID:Ht.assignUserID,assignUserIDs:Ht.assignUserIDs,getUserID:Ht.getUserID,searchUserIDs:Ht.searchUserIDs,listUserIDs:Ht.listUserIDs,getTopUserIDs:Ht.getTopUserIDs,removeUserID:Ht.removeUserID,hasPendingMappings:Ht.hasPendingMappings,generateSecuredApiKey:Ht.generateSecuredApiKey,getSecuredApiKeyRemainingValidity:Ht.getSecuredApiKeyRemainingValidity,destroy:T6.destroy,clearDictionaryEntries:Ht.clearDictionaryEntries,deleteDictionaryEntries:Ht.deleteDictionaryEntries,getDictionarySettings:Ht.getDictionarySettings,getAppTask:Ht.getAppTask,replaceDictionaryEntries:Ht.replaceDictionaryEntries,saveDictionaryEntries:Ht.saveDictionaryEntries,searchDictionaryEntries:Ht.searchDictionaryEntries,setDictionarySettings:Ht.setDictionarySettings,waitAppTask:Ht.waitAppTask,customRequest:Ht.customRequest,initIndex:u=>A=>Ht.initIndex(u)(A,{methods:{batch:Ht.batch,delete:Ht.deleteIndex,findAnswers:Ht.findAnswers,getObject:Ht.getObject,getObjects:Ht.getObjects,saveObject:Ht.saveObject,saveObjects:Ht.saveObjects,search:Ht.search,searchForFacetValues:Ht.searchForFacetValues,waitTask:Ht.waitTask,setSettings:Ht.setSettings,getSettings:Ht.getSettings,partialUpdateObject:Ht.partialUpdateObject,partialUpdateObjects:Ht.partialUpdateObjects,deleteObject:Ht.deleteObject,deleteObjects:Ht.deleteObjects,deleteBy:Ht.deleteBy,clearObjects:Ht.clearObjects,browseObjects:Ht.browseObjects,getObjectPosition:Ht.getObjectPosition,findObject:Ht.findObject,exists:Ht.exists,saveSynonym:Ht.saveSynonym,saveSynonyms:Ht.saveSynonyms,getSynonym:Ht.getSynonym,searchSynonyms:Ht.searchSynonyms,browseSynonyms:Ht.browseSynonyms,deleteSynonym:Ht.deleteSynonym,clearSynonyms:Ht.clearSynonyms,replaceAllObjects:Ht.replaceAllObjects,replaceAllSynonyms:Ht.replaceAllSynonyms,searchRules:Ht.searchRules,getRule:Ht.getRule,deleteRule:Ht.deleteRule,saveRule:Ht.saveRule,saveRules:Ht.saveRules,replaceAllRules:Ht.replaceAllRules,browseRules:Ht.browseRules,clearRules:Ht.clearRules}}),initAnalytics:()=>u=>gC.createAnalyticsClient({...o,...u,methods:{addABTest:gC.addABTest,getABTest:gC.getABTest,getABTests:gC.getABTests,stopABTest:gC.stopABTest,deleteABTest:gC.deleteABTest}}),initPersonalization:n,initRecommendation:()=>u=>(a.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),n()(u))}})}dEe.version=T6.version;mEe.exports=dEe});var N6=_((RYt,L6)=>{var EEe=yEe();L6.exports=EEe;L6.exports.default=EEe});var U6=_((LYt,wEe)=>{"use strict";var IEe=Object.getOwnPropertySymbols,lyt=Object.prototype.hasOwnProperty,cyt=Object.prototype.propertyIsEnumerable;function uyt(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function Ayt(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var o=Object.getOwnPropertyNames(e).map(function(n){return e[n]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(n){a[n]=n}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}wEe.exports=Ayt()?Object.assign:function(t,e){for(var r,o=uyt(t),a,n=1;n{"use strict";var H6=U6(),dC=60103,DEe=60106;Cn.Fragment=60107;Cn.StrictMode=60108;Cn.Profiler=60114;var SEe=60109,PEe=60110,xEe=60112;Cn.Suspense=60113;var bEe=60115,kEe=60116;typeof Symbol=="function"&&Symbol.for&&(sc=Symbol.for,dC=sc("react.element"),DEe=sc("react.portal"),Cn.Fragment=sc("react.fragment"),Cn.StrictMode=sc("react.strict_mode"),Cn.Profiler=sc("react.profiler"),SEe=sc("react.provider"),PEe=sc("react.context"),xEe=sc("react.forward_ref"),Cn.Suspense=sc("react.suspense"),bEe=sc("react.memo"),kEe=sc("react.lazy"));var sc,BEe=typeof Symbol=="function"&&Symbol.iterator;function fyt(t){return t===null||typeof t!="object"?null:(t=BEe&&t[BEe]||t["@@iterator"],typeof t=="function"?t:null)}function mB(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r{"use strict";UEe.exports=MEe()});var V6=_((MYt,Y6)=>{"use strict";var gn=Y6.exports;Y6.exports.default=gn;var Gn="\x1B[",yB="\x1B]",yC="\x07",cQ=";",_Ee=process.env.TERM_PROGRAM==="Apple_Terminal";gn.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?Gn+(t+1)+"G":Gn+(e+1)+";"+(t+1)+"H"};gn.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=Gn+-t+"D":t>0&&(r+=Gn+t+"C"),e<0?r+=Gn+-e+"A":e>0&&(r+=Gn+e+"B"),r};gn.cursorUp=(t=1)=>Gn+t+"A";gn.cursorDown=(t=1)=>Gn+t+"B";gn.cursorForward=(t=1)=>Gn+t+"C";gn.cursorBackward=(t=1)=>Gn+t+"D";gn.cursorLeft=Gn+"G";gn.cursorSavePosition=_Ee?"\x1B7":Gn+"s";gn.cursorRestorePosition=_Ee?"\x1B8":Gn+"u";gn.cursorGetPosition=Gn+"6n";gn.cursorNextLine=Gn+"E";gn.cursorPrevLine=Gn+"F";gn.cursorHide=Gn+"?25l";gn.cursorShow=Gn+"?25h";gn.eraseLines=t=>{let e="";for(let r=0;r[yB,"8",cQ,cQ,e,yC,t,yB,"8",cQ,cQ,yC].join("");gn.image=(t,e={})=>{let r=`${yB}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+t.toString("base64")+yC};gn.iTerm={setCwd:(t=process.cwd())=>`${yB}50;CurrentDir=${t}${yC}`,annotation:(t,e={})=>{let r=`${yB}1337;`,o=typeof e.x<"u",a=typeof e.y<"u";if((o||a)&&!(o&&a&&typeof e.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replace(/\|/g,""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(o?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+yC}}});var qEe=_((UYt,K6)=>{"use strict";var HEe=(t,e)=>{for(let r of Reflect.ownKeys(e))Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t};K6.exports=HEe;K6.exports.default=HEe});var GEe=_((_Yt,AQ)=>{"use strict";var myt=qEe(),uQ=new WeakMap,jEe=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,o=0,a=t.displayName||t.name||"",n=function(...u){if(uQ.set(n,++o),o===1)r=t.apply(this,u),t=null;else if(e.throw===!0)throw new Error(`Function \`${a}\` can only be called once`);return r};return myt(n,t),uQ.set(n,o),n};AQ.exports=jEe;AQ.exports.default=jEe;AQ.exports.callCount=t=>{if(!uQ.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return uQ.get(t)}});var WEe=_((HYt,fQ)=>{fQ.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&fQ.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&fQ.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var X6=_((qYt,IC)=>{var wi=global.process,td=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};td(wi)?(YEe=ve("assert"),EC=WEe(),VEe=/^win/i.test(wi.platform),EB=ve("events"),typeof EB!="function"&&(EB=EB.EventEmitter),wi.__signal_exit_emitter__?ks=wi.__signal_exit_emitter__:(ks=wi.__signal_exit_emitter__=new EB,ks.count=0,ks.emitted={}),ks.infinite||(ks.setMaxListeners(1/0),ks.infinite=!0),IC.exports=function(t,e){if(!td(global.process))return function(){};YEe.equal(typeof t,"function","a callback must be provided for exit handler"),CC===!1&&J6();var r="exit";e&&e.alwaysLast&&(r="afterexit");var o=function(){ks.removeListener(r,t),ks.listeners("exit").length===0&&ks.listeners("afterexit").length===0&&pQ()};return ks.on(r,t),o},pQ=function(){!CC||!td(global.process)||(CC=!1,EC.forEach(function(e){try{wi.removeListener(e,hQ[e])}catch{}}),wi.emit=gQ,wi.reallyExit=z6,ks.count-=1)},IC.exports.unload=pQ,rd=function(e,r,o){ks.emitted[e]||(ks.emitted[e]=!0,ks.emit(e,r,o))},hQ={},EC.forEach(function(t){hQ[t]=function(){if(td(global.process)){var r=wi.listeners(t);r.length===ks.count&&(pQ(),rd("exit",null,t),rd("afterexit",null,t),VEe&&t==="SIGHUP"&&(t="SIGINT"),wi.kill(wi.pid,t))}}}),IC.exports.signals=function(){return EC},CC=!1,J6=function(){CC||!td(global.process)||(CC=!0,ks.count+=1,EC=EC.filter(function(e){try{return wi.on(e,hQ[e]),!0}catch{return!1}}),wi.emit=JEe,wi.reallyExit=KEe)},IC.exports.load=J6,z6=wi.reallyExit,KEe=function(e){td(global.process)&&(wi.exitCode=e||0,rd("exit",wi.exitCode,null),rd("afterexit",wi.exitCode,null),z6.call(wi,wi.exitCode))},gQ=wi.emit,JEe=function(e,r){if(e==="exit"&&td(global.process)){r!==void 0&&(wi.exitCode=r);var o=gQ.apply(this,arguments);return rd("exit",wi.exitCode,null),rd("afterexit",wi.exitCode,null),o}else return gQ.apply(this,arguments)}):IC.exports=function(){return function(){}};var YEe,EC,VEe,EB,ks,pQ,rd,hQ,CC,J6,z6,KEe,gQ,JEe});var XEe=_((jYt,zEe)=>{"use strict";var yyt=GEe(),Eyt=X6();zEe.exports=yyt(()=>{Eyt(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})});var Z6=_(wC=>{"use strict";var Cyt=XEe(),dQ=!1;wC.show=(t=process.stderr)=>{t.isTTY&&(dQ=!1,t.write("\x1B[?25h"))};wC.hide=(t=process.stderr)=>{t.isTTY&&(Cyt(),dQ=!0,t.write("\x1B[?25l"))};wC.toggle=(t,e)=>{t!==void 0&&(dQ=t),dQ?wC.show(e):wC.hide(e)}});var tCe=_(CB=>{"use strict";var eCe=CB&&CB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(CB,"__esModule",{value:!0});var ZEe=eCe(V6()),$Ee=eCe(Z6()),Iyt=(t,{showCursor:e=!1}={})=>{let r=0,o="",a=!1,n=u=>{!e&&!a&&($Ee.default.hide(),a=!0);let A=u+` -`;A!==o&&(o=A,t.write(ZEe.default.eraseLines(r)+A),r=A.split(` -`).length)};return n.clear=()=>{t.write(ZEe.default.eraseLines(r)),o="",r=0},n.done=()=>{o="",r=0,e||($Ee.default.show(),a=!1)},n};CB.default={create:Iyt}});var rCe=_((YYt,wyt)=>{wyt.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var sCe=_(Cl=>{"use strict";var iCe=rCe(),gA=process.env;Object.defineProperty(Cl,"_vendors",{value:iCe.map(function(t){return t.constant})});Cl.name=null;Cl.isPR=null;iCe.forEach(function(t){var e=Array.isArray(t.env)?t.env:[t.env],r=e.every(function(o){return nCe(o)});if(Cl[t.constant]=r,r)switch(Cl.name=t.name,typeof t.pr){case"string":Cl.isPR=!!gA[t.pr];break;case"object":"env"in t.pr?Cl.isPR=t.pr.env in gA&&gA[t.pr.env]!==t.pr.ne:"any"in t.pr?Cl.isPR=t.pr.any.some(function(o){return!!gA[o]}):Cl.isPR=nCe(t.pr);break;default:Cl.isPR=null}});Cl.isCI=!!(gA.CI||gA.CONTINUOUS_INTEGRATION||gA.BUILD_NUMBER||gA.RUN_ID||Cl.name);function nCe(t){return typeof t=="string"?!!gA[t]:Object.keys(t).every(function(e){return gA[e]===t[e]})}});var aCe=_((KYt,oCe)=>{"use strict";oCe.exports=sCe().isCI});var cCe=_((JYt,lCe)=>{"use strict";var Byt=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};lCe.exports=(t,{include:e,exclude:r}={})=>{let o=a=>{let n=u=>typeof u=="string"?a===u:u.test(a);return e?e.some(n):r?!r.some(n):!0};for(let[a,n]of Byt(t.constructor.prototype)){if(n==="constructor"||!o(n))continue;let u=Reflect.getOwnPropertyDescriptor(a,n);u&&typeof u.value=="function"&&(t[n]=t[n].bind(t))}return t}});var gCe=_(Hn=>{"use strict";var vC,BB,CQ,sq;typeof performance=="object"&&typeof performance.now=="function"?(uCe=performance,Hn.unstable_now=function(){return uCe.now()}):($6=Date,ACe=$6.now(),Hn.unstable_now=function(){return $6.now()-ACe});var uCe,$6,ACe;typeof window>"u"||typeof MessageChannel!="function"?(BC=null,eq=null,tq=function(){if(BC!==null)try{var t=Hn.unstable_now();BC(!0,t),BC=null}catch(e){throw setTimeout(tq,0),e}},vC=function(t){BC!==null?setTimeout(vC,0,t):(BC=t,setTimeout(tq,0))},BB=function(t,e){eq=setTimeout(t,e)},CQ=function(){clearTimeout(eq)},Hn.unstable_shouldYield=function(){return!1},sq=Hn.unstable_forceFrameRate=function(){}):(fCe=window.setTimeout,pCe=window.clearTimeout,typeof console<"u"&&(hCe=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),typeof hCe!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")),IB=!1,wB=null,mQ=-1,rq=5,nq=0,Hn.unstable_shouldYield=function(){return Hn.unstable_now()>=nq},sq=function(){},Hn.unstable_forceFrameRate=function(t){0>t||125>>1,a=t[o];if(a!==void 0&&0EQ(u,r))p!==void 0&&0>EQ(p,u)?(t[o]=p,t[A]=r,o=A):(t[o]=u,t[n]=r,o=n);else if(p!==void 0&&0>EQ(p,r))t[o]=p,t[A]=r,o=A;else break e}}return e}return null}function EQ(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}var dA=[],Uh=[],vyt=1,oc=null,bo=3,wQ=!1,nd=!1,vB=!1;function aq(t){for(var e=ou(Uh);e!==null;){if(e.callback===null)IQ(Uh);else if(e.startTime<=t)IQ(Uh),e.sortIndex=e.expirationTime,oq(dA,e);else break;e=ou(Uh)}}function lq(t){if(vB=!1,aq(t),!nd)if(ou(dA)!==null)nd=!0,vC(cq);else{var e=ou(Uh);e!==null&&BB(lq,e.startTime-t)}}function cq(t,e){nd=!1,vB&&(vB=!1,CQ()),wQ=!0;var r=bo;try{for(aq(e),oc=ou(dA);oc!==null&&(!(oc.expirationTime>e)||t&&!Hn.unstable_shouldYield());){var o=oc.callback;if(typeof o=="function"){oc.callback=null,bo=oc.priorityLevel;var a=o(oc.expirationTime<=e);e=Hn.unstable_now(),typeof a=="function"?oc.callback=a:oc===ou(dA)&&IQ(dA),aq(e)}else IQ(dA);oc=ou(dA)}if(oc!==null)var n=!0;else{var u=ou(Uh);u!==null&&BB(lq,u.startTime-e),n=!1}return n}finally{oc=null,bo=r,wQ=!1}}var Dyt=sq;Hn.unstable_IdlePriority=5;Hn.unstable_ImmediatePriority=1;Hn.unstable_LowPriority=4;Hn.unstable_NormalPriority=3;Hn.unstable_Profiling=null;Hn.unstable_UserBlockingPriority=2;Hn.unstable_cancelCallback=function(t){t.callback=null};Hn.unstable_continueExecution=function(){nd||wQ||(nd=!0,vC(cq))};Hn.unstable_getCurrentPriorityLevel=function(){return bo};Hn.unstable_getFirstCallbackNode=function(){return ou(dA)};Hn.unstable_next=function(t){switch(bo){case 1:case 2:case 3:var e=3;break;default:e=bo}var r=bo;bo=e;try{return t()}finally{bo=r}};Hn.unstable_pauseExecution=function(){};Hn.unstable_requestPaint=Dyt;Hn.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=bo;bo=t;try{return e()}finally{bo=r}};Hn.unstable_scheduleCallback=function(t,e,r){var o=Hn.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0o?(t.sortIndex=r,oq(Uh,t),ou(dA)===null&&t===ou(Uh)&&(vB?CQ():vB=!0,BB(lq,r-o))):(t.sortIndex=a,oq(dA,t),nd||wQ||(nd=!0,vC(cq))),t};Hn.unstable_wrapCallback=function(t){var e=bo;return function(){var r=bo;bo=e;try{return t.apply(this,arguments)}finally{bo=r}}}});var uq=_((XYt,dCe)=>{"use strict";dCe.exports=gCe()});var mCe=_((ZYt,DB)=>{DB.exports=function(e){var r={},o=U6(),a=ln(),n=uq();function u(v){for(var S="https://reactjs.org/docs/error-decoder.html?invariant="+v,Q=1;QUe||Y[Be]!==ne[Ue])return` -`+Y[Be].replace(" at new "," at ");while(1<=Be&&0<=Ue);break}}}finally{we=!1,Error.prepareStackTrace=Q}return(v=v?v.displayName||v.name:"")?Il(v):""}var wl=[],Bi=-1;function Ls(v){return{current:v}}function Ft(v){0>Bi||(v.current=wl[Bi],wl[Bi]=null,Bi--)}function Bn(v,S){Bi++,wl[Bi]=v.current,v.current=S}var Lo={},ki=Ls(Lo),vi=Ls(!1),sa=Lo;function un(v,S){var Q=v.type.contextTypes;if(!Q)return Lo;var H=v.stateNode;if(H&&H.__reactInternalMemoizedUnmaskedChildContext===S)return H.__reactInternalMemoizedMaskedChildContext;var Y={},ne;for(ne in Q)Y[ne]=S[ne];return H&&(v=v.stateNode,v.__reactInternalMemoizedUnmaskedChildContext=S,v.__reactInternalMemoizedMaskedChildContext=Y),Y}function qn(v){return v=v.childContextTypes,v!=null}function Ec(){Ft(vi),Ft(ki)}function lp(v,S,Q){if(ki.current!==Lo)throw Error(u(168));Bn(ki,S),Bn(vi,Q)}function oa(v,S,Q){var H=v.stateNode;if(v=S.childContextTypes,typeof H.getChildContext!="function")return Q;H=H.getChildContext();for(var Y in H)if(!(Y in v))throw Error(u(108,g(S)||"Unknown",Y));return o({},Q,H)}function aa(v){return v=(v=v.stateNode)&&v.__reactInternalMemoizedMergedChildContext||Lo,sa=ki.current,Bn(ki,v),Bn(vi,vi.current),!0}function la(v,S,Q){var H=v.stateNode;if(!H)throw Error(u(169));Q?(v=oa(v,S,sa),H.__reactInternalMemoizedMergedChildContext=v,Ft(vi),Ft(ki),Bn(ki,v)):Ft(vi),Bn(vi,Q)}var Ze=null,ca=null,mu=n.unstable_now;mu();var Bl=0,dn=8;function No(v){if(1&v)return dn=15,1;if(2&v)return dn=14,2;if(4&v)return dn=13,4;var S=24&v;return S!==0?(dn=12,S):v&32?(dn=11,32):(S=192&v,S!==0?(dn=10,S):v&256?(dn=9,256):(S=3584&v,S!==0?(dn=8,S):v&4096?(dn=7,4096):(S=4186112&v,S!==0?(dn=6,S):(S=62914560&v,S!==0?(dn=5,S):v&67108864?(dn=4,67108864):v&134217728?(dn=3,134217728):(S=805306368&v,S!==0?(dn=2,S):1073741824&v?(dn=1,1073741824):(dn=8,v))))))}function RA(v){switch(v){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function TA(v){switch(v){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(u(358,v))}}function Oo(v,S){var Q=v.pendingLanes;if(Q===0)return dn=0;var H=0,Y=0,ne=v.expiredLanes,Be=v.suspendedLanes,Ue=v.pingedLanes;if(ne!==0)H=ne,Y=dn=15;else if(ne=Q&134217727,ne!==0){var ft=ne&~Be;ft!==0?(H=No(ft),Y=dn):(Ue&=ne,Ue!==0&&(H=No(Ue),Y=dn))}else ne=Q&~Be,ne!==0?(H=No(ne),Y=dn):Ue!==0&&(H=No(Ue),Y=dn);if(H===0)return 0;if(H=31-qi(H),H=Q&((0>H?0:1<Q;Q++)S.push(v);return S}function ua(v,S,Q){v.pendingLanes|=S;var H=S-1;v.suspendedLanes&=H,v.pingedLanes&=H,v=v.eventTimes,S=31-qi(S),v[S]=Q}var qi=Math.clz32?Math.clz32:Dl,vl=Math.log,Cc=Math.LN2;function Dl(v){return v===0?32:31-(vl(v)/Cc|0)|0}var Aa=n.unstable_runWithPriority,Di=n.unstable_scheduleCallback,rs=n.unstable_cancelCallback,ja=n.unstable_shouldYield,yu=n.unstable_requestPaint,Sl=n.unstable_now,pi=n.unstable_getCurrentPriorityLevel,Dn=n.unstable_ImmediatePriority,Pl=n.unstable_UserBlockingPriority,Je=n.unstable_NormalPriority,st=n.unstable_LowPriority,vt=n.unstable_IdlePriority,ar={},ee=yu!==void 0?yu:function(){},ye=null,Ne=null,gt=!1,mt=Sl(),Dt=1e4>mt?Sl:function(){return Sl()-mt};function er(){switch(pi()){case Dn:return 99;case Pl:return 98;case Je:return 97;case st:return 96;case vt:return 95;default:throw Error(u(332))}}function sn(v){switch(v){case 99:return Dn;case 98:return Pl;case 97:return Je;case 96:return st;case 95:return vt;default:throw Error(u(332))}}function ei(v,S){return v=sn(v),Aa(v,S)}function Qi(v,S,Q){return v=sn(v),Di(v,S,Q)}function Sn(){if(Ne!==null){var v=Ne;Ne=null,rs(v)}fa()}function fa(){if(!gt&&ye!==null){gt=!0;var v=0;try{var S=ye;ei(99,function(){for(;vPn?(Tn=xr,xr=null):Tn=xr.sibling;var Yr=Xt($e,xr,pt[Pn],zt);if(Yr===null){xr===null&&(xr=Tn);break}v&&xr&&Yr.alternate===null&&S($e,xr),je=ne(Yr,je,Pn),Wn===null?Br=Yr:Wn.sibling=Yr,Wn=Yr,xr=Tn}if(Pn===pt.length)return Q($e,xr),Br;if(xr===null){for(;PnPn?(Tn=xr,xr=null):Tn=xr.sibling;var ti=Xt($e,xr,Yr.value,zt);if(ti===null){xr===null&&(xr=Tn);break}v&&xr&&ti.alternate===null&&S($e,xr),je=ne(ti,je,Pn),Wn===null?Br=ti:Wn.sibling=ti,Wn=ti,xr=Tn}if(Yr.done)return Q($e,xr),Br;if(xr===null){for(;!Yr.done;Pn++,Yr=pt.next())Yr=Tr($e,Yr.value,zt),Yr!==null&&(je=ne(Yr,je,Pn),Wn===null?Br=Yr:Wn.sibling=Yr,Wn=Yr);return Br}for(xr=H($e,xr);!Yr.done;Pn++,Yr=pt.next())Yr=jn(xr,$e,Pn,Yr.value,zt),Yr!==null&&(v&&Yr.alternate!==null&&xr.delete(Yr.key===null?Pn:Yr.key),je=ne(Yr,je,Pn),Wn===null?Br=Yr:Wn.sibling=Yr,Wn=Yr);return v&&xr.forEach(function(Rc){return S($e,Rc)}),Br}return function($e,je,pt,zt){var Br=typeof pt=="object"&&pt!==null&&pt.type===E&&pt.key===null;Br&&(pt=pt.props.children);var Wn=typeof pt=="object"&&pt!==null;if(Wn)switch(pt.$$typeof){case p:e:{for(Wn=pt.key,Br=je;Br!==null;){if(Br.key===Wn){switch(Br.tag){case 7:if(pt.type===E){Q($e,Br.sibling),je=Y(Br,pt.props.children),je.return=$e,$e=je;break e}break;default:if(Br.elementType===pt.type){Q($e,Br.sibling),je=Y(Br,pt.props),je.ref=dt($e,Br,pt),je.return=$e,$e=je;break e}}Q($e,Br);break}else S($e,Br);Br=Br.sibling}pt.type===E?(je=Ru(pt.props.children,$e.mode,zt,pt.key),je.return=$e,$e=je):(zt=k0(pt.type,pt.key,pt.props,null,$e.mode,zt),zt.ref=dt($e,je,pt),zt.return=$e,$e=zt)}return Be($e);case h:e:{for(Br=pt.key;je!==null;){if(je.key===Br)if(je.tag===4&&je.stateNode.containerInfo===pt.containerInfo&&je.stateNode.implementation===pt.implementation){Q($e,je.sibling),je=Y(je,pt.children||[]),je.return=$e,$e=je;break e}else{Q($e,je);break}else S($e,je);je=je.sibling}je=ao(pt,$e.mode,zt),je.return=$e,$e=je}return Be($e)}if(typeof pt=="string"||typeof pt=="number")return pt=""+pt,je!==null&&je.tag===6?(Q($e,je.sibling),je=Y(je,pt),je.return=$e,$e=je):(Q($e,je),je=ZI(pt,$e.mode,zt),je.return=$e,$e=je),Be($e);if(Cu(pt))return li($e,je,pt,zt);if(Ee(pt))return Ea($e,je,pt,zt);if(Wn&&wc($e,pt),typeof pt>"u"&&!Br)switch($e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(u(152,g($e.type)||"Component"))}return Q($e,je)}}var c0=xd(!0),DI=xd(!1),hp={},cr=Ls(hp),Ni=Ls(hp),Iu=Ls(hp);function pa(v){if(v===hp)throw Error(u(174));return v}function u0(v,S){Bn(Iu,S),Bn(Ni,v),Bn(cr,hp),v=ht(S),Ft(cr),Bn(cr,v)}function Bc(){Ft(cr),Ft(Ni),Ft(Iu)}function wu(v){var S=pa(Iu.current),Q=pa(cr.current);S=q(Q,v.type,S),Q!==S&&(Bn(Ni,v),Bn(cr,S))}function wt(v){Ni.current===v&&(Ft(cr),Ft(Ni))}var oi=Ls(0);function UA(v){for(var S=v;S!==null;){if(S.tag===13){var Q=S.memoizedState;if(Q!==null&&(Q=Q.dehydrated,Q===null||pr(Q)||Me(Q)))return S}else if(S.tag===19&&S.memoizedProps.revealOrder!==void 0){if(S.flags&64)return S}else if(S.child!==null){S.child.return=S,S=S.child;continue}if(S===v)break;for(;S.sibling===null;){if(S.return===null||S.return===v)return null;S=S.return}S.sibling.return=S.return,S=S.sibling}return null}var ha=null,Uo=null,ga=!1;function A0(v,S){var Q=ya(5,null,null,0);Q.elementType="DELETED",Q.type="DELETED",Q.stateNode=S,Q.return=v,Q.flags=8,v.lastEffect!==null?(v.lastEffect.nextEffect=Q,v.lastEffect=Q):v.firstEffect=v.lastEffect=Q}function gp(v,S){switch(v.tag){case 5:return S=To(S,v.type,v.pendingProps),S!==null?(v.stateNode=S,!0):!1;case 6:return S=kA(S,v.pendingProps),S!==null?(v.stateNode=S,!0):!1;case 13:return!1;default:return!1}}function f0(v){if(ga){var S=Uo;if(S){var Q=S;if(!gp(v,S)){if(S=ia(Q),!S||!gp(v,S)){v.flags=v.flags&-1025|2,ga=!1,ha=v;return}A0(ha,Q)}ha=v,Uo=dc(S)}else v.flags=v.flags&-1025|2,ga=!1,ha=v}}function bd(v){for(v=v.return;v!==null&&v.tag!==5&&v.tag!==3&&v.tag!==13;)v=v.return;ha=v}function _A(v){if(!X||v!==ha)return!1;if(!ga)return bd(v),ga=!0,!1;var S=v.type;if(v.tag!==5||S!=="head"&&S!=="body"&&!tt(S,v.memoizedProps))for(S=Uo;S;)A0(v,S),S=ia(S);if(bd(v),v.tag===13){if(!X)throw Error(u(316));if(v=v.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(u(317));Uo=QA(v)}else Uo=ha?ia(v.stateNode):null;return!0}function p0(){X&&(Uo=ha=null,ga=!1)}var vc=[];function Dc(){for(var v=0;vne))throw Error(u(301));ne+=1,Ci=ji=null,S.updateQueue=null,Bu.current=re,v=Q(H,Y)}while(vu)}if(Bu.current=bt,S=ji!==null&&ji.next!==null,Sc=0,Ci=ji=On=null,HA=!1,S)throw Error(u(300));return v}function Gi(){var v={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ci===null?On.memoizedState=Ci=v:Ci=Ci.next=v,Ci}function Va(){if(ji===null){var v=On.alternate;v=v!==null?v.memoizedState:null}else v=ji.next;var S=Ci===null?On.memoizedState:Ci.next;if(S!==null)Ci=S,ji=v;else{if(v===null)throw Error(u(310));ji=v,v={memoizedState:ji.memoizedState,baseState:ji.baseState,baseQueue:ji.baseQueue,queue:ji.queue,next:null},Ci===null?On.memoizedState=Ci=v:Ci=Ci.next=v}return Ci}function io(v,S){return typeof S=="function"?S(v):S}function Du(v){var S=Va(),Q=S.queue;if(Q===null)throw Error(u(311));Q.lastRenderedReducer=v;var H=ji,Y=H.baseQueue,ne=Q.pending;if(ne!==null){if(Y!==null){var Be=Y.next;Y.next=ne.next,ne.next=Be}H.baseQueue=Y=ne,Q.pending=null}if(Y!==null){Y=Y.next,H=H.baseState;var Ue=Be=ne=null,ft=Y;do{var jt=ft.lane;if((Sc&jt)===jt)Ue!==null&&(Ue=Ue.next={lane:0,action:ft.action,eagerReducer:ft.eagerReducer,eagerState:ft.eagerState,next:null}),H=ft.eagerReducer===v?ft.eagerState:v(H,ft.action);else{var wr={lane:jt,action:ft.action,eagerReducer:ft.eagerReducer,eagerState:ft.eagerState,next:null};Ue===null?(Be=Ue=wr,ne=H):Ue=Ue.next=wr,On.lanes|=jt,B0|=jt}ft=ft.next}while(ft!==null&&ft!==Y);Ue===null?ne=H:Ue.next=Be,eo(H,S.memoizedState)||(Ye=!0),S.memoizedState=H,S.baseState=ne,S.baseQueue=Ue,Q.lastRenderedState=H}return[S.memoizedState,Q.dispatch]}function Su(v){var S=Va(),Q=S.queue;if(Q===null)throw Error(u(311));Q.lastRenderedReducer=v;var H=Q.dispatch,Y=Q.pending,ne=S.memoizedState;if(Y!==null){Q.pending=null;var Be=Y=Y.next;do ne=v(ne,Be.action),Be=Be.next;while(Be!==Y);eo(ne,S.memoizedState)||(Ye=!0),S.memoizedState=ne,S.baseQueue===null&&(S.baseState=ne),Q.lastRenderedState=ne}return[ne,H]}function Ka(v,S,Q){var H=S._getVersion;H=H(S._source);var Y=y?S._workInProgressVersionPrimary:S._workInProgressVersionSecondary;if(Y!==null?v=Y===H:(v=v.mutableReadLanes,(v=(Sc&v)===v)&&(y?S._workInProgressVersionPrimary=H:S._workInProgressVersionSecondary=H,vc.push(S))),v)return Q(S._source);throw vc.push(S),Error(u(350))}function fn(v,S,Q,H){var Y=Os;if(Y===null)throw Error(u(349));var ne=S._getVersion,Be=ne(S._source),Ue=Bu.current,ft=Ue.useState(function(){return Ka(Y,S,Q)}),jt=ft[1],wr=ft[0];ft=Ci;var Tr=v.memoizedState,Xt=Tr.refs,jn=Xt.getSnapshot,li=Tr.source;Tr=Tr.subscribe;var Ea=On;return v.memoizedState={refs:Xt,source:S,subscribe:H},Ue.useEffect(function(){Xt.getSnapshot=Q,Xt.setSnapshot=jt;var $e=ne(S._source);if(!eo(Be,$e)){$e=Q(S._source),eo(wr,$e)||(jt($e),$e=ss(Ea),Y.mutableReadLanes|=$e&Y.pendingLanes),$e=Y.mutableReadLanes,Y.entangledLanes|=$e;for(var je=Y.entanglements,pt=$e;0Q?98:Q,function(){v(!0)}),ei(97qI&&(S.flags|=64,Y=!0,VA(H,!1),S.lanes=33554432)}else{if(!Y)if(v=UA(ne),v!==null){if(S.flags|=64,Y=!0,v=v.updateQueue,v!==null&&(S.updateQueue=v,S.flags|=4),VA(H,!0),H.tail===null&&H.tailMode==="hidden"&&!ne.alternate&&!ga)return S=S.lastEffect=H.lastEffect,S!==null&&(S.nextEffect=null),null}else 2*Dt()-H.renderingStartTime>qI&&Q!==1073741824&&(S.flags|=64,Y=!0,VA(H,!1),S.lanes=33554432);H.isBackwards?(ne.sibling=S.child,S.child=ne):(v=H.last,v!==null?v.sibling=ne:S.child=ne,H.last=ne)}return H.tail!==null?(v=H.tail,H.rendering=v,H.tail=v.sibling,H.lastEffect=S.lastEffect,H.renderingStartTime=Dt(),v.sibling=null,S=oi.current,Bn(oi,Y?S&1|2:S&1),v):null;case 23:case 24:return KI(),v!==null&&v.memoizedState!==null!=(S.memoizedState!==null)&&H.mode!=="unstable-defer-without-hiding"&&(S.flags|=4),null}throw Error(u(156,S.tag))}function qF(v){switch(v.tag){case 1:qn(v.type)&&Ec();var S=v.flags;return S&4096?(v.flags=S&-4097|64,v):null;case 3:if(Bc(),Ft(vi),Ft(ki),Dc(),S=v.flags,S&64)throw Error(u(285));return v.flags=S&-4097|64,v;case 5:return wt(v),null;case 13:return Ft(oi),S=v.flags,S&4096?(v.flags=S&-4097|64,v):null;case 19:return Ft(oi),null;case 4:return Bc(),null;case 10:return a0(v),null;case 23:case 24:return KI(),null;default:return null}}function m0(v,S){try{var Q="",H=S;do Q+=vI(H),H=H.return;while(H);var Y=Q}catch(ne){Y=` -Error generating stack: `+ne.message+` -`+ne.stack}return{value:v,source:S,stack:Y}}function y0(v,S){try{console.error(S.value)}catch(Q){setTimeout(function(){throw Q})}}var jF=typeof WeakMap=="function"?WeakMap:Map;function bI(v,S,Q){Q=Wa(-1,Q),Q.tag=3,Q.payload={element:null};var H=S.value;return Q.callback=function(){Wd||(Wd=!0,jI=H),y0(v,S)},Q}function E0(v,S,Q){Q=Wa(-1,Q),Q.tag=3;var H=v.type.getDerivedStateFromError;if(typeof H=="function"){var Y=S.value;Q.payload=function(){return y0(v,S),H(Y)}}var ne=v.stateNode;return ne!==null&&typeof ne.componentDidCatch=="function"&&(Q.callback=function(){typeof H!="function"&&(bl===null?bl=new Set([this]):bl.add(this),y0(v,S));var Be=S.stack;this.componentDidCatch(S.value,{componentStack:Be!==null?Be:""})}),Q}var GF=typeof WeakSet=="function"?WeakSet:Set;function kI(v){var S=v.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(Q){Fu(v,Q)}else S.current=null}function Td(v,S){switch(S.tag){case 0:case 11:case 15:case 22:return;case 1:if(S.flags&256&&v!==null){var Q=v.memoizedProps,H=v.memoizedState;v=S.stateNode,S=v.getSnapshotBeforeUpdate(S.elementType===S.type?Q:to(S.type,Q),H),v.__reactInternalSnapshotBeforeUpdate=S}return;case 3:R&&S.flags&256&&hs(S.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(u(163))}function wp(v,S){if(S=S.updateQueue,S=S!==null?S.lastEffect:null,S!==null){var Q=S=S.next;do{if((Q.tag&v)===v){var H=Q.destroy;Q.destroy=void 0,H!==void 0&&H()}Q=Q.next}while(Q!==S)}}function uD(v,S,Q){switch(Q.tag){case 0:case 11:case 15:case 22:if(S=Q.updateQueue,S=S!==null?S.lastEffect:null,S!==null){v=S=S.next;do{if((v.tag&3)===3){var H=v.create;v.destroy=H()}v=v.next}while(v!==S)}if(S=Q.updateQueue,S=S!==null?S.lastEffect:null,S!==null){v=S=S.next;do{var Y=v;H=Y.next,Y=Y.tag,Y&4&&Y&1&&(vD(Q,v),$F(Q,v)),v=H}while(v!==S)}return;case 1:v=Q.stateNode,Q.flags&4&&(S===null?v.componentDidMount():(H=Q.elementType===Q.type?S.memoizedProps:to(Q.type,S.memoizedProps),v.componentDidUpdate(H,S.memoizedState,v.__reactInternalSnapshotBeforeUpdate))),S=Q.updateQueue,S!==null&&Sd(Q,S,v);return;case 3:if(S=Q.updateQueue,S!==null){if(v=null,Q.child!==null)switch(Q.child.tag){case 5:v=Re(Q.child.stateNode);break;case 1:v=Q.child.stateNode}Sd(Q,S,v)}return;case 5:v=Q.stateNode,S===null&&Q.flags&4&&Qs(v,Q.type,Q.memoizedProps,Q);return;case 6:return;case 4:return;case 12:return;case 13:X&&Q.memoizedState===null&&(Q=Q.alternate,Q!==null&&(Q=Q.memoizedState,Q!==null&&(Q=Q.dehydrated,Q!==null&&mc(Q))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(u(163))}function AD(v,S){if(R)for(var Q=v;;){if(Q.tag===5){var H=Q.stateNode;S?op(H):Rs(Q.stateNode,Q.memoizedProps)}else if(Q.tag===6)H=Q.stateNode,S?ap(H):Nn(H,Q.memoizedProps);else if((Q.tag!==23&&Q.tag!==24||Q.memoizedState===null||Q===v)&&Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===v)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===v)return;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}}function Ld(v,S){if(ca&&typeof ca.onCommitFiberUnmount=="function")try{ca.onCommitFiberUnmount(Ze,S)}catch{}switch(S.tag){case 0:case 11:case 14:case 15:case 22:if(v=S.updateQueue,v!==null&&(v=v.lastEffect,v!==null)){var Q=v=v.next;do{var H=Q,Y=H.destroy;if(H=H.tag,Y!==void 0)if(H&4)vD(S,Q);else{H=S;try{Y()}catch(ne){Fu(H,ne)}}Q=Q.next}while(Q!==v)}break;case 1:if(kI(S),v=S.stateNode,typeof v.componentWillUnmount=="function")try{v.props=S.memoizedProps,v.state=S.memoizedState,v.componentWillUnmount()}catch(ne){Fu(S,ne)}break;case 5:kI(S);break;case 4:R?gD(v,S):z&&z&&(S=S.stateNode.containerInfo,v=pc(S),xA(S,v))}}function fD(v,S){for(var Q=S;;)if(Ld(v,Q),Q.child===null||R&&Q.tag===4){if(Q===S)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===S)return;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}else Q.child.return=Q,Q=Q.child}function Nd(v){v.alternate=null,v.child=null,v.dependencies=null,v.firstEffect=null,v.lastEffect=null,v.memoizedProps=null,v.memoizedState=null,v.pendingProps=null,v.return=null,v.updateQueue=null}function pD(v){return v.tag===5||v.tag===3||v.tag===4}function hD(v){if(R){e:{for(var S=v.return;S!==null;){if(pD(S))break e;S=S.return}throw Error(u(160))}var Q=S;switch(S=Q.stateNode,Q.tag){case 5:var H=!1;break;case 3:S=S.containerInfo,H=!0;break;case 4:S=S.containerInfo,H=!0;break;default:throw Error(u(161))}Q.flags&16&&(gu(S),Q.flags&=-17);e:t:for(Q=v;;){for(;Q.sibling===null;){if(Q.return===null||pD(Q.return)){Q=null;break e}Q=Q.return}for(Q.sibling.return=Q.return,Q=Q.sibling;Q.tag!==5&&Q.tag!==6&&Q.tag!==18;){if(Q.flags&2||Q.child===null||Q.tag===4)continue t;Q.child.return=Q,Q=Q.child}if(!(Q.flags&2)){Q=Q.stateNode;break e}}H?QI(v,Q,S):FI(v,Q,S)}}function QI(v,S,Q){var H=v.tag,Y=H===5||H===6;if(Y)v=Y?v.stateNode:v.stateNode.instance,S?Fs(Q,v,S):Xs(Q,v);else if(H!==4&&(v=v.child,v!==null))for(QI(v,S,Q),v=v.sibling;v!==null;)QI(v,S,Q),v=v.sibling}function FI(v,S,Q){var H=v.tag,Y=H===5||H===6;if(Y)v=Y?v.stateNode:v.stateNode.instance,S?bi(Q,v,S):$n(Q,v);else if(H!==4&&(v=v.child,v!==null))for(FI(v,S,Q),v=v.sibling;v!==null;)FI(v,S,Q),v=v.sibling}function gD(v,S){for(var Q=S,H=!1,Y,ne;;){if(!H){H=Q.return;e:for(;;){if(H===null)throw Error(u(160));switch(Y=H.stateNode,H.tag){case 5:ne=!1;break e;case 3:Y=Y.containerInfo,ne=!0;break e;case 4:Y=Y.containerInfo,ne=!0;break e}H=H.return}H=!0}if(Q.tag===5||Q.tag===6)fD(v,Q),ne?PA(Y,Q.stateNode):$s(Y,Q.stateNode);else if(Q.tag===4){if(Q.child!==null){Y=Q.stateNode.containerInfo,ne=!0,Q.child.return=Q,Q=Q.child;continue}}else if(Ld(v,Q),Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===S)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===S)return;Q=Q.return,Q.tag===4&&(H=!1)}Q.sibling.return=Q.return,Q=Q.sibling}}function RI(v,S){if(R){switch(S.tag){case 0:case 11:case 14:case 15:case 22:wp(3,S);return;case 1:return;case 5:var Q=S.stateNode;if(Q!=null){var H=S.memoizedProps;v=v!==null?v.memoizedProps:H;var Y=S.type,ne=S.updateQueue;S.updateQueue=null,ne!==null&&Zs(Q,ne,Y,v,H,S)}return;case 6:if(S.stateNode===null)throw Error(u(162));Q=S.memoizedProps,Hi(S.stateNode,v!==null?v.memoizedProps:Q,Q);return;case 3:X&&(S=S.stateNode,S.hydrate&&(S.hydrate=!1,FA(S.containerInfo)));return;case 12:return;case 13:dD(S),C0(S);return;case 19:C0(S);return;case 17:return;case 23:case 24:AD(S,S.memoizedState!==null);return}throw Error(u(163))}switch(S.tag){case 0:case 11:case 14:case 15:case 22:wp(3,S);return;case 12:return;case 13:dD(S),C0(S);return;case 19:C0(S);return;case 3:X&&(Q=S.stateNode,Q.hydrate&&(Q.hydrate=!1,FA(Q.containerInfo)));break;case 23:case 24:return}e:if(z){switch(S.tag){case 1:case 5:case 6:case 20:break e;case 3:case 4:S=S.stateNode,xA(S.containerInfo,S.pendingChildren);break e}throw Error(u(163))}}function dD(v){v.memoizedState!==null&&(HI=Dt(),R&&AD(v.child,!0))}function C0(v){var S=v.updateQueue;if(S!==null){v.updateQueue=null;var Q=v.stateNode;Q===null&&(Q=v.stateNode=new GF),S.forEach(function(H){var Y=tR.bind(null,v,H);Q.has(H)||(Q.add(H),H.then(Y,Y))})}}function WF(v,S){return v!==null&&(v=v.memoizedState,v===null||v.dehydrated!==null)?(S=S.memoizedState,S!==null&&S.dehydrated===null):!1}var Od=0,Md=1,Ud=2,I0=3,_d=4;if(typeof Symbol=="function"&&Symbol.for){var w0=Symbol.for;Od=w0("selector.component"),Md=w0("selector.has_pseudo_class"),Ud=w0("selector.role"),I0=w0("selector.test_id"),_d=w0("selector.text")}function Hd(v){var S=$(v);if(S!=null){if(typeof S.memoizedProps["data-testname"]!="string")throw Error(u(364));return S}if(v=nr(v),v===null)throw Error(u(362));return v.stateNode.current}function xu(v,S){switch(S.$$typeof){case Od:if(v.type===S.value)return!0;break;case Md:e:{S=S.value,v=[v,0];for(var Q=0;Q";case Md:return":has("+(bu(v)||"")+")";case Ud:return'[role="'+v.value+'"]';case _d:return'"'+v.value+'"';case I0:return'[data-testname="'+v.value+'"]';default:throw Error(u(365,v))}}function TI(v,S){var Q=[];v=[v,0];for(var H=0;HY&&(Y=Be),Q&=~ne}if(Q=Y,Q=Dt()-Q,Q=(120>Q?120:480>Q?480:1080>Q?1080:1920>Q?1920:3e3>Q?3e3:4320>Q?4320:1960*VF(Q/1960))-Q,10 component higher in the tree to provide a loading indicator or placeholder to display.`)}is!==5&&(is=2),ft=m0(ft,Ue),Xt=Be;do{switch(Xt.tag){case 3:ne=ft,Xt.flags|=4096,S&=-S,Xt.lanes|=S;var Wn=bI(Xt,ne,S);Dd(Xt,Wn);break e;case 1:ne=ft;var xr=Xt.type,Pn=Xt.stateNode;if(!(Xt.flags&64)&&(typeof xr.getDerivedStateFromError=="function"||Pn!==null&&typeof Pn.componentDidCatch=="function"&&(bl===null||!bl.has(Pn)))){Xt.flags|=4096,S&=-S,Xt.lanes|=S;var Tn=E0(Xt,ne,S);Dd(Xt,Tn);break e}}Xt=Xt.return}while(Xt!==null)}BD(Q)}catch(Yr){S=Yr,Oi===Q&&Q!==null&&(Oi=Q=Q.return);continue}break}while(!0)}function ID(){var v=jd.current;return jd.current=bt,v===null?bt:v}function b0(v,S){var Q=Pr;Pr|=16;var H=ID();Os===v&&ms===S||Sp(v,S);do try{JF();break}catch(Y){CD(v,Y)}while(!0);if(s0(),Pr=Q,jd.current=H,Oi!==null)throw Error(u(261));return Os=null,ms=0,is}function JF(){for(;Oi!==null;)wD(Oi)}function zF(){for(;Oi!==null&&!ja();)wD(Oi)}function wD(v){var S=PD(v.alternate,v,KA);v.memoizedProps=v.pendingProps,S===null?BD(v):Oi=S,NI.current=null}function BD(v){var S=v;do{var Q=S.alternate;if(v=S.return,S.flags&2048){if(Q=qF(S),Q!==null){Q.flags&=2047,Oi=Q;return}v!==null&&(v.firstEffect=v.lastEffect=null,v.flags|=2048)}else{if(Q=HF(Q,S,KA),Q!==null){Oi=Q;return}if(Q=S,Q.tag!==24&&Q.tag!==23||Q.memoizedState===null||KA&1073741824||!(Q.mode&4)){for(var H=0,Y=Q.child;Y!==null;)H|=Y.lanes|Y.childLanes,Y=Y.sibling;Q.childLanes=H}v!==null&&!(v.flags&2048)&&(v.firstEffect===null&&(v.firstEffect=S.firstEffect),S.lastEffect!==null&&(v.lastEffect!==null&&(v.lastEffect.nextEffect=S.firstEffect),v.lastEffect=S.lastEffect),1Dt()-HI?Sp(v,0):UI|=Q),qo(v,S)}function tR(v,S){var Q=v.stateNode;Q!==null&&Q.delete(S),S=0,S===0&&(S=v.mode,S&2?S&4?(kc===0&&(kc=Bp),S=vn(62914560&~kc),S===0&&(S=4194304)):S=er()===99?1:2:S=1),Q=oo(),v=Kd(v,S),v!==null&&(ua(v,S,Q),qo(v,Q))}var PD;PD=function(v,S,Q){var H=S.lanes;if(v!==null)if(v.memoizedProps!==S.pendingProps||vi.current)Ye=!0;else if(Q&H)Ye=!!(v.flags&16384);else{switch(Ye=!1,S.tag){case 3:Fd(S),p0();break;case 5:wu(S);break;case 1:qn(S.type)&&aa(S);break;case 4:u0(S,S.stateNode.containerInfo);break;case 10:o0(S,S.memoizedProps.value);break;case 13:if(S.memoizedState!==null)return Q&S.child.childLanes?PI(v,S,Q):(Bn(oi,oi.current&1),S=Mn(v,S,Q),S!==null?S.sibling:null);Bn(oi,oi.current&1);break;case 19:if(H=(Q&S.childLanes)!==0,v.flags&64){if(H)return cD(v,S,Q);S.flags|=64}var Y=S.memoizedState;if(Y!==null&&(Y.rendering=null,Y.tail=null,Y.lastEffect=null),Bn(oi,oi.current),H)break;return null;case 23:case 24:return S.lanes=0,ai(v,S,Q)}return Mn(v,S,Q)}else Ye=!1;switch(S.lanes=0,S.tag){case 2:if(H=S.type,v!==null&&(v.alternate=null,S.alternate=null,S.flags|=2),v=S.pendingProps,Y=un(S,ki.current),Eu(S,Q),Y=g0(null,S,H,v,Y,Q),S.flags|=1,typeof Y=="object"&&Y!==null&&typeof Y.render=="function"&&Y.$$typeof===void 0){if(S.tag=1,S.memoizedState=null,S.updateQueue=null,qn(H)){var ne=!0;aa(S)}else ne=!1;S.memoizedState=Y.state!==null&&Y.state!==void 0?Y.state:null,pp(S);var Be=H.getDerivedStateFromProps;typeof Be=="function"&&NA(S,H,Be,v),Y.updater=OA,S.stateNode=Y,Y._reactInternals=S,no(S,H,v,Q),S=SI(null,S,H,!0,ne,Q)}else S.tag=0,At(null,S,Y,Q),S=S.child;return S;case 16:Y=S.elementType;e:{switch(v!==null&&(v.alternate=null,S.alternate=null,S.flags|=2),v=S.pendingProps,ne=Y._init,Y=ne(Y._payload),S.type=Y,ne=S.tag=nR(Y),v=to(Y,v),ne){case 0:S=GA(null,S,Y,v,Q);break e;case 1:S=lD(null,S,Y,v,Q);break e;case 11:S=hr(null,S,Y,v,Q);break e;case 14:S=Ir(null,S,Y,to(Y.type,v),H,Q);break e}throw Error(u(306,Y,""))}return S;case 0:return H=S.type,Y=S.pendingProps,Y=S.elementType===H?Y:to(H,Y),GA(v,S,H,Y,Q);case 1:return H=S.type,Y=S.pendingProps,Y=S.elementType===H?Y:to(H,Y),lD(v,S,H,Y,Q);case 3:if(Fd(S),H=S.updateQueue,v===null||H===null)throw Error(u(282));if(H=S.pendingProps,Y=S.memoizedState,Y=Y!==null?Y.element:null,l0(v,S),LA(S,H,null,Q),H=S.memoizedState.element,H===Y)p0(),S=Mn(v,S,Q);else{if(Y=S.stateNode,(ne=Y.hydrate)&&(X?(Uo=dc(S.stateNode.containerInfo),ha=S,ne=ga=!0):ne=!1),ne){if(X&&(v=Y.mutableSourceEagerHydrationData,v!=null))for(Y=0;Y=jt&&ne>=Tr&&Y<=wr&&Be<=Xt){v.splice(S,1);break}else if(H!==jt||Q.width!==ft.width||XtBe){if(!(ne!==Tr||Q.height!==ft.height||wrY)){jt>H&&(ft.width+=jt-H,ft.x=H),wrne&&(ft.height+=Tr-ne,ft.y=ne),XtQ&&(Q=Be)),Be ")+` - -No matching component was found for: - `)+v.join(" > ")}return null},r.getPublicRootInstance=function(v){if(v=v.current,!v.child)return null;switch(v.child.tag){case 5:return Re(v.child.stateNode);default:return v.child.stateNode}},r.injectIntoDevTools=function(v){if(v={bundleType:v.bundleType,version:v.version,rendererPackageName:v.rendererPackageName,rendererConfig:v.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:A.ReactCurrentDispatcher,findHostInstanceByFiber:sR,findFiberByHostInstance:v.findFiberByHostInstance||oR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")v=!1;else{var S=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!S.isDisabled&&S.supportsFiber)try{Ze=S.inject(v),ca=S}catch{}v=!0}return v},r.observeVisibleRects=function(v,S,Q,H){if(!qt)throw Error(u(363));v=LI(v,S);var Y=Xr(v,Q,H).disconnect;return{disconnect:function(){Y()}}},r.registerMutableSourceForHydration=function(v,S){var Q=S._getVersion;Q=Q(S._source),v.mutableSourceEagerHydrationData==null?v.mutableSourceEagerHydrationData=[S,Q]:v.mutableSourceEagerHydrationData.push(S,Q)},r.runWithPriority=function(v,S){var Q=Bl;try{return Bl=v,S()}finally{Bl=Q}},r.shouldSuspend=function(){return!1},r.unbatchedUpdates=function(v,S){var Q=Pr;Pr&=-2,Pr|=8;try{return v(S)}finally{Pr=Q,Pr===0&&(ku(),Sn())}},r.updateContainer=function(v,S,Q,H){var Y=S.current,ne=oo(),Be=ss(Y);e:if(Q){Q=Q._reactInternals;t:{if(me(Q)!==Q||Q.tag!==1)throw Error(u(170));var Ue=Q;do{switch(Ue.tag){case 3:Ue=Ue.stateNode.context;break t;case 1:if(qn(Ue.type)){Ue=Ue.stateNode.__reactInternalMemoizedMergedChildContext;break t}}Ue=Ue.return}while(Ue!==null);throw Error(u(171))}if(Q.tag===1){var ft=Q.type;if(qn(ft)){Q=oa(Q,ft,Ue);break e}}Q=Ue}else Q=Lo;return S.context===null?S.context=Q:S.pendingContext=Q,S=Wa(ne,Be),S.payload={element:v},H=H===void 0?null:H,H!==null&&(S.callback=H),Ya(Y,S),Xa(Y,Be,ne),Be},r}});var ECe=_(($Yt,yCe)=>{"use strict";yCe.exports=mCe()});var ICe=_((eVt,CCe)=>{"use strict";var Syt={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};CCe.exports=Syt});var DCe=_((tVt,vCe)=>{"use strict";var Pyt=Object.assign||function(t){for(var e=1;e"}}]),t}(),wCe=function(){BQ(t,null,[{key:"fromJS",value:function(r){var o=r.width,a=r.height;return new t(o,a)}}]);function t(e,r){fq(this,t),this.width=e,this.height=r}return BQ(t,[{key:"fromJS",value:function(r){r(this.width,this.height)}},{key:"toString",value:function(){return""}}]),t}(),BCe=function(){function t(e,r){fq(this,t),this.unit=e,this.value=r}return BQ(t,[{key:"fromJS",value:function(r){r(this.unit,this.value)}},{key:"toString",value:function(){switch(this.unit){case au.UNIT_POINT:return String(this.value);case au.UNIT_PERCENT:return this.value+"%";case au.UNIT_AUTO:return"auto";default:return this.value+"?"}}},{key:"valueOf",value:function(){return this.value}}]),t}();vCe.exports=function(t,e){function r(u,A,p){var h=u[A];u[A]=function(){for(var E=arguments.length,w=Array(E),D=0;D1?w-1:0),b=1;b1&&arguments[1]!==void 0?arguments[1]:NaN,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:au.DIRECTION_LTR;return u.call(this,A,p,h)}),Pyt({Config:e.Config,Node:e.Node,Layout:t("Layout",xyt),Size:t("Size",wCe),Value:t("Value",BCe),getInstanceCount:function(){return e.getInstanceCount.apply(e,arguments)}},au)}});var SCe=_((exports,module)=>{(function(t,e){typeof define=="function"&&define.amd?define([],function(){return e}):typeof module=="object"&&module.exports?module.exports=e:(t.nbind=t.nbind||{}).init=e})(exports,function(Module,cb){typeof Module=="function"&&(cb=Module,Module={}),Module.onRuntimeInitialized=function(t,e){return function(){t&&t.apply(this,arguments);try{Module.ccall("nbind_init")}catch(r){e(r);return}e(null,{bind:Module._nbind_value,reflect:Module.NBind.reflect,queryType:Module.NBind.queryType,toggleLightGC:Module.toggleLightGC,lib:Module})}}(Module.onRuntimeInitialized,cb);var Module;Module||(Module=(typeof Module<"u"?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if(Module.ENVIRONMENT==="WEB")ENVIRONMENT_IS_WEB=!0;else if(Module.ENVIRONMENT==="WORKER")ENVIRONMENT_IS_WORKER=!0;else if(Module.ENVIRONMENT==="NODE")ENVIRONMENT_IS_NODE=!0;else if(Module.ENVIRONMENT==="SHELL")ENVIRONMENT_IS_SHELL=!0;else throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof ve=="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,r){nodeFS||(nodeFS={}("")),nodePath||(nodePath={}("")),e=nodePath.normalize(e);var o=nodeFS.readFileSync(e);return r?o:o.toString()},Module.readBinary=function(e){var r=Module.read(e,!0);return r.buffer||(r=new Uint8Array(r)),assert(r.buffer),r},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),typeof printErr<"u"&&(Module.printErr=printErr),typeof read<"u"?Module.read=read:Module.read=function(){throw"no read() available"},Module.readBinary=function(e){if(typeof readbuffer=="function")return new Uint8Array(readbuffer(e));var r=read(e,"binary");return assert(typeof r=="object"),r},typeof scriptArgs<"u"?Module.arguments=scriptArgs:typeof arguments<"u"&&(Module.arguments=arguments),typeof quit=="function"&&(Module.quit=function(t,e){quit(t)});else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(Module.read=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Module.readAsync=function(e,r,o){var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){a.status==200||a.status==0&&a.response?r(a.response):o()},a.onerror=o,a.send(null)},typeof arguments<"u"&&(Module.arguments=arguments),typeof console<"u")Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&typeof dump<"u"?function(t){dump(t)}:function(t){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),typeof Module.setWindowTitle>"u"&&(Module.setWindowTitle=function(t){document.title=t})}else throw"Unknown runtime environment. Where are we?";function globalEval(t){eval.call(null,t)}!Module.load&&Module.read&&(Module.load=function(e){globalEval(Module.read(e))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.quit||(Module.quit=function(t,e){throw e}),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(t){return tempRet0=t,t},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(t){STACKTOP=t},getNativeTypeSize:function(t){switch(t){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(t[t.length-1]==="*")return Runtime.QUANTUM_SIZE;if(t[0]==="i"){var e=parseInt(t.substr(1));return assert(e%8===0),e/8}else return 0}}},getNativeFieldSize:function(t){return Math.max(Runtime.getNativeTypeSize(t),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(t,e){return e==="double"||e==="i64"?t&7&&(assert((t&7)===4),t+=4):assert((t&3)===0),t},getAlignSize:function(t,e,r){return!r&&(t=="i64"||t=="double")?8:t?Math.min(e||(t?Runtime.getNativeFieldSize(t):0),Runtime.QUANTUM_SIZE):Math.min(e,8)},dynCall:function(t,e,r){return r&&r.length?Module["dynCall_"+t].apply(null,[e].concat(r)):Module["dynCall_"+t].call(null,e)},functionPointers:[],addFunction:function(t){for(var e=0;e>2],r=(e+t+15|0)&-16;if(HEAP32[DYNAMICTOP_PTR>>2]=r,r>=TOTAL_MEMORY){var o=enlargeMemory();if(!o)return HEAP32[DYNAMICTOP_PTR>>2]=e,0}return e},alignMemory:function(t,e){var r=t=Math.ceil(t/(e||16))*(e||16);return r},makeBigInt:function(t,e,r){var o=r?+(t>>>0)+ +(e>>>0)*4294967296:+(t>>>0)+ +(e|0)*4294967296;return o},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0;function assert(t,e){t||abort("Assertion failed: "+e)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(t){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(t){var e=Runtime.stackAlloc(t.length);return writeArrayToMemory(t,e),e},stringToC:function(t){var e=0;if(t!=null&&t!==0){var r=(t.length<<2)+1;e=Runtime.stackAlloc(r),stringToUTF8(t,e,r)}return e}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(e,r,o,a,n){var u=getCFunc(e),A=[],p=0;if(a)for(var h=0;h>0]=e;break;case"i8":HEAP8[t>>0]=e;break;case"i16":HEAP16[t>>1]=e;break;case"i32":HEAP32[t>>2]=e;break;case"i64":tempI64=[e>>>0,(tempDouble=e,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t>>2]=tempI64[0],HEAP32[t+4>>2]=tempI64[1];break;case"float":HEAPF32[t>>2]=e;break;case"double":HEAPF64[t>>3]=e;break;default:abort("invalid type for setValue: "+r)}}Module.setValue=setValue;function getValue(t,e,r){switch(e=e||"i8",e.charAt(e.length-1)==="*"&&(e="i32"),e){case"i1":return HEAP8[t>>0];case"i8":return HEAP8[t>>0];case"i16":return HEAP16[t>>1];case"i32":return HEAP32[t>>2];case"i64":return HEAP32[t>>2];case"float":return HEAPF32[t>>2];case"double":return HEAPF64[t>>3];default:abort("invalid type for setValue: "+e)}return null}Module.getValue=getValue;var ALLOC_NORMAL=0,ALLOC_STACK=1,ALLOC_STATIC=2,ALLOC_DYNAMIC=3,ALLOC_NONE=4;Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE;function allocate(t,e,r,o){var a,n;typeof t=="number"?(a=!0,n=t):(a=!1,n=t.length);var u=typeof e=="string"?e:null,A;if(r==ALLOC_NONE?A=o:A=[typeof _malloc=="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][r===void 0?ALLOC_STATIC:r](Math.max(n,u?1:e.length)),a){var o=A,p;for(assert((A&3)==0),p=A+(n&-4);o>2]=0;for(p=A+n;o>0]=0;return A}if(u==="i8")return t.subarray||t.slice?HEAPU8.set(t,A):HEAPU8.set(new Uint8Array(t),A),A;for(var h=0,E,w,D;h>0],r|=o,!(o==0&&!e||(a++,e&&a==e)););e||(e=a);var n="";if(r<128){for(var u=1024,A;e>0;)A=String.fromCharCode.apply(String,HEAPU8.subarray(t,t+Math.min(e,u))),n=n?n+A:A,t+=u,e-=u;return n}return Module.UTF8ToString(t)}Module.Pointer_stringify=Pointer_stringify;function AsciiToString(t){for(var e="";;){var r=HEAP8[t++>>0];if(!r)return e;e+=String.fromCharCode(r)}}Module.AsciiToString=AsciiToString;function stringToAscii(t,e){return writeAsciiToMemory(t,e,!1)}Module.stringToAscii=stringToAscii;var UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(t,e){for(var r=e;t[r];)++r;if(r-e>16&&t.subarray&&UTF8Decoder)return UTF8Decoder.decode(t.subarray(e,r));for(var o,a,n,u,A,p,h="";;){if(o=t[e++],!o)return h;if(!(o&128)){h+=String.fromCharCode(o);continue}if(a=t[e++]&63,(o&224)==192){h+=String.fromCharCode((o&31)<<6|a);continue}if(n=t[e++]&63,(o&240)==224?o=(o&15)<<12|a<<6|n:(u=t[e++]&63,(o&248)==240?o=(o&7)<<18|a<<12|n<<6|u:(A=t[e++]&63,(o&252)==248?o=(o&3)<<24|a<<18|n<<12|u<<6|A:(p=t[e++]&63,o=(o&1)<<30|a<<24|n<<18|u<<12|A<<6|p))),o<65536)h+=String.fromCharCode(o);else{var E=o-65536;h+=String.fromCharCode(55296|E>>10,56320|E&1023)}}}Module.UTF8ArrayToString=UTF8ArrayToString;function UTF8ToString(t){return UTF8ArrayToString(HEAPU8,t)}Module.UTF8ToString=UTF8ToString;function stringToUTF8Array(t,e,r,o){if(!(o>0))return 0;for(var a=r,n=r+o-1,u=0;u=55296&&A<=57343&&(A=65536+((A&1023)<<10)|t.charCodeAt(++u)&1023),A<=127){if(r>=n)break;e[r++]=A}else if(A<=2047){if(r+1>=n)break;e[r++]=192|A>>6,e[r++]=128|A&63}else if(A<=65535){if(r+2>=n)break;e[r++]=224|A>>12,e[r++]=128|A>>6&63,e[r++]=128|A&63}else if(A<=2097151){if(r+3>=n)break;e[r++]=240|A>>18,e[r++]=128|A>>12&63,e[r++]=128|A>>6&63,e[r++]=128|A&63}else if(A<=67108863){if(r+4>=n)break;e[r++]=248|A>>24,e[r++]=128|A>>18&63,e[r++]=128|A>>12&63,e[r++]=128|A>>6&63,e[r++]=128|A&63}else{if(r+5>=n)break;e[r++]=252|A>>30,e[r++]=128|A>>24&63,e[r++]=128|A>>18&63,e[r++]=128|A>>12&63,e[r++]=128|A>>6&63,e[r++]=128|A&63}}return e[r]=0,r-a}Module.stringToUTF8Array=stringToUTF8Array;function stringToUTF8(t,e,r){return stringToUTF8Array(t,HEAPU8,e,r)}Module.stringToUTF8=stringToUTF8;function lengthBytesUTF8(t){for(var e=0,r=0;r=55296&&o<=57343&&(o=65536+((o&1023)<<10)|t.charCodeAt(++r)&1023),o<=127?++e:o<=2047?e+=2:o<=65535?e+=3:o<=2097151?e+=4:o<=67108863?e+=5:e+=6}return e}Module.lengthBytesUTF8=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function demangle(t){var e=Module.___cxa_demangle||Module.__cxa_demangle;if(e){try{var r=t.substr(1),o=lengthBytesUTF8(r)+1,a=_malloc(o);stringToUTF8(r,a,o);var n=_malloc(4),u=e(a,0,0,n);if(getValue(n,"i32")===0&&u)return Pointer_stringify(u)}catch{}finally{a&&_free(a),n&&_free(n),u&&_free(u)}return t}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),t}function demangleAll(t){var e=/__Z[\w\d_]+/g;return t.replace(e,function(r){var o=demangle(r);return r===o?r:r+" ["+o+"]"})}function jsStackTrace(){var t=new Error;if(!t.stack){try{throw new Error(0)}catch(e){t=e}if(!t.stack)return"(no stack trace available)"}return t.stack.toString()}function stackTrace(){var t=jsStackTrace();return Module.extraStackTrace&&(t+=` -`+Module.extraStackTrace()),demangleAll(t)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY0;){var e=t.shift();if(typeof e=="function"){e();continue}var r=e.func;typeof r=="number"?e.arg===void 0?Module.dynCall_v(r):Module.dynCall_vi(r,e.arg):r(e.arg===void 0?null:e.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(t){__ATPRERUN__.unshift(t)}Module.addOnPreRun=addOnPreRun;function addOnInit(t){__ATINIT__.unshift(t)}Module.addOnInit=addOnInit;function addOnPreMain(t){__ATMAIN__.unshift(t)}Module.addOnPreMain=addOnPreMain;function addOnExit(t){__ATEXIT__.unshift(t)}Module.addOnExit=addOnExit;function addOnPostRun(t){__ATPOSTRUN__.unshift(t)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(t,e,r){var o=r>0?r:lengthBytesUTF8(t)+1,a=new Array(o),n=stringToUTF8Array(t,a,0,a.length);return e&&(a.length=n),a}Module.intArrayFromString=intArrayFromString;function intArrayToString(t){for(var e=[],r=0;r255&&(o&=255),e.push(String.fromCharCode(o))}return e.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(t,e,r){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var o,a;r&&(a=e+lengthBytesUTF8(t),o=HEAP8[a]),stringToUTF8(t,e,1/0),r&&(HEAP8[a]=o)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(t,e){HEAP8.set(t,e)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(t,e,r){for(var o=0;o>0]=t.charCodeAt(o);r||(HEAP8[e>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function t(e,r){var o=e>>>16,a=e&65535,n=r>>>16,u=r&65535;return a*u+(o*u+a*n<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(t){return froundBuffer[0]=t,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(t){t=t>>>0;for(var e=0;e<32;e++)if(t&1<<31-e)return e;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(t){return t}function addRunDependency(t){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}Module.addRunDependency=addRunDependency;function removeRunDependency(t){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),runDependencies==0&&(runDependencyWatcher!==null&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var e=dependenciesFulfilled;dependenciesFulfilled=null,e()}}Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(t,e,r,o,a,n,u,A){return _nbind.callbackSignatureList[t].apply(this,arguments)}];function _emscripten_asm_const_iiiiiiii(t,e,r,o,a,n,u,A){return ASM_CONSTS[t](e,r,o,a,n,u,A)}function _emscripten_asm_const_iiiii(t,e,r,o,a){return ASM_CONSTS[t](e,r,o,a)}function _emscripten_asm_const_iiidddddd(t,e,r,o,a,n,u,A,p){return ASM_CONSTS[t](e,r,o,a,n,u,A,p)}function _emscripten_asm_const_iiididi(t,e,r,o,a,n,u){return ASM_CONSTS[t](e,r,o,a,n,u)}function _emscripten_asm_const_iiii(t,e,r,o){return ASM_CONSTS[t](e,r,o)}function _emscripten_asm_const_iiiid(t,e,r,o,a){return ASM_CONSTS[t](e,r,o,a)}function _emscripten_asm_const_iiiiii(t,e,r,o,a,n){return ASM_CONSTS[t](e,r,o,a,n)}STATIC_BASE=Runtime.GLOBAL_BASE,STATICTOP=STATIC_BASE+12800,__ATINIT__.push({func:function(){__GLOBAL__sub_I_Yoga_cpp()}},{func:function(){__GLOBAL__sub_I_nbind_cc()}},{func:function(){__GLOBAL__sub_I_common_cc()}},{func:function(){__GLOBAL__sub_I_Binding_cc()}}),allocate([0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,192,127,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,128,191,0,0,128,191,0,0,192,127,0,0,0,0,0,0,0,0,0,0,128,63,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,190,12,0,0,200,12,0,0,208,12,0,0,216,12,0,0,230,12,0,0,242,12,0,0,1,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,192,127,3,0,0,0,180,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,182,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,4,0,0,0,183,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,184,45,0,0,185,45,0,0,181,45,0,0,181,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,148,4,0,0,3,0,0,0,187,45,0,0,164,4,0,0,188,45,0,0,2,0,0,0,189,45,0,0,164,4,0,0,188,45,0,0,185,45,0,0,164,4,0,0,185,45,0,0,164,4,0,0,188,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,6,0,0,0,1,0,0,0,7,0,0,0,183,45,0,0,182,45,0,0,181,45,0,0,190,45,0,0,190,45,0,0,182,45,0,0,182,45,0,0,185,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,185,45,0,0,48,5,0,0,3,0,0,0,56,5,0,0,1,0,0,0,189,45,0,0,185,45,0,0,164,4,0,0,76,5,0,0,2,0,0,0,191,45,0,0,186,45,0,0,182,45,0,0,185,45,0,0,192,45,0,0,185,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,76,5,0,0,76,5,0,0,136,5,0,0,182,45,0,0,181,45,0,0,2,0,0,0,190,45,0,0,136,5,0,0,56,19,0,0,156,5,0,0,2,0,0,0,184,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0,9,0,0,0,1,0,0,0,10,0,0,0,204,5,0,0,181,45,0,0,181,45,0,0,2,0,0,0,180,45,0,0,204,5,0,0,2,0,0,0,195,45,0,0,236,5,0,0,97,19,0,0,198,45,0,0,211,45,0,0,212,45,0,0,213,45,0,0,214,45,0,0,215,45,0,0,188,45,0,0,182,45,0,0,216,45,0,0,217,45,0,0,218,45,0,0,219,45,0,0,192,45,0,0,181,45,0,0,0,0,0,0,185,45,0,0,110,19,0,0,186,45,0,0,115,19,0,0,221,45,0,0,120,19,0,0,148,4,0,0,132,19,0,0,96,6,0,0,145,19,0,0,222,45,0,0,164,19,0,0,223,45,0,0,173,19,0,0,0,0,0,0,3,0,0,0,104,6,0,0,1,0,0,0,187,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,11,0,0,0,12,0,0,0,1,0,0,0,13,0,0,0,185,45,0,0,224,45,0,0,164,6,0,0,188,45,0,0,172,6,0,0,180,6,0,0,2,0,0,0,188,6,0,0,7,0,0,0,224,45,0,0,7,0,0,0,164,6,0,0,1,0,0,0,213,45,0,0,185,45,0,0,224,45,0,0,172,6,0,0,185,45,0,0,224,45,0,0,164,6,0,0,185,45,0,0,224,45,0,0,211,45,0,0,211,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,172,6,0,0,222,45,0,0,211,45,0,0,224,45,0,0,188,45,0,0,222,45,0,0,211,45,0,0,40,7,0,0,188,45,0,0,2,0,0,0,224,45,0,0,185,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,222,45,0,0,224,45,0,0,148,4,0,0,185,45,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,185,45,0,0,164,6,0,0,148,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,14,0,0,0,15,0,0,0,1,0,0,0,16,0,0,0,148,7,0,0,2,0,0,0,225,45,0,0,183,45,0,0,188,45,0,0,168,7,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,234,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,9,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,242,45,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,110,111,100,101,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,119,104,105,99,104,32,115,116,105,108,108,32,104,97,115,32,99,104,105,108,100,114,101,110,32,97,116,116,97,99,104,101,100,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,115,116,105,108,108,32,97,116,116,97,99,104,101,100,32,116,111,32,97,32,112,97,114,101,110,116,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,99,111,110,102,105,103,0,67,97,110,110,111,116,32,115,101,116,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,67,104,105,108,100,32,97,108,114,101,97,100,121,32,104,97,115,32,97,32,112,97,114,101,110,116,44,32,105,116,32,109,117,115,116,32,98,101,32,114,101,109,111,118,101,100,32,102,105,114,115,116,46,0,67,97,110,110,111,116,32,97,100,100,32,99,104,105,108,100,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,79,110,108,121,32,108,101,97,102,32,110,111,100,101,115,32,119,105,116,104,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,115,104,111,117,108,100,32,109,97,110,117,97,108,108,121,32,109,97,114,107,32,116,104,101,109,115,101,108,118,101,115,32,97,115,32,100,105,114,116,121,0,67,97,110,110,111,116,32,103,101,116,32,108,97,121,111,117,116,32,112,114,111,112,101,114,116,105,101,115,32,111,102,32,109,117,108,116,105,45,101,100,103,101,32,115,104,111,114,116,104,97,110,100,115,0,37,115,37,100,46,123,91,115,107,105,112,112,101,100,93,32,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,61,62,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,37,115,37,100,46,123,37,115,0,42,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,37,115,10,0,37,115,37,100,46,125,37,115,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,79,117,116,32,111,102,32,99,97,99,104,101,32,101,110,116,114,105,101,115,33,10,0,83,99,97,108,101,32,102,97,99,116,111,114,32,115,104,111,117,108,100,32,110,111,116,32,98,101,32,108,101,115,115,32,116,104,97,110,32,122,101,114,111,0,105,110,105,116,105,97,108,0,37,115,10,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,85,78,68,69,70,73,78,69,68,0,69,88,65,67,84,76,89,0,65,84,95,77,79,83,84,0,76,65,89,95,85,78,68,69,70,73,78,69,68,0,76,65,89,95,69,88,65,67,84,76,89,0,76,65,89,95,65,84,95,77,79,83,84,0,97,118,97,105,108,97,98,108,101,87,105,100,116,104,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,119,105,100,116,104,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,97,118,97,105,108,97,98,108,101,72,101,105,103,104,116,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,104,101,105,103,104,116,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,102,108,101,120,0,115,116,114,101,116,99,104,0,109,117,108,116,105,108,105,110,101,45,115,116,114,101,116,99,104,0,69,120,112,101,99,116,101,100,32,110,111,100,101,32,116,111,32,104,97,118,101,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,0,109,101,97,115,117,114,101,0,69,120,112,101,99,116,32,99,117,115,116,111,109,32,98,97,115,101,108,105,110,101,32,102,117,110,99,116,105,111,110,32,116,111,32,110,111,116,32,114,101,116,117,114,110,32,78,97,78,0,97,98,115,45,109,101,97,115,117,114,101,0,97,98,115,45,108,97,121,111,117,116,0,78,111,100,101,0,99,114,101,97,116,101,68,101,102,97,117,108,116,0,99,114,101,97,116,101,87,105,116,104,67,111,110,102,105,103,0,100,101,115,116,114,111,121,0,114,101,115,101,116,0,99,111,112,121,83,116,121,108,101,0,115,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,115,101,116,80,111,115,105,116,105,111,110,0,115,101,116,80,111,115,105,116,105,111,110,80,101,114,99,101,110,116,0,115,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,115,101,116,65,108,105,103,110,73,116,101,109,115,0,115,101,116,65,108,105,103,110,83,101,108,102,0,115,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,115,101,116,70,108,101,120,87,114,97,112,0,115,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,115,101,116,77,97,114,103,105,110,0,115,101,116,77,97,114,103,105,110,80,101,114,99,101,110,116,0,115,101,116,77,97,114,103,105,110,65,117,116,111,0,115,101,116,79,118,101,114,102,108,111,119,0,115,101,116,68,105,115,112,108,97,121,0,115,101,116,70,108,101,120,0,115,101,116,70,108,101,120,66,97,115,105,115,0,115,101,116,70,108,101,120,66,97,115,105,115,80,101,114,99,101,110,116,0,115,101,116,70,108,101,120,71,114,111,119,0,115,101,116,70,108,101,120,83,104,114,105,110,107,0,115,101,116,87,105,100,116,104,0,115,101,116,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,87,105,100,116,104,65,117,116,111,0,115,101,116,72,101,105,103,104,116,0,115,101,116,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,72,101,105,103,104,116,65,117,116,111,0,115,101,116,77,105,110,87,105,100,116,104,0,115,101,116,77,105,110,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,105,110,72,101,105,103,104,116,0,115,101,116,77,105,110,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,77,97,120,87,105,100,116,104,0,115,101,116,77,97,120,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,97,120,72,101,105,103,104,116,0,115,101,116,77,97,120,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,65,115,112,101,99,116,82,97,116,105,111,0,115,101,116,66,111,114,100,101,114,0,115,101,116,80,97,100,100,105,110,103,0,115,101,116,80,97,100,100,105,110,103,80,101,114,99,101,110,116,0,103,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,103,101,116,80,111,115,105,116,105,111,110,0,103,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,103,101,116,65,108,105,103,110,73,116,101,109,115,0,103,101,116,65,108,105,103,110,83,101,108,102,0,103,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,103,101,116,70,108,101,120,87,114,97,112,0,103,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,103,101,116,77,97,114,103,105,110,0,103,101,116,70,108,101,120,66,97,115,105,115,0,103,101,116,70,108,101,120,71,114,111,119,0,103,101,116,70,108,101,120,83,104,114,105,110,107,0,103,101,116,87,105,100,116,104,0,103,101,116,72,101,105,103,104,116,0,103,101,116,77,105,110,87,105,100,116,104,0,103,101,116,77,105,110,72,101,105,103,104,116,0,103,101,116,77,97,120,87,105,100,116,104,0,103,101,116,77,97,120,72,101,105,103,104,116,0,103,101,116,65,115,112,101,99,116,82,97,116,105,111,0,103,101,116,66,111,114,100,101,114,0,103,101,116,79,118,101,114,102,108,111,119,0,103,101,116,68,105,115,112,108,97,121,0,103,101,116,80,97,100,100,105,110,103,0,105,110,115,101,114,116,67,104,105,108,100,0,114,101,109,111,118,101,67,104,105,108,100,0,103,101,116,67,104,105,108,100,67,111,117,110,116,0,103,101,116,80,97,114,101,110,116,0,103,101,116,67,104,105,108,100,0,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,117,110,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,109,97,114,107,68,105,114,116,121,0,105,115,68,105,114,116,121,0,99,97,108,99,117,108,97,116,101,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,76,101,102,116,0,103,101,116,67,111,109,112,117,116,101,100,82,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,84,111,112,0,103,101,116,67,111,109,112,117,116,101,100,66,111,116,116,111,109,0,103,101,116,67,111,109,112,117,116,101,100,87,105,100,116,104,0,103,101,116,67,111,109,112,117,116,101,100,72,101,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,77,97,114,103,105,110,0,103,101,116,67,111,109,112,117,116,101,100,66,111,114,100,101,114,0,103,101,116,67,111,109,112,117,116,101,100,80,97,100,100,105,110,103,0,67,111,110,102,105,103,0,99,114,101,97,116,101,0,115,101,116,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,115,101,116,80,111,105,110,116,83,99,97,108,101,70,97,99,116,111,114,0,105,115,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,86,97,108,117,101,0,76,97,121,111,117,116,0,83,105,122,101,0,103,101,116,73,110,115,116,97,110,99,101,67,111,117,110,116,0,73,110,116,54,52,0,1,1,1,2,2,4,4,4,4,8,8,4,8,118,111,105,100,0,98,111,111,108,0,115,116,100,58,58,115,116,114,105,110,103,0,99,98,70,117,110,99,116,105,111,110,32,38,0,99,111,110,115,116,32,99,98,70,117,110,99,116,105,111,110,32,38,0,69,120,116,101,114,110,97,108,0,66,117,102,102,101,114,0,78,66,105,110,100,73,68,0,78,66,105,110,100,0,98,105,110,100,95,118,97,108,117,101,0,114,101,102,108,101,99,116,0,113,117,101,114,121,84,121,112,101,0,108,97,108,108,111,99,0,108,114,101,115,101,116,0,123,114,101,116,117,114,110,40,95,110,98,105,110,100,46,99,97,108,108,98,97,99,107,83,105,103,110,97,116,117,114,101,76,105,115,116,91,36,48,93,46,97,112,112,108,121,40,116,104,105,115,44,97,114,103,117,109,101,110,116,115,41,41,59,125,0,95,110,98,105,110,100,95,110,101,119,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,46,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);var tempDoublePtr=STATICTOP;STATICTOP+=16;function _atexit(t,e){__ATEXIT__.unshift({func:t,arg:e})}function ___cxa_atexit(){return _atexit.apply(null,arguments)}function _abort(){Module.abort()}function __ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj(){Module.printErr("missing function: _ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj"),abort(-1)}function __decorate(t,e,r,o){var a=arguments.length,n=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,o);else for(var A=t.length-1;A>=0;A--)(u=t[A])&&(n=(a<3?u(n):a>3?u(e,r,n):u(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function _defineHidden(t){return function(e,r){Object.defineProperty(e,r,{configurable:!1,enumerable:!1,value:t,writable:!0})}}var _nbind={};function __nbind_free_external(t){_nbind.externalList[t].dereference(t)}function __nbind_reference_external(t){_nbind.externalList[t].reference()}function _llvm_stackrestore(t){var e=_llvm_stacksave,r=e.LLVM_SAVEDSTACKS[t];e.LLVM_SAVEDSTACKS.splice(t,1),Runtime.stackRestore(r)}function __nbind_register_pool(t,e,r,o){_nbind.Pool.pageSize=t,_nbind.Pool.usedPtr=e/4,_nbind.Pool.rootPtr=r,_nbind.Pool.pagePtr=o/4,HEAP32[e/4]=16909060,HEAP8[e]==1&&(_nbind.bigEndian=!0),HEAP32[e/4]=0,_nbind.makeTypeKindTbl=(n={},n[1024]=_nbind.PrimitiveType,n[64]=_nbind.Int64Type,n[2048]=_nbind.BindClass,n[3072]=_nbind.BindClassPtr,n[4096]=_nbind.SharedClassPtr,n[5120]=_nbind.ArrayType,n[6144]=_nbind.ArrayType,n[7168]=_nbind.CStringType,n[9216]=_nbind.CallbackType,n[10240]=_nbind.BindType,n),_nbind.makeTypeNameTbl={Buffer:_nbind.BufferType,External:_nbind.ExternalType,Int64:_nbind.Int64Type,_nbind_new:_nbind.CreateValueType,bool:_nbind.BooleanType,"cbFunction &":_nbind.CallbackType,"const cbFunction &":_nbind.CallbackType,"const std::string &":_nbind.StringType,"std::string":_nbind.StringType},Module.toggleLightGC=_nbind.toggleLightGC,_nbind.callUpcast=Module.dynCall_ii;var a=_nbind.makeType(_nbind.constructType,{flags:2048,id:0,name:""});a.proto=Module,_nbind.BindClass.list.push(a);var n}function _emscripten_set_main_loop_timing(t,e){if(Browser.mainLoop.timingMode=t,Browser.mainLoop.timingValue=e,!Browser.mainLoop.func)return 1;if(t==0)Browser.mainLoop.scheduler=function(){var u=Math.max(0,Browser.mainLoop.tickStartTime+e-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,u)},Browser.mainLoop.method="timeout";else if(t==1)Browser.mainLoop.scheduler=function(){Browser.requestAnimationFrame(Browser.mainLoop.runner)},Browser.mainLoop.method="rAF";else if(t==2){if(!window.setImmediate){let n=function(u){u.source===window&&u.data===o&&(u.stopPropagation(),r.shift()())};var a=n,r=[],o="setimmediate";window.addEventListener("message",n,!0),window.setImmediate=function(A){r.push(A),ENVIRONMENT_IS_WORKER?(Module.setImmediates===void 0&&(Module.setImmediates=[]),Module.setImmediates.push(A),window.postMessage({target:o})):window.postMessage(o,"*")}}Browser.mainLoop.scheduler=function(){window.setImmediate(Browser.mainLoop.runner)},Browser.mainLoop.method="immediate"}return 0}function _emscripten_get_now(){abort()}function _emscripten_set_main_loop(t,e,r,o,a){Module.noExitRuntime=!0,assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Browser.mainLoop.func=t,Browser.mainLoop.arg=o;var n;typeof o<"u"?n=function(){Module.dynCall_vi(t,o)}:n=function(){Module.dynCall_v(t)};var u=Browser.mainLoop.currentlyRunningMainloop;if(Browser.mainLoop.runner=function(){if(!ABORT){if(Browser.mainLoop.queue.length>0){var p=Date.now(),h=Browser.mainLoop.queue.shift();if(h.func(h.arg),Browser.mainLoop.remainingBlockers){var E=Browser.mainLoop.remainingBlockers,w=E%1==0?E-1:Math.floor(E);h.counted?Browser.mainLoop.remainingBlockers=w:(w=w+.5,Browser.mainLoop.remainingBlockers=(8*E+w)/9)}if(console.log('main loop blocker "'+h.name+'" took '+(Date.now()-p)+" ms"),Browser.mainLoop.updateStatus(),u1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else Browser.mainLoop.timingMode==0&&(Browser.mainLoop.tickStartTime=_emscripten_get_now());Browser.mainLoop.method==="timeout"&&Module.ctx&&(Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Browser.mainLoop.method=""),Browser.mainLoop.runIter(n),!(u0?_emscripten_set_main_loop_timing(0,1e3/e):_emscripten_set_main_loop_timing(1,1),Browser.mainLoop.scheduler()),r)throw"SimulateInfiniteLoop"}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null,Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var t=Browser.mainLoop.timingMode,e=Browser.mainLoop.timingValue,r=Browser.mainLoop.func;Browser.mainLoop.func=null,_emscripten_set_main_loop(r,0,!1,Browser.mainLoop.arg,!0),_emscripten_set_main_loop_timing(t,e),Browser.mainLoop.scheduler()},updateStatus:function(){if(Module.setStatus){var t=Module.statusMessage||"Please wait...",e=Browser.mainLoop.remainingBlockers,r=Browser.mainLoop.expectedBlockers;e?e"u"&&(console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),Module.noImageDecoding=!0);var t={};t.canHandle=function(n){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(n)},t.handle=function(n,u,A,p){var h=null;if(Browser.hasBlobConstructor)try{h=new Blob([n],{type:Browser.getMimetype(u)}),h.size!==n.length&&(h=new Blob([new Uint8Array(n).buffer],{type:Browser.getMimetype(u)}))}catch(b){Runtime.warnOnce("Blob constructor present but fails: "+b+"; falling back to blob builder")}if(!h){var E=new Browser.BlobBuilder;E.append(new Uint8Array(n).buffer),h=E.getBlob()}var w=Browser.URLObject.createObjectURL(h),D=new Image;D.onload=function(){assert(D.complete,"Image "+u+" could not be decoded");var C=document.createElement("canvas");C.width=D.width,C.height=D.height;var T=C.getContext("2d");T.drawImage(D,0,0),Module.preloadedImages[u]=C,Browser.URLObject.revokeObjectURL(w),A&&A(n)},D.onerror=function(C){console.log("Image "+w+" could not be decoded"),p&&p()},D.src=w},Module.preloadPlugins.push(t);var e={};e.canHandle=function(n){return!Module.noAudioDecoding&&n.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},e.handle=function(n,u,A,p){var h=!1;function E(T){h||(h=!0,Module.preloadedAudios[u]=T,A&&A(n))}function w(){h||(h=!0,Module.preloadedAudios[u]=new Audio,p&&p())}if(Browser.hasBlobConstructor){try{var D=new Blob([n],{type:Browser.getMimetype(u)})}catch{return w()}var b=Browser.URLObject.createObjectURL(D),C=new Audio;C.addEventListener("canplaythrough",function(){E(C)},!1),C.onerror=function(N){if(h)return;console.log("warning: browser could not fully decode audio "+u+", trying slower base64 approach");function U(J){for(var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",le="=",ce="",ue=0,Ie=0,he=0;he=6;){var De=ue>>Ie-6&63;Ie-=6,ce+=te[De]}return Ie==2?(ce+=te[(ue&3)<<4],ce+=le+le):Ie==4&&(ce+=te[(ue&15)<<2],ce+=le),ce}C.src="data:audio/x-"+u.substr(-3)+";base64,"+U(n),E(C)},C.src=b,Browser.safeSetTimeout(function(){E(C)},1e4)}else return w()},Module.preloadPlugins.push(e);function r(){Browser.pointerLock=document.pointerLockElement===Module.canvas||document.mozPointerLockElement===Module.canvas||document.webkitPointerLockElement===Module.canvas||document.msPointerLockElement===Module.canvas}var o=Module.canvas;o&&(o.requestPointerLock=o.requestPointerLock||o.mozRequestPointerLock||o.webkitRequestPointerLock||o.msRequestPointerLock||function(){},o.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},o.exitPointerLock=o.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",r,!1),document.addEventListener("mozpointerlockchange",r,!1),document.addEventListener("webkitpointerlockchange",r,!1),document.addEventListener("mspointerlockchange",r,!1),Module.elementPointerLock&&o.addEventListener("click",function(a){!Browser.pointerLock&&Module.canvas.requestPointerLock&&(Module.canvas.requestPointerLock(),a.preventDefault())},!1))},createContext:function(t,e,r,o){if(e&&Module.ctx&&t==Module.canvas)return Module.ctx;var a,n;if(e){var u={antialias:!1,alpha:!1};if(o)for(var A in o)u[A]=o[A];n=GL.createContext(t,u),n&&(a=GL.getContext(n).GLctx)}else a=t.getContext("2d");return a?(r&&(e||assert(typeof GLctx>"u","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),Module.ctx=a,e&&GL.makeContextCurrent(n),Module.useWebGL=e,Browser.moduleContextCreatedCallbacks.forEach(function(p){p()}),Browser.init()),a):null},destroyContext:function(t,e,r){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen:function(t,e,r){Browser.lockPointer=t,Browser.resizeCanvas=e,Browser.vrDevice=r,typeof Browser.lockPointer>"u"&&(Browser.lockPointer=!0),typeof Browser.resizeCanvas>"u"&&(Browser.resizeCanvas=!1),typeof Browser.vrDevice>"u"&&(Browser.vrDevice=null);var o=Module.canvas;function a(){Browser.isFullscreen=!1;var u=o.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===u?(o.exitFullscreen=document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||function(){},o.exitFullscreen=o.exitFullscreen.bind(document),Browser.lockPointer&&o.requestPointerLock(),Browser.isFullscreen=!0,Browser.resizeCanvas&&Browser.setFullscreenCanvasSize()):(u.parentNode.insertBefore(o,u),u.parentNode.removeChild(u),Browser.resizeCanvas&&Browser.setWindowedCanvasSize()),Module.onFullScreen&&Module.onFullScreen(Browser.isFullscreen),Module.onFullscreen&&Module.onFullscreen(Browser.isFullscreen),Browser.updateCanvasDimensions(o)}Browser.fullscreenHandlersInstalled||(Browser.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("MSFullscreenChange",a,!1));var n=document.createElement("div");o.parentNode.insertBefore(n,o),n.appendChild(o),n.requestFullscreen=n.requestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen||(n.webkitRequestFullscreen?function(){n.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}:null)||(n.webkitRequestFullScreen?function(){n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),r?n.requestFullscreen({vrDisplay:r}):n.requestFullscreen()},requestFullScreen:function(t,e,r){return Module.printErr("Browser.requestFullScreen() is deprecated. Please call Browser.requestFullscreen instead."),Browser.requestFullScreen=function(o,a,n){return Browser.requestFullscreen(o,a,n)},Browser.requestFullscreen(t,e,r)},nextRAF:0,fakeRequestAnimationFrame:function(t){var e=Date.now();if(Browser.nextRAF===0)Browser.nextRAF=e+1e3/60;else for(;e+2>=Browser.nextRAF;)Browser.nextRAF+=1e3/60;var r=Math.max(Browser.nextRAF-e,0);setTimeout(t,r)},requestAnimationFrame:function t(e){typeof window>"u"?Browser.fakeRequestAnimationFrame(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||Browser.fakeRequestAnimationFrame),window.requestAnimationFrame(e))},safeCallback:function(t){return function(){if(!ABORT)return t.apply(null,arguments)}},allowAsyncCallbacks:!0,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=!1},resumeAsyncCallbacks:function(){if(Browser.allowAsyncCallbacks=!0,Browser.queuedAsyncCallbacks.length>0){var t=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[],t.forEach(function(e){e()})}},safeRequestAnimationFrame:function(t){return Browser.requestAnimationFrame(function(){ABORT||(Browser.allowAsyncCallbacks?t():Browser.queuedAsyncCallbacks.push(t))})},safeSetTimeout:function(t,e){return Module.noExitRuntime=!0,setTimeout(function(){ABORT||(Browser.allowAsyncCallbacks?t():Browser.queuedAsyncCallbacks.push(t))},e)},safeSetInterval:function(t,e){return Module.noExitRuntime=!0,setInterval(function(){ABORT||Browser.allowAsyncCallbacks&&t()},e)},getMimetype:function(t){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[t.substr(t.lastIndexOf(".")+1)]},getUserMedia:function(t){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(t)},getMovementX:function(t){return t.movementX||t.mozMovementX||t.webkitMovementX||0},getMovementY:function(t){return t.movementY||t.mozMovementY||t.webkitMovementY||0},getMouseWheelDelta:function(t){var e=0;switch(t.type){case"DOMMouseScroll":e=t.detail;break;case"mousewheel":e=t.wheelDelta;break;case"wheel":e=t.deltaY;break;default:throw"unrecognized mouse wheel event: "+t.type}return e},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(t){if(Browser.pointerLock)t.type!="mousemove"&&"mozMovementX"in t?Browser.mouseMovementX=Browser.mouseMovementY=0:(Browser.mouseMovementX=Browser.getMovementX(t),Browser.mouseMovementY=Browser.getMovementY(t)),typeof SDL<"u"?(Browser.mouseX=SDL.mouseX+Browser.mouseMovementX,Browser.mouseY=SDL.mouseY+Browser.mouseMovementY):(Browser.mouseX+=Browser.mouseMovementX,Browser.mouseY+=Browser.mouseMovementY);else{var e=Module.canvas.getBoundingClientRect(),r=Module.canvas.width,o=Module.canvas.height,a=typeof window.scrollX<"u"?window.scrollX:window.pageXOffset,n=typeof window.scrollY<"u"?window.scrollY:window.pageYOffset;if(t.type==="touchstart"||t.type==="touchend"||t.type==="touchmove"){var u=t.touch;if(u===void 0)return;var A=u.pageX-(a+e.left),p=u.pageY-(n+e.top);A=A*(r/e.width),p=p*(o/e.height);var h={x:A,y:p};if(t.type==="touchstart")Browser.lastTouches[u.identifier]=h,Browser.touches[u.identifier]=h;else if(t.type==="touchend"||t.type==="touchmove"){var E=Browser.touches[u.identifier];E||(E=h),Browser.lastTouches[u.identifier]=E,Browser.touches[u.identifier]=h}return}var w=t.pageX-(a+e.left),D=t.pageY-(n+e.top);w=w*(r/e.width),D=D*(o/e.height),Browser.mouseMovementX=w-Browser.mouseX,Browser.mouseMovementY=D-Browser.mouseY,Browser.mouseX=w,Browser.mouseY=D}},asyncLoad:function(t,e,r,o){var a=o?"":"al "+t;Module.readAsync(t,function(n){assert(n,'Loading data file "'+t+'" failed (no arrayBuffer).'),e(new Uint8Array(n)),a&&removeRunDependency(a)},function(n){if(r)r();else throw'Loading data file "'+t+'" failed.'}),a&&addRunDependency(a)},resizeListeners:[],updateResizeListeners:function(){var t=Module.canvas;Browser.resizeListeners.forEach(function(e){e(t.width,t.height)})},setCanvasSize:function(t,e,r){var o=Module.canvas;Browser.updateCanvasDimensions(o,t,e),r||Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL<"u"){var t=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];t=t|8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=t}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL<"u"){var t=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];t=t&-8388609,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=t}Browser.updateResizeListeners()},updateCanvasDimensions:function(t,e,r){e&&r?(t.widthNative=e,t.heightNative=r):(e=t.widthNative,r=t.heightNative);var o=e,a=r;if(Module.forcedAspectRatio&&Module.forcedAspectRatio>0&&(o/a>2];return e},getStr:function(){var t=Pointer_stringify(SYSCALLS.get());return t},get64:function(){var t=SYSCALLS.get(),e=SYSCALLS.get();return t>=0?assert(e===0):assert(e===-1),t},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall6(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.getStreamFromFD();return FS.close(r),0}catch(o){return(typeof FS>"u"||!(o instanceof FS.ErrnoError))&&abort(o),-o.errno}}function ___syscall54(t,e){SYSCALLS.varargs=e;try{return 0}catch(r){return(typeof FS>"u"||!(r instanceof FS.ErrnoError))&&abort(r),-r.errno}}function _typeModule(t){var e=[[0,1,"X"],[1,1,"const X"],[128,1,"X *"],[256,1,"X &"],[384,1,"X &&"],[512,1,"std::shared_ptr"],[640,1,"std::unique_ptr"],[5120,1,"std::vector"],[6144,2,"std::array"],[9216,-1,"std::function"]];function r(p,h,E,w,D,b){if(h==1){var C=w&896;(C==128||C==256||C==384)&&(p="X const")}var T;return b?T=E.replace("X",p).replace("Y",D):T=p.replace("X",E).replace("Y",D),T.replace(/([*&]) (?=[*&])/g,"$1")}function o(p,h,E,w,D){throw new Error(p+" type "+E.replace("X",h+"?")+(w?" with flag "+w:"")+" in "+D)}function a(p,h,E,w,D,b,C,T){b===void 0&&(b="X"),T===void 0&&(T=1);var N=E(p);if(N)return N;var U=w(p),J=U.placeholderFlag,te=e[J];C&&te&&(b=r(C[2],C[0],b,te[0],"?",!0));var le;J==0&&(le="Unbound"),J>=10&&(le="Corrupt"),T>20&&(le="Deeply nested"),le&&o(le,p,b,J,D||"?");var ce=U.paramList[0],ue=a(ce,h,E,w,D,b,te,T+1),Ie,he={flags:te[0],id:p,name:"",paramList:[ue]},De=[],Ee="?";switch(U.placeholderFlag){case 1:Ie=ue.spec;break;case 2:if((ue.flags&15360)==1024&&ue.spec.ptrSize==1){he.flags=7168;break}case 3:case 6:case 5:Ie=ue.spec,ue.flags&15360;break;case 8:Ee=""+U.paramList[1],he.paramList.push(U.paramList[1]);break;case 9:for(var g=0,me=U.paramList[1];g>2]=t),t}function _llvm_stacksave(){var t=_llvm_stacksave;return t.LLVM_SAVEDSTACKS||(t.LLVM_SAVEDSTACKS=[]),t.LLVM_SAVEDSTACKS.push(Runtime.stackSave()),t.LLVM_SAVEDSTACKS.length-1}function ___syscall140(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.getStreamFromFD(),o=SYSCALLS.get(),a=SYSCALLS.get(),n=SYSCALLS.get(),u=SYSCALLS.get(),A=a;return FS.llseek(r,A,u),HEAP32[n>>2]=r.position,r.getdents&&A===0&&u===0&&(r.getdents=null),0}catch(p){return(typeof FS>"u"||!(p instanceof FS.ErrnoError))&&abort(p),-p.errno}}function ___syscall146(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.get(),o=SYSCALLS.get(),a=SYSCALLS.get(),n=0;___syscall146.buffer||(___syscall146.buffers=[null,[],[]],___syscall146.printChar=function(E,w){var D=___syscall146.buffers[E];assert(D),w===0||w===10?((E===1?Module.print:Module.printErr)(UTF8ArrayToString(D,0)),D.length=0):D.push(w)});for(var u=0;u>2],p=HEAP32[o+(u*8+4)>>2],h=0;h"u"||!(E instanceof FS.ErrnoError))&&abort(E),-E.errno}}function __nbind_finish(){for(var t=0,e=_nbind.BindClass.list;tt.pageSize/2||e>t.pageSize-r){var o=_nbind.typeNameTbl.NBind.proto;return o.lalloc(e)}else return HEAPU32[t.usedPtr]=r+e,t.rootPtr+r},t.lreset=function(e,r){var o=HEAPU32[t.pagePtr];if(o){var a=_nbind.typeNameTbl.NBind.proto;a.lreset(e,r)}else HEAPU32[t.usedPtr]=e},t}();_nbind.Pool=Pool;function constructType(t,e){var r=t==10240?_nbind.makeTypeNameTbl[e.name]||_nbind.BindType:_nbind.makeTypeKindTbl[t],o=new r(e);return typeIdTbl[e.id]=o,_nbind.typeNameTbl[e.name]=o,o}_nbind.constructType=constructType;function getType(t){return typeIdTbl[t]}_nbind.getType=getType;function queryType(t){var e=HEAPU8[t],r=_nbind.structureList[e][1];t/=4,r<0&&(++t,r=HEAPU32[t]+1);var o=Array.prototype.slice.call(HEAPU32.subarray(t+1,t+1+r));return e==9&&(o=[o[0],o.slice(1)]),{paramList:o,placeholderFlag:e}}_nbind.queryType=queryType;function getTypes(t,e){return t.map(function(r){return typeof r=="number"?_nbind.getComplexType(r,constructType,getType,queryType,e):_nbind.typeNameTbl[r]})}_nbind.getTypes=getTypes;function readTypeIdList(t,e){return Array.prototype.slice.call(HEAPU32,t/4,t/4+e)}_nbind.readTypeIdList=readTypeIdList;function readAsciiString(t){for(var e=t;HEAPU8[e++];);return String.fromCharCode.apply("",HEAPU8.subarray(t,e-1))}_nbind.readAsciiString=readAsciiString;function readPolicyList(t){var e={};if(t)for(;;){var r=HEAPU32[t/4];if(!r)break;e[readAsciiString(r)]=!0,t+=4}return e}_nbind.readPolicyList=readPolicyList;function getDynCall(t,e){var r={float32_t:"d",float64_t:"d",int64_t:"d",uint64_t:"d",void:"v"},o=t.map(function(n){return r[n.name]||"i"}).join(""),a=Module["dynCall_"+o];if(!a)throw new Error("dynCall_"+o+" not found for "+e+"("+t.map(function(n){return n.name}).join(", ")+")");return a}_nbind.getDynCall=getDynCall;function addMethod(t,e,r,o){var a=t[e];t.hasOwnProperty(e)&&a?((a.arity||a.arity===0)&&(a=_nbind.makeOverloader(a,a.arity),t[e]=a),a.addMethod(r,o)):(r.arity=o,t[e]=r)}_nbind.addMethod=addMethod;function throwError(t){throw new Error(t)}_nbind.throwError=throwError,_nbind.bigEndian=!1,_a=_typeModule(_typeModule),_nbind.Type=_a.Type,_nbind.makeType=_a.makeType,_nbind.getComplexType=_a.getComplexType,_nbind.structureList=_a.structureList;var BindType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.heap=HEAPU32,r.ptrSize=4,r}return e.prototype.needsWireRead=function(r){return!!this.wireRead||!!this.makeWireRead},e.prototype.needsWireWrite=function(r){return!!this.wireWrite||!!this.makeWireWrite},e}(_nbind.Type);_nbind.BindType=BindType;var PrimitiveType=function(t){__extends(e,t);function e(r){var o=t.call(this,r)||this,a=r.flags&32?{32:HEAPF32,64:HEAPF64}:r.flags&8?{8:HEAPU8,16:HEAPU16,32:HEAPU32}:{8:HEAP8,16:HEAP16,32:HEAP32};return o.heap=a[r.ptrSize*8],o.ptrSize=r.ptrSize,o}return e.prototype.needsWireWrite=function(r){return!!r&&!!r.Strict},e.prototype.makeWireWrite=function(r,o){return o&&o.Strict&&function(a){if(typeof a=="number")return a;throw new Error("Type mismatch")}},e}(BindType);_nbind.PrimitiveType=PrimitiveType;function pushCString(t,e){if(t==null){if(e&&e.Nullable)return 0;throw new Error("Type mismatch")}if(e&&e.Strict){if(typeof t!="string")throw new Error("Type mismatch")}else t=t.toString();var r=Module.lengthBytesUTF8(t)+1,o=_nbind.Pool.lalloc(r);return Module.stringToUTF8Array(t,HEAPU8,o,r),o}_nbind.pushCString=pushCString;function popCString(t){return t===0?null:Module.Pointer_stringify(t)}_nbind.popCString=popCString;var CStringType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.wireRead=popCString,r.wireWrite=pushCString,r.readResources=[_nbind.resources.pool],r.writeResources=[_nbind.resources.pool],r}return e.prototype.makeWireWrite=function(r,o){return function(a){return pushCString(a,o)}},e}(BindType);_nbind.CStringType=CStringType;var BooleanType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.wireRead=function(o){return!!o},r}return e.prototype.needsWireWrite=function(r){return!!r&&!!r.Strict},e.prototype.makeWireRead=function(r){return"!!("+r+")"},e.prototype.makeWireWrite=function(r,o){return o&&o.Strict&&function(a){if(typeof a=="boolean")return a;throw new Error("Type mismatch")}||r},e}(BindType);_nbind.BooleanType=BooleanType;var Wrapper=function(){function t(){}return t.prototype.persist=function(){this.__nbindState|=1},t}();_nbind.Wrapper=Wrapper;function makeBound(t,e){var r=function(o){__extends(a,o);function a(n,u,A,p){var h=o.call(this)||this;if(!(h instanceof a))return new(Function.prototype.bind.apply(a,Array.prototype.concat.apply([null],arguments)));var E=u,w=A,D=p;if(n!==_nbind.ptrMarker){var b=h.__nbindConstructor.apply(h,arguments);E=4608,D=HEAPU32[b/4],w=HEAPU32[b/4+1]}var C={configurable:!0,enumerable:!1,value:null,writable:!1},T={__nbindFlags:E,__nbindPtr:w};D&&(T.__nbindShared=D,_nbind.mark(h));for(var N=0,U=Object.keys(T);N>=1;var r=_nbind.valueList[t];return _nbind.valueList[t]=firstFreeValue,firstFreeValue=t,r}else{if(e)return _nbind.popShared(t,e);throw new Error("Invalid value slot "+t)}}_nbind.popValue=popValue;var valueBase=18446744073709552e3;function push64(t){return typeof t=="number"?t:pushValue(t)*4096+valueBase}function pop64(t){return t=3?u=Buffer.from(n):u=new Buffer(n),u.copy(o)}else getBuffer(o).set(n)}}_nbind.commitBuffer=commitBuffer;var dirtyList=[],gcTimer=0;function sweep(){for(var t=0,e=dirtyList;t>2]=DYNAMIC_BASE,staticSealed=!0;function invoke_viiiii(t,e,r,o,a,n){try{Module.dynCall_viiiii(t,e,r,o,a,n)}catch(u){if(typeof u!="number"&&u!=="longjmp")throw u;Module.setThrew(1,0)}}function invoke_vif(t,e,r){try{Module.dynCall_vif(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_vid(t,e,r){try{Module.dynCall_vid(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_fiff(t,e,r,o){try{return Module.dynCall_fiff(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_vi(t,e){try{Module.dynCall_vi(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_vii(t,e,r){try{Module.dynCall_vii(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_ii(t,e){try{return Module.dynCall_ii(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_viddi(t,e,r,o,a){try{Module.dynCall_viddi(t,e,r,o,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}function invoke_vidd(t,e,r,o){try{Module.dynCall_vidd(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_iiii(t,e,r,o){try{return Module.dynCall_iiii(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_diii(t,e,r,o){try{return Module.dynCall_diii(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_di(t,e){try{return Module.dynCall_di(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_iid(t,e,r){try{return Module.dynCall_iid(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_iii(t,e,r){try{return Module.dynCall_iii(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_viiddi(t,e,r,o,a,n){try{Module.dynCall_viiddi(t,e,r,o,a,n)}catch(u){if(typeof u!="number"&&u!=="longjmp")throw u;Module.setThrew(1,0)}}function invoke_viiiiii(t,e,r,o,a,n,u){try{Module.dynCall_viiiiii(t,e,r,o,a,n,u)}catch(A){if(typeof A!="number"&&A!=="longjmp")throw A;Module.setThrew(1,0)}}function invoke_dii(t,e,r){try{return Module.dynCall_dii(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_i(t){try{return Module.dynCall_i(t)}catch(e){if(typeof e!="number"&&e!=="longjmp")throw e;Module.setThrew(1,0)}}function invoke_iiiiii(t,e,r,o,a,n){try{return Module.dynCall_iiiiii(t,e,r,o,a,n)}catch(u){if(typeof u!="number"&&u!=="longjmp")throw u;Module.setThrew(1,0)}}function invoke_viiid(t,e,r,o,a){try{Module.dynCall_viiid(t,e,r,o,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}function invoke_viififi(t,e,r,o,a,n,u){try{Module.dynCall_viififi(t,e,r,o,a,n,u)}catch(A){if(typeof A!="number"&&A!=="longjmp")throw A;Module.setThrew(1,0)}}function invoke_viii(t,e,r,o){try{Module.dynCall_viii(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_v(t){try{Module.dynCall_v(t)}catch(e){if(typeof e!="number"&&e!=="longjmp")throw e;Module.setThrew(1,0)}}function invoke_viid(t,e,r,o){try{Module.dynCall_viid(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_idd(t,e,r){try{return Module.dynCall_idd(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_viiii(t,e,r,o,a){try{Module.dynCall_viiii(t,e,r,o,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}Module.asmGlobalArg={Math,Int8Array,Int16Array,Int32Array,Uint8Array,Uint16Array,Uint32Array,Float32Array,Float64Array,NaN:NaN,Infinity:1/0},Module.asmLibraryArg={abort,assert,enlargeMemory,getTotalMemory,abortOnCannotGrowMemory,invoke_viiiii,invoke_vif,invoke_vid,invoke_fiff,invoke_vi,invoke_vii,invoke_ii,invoke_viddi,invoke_vidd,invoke_iiii,invoke_diii,invoke_di,invoke_iid,invoke_iii,invoke_viiddi,invoke_viiiiii,invoke_dii,invoke_i,invoke_iiiiii,invoke_viiid,invoke_viififi,invoke_viii,invoke_v,invoke_viid,invoke_idd,invoke_viiii,_emscripten_asm_const_iiiii,_emscripten_asm_const_iiidddddd,_emscripten_asm_const_iiiid,__nbind_reference_external,_emscripten_asm_const_iiiiiiii,_removeAccessorPrefix,_typeModule,__nbind_register_pool,__decorate,_llvm_stackrestore,___cxa_atexit,__extends,__nbind_get_value_object,__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,_emscripten_set_main_loop_timing,__nbind_register_primitive,__nbind_register_type,_emscripten_memcpy_big,__nbind_register_function,___setErrNo,__nbind_register_class,__nbind_finish,_abort,_nbind_value,_llvm_stacksave,___syscall54,_defineHidden,_emscripten_set_main_loop,_emscripten_get_now,__nbind_register_callback_signature,_emscripten_asm_const_iiiiii,__nbind_free_external,_emscripten_asm_const_iiii,_emscripten_asm_const_iiididi,___syscall6,_atexit,___syscall140,___syscall146,DYNAMICTOP_PTR,tempDoublePtr,ABORT,STACKTOP,STACK_MAX,cttz_i8,___dso_handle};var asm=function(t,e,r){var o=new t.Int8Array(r),a=new t.Int16Array(r),n=new t.Int32Array(r),u=new t.Uint8Array(r),A=new t.Uint16Array(r),p=new t.Uint32Array(r),h=new t.Float32Array(r),E=new t.Float64Array(r),w=e.DYNAMICTOP_PTR|0,D=e.tempDoublePtr|0,b=e.ABORT|0,C=e.STACKTOP|0,T=e.STACK_MAX|0,N=e.cttz_i8|0,U=e.___dso_handle|0,J=0,te=0,le=0,ce=0,ue=t.NaN,Ie=t.Infinity,he=0,De=0,Ee=0,g=0,me=0,Ce=0,fe=t.Math.floor,ie=t.Math.abs,Z=t.Math.sqrt,Se=t.Math.pow,Re=t.Math.cos,ht=t.Math.sin,q=t.Math.tan,nt=t.Math.acos,Le=t.Math.asin,Te=t.Math.atan,ke=t.Math.atan2,Ke=t.Math.exp,xe=t.Math.log,tt=t.Math.ceil,He=t.Math.imul,x=t.Math.min,I=t.Math.max,P=t.Math.clz32,y=t.Math.fround,R=e.abort,z=e.assert,X=e.enlargeMemory,$=e.getTotalMemory,se=e.abortOnCannotGrowMemory,be=e.invoke_viiiii,Fe=e.invoke_vif,lt=e.invoke_vid,Et=e.invoke_fiff,qt=e.invoke_vi,nr=e.invoke_vii,Pt=e.invoke_ii,cn=e.invoke_viddi,Sr=e.invoke_vidd,yr=e.invoke_iiii,Rr=e.invoke_diii,Xr=e.invoke_di,$n=e.invoke_iid,Xs=e.invoke_iii,Hi=e.invoke_viiddi,Qs=e.invoke_viiiiii,Zs=e.invoke_dii,bi=e.invoke_i,Fs=e.invoke_iiiiii,$s=e.invoke_viiid,PA=e.invoke_viififi,gu=e.invoke_viii,op=e.invoke_v,ap=e.invoke_viid,Rs=e.invoke_idd,Nn=e.invoke_viiii,hs=e._emscripten_asm_const_iiiii,Ts=e._emscripten_asm_const_iiidddddd,pc=e._emscripten_asm_const_iiiid,hc=e.__nbind_reference_external,gc=e._emscripten_asm_const_iiiiiiii,xA=e._removeAccessorPrefix,bA=e._typeModule,Ro=e.__nbind_register_pool,To=e.__decorate,kA=e._llvm_stackrestore,pr=e.___cxa_atexit,Me=e.__extends,ia=e.__nbind_get_value_object,dc=e.__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,Er=e._emscripten_set_main_loop_timing,du=e.__nbind_register_primitive,QA=e.__nbind_register_type,FA=e._emscripten_memcpy_big,mc=e.__nbind_register_function,yc=e.___setErrNo,Il=e.__nbind_register_class,we=e.__nbind_finish,Tt=e._abort,wl=e._nbind_value,Bi=e._llvm_stacksave,Ls=e.___syscall54,Ft=e._defineHidden,Bn=e._emscripten_set_main_loop,Lo=e._emscripten_get_now,ki=e.__nbind_register_callback_signature,vi=e._emscripten_asm_const_iiiiii,sa=e.__nbind_free_external,un=e._emscripten_asm_const_iiii,qn=e._emscripten_asm_const_iiididi,Ec=e.___syscall6,lp=e._atexit,oa=e.___syscall140,aa=e.___syscall146,la=y(0);let Ze=y(0);function ca(s){s=s|0;var l=0;return l=C,C=C+s|0,C=C+15&-16,l|0}function mu(){return C|0}function Bl(s){s=s|0,C=s}function dn(s,l){s=s|0,l=l|0,C=s,T=l}function No(s,l){s=s|0,l=l|0,J||(J=s,te=l)}function RA(s){s=s|0,Ce=s}function TA(){return Ce|0}function Oo(){var s=0,l=0;br(8104,8,400)|0,br(8504,408,540)|0,s=9044,l=s+44|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));o[9088]=0,o[9089]=1,n[2273]=0,n[2274]=948,n[2275]=948,pr(17,8104,U|0)|0}function qa(s){s=s|0,gt(s+948|0)}function Ot(s){return s=y(s),((AD(s)|0)&2147483647)>>>0>2139095040|0}function vn(s,l,c){s=s|0,l=l|0,c=c|0;e:do if(n[s+(l<<3)+4>>2]|0)s=s+(l<<3)|0;else{if((l|2|0)==3&&n[s+60>>2]|0){s=s+56|0;break}switch(l|0){case 0:case 2:case 4:case 5:{if(n[s+52>>2]|0){s=s+48|0;break e}break}default:}if(n[s+68>>2]|0){s=s+64|0;break}else{s=(l|1|0)==5?948:c;break}}while(!1);return s|0}function Mo(s){s=s|0;var l=0;return l=_D(1e3)|0,ua(s,(l|0)!=0,2456),n[2276]=(n[2276]|0)+1,br(l|0,8104,1e3)|0,o[s+2>>0]|0&&(n[l+4>>2]=2,n[l+12>>2]=4),n[l+976>>2]=s,l|0}function ua(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;d=C,C=C+16|0,f=d,l||(n[f>>2]=c,d0(s,5,3197,f)),C=d}function qi(){return Mo(956)|0}function vl(s){s=s|0;var l=0;return l=Yt(1e3)|0,Cc(l,s),ua(n[s+976>>2]|0,1,2456),n[2276]=(n[2276]|0)+1,n[l+944>>2]=0,l|0}function Cc(s,l){s=s|0,l=l|0;var c=0;br(s|0,l|0,948)|0,Qd(s+948|0,l+948|0),c=s+960|0,s=l+960|0,l=c+40|0;do n[c>>2]=n[s>>2],c=c+4|0,s=s+4|0;while((c|0)<(l|0))}function Dl(s){s=s|0;var l=0,c=0,f=0,d=0;if(l=s+944|0,c=n[l>>2]|0,c|0&&(Aa(c+948|0,s)|0,n[l>>2]=0),c=Di(s)|0,c|0){l=0;do n[(rs(s,l)|0)+944>>2]=0,l=l+1|0;while((l|0)!=(c|0))}c=s+948|0,f=n[c>>2]|0,d=s+952|0,l=n[d>>2]|0,(l|0)!=(f|0)&&(n[d>>2]=l+(~((l+-4-f|0)>>>2)<<2)),ja(c),HD(s),n[2276]=(n[2276]|0)+-1}function Aa(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0;f=n[s>>2]|0,k=s+4|0,c=n[k>>2]|0,m=c;e:do if((f|0)==(c|0))d=f,B=4;else for(s=f;;){if((n[s>>2]|0)==(l|0)){d=s,B=4;break e}if(s=s+4|0,(s|0)==(c|0)){s=0;break}}while(!1);return(B|0)==4&&((d|0)!=(c|0)?(f=d+4|0,s=m-f|0,l=s>>2,l&&(rw(d|0,f|0,s|0)|0,c=n[k>>2]|0),s=d+(l<<2)|0,(c|0)==(s|0)||(n[k>>2]=c+(~((c+-4-s|0)>>>2)<<2)),s=1):s=0),s|0}function Di(s){return s=s|0,(n[s+952>>2]|0)-(n[s+948>>2]|0)>>2|0}function rs(s,l){s=s|0,l=l|0;var c=0;return c=n[s+948>>2]|0,(n[s+952>>2]|0)-c>>2>>>0>l>>>0?s=n[c+(l<<2)>>2]|0:s=0,s|0}function ja(s){s=s|0;var l=0,c=0,f=0,d=0;f=C,C=C+32|0,l=f,d=n[s>>2]|0,c=(n[s+4>>2]|0)-d|0,((n[s+8>>2]|0)-d|0)>>>0>c>>>0&&(d=c>>2,Ld(l,d,d,s+8|0),fD(s,l),Nd(l)),C=f}function yu(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0;M=Di(s)|0;do if(M|0){if((n[(rs(s,0)|0)+944>>2]|0)==(s|0)){if(!(Aa(s+948|0,l)|0))break;br(l+400|0,8504,540)|0,n[l+944>>2]=0,Ne(s);break}B=n[(n[s+976>>2]|0)+12>>2]|0,k=s+948|0,F=(B|0)==0,c=0,m=0;do f=n[(n[k>>2]|0)+(m<<2)>>2]|0,(f|0)==(l|0)?Ne(s):(d=vl(f)|0,n[(n[k>>2]|0)+(c<<2)>>2]=d,n[d+944>>2]=s,F||hT[B&15](f,d,s,c),c=c+1|0),m=m+1|0;while((m|0)!=(M|0));if(c>>>0>>0){F=s+948|0,k=s+952|0,B=c,c=n[k>>2]|0;do m=(n[F>>2]|0)+(B<<2)|0,f=m+4|0,d=c-f|0,l=d>>2,l&&(rw(m|0,f|0,d|0)|0,c=n[k>>2]|0),d=c,f=m+(l<<2)|0,(d|0)!=(f|0)&&(c=d+(~((d+-4-f|0)>>>2)<<2)|0,n[k>>2]=c),B=B+1|0;while((B|0)!=(M|0))}}while(!1)}function Sl(s){s=s|0;var l=0,c=0,f=0,d=0;pi(s,(Di(s)|0)==0,2491),pi(s,(n[s+944>>2]|0)==0,2545),l=s+948|0,c=n[l>>2]|0,f=s+952|0,d=n[f>>2]|0,(d|0)!=(c|0)&&(n[f>>2]=d+(~((d+-4-c|0)>>>2)<<2)),ja(l),l=s+976|0,c=n[l>>2]|0,br(s|0,8104,1e3)|0,o[c+2>>0]|0&&(n[s+4>>2]=2,n[s+12>>2]=4),n[l>>2]=c}function pi(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;d=C,C=C+16|0,f=d,l||(n[f>>2]=c,so(s,5,3197,f)),C=d}function Dn(){return n[2276]|0}function Pl(){var s=0;return s=_D(20)|0,Je((s|0)!=0,2592),n[2277]=(n[2277]|0)+1,n[s>>2]=n[239],n[s+4>>2]=n[240],n[s+8>>2]=n[241],n[s+12>>2]=n[242],n[s+16>>2]=n[243],s|0}function Je(s,l){s=s|0,l=l|0;var c=0,f=0;f=C,C=C+16|0,c=f,s||(n[c>>2]=l,so(0,5,3197,c)),C=f}function st(s){s=s|0,HD(s),n[2277]=(n[2277]|0)+-1}function vt(s,l){s=s|0,l=l|0;var c=0;l?(pi(s,(Di(s)|0)==0,2629),c=1):(c=0,l=0),n[s+964>>2]=l,n[s+988>>2]=c}function ar(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,m=f+8|0,d=f+4|0,B=f,n[d>>2]=l,pi(s,(n[l+944>>2]|0)==0,2709),pi(s,(n[s+964>>2]|0)==0,2763),ee(s),l=s+948|0,n[B>>2]=(n[l>>2]|0)+(c<<2),n[m>>2]=n[B>>2],ye(l,m,d)|0,n[(n[d>>2]|0)+944>>2]=s,Ne(s),C=f}function ee(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;if(c=Di(s)|0,c|0&&(n[(rs(s,0)|0)+944>>2]|0)!=(s|0)){f=n[(n[s+976>>2]|0)+12>>2]|0,d=s+948|0,m=(f|0)==0,l=0;do B=n[(n[d>>2]|0)+(l<<2)>>2]|0,k=vl(B)|0,n[(n[d>>2]|0)+(l<<2)>>2]=k,n[k+944>>2]=s,m||hT[f&15](B,k,s,l),l=l+1|0;while((l|0)!=(c|0))}}function ye(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0,rt=0,Xe=0;rt=C,C=C+64|0,j=rt+52|0,k=rt+48|0,oe=rt+28|0,We=rt+24|0,Oe=rt+20|0,Qe=rt,f=n[s>>2]|0,m=f,l=f+((n[l>>2]|0)-m>>2<<2)|0,f=s+4|0,d=n[f>>2]|0,B=s+8|0;do if(d>>>0<(n[B>>2]|0)>>>0){if((l|0)==(d|0)){n[l>>2]=n[c>>2],n[f>>2]=(n[f>>2]|0)+4;break}pD(s,l,d,l+4|0),l>>>0<=c>>>0&&(c=(n[f>>2]|0)>>>0>c>>>0?c+4|0:c),n[l>>2]=n[c>>2]}else{f=(d-m>>2)+1|0,d=L(s)|0,d>>>0>>0&&Zr(s),O=n[s>>2]|0,M=(n[B>>2]|0)-O|0,m=M>>1,Ld(Qe,M>>2>>>0>>1>>>0?m>>>0>>0?f:m:d,l-O>>2,s+8|0),O=Qe+8|0,f=n[O>>2]|0,m=Qe+12|0,M=n[m>>2]|0,B=M,F=f;do if((f|0)==(M|0)){if(M=Qe+4|0,f=n[M>>2]|0,Xe=n[Qe>>2]|0,d=Xe,f>>>0<=Xe>>>0){f=B-d>>1,f=f|0?f:1,Ld(oe,f,f>>>2,n[Qe+16>>2]|0),n[We>>2]=n[M>>2],n[Oe>>2]=n[O>>2],n[k>>2]=n[We>>2],n[j>>2]=n[Oe>>2],QI(oe,k,j),f=n[Qe>>2]|0,n[Qe>>2]=n[oe>>2],n[oe>>2]=f,f=oe+4|0,Xe=n[M>>2]|0,n[M>>2]=n[f>>2],n[f>>2]=Xe,f=oe+8|0,Xe=n[O>>2]|0,n[O>>2]=n[f>>2],n[f>>2]=Xe,f=oe+12|0,Xe=n[m>>2]|0,n[m>>2]=n[f>>2],n[f>>2]=Xe,Nd(oe),f=n[O>>2]|0;break}m=f,B=((m-d>>2)+1|0)/-2|0,k=f+(B<<2)|0,d=F-m|0,m=d>>2,m&&(rw(k|0,f|0,d|0)|0,f=n[M>>2]|0),Xe=k+(m<<2)|0,n[O>>2]=Xe,n[M>>2]=f+(B<<2),f=Xe}while(!1);n[f>>2]=n[c>>2],n[O>>2]=(n[O>>2]|0)+4,l=hD(s,Qe,l)|0,Nd(Qe)}while(!1);return C=rt,l|0}function Ne(s){s=s|0;var l=0;do{if(l=s+984|0,o[l>>0]|0)break;o[l>>0]=1,h[s+504>>2]=y(ue),s=n[s+944>>2]|0}while(s|0)}function gt(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-4-f|0)>>>2)<<2)),yt(c))}function mt(s){return s=s|0,n[s+944>>2]|0}function Dt(s){s=s|0,pi(s,(n[s+964>>2]|0)!=0,2832),Ne(s)}function er(s){return s=s|0,(o[s+984>>0]|0)!=0|0}function sn(s,l){s=s|0,l=l|0,wUe(s,l,400)|0&&(br(s|0,l|0,400)|0,Ne(s))}function ei(s){s=s|0;var l=Ze;return l=y(h[s+44>>2]),s=Ot(l)|0,y(s?y(0):l)}function Qi(s){s=s|0;var l=Ze;return l=y(h[s+48>>2]),Ot(l)|0&&(l=o[(n[s+976>>2]|0)+2>>0]|0?y(1):y(0)),y(l)}function Sn(s,l){s=s|0,l=l|0,n[s+980>>2]=l}function fa(s){return s=s|0,n[s+980>>2]|0}function wd(s,l){s=s|0,l=l|0;var c=0;c=s+4|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function BI(s){return s=s|0,n[s+4>>2]|0}function eo(s,l){s=s|0,l=l|0;var c=0;c=s+8|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function Bd(s){return s=s|0,n[s+8>>2]|0}function cp(s,l){s=s|0,l=l|0;var c=0;c=s+12|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function vI(s){return s=s|0,n[s+12>>2]|0}function to(s,l){s=s|0,l=l|0;var c=0;c=s+16|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function up(s){return s=s|0,n[s+16>>2]|0}function Ap(s,l){s=s|0,l=l|0;var c=0;c=s+20|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function Ic(s){return s=s|0,n[s+20>>2]|0}function fp(s,l){s=s|0,l=l|0;var c=0;c=s+24|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function s0(s){return s=s|0,n[s+24>>2]|0}function o0(s,l){s=s|0,l=l|0;var c=0;c=s+28|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function a0(s){return s=s|0,n[s+28>>2]|0}function vd(s,l){s=s|0,l=l|0;var c=0;c=s+32|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function Eu(s){return s=s|0,n[s+32>>2]|0}function ro(s,l){s=s|0,l=l|0;var c=0;c=s+36|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Ne(s))}function Ga(s){return s=s|0,n[s+36>>2]|0}function pp(s,l){s=s|0,l=y(l);var c=0;c=s+40|0,y(h[c>>2])!=l&&(h[c>>2]=l,Ne(s))}function l0(s,l){s=s|0,l=y(l);var c=0;c=s+44|0,y(h[c>>2])!=l&&(h[c>>2]=l,Ne(s))}function Wa(s,l){s=s|0,l=y(l);var c=0;c=s+48|0,y(h[c>>2])!=l&&(h[c>>2]=l,Ne(s))}function Ya(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+52|0,d=s+56|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function Dd(s,l){s=s|0,l=y(l);var c=0,f=0;f=s+52|0,c=s+56|0,y(h[f>>2])==l&&(n[c>>2]|0)==2||(h[f>>2]=l,f=Ot(l)|0,n[c>>2]=f?3:2,Ne(s))}function LA(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+52|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Sd(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=(m^1)&1,d=s+132+(l<<3)|0,l=s+132+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function Pd(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=m?0:2,d=s+132+(l<<3)|0,l=s+132+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function NA(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=l+132+(c<<3)|0,l=n[f+4>>2]|0,c=s,n[c>>2]=n[f>>2],n[c+4>>2]=l}function OA(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=(m^1)&1,d=s+60+(l<<3)|0,l=s+60+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function W(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=m?0:2,d=s+60+(l<<3)|0,l=s+60+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function xt(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=l+60+(c<<3)|0,l=n[f+4>>2]|0,c=s,n[c>>2]=n[f>>2],n[c+4>>2]=l}function MA(s,l){s=s|0,l=l|0;var c=0;c=s+60+(l<<3)+4|0,(n[c>>2]|0)!=3&&(h[s+60+(l<<3)>>2]=y(ue),n[c>>2]=3,Ne(s))}function no(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=(m^1)&1,d=s+204+(l<<3)|0,l=s+204+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function Cu(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=m?0:2,d=s+204+(l<<3)|0,l=s+204+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function dt(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=l+204+(c<<3)|0,l=n[f+4>>2]|0,c=s,n[c>>2]=n[f>>2],n[c+4>>2]=l}function wc(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=Ot(c)|0,f=(m^1)&1,d=s+276+(l<<3)|0,l=s+276+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Ne(s))}function xd(s,l){return s=s|0,l=l|0,y(h[s+276+(l<<3)>>2])}function c0(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+348|0,d=s+352|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function DI(s,l){s=s|0,l=y(l);var c=0,f=0;f=s+348|0,c=s+352|0,y(h[f>>2])==l&&(n[c>>2]|0)==2||(h[f>>2]=l,f=Ot(l)|0,n[c>>2]=f?3:2,Ne(s))}function hp(s){s=s|0;var l=0;l=s+352|0,(n[l>>2]|0)!=3&&(h[s+348>>2]=y(ue),n[l>>2]=3,Ne(s))}function cr(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+348|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Ni(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+356|0,d=s+360|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function Iu(s,l){s=s|0,l=y(l);var c=0,f=0;f=s+356|0,c=s+360|0,y(h[f>>2])==l&&(n[c>>2]|0)==2||(h[f>>2]=l,f=Ot(l)|0,n[c>>2]=f?3:2,Ne(s))}function pa(s){s=s|0;var l=0;l=s+360|0,(n[l>>2]|0)!=3&&(h[s+356>>2]=y(ue),n[l>>2]=3,Ne(s))}function u0(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+356|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Bc(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+364|0,d=s+368|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function wu(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=m?0:2,f=s+364|0,d=s+368|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function wt(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+364|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function oi(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+372|0,d=s+376|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function UA(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=m?0:2,f=s+372|0,d=s+376|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function ha(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+372|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Uo(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+380|0,d=s+384|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function ga(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=m?0:2,f=s+380|0,d=s+384|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function A0(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+380|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function gp(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=(m^1)&1,f=s+388|0,d=s+392|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function f0(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=Ot(l)|0,c=m?0:2,f=s+388|0,d=s+392|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Ne(s))}function bd(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+388|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function _A(s,l){s=s|0,l=y(l);var c=0;c=s+396|0,y(h[c>>2])!=l&&(h[c>>2]=l,Ne(s))}function p0(s){return s=s|0,y(h[s+396>>2])}function vc(s){return s=s|0,y(h[s+400>>2])}function Dc(s){return s=s|0,y(h[s+404>>2])}function Bu(s){return s=s|0,y(h[s+408>>2])}function gs(s){return s=s|0,y(h[s+412>>2])}function Sc(s){return s=s|0,y(h[s+416>>2])}function On(s){return s=s|0,y(h[s+420>>2])}function ji(s,l){switch(s=s|0,l=l|0,pi(s,(l|0)<6,2918),l|0){case 0:{l=(n[s+496>>2]|0)==2?5:4;break}case 2:{l=(n[s+496>>2]|0)==2?4:5;break}default:}return y(h[s+424+(l<<2)>>2])}function Ci(s,l){switch(s=s|0,l=l|0,pi(s,(l|0)<6,2918),l|0){case 0:{l=(n[s+496>>2]|0)==2?5:4;break}case 2:{l=(n[s+496>>2]|0)==2?4:5;break}default:}return y(h[s+448+(l<<2)>>2])}function HA(s,l){switch(s=s|0,l=l|0,pi(s,(l|0)<6,2918),l|0){case 0:{l=(n[s+496>>2]|0)==2?5:4;break}case 2:{l=(n[s+496>>2]|0)==2?4:5;break}default:}return y(h[s+472+(l<<2)>>2])}function vu(s,l){s=s|0,l=l|0;var c=0,f=Ze;return c=n[s+4>>2]|0,(c|0)==(n[l+4>>2]|0)?c?(f=y(h[s>>2]),s=y(ie(y(f-y(h[l>>2]))))>2]=0,n[f+4>>2]=0,n[f+8>>2]=0,dc(f|0,s|0,l|0,0),so(s,3,(o[f+11>>0]|0)<0?n[f>>2]|0:f,c),WUe(f),C=c}function Gi(s,l,c,f){s=y(s),l=y(l),c=c|0,f=f|0;var d=Ze;s=y(s*l),d=y(lT(s,y(1)));do if(An(d,y(0))|0)s=y(s-d);else{if(s=y(s-d),An(d,y(1))|0){s=y(s+y(1));break}if(c){s=y(s+y(1));break}f||(d>y(.5)?d=y(1):(f=An(d,y(.5))|0,d=y(f?1:0)),s=y(s+d))}while(!1);return y(s/l)}function Va(s,l,c,f,d,m,B,k,F,M,O,j,oe){s=s|0,l=y(l),c=c|0,f=y(f),d=d|0,m=y(m),B=B|0,k=y(k),F=y(F),M=y(M),O=y(O),j=y(j),oe=oe|0;var We=0,Oe=Ze,Qe=Ze,rt=Ze,Xe=Ze,ct=Ze,_e=Ze;return F>2]),Oe!=y(0))?(rt=y(Gi(l,Oe,0,0)),Xe=y(Gi(f,Oe,0,0)),Qe=y(Gi(m,Oe,0,0)),Oe=y(Gi(k,Oe,0,0))):(Qe=m,rt=l,Oe=k,Xe=f),(d|0)==(s|0)?We=An(Qe,rt)|0:We=0,(B|0)==(c|0)?oe=An(Oe,Xe)|0:oe=0,!We&&(ct=y(l-O),!(io(s,ct,F)|0))&&!(Du(s,ct,d,F)|0)?We=Su(s,ct,d,m,F)|0:We=1,!oe&&(_e=y(f-j),!(io(c,_e,M)|0))&&!(Du(c,_e,B,M)|0)?oe=Su(c,_e,B,k,M)|0:oe=1,oe=We&oe),oe|0}function io(s,l,c){return s=s|0,l=y(l),c=y(c),(s|0)==1?s=An(l,c)|0:s=0,s|0}function Du(s,l,c,f){return s=s|0,l=y(l),c=c|0,f=y(f),(s|0)==2&(c|0)==0?l>=f?s=1:s=An(l,f)|0:s=0,s|0}function Su(s,l,c,f,d){return s=s|0,l=y(l),c=c|0,f=y(f),d=y(d),(s|0)==2&(c|0)==2&f>l?d<=l?s=1:s=An(l,d)|0:s=0,s|0}function Ka(s,l,c,f,d,m,B,k,F,M,O){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=m|0,B=y(B),k=y(k),F=F|0,M=M|0,O=O|0;var j=0,oe=0,We=0,Oe=0,Qe=Ze,rt=Ze,Xe=0,ct=0,_e=0,Ge=0,Nt=0,_r=0,ur=0,Zt=0,kr=0,Or=0,lr=0,Ln=Ze,lo=Ze,co=Ze,uo=0,Ia=0;lr=C,C=C+160|0,Zt=lr+152|0,ur=lr+120|0,_r=lr+104|0,_e=lr+72|0,Oe=lr+56|0,Nt=lr+8|0,ct=lr,Ge=(n[2279]|0)+1|0,n[2279]=Ge,kr=s+984|0,o[kr>>0]|0&&(n[s+512>>2]|0)!=(n[2278]|0)?Xe=4:(n[s+516>>2]|0)==(f|0)?Or=0:Xe=4,(Xe|0)==4&&(n[s+520>>2]=0,n[s+924>>2]=-1,n[s+928>>2]=-1,h[s+932>>2]=y(-1),h[s+936>>2]=y(-1),Or=1);e:do if(n[s+964>>2]|0)if(Qe=y(fn(s,2,B)),rt=y(fn(s,0,B)),j=s+916|0,co=y(h[j>>2]),lo=y(h[s+920>>2]),Ln=y(h[s+932>>2]),Va(d,l,m,c,n[s+924>>2]|0,co,n[s+928>>2]|0,lo,Ln,y(h[s+936>>2]),Qe,rt,O)|0)Xe=22;else if(We=n[s+520>>2]|0,!We)Xe=21;else for(oe=0;;){if(j=s+524+(oe*24|0)|0,Ln=y(h[j>>2]),lo=y(h[s+524+(oe*24|0)+4>>2]),co=y(h[s+524+(oe*24|0)+16>>2]),Va(d,l,m,c,n[s+524+(oe*24|0)+8>>2]|0,Ln,n[s+524+(oe*24|0)+12>>2]|0,lo,co,y(h[s+524+(oe*24|0)+20>>2]),Qe,rt,O)|0){Xe=22;break e}if(oe=oe+1|0,oe>>>0>=We>>>0){Xe=21;break}}else{if(F){if(j=s+916|0,!(An(y(h[j>>2]),l)|0)){Xe=21;break}if(!(An(y(h[s+920>>2]),c)|0)){Xe=21;break}if((n[s+924>>2]|0)!=(d|0)){Xe=21;break}j=(n[s+928>>2]|0)==(m|0)?j:0,Xe=22;break}if(We=n[s+520>>2]|0,!We)Xe=21;else for(oe=0;;){if(j=s+524+(oe*24|0)|0,An(y(h[j>>2]),l)|0&&An(y(h[s+524+(oe*24|0)+4>>2]),c)|0&&(n[s+524+(oe*24|0)+8>>2]|0)==(d|0)&&(n[s+524+(oe*24|0)+12>>2]|0)==(m|0)){Xe=22;break e}if(oe=oe+1|0,oe>>>0>=We>>>0){Xe=21;break}}}while(!1);do if((Xe|0)==21)o[11697]|0?(j=0,Xe=28):(j=0,Xe=31);else if((Xe|0)==22){if(oe=(o[11697]|0)!=0,!((j|0)!=0&(Or^1)))if(oe){Xe=28;break}else{Xe=31;break}Oe=j+16|0,n[s+908>>2]=n[Oe>>2],We=j+20|0,n[s+912>>2]=n[We>>2],(o[11698]|0)==0|oe^1||(n[ct>>2]=Pc(Ge)|0,n[ct+4>>2]=Ge,so(s,4,2972,ct),oe=n[s+972>>2]|0,oe|0&&ef[oe&127](s),d=_o(d,F)|0,m=_o(m,F)|0,Ia=+y(h[Oe>>2]),uo=+y(h[We>>2]),n[Nt>>2]=d,n[Nt+4>>2]=m,E[Nt+8>>3]=+l,E[Nt+16>>3]=+c,E[Nt+24>>3]=Ia,E[Nt+32>>3]=uo,n[Nt+40>>2]=M,so(s,4,2989,Nt))}while(!1);return(Xe|0)==28&&(oe=Pc(Ge)|0,n[Oe>>2]=oe,n[Oe+4>>2]=Ge,n[Oe+8>>2]=Or?3047:11699,so(s,4,3038,Oe),oe=n[s+972>>2]|0,oe|0&&ef[oe&127](s),Nt=_o(d,F)|0,Xe=_o(m,F)|0,n[_e>>2]=Nt,n[_e+4>>2]=Xe,E[_e+8>>3]=+l,E[_e+16>>3]=+c,n[_e+24>>2]=M,so(s,4,3049,_e),Xe=31),(Xe|0)==31&&(ds(s,l,c,f,d,m,B,k,F,O),o[11697]|0&&(oe=n[2279]|0,Nt=Pc(oe)|0,n[_r>>2]=Nt,n[_r+4>>2]=oe,n[_r+8>>2]=Or?3047:11699,so(s,4,3083,_r),oe=n[s+972>>2]|0,oe|0&&ef[oe&127](s),Nt=_o(d,F)|0,_r=_o(m,F)|0,uo=+y(h[s+908>>2]),Ia=+y(h[s+912>>2]),n[ur>>2]=Nt,n[ur+4>>2]=_r,E[ur+8>>3]=uo,E[ur+16>>3]=Ia,n[ur+24>>2]=M,so(s,4,3092,ur)),n[s+516>>2]=f,j||(oe=s+520|0,j=n[oe>>2]|0,(j|0)==16&&(o[11697]|0&&so(s,4,3124,Zt),n[oe>>2]=0,j=0),F?j=s+916|0:(n[oe>>2]=j+1,j=s+524+(j*24|0)|0),h[j>>2]=l,h[j+4>>2]=c,n[j+8>>2]=d,n[j+12>>2]=m,n[j+16>>2]=n[s+908>>2],n[j+20>>2]=n[s+912>>2],j=0)),F&&(n[s+416>>2]=n[s+908>>2],n[s+420>>2]=n[s+912>>2],o[s+985>>0]=1,o[kr>>0]=0),n[2279]=(n[2279]|0)+-1,n[s+512>>2]=n[2278],C=lr,Or|(j|0)==0|0}function fn(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return f=y(K(s,l,c)),y(f+y(re(s,l,c)))}function so(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=C,C=C+16|0,d=m,n[d>>2]=f,s?f=n[s+976>>2]|0:f=0,yp(f,s,l,c,d),C=m}function Pc(s){return s=s|0,(s>>>0>60?3201:3201+(60-s)|0)|0}function _o(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;return d=C,C=C+32|0,c=d+12|0,f=d,n[c>>2]=n[254],n[c+4>>2]=n[255],n[c+8>>2]=n[256],n[f>>2]=n[257],n[f+4>>2]=n[258],n[f+8>>2]=n[259],(s|0)>2?s=11699:s=n[(l?f:c)+(s<<2)>>2]|0,C=d,s|0}function ds(s,l,c,f,d,m,B,k,F,M){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=m|0,B=y(B),k=y(k),F=F|0,M=M|0;var O=0,j=0,oe=0,We=0,Oe=Ze,Qe=Ze,rt=Ze,Xe=Ze,ct=Ze,_e=Ze,Ge=Ze,Nt=0,_r=0,ur=0,Zt=Ze,kr=Ze,Or=0,lr=Ze,Ln=0,lo=0,co=0,uo=0,Ia=0,Lp=0,Np=0,kl=0,Op=0,Nu=0,Ou=0,Mp=0,Up=0,_p=0,$r=0,Ql=0,Hp=0,Lc=0,qp=Ze,jp=Ze,Mu=Ze,Uu=Ze,Nc=Ze,Ms=0,rl=0,Go=0,Fl=0,rf=0,nf=Ze,_u=Ze,sf=Ze,of=Ze,Us=Ze,Cs=Ze,Rl=0,Un=Ze,af=Ze,Ao=Ze,Oc=Ze,fo=Ze,Mc=Ze,lf=0,cf=0,Uc=Ze,_s=Ze,Tl=0,uf=0,Af=0,ff=0,Fr=Ze,ri=0,Is=0,po=0,Hs=0,Lr=0,Ar=0,Ll=0,Kt=Ze,pf=0,hi=0;Ll=C,C=C+16|0,Ms=Ll+12|0,rl=Ll+8|0,Go=Ll+4|0,Fl=Ll,pi(s,(d|0)==0|(Ot(l)|0)^1,3326),pi(s,(m|0)==0|(Ot(c)|0)^1,3406),Is=At(s,f)|0,n[s+496>>2]=Is,Lr=hr(2,Is)|0,Ar=hr(0,Is)|0,h[s+440>>2]=y(K(s,Lr,B)),h[s+444>>2]=y(re(s,Lr,B)),h[s+428>>2]=y(K(s,Ar,B)),h[s+436>>2]=y(re(s,Ar,B)),h[s+464>>2]=y(Ir(s,Lr)),h[s+468>>2]=y(Rn(s,Lr)),h[s+452>>2]=y(Ir(s,Ar)),h[s+460>>2]=y(Rn(s,Ar)),h[s+488>>2]=y(ai(s,Lr,B)),h[s+492>>2]=y(ns(s,Lr,B)),h[s+476>>2]=y(ai(s,Ar,B)),h[s+484>>2]=y(ns(s,Ar,B));do if(n[s+964>>2]|0)GA(s,l,c,d,m,B,k);else{if(po=s+948|0,Hs=(n[s+952>>2]|0)-(n[po>>2]|0)>>2,!Hs){lD(s,l,c,d,m,B,k);break}if(!F&&SI(s,l,c,d,m,B,k)|0)break;ee(s),Ql=s+508|0,o[Ql>>0]=0,Lr=hr(n[s+4>>2]|0,Is)|0,Ar=Fd(Lr,Is)|0,ri=ge(Lr)|0,Hp=n[s+8>>2]|0,uf=s+28|0,Lc=(n[uf>>2]|0)!=0,fo=ri?B:k,Uc=ri?k:B,qp=y(Cp(s,Lr,B)),jp=y(PI(s,Lr,B)),Oe=y(Cp(s,Ar,B)),Mc=y(da(s,Lr,B)),_s=y(da(s,Ar,B)),ur=ri?d:m,Tl=ri?m:d,Fr=ri?Mc:_s,ct=ri?_s:Mc,Oc=y(fn(s,2,B)),Xe=y(fn(s,0,B)),Qe=y(y(Vr(s+364|0,B))-Fr),rt=y(y(Vr(s+380|0,B))-Fr),_e=y(y(Vr(s+372|0,k))-ct),Ge=y(y(Vr(s+388|0,k))-ct),Mu=ri?Qe:_e,Uu=ri?rt:Ge,Oc=y(l-Oc),l=y(Oc-Fr),Ot(l)|0?Fr=l:Fr=y(Yn(y(M0(l,rt)),Qe)),af=y(c-Xe),l=y(af-ct),Ot(l)|0?Ao=l:Ao=y(Yn(y(M0(l,Ge)),_e)),Qe=ri?Fr:Ao,Un=ri?Ao:Fr;e:do if((ur|0)==1)for(f=0,j=0;;){if(O=rs(s,j)|0,!f)y(WA(O))>y(0)&&y(Ip(O))>y(0)?f=O:f=0;else if(xI(O)|0){We=0;break e}if(j=j+1|0,j>>>0>=Hs>>>0){We=f;break}}else We=0;while(!1);Nt=We+500|0,_r=We+504|0,f=0,O=0,l=y(0),oe=0;do{if(j=n[(n[po>>2]|0)+(oe<<2)>>2]|0,(n[j+36>>2]|0)==1)Rd(j),o[j+985>>0]=1,o[j+984>>0]=0;else{Pu(j),F&&mp(j,At(j,Is)|0,Qe,Un,Fr);do if((n[j+24>>2]|0)!=1)if((j|0)==(We|0)){n[Nt>>2]=n[2278],h[_r>>2]=y(0);break}else{cD(s,j,Fr,d,Ao,Fr,Ao,m,Is,M);break}else O|0&&(n[O+960>>2]=j),n[j+960>>2]=0,O=j,f=f|0?f:j;while(!1);Cs=y(h[j+504>>2]),l=y(l+y(Cs+y(fn(j,Lr,Fr))))}oe=oe+1|0}while((oe|0)!=(Hs|0));for(co=l>Qe,Rl=Lc&((ur|0)==2&co)?1:ur,Ln=(Tl|0)==1,Ia=Ln&(F^1),Lp=(Rl|0)==1,Np=(Rl|0)==2,kl=976+(Lr<<2)|0,Op=(Tl|2|0)==2,_p=Ln&(Lc^1),Nu=1040+(Ar<<2)|0,Ou=1040+(Lr<<2)|0,Mp=976+(Ar<<2)|0,Up=(Tl|0)!=1,co=Lc&((ur|0)!=0&co),lo=s+976|0,Ln=Ln^1,l=Qe,Or=0,uo=0,Cs=y(0),Nc=y(0);;){e:do if(Or>>>0>>0)for(_r=n[po>>2]|0,oe=0,Ge=y(0),_e=y(0),rt=y(0),Qe=y(0),j=0,O=0,We=Or;;){if(Nt=n[_r+(We<<2)>>2]|0,(n[Nt+36>>2]|0)!=1&&(n[Nt+940>>2]=uo,(n[Nt+24>>2]|0)!=1)){if(Xe=y(fn(Nt,Lr,Fr)),$r=n[kl>>2]|0,c=y(Vr(Nt+380+($r<<3)|0,fo)),ct=y(h[Nt+504>>2]),c=y(M0(c,ct)),c=y(Yn(y(Vr(Nt+364+($r<<3)|0,fo)),c)),Lc&(oe|0)!=0&y(Xe+y(_e+c))>l){m=oe,Xe=Ge,ur=We;break e}Xe=y(Xe+c),c=y(_e+Xe),Xe=y(Ge+Xe),xI(Nt)|0&&(rt=y(rt+y(WA(Nt))),Qe=y(Qe-y(ct*y(Ip(Nt))))),O|0&&(n[O+960>>2]=Nt),n[Nt+960>>2]=0,oe=oe+1|0,O=Nt,j=j|0?j:Nt}else Xe=Ge,c=_e;if(We=We+1|0,We>>>0>>0)Ge=Xe,_e=c;else{m=oe,ur=We;break}}else m=0,Xe=y(0),rt=y(0),Qe=y(0),j=0,ur=Or;while(!1);$r=rt>y(0)&rty(0)&QeUu&((Ot(Uu)|0)^1))l=Uu,$r=51;else if(o[(n[lo>>2]|0)+3>>0]|0)$r=51;else{if(Zt!=y(0)&&y(WA(s))!=y(0)){$r=53;break}l=Xe,$r=53}while(!1);if(($r|0)==51&&($r=0,Ot(l)|0?$r=53:(kr=y(l-Xe),lr=l)),($r|0)==53&&($r=0,Xe>2]|0,We=kry(0),_e=y(kr/Zt),rt=y(0),Xe=y(0),l=y(0),O=j;do c=y(Vr(O+380+(oe<<3)|0,fo)),Qe=y(Vr(O+364+(oe<<3)|0,fo)),Qe=y(M0(c,y(Yn(Qe,y(h[O+504>>2]))))),We?(c=y(Qe*y(Ip(O))),c!=y(-0)&&(Kt=y(Qe-y(ct*c)),nf=y(Mn(O,Lr,Kt,lr,Fr)),Kt!=nf)&&(rt=y(rt-y(nf-Qe)),l=y(l+c))):Nt&&(_u=y(WA(O)),_u!=y(0))&&(Kt=y(Qe+y(_e*_u)),sf=y(Mn(O,Lr,Kt,lr,Fr)),Kt!=sf)&&(rt=y(rt-y(sf-Qe)),Xe=y(Xe-_u)),O=n[O+960>>2]|0;while(O|0);if(l=y(Ge+l),Qe=y(kr+rt),rf)l=y(0);else{ct=y(Zt+Xe),We=n[kl>>2]|0,Nt=Qey(0),ct=y(Qe/ct),l=y(0);do{Kt=y(Vr(j+380+(We<<3)|0,fo)),rt=y(Vr(j+364+(We<<3)|0,fo)),rt=y(M0(Kt,y(Yn(rt,y(h[j+504>>2]))))),Nt?(Kt=y(rt*y(Ip(j))),Qe=y(-Kt),Kt!=y(-0)?(Kt=y(_e*Qe),Qe=y(Mn(j,Lr,y(rt+(_r?Qe:Kt)),lr,Fr))):Qe=rt):oe&&(of=y(WA(j)),of!=y(0))?Qe=y(Mn(j,Lr,y(rt+y(ct*of)),lr,Fr)):Qe=rt,l=y(l-y(Qe-rt)),Xe=y(fn(j,Lr,Fr)),c=y(fn(j,Ar,Fr)),Qe=y(Qe+Xe),h[rl>>2]=Qe,n[Fl>>2]=1,rt=y(h[j+396>>2]);e:do if(Ot(rt)|0){O=Ot(Un)|0;do if(!O){if(co|(Ns(j,Ar,Un)|0|Ln)||(Wi(s,j)|0)!=4||(n[(Ja(j,Ar)|0)+4>>2]|0)==3||(n[(za(j,Ar)|0)+4>>2]|0)==3)break;h[Ms>>2]=Un,n[Go>>2]=1;break e}while(!1);if(Ns(j,Ar,Un)|0){O=n[j+992+(n[Mp>>2]<<2)>>2]|0,Kt=y(c+y(Vr(O,Un))),h[Ms>>2]=Kt,O=Up&(n[O+4>>2]|0)==2,n[Go>>2]=((Ot(Kt)|0|O)^1)&1;break}else{h[Ms>>2]=Un,n[Go>>2]=O?0:2;break}}else Kt=y(Qe-Xe),Zt=y(Kt/rt),Kt=y(rt*Kt),n[Go>>2]=1,h[Ms>>2]=y(c+(ri?Zt:Kt));while(!1);xc(j,Lr,lr,Fr,Fl,rl),xc(j,Ar,Un,Fr,Go,Ms);do if(!(Ns(j,Ar,Un)|0)&&(Wi(s,j)|0)==4){if((n[(Ja(j,Ar)|0)+4>>2]|0)==3){O=0;break}O=(n[(za(j,Ar)|0)+4>>2]|0)!=3}else O=0;while(!1);Kt=y(h[rl>>2]),Zt=y(h[Ms>>2]),pf=n[Fl>>2]|0,hi=n[Go>>2]|0,Ka(j,ri?Kt:Zt,ri?Zt:Kt,Is,ri?pf:hi,ri?hi:pf,Fr,Ao,F&(O^1),3488,M)|0,o[Ql>>0]=o[Ql>>0]|o[j+508>>0],j=n[j+960>>2]|0}while(j|0)}}else l=y(0);if(l=y(kr+l),hi=l>0]=hi|u[Ql>>0],Np&l>y(0)?(O=n[kl>>2]|0,n[s+364+(O<<3)+4>>2]|0&&(Us=y(Vr(s+364+(O<<3)|0,fo)),Us>=y(0))?Qe=y(Yn(y(0),y(Us-y(lr-l)))):Qe=y(0)):Qe=l,Nt=Or>>>0>>0,Nt){We=n[po>>2]|0,oe=Or,O=0;do j=n[We+(oe<<2)>>2]|0,n[j+24>>2]|0||(O=((n[(Ja(j,Lr)|0)+4>>2]|0)==3&1)+O|0,O=O+((n[(za(j,Lr)|0)+4>>2]|0)==3&1)|0),oe=oe+1|0;while((oe|0)!=(ur|0));O?(Xe=y(0),c=y(0)):$r=101}else $r=101;e:do if(($r|0)==101)switch($r=0,Hp|0){case 1:{O=0,Xe=y(Qe*y(.5)),c=y(0);break e}case 2:{O=0,Xe=Qe,c=y(0);break e}case 3:{if(m>>>0<=1){O=0,Xe=y(0),c=y(0);break e}c=y((m+-1|0)>>>0),O=0,Xe=y(0),c=y(y(Yn(Qe,y(0)))/c);break e}case 5:{c=y(Qe/y((m+1|0)>>>0)),O=0,Xe=c;break e}case 4:{c=y(Qe/y(m>>>0)),O=0,Xe=y(c*y(.5));break e}default:{O=0,Xe=y(0),c=y(0);break e}}while(!1);if(l=y(qp+Xe),Nt){rt=y(Qe/y(O|0)),oe=n[po>>2]|0,j=Or,Qe=y(0);do{O=n[oe+(j<<2)>>2]|0;e:do if((n[O+36>>2]|0)!=1){switch(n[O+24>>2]|0){case 1:{if(Ho(O,Lr)|0){if(!F)break e;Kt=y(YA(O,Lr,lr)),Kt=y(Kt+y(Ir(s,Lr))),Kt=y(Kt+y(K(O,Lr,Fr))),h[O+400+(n[Ou>>2]<<2)>>2]=Kt;break e}break}case 0:if(hi=(n[(Ja(O,Lr)|0)+4>>2]|0)==3,Kt=y(rt+l),l=hi?Kt:l,F&&(hi=O+400+(n[Ou>>2]<<2)|0,h[hi>>2]=y(l+y(h[hi>>2]))),hi=(n[(za(O,Lr)|0)+4>>2]|0)==3,Kt=y(rt+l),l=hi?Kt:l,Ia){Kt=y(c+y(fn(O,Lr,Fr))),Qe=Un,l=y(l+y(Kt+y(h[O+504>>2])));break e}else{l=y(l+y(c+y(VA(O,Lr,Fr)))),Qe=y(Yn(Qe,y(VA(O,Ar,Fr))));break e}default:}F&&(Kt=y(Xe+y(Ir(s,Lr))),hi=O+400+(n[Ou>>2]<<2)|0,h[hi>>2]=y(Kt+y(h[hi>>2])))}while(!1);j=j+1|0}while((j|0)!=(ur|0))}else Qe=y(0);if(c=y(jp+l),Op?Xe=y(y(Mn(s,Ar,y(_s+Qe),Uc,B))-_s):Xe=Un,rt=y(y(Mn(s,Ar,y(_s+(_p?Un:Qe)),Uc,B))-_s),Nt&F){j=Or;do{oe=n[(n[po>>2]|0)+(j<<2)>>2]|0;do if((n[oe+36>>2]|0)!=1){if((n[oe+24>>2]|0)==1){if(Ho(oe,Ar)|0){if(Kt=y(YA(oe,Ar,Un)),Kt=y(Kt+y(Ir(s,Ar))),Kt=y(Kt+y(K(oe,Ar,Fr))),O=n[Nu>>2]|0,h[oe+400+(O<<2)>>2]=Kt,!(Ot(Kt)|0))break}else O=n[Nu>>2]|0;Kt=y(Ir(s,Ar)),h[oe+400+(O<<2)>>2]=y(Kt+y(K(oe,Ar,Fr)));break}O=Wi(s,oe)|0;do if((O|0)==4){if((n[(Ja(oe,Ar)|0)+4>>2]|0)==3){$r=139;break}if((n[(za(oe,Ar)|0)+4>>2]|0)==3){$r=139;break}if(Ns(oe,Ar,Un)|0){l=Oe;break}pf=n[oe+908+(n[kl>>2]<<2)>>2]|0,n[Ms>>2]=pf,l=y(h[oe+396>>2]),hi=Ot(l)|0,Qe=(n[D>>2]=pf,y(h[D>>2])),hi?l=rt:(kr=y(fn(oe,Ar,Fr)),Kt=y(Qe/l),l=y(l*Qe),l=y(kr+(ri?Kt:l))),h[rl>>2]=l,h[Ms>>2]=y(y(fn(oe,Lr,Fr))+Qe),n[Go>>2]=1,n[Fl>>2]=1,xc(oe,Lr,lr,Fr,Go,Ms),xc(oe,Ar,Un,Fr,Fl,rl),l=y(h[Ms>>2]),kr=y(h[rl>>2]),Kt=ri?l:kr,l=ri?kr:l,hi=((Ot(Kt)|0)^1)&1,Ka(oe,Kt,l,Is,hi,((Ot(l)|0)^1)&1,Fr,Ao,1,3493,M)|0,l=Oe}else $r=139;while(!1);e:do if(($r|0)==139){$r=0,l=y(Xe-y(VA(oe,Ar,Fr)));do if((n[(Ja(oe,Ar)|0)+4>>2]|0)==3){if((n[(za(oe,Ar)|0)+4>>2]|0)!=3)break;l=y(Oe+y(Yn(y(0),y(l*y(.5)))));break e}while(!1);if((n[(za(oe,Ar)|0)+4>>2]|0)==3){l=Oe;break}if((n[(Ja(oe,Ar)|0)+4>>2]|0)==3){l=y(Oe+y(Yn(y(0),l)));break}switch(O|0){case 1:{l=Oe;break e}case 2:{l=y(Oe+y(l*y(.5)));break e}default:{l=y(Oe+l);break e}}}while(!1);Kt=y(Cs+l),hi=oe+400+(n[Nu>>2]<<2)|0,h[hi>>2]=y(Kt+y(h[hi>>2]))}while(!1);j=j+1|0}while((j|0)!=(ur|0))}if(Cs=y(Cs+rt),Nc=y(Yn(Nc,c)),m=uo+1|0,ur>>>0>=Hs>>>0)break;l=lr,Or=ur,uo=m}do if(F){if(O=m>>>0>1,!O&&!(HF(s)|0))break;if(!(Ot(Un)|0)){l=y(Un-Cs);e:do switch(n[s+12>>2]|0){case 3:{Oe=y(Oe+l),_e=y(0);break}case 2:{Oe=y(Oe+y(l*y(.5))),_e=y(0);break}case 4:{Un>Cs?_e=y(l/y(m>>>0)):_e=y(0);break}case 7:if(Un>Cs){Oe=y(Oe+y(l/y(m<<1>>>0))),_e=y(l/y(m>>>0)),_e=O?_e:y(0);break e}else{Oe=y(Oe+y(l*y(.5))),_e=y(0);break e}case 6:{_e=y(l/y(uo>>>0)),_e=Un>Cs&O?_e:y(0);break}default:_e=y(0)}while(!1);if(m|0)for(Nt=1040+(Ar<<2)|0,_r=976+(Ar<<2)|0,We=0,j=0;;){e:do if(j>>>0>>0)for(Qe=y(0),rt=y(0),l=y(0),oe=j;;){O=n[(n[po>>2]|0)+(oe<<2)>>2]|0;do if((n[O+36>>2]|0)!=1&&!(n[O+24>>2]|0)){if((n[O+940>>2]|0)!=(We|0))break e;if(qF(O,Ar)|0&&(Kt=y(h[O+908+(n[_r>>2]<<2)>>2]),l=y(Yn(l,y(Kt+y(fn(O,Ar,Fr)))))),(Wi(s,O)|0)!=5)break;Us=y(m0(O)),Us=y(Us+y(K(O,0,Fr))),Kt=y(h[O+912>>2]),Kt=y(y(Kt+y(fn(O,0,Fr)))-Us),Us=y(Yn(rt,Us)),Kt=y(Yn(Qe,Kt)),Qe=Kt,rt=Us,l=y(Yn(l,y(Us+Kt)))}while(!1);if(O=oe+1|0,O>>>0>>0)oe=O;else{oe=O;break}}else rt=y(0),l=y(0),oe=j;while(!1);if(ct=y(_e+l),c=Oe,Oe=y(Oe+ct),j>>>0>>0){Xe=y(c+rt),O=j;do{j=n[(n[po>>2]|0)+(O<<2)>>2]|0;e:do if((n[j+36>>2]|0)!=1&&!(n[j+24>>2]|0))switch(Wi(s,j)|0){case 1:{Kt=y(c+y(K(j,Ar,Fr))),h[j+400+(n[Nt>>2]<<2)>>2]=Kt;break e}case 3:{Kt=y(y(Oe-y(re(j,Ar,Fr)))-y(h[j+908+(n[_r>>2]<<2)>>2])),h[j+400+(n[Nt>>2]<<2)>>2]=Kt;break e}case 2:{Kt=y(c+y(y(ct-y(h[j+908+(n[_r>>2]<<2)>>2]))*y(.5))),h[j+400+(n[Nt>>2]<<2)>>2]=Kt;break e}case 4:{if(Kt=y(c+y(K(j,Ar,Fr))),h[j+400+(n[Nt>>2]<<2)>>2]=Kt,Ns(j,Ar,Un)|0||(ri?(Qe=y(h[j+908>>2]),l=y(Qe+y(fn(j,Lr,Fr))),rt=ct):(rt=y(h[j+912>>2]),rt=y(rt+y(fn(j,Ar,Fr))),l=ct,Qe=y(h[j+908>>2])),An(l,Qe)|0&&An(rt,y(h[j+912>>2]))|0))break e;Ka(j,l,rt,Is,1,1,Fr,Ao,1,3501,M)|0;break e}case 5:{h[j+404>>2]=y(y(Xe-y(m0(j)))+y(YA(j,0,Un)));break e}default:break e}while(!1);O=O+1|0}while((O|0)!=(oe|0))}if(We=We+1|0,(We|0)==(m|0))break;j=oe}}}while(!1);if(h[s+908>>2]=y(Mn(s,2,Oc,B,B)),h[s+912>>2]=y(Mn(s,0,af,k,B)),Rl|0&&(lf=n[s+32>>2]|0,cf=(Rl|0)==2,!(cf&(lf|0)!=2))?cf&(lf|0)==2&&(l=y(Mc+lr),l=y(Yn(y(M0(l,y(y0(s,Lr,Nc,fo)))),Mc)),$r=198):(l=y(Mn(s,Lr,Nc,fo,B)),$r=198),($r|0)==198&&(h[s+908+(n[976+(Lr<<2)>>2]<<2)>>2]=l),Tl|0&&(Af=n[s+32>>2]|0,ff=(Tl|0)==2,!(ff&(Af|0)!=2))?ff&(Af|0)==2&&(l=y(_s+Un),l=y(Yn(y(M0(l,y(y0(s,Ar,y(_s+Cs),Uc)))),_s)),$r=204):(l=y(Mn(s,Ar,y(_s+Cs),Uc,B)),$r=204),($r|0)==204&&(h[s+908+(n[976+(Ar<<2)>>2]<<2)>>2]=l),F){if((n[uf>>2]|0)==2){j=976+(Ar<<2)|0,oe=1040+(Ar<<2)|0,O=0;do We=rs(s,O)|0,n[We+24>>2]|0||(pf=n[j>>2]|0,Kt=y(h[s+908+(pf<<2)>>2]),hi=We+400+(n[oe>>2]<<2)|0,Kt=y(Kt-y(h[hi>>2])),h[hi>>2]=y(Kt-y(h[We+908+(pf<<2)>>2]))),O=O+1|0;while((O|0)!=(Hs|0))}if(f|0){O=ri?Rl:d;do jF(s,f,Fr,O,Ao,Is,M),f=n[f+960>>2]|0;while(f|0)}if(O=(Lr|2|0)==3,j=(Ar|2|0)==3,O|j){f=0;do oe=n[(n[po>>2]|0)+(f<<2)>>2]|0,(n[oe+36>>2]|0)!=1&&(O&&bI(s,oe,Lr),j&&bI(s,oe,Ar)),f=f+1|0;while((f|0)!=(Hs|0))}}}while(!1);C=Ll}function dp(s,l){s=s|0,l=y(l);var c=0;ua(s,l>=y(0),3147),c=l==y(0),h[s+4>>2]=c?y(0):l}function qA(s,l,c,f){s=s|0,l=y(l),c=y(c),f=f|0;var d=Ze,m=Ze,B=0,k=0,F=0;n[2278]=(n[2278]|0)+1,Pu(s),Ns(s,2,l)|0?(d=y(Vr(n[s+992>>2]|0,l)),F=1,d=y(d+y(fn(s,2,l)))):(d=y(Vr(s+380|0,l)),d>=y(0)?F=2:(F=((Ot(l)|0)^1)&1,d=l)),Ns(s,0,c)|0?(m=y(Vr(n[s+996>>2]|0,c)),k=1,m=y(m+y(fn(s,0,l)))):(m=y(Vr(s+388|0,c)),m>=y(0)?k=2:(k=((Ot(c)|0)^1)&1,m=c)),B=s+976|0,Ka(s,d,m,f,F,k,l,c,1,3189,n[B>>2]|0)|0&&(mp(s,n[s+496>>2]|0,l,c,l),jA(s,y(h[(n[B>>2]|0)+4>>2]),y(0),y(0)),o[11696]|0)&&h0(s,7)}function Pu(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;k=C,C=C+32|0,B=k+24|0,m=k+16|0,f=k+8|0,d=k,c=0;do l=s+380+(c<<3)|0,n[s+380+(c<<3)+4>>2]|0&&(F=l,M=n[F+4>>2]|0,O=f,n[O>>2]=n[F>>2],n[O+4>>2]=M,O=s+364+(c<<3)|0,M=n[O+4>>2]|0,F=d,n[F>>2]=n[O>>2],n[F+4>>2]=M,n[m>>2]=n[f>>2],n[m+4>>2]=n[f+4>>2],n[B>>2]=n[d>>2],n[B+4>>2]=n[d+4>>2],vu(m,B)|0)||(l=s+348+(c<<3)|0),n[s+992+(c<<2)>>2]=l,c=c+1|0;while((c|0)!=2);C=k}function Ns(s,l,c){s=s|0,l=l|0,c=y(c);var f=0;switch(s=n[s+992+(n[976+(l<<2)>>2]<<2)>>2]|0,n[s+4>>2]|0){case 0:case 3:{s=0;break}case 1:{y(h[s>>2])>2])>2]|0){case 2:{l=y(y(y(h[s>>2])*l)/y(100));break}case 1:{l=y(h[s>>2]);break}default:l=y(ue)}return y(l)}function mp(s,l,c,f,d){s=s|0,l=l|0,c=y(c),f=y(f),d=y(d);var m=0,B=Ze;l=n[s+944>>2]|0?l:1,m=hr(n[s+4>>2]|0,l)|0,l=Fd(m,l)|0,c=y(uD(s,m,c)),f=y(uD(s,l,f)),B=y(c+y(K(s,m,d))),h[s+400+(n[1040+(m<<2)>>2]<<2)>>2]=B,c=y(c+y(re(s,m,d))),h[s+400+(n[1e3+(m<<2)>>2]<<2)>>2]=c,c=y(f+y(K(s,l,d))),h[s+400+(n[1040+(l<<2)>>2]<<2)>>2]=c,d=y(f+y(re(s,l,d))),h[s+400+(n[1e3+(l<<2)>>2]<<2)>>2]=d}function jA(s,l,c,f){s=s|0,l=y(l),c=y(c),f=y(f);var d=0,m=0,B=Ze,k=Ze,F=0,M=0,O=Ze,j=0,oe=Ze,We=Ze,Oe=Ze,Qe=Ze;if(l!=y(0)&&(d=s+400|0,Qe=y(h[d>>2]),m=s+404|0,Oe=y(h[m>>2]),j=s+416|0,We=y(h[j>>2]),M=s+420|0,B=y(h[M>>2]),oe=y(Qe+c),O=y(Oe+f),f=y(oe+We),k=y(O+B),F=(n[s+988>>2]|0)==1,h[d>>2]=y(Gi(Qe,l,0,F)),h[m>>2]=y(Gi(Oe,l,0,F)),c=y(lT(y(We*l),y(1))),An(c,y(0))|0?m=0:m=(An(c,y(1))|0)^1,c=y(lT(y(B*l),y(1))),An(c,y(0))|0?d=0:d=(An(c,y(1))|0)^1,Qe=y(Gi(f,l,F&m,F&(m^1))),h[j>>2]=y(Qe-y(Gi(oe,l,0,F))),Qe=y(Gi(k,l,F&d,F&(d^1))),h[M>>2]=y(Qe-y(Gi(O,l,0,F))),m=(n[s+952>>2]|0)-(n[s+948>>2]|0)>>2,m|0)){d=0;do jA(rs(s,d)|0,l,oe,O),d=d+1|0;while((d|0)!=(m|0))}}function kd(s,l,c,f,d){switch(s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,c|0){case 5:case 0:{s=M7(n[489]|0,f,d)|0;break}default:s=HUe(f,d)|0}return s|0}function d0(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;d=C,C=C+16|0,m=d,n[m>>2]=f,yp(s,0,l,c,m),C=d}function yp(s,l,c,f,d){if(s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,s=s|0?s:956,sW[n[s+8>>2]&1](s,l,c,f,d)|0,(c|0)==5)Tt();else return}function xl(s,l,c){s=s|0,l=l|0,c=c|0,o[s+l>>0]=c&1}function Qd(s,l){s=s|0,l=l|0;var c=0,f=0;n[s>>2]=0,n[s+4>>2]=0,n[s+8>>2]=0,c=l+4|0,f=(n[c>>2]|0)-(n[l>>2]|0)>>2,f|0&&(Ep(s,f),bt(s,n[l>>2]|0,n[c>>2]|0,f))}function Ep(s,l){s=s|0,l=l|0;var c=0;if((L(s)|0)>>>0>>0&&Zr(s),l>>>0>1073741823)Tt();else{c=Yt(l<<2)|0,n[s+4>>2]=c,n[s>>2]=c,n[s+8>>2]=c+(l<<2);return}}function bt(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,f=s+4|0,s=c-l|0,(s|0)>0&&(br(n[f>>2]|0,l|0,s|0)|0,n[f>>2]=(n[f>>2]|0)+(s>>>2<<2))}function L(s){return s=s|0,1073741823}function K(s,l,c){return s=s|0,l=l|0,c=y(c),ge(l)|0&&n[s+96>>2]|0?s=s+92|0:s=vn(s+60|0,n[1040+(l<<2)>>2]|0,992)|0,y(Ye(s,c))}function re(s,l,c){return s=s|0,l=l|0,c=y(c),ge(l)|0&&n[s+104>>2]|0?s=s+100|0:s=vn(s+60|0,n[1e3+(l<<2)>>2]|0,992)|0,y(Ye(s,c))}function ge(s){return s=s|0,(s|1|0)==3|0}function Ye(s,l){return s=s|0,l=y(l),(n[s+4>>2]|0)==3?l=y(0):l=y(Vr(s,l)),y(l)}function At(s,l){return s=s|0,l=l|0,s=n[s>>2]|0,(s|0?s:(l|0)>1?l:1)|0}function hr(s,l){s=s|0,l=l|0;var c=0;e:do if((l|0)==2){switch(s|0){case 2:{s=3;break e}case 3:break;default:{c=4;break e}}s=2}else c=4;while(!1);return s|0}function Ir(s,l){s=s|0,l=l|0;var c=Ze;return ge(l)|0&&n[s+312>>2]|0&&(c=y(h[s+308>>2]),c>=y(0))||(c=y(Yn(y(h[(vn(s+276|0,n[1040+(l<<2)>>2]|0,992)|0)>>2]),y(0)))),y(c)}function Rn(s,l){s=s|0,l=l|0;var c=Ze;return ge(l)|0&&n[s+320>>2]|0&&(c=y(h[s+316>>2]),c>=y(0))||(c=y(Yn(y(h[(vn(s+276|0,n[1e3+(l<<2)>>2]|0,992)|0)>>2]),y(0)))),y(c)}function ai(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return ge(l)|0&&n[s+240>>2]|0&&(f=y(Vr(s+236|0,c)),f>=y(0))||(f=y(Yn(y(Vr(vn(s+204|0,n[1040+(l<<2)>>2]|0,992)|0,c)),y(0)))),y(f)}function ns(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return ge(l)|0&&n[s+248>>2]|0&&(f=y(Vr(s+244|0,c)),f>=y(0))||(f=y(Yn(y(Vr(vn(s+204|0,n[1e3+(l<<2)>>2]|0,992)|0,c)),y(0)))),y(f)}function GA(s,l,c,f,d,m,B){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=y(m),B=y(B);var k=Ze,F=Ze,M=Ze,O=Ze,j=Ze,oe=Ze,We=0,Oe=0,Qe=0;Qe=C,C=C+16|0,We=Qe,Oe=s+964|0,pi(s,(n[Oe>>2]|0)!=0,3519),k=y(da(s,2,l)),F=y(da(s,0,l)),M=y(fn(s,2,l)),O=y(fn(s,0,l)),Ot(l)|0?j=l:j=y(Yn(y(0),y(y(l-M)-k))),Ot(c)|0?oe=c:oe=y(Yn(y(0),y(y(c-O)-F))),(f|0)==1&(d|0)==1?(h[s+908>>2]=y(Mn(s,2,y(l-M),m,m)),l=y(Mn(s,0,y(c-O),B,m))):(oW[n[Oe>>2]&1](We,s,j,f,oe,d),j=y(k+y(h[We>>2])),oe=y(l-M),h[s+908>>2]=y(Mn(s,2,(f|2|0)==2?j:oe,m,m)),oe=y(F+y(h[We+4>>2])),l=y(c-O),l=y(Mn(s,0,(d|2|0)==2?oe:l,B,m))),h[s+912>>2]=l,C=Qe}function lD(s,l,c,f,d,m,B){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=y(m),B=y(B);var k=Ze,F=Ze,M=Ze,O=Ze;M=y(da(s,2,m)),k=y(da(s,0,m)),O=y(fn(s,2,m)),F=y(fn(s,0,m)),l=y(l-O),h[s+908>>2]=y(Mn(s,2,(f|2|0)==2?M:l,m,m)),c=y(c-F),h[s+912>>2]=y(Mn(s,0,(d|2|0)==2?k:c,B,m))}function SI(s,l,c,f,d,m,B){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=y(m),B=y(B);var k=0,F=Ze,M=Ze;return k=(f|0)==2,!(l<=y(0)&k)&&!(c<=y(0)&(d|0)==2)&&!((f|0)==1&(d|0)==1)?s=0:(F=y(fn(s,0,m)),M=y(fn(s,2,m)),k=l>2]=y(Mn(s,2,k?y(0):l,m,m)),l=y(c-F),k=c>2]=y(Mn(s,0,k?y(0):l,B,m)),s=1),s|0}function Fd(s,l){return s=s|0,l=l|0,E0(s)|0?s=hr(2,l)|0:s=0,s|0}function Cp(s,l,c){return s=s|0,l=l|0,c=y(c),c=y(ai(s,l,c)),y(c+y(Ir(s,l)))}function PI(s,l,c){return s=s|0,l=l|0,c=y(c),c=y(ns(s,l,c)),y(c+y(Rn(s,l)))}function da(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return f=y(Cp(s,l,c)),y(f+y(PI(s,l,c)))}function xI(s){return s=s|0,n[s+24>>2]|0?s=0:y(WA(s))!=y(0)?s=1:s=y(Ip(s))!=y(0),s|0}function WA(s){s=s|0;var l=Ze;if(n[s+944>>2]|0){if(l=y(h[s+44>>2]),Ot(l)|0)return l=y(h[s+40>>2]),s=l>y(0)&((Ot(l)|0)^1),y(s?l:y(0))}else l=y(0);return y(l)}function Ip(s){s=s|0;var l=Ze,c=0,f=Ze;do if(n[s+944>>2]|0){if(l=y(h[s+48>>2]),Ot(l)|0){if(c=o[(n[s+976>>2]|0)+2>>0]|0,!(c<<24>>24)&&(f=y(h[s+40>>2]),f>24?y(1):y(0)}}else l=y(0);while(!1);return y(l)}function Rd(s){s=s|0;var l=0,c=0;if(sm(s+400|0,0,540)|0,o[s+985>>0]=1,ee(s),c=Di(s)|0,c|0){l=s+948|0,s=0;do Rd(n[(n[l>>2]|0)+(s<<2)>>2]|0),s=s+1|0;while((s|0)!=(c|0))}}function cD(s,l,c,f,d,m,B,k,F,M){s=s|0,l=l|0,c=y(c),f=f|0,d=y(d),m=y(m),B=y(B),k=k|0,F=F|0,M=M|0;var O=0,j=Ze,oe=0,We=0,Oe=Ze,Qe=Ze,rt=0,Xe=Ze,ct=0,_e=Ze,Ge=0,Nt=0,_r=0,ur=0,Zt=0,kr=0,Or=0,lr=0,Ln=0,lo=0;Ln=C,C=C+16|0,_r=Ln+12|0,ur=Ln+8|0,Zt=Ln+4|0,kr=Ln,lr=hr(n[s+4>>2]|0,F)|0,Ge=ge(lr)|0,j=y(Vr(GF(l)|0,Ge?m:B)),Nt=Ns(l,2,m)|0,Or=Ns(l,0,B)|0;do if(!(Ot(j)|0)&&!(Ot(Ge?c:d)|0)){if(O=l+504|0,!(Ot(y(h[O>>2]))|0)&&(!(kI(n[l+976>>2]|0,0)|0)||(n[l+500>>2]|0)==(n[2278]|0)))break;h[O>>2]=y(Yn(j,y(da(l,lr,m))))}else oe=7;while(!1);do if((oe|0)==7){if(ct=Ge^1,!(ct|Nt^1)){B=y(Vr(n[l+992>>2]|0,m)),h[l+504>>2]=y(Yn(B,y(da(l,2,m))));break}if(!(Ge|Or^1)){B=y(Vr(n[l+996>>2]|0,B)),h[l+504>>2]=y(Yn(B,y(da(l,0,m))));break}h[_r>>2]=y(ue),h[ur>>2]=y(ue),n[Zt>>2]=0,n[kr>>2]=0,Xe=y(fn(l,2,m)),_e=y(fn(l,0,m)),Nt?(Oe=y(Xe+y(Vr(n[l+992>>2]|0,m))),h[_r>>2]=Oe,n[Zt>>2]=1,We=1):(We=0,Oe=y(ue)),Or?(j=y(_e+y(Vr(n[l+996>>2]|0,B))),h[ur>>2]=j,n[kr>>2]=1,O=1):(O=0,j=y(ue)),oe=n[s+32>>2]|0,Ge&(oe|0)==2?oe=2:Ot(Oe)|0&&!(Ot(c)|0)&&(h[_r>>2]=c,n[Zt>>2]=2,We=2,Oe=c),!((oe|0)==2&ct)&&Ot(j)|0&&!(Ot(d)|0)&&(h[ur>>2]=d,n[kr>>2]=2,O=2,j=d),Qe=y(h[l+396>>2]),rt=Ot(Qe)|0;do if(rt)oe=We;else{if((We|0)==1&ct){h[ur>>2]=y(y(Oe-Xe)/Qe),n[kr>>2]=1,O=1,oe=1;break}Ge&(O|0)==1?(h[_r>>2]=y(Qe*y(j-_e)),n[Zt>>2]=1,O=1,oe=1):oe=We}while(!1);lo=Ot(c)|0,We=(Wi(s,l)|0)!=4,!(Ge|Nt|((f|0)!=1|lo)|(We|(oe|0)==1))&&(h[_r>>2]=c,n[Zt>>2]=1,!rt)&&(h[ur>>2]=y(y(c-Xe)/Qe),n[kr>>2]=1,O=1),!(Or|ct|((k|0)!=1|(Ot(d)|0))|(We|(O|0)==1))&&(h[ur>>2]=d,n[kr>>2]=1,!rt)&&(h[_r>>2]=y(Qe*y(d-_e)),n[Zt>>2]=1),xc(l,2,m,m,Zt,_r),xc(l,0,B,m,kr,ur),c=y(h[_r>>2]),d=y(h[ur>>2]),Ka(l,c,d,F,n[Zt>>2]|0,n[kr>>2]|0,m,B,0,3565,M)|0,B=y(h[l+908+(n[976+(lr<<2)>>2]<<2)>>2]),h[l+504>>2]=y(Yn(B,y(da(l,lr,m))))}while(!1);n[l+500>>2]=n[2278],C=Ln}function Mn(s,l,c,f,d){return s=s|0,l=l|0,c=y(c),f=y(f),d=y(d),f=y(y0(s,l,c,f)),y(Yn(f,y(da(s,l,d))))}function Wi(s,l){return s=s|0,l=l|0,l=l+20|0,l=n[(n[l>>2]|0?l:s+16|0)>>2]|0,(l|0)==5&&E0(n[s+4>>2]|0)|0&&(l=1),l|0}function Ja(s,l){return s=s|0,l=l|0,ge(l)|0&&n[s+96>>2]|0?l=4:l=n[1040+(l<<2)>>2]|0,s+60+(l<<3)|0}function za(s,l){return s=s|0,l=l|0,ge(l)|0&&n[s+104>>2]|0?l=5:l=n[1e3+(l<<2)>>2]|0,s+60+(l<<3)|0}function xc(s,l,c,f,d,m){switch(s=s|0,l=l|0,c=y(c),f=y(f),d=d|0,m=m|0,c=y(Vr(s+380+(n[976+(l<<2)>>2]<<3)|0,c)),c=y(c+y(fn(s,l,f))),n[d>>2]|0){case 2:case 1:{d=Ot(c)|0,f=y(h[m>>2]),h[m>>2]=d|f>2]=2,h[m>>2]=c);break}default:}}function Ho(s,l){return s=s|0,l=l|0,s=s+132|0,ge(l)|0&&n[(vn(s,4,948)|0)+4>>2]|0?s=1:s=(n[(vn(s,n[1040+(l<<2)>>2]|0,948)|0)+4>>2]|0)!=0,s|0}function YA(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0;return s=s+132|0,ge(l)|0&&(f=vn(s,4,948)|0,(n[f+4>>2]|0)!=0)?d=4:(f=vn(s,n[1040+(l<<2)>>2]|0,948)|0,n[f+4>>2]|0?d=4:c=y(0)),(d|0)==4&&(c=y(Vr(f,c))),y(c)}function VA(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return f=y(h[s+908+(n[976+(l<<2)>>2]<<2)>>2]),f=y(f+y(K(s,l,c))),y(f+y(re(s,l,c)))}function HF(s){s=s|0;var l=0,c=0,f=0;e:do if(E0(n[s+4>>2]|0)|0)l=0;else if((n[s+16>>2]|0)!=5)if(c=Di(s)|0,!c)l=0;else for(l=0;;){if(f=rs(s,l)|0,!(n[f+24>>2]|0)&&(n[f+20>>2]|0)==5){l=1;break e}if(l=l+1|0,l>>>0>=c>>>0){l=0;break}}else l=1;while(!1);return l|0}function qF(s,l){s=s|0,l=l|0;var c=Ze;return c=y(h[s+908+(n[976+(l<<2)>>2]<<2)>>2]),c>=y(0)&((Ot(c)|0)^1)|0}function m0(s){s=s|0;var l=Ze,c=0,f=0,d=0,m=0,B=0,k=0,F=Ze;if(c=n[s+968>>2]|0,c)F=y(h[s+908>>2]),l=y(h[s+912>>2]),l=y(tW[c&0](s,F,l)),pi(s,(Ot(l)|0)^1,3573);else{m=Di(s)|0;do if(m|0){for(c=0,d=0;;){if(f=rs(s,d)|0,n[f+940>>2]|0){B=8;break}if((n[f+24>>2]|0)!=1)if(k=(Wi(s,f)|0)==5,k){c=f;break}else c=c|0?c:f;if(d=d+1|0,d>>>0>=m>>>0){B=8;break}}if((B|0)==8&&!c)break;return l=y(m0(c)),y(l+y(h[c+404>>2]))}while(!1);l=y(h[s+912>>2])}return y(l)}function y0(s,l,c,f){s=s|0,l=l|0,c=y(c),f=y(f);var d=Ze,m=0;return E0(l)|0?(l=1,m=3):ge(l)|0?(l=0,m=3):(f=y(ue),d=y(ue)),(m|0)==3&&(d=y(Vr(s+364+(l<<3)|0,f)),f=y(Vr(s+380+(l<<3)|0,f))),m=f=y(0)&((Ot(f)|0)^1)),c=m?f:c,m=d>=y(0)&((Ot(d)|0)^1)&c>2]|0,m)|0,Oe=Fd(rt,m)|0,Qe=ge(rt)|0,j=y(fn(l,2,c)),oe=y(fn(l,0,c)),Ns(l,2,c)|0?k=y(j+y(Vr(n[l+992>>2]|0,c))):Ho(l,2)|0&&Td(l,2)|0?(k=y(h[s+908>>2]),F=y(Ir(s,2)),F=y(k-y(F+y(Rn(s,2)))),k=y(YA(l,2,c)),k=y(Mn(l,2,y(F-y(k+y(wp(l,2,c)))),c,c))):k=y(ue),Ns(l,0,d)|0?F=y(oe+y(Vr(n[l+996>>2]|0,d))):Ho(l,0)|0&&Td(l,0)|0?(F=y(h[s+912>>2]),ct=y(Ir(s,0)),ct=y(F-y(ct+y(Rn(s,0)))),F=y(YA(l,0,d)),F=y(Mn(l,0,y(ct-y(F+y(wp(l,0,d)))),d,c))):F=y(ue),M=Ot(k)|0,O=Ot(F)|0;do if(M^O&&(We=y(h[l+396>>2]),!(Ot(We)|0)))if(M){k=y(j+y(y(F-oe)*We));break}else{ct=y(oe+y(y(k-j)/We)),F=O?ct:F;break}while(!1);O=Ot(k)|0,M=Ot(F)|0,O|M&&(_e=(O^1)&1,f=c>y(0)&((f|0)!=0&O),k=Qe?k:f?c:k,Ka(l,k,F,m,Qe?_e:f?2:_e,O&(M^1)&1,k,F,0,3623,B)|0,k=y(h[l+908>>2]),k=y(k+y(fn(l,2,c))),F=y(h[l+912>>2]),F=y(F+y(fn(l,0,c)))),Ka(l,k,F,m,1,1,k,F,1,3635,B)|0,Td(l,rt)|0&&!(Ho(l,rt)|0)?(_e=n[976+(rt<<2)>>2]|0,ct=y(h[s+908+(_e<<2)>>2]),ct=y(ct-y(h[l+908+(_e<<2)>>2])),ct=y(ct-y(Rn(s,rt))),ct=y(ct-y(re(l,rt,c))),ct=y(ct-y(wp(l,rt,Qe?c:d))),h[l+400+(n[1040+(rt<<2)>>2]<<2)>>2]=ct):Xe=21;do if((Xe|0)==21){if(!(Ho(l,rt)|0)&&(n[s+8>>2]|0)==1){_e=n[976+(rt<<2)>>2]|0,ct=y(h[s+908+(_e<<2)>>2]),ct=y(y(ct-y(h[l+908+(_e<<2)>>2]))*y(.5)),h[l+400+(n[1040+(rt<<2)>>2]<<2)>>2]=ct;break}!(Ho(l,rt)|0)&&(n[s+8>>2]|0)==2&&(_e=n[976+(rt<<2)>>2]|0,ct=y(h[s+908+(_e<<2)>>2]),ct=y(ct-y(h[l+908+(_e<<2)>>2])),h[l+400+(n[1040+(rt<<2)>>2]<<2)>>2]=ct)}while(!1);Td(l,Oe)|0&&!(Ho(l,Oe)|0)?(_e=n[976+(Oe<<2)>>2]|0,ct=y(h[s+908+(_e<<2)>>2]),ct=y(ct-y(h[l+908+(_e<<2)>>2])),ct=y(ct-y(Rn(s,Oe))),ct=y(ct-y(re(l,Oe,c))),ct=y(ct-y(wp(l,Oe,Qe?d:c))),h[l+400+(n[1040+(Oe<<2)>>2]<<2)>>2]=ct):Xe=30;do if((Xe|0)==30&&!(Ho(l,Oe)|0)){if((Wi(s,l)|0)==2){_e=n[976+(Oe<<2)>>2]|0,ct=y(h[s+908+(_e<<2)>>2]),ct=y(y(ct-y(h[l+908+(_e<<2)>>2]))*y(.5)),h[l+400+(n[1040+(Oe<<2)>>2]<<2)>>2]=ct;break}_e=(Wi(s,l)|0)==3,_e^(n[s+28>>2]|0)==2&&(_e=n[976+(Oe<<2)>>2]|0,ct=y(h[s+908+(_e<<2)>>2]),ct=y(ct-y(h[l+908+(_e<<2)>>2])),h[l+400+(n[1040+(Oe<<2)>>2]<<2)>>2]=ct)}while(!1)}function bI(s,l,c){s=s|0,l=l|0,c=c|0;var f=Ze,d=0;d=n[976+(c<<2)>>2]|0,f=y(h[l+908+(d<<2)>>2]),f=y(y(h[s+908+(d<<2)>>2])-f),f=y(f-y(h[l+400+(n[1040+(c<<2)>>2]<<2)>>2])),h[l+400+(n[1e3+(c<<2)>>2]<<2)>>2]=f}function E0(s){return s=s|0,(s|1|0)==1|0}function GF(s){s=s|0;var l=Ze;switch(n[s+56>>2]|0){case 0:case 3:{l=y(h[s+40>>2]),l>y(0)&((Ot(l)|0)^1)?s=o[(n[s+976>>2]|0)+2>>0]|0?1056:992:s=1056;break}default:s=s+52|0}return s|0}function kI(s,l){return s=s|0,l=l|0,(o[s+l>>0]|0)!=0|0}function Td(s,l){return s=s|0,l=l|0,s=s+132|0,ge(l)|0&&n[(vn(s,5,948)|0)+4>>2]|0?s=1:s=(n[(vn(s,n[1e3+(l<<2)>>2]|0,948)|0)+4>>2]|0)!=0,s|0}function wp(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0;return s=s+132|0,ge(l)|0&&(f=vn(s,5,948)|0,(n[f+4>>2]|0)!=0)?d=4:(f=vn(s,n[1e3+(l<<2)>>2]|0,948)|0,n[f+4>>2]|0?d=4:c=y(0)),(d|0)==4&&(c=y(Vr(f,c))),y(c)}function uD(s,l,c){return s=s|0,l=l|0,c=y(c),Ho(s,l)|0?c=y(YA(s,l,c)):c=y(-y(wp(s,l,c))),y(c)}function AD(s){return s=y(s),h[D>>2]=s,n[D>>2]|0|0}function Ld(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>1073741823)Tt();else{d=Yt(l<<2)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<2)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<2)}function fD(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Nd(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-4-l|0)>>>2)<<2)),s=n[s>>2]|0,s|0&&yt(s)}function pD(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;if(B=s+4|0,k=n[B>>2]|0,d=k-f|0,m=d>>2,s=l+(m<<2)|0,s>>>0>>0){f=k;do n[f>>2]=n[s>>2],s=s+4|0,f=(n[B>>2]|0)+4|0,n[B>>2]=f;while(s>>>0>>0)}m|0&&rw(k+(0-m<<2)|0,l|0,d|0)|0}function hD(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0;return k=l+4|0,F=n[k>>2]|0,d=n[s>>2]|0,B=c,m=B-d|0,f=F+(0-(m>>2)<<2)|0,n[k>>2]=f,(m|0)>0&&br(f|0,d|0,m|0)|0,d=s+4|0,m=l+8|0,f=(n[d>>2]|0)-B|0,(f|0)>0&&(br(n[m>>2]|0,c|0,f|0)|0,n[m>>2]=(n[m>>2]|0)+(f>>>2<<2)),B=n[s>>2]|0,n[s>>2]=n[k>>2],n[k>>2]=B,B=n[d>>2]|0,n[d>>2]=n[m>>2],n[m>>2]=B,B=s+8|0,c=l+12|0,s=n[B>>2]|0,n[B>>2]=n[c>>2],n[c>>2]=s,n[l>>2]=n[k>>2],F|0}function QI(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;if(B=n[l>>2]|0,m=n[c>>2]|0,(B|0)!=(m|0)){d=s+8|0,c=((m+-4-B|0)>>>2)+1|0,s=B,f=n[d>>2]|0;do n[f>>2]=n[s>>2],f=(n[d>>2]|0)+4|0,n[d>>2]=f,s=s+4|0;while((s|0)!=(m|0));n[l>>2]=B+(c<<2)}}function FI(){Oo()}function gD(){var s=0;return s=Yt(4)|0,RI(s),s|0}function RI(s){s=s|0,n[s>>2]=Pl()|0}function dD(s){s=s|0,s|0&&(C0(s),yt(s))}function C0(s){s=s|0,st(n[s>>2]|0)}function WF(s,l,c){s=s|0,l=l|0,c=c|0,xl(n[s>>2]|0,l,c)}function Od(s,l){s=s|0,l=y(l),dp(n[s>>2]|0,l)}function Md(s,l){return s=s|0,l=l|0,kI(n[s>>2]|0,l)|0}function Ud(){var s=0;return s=Yt(8)|0,I0(s,0),s|0}function I0(s,l){s=s|0,l=l|0,l?l=Mo(n[l>>2]|0)|0:l=qi()|0,n[s>>2]=l,n[s+4>>2]=0,Sn(l,s)}function _d(s){s=s|0;var l=0;return l=Yt(8)|0,I0(l,s),l|0}function w0(s){s=s|0,s|0&&(Hd(s),yt(s))}function Hd(s){s=s|0;var l=0;Dl(n[s>>2]|0),l=s+4|0,s=n[l>>2]|0,n[l>>2]=0,s|0&&(xu(s),yt(s))}function xu(s){s=s|0,bu(s)}function bu(s){s=s|0,s=n[s>>2]|0,s|0&&sa(s|0)}function TI(s){return s=s|0,fa(s)|0}function LI(s){s=s|0;var l=0,c=0;c=s+4|0,l=n[c>>2]|0,n[c>>2]=0,l|0&&(xu(l),yt(l)),Sl(n[s>>2]|0)}function qd(s,l){s=s|0,l=l|0,sn(n[s>>2]|0,n[l>>2]|0)}function YF(s,l){s=s|0,l=l|0,fp(n[s>>2]|0,l)}function VF(s,l,c){s=s|0,l=l|0,c=+c,Sd(n[s>>2]|0,l,y(c))}function jd(s,l,c){s=s|0,l=l|0,c=+c,Pd(n[s>>2]|0,l,y(c))}function NI(s,l){s=s|0,l=l|0,cp(n[s>>2]|0,l)}function OI(s,l){s=s|0,l=l|0,to(n[s>>2]|0,l)}function Pr(s,l){s=s|0,l=l|0,Ap(n[s>>2]|0,l)}function Os(s,l){s=s|0,l=l|0,wd(n[s>>2]|0,l)}function Oi(s,l){s=s|0,l=l|0,o0(n[s>>2]|0,l)}function ms(s,l){s=s|0,l=l|0,eo(n[s>>2]|0,l)}function KA(s,l,c){s=s|0,l=l|0,c=+c,OA(n[s>>2]|0,l,y(c))}function MI(s,l,c){s=s|0,l=l|0,c=+c,W(n[s>>2]|0,l,y(c))}function is(s,l){s=s|0,l=l|0,MA(n[s>>2]|0,l)}function Gd(s,l){s=s|0,l=l|0,vd(n[s>>2]|0,l)}function Bp(s,l){s=s|0,l=l|0,ro(n[s>>2]|0,l)}function B0(s,l){s=s|0,l=+l,pp(n[s>>2]|0,y(l))}function vp(s,l){s=s|0,l=+l,Ya(n[s>>2]|0,y(l))}function UI(s,l){s=s|0,l=+l,Dd(n[s>>2]|0,y(l))}function _I(s,l){s=s|0,l=+l,l0(n[s>>2]|0,y(l))}function HI(s,l){s=s|0,l=+l,Wa(n[s>>2]|0,y(l))}function qI(s,l){s=s|0,l=+l,c0(n[s>>2]|0,y(l))}function ku(s,l){s=s|0,l=+l,DI(n[s>>2]|0,y(l))}function ir(s){s=s|0,hp(n[s>>2]|0)}function Wd(s,l){s=s|0,l=+l,Ni(n[s>>2]|0,y(l))}function jI(s,l){s=s|0,l=+l,Iu(n[s>>2]|0,y(l))}function bl(s){s=s|0,pa(n[s>>2]|0)}function Qu(s,l){s=s|0,l=+l,Bc(n[s>>2]|0,y(l))}function v0(s,l){s=s|0,l=+l,wu(n[s>>2]|0,y(l))}function D0(s,l){s=s|0,l=+l,oi(n[s>>2]|0,y(l))}function GI(s,l){s=s|0,l=+l,UA(n[s>>2]|0,y(l))}function WI(s,l){s=s|0,l=+l,Uo(n[s>>2]|0,y(l))}function bc(s,l){s=s|0,l=+l,ga(n[s>>2]|0,y(l))}function S0(s,l){s=s|0,l=+l,gp(n[s>>2]|0,y(l))}function YI(s,l){s=s|0,l=+l,f0(n[s>>2]|0,y(l))}function Yd(s,l){s=s|0,l=+l,_A(n[s>>2]|0,y(l))}function kc(s,l,c){s=s|0,l=l|0,c=+c,wc(n[s>>2]|0,l,y(c))}function Vd(s,l,c){s=s|0,l=l|0,c=+c,no(n[s>>2]|0,l,y(c))}function P0(s,l,c){s=s|0,l=l|0,c=+c,Cu(n[s>>2]|0,l,y(c))}function x0(s){return s=s|0,s0(n[s>>2]|0)|0}function oo(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,NA(d,n[l>>2]|0,c),ss(s,d),C=f}function ss(s,l){s=s|0,l=l|0,Xa(s,n[l+4>>2]|0,+y(h[l>>2]))}function Xa(s,l,c){s=s|0,l=l|0,c=+c,n[s>>2]=l,E[s+8>>3]=c}function Kd(s){return s=s|0,vI(n[s>>2]|0)|0}function qo(s){return s=s|0,up(n[s>>2]|0)|0}function mD(s){return s=s|0,Ic(n[s>>2]|0)|0}function Dp(s){return s=s|0,BI(n[s>>2]|0)|0}function VI(s){return s=s|0,a0(n[s>>2]|0)|0}function KF(s){return s=s|0,Bd(n[s>>2]|0)|0}function yD(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,xt(d,n[l>>2]|0,c),ss(s,d),C=f}function ED(s){return s=s|0,Eu(n[s>>2]|0)|0}function Jd(s){return s=s|0,Ga(n[s>>2]|0)|0}function KI(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,LA(f,n[l>>2]|0),ss(s,f),C=c}function Sp(s){return s=s|0,+ +y(ei(n[s>>2]|0))}function CD(s){return s=s|0,+ +y(Qi(n[s>>2]|0))}function ID(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,cr(f,n[l>>2]|0),ss(s,f),C=c}function b0(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,u0(f,n[l>>2]|0),ss(s,f),C=c}function JF(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,wt(f,n[l>>2]|0),ss(s,f),C=c}function zF(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,ha(f,n[l>>2]|0),ss(s,f),C=c}function wD(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,A0(f,n[l>>2]|0),ss(s,f),C=c}function BD(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,bd(f,n[l>>2]|0),ss(s,f),C=c}function JA(s){return s=s|0,+ +y(p0(n[s>>2]|0))}function XF(s,l){return s=s|0,l=l|0,+ +y(xd(n[s>>2]|0,l))}function ZF(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,dt(d,n[l>>2]|0,c),ss(s,d),C=f}function Qc(s,l,c){s=s|0,l=l|0,c=c|0,ar(n[s>>2]|0,n[l>>2]|0,c)}function $F(s,l){s=s|0,l=l|0,yu(n[s>>2]|0,n[l>>2]|0)}function vD(s){return s=s|0,Di(n[s>>2]|0)|0}function eR(s){return s=s|0,s=mt(n[s>>2]|0)|0,s?s=TI(s)|0:s=0,s|0}function DD(s,l){return s=s|0,l=l|0,s=rs(n[s>>2]|0,l)|0,s?s=TI(s)|0:s=0,s|0}function Fu(s,l){s=s|0,l=l|0;var c=0,f=0;f=Yt(4)|0,SD(f,l),c=s+4|0,l=n[c>>2]|0,n[c>>2]=f,l|0&&(xu(l),yt(l)),vt(n[s>>2]|0,1)}function SD(s,l){s=s|0,l=l|0,iR(s,l)}function tR(s,l,c,f,d,m){s=s|0,l=l|0,c=y(c),f=f|0,d=y(d),m=m|0;var B=0,k=0;B=C,C=C+16|0,k=B,PD(k,fa(l)|0,+c,f,+d,m),h[s>>2]=y(+E[k>>3]),h[s+4>>2]=y(+E[k+8>>3]),C=B}function PD(s,l,c,f,d,m){s=s|0,l=l|0,c=+c,f=f|0,d=+d,m=m|0;var B=0,k=0,F=0,M=0,O=0;B=C,C=C+32|0,O=B+8|0,M=B+20|0,F=B,k=B+16|0,E[O>>3]=c,n[M>>2]=f,E[F>>3]=d,n[k>>2]=m,zd(s,n[l+4>>2]|0,O,M,F,k),C=B}function zd(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0;B=C,C=C+16|0,k=B,$a(k),l=ys(l)|0,xD(s,l,+E[c>>3],n[f>>2]|0,+E[d>>3],n[m>>2]|0),el(k),C=B}function ys(s){return s=s|0,n[s>>2]|0}function xD(s,l,c,f,d,m){s=s|0,l=l|0,c=+c,f=f|0,d=+d,m=m|0;var B=0;B=jo(JI()|0)|0,c=+ma(c),f=Xd(f)|0,d=+ma(d),rR(s,qn(0,B|0,l|0,+c,f|0,+d,Xd(m)|0)|0)}function JI(){var s=0;return o[7608]|0||(XI(9120),s=7608,n[s>>2]=1,n[s+4>>2]=0),9120}function jo(s){return s=s|0,n[s+8>>2]|0}function ma(s){return s=+s,+ +Ru(s)}function Xd(s){return s=s|0,k0(s)|0}function rR(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;d=C,C=C+32|0,c=d,f=l,f&1?(ya(c,0),ia(f|0,c|0)|0,zI(s,c),nR(c)):(n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=n[l+8>>2],n[s+12>>2]=n[l+12>>2]),C=d}function ya(s,l){s=s|0,l=l|0,Fc(s,l),n[s+8>>2]=0,o[s+24>>0]=0}function zI(s,l){s=s|0,l=l|0,l=l+8|0,n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=n[l+8>>2],n[s+12>>2]=n[l+12>>2]}function nR(s){s=s|0,o[s+24>>0]=0}function Fc(s,l){s=s|0,l=l|0,n[s>>2]=l}function k0(s){return s=s|0,s|0}function Ru(s){return s=+s,+s}function XI(s){s=s|0,ao(s,ZI()|0,4)}function ZI(){return 1064}function ao(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c,n[s+8>>2]=ki(l|0,c+1|0)|0}function iR(s,l){s=s|0,l=l|0,l=n[l>>2]|0,n[s>>2]=l,hc(l|0)}function bD(s){s=s|0;var l=0,c=0;c=s+4|0,l=n[c>>2]|0,n[c>>2]=0,l|0&&(xu(l),yt(l)),vt(n[s>>2]|0,0)}function kD(s){s=s|0,Dt(n[s>>2]|0)}function Zd(s){return s=s|0,er(n[s>>2]|0)|0}function sR(s,l,c,f){s=s|0,l=+l,c=+c,f=f|0,qA(n[s>>2]|0,y(l),y(c),f)}function oR(s){return s=s|0,+ +y(vc(n[s>>2]|0))}function v(s){return s=s|0,+ +y(Bu(n[s>>2]|0))}function S(s){return s=s|0,+ +y(Dc(n[s>>2]|0))}function Q(s){return s=s|0,+ +y(gs(n[s>>2]|0))}function H(s){return s=s|0,+ +y(Sc(n[s>>2]|0))}function Y(s){return s=s|0,+ +y(On(n[s>>2]|0))}function ne(s,l){s=s|0,l=l|0,E[s>>3]=+y(vc(n[l>>2]|0)),E[s+8>>3]=+y(Bu(n[l>>2]|0)),E[s+16>>3]=+y(Dc(n[l>>2]|0)),E[s+24>>3]=+y(gs(n[l>>2]|0)),E[s+32>>3]=+y(Sc(n[l>>2]|0)),E[s+40>>3]=+y(On(n[l>>2]|0))}function Be(s,l){return s=s|0,l=l|0,+ +y(ji(n[s>>2]|0,l))}function Ue(s,l){return s=s|0,l=l|0,+ +y(Ci(n[s>>2]|0,l))}function ft(s,l){return s=s|0,l=l|0,+ +y(HA(n[s>>2]|0,l))}function jt(){return Dn()|0}function wr(){Tr(),Xt(),jn(),li(),Ea(),$e()}function Tr(){PLe(11713,4938,1)}function Xt(){YTe(10448)}function jn(){PTe(10408)}function li(){zRe(10324)}function Ea(){iFe(10096)}function $e(){je(9132)}function je(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0,rt=0,Xe=0,ct=0,_e=0,Ge=0,Nt=0,_r=0,ur=0,Zt=0,kr=0,Or=0,lr=0,Ln=0,lo=0,co=0,uo=0,Ia=0,Lp=0,Np=0,kl=0,Op=0,Nu=0,Ou=0,Mp=0,Up=0,_p=0,$r=0,Ql=0,Hp=0,Lc=0,qp=0,jp=0,Mu=0,Uu=0,Nc=0,Ms=0,rl=0,Go=0,Fl=0,rf=0,nf=0,_u=0,sf=0,of=0,Us=0,Cs=0,Rl=0,Un=0,af=0,Ao=0,Oc=0,fo=0,Mc=0,lf=0,cf=0,Uc=0,_s=0,Tl=0,uf=0,Af=0,ff=0,Fr=0,ri=0,Is=0,po=0,Hs=0,Lr=0,Ar=0,Ll=0;l=C,C=C+672|0,c=l+656|0,Ll=l+648|0,Ar=l+640|0,Lr=l+632|0,Hs=l+624|0,po=l+616|0,Is=l+608|0,ri=l+600|0,Fr=l+592|0,ff=l+584|0,Af=l+576|0,uf=l+568|0,Tl=l+560|0,_s=l+552|0,Uc=l+544|0,cf=l+536|0,lf=l+528|0,Mc=l+520|0,fo=l+512|0,Oc=l+504|0,Ao=l+496|0,af=l+488|0,Un=l+480|0,Rl=l+472|0,Cs=l+464|0,Us=l+456|0,of=l+448|0,sf=l+440|0,_u=l+432|0,nf=l+424|0,rf=l+416|0,Fl=l+408|0,Go=l+400|0,rl=l+392|0,Ms=l+384|0,Nc=l+376|0,Uu=l+368|0,Mu=l+360|0,jp=l+352|0,qp=l+344|0,Lc=l+336|0,Hp=l+328|0,Ql=l+320|0,$r=l+312|0,_p=l+304|0,Up=l+296|0,Mp=l+288|0,Ou=l+280|0,Nu=l+272|0,Op=l+264|0,kl=l+256|0,Np=l+248|0,Lp=l+240|0,Ia=l+232|0,uo=l+224|0,co=l+216|0,lo=l+208|0,Ln=l+200|0,lr=l+192|0,Or=l+184|0,kr=l+176|0,Zt=l+168|0,ur=l+160|0,_r=l+152|0,Nt=l+144|0,Ge=l+136|0,_e=l+128|0,ct=l+120|0,Xe=l+112|0,rt=l+104|0,Qe=l+96|0,Oe=l+88|0,We=l+80|0,oe=l+72|0,j=l+64|0,O=l+56|0,M=l+48|0,F=l+40|0,k=l+32|0,B=l+24|0,m=l+16|0,d=l+8|0,f=l,pt(s,3646),zt(s,3651,2)|0,Br(s,3665,2)|0,Wn(s,3682,18)|0,n[Ll>>2]=19,n[Ll+4>>2]=0,n[c>>2]=n[Ll>>2],n[c+4>>2]=n[Ll+4>>2],xr(s,3690,c)|0,n[Ar>>2]=1,n[Ar+4>>2]=0,n[c>>2]=n[Ar>>2],n[c+4>>2]=n[Ar+4>>2],Pn(s,3696,c)|0,n[Lr>>2]=2,n[Lr+4>>2]=0,n[c>>2]=n[Lr>>2],n[c+4>>2]=n[Lr+4>>2],Tn(s,3706,c)|0,n[Hs>>2]=1,n[Hs+4>>2]=0,n[c>>2]=n[Hs>>2],n[c+4>>2]=n[Hs+4>>2],Yr(s,3722,c)|0,n[po>>2]=2,n[po+4>>2]=0,n[c>>2]=n[po>>2],n[c+4>>2]=n[po+4>>2],Yr(s,3734,c)|0,n[Is>>2]=3,n[Is+4>>2]=0,n[c>>2]=n[Is>>2],n[c+4>>2]=n[Is+4>>2],Tn(s,3753,c)|0,n[ri>>2]=4,n[ri+4>>2]=0,n[c>>2]=n[ri>>2],n[c+4>>2]=n[ri+4>>2],Tn(s,3769,c)|0,n[Fr>>2]=5,n[Fr+4>>2]=0,n[c>>2]=n[Fr>>2],n[c+4>>2]=n[Fr+4>>2],Tn(s,3783,c)|0,n[ff>>2]=6,n[ff+4>>2]=0,n[c>>2]=n[ff>>2],n[c+4>>2]=n[ff+4>>2],Tn(s,3796,c)|0,n[Af>>2]=7,n[Af+4>>2]=0,n[c>>2]=n[Af>>2],n[c+4>>2]=n[Af+4>>2],Tn(s,3813,c)|0,n[uf>>2]=8,n[uf+4>>2]=0,n[c>>2]=n[uf>>2],n[c+4>>2]=n[uf+4>>2],Tn(s,3825,c)|0,n[Tl>>2]=3,n[Tl+4>>2]=0,n[c>>2]=n[Tl>>2],n[c+4>>2]=n[Tl+4>>2],Yr(s,3843,c)|0,n[_s>>2]=4,n[_s+4>>2]=0,n[c>>2]=n[_s>>2],n[c+4>>2]=n[_s+4>>2],Yr(s,3853,c)|0,n[Uc>>2]=9,n[Uc+4>>2]=0,n[c>>2]=n[Uc>>2],n[c+4>>2]=n[Uc+4>>2],Tn(s,3870,c)|0,n[cf>>2]=10,n[cf+4>>2]=0,n[c>>2]=n[cf>>2],n[c+4>>2]=n[cf+4>>2],Tn(s,3884,c)|0,n[lf>>2]=11,n[lf+4>>2]=0,n[c>>2]=n[lf>>2],n[c+4>>2]=n[lf+4>>2],Tn(s,3896,c)|0,n[Mc>>2]=1,n[Mc+4>>2]=0,n[c>>2]=n[Mc>>2],n[c+4>>2]=n[Mc+4>>2],ti(s,3907,c)|0,n[fo>>2]=2,n[fo+4>>2]=0,n[c>>2]=n[fo>>2],n[c+4>>2]=n[fo+4>>2],ti(s,3915,c)|0,n[Oc>>2]=3,n[Oc+4>>2]=0,n[c>>2]=n[Oc>>2],n[c+4>>2]=n[Oc+4>>2],ti(s,3928,c)|0,n[Ao>>2]=4,n[Ao+4>>2]=0,n[c>>2]=n[Ao>>2],n[c+4>>2]=n[Ao+4>>2],ti(s,3948,c)|0,n[af>>2]=5,n[af+4>>2]=0,n[c>>2]=n[af>>2],n[c+4>>2]=n[af+4>>2],ti(s,3960,c)|0,n[Un>>2]=6,n[Un+4>>2]=0,n[c>>2]=n[Un>>2],n[c+4>>2]=n[Un+4>>2],ti(s,3974,c)|0,n[Rl>>2]=7,n[Rl+4>>2]=0,n[c>>2]=n[Rl>>2],n[c+4>>2]=n[Rl+4>>2],ti(s,3983,c)|0,n[Cs>>2]=20,n[Cs+4>>2]=0,n[c>>2]=n[Cs>>2],n[c+4>>2]=n[Cs+4>>2],xr(s,3999,c)|0,n[Us>>2]=8,n[Us+4>>2]=0,n[c>>2]=n[Us>>2],n[c+4>>2]=n[Us+4>>2],ti(s,4012,c)|0,n[of>>2]=9,n[of+4>>2]=0,n[c>>2]=n[of>>2],n[c+4>>2]=n[of+4>>2],ti(s,4022,c)|0,n[sf>>2]=21,n[sf+4>>2]=0,n[c>>2]=n[sf>>2],n[c+4>>2]=n[sf+4>>2],xr(s,4039,c)|0,n[_u>>2]=10,n[_u+4>>2]=0,n[c>>2]=n[_u>>2],n[c+4>>2]=n[_u+4>>2],ti(s,4053,c)|0,n[nf>>2]=11,n[nf+4>>2]=0,n[c>>2]=n[nf>>2],n[c+4>>2]=n[nf+4>>2],ti(s,4065,c)|0,n[rf>>2]=12,n[rf+4>>2]=0,n[c>>2]=n[rf>>2],n[c+4>>2]=n[rf+4>>2],ti(s,4084,c)|0,n[Fl>>2]=13,n[Fl+4>>2]=0,n[c>>2]=n[Fl>>2],n[c+4>>2]=n[Fl+4>>2],ti(s,4097,c)|0,n[Go>>2]=14,n[Go+4>>2]=0,n[c>>2]=n[Go>>2],n[c+4>>2]=n[Go+4>>2],ti(s,4117,c)|0,n[rl>>2]=15,n[rl+4>>2]=0,n[c>>2]=n[rl>>2],n[c+4>>2]=n[rl+4>>2],ti(s,4129,c)|0,n[Ms>>2]=16,n[Ms+4>>2]=0,n[c>>2]=n[Ms>>2],n[c+4>>2]=n[Ms+4>>2],ti(s,4148,c)|0,n[Nc>>2]=17,n[Nc+4>>2]=0,n[c>>2]=n[Nc>>2],n[c+4>>2]=n[Nc+4>>2],ti(s,4161,c)|0,n[Uu>>2]=18,n[Uu+4>>2]=0,n[c>>2]=n[Uu>>2],n[c+4>>2]=n[Uu+4>>2],ti(s,4181,c)|0,n[Mu>>2]=5,n[Mu+4>>2]=0,n[c>>2]=n[Mu>>2],n[c+4>>2]=n[Mu+4>>2],Yr(s,4196,c)|0,n[jp>>2]=6,n[jp+4>>2]=0,n[c>>2]=n[jp>>2],n[c+4>>2]=n[jp+4>>2],Yr(s,4206,c)|0,n[qp>>2]=7,n[qp+4>>2]=0,n[c>>2]=n[qp>>2],n[c+4>>2]=n[qp+4>>2],Yr(s,4217,c)|0,n[Lc>>2]=3,n[Lc+4>>2]=0,n[c>>2]=n[Lc>>2],n[c+4>>2]=n[Lc+4>>2],Rc(s,4235,c)|0,n[Hp>>2]=1,n[Hp+4>>2]=0,n[c>>2]=n[Hp>>2],n[c+4>>2]=n[Hp+4>>2],aR(s,4251,c)|0,n[Ql>>2]=4,n[Ql+4>>2]=0,n[c>>2]=n[Ql>>2],n[c+4>>2]=n[Ql+4>>2],Rc(s,4263,c)|0,n[$r>>2]=5,n[$r+4>>2]=0,n[c>>2]=n[$r>>2],n[c+4>>2]=n[$r+4>>2],Rc(s,4279,c)|0,n[_p>>2]=6,n[_p+4>>2]=0,n[c>>2]=n[_p>>2],n[c+4>>2]=n[_p+4>>2],Rc(s,4293,c)|0,n[Up>>2]=7,n[Up+4>>2]=0,n[c>>2]=n[Up>>2],n[c+4>>2]=n[Up+4>>2],Rc(s,4306,c)|0,n[Mp>>2]=8,n[Mp+4>>2]=0,n[c>>2]=n[Mp>>2],n[c+4>>2]=n[Mp+4>>2],Rc(s,4323,c)|0,n[Ou>>2]=9,n[Ou+4>>2]=0,n[c>>2]=n[Ou>>2],n[c+4>>2]=n[Ou+4>>2],Rc(s,4335,c)|0,n[Nu>>2]=2,n[Nu+4>>2]=0,n[c>>2]=n[Nu>>2],n[c+4>>2]=n[Nu+4>>2],aR(s,4353,c)|0,n[Op>>2]=12,n[Op+4>>2]=0,n[c>>2]=n[Op>>2],n[c+4>>2]=n[Op+4>>2],Q0(s,4363,c)|0,n[kl>>2]=1,n[kl+4>>2]=0,n[c>>2]=n[kl>>2],n[c+4>>2]=n[kl+4>>2],zA(s,4376,c)|0,n[Np>>2]=2,n[Np+4>>2]=0,n[c>>2]=n[Np>>2],n[c+4>>2]=n[Np+4>>2],zA(s,4388,c)|0,n[Lp>>2]=13,n[Lp+4>>2]=0,n[c>>2]=n[Lp>>2],n[c+4>>2]=n[Lp+4>>2],Q0(s,4402,c)|0,n[Ia>>2]=14,n[Ia+4>>2]=0,n[c>>2]=n[Ia>>2],n[c+4>>2]=n[Ia+4>>2],Q0(s,4411,c)|0,n[uo>>2]=15,n[uo+4>>2]=0,n[c>>2]=n[uo>>2],n[c+4>>2]=n[uo+4>>2],Q0(s,4421,c)|0,n[co>>2]=16,n[co+4>>2]=0,n[c>>2]=n[co>>2],n[c+4>>2]=n[co+4>>2],Q0(s,4433,c)|0,n[lo>>2]=17,n[lo+4>>2]=0,n[c>>2]=n[lo>>2],n[c+4>>2]=n[lo+4>>2],Q0(s,4446,c)|0,n[Ln>>2]=18,n[Ln+4>>2]=0,n[c>>2]=n[Ln>>2],n[c+4>>2]=n[Ln+4>>2],Q0(s,4458,c)|0,n[lr>>2]=3,n[lr+4>>2]=0,n[c>>2]=n[lr>>2],n[c+4>>2]=n[lr+4>>2],zA(s,4471,c)|0,n[Or>>2]=1,n[Or+4>>2]=0,n[c>>2]=n[Or>>2],n[c+4>>2]=n[Or+4>>2],QD(s,4486,c)|0,n[kr>>2]=10,n[kr+4>>2]=0,n[c>>2]=n[kr>>2],n[c+4>>2]=n[kr+4>>2],Rc(s,4496,c)|0,n[Zt>>2]=11,n[Zt+4>>2]=0,n[c>>2]=n[Zt>>2],n[c+4>>2]=n[Zt+4>>2],Rc(s,4508,c)|0,n[ur>>2]=3,n[ur+4>>2]=0,n[c>>2]=n[ur>>2],n[c+4>>2]=n[ur+4>>2],aR(s,4519,c)|0,n[_r>>2]=4,n[_r+4>>2]=0,n[c>>2]=n[_r>>2],n[c+4>>2]=n[_r+4>>2],Lve(s,4530,c)|0,n[Nt>>2]=19,n[Nt+4>>2]=0,n[c>>2]=n[Nt>>2],n[c+4>>2]=n[Nt+4>>2],Nve(s,4542,c)|0,n[Ge>>2]=12,n[Ge+4>>2]=0,n[c>>2]=n[Ge>>2],n[c+4>>2]=n[Ge+4>>2],Ove(s,4554,c)|0,n[_e>>2]=13,n[_e+4>>2]=0,n[c>>2]=n[_e>>2],n[c+4>>2]=n[_e+4>>2],Mve(s,4568,c)|0,n[ct>>2]=2,n[ct+4>>2]=0,n[c>>2]=n[ct>>2],n[c+4>>2]=n[ct+4>>2],Uve(s,4578,c)|0,n[Xe>>2]=20,n[Xe+4>>2]=0,n[c>>2]=n[Xe>>2],n[c+4>>2]=n[Xe+4>>2],_ve(s,4587,c)|0,n[rt>>2]=22,n[rt+4>>2]=0,n[c>>2]=n[rt>>2],n[c+4>>2]=n[rt+4>>2],xr(s,4602,c)|0,n[Qe>>2]=23,n[Qe+4>>2]=0,n[c>>2]=n[Qe>>2],n[c+4>>2]=n[Qe+4>>2],xr(s,4619,c)|0,n[Oe>>2]=14,n[Oe+4>>2]=0,n[c>>2]=n[Oe>>2],n[c+4>>2]=n[Oe+4>>2],Hve(s,4629,c)|0,n[We>>2]=1,n[We+4>>2]=0,n[c>>2]=n[We>>2],n[c+4>>2]=n[We+4>>2],qve(s,4637,c)|0,n[oe>>2]=4,n[oe+4>>2]=0,n[c>>2]=n[oe>>2],n[c+4>>2]=n[oe+4>>2],zA(s,4653,c)|0,n[j>>2]=5,n[j+4>>2]=0,n[c>>2]=n[j>>2],n[c+4>>2]=n[j+4>>2],zA(s,4669,c)|0,n[O>>2]=6,n[O+4>>2]=0,n[c>>2]=n[O>>2],n[c+4>>2]=n[O+4>>2],zA(s,4686,c)|0,n[M>>2]=7,n[M+4>>2]=0,n[c>>2]=n[M>>2],n[c+4>>2]=n[M+4>>2],zA(s,4701,c)|0,n[F>>2]=8,n[F+4>>2]=0,n[c>>2]=n[F>>2],n[c+4>>2]=n[F+4>>2],zA(s,4719,c)|0,n[k>>2]=9,n[k+4>>2]=0,n[c>>2]=n[k>>2],n[c+4>>2]=n[k+4>>2],zA(s,4736,c)|0,n[B>>2]=21,n[B+4>>2]=0,n[c>>2]=n[B>>2],n[c+4>>2]=n[B+4>>2],jve(s,4754,c)|0,n[m>>2]=2,n[m+4>>2]=0,n[c>>2]=n[m>>2],n[c+4>>2]=n[m+4>>2],QD(s,4772,c)|0,n[d>>2]=3,n[d+4>>2]=0,n[c>>2]=n[d>>2],n[c+4>>2]=n[d+4>>2],QD(s,4790,c)|0,n[f>>2]=4,n[f+4>>2]=0,n[c>>2]=n[f>>2],n[c+4>>2]=n[f+4>>2],QD(s,4808,c)|0,C=l}function pt(s,l){s=s|0,l=l|0;var c=0;c=JQe()|0,n[s>>2]=c,zQe(c,l),Fp(n[s>>2]|0)}function zt(s,l,c){return s=s|0,l=l|0,c=c|0,LQe(s,mn(l)|0,c,0),s|0}function Br(s,l,c){return s=s|0,l=l|0,c=c|0,EQe(s,mn(l)|0,c,0),s|0}function Wn(s,l,c){return s=s|0,l=l|0,c=c|0,sQe(s,mn(l)|0,c,0),s|0}function xr(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],jke(s,l,d),C=f,s|0}function Pn(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],vke(s,l,d),C=f,s|0}function Tn(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],lke(s,l,d),C=f,s|0}function Yr(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Ybe(s,l,d),C=f,s|0}function ti(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],kbe(s,l,d),C=f,s|0}function Rc(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],hbe(s,l,d),C=f,s|0}function aR(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Zxe(s,l,d),C=f,s|0}function Q0(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],vxe(s,l,d),C=f,s|0}function zA(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],lxe(s,l,d),C=f,s|0}function QD(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],YPe(s,l,d),C=f,s|0}function Lve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],kPe(s,l,d),C=f,s|0}function Nve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],hPe(s,l,d),C=f,s|0}function Ove(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],$Se(s,l,d),C=f,s|0}function Mve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],MSe(s,l,d),C=f,s|0}function Uve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ISe(s,l,d),C=f,s|0}function _ve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],iSe(s,l,d),C=f,s|0}function Hve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],qDe(s,l,d),C=f,s|0}function qve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],vDe(s,l,d),C=f,s|0}function jve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Gve(s,l,d),C=f,s|0}function Gve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Wve(s,c,d,1),C=f}function mn(s){return s=s|0,s|0}function Wve(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=lR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=Yve(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Vve(m,f)|0,f),C=d}function lR(){var s=0,l=0;if(o[7616]|0||(L5(9136),pr(24,9136,U|0)|0,l=7616,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9136)|0)){s=9136,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));L5(9136)}return 9136}function Yve(s){return s=s|0,0}function Vve(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=lR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],T5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(zve(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function yn(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0;B=C,C=C+32|0,oe=B+24|0,j=B+20|0,F=B+16|0,O=B+12|0,M=B+8|0,k=B+4|0,We=B,n[j>>2]=l,n[F>>2]=c,n[O>>2]=f,n[M>>2]=d,n[k>>2]=m,m=s+28|0,n[We>>2]=n[m>>2],n[oe>>2]=n[We>>2],Kve(s+24|0,oe,j,O,M,F,k)|0,n[m>>2]=n[n[m>>2]>>2],C=B}function Kve(s,l,c,f,d,m,B){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0,s=Jve(l)|0,l=Yt(24)|0,R5(l+4|0,n[c>>2]|0,n[f>>2]|0,n[d>>2]|0,n[m>>2]|0,n[B>>2]|0),n[l>>2]=n[s>>2],n[s>>2]=l,l|0}function Jve(s){return s=s|0,n[s>>2]|0}function R5(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,n[s>>2]=l,n[s+4>>2]=c,n[s+8>>2]=f,n[s+12>>2]=d,n[s+16>>2]=m}function dr(s,l){return s=s|0,l=l|0,l|s|0}function T5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function zve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Xve(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,Zve(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],T5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,$ve(s,k),eDe(k),C=M;return}}function Xve(s){return s=s|0,357913941}function Zve(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function $ve(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function eDe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function L5(s){s=s|0,nDe(s)}function tDe(s){s=s|0,rDe(s+24|0)}function Nr(s){return s=s|0,n[s>>2]|0}function rDe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function nDe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,3,l,iDe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Jr(){return 9228}function iDe(){return 1140}function sDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=oDe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=aDe(l,f)|0,C=c,l|0}function zr(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,n[s>>2]=l,n[s+4>>2]=c,n[s+8>>2]=f,n[s+12>>2]=d,n[s+16>>2]=m}function oDe(s){return s=s|0,(n[(lR()|0)+24>>2]|0)+(s*12|0)|0}function aDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;return d=C,C=C+48|0,f=d,c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),tf[c&31](f,s),f=lDe(f)|0,C=d,f|0}function lDe(s){s=s|0;var l=0,c=0,f=0,d=0;return d=C,C=C+32|0,l=d+12|0,c=d,f=cR(N5()|0)|0,f?(uR(l,f),AR(c,l),cDe(s,c),s=fR(l)|0):s=uDe(s)|0,C=d,s|0}function N5(){var s=0;return o[7632]|0||(CDe(9184),pr(25,9184,U|0)|0,s=7632,n[s>>2]=1,n[s+4>>2]=0),9184}function cR(s){return s=s|0,n[s+36>>2]|0}function uR(s,l){s=s|0,l=l|0,n[s>>2]=l,n[s+4>>2]=s,n[s+8>>2]=0}function AR(s,l){s=s|0,l=l|0,n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=0}function cDe(s,l){s=s|0,l=l|0,hDe(l,s,s+8|0,s+16|0,s+24|0,s+32|0,s+40|0)|0}function fR(s){return s=s|0,n[(n[s+4>>2]|0)+8>>2]|0}function uDe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,F=0;F=C,C=C+16|0,c=F+4|0,f=F,d=Za(8)|0,m=d,B=Yt(48)|0,k=B,l=k+48|0;do n[k>>2]=n[s>>2],k=k+4|0,s=s+4|0;while((k|0)<(l|0));return l=m+4|0,n[l>>2]=B,k=Yt(8)|0,B=n[l>>2]|0,n[f>>2]=0,n[c>>2]=n[f>>2],O5(k,B,c),n[d>>2]=k,C=F,m|0}function O5(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Yt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1092,n[c+12>>2]=l,n[s+4>>2]=c}function ADe(s){s=s|0,im(s),yt(s)}function fDe(s){s=s|0,s=n[s+12>>2]|0,s|0&&yt(s)}function pDe(s){s=s|0,yt(s)}function hDe(s,l,c,f,d,m,B){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0,m=gDe(n[s>>2]|0,l,c,f,d,m,B)|0,B=s+4|0,n[(n[B>>2]|0)+8>>2]=m,n[(n[B>>2]|0)+8>>2]|0}function gDe(s,l,c,f,d,m,B){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0;var k=0,F=0;return k=C,C=C+16|0,F=k,$a(F),s=ys(s)|0,B=dDe(s,+E[l>>3],+E[c>>3],+E[f>>3],+E[d>>3],+E[m>>3],+E[B>>3])|0,el(F),C=k,B|0}function dDe(s,l,c,f,d,m,B){s=s|0,l=+l,c=+c,f=+f,d=+d,m=+m,B=+B;var k=0;return k=jo(mDe()|0)|0,l=+ma(l),c=+ma(c),f=+ma(f),d=+ma(d),m=+ma(m),Ts(0,k|0,s|0,+l,+c,+f,+d,+m,+ +ma(B))|0}function mDe(){var s=0;return o[7624]|0||(yDe(9172),s=7624,n[s>>2]=1,n[s+4>>2]=0),9172}function yDe(s){s=s|0,ao(s,EDe()|0,6)}function EDe(){return 1112}function CDe(s){s=s|0,Pp(s)}function IDe(s){s=s|0,M5(s+24|0),U5(s+16|0)}function M5(s){s=s|0,BDe(s)}function U5(s){s=s|0,wDe(s)}function wDe(s){s=s|0;var l=0,c=0;if(l=n[s>>2]|0,l|0)do c=l,l=n[l>>2]|0,yt(c);while(l|0);n[s>>2]=0}function BDe(s){s=s|0;var l=0,c=0;if(l=n[s>>2]|0,l|0)do c=l,l=n[l>>2]|0,yt(c);while(l|0);n[s>>2]=0}function Pp(s){s=s|0;var l=0;n[s+16>>2]=0,n[s+20>>2]=0,l=s+24|0,n[l>>2]=0,n[s+28>>2]=l,n[s+36>>2]=0,o[s+40>>0]=0,o[s+41>>0]=0}function vDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],DDe(s,c,d,0),C=f}function DDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=pR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=SDe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,PDe(m,f)|0,f),C=d}function pR(){var s=0,l=0;if(o[7640]|0||(H5(9232),pr(26,9232,U|0)|0,l=7640,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9232)|0)){s=9232,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));H5(9232)}return 9232}function SDe(s){return s=s|0,0}function PDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=pR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],_5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(xDe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function _5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function xDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=bDe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,kDe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],_5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,QDe(s,k),FDe(k),C=M;return}}function bDe(s){return s=s|0,357913941}function kDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function QDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function FDe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function H5(s){s=s|0,LDe(s)}function RDe(s){s=s|0,TDe(s+24|0)}function TDe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function LDe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,1,l,NDe()|0,3),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function NDe(){return 1144}function ODe(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0;var m=0,B=0,k=0,F=0;m=C,C=C+16|0,B=m+8|0,k=m,F=MDe(s)|0,s=n[F+4>>2]|0,n[k>>2]=n[F>>2],n[k+4>>2]=s,n[B>>2]=n[k>>2],n[B+4>>2]=n[k+4>>2],UDe(l,B,c,f,d),C=m}function MDe(s){return s=s|0,(n[(pR()|0)+24>>2]|0)+(s*12|0)|0}function UDe(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0;var m=0,B=0,k=0,F=0,M=0;M=C,C=C+16|0,B=M+2|0,k=M+1|0,F=M,m=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(m=n[(n[s>>2]|0)+m>>2]|0),Tu(B,c),c=+Lu(B,c),Tu(k,f),f=+Lu(k,f),XA(F,d),F=ZA(F,d)|0,rW[m&1](s,c,f,F),C=M}function Tu(s,l){s=s|0,l=+l}function Lu(s,l){return s=s|0,l=+l,+ +HDe(l)}function XA(s,l){s=s|0,l=l|0}function ZA(s,l){return s=s|0,l=l|0,_De(l)|0}function _De(s){return s=s|0,s|0}function HDe(s){return s=+s,+s}function qDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],jDe(s,c,d,1),C=f}function jDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=hR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=GDe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,WDe(m,f)|0,f),C=d}function hR(){var s=0,l=0;if(o[7648]|0||(j5(9268),pr(27,9268,U|0)|0,l=7648,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9268)|0)){s=9268,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));j5(9268)}return 9268}function GDe(s){return s=s|0,0}function WDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=hR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],q5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(YDe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function q5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function YDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=VDe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,KDe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],q5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,JDe(s,k),zDe(k),C=M;return}}function VDe(s){return s=s|0,357913941}function KDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function JDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function zDe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function j5(s){s=s|0,$De(s)}function XDe(s){s=s|0,ZDe(s+24|0)}function ZDe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function $De(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,4,l,eSe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function eSe(){return 1160}function tSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=rSe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=nSe(l,f)|0,C=c,l|0}function rSe(s){return s=s|0,(n[(hR()|0)+24>>2]|0)+(s*12|0)|0}function nSe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),G5(_0[c&31](s)|0)|0}function G5(s){return s=s|0,s&1|0}function iSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],sSe(s,c,d,0),C=f}function sSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=gR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=oSe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,aSe(m,f)|0,f),C=d}function gR(){var s=0,l=0;if(o[7656]|0||(Y5(9304),pr(28,9304,U|0)|0,l=7656,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9304)|0)){s=9304,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));Y5(9304)}return 9304}function oSe(s){return s=s|0,0}function aSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=gR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],W5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(lSe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function W5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function lSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=cSe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,uSe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],W5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,ASe(s,k),fSe(k),C=M;return}}function cSe(s){return s=s|0,357913941}function uSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function ASe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function fSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function Y5(s){s=s|0,gSe(s)}function pSe(s){s=s|0,hSe(s+24|0)}function hSe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function gSe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,5,l,dSe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function dSe(){return 1164}function mSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=ySe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ESe(l,d,c),C=f}function ySe(s){return s=s|0,(n[(gR()|0)+24>>2]|0)+(s*12|0)|0}function ESe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),xp(d,c),c=bp(d,c)|0,tf[f&31](s,c),kp(d),C=m}function xp(s,l){s=s|0,l=l|0,CSe(s,l)}function bp(s,l){return s=s|0,l=l|0,s|0}function kp(s){s=s|0,xu(s)}function CSe(s,l){s=s|0,l=l|0,dR(s,l)}function dR(s,l){s=s|0,l=l|0,n[s>>2]=l}function ISe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],wSe(s,c,d,0),C=f}function wSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=mR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=BSe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,vSe(m,f)|0,f),C=d}function mR(){var s=0,l=0;if(o[7664]|0||(K5(9340),pr(29,9340,U|0)|0,l=7664,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9340)|0)){s=9340,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));K5(9340)}return 9340}function BSe(s){return s=s|0,0}function vSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=mR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],V5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(DSe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function V5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function DSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=SSe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,PSe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],V5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,xSe(s,k),bSe(k),C=M;return}}function SSe(s){return s=s|0,357913941}function PSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function xSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function bSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function K5(s){s=s|0,FSe(s)}function kSe(s){s=s|0,QSe(s+24|0)}function QSe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function FSe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,4,l,RSe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function RSe(){return 1180}function TSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=LSe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=NSe(l,d,c)|0,C=f,c|0}function LSe(s){return s=s|0,(n[(mR()|0)+24>>2]|0)+(s*12|0)|0}function NSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;return m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),F0(d,c),d=R0(d,c)|0,d=FD(pT[f&15](s,d)|0)|0,C=m,d|0}function F0(s,l){s=s|0,l=l|0}function R0(s,l){return s=s|0,l=l|0,OSe(l)|0}function FD(s){return s=s|0,s|0}function OSe(s){return s=s|0,s|0}function MSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],USe(s,c,d,0),C=f}function USe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=yR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=_Se(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,HSe(m,f)|0,f),C=d}function yR(){var s=0,l=0;if(o[7672]|0||(z5(9376),pr(30,9376,U|0)|0,l=7672,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9376)|0)){s=9376,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));z5(9376)}return 9376}function _Se(s){return s=s|0,0}function HSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=yR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],J5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(qSe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function J5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function qSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=jSe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,GSe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],J5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,WSe(s,k),YSe(k),C=M;return}}function jSe(s){return s=s|0,357913941}function GSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function WSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function YSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function z5(s){s=s|0,JSe(s)}function VSe(s){s=s|0,KSe(s+24|0)}function KSe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function JSe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,5,l,X5()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function X5(){return 1196}function zSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=XSe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=ZSe(l,f)|0,C=c,l|0}function XSe(s){return s=s|0,(n[(yR()|0)+24>>2]|0)+(s*12|0)|0}function ZSe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),FD(_0[c&31](s)|0)|0}function $Se(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ePe(s,c,d,1),C=f}function ePe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=ER()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=tPe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,rPe(m,f)|0,f),C=d}function ER(){var s=0,l=0;if(o[7680]|0||($5(9412),pr(31,9412,U|0)|0,l=7680,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9412)|0)){s=9412,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));$5(9412)}return 9412}function tPe(s){return s=s|0,0}function rPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=ER()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],Z5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(nPe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function Z5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function nPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=iPe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,sPe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],Z5(m,f,c),n[F>>2]=(n[F>>2]|0)+12,oPe(s,k),aPe(k),C=M;return}}function iPe(s){return s=s|0,357913941}function sPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function oPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function aPe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function $5(s){s=s|0,uPe(s)}function lPe(s){s=s|0,cPe(s+24|0)}function cPe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function uPe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,6,l,e9()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function e9(){return 1200}function APe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=fPe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=pPe(l,f)|0,C=c,l|0}function fPe(s){return s=s|0,(n[(ER()|0)+24>>2]|0)+(s*12|0)|0}function pPe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),RD(_0[c&31](s)|0)|0}function RD(s){return s=s|0,s|0}function hPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],gPe(s,c,d,0),C=f}function gPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=CR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=dPe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,mPe(m,f)|0,f),C=d}function CR(){var s=0,l=0;if(o[7688]|0||(r9(9448),pr(32,9448,U|0)|0,l=7688,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9448)|0)){s=9448,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));r9(9448)}return 9448}function dPe(s){return s=s|0,0}function mPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=CR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],t9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(yPe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function t9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function yPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=EPe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,CPe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],t9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,IPe(s,k),wPe(k),C=M;return}}function EPe(s){return s=s|0,357913941}function CPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function IPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function wPe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function r9(s){s=s|0,DPe(s)}function BPe(s){s=s|0,vPe(s+24|0)}function vPe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function DPe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,6,l,n9()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function n9(){return 1204}function SPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=PPe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],xPe(l,d,c),C=f}function PPe(s){return s=s|0,(n[(CR()|0)+24>>2]|0)+(s*12|0)|0}function xPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),IR(d,c),d=wR(d,c)|0,tf[f&31](s,d),C=m}function IR(s,l){s=s|0,l=l|0}function wR(s,l){return s=s|0,l=l|0,bPe(l)|0}function bPe(s){return s=s|0,s|0}function kPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],QPe(s,c,d,0),C=f}function QPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=BR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=FPe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,RPe(m,f)|0,f),C=d}function BR(){var s=0,l=0;if(o[7696]|0||(s9(9484),pr(33,9484,U|0)|0,l=7696,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9484)|0)){s=9484,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));s9(9484)}return 9484}function FPe(s){return s=s|0,0}function RPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=BR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],i9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(TPe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function i9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function TPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=LPe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,NPe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],i9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,OPe(s,k),MPe(k),C=M;return}}function LPe(s){return s=s|0,357913941}function NPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function OPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function MPe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function s9(s){s=s|0,HPe(s)}function UPe(s){s=s|0,_Pe(s+24|0)}function _Pe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function HPe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,1,l,qPe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function qPe(){return 1212}function jPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+8|0,B=d,k=GPe(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],WPe(l,m,c,f),C=d}function GPe(s){return s=s|0,(n[(BR()|0)+24>>2]|0)+(s*12|0)|0}function WPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;k=C,C=C+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(d=n[(n[s>>2]|0)+d>>2]|0),IR(m,c),m=wR(m,c)|0,F0(B,f),B=R0(B,f)|0,sw[d&15](s,m,B),C=k}function YPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],VPe(s,c,d,1),C=f}function VPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=vR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=KPe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,JPe(m,f)|0,f),C=d}function vR(){var s=0,l=0;if(o[7704]|0||(a9(9520),pr(34,9520,U|0)|0,l=7704,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9520)|0)){s=9520,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));a9(9520)}return 9520}function KPe(s){return s=s|0,0}function JPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=vR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],o9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(zPe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function o9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function zPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=XPe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,ZPe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],o9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,$Pe(s,k),exe(k),C=M;return}}function XPe(s){return s=s|0,357913941}function ZPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function $Pe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function exe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function a9(s){s=s|0,nxe(s)}function txe(s){s=s|0,rxe(s+24|0)}function rxe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function nxe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,1,l,ixe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function ixe(){return 1224}function sxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;return d=C,C=C+16|0,m=d+8|0,B=d,k=oxe(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],f=+axe(l,m,c),C=d,+f}function oxe(s){return s=s|0,(n[(vR()|0)+24>>2]|0)+(s*12|0)|0}function axe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(d,c),d=ZA(d,c)|0,B=+Ru(+iW[f&7](s,d)),C=m,+B}function lxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],cxe(s,c,d,1),C=f}function cxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=DR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=uxe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Axe(m,f)|0,f),C=d}function DR(){var s=0,l=0;if(o[7712]|0||(c9(9556),pr(35,9556,U|0)|0,l=7712,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9556)|0)){s=9556,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));c9(9556)}return 9556}function uxe(s){return s=s|0,0}function Axe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=DR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],l9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(fxe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function l9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function fxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=pxe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,hxe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],l9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,gxe(s,k),dxe(k),C=M;return}}function pxe(s){return s=s|0,357913941}function hxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function gxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function dxe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function c9(s){s=s|0,Exe(s)}function mxe(s){s=s|0,yxe(s+24|0)}function yxe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function Exe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,5,l,Cxe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Cxe(){return 1232}function Ixe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=wxe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=+Bxe(l,d),C=f,+c}function wxe(s){return s=s|0,(n[(DR()|0)+24>>2]|0)+(s*12|0)|0}function Bxe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),+ +Ru(+nW[c&15](s))}function vxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Dxe(s,c,d,1),C=f}function Dxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=SR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=Sxe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Pxe(m,f)|0,f),C=d}function SR(){var s=0,l=0;if(o[7720]|0||(A9(9592),pr(36,9592,U|0)|0,l=7720,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9592)|0)){s=9592,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));A9(9592)}return 9592}function Sxe(s){return s=s|0,0}function Pxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=SR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],u9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(xxe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function u9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function xxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=bxe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,kxe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],u9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,Qxe(s,k),Fxe(k),C=M;return}}function bxe(s){return s=s|0,357913941}function kxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Qxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Fxe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function A9(s){s=s|0,Lxe(s)}function Rxe(s){s=s|0,Txe(s+24|0)}function Txe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function Lxe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,7,l,Nxe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Nxe(){return 1276}function Oxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=Mxe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=Uxe(l,f)|0,C=c,l|0}function Mxe(s){return s=s|0,(n[(SR()|0)+24>>2]|0)+(s*12|0)|0}function Uxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;return d=C,C=C+16|0,f=d,c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),tf[c&31](f,s),f=f9(f)|0,C=d,f|0}function f9(s){s=s|0;var l=0,c=0,f=0,d=0;return d=C,C=C+32|0,l=d+12|0,c=d,f=cR(p9()|0)|0,f?(uR(l,f),AR(c,l),_xe(s,c),s=fR(l)|0):s=Hxe(s)|0,C=d,s|0}function p9(){var s=0;return o[7736]|0||(Xxe(9640),pr(25,9640,U|0)|0,s=7736,n[s>>2]=1,n[s+4>>2]=0),9640}function _xe(s,l){s=s|0,l=l|0,Wxe(l,s,s+8|0)|0}function Hxe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;return c=C,C=C+16|0,d=c+4|0,B=c,f=Za(8)|0,l=f,k=Yt(16)|0,n[k>>2]=n[s>>2],n[k+4>>2]=n[s+4>>2],n[k+8>>2]=n[s+8>>2],n[k+12>>2]=n[s+12>>2],m=l+4|0,n[m>>2]=k,s=Yt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],PR(s,m,d),n[f>>2]=s,C=c,l|0}function PR(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Yt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1244,n[c+12>>2]=l,n[s+4>>2]=c}function qxe(s){s=s|0,im(s),yt(s)}function jxe(s){s=s|0,s=n[s+12>>2]|0,s|0&&yt(s)}function Gxe(s){s=s|0,yt(s)}function Wxe(s,l,c){return s=s|0,l=l|0,c=c|0,l=Yxe(n[s>>2]|0,l,c)|0,c=s+4|0,n[(n[c>>2]|0)+8>>2]=l,n[(n[c>>2]|0)+8>>2]|0}function Yxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;return f=C,C=C+16|0,d=f,$a(d),s=ys(s)|0,c=Vxe(s,n[l>>2]|0,+E[c>>3])|0,el(d),C=f,c|0}function Vxe(s,l,c){s=s|0,l=l|0,c=+c;var f=0;return f=jo(Kxe()|0)|0,l=Xd(l)|0,pc(0,f|0,s|0,l|0,+ +ma(c))|0}function Kxe(){var s=0;return o[7728]|0||(Jxe(9628),s=7728,n[s>>2]=1,n[s+4>>2]=0),9628}function Jxe(s){s=s|0,ao(s,zxe()|0,2)}function zxe(){return 1264}function Xxe(s){s=s|0,Pp(s)}function Zxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],$xe(s,c,d,1),C=f}function $xe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=xR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=ebe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,tbe(m,f)|0,f),C=d}function xR(){var s=0,l=0;if(o[7744]|0||(g9(9684),pr(37,9684,U|0)|0,l=7744,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9684)|0)){s=9684,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));g9(9684)}return 9684}function ebe(s){return s=s|0,0}function tbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=xR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],h9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(rbe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function h9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function rbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=nbe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,ibe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],h9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,sbe(s,k),obe(k),C=M;return}}function nbe(s){return s=s|0,357913941}function ibe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function sbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function obe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function g9(s){s=s|0,cbe(s)}function abe(s){s=s|0,lbe(s+24|0)}function lbe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function cbe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,5,l,ube()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function ube(){return 1280}function Abe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=fbe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=pbe(l,d,c)|0,C=f,c|0}function fbe(s){return s=s|0,(n[(xR()|0)+24>>2]|0)+(s*12|0)|0}function pbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return B=C,C=C+32|0,d=B,m=B+16|0,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(m,c),m=ZA(m,c)|0,sw[f&15](d,s,m),m=f9(d)|0,C=B,m|0}function hbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],gbe(s,c,d,1),C=f}function gbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=bR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=dbe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,mbe(m,f)|0,f),C=d}function bR(){var s=0,l=0;if(o[7752]|0||(m9(9720),pr(38,9720,U|0)|0,l=7752,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9720)|0)){s=9720,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));m9(9720)}return 9720}function dbe(s){return s=s|0,0}function mbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=bR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],d9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(ybe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function d9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function ybe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Ebe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,Cbe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],d9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,Ibe(s,k),wbe(k),C=M;return}}function Ebe(s){return s=s|0,357913941}function Cbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Ibe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function wbe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function m9(s){s=s|0,Dbe(s)}function Bbe(s){s=s|0,vbe(s+24|0)}function vbe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function Dbe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,8,l,Sbe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Sbe(){return 1288}function Pbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=xbe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=bbe(l,f)|0,C=c,l|0}function xbe(s){return s=s|0,(n[(bR()|0)+24>>2]|0)+(s*12|0)|0}function bbe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),k0(_0[c&31](s)|0)|0}function kbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Qbe(s,c,d,0),C=f}function Qbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=kR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=Fbe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Rbe(m,f)|0,f),C=d}function kR(){var s=0,l=0;if(o[7760]|0||(E9(9756),pr(39,9756,U|0)|0,l=7760,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9756)|0)){s=9756,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));E9(9756)}return 9756}function Fbe(s){return s=s|0,0}function Rbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=kR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],y9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(Tbe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function y9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function Tbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Lbe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,Nbe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],y9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,Obe(s,k),Mbe(k),C=M;return}}function Lbe(s){return s=s|0,357913941}function Nbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Obe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Mbe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function E9(s){s=s|0,Hbe(s)}function Ube(s){s=s|0,_be(s+24|0)}function _be(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function Hbe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,8,l,qbe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function qbe(){return 1292}function jbe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=Gbe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Wbe(l,d,c),C=f}function Gbe(s){return s=s|0,(n[(kR()|0)+24>>2]|0)+(s*12|0)|0}function Wbe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),Tu(d,c),c=+Lu(d,c),eW[f&31](s,c),C=m}function Ybe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Vbe(s,c,d,0),C=f}function Vbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=QR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=Kbe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Jbe(m,f)|0,f),C=d}function QR(){var s=0,l=0;if(o[7768]|0||(I9(9792),pr(40,9792,U|0)|0,l=7768,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9792)|0)){s=9792,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));I9(9792)}return 9792}function Kbe(s){return s=s|0,0}function Jbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=QR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],C9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(zbe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function C9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function zbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Xbe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,Zbe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],C9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,$be(s,k),eke(k),C=M;return}}function Xbe(s){return s=s|0,357913941}function Zbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function $be(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function eke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function I9(s){s=s|0,nke(s)}function tke(s){s=s|0,rke(s+24|0)}function rke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function nke(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,1,l,ike()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function ike(){return 1300}function ske(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+8|0,B=d,k=oke(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],ake(l,m,c,f),C=d}function oke(s){return s=s|0,(n[(QR()|0)+24>>2]|0)+(s*12|0)|0}function ake(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f;var d=0,m=0,B=0,k=0;k=C,C=C+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(d=n[(n[s>>2]|0)+d>>2]|0),XA(m,c),m=ZA(m,c)|0,Tu(B,f),f=+Lu(B,f),lW[d&15](s,m,f),C=k}function lke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],cke(s,c,d,0),C=f}function cke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=FR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=uke(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Ake(m,f)|0,f),C=d}function FR(){var s=0,l=0;if(o[7776]|0||(B9(9828),pr(41,9828,U|0)|0,l=7776,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9828)|0)){s=9828,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));B9(9828)}return 9828}function uke(s){return s=s|0,0}function Ake(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=FR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],w9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(fke(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function w9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function fke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=pke(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,hke(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],w9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,gke(s,k),dke(k),C=M;return}}function pke(s){return s=s|0,357913941}function hke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function gke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function dke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function B9(s){s=s|0,Eke(s)}function mke(s){s=s|0,yke(s+24|0)}function yke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function Eke(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,7,l,Cke()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Cke(){return 1312}function Ike(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=wke(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Bke(l,d,c),C=f}function wke(s){return s=s|0,(n[(FR()|0)+24>>2]|0)+(s*12|0)|0}function Bke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(d,c),d=ZA(d,c)|0,tf[f&31](s,d),C=m}function vke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Dke(s,c,d,0),C=f}function Dke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=RR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=Ske(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Pke(m,f)|0,f),C=d}function RR(){var s=0,l=0;if(o[7784]|0||(D9(9864),pr(42,9864,U|0)|0,l=7784,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9864)|0)){s=9864,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));D9(9864)}return 9864}function Ske(s){return s=s|0,0}function Pke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=RR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],v9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(xke(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function v9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function xke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=bke(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,kke(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],v9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,Qke(s,k),Fke(k),C=M;return}}function bke(s){return s=s|0,357913941}function kke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Qke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Fke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function D9(s){s=s|0,Lke(s)}function Rke(s){s=s|0,Tke(s+24|0)}function Tke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function Lke(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,8,l,Nke()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Nke(){return 1320}function Oke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=Mke(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Uke(l,d,c),C=f}function Mke(s){return s=s|0,(n[(RR()|0)+24>>2]|0)+(s*12|0)|0}function Uke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),_ke(d,c),d=Hke(d,c)|0,tf[f&31](s,d),C=m}function _ke(s,l){s=s|0,l=l|0}function Hke(s,l){return s=s|0,l=l|0,qke(l)|0}function qke(s){return s=s|0,s|0}function jke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Gke(s,c,d,0),C=f}function Gke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=TR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=Wke(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,Yke(m,f)|0,f),C=d}function TR(){var s=0,l=0;if(o[7792]|0||(P9(9900),pr(43,9900,U|0)|0,l=7792,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9900)|0)){s=9900,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));P9(9900)}return 9900}function Wke(s){return s=s|0,0}function Yke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=TR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],S9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(Vke(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function S9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function Vke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Kke(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,Jke(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],S9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,zke(s,k),Xke(k),C=M;return}}function Kke(s){return s=s|0,357913941}function Jke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function zke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Xke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function P9(s){s=s|0,eQe(s)}function Zke(s){s=s|0,$ke(s+24|0)}function $ke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function eQe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,22,l,tQe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function tQe(){return 1344}function rQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;c=C,C=C+16|0,f=c+8|0,d=c,m=nQe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],iQe(l,f),C=c}function nQe(s){return s=s|0,(n[(TR()|0)+24>>2]|0)+(s*12|0)|0}function iQe(s,l){s=s|0,l=l|0;var c=0;c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),ef[c&127](s)}function sQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=LR()|0,s=oQe(c)|0,yn(m,l,d,s,aQe(c,f)|0,f)}function LR(){var s=0,l=0;if(o[7800]|0||(b9(9936),pr(44,9936,U|0)|0,l=7800,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9936)|0)){s=9936,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));b9(9936)}return 9936}function oQe(s){return s=s|0,s|0}function aQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=LR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(x9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(lQe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function x9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function lQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=cQe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,uQe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,x9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,AQe(s,d),fQe(d),C=k;return}}function cQe(s){return s=s|0,536870911}function uQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function AQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function fQe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function b9(s){s=s|0,gQe(s)}function pQe(s){s=s|0,hQe(s+24|0)}function hQe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function gQe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,23,l,n9()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function dQe(s,l){s=s|0,l=l|0,yQe(n[(mQe(s)|0)>>2]|0,l)}function mQe(s){return s=s|0,(n[(LR()|0)+24>>2]|0)+(s<<3)|0}function yQe(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,IR(f,l),l=wR(f,l)|0,ef[s&127](l),C=c}function EQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=NR()|0,s=CQe(c)|0,yn(m,l,d,s,IQe(c,f)|0,f)}function NR(){var s=0,l=0;if(o[7808]|0||(Q9(9972),pr(45,9972,U|0)|0,l=7808,n[l>>2]=1,n[l+4>>2]=0),!(Nr(9972)|0)){s=9972,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));Q9(9972)}return 9972}function CQe(s){return s=s|0,s|0}function IQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=NR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(k9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(wQe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function k9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function wQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=BQe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,vQe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,k9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,DQe(s,d),SQe(d),C=k;return}}function BQe(s){return s=s|0,536870911}function vQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function DQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function SQe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function Q9(s){s=s|0,bQe(s)}function PQe(s){s=s|0,xQe(s+24|0)}function xQe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function bQe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,9,l,kQe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function kQe(){return 1348}function QQe(s,l){return s=s|0,l=l|0,RQe(n[(FQe(s)|0)>>2]|0,l)|0}function FQe(s){return s=s|0,(n[(NR()|0)+24>>2]|0)+(s<<3)|0}function RQe(s,l){s=s|0,l=l|0;var c=0,f=0;return c=C,C=C+16|0,f=c,F9(f,l),l=R9(f,l)|0,l=FD(_0[s&31](l)|0)|0,C=c,l|0}function F9(s,l){s=s|0,l=l|0}function R9(s,l){return s=s|0,l=l|0,TQe(l)|0}function TQe(s){return s=s|0,s|0}function LQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=OR()|0,s=NQe(c)|0,yn(m,l,d,s,OQe(c,f)|0,f)}function OR(){var s=0,l=0;if(o[7816]|0||(L9(10008),pr(46,10008,U|0)|0,l=7816,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10008)|0)){s=10008,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));L9(10008)}return 10008}function NQe(s){return s=s|0,s|0}function OQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=OR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(T9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(MQe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function T9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function MQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=UQe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,_Qe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,T9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,HQe(s,d),qQe(d),C=k;return}}function UQe(s){return s=s|0,536870911}function _Qe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function HQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function qQe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function L9(s){s=s|0,WQe(s)}function jQe(s){s=s|0,GQe(s+24|0)}function GQe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function WQe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,15,l,X5()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function YQe(s){return s=s|0,KQe(n[(VQe(s)|0)>>2]|0)|0}function VQe(s){return s=s|0,(n[(OR()|0)+24>>2]|0)+(s<<3)|0}function KQe(s){return s=s|0,FD(VD[s&7]()|0)|0}function JQe(){var s=0;return o[7832]|0||(nFe(10052),pr(25,10052,U|0)|0,s=7832,n[s>>2]=1,n[s+4>>2]=0),10052}function zQe(s,l){s=s|0,l=l|0,n[s>>2]=XQe()|0,n[s+4>>2]=ZQe()|0,n[s+12>>2]=l,n[s+8>>2]=$Qe()|0,n[s+32>>2]=2}function XQe(){return 11709}function ZQe(){return 1188}function $Qe(){return TD()|0}function eFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(tFe(c),yt(c)):l|0&&(Hd(l),yt(l))}function Qp(s,l){return s=s|0,l=l|0,l&s|0}function tFe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function TD(){var s=0;return o[7824]|0||(n[2511]=rFe()|0,n[2512]=0,s=7824,n[s>>2]=1,n[s+4>>2]=0),10044}function rFe(){return 0}function nFe(s){s=s|0,Pp(s)}function iFe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0;l=C,C=C+32|0,c=l+24|0,m=l+16|0,d=l+8|0,f=l,sFe(s,4827),oFe(s,4834,3)|0,aFe(s,3682,47)|0,n[m>>2]=9,n[m+4>>2]=0,n[c>>2]=n[m>>2],n[c+4>>2]=n[m+4>>2],lFe(s,4841,c)|0,n[d>>2]=1,n[d+4>>2]=0,n[c>>2]=n[d>>2],n[c+4>>2]=n[d+4>>2],cFe(s,4871,c)|0,n[f>>2]=10,n[f+4>>2]=0,n[c>>2]=n[f>>2],n[c+4>>2]=n[f+4>>2],uFe(s,4891,c)|0,C=l}function sFe(s,l){s=s|0,l=l|0;var c=0;c=qRe()|0,n[s>>2]=c,jRe(c,l),Fp(n[s>>2]|0)}function oFe(s,l,c){return s=s|0,l=l|0,c=c|0,SRe(s,mn(l)|0,c,0),s|0}function aFe(s,l,c){return s=s|0,l=l|0,c=c|0,ARe(s,mn(l)|0,c,0),s|0}function lFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],YFe(s,l,d),C=f,s|0}function cFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],PFe(s,l,d),C=f,s|0}function uFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],AFe(s,l,d),C=f,s|0}function AFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],fFe(s,c,d,1),C=f}function fFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=MR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=pFe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,hFe(m,f)|0,f),C=d}function MR(){var s=0,l=0;if(o[7840]|0||(O9(10100),pr(48,10100,U|0)|0,l=7840,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10100)|0)){s=10100,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));O9(10100)}return 10100}function pFe(s){return s=s|0,0}function hFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=MR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],N9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(gFe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function N9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function gFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=dFe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,mFe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],N9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,yFe(s,k),EFe(k),C=M;return}}function dFe(s){return s=s|0,357913941}function mFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function yFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function EFe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function O9(s){s=s|0,wFe(s)}function CFe(s){s=s|0,IFe(s+24|0)}function IFe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function wFe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,6,l,BFe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function BFe(){return 1364}function vFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=DFe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=SFe(l,d,c)|0,C=f,c|0}function DFe(s){return s=s|0,(n[(MR()|0)+24>>2]|0)+(s*12|0)|0}function SFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;return m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(d,c),d=ZA(d,c)|0,d=G5(pT[f&15](s,d)|0)|0,C=m,d|0}function PFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],xFe(s,c,d,0),C=f}function xFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=UR()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=bFe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,kFe(m,f)|0,f),C=d}function UR(){var s=0,l=0;if(o[7848]|0||(U9(10136),pr(49,10136,U|0)|0,l=7848,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10136)|0)){s=10136,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));U9(10136)}return 10136}function bFe(s){return s=s|0,0}function kFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=UR()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],M9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(QFe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function M9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function QFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=FFe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,RFe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],M9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,TFe(s,k),LFe(k),C=M;return}}function FFe(s){return s=s|0,357913941}function RFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function TFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function LFe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function U9(s){s=s|0,MFe(s)}function NFe(s){s=s|0,OFe(s+24|0)}function OFe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function MFe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,9,l,UFe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function UFe(){return 1372}function _Fe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=HFe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],qFe(l,d,c),C=f}function HFe(s){return s=s|0,(n[(UR()|0)+24>>2]|0)+(s*12|0)|0}function qFe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=Ze;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),jFe(d,c),B=y(GFe(d,c)),$7[f&1](s,B),C=m}function jFe(s,l){s=s|0,l=+l}function GFe(s,l){return s=s|0,l=+l,y(WFe(l))}function WFe(s){return s=+s,y(s)}function YFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=mn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],VFe(s,c,d,0),C=f}function VFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,F=0,M=0,O=0;d=C,C=C+32|0,m=d+16|0,O=d+8|0,k=d,M=n[c>>2]|0,F=n[c+4>>2]|0,B=n[s>>2]|0,s=_R()|0,n[O>>2]=M,n[O+4>>2]=F,n[m>>2]=n[O>>2],n[m+4>>2]=n[O+4>>2],c=KFe(m)|0,n[k>>2]=M,n[k+4>>2]=F,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],yn(B,l,s,c,JFe(m,f)|0,f),C=d}function _R(){var s=0,l=0;if(o[7856]|0||(H9(10172),pr(50,10172,U|0)|0,l=7856,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10172)|0)){s=10172,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));H9(10172)}return 10172}function KFe(s){return s=s|0,0}function JFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0;return O=C,C=C+32|0,d=O+24|0,B=O+16|0,k=O,F=O+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,j=_R()|0,M=j+24|0,s=dr(l,4)|0,n[F>>2]=s,l=j+28|0,c=n[l>>2]|0,c>>>0<(n[j+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],_9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(zFe(M,k,F),s=n[l>>2]|0),C=O,((s-(n[M>>2]|0)|0)/12|0)+-1|0}function _9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function zFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;if(M=C,C=C+48|0,f=M+32|0,B=M+24|0,k=M,F=s+4|0,d=(((n[F>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=XFe(s)|0,m>>>0>>0)Zr(s);else{O=n[s>>2]|0,oe=((n[s+8>>2]|0)-O|0)/12|0,j=oe<<1,ZFe(k,oe>>>0>>1>>>0?j>>>0>>0?d:j:m,((n[F>>2]|0)-O|0)/12|0,s+8|0),F=k+8|0,m=n[F>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],_9(m,f,c),n[F>>2]=(n[F>>2]|0)+12,$Fe(s,k),eRe(k),C=M;return}}function XFe(s){return s=s|0,357913941}function ZFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Yt(l*12|0)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function $Fe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function eRe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&&yt(s)}function H9(s){s=s|0,nRe(s)}function tRe(s){s=s|0,rRe(s+24|0)}function rRe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),yt(c))}function nRe(s){s=s|0;var l=0;l=Jr()|0,zr(s,2,3,l,iRe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function iRe(){return 1380}function sRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+8|0,B=d,k=oRe(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],aRe(l,m,c,f),C=d}function oRe(s){return s=s|0,(n[(_R()|0)+24>>2]|0)+(s*12|0)|0}function aRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;k=C,C=C+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(d=n[(n[s>>2]|0)+d>>2]|0),XA(m,c),m=ZA(m,c)|0,lRe(B,f),B=cRe(B,f)|0,sw[d&15](s,m,B),C=k}function lRe(s,l){s=s|0,l=l|0}function cRe(s,l){return s=s|0,l=l|0,uRe(l)|0}function uRe(s){return s=s|0,(s|0)!=0|0}function ARe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=HR()|0,s=fRe(c)|0,yn(m,l,d,s,pRe(c,f)|0,f)}function HR(){var s=0,l=0;if(o[7864]|0||(j9(10208),pr(51,10208,U|0)|0,l=7864,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10208)|0)){s=10208,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));j9(10208)}return 10208}function fRe(s){return s=s|0,s|0}function pRe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=HR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(q9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(hRe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function q9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function hRe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=gRe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,dRe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,q9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,mRe(s,d),yRe(d),C=k;return}}function gRe(s){return s=s|0,536870911}function dRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function mRe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function yRe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function j9(s){s=s|0,IRe(s)}function ERe(s){s=s|0,CRe(s+24|0)}function CRe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function IRe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,24,l,wRe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function wRe(){return 1392}function BRe(s,l){s=s|0,l=l|0,DRe(n[(vRe(s)|0)>>2]|0,l)}function vRe(s){return s=s|0,(n[(HR()|0)+24>>2]|0)+(s<<3)|0}function DRe(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,F9(f,l),l=R9(f,l)|0,ef[s&127](l),C=c}function SRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=qR()|0,s=PRe(c)|0,yn(m,l,d,s,xRe(c,f)|0,f)}function qR(){var s=0,l=0;if(o[7872]|0||(W9(10244),pr(52,10244,U|0)|0,l=7872,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10244)|0)){s=10244,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));W9(10244)}return 10244}function PRe(s){return s=s|0,s|0}function xRe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=qR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(G9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(bRe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function G9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function bRe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=kRe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,QRe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,G9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,FRe(s,d),RRe(d),C=k;return}}function kRe(s){return s=s|0,536870911}function QRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function FRe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function RRe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function W9(s){s=s|0,NRe(s)}function TRe(s){s=s|0,LRe(s+24|0)}function LRe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function NRe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,16,l,ORe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function ORe(){return 1400}function MRe(s){return s=s|0,_Re(n[(URe(s)|0)>>2]|0)|0}function URe(s){return s=s|0,(n[(qR()|0)+24>>2]|0)+(s<<3)|0}function _Re(s){return s=s|0,HRe(VD[s&7]()|0)|0}function HRe(s){return s=s|0,s|0}function qRe(){var s=0;return o[7880]|0||(JRe(10280),pr(25,10280,U|0)|0,s=7880,n[s>>2]=1,n[s+4>>2]=0),10280}function jRe(s,l){s=s|0,l=l|0,n[s>>2]=GRe()|0,n[s+4>>2]=WRe()|0,n[s+12>>2]=l,n[s+8>>2]=YRe()|0,n[s+32>>2]=4}function GRe(){return 11711}function WRe(){return 1356}function YRe(){return TD()|0}function VRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(KRe(c),yt(c)):l|0&&(C0(l),yt(l))}function KRe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function JRe(s){s=s|0,Pp(s)}function zRe(s){s=s|0,XRe(s,4920),ZRe(s)|0,$Re(s)|0}function XRe(s,l){s=s|0,l=l|0;var c=0;c=p9()|0,n[s>>2]=c,CTe(c,l),Fp(n[s>>2]|0)}function ZRe(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,uTe()|0),s|0}function $Re(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,eTe()|0),s|0}function eTe(){var s=0;return o[7888]|0||(Y9(10328),pr(53,10328,U|0)|0,s=7888,n[s>>2]=1,n[s+4>>2]=0),Nr(10328)|0||Y9(10328),10328}function T0(s,l){s=s|0,l=l|0,yn(s,0,l,0,0,0)}function Y9(s){s=s|0,nTe(s),L0(s,10)}function tTe(s){s=s|0,rTe(s+24|0)}function rTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function nTe(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,1,l,aTe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function iTe(s,l,c){s=s|0,l=l|0,c=+c,sTe(s,l,c)}function L0(s,l){s=s|0,l=l|0,n[s+20>>2]=l}function sTe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,m=f+8|0,k=f+13|0,d=f,B=f+12|0,XA(k,l),n[m>>2]=ZA(k,l)|0,Tu(B,c),E[d>>3]=+Lu(B,c),oTe(s,m,d),C=f}function oTe(s,l,c){s=s|0,l=l|0,c=c|0,Xa(s+8|0,n[l>>2]|0,+E[c>>3]),o[s+24>>0]=1}function aTe(){return 1404}function lTe(s,l){return s=s|0,l=+l,cTe(s,l)|0}function cTe(s,l){s=s|0,l=+l;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return f=C,C=C+16|0,m=f+4|0,B=f+8|0,k=f,d=Za(8)|0,c=d,F=Yt(16)|0,XA(m,s),s=ZA(m,s)|0,Tu(B,l),Xa(F,s,+Lu(B,l)),B=c+4|0,n[B>>2]=F,s=Yt(8)|0,B=n[B>>2]|0,n[k>>2]=0,n[m>>2]=n[k>>2],PR(s,B,m),n[d>>2]=s,C=f,c|0}function uTe(){var s=0;return o[7896]|0||(V9(10364),pr(54,10364,U|0)|0,s=7896,n[s>>2]=1,n[s+4>>2]=0),Nr(10364)|0||V9(10364),10364}function V9(s){s=s|0,pTe(s),L0(s,55)}function ATe(s){s=s|0,fTe(s+24|0)}function fTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function pTe(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,4,l,mTe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function hTe(s){s=s|0,gTe(s)}function gTe(s){s=s|0,dTe(s)}function dTe(s){s=s|0,K9(s+8|0),o[s+24>>0]=1}function K9(s){s=s|0,n[s>>2]=0,E[s+8>>3]=0}function mTe(){return 1424}function yTe(){return ETe()|0}function ETe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0;return l=C,C=C+16|0,d=l+4|0,B=l,c=Za(8)|0,s=c,f=Yt(16)|0,K9(f),m=s+4|0,n[m>>2]=f,f=Yt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],PR(f,m,d),n[c>>2]=f,C=l,s|0}function CTe(s,l){s=s|0,l=l|0,n[s>>2]=ITe()|0,n[s+4>>2]=wTe()|0,n[s+12>>2]=l,n[s+8>>2]=BTe()|0,n[s+32>>2]=5}function ITe(){return 11710}function wTe(){return 1416}function BTe(){return LD()|0}function vTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(DTe(c),yt(c)):l|0&&yt(l)}function DTe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function LD(){var s=0;return o[7904]|0||(n[2600]=STe()|0,n[2601]=0,s=7904,n[s>>2]=1,n[s+4>>2]=0),10400}function STe(){return n[357]|0}function PTe(s){s=s|0,xTe(s,4926),bTe(s)|0}function xTe(s,l){s=s|0,l=l|0;var c=0;c=N5()|0,n[s>>2]=c,_Te(c,l),Fp(n[s>>2]|0)}function bTe(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,kTe()|0),s|0}function kTe(){var s=0;return o[7912]|0||(J9(10412),pr(56,10412,U|0)|0,s=7912,n[s>>2]=1,n[s+4>>2]=0),Nr(10412)|0||J9(10412),10412}function J9(s){s=s|0,RTe(s),L0(s,57)}function QTe(s){s=s|0,FTe(s+24|0)}function FTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function RTe(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,5,l,OTe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function TTe(s){s=s|0,LTe(s)}function LTe(s){s=s|0,NTe(s)}function NTe(s){s=s|0;var l=0,c=0;l=s+8|0,c=l+48|0;do n[l>>2]=0,l=l+4|0;while((l|0)<(c|0));o[s+56>>0]=1}function OTe(){return 1432}function MTe(){return UTe()|0}function UTe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0,k=0;B=C,C=C+16|0,s=B+4|0,l=B,c=Za(8)|0,f=c,d=Yt(48)|0,m=d,k=m+48|0;do n[m>>2]=0,m=m+4|0;while((m|0)<(k|0));return m=f+4|0,n[m>>2]=d,k=Yt(8)|0,m=n[m>>2]|0,n[l>>2]=0,n[s>>2]=n[l>>2],O5(k,m,s),n[c>>2]=k,C=B,f|0}function _Te(s,l){s=s|0,l=l|0,n[s>>2]=HTe()|0,n[s+4>>2]=qTe()|0,n[s+12>>2]=l,n[s+8>>2]=jTe()|0,n[s+32>>2]=6}function HTe(){return 11704}function qTe(){return 1436}function jTe(){return LD()|0}function GTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(WTe(c),yt(c)):l|0&&yt(l)}function WTe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function YTe(s){s=s|0,VTe(s,4933),KTe(s)|0,JTe(s)|0}function VTe(s,l){s=s|0,l=l|0;var c=0;c=ELe()|0,n[s>>2]=c,CLe(c,l),Fp(n[s>>2]|0)}function KTe(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,cLe()|0),s|0}function JTe(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,zTe()|0),s|0}function zTe(){var s=0;return o[7920]|0||(z9(10452),pr(58,10452,U|0)|0,s=7920,n[s>>2]=1,n[s+4>>2]=0),Nr(10452)|0||z9(10452),10452}function z9(s){s=s|0,$Te(s),L0(s,1)}function XTe(s){s=s|0,ZTe(s+24|0)}function ZTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function $Te(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,1,l,nLe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function eLe(s,l,c){s=s|0,l=+l,c=+c,tLe(s,l,c)}function tLe(s,l,c){s=s|0,l=+l,c=+c;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+32|0,m=f+8|0,k=f+17|0,d=f,B=f+16|0,Tu(k,l),E[m>>3]=+Lu(k,l),Tu(B,c),E[d>>3]=+Lu(B,c),rLe(s,m,d),C=f}function rLe(s,l,c){s=s|0,l=l|0,c=c|0,X9(s+8|0,+E[l>>3],+E[c>>3]),o[s+24>>0]=1}function X9(s,l,c){s=s|0,l=+l,c=+c,E[s>>3]=l,E[s+8>>3]=c}function nLe(){return 1472}function iLe(s,l){return s=+s,l=+l,sLe(s,l)|0}function sLe(s,l){s=+s,l=+l;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return f=C,C=C+16|0,B=f+4|0,k=f+8|0,F=f,d=Za(8)|0,c=d,m=Yt(16)|0,Tu(B,s),s=+Lu(B,s),Tu(k,l),X9(m,s,+Lu(k,l)),k=c+4|0,n[k>>2]=m,m=Yt(8)|0,k=n[k>>2]|0,n[F>>2]=0,n[B>>2]=n[F>>2],Z9(m,k,B),n[d>>2]=m,C=f,c|0}function Z9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Yt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1452,n[c+12>>2]=l,n[s+4>>2]=c}function oLe(s){s=s|0,im(s),yt(s)}function aLe(s){s=s|0,s=n[s+12>>2]|0,s|0&&yt(s)}function lLe(s){s=s|0,yt(s)}function cLe(){var s=0;return o[7928]|0||($9(10488),pr(59,10488,U|0)|0,s=7928,n[s>>2]=1,n[s+4>>2]=0),Nr(10488)|0||$9(10488),10488}function $9(s){s=s|0,fLe(s),L0(s,60)}function uLe(s){s=s|0,ALe(s+24|0)}function ALe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function fLe(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,6,l,dLe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function pLe(s){s=s|0,hLe(s)}function hLe(s){s=s|0,gLe(s)}function gLe(s){s=s|0,e7(s+8|0),o[s+24>>0]=1}function e7(s){s=s|0,n[s>>2]=0,n[s+4>>2]=0,n[s+8>>2]=0,n[s+12>>2]=0}function dLe(){return 1492}function mLe(){return yLe()|0}function yLe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0;return l=C,C=C+16|0,d=l+4|0,B=l,c=Za(8)|0,s=c,f=Yt(16)|0,e7(f),m=s+4|0,n[m>>2]=f,f=Yt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],Z9(f,m,d),n[c>>2]=f,C=l,s|0}function ELe(){var s=0;return o[7936]|0||(SLe(10524),pr(25,10524,U|0)|0,s=7936,n[s>>2]=1,n[s+4>>2]=0),10524}function CLe(s,l){s=s|0,l=l|0,n[s>>2]=ILe()|0,n[s+4>>2]=wLe()|0,n[s+12>>2]=l,n[s+8>>2]=BLe()|0,n[s+32>>2]=7}function ILe(){return 11700}function wLe(){return 1484}function BLe(){return LD()|0}function vLe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(DLe(c),yt(c)):l|0&&yt(l)}function DLe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function SLe(s){s=s|0,Pp(s)}function PLe(s,l,c){s=s|0,l=l|0,c=c|0,s=mn(l)|0,l=xLe(c)|0,c=bLe(c,0)|0,sNe(s,l,c,jR()|0,0)}function xLe(s){return s=s|0,s|0}function bLe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=jR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(r7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(NLe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function jR(){var s=0,l=0;if(o[7944]|0||(t7(10568),pr(61,10568,U|0)|0,l=7944,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10568)|0)){s=10568,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));t7(10568)}return 10568}function t7(s){s=s|0,FLe(s)}function kLe(s){s=s|0,QLe(s+24|0)}function QLe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function FLe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,17,l,e9()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function RLe(s){return s=s|0,LLe(n[(TLe(s)|0)>>2]|0)|0}function TLe(s){return s=s|0,(n[(jR()|0)+24>>2]|0)+(s<<3)|0}function LLe(s){return s=s|0,RD(VD[s&7]()|0)|0}function r7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function NLe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=OLe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,MLe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,r7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,ULe(s,d),_Le(d),C=k;return}}function OLe(s){return s=s|0,536870911}function MLe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function ULe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function _Le(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function HLe(){qLe()}function qLe(){jLe(10604)}function jLe(s){s=s|0,GLe(s,4955)}function GLe(s,l){s=s|0,l=l|0;var c=0;c=WLe()|0,n[s>>2]=c,YLe(c,l),Fp(n[s>>2]|0)}function WLe(){var s=0;return o[7952]|0||(tNe(10612),pr(25,10612,U|0)|0,s=7952,n[s>>2]=1,n[s+4>>2]=0),10612}function YLe(s,l){s=s|0,l=l|0,n[s>>2]=zLe()|0,n[s+4>>2]=XLe()|0,n[s+12>>2]=l,n[s+8>>2]=ZLe()|0,n[s+32>>2]=8}function Fp(s){s=s|0;var l=0,c=0;l=C,C=C+16|0,c=l,$d()|0,n[c>>2]=s,VLe(10608,c),C=l}function $d(){return o[11714]|0||(n[2652]=0,pr(62,10608,U|0)|0,o[11714]=1),10608}function VLe(s,l){s=s|0,l=l|0;var c=0;c=Yt(8)|0,n[c+4>>2]=n[l>>2],n[c>>2]=n[s>>2],n[s>>2]=c}function KLe(s){s=s|0,JLe(s)}function JLe(s){s=s|0;var l=0,c=0;if(l=n[s>>2]|0,l|0)do c=l,l=n[l>>2]|0,yt(c);while(l|0);n[s>>2]=0}function zLe(){return 11715}function XLe(){return 1496}function ZLe(){return TD()|0}function $Le(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(eNe(c),yt(c)):l|0&&yt(l)}function eNe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function tNe(s){s=s|0,Pp(s)}function rNe(s,l){s=s|0,l=l|0;var c=0,f=0;$d()|0,c=n[2652]|0;e:do if(c|0){for(;f=n[c+4>>2]|0,!(f|0&&!(O7(GR(f)|0,s)|0));)if(c=n[c>>2]|0,!c)break e;nNe(f,l)}while(!1)}function GR(s){return s=s|0,n[s+12>>2]|0}function nNe(s,l){s=s|0,l=l|0;var c=0;s=s+36|0,c=n[s>>2]|0,c|0&&(xu(c),yt(c)),c=Yt(4)|0,SD(c,l),n[s>>2]=c}function WR(){return o[11716]|0||(n[2664]=0,pr(63,10656,U|0)|0,o[11716]=1),10656}function n7(){var s=0;return o[11717]|0?s=n[2665]|0:(iNe(),n[2665]=1504,o[11717]=1,s=1504),s|0}function iNe(){o[11740]|0||(o[11718]=dr(dr(8,0)|0,0)|0,o[11719]=dr(dr(0,0)|0,0)|0,o[11720]=dr(dr(0,16)|0,0)|0,o[11721]=dr(dr(8,0)|0,0)|0,o[11722]=dr(dr(0,0)|0,0)|0,o[11723]=dr(dr(8,0)|0,0)|0,o[11724]=dr(dr(0,0)|0,0)|0,o[11725]=dr(dr(8,0)|0,0)|0,o[11726]=dr(dr(0,0)|0,0)|0,o[11727]=dr(dr(8,0)|0,0)|0,o[11728]=dr(dr(0,0)|0,0)|0,o[11729]=dr(dr(0,0)|0,32)|0,o[11730]=dr(dr(0,0)|0,32)|0,o[11740]=1)}function i7(){return 1572}function sNe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0,M=0,O=0;m=C,C=C+32|0,O=m+16|0,M=m+12|0,F=m+8|0,k=m+4|0,B=m,n[O>>2]=s,n[M>>2]=l,n[F>>2]=c,n[k>>2]=f,n[B>>2]=d,WR()|0,oNe(10656,O,M,F,k,B),C=m}function oNe(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0;B=Yt(24)|0,R5(B+4|0,n[l>>2]|0,n[c>>2]|0,n[f>>2]|0,n[d>>2]|0,n[m>>2]|0),n[B>>2]=n[s>>2],n[s>>2]=B}function s7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0,rt=0,Xe=0,ct=0;if(ct=C,C=C+32|0,Oe=ct+20|0,Qe=ct+8|0,rt=ct+4|0,Xe=ct,l=n[l>>2]|0,l|0){We=Oe+4|0,F=Oe+8|0,M=Qe+4|0,O=Qe+8|0,j=Qe+8|0,oe=Oe+8|0;do{if(B=l+4|0,k=YR(B)|0,k|0){if(d=$I(k)|0,n[Oe>>2]=0,n[We>>2]=0,n[F>>2]=0,f=(ew(k)|0)+1|0,aNe(Oe,f),f|0)for(;f=f+-1|0,Tc(Qe,n[d>>2]|0),m=n[We>>2]|0,m>>>0<(n[oe>>2]|0)>>>0?(n[m>>2]=n[Qe>>2],n[We>>2]=(n[We>>2]|0)+4):VR(Oe,Qe),f;)d=d+4|0;f=tw(k)|0,n[Qe>>2]=0,n[M>>2]=0,n[O>>2]=0;e:do if(n[f>>2]|0)for(d=0,m=0;;){if((d|0)==(m|0)?lNe(Qe,f):(n[d>>2]=n[f>>2],n[M>>2]=(n[M>>2]|0)+4),f=f+4|0,!(n[f>>2]|0))break e;d=n[M>>2]|0,m=n[j>>2]|0}while(!1);n[rt>>2]=ND(B)|0,n[Xe>>2]=Nr(k)|0,cNe(c,s,rt,Xe,Oe,Qe),KR(Qe),$A(Oe)}l=n[l>>2]|0}while(l|0)}C=ct}function YR(s){return s=s|0,n[s+12>>2]|0}function $I(s){return s=s|0,n[s+12>>2]|0}function ew(s){return s=s|0,n[s+16>>2]|0}function aNe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;d=C,C=C+32|0,c=d,f=n[s>>2]|0,(n[s+8>>2]|0)-f>>2>>>0>>0&&(p7(c,l,(n[s+4>>2]|0)-f>>2,s+8|0),h7(s,c),g7(c)),C=d}function VR(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0;if(B=C,C=C+32|0,c=B,f=s+4|0,d=((n[f>>2]|0)-(n[s>>2]|0)>>2)+1|0,m=f7(s)|0,m>>>0>>0)Zr(s);else{k=n[s>>2]|0,M=(n[s+8>>2]|0)-k|0,F=M>>1,p7(c,M>>2>>>0>>1>>>0?F>>>0>>0?d:F:m,(n[f>>2]|0)-k>>2,s+8|0),m=c+8|0,n[n[m>>2]>>2]=n[l>>2],n[m>>2]=(n[m>>2]|0)+4,h7(s,c),g7(c),C=B;return}}function tw(s){return s=s|0,n[s+8>>2]|0}function lNe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0;if(B=C,C=C+32|0,c=B,f=s+4|0,d=((n[f>>2]|0)-(n[s>>2]|0)>>2)+1|0,m=A7(s)|0,m>>>0>>0)Zr(s);else{k=n[s>>2]|0,M=(n[s+8>>2]|0)-k|0,F=M>>1,xNe(c,M>>2>>>0>>1>>>0?F>>>0>>0?d:F:m,(n[f>>2]|0)-k>>2,s+8|0),m=c+8|0,n[n[m>>2]>>2]=n[l>>2],n[m>>2]=(n[m>>2]|0)+4,bNe(s,c),kNe(c),C=B;return}}function ND(s){return s=s|0,n[s>>2]|0}function cNe(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,uNe(s,l,c,f,d,m)}function KR(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-4-f|0)>>>2)<<2)),yt(c))}function $A(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-4-f|0)>>>2)<<2)),yt(c))}function uNe(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,F=0,M=0,O=0,j=0;B=C,C=C+48|0,O=B+40|0,k=B+32|0,j=B+24|0,F=B+12|0,M=B,$a(k),s=ys(s)|0,n[j>>2]=n[l>>2],c=n[c>>2]|0,f=n[f>>2]|0,JR(F,d),ANe(M,m),n[O>>2]=n[j>>2],fNe(s,O,c,f,F,M),KR(M),$A(F),el(k),C=B}function JR(s,l){s=s|0,l=l|0;var c=0,f=0;n[s>>2]=0,n[s+4>>2]=0,n[s+8>>2]=0,c=l+4|0,f=(n[c>>2]|0)-(n[l>>2]|0)>>2,f|0&&(SNe(s,f),PNe(s,n[l>>2]|0,n[c>>2]|0,f))}function ANe(s,l){s=s|0,l=l|0;var c=0,f=0;n[s>>2]=0,n[s+4>>2]=0,n[s+8>>2]=0,c=l+4|0,f=(n[c>>2]|0)-(n[l>>2]|0)>>2,f|0&&(vNe(s,f),DNe(s,n[l>>2]|0,n[c>>2]|0,f))}function fNe(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,F=0,M=0,O=0,j=0;B=C,C=C+32|0,O=B+28|0,j=B+24|0,k=B+12|0,F=B,M=jo(pNe()|0)|0,n[j>>2]=n[l>>2],n[O>>2]=n[j>>2],l=N0(O)|0,c=o7(c)|0,f=zR(f)|0,n[k>>2]=n[d>>2],O=d+4|0,n[k+4>>2]=n[O>>2],j=d+8|0,n[k+8>>2]=n[j>>2],n[j>>2]=0,n[O>>2]=0,n[d>>2]=0,d=XR(k)|0,n[F>>2]=n[m>>2],O=m+4|0,n[F+4>>2]=n[O>>2],j=m+8|0,n[F+8>>2]=n[j>>2],n[j>>2]=0,n[O>>2]=0,n[m>>2]=0,gc(0,M|0,s|0,l|0,c|0,f|0,d|0,hNe(F)|0)|0,KR(F),$A(k),C=B}function pNe(){var s=0;return o[7968]|0||(wNe(10708),s=7968,n[s>>2]=1,n[s+4>>2]=0),10708}function N0(s){return s=s|0,l7(s)|0}function o7(s){return s=s|0,a7(s)|0}function zR(s){return s=s|0,RD(s)|0}function XR(s){return s=s|0,dNe(s)|0}function hNe(s){return s=s|0,gNe(s)|0}function gNe(s){s=s|0;var l=0,c=0,f=0;if(f=(n[s+4>>2]|0)-(n[s>>2]|0)|0,c=f>>2,f=Za(f+4|0)|0,n[f>>2]=c,c|0){l=0;do n[f+4+(l<<2)>>2]=a7(n[(n[s>>2]|0)+(l<<2)>>2]|0)|0,l=l+1|0;while((l|0)!=(c|0))}return f|0}function a7(s){return s=s|0,s|0}function dNe(s){s=s|0;var l=0,c=0,f=0;if(f=(n[s+4>>2]|0)-(n[s>>2]|0)|0,c=f>>2,f=Za(f+4|0)|0,n[f>>2]=c,c|0){l=0;do n[f+4+(l<<2)>>2]=l7((n[s>>2]|0)+(l<<2)|0)|0,l=l+1|0;while((l|0)!=(c|0))}return f|0}function l7(s){s=s|0;var l=0,c=0,f=0,d=0;return d=C,C=C+32|0,l=d+12|0,c=d,f=cR(c7()|0)|0,f?(uR(l,f),AR(c,l),Z4e(s,c),s=fR(l)|0):s=mNe(s)|0,C=d,s|0}function c7(){var s=0;return o[7960]|0||(INe(10664),pr(25,10664,U|0)|0,s=7960,n[s>>2]=1,n[s+4>>2]=0),10664}function mNe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;return c=C,C=C+16|0,d=c+4|0,B=c,f=Za(8)|0,l=f,k=Yt(4)|0,n[k>>2]=n[s>>2],m=l+4|0,n[m>>2]=k,s=Yt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],u7(s,m,d),n[f>>2]=s,C=c,l|0}function u7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Yt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1656,n[c+12>>2]=l,n[s+4>>2]=c}function yNe(s){s=s|0,im(s),yt(s)}function ENe(s){s=s|0,s=n[s+12>>2]|0,s|0&&yt(s)}function CNe(s){s=s|0,yt(s)}function INe(s){s=s|0,Pp(s)}function wNe(s){s=s|0,ao(s,BNe()|0,5)}function BNe(){return 1676}function vNe(s,l){s=s|0,l=l|0;var c=0;if((A7(s)|0)>>>0>>0&&Zr(s),l>>>0>1073741823)Tt();else{c=Yt(l<<2)|0,n[s+4>>2]=c,n[s>>2]=c,n[s+8>>2]=c+(l<<2);return}}function DNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,f=s+4|0,s=c-l|0,(s|0)>0&&(br(n[f>>2]|0,l|0,s|0)|0,n[f>>2]=(n[f>>2]|0)+(s>>>2<<2))}function A7(s){return s=s|0,1073741823}function SNe(s,l){s=s|0,l=l|0;var c=0;if((f7(s)|0)>>>0>>0&&Zr(s),l>>>0>1073741823)Tt();else{c=Yt(l<<2)|0,n[s+4>>2]=c,n[s>>2]=c,n[s+8>>2]=c+(l<<2);return}}function PNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,f=s+4|0,s=c-l|0,(s|0)>0&&(br(n[f>>2]|0,l|0,s|0)|0,n[f>>2]=(n[f>>2]|0)+(s>>>2<<2))}function f7(s){return s=s|0,1073741823}function xNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>1073741823)Tt();else{d=Yt(l<<2)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<2)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<2)}function bNe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function kNe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-4-l|0)>>>2)<<2)),s=n[s>>2]|0,s|0&&yt(s)}function p7(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>1073741823)Tt();else{d=Yt(l<<2)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<2)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<2)}function h7(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function g7(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-4-l|0)>>>2)<<2)),s=n[s>>2]|0,s|0&&yt(s)}function QNe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0;if(Qe=C,C=C+32|0,O=Qe+20|0,j=Qe+12|0,M=Qe+16|0,oe=Qe+4|0,We=Qe,Oe=Qe+8|0,k=n7()|0,m=n[k>>2]|0,B=n[m>>2]|0,B|0)for(F=n[k+8>>2]|0,k=n[k+4>>2]|0;Tc(O,B),FNe(s,O,k,F),m=m+4|0,B=n[m>>2]|0,B;)F=F+1|0,k=k+1|0;if(m=i7()|0,B=n[m>>2]|0,B|0)do Tc(O,B),n[j>>2]=n[m+4>>2],RNe(l,O,j),m=m+8|0,B=n[m>>2]|0;while(B|0);if(m=n[($d()|0)>>2]|0,m|0)do l=n[m+4>>2]|0,Tc(O,n[(em(l)|0)>>2]|0),n[j>>2]=GR(l)|0,TNe(c,O,j),m=n[m>>2]|0;while(m|0);if(Tc(M,0),m=WR()|0,n[O>>2]=n[M>>2],s7(O,m,d),m=n[($d()|0)>>2]|0,m|0){s=O+4|0,l=O+8|0,c=O+8|0;do{if(F=n[m+4>>2]|0,Tc(j,n[(em(F)|0)>>2]|0),LNe(oe,d7(F)|0),B=n[oe>>2]|0,B|0){n[O>>2]=0,n[s>>2]=0,n[l>>2]=0;do Tc(We,n[(em(n[B+4>>2]|0)|0)>>2]|0),k=n[s>>2]|0,k>>>0<(n[c>>2]|0)>>>0?(n[k>>2]=n[We>>2],n[s>>2]=(n[s>>2]|0)+4):VR(O,We),B=n[B>>2]|0;while(B|0);NNe(f,j,O),$A(O)}n[Oe>>2]=n[j>>2],M=m7(F)|0,n[O>>2]=n[Oe>>2],s7(O,M,d),U5(oe),m=n[m>>2]|0}while(m|0)}C=Qe}function FNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,KNe(s,l,c,f)}function RNe(s,l,c){s=s|0,l=l|0,c=c|0,VNe(s,l,c)}function em(s){return s=s|0,s|0}function TNe(s,l,c){s=s|0,l=l|0,c=c|0,jNe(s,l,c)}function d7(s){return s=s|0,s+16|0}function LNe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;if(m=C,C=C+16|0,d=m+8|0,c=m,n[s>>2]=0,f=n[l>>2]|0,n[d>>2]=f,n[c>>2]=s,c=qNe(c)|0,f|0){if(f=Yt(12)|0,B=(y7(d)|0)+4|0,s=n[B+4>>2]|0,l=f+4|0,n[l>>2]=n[B>>2],n[l+4>>2]=s,l=n[n[d>>2]>>2]|0,n[d>>2]=l,!l)s=f;else for(l=f;s=Yt(12)|0,F=(y7(d)|0)+4|0,k=n[F+4>>2]|0,B=s+4|0,n[B>>2]=n[F>>2],n[B+4>>2]=k,n[l>>2]=s,B=n[n[d>>2]>>2]|0,n[d>>2]=B,B;)l=s;n[s>>2]=n[c>>2],n[c>>2]=f}C=m}function NNe(s,l,c){s=s|0,l=l|0,c=c|0,ONe(s,l,c)}function m7(s){return s=s|0,s+24|0}function ONe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+32|0,B=f+24|0,d=f+16|0,k=f+12|0,m=f,$a(d),s=ys(s)|0,n[k>>2]=n[l>>2],JR(m,c),n[B>>2]=n[k>>2],MNe(s,B,m),$A(m),el(d),C=f}function MNe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+32|0,B=f+16|0,k=f+12|0,d=f,m=jo(UNe()|0)|0,n[k>>2]=n[l>>2],n[B>>2]=n[k>>2],l=N0(B)|0,n[d>>2]=n[c>>2],B=c+4|0,n[d+4>>2]=n[B>>2],k=c+8|0,n[d+8>>2]=n[k>>2],n[k>>2]=0,n[B>>2]=0,n[c>>2]=0,hs(0,m|0,s|0,l|0,XR(d)|0)|0,$A(d),C=f}function UNe(){var s=0;return o[7976]|0||(_Ne(10720),s=7976,n[s>>2]=1,n[s+4>>2]=0),10720}function _Ne(s){s=s|0,ao(s,HNe()|0,2)}function HNe(){return 1732}function qNe(s){return s=s|0,n[s>>2]|0}function y7(s){return s=s|0,n[s>>2]|0}function jNe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+32|0,m=f+16|0,d=f+8|0,B=f,$a(d),s=ys(s)|0,n[B>>2]=n[l>>2],c=n[c>>2]|0,n[m>>2]=n[B>>2],E7(s,m,c),el(d),C=f}function E7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,m=f+4|0,B=f,d=jo(GNe()|0)|0,n[B>>2]=n[l>>2],n[m>>2]=n[B>>2],l=N0(m)|0,hs(0,d|0,s|0,l|0,o7(c)|0)|0,C=f}function GNe(){var s=0;return o[7984]|0||(WNe(10732),s=7984,n[s>>2]=1,n[s+4>>2]=0),10732}function WNe(s){s=s|0,ao(s,YNe()|0,2)}function YNe(){return 1744}function VNe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+32|0,m=f+16|0,d=f+8|0,B=f,$a(d),s=ys(s)|0,n[B>>2]=n[l>>2],c=n[c>>2]|0,n[m>>2]=n[B>>2],E7(s,m,c),el(d),C=f}function KNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+32|0,B=d+16|0,m=d+8|0,k=d,$a(m),s=ys(s)|0,n[k>>2]=n[l>>2],c=o[c>>0]|0,f=o[f>>0]|0,n[B>>2]=n[k>>2],JNe(s,B,c,f),el(m),C=d}function JNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,B=d+4|0,k=d,m=jo(zNe()|0)|0,n[k>>2]=n[l>>2],n[B>>2]=n[k>>2],l=N0(B)|0,c=tm(c)|0,vi(0,m|0,s|0,l|0,c|0,tm(f)|0)|0,C=d}function zNe(){var s=0;return o[7992]|0||(ZNe(10744),s=7992,n[s>>2]=1,n[s+4>>2]=0),10744}function tm(s){return s=s|0,XNe(s)|0}function XNe(s){return s=s|0,s&255|0}function ZNe(s){s=s|0,ao(s,$Ne()|0,3)}function $Ne(){return 1756}function eOe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;switch(oe=C,C=C+32|0,k=oe+8|0,F=oe+4|0,M=oe+20|0,O=oe,dR(s,0),f=X4e(l)|0,n[k>>2]=0,j=k+4|0,n[j>>2]=0,n[k+8>>2]=0,f<<24>>24){case 0:{o[M>>0]=0,tOe(F,c,M),OD(s,F)|0,bu(F);break}case 8:{j=nT(l)|0,o[M>>0]=8,Tc(O,n[j+4>>2]|0),rOe(F,c,M,O,j+8|0),OD(s,F)|0,bu(F);break}case 9:{if(m=nT(l)|0,l=n[m+4>>2]|0,l|0)for(B=k+8|0,d=m+12|0;l=l+-1|0,Tc(F,n[d>>2]|0),f=n[j>>2]|0,f>>>0<(n[B>>2]|0)>>>0?(n[f>>2]=n[F>>2],n[j>>2]=(n[j>>2]|0)+4):VR(k,F),l;)d=d+4|0;o[M>>0]=9,Tc(O,n[m+8>>2]|0),nOe(F,c,M,O,k),OD(s,F)|0,bu(F);break}default:j=nT(l)|0,o[M>>0]=f,Tc(O,n[j+4>>2]|0),iOe(F,c,M,O),OD(s,F)|0,bu(F)}$A(k),C=oe}function tOe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,$a(d),l=ys(l)|0,mOe(s,l,o[c>>0]|0),el(d),C=f}function OD(s,l){s=s|0,l=l|0;var c=0;return c=n[s>>2]|0,c|0&&sa(c|0),n[s>>2]=n[l>>2],n[l>>2]=0,s|0}function rOe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0;m=C,C=C+32|0,k=m+16|0,B=m+8|0,F=m,$a(B),l=ys(l)|0,c=o[c>>0]|0,n[F>>2]=n[f>>2],d=n[d>>2]|0,n[k>>2]=n[F>>2],pOe(s,l,c,k,d),el(B),C=m}function nOe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0,M=0;m=C,C=C+32|0,F=m+24|0,B=m+16|0,M=m+12|0,k=m,$a(B),l=ys(l)|0,c=o[c>>0]|0,n[M>>2]=n[f>>2],JR(k,d),n[F>>2]=n[M>>2],cOe(s,l,c,F,k),$A(k),el(B),C=m}function iOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+32|0,B=d+16|0,m=d+8|0,k=d,$a(m),l=ys(l)|0,c=o[c>>0]|0,n[k>>2]=n[f>>2],n[B>>2]=n[k>>2],sOe(s,l,c,B),el(m),C=d}function sOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+4|0,k=d,B=jo(oOe()|0)|0,c=tm(c)|0,n[k>>2]=n[f>>2],n[m>>2]=n[k>>2],MD(s,hs(0,B|0,l|0,c|0,N0(m)|0)|0),C=d}function oOe(){var s=0;return o[8e3]|0||(aOe(10756),s=8e3,n[s>>2]=1,n[s+4>>2]=0),10756}function MD(s,l){s=s|0,l=l|0,dR(s,l)}function aOe(s){s=s|0,ao(s,lOe()|0,2)}function lOe(){return 1772}function cOe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0,M=0;m=C,C=C+32|0,F=m+16|0,M=m+12|0,B=m,k=jo(uOe()|0)|0,c=tm(c)|0,n[M>>2]=n[f>>2],n[F>>2]=n[M>>2],f=N0(F)|0,n[B>>2]=n[d>>2],F=d+4|0,n[B+4>>2]=n[F>>2],M=d+8|0,n[B+8>>2]=n[M>>2],n[M>>2]=0,n[F>>2]=0,n[d>>2]=0,MD(s,vi(0,k|0,l|0,c|0,f|0,XR(B)|0)|0),$A(B),C=m}function uOe(){var s=0;return o[8008]|0||(AOe(10768),s=8008,n[s>>2]=1,n[s+4>>2]=0),10768}function AOe(s){s=s|0,ao(s,fOe()|0,3)}function fOe(){return 1784}function pOe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0;m=C,C=C+16|0,k=m+4|0,F=m,B=jo(hOe()|0)|0,c=tm(c)|0,n[F>>2]=n[f>>2],n[k>>2]=n[F>>2],f=N0(k)|0,MD(s,vi(0,B|0,l|0,c|0,f|0,zR(d)|0)|0),C=m}function hOe(){var s=0;return o[8016]|0||(gOe(10780),s=8016,n[s>>2]=1,n[s+4>>2]=0),10780}function gOe(s){s=s|0,ao(s,dOe()|0,3)}function dOe(){return 1800}function mOe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=jo(yOe()|0)|0,MD(s,un(0,f|0,l|0,tm(c)|0)|0)}function yOe(){var s=0;return o[8024]|0||(EOe(10792),s=8024,n[s>>2]=1,n[s+4>>2]=0),10792}function EOe(s){s=s|0,ao(s,COe()|0,1)}function COe(){return 1816}function IOe(){wOe(),BOe(),vOe()}function wOe(){n[2702]=V7(65536)|0}function BOe(){GOe(10856)}function vOe(){DOe(10816)}function DOe(s){s=s|0,SOe(s,5044),POe(s)|0}function SOe(s,l){s=s|0,l=l|0;var c=0;c=c7()|0,n[s>>2]=c,MOe(c,l),Fp(n[s>>2]|0)}function POe(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,xOe()|0),s|0}function xOe(){var s=0;return o[8032]|0||(C7(10820),pr(64,10820,U|0)|0,s=8032,n[s>>2]=1,n[s+4>>2]=0),Nr(10820)|0||C7(10820),10820}function C7(s){s=s|0,QOe(s),L0(s,25)}function bOe(s){s=s|0,kOe(s+24|0)}function kOe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function QOe(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,18,l,LOe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function FOe(s,l){s=s|0,l=l|0,ROe(s,l)}function ROe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;c=C,C=C+16|0,f=c,d=c+4|0,F0(d,l),n[f>>2]=R0(d,l)|0,TOe(s,f),C=c}function TOe(s,l){s=s|0,l=l|0,I7(s+4|0,n[l>>2]|0),o[s+8>>0]=1}function I7(s,l){s=s|0,l=l|0,n[s>>2]=l}function LOe(){return 1824}function NOe(s){return s=s|0,OOe(s)|0}function OOe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;return c=C,C=C+16|0,d=c+4|0,B=c,f=Za(8)|0,l=f,k=Yt(4)|0,F0(d,s),I7(k,R0(d,s)|0),m=l+4|0,n[m>>2]=k,s=Yt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],u7(s,m,d),n[f>>2]=s,C=c,l|0}function Za(s){s=s|0;var l=0,c=0;return s=s+7&-8,s>>>0<=32768&&(l=n[2701]|0,s>>>0<=(65536-l|0)>>>0)?(c=(n[2702]|0)+l|0,n[2701]=l+s,s=c):(s=V7(s+8|0)|0,n[s>>2]=n[2703],n[2703]=s,s=s+8|0),s|0}function MOe(s,l){s=s|0,l=l|0,n[s>>2]=UOe()|0,n[s+4>>2]=_Oe()|0,n[s+12>>2]=l,n[s+8>>2]=HOe()|0,n[s+32>>2]=9}function UOe(){return 11744}function _Oe(){return 1832}function HOe(){return LD()|0}function qOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(jOe(c),yt(c)):l|0&&yt(l)}function jOe(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function GOe(s){s=s|0,WOe(s,5052),YOe(s)|0,VOe(s,5058,26)|0,KOe(s,5069,1)|0,JOe(s,5077,10)|0,zOe(s,5087,19)|0,XOe(s,5094,27)|0}function WOe(s,l){s=s|0,l=l|0;var c=0;c=j4e()|0,n[s>>2]=c,G4e(c,l),Fp(n[s>>2]|0)}function YOe(s){s=s|0;var l=0;return l=n[s>>2]|0,T0(l,b4e()|0),s|0}function VOe(s,l,c){return s=s|0,l=l|0,c=c|0,A4e(s,mn(l)|0,c,0),s|0}function KOe(s,l,c){return s=s|0,l=l|0,c=c|0,zMe(s,mn(l)|0,c,0),s|0}function JOe(s,l,c){return s=s|0,l=l|0,c=c|0,xMe(s,mn(l)|0,c,0),s|0}function zOe(s,l,c){return s=s|0,l=l|0,c=c|0,pMe(s,mn(l)|0,c,0),s|0}function w7(s,l){s=s|0,l=l|0;var c=0,f=0;e:for(;;){for(c=n[2703]|0;;){if((c|0)==(l|0))break e;if(f=n[c>>2]|0,n[2703]=f,!c)c=f;else break}yt(c)}n[2701]=s}function XOe(s,l,c){return s=s|0,l=l|0,c=c|0,ZOe(s,mn(l)|0,c,0),s|0}function ZOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=ZR()|0,s=$Oe(c)|0,yn(m,l,d,s,eMe(c,f)|0,f)}function ZR(){var s=0,l=0;if(o[8040]|0||(v7(10860),pr(65,10860,U|0)|0,l=8040,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10860)|0)){s=10860,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));v7(10860)}return 10860}function $Oe(s){return s=s|0,s|0}function eMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=ZR()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(B7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(tMe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function B7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function tMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=rMe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,nMe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,B7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,iMe(s,d),sMe(d),C=k;return}}function rMe(s){return s=s|0,536870911}function nMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function iMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function sMe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function v7(s){s=s|0,lMe(s)}function oMe(s){s=s|0,aMe(s+24|0)}function aMe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function lMe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,11,l,cMe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function cMe(){return 1840}function uMe(s,l,c){s=s|0,l=l|0,c=c|0,fMe(n[(AMe(s)|0)>>2]|0,l,c)}function AMe(s){return s=s|0,(n[(ZR()|0)+24>>2]|0)+(s<<3)|0}function fMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;f=C,C=C+16|0,m=f+1|0,d=f,F0(m,l),l=R0(m,l)|0,F0(d,c),c=R0(d,c)|0,tf[s&31](l,c),C=f}function pMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=$R()|0,s=hMe(c)|0,yn(m,l,d,s,gMe(c,f)|0,f)}function $R(){var s=0,l=0;if(o[8048]|0||(S7(10896),pr(66,10896,U|0)|0,l=8048,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10896)|0)){s=10896,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));S7(10896)}return 10896}function hMe(s){return s=s|0,s|0}function gMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=$R()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(D7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(dMe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function D7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function dMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=mMe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,yMe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,D7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,EMe(s,d),CMe(d),C=k;return}}function mMe(s){return s=s|0,536870911}function yMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function EMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function CMe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function S7(s){s=s|0,BMe(s)}function IMe(s){s=s|0,wMe(s+24|0)}function wMe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function BMe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,11,l,vMe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function vMe(){return 1852}function DMe(s,l){return s=s|0,l=l|0,PMe(n[(SMe(s)|0)>>2]|0,l)|0}function SMe(s){return s=s|0,(n[($R()|0)+24>>2]|0)+(s<<3)|0}function PMe(s,l){s=s|0,l=l|0;var c=0,f=0;return c=C,C=C+16|0,f=c,F0(f,l),l=R0(f,l)|0,l=RD(_0[s&31](l)|0)|0,C=c,l|0}function xMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=eT()|0,s=bMe(c)|0,yn(m,l,d,s,kMe(c,f)|0,f)}function eT(){var s=0,l=0;if(o[8056]|0||(x7(10932),pr(67,10932,U|0)|0,l=8056,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10932)|0)){s=10932,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));x7(10932)}return 10932}function bMe(s){return s=s|0,s|0}function kMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=eT()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(P7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(QMe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function P7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function QMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=FMe(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,RMe(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,P7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,TMe(s,d),LMe(d),C=k;return}}function FMe(s){return s=s|0,536870911}function RMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function TMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function LMe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function x7(s){s=s|0,MMe(s)}function NMe(s){s=s|0,OMe(s+24|0)}function OMe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function MMe(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,7,l,UMe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function UMe(){return 1860}function _Me(s,l,c){return s=s|0,l=l|0,c=c|0,qMe(n[(HMe(s)|0)>>2]|0,l,c)|0}function HMe(s){return s=s|0,(n[(eT()|0)+24>>2]|0)+(s<<3)|0}function qMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0;return f=C,C=C+32|0,B=f+12|0,m=f+8|0,k=f,F=f+16|0,d=f+4|0,jMe(F,l),GMe(k,F,l),xp(d,c),c=bp(d,c)|0,n[B>>2]=n[k>>2],sw[s&15](m,B,c),c=WMe(m)|0,bu(m),kp(d),C=f,c|0}function jMe(s,l){s=s|0,l=l|0}function GMe(s,l,c){s=s|0,l=l|0,c=c|0,YMe(s,c)}function WMe(s){return s=s|0,ys(s)|0}function YMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;d=C,C=C+16|0,c=d,f=l,f&1?(VMe(c,0),ia(f|0,c|0)|0,KMe(s,c),JMe(c)):n[s>>2]=n[l>>2],C=d}function VMe(s,l){s=s|0,l=l|0,Fc(s,l),n[s+4>>2]=0,o[s+8>>0]=0}function KMe(s,l){s=s|0,l=l|0,n[s>>2]=n[l+4>>2]}function JMe(s){s=s|0,o[s+8>>0]=0}function zMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=tT()|0,s=XMe(c)|0,yn(m,l,d,s,ZMe(c,f)|0,f)}function tT(){var s=0,l=0;if(o[8064]|0||(k7(10968),pr(68,10968,U|0)|0,l=8064,n[l>>2]=1,n[l+4>>2]=0),!(Nr(10968)|0)){s=10968,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));k7(10968)}return 10968}function XMe(s){return s=s|0,s|0}function ZMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=tT()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(b7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):($Me(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function b7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function $Me(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=e4e(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,t4e(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,b7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,r4e(s,d),n4e(d),C=k;return}}function e4e(s){return s=s|0,536870911}function t4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function r4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function n4e(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function k7(s){s=s|0,o4e(s)}function i4e(s){s=s|0,s4e(s+24|0)}function s4e(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function o4e(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,1,l,a4e()|0,5),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function a4e(){return 1872}function l4e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,u4e(n[(c4e(s)|0)>>2]|0,l,c,f,d,m)}function c4e(s){return s=s|0,(n[(tT()|0)+24>>2]|0)+(s<<3)|0}function u4e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,F=0,M=0,O=0,j=0;B=C,C=C+32|0,k=B+16|0,F=B+12|0,M=B+8|0,O=B+4|0,j=B,xp(k,l),l=bp(k,l)|0,xp(F,c),c=bp(F,c)|0,xp(M,f),f=bp(M,f)|0,xp(O,d),d=bp(O,d)|0,xp(j,m),m=bp(j,m)|0,Z7[s&1](l,c,f,d,m),kp(j),kp(O),kp(M),kp(F),kp(k),C=B}function A4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=rT()|0,s=f4e(c)|0,yn(m,l,d,s,p4e(c,f)|0,f)}function rT(){var s=0,l=0;if(o[8072]|0||(F7(11004),pr(69,11004,U|0)|0,l=8072,n[l>>2]=1,n[l+4>>2]=0),!(Nr(11004)|0)){s=11004,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));F7(11004)}return 11004}function f4e(s){return s=s|0,s|0}function p4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,F=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,F=rT()|0,B=F+24|0,l=dr(l,4)|0,n[m>>2]=l,c=F+28|0,f=n[c>>2]|0,f>>>0<(n[F+32>>2]|0)>>>0?(Q7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(h4e(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function Q7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function h4e(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=g4e(s)|0,f>>>0>>0)Zr(s);else{F=n[s>>2]|0,O=(n[s+8>>2]|0)-F|0,M=O>>2,d4e(d,O>>3>>>0>>1>>>0?M>>>0>>0?B:M:f,(n[m>>2]|0)-F>>3,s+8|0),B=d+8|0,Q7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,m4e(s,d),y4e(d),C=k;return}}function g4e(s){return s=s|0,536870911}function d4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Yt(l<<3)|0;break}else d=0;while(!1);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function m4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(br(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function y4e(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&&yt(s)}function F7(s){s=s|0,I4e(s)}function E4e(s){s=s|0,C4e(s+24|0)}function C4e(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function I4e(s){s=s|0;var l=0;l=Jr()|0,zr(s,1,12,l,w4e()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function w4e(){return 1896}function B4e(s,l,c){s=s|0,l=l|0,c=c|0,D4e(n[(v4e(s)|0)>>2]|0,l,c)}function v4e(s){return s=s|0,(n[(rT()|0)+24>>2]|0)+(s<<3)|0}function D4e(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;f=C,C=C+16|0,m=f+4|0,d=f,S4e(m,l),l=P4e(m,l)|0,xp(d,c),c=bp(d,c)|0,tf[s&31](l,c),kp(d),C=f}function S4e(s,l){s=s|0,l=l|0}function P4e(s,l){return s=s|0,l=l|0,x4e(l)|0}function x4e(s){return s=s|0,s|0}function b4e(){var s=0;return o[8080]|0||(R7(11040),pr(70,11040,U|0)|0,s=8080,n[s>>2]=1,n[s+4>>2]=0),Nr(11040)|0||R7(11040),11040}function R7(s){s=s|0,F4e(s),L0(s,71)}function k4e(s){s=s|0,Q4e(s+24|0)}function Q4e(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),yt(c))}function F4e(s){s=s|0;var l=0;l=Jr()|0,zr(s,5,7,l,N4e()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function R4e(s){s=s|0,T4e(s)}function T4e(s){s=s|0,L4e(s)}function L4e(s){s=s|0,o[s+8>>0]=1}function N4e(){return 1936}function O4e(){return M4e()|0}function M4e(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0;return l=C,C=C+16|0,d=l+4|0,B=l,c=Za(8)|0,s=c,m=s+4|0,n[m>>2]=Yt(1)|0,f=Yt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],U4e(f,m,d),n[c>>2]=f,C=l,s|0}function U4e(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Yt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1916,n[c+12>>2]=l,n[s+4>>2]=c}function _4e(s){s=s|0,im(s),yt(s)}function H4e(s){s=s|0,s=n[s+12>>2]|0,s|0&&yt(s)}function q4e(s){s=s|0,yt(s)}function j4e(){var s=0;return o[8088]|0||(z4e(11076),pr(25,11076,U|0)|0,s=8088,n[s>>2]=1,n[s+4>>2]=0),11076}function G4e(s,l){s=s|0,l=l|0,n[s>>2]=W4e()|0,n[s+4>>2]=Y4e()|0,n[s+12>>2]=l,n[s+8>>2]=V4e()|0,n[s+32>>2]=10}function W4e(){return 11745}function Y4e(){return 1940}function V4e(){return TD()|0}function K4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Qp(f,896)|0)==512?c|0&&(J4e(c),yt(c)):l|0&&yt(l)}function J4e(s){s=s|0,s=n[s+4>>2]|0,s|0&&Rp(s)}function z4e(s){s=s|0,Pp(s)}function Tc(s,l){s=s|0,l=l|0,n[s>>2]=l}function nT(s){return s=s|0,n[s>>2]|0}function X4e(s){return s=s|0,o[n[s>>2]>>0]|0}function Z4e(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,n[f>>2]=n[s>>2],$4e(l,f)|0,C=c}function $4e(s,l){s=s|0,l=l|0;var c=0;return c=eUe(n[s>>2]|0,l)|0,l=s+4|0,n[(n[l>>2]|0)+8>>2]=c,n[(n[l>>2]|0)+8>>2]|0}function eUe(s,l){s=s|0,l=l|0;var c=0,f=0;return c=C,C=C+16|0,f=c,$a(f),s=ys(s)|0,l=tUe(s,n[l>>2]|0)|0,el(f),C=c,l|0}function $a(s){s=s|0,n[s>>2]=n[2701],n[s+4>>2]=n[2703]}function tUe(s,l){s=s|0,l=l|0;var c=0;return c=jo(rUe()|0)|0,un(0,c|0,s|0,zR(l)|0)|0}function el(s){s=s|0,w7(n[s>>2]|0,n[s+4>>2]|0)}function rUe(){var s=0;return o[8096]|0||(nUe(11120),s=8096,n[s>>2]=1,n[s+4>>2]=0),11120}function nUe(s){s=s|0,ao(s,iUe()|0,1)}function iUe(){return 1948}function sUe(){oUe()}function oUe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0;if(Oe=C,C=C+16|0,O=Oe+4|0,j=Oe,Ro(65536,10804,n[2702]|0,10812),c=n7()|0,l=n[c>>2]|0,s=n[l>>2]|0,s|0)for(f=n[c+8>>2]|0,c=n[c+4>>2]|0;du(s|0,u[c>>0]|0|0,o[f>>0]|0),l=l+4|0,s=n[l>>2]|0,s;)f=f+1|0,c=c+1|0;if(s=i7()|0,l=n[s>>2]|0,l|0)do QA(l|0,n[s+4>>2]|0),s=s+8|0,l=n[s>>2]|0;while(l|0);QA(aUe()|0,5167),M=$d()|0,s=n[M>>2]|0;e:do if(s|0){do lUe(n[s+4>>2]|0),s=n[s>>2]|0;while(s|0);if(s=n[M>>2]|0,s|0){F=M;do{for(;d=s,s=n[s>>2]|0,d=n[d+4>>2]|0,!!(cUe(d)|0);)if(n[j>>2]=F,n[O>>2]=n[j>>2],uUe(M,O)|0,!s)break e;if(AUe(d),F=n[F>>2]|0,l=T7(d)|0,m=Bi()|0,B=C,C=C+((1*(l<<2)|0)+15&-16)|0,k=C,C=C+((1*(l<<2)|0)+15&-16)|0,l=n[(d7(d)|0)>>2]|0,l|0)for(c=B,f=k;n[c>>2]=n[(em(n[l+4>>2]|0)|0)>>2],n[f>>2]=n[l+8>>2],l=n[l>>2]|0,l;)c=c+4|0,f=f+4|0;Qe=em(d)|0,l=fUe(d)|0,c=T7(d)|0,f=pUe(d)|0,Il(Qe|0,l|0,B|0,k|0,c|0,f|0,GR(d)|0),kA(m|0)}while(s|0)}}while(!1);if(s=n[(WR()|0)>>2]|0,s|0)do Qe=s+4|0,M=YR(Qe)|0,d=tw(M)|0,m=$I(M)|0,B=(ew(M)|0)+1|0,k=UD(M)|0,F=L7(Qe)|0,M=Nr(M)|0,O=ND(Qe)|0,j=iT(Qe)|0,mc(0,d|0,m|0,B|0,k|0,F|0,M|0,O|0,j|0,sT(Qe)|0),s=n[s>>2]|0;while(s|0);s=n[($d()|0)>>2]|0;e:do if(s|0){t:for(;;){if(l=n[s+4>>2]|0,l|0&&(oe=n[(em(l)|0)>>2]|0,We=n[(m7(l)|0)>>2]|0,We|0)){c=We;do{l=c+4|0,f=YR(l)|0;r:do if(f|0)switch(Nr(f)|0){case 0:break t;case 4:case 3:case 2:{k=tw(f)|0,F=$I(f)|0,M=(ew(f)|0)+1|0,O=UD(f)|0,j=Nr(f)|0,Qe=ND(l)|0,mc(oe|0,k|0,F|0,M|0,O|0,0,j|0,Qe|0,iT(l)|0,sT(l)|0);break r}case 1:{B=tw(f)|0,k=$I(f)|0,F=(ew(f)|0)+1|0,M=UD(f)|0,O=L7(l)|0,j=Nr(f)|0,Qe=ND(l)|0,mc(oe|0,B|0,k|0,F|0,M|0,O|0,j|0,Qe|0,iT(l)|0,sT(l)|0);break r}case 5:{M=tw(f)|0,O=$I(f)|0,j=(ew(f)|0)+1|0,Qe=UD(f)|0,mc(oe|0,M|0,O|0,j|0,Qe|0,hUe(f)|0,Nr(f)|0,0,0,0);break r}default:break r}while(!1);c=n[c>>2]|0}while(c|0)}if(s=n[s>>2]|0,!s)break e}Tt()}while(!1);we(),C=Oe}function aUe(){return 11703}function lUe(s){s=s|0,o[s+40>>0]=0}function cUe(s){return s=s|0,(o[s+40>>0]|0)!=0|0}function uUe(s,l){return s=s|0,l=l|0,l=gUe(l)|0,s=n[l>>2]|0,n[l>>2]=n[s>>2],yt(s),n[l>>2]|0}function AUe(s){s=s|0,o[s+40>>0]=1}function T7(s){return s=s|0,n[s+20>>2]|0}function fUe(s){return s=s|0,n[s+8>>2]|0}function pUe(s){return s=s|0,n[s+32>>2]|0}function UD(s){return s=s|0,n[s+4>>2]|0}function L7(s){return s=s|0,n[s+4>>2]|0}function iT(s){return s=s|0,n[s+8>>2]|0}function sT(s){return s=s|0,n[s+16>>2]|0}function hUe(s){return s=s|0,n[s+20>>2]|0}function gUe(s){return s=s|0,n[s>>2]|0}function _D(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0,rt=0,Xe=0,ct=0,_e=0,Ge=0,Nt=0;Nt=C,C=C+16|0,oe=Nt;do if(s>>>0<245){if(M=s>>>0<11?16:s+11&-8,s=M>>>3,j=n[2783]|0,c=j>>>s,c&3|0)return l=(c&1^1)+s|0,s=11172+(l<<1<<2)|0,c=s+8|0,f=n[c>>2]|0,d=f+8|0,m=n[d>>2]|0,(s|0)==(m|0)?n[2783]=j&~(1<>2]=s,n[c>>2]=m),Ge=l<<3,n[f+4>>2]=Ge|3,Ge=f+Ge+4|0,n[Ge>>2]=n[Ge>>2]|1,Ge=d,C=Nt,Ge|0;if(O=n[2785]|0,M>>>0>O>>>0){if(c|0)return l=2<>>12&16,l=l>>>B,c=l>>>5&8,l=l>>>c,d=l>>>2&4,l=l>>>d,s=l>>>1&2,l=l>>>s,f=l>>>1&1,f=(c|B|d|s|f)+(l>>>f)|0,l=11172+(f<<1<<2)|0,s=l+8|0,d=n[s>>2]|0,B=d+8|0,c=n[B>>2]|0,(l|0)==(c|0)?(s=j&~(1<>2]=l,n[s>>2]=c,s=j),m=(f<<3)-M|0,n[d+4>>2]=M|3,f=d+M|0,n[f+4>>2]=m|1,n[f+m>>2]=m,O|0&&(d=n[2788]|0,l=O>>>3,c=11172+(l<<1<<2)|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=d,n[l+12>>2]=d,n[d+8>>2]=l,n[d+12>>2]=c),n[2785]=m,n[2788]=f,Ge=B,C=Nt,Ge|0;if(k=n[2784]|0,k){if(c=(k&0-k)+-1|0,B=c>>>12&16,c=c>>>B,m=c>>>5&8,c=c>>>m,F=c>>>2&4,c=c>>>F,f=c>>>1&2,c=c>>>f,s=c>>>1&1,s=n[11436+((m|B|F|f|s)+(c>>>s)<<2)>>2]|0,c=(n[s+4>>2]&-8)-M|0,f=n[s+16+(((n[s+16>>2]|0)==0&1)<<2)>>2]|0,!f)F=s,m=c;else{do B=(n[f+4>>2]&-8)-M|0,F=B>>>0>>0,c=F?B:c,s=F?f:s,f=n[f+16+(((n[f+16>>2]|0)==0&1)<<2)>>2]|0;while(f|0);F=s,m=c}if(B=F+M|0,F>>>0>>0){d=n[F+24>>2]|0,l=n[F+12>>2]|0;do if((l|0)==(F|0)){if(s=F+20|0,l=n[s>>2]|0,!l&&(s=F+16|0,l=n[s>>2]|0,!l)){c=0;break}for(;;){if(c=l+20|0,f=n[c>>2]|0,f|0){l=f,s=c;continue}if(c=l+16|0,f=n[c>>2]|0,f)l=f,s=c;else break}n[s>>2]=0,c=l}else c=n[F+8>>2]|0,n[c+12>>2]=l,n[l+8>>2]=c,c=l;while(!1);do if(d|0){if(l=n[F+28>>2]|0,s=11436+(l<<2)|0,(F|0)==(n[s>>2]|0)){if(n[s>>2]=c,!c){n[2784]=k&~(1<>2]|0)!=(F|0)&1)<<2)>>2]=c,!c)break;n[c+24>>2]=d,l=n[F+16>>2]|0,l|0&&(n[c+16>>2]=l,n[l+24>>2]=c),l=n[F+20>>2]|0,l|0&&(n[c+20>>2]=l,n[l+24>>2]=c)}while(!1);return m>>>0<16?(Ge=m+M|0,n[F+4>>2]=Ge|3,Ge=F+Ge+4|0,n[Ge>>2]=n[Ge>>2]|1):(n[F+4>>2]=M|3,n[B+4>>2]=m|1,n[B+m>>2]=m,O|0&&(f=n[2788]|0,l=O>>>3,c=11172+(l<<1<<2)|0,l=1<>2]|0):(n[2783]=j|l,l=c,s=c+8|0),n[s>>2]=f,n[l+12>>2]=f,n[f+8>>2]=l,n[f+12>>2]=c),n[2785]=m,n[2788]=B),Ge=F+8|0,C=Nt,Ge|0}else j=M}else j=M}else j=M}else if(s>>>0<=4294967231)if(s=s+11|0,M=s&-8,F=n[2784]|0,F){f=0-M|0,s=s>>>8,s?M>>>0>16777215?k=31:(j=(s+1048320|0)>>>16&8,_e=s<>>16&4,_e=_e<>>16&2,k=14-(O|j|k)+(_e<>>15)|0,k=M>>>(k+7|0)&1|k<<1):k=0,c=n[11436+(k<<2)>>2]|0;e:do if(!c)c=0,s=0,_e=57;else for(s=0,B=M<<((k|0)==31?0:25-(k>>>1)|0),m=0;;){if(d=(n[c+4>>2]&-8)-M|0,d>>>0>>0)if(d)s=c,f=d;else{s=c,f=0,d=c,_e=61;break e}if(d=n[c+20>>2]|0,c=n[c+16+(B>>>31<<2)>>2]|0,m=(d|0)==0|(d|0)==(c|0)?m:d,d=(c|0)==0,d){c=m,_e=57;break}else B=B<<((d^1)&1)}while(!1);if((_e|0)==57){if((c|0)==0&(s|0)==0){if(s=2<>>12&16,j=j>>>B,m=j>>>5&8,j=j>>>m,k=j>>>2&4,j=j>>>k,O=j>>>1&2,j=j>>>O,c=j>>>1&1,s=0,c=n[11436+((m|B|k|O|c)+(j>>>c)<<2)>>2]|0}c?(d=c,_e=61):(k=s,B=f)}if((_e|0)==61)for(;;)if(_e=0,c=(n[d+4>>2]&-8)-M|0,j=c>>>0>>0,c=j?c:f,s=j?d:s,d=n[d+16+(((n[d+16>>2]|0)==0&1)<<2)>>2]|0,d)f=c,_e=61;else{k=s,B=c;break}if(k|0&&B>>>0<((n[2785]|0)-M|0)>>>0){if(m=k+M|0,k>>>0>=m>>>0)return Ge=0,C=Nt,Ge|0;d=n[k+24>>2]|0,l=n[k+12>>2]|0;do if((l|0)==(k|0)){if(s=k+20|0,l=n[s>>2]|0,!l&&(s=k+16|0,l=n[s>>2]|0,!l)){l=0;break}for(;;){if(c=l+20|0,f=n[c>>2]|0,f|0){l=f,s=c;continue}if(c=l+16|0,f=n[c>>2]|0,f)l=f,s=c;else break}n[s>>2]=0}else Ge=n[k+8>>2]|0,n[Ge+12>>2]=l,n[l+8>>2]=Ge;while(!1);do if(d){if(s=n[k+28>>2]|0,c=11436+(s<<2)|0,(k|0)==(n[c>>2]|0)){if(n[c>>2]=l,!l){f=F&~(1<>2]|0)!=(k|0)&1)<<2)>>2]=l,!l){f=F;break}n[l+24>>2]=d,s=n[k+16>>2]|0,s|0&&(n[l+16>>2]=s,n[s+24>>2]=l),s=n[k+20>>2]|0,s&&(n[l+20>>2]=s,n[s+24>>2]=l),f=F}else f=F;while(!1);do if(B>>>0>=16){if(n[k+4>>2]=M|3,n[m+4>>2]=B|1,n[m+B>>2]=B,l=B>>>3,B>>>0<256){c=11172+(l<<1<<2)|0,s=n[2783]|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=m,n[l+12>>2]=m,n[m+8>>2]=l,n[m+12>>2]=c;break}if(l=B>>>8,l?B>>>0>16777215?l=31:(_e=(l+1048320|0)>>>16&8,Ge=l<<_e,ct=(Ge+520192|0)>>>16&4,Ge=Ge<>>16&2,l=14-(ct|_e|l)+(Ge<>>15)|0,l=B>>>(l+7|0)&1|l<<1):l=0,c=11436+(l<<2)|0,n[m+28>>2]=l,s=m+16|0,n[s+4>>2]=0,n[s>>2]=0,s=1<>2]=m,n[m+24>>2]=c,n[m+12>>2]=m,n[m+8>>2]=m;break}for(s=B<<((l|0)==31?0:25-(l>>>1)|0),c=n[c>>2]|0;;){if((n[c+4>>2]&-8|0)==(B|0)){_e=97;break}if(f=c+16+(s>>>31<<2)|0,l=n[f>>2]|0,l)s=s<<1,c=l;else{_e=96;break}}if((_e|0)==96){n[f>>2]=m,n[m+24>>2]=c,n[m+12>>2]=m,n[m+8>>2]=m;break}else if((_e|0)==97){_e=c+8|0,Ge=n[_e>>2]|0,n[Ge+12>>2]=m,n[_e>>2]=m,n[m+8>>2]=Ge,n[m+12>>2]=c,n[m+24>>2]=0;break}}else Ge=B+M|0,n[k+4>>2]=Ge|3,Ge=k+Ge+4|0,n[Ge>>2]=n[Ge>>2]|1;while(!1);return Ge=k+8|0,C=Nt,Ge|0}else j=M}else j=M;else j=-1;while(!1);if(c=n[2785]|0,c>>>0>=j>>>0)return l=c-j|0,s=n[2788]|0,l>>>0>15?(Ge=s+j|0,n[2788]=Ge,n[2785]=l,n[Ge+4>>2]=l|1,n[Ge+l>>2]=l,n[s+4>>2]=j|3):(n[2785]=0,n[2788]=0,n[s+4>>2]=c|3,Ge=s+c+4|0,n[Ge>>2]=n[Ge>>2]|1),Ge=s+8|0,C=Nt,Ge|0;if(B=n[2786]|0,B>>>0>j>>>0)return ct=B-j|0,n[2786]=ct,Ge=n[2789]|0,_e=Ge+j|0,n[2789]=_e,n[_e+4>>2]=ct|1,n[Ge+4>>2]=j|3,Ge=Ge+8|0,C=Nt,Ge|0;if(n[2901]|0?s=n[2903]|0:(n[2903]=4096,n[2902]=4096,n[2904]=-1,n[2905]=-1,n[2906]=0,n[2894]=0,s=oe&-16^1431655768,n[oe>>2]=s,n[2901]=s,s=4096),k=j+48|0,F=j+47|0,m=s+F|0,d=0-s|0,M=m&d,M>>>0<=j>>>0||(s=n[2893]|0,s|0&&(O=n[2891]|0,oe=O+M|0,oe>>>0<=O>>>0|oe>>>0>s>>>0)))return Ge=0,C=Nt,Ge|0;e:do if(n[2894]&4)l=0,_e=133;else{c=n[2789]|0;t:do if(c){for(f=11580;s=n[f>>2]|0,!(s>>>0<=c>>>0&&(Qe=f+4|0,(s+(n[Qe>>2]|0)|0)>>>0>c>>>0));)if(s=n[f+8>>2]|0,s)f=s;else{_e=118;break t}if(l=m-B&d,l>>>0<2147483647)if(s=Tp(l|0)|0,(s|0)==((n[f>>2]|0)+(n[Qe>>2]|0)|0)){if((s|0)!=-1){B=l,m=s,_e=135;break e}}else f=s,_e=126;else l=0}else _e=118;while(!1);do if((_e|0)==118)if(c=Tp(0)|0,(c|0)!=-1&&(l=c,We=n[2902]|0,Oe=We+-1|0,l=(Oe&l|0?(Oe+l&0-We)-l|0:0)+M|0,We=n[2891]|0,Oe=l+We|0,l>>>0>j>>>0&l>>>0<2147483647)){if(Qe=n[2893]|0,Qe|0&&Oe>>>0<=We>>>0|Oe>>>0>Qe>>>0){l=0;break}if(s=Tp(l|0)|0,(s|0)==(c|0)){B=l,m=c,_e=135;break e}else f=s,_e=126}else l=0;while(!1);do if((_e|0)==126){if(c=0-l|0,!(k>>>0>l>>>0&(l>>>0<2147483647&(f|0)!=-1)))if((f|0)==-1){l=0;break}else{B=l,m=f,_e=135;break e}if(s=n[2903]|0,s=F-l+s&0-s,s>>>0>=2147483647){B=l,m=f,_e=135;break e}if((Tp(s|0)|0)==-1){Tp(c|0)|0,l=0;break}else{B=s+l|0,m=f,_e=135;break e}}while(!1);n[2894]=n[2894]|4,_e=133}while(!1);if((_e|0)==133&&M>>>0<2147483647&&(ct=Tp(M|0)|0,Qe=Tp(0)|0,rt=Qe-ct|0,Xe=rt>>>0>(j+40|0)>>>0,!((ct|0)==-1|Xe^1|ct>>>0>>0&((ct|0)!=-1&(Qe|0)!=-1)^1))&&(B=Xe?rt:l,m=ct,_e=135),(_e|0)==135){l=(n[2891]|0)+B|0,n[2891]=l,l>>>0>(n[2892]|0)>>>0&&(n[2892]=l),F=n[2789]|0;do if(F){for(l=11580;;){if(s=n[l>>2]|0,c=l+4|0,f=n[c>>2]|0,(m|0)==(s+f|0)){_e=145;break}if(d=n[l+8>>2]|0,d)l=d;else break}if((_e|0)==145&&!(n[l+12>>2]&8|0)&&F>>>0>>0&F>>>0>=s>>>0){n[c>>2]=f+B,Ge=F+8|0,Ge=Ge&7|0?0-Ge&7:0,_e=F+Ge|0,Ge=(n[2786]|0)+(B-Ge)|0,n[2789]=_e,n[2786]=Ge,n[_e+4>>2]=Ge|1,n[_e+Ge+4>>2]=40,n[2790]=n[2905];break}for(m>>>0<(n[2787]|0)>>>0&&(n[2787]=m),c=m+B|0,l=11580;;){if((n[l>>2]|0)==(c|0)){_e=153;break}if(s=n[l+8>>2]|0,s)l=s;else break}if((_e|0)==153&&!(n[l+12>>2]&8|0)){n[l>>2]=m,O=l+4|0,n[O>>2]=(n[O>>2]|0)+B,O=m+8|0,O=m+(O&7|0?0-O&7:0)|0,l=c+8|0,l=c+(l&7|0?0-l&7:0)|0,M=O+j|0,k=l-O-j|0,n[O+4>>2]=j|3;do if((l|0)!=(F|0)){if((l|0)==(n[2788]|0)){Ge=(n[2785]|0)+k|0,n[2785]=Ge,n[2788]=M,n[M+4>>2]=Ge|1,n[M+Ge>>2]=Ge;break}if(s=n[l+4>>2]|0,(s&3|0)==1){B=s&-8,f=s>>>3;e:do if(s>>>0<256)if(s=n[l+8>>2]|0,c=n[l+12>>2]|0,(c|0)==(s|0)){n[2783]=n[2783]&~(1<>2]=c,n[c+8>>2]=s;break}else{m=n[l+24>>2]|0,s=n[l+12>>2]|0;do if((s|0)==(l|0)){if(f=l+16|0,c=f+4|0,s=n[c>>2]|0,!s)if(s=n[f>>2]|0,s)c=f;else{s=0;break}for(;;){if(f=s+20|0,d=n[f>>2]|0,d|0){s=d,c=f;continue}if(f=s+16|0,d=n[f>>2]|0,d)s=d,c=f;else break}n[c>>2]=0}else Ge=n[l+8>>2]|0,n[Ge+12>>2]=s,n[s+8>>2]=Ge;while(!1);if(!m)break;c=n[l+28>>2]|0,f=11436+(c<<2)|0;do if((l|0)!=(n[f>>2]|0)){if(n[m+16+(((n[m+16>>2]|0)!=(l|0)&1)<<2)>>2]=s,!s)break e}else{if(n[f>>2]=s,s|0)break;n[2784]=n[2784]&~(1<>2]=m,c=l+16|0,f=n[c>>2]|0,f|0&&(n[s+16>>2]=f,n[f+24>>2]=s),c=n[c+4>>2]|0,!c)break;n[s+20>>2]=c,n[c+24>>2]=s}while(!1);l=l+B|0,d=B+k|0}else d=k;if(l=l+4|0,n[l>>2]=n[l>>2]&-2,n[M+4>>2]=d|1,n[M+d>>2]=d,l=d>>>3,d>>>0<256){c=11172+(l<<1<<2)|0,s=n[2783]|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=M,n[l+12>>2]=M,n[M+8>>2]=l,n[M+12>>2]=c;break}l=d>>>8;do if(!l)l=0;else{if(d>>>0>16777215){l=31;break}_e=(l+1048320|0)>>>16&8,Ge=l<<_e,ct=(Ge+520192|0)>>>16&4,Ge=Ge<>>16&2,l=14-(ct|_e|l)+(Ge<>>15)|0,l=d>>>(l+7|0)&1|l<<1}while(!1);if(f=11436+(l<<2)|0,n[M+28>>2]=l,s=M+16|0,n[s+4>>2]=0,n[s>>2]=0,s=n[2784]|0,c=1<>2]=M,n[M+24>>2]=f,n[M+12>>2]=M,n[M+8>>2]=M;break}for(s=d<<((l|0)==31?0:25-(l>>>1)|0),c=n[f>>2]|0;;){if((n[c+4>>2]&-8|0)==(d|0)){_e=194;break}if(f=c+16+(s>>>31<<2)|0,l=n[f>>2]|0,l)s=s<<1,c=l;else{_e=193;break}}if((_e|0)==193){n[f>>2]=M,n[M+24>>2]=c,n[M+12>>2]=M,n[M+8>>2]=M;break}else if((_e|0)==194){_e=c+8|0,Ge=n[_e>>2]|0,n[Ge+12>>2]=M,n[_e>>2]=M,n[M+8>>2]=Ge,n[M+12>>2]=c,n[M+24>>2]=0;break}}else Ge=(n[2786]|0)+k|0,n[2786]=Ge,n[2789]=M,n[M+4>>2]=Ge|1;while(!1);return Ge=O+8|0,C=Nt,Ge|0}for(l=11580;s=n[l>>2]|0,!(s>>>0<=F>>>0&&(Ge=s+(n[l+4>>2]|0)|0,Ge>>>0>F>>>0));)l=n[l+8>>2]|0;d=Ge+-47|0,s=d+8|0,s=d+(s&7|0?0-s&7:0)|0,d=F+16|0,s=s>>>0>>0?F:s,l=s+8|0,c=m+8|0,c=c&7|0?0-c&7:0,_e=m+c|0,c=B+-40-c|0,n[2789]=_e,n[2786]=c,n[_e+4>>2]=c|1,n[_e+c+4>>2]=40,n[2790]=n[2905],c=s+4|0,n[c>>2]=27,n[l>>2]=n[2895],n[l+4>>2]=n[2896],n[l+8>>2]=n[2897],n[l+12>>2]=n[2898],n[2895]=m,n[2896]=B,n[2898]=0,n[2897]=l,l=s+24|0;do _e=l,l=l+4|0,n[l>>2]=7;while((_e+8|0)>>>0>>0);if((s|0)!=(F|0)){if(m=s-F|0,n[c>>2]=n[c>>2]&-2,n[F+4>>2]=m|1,n[s>>2]=m,l=m>>>3,m>>>0<256){c=11172+(l<<1<<2)|0,s=n[2783]|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=F,n[l+12>>2]=F,n[F+8>>2]=l,n[F+12>>2]=c;break}if(l=m>>>8,l?m>>>0>16777215?c=31:(_e=(l+1048320|0)>>>16&8,Ge=l<<_e,ct=(Ge+520192|0)>>>16&4,Ge=Ge<>>16&2,c=14-(ct|_e|c)+(Ge<>>15)|0,c=m>>>(c+7|0)&1|c<<1):c=0,f=11436+(c<<2)|0,n[F+28>>2]=c,n[F+20>>2]=0,n[d>>2]=0,l=n[2784]|0,s=1<>2]=F,n[F+24>>2]=f,n[F+12>>2]=F,n[F+8>>2]=F;break}for(s=m<<((c|0)==31?0:25-(c>>>1)|0),c=n[f>>2]|0;;){if((n[c+4>>2]&-8|0)==(m|0)){_e=216;break}if(f=c+16+(s>>>31<<2)|0,l=n[f>>2]|0,l)s=s<<1,c=l;else{_e=215;break}}if((_e|0)==215){n[f>>2]=F,n[F+24>>2]=c,n[F+12>>2]=F,n[F+8>>2]=F;break}else if((_e|0)==216){_e=c+8|0,Ge=n[_e>>2]|0,n[Ge+12>>2]=F,n[_e>>2]=F,n[F+8>>2]=Ge,n[F+12>>2]=c,n[F+24>>2]=0;break}}}else{Ge=n[2787]|0,(Ge|0)==0|m>>>0>>0&&(n[2787]=m),n[2895]=m,n[2896]=B,n[2898]=0,n[2792]=n[2901],n[2791]=-1,l=0;do Ge=11172+(l<<1<<2)|0,n[Ge+12>>2]=Ge,n[Ge+8>>2]=Ge,l=l+1|0;while((l|0)!=32);Ge=m+8|0,Ge=Ge&7|0?0-Ge&7:0,_e=m+Ge|0,Ge=B+-40-Ge|0,n[2789]=_e,n[2786]=Ge,n[_e+4>>2]=Ge|1,n[_e+Ge+4>>2]=40,n[2790]=n[2905]}while(!1);if(l=n[2786]|0,l>>>0>j>>>0)return ct=l-j|0,n[2786]=ct,Ge=n[2789]|0,_e=Ge+j|0,n[2789]=_e,n[_e+4>>2]=ct|1,n[Ge+4>>2]=j|3,Ge=Ge+8|0,C=Nt,Ge|0}return n[(rm()|0)>>2]=12,Ge=0,C=Nt,Ge|0}function HD(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,F=0;if(s){c=s+-8|0,d=n[2787]|0,s=n[s+-4>>2]|0,l=s&-8,F=c+l|0;do if(s&1)k=c,B=c;else{if(f=n[c>>2]|0,!(s&3)||(B=c+(0-f)|0,m=f+l|0,B>>>0>>0))return;if((B|0)==(n[2788]|0)){if(s=F+4|0,l=n[s>>2]|0,(l&3|0)!=3){k=B,l=m;break}n[2785]=m,n[s>>2]=l&-2,n[B+4>>2]=m|1,n[B+m>>2]=m;return}if(c=f>>>3,f>>>0<256)if(s=n[B+8>>2]|0,l=n[B+12>>2]|0,(l|0)==(s|0)){n[2783]=n[2783]&~(1<>2]=l,n[l+8>>2]=s,k=B,l=m;break}d=n[B+24>>2]|0,s=n[B+12>>2]|0;do if((s|0)==(B|0)){if(c=B+16|0,l=c+4|0,s=n[l>>2]|0,!s)if(s=n[c>>2]|0,s)l=c;else{s=0;break}for(;;){if(c=s+20|0,f=n[c>>2]|0,f|0){s=f,l=c;continue}if(c=s+16|0,f=n[c>>2]|0,f)s=f,l=c;else break}n[l>>2]=0}else k=n[B+8>>2]|0,n[k+12>>2]=s,n[s+8>>2]=k;while(!1);if(d){if(l=n[B+28>>2]|0,c=11436+(l<<2)|0,(B|0)==(n[c>>2]|0)){if(n[c>>2]=s,!s){n[2784]=n[2784]&~(1<>2]|0)!=(B|0)&1)<<2)>>2]=s,!s){k=B,l=m;break}n[s+24>>2]=d,l=B+16|0,c=n[l>>2]|0,c|0&&(n[s+16>>2]=c,n[c+24>>2]=s),l=n[l+4>>2]|0,l?(n[s+20>>2]=l,n[l+24>>2]=s,k=B,l=m):(k=B,l=m)}else k=B,l=m}while(!1);if(!(B>>>0>=F>>>0)&&(s=F+4|0,f=n[s>>2]|0,!!(f&1))){if(f&2)n[s>>2]=f&-2,n[k+4>>2]=l|1,n[B+l>>2]=l,d=l;else{if(s=n[2788]|0,(F|0)==(n[2789]|0)){if(F=(n[2786]|0)+l|0,n[2786]=F,n[2789]=k,n[k+4>>2]=F|1,(k|0)!=(s|0))return;n[2788]=0,n[2785]=0;return}if((F|0)==(s|0)){F=(n[2785]|0)+l|0,n[2785]=F,n[2788]=B,n[k+4>>2]=F|1,n[B+F>>2]=F;return}d=(f&-8)+l|0,c=f>>>3;do if(f>>>0<256)if(l=n[F+8>>2]|0,s=n[F+12>>2]|0,(s|0)==(l|0)){n[2783]=n[2783]&~(1<>2]=s,n[s+8>>2]=l;break}else{m=n[F+24>>2]|0,s=n[F+12>>2]|0;do if((s|0)==(F|0)){if(c=F+16|0,l=c+4|0,s=n[l>>2]|0,!s)if(s=n[c>>2]|0,s)l=c;else{c=0;break}for(;;){if(c=s+20|0,f=n[c>>2]|0,f|0){s=f,l=c;continue}if(c=s+16|0,f=n[c>>2]|0,f)s=f,l=c;else break}n[l>>2]=0,c=s}else c=n[F+8>>2]|0,n[c+12>>2]=s,n[s+8>>2]=c,c=s;while(!1);if(m|0){if(s=n[F+28>>2]|0,l=11436+(s<<2)|0,(F|0)==(n[l>>2]|0)){if(n[l>>2]=c,!c){n[2784]=n[2784]&~(1<>2]|0)!=(F|0)&1)<<2)>>2]=c,!c)break;n[c+24>>2]=m,s=F+16|0,l=n[s>>2]|0,l|0&&(n[c+16>>2]=l,n[l+24>>2]=c),s=n[s+4>>2]|0,s|0&&(n[c+20>>2]=s,n[s+24>>2]=c)}}while(!1);if(n[k+4>>2]=d|1,n[B+d>>2]=d,(k|0)==(n[2788]|0)){n[2785]=d;return}}if(s=d>>>3,d>>>0<256){c=11172+(s<<1<<2)|0,l=n[2783]|0,s=1<>2]|0):(n[2783]=l|s,s=c,l=c+8|0),n[l>>2]=k,n[s+12>>2]=k,n[k+8>>2]=s,n[k+12>>2]=c;return}s=d>>>8,s?d>>>0>16777215?s=31:(B=(s+1048320|0)>>>16&8,F=s<>>16&4,F=F<>>16&2,s=14-(m|B|s)+(F<>>15)|0,s=d>>>(s+7|0)&1|s<<1):s=0,f=11436+(s<<2)|0,n[k+28>>2]=s,n[k+20>>2]=0,n[k+16>>2]=0,l=n[2784]|0,c=1<>>1)|0),c=n[f>>2]|0;;){if((n[c+4>>2]&-8|0)==(d|0)){s=73;break}if(f=c+16+(l>>>31<<2)|0,s=n[f>>2]|0,s)l=l<<1,c=s;else{s=72;break}}if((s|0)==72){n[f>>2]=k,n[k+24>>2]=c,n[k+12>>2]=k,n[k+8>>2]=k;break}else if((s|0)==73){B=c+8|0,F=n[B>>2]|0,n[F+12>>2]=k,n[B>>2]=k,n[k+8>>2]=F,n[k+12>>2]=c,n[k+24>>2]=0;break}}else n[2784]=l|c,n[f>>2]=k,n[k+24>>2]=f,n[k+12>>2]=k,n[k+8>>2]=k;while(!1);if(F=(n[2791]|0)+-1|0,n[2791]=F,!F)s=11588;else return;for(;s=n[s>>2]|0,s;)s=s+8|0;n[2791]=-1}}}function dUe(){return 11628}function mUe(s){s=s|0;var l=0,c=0;return l=C,C=C+16|0,c=l,n[c>>2]=CUe(n[s+60>>2]|0)|0,s=qD(Ec(6,c|0)|0)|0,C=l,s|0}function N7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0;j=C,C=C+48|0,M=j+16|0,m=j,d=j+32|0,k=s+28|0,f=n[k>>2]|0,n[d>>2]=f,F=s+20|0,f=(n[F>>2]|0)-f|0,n[d+4>>2]=f,n[d+8>>2]=l,n[d+12>>2]=c,f=f+c|0,B=s+60|0,n[m>>2]=n[B>>2],n[m+4>>2]=d,n[m+8>>2]=2,m=qD(aa(146,m|0)|0)|0;e:do if((f|0)!=(m|0)){for(l=2;!((m|0)<0);)if(f=f-m|0,We=n[d+4>>2]|0,oe=m>>>0>We>>>0,d=oe?d+8|0:d,l=(oe<<31>>31)+l|0,We=m-(oe?We:0)|0,n[d>>2]=(n[d>>2]|0)+We,oe=d+4|0,n[oe>>2]=(n[oe>>2]|0)-We,n[M>>2]=n[B>>2],n[M+4>>2]=d,n[M+8>>2]=l,m=qD(aa(146,M|0)|0)|0,(f|0)==(m|0)){O=3;break e}n[s+16>>2]=0,n[k>>2]=0,n[F>>2]=0,n[s>>2]=n[s>>2]|32,(l|0)==2?c=0:c=c-(n[d+4>>2]|0)|0}else O=3;while(!1);return(O|0)==3&&(We=n[s+44>>2]|0,n[s+16>>2]=We+(n[s+48>>2]|0),n[k>>2]=We,n[F>>2]=We),C=j,c|0}function yUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;return d=C,C=C+32|0,m=d,f=d+20|0,n[m>>2]=n[s+60>>2],n[m+4>>2]=0,n[m+8>>2]=l,n[m+12>>2]=f,n[m+16>>2]=c,(qD(oa(140,m|0)|0)|0)<0?(n[f>>2]=-1,s=-1):s=n[f>>2]|0,C=d,s|0}function qD(s){return s=s|0,s>>>0>4294963200&&(n[(rm()|0)>>2]=0-s,s=-1),s|0}function rm(){return(EUe()|0)+64|0}function EUe(){return oT()|0}function oT(){return 2084}function CUe(s){return s=s|0,s|0}function IUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;return d=C,C=C+32|0,f=d,n[s+36>>2]=1,!(n[s>>2]&64|0)&&(n[f>>2]=n[s+60>>2],n[f+4>>2]=21523,n[f+8>>2]=d+16,Ls(54,f|0)|0)&&(o[s+75>>0]=-1),f=N7(s,l,c)|0,C=d,f|0}function O7(s,l){s=s|0,l=l|0;var c=0,f=0;if(c=o[s>>0]|0,f=o[l>>0]|0,!(c<<24>>24)||c<<24>>24!=f<<24>>24)s=f;else{do s=s+1|0,l=l+1|0,c=o[s>>0]|0,f=o[l>>0]|0;while(!(!(c<<24>>24)||c<<24>>24!=f<<24>>24));s=f}return(c&255)-(s&255)|0}function wUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;e:do if(!c)s=0;else{for(;f=o[s>>0]|0,d=o[l>>0]|0,f<<24>>24==d<<24>>24;)if(c=c+-1|0,c)s=s+1|0,l=l+1|0;else{s=0;break e}s=(f&255)-(d&255)|0}while(!1);return s|0}function M7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0;Qe=C,C=C+224|0,O=Qe+120|0,j=Qe+80|0,We=Qe,Oe=Qe+136|0,f=j,d=f+40|0;do n[f>>2]=0,f=f+4|0;while((f|0)<(d|0));return n[O>>2]=n[c>>2],(aT(0,l,O,We,j)|0)<0?c=-1:((n[s+76>>2]|0)>-1?oe=BUe(s)|0:oe=0,c=n[s>>2]|0,M=c&32,(o[s+74>>0]|0)<1&&(n[s>>2]=c&-33),f=s+48|0,n[f>>2]|0?c=aT(s,l,O,We,j)|0:(d=s+44|0,m=n[d>>2]|0,n[d>>2]=Oe,B=s+28|0,n[B>>2]=Oe,k=s+20|0,n[k>>2]=Oe,n[f>>2]=80,F=s+16|0,n[F>>2]=Oe+80,c=aT(s,l,O,We,j)|0,m&&(YD[n[s+36>>2]&7](s,0,0)|0,c=n[k>>2]|0?c:-1,n[d>>2]=m,n[f>>2]=0,n[F>>2]=0,n[B>>2]=0,n[k>>2]=0)),f=n[s>>2]|0,n[s>>2]=f|M,oe|0&&vUe(s),c=f&32|0?-1:c),C=Qe,c|0}function aT(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0,rt=0,Xe=0,ct=0,_e=0,Ge=0,Nt=0,_r=0,ur=0,Zt=0,kr=0,Or=0,lr=0;lr=C,C=C+64|0,ur=lr+16|0,Zt=lr,Nt=lr+24|0,kr=lr+8|0,Or=lr+20|0,n[ur>>2]=l,ct=(s|0)!=0,_e=Nt+40|0,Ge=_e,Nt=Nt+39|0,_r=kr+4|0,B=0,m=0,O=0;e:for(;;){do if((m|0)>-1)if((B|0)>(2147483647-m|0)){n[(rm()|0)>>2]=75,m=-1;break}else{m=B+m|0;break}while(!1);if(B=o[l>>0]|0,B<<24>>24)k=l;else{Xe=87;break}t:for(;;){switch(B<<24>>24){case 37:{B=k,Xe=9;break t}case 0:{B=k;break t}default:}rt=k+1|0,n[ur>>2]=rt,B=o[rt>>0]|0,k=rt}t:do if((Xe|0)==9)for(;;){if(Xe=0,(o[k+1>>0]|0)!=37)break t;if(B=B+1|0,k=k+2|0,n[ur>>2]=k,(o[k>>0]|0)==37)Xe=9;else break}while(!1);if(B=B-l|0,ct&&os(s,l,B),B|0){l=k;continue}F=k+1|0,B=(o[F>>0]|0)+-48|0,B>>>0<10?(rt=(o[k+2>>0]|0)==36,Qe=rt?B:-1,O=rt?1:O,F=rt?k+3|0:F):Qe=-1,n[ur>>2]=F,B=o[F>>0]|0,k=(B<<24>>24)+-32|0;t:do if(k>>>0<32)for(M=0,j=B;;){if(B=1<>2]=F,B=o[F>>0]|0,k=(B<<24>>24)+-32|0,k>>>0>=32)break;j=B}else M=0;while(!1);if(B<<24>>24==42){if(k=F+1|0,B=(o[k>>0]|0)+-48|0,B>>>0<10&&(o[F+2>>0]|0)==36)n[d+(B<<2)>>2]=10,B=n[f+((o[k>>0]|0)+-48<<3)>>2]|0,O=1,F=F+3|0;else{if(O|0){m=-1;break}ct?(O=(n[c>>2]|0)+3&-4,B=n[O>>2]|0,n[c>>2]=O+4,O=0,F=k):(B=0,O=0,F=k)}n[ur>>2]=F,rt=(B|0)<0,B=rt?0-B|0:B,M=rt?M|8192:M}else{if(B=U7(ur)|0,(B|0)<0){m=-1;break}F=n[ur>>2]|0}do if((o[F>>0]|0)==46){if((o[F+1>>0]|0)!=42){n[ur>>2]=F+1,k=U7(ur)|0,F=n[ur>>2]|0;break}if(j=F+2|0,k=(o[j>>0]|0)+-48|0,k>>>0<10&&(o[F+3>>0]|0)==36){n[d+(k<<2)>>2]=10,k=n[f+((o[j>>0]|0)+-48<<3)>>2]|0,F=F+4|0,n[ur>>2]=F;break}if(O|0){m=-1;break e}ct?(rt=(n[c>>2]|0)+3&-4,k=n[rt>>2]|0,n[c>>2]=rt+4):k=0,n[ur>>2]=j,F=j}else k=-1;while(!1);for(Oe=0;;){if(((o[F>>0]|0)+-65|0)>>>0>57){m=-1;break e}if(rt=F+1|0,n[ur>>2]=rt,j=o[(o[F>>0]|0)+-65+(5178+(Oe*58|0))>>0]|0,oe=j&255,(oe+-1|0)>>>0<8)Oe=oe,F=rt;else break}if(!(j<<24>>24)){m=-1;break}We=(Qe|0)>-1;do if(j<<24>>24==19)if(We){m=-1;break e}else Xe=49;else{if(We){n[d+(Qe<<2)>>2]=oe,We=f+(Qe<<3)|0,Qe=n[We+4>>2]|0,Xe=Zt,n[Xe>>2]=n[We>>2],n[Xe+4>>2]=Qe,Xe=49;break}if(!ct){m=0;break e}_7(Zt,oe,c)}while(!1);if((Xe|0)==49&&(Xe=0,!ct)){B=0,l=rt;continue}F=o[F>>0]|0,F=(Oe|0)!=0&(F&15|0)==3?F&-33:F,We=M&-65537,Qe=M&8192|0?We:M;t:do switch(F|0){case 110:switch((Oe&255)<<24>>24){case 0:{n[n[Zt>>2]>>2]=m,B=0,l=rt;continue e}case 1:{n[n[Zt>>2]>>2]=m,B=0,l=rt;continue e}case 2:{B=n[Zt>>2]|0,n[B>>2]=m,n[B+4>>2]=((m|0)<0)<<31>>31,B=0,l=rt;continue e}case 3:{a[n[Zt>>2]>>1]=m,B=0,l=rt;continue e}case 4:{o[n[Zt>>2]>>0]=m,B=0,l=rt;continue e}case 6:{n[n[Zt>>2]>>2]=m,B=0,l=rt;continue e}case 7:{B=n[Zt>>2]|0,n[B>>2]=m,n[B+4>>2]=((m|0)<0)<<31>>31,B=0,l=rt;continue e}default:{B=0,l=rt;continue e}}case 112:{F=120,k=k>>>0>8?k:8,l=Qe|8,Xe=61;break}case 88:case 120:{l=Qe,Xe=61;break}case 111:{F=Zt,l=n[F>>2]|0,F=n[F+4>>2]|0,oe=SUe(l,F,_e)|0,We=Ge-oe|0,M=0,j=5642,k=(Qe&8|0)==0|(k|0)>(We|0)?k:We+1|0,We=Qe,Xe=67;break}case 105:case 100:if(F=Zt,l=n[F>>2]|0,F=n[F+4>>2]|0,(F|0)<0){l=jD(0,0,l|0,F|0)|0,F=Ce,M=Zt,n[M>>2]=l,n[M+4>>2]=F,M=1,j=5642,Xe=66;break t}else{M=(Qe&2049|0)!=0&1,j=Qe&2048|0?5643:Qe&1|0?5644:5642,Xe=66;break t}case 117:{F=Zt,M=0,j=5642,l=n[F>>2]|0,F=n[F+4>>2]|0,Xe=66;break}case 99:{o[Nt>>0]=n[Zt>>2],l=Nt,M=0,j=5642,oe=_e,F=1,k=We;break}case 109:{F=PUe(n[(rm()|0)>>2]|0)|0,Xe=71;break}case 115:{F=n[Zt>>2]|0,F=F|0?F:5652,Xe=71;break}case 67:{n[kr>>2]=n[Zt>>2],n[_r>>2]=0,n[Zt>>2]=kr,oe=-1,F=kr,Xe=75;break}case 83:{l=n[Zt>>2]|0,k?(oe=k,F=l,Xe=75):(Es(s,32,B,0,Qe),l=0,Xe=84);break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{B=bUe(s,+E[Zt>>3],B,k,Qe,F)|0,l=rt;continue e}default:M=0,j=5642,oe=_e,F=k,k=Qe}while(!1);t:do if((Xe|0)==61)Qe=Zt,Oe=n[Qe>>2]|0,Qe=n[Qe+4>>2]|0,oe=DUe(Oe,Qe,_e,F&32)|0,j=(l&8|0)==0|(Oe|0)==0&(Qe|0)==0,M=j?0:2,j=j?5642:5642+(F>>4)|0,We=l,l=Oe,F=Qe,Xe=67;else if((Xe|0)==66)oe=nm(l,F,_e)|0,We=Qe,Xe=67;else if((Xe|0)==71)Xe=0,Qe=xUe(F,0,k)|0,Oe=(Qe|0)==0,l=F,M=0,j=5642,oe=Oe?F+k|0:Qe,F=Oe?k:Qe-F|0,k=We;else if((Xe|0)==75){for(Xe=0,j=F,l=0,k=0;M=n[j>>2]|0,!(!M||(k=H7(Or,M)|0,(k|0)<0|k>>>0>(oe-l|0)>>>0));)if(l=k+l|0,oe>>>0>l>>>0)j=j+4|0;else break;if((k|0)<0){m=-1;break e}if(Es(s,32,B,l,Qe),!l)l=0,Xe=84;else for(M=0;;){if(k=n[F>>2]|0,!k){Xe=84;break t}if(k=H7(Or,k)|0,M=k+M|0,(M|0)>(l|0)){Xe=84;break t}if(os(s,Or,k),M>>>0>=l>>>0){Xe=84;break}else F=F+4|0}}while(!1);if((Xe|0)==67)Xe=0,F=(l|0)!=0|(F|0)!=0,Qe=(k|0)!=0|F,F=((F^1)&1)+(Ge-oe)|0,l=Qe?oe:_e,oe=_e,F=Qe?(k|0)>(F|0)?k:F:k,k=(k|0)>-1?We&-65537:We;else if((Xe|0)==84){Xe=0,Es(s,32,B,l,Qe^8192),B=(B|0)>(l|0)?B:l,l=rt;continue}Oe=oe-l|0,We=(F|0)<(Oe|0)?Oe:F,Qe=We+M|0,B=(B|0)<(Qe|0)?Qe:B,Es(s,32,B,Qe,k),os(s,j,M),Es(s,48,B,Qe,k^65536),Es(s,48,We,Oe,0),os(s,l,Oe),Es(s,32,B,Qe,k^8192),l=rt}e:do if((Xe|0)==87&&!s)if(!O)m=0;else{for(m=1;l=n[d+(m<<2)>>2]|0,!!l;)if(_7(f+(m<<3)|0,l,c),m=m+1|0,(m|0)>=10){m=1;break e}for(;;){if(n[d+(m<<2)>>2]|0){m=-1;break e}if(m=m+1|0,(m|0)>=10){m=1;break}}}while(!1);return C=lr,m|0}function BUe(s){return s=s|0,0}function vUe(s){s=s|0}function os(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]&32||MUe(l,c,s)|0}function U7(s){s=s|0;var l=0,c=0,f=0;if(c=n[s>>2]|0,f=(o[c>>0]|0)+-48|0,f>>>0<10){l=0;do l=f+(l*10|0)|0,c=c+1|0,n[s>>2]=c,f=(o[c>>0]|0)+-48|0;while(f>>>0<10)}else l=0;return l|0}function _7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;e:do if(l>>>0<=20)do switch(l|0){case 9:{f=(n[c>>2]|0)+3&-4,l=n[f>>2]|0,n[c>>2]=f+4,n[s>>2]=l;break e}case 10:{f=(n[c>>2]|0)+3&-4,l=n[f>>2]|0,n[c>>2]=f+4,f=s,n[f>>2]=l,n[f+4>>2]=((l|0)<0)<<31>>31;break e}case 11:{f=(n[c>>2]|0)+3&-4,l=n[f>>2]|0,n[c>>2]=f+4,f=s,n[f>>2]=l,n[f+4>>2]=0;break e}case 12:{f=(n[c>>2]|0)+7&-8,l=f,d=n[l>>2]|0,l=n[l+4>>2]|0,n[c>>2]=f+8,f=s,n[f>>2]=d,n[f+4>>2]=l;break e}case 13:{d=(n[c>>2]|0)+3&-4,f=n[d>>2]|0,n[c>>2]=d+4,f=(f&65535)<<16>>16,d=s,n[d>>2]=f,n[d+4>>2]=((f|0)<0)<<31>>31;break e}case 14:{d=(n[c>>2]|0)+3&-4,f=n[d>>2]|0,n[c>>2]=d+4,d=s,n[d>>2]=f&65535,n[d+4>>2]=0;break e}case 15:{d=(n[c>>2]|0)+3&-4,f=n[d>>2]|0,n[c>>2]=d+4,f=(f&255)<<24>>24,d=s,n[d>>2]=f,n[d+4>>2]=((f|0)<0)<<31>>31;break e}case 16:{d=(n[c>>2]|0)+3&-4,f=n[d>>2]|0,n[c>>2]=d+4,d=s,n[d>>2]=f&255,n[d+4>>2]=0;break e}case 17:{d=(n[c>>2]|0)+7&-8,m=+E[d>>3],n[c>>2]=d+8,E[s>>3]=m;break e}case 18:{d=(n[c>>2]|0)+7&-8,m=+E[d>>3],n[c>>2]=d+8,E[s>>3]=m;break e}default:break e}while(!1);while(!1)}function DUe(s,l,c,f){if(s=s|0,l=l|0,c=c|0,f=f|0,!((s|0)==0&(l|0)==0))do c=c+-1|0,o[c>>0]=u[5694+(s&15)>>0]|0|f,s=GD(s|0,l|0,4)|0,l=Ce;while(!((s|0)==0&(l|0)==0));return c|0}function SUe(s,l,c){if(s=s|0,l=l|0,c=c|0,!((s|0)==0&(l|0)==0))do c=c+-1|0,o[c>>0]=s&7|48,s=GD(s|0,l|0,3)|0,l=Ce;while(!((s|0)==0&(l|0)==0));return c|0}function nm(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;if(l>>>0>0|(l|0)==0&s>>>0>4294967295){for(;f=AT(s|0,l|0,10,0)|0,c=c+-1|0,o[c>>0]=f&255|48,f=s,s=uT(s|0,l|0,10,0)|0,l>>>0>9|(l|0)==9&f>>>0>4294967295;)l=Ce;l=s}else l=s;if(l)for(;c=c+-1|0,o[c>>0]=(l>>>0)%10|0|48,!(l>>>0<10);)l=(l>>>0)/10|0;return c|0}function PUe(s){return s=s|0,TUe(s,n[(RUe()|0)+188>>2]|0)|0}function xUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;m=l&255,f=(c|0)!=0;e:do if(f&(s&3|0)!=0)for(d=l&255;;){if((o[s>>0]|0)==d<<24>>24){B=6;break e}if(s=s+1|0,c=c+-1|0,f=(c|0)!=0,!(f&(s&3|0)!=0)){B=5;break}}else B=5;while(!1);(B|0)==5&&(f?B=6:c=0);e:do if((B|0)==6&&(d=l&255,(o[s>>0]|0)!=d<<24>>24)){f=He(m,16843009)|0;t:do if(c>>>0>3){for(;m=n[s>>2]^f,!((m&-2139062144^-2139062144)&m+-16843009|0);)if(s=s+4|0,c=c+-4|0,c>>>0<=3){B=11;break t}}else B=11;while(!1);if((B|0)==11&&!c){c=0;break}for(;;){if((o[s>>0]|0)==d<<24>>24)break e;if(s=s+1|0,c=c+-1|0,!c){c=0;break}}}while(!1);return(c|0?s:0)|0}function Es(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0;if(B=C,C=C+256|0,m=B,(c|0)>(f|0)&(d&73728|0)==0){if(d=c-f|0,sm(m|0,l|0,(d>>>0<256?d:256)|0)|0,d>>>0>255){l=c-f|0;do os(s,m,256),d=d+-256|0;while(d>>>0>255);d=l&255}os(s,m,d)}C=B}function H7(s,l){return s=s|0,l=l|0,s?s=QUe(s,l,0)|0:s=0,s|0}function bUe(s,l,c,f,d,m){s=s|0,l=+l,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0,Qe=0,rt=0,Xe=0,ct=0,_e=0,Ge=0,Nt=0,_r=0,ur=0,Zt=0,kr=0,Or=0,lr=0,Ln=0;Ln=C,C=C+560|0,F=Ln+8|0,rt=Ln,lr=Ln+524|0,Or=lr,M=Ln+512|0,n[rt>>2]=0,kr=M+12|0,q7(l)|0,(Ce|0)<0?(l=-l,ur=1,_r=5659):(ur=(d&2049|0)!=0&1,_r=d&2048|0?5662:d&1|0?5665:5660),q7(l)|0,Zt=Ce&2146435072;do if(Zt>>>0<2146435072|(Zt|0)==2146435072&!1){if(We=+kUe(l,rt)*2,B=We!=0,B&&(n[rt>>2]=(n[rt>>2]|0)+-1),ct=m|32,(ct|0)==97){Oe=m&32,oe=Oe|0?_r+9|0:_r,j=ur|2,B=12-f|0;do if(f>>>0>11|(B|0)==0)l=We;else{l=8;do B=B+-1|0,l=l*16;while(B|0);if((o[oe>>0]|0)==45){l=-(l+(-We-l));break}else{l=We+l-l;break}}while(!1);k=n[rt>>2]|0,B=(k|0)<0?0-k|0:k,B=nm(B,((B|0)<0)<<31>>31,kr)|0,(B|0)==(kr|0)&&(B=M+11|0,o[B>>0]=48),o[B+-1>>0]=(k>>31&2)+43,O=B+-2|0,o[O>>0]=m+15,M=(f|0)<1,F=(d&8|0)==0,B=lr;do Zt=~~l,k=B+1|0,o[B>>0]=u[5694+Zt>>0]|Oe,l=(l-+(Zt|0))*16,(k-Or|0)==1&&!(F&(M&l==0))?(o[k>>0]=46,B=B+2|0):B=k;while(l!=0);Zt=B-Or|0,Or=kr-O|0,kr=(f|0)!=0&(Zt+-2|0)<(f|0)?f+2|0:Zt,B=Or+j+kr|0,Es(s,32,c,B,d),os(s,oe,j),Es(s,48,c,B,d^65536),os(s,lr,Zt),Es(s,48,kr-Zt|0,0,0),os(s,O,Or),Es(s,32,c,B,d^8192);break}k=(f|0)<0?6:f,B?(B=(n[rt>>2]|0)+-28|0,n[rt>>2]=B,l=We*268435456):(l=We,B=n[rt>>2]|0),Zt=(B|0)<0?F:F+288|0,F=Zt;do Ge=~~l>>>0,n[F>>2]=Ge,F=F+4|0,l=(l-+(Ge>>>0))*1e9;while(l!=0);if((B|0)>0)for(M=Zt,j=F;;){if(O=(B|0)<29?B:29,B=j+-4|0,B>>>0>=M>>>0){F=0;do _e=K7(n[B>>2]|0,0,O|0)|0,_e=cT(_e|0,Ce|0,F|0,0)|0,Ge=Ce,Xe=AT(_e|0,Ge|0,1e9,0)|0,n[B>>2]=Xe,F=uT(_e|0,Ge|0,1e9,0)|0,B=B+-4|0;while(B>>>0>=M>>>0);F&&(M=M+-4|0,n[M>>2]=F)}for(F=j;!(F>>>0<=M>>>0);)if(B=F+-4|0,!(n[B>>2]|0))F=B;else break;if(B=(n[rt>>2]|0)-O|0,n[rt>>2]=B,(B|0)>0)j=F;else break}else M=Zt;if((B|0)<0){f=((k+25|0)/9|0)+1|0,Qe=(ct|0)==102;do{if(Oe=0-B|0,Oe=(Oe|0)<9?Oe:9,M>>>0>>0){O=(1<>>Oe,oe=0,B=M;do Ge=n[B>>2]|0,n[B>>2]=(Ge>>>Oe)+oe,oe=He(Ge&O,j)|0,B=B+4|0;while(B>>>0>>0);B=n[M>>2]|0?M:M+4|0,oe?(n[F>>2]=oe,M=B,B=F+4|0):(M=B,B=F)}else M=n[M>>2]|0?M:M+4|0,B=F;F=Qe?Zt:M,F=(B-F>>2|0)>(f|0)?F+(f<<2)|0:B,B=(n[rt>>2]|0)+Oe|0,n[rt>>2]=B}while((B|0)<0);B=M,f=F}else B=M,f=F;if(Ge=Zt,B>>>0>>0){if(F=(Ge-B>>2)*9|0,O=n[B>>2]|0,O>>>0>=10){M=10;do M=M*10|0,F=F+1|0;while(O>>>0>=M>>>0)}}else F=0;if(Qe=(ct|0)==103,Xe=(k|0)!=0,M=k-((ct|0)!=102?F:0)+((Xe&Qe)<<31>>31)|0,(M|0)<(((f-Ge>>2)*9|0)+-9|0)){if(M=M+9216|0,Oe=Zt+4+(((M|0)/9|0)+-1024<<2)|0,M=((M|0)%9|0)+1|0,(M|0)<9){O=10;do O=O*10|0,M=M+1|0;while((M|0)!=9)}else O=10;if(j=n[Oe>>2]|0,oe=(j>>>0)%(O>>>0)|0,M=(Oe+4|0)==(f|0),M&(oe|0)==0)M=Oe;else if(We=((j>>>0)/(O>>>0)|0)&1|0?9007199254740994:9007199254740992,_e=(O|0)/2|0,l=oe>>>0<_e>>>0?.5:M&(oe|0)==(_e|0)?1:1.5,ur&&(_e=(o[_r>>0]|0)==45,l=_e?-l:l,We=_e?-We:We),M=j-oe|0,n[Oe>>2]=M,We+l!=We){if(_e=M+O|0,n[Oe>>2]=_e,_e>>>0>999999999)for(F=Oe;M=F+-4|0,n[F>>2]=0,M>>>0>>0&&(B=B+-4|0,n[B>>2]=0),_e=(n[M>>2]|0)+1|0,n[M>>2]=_e,_e>>>0>999999999;)F=M;else M=Oe;if(F=(Ge-B>>2)*9|0,j=n[B>>2]|0,j>>>0>=10){O=10;do O=O*10|0,F=F+1|0;while(j>>>0>=O>>>0)}}else M=Oe;M=M+4|0,M=f>>>0>M>>>0?M:f,_e=B}else M=f,_e=B;for(ct=M;;){if(ct>>>0<=_e>>>0){rt=0;break}if(B=ct+-4|0,!(n[B>>2]|0))ct=B;else{rt=1;break}}f=0-F|0;do if(Qe)if(B=((Xe^1)&1)+k|0,(B|0)>(F|0)&(F|0)>-5?(O=m+-1|0,k=B+-1-F|0):(O=m+-2|0,k=B+-1|0),B=d&8,B)Oe=B;else{if(rt&&(Nt=n[ct+-4>>2]|0,(Nt|0)!=0))if((Nt>>>0)%10|0)M=0;else{M=0,B=10;do B=B*10|0,M=M+1|0;while(!((Nt>>>0)%(B>>>0)|0|0))}else M=9;if(B=((ct-Ge>>2)*9|0)+-9|0,(O|32|0)==102){Oe=B-M|0,Oe=(Oe|0)>0?Oe:0,k=(k|0)<(Oe|0)?k:Oe,Oe=0;break}else{Oe=B+F-M|0,Oe=(Oe|0)>0?Oe:0,k=(k|0)<(Oe|0)?k:Oe,Oe=0;break}}else O=m,Oe=d&8;while(!1);if(Qe=k|Oe,j=(Qe|0)!=0&1,oe=(O|32|0)==102,oe)Xe=0,B=(F|0)>0?F:0;else{if(B=(F|0)<0?f:F,B=nm(B,((B|0)<0)<<31>>31,kr)|0,M=kr,(M-B|0)<2)do B=B+-1|0,o[B>>0]=48;while((M-B|0)<2);o[B+-1>>0]=(F>>31&2)+43,B=B+-2|0,o[B>>0]=O,Xe=B,B=M-B|0}if(B=ur+1+k+j+B|0,Es(s,32,c,B,d),os(s,_r,ur),Es(s,48,c,B,d^65536),oe){O=_e>>>0>Zt>>>0?Zt:_e,Oe=lr+9|0,j=Oe,oe=lr+8|0,M=O;do{if(F=nm(n[M>>2]|0,0,Oe)|0,(M|0)==(O|0))(F|0)==(Oe|0)&&(o[oe>>0]=48,F=oe);else if(F>>>0>lr>>>0){sm(lr|0,48,F-Or|0)|0;do F=F+-1|0;while(F>>>0>lr>>>0)}os(s,F,j-F|0),M=M+4|0}while(M>>>0<=Zt>>>0);if(Qe|0&&os(s,5710,1),M>>>0>>0&(k|0)>0)for(;;){if(F=nm(n[M>>2]|0,0,Oe)|0,F>>>0>lr>>>0){sm(lr|0,48,F-Or|0)|0;do F=F+-1|0;while(F>>>0>lr>>>0)}if(os(s,F,(k|0)<9?k:9),M=M+4|0,F=k+-9|0,M>>>0>>0&(k|0)>9)k=F;else{k=F;break}}Es(s,48,k+9|0,9,0)}else{if(Qe=rt?ct:_e+4|0,(k|0)>-1){rt=lr+9|0,Oe=(Oe|0)==0,f=rt,j=0-Or|0,oe=lr+8|0,O=_e;do{F=nm(n[O>>2]|0,0,rt)|0,(F|0)==(rt|0)&&(o[oe>>0]=48,F=oe);do if((O|0)==(_e|0)){if(M=F+1|0,os(s,F,1),Oe&(k|0)<1){F=M;break}os(s,5710,1),F=M}else{if(F>>>0<=lr>>>0)break;sm(lr|0,48,F+j|0)|0;do F=F+-1|0;while(F>>>0>lr>>>0)}while(!1);Or=f-F|0,os(s,F,(k|0)>(Or|0)?Or:k),k=k-Or|0,O=O+4|0}while(O>>>0>>0&(k|0)>-1)}Es(s,48,k+18|0,18,0),os(s,Xe,kr-Xe|0)}Es(s,32,c,B,d^8192)}else lr=(m&32|0)!=0,B=ur+3|0,Es(s,32,c,B,d&-65537),os(s,_r,ur),os(s,l!=l|!1?lr?5686:5690:lr?5678:5682,3),Es(s,32,c,B,d^8192);while(!1);return C=Ln,((B|0)<(c|0)?c:B)|0}function q7(s){s=+s;var l=0;return E[D>>3]=s,l=n[D>>2]|0,Ce=n[D+4>>2]|0,l|0}function kUe(s,l){return s=+s,l=l|0,+ +j7(s,l)}function j7(s,l){s=+s,l=l|0;var c=0,f=0,d=0;switch(E[D>>3]=s,c=n[D>>2]|0,f=n[D+4>>2]|0,d=GD(c|0,f|0,52)|0,d&2047){case 0:{s!=0?(s=+j7(s*18446744073709552e3,l),c=(n[l>>2]|0)+-64|0):c=0,n[l>>2]=c;break}case 2047:break;default:n[l>>2]=(d&2047)+-1022,n[D>>2]=c,n[D+4>>2]=f&-2146435073|1071644672,s=+E[D>>3]}return+s}function QUe(s,l,c){s=s|0,l=l|0,c=c|0;do if(s){if(l>>>0<128){o[s>>0]=l,s=1;break}if(!(n[n[(FUe()|0)+188>>2]>>2]|0))if((l&-128|0)==57216){o[s>>0]=l,s=1;break}else{n[(rm()|0)>>2]=84,s=-1;break}if(l>>>0<2048){o[s>>0]=l>>>6|192,o[s+1>>0]=l&63|128,s=2;break}if(l>>>0<55296|(l&-8192|0)==57344){o[s>>0]=l>>>12|224,o[s+1>>0]=l>>>6&63|128,o[s+2>>0]=l&63|128,s=3;break}if((l+-65536|0)>>>0<1048576){o[s>>0]=l>>>18|240,o[s+1>>0]=l>>>12&63|128,o[s+2>>0]=l>>>6&63|128,o[s+3>>0]=l&63|128,s=4;break}else{n[(rm()|0)>>2]=84,s=-1;break}}else s=1;while(!1);return s|0}function FUe(){return oT()|0}function RUe(){return oT()|0}function TUe(s,l){s=s|0,l=l|0;var c=0,f=0;for(f=0;;){if((u[5712+f>>0]|0)==(s|0)){s=2;break}if(c=f+1|0,(c|0)==87){c=5800,f=87,s=5;break}else f=c}if((s|0)==2&&(f?(c=5800,s=5):c=5800),(s|0)==5)for(;;){do s=c,c=c+1|0;while(o[s>>0]|0);if(f=f+-1|0,f)s=5;else break}return LUe(c,n[l+20>>2]|0)|0}function LUe(s,l){return s=s|0,l=l|0,NUe(s,l)|0}function NUe(s,l){return s=s|0,l=l|0,l?l=OUe(n[l>>2]|0,n[l+4>>2]|0,s)|0:l=0,(l|0?l:s)|0}function OUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0;oe=(n[s>>2]|0)+1794895138|0,m=O0(n[s+8>>2]|0,oe)|0,f=O0(n[s+12>>2]|0,oe)|0,d=O0(n[s+16>>2]|0,oe)|0;e:do if(m>>>0>>2>>>0&&(j=l-(m<<2)|0,f>>>0>>0&d>>>0>>0)&&!((d|f)&3|0)){for(j=f>>>2,O=d>>>2,M=0;;){if(k=m>>>1,F=M+k|0,B=F<<1,d=B+j|0,f=O0(n[s+(d<<2)>>2]|0,oe)|0,d=O0(n[s+(d+1<<2)>>2]|0,oe)|0,!(d>>>0>>0&f>>>0<(l-d|0)>>>0)){f=0;break e}if(o[s+(d+f)>>0]|0){f=0;break e}if(f=O7(c,s+d|0)|0,!f)break;if(f=(f|0)<0,(m|0)==1){f=0;break e}else M=f?M:F,m=f?k:m-k|0}f=B+O|0,d=O0(n[s+(f<<2)>>2]|0,oe)|0,f=O0(n[s+(f+1<<2)>>2]|0,oe)|0,f>>>0>>0&d>>>0<(l-f|0)>>>0?f=o[s+(f+d)>>0]|0?0:s+f|0:f=0}else f=0;while(!1);return f|0}function O0(s,l){s=s|0,l=l|0;var c=0;return c=X7(s|0)|0,(l|0?c:s)|0}function MUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=c+16|0,d=n[f>>2]|0,d?m=5:UUe(c)|0?f=0:(d=n[f>>2]|0,m=5);e:do if((m|0)==5){if(k=c+20|0,B=n[k>>2]|0,f=B,(d-B|0)>>>0>>0){f=YD[n[c+36>>2]&7](c,s,l)|0;break}t:do if((o[c+75>>0]|0)>-1){for(B=l;;){if(!B){m=0,d=s;break t}if(d=B+-1|0,(o[s+d>>0]|0)==10)break;B=d}if(f=YD[n[c+36>>2]&7](c,s,B)|0,f>>>0>>0)break e;m=B,d=s+B|0,l=l-B|0,f=n[k>>2]|0}else m=0,d=s;while(!1);br(f|0,d|0,l|0)|0,n[k>>2]=(n[k>>2]|0)+l,f=m+l|0}while(!1);return f|0}function UUe(s){s=s|0;var l=0,c=0;return l=s+74|0,c=o[l>>0]|0,o[l>>0]=c+255|c,l=n[s>>2]|0,l&8?(n[s>>2]=l|32,s=-1):(n[s+8>>2]=0,n[s+4>>2]=0,c=n[s+44>>2]|0,n[s+28>>2]=c,n[s+20>>2]=c,n[s+16>>2]=c+(n[s+48>>2]|0),s=0),s|0}function Yn(s,l){s=y(s),l=y(l);var c=0,f=0;c=G7(s)|0;do if((c&2147483647)>>>0<=2139095040){if(f=G7(l)|0,(f&2147483647)>>>0<=2139095040)if((f^c|0)<0){s=(c|0)<0?l:s;break}else{s=s>2]=s,n[D>>2]|0|0}function M0(s,l){s=y(s),l=y(l);var c=0,f=0;c=W7(s)|0;do if((c&2147483647)>>>0<=2139095040){if(f=W7(l)|0,(f&2147483647)>>>0<=2139095040)if((f^c|0)<0){s=(c|0)<0?s:l;break}else{s=s>2]=s,n[D>>2]|0|0}function lT(s,l){s=y(s),l=y(l);var c=0,f=0,d=0,m=0,B=0,k=0,F=0,M=0;m=(h[D>>2]=s,n[D>>2]|0),k=(h[D>>2]=l,n[D>>2]|0),c=m>>>23&255,B=k>>>23&255,F=m&-2147483648,d=k<<1;e:do if(d|0&&!((c|0)==255|((_Ue(l)|0)&2147483647)>>>0>2139095040)){if(f=m<<1,f>>>0<=d>>>0)return l=y(s*y(0)),y((f|0)==(d|0)?l:s);if(c)f=m&8388607|8388608;else{if(c=m<<9,(c|0)>-1){f=c,c=0;do c=c+-1|0,f=f<<1;while((f|0)>-1)}else c=0;f=m<<1-c}if(B)k=k&8388607|8388608;else{if(m=k<<9,(m|0)>-1){d=0;do d=d+-1|0,m=m<<1;while((m|0)>-1)}else d=0;B=d,k=k<<1-d}d=f-k|0,m=(d|0)>-1;t:do if((c|0)>(B|0)){for(;;){if(m)if(d)f=d;else break;if(f=f<<1,c=c+-1|0,d=f-k|0,m=(d|0)>-1,(c|0)<=(B|0))break t}l=y(s*y(0));break e}while(!1);if(m)if(d)f=d;else{l=y(s*y(0));break}if(f>>>0<8388608)do f=f<<1,c=c+-1|0;while(f>>>0<8388608);(c|0)>0?c=f+-8388608|c<<23:c=f>>>(1-c|0),l=(n[D>>2]=c|F,y(h[D>>2]))}else M=3;while(!1);return(M|0)==3&&(l=y(s*l),l=y(l/l)),y(l)}function _Ue(s){return s=y(s),h[D>>2]=s,n[D>>2]|0|0}function HUe(s,l){return s=s|0,l=l|0,M7(n[582]|0,s,l)|0}function Zr(s){s=s|0,Tt()}function im(s){s=s|0}function qUe(s,l){return s=s|0,l=l|0,0}function jUe(s){return s=s|0,(Y7(s+4|0)|0)==-1?(ef[n[(n[s>>2]|0)+8>>2]&127](s),s=1):s=0,s|0}function Y7(s){s=s|0;var l=0;return l=n[s>>2]|0,n[s>>2]=l+-1,l+-1|0}function Rp(s){s=s|0,jUe(s)|0&&GUe(s)}function GUe(s){s=s|0;var l=0;l=s+8|0,n[l>>2]|0&&(Y7(l)|0)!=-1||ef[n[(n[s>>2]|0)+16>>2]&127](s)}function Yt(s){s=s|0;var l=0;for(l=s|0?s:1;s=_D(l)|0,!(s|0);){if(s=YUe()|0,!s){s=0;break}aW[s&0]()}return s|0}function V7(s){return s=s|0,Yt(s)|0}function yt(s){s=s|0,HD(s)}function WUe(s){s=s|0,(o[s+11>>0]|0)<0&&yt(n[s>>2]|0)}function YUe(){var s=0;return s=n[2923]|0,n[2923]=s+0,s|0}function VUe(){}function jD(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,f=l-f-(c>>>0>s>>>0|0)>>>0,Ce=f,s-c>>>0|0|0}function cT(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,c=s+c>>>0,Ce=l+f+(c>>>0>>0|0)>>>0,c|0|0}function sm(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;if(m=s+c|0,l=l&255,(c|0)>=67){for(;s&3;)o[s>>0]=l,s=s+1|0;for(f=m&-4|0,d=f-64|0,B=l|l<<8|l<<16|l<<24;(s|0)<=(d|0);)n[s>>2]=B,n[s+4>>2]=B,n[s+8>>2]=B,n[s+12>>2]=B,n[s+16>>2]=B,n[s+20>>2]=B,n[s+24>>2]=B,n[s+28>>2]=B,n[s+32>>2]=B,n[s+36>>2]=B,n[s+40>>2]=B,n[s+44>>2]=B,n[s+48>>2]=B,n[s+52>>2]=B,n[s+56>>2]=B,n[s+60>>2]=B,s=s+64|0;for(;(s|0)<(f|0);)n[s>>2]=B,s=s+4|0}for(;(s|0)<(m|0);)o[s>>0]=l,s=s+1|0;return m-c|0}function K7(s,l,c){return s=s|0,l=l|0,c=c|0,(c|0)<32?(Ce=l<>>32-c,s<>>c,s>>>c|(l&(1<>>c-32|0)}function br(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;if((c|0)>=8192)return FA(s|0,l|0,c|0)|0;if(m=s|0,d=s+c|0,(s&3)==(l&3)){for(;s&3;){if(!c)return m|0;o[s>>0]=o[l>>0]|0,s=s+1|0,l=l+1|0,c=c-1|0}for(c=d&-4|0,f=c-64|0;(s|0)<=(f|0);)n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=n[l+8>>2],n[s+12>>2]=n[l+12>>2],n[s+16>>2]=n[l+16>>2],n[s+20>>2]=n[l+20>>2],n[s+24>>2]=n[l+24>>2],n[s+28>>2]=n[l+28>>2],n[s+32>>2]=n[l+32>>2],n[s+36>>2]=n[l+36>>2],n[s+40>>2]=n[l+40>>2],n[s+44>>2]=n[l+44>>2],n[s+48>>2]=n[l+48>>2],n[s+52>>2]=n[l+52>>2],n[s+56>>2]=n[l+56>>2],n[s+60>>2]=n[l+60>>2],s=s+64|0,l=l+64|0;for(;(s|0)<(c|0);)n[s>>2]=n[l>>2],s=s+4|0,l=l+4|0}else for(c=d-4|0;(s|0)<(c|0);)o[s>>0]=o[l>>0]|0,o[s+1>>0]=o[l+1>>0]|0,o[s+2>>0]=o[l+2>>0]|0,o[s+3>>0]=o[l+3>>0]|0,s=s+4|0,l=l+4|0;for(;(s|0)<(d|0);)o[s>>0]=o[l>>0]|0,s=s+1|0,l=l+1|0;return m|0}function J7(s){s=s|0;var l=0;return l=o[N+(s&255)>>0]|0,(l|0)<8?l|0:(l=o[N+(s>>8&255)>>0]|0,(l|0)<8?l+8|0:(l=o[N+(s>>16&255)>>0]|0,(l|0)<8?l+16|0:(o[N+(s>>>24)>>0]|0)+24|0))}function z7(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,F=0,M=0,O=0,j=0,oe=0,We=0,Oe=0;if(O=s,F=l,M=F,B=c,oe=f,k=oe,!M)return m=(d|0)!=0,k?m?(n[d>>2]=s|0,n[d+4>>2]=l&0,oe=0,d=0,Ce=oe,d|0):(oe=0,d=0,Ce=oe,d|0):(m&&(n[d>>2]=(O>>>0)%(B>>>0),n[d+4>>2]=0),oe=0,d=(O>>>0)/(B>>>0)>>>0,Ce=oe,d|0);m=(k|0)==0;do if(B){if(!m){if(m=(P(k|0)|0)-(P(M|0)|0)|0,m>>>0<=31){j=m+1|0,k=31-m|0,l=m-31>>31,B=j,s=O>>>(j>>>0)&l|M<>>(j>>>0)&l,m=0,k=O<>2]=s|0,n[d+4>>2]=F|l&0,oe=0,d=0,Ce=oe,d|0):(oe=0,d=0,Ce=oe,d|0)}if(m=B-1|0,m&B|0){k=(P(B|0)|0)+33-(P(M|0)|0)|0,Oe=64-k|0,j=32-k|0,F=j>>31,We=k-32|0,l=We>>31,B=k,s=j-1>>31&M>>>(We>>>0)|(M<>>(k>>>0))&l,l=l&M>>>(k>>>0),m=O<>>(We>>>0))&F|O<>31;break}return d|0&&(n[d>>2]=m&O,n[d+4>>2]=0),(B|0)==1?(We=F|l&0,Oe=s|0|0,Ce=We,Oe|0):(Oe=J7(B|0)|0,We=M>>>(Oe>>>0)|0,Oe=M<<32-Oe|O>>>(Oe>>>0)|0,Ce=We,Oe|0)}else{if(m)return d|0&&(n[d>>2]=(M>>>0)%(B>>>0),n[d+4>>2]=0),We=0,Oe=(M>>>0)/(B>>>0)>>>0,Ce=We,Oe|0;if(!O)return d|0&&(n[d>>2]=0,n[d+4>>2]=(M>>>0)%(k>>>0)),We=0,Oe=(M>>>0)/(k>>>0)>>>0,Ce=We,Oe|0;if(m=k-1|0,!(m&k))return d|0&&(n[d>>2]=s|0,n[d+4>>2]=m&M|l&0),We=0,Oe=M>>>((J7(k|0)|0)>>>0),Ce=We,Oe|0;if(m=(P(k|0)|0)-(P(M|0)|0)|0,m>>>0<=30){l=m+1|0,k=31-m|0,B=l,s=M<>>(l>>>0),l=M>>>(l>>>0),m=0,k=O<>2]=s|0,n[d+4>>2]=F|l&0,We=0,Oe=0,Ce=We,Oe|0):(We=0,Oe=0,Ce=We,Oe|0)}while(!1);if(!B)M=k,F=0,k=0;else{j=c|0|0,O=oe|f&0,M=cT(j|0,O|0,-1,-1)|0,c=Ce,F=k,k=0;do f=F,F=m>>>31|F<<1,m=k|m<<1,f=s<<1|f>>>31|0,oe=s>>>31|l<<1|0,jD(M|0,c|0,f|0,oe|0)|0,Oe=Ce,We=Oe>>31|((Oe|0)<0?-1:0)<<1,k=We&1,s=jD(f|0,oe|0,We&j|0,(((Oe|0)<0?-1:0)>>31|((Oe|0)<0?-1:0)<<1)&O|0)|0,l=Ce,B=B-1|0;while(B|0);M=F,F=0}return B=0,d|0&&(n[d>>2]=s,n[d+4>>2]=l),We=(m|0)>>>31|(M|B)<<1|(B<<1|m>>>31)&0|F,Oe=(m<<1|0)&-2|k,Ce=We,Oe|0}function uT(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,z7(s,l,c,f,0)|0}function Tp(s){s=s|0;var l=0,c=0;return c=s+15&-16|0,l=n[w>>2]|0,s=l+c|0,(c|0)>0&(s|0)<(l|0)|(s|0)<0?(se()|0,yc(12),-1):(n[w>>2]=s,(s|0)>($()|0)&&!(X()|0)?(n[w>>2]=l,yc(12),-1):l|0)}function rw(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;if((l|0)<(s|0)&(s|0)<(l+c|0)){for(f=s,l=l+c|0,s=s+c|0;(c|0)>0;)s=s-1|0,l=l-1|0,c=c-1|0,o[s>>0]=o[l>>0]|0;s=f}else br(s,l,c)|0;return s|0}function AT(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;return m=C,C=C+16|0,d=m|0,z7(s,l,c,f,d)|0,C=m,Ce=n[d+4>>2]|0,n[d>>2]|0|0}function X7(s){return s=s|0,(s&255)<<24|(s>>8&255)<<16|(s>>16&255)<<8|s>>>24|0}function KUe(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,Z7[s&1](l|0,c|0,f|0,d|0,m|0)}function JUe(s,l,c){s=s|0,l=l|0,c=y(c),$7[s&1](l|0,y(c))}function zUe(s,l,c){s=s|0,l=l|0,c=+c,eW[s&31](l|0,+c)}function XUe(s,l,c,f){return s=s|0,l=l|0,c=y(c),f=y(f),y(tW[s&0](l|0,y(c),y(f)))}function ZUe(s,l){s=s|0,l=l|0,ef[s&127](l|0)}function $Ue(s,l,c){s=s|0,l=l|0,c=c|0,tf[s&31](l|0,c|0)}function e3e(s,l){return s=s|0,l=l|0,_0[s&31](l|0)|0}function t3e(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0,rW[s&1](l|0,+c,+f,d|0)}function r3e(s,l,c,f){s=s|0,l=l|0,c=+c,f=+f,N3e[s&1](l|0,+c,+f)}function n3e(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,YD[s&7](l|0,c|0,f|0)|0}function i3e(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,+O3e[s&1](l|0,c|0,f|0)}function s3e(s,l){return s=s|0,l=l|0,+nW[s&15](l|0)}function o3e(s,l,c){return s=s|0,l=l|0,c=+c,M3e[s&1](l|0,+c)|0}function a3e(s,l,c){return s=s|0,l=l|0,c=c|0,pT[s&15](l|0,c|0)|0}function l3e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=+f,d=+d,m=m|0,U3e[s&1](l|0,c|0,+f,+d,m|0)}function c3e(s,l,c,f,d,m,B){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0,_3e[s&1](l|0,c|0,f|0,d|0,m|0,B|0)}function u3e(s,l,c){return s=s|0,l=l|0,c=c|0,+iW[s&7](l|0,c|0)}function A3e(s){return s=s|0,VD[s&7]()|0}function f3e(s,l,c,f,d,m){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,sW[s&1](l|0,c|0,f|0,d|0,m|0)|0}function p3e(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=+d,H3e[s&1](l|0,c|0,f|0,+d)}function h3e(s,l,c,f,d,m,B){s=s|0,l=l|0,c=c|0,f=y(f),d=d|0,m=y(m),B=B|0,oW[s&1](l|0,c|0,y(f),d|0,y(m),B|0)}function g3e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,sw[s&15](l|0,c|0,f|0)}function d3e(s){s=s|0,aW[s&0]()}function m3e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f,lW[s&15](l|0,c|0,+f)}function y3e(s,l,c){return s=s|0,l=+l,c=+c,q3e[s&1](+l,+c)|0}function E3e(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,hT[s&15](l|0,c|0,f|0,d|0)}function C3e(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,R(0)}function I3e(s,l){s=s|0,l=y(l),R(1)}function Ca(s,l){s=s|0,l=+l,R(2)}function w3e(s,l,c){return s=s|0,l=y(l),c=y(c),R(3),Ze}function Cr(s){s=s|0,R(4)}function nw(s,l){s=s|0,l=l|0,R(5)}function tl(s){return s=s|0,R(6),0}function B3e(s,l,c,f){s=s|0,l=+l,c=+c,f=f|0,R(7)}function v3e(s,l,c){s=s|0,l=+l,c=+c,R(8)}function D3e(s,l,c){return s=s|0,l=l|0,c=c|0,R(9),0}function S3e(s,l,c){return s=s|0,l=l|0,c=c|0,R(10),0}function U0(s){return s=s|0,R(11),0}function P3e(s,l){return s=s|0,l=+l,R(12),0}function iw(s,l){return s=s|0,l=l|0,R(13),0}function x3e(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0,R(14)}function b3e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,R(15)}function fT(s,l){return s=s|0,l=l|0,R(16),0}function k3e(){return R(17),0}function Q3e(s,l,c,f,d){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,R(18),0}function F3e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f,R(19)}function R3e(s,l,c,f,d,m){s=s|0,l=l|0,c=y(c),f=f|0,d=y(d),m=m|0,R(20)}function WD(s,l,c){s=s|0,l=l|0,c=c|0,R(21)}function T3e(){R(22)}function om(s,l,c){s=s|0,l=l|0,c=+c,R(23)}function L3e(s,l){return s=+s,l=+l,R(24),0}function am(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,R(25)}var Z7=[C3e,QNe],$7=[I3e,Od],eW=[Ca,B0,vp,UI,_I,HI,qI,ku,Wd,jI,Qu,v0,D0,GI,WI,bc,S0,YI,Yd,Ca,Ca,Ca,Ca,Ca,Ca,Ca,Ca,Ca,Ca,Ca,Ca,Ca],tW=[w3e],ef=[Cr,im,ADe,fDe,pDe,qxe,jxe,Gxe,oLe,aLe,lLe,yNe,ENe,CNe,_4e,H4e,q4e,qa,w0,LI,ir,bl,bD,kD,tDe,IDe,RDe,XDe,pSe,kSe,VSe,lPe,BPe,UPe,txe,mxe,Rxe,abe,Bbe,Ube,tke,mke,Rke,Zke,pQe,PQe,jQe,dD,CFe,NFe,tRe,ERe,TRe,tTe,ATe,hTe,QTe,TTe,XTe,uLe,pLe,kLe,KLe,M5,bOe,oMe,IMe,NMe,i4e,E4e,k4e,R4e,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr,Cr],tf=[nw,qd,YF,NI,OI,Pr,Os,Oi,ms,is,Gd,Bp,KI,ID,b0,JF,zF,wD,BD,$F,Fu,ne,rQe,dQe,BRe,FOe,rNe,w7,nw,nw,nw,nw],_0=[tl,mUe,_d,x0,Kd,qo,mD,Dp,VI,KF,ED,Jd,vD,eR,Zd,YQe,MRe,RLe,NOe,Za,tl,tl,tl,tl,tl,tl,tl,tl,tl,tl,tl,tl],rW=[B3e,sR],N3e=[v3e,eLe],YD=[D3e,N7,yUe,IUe,TSe,Abe,vFe,_Me],O3e=[S3e,sxe],nW=[U0,Sp,CD,JA,oR,v,S,Q,H,Y,U0,U0,U0,U0,U0,U0],M3e=[P3e,lTe],pT=[iw,qUe,DD,sDe,tSe,zSe,APe,Oxe,Pbe,QQe,Md,DMe,iw,iw,iw,iw],U3e=[x3e,ODe],_3e=[b3e,l4e],iW=[fT,XF,Be,Ue,ft,Ixe,fT,fT],VD=[k3e,jt,Ud,gD,yTe,MTe,mLe,O4e],sW=[Q3e,kd],H3e=[F3e,ske],oW=[R3e,tR],sw=[WD,oo,yD,ZF,Qc,mSe,SPe,Ike,Oke,WF,eOe,uMe,B4e,WD,WD,WD],aW=[T3e],lW=[om,VF,jd,KA,MI,kc,Vd,P0,jbe,_Fe,iTe,om,om,om,om,om],q3e=[L3e,iLe],hT=[am,jPe,eFe,sRe,VRe,vTe,GTe,vLe,$Le,qOe,K4e,am,am,am,am,am];return{_llvm_bswap_i32:X7,dynCall_idd:y3e,dynCall_i:A3e,_i64Subtract:jD,___udivdi3:uT,dynCall_vif:JUe,setThrew:No,dynCall_viii:g3e,_bitshift64Lshr:GD,_bitshift64Shl:K7,dynCall_vi:ZUe,dynCall_viiddi:l3e,dynCall_diii:i3e,dynCall_iii:a3e,_memset:sm,_sbrk:Tp,_memcpy:br,__GLOBAL__sub_I_Yoga_cpp:FI,dynCall_vii:$Ue,___uremdi3:AT,dynCall_vid:zUe,stackAlloc:ca,_nbind_init:sUe,getTempRet0:TA,dynCall_di:s3e,dynCall_iid:o3e,setTempRet0:RA,_i64Add:cT,dynCall_fiff:XUe,dynCall_iiii:n3e,_emscripten_get_global_libc:dUe,dynCall_viid:m3e,dynCall_viiid:p3e,dynCall_viififi:h3e,dynCall_ii:e3e,__GLOBAL__sub_I_Binding_cc:IOe,dynCall_viiii:E3e,dynCall_iiiiii:f3e,stackSave:mu,dynCall_viiiii:KUe,__GLOBAL__sub_I_nbind_cc:wr,dynCall_vidd:r3e,_free:HD,runPostSets:VUe,dynCall_viiiiii:c3e,establishStackSpace:dn,_memmove:rw,stackRestore:Bl,_malloc:_D,__GLOBAL__sub_I_common_cc:HLe,dynCall_viddi:t3e,dynCall_dii:u3e,dynCall_v:d3e}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer),_llvm_bswap_i32=Module._llvm_bswap_i32=asm._llvm_bswap_i32,getTempRet0=Module.getTempRet0=asm.getTempRet0,___udivdi3=Module.___udivdi3=asm.___udivdi3,setThrew=Module.setThrew=asm.setThrew,_bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,_bitshift64Shl=Module._bitshift64Shl=asm._bitshift64Shl,_memset=Module._memset=asm._memset,_sbrk=Module._sbrk=asm._sbrk,_memcpy=Module._memcpy=asm._memcpy,stackAlloc=Module.stackAlloc=asm.stackAlloc,___uremdi3=Module.___uremdi3=asm.___uremdi3,_nbind_init=Module._nbind_init=asm._nbind_init,_i64Subtract=Module._i64Subtract=asm._i64Subtract,setTempRet0=Module.setTempRet0=asm.setTempRet0,_i64Add=Module._i64Add=asm._i64Add,_emscripten_get_global_libc=Module._emscripten_get_global_libc=asm._emscripten_get_global_libc,__GLOBAL__sub_I_Yoga_cpp=Module.__GLOBAL__sub_I_Yoga_cpp=asm.__GLOBAL__sub_I_Yoga_cpp,__GLOBAL__sub_I_Binding_cc=Module.__GLOBAL__sub_I_Binding_cc=asm.__GLOBAL__sub_I_Binding_cc,stackSave=Module.stackSave=asm.stackSave,__GLOBAL__sub_I_nbind_cc=Module.__GLOBAL__sub_I_nbind_cc=asm.__GLOBAL__sub_I_nbind_cc,_free=Module._free=asm._free,runPostSets=Module.runPostSets=asm.runPostSets,establishStackSpace=Module.establishStackSpace=asm.establishStackSpace,_memmove=Module._memmove=asm._memmove,stackRestore=Module.stackRestore=asm.stackRestore,_malloc=Module._malloc=asm._malloc,__GLOBAL__sub_I_common_cc=Module.__GLOBAL__sub_I_common_cc=asm.__GLOBAL__sub_I_common_cc,dynCall_viiiii=Module.dynCall_viiiii=asm.dynCall_viiiii,dynCall_vif=Module.dynCall_vif=asm.dynCall_vif,dynCall_vid=Module.dynCall_vid=asm.dynCall_vid,dynCall_fiff=Module.dynCall_fiff=asm.dynCall_fiff,dynCall_vi=Module.dynCall_vi=asm.dynCall_vi,dynCall_vii=Module.dynCall_vii=asm.dynCall_vii,dynCall_ii=Module.dynCall_ii=asm.dynCall_ii,dynCall_viddi=Module.dynCall_viddi=asm.dynCall_viddi,dynCall_vidd=Module.dynCall_vidd=asm.dynCall_vidd,dynCall_iiii=Module.dynCall_iiii=asm.dynCall_iiii,dynCall_diii=Module.dynCall_diii=asm.dynCall_diii,dynCall_di=Module.dynCall_di=asm.dynCall_di,dynCall_iid=Module.dynCall_iid=asm.dynCall_iid,dynCall_iii=Module.dynCall_iii=asm.dynCall_iii,dynCall_viiddi=Module.dynCall_viiddi=asm.dynCall_viiddi,dynCall_viiiiii=Module.dynCall_viiiiii=asm.dynCall_viiiiii,dynCall_dii=Module.dynCall_dii=asm.dynCall_dii,dynCall_i=Module.dynCall_i=asm.dynCall_i,dynCall_iiiiii=Module.dynCall_iiiiii=asm.dynCall_iiiiii,dynCall_viiid=Module.dynCall_viiid=asm.dynCall_viiid,dynCall_viififi=Module.dynCall_viififi=asm.dynCall_viififi,dynCall_viii=Module.dynCall_viii=asm.dynCall_viii,dynCall_v=Module.dynCall_v=asm.dynCall_v,dynCall_viid=Module.dynCall_viid=asm.dynCall_viid,dynCall_idd=Module.dynCall_idd=asm.dynCall_idd,dynCall_viiii=Module.dynCall_viiii=asm.dynCall_viiii;Runtime.stackAlloc=Module.stackAlloc,Runtime.stackSave=Module.stackSave,Runtime.stackRestore=Module.stackRestore,Runtime.establishStackSpace=Module.establishStackSpace,Runtime.setTempRet0=Module.setTempRet0,Runtime.getTempRet0=Module.getTempRet0,Module.asm=asm;function ExitStatus(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function t(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=t)},Module.callMain=Module.callMain=function t(e){e=e||[],ensureInitRuntime();var r=e.length+1;function o(){for(var p=0;p<3;p++)a.push(0)}var a=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];o();for(var n=0;n0||(preRun(),runDependencies>0)||Module.calledRun)return;function e(){Module.calledRun||(Module.calledRun=!0,!ABORT&&(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(t),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),e()},1)):e()}Module.run=Module.run=run;function exit(t,e){e&&Module.noExitRuntime||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=t,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(t)),ENVIRONMENT_IS_NODE&&process.exit(t),Module.quit(t,new ExitStatus(t)))}Module.exit=Module.exit=exit;var abortDecorators=[];function abort(t){Module.onAbort&&Module.onAbort(t),t!==void 0?(Module.print(t),Module.printErr(t),t=JSON.stringify(t)):t="",ABORT=!0,EXITSTATUS=1;var e=` -If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,r="abort("+t+") at "+stackTrace()+e;throw abortDecorators&&abortDecorators.forEach(function(o){r=o(r,t)}),r}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var id=_((nVt,PCe)=>{"use strict";var byt=DCe(),kyt=SCe(),pq=!1,hq=null;kyt({},function(t,e){if(!pq){if(pq=!0,t)throw t;hq=e}});if(!pq)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");PCe.exports=byt(hq.bind,hq.lib)});var dq=_((iVt,gq)=>{"use strict";var xCe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);gq.exports=xCe;gq.exports.default=xCe});var kCe=_((sVt,bCe)=>{"use strict";bCe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var SB=_((oVt,mq)=>{"use strict";var Qyt=hP(),Fyt=dq(),Ryt=kCe(),QCe=t=>{if(typeof t!="string"||t.length===0||(t=Qyt(t),t.length===0))return 0;t=t.replace(Ryt()," ");let e=0;for(let r=0;r=127&&o<=159||o>=768&&o<=879||(o>65535&&r++,e+=Fyt(o)?2:1)}return e};mq.exports=QCe;mq.exports.default=QCe});var Eq=_((aVt,yq)=>{"use strict";var Tyt=SB(),FCe=t=>{let e=0;for(let r of t.split(` -`))e=Math.max(e,Tyt(r));return e};yq.exports=FCe;yq.exports.default=FCe});var RCe=_(PB=>{"use strict";var Lyt=PB&&PB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(PB,"__esModule",{value:!0});var Nyt=Lyt(Eq()),Cq={};PB.default=t=>{if(t.length===0)return{width:0,height:0};if(Cq[t])return Cq[t];let e=Nyt.default(t),r=t.split(` -`).length;return Cq[t]={width:e,height:r},{width:e,height:r}}});var TCe=_(xB=>{"use strict";var Oyt=xB&&xB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xB,"__esModule",{value:!0});var In=Oyt(id()),Myt=(t,e)=>{"position"in e&&t.setPositionType(e.position==="absolute"?In.default.POSITION_TYPE_ABSOLUTE:In.default.POSITION_TYPE_RELATIVE)},Uyt=(t,e)=>{"marginLeft"in e&&t.setMargin(In.default.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(In.default.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(In.default.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(In.default.EDGE_BOTTOM,e.marginBottom||0)},_yt=(t,e)=>{"paddingLeft"in e&&t.setPadding(In.default.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(In.default.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(In.default.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(In.default.EDGE_BOTTOM,e.paddingBottom||0)},Hyt=(t,e)=>{var r;"flexGrow"in e&&t.setFlexGrow((r=e.flexGrow)!==null&&r!==void 0?r:0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(In.default.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(In.default.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(In.default.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(In.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(In.default.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(In.default.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(In.default.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(In.default.ALIGN_FLEX_END)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(In.default.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(In.default.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(In.default.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(In.default.ALIGN_FLEX_END)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(In.default.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(In.default.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(In.default.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(In.default.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(In.default.JUSTIFY_SPACE_AROUND))},qyt=(t,e)=>{var r,o;"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth((r=e.minWidth)!==null&&r!==void 0?r:0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight((o=e.minHeight)!==null&&o!==void 0?o:0))},jyt=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?In.default.DISPLAY_FLEX:In.default.DISPLAY_NONE)},Gyt=(t,e)=>{if("borderStyle"in e){let r=typeof e.borderStyle=="string"?1:0;t.setBorder(In.default.EDGE_TOP,r),t.setBorder(In.default.EDGE_BOTTOM,r),t.setBorder(In.default.EDGE_LEFT,r),t.setBorder(In.default.EDGE_RIGHT,r)}};xB.default=(t,e={})=>{Myt(t,e),Uyt(t,e),_yt(t,e),Hyt(t,e),qyt(t,e),jyt(t,e),Gyt(t,e)}});var OCe=_((uVt,NCe)=>{"use strict";var bB=SB(),Wyt=hP(),Yyt=qw(),wq=new Set(["\x1B","\x9B"]),Vyt=39,LCe=t=>`${wq.values().next().value}[${t}m`,Kyt=t=>t.split(" ").map(e=>bB(e)),Iq=(t,e,r)=>{let o=[...e],a=!1,n=bB(Wyt(t[t.length-1]));for(let[u,A]of o.entries()){let p=bB(A);if(n+p<=r?t[t.length-1]+=A:(t.push(A),n=0),wq.has(A))a=!0;else if(a&&A==="m"){a=!1;continue}a||(n+=p,n===r&&u0&&t.length>1&&(t[t.length-2]+=t.pop())},Jyt=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(bB(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},zyt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let o="",a="",n,u=Kyt(t),A=[""];for(let[p,h]of t.split(" ").entries()){r.trim!==!1&&(A[A.length-1]=A[A.length-1].trimLeft());let E=bB(A[A.length-1]);if(p!==0&&(E>=e&&(r.wordWrap===!1||r.trim===!1)&&(A.push(""),E=0),(E>0||r.trim===!1)&&(A[A.length-1]+=" ",E++)),r.hard&&u[p]>e){let w=e-E,D=1+Math.floor((u[p]-w-1)/e);Math.floor((u[p]-1)/e)e&&E>0&&u[p]>0){if(r.wordWrap===!1&&Ee&&r.wordWrap===!1){Iq(A,h,e);continue}A[A.length-1]+=h}r.trim!==!1&&(A=A.map(Jyt)),o=A.join(` -`);for(let[p,h]of[...o].entries()){if(a+=h,wq.has(h)){let w=parseFloat(/\d[^m]*/.exec(o.slice(p,p+4)));n=w===Vyt?null:w}let E=Yyt.codes.get(Number(n));n&&E&&(o[p+1]===` -`?a+=LCe(E):h===` -`&&(a+=LCe(n)))}return a};NCe.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,` -`).split(` -`).map(o=>zyt(o,e,r)).join(` -`)});var _Ce=_((AVt,UCe)=>{"use strict";var MCe="[\uD800-\uDBFF][\uDC00-\uDFFF]",Xyt=t=>t&&t.exact?new RegExp(`^${MCe}$`):new RegExp(MCe,"g");UCe.exports=Xyt});var Bq=_((fVt,GCe)=>{"use strict";var Zyt=dq(),$yt=_Ce(),HCe=qw(),jCe=["\x1B","\x9B"],vQ=t=>`${jCe[0]}[${t}m`,qCe=(t,e,r)=>{let o=[];t=[...t];for(let a of t){let n=a;a.match(";")&&(a=a.split(";")[0][0]+"0");let u=HCe.codes.get(parseInt(a,10));if(u){let A=t.indexOf(u.toString());A>=0?t.splice(A,1):o.push(vQ(e?u:n))}else if(e){o.push(vQ(0));break}else o.push(vQ(n))}if(e&&(o=o.filter((a,n)=>o.indexOf(a)===n),r!==void 0)){let a=vQ(HCe.codes.get(parseInt(r,10)));o=o.reduce((n,u)=>u===a?[u,...n]:[...n,u],[])}return o.join("")};GCe.exports=(t,e,r)=>{let o=[...t.normalize()],a=[];r=typeof r=="number"?r:o.length;let n=!1,u,A=0,p="";for(let[h,E]of o.entries()){let w=!1;if(jCe.includes(E)){let D=/\d[^m]*/.exec(t.slice(h,h+18));u=D&&D.length>0?D[0]:void 0,Ae&&A<=r)p+=E;else if(A===e&&!n&&u!==void 0)p=qCe(a);else if(A>=r){p+=qCe(a,!0,u);break}}return p}});var YCe=_((pVt,WCe)=>{"use strict";var _h=Bq(),eEt=SB();function DQ(t,e,r){if(t.charAt(e)===" ")return e;for(let o=1;o<=3;o++)if(r){if(t.charAt(e+o)===" ")return e+o}else if(t.charAt(e-o)===" ")return e-o;return e}WCe.exports=(t,e,r)=>{r={position:"end",preferTruncationOnSpace:!1,...r};let{position:o,space:a,preferTruncationOnSpace:n}=r,u="\u2026",A=1;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof e}`);if(e<1)return"";if(e===1)return u;let p=eEt(t);if(p<=e)return t;if(o==="start"){if(n){let h=DQ(t,p-e+1,!0);return u+_h(t,h,p).trim()}return a===!0&&(u+=" ",A=2),u+_h(t,p-e+A,p)}if(o==="middle"){a===!0&&(u=" "+u+" ",A=3);let h=Math.floor(e/2);if(n){let E=DQ(t,h),w=DQ(t,p-(e-h)+1,!0);return _h(t,0,E)+u+_h(t,w,p).trim()}return _h(t,0,h)+u+_h(t,p-(e-h)+A,p)}if(o==="end"){if(n){let h=DQ(t,e-1);return _h(t,0,h)+u}return a===!0&&(u=" "+u,A=2),_h(t,0,e-A)+u}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${o}`)}});var Dq=_(kB=>{"use strict";var VCe=kB&&kB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kB,"__esModule",{value:!0});var tEt=VCe(OCe()),rEt=VCe(YCe()),vq={};kB.default=(t,e,r)=>{let o=t+String(e)+String(r);if(vq[o])return vq[o];let a=t;if(r==="wrap"&&(a=tEt.default(t,e,{trim:!1,hard:!0})),r.startsWith("truncate")){let n="end";r==="truncate-middle"&&(n="middle"),r==="truncate-start"&&(n="start"),a=rEt.default(t,e,{position:n})}return vq[o]=a,a}});var Pq=_(Sq=>{"use strict";Object.defineProperty(Sq,"__esModule",{value:!0});var KCe=t=>{let e="";if(t.childNodes.length>0)for(let r of t.childNodes){let o="";r.nodeName==="#text"?o=r.nodeValue:((r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text")&&(o=KCe(r)),o.length>0&&typeof r.internal_transform=="function"&&(o=r.internal_transform(o))),e+=o}return e};Sq.default=KCe});var xq=_(Ei=>{"use strict";var QB=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.setTextNodeValue=Ei.createTextNode=Ei.setStyle=Ei.setAttribute=Ei.removeChildNode=Ei.insertBeforeNode=Ei.appendChildNode=Ei.createNode=Ei.TEXT_NAME=void 0;var nEt=QB(id()),JCe=QB(RCe()),iEt=QB(TCe()),sEt=QB(Dq()),oEt=QB(Pq());Ei.TEXT_NAME="#text";Ei.createNode=t=>{var e;let r={nodeName:t,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:t==="ink-virtual-text"?void 0:nEt.default.Node.create()};return t==="ink-text"&&((e=r.yogaNode)===null||e===void 0||e.setMeasureFunc(aEt.bind(null,r))),r};Ei.appendChildNode=(t,e)=>{var r;e.parentNode&&Ei.removeChildNode(e.parentNode,e),e.parentNode=t,t.childNodes.push(e),e.yogaNode&&((r=t.yogaNode)===null||r===void 0||r.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&SQ(t)};Ei.insertBeforeNode=(t,e,r)=>{var o,a;e.parentNode&&Ei.removeChildNode(e.parentNode,e),e.parentNode=t;let n=t.childNodes.indexOf(r);if(n>=0){t.childNodes.splice(n,0,e),e.yogaNode&&((o=t.yogaNode)===null||o===void 0||o.insertChild(e.yogaNode,n));return}t.childNodes.push(e),e.yogaNode&&((a=t.yogaNode)===null||a===void 0||a.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&SQ(t)};Ei.removeChildNode=(t,e)=>{var r,o;e.yogaNode&&((o=(r=e.parentNode)===null||r===void 0?void 0:r.yogaNode)===null||o===void 0||o.removeChild(e.yogaNode)),e.parentNode=null;let a=t.childNodes.indexOf(e);a>=0&&t.childNodes.splice(a,1),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&SQ(t)};Ei.setAttribute=(t,e,r)=>{t.attributes[e]=r};Ei.setStyle=(t,e)=>{t.style=e,t.yogaNode&&iEt.default(t.yogaNode,e)};Ei.createTextNode=t=>{let e={nodeName:"#text",nodeValue:t,yogaNode:void 0,parentNode:null,style:{}};return Ei.setTextNodeValue(e,t),e};var aEt=function(t,e){var r,o;let a=t.nodeName==="#text"?t.nodeValue:oEt.default(t),n=JCe.default(a);if(n.width<=e||n.width>=1&&e>0&&e<1)return n;let u=(o=(r=t.style)===null||r===void 0?void 0:r.textWrap)!==null&&o!==void 0?o:"wrap",A=sEt.default(a,e,u);return JCe.default(A)},zCe=t=>{var e;if(!(!t||!t.parentNode))return(e=t.yogaNode)!==null&&e!==void 0?e:zCe(t.parentNode)},SQ=t=>{let e=zCe(t);e?.markDirty()};Ei.setTextNodeValue=(t,e)=>{typeof e!="string"&&(e=String(e)),t.nodeValue=e,SQ(t)}});var tIe=_(FB=>{"use strict";var eIe=FB&&FB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(FB,"__esModule",{value:!0});var XCe=uq(),lEt=eIe(ECe()),ZCe=eIe(id()),ko=xq(),$Ce=t=>{t?.unsetMeasureFunc(),t?.freeRecursive()};FB.default=lEt.default({schedulePassiveEffects:XCe.unstable_scheduleCallback,cancelPassiveEffects:XCe.unstable_cancelCallback,now:Date.now,getRootHostContext:()=>({isInsideText:!1}),prepareForCommit:()=>null,preparePortalMount:()=>null,clearContainer:()=>!1,shouldDeprioritizeSubtree:()=>!1,resetAfterCommit:t=>{if(t.isStaticDirty){t.isStaticDirty=!1,typeof t.onImmediateRender=="function"&&t.onImmediateRender();return}typeof t.onRender=="function"&&t.onRender()},getChildHostContext:(t,e)=>{let r=t.isInsideText,o=e==="ink-text"||e==="ink-virtual-text";return r===o?t:{isInsideText:o}},shouldSetTextContent:()=>!1,createInstance:(t,e,r,o)=>{if(o.isInsideText&&t==="ink-box")throw new Error(" can\u2019t be nested inside component");let a=t==="ink-text"&&o.isInsideText?"ink-virtual-text":t,n=ko.createNode(a);for(let[u,A]of Object.entries(e))u!=="children"&&(u==="style"?ko.setStyle(n,A):u==="internal_transform"?n.internal_transform=A:u==="internal_static"?n.internal_static=!0:ko.setAttribute(n,u,A));return n},createTextInstance:(t,e,r)=>{if(!r.isInsideText)throw new Error(`Text string "${t}" must be rendered inside component`);return ko.createTextNode(t)},resetTextContent:()=>{},hideTextInstance:t=>{ko.setTextNodeValue(t,"")},unhideTextInstance:(t,e)=>{ko.setTextNodeValue(t,e)},getPublicInstance:t=>t,hideInstance:t=>{var e;(e=t.yogaNode)===null||e===void 0||e.setDisplay(ZCe.default.DISPLAY_NONE)},unhideInstance:t=>{var e;(e=t.yogaNode)===null||e===void 0||e.setDisplay(ZCe.default.DISPLAY_FLEX)},appendInitialChild:ko.appendChildNode,appendChild:ko.appendChildNode,insertBefore:ko.insertBeforeNode,finalizeInitialChildren:(t,e,r,o)=>(t.internal_static&&(o.isStaticDirty=!0,o.staticNode=t),!1),supportsMutation:!0,appendChildToContainer:ko.appendChildNode,insertInContainerBefore:ko.insertBeforeNode,removeChildFromContainer:(t,e)=>{ko.removeChildNode(t,e),$Ce(e.yogaNode)},prepareUpdate:(t,e,r,o,a)=>{t.internal_static&&(a.isStaticDirty=!0);let n={},u=Object.keys(o);for(let A of u)if(o[A]!==r[A]){if(A==="style"&&typeof o.style=="object"&&typeof r.style=="object"){let h=o.style,E=r.style,w=Object.keys(h);for(let D of w){if(D==="borderStyle"||D==="borderColor"){if(typeof n.style!="object"){let b={};n.style=b}n.style.borderStyle=h.borderStyle,n.style.borderColor=h.borderColor}if(h[D]!==E[D]){if(typeof n.style!="object"){let b={};n.style=b}n.style[D]=h[D]}}continue}n[A]=o[A]}return n},commitUpdate:(t,e)=>{for(let[r,o]of Object.entries(e))r!=="children"&&(r==="style"?ko.setStyle(t,o):r==="internal_transform"?t.internal_transform=o:r==="internal_static"?t.internal_static=!0:ko.setAttribute(t,r,o))},commitTextUpdate:(t,e,r)=>{ko.setTextNodeValue(t,r)},removeChild:(t,e)=>{ko.removeChildNode(t,e),$Ce(e.yogaNode)}})});var nIe=_((yVt,rIe)=>{"use strict";rIe.exports=(t,e=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(e===0)return t;let o=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(o,r.indent.repeat(e))}});var iIe=_(RB=>{"use strict";var cEt=RB&&RB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(RB,"__esModule",{value:!0});var PQ=cEt(id());RB.default=t=>t.getComputedWidth()-t.getComputedPadding(PQ.default.EDGE_LEFT)-t.getComputedPadding(PQ.default.EDGE_RIGHT)-t.getComputedBorder(PQ.default.EDGE_LEFT)-t.getComputedBorder(PQ.default.EDGE_RIGHT)});var sIe=_((CVt,uEt)=>{uEt.exports={single:{topLeft:"\u250C",topRight:"\u2510",bottomRight:"\u2518",bottomLeft:"\u2514",vertical:"\u2502",horizontal:"\u2500"},double:{topLeft:"\u2554",topRight:"\u2557",bottomRight:"\u255D",bottomLeft:"\u255A",vertical:"\u2551",horizontal:"\u2550"},round:{topLeft:"\u256D",topRight:"\u256E",bottomRight:"\u256F",bottomLeft:"\u2570",vertical:"\u2502",horizontal:"\u2500"},bold:{topLeft:"\u250F",topRight:"\u2513",bottomRight:"\u251B",bottomLeft:"\u2517",vertical:"\u2503",horizontal:"\u2501"},singleDouble:{topLeft:"\u2553",topRight:"\u2556",bottomRight:"\u255C",bottomLeft:"\u2559",vertical:"\u2551",horizontal:"\u2500"},doubleSingle:{topLeft:"\u2552",topRight:"\u2555",bottomRight:"\u255B",bottomLeft:"\u2558",vertical:"\u2502",horizontal:"\u2550"},classic:{topLeft:"+",topRight:"+",bottomRight:"+",bottomLeft:"+",vertical:"|",horizontal:"-"}}});var aIe=_((IVt,bq)=>{"use strict";var oIe=sIe();bq.exports=oIe;bq.exports.default=oIe});var cIe=_((wVt,lIe)=>{"use strict";var AEt=(t,e,r)=>{let o=t.indexOf(e);if(o===-1)return t;let a=e.length,n=0,u="";do u+=t.substr(n,o-n)+e+r,n=o+a,o=t.indexOf(e,n);while(o!==-1);return u+=t.substr(n),u},fEt=(t,e,r,o)=>{let a=0,n="";do{let u=t[o-1]==="\r";n+=t.substr(a,(u?o-1:o)-a)+e+(u?`\r -`:` -`)+r,a=o+1,o=t.indexOf(` -`,a)}while(o!==-1);return n+=t.substr(a),n};lIe.exports={stringReplaceAll:AEt,stringEncaseCRLFWithFirstIndex:fEt}});var hIe=_((BVt,pIe)=>{"use strict";var pEt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,uIe=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,hEt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,gEt=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,dEt=new Map([["n",` -`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function fIe(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):dEt.get(t)||t}function mEt(t,e){let r=[],o=e.trim().split(/\s*,\s*/g),a;for(let n of o){let u=Number(n);if(!Number.isNaN(u))r.push(u);else if(a=n.match(hEt))r.push(a[2].replace(gEt,(A,p,h)=>p?fIe(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function yEt(t){uIe.lastIndex=0;let e=[],r;for(;(r=uIe.exec(t))!==null;){let o=r[1];if(r[2]){let a=mEt(o,r[2]);e.push([o].concat(a))}else e.push([o])}return e}function AIe(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let o=t;for(let[a,n]of Object.entries(r))if(Array.isArray(n)){if(!(a in o))throw new Error(`Unknown Chalk style: ${a}`);o=n.length>0?o[a](...n):o[a]}return o}pIe.exports=(t,e)=>{let r=[],o=[],a=[];if(e.replace(pEt,(n,u,A,p,h,E)=>{if(u)a.push(fIe(u));else if(p){let w=a.join("");a=[],o.push(r.length===0?w:AIe(t,r)(w)),r.push({inverse:A,styles:yEt(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");o.push(AIe(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),o.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return o.join("")}});var FQ=_((vVt,CIe)=>{"use strict";var TB=qw(),{stdout:Qq,stderr:Fq}=$L(),{stringReplaceAll:EEt,stringEncaseCRLFWithFirstIndex:CEt}=cIe(),{isArray:xQ}=Array,dIe=["ansi","ansi","ansi256","ansi16m"],DC=Object.create(null),IEt=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Qq?Qq.level:0;t.level=e.level===void 0?r:e.level},Rq=class{constructor(e){return mIe(e)}},mIe=t=>{let e={};return IEt(e,t),e.template=(...r)=>EIe(e.template,...r),Object.setPrototypeOf(e,bQ.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=Rq,e.template};function bQ(t){return mIe(t)}for(let[t,e]of Object.entries(TB))DC[t]={get(){let r=kQ(this,Tq(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};DC.visible={get(){let t=kQ(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var yIe=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of yIe)DC[t]={get(){let{level:e}=this;return function(...r){let o=Tq(TB.color[dIe[e]][t](...r),TB.color.close,this._styler);return kQ(this,o,this._isEmpty)}}};for(let t of yIe){let e="bg"+t[0].toUpperCase()+t.slice(1);DC[e]={get(){let{level:r}=this;return function(...o){let a=Tq(TB.bgColor[dIe[r]][t](...o),TB.bgColor.close,this._styler);return kQ(this,a,this._isEmpty)}}}}var wEt=Object.defineProperties(()=>{},{...DC,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),Tq=(t,e,r)=>{let o,a;return r===void 0?(o=t,a=e):(o=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:o,closeAll:a,parent:r}},kQ=(t,e,r)=>{let o=(...a)=>xQ(a[0])&&xQ(a[0].raw)?gIe(o,EIe(o,...a)):gIe(o,a.length===1?""+a[0]:a.join(" "));return Object.setPrototypeOf(o,wEt),o._generator=t,o._styler=e,o._isEmpty=r,o},gIe=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:o,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=EEt(e,r.close,r.open),r=r.parent;let n=e.indexOf(` -`);return n!==-1&&(e=CEt(e,a,o,n)),o+e+a},kq,EIe=(t,...e)=>{let[r]=e;if(!xQ(r)||!xQ(r.raw))return e.join(" ");let o=e.slice(1),a=[r.raw[0]];for(let n=1;n{"use strict";var BEt=NB&&NB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(NB,"__esModule",{value:!0});var LB=BEt(FQ()),vEt=/^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,DEt=/^(ansi|ansi256)\(\s?(\d+)\s?\)$/,RQ=(t,e)=>e==="foreground"?t:"bg"+t[0].toUpperCase()+t.slice(1);NB.default=(t,e,r)=>{if(!e)return t;if(e in LB.default){let a=RQ(e,r);return LB.default[a](t)}if(e.startsWith("#")){let a=RQ("hex",r);return LB.default[a](e)(t)}if(e.startsWith("ansi")){let a=DEt.exec(e);if(!a)return t;let n=RQ(a[1],r),u=Number(a[2]);return LB.default[n](u)(t)}if(e.startsWith("rgb")||e.startsWith("hsl")||e.startsWith("hsv")||e.startsWith("hwb")){let a=vEt.exec(e);if(!a)return t;let n=RQ(a[1],r),u=Number(a[2]),A=Number(a[3]),p=Number(a[4]);return LB.default[n](u,A,p)(t)}return t}});var wIe=_(OB=>{"use strict";var IIe=OB&&OB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(OB,"__esModule",{value:!0});var SEt=IIe(aIe()),Nq=IIe(Lq());OB.default=(t,e,r,o)=>{if(typeof r.style.borderStyle=="string"){let a=r.yogaNode.getComputedWidth(),n=r.yogaNode.getComputedHeight(),u=r.style.borderColor,A=SEt.default[r.style.borderStyle],p=Nq.default(A.topLeft+A.horizontal.repeat(a-2)+A.topRight,u,"foreground"),h=(Nq.default(A.vertical,u,"foreground")+` -`).repeat(n-2),E=Nq.default(A.bottomLeft+A.horizontal.repeat(a-2)+A.bottomRight,u,"foreground");o.write(t,e,p,{transformers:[]}),o.write(t,e+1,h,{transformers:[]}),o.write(t+a-1,e+1,h,{transformers:[]}),o.write(t,e+n-1,E,{transformers:[]})}}});var vIe=_(MB=>{"use strict";var sd=MB&&MB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(MB,"__esModule",{value:!0});var PEt=sd(id()),xEt=sd(Eq()),bEt=sd(nIe()),kEt=sd(Dq()),QEt=sd(iIe()),FEt=sd(Pq()),REt=sd(wIe()),TEt=(t,e)=>{var r;let o=(r=t.childNodes[0])===null||r===void 0?void 0:r.yogaNode;if(o){let a=o.getComputedLeft(),n=o.getComputedTop();e=` -`.repeat(n)+bEt.default(e,a)}return e},BIe=(t,e,r)=>{var o;let{offsetX:a=0,offsetY:n=0,transformers:u=[],skipStaticElements:A}=r;if(A&&t.internal_static)return;let{yogaNode:p}=t;if(p){if(p.getDisplay()===PEt.default.DISPLAY_NONE)return;let h=a+p.getComputedLeft(),E=n+p.getComputedTop(),w=u;if(typeof t.internal_transform=="function"&&(w=[t.internal_transform,...u]),t.nodeName==="ink-text"){let D=FEt.default(t);if(D.length>0){let b=xEt.default(D),C=QEt.default(p);if(b>C){let T=(o=t.style.textWrap)!==null&&o!==void 0?o:"wrap";D=kEt.default(D,C,T)}D=TEt(t,D),e.write(h,E,D,{transformers:w})}return}if(t.nodeName==="ink-box"&&REt.default(h,E,t,e),t.nodeName==="ink-root"||t.nodeName==="ink-box")for(let D of t.childNodes)BIe(D,e,{offsetX:h,offsetY:E,transformers:w,skipStaticElements:A})}};MB.default=BIe});var PIe=_(UB=>{"use strict";var SIe=UB&&UB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(UB,"__esModule",{value:!0});var DIe=SIe(Bq()),LEt=SIe(SB()),Oq=class{constructor(e){this.writes=[];let{width:r,height:o}=e;this.width=r,this.height=o}write(e,r,o,a){let{transformers:n}=a;o&&this.writes.push({x:e,y:r,text:o,transformers:n})}get(){let e=[];for(let o=0;oo.trimRight()).join(` -`),height:e.length}}};UB.default=Oq});var kIe=_(_B=>{"use strict";var Mq=_B&&_B.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_B,"__esModule",{value:!0});var NEt=Mq(id()),xIe=Mq(vIe()),bIe=Mq(PIe());_B.default=(t,e)=>{var r;if(t.yogaNode.setWidth(e),t.yogaNode){t.yogaNode.calculateLayout(void 0,void 0,NEt.default.DIRECTION_LTR);let o=new bIe.default({width:t.yogaNode.getComputedWidth(),height:t.yogaNode.getComputedHeight()});xIe.default(t,o,{skipStaticElements:!0});let a;!((r=t.staticNode)===null||r===void 0)&&r.yogaNode&&(a=new bIe.default({width:t.staticNode.yogaNode.getComputedWidth(),height:t.staticNode.yogaNode.getComputedHeight()}),xIe.default(t.staticNode,a,{skipStaticElements:!1}));let{output:n,height:u}=o.get();return{output:n,outputHeight:u,staticOutput:a?`${a.get().output} -`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var TIe=_((kVt,RIe)=>{"use strict";var QIe=ve("stream"),FIe=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],Uq={},OEt=t=>{let e=new QIe.PassThrough,r=new QIe.PassThrough;e.write=a=>t("stdout",a),r.write=a=>t("stderr",a);let o=new console.Console(e,r);for(let a of FIe)Uq[a]=console[a],console[a]=o[a];return()=>{for(let a of FIe)console[a]=Uq[a];Uq={}}};RIe.exports=OEt});var Hq=_(_q=>{"use strict";Object.defineProperty(_q,"__esModule",{value:!0});_q.default=new WeakMap});var jq=_(qq=>{"use strict";Object.defineProperty(qq,"__esModule",{value:!0});var MEt=ln(),LIe=MEt.createContext({exit:()=>{}});LIe.displayName="InternalAppContext";qq.default=LIe});var Wq=_(Gq=>{"use strict";Object.defineProperty(Gq,"__esModule",{value:!0});var UEt=ln(),NIe=UEt.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});NIe.displayName="InternalStdinContext";Gq.default=NIe});var Vq=_(Yq=>{"use strict";Object.defineProperty(Yq,"__esModule",{value:!0});var _Et=ln(),OIe=_Et.createContext({stdout:void 0,write:()=>{}});OIe.displayName="InternalStdoutContext";Yq.default=OIe});var Jq=_(Kq=>{"use strict";Object.defineProperty(Kq,"__esModule",{value:!0});var HEt=ln(),MIe=HEt.createContext({stderr:void 0,write:()=>{}});MIe.displayName="InternalStderrContext";Kq.default=MIe});var TQ=_(zq=>{"use strict";Object.defineProperty(zq,"__esModule",{value:!0});var qEt=ln(),UIe=qEt.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{},focus:()=>{}});UIe.displayName="InternalFocusContext";zq.default=UIe});var HIe=_((OVt,_Ie)=>{"use strict";var jEt=/[|\\{}()[\]^$+*?.-]/g;_Ie.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(jEt,"\\$&")}});var WIe=_((MVt,GIe)=>{"use strict";var GEt=HIe(),WEt=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",jIe=[].concat(ve("module").builtinModules,"bootstrap_node","node").map(t=>new RegExp(`(?:\\((?:node:)?${t}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${t}(?:\\.js)?:\\d+:\\d+$)`));jIe.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var Xq=class t{constructor(e){e={ignoredPackages:[],...e},"internals"in e||(e.internals=t.nodeInternals()),"cwd"in e||(e.cwd=WEt),this._cwd=e.cwd.replace(/\\/g,"/"),this._internals=[].concat(e.internals,YEt(e.ignoredPackages)),this._wrapCallSite=e.wrapCallSite||!1}static nodeInternals(){return[...jIe]}clean(e,r=0){r=" ".repeat(r),Array.isArray(e)||(e=e.split(` -`)),!/^\s*at /.test(e[0])&&/^\s*at /.test(e[1])&&(e=e.slice(1));let o=!1,a=null,n=[];return e.forEach(u=>{if(u=u.replace(/\\/g,"/"),this._internals.some(p=>p.test(u)))return;let A=/^\s*at /.test(u);o?u=u.trimEnd().replace(/^(\s+)at /,"$1"):(u=u.trim(),A&&(u=u.slice(3))),u=u.replace(`${this._cwd}/`,""),u&&(A?(a&&(n.push(a),a=null),n.push(u)):(o=!0,a=u))}),n.map(u=>`${r}${u} -`).join("")}captureString(e,r=this.captureString){typeof e=="function"&&(r=e,e=1/0);let{stackTraceLimit:o}=Error;e&&(Error.stackTraceLimit=e);let a={};Error.captureStackTrace(a,r);let{stack:n}=a;return Error.stackTraceLimit=o,this.clean(n)}capture(e,r=this.capture){typeof e=="function"&&(r=e,e=1/0);let{prepareStackTrace:o,stackTraceLimit:a}=Error;Error.prepareStackTrace=(A,p)=>this._wrapCallSite?p.map(this._wrapCallSite):p,e&&(Error.stackTraceLimit=e);let n={};Error.captureStackTrace(n,r);let{stack:u}=n;return Object.assign(Error,{prepareStackTrace:o,stackTraceLimit:a}),u}at(e=this.at){let[r]=this.capture(1,e);if(!r)return{};let o={line:r.getLineNumber(),column:r.getColumnNumber()};qIe(o,r.getFileName(),this._cwd),r.isConstructor()&&(o.constructor=!0),r.isEval()&&(o.evalOrigin=r.getEvalOrigin()),r.isNative()&&(o.native=!0);let a;try{a=r.getTypeName()}catch{}a&&a!=="Object"&&a!=="[object Object]"&&(o.type=a);let n=r.getFunctionName();n&&(o.function=n);let u=r.getMethodName();return u&&n!==u&&(o.method=u),o}parseLine(e){let r=e&&e.match(VEt);if(!r)return null;let o=r[1]==="new",a=r[2],n=r[3],u=r[4],A=Number(r[5]),p=Number(r[6]),h=r[7],E=r[8],w=r[9],D=r[10]==="native",b=r[11]===")",C,T={};if(E&&(T.line=Number(E)),w&&(T.column=Number(w)),b&&h){let N=0;for(let U=h.length-1;U>0;U--)if(h.charAt(U)===")")N++;else if(h.charAt(U)==="("&&h.charAt(U-1)===" "&&(N--,N===-1&&h.charAt(U-1)===" ")){let J=h.slice(0,U-1);h=h.slice(U+1),a+=` (${J}`;break}}if(a){let N=a.match(KEt);N&&(a=N[1],C=N[2])}return qIe(T,h,this._cwd),o&&(T.constructor=!0),n&&(T.evalOrigin=n,T.evalLine=A,T.evalColumn=p,T.evalFile=u&&u.replace(/\\/g,"/")),D&&(T.native=!0),a&&(T.function=a),C&&a!==C&&(T.method=C),T}};function qIe(t,e,r){e&&(e=e.replace(/\\/g,"/"),e.startsWith(`${r}/`)&&(e=e.slice(r.length+1)),t.file=e)}function YEt(t){if(t.length===0)return[];let e=t.map(r=>GEt(r));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${e.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var VEt=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),KEt=/^(.*?) \[as (.*?)\]$/;GIe.exports=Xq});var VIe=_((UVt,YIe)=>{"use strict";YIe.exports=(t,e)=>t.replace(/^\t+/gm,r=>" ".repeat(r.length*(e||2)))});var JIe=_((_Vt,KIe)=>{"use strict";var JEt=VIe(),zEt=(t,e)=>{let r=[],o=t-e,a=t+e;for(let n=o;n<=a;n++)r.push(n);return r};KIe.exports=(t,e,r)=>{if(typeof t!="string")throw new TypeError("Source code is missing.");if(!e||e<1)throw new TypeError("Line number must start from `1`.");if(t=JEt(t).split(/\r?\n/),!(e>t.length))return r={around:3,...r},zEt(e,r.around).filter(o=>t[o-1]!==void 0).map(o=>({line:o,value:t[o-1]}))}});var LQ=_(lu=>{"use strict";var XEt=lu&&lu.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),ZEt=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Et=lu&&lu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&XEt(e,t,r);return ZEt(e,t),e},eCt=lu&&lu.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(t);a{var{children:r}=t,o=eCt(t,["children"]);let a=Object.assign(Object.assign({},o),{marginLeft:o.marginLeft||o.marginX||o.margin||0,marginRight:o.marginRight||o.marginX||o.margin||0,marginTop:o.marginTop||o.marginY||o.margin||0,marginBottom:o.marginBottom||o.marginY||o.margin||0,paddingLeft:o.paddingLeft||o.paddingX||o.padding||0,paddingRight:o.paddingRight||o.paddingX||o.padding||0,paddingTop:o.paddingTop||o.paddingY||o.padding||0,paddingBottom:o.paddingBottom||o.paddingY||o.padding||0});return zIe.default.createElement("ink-box",{ref:e,style:a},r)});Zq.displayName="Box";Zq.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};lu.default=Zq});var tj=_(HB=>{"use strict";var $q=HB&&HB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(HB,"__esModule",{value:!0});var tCt=$q(ln()),SC=$q(FQ()),XIe=$q(Lq()),ej=({color:t,backgroundColor:e,dimColor:r,bold:o,italic:a,underline:n,strikethrough:u,inverse:A,wrap:p,children:h})=>{if(h==null)return null;let E=w=>(r&&(w=SC.default.dim(w)),t&&(w=XIe.default(w,t,"foreground")),e&&(w=XIe.default(w,e,"background")),o&&(w=SC.default.bold(w)),a&&(w=SC.default.italic(w)),n&&(w=SC.default.underline(w)),u&&(w=SC.default.strikethrough(w)),A&&(w=SC.default.inverse(w)),w);return tCt.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row",textWrap:p},internal_transform:E},h)};ej.displayName="Text";ej.defaultProps={dimColor:!1,bold:!1,italic:!1,underline:!1,strikethrough:!1,wrap:"wrap"};HB.default=ej});var twe=_(cu=>{"use strict";var rCt=cu&&cu.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),nCt=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iCt=cu&&cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&rCt(e,t,r);return nCt(e,t),e},qB=cu&&cu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cu,"__esModule",{value:!0});var ZIe=iCt(ve("fs")),ps=qB(ln()),$Ie=qB(WIe()),sCt=qB(JIe()),Jf=qB(LQ()),mA=qB(tj()),ewe=new $Ie.default({cwd:process.cwd(),internals:$Ie.default.nodeInternals()}),oCt=({error:t})=>{let e=t.stack?t.stack.split(` -`).slice(1):void 0,r=e?ewe.parseLine(e[0]):void 0,o,a=0;if(r?.file&&r?.line&&ZIe.existsSync(r.file)){let n=ZIe.readFileSync(r.file,"utf8");if(o=sCt.default(n,r.line),o)for(let{line:u}of o)a=Math.max(a,String(u).length)}return ps.default.createElement(Jf.default,{flexDirection:"column",padding:1},ps.default.createElement(Jf.default,null,ps.default.createElement(mA.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),ps.default.createElement(mA.default,null," ",t.message)),r&&ps.default.createElement(Jf.default,{marginTop:1},ps.default.createElement(mA.default,{dimColor:!0},r.file,":",r.line,":",r.column)),r&&o&&ps.default.createElement(Jf.default,{marginTop:1,flexDirection:"column"},o.map(({line:n,value:u})=>ps.default.createElement(Jf.default,{key:n},ps.default.createElement(Jf.default,{width:a+1},ps.default.createElement(mA.default,{dimColor:n!==r.line,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0},String(n).padStart(a," "),":")),ps.default.createElement(mA.default,{key:n,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0}," "+u)))),t.stack&&ps.default.createElement(Jf.default,{marginTop:1,flexDirection:"column"},t.stack.split(` -`).slice(1).map(n=>{let u=ewe.parseLine(n);return u?ps.default.createElement(Jf.default,{key:n},ps.default.createElement(mA.default,{dimColor:!0},"- "),ps.default.createElement(mA.default,{dimColor:!0,bold:!0},u.function),ps.default.createElement(mA.default,{dimColor:!0,color:"gray"}," ","(",u.file,":",u.line,":",u.column,")")):ps.default.createElement(Jf.default,{key:n},ps.default.createElement(mA.default,{dimColor:!0},"- "),ps.default.createElement(mA.default,{dimColor:!0,bold:!0},n))})))};cu.default=oCt});var nwe=_(uu=>{"use strict";var aCt=uu&&uu.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),lCt=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cCt=uu&&uu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&aCt(e,t,r);return lCt(e,t),e},ad=uu&&uu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uu,"__esModule",{value:!0});var od=cCt(ln()),rwe=ad(Z6()),uCt=ad(jq()),ACt=ad(Wq()),fCt=ad(Vq()),pCt=ad(Jq()),hCt=ad(TQ()),gCt=ad(twe()),dCt=" ",mCt="\x1B[Z",yCt="\x1B",NQ=class extends od.PureComponent{constructor(){super(...arguments),this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=e=>{let{stdin:r}=this.props;if(!this.isRawModeSupported())throw r===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default. -Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink. -Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.addListener("data",this.handleInput),r.resume(),r.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("data",this.handleInput),r.pause())},this.handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===yCt&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===dCt&&this.focusNext(),e===mCt&&this.focusPrevious())},this.handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focus=e=>{this.setState(r=>r.focusables.some(a=>a?.id===e)?{activeFocusId:e}:r)},this.focusNext=()=>{this.setState(e=>{var r;let o=(r=e.focusables[0])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findNextFocusable(e)||o}})},this.focusPrevious=()=>{this.setState(e=>{var r;let o=(r=e.focusables[e.focusables.length-1])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findPreviousFocusable(e)||o}})},this.addFocusable=(e,{autoFocus:r})=>{this.setState(o=>{let a=o.activeFocusId;return!a&&r&&(a=e),{activeFocusId:a,focusables:[...o.focusables,{id:e,isActive:!0}]}})},this.removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(o=>o.id!==e)}))},this.activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(o=>o.id!==e?o:{id:e,isActive:!0})}))},this.deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(o=>o.id!==e?o:{id:e,isActive:!1})}))},this.findNextFocusable=e=>{var r;let o=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=o+1;a{var r;let o=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=o-1;a>=0;a--)if(!((r=e.focusables[a])===null||r===void 0)&&r.isActive)return e.focusables[a].id}}static getDerivedStateFromError(e){return{error:e}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return od.default.createElement(uCt.default.Provider,{value:{exit:this.handleExit}},od.default.createElement(ACt.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},od.default.createElement(fCt.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},od.default.createElement(pCt.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},od.default.createElement(hCt.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious,focus:this.focus}},this.state.error?od.default.createElement(gCt.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){rwe.default.hide(this.props.stdout)}componentWillUnmount(){rwe.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(e){this.handleExit(e)}};uu.default=NQ;NQ.displayName="InternalApp"});var owe=_(Au=>{"use strict";var ECt=Au&&Au.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),CCt=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ICt=Au&&Au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&ECt(e,t,r);return CCt(e,t),e},fu=Au&&Au.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Au,"__esModule",{value:!0});var wCt=fu(ln()),iwe=WM(),BCt=fu(tCe()),vCt=fu(V6()),DCt=fu(aCe()),SCt=fu(cCe()),rj=fu(tIe()),PCt=fu(kIe()),xCt=fu(X6()),bCt=fu(TIe()),kCt=ICt(xq()),QCt=fu(Hq()),FCt=fu(nwe()),PC=process.env.CI==="false"?!1:DCt.default,swe=()=>{},nj=class{constructor(e){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:r,outputHeight:o,staticOutput:a}=PCt.default(this.rootNode,this.options.stdout.columns||80),n=a&&a!==` -`;if(this.options.debug){n&&(this.fullStaticOutput+=a),this.options.stdout.write(this.fullStaticOutput+r);return}if(PC){n&&this.options.stdout.write(a),this.lastOutput=r;return}if(n&&(this.fullStaticOutput+=a),o>=this.options.stdout.rows){this.options.stdout.write(vCt.default.clearTerminal+this.fullStaticOutput+r),this.lastOutput=r;return}n&&(this.log.clear(),this.options.stdout.write(a),this.log(r)),!n&&r!==this.lastOutput&&this.throttledLog(r),this.lastOutput=r},SCt.default(this),this.options=e,this.rootNode=kCt.createNode("ink-root"),this.rootNode.onRender=e.debug?this.onRender:iwe(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=BCt.default.create(e.stdout),this.throttledLog=e.debug?this.log:iwe(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=rj.default.createContainer(this.rootNode,0,!1,null),this.unsubscribeExit=xCt.default(this.unmount,{alwaysLast:!1}),e.patchConsole&&this.patchConsole(),PC||(e.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{e.stdout.off("resize",this.onRender)})}render(e){let r=wCt.default.createElement(FCt.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},e);rj.default.updateContainer(r,this.container,null,swe)}writeToStdout(e){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(e+this.fullStaticOutput+this.lastOutput);return}if(PC){this.options.stdout.write(e);return}this.log.clear(),this.options.stdout.write(e),this.log(this.lastOutput)}}writeToStderr(e){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(e),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(PC){this.options.stderr.write(e);return}this.log.clear(),this.options.stderr.write(e),this.log(this.lastOutput)}}unmount(e){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),PC?this.options.stdout.write(this.lastOutput+` -`):this.options.debug||this.log.done(),this.isUnmounted=!0,rj.default.updateContainer(null,this.container,null,swe),QCt.default.delete(this.options.stdout),e instanceof Error?this.rejectExitPromise(e):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((e,r)=>{this.resolveExitPromise=e,this.rejectExitPromise=r})),this.exitPromise}clear(){!PC&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=bCt.default((e,r)=>{e==="stdout"&&this.writeToStdout(r),e==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}};Au.default=nj});var lwe=_(jB=>{"use strict";var awe=jB&&jB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jB,"__esModule",{value:!0});var RCt=awe(owe()),OQ=awe(Hq()),TCt=ve("stream"),LCt=(t,e)=>{let r=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},NCt(e)),o=OCt(r.stdout,()=>new RCt.default(r));return o.render(t),{rerender:o.render,unmount:()=>o.unmount(),waitUntilExit:o.waitUntilExit,cleanup:()=>OQ.default.delete(r.stdout),clear:o.clear}};jB.default=LCt;var NCt=(t={})=>t instanceof TCt.Stream?{stdout:t,stdin:process.stdin}:t,OCt=(t,e)=>{let r;return OQ.default.has(t)?r=OQ.default.get(t):(r=e(),OQ.default.set(t,r)),r}});var uwe=_(zf=>{"use strict";var MCt=zf&&zf.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),UCt=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ct=zf&&zf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&MCt(e,t,r);return UCt(e,t),e};Object.defineProperty(zf,"__esModule",{value:!0});var GB=_Ct(ln()),cwe=t=>{let{items:e,children:r,style:o}=t,[a,n]=GB.useState(0),u=GB.useMemo(()=>e.slice(a),[e,a]);GB.useLayoutEffect(()=>{n(e.length)},[e.length]);let A=u.map((h,E)=>r(h,a+E)),p=GB.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},o),[o]);return GB.default.createElement("ink-box",{internal_static:!0,style:p},A)};cwe.displayName="Static";zf.default=cwe});var fwe=_(WB=>{"use strict";var HCt=WB&&WB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(WB,"__esModule",{value:!0});var qCt=HCt(ln()),Awe=({children:t,transform:e})=>t==null?null:qCt.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:e},t);Awe.displayName="Transform";WB.default=Awe});var hwe=_(YB=>{"use strict";var jCt=YB&&YB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(YB,"__esModule",{value:!0});var GCt=jCt(ln()),pwe=({count:t=1})=>GCt.default.createElement("ink-text",null,` -`.repeat(t));pwe.displayName="Newline";YB.default=pwe});var mwe=_(VB=>{"use strict";var gwe=VB&&VB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(VB,"__esModule",{value:!0});var WCt=gwe(ln()),YCt=gwe(LQ()),dwe=()=>WCt.default.createElement(YCt.default,{flexGrow:1});dwe.displayName="Spacer";VB.default=dwe});var MQ=_(KB=>{"use strict";var VCt=KB&&KB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(KB,"__esModule",{value:!0});var KCt=ln(),JCt=VCt(Wq()),zCt=()=>KCt.useContext(JCt.default);KB.default=zCt});var Ewe=_(JB=>{"use strict";var XCt=JB&&JB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(JB,"__esModule",{value:!0});var ywe=ln(),ZCt=XCt(MQ()),$Ct=(t,e={})=>{let{stdin:r,setRawMode:o,internal_exitOnCtrlC:a}=ZCt.default();ywe.useEffect(()=>{if(e.isActive!==!1)return o(!0),()=>{o(!1)}},[e.isActive,o]),ywe.useEffect(()=>{if(e.isActive===!1)return;let n=u=>{let A=String(u),p={upArrow:A==="\x1B[A",downArrow:A==="\x1B[B",leftArrow:A==="\x1B[D",rightArrow:A==="\x1B[C",pageDown:A==="\x1B[6~",pageUp:A==="\x1B[5~",return:A==="\r",escape:A==="\x1B",ctrl:!1,shift:!1,tab:A===" "||A==="\x1B[Z",backspace:A==="\b",delete:A==="\x7F"||A==="\x1B[3~",meta:!1};A<=""&&!p.return&&(A=String.fromCharCode(A.charCodeAt(0)+97-1),p.ctrl=!0),A.startsWith("\x1B")&&(A=A.slice(1),p.meta=!0);let h=A>="A"&&A<="Z",E=A>="\u0410"&&A<="\u042F";A.length===1&&(h||E)&&(p.shift=!0),p.tab&&A==="[Z"&&(p.shift=!0),(p.tab||p.backspace||p.delete)&&(A=""),(!(A==="c"&&p.ctrl)||!a)&&t(A,p)};return r?.on("data",n),()=>{r?.off("data",n)}},[e.isActive,r,a,t])};JB.default=$Ct});var Cwe=_(zB=>{"use strict";var eIt=zB&&zB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zB,"__esModule",{value:!0});var tIt=ln(),rIt=eIt(jq()),nIt=()=>tIt.useContext(rIt.default);zB.default=nIt});var Iwe=_(XB=>{"use strict";var iIt=XB&&XB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(XB,"__esModule",{value:!0});var sIt=ln(),oIt=iIt(Vq()),aIt=()=>sIt.useContext(oIt.default);XB.default=aIt});var wwe=_(ZB=>{"use strict";var lIt=ZB&&ZB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ZB,"__esModule",{value:!0});var cIt=ln(),uIt=lIt(Jq()),AIt=()=>cIt.useContext(uIt.default);ZB.default=AIt});var vwe=_(ev=>{"use strict";var Bwe=ev&&ev.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ev,"__esModule",{value:!0});var $B=ln(),fIt=Bwe(TQ()),pIt=Bwe(MQ()),hIt=({isActive:t=!0,autoFocus:e=!1,id:r}={})=>{let{isRawModeSupported:o,setRawMode:a}=pIt.default(),{activeId:n,add:u,remove:A,activate:p,deactivate:h,focus:E}=$B.useContext(fIt.default),w=$B.useMemo(()=>r??Math.random().toString().slice(2,7),[r]);return $B.useEffect(()=>(u(w,{autoFocus:e}),()=>{A(w)}),[w,e]),$B.useEffect(()=>{t?p(w):h(w)},[t,w]),$B.useEffect(()=>{if(!(!o||!t))return a(!0),()=>{a(!1)}},[t]),{isFocused:!!w&&n===w,focus:E}};ev.default=hIt});var Dwe=_(tv=>{"use strict";var gIt=tv&&tv.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tv,"__esModule",{value:!0});var dIt=ln(),mIt=gIt(TQ()),yIt=()=>{let t=dIt.useContext(mIt.default);return{enableFocus:t.enableFocus,disableFocus:t.disableFocus,focusNext:t.focusNext,focusPrevious:t.focusPrevious,focus:t.focus}};tv.default=yIt});var Swe=_(ij=>{"use strict";Object.defineProperty(ij,"__esModule",{value:!0});ij.default=t=>{var e,r,o,a;return{width:(r=(e=t.yogaNode)===null||e===void 0?void 0:e.getComputedWidth())!==null&&r!==void 0?r:0,height:(a=(o=t.yogaNode)===null||o===void 0?void 0:o.getComputedHeight())!==null&&a!==void 0?a:0}}});var ac=_(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});var EIt=lwe();Object.defineProperty(Js,"render",{enumerable:!0,get:function(){return EIt.default}});var CIt=LQ();Object.defineProperty(Js,"Box",{enumerable:!0,get:function(){return CIt.default}});var IIt=tj();Object.defineProperty(Js,"Text",{enumerable:!0,get:function(){return IIt.default}});var wIt=uwe();Object.defineProperty(Js,"Static",{enumerable:!0,get:function(){return wIt.default}});var BIt=fwe();Object.defineProperty(Js,"Transform",{enumerable:!0,get:function(){return BIt.default}});var vIt=hwe();Object.defineProperty(Js,"Newline",{enumerable:!0,get:function(){return vIt.default}});var DIt=mwe();Object.defineProperty(Js,"Spacer",{enumerable:!0,get:function(){return DIt.default}});var SIt=Ewe();Object.defineProperty(Js,"useInput",{enumerable:!0,get:function(){return SIt.default}});var PIt=Cwe();Object.defineProperty(Js,"useApp",{enumerable:!0,get:function(){return PIt.default}});var xIt=MQ();Object.defineProperty(Js,"useStdin",{enumerable:!0,get:function(){return xIt.default}});var bIt=Iwe();Object.defineProperty(Js,"useStdout",{enumerable:!0,get:function(){return bIt.default}});var kIt=wwe();Object.defineProperty(Js,"useStderr",{enumerable:!0,get:function(){return kIt.default}});var QIt=vwe();Object.defineProperty(Js,"useFocus",{enumerable:!0,get:function(){return QIt.default}});var FIt=Dwe();Object.defineProperty(Js,"useFocusManager",{enumerable:!0,get:function(){return FIt.default}});var RIt=Swe();Object.defineProperty(Js,"measureElement",{enumerable:!0,get:function(){return RIt.default}})});var oj={};Vt(oj,{Gem:()=>sj});var Pwe,ld,sj,UQ=It(()=>{Pwe=et(ac()),ld=et(ln()),sj=(0,ld.memo)(({active:t})=>{let e=(0,ld.useMemo)(()=>t?"\u25C9":"\u25EF",[t]),r=(0,ld.useMemo)(()=>t?"green":"yellow",[t]);return ld.default.createElement(Pwe.Text,{color:r},e)})});var bwe={};Vt(bwe,{useKeypress:()=>cd});function cd({active:t},e,r){let{stdin:o}=(0,xwe.useStdin)(),a=(0,_Q.useCallback)((n,u)=>e(n,u),r);(0,_Q.useEffect)(()=>{if(!(!t||!o))return o.on("keypress",a),()=>{o.off("keypress",a)}},[t,a,o])}var xwe,_Q,rv=It(()=>{xwe=et(ac()),_Q=et(ln())});var Qwe={};Vt(Qwe,{FocusRequest:()=>kwe,useFocusRequest:()=>aj});var kwe,aj,lj=It(()=>{rv();kwe=(r=>(r.BEFORE="before",r.AFTER="after",r))(kwe||{}),aj=function({active:t},e,r){cd({active:t},(o,a)=>{a.name==="tab"&&(a.shift?e("before"):e("after"))},r)}});var Fwe={};Vt(Fwe,{useListInput:()=>nv});var nv,HQ=It(()=>{rv();nv=function(t,e,{active:r,minus:o,plus:a,set:n,loop:u=!0}){cd({active:r},(A,p)=>{let h=e.indexOf(t);switch(p.name){case o:{let E=h-1;if(u){n(e[(e.length+E)%e.length]);return}if(E<0)return;n(e[E])}break;case a:{let E=h+1;if(u){n(e[E%e.length]);return}if(E>=e.length)return;n(e[E])}break}},[e,t,a,n,u])}});var qQ={};Vt(qQ,{ScrollableItems:()=>TIt});var Hh,Ua,TIt,jQ=It(()=>{Hh=et(ac()),Ua=et(ln());lj();HQ();TIt=({active:t=!0,children:e=[],radius:r=10,size:o=1,loop:a=!0,onFocusRequest:n,willReachEnd:u})=>{let A=N=>{if(N.key===null)throw new Error("Expected all children to have a key");return N.key},p=Ua.default.Children.map(e,N=>A(N)),h=p[0],[E,w]=(0,Ua.useState)(h),D=p.indexOf(E);(0,Ua.useEffect)(()=>{p.includes(E)||w(h)},[e]),(0,Ua.useEffect)(()=>{u&&D>=p.length-2&&u()},[D]),aj({active:t&&!!n},N=>{n?.(N)},[n]),nv(E,p,{active:t,minus:"up",plus:"down",set:w,loop:a});let b=D-r,C=D+r;C>p.length&&(b-=C-p.length,C=p.length),b<0&&(C+=-b,b=0),C>=p.length&&(C=p.length-1);let T=[];for(let N=b;N<=C;++N){let U=p[N],J=t&&U===E;T.push(Ua.default.createElement(Hh.Box,{key:U,height:o},Ua.default.createElement(Hh.Box,{marginLeft:1,marginRight:1},Ua.default.createElement(Hh.Text,null,J?Ua.default.createElement(Hh.Text,{color:"cyan",bold:!0},">"):" ")),Ua.default.createElement(Hh.Box,null,Ua.default.cloneElement(e[N],{active:J}))))}return Ua.default.createElement(Hh.Box,{flexDirection:"column",width:"100%"},T)}});var Rwe,Xf,Twe,cj,Lwe,uj=It(()=>{Rwe=et(ac()),Xf=et(ln()),Twe=ve("readline"),cj=Xf.default.createContext(null),Lwe=({children:t})=>{let{stdin:e,setRawMode:r}=(0,Rwe.useStdin)();(0,Xf.useEffect)(()=>{r&&r(!0),e&&(0,Twe.emitKeypressEvents)(e)},[e,r]);let[o,a]=(0,Xf.useState)(new Map),n=(0,Xf.useMemo)(()=>({getAll:()=>o,get:u=>o.get(u),set:(u,A)=>a(new Map([...o,[u,A]]))}),[o,a]);return Xf.default.createElement(cj.Provider,{value:n,children:t})}});var Aj={};Vt(Aj,{useMinistore:()=>LIt});function LIt(t,e){let r=(0,GQ.useContext)(cj);if(r===null)throw new Error("Expected this hook to run with a ministore context attached");if(typeof t>"u")return r.getAll();let o=(0,GQ.useCallback)(n=>{r.set(t,n)},[t,r.set]),a=r.get(t);return typeof a>"u"&&(a=e),[a,o]}var GQ,fj=It(()=>{GQ=et(ln());uj()});var YQ={};Vt(YQ,{renderForm:()=>NIt});async function NIt(t,e,{stdin:r,stdout:o,stderr:a}){let n,u=p=>{let{exit:h}=(0,WQ.useApp)();cd({active:!0},(E,w)=>{w.name==="return"&&(n=p,h())},[h,p])},{waitUntilExit:A}=(0,WQ.render)(pj.default.createElement(Lwe,null,pj.default.createElement(t,{...e,useSubmit:u})),{stdin:r,stdout:o,stderr:a});return await A(),n}var WQ,pj,VQ=It(()=>{WQ=et(ac()),pj=et(ln());uj();rv()});var Uwe=_(iv=>{"use strict";Object.defineProperty(iv,"__esModule",{value:!0});iv.UncontrolledTextInput=void 0;var Owe=ln(),hj=ln(),Nwe=ac(),ud=FQ(),Mwe=({value:t,placeholder:e="",focus:r=!0,mask:o,highlightPastedText:a=!1,showCursor:n=!0,onChange:u,onSubmit:A})=>{let[{cursorOffset:p,cursorWidth:h},E]=hj.useState({cursorOffset:(t||"").length,cursorWidth:0});hj.useEffect(()=>{E(T=>{if(!r||!n)return T;let N=t||"";return T.cursorOffset>N.length-1?{cursorOffset:N.length,cursorWidth:0}:T})},[t,r,n]);let w=a?h:0,D=o?o.repeat(t.length):t,b=D,C=e?ud.grey(e):void 0;if(n&&r){C=e.length>0?ud.inverse(e[0])+ud.grey(e.slice(1)):ud.inverse(" "),b=D.length>0?"":ud.inverse(" ");let T=0;for(let N of D)T>=p-w&&T<=p?b+=ud.inverse(N):b+=N,T++;D.length>0&&p===D.length&&(b+=ud.inverse(" "))}return Nwe.useInput((T,N)=>{if(N.upArrow||N.downArrow||N.ctrl&&T==="c"||N.tab||N.shift&&N.tab)return;if(N.return){A&&A(t);return}let U=p,J=t,te=0;N.leftArrow?n&&U--:N.rightArrow?n&&U++:N.backspace||N.delete?p>0&&(J=t.slice(0,p-1)+t.slice(p,t.length),U--):(J=t.slice(0,p)+T+t.slice(p,t.length),U+=T.length,T.length>1&&(te=T.length)),p<0&&(U=0),p>t.length&&(U=t.length),E({cursorOffset:U,cursorWidth:te}),J!==t&&u(J)},{isActive:r}),Owe.createElement(Nwe.Text,null,e?D.length>0?b:C:b)};iv.default=Mwe;iv.UncontrolledTextInput=({initialValue:t="",...e})=>{let[r,o]=hj.useState(t);return Owe.createElement(Mwe,Object.assign({},e,{value:r,onChange:o}))}});var qwe={};Vt(qwe,{Pad:()=>gj});var _we,Hwe,gj,dj=It(()=>{_we=et(ac()),Hwe=et(ln()),gj=({length:t,active:e})=>{if(t===0)return null;let r=t>1?` ${"-".repeat(t-1)}`:" ";return Hwe.default.createElement(_we.Text,{dimColor:!e},r)}});var jwe={};Vt(jwe,{ItemOptions:()=>OIt});var ov,qh,OIt,Gwe=It(()=>{ov=et(ac()),qh=et(ln());HQ();UQ();dj();OIt=function({active:t,skewer:e,options:r,value:o,onChange:a,sizes:n=[]}){let u=r.filter(({label:p})=>!!p).map(({value:p})=>p),A=r.findIndex(p=>p.value===o&&p.label!="");return nv(o,u,{active:t,minus:"left",plus:"right",set:a}),qh.default.createElement(qh.default.Fragment,null,r.map(({label:p},h)=>{let E=h===A,w=n[h]-1||0,D=p.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),b=Math.max(0,w-D.length-2);return p?qh.default.createElement(ov.Box,{key:p,width:w,marginLeft:1},qh.default.createElement(ov.Text,{wrap:"truncate"},qh.default.createElement(sj,{active:E})," ",p),e?qh.default.createElement(gj,{active:t,length:b}):null):qh.default.createElement(ov.Box,{key:`spacer-${h}`,width:w,marginLeft:1})}))}});var s1e=_((xJt,i1e)=>{var Dj;i1e.exports=()=>(typeof Dj>"u"&&(Dj=ve("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),Dj)});var S1e=_(($Jt,D1e)=>{var Tj=Symbol("arg flag"),lc=class t extends Error{constructor(e,r){super(e),this.name="ArgError",this.code=r,Object.setPrototypeOf(this,t.prototype)}};function wv(t,{argv:e=process.argv.slice(2),permissive:r=!1,stopAtPositional:o=!1}={}){if(!t)throw new lc("argument specification object is required","ARG_CONFIG_NO_SPEC");let a={_:[]},n={},u={};for(let A of Object.keys(t)){if(!A)throw new lc("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(A[0]!=="-")throw new lc(`argument key must start with '-' but found: '${A}'`,"ARG_CONFIG_NONOPT_KEY");if(A.length===1)throw new lc(`argument key must have a name; singular '-' keys are not allowed: ${A}`,"ARG_CONFIG_NONAME_KEY");if(typeof t[A]=="string"){n[A]=t[A];continue}let p=t[A],h=!1;if(Array.isArray(p)&&p.length===1&&typeof p[0]=="function"){let[E]=p;p=(w,D,b=[])=>(b.push(E(w,D,b[b.length-1])),b),h=E===Boolean||E[Tj]===!0}else if(typeof p=="function")h=p===Boolean||p[Tj]===!0;else throw new lc(`type missing or not a function or valid array type: ${A}`,"ARG_CONFIG_VAD_TYPE");if(A[1]!=="-"&&A.length>2)throw new lc(`short argument keys (with a single hyphen) must have only one character: ${A}`,"ARG_CONFIG_SHORTOPT_TOOLONG");u[A]=[p,h]}for(let A=0,p=e.length;A0){a._=a._.concat(e.slice(A));break}if(h==="--"){a._=a._.concat(e.slice(A+1));break}if(h.length>1&&h[0]==="-"){let E=h[1]==="-"||h.length===2?[h]:h.slice(1).split("").map(w=>`-${w}`);for(let w=0;w1&&e[A+1][0]==="-"&&!(e[A+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(N===Number||typeof BigInt<"u"&&N===BigInt))){let J=b===T?"":` (alias for ${T})`;throw new lc(`option requires argument: ${b}${J}`,"ARG_MISSING_REQUIRED_LONGARG")}a[T]=N(e[A+1],T,a[T]),++A}else a[T]=N(C,T,a[T])}}else a._.push(h)}return a}wv.flag=t=>(t[Tj]=!0,t);wv.COUNT=wv.flag((t,e,r)=>(r||0)+1);wv.ArgError=lc;D1e.exports=wv});var T1e=_((bzt,R1e)=>{var Mj;R1e.exports=()=>(typeof Mj>"u"&&(Mj=ve("zlib").brotliDecompressSync(Buffer.from("W3EZIYq6tFiN9chAsHEAIOhmAtYF3JDBG6K9UMioWhJVZyywcPypqvH1szH4cAa4kyNi1Puf6txZplhpwhwqposi0oYtmzjyXKmGT6kifq00/67L6VlOUG6NHOKMc5BDVE39YUVLi8UARaOwrk+DKKSAhedfN3+aSYN4Zw6X98Wmv5kFapLaBLFS1Xo21ZqGaazCndkKo4Fz+orQ6z6EeKCFcypbGBVIbnEl+JT4ItTINpWm1bGCLRejJvLT+AiBNl1/mL5BemR8+v37pqUiCRDXpAqV6SiJ1zjG60IdRQG76r53xTboGXQD0JLEwThyPce6V1XvP3Q3erBokiMRQ46xSzlns3iCeMMI5K5MEiqIpeIyBBj3oo87J2N1LEtdm5Ugnms3yBwbJdhmZCmc3o/5/+fu9/YfBag4UitFan/4Wr10Uruf1Lmb2iCEPiAEduLsrt+PZT6yYq1G7KVzMOD9UbP9S+QEuXgXymyvgT8biTZzxfinzD5Hm0wn5bT6s3WLl8OZXO5m9Pv1ZZtGfu+7eIIRvXOz/4xYVOx94Vt8ed2SHJG9S/YPBUvz5L+GPBwk9UwZ/Vfo8lkqEfDIDyc+u7fdhamMRz80U0sHbHSykO2pdlzABqMKCqlHlgSACT3ZmLTkLlpl7UN/In8Fmh5j5r4BkDeYEyb82wA/AXKMpQW1WQPY/58SBA15/6ZAUzsq011Ch8fjrM6QGRsa7PTsw5oUxR1hpfQXN6uDBbjG8AgDMv2sgj4pcXZeXPzFFPxx4YYuydJYOUb3zSuSxwhjxmZXFK2mPNC4A3ukVFEsu9sIEcMHYq4AbgIE86ycIp1roFIhUNl2svUdYSU1H/ErVTcXXMoG27dBwmA86oROLr6dqs5A674JUJcC8LecgNlVb/J8xPfivJDgHpNjtLdO2QNgoMKD+9w/VrPVlGspEWpyjDfhHGhtFvGZxkUSCDNY/9xDpIoQ3eIVRB8QThoRlPDP1RRQ+TopUdYI3AWaPsAGbHXJqADJJ9Wuhuf5KUsinb89qcG55OEGZ5iGkzxzoGALbiKcd8f+9AR/S7pr7kP+6iHOyZP/DOTT6OLZ/yeztW8lZFCUd/RCAdAeWrRonMjiOHP8zhJ2R2+1RtVinv8VVsYdy2J5zwFPXWpic/9npJwe6XGr5wILoOPY7dUvXMzJ3u+jiAcTNJP9E6KaBOsGCaQmPTIMIBQK36Qd3UGN+mTuRnlNgwPzE7wLFlqTXx+DARuDXoqqGmZGUFUB8u9Frf61ovqGzB6YqUfaX8s5TkDWQDlV+noHW5IR5VyT0edfGSH4ooTGX5egwQGU99Vqs009/uqSkoTSwfyNsLyvi1ks8zkMyy9ygEWtR+lu9VvImW9QhadqM6sd9KYZbBsr/kHRFlz86Dm4nz1nZanmqdWgdTUswJlFbQOLUG74SXT0wmqWNO3oNqfgDA0ucQDxm/SeTE4pCW/wKoAXBtWvJYHeN7iL8qYPAtadbzb8d8nJaNu+zPxWOvtXkK80fs++tHJVpsP4JUX6tMEXZuDAKnXWdqKtAvKBTRVchrqaTjDhkxyDSAwJAUogF2xm/94b4fptN45S3s/1iBv56Jf/vB8Ow4xOGuGW8mJDAo5bGudYZj1AnDPimhOiftlLMYXiJo/EHpEcsj1h3FqXU9QqkvY4Kd7Ym+TmB6cTHFvh8nddj/8kVQ4efDMmr6g2S4S6ApGNmNlWStzciVXOCSGaCLqQOXuAV917Iz0WIDDS83gGO4ynj6ihWATiDDWrcpMI9aXG+MlcPKkZTVI8Em1larMHb1K1Kgba0p1S7TXIRElngpLFz6HYFiSv6l7pvweuVdxdDWMa5oSAANKolU/q00lVjxKfXG0n34BMgiO+HwWQbBlLob2Mudc4OeHpSXURbIx2yAYgHgWCPnjpk2jNRJdFEVdL9MBhNGzSfB7A4MVluvxIsb9JVjT8HeeGYzhvulVFS5MM9eqkCug2v2cpHbdIp/NJGRwqX31xKPfw5O3KlhpsqQi/PrrglJBqrmOV1qxNlqYqjbg37zM3eSQwvuYtg/3eZL7sj6Z7rf2aBjwqAjmZZTs/EVXAPYJMHonuzTyq/jUt3VBc48ifMf7UmIjMgmHwEML94dRUQ18RRdXYPJUtkvZ60qJ1REFPTH6BOanSTpxkApApj0GAVmu5SQWct71lru5enZbHtziFjpkbV9syBwuqIVP0n0+MCHtqE6kD2VRrUDKEdMr3AeGTfNM1jgQ/+dusCEXeQo5/yPsxgw6BrRkAp9RAqdVVl3T5ZyXzFVkP2Q5HcPReMNjFFlPsKLMeaCMJpjrcAYHqZR85qp/wxwjLtQImZyzemx5jePTFfMPdKVmXIs4ZMTBBV4scXSjzBkcn7zErArLQ7cGAmSnDvyO1WJPG1VxJPUqBlSPrApi96EdWCshmrLH9FUrctUKsW7BP7R2ByXwsTSfZrxxEsPav7veYciPip1Gg09zceq9rjsk6E8tu4HGA1tUgKrYxFilJnEOeWb66Xk3LSjwAA3a/PAhTP4XVJQk90DGSf4ejGOiirY/M5ogKog+nCT+s0FziBoLvbyVDC/P8D2cMkduhvF8hppFpGmlo9Gr5Oq09budkN1qais1GJ09L9PHw49RcWwWIdZjINsk/K5qKhlLaGtfoDK+7F4kdtF/6FiA41ht1xehDyWdTnpXE8utJNe2yI2+RpZN8WPViaeg4bmLO0iX1KTxCiYjJwjYPt1TJTPGiSlsW2251xASZcwWlptnreuZtXfhd15/qkulrPYbUP/B1CF30zZZrN/TnlE4r0V73EFM70Fv9IHxl5j7VCOEHqJzguotEg4L2qGq7tbxJ8WV0dT2vy7ejS/GeZOt/h+28AzDQuse7Pr6xvAcF5Noo8Be4EHGZ77DRRPMIeQZnK2Lng4gvPYxFOdUpN07F5aUotraCK9sG4DGcTAXi8+wHlQQiveWg/EPTy61pUhdeO7xj2/GEzfWzP8czc2stItnyJhUgc4Fc+ZRdmC7swJYSQuSNVV58cIUdFPP+QjQ1LWNoBpdoZ3XgPBn7+jL89l2BnaWN5po64hlLPeaNsXs72rTgKbPmMC/IpBWel0JTWLZ9ydeyQA3taqpUHvcX25+oq/zvakRU7hjXYpPTK+AYW9zQohOzJURkRpAy+52t7hMSj7/YXqmeJf668Nwyubp94s+nx0EQV9pZ9YhedRdm4hcredwm4sw5LuWiCqgrFa2ImYDGn6W/wxxsrpxAIvYQxXdWPHYFkEpJVdpZ1WpOR070TahMzCUz+agtQ080kHR7eSCZbRlfa6zD4XFncMvceZ0u9TXNvhaG3QvCMoi9W3lAeVP5ddsIQr1P+zSwI5xu1+amj3rVuKrbUdHqnLDsL/lehsqHajsU6uebGTJS0y4/kIoKwLGXeUpKpeYPJjtDPOrBbPnlV2yZnGBwwPtezGpjVjsd285lBUQHYUCJvyp5w+FbNnvOUj5JhzJHPNyW2UqfwjWuTUkpoI9YbQGHO+ypj3/+7rq5HJGaInO+YAEIfVHqWNIb12gqgZGtqG/DONCWOOsR8P2MFjBdxf4P5oIWBmbgxF32+jvekGFIoqbu+XS2iKBdlbUN6Ndycbfll69jwTwegGGKp1/bmWNvYRuWlJXQ+yYOsLcJeH/7W02XtFxhZmkvm9o7ALfxHWm2BgjhEbevByqg079fDdruPSTmR7vTXdimc9f9Wzg3xvu4+h7ErFkJ0sW3I2myj+Yso+nHKlMM/Y97LmjPCssXNhZQG5Owj1WAQLryx4XCEp63EiVQQkfltmKeKFZ4GcIM8JWiw0gyPaz+Xjj7GCsJEotHwP6rrNuwFIW3fOy2TodNSFQ32dBdIYr3HM1KiGO79Slg5Kf990Nuz7qv6uXSHL+wBs63hARElujtC4Bu6VgO2PbeOM68zce3HyEeUUmlwP9iFU1hVbURlpP+SMwkyv4WTF26RdwOEZtLwLc880qjPHyf93ntc7DvLAnVs6O6casj6gf8vtw5XplmO2rm28sy42QHblRyPOb6Ke9r/tAtovhmt0IeBv2pTNrPmO9GPvTr+oI6twYGM6eFc87WiJNX+VPufZSe8uYf/BEJNMDaAwBkfLV1G52L6AIBeAdfz8JKW1tqZ6mXgHuHXThF3bL2ljJZRBohCMnaRqFKqSfpgtwaniJoXAZjzKi9qLdjRONBPbZuJM4Rw7IfsgeMmv3hpjn/5JE0OzA77mPQPfx3Qfv/etCmwglCuNL+duQTtrJYWb+sResnwObeoWfGwl8G5e5pd+L6RnBWitOTtrBqsKEDS8Ng50SldwJ6CLoEsyMpGL95sVXvlMy7WDbyJr6UOC8GJy5B8pKkjjmskpUe82oJTQsN510mZItnXENACbKKuAjqQ9VNsh8bf93RlUhMGArpW3MoX00Lc61QAXKW792xLVPFaDu7FkPh6obAWA+FrzEIhCJAwu33TpZC8xHtu6ilVHiSoPlitMcBtv9KTvVW+K0WH7eTr9Ks16t21SlciSM/3jNldJt439nsCrw4XC/ZT15st3zyqtNsCMaZWvSQvEUSqBlkeTdoGXQ8NLacpocmpxxoT4Y6p5XwRKMb69V68hEcpQKSsGWEdeJ1NjsBhaV1eOFopbykx0EgvjRF3Z/YfPWBZYQ4k8K6puuYt4xM/Tg38sYwxeuutm2pA2TAOwvnxIUjQwXnDjVFsErDPKa339FjCS3W8b8Jnl06vIdLfYbtzhO3WcZxyCt7VS2sutAnrjezOOIzIvCBn9unSNsdL+S/261hdlt1Nj75bvUL42bH1pWDUT7YNjtqkB6j7dg/f9Sfred8bmtcXYyn9M0mbHiiVKC/h0VS5mXyWE6d/DJSMYJjMwAdJoIoVUnZBmUXaNLrUafJ5rQrIhg8HroT8qFsHF/tVZRy/TK47xojkfnt7uGwqNI4/Xv0leAWuoqRQk7L1vTlOjpfnd1QHuqJPPaH+z//kQ8PVN+NdD8tMGr9PhL8Kuu7i2r+vrjjZwWkj+4RSFjpQQvPxecgofKG+ZWVZQ6oDPBTbMwQD07MGjIFJfeJ1k6ks59LLSAuYeInVR2teCG9k6iFcX1br3wxAet1jmbwvuqeT5o7uMrF1DfRuxSApotBD45wmRzjgriGjLbQulEwY9TmTuU3zWE0Xk1atglzf1yQO1IK8PKzc+jaMY3/p31WTxdDEcbY7yU2/10qxPbk/mYekmEG2eaj6eEzH87NNtY0jsBgVwsT61yVAuDIkGLkY+W+T+h9g0q08aMP84KmrxwHzjeGeFDu6K2ZvVu45+WJ7x2JRgLj++2ts93Odj/HMjnb18rSUen35zziy5uNYpZIH0U9Nw/WaAEAQlR4GBbRwNmTyFmikrSjTlw8ug8+tyM+VtZ2F8UQo+pRAKTIJYI/3dP1jrTuE9tVSBlMtU3NENcu3WqWefXuupisJKP7OzGu4/m0jePA7HOHI3XGfEf6HbfS9PFsL4bLBa87mUiONGMOkd0/2/yJ0d4ZaCccWmLtRrgop+v9ar6RaEZeiLSMOMLlZbc+U04vJJYeRIvHOrzyK80WD5gw0bsOn2gsXZSf2rLVLVuuTHooa8MWQkwTkFJfFrkEtkuVBAVNR9M+m/a/ANwFaKfK4tvnMvPHnGklFC3dja/bPzfglIqm/e7TMMNG/nGK6sfaraU1ZvjHChRVouSQuS5NJVmSevoAJPRYtUjky3psBoOOaIO4J2uJbM3mqILG5lUnVZ9yeV9NT1DrPqaIEXBIWM5b3UlJUByBHuEwooQHx/2+NO0mEMpvzHJPCN5mD/0K40OPQmVeQbV4iYdnxPnb75zZPCG5LsuoDnCVPrrzwdHSYFccEdmMfbU/ObN6CGEcmZJwOXz6/cy5vAj20/q9C2pegEuPj7WFAOnofC+S5fuj8nn+ZsfOHJjGTSnB0rbumIF9Qpf9GkDHv0hw5/nGV8LTjbdRLpfvk3MkA+PbCQEmyKEWQ4ORSL+BHwqsXwkGmiHlPW4m5iM454abLMzT7+YId+WmfKhF0mSeqOpCPaI5ZFnyIG9/dGyZKZTSM3R83msXipq7sIuBVywk13QYhRqRB7CoFERwzo0m7Y4goWxOAc5xc8DJtzgpqCFTALbST766uZu92bie9toxr33qBTN5/WrpYCK6aM9rQExR0KCJjRJCrO6LzZMZtZd8VDapfAzmfM4lOJCFmzwBxdkEYFnyiIqf3ozgcps7xTqj4CeO+C0XUMAd3ztIfF1DevGRcZox+SjiHnIBNZoCJU6CrFnpvNRKQkNYByQLpzFJbL2DaCgsUf+zMVdLui6pW79ra4jdaYGZZhMIeTIJYZFmok3zHwNqnm0IgdfgqRU1LzSFSRVlHBQhC58W0zDw0vVTYx8TtGZRYHn5ZMVFpq4sWBzswuDrCdYnnWjpSde847Kn79MlLnq7rKKiYNmEHddelIjFbLO1oaGOpdiY4Zx27Zu87dRBx1eJ2KhnyUlrA+5QAX7dVqgkiPp4XQoitt2FkKbFYPZzOmZYUoQyvJzJXYwGrOvXuVbvFcz8yyusj2nId7zWoDs7ErjhEL05D837w/L+UL3P4Fx2P97SyLaGiB2xEY0YWgpPR1u9NKpYxbb1pFCBJsz5VR3oviAewq/3yVkyc+vBSkJKwGS0WnfGMZWns61eOlWsYntH0qhMMyEVdq+Li3PK8P6tt4u922UXL5DFHbj0pjdGuVJ6cWKukVDQtA0WDBpccGC4AFmNFvto7xRQurh8jGiyjXRSMSPtLTCTx+z2SSUw2c8AO5lvBGU1+KpWo4CBTnF8LR+yomVJHcCAEWouGtTdg7/XtR/RJn3rFq51i7A/rVeyrVYYpu64lYh3N8c2dlZP96iuvd5xtRhL6w8OL8o1x1wbigNh98D4fUs2/lvg/eF7f/jesyBdo207knR2+m7h0DZyP3XHUffPVh4/S3n8rOaxWdOoadO0aswyJd8vsuMWQOWSiIy6bQdw8dNONMjaB8bbuwgKPiXhhAiS7Zxz6m8XaFt2MZC5LV3qFjTgTeky/2vUPEhFhWKLEneedElqLk5Vljr4Vvkqx2Uh6orDEu8eCXOEuCUn8vfWP56EclKUrq4pChDd1WJGLc9OTHcD8b/dkxvafPcbYK7uATN3BP/I97PtcIKg23YyefFl0BnthIGsVWi1IsS7VQ+SJj3aZn0ugrN/h3XBprvD5O0dqLu7X+mcd2FlSl675jWfg3KJfClgkiVlEsSlswBS1Ace3MlkZuggqO7FAztGlVZMSWOD3uJYnP9OY5J4TJsWu8ErjUw3Ns4f+XIwwzKlsRtmssHJnx0dJL521YPTnzRdVnfhx9KpM1++GkqfOdtFT3S2bmhP1OGm0R9haXsCzpWevxKYhV7LcV4K5Vv8T0Z7pczlYWRHD55XW4BOqJYaY4SugJwTjFobPpzyQPdVnFXMzJXrHC7jDuVz7DlaZE8E+hn1p5oWv7y0Hcb8LEAh0J/ZKvSIExZ8Dqhwk8zDAJq74j1M7GV09D4CxWtwS11OsR8okFpM7xb53IlEo3vGkOMXUXHzTBfTwX2B7S0/UKEvKufO5ggTaEVXr1l7pEl7m9k5WRn6UDdO7JkX6tQOyrKRabmM2BehDcWl1JRDdSGR2RqGJdClj2p9vEYxCMuUxCZDamCs/P/q5tKdI7D00WEWNf3mWu4h+lf7EevFSbgzZB6PA43FuBwH96J2rmy8u0OEGOGbBXLDVWHTpFOGhrBDNuSIZKfUaF/HdVzHNevKuhlESlYSZHAJ/p4ftuL/COr9ElGs0h3YMiLgt7mIIhlzwRFdzQVKYKi/RAnXGxRiSLx8vvr9V4RXWON8Tp+IKkhUHVf0VdAvmfXC1hbRL6n/p4QqQ9ycDoy2dbYFwuA6OvG2Tw1RCwF6F0v7g8plKZ+BYcy6AgAxDJX513KniC6SbX8FQ3Du5IA3W4aY7OmV+bfyNbvExtVBM3dQuN6lAsFk0kfe1ayWsQsOfAy7SLy+wTlDgyn9nlzCDDrYHUQlR4iTw+/c+QwiWnrJXm2I4zoROtZpwgXNq/TEaWmpw9CT7Ffl4A88HLI0Qp1awaBjjbwaNjKd7Hjk5e6ZYIgNef7kzrxtCZuxo+o+sRAmYiavk+v/2syu/5H3/6r378/7f8v7d+89j+31r8cgI5jrV1h9vDCkGp0/1qi4lDDZoo9FzprweUKPSfZbCXKyAJlN1DhnSPc7vxVQkamjt40WQ5016uQXPZba30MKo95EQzNTDG30duzjtcMlp9fWjd/2G3yKpXqowQ4Zay2zvhsjjnhkZ46LHjNuS5S459FN+SSJlyMo6dRxHI3rHkzpb5w9F6uXlOiImWvrTC/T1fWB9ZtZel3XdShWf1WbfR5+b6YvJPPTkHcRqf3bELljG/zP3uY4+1uwE7d12Q3/2g7M/XuI76aWC8ny2XWUvHyI3zIQxbosW2mnftmTWinWXO7CJ37r/evev0Pv3733/ZItfrONfpdDQu+ulprJmrB26pee2f8Q2pB6Doewo+sXDwpdLIl0puY0zZ6Npmk0+sJQ/iULvWoPwbscNtAXuMIQzqezvgCW39yQxQ2QnZ7d79k0qH6hMUoPSSuqTYV+UaR6SJR7xUZfhub8e2BrzEO1zx7qy5OML+KzWazq9E9qMNGr0nD3lX/8+wvNXVa/M+jw1J9rHodAq4czx8fkSdOVyezYyLjFH351xOwS28u/49bCy8IIn9TMGmnNd0ZFS3gMp2wB13Qr3Z+J6juyK8XbNxcgoXUe1Jmj+zU7g0s2H+ucSoNy/VLrbMcntV8+dVctI//6GM6BvWMP9nR/SggedLM4cGCdsMSk397TkW4IlRldWBpzrQ1rI3mpTL+lQspkL7dJv6Rn9FYXnLIjbLt5ic/QJ5xHJ3/JT7jsOHVyCVA+1bMwei0ZMiXbIt6WoY43LUuMsPZrb+vGXdxDSZ4SuVFxzlIYEXd/mUGdz7oiD286aTAM2N8YJxrtYpjqalqUkxy4WEIJYo7v/r9ev51pXyIj0CvJj0fPmYd49tqcIWfr2xqnzPB3S7ifoSVUccxjKJIZD5+g4vywNyKwAPccNQ2LC6ewN6/wAoJhq38lRPVOARqT4upWjjFzg/00BVDW+ivGUO/8VTr+moxdVA725J1+wMWA0/QpW3qCmciEafy6YsT1Fory0Va0lLHonGVo6ZFukt5j3mFr1iLd4ldV8Pl4E7DgoxEkXkXEgBX9rkJhWbZogUnXWZd5qHw2+Fna5y1AKskEkMX2xUvFJc9CdfCJOVesIdT0TtD9DJZwwz7PuSPCx4D+pnRJW0i7bRl/tRUpJUEBFHFeI12/8z5UZTagtRA/iKHbUZCCrNPWULvrnCXPDwZnxP/86/Z9smgrTbATvU3wAvSFoeJ/55aN4iC+b9gqvbt67PH0aaCvaWsQyJe/C5ufIOl0rPWzhN0IUi+I1Z7pGIMUpdbSDEeQO93SIZyk5CL6voaYqbTjSGd9n6IknEqZYerC4xB4JJOphbanMaiwDiubv0H0mf2zO7wXHVpr7Ma+89sP3b9K3PUFszBEx3+yGbm9z4XunvJUJwj1Pi3OcM22HrQwKWG3w/6kcMVVTVkzIWO1VIoY9JgQb+6QoYrdnvws67UHbuNd04SdmZiIp2U+lhTxDJd026yC1Bv92J+TEk+ZAPp2SD3LgRn3TmIbnnh7G4umfoiLN5/h7oLd2HqGTFKpYV1bkelsLChqDcPJrKok/Eyoc91R1nvIxRAtHzHkR9jvJjSPNeMxA0QgEZ9/StXgfHXglr3wBiM/+BqVuKpz6KYxZMQFCGpvBnyHeM20c7DBmPwg0WBJq1WP4H3oMnyEEwOkD+2DD6AI8fs7CRb4GhroZBemnKNem0FnL4H4Yg9Enzq3dTfzuU9POpRP1gUnZMgACjE/E9ztefsDIsIcXm6+Rtt8GpC1WD7EuSEyA/2P456sO9ceNI6XZeEcwehoYh86FrfGHtFPyzdaCZN0U6FHml5lUKLIejk2/KUxlq+cTDYlZlEaCV0M+xhlvj3hJBPk/AlR5mzbuIytpFkO6dqlOwNIi0UxVBzKZSpbwFPC/D0EN6Ffw+7wv9EXvBMZSOnW2BqQDINkDhYWpuwhBe3SForn7u7CSY8FrCmmpT6mGegXh+RzIbWsQszZeY+nBzUeF0tAFwaHkRqyg/sm9kv8n900wWNxdgmUnSz3IwPl+7c7SmZ6V9EUlTfsQ3BBsRaKNNgRYZ8ucsU7u3jOZ18wJxf6esjlr0v2uzWTg8ZYGAlU2+Fh3IVhvdQ9eLpOtf0Z5qTcOEAHxypaXr8gJQsGUfGtuVkHtrs4wlueRZnQEVnAfxMQrfLmE5cX3xdV4fynjy+zF3W9xAkjoRgOxV6UQtZkeiwIyb231QtBjdTavWE/frX/Uv6VYRGrhv8xeWaIJ8T5zCnGn9FLR98XL0bGR1gnwLg6Goa2KbbncIEGispgKjnGtnanbVVDPkAbi5gT2FRnxSh8MoV6m+0GJO+Wscx99goQQCvZwplCXTT2CIn0ri6Zgb7I1zDNCS5aFURb4e4F0xPsLoCbH8TaHIRiezVnyUE1afpzNtHYC/2xy15JdmkUJRBdV0Zha2JJj10FSQKxcxIrUzce6VtSOdzHY6V9GksTOhg/Tnchk2O3GVKJ0DCgGsOvDGI8KBTLAQC3txao4K6+hWhhEuAuWSFnPWsyB8fushifL8UHd75MgNyd5lyBIGtYU/XgWw8/bWv4CCcQy/Ro1V+4p7Q7dlLbUT8Z9TjtwhS1YPSVbTZbH6zTlCul6pRnrck5uJtlTf06TThRTBbyLncuDVgE73k1EDBxUQXE6tN0MVFxv7l+V9dFRBn+fSg8vy3rr1V7pn1PAK/RDkE3njlncxi9Su6fHShr2+7e5cq8zpLdAxz2TdFp0r4w4H2HL+qIwoiCLOo2HRClcdoqjjQkGhlN3gLGR9NlbRLtWlcujlfeMj3IiSv+3dcK+cSHsfCGCgWD6eGlgV+9rGlbUrxO4Fx3fQ/jVm/9oc2EI2lB3htnqdmc5IZp+xasOF7XSlW2kS7mL8jrqHiSKmXY5ttsHZyEDvp58kb+OQWTpo17pAKfZowRmDfdGtB248xPNF73hFdcPh3CXUfox+HaHLABcChwPM/XvzYC/QyAx5O/dMMoMhJR6v9n/hRJNAZavrJJ0CzND/C4bZI+HKXfAC0vZ9lJl9813xACJw01OhuxKYTWROPHcImWt2Mc9GoTBa6+ZdPgE4UbUulSDPpCKTnBG4ekb5iA3+pLHpzhxz5ytyaXchjl3d9NQb3JbzszDtHRpx93vWTPbXJ5Tb5693ytxLsnB6rTwgDiVJrydLPmDyYBK5NoaO7xKChVm6ogbTAMi1Y5XnCilYvUFX8680w3chjbozVWJ+eVyITTi7Py5bFCiDhvhEKxnsUxipBWiLu8MJV/2nnjICE4TdfpP1nhmmDcuK5sGESyVE5nZU1eOl+kTz1OvfrF8OVdVIABUcfSNFaqZNjNpDIECwMU4N0xcoz+izQ5M0IKkmvhhJ48biHYxaIZhjNW0j8PQfYsTZ4HwHytkYEY5MnAGdZE2qZ2+0E48n51B/NZ40ng0kzMkNaV40yuuQvd8+sSZHEWtQyrRsNX0gwjpJkAn7bAUjZi2OTsPTa28TZjl8j07umL/w6rk8CY0K1gRBsn09Nx+tpUf8VI8qWFTQSFyys+I2stb13ImzFJDhZzwa6WGHijuYF3oma38lbhiTN1mQC4cv3+ckFixPWpxyByK4rdLZ9tBVBm0JEVnlEOGfUCcuR3I6V/cRk1IAzsuc3WJHts6zHA72IZzp+Q1J5urzQx1gbzFiFgOzg/BXyYrJO331BVJV9UhWzRmJbErtvWzgshCuMHgp3cfVPD2L4ljgFCJxQMUBVc//9C+4rP6jY3EH26Rh2czjofLyClC5NPLpIqk4aINfJW8gL15el8T3O/kzHysSNPk5asTudiFAqtKDK+u46l+QyN93ZUMoD/jmILyAnG6/Xt9zYCEOpIyqTeSSMUpXUsBhCnlPmFA55RPDXWKtx1y0Ufmesz98bSYx3X+XV2mRr30vvrlHAgBMQpyjbZdyTo6/hlUaBPNm+yHFfV5DRO9SJeCKUkB6wPs0iYHoErvAxOZT6nNzdtKfcoUDqVGGHHWxa9VsQI0o4nSYS4EsDFSSAH9G+WMsjr3nWC6huphwNt2NwnhC6UdAoUeYMcgKmURP6SXJB7gT+pz1RWlS+peHKDr7pxk3kaOj5RPyiLKEdeN7jdnqm56lk65ljnhtl4RMKOTXSt7Yqho762SMrFrqHwhioqHOsL5aYkAz8LUxpqvlDE2xsqPq6qZ09nBQW7yftGT+kBcXFAfMOucG8Ph2GZUpLlvMnBHU0hJbb2p/Ty70I1X4T2LdMJ0HtuswS8DNDkd5JmNX5Mw/Jpw4aYJcd7aJSEq6rakL0w8cK8vM19VkO8lCDnK1ilHRa8qvIpPjZWLkru8II/VRfEwssYr7YVN2QXEYHBjZo0Dm+x4vMaTpz4kAEQF6I7pvRyHEiVIeJwor5tJr2Gk9uzZ/piEIqjW8IC2tf4B4e/B32Xx6a2tF9mpoNjFClU3vbElfzKRTgoCamTjo44EoYV9WCN62ahgndMsKEBDpKsI+3z5l26lvB+7QYYXqniZIEL6ZvW2VLbo7l+lRa8g03qiUceKstpP0+7GyNvGUGf4IhYy2j33Qtv8I45ifoU2MRhqjhjlZCx4+4tF61m2muhX5WquOPJn/wpnvypXuMNii2Vn++oYdHY2f0YyyvV5Ts+SEIzcIGVcxcHDHSjABsK1pWCjnOFnAWSBUWKau+v6QbQbvSuaFMMv44knqrD3/3s5ZPuNxnleE2MEhrBSZF9OBMD8BwBbf7JJmsbMkHsyQfZ+vSDbH1avJQO165deNFmIeHr3Ti4JcRwQzbwuzgRZG9IRShqeohN0jI1M7vTlDWw9XfQiqCLwz9ZAsY4kIMhP8+lFaaepr6JDMcifk+tv4CisdMHt7YSahmAtHEhZZqwI+0BADak/SO0n+M/Ccg4raXUoox8Io8t3frv9+QaN/r02P9v2dZx29fftXc9W7c1W8/Xfc3X/s46sF6uP0s90dZO62Pdz64z6/f8DezsAVrv93fWEb3LNVDfuRXSiasyD28oE33TYsxVoxU2MDx/kLgY1FxRSG1QWkYQi3NTLcQxAYTppyI4CmIX4rhg6XR7IIeuONOy7fisVBOg2eSWzeyuPr01BrMl/2RwYvXuMOTRJEKZXjrrm4GMTEZFWPFc7rKaAFDRl8741U+gbq4OAdJIBQ5Ok4cPJpxZt7x0Gs4pGSRz8Bz1uKvJFszGbaTr3ad/ZzHwOvdPlFyw5RL1saKAisoHlDBh7xdZO4hKmaKwPUm4u2PvS+OxAk4UD0YdV9E09A25FLi6bCaArqpmcLB9P/+7NKVsUXSKDU3QMirLdkIQ8p/S7NekIBwMGas5NZ2wOU83YkmrKRrA+4rNLiTaUOITekvowbFQu1b6ToLqKBU3Q8ap46eXAhZgHCspjenA+XlIdate6bodfNxx72xtl1gpW6tj26QakzSeOz4d6zKQafPgvHTTqpn6TILmHJ+4Dl2oCO/XpilQ4li7ajS26Kwrhtmprd81qDGVfCtqDETDLcwfLsgEQyErWMUMGWNRbma4TiqkbCVrDQHNKj3A0bjSUd1bF01tvrYuCBD2ADAJ94czQomuEEasYHcAkktExutxF9fMTrBrADLDGDGJ8VmixC0u3yp553Iq5JblmFlfCCK/o2c+aYwGy4efBci7B6gsBvkvydoCEOnapy25sA77M1NOzzIh6E2w4LvDUMGrzTAFsxo+pdje3RNK9KATf7n624Gbk4K9lzWGt5HKuU8tRpbANylg/JwxUJt1zNXPmP2KgbHbdWs08irGWjVzuZeeryBqerUt8mugetGtYGmC3B50+Q8E4YRRSWYqR/MZ1x99VP2W7Q594gEsA+4Y3wQAN9mRaaKckHLPT/yOUPx1LWOs9nfS+/i5twOYq6FUTepgvH9Std28TIVetAlizsTuFNeFlYm7+47P/ptg41F4kohMzSJY3nmxYqTjRMWGcNlOOYQ27qdPfrdG+D2HJyD5F5Z6T4L4H42kF+qVU2hY609PI/mk5DMlykNiNG6A0h5dmIf8pKcffsJrmKPgLcQ3SjXTQS7p1xC3ImSOZN/y99xYLrI4pdcJM/2H8zb0/XCaSWPtuj1gR+DsX3ZjTNioCKtsVSr8HnpcW222/VZ8o9PFd0IvYM5nqgE7WYtRhzz7vzaeY8HiCL7QLWm6vT2trOtbqelgjEd+ZN5aME4nl5e0u8eDF509OuZwAGWHtBMjbSt6rrCSyXcdd5OjYRAAvWzh6O/M8FPJyay4ElL95X2u37gyVWsEpLqWYp9XvqAne3/qp/jEFuJqqeuBIdf8ZbQs5azBb4Iptj1VMfhpZSwmQqbvpvZQN5vI9DR3rlh6vyh+DJnt28ArYCUYVpZNgBHLQZUTERisKsF3VkelSMfZ09c+6p1yBgksohrL5rUoflkDKFHLUbH1RayHjOppYCpQbDCEDgdtkHvl3hZkDWKYjLhUmYfIwj8UBqHUVpGMUUM+8tPiE4Qw9FyUkyht8+J5TFm+njoHmMZchZqRc5iVZIpFDMST9uljx5fJaFb7QA0EZ8Wppk0m49/4xVejV/eX9Z14d8R4ewDGm2hTAN2cQAUBfz8u2EVIT5IDKlKYaWZBcwcz5yaaXHjSdscCFKqQEt5fTTNyMc1u841s3mgP/miIFAqpWQD9AZSepBQ6taM9ub5VvB21y2h3ccduaEzgIcOk6KouZO3mo8Qr2b/5xmkNjT7KIU59wnK0i92WIgf5Pz9BvXUSRVibeNxeiq6wLn7hDZuXCJ+5emjY9AV3R6z59NrWIEpVmxfes9uTJUF7jUdjx9CYNG+RND9hNjBRlUMsyjuJp0w5LOeuR6rKwJeb3tCMomi4qM0owmytPjGxcNhuybzDZY/yYj4QvEzrXOs9wgfmYmnrrFeK6+IaqzK5x+rPhlP27eqJaNdSedqsj2OQ0ZHCTWLT2rxMCkPFdrBb+3CoZxDdCsWgfHMp4XLRzh2CjpvK7FzobVHjjZVhAzQoFfHoq7/VhwcvGZGyFFUuEVCzrdGY3zYGs+mjDPvKAP6SXdMOJrS7EX61KdFhVu+Ej5HRyIryvCmYaRkC7OCkunYi9tv9s3jGjUbYbfF2eljeFKFVewCX8I+hWWRaSgGOAGTJYxkmcuYR7ZFjP4krwVqNSJ7mKBaoBcgpUwSnnCich82cXYEAkBN5rPjF1hqgt9+hDTR5iWM1TNnPpLVkBpXvN1gVdHKGlLRSY4nFAjFHCqQMUElrouyOwTsi71RqXOmLrLBBQym6YY+h7YqCeYJFWNBd5BwUxAb4Dndxi5YmgBo1Uy9+i9+D+sfPObaraR3Cq1V3vsx8Vra4SXLH4cHatqyI6xWZ0w8puk3oVIrkjp/QpwSbm/ePWUFUnTXE6kVmKJnrSNNdZtaGSeBWLXU53TRvLofxcPg6HBMr+VwzIeOZITOzbSn7DzJhiURxXHcjfpjWH6aud3SnDJJZoOtSVQJgH7mmRw9YBEzzRCcnhYo23SZWD7cgE2i3TREfOMxn5bQH/MfFX9LDlfI9F+7+cmpbpsNP5GfXOL+ENxKua3LsVq5hbrg4Il5SOs/dINKERR3Y7qmRp/7XuowpOH6j1spsgk/Cs9oGz7AX8lYEwmendjvUHrVNSZpcaVL3StluZpr6JoXXwtS8GMhxfhvgM7P+K30v67s01HnMZ2aWu6QS/zPewiXMoKnyM0oB8XbZN7G5tgwhaDqcLJMQ5cM4nAoW4G5dnwR/CnL8njImcaU9seuXBcepARuNvAXaXaGmyok1B3RPovjor0blv/HSSZmrNOWRs9/XcR3nhjxm/iy5+WsNt/TPB5nhTCcpg1mX5tYEVZUWbMUjrQDh1BJEUgmgo+K8kqAYMGnx64iuJLXLiBTIeNcD0SYExomllEEsKgnYALn09Yf7UkE5itvk+jXRQH9nfr6pUT3pCglNHbMlMAGkh+axp8/twMI6hl4cyrVBkXkClUzhnPBTG24WKtxLCBZws5h9UBUWge1Q10arSAJMMsUu7L2UkAw3uHBjgh0MQF+sHkkUgovdUuyxDz6acts2IJp1cENQk5GHH0SzVJKZ6FN7Sg4/b7hz9nkam2Wy0b/mE78V9+/9jH3GWIWiyoFJUYsv9K37DnDi1czFO6TTKk+nPK30NFLVkxgRYwAfGTtYxrGYrzg+M451+Cn2qaaqWorica4pEhXuDPinzBhOMnAT9D/cLFGSBw==","base64")).toString()),Mj)});var U1e=_((Gj,Wj)=>{(function(t){Gj&&typeof Gj=="object"&&typeof Wj<"u"?Wj.exports=t():typeof define=="function"&&define.amd?define([],t):typeof window<"u"?window.isWindows=t():typeof global<"u"?global.isWindows=t():typeof self<"u"?self.isWindows=t():this.isWindows=t()})(function(){"use strict";return function(){return process&&(process.platform==="win32"||/^(msys|cygwin)$/.test(process.env.OSTYPE))}})});var j1e=_((PXt,q1e)=>{"use strict";Yj.ifExists=Twt;var FC=ve("util"),cc=ve("path"),_1e=U1e(),Qwt=/^#!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/,Fwt={createPwshFile:!0,createCmdFile:_1e(),fs:ve("fs")},Rwt=new Map([[".js","node"],[".cjs","node"],[".mjs","node"],[".cmd","cmd"],[".bat","cmd"],[".ps1","pwsh"],[".sh","sh"]]);function H1e(t){let e={...Fwt,...t},r=e.fs;return e.fs_={chmod:r.chmod?FC.promisify(r.chmod):async()=>{},mkdir:FC.promisify(r.mkdir),readFile:FC.promisify(r.readFile),stat:FC.promisify(r.stat),unlink:FC.promisify(r.unlink),writeFile:FC.promisify(r.writeFile)},e}async function Yj(t,e,r){let o=H1e(r);await o.fs_.stat(t),await Nwt(t,e,o)}function Twt(t,e,r){return Yj(t,e,r).catch(()=>{})}function Lwt(t,e){return e.fs_.unlink(t).catch(()=>{})}async function Nwt(t,e,r){let o=await Hwt(t,r);return await Owt(e,r),Mwt(t,e,o,r)}function Owt(t,e){return e.fs_.mkdir(cc.dirname(t),{recursive:!0})}function Mwt(t,e,r,o){let a=H1e(o),n=[{generator:Gwt,extension:""}];return a.createCmdFile&&n.push({generator:jwt,extension:".cmd"}),a.createPwshFile&&n.push({generator:Wwt,extension:".ps1"}),Promise.all(n.map(u=>qwt(t,e+u.extension,r,u.generator,a)))}function Uwt(t,e){return Lwt(t,e)}function _wt(t,e){return Ywt(t,e)}async function Hwt(t,e){let a=(await e.fs_.readFile(t,"utf8")).trim().split(/\r*\n/)[0].match(Qwt);if(!a){let n=cc.extname(t).toLowerCase();return{program:Rwt.get(n)||null,additionalArgs:""}}return{program:a[1],additionalArgs:a[2]}}async function qwt(t,e,r,o,a){let n=a.preserveSymlinks?"--preserve-symlinks":"",u=[r.additionalArgs,n].filter(A=>A).join(" ");return a=Object.assign({},a,{prog:r.program,args:u}),await Uwt(e,a),await a.fs_.writeFile(e,o(t,e,a),"utf8"),_wt(e,a)}function jwt(t,e,r){let a=cc.relative(cc.dirname(e),t).split("/").join("\\"),n=cc.isAbsolute(a)?`"${a}"`:`"%~dp0\\${a}"`,u,A=r.prog,p=r.args||"",h=Vj(r.nodePath).win32;A?(u=`"%~dp0\\${A}.exe"`,a=n):(A=n,p="",a="");let E=r.progArgs?`${r.progArgs.join(" ")} `:"",w=h?`@SET NODE_PATH=${h}\r -`:"";return u?w+=`@IF EXIST ${u} (\r - ${u} ${p} ${a} ${E}%*\r -) ELSE (\r - @SETLOCAL\r - @SET PATHEXT=%PATHEXT:;.JS;=;%\r - ${A} ${p} ${a} ${E}%*\r -)\r -`:w+=`@${A} ${p} ${a} ${E}%*\r -`,w}function Gwt(t,e,r){let o=cc.relative(cc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n;o=o.split("\\").join("/");let u=cc.isAbsolute(o)?`"${o}"`:`"$basedir/${o}"`,A=r.args||"",p=Vj(r.nodePath).posix;a?(n=`"$basedir/${r.prog}"`,o=u):(a=u,A="",o="");let h=r.progArgs?`${r.progArgs.join(" ")} `:"",E=`#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*) basedir=\`cygpath -w "$basedir"\`;; -esac - -`,w=r.nodePath?`export NODE_PATH="${p}" -`:"";return n?E+=`${w}if [ -x ${n} ]; then - exec ${n} ${A} ${o} ${h}"$@" -else - exec ${a} ${A} ${o} ${h}"$@" -fi -`:E+=`${w}${a} ${A} ${o} ${h}"$@" -exit $? -`,E}function Wwt(t,e,r){let o=cc.relative(cc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n=a&&`"${a}$exe"`,u;o=o.split("\\").join("/");let A=cc.isAbsolute(o)?`"${o}"`:`"$basedir/${o}"`,p=r.args||"",h=Vj(r.nodePath),E=h.win32,w=h.posix;n?(u=`"$basedir/${r.prog}$exe"`,o=A):(n=A,p="",o="");let D=r.progArgs?`${r.progArgs.join(" ")} `:"",b=`#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -${r.nodePath?`$env_node_path=$env:NODE_PATH -$env:NODE_PATH="${E}" -`:""}if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -}`;return r.nodePath&&(b+=` else { - $env:NODE_PATH="${w}" -}`),u?b+=` -$ret=0 -if (Test-Path ${u}) { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & ${u} ${p} ${o} ${D}$args - } else { - & ${u} ${p} ${o} ${D}$args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & ${n} ${p} ${o} ${D}$args - } else { - & ${n} ${p} ${o} ${D}$args - } - $ret=$LASTEXITCODE -} -${r.nodePath?`$env:NODE_PATH=$env_node_path -`:""}exit $ret -`:b+=` -# Support pipeline input -if ($MyInvocation.ExpectingInput) { - $input | & ${n} ${p} ${o} ${D}$args -} else { - & ${n} ${p} ${o} ${D}$args -} -${r.nodePath?`$env:NODE_PATH=$env_node_path -`:""}exit $LASTEXITCODE -`,b}function Ywt(t,e){return e.fs_.chmod(t,493)}function Vj(t){if(!t)return{win32:"",posix:""};let e=typeof t=="string"?t.split(cc.delimiter):Array.from(t),r={};for(let o=0;o`/mnt/${A.toLowerCase()}`):e[o];r.win32=r.win32?`${r.win32};${a}`:a,r.posix=r.posix?`${r.posix}:${n}`:n,r[o]={win32:a,posix:n}}return r}q1e.exports=Yj});var aG=_((KZt,c2e)=>{c2e.exports=ve("stream")});var p2e=_((JZt,f2e)=>{"use strict";function u2e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,o)}return r}function E1t(t){for(var e=1;e0?this.tail.next=o:this.head=o,this.tail=o,++this.length}},{key:"unshift",value:function(r){var o={data:r,next:this.head};this.length===0&&(this.tail=o),this.head=o,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var o=this.head,a=""+o.data;o=o.next;)a+=r+o.data;return a}},{key:"concat",value:function(r){if(this.length===0)return sF.alloc(0);for(var o=sF.allocUnsafe(r>>>0),a=this.head,n=0;a;)S1t(a.data,o,n),n+=a.data.length,a=a.next;return o}},{key:"consume",value:function(r,o){var a;return ru.length?u.length:r;if(A===u.length?n+=u:n+=u.slice(0,r),r-=A,r===0){A===u.length?(++a,o.next?this.head=o.next:this.head=this.tail=null):(this.head=o,o.data=u.slice(A));break}++a}return this.length-=a,n}},{key:"_getBuffer",value:function(r){var o=sF.allocUnsafe(r),a=this.head,n=1;for(a.data.copy(o),r-=a.data.length;a=a.next;){var u=a.data,A=r>u.length?u.length:r;if(u.copy(o,o.length-r,0,A),r-=A,r===0){A===u.length?(++n,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=u.slice(A));break}++n}return this.length-=n,o}},{key:D1t,value:function(r,o){return lG(this,E1t({},o,{depth:0,customInspect:!1}))}}]),t}()});var uG=_((zZt,g2e)=>{"use strict";function P1t(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(cG,this,t)):process.nextTick(cG,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(n){!e&&n?r._writableState?r._writableState.errorEmitted?process.nextTick(oF,r):(r._writableState.errorEmitted=!0,process.nextTick(h2e,r,n)):process.nextTick(h2e,r,n):e?(process.nextTick(oF,r),e(n)):process.nextTick(oF,r)}),this)}function h2e(t,e){cG(t,e),oF(t)}function oF(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function x1t(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function cG(t,e){t.emit("error",e)}function b1t(t,e){var r=t._readableState,o=t._writableState;r&&r.autoDestroy||o&&o.autoDestroy?t.destroy(e):t.emit("error",e)}g2e.exports={destroy:P1t,undestroy:x1t,errorOrDestroy:b1t}});var Jh=_((XZt,y2e)=>{"use strict";var m2e={};function Ac(t,e,r){r||(r=Error);function o(n,u,A){return typeof e=="string"?e:e(n,u,A)}class a extends r{constructor(u,A,p){super(o(u,A,p))}}a.prototype.name=r.name,a.prototype.code=t,m2e[t]=a}function d2e(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(o=>String(o)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function k1t(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Q1t(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function F1t(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Ac("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ac("ERR_INVALID_ARG_TYPE",function(t,e,r){let o;typeof e=="string"&&k1t(e,"not ")?(o="must not be",e=e.replace(/^not /,"")):o="must be";let a;if(Q1t(t," argument"))a=`The ${t} ${o} ${d2e(e,"type")}`;else{let n=F1t(t,".")?"property":"argument";a=`The "${t}" ${n} ${o} ${d2e(e,"type")}`}return a+=`. Received type ${typeof r}`,a},TypeError);Ac("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ac("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ac("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ac("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ac("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ac("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ac("ERR_STREAM_WRITE_AFTER_END","write after end");Ac("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ac("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ac("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");y2e.exports.codes=m2e});var AG=_((ZZt,E2e)=>{"use strict";var R1t=Jh().codes.ERR_INVALID_OPT_VALUE;function T1t(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function L1t(t,e,r,o){var a=T1t(e,o,r);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var n=o?r:"highWaterMark";throw new R1t(n,a)}return Math.floor(a)}return t.objectMode?16:16*1024}E2e.exports={getHighWaterMark:L1t}});var C2e=_(($Zt,fG)=>{typeof Object.create=="function"?fG.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:fG.exports=function(e,r){if(r){e.super_=r;var o=function(){};o.prototype=r.prototype,e.prototype=new o,e.prototype.constructor=e}}});var zh=_((e$t,hG)=>{try{if(pG=ve("util"),typeof pG.inherits!="function")throw"";hG.exports=pG.inherits}catch{hG.exports=C2e()}var pG});var w2e=_((t$t,I2e)=>{I2e.exports=ve("util").deprecate});var mG=_((r$t,x2e)=>{"use strict";x2e.exports=Li;function v2e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){l2t(e,t)}}var OC;Li.WritableState=Tv;var N1t={deprecate:w2e()},D2e=aG(),lF=ve("buffer").Buffer,O1t=global.Uint8Array||function(){};function M1t(t){return lF.from(t)}function U1t(t){return lF.isBuffer(t)||t instanceof O1t}var dG=uG(),_1t=AG(),H1t=_1t.getHighWaterMark,Xh=Jh().codes,q1t=Xh.ERR_INVALID_ARG_TYPE,j1t=Xh.ERR_METHOD_NOT_IMPLEMENTED,G1t=Xh.ERR_MULTIPLE_CALLBACK,W1t=Xh.ERR_STREAM_CANNOT_PIPE,Y1t=Xh.ERR_STREAM_DESTROYED,V1t=Xh.ERR_STREAM_NULL_VALUES,K1t=Xh.ERR_STREAM_WRITE_AFTER_END,J1t=Xh.ERR_UNKNOWN_ENCODING,MC=dG.errorOrDestroy;zh()(Li,D2e);function z1t(){}function Tv(t,e,r){OC=OC||dd(),t=t||{},typeof r!="boolean"&&(r=e instanceof OC),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=H1t(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=t.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){n2t(e,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new v2e(this)}Tv.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Tv.prototype,"buffer",{get:N1t.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var aF;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(aF=Function.prototype[Symbol.hasInstance],Object.defineProperty(Li,Symbol.hasInstance,{value:function(e){return aF.call(this,e)?!0:this!==Li?!1:e&&e._writableState instanceof Tv}})):aF=function(e){return e instanceof this};function Li(t){OC=OC||dd();var e=this instanceof OC;if(!e&&!aF.call(Li,this))return new Li(t);this._writableState=new Tv(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),D2e.call(this)}Li.prototype.pipe=function(){MC(this,new W1t)};function X1t(t,e){var r=new K1t;MC(t,r),process.nextTick(e,r)}function Z1t(t,e,r,o){var a;return r===null?a=new V1t:typeof r!="string"&&!e.objectMode&&(a=new q1t("chunk",["string","Buffer"],r)),a?(MC(t,a),process.nextTick(o,a),!1):!0}Li.prototype.write=function(t,e,r){var o=this._writableState,a=!1,n=!o.objectMode&&U1t(t);return n&&!lF.isBuffer(t)&&(t=M1t(t)),typeof e=="function"&&(r=e,e=null),n?e="buffer":e||(e=o.defaultEncoding),typeof r!="function"&&(r=z1t),o.ending?X1t(this,r):(n||Z1t(this,o,t,r))&&(o.pendingcb++,a=e2t(this,o,n,t,e,r)),a};Li.prototype.cork=function(){this._writableState.corked++};Li.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&S2e(this,t))};Li.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new J1t(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Li.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function $1t(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=lF.from(e,r)),e}Object.defineProperty(Li.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function e2t(t,e,r,o,a,n){if(!r){var u=$1t(e,o,a);o!==u&&(r=!0,a="buffer",o=u)}var A=e.objectMode?1:o.length;e.length+=A;var p=e.length{"use strict";var c2t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};k2e.exports=IA;var b2e=CG(),EG=mG();zh()(IA,b2e);for(yG=c2t(EG.prototype),cF=0;cF{var AF=ve("buffer"),np=AF.Buffer;function Q2e(t,e){for(var r in t)e[r]=t[r]}np.from&&np.alloc&&np.allocUnsafe&&np.allocUnsafeSlow?F2e.exports=AF:(Q2e(AF,IG),IG.Buffer=UC);function UC(t,e,r){return np(t,e,r)}Q2e(np,UC);UC.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return np(t,e,r)};UC.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var o=np(t);return e!==void 0?typeof r=="string"?o.fill(e,r):o.fill(e):o.fill(0),o};UC.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return np(t)};UC.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return AF.SlowBuffer(t)}});var vG=_(L2e=>{"use strict";var BG=R2e().Buffer,T2e=BG.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function f2t(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function p2t(t){var e=f2t(t);if(typeof e!="string"&&(BG.isEncoding===T2e||!T2e(t)))throw new Error("Unknown encoding: "+t);return e||t}L2e.StringDecoder=Lv;function Lv(t){this.encoding=p2t(t);var e;switch(this.encoding){case"utf16le":this.text=E2t,this.end=C2t,e=4;break;case"utf8":this.fillLast=d2t,e=4;break;case"base64":this.text=I2t,this.end=w2t,e=3;break;default:this.write=B2t,this.end=v2t;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=BG.allocUnsafe(e)}Lv.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function h2t(t,e,r){var o=e.length-1;if(o=0?(a>0&&(t.lastNeed=a-1),a):--o=0?(a>0&&(t.lastNeed=a-2),a):--o=0?(a>0&&(a===2?a=0:t.lastNeed=a-3),a):0))}function g2t(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function d2t(t){var e=this.lastTotal-this.lastNeed,r=g2t(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function m2t(t,e){var r=h2t(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var o=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,o),t.toString("utf8",e,o)}function y2t(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function E2t(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var o=r.charCodeAt(r.length-1);if(o>=55296&&o<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function C2t(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function I2t(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function w2t(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function B2t(t){return t.toString(this.encoding)}function v2t(t){return t&&t.length?this.write(t):""}});var fF=_((s$t,M2e)=>{"use strict";var N2e=Jh().codes.ERR_STREAM_PREMATURE_CLOSE;function D2t(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,o=new Array(r),a=0;a{"use strict";var pF;function Zh(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var x2t=fF(),$h=Symbol("lastResolve"),md=Symbol("lastReject"),Nv=Symbol("error"),hF=Symbol("ended"),yd=Symbol("lastPromise"),DG=Symbol("handlePromise"),Ed=Symbol("stream");function e0(t,e){return{value:t,done:e}}function b2t(t){var e=t[$h];if(e!==null){var r=t[Ed].read();r!==null&&(t[yd]=null,t[$h]=null,t[md]=null,e(e0(r,!1)))}}function k2t(t){process.nextTick(b2t,t)}function Q2t(t,e){return function(r,o){t.then(function(){if(e[hF]){r(e0(void 0,!0));return}e[DG](r,o)},o)}}var F2t=Object.getPrototypeOf(function(){}),R2t=Object.setPrototypeOf((pF={get stream(){return this[Ed]},next:function(){var e=this,r=this[Nv];if(r!==null)return Promise.reject(r);if(this[hF])return Promise.resolve(e0(void 0,!0));if(this[Ed].destroyed)return new Promise(function(u,A){process.nextTick(function(){e[Nv]?A(e[Nv]):u(e0(void 0,!0))})});var o=this[yd],a;if(o)a=new Promise(Q2t(o,this));else{var n=this[Ed].read();if(n!==null)return Promise.resolve(e0(n,!1));a=new Promise(this[DG])}return this[yd]=a,a}},Zh(pF,Symbol.asyncIterator,function(){return this}),Zh(pF,"return",function(){var e=this;return new Promise(function(r,o){e[Ed].destroy(null,function(a){if(a){o(a);return}r(e0(void 0,!0))})})}),pF),F2t),T2t=function(e){var r,o=Object.create(R2t,(r={},Zh(r,Ed,{value:e,writable:!0}),Zh(r,$h,{value:null,writable:!0}),Zh(r,md,{value:null,writable:!0}),Zh(r,Nv,{value:null,writable:!0}),Zh(r,hF,{value:e._readableState.endEmitted,writable:!0}),Zh(r,DG,{value:function(n,u){var A=o[Ed].read();A?(o[yd]=null,o[$h]=null,o[md]=null,n(e0(A,!1))):(o[$h]=n,o[md]=u)},writable:!0}),r));return o[yd]=null,x2t(e,function(a){if(a&&a.code!=="ERR_STREAM_PREMATURE_CLOSE"){var n=o[md];n!==null&&(o[yd]=null,o[$h]=null,o[md]=null,n(a)),o[Nv]=a;return}var u=o[$h];u!==null&&(o[yd]=null,o[$h]=null,o[md]=null,u(e0(void 0,!0))),o[hF]=!0}),e.on("readable",k2t.bind(null,o)),o};U2e.exports=T2t});var G2e=_((a$t,j2e)=>{"use strict";function H2e(t,e,r,o,a,n,u){try{var A=t[n](u),p=A.value}catch(h){r(h);return}A.done?e(p):Promise.resolve(p).then(o,a)}function L2t(t){return function(){var e=this,r=arguments;return new Promise(function(o,a){var n=t.apply(e,r);function u(p){H2e(n,o,a,u,A,"next",p)}function A(p){H2e(n,o,a,u,A,"throw",p)}u(void 0)})}}function q2e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,o)}return r}function N2t(t){for(var e=1;e{"use strict";eBe.exports=wn;var _C;wn.ReadableState=K2e;var l$t=ve("events").EventEmitter,V2e=function(e,r){return e.listeners(r).length},Mv=aG(),gF=ve("buffer").Buffer,_2t=global.Uint8Array||function(){};function H2t(t){return gF.from(t)}function q2t(t){return gF.isBuffer(t)||t instanceof _2t}var SG=ve("util"),tn;SG&&SG.debuglog?tn=SG.debuglog("stream"):tn=function(){};var j2t=p2e(),RG=uG(),G2t=AG(),W2t=G2t.getHighWaterMark,dF=Jh().codes,Y2t=dF.ERR_INVALID_ARG_TYPE,V2t=dF.ERR_STREAM_PUSH_AFTER_EOF,K2t=dF.ERR_METHOD_NOT_IMPLEMENTED,J2t=dF.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,HC,PG,xG;zh()(wn,Mv);var Ov=RG.errorOrDestroy,bG=["error","close","destroy","pause","resume"];function z2t(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function K2e(t,e,r){_C=_C||dd(),t=t||{},typeof r!="boolean"&&(r=e instanceof _C),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=W2t(this,t,"readableHighWaterMark",r),this.buffer=new j2t,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(HC||(HC=vG().StringDecoder),this.decoder=new HC(t.encoding),this.encoding=t.encoding)}function wn(t){if(_C=_C||dd(),!(this instanceof wn))return new wn(t);var e=this instanceof _C;this._readableState=new K2e(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Mv.call(this)}Object.defineProperty(wn.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});wn.prototype.destroy=RG.destroy;wn.prototype._undestroy=RG.undestroy;wn.prototype._destroy=function(t,e){e(t)};wn.prototype.push=function(t,e){var r=this._readableState,o;return r.objectMode?o=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=gF.from(t,e),e=""),o=!0),J2e(this,t,e,!1,o)};wn.prototype.unshift=function(t){return J2e(this,t,null,!0,!1)};function J2e(t,e,r,o,a){tn("readableAddChunk",e);var n=t._readableState;if(e===null)n.reading=!1,$2t(t,n);else{var u;if(a||(u=X2t(n,e)),u)Ov(t,u);else if(n.objectMode||e&&e.length>0)if(typeof e!="string"&&!n.objectMode&&Object.getPrototypeOf(e)!==gF.prototype&&(e=H2t(e)),o)n.endEmitted?Ov(t,new J2t):kG(t,n,e,!0);else if(n.ended)Ov(t,new V2t);else{if(n.destroyed)return!1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?kG(t,n,e,!1):FG(t,n)):kG(t,n,e,!1)}else o||(n.reading=!1,FG(t,n))}return!n.ended&&(n.length=W2e?t=W2e:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Y2e(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=Z2t(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}wn.prototype.read=function(t){tn("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return tn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?QG(this):mF(this),null;if(t=Y2e(t,e),t===0&&e.ended)return e.length===0&&QG(this),null;var o=e.needReadable;tn("need readable",o),(e.length===0||e.length-t0?a=Z2e(t,e):a=null,a===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&QG(this)),a!==null&&this.emit("data",a),a};function $2t(t,e){if(tn("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?mF(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,z2e(t)))}}function mF(t){var e=t._readableState;tn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(tn("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(z2e,t))}function z2e(t){var e=t._readableState;tn("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,TG(t)}function FG(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(eBt,t,e))}function eBt(t,e){for(;!e.reading&&!e.ended&&(e.length1&&$2e(o.pipes,t)!==-1)&&!h&&(tn("false write response, pause",o.awaitDrain),o.awaitDrain++),r.pause())}function D(N){tn("onerror",N),T(),t.removeListener("error",D),V2e(t,"error")===0&&Ov(t,N)}z2t(t,"error",D);function b(){t.removeListener("finish",C),T()}t.once("close",b);function C(){tn("onfinish"),t.removeListener("close",b),T()}t.once("finish",C);function T(){tn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),o.flowing||(tn("pipe resume"),r.resume()),t};function tBt(t){return function(){var r=t._readableState;tn("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&V2e(t,"data")&&(r.flowing=!0,TG(t))}}wn.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var o=e.pipes,a=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var n=0;n0,o.flowing!==!1&&this.resume()):t==="readable"&&!o.endEmitted&&!o.readableListening&&(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,tn("on readable",o.length,o.reading),o.length?mF(this):o.reading||process.nextTick(rBt,this)),r};wn.prototype.addListener=wn.prototype.on;wn.prototype.removeListener=function(t,e){var r=Mv.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(X2e,this),r};wn.prototype.removeAllListeners=function(t){var e=Mv.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(X2e,this),e};function X2e(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function rBt(t){tn("readable nexttick read 0"),t.read(0)}wn.prototype.resume=function(){var t=this._readableState;return t.flowing||(tn("resume"),t.flowing=!t.readableListening,nBt(this,t)),t.paused=!1,this};function nBt(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(iBt,t,e))}function iBt(t,e){tn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),TG(t),e.flowing&&!e.reading&&t.read(0)}wn.prototype.pause=function(){return tn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(tn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function TG(t){var e=t._readableState;for(tn("flow",e.flowing);e.flowing&&t.read()!==null;);}wn.prototype.wrap=function(t){var e=this,r=this._readableState,o=!1;t.on("end",function(){if(tn("wrapped end"),r.decoder&&!r.ended){var u=r.decoder.end();u&&u.length&&e.push(u)}e.push(null)}),t.on("data",function(u){if(tn("wrapped data"),r.decoder&&(u=r.decoder.write(u)),!(r.objectMode&&u==null)&&!(!r.objectMode&&(!u||!u.length))){var A=e.push(u);A||(o=!0,t.pause())}});for(var a in t)this[a]===void 0&&typeof t[a]=="function"&&(this[a]=function(A){return function(){return t[A].apply(t,arguments)}}(a));for(var n=0;n=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function QG(t){var e=t._readableState;tn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(sBt,e,t))}function sBt(t,e){if(tn("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(wn.from=function(t,e){return xG===void 0&&(xG=G2e()),xG(wn,t,e)});function $2e(t,e){for(var r=0,o=t.length;r{"use strict";rBe.exports=ip;var yF=Jh().codes,oBt=yF.ERR_METHOD_NOT_IMPLEMENTED,aBt=yF.ERR_MULTIPLE_CALLBACK,lBt=yF.ERR_TRANSFORM_ALREADY_TRANSFORMING,cBt=yF.ERR_TRANSFORM_WITH_LENGTH_0,EF=dd();zh()(ip,EF);function uBt(t,e){var r=this._transformState;r.transforming=!1;var o=r.writecb;if(o===null)return this.emit("error",new aBt);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),o(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length{"use strict";iBe.exports=Uv;var nBe=LG();zh()(Uv,nBe);function Uv(t){if(!(this instanceof Uv))return new Uv(t);nBe.call(this,t)}Uv.prototype._transform=function(t,e,r){r(null,t)}});var uBe=_((f$t,cBe)=>{"use strict";var NG;function fBt(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var lBe=Jh().codes,pBt=lBe.ERR_MISSING_ARGS,hBt=lBe.ERR_STREAM_DESTROYED;function oBe(t){if(t)throw t}function gBt(t){return t.setHeader&&typeof t.abort=="function"}function dBt(t,e,r,o){o=fBt(o);var a=!1;t.on("close",function(){a=!0}),NG===void 0&&(NG=fF()),NG(t,{readable:e,writable:r},function(u){if(u)return o(u);a=!0,o()});var n=!1;return function(u){if(!a&&!n){if(n=!0,gBt(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();o(u||new hBt("pipe"))}}}function aBe(t){t()}function mBt(t,e){return t.pipe(e)}function yBt(t){return!t.length||typeof t[t.length-1]!="function"?oBe:t.pop()}function EBt(){for(var t=arguments.length,e=new Array(t),r=0;r0;return dBt(u,p,h,function(E){a||(a=E),E&&n.forEach(aBe),!p&&(n.forEach(aBe),o(a))})});return e.reduce(mBt)}cBe.exports=EBt});var qC=_((fc,Hv)=>{var _v=ve("stream");process.env.READABLE_STREAM==="disable"&&_v?(Hv.exports=_v.Readable,Object.assign(Hv.exports,_v),Hv.exports.Stream=_v):(fc=Hv.exports=CG(),fc.Stream=_v||fc,fc.Readable=fc,fc.Writable=mG(),fc.Duplex=dd(),fc.Transform=LG(),fc.PassThrough=sBe(),fc.finished=fF(),fc.pipeline=uBe())});var pBe=_((p$t,fBe)=>{"use strict";var{Buffer:hu}=ve("buffer"),ABe=Symbol.for("BufferList");function fi(t){if(!(this instanceof fi))return new fi(t);fi._init.call(this,t)}fi._init=function(e){Object.defineProperty(this,ABe,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};fi.prototype._new=function(e){return new fi(e)};fi.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let o=0;othis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};fi.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};fi.prototype.copy=function(e,r,o,a){if((typeof o!="number"||o<0)&&(o=0),(typeof a!="number"||a>this.length)&&(a=this.length),o>=this.length||a<=0)return e||hu.alloc(0);let n=!!e,u=this._offset(o),A=a-o,p=A,h=n&&r||0,E=u[1];if(o===0&&a===this.length){if(!n)return this._bufs.length===1?this._bufs[0]:hu.concat(this._bufs,this.length);for(let w=0;wD)this._bufs[w].copy(e,h,E),h+=D;else{this._bufs[w].copy(e,h,E,E+p),h+=D;break}p-=D,E&&(E=0)}return e.length>h?e.slice(0,h):e};fi.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let o=this._offset(e),a=this._offset(r),n=this._bufs.slice(o[0],a[0]+1);return a[1]===0?n.pop():n[n.length-1]=n[n.length-1].slice(0,a[1]),o[1]!==0&&(n[0]=n[0].slice(o[1])),this._new(n)};fi.prototype.toString=function(e,r,o){return this.slice(r,o).toString(e)};fi.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};fi.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let o=this._offset(e),a=o[0],n=o[1];for(;a=t.length){let p=u.indexOf(t,n);if(p!==-1)return this._reverseOffset([a,p]);n=u.length-t.length+1}else{let p=this._reverseOffset([a,n]);if(this._match(p,t))return p;n++}n=0}return-1};fi.prototype._match=function(t,e){if(this.length-t{"use strict";var OG=qC().Duplex,CBt=zh(),qv=pBe();function Fo(t){if(!(this instanceof Fo))return new Fo(t);if(typeof t=="function"){this._callback=t;let e=function(o){this._callback&&(this._callback(o),this._callback=null)}.bind(this);this.on("pipe",function(o){o.on("error",e)}),this.on("unpipe",function(o){o.removeListener("error",e)}),t=null}qv._init.call(this,t),OG.call(this)}CBt(Fo,OG);Object.assign(Fo.prototype,qv.prototype);Fo.prototype._new=function(e){return new Fo(e)};Fo.prototype._write=function(e,r,o){this._appendBuffer(e),typeof o=="function"&&o()};Fo.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Fo.prototype.end=function(e){OG.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Fo.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Fo.prototype._isBufferList=function(e){return e instanceof Fo||e instanceof qv||Fo.isBufferList(e)};Fo.isBufferList=qv.isBufferList;CF.exports=Fo;CF.exports.BufferListStream=Fo;CF.exports.BufferList=qv});var _G=_(GC=>{var IBt=Buffer.alloc,wBt="0000000000000000000",BBt="7777777777777777777",gBe=48,dBe=Buffer.from("ustar\0","binary"),vBt=Buffer.from("00","binary"),DBt=Buffer.from("ustar ","binary"),SBt=Buffer.from(" \0","binary"),PBt=parseInt("7777",8),jv=257,UG=263,xBt=function(t,e,r){return typeof t!="number"?r:(t=~~t,t>=e?e:t>=0||(t+=e,t>=0)?t:0)},bBt=function(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},kBt=function(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},mBe=function(t,e,r,o){for(;re?BBt.slice(0,e)+" ":wBt.slice(0,e-t.length)+t+" "};function QBt(t){var e;if(t[0]===128)e=!0;else if(t[0]===255)e=!1;else return null;for(var r=[],o=t.length-1;o>0;o--){var a=t[o];e?r.push(a):r.push(255-a)}var n=0,u=r.length;for(o=0;o=Math.pow(10,r)&&r++,e+r+t};GC.decodeLongPath=function(t,e){return jC(t,0,t.length,e)};GC.encodePax=function(t){var e="";t.name&&(e+=MG(" path="+t.name+` -`)),t.linkname&&(e+=MG(" linkpath="+t.linkname+` -`));var r=t.pax;if(r)for(var o in r)e+=MG(" "+o+"="+r[o]+` -`);return Buffer.from(e)};GC.decodePax=function(t){for(var e={};t.length;){for(var r=0;r100;){var a=r.indexOf("/");if(a===-1)return null;o+=o?"/"+r.slice(0,a):r.slice(0,a),r=r.slice(a+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(o)>155||t.linkname&&Buffer.byteLength(t.linkname)>100?null:(e.write(r),e.write(t0(t.mode&PBt,6),100),e.write(t0(t.uid,6),108),e.write(t0(t.gid,6),116),e.write(t0(t.size,11),124),e.write(t0(t.mtime.getTime()/1e3|0,11),136),e[156]=gBe+kBt(t.type),t.linkname&&e.write(t.linkname,157),dBe.copy(e,jv),vBt.copy(e,UG),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(t0(t.devmajor||0,6),329),e.write(t0(t.devminor||0,6),337),o&&e.write(o,345),e.write(t0(yBe(e),6),148),e)};GC.decode=function(t,e,r){var o=t[156]===0?0:t[156]-gBe,a=jC(t,0,100,e),n=r0(t,100,8),u=r0(t,108,8),A=r0(t,116,8),p=r0(t,124,12),h=r0(t,136,12),E=bBt(o),w=t[157]===0?null:jC(t,157,100,e),D=jC(t,265,32),b=jC(t,297,32),C=r0(t,329,8),T=r0(t,337,8),N=yBe(t);if(N===8*32)return null;if(N!==r0(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(dBe.compare(t,jv,jv+6)===0)t[345]&&(a=jC(t,345,155,e)+"/"+a);else if(!(DBt.compare(t,jv,jv+6)===0&&SBt.compare(t,UG,UG+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return o===0&&a&&a[a.length-1]==="/"&&(o=5),{name:a,mode:n,uid:u,gid:A,size:p,mtime:new Date(1e3*h),type:E,linkname:w,uname:D,gname:b,devmajor:C,devminor:T}}});var DBe=_((d$t,vBe)=>{var CBe=ve("util"),FBt=hBe(),Gv=_G(),IBe=qC().Writable,wBe=qC().PassThrough,BBe=function(){},EBe=function(t){return t&=511,t&&512-t},RBt=function(t,e){var r=new IF(t,e);return r.end(),r},TBt=function(t,e){return e.path&&(t.name=e.path),e.linkpath&&(t.linkname=e.linkpath),e.size&&(t.size=parseInt(e.size,10)),t.pax=e,t},IF=function(t,e){this._parent=t,this.offset=e,wBe.call(this,{autoDestroy:!1})};CBe.inherits(IF,wBe);IF.prototype.destroy=function(t){this._parent.destroy(t)};var sp=function(t){if(!(this instanceof sp))return new sp(t);IBe.call(this,t),t=t||{},this._offset=0,this._buffer=FBt(),this._missing=0,this._partial=!1,this._onparse=BBe,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var e=this,r=e._buffer,o=function(){e._continue()},a=function(D){if(e._locked=!1,D)return e.destroy(D);e._stream||o()},n=function(){e._stream=null;var D=EBe(e._header.size);D?e._parse(D,u):e._parse(512,w),e._locked||o()},u=function(){e._buffer.consume(EBe(e._header.size)),e._parse(512,w),o()},A=function(){var D=e._header.size;e._paxGlobal=Gv.decodePax(r.slice(0,D)),r.consume(D),n()},p=function(){var D=e._header.size;e._pax=Gv.decodePax(r.slice(0,D)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),r.consume(D),n()},h=function(){var D=e._header.size;this._gnuLongPath=Gv.decodeLongPath(r.slice(0,D),t.filenameEncoding),r.consume(D),n()},E=function(){var D=e._header.size;this._gnuLongLinkPath=Gv.decodeLongPath(r.slice(0,D),t.filenameEncoding),r.consume(D),n()},w=function(){var D=e._offset,b;try{b=e._header=Gv.decode(r.slice(0,512),t.filenameEncoding,t.allowUnknownFormat)}catch(C){e.emit("error",C)}if(r.consume(512),!b){e._parse(512,w),o();return}if(b.type==="gnu-long-path"){e._parse(b.size,h),o();return}if(b.type==="gnu-long-link-path"){e._parse(b.size,E),o();return}if(b.type==="pax-global-header"){e._parse(b.size,A),o();return}if(b.type==="pax-header"){e._parse(b.size,p),o();return}if(e._gnuLongPath&&(b.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(b.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=b=TBt(b,e._pax),e._pax=null),e._locked=!0,!b.size||b.type==="directory"){e._parse(512,w),e.emit("entry",b,RBt(e,D),a);return}e._stream=new IF(e,D),e.emit("entry",b,e._stream,a),e._parse(b.size,n),o()};this._onheader=w,this._parse(512,w)};CBe.inherits(sp,IBe);sp.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.emit("close"))};sp.prototype._parse=function(t,e){this._destroyed||(this._offset+=t,this._missing=t,e===this._onheader&&(this._partial=!1),this._onparse=e)};sp.prototype._continue=function(){if(!this._destroyed){var t=this._cb;this._cb=BBe,this._overflow?this._write(this._overflow,void 0,t):t()}};sp.prototype._write=function(t,e,r){if(!this._destroyed){var o=this._stream,a=this._buffer,n=this._missing;if(t.length&&(this._partial=!0),t.lengthn&&(u=t.slice(n),t=t.slice(0,n)),o?o.end(t):a.append(t),this._overflow=u,this._onparse()}};sp.prototype._final=function(t){if(this._partial)return this.destroy(new Error("Unexpected end of data"));t()};vBe.exports=sp});var PBe=_((m$t,SBe)=>{SBe.exports=ve("fs").constants||ve("constants")});var FBe=_((y$t,QBe)=>{var WC=PBe(),xBe=E4(),BF=zh(),LBt=Buffer.alloc,bBe=qC().Readable,YC=qC().Writable,NBt=ve("string_decoder").StringDecoder,wF=_G(),OBt=parseInt("755",8),MBt=parseInt("644",8),kBe=LBt(1024),qG=function(){},HG=function(t,e){e&=511,e&&t.push(kBe.slice(0,512-e))};function UBt(t){switch(t&WC.S_IFMT){case WC.S_IFBLK:return"block-device";case WC.S_IFCHR:return"character-device";case WC.S_IFDIR:return"directory";case WC.S_IFIFO:return"fifo";case WC.S_IFLNK:return"symlink"}return"file"}var vF=function(t){YC.call(this),this.written=0,this._to=t,this._destroyed=!1};BF(vF,YC);vF.prototype._write=function(t,e,r){if(this.written+=t.length,this._to.push(t))return r();this._to._drain=r};vF.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var DF=function(){YC.call(this),this.linkname="",this._decoder=new NBt("utf-8"),this._destroyed=!1};BF(DF,YC);DF.prototype._write=function(t,e,r){this.linkname+=this._decoder.write(t),r()};DF.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var Wv=function(){YC.call(this),this._destroyed=!1};BF(Wv,YC);Wv.prototype._write=function(t,e,r){r(new Error("No body allowed for this entry"))};Wv.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var wA=function(t){if(!(this instanceof wA))return new wA(t);bBe.call(this,t),this._drain=qG,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};BF(wA,bBe);wA.prototype.entry=function(t,e,r){if(this._stream)throw new Error("already piping an entry");if(!(this._finalized||this._destroyed)){typeof e=="function"&&(r=e,e=null),r||(r=qG);var o=this;if((!t.size||t.type==="symlink")&&(t.size=0),t.type||(t.type=UBt(t.mode)),t.mode||(t.mode=t.type==="directory"?OBt:MBt),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),typeof e=="string"&&(e=Buffer.from(e)),Buffer.isBuffer(e)){t.size=e.length,this._encode(t);var a=this.push(e);return HG(o,t.size),a?process.nextTick(r):this._drain=r,new Wv}if(t.type==="symlink"&&!t.linkname){var n=new DF;return xBe(n,function(A){if(A)return o.destroy(),r(A);t.linkname=n.linkname,o._encode(t),r()}),n}if(this._encode(t),t.type!=="file"&&t.type!=="contiguous-file")return process.nextTick(r),new Wv;var u=new vF(this);return this._stream=u,xBe(u,function(A){if(o._stream=null,A)return o.destroy(),r(A);if(u.written!==t.size)return o.destroy(),r(new Error("size mismatch"));HG(o,t.size),o._finalizing&&o.finalize(),r()}),u}};wA.prototype.finalize=function(){if(this._stream){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(kBe),this.push(null))};wA.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())};wA.prototype._encode=function(t){if(!t.pax){var e=wF.encode(t);if(e){this.push(e);return}}this._encodePax(t)};wA.prototype._encodePax=function(t){var e=wF.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:e.length,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(wF.encode(r)),this.push(e),HG(this,e.length),r.size=t.size,r.type=t.type,this.push(wF.encode(r))};wA.prototype._read=function(t){var e=this._drain;this._drain=qG,e()};QBe.exports=wA});var RBe=_(jG=>{jG.extract=DBe();jG.pack=FBe()});var WBe=_((M$t,GBe)=>{"use strict";var Yv=class t{constructor(e,r,o){this.__specs=e||{},Object.keys(this.__specs).forEach(a=>{if(typeof this.__specs[a]=="string"){let n=this.__specs[a],u=this.__specs[n];if(u){let A=u.aliases||[];A.push(a,n),u.aliases=[...new Set(A)],this.__specs[a]=u}else throw new Error(`Alias refers to invalid key: ${n} -> ${a}`)}}),this.__opts=r||{},this.__providers=qBe(o.filter(a=>a!=null&&typeof a=="object")),this.__isFiggyPudding=!0}get(e){return JG(this,e,!0)}get[Symbol.toStringTag](){return"FiggyPudding"}forEach(e,r=this){for(let[o,a]of this.entries())e.call(r,a,o,this)}toJSON(){let e={};return this.forEach((r,o)=>{e[o]=r}),e}*entries(e){for(let o of Object.keys(this.__specs))yield[o,this.get(o)];let r=e||this.__opts.other;if(r){let o=new Set;for(let a of this.__providers){let n=a.entries?a.entries(r):evt(a);for(let[u,A]of n)r(u)&&!o.has(u)&&(o.add(u),yield[u,A])}}}*[Symbol.iterator](){for(let[e,r]of this.entries())yield[e,r]}*keys(){for(let[e]of this.entries())yield e}*values(){for(let[,e]of this.entries())yield e}concat(...e){return new Proxy(new t(this.__specs,this.__opts,qBe(this.__providers).concat(e)),jBe)}};try{let t=ve("util");Yv.prototype[t.inspect.custom]=function(e,r){return this[Symbol.toStringTag]+" "+t.inspect(this.toJSON(),r)}}catch{}function ZBt(t){throw Object.assign(new Error(`invalid config key requested: ${t}`),{code:"EBADKEY"})}function JG(t,e,r){let o=t.__specs[e];if(r&&!o&&(!t.__opts.other||!t.__opts.other(e)))ZBt(e);else{o||(o={});let a;for(let n of t.__providers){if(a=HBe(e,n),a===void 0&&o.aliases&&o.aliases.length){for(let u of o.aliases)if(u!==e&&(a=HBe(u,n),a!==void 0))break}if(a!==void 0)break}return a===void 0&&o.default!==void 0?typeof o.default=="function"?o.default(t):o.default:a}}function HBe(t,e){let r;return e.__isFiggyPudding?r=JG(e,t,!1):typeof e.get=="function"?r=e.get(t):r=e[t],r}var jBe={has(t,e){return e in t.__specs&&JG(t,e,!1)!==void 0},ownKeys(t){return Object.keys(t.__specs)},get(t,e){return typeof e=="symbol"||e.slice(0,2)==="__"||e in Yv.prototype?t[e]:t.get(e)},set(t,e,r){if(typeof e=="symbol"||e.slice(0,2)==="__")return t[e]=r,!0;throw new Error("figgyPudding options cannot be modified. Use .concat() instead.")},deleteProperty(){throw new Error("figgyPudding options cannot be deleted. Use .concat() and shadow them instead.")}};GBe.exports=$Bt;function $Bt(t,e){function r(...o){return new Proxy(new Yv(t,e,o),jBe)}return r}function qBe(t){let e=[];return t.forEach(r=>e.unshift(r)),e}function evt(t){return Object.keys(t).map(e=>[e,t[e]])}});var KBe=_((U$t,DA)=>{"use strict";var Kv=ve("crypto"),tvt=WBe(),rvt=ve("stream").Transform,YBe=["sha256","sha384","sha512"],nvt=/^[a-z0-9+/]+(?:=?=?)$/i,ivt=/^([^-]+)-([^?]+)([?\S*]*)$/,svt=/^([^-]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)*$/,ovt=/^[\x21-\x7E]+$/,na=tvt({algorithms:{default:["sha512"]},error:{default:!1},integrity:{},options:{default:[]},pickAlgorithm:{default:()=>hvt},Promise:{default:()=>Promise},sep:{default:" "},single:{default:!1},size:{},strict:{default:!1}}),n0=class{get isHash(){return!0}constructor(e,r){r=na(r);let o=!!r.strict;this.source=e.trim();let a=this.source.match(o?svt:ivt);if(!a||o&&!YBe.some(u=>u===a[1]))return;this.algorithm=a[1],this.digest=a[2];let n=a[3];this.options=n?n.slice(1).split("?"):[]}hexDigest(){return this.digest&&Buffer.from(this.digest,"base64").toString("hex")}toJSON(){return this.toString()}toString(e){if(e=na(e),e.strict&&!(YBe.some(o=>o===this.algorithm)&&this.digest.match(nvt)&&(this.options||[]).every(o=>o.match(ovt))))return"";let r=this.options&&this.options.length?`?${this.options.join("?")}`:"";return`${this.algorithm}-${this.digest}${r}`}},Cd=class{get isIntegrity(){return!0}toJSON(){return this.toString()}toString(e){e=na(e);let r=e.sep||" ";return e.strict&&(r=r.replace(/\S+/g," ")),Object.keys(this).map(o=>this[o].map(a=>n0.prototype.toString.call(a,e)).filter(a=>a.length).join(r)).filter(o=>o.length).join(r)}concat(e,r){r=na(r);let o=typeof e=="string"?e:Vv(e,r);return vA(`${this.toString(r)} ${o}`,r)}hexDigest(){return vA(this,{single:!0}).hexDigest()}match(e,r){r=na(r);let o=vA(e,r),a=o.pickAlgorithm(r);return this[a]&&o[a]&&this[a].find(n=>o[a].find(u=>n.digest===u.digest))||!1}pickAlgorithm(e){e=na(e);let r=e.pickAlgorithm,o=Object.keys(this);if(!o.length)throw new Error(`No algorithms available for ${JSON.stringify(this.toString())}`);return o.reduce((a,n)=>r(a,n)||a)}};DA.exports.parse=vA;function vA(t,e){if(e=na(e),typeof t=="string")return zG(t,e);if(t.algorithm&&t.digest){let r=new Cd;return r[t.algorithm]=[t],zG(Vv(r,e),e)}else return zG(Vv(t,e),e)}function zG(t,e){return e.single?new n0(t,e):t.trim().split(/\s+/).reduce((r,o)=>{let a=new n0(o,e);if(a.algorithm&&a.digest){let n=a.algorithm;r[n]||(r[n]=[]),r[n].push(a)}return r},new Cd)}DA.exports.stringify=Vv;function Vv(t,e){return e=na(e),t.algorithm&&t.digest?n0.prototype.toString.call(t,e):typeof t=="string"?Vv(vA(t,e),e):Cd.prototype.toString.call(t,e)}DA.exports.fromHex=avt;function avt(t,e,r){r=na(r);let o=r.options&&r.options.length?`?${r.options.join("?")}`:"";return vA(`${e}-${Buffer.from(t,"hex").toString("base64")}${o}`,r)}DA.exports.fromData=lvt;function lvt(t,e){e=na(e);let r=e.algorithms,o=e.options&&e.options.length?`?${e.options.join("?")}`:"";return r.reduce((a,n)=>{let u=Kv.createHash(n).update(t).digest("base64"),A=new n0(`${n}-${u}${o}`,e);if(A.algorithm&&A.digest){let p=A.algorithm;a[p]||(a[p]=[]),a[p].push(A)}return a},new Cd)}DA.exports.fromStream=cvt;function cvt(t,e){e=na(e);let r=e.Promise||Promise,o=XG(e);return new r((a,n)=>{t.pipe(o),t.on("error",n),o.on("error",n);let u;o.on("integrity",A=>{u=A}),o.on("end",()=>a(u)),o.on("data",()=>{})})}DA.exports.checkData=uvt;function uvt(t,e,r){if(r=na(r),e=vA(e,r),!Object.keys(e).length){if(r.error)throw Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"});return!1}let o=e.pickAlgorithm(r),a=Kv.createHash(o).update(t).digest("base64"),n=vA({algorithm:o,digest:a}),u=n.match(e,r);if(u||!r.error)return u;if(typeof r.size=="number"&&t.length!==r.size){let A=new Error(`data size mismatch when checking ${e}. - Wanted: ${r.size} - Found: ${t.length}`);throw A.code="EBADSIZE",A.found=t.length,A.expected=r.size,A.sri=e,A}else{let A=new Error(`Integrity checksum failed when using ${o}: Wanted ${e}, but got ${n}. (${t.length} bytes)`);throw A.code="EINTEGRITY",A.found=n,A.expected=e,A.algorithm=o,A.sri=e,A}}DA.exports.checkStream=Avt;function Avt(t,e,r){r=na(r);let o=r.Promise||Promise,a=XG(r.concat({integrity:e}));return new o((n,u)=>{t.pipe(a),t.on("error",u),a.on("error",u);let A;a.on("verified",p=>{A=p}),a.on("end",()=>n(A)),a.on("data",()=>{})})}DA.exports.integrityStream=XG;function XG(t){t=na(t);let e=t.integrity&&vA(t.integrity,t),r=e&&Object.keys(e).length,o=r&&e.pickAlgorithm(t),a=r&&e[o],n=Array.from(new Set(t.algorithms.concat(o?[o]:[]))),u=n.map(Kv.createHash),A=0,p=new rvt({transform(h,E,w){A+=h.length,u.forEach(D=>D.update(h,E)),w(null,h,E)}}).on("end",()=>{let h=t.options&&t.options.length?`?${t.options.join("?")}`:"",E=vA(u.map((D,b)=>`${n[b]}-${D.digest("base64")}${h}`).join(" "),t),w=r&&E.match(e,t);if(typeof t.size=="number"&&A!==t.size){let D=new Error(`stream size mismatch when checking ${e}. - Wanted: ${t.size} - Found: ${A}`);D.code="EBADSIZE",D.found=A,D.expected=t.size,D.sri=e,p.emit("error",D)}else if(t.integrity&&!w){let D=new Error(`${e} integrity checksum failed when using ${o}: wanted ${a} but got ${E}. (${A} bytes)`);D.code="EINTEGRITY",D.found=E,D.expected=a,D.algorithm=o,D.sri=e,p.emit("error",D)}else p.emit("size",A),p.emit("integrity",E),w&&p.emit("verified",w)});return p}DA.exports.create=fvt;function fvt(t){t=na(t);let e=t.algorithms,r=t.options.length?`?${t.options.join("?")}`:"",o=e.map(Kv.createHash);return{update:function(a,n){return o.forEach(u=>u.update(a,n)),this},digest:function(a){return e.reduce((u,A)=>{let p=o.shift().digest("base64"),h=new n0(`${A}-${p}${r}`,t);if(h.algorithm&&h.digest){let E=h.algorithm;u[E]||(u[E]=[]),u[E].push(h)}return u},new Cd)}}}var pvt=new Set(Kv.getHashes()),VBe=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>pvt.has(t));function hvt(t,e){return VBe.indexOf(t.toLowerCase())>=VBe.indexOf(e.toLowerCase())?t:e}});var Bve=_((qnr,wve)=>{var hDt=WN();function gDt(t){return hDt(t)?void 0:t}wve.exports=gDt});var Dve=_((jnr,vve)=>{var dDt=Cb(),mDt=hH(),yDt=yH(),EDt=Wg(),CDt=Eg(),IDt=Bve(),wDt=l8(),BDt=pH(),vDt=1,DDt=2,SDt=4,PDt=wDt(function(t,e){var r={};if(t==null)return r;var o=!1;e=dDt(e,function(n){return n=EDt(n,t),o||(o=n.length>1),n}),CDt(t,BDt(t),r),o&&(r=mDt(r,vDt|DDt|SDt,IDt));for(var a=e.length;a--;)yDt(r,e[a]);return r});vve.exports=PDt});St();Ve();St();var kve=ve("child_process"),Qve=et(sg());Gt();var oE=new Map([]);var P2={};Vt(P2,{BaseCommand:()=>ut,WorkspaceRequiredError:()=>or,getCli:()=>qhe,getDynamicLibs:()=>Hhe,getPluginConfiguration:()=>lE,openWorkspace:()=>aE,pluginCommands:()=>oE,runExit:()=>Nk});Gt();var ut=class extends ot{constructor(){super(...arguments);this.cwd=de.String("--cwd",{hidden:!0})}validateAndExecute(){if(typeof this.cwd<"u")throw new it("The --cwd option is ambiguous when used anywhere else than the very first parameter provided in the command line, before even the command path");return super.validateAndExecute()}};Ve();St();Gt();var or=class extends it{constructor(e,r){let o=V.relative(e,r),a=V.join(e,_t.fileName);super(`This command can only be run from within a workspace of your project (${o} isn't a workspace of ${a}).`)}};Ve();St();sA();Ol();z1();Gt();var PAt=et(ni());il();var Hhe=()=>new Map([["@yarnpkg/cli",P2],["@yarnpkg/core",S2],["@yarnpkg/fslib",Aw],["@yarnpkg/libzip",K1],["@yarnpkg/parsers",Ew],["@yarnpkg/shell",e2],["clipanion",Qw],["semver",PAt],["typanion",Yo]]);Ve();async function aE(t,e){let{project:r,workspace:o}=await Qt.find(t,e);if(!o)throw new or(r.cwd,e);return o}Ve();St();sA();Ol();z1();Gt();var NDt=et(ni());il();var MH={};Vt(MH,{AddCommand:()=>fE,BinCommand:()=>pE,CacheCleanCommand:()=>hE,ClipanionCommand:()=>CE,ConfigCommand:()=>yE,ConfigGetCommand:()=>gE,ConfigSetCommand:()=>dE,ConfigUnsetCommand:()=>mE,DedupeCommand:()=>EE,EntryCommand:()=>wE,ExecCommand:()=>vE,ExplainCommand:()=>PE,ExplainPeerRequirementsCommand:()=>DE,HelpCommand:()=>IE,InfoCommand:()=>xE,LinkCommand:()=>kE,NodeCommand:()=>QE,PluginCheckCommand:()=>FE,PluginImportCommand:()=>LE,PluginImportSourcesCommand:()=>NE,PluginListCommand:()=>RE,PluginRemoveCommand:()=>OE,PluginRuntimeCommand:()=>ME,RebuildCommand:()=>UE,RemoveCommand:()=>_E,RunCommand:()=>qE,RunIndexCommand:()=>HE,SetResolutionCommand:()=>jE,SetVersionCommand:()=>SE,SetVersionSourcesCommand:()=>TE,UnlinkCommand:()=>GE,UpCommand:()=>WE,VersionCommand:()=>BE,WhyCommand:()=>YE,WorkspaceCommand:()=>XE,WorkspacesListCommand:()=>zE,YarnCommand:()=>bE,dedupeUtils:()=>Yk,default:()=>Igt,suggestUtils:()=>nu});var Eme=et(sg());Ve();Ve();Ve();Gt();var bge=et(Q2());il();var nu={};Vt(nu,{Modifier:()=>lH,Strategy:()=>jk,Target:()=>F2,WorkspaceModifier:()=>vge,applyModifier:()=>Vft,extractDescriptorFromPath:()=>cH,extractRangeModifier:()=>Dge,fetchDescriptorFrom:()=>uH,findProjectDescriptors:()=>xge,getModifier:()=>R2,getSuggestedDescriptors:()=>T2,makeWorkspaceDescriptor:()=>Pge,toWorkspaceModifier:()=>Sge});Ve();Ve();St();var aH=et(ni()),Wft="workspace:",F2=(o=>(o.REGULAR="dependencies",o.DEVELOPMENT="devDependencies",o.PEER="peerDependencies",o))(F2||{}),lH=(o=>(o.CARET="^",o.TILDE="~",o.EXACT="",o))(lH||{}),vge=(o=>(o.CARET="^",o.TILDE="~",o.EXACT="*",o))(vge||{}),jk=(n=>(n.KEEP="keep",n.REUSE="reuse",n.PROJECT="project",n.LATEST="latest",n.CACHE="cache",n))(jk||{});function R2(t,e){return t.exact?"":t.caret?"^":t.tilde?"~":e.configuration.get("defaultSemverRangePrefix")}var Yft=/^([\^~]?)[0-9]+(?:\.[0-9]+){0,2}(?:-\S+)?$/;function Dge(t,{project:e}){let r=t.match(Yft);return r?r[1]:e.configuration.get("defaultSemverRangePrefix")}function Vft(t,e){let{protocol:r,source:o,params:a,selector:n}=G.parseRange(t.range);return aH.default.valid(n)&&(n=`${e}${t.range}`),G.makeDescriptor(t,G.makeRange({protocol:r,source:o,params:a,selector:n}))}function Sge(t){switch(t){case"^":return"^";case"~":return"~";case"":return"*";default:throw new Error(`Assertion failed: Unknown modifier: "${t}"`)}}function Pge(t,e){return G.makeDescriptor(t.anchoredDescriptor,`${Wft}${Sge(e)}`)}async function xge(t,{project:e,target:r}){let o=new Map,a=n=>{let u=o.get(n.descriptorHash);return u||o.set(n.descriptorHash,u={descriptor:n,locators:[]}),u};for(let n of e.workspaces)if(r==="peerDependencies"){let u=n.manifest.peerDependencies.get(t.identHash);u!==void 0&&a(u).locators.push(n.anchoredLocator)}else{let u=n.manifest.dependencies.get(t.identHash),A=n.manifest.devDependencies.get(t.identHash);r==="devDependencies"?A!==void 0?a(A).locators.push(n.anchoredLocator):u!==void 0&&a(u).locators.push(n.anchoredLocator):u!==void 0?a(u).locators.push(n.anchoredLocator):A!==void 0&&a(A).locators.push(n.anchoredLocator)}return o}async function cH(t,{cwd:e,workspace:r}){return await Kft(async o=>{V.isAbsolute(t)||(t=V.relative(r.cwd,V.resolve(e,t)),t.match(/^\.{0,2}\//)||(t=`./${t}`));let{project:a}=r,n=await uH(G.makeIdent(null,"archive"),t,{project:r.project,cache:o,workspace:r});if(!n)throw new Error("Assertion failed: The descriptor should have been found");let u=new Ri,A=a.configuration.makeResolver(),p=a.configuration.makeFetcher(),h={checksums:a.storedChecksums,project:a,cache:o,fetcher:p,report:u,resolver:A},E=A.bindDescriptor(n,r.anchoredLocator,h),w=G.convertDescriptorToLocator(E),D=await p.fetch(w,h),b=await _t.find(D.prefixPath,{baseFs:D.packageFs});if(!b.name)throw new Error("Target path doesn't have a name");return G.makeDescriptor(b.name,t)})}async function T2(t,{project:e,workspace:r,cache:o,target:a,fixed:n,modifier:u,strategies:A,maxResults:p=1/0}){if(!(p>=0))throw new Error(`Invalid maxResults (${p})`);let[h,E]=t.range!=="unknown"?n||Ur.validRange(t.range)||!t.range.match(/^[a-z0-9._-]+$/i)?[t.range,"latest"]:["unknown",t.range]:["unknown","latest"];if(h!=="unknown")return{suggestions:[{descriptor:t,name:`Use ${G.prettyDescriptor(e.configuration,t)}`,reason:"(unambiguous explicit request)"}],rejections:[]};let w=typeof r<"u"&&r!==null&&r.manifest[a].get(t.identHash)||null,D=[],b=[],C=async T=>{try{await T()}catch(N){b.push(N)}};for(let T of A){if(D.length>=p)break;switch(T){case"keep":await C(async()=>{w&&D.push({descriptor:w,name:`Keep ${G.prettyDescriptor(e.configuration,w)}`,reason:"(no changes)"})});break;case"reuse":await C(async()=>{for(let{descriptor:N,locators:U}of(await xge(t,{project:e,target:a})).values()){if(U.length===1&&U[0].locatorHash===r.anchoredLocator.locatorHash&&A.includes("keep"))continue;let J=`(originally used by ${G.prettyLocator(e.configuration,U[0])}`;J+=U.length>1?` and ${U.length-1} other${U.length>2?"s":""})`:")",D.push({descriptor:N,name:`Reuse ${G.prettyDescriptor(e.configuration,N)}`,reason:J})}});break;case"cache":await C(async()=>{for(let N of e.storedDescriptors.values())N.identHash===t.identHash&&D.push({descriptor:N,name:`Reuse ${G.prettyDescriptor(e.configuration,N)}`,reason:"(already used somewhere in the lockfile)"})});break;case"project":await C(async()=>{if(r.manifest.name!==null&&t.identHash===r.manifest.name.identHash)return;let N=e.tryWorkspaceByIdent(t);if(N===null)return;let U=Pge(N,u);D.push({descriptor:U,name:`Attach ${G.prettyDescriptor(e.configuration,U)}`,reason:`(local workspace at ${pe.pretty(e.configuration,N.relativeCwd,pe.Type.PATH)})`})});break;case"latest":{let N=e.configuration.get("enableNetwork"),U=e.configuration.get("enableOfflineMode");await C(async()=>{if(a==="peerDependencies")D.push({descriptor:G.makeDescriptor(t,"*"),name:"Use *",reason:"(catch-all peer dependency pattern)"});else if(!N&&!U)D.push({descriptor:null,name:"Resolve from latest",reason:pe.pretty(e.configuration,"(unavailable because enableNetwork is toggled off)","grey")});else{let J=await uH(t,E,{project:e,cache:o,workspace:r,modifier:u});J&&D.push({descriptor:J,name:`Use ${G.prettyDescriptor(e.configuration,J)}`,reason:`(resolved from ${U?"the cache":"latest"})`})}})}break}}return{suggestions:D.slice(0,p),rejections:b.slice(0,p)}}async function uH(t,e,{project:r,cache:o,workspace:a,preserveModifier:n=!0,modifier:u}){let A=r.configuration.normalizeDependency(G.makeDescriptor(t,e)),p=new Ri,h=r.configuration.makeFetcher(),E=r.configuration.makeResolver(),w={project:r,fetcher:h,cache:o,checksums:r.storedChecksums,report:p,cacheOptions:{skipIntegrityCheck:!0}},D={...w,resolver:E,fetchOptions:w},b=E.bindDescriptor(A,a.anchoredLocator,D),C=await E.getCandidates(b,{},D);if(C.length===0)return null;let T=C[0],{protocol:N,source:U,params:J,selector:te}=G.parseRange(G.convertToManifestRange(T.reference));if(N===r.configuration.get("defaultProtocol")&&(N=null),aH.default.valid(te)){let le=te;if(typeof u<"u")te=u+te;else if(n!==!1){let Ie=typeof n=="string"?n:A.range;te=Dge(Ie,{project:r})+te}let ce=G.makeDescriptor(T,G.makeRange({protocol:N,source:U,params:J,selector:te}));(await E.getCandidates(r.configuration.normalizeDependency(ce),{},D)).length!==1&&(te=le)}return G.makeDescriptor(T,G.makeRange({protocol:N,source:U,params:J,selector:te}))}async function Kft(t){return await ae.mktempPromise(async e=>{let r=ze.create(e);return r.useWithSource(e,{enableMirror:!1,compressionLevel:0},e,{overwrite:!0}),await t(new Wr(e,{configuration:r,check:!1,immutable:!1}))})}var fE=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.fixed=de.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=de.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=de.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=de.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.dev=de.Boolean("-D,--dev",!1,{description:"Add a package as a dev dependency"});this.peer=de.Boolean("-P,--peer",!1,{description:"Add a package as a peer dependency"});this.optional=de.Boolean("-O,--optional",!1,{description:"Add / upgrade a package to an optional regular / peer dependency"});this.preferDev=de.Boolean("--prefer-dev",!1,{description:"Add / upgrade a package to a dev dependency"});this.interactive=de.Boolean("-i,--interactive",{description:"Reuse the specified package from other workspaces in the project"});this.cached=de.Boolean("--cached",!1,{description:"Reuse the highest version already used somewhere within the project"});this.mode=de.String("--mode",{description:"Change what artifacts installs generate",validator:js(yl)});this.silent=de.Boolean("--silent",{hidden:!0});this.packages=de.Rest()}static{this.paths=[["add"]]}static{this.usage=ot.Usage({description:"add dependencies to the project",details:"\n This command adds a package to the package.json for the nearest workspace.\n\n - If it didn't exist before, the package will by default be added to the regular `dependencies` field, but this behavior can be overriden thanks to the `-D,--dev` flag (which will cause the dependency to be added to the `devDependencies` field instead) and the `-P,--peer` flag (which will do the same but for `peerDependencies`).\n\n - If the package was already listed in your dependencies, it will by default be upgraded whether it's part of your `dependencies` or `devDependencies` (it won't ever update `peerDependencies`, though).\n\n - If set, the `--prefer-dev` flag will operate as a more flexible `-D,--dev` in that it will add the package to your `devDependencies` if it isn't already listed in either `dependencies` or `devDependencies`, but it will also happily upgrade your `dependencies` if that's what you already use (whereas `-D,--dev` would throw an exception).\n\n - If set, the `-O,--optional` flag will add the package to the `optionalDependencies` field and, in combination with the `-P,--peer` flag, it will add the package as an optional peer dependency. If the package was already listed in your `dependencies`, it will be upgraded to `optionalDependencies`. If the package was already listed in your `peerDependencies`, in combination with the `-P,--peer` flag, it will be upgraded to an optional peer dependency: `\"peerDependenciesMeta\": { \"\": { \"optional\": true } }`\n\n - If the added package doesn't specify a range at all its `latest` tag will be resolved and the returned version will be used to generate a new semver range (using the `^` modifier by default unless otherwise configured via the `defaultSemverRangePrefix` configuration, or the `~` modifier if `-T,--tilde` is specified, or no modifier at all if `-E,--exact` is specified). Two exceptions to this rule: the first one is that if the package is a workspace then its local version will be used, and the second one is that if you use `-P,--peer` the default range will be `*` and won't be resolved at all.\n\n - If the added package specifies a range (such as `^1.0.0`, `latest`, or `rc`), Yarn will add this range as-is in the resulting package.json entry (in particular, tags such as `rc` will be encoded as-is rather than being converted into a semver range).\n\n If the `--cached` option is used, Yarn will preferably reuse the highest version already used somewhere within the project, even if through a transitive dependency.\n\n If the `-i,--interactive` option is used (or if the `preferInteractive` settings is toggled on) the command will first try to check whether other workspaces in the project use the specified package and, if so, will offer to reuse them.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n For a compilation of all the supported protocols, please consult the dedicated page from our website: https://yarnpkg.com/protocols.\n ",examples:[["Add a regular package to the current workspace","$0 add lodash"],["Add a specific version for a package to the current workspace","$0 add lodash@1.2.3"],["Add a package from a GitHub repository (the master branch) to the current workspace using a URL","$0 add lodash@https://github.com/lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol","$0 add lodash@github:lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol (shorthand)","$0 add lodash@lodash/lodash"],["Add a package from a specific branch of a GitHub repository to the current workspace using the GitHub protocol (shorthand)","$0 add lodash-es@lodash/lodash#es"],["Add a local package (gzipped tarball format) to the current workspace","$0 add local-package-name@file:../path/to/local-package-name-v0.1.2.tgz"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=this.fixed,A=r.isInteractive({interactive:this.interactive,stdout:this.context.stdout}),p=A||r.get("preferReuse"),h=R2(this,o),E=[p?"reuse":void 0,"project",this.cached?"cache":void 0,"latest"].filter(U=>typeof U<"u"),w=A?1/0:1,D=await Promise.all(this.packages.map(async U=>{let J=U.match(/^\.{0,2}\//)?await cH(U,{cwd:this.context.cwd,workspace:a}):G.tryParseDescriptor(U),te=U.match(/^(https?:|git@github)/);if(te)throw new it(`It seems you are trying to add a package using a ${pe.pretty(r,`${te[0]}...`,pe.Type.RANGE)} url; we now require package names to be explicitly specified. -Try running the command again with the package name prefixed: ${pe.pretty(r,"yarn add",pe.Type.CODE)} ${pe.pretty(r,G.makeDescriptor(G.makeIdent(null,"my-package"),`${te[0]}...`),pe.Type.DESCRIPTOR)}`);if(!J)throw new it(`The ${pe.pretty(r,U,pe.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);let le=Jft(a,J,{dev:this.dev,peer:this.peer,preferDev:this.preferDev,optional:this.optional});return await Promise.all(le.map(async ue=>{let Ie=await T2(J,{project:o,workspace:a,cache:n,fixed:u,target:ue,modifier:h,strategies:E,maxResults:w});return{request:J,suggestedDescriptors:Ie,target:ue}}))})).then(U=>U.flat()),b=await pA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async U=>{for(let{request:J,suggestedDescriptors:{suggestions:te,rejections:le}}of D)if(te.filter(ue=>ue.descriptor!==null).length===0){let[ue]=le;if(typeof ue>"u")throw new Error("Assertion failed: Expected an error to have been set");o.configuration.get("enableNetwork")?U.reportError(27,`${G.prettyDescriptor(r,J)} can't be resolved to a satisfying range`):U.reportError(27,`${G.prettyDescriptor(r,J)} can't be resolved to a satisfying range (note: network resolution has been disabled)`),U.reportSeparator(),U.reportExceptionOnce(ue)}});if(b.hasErrors())return b.exitCode();let C=!1,T=[],N=[];for(let{suggestedDescriptors:{suggestions:U},target:J}of D){let te,le=U.filter(he=>he.descriptor!==null),ce=le[0].descriptor,ue=le.every(he=>G.areDescriptorsEqual(he.descriptor,ce));le.length===1||ue?te=ce:(C=!0,{answer:te}=await(0,bge.prompt)({type:"select",name:"answer",message:"Which range do you want to use?",choices:U.map(({descriptor:he,name:De,reason:Ee})=>he?{name:De,hint:Ee,descriptor:he}:{name:De,hint:Ee,disabled:!0}),onCancel:()=>process.exit(130),result(he){return this.find(he,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let Ie=a.manifest[J].get(te.identHash);(typeof Ie>"u"||Ie.descriptorHash!==te.descriptorHash)&&(a.manifest[J].set(te.identHash,te),this.optional&&(J==="dependencies"?a.manifest.ensureDependencyMeta({...te,range:"unknown"}).optional=!0:J==="peerDependencies"&&(a.manifest.ensurePeerDependencyMeta({...te,range:"unknown"}).optional=!0)),typeof Ie>"u"?T.push([a,J,te,E]):N.push([a,J,Ie,te]))}return await r.triggerMultipleHooks(U=>U.afterWorkspaceDependencyAddition,T),await r.triggerMultipleHooks(U=>U.afterWorkspaceDependencyReplacement,N),C&&this.context.stdout.write(` -`),await o.installWithNewReport({json:this.json,stdout:this.context.stdout,quiet:this.context.quiet},{cache:n,mode:this.mode})}};function Jft(t,e,{dev:r,peer:o,preferDev:a,optional:n}){let u=t.manifest.dependencies.has(e.identHash),A=t.manifest.devDependencies.has(e.identHash),p=t.manifest.peerDependencies.has(e.identHash);if((r||o)&&u)throw new it(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a regular dependency - remove the -D,-P flags or remove it from your dependencies first`);if(!r&&!o&&p)throw new it(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - use either of -D or -P, or remove it from your peer dependencies first`);if(n&&A)throw new it(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a dev dependency - remove the -O flag or remove it from your dev dependencies first`);if(n&&!o&&p)throw new it(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);if((r||a)&&n)throw new it(`Package "${G.prettyIdent(t.project.configuration,e)}" cannot simultaneously be a dev dependency and an optional dependency`);let h=[];return o&&h.push("peerDependencies"),(r||a)&&h.push("devDependencies"),n&&h.push("dependencies"),h.length>0?h:A?["devDependencies"]:p?["peerDependencies"]:["dependencies"]}Ve();Ve();Gt();var pE=class extends ut{constructor(){super(...arguments);this.verbose=de.Boolean("-v,--verbose",!1,{description:"Print both the binary name and the locator of the package that provides the binary"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.name=de.String({required:!1})}static{this.paths=[["bin"]]}static{this.usage=ot.Usage({description:"get the path to a binary script",details:` - When used without arguments, this command will print the list of all the binaries available in the current workspace. Adding the \`-v,--verbose\` flag will cause the output to contain both the binary name and the locator of the package that provides the binary. - - When an argument is specified, this command will just print the path to the binary on the standard output and exit. Note that the reported path may be stored within a zip archive. - `,examples:[["List all the available binaries","$0 bin"],["Print the path to a specific binary","$0 bin eslint"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,locator:a}=await Qt.find(r,this.context.cwd);if(await o.restoreInstallState(),this.name){let A=(await hn.getPackageAccessibleBinaries(a,{project:o})).get(this.name);if(!A)throw new it(`Couldn't find a binary named "${this.name}" for package "${G.prettyLocator(r,a)}"`);let[,p]=A;return this.context.stdout.write(`${p} -`),0}return(await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async u=>{let A=await hn.getPackageAccessibleBinaries(a,{project:o}),h=Array.from(A.keys()).reduce((E,w)=>Math.max(E,w.length),0);for(let[E,[w,D]]of A)u.reportJson({name:E,source:G.stringifyIdent(w),path:D});if(this.verbose)for(let[E,[w]]of A)u.reportInfo(null,`${E.padEnd(h," ")} ${G.prettyLocator(r,w)}`);else for(let E of A.keys())u.reportInfo(null,E)})).exitCode()}};Ve();St();Gt();var hE=class extends ut{constructor(){super(...arguments);this.mirror=de.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=de.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}static{this.paths=[["cache","clean"],["cache","clear"]]}static{this.usage=ot.Usage({description:"remove the shared cache files",details:` - This command will remove all the files from the cache. - `,examples:[["Remove all the local archives","$0 cache clean"],["Remove all the archives stored in the ~/.yarn directory","$0 cache clean --mirror"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(!r.get("enableCacheClean"))throw new it("Cache cleaning is currently disabled. To enable it, set `enableCacheClean: true` in your configuration file. Note: Cache cleaning is typically not required and should be avoided when using Zero-Installs.");let o=await Wr.find(r);return(await Lt.start({configuration:r,stdout:this.context.stdout},async()=>{let n=(this.all||this.mirror)&&o.mirrorCwd!==null,u=!this.mirror;n&&(await ae.removePromise(o.mirrorCwd),await r.triggerHook(A=>A.cleanGlobalArtifacts,r)),u&&await ae.removePromise(o.cwd)})).exitCode()}};Ve();Gt();var Qge=et(L2()),AH=ve("util"),gE=class extends ut{constructor(){super(...arguments);this.why=de.Boolean("--why",!1,{description:"Print the explanation for why a setting has its value"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=de.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=de.String()}static{this.paths=[["config","get"]]}static{this.usage=ot.Usage({description:"read a configuration settings",details:` - This command will print a configuration setting. - - Secrets (such as tokens) will be redacted from the output by default. If this behavior isn't desired, set the \`--no-redacted\` to get the untransformed value. - `,examples:[["Print a simple configuration setting","yarn config get yarnPath"],["Print a complex configuration setting","yarn config get packageExtensions"],["Print a nested field from the configuration",`yarn config get 'npmScopes["my-company"].npmRegistryServer'`],["Print a token from the configuration","yarn config get npmAuthToken --no-redacted"],["Print a configuration setting as JSON","yarn config get packageExtensions --json"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=this.name.replace(/[.[].*$/,""),a=this.name.replace(/^[^.[]*/,"");if(typeof r.settings.get(o)>"u")throw new it(`Couldn't find a configuration settings named "${o}"`);let u=r.getSpecial(o,{hideSecrets:!this.unsafe,getNativePaths:!0}),A=qe.convertMapsToIndexableObjects(u),p=a?(0,Qge.default)(A,a):A,h=await Lt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async E=>{E.reportJson(p)});if(!this.json){if(typeof p=="string")return this.context.stdout.write(`${p} -`),h.exitCode();AH.inspect.styles.name="cyan",this.context.stdout.write(`${(0,AH.inspect)(p,{depth:1/0,colors:r.get("enableColors"),compact:!1})} -`)}return h.exitCode()}};Ve();Gt();var Ide=et(gH()),wde=et(L2()),Bde=et(dH()),mH=ve("util"),dE=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=de.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=de.String();this.value=de.String()}static{this.paths=[["config","set"]]}static{this.usage=ot.Usage({description:"change a configuration settings",details:` - This command will set a configuration setting. - - When used without the \`--json\` flag, it can only set a simple configuration setting (a string, a number, or a boolean). - - When used with the \`--json\` flag, it can set both simple and complex configuration settings, including Arrays and Objects. - `,examples:[["Set a simple configuration setting (a string, a number, or a boolean)","yarn config set initScope myScope"],["Set a simple configuration setting (a string, a number, or a boolean) using the `--json` flag",'yarn config set initScope --json \\"myScope\\"'],["Set a complex configuration setting (an Array) using the `--json` flag",`yarn config set unsafeHttpWhitelist --json '["*.example.com", "example.com"]'`],["Set a complex configuration setting (an Object) using the `--json` flag",`yarn config set packageExtensions --json '{ "@babel/parser@*": { "dependencies": { "@babel/types": "*" } } }'`],["Set a nested configuration setting",'yarn config set npmScopes.company.npmRegistryServer "https://npm.example.com"'],["Set a nested configuration setting using indexed access for non-simple keys",`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=()=>{if(!r.projectCwd)throw new it("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new it(`Couldn't find a configuration settings named "${a}"`);if(a==="enableStrictSettings")throw new it("This setting only affects the file it's in, and thus cannot be set from the CLI");let A=this.json?JSON.parse(this.value):this.value;await(this.home?C=>ze.updateHomeConfiguration(C):C=>ze.updateConfiguration(o(),C))(C=>{if(n){let T=(0,Ide.default)(C);return(0,Bde.default)(T,this.name,A),T}else return{...C,[a]:A}});let E=(await ze.find(this.context.cwd,this.context.plugins)).getSpecial(a,{hideSecrets:!0,getNativePaths:!0}),w=qe.convertMapsToIndexableObjects(E),D=n?(0,wde.default)(w,n):w;return(await Lt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async C=>{mH.inspect.styles.name="cyan",C.reportInfo(0,`Successfully set ${this.name} to ${(0,mH.inspect)(D,{depth:1/0,colors:r.get("enableColors"),compact:!1})}`)})).exitCode()}};Ve();Gt();var Tde=et(gH()),Lde=et(Pde()),Nde=et(EH()),mE=class extends ut{constructor(){super(...arguments);this.home=de.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=de.String()}static{this.paths=[["config","unset"]]}static{this.usage=ot.Usage({description:"unset a configuration setting",details:` - This command will unset a configuration setting. - `,examples:[["Unset a simple configuration setting","yarn config unset initScope"],["Unset a complex configuration setting","yarn config unset packageExtensions"],["Unset a nested configuration setting","yarn config unset npmScopes.company.npmRegistryServer"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=()=>{if(!r.projectCwd)throw new it("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new it(`Couldn't find a configuration settings named "${a}"`);let A=this.home?h=>ze.updateHomeConfiguration(h):h=>ze.updateConfiguration(o(),h);return(await Lt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async h=>{let E=!1;await A(w=>{if(!(0,Lde.default)(w,this.name))return h.reportWarning(0,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),E=!0,w;let D=n?(0,Tde.default)(w):{...w};return(0,Nde.default)(D,this.name),D}),E||h.reportInfo(0,`Successfully unset ${this.name}`)})).exitCode()}};Ve();St();Gt();var Wk=ve("util"),yE=class extends ut{constructor(){super(...arguments);this.noDefaults=de.Boolean("--no-defaults",!1,{description:"Omit the default values from the display"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.verbose=de.Boolean("-v,--verbose",{hidden:!0});this.why=de.Boolean("--why",{hidden:!0});this.names=de.Rest()}static{this.paths=[["config"]]}static{this.usage=ot.Usage({description:"display the current configuration",details:` - This command prints the current active configuration settings. - `,examples:[["Print the active configuration settings","$0 config"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins,{strict:!1}),o=await Qy({configuration:r,stdout:this.context.stdout,forceError:this.json},[{option:this.verbose,message:"The --verbose option is deprecated, the settings' descriptions are now always displayed"},{option:this.why,message:"The --why option is deprecated, the settings' sources are now always displayed"}]);if(o!==null)return o;let a=this.names.length>0?[...new Set(this.names)].sort():[...r.settings.keys()].sort(),n,u=await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async A=>{if(r.invalid.size>0&&!this.json){for(let[p,h]of r.invalid)A.reportError(34,`Invalid configuration key "${p}" in ${h}`);A.reportSeparator()}if(this.json)for(let p of a){let h=r.settings.get(p);typeof h>"u"&&A.reportError(34,`No configuration key named "${p}"`);let E=r.getSpecial(p,{hideSecrets:!0,getNativePaths:!0}),w=r.sources.get(p)??"",D=w&&w[0]!=="<"?Ae.fromPortablePath(w):w;A.reportJson({key:p,effective:E,source:D,...h})}else{let p={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},h={},E={children:h};for(let w of a){if(this.noDefaults&&!r.sources.has(w))continue;let D=r.settings.get(w),b=r.sources.get(w)??"",C=r.getSpecial(w,{hideSecrets:!0,getNativePaths:!0}),T={Description:{label:"Description",value:pe.tuple(pe.Type.MARKDOWN,{text:D.description,format:this.cli.format(),paragraphs:!1})},Source:{label:"Source",value:pe.tuple(b[0]==="<"?pe.Type.CODE:pe.Type.PATH,b)}};h[w]={value:pe.tuple(pe.Type.CODE,w),children:T};let N=(U,J)=>{for(let[te,le]of J)if(le instanceof Map){let ce={};U[te]={children:ce},N(ce,le)}else U[te]={label:te,value:pe.tuple(pe.Type.NO_HINT,(0,Wk.inspect)(le,p))}};C instanceof Map?N(T,C):T.Value={label:"Value",value:pe.tuple(pe.Type.NO_HINT,(0,Wk.inspect)(C,p))}}a.length!==1&&(n=void 0),As.emitTree(E,{configuration:r,json:this.json,stdout:this.context.stdout,separators:2})}});if(!this.json&&typeof n<"u"){let A=a[0],p=(0,Wk.inspect)(r.getSpecial(A,{hideSecrets:!0,getNativePaths:!0}),{colors:r.get("enableColors")});this.context.stdout.write(` -`),this.context.stdout.write(`${p} -`)}return u.exitCode()}};Ve();Gt();il();var Yk={};Vt(Yk,{Strategy:()=>N2,acceptedStrategies:()=>Q0t,dedupe:()=>CH});Ve();Ve();var Ode=et(Xo()),N2=(e=>(e.HIGHEST="highest",e))(N2||{}),Q0t=new Set(Object.values(N2)),F0t={highest:async(t,e,{resolver:r,fetcher:o,resolveOptions:a,fetchOptions:n})=>{let u=new Map;for(let[p,h]of t.storedResolutions){let E=t.storedDescriptors.get(p);if(typeof E>"u")throw new Error(`Assertion failed: The descriptor (${p}) should have been registered`);qe.getSetWithDefault(u,E.identHash).add(h)}let A=new Map(qe.mapAndFilter(t.storedDescriptors.values(),p=>G.isVirtualDescriptor(p)?qe.mapAndFilter.skip:[p.descriptorHash,qe.makeDeferred()]));for(let p of t.storedDescriptors.values()){let h=A.get(p.descriptorHash);if(typeof h>"u")throw new Error(`Assertion failed: The descriptor (${p.descriptorHash}) should have been registered`);let E=t.storedResolutions.get(p.descriptorHash);if(typeof E>"u")throw new Error(`Assertion failed: The resolution (${p.descriptorHash}) should have been registered`);let w=t.originalPackages.get(E);if(typeof w>"u")throw new Error(`Assertion failed: The package (${E}) should have been registered`);Promise.resolve().then(async()=>{let D=r.getResolutionDependencies(p,a),b=Object.fromEntries(await qe.allSettledSafe(Object.entries(D).map(async([te,le])=>{let ce=A.get(le.descriptorHash);if(typeof ce>"u")throw new Error(`Assertion failed: The descriptor (${le.descriptorHash}) should have been registered`);let ue=await ce.promise;if(!ue)throw new Error("Assertion failed: Expected the dependency to have been through the dedupe process itself");return[te,ue.updatedPackage]})));if(e.length&&!Ode.default.isMatch(G.stringifyIdent(p),e)||!r.shouldPersistResolution(w,a))return w;let C=u.get(p.identHash);if(typeof C>"u")throw new Error(`Assertion failed: The resolutions (${p.identHash}) should have been registered`);if(C.size===1)return w;let T=[...C].map(te=>{let le=t.originalPackages.get(te);if(typeof le>"u")throw new Error(`Assertion failed: The package (${te}) should have been registered`);return le}),N=await r.getSatisfying(p,b,T,a),U=N.locators?.[0];if(typeof U>"u"||!N.sorted)return w;let J=t.originalPackages.get(U.locatorHash);if(typeof J>"u")throw new Error(`Assertion failed: The package (${U.locatorHash}) should have been registered`);return J}).then(async D=>{let b=await t.preparePackage(D,{resolver:r,resolveOptions:a});h.resolve({descriptor:p,currentPackage:w,updatedPackage:D,resolvedPackage:b})}).catch(D=>{h.reject(D)})}return[...A.values()].map(p=>p.promise)}};async function CH(t,{strategy:e,patterns:r,cache:o,report:a}){let{configuration:n}=t,u=new Ri,A=n.makeResolver(),p=n.makeFetcher(),h={cache:o,checksums:t.storedChecksums,fetcher:p,project:t,report:u,cacheOptions:{skipIntegrityCheck:!0}},E={project:t,resolver:A,report:u,fetchOptions:h};return await a.startTimerPromise("Deduplication step",async()=>{let w=F0t[e],D=await w(t,r,{resolver:A,resolveOptions:E,fetcher:p,fetchOptions:h}),b=Ws.progressViaCounter(D.length);await a.reportProgress(b);let C=0;await Promise.all(D.map(U=>U.then(J=>{if(J===null||J.currentPackage.locatorHash===J.updatedPackage.locatorHash)return;C++;let{descriptor:te,currentPackage:le,updatedPackage:ce}=J;a.reportInfo(0,`${G.prettyDescriptor(n,te)} can be deduped from ${G.prettyLocator(n,le)} to ${G.prettyLocator(n,ce)}`),a.reportJson({descriptor:G.stringifyDescriptor(te),currentResolution:G.stringifyLocator(le),updatedResolution:G.stringifyLocator(ce)}),t.storedResolutions.set(te.descriptorHash,ce.locatorHash)}).finally(()=>b.tick())));let T;switch(C){case 0:T="No packages";break;case 1:T="One package";break;default:T=`${C} packages`}let N=pe.pretty(n,e,pe.Type.CODE);return a.reportInfo(0,`${T} can be deduped using the ${N} strategy`),C})}var EE=class extends ut{constructor(){super(...arguments);this.strategy=de.String("-s,--strategy","highest",{description:"The strategy to use when deduping dependencies",validator:js(N2)});this.check=de.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=de.String("--mode",{description:"Change what artifacts installs generate",validator:js(yl)});this.patterns=de.Rest()}static{this.paths=[["dedupe"]]}static{this.usage=ot.Usage({description:"deduplicate dependencies with overlapping ranges",details:"\n Duplicates are defined as descriptors with overlapping ranges being resolved and locked to different locators. They are a natural consequence of Yarn's deterministic installs, but they can sometimes pile up and unnecessarily increase the size of your project.\n\n This command dedupes dependencies in the current project using different strategies (only one is implemented at the moment):\n\n - `highest`: Reuses (where possible) the locators with the highest versions. This means that dependencies can only be upgraded, never downgraded. It's also guaranteed that it never takes more than a single pass to dedupe the entire dependency tree.\n\n **Note:** Even though it never produces a wrong dependency tree, this command should be used with caution, as it modifies the dependency tree, which can sometimes cause problems when packages don't strictly follow semver recommendations. Because of this, it is recommended to also review the changes manually.\n\n If set, the `-c,--check` flag will only report the found duplicates, without persisting the modified dependency tree. If changes are found, the command will exit with a non-zero exit code, making it suitable for CI purposes.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n ### In-depth explanation:\n\n Yarn doesn't deduplicate dependencies by default, otherwise installs wouldn't be deterministic and the lockfile would be useless. What it actually does is that it tries to not duplicate dependencies in the first place.\n\n **Example:** If `foo@^2.3.4` (a dependency of a dependency) has already been resolved to `foo@2.3.4`, running `yarn add foo@*`will cause Yarn to reuse `foo@2.3.4`, even if the latest `foo` is actually `foo@2.10.14`, thus preventing unnecessary duplication.\n\n Duplication happens when Yarn can't unlock dependencies that have already been locked inside the lockfile.\n\n **Example:** If `foo@^2.3.4` (a dependency of a dependency) has already been resolved to `foo@2.3.4`, running `yarn add foo@2.10.14` will cause Yarn to install `foo@2.10.14` because the existing resolution doesn't satisfy the range `2.10.14`. This behavior can lead to (sometimes) unwanted duplication, since now the lockfile contains 2 separate resolutions for the 2 `foo` descriptors, even though they have overlapping ranges, which means that the lockfile can be simplified so that both descriptors resolve to `foo@2.10.14`.\n ",examples:[["Dedupe all packages","$0 dedupe"],["Dedupe all packages using a specific strategy","$0 dedupe --strategy highest"],["Dedupe a specific package","$0 dedupe lodash"],["Dedupe all packages with the `@babel/*` scope","$0 dedupe '@babel/*'"],["Check for duplicates (can be used as a CI step)","$0 dedupe --check"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd),a=await Wr.find(r);await o.restoreInstallState({restoreResolutions:!1});let n=0,u=await Lt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout,json:this.json},async A=>{n=await CH(o,{strategy:this.strategy,patterns:this.patterns,cache:a,report:A})});return u.hasErrors()?u.exitCode():this.check?n?1:0:await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:a,mode:this.mode})}};Ve();Gt();var CE=class extends ut{static{this.paths=[["--clipanion=definitions"]]}async execute(){let{plugins:e}=await ze.find(this.context.cwd,this.context.plugins),r=[];for(let u of e){let{commands:A}=u[1];if(A){let h=Ko.from(A).definitions();r.push([u[0],h])}}let o=this.cli.definitions(),a=(u,A)=>u.split(" ").slice(1).join()===A.split(" ").slice(1).join(),n=Mde()["@yarnpkg/builder"].bundles.standard;for(let u of r){let A=u[1];for(let p of A)o.find(h=>a(h.path,p.path)).plugin={name:u[0],isDefault:n.includes(u[0])}}this.context.stdout.write(`${JSON.stringify(o,null,2)} -`)}};var IE=class extends ut{static{this.paths=[["help"],["--help"],["-h"]]}async execute(){this.context.stdout.write(this.cli.usage(null))}};Ve();St();Gt();var wE=class extends ut{constructor(){super(...arguments);this.leadingArgument=de.String();this.args=de.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!G.tryParseIdent(this.leadingArgument)){let r=V.resolve(this.context.cwd,Ae.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:r})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}};Ve();var BE=class extends ut{static{this.paths=[["-v"],["--version"]]}async execute(){this.context.stdout.write(`${nn||""} -`)}};Ve();Ve();Gt();var vE=class extends ut{constructor(){super(...arguments);this.commandName=de.String();this.args=de.Proxy()}static{this.paths=[["exec"]]}static{this.usage=ot.Usage({description:"execute a shell script",details:` - This command simply executes a shell script within the context of the root directory of the active workspace using the portable shell. - - It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment). - `,examples:[["Execute a single shell command","$0 exec echo Hello World"],["Execute a shell script",'$0 exec "tsc & babel src --out-dir lib"']]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,locator:a}=await Qt.find(r,this.context.cwd);return await o.restoreInstallState(),await hn.executePackageShellcode(a,this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,project:o})}};Ve();Gt();il();var DE=class extends ut{constructor(){super(...arguments);this.hash=de.String({required:!1,validator:NS(Pm(),[Bw(/^p[0-9a-f]{5}$/)])})}static{this.paths=[["explain","peer-requirements"]]}static{this.usage=ot.Usage({description:"explain a set of peer requirements",details:` - A peer requirement represents all peer requests that a subject must satisfy when providing a requested package to requesters. - - When the hash argument is specified, this command prints a detailed explanation of the peer requirement corresponding to the hash and whether it is satisfied or not. - - When used without arguments, this command lists all peer requirements and the corresponding hash that can be used to get detailed information about a given requirement. - - **Note:** A hash is a six-letter p-prefixed code that can be obtained from peer dependency warnings or from the list of all peer requirements (\`yarn explain peer-requirements\`). - `,examples:[["Explain the corresponding peer requirement for a hash","$0 explain peer-requirements p1a4ed"],["List all peer requirements","$0 explain peer-requirements"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd);return await o.restoreInstallState({restoreResolutions:!1}),await o.applyLightResolution(),typeof this.hash<"u"?await T0t(this.hash,o,{stdout:this.context.stdout}):await L0t(o,{stdout:this.context.stdout})}};async function T0t(t,e,r){let o=e.peerRequirementNodes.get(t);if(typeof o>"u")throw new Error(`No peerDependency requirements found for hash: "${t}"`);let a=new Set,n=p=>a.has(p.requester.locatorHash)?{value:pe.tuple(pe.Type.DEPENDENT,{locator:p.requester,descriptor:p.descriptor}),children:p.children.size>0?[{value:pe.tuple(pe.Type.NO_HINT,"...")}]:[]}:(a.add(p.requester.locatorHash),{value:pe.tuple(pe.Type.DEPENDENT,{locator:p.requester,descriptor:p.descriptor}),children:Object.fromEntries(Array.from(p.children.values(),h=>[G.stringifyLocator(h.requester),n(h)]))}),u=e.peerWarnings.find(p=>p.hash===t);return(await Lt.start({configuration:e.configuration,stdout:r.stdout,includeFooter:!1,includePrefix:!1},async p=>{let h=pe.mark(e.configuration),E=u?h.Cross:h.Check;if(p.reportInfo(0,`Package ${pe.pretty(e.configuration,o.subject,pe.Type.LOCATOR)} is requested to provide ${pe.pretty(e.configuration,o.ident,pe.Type.IDENT)} by its descendants`),p.reportSeparator(),p.reportInfo(0,pe.pretty(e.configuration,o.subject,pe.Type.LOCATOR)),As.emitTree({children:Object.fromEntries(Array.from(o.requests.values(),w=>[G.stringifyLocator(w.requester),n(w)]))},{configuration:e.configuration,stdout:r.stdout,json:!1}),p.reportSeparator(),o.provided.range==="missing:"){let w=u?"":" , but all peer requests are optional";p.reportInfo(0,`${E} Package ${pe.pretty(e.configuration,o.subject,pe.Type.LOCATOR)} does not provide ${pe.pretty(e.configuration,o.ident,pe.Type.IDENT)}${w}.`)}else{let w=e.storedResolutions.get(o.provided.descriptorHash);if(!w)throw new Error("Assertion failed: Expected the descriptor to be registered");let D=e.storedPackages.get(w);if(!D)throw new Error("Assertion failed: Expected the package to be registered");p.reportInfo(0,`${E} Package ${pe.pretty(e.configuration,o.subject,pe.Type.LOCATOR)} provides ${pe.pretty(e.configuration,o.ident,pe.Type.IDENT)} with version ${G.prettyReference(e.configuration,D.version??"0.0.0")}, ${u?"which does not satisfy all requests.":"which satisfies all requests"}`),u?.type===3&&(u.range?p.reportInfo(0,` The combined requested range is ${pe.pretty(e.configuration,u.range,pe.Type.RANGE)}`):p.reportInfo(0," Unfortunately, the requested ranges have no overlap"))}})).exitCode()}async function L0t(t,e){return(await Lt.start({configuration:t.configuration,stdout:e.stdout,includeFooter:!1,includePrefix:!1},async o=>{let a=pe.mark(t.configuration),n=qe.sortMap(t.peerRequirementNodes,[([,u])=>G.stringifyLocator(u.subject),([,u])=>G.stringifyIdent(u.ident)]);for(let[,u]of n.values()){if(!u.root)continue;let A=t.peerWarnings.find(E=>E.hash===u.hash),p=[...G.allPeerRequests(u)],h;if(p.length>2?h=` and ${p.length-1} other dependencies`:p.length===2?h=" and 1 other dependency":h="",u.provided.range!=="missing:"){let E=t.storedResolutions.get(u.provided.descriptorHash);if(!E)throw new Error("Assertion failed: Expected the resolution to have been registered");let w=t.storedPackages.get(E);if(!w)throw new Error("Assertion failed: Expected the provided package to have been registered");let D=`${pe.pretty(t.configuration,u.hash,pe.Type.CODE)} \u2192 ${A?a.Cross:a.Check} ${G.prettyLocator(t.configuration,u.subject)} provides ${G.prettyLocator(t.configuration,w)} to ${G.prettyLocator(t.configuration,p[0].requester)}${h}`;A?o.reportWarning(0,D):o.reportInfo(0,D)}else{let E=`${pe.pretty(t.configuration,u.hash,pe.Type.CODE)} \u2192 ${A?a.Cross:a.Check} ${G.prettyLocator(t.configuration,u.subject)} doesn't provide ${G.prettyIdent(t.configuration,u.ident)} to ${G.prettyLocator(t.configuration,p[0].requester)}${h}`;A?o.reportWarning(0,E):o.reportInfo(0,E)}}})).exitCode()}Ve();Gt();il();Ve();Ve();St();Gt();var Ude=et(ni()),SE=class extends ut{constructor(){super(...arguments);this.useYarnPath=de.Boolean("--yarn-path",{description:"Set the yarnPath setting even if the version can be accessed by Corepack"});this.onlyIfNeeded=de.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=de.String()}static{this.paths=[["set","version"]]}static{this.usage=ot.Usage({description:"lock the Yarn version used by the project",details:"\n This command will set a specific release of Yarn to be used by Corepack: https://nodejs.org/api/corepack.html.\n\n By default it only will set the `packageManager` field at the root of your project, but if the referenced release cannot be represented this way, if you already have `yarnPath` configured, or if you set the `--yarn-path` command line flag, then the release will also be downloaded from the Yarn GitHub repository, stored inside your project, and referenced via the `yarnPath` settings from your project `.yarnrc.yml` file.\n\n A very good use case for this command is to enforce the version of Yarn used by any single member of your team inside the same project - by doing this you ensure that you have control over Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting different behavior.\n\n The version specifier can be:\n\n - a tag:\n - `latest` / `berry` / `stable` -> the most recent stable berry (`>=2.0.0`) release\n - `canary` -> the most recent canary (release candidate) berry (`>=2.0.0`) release\n - `classic` -> the most recent classic (`^0.x || ^1.x`) release\n\n - a semver range (e.g. `2.x`) -> the most recent version satisfying the range (limited to berry releases)\n\n - a semver version (e.g. `2.4.1`, `1.22.1`)\n\n - a local file referenced through either a relative or absolute path\n\n - `self` -> the version used to invoke the command\n ",examples:[["Download the latest release from the Yarn repository","$0 set version latest"],["Download the latest canary release from the Yarn repository","$0 set version canary"],["Download the latest classic release from the Yarn repository","$0 set version classic"],["Download the most recent Yarn 3 build","$0 set version 3.x"],["Download a specific Yarn 2 build","$0 set version 2.0.0-rc.30"],["Switch back to a specific Yarn 1 release","$0 set version 1.22.1"],["Use a release from the local filesystem","$0 set version ./yarn.cjs"],["Use a release from a URL","$0 set version https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js"],["Download the version used to invoke the command","$0 set version self"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(this.onlyIfNeeded&&r.get("yarnPath")){let A=r.sources.get("yarnPath");if(!A)throw new Error("Assertion failed: Expected 'yarnPath' to have a source");let p=r.projectCwd??r.startingCwd;if(V.contains(p,A))return 0}let o=()=>{if(typeof nn>"u")throw new it("The --install flag can only be used without explicit version specifier from the Yarn CLI");return`file://${process.argv[1]}`},a,n=(A,p)=>({version:p,url:A.replace(/\{\}/g,p)});if(this.version==="self")a={url:o(),version:nn??"self"};else if(this.version==="latest"||this.version==="berry"||this.version==="stable")a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await O2(r,"stable"));else if(this.version==="canary")a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await O2(r,"canary"));else if(this.version==="classic")a={url:"https://classic.yarnpkg.com/latest.js",version:"classic"};else if(this.version.match(/^https?:/))a={url:this.version,version:"remote"};else if(this.version.match(/^\.{0,2}[\\/]/)||Ae.isAbsolute(this.version))a={url:`file://${V.resolve(Ae.toPortablePath(this.version))}`,version:"file"};else if(Ur.satisfiesWithPrereleases(this.version,">=2.0.0"))a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",this.version);else if(Ur.satisfiesWithPrereleases(this.version,"^0.x || ^1.x"))a=n("https://github.com/yarnpkg/yarn/releases/download/v{}/yarn-{}.js",this.version);else if(Ur.validRange(this.version))a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await N0t(r,this.version));else throw new it(`Invalid version descriptor "${this.version}"`);return(await Lt.start({configuration:r,stdout:this.context.stdout,includeLogs:!this.context.quiet},async A=>{let p=async()=>{let h="file://";return a.url.startsWith(h)?(A.reportInfo(0,`Retrieving ${pe.pretty(r,a.url,pe.Type.PATH)}`),await ae.readFilePromise(a.url.slice(h.length))):(A.reportInfo(0,`Downloading ${pe.pretty(r,a.url,pe.Type.URL)}`),await on.get(a.url,{configuration:r}))};await IH(r,a.version,p,{report:A,useYarnPath:this.useYarnPath})})).exitCode()}};async function N0t(t,e){let o=(await on.get("https://repo.yarnpkg.com/tags",{configuration:t,jsonResponse:!0})).tags.filter(a=>Ur.satisfiesWithPrereleases(a,e));if(o.length===0)throw new it(`No matching release found for range ${pe.pretty(t,e,pe.Type.RANGE)}.`);return o[0]}async function O2(t,e){let r=await on.get("https://repo.yarnpkg.com/tags",{configuration:t,jsonResponse:!0});if(!r.latest[e])throw new it(`Tag ${pe.pretty(t,e,pe.Type.RANGE)} not found`);return r.latest[e]}async function IH(t,e,r,{report:o,useYarnPath:a}){let n,u=async()=>(typeof n>"u"&&(n=await r()),n);if(e===null){let te=await u();await ae.mktempPromise(async le=>{let ce=V.join(le,"yarn.cjs");await ae.writeFilePromise(ce,te);let{stdout:ue}=await Hr.execvp(process.execPath,[Ae.fromPortablePath(ce),"--version"],{cwd:le,env:{...t.env,YARN_IGNORE_PATH:"1"}});if(e=ue.trim(),!Ude.default.valid(e))throw new Error(`Invalid semver version. ${pe.pretty(t,"yarn --version",pe.Type.CODE)} returned: -${e}`)})}let A=t.projectCwd??t.startingCwd,p=V.resolve(A,".yarn/releases"),h=V.resolve(p,`yarn-${e}.cjs`),E=V.relative(t.startingCwd,h),w=qe.isTaggedYarnVersion(e),D=t.get("yarnPath"),b=!w,C=b||!!D||!!a;if(a===!1){if(b)throw new Jt(0,"You explicitly opted out of yarnPath usage in your command line, but the version you specified cannot be represented by Corepack");C=!1}else!C&&!process.env.COREPACK_ROOT&&(o.reportWarning(0,`You don't seem to have ${pe.applyHyperlink(t,"Corepack","https://nodejs.org/api/corepack.html")} enabled; we'll have to rely on ${pe.applyHyperlink(t,"yarnPath","https://yarnpkg.com/configuration/yarnrc#yarnPath")} instead`),C=!0);if(C){let te=await u();o.reportInfo(0,`Saving the new release in ${pe.pretty(t,E,"magenta")}`),await ae.removePromise(V.dirname(h)),await ae.mkdirPromise(V.dirname(h),{recursive:!0}),await ae.writeFilePromise(h,te,{mode:493}),await ze.updateConfiguration(A,{yarnPath:V.relative(A,h)})}else await ae.removePromise(V.dirname(h)),await ze.updateConfiguration(A,{yarnPath:ze.deleteProperty});let T=await _t.tryFind(A)||new _t;T.packageManager=`yarn@${w?e:await O2(t,"stable")}`;let N={};T.exportTo(N);let U=V.join(A,_t.fileName),J=`${JSON.stringify(N,null,T.indent)} -`;return await ae.changeFilePromise(U,J,{automaticNewlines:!0}),{bundleVersion:e}}function _de(t){return vr[jS(t)]}var O0t=/## (?YN[0-9]{4}) - `(?[A-Z_]+)`\n\n(?
(?:.(?!##))+)/gs;async function M0t(t){let r=`https://repo.yarnpkg.com/${qe.isTaggedYarnVersion(nn)?nn:await O2(t,"canary")}/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx`,o=await on.get(r,{configuration:t});return new Map(Array.from(o.toString().matchAll(O0t),({groups:a})=>{if(!a)throw new Error("Assertion failed: Expected the match to have been successful");let n=_de(a.code);if(a.name!==n)throw new Error(`Assertion failed: Invalid error code data: Expected "${a.name}" to be named "${n}"`);return[a.code,a.details]}))}var PE=class extends ut{constructor(){super(...arguments);this.code=de.String({required:!1,validator:vw(Pm(),[Bw(/^YN[0-9]{4}$/)])});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["explain"]]}static{this.usage=ot.Usage({description:"explain an error code",details:` - When the code argument is specified, this command prints its name and its details. - - When used without arguments, this command lists all error codes and their names. - `,examples:[["Explain an error code","$0 explain YN0006"],["List all error codes","$0 explain"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(typeof this.code<"u"){let o=_de(this.code),a=pe.pretty(r,o,pe.Type.CODE),n=this.cli.format().header(`${this.code} - ${a}`),A=(await M0t(r)).get(this.code),p=typeof A<"u"?pe.jsonOrPretty(this.json,r,pe.tuple(pe.Type.MARKDOWN,{text:A,format:this.cli.format(),paragraphs:!0})):`This error code does not have a description. - -You can help us by editing this page on GitHub \u{1F642}: -${pe.jsonOrPretty(this.json,r,pe.tuple(pe.Type.URL,"https://github.com/yarnpkg/berry/blob/master/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx"))} -`;this.json?this.context.stdout.write(`${JSON.stringify({code:this.code,name:o,details:p})} -`):this.context.stdout.write(`${n} - -${p} -`)}else{let o={children:qe.mapAndFilter(Object.entries(vr),([a,n])=>Number.isNaN(Number(a))?qe.mapAndFilter.skip:{label:Ju(Number(a)),value:pe.tuple(pe.Type.CODE,n)})};As.emitTree(o,{configuration:r,stdout:this.context.stdout,json:this.json})}}};Ve();St();Gt();var Hde=et(Xo()),xE=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=de.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=de.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=de.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=de.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=de.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=de.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=de.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=de.Rest()}static{this.paths=[["info"]]}static{this.usage=ot.Usage({description:"see information related to packages",details:"\n This command prints various information related to the specified packages, accepting glob patterns.\n\n By default, if the locator reference is missing, Yarn will default to print the information about all the matching direct dependencies of the package for the active workspace. To instead print all versions of the package that are direct dependencies of any of your workspaces, use the `-A,--all` flag. Adding the `-R,--recursive` flag will also report transitive dependencies.\n\n Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options (`--dependents`, `--manifest`, `--virtuals`, ...) described in the option descriptions.\n\n Note that this command will only print the information directly related to the selected packages - if you wish to know why the package is there in the first place, use `yarn why` which will do just that (it also provides a `-R,--recursive` flag that may be of some help).\n ",examples:[["Show information about Lodash","$0 info lodash"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a&&!this.all)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState();let u=new Set(this.extra);this.cache&&u.add("cache"),this.dependents&&u.add("dependents"),this.manifest&&u.add("manifest");let A=(le,{recursive:ce})=>{let ue=le.anchoredLocator.locatorHash,Ie=new Map,he=[ue];for(;he.length>0;){let De=he.shift();if(Ie.has(De))continue;let Ee=o.storedPackages.get(De);if(typeof Ee>"u")throw new Error("Assertion failed: Expected the package to be registered");if(Ie.set(De,Ee),G.isVirtualLocator(Ee)&&he.push(G.devirtualizeLocator(Ee).locatorHash),!(!ce&&De!==ue))for(let g of Ee.dependencies.values()){let me=o.storedResolutions.get(g.descriptorHash);if(typeof me>"u")throw new Error("Assertion failed: Expected the resolution to be registered");he.push(me)}}return Ie.values()},p=({recursive:le})=>{let ce=new Map;for(let ue of o.workspaces)for(let Ie of A(ue,{recursive:le}))ce.set(Ie.locatorHash,Ie);return ce.values()},h=({all:le,recursive:ce})=>le&&ce?o.storedPackages.values():le?p({recursive:ce}):A(a,{recursive:ce}),E=({all:le,recursive:ce})=>{let ue=h({all:le,recursive:ce}),Ie=this.patterns.map(Ee=>{let g=G.parseLocator(Ee),me=Hde.default.makeRe(G.stringifyIdent(g)),Ce=G.isVirtualLocator(g),fe=Ce?G.devirtualizeLocator(g):g;return ie=>{let Z=G.stringifyIdent(ie);if(!me.test(Z))return!1;if(g.reference==="unknown")return!0;let Se=G.isVirtualLocator(ie),Re=Se?G.devirtualizeLocator(ie):ie;return!(Ce&&Se&&g.reference!==ie.reference||fe.reference!==Re.reference)}}),he=qe.sortMap([...ue],Ee=>G.stringifyLocator(Ee));return{selection:he.filter(Ee=>Ie.length===0||Ie.some(g=>g(Ee))),sortedLookup:he}},{selection:w,sortedLookup:D}=E({all:this.all,recursive:this.recursive});if(w.length===0)throw new it("No package matched your request");let b=new Map;if(this.dependents)for(let le of D)for(let ce of le.dependencies.values()){let ue=o.storedResolutions.get(ce.descriptorHash);if(typeof ue>"u")throw new Error("Assertion failed: Expected the resolution to be registered");qe.getArrayWithDefault(b,ue).push(le)}let C=new Map;for(let le of D){if(!G.isVirtualLocator(le))continue;let ce=G.devirtualizeLocator(le);qe.getArrayWithDefault(C,ce.locatorHash).push(le)}let T={},N={children:T},U=r.makeFetcher(),J={project:o,fetcher:U,cache:n,checksums:o.storedChecksums,report:new Ri,cacheOptions:{skipIntegrityCheck:!0}},te=[async(le,ce,ue)=>{if(!ce.has("manifest"))return;let Ie=await U.fetch(le,J),he;try{he=await _t.find(Ie.prefixPath,{baseFs:Ie.packageFs})}finally{Ie.releaseFs?.()}ue("Manifest",{License:pe.tuple(pe.Type.NO_HINT,he.license),Homepage:pe.tuple(pe.Type.URL,he.raw.homepage??null)})},async(le,ce,ue)=>{if(!ce.has("cache"))return;let Ie=o.storedChecksums.get(le.locatorHash)??null,he=n.getLocatorPath(le,Ie),De;if(he!==null)try{De=await ae.statPromise(he)}catch{}let Ee=typeof De<"u"?[De.size,pe.Type.SIZE]:void 0;ue("Cache",{Checksum:pe.tuple(pe.Type.NO_HINT,Ie),Path:pe.tuple(pe.Type.PATH,he),Size:Ee})}];for(let le of w){let ce=G.isVirtualLocator(le);if(!this.virtuals&&ce)continue;let ue={},Ie={value:[le,pe.Type.LOCATOR],children:ue};if(T[G.stringifyLocator(le)]=Ie,this.nameOnly){delete Ie.children;continue}let he=C.get(le.locatorHash);typeof he<"u"&&(ue.Instances={label:"Instances",value:pe.tuple(pe.Type.NUMBER,he.length)}),ue.Version={label:"Version",value:pe.tuple(pe.Type.NO_HINT,le.version)};let De=(g,me)=>{let Ce={};if(ue[g]=Ce,Array.isArray(me))Ce.children=me.map(fe=>({value:fe}));else{let fe={};Ce.children=fe;for(let[ie,Z]of Object.entries(me))typeof Z>"u"||(fe[ie]={label:ie,value:Z})}};if(!ce){for(let g of te)await g(le,u,De);await r.triggerHook(g=>g.fetchPackageInfo,le,u,De)}le.bin.size>0&&!ce&&De("Exported Binaries",[...le.bin.keys()].map(g=>pe.tuple(pe.Type.PATH,g)));let Ee=b.get(le.locatorHash);typeof Ee<"u"&&Ee.length>0&&De("Dependents",Ee.map(g=>pe.tuple(pe.Type.LOCATOR,g))),le.dependencies.size>0&&!ce&&De("Dependencies",[...le.dependencies.values()].map(g=>{let me=o.storedResolutions.get(g.descriptorHash),Ce=typeof me<"u"?o.storedPackages.get(me)??null:null;return pe.tuple(pe.Type.RESOLUTION,{descriptor:g,locator:Ce})})),le.peerDependencies.size>0&&ce&&De("Peer dependencies",[...le.peerDependencies.values()].map(g=>{let me=le.dependencies.get(g.identHash),Ce=typeof me<"u"?o.storedResolutions.get(me.descriptorHash)??null:null,fe=Ce!==null?o.storedPackages.get(Ce)??null:null;return pe.tuple(pe.Type.RESOLUTION,{descriptor:g,locator:fe})}))}As.emitTree(N,{configuration:r,json:this.json,stdout:this.context.stdout,separators:this.nameOnly?0:2})}};Ve();St();Ol();var Vk=et(sg());Gt();var wH=et(ni());il();var U0t=[{selector:t=>t===-1,name:"nodeLinker",value:"node-modules"},{selector:t=>t!==-1&&t<8,name:"enableGlobalCache",value:!1},{selector:t=>t!==-1&&t<8,name:"compressionLevel",value:"mixed"}],bE=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.immutable=de.Boolean("--immutable",{description:"Abort with an error exit code if the lockfile was to be modified"});this.immutableCache=de.Boolean("--immutable-cache",{description:"Abort with an error exit code if the cache folder was to be modified"});this.refreshLockfile=de.Boolean("--refresh-lockfile",{description:"Refresh the package metadata stored in the lockfile"});this.checkCache=de.Boolean("--check-cache",{description:"Always refetch the packages and ensure that their checksums are consistent"});this.checkResolutions=de.Boolean("--check-resolutions",{description:"Validates that the package resolutions are coherent"});this.inlineBuilds=de.Boolean("--inline-builds",{description:"Verbosely print the output of the build steps of dependencies"});this.mode=de.String("--mode",{description:"Change what artifacts installs generate",validator:js(yl)});this.cacheFolder=de.String("--cache-folder",{hidden:!0});this.frozenLockfile=de.Boolean("--frozen-lockfile",{hidden:!0});this.ignoreEngines=de.Boolean("--ignore-engines",{hidden:!0});this.nonInteractive=de.Boolean("--non-interactive",{hidden:!0});this.preferOffline=de.Boolean("--prefer-offline",{hidden:!0});this.production=de.Boolean("--production",{hidden:!0});this.registry=de.String("--registry",{hidden:!0});this.silent=de.Boolean("--silent",{hidden:!0});this.networkTimeout=de.String("--network-timeout",{hidden:!0})}static{this.paths=[["install"],ot.Default]}static{this.usage=ot.Usage({description:"install the project dependencies",details:"\n This command sets up your project if needed. The installation is split into four different steps that each have their own characteristics:\n\n - **Resolution:** First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ).\n\n - **Fetch:** Then we download all the dependencies if needed, and make sure that they're all stored within our cache (check the value of `cacheFolder` in `yarn config` to see where the cache files are stored).\n\n - **Link:** Then we send the dependency tree information to internal plugins tasked with writing them on the disk in some form (for example by generating the `.pnp.cjs` file you might know).\n\n - **Build:** Once the dependency tree has been written on the disk, the package manager will now be free to run the build scripts for all packages that might need it, in a topological order compatible with the way they depend on one another. See https://yarnpkg.com/advanced/lifecycle-scripts for detail.\n\n Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your `.pnp.cjs` file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.\n\n If the `--immutable` option is set (defaults to true on CI), Yarn will abort with an error exit code if the lockfile was to be modified (other paths can be added using the `immutablePatterns` configuration setting). For backward compatibility we offer an alias under the name of `--frozen-lockfile`, but it will be removed in a later release.\n\n If the `--immutable-cache` option is set, Yarn will abort with an error exit code if the cache folder was to be modified (either because files would be added, or because they'd be removed).\n\n If the `--refresh-lockfile` option is set, Yarn will keep the same resolution for the packages currently in the lockfile but will refresh their metadata. If used together with `--immutable`, it can validate that the lockfile information are consistent. This flag is enabled by default when Yarn detects it runs within a pull request context.\n\n If the `--check-cache` option is set, Yarn will always refetch the packages and will ensure that their checksum matches what's 1/ described in the lockfile 2/ inside the existing cache files (if present). This is recommended as part of your CI workflow if you're both following the Zero-Installs model and accepting PRs from third-parties, as they'd otherwise have the ability to alter the checked-in packages before submitting them.\n\n If the `--inline-builds` option is set, Yarn will verbosely print the output of the build steps of your dependencies (instead of writing them into individual files). This is likely useful mostly for debug purposes only when using Docker-like environments.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n ",examples:[["Install the project","$0 install"],["Validate a project when using Zero-Installs","$0 install --immutable --immutable-cache"],["Validate a project when using Zero-Installs (slightly safer if you accept external PRs)","$0 install --immutable --immutable-cache --check-cache"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);typeof this.inlineBuilds<"u"&&r.useWithSource("",{enableInlineBuilds:this.inlineBuilds},r.startingCwd,{overwrite:!0});let o=!!process.env.FUNCTION_TARGET||!!process.env.GOOGLE_RUNTIME,a=await Qy({configuration:r,stdout:this.context.stdout},[{option:this.ignoreEngines,message:"The --ignore-engines option is deprecated; engine checking isn't a core feature anymore",error:!Vk.default.VERCEL},{option:this.registry,message:"The --registry option is deprecated; prefer setting npmRegistryServer in your .yarnrc.yml file"},{option:this.preferOffline,message:"The --prefer-offline flag is deprecated; use the --cached flag with 'yarn add' instead",error:!Vk.default.VERCEL},{option:this.production,message:"The --production option is deprecated on 'install'; use 'yarn workspaces focus' instead",error:!0},{option:this.nonInteractive,message:"The --non-interactive option is deprecated",error:!o},{option:this.frozenLockfile,message:"The --frozen-lockfile option is deprecated; use --immutable and/or --immutable-cache instead",callback:()=>this.immutable=this.frozenLockfile},{option:this.cacheFolder,message:"The cache-folder option has been deprecated; use rc settings instead",error:!Vk.default.NETLIFY}]);if(a!==null)return a;let n=this.mode==="update-lockfile";if(n&&(this.immutable||this.immutableCache))throw new it(`${pe.pretty(r,"--immutable",pe.Type.CODE)} and ${pe.pretty(r,"--immutable-cache",pe.Type.CODE)} cannot be used with ${pe.pretty(r,"--mode=update-lockfile",pe.Type.CODE)}`);let u=(this.immutable??r.get("enableImmutableInstalls"))&&!n,A=this.immutableCache&&!n;if(r.projectCwd!==null){let T=await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async N=>{let U=!1;await q0t(r,u)&&(N.reportInfo(48,"Automatically removed core plugins that are now builtins \u{1F44D}"),U=!0),await H0t(r,u)&&(N.reportInfo(48,"Automatically fixed merge conflicts \u{1F44D}"),U=!0),U&&N.reportSeparator()});if(T.hasErrors())return T.exitCode()}if(r.projectCwd!==null){let T=await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async N=>{if(ze.telemetry?.isNew)ze.telemetry.commitTips(),N.reportInfo(65,"Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry"),N.reportInfo(65,`Run ${pe.pretty(r,"yarn config set --home enableTelemetry 0",pe.Type.CODE)} to disable`),N.reportSeparator();else if(ze.telemetry?.shouldShowTips){let U=await on.get("https://repo.yarnpkg.com/tags",{configuration:r,jsonResponse:!0}).catch(()=>null);if(U!==null){let J=null;if(nn!==null){let le=wH.default.prerelease(nn)?"canary":"stable",ce=U.latest[le];wH.default.gt(ce,nn)&&(J=[le,ce])}if(J)ze.telemetry.commitTips(),N.reportInfo(88,`${pe.applyStyle(r,`A new ${J[0]} version of Yarn is available:`,pe.Style.BOLD)} ${G.prettyReference(r,J[1])}!`),N.reportInfo(88,`Upgrade now by running ${pe.pretty(r,`yarn set version ${J[1]}`,pe.Type.CODE)}`),N.reportSeparator();else{let te=ze.telemetry.selectTip(U.tips);te&&(N.reportInfo(89,pe.pretty(r,te.message,pe.Type.MARKDOWN_INLINE)),te.url&&N.reportInfo(89,`Learn more at ${te.url}`),N.reportSeparator())}}}});if(T.hasErrors())return T.exitCode()}let{project:p,workspace:h}=await Qt.find(r,this.context.cwd),E=p.lockfileLastVersion;if(E!==null){let T=await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async N=>{let U={};for(let J of U0t)J.selector(E)&&typeof r.sources.get(J.name)>"u"&&(r.use("",{[J.name]:J.value},p.cwd,{overwrite:!0}),U[J.name]=J.value);Object.keys(U).length>0&&(await ze.updateConfiguration(p.cwd,U),N.reportInfo(87,"Migrated your project to the latest Yarn version \u{1F680}"),N.reportSeparator())});if(T.hasErrors())return T.exitCode()}let w=await Wr.find(r,{immutable:A,check:this.checkCache});if(!h)throw new or(p.cwd,this.context.cwd);await p.restoreInstallState({restoreResolutions:!1});let D=r.get("enableHardenedMode");D&&typeof r.sources.get("enableHardenedMode")>"u"&&await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async T=>{T.reportWarning(0,"Yarn detected that the current workflow is executed from a public pull request. For safety the hardened mode has been enabled."),T.reportWarning(0,`It will prevent malicious lockfile manipulations, in exchange for a slower install time. You can opt-out if necessary; check our ${pe.applyHyperlink(r,"documentation","https://yarnpkg.com/features/security#hardened-mode")} for more details.`),T.reportSeparator()}),(this.refreshLockfile??D)&&(p.lockfileNeedsRefresh=!0);let b=this.checkResolutions??D;return(await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout,forceSectionAlignment:!0,includeLogs:!0,includeVersion:!0},async T=>{await p.install({cache:w,report:T,immutable:u,checkResolutions:b,mode:this.mode})})).exitCode()}},_0t="<<<<<<<";async function H0t(t,e){if(!t.projectCwd)return!1;let r=V.join(t.projectCwd,mr.lockfile);if(!await ae.existsPromise(r)||!(await ae.readFilePromise(r,"utf8")).includes(_0t))return!1;if(e)throw new Jt(47,"Cannot autofix a lockfile when running an immutable install");let a=await Hr.execvp("git",["rev-parse","MERGE_HEAD","HEAD"],{cwd:t.projectCwd});if(a.code!==0&&(a=await Hr.execvp("git",["rev-parse","REBASE_HEAD","HEAD"],{cwd:t.projectCwd})),a.code!==0&&(a=await Hr.execvp("git",["rev-parse","CHERRY_PICK_HEAD","HEAD"],{cwd:t.projectCwd})),a.code!==0)throw new Jt(83,"Git returned an error when trying to find the commits pertaining to the conflict");let n=await Promise.all(a.stdout.trim().split(/\n/).map(async A=>{let p=await Hr.execvp("git",["show",`${A}:./${mr.lockfile}`],{cwd:t.projectCwd});if(p.code!==0)throw new Jt(83,`Git returned an error when trying to access the lockfile content in ${A}`);try{return Vi(p.stdout)}catch{throw new Jt(46,"A variant of the conflicting lockfile failed to parse")}}));n=n.filter(A=>!!A.__metadata);for(let A of n){if(A.__metadata.version<7)for(let p of Object.keys(A)){if(p==="__metadata")continue;let h=G.parseDescriptor(p,!0),E=t.normalizeDependency(h),w=G.stringifyDescriptor(E);w!==p&&(A[w]=A[p],delete A[p])}for(let p of Object.keys(A)){if(p==="__metadata")continue;let h=A[p].checksum;typeof h>"u"||h.includes("/")||(A[p].checksum=`${A.__metadata.cacheKey}/${h}`)}}let u=Object.assign({},...n);u.__metadata.version=`${Math.min(...n.map(A=>parseInt(A.__metadata.version??0)))}`,u.__metadata.cacheKey="merged";for(let[A,p]of Object.entries(u))typeof p=="string"&&delete u[A];return await ae.changeFilePromise(r,Sa(u),{automaticNewlines:!0}),!0}async function q0t(t,e){if(!t.projectCwd)return!1;let r=[],o=V.join(t.projectCwd,".yarn/plugins/@yarnpkg");return await ze.updateConfiguration(t.projectCwd,{plugins:n=>{if(!Array.isArray(n))return n;let u=n.filter(A=>{if(!A.path)return!0;let p=V.resolve(t.projectCwd,A.path),h=j1.has(A.spec)&&V.contains(o,p);return h&&r.push(p),!h});return u.length===0?ze.deleteProperty:u.length===n.length?n:u}},{immutable:e})?(await Promise.all(r.map(async n=>{await ae.removePromise(n)})),!0):!1}Ve();St();Gt();var kE=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("-A,--all",!1,{description:"Link all workspaces belonging to the target projects to the current one"});this.private=de.Boolean("-p,--private",!1,{description:"Also link private workspaces belonging to the target projects to the current one"});this.relative=de.Boolean("-r,--relative",!1,{description:"Link workspaces using relative paths instead of absolute paths"});this.destinations=de.Rest()}static{this.paths=[["link"]]}static{this.usage=ot.Usage({description:"connect the local project to another one",details:"\n This command will set a new `resolutions` field in the project-level manifest and point it to the workspace at the specified location (even if part of another project).\n ",examples:[["Register one or more remote workspaces for use in the current project","$0 link ~/ts-loader ~/jest"],["Register all workspaces from a remote project for use in the current project","$0 link ~/jest --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=o.topLevelWorkspace,A=[];for(let p of this.destinations){let h=V.resolve(this.context.cwd,Ae.toPortablePath(p)),E=await ze.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:w,workspace:D}=await Qt.find(E,h);if(o.cwd===w.cwd)throw new it(`Invalid destination '${p}'; Can't link the project to itself`);if(!D)throw new or(w.cwd,h);if(this.all){let b=!1;for(let C of w.workspaces)C.manifest.name&&(!C.manifest.private||this.private)&&(A.push(C),b=!0);if(!b)throw new it(`No workspace found to be linked in the target project: ${p}`)}else{if(!D.manifest.name)throw new it(`The target workspace at '${p}' doesn't have a name and thus cannot be linked`);if(D.manifest.private&&!this.private)throw new it(`The target workspace at '${p}' is marked private - use the --private flag to link it anyway`);A.push(D)}}for(let p of A){let h=G.stringifyIdent(p.anchoredLocator),E=this.relative?V.relative(o.cwd,p.cwd):p.cwd;u.manifest.resolutions.push({pattern:{descriptor:{fullName:h}},reference:`portal:${E}`})}return await o.installWithNewReport({stdout:this.context.stdout},{cache:n})}};Gt();var QE=class extends ut{constructor(){super(...arguments);this.args=de.Proxy()}static{this.paths=[["node"]]}static{this.usage=ot.Usage({description:"run node with the hook already setup",details:` - This command simply runs Node. It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment). - - The Node process will use the exact same version of Node as the one used to run Yarn itself, which might be a good way to ensure that your commands always use a consistent Node version. - `,examples:[["Run a Node script","$0 node ./my-script.js"]]})}async execute(){return this.cli.run(["exec","node",...this.args])}};Ve();Gt();var FE=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","check"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"find all third-party plugins that differ from their own spec",details:` - Check only the plugins from https. - - If this command detects any plugin differences in the CI environment, it will throw an error. - `,examples:[["find all third-party plugins that differ from their own spec","$0 plugin check"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=await ze.findRcFiles(this.context.cwd);return(await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{for(let u of o)if(u.data?.plugins)for(let A of u.data.plugins){if(!A.checksum||!A.spec.match(/^https?:/))continue;let p=await on.get(A.spec,{configuration:r}),h=bn.makeHash(p);if(A.checksum===h)continue;let E=pe.pretty(r,A.path,pe.Type.PATH),w=pe.pretty(r,A.spec,pe.Type.URL),D=`${E} is different from the file provided by ${w}`;n.reportJson({...A,newChecksum:h}),n.reportError(0,D)}})).exitCode()}};Ve();Ve();St();Gt();var Yde=ve("os");Ve();St();Gt();var qde=ve("os");Ve();Ol();Gt();var j0t="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function Jg(t,e){let r=await on.get(j0t,{configuration:t}),o=Vi(r.toString());return Object.fromEntries(Object.entries(o).filter(([a,n])=>!e||Ur.satisfiesWithPrereleases(e,n.range??"<4.0.0-rc.1")))}var RE=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","list"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"list the available official plugins",details:"\n This command prints the plugins available directly from the Yarn repository. Only those plugins can be referenced by name in `yarn plugin import`.\n ",examples:[["List the official plugins","$0 plugin list"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{let n=await Jg(r,nn);for(let[u,{experimental:A,...p}]of Object.entries(n)){let h=u;A&&(h+=" [experimental]"),a.reportJson({name:u,experimental:A,...p}),a.reportInfo(null,h)}})).exitCode()}};var G0t=/^[0-9]+$/,W0t=process.platform==="win32";function jde(t){return G0t.test(t)?`pull/${t}/head`:t}var Y0t=({repository:t,branch:e},r)=>[["git","init",Ae.fromPortablePath(r)],["git","remote","add","origin",t],["git","fetch","origin","--depth=1",jde(e)],["git","reset","--hard","FETCH_HEAD"]],V0t=({branch:t})=>[["git","fetch","origin","--depth=1",jde(t),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx","-e","packages/yarnpkg-cli/bundles"]],K0t=({plugins:t,noMinify:e},r,o)=>[["yarn","build:cli",...new Array().concat(...t.map(a=>["--plugin",V.resolve(o,a)])),...e?["--no-minify"]:[],"|"],[W0t?"move":"mv","packages/yarnpkg-cli/bundles/yarn.js",Ae.fromPortablePath(r),"|"]],TE=class extends ut{constructor(){super(...arguments);this.installPath=de.String("--path",{description:"The path where the repository should be cloned to"});this.repository=de.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=de.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=de.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.dryRun=de.Boolean("-n,--dry-run",!1,{description:"If set, the bundle will be built but not added to the project"});this.noMinify=de.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=de.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=de.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}static{this.paths=[["set","version","from","sources"]]}static{this.usage=ot.Usage({description:"build Yarn from master",details:` - This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project. - - By default, it also updates all contrib plugins to the same commit the bundle is built from. This behavior can be disabled by using the \`--skip-plugins\` flag. - `,examples:[["Build Yarn from master","$0 set version from sources"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd),a=typeof this.installPath<"u"?V.resolve(this.context.cwd,Ae.toPortablePath(this.installPath)):V.resolve(Ae.toPortablePath((0,qde.tmpdir)()),"yarnpkg-sources",bn.makeHash(this.repository).slice(0,6));return(await Lt.start({configuration:r,stdout:this.context.stdout},async u=>{await BH(this,{configuration:r,report:u,target:a}),u.reportSeparator(),u.reportInfo(0,"Building a fresh bundle"),u.reportSeparator();let A=await Hr.execvp("git",["rev-parse","--short","HEAD"],{cwd:a,strict:!0}),p=V.join(a,`packages/yarnpkg-cli/bundles/yarn-${A.stdout.trim()}.js`);ae.existsSync(p)||(await M2(K0t(this,p,a),{configuration:r,context:this.context,target:a}),u.reportSeparator());let h=await ae.readFilePromise(p);if(!this.dryRun){let{bundleVersion:E}=await IH(r,null,async()=>h,{report:u});this.skipPlugins||await J0t(this,E,{project:o,report:u,target:a})}})).exitCode()}};async function M2(t,{configuration:e,context:r,target:o}){for(let[a,...n]of t){let u=n[n.length-1]==="|";if(u&&n.pop(),u)await Hr.pipevp(a,n,{cwd:o,stdin:r.stdin,stdout:r.stdout,stderr:r.stderr,strict:!0});else{r.stdout.write(`${pe.pretty(e,` $ ${[a,...n].join(" ")}`,"grey")} -`);try{await Hr.execvp(a,n,{cwd:o,strict:!0})}catch(A){throw r.stdout.write(A.stdout||A.stack),A}}}}async function BH(t,{configuration:e,report:r,target:o}){let a=!1;if(!t.force&&ae.existsSync(V.join(o,".git"))){r.reportInfo(0,"Fetching the latest commits"),r.reportSeparator();try{await M2(V0t(t),{configuration:e,context:t.context,target:o}),a=!0}catch{r.reportSeparator(),r.reportWarning(0,"Repository update failed; we'll try to regenerate it")}}a||(r.reportInfo(0,"Cloning the remote repository"),r.reportSeparator(),await ae.removePromise(o),await ae.mkdirPromise(o,{recursive:!0}),await M2(Y0t(t,o),{configuration:e,context:t.context,target:o}))}async function J0t(t,e,{project:r,report:o,target:a}){let n=await Jg(r.configuration,e),u=new Set(Object.keys(n));for(let A of r.configuration.plugins.keys())u.has(A)&&await vH(A,t,{project:r,report:o,target:a})}Ve();Ve();St();Gt();var Gde=et(ni()),Wde=ve("vm");var LE=class extends ut{constructor(){super(...arguments);this.name=de.String();this.checksum=de.Boolean("--checksum",!0,{description:"Whether to care if this plugin is modified"})}static{this.paths=[["plugin","import"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"download a plugin",details:` - This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations. - - Three types of plugin references are accepted: - - - If the plugin is stored within the Yarn repository, it can be referenced by name. - - Third-party plugins can be referenced directly through their public urls. - - Local plugins can be referenced by their path on the disk. - - If the \`--no-checksum\` option is set, Yarn will no longer care if the plugin is modified. - - Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package). - `,examples:[['Download and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import @yarnpkg/plugin-exec"],['Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import exec"],["Download and activate a community plugin","$0 plugin import https://example.org/path/to/plugin.js"],["Activate a local plugin","$0 plugin import ./path/to/plugin.js"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Lt.start({configuration:r,stdout:this.context.stdout},async a=>{let{project:n}=await Qt.find(r,this.context.cwd),u,A;if(this.name.match(/^\.{0,2}[\\/]/)||Ae.isAbsolute(this.name)){let p=V.resolve(this.context.cwd,Ae.toPortablePath(this.name));a.reportInfo(0,`Reading ${pe.pretty(r,p,pe.Type.PATH)}`),u=V.relative(n.cwd,p),A=await ae.readFilePromise(p)}else{let p;if(this.name.match(/^https?:/)){try{new URL(this.name)}catch{throw new Jt(52,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}u=this.name,p=this.name}else{let h=G.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(h.reference!=="unknown"&&!Gde.default.valid(h.reference))throw new Jt(0,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let E=G.stringifyIdent(h),w=await Jg(r,nn);if(!Object.hasOwn(w,E)){let D=`Couldn't find a plugin named ${G.prettyIdent(r,h)} on the remote registry. -`;throw r.plugins.has(E)?D+=`A plugin named ${G.prettyIdent(r,h)} is already installed; possibly attempting to import a built-in plugin.`:D+=`Note that only the plugins referenced on our website (${pe.pretty(r,"https://github.com/yarnpkg/berry/blob/master/plugins.yml",pe.Type.URL)}) can be referenced by their name; any other plugin will have to be referenced through its public url (for example ${pe.pretty(r,"https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js",pe.Type.URL)}).`,new Jt(51,D)}u=E,p=w[E].url,h.reference!=="unknown"?p=p.replace(/\/master\//,`/${E}/${h.reference}/`):nn!==null&&(p=p.replace(/\/master\//,`/@yarnpkg/cli/${nn}/`))}a.reportInfo(0,`Downloading ${pe.pretty(r,p,"green")}`),A=await on.get(p,{configuration:r})}await DH(u,A,{checksum:this.checksum,project:n,report:a})})).exitCode()}};async function DH(t,e,{checksum:r=!0,project:o,report:a}){let{configuration:n}=o,u={},A={exports:u};(0,Wde.runInNewContext)(e.toString(),{module:A,exports:u});let h=`.yarn/plugins/${A.exports.name}.cjs`,E=V.resolve(o.cwd,h);a.reportInfo(0,`Saving the new plugin in ${pe.pretty(n,h,"magenta")}`),await ae.mkdirPromise(V.dirname(E),{recursive:!0}),await ae.writeFilePromise(E,e);let w={path:h,spec:t};r&&(w.checksum=bn.makeHash(e)),await ze.addPlugin(o.cwd,[w])}var z0t=({pluginName:t,noMinify:e},r)=>[["yarn",`build:${t}`,...e?["--no-minify"]:[],"|"]],NE=class extends ut{constructor(){super(...arguments);this.installPath=de.String("--path",{description:"The path where the repository should be cloned to"});this.repository=de.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=de.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=de.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=de.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=de.String()}static{this.paths=[["plugin","import","from","sources"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"build a plugin from sources",details:` - This command clones the Yarn repository into a temporary folder, builds the specified contrib plugin and updates the configuration to reference it in further CLI invocations. - - The plugins can be referenced by their short name if sourced from the official Yarn repository. - `,examples:[['Build and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import from sources @yarnpkg/plugin-exec"],['Build and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import from sources exec"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=typeof this.installPath<"u"?V.resolve(this.context.cwd,Ae.toPortablePath(this.installPath)):V.resolve(Ae.toPortablePath((0,Yde.tmpdir)()),"yarnpkg-sources",bn.makeHash(this.repository).slice(0,6));return(await Lt.start({configuration:r,stdout:this.context.stdout},async n=>{let{project:u}=await Qt.find(r,this.context.cwd),A=G.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),p=G.stringifyIdent(A),h=await Jg(r,nn);if(!Object.hasOwn(h,p))throw new Jt(51,`Couldn't find a plugin named "${p}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);let E=p;await BH(this,{configuration:r,report:n,target:o}),await vH(E,this,{project:u,report:n,target:o})})).exitCode()}};async function vH(t,{context:e,noMinify:r},{project:o,report:a,target:n}){let u=t.replace(/@yarnpkg\//,""),{configuration:A}=o;a.reportSeparator(),a.reportInfo(0,`Building a fresh ${u}`),a.reportSeparator(),await M2(z0t({pluginName:u,noMinify:r},n),{configuration:A,context:e,target:n}),a.reportSeparator();let p=V.resolve(n,`packages/${u}/bundles/${t}.js`),h=await ae.readFilePromise(p);await DH(t,h,{project:o,report:a})}Ve();St();Gt();var OE=class extends ut{constructor(){super(...arguments);this.name=de.String()}static{this.paths=[["plugin","remove"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"remove a plugin",details:` - This command deletes the specified plugin from the .yarn/plugins folder and removes it from the configuration. - - **Note:** The plugins have to be referenced by their name property, which can be obtained using the \`yarn plugin runtime\` command. Shorthands are not allowed. - `,examples:[["Remove a plugin imported from the Yarn repository","$0 plugin remove @yarnpkg/plugin-typescript"],["Remove a plugin imported from a local file","$0 plugin remove my-local-plugin"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd);return(await Lt.start({configuration:r,stdout:this.context.stdout},async n=>{let u=this.name,A=G.parseIdent(u);if(!r.plugins.has(u))throw new it(`${G.prettyIdent(r,A)} isn't referenced by the current configuration`);let p=`.yarn/plugins/${u}.cjs`,h=V.resolve(o.cwd,p);ae.existsSync(h)&&(n.reportInfo(0,`Removing ${pe.pretty(r,p,pe.Type.PATH)}...`),await ae.removePromise(h)),n.reportInfo(0,"Updating the configuration..."),await ze.updateConfiguration(o.cwd,{plugins:E=>{if(!Array.isArray(E))return E;let w=E.filter(D=>D.path!==p);return w.length===0?ze.deleteProperty:w.length===E.length?E:w}})})).exitCode()}};Ve();Gt();var ME=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","runtime"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"list the active plugins",details:` - This command prints the currently active plugins. Will be displayed both builtin plugins and external plugins. - `,examples:[["List the currently active plugins","$0 plugin runtime"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{for(let n of r.plugins.keys()){let u=this.context.plugins.plugins.has(n),A=n;u&&(A+=" [builtin]"),a.reportJson({name:n,builtin:u}),a.reportInfo(null,`${A}`)}})).exitCode()}};Ve();Ve();Gt();var UE=class extends ut{constructor(){super(...arguments);this.idents=de.Rest()}static{this.paths=[["rebuild"]]}static{this.usage=ot.Usage({description:"rebuild the project's native packages",details:` - This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again. - - Note that while Yarn forgets the compilation, the previous artifacts aren't erased from the filesystem and may affect the next builds (in good or bad). To avoid this, you may remove the .yarn/unplugged folder, or any other relevant location where packages might have been stored (Yarn may offer a way to do that automatically in the future). - - By default all packages will be rebuilt, but you can filter the list by specifying the names of the packages you want to clear from memory. - `,examples:[["Rebuild all packages","$0 rebuild"],["Rebuild fsevents only","$0 rebuild fsevents"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);let u=new Set;for(let A of this.idents)u.add(G.parseIdent(A).identHash);if(await o.restoreInstallState({restoreResolutions:!1}),await o.resolveEverything({cache:n,report:new Ri}),u.size>0)for(let A of o.storedPackages.values())u.has(A.identHash)&&(o.storedBuildState.delete(A.locatorHash),o.skippedBuilds.delete(A.locatorHash));else o.storedBuildState.clear(),o.skippedBuilds.clear();return await o.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Ve();Ve();Ve();Gt();var SH=et(Xo());il();var _E=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=de.String("--mode",{description:"Change what artifacts installs generate",validator:js(yl)});this.patterns=de.Rest()}static{this.paths=[["remove"]]}static{this.usage=ot.Usage({description:"remove dependencies from the project",details:` - This command will remove the packages matching the specified patterns from the current workspace. - - If the \`--mode=\` option is set, Yarn will change which artifacts are generated. The modes currently supported are: - - - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run. - - - \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost. - - This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them. - `,examples:[["Remove a dependency from the current project","$0 remove lodash"],["Remove a dependency from all workspaces at once","$0 remove lodash --all"],["Remove all dependencies starting with `eslint-`","$0 remove 'eslint-*'"],["Remove all dependencies with the `@babel` scope","$0 remove '@babel/*'"],["Remove all dependencies matching `react-dom` or `react-helmet`","$0 remove 'react-{dom,helmet}'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=this.all?o.workspaces:[a],A=["dependencies","devDependencies","peerDependencies"],p=[],h=!1,E=[];for(let C of this.patterns){let T=!1,N=G.parseIdent(C);for(let U of u){let J=[...U.manifest.peerDependenciesMeta.keys()];for(let te of(0,SH.default)(J,C))U.manifest.peerDependenciesMeta.delete(te),h=!0,T=!0;for(let te of A){let le=U.manifest.getForScope(te),ce=[...le.values()].map(ue=>G.stringifyIdent(ue));for(let ue of(0,SH.default)(ce,G.stringifyIdent(N))){let{identHash:Ie}=G.parseIdent(ue),he=le.get(Ie);if(typeof he>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");U.manifest[te].delete(Ie),E.push([U,te,he]),h=!0,T=!0}}}T||p.push(C)}let w=p.length>1?"Patterns":"Pattern",D=p.length>1?"don't":"doesn't",b=this.all?"any":"this";if(p.length>0)throw new it(`${w} ${pe.prettyList(r,p,pe.Type.CODE)} ${D} match any packages referenced by ${b} workspace`);return h?(await r.triggerMultipleHooks(C=>C.afterWorkspaceDependencyRemoval,E),await o.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})):0}};Ve();Ve();Gt();var Vde=ve("util"),HE=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["run"]]}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);return(await Lt.start({configuration:r,stdout:this.context.stdout,json:this.json},async u=>{let A=a.manifest.scripts,p=qe.sortMap(A.keys(),w=>w),h={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},E=p.reduce((w,D)=>Math.max(w,D.length),0);for(let[w,D]of A.entries())u.reportInfo(null,`${w.padEnd(E," ")} ${(0,Vde.inspect)(D,h)}`),u.reportJson({name:w,script:D})})).exitCode()}};Ve();Ve();Gt();var qE=class extends ut{constructor(){super(...arguments);this.inspect=de.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=de.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=de.Boolean("-T,--top-level",!1,{description:"Check the root workspace for scripts and/or binaries instead of the current one"});this.binariesOnly=de.Boolean("-B,--binaries-only",!1,{description:"Ignore any user defined scripts and only check for binaries"});this.require=de.String("--require",{description:"Forwarded to the underlying Node process when executing a binary"});this.silent=de.Boolean("--silent",{hidden:!0});this.scriptName=de.String();this.args=de.Proxy()}static{this.paths=[["run"]]}static{this.usage=ot.Usage({description:"run a script defined in the package.json",details:` - This command will run a tool. The exact tool that will be executed will depend on the current state of your workspace: - - - If the \`scripts\` field from your local package.json contains a matching script name, its definition will get executed. - - - Otherwise, if one of the local workspace's dependencies exposes a binary with a matching name, this binary will get executed. - - - Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed. - - Whatever happens, the cwd of the spawned process will be the workspace that declares the script (which makes it possible to call commands cross-workspaces using the third syntax). - `,examples:[["Run the tests from the local workspace","$0 run test"],['Same thing, but without the "run" keyword',"$0 test"],["Inspect Webpack while running","$0 run --inspect-brk webpack"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a,locator:n}=await Qt.find(r,this.context.cwd);await o.restoreInstallState();let u=this.topLevel?o.topLevelWorkspace.anchoredLocator:n;if(!this.binariesOnly&&await hn.hasPackageScript(u,this.scriptName,{project:o}))return await hn.executePackageScript(u,this.scriptName,this.args,{project:o,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let A=await hn.getPackageAccessibleBinaries(u,{project:o});if(A.get(this.scriptName)){let h=[];return this.inspect&&(typeof this.inspect=="string"?h.push(`--inspect=${this.inspect}`):h.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?h.push(`--inspect-brk=${this.inspectBrk}`):h.push("--inspect-brk")),this.require&&h.push(`--require=${this.require}`),await hn.executePackageAccessibleBinary(u,this.scriptName,this.args,{cwd:this.context.cwd,project:o,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:h,packageAccessibleBinaries:A})}if(!this.topLevel&&!this.binariesOnly&&a&&this.scriptName.includes(":")){let E=(await Promise.all(o.workspaces.map(async w=>w.manifest.scripts.has(this.scriptName)?w:null))).filter(w=>w!==null);if(E.length===1)return await hn.executeWorkspaceScript(E[0],this.scriptName,this.args,{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}if(this.topLevel)throw this.scriptName==="node-gyp"?new it(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${G.prettyLocator(r,n)}). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.`):new it(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${G.prettyLocator(r,n)}).`);{if(this.scriptName==="global")throw new it("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let h=[this.scriptName].concat(this.args);for(let[E,w]of oE)for(let D of w)if(h.length>=D.length&&JSON.stringify(h.slice(0,D.length))===JSON.stringify(D))throw new it(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${E} plugin. You can install it with "yarn plugin import ${E}".`);throw new it(`Couldn't find a script named "${this.scriptName}".`)}}};Ve();Ve();Gt();var jE=class extends ut{constructor(){super(...arguments);this.descriptor=de.String();this.resolution=de.String()}static{this.paths=[["set","resolution"]]}static{this.usage=ot.Usage({description:"enforce a package resolution",details:'\n This command updates the resolution table so that `descriptor` is resolved by `resolution`.\n\n Note that by default this command only affect the current resolution table - meaning that this "manual override" will disappear if you remove the lockfile, or if the package disappear from the table. If you wish to make the enforced resolution persist whatever happens, edit the `resolutions` field in your top-level manifest.\n\n Note that no attempt is made at validating that `resolution` is a valid resolution entry for `descriptor`.\n ',examples:[["Force all instances of lodash@npm:^1.2.3 to resolve to 1.5.0","$0 set resolution lodash@npm:^1.2.3 1.5.0"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(await o.restoreInstallState({restoreResolutions:!1}),!a)throw new or(o.cwd,this.context.cwd);let u=G.parseDescriptor(this.descriptor,!0),A=G.makeDescriptor(u,this.resolution);return o.storedDescriptors.set(u.descriptorHash,u),o.storedDescriptors.set(A.descriptorHash,A),o.resolutionAliases.set(u.descriptorHash,A.descriptorHash),await o.installWithNewReport({stdout:this.context.stdout},{cache:n})}};Ve();St();Gt();var Kde=et(Xo()),GE=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=de.Rest()}static{this.paths=[["unlink"]]}static{this.usage=ot.Usage({description:"disconnect the local project from another one",details:` - This command will remove any resolutions in the project-level manifest that would have been added via a yarn link with similar arguments. - `,examples:[["Unregister a remote workspace in the current project","$0 unlink ~/ts-loader"],["Unregister all workspaces from a remote project in the current project","$0 unlink ~/jest --all"],["Unregister all previously linked workspaces","$0 unlink --all"],["Unregister all workspaces matching a glob","$0 unlink '@babel/*' 'pkg-{a,b}'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);let u=o.topLevelWorkspace,A=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:p,reference:h}of u.manifest.resolutions)h.startsWith("portal:")&&A.add(p.descriptor.fullName);if(this.leadingArguments.length>0)for(let p of this.leadingArguments){let h=V.resolve(this.context.cwd,Ae.toPortablePath(p));if(qe.isPathLike(p)){let E=await ze.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:w,workspace:D}=await Qt.find(E,h);if(!D)throw new or(w.cwd,h);if(this.all){for(let b of w.workspaces)b.manifest.name&&A.add(G.stringifyIdent(b.anchoredLocator));if(A.size===0)throw new it("No workspace found to be unlinked in the target project")}else{if(!D.manifest.name)throw new it("The target workspace doesn't have a name and thus cannot be unlinked");A.add(G.stringifyIdent(D.anchoredLocator))}}else{let E=[...u.manifest.resolutions.map(({pattern:w})=>w.descriptor.fullName)];for(let w of(0,Kde.default)(E,p))A.add(w)}}return u.manifest.resolutions=u.manifest.resolutions.filter(({pattern:p})=>!A.has(p.descriptor.fullName)),await o.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Ve();Ve();Ve();Gt();var Jde=et(Q2()),PH=et(Xo());il();var WE=class extends ut{constructor(){super(...arguments);this.interactive=de.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.fixed=de.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=de.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=de.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=de.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=de.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.mode=de.String("--mode",{description:"Change what artifacts installs generate",validator:js(yl)});this.patterns=de.Rest()}static{this.paths=[["up"]]}static{this.usage=ot.Usage({description:"upgrade dependencies across the project",details:"\n This command upgrades the packages matching the list of specified patterns to their latest available version across the whole project (regardless of whether they're part of `dependencies` or `devDependencies` - `peerDependencies` won't be affected). This is a project-wide command: all workspaces will be upgraded in the process.\n\n If `-R,--recursive` is set the command will change behavior and no other switch will be allowed. When operating under this mode `yarn up` will force all ranges matching the selected packages to be resolved again (often to the highest available versions) before being stored in the lockfile. It however won't touch your manifests anymore, so depending on your needs you might want to run both `yarn up` and `yarn up -R` to cover all bases.\n\n If `-i,--interactive` is set (or if the `preferInteractive` settings is toggled on) the command will offer various choices, depending on the detected upgrade paths. Some upgrades require this flag in order to resolve ambiguities.\n\n The, `-C,--caret`, `-E,--exact` and `-T,--tilde` options have the same meaning as in the `add` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n Generally you can see `yarn up` as a counterpart to what was `yarn upgrade --latest` in Yarn 1 (ie it ignores the ranges previously listed in your manifests), but unlike `yarn upgrade` which only upgraded dependencies in the current workspace, `yarn up` will upgrade all workspaces at the same time.\n\n This command accepts glob patterns as arguments (if valid Descriptors and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n **Note:** The ranges have to be static, only the package scopes and names can contain glob patterns.\n ",examples:[["Upgrade all instances of lodash to the latest release","$0 up lodash"],["Upgrade all instances of lodash to the latest release, but ask confirmation for each","$0 up lodash -i"],["Upgrade all instances of lodash to 1.2.3","$0 up lodash@1.2.3"],["Upgrade all instances of packages with the `@babel` scope to the latest release","$0 up '@babel/*'"],["Upgrade all instances of packages containing the word `jest` to the latest release","$0 up '*jest*'"],["Upgrade all instances of packages with the `@babel` scope to 7.0.0","$0 up '@babel/*@7.0.0'"]]})}static{this.schema=[Sw("recursive",Vu.Forbids,["interactive","exact","tilde","caret"],{ignore:[void 0,!1]})]}async execute(){return this.recursive?await this.executeUpRecursive():await this.executeUpClassic()}async executeUpRecursive(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=[...o.storedDescriptors.values()],A=u.map(E=>G.stringifyIdent(E)),p=new Set;for(let E of this.patterns){if(G.parseDescriptor(E).range!=="unknown")throw new it("Ranges aren't allowed when using --recursive");for(let w of(0,PH.default)(A,E)){let D=G.parseIdent(w);p.add(D.identHash)}}let h=u.filter(E=>p.has(E.identHash));for(let E of h)o.storedDescriptors.delete(E.descriptorHash),o.storedResolutions.delete(E.descriptorHash);return await o.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}async executeUpClassic(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=this.fixed,A=r.isInteractive({interactive:this.interactive,stdout:this.context.stdout}),p=R2(this,o),h=A?["keep","reuse","project","latest"]:["project","latest"],E=[],w=[];for(let N of this.patterns){let U=!1,J=G.parseDescriptor(N),te=G.stringifyIdent(J);for(let le of o.workspaces)for(let ce of["dependencies","devDependencies"]){let Ie=[...le.manifest.getForScope(ce).values()].map(De=>G.stringifyIdent(De)),he=te==="*"?Ie:(0,PH.default)(Ie,te);for(let De of he){let Ee=G.parseIdent(De),g=le.manifest[ce].get(Ee.identHash);if(typeof g>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let me=G.makeDescriptor(Ee,J.range);E.push(Promise.resolve().then(async()=>[le,ce,g,await T2(me,{project:o,workspace:le,cache:n,target:ce,fixed:u,modifier:p,strategies:h})])),U=!0}}U||w.push(N)}if(w.length>1)throw new it(`Patterns ${pe.prettyList(r,w,pe.Type.CODE)} don't match any packages referenced by any workspace`);if(w.length>0)throw new it(`Pattern ${pe.prettyList(r,w,pe.Type.CODE)} doesn't match any packages referenced by any workspace`);let D=await Promise.all(E),b=await pA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async N=>{for(let[,,U,{suggestions:J,rejections:te}]of D){let le=J.filter(ce=>ce.descriptor!==null);if(le.length===0){let[ce]=te;if(typeof ce>"u")throw new Error("Assertion failed: Expected an error to have been set");let ue=this.cli.error(ce);o.configuration.get("enableNetwork")?N.reportError(27,`${G.prettyDescriptor(r,U)} can't be resolved to a satisfying range - -${ue}`):N.reportError(27,`${G.prettyDescriptor(r,U)} can't be resolved to a satisfying range (note: network resolution has been disabled) - -${ue}`)}else le.length>1&&!A&&N.reportError(27,`${G.prettyDescriptor(r,U)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(b.hasErrors())return b.exitCode();let C=!1,T=[];for(let[N,U,,{suggestions:J}]of D){let te,le=J.filter(he=>he.descriptor!==null),ce=le[0].descriptor,ue=le.every(he=>G.areDescriptorsEqual(he.descriptor,ce));le.length===1||ue?te=ce:(C=!0,{answer:te}=await(0,Jde.prompt)({type:"select",name:"answer",message:`Which range do you want to use in ${G.prettyWorkspace(r,N)} \u276F ${U}?`,choices:J.map(({descriptor:he,name:De,reason:Ee})=>he?{name:De,hint:Ee,descriptor:he}:{name:De,hint:Ee,disabled:!0}),onCancel:()=>process.exit(130),result(he){return this.find(he,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let Ie=N.manifest[U].get(te.identHash);if(typeof Ie>"u")throw new Error("Assertion failed: This descriptor should have a matching entry");if(Ie.descriptorHash!==te.descriptorHash)N.manifest[U].set(te.identHash,te),T.push([N,U,Ie,te]);else{let he=r.makeResolver(),De={project:o,resolver:he},Ee=r.normalizeDependency(Ie),g=he.bindDescriptor(Ee,N.anchoredLocator,De);o.forgetResolution(g)}}return await r.triggerMultipleHooks(N=>N.afterWorkspaceDependencyReplacement,T),C&&this.context.stdout.write(` -`),await o.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}};Ve();Ve();Ve();Gt();var YE=class extends ut{constructor(){super(...arguments);this.recursive=de.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=de.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=de.String()}static{this.paths=[["why"]]}static{this.usage=ot.Usage({description:"display the reason why a package is needed",details:` - This command prints the exact reasons why a package appears in the dependency tree. - - If \`-R,--recursive\` is set, the listing will go in depth and will list, for each workspaces, what are all the paths that lead to the dependency. Note that the display is somewhat optimized in that it will not print the package listing twice for a single package, so if you see a leaf named "Foo" when looking for "Bar", it means that "Foo" already got printed higher in the tree. - `,examples:[["Explain why lodash is used in your project","$0 why lodash"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState();let n=G.parseIdent(this.package).identHash,u=this.recursive?Z0t(o,n,{configuration:r,peers:this.peers}):X0t(o,n,{configuration:r,peers:this.peers});As.emitTree(u,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1})}};function X0t(t,e,{configuration:r,peers:o}){let a=qe.sortMap(t.storedPackages.values(),A=>G.stringifyLocator(A)),n={},u={children:n};for(let A of a){let p={};for(let E of A.dependencies.values()){if(!o&&A.peerDependencies.has(E.identHash))continue;let w=t.storedResolutions.get(E.descriptorHash);if(!w)throw new Error("Assertion failed: The resolution should have been registered");let D=t.storedPackages.get(w);if(!D)throw new Error("Assertion failed: The package should have been registered");if(D.identHash!==e)continue;{let C=G.stringifyLocator(A);n[C]={value:[A,pe.Type.LOCATOR],children:p}}let b=G.stringifyLocator(D);p[b]={value:[{descriptor:E,locator:D},pe.Type.DEPENDENT]}}}return u}function Z0t(t,e,{configuration:r,peers:o}){let a=qe.sortMap(t.workspaces,D=>G.stringifyLocator(D.anchoredLocator)),n=new Set,u=new Set,A=D=>{if(n.has(D.locatorHash))return u.has(D.locatorHash);if(n.add(D.locatorHash),D.identHash===e)return u.add(D.locatorHash),!0;let b=!1;D.identHash===e&&(b=!0);for(let C of D.dependencies.values()){if(!o&&D.peerDependencies.has(C.identHash))continue;let T=t.storedResolutions.get(C.descriptorHash);if(!T)throw new Error("Assertion failed: The resolution should have been registered");let N=t.storedPackages.get(T);if(!N)throw new Error("Assertion failed: The package should have been registered");A(N)&&(b=!0)}return b&&u.add(D.locatorHash),b};for(let D of a)A(D.anchoredPackage);let p=new Set,h={},E={children:h},w=(D,b,C)=>{if(!u.has(D.locatorHash))return;let T=C!==null?pe.tuple(pe.Type.DEPENDENT,{locator:D,descriptor:C}):pe.tuple(pe.Type.LOCATOR,D),N={},U={value:T,children:N},J=G.stringifyLocator(D);if(b[J]=U,!(C!==null&&t.tryWorkspaceByLocator(D))&&!p.has(D.locatorHash)){p.add(D.locatorHash);for(let te of D.dependencies.values()){if(!o&&D.peerDependencies.has(te.identHash))continue;let le=t.storedResolutions.get(te.descriptorHash);if(!le)throw new Error("Assertion failed: The resolution should have been registered");let ce=t.storedPackages.get(le);if(!ce)throw new Error("Assertion failed: The package should have been registered");w(ce,N,te)}}};for(let D of a)w(D.anchoredPackage,h,null);return E}Ve();var OH={};Vt(OH,{GitFetcher:()=>_2,GitResolver:()=>H2,default:()=>Egt,gitUtils:()=>ra});Ve();St();var ra={};Vt(ra,{TreeishProtocols:()=>U2,clone:()=>NH,fetchBase:()=>mme,fetchChangedFiles:()=>yme,fetchChangedWorkspaces:()=>mgt,fetchRoot:()=>dme,isGitUrl:()=>JE,lsRemote:()=>gme,normalizeLocator:()=>dgt,normalizeRepoUrl:()=>VE,resolveUrl:()=>LH,splitRepoUrl:()=>Rh,validateRepoUrl:()=>TH});Ve();St();Gt();var fme=et(cme()),pme=et(t3()),KE=et(ve("querystring")),FH=et(ni());function QH(t,e,r){let o=t.indexOf(r);return t.lastIndexOf(e,o>-1?o:1/0)}function ume(t){try{return new URL(t)}catch{return}}function hgt(t){let e=QH(t,"@","#"),r=QH(t,":","#");return r>e&&(t=`${t.slice(0,r)}/${t.slice(r+1)}`),QH(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`ssh://${t}`),t}function Ame(t){return ume(t)||ume(hgt(t))}function VE(t,{git:e=!1}={}){if(t=t.replace(/^git\+https:/,"https:"),t=t.replace(/^(?:github:|https:\/\/github\.com\/|git:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)(?:\.git)?(#.*)?$/,"https://github.com/$1/$2.git$3"),t=t.replace(/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/,"https://github.com/$1/$2.git#$3"),e){let r=Ame(t);r&&(t=r.href),t=t.replace(/^git\+([^:]+):/,"$1:")}return t}function hme(){return{...process.env,GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND||`${process.env.GIT_SSH||"ssh"} -o BatchMode=yes`}}var ggt=[/^ssh:/,/^git(?:\+[^:]+)?:/,/^(?:git\+)?https?:[^#]+\/[^#]+(?:\.git)(?:#.*)?$/,/^git@[^#]+\/[^#]+\.git(?:#.*)?$/,/^(?:github:|https:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z._0-9-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z._0-9-]+?)(?:\.git)?(?:#.*)?$/,/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/],U2=(a=>(a.Commit="commit",a.Head="head",a.Tag="tag",a.Semver="semver",a))(U2||{});function JE(t){return t?ggt.some(e=>!!t.match(e)):!1}function Rh(t){t=VE(t);let e=t.indexOf("#");if(e===-1)return{repo:t,treeish:{protocol:"head",request:"HEAD"},extra:{}};let r=t.slice(0,e),o=t.slice(e+1);if(o.match(/^[a-z]+=/)){let a=KE.default.parse(o);for(let[p,h]of Object.entries(a))if(typeof h!="string")throw new Error(`Assertion failed: The ${p} parameter must be a literal string`);let n=Object.values(U2).find(p=>Object.hasOwn(a,p)),[u,A]=typeof n<"u"?[n,a[n]]:["head","HEAD"];for(let p of Object.values(U2))delete a[p];return{repo:r,treeish:{protocol:u,request:A},extra:a}}else{let a=o.indexOf(":"),[n,u]=a===-1?[null,o]:[o.slice(0,a),o.slice(a+1)];return{repo:r,treeish:{protocol:n,request:u},extra:{}}}}function dgt(t){return G.makeLocator(t,VE(t.reference))}function TH(t,{configuration:e}){let r=VE(t,{git:!0});if(!on.getNetworkSettings(`https://${(0,fme.default)(r).resource}`,{configuration:e}).enableNetwork)throw new Jt(80,`Request to '${r}' has been blocked because of your configuration settings`);return r}async function gme(t,e){let r=TH(t,{configuration:e}),o=await RH("listing refs",["ls-remote",r],{cwd:e.startingCwd,env:hme()},{configuration:e,normalizedRepoUrl:r}),a=new Map,n=/^([a-f0-9]{40})\t([^\n]+)/gm,u;for(;(u=n.exec(o.stdout))!==null;)a.set(u[2],u[1]);return a}async function LH(t,e){let{repo:r,treeish:{protocol:o,request:a},extra:n}=Rh(t),u=await gme(r,e),A=(h,E)=>{switch(h){case"commit":{if(!E.match(/^[a-f0-9]{40}$/))throw new Error("Invalid commit hash");return KE.default.stringify({...n,commit:E})}case"head":{let w=u.get(E==="HEAD"?E:`refs/heads/${E}`);if(typeof w>"u")throw new Error(`Unknown head ("${E}")`);return KE.default.stringify({...n,commit:w})}case"tag":{let w=u.get(`refs/tags/${E}`);if(typeof w>"u")throw new Error(`Unknown tag ("${E}")`);return KE.default.stringify({...n,commit:w})}case"semver":{let w=Ur.validRange(E);if(!w)throw new Error(`Invalid range ("${E}")`);let D=new Map([...u.entries()].filter(([C])=>C.startsWith("refs/tags/")).map(([C,T])=>[FH.default.parse(C.slice(10)),T]).filter(C=>C[0]!==null)),b=FH.default.maxSatisfying([...D.keys()],w);if(b===null)throw new Error(`No matching range ("${E}")`);return KE.default.stringify({...n,commit:D.get(b)})}case null:{let w;if((w=p("commit",E))!==null||(w=p("tag",E))!==null||(w=p("head",E))!==null)return w;throw E.match(/^[a-f0-9]+$/)?new Error(`Couldn't resolve "${E}" as either a commit, a tag, or a head - if a commit, use the 40-characters commit hash`):new Error(`Couldn't resolve "${E}" as either a commit, a tag, or a head`)}default:throw new Error(`Invalid Git resolution protocol ("${h}")`)}},p=(h,E)=>{try{return A(h,E)}catch{return null}};return VE(`${r}#${A(o,a)}`)}async function NH(t,e){return await e.getLimit("cloneConcurrency")(async()=>{let{repo:r,treeish:{protocol:o,request:a}}=Rh(t);if(o!=="commit")throw new Error("Invalid treeish protocol when cloning");let n=TH(r,{configuration:e}),u=await ae.mktempPromise(),A={cwd:u,env:hme()};return await RH("cloning the repository",["clone","-c core.autocrlf=false",n,Ae.fromPortablePath(u)],A,{configuration:e,normalizedRepoUrl:n}),await RH("switching branch",["checkout",`${a}`],A,{configuration:e,normalizedRepoUrl:n}),u})}async function dme(t){let e,r=t;do{if(e=r,await ae.existsPromise(V.join(e,".git")))return e;r=V.dirname(e)}while(r!==e);return null}async function mme(t,{baseRefs:e}){if(e.length===0)throw new it("Can't run this command with zero base refs specified.");let r=[];for(let A of e){let{code:p}=await Hr.execvp("git",["merge-base",A,"HEAD"],{cwd:t});p===0&&r.push(A)}if(r.length===0)throw new it(`No ancestor could be found between any of HEAD and ${e.join(", ")}`);let{stdout:o}=await Hr.execvp("git",["merge-base","HEAD",...r],{cwd:t,strict:!0}),a=o.trim(),{stdout:n}=await Hr.execvp("git",["show","--quiet","--pretty=format:%s",a],{cwd:t,strict:!0}),u=n.trim();return{hash:a,title:u}}async function yme(t,{base:e,project:r}){let o=qe.buildIgnorePattern(r.configuration.get("changesetIgnorePatterns")),{stdout:a}=await Hr.execvp("git",["diff","--name-only",`${e}`],{cwd:t,strict:!0}),n=a.split(/\r\n|\r|\n/).filter(h=>h.length>0).map(h=>V.resolve(t,Ae.toPortablePath(h))),{stdout:u}=await Hr.execvp("git",["ls-files","--others","--exclude-standard"],{cwd:t,strict:!0}),A=u.split(/\r\n|\r|\n/).filter(h=>h.length>0).map(h=>V.resolve(t,Ae.toPortablePath(h))),p=[...new Set([...n,...A].sort())];return o?p.filter(h=>!V.relative(r.cwd,h).match(o)):p}async function mgt({ref:t,project:e}){if(e.configuration.projectCwd===null)throw new it("This command can only be run from within a Yarn project");let r=[V.resolve(e.cwd,mr.lockfile),V.resolve(e.cwd,e.configuration.get("cacheFolder")),V.resolve(e.cwd,e.configuration.get("installStatePath")),V.resolve(e.cwd,e.configuration.get("virtualFolder"))];await e.configuration.triggerHook(u=>u.populateYarnPaths,e,u=>{u!=null&&r.push(u)});let o=await dme(e.configuration.projectCwd);if(o==null)throw new it("This command can only be run on Git repositories");let a=await mme(o,{baseRefs:typeof t=="string"?[t]:e.configuration.get("changesetBaseRefs")}),n=await yme(o,{base:a.hash,project:e});return new Set(qe.mapAndFilter(n,u=>{let A=e.tryWorkspaceByFilePath(u);return A===null?qe.mapAndFilter.skip:r.some(p=>u.startsWith(p))?qe.mapAndFilter.skip:A}))}async function RH(t,e,r,{configuration:o,normalizedRepoUrl:a}){try{return await Hr.execvp("git",e,{...r,strict:!0})}catch(n){if(!(n instanceof Hr.ExecError))throw n;let u=n.reportExtra,A=n.stderr.toString();throw new Jt(1,`Failed ${t}`,p=>{p.reportError(1,` ${pe.prettyField(o,{label:"Repository URL",value:pe.tuple(pe.Type.URL,a)})}`);for(let h of A.matchAll(/^(.+?): (.*)$/gm)){let[,E,w]=h;E=E.toLowerCase();let D=E==="error"?"Error":`${(0,pme.default)(E)} Error`;p.reportError(1,` ${pe.prettyField(o,{label:D,value:pe.tuple(pe.Type.NO_HINT,w)})}`)}u?.(p)})}}var _2=class{supports(e,r){return JE(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,a=new Map(r.checksums);a.set(e.locatorHash,o);let n={...r,checksums:a},u=await this.downloadHosted(e,n);if(u!==null)return u;let[A,p,h]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote repository`),loader:()=>this.cloneFromRemote(e,n),...r.cacheOptions});return{packageFs:A,releaseFs:p,prefixPath:G.getIdentVendorPath(e),checksum:h}}async downloadHosted(e,r){return r.project.configuration.reduceHook(o=>o.fetchHostedRepository,null,e,r)}async cloneFromRemote(e,r){let o=Rh(e.reference),a=await NH(e.reference,r.project.configuration),n=V.resolve(a,o.extra.cwd??Bt.dot),u=V.join(n,"package.tgz");await hn.prepareExternalProject(n,u,{configuration:r.project.configuration,report:r.report,workspace:o.extra.workspace,locator:e});let A=await ae.readFilePromise(u);return await qe.releaseAfterUseAsync(async()=>await $i.convertToZip(A,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1}))}};Ve();Ve();var H2=class{supportsDescriptor(e,r){return JE(e.range)}supportsLocator(e,r){return JE(e.reference)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=await LH(e.range,o.project.configuration);return[G.makeLocator(e,a)]}async getSatisfying(e,r,o,a){let n=Rh(e.range);return{locators:o.filter(A=>{if(A.identHash!==e.identHash)return!1;let p=Rh(A.reference);return!(n.repo!==p.repo||n.treeish.protocol==="commit"&&n.treeish.request!==p.treeish.request)}),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await qe.releaseAfterUseAsync(async()=>await _t.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var ygt={configuration:{changesetBaseRefs:{description:"The base git refs that the current HEAD is compared against when detecting changes. Supports git branches, tags, and commits.",type:"STRING",isArray:!0,isNullable:!1,default:["master","origin/master","upstream/master","main","origin/main","upstream/main"]},changesetIgnorePatterns:{description:"Array of glob patterns; files matching them will be ignored when fetching the changed files",type:"STRING",default:[],isArray:!0},cloneConcurrency:{description:"Maximal number of concurrent clones",type:"NUMBER",default:2}},fetchers:[_2],resolvers:[H2]};var Egt=ygt;Gt();var zE=class extends ut{constructor(){super(...arguments);this.since=de.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.recursive=de.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.noPrivate=de.Boolean("--no-private",{description:"Exclude workspaces that have the private field set to true"});this.verbose=de.Boolean("-v,--verbose",!1,{description:"Also return the cross-dependencies between workspaces"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["workspaces","list"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"list all available workspaces",details:"\n This command will print the list of all workspaces in the project.\n\n - If `--since` is set, Yarn will only list workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--no-private` is set, Yarn will not list any workspaces that have the `private` field set to `true`.\n\n - If both the `-v,--verbose` and `--json` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd);return(await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{let u=this.since?await ra.fetchChangedWorkspaces({ref:this.since,project:o}):o.workspaces,A=new Set(u);if(this.recursive)for(let p of[...u].map(h=>h.getRecursiveWorkspaceDependents()))for(let h of p)A.add(h);for(let p of A){let{manifest:h}=p;if(h.private&&this.noPrivate)continue;let E;if(this.verbose){let w=new Set,D=new Set;for(let b of _t.hardDependencies)for(let[C,T]of h.getForScope(b)){let N=o.tryWorkspaceByDescriptor(T);N===null?o.workspacesByIdent.has(C)&&D.add(T):w.add(N)}E={workspaceDependencies:Array.from(w).map(b=>b.relativeCwd),mismatchedWorkspaceDependencies:Array.from(D).map(b=>G.stringifyDescriptor(b))}}n.reportInfo(null,`${p.relativeCwd}`),n.reportJson({location:p.relativeCwd,name:h.name?G.stringifyIdent(h.name):null,...E})}})).exitCode()}};Ve();Ve();Gt();var XE=class extends ut{constructor(){super(...arguments);this.workspaceName=de.String();this.commandName=de.String();this.args=de.Proxy()}static{this.paths=[["workspace"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"run a command within the specified workspace",details:` - This command will run a given sub-command on a single workspace. - `,examples:[["Add a package to a single workspace","yarn workspace components add -D react"],["Run build script on a single workspace","yarn workspace components run build"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);let n=o.workspaces,u=new Map(n.map(p=>[G.stringifyIdent(p.anchoredLocator),p])),A=u.get(this.workspaceName);if(A===void 0){let p=Array.from(u.keys()).sort();throw new it(`Workspace '${this.workspaceName}' not found. Did you mean any of the following: - - ${p.join(` - - `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:A.cwd})}};var Cgt={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:"BOOLEAN",default:Eme.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:"STRING",values:["^","~",""],default:"^"},preferReuse:{description:"If true, `yarn add` will attempt to reuse the most common dependency range in other workspaces.",type:"BOOLEAN",default:!1}},commands:[hE,gE,dE,mE,jE,TE,SE,zE,CE,IE,wE,BE,fE,pE,yE,EE,vE,DE,PE,xE,bE,kE,GE,QE,FE,NE,LE,OE,RE,ME,UE,_E,HE,qE,WE,YE,XE]},Igt=Cgt;var jH={};Vt(jH,{default:()=>Bgt});Ve();var kt={optional:!0},UH=[["@tailwindcss/aspect-ratio@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@tailwindcss/line-clamp@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@fullhuman/postcss-purgecss@3.1.3 || 3.1.3-alpha.0",{peerDependencies:{postcss:"^8.0.0"}}],["@samverschueren/stream-to-observable@<0.3.1",{peerDependenciesMeta:{rxjs:kt,zenObservable:kt}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:kt,zenObservable:kt}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{"supports-color":kt}}],["got@<11",{dependencies:{"@types/responselike":"^1.0.0","@types/keyv":"^3.1.1"}}],["cacheable-lookup@<4.1.2",{dependencies:{"@types/keyv":"^3.1.1"}}],["http-link-dataloader@*",{peerDependencies:{graphql:"^0.13.1 || ^14.0.0"}}],["typescript-language-server@*",{dependencies:{"vscode-jsonrpc":"^5.0.1","vscode-languageserver-protocol":"^3.15.0"}}],["postcss-syntax@*",{peerDependenciesMeta:{"postcss-html":kt,"postcss-jsx":kt,"postcss-less":kt,"postcss-markdown":kt,"postcss-scss":kt}}],["jss-plugin-rule-value-function@<=10.1.1",{dependencies:{"tiny-warning":"^1.0.2"}}],["ink-select-input@<4.1.0",{peerDependencies:{react:"^16.8.2"}}],["license-webpack-plugin@<2.3.18",{peerDependenciesMeta:{webpack:kt}}],["snowpack@>=3.3.0",{dependencies:{"node-gyp":"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:kt}}],["reactcss@*",{peerDependencies:{react:"*"}}],["react-color@<=2.19.0",{peerDependencies:{react:"*"}}],["gatsby-plugin-i18n@*",{dependencies:{ramda:"^0.24.1"}}],["useragent@^2.0.0",{dependencies:{request:"^2.88.0",yamlparser:"0.0.x",semver:"5.5.x"}}],["@apollographql/apollo-tools@<=0.5.2",{peerDependencies:{graphql:"^14.2.1 || ^15.0.0"}}],["material-table@^2.0.0",{dependencies:{"@babel/runtime":"^7.11.2"}}],["@babel/parser@*",{dependencies:{"@babel/types":"^7.8.3"}}],["fork-ts-checker-webpack-plugin@<=6.3.4",{peerDependencies:{eslint:">= 6",typescript:">= 2.7",webpack:">= 4","vue-template-compiler":"*"},peerDependenciesMeta:{eslint:kt,"vue-template-compiler":kt}}],["rc-animate@<=3.1.1",{peerDependencies:{react:">=16.9.0","react-dom":">=16.9.0"}}],["react-bootstrap-table2-paginator@*",{dependencies:{classnames:"^2.2.6"}}],["react-draggable@<=4.4.3",{peerDependencies:{react:">= 16.3.0","react-dom":">= 16.3.0"}}],["apollo-upload-client@<14",{peerDependencies:{graphql:"14 - 15"}}],["react-instantsearch-core@<=6.7.0",{peerDependencies:{algoliasearch:">= 3.1 < 5"}}],["react-instantsearch-dom@<=6.7.0",{dependencies:{"react-fast-compare":"^3.0.0"}}],["ws@<7.2.1",{peerDependencies:{bufferutil:"^4.0.1","utf-8-validate":"^5.0.2"},peerDependenciesMeta:{bufferutil:kt,"utf-8-validate":kt}}],["react-portal@<4.2.2",{peerDependencies:{"react-dom":"^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"}}],["react-scripts@<=4.0.1",{peerDependencies:{react:"*"}}],["testcafe@<=1.10.1",{dependencies:{"@babel/plugin-transform-for-of":"^7.12.1","@babel/runtime":"^7.12.5"}}],["testcafe-legacy-api@<=4.2.0",{dependencies:{"testcafe-hammerhead":"^17.0.1","read-file-relative":"^1.2.0"}}],["@google-cloud/firestore@<=4.9.3",{dependencies:{protobufjs:"^6.8.6"}}],["gatsby-source-apiserver@*",{dependencies:{"babel-polyfill":"^6.26.0"}}],["@webpack-cli/package-utils@<=1.0.1-alpha.4",{dependencies:{"cross-spawn":"^7.0.3"}}],["gatsby-remark-prismjs@<3.3.28",{dependencies:{lodash:"^4"}}],["gatsby-plugin-favicon@*",{peerDependencies:{webpack:"*"}}],["gatsby-plugin-sharp@<=4.6.0-next.3",{dependencies:{debug:"^4.3.1"}}],["gatsby-react-router-scroll@<=5.6.0-next.0",{dependencies:{"prop-types":"^15.7.2"}}],["@rebass/forms@*",{dependencies:{"@styled-system/should-forward-prop":"^5.0.0"},peerDependencies:{react:"^16.8.6"}}],["rebass@*",{peerDependencies:{react:"^16.8.6"}}],["@ant-design/react-slick@<=0.28.3",{peerDependencies:{react:">=16.0.0"}}],["mqtt@<4.2.7",{dependencies:{duplexify:"^4.1.1"}}],["vue-cli-plugin-vuetify@<=2.0.3",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":kt,"vuetify-loader":kt}}],["vue-cli-plugin-vuetify@<=2.0.4",{dependencies:{"null-loader":"^3.0.0"}}],["vue-cli-plugin-vuetify@>=2.4.3",{peerDependencies:{vue:"*"}}],["@vuetify/cli-plugin-utils@<=0.0.4",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":kt}}],["@vue/cli-plugin-typescript@<=5.0.0-alpha.0",{dependencies:{"babel-loader":"^8.1.0"}}],["@vue/cli-plugin-typescript@<=5.0.0-beta.0",{dependencies:{"@babel/core":"^7.12.16"},peerDependencies:{"vue-template-compiler":"^2.0.0"},peerDependenciesMeta:{"vue-template-compiler":kt}}],["cordova-ios@<=6.3.0",{dependencies:{underscore:"^1.9.2"}}],["cordova-lib@<=10.0.1",{dependencies:{underscore:"^1.9.2"}}],["git-node-fs@*",{peerDependencies:{"js-git":"^0.7.8"},peerDependenciesMeta:{"js-git":kt}}],["consolidate@<0.16.0",{peerDependencies:{mustache:"^3.0.0"},peerDependenciesMeta:{mustache:kt}}],["consolidate@<=0.16.0",{peerDependencies:{velocityjs:"^2.0.1",tinyliquid:"^0.2.34","liquid-node":"^3.0.1",jade:"^1.11.0","then-jade":"*",dust:"^0.3.0","dustjs-helpers":"^1.7.4","dustjs-linkedin":"^2.7.5",swig:"^1.4.2","swig-templates":"^2.0.3","razor-tmpl":"^1.3.1",atpl:">=0.7.6",liquor:"^0.0.5",twig:"^1.15.2",ejs:"^3.1.5",eco:"^1.1.0-rc-3",jazz:"^0.0.18",jqtpl:"~1.1.0",hamljs:"^0.6.2",hamlet:"^0.3.3",whiskers:"^0.4.0","haml-coffee":"^1.14.1","hogan.js":"^3.0.2",templayed:">=0.2.3",handlebars:"^4.7.6",underscore:"^1.11.0",lodash:"^4.17.20",pug:"^3.0.0","then-pug":"*",qejs:"^3.0.5",walrus:"^0.10.1",mustache:"^4.0.1",just:"^0.1.8",ect:"^0.5.9",mote:"^0.2.0",toffee:"^0.3.6",dot:"^1.1.3","bracket-template":"^1.1.5",ractive:"^1.3.12",nunjucks:"^3.2.2",htmling:"^0.0.8","babel-core":"^6.26.3",plates:"~0.4.11","react-dom":"^16.13.1",react:"^16.13.1","arc-templates":"^0.5.3",vash:"^0.13.0",slm:"^2.0.0",marko:"^3.14.4",teacup:"^2.0.0","coffee-script":"^1.12.7",squirrelly:"^5.1.0",twing:"^5.0.2"},peerDependenciesMeta:{velocityjs:kt,tinyliquid:kt,"liquid-node":kt,jade:kt,"then-jade":kt,dust:kt,"dustjs-helpers":kt,"dustjs-linkedin":kt,swig:kt,"swig-templates":kt,"razor-tmpl":kt,atpl:kt,liquor:kt,twig:kt,ejs:kt,eco:kt,jazz:kt,jqtpl:kt,hamljs:kt,hamlet:kt,whiskers:kt,"haml-coffee":kt,"hogan.js":kt,templayed:kt,handlebars:kt,underscore:kt,lodash:kt,pug:kt,"then-pug":kt,qejs:kt,walrus:kt,mustache:kt,just:kt,ect:kt,mote:kt,toffee:kt,dot:kt,"bracket-template":kt,ractive:kt,nunjucks:kt,htmling:kt,"babel-core":kt,plates:kt,"react-dom":kt,react:kt,"arc-templates":kt,vash:kt,slm:kt,marko:kt,teacup:kt,"coffee-script":kt,squirrelly:kt,twing:kt}}],["vue-loader@<=16.3.3",{peerDependencies:{"@vue/compiler-sfc":"^3.0.8",webpack:"^4.1.0 || ^5.0.0-0"},peerDependenciesMeta:{"@vue/compiler-sfc":kt}}],["vue-loader@^16.7.0",{peerDependencies:{"@vue/compiler-sfc":"^3.0.8",vue:"^3.2.13"},peerDependenciesMeta:{"@vue/compiler-sfc":kt,vue:kt}}],["scss-parser@<=1.0.5",{dependencies:{lodash:"^4.17.21"}}],["query-ast@<1.0.5",{dependencies:{lodash:"^4.17.21"}}],["redux-thunk@<=2.3.0",{peerDependencies:{redux:"^4.0.0"}}],["skypack@<=0.3.2",{dependencies:{tar:"^6.1.0"}}],["@npmcli/metavuln-calculator@<2.0.0",{dependencies:{"json-parse-even-better-errors":"^2.3.1"}}],["bin-links@<2.3.0",{dependencies:{"mkdirp-infer-owner":"^1.0.2"}}],["rollup-plugin-polyfill-node@<=0.8.0",{peerDependencies:{rollup:"^1.20.0 || ^2.0.0"}}],["snowpack@<3.8.6",{dependencies:{"magic-string":"^0.25.7"}}],["elm-webpack-loader@*",{dependencies:{temp:"^0.9.4"}}],["winston-transport@<=4.4.0",{dependencies:{logform:"^2.2.0"}}],["jest-vue-preprocessor@*",{dependencies:{"@babel/core":"7.8.7","@babel/template":"7.8.6"},peerDependencies:{pug:"^2.0.4"},peerDependenciesMeta:{pug:kt}}],["redux-persist@*",{peerDependencies:{react:">=16"},peerDependenciesMeta:{react:kt}}],["sodium@>=3",{dependencies:{"node-gyp":"^3.8.0"}}],["babel-plugin-graphql-tag@<=3.1.0",{peerDependencies:{graphql:"^14.0.0 || ^15.0.0"}}],["@playwright/test@<=1.14.1",{dependencies:{"jest-matcher-utils":"^26.4.2"}}],...["babel-plugin-remove-graphql-queries@<3.14.0-next.1","babel-preset-gatsby-package@<1.14.0-next.1","create-gatsby@<1.14.0-next.1","gatsby-admin@<0.24.0-next.1","gatsby-cli@<3.14.0-next.1","gatsby-core-utils@<2.14.0-next.1","gatsby-design-tokens@<3.14.0-next.1","gatsby-legacy-polyfills@<1.14.0-next.1","gatsby-plugin-benchmark-reporting@<1.14.0-next.1","gatsby-plugin-graphql-config@<0.23.0-next.1","gatsby-plugin-image@<1.14.0-next.1","gatsby-plugin-mdx@<2.14.0-next.1","gatsby-plugin-netlify-cms@<5.14.0-next.1","gatsby-plugin-no-sourcemaps@<3.14.0-next.1","gatsby-plugin-page-creator@<3.14.0-next.1","gatsby-plugin-preact@<5.14.0-next.1","gatsby-plugin-preload-fonts@<2.14.0-next.1","gatsby-plugin-schema-snapshot@<2.14.0-next.1","gatsby-plugin-styletron@<6.14.0-next.1","gatsby-plugin-subfont@<3.14.0-next.1","gatsby-plugin-utils@<1.14.0-next.1","gatsby-recipes@<0.25.0-next.1","gatsby-source-shopify@<5.6.0-next.1","gatsby-source-wikipedia@<3.14.0-next.1","gatsby-transformer-screenshot@<3.14.0-next.1","gatsby-worker@<0.5.0-next.1"].map(t=>[t,{dependencies:{"@babel/runtime":"^7.14.8"}}]),["gatsby-core-utils@<2.14.0-next.1",{dependencies:{got:"8.3.2"}}],["gatsby-plugin-gatsby-cloud@<=3.1.0-next.0",{dependencies:{"gatsby-core-utils":"^2.13.0-next.0"}}],["gatsby-plugin-gatsby-cloud@<=3.2.0-next.1",{peerDependencies:{webpack:"*"}}],["babel-plugin-remove-graphql-queries@<=3.14.0-next.1",{dependencies:{"gatsby-core-utils":"^2.8.0-next.1"}}],["gatsby-plugin-netlify@3.13.0-next.1",{dependencies:{"gatsby-core-utils":"^2.13.0-next.0"}}],["clipanion-v3-codemod@<=0.2.0",{peerDependencies:{jscodeshift:"^0.11.0"}}],["react-live@*",{peerDependencies:{"react-dom":"*",react:"*"}}],["webpack@<4.44.1",{peerDependenciesMeta:{"webpack-cli":kt,"webpack-command":kt}}],["webpack@<5.0.0-beta.23",{peerDependenciesMeta:{"webpack-cli":kt}}],["webpack-dev-server@<3.10.2",{peerDependenciesMeta:{"webpack-cli":kt}}],["@docusaurus/responsive-loader@<1.5.0",{peerDependenciesMeta:{sharp:kt,jimp:kt}}],["eslint-module-utils@*",{peerDependenciesMeta:{"eslint-import-resolver-node":kt,"eslint-import-resolver-typescript":kt,"eslint-import-resolver-webpack":kt,"@typescript-eslint/parser":kt}}],["eslint-plugin-import@*",{peerDependenciesMeta:{"@typescript-eslint/parser":kt}}],["critters-webpack-plugin@<3.0.2",{peerDependenciesMeta:{"html-webpack-plugin":kt}}],["terser@<=5.10.0",{dependencies:{acorn:"^8.5.0"}}],["babel-preset-react-app@10.0.x <10.0.2",{dependencies:{"@babel/plugin-proposal-private-property-in-object":"^7.16.7"}}],["eslint-config-react-app@*",{peerDependenciesMeta:{typescript:kt}}],["@vue/eslint-config-typescript@<11.0.0",{peerDependenciesMeta:{typescript:kt}}],["unplugin-vue2-script-setup@<0.9.1",{peerDependencies:{"@vue/composition-api":"^1.4.3","@vue/runtime-dom":"^3.2.26"}}],["@cypress/snapshot@*",{dependencies:{debug:"^3.2.7"}}],["auto-relay@<=0.14.0",{peerDependencies:{"reflect-metadata":"^0.1.13"}}],["vue-template-babel-compiler@<1.2.0",{peerDependencies:{"vue-template-compiler":"^2.6.0"}}],["@parcel/transformer-image@<2.5.0",{peerDependencies:{"@parcel/core":"*"}}],["@parcel/transformer-js@<2.5.0",{peerDependencies:{"@parcel/core":"*"}}],["parcel@*",{peerDependenciesMeta:{"@parcel/core":kt}}],["react-scripts@*",{peerDependencies:{eslint:"*"}}],["focus-trap-react@^8.0.0",{dependencies:{tabbable:"^5.3.2"}}],["react-rnd@<10.3.7",{peerDependencies:{react:">=16.3.0","react-dom":">=16.3.0"}}],["connect-mongo@<5.0.0",{peerDependencies:{"express-session":"^1.17.1"}}],["vue-i18n@<9",{peerDependencies:{vue:"^2"}}],["vue-router@<4",{peerDependencies:{vue:"^2"}}],["unified@<10",{dependencies:{"@types/unist":"^2.0.0"}}],["react-github-btn@<=1.3.0",{peerDependencies:{react:">=16.3.0"}}],["react-dev-utils@*",{peerDependencies:{typescript:">=2.7",webpack:">=4"},peerDependenciesMeta:{typescript:kt}}],["@asyncapi/react-component@<=1.0.0-next.39",{peerDependencies:{react:">=16.8.0","react-dom":">=16.8.0"}}],["xo@*",{peerDependencies:{webpack:">=1.11.0"},peerDependenciesMeta:{webpack:kt}}],["babel-plugin-remove-graphql-queries@<=4.20.0-next.0",{dependencies:{"@babel/types":"^7.15.4"}}],["gatsby-plugin-page-creator@<=4.20.0-next.1",{dependencies:{"fs-extra":"^10.1.0"}}],["gatsby-plugin-utils@<=3.14.0-next.1",{dependencies:{fastq:"^1.13.0"},peerDependencies:{graphql:"^15.0.0"}}],["gatsby-plugin-mdx@<3.1.0-next.1",{dependencies:{mkdirp:"^1.0.4"}}],["gatsby-plugin-mdx@^2",{peerDependencies:{gatsby:"^3.0.0-next"}}],["fdir@<=5.2.0",{peerDependencies:{picomatch:"2.x"},peerDependenciesMeta:{picomatch:kt}}],["babel-plugin-transform-typescript-metadata@<=0.3.2",{peerDependencies:{"@babel/core":"^7","@babel/traverse":"^7"},peerDependenciesMeta:{"@babel/traverse":kt}}],["graphql-compose@>=9.0.10",{peerDependencies:{graphql:"^14.2.0 || ^15.0.0 || ^16.0.0"}}],["vite-plugin-vuetify@<=1.0.2",{peerDependencies:{vue:"^3.0.0"}}],["webpack-plugin-vuetify@<=2.0.1",{peerDependencies:{vue:"^3.2.6"}}],["eslint-import-resolver-vite@<2.0.1",{dependencies:{debug:"^4.3.4",resolve:"^1.22.8"}}],["notistack@^3.0.0",{dependencies:{csstype:"^3.0.10"}}]];var _H;function Cme(){return typeof _H>"u"&&(_H=ve("zlib").brotliDecompressSync(Buffer.from("G7weAByFTVk3Vs7UfHhq4yykgEM7pbW7TI43SG2S5tvGrwHBAzdz+s/npQ6tgEvobvxisrPIadkXeUAJotBn5bDZ5kAhcRqsIHe3F75Walet5hNalwgFDtxb0BiDUjiUQkjG0yW2hto9HPgiCkm316d6bC0kST72YN7D7rfkhCE9x4J0XwB0yavalxpUu2t9xszHrmtwalOxT7VslsxWcB1qpqZwERUra4psWhTV8BgwWeizurec82Caf1ABL11YMfbf8FJ9JBceZOkgmvrQPbC9DUldX/yMbmX06UQluCEjSwUoyO+EZPIjofr+/oAZUck2enraRD+oWLlnlYnj8xB+gwSo9lmmks4fXv574qSqcWA6z21uYkzMu3EWj+K23RxeQlLqiE35/rC8GcS4CGkKHKKq+zAIQwD9iRDNfiAqueLLpicFFrNsAI4zeTD/eO9MHcnRa5m8UT+M2+V+AkFST4BlKneiAQRSdST8KEAIyFlULt6wa9EBd0Ds28VmpaxquJdVt+nwdEs5xUskI13OVtFyY0UrQIRAlCuvvWivvlSKQfTO+2Q8OyUR1W5RvetaPz4jD27hdtwHFFA1Ptx6Ee/t2cY2rg2G46M1pNDRf2pWhvpy8pqMnuI3++4OF3+7OFIWXGjh+o7Nr2jNvbiYcQdQS1h903/jVFgOpA0yJ78z+x759bFA0rq+6aY5qPB4FzS3oYoLupDUhD9nDz6F6H7hpnlMf18KNKDu4IKjTWwrAnY6MFQw1W6ymOALHlFyCZmQhldg1MQHaMVVQTVgDC60TfaBqG++Y8PEoFhN/PBTZT175KNP/BlHDYGOOBmnBdzqJKplZ/ljiVG0ZBzfqeBRrrUkn6rA54462SgiliKoYVnbeptMdXNfAuaupIEi0bApF10TlgHfmEJAPUVidRVFyDupSem5po5vErPqWKhKbUIp0LozpYsIKK57dM/HKr+nguF+7924IIWMICkQ8JUigs9D+W+c4LnNoRtPPKNRUiCYmP+Jfo2lfKCKw8qpraEeWU3uiNRO6zcyKQoXPR5htmzzLznke7b4YbXW3I1lIRzmgG02Udb58U+7TpwyN7XymCgH+wuPDthZVQvRZuEP+SnLtMicz9m5zASWOBiAcLmkuFlTKuHspSIhCBD0yUPKcxu81A+4YD78rA2vtwsUEday9WNyrShyrl60rWmA+SmbYZkQOwFJWArxRYYc5jGhA5ikxYw1rx3ei4NmeX/lKiwpZ9Ln1tV2Ae7sArvxuVLbJjqJRjW1vFXAyHpvLG+8MJ6T2Ubx5M2KDa2SN6vuIGxJ9WQM9Mk3Q7aCNiZONXllhqq24DmoLbQfW2rYWsOgHWjtOmIQMyMKdiHZDjoyIq5+U700nZ6odJAoYXPQBvFNiQ78d5jaXliBqLTJEqUCwi+LiH2mx92EmNKDsJL74Z613+3lf20pxkV1+erOrjj8pW00vsPaahKUM+05ssd5uwM7K482KWEf3TCwlg/o3e5ngto7qSMz7YteIgCsF1UOcsLk7F7MxWbvrPMY473ew0G+noVL8EPbkmEMftMSeL6HFub/zy+2JQ==","base64")).toString()),_H}var HH;function Ime(){return typeof HH>"u"&&(HH=ve("zlib").brotliDecompressSync(Buffer.from("G8MSIIzURnVBnObTcvb3XE6v2S9Qgc2K801Oa5otNKEtK8BINZNcaQHy+9/vf/WXBimwutXC33P2DPc64pps5rz7NGGWaOKNSPL4Y2KRE8twut2lFOIN+OXPtRmPMRhMTILib2bEQx43az2I5d3YS8Roa5UZpF/ujHb3Djd3GDvYUfvFYSUQ39vb2cmifp/rgB4J/65JK3wRBTvMBoNBmn3mbXC63/gbBkW/2IRPri0O8bcsRBsmarF328pAln04nyJFkwUAvNu934supAqLtyerZZpJ8I8suJHhf/ocMV+scKwa8NOiDKIPXw6Ex/EEZD6TEGaW8N5zvNHYF10l6Lfooj7D5W2k3dgvQSbp2Wv8TGOayS978gxlOLVjTGXs66ozewbrjwElLtyrYNnWTfzzdEutgROUFPVMhnMoy8EjJLLlWwIEoySxliim9kYW30JUHiPVyjt0iAw/ZpPmCbUCltYPnq6ZNblIKhTNhqS/oqC9iya5sGKZTOVsTEg34n92uZTf2iPpcZih8rPW8CzA+adIGmyCPcKdLMsBLShd+zuEbTrqpwuh+DLmracZcjPC5Sdf5odDAhKpFuOsQS67RT+1VgWWygSv3YwxDnylc04/PYuaMeIzhBkLrvs7e/OUzRTF56MmfY6rI63QtEjEQzq637zQqJ39nNhu3NmoRRhW/086bHGBUtx0PE0j3aEGvkdh9WJC8y8j8mqqke9/dQ5la+Q3ba4RlhvTbnfQhPDDab3tUifkjKuOsp13mXEmO00Mu88F/M67R7LXfoFDFLNtgCSWjWX+3Jn1371pJTK9xPBiMJafvDjtFyAzu8rxeQ0TKMQXNPs5xxiBOd+BRJP8KP88XPtJIbZKh/cdW8KvBUkpqKpGoiIaA32c3/JnQr4efXt85mXvidOvn/eU3Pase1typLYBalJ14mCso9h79nuMOuCa/kZAOkJHmTjP5RM2WNoPasZUAnT1TAE/NH25hUxcQv6hQWR/m1PKk4ooXMcM4SR1iYU3fUohvqk4RY2hbmTVVIXv6TvqO+0doOjgeVFAcom+RlwJQmOVH7pr1Q9LoJT6n1DeQEB+NHygsATbIwTcOKZlJsY8G4+suX1uQLjUWwLjjs0mvSvZcLTpIGAekeR7GCgl8eo3ndAqEe2XCav4huliHjdbIPBsGJuPX7lrO9HX1UbXRH5opOe1x6JsOSgHZR+EaxuXVhpLLxm6jk1LJtZfHSc6BKPun3CpYYVMJGwEUyk8MTGG0XL5MfEwaXpnc9TKnBmlGn6nHiGREc3ysn47XIBDzA+YvFdjZzVIEDcKGpS6PbUJehFRjEne8D0lVU1XuRtlgszq6pTNlQ/3MzNOEgCWPyTct22V2mEi2krizn5VDo9B19/X2DB3hCGRMM7ONbtnAcIx/OWB1u5uPbW1gsH8irXxT/IzG0PoXWYjhbMsH3KTuoOl5o17PulcgvsfTSnKFM354GWI8luqZnrswWjiXy3G+Vbyo1KMopFmmvBwNELgaS8z8dNZchx/Cl/xjddxhMcyqtzFyONb2Zdu90NkI8pAeufe7YlXrp53v8Dj/l8vWeVspRKBGXScBBPI/HinSTGmLDOGGOCIyH0JFdOZx0gWsacNlQLJMIrBhqRxXxHF/5pseWwejlAAvZ3klZSDSYY8mkToaWejXhgNomeGtx1DTLEUFMRkgF5yFB22WYdJnaWN14r1YJj81hGi45+jrADS5nYRhCiSlCJJ1nL8pYX+HDSMhdTEWyRcgHVp/IsUIZYMfT+YYncUQPgcxNGCHfZ88vDdrcUuaGIl6zhAsiaq7R5dfqrqXH/JcBhfjT8D0azayIyEz75Nxp6YkcyDxlJq3EXnJUpqDohJJOysL1t1uNiHESlvsxPb5cpbW0+ICZqJmUZus1BMW0F5IVBODLIo2zHHjA0=","base64")).toString()),HH}var qH;function wme(){return typeof qH>"u"&&(qH=ve("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),qH}var Bme=new Map([[G.makeIdent(null,"fsevents").identHash,Cme],[G.makeIdent(null,"resolve").identHash,Ime],[G.makeIdent(null,"typescript").identHash,wme]]),wgt={hooks:{registerPackageExtensions:async(t,e)=>{for(let[r,o]of UH)e(G.parseDescriptor(r,!0),o)},getBuiltinPatch:async(t,e)=>{let r="compat/";if(!e.startsWith(r))return;let o=G.parseIdent(e.slice(r.length)),a=Bme.get(o.identHash)?.();return typeof a<"u"?a:null},reduceDependency:async(t,e,r,o)=>typeof Bme.get(t.identHash)>"u"?t:G.makeDescriptor(t,G.makeRange({protocol:"patch:",source:G.stringifyDescriptor(t),selector:`optional!builtin`,params:null}))}},Bgt=wgt;var a6={};Vt(a6,{ConstraintsCheckCommand:()=>sC,ConstraintsQueryCommand:()=>nC,ConstraintsSourceCommand:()=>iC,default:()=>zgt});Ve();Ve();j2();var $E=class{constructor(e){this.project=e}createEnvironment(){let e=new ZE(["cwd","ident"]),r=new ZE(["workspace","type","ident"]),o=new ZE(["ident"]),a={manifestUpdates:new Map,reportedErrors:new Map},n=new Map,u=new Map;for(let A of this.project.storedPackages.values()){let p=Array.from(A.peerDependencies.values(),h=>[G.stringifyIdent(h),h.range]);n.set(A.locatorHash,{workspace:null,ident:G.stringifyIdent(A),version:A.version,dependencies:new Map,peerDependencies:new Map(p.filter(([h])=>A.peerDependenciesMeta.get(h)?.optional!==!0)),optionalPeerDependencies:new Map(p.filter(([h])=>A.peerDependenciesMeta.get(h)?.optional===!0))})}for(let A of this.project.storedPackages.values()){let p=n.get(A.locatorHash);p.dependencies=new Map(Array.from(A.dependencies.values(),h=>{let E=this.project.storedResolutions.get(h.descriptorHash);if(typeof E>"u")throw new Error("Assertion failed: The resolution should have been registered");let w=n.get(E);if(typeof w>"u")throw new Error("Assertion failed: The package should have been registered");return[G.stringifyIdent(h),w]})),p.dependencies.delete(p.ident)}for(let A of this.project.workspaces){let p=G.stringifyIdent(A.anchoredLocator),h=A.manifest.exportTo({}),E=n.get(A.anchoredLocator.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");let w=(T,N,{caller:U=Xi.getCaller()}={})=>{let J=q2(T),te=qe.getMapWithDefault(a.manifestUpdates,A.cwd),le=qe.getMapWithDefault(te,J),ce=qe.getSetWithDefault(le,N);U!==null&&ce.add(U)},D=T=>w(T,void 0,{caller:Xi.getCaller()}),b=T=>{qe.getArrayWithDefault(a.reportedErrors,A.cwd).push(T)},C=e.insert({cwd:A.relativeCwd,ident:p,manifest:h,pkg:E,set:w,unset:D,error:b});u.set(A,C);for(let T of _t.allDependencies)for(let N of A.manifest[T].values()){let U=G.stringifyIdent(N),J=()=>{w([T,U],void 0,{caller:Xi.getCaller()})},te=ce=>{w([T,U],ce,{caller:Xi.getCaller()})},le=null;if(T!=="peerDependencies"&&(T!=="dependencies"||!A.manifest.devDependencies.has(N.identHash))){let ce=A.anchoredPackage.dependencies.get(N.identHash);if(ce){if(typeof ce>"u")throw new Error("Assertion failed: The dependency should have been registered");let ue=this.project.storedResolutions.get(ce.descriptorHash);if(typeof ue>"u")throw new Error("Assertion failed: The resolution should have been registered");let Ie=n.get(ue);if(typeof Ie>"u")throw new Error("Assertion failed: The package should have been registered");le=Ie}}r.insert({workspace:C,ident:U,range:N.range,type:T,resolution:le,update:te,delete:J,error:b})}}for(let A of this.project.storedPackages.values()){let p=this.project.tryWorkspaceByLocator(A);if(!p)continue;let h=u.get(p);if(typeof h>"u")throw new Error("Assertion failed: The workspace should have been registered");let E=n.get(A.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");E.workspace=h}return{workspaces:e,dependencies:r,packages:o,result:a}}async process(){let e=this.createEnvironment(),r={Yarn:{workspace:a=>e.workspaces.find(a)[0]??null,workspaces:a=>e.workspaces.find(a),dependency:a=>e.dependencies.find(a)[0]??null,dependencies:a=>e.dependencies.find(a),package:a=>e.packages.find(a)[0]??null,packages:a=>e.packages.find(a)}},o=await this.project.loadUserConfig();return o?.constraints?(await o.constraints(r),e.result):null}};Ve();Ve();Gt();var nC=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.query=de.String()}static{this.paths=[["constraints","query"]]}static{this.usage=ot.Usage({category:"Constraints-related commands",description:"query the constraints fact database",details:` - This command will output all matches to the given prolog query. - `,examples:[["List all dependencies throughout the workspace","yarn constraints query 'workspace_has_dependency(_, DependencyName, _, _).'"]]})}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(V2(),Y2)),o=await ze.find(this.context.cwd,this.context.plugins),{project:a}=await Qt.find(o,this.context.cwd),n=await r.find(a),u=this.query;return u.endsWith(".")||(u=`${u}.`),(await Lt.start({configuration:o,json:this.json,stdout:this.context.stdout},async p=>{for await(let h of n.query(u)){let E=Array.from(Object.entries(h)),w=E.length,D=E.reduce((b,[C])=>Math.max(b,C.length),0);for(let b=0;b(V2(),Y2)),o=await ze.find(this.context.cwd,this.context.plugins),{project:a}=await Qt.find(o,this.context.cwd),n=await r.find(a);this.context.stdout.write(this.verbose?n.fullSource:n.source)}};Ve();Ve();Gt();j2();var sC=class extends ut{constructor(){super(...arguments);this.fix=de.Boolean("--fix",!1,{description:"Attempt to automatically fix unambiguous issues, following a multi-pass process"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["constraints"]]}static{this.usage=ot.Usage({category:"Constraints-related commands",description:"check that the project constraints are met",details:` - This command will run constraints on your project and emit errors for each one that is found but isn't met. If any error is emitted the process will exit with a non-zero exit code. - - If the \`--fix\` flag is used, Yarn will attempt to automatically fix the issues the best it can, following a multi-pass process (with a maximum of 10 iterations). Some ambiguous patterns cannot be autofixed, in which case you'll have to manually specify the right resolution. - - For more information as to how to write constraints, please consult our dedicated page on our website: https://yarnpkg.com/features/constraints. - `,examples:[["Check that all constraints are satisfied","yarn constraints"],["Autofix all unmet constraints","yarn constraints --fix"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd);await o.restoreInstallState();let a=await o.loadUserConfig(),n;if(a?.constraints)n=new $E(o);else{let{Constraints:h}=await Promise.resolve().then(()=>(V2(),Y2));n=await h.find(o)}let u,A=!1,p=!1;for(let h=this.fix?10:1;h>0;--h){let E=await n.process();if(!E)break;let{changedWorkspaces:w,remainingErrors:D}=Kk(o,E,{fix:this.fix}),b=[];for(let[C,T]of w){let N=C.manifest.indent;C.manifest=new _t,C.manifest.indent=N,C.manifest.load(T),b.push(C.persistManifest())}if(await Promise.all(b),!(w.size>0&&h>1)){u=kme(D,{configuration:r}),A=!1,p=!0;for(let[,C]of D)for(let T of C)T.fixable?A=!0:p=!1}}if(u.children.length===0)return 0;if(A){let h=p?`Those errors can all be fixed by running ${pe.pretty(r,"yarn constraints --fix",pe.Type.CODE)}`:`Errors prefixed by '\u2699' can be fixed by running ${pe.pretty(r,"yarn constraints --fix",pe.Type.CODE)}`;await Lt.start({configuration:r,stdout:this.context.stdout,includeNames:!1,includeFooter:!1},async E=>{E.reportInfo(0,h),E.reportSeparator()})}return u.children=qe.sortMap(u.children,h=>h.value[1]),As.emitTree(u,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1}),1}};j2();var Jgt={configuration:{enableConstraintsChecks:{description:"If true, constraints will run during installs",type:"BOOLEAN",default:!1},constraintsPath:{description:"The path of the constraints file.",type:"ABSOLUTE_PATH",default:"./constraints.pro"}},commands:[nC,iC,sC],hooks:{async validateProjectAfterInstall(t,{reportError:e}){if(!t.configuration.get("enableConstraintsChecks"))return;let r=await t.loadUserConfig(),o;if(r?.constraints)o=new $E(t);else{let{Constraints:u}=await Promise.resolve().then(()=>(V2(),Y2));o=await u.find(t)}let a=await o.process();if(!a)return;let{remainingErrors:n}=Kk(t,a);if(n.size!==0)if(t.configuration.isCI)for(let[u,A]of n)for(let p of A)e(84,`${pe.pretty(t.configuration,u.anchoredLocator,pe.Type.IDENT)}: ${p.text}`);else e(84,`Constraint check failed; run ${pe.pretty(t.configuration,"yarn constraints",pe.Type.CODE)} for more details`)}}},zgt=Jgt;var l6={};Vt(l6,{CreateCommand:()=>oC,DlxCommand:()=>aC,default:()=>Zgt});Ve();Gt();var oC=class extends ut{constructor(){super(...arguments);this.pkg=de.String("-p,--package",{description:"The package to run the provided command from"});this.quiet=de.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=de.String();this.args=de.Proxy()}static{this.paths=[["create"]]}async execute(){let r=[];this.pkg&&r.push("--package",this.pkg),this.quiet&&r.push("--quiet");let o=this.command.replace(/^(@[^@/]+)(@|$)/,"$1/create$2"),a=G.parseDescriptor(o),n=a.name.match(/^create(-|$)/)?a:a.scope?G.makeIdent(a.scope,`create-${a.name}`):G.makeIdent(null,`create-${a.name}`),u=G.stringifyIdent(n);return a.range!=="unknown"&&(u+=`@${a.range}`),this.cli.run(["dlx",...r,u,...this.args])}};Ve();Ve();St();Gt();var aC=class extends ut{constructor(){super(...arguments);this.packages=de.Array("-p,--package",{description:"The package(s) to install before running the command"});this.quiet=de.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=de.String();this.args=de.Proxy()}static{this.paths=[["dlx"]]}static{this.usage=ot.Usage({description:"run a package in a temporary environment",details:"\n This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd.\n\n By default Yarn will download the package named `command`, but this can be changed through the use of the `-p,--package` flag which will instruct Yarn to still run the same command but from a different package.\n\n Using `yarn dlx` as a replacement of `yarn add` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through `dlx` - neither their name, nor their version).\n ",examples:[["Use create-react-app to create a new React app","yarn dlx create-react-app ./my-app"],["Install multiple packages for a single command",`yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`]]})}async execute(){return ze.telemetry=null,await ae.mktempPromise(async r=>{let o=V.join(r,`dlx-${process.pid}`);await ae.mkdirPromise(o),await ae.writeFilePromise(V.join(o,"package.json"),`{} -`),await ae.writeFilePromise(V.join(o,"yarn.lock"),"");let a=V.join(o,".yarnrc.yml"),n=await ze.findProjectCwd(this.context.cwd),A={enableGlobalCache:!(await ze.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),enableTelemetry:!1,logFilters:[{code:Ju(68),level:pe.LogLevel.Discard}]},p=n!==null?V.join(n,".yarnrc.yml"):null;p!==null&&ae.existsSync(p)?(await ae.copyFilePromise(p,a),await ze.updateConfiguration(o,N=>{let U=qe.toMerged(N,A);return Array.isArray(N.plugins)&&(U.plugins=N.plugins.map(J=>{let te=typeof J=="string"?J:J.path,le=Ae.isAbsolute(te)?te:Ae.resolve(Ae.fromPortablePath(n),te);return typeof J=="string"?le:{path:le,spec:J.spec}})),U})):await ae.writeJsonPromise(a,A);let h=this.packages??[this.command],E=G.parseDescriptor(this.command).name,w=await this.cli.run(["add","--fixed","--",...h],{cwd:o,quiet:this.quiet});if(w!==0)return w;this.quiet||this.context.stdout.write(` -`);let D=await ze.find(o,this.context.plugins),{project:b,workspace:C}=await Qt.find(D,o);if(C===null)throw new or(b.cwd,o);await b.restoreInstallState();let T=await hn.getWorkspaceAccessibleBinaries(C);return T.has(E)===!1&&T.size===1&&typeof this.packages>"u"&&(E=Array.from(T)[0][0]),await hn.executeWorkspaceAccessibleBinary(C,E,this.args,{packageAccessibleBinaries:T,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};var Xgt={commands:[oC,aC]},Zgt=Xgt;var A6={};Vt(A6,{ExecFetcher:()=>J2,ExecResolver:()=>z2,default:()=>tdt,execUtils:()=>Zk});Ve();Ve();St();var hA="exec:";var Zk={};Vt(Zk,{loadGeneratorFile:()=>K2,makeLocator:()=>u6,makeSpec:()=>rye,parseSpec:()=>c6});Ve();St();function c6(t){let{params:e,selector:r}=G.parseRange(t),o=Ae.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?G.parseLocator(e.locator):null,path:o}}function rye({parentLocator:t,path:e,generatorHash:r,protocol:o}){let a=t!==null?{locator:G.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return G.makeRange({protocol:o,source:e,selector:e,params:{...n,...a}})}function u6(t,{parentLocator:e,path:r,generatorHash:o,protocol:a}){return G.makeLocator(t,rye({parentLocator:e,path:r,generatorHash:o,protocol:a}))}async function K2(t,e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(t,{protocol:e}),n=V.isAbsolute(a)?{packageFs:new En(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(o,r),u=n.localPath?{packageFs:new En(Bt.root),prefixPath:V.relative(Bt.root,n.localPath)}:n;n!==u&&n.releaseFs&&n.releaseFs();let A=u.packageFs,p=V.join(u.prefixPath,a);return await A.readFilePromise(p,"utf8")}var J2=class{supports(e,r){return!!e.reference.startsWith(hA)}getLocalPath(e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(e.reference,{protocol:hA});if(V.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:V.resolve(n,a)}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:u}}async fetchFromDisk(e,r){let o=await K2(e.reference,hA,r);return ae.mktempPromise(async a=>{let n=V.join(a,"generator.js");return await ae.writeFilePromise(n,o),ae.mktempPromise(async u=>{if(await this.generatePackage(u,e,n,r),!ae.existsSync(V.join(u,"build")))throw new Error("The script should have generated a build directory");return await $i.makeArchiveFromDirectory(V.join(u,"build"),{prefixPath:G.getIdentVendorPath(e),compressionLevel:r.project.configuration.get("compressionLevel")})})})}async generatePackage(e,r,o,a){return await ae.mktempPromise(async n=>{let u=await hn.makeScriptEnv({project:a.project,binFolder:n}),A=V.join(e,"runtime.js");return await ae.mktempPromise(async p=>{let h=V.join(p,"buildfile.log"),E=V.join(e,"generator"),w=V.join(e,"build");await ae.mkdirPromise(E),await ae.mkdirPromise(w);let D={tempDir:Ae.fromPortablePath(E),buildDir:Ae.fromPortablePath(w),locator:G.stringifyLocator(r)};await ae.writeFilePromise(A,` - // Expose 'Module' as a global variable - Object.defineProperty(global, 'Module', { - get: () => require('module'), - configurable: true, - enumerable: false, - }); - - // Expose non-hidden built-in modules as global variables - for (const name of Module.builtinModules.filter((name) => name !== 'module' && !name.startsWith('_'))) { - Object.defineProperty(global, name, { - get: () => require(name), - configurable: true, - enumerable: false, - }); - } - - // Expose the 'execEnv' global variable - Object.defineProperty(global, 'execEnv', { - value: { - ...${JSON.stringify(D)}, - }, - enumerable: true, - }); - `);let b=u.NODE_OPTIONS||"",C=/\s*--require\s+\S*\.pnp\.c?js\s*/g;b=b.replace(C," ").trim(),u.NODE_OPTIONS=b;let{stdout:T,stderr:N}=a.project.configuration.getSubprocessStreams(h,{header:`# This file contains the result of Yarn generating a package (${G.stringifyLocator(r)}) -`,prefix:G.prettyLocator(a.project.configuration,r),report:a.report}),{code:U}=await Hr.pipevp(process.execPath,["--require",Ae.fromPortablePath(A),Ae.fromPortablePath(o),G.stringifyIdent(r)],{cwd:e,env:u,stdin:null,stdout:T,stderr:N});if(U!==0)throw ae.detachTemp(p),new Error(`Package generation failed (exit code ${U}, logs can be found here: ${pe.pretty(a.project.configuration,h,pe.Type.PATH)})`)})})}};Ve();Ve();var $gt=2,z2=class{supportsDescriptor(e,r){return!!e.range.startsWith(hA)}supportsLocator(e,r){return!!e.reference.startsWith(hA)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=c6(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let u=await K2(G.makeRange({protocol:hA,source:a,selector:a,params:{locator:G.stringifyLocator(n)}}),hA,o.fetchOptions),A=bn.makeHash(`${$gt}`,u).slice(0,6);return[u6(e,{parentLocator:n,path:a,generatorHash:A,protocol:hA})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await qe.releaseAfterUseAsync(async()=>await _t.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var edt={fetchers:[J2],resolvers:[z2]},tdt=edt;var p6={};Vt(p6,{FileFetcher:()=>eB,FileResolver:()=>tB,TarballFileFetcher:()=>rB,TarballFileResolver:()=>nB,default:()=>idt,fileUtils:()=>$g});Ve();St();var lC=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,X2=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,_i="file:";var $g={};Vt($g,{fetchArchiveFromLocator:()=>$2,makeArchiveFromLocator:()=>$k,makeBufferFromLocator:()=>f6,makeLocator:()=>cC,makeSpec:()=>nye,parseSpec:()=>Z2});Ve();St();function Z2(t){let{params:e,selector:r}=G.parseRange(t),o=Ae.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?G.parseLocator(e.locator):null,path:o}}function nye({parentLocator:t,path:e,hash:r,protocol:o}){let a=t!==null?{locator:G.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return G.makeRange({protocol:o,source:e,selector:e,params:{...n,...a}})}function cC(t,{parentLocator:e,path:r,hash:o,protocol:a}){return G.makeLocator(t,nye({parentLocator:e,path:r,hash:o,protocol:a}))}async function $2(t,e){let{parentLocator:r,path:o}=G.parseFileStyleRange(t.reference,{protocol:_i}),a=V.isAbsolute(o)?{packageFs:new En(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await e.fetcher.fetch(r,e),n=a.localPath?{packageFs:new En(Bt.root),prefixPath:V.relative(Bt.root,a.localPath)}:a;a!==n&&a.releaseFs&&a.releaseFs();let u=n.packageFs,A=V.join(n.prefixPath,o);return await qe.releaseAfterUseAsync(async()=>await u.readFilePromise(A),n.releaseFs)}async function $k(t,{protocol:e,fetchOptions:r,inMemory:o=!1}){let{parentLocator:a,path:n}=G.parseFileStyleRange(t.reference,{protocol:e}),u=V.isAbsolute(n)?{packageFs:new En(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(a,r),A=u.localPath?{packageFs:new En(Bt.root),prefixPath:V.relative(Bt.root,u.localPath)}:u;u!==A&&u.releaseFs&&u.releaseFs();let p=A.packageFs,h=V.join(A.prefixPath,n);return await qe.releaseAfterUseAsync(async()=>await $i.makeArchiveFromDirectory(h,{baseFs:p,prefixPath:G.getIdentVendorPath(t),compressionLevel:r.project.configuration.get("compressionLevel"),inMemory:o}),A.releaseFs)}async function f6(t,{protocol:e,fetchOptions:r}){return(await $k(t,{protocol:e,fetchOptions:r,inMemory:!0})).getBufferAndClose()}var eB=class{supports(e,r){return!!e.reference.startsWith(_i)}getLocalPath(e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(e.reference,{protocol:_i});if(V.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:V.resolve(n,a)}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:u}}async fetchFromDisk(e,r){return $k(e,{protocol:_i,fetchOptions:r})}};Ve();Ve();var rdt=2,tB=class{supportsDescriptor(e,r){return e.range.match(lC)?!0:!!e.range.startsWith(_i)}supportsLocator(e,r){return!!e.reference.startsWith(_i)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return lC.test(e.range)&&(e=G.makeDescriptor(e,`${_i}${e.range}`)),G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=Z2(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let u=await f6(G.makeLocator(e,G.makeRange({protocol:_i,source:a,selector:a,params:{locator:G.stringifyLocator(n)}})),{protocol:_i,fetchOptions:o.fetchOptions}),A=bn.makeHash(`${rdt}`,u).slice(0,6);return[cC(e,{parentLocator:n,path:a,hash:A,protocol:_i})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await qe.releaseAfterUseAsync(async()=>await _t.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};Ve();var rB=class{supports(e,r){return X2.test(e.reference)?!!e.reference.startsWith(_i):!1}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:u}}async fetchFromDisk(e,r){let o=await $2(e,r);return await $i.convertToZip(o,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}};Ve();Ve();Ve();var nB=class{supportsDescriptor(e,r){return X2.test(e.range)?!!(e.range.startsWith(_i)||lC.test(e.range)):!1}supportsLocator(e,r){return X2.test(e.reference)?!!e.reference.startsWith(_i):!1}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return lC.test(e.range)&&(e=G.makeDescriptor(e,`${_i}${e.range}`)),G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=Z2(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let u=cC(e,{parentLocator:n,path:a,hash:"",protocol:_i}),A=await $2(u,o.fetchOptions),p=bn.makeHash(A).slice(0,6);return[cC(e,{parentLocator:n,path:a,hash:p,protocol:_i})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await qe.releaseAfterUseAsync(async()=>await _t.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var ndt={fetchers:[rB,eB],resolvers:[nB,tB]},idt=ndt;var d6={};Vt(d6,{GithubFetcher:()=>iB,default:()=>odt,githubUtils:()=>eQ});Ve();St();var eQ={};Vt(eQ,{invalidGithubUrlMessage:()=>oye,isGithubUrl:()=>h6,parseGithubUrl:()=>g6});var iye=et(ve("querystring")),sye=[/^https?:\/\/(?:([^/]+?)@)?github.com\/([^/#]+)\/([^/#]+)\/tarball\/([^/#]+)(?:#(.*))?$/,/^https?:\/\/(?:([^/]+?)@)?github.com\/([^/#]+)\/([^/#]+?)(?:\.git)?(?:#(.*))?$/];function h6(t){return t?sye.some(e=>!!t.match(e)):!1}function g6(t){let e;for(let A of sye)if(e=t.match(A),e)break;if(!e)throw new Error(oye(t));let[,r,o,a,n="master"]=e,{commit:u}=iye.default.parse(n);return n=u||n.replace(/[^:]*:/,""),{auth:r,username:o,reponame:a,treeish:n}}function oye(t){return`Input cannot be parsed as a valid GitHub URL ('${t}').`}var iB=class{supports(e,r){return!!h6(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from GitHub`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let o=await on.get(this.getLocatorUrl(e,r),{configuration:r.project.configuration});return await ae.mktempPromise(async a=>{let n=new En(a);await $i.extractArchiveTo(o,n,{stripComponents:1});let u=ra.splitRepoUrl(e.reference),A=V.join(a,"package.tgz");await hn.prepareExternalProject(a,A,{configuration:r.project.configuration,report:r.report,workspace:u.extra.workspace,locator:e});let p=await ae.readFilePromise(A);return await $i.convertToZip(p,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})})}getLocatorUrl(e,r){let{auth:o,username:a,reponame:n,treeish:u}=g6(e.reference);return`https://${o?`${o}@`:""}github.com/${a}/${n}/archive/${u}.tar.gz`}};var sdt={hooks:{async fetchHostedRepository(t,e,r){if(t!==null)return t;let o=new iB;if(!o.supports(e,r))return null;try{return await o.fetch(e,r)}catch{return null}}}},odt=sdt;var m6={};Vt(m6,{TarballHttpFetcher:()=>oB,TarballHttpResolver:()=>aB,default:()=>ldt});Ve();function sB(t){let e;try{e=new URL(t)}catch{return!1}return!(e.protocol!=="http:"&&e.protocol!=="https:"||!e.pathname.match(/(\.tar\.gz|\.tgz|\/[^.]+)$/))}var oB=class{supports(e,r){return sB(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let o=await on.get(e.reference,{configuration:r.project.configuration});return await $i.convertToZip(o,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}};Ve();Ve();var aB=class{supportsDescriptor(e,r){return sB(e.range)}supportsLocator(e,r){return sB(e.reference)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){return[G.convertDescriptorToLocator(e)]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await qe.releaseAfterUseAsync(async()=>await _t.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var adt={fetchers:[oB],resolvers:[aB]},ldt=adt;var y6={};Vt(y6,{InitCommand:()=>uC,default:()=>udt});Ve();Ve();St();Gt();var uC=class extends ut{constructor(){super(...arguments);this.private=de.Boolean("-p,--private",!1,{description:"Initialize a private package"});this.workspace=de.Boolean("-w,--workspace",!1,{description:"Initialize a workspace root with a `packages/` directory"});this.install=de.String("-i,--install",!1,{tolerateBoolean:!0,description:"Initialize a package with a specific bundle that will be locked in the project"});this.name=de.String("-n,--name",{description:"Initialize a package with the given name"});this.initializer=de.String({required:!1});this.usev2=de.Boolean("-2",!1,{hidden:!0});this.yes=de.Boolean("-y,--yes",{hidden:!0})}static{this.paths=[["init"]]}static{this.usage=ot.Usage({description:"create a new package",details:"\n This command will setup a new package in your local directory.\n\n If the `-p,--private` or `-w,--workspace` options are set, the package will be private by default.\n\n If the `-w,--workspace` option is set, the package will be configured to accept a set of workspaces in the `packages/` directory.\n\n If the `-i,--install` option is given a value, Yarn will first download it using `yarn set version` and only then forward the init call to the newly downloaded bundle. Without arguments, the downloaded bundle will be `latest`.\n\n The initial settings of the manifest can be changed by using the `initScope` and `initFields` configuration values. Additionally, Yarn will generate an EditorConfig file whose rules can be altered via `initEditorConfig`, and will initialize a Git repository in the current directory.\n ",examples:[["Create a new package in the local directory","yarn init"],["Create a new private package in the local directory","yarn init -p"],["Create a new package and store the Yarn release inside","yarn init -i=latest"],["Create a new private package and defines it as a workspace root","yarn init -w"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=typeof this.install=="string"?this.install:this.usev2||this.install===!0?"latest":null;return o!==null?await this.executeProxy(r,o):await this.executeRegular(r)}async executeProxy(r,o){if(r.projectCwd!==null&&r.projectCwd!==this.context.cwd)throw new it("Cannot use the --install flag from within a project subdirectory");ae.existsSync(this.context.cwd)||await ae.mkdirPromise(this.context.cwd,{recursive:!0});let a=V.join(this.context.cwd,mr.lockfile);ae.existsSync(a)||await ae.writeFilePromise(a,"");let n=await this.cli.run(["set","version",o],{quiet:!0});if(n!==0)return n;let u=[];return this.private&&u.push("-p"),this.workspace&&u.push("-w"),this.name&&u.push(`-n=${this.name}`),this.yes&&u.push("-y"),await ae.mktempPromise(async A=>{let{code:p}=await Hr.pipevp("yarn",["init",...u],{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,env:await hn.makeScriptEnv({binFolder:A})});return p})}async executeRegular(r){let o=null;try{o=(await Qt.find(r,this.context.cwd)).project}catch{o=null}ae.existsSync(this.context.cwd)||await ae.mkdirPromise(this.context.cwd,{recursive:!0});let a=await _t.tryFind(this.context.cwd),n=a??new _t,u=Object.fromEntries(r.get("initFields").entries());n.load(u),n.name=n.name??G.makeIdent(r.get("initScope"),this.name??V.basename(this.context.cwd)),n.packageManager=nn&&qe.isTaggedYarnVersion(nn)?`yarn@${nn}`:null,(!a&&this.workspace||this.private)&&(n.private=!0),this.workspace&&n.workspaceDefinitions.length===0&&(await ae.mkdirPromise(V.join(this.context.cwd,"packages"),{recursive:!0}),n.workspaceDefinitions=[{pattern:"packages/*"}]);let A={};n.exportTo(A);let p=V.join(this.context.cwd,_t.fileName);await ae.changeFilePromise(p,`${JSON.stringify(A,null,2)} -`,{automaticNewlines:!0});let h=[p],E=V.join(this.context.cwd,"README.md");if(ae.existsSync(E)||(await ae.writeFilePromise(E,`# ${G.stringifyIdent(n.name)} -`),h.push(E)),!o||o.cwd===this.context.cwd){let w=V.join(this.context.cwd,mr.lockfile);ae.existsSync(w)||(await ae.writeFilePromise(w,""),h.push(w));let b=[".yarn/*","!.yarn/patches","!.yarn/plugins","!.yarn/releases","!.yarn/sdks","!.yarn/versions","","# Whether you use PnP or not, the node_modules folder is often used to store","# build artifacts that should be gitignored","node_modules","","# Swap the comments on the following lines if you wish to use zero-installs","# In that case, don't forget to run `yarn config set enableGlobalCache false`!","# Documentation here: https://yarnpkg.com/features/caching#zero-installs","","#!.yarn/cache",".pnp.*"].map(ce=>`${ce} -`).join(""),C=V.join(this.context.cwd,".gitignore");ae.existsSync(C)||(await ae.writeFilePromise(C,b),h.push(C));let N=["/.yarn/** linguist-vendored","/.yarn/releases/* binary","/.yarn/plugins/**/* binary","/.pnp.* binary linguist-generated"].map(ce=>`${ce} -`).join(""),U=V.join(this.context.cwd,".gitattributes");ae.existsSync(U)||(await ae.writeFilePromise(U,N),h.push(U));let J={"*":{charset:"utf-8",endOfLine:"lf",indentSize:2,indentStyle:"space",insertFinalNewline:!0}};qe.mergeIntoTarget(J,r.get("initEditorConfig"));let te=`root = true -`;for(let[ce,ue]of Object.entries(J)){te+=` -[${ce}] -`;for(let[Ie,he]of Object.entries(ue)){let De=Ie.replace(/[A-Z]/g,Ee=>`_${Ee.toLowerCase()}`);te+=`${De} = ${he} -`}}let le=V.join(this.context.cwd,".editorconfig");ae.existsSync(le)||(await ae.writeFilePromise(le,te),h.push(le)),await this.cli.run(["install"],{quiet:!0}),this.initializer&&(this.context.stdout.write(` -`),await this.cli.run(["dlx",this.initializer],{quiet:!0})),ae.existsSync(V.join(this.context.cwd,".git"))||(await Hr.execvp("git",["init"],{cwd:this.context.cwd}),await Hr.execvp("git",["add","--",...h],{cwd:this.context.cwd}),await Hr.execvp("git",["commit","--allow-empty","-m","First commit"],{cwd:this.context.cwd}))}}};var cdt={configuration:{initScope:{description:"Scope used when creating packages via the init command",type:"STRING",default:null},initFields:{description:"Additional fields to set when creating packages via the init command",type:"MAP",valueDefinition:{description:"",type:"ANY"}},initEditorConfig:{description:"Extra rules to define in the generator editorconfig",type:"MAP",valueDefinition:{description:"",type:"ANY"}}},commands:[uC]},udt=cdt;var mj={};Vt(mj,{SearchCommand:()=>xC,UpgradeInteractiveCommand:()=>bC,default:()=>UIt});Ve();var lye=et(ve("os"));function AC({stdout:t}){if(lye.default.endianness()==="BE")throw new Error("Interactive commands cannot be used on big-endian systems because ink depends on yoga-layout-prebuilt which only supports little-endian architectures");if(!t.isTTY)throw new Error("Interactive commands can only be used inside a TTY environment")}Gt();var CEe=et(N6()),O6={appId:"OFCNCOG2CU",apiKey:"6fe4476ee5a1832882e326b506d14126",indexName:"npm-search"},ayt=(0,CEe.default)(O6.appId,O6.apiKey).initIndex(O6.indexName),M6=async(t,e=0)=>await ayt.search(t,{analyticsTags:["yarn-plugin-interactive-tools"],attributesToRetrieve:["name","version","owner","repository","humanDownloadsLast30Days"],page:e,hitsPerPage:10});var sv=["regular","dev","peer"],xC=class extends ut{static{this.paths=[["search"]]}static{this.usage=ot.Usage({category:"Interactive commands",description:"open the search interface",details:` - This command opens a fullscreen terminal interface where you can search for and install packages from the npm registry. - `,examples:[["Open the search window","yarn search"]]})}async execute(){AC(this.context);let{Gem:e}=await Promise.resolve().then(()=>(UQ(),oj)),{ScrollableItems:r}=await Promise.resolve().then(()=>(jQ(),qQ)),{useKeypress:o}=await Promise.resolve().then(()=>(rv(),bwe)),{useMinistore:a}=await Promise.resolve().then(()=>(fj(),Aj)),{renderForm:n}=await Promise.resolve().then(()=>(VQ(),YQ)),{default:u}=await Promise.resolve().then(()=>et(Uwe())),{Box:A,Text:p}=await Promise.resolve().then(()=>et(ac())),{default:h,useEffect:E,useState:w}=await Promise.resolve().then(()=>et(ln())),D=await ze.find(this.context.cwd,this.context.plugins),b=()=>h.createElement(A,{flexDirection:"row"},h.createElement(A,{flexDirection:"column",width:48},h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to move between packages.")),h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select a package.")),h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," again to change the target."))),h.createElement(A,{flexDirection:"column"},h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to install the selected packages.")),h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to abort.")))),C=()=>h.createElement(h.Fragment,null,h.createElement(A,{width:15},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Owner")),h.createElement(A,{width:11},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Version")),h.createElement(A,{width:10},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Downloads"))),T=()=>h.createElement(A,{width:17},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Target")),N=({hit:he,active:De})=>{let[Ee,g]=a(he.name,null);o({active:De},(fe,ie)=>{if(ie.name!=="space")return;if(!Ee){g(sv[0]);return}let Z=sv.indexOf(Ee)+1;Z===sv.length?g(null):g(sv[Z])},[Ee,g]);let me=G.parseIdent(he.name),Ce=G.prettyIdent(D,me);return h.createElement(A,null,h.createElement(A,{width:45},h.createElement(p,{bold:!0,wrap:"wrap"},Ce)),h.createElement(A,{width:14,marginLeft:1},h.createElement(p,{bold:!0,wrap:"truncate"},he.owner.name)),h.createElement(A,{width:10,marginLeft:1},h.createElement(p,{italic:!0,wrap:"truncate"},he.version)),h.createElement(A,{width:16,marginLeft:1},h.createElement(p,null,he.humanDownloadsLast30Days)))},U=({name:he,active:De})=>{let[Ee]=a(he,null),g=G.parseIdent(he);return h.createElement(A,null,h.createElement(A,{width:47},h.createElement(p,{bold:!0}," - ",G.prettyIdent(D,g))),sv.map(me=>h.createElement(A,{key:me,width:14,marginLeft:1},h.createElement(p,null," ",h.createElement(e,{active:Ee===me})," ",h.createElement(p,{bold:!0},me)))))},J=()=>h.createElement(A,{marginTop:1},h.createElement(p,null,"Powered by Algolia.")),le=await n(({useSubmit:he})=>{let De=a();he(De);let Ee=Array.from(De.keys()).filter(q=>De.get(q)!==null),[g,me]=w(""),[Ce,fe]=w(0),[ie,Z]=w([]),Se=q=>{q.match(/\t| /)||me(q)},Re=async()=>{fe(0);let q=await M6(g);q.query===g&&Z(q.hits)},ht=async()=>{let q=await M6(g,Ce+1);q.query===g&&q.page-1===Ce&&(fe(q.page),Z([...ie,...q.hits]))};return E(()=>{g?Re():Z([])},[g]),h.createElement(A,{flexDirection:"column"},h.createElement(b,null),h.createElement(A,{flexDirection:"row",marginTop:1},h.createElement(p,{bold:!0},"Search: "),h.createElement(A,{width:41},h.createElement(u,{value:g,onChange:Se,placeholder:"i.e. babel, webpack, react...",showCursor:!1})),h.createElement(C,null)),ie.length?h.createElement(r,{radius:2,loop:!1,children:ie.map(q=>h.createElement(N,{key:q.name,hit:q,active:!1})),willReachEnd:ht}):h.createElement(p,{color:"gray"},"Start typing..."),h.createElement(A,{flexDirection:"row",marginTop:1},h.createElement(A,{width:49},h.createElement(p,{bold:!0},"Selected:")),h.createElement(T,null)),Ee.length?Ee.map(q=>h.createElement(U,{key:q,name:q,active:!1})):h.createElement(p,{color:"gray"},"No selected packages..."),h.createElement(J,null))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof le>"u")return 1;let ce=Array.from(le.keys()).filter(he=>le.get(he)==="regular"),ue=Array.from(le.keys()).filter(he=>le.get(he)==="dev"),Ie=Array.from(le.keys()).filter(he=>le.get(he)==="peer");return ce.length&&await this.cli.run(["add",...ce]),ue.length&&await this.cli.run(["add","--dev",...ue]),Ie&&await this.cli.run(["add","--peer",...Ie]),0}};Ve();Gt();n8();var Ywe=et(ni()),Wwe=/^((?:[\^~]|>=?)?)([0-9]+)(\.[0-9]+)(\.[0-9]+)((?:-\S+)?)$/;function Vwe(t,e){return t.length>0?[t.slice(0,e)].concat(Vwe(t.slice(e),e)):[]}var bC=class extends ut{static{this.paths=[["upgrade-interactive"]]}static{this.usage=ot.Usage({category:"Interactive commands",description:"open the upgrade interface",details:` - This command opens a fullscreen terminal interface where you can see any out of date packages used by your application, their status compared to the latest versions available on the remote registry, and select packages to upgrade. - `,examples:[["Open the upgrade window","yarn upgrade-interactive"]]})}async execute(){AC(this.context);let{ItemOptions:e}=await Promise.resolve().then(()=>(Gwe(),jwe)),{Pad:r}=await Promise.resolve().then(()=>(dj(),qwe)),{ScrollableItems:o}=await Promise.resolve().then(()=>(jQ(),qQ)),{useMinistore:a}=await Promise.resolve().then(()=>(fj(),Aj)),{renderForm:n}=await Promise.resolve().then(()=>(VQ(),YQ)),{Box:u,Text:A}=await Promise.resolve().then(()=>et(ac())),{default:p,useEffect:h,useRef:E,useState:w}=await Promise.resolve().then(()=>et(ln())),D=await ze.find(this.context.cwd,this.context.plugins),{project:b,workspace:C}=await Qt.find(D,this.context.cwd),T=await Wr.find(D);if(!C)throw new or(b.cwd,this.context.cwd);await b.restoreInstallState({restoreResolutions:!1});let N=this.context.stdout.rows-7,U=(me,Ce)=>{let fe=$pe(me,Ce),ie="";for(let Z of fe)Z.added?ie+=pe.pretty(D,Z.value,"green"):Z.removed||(ie+=Z.value);return ie},J=(me,Ce)=>{if(me===Ce)return Ce;let fe=G.parseRange(me),ie=G.parseRange(Ce),Z=fe.selector.match(Wwe),Se=ie.selector.match(Wwe);if(!Z||!Se)return U(me,Ce);let Re=["gray","red","yellow","green","magenta"],ht=null,q="";for(let nt=1;nt{let ie=await nu.fetchDescriptorFrom(me,fe,{project:b,cache:T,preserveModifier:Ce,workspace:C});return ie!==null?ie.range:me.range},le=async me=>{let Ce=Ywe.default.valid(me.range)?`^${me.range}`:me.range,[fe,ie]=await Promise.all([te(me,me.range,Ce).catch(()=>null),te(me,me.range,"latest").catch(()=>null)]),Z=[{value:null,label:me.range}];return fe&&fe!==me.range?Z.push({value:fe,label:J(me.range,fe)}):Z.push({value:null,label:""}),ie&&ie!==fe&&ie!==me.range?Z.push({value:ie,label:J(me.range,ie)}):Z.push({value:null,label:""}),Z},ce=()=>p.createElement(u,{flexDirection:"row"},p.createElement(u,{flexDirection:"column",width:49},p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},""),"/",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to select packages.")),p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},""),"/",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to select versions."))),p.createElement(u,{flexDirection:"column"},p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to install.")),p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to abort.")))),ue=()=>p.createElement(u,{flexDirection:"row",paddingTop:1,paddingBottom:1},p.createElement(u,{width:50},p.createElement(A,{bold:!0},p.createElement(A,{color:"greenBright"},"?")," Pick the packages you want to upgrade.")),p.createElement(u,{width:17},p.createElement(A,{bold:!0,underline:!0,color:"gray"},"Current")),p.createElement(u,{width:17},p.createElement(A,{bold:!0,underline:!0,color:"gray"},"Range")),p.createElement(u,{width:17},p.createElement(A,{bold:!0,underline:!0,color:"gray"},"Latest"))),Ie=({active:me,descriptor:Ce,suggestions:fe})=>{let[ie,Z]=a(Ce.descriptorHash,null),Se=G.stringifyIdent(Ce),Re=Math.max(0,45-Se.length);return p.createElement(p.Fragment,null,p.createElement(u,null,p.createElement(u,{width:45},p.createElement(A,{bold:!0},G.prettyIdent(D,Ce)),p.createElement(r,{active:me,length:Re})),p.createElement(e,{active:me,options:fe,value:ie,skewer:!0,onChange:Z,sizes:[17,17,17]})))},he=({dependencies:me})=>{let[Ce,fe]=w(me.map(()=>null)),ie=E(!0),Z=async Se=>{let Re=await le(Se);return Re.filter(ht=>ht.label!=="").length<=1?null:{descriptor:Se,suggestions:Re}};return h(()=>()=>{ie.current=!1},[]),h(()=>{let Se=Math.trunc(N*1.75),Re=me.slice(0,Se),ht=me.slice(Se),q=Vwe(ht,N),nt=Re.map(Z).reduce(async(Le,Te)=>{await Le;let ke=await Te;ke!==null&&ie.current&&fe(Ke=>{let xe=Ke.findIndex(He=>He===null),tt=[...Ke];return tt[xe]=ke,tt})},Promise.resolve());q.reduce((Le,Te)=>Promise.all(Te.map(ke=>Promise.resolve().then(()=>Z(ke)))).then(async ke=>{ke=ke.filter(Ke=>Ke!==null),await Le,ie.current&&fe(Ke=>{let xe=Ke.findIndex(tt=>tt===null);return Ke.slice(0,xe).concat(ke).concat(Ke.slice(xe+ke.length))})}),nt).then(()=>{ie.current&&fe(Le=>Le.filter(Te=>Te!==null))})},[]),Ce.length?p.createElement(o,{radius:N>>1,children:Ce.map((Se,Re)=>Se!==null?p.createElement(Ie,{key:Re,active:!1,descriptor:Se.descriptor,suggestions:Se.suggestions}):p.createElement(A,{key:Re},"Loading..."))}):p.createElement(A,null,"No upgrades found")},Ee=await n(({useSubmit:me})=>{me(a());let Ce=new Map;for(let ie of b.workspaces)for(let Z of["dependencies","devDependencies"])for(let Se of ie.manifest[Z].values())b.tryWorkspaceByDescriptor(Se)===null&&(Se.range.startsWith("link:")||Ce.set(Se.descriptorHash,Se));let fe=qe.sortMap(Ce.values(),ie=>G.stringifyDescriptor(ie));return p.createElement(u,{flexDirection:"column"},p.createElement(ce,null),p.createElement(ue,null),p.createElement(he,{dependencies:fe}))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof Ee>"u")return 1;let g=!1;for(let me of b.workspaces)for(let Ce of["dependencies","devDependencies"]){let fe=me.manifest[Ce];for(let ie of fe.values()){let Z=Ee.get(ie.descriptorHash);typeof Z<"u"&&Z!==null&&(fe.set(ie.identHash,G.makeDescriptor(ie,Z)),g=!0)}}return g?await b.installWithNewReport({quiet:this.context.quiet,stdout:this.context.stdout},{cache:T}):0}};var MIt={commands:[xC,bC]},UIt=MIt;var yj={};Vt(yj,{LinkFetcher:()=>av,LinkResolver:()=>lv,PortalFetcher:()=>cv,PortalResolver:()=>uv,default:()=>HIt});Ve();St();var Zf="portal:",$f="link:";var av=class{supports(e,r){return!!e.reference.startsWith($f)}getLocalPath(e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(e.reference,{protocol:$f});if(V.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:V.resolve(n,a)}async fetch(e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(e.reference,{protocol:$f}),n=V.isAbsolute(a)?{packageFs:new En(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(o,r),u=n.localPath?{packageFs:new En(Bt.root),prefixPath:V.relative(Bt.root,n.localPath),localPath:Bt.root}:n;n!==u&&n.releaseFs&&n.releaseFs();let A=u.packageFs,p=V.resolve(u.localPath??u.packageFs.getRealPath(),u.prefixPath,a);return n.localPath?{packageFs:new En(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot,discardFromLookup:!0,localPath:p}:{packageFs:new Gu(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot,discardFromLookup:!0}}};Ve();St();var lv=class{supportsDescriptor(e,r){return!!e.range.startsWith($f)}supportsLocator(e,r){return!!e.reference.startsWith($f)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=e.range.slice($f.length);return[G.makeLocator(e,`${$f}${Ae.toPortablePath(a)}`)]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){return{...e,version:"0.0.0",languageName:r.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:null,dependencies:new Map,peerDependencies:new Map,dependenciesMeta:new Map,peerDependenciesMeta:new Map,bin:new Map}}};Ve();St();var cv=class{supports(e,r){return!!e.reference.startsWith(Zf)}getLocalPath(e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(e.reference,{protocol:Zf});if(V.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:V.resolve(n,a)}async fetch(e,r){let{parentLocator:o,path:a}=G.parseFileStyleRange(e.reference,{protocol:Zf}),n=V.isAbsolute(a)?{packageFs:new En(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(o,r),u=n.localPath?{packageFs:new En(Bt.root),prefixPath:V.relative(Bt.root,n.localPath),localPath:Bt.root}:n;n!==u&&n.releaseFs&&n.releaseFs();let A=u.packageFs,p=V.resolve(u.localPath??u.packageFs.getRealPath(),u.prefixPath,a);return n.localPath?{packageFs:new En(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot,localPath:p}:{packageFs:new Gu(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot}}};Ve();Ve();St();var uv=class{supportsDescriptor(e,r){return!!e.range.startsWith(Zf)}supportsLocator(e,r){return!!e.reference.startsWith(Zf)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=e.range.slice(Zf.length);return[G.makeLocator(e,`${Zf}${Ae.toPortablePath(a)}`)]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await qe.releaseAfterUseAsync(async()=>await _t.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var _It={fetchers:[av,cv],resolvers:[lv,uv]},HIt=_It;var tG={};Vt(tG,{NodeModulesLinker:()=>Dv,NodeModulesMode:()=>Xj,PnpLooseLinker:()=>Sv,default:()=>n1t});St();Ve();St();St();var Cj=(t,e)=>`${t}@${e}`,Kwe=(t,e)=>{let r=e.indexOf("#"),o=r>=0?e.substring(r+1):e;return Cj(t,o)};var zwe=(t,e={})=>{let r=e.debugLevel||Number(process.env.NM_DEBUG_LEVEL||-1),o=e.check||r>=9,a=e.hoistingLimits||new Map,n={check:o,debugLevel:r,hoistingLimits:a,fastLookupPossible:!0},u;n.debugLevel>=0&&(u=Date.now());let A=KIt(t,n),p=!1,h=0;do{let E=Ij(A,[A],new Set([A.locator]),new Map,n);p=E.anotherRoundNeeded||E.isGraphChanged,n.fastLookupPossible=!1,h++}while(p);if(n.debugLevel>=0&&console.log(`hoist time: ${Date.now()-u}ms, rounds: ${h}`),n.debugLevel>=1){let E=Av(A);if(Ij(A,[A],new Set([A.locator]),new Map,n).isGraphChanged)throw new Error(`The hoisting result is not terminal, prev tree: -${E}, next tree: -${Av(A)}`);let D=Xwe(A);if(D)throw new Error(`${D}, after hoisting finished: -${Av(A)}`)}return n.debugLevel>=2&&console.log(Av(A)),JIt(A)},qIt=t=>{let e=t[t.length-1],r=new Map,o=new Set,a=n=>{if(!o.has(n)){o.add(n);for(let u of n.hoistedDependencies.values())r.set(u.name,u);for(let u of n.dependencies.values())n.peerNames.has(u.name)||a(u)}};return a(e),r},jIt=t=>{let e=t[t.length-1],r=new Map,o=new Set,a=new Set,n=(u,A)=>{if(o.has(u))return;o.add(u);for(let h of u.hoistedDependencies.values())if(!A.has(h.name)){let E;for(let w of t)E=w.dependencies.get(h.name),E&&r.set(E.name,E)}let p=new Set;for(let h of u.dependencies.values())p.add(h.name);for(let h of u.dependencies.values())u.peerNames.has(h.name)||n(h,p)};return n(e,a),r},Jwe=(t,e)=>{if(e.decoupled)return e;let{name:r,references:o,ident:a,locator:n,dependencies:u,originalDependencies:A,hoistedDependencies:p,peerNames:h,reasons:E,isHoistBorder:w,hoistPriority:D,dependencyKind:b,hoistedFrom:C,hoistedTo:T}=e,N={name:r,references:new Set(o),ident:a,locator:n,dependencies:new Map(u),originalDependencies:new Map(A),hoistedDependencies:new Map(p),peerNames:new Set(h),reasons:new Map(E),decoupled:!0,isHoistBorder:w,hoistPriority:D,dependencyKind:b,hoistedFrom:new Map(C),hoistedTo:new Map(T)},U=N.dependencies.get(r);return U&&U.ident==N.ident&&N.dependencies.set(r,N),t.dependencies.set(N.name,N),N},GIt=(t,e)=>{let r=new Map([[t.name,[t.ident]]]);for(let a of t.dependencies.values())t.peerNames.has(a.name)||r.set(a.name,[a.ident]);let o=Array.from(e.keys());o.sort((a,n)=>{let u=e.get(a),A=e.get(n);if(A.hoistPriority!==u.hoistPriority)return A.hoistPriority-u.hoistPriority;{let p=u.dependents.size+u.peerDependents.size;return A.dependents.size+A.peerDependents.size-p}});for(let a of o){let n=a.substring(0,a.indexOf("@",1)),u=a.substring(n.length+1);if(!t.peerNames.has(n)){let A=r.get(n);A||(A=[],r.set(n,A)),A.indexOf(u)<0&&A.push(u)}}return r},Ej=t=>{let e=new Set,r=(o,a=new Set)=>{if(!a.has(o)){a.add(o);for(let n of o.peerNames)if(!t.peerNames.has(n)){let u=t.dependencies.get(n);u&&!e.has(u)&&r(u,a)}e.add(o)}};for(let o of t.dependencies.values())t.peerNames.has(o.name)||r(o);return e},Ij=(t,e,r,o,a,n=new Set)=>{let u=e[e.length-1];if(n.has(u))return{anotherRoundNeeded:!1,isGraphChanged:!1};n.add(u);let A=zIt(u),p=GIt(u,A),h=t==u?new Map:a.fastLookupPossible?qIt(e):jIt(e),E,w=!1,D=!1,b=new Map(Array.from(p.entries()).map(([T,N])=>[T,N[0]])),C=new Map;do{let T=VIt(t,e,r,h,b,p,o,C,a);T.isGraphChanged&&(D=!0),T.anotherRoundNeeded&&(w=!0),E=!1;for(let[N,U]of p)U.length>1&&!u.dependencies.has(N)&&(b.delete(N),U.shift(),b.set(N,U[0]),E=!0)}while(E);for(let T of u.dependencies.values())if(!u.peerNames.has(T.name)&&!r.has(T.locator)){r.add(T.locator);let N=Ij(t,[...e,T],r,C,a);N.isGraphChanged&&(D=!0),N.anotherRoundNeeded&&(w=!0),r.delete(T.locator)}return{anotherRoundNeeded:w,isGraphChanged:D}},WIt=t=>{for(let[e,r]of t.dependencies)if(!t.peerNames.has(e)&&r.ident!==t.ident)return!0;return!1},YIt=(t,e,r,o,a,n,u,A,{outputReason:p,fastLookupPossible:h})=>{let E,w=null,D=new Set;p&&(E=`${Array.from(e).map(N=>zs(N)).join("\u2192")}`);let b=r[r.length-1],T=!(o.ident===b.ident);if(p&&!T&&(w="- self-reference"),T&&(T=o.dependencyKind!==1,p&&!T&&(w="- workspace")),T&&o.dependencyKind===2&&(T=!WIt(o),p&&!T&&(w="- external soft link with unhoisted dependencies")),T&&(T=!t.peerNames.has(o.name),p&&!T&&(w=`- cannot shadow peer: ${zs(t.originalDependencies.get(o.name).locator)} at ${E}`)),T){let N=!1,U=a.get(o.name);if(N=!U||U.ident===o.ident,p&&!N&&(w=`- filled by: ${zs(U.locator)} at ${E}`),N)for(let J=r.length-1;J>=1;J--){let le=r[J].dependencies.get(o.name);if(le&&le.ident!==o.ident){N=!1;let ce=A.get(b);ce||(ce=new Set,A.set(b,ce)),ce.add(o.name),p&&(w=`- filled by ${zs(le.locator)} at ${r.slice(0,J).map(ue=>zs(ue.locator)).join("\u2192")}`);break}}T=N}if(T&&(T=n.get(o.name)===o.ident,p&&!T&&(w=`- filled by: ${zs(u.get(o.name)[0])} at ${E}`)),T){let N=!0,U=new Set(o.peerNames);for(let J=r.length-1;J>=1;J--){let te=r[J];for(let le of U){if(te.peerNames.has(le)&&te.originalDependencies.has(le))continue;let ce=te.dependencies.get(le);ce&&t.dependencies.get(le)!==ce&&(J===r.length-1?D.add(ce):(D=null,N=!1,p&&(w=`- peer dependency ${zs(ce.locator)} from parent ${zs(te.locator)} was not hoisted to ${E}`))),U.delete(le)}if(!N)break}T=N}if(T&&!h)for(let N of o.hoistedDependencies.values()){let U=a.get(N.name)||t.dependencies.get(N.name);if(!U||N.ident!==U.ident){T=!1,p&&(w=`- previously hoisted dependency mismatch, needed: ${zs(N.locator)}, available: ${zs(U?.locator)}`);break}}return D!==null&&D.size>0?{isHoistable:2,dependsOn:D,reason:w}:{isHoistable:T?0:1,reason:w}},KQ=t=>`${t.name}@${t.locator}`,VIt=(t,e,r,o,a,n,u,A,p)=>{let h=e[e.length-1],E=new Set,w=!1,D=!1,b=(U,J,te,le,ce)=>{if(E.has(le))return;let ue=[...J,KQ(le)],Ie=[...te,KQ(le)],he=new Map,De=new Map;for(let fe of Ej(le)){let ie=YIt(h,r,[h,...U,le],fe,o,a,n,A,{outputReason:p.debugLevel>=2,fastLookupPossible:p.fastLookupPossible});if(De.set(fe,ie),ie.isHoistable===2)for(let Z of ie.dependsOn){let Se=he.get(Z.name)||new Set;Se.add(fe.name),he.set(Z.name,Se)}}let Ee=new Set,g=(fe,ie,Z)=>{if(!Ee.has(fe)){Ee.add(fe),De.set(fe,{isHoistable:1,reason:Z});for(let Se of he.get(fe.name)||[])g(le.dependencies.get(Se),ie,p.debugLevel>=2?`- peer dependency ${zs(fe.locator)} from parent ${zs(le.locator)} was not hoisted`:"")}};for(let[fe,ie]of De)ie.isHoistable===1&&g(fe,ie,ie.reason);let me=!1;for(let fe of De.keys())if(!Ee.has(fe)){D=!0;let ie=u.get(le);ie&&ie.has(fe.name)&&(w=!0),me=!0,le.dependencies.delete(fe.name),le.hoistedDependencies.set(fe.name,fe),le.reasons.delete(fe.name);let Z=h.dependencies.get(fe.name);if(p.debugLevel>=2){let Se=Array.from(J).concat([le.locator]).map(ht=>zs(ht)).join("\u2192"),Re=h.hoistedFrom.get(fe.name);Re||(Re=[],h.hoistedFrom.set(fe.name,Re)),Re.push(Se),le.hoistedTo.set(fe.name,Array.from(e).map(ht=>zs(ht.locator)).join("\u2192"))}if(!Z)h.ident!==fe.ident&&(h.dependencies.set(fe.name,fe),ce.add(fe));else for(let Se of fe.references)Z.references.add(Se)}if(le.dependencyKind===2&&me&&(w=!0),p.check){let fe=Xwe(t);if(fe)throw new Error(`${fe}, after hoisting dependencies of ${[h,...U,le].map(ie=>zs(ie.locator)).join("\u2192")}: -${Av(t)}`)}let Ce=Ej(le);for(let fe of Ce)if(Ee.has(fe)){let ie=De.get(fe);if((a.get(fe.name)===fe.ident||!le.reasons.has(fe.name))&&ie.isHoistable!==0&&le.reasons.set(fe.name,ie.reason),!fe.isHoistBorder&&Ie.indexOf(KQ(fe))<0){E.add(le);let Se=Jwe(le,fe);b([...U,le],ue,Ie,Se,T),E.delete(le)}}},C,T=new Set(Ej(h)),N=Array.from(e).map(U=>KQ(U));do{C=T,T=new Set;for(let U of C){if(U.locator===h.locator||U.isHoistBorder)continue;let J=Jwe(h,U);b([],Array.from(r),N,J,T)}}while(T.size>0);return{anotherRoundNeeded:w,isGraphChanged:D}},Xwe=t=>{let e=[],r=new Set,o=new Set,a=(n,u,A)=>{if(r.has(n)||(r.add(n),o.has(n)))return;let p=new Map(u);for(let h of n.dependencies.values())n.peerNames.has(h.name)||p.set(h.name,h);for(let h of n.originalDependencies.values()){let E=p.get(h.name),w=()=>`${Array.from(o).concat([n]).map(D=>zs(D.locator)).join("\u2192")}`;if(n.peerNames.has(h.name)){let D=u.get(h.name);(D!==E||!D||D.ident!==h.ident)&&e.push(`${w()} - broken peer promise: expected ${h.ident} but found ${D&&D.ident}`)}else{let D=A.hoistedFrom.get(n.name),b=n.hoistedTo.get(h.name),C=`${D?` hoisted from ${D.join(", ")}`:""}`,T=`${b?` hoisted to ${b}`:""}`,N=`${w()}${C}`;E?E.ident!==h.ident&&e.push(`${N} - broken require promise for ${h.name}${T}: expected ${h.ident}, but found: ${E.ident}`):e.push(`${N} - broken require promise: no required dependency ${h.name}${T} found`)}}o.add(n);for(let h of n.dependencies.values())n.peerNames.has(h.name)||a(h,p,n);o.delete(n)};return a(t,t.dependencies,t),e.join(` -`)},KIt=(t,e)=>{let{identName:r,name:o,reference:a,peerNames:n}=t,u={name:o,references:new Set([a]),locator:Cj(r,a),ident:Kwe(r,a),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(n),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistPriority:0,dependencyKind:1,hoistedFrom:new Map,hoistedTo:new Map},A=new Map([[t,u]]),p=(h,E)=>{let w=A.get(h),D=!!w;if(!w){let{name:b,identName:C,reference:T,peerNames:N,hoistPriority:U,dependencyKind:J}=h,te=e.hoistingLimits.get(E.locator);w={name:b,references:new Set([T]),locator:Cj(C,T),ident:Kwe(C,T),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(N),reasons:new Map,decoupled:!0,isHoistBorder:te?te.has(b):!1,hoistPriority:U||0,dependencyKind:J||0,hoistedFrom:new Map,hoistedTo:new Map},A.set(h,w)}if(E.dependencies.set(h.name,w),E.originalDependencies.set(h.name,w),D){let b=new Set,C=T=>{if(!b.has(T)){b.add(T),T.decoupled=!1;for(let N of T.dependencies.values())T.peerNames.has(N.name)||C(N)}};C(w)}else for(let b of h.dependencies)p(b,w)};for(let h of t.dependencies)p(h,u);return u},wj=t=>t.substring(0,t.indexOf("@",1)),JIt=t=>{let e={name:t.name,identName:wj(t.locator),references:new Set(t.references),dependencies:new Set},r=new Set([t]),o=(a,n,u)=>{let A=r.has(a),p;if(n===a)p=u;else{let{name:h,references:E,locator:w}=a;p={name:h,identName:wj(w),references:E,dependencies:new Set}}if(u.dependencies.add(p),!A){r.add(a);for(let h of a.dependencies.values())a.peerNames.has(h.name)||o(h,a,p);r.delete(a)}};for(let a of t.dependencies.values())o(a,t,e);return e},zIt=t=>{let e=new Map,r=new Set([t]),o=u=>`${u.name}@${u.ident}`,a=u=>{let A=o(u),p=e.get(A);return p||(p={dependents:new Set,peerDependents:new Set,hoistPriority:0},e.set(A,p)),p},n=(u,A)=>{let p=!!r.has(A);if(a(A).dependents.add(u.ident),!p){r.add(A);for(let E of A.dependencies.values()){let w=a(E);w.hoistPriority=Math.max(w.hoistPriority,E.hoistPriority),A.peerNames.has(E.name)?w.peerDependents.add(A.ident):n(A,E)}}};for(let u of t.dependencies.values())t.peerNames.has(u.name)||n(t,u);return e},zs=t=>{if(!t)return"none";let e=t.indexOf("@",1),r=t.substring(0,e);r.endsWith("$wsroot$")&&(r=`wh:${r.replace("$wsroot$","")}`);let o=t.substring(e+1);if(o==="workspace:.")return".";if(o){let a=(o.indexOf("#")>0?o.split("#")[1]:o).replace("npm:","");return o.startsWith("virtual")&&(r=`v:${r}`),a.startsWith("workspace")&&(r=`w:${r}`,a=""),`${r}${a?`@${a}`:""}`}else return`${r}`};var Av=t=>{let e=0,r=(a,n,u="")=>{if(e>5e4||n.has(a))return"";e++;let A=Array.from(a.dependencies.values()).sort((h,E)=>h.name===E.name?0:h.name>E.name?1:-1),p="";n.add(a);for(let h=0;h":"")+(D!==E.name?`a:${E.name}:`:"")+zs(E.locator)+(w?` ${w}`:"")} -`,p+=r(E,n,`${u}${h5e4?` -Tree is too large, part of the tree has been dunped -`:"")};var fv=(o=>(o.WORKSPACES="workspaces",o.DEPENDENCIES="dependencies",o.NONE="none",o))(fv||{}),Zwe="node_modules",jh="$wsroot$";var pv=(t,e)=>{let{packageTree:r,hoistingLimits:o,errors:a,preserveSymlinksRequired:n}=ZIt(t,e),u=null;if(a.length===0){let A=zwe(r,{hoistingLimits:o});u=ewt(t,A,e)}return{tree:u,errors:a,preserveSymlinksRequired:n}},yA=t=>`${t.name}@${t.reference}`,vj=t=>{let e=new Map;for(let[r,o]of t.entries())if(!o.dirList){let a=e.get(o.locator);a||(a={target:o.target,linkType:o.linkType,locations:[],aliases:o.aliases},e.set(o.locator,a)),a.locations.push(r)}for(let r of e.values())r.locations=r.locations.sort((o,a)=>{let n=o.split(V.delimiter).length,u=a.split(V.delimiter).length;return a===o?0:n!==u?u-n:a>o?1:-1});return e},$we=(t,e)=>{let r=G.isVirtualLocator(t)?G.devirtualizeLocator(t):t,o=G.isVirtualLocator(e)?G.devirtualizeLocator(e):e;return G.areLocatorsEqual(r,o)},Bj=(t,e,r,o)=>{if(t.linkType!=="SOFT")return!1;let a=Ae.toPortablePath(r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation);return V.contains(o,a)===null},XIt=t=>{let e=t.getPackageInformation(t.topLevel);if(e===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");if(t.findPackageLocator(e.packageLocation)===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let o=Ae.toPortablePath(e.packageLocation.slice(0,-1)),a=new Map,n={children:new Map},u=t.getDependencyTreeRoots(),A=new Map,p=new Set,h=(D,b)=>{let C=yA(D);if(p.has(C))return;p.add(C);let T=t.getPackageInformation(D);if(T){let N=b?yA(b):"";if(yA(D)!==N&&T.linkType==="SOFT"&&!D.reference.startsWith("link:")&&!Bj(T,D,t,o)){let U=e1e(T,D,t);(!A.get(U)||D.reference.startsWith("workspace:"))&&A.set(U,D)}for(let[U,J]of T.packageDependencies)J!==null&&(T.packagePeers.has(U)||h(t.getLocator(U,J),D))}};for(let D of u)h(D,null);let E=o.split(V.sep);for(let D of A.values()){let b=t.getPackageInformation(D),T=Ae.toPortablePath(b.packageLocation.slice(0,-1)).split(V.sep).slice(E.length),N=n;for(let U of T){let J=N.children.get(U);J||(J={children:new Map},N.children.set(U,J)),N=J}N.workspaceLocator=D}let w=(D,b)=>{if(D.workspaceLocator){let C=yA(b),T=a.get(C);T||(T=new Set,a.set(C,T)),T.add(D.workspaceLocator)}for(let C of D.children.values())w(C,D.workspaceLocator||b)};for(let D of n.children.values())w(D,n.workspaceLocator);return a},ZIt=(t,e)=>{let r=[],o=!1,a=new Map,n=XIt(t),u=t.getPackageInformation(t.topLevel);if(u===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let A=t.findPackageLocator(u.packageLocation);if(A===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let p=Ae.toPortablePath(u.packageLocation.slice(0,-1)),h={name:A.name,identName:A.name,reference:A.reference,peerNames:u.packagePeers,dependencies:new Set,dependencyKind:1},E=new Map,w=(b,C)=>`${yA(C)}:${b}`,D=(b,C,T,N,U,J,te,le)=>{let ce=w(b,T),ue=E.get(ce),Ie=!!ue;!Ie&&T.name===A.name&&T.reference===A.reference&&(ue=h,E.set(ce,h));let he=Bj(C,T,t,p);if(!ue){let fe=0;he?fe=2:C.linkType==="SOFT"&&T.name.endsWith(jh)&&(fe=1),ue={name:b,identName:T.name,reference:T.reference,dependencies:new Set,peerNames:fe===1?new Set:C.packagePeers,dependencyKind:fe},E.set(ce,ue)}let De;if(he?De=2:U.linkType==="SOFT"?De=1:De=0,ue.hoistPriority=Math.max(ue.hoistPriority||0,De),le&&!he){let fe=yA({name:N.identName,reference:N.reference}),ie=a.get(fe)||new Set;a.set(fe,ie),ie.add(ue.name)}let Ee=new Map(C.packageDependencies);if(e.project){let fe=e.project.workspacesByCwd.get(Ae.toPortablePath(C.packageLocation.slice(0,-1)));if(fe){let ie=new Set([...Array.from(fe.manifest.peerDependencies.values(),Z=>G.stringifyIdent(Z)),...Array.from(fe.manifest.peerDependenciesMeta.keys())]);for(let Z of ie)Ee.has(Z)||(Ee.set(Z,J.get(Z)||null),ue.peerNames.add(Z))}}let g=yA({name:T.name.replace(jh,""),reference:T.reference}),me=n.get(g);if(me)for(let fe of me)Ee.set(`${fe.name}${jh}`,fe.reference);(C!==U||C.linkType!=="SOFT"||!he&&(!e.selfReferencesByCwd||e.selfReferencesByCwd.get(te)))&&N.dependencies.add(ue);let Ce=T!==A&&C.linkType==="SOFT"&&!T.name.endsWith(jh)&&!he;if(!Ie&&!Ce){let fe=new Map;for(let[ie,Z]of Ee)if(Z!==null){let Se=t.getLocator(ie,Z),Re=t.getLocator(ie.replace(jh,""),Z),ht=t.getPackageInformation(Re);if(ht===null)throw new Error("Assertion failed: Expected the package to have been registered");let q=Bj(ht,Se,t,p);if(e.validateExternalSoftLinks&&e.project&&q){ht.packageDependencies.size>0&&(o=!0);for(let[Ke,xe]of ht.packageDependencies)if(xe!==null){let tt=G.parseLocator(Array.isArray(xe)?`${xe[0]}@${xe[1]}`:`${Ke}@${xe}`);if(yA(tt)!==yA(Se)){let He=Ee.get(Ke);if(He){let x=G.parseLocator(Array.isArray(He)?`${He[0]}@${He[1]}`:`${Ke}@${He}`);$we(x,tt)||r.push({messageName:71,text:`Cannot link ${G.prettyIdent(e.project.configuration,G.parseIdent(Se.name))} into ${G.prettyLocator(e.project.configuration,G.parseLocator(`${T.name}@${T.reference}`))} dependency ${G.prettyLocator(e.project.configuration,tt)} conflicts with parent dependency ${G.prettyLocator(e.project.configuration,x)}`})}else{let x=fe.get(Ke);if(x){let I=x.target,P=G.parseLocator(Array.isArray(I)?`${I[0]}@${I[1]}`:`${Ke}@${I}`);$we(P,tt)||r.push({messageName:71,text:`Cannot link ${G.prettyIdent(e.project.configuration,G.parseIdent(Se.name))} into ${G.prettyLocator(e.project.configuration,G.parseLocator(`${T.name}@${T.reference}`))} dependency ${G.prettyLocator(e.project.configuration,tt)} conflicts with dependency ${G.prettyLocator(e.project.configuration,P)} from sibling portal ${G.prettyIdent(e.project.configuration,G.parseIdent(x.portal.name))}`})}else fe.set(Ke,{target:tt.reference,portal:Se})}}}}let nt=e.hoistingLimitsByCwd?.get(te),Le=q?te:V.relative(p,Ae.toPortablePath(ht.packageLocation))||Bt.dot,Te=e.hoistingLimitsByCwd?.get(Le);D(ie,ht,Se,ue,C,Ee,Le,nt==="dependencies"||Te==="dependencies"||Te==="workspaces")}}};return D(A.name,u,A,h,u,u.packageDependencies,Bt.dot,!1),{packageTree:h,hoistingLimits:a,errors:r,preserveSymlinksRequired:o}};function e1e(t,e,r){let o=r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation;return Ae.toPortablePath(o||t.packageLocation)}function $It(t,e,r){let o=e.getLocator(t.name.replace(jh,""),t.reference),a=e.getPackageInformation(o);if(a===null)throw new Error("Assertion failed: Expected the package to be registered");return r.pnpifyFs?{linkType:"SOFT",target:Ae.toPortablePath(a.packageLocation)}:{linkType:a.linkType,target:e1e(a,t,e)}}var ewt=(t,e,r)=>{let o=new Map,a=(E,w,D)=>{let{linkType:b,target:C}=$It(E,t,r);return{locator:yA(E),nodePath:w,target:C,linkType:b,aliases:D}},n=E=>{let[w,D]=E.split("/");return D?{scope:w,name:D}:{scope:null,name:w}},u=new Set,A=(E,w,D)=>{if(u.has(E))return;u.add(E);let b=Array.from(E.references).sort().join("#");for(let C of E.dependencies){let T=Array.from(C.references).sort().join("#");if(C.identName===E.identName.replace(jh,"")&&T===b)continue;let N=Array.from(C.references).sort(),U={name:C.identName,reference:N[0]},{name:J,scope:te}=n(C.name),le=te?[te,J]:[J],ce=V.join(w,Zwe),ue=V.join(ce,...le),Ie=`${D}/${U.name}`,he=a(U,D,N.slice(1)),De=!1;if(he.linkType==="SOFT"&&r.project){let Ee=r.project.workspacesByCwd.get(he.target.slice(0,-1));De=!!(Ee&&!Ee.manifest.name)}if(!C.name.endsWith(jh)&&!De){let Ee=o.get(ue);if(Ee){if(Ee.dirList)throw new Error(`Assertion failed: ${ue} cannot merge dir node with leaf node`);{let Ce=G.parseLocator(Ee.locator),fe=G.parseLocator(he.locator);if(Ee.linkType!==he.linkType)throw new Error(`Assertion failed: ${ue} cannot merge nodes with different link types ${Ee.nodePath}/${G.stringifyLocator(Ce)} and ${D}/${G.stringifyLocator(fe)}`);if(Ce.identHash!==fe.identHash)throw new Error(`Assertion failed: ${ue} cannot merge nodes with different idents ${Ee.nodePath}/${G.stringifyLocator(Ce)} and ${D}/s${G.stringifyLocator(fe)}`);he.aliases=[...he.aliases,...Ee.aliases,G.parseLocator(Ee.locator).reference]}}o.set(ue,he);let g=ue.split("/"),me=g.indexOf(Zwe);for(let Ce=g.length-1;me>=0&&Ce>me;Ce--){let fe=Ae.toPortablePath(g.slice(0,Ce).join(V.sep)),ie=g[Ce],Z=o.get(fe);if(!Z)o.set(fe,{dirList:new Set([ie])});else if(Z.dirList){if(Z.dirList.has(ie))break;Z.dirList.add(ie)}}}A(C,he.linkType==="SOFT"?he.target:ue,Ie)}},p=a({name:e.name,reference:Array.from(e.references)[0]},"",[]),h=p.target;return o.set(h,p),A(e,h,""),o};Ve();Ve();St();St();sA();Ol();var jj={};Vt(jj,{PnpInstaller:()=>pd,PnpLinker:()=>Yh,UnplugCommand:()=>QC,default:()=>kwt,getPnpPath:()=>Vh,jsInstallUtils:()=>CA,pnpUtils:()=>vv,quotePathIfNeeded:()=>M1e});St();var O1e=ve("url");Ve();Ve();St();St();var t1e={DEFAULT:{collapsed:!1,next:{"*":"DEFAULT"}},TOP_LEVEL:{collapsed:!1,next:{fallbackExclusionList:"FALLBACK_EXCLUSION_LIST",packageRegistryData:"PACKAGE_REGISTRY_DATA","*":"DEFAULT"}},FALLBACK_EXCLUSION_LIST:{collapsed:!1,next:{"*":"FALLBACK_EXCLUSION_ENTRIES"}},FALLBACK_EXCLUSION_ENTRIES:{collapsed:!0,next:{"*":"FALLBACK_EXCLUSION_DATA"}},FALLBACK_EXCLUSION_DATA:{collapsed:!0,next:{"*":"DEFAULT"}},PACKAGE_REGISTRY_DATA:{collapsed:!1,next:{"*":"PACKAGE_REGISTRY_ENTRIES"}},PACKAGE_REGISTRY_ENTRIES:{collapsed:!0,next:{"*":"PACKAGE_STORE_DATA"}},PACKAGE_STORE_DATA:{collapsed:!1,next:{"*":"PACKAGE_STORE_ENTRIES"}},PACKAGE_STORE_ENTRIES:{collapsed:!0,next:{"*":"PACKAGE_INFORMATION_DATA"}},PACKAGE_INFORMATION_DATA:{collapsed:!1,next:{packageDependencies:"PACKAGE_DEPENDENCIES","*":"DEFAULT"}},PACKAGE_DEPENDENCIES:{collapsed:!1,next:{"*":"PACKAGE_DEPENDENCY"}},PACKAGE_DEPENDENCY:{collapsed:!0,next:{"*":"DEFAULT"}}};function twt(t,e,r){let o="";o+="[";for(let a=0,n=t.length;a"u"||(A!==0&&(a+=", "),a+=JSON.stringify(p),a+=": ",a+=JQ(p,h,e,r).replace(/^ +/g,""),A+=1)}return a+="}",a}function iwt(t,e,r){let o=Object.keys(t),a=`${r} `,n="";n+=r,n+=`{ -`;let u=0;for(let A=0,p=o.length;A"u"||(u!==0&&(n+=",",n+=` -`),n+=a,n+=JSON.stringify(h),n+=": ",n+=JQ(h,E,e,a).replace(/^ +/g,""),u+=1)}return u!==0&&(n+=` -`),n+=r,n+="}",n}function JQ(t,e,r,o){let{next:a}=t1e[r],n=a[t]||a["*"];return r1e(e,n,o)}function r1e(t,e,r){let{collapsed:o}=t1e[e];return Array.isArray(t)?o?twt(t,e,r):rwt(t,e,r):typeof t=="object"&&t!==null?o?nwt(t,e,r):iwt(t,e,r):JSON.stringify(t)}function n1e(t){return r1e(t,"TOP_LEVEL","")}function hv(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let o=[];for(let n of e)o.push(r.map(u=>n(u)));let a=r.map((n,u)=>u);return a.sort((n,u)=>{for(let A of o){let p=A[n]A[u]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function swt(t){let e=new Map,r=hv(t.fallbackExclusionList||[],[({name:o,reference:a})=>o,({name:o,reference:a})=>a]);for(let{name:o,reference:a}of r){let n=e.get(o);typeof n>"u"&&e.set(o,n=new Set),n.add(a)}return Array.from(e).map(([o,a])=>[o,Array.from(a)])}function owt(t){return hv(t.fallbackPool||[],([e])=>e)}function awt(t){let e=[];for(let[r,o]of hv(t.packageRegistry,([a])=>a===null?"0":`1${a}`)){let a=[];e.push([r,a]);for(let[n,{packageLocation:u,packageDependencies:A,packagePeers:p,linkType:h,discardFromLookup:E}]of hv(o,([w])=>w===null?"0":`1${w}`)){let w=[];r!==null&&n!==null&&!A.has(r)&&w.push([r,n]);for(let[C,T]of hv(A.entries(),([N])=>N))w.push([C,T]);let D=p&&p.size>0?Array.from(p):void 0,b=E||void 0;a.push([n,{packageLocation:u,packageDependencies:w,packagePeers:D,linkType:h,discardFromLookup:b}])}}return e}function gv(t){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost."],dependencyTreeRoots:t.dependencyTreeRoots,enableTopLevelFallback:t.enableTopLevelFallback||!1,ignorePatternData:t.ignorePattern||null,fallbackExclusionList:swt(t),fallbackPool:owt(t),packageRegistryData:awt(t)}}var o1e=et(s1e());function a1e(t,e){return[t?`${t} -`:"",`/* eslint-disable */ -`,`// @ts-nocheck -`,`"use strict"; -`,` -`,e,` -`,(0,o1e.default)()].join("")}function lwt(t){return JSON.stringify(t,null,2)}function cwt(t){return`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,`\\ -`)}'`}function uwt(t){return[`const RAW_RUNTIME_STATE = -`,`${cwt(n1e(t))}; - -`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) { -`,` return hydrateRuntimeState(JSON.parse(RAW_RUNTIME_STATE), {basePath: basePath || __dirname}); -`,`} -`].join("")}function Awt(){return[`function $$SETUP_STATE(hydrateRuntimeState, basePath) { -`,` const fs = require('fs'); -`,` const path = require('path'); -`,` const pnpDataFilepath = path.resolve(__dirname, ${JSON.stringify(mr.pnpData)}); -`,` return hydrateRuntimeState(JSON.parse(fs.readFileSync(pnpDataFilepath, 'utf8')), {basePath: basePath || __dirname}); -`,`} -`].join("")}function l1e(t){let e=gv(t),r=uwt(e);return a1e(t.shebang,r)}function c1e(t){let e=gv(t),r=Awt(),o=a1e(t.shebang,r);return{dataFile:lwt(e),loaderFile:o}}St();function Sj(t,{basePath:e}){let r=Ae.toPortablePath(e),o=V.resolve(r),a=t.ignorePatternData!==null?new RegExp(t.ignorePatternData):null,n=new Map,u=new Map(t.packageRegistryData.map(([w,D])=>[w,new Map(D.map(([b,C])=>{if(w===null!=(b===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let T=C.discardFromLookup??!1,N={name:w,reference:b},U=n.get(C.packageLocation);U?(U.discardFromLookup=U.discardFromLookup&&T,T||(U.locator=N)):n.set(C.packageLocation,{locator:N,discardFromLookup:T});let J=null;return[b,{packageDependencies:new Map(C.packageDependencies),packagePeers:new Set(C.packagePeers),linkType:C.linkType,discardFromLookup:T,get packageLocation(){return J||(J=V.join(o,C.packageLocation))}}]}))])),A=new Map(t.fallbackExclusionList.map(([w,D])=>[w,new Set(D)])),p=new Map(t.fallbackPool),h=t.dependencyTreeRoots,E=t.enableTopLevelFallback;return{basePath:r,dependencyTreeRoots:h,enableTopLevelFallback:E,fallbackExclusionList:A,fallbackPool:p,ignorePattern:a,packageLocatorsByLocations:n,packageRegistry:u}}St();St();var tp=ve("module"),fd=ve("url"),Nj=ve("util");var Qo=ve("url");var p1e=et(ve("assert"));var Pj=Array.isArray,dv=JSON.stringify,mv=Object.getOwnPropertyNames,Ad=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),xj=(t,e)=>RegExp.prototype.exec.call(t,e),bj=(t,...e)=>RegExp.prototype[Symbol.replace].apply(t,e),Gh=(t,...e)=>String.prototype.endsWith.apply(t,e),kj=(t,...e)=>String.prototype.includes.apply(t,e),Qj=(t,...e)=>String.prototype.lastIndexOf.apply(t,e),yv=(t,...e)=>String.prototype.indexOf.apply(t,e),u1e=(t,...e)=>String.prototype.replace.apply(t,e),Wh=(t,...e)=>String.prototype.slice.apply(t,e),EA=(t,...e)=>String.prototype.startsWith.apply(t,e),A1e=Map,f1e=JSON.parse;function Ev(t,e,r){return class extends r{constructor(...o){super(e(...o)),this.code=t,this.name=`${r.name} [${t}]`}}}var h1e=Ev("ERR_PACKAGE_IMPORT_NOT_DEFINED",(t,e,r)=>`Package import specifier "${t}" is not defined${e?` in package ${e}package.json`:""} imported from ${r}`,TypeError),Fj=Ev("ERR_INVALID_MODULE_SPECIFIER",(t,e,r=void 0)=>`Invalid module "${t}" ${e}${r?` imported from ${r}`:""}`,TypeError),g1e=Ev("ERR_INVALID_PACKAGE_TARGET",(t,e,r,o=!1,a=void 0)=>{let n=typeof r=="string"&&!o&&r.length&&!EA(r,"./");return e==="."?((0,p1e.default)(o===!1),`Invalid "exports" main target ${dv(r)} defined in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`):`Invalid "${o?"imports":"exports"}" target ${dv(r)} defined for '${e}' in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`},Error),Cv=Ev("ERR_INVALID_PACKAGE_CONFIG",(t,e,r)=>`Invalid package config ${t}${e?` while importing ${e}`:""}${r?`. ${r}`:""}`,Error),d1e=Ev("ERR_PACKAGE_PATH_NOT_EXPORTED",(t,e,r=void 0)=>e==="."?`No "exports" main defined in ${t}package.json${r?` imported from ${r}`:""}`:`Package subpath '${e}' is not defined by "exports" in ${t}package.json${r?` imported from ${r}`:""}`,Error);var XQ=ve("url");function m1e(t,e){let r=Object.create(null);for(let o=0;oe):t+e}Iv(r,t,o,u,a)}xj(E1e,Wh(t,2))!==null&&Iv(r,t,o,u,a);let p=new URL(t,o),h=p.pathname,E=new URL(".",o).pathname;if(EA(h,E)||Iv(r,t,o,u,a),e==="")return p;if(xj(E1e,e)!==null){let w=n?u1e(r,"*",()=>e):r+e;hwt(w,o,u,a)}return n?new URL(bj(C1e,p.href,()=>e)):new URL(e,p)}function dwt(t){let e=+t;return`${e}`!==t?!1:e>=0&&e<4294967295}function kC(t,e,r,o,a,n,u,A){if(typeof e=="string")return gwt(e,r,o,t,a,n,u,A);if(Pj(e)){if(e.length===0)return null;let p;for(let h=0;hn?-1:n>a||r===-1?1:o===-1||t.length>e.length?-1:e.length>t.length?1:0}function mwt(t,e,r){if(typeof t=="string"||Pj(t))return!0;if(typeof t!="object"||t===null)return!1;let o=mv(t),a=!1,n=0;for(let u=0;u=h.length&&Gh(e,w)&&w1e(n,h)===1&&Qj(h,"*")===E&&(n=h,u=Wh(e,E,e.length-w.length))}}if(n){let p=r[n],h=kC(t,p,u,n,o,!0,!1,a);return h==null&&Rj(e,t,o),h}Rj(e,t,o)}function v1e({name:t,base:e,conditions:r,readFileSyncFn:o}){if(t==="#"||EA(t,"#/")||Gh(t,"/")){let u="is not a valid internal imports specifier name";throw new Fj(t,u,(0,Qo.fileURLToPath)(e))}let a,n=y1e(e,o);if(n.exists){a=(0,Qo.pathToFileURL)(n.pjsonPath);let u=n.imports;if(u)if(Ad(u,t)&&!kj(t,"*")){let A=kC(a,u[t],"",t,e,!1,!0,r);if(A!=null)return A}else{let A="",p,h=mv(u);for(let E=0;E=w.length&&Gh(t,b)&&w1e(A,w)===1&&Qj(w,"*")===D&&(A=w,p=Wh(t,D,t.length-b.length))}}if(A){let E=u[A],w=kC(a,E,p,A,e,!0,!0,r);if(w!=null)return w}}}pwt(t,a,e)}St();var Ewt=new Set(["BUILTIN_NODE_RESOLUTION_FAILED","MISSING_DEPENDENCY","MISSING_PEER_DEPENDENCY","QUALIFIED_PATH_RESOLUTION_FAILED","UNDECLARED_DEPENDENCY"]);function ts(t,e,r={},o){o??=Ewt.has(t)?"MODULE_NOT_FOUND":t;let a={configurable:!0,writable:!0,enumerable:!1};return Object.defineProperties(new Error(e),{code:{...a,value:o},pnpCode:{...a,value:t},data:{...a,value:r}})}function pu(t){return Ae.normalize(Ae.fromPortablePath(t))}var x1e=et(S1e());function b1e(t){return Cwt(),Lj[t]}var Lj;function Cwt(){Lj||(Lj={"--conditions":[],...P1e(Iwt()),...P1e(process.execArgv)})}function P1e(t){return(0,x1e.default)({"--conditions":[String],"-C":"--conditions"},{argv:t,permissive:!0})}function Iwt(){let t=[],e=wwt(process.env.NODE_OPTIONS||"",t);return t.length,e}function wwt(t,e){let r=[],o=!1,a=!0;for(let n=0;nparseInt(t,10)),k1e=Ha>19||Ha===19&&ep>=2||Ha===18&&ep>=13,tzt=Ha===20&&ep<6||Ha===19&&ep>=3,rzt=Ha>19||Ha===19&&ep>=6,nzt=Ha>=21||Ha===20&&ep>=10||Ha===18&&ep>=19,izt=Ha>=21||Ha===20&&ep>=10||Ha===18&&ep>=20,szt=Ha>=22;function Q1e(t){if(process.env.WATCH_REPORT_DEPENDENCIES&&process.send)if(t=t.map(e=>Ae.fromPortablePath(qs.resolveVirtual(Ae.toPortablePath(e)))),k1e)process.send({"watch:require":t});else for(let e of t)process.send({"watch:require":e})}function Oj(t,e){let r=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,o=Number(process.env.PNP_DEBUG_LEVEL),a=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,n=/^(\/|\.{1,2}(\/|$))/,u=/\/$/,A=/^\.{0,2}\//,p={name:null,reference:null},h=[],E=new Set;if(t.enableTopLevelFallback===!0&&h.push(p),e.compatibilityMode!==!1)for(let Le of["react-scripts","gatsby"]){let Te=t.packageRegistry.get(Le);if(Te)for(let ke of Te.keys()){if(ke===null)throw new Error("Assertion failed: This reference shouldn't be null");h.push({name:Le,reference:ke})}}let{ignorePattern:w,packageRegistry:D,packageLocatorsByLocations:b}=t;function C(Le,Te){return{fn:Le,args:Te,error:null,result:null}}function T(Le){let Te=process.stderr?.hasColors?.()??process.stdout.isTTY,ke=(tt,He)=>`\x1B[${tt}m${He}\x1B[0m`,Ke=Le.error;console.error(Ke?ke("31;1",`\u2716 ${Le.error?.message.replace(/\n.*/s,"")}`):ke("33;1","\u203C Resolution")),Le.args.length>0&&console.error();for(let tt of Le.args)console.error(` ${ke("37;1","In \u2190")} ${(0,Nj.inspect)(tt,{colors:Te,compact:!0})}`);Le.result&&(console.error(),console.error(` ${ke("37;1","Out \u2192")} ${(0,Nj.inspect)(Le.result,{colors:Te,compact:!0})}`));let xe=new Error().stack.match(/(?<=^ +)at.*/gm)?.slice(2)??[];if(xe.length>0){console.error();for(let tt of xe)console.error(` ${ke("38;5;244",tt)}`)}console.error()}function N(Le,Te){if(e.allowDebug===!1)return Te;if(Number.isFinite(o)){if(o>=2)return(...ke)=>{let Ke=C(Le,ke);try{return Ke.result=Te(...ke)}catch(xe){throw Ke.error=xe}finally{T(Ke)}};if(o>=1)return(...ke)=>{try{return Te(...ke)}catch(Ke){let xe=C(Le,ke);throw xe.error=Ke,T(xe),Ke}}}return Te}function U(Le){let Te=g(Le);if(!Te)throw ts("INTERNAL","Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return Te}function J(Le){if(Le.name===null)return!0;for(let Te of t.dependencyTreeRoots)if(Te.name===Le.name&&Te.reference===Le.reference)return!0;return!1}let te=new Set(["node","require",...b1e("--conditions")]);function le(Le,Te=te,ke){let Ke=fe(V.join(Le,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(Ke===null)throw ts("INTERNAL",`The locator that owns the "${Le}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:xe}=U(Ke),tt=V.join(xe,mr.manifest);if(!e.fakeFs.existsSync(tt))return null;let He=JSON.parse(e.fakeFs.readFileSync(tt,"utf8"));if(He.exports==null)return null;let x=V.contains(xe,Le);if(x===null)throw ts("INTERNAL","unqualifiedPath doesn't contain the packageLocation (this is probably an internal error)");x!=="."&&!A.test(x)&&(x=`./${x}`);try{let I=B1e({packageJSONUrl:(0,fd.pathToFileURL)(Ae.fromPortablePath(tt)),packageSubpath:x,exports:He.exports,base:ke?(0,fd.pathToFileURL)(Ae.fromPortablePath(ke)):null,conditions:Te});return Ae.toPortablePath((0,fd.fileURLToPath)(I))}catch(I){throw ts("EXPORTS_RESOLUTION_FAILED",I.message,{unqualifiedPath:pu(Le),locator:Ke,pkgJson:He,subpath:pu(x),conditions:Te},I.code)}}function ce(Le,Te,{extensions:ke}){let Ke;try{Te.push(Le),Ke=e.fakeFs.statSync(Le)}catch{}if(Ke&&!Ke.isDirectory())return e.fakeFs.realpathSync(Le);if(Ke&&Ke.isDirectory()){let xe;try{xe=JSON.parse(e.fakeFs.readFileSync(V.join(Le,mr.manifest),"utf8"))}catch{}let tt;if(xe&&xe.main&&(tt=V.resolve(Le,xe.main)),tt&&tt!==Le){let He=ce(tt,Te,{extensions:ke});if(He!==null)return He}}for(let xe=0,tt=ke.length;xe{let x=JSON.stringify(He.name);if(Ke.has(x))return;Ke.add(x);let I=me(He);for(let P of I)if(U(P).packagePeers.has(Le))xe(P);else{let R=ke.get(P.name);typeof R>"u"&&ke.set(P.name,R=new Set),R.add(P.reference)}};xe(Te);let tt=[];for(let He of[...ke.keys()].sort())for(let x of[...ke.get(He)].sort())tt.push({name:He,reference:x});return tt}function fe(Le,{resolveIgnored:Te=!1,includeDiscardFromLookup:ke=!1}={}){if(he(Le)&&!Te)return null;let Ke=V.relative(t.basePath,Le);Ke.match(n)||(Ke=`./${Ke}`),Ke.endsWith("/")||(Ke=`${Ke}/`);do{let xe=b.get(Ke);if(typeof xe>"u"||xe.discardFromLookup&&!ke){Ke=Ke.substring(0,Ke.lastIndexOf("/",Ke.length-2)+1);continue}return xe.locator}while(Ke!=="");return null}function ie(Le){try{return e.fakeFs.readFileSync(Ae.toPortablePath(Le),"utf8")}catch(Te){if(Te.code==="ENOENT")return;throw Te}}function Z(Le,Te,{considerBuiltins:ke=!0}={}){if(Le.startsWith("#"))throw new Error("resolveToUnqualified can not handle private import mappings");if(Le==="pnpapi")return Ae.toPortablePath(e.pnpapiResolution);if(ke&&(0,tp.isBuiltin)(Le))return null;let Ke=pu(Le),xe=Te&&pu(Te);if(Te&&he(Te)&&(!V.isAbsolute(Le)||fe(Le)===null)){let x=Ie(Le,Te);if(x===!1)throw ts("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp) - -Require request: "${Ke}" -Required by: ${xe} -`,{request:Ke,issuer:xe});return Ae.toPortablePath(x)}let tt,He=Le.match(a);if(He){if(!Te)throw ts("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:Ke,issuer:xe});let[,x,I]=He,P=fe(Te);if(!P){let Fe=Ie(Le,Te);if(Fe===!1)throw ts("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree). - -Require path: "${Ke}" -Required by: ${xe} -`,{request:Ke,issuer:xe});return Ae.toPortablePath(Fe)}let R=U(P).packageDependencies.get(x),z=null;if(R==null&&P.name!==null){let Fe=t.fallbackExclusionList.get(P.name);if(!Fe||!Fe.has(P.reference)){for(let Et=0,qt=h.length;EtJ(lt))?X=ts("MISSING_PEER_DEPENDENCY",`${P.name} tried to access ${x} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound. - -Required package: ${x}${x!==Ke?` (via "${Ke}")`:""} -Required by: ${P.name}@${P.reference} (via ${xe}) -${Fe.map(lt=>`Ancestor breaking the chain: ${lt.name}@${lt.reference} -`).join("")} -`,{request:Ke,issuer:xe,issuerLocator:Object.assign({},P),dependencyName:x,brokenAncestors:Fe}):X=ts("MISSING_PEER_DEPENDENCY",`${P.name} tried to access ${x} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound. - -Required package: ${x}${x!==Ke?` (via "${Ke}")`:""} -Required by: ${P.name}@${P.reference} (via ${xe}) - -${Fe.map(lt=>`Ancestor breaking the chain: ${lt.name}@${lt.reference} -`).join("")} -`,{request:Ke,issuer:xe,issuerLocator:Object.assign({},P),dependencyName:x,brokenAncestors:Fe})}else R===void 0&&(!ke&&(0,tp.isBuiltin)(Le)?J(P)?X=ts("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound. - -Required package: ${x}${x!==Ke?` (via "${Ke}")`:""} -Required by: ${xe} -`,{request:Ke,issuer:xe,dependencyName:x}):X=ts("UNDECLARED_DEPENDENCY",`${P.name} tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in ${P.name}'s dependencies, this makes the require call ambiguous and unsound. - -Required package: ${x}${x!==Ke?` (via "${Ke}")`:""} -Required by: ${xe} -`,{request:Ke,issuer:xe,issuerLocator:Object.assign({},P),dependencyName:x}):J(P)?X=ts("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound. - -Required package: ${x}${x!==Ke?` (via "${Ke}")`:""} -Required by: ${xe} -`,{request:Ke,issuer:xe,dependencyName:x}):X=ts("UNDECLARED_DEPENDENCY",`${P.name} tried to access ${x}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound. - -Required package: ${x}${x!==Ke?` (via "${Ke}")`:""} -Required by: ${P.name}@${P.reference} (via ${xe}) -`,{request:Ke,issuer:xe,issuerLocator:Object.assign({},P),dependencyName:x}));if(R==null){if(z===null||X===null)throw X||new Error("Assertion failed: Expected an error to have been set");R=z;let Fe=X.message.replace(/\n.*/g,"");X.message=Fe,!E.has(Fe)&&o!==0&&(E.add(Fe),process.emitWarning(X))}let $=Array.isArray(R)?{name:R[0],reference:R[1]}:{name:x,reference:R},se=U($);if(!se.packageLocation)throw ts("MISSING_DEPENDENCY",`A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod. - -Required package: ${$.name}@${$.reference}${$.name!==Ke?` (via "${Ke}")`:""} -Required by: ${P.name}@${P.reference} (via ${xe}) -`,{request:Ke,issuer:xe,dependencyLocator:Object.assign({},$)});let be=se.packageLocation;I?tt=V.join(be,I):tt=be}else if(V.isAbsolute(Le))tt=V.normalize(Le);else{if(!Te)throw ts("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:Ke,issuer:xe});let x=V.resolve(Te);Te.match(u)?tt=V.normalize(V.join(x,Le)):tt=V.normalize(V.join(V.dirname(x),Le))}return V.normalize(tt)}function Se(Le,Te,ke=te,Ke){if(n.test(Le))return Te;let xe=le(Te,ke,Ke);return xe?V.normalize(xe):Te}function Re(Le,{extensions:Te=Object.keys(tp.Module._extensions)}={}){let ke=[],Ke=ce(Le,ke,{extensions:Te});if(Ke)return V.normalize(Ke);{Q1e(ke.map(He=>Ae.fromPortablePath(He)));let xe=pu(Le),tt=fe(Le);if(tt){let{packageLocation:He}=U(tt),x=!0;try{e.fakeFs.accessSync(He)}catch(I){if(I?.code==="ENOENT")x=!1;else{let P=(I?.message??I??"empty exception thrown").replace(/^[A-Z]/,y=>y.toLowerCase());throw ts("QUALIFIED_PATH_RESOLUTION_FAILED",`Required package exists but could not be accessed (${P}). - -Missing package: ${tt.name}@${tt.reference} -Expected package location: ${pu(He)} -`,{unqualifiedPath:xe,extensions:Te})}}if(!x){let I=He.includes("/unplugged/")?"Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).":"Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.";throw ts("QUALIFIED_PATH_RESOLUTION_FAILED",`${I} - -Missing package: ${tt.name}@${tt.reference} -Expected package location: ${pu(He)} -`,{unqualifiedPath:xe,extensions:Te})}}throw ts("QUALIFIED_PATH_RESOLUTION_FAILED",`Qualified path resolution failed: we looked for the following paths, but none could be accessed. - -Source path: ${xe} -${ke.map(He=>`Not found: ${pu(He)} -`).join("")}`,{unqualifiedPath:xe,extensions:Te})}}function ht(Le,Te,ke){if(!Te)throw new Error("Assertion failed: An issuer is required to resolve private import mappings");let Ke=v1e({name:Le,base:(0,fd.pathToFileURL)(Ae.fromPortablePath(Te)),conditions:ke.conditions??te,readFileSyncFn:ie});if(Ke instanceof URL)return Re(Ae.toPortablePath((0,fd.fileURLToPath)(Ke)),{extensions:ke.extensions});if(Ke.startsWith("#"))throw new Error("Mapping from one private import to another isn't allowed");return q(Ke,Te,ke)}function q(Le,Te,ke={}){try{if(Le.startsWith("#"))return ht(Le,Te,ke);let{considerBuiltins:Ke,extensions:xe,conditions:tt}=ke,He=Z(Le,Te,{considerBuiltins:Ke});if(Le==="pnpapi")return He;if(He===null)return null;let x=()=>Te!==null?he(Te):!1,I=(!Ke||!(0,tp.isBuiltin)(Le))&&!x()?Se(Le,He,tt,Te):He;return Re(I,{extensions:xe})}catch(Ke){throw Object.hasOwn(Ke,"pnpCode")&&Object.assign(Ke.data,{request:pu(Le),issuer:Te&&pu(Te)}),Ke}}function nt(Le){let Te=V.normalize(Le),ke=qs.resolveVirtual(Te);return ke!==Te?ke:null}return{VERSIONS:De,topLevel:Ee,getLocator:(Le,Te)=>Array.isArray(Te)?{name:Te[0],reference:Te[1]}:{name:Le,reference:Te},getDependencyTreeRoots:()=>[...t.dependencyTreeRoots],getAllLocators(){let Le=[];for(let[Te,ke]of D)for(let Ke of ke.keys())Te!==null&&Ke!==null&&Le.push({name:Te,reference:Ke});return Le},getPackageInformation:Le=>{let Te=g(Le);if(Te===null)return null;let ke=Ae.fromPortablePath(Te.packageLocation);return{...Te,packageLocation:ke}},findPackageLocator:Le=>fe(Ae.toPortablePath(Le)),resolveToUnqualified:N("resolveToUnqualified",(Le,Te,ke)=>{let Ke=Te!==null?Ae.toPortablePath(Te):null,xe=Z(Ae.toPortablePath(Le),Ke,ke);return xe===null?null:Ae.fromPortablePath(xe)}),resolveUnqualified:N("resolveUnqualified",(Le,Te)=>Ae.fromPortablePath(Re(Ae.toPortablePath(Le),Te))),resolveRequest:N("resolveRequest",(Le,Te,ke)=>{let Ke=Te!==null?Ae.toPortablePath(Te):null,xe=q(Ae.toPortablePath(Le),Ke,ke);return xe===null?null:Ae.fromPortablePath(xe)}),resolveVirtual:N("resolveVirtual",Le=>{let Te=nt(Ae.toPortablePath(Le));return Te!==null?Ae.fromPortablePath(Te):null})}}St();var F1e=(t,e,r)=>{let o=gv(t),a=Sj(o,{basePath:e}),n=Ae.join(e,mr.pnpCjs);return Oj(a,{fakeFs:r,pnpapiResolution:n})};var Uj=et(T1e());Gt();var CA={};Vt(CA,{checkManifestCompatibility:()=>L1e,extractBuildRequest:()=>ZQ,getExtractHint:()=>_j,hasBindingGyp:()=>Hj});Ve();St();function L1e(t){return G.isPackageCompatible(t,Xi.getArchitectureSet())}function ZQ(t,e,r,{configuration:o}){let a=[];for(let n of["preinstall","install","postinstall"])e.manifest.scripts.has(n)&&a.push({type:0,script:n});return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&a.push({type:1,script:"node-gyp rebuild"}),a.length===0?null:t.linkType!=="HARD"?{skipped:!0,explain:n=>n.reportWarningOnce(6,`${G.prettyLocator(o,t)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`)}:r&&r.built===!1?{skipped:!0,explain:n=>n.reportInfoOnce(5,`${G.prettyLocator(o,t)} lists build scripts, but its build has been explicitly disabled through configuration.`)}:!o.get("enableScripts")&&!r.built?{skipped:!0,explain:n=>n.reportWarningOnce(4,`${G.prettyLocator(o,t)} lists build scripts, but all build scripts have been disabled.`)}:L1e(t)?{skipped:!1,directives:a}:{skipped:!0,explain:n=>n.reportWarningOnce(76,`${G.prettyLocator(o,t)} The ${Xi.getArchitectureName()} architecture is incompatible with this package, build skipped.`)}}var vwt=new Set([".exe",".bin",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function _j(t){return t.packageFs.getExtractHint({relevantExtensions:vwt})}function Hj(t){let e=V.join(t.prefixPath,"binding.gyp");return t.packageFs.existsSync(e)}var vv={};Vt(vv,{getUnpluggedPath:()=>Bv});Ve();St();function Bv(t,{configuration:e}){return V.resolve(e.get("pnpUnpluggedFolder"),G.slugifyLocator(t))}var Dwt=new Set([G.makeIdent(null,"open").identHash,G.makeIdent(null,"opn").identHash]),Yh=class{constructor(){this.mode="strict";this.pnpCache=new Map}getCustomDataKey(){return JSON.stringify({name:"PnpLinker",version:2})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the PnP linker to be enabled");let o=Vh(r.project).cjs;if(!ae.existsSync(o))throw new it(`The project in ${pe.pretty(r.project.configuration,`${r.project.cwd}/package.json`,pe.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let a=qe.getFactoryWithDefault(this.pnpCache,o,()=>qe.dynamicRequire(o,{cachingStrategy:qe.CachingStrategy.FsTime})),n={name:G.stringifyIdent(e),reference:e.reference},u=a.getPackageInformation(n);if(!u)throw new it(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed PnP map - running an install might help`);return Ae.toPortablePath(u.packageLocation)}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let o=Vh(r.project).cjs;if(!ae.existsSync(o))return null;let n=qe.getFactoryWithDefault(this.pnpCache,o,()=>qe.dynamicRequire(o,{cachingStrategy:qe.CachingStrategy.FsTime})).findPackageLocator(Ae.fromPortablePath(e));return n?G.makeLocator(G.parseIdent(n.name),n.reference):null}makeInstaller(e){return new pd(e)}isEnabled(e){return!(e.project.configuration.get("nodeLinker")!=="pnp"||e.project.configuration.get("pnpMode")!==this.mode)}},pd=class{constructor(e){this.opts=e;this.mode="strict";this.asyncActions=new qe.AsyncActions(10);this.packageRegistry=new Map;this.virtualTemplates=new Map;this.isESMLoaderRequired=!1;this.customData={store:new Map};this.unpluggedPaths=new Set;this.opts=e}attachCustomData(e){this.customData=e}async installPackage(e,r,o){let a=G.stringifyIdent(e),n=e.reference,u=!!this.opts.project.tryWorkspaceByLocator(e),A=G.isVirtualLocator(e),p=e.peerDependencies.size>0&&!A,h=!p&&!u,E=!p&&e.linkType!=="SOFT",w,D;if(h||E){let te=A?G.devirtualizeLocator(e):e;w=this.customData.store.get(te.locatorHash),typeof w>"u"&&(w=await Swt(r),e.linkType==="HARD"&&this.customData.store.set(te.locatorHash,w)),w.manifest.type==="module"&&(this.isESMLoaderRequired=!0),D=this.opts.project.getDependencyMeta(te,e.version)}let b=h?ZQ(e,w,D,{configuration:this.opts.project.configuration}):null,C=E?await this.unplugPackageIfNeeded(e,w,r,D,o):r.packageFs;if(V.isAbsolute(r.prefixPath))throw new Error(`Assertion failed: Expected the prefix path (${r.prefixPath}) to be relative to the parent`);let T=V.resolve(C.getRealPath(),r.prefixPath),N=qj(this.opts.project.cwd,T),U=new Map,J=new Set;if(A){for(let te of e.peerDependencies.values())U.set(G.stringifyIdent(te),null),J.add(G.stringifyIdent(te));if(!u){let te=G.devirtualizeLocator(e);this.virtualTemplates.set(te.locatorHash,{location:qj(this.opts.project.cwd,qs.resolveVirtual(T)),locator:te})}}return qe.getMapWithDefault(this.packageRegistry,a).set(n,{packageLocation:N,packageDependencies:U,packagePeers:J,linkType:e.linkType,discardFromLookup:r.discardFromLookup||!1}),{packageLocation:T,buildRequest:b}}async attachInternalDependencies(e,r){let o=this.getPackageInformation(e);for(let[a,n]of r){let u=G.areIdentsEqual(a,n)?n.reference:[G.stringifyIdent(n),n.reference];o.packageDependencies.set(G.stringifyIdent(a),u)}}async attachExternalDependents(e,r){for(let o of r)this.getDiskInformation(o).packageDependencies.set(G.stringifyIdent(e),e.reference)}async finalizeInstall(){if(this.opts.project.configuration.get("pnpMode")!==this.mode)return;let e=Vh(this.opts.project);if(this.isEsmEnabled()||await ae.removePromise(e.esmLoader),this.opts.project.configuration.get("nodeLinker")!=="pnp"){await ae.removePromise(e.cjs),await ae.removePromise(e.data),await ae.removePromise(e.esmLoader),await ae.removePromise(this.opts.project.configuration.get("pnpUnpluggedFolder"));return}for(let{locator:E,location:w}of this.virtualTemplates.values())qe.getMapWithDefault(this.packageRegistry,G.stringifyIdent(E)).set(E.reference,{packageLocation:w,packageDependencies:new Map,packagePeers:new Set,linkType:"SOFT",discardFromLookup:!1});this.packageRegistry.set(null,new Map([[null,this.getPackageInformation(this.opts.project.topLevelWorkspace.anchoredLocator)]]));let r=this.opts.project.configuration.get("pnpFallbackMode"),o=this.opts.project.workspaces.map(({anchoredLocator:E})=>({name:G.stringifyIdent(E),reference:E.reference})),a=r!=="none",n=[],u=new Map,A=qe.buildIgnorePattern([".yarn/sdks/**",...this.opts.project.configuration.get("pnpIgnorePatterns")]),p=this.packageRegistry,h=this.opts.project.configuration.get("pnpShebang");if(r==="dependencies-only")for(let E of this.opts.project.storedPackages.values())this.opts.project.tryWorkspaceByLocator(E)&&n.push({name:G.stringifyIdent(E),reference:E.reference});return await this.asyncActions.wait(),await this.finalizeInstallWithPnp({dependencyTreeRoots:o,enableTopLevelFallback:a,fallbackExclusionList:n,fallbackPool:u,ignorePattern:A,packageRegistry:p,shebang:h}),{customData:this.customData}}async transformPnpSettings(e){}isEsmEnabled(){if(this.opts.project.configuration.sources.has("pnpEnableEsmLoader"))return this.opts.project.configuration.get("pnpEnableEsmLoader");if(this.isESMLoaderRequired)return!0;for(let e of this.opts.project.workspaces)if(e.manifest.type==="module")return!0;return!1}async finalizeInstallWithPnp(e){let r=Vh(this.opts.project),o=await this.locateNodeModules(e.ignorePattern);if(o.length>0){this.opts.report.reportWarning(31,"One or more node_modules have been detected and will be removed. This operation may take some time.");for(let n of o)await ae.removePromise(n)}if(await this.transformPnpSettings(e),this.opts.project.configuration.get("pnpEnableInlining")){let n=l1e(e);await ae.changeFilePromise(r.cjs,n,{automaticNewlines:!0,mode:493}),await ae.removePromise(r.data)}else{let{dataFile:n,loaderFile:u}=c1e(e);await ae.changeFilePromise(r.cjs,u,{automaticNewlines:!0,mode:493}),await ae.changeFilePromise(r.data,n,{automaticNewlines:!0,mode:420})}this.isEsmEnabled()&&(this.opts.report.reportWarning(0,"ESM support for PnP uses the experimental loader API and is therefore experimental"),await ae.changeFilePromise(r.esmLoader,(0,Uj.default)(),{automaticNewlines:!0,mode:420}));let a=this.opts.project.configuration.get("pnpUnpluggedFolder");if(this.unpluggedPaths.size===0)await ae.removePromise(a);else for(let n of await ae.readdirPromise(a)){let u=V.resolve(a,n);this.unpluggedPaths.has(u)||await ae.removePromise(u)}}async locateNodeModules(e){let r=[],o=e?new RegExp(e):null;for(let a of this.opts.project.workspaces){let n=V.join(a.cwd,"node_modules");if(o&&o.test(V.relative(this.opts.project.cwd,a.cwd))||!ae.existsSync(n))continue;let u=await ae.readdirPromise(n,{withFileTypes:!0}),A=u.filter(p=>!p.isDirectory()||p.name===".bin"||!p.name.startsWith("."));if(A.length===u.length)r.push(n);else for(let p of A)r.push(V.join(n,p.name))}return r}async unplugPackageIfNeeded(e,r,o,a,n){return this.shouldBeUnplugged(e,r,a)?this.unplugPackage(e,o,n):o.packageFs}shouldBeUnplugged(e,r,o){return typeof o.unplugged<"u"?o.unplugged:Dwt.has(e.identHash)||e.conditions!=null?!0:r.manifest.preferUnplugged!==null?r.manifest.preferUnplugged:!!(ZQ(e,r,o,{configuration:this.opts.project.configuration})?.skipped===!1||r.misc.extractHint)}async unplugPackage(e,r,o){let a=Bv(e,{configuration:this.opts.project.configuration});return this.opts.project.disabledLocators.has(e.locatorHash)?new ju(a,{baseFs:r.packageFs,pathUtils:V}):(this.unpluggedPaths.add(a),o.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{let n=V.join(a,r.prefixPath,".ready");await ae.existsPromise(n)||(this.opts.project.storedBuildState.delete(e.locatorHash),await ae.mkdirPromise(a,{recursive:!0}),await ae.copyPromise(a,Bt.dot,{baseFs:r.packageFs,overwrite:!1}),await ae.writeFilePromise(n,""))})),new En(a))}getPackageInformation(e){let r=G.stringifyIdent(e),o=e.reference,a=this.packageRegistry.get(r);if(!a)throw new Error(`Assertion failed: The package information store should have been available (for ${G.prettyIdent(this.opts.project.configuration,e)})`);let n=a.get(o);if(!n)throw new Error(`Assertion failed: The package information should have been available (for ${G.prettyLocator(this.opts.project.configuration,e)})`);return n}getDiskInformation(e){let r=qe.getMapWithDefault(this.packageRegistry,"@@disk"),o=qj(this.opts.project.cwd,e);return qe.getFactoryWithDefault(r,o,()=>({packageLocation:o,packageDependencies:new Map,packagePeers:new Set,linkType:"SOFT",discardFromLookup:!1}))}};function qj(t,e){let r=V.relative(t,e);return r.match(/^\.{0,2}\//)||(r=`./${r}`),r.replace(/\/?$/,"/")}async function Swt(t){let e=await _t.tryFind(t.prefixPath,{baseFs:t.packageFs})??new _t,r=new Set(["preinstall","install","postinstall"]);for(let o of e.scripts.keys())r.has(o)||e.scripts.delete(o);return{manifest:{scripts:e.scripts,preferUnplugged:e.preferUnplugged,type:e.type},misc:{extractHint:_j(t),hasBindingGyp:Hj(t)}}}Ve();Ve();Gt();var N1e=et(Xo());var QC=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("-A,--all",!1,{description:"Unplug direct dependencies from the entire project"});this.recursive=de.Boolean("-R,--recursive",!1,{description:"Unplug both direct and transitive dependencies"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=de.Rest()}static{this.paths=[["unplug"]]}static{this.usage=ot.Usage({description:"force the unpacking of a list of packages",details:"\n This command will add the selectors matching the specified patterns to the list of packages that must be unplugged when installed.\n\n A package being unplugged means that instead of being referenced directly through its archive, it will be unpacked at install time in the directory configured via `pnpUnpluggedFolder`. Note that unpacking packages this way is generally not recommended because it'll make it harder to store your packages within the repository. However, it's a good approach to quickly and safely debug some packages, and can even sometimes be required depending on the context (for example when the package contains shellscripts).\n\n Running the command will set a persistent flag inside your top-level `package.json`, in the `dependenciesMeta` field. As such, to undo its effects, you'll need to revert the changes made to the manifest and run `yarn install` to apply the modification.\n\n By default, only direct dependencies from the current workspace are affected. If `-A,--all` is set, direct dependencies from the entire project are affected. Using the `-R,--recursive` flag will affect transitive dependencies as well as direct ones.\n\n This command accepts glob patterns inside the scope and name components (not the range). Make sure to escape the patterns to prevent your own shell from trying to expand them.\n ",examples:[["Unplug the lodash dependency from the active workspace","yarn unplug lodash"],["Unplug all instances of lodash referenced by any workspace","yarn unplug lodash -A"],["Unplug all instances of lodash referenced by the active workspace and its dependencies","yarn unplug lodash -R"],["Unplug all instances of lodash, anywhere","yarn unplug lodash -AR"],["Unplug one specific version of lodash","yarn unplug lodash@1.2.3"],["Unplug all packages with the `@babel` scope","yarn unplug '@babel/*'"],["Unplug all packages (only for testing, not recommended)","yarn unplug -R '*'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);if(r.get("nodeLinker")!=="pnp")throw new it("This command can only be used if the `nodeLinker` option is set to `pnp`");await o.restoreInstallState();let u=new Set(this.patterns),A=this.patterns.map(b=>{let C=G.parseDescriptor(b),T=C.range!=="unknown"?C:G.makeDescriptor(C,"*");if(!Ur.validRange(T.range))throw new it(`The range of the descriptor patterns must be a valid semver range (${G.prettyDescriptor(r,T)})`);return N=>{let U=G.stringifyIdent(N);return!N1e.default.isMatch(U,G.stringifyIdent(T))||N.version&&!Ur.satisfiesWithPrereleases(N.version,T.range)?!1:(u.delete(b),!0)}}),p=()=>{let b=[];for(let C of o.storedPackages.values())!o.tryWorkspaceByLocator(C)&&!G.isVirtualLocator(C)&&A.some(T=>T(C))&&b.push(C);return b},h=b=>{let C=new Set,T=[],N=(U,J)=>{if(C.has(U.locatorHash))return;let te=!!o.tryWorkspaceByLocator(U);if(!(J>0&&!this.recursive&&te)&&(C.add(U.locatorHash),!o.tryWorkspaceByLocator(U)&&A.some(le=>le(U))&&T.push(U),!(J>0&&!this.recursive)))for(let le of U.dependencies.values()){let ce=o.storedResolutions.get(le.descriptorHash);if(!ce)throw new Error("Assertion failed: The resolution should have been registered");let ue=o.storedPackages.get(ce);if(!ue)throw new Error("Assertion failed: The package should have been registered");N(ue,J+1)}};for(let U of b)N(U.anchoredPackage,0);return T},E,w;if(this.all&&this.recursive?(E=p(),w="the project"):this.all?(E=h(o.workspaces),w="any workspace"):(E=h([a]),w="this workspace"),u.size>1)throw new it(`Patterns ${pe.prettyList(r,u,pe.Type.CODE)} don't match any packages referenced by ${w}`);if(u.size>0)throw new it(`Pattern ${pe.prettyList(r,u,pe.Type.CODE)} doesn't match any packages referenced by ${w}`);E=qe.sortMap(E,b=>G.stringifyLocator(b));let D=await Lt.start({configuration:r,stdout:this.context.stdout,json:this.json},async b=>{for(let C of E){let T=C.version??"unknown",N=o.topLevelWorkspace.manifest.ensureDependencyMeta(G.makeDescriptor(C,T));N.unplugged=!0,b.reportInfo(0,`Will unpack ${G.prettyLocator(r,C)} to ${pe.pretty(r,Bv(C,{configuration:r}),pe.Type.PATH)}`),b.reportJson({locator:G.stringifyLocator(C),version:T})}await o.topLevelWorkspace.persistManifest(),this.json||b.reportSeparator()});return D.hasErrors()?D.exitCode():await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};var Vh=t=>({cjs:V.join(t.cwd,mr.pnpCjs),data:V.join(t.cwd,mr.pnpData),esmLoader:V.join(t.cwd,mr.pnpEsmLoader)}),M1e=t=>/\s/.test(t)?JSON.stringify(t):t;async function Pwt(t,e,r){let o=/\s*--require\s+\S*\.pnp\.c?js\s*/g,a=/\s*--experimental-loader\s+\S*\.pnp\.loader\.mjs\s*/,n=(e.NODE_OPTIONS??"").replace(o," ").replace(a," ").trim();if(t.configuration.get("nodeLinker")!=="pnp"){e.NODE_OPTIONS=n||void 0;return}let u=Vh(t),A=`--require ${M1e(Ae.fromPortablePath(u.cjs))}`;ae.existsSync(u.esmLoader)&&(A=`${A} --experimental-loader ${(0,O1e.pathToFileURL)(Ae.fromPortablePath(u.esmLoader)).href}`),ae.existsSync(u.cjs)&&(e.NODE_OPTIONS=n?`${A} ${n}`:A)}async function xwt(t,e){let r=Vh(t);e(r.cjs),e(r.data),e(r.esmLoader),e(t.configuration.get("pnpUnpluggedFolder"))}var bwt={hooks:{populateYarnPaths:xwt,setupScriptEnvironment:Pwt},configuration:{nodeLinker:{description:'The linker used for installing Node packages, one of: "pnp", "pnpm", or "node-modules"',type:"STRING",default:"pnp"},winLinkType:{description:"Whether Yarn should use Windows Junctions or symlinks when creating links on Windows.",type:"STRING",values:["junctions","symlinks"],default:"junctions"},pnpMode:{description:"If 'strict', generates standard PnP maps. If 'loose', merges them with the n_m resolution.",type:"STRING",default:"strict"},pnpShebang:{description:"String to prepend to the generated PnP script",type:"STRING",default:"#!/usr/bin/env node"},pnpIgnorePatterns:{description:"Array of glob patterns; files matching them will use the classic resolution",type:"STRING",default:[],isArray:!0},pnpEnableEsmLoader:{description:"If true, Yarn will generate an ESM loader (`.pnp.loader.mjs`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.",type:"BOOLEAN",default:!1},pnpEnableInlining:{description:"If true, the PnP data will be inlined along with the generated loader",type:"BOOLEAN",default:!0},pnpFallbackMode:{description:"If true, the generated PnP loader will follow the top-level fallback rule",type:"STRING",default:"dependencies-only"},pnpUnpluggedFolder:{description:"Folder where the unplugged packages must be stored",type:"ABSOLUTE_PATH",default:"./.yarn/unplugged"}},linkers:[Yh],commands:[QC]},kwt=bwt;var Y1e=et(j1e());Gt();var zj=et(ve("crypto")),V1e=et(ve("fs")),K1e=1,xi="node_modules",$Q=".bin",J1e=".yarn-state.yml",Vwt=1e3,Xj=(o=>(o.CLASSIC="classic",o.HARDLINKS_LOCAL="hardlinks-local",o.HARDLINKS_GLOBAL="hardlinks-global",o))(Xj||{}),Dv=class{constructor(){this.installStateCache=new Map}getCustomDataKey(){return JSON.stringify({name:"NodeModulesLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the node-modules linker to be enabled");let o=r.project.tryWorkspaceByLocator(e);if(o)return o.cwd;let a=await qe.getFactoryWithDefault(this.installStateCache,r.project.cwd,async()=>await Jj(r.project,{unrollAliases:!0}));if(a===null)throw new it("Couldn't find the node_modules state file - running an install might help (findPackageLocation)");let n=a.locatorMap.get(G.stringifyLocator(e));if(!n){let p=new it(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed node_modules map - running an install might help`);throw p.code="LOCATOR_NOT_INSTALLED",p}let u=n.locations.sort((p,h)=>p.split(V.sep).length-h.split(V.sep).length),A=V.join(r.project.configuration.startingCwd,xi);return u.find(p=>V.contains(A,p))||n.locations[0]}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let o=await qe.getFactoryWithDefault(this.installStateCache,r.project.cwd,async()=>await Jj(r.project,{unrollAliases:!0}));if(o===null)return null;let{locationRoot:a,segments:n}=eF(V.resolve(e),{skipPrefix:r.project.cwd}),u=o.locationTree.get(a);if(!u)return null;let A=u.locator;for(let p of n){if(u=u.children.get(p),!u)break;A=u.locator||A}return G.parseLocator(A)}makeInstaller(e){return new Kj(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="node-modules"}},Kj=class{constructor(e){this.opts=e;this.localStore=new Map;this.realLocatorChecksums=new Map;this.customData={store:new Map}}attachCustomData(e){this.customData=e}async installPackage(e,r){let o=V.resolve(r.packageFs.getRealPath(),r.prefixPath),a=this.customData.store.get(e.locatorHash);if(typeof a>"u"&&(a=await Kwt(e,r),e.linkType==="HARD"&&this.customData.store.set(e.locatorHash,a)),!G.isPackageCompatible(e,this.opts.project.configuration.getSupportedArchitectures()))return{packageLocation:null,buildRequest:null};let n=new Map,u=new Set;n.has(G.stringifyIdent(e))||n.set(G.stringifyIdent(e),e.reference);let A=e;if(G.isVirtualLocator(e)){A=G.devirtualizeLocator(e);for(let E of e.peerDependencies.values())n.set(G.stringifyIdent(E),null),u.add(G.stringifyIdent(E))}let p={packageLocation:`${Ae.fromPortablePath(o)}/`,packageDependencies:n,packagePeers:u,linkType:e.linkType,discardFromLookup:r.discardFromLookup??!1};this.localStore.set(e.locatorHash,{pkg:e,customPackageData:a,dependencyMeta:this.opts.project.getDependencyMeta(e,e.version),pnpNode:p});let h=r.checksum?r.checksum.substring(r.checksum.indexOf("/")+1):null;return this.realLocatorChecksums.set(A.locatorHash,h),{packageLocation:o,buildRequest:null}}async attachInternalDependencies(e,r){let o=this.localStore.get(e.locatorHash);if(typeof o>"u")throw new Error("Assertion failed: Expected information object to have been registered");for(let[a,n]of r){let u=G.areIdentsEqual(a,n)?n.reference:[G.stringifyIdent(n),n.reference];o.pnpNode.packageDependencies.set(G.stringifyIdent(a),u)}}async attachExternalDependents(e,r){throw new Error("External dependencies haven't been implemented for the node-modules linker")}async finalizeInstall(){if(this.opts.project.configuration.get("nodeLinker")!=="node-modules")return;let e=new qs({baseFs:new iA({maxOpenFiles:80,readOnlyArchives:!0})}),r=await Jj(this.opts.project),o=this.opts.project.configuration.get("nmMode");(r===null||o!==r.nmMode)&&(this.opts.project.storedBuildState.clear(),r={locatorMap:new Map,binSymlinks:new Map,locationTree:new Map,nmMode:o,mtimeMs:0});let a=new Map(this.opts.project.workspaces.map(D=>{let b=this.opts.project.configuration.get("nmHoistingLimits");try{b=qe.validateEnum(fv,D.manifest.installConfig?.hoistingLimits??b)}catch{let C=G.prettyWorkspace(this.opts.project.configuration,D);this.opts.report.reportWarning(57,`${C}: Invalid 'installConfig.hoistingLimits' value. Expected one of ${Object.values(fv).join(", ")}, using default: "${b}"`)}return[D.relativeCwd,b]})),n=new Map(this.opts.project.workspaces.map(D=>{let b=this.opts.project.configuration.get("nmSelfReferences");return b=D.manifest.installConfig?.selfReferences??b,[D.relativeCwd,b]})),u={VERSIONS:{std:1},topLevel:{name:null,reference:null},getLocator:(D,b)=>Array.isArray(b)?{name:b[0],reference:b[1]}:{name:D,reference:b},getDependencyTreeRoots:()=>this.opts.project.workspaces.map(D=>{let b=D.anchoredLocator;return{name:G.stringifyIdent(b),reference:b.reference}}),getPackageInformation:D=>{let b=D.reference===null?this.opts.project.topLevelWorkspace.anchoredLocator:G.makeLocator(G.parseIdent(D.name),D.reference),C=this.localStore.get(b.locatorHash);if(typeof C>"u")throw new Error("Assertion failed: Expected the package reference to have been registered");return C.pnpNode},findPackageLocator:D=>{let b=this.opts.project.tryWorkspaceByCwd(Ae.toPortablePath(D));if(b!==null){let C=b.anchoredLocator;return{name:G.stringifyIdent(C),reference:C.reference}}throw new Error("Assertion failed: Unimplemented")},resolveToUnqualified:()=>{throw new Error("Assertion failed: Unimplemented")},resolveUnqualified:()=>{throw new Error("Assertion failed: Unimplemented")},resolveRequest:()=>{throw new Error("Assertion failed: Unimplemented")},resolveVirtual:D=>Ae.fromPortablePath(qs.resolveVirtual(Ae.toPortablePath(D)))},{tree:A,errors:p,preserveSymlinksRequired:h}=pv(u,{pnpifyFs:!1,validateExternalSoftLinks:!0,hoistingLimitsByCwd:a,project:this.opts.project,selfReferencesByCwd:n});if(!A){for(let{messageName:D,text:b}of p)this.opts.report.reportError(D,b);return}let E=vj(A);await e1t(r,E,{baseFs:e,project:this.opts.project,report:this.opts.report,realLocatorChecksums:this.realLocatorChecksums,loadManifest:async D=>{let b=G.parseLocator(D),C=this.localStore.get(b.locatorHash);if(typeof C>"u")throw new Error("Assertion failed: Expected the slot to exist");return C.customPackageData.manifest}});let w=[];for(let[D,b]of E.entries()){if(Z1e(D))continue;let C=G.parseLocator(D),T=this.localStore.get(C.locatorHash);if(typeof T>"u")throw new Error("Assertion failed: Expected the slot to exist");if(this.opts.project.tryWorkspaceByLocator(T.pkg))continue;let N=CA.extractBuildRequest(T.pkg,T.customPackageData,T.dependencyMeta,{configuration:this.opts.project.configuration});N&&w.push({buildLocations:b.locations,locator:C,buildRequest:N})}return h&&this.opts.report.reportWarning(72,`The application uses portals and that's why ${pe.pretty(this.opts.project.configuration,"--preserve-symlinks",pe.Type.CODE)} Node option is required for launching it`),{customData:this.customData,records:w}}};async function Kwt(t,e){let r=await _t.tryFind(e.prefixPath,{baseFs:e.packageFs})??new _t,o=new Set(["preinstall","install","postinstall"]);for(let a of r.scripts.keys())o.has(a)||r.scripts.delete(a);return{manifest:{bin:r.bin,scripts:r.scripts},misc:{hasBindingGyp:CA.hasBindingGyp(e)}}}async function Jwt(t,e,r,o,{installChangedByUser:a}){let n="";n+=`# Warning: This file is automatically generated. Removing it is fine, but will -`,n+=`# cause your node_modules installation to become invalidated. -`,n+=` -`,n+=`__metadata: -`,n+=` version: ${K1e} -`,n+=` nmMode: ${o.value} -`;let u=Array.from(e.keys()).sort(),A=G.stringifyLocator(t.topLevelWorkspace.anchoredLocator);for(let E of u){let w=e.get(E);n+=` -`,n+=`${JSON.stringify(E)}: -`,n+=` locations: -`;for(let D of w.locations){let b=V.contains(t.cwd,D);if(b===null)throw new Error(`Assertion failed: Expected the path to be within the project (${D})`);n+=` - ${JSON.stringify(b)} -`}if(w.aliases.length>0){n+=` aliases: -`;for(let D of w.aliases)n+=` - ${JSON.stringify(D)} -`}if(E===A&&r.size>0){n+=` bin: -`;for(let[D,b]of r){let C=V.contains(t.cwd,D);if(C===null)throw new Error(`Assertion failed: Expected the path to be within the project (${D})`);n+=` ${JSON.stringify(C)}: -`;for(let[T,N]of b){let U=V.relative(V.join(D,xi),N);n+=` ${JSON.stringify(T)}: ${JSON.stringify(U)} -`}}}}let p=t.cwd,h=V.join(p,xi,J1e);a&&await ae.removePromise(h),await ae.changeFilePromise(h,n,{automaticNewlines:!0})}async function Jj(t,{unrollAliases:e=!1}={}){let r=t.cwd,o=V.join(r,xi,J1e),a;try{a=await ae.statPromise(o)}catch{}if(!a)return null;let n=Vi(await ae.readFilePromise(o,"utf8"));if(n.__metadata.version>K1e)return null;let u=n.__metadata.nmMode||"classic",A=new Map,p=new Map;delete n.__metadata;for(let[h,E]of Object.entries(n)){let w=E.locations.map(b=>V.join(r,b)),D=E.bin;if(D)for(let[b,C]of Object.entries(D)){let T=V.join(r,Ae.toPortablePath(b)),N=qe.getMapWithDefault(p,T);for(let[U,J]of Object.entries(C))N.set(U,Ae.toPortablePath([T,xi,J].join(V.sep)))}if(A.set(h,{target:Bt.dot,linkType:"HARD",locations:w,aliases:E.aliases||[]}),e&&E.aliases)for(let b of E.aliases){let{scope:C,name:T}=G.parseLocator(h),N=G.makeLocator(G.makeIdent(C,T),b),U=G.stringifyLocator(N);A.set(U,{target:Bt.dot,linkType:"HARD",locations:w,aliases:[]})}}return{locatorMap:A,binSymlinks:p,locationTree:z1e(A,{skipPrefix:t.cwd}),nmMode:u,mtimeMs:a.mtimeMs}}var RC=async(t,e)=>{if(t.split(V.sep).indexOf(xi)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${t}`);try{let r;if(!e.innerLoop&&(r=await ae.lstatPromise(t),!r.isDirectory()&&!r.isSymbolicLink()||r.isSymbolicLink()&&!e.isWorkspaceDir)){await ae.unlinkPromise(t);return}let o=await ae.readdirPromise(t,{withFileTypes:!0});for(let n of o){let u=V.join(t,n.name);n.isDirectory()?(n.name!==xi||e&&e.innerLoop)&&await RC(u,{innerLoop:!0,contentsOnly:!1}):await ae.unlinkPromise(u)}let a=!e.innerLoop&&e.isWorkspaceDir&&r?.isSymbolicLink();!e.contentsOnly&&!a&&await ae.rmdirPromise(t)}catch(r){if(r.code!=="ENOENT"&&r.code!=="ENOTEMPTY")throw r}},G1e=4,eF=(t,{skipPrefix:e})=>{let r=V.contains(e,t);if(r===null)throw new Error(`Assertion failed: Writing attempt prevented to ${t} which is outside project root: ${e}`);let o=r.split(V.sep).filter(p=>p!==""),a=o.indexOf(xi),n=o.slice(0,a).join(V.sep),u=V.join(e,n),A=o.slice(a);return{locationRoot:u,segments:A}},z1e=(t,{skipPrefix:e})=>{let r=new Map;if(t===null)return r;let o=()=>({children:new Map,linkType:"HARD"});for(let[a,n]of t.entries()){if(n.linkType==="SOFT"&&V.contains(e,n.target)!==null){let A=qe.getFactoryWithDefault(r,n.target,o);A.locator=a,A.linkType=n.linkType}for(let u of n.locations){let{locationRoot:A,segments:p}=eF(u,{skipPrefix:e}),h=qe.getFactoryWithDefault(r,A,o);for(let E=0;E{if(process.platform==="win32"&&r==="junctions"){let o;try{o=await ae.lstatPromise(t)}catch{}if(!o||o.isDirectory()){await ae.symlinkPromise(t,e,"junction");return}}await ae.symlinkPromise(V.relative(V.dirname(e),t),e)};async function X1e(t,e,r){let o=V.join(t,`${zj.default.randomBytes(16).toString("hex")}.tmp`);try{await ae.writeFilePromise(o,r);try{await ae.linkPromise(o,e)}catch{}}finally{await ae.unlinkPromise(o)}}async function zwt({srcPath:t,dstPath:e,entry:r,globalHardlinksStore:o,baseFs:a,nmMode:n}){if(r.kind==="file"){if(n.value==="hardlinks-global"&&o&&r.digest){let A=V.join(o,r.digest.substring(0,2),`${r.digest.substring(2)}.dat`),p;try{let h=await ae.statPromise(A);if(h&&(!r.mtimeMs||h.mtimeMs>r.mtimeMs||h.mtimeMs{await ae.mkdirPromise(t,{recursive:!0});let A=async(E=Bt.dot)=>{let w=V.join(e,E),D=await r.readdirPromise(w,{withFileTypes:!0}),b=new Map;for(let C of D){let T=V.join(E,C.name),N,U=V.join(w,C.name);if(C.isFile()){if(N={kind:"file",mode:(await r.lstatPromise(U)).mode},a.value==="hardlinks-global"){let J=await bn.checksumFile(U,{baseFs:r,algorithm:"sha1"});N.digest=J}}else if(C.isDirectory())N={kind:"directory"};else if(C.isSymbolicLink())N={kind:"symlink",symlinkTo:await r.readlinkPromise(U)};else throw new Error(`Unsupported file type (file: ${U}, mode: 0o${await r.statSync(U).mode.toString(8).padStart(6,"0")})`);if(b.set(T,N),C.isDirectory()&&T!==xi){let J=await A(T);for(let[te,le]of J)b.set(te,le)}}return b},p;if(a.value==="hardlinks-global"&&o&&u){let E=V.join(o,u.substring(0,2),`${u.substring(2)}.json`);try{p=new Map(Object.entries(JSON.parse(await ae.readFilePromise(E,"utf8"))))}catch{p=await A()}}else p=await A();let h=!1;for(let[E,w]of p){let D=V.join(e,E),b=V.join(t,E);if(w.kind==="directory")await ae.mkdirPromise(b,{recursive:!0});else if(w.kind==="file"){let C=w.mtimeMs;await zwt({srcPath:D,dstPath:b,entry:w,nmMode:a,baseFs:r,globalHardlinksStore:o}),w.mtimeMs!==C&&(h=!0)}else w.kind==="symlink"&&await Zj(V.resolve(V.dirname(b),w.symlinkTo),b,n)}if(a.value==="hardlinks-global"&&o&&h&&u){let E=V.join(o,u.substring(0,2),`${u.substring(2)}.json`);await ae.removePromise(E),await X1e(o,E,Buffer.from(JSON.stringify(Object.fromEntries(p))))}};function Zwt(t,e,r,o){let a=new Map,n=new Map,u=new Map,A=!1,p=(h,E,w,D,b)=>{let C=!0,T=V.join(h,E),N=new Set;if(E===xi||E.startsWith("@")){let J;try{J=ae.statSync(T)}catch{}C=!!J,J?J.mtimeMs>r?(A=!0,N=new Set(ae.readdirSync(T))):N=new Set(w.children.get(E).children.keys()):A=!0;let te=e.get(h);if(te){let le=V.join(h,xi,$Q),ce;try{ce=ae.statSync(le)}catch{}if(!ce)A=!0;else if(ce.mtimeMs>r){A=!0;let ue=new Set(ae.readdirSync(le)),Ie=new Map;n.set(h,Ie);for(let[he,De]of te)ue.has(he)&&Ie.set(he,De)}else n.set(h,te)}}else C=b.has(E);let U=w.children.get(E);if(C){let{linkType:J,locator:te}=U,le={children:new Map,linkType:J,locator:te};if(D.children.set(E,le),te){let ce=qe.getSetWithDefault(u,te);ce.add(T),u.set(te,ce)}for(let ce of U.children.keys())p(T,ce,U,le,N)}else U.locator&&o.storedBuildState.delete(G.parseLocator(U.locator).locatorHash)};for(let[h,E]of t){let{linkType:w,locator:D}=E,b={children:new Map,linkType:w,locator:D};if(a.set(h,b),D){let C=qe.getSetWithDefault(u,E.locator);C.add(h),u.set(E.locator,C)}E.children.has(xi)&&p(h,xi,E,b,new Set)}return{locationTree:a,binSymlinks:n,locatorLocations:u,installChangedByUser:A}}function Z1e(t){let e=G.parseDescriptor(t);return G.isVirtualDescriptor(e)&&(e=G.devirtualizeDescriptor(e)),e.range.startsWith("link:")}async function $wt(t,e,r,{loadManifest:o}){let a=new Map;for(let[A,{locations:p}]of t){let h=Z1e(A)?null:await o(A,p[0]),E=new Map;if(h)for(let[w,D]of h.bin){let b=V.join(p[0],D);D!==""&&ae.existsSync(b)&&E.set(w,D)}a.set(A,E)}let n=new Map,u=(A,p,h)=>{let E=new Map,w=V.contains(r,A);if(h.locator&&w!==null){let D=a.get(h.locator);for(let[b,C]of D){let T=V.join(A,Ae.toPortablePath(C));E.set(b,T)}for(let[b,C]of h.children){let T=V.join(A,b),N=u(T,T,C);N.size>0&&n.set(A,new Map([...n.get(A)||new Map,...N]))}}else for(let[D,b]of h.children){let C=u(V.join(A,D),p,b);for(let[T,N]of C)E.set(T,N)}return E};for(let[A,p]of e){let h=u(A,A,p);h.size>0&&n.set(A,new Map([...n.get(A)||new Map,...h]))}return n}var W1e=(t,e)=>{if(!t||!e)return t===e;let r=G.parseLocator(t);G.isVirtualLocator(r)&&(r=G.devirtualizeLocator(r));let o=G.parseLocator(e);return G.isVirtualLocator(o)&&(o=G.devirtualizeLocator(o)),G.areLocatorsEqual(r,o)};function $j(t){return V.join(t.get("globalFolder"),"store")}async function e1t(t,e,{baseFs:r,project:o,report:a,loadManifest:n,realLocatorChecksums:u}){let A=V.join(o.cwd,xi),{locationTree:p,binSymlinks:h,locatorLocations:E,installChangedByUser:w}=Zwt(t.locationTree,t.binSymlinks,t.mtimeMs,o),D=z1e(e,{skipPrefix:o.cwd}),b=[],C=async({srcDir:De,dstDir:Ee,linkType:g,globalHardlinksStore:me,nmMode:Ce,windowsLinkType:fe,packageChecksum:ie})=>{let Z=(async()=>{try{g==="SOFT"?(await ae.mkdirPromise(V.dirname(Ee),{recursive:!0}),await Zj(V.resolve(De),Ee,fe)):await Xwt(Ee,De,{baseFs:r,globalHardlinksStore:me,nmMode:Ce,windowsLinkType:fe,packageChecksum:ie})}catch(Se){throw Se.message=`While persisting ${De} -> ${Ee} ${Se.message}`,Se}finally{le.tick()}})().then(()=>b.splice(b.indexOf(Z),1));b.push(Z),b.length>G1e&&await Promise.race(b)},T=async(De,Ee,g)=>{let me=(async()=>{let Ce=async(fe,ie,Z)=>{try{Z.innerLoop||await ae.mkdirPromise(ie,{recursive:!0});let Se=await ae.readdirPromise(fe,{withFileTypes:!0});for(let Re of Se){if(!Z.innerLoop&&Re.name===$Q)continue;let ht=V.join(fe,Re.name),q=V.join(ie,Re.name);Re.isDirectory()?(Re.name!==xi||Z&&Z.innerLoop)&&(await ae.mkdirPromise(q,{recursive:!0}),await Ce(ht,q,{...Z,innerLoop:!0})):Ie.value==="hardlinks-local"||Ie.value==="hardlinks-global"?await ae.linkPromise(ht,q):await ae.copyFilePromise(ht,q,V1e.default.constants.COPYFILE_FICLONE)}}catch(Se){throw Z.innerLoop||(Se.message=`While cloning ${fe} -> ${ie} ${Se.message}`),Se}finally{Z.innerLoop||le.tick()}};await Ce(De,Ee,g)})().then(()=>b.splice(b.indexOf(me),1));b.push(me),b.length>G1e&&await Promise.race(b)},N=async(De,Ee,g)=>{if(g)for(let[me,Ce]of Ee.children){let fe=g.children.get(me);await N(V.join(De,me),Ce,fe)}else{Ee.children.has(xi)&&await RC(V.join(De,xi),{contentsOnly:!1});let me=V.basename(De)===xi&&p.has(V.join(V.dirname(De)));await RC(De,{contentsOnly:De===A,isWorkspaceDir:me})}};for(let[De,Ee]of p){let g=D.get(De);for(let[me,Ce]of Ee.children){if(me===".")continue;let fe=g&&g.children.get(me),ie=V.join(De,me);await N(ie,Ce,fe)}}let U=async(De,Ee,g)=>{if(g){W1e(Ee.locator,g.locator)||await RC(De,{contentsOnly:Ee.linkType==="HARD"});for(let[me,Ce]of Ee.children){let fe=g.children.get(me);await U(V.join(De,me),Ce,fe)}}else{Ee.children.has(xi)&&await RC(V.join(De,xi),{contentsOnly:!0});let me=V.basename(De)===xi&&D.has(V.join(V.dirname(De)));await RC(De,{contentsOnly:Ee.linkType==="HARD",isWorkspaceDir:me})}};for(let[De,Ee]of D){let g=p.get(De);for(let[me,Ce]of Ee.children){if(me===".")continue;let fe=g&&g.children.get(me);await U(V.join(De,me),Ce,fe)}}let J=new Map,te=[];for(let[De,Ee]of E)for(let g of Ee){let{locationRoot:me,segments:Ce}=eF(g,{skipPrefix:o.cwd}),fe=D.get(me),ie=me;if(fe){for(let Z of Ce)if(ie=V.join(ie,Z),fe=fe.children.get(Z),!fe)break;if(fe){let Z=W1e(fe.locator,De),Se=e.get(fe.locator),Re=Se.target,ht=ie,q=Se.linkType;if(Z)J.has(Re)||J.set(Re,ht);else if(Re!==ht){let nt=G.parseLocator(fe.locator);G.isVirtualLocator(nt)&&(nt=G.devirtualizeLocator(nt)),te.push({srcDir:Re,dstDir:ht,linkType:q,realLocatorHash:nt.locatorHash})}}}}for(let[De,{locations:Ee}]of e.entries())for(let g of Ee){let{locationRoot:me,segments:Ce}=eF(g,{skipPrefix:o.cwd}),fe=p.get(me),ie=D.get(me),Z=me,Se=e.get(De),Re=G.parseLocator(De);G.isVirtualLocator(Re)&&(Re=G.devirtualizeLocator(Re));let ht=Re.locatorHash,q=Se.target,nt=g;if(q===nt)continue;let Le=Se.linkType;for(let Te of Ce)ie=ie.children.get(Te);if(!fe)te.push({srcDir:q,dstDir:nt,linkType:Le,realLocatorHash:ht});else for(let Te of Ce)if(Z=V.join(Z,Te),fe=fe.children.get(Te),!fe){te.push({srcDir:q,dstDir:nt,linkType:Le,realLocatorHash:ht});break}}let le=Ws.progressViaCounter(te.length),ce=a.reportProgress(le),ue=o.configuration.get("nmMode"),Ie={value:ue},he=o.configuration.get("winLinkType");try{let De=Ie.value==="hardlinks-global"?`${$j(o.configuration)}/v1`:null;if(De&&!await ae.existsPromise(De)){await ae.mkdirpPromise(De);for(let g=0;g<256;g++)await ae.mkdirPromise(V.join(De,g.toString(16).padStart(2,"0")))}for(let g of te)(g.linkType==="SOFT"||!J.has(g.srcDir))&&(J.set(g.srcDir,g.dstDir),await C({...g,globalHardlinksStore:De,nmMode:Ie,windowsLinkType:he,packageChecksum:u.get(g.realLocatorHash)||null}));await Promise.all(b),b.length=0;for(let g of te){let me=J.get(g.srcDir);g.linkType!=="SOFT"&&g.dstDir!==me&&await T(me,g.dstDir,{nmMode:Ie})}await Promise.all(b),await ae.mkdirPromise(A,{recursive:!0});let Ee=await $wt(e,D,o.cwd,{loadManifest:n});await t1t(h,Ee,o.cwd,he),await Jwt(o,e,Ee,Ie,{installChangedByUser:w}),ue=="hardlinks-global"&&Ie.value=="hardlinks-local"&&a.reportWarningOnce(74,"'nmMode' has been downgraded to 'hardlinks-local' due to global cache and install folder being on different devices")}finally{ce.stop()}}async function t1t(t,e,r,o){for(let a of t.keys()){if(V.contains(r,a)===null)throw new Error(`Assertion failed. Excepted bin symlink location to be inside project dir, instead it was at ${a}`);if(!e.has(a)){let n=V.join(a,xi,$Q);await ae.removePromise(n)}}for(let[a,n]of e){if(V.contains(r,a)===null)throw new Error(`Assertion failed. Excepted bin symlink location to be inside project dir, instead it was at ${a}`);let u=V.join(a,xi,$Q),A=t.get(a)||new Map;await ae.mkdirPromise(u,{recursive:!0});for(let p of A.keys())n.has(p)||(await ae.removePromise(V.join(u,p)),process.platform==="win32"&&await ae.removePromise(V.join(u,`${p}.cmd`)));for(let[p,h]of n){let E=A.get(p),w=V.join(u,p);E!==h&&(process.platform==="win32"?await(0,Y1e.default)(Ae.fromPortablePath(h),Ae.fromPortablePath(w),{createPwshFile:!1}):(await ae.removePromise(w),await Zj(h,w,o),V.contains(r,await ae.realpathPromise(h))!==null&&await ae.chmodPromise(h,493)))}}}Ve();St();sA();var Sv=class extends Yh{constructor(){super(...arguments);this.mode="loose"}makeInstaller(r){return new eG(r)}},eG=class extends pd{constructor(){super(...arguments);this.mode="loose"}async transformPnpSettings(r){let o=new qs({baseFs:new iA({maxOpenFiles:80,readOnlyArchives:!0})}),a=F1e(r,this.opts.project.cwd,o),{tree:n,errors:u}=pv(a,{pnpifyFs:!1,project:this.opts.project});if(!n){for(let{messageName:w,text:D}of u)this.opts.report.reportError(w,D);return}let A=new Map;r.fallbackPool=A;let p=(w,D)=>{let b=G.parseLocator(D.locator),C=G.stringifyIdent(b);C===w?A.set(w,b.reference):A.set(w,[C,b.reference])},h=V.join(this.opts.project.cwd,mr.nodeModules),E=n.get(h);if(!(typeof E>"u")){if("target"in E)throw new Error("Assertion failed: Expected the root junction point to be a directory");for(let w of E.dirList){let D=V.join(h,w),b=n.get(D);if(typeof b>"u")throw new Error("Assertion failed: Expected the child to have been registered");if("target"in b)p(w,b);else for(let C of b.dirList){let T=V.join(D,C),N=n.get(T);if(typeof N>"u")throw new Error("Assertion failed: Expected the subchild to have been registered");if("target"in N)p(`${w}/${C}`,N);else throw new Error("Assertion failed: Expected the leaf junction to be a package")}}}}};var r1t={hooks:{cleanGlobalArtifacts:async t=>{let e=$j(t);await ae.removePromise(e)}},configuration:{nmHoistingLimits:{description:"Prevents packages to be hoisted past specific levels",type:"STRING",values:["workspaces","dependencies","none"],default:"none"},nmMode:{description:"Defines in which measure Yarn must use hardlinks and symlinks when generated `node_modules` directories.",type:"STRING",values:["classic","hardlinks-local","hardlinks-global"],default:"classic"},nmSelfReferences:{description:"Defines whether the linker should generate self-referencing symlinks for workspaces.",type:"BOOLEAN",default:!0}},linkers:[Dv,Sv]},n1t=r1t;var $G={};Vt($G,{NpmHttpFetcher:()=>bv,NpmRemapResolver:()=>kv,NpmSemverFetcher:()=>rp,NpmSemverResolver:()=>Qv,NpmTagResolver:()=>Fv,default:()=>yvt,npmConfigUtils:()=>si,npmHttpUtils:()=>en,npmPublishUtils:()=>KC});Ve();var o2e=et(ni());var Zn="npm:";var en={};Vt(en,{AuthType:()=>n2e,customPackageError:()=>hd,del:()=>g1t,get:()=>gd,getIdentUrl:()=>tF,getPackageMetadata:()=>NC,handleInvalidAuthenticationError:()=>Kh,post:()=>p1t,put:()=>h1t});Ve();Ve();St();var iG=et(Q2()),t2e=et(c8()),r2e=et(ni());var si={};Vt(si,{RegistryType:()=>$1e,getAuditRegistry:()=>i1t,getAuthConfiguration:()=>nG,getDefaultRegistry:()=>Pv,getPublishRegistry:()=>s1t,getRegistryConfiguration:()=>e2e,getScopeConfiguration:()=>rG,getScopeRegistry:()=>TC,normalizeRegistry:()=>uc});var $1e=(o=>(o.AUDIT_REGISTRY="npmAuditRegistry",o.FETCH_REGISTRY="npmRegistryServer",o.PUBLISH_REGISTRY="npmPublishRegistry",o))($1e||{});function uc(t){return t.replace(/\/$/,"")}function i1t({configuration:t}){return Pv({configuration:t,type:"npmAuditRegistry"})}function s1t(t,{configuration:e}){return t.publishConfig?.registry?uc(t.publishConfig.registry):t.name?TC(t.name.scope,{configuration:e,type:"npmPublishRegistry"}):Pv({configuration:e,type:"npmPublishRegistry"})}function TC(t,{configuration:e,type:r="npmRegistryServer"}){let o=rG(t,{configuration:e});if(o===null)return Pv({configuration:e,type:r});let a=o.get(r);return a===null?Pv({configuration:e,type:r}):uc(a)}function Pv({configuration:t,type:e="npmRegistryServer"}){let r=t.get(e);return uc(r!==null?r:t.get("npmRegistryServer"))}function e2e(t,{configuration:e}){let r=e.get("npmRegistries"),o=uc(t),a=r.get(o);if(typeof a<"u")return a;let n=r.get(o.replace(/^[a-z]+:/,""));return typeof n<"u"?n:null}function rG(t,{configuration:e}){if(t===null)return null;let o=e.get("npmScopes").get(t);return o||null}function nG(t,{configuration:e,ident:r}){let o=r&&rG(r.scope,{configuration:e});return o?.get("npmAuthIdent")||o?.get("npmAuthToken")?o:e2e(t,{configuration:e})||e}var n2e=(a=>(a[a.NO_AUTH=0]="NO_AUTH",a[a.BEST_EFFORT=1]="BEST_EFFORT",a[a.CONFIGURATION=2]="CONFIGURATION",a[a.ALWAYS_AUTH=3]="ALWAYS_AUTH",a))(n2e||{});async function Kh(t,{attemptedAs:e,registry:r,headers:o,configuration:a}){if(nF(t))throw new Jt(41,"Invalid OTP token");if(t.originalError?.name==="HTTPError"&&t.originalError?.response.statusCode===401)throw new Jt(41,`Invalid authentication (${typeof e!="string"?`as ${await m1t(r,o,{configuration:a})}`:`attempted as ${e}`})`)}function hd(t,e){let r=t.response?.statusCode;return r?r===404?"Package not found":r>=500&&r<600?`The registry appears to be down (using a ${pe.applyHyperlink(e,"local cache","https://yarnpkg.com/advanced/lexicon#local-cache")} might have protected you against such outages)`:null:null}function tF(t){return t.scope?`/@${t.scope}%2f${t.name}`:`/${t.name}`}var i2e=new Map,o1t=new Map;async function a1t(t){return await qe.getFactoryWithDefault(i2e,t,async()=>{let e=null;try{e=await ae.readJsonPromise(t)}catch{}return e})}async function l1t(t,e,{configuration:r,cached:o,registry:a,headers:n,version:u,...A}){return await qe.getFactoryWithDefault(o1t,t,async()=>await gd(tF(e),{...A,customErrorMessage:hd,configuration:r,registry:a,ident:e,headers:{...n,"If-None-Match":o?.etag,"If-Modified-Since":o?.lastModified},wrapNetworkRequest:async p=>async()=>{let h=await p();if(h.statusCode===304){if(o===null)throw new Error("Assertion failed: cachedMetadata should not be null");return{...h,body:o.metadata}}let E=c1t(JSON.parse(h.body.toString())),w={metadata:E,etag:h.headers.etag,lastModified:h.headers["last-modified"]};return i2e.set(t,Promise.resolve(w)),Promise.resolve().then(async()=>{let D=`${t}-${process.pid}.tmp`;await ae.mkdirPromise(V.dirname(D),{recursive:!0}),await ae.writeJsonPromise(D,w,{compact:!0}),await ae.renamePromise(D,t)}).catch(()=>{}),{...h,body:E}}}))}async function NC(t,{cache:e,project:r,registry:o,headers:a,version:n,...u}){let{configuration:A}=r;o=xv(A,{ident:t,registry:o});let p=A1t(A,o),h=V.join(p,`${G.slugifyIdent(t)}.json`),E=null;if(!r.lockfileNeedsRefresh&&(E=await a1t(h),E)){if(typeof n<"u"&&typeof E.metadata.versions[n]<"u")return E.metadata;if(A.get("enableOfflineMode")){let w=structuredClone(E.metadata),D=new Set;if(e){for(let C of Object.keys(w.versions)){let T=G.makeLocator(t,`npm:${C}`),N=e.getLocatorMirrorPath(T);(!N||!ae.existsSync(N))&&(delete w.versions[C],D.add(C))}let b=w["dist-tags"].latest;if(D.has(b)){let C=Object.keys(E.metadata.versions).sort(r2e.default.compare),T=C.indexOf(b);for(;D.has(C[T])&&T>=0;)T-=1;T>=0?w["dist-tags"].latest=C[T]:delete w["dist-tags"].latest}}return w}}return await l1t(h,t,{...u,configuration:A,cached:E,registry:o,headers:a,version:n})}var s2e=["name","dist.tarball","bin","scripts","os","cpu","libc","dependencies","dependenciesMeta","optionalDependencies","peerDependencies","peerDependenciesMeta","deprecated"];function c1t(t){return{"dist-tags":t["dist-tags"],versions:Object.fromEntries(Object.entries(t.versions).map(([e,r])=>[e,(0,t2e.default)(r,s2e)]))}}var u1t=bn.makeHash(...s2e).slice(0,6);function A1t(t,e){let r=f1t(t),o=new URL(e);return V.join(r,u1t,o.hostname)}function f1t(t){return V.join(t.get("globalFolder"),"metadata/npm")}async function gd(t,{configuration:e,headers:r,ident:o,authType:a,registry:n,...u}){n=xv(e,{ident:o,registry:n}),o&&o.scope&&typeof a>"u"&&(a=1);let A=await rF(n,{authType:a,configuration:e,ident:o});A&&(r={...r,authorization:A});try{return await on.get(t.charAt(0)==="/"?`${n}${t}`:t,{configuration:e,headers:r,...u})}catch(p){throw await Kh(p,{registry:n,configuration:e,headers:r}),p}}async function p1t(t,e,{attemptedAs:r,configuration:o,headers:a,ident:n,authType:u=3,registry:A,otp:p,...h}){A=xv(o,{ident:n,registry:A});let E=await rF(A,{authType:u,configuration:o,ident:n});E&&(a={...a,authorization:E}),p&&(a={...a,...LC(p)});try{return await on.post(A+t,e,{configuration:o,headers:a,...h})}catch(w){if(!nF(w)||p)throw await Kh(w,{attemptedAs:r,registry:A,configuration:o,headers:a}),w;p=await sG(w,{configuration:o});let D={...a,...LC(p)};try{return await on.post(`${A}${t}`,e,{configuration:o,headers:D,...h})}catch(b){throw await Kh(b,{attemptedAs:r,registry:A,configuration:o,headers:a}),b}}}async function h1t(t,e,{attemptedAs:r,configuration:o,headers:a,ident:n,authType:u=3,registry:A,otp:p,...h}){A=xv(o,{ident:n,registry:A});let E=await rF(A,{authType:u,configuration:o,ident:n});E&&(a={...a,authorization:E}),p&&(a={...a,...LC(p)});try{return await on.put(A+t,e,{configuration:o,headers:a,...h})}catch(w){if(!nF(w))throw await Kh(w,{attemptedAs:r,registry:A,configuration:o,headers:a}),w;p=await sG(w,{configuration:o});let D={...a,...LC(p)};try{return await on.put(`${A}${t}`,e,{configuration:o,headers:D,...h})}catch(b){throw await Kh(b,{attemptedAs:r,registry:A,configuration:o,headers:a}),b}}}async function g1t(t,{attemptedAs:e,configuration:r,headers:o,ident:a,authType:n=3,registry:u,otp:A,...p}){u=xv(r,{ident:a,registry:u});let h=await rF(u,{authType:n,configuration:r,ident:a});h&&(o={...o,authorization:h}),A&&(o={...o,...LC(A)});try{return await on.del(u+t,{configuration:r,headers:o,...p})}catch(E){if(!nF(E)||A)throw await Kh(E,{attemptedAs:e,registry:u,configuration:r,headers:o}),E;A=await sG(E,{configuration:r});let w={...o,...LC(A)};try{return await on.del(`${u}${t}`,{configuration:r,headers:w,...p})}catch(D){throw await Kh(D,{attemptedAs:e,registry:u,configuration:r,headers:o}),D}}}function xv(t,{ident:e,registry:r}){if(typeof r>"u"&&e)return TC(e.scope,{configuration:t});if(typeof r!="string")throw new Error("Assertion failed: The registry should be a string");return uc(r)}async function rF(t,{authType:e=2,configuration:r,ident:o}){let a=nG(t,{configuration:r,ident:o}),n=d1t(a,e);if(!n)return null;let u=await r.reduceHook(A=>A.getNpmAuthenticationHeader,void 0,t,{configuration:r,ident:o});if(u)return u;if(a.get("npmAuthToken"))return`Bearer ${a.get("npmAuthToken")}`;if(a.get("npmAuthIdent")){let A=a.get("npmAuthIdent");return A.includes(":")?`Basic ${Buffer.from(A).toString("base64")}`:`Basic ${A}`}if(n&&e!==1)throw new Jt(33,"No authentication configured for request");return null}function d1t(t,e){switch(e){case 2:return t.get("npmAlwaysAuth");case 1:case 3:return!0;case 0:return!1;default:throw new Error("Unreachable")}}async function m1t(t,e,{configuration:r}){if(typeof e>"u"||typeof e.authorization>"u")return"an anonymous user";try{return(await on.get(new URL(`${t}/-/whoami`).href,{configuration:r,headers:e,jsonResponse:!0})).username??"an unknown user"}catch{return"an unknown user"}}async function sG(t,{configuration:e}){let r=t.originalError?.response.headers["npm-notice"];if(r&&(await Lt.start({configuration:e,stdout:process.stdout,includeFooter:!1},async a=>{if(a.reportInfo(0,r.replace(/(https?:\/\/\S+)/g,pe.pretty(e,"$1",pe.Type.URL))),!process.env.YARN_IS_TEST_ENV){let n=r.match(/open (https?:\/\/\S+)/i);if(n&&Xi.openUrl){let{openNow:u}=await(0,iG.prompt)({type:"confirm",name:"openNow",message:"Do you want to try to open this url now?",required:!0,initial:!0,onCancel:()=>process.exit(130)});u&&(await Xi.openUrl(n[1])||(a.reportSeparator(),a.reportWarning(0,"We failed to automatically open the url; you'll have to open it yourself in your browser of choice.")))}}}),process.stdout.write(` -`)),process.env.YARN_IS_TEST_ENV)return process.env.YARN_INJECT_NPM_2FA_TOKEN||"";let{otp:o}=await(0,iG.prompt)({type:"password",name:"otp",message:"One-time password:",required:!0,onCancel:()=>process.exit(130)});return process.stdout.write(` -`),o}function nF(t){if(t.originalError?.name!=="HTTPError")return!1;try{return(t.originalError?.response.headers["www-authenticate"].split(/,\s*/).map(r=>r.toLowerCase())).includes("otp")}catch{return!1}}function LC(t){return{"npm-otp":t}}var bv=class{supports(e,r){if(!e.reference.startsWith(Zn))return!1;let{selector:o,params:a}=G.parseRange(e.reference);return!(!o2e.default.valid(o)||a===null||typeof a.__archiveUrl!="string")}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let{params:o}=G.parseRange(e.reference);if(o===null||typeof o.__archiveUrl!="string")throw new Error("Assertion failed: The archiveUrl querystring parameter should have been available");let a=await gd(o.__archiveUrl,{customErrorMessage:hd,configuration:r.project.configuration,ident:e});return await $i.convertToZip(a,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}};Ve();var kv=class{supportsDescriptor(e,r){return!(!e.range.startsWith(Zn)||!G.tryParseDescriptor(e.range.slice(Zn.length),!0))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){let o=r.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(Zn.length),!0));return r.resolver.getResolutionDependencies(o,r)}async getCandidates(e,r,o){let a=o.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(Zn.length),!0));return await o.resolver.getCandidates(a,r,o)}async getSatisfying(e,r,o,a){let n=a.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(Zn.length),!0));return a.resolver.getSatisfying(n,r,o,a)}resolve(e,r){throw new Error("Unreachable")}};Ve();Ve();var a2e=et(ni());var rp=class t{supports(e,r){if(!e.reference.startsWith(Zn))return!1;let o=new URL(e.reference);return!(!a2e.default.valid(o.pathname)||o.searchParams.has("__archiveUrl"))}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote registry`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let o;try{o=await gd(t.getLocatorUrl(e),{customErrorMessage:hd,configuration:r.project.configuration,ident:e})}catch{o=await gd(t.getLocatorUrl(e).replace(/%2f/g,"/"),{customErrorMessage:hd,configuration:r.project.configuration,ident:e})}return await $i.convertToZip(o,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}static isConventionalTarballUrl(e,r,{configuration:o}){let a=TC(e.scope,{configuration:o}),n=t.getLocatorUrl(e);return r=r.replace(/^https?:(\/\/(?:[^/]+\.)?npmjs.org(?:$|\/))/,"https:$1"),a=a.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r=r.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r===a+n||r===a+n.replace(/%2f/g,"/")}static getLocatorUrl(e){let r=Ur.clean(e.reference.slice(Zn.length));if(r===null)throw new Jt(10,"The npm semver resolver got selected, but the version isn't semver");return`${tF(e)}/-/${e.name}-${r}.tgz`}};Ve();Ve();Ve();var oG=et(ni());var iF=G.makeIdent(null,"node-gyp"),y1t=/\b(node-gyp|prebuild-install)\b/,Qv=class{supportsDescriptor(e,r){return e.range.startsWith(Zn)?!!Ur.validRange(e.range.slice(Zn.length)):!1}supportsLocator(e,r){if(!e.reference.startsWith(Zn))return!1;let{selector:o}=G.parseRange(e.reference);return!!oG.default.valid(o)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=Ur.validRange(e.range.slice(Zn.length));if(a===null)throw new Error(`Expected a valid range, got ${e.range.slice(Zn.length)}`);let n=await NC(e,{cache:o.fetchOptions?.cache,project:o.project,version:oG.default.valid(a.raw)?a.raw:void 0}),u=qe.mapAndFilter(Object.keys(n.versions),h=>{try{let E=new Ur.SemVer(h);if(a.test(E))return E}catch{}return qe.mapAndFilter.skip}),A=u.filter(h=>!n.versions[h.raw].deprecated),p=A.length>0?A:u;return p.sort((h,E)=>-h.compare(E)),p.map(h=>{let E=G.makeLocator(e,`${Zn}${h.raw}`),w=n.versions[h.raw].dist.tarball;return rp.isConventionalTarballUrl(E,w,{configuration:o.project.configuration})?E:G.bindLocator(E,{__archiveUrl:w})})}async getSatisfying(e,r,o,a){let n=Ur.validRange(e.range.slice(Zn.length));if(n===null)throw new Error(`Expected a valid range, got ${e.range.slice(Zn.length)}`);return{locators:qe.mapAndFilter(o,p=>{if(p.identHash!==e.identHash)return qe.mapAndFilter.skip;let h=G.tryParseRange(p.reference,{requireProtocol:Zn});if(!h)return qe.mapAndFilter.skip;let E=new Ur.SemVer(h.selector);return n.test(E)?{locator:p,version:E}:qe.mapAndFilter.skip}).sort((p,h)=>-p.version.compare(h.version)).map(({locator:p})=>p),sorted:!0}}async resolve(e,r){let{selector:o}=G.parseRange(e.reference),a=Ur.clean(o);if(a===null)throw new Jt(10,"The npm semver resolver got selected, but the version isn't semver");let n=await NC(e,{cache:r.fetchOptions?.cache,project:r.project,version:a});if(!Object.hasOwn(n,"versions"))throw new Jt(15,'Registry returned invalid data for - missing "versions" field');if(!Object.hasOwn(n.versions,a))throw new Jt(16,`Registry failed to return reference "${a}"`);let u=new _t;if(u.load(n.versions[a]),!u.dependencies.has(iF.identHash)&&!u.peerDependencies.has(iF.identHash)){for(let A of u.scripts.values())if(A.match(y1t)){u.dependencies.set(iF.identHash,G.makeDescriptor(iF,"latest"));break}}return{...e,version:a,languageName:"node",linkType:"HARD",conditions:u.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(u.dependencies),peerDependencies:u.peerDependencies,dependenciesMeta:u.dependenciesMeta,peerDependenciesMeta:u.peerDependenciesMeta,bin:u.bin}}};Ve();Ve();var l2e=et(ni());var Fv=class{supportsDescriptor(e,r){return!(!e.range.startsWith(Zn)||!by.test(e.range.slice(Zn.length)))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=e.range.slice(Zn.length),n=await NC(e,{cache:o.fetchOptions?.cache,project:o.project});if(!Object.hasOwn(n,"dist-tags"))throw new Jt(15,'Registry returned invalid data - missing "dist-tags" field');let u=n["dist-tags"];if(!Object.hasOwn(u,a))throw new Jt(16,`Registry failed to return tag "${a}"`);let A=u[a],p=G.makeLocator(e,`${Zn}${A}`),h=n.versions[A].dist.tarball;return rp.isConventionalTarballUrl(p,h,{configuration:o.project.configuration})?[p]:[G.bindLocator(p,{__archiveUrl:h})]}async getSatisfying(e,r,o,a){let n=[];for(let u of o){if(u.identHash!==e.identHash)continue;let A=G.tryParseRange(u.reference,{requireProtocol:Zn});if(!(!A||!l2e.default.valid(A.selector))){if(A.params?.__archiveUrl){let p=G.makeRange({protocol:Zn,selector:A.selector,source:null,params:null}),[h]=await a.resolver.getCandidates(G.makeDescriptor(e,p),r,a);if(u.reference!==h.reference)continue}n.push(u)}}return{locators:n,sorted:!1}}async resolve(e,r){throw new Error("Unreachable")}};var KC={};Vt(KC,{getGitHead:()=>dvt,getPublishAccess:()=>XBe,getReadmeContent:()=>ZBe,makePublishBody:()=>gvt});Ve();Ve();St();var KG={};Vt(KG,{PackCommand:()=>VC,default:()=>XBt,packUtils:()=>BA});Ve();Ve();Ve();St();Gt();var BA={};Vt(BA,{genPackList:()=>PF,genPackStream:()=>VG,genPackageManifest:()=>UBe,hasPackScripts:()=>WG,prepareForPack:()=>YG});Ve();St();var GG=et(Xo()),OBe=et(RBe()),MBe=ve("zlib"),_Bt=["/package.json","/readme","/readme.*","/license","/license.*","/licence","/licence.*","/changelog","/changelog.*"],HBt=["/package.tgz",".github",".git",".hg","node_modules",".npmignore",".gitignore",".#*",".DS_Store"];async function WG(t){return!!(hn.hasWorkspaceScript(t,"prepack")||hn.hasWorkspaceScript(t,"postpack"))}async function YG(t,{report:e},r){await hn.maybeExecuteWorkspaceLifecycleScript(t,"prepack",{report:e});try{let o=V.join(t.cwd,_t.fileName);await ae.existsPromise(o)&&await t.manifest.loadFile(o,{baseFs:ae}),await r()}finally{await hn.maybeExecuteWorkspaceLifecycleScript(t,"postpack",{report:e})}}async function VG(t,e){typeof e>"u"&&(e=await PF(t));let r=new Set;for(let n of t.manifest.publishConfig?.executableFiles??new Set)r.add(V.normalize(n));for(let n of t.manifest.bin.values())r.add(V.normalize(n));let o=OBe.default.pack();process.nextTick(async()=>{for(let n of e){let u=V.normalize(n),A=V.resolve(t.cwd,u),p=V.join("package",u),h=await ae.lstatPromise(A),E={name:p,mtime:new Date(Si.SAFE_TIME*1e3)},w=r.has(u)?493:420,D,b,C=new Promise((N,U)=>{D=N,b=U}),T=N=>{N?b(N):D()};if(h.isFile()){let N;u==="package.json"?N=Buffer.from(JSON.stringify(await UBe(t),null,2)):N=await ae.readFilePromise(A),o.entry({...E,mode:w,type:"file"},N,T)}else h.isSymbolicLink()?o.entry({...E,mode:w,type:"symlink",linkname:await ae.readlinkPromise(A)},T):T(new Error(`Unsupported file type ${h.mode} for ${Ae.fromPortablePath(u)}`));await C}o.finalize()});let a=(0,MBe.createGzip)();return o.pipe(a),a}async function UBe(t){let e=JSON.parse(JSON.stringify(t.manifest.raw));return await t.project.configuration.triggerHook(r=>r.beforeWorkspacePacking,t,e),e}async function PF(t){let e=t.project,r=e.configuration,o={accept:[],reject:[]};for(let w of HBt)o.reject.push(w);for(let w of _Bt)o.accept.push(w);o.reject.push(r.get("rcFilename"));let a=w=>{if(w===null||!w.startsWith(`${t.cwd}/`))return;let D=V.relative(t.cwd,w),b=V.resolve(Bt.root,D);o.reject.push(b)};a(V.resolve(e.cwd,mr.lockfile)),a(r.get("cacheFolder")),a(r.get("globalFolder")),a(r.get("installStatePath")),a(r.get("virtualFolder")),a(r.get("yarnPath")),await r.triggerHook(w=>w.populateYarnPaths,e,w=>{a(w)});for(let w of e.workspaces){let D=V.relative(t.cwd,w.cwd);D!==""&&!D.match(/^(\.\.)?\//)&&o.reject.push(`/${D}`)}let n={accept:[],reject:[]},u=t.manifest.publishConfig?.main??t.manifest.main,A=t.manifest.publishConfig?.module??t.manifest.module,p=t.manifest.publishConfig?.browser??t.manifest.browser,h=t.manifest.publishConfig?.bin??t.manifest.bin;u!=null&&n.accept.push(V.resolve(Bt.root,u)),A!=null&&n.accept.push(V.resolve(Bt.root,A)),typeof p=="string"&&n.accept.push(V.resolve(Bt.root,p));for(let w of h.values())n.accept.push(V.resolve(Bt.root,w));if(p instanceof Map)for(let[w,D]of p.entries())n.accept.push(V.resolve(Bt.root,w)),typeof D=="string"&&n.accept.push(V.resolve(Bt.root,D));let E=t.manifest.files!==null;if(E){n.reject.push("/*");for(let w of t.manifest.files)_Be(n.accept,w,{cwd:Bt.root})}return await qBt(t.cwd,{hasExplicitFileList:E,globalList:o,ignoreList:n})}async function qBt(t,{hasExplicitFileList:e,globalList:r,ignoreList:o}){let a=[],n=new Gu(t),u=[[Bt.root,[o]]];for(;u.length>0;){let[A,p]=u.pop(),h=await n.lstatPromise(A);if(!LBe(A,{globalList:r,ignoreLists:h.isDirectory()?null:p}))if(h.isDirectory()){let E=await n.readdirPromise(A),w=!1,D=!1;if(!e||A!==Bt.root)for(let T of E)w=w||T===".gitignore",D=D||T===".npmignore";let b=D?await TBe(n,A,".npmignore"):w?await TBe(n,A,".gitignore"):null,C=b!==null?[b].concat(p):p;LBe(A,{globalList:r,ignoreLists:p})&&(C=[...p,{accept:[],reject:["**/*"]}]);for(let T of E)u.push([V.resolve(A,T),C])}else(h.isFile()||h.isSymbolicLink())&&a.push(V.relative(Bt.root,A))}return a.sort()}async function TBe(t,e,r){let o={accept:[],reject:[]},a=await t.readFilePromise(V.join(e,r),"utf8");for(let n of a.split(/\n/g))_Be(o.reject,n,{cwd:e});return o}function jBt(t,{cwd:e}){let r=t[0]==="!";return r&&(t=t.slice(1)),t.match(/\.{0,1}\//)&&(t=V.resolve(e,t)),r&&(t=`!${t}`),t}function _Be(t,e,{cwd:r}){let o=e.trim();o===""||o[0]==="#"||t.push(jBt(o,{cwd:r}))}function LBe(t,{globalList:e,ignoreLists:r}){let o=SF(t,e.accept);if(o!==0)return o===2;let a=SF(t,e.reject);if(a!==0)return a===1;if(r!==null)for(let n of r){let u=SF(t,n.accept);if(u!==0)return u===2;let A=SF(t,n.reject);if(A!==0)return A===1}return!1}function SF(t,e){let r=e,o=[];for(let a=0;a{await YG(a,{report:p},async()=>{p.reportJson({base:Ae.fromPortablePath(a.cwd)});let h=await PF(a);for(let E of h)p.reportInfo(null,Ae.fromPortablePath(E)),p.reportJson({location:Ae.fromPortablePath(E)});if(!this.dryRun){let E=await VG(a,h);await ae.mkdirPromise(V.dirname(u),{recursive:!0});let w=ae.createWriteStream(u);E.pipe(w),await new Promise(D=>{w.on("finish",D)})}}),this.dryRun||(p.reportInfo(0,`Package archive generated in ${pe.pretty(r,u,pe.Type.PATH)}`),p.reportJson({output:Ae.fromPortablePath(u)}))})).exitCode()}};function GBt(t,{workspace:e}){let r=t.replace("%s",WBt(e)).replace("%v",YBt(e));return Ae.toPortablePath(r)}function WBt(t){return t.manifest.name!==null?G.slugifyIdent(t.manifest.name):"package"}function YBt(t){return t.manifest.version!==null?t.manifest.version:"unknown"}var VBt=["dependencies","devDependencies","peerDependencies"],KBt="workspace:",JBt=(t,e)=>{e.publishConfig&&(e.publishConfig.type&&(e.type=e.publishConfig.type),e.publishConfig.main&&(e.main=e.publishConfig.main),e.publishConfig.browser&&(e.browser=e.publishConfig.browser),e.publishConfig.module&&(e.module=e.publishConfig.module),e.publishConfig.exports&&(e.exports=e.publishConfig.exports),e.publishConfig.imports&&(e.imports=e.publishConfig.imports),e.publishConfig.bin&&(e.bin=e.publishConfig.bin));let r=t.project;for(let o of VBt)for(let a of t.manifest.getForScope(o).values()){let n=r.tryWorkspaceByDescriptor(a),u=G.parseRange(a.range);if(u.protocol===KBt)if(n===null){if(r.tryWorkspaceByIdent(a)===null)throw new Jt(21,`${G.prettyDescriptor(r.configuration,a)}: No local workspace found for this range`)}else{let A;G.areDescriptorsEqual(a,n.anchoredDescriptor)||u.selector==="*"?A=n.manifest.version??"0.0.0":u.selector==="~"||u.selector==="^"?A=`${u.selector}${n.manifest.version??"0.0.0"}`:A=u.selector;let p=o==="dependencies"?G.makeDescriptor(a,"unknown"):null,h=p!==null&&t.manifest.ensureDependencyMeta(p).optional?"optionalDependencies":o;e[h][G.stringifyIdent(a)]=A}}},zBt={hooks:{beforeWorkspacePacking:JBt},commands:[VC]},XBt=zBt;var JBe=ve("crypto"),zBe=et(KBe());async function gvt(t,e,{access:r,tag:o,registry:a,gitHead:n}){let u=t.manifest.name,A=t.manifest.version,p=G.stringifyIdent(u),h=(0,JBe.createHash)("sha1").update(e).digest("hex"),E=zBe.default.fromData(e).toString(),w=r??XBe(t,u),D=await ZBe(t),b=await BA.genPackageManifest(t),C=`${p}-${A}.tgz`,T=new URL(`${uc(a)}/${p}/-/${C}`);return{_id:p,_attachments:{[C]:{content_type:"application/octet-stream",data:e.toString("base64"),length:e.length}},name:p,access:w,"dist-tags":{[o]:A},versions:{[A]:{...b,_id:`${p}@${A}`,name:p,version:A,gitHead:n,dist:{shasum:h,integrity:E,tarball:T.toString()}}},readme:D}}async function dvt(t){try{let{stdout:e}=await Hr.execvp("git",["rev-parse","--revs-only","HEAD"],{cwd:t});return e.trim()===""?void 0:e.trim()}catch{return}}function XBe(t,e){let r=t.project.configuration;return t.manifest.publishConfig&&typeof t.manifest.publishConfig.access=="string"?t.manifest.publishConfig.access:r.get("npmPublishAccess")!==null?r.get("npmPublishAccess"):e.scope?"restricted":"public"}async function ZBe(t){let e=Ae.toPortablePath(`${t.cwd}/README.md`),r=t.manifest.name,a=`# ${G.stringifyIdent(r)} -`;try{a=await ae.readFilePromise(e,"utf8")}catch(n){if(n.code==="ENOENT")return a;throw n}return a}var ZG={npmAlwaysAuth:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"BOOLEAN",default:!1},npmAuthIdent:{description:"Authentication identity for the npm registry (_auth in npm and yarn v1)",type:"SECRET",default:null},npmAuthToken:{description:"Authentication token for the npm registry (_authToken in npm and yarn v1)",type:"SECRET",default:null}},$Be={npmAuditRegistry:{description:"Registry to query for audit reports",type:"STRING",default:null},npmPublishRegistry:{description:"Registry to push packages to",type:"STRING",default:null},npmRegistryServer:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"STRING",default:"https://registry.yarnpkg.com"}},mvt={configuration:{...ZG,...$Be,npmScopes:{description:"Settings per package scope",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{...ZG,...$Be}}},npmRegistries:{description:"Settings per registry",type:"MAP",normalizeKeys:uc,valueDefinition:{description:"",type:"SHAPE",properties:{...ZG}}}},fetchers:[bv,rp],resolvers:[kv,Qv,Fv]},yvt=mvt;var l5={};Vt(l5,{NpmAuditCommand:()=>zC,NpmInfoCommand:()=>XC,NpmLoginCommand:()=>ZC,NpmLogoutCommand:()=>eI,NpmPublishCommand:()=>tI,NpmTagAddCommand:()=>nI,NpmTagListCommand:()=>rI,NpmTagRemoveCommand:()=>iI,NpmWhoamiCommand:()=>sI,default:()=>Dvt,npmAuditTypes:()=>Xv,npmAuditUtils:()=>xF});Ve();Ve();Gt();var i5=et(Xo());il();var Xv={};Vt(Xv,{Environment:()=>Jv,Severity:()=>zv});var Jv=(o=>(o.All="all",o.Production="production",o.Development="development",o))(Jv||{}),zv=(n=>(n.Info="info",n.Low="low",n.Moderate="moderate",n.High="high",n.Critical="critical",n))(zv||{});var xF={};Vt(xF,{allSeverities:()=>JC,getPackages:()=>n5,getReportTree:()=>t5,getSeverityInclusions:()=>e5,getTopLevelDependencies:()=>r5});Ve();var eve=et(ni());var JC=["info","low","moderate","high","critical"];function e5(t){if(typeof t>"u")return new Set(JC);let e=JC.indexOf(t),r=JC.slice(e);return new Set(r)}function t5(t){let e={},r={children:e};for(let[o,a]of qe.sortMap(Object.entries(t),n=>n[0]))for(let n of qe.sortMap(a,u=>`${u.id}`))e[`${o}/${n.id}`]={value:pe.tuple(pe.Type.IDENT,G.parseIdent(o)),children:{ID:typeof n.id<"u"&&{label:"ID",value:pe.tuple(pe.Type.ID,n.id)},Issue:{label:"Issue",value:pe.tuple(pe.Type.NO_HINT,n.title)},URL:typeof n.url<"u"&&{label:"URL",value:pe.tuple(pe.Type.URL,n.url)},Severity:{label:"Severity",value:pe.tuple(pe.Type.NO_HINT,n.severity)},"Vulnerable Versions":{label:"Vulnerable Versions",value:pe.tuple(pe.Type.RANGE,n.vulnerable_versions)},"Tree Versions":{label:"Tree Versions",children:[...n.versions].sort(eve.default.compare).map(u=>({value:pe.tuple(pe.Type.REFERENCE,u)}))},Dependents:{label:"Dependents",children:qe.sortMap(n.dependents,u=>G.stringifyLocator(u)).map(u=>({value:pe.tuple(pe.Type.LOCATOR,u)}))}}};return r}function r5(t,e,{all:r,environment:o}){let a=[],n=r?t.workspaces:[e],u=["all","production"].includes(o),A=["all","development"].includes(o);for(let p of n)for(let h of p.anchoredPackage.dependencies.values())(p.manifest.devDependencies.has(h.identHash)?!A:!u)||a.push({workspace:p,dependency:h});return a}function n5(t,e,{recursive:r}){let o=new Map,a=new Set,n=[],u=(A,p)=>{let h=t.storedResolutions.get(p.descriptorHash);if(typeof h>"u")throw new Error("Assertion failed: The resolution should have been registered");if(!a.has(h))a.add(h);else return;let E=t.storedPackages.get(h);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");if(G.ensureDevirtualizedLocator(E).reference.startsWith("npm:")&&E.version!==null){let D=G.stringifyIdent(E),b=qe.getMapWithDefault(o,D);qe.getArrayWithDefault(b,E.version).push(A)}if(r)for(let D of E.dependencies.values())n.push([E,D])};for(let{workspace:A,dependency:p}of e)n.push([A.anchoredLocator,p]);for(;n.length>0;){let[A,p]=n.shift();u(A,p)}return o}var zC=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("-A,--all",!1,{description:"Audit dependencies from all workspaces"});this.recursive=de.Boolean("-R,--recursive",!1,{description:"Audit transitive dependencies as well"});this.environment=de.String("--environment","all",{description:"Which environments to cover",validator:js(Jv)});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.noDeprecations=de.Boolean("--no-deprecations",!1,{description:"Don't warn about deprecated packages"});this.severity=de.String("--severity","info",{description:"Minimal severity requested for packages to be displayed",validator:js(zv)});this.excludes=de.Array("--exclude",[],{description:"Array of glob patterns of packages to exclude from audit"});this.ignores=de.Array("--ignore",[],{description:"Array of glob patterns of advisory ID's to ignore in the audit report"})}static{this.paths=[["npm","audit"]]}static{this.usage=ot.Usage({description:"perform a vulnerability audit against the installed packages",details:` - This command checks for known security reports on the packages you use. The reports are by default extracted from the npm registry, and may or may not be relevant to your actual program (not all vulnerabilities affect all code paths). - - For consistency with our other commands the default is to only check the direct dependencies for the active workspace. To extend this search to all workspaces, use \`-A,--all\`. To extend this search to both direct and transitive dependencies, use \`-R,--recursive\`. - - Applying the \`--severity\` flag will limit the audit table to vulnerabilities of the corresponding severity and above. Valid values are ${JC.map(r=>`\`${r}\``).join(", ")}. - - If the \`--json\` flag is set, Yarn will print the output exactly as received from the registry. Regardless of this flag, the process will exit with a non-zero exit code if a report is found for the selected packages. - - If certain packages produce false positives for a particular environment, the \`--exclude\` flag can be used to exclude any number of packages from the audit. This can also be set in the configuration file with the \`npmAuditExcludePackages\` option. - - If particular advisories are needed to be ignored, the \`--ignore\` flag can be used with Advisory ID's to ignore any number of advisories in the audit report. This can also be set in the configuration file with the \`npmAuditIgnoreAdvisories\` option. - - To understand the dependency tree requiring vulnerable packages, check the raw report with the \`--json\` flag or use \`yarn why package\` to get more information as to who depends on them. - `,examples:[["Checks for known security issues with the installed packages. The output is a list of known issues.","yarn npm audit"],["Audit dependencies in all workspaces","yarn npm audit --all"],["Limit auditing to `dependencies` (excludes `devDependencies`)","yarn npm audit --environment production"],["Show audit report as valid JSON","yarn npm audit --json"],["Audit all direct and transitive dependencies","yarn npm audit --recursive"],["Output moderate (or more severe) vulnerabilities","yarn npm audit --severity moderate"],["Exclude certain packages","yarn npm audit --exclude package1 --exclude package2"],["Ignore specific advisories","yarn npm audit --ignore 1234567 --ignore 7654321"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState();let n=r5(o,a,{all:this.all,environment:this.environment}),u=n5(o,n,{recursive:this.recursive}),A=Array.from(new Set([...r.get("npmAuditExcludePackages"),...this.excludes])),p=Object.create(null);for(let[N,U]of u)A.some(J=>i5.default.isMatch(N,J))||(p[N]=[...U.keys()]);let h=si.getAuditRegistry({configuration:r}),E,w=await pA.start({configuration:r,stdout:this.context.stdout},async()=>{let N=en.post("/-/npm/v1/security/advisories/bulk",p,{authType:en.AuthType.BEST_EFFORT,configuration:r,jsonResponse:!0,registry:h}),U=this.noDeprecations?[]:await Promise.all(Array.from(Object.entries(p),async([te,le])=>{let ce=await en.getPackageMetadata(G.parseIdent(te),{project:o});return qe.mapAndFilter(le,ue=>{let{deprecated:Ie}=ce.versions[ue];return Ie?[te,ue,Ie]:qe.mapAndFilter.skip})})),J=await N;for(let[te,le,ce]of U.flat(1))Object.hasOwn(J,te)&&J[te].some(ue=>Ur.satisfiesWithPrereleases(le,ue.vulnerable_versions))||(J[te]??=[],J[te].push({id:`${te} (deprecation)`,title:ce.trim()||"This package has been deprecated.",severity:"moderate",vulnerable_versions:le}));E=J});if(w.hasErrors())return w.exitCode();let D=e5(this.severity),b=Array.from(new Set([...r.get("npmAuditIgnoreAdvisories"),...this.ignores])),C=Object.create(null);for(let[N,U]of Object.entries(E)){let J=U.filter(te=>!i5.default.isMatch(`${te.id}`,b)&&D.has(te.severity));J.length>0&&(C[N]=J.map(te=>{let le=u.get(N);if(typeof le>"u")throw new Error("Assertion failed: Expected the registry to only return packages that were requested");let ce=[...le.keys()].filter(Ie=>Ur.satisfiesWithPrereleases(Ie,te.vulnerable_versions)),ue=new Map;for(let Ie of ce)for(let he of le.get(Ie))ue.set(he.locatorHash,he);return{...te,versions:ce,dependents:[...ue.values()]}}))}let T=Object.keys(C).length>0;return T?(As.emitTree(t5(C),{configuration:r,json:this.json,stdout:this.context.stdout,separators:2}),1):(await Lt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async N=>{N.reportInfo(1,"No audit suggestions")}),T?1:0)}};Ve();Ve();St();Gt();var s5=et(ni()),o5=ve("util"),XC=class extends ut{constructor(){super(...arguments);this.fields=de.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=de.Rest()}static{this.paths=[["npm","info"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"show information about a package",details:"\n This command fetches information about a package from the npm registry and prints it in a tree format.\n\n The package does not have to be installed locally, but needs to have been published (in particular, local changes will be ignored even for workspaces).\n\n Append `@` to the package argument to provide information specific to the latest version that satisfies the range or to the corresponding tagged version. If the range is invalid or if there is no version satisfying the range, the command will print a warning and fall back to the latest version.\n\n If the `-f,--fields` option is set, it's a comma-separated list of fields which will be used to only display part of the package information.\n\n By default, this command won't return the `dist`, `readme`, and `users` fields, since they are often very long. To explicitly request those fields, explicitly list them with the `--fields` flag or request the output in JSON mode.\n ",examples:[["Show all available information about react (except the `dist`, `readme`, and `users` fields)","yarn npm info react"],["Show all available information about react as valid JSON (including the `dist`, `readme`, and `users` fields)","yarn npm info react --json"],["Show all available information about react@16.12.0","yarn npm info react@16.12.0"],["Show all available information about react@next","yarn npm info react@next"],["Show the description of react","yarn npm info react --fields description"],["Show all available versions of react","yarn npm info react --fields versions"],["Show the readme of react","yarn npm info react --fields readme"],["Show a few fields of react","yarn npm info react --fields homepage,repository"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd),a=typeof this.fields<"u"?new Set(["name",...this.fields.split(/\s*,\s*/)]):null,n=[],u=!1,A=await Lt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async p=>{for(let h of this.packages){let E;if(h==="."){let le=o.topLevelWorkspace;if(!le.manifest.name)throw new it(`Missing ${pe.pretty(r,"name",pe.Type.CODE)} field in ${Ae.fromPortablePath(V.join(le.cwd,mr.manifest))}`);E=G.makeDescriptor(le.manifest.name,"unknown")}else E=G.parseDescriptor(h);let w=en.getIdentUrl(E),D=a5(await en.get(w,{configuration:r,ident:E,jsonResponse:!0,customErrorMessage:en.customPackageError})),b=Object.keys(D.versions).sort(s5.default.compareLoose),T=D["dist-tags"].latest||b[b.length-1],N=Ur.validRange(E.range);if(N){let le=s5.default.maxSatisfying(b,N);le!==null?T=le:(p.reportWarning(0,`Unmet range ${G.prettyRange(r,E.range)}; falling back to the latest version`),u=!0)}else Object.hasOwn(D["dist-tags"],E.range)?T=D["dist-tags"][E.range]:E.range!=="unknown"&&(p.reportWarning(0,`Unknown tag ${G.prettyRange(r,E.range)}; falling back to the latest version`),u=!0);let U=D.versions[T],J={...D,...U,version:T,versions:b},te;if(a!==null){te={};for(let le of a){let ce=J[le];if(typeof ce<"u")te[le]=ce;else{p.reportWarning(1,`The ${pe.pretty(r,le,pe.Type.CODE)} field doesn't exist inside ${G.prettyIdent(r,E)}'s information`),u=!0;continue}}}else this.json||(delete J.dist,delete J.readme,delete J.users),te=J;p.reportJson(te),this.json||n.push(te)}});o5.inspect.styles.name="cyan";for(let p of n)(p!==n[0]||u)&&this.context.stdout.write(` -`),this.context.stdout.write(`${(0,o5.inspect)(p,{depth:1/0,colors:!0,compact:!1})} -`);return A.exitCode()}};function a5(t){if(Array.isArray(t)){let e=[];for(let r of t)r=a5(r),r&&e.push(r);return e}else if(typeof t=="object"&&t!==null){let e={};for(let r of Object.keys(t)){if(r.startsWith("_"))continue;let o=a5(t[r]);o&&(e[r]=o)}return e}else return t||null}Ve();Ve();Gt();var tve=et(Q2()),ZC=class extends ut{constructor(){super(...arguments);this.scope=de.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=de.Boolean("--publish",!1,{description:"Login to the publish registry"});this.alwaysAuth=de.Boolean("--always-auth",{description:"Set the npmAlwaysAuth configuration"})}static{this.paths=[["npm","login"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"store new login info to access the npm registry",details:"\n This command will ask you for your username, password, and 2FA One-Time-Password (when it applies). It will then modify your local configuration (in your home folder, never in the project itself) to reference the new tokens thus generated.\n\n Adding the `-s,--scope` flag will cause the authentication to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the authentication to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n ",examples:[["Login to the default registry","yarn npm login"],["Login to the registry linked to the @my-scope registry","yarn npm login --scope my-scope"],["Login to the publish registry for the current package","yarn npm login --publish"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=await bF({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await Lt.start({configuration:r,stdout:this.context.stdout,includeFooter:!1},async n=>{let u=await Ivt({configuration:r,registry:o,report:n,stdin:this.context.stdin,stdout:this.context.stdout}),A=await Evt(o,u,r);return await Cvt(o,A,{alwaysAuth:this.alwaysAuth,scope:this.scope}),n.reportInfo(0,"Successfully logged in")})).exitCode()}};async function bF({scope:t,publish:e,configuration:r,cwd:o}){return t&&e?si.getScopeRegistry(t,{configuration:r,type:si.RegistryType.PUBLISH_REGISTRY}):t?si.getScopeRegistry(t,{configuration:r}):e?si.getPublishRegistry((await aE(r,o)).manifest,{configuration:r}):si.getDefaultRegistry({configuration:r})}async function Evt(t,e,r){let o=`/-/user/org.couchdb.user:${encodeURIComponent(e.name)}`,a={_id:`org.couchdb.user:${e.name}`,name:e.name,password:e.password,type:"user",roles:[],date:new Date().toISOString()},n={attemptedAs:e.name,configuration:r,registry:t,jsonResponse:!0,authType:en.AuthType.NO_AUTH};try{return(await en.put(o,a,n)).token}catch(E){if(!(E.originalError?.name==="HTTPError"&&E.originalError?.response.statusCode===409))throw E}let u={...n,authType:en.AuthType.NO_AUTH,headers:{authorization:`Basic ${Buffer.from(`${e.name}:${e.password}`).toString("base64")}`}},A=await en.get(o,u);for(let[E,w]of Object.entries(A))(!a[E]||E==="roles")&&(a[E]=w);let p=`${o}/-rev/${a._rev}`;return(await en.put(p,a,u)).token}async function Cvt(t,e,{alwaysAuth:r,scope:o}){let a=u=>A=>{let p=qe.isIndexableObject(A)?A:{},h=p[u],E=qe.isIndexableObject(h)?h:{};return{...p,[u]:{...E,...r!==void 0?{npmAlwaysAuth:r}:{},npmAuthToken:e}}},n=o?{npmScopes:a(o)}:{npmRegistries:a(t)};return await ze.updateHomeConfiguration(n)}async function Ivt({configuration:t,registry:e,report:r,stdin:o,stdout:a}){r.reportInfo(0,`Logging in to ${pe.pretty(t,e,pe.Type.URL)}`);let n=!1;if(e.match(/^https:\/\/npm\.pkg\.github\.com(\/|$)/)&&(r.reportInfo(0,"You seem to be using the GitHub Package Registry. Tokens must be generated with the 'repo', 'write:packages', and 'read:packages' permissions."),n=!0),r.reportSeparator(),t.env.YARN_IS_TEST_ENV)return{name:t.env.YARN_INJECT_NPM_USER||"",password:t.env.YARN_INJECT_NPM_PASSWORD||""};let u=await(0,tve.prompt)([{type:"input",name:"name",message:"Username:",required:!0,onCancel:()=>process.exit(130),stdin:o,stdout:a},{type:"password",name:"password",message:n?"Token:":"Password:",required:!0,onCancel:()=>process.exit(130),stdin:o,stdout:a}]);return r.reportSeparator(),u}Ve();Ve();Gt();var $C=new Set(["npmAuthIdent","npmAuthToken"]),eI=class extends ut{constructor(){super(...arguments);this.scope=de.String("-s,--scope",{description:"Logout of the registry configured for a given scope"});this.publish=de.Boolean("--publish",!1,{description:"Logout of the publish registry"});this.all=de.Boolean("-A,--all",!1,{description:"Logout of all registries"})}static{this.paths=[["npm","logout"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"logout of the npm registry",details:"\n This command will log you out by modifying your local configuration (in your home folder, never in the project itself) to delete all credentials linked to a registry.\n\n Adding the `-s,--scope` flag will cause the deletion to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the deletion to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n\n Adding the `-A,--all` flag will cause the deletion to be done against all registries and scopes.\n ",examples:[["Logout of the default registry","yarn npm logout"],["Logout of the @my-scope scope","yarn npm logout --scope my-scope"],["Logout of the publish registry for the current package","yarn npm logout --publish"],["Logout of all registries","yarn npm logout --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o=async()=>{let n=await bF({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope}),u=await ze.find(this.context.cwd,this.context.plugins),A=G.makeIdent(this.scope??null,"pkg");return!si.getAuthConfiguration(n,{configuration:u,ident:A}).get("npmAuthToken")};return(await Lt.start({configuration:r,stdout:this.context.stdout},async n=>{if(this.all&&(await Bvt(),n.reportInfo(0,"Successfully logged out from everything")),this.scope){await rve("npmScopes",this.scope),await o()?n.reportInfo(0,`Successfully logged out from ${this.scope}`):n.reportWarning(0,"Scope authentication settings removed, but some other ones settings still apply to it");return}let u=await bF({configuration:r,cwd:this.context.cwd,publish:this.publish});await rve("npmRegistries",u),await o()?n.reportInfo(0,`Successfully logged out from ${u}`):n.reportWarning(0,"Registry authentication settings removed, but some other ones settings still apply to it")})).exitCode()}};function wvt(t,e){let r=t[e];if(!qe.isIndexableObject(r))return!1;let o=new Set(Object.keys(r));if([...$C].every(n=>!o.has(n)))return!1;for(let n of $C)o.delete(n);if(o.size===0)return t[e]=void 0,!0;let a={...r};for(let n of $C)delete a[n];return t[e]=a,!0}async function Bvt(){let t=e=>{let r=!1,o=qe.isIndexableObject(e)?{...e}:{};o.npmAuthToken&&(delete o.npmAuthToken,r=!0);for(let a of Object.keys(o))wvt(o,a)&&(r=!0);if(Object.keys(o).length!==0)return r?o:e};return await ze.updateHomeConfiguration({npmRegistries:t,npmScopes:t})}async function rve(t,e){return await ze.updateHomeConfiguration({[t]:r=>{let o=qe.isIndexableObject(r)?r:{};if(!Object.hasOwn(o,e))return r;let a=o[e],n=qe.isIndexableObject(a)?a:{},u=new Set(Object.keys(n));if([...$C].every(p=>!u.has(p)))return r;for(let p of $C)u.delete(p);if(u.size===0)return Object.keys(o).length===1?void 0:{...o,[e]:void 0};let A={};for(let p of $C)A[p]=void 0;return{...o,[e]:{...n,...A}}}})}Ve();Gt();var tI=class extends ut{constructor(){super(...arguments);this.access=de.String("--access",{description:"The access for the published package (public or restricted)"});this.tag=de.String("--tag","latest",{description:"The tag on the registry that the package should be attached to"});this.tolerateRepublish=de.Boolean("--tolerate-republish",!1,{description:"Warn and exit when republishing an already existing version of a package"});this.otp=de.String("--otp",{description:"The OTP token to use with the command"})}static{this.paths=[["npm","publish"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"publish the active workspace to the npm registry",details:'\n This command will pack the active workspace into a fresh archive and upload it to the npm registry.\n\n The package will by default be attached to the `latest` tag on the registry, but this behavior can be overridden by using the `--tag` option.\n\n Note that for legacy reasons scoped packages are by default published with an access set to `restricted` (aka "private packages"). This requires you to register for a paid npm plan. In case you simply wish to publish a public scoped package to the registry (for free), just add the `--access public` flag. This behavior can be enabled by default through the `npmPublishAccess` settings.\n ',examples:[["Publish the active workspace","yarn npm publish"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);if(a.manifest.private)throw new it("Private workspaces cannot be published");if(a.manifest.name===null||a.manifest.version===null)throw new it("Workspaces must have valid names and versions to be published on an external registry");await o.restoreInstallState();let n=a.manifest.name,u=a.manifest.version,A=si.getPublishRegistry(a.manifest,{configuration:r});return(await Lt.start({configuration:r,stdout:this.context.stdout},async h=>{if(this.tolerateRepublish)try{let E=await en.get(en.getIdentUrl(n),{configuration:r,registry:A,ident:n,jsonResponse:!0});if(!Object.hasOwn(E,"versions"))throw new Jt(15,'Registry returned invalid data for - missing "versions" field');if(Object.hasOwn(E.versions,u)){h.reportWarning(0,`Registry already knows about version ${u}; skipping.`);return}}catch(E){if(E.originalError?.response?.statusCode!==404)throw E}await hn.maybeExecuteWorkspaceLifecycleScript(a,"prepublish",{report:h}),await BA.prepareForPack(a,{report:h},async()=>{let E=await BA.genPackList(a);for(let T of E)h.reportInfo(null,T);let w=await BA.genPackStream(a,E),D=await qe.bufferStream(w),b=await KC.getGitHead(a.cwd),C=await KC.makePublishBody(a,D,{access:this.access,tag:this.tag,registry:A,gitHead:b});await en.put(en.getIdentUrl(n),C,{configuration:r,registry:A,ident:n,otp:this.otp,jsonResponse:!0})}),h.reportInfo(0,"Package archive published")})).exitCode()}};Ve();Gt();var nve=et(ni());Ve();St();Gt();var rI=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=de.String({required:!1})}static{this.paths=[["npm","tag","list"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"list all dist-tags of a package",details:` - This command will list all tags of a package from the npm registry. - - If the package is not specified, Yarn will default to the current workspace. - `,examples:[["List all tags of package `my-pkg`","yarn npm tag list my-pkg"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n;if(typeof this.package<"u")n=G.parseIdent(this.package);else{if(!a)throw new or(o.cwd,this.context.cwd);if(!a.manifest.name)throw new it(`Missing 'name' field in ${Ae.fromPortablePath(V.join(a.cwd,mr.manifest))}`);n=a.manifest.name}let u=await Zv(n,r),p={children:qe.sortMap(Object.entries(u),([h])=>h).map(([h,E])=>({value:pe.tuple(pe.Type.RESOLUTION,{descriptor:G.makeDescriptor(n,h),locator:G.makeLocator(n,E)})}))};return As.emitTree(p,{configuration:r,json:this.json,stdout:this.context.stdout})}};async function Zv(t,e){let r=`/-/package${en.getIdentUrl(t)}/dist-tags`;return en.get(r,{configuration:e,ident:t,jsonResponse:!0,customErrorMessage:en.customPackageError})}var nI=class extends ut{constructor(){super(...arguments);this.package=de.String();this.tag=de.String()}static{this.paths=[["npm","tag","add"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"add a tag for a specific version of a package",details:` - This command will add a tag to the npm registry for a specific version of a package. If the tag already exists, it will be overwritten. - `,examples:[["Add a `beta` tag for version `2.3.4-beta.4` of package `my-pkg`","yarn npm tag add my-pkg@2.3.4-beta.4 beta"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);let n=G.parseDescriptor(this.package,!0),u=n.range;if(!nve.default.valid(u))throw new it(`The range ${pe.pretty(r,n.range,pe.Type.RANGE)} must be a valid semver version`);let A=si.getPublishRegistry(a.manifest,{configuration:r}),p=pe.pretty(r,n,pe.Type.IDENT),h=pe.pretty(r,u,pe.Type.RANGE),E=pe.pretty(r,this.tag,pe.Type.CODE);return(await Lt.start({configuration:r,stdout:this.context.stdout},async D=>{let b=await Zv(n,r);Object.hasOwn(b,this.tag)&&b[this.tag]===u&&D.reportWarning(0,`Tag ${E} is already set to version ${h}`);let C=`/-/package${en.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await en.put(C,u,{configuration:r,registry:A,ident:n,jsonRequest:!0,jsonResponse:!0}),D.reportInfo(0,`Tag ${E} added to version ${h} of package ${p}`)})).exitCode()}};Ve();Gt();var iI=class extends ut{constructor(){super(...arguments);this.package=de.String();this.tag=de.String()}static{this.paths=[["npm","tag","remove"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"remove a tag from a package",details:` - This command will remove a tag from a package from the npm registry. - `,examples:[["Remove the `beta` tag from package `my-pkg`","yarn npm tag remove my-pkg beta"]]})}async execute(){if(this.tag==="latest")throw new it("The 'latest' tag cannot be removed.");let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);let n=G.parseIdent(this.package),u=si.getPublishRegistry(a.manifest,{configuration:r}),A=pe.pretty(r,this.tag,pe.Type.CODE),p=pe.pretty(r,n,pe.Type.IDENT),h=await Zv(n,r);if(!Object.hasOwn(h,this.tag))throw new it(`${A} is not a tag of package ${p}`);return(await Lt.start({configuration:r,stdout:this.context.stdout},async w=>{let D=`/-/package${en.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await en.del(D,{configuration:r,registry:u,ident:n,jsonResponse:!0}),w.reportInfo(0,`Tag ${A} removed from package ${p}`)})).exitCode()}};Ve();Ve();Gt();var sI=class extends ut{constructor(){super(...arguments);this.scope=de.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=de.Boolean("--publish",!1,{description:"Print username for the publish registry"})}static{this.paths=[["npm","whoami"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"display the name of the authenticated user",details:"\n Print the username associated with the current authentication settings to the standard output.\n\n When using `-s,--scope`, the username printed will be the one that matches the authentication settings of the registry associated with the given scope (those settings can be overriden using the `npmRegistries` map, and the registry associated with the scope is configured via the `npmScopes` map).\n\n When using `--publish`, the registry we'll select will by default be the one used when publishing packages (`publishConfig.registry` or `npmPublishRegistry` if available, otherwise we'll fallback to the regular `npmRegistryServer`).\n ",examples:[["Print username for the default registry","yarn npm whoami"],["Print username for the registry on a given scope","yarn npm whoami --scope company"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),o;return this.scope&&this.publish?o=si.getScopeRegistry(this.scope,{configuration:r,type:si.RegistryType.PUBLISH_REGISTRY}):this.scope?o=si.getScopeRegistry(this.scope,{configuration:r}):this.publish?o=si.getPublishRegistry((await aE(r,this.context.cwd)).manifest,{configuration:r}):o=si.getDefaultRegistry({configuration:r}),(await Lt.start({configuration:r,stdout:this.context.stdout},async n=>{let u;try{u=await en.get("/-/whoami",{configuration:r,registry:o,authType:en.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?G.makeIdent(this.scope,""):void 0})}catch(A){if(A.response?.statusCode===401||A.response?.statusCode===403){n.reportError(41,"Authentication failed - your credentials may have expired");return}else throw A}n.reportInfo(0,u.username)})).exitCode()}};var vvt={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:"STRING",default:null},npmAuditExcludePackages:{description:"Array of glob patterns of packages to exclude from npm audit",type:"STRING",default:[],isArray:!0},npmAuditIgnoreAdvisories:{description:"Array of glob patterns of advisory IDs to exclude from npm audit",type:"STRING",default:[],isArray:!0}},commands:[zC,XC,ZC,eI,tI,nI,rI,iI,sI]},Dvt=vvt;var g5={};Vt(g5,{PatchCommand:()=>AI,PatchCommitCommand:()=>uI,PatchFetcher:()=>nD,PatchResolver:()=>iD,default:()=>jvt,patchUtils:()=>Id});Ve();Ve();St();sA();var Id={};Vt(Id,{applyPatchFile:()=>QF,diffFolders:()=>p5,ensureUnpatchedDescriptor:()=>c5,ensureUnpatchedLocator:()=>RF,extractPackageToDisk:()=>f5,extractPatchFlags:()=>uve,isParentRequired:()=>A5,isPatchDescriptor:()=>FF,isPatchLocator:()=>i0,loadPatchFiles:()=>rD,makeDescriptor:()=>TF,makeLocator:()=>u5,makePatchHash:()=>h5,parseDescriptor:()=>eD,parseLocator:()=>tD,parsePatchFile:()=>$v,unpatchDescriptor:()=>_vt,unpatchLocator:()=>Hvt});Ve();St();Ve();St();var Svt=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function oI(t){return V.relative(Bt.root,V.resolve(Bt.root,Ae.toPortablePath(t)))}function Pvt(t){let e=t.trim().match(Svt);if(!e)throw new Error(`Bad header line: '${t}'`);return{original:{start:Math.max(Number(e[1]),1),length:Number(e[3]||1)},patched:{start:Math.max(Number(e[4]),1),length:Number(e[6]||1)}}}var xvt=420,bvt=493;var ive=()=>({semverExclusivity:null,diffLineFromPath:null,diffLineToPath:null,oldMode:null,newMode:null,deletedFileMode:null,newFileMode:null,renameFrom:null,renameTo:null,beforeHash:null,afterHash:null,fromPath:null,toPath:null,hunks:null}),kvt=t=>({header:Pvt(t),parts:[]}),Qvt={"@":"header","-":"deletion","+":"insertion"," ":"context","\\":"pragma",undefined:"context"};function Fvt(t){let e=[],r=ive(),o="parsing header",a=null,n=null;function u(){a&&(n&&(a.parts.push(n),n=null),r.hunks.push(a),a=null)}function A(){u(),e.push(r),r=ive()}for(let p=0;p0?"patch":"mode change",J=null;switch(U){case"rename":{if(!E||!w)throw new Error("Bad parser state: rename from & to not given");e.push({type:"rename",semverExclusivity:o,fromPath:oI(E),toPath:oI(w)}),J=w}break;case"file deletion":{let te=a||C;if(!te)throw new Error("Bad parse state: no path given for file deletion");e.push({type:"file deletion",semverExclusivity:o,hunk:N&&N[0]||null,path:oI(te),mode:kF(p),hash:D})}break;case"file creation":{let te=n||T;if(!te)throw new Error("Bad parse state: no path given for file creation");e.push({type:"file creation",semverExclusivity:o,hunk:N&&N[0]||null,path:oI(te),mode:kF(h),hash:b})}break;case"patch":case"mode change":J=T||n;break;default:qe.assertNever(U);break}J&&u&&A&&u!==A&&e.push({type:"mode change",semverExclusivity:o,path:oI(J),oldMode:kF(u),newMode:kF(A)}),J&&N&&N.length&&e.push({type:"patch",semverExclusivity:o,path:oI(J),hunks:N,beforeHash:D,afterHash:b})}if(e.length===0)throw new Error("Unable to parse patch file: No changes found. Make sure the patch is a valid UTF8 encoded string");return e}function kF(t){let e=parseInt(t,8)&511;if(e!==xvt&&e!==bvt)throw new Error(`Unexpected file mode string: ${t}`);return e}function $v(t){let e=t.split(/\n/g);return e[e.length-1]===""&&e.pop(),Rvt(Fvt(e))}function Tvt(t){let e=0,r=0;for(let{type:o,lines:a}of t.parts)switch(o){case"context":r+=a.length,e+=a.length;break;case"deletion":e+=a.length;break;case"insertion":r+=a.length;break;default:qe.assertNever(o);break}if(e!==t.header.original.length||r!==t.header.patched.length){let o=a=>a<0?a:`+${a}`;throw new Error(`hunk header integrity check failed (expected @@ ${o(t.header.original.length)} ${o(t.header.patched.length)} @@, got @@ ${o(e)} ${o(r)} @@)`)}}Ve();St();var aI=class extends Error{constructor(r,o){super(`Cannot apply hunk #${r+1}`);this.hunk=o}};async function lI(t,e,r){let o=await t.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await t.lutimesPromise(e,o.atime,o.mtime)}async function QF(t,{baseFs:e=new _n,dryRun:r=!1,version:o=null}={}){for(let a of t)if(!(a.semverExclusivity!==null&&o!==null&&!Ur.satisfiesWithPrereleases(o,a.semverExclusivity)))switch(a.type){case"file deletion":if(r){if(!e.existsSync(a.path))throw new Error(`Trying to delete a file that doesn't exist: ${a.path}`)}else await lI(e,V.dirname(a.path),async()=>{await e.unlinkPromise(a.path)});break;case"rename":if(r){if(!e.existsSync(a.fromPath))throw new Error(`Trying to move a file that doesn't exist: ${a.fromPath}`)}else await lI(e,V.dirname(a.fromPath),async()=>{await lI(e,V.dirname(a.toPath),async()=>{await lI(e,a.fromPath,async()=>(await e.movePromise(a.fromPath,a.toPath),a.toPath))})});break;case"file creation":if(r){if(e.existsSync(a.path))throw new Error(`Trying to create a file that already exists: ${a.path}`)}else{let n=a.hunk?a.hunk.parts[0].lines.join(` -`)+(a.hunk.parts[0].noNewlineAtEndOfFile?"":` -`):"";await e.mkdirpPromise(V.dirname(a.path),{chmod:493,utimes:[Si.SAFE_TIME,Si.SAFE_TIME]}),await e.writeFilePromise(a.path,n,{mode:a.mode}),await e.utimesPromise(a.path,Si.SAFE_TIME,Si.SAFE_TIME)}break;case"patch":await lI(e,a.path,async()=>{await Ovt(a,{baseFs:e,dryRun:r})});break;case"mode change":{let u=(await e.statPromise(a.path)).mode;if(sve(a.newMode)!==sve(u))continue;await lI(e,a.path,async()=>{await e.chmodPromise(a.path,a.newMode)})}break;default:qe.assertNever(a);break}}function sve(t){return(t&64)>0}function ove(t){return t.replace(/\s+$/,"")}function Nvt(t,e){return ove(t)===ove(e)}async function Ovt({hunks:t,path:e},{baseFs:r,dryRun:o=!1}){let a=await r.statSync(e).mode,u=(await r.readFileSync(e,"utf8")).split(/\n/),A=[],p=0,h=0;for(let w of t){let D=Math.max(h,w.header.patched.start+p),b=Math.max(0,D-h),C=Math.max(0,u.length-D-w.header.original.length),T=Math.max(b,C),N=0,U=0,J=null;for(;N<=T;){if(N<=b&&(U=D-N,J=ave(w,u,U),J!==null)){N=-N;break}if(N<=C&&(U=D+N,J=ave(w,u,U),J!==null))break;N+=1}if(J===null)throw new aI(t.indexOf(w),w);A.push(J),p+=N,h=U+w.header.original.length}if(o)return;let E=0;for(let w of A)for(let D of w)switch(D.type){case"splice":{let b=D.index+E;u.splice(b,D.numToDelete,...D.linesToInsert),E+=D.linesToInsert.length-D.numToDelete}break;case"pop":u.pop();break;case"push":u.push(D.line);break;default:qe.assertNever(D);break}await r.writeFilePromise(e,u.join(` -`),{mode:a})}function ave(t,e,r){let o=[];for(let a of t.parts)switch(a.type){case"context":case"deletion":{for(let n of a.lines){let u=e[r];if(u==null||!Nvt(u,n))return null;r+=1}a.type==="deletion"&&(o.push({type:"splice",index:r-a.lines.length,numToDelete:a.lines.length,linesToInsert:[]}),a.noNewlineAtEndOfFile&&o.push({type:"push",line:""}))}break;case"insertion":o.push({type:"splice",index:r,numToDelete:0,linesToInsert:a.lines}),a.noNewlineAtEndOfFile&&o.push({type:"pop"});break;default:qe.assertNever(a.type);break}return o}var Uvt=/^builtin<([^>]+)>$/;function cI(t,e){let{protocol:r,source:o,selector:a,params:n}=G.parseRange(t);if(r!=="patch:")throw new Error("Invalid patch range");if(o===null)throw new Error("Patch locators must explicitly define their source");let u=a?a.split(/&/).map(E=>Ae.toPortablePath(E)):[],A=n&&typeof n.locator=="string"?G.parseLocator(n.locator):null,p=n&&typeof n.version=="string"?n.version:null,h=e(o);return{parentLocator:A,sourceItem:h,patchPaths:u,sourceVersion:p}}function FF(t){return t.range.startsWith("patch:")}function i0(t){return t.reference.startsWith("patch:")}function eD(t){let{sourceItem:e,...r}=cI(t.range,G.parseDescriptor);return{...r,sourceDescriptor:e}}function tD(t){let{sourceItem:e,...r}=cI(t.reference,G.parseLocator);return{...r,sourceLocator:e}}function _vt(t){let{sourceItem:e}=cI(t.range,G.parseDescriptor);return e}function Hvt(t){let{sourceItem:e}=cI(t.reference,G.parseLocator);return e}function c5(t){if(!FF(t))return t;let{sourceItem:e}=cI(t.range,G.parseDescriptor);return e}function RF(t){if(!i0(t))return t;let{sourceItem:e}=cI(t.reference,G.parseLocator);return e}function lve({parentLocator:t,sourceItem:e,patchPaths:r,sourceVersion:o,patchHash:a},n){let u=t!==null?{locator:G.stringifyLocator(t)}:{},A=typeof o<"u"?{version:o}:{},p=typeof a<"u"?{hash:a}:{};return G.makeRange({protocol:"patch:",source:n(e),selector:r.join("&"),params:{...A,...p,...u}})}function TF(t,{parentLocator:e,sourceDescriptor:r,patchPaths:o}){return G.makeDescriptor(t,lve({parentLocator:e,sourceItem:r,patchPaths:o},G.stringifyDescriptor))}function u5(t,{parentLocator:e,sourcePackage:r,patchPaths:o,patchHash:a}){return G.makeLocator(t,lve({parentLocator:e,sourceItem:r,sourceVersion:r.version,patchPaths:o,patchHash:a},G.stringifyLocator))}function cve({onAbsolute:t,onRelative:e,onProject:r,onBuiltin:o},a){let n=a.lastIndexOf("!");n!==-1&&(a=a.slice(n+1));let u=a.match(Uvt);return u!==null?o(u[1]):a.startsWith("~/")?r(a.slice(2)):V.isAbsolute(a)?t(a):e(a)}function uve(t){let e=t.lastIndexOf("!");return{optional:(e!==-1?new Set(t.slice(0,e).split(/!/)):new Set).has("optional")}}function A5(t){return cve({onAbsolute:()=>!1,onRelative:()=>!0,onProject:()=>!1,onBuiltin:()=>!1},t)}async function rD(t,e,r){let o=t!==null?await r.fetcher.fetch(t,r):null,a=o&&o.localPath?{packageFs:new En(Bt.root),prefixPath:V.relative(Bt.root,o.localPath)}:o;o&&o!==a&&o.releaseFs&&o.releaseFs();let n=await qe.releaseAfterUseAsync(async()=>await Promise.all(e.map(async u=>{let A=uve(u),p=await cve({onAbsolute:async h=>await ae.readFilePromise(h,"utf8"),onRelative:async h=>{if(a===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await a.packageFs.readFilePromise(V.join(a.prefixPath,h),"utf8")},onProject:async h=>await ae.readFilePromise(V.join(r.project.cwd,h),"utf8"),onBuiltin:async h=>await r.project.configuration.firstHook(E=>E.getBuiltinPatch,r.project,h)},u);return{...A,source:p}})));for(let u of n)typeof u.source=="string"&&(u.source=u.source.replace(/\r\n?/g,` -`));return n}async function f5(t,{cache:e,project:r}){let o=r.storedPackages.get(t.locatorHash);if(typeof o>"u")throw new Error("Assertion failed: Expected the package to be registered");let a=RF(t),n=r.storedChecksums,u=new Ri,A=await ae.mktempPromise(),p=V.join(A,"source"),h=V.join(A,"user"),E=V.join(A,".yarn-patch.json"),w=r.configuration.makeFetcher(),D=[];try{let b,C;if(t.locatorHash===a.locatorHash){let T=await w.fetch(t,{cache:e,project:r,fetcher:w,checksums:n,report:u});D.push(()=>T.releaseFs?.()),b=T,C=T}else b=await w.fetch(t,{cache:e,project:r,fetcher:w,checksums:n,report:u}),D.push(()=>b.releaseFs?.()),C=await w.fetch(t,{cache:e,project:r,fetcher:w,checksums:n,report:u}),D.push(()=>C.releaseFs?.());await Promise.all([ae.copyPromise(p,b.prefixPath,{baseFs:b.packageFs}),ae.copyPromise(h,C.prefixPath,{baseFs:C.packageFs}),ae.writeJsonPromise(E,{locator:G.stringifyLocator(t),version:o.version})])}finally{for(let b of D)b()}return ae.detachTemp(A),h}async function p5(t,e){let r=Ae.fromPortablePath(t).replace(/\\/g,"/"),o=Ae.fromPortablePath(e).replace(/\\/g,"/"),{stdout:a,stderr:n}=await Hr.execvp("git",["-c","core.safecrlf=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--no-renames","--text",r,o],{cwd:Ae.toPortablePath(process.cwd()),env:{...process.env,GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""}});if(n.length>0)throw new Error(`Unable to diff directories. Make sure you have a recent version of 'git' available in PATH. -The following error was reported by 'git': -${n}`);let u=r.startsWith("/")?A=>A.slice(1):A=>A;return a.replace(new RegExp(`(a|b)(${qe.escapeRegExp(`/${u(r)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${qe.escapeRegExp(`/${u(o)}/`)}`,"g"),"$1/").replace(new RegExp(qe.escapeRegExp(`${r}/`),"g"),"").replace(new RegExp(qe.escapeRegExp(`${o}/`),"g"),"")}function h5(t,e){let r=[];for(let{source:o}of t){if(o===null)continue;let a=$v(o);for(let n of a){let{semverExclusivity:u,...A}=n;u!==null&&e!==null&&!Ur.satisfiesWithPrereleases(e,u)||r.push(JSON.stringify(A))}}return bn.makeHash(`${3}`,...r).slice(0,6)}Ve();function Ave(t,{configuration:e,report:r}){for(let o of t.parts)for(let a of o.lines)switch(o.type){case"context":r.reportInfo(null,` ${pe.pretty(e,a,"grey")}`);break;case"deletion":r.reportError(28,`- ${pe.pretty(e,a,pe.Type.REMOVED)}`);break;case"insertion":r.reportError(28,`+ ${pe.pretty(e,a,pe.Type.ADDED)}`);break;default:qe.assertNever(o.type)}}var nD=class{supports(e,r){return!!i0(e)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:u}}async patchPackage(e,r){let{parentLocator:o,sourceLocator:a,sourceVersion:n,patchPaths:u}=tD(e),A=await rD(o,u,r),p=await ae.mktempPromise(),h=V.join(p,"current.zip"),E=await r.fetcher.fetch(a,r),w=G.getIdentVendorPath(e),D=new Zi(h,{create:!0,level:r.project.configuration.get("compressionLevel")});await qe.releaseAfterUseAsync(async()=>{await D.copyPromise(w,E.prefixPath,{baseFs:E.packageFs,stableSort:!0})},E.releaseFs),D.saveAndClose();for(let{source:b,optional:C}of A){if(b===null)continue;let T=new Zi(h,{level:r.project.configuration.get("compressionLevel")}),N=new En(V.resolve(Bt.root,w),{baseFs:T});try{await QF($v(b),{baseFs:N,version:n})}catch(U){if(!(U instanceof aI))throw U;let J=r.project.configuration.get("enableInlineHunks"),te=!J&&!C?" (set enableInlineHunks for details)":"",le=`${G.prettyLocator(r.project.configuration,e)}: ${U.message}${te}`,ce=ue=>{J&&Ave(U.hunk,{configuration:r.project.configuration,report:ue})};if(T.discardAndClose(),C){r.report.reportWarningOnce(66,le,{reportExtra:ce});continue}else throw new Jt(66,le,ce)}T.saveAndClose()}return new Zi(h,{level:r.project.configuration.get("compressionLevel")})}};Ve();var iD=class{supportsDescriptor(e,r){return!!FF(e)}supportsLocator(e,r){return!!i0(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){let{patchPaths:a}=eD(e);return a.every(n=>!A5(n))?e:G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){let{sourceDescriptor:o}=eD(e);return{sourceDescriptor:r.project.configuration.normalizeDependency(o)}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:a,patchPaths:n}=eD(e),u=await rD(a,n,o.fetchOptions),A=r.sourceDescriptor;if(typeof A>"u")throw new Error("Assertion failed: The dependency should have been resolved");let p=h5(u,A.version);return[u5(e,{parentLocator:a,sourcePackage:A,patchPaths:n,patchHash:p})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let{sourceLocator:o}=tD(e);return{...await r.resolver.resolve(o,r),...e}}};Ve();St();Gt();var uI=class extends ut{constructor(){super(...arguments);this.save=de.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=de.String()}static{this.paths=[["patch-commit"]]}static{this.usage=ot.Usage({description:"generate a patch out of a directory",details:"\n By default, this will print a patchfile on stdout based on the diff between the folder passed in and the original version of the package. Such file is suitable for consumption with the `patch:` protocol.\n\n With the `-s,--save` option set, the patchfile won't be printed on stdout anymore and will instead be stored within a local file (by default kept within `.yarn/patches`, but configurable via the `patchFolder` setting). A `resolutions` entry will also be added to your top-level manifest, referencing the patched package via the `patch:` protocol.\n\n Note that only folders generated by `yarn patch` are accepted as valid input for `yarn patch-commit`.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState();let n=V.resolve(this.context.cwd,Ae.toPortablePath(this.patchFolder)),u=V.join(n,"../source"),A=V.join(n,"../.yarn-patch.json");if(!ae.existsSync(u))throw new it("The argument folder didn't get created by 'yarn patch'");let p=await p5(u,n),h=await ae.readJsonPromise(A),E=G.parseLocator(h.locator,!0);if(!o.storedPackages.has(E.locatorHash))throw new it("No package found in the project for the given locator");if(!this.save){this.context.stdout.write(p);return}let w=r.get("patchFolder"),D=V.join(w,`${G.slugifyLocator(E)}.patch`);await ae.mkdirPromise(w,{recursive:!0}),await ae.writeFilePromise(D,p);let b=[],C=new Map;for(let T of o.storedPackages.values()){if(G.isVirtualLocator(T))continue;let N=T.dependencies.get(E.identHash);if(!N)continue;let U=G.ensureDevirtualizedDescriptor(N),J=c5(U),te=o.storedResolutions.get(J.descriptorHash);if(!te)throw new Error("Assertion failed: Expected the resolution to have been registered");if(!o.storedPackages.get(te))throw new Error("Assertion failed: Expected the package to have been registered");let ce=o.tryWorkspaceByLocator(T);if(ce)b.push(ce);else{let ue=o.originalPackages.get(T.locatorHash);if(!ue)throw new Error("Assertion failed: Expected the original package to have been registered");let Ie=ue.dependencies.get(N.identHash);if(!Ie)throw new Error("Assertion failed: Expected the original dependency to have been registered");C.set(Ie.descriptorHash,Ie)}}for(let T of b)for(let N of _t.hardDependencies){let U=T.manifest[N].get(E.identHash);if(!U)continue;let J=TF(U,{parentLocator:null,sourceDescriptor:G.convertLocatorToDescriptor(E),patchPaths:[V.join(mr.home,V.relative(o.cwd,D))]});T.manifest[N].set(U.identHash,J)}for(let T of C.values()){let N=TF(T,{parentLocator:null,sourceDescriptor:G.convertLocatorToDescriptor(E),patchPaths:[V.join(mr.home,V.relative(o.cwd,D))]});o.topLevelWorkspace.manifest.resolutions.push({pattern:{descriptor:{fullName:G.stringifyIdent(N),description:T.range}},reference:N.range})}await o.persist()}};Ve();St();Gt();var AI=class extends ut{constructor(){super(...arguments);this.update=de.Boolean("-u,--update",!1,{description:"Reapply local patches that already apply to this packages"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=de.String()}static{this.paths=[["patch"]]}static{this.usage=ot.Usage({description:"prepare a package for patching",details:"\n This command will cause a package to be extracted in a temporary directory intended to be editable at will.\n\n Once you're done with your changes, run `yarn patch-commit -s path` (with `path` being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the `patch:` protocol. Run `yarn patch-commit -h` for more details.\n\n Calling the command when you already have a patch won't import it by default (in other words, the default behavior is to reset existing patches). However, adding the `-u,--update` flag will import any current patch.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState();let u=G.parseLocator(this.package);if(u.reference==="unknown"){let A=qe.mapAndFilter([...o.storedPackages.values()],p=>p.identHash!==u.identHash?qe.mapAndFilter.skip:G.isVirtualLocator(p)?qe.mapAndFilter.skip:i0(p)!==this.update?qe.mapAndFilter.skip:p);if(A.length===0)throw new it("No package found in the project for the given locator");if(A.length>1)throw new it(`Multiple candidate packages found; explicitly choose one of them (use \`yarn why \` to get more information as to who depends on them): -${A.map(p=>` -- ${G.prettyLocator(r,p)}`).join("")}`);u=A[0]}if(!o.storedPackages.has(u.locatorHash))throw new it("No package found in the project for the given locator");await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async A=>{let p=RF(u),h=await f5(u,{cache:n,project:o});A.reportJson({locator:G.stringifyLocator(p),path:Ae.fromPortablePath(h)});let E=this.update?" along with its current modifications":"";A.reportInfo(0,`Package ${G.prettyLocator(r,p)} got extracted with success${E}!`),A.reportInfo(0,`You can now edit the following folder: ${pe.pretty(r,Ae.fromPortablePath(h),"magenta")}`),A.reportInfo(0,`Once you are done run ${pe.pretty(r,`yarn patch-commit -s ${process.platform==="win32"?'"':""}${Ae.fromPortablePath(h)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};var qvt={configuration:{enableInlineHunks:{description:"If true, the installs will print unmatched patch hunks",type:"BOOLEAN",default:!1},patchFolder:{description:"Folder where the patch files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/patches"}},commands:[uI,AI],fetchers:[nD],resolvers:[iD]},jvt=qvt;var y5={};Vt(y5,{PnpmLinker:()=>sD,default:()=>Kvt});Ve();St();Gt();var sD=class{getCustomDataKey(){return JSON.stringify({name:"PnpmLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the pnpm linker to be enabled");let o=this.getCustomDataKey(),a=r.project.linkersCustomData.get(o);if(!a)throw new it(`The project in ${pe.pretty(r.project.configuration,`${r.project.cwd}/package.json`,pe.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=a.pathsByLocator.get(e.locatorHash);if(typeof n>"u")throw new it(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed pnpm map - running an install might help`);return n.packageLocation}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let o=this.getCustomDataKey(),a=r.project.linkersCustomData.get(o);if(!a)throw new it(`The project in ${pe.pretty(r.project.configuration,`${r.project.cwd}/package.json`,pe.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=e.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);if(n){let p=a.locatorByPath.get(n[1]);if(p)return p}let u=e,A=e;do{A=u,u=V.dirname(A);let p=a.locatorByPath.get(A);if(p)return p}while(u!==A);return null}makeInstaller(e){return new d5(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="pnpm"}},d5=class{constructor(e){this.opts=e;this.asyncActions=new qe.AsyncActions(10);this.customData={pathsByLocator:new Map,locatorByPath:new Map};this.indexFolderPromise=$D(ae,{indexPath:V.join(e.project.configuration.get("globalFolder"),"index")})}attachCustomData(e){}async installPackage(e,r,o){switch(e.linkType){case"SOFT":return this.installPackageSoft(e,r,o);case"HARD":return this.installPackageHard(e,r,o)}throw new Error("Assertion failed: Unsupported package link type")}async installPackageSoft(e,r,o){let a=V.resolve(r.packageFs.getRealPath(),r.prefixPath),n=this.opts.project.tryWorkspaceByLocator(e)?V.join(a,mr.nodeModules):null;return this.customData.pathsByLocator.set(e.locatorHash,{packageLocation:a,dependenciesLocation:n}),{packageLocation:a,buildRequest:null}}async installPackageHard(e,r,o){let a=Gvt(e,{project:this.opts.project}),n=a.packageLocation;this.customData.locatorByPath.set(n,G.stringifyLocator(e)),this.customData.pathsByLocator.set(e.locatorHash,a),o.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{await ae.mkdirPromise(n,{recursive:!0}),await ae.copyPromise(n,r.prefixPath,{baseFs:r.packageFs,overwrite:!1,linkStrategy:{type:"HardlinkFromIndex",indexPath:await this.indexFolderPromise,autoRepair:!0}})}));let A=G.isVirtualLocator(e)?G.devirtualizeLocator(e):e,p={manifest:await _t.tryFind(r.prefixPath,{baseFs:r.packageFs})??new _t,misc:{hasBindingGyp:CA.hasBindingGyp(r)}},h=this.opts.project.getDependencyMeta(A,e.version),E=CA.extractBuildRequest(e,p,h,{configuration:this.opts.project.configuration});return{packageLocation:n,buildRequest:E}}async attachInternalDependencies(e,r){if(this.opts.project.configuration.get("nodeLinker")!=="pnpm"||!fve(e,{project:this.opts.project}))return;let o=this.customData.pathsByLocator.get(e.locatorHash);if(typeof o>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${G.stringifyLocator(e)})`);let{dependenciesLocation:a}=o;a&&this.asyncActions.reduce(e.locatorHash,async n=>{await ae.mkdirPromise(a,{recursive:!0});let u=await Wvt(a),A=new Map(u),p=[n],h=(w,D)=>{let b=D;fve(D,{project:this.opts.project})||(this.opts.report.reportWarningOnce(0,"The pnpm linker doesn't support providing different versions to workspaces' peer dependencies"),b=G.devirtualizeLocator(D));let C=this.customData.pathsByLocator.get(b.locatorHash);if(typeof C>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${G.stringifyLocator(D)})`);let T=G.stringifyIdent(w),N=V.join(a,T),U=V.relative(V.dirname(N),C.packageLocation),J=A.get(T);A.delete(T),p.push(Promise.resolve().then(async()=>{if(J){if(J.isSymbolicLink()&&await ae.readlinkPromise(N)===U)return;await ae.removePromise(N)}await ae.mkdirpPromise(V.dirname(N)),process.platform=="win32"&&this.opts.project.configuration.get("winLinkType")==="junctions"?await ae.symlinkPromise(C.packageLocation,N,"junction"):await ae.symlinkPromise(U,N)}))},E=!1;for(let[w,D]of r)w.identHash===e.identHash&&(E=!0),h(w,D);!E&&!this.opts.project.tryWorkspaceByLocator(e)&&h(G.convertLocatorToDescriptor(e),e),p.push(Yvt(a,A)),await Promise.all(p)})}async attachExternalDependents(e,r){throw new Error("External dependencies haven't been implemented for the pnpm linker")}async finalizeInstall(){let e=hve(this.opts.project);if(this.opts.project.configuration.get("nodeLinker")!=="pnpm")await ae.removePromise(e);else{let r;try{r=new Set(await ae.readdirPromise(e))}catch{r=new Set}for(let{dependenciesLocation:o}of this.customData.pathsByLocator.values()){if(!o)continue;let a=V.contains(e,o);if(a===null)continue;let[n]=a.split(V.sep);r.delete(n)}await Promise.all([...r].map(async o=>{await ae.removePromise(V.join(e,o))}))}return await this.asyncActions.wait(),await m5(e),this.opts.project.configuration.get("nodeLinker")!=="node-modules"&&await m5(pve(this.opts.project)),{customData:this.customData}}};function pve(t){return V.join(t.cwd,mr.nodeModules)}function hve(t){return V.join(pve(t),".store")}function Gvt(t,{project:e}){let r=G.slugifyLocator(t),o=hve(e),a=V.join(o,r,"package"),n=V.join(o,r,mr.nodeModules);return{packageLocation:a,dependenciesLocation:n}}function fve(t,{project:e}){return!G.isVirtualLocator(t)||!e.tryWorkspaceByLocator(t)}async function Wvt(t){let e=new Map,r=[];try{r=await ae.readdirPromise(t,{withFileTypes:!0})}catch(o){if(o.code!=="ENOENT")throw o}try{for(let o of r)if(!o.name.startsWith("."))if(o.name.startsWith("@")){let a=await ae.readdirPromise(V.join(t,o.name),{withFileTypes:!0});if(a.length===0)e.set(o.name,o);else for(let n of a)e.set(`${o.name}/${n.name}`,n)}else e.set(o.name,o)}catch(o){if(o.code!=="ENOENT")throw o}return e}async function Yvt(t,e){let r=[],o=new Set;for(let a of e.keys()){r.push(ae.removePromise(V.join(t,a)));let n=G.tryParseIdent(a)?.scope;n&&o.add(`@${n}`)}return Promise.all(r).then(()=>Promise.all([...o].map(a=>m5(V.join(t,a)))))}async function m5(t){try{await ae.rmdirPromise(t)}catch(e){if(e.code!=="ENOENT"&&e.code!=="ENOTEMPTY")throw e}}var Vvt={linkers:[sD]},Kvt=Vvt;var D5={};Vt(D5,{StageCommand:()=>fI,default:()=>sDt,stageUtils:()=>NF});Ve();St();Gt();Ve();St();var NF={};Vt(NF,{ActionType:()=>E5,checkConsensus:()=>LF,expandDirectory:()=>w5,findConsensus:()=>B5,findVcsRoot:()=>C5,genCommitMessage:()=>v5,getCommitPrefix:()=>gve,isYarnFile:()=>I5});St();var E5=(n=>(n[n.CREATE=0]="CREATE",n[n.DELETE=1]="DELETE",n[n.ADD=2]="ADD",n[n.REMOVE=3]="REMOVE",n[n.MODIFY=4]="MODIFY",n))(E5||{});async function C5(t,{marker:e}){do if(!ae.existsSync(V.join(t,e)))t=V.dirname(t);else return t;while(t!=="/");return null}function I5(t,{roots:e,names:r}){if(r.has(V.basename(t)))return!0;do if(!e.has(t))t=V.dirname(t);else return!0;while(t!=="/");return!1}function w5(t){let e=[],r=[t];for(;r.length>0;){let o=r.pop(),a=ae.readdirSync(o);for(let n of a){let u=V.resolve(o,n);ae.lstatSync(u).isDirectory()?r.push(u):e.push(u)}}return e}function LF(t,e){let r=0,o=0;for(let a of t)a!=="wip"&&(e.test(a)?r+=1:o+=1);return r>=o}function B5(t){let e=LF(t,/^(\w\(\w+\):\s*)?\w+s/),r=LF(t,/^(\w\(\w+\):\s*)?[A-Z]/),o=LF(t,/^\w\(\w+\):/);return{useThirdPerson:e,useUpperCase:r,useComponent:o}}function gve(t){return t.useComponent?"chore(yarn): ":""}var Jvt=new Map([[0,"create"],[1,"delete"],[2,"add"],[3,"remove"],[4,"update"]]);function v5(t,e){let r=gve(t),o=[],a=e.slice().sort((n,u)=>n[0]-u[0]);for(;a.length>0;){let[n,u]=a.shift(),A=Jvt.get(n);t.useUpperCase&&o.length===0&&(A=`${A[0].toUpperCase()}${A.slice(1)}`),t.useThirdPerson&&(A+="s");let p=[u];for(;a.length>0&&a[0][0]===n;){let[,E]=a.shift();p.push(E)}p.sort();let h=p.shift();p.length===1?h+=" (and one other)":p.length>1&&(h+=` (and ${p.length} others)`),o.push(`${A} ${h}`)}return`${r}${o.join(", ")}`}var zvt="Commit generated via `yarn stage`",Xvt=11;async function dve(t){let{code:e,stdout:r}=await Hr.execvp("git",["log","-1","--pretty=format:%H"],{cwd:t});return e===0?r.trim():null}async function Zvt(t,e){let r=[],o=e.filter(h=>V.basename(h.path)==="package.json");for(let{action:h,path:E}of o){let w=V.relative(t,E);if(h===4){let D=await dve(t),{stdout:b}=await Hr.execvp("git",["show",`${D}:${w}`],{cwd:t,strict:!0}),C=await _t.fromText(b),T=await _t.fromFile(E),N=new Map([...T.dependencies,...T.devDependencies]),U=new Map([...C.dependencies,...C.devDependencies]);for(let[J,te]of U){let le=G.stringifyIdent(te),ce=N.get(J);ce?ce.range!==te.range&&r.push([4,`${le} to ${ce.range}`]):r.push([3,le])}for(let[J,te]of N)U.has(J)||r.push([2,G.stringifyIdent(te)])}else if(h===0){let D=await _t.fromFile(E);D.name?r.push([0,G.stringifyIdent(D.name)]):r.push([0,"a package"])}else if(h===1){let D=await dve(t),{stdout:b}=await Hr.execvp("git",["show",`${D}:${w}`],{cwd:t,strict:!0}),C=await _t.fromText(b);C.name?r.push([1,G.stringifyIdent(C.name)]):r.push([1,"a package"])}else throw new Error("Assertion failed: Unsupported action type")}let{code:a,stdout:n}=await Hr.execvp("git",["log",`-${Xvt}`,"--pretty=format:%s"],{cwd:t}),u=a===0?n.split(/\n/g).filter(h=>h!==""):[],A=B5(u);return v5(A,r)}var $vt={0:[" A ","?? "],4:[" M "],1:[" D "]},eDt={0:["A "],4:["M "],1:["D "]},mve={async findRoot(t){return await C5(t,{marker:".git"})},async filterChanges(t,e,r,o){let{stdout:a}=await Hr.execvp("git",["status","-s"],{cwd:t,strict:!0}),n=a.toString().split(/\n/g),u=o?.staged?eDt:$vt;return[].concat(...n.map(p=>{if(p==="")return[];let h=p.slice(0,3),E=V.resolve(t,p.slice(3));if(!o?.staged&&h==="?? "&&p.endsWith("/"))return w5(E).map(w=>({action:0,path:w}));{let D=[0,4,1].find(b=>u[b].includes(h));return D!==void 0?[{action:D,path:E}]:[]}})).filter(p=>I5(p.path,{roots:e,names:r}))},async genCommitMessage(t,e){return await Zvt(t,e)},async makeStage(t,e){let r=e.map(o=>Ae.fromPortablePath(o.path));await Hr.execvp("git",["add","--",...r],{cwd:t,strict:!0})},async makeCommit(t,e,r){let o=e.map(a=>Ae.fromPortablePath(a.path));await Hr.execvp("git",["add","-N","--",...o],{cwd:t,strict:!0}),await Hr.execvp("git",["commit","-m",`${r} - -${zvt} -`,"--",...o],{cwd:t,strict:!0})},async makeReset(t,e){let r=e.map(o=>Ae.fromPortablePath(o.path));await Hr.execvp("git",["reset","HEAD","--",...r],{cwd:t,strict:!0})}};var tDt=[mve],fI=class extends ut{constructor(){super(...arguments);this.commit=de.Boolean("-c,--commit",!1,{description:"Commit the staged files"});this.reset=de.Boolean("-r,--reset",!1,{description:"Remove all files from the staging area"});this.dryRun=de.Boolean("-n,--dry-run",!1,{description:"Print the commit message and the list of modified files without staging / committing"});this.update=de.Boolean("-u,--update",!1,{hidden:!0})}static{this.paths=[["stage"]]}static{this.usage=ot.Usage({description:"add all yarn files to your vcs",details:"\n This command will add to your staging area the files belonging to Yarn (typically any modified `package.json` and `.yarnrc.yml` files, but also linker-generated files, cache data, etc). It will take your ignore list into account, so the cache files won't be added if the cache is ignored in a `.gitignore` file (assuming you use Git).\n\n Running `--reset` will instead remove them from the staging area (the changes will still be there, but won't be committed until you stage them back).\n\n Since the staging area is a non-existent concept in Mercurial, Yarn will always create a new commit when running this command on Mercurial repositories. You can get this behavior when using Git by using the `--commit` flag which will directly create a commit.\n ",examples:[["Adds all modified project files to the staging area","yarn stage"],["Creates a new commit containing all modified project files","yarn stage --commit"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o}=await Qt.find(r,this.context.cwd),{driver:a,root:n}=await rDt(o.cwd),u=[r.get("cacheFolder"),r.get("globalFolder"),r.get("virtualFolder"),r.get("yarnPath")];await r.triggerHook(w=>w.populateYarnPaths,o,w=>{u.push(w)});let A=new Set;for(let w of u)for(let D of nDt(n,w))A.add(D);let p=new Set([r.get("rcFilename"),mr.lockfile,mr.manifest]),h=await a.filterChanges(n,A,p),E=await a.genCommitMessage(n,h);if(this.dryRun)if(this.commit)this.context.stdout.write(`${E} -`);else for(let w of h)this.context.stdout.write(`${Ae.fromPortablePath(w.path)} -`);else if(this.reset){let w=await a.filterChanges(n,A,p,{staged:!0});w.length===0?this.context.stdout.write("No staged changes found!"):await a.makeReset(n,w)}else h.length===0?this.context.stdout.write("No changes found!"):this.commit?await a.makeCommit(n,h,E):(await a.makeStage(n,h),this.context.stdout.write(E))}};async function rDt(t){let e=null,r=null;for(let o of tDt)if((r=await o.findRoot(t))!==null){e=o;break}if(e===null||r===null)throw new it("No stage driver has been found for your current project");return{driver:e,root:r}}function nDt(t,e){let r=[];if(e===null)return r;for(;;){(e===t||e.startsWith(`${t}/`))&&r.push(e);let o;try{o=ae.statSync(e)}catch{break}if(o.isSymbolicLink())e=V.resolve(V.dirname(e),ae.readlinkSync(e));else break}return r}var iDt={commands:[fI]},sDt=iDt;var S5={};Vt(S5,{default:()=>pDt});Ve();Ve();St();var Cve=et(ni());Ve();var yve=et(N6()),oDt="e8e1bd300d860104bb8c58453ffa1eb4",aDt="OFCNCOG2CU",Eve=async(t,e)=>{let r=G.stringifyIdent(t),a=lDt(e).initIndex("npm-search");try{return(await a.getObject(r,{attributesToRetrieve:["types"]})).types?.ts==="definitely-typed"}catch{return!1}},lDt=t=>(0,yve.default)(aDt,oDt,{requester:{async send(r){try{let o=await on.request(r.url,r.data||null,{configuration:t,headers:r.headers});return{content:o.body,isTimedOut:!1,status:o.statusCode}}catch(o){return{content:o.response.body,isTimedOut:!1,status:o.response.statusCode}}}}});var Ive=t=>t.scope?`${t.scope}__${t.name}`:`${t.name}`,cDt=async(t,e,r,o)=>{if(r.scope==="types")return;let{project:a}=t,{configuration:n}=a;if(!(n.get("tsEnableAutoTypes")??(ae.existsSync(V.join(t.cwd,"tsconfig.json"))||ae.existsSync(V.join(a.cwd,"tsconfig.json")))))return;let A=n.makeResolver(),p={project:a,resolver:A,report:new Ri};if(!await Eve(r,n))return;let E=Ive(r),w=G.parseRange(r.range).selector;if(!Ur.validRange(w)){let N=n.normalizeDependency(r),U=await A.getCandidates(N,{},p);w=G.parseRange(U[0].reference).selector}let D=Cve.default.coerce(w);if(D===null)return;let b=`${nu.Modifier.CARET}${D.major}`,C=G.makeDescriptor(G.makeIdent("types",E),b),T=qe.mapAndFind(a.workspaces,N=>{let U=N.manifest.dependencies.get(r.identHash)?.descriptorHash,J=N.manifest.devDependencies.get(r.identHash)?.descriptorHash;if(U!==r.descriptorHash&&J!==r.descriptorHash)return qe.mapAndFind.skip;let te=[];for(let le of _t.allDependencies){let ce=N.manifest[le].get(C.identHash);typeof ce>"u"||te.push([le,ce])}return te.length===0?qe.mapAndFind.skip:te});if(typeof T<"u")for(let[N,U]of T)t.manifest[N].set(U.identHash,U);else{try{let N=n.normalizeDependency(C);if((await A.getCandidates(N,{},p)).length===0)return}catch{return}t.manifest[nu.Target.DEVELOPMENT].set(C.identHash,C)}},uDt=async(t,e,r)=>{if(r.scope==="types")return;let{project:o}=t,{configuration:a}=o;if(!(a.get("tsEnableAutoTypes")??(ae.existsSync(V.join(t.cwd,"tsconfig.json"))||ae.existsSync(V.join(o.cwd,"tsconfig.json")))))return;let u=Ive(r),A=G.makeIdent("types",u);for(let p of _t.allDependencies)typeof t.manifest[p].get(A.identHash)>"u"||t.manifest[p].delete(A.identHash)},ADt=(t,e)=>{e.publishConfig&&e.publishConfig.typings&&(e.typings=e.publishConfig.typings),e.publishConfig&&e.publishConfig.types&&(e.types=e.publishConfig.types)},fDt={configuration:{tsEnableAutoTypes:{description:"Whether Yarn should auto-install @types/ dependencies on 'yarn add'",type:"BOOLEAN",isNullable:!0,default:null}},hooks:{afterWorkspaceDependencyAddition:cDt,afterWorkspaceDependencyRemoval:uDt,beforeWorkspacePacking:ADt}},pDt=fDt;var Q5={};Vt(Q5,{VersionApplyCommand:()=>mI,VersionCheckCommand:()=>yI,VersionCommand:()=>EI,default:()=>FDt,versionUtils:()=>dI});Ve();Ve();Gt();var dI={};Vt(dI,{Decision:()=>hI,applyPrerelease:()=>Pve,applyReleases:()=>k5,applyStrategy:()=>MF,clearVersionFiles:()=>P5,getUndecidedDependentWorkspaces:()=>aD,getUndecidedWorkspaces:()=>OF,openVersionFile:()=>gI,requireMoreDecisions:()=>bDt,resolveVersionFiles:()=>oD,suggestStrategy:()=>b5,updateVersionFiles:()=>x5,validateReleaseDecision:()=>pI});Ve();St();Ol();Gt();var Sve=et(Dve()),SA=et(ni()),xDt=/^(>=|[~^]|)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,hI=(u=>(u.UNDECIDED="undecided",u.DECLINE="decline",u.MAJOR="major",u.MINOR="minor",u.PATCH="patch",u.PRERELEASE="prerelease",u))(hI||{});function pI(t){let e=SA.default.valid(t);return e||qe.validateEnum((0,Sve.default)(hI,"UNDECIDED"),t)}async function oD(t,{prerelease:e=null}={}){let r=new Map,o=t.configuration.get("deferredVersionFolder");if(!ae.existsSync(o))return r;let a=await ae.readdirPromise(o);for(let n of a){if(!n.endsWith(".yml"))continue;let u=V.join(o,n),A=await ae.readFilePromise(u,"utf8"),p=Vi(A);for(let[h,E]of Object.entries(p.releases||{})){if(E==="decline")continue;let w=G.parseIdent(h),D=t.tryWorkspaceByIdent(w);if(D===null)throw new Error(`Assertion failed: Expected a release definition file to only reference existing workspaces (${V.basename(u)} references ${h})`);if(D.manifest.version===null)throw new Error(`Assertion failed: Expected the workspace to have a version (${G.prettyLocator(t.configuration,D.anchoredLocator)})`);let b=D.manifest.raw.stableVersion??D.manifest.version,C=r.get(D),T=MF(b,pI(E));if(T===null)throw new Error(`Assertion failed: Expected ${b} to support being bumped via strategy ${E}`);let N=typeof C<"u"?SA.default.gt(T,C)?T:C:T;r.set(D,N)}}return e&&(r=new Map([...r].map(([n,u])=>[n,Pve(u,{current:n.manifest.version,prerelease:e})]))),r}async function P5(t){let e=t.configuration.get("deferredVersionFolder");ae.existsSync(e)&&await ae.removePromise(e)}async function x5(t,e){let r=new Set(e),o=t.configuration.get("deferredVersionFolder");if(!ae.existsSync(o))return;let a=await ae.readdirPromise(o);for(let n of a){if(!n.endsWith(".yml"))continue;let u=V.join(o,n),A=await ae.readFilePromise(u,"utf8"),p=Vi(A),h=p?.releases;if(h){for(let E of Object.keys(h)){let w=G.parseIdent(E),D=t.tryWorkspaceByIdent(w);(D===null||r.has(D))&&delete p.releases[E]}Object.keys(p.releases).length>0?await ae.changeFilePromise(u,Sa(new Sa.PreserveOrdering(p))):await ae.unlinkPromise(u)}}}async function gI(t,{allowEmpty:e=!1}={}){let r=t.configuration;if(r.projectCwd===null)throw new it("This command can only be run from within a Yarn project");let o=await ra.fetchRoot(r.projectCwd),a=o!==null?await ra.fetchBase(o,{baseRefs:r.get("changesetBaseRefs")}):null,n=o!==null?await ra.fetchChangedFiles(o,{base:a.hash,project:t}):[],u=r.get("deferredVersionFolder"),A=n.filter(b=>V.contains(u,b)!==null);if(A.length>1)throw new it(`Your current branch contains multiple versioning files; this isn't supported: -- ${A.map(b=>Ae.fromPortablePath(b)).join(` -- `)}`);let p=new Set(qe.mapAndFilter(n,b=>{let C=t.tryWorkspaceByFilePath(b);return C===null?qe.mapAndFilter.skip:C}));if(A.length===0&&p.size===0&&!e)return null;let h=A.length===1?A[0]:V.join(u,`${bn.makeHash(Math.random().toString()).slice(0,8)}.yml`),E=ae.existsSync(h)?await ae.readFilePromise(h,"utf8"):"{}",w=Vi(E),D=new Map;for(let b of w.declined||[]){let C=G.parseIdent(b),T=t.getWorkspaceByIdent(C);D.set(T,"decline")}for(let[b,C]of Object.entries(w.releases||{})){let T=G.parseIdent(b),N=t.getWorkspaceByIdent(T);D.set(N,pI(C))}return{project:t,root:o,baseHash:a!==null?a.hash:null,baseTitle:a!==null?a.title:null,changedFiles:new Set(n),changedWorkspaces:p,releaseRoots:new Set([...p].filter(b=>b.manifest.version!==null)),releases:D,async saveAll(){let b={},C=[],T=[];for(let N of t.workspaces){if(N.manifest.version===null)continue;let U=G.stringifyIdent(N.anchoredLocator),J=D.get(N);J==="decline"?C.push(U):typeof J<"u"?b[U]=pI(J):p.has(N)&&T.push(U)}await ae.mkdirPromise(V.dirname(h),{recursive:!0}),await ae.changeFilePromise(h,Sa(new Sa.PreserveOrdering({releases:Object.keys(b).length>0?b:void 0,declined:C.length>0?C:void 0,undecided:T.length>0?T:void 0})))}}}function bDt(t){return OF(t).size>0||aD(t).length>0}function OF(t){let e=new Set;for(let r of t.changedWorkspaces)r.manifest.version!==null&&(t.releases.has(r)||e.add(r));return e}function aD(t,{include:e=new Set}={}){let r=[],o=new Map(qe.mapAndFilter([...t.releases],([n,u])=>u==="decline"?qe.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n])),a=new Map(qe.mapAndFilter([...t.releases],([n,u])=>u!=="decline"?qe.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n]));for(let n of t.project.workspaces)if(!(!e.has(n)&&(a.has(n.anchoredLocator.locatorHash)||o.has(n.anchoredLocator.locatorHash)))&&n.manifest.version!==null)for(let u of _t.hardDependencies)for(let A of n.manifest.getForScope(u).values()){let p=t.project.tryWorkspaceByDescriptor(A);p!==null&&o.has(p.anchoredLocator.locatorHash)&&r.push([n,p])}return r}function b5(t,e){let r=SA.default.clean(e);for(let o of Object.values(hI))if(o!=="undecided"&&o!=="decline"&&SA.default.inc(t,o)===r)return o;return null}function MF(t,e){if(SA.default.valid(e))return e;if(t===null)throw new it(`Cannot apply the release strategy "${e}" unless the workspace already has a valid version`);if(!SA.default.valid(t))throw new it(`Cannot apply the release strategy "${e}" on a non-semver version (${t})`);let r=SA.default.inc(t,e);if(r===null)throw new it(`Cannot apply the release strategy "${e}" on the specified version (${t})`);return r}function k5(t,e,{report:r}){let o=new Map;for(let a of t.workspaces)for(let n of _t.allDependencies)for(let u of a.manifest[n].values()){let A=t.tryWorkspaceByDescriptor(u);if(A===null||!e.has(A))continue;qe.getArrayWithDefault(o,A).push([a,n,u.identHash])}for(let[a,n]of e){let u=a.manifest.version;a.manifest.version=n,SA.default.prerelease(n)===null?delete a.manifest.raw.stableVersion:a.manifest.raw.stableVersion||(a.manifest.raw.stableVersion=u);let A=a.manifest.name!==null?G.stringifyIdent(a.manifest.name):null;r.reportInfo(0,`${G.prettyLocator(t.configuration,a.anchoredLocator)}: Bumped to ${n}`),r.reportJson({cwd:Ae.fromPortablePath(a.cwd),ident:A,oldVersion:u,newVersion:n});let p=o.get(a);if(!(typeof p>"u"))for(let[h,E,w]of p){let D=h.manifest[E].get(w);if(typeof D>"u")throw new Error("Assertion failed: The dependency should have existed");let b=D.range,C=!1;if(b.startsWith(ci.protocol)&&(b=b.slice(ci.protocol.length),C=!0,b===a.relativeCwd))continue;let T=b.match(xDt);if(!T){r.reportWarning(0,`Couldn't auto-upgrade range ${b} (in ${G.prettyLocator(t.configuration,h.anchoredLocator)})`);continue}let N=`${T[1]}${n}`;C&&(N=`${ci.protocol}${N}`);let U=G.makeDescriptor(D,N);h.manifest[E].set(w,U)}}}var kDt=new Map([["%n",{extract:t=>t.length>=1?[t[0],t.slice(1)]:null,generate:(t=0)=>`${t+1}`}]]);function Pve(t,{current:e,prerelease:r}){let o=new SA.default.SemVer(e),a=o.prerelease.slice(),n=[];o.prerelease=[],o.format()!==t&&(a.length=0);let u=!0,A=r.split(/\./g);for(let p of A){let h=kDt.get(p);if(typeof h>"u")n.push(p),a[0]===p?a.shift():u=!1;else{let E=u?h.extract(a):null;E!==null&&typeof E[0]=="number"?(n.push(h.generate(E[0])),a=E[1]):(n.push(h.generate()),u=!1)}}return o.prerelease&&(o.prerelease=[]),`${t}-${n.join(".")}`}var mI=class extends ut{constructor(){super(...arguments);this.all=de.Boolean("--all",!1,{description:"Apply the deferred version changes on all workspaces"});this.dryRun=de.Boolean("--dry-run",!1,{description:"Print the versions without actually generating the package archive"});this.prerelease=de.String("--prerelease",{description:"Add a prerelease identifier to new versions",tolerateBoolean:!0});this.recursive=de.Boolean("-R,--recursive",{description:"Release the transitive workspaces as well"});this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["version","apply"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"apply all the deferred version bumps at once",details:` - This command will apply the deferred version changes and remove their definitions from the repository. - - Note that if \`--prerelease\` is set, the given prerelease identifier (by default \`rc.%n\`) will be used on all new versions and the version definitions will be kept as-is. - - By default only the current workspace will be bumped, but you can configure this behavior by using one of: - - - \`--recursive\` to also apply the version bump on its dependencies - - \`--all\` to apply the version bump on all packages in the repository - - Note that this command will also update the \`workspace:\` references across all your local workspaces, thus ensuring that they keep referring to the same workspaces even after the version bump. - `,examples:[["Apply the version change to the local workspace","yarn version apply"],["Apply the version change to all the workspaces in the local workspace","yarn version apply --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);if(!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=await Lt.start({configuration:r,json:this.json,stdout:this.context.stdout},async A=>{let p=this.prerelease?typeof this.prerelease!="boolean"?this.prerelease:"rc.%n":null,h=await oD(o,{prerelease:p}),E=new Map;if(this.all)E=h;else{let w=this.recursive?a.getRecursiveWorkspaceDependencies():[a];for(let D of w){let b=h.get(D);typeof b<"u"&&E.set(D,b)}}if(E.size===0){let w=h.size>0?" Did you want to add --all?":"";A.reportWarning(0,`The current workspace doesn't seem to require a version bump.${w}`);return}k5(o,E,{report:A}),this.dryRun||(p||(this.all?await P5(o):await x5(o,[...E.keys()])),A.reportSeparator())});return this.dryRun||u.hasErrors()?u.exitCode():await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};Ve();St();Gt();var UF=et(ni());var yI=class extends ut{constructor(){super(...arguments);this.interactive=de.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}static{this.paths=[["version","check"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"check that all the relevant packages have been bumped",details:"\n **Warning:** This command currently requires Git.\n\n This command will check that all the packages covered by the files listed in argument have been properly bumped or declined to bump.\n\n In the case of a bump, the check will also cover transitive packages - meaning that should `Foo` be bumped, a package `Bar` depending on `Foo` will require a decision as to whether `Bar` will need to be bumped. This check doesn't cross packages that have declined to bump.\n\n In case no arguments are passed to the function, the list of modified files will be generated by comparing the HEAD against `master`.\n ",examples:[["Check whether the modified packages need a bump","yarn version check"]]})}async execute(){return this.interactive?await this.executeInteractive():await this.executeStandard()}async executeInteractive(){AC(this.context);let{Gem:r}=await Promise.resolve().then(()=>(UQ(),oj)),{ScrollableItems:o}=await Promise.resolve().then(()=>(jQ(),qQ)),{FocusRequest:a}=await Promise.resolve().then(()=>(lj(),Qwe)),{useListInput:n}=await Promise.resolve().then(()=>(HQ(),Fwe)),{renderForm:u}=await Promise.resolve().then(()=>(VQ(),YQ)),{Box:A,Text:p}=await Promise.resolve().then(()=>et(ac())),{default:h,useCallback:E,useState:w}=await Promise.resolve().then(()=>et(ln())),D=await ze.find(this.context.cwd,this.context.plugins),{project:b,workspace:C}=await Qt.find(D,this.context.cwd);if(!C)throw new or(b.cwd,this.context.cwd);await b.restoreInstallState();let T=await gI(b);if(T===null||T.releaseRoots.size===0)return 0;if(T.root===null)throw new it("This command can only be run on Git repositories");let N=()=>h.createElement(A,{flexDirection:"row",paddingBottom:1},h.createElement(A,{flexDirection:"column",width:60},h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select workspaces.")),h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select release strategies."))),h.createElement(A,{flexDirection:"column"},h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to save.")),h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to abort.")))),U=({workspace:Ie,active:he,decision:De,setDecision:Ee})=>{let g=Ie.manifest.raw.stableVersion??Ie.manifest.version;if(g===null)throw new Error(`Assertion failed: The version should have been set (${G.prettyLocator(D,Ie.anchoredLocator)})`);if(UF.default.prerelease(g)!==null)throw new Error(`Assertion failed: Prerelease identifiers shouldn't be found (${g})`);let me=["undecided","decline","patch","minor","major"];n(De,me,{active:he,minus:"left",plus:"right",set:Ee});let Ce=De==="undecided"?h.createElement(p,{color:"yellow"},g):De==="decline"?h.createElement(p,{color:"green"},g):h.createElement(p,null,h.createElement(p,{color:"magenta"},g)," \u2192 ",h.createElement(p,{color:"green"},UF.default.valid(De)?De:UF.default.inc(g,De)));return h.createElement(A,{flexDirection:"column"},h.createElement(A,null,h.createElement(p,null,G.prettyLocator(D,Ie.anchoredLocator)," - ",Ce)),h.createElement(A,null,me.map(fe=>h.createElement(A,{key:fe,paddingLeft:2},h.createElement(p,null,h.createElement(r,{active:fe===De})," ",fe)))))},J=Ie=>{let he=new Set(T.releaseRoots),De=new Map([...Ie].filter(([Ee])=>he.has(Ee)));for(;;){let Ee=aD({project:T.project,releases:De}),g=!1;if(Ee.length>0){for(let[me]of Ee)if(!he.has(me)){he.add(me),g=!0;let Ce=Ie.get(me);typeof Ce<"u"&&De.set(me,Ce)}}if(!g)break}return{relevantWorkspaces:he,relevantReleases:De}},te=()=>{let[Ie,he]=w(()=>new Map(T.releases)),De=E((Ee,g)=>{let me=new Map(Ie);g!=="undecided"?me.set(Ee,g):me.delete(Ee);let{relevantReleases:Ce}=J(me);he(Ce)},[Ie,he]);return[Ie,De]},le=({workspaces:Ie,releases:he})=>{let De=[];De.push(`${Ie.size} total`);let Ee=0,g=0;for(let me of Ie){let Ce=he.get(me);typeof Ce>"u"?g+=1:Ce!=="decline"&&(Ee+=1)}return De.push(`${Ee} release${Ee===1?"":"s"}`),De.push(`${g} remaining`),h.createElement(p,{color:"yellow"},De.join(", "))},ue=await u(({useSubmit:Ie})=>{let[he,De]=te();Ie(he);let{relevantWorkspaces:Ee}=J(he),g=new Set([...Ee].filter(ie=>!T.releaseRoots.has(ie))),[me,Ce]=w(0),fe=E(ie=>{switch(ie){case a.BEFORE:Ce(me-1);break;case a.AFTER:Ce(me+1);break}},[me,Ce]);return h.createElement(A,{flexDirection:"column"},h.createElement(N,null),h.createElement(A,null,h.createElement(p,{wrap:"wrap"},"The following files have been modified in your local checkout.")),h.createElement(A,{flexDirection:"column",marginTop:1,paddingLeft:2},[...T.changedFiles].map(ie=>h.createElement(A,{key:ie},h.createElement(p,null,h.createElement(p,{color:"grey"},Ae.fromPortablePath(T.root)),Ae.sep,Ae.relative(Ae.fromPortablePath(T.root),Ae.fromPortablePath(ie)))))),T.releaseRoots.size>0&&h.createElement(h.Fragment,null,h.createElement(A,{marginTop:1},h.createElement(p,{wrap:"wrap"},"Because of those files having been modified, the following workspaces may need to be released again (note that private workspaces are also shown here, because even though they won't be published, releasing them will allow us to flag their dependents for potential re-release):")),g.size>3?h.createElement(A,{marginTop:1},h.createElement(le,{workspaces:T.releaseRoots,releases:he})):null,h.createElement(A,{marginTop:1,flexDirection:"column"},h.createElement(o,{active:me%2===0,radius:1,size:2,onFocusRequest:fe},[...T.releaseRoots].map(ie=>h.createElement(U,{key:ie.cwd,workspace:ie,decision:he.get(ie)||"undecided",setDecision:Z=>De(ie,Z)}))))),g.size>0?h.createElement(h.Fragment,null,h.createElement(A,{marginTop:1},h.createElement(p,{wrap:"wrap"},"The following workspaces depend on other workspaces that have been marked for release, and thus may need to be released as well:")),h.createElement(A,null,h.createElement(p,null,"(Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to move the focus between the workspace groups.)")),g.size>5?h.createElement(A,{marginTop:1},h.createElement(le,{workspaces:g,releases:he})):null,h.createElement(A,{marginTop:1,flexDirection:"column"},h.createElement(o,{active:me%2===1,radius:2,size:2,onFocusRequest:fe},[...g].map(ie=>h.createElement(U,{key:ie.cwd,workspace:ie,decision:he.get(ie)||"undecided",setDecision:Z=>De(ie,Z)}))))):null)},{versionFile:T},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof ue>"u")return 1;T.releases.clear();for(let[Ie,he]of ue)T.releases.set(Ie,he);await T.saveAll()}async executeStandard(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);return await o.restoreInstallState(),(await Lt.start({configuration:r,stdout:this.context.stdout},async u=>{let A=await gI(o);if(A===null||A.releaseRoots.size===0)return;if(A.root===null)throw new it("This command can only be run on Git repositories");if(u.reportInfo(0,`Your PR was started right after ${pe.pretty(r,A.baseHash.slice(0,7),"yellow")} ${pe.pretty(r,A.baseTitle,"magenta")}`),A.changedFiles.size>0){u.reportInfo(0,"You have changed the following files since then:"),u.reportSeparator();for(let D of A.changedFiles)u.reportInfo(null,`${pe.pretty(r,Ae.fromPortablePath(A.root),"gray")}${Ae.sep}${Ae.relative(Ae.fromPortablePath(A.root),Ae.fromPortablePath(D))}`)}let p=!1,h=!1,E=OF(A);if(E.size>0){p||u.reportSeparator();for(let D of E)u.reportError(0,`${G.prettyLocator(r,D.anchoredLocator)} has been modified but doesn't have a release strategy attached`);p=!0}let w=aD(A);for(let[D,b]of w)h||u.reportSeparator(),u.reportError(0,`${G.prettyLocator(r,D.anchoredLocator)} doesn't have a release strategy attached, but depends on ${G.prettyWorkspace(r,b)} which is planned for release.`),h=!0;(p||h)&&(u.reportSeparator(),u.reportInfo(0,"This command detected that at least some workspaces have received modifications without explicit instructions as to how they had to be released (if needed)."),u.reportInfo(0,"To correct these errors, run `yarn version check --interactive` then follow the instructions."))})).exitCode()}};Ve();Gt();var _F=et(ni());var EI=class extends ut{constructor(){super(...arguments);this.deferred=de.Boolean("-d,--deferred",{description:"Prepare the version to be bumped during the next release cycle"});this.immediate=de.Boolean("-i,--immediate",{description:"Bump the version immediately"});this.strategy=de.String()}static{this.paths=[["version"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"apply a new version to the current package",details:"\n This command will bump the version number for the given package, following the specified strategy:\n\n - If `major`, the first number from the semver range will be increased (`X.0.0`).\n - If `minor`, the second number from the semver range will be increased (`0.X.0`).\n - If `patch`, the third number from the semver range will be increased (`0.0.X`).\n - If prefixed by `pre` (`premajor`, ...), a `-0` suffix will be set (`0.0.0-0`).\n - If `prerelease`, the suffix will be increased (`0.0.0-X`); the third number from the semver range will also be increased if there was no suffix in the previous version.\n - If `decline`, the nonce will be increased for `yarn version check` to pass without version bump.\n - If a valid semver range, it will be used as new version.\n - If unspecified, Yarn will ask you for guidance.\n\n For more information about the `--deferred` flag, consult our documentation (https://yarnpkg.com/features/release-workflow#deferred-versioning).\n ",examples:[["Immediately bump the version to the next major","yarn version major"],["Prepare the version to be bumped to the next major","yarn version major --deferred"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!a)throw new or(o.cwd,this.context.cwd);let n=r.get("preferDeferredVersions");this.deferred&&(n=!0),this.immediate&&(n=!1);let u=_F.default.valid(this.strategy),A=this.strategy==="decline",p;if(u)if(a.manifest.version!==null){let E=b5(a.manifest.version,this.strategy);E!==null?p=E:p=this.strategy}else p=this.strategy;else{let E=a.manifest.version;if(!A){if(E===null)throw new it("Can't bump the version if there wasn't a version to begin with - use 0.0.0 as initial version then run the command again.");if(typeof E!="string"||!_F.default.valid(E))throw new it(`Can't bump the version (${E}) if it's not valid semver`)}p=pI(this.strategy)}if(!n){let w=(await oD(o)).get(a);if(typeof w<"u"&&p!=="decline"){let D=MF(a.manifest.version,p);if(_F.default.lt(D,w))throw new it(`Can't bump the version to one that would be lower than the current deferred one (${w})`)}}let h=await gI(o,{allowEmpty:!0});return h.releases.set(a,p),await h.saveAll(),n?0:await this.cli.run(["version","apply"])}};var QDt={configuration:{deferredVersionFolder:{description:"Folder where are stored the versioning files",type:"ABSOLUTE_PATH",default:"./.yarn/versions"},preferDeferredVersions:{description:"If true, running `yarn version` will assume the `--deferred` flag unless `--immediate` is set",type:"BOOLEAN",default:!1}},commands:[mI,yI,EI]},FDt=QDt;var F5={};Vt(F5,{WorkspacesFocusCommand:()=>CI,WorkspacesForeachCommand:()=>wI,default:()=>LDt});Ve();Ve();Gt();var CI=class extends ut{constructor(){super(...arguments);this.json=de.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=de.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=de.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=de.Rest()}static{this.paths=[["workspaces","focus"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd),n=await Wr.find(r);await o.restoreInstallState({restoreResolutions:!1});let u;if(this.all)u=new Set(o.workspaces);else if(this.workspaces.length===0){if(!a)throw new or(o.cwd,this.context.cwd);u=new Set([a])}else u=new Set(this.workspaces.map(A=>o.getWorkspaceByIdent(G.parseIdent(A))));for(let A of u)for(let p of this.production?["dependencies"]:_t.hardDependencies)for(let h of A.manifest.getForScope(p).values()){let E=o.tryWorkspaceByDescriptor(h);E!==null&&u.add(E)}for(let A of o.workspaces)u.has(A)?this.production&&A.manifest.devDependencies.clear():(A.manifest.installConfig=A.manifest.installConfig||{},A.manifest.installConfig.selfReferences=!1,A.manifest.dependencies.clear(),A.manifest.devDependencies.clear(),A.manifest.peerDependencies.clear(),A.manifest.scripts.clear());return await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n,persistProject:!1})}};Ve();Ve();Ve();Gt();var II=et(Xo()),bve=et(lg());il();var wI=class extends ut{constructor(){super(...arguments);this.from=de.Array("--from",{description:"An array of glob pattern idents or paths from which to base any recursion"});this.all=de.Boolean("-A,--all",{description:"Run the command on all workspaces of a project"});this.recursive=de.Boolean("-R,--recursive",{description:"Run the command on the current workspace and all of its recursive dependencies"});this.worktree=de.Boolean("-W,--worktree",{description:"Run the command on all workspaces of the current worktree"});this.verbose=de.Counter("-v,--verbose",{description:"Increase level of logging verbosity up to 2 times"});this.parallel=de.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=de.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=de.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:pL([js(["unlimited"]),vw(fL(),[gL(),hL(1)])])});this.topological=de.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=de.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=de.Array("--include",[],{description:"An array of glob pattern idents or paths; only matching workspaces will be traversed"});this.exclude=de.Array("--exclude",[],{description:"An array of glob pattern idents or paths; matching workspaces won't be traversed"});this.publicOnly=de.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=de.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.dryRun=de.Boolean("-n,--dry-run",{description:"Print the commands that would be run, without actually running them"});this.commandName=de.String();this.args=de.Proxy()}static{this.paths=[["workspaces","foreach"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `-W,--worktree` is set, Yarn will find workspaces to run the command on by looking at the current worktree.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - If `--dry-run` is set, Yarn will explain what it would do without actually doing anything.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n The `-v,--verbose` flag can be passed up to twice: once to prefix output lines with the originating workspace's name, and again to include start/finish/timing log lines. Maximum verbosity is enabled by default in terminal environments.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish all packages","yarn workspaces foreach -A npm publish --tolerate-republish"],["Run the build script on all descendant packages","yarn workspaces foreach -A run build"],["Run the build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -Apt run build"],["Run the build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -Rpt --from '{workspace-a,workspace-b}' run build"]]})}static{this.schema=[Sw("all",Vu.Forbids,["from","recursive","since","worktree"],{missingIf:"undefined"}),dL(["all","recursive","since","worktree"],{missingIf:"undefined"})]}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await Qt.find(r,this.context.cwd);if(!this.all&&!a)throw new or(o.cwd,this.context.cwd);await o.restoreInstallState();let n=this.cli.process([this.commandName,...this.args]),u=n.path.length===1&&n.path[0]==="run"&&typeof n.scriptName<"u"?n.scriptName:null;if(n.path.length===0)throw new it("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let A=Ee=>{this.dryRun&&this.context.stdout.write(`${Ee} -`)},p=()=>{let Ee=this.from.map(g=>II.default.matcher(g));return o.workspaces.filter(g=>{let me=G.stringifyIdent(g.anchoredLocator),Ce=g.relativeCwd;return Ee.some(fe=>fe(me)||fe(Ce))})},h=[];if(this.since?(A("Option --since is set; selecting the changed workspaces as root for workspace selection"),h=Array.from(await ra.fetchChangedWorkspaces({ref:this.since,project:o}))):this.from?(A("Option --from is set; selecting the specified workspaces"),h=[...p()]):this.worktree?(A("Option --worktree is set; selecting the current workspace"),h=[a]):this.recursive?(A("Option --recursive is set; selecting the current workspace"),h=[a]):this.all&&(A("Option --all is set; selecting all workspaces"),h=[...o.workspaces]),this.dryRun&&!this.all){for(let Ee of h)A(` -- ${Ee.relativeCwd} - ${G.prettyLocator(r,Ee.anchoredLocator)}`);h.length>0&&A("")}let E;if(this.recursive?this.since?(A("Option --recursive --since is set; recursively selecting all dependent workspaces"),E=new Set(h.map(Ee=>[...Ee.getRecursiveWorkspaceDependents()]).flat())):(A("Option --recursive is set; recursively selecting all transitive dependencies"),E=new Set(h.map(Ee=>[...Ee.getRecursiveWorkspaceDependencies()]).flat())):this.worktree?(A("Option --worktree is set; recursively selecting all nested workspaces"),E=new Set(h.map(Ee=>[...Ee.getRecursiveWorkspaceChildren()]).flat())):E=null,E!==null&&(h=[...new Set([...h,...E])],this.dryRun))for(let Ee of E)A(` -- ${Ee.relativeCwd} - ${G.prettyLocator(r,Ee.anchoredLocator)}`);let w=[],D=!1;if(u?.includes(":")){for(let Ee of o.workspaces)if(Ee.manifest.scripts.has(u)&&(D=!D,D===!1))break}for(let Ee of h){if(u&&!Ee.manifest.scripts.has(u)&&!D&&!(await hn.getWorkspaceAccessibleBinaries(Ee)).has(u)){A(`Excluding ${Ee.relativeCwd} because it doesn't have a "${u}" script`);continue}if(!(u===r.env.npm_lifecycle_event&&Ee.cwd===a.cwd)){if(this.include.length>0&&!II.default.isMatch(G.stringifyIdent(Ee.anchoredLocator),this.include)&&!II.default.isMatch(Ee.relativeCwd,this.include)){A(`Excluding ${Ee.relativeCwd} because it doesn't match the --include filter`);continue}if(this.exclude.length>0&&(II.default.isMatch(G.stringifyIdent(Ee.anchoredLocator),this.exclude)||II.default.isMatch(Ee.relativeCwd,this.exclude))){A(`Excluding ${Ee.relativeCwd} because it matches the --exclude filter`);continue}if(this.publicOnly&&Ee.manifest.private===!0){A(`Excluding ${Ee.relativeCwd} because it's a private workspace and --no-private was set`);continue}w.push(Ee)}}if(this.dryRun)return 0;let b=this.verbose??(this.context.stdout.isTTY?1/0:0),C=b>0,T=b>1,N=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(Xi.availableParallelism()/2):1,U=N===1?!1:this.parallel,J=U?this.interlaced:!0,te=(0,bve.default)(N),le=new Map,ce=new Set,ue=0,Ie=null,he=!1,De=await Lt.start({configuration:r,stdout:this.context.stdout,includePrefix:!1},async Ee=>{let g=async(me,{commandIndex:Ce})=>{if(he)return-1;!U&&T&&Ce>1&&Ee.reportSeparator();let fe=RDt(me,{configuration:r,label:C,commandIndex:Ce}),[ie,Z]=xve(Ee,{prefix:fe,interlaced:J}),[Se,Re]=xve(Ee,{prefix:fe,interlaced:J});try{T&&Ee.reportInfo(null,`${fe?`${fe} `:""}Process started`);let ht=Date.now(),q=await this.cli.run([this.commandName,...this.args],{cwd:me.cwd,stdout:ie,stderr:Se})||0;ie.end(),Se.end(),await Z,await Re;let nt=Date.now();if(T){let Le=r.get("enableTimers")?`, completed in ${pe.pretty(r,nt-ht,pe.Type.DURATION)}`:"";Ee.reportInfo(null,`${fe?`${fe} `:""}Process exited (exit code ${q})${Le}`)}return q===130&&(he=!0,Ie=q),q}catch(ht){throw ie.end(),Se.end(),await Z,await Re,ht}};for(let me of w)le.set(me.anchoredLocator.locatorHash,me);for(;le.size>0&&!Ee.hasErrors();){let me=[];for(let[Z,Se]of le){if(ce.has(Se.anchoredDescriptor.descriptorHash))continue;let Re=!0;if(this.topological||this.topologicalDev){let ht=this.topologicalDev?new Map([...Se.manifest.dependencies,...Se.manifest.devDependencies]):Se.manifest.dependencies;for(let q of ht.values()){let nt=o.tryWorkspaceByDescriptor(q);if(Re=nt===null||!le.has(nt.anchoredLocator.locatorHash),!Re)break}}if(Re&&(ce.add(Se.anchoredDescriptor.descriptorHash),me.push(te(async()=>{let ht=await g(Se,{commandIndex:++ue});return le.delete(Z),ce.delete(Se.anchoredDescriptor.descriptorHash),{workspace:Se,exitCode:ht}})),!U))break}if(me.length===0){let Z=Array.from(le.values()).map(Se=>G.prettyLocator(r,Se.anchoredLocator)).join(", ");Ee.reportError(3,`Dependency cycle detected (${Z})`);return}let Ce=await Promise.all(me);Ce.forEach(({workspace:Z,exitCode:Se})=>{Se!==0&&Ee.reportError(0,`The command failed in workspace ${G.prettyLocator(r,Z.anchoredLocator)} with exit code ${Se}`)});let ie=Ce.map(Z=>Z.exitCode).find(Z=>Z!==0);(this.topological||this.topologicalDev)&&typeof ie<"u"&&Ee.reportError(0,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return Ie!==null?Ie:De.exitCode()}};function xve(t,{prefix:e,interlaced:r}){let o=t.createStreamReporter(e),a=new qe.DefaultStream;a.pipe(o,{end:!1}),a.on("finish",()=>{o.end()});let n=new Promise(A=>{o.on("finish",()=>{A(a.active)})});if(r)return[a,n];let u=new qe.BufferStream;return u.pipe(a,{end:!1}),u.on("finish",()=>{a.end()}),[u,n]}function RDt(t,{configuration:e,commandIndex:r,label:o}){if(!o)return null;let n=`[${G.stringifyIdent(t.anchoredLocator)}]:`,u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],A=u[r%u.length];return pe.pretty(e,n,A)}var TDt={commands:[CI,wI]},LDt=TDt;var lE=()=>({modules:new Map([["@yarnpkg/cli",P2],["@yarnpkg/core",S2],["@yarnpkg/fslib",Aw],["@yarnpkg/libzip",K1],["@yarnpkg/parsers",Ew],["@yarnpkg/shell",e2],["clipanion",Qw],["semver",NDt],["typanion",Yo],["@yarnpkg/plugin-essentials",MH],["@yarnpkg/plugin-compat",jH],["@yarnpkg/plugin-constraints",a6],["@yarnpkg/plugin-dlx",l6],["@yarnpkg/plugin-exec",A6],["@yarnpkg/plugin-file",p6],["@yarnpkg/plugin-git",OH],["@yarnpkg/plugin-github",d6],["@yarnpkg/plugin-http",m6],["@yarnpkg/plugin-init",y6],["@yarnpkg/plugin-interactive-tools",mj],["@yarnpkg/plugin-link",yj],["@yarnpkg/plugin-nm",tG],["@yarnpkg/plugin-npm",$G],["@yarnpkg/plugin-npm-cli",l5],["@yarnpkg/plugin-pack",KG],["@yarnpkg/plugin-patch",g5],["@yarnpkg/plugin-pnp",jj],["@yarnpkg/plugin-pnpm",y5],["@yarnpkg/plugin-stage",D5],["@yarnpkg/plugin-typescript",S5],["@yarnpkg/plugin-version",Q5],["@yarnpkg/plugin-workspace-tools",F5]]),plugins:new Set(["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-constraints","@yarnpkg/plugin-dlx","@yarnpkg/plugin-exec","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp","@yarnpkg/plugin-pnpm","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"])});function Fve({cwd:t,pluginConfiguration:e}){let r=new Ko({binaryLabel:"Yarn Package Manager",binaryName:"yarn",binaryVersion:nn??""});return Object.assign(r,{defaultContext:{...Ko.defaultContext,cwd:t,plugins:e,quiet:!1,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr}})}function ODt(t){if(qe.parseOptionalBoolean(process.env.YARN_IGNORE_NODE))return!0;let r=process.versions.node,o=">=18.12.0";if(Ur.satisfiesWithPrereleases(r,o))return!0;let a=new it(`This tool requires a Node version compatible with ${o} (got ${r}). Upgrade Node, or set \`YARN_IGNORE_NODE=1\` in your environment.`);return Ko.defaultContext.stdout.write(t.error(a)),!1}async function Rve({selfPath:t,pluginConfiguration:e}){return await ze.find(Ae.toPortablePath(process.cwd()),e,{strict:!1,usePathCheck:t})}function MDt(t,e,{yarnPath:r}){if(!ae.existsSync(r))return t.error(new Error(`The "yarn-path" option has been set, but the specified location doesn't exist (${r}).`)),1;process.on("SIGINT",()=>{});let o={stdio:"inherit",env:{...process.env,YARN_IGNORE_PATH:"1"}};try{(0,kve.execFileSync)(process.execPath,[Ae.fromPortablePath(r),...e],o)}catch(a){return a.status??1}return 0}function UDt(t,e){let r=null,o=e;return e.length>=2&&e[0]==="--cwd"?(r=Ae.toPortablePath(e[1]),o=e.slice(2)):e.length>=1&&e[0].startsWith("--cwd=")?(r=Ae.toPortablePath(e[0].slice(6)),o=e.slice(1)):e[0]==="add"&&e[e.length-2]==="--cwd"&&(r=Ae.toPortablePath(e[e.length-1]),o=e.slice(0,e.length-2)),t.defaultContext.cwd=r!==null?V.resolve(r):V.cwd(),o}function _Dt(t,{configuration:e}){if(!e.get("enableTelemetry")||Qve.isCI||!process.stdout.isTTY)return;ze.telemetry=new sE(e,"puba9cdc10ec5790a2cf4969dd413a47270");let o=/^@yarnpkg\/plugin-(.*)$/;for(let a of e.plugins.keys())oE.has(a.match(o)?.[1]??"")&&ze.telemetry?.reportPluginName(a);t.binaryVersion&&ze.telemetry.reportVersion(t.binaryVersion)}function Tve(t,{configuration:e}){for(let r of e.plugins.values())for(let o of r.commands||[])t.register(o)}async function HDt(t,e,{selfPath:r,pluginConfiguration:o}){if(!ODt(t))return 1;let a=await Rve({selfPath:r,pluginConfiguration:o}),n=a.get("yarnPath"),u=a.get("ignorePath");if(n&&!u)return MDt(t,e,{yarnPath:n});delete process.env.YARN_IGNORE_PATH;let A=UDt(t,e);_Dt(t,{configuration:a}),Tve(t,{configuration:a});let p=t.process(A,t.defaultContext);return p.help||ze.telemetry?.reportCommandName(p.path.join(" ")),await t.run(p,t.defaultContext)}async function qhe({cwd:t=V.cwd(),pluginConfiguration:e=lE()}={}){let r=Fve({cwd:t,pluginConfiguration:e}),o=await Rve({pluginConfiguration:e,selfPath:null});return Tve(r,{configuration:o}),r}async function Nk(t,{cwd:e=V.cwd(),selfPath:r,pluginConfiguration:o}){let a=Fve({cwd:e,pluginConfiguration:o});function n(){Ko.defaultContext.stdout.write(`ERROR: Yarn is terminating due to an unexpected empty event loop. -Please report this issue at https://github.com/yarnpkg/berry/issues.`)}process.once("beforeExit",n);try{process.exitCode=42,process.exitCode=await HDt(a,t,{selfPath:r,pluginConfiguration:o})}catch(u){Ko.defaultContext.stdout.write(a.error(u)),process.exitCode=1}finally{process.off("beforeExit",n),await ae.rmtempPromise()}}Nk(process.argv.slice(2),{cwd:V.cwd(),selfPath:Ae.toPortablePath(Ae.resolve(process.argv[1])),pluginConfiguration:lE()});})(); -/** - @license - Copyright (c) 2015, Rebecca Turner - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - */ -/** - @license - Copyright Node.js contributors. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ -/** - @license - The MIT License (MIT) - - Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ -/** - @license - Copyright Joyent, Inc. and other Node contributors. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to permit - persons to whom the Software is furnished to do so, subject to the - following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -/*! Bundled license information: - -is-number/index.js: - (*! - * is-number - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - *) - -to-regex-range/index.js: - (*! - * to-regex-range - * - * Copyright (c) 2015-present, Jon Schlinkert. - * Released under the MIT License. - *) - -fill-range/index.js: - (*! - * fill-range - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Licensed under the MIT License. - *) - -is-extglob/index.js: - (*! - * is-extglob - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - *) - -is-glob/index.js: - (*! - * is-glob - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - *) - -queue-microtask/index.js: - (*! queue-microtask. MIT License. Feross Aboukhadijeh *) - -run-parallel/index.js: - (*! run-parallel. MIT License. Feross Aboukhadijeh *) - -git-url-parse/lib/index.js: - (*! - * buildToken - * Builds OAuth token prefix (helper function) - * - * @name buildToken - * @function - * @param {GitUrl} obj The parsed Git url object. - * @return {String} token prefix - *) - -object-assign/index.js: - (* - object-assign - (c) Sindre Sorhus - @license MIT - *) - -react/cjs/react.production.min.js: - (** @license React v17.0.2 - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -scheduler/cjs/scheduler.production.min.js: - (** @license React v0.20.2 - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -react-reconciler/cjs/react-reconciler.production.min.js: - (** @license React v0.26.2 - * react-reconciler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -is-windows/index.js: - (*! - * is-windows - * - * Copyright © 2015-2018, Jon Schlinkert. - * Released under the MIT License. - *) -*/ diff --git a/.yarn/releases/yarn-4.9.1.cjs b/.yarn/releases/yarn-4.9.1.cjs new file mode 100755 index 0000000000..657026d5c6 --- /dev/null +++ b/.yarn/releases/yarn-4.9.1.cjs @@ -0,0 +1,948 @@ +#!/usr/bin/env node +/* eslint-disable */ +//prettier-ignore +(()=>{var u7e=Object.create;var D_=Object.defineProperty;var f7e=Object.getOwnPropertyDescriptor;var A7e=Object.getOwnPropertyNames;var p7e=Object.getPrototypeOf,h7e=Object.prototype.hasOwnProperty;var ye=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var It=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Vt=(t,e)=>{for(var r in e)D_(t,r,{get:e[r],enumerable:!0})},g7e=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of A7e(e))!h7e.call(t,a)&&a!==r&&D_(t,a,{get:()=>e[a],enumerable:!(s=f7e(e,a))||s.enumerable});return t};var et=(t,e,r)=>(r=t!=null?u7e(p7e(t)):{},g7e(e||!t||!t.__esModule?D_(r,"default",{value:t,enumerable:!0}):r,t));var ui={};Vt(ui,{SAFE_TIME:()=>P$,S_IFDIR:()=>lx,S_IFLNK:()=>cx,S_IFMT:()=>_f,S_IFREG:()=>M2});var _f,lx,M2,cx,P$,x$=It(()=>{_f=61440,lx=16384,M2=32768,cx=40960,P$=456789e3});var or={};Vt(or,{EBADF:()=>Uo,EBUSY:()=>d7e,EEXIST:()=>w7e,EINVAL:()=>y7e,EISDIR:()=>C7e,ENOENT:()=>E7e,ENOSYS:()=>m7e,ENOTDIR:()=>I7e,ENOTEMPTY:()=>v7e,EOPNOTSUPP:()=>S7e,EROFS:()=>B7e,ERR_DIR_CLOSED:()=>b_});function wc(t,e){return Object.assign(new Error(`${t}: ${e}`),{code:t})}function d7e(t){return wc("EBUSY",t)}function m7e(t,e){return wc("ENOSYS",`${t}, ${e}`)}function y7e(t){return wc("EINVAL",`invalid argument, ${t}`)}function Uo(t){return wc("EBADF",`bad file descriptor, ${t}`)}function E7e(t){return wc("ENOENT",`no such file or directory, ${t}`)}function I7e(t){return wc("ENOTDIR",`not a directory, ${t}`)}function C7e(t){return wc("EISDIR",`illegal operation on a directory, ${t}`)}function w7e(t){return wc("EEXIST",`file already exists, ${t}`)}function B7e(t){return wc("EROFS",`read-only filesystem, ${t}`)}function v7e(t){return wc("ENOTEMPTY",`directory not empty, ${t}`)}function S7e(t){return wc("EOPNOTSUPP",`operation not supported, ${t}`)}function b_(){return wc("ERR_DIR_CLOSED","Directory handle was closed")}var ux=It(()=>{});var el={};Vt(el,{BigIntStatsEntry:()=>iE,DEFAULT_MODE:()=>k_,DirEntry:()=>P_,StatEntry:()=>nE,areStatsEqual:()=>Q_,clearStats:()=>fx,convertToBigIntStats:()=>b7e,makeDefaultStats:()=>k$,makeEmptyStats:()=>D7e});function k$(){return new nE}function D7e(){return fx(k$())}function fx(t){for(let e in t)if(Object.hasOwn(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):x_.types.isDate(r)&&(t[e]=new Date(0))}return t}function b7e(t){let e=new iE;for(let r in t)if(Object.hasOwn(t,r)){let s=t[r];typeof s=="number"?e[r]=BigInt(s):x_.types.isDate(s)&&(e[r]=new Date(s))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthtimeNs=e.birthtimeMs*BigInt(1e6),e}function Q_(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||t.isFIFO()!==e.isFIFO()||t.isFile()!==e.isFile()||t.isSocket()!==e.isSocket()||t.isSymbolicLink()!==e.isSymbolicLink()||t.mode!==e.mode||t.mtimeMs!==e.mtimeMs||t.nlink!==e.nlink||t.rdev!==e.rdev||t.size!==e.size||t.uid!==e.uid)return!1;let r=t,s=e;return!(r.atimeNs!==s.atimeNs||r.mtimeNs!==s.mtimeNs||r.ctimeNs!==s.ctimeNs||r.birthtimeNs!==s.birthtimeNs)}var x_,k_,P_,nE,iE,T_=It(()=>{x_=et(ye("util")),k_=33188,P_=class{constructor(){this.name="";this.path="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},nE=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=k_;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},iE=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=BigInt(0);this.ino=BigInt(0);this.mode=BigInt(k_);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&BigInt(61440))===BigInt(16384)}isFIFO(){return!1}isFile(){return(this.mode&BigInt(61440))===BigInt(32768)}isSocket(){return!1}isSymbolicLink(){return(this.mode&BigInt(61440))===BigInt(40960)}}});function T7e(t){let e,r;if(e=t.match(k7e))t=e[1];else if(r=t.match(Q7e))t=`\\\\${r[1]?".\\":""}${r[2]}`;else return t;return t.replace(/\//g,"\\")}function R7e(t){t=t.replace(/\\/g,"/");let e,r;return(e=t.match(P7e))?t=`/${e[1]}`:(r=t.match(x7e))&&(t=`/unc/${r[1]?".dot/":""}${r[2]}`),t}function Ax(t,e){return t===ue?T$(e):R_(e)}var _2,vt,Er,ue,K,Q$,P7e,x7e,k7e,Q7e,R_,T$,tl=It(()=>{_2=et(ye("path")),vt={root:"/",dot:".",parent:".."},Er={home:"~",nodeModules:"node_modules",manifest:"package.json",lockfile:"yarn.lock",virtual:"__virtual__",pnpJs:".pnp.js",pnpCjs:".pnp.cjs",pnpData:".pnp.data.json",pnpEsmLoader:".pnp.loader.mjs",rc:".yarnrc.yml",env:".env"},ue=Object.create(_2.default),K=Object.create(_2.default.posix);ue.cwd=()=>process.cwd();K.cwd=process.platform==="win32"?()=>R_(process.cwd()):process.cwd;process.platform==="win32"&&(K.resolve=(...t)=>t.length>0&&K.isAbsolute(t[0])?_2.default.posix.resolve(...t):_2.default.posix.resolve(K.cwd(),...t));Q$=function(t,e,r){return e=t.normalize(e),r=t.normalize(r),e===r?".":(e.endsWith(t.sep)||(e=e+t.sep),r.startsWith(e)?r.slice(e.length):null)};ue.contains=(t,e)=>Q$(ue,t,e);K.contains=(t,e)=>Q$(K,t,e);P7e=/^([a-zA-Z]:.*)$/,x7e=/^\/\/(\.\/)?(.*)$/,k7e=/^\/([a-zA-Z]:.*)$/,Q7e=/^\/unc\/(\.dot\/)?(.*)$/;R_=process.platform==="win32"?R7e:t=>t,T$=process.platform==="win32"?T7e:t=>t;ue.fromPortablePath=T$;ue.toPortablePath=R_});async function px(t,e){let r="0123456789abcdef";await t.mkdirPromise(e.indexPath,{recursive:!0});let s=[];for(let a of r)for(let n of r)s.push(t.mkdirPromise(t.pathUtils.join(e.indexPath,`${a}${n}`),{recursive:!0}));return await Promise.all(s),e.indexPath}async function R$(t,e,r,s,a){let n=t.pathUtils.normalize(e),c=r.pathUtils.normalize(s),f=[],p=[],{atime:h,mtime:E}=a.stableTime?{atime:md,mtime:md}:await r.lstatPromise(c);await t.mkdirpPromise(t.pathUtils.dirname(e),{utimes:[h,E]}),await F_(f,p,t,n,r,c,{...a,didParentExist:!0});for(let C of f)await C();await Promise.all(p.map(C=>C()))}async function F_(t,e,r,s,a,n,c){let f=c.didParentExist?await F$(r,s):null,p=await a.lstatPromise(n),{atime:h,mtime:E}=c.stableTime?{atime:md,mtime:md}:p,C;switch(!0){case p.isDirectory():C=await N7e(t,e,r,s,f,a,n,p,c);break;case p.isFile():C=await M7e(t,e,r,s,f,a,n,p,c);break;case p.isSymbolicLink():C=await _7e(t,e,r,s,f,a,n,p,c);break;default:throw new Error(`Unsupported file type (${p.mode})`)}return(c.linkStrategy?.type!=="HardlinkFromIndex"||!p.isFile())&&((C||f?.mtime?.getTime()!==E.getTime()||f?.atime?.getTime()!==h.getTime())&&(e.push(()=>r.lutimesPromise(s,h,E)),C=!0),(f===null||(f.mode&511)!==(p.mode&511))&&(e.push(()=>r.chmodPromise(s,p.mode&511)),C=!0)),C}async function F$(t,e){try{return await t.lstatPromise(e)}catch{return null}}async function N7e(t,e,r,s,a,n,c,f,p){if(a!==null&&!a.isDirectory())if(p.overwrite)t.push(async()=>r.removePromise(s)),a=null;else return!1;let h=!1;a===null&&(t.push(async()=>{try{await r.mkdirPromise(s,{mode:f.mode})}catch(S){if(S.code!=="EEXIST")throw S}}),h=!0);let E=await n.readdirPromise(c),C=p.didParentExist&&!a?{...p,didParentExist:!1}:p;if(p.stableSort)for(let S of E.sort())await F_(t,e,r,r.pathUtils.join(s,S),n,n.pathUtils.join(c,S),C)&&(h=!0);else(await Promise.all(E.map(async P=>{await F_(t,e,r,r.pathUtils.join(s,P),n,n.pathUtils.join(c,P),C)}))).some(P=>P)&&(h=!0);return h}async function O7e(t,e,r,s,a,n,c,f,p,h){let E=await n.checksumFilePromise(c,{algorithm:"sha1"}),C=420,S=f.mode&511,P=`${E}${S!==C?S.toString(8):""}`,I=r.pathUtils.join(h.indexPath,E.slice(0,2),`${P}.dat`),R;(ce=>(ce[ce.Lock=0]="Lock",ce[ce.Rename=1]="Rename"))(R||={});let N=1,U=await F$(r,I);if(a){let ie=U&&a.dev===U.dev&&a.ino===U.ino,Ae=U?.mtimeMs!==F7e;if(ie&&Ae&&h.autoRepair&&(N=0,U=null),!ie)if(p.overwrite)t.push(async()=>r.removePromise(s)),a=null;else return!1}let W=!U&&N===1?`${I}.${Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0")}`:null,te=!1;return t.push(async()=>{if(!U&&(N===0&&await r.lockPromise(I,async()=>{let ie=await n.readFilePromise(c);await r.writeFilePromise(I,ie)}),N===1&&W)){let ie=await n.readFilePromise(c);await r.writeFilePromise(W,ie);try{await r.linkPromise(W,I)}catch(Ae){if(Ae.code==="EEXIST")te=!0,await r.unlinkPromise(W);else throw Ae}}a||await r.linkPromise(I,s)}),e.push(async()=>{U||(await r.lutimesPromise(I,md,md),S!==C&&await r.chmodPromise(I,S)),W&&!te&&await r.unlinkPromise(W)}),!1}async function L7e(t,e,r,s,a,n,c,f,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(s)),a=null;else return!1;return t.push(async()=>{let h=await n.readFilePromise(c);await r.writeFilePromise(s,h)}),!0}async function M7e(t,e,r,s,a,n,c,f,p){return p.linkStrategy?.type==="HardlinkFromIndex"?O7e(t,e,r,s,a,n,c,f,p,p.linkStrategy):L7e(t,e,r,s,a,n,c,f,p)}async function _7e(t,e,r,s,a,n,c,f,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(s)),a=null;else return!1;return t.push(async()=>{await r.symlinkPromise(Ax(r.pathUtils,await n.readlinkPromise(c)),s)}),!0}var md,F7e,N_=It(()=>{tl();md=new Date(456789e3*1e3),F7e=md.getTime()});function hx(t,e,r,s){let a=()=>{let n=r.shift();if(typeof n>"u")return null;let c=t.pathUtils.join(e,n);return Object.assign(t.statSync(c),{name:n,path:void 0})};return new U2(e,a,s)}var U2,N$=It(()=>{ux();U2=class{constructor(e,r,s={}){this.path=e;this.nextDirent=r;this.opts=s;this.closed=!1}throwIfClosed(){if(this.closed)throw b_()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.read())!==null;)yield e}finally{await this.close()}}read(e){let r=this.readSync();return typeof e<"u"?e(null,r):Promise.resolve(r)}readSync(){return this.throwIfClosed(),this.nextDirent()}close(e){return this.closeSync(),typeof e<"u"?e(null):Promise.resolve()}closeSync(){this.throwIfClosed(),this.opts.onClose?.(),this.closed=!0}}});function O$(t,e){if(t!==e)throw new Error(`Invalid StatWatcher status: expected '${e}', got '${t}'`)}var L$,gx,M$=It(()=>{L$=ye("events");T_();gx=class t extends L$.EventEmitter{constructor(r,s,{bigint:a=!1}={}){super();this.status="ready";this.changeListeners=new Map;this.startTimeout=null;this.fakeFs=r,this.path=s,this.bigint=a,this.lastStats=this.stat()}static create(r,s,a){let n=new t(r,s,a);return n.start(),n}start(){O$(this.status,"ready"),this.status="running",this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.fakeFs.existsSync(this.path)||this.emit("change",this.lastStats,this.lastStats)},3)}stop(){O$(this.status,"running"),this.status="stopped",this.startTimeout!==null&&(clearTimeout(this.startTimeout),this.startTimeout=null),this.emit("stop")}stat(){try{return this.fakeFs.statSync(this.path,{bigint:this.bigint})}catch{let r=this.bigint?new iE:new nE;return fx(r)}}makeInterval(r){let s=setInterval(()=>{let a=this.stat(),n=this.lastStats;Q_(a,n)||(this.lastStats=a,this.emit("change",a,n))},r.interval);return r.persistent?s:s.unref()}registerChangeListener(r,s){this.addListener("change",r),this.changeListeners.set(r,this.makeInterval(s))}unregisterChangeListener(r){this.removeListener("change",r);let s=this.changeListeners.get(r);typeof s<"u"&&clearInterval(s),this.changeListeners.delete(r)}unregisterAllChangeListeners(){for(let r of this.changeListeners.keys())this.unregisterChangeListener(r)}hasChangeListeners(){return this.changeListeners.size>0}ref(){for(let r of this.changeListeners.values())r.ref();return this}unref(){for(let r of this.changeListeners.values())r.unref();return this}}});function sE(t,e,r,s){let a,n,c,f;switch(typeof r){case"function":a=!1,n=!0,c=5007,f=r;break;default:({bigint:a=!1,persistent:n=!0,interval:c=5007}=r),f=s;break}let p=dx.get(t);typeof p>"u"&&dx.set(t,p=new Map);let h=p.get(e);return typeof h>"u"&&(h=gx.create(t,e,{bigint:a}),p.set(e,h)),h.registerChangeListener(f,{persistent:n,interval:c}),h}function yd(t,e,r){let s=dx.get(t);if(typeof s>"u")return;let a=s.get(e);typeof a>"u"||(typeof r>"u"?a.unregisterAllChangeListeners():a.unregisterChangeListener(r),a.hasChangeListeners()||(a.stop(),s.delete(e)))}function Ed(t){let e=dx.get(t);if(!(typeof e>"u"))for(let r of e.keys())yd(t,r)}var dx,O_=It(()=>{M$();dx=new WeakMap});function U7e(t){let e=t.match(/\r?\n/g);if(e===null)return U$.EOL;let r=e.filter(a=>a===`\r +`).length,s=e.length-r;return r>s?`\r +`:` +`}function Id(t,e){return e.replace(/\r?\n/g,U7e(t))}var _$,U$,Ep,Uf,Cd=It(()=>{_$=ye("crypto"),U$=ye("os");N_();tl();Ep=class{constructor(e){this.pathUtils=e}async*genTraversePromise(e,{stableSort:r=!1}={}){let s=[e];for(;s.length>0;){let a=s.shift();if((await this.lstatPromise(a)).isDirectory()){let c=await this.readdirPromise(a);if(r)for(let f of c.sort())s.push(this.pathUtils.join(a,f));else throw new Error("Not supported")}else yield a}}async checksumFilePromise(e,{algorithm:r="sha512"}={}){let s=await this.openPromise(e,"r");try{let n=Buffer.allocUnsafeSlow(65536),c=(0,_$.createHash)(r),f=0;for(;(f=await this.readPromise(s,n,0,65536))!==0;)c.update(f===65536?n:n.slice(0,f));return c.digest("hex")}finally{await this.closePromise(s)}}async removePromise(e,{recursive:r=!0,maxRetries:s=5}={}){let a;try{a=await this.lstatPromise(e)}catch(n){if(n.code==="ENOENT")return;throw n}if(a.isDirectory()){if(r){let n=await this.readdirPromise(e);await Promise.all(n.map(c=>this.removePromise(this.pathUtils.resolve(e,c))))}for(let n=0;n<=s;n++)try{await this.rmdirPromise(e);break}catch(c){if(c.code!=="EBUSY"&&c.code!=="ENOTEMPTY")throw c;nsetTimeout(f,n*100))}}else await this.unlinkPromise(e)}removeSync(e,{recursive:r=!0}={}){let s;try{s=this.lstatSync(e)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.isDirectory()){if(r)for(let a of this.readdirSync(e))this.removeSync(this.pathUtils.resolve(e,a));this.rmdirSync(e)}else this.unlinkSync(e)}async mkdirpPromise(e,{chmod:r,utimes:s}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let c=2;c<=a.length;++c){let f=a.slice(0,c).join(this.pathUtils.sep);if(!this.existsSync(f)){try{await this.mkdirPromise(f)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=f,r!=null&&await this.chmodPromise(f,r),s!=null)await this.utimesPromise(f,s[0],s[1]);else{let p=await this.statPromise(this.pathUtils.dirname(f));await this.utimesPromise(f,p.atime,p.mtime)}}}return n}mkdirpSync(e,{chmod:r,utimes:s}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let c=2;c<=a.length;++c){let f=a.slice(0,c).join(this.pathUtils.sep);if(!this.existsSync(f)){try{this.mkdirSync(f)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=f,r!=null&&this.chmodSync(f,r),s!=null)this.utimesSync(f,s[0],s[1]);else{let p=this.statSync(this.pathUtils.dirname(f));this.utimesSync(f,p.atime,p.mtime)}}}return n}async copyPromise(e,r,{baseFs:s=this,overwrite:a=!0,stableSort:n=!1,stableTime:c=!1,linkStrategy:f=null}={}){return await R$(this,e,s,r,{overwrite:a,stableSort:n,stableTime:c,linkStrategy:f})}copySync(e,r,{baseFs:s=this,overwrite:a=!0}={}){let n=s.lstatSync(r),c=this.existsSync(e);if(n.isDirectory()){this.mkdirpSync(e);let p=s.readdirSync(r);for(let h of p)this.copySync(this.pathUtils.join(e,h),s.pathUtils.join(r,h),{baseFs:s,overwrite:a})}else if(n.isFile()){if(!c||a){c&&this.removeSync(e);let p=s.readFileSync(r);this.writeFileSync(e,p)}}else if(n.isSymbolicLink()){if(!c||a){c&&this.removeSync(e);let p=s.readlinkSync(r);this.symlinkSync(Ax(this.pathUtils,p),e)}}else throw new Error(`Unsupported file type (file: ${r}, mode: 0o${n.mode.toString(8).padStart(6,"0")})`);let f=n.mode&511;this.chmodSync(e,f)}async changeFilePromise(e,r,s={}){return Buffer.isBuffer(r)?this.changeFileBufferPromise(e,r,s):this.changeFileTextPromise(e,r,s)}async changeFileBufferPromise(e,r,{mode:s}={}){let a=Buffer.alloc(0);try{a=await this.readFilePromise(e)}catch{}Buffer.compare(a,r)!==0&&await this.writeFilePromise(e,r,{mode:s})}async changeFileTextPromise(e,r,{automaticNewlines:s,mode:a}={}){let n="";try{n=await this.readFilePromise(e,"utf8")}catch{}let c=s?Id(n,r):r;n!==c&&await this.writeFilePromise(e,c,{mode:a})}changeFileSync(e,r,s={}){return Buffer.isBuffer(r)?this.changeFileBufferSync(e,r,s):this.changeFileTextSync(e,r,s)}changeFileBufferSync(e,r,{mode:s}={}){let a=Buffer.alloc(0);try{a=this.readFileSync(e)}catch{}Buffer.compare(a,r)!==0&&this.writeFileSync(e,r,{mode:s})}changeFileTextSync(e,r,{automaticNewlines:s=!1,mode:a}={}){let n="";try{n=this.readFileSync(e,"utf8")}catch{}let c=s?Id(n,r):r;n!==c&&this.writeFileSync(e,c,{mode:a})}async movePromise(e,r){try{await this.renamePromise(e,r)}catch(s){if(s.code==="EXDEV")await this.copyPromise(r,e),await this.removePromise(e);else throw s}}moveSync(e,r){try{this.renameSync(e,r)}catch(s){if(s.code==="EXDEV")this.copySync(r,e),this.removeSync(e);else throw s}}async lockPromise(e,r){let s=`${e}.flock`,a=1e3/60,n=Date.now(),c=null,f=async()=>{let p;try{[p]=await this.readJsonPromise(s)}catch{return Date.now()-n<500}try{return process.kill(p,0),!0}catch{return!1}};for(;c===null;)try{c=await this.openPromise(s,"wx")}catch(p){if(p.code==="EEXIST"){if(!await f())try{await this.unlinkPromise(s);continue}catch{}if(Date.now()-n<60*1e3)await new Promise(h=>setTimeout(h,a));else throw new Error(`Couldn't acquire a lock in a reasonable time (via ${s})`)}else throw p}await this.writePromise(c,JSON.stringify([process.pid]));try{return await r()}finally{try{await this.closePromise(c),await this.unlinkPromise(s)}catch{}}}async readJsonPromise(e){let r=await this.readFilePromise(e,"utf8");try{return JSON.parse(r)}catch(s){throw s.message+=` (in ${e})`,s}}readJsonSync(e){let r=this.readFileSync(e,"utf8");try{return JSON.parse(r)}catch(s){throw s.message+=` (in ${e})`,s}}async writeJsonPromise(e,r,{compact:s=!1}={}){let a=s?0:2;return await this.writeFilePromise(e,`${JSON.stringify(r,null,a)} +`)}writeJsonSync(e,r,{compact:s=!1}={}){let a=s?0:2;return this.writeFileSync(e,`${JSON.stringify(r,null,a)} +`)}async preserveTimePromise(e,r){let s=await this.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await this.lutimesPromise(e,s.atime,s.mtime)}async preserveTimeSync(e,r){let s=this.lstatSync(e),a=r();typeof a<"u"&&(e=a),this.lutimesSync(e,s.atime,s.mtime)}},Uf=class extends Ep{constructor(){super(K)}}});var Hs,Ip=It(()=>{Cd();Hs=class extends Ep{getExtractHint(e){return this.baseFs.getExtractHint(e)}resolve(e){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(e)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(e,r,s){return this.baseFs.openPromise(this.mapToBase(e),r,s)}openSync(e,r,s){return this.baseFs.openSync(this.mapToBase(e),r,s)}async opendirPromise(e,r){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(e),r),{path:e})}opendirSync(e,r){return Object.assign(this.baseFs.opendirSync(this.mapToBase(e),r),{path:e})}async readPromise(e,r,s,a,n){return await this.baseFs.readPromise(e,r,s,a,n)}readSync(e,r,s,a,n){return this.baseFs.readSync(e,r,s,a,n)}async writePromise(e,r,s,a,n){return typeof r=="string"?await this.baseFs.writePromise(e,r,s):await this.baseFs.writePromise(e,r,s,a,n)}writeSync(e,r,s,a,n){return typeof r=="string"?this.baseFs.writeSync(e,r,s):this.baseFs.writeSync(e,r,s,a,n)}async closePromise(e){return this.baseFs.closePromise(e)}closeSync(e){this.baseFs.closeSync(e)}createReadStream(e,r){return this.baseFs.createReadStream(e!==null?this.mapToBase(e):e,r)}createWriteStream(e,r){return this.baseFs.createWriteStream(e!==null?this.mapToBase(e):e,r)}async realpathPromise(e){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(e)))}realpathSync(e){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(e)))}async existsPromise(e){return this.baseFs.existsPromise(this.mapToBase(e))}existsSync(e){return this.baseFs.existsSync(this.mapToBase(e))}accessSync(e,r){return this.baseFs.accessSync(this.mapToBase(e),r)}async accessPromise(e,r){return this.baseFs.accessPromise(this.mapToBase(e),r)}async statPromise(e,r){return this.baseFs.statPromise(this.mapToBase(e),r)}statSync(e,r){return this.baseFs.statSync(this.mapToBase(e),r)}async fstatPromise(e,r){return this.baseFs.fstatPromise(e,r)}fstatSync(e,r){return this.baseFs.fstatSync(e,r)}lstatPromise(e,r){return this.baseFs.lstatPromise(this.mapToBase(e),r)}lstatSync(e,r){return this.baseFs.lstatSync(this.mapToBase(e),r)}async fchmodPromise(e,r){return this.baseFs.fchmodPromise(e,r)}fchmodSync(e,r){return this.baseFs.fchmodSync(e,r)}async chmodPromise(e,r){return this.baseFs.chmodPromise(this.mapToBase(e),r)}chmodSync(e,r){return this.baseFs.chmodSync(this.mapToBase(e),r)}async fchownPromise(e,r,s){return this.baseFs.fchownPromise(e,r,s)}fchownSync(e,r,s){return this.baseFs.fchownSync(e,r,s)}async chownPromise(e,r,s){return this.baseFs.chownPromise(this.mapToBase(e),r,s)}chownSync(e,r,s){return this.baseFs.chownSync(this.mapToBase(e),r,s)}async renamePromise(e,r){return this.baseFs.renamePromise(this.mapToBase(e),this.mapToBase(r))}renameSync(e,r){return this.baseFs.renameSync(this.mapToBase(e),this.mapToBase(r))}async copyFilePromise(e,r,s=0){return this.baseFs.copyFilePromise(this.mapToBase(e),this.mapToBase(r),s)}copyFileSync(e,r,s=0){return this.baseFs.copyFileSync(this.mapToBase(e),this.mapToBase(r),s)}async appendFilePromise(e,r,s){return this.baseFs.appendFilePromise(this.fsMapToBase(e),r,s)}appendFileSync(e,r,s){return this.baseFs.appendFileSync(this.fsMapToBase(e),r,s)}async writeFilePromise(e,r,s){return this.baseFs.writeFilePromise(this.fsMapToBase(e),r,s)}writeFileSync(e,r,s){return this.baseFs.writeFileSync(this.fsMapToBase(e),r,s)}async unlinkPromise(e){return this.baseFs.unlinkPromise(this.mapToBase(e))}unlinkSync(e){return this.baseFs.unlinkSync(this.mapToBase(e))}async utimesPromise(e,r,s){return this.baseFs.utimesPromise(this.mapToBase(e),r,s)}utimesSync(e,r,s){return this.baseFs.utimesSync(this.mapToBase(e),r,s)}async lutimesPromise(e,r,s){return this.baseFs.lutimesPromise(this.mapToBase(e),r,s)}lutimesSync(e,r,s){return this.baseFs.lutimesSync(this.mapToBase(e),r,s)}async mkdirPromise(e,r){return this.baseFs.mkdirPromise(this.mapToBase(e),r)}mkdirSync(e,r){return this.baseFs.mkdirSync(this.mapToBase(e),r)}async rmdirPromise(e,r){return this.baseFs.rmdirPromise(this.mapToBase(e),r)}rmdirSync(e,r){return this.baseFs.rmdirSync(this.mapToBase(e),r)}async rmPromise(e,r){return this.baseFs.rmPromise(this.mapToBase(e),r)}rmSync(e,r){return this.baseFs.rmSync(this.mapToBase(e),r)}async linkPromise(e,r){return this.baseFs.linkPromise(this.mapToBase(e),this.mapToBase(r))}linkSync(e,r){return this.baseFs.linkSync(this.mapToBase(e),this.mapToBase(r))}async symlinkPromise(e,r,s){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkPromise(this.mapToBase(e),a,s);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),c=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkPromise(c,a,s)}symlinkSync(e,r,s){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkSync(this.mapToBase(e),a,s);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),c=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkSync(c,a,s)}async readFilePromise(e,r){return this.baseFs.readFilePromise(this.fsMapToBase(e),r)}readFileSync(e,r){return this.baseFs.readFileSync(this.fsMapToBase(e),r)}readdirPromise(e,r){return this.baseFs.readdirPromise(this.mapToBase(e),r)}readdirSync(e,r){return this.baseFs.readdirSync(this.mapToBase(e),r)}async readlinkPromise(e){return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(e)))}readlinkSync(e){return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(e)))}async truncatePromise(e,r){return this.baseFs.truncatePromise(this.mapToBase(e),r)}truncateSync(e,r){return this.baseFs.truncateSync(this.mapToBase(e),r)}async ftruncatePromise(e,r){return this.baseFs.ftruncatePromise(e,r)}ftruncateSync(e,r){return this.baseFs.ftruncateSync(e,r)}watch(e,r,s){return this.baseFs.watch(this.mapToBase(e),r,s)}watchFile(e,r,s){return this.baseFs.watchFile(this.mapToBase(e),r,s)}unwatchFile(e,r){return this.baseFs.unwatchFile(this.mapToBase(e),r)}fsMapToBase(e){return typeof e=="number"?e:this.mapToBase(e)}}});var Hf,H$=It(()=>{Ip();Hf=class extends Hs{constructor(e,{baseFs:r,pathUtils:s}){super(s),this.target=e,this.baseFs=r}getRealPath(){return this.target}getBaseFs(){return this.baseFs}mapFromBase(e){return e}mapToBase(e){return e}}});function j$(t){let e=t;return typeof t.path=="string"&&(e.path=ue.toPortablePath(t.path)),e}var q$,Yn,wd=It(()=>{q$=et(ye("fs"));Cd();tl();Yn=class extends Uf{constructor(e=q$.default){super(),this.realFs=e}getExtractHint(){return!1}getRealPath(){return vt.root}resolve(e){return K.resolve(e)}async openPromise(e,r,s){return await new Promise((a,n)=>{this.realFs.open(ue.fromPortablePath(e),r,s,this.makeCallback(a,n))})}openSync(e,r,s){return this.realFs.openSync(ue.fromPortablePath(e),r,s)}async opendirPromise(e,r){return await new Promise((s,a)=>{typeof r<"u"?this.realFs.opendir(ue.fromPortablePath(e),r,this.makeCallback(s,a)):this.realFs.opendir(ue.fromPortablePath(e),this.makeCallback(s,a))}).then(s=>{let a=s;return Object.defineProperty(a,"path",{value:e,configurable:!0,writable:!0}),a})}opendirSync(e,r){let a=typeof r<"u"?this.realFs.opendirSync(ue.fromPortablePath(e),r):this.realFs.opendirSync(ue.fromPortablePath(e));return Object.defineProperty(a,"path",{value:e,configurable:!0,writable:!0}),a}async readPromise(e,r,s=0,a=0,n=-1){return await new Promise((c,f)=>{this.realFs.read(e,r,s,a,n,(p,h)=>{p?f(p):c(h)})})}readSync(e,r,s,a,n){return this.realFs.readSync(e,r,s,a,n)}async writePromise(e,r,s,a,n){return await new Promise((c,f)=>typeof r=="string"?this.realFs.write(e,r,s,this.makeCallback(c,f)):this.realFs.write(e,r,s,a,n,this.makeCallback(c,f)))}writeSync(e,r,s,a,n){return typeof r=="string"?this.realFs.writeSync(e,r,s):this.realFs.writeSync(e,r,s,a,n)}async closePromise(e){await new Promise((r,s)=>{this.realFs.close(e,this.makeCallback(r,s))})}closeSync(e){this.realFs.closeSync(e)}createReadStream(e,r){let s=e!==null?ue.fromPortablePath(e):e;return this.realFs.createReadStream(s,r)}createWriteStream(e,r){let s=e!==null?ue.fromPortablePath(e):e;return this.realFs.createWriteStream(s,r)}async realpathPromise(e){return await new Promise((r,s)=>{this.realFs.realpath(ue.fromPortablePath(e),{},this.makeCallback(r,s))}).then(r=>ue.toPortablePath(r))}realpathSync(e){return ue.toPortablePath(this.realFs.realpathSync(ue.fromPortablePath(e),{}))}async existsPromise(e){return await new Promise(r=>{this.realFs.exists(ue.fromPortablePath(e),r)})}accessSync(e,r){return this.realFs.accessSync(ue.fromPortablePath(e),r)}async accessPromise(e,r){return await new Promise((s,a)=>{this.realFs.access(ue.fromPortablePath(e),r,this.makeCallback(s,a))})}existsSync(e){return this.realFs.existsSync(ue.fromPortablePath(e))}async statPromise(e,r){return await new Promise((s,a)=>{r?this.realFs.stat(ue.fromPortablePath(e),r,this.makeCallback(s,a)):this.realFs.stat(ue.fromPortablePath(e),this.makeCallback(s,a))})}statSync(e,r){return r?this.realFs.statSync(ue.fromPortablePath(e),r):this.realFs.statSync(ue.fromPortablePath(e))}async fstatPromise(e,r){return await new Promise((s,a)=>{r?this.realFs.fstat(e,r,this.makeCallback(s,a)):this.realFs.fstat(e,this.makeCallback(s,a))})}fstatSync(e,r){return r?this.realFs.fstatSync(e,r):this.realFs.fstatSync(e)}async lstatPromise(e,r){return await new Promise((s,a)=>{r?this.realFs.lstat(ue.fromPortablePath(e),r,this.makeCallback(s,a)):this.realFs.lstat(ue.fromPortablePath(e),this.makeCallback(s,a))})}lstatSync(e,r){return r?this.realFs.lstatSync(ue.fromPortablePath(e),r):this.realFs.lstatSync(ue.fromPortablePath(e))}async fchmodPromise(e,r){return await new Promise((s,a)=>{this.realFs.fchmod(e,r,this.makeCallback(s,a))})}fchmodSync(e,r){return this.realFs.fchmodSync(e,r)}async chmodPromise(e,r){return await new Promise((s,a)=>{this.realFs.chmod(ue.fromPortablePath(e),r,this.makeCallback(s,a))})}chmodSync(e,r){return this.realFs.chmodSync(ue.fromPortablePath(e),r)}async fchownPromise(e,r,s){return await new Promise((a,n)=>{this.realFs.fchown(e,r,s,this.makeCallback(a,n))})}fchownSync(e,r,s){return this.realFs.fchownSync(e,r,s)}async chownPromise(e,r,s){return await new Promise((a,n)=>{this.realFs.chown(ue.fromPortablePath(e),r,s,this.makeCallback(a,n))})}chownSync(e,r,s){return this.realFs.chownSync(ue.fromPortablePath(e),r,s)}async renamePromise(e,r){return await new Promise((s,a)=>{this.realFs.rename(ue.fromPortablePath(e),ue.fromPortablePath(r),this.makeCallback(s,a))})}renameSync(e,r){return this.realFs.renameSync(ue.fromPortablePath(e),ue.fromPortablePath(r))}async copyFilePromise(e,r,s=0){return await new Promise((a,n)=>{this.realFs.copyFile(ue.fromPortablePath(e),ue.fromPortablePath(r),s,this.makeCallback(a,n))})}copyFileSync(e,r,s=0){return this.realFs.copyFileSync(ue.fromPortablePath(e),ue.fromPortablePath(r),s)}async appendFilePromise(e,r,s){return await new Promise((a,n)=>{let c=typeof e=="string"?ue.fromPortablePath(e):e;s?this.realFs.appendFile(c,r,s,this.makeCallback(a,n)):this.realFs.appendFile(c,r,this.makeCallback(a,n))})}appendFileSync(e,r,s){let a=typeof e=="string"?ue.fromPortablePath(e):e;s?this.realFs.appendFileSync(a,r,s):this.realFs.appendFileSync(a,r)}async writeFilePromise(e,r,s){return await new Promise((a,n)=>{let c=typeof e=="string"?ue.fromPortablePath(e):e;s?this.realFs.writeFile(c,r,s,this.makeCallback(a,n)):this.realFs.writeFile(c,r,this.makeCallback(a,n))})}writeFileSync(e,r,s){let a=typeof e=="string"?ue.fromPortablePath(e):e;s?this.realFs.writeFileSync(a,r,s):this.realFs.writeFileSync(a,r)}async unlinkPromise(e){return await new Promise((r,s)=>{this.realFs.unlink(ue.fromPortablePath(e),this.makeCallback(r,s))})}unlinkSync(e){return this.realFs.unlinkSync(ue.fromPortablePath(e))}async utimesPromise(e,r,s){return await new Promise((a,n)=>{this.realFs.utimes(ue.fromPortablePath(e),r,s,this.makeCallback(a,n))})}utimesSync(e,r,s){this.realFs.utimesSync(ue.fromPortablePath(e),r,s)}async lutimesPromise(e,r,s){return await new Promise((a,n)=>{this.realFs.lutimes(ue.fromPortablePath(e),r,s,this.makeCallback(a,n))})}lutimesSync(e,r,s){this.realFs.lutimesSync(ue.fromPortablePath(e),r,s)}async mkdirPromise(e,r){return await new Promise((s,a)=>{this.realFs.mkdir(ue.fromPortablePath(e),r,this.makeCallback(s,a))})}mkdirSync(e,r){return this.realFs.mkdirSync(ue.fromPortablePath(e),r)}async rmdirPromise(e,r){return await new Promise((s,a)=>{r?this.realFs.rmdir(ue.fromPortablePath(e),r,this.makeCallback(s,a)):this.realFs.rmdir(ue.fromPortablePath(e),this.makeCallback(s,a))})}rmdirSync(e,r){return this.realFs.rmdirSync(ue.fromPortablePath(e),r)}async rmPromise(e,r){return await new Promise((s,a)=>{r?this.realFs.rm(ue.fromPortablePath(e),r,this.makeCallback(s,a)):this.realFs.rm(ue.fromPortablePath(e),this.makeCallback(s,a))})}rmSync(e,r){return this.realFs.rmSync(ue.fromPortablePath(e),r)}async linkPromise(e,r){return await new Promise((s,a)=>{this.realFs.link(ue.fromPortablePath(e),ue.fromPortablePath(r),this.makeCallback(s,a))})}linkSync(e,r){return this.realFs.linkSync(ue.fromPortablePath(e),ue.fromPortablePath(r))}async symlinkPromise(e,r,s){return await new Promise((a,n)=>{this.realFs.symlink(ue.fromPortablePath(e.replace(/\/+$/,"")),ue.fromPortablePath(r),s,this.makeCallback(a,n))})}symlinkSync(e,r,s){return this.realFs.symlinkSync(ue.fromPortablePath(e.replace(/\/+$/,"")),ue.fromPortablePath(r),s)}async readFilePromise(e,r){return await new Promise((s,a)=>{let n=typeof e=="string"?ue.fromPortablePath(e):e;this.realFs.readFile(n,r,this.makeCallback(s,a))})}readFileSync(e,r){let s=typeof e=="string"?ue.fromPortablePath(e):e;return this.realFs.readFileSync(s,r)}async readdirPromise(e,r){return await new Promise((s,a)=>{r?r.recursive&&process.platform==="win32"?r.withFileTypes?this.realFs.readdir(ue.fromPortablePath(e),r,this.makeCallback(n=>s(n.map(j$)),a)):this.realFs.readdir(ue.fromPortablePath(e),r,this.makeCallback(n=>s(n.map(ue.toPortablePath)),a)):this.realFs.readdir(ue.fromPortablePath(e),r,this.makeCallback(s,a)):this.realFs.readdir(ue.fromPortablePath(e),this.makeCallback(s,a))})}readdirSync(e,r){return r?r.recursive&&process.platform==="win32"?r.withFileTypes?this.realFs.readdirSync(ue.fromPortablePath(e),r).map(j$):this.realFs.readdirSync(ue.fromPortablePath(e),r).map(ue.toPortablePath):this.realFs.readdirSync(ue.fromPortablePath(e),r):this.realFs.readdirSync(ue.fromPortablePath(e))}async readlinkPromise(e){return await new Promise((r,s)=>{this.realFs.readlink(ue.fromPortablePath(e),this.makeCallback(r,s))}).then(r=>ue.toPortablePath(r))}readlinkSync(e){return ue.toPortablePath(this.realFs.readlinkSync(ue.fromPortablePath(e)))}async truncatePromise(e,r){return await new Promise((s,a)=>{this.realFs.truncate(ue.fromPortablePath(e),r,this.makeCallback(s,a))})}truncateSync(e,r){return this.realFs.truncateSync(ue.fromPortablePath(e),r)}async ftruncatePromise(e,r){return await new Promise((s,a)=>{this.realFs.ftruncate(e,r,this.makeCallback(s,a))})}ftruncateSync(e,r){return this.realFs.ftruncateSync(e,r)}watch(e,r,s){return this.realFs.watch(ue.fromPortablePath(e),r,s)}watchFile(e,r,s){return this.realFs.watchFile(ue.fromPortablePath(e),r,s)}unwatchFile(e,r){return this.realFs.unwatchFile(ue.fromPortablePath(e),r)}makeCallback(e,r){return(s,a)=>{s?r(s):e(a)}}}});var Sn,G$=It(()=>{wd();Ip();tl();Sn=class extends Hs{constructor(e,{baseFs:r=new Yn}={}){super(K),this.target=this.pathUtils.normalize(e),this.baseFs=r}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.target)}resolve(e){return this.pathUtils.isAbsolute(e)?K.normalize(e):this.baseFs.resolve(K.join(this.target,e))}mapFromBase(e){return e}mapToBase(e){return this.pathUtils.isAbsolute(e)?e:this.pathUtils.join(this.target,e)}}});var W$,jf,Y$=It(()=>{wd();Ip();tl();W$=vt.root,jf=class extends Hs{constructor(e,{baseFs:r=new Yn}={}){super(K),this.target=this.pathUtils.resolve(vt.root,e),this.baseFs=r}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.pathUtils.relative(vt.root,this.target))}getTarget(){return this.target}getBaseFs(){return this.baseFs}mapToBase(e){let r=this.pathUtils.normalize(e);if(this.pathUtils.isAbsolute(e))return this.pathUtils.resolve(this.target,this.pathUtils.relative(W$,e));if(r.match(/^\.\.\/?/))throw new Error(`Resolving this path (${e}) would escape the jail`);return this.pathUtils.resolve(this.target,e)}mapFromBase(e){return this.pathUtils.resolve(W$,this.pathUtils.relative(this.target,e))}}});var oE,V$=It(()=>{Ip();oE=class extends Hs{constructor(r,s){super(s);this.instance=null;this.factory=r}get baseFs(){return this.instance||(this.instance=this.factory()),this.instance}set baseFs(r){this.instance=r}mapFromBase(r){return r}mapToBase(r){return r}}});var Bd,rl,n0,K$=It(()=>{Bd=ye("fs");Cd();wd();O_();ux();tl();rl=4278190080,n0=class extends Uf{constructor({baseFs:r=new Yn,filter:s=null,magicByte:a=42,maxOpenFiles:n=1/0,useCache:c=!0,maxAge:f=5e3,typeCheck:p=Bd.constants.S_IFREG,getMountPoint:h,factoryPromise:E,factorySync:C}){if(Math.floor(a)!==a||!(a>1&&a<=127))throw new Error("The magic byte must be set to a round value between 1 and 127 included");super();this.fdMap=new Map;this.nextFd=3;this.isMount=new Set;this.notMount=new Set;this.realPaths=new Map;this.limitOpenFilesTimeout=null;this.baseFs=r,this.mountInstances=c?new Map:null,this.factoryPromise=E,this.factorySync=C,this.filter=s,this.getMountPoint=h,this.magic=a<<24,this.maxAge=f,this.maxOpenFiles=n,this.typeCheck=p}getExtractHint(r){return this.baseFs.getExtractHint(r)}getRealPath(){return this.baseFs.getRealPath()}saveAndClose(){if(Ed(this),this.mountInstances)for(let[r,{childFs:s}]of this.mountInstances.entries())s.saveAndClose?.(),this.mountInstances.delete(r)}discardAndClose(){if(Ed(this),this.mountInstances)for(let[r,{childFs:s}]of this.mountInstances.entries())s.discardAndClose?.(),this.mountInstances.delete(r)}resolve(r){return this.baseFs.resolve(r)}remapFd(r,s){let a=this.nextFd++|this.magic;return this.fdMap.set(a,[r,s]),a}async openPromise(r,s,a){return await this.makeCallPromise(r,async()=>await this.baseFs.openPromise(r,s,a),async(n,{subPath:c})=>this.remapFd(n,await n.openPromise(c,s,a)))}openSync(r,s,a){return this.makeCallSync(r,()=>this.baseFs.openSync(r,s,a),(n,{subPath:c})=>this.remapFd(n,n.openSync(c,s,a)))}async opendirPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.opendirPromise(r,s),async(a,{subPath:n})=>await a.opendirPromise(n,s),{requireSubpath:!1})}opendirSync(r,s){return this.makeCallSync(r,()=>this.baseFs.opendirSync(r,s),(a,{subPath:n})=>a.opendirSync(n,s),{requireSubpath:!1})}async readPromise(r,s,a,n,c){if((r&rl)!==this.magic)return await this.baseFs.readPromise(r,s,a,n,c);let f=this.fdMap.get(r);if(typeof f>"u")throw Uo("read");let[p,h]=f;return await p.readPromise(h,s,a,n,c)}readSync(r,s,a,n,c){if((r&rl)!==this.magic)return this.baseFs.readSync(r,s,a,n,c);let f=this.fdMap.get(r);if(typeof f>"u")throw Uo("readSync");let[p,h]=f;return p.readSync(h,s,a,n,c)}async writePromise(r,s,a,n,c){if((r&rl)!==this.magic)return typeof s=="string"?await this.baseFs.writePromise(r,s,a):await this.baseFs.writePromise(r,s,a,n,c);let f=this.fdMap.get(r);if(typeof f>"u")throw Uo("write");let[p,h]=f;return typeof s=="string"?await p.writePromise(h,s,a):await p.writePromise(h,s,a,n,c)}writeSync(r,s,a,n,c){if((r&rl)!==this.magic)return typeof s=="string"?this.baseFs.writeSync(r,s,a):this.baseFs.writeSync(r,s,a,n,c);let f=this.fdMap.get(r);if(typeof f>"u")throw Uo("writeSync");let[p,h]=f;return typeof s=="string"?p.writeSync(h,s,a):p.writeSync(h,s,a,n,c)}async closePromise(r){if((r&rl)!==this.magic)return await this.baseFs.closePromise(r);let s=this.fdMap.get(r);if(typeof s>"u")throw Uo("close");this.fdMap.delete(r);let[a,n]=s;return await a.closePromise(n)}closeSync(r){if((r&rl)!==this.magic)return this.baseFs.closeSync(r);let s=this.fdMap.get(r);if(typeof s>"u")throw Uo("closeSync");this.fdMap.delete(r);let[a,n]=s;return a.closeSync(n)}createReadStream(r,s){return r===null?this.baseFs.createReadStream(r,s):this.makeCallSync(r,()=>this.baseFs.createReadStream(r,s),(a,{archivePath:n,subPath:c})=>{let f=a.createReadStream(c,s);return f.path=ue.fromPortablePath(this.pathUtils.join(n,c)),f})}createWriteStream(r,s){return r===null?this.baseFs.createWriteStream(r,s):this.makeCallSync(r,()=>this.baseFs.createWriteStream(r,s),(a,{subPath:n})=>a.createWriteStream(n,s))}async realpathPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.realpathPromise(r),async(s,{archivePath:a,subPath:n})=>{let c=this.realPaths.get(a);return typeof c>"u"&&(c=await this.baseFs.realpathPromise(a),this.realPaths.set(a,c)),this.pathUtils.join(c,this.pathUtils.relative(vt.root,await s.realpathPromise(n)))})}realpathSync(r){return this.makeCallSync(r,()=>this.baseFs.realpathSync(r),(s,{archivePath:a,subPath:n})=>{let c=this.realPaths.get(a);return typeof c>"u"&&(c=this.baseFs.realpathSync(a),this.realPaths.set(a,c)),this.pathUtils.join(c,this.pathUtils.relative(vt.root,s.realpathSync(n)))})}async existsPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.existsPromise(r),async(s,{subPath:a})=>await s.existsPromise(a))}existsSync(r){return this.makeCallSync(r,()=>this.baseFs.existsSync(r),(s,{subPath:a})=>s.existsSync(a))}async accessPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.accessPromise(r,s),async(a,{subPath:n})=>await a.accessPromise(n,s))}accessSync(r,s){return this.makeCallSync(r,()=>this.baseFs.accessSync(r,s),(a,{subPath:n})=>a.accessSync(n,s))}async statPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.statPromise(r,s),async(a,{subPath:n})=>await a.statPromise(n,s))}statSync(r,s){return this.makeCallSync(r,()=>this.baseFs.statSync(r,s),(a,{subPath:n})=>a.statSync(n,s))}async fstatPromise(r,s){if((r&rl)!==this.magic)return this.baseFs.fstatPromise(r,s);let a=this.fdMap.get(r);if(typeof a>"u")throw Uo("fstat");let[n,c]=a;return n.fstatPromise(c,s)}fstatSync(r,s){if((r&rl)!==this.magic)return this.baseFs.fstatSync(r,s);let a=this.fdMap.get(r);if(typeof a>"u")throw Uo("fstatSync");let[n,c]=a;return n.fstatSync(c,s)}async lstatPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.lstatPromise(r,s),async(a,{subPath:n})=>await a.lstatPromise(n,s))}lstatSync(r,s){return this.makeCallSync(r,()=>this.baseFs.lstatSync(r,s),(a,{subPath:n})=>a.lstatSync(n,s))}async fchmodPromise(r,s){if((r&rl)!==this.magic)return this.baseFs.fchmodPromise(r,s);let a=this.fdMap.get(r);if(typeof a>"u")throw Uo("fchmod");let[n,c]=a;return n.fchmodPromise(c,s)}fchmodSync(r,s){if((r&rl)!==this.magic)return this.baseFs.fchmodSync(r,s);let a=this.fdMap.get(r);if(typeof a>"u")throw Uo("fchmodSync");let[n,c]=a;return n.fchmodSync(c,s)}async chmodPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.chmodPromise(r,s),async(a,{subPath:n})=>await a.chmodPromise(n,s))}chmodSync(r,s){return this.makeCallSync(r,()=>this.baseFs.chmodSync(r,s),(a,{subPath:n})=>a.chmodSync(n,s))}async fchownPromise(r,s,a){if((r&rl)!==this.magic)return this.baseFs.fchownPromise(r,s,a);let n=this.fdMap.get(r);if(typeof n>"u")throw Uo("fchown");let[c,f]=n;return c.fchownPromise(f,s,a)}fchownSync(r,s,a){if((r&rl)!==this.magic)return this.baseFs.fchownSync(r,s,a);let n=this.fdMap.get(r);if(typeof n>"u")throw Uo("fchownSync");let[c,f]=n;return c.fchownSync(f,s,a)}async chownPromise(r,s,a){return await this.makeCallPromise(r,async()=>await this.baseFs.chownPromise(r,s,a),async(n,{subPath:c})=>await n.chownPromise(c,s,a))}chownSync(r,s,a){return this.makeCallSync(r,()=>this.baseFs.chownSync(r,s,a),(n,{subPath:c})=>n.chownSync(c,s,a))}async renamePromise(r,s){return await this.makeCallPromise(r,async()=>await this.makeCallPromise(s,async()=>await this.baseFs.renamePromise(r,s),async()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})}),async(a,{subPath:n})=>await this.makeCallPromise(s,async()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})},async(c,{subPath:f})=>{if(a!==c)throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"});return await a.renamePromise(n,f)}))}renameSync(r,s){return this.makeCallSync(r,()=>this.makeCallSync(s,()=>this.baseFs.renameSync(r,s),()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})}),(a,{subPath:n})=>this.makeCallSync(s,()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})},(c,{subPath:f})=>{if(a!==c)throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"});return a.renameSync(n,f)}))}async copyFilePromise(r,s,a=0){let n=async(c,f,p,h)=>{if(a&Bd.constants.COPYFILE_FICLONE_FORCE)throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${f}' -> ${h}'`),{code:"EXDEV"});if(a&Bd.constants.COPYFILE_EXCL&&await this.existsPromise(f))throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${f}' -> '${h}'`),{code:"EEXIST"});let E;try{E=await c.readFilePromise(f)}catch{throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${f}' -> '${h}'`),{code:"EINVAL"})}await p.writeFilePromise(h,E)};return await this.makeCallPromise(r,async()=>await this.makeCallPromise(s,async()=>await this.baseFs.copyFilePromise(r,s,a),async(c,{subPath:f})=>await n(this.baseFs,r,c,f)),async(c,{subPath:f})=>await this.makeCallPromise(s,async()=>await n(c,f,this.baseFs,s),async(p,{subPath:h})=>c!==p?await n(c,f,p,h):await c.copyFilePromise(f,h,a)))}copyFileSync(r,s,a=0){let n=(c,f,p,h)=>{if(a&Bd.constants.COPYFILE_FICLONE_FORCE)throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${f}' -> ${h}'`),{code:"EXDEV"});if(a&Bd.constants.COPYFILE_EXCL&&this.existsSync(f))throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${f}' -> '${h}'`),{code:"EEXIST"});let E;try{E=c.readFileSync(f)}catch{throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${f}' -> '${h}'`),{code:"EINVAL"})}p.writeFileSync(h,E)};return this.makeCallSync(r,()=>this.makeCallSync(s,()=>this.baseFs.copyFileSync(r,s,a),(c,{subPath:f})=>n(this.baseFs,r,c,f)),(c,{subPath:f})=>this.makeCallSync(s,()=>n(c,f,this.baseFs,s),(p,{subPath:h})=>c!==p?n(c,f,p,h):c.copyFileSync(f,h,a)))}async appendFilePromise(r,s,a){return await this.makeCallPromise(r,async()=>await this.baseFs.appendFilePromise(r,s,a),async(n,{subPath:c})=>await n.appendFilePromise(c,s,a))}appendFileSync(r,s,a){return this.makeCallSync(r,()=>this.baseFs.appendFileSync(r,s,a),(n,{subPath:c})=>n.appendFileSync(c,s,a))}async writeFilePromise(r,s,a){return await this.makeCallPromise(r,async()=>await this.baseFs.writeFilePromise(r,s,a),async(n,{subPath:c})=>await n.writeFilePromise(c,s,a))}writeFileSync(r,s,a){return this.makeCallSync(r,()=>this.baseFs.writeFileSync(r,s,a),(n,{subPath:c})=>n.writeFileSync(c,s,a))}async unlinkPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.unlinkPromise(r),async(s,{subPath:a})=>await s.unlinkPromise(a))}unlinkSync(r){return this.makeCallSync(r,()=>this.baseFs.unlinkSync(r),(s,{subPath:a})=>s.unlinkSync(a))}async utimesPromise(r,s,a){return await this.makeCallPromise(r,async()=>await this.baseFs.utimesPromise(r,s,a),async(n,{subPath:c})=>await n.utimesPromise(c,s,a))}utimesSync(r,s,a){return this.makeCallSync(r,()=>this.baseFs.utimesSync(r,s,a),(n,{subPath:c})=>n.utimesSync(c,s,a))}async lutimesPromise(r,s,a){return await this.makeCallPromise(r,async()=>await this.baseFs.lutimesPromise(r,s,a),async(n,{subPath:c})=>await n.lutimesPromise(c,s,a))}lutimesSync(r,s,a){return this.makeCallSync(r,()=>this.baseFs.lutimesSync(r,s,a),(n,{subPath:c})=>n.lutimesSync(c,s,a))}async mkdirPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.mkdirPromise(r,s),async(a,{subPath:n})=>await a.mkdirPromise(n,s))}mkdirSync(r,s){return this.makeCallSync(r,()=>this.baseFs.mkdirSync(r,s),(a,{subPath:n})=>a.mkdirSync(n,s))}async rmdirPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.rmdirPromise(r,s),async(a,{subPath:n})=>await a.rmdirPromise(n,s))}rmdirSync(r,s){return this.makeCallSync(r,()=>this.baseFs.rmdirSync(r,s),(a,{subPath:n})=>a.rmdirSync(n,s))}async rmPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.rmPromise(r,s),async(a,{subPath:n})=>await a.rmPromise(n,s))}rmSync(r,s){return this.makeCallSync(r,()=>this.baseFs.rmSync(r,s),(a,{subPath:n})=>a.rmSync(n,s))}async linkPromise(r,s){return await this.makeCallPromise(s,async()=>await this.baseFs.linkPromise(r,s),async(a,{subPath:n})=>await a.linkPromise(r,n))}linkSync(r,s){return this.makeCallSync(s,()=>this.baseFs.linkSync(r,s),(a,{subPath:n})=>a.linkSync(r,n))}async symlinkPromise(r,s,a){return await this.makeCallPromise(s,async()=>await this.baseFs.symlinkPromise(r,s,a),async(n,{subPath:c})=>await n.symlinkPromise(r,c))}symlinkSync(r,s,a){return this.makeCallSync(s,()=>this.baseFs.symlinkSync(r,s,a),(n,{subPath:c})=>n.symlinkSync(r,c))}async readFilePromise(r,s){return this.makeCallPromise(r,async()=>await this.baseFs.readFilePromise(r,s),async(a,{subPath:n})=>await a.readFilePromise(n,s))}readFileSync(r,s){return this.makeCallSync(r,()=>this.baseFs.readFileSync(r,s),(a,{subPath:n})=>a.readFileSync(n,s))}async readdirPromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.readdirPromise(r,s),async(a,{subPath:n})=>await a.readdirPromise(n,s),{requireSubpath:!1})}readdirSync(r,s){return this.makeCallSync(r,()=>this.baseFs.readdirSync(r,s),(a,{subPath:n})=>a.readdirSync(n,s),{requireSubpath:!1})}async readlinkPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.readlinkPromise(r),async(s,{subPath:a})=>await s.readlinkPromise(a))}readlinkSync(r){return this.makeCallSync(r,()=>this.baseFs.readlinkSync(r),(s,{subPath:a})=>s.readlinkSync(a))}async truncatePromise(r,s){return await this.makeCallPromise(r,async()=>await this.baseFs.truncatePromise(r,s),async(a,{subPath:n})=>await a.truncatePromise(n,s))}truncateSync(r,s){return this.makeCallSync(r,()=>this.baseFs.truncateSync(r,s),(a,{subPath:n})=>a.truncateSync(n,s))}async ftruncatePromise(r,s){if((r&rl)!==this.magic)return this.baseFs.ftruncatePromise(r,s);let a=this.fdMap.get(r);if(typeof a>"u")throw Uo("ftruncate");let[n,c]=a;return n.ftruncatePromise(c,s)}ftruncateSync(r,s){if((r&rl)!==this.magic)return this.baseFs.ftruncateSync(r,s);let a=this.fdMap.get(r);if(typeof a>"u")throw Uo("ftruncateSync");let[n,c]=a;return n.ftruncateSync(c,s)}watch(r,s,a){return this.makeCallSync(r,()=>this.baseFs.watch(r,s,a),(n,{subPath:c})=>n.watch(c,s,a))}watchFile(r,s,a){return this.makeCallSync(r,()=>this.baseFs.watchFile(r,s,a),()=>sE(this,r,s,a))}unwatchFile(r,s){return this.makeCallSync(r,()=>this.baseFs.unwatchFile(r,s),()=>yd(this,r,s))}async makeCallPromise(r,s,a,{requireSubpath:n=!0}={}){if(typeof r!="string")return await s();let c=this.resolve(r),f=this.findMount(c);return f?n&&f.subPath==="/"?await s():await this.getMountPromise(f.archivePath,async p=>await a(p,f)):await s()}makeCallSync(r,s,a,{requireSubpath:n=!0}={}){if(typeof r!="string")return s();let c=this.resolve(r),f=this.findMount(c);return!f||n&&f.subPath==="/"?s():this.getMountSync(f.archivePath,p=>a(p,f))}findMount(r){if(this.filter&&!this.filter.test(r))return null;let s="";for(;;){let a=r.substring(s.length),n=this.getMountPoint(a,s);if(!n)return null;if(s=this.pathUtils.join(s,n),!this.isMount.has(s)){if(this.notMount.has(s))continue;try{if(this.typeCheck!==null&&(this.baseFs.statSync(s).mode&Bd.constants.S_IFMT)!==this.typeCheck){this.notMount.add(s);continue}}catch{return null}this.isMount.add(s)}return{archivePath:s,subPath:this.pathUtils.join(vt.root,r.substring(s.length))}}}limitOpenFiles(r){if(this.mountInstances===null)return;let s=Date.now(),a=s+this.maxAge,n=r===null?0:this.mountInstances.size-r;for(let[c,{childFs:f,expiresAt:p,refCount:h}]of this.mountInstances.entries())if(!(h!==0||f.hasOpenFileHandles?.())){if(s>=p){f.saveAndClose?.(),this.mountInstances.delete(c),n-=1;continue}else if(r===null||n<=0){a=p;break}f.saveAndClose?.(),this.mountInstances.delete(c),n-=1}this.limitOpenFilesTimeout===null&&(r===null&&this.mountInstances.size>0||r!==null)&&isFinite(a)&&(this.limitOpenFilesTimeout=setTimeout(()=>{this.limitOpenFilesTimeout=null,this.limitOpenFiles(null)},a-s).unref())}async getMountPromise(r,s){if(this.mountInstances){let a=this.mountInstances.get(r);if(!a){let n=await this.factoryPromise(this.baseFs,r);a=this.mountInstances.get(r),a||(a={childFs:n(),expiresAt:0,refCount:0})}this.mountInstances.delete(r),this.limitOpenFiles(this.maxOpenFiles-1),this.mountInstances.set(r,a),a.expiresAt=Date.now()+this.maxAge,a.refCount+=1;try{return await s(a.childFs)}finally{a.refCount-=1}}else{let a=(await this.factoryPromise(this.baseFs,r))();try{return await s(a)}finally{a.saveAndClose?.()}}}getMountSync(r,s){if(this.mountInstances){let a=this.mountInstances.get(r);return a||(a={childFs:this.factorySync(this.baseFs,r),expiresAt:0,refCount:0}),this.mountInstances.delete(r),this.limitOpenFiles(this.maxOpenFiles-1),this.mountInstances.set(r,a),a.expiresAt=Date.now()+this.maxAge,s(a.childFs)}else{let a=this.factorySync(this.baseFs,r);try{return s(a)}finally{a.saveAndClose?.()}}}}});var er,mx,J$=It(()=>{Cd();tl();er=()=>Object.assign(new Error("ENOSYS: unsupported filesystem access"),{code:"ENOSYS"}),mx=class t extends Ep{static{this.instance=new t}constructor(){super(K)}getExtractHint(){throw er()}getRealPath(){throw er()}resolve(){throw er()}async openPromise(){throw er()}openSync(){throw er()}async opendirPromise(){throw er()}opendirSync(){throw er()}async readPromise(){throw er()}readSync(){throw er()}async writePromise(){throw er()}writeSync(){throw er()}async closePromise(){throw er()}closeSync(){throw er()}createWriteStream(){throw er()}createReadStream(){throw er()}async realpathPromise(){throw er()}realpathSync(){throw er()}async readdirPromise(){throw er()}readdirSync(){throw er()}async existsPromise(e){throw er()}existsSync(e){throw er()}async accessPromise(){throw er()}accessSync(){throw er()}async statPromise(){throw er()}statSync(){throw er()}async fstatPromise(e){throw er()}fstatSync(e){throw er()}async lstatPromise(e){throw er()}lstatSync(e){throw er()}async fchmodPromise(){throw er()}fchmodSync(){throw er()}async chmodPromise(){throw er()}chmodSync(){throw er()}async fchownPromise(){throw er()}fchownSync(){throw er()}async chownPromise(){throw er()}chownSync(){throw er()}async mkdirPromise(){throw er()}mkdirSync(){throw er()}async rmdirPromise(){throw er()}rmdirSync(){throw er()}async rmPromise(){throw er()}rmSync(){throw er()}async linkPromise(){throw er()}linkSync(){throw er()}async symlinkPromise(){throw er()}symlinkSync(){throw er()}async renamePromise(){throw er()}renameSync(){throw er()}async copyFilePromise(){throw er()}copyFileSync(){throw er()}async appendFilePromise(){throw er()}appendFileSync(){throw er()}async writeFilePromise(){throw er()}writeFileSync(){throw er()}async unlinkPromise(){throw er()}unlinkSync(){throw er()}async utimesPromise(){throw er()}utimesSync(){throw er()}async lutimesPromise(){throw er()}lutimesSync(){throw er()}async readFilePromise(){throw er()}readFileSync(){throw er()}async readlinkPromise(){throw er()}readlinkSync(){throw er()}async truncatePromise(){throw er()}truncateSync(){throw er()}async ftruncatePromise(e,r){throw er()}ftruncateSync(e,r){throw er()}watch(){throw er()}watchFile(){throw er()}unwatchFile(){throw er()}}});var i0,z$=It(()=>{Ip();tl();i0=class extends Hs{constructor(e){super(ue),this.baseFs=e}mapFromBase(e){return ue.fromPortablePath(e)}mapToBase(e){return ue.toPortablePath(e)}}});var H7e,L_,j7e,fo,Z$=It(()=>{wd();Ip();tl();H7e=/^[0-9]+$/,L_=/^(\/(?:[^/]+\/)*?(?:\$\$virtual|__virtual__))((?:\/((?:[^/]+-)?[a-f0-9]+)(?:\/([^/]+))?)?((?:\/.*)?))$/,j7e=/^([^/]+-)?[a-f0-9]+$/,fo=class t extends Hs{static makeVirtualPath(e,r,s){if(K.basename(e)!=="__virtual__")throw new Error('Assertion failed: Virtual folders must be named "__virtual__"');if(!K.basename(r).match(j7e))throw new Error("Assertion failed: Virtual components must be ended by an hexadecimal hash");let n=K.relative(K.dirname(e),s).split("/"),c=0;for(;c{M_=et(ye("buffer")),X$=ye("url"),$$=ye("util");Ip();tl();yx=class extends Hs{constructor(e){super(ue),this.baseFs=e}mapFromBase(e){return e}mapToBase(e){if(typeof e=="string")return e;if(e instanceof URL)return(0,X$.fileURLToPath)(e);if(Buffer.isBuffer(e)){let r=e.toString();if(!q7e(e,r))throw new Error("Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942");return r}throw new Error(`Unsupported path type: ${(0,$$.inspect)(e)}`)}}});var see,Ho,Cp,s0,Ex,Ix,aE,Nu,Ou,tee,ree,nee,iee,H2,oee=It(()=>{see=ye("readline"),Ho=Symbol("kBaseFs"),Cp=Symbol("kFd"),s0=Symbol("kClosePromise"),Ex=Symbol("kCloseResolve"),Ix=Symbol("kCloseReject"),aE=Symbol("kRefs"),Nu=Symbol("kRef"),Ou=Symbol("kUnref"),H2=class{constructor(e,r){this[iee]=1;this[nee]=void 0;this[ree]=void 0;this[tee]=void 0;this[Ho]=r,this[Cp]=e}get fd(){return this[Cp]}async appendFile(e,r){try{this[Nu](this.appendFile);let s=(typeof r=="string"?r:r?.encoding)??void 0;return await this[Ho].appendFilePromise(this.fd,e,s?{encoding:s}:void 0)}finally{this[Ou]()}}async chown(e,r){try{return this[Nu](this.chown),await this[Ho].fchownPromise(this.fd,e,r)}finally{this[Ou]()}}async chmod(e){try{return this[Nu](this.chmod),await this[Ho].fchmodPromise(this.fd,e)}finally{this[Ou]()}}createReadStream(e){return this[Ho].createReadStream(null,{...e,fd:this.fd})}createWriteStream(e){return this[Ho].createWriteStream(null,{...e,fd:this.fd})}datasync(){throw new Error("Method not implemented.")}sync(){throw new Error("Method not implemented.")}async read(e,r,s,a){try{this[Nu](this.read);let n;return Buffer.isBuffer(e)?n=e:(e??={},n=e.buffer??Buffer.alloc(16384),r=e.offset||0,s=e.length??n.byteLength,a=e.position??null),r??=0,s??=0,s===0?{bytesRead:s,buffer:n}:{bytesRead:await this[Ho].readPromise(this.fd,n,r,s,a),buffer:n}}finally{this[Ou]()}}async readFile(e){try{this[Nu](this.readFile);let r=(typeof e=="string"?e:e?.encoding)??void 0;return await this[Ho].readFilePromise(this.fd,r)}finally{this[Ou]()}}readLines(e){return(0,see.createInterface)({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){try{return this[Nu](this.stat),await this[Ho].fstatPromise(this.fd,e)}finally{this[Ou]()}}async truncate(e){try{return this[Nu](this.truncate),await this[Ho].ftruncatePromise(this.fd,e)}finally{this[Ou]()}}utimes(e,r){throw new Error("Method not implemented.")}async writeFile(e,r){try{this[Nu](this.writeFile);let s=(typeof r=="string"?r:r?.encoding)??void 0;await this[Ho].writeFilePromise(this.fd,e,s)}finally{this[Ou]()}}async write(...e){try{if(this[Nu](this.write),ArrayBuffer.isView(e[0])){let[r,s,a,n]=e;return{bytesWritten:await this[Ho].writePromise(this.fd,r,s??void 0,a??void 0,n??void 0),buffer:r}}else{let[r,s,a]=e;return{bytesWritten:await this[Ho].writePromise(this.fd,r,s,a),buffer:r}}}finally{this[Ou]()}}async writev(e,r){try{this[Nu](this.writev);let s=0;if(typeof r<"u")for(let a of e){let n=await this.write(a,void 0,void 0,r);s+=n.bytesWritten,r+=n.bytesWritten}else for(let a of e){let n=await this.write(a);s+=n.bytesWritten}return{buffers:e,bytesWritten:s}}finally{this[Ou]()}}readv(e,r){throw new Error("Method not implemented.")}close(){if(this[Cp]===-1)return Promise.resolve();if(this[s0])return this[s0];if(this[aE]--,this[aE]===0){let e=this[Cp];this[Cp]=-1,this[s0]=this[Ho].closePromise(e).finally(()=>{this[s0]=void 0})}else this[s0]=new Promise((e,r)=>{this[Ex]=e,this[Ix]=r}).finally(()=>{this[s0]=void 0,this[Ix]=void 0,this[Ex]=void 0});return this[s0]}[(Ho,Cp,iee=aE,nee=s0,ree=Ex,tee=Ix,Nu)](e){if(this[Cp]===-1){let r=new Error("file closed");throw r.code="EBADF",r.syscall=e.name,r}this[aE]++}[Ou](){if(this[aE]--,this[aE]===0){let e=this[Cp];this[Cp]=-1,this[Ho].closePromise(e).then(this[Ex],this[Ix])}}}});function j2(t,e){e=new yx(e);let r=(s,a,n)=>{let c=s[a];s[a]=n,typeof c?.[lE.promisify.custom]<"u"&&(n[lE.promisify.custom]=c[lE.promisify.custom])};{r(t,"exists",(s,...a)=>{let c=typeof a[a.length-1]=="function"?a.pop():()=>{};process.nextTick(()=>{e.existsPromise(s).then(f=>{c(f)},()=>{c(!1)})})}),r(t,"read",(...s)=>{let[a,n,c,f,p,h]=s;if(s.length<=3){let E={};s.length<3?h=s[1]:(E=s[1],h=s[2]),{buffer:n=Buffer.alloc(16384),offset:c=0,length:f=n.byteLength,position:p}=E}if(c==null&&(c=0),f|=0,f===0){process.nextTick(()=>{h(null,0,n)});return}p==null&&(p=-1),process.nextTick(()=>{e.readPromise(a,n,c,f,p).then(E=>{h(null,E,n)},E=>{h(E,0,n)})})});for(let s of aee){let a=s.replace(/Promise$/,"");if(typeof t[a]>"u")continue;let n=e[s];if(typeof n>"u")continue;r(t,a,(...f)=>{let h=typeof f[f.length-1]=="function"?f.pop():()=>{};process.nextTick(()=>{n.apply(e,f).then(E=>{h(null,E)},E=>{h(E)})})})}t.realpath.native=t.realpath}{r(t,"existsSync",s=>{try{return e.existsSync(s)}catch{return!1}}),r(t,"readSync",(...s)=>{let[a,n,c,f,p]=s;return s.length<=3&&({offset:c=0,length:f=n.byteLength,position:p}=s[2]||{}),c==null&&(c=0),f|=0,f===0?0:(p==null&&(p=-1),e.readSync(a,n,c,f,p))});for(let s of G7e){let a=s;if(typeof t[a]>"u")continue;let n=e[s];typeof n>"u"||r(t,a,n.bind(e))}t.realpathSync.native=t.realpathSync}{let s=t.promises;for(let a of aee){let n=a.replace(/Promise$/,"");if(typeof s[n]>"u")continue;let c=e[a];typeof c>"u"||a!=="open"&&r(s,n,(f,...p)=>f instanceof H2?f[n].apply(f,p):c.call(e,f,...p))}r(s,"open",async(...a)=>{let n=await e.openPromise(...a);return new H2(n,e)})}t.read[lE.promisify.custom]=async(s,a,...n)=>({bytesRead:await e.readPromise(s,a,...n),buffer:a}),t.write[lE.promisify.custom]=async(s,a,...n)=>({bytesWritten:await e.writePromise(s,a,...n),buffer:a})}function Cx(t,e){let r=Object.create(t);return j2(r,e),r}var lE,G7e,aee,lee=It(()=>{lE=ye("util");eee();oee();G7e=new Set(["accessSync","appendFileSync","createReadStream","createWriteStream","chmodSync","fchmodSync","chownSync","fchownSync","closeSync","copyFileSync","linkSync","lstatSync","fstatSync","lutimesSync","mkdirSync","openSync","opendirSync","readlinkSync","readFileSync","readdirSync","readlinkSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","ftruncateSync","unlinkSync","unwatchFile","utimesSync","watch","watchFile","writeFileSync","writeSync"]),aee=new Set(["accessPromise","appendFilePromise","fchmodPromise","chmodPromise","fchownPromise","chownPromise","closePromise","copyFilePromise","linkPromise","fstatPromise","lstatPromise","lutimesPromise","mkdirPromise","openPromise","opendirPromise","readdirPromise","realpathPromise","readFilePromise","readdirPromise","readlinkPromise","renamePromise","rmdirPromise","rmPromise","statPromise","symlinkPromise","truncatePromise","ftruncatePromise","unlinkPromise","utimesPromise","writeFilePromise","writeSync"])});function cee(t){let e=Math.ceil(Math.random()*4294967296).toString(16).padStart(8,"0");return`${t}${e}`}function uee(){if(__)return __;let t=ue.toPortablePath(fee.default.tmpdir()),e=le.realpathSync(t);return process.once("exit",()=>{le.rmtempSync()}),__={tmpdir:t,realTmpdir:e}}var fee,Lu,__,le,Aee=It(()=>{fee=et(ye("os"));wd();tl();Lu=new Set,__=null;le=Object.assign(new Yn,{detachTemp(t){Lu.delete(t)},mktempSync(t){let{tmpdir:e,realTmpdir:r}=uee();for(;;){let s=cee("xfs-");try{this.mkdirSync(K.join(e,s))}catch(n){if(n.code==="EEXIST")continue;throw n}let a=K.join(r,s);if(Lu.add(a),typeof t>"u")return a;try{return t(a)}finally{if(Lu.has(a)){Lu.delete(a);try{this.removeSync(a)}catch{}}}}},async mktempPromise(t){let{tmpdir:e,realTmpdir:r}=uee();for(;;){let s=cee("xfs-");try{await this.mkdirPromise(K.join(e,s))}catch(n){if(n.code==="EEXIST")continue;throw n}let a=K.join(r,s);if(Lu.add(a),typeof t>"u")return a;try{return await t(a)}finally{if(Lu.has(a)){Lu.delete(a);try{await this.removePromise(a)}catch{}}}}},async rmtempPromise(){await Promise.all(Array.from(Lu.values()).map(async t=>{try{await le.removePromise(t,{maxRetries:0}),Lu.delete(t)}catch{}}))},rmtempSync(){for(let t of Lu)try{le.removeSync(t),Lu.delete(t)}catch{}}})});var q2={};Vt(q2,{AliasFS:()=>Hf,BasePortableFakeFS:()=>Uf,CustomDir:()=>U2,CwdFS:()=>Sn,FakeFS:()=>Ep,Filename:()=>Er,JailFS:()=>jf,LazyFS:()=>oE,MountFS:()=>n0,NoFS:()=>mx,NodeFS:()=>Yn,PortablePath:()=>vt,PosixFS:()=>i0,ProxiedFS:()=>Hs,VirtualFS:()=>fo,constants:()=>ui,errors:()=>or,extendFs:()=>Cx,normalizeLineEndings:()=>Id,npath:()=>ue,opendir:()=>hx,patchFs:()=>j2,ppath:()=>K,setupCopyIndex:()=>px,statUtils:()=>el,unwatchAllFiles:()=>Ed,unwatchFile:()=>yd,watchFile:()=>sE,xfs:()=>le});var bt=It(()=>{x$();ux();T_();N_();N$();O_();Cd();tl();tl();H$();Cd();G$();Y$();V$();K$();J$();wd();z$();Ip();Z$();lee();Aee()});var mee=L((A5t,dee)=>{dee.exports=gee;gee.sync=Y7e;var pee=ye("fs");function W7e(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var s=0;s{Cee.exports=Eee;Eee.sync=V7e;var yee=ye("fs");function Eee(t,e,r){yee.stat(t,function(s,a){r(s,s?!1:Iee(a,e))})}function V7e(t,e){return Iee(yee.statSync(t),e)}function Iee(t,e){return t.isFile()&&K7e(t,e)}function K7e(t,e){var r=t.mode,s=t.uid,a=t.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),c=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),f=parseInt("100",8),p=parseInt("010",8),h=parseInt("001",8),E=f|p,C=r&h||r&p&&a===c||r&f&&s===n||r&E&&n===0;return C}});var vee=L((g5t,Bee)=>{var h5t=ye("fs"),wx;process.platform==="win32"||global.TESTING_WINDOWS?wx=mee():wx=wee();Bee.exports=U_;U_.sync=J7e;function U_(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,a){U_(t,e||{},function(n,c){n?a(n):s(c)})})}wx(t,e||{},function(s,a){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,a=!1),r(s,a)})}function J7e(t,e){try{return wx.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Qee=L((d5t,kee)=>{var cE=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",See=ye("path"),z7e=cE?";":":",Dee=vee(),bee=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Pee=(t,e)=>{let r=e.colon||z7e,s=t.match(/\//)||cE&&t.match(/\\/)?[""]:[...cE?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],a=cE?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=cE?a.split(r):[""];return cE&&t.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:s,pathExt:n,pathExtExe:a}},xee=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:s,pathExt:a,pathExtExe:n}=Pee(t,e),c=[],f=h=>new Promise((E,C)=>{if(h===s.length)return e.all&&c.length?E(c):C(bee(t));let S=s[h],P=/^".*"$/.test(S)?S.slice(1,-1):S,I=See.join(P,t),R=!P&&/^\.[\\\/]/.test(t)?t.slice(0,2)+I:I;E(p(R,h,0))}),p=(h,E,C)=>new Promise((S,P)=>{if(C===a.length)return S(f(E+1));let I=a[C];Dee(h+I,{pathExt:n},(R,N)=>{if(!R&&N)if(e.all)c.push(h+I);else return S(h+I);return S(p(h,E,C+1))})});return r?f(0).then(h=>r(null,h),r):f(0)},Z7e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:s,pathExtExe:a}=Pee(t,e),n=[];for(let c=0;c{"use strict";var Tee=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};H_.exports=Tee;H_.exports.default=Tee});var Lee=L((y5t,Oee)=>{"use strict";var Fee=ye("path"),X7e=Qee(),$7e=Ree();function Nee(t,e){let r=t.options.env||process.env,s=process.cwd(),a=t.options.cwd!=null,n=a&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(t.options.cwd)}catch{}let c;try{c=X7e.sync(t.command,{path:r[$7e({env:r})],pathExt:e?Fee.delimiter:void 0})}catch{}finally{n&&process.chdir(s)}return c&&(c=Fee.resolve(a?t.options.cwd:"",c)),c}function eKe(t){return Nee(t)||Nee(t,!0)}Oee.exports=eKe});var Mee=L((E5t,q_)=>{"use strict";var j_=/([()\][%!^"`<>&|;, *?])/g;function tKe(t){return t=t.replace(j_,"^$1"),t}function rKe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(j_,"^$1"),e&&(t=t.replace(j_,"^$1")),t}q_.exports.command=tKe;q_.exports.argument=rKe});var Uee=L((I5t,_ee)=>{"use strict";_ee.exports=/^#!(.*)/});var jee=L((C5t,Hee)=>{"use strict";var nKe=Uee();Hee.exports=(t="")=>{let e=t.match(nKe);if(!e)return null;let[r,s]=e[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return a==="env"?s:s?`${a} ${s}`:a}});var Gee=L((w5t,qee)=>{"use strict";var G_=ye("fs"),iKe=jee();function sKe(t){let r=Buffer.alloc(150),s;try{s=G_.openSync(t,"r"),G_.readSync(s,r,0,150,0),G_.closeSync(s)}catch{}return iKe(r.toString())}qee.exports=sKe});var Kee=L((B5t,Vee)=>{"use strict";var oKe=ye("path"),Wee=Lee(),Yee=Mee(),aKe=Gee(),lKe=process.platform==="win32",cKe=/\.(?:com|exe)$/i,uKe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function fKe(t){t.file=Wee(t);let e=t.file&&aKe(t.file);return e?(t.args.unshift(t.file),t.command=e,Wee(t)):t.file}function AKe(t){if(!lKe)return t;let e=fKe(t),r=!cKe.test(e);if(t.options.forceShell||r){let s=uKe.test(e);t.command=oKe.normalize(t.command),t.command=Yee.command(t.command),t.args=t.args.map(n=>Yee.argument(n,s));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function pKe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let s={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?s:AKe(s)}Vee.exports=pKe});var Zee=L((v5t,zee)=>{"use strict";var W_=process.platform==="win32";function Y_(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function hKe(t,e){if(!W_)return;let r=t.emit;t.emit=function(s,a){if(s==="exit"){let n=Jee(a,e);if(n)return r.call(t,"error",n)}return r.apply(t,arguments)}}function Jee(t,e){return W_&&t===1&&!e.file?Y_(e.original,"spawn"):null}function gKe(t,e){return W_&&t===1&&!e.file?Y_(e.original,"spawnSync"):null}zee.exports={hookChildProcess:hKe,verifyENOENT:Jee,verifyENOENTSync:gKe,notFoundError:Y_}});var J_=L((S5t,uE)=>{"use strict";var Xee=ye("child_process"),V_=Kee(),K_=Zee();function $ee(t,e,r){let s=V_(t,e,r),a=Xee.spawn(s.command,s.args,s.options);return K_.hookChildProcess(a,s),a}function dKe(t,e,r){let s=V_(t,e,r),a=Xee.spawnSync(s.command,s.args,s.options);return a.error=a.error||K_.verifyENOENTSync(a.status,s),a}uE.exports=$ee;uE.exports.spawn=$ee;uE.exports.sync=dKe;uE.exports._parse=V_;uE.exports._enoent=K_});var tte=L((D5t,ete)=>{"use strict";function mKe(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function vd(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,vd)}mKe(vd,Error);vd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",C;for(C=0;C0){for(C=1,S=1;C>",b=ur(">>",!1),y=">&",F=ur(">&",!1),z=">",Z=ur(">",!1),$="<<<",oe=ur("<<<",!1),xe="<&",Te=ur("<&",!1),lt="<",Et=ur("<",!1),qt=function(O){return{type:"argument",segments:[].concat(...O)}},ir=function(O){return O},Pt="$'",gn=ur("$'",!1),Pr="'",Ir=ur("'",!1),Nr=function(O){return[{type:"text",text:O}]},nn='""',oi=ur('""',!1),wo=function(){return{type:"text",text:""}},rs='"',eo=ur('"',!1),Bo=function(O){return O},Hi=function(O){return{type:"arithmetic",arithmetic:O,quoted:!0}},to=function(O){return{type:"shell",shell:O,quoted:!0}},vo=function(O){return{type:"variable",...O,quoted:!0}},RA=function(O){return{type:"text",text:O}},pf=function(O){return{type:"arithmetic",arithmetic:O,quoted:!1}},Eh=function(O){return{type:"shell",shell:O,quoted:!1}},Ih=function(O){return{type:"variable",...O,quoted:!1}},ro=function(O){return{type:"glob",pattern:O}},jn=/^[^']/,Rs=zi(["'"],!0,!1),no=function(O){return O.join("")},lu=/^[^$"]/,cu=zi(["$",'"'],!0,!1),uu=`\\ +`,FA=ur(`\\ +`,!1),NA=function(){return""},aa="\\",la=ur("\\",!1),OA=/^[\\$"`]/,gr=zi(["\\","$",'"',"`"],!1,!1),So=function(O){return O},Me="\\a",fu=ur("\\a",!1),Cr=function(){return"a"},hf="\\b",LA=ur("\\b",!1),MA=function(){return"\b"},Au=/^[Ee]/,pu=zi(["E","e"],!1,!1),ac=function(){return"\x1B"},ve="\\f",Nt=ur("\\f",!1),lc=function(){return"\f"},Ni="\\n",io=ur("\\n",!1),Rt=function(){return` +`},xn="\\r",ca=ur("\\r",!1),ji=function(){return"\r"},Oi="\\t",Oa=ur("\\t",!1),dn=function(){return" "},Jn="\\v",hu=ur("\\v",!1),Ch=function(){return"\v"},La=/^[\\'"?]/,Ma=zi(["\\","'",'"',"?"],!1,!1),Ua=function(O){return String.fromCharCode(parseInt(O,16))},Xe="\\x",Ha=ur("\\x",!1),gf="\\u",cc=ur("\\u",!1),wn="\\U",ua=ur("\\U",!1),_A=function(O){return String.fromCodePoint(parseInt(O,16))},UA=/^[0-7]/,fa=zi([["0","7"]],!1,!1),vl=/^[0-9a-fA-f]/,Mt=zi([["0","9"],["a","f"],["A","f"]],!1,!1),kn=Ef(),Aa="{}",ja=ur("{}",!1),ns=function(){return"{}"},uc="-",gu=ur("-",!1),fc="+",qa=ur("+",!1),Li=".",Cs=ur(".",!1),Sl=function(O,J,re){return{type:"number",value:(O==="-"?-1:1)*parseFloat(J.join("")+"."+re.join(""))}},df=function(O,J){return{type:"number",value:(O==="-"?-1:1)*parseInt(J.join(""))}},Ac=function(O){return{type:"variable",...O}},wi=function(O){return{type:"variable",name:O}},Qn=function(O){return O},pc="*",Je=ur("*",!1),st="/",St=ur("/",!1),lr=function(O,J,re){return{type:J==="*"?"multiplication":"division",right:re}},ee=function(O,J){return J.reduce((re,de)=>({left:re,...de}),O)},Ie=function(O,J,re){return{type:J==="+"?"addition":"subtraction",right:re}},Oe="$((",ht=ur("$((",!1),mt="))",Dt=ur("))",!1),tr=function(O){return O},fn="$(",ai=ur("$(",!1),qi=function(O){return O},Tn="${",Ga=ur("${",!1),my=":-",t2=ur(":-",!1),Do=function(O,J){return{name:O,defaultValue:J}},yy=":-}",wh=ur(":-}",!1),r2=function(O){return{name:O,defaultValue:[]}},bo=":+",Bh=ur(":+",!1),vh=function(O,J){return{name:O,alternativeValue:J}},du=":+}",Sh=ur(":+}",!1),Ng=function(O){return{name:O,alternativeValue:[]}},Og=function(O){return{name:O}},Lg="$",Ey=ur("$",!1),mf=function(O){return e.isGlobPattern(O)},Po=function(O){return O},Dl=/^[a-zA-Z0-9_]/,Dh=zi([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Mg=function(){return By()},bl=/^[$@*?#a-zA-Z0-9_\-]/,Pl=zi(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),Iy=/^[()}<>$|&; \t"']/,HA=zi(["(",")","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),Cy=/^[<>&; \t"']/,wy=zi(["<",">","&",";"," "," ",'"',"'"],!1,!1),jA=/^[ \t]/,qA=zi([" "," "],!1,!1),Y=0,xt=0,GA=[{line:1,column:1}],xo=0,yf=[],dt=0,mu;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function By(){return t.substring(xt,Y)}function _g(){return If(xt,Y)}function n2(O,J){throw J=J!==void 0?J:If(xt,Y),WA([Ug(O)],t.substring(xt,Y),J)}function bh(O,J){throw J=J!==void 0?J:If(xt,Y),gi(O,J)}function ur(O,J){return{type:"literal",text:O,ignoreCase:J}}function zi(O,J,re){return{type:"class",parts:O,inverted:J,ignoreCase:re}}function Ef(){return{type:"any"}}function Wa(){return{type:"end"}}function Ug(O){return{type:"other",description:O}}function yu(O){var J=GA[O],re;if(J)return J;for(re=O-1;!GA[re];)re--;for(J=GA[re],J={line:J.line,column:J.column};rexo&&(xo=Y,yf=[]),yf.push(O))}function gi(O,J){return new vd(O,null,null,J)}function WA(O,J,re){return new vd(vd.buildMessage(O,J),O,J,re)}function Ya(){var O,J,re;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();return J!==r?(re=pa(),re===r&&(re=null),re!==r?(xt=O,J=n(re),O=J):(Y=O,O=r)):(Y=O,O=r),O}function pa(){var O,J,re,de,Ke;if(O=Y,J=Ph(),J!==r){for(re=[],de=kt();de!==r;)re.push(de),de=kt();re!==r?(de=Hg(),de!==r?(Ke=Va(),Ke===r&&(Ke=null),Ke!==r?(xt=O,J=c(J,de,Ke),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;if(O===r)if(O=Y,J=Ph(),J!==r){for(re=[],de=kt();de!==r;)re.push(de),de=kt();re!==r?(de=Hg(),de===r&&(de=null),de!==r?(xt=O,J=f(J,de),O=J):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;return O}function Va(){var O,J,re,de,Ke;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r)if(re=pa(),re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();de!==r?(xt=O,J=p(re),O=J):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r;return O}function Hg(){var O;return t.charCodeAt(Y)===59?(O=h,Y++):(O=r,dt===0&&wt(E)),O===r&&(t.charCodeAt(Y)===38?(O=C,Y++):(O=r,dt===0&&wt(S))),O}function Ph(){var O,J,re;return O=Y,J=YA(),J!==r?(re=jg(),re===r&&(re=null),re!==r?(xt=O,J=P(J,re),O=J):(Y=O,O=r)):(Y=O,O=r),O}function jg(){var O,J,re,de,Ke,ft,dr;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r)if(re=vy(),re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();if(de!==r)if(Ke=Ph(),Ke!==r){for(ft=[],dr=kt();dr!==r;)ft.push(dr),dr=kt();ft!==r?(xt=O,J=I(re,Ke),O=J):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r;return O}function vy(){var O;return t.substr(Y,2)===R?(O=R,Y+=2):(O=r,dt===0&&wt(N)),O===r&&(t.substr(Y,2)===U?(O=U,Y+=2):(O=r,dt===0&&wt(W))),O}function YA(){var O,J,re;return O=Y,J=Cf(),J!==r?(re=qg(),re===r&&(re=null),re!==r?(xt=O,J=te(J,re),O=J):(Y=O,O=r)):(Y=O,O=r),O}function qg(){var O,J,re,de,Ke,ft,dr;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r)if(re=Eu(),re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();if(de!==r)if(Ke=YA(),Ke!==r){for(ft=[],dr=kt();dr!==r;)ft.push(dr),dr=kt();ft!==r?(xt=O,J=ie(re,Ke),O=J):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r;return O}function Eu(){var O;return t.substr(Y,2)===Ae?(O=Ae,Y+=2):(O=r,dt===0&&wt(ce)),O===r&&(t.charCodeAt(Y)===124?(O=me,Y++):(O=r,dt===0&&wt(pe))),O}function Iu(){var O,J,re,de,Ke,ft;if(O=Y,J=Qh(),J!==r)if(t.charCodeAt(Y)===61?(re=Be,Y++):(re=r,dt===0&&wt(Ce)),re!==r)if(de=VA(),de!==r){for(Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();Ke!==r?(xt=O,J=g(J,de),O=J):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r;else Y=O,O=r;if(O===r)if(O=Y,J=Qh(),J!==r)if(t.charCodeAt(Y)===61?(re=Be,Y++):(re=r,dt===0&&wt(Ce)),re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();de!==r?(xt=O,J=we(J),O=J):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r;return O}function Cf(){var O,J,re,de,Ke,ft,dr,Br,_n,di,ws;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r)if(t.charCodeAt(Y)===40?(re=Ee,Y++):(re=r,dt===0&&wt(fe)),re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();if(de!==r)if(Ke=pa(),Ke!==r){for(ft=[],dr=kt();dr!==r;)ft.push(dr),dr=kt();if(ft!==r)if(t.charCodeAt(Y)===41?(dr=se,Y++):(dr=r,dt===0&&wt(X)),dr!==r){for(Br=[],_n=kt();_n!==r;)Br.push(_n),_n=kt();if(Br!==r){for(_n=[],di=qn();di!==r;)_n.push(di),di=qn();if(_n!==r){for(di=[],ws=kt();ws!==r;)di.push(ws),ws=kt();di!==r?(xt=O,J=De(Ke,_n),O=J):(Y=O,O=r)}else Y=O,O=r}else Y=O,O=r}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r;if(O===r){for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r)if(t.charCodeAt(Y)===123?(re=Re,Y++):(re=r,dt===0&&wt(gt)),re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();if(de!==r)if(Ke=pa(),Ke!==r){for(ft=[],dr=kt();dr!==r;)ft.push(dr),dr=kt();if(ft!==r)if(t.charCodeAt(Y)===125?(dr=j,Y++):(dr=r,dt===0&&wt(rt)),dr!==r){for(Br=[],_n=kt();_n!==r;)Br.push(_n),_n=kt();if(Br!==r){for(_n=[],di=qn();di!==r;)_n.push(di),di=qn();if(_n!==r){for(di=[],ws=kt();ws!==r;)di.push(ws),ws=kt();di!==r?(xt=O,J=Fe(Ke,_n),O=J):(Y=O,O=r)}else Y=O,O=r}else Y=O,O=r}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r;if(O===r){for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r){for(re=[],de=Iu();de!==r;)re.push(de),de=Iu();if(re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();if(de!==r){if(Ke=[],ft=Cu(),ft!==r)for(;ft!==r;)Ke.push(ft),ft=Cu();else Ke=r;if(Ke!==r){for(ft=[],dr=kt();dr!==r;)ft.push(dr),dr=kt();ft!==r?(xt=O,J=Ne(re,Ke),O=J):(Y=O,O=r)}else Y=O,O=r}else Y=O,O=r}else Y=O,O=r}else Y=O,O=r;if(O===r){for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r){if(re=[],de=Iu(),de!==r)for(;de!==r;)re.push(de),de=Iu();else re=r;if(re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();de!==r?(xt=O,J=Pe(re),O=J):(Y=O,O=r)}else Y=O,O=r}else Y=O,O=r}}}return O}function Fs(){var O,J,re,de,Ke;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r){if(re=[],de=xi(),de!==r)for(;de!==r;)re.push(de),de=xi();else re=r;if(re!==r){for(de=[],Ke=kt();Ke!==r;)de.push(Ke),Ke=kt();de!==r?(xt=O,J=Ye(re),O=J):(Y=O,O=r)}else Y=O,O=r}else Y=O,O=r;return O}function Cu(){var O,J,re;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();if(J!==r?(re=qn(),re!==r?(xt=O,J=ke(re),O=J):(Y=O,O=r)):(Y=O,O=r),O===r){for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();J!==r?(re=xi(),re!==r?(xt=O,J=ke(re),O=J):(Y=O,O=r)):(Y=O,O=r)}return O}function qn(){var O,J,re,de,Ke;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();return J!==r?(it.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(_e)),re===r&&(re=null),re!==r?(de=is(),de!==r?(Ke=xi(),Ke!==r?(xt=O,J=x(re,de,Ke),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O}function is(){var O;return t.substr(Y,2)===w?(O=w,Y+=2):(O=r,dt===0&&wt(b)),O===r&&(t.substr(Y,2)===y?(O=y,Y+=2):(O=r,dt===0&&wt(F)),O===r&&(t.charCodeAt(Y)===62?(O=z,Y++):(O=r,dt===0&&wt(Z)),O===r&&(t.substr(Y,3)===$?(O=$,Y+=3):(O=r,dt===0&&wt(oe)),O===r&&(t.substr(Y,2)===xe?(O=xe,Y+=2):(O=r,dt===0&&wt(Te)),O===r&&(t.charCodeAt(Y)===60?(O=lt,Y++):(O=r,dt===0&&wt(Et))))))),O}function xi(){var O,J,re;for(O=Y,J=[],re=kt();re!==r;)J.push(re),re=kt();return J!==r?(re=VA(),re!==r?(xt=O,J=ke(re),O=J):(Y=O,O=r)):(Y=O,O=r),O}function VA(){var O,J,re;if(O=Y,J=[],re=wf(),re!==r)for(;re!==r;)J.push(re),re=wf();else J=r;return J!==r&&(xt=O,J=qt(J)),O=J,O}function wf(){var O,J;return O=Y,J=mn(),J!==r&&(xt=O,J=ir(J)),O=J,O===r&&(O=Y,J=Gg(),J!==r&&(xt=O,J=ir(J)),O=J,O===r&&(O=Y,J=Wg(),J!==r&&(xt=O,J=ir(J)),O=J,O===r&&(O=Y,J=ss(),J!==r&&(xt=O,J=ir(J)),O=J))),O}function mn(){var O,J,re,de;return O=Y,t.substr(Y,2)===Pt?(J=Pt,Y+=2):(J=r,dt===0&&wt(gn)),J!==r?(re=yn(),re!==r?(t.charCodeAt(Y)===39?(de=Pr,Y++):(de=r,dt===0&&wt(Ir)),de!==r?(xt=O,J=Nr(re),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O}function Gg(){var O,J,re,de;return O=Y,t.charCodeAt(Y)===39?(J=Pr,Y++):(J=r,dt===0&&wt(Ir)),J!==r?(re=Bf(),re!==r?(t.charCodeAt(Y)===39?(de=Pr,Y++):(de=r,dt===0&&wt(Ir)),de!==r?(xt=O,J=Nr(re),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O}function Wg(){var O,J,re,de;if(O=Y,t.substr(Y,2)===nn?(J=nn,Y+=2):(J=r,dt===0&&wt(oi)),J!==r&&(xt=O,J=wo()),O=J,O===r)if(O=Y,t.charCodeAt(Y)===34?(J=rs,Y++):(J=r,dt===0&&wt(eo)),J!==r){for(re=[],de=xl();de!==r;)re.push(de),de=xl();re!==r?(t.charCodeAt(Y)===34?(de=rs,Y++):(de=r,dt===0&&wt(eo)),de!==r?(xt=O,J=Bo(re),O=J):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;return O}function ss(){var O,J,re;if(O=Y,J=[],re=ko(),re!==r)for(;re!==r;)J.push(re),re=ko();else J=r;return J!==r&&(xt=O,J=Bo(J)),O=J,O}function xl(){var O,J;return O=Y,J=Xr(),J!==r&&(xt=O,J=Hi(J)),O=J,O===r&&(O=Y,J=kh(),J!==r&&(xt=O,J=to(J)),O=J,O===r&&(O=Y,J=JA(),J!==r&&(xt=O,J=vo(J)),O=J,O===r&&(O=Y,J=vf(),J!==r&&(xt=O,J=RA(J)),O=J))),O}function ko(){var O,J;return O=Y,J=Xr(),J!==r&&(xt=O,J=pf(J)),O=J,O===r&&(O=Y,J=kh(),J!==r&&(xt=O,J=Eh(J)),O=J,O===r&&(O=Y,J=JA(),J!==r&&(xt=O,J=Ih(J)),O=J,O===r&&(O=Y,J=Sy(),J!==r&&(xt=O,J=ro(J)),O=J,O===r&&(O=Y,J=xh(),J!==r&&(xt=O,J=RA(J)),O=J)))),O}function Bf(){var O,J,re;for(O=Y,J=[],jn.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Rs));re!==r;)J.push(re),jn.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Rs));return J!==r&&(xt=O,J=no(J)),O=J,O}function vf(){var O,J,re;if(O=Y,J=[],re=kl(),re===r&&(lu.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(cu))),re!==r)for(;re!==r;)J.push(re),re=kl(),re===r&&(lu.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(cu)));else J=r;return J!==r&&(xt=O,J=no(J)),O=J,O}function kl(){var O,J,re;return O=Y,t.substr(Y,2)===uu?(J=uu,Y+=2):(J=r,dt===0&&wt(FA)),J!==r&&(xt=O,J=NA()),O=J,O===r&&(O=Y,t.charCodeAt(Y)===92?(J=aa,Y++):(J=r,dt===0&&wt(la)),J!==r?(OA.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(gr)),re!==r?(xt=O,J=So(re),O=J):(Y=O,O=r)):(Y=O,O=r)),O}function yn(){var O,J,re;for(O=Y,J=[],re=Qo(),re===r&&(jn.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Rs)));re!==r;)J.push(re),re=Qo(),re===r&&(jn.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Rs)));return J!==r&&(xt=O,J=no(J)),O=J,O}function Qo(){var O,J,re;return O=Y,t.substr(Y,2)===Me?(J=Me,Y+=2):(J=r,dt===0&&wt(fu)),J!==r&&(xt=O,J=Cr()),O=J,O===r&&(O=Y,t.substr(Y,2)===hf?(J=hf,Y+=2):(J=r,dt===0&&wt(LA)),J!==r&&(xt=O,J=MA()),O=J,O===r&&(O=Y,t.charCodeAt(Y)===92?(J=aa,Y++):(J=r,dt===0&&wt(la)),J!==r?(Au.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(pu)),re!==r?(xt=O,J=ac(),O=J):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===ve?(J=ve,Y+=2):(J=r,dt===0&&wt(Nt)),J!==r&&(xt=O,J=lc()),O=J,O===r&&(O=Y,t.substr(Y,2)===Ni?(J=Ni,Y+=2):(J=r,dt===0&&wt(io)),J!==r&&(xt=O,J=Rt()),O=J,O===r&&(O=Y,t.substr(Y,2)===xn?(J=xn,Y+=2):(J=r,dt===0&&wt(ca)),J!==r&&(xt=O,J=ji()),O=J,O===r&&(O=Y,t.substr(Y,2)===Oi?(J=Oi,Y+=2):(J=r,dt===0&&wt(Oa)),J!==r&&(xt=O,J=dn()),O=J,O===r&&(O=Y,t.substr(Y,2)===Jn?(J=Jn,Y+=2):(J=r,dt===0&&wt(hu)),J!==r&&(xt=O,J=Ch()),O=J,O===r&&(O=Y,t.charCodeAt(Y)===92?(J=aa,Y++):(J=r,dt===0&&wt(la)),J!==r?(La.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Ma)),re!==r?(xt=O,J=So(re),O=J):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=wu()))))))))),O}function wu(){var O,J,re,de,Ke,ft,dr,Br,_n,di,ws,zA;return O=Y,t.charCodeAt(Y)===92?(J=aa,Y++):(J=r,dt===0&&wt(la)),J!==r?(re=ha(),re!==r?(xt=O,J=Ua(re),O=J):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===Xe?(J=Xe,Y+=2):(J=r,dt===0&&wt(Ha)),J!==r?(re=Y,de=Y,Ke=ha(),Ke!==r?(ft=Ns(),ft!==r?(Ke=[Ke,ft],de=Ke):(Y=de,de=r)):(Y=de,de=r),de===r&&(de=ha()),de!==r?re=t.substring(re,Y):re=de,re!==r?(xt=O,J=Ua(re),O=J):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===gf?(J=gf,Y+=2):(J=r,dt===0&&wt(cc)),J!==r?(re=Y,de=Y,Ke=Ns(),Ke!==r?(ft=Ns(),ft!==r?(dr=Ns(),dr!==r?(Br=Ns(),Br!==r?(Ke=[Ke,ft,dr,Br],de=Ke):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r),de!==r?re=t.substring(re,Y):re=de,re!==r?(xt=O,J=Ua(re),O=J):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===wn?(J=wn,Y+=2):(J=r,dt===0&&wt(ua)),J!==r?(re=Y,de=Y,Ke=Ns(),Ke!==r?(ft=Ns(),ft!==r?(dr=Ns(),dr!==r?(Br=Ns(),Br!==r?(_n=Ns(),_n!==r?(di=Ns(),di!==r?(ws=Ns(),ws!==r?(zA=Ns(),zA!==r?(Ke=[Ke,ft,dr,Br,_n,di,ws,zA],de=Ke):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r)):(Y=de,de=r),de!==r?re=t.substring(re,Y):re=de,re!==r?(xt=O,J=_A(re),O=J):(Y=O,O=r)):(Y=O,O=r)))),O}function ha(){var O;return UA.test(t.charAt(Y))?(O=t.charAt(Y),Y++):(O=r,dt===0&&wt(fa)),O}function Ns(){var O;return vl.test(t.charAt(Y))?(O=t.charAt(Y),Y++):(O=r,dt===0&&wt(Mt)),O}function xh(){var O,J,re,de,Ke;if(O=Y,J=[],re=Y,t.charCodeAt(Y)===92?(de=aa,Y++):(de=r,dt===0&&wt(la)),de!==r?(t.length>Y?(Ke=t.charAt(Y),Y++):(Ke=r,dt===0&&wt(kn)),Ke!==r?(xt=re,de=So(Ke),re=de):(Y=re,re=r)):(Y=re,re=r),re===r&&(re=Y,t.substr(Y,2)===Aa?(de=Aa,Y+=2):(de=r,dt===0&&wt(ja)),de!==r&&(xt=re,de=ns()),re=de,re===r&&(re=Y,de=Y,dt++,Ke=Dy(),dt--,Ke===r?de=void 0:(Y=de,de=r),de!==r?(t.length>Y?(Ke=t.charAt(Y),Y++):(Ke=r,dt===0&&wt(kn)),Ke!==r?(xt=re,de=So(Ke),re=de):(Y=re,re=r)):(Y=re,re=r))),re!==r)for(;re!==r;)J.push(re),re=Y,t.charCodeAt(Y)===92?(de=aa,Y++):(de=r,dt===0&&wt(la)),de!==r?(t.length>Y?(Ke=t.charAt(Y),Y++):(Ke=r,dt===0&&wt(kn)),Ke!==r?(xt=re,de=So(Ke),re=de):(Y=re,re=r)):(Y=re,re=r),re===r&&(re=Y,t.substr(Y,2)===Aa?(de=Aa,Y+=2):(de=r,dt===0&&wt(ja)),de!==r&&(xt=re,de=ns()),re=de,re===r&&(re=Y,de=Y,dt++,Ke=Dy(),dt--,Ke===r?de=void 0:(Y=de,de=r),de!==r?(t.length>Y?(Ke=t.charAt(Y),Y++):(Ke=r,dt===0&&wt(kn)),Ke!==r?(xt=re,de=So(Ke),re=de):(Y=re,re=r)):(Y=re,re=r)));else J=r;return J!==r&&(xt=O,J=no(J)),O=J,O}function KA(){var O,J,re,de,Ke,ft;if(O=Y,t.charCodeAt(Y)===45?(J=uc,Y++):(J=r,dt===0&&wt(gu)),J===r&&(t.charCodeAt(Y)===43?(J=fc,Y++):(J=r,dt===0&&wt(qa))),J===r&&(J=null),J!==r){if(re=[],it.test(t.charAt(Y))?(de=t.charAt(Y),Y++):(de=r,dt===0&&wt(_e)),de!==r)for(;de!==r;)re.push(de),it.test(t.charAt(Y))?(de=t.charAt(Y),Y++):(de=r,dt===0&&wt(_e));else re=r;if(re!==r)if(t.charCodeAt(Y)===46?(de=Li,Y++):(de=r,dt===0&&wt(Cs)),de!==r){if(Ke=[],it.test(t.charAt(Y))?(ft=t.charAt(Y),Y++):(ft=r,dt===0&&wt(_e)),ft!==r)for(;ft!==r;)Ke.push(ft),it.test(t.charAt(Y))?(ft=t.charAt(Y),Y++):(ft=r,dt===0&&wt(_e));else Ke=r;Ke!==r?(xt=O,J=Sl(J,re,Ke),O=J):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;if(O===r){if(O=Y,t.charCodeAt(Y)===45?(J=uc,Y++):(J=r,dt===0&&wt(gu)),J===r&&(t.charCodeAt(Y)===43?(J=fc,Y++):(J=r,dt===0&&wt(qa))),J===r&&(J=null),J!==r){if(re=[],it.test(t.charAt(Y))?(de=t.charAt(Y),Y++):(de=r,dt===0&&wt(_e)),de!==r)for(;de!==r;)re.push(de),it.test(t.charAt(Y))?(de=t.charAt(Y),Y++):(de=r,dt===0&&wt(_e));else re=r;re!==r?(xt=O,J=df(J,re),O=J):(Y=O,O=r)}else Y=O,O=r;if(O===r&&(O=Y,J=JA(),J!==r&&(xt=O,J=Ac(J)),O=J,O===r&&(O=Y,J=hc(),J!==r&&(xt=O,J=wi(J)),O=J,O===r)))if(O=Y,t.charCodeAt(Y)===40?(J=Ee,Y++):(J=r,dt===0&&wt(fe)),J!==r){for(re=[],de=kt();de!==r;)re.push(de),de=kt();if(re!==r)if(de=so(),de!==r){for(Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();Ke!==r?(t.charCodeAt(Y)===41?(ft=se,Y++):(ft=r,dt===0&&wt(X)),ft!==r?(xt=O,J=Qn(de),O=J):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r}return O}function Sf(){var O,J,re,de,Ke,ft,dr,Br;if(O=Y,J=KA(),J!==r){for(re=[],de=Y,Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();if(Ke!==r)if(t.charCodeAt(Y)===42?(ft=pc,Y++):(ft=r,dt===0&&wt(Je)),ft===r&&(t.charCodeAt(Y)===47?(ft=st,Y++):(ft=r,dt===0&&wt(St))),ft!==r){for(dr=[],Br=kt();Br!==r;)dr.push(Br),Br=kt();dr!==r?(Br=KA(),Br!==r?(xt=de,Ke=lr(J,ft,Br),de=Ke):(Y=de,de=r)):(Y=de,de=r)}else Y=de,de=r;else Y=de,de=r;for(;de!==r;){for(re.push(de),de=Y,Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();if(Ke!==r)if(t.charCodeAt(Y)===42?(ft=pc,Y++):(ft=r,dt===0&&wt(Je)),ft===r&&(t.charCodeAt(Y)===47?(ft=st,Y++):(ft=r,dt===0&&wt(St))),ft!==r){for(dr=[],Br=kt();Br!==r;)dr.push(Br),Br=kt();dr!==r?(Br=KA(),Br!==r?(xt=de,Ke=lr(J,ft,Br),de=Ke):(Y=de,de=r)):(Y=de,de=r)}else Y=de,de=r;else Y=de,de=r}re!==r?(xt=O,J=ee(J,re),O=J):(Y=O,O=r)}else Y=O,O=r;return O}function so(){var O,J,re,de,Ke,ft,dr,Br;if(O=Y,J=Sf(),J!==r){for(re=[],de=Y,Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();if(Ke!==r)if(t.charCodeAt(Y)===43?(ft=fc,Y++):(ft=r,dt===0&&wt(qa)),ft===r&&(t.charCodeAt(Y)===45?(ft=uc,Y++):(ft=r,dt===0&&wt(gu))),ft!==r){for(dr=[],Br=kt();Br!==r;)dr.push(Br),Br=kt();dr!==r?(Br=Sf(),Br!==r?(xt=de,Ke=Ie(J,ft,Br),de=Ke):(Y=de,de=r)):(Y=de,de=r)}else Y=de,de=r;else Y=de,de=r;for(;de!==r;){for(re.push(de),de=Y,Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();if(Ke!==r)if(t.charCodeAt(Y)===43?(ft=fc,Y++):(ft=r,dt===0&&wt(qa)),ft===r&&(t.charCodeAt(Y)===45?(ft=uc,Y++):(ft=r,dt===0&&wt(gu))),ft!==r){for(dr=[],Br=kt();Br!==r;)dr.push(Br),Br=kt();dr!==r?(Br=Sf(),Br!==r?(xt=de,Ke=Ie(J,ft,Br),de=Ke):(Y=de,de=r)):(Y=de,de=r)}else Y=de,de=r;else Y=de,de=r}re!==r?(xt=O,J=ee(J,re),O=J):(Y=O,O=r)}else Y=O,O=r;return O}function Xr(){var O,J,re,de,Ke,ft;if(O=Y,t.substr(Y,3)===Oe?(J=Oe,Y+=3):(J=r,dt===0&&wt(ht)),J!==r){for(re=[],de=kt();de!==r;)re.push(de),de=kt();if(re!==r)if(de=so(),de!==r){for(Ke=[],ft=kt();ft!==r;)Ke.push(ft),ft=kt();Ke!==r?(t.substr(Y,2)===mt?(ft=mt,Y+=2):(ft=r,dt===0&&wt(Dt)),ft!==r?(xt=O,J=tr(de),O=J):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;return O}function kh(){var O,J,re,de;return O=Y,t.substr(Y,2)===fn?(J=fn,Y+=2):(J=r,dt===0&&wt(ai)),J!==r?(re=pa(),re!==r?(t.charCodeAt(Y)===41?(de=se,Y++):(de=r,dt===0&&wt(X)),de!==r?(xt=O,J=qi(re),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O}function JA(){var O,J,re,de,Ke,ft;return O=Y,t.substr(Y,2)===Tn?(J=Tn,Y+=2):(J=r,dt===0&&wt(Ga)),J!==r?(re=hc(),re!==r?(t.substr(Y,2)===my?(de=my,Y+=2):(de=r,dt===0&&wt(t2)),de!==r?(Ke=Fs(),Ke!==r?(t.charCodeAt(Y)===125?(ft=j,Y++):(ft=r,dt===0&&wt(rt)),ft!==r?(xt=O,J=Do(re,Ke),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===Tn?(J=Tn,Y+=2):(J=r,dt===0&&wt(Ga)),J!==r?(re=hc(),re!==r?(t.substr(Y,3)===yy?(de=yy,Y+=3):(de=r,dt===0&&wt(wh)),de!==r?(xt=O,J=r2(re),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===Tn?(J=Tn,Y+=2):(J=r,dt===0&&wt(Ga)),J!==r?(re=hc(),re!==r?(t.substr(Y,2)===bo?(de=bo,Y+=2):(de=r,dt===0&&wt(Bh)),de!==r?(Ke=Fs(),Ke!==r?(t.charCodeAt(Y)===125?(ft=j,Y++):(ft=r,dt===0&&wt(rt)),ft!==r?(xt=O,J=vh(re,Ke),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===Tn?(J=Tn,Y+=2):(J=r,dt===0&&wt(Ga)),J!==r?(re=hc(),re!==r?(t.substr(Y,3)===du?(de=du,Y+=3):(de=r,dt===0&&wt(Sh)),de!==r?(xt=O,J=Ng(re),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.substr(Y,2)===Tn?(J=Tn,Y+=2):(J=r,dt===0&&wt(Ga)),J!==r?(re=hc(),re!==r?(t.charCodeAt(Y)===125?(de=j,Y++):(de=r,dt===0&&wt(rt)),de!==r?(xt=O,J=Og(re),O=J):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r),O===r&&(O=Y,t.charCodeAt(Y)===36?(J=Lg,Y++):(J=r,dt===0&&wt(Ey)),J!==r?(re=hc(),re!==r?(xt=O,J=Og(re),O=J):(Y=O,O=r)):(Y=O,O=r)))))),O}function Sy(){var O,J,re;return O=Y,J=Yg(),J!==r?(xt=Y,re=mf(J),re?re=void 0:re=r,re!==r?(xt=O,J=Po(J),O=J):(Y=O,O=r)):(Y=O,O=r),O}function Yg(){var O,J,re,de,Ke;if(O=Y,J=[],re=Y,de=Y,dt++,Ke=Th(),dt--,Ke===r?de=void 0:(Y=de,de=r),de!==r?(t.length>Y?(Ke=t.charAt(Y),Y++):(Ke=r,dt===0&&wt(kn)),Ke!==r?(xt=re,de=So(Ke),re=de):(Y=re,re=r)):(Y=re,re=r),re!==r)for(;re!==r;)J.push(re),re=Y,de=Y,dt++,Ke=Th(),dt--,Ke===r?de=void 0:(Y=de,de=r),de!==r?(t.length>Y?(Ke=t.charAt(Y),Y++):(Ke=r,dt===0&&wt(kn)),Ke!==r?(xt=re,de=So(Ke),re=de):(Y=re,re=r)):(Y=re,re=r);else J=r;return J!==r&&(xt=O,J=no(J)),O=J,O}function Qh(){var O,J,re;if(O=Y,J=[],Dl.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Dh)),re!==r)for(;re!==r;)J.push(re),Dl.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Dh));else J=r;return J!==r&&(xt=O,J=Mg()),O=J,O}function hc(){var O,J,re;if(O=Y,J=[],bl.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Pl)),re!==r)for(;re!==r;)J.push(re),bl.test(t.charAt(Y))?(re=t.charAt(Y),Y++):(re=r,dt===0&&wt(Pl));else J=r;return J!==r&&(xt=O,J=Mg()),O=J,O}function Dy(){var O;return Iy.test(t.charAt(Y))?(O=t.charAt(Y),Y++):(O=r,dt===0&&wt(HA)),O}function Th(){var O;return Cy.test(t.charAt(Y))?(O=t.charAt(Y),Y++):(O=r,dt===0&&wt(wy)),O}function kt(){var O,J;if(O=[],jA.test(t.charAt(Y))?(J=t.charAt(Y),Y++):(J=r,dt===0&&wt(qA)),J!==r)for(;J!==r;)O.push(J),jA.test(t.charAt(Y))?(J=t.charAt(Y),Y++):(J=r,dt===0&&wt(qA));else O=r;return O}if(mu=a(),mu!==r&&Y===t.length)return mu;throw mu!==r&&Y!1}){try{return(0,rte.parse)(t,e)}catch(r){throw r.location&&(r.message=r.message.replace(/(\.)?$/,` (line ${r.location.start.line}, column ${r.location.start.column})$1`)),r}}function fE(t,{endSemicolon:e=!1}={}){return t.map(({command:r,type:s},a)=>`${Sx(r)}${s===";"?a!==t.length-1||e?";":"":" &"}`).join(" ")}function Sx(t){return`${AE(t.chain)}${t.then?` ${z_(t.then)}`:""}`}function z_(t){return`${t.type} ${Sx(t.line)}`}function AE(t){return`${X_(t)}${t.then?` ${Z_(t.then)}`:""}`}function Z_(t){return`${t.type} ${AE(t.chain)}`}function X_(t){switch(t.type){case"command":return`${t.envs.length>0?`${t.envs.map(e=>Bx(e)).join(" ")} `:""}${t.args.map(e=>$_(e)).join(" ")}`;case"subshell":return`(${fE(t.subshell)})${t.args.length>0?` ${t.args.map(e=>G2(e)).join(" ")}`:""}`;case"group":return`{ ${fE(t.group,{endSemicolon:!0})} }${t.args.length>0?` ${t.args.map(e=>G2(e)).join(" ")}`:""}`;case"envs":return t.envs.map(e=>Bx(e)).join(" ");default:throw new Error(`Unsupported command type: "${t.type}"`)}}function Bx(t){return`${t.name}=${t.args[0]?Sd(t.args[0]):""}`}function $_(t){switch(t.type){case"redirection":return G2(t);case"argument":return Sd(t);default:throw new Error(`Unsupported argument type: "${t.type}"`)}}function G2(t){return`${t.subtype} ${t.args.map(e=>Sd(e)).join(" ")}`}function Sd(t){return t.segments.map(e=>eU(e)).join("")}function eU(t){let e=(s,a)=>a?`"${s}"`:s,r=s=>s===""?"''":s.match(/[()}<>$|&;"'\n\t ]/)?s.match(/['\t\p{C}]/u)?s.match(/'/)?`"${s.replace(/["$\t\p{C}]/u,IKe)}"`:`$'${s.replace(/[\t\p{C}]/u,ite)}'`:`'${s}'`:s;switch(t.type){case"text":return r(t.text);case"glob":return t.pattern;case"shell":return e(`$(${fE(t.shell)})`,t.quoted);case"variable":return e(typeof t.defaultValue>"u"?typeof t.alternativeValue>"u"?`\${${t.name}}`:t.alternativeValue.length===0?`\${${t.name}:+}`:`\${${t.name}:+${t.alternativeValue.map(s=>Sd(s)).join(" ")}}`:t.defaultValue.length===0?`\${${t.name}:-}`:`\${${t.name}:-${t.defaultValue.map(s=>Sd(s)).join(" ")}}`,t.quoted);case"arithmetic":return`$(( ${Dx(t.arithmetic)} ))`;default:throw new Error(`Unsupported argument segment type: "${t.type}"`)}}function Dx(t){let e=a=>{switch(a){case"addition":return"+";case"subtraction":return"-";case"multiplication":return"*";case"division":return"/";default:throw new Error(`Can't extract operator from arithmetic expression of type "${a}"`)}},r=(a,n)=>n?`( ${a} )`:a,s=a=>r(Dx(a),!["number","variable"].includes(a.type));switch(t.type){case"number":return String(t.value);case"variable":return t.name;default:return`${s(t.left)} ${e(t.type)} ${s(t.right)}`}}var rte,nte,EKe,ite,IKe,ste=It(()=>{rte=et(tte());nte=new Map([["\f","\\f"],[` +`,"\\n"],["\r","\\r"],[" ","\\t"],["\v","\\v"],["\0","\\0"]]),EKe=new Map([["\\","\\\\"],["$","\\$"],['"','\\"'],...Array.from(nte,([t,e])=>[t,`"$'${e}'"`])]),ite=t=>nte.get(t)??`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`,IKe=t=>EKe.get(t)??`"$'${ite(t)}'"`});var ate=L((U5t,ote)=>{"use strict";function CKe(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Dd(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Dd)}CKe(Dd,Error);Dd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",C;for(C=0;C0){for(C=1,S=1;CAe&&(Ae=W,ce=[]),ce.push(_e))}function rt(_e,x){return new Dd(_e,null,null,x)}function Fe(_e,x,w){return new Dd(Dd.buildMessage(_e,x),_e,x,w)}function Ne(){var _e,x,w,b;return _e=W,x=Pe(),x!==r?(t.charCodeAt(W)===47?(w=n,W++):(w=r,me===0&&j(c)),w!==r?(b=Pe(),b!==r?(te=_e,x=f(x,b),_e=x):(W=_e,_e=r)):(W=_e,_e=r)):(W=_e,_e=r),_e===r&&(_e=W,x=Pe(),x!==r&&(te=_e,x=p(x)),_e=x),_e}function Pe(){var _e,x,w,b;return _e=W,x=Ye(),x!==r?(t.charCodeAt(W)===64?(w=h,W++):(w=r,me===0&&j(E)),w!==r?(b=it(),b!==r?(te=_e,x=C(x,b),_e=x):(W=_e,_e=r)):(W=_e,_e=r)):(W=_e,_e=r),_e===r&&(_e=W,x=Ye(),x!==r&&(te=_e,x=S(x)),_e=x),_e}function Ye(){var _e,x,w,b,y;return _e=W,t.charCodeAt(W)===64?(x=h,W++):(x=r,me===0&&j(E)),x!==r?(w=ke(),w!==r?(t.charCodeAt(W)===47?(b=n,W++):(b=r,me===0&&j(c)),b!==r?(y=ke(),y!==r?(te=_e,x=P(),_e=x):(W=_e,_e=r)):(W=_e,_e=r)):(W=_e,_e=r)):(W=_e,_e=r),_e===r&&(_e=W,x=ke(),x!==r&&(te=_e,x=P()),_e=x),_e}function ke(){var _e,x,w;if(_e=W,x=[],I.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(R)),w!==r)for(;w!==r;)x.push(w),I.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(R));else x=r;return x!==r&&(te=_e,x=P()),_e=x,_e}function it(){var _e,x,w;if(_e=W,x=[],N.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(U)),w!==r)for(;w!==r;)x.push(w),N.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(U));else x=r;return x!==r&&(te=_e,x=P()),_e=x,_e}if(pe=a(),pe!==r&&W===t.length)return pe;throw pe!==r&&W{lte=et(ate())});var Pd=L((j5t,bd)=>{"use strict";function ute(t){return typeof t>"u"||t===null}function BKe(t){return typeof t=="object"&&t!==null}function vKe(t){return Array.isArray(t)?t:ute(t)?[]:[t]}function SKe(t,e){var r,s,a,n;if(e)for(n=Object.keys(e),r=0,s=n.length;r{"use strict";function W2(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}W2.prototype=Object.create(Error.prototype);W2.prototype.constructor=W2;W2.prototype.toString=function(e){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!e&&this.mark&&(r+=" "+this.mark.toString()),r};fte.exports=W2});var hte=L((G5t,pte)=>{"use strict";var Ate=Pd();function tU(t,e,r,s,a){this.name=t,this.buffer=e,this.position=r,this.line=s,this.column=a}tU.prototype.getSnippet=function(e,r){var s,a,n,c,f;if(!this.buffer)return null;for(e=e||4,r=r||75,s="",a=this.position;a>0&&`\0\r +\x85\u2028\u2029`.indexOf(this.buffer.charAt(a-1))===-1;)if(a-=1,this.position-a>r/2-1){s=" ... ",a+=5;break}for(n="",c=this.position;cr/2-1){n=" ... ",c-=5;break}return f=this.buffer.slice(a,c),Ate.repeat(" ",e)+s+f+n+` +`+Ate.repeat(" ",e+this.position-a+s.length)+"^"};tU.prototype.toString=function(e){var r,s="";return this.name&&(s+='in "'+this.name+'" '),s+="at line "+(this.line+1)+", column "+(this.column+1),e||(r=this.getSnippet(),r&&(s+=`: +`+r)),s};pte.exports=tU});var Ds=L((W5t,dte)=>{"use strict";var gte=pE(),PKe=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],xKe=["scalar","sequence","mapping"];function kKe(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(s){e[String(s)]=r})}),e}function QKe(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(PKe.indexOf(r)===-1)throw new gte('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=kKe(e.styleAliases||null),xKe.indexOf(this.kind)===-1)throw new gte('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}dte.exports=QKe});var xd=L((Y5t,yte)=>{"use strict";var mte=Pd(),xx=pE(),TKe=Ds();function rU(t,e,r){var s=[];return t.include.forEach(function(a){r=rU(a,e,r)}),t[e].forEach(function(a){r.forEach(function(n,c){n.tag===a.tag&&n.kind===a.kind&&s.push(c)}),r.push(a)}),r.filter(function(a,n){return s.indexOf(n)===-1})}function RKe(){var t={scalar:{},sequence:{},mapping:{},fallback:{}},e,r;function s(a){t[a.kind][a.tag]=t.fallback[a.tag]=a}for(e=0,r=arguments.length;e{"use strict";var FKe=Ds();Ete.exports=new FKe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var wte=L((K5t,Cte)=>{"use strict";var NKe=Ds();Cte.exports=new NKe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var vte=L((J5t,Bte)=>{"use strict";var OKe=Ds();Bte.exports=new OKe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var kx=L((z5t,Ste)=>{"use strict";var LKe=xd();Ste.exports=new LKe({explicit:[Ite(),wte(),vte()]})});var bte=L((Z5t,Dte)=>{"use strict";var MKe=Ds();function _Ke(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function UKe(){return null}function HKe(t){return t===null}Dte.exports=new MKe("tag:yaml.org,2002:null",{kind:"scalar",resolve:_Ke,construct:UKe,predicate:HKe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var xte=L((X5t,Pte)=>{"use strict";var jKe=Ds();function qKe(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function GKe(t){return t==="true"||t==="True"||t==="TRUE"}function WKe(t){return Object.prototype.toString.call(t)==="[object Boolean]"}Pte.exports=new jKe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:qKe,construct:GKe,predicate:WKe,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var Qte=L(($5t,kte)=>{"use strict";var YKe=Pd(),VKe=Ds();function KKe(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function JKe(t){return 48<=t&&t<=55}function zKe(t){return 48<=t&&t<=57}function ZKe(t){if(t===null)return!1;var e=t.length,r=0,s=!1,a;if(!e)return!1;if(a=t[r],(a==="-"||a==="+")&&(a=t[++r]),a==="0"){if(r+1===e)return!0;if(a=t[++r],a==="b"){for(r++;r=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var Fte=L((e9t,Rte)=>{"use strict";var Tte=Pd(),eJe=Ds(),tJe=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function rJe(t){return!(t===null||!tJe.test(t)||t[t.length-1]==="_")}function nJe(t){var e,r,s,a;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,a=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(n){a.unshift(parseFloat(n,10))}),e=0,s=1,a.forEach(function(n){e+=n*s,s*=60}),r*e):r*parseFloat(e,10)}var iJe=/^[-+]?[0-9]+e/;function sJe(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Tte.isNegativeZero(t))return"-0.0";return r=t.toString(10),iJe.test(r)?r.replace("e",".e"):r}function oJe(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Tte.isNegativeZero(t))}Rte.exports=new eJe("tag:yaml.org,2002:float",{kind:"scalar",resolve:rJe,construct:nJe,predicate:oJe,represent:sJe,defaultStyle:"lowercase"})});var nU=L((t9t,Nte)=>{"use strict";var aJe=xd();Nte.exports=new aJe({include:[kx()],implicit:[bte(),xte(),Qte(),Fte()]})});var iU=L((r9t,Ote)=>{"use strict";var lJe=xd();Ote.exports=new lJe({include:[nU()]})});var Ute=L((n9t,_te)=>{"use strict";var cJe=Ds(),Lte=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Mte=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function uJe(t){return t===null?!1:Lte.exec(t)!==null||Mte.exec(t)!==null}function fJe(t){var e,r,s,a,n,c,f,p=0,h=null,E,C,S;if(e=Lte.exec(t),e===null&&(e=Mte.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],s=+e[2]-1,a=+e[3],!e[4])return new Date(Date.UTC(r,s,a));if(n=+e[4],c=+e[5],f=+e[6],e[7]){for(p=e[7].slice(0,3);p.length<3;)p+="0";p=+p}return e[9]&&(E=+e[10],C=+(e[11]||0),h=(E*60+C)*6e4,e[9]==="-"&&(h=-h)),S=new Date(Date.UTC(r,s,a,n,c,f,p)),h&&S.setTime(S.getTime()-h),S}function AJe(t){return t.toISOString()}_te.exports=new cJe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:uJe,construct:fJe,instanceOf:Date,represent:AJe})});var jte=L((i9t,Hte)=>{"use strict";var pJe=Ds();function hJe(t){return t==="<<"||t===null}Hte.exports=new pJe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:hJe})});var Wte=L((s9t,Gte)=>{"use strict";var kd;try{qte=ye,kd=qte("buffer").Buffer}catch{}var qte,gJe=Ds(),sU=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;function dJe(t){if(t===null)return!1;var e,r,s=0,a=t.length,n=sU;for(r=0;r64)){if(e<0)return!1;s+=6}return s%8===0}function mJe(t){var e,r,s=t.replace(/[\r\n=]/g,""),a=s.length,n=sU,c=0,f=[];for(e=0;e>16&255),f.push(c>>8&255),f.push(c&255)),c=c<<6|n.indexOf(s.charAt(e));return r=a%4*6,r===0?(f.push(c>>16&255),f.push(c>>8&255),f.push(c&255)):r===18?(f.push(c>>10&255),f.push(c>>2&255)):r===12&&f.push(c>>4&255),kd?kd.from?kd.from(f):new kd(f):f}function yJe(t){var e="",r=0,s,a,n=t.length,c=sU;for(s=0;s>18&63],e+=c[r>>12&63],e+=c[r>>6&63],e+=c[r&63]),r=(r<<8)+t[s];return a=n%3,a===0?(e+=c[r>>18&63],e+=c[r>>12&63],e+=c[r>>6&63],e+=c[r&63]):a===2?(e+=c[r>>10&63],e+=c[r>>4&63],e+=c[r<<2&63],e+=c[64]):a===1&&(e+=c[r>>2&63],e+=c[r<<4&63],e+=c[64],e+=c[64]),e}function EJe(t){return kd&&kd.isBuffer(t)}Gte.exports=new gJe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:dJe,construct:mJe,predicate:EJe,represent:yJe})});var Vte=L((a9t,Yte)=>{"use strict";var IJe=Ds(),CJe=Object.prototype.hasOwnProperty,wJe=Object.prototype.toString;function BJe(t){if(t===null)return!0;var e=[],r,s,a,n,c,f=t;for(r=0,s=f.length;r{"use strict";var SJe=Ds(),DJe=Object.prototype.toString;function bJe(t){if(t===null)return!0;var e,r,s,a,n,c=t;for(n=new Array(c.length),e=0,r=c.length;e{"use strict";var xJe=Ds(),kJe=Object.prototype.hasOwnProperty;function QJe(t){if(t===null)return!0;var e,r=t;for(e in r)if(kJe.call(r,e)&&r[e]!==null)return!1;return!0}function TJe(t){return t!==null?t:{}}zte.exports=new xJe("tag:yaml.org,2002:set",{kind:"mapping",resolve:QJe,construct:TJe})});var gE=L((u9t,Xte)=>{"use strict";var RJe=xd();Xte.exports=new RJe({include:[iU()],implicit:[Ute(),jte()],explicit:[Wte(),Vte(),Jte(),Zte()]})});var ere=L((f9t,$te)=>{"use strict";var FJe=Ds();function NJe(){return!0}function OJe(){}function LJe(){return""}function MJe(t){return typeof t>"u"}$te.exports=new FJe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:NJe,construct:OJe,predicate:MJe,represent:LJe})});var rre=L((A9t,tre)=>{"use strict";var _Je=Ds();function UJe(t){if(t===null||t.length===0)return!1;var e=t,r=/\/([gim]*)$/.exec(t),s="";return!(e[0]==="/"&&(r&&(s=r[1]),s.length>3||e[e.length-s.length-1]!=="/"))}function HJe(t){var e=t,r=/\/([gim]*)$/.exec(t),s="";return e[0]==="/"&&(r&&(s=r[1]),e=e.slice(1,e.length-s.length-1)),new RegExp(e,s)}function jJe(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}function qJe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}tre.exports=new _Je("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:UJe,construct:HJe,predicate:qJe,represent:jJe})});var sre=L((p9t,ire)=>{"use strict";var Qx;try{nre=ye,Qx=nre("esprima")}catch{typeof window<"u"&&(Qx=window.esprima)}var nre,GJe=Ds();function WJe(t){if(t===null)return!1;try{var e="("+t+")",r=Qx.parse(e,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function YJe(t){var e="("+t+")",r=Qx.parse(e,{range:!0}),s=[],a;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(n){s.push(n.name)}),a=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(s,e.slice(a[0]+1,a[1]-1)):new Function(s,"return "+e.slice(a[0],a[1]))}function VJe(t){return t.toString()}function KJe(t){return Object.prototype.toString.call(t)==="[object Function]"}ire.exports=new GJe("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:WJe,construct:YJe,predicate:KJe,represent:VJe})});var Y2=L((g9t,are)=>{"use strict";var ore=xd();are.exports=ore.DEFAULT=new ore({include:[gE()],explicit:[ere(),rre(),sre()]})});var Dre=L((d9t,V2)=>{"use strict";var wp=Pd(),hre=pE(),JJe=hte(),gre=gE(),zJe=Y2(),a0=Object.prototype.hasOwnProperty,Tx=1,dre=2,mre=3,Rx=4,oU=1,ZJe=2,lre=3,XJe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,$Je=/[\x85\u2028\u2029]/,eze=/[,\[\]\{\}]/,yre=/^(?:!|!!|![a-z\-]+!)$/i,Ere=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function cre(t){return Object.prototype.toString.call(t)}function qf(t){return t===10||t===13}function Td(t){return t===9||t===32}function nl(t){return t===9||t===32||t===10||t===13}function dE(t){return t===44||t===91||t===93||t===123||t===125}function tze(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function rze(t){return t===120?2:t===117?4:t===85?8:0}function nze(t){return 48<=t&&t<=57?t-48:-1}function ure(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?` +`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"\x85":t===95?"\xA0":t===76?"\u2028":t===80?"\u2029":""}function ize(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}var Ire=new Array(256),Cre=new Array(256);for(Qd=0;Qd<256;Qd++)Ire[Qd]=ure(Qd)?1:0,Cre[Qd]=ure(Qd);var Qd;function sze(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||zJe,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function wre(t,e){return new hre(e,new JJe(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function Rr(t,e){throw wre(t,e)}function Fx(t,e){t.onWarning&&t.onWarning.call(null,wre(t,e))}var fre={YAML:function(e,r,s){var a,n,c;e.version!==null&&Rr(e,"duplication of %YAML directive"),s.length!==1&&Rr(e,"YAML directive accepts exactly one argument"),a=/^([0-9]+)\.([0-9]+)$/.exec(s[0]),a===null&&Rr(e,"ill-formed argument of the YAML directive"),n=parseInt(a[1],10),c=parseInt(a[2],10),n!==1&&Rr(e,"unacceptable YAML version of the document"),e.version=s[0],e.checkLineBreaks=c<2,c!==1&&c!==2&&Fx(e,"unsupported YAML version of the document")},TAG:function(e,r,s){var a,n;s.length!==2&&Rr(e,"TAG directive accepts exactly two arguments"),a=s[0],n=s[1],yre.test(a)||Rr(e,"ill-formed tag handle (first argument) of the TAG directive"),a0.call(e.tagMap,a)&&Rr(e,'there is a previously declared suffix for "'+a+'" tag handle'),Ere.test(n)||Rr(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[a]=n}};function o0(t,e,r,s){var a,n,c,f;if(e1&&(t.result+=wp.repeat(` +`,e-1))}function oze(t,e,r){var s,a,n,c,f,p,h,E,C=t.kind,S=t.result,P;if(P=t.input.charCodeAt(t.position),nl(P)||dE(P)||P===35||P===38||P===42||P===33||P===124||P===62||P===39||P===34||P===37||P===64||P===96||(P===63||P===45)&&(a=t.input.charCodeAt(t.position+1),nl(a)||r&&dE(a)))return!1;for(t.kind="scalar",t.result="",n=c=t.position,f=!1;P!==0;){if(P===58){if(a=t.input.charCodeAt(t.position+1),nl(a)||r&&dE(a))break}else if(P===35){if(s=t.input.charCodeAt(t.position-1),nl(s))break}else{if(t.position===t.lineStart&&Nx(t)||r&&dE(P))break;if(qf(P))if(p=t.line,h=t.lineStart,E=t.lineIndent,as(t,!1,-1),t.lineIndent>=e){f=!0,P=t.input.charCodeAt(t.position);continue}else{t.position=c,t.line=p,t.lineStart=h,t.lineIndent=E;break}}f&&(o0(t,n,c,!1),lU(t,t.line-p),n=c=t.position,f=!1),Td(P)||(c=t.position+1),P=t.input.charCodeAt(++t.position)}return o0(t,n,c,!1),t.result?!0:(t.kind=C,t.result=S,!1)}function aze(t,e){var r,s,a;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,s=a=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(o0(t,s,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)s=t.position,t.position++,a=t.position;else return!0;else qf(r)?(o0(t,s,a,!0),lU(t,as(t,!1,e)),s=a=t.position):t.position===t.lineStart&&Nx(t)?Rr(t,"unexpected end of the document within a single quoted scalar"):(t.position++,a=t.position);Rr(t,"unexpected end of the stream within a single quoted scalar")}function lze(t,e){var r,s,a,n,c,f;if(f=t.input.charCodeAt(t.position),f!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=s=t.position;(f=t.input.charCodeAt(t.position))!==0;){if(f===34)return o0(t,r,t.position,!0),t.position++,!0;if(f===92){if(o0(t,r,t.position,!0),f=t.input.charCodeAt(++t.position),qf(f))as(t,!1,e);else if(f<256&&Ire[f])t.result+=Cre[f],t.position++;else if((c=rze(f))>0){for(a=c,n=0;a>0;a--)f=t.input.charCodeAt(++t.position),(c=tze(f))>=0?n=(n<<4)+c:Rr(t,"expected hexadecimal character");t.result+=ize(n),t.position++}else Rr(t,"unknown escape sequence");r=s=t.position}else qf(f)?(o0(t,r,s,!0),lU(t,as(t,!1,e)),r=s=t.position):t.position===t.lineStart&&Nx(t)?Rr(t,"unexpected end of the document within a double quoted scalar"):(t.position++,s=t.position)}Rr(t,"unexpected end of the stream within a double quoted scalar")}function cze(t,e){var r=!0,s,a=t.tag,n,c=t.anchor,f,p,h,E,C,S={},P,I,R,N;if(N=t.input.charCodeAt(t.position),N===91)p=93,C=!1,n=[];else if(N===123)p=125,C=!0,n={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=n),N=t.input.charCodeAt(++t.position);N!==0;){if(as(t,!0,e),N=t.input.charCodeAt(t.position),N===p)return t.position++,t.tag=a,t.anchor=c,t.kind=C?"mapping":"sequence",t.result=n,!0;r||Rr(t,"missed comma between flow collection entries"),I=P=R=null,h=E=!1,N===63&&(f=t.input.charCodeAt(t.position+1),nl(f)&&(h=E=!0,t.position++,as(t,!0,e))),s=t.line,yE(t,e,Tx,!1,!0),I=t.tag,P=t.result,as(t,!0,e),N=t.input.charCodeAt(t.position),(E||t.line===s)&&N===58&&(h=!0,N=t.input.charCodeAt(++t.position),as(t,!0,e),yE(t,e,Tx,!1,!0),R=t.result),C?mE(t,n,S,I,P,R):h?n.push(mE(t,null,S,I,P,R)):n.push(P),as(t,!0,e),N=t.input.charCodeAt(t.position),N===44?(r=!0,N=t.input.charCodeAt(++t.position)):r=!1}Rr(t,"unexpected end of the stream within a flow collection")}function uze(t,e){var r,s,a=oU,n=!1,c=!1,f=e,p=0,h=!1,E,C;if(C=t.input.charCodeAt(t.position),C===124)s=!1;else if(C===62)s=!0;else return!1;for(t.kind="scalar",t.result="";C!==0;)if(C=t.input.charCodeAt(++t.position),C===43||C===45)oU===a?a=C===43?lre:ZJe:Rr(t,"repeat of a chomping mode identifier");else if((E=nze(C))>=0)E===0?Rr(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?Rr(t,"repeat of an indentation width identifier"):(f=e+E-1,c=!0);else break;if(Td(C)){do C=t.input.charCodeAt(++t.position);while(Td(C));if(C===35)do C=t.input.charCodeAt(++t.position);while(!qf(C)&&C!==0)}for(;C!==0;){for(aU(t),t.lineIndent=0,C=t.input.charCodeAt(t.position);(!c||t.lineIndentf&&(f=t.lineIndent),qf(C)){p++;continue}if(t.lineIndente)&&p!==0)Rr(t,"bad indentation of a sequence entry");else if(t.lineIndente)&&(yE(t,e,Rx,!0,a)&&(I?S=t.result:P=t.result),I||(mE(t,h,E,C,S,P,n,c),C=S=P=null),as(t,!0,-1),N=t.input.charCodeAt(t.position)),t.lineIndent>e&&N!==0)Rr(t,"bad indentation of a mapping entry");else if(t.lineIndente?p=1:t.lineIndent===e?p=0:t.lineIndente?p=1:t.lineIndent===e?p=0:t.lineIndent tag; it should be "scalar", not "'+t.kind+'"'),C=0,S=t.implicitTypes.length;C tag; it should be "'+P.kind+'", not "'+t.kind+'"'),P.resolve(t.result)?(t.result=P.construct(t.result),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):Rr(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):Rr(t,"unknown tag !<"+t.tag+">");return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||E}function gze(t){var e=t.position,r,s,a,n=!1,c;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};(c=t.input.charCodeAt(t.position))!==0&&(as(t,!0,-1),c=t.input.charCodeAt(t.position),!(t.lineIndent>0||c!==37));){for(n=!0,c=t.input.charCodeAt(++t.position),r=t.position;c!==0&&!nl(c);)c=t.input.charCodeAt(++t.position);for(s=t.input.slice(r,t.position),a=[],s.length<1&&Rr(t,"directive name must not be less than one character in length");c!==0;){for(;Td(c);)c=t.input.charCodeAt(++t.position);if(c===35){do c=t.input.charCodeAt(++t.position);while(c!==0&&!qf(c));break}if(qf(c))break;for(r=t.position;c!==0&&!nl(c);)c=t.input.charCodeAt(++t.position);a.push(t.input.slice(r,t.position))}c!==0&&aU(t),a0.call(fre,s)?fre[s](t,s,a):Fx(t,'unknown document directive "'+s+'"')}if(as(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,as(t,!0,-1)):n&&Rr(t,"directives end mark is expected"),yE(t,t.lineIndent-1,Rx,!1,!0),as(t,!0,-1),t.checkLineBreaks&&$Je.test(t.input.slice(e,t.position))&&Fx(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&Nx(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,as(t,!0,-1));return}if(t.position"u"&&(r=e,e=null);var s=Bre(t,r);if(typeof e!="function")return s;for(var a=0,n=s.length;a"u"&&(r=e,e=null),vre(t,e,wp.extend({schema:gre},r))}function mze(t,e){return Sre(t,wp.extend({schema:gre},e))}V2.exports.loadAll=vre;V2.exports.load=Sre;V2.exports.safeLoadAll=dze;V2.exports.safeLoad=mze});var Jre=L((m9t,AU)=>{"use strict";var J2=Pd(),z2=pE(),yze=Y2(),Eze=gE(),Fre=Object.prototype.toString,Nre=Object.prototype.hasOwnProperty,Ize=9,K2=10,Cze=13,wze=32,Bze=33,vze=34,Ore=35,Sze=37,Dze=38,bze=39,Pze=42,Lre=44,xze=45,Mre=58,kze=61,Qze=62,Tze=63,Rze=64,_re=91,Ure=93,Fze=96,Hre=123,Nze=124,jre=125,jo={};jo[0]="\\0";jo[7]="\\a";jo[8]="\\b";jo[9]="\\t";jo[10]="\\n";jo[11]="\\v";jo[12]="\\f";jo[13]="\\r";jo[27]="\\e";jo[34]='\\"';jo[92]="\\\\";jo[133]="\\N";jo[160]="\\_";jo[8232]="\\L";jo[8233]="\\P";var Oze=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function Lze(t,e){var r,s,a,n,c,f,p;if(e===null)return{};for(r={},s=Object.keys(e),a=0,n=s.length;a0?t.charCodeAt(n-1):null,S=S&&xre(c,f)}else{for(n=0;ns&&t[C+1]!==" ",C=n);else if(!EE(c))return Ox;f=n>0?t.charCodeAt(n-1):null,S=S&&xre(c,f)}h=h||E&&n-C-1>s&&t[C+1]!==" "}return!p&&!h?S&&!a(t)?Gre:Wre:r>9&&qre(t)?Ox:h?Vre:Yre}function qze(t,e,r,s){t.dump=function(){if(e.length===0)return"''";if(!t.noCompatMode&&Oze.indexOf(e)!==-1)return"'"+e+"'";var a=t.indent*Math.max(1,r),n=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),c=s||t.flowLevel>-1&&r>=t.flowLevel;function f(p){return _ze(t,p)}switch(jze(e,c,t.indent,n,f)){case Gre:return e;case Wre:return"'"+e.replace(/'/g,"''")+"'";case Yre:return"|"+kre(e,t.indent)+Qre(Pre(e,a));case Vre:return">"+kre(e,t.indent)+Qre(Pre(Gze(e,n),a));case Ox:return'"'+Wze(e,n)+'"';default:throw new z2("impossible error: invalid scalar style")}}()}function kre(t,e){var r=qre(t)?String(e):"",s=t[t.length-1]===` +`,a=s&&(t[t.length-2]===` +`||t===` +`),n=a?"+":s?"":"-";return r+n+` +`}function Qre(t){return t[t.length-1]===` +`?t.slice(0,-1):t}function Gze(t,e){for(var r=/(\n+)([^\n]*)/g,s=function(){var h=t.indexOf(` +`);return h=h!==-1?h:t.length,r.lastIndex=h,Tre(t.slice(0,h),e)}(),a=t[0]===` +`||t[0]===" ",n,c;c=r.exec(t);){var f=c[1],p=c[2];n=p[0]===" ",s+=f+(!a&&!n&&p!==""?` +`:"")+Tre(p,e),a=n}return s}function Tre(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,s,a=0,n,c=0,f=0,p="";s=r.exec(t);)f=s.index,f-a>e&&(n=c>a?c:f,p+=` +`+t.slice(a,n),a=n+1),c=f;return p+=` +`,t.length-a>e&&c>a?p+=t.slice(a,c)+` +`+t.slice(c+1):p+=t.slice(a),p.slice(1)}function Wze(t){for(var e="",r,s,a,n=0;n=55296&&r<=56319&&(s=t.charCodeAt(n+1),s>=56320&&s<=57343)){e+=bre((r-55296)*1024+s-56320+65536),n++;continue}a=jo[r],e+=!a&&EE(r)?t[n]:a||bre(r)}return e}function Yze(t,e,r){var s="",a=t.tag,n,c;for(n=0,c=r.length;n1024&&(E+="? "),E+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Rd(t,e,h,!1,!1)&&(E+=t.dump,s+=E));t.tag=a,t.dump="{"+s+"}"}function Jze(t,e,r,s){var a="",n=t.tag,c=Object.keys(r),f,p,h,E,C,S;if(t.sortKeys===!0)c.sort();else if(typeof t.sortKeys=="function")c.sort(t.sortKeys);else if(t.sortKeys)throw new z2("sortKeys must be a boolean or a function");for(f=0,p=c.length;f1024,C&&(t.dump&&K2===t.dump.charCodeAt(0)?S+="?":S+="? "),S+=t.dump,C&&(S+=cU(t,e)),Rd(t,e+1,E,!0,C)&&(t.dump&&K2===t.dump.charCodeAt(0)?S+=":":S+=": ",S+=t.dump,a+=S));t.tag=n,t.dump=a||"{}"}function Rre(t,e,r){var s,a,n,c,f,p;for(a=r?t.explicitTypes:t.implicitTypes,n=0,c=a.length;n tag resolver accepts not "'+p+'" style');t.dump=s}return!0}return!1}function Rd(t,e,r,s,a,n){t.tag=null,t.dump=r,Rre(t,r,!1)||Rre(t,r,!0);var c=Fre.call(t.dump);s&&(s=t.flowLevel<0||t.flowLevel>e);var f=c==="[object Object]"||c==="[object Array]",p,h;if(f&&(p=t.duplicates.indexOf(r),h=p!==-1),(t.tag!==null&&t.tag!=="?"||h||t.indent!==2&&e>0)&&(a=!1),h&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(f&&h&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),c==="[object Object]")s&&Object.keys(t.dump).length!==0?(Jze(t,e,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(Kze(t,e,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump));else if(c==="[object Array]"){var E=t.noArrayIndent&&e>0?e-1:e;s&&t.dump.length!==0?(Vze(t,E,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(Yze(t,E,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump))}else if(c==="[object String]")t.tag!=="?"&&qze(t,t.dump,e,n);else{if(t.skipInvalid)return!1;throw new z2("unacceptable kind of an object to dump "+c)}t.tag!==null&&t.tag!=="?"&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function zze(t,e){var r=[],s=[],a,n;for(uU(t,r,s),a=0,n=s.length;a{"use strict";var Lx=Dre(),zre=Jre();function Mx(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}Gi.exports.Type=Ds();Gi.exports.Schema=xd();Gi.exports.FAILSAFE_SCHEMA=kx();Gi.exports.JSON_SCHEMA=nU();Gi.exports.CORE_SCHEMA=iU();Gi.exports.DEFAULT_SAFE_SCHEMA=gE();Gi.exports.DEFAULT_FULL_SCHEMA=Y2();Gi.exports.load=Lx.load;Gi.exports.loadAll=Lx.loadAll;Gi.exports.safeLoad=Lx.safeLoad;Gi.exports.safeLoadAll=Lx.safeLoadAll;Gi.exports.dump=zre.dump;Gi.exports.safeDump=zre.safeDump;Gi.exports.YAMLException=pE();Gi.exports.MINIMAL_SCHEMA=kx();Gi.exports.SAFE_SCHEMA=gE();Gi.exports.DEFAULT_SCHEMA=Y2();Gi.exports.scan=Mx("scan");Gi.exports.parse=Mx("parse");Gi.exports.compose=Mx("compose");Gi.exports.addConstructor=Mx("addConstructor")});var $re=L((E9t,Xre)=>{"use strict";var Xze=Zre();Xre.exports=Xze});var tne=L((I9t,ene)=>{"use strict";function $ze(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Fd(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Fd)}$ze(Fd,Error);Fd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",C;for(C=0;C0){for(C=1,S=1;C({[ht]:Oe})))},Ae=function(ee){return ee},ce=function(ee){return ee},me=La("correct indentation"),pe=" ",Be=dn(" ",!1),Ce=function(ee){return ee.length===lr*St},g=function(ee){return ee.length===(lr+1)*St},we=function(){return lr++,!0},Ee=function(){return lr--,!0},fe=function(){return ca()},se=La("pseudostring"),X=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,De=Jn(["\r",` +`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),Re=/^[^\r\n\t ,\][{}:#"']/,gt=Jn(["\r",` +`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),j=function(){return ca().replace(/^ *| *$/g,"")},rt="--",Fe=dn("--",!1),Ne=/^[a-zA-Z\/0-9]/,Pe=Jn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),Ye=/^[^\r\n\t :,]/,ke=Jn(["\r",` +`," "," ",":",","],!0,!1),it="null",_e=dn("null",!1),x=function(){return null},w="true",b=dn("true",!1),y=function(){return!0},F="false",z=dn("false",!1),Z=function(){return!1},$=La("string"),oe='"',xe=dn('"',!1),Te=function(){return""},lt=function(ee){return ee},Et=function(ee){return ee.join("")},qt=/^[^"\\\0-\x1F\x7F]/,ir=Jn(['"',"\\",["\0",""],"\x7F"],!0,!1),Pt='\\"',gn=dn('\\"',!1),Pr=function(){return'"'},Ir="\\\\",Nr=dn("\\\\",!1),nn=function(){return"\\"},oi="\\/",wo=dn("\\/",!1),rs=function(){return"/"},eo="\\b",Bo=dn("\\b",!1),Hi=function(){return"\b"},to="\\f",vo=dn("\\f",!1),RA=function(){return"\f"},pf="\\n",Eh=dn("\\n",!1),Ih=function(){return` +`},ro="\\r",jn=dn("\\r",!1),Rs=function(){return"\r"},no="\\t",lu=dn("\\t",!1),cu=function(){return" "},uu="\\u",FA=dn("\\u",!1),NA=function(ee,Ie,Oe,ht){return String.fromCharCode(parseInt(`0x${ee}${Ie}${Oe}${ht}`))},aa=/^[0-9a-fA-F]/,la=Jn([["0","9"],["a","f"],["A","F"]],!1,!1),OA=La("blank space"),gr=/^[ \t]/,So=Jn([" "," "],!1,!1),Me=La("white space"),fu=/^[ \t\n\r]/,Cr=Jn([" "," ",` +`,"\r"],!1,!1),hf=`\r +`,LA=dn(`\r +`,!1),MA=` +`,Au=dn(` +`,!1),pu="\r",ac=dn("\r",!1),ve=0,Nt=0,lc=[{line:1,column:1}],Ni=0,io=[],Rt=0,xn;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function ca(){return t.substring(Nt,ve)}function ji(){return Ua(Nt,ve)}function Oi(ee,Ie){throw Ie=Ie!==void 0?Ie:Ua(Nt,ve),gf([La(ee)],t.substring(Nt,ve),Ie)}function Oa(ee,Ie){throw Ie=Ie!==void 0?Ie:Ua(Nt,ve),Ha(ee,Ie)}function dn(ee,Ie){return{type:"literal",text:ee,ignoreCase:Ie}}function Jn(ee,Ie,Oe){return{type:"class",parts:ee,inverted:Ie,ignoreCase:Oe}}function hu(){return{type:"any"}}function Ch(){return{type:"end"}}function La(ee){return{type:"other",description:ee}}function Ma(ee){var Ie=lc[ee],Oe;if(Ie)return Ie;for(Oe=ee-1;!lc[Oe];)Oe--;for(Ie=lc[Oe],Ie={line:Ie.line,column:Ie.column};OeNi&&(Ni=ve,io=[]),io.push(ee))}function Ha(ee,Ie){return new Fd(ee,null,null,Ie)}function gf(ee,Ie,Oe){return new Fd(Fd.buildMessage(ee,Ie),ee,Ie,Oe)}function cc(){var ee;return ee=_A(),ee}function wn(){var ee,Ie,Oe;for(ee=ve,Ie=[],Oe=ua();Oe!==r;)Ie.push(Oe),Oe=ua();return Ie!==r&&(Nt=ee,Ie=n(Ie)),ee=Ie,ee}function ua(){var ee,Ie,Oe,ht,mt;return ee=ve,Ie=vl(),Ie!==r?(t.charCodeAt(ve)===45?(Oe=c,ve++):(Oe=r,Rt===0&&Xe(f)),Oe!==r?(ht=Qn(),ht!==r?(mt=fa(),mt!==r?(Nt=ee,Ie=p(mt),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r),ee}function _A(){var ee,Ie,Oe;for(ee=ve,Ie=[],Oe=UA();Oe!==r;)Ie.push(Oe),Oe=UA();return Ie!==r&&(Nt=ee,Ie=h(Ie)),ee=Ie,ee}function UA(){var ee,Ie,Oe,ht,mt,Dt,tr,fn,ai;if(ee=ve,Ie=Qn(),Ie===r&&(Ie=null),Ie!==r){if(Oe=ve,t.charCodeAt(ve)===35?(ht=E,ve++):(ht=r,Rt===0&&Xe(C)),ht!==r){if(mt=[],Dt=ve,tr=ve,Rt++,fn=st(),Rt--,fn===r?tr=void 0:(ve=tr,tr=r),tr!==r?(t.length>ve?(fn=t.charAt(ve),ve++):(fn=r,Rt===0&&Xe(S)),fn!==r?(tr=[tr,fn],Dt=tr):(ve=Dt,Dt=r)):(ve=Dt,Dt=r),Dt!==r)for(;Dt!==r;)mt.push(Dt),Dt=ve,tr=ve,Rt++,fn=st(),Rt--,fn===r?tr=void 0:(ve=tr,tr=r),tr!==r?(t.length>ve?(fn=t.charAt(ve),ve++):(fn=r,Rt===0&&Xe(S)),fn!==r?(tr=[tr,fn],Dt=tr):(ve=Dt,Dt=r)):(ve=Dt,Dt=r);else mt=r;mt!==r?(ht=[ht,mt],Oe=ht):(ve=Oe,Oe=r)}else ve=Oe,Oe=r;if(Oe===r&&(Oe=null),Oe!==r){if(ht=[],mt=Je(),mt!==r)for(;mt!==r;)ht.push(mt),mt=Je();else ht=r;ht!==r?(Nt=ee,Ie=P(),ee=Ie):(ve=ee,ee=r)}else ve=ee,ee=r}else ve=ee,ee=r;if(ee===r&&(ee=ve,Ie=vl(),Ie!==r?(Oe=ja(),Oe!==r?(ht=Qn(),ht===r&&(ht=null),ht!==r?(t.charCodeAt(ve)===58?(mt=I,ve++):(mt=r,Rt===0&&Xe(R)),mt!==r?(Dt=Qn(),Dt===r&&(Dt=null),Dt!==r?(tr=fa(),tr!==r?(Nt=ee,Ie=N(Oe,tr),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r),ee===r&&(ee=ve,Ie=vl(),Ie!==r?(Oe=ns(),Oe!==r?(ht=Qn(),ht===r&&(ht=null),ht!==r?(t.charCodeAt(ve)===58?(mt=I,ve++):(mt=r,Rt===0&&Xe(R)),mt!==r?(Dt=Qn(),Dt===r&&(Dt=null),Dt!==r?(tr=fa(),tr!==r?(Nt=ee,Ie=N(Oe,tr),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r),ee===r))){if(ee=ve,Ie=vl(),Ie!==r)if(Oe=ns(),Oe!==r)if(ht=Qn(),ht!==r)if(mt=gu(),mt!==r){if(Dt=[],tr=Je(),tr!==r)for(;tr!==r;)Dt.push(tr),tr=Je();else Dt=r;Dt!==r?(Nt=ee,Ie=N(Oe,mt),ee=Ie):(ve=ee,ee=r)}else ve=ee,ee=r;else ve=ee,ee=r;else ve=ee,ee=r;else ve=ee,ee=r;if(ee===r)if(ee=ve,Ie=vl(),Ie!==r)if(Oe=ns(),Oe!==r){if(ht=[],mt=ve,Dt=Qn(),Dt===r&&(Dt=null),Dt!==r?(t.charCodeAt(ve)===44?(tr=U,ve++):(tr=r,Rt===0&&Xe(W)),tr!==r?(fn=Qn(),fn===r&&(fn=null),fn!==r?(ai=ns(),ai!==r?(Nt=mt,Dt=te(Oe,ai),mt=Dt):(ve=mt,mt=r)):(ve=mt,mt=r)):(ve=mt,mt=r)):(ve=mt,mt=r),mt!==r)for(;mt!==r;)ht.push(mt),mt=ve,Dt=Qn(),Dt===r&&(Dt=null),Dt!==r?(t.charCodeAt(ve)===44?(tr=U,ve++):(tr=r,Rt===0&&Xe(W)),tr!==r?(fn=Qn(),fn===r&&(fn=null),fn!==r?(ai=ns(),ai!==r?(Nt=mt,Dt=te(Oe,ai),mt=Dt):(ve=mt,mt=r)):(ve=mt,mt=r)):(ve=mt,mt=r)):(ve=mt,mt=r);else ht=r;ht!==r?(mt=Qn(),mt===r&&(mt=null),mt!==r?(t.charCodeAt(ve)===58?(Dt=I,ve++):(Dt=r,Rt===0&&Xe(R)),Dt!==r?(tr=Qn(),tr===r&&(tr=null),tr!==r?(fn=fa(),fn!==r?(Nt=ee,Ie=ie(Oe,ht,fn),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)}else ve=ee,ee=r;else ve=ee,ee=r}return ee}function fa(){var ee,Ie,Oe,ht,mt,Dt,tr;if(ee=ve,Ie=ve,Rt++,Oe=ve,ht=st(),ht!==r?(mt=Mt(),mt!==r?(t.charCodeAt(ve)===45?(Dt=c,ve++):(Dt=r,Rt===0&&Xe(f)),Dt!==r?(tr=Qn(),tr!==r?(ht=[ht,mt,Dt,tr],Oe=ht):(ve=Oe,Oe=r)):(ve=Oe,Oe=r)):(ve=Oe,Oe=r)):(ve=Oe,Oe=r),Rt--,Oe!==r?(ve=Ie,Ie=void 0):Ie=r,Ie!==r?(Oe=Je(),Oe!==r?(ht=kn(),ht!==r?(mt=wn(),mt!==r?(Dt=Aa(),Dt!==r?(Nt=ee,Ie=Ae(mt),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r),ee===r&&(ee=ve,Ie=st(),Ie!==r?(Oe=kn(),Oe!==r?(ht=_A(),ht!==r?(mt=Aa(),mt!==r?(Nt=ee,Ie=Ae(ht),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r),ee===r))if(ee=ve,Ie=uc(),Ie!==r){if(Oe=[],ht=Je(),ht!==r)for(;ht!==r;)Oe.push(ht),ht=Je();else Oe=r;Oe!==r?(Nt=ee,Ie=ce(Ie),ee=Ie):(ve=ee,ee=r)}else ve=ee,ee=r;return ee}function vl(){var ee,Ie,Oe;for(Rt++,ee=ve,Ie=[],t.charCodeAt(ve)===32?(Oe=pe,ve++):(Oe=r,Rt===0&&Xe(Be));Oe!==r;)Ie.push(Oe),t.charCodeAt(ve)===32?(Oe=pe,ve++):(Oe=r,Rt===0&&Xe(Be));return Ie!==r?(Nt=ve,Oe=Ce(Ie),Oe?Oe=void 0:Oe=r,Oe!==r?(Ie=[Ie,Oe],ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r),Rt--,ee===r&&(Ie=r,Rt===0&&Xe(me)),ee}function Mt(){var ee,Ie,Oe;for(ee=ve,Ie=[],t.charCodeAt(ve)===32?(Oe=pe,ve++):(Oe=r,Rt===0&&Xe(Be));Oe!==r;)Ie.push(Oe),t.charCodeAt(ve)===32?(Oe=pe,ve++):(Oe=r,Rt===0&&Xe(Be));return Ie!==r?(Nt=ve,Oe=g(Ie),Oe?Oe=void 0:Oe=r,Oe!==r?(Ie=[Ie,Oe],ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r),ee}function kn(){var ee;return Nt=ve,ee=we(),ee?ee=void 0:ee=r,ee}function Aa(){var ee;return Nt=ve,ee=Ee(),ee?ee=void 0:ee=r,ee}function ja(){var ee;return ee=Sl(),ee===r&&(ee=fc()),ee}function ns(){var ee,Ie,Oe;if(ee=Sl(),ee===r){if(ee=ve,Ie=[],Oe=qa(),Oe!==r)for(;Oe!==r;)Ie.push(Oe),Oe=qa();else Ie=r;Ie!==r&&(Nt=ee,Ie=fe()),ee=Ie}return ee}function uc(){var ee;return ee=Li(),ee===r&&(ee=Cs(),ee===r&&(ee=Sl(),ee===r&&(ee=fc()))),ee}function gu(){var ee;return ee=Li(),ee===r&&(ee=Sl(),ee===r&&(ee=qa())),ee}function fc(){var ee,Ie,Oe,ht,mt,Dt;if(Rt++,ee=ve,X.test(t.charAt(ve))?(Ie=t.charAt(ve),ve++):(Ie=r,Rt===0&&Xe(De)),Ie!==r){for(Oe=[],ht=ve,mt=Qn(),mt===r&&(mt=null),mt!==r?(Re.test(t.charAt(ve))?(Dt=t.charAt(ve),ve++):(Dt=r,Rt===0&&Xe(gt)),Dt!==r?(mt=[mt,Dt],ht=mt):(ve=ht,ht=r)):(ve=ht,ht=r);ht!==r;)Oe.push(ht),ht=ve,mt=Qn(),mt===r&&(mt=null),mt!==r?(Re.test(t.charAt(ve))?(Dt=t.charAt(ve),ve++):(Dt=r,Rt===0&&Xe(gt)),Dt!==r?(mt=[mt,Dt],ht=mt):(ve=ht,ht=r)):(ve=ht,ht=r);Oe!==r?(Nt=ee,Ie=j(),ee=Ie):(ve=ee,ee=r)}else ve=ee,ee=r;return Rt--,ee===r&&(Ie=r,Rt===0&&Xe(se)),ee}function qa(){var ee,Ie,Oe,ht,mt;if(ee=ve,t.substr(ve,2)===rt?(Ie=rt,ve+=2):(Ie=r,Rt===0&&Xe(Fe)),Ie===r&&(Ie=null),Ie!==r)if(Ne.test(t.charAt(ve))?(Oe=t.charAt(ve),ve++):(Oe=r,Rt===0&&Xe(Pe)),Oe!==r){for(ht=[],Ye.test(t.charAt(ve))?(mt=t.charAt(ve),ve++):(mt=r,Rt===0&&Xe(ke));mt!==r;)ht.push(mt),Ye.test(t.charAt(ve))?(mt=t.charAt(ve),ve++):(mt=r,Rt===0&&Xe(ke));ht!==r?(Nt=ee,Ie=j(),ee=Ie):(ve=ee,ee=r)}else ve=ee,ee=r;else ve=ee,ee=r;return ee}function Li(){var ee,Ie;return ee=ve,t.substr(ve,4)===it?(Ie=it,ve+=4):(Ie=r,Rt===0&&Xe(_e)),Ie!==r&&(Nt=ee,Ie=x()),ee=Ie,ee}function Cs(){var ee,Ie;return ee=ve,t.substr(ve,4)===w?(Ie=w,ve+=4):(Ie=r,Rt===0&&Xe(b)),Ie!==r&&(Nt=ee,Ie=y()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,5)===F?(Ie=F,ve+=5):(Ie=r,Rt===0&&Xe(z)),Ie!==r&&(Nt=ee,Ie=Z()),ee=Ie),ee}function Sl(){var ee,Ie,Oe,ht;return Rt++,ee=ve,t.charCodeAt(ve)===34?(Ie=oe,ve++):(Ie=r,Rt===0&&Xe(xe)),Ie!==r?(t.charCodeAt(ve)===34?(Oe=oe,ve++):(Oe=r,Rt===0&&Xe(xe)),Oe!==r?(Nt=ee,Ie=Te(),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r),ee===r&&(ee=ve,t.charCodeAt(ve)===34?(Ie=oe,ve++):(Ie=r,Rt===0&&Xe(xe)),Ie!==r?(Oe=df(),Oe!==r?(t.charCodeAt(ve)===34?(ht=oe,ve++):(ht=r,Rt===0&&Xe(xe)),ht!==r?(Nt=ee,Ie=lt(Oe),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)),Rt--,ee===r&&(Ie=r,Rt===0&&Xe($)),ee}function df(){var ee,Ie,Oe;if(ee=ve,Ie=[],Oe=Ac(),Oe!==r)for(;Oe!==r;)Ie.push(Oe),Oe=Ac();else Ie=r;return Ie!==r&&(Nt=ee,Ie=Et(Ie)),ee=Ie,ee}function Ac(){var ee,Ie,Oe,ht,mt,Dt;return qt.test(t.charAt(ve))?(ee=t.charAt(ve),ve++):(ee=r,Rt===0&&Xe(ir)),ee===r&&(ee=ve,t.substr(ve,2)===Pt?(Ie=Pt,ve+=2):(Ie=r,Rt===0&&Xe(gn)),Ie!==r&&(Nt=ee,Ie=Pr()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===Ir?(Ie=Ir,ve+=2):(Ie=r,Rt===0&&Xe(Nr)),Ie!==r&&(Nt=ee,Ie=nn()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===oi?(Ie=oi,ve+=2):(Ie=r,Rt===0&&Xe(wo)),Ie!==r&&(Nt=ee,Ie=rs()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===eo?(Ie=eo,ve+=2):(Ie=r,Rt===0&&Xe(Bo)),Ie!==r&&(Nt=ee,Ie=Hi()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===to?(Ie=to,ve+=2):(Ie=r,Rt===0&&Xe(vo)),Ie!==r&&(Nt=ee,Ie=RA()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===pf?(Ie=pf,ve+=2):(Ie=r,Rt===0&&Xe(Eh)),Ie!==r&&(Nt=ee,Ie=Ih()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===ro?(Ie=ro,ve+=2):(Ie=r,Rt===0&&Xe(jn)),Ie!==r&&(Nt=ee,Ie=Rs()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===no?(Ie=no,ve+=2):(Ie=r,Rt===0&&Xe(lu)),Ie!==r&&(Nt=ee,Ie=cu()),ee=Ie,ee===r&&(ee=ve,t.substr(ve,2)===uu?(Ie=uu,ve+=2):(Ie=r,Rt===0&&Xe(FA)),Ie!==r?(Oe=wi(),Oe!==r?(ht=wi(),ht!==r?(mt=wi(),mt!==r?(Dt=wi(),Dt!==r?(Nt=ee,Ie=NA(Oe,ht,mt,Dt),ee=Ie):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)):(ve=ee,ee=r)))))))))),ee}function wi(){var ee;return aa.test(t.charAt(ve))?(ee=t.charAt(ve),ve++):(ee=r,Rt===0&&Xe(la)),ee}function Qn(){var ee,Ie;if(Rt++,ee=[],gr.test(t.charAt(ve))?(Ie=t.charAt(ve),ve++):(Ie=r,Rt===0&&Xe(So)),Ie!==r)for(;Ie!==r;)ee.push(Ie),gr.test(t.charAt(ve))?(Ie=t.charAt(ve),ve++):(Ie=r,Rt===0&&Xe(So));else ee=r;return Rt--,ee===r&&(Ie=r,Rt===0&&Xe(OA)),ee}function pc(){var ee,Ie;if(Rt++,ee=[],fu.test(t.charAt(ve))?(Ie=t.charAt(ve),ve++):(Ie=r,Rt===0&&Xe(Cr)),Ie!==r)for(;Ie!==r;)ee.push(Ie),fu.test(t.charAt(ve))?(Ie=t.charAt(ve),ve++):(Ie=r,Rt===0&&Xe(Cr));else ee=r;return Rt--,ee===r&&(Ie=r,Rt===0&&Xe(Me)),ee}function Je(){var ee,Ie,Oe,ht,mt,Dt;if(ee=ve,Ie=st(),Ie!==r){for(Oe=[],ht=ve,mt=Qn(),mt===r&&(mt=null),mt!==r?(Dt=st(),Dt!==r?(mt=[mt,Dt],ht=mt):(ve=ht,ht=r)):(ve=ht,ht=r);ht!==r;)Oe.push(ht),ht=ve,mt=Qn(),mt===r&&(mt=null),mt!==r?(Dt=st(),Dt!==r?(mt=[mt,Dt],ht=mt):(ve=ht,ht=r)):(ve=ht,ht=r);Oe!==r?(Ie=[Ie,Oe],ee=Ie):(ve=ee,ee=r)}else ve=ee,ee=r;return ee}function st(){var ee;return t.substr(ve,2)===hf?(ee=hf,ve+=2):(ee=r,Rt===0&&Xe(LA)),ee===r&&(t.charCodeAt(ve)===10?(ee=MA,ve++):(ee=r,Rt===0&&Xe(Au)),ee===r&&(t.charCodeAt(ve)===13?(ee=pu,ve++):(ee=r,Rt===0&&Xe(ac)))),ee}let St=2,lr=0;if(xn=a(),xn!==r&&ve===t.length)return xn;throw xn!==r&&ve"u"?!0:typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.keys(t).every(e=>sne(t[e])):!1}function pU(t,e,r){if(t===null)return`null +`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()} +`;if(typeof t=="string")return`${nne(t)} +`;if(Array.isArray(t)){if(t.length===0)return`[] +`;let s=" ".repeat(e);return` +${t.map(n=>`${s}- ${pU(n,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let[s,a]=t instanceof _x?[t.data,!1]:[t,!0],n=" ".repeat(e),c=Object.keys(s);a&&c.sort((p,h)=>{let E=rne.indexOf(p),C=rne.indexOf(h);return E===-1&&C===-1?ph?1:0:E!==-1&&C===-1?-1:E===-1&&C!==-1?1:E-C});let f=c.filter(p=>!sne(s[p])).map((p,h)=>{let E=s[p],C=nne(p),S=pU(E,e+1,!0),P=h>0||r?n:"",I=C.length>1024?`? ${C} +${P}:`:`${C}:`,R=S.startsWith(` +`)?S:` ${S}`;return`${P}${I}${R}`}).join(e===0?` +`:"")||` +`;return r?` +${f}`:`${f}`}throw new Error(`Unsupported value type (${t})`)}function il(t){try{let e=pU(t,0,!1);return e!==` +`?e:""}catch(e){throw e.location&&(e.message=e.message.replace(/(\.)?$/,` (line ${e.location.start.line}, column ${e.location.start.column})$1`)),e}}function rZe(t){return t.endsWith(` +`)||(t+=` +`),(0,ine.parse)(t)}function iZe(t){if(nZe.test(t))return rZe(t);let e=(0,Ux.safeLoad)(t,{schema:Ux.FAILSAFE_SCHEMA,json:!0});if(e==null)return{};if(typeof e!="object")throw new Error(`Expected an indexed object, got a ${typeof e} instead. Does your file follow Yaml's rules?`);if(Array.isArray(e))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return e}function ls(t){return iZe(t)}var Ux,ine,tZe,rne,_x,nZe,one=It(()=>{Ux=et($re()),ine=et(tne()),tZe=/^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/,rne=["__metadata","version","resolution","dependencies","peerDependencies","dependenciesMeta","peerDependenciesMeta","binaries"],_x=class{constructor(e){this.data=e}};il.PreserveOrdering=_x;nZe=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i});var Z2={};Vt(Z2,{parseResolution:()=>bx,parseShell:()=>vx,parseSyml:()=>ls,stringifyArgument:()=>$_,stringifyArgumentSegment:()=>eU,stringifyArithmeticExpression:()=>Dx,stringifyCommand:()=>X_,stringifyCommandChain:()=>AE,stringifyCommandChainThen:()=>Z_,stringifyCommandLine:()=>Sx,stringifyCommandLineThen:()=>z_,stringifyEnvSegment:()=>Bx,stringifyRedirectArgument:()=>G2,stringifyResolution:()=>Px,stringifyShell:()=>fE,stringifyShellLine:()=>fE,stringifySyml:()=>il,stringifyValueArgument:()=>Sd});var Bc=It(()=>{ste();cte();one()});var lne=L((S9t,hU)=>{"use strict";var sZe=t=>{let e=!1,r=!1,s=!1;for(let a=0;a{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let r=a=>e.pascalCase?a.charAt(0).toUpperCase()+a.slice(1):a;return Array.isArray(t)?t=t.map(a=>a.trim()).filter(a=>a.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=sZe(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(a,n)=>n.toUpperCase()).replace(/\d+(\w|$)/g,a=>a.toUpperCase()),r(t))};hU.exports=ane;hU.exports.default=ane});var cne=L((D9t,oZe)=>{oZe.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var Nd=L(_l=>{"use strict";var fne=cne(),bs=process.env;Object.defineProperty(_l,"_vendors",{value:fne.map(function(t){return t.constant})});_l.name=null;_l.isPR=null;fne.forEach(function(t){let r=(Array.isArray(t.env)?t.env:[t.env]).every(function(s){return une(s)});if(_l[t.constant]=r,!!r)switch(_l.name=t.name,typeof t.pr){case"string":_l.isPR=!!bs[t.pr];break;case"object":"env"in t.pr?_l.isPR=t.pr.env in bs&&bs[t.pr.env]!==t.pr.ne:"any"in t.pr?_l.isPR=t.pr.any.some(function(s){return!!bs[s]}):_l.isPR=une(t.pr);break;default:_l.isPR=null}});_l.isCI=!!(bs.CI!=="false"&&(bs.BUILD_ID||bs.BUILD_NUMBER||bs.CI||bs.CI_APP_ID||bs.CI_BUILD_ID||bs.CI_BUILD_NUMBER||bs.CI_NAME||bs.CONTINUOUS_INTEGRATION||bs.RUN_ID||_l.name));function une(t){return typeof t=="string"?!!bs[t]:"env"in t?bs[t.env]&&bs[t.env].includes(t.includes):"any"in t?t.any.some(function(e){return!!bs[e]}):Object.keys(t).every(function(e){return bs[e]===t[e]})}});var ei,En,Od,gU,Hx,Ane,dU,mU,jx=It(()=>{(function(t){t.StartOfInput="\0",t.EndOfInput="",t.EndOfPartialInput=""})(ei||(ei={}));(function(t){t[t.InitialNode=0]="InitialNode",t[t.SuccessNode=1]="SuccessNode",t[t.ErrorNode=2]="ErrorNode",t[t.CustomNode=3]="CustomNode"})(En||(En={}));Od=-1,gU=/^(-h|--help)(?:=([0-9]+))?$/,Hx=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,Ane=/^-[a-zA-Z]{2,}$/,dU=/^([^=]+)=([\s\S]*)$/,mU=process.env.DEBUG_CLI==="1"});var nt,IE,qx,yU,Gx=It(()=>{jx();nt=class extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}},IE=class extends Error{constructor(e,r){if(super(),this.input=e,this.candidates=r,this.clipanion={type:"none"},this.name="UnknownSyntaxError",this.candidates.length===0)this.message="Command not found, but we're not sure what's the alternative.";else if(this.candidates.every(s=>s.reason!==null&&s.reason===r[0].reason)){let[{reason:s}]=this.candidates;this.message=`${s} + +${this.candidates.map(({usage:a})=>`$ ${a}`).join(` +`)}`}else if(this.candidates.length===1){let[{usage:s}]=this.candidates;this.message=`Command not found; did you mean: + +$ ${s} +${yU(e)}`}else this.message=`Command not found; did you mean one of: + +${this.candidates.map(({usage:s},a)=>`${`${a}.`.padStart(4)} ${s}`).join(` +`)} + +${yU(e)}`}},qx=class extends Error{constructor(e,r){super(),this.input=e,this.usages=r,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives: + +${this.usages.map((s,a)=>`${`${a}.`.padStart(4)} ${s}`).join(` +`)} + +${yU(e)}`}},yU=t=>`While running ${t.filter(e=>e!==ei.EndOfInput&&e!==ei.EndOfPartialInput).map(e=>{let r=JSON.stringify(e);return e.match(/\s/)||e.length===0||r!==`"${e}"`?r:e}).join(" ")}`});function aZe(t){let e=t.split(` +`),r=e.filter(a=>a.match(/\S/)),s=r.length>0?r.reduce((a,n)=>Math.min(a,n.length-n.trimStart().length),Number.MAX_VALUE):0;return e.map(a=>a.slice(s).trimRight()).join(` +`)}function qo(t,{format:e,paragraphs:r}){return t=t.replace(/\r\n?/g,` +`),t=aZe(t),t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2 + +`),t=t.replace(/\n(\n)?\n*/g,(s,a)=>a||" "),r&&(t=t.split(/\n/).map(s=>{let a=s.match(/^\s*[*-][\t ]+(.*)/);if(!a)return s.match(/(.{1,80})(?: |$)/g).join(` +`);let n=s.length-s.trimStart().length;return a[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map((c,f)=>" ".repeat(n)+(f===0?"- ":" ")+c).join(` +`)}).join(` + +`)),t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(s,a,n)=>e.code(a+n+a)),t=t.replace(/(\*\*)((?:.|[\n])*?)\1/g,(s,a,n)=>e.bold(a+n+a)),t?`${t} +`:""}var EU,pne,hne,IU=It(()=>{EU=Array(80).fill("\u2501");for(let t=0;t<=24;++t)EU[EU.length-t]=`\x1B[38;5;${232+t}m\u2501`;pne={header:t=>`\x1B[1m\u2501\u2501\u2501 ${t}${t.length<75?` ${EU.slice(t.length+5).join("")}`:":"}\x1B[0m`,bold:t=>`\x1B[1m${t}\x1B[22m`,error:t=>`\x1B[31m\x1B[1m${t}\x1B[22m\x1B[39m`,code:t=>`\x1B[36m${t}\x1B[39m`},hne={header:t=>t,bold:t=>t,error:t=>t,code:t=>t}});function Ea(t){return{...t,[X2]:!0}}function Gf(t,e){return typeof t>"u"?[t,e]:typeof t=="object"&&t!==null&&!Array.isArray(t)?[void 0,t]:[t,e]}function Wx(t,{mergeName:e=!1}={}){let r=t.match(/^([^:]+): (.*)$/m);if(!r)return"validation failed";let[,s,a]=r;return e&&(a=a[0].toLowerCase()+a.slice(1)),a=s!=="."||!e?`${s.replace(/^\.(\[|$)/,"$1")}: ${a}`:`: ${a}`,a}function $2(t,e){return e.length===1?new nt(`${t}${Wx(e[0],{mergeName:!0})}`):new nt(`${t}: +${e.map(r=>` +- ${Wx(r)}`).join("")}`)}function Ld(t,e,r){if(typeof r>"u")return e;let s=[],a=[],n=f=>{let p=e;return e=f,n.bind(null,p)};if(!r(e,{errors:s,coercions:a,coercion:n}))throw $2(`Invalid value for ${t}`,s);for(let[,f]of a)f();return e}var X2,Bp=It(()=>{Gx();X2=Symbol("clipanion/isOption")});var Ia={};Vt(Ia,{KeyRelationship:()=>Wf,TypeAssertionError:()=>c0,applyCascade:()=>rB,as:()=>DZe,assert:()=>BZe,assertWithErrors:()=>vZe,cascade:()=>Jx,fn:()=>bZe,hasAtLeastOneKey:()=>bU,hasExactLength:()=>Ene,hasForbiddenKeys:()=>YZe,hasKeyRelationship:()=>iB,hasMaxLength:()=>xZe,hasMinLength:()=>PZe,hasMutuallyExclusiveKeys:()=>VZe,hasRequiredKeys:()=>WZe,hasUniqueItems:()=>kZe,isArray:()=>Yx,isAtLeast:()=>SU,isAtMost:()=>RZe,isBase64:()=>HZe,isBoolean:()=>gZe,isDate:()=>mZe,isDict:()=>IZe,isEnum:()=>Ao,isHexColor:()=>UZe,isISO8601:()=>_Ze,isInExclusiveRange:()=>NZe,isInInclusiveRange:()=>FZe,isInstanceOf:()=>wZe,isInteger:()=>DU,isJSON:()=>jZe,isLiteral:()=>dne,isLowerCase:()=>OZe,isMap:()=>EZe,isNegative:()=>QZe,isNullable:()=>GZe,isNumber:()=>BU,isObject:()=>mne,isOneOf:()=>vU,isOptional:()=>qZe,isPartial:()=>CZe,isPayload:()=>dZe,isPositive:()=>TZe,isRecord:()=>Kx,isSet:()=>yZe,isString:()=>wE,isTuple:()=>Vx,isUUID4:()=>MZe,isUnknown:()=>wU,isUpperCase:()=>LZe,makeTrait:()=>yne,makeValidator:()=>Wr,matchesRegExp:()=>tB,softAssert:()=>SZe});function ti(t){return t===null?"null":t===void 0?"undefined":t===""?"an empty string":typeof t=="symbol"?`<${t.toString()}>`:Array.isArray(t)?"an array":JSON.stringify(t)}function CE(t,e){if(t.length===0)return"nothing";if(t.length===1)return ti(t[0]);let r=t.slice(0,-1),s=t[t.length-1],a=t.length>2?`, ${e} `:` ${e} `;return`${r.map(n=>ti(n)).join(", ")}${a}${ti(s)}`}function l0(t,e){var r,s,a;return typeof e=="number"?`${(r=t?.p)!==null&&r!==void 0?r:"."}[${e}]`:lZe.test(e)?`${(s=t?.p)!==null&&s!==void 0?s:""}.${e}`:`${(a=t?.p)!==null&&a!==void 0?a:"."}[${JSON.stringify(e)}]`}function CU(t,e,r){return t===1?e:r}function mr({errors:t,p:e}={},r){return t?.push(`${e??"."}: ${r}`),!1}function pZe(t,e){return r=>{t[e]=r}}function Yf(t,e){return r=>{let s=t[e];return t[e]=r,Yf(t,e).bind(null,s)}}function eB(t,e,r){let s=()=>(t(r()),a),a=()=>(t(e),s);return s}function wU(){return Wr({test:(t,e)=>!0})}function dne(t){return Wr({test:(e,r)=>e!==t?mr(r,`Expected ${ti(t)} (got ${ti(e)})`):!0})}function wE(){return Wr({test:(t,e)=>typeof t!="string"?mr(e,`Expected a string (got ${ti(t)})`):!0})}function Ao(t){let e=Array.isArray(t)?t:Object.values(t),r=e.every(a=>typeof a=="string"||typeof a=="number"),s=new Set(e);return s.size===1?dne([...s][0]):Wr({test:(a,n)=>s.has(a)?!0:r?mr(n,`Expected one of ${CE(e,"or")} (got ${ti(a)})`):mr(n,`Expected a valid enumeration value (got ${ti(a)})`)})}function gZe(){return Wr({test:(t,e)=>{var r;if(typeof t!="boolean"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return mr(e,"Unbound coercion result");let s=hZe.get(t);if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return mr(e,`Expected a boolean (got ${ti(t)})`)}return!0}})}function BU(){return Wr({test:(t,e)=>{var r;if(typeof t!="number"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return mr(e,"Unbound coercion result");let s;if(typeof t=="string"){let a;try{a=JSON.parse(t)}catch{}if(typeof a=="number")if(JSON.stringify(a)===t)s=a;else return mr(e,`Received a number that can't be safely represented by the runtime (${t})`)}if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return mr(e,`Expected a number (got ${ti(t)})`)}return!0}})}function dZe(t){return Wr({test:(e,r)=>{var s;if(typeof r?.coercions>"u")return mr(r,"The isPayload predicate can only be used with coercion enabled");if(typeof r.coercion>"u")return mr(r,"Unbound coercion result");if(typeof e!="string")return mr(r,`Expected a string (got ${ti(e)})`);let a;try{a=JSON.parse(e)}catch{return mr(r,`Expected a JSON string (got ${ti(e)})`)}let n={value:a};return t(a,Object.assign(Object.assign({},r),{coercion:Yf(n,"value")}))?(r.coercions.push([(s=r.p)!==null&&s!==void 0?s:".",r.coercion.bind(null,n.value)]),!0):!1}})}function mZe(){return Wr({test:(t,e)=>{var r;if(!(t instanceof Date)){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return mr(e,"Unbound coercion result");let s;if(typeof t=="string"&&gne.test(t))s=new Date(t);else{let a;if(typeof t=="string"){let n;try{n=JSON.parse(t)}catch{}typeof n=="number"&&(a=n)}else typeof t=="number"&&(a=t);if(typeof a<"u")if(Number.isSafeInteger(a)||!Number.isSafeInteger(a*1e3))s=new Date(a*1e3);else return mr(e,`Received a timestamp that can't be safely represented by the runtime (${t})`)}if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return mr(e,`Expected a date (got ${ti(t)})`)}return!0}})}function Yx(t,{delimiter:e}={}){return Wr({test:(r,s)=>{var a;let n=r;if(typeof r=="string"&&typeof e<"u"&&typeof s?.coercions<"u"){if(typeof s?.coercion>"u")return mr(s,"Unbound coercion result");r=r.split(e)}if(!Array.isArray(r))return mr(s,`Expected an array (got ${ti(r)})`);let c=!0;for(let f=0,p=r.length;f{var n,c;if(Object.getPrototypeOf(s).toString()==="[object Set]")if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return mr(a,"Unbound coercion result");let f=[...s],p=[...s];if(!r(p,Object.assign(Object.assign({},a),{coercion:void 0})))return!1;let h=()=>p.some((E,C)=>E!==f[C])?new Set(p):s;return a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",eB(a.coercion,s,h)]),!0}else{let f=!0;for(let p of s)if(f=t(p,Object.assign({},a))&&f,!f&&a?.errors==null)break;return f}if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return mr(a,"Unbound coercion result");let f={value:s};return r(s,Object.assign(Object.assign({},a),{coercion:Yf(f,"value")}))?(a.coercions.push([(c=a.p)!==null&&c!==void 0?c:".",eB(a.coercion,s,()=>new Set(f.value))]),!0):!1}return mr(a,`Expected a set (got ${ti(s)})`)}})}function EZe(t,e){let r=Yx(Vx([t,e])),s=Kx(e,{keys:t});return Wr({test:(a,n)=>{var c,f,p;if(Object.getPrototypeOf(a).toString()==="[object Map]")if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return mr(n,"Unbound coercion result");let h=[...a],E=[...a];if(!r(E,Object.assign(Object.assign({},n),{coercion:void 0})))return!1;let C=()=>E.some((S,P)=>S[0]!==h[P][0]||S[1]!==h[P][1])?new Map(E):a;return n.coercions.push([(c=n.p)!==null&&c!==void 0?c:".",eB(n.coercion,a,C)]),!0}else{let h=!0;for(let[E,C]of a)if(h=t(E,Object.assign({},n))&&h,!h&&n?.errors==null||(h=e(C,Object.assign(Object.assign({},n),{p:l0(n,E)}))&&h,!h&&n?.errors==null))break;return h}if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return mr(n,"Unbound coercion result");let h={value:a};return Array.isArray(a)?r(a,Object.assign(Object.assign({},n),{coercion:void 0}))?(n.coercions.push([(f=n.p)!==null&&f!==void 0?f:".",eB(n.coercion,a,()=>new Map(h.value))]),!0):!1:s(a,Object.assign(Object.assign({},n),{coercion:Yf(h,"value")}))?(n.coercions.push([(p=n.p)!==null&&p!==void 0?p:".",eB(n.coercion,a,()=>new Map(Object.entries(h.value)))]),!0):!1}return mr(n,`Expected a map (got ${ti(a)})`)}})}function Vx(t,{delimiter:e}={}){let r=Ene(t.length);return Wr({test:(s,a)=>{var n;if(typeof s=="string"&&typeof e<"u"&&typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return mr(a,"Unbound coercion result");s=s.split(e),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,s)])}if(!Array.isArray(s))return mr(a,`Expected a tuple (got ${ti(s)})`);let c=r(s,Object.assign({},a));for(let f=0,p=s.length;f{var n;if(Array.isArray(s)&&typeof a?.coercions<"u")return typeof a?.coercion>"u"?mr(a,"Unbound coercion result"):r(s,Object.assign(Object.assign({},a),{coercion:void 0}))?(s=Object.fromEntries(s),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,s)]),!0):!1;if(typeof s!="object"||s===null)return mr(a,`Expected an object (got ${ti(s)})`);let c=Object.keys(s),f=!0;for(let p=0,h=c.length;p{if(typeof a!="object"||a===null)return mr(n,`Expected an object (got ${ti(a)})`);let c=new Set([...r,...Object.keys(a)]),f={},p=!0;for(let h of c){if(h==="constructor"||h==="__proto__")p=mr(Object.assign(Object.assign({},n),{p:l0(n,h)}),"Unsafe property name");else{let E=Object.prototype.hasOwnProperty.call(t,h)?t[h]:void 0,C=Object.prototype.hasOwnProperty.call(a,h)?a[h]:void 0;typeof E<"u"?p=E(C,Object.assign(Object.assign({},n),{p:l0(n,h),coercion:Yf(a,h)}))&&p:e===null?p=mr(Object.assign(Object.assign({},n),{p:l0(n,h)}),`Extraneous property (got ${ti(C)})`):Object.defineProperty(f,h,{enumerable:!0,get:()=>C,set:pZe(a,h)})}if(!p&&n?.errors==null)break}return e!==null&&(p||n?.errors!=null)&&(p=e(f,n)&&p),p}});return Object.assign(s,{properties:t})}function CZe(t){return mne(t,{extra:Kx(wU())})}function yne(t){return()=>t}function Wr({test:t}){return yne(t)()}function BZe(t,e){if(!e(t))throw new c0}function vZe(t,e){let r=[];if(!e(t,{errors:r}))throw new c0({errors:r})}function SZe(t,e){}function DZe(t,e,{coerce:r=!1,errors:s,throw:a}={}){let n=s?[]:void 0;if(!r){if(e(t,{errors:n}))return a?t:{value:t,errors:void 0};if(a)throw new c0({errors:n});return{value:void 0,errors:n??!0}}let c={value:t},f=Yf(c,"value"),p=[];if(!e(t,{errors:n,coercion:f,coercions:p})){if(a)throw new c0({errors:n});return{value:void 0,errors:n??!0}}for(let[,h]of p)h();return a?c.value:{value:c.value,errors:void 0}}function bZe(t,e){let r=Vx(t);return(...s)=>{if(!r(s))throw new c0;return e(...s)}}function PZe(t){return Wr({test:(e,r)=>e.length>=t?!0:mr(r,`Expected to have a length of at least ${t} elements (got ${e.length})`)})}function xZe(t){return Wr({test:(e,r)=>e.length<=t?!0:mr(r,`Expected to have a length of at most ${t} elements (got ${e.length})`)})}function Ene(t){return Wr({test:(e,r)=>e.length!==t?mr(r,`Expected to have a length of exactly ${t} elements (got ${e.length})`):!0})}function kZe({map:t}={}){return Wr({test:(e,r)=>{let s=new Set,a=new Set;for(let n=0,c=e.length;nt<=0?!0:mr(e,`Expected to be negative (got ${t})`)})}function TZe(){return Wr({test:(t,e)=>t>=0?!0:mr(e,`Expected to be positive (got ${t})`)})}function SU(t){return Wr({test:(e,r)=>e>=t?!0:mr(r,`Expected to be at least ${t} (got ${e})`)})}function RZe(t){return Wr({test:(e,r)=>e<=t?!0:mr(r,`Expected to be at most ${t} (got ${e})`)})}function FZe(t,e){return Wr({test:(r,s)=>r>=t&&r<=e?!0:mr(s,`Expected to be in the [${t}; ${e}] range (got ${r})`)})}function NZe(t,e){return Wr({test:(r,s)=>r>=t&&re!==Math.round(e)?mr(r,`Expected to be an integer (got ${e})`):!t&&!Number.isSafeInteger(e)?mr(r,`Expected to be a safe integer (got ${e})`):!0})}function tB(t){return Wr({test:(e,r)=>t.test(e)?!0:mr(r,`Expected to match the pattern ${t.toString()} (got ${ti(e)})`)})}function OZe(){return Wr({test:(t,e)=>t!==t.toLowerCase()?mr(e,`Expected to be all-lowercase (got ${t})`):!0})}function LZe(){return Wr({test:(t,e)=>t!==t.toUpperCase()?mr(e,`Expected to be all-uppercase (got ${t})`):!0})}function MZe(){return Wr({test:(t,e)=>AZe.test(t)?!0:mr(e,`Expected to be a valid UUID v4 (got ${ti(t)})`)})}function _Ze(){return Wr({test:(t,e)=>gne.test(t)?!0:mr(e,`Expected to be a valid ISO 8601 date string (got ${ti(t)})`)})}function UZe({alpha:t=!1}){return Wr({test:(e,r)=>(t?cZe.test(e):uZe.test(e))?!0:mr(r,`Expected to be a valid hexadecimal color string (got ${ti(e)})`)})}function HZe(){return Wr({test:(t,e)=>fZe.test(t)?!0:mr(e,`Expected to be a valid base 64 string (got ${ti(t)})`)})}function jZe(t=wU()){return Wr({test:(e,r)=>{let s;try{s=JSON.parse(e)}catch{return mr(r,`Expected to be a valid JSON string (got ${ti(e)})`)}return t(s,r)}})}function Jx(t,...e){let r=Array.isArray(e[0])?e[0]:e;return Wr({test:(s,a)=>{var n,c;let f={value:s},p=typeof a?.coercions<"u"?Yf(f,"value"):void 0,h=typeof a?.coercions<"u"?[]:void 0;if(!t(s,Object.assign(Object.assign({},a),{coercion:p,coercions:h})))return!1;let E=[];if(typeof h<"u")for(let[,C]of h)E.push(C());try{if(typeof a?.coercions<"u"){if(f.value!==s){if(typeof a?.coercion>"u")return mr(a,"Unbound coercion result");a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,f.value)])}(c=a?.coercions)===null||c===void 0||c.push(...h)}return r.every(C=>C(f.value,a))}finally{for(let C of E)C()}}})}function rB(t,...e){let r=Array.isArray(e[0])?e[0]:e;return Jx(t,r)}function qZe(t){return Wr({test:(e,r)=>typeof e>"u"?!0:t(e,r)})}function GZe(t){return Wr({test:(e,r)=>e===null?!0:t(e,r)})}function WZe(t,e){var r;let s=new Set(t),a=nB[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Wr({test:(n,c)=>{let f=new Set(Object.keys(n)),p=[];for(let h of s)a(f,h,n)||p.push(h);return p.length>0?mr(c,`Missing required ${CU(p.length,"property","properties")} ${CE(p,"and")}`):!0}})}function bU(t,e){var r;let s=new Set(t),a=nB[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Wr({test:(n,c)=>Object.keys(n).some(h=>a(s,h,n))?!0:mr(c,`Missing at least one property from ${CE(Array.from(s),"or")}`)})}function YZe(t,e){var r;let s=new Set(t),a=nB[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Wr({test:(n,c)=>{let f=new Set(Object.keys(n)),p=[];for(let h of s)a(f,h,n)&&p.push(h);return p.length>0?mr(c,`Forbidden ${CU(p.length,"property","properties")} ${CE(p,"and")}`):!0}})}function VZe(t,e){var r;let s=new Set(t),a=nB[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Wr({test:(n,c)=>{let f=new Set(Object.keys(n)),p=[];for(let h of s)a(f,h,n)&&p.push(h);return p.length>1?mr(c,`Mutually exclusive properties ${CE(p,"and")}`):!0}})}function iB(t,e,r,s){var a,n;let c=new Set((a=s?.ignore)!==null&&a!==void 0?a:[]),f=nB[(n=s?.missingIf)!==null&&n!==void 0?n:"missing"],p=new Set(r),h=KZe[e],E=e===Wf.Forbids?"or":"and";return Wr({test:(C,S)=>{let P=new Set(Object.keys(C));if(!f(P,t,C)||c.has(C[t]))return!0;let I=[];for(let R of p)(f(P,R,C)&&!c.has(C[R]))!==h.expect&&I.push(R);return I.length>=1?mr(S,`Property "${t}" ${h.message} ${CU(I.length,"property","properties")} ${CE(I,E)}`):!0}})}var lZe,cZe,uZe,fZe,AZe,gne,hZe,wZe,vU,c0,nB,Wf,KZe,Ul=It(()=>{lZe=/^[a-zA-Z_][a-zA-Z0-9_]*$/;cZe=/^#[0-9a-f]{6}$/i,uZe=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i,fZe=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,AZe=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i,gne=/^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/;hZe=new Map([["true",!0],["True",!0],["1",!0],[1,!0],["false",!1],["False",!1],["0",!1],[0,!1]]);wZe=t=>Wr({test:(e,r)=>e instanceof t?!0:mr(r,`Expected an instance of ${t.name} (got ${ti(e)})`)}),vU=(t,{exclusive:e=!1}={})=>Wr({test:(r,s)=>{var a,n,c;let f=[],p=typeof s?.errors<"u"?[]:void 0;for(let h=0,E=t.length;h1?mr(s,`Expected to match exactly a single predicate (matched ${f.join(", ")})`):(c=s?.errors)===null||c===void 0||c.push(...p),!1}});c0=class extends Error{constructor({errors:e}={}){let r="Type mismatch";if(e&&e.length>0){r+=` +`;for(let s of e)r+=` +- ${s}`}super(r)}};nB={missing:(t,e)=>t.has(e),undefined:(t,e,r)=>t.has(e)&&typeof r[e]<"u",nil:(t,e,r)=>t.has(e)&&r[e]!=null,falsy:(t,e,r)=>t.has(e)&&!!r[e]};(function(t){t.Forbids="Forbids",t.Requires="Requires"})(Wf||(Wf={}));KZe={[Wf.Forbids]:{expect:!1,message:"forbids using"},[Wf.Requires]:{expect:!0,message:"requires using"}}});var ot,u0=It(()=>{Bp();ot=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let r=this.constructor.schema;if(Array.isArray(r)){let{isDict:a,isUnknown:n,applyCascade:c}=await Promise.resolve().then(()=>(Ul(),Ia)),f=c(a(n()),r),p=[],h=[];if(!f(this,{errors:p,coercions:h}))throw $2("Invalid option schema",p);for(let[,C]of h)C()}else if(r!=null)throw new Error("Invalid command schema");let s=await this.execute();return typeof s<"u"?s:0}};ot.isOption=X2;ot.Default=[]});function sl(t){mU&&console.log(t)}function Cne(){let t={nodes:[]};for(let e=0;e{if(e.has(s))return;e.add(s);let a=t.nodes[s];for(let c of Object.values(a.statics))for(let{to:f}of c)r(f);for(let[,{to:c}]of a.dynamics)r(c);for(let{to:c}of a.shortcuts)r(c);let n=new Set(a.shortcuts.map(({to:c})=>c));for(;a.shortcuts.length>0;){let{to:c}=a.shortcuts.shift(),f=t.nodes[c];for(let[p,h]of Object.entries(f.statics)){let E=Object.prototype.hasOwnProperty.call(a.statics,p)?a.statics[p]:a.statics[p]=[];for(let C of h)E.some(({to:S})=>C.to===S)||E.push(C)}for(let[p,h]of f.dynamics)a.dynamics.some(([E,{to:C}])=>p===E&&h.to===C)||a.dynamics.push([p,h]);for(let p of f.shortcuts)n.has(p.to)||(a.shortcuts.push(p),n.add(p.to))}};r(En.InitialNode)}function ZZe(t,{prefix:e=""}={}){if(mU){sl(`${e}Nodes are:`);for(let r=0;rE!==En.ErrorNode).map(({state:E})=>({usage:E.candidateUsage,reason:null})));if(h.every(({node:E})=>E===En.ErrorNode))throw new IE(e,h.map(({state:E})=>({usage:E.candidateUsage,reason:E.errorMessage})));s=eXe(h)}if(s.length>0){sl(" Results:");for(let n of s)sl(` - ${n.node} -> ${JSON.stringify(n.state)}`)}else sl(" No results");return s}function $Ze(t,e,{endToken:r=ei.EndOfInput}={}){let s=XZe(t,[...e,r]);return tXe(e,s.map(({state:a})=>a))}function eXe(t){let e=0;for(let{state:r}of t)r.path.length>e&&(e=r.path.length);return t.filter(({state:r})=>r.path.length===e)}function tXe(t,e){let r=e.filter(S=>S.selectedIndex!==null),s=r.filter(S=>!S.partial);if(s.length>0&&(r=s),r.length===0)throw new Error;let a=r.filter(S=>S.selectedIndex===Od||S.requiredOptions.every(P=>P.some(I=>S.options.find(R=>R.name===I))));if(a.length===0)throw new IE(t,r.map(S=>({usage:S.candidateUsage,reason:null})));let n=0;for(let S of a)S.path.length>n&&(n=S.path.length);let c=a.filter(S=>S.path.length===n),f=S=>S.positionals.filter(({extra:P})=>!P).length+S.options.length,p=c.map(S=>({state:S,positionalCount:f(S)})),h=0;for(let{positionalCount:S}of p)S>h&&(h=S);let E=p.filter(({positionalCount:S})=>S===h).map(({state:S})=>S),C=rXe(E);if(C.length>1)throw new qx(t,C.map(S=>S.candidateUsage));return C[0]}function rXe(t){let e=[],r=[];for(let s of t)s.selectedIndex===Od?r.push(s):e.push(s);return r.length>0&&e.push({...Ine,path:wne(...r.map(s=>s.path)),options:r.reduce((s,a)=>s.concat(a.options),[])}),e}function wne(t,e,...r){return e===void 0?Array.from(t):wne(t.filter((s,a)=>s===e[a]),...r)}function Hl(){return{dynamics:[],shortcuts:[],statics:{}}}function Bne(t){return t===En.SuccessNode||t===En.ErrorNode}function PU(t,e=0){return{to:Bne(t.to)?t.to:t.to>=En.CustomNode?t.to+e-En.CustomNode+1:t.to+e,reducer:t.reducer}}function nXe(t,e=0){let r=Hl();for(let[s,a]of t.dynamics)r.dynamics.push([s,PU(a,e)]);for(let s of t.shortcuts)r.shortcuts.push(PU(s,e));for(let[s,a]of Object.entries(t.statics))r.statics[s]=a.map(n=>PU(n,e));return r}function js(t,e,r,s,a){t.nodes[e].dynamics.push([r,{to:s,reducer:a}])}function BE(t,e,r,s){t.nodes[e].shortcuts.push({to:r,reducer:s})}function Ca(t,e,r,s,a){(Object.prototype.hasOwnProperty.call(t.nodes[e].statics,r)?t.nodes[e].statics[r]:t.nodes[e].statics[r]=[]).push({to:s,reducer:a})}function zx(t,e,r,s,a){if(Array.isArray(e)){let[n,...c]=e;return t[n](r,s,a,...c)}else return t[e](r,s,a)}var Ine,iXe,xU,jl,kU,Zx,Xx=It(()=>{jx();Gx();Ine={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:Od,partial:!1,tokens:[]};iXe={always:()=>!0,isOptionLike:(t,e)=>!t.ignoreOptions&&e!=="-"&&e.startsWith("-"),isNotOptionLike:(t,e)=>t.ignoreOptions||e==="-"||!e.startsWith("-"),isOption:(t,e,r,s)=>!t.ignoreOptions&&e===s,isBatchOption:(t,e,r,s)=>!t.ignoreOptions&&Ane.test(e)&&[...e.slice(1)].every(a=>s.has(`-${a}`)),isBoundOption:(t,e,r,s,a)=>{let n=e.match(dU);return!t.ignoreOptions&&!!n&&Hx.test(n[1])&&s.has(n[1])&&a.filter(c=>c.nameSet.includes(n[1])).every(c=>c.allowBinding)},isNegatedOption:(t,e,r,s)=>!t.ignoreOptions&&e===`--no-${s.slice(2)}`,isHelp:(t,e)=>!t.ignoreOptions&&gU.test(e),isUnsupportedOption:(t,e,r,s)=>!t.ignoreOptions&&e.startsWith("-")&&Hx.test(e)&&!s.has(e),isInvalidOption:(t,e)=>!t.ignoreOptions&&e.startsWith("-")&&!Hx.test(e)},xU={setCandidateState:(t,e,r,s)=>({...t,...s}),setSelectedIndex:(t,e,r,s)=>({...t,selectedIndex:s}),setPartialIndex:(t,e,r,s)=>({...t,selectedIndex:s,partial:!0}),pushBatch:(t,e,r,s)=>{let a=t.options.slice(),n=t.tokens.slice();for(let c=1;c{let[,s,a]=e.match(dU),n=t.options.concat({name:s,value:a}),c=t.tokens.concat([{segmentIndex:r,type:"option",slice:[0,s.length],option:s},{segmentIndex:r,type:"assign",slice:[s.length,s.length+1]},{segmentIndex:r,type:"value",slice:[s.length+1,s.length+a.length+1]}]);return{...t,options:n,tokens:c}},pushPath:(t,e,r)=>{let s=t.path.concat(e),a=t.tokens.concat({segmentIndex:r,type:"path"});return{...t,path:s,tokens:a}},pushPositional:(t,e,r)=>{let s=t.positionals.concat({value:e,extra:!1}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:s,tokens:a}},pushExtra:(t,e,r)=>{let s=t.positionals.concat({value:e,extra:!0}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:s,tokens:a}},pushExtraNoLimits:(t,e,r)=>{let s=t.positionals.concat({value:e,extra:jl}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:s,tokens:a}},pushTrue:(t,e,r,s)=>{let a=t.options.concat({name:s,value:!0}),n=t.tokens.concat({segmentIndex:r,type:"option",option:s});return{...t,options:a,tokens:n}},pushFalse:(t,e,r,s)=>{let a=t.options.concat({name:s,value:!1}),n=t.tokens.concat({segmentIndex:r,type:"option",option:s});return{...t,options:a,tokens:n}},pushUndefined:(t,e,r,s)=>{let a=t.options.concat({name:e,value:void 0}),n=t.tokens.concat({segmentIndex:r,type:"option",option:e});return{...t,options:a,tokens:n}},pushStringValue:(t,e,r)=>{var s;let a=t.options[t.options.length-1],n=t.options.slice(),c=t.tokens.concat({segmentIndex:r,type:"value"});return a.value=((s=a.value)!==null&&s!==void 0?s:[]).concat([e]),{...t,options:n,tokens:c}},setStringValue:(t,e,r)=>{let s=t.options[t.options.length-1],a=t.options.slice(),n=t.tokens.concat({segmentIndex:r,type:"value"});return s.value=e,{...t,options:a,tokens:n}},inhibateOptions:t=>({...t,ignoreOptions:!0}),useHelp:(t,e,r,s)=>{let[,,a]=e.match(gU);return typeof a<"u"?{...t,options:[{name:"-c",value:String(s)},{name:"-i",value:a}]}:{...t,options:[{name:"-c",value:String(s)}]}},setError:(t,e,r,s)=>e===ei.EndOfInput||e===ei.EndOfPartialInput?{...t,errorMessage:`${s}.`}:{...t,errorMessage:`${s} ("${e}").`},setOptionArityError:(t,e)=>{let r=t.options[t.options.length-1];return{...t,errorMessage:`Not enough arguments to option ${r.name}.`}}},jl=Symbol(),kU=class{constructor(e,r){this.allOptionNames=new Map,this.arity={leading:[],trailing:[],extra:[],proxy:!1},this.options=[],this.paths=[],this.cliIndex=e,this.cliOpts=r}addPath(e){this.paths.push(e)}setArity({leading:e=this.arity.leading,trailing:r=this.arity.trailing,extra:s=this.arity.extra,proxy:a=this.arity.proxy}){Object.assign(this.arity,{leading:e,trailing:r,extra:s,proxy:a})}addPositional({name:e="arg",required:r=!0}={}){if(!r&&this.arity.extra===jl)throw new Error("Optional parameters cannot be declared when using .rest() or .proxy()");if(!r&&this.arity.trailing.length>0)throw new Error("Optional parameters cannot be declared after the required trailing positional arguments");!r&&this.arity.extra!==jl?this.arity.extra.push(e):this.arity.extra!==jl&&this.arity.extra.length===0?this.arity.leading.push(e):this.arity.trailing.push(e)}addRest({name:e="arg",required:r=0}={}){if(this.arity.extra===jl)throw new Error("Infinite lists cannot be declared multiple times in the same command");if(this.arity.trailing.length>0)throw new Error("Infinite lists cannot be declared after the required trailing positional arguments");for(let s=0;s1)throw new Error("The arity cannot be higher than 1 when the option only supports the --arg=value syntax");if(!Number.isInteger(s))throw new Error(`The arity must be an integer, got ${s}`);if(s<0)throw new Error(`The arity must be positive, got ${s}`);let f=e.reduce((p,h)=>h.length>p.length?h:p,"");for(let p of e)this.allOptionNames.set(p,f);this.options.push({preferredName:f,nameSet:e,description:r,arity:s,hidden:a,required:n,allowBinding:c})}setContext(e){this.context=e}usage({detailed:e=!0,inlineOptions:r=!0}={}){let s=[this.cliOpts.binaryName],a=[];if(this.paths.length>0&&s.push(...this.paths[0]),e){for(let{preferredName:c,nameSet:f,arity:p,hidden:h,description:E,required:C}of this.options){if(h)continue;let S=[];for(let I=0;I`:`[${P}]`)}s.push(...this.arity.leading.map(c=>`<${c}>`)),this.arity.extra===jl?s.push("..."):s.push(...this.arity.extra.map(c=>`[${c}]`)),s.push(...this.arity.trailing.map(c=>`<${c}>`))}return{usage:s.join(" "),options:a}}compile(){if(typeof this.context>"u")throw new Error("Assertion failed: No context attached");let e=Cne(),r=En.InitialNode,s=this.usage().usage,a=this.options.filter(f=>f.required).map(f=>f.nameSet);r=Mu(e,Hl()),Ca(e,En.InitialNode,ei.StartOfInput,r,["setCandidateState",{candidateUsage:s,requiredOptions:a}]);let n=this.arity.proxy?"always":"isNotOptionLike",c=this.paths.length>0?this.paths:[[]];for(let f of c){let p=r;if(f.length>0){let S=Mu(e,Hl());BE(e,p,S),this.registerOptions(e,S),p=S}for(let S=0;S0||!this.arity.proxy){let S=Mu(e,Hl());js(e,p,"isHelp",S,["useHelp",this.cliIndex]),js(e,S,"always",S,"pushExtra"),Ca(e,S,ei.EndOfInput,En.SuccessNode,["setSelectedIndex",Od]),this.registerOptions(e,p)}this.arity.leading.length>0&&(Ca(e,p,ei.EndOfInput,En.ErrorNode,["setError","Not enough positional arguments"]),Ca(e,p,ei.EndOfPartialInput,En.SuccessNode,["setPartialIndex",this.cliIndex]));let h=p;for(let S=0;S0||S+1!==this.arity.leading.length)&&(Ca(e,P,ei.EndOfInput,En.ErrorNode,["setError","Not enough positional arguments"]),Ca(e,P,ei.EndOfPartialInput,En.SuccessNode,["setPartialIndex",this.cliIndex])),js(e,h,"isNotOptionLike",P,"pushPositional"),h=P}let E=h;if(this.arity.extra===jl||this.arity.extra.length>0){let S=Mu(e,Hl());if(BE(e,h,S),this.arity.extra===jl){let P=Mu(e,Hl());this.arity.proxy||this.registerOptions(e,P),js(e,h,n,P,"pushExtraNoLimits"),js(e,P,n,P,"pushExtraNoLimits"),BE(e,P,S)}else for(let P=0;P0)&&this.registerOptions(e,I),js(e,E,n,I,"pushExtra"),BE(e,I,S),E=I}E=S}this.arity.trailing.length>0&&(Ca(e,E,ei.EndOfInput,En.ErrorNode,["setError","Not enough positional arguments"]),Ca(e,E,ei.EndOfPartialInput,En.SuccessNode,["setPartialIndex",this.cliIndex]));let C=E;for(let S=0;S=0&&e{let c=n?ei.EndOfPartialInput:ei.EndOfInput;return $Ze(s,a,{endToken:c})}}}}});function Sne(){return $x.default&&"getColorDepth"in $x.default.WriteStream.prototype?$x.default.WriteStream.prototype.getColorDepth():process.env.FORCE_COLOR==="0"?1:process.env.FORCE_COLOR==="1"||typeof process.stdout<"u"&&process.stdout.isTTY?8:1}function Dne(t){let e=vne;if(typeof e>"u"){if(t.stdout===process.stdout&&t.stderr===process.stderr)return null;let{AsyncLocalStorage:r}=ye("async_hooks");e=vne=new r;let s=process.stdout._write;process.stdout._write=function(n,c,f){let p=e.getStore();return typeof p>"u"?s.call(this,n,c,f):p.stdout.write(n,c,f)};let a=process.stderr._write;process.stderr._write=function(n,c,f){let p=e.getStore();return typeof p>"u"?a.call(this,n,c,f):p.stderr.write(n,c,f)}}return r=>e.run(t,r)}var $x,vne,bne=It(()=>{$x=et(ye("tty"),1)});var ek,Pne=It(()=>{u0();ek=class t extends ot{constructor(e){super(),this.contexts=e,this.commands=[]}static from(e,r){let s=new t(r);s.path=e.path;for(let a of e.options)switch(a.name){case"-c":s.commands.push(Number(a.value));break;case"-i":s.index=Number(a.value);break}return s}async execute(){let e=this.commands;if(typeof this.index<"u"&&this.index>=0&&this.index1){this.context.stdout.write(`Multiple commands match your selection: +`),this.context.stdout.write(` +`);let r=0;for(let s of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[s].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(` +`),this.context.stdout.write(`Run again with -h= to see the longer details of any of those commands. +`)}}}});async function Qne(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}=Rne(t);return wa.from(r,e).runExit(s,a)}async function Tne(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}=Rne(t);return wa.from(r,e).run(s,a)}function Rne(t){let e,r,s,a;switch(typeof process<"u"&&typeof process.argv<"u"&&(s=process.argv.slice(2)),t.length){case 1:r=t[0];break;case 2:t[0]&&t[0].prototype instanceof ot||Array.isArray(t[0])?(r=t[0],Array.isArray(t[1])?s=t[1]:a=t[1]):(e=t[0],r=t[1]);break;case 3:Array.isArray(t[2])?(e=t[0],r=t[1],s=t[2]):t[0]&&t[0].prototype instanceof ot||Array.isArray(t[0])?(r=t[0],s=t[1],a=t[2]):(e=t[0],r=t[1],a=t[2]);break;default:e=t[0],r=t[1],s=t[2],a=t[3];break}if(typeof s>"u")throw new Error("The argv parameter must be provided when running Clipanion outside of a Node context");return{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}}function kne(t){return t()}var xne,wa,Fne=It(()=>{jx();Xx();IU();bne();u0();Pne();xne=Symbol("clipanion/errorCommand");wa=class t{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:s,enableCapture:a=!1,enableColors:n}={}){this.registrations=new Map,this.builder=new Zx({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=s,this.enableCapture=a,this.enableColors=n}static from(e,r={}){let s=new t(r),a=Array.isArray(e)?e:[e];for(let n of a)s.register(n);return s}register(e){var r;let s=new Map,a=new e;for(let p in a){let h=a[p];typeof h=="object"&&h!==null&&h[ot.isOption]&&s.set(p,h)}let n=this.builder.command(),c=n.cliIndex,f=(r=e.paths)!==null&&r!==void 0?r:a.paths;if(typeof f<"u")for(let p of f)n.addPath(p);this.registrations.set(e,{specs:s,builder:n,index:c});for(let[p,{definition:h}]of s.entries())h(n,p);n.setContext({commandClass:e})}process(e,r){let{input:s,context:a,partial:n}=typeof e=="object"&&Array.isArray(e)?{input:e,context:r}:e,{contexts:c,process:f}=this.builder.compile(),p=f(s,{partial:n}),h={...t.defaultContext,...a};switch(p.selectedIndex){case Od:{let E=ek.from(p,c);return E.context=h,E.tokens=p.tokens,E}default:{let{commandClass:E}=c[p.selectedIndex],C=this.registrations.get(E);if(typeof C>"u")throw new Error("Assertion failed: Expected the command class to have been registered.");let S=new E;S.context=h,S.tokens=p.tokens,S.path=p.path;try{for(let[P,{transformer:I}]of C.specs.entries())S[P]=I(C.builder,P,p,h);return S}catch(P){throw P[xne]=S,P}}break}}async run(e,r){var s,a;let n,c={...t.defaultContext,...r},f=(s=this.enableColors)!==null&&s!==void 0?s:c.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e,c)}catch(E){return c.stdout.write(this.error(E,{colored:f})),1}if(n.help)return c.stdout.write(this.usage(n,{colored:f,detailed:!0})),0;n.context=c,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),definition:E=>this.definition(E),error:(E,C)=>this.error(E,C),format:E=>this.format(E),process:(E,C)=>this.process(E,{...c,...C}),run:(E,C)=>this.run(E,{...c,...C}),usage:(E,C)=>this.usage(E,C)};let p=this.enableCapture&&(a=Dne(c))!==null&&a!==void 0?a:kne,h;try{h=await p(()=>n.validateAndExecute().catch(E=>n.catch(E).then(()=>0)))}catch(E){return c.stdout.write(this.error(E,{colored:f,command:n})),1}return h}async runExit(e,r){process.exitCode=await this.run(e,r)}definition(e,{colored:r=!1}={}){if(!e.usage)return null;let{usage:s}=this.getUsageByRegistration(e,{detailed:!1}),{usage:a,options:n}=this.getUsageByRegistration(e,{detailed:!0,inlineOptions:!1}),c=typeof e.usage.category<"u"?qo(e.usage.category,{format:this.format(r),paragraphs:!1}):void 0,f=typeof e.usage.description<"u"?qo(e.usage.description,{format:this.format(r),paragraphs:!1}):void 0,p=typeof e.usage.details<"u"?qo(e.usage.details,{format:this.format(r),paragraphs:!0}):void 0,h=typeof e.usage.examples<"u"?e.usage.examples.map(([E,C])=>[qo(E,{format:this.format(r),paragraphs:!1}),C.replace(/\$0/g,this.binaryName)]):void 0;return{path:s,usage:a,category:c,description:f,details:p,examples:h,options:n}}definitions({colored:e=!1}={}){let r=[];for(let s of this.registrations.keys()){let a=this.definition(s,{colored:e});a&&r.push(a)}return r}usage(e=null,{colored:r,detailed:s=!1,prefix:a="$ "}={}){var n;if(e===null){for(let p of this.registrations.keys()){let h=p.paths,E=typeof p.usage<"u";if(!h||h.length===0||h.length===1&&h[0].length===0||((n=h?.some(P=>P.length===0))!==null&&n!==void 0?n:!1))if(e){e=null;break}else e=p;else if(E){e=null;continue}}e&&(s=!0)}let c=e!==null&&e instanceof ot?e.constructor:e,f="";if(c)if(s){let{description:p="",details:h="",examples:E=[]}=c.usage||{};p!==""&&(f+=qo(p,{format:this.format(r),paragraphs:!1}).replace(/^./,P=>P.toUpperCase()),f+=` +`),(h!==""||E.length>0)&&(f+=`${this.format(r).header("Usage")} +`,f+=` +`);let{usage:C,options:S}=this.getUsageByRegistration(c,{inlineOptions:!1});if(f+=`${this.format(r).bold(a)}${C} +`,S.length>0){f+=` +`,f+=`${this.format(r).header("Options")} +`;let P=S.reduce((I,R)=>Math.max(I,R.definition.length),0);f+=` +`;for(let{definition:I,description:R}of S)f+=` ${this.format(r).bold(I.padEnd(P))} ${qo(R,{format:this.format(r),paragraphs:!1})}`}if(h!==""&&(f+=` +`,f+=`${this.format(r).header("Details")} +`,f+=` +`,f+=qo(h,{format:this.format(r),paragraphs:!0})),E.length>0){f+=` +`,f+=`${this.format(r).header("Examples")} +`;for(let[P,I]of E)f+=` +`,f+=qo(P,{format:this.format(r),paragraphs:!1}),f+=`${I.replace(/^/m,` ${this.format(r).bold(a)}`).replace(/\$0/g,this.binaryName)} +`}}else{let{usage:p}=this.getUsageByRegistration(c);f+=`${this.format(r).bold(a)}${p} +`}else{let p=new Map;for(let[S,{index:P}]of this.registrations.entries()){if(typeof S.usage>"u")continue;let I=typeof S.usage.category<"u"?qo(S.usage.category,{format:this.format(r),paragraphs:!1}):null,R=p.get(I);typeof R>"u"&&p.set(I,R=[]);let{usage:N}=this.getUsageByIndex(P);R.push({commandClass:S,usage:N})}let h=Array.from(p.keys()).sort((S,P)=>S===null?-1:P===null?1:S.localeCompare(P,"en",{usage:"sort",caseFirst:"upper"})),E=typeof this.binaryLabel<"u",C=typeof this.binaryVersion<"u";E||C?(E&&C?f+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)} + +`:E?f+=`${this.format(r).header(`${this.binaryLabel}`)} +`:f+=`${this.format(r).header(`${this.binaryVersion}`)} +`,f+=` ${this.format(r).bold(a)}${this.binaryName} +`):f+=`${this.format(r).bold(a)}${this.binaryName} +`;for(let S of h){let P=p.get(S).slice().sort((R,N)=>R.usage.localeCompare(N.usage,"en",{usage:"sort",caseFirst:"upper"})),I=S!==null?S.trim():"General commands";f+=` +`,f+=`${this.format(r).header(`${I}`)} +`;for(let{commandClass:R,usage:N}of P){let U=R.usage.description||"undocumented";f+=` +`,f+=` ${this.format(r).bold(N)} +`,f+=` ${qo(U,{format:this.format(r),paragraphs:!1})}`}}f+=` +`,f+=qo("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return f}error(e,r){var s,{colored:a,command:n=(s=e[xne])!==null&&s!==void 0?s:null}=r===void 0?{}:r;(!e||typeof e!="object"||!("stack"in e))&&(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let c="",f=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");f==="Error"&&(f="Internal Error"),c+=`${this.format(a).error(f)}: ${e.message} +`;let p=e.clipanion;return typeof p<"u"?p.type==="usage"&&(c+=` +`,c+=this.usage(n)):e.stack&&(c+=`${e.stack.replace(/^.*\n/,"")} +`),c}format(e){var r;return((r=e??this.enableColors)!==null&&r!==void 0?r:t.defaultContext.colorDepth>1)?pne:hne}getUsageByRegistration(e,r){let s=this.registrations.get(e);if(typeof s>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(s.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}};wa.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:Sne()}});var sB,Nne=It(()=>{u0();sB=class extends ot{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)} +`)}};sB.paths=[["--clipanion=definitions"]]});var oB,One=It(()=>{u0();oB=class extends ot{async execute(){this.context.stdout.write(this.cli.usage())}};oB.paths=[["-h"],["--help"]]});function tk(t={}){return Ea({definition(e,r){var s;e.addProxy({name:(s=t.name)!==null&&s!==void 0?s:r,required:t.required})},transformer(e,r,s){return s.positionals.map(({value:a})=>a)}})}var QU=It(()=>{Bp()});var aB,Lne=It(()=>{u0();QU();aB=class extends ot{constructor(){super(...arguments),this.args=tk()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)} +`)}};aB.paths=[["--clipanion=tokens"]]});var lB,Mne=It(()=>{u0();lB=class extends ot{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:""} +`)}};lB.paths=[["-v"],["--version"]]});var TU={};Vt(TU,{DefinitionsCommand:()=>sB,HelpCommand:()=>oB,TokensCommand:()=>aB,VersionCommand:()=>lB});var _ne=It(()=>{Nne();One();Lne();Mne()});function Une(t,e,r){let[s,a]=Gf(e,r??{}),{arity:n=1}=a,c=t.split(","),f=new Set(c);return Ea({definition(p){p.addOption({names:c,arity:n,hidden:a?.hidden,description:a?.description,required:a.required})},transformer(p,h,E){let C,S=typeof s<"u"?[...s]:void 0;for(let{name:P,value:I}of E.options)f.has(P)&&(C=P,S=S??[],S.push(I));return typeof S<"u"?Ld(C??h,S,a.validator):S}})}var Hne=It(()=>{Bp()});function jne(t,e,r){let[s,a]=Gf(e,r??{}),n=t.split(","),c=new Set(n);return Ea({definition(f){f.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(f,p,h){let E=s;for(let{name:C,value:S}of h.options)c.has(C)&&(E=S);return E}})}var qne=It(()=>{Bp()});function Gne(t,e,r){let[s,a]=Gf(e,r??{}),n=t.split(","),c=new Set(n);return Ea({definition(f){f.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(f,p,h){let E=s;for(let{name:C,value:S}of h.options)c.has(C)&&(E??(E=0),S?E+=1:E=0);return E}})}var Wne=It(()=>{Bp()});function Yne(t={}){return Ea({definition(e,r){var s;e.addRest({name:(s=t.name)!==null&&s!==void 0?s:r,required:t.required})},transformer(e,r,s){let a=c=>{let f=s.positionals[c];return f.extra===jl||f.extra===!1&&cc)}})}var Vne=It(()=>{Xx();Bp()});function sXe(t,e,r){let[s,a]=Gf(e,r??{}),{arity:n=1}=a,c=t.split(","),f=new Set(c);return Ea({definition(p){p.addOption({names:c,arity:a.tolerateBoolean?0:n,hidden:a.hidden,description:a.description,required:a.required})},transformer(p,h,E,C){let S,P=s;typeof a.env<"u"&&C.env[a.env]&&(S=a.env,P=C.env[a.env]);for(let{name:I,value:R}of E.options)f.has(I)&&(S=I,P=R);return typeof P=="string"?Ld(S??h,P,a.validator):P}})}function oXe(t={}){let{required:e=!0}=t;return Ea({definition(r,s){var a;r.addPositional({name:(a=t.name)!==null&&a!==void 0?a:s,required:t.required})},transformer(r,s,a){var n;for(let c=0;c{Xx();Bp()});var ge={};Vt(ge,{Array:()=>Une,Boolean:()=>jne,Counter:()=>Gne,Proxy:()=>tk,Rest:()=>Yne,String:()=>Kne,applyValidator:()=>Ld,cleanValidationError:()=>Wx,formatError:()=>$2,isOptionSymbol:()=>X2,makeCommandOption:()=>Ea,rerouteArguments:()=>Gf});var zne=It(()=>{Bp();QU();Hne();qne();Wne();Vne();Jne()});var cB={};Vt(cB,{Builtins:()=>TU,Cli:()=>wa,Command:()=>ot,Option:()=>ge,UsageError:()=>nt,formatMarkdownish:()=>qo,run:()=>Tne,runExit:()=>Qne});var Wt=It(()=>{Gx();IU();u0();Fne();_ne();zne()});var Zne=L((RWt,aXe)=>{aXe.exports={name:"dotenv",version:"16.3.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://github.com/motdotla/dotenv?sponsor=1",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var tie=L((FWt,vp)=>{var Xne=ye("fs"),FU=ye("path"),lXe=ye("os"),cXe=ye("crypto"),uXe=Zne(),NU=uXe.version,fXe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function AXe(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,` +`);let s;for(;(s=fXe.exec(r))!=null;){let a=s[1],n=s[2]||"";n=n.trim();let c=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),c==='"'&&(n=n.replace(/\\n/g,` +`),n=n.replace(/\\r/g,"\r")),e[a]=n}return e}function pXe(t){let e=eie(t),r=qs.configDotenv({path:e});if(!r.parsed)throw new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);let s=$ne(t).split(","),a=s.length,n;for(let c=0;c=a)throw f}return qs.parse(n)}function hXe(t){console.log(`[dotenv@${NU}][INFO] ${t}`)}function gXe(t){console.log(`[dotenv@${NU}][WARN] ${t}`)}function RU(t){console.log(`[dotenv@${NU}][DEBUG] ${t}`)}function $ne(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function dXe(t,e){let r;try{r=new URL(e)}catch(f){throw f.code==="ERR_INVALID_URL"?new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development"):f}let s=r.password;if(!s)throw new Error("INVALID_DOTENV_KEY: Missing key part");let a=r.searchParams.get("environment");if(!a)throw new Error("INVALID_DOTENV_KEY: Missing environment part");let n=`DOTENV_VAULT_${a.toUpperCase()}`,c=t.parsed[n];if(!c)throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);return{ciphertext:c,key:s}}function eie(t){let e=FU.resolve(process.cwd(),".env");return t&&t.path&&t.path.length>0&&(e=t.path),e.endsWith(".vault")?e:`${e}.vault`}function mXe(t){return t[0]==="~"?FU.join(lXe.homedir(),t.slice(1)):t}function yXe(t){hXe("Loading env from encrypted .env.vault");let e=qs._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),qs.populate(r,e,t),{parsed:e}}function EXe(t){let e=FU.resolve(process.cwd(),".env"),r="utf8",s=!!(t&&t.debug);t&&(t.path!=null&&(e=mXe(t.path)),t.encoding!=null&&(r=t.encoding));try{let a=qs.parse(Xne.readFileSync(e,{encoding:r})),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),qs.populate(n,a,t),{parsed:a}}catch(a){return s&&RU(`Failed to load ${e} ${a.message}`),{error:a}}}function IXe(t){let e=eie(t);return $ne(t).length===0?qs.configDotenv(t):Xne.existsSync(e)?qs._configVault(t):(gXe(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),qs.configDotenv(t))}function CXe(t,e){let r=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),a=s.slice(0,12),n=s.slice(-16);s=s.slice(12,-16);try{let c=cXe.createDecipheriv("aes-256-gcm",r,a);return c.setAuthTag(n),`${c.update(s)}${c.final()}`}catch(c){let f=c instanceof RangeError,p=c.message==="Invalid key length",h=c.message==="Unsupported state or unable to authenticate data";if(f||p){let E="INVALID_DOTENV_KEY: It must be 64 characters long (or more)";throw new Error(E)}else if(h){let E="DECRYPTION_FAILED: Please check your DOTENV_KEY";throw new Error(E)}else throw console.error("Error: ",c.code),console.error("Error: ",c.message),c}}function wXe(t,e,r={}){let s=!!(r&&r.debug),a=!!(r&&r.override);if(typeof e!="object")throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");for(let n of Object.keys(e))Object.prototype.hasOwnProperty.call(t,n)?(a===!0&&(t[n]=e[n]),s&&RU(a===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):t[n]=e[n]}var qs={configDotenv:EXe,_configVault:yXe,_parseVault:pXe,config:IXe,decrypt:CXe,parse:AXe,populate:wXe};vp.exports.configDotenv=qs.configDotenv;vp.exports._configVault=qs._configVault;vp.exports._parseVault=qs._parseVault;vp.exports.config=qs.config;vp.exports.decrypt=qs.decrypt;vp.exports.parse=qs.parse;vp.exports.populate=qs.populate;vp.exports=qs});var nie=L((NWt,rie)=>{"use strict";rie.exports=(t,...e)=>new Promise(r=>{r(t(...e))})});var Md=L((OWt,OU)=>{"use strict";var BXe=nie(),iie=t=>{if(t<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],r=0,s=()=>{r--,e.length>0&&e.shift()()},a=(f,p,...h)=>{r++;let E=BXe(f,...h);p(E),E.then(s,s)},n=(f,p,...h)=>{rnew Promise(h=>n(f,h,...p));return Object.defineProperties(c,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length}}),c};OU.exports=iie;OU.exports.default=iie});function Vf(t){return`YN${t.toString(10).padStart(4,"0")}`}function rk(t){let e=Number(t.slice(2));if(typeof Dr[e]>"u")throw new Error(`Unknown message name: "${t}"`);return e}var Dr,nk=It(()=>{Dr=(Me=>(Me[Me.UNNAMED=0]="UNNAMED",Me[Me.EXCEPTION=1]="EXCEPTION",Me[Me.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",Me[Me.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",Me[Me.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",Me[Me.BUILD_DISABLED=5]="BUILD_DISABLED",Me[Me.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",Me[Me.MUST_BUILD=7]="MUST_BUILD",Me[Me.MUST_REBUILD=8]="MUST_REBUILD",Me[Me.BUILD_FAILED=9]="BUILD_FAILED",Me[Me.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",Me[Me.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",Me[Me.LINKER_NOT_FOUND=12]="LINKER_NOT_FOUND",Me[Me.FETCH_NOT_CACHED=13]="FETCH_NOT_CACHED",Me[Me.YARN_IMPORT_FAILED=14]="YARN_IMPORT_FAILED",Me[Me.REMOTE_INVALID=15]="REMOTE_INVALID",Me[Me.REMOTE_NOT_FOUND=16]="REMOTE_NOT_FOUND",Me[Me.RESOLUTION_PACK=17]="RESOLUTION_PACK",Me[Me.CACHE_CHECKSUM_MISMATCH=18]="CACHE_CHECKSUM_MISMATCH",Me[Me.UNUSED_CACHE_ENTRY=19]="UNUSED_CACHE_ENTRY",Me[Me.MISSING_LOCKFILE_ENTRY=20]="MISSING_LOCKFILE_ENTRY",Me[Me.WORKSPACE_NOT_FOUND=21]="WORKSPACE_NOT_FOUND",Me[Me.TOO_MANY_MATCHING_WORKSPACES=22]="TOO_MANY_MATCHING_WORKSPACES",Me[Me.CONSTRAINTS_MISSING_DEPENDENCY=23]="CONSTRAINTS_MISSING_DEPENDENCY",Me[Me.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY=24]="CONSTRAINTS_INCOMPATIBLE_DEPENDENCY",Me[Me.CONSTRAINTS_EXTRANEOUS_DEPENDENCY=25]="CONSTRAINTS_EXTRANEOUS_DEPENDENCY",Me[Me.CONSTRAINTS_INVALID_DEPENDENCY=26]="CONSTRAINTS_INVALID_DEPENDENCY",Me[Me.CANT_SUGGEST_RESOLUTIONS=27]="CANT_SUGGEST_RESOLUTIONS",Me[Me.FROZEN_LOCKFILE_EXCEPTION=28]="FROZEN_LOCKFILE_EXCEPTION",Me[Me.CROSS_DRIVE_VIRTUAL_LOCAL=29]="CROSS_DRIVE_VIRTUAL_LOCAL",Me[Me.FETCH_FAILED=30]="FETCH_FAILED",Me[Me.DANGEROUS_NODE_MODULES=31]="DANGEROUS_NODE_MODULES",Me[Me.NODE_GYP_INJECTED=32]="NODE_GYP_INJECTED",Me[Me.AUTHENTICATION_NOT_FOUND=33]="AUTHENTICATION_NOT_FOUND",Me[Me.INVALID_CONFIGURATION_KEY=34]="INVALID_CONFIGURATION_KEY",Me[Me.NETWORK_ERROR=35]="NETWORK_ERROR",Me[Me.LIFECYCLE_SCRIPT=36]="LIFECYCLE_SCRIPT",Me[Me.CONSTRAINTS_MISSING_FIELD=37]="CONSTRAINTS_MISSING_FIELD",Me[Me.CONSTRAINTS_INCOMPATIBLE_FIELD=38]="CONSTRAINTS_INCOMPATIBLE_FIELD",Me[Me.CONSTRAINTS_EXTRANEOUS_FIELD=39]="CONSTRAINTS_EXTRANEOUS_FIELD",Me[Me.CONSTRAINTS_INVALID_FIELD=40]="CONSTRAINTS_INVALID_FIELD",Me[Me.AUTHENTICATION_INVALID=41]="AUTHENTICATION_INVALID",Me[Me.PROLOG_UNKNOWN_ERROR=42]="PROLOG_UNKNOWN_ERROR",Me[Me.PROLOG_SYNTAX_ERROR=43]="PROLOG_SYNTAX_ERROR",Me[Me.PROLOG_EXISTENCE_ERROR=44]="PROLOG_EXISTENCE_ERROR",Me[Me.STACK_OVERFLOW_RESOLUTION=45]="STACK_OVERFLOW_RESOLUTION",Me[Me.AUTOMERGE_FAILED_TO_PARSE=46]="AUTOMERGE_FAILED_TO_PARSE",Me[Me.AUTOMERGE_IMMUTABLE=47]="AUTOMERGE_IMMUTABLE",Me[Me.AUTOMERGE_SUCCESS=48]="AUTOMERGE_SUCCESS",Me[Me.AUTOMERGE_REQUIRED=49]="AUTOMERGE_REQUIRED",Me[Me.DEPRECATED_CLI_SETTINGS=50]="DEPRECATED_CLI_SETTINGS",Me[Me.PLUGIN_NAME_NOT_FOUND=51]="PLUGIN_NAME_NOT_FOUND",Me[Me.INVALID_PLUGIN_REFERENCE=52]="INVALID_PLUGIN_REFERENCE",Me[Me.CONSTRAINTS_AMBIGUITY=53]="CONSTRAINTS_AMBIGUITY",Me[Me.CACHE_OUTSIDE_PROJECT=54]="CACHE_OUTSIDE_PROJECT",Me[Me.IMMUTABLE_INSTALL=55]="IMMUTABLE_INSTALL",Me[Me.IMMUTABLE_CACHE=56]="IMMUTABLE_CACHE",Me[Me.INVALID_MANIFEST=57]="INVALID_MANIFEST",Me[Me.PACKAGE_PREPARATION_FAILED=58]="PACKAGE_PREPARATION_FAILED",Me[Me.INVALID_RANGE_PEER_DEPENDENCY=59]="INVALID_RANGE_PEER_DEPENDENCY",Me[Me.INCOMPATIBLE_PEER_DEPENDENCY=60]="INCOMPATIBLE_PEER_DEPENDENCY",Me[Me.DEPRECATED_PACKAGE=61]="DEPRECATED_PACKAGE",Me[Me.INCOMPATIBLE_OS=62]="INCOMPATIBLE_OS",Me[Me.INCOMPATIBLE_CPU=63]="INCOMPATIBLE_CPU",Me[Me.FROZEN_ARTIFACT_EXCEPTION=64]="FROZEN_ARTIFACT_EXCEPTION",Me[Me.TELEMETRY_NOTICE=65]="TELEMETRY_NOTICE",Me[Me.PATCH_HUNK_FAILED=66]="PATCH_HUNK_FAILED",Me[Me.INVALID_CONFIGURATION_VALUE=67]="INVALID_CONFIGURATION_VALUE",Me[Me.UNUSED_PACKAGE_EXTENSION=68]="UNUSED_PACKAGE_EXTENSION",Me[Me.REDUNDANT_PACKAGE_EXTENSION=69]="REDUNDANT_PACKAGE_EXTENSION",Me[Me.AUTO_NM_SUCCESS=70]="AUTO_NM_SUCCESS",Me[Me.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK=71]="NM_CANT_INSTALL_EXTERNAL_SOFT_LINK",Me[Me.NM_PRESERVE_SYMLINKS_REQUIRED=72]="NM_PRESERVE_SYMLINKS_REQUIRED",Me[Me.UPDATE_LOCKFILE_ONLY_SKIP_LINK=73]="UPDATE_LOCKFILE_ONLY_SKIP_LINK",Me[Me.NM_HARDLINKS_MODE_DOWNGRADED=74]="NM_HARDLINKS_MODE_DOWNGRADED",Me[Me.PROLOG_INSTANTIATION_ERROR=75]="PROLOG_INSTANTIATION_ERROR",Me[Me.INCOMPATIBLE_ARCHITECTURE=76]="INCOMPATIBLE_ARCHITECTURE",Me[Me.GHOST_ARCHITECTURE=77]="GHOST_ARCHITECTURE",Me[Me.RESOLUTION_MISMATCH=78]="RESOLUTION_MISMATCH",Me[Me.PROLOG_LIMIT_EXCEEDED=79]="PROLOG_LIMIT_EXCEEDED",Me[Me.NETWORK_DISABLED=80]="NETWORK_DISABLED",Me[Me.NETWORK_UNSAFE_HTTP=81]="NETWORK_UNSAFE_HTTP",Me[Me.RESOLUTION_FAILED=82]="RESOLUTION_FAILED",Me[Me.AUTOMERGE_GIT_ERROR=83]="AUTOMERGE_GIT_ERROR",Me[Me.CONSTRAINTS_CHECK_FAILED=84]="CONSTRAINTS_CHECK_FAILED",Me[Me.UPDATED_RESOLUTION_RECORD=85]="UPDATED_RESOLUTION_RECORD",Me[Me.EXPLAIN_PEER_DEPENDENCIES_CTA=86]="EXPLAIN_PEER_DEPENDENCIES_CTA",Me[Me.MIGRATION_SUCCESS=87]="MIGRATION_SUCCESS",Me[Me.VERSION_NOTICE=88]="VERSION_NOTICE",Me[Me.TIPS_NOTICE=89]="TIPS_NOTICE",Me[Me.OFFLINE_MODE_ENABLED=90]="OFFLINE_MODE_ENABLED",Me[Me.INVALID_PROVENANCE_ENVIRONMENT=91]="INVALID_PROVENANCE_ENVIRONMENT",Me))(Dr||{})});var uB=L((MWt,sie)=>{var vXe="2.0.0",SXe=Number.MAX_SAFE_INTEGER||9007199254740991,DXe=16,bXe=250,PXe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];sie.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:DXe,MAX_SAFE_BUILD_LENGTH:bXe,MAX_SAFE_INTEGER:SXe,RELEASE_TYPES:PXe,SEMVER_SPEC_VERSION:vXe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var fB=L((_Wt,oie)=>{var xXe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};oie.exports=xXe});var vE=L((Sp,aie)=>{var{MAX_SAFE_COMPONENT_LENGTH:LU,MAX_SAFE_BUILD_LENGTH:kXe,MAX_LENGTH:QXe}=uB(),TXe=fB();Sp=aie.exports={};var RXe=Sp.re=[],FXe=Sp.safeRe=[],rr=Sp.src=[],nr=Sp.t={},NXe=0,MU="[a-zA-Z0-9-]",OXe=[["\\s",1],["\\d",QXe],[MU,kXe]],LXe=t=>{for(let[e,r]of OXe)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Kr=(t,e,r)=>{let s=LXe(e),a=NXe++;TXe(t,a,e),nr[t]=a,rr[a]=e,RXe[a]=new RegExp(e,r?"g":void 0),FXe[a]=new RegExp(s,r?"g":void 0)};Kr("NUMERICIDENTIFIER","0|[1-9]\\d*");Kr("NUMERICIDENTIFIERLOOSE","\\d+");Kr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${MU}*`);Kr("MAINVERSION",`(${rr[nr.NUMERICIDENTIFIER]})\\.(${rr[nr.NUMERICIDENTIFIER]})\\.(${rr[nr.NUMERICIDENTIFIER]})`);Kr("MAINVERSIONLOOSE",`(${rr[nr.NUMERICIDENTIFIERLOOSE]})\\.(${rr[nr.NUMERICIDENTIFIERLOOSE]})\\.(${rr[nr.NUMERICIDENTIFIERLOOSE]})`);Kr("PRERELEASEIDENTIFIER",`(?:${rr[nr.NUMERICIDENTIFIER]}|${rr[nr.NONNUMERICIDENTIFIER]})`);Kr("PRERELEASEIDENTIFIERLOOSE",`(?:${rr[nr.NUMERICIDENTIFIERLOOSE]}|${rr[nr.NONNUMERICIDENTIFIER]})`);Kr("PRERELEASE",`(?:-(${rr[nr.PRERELEASEIDENTIFIER]}(?:\\.${rr[nr.PRERELEASEIDENTIFIER]})*))`);Kr("PRERELEASELOOSE",`(?:-?(${rr[nr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${rr[nr.PRERELEASEIDENTIFIERLOOSE]})*))`);Kr("BUILDIDENTIFIER",`${MU}+`);Kr("BUILD",`(?:\\+(${rr[nr.BUILDIDENTIFIER]}(?:\\.${rr[nr.BUILDIDENTIFIER]})*))`);Kr("FULLPLAIN",`v?${rr[nr.MAINVERSION]}${rr[nr.PRERELEASE]}?${rr[nr.BUILD]}?`);Kr("FULL",`^${rr[nr.FULLPLAIN]}$`);Kr("LOOSEPLAIN",`[v=\\s]*${rr[nr.MAINVERSIONLOOSE]}${rr[nr.PRERELEASELOOSE]}?${rr[nr.BUILD]}?`);Kr("LOOSE",`^${rr[nr.LOOSEPLAIN]}$`);Kr("GTLT","((?:<|>)?=?)");Kr("XRANGEIDENTIFIERLOOSE",`${rr[nr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Kr("XRANGEIDENTIFIER",`${rr[nr.NUMERICIDENTIFIER]}|x|X|\\*`);Kr("XRANGEPLAIN",`[v=\\s]*(${rr[nr.XRANGEIDENTIFIER]})(?:\\.(${rr[nr.XRANGEIDENTIFIER]})(?:\\.(${rr[nr.XRANGEIDENTIFIER]})(?:${rr[nr.PRERELEASE]})?${rr[nr.BUILD]}?)?)?`);Kr("XRANGEPLAINLOOSE",`[v=\\s]*(${rr[nr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${rr[nr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${rr[nr.XRANGEIDENTIFIERLOOSE]})(?:${rr[nr.PRERELEASELOOSE]})?${rr[nr.BUILD]}?)?)?`);Kr("XRANGE",`^${rr[nr.GTLT]}\\s*${rr[nr.XRANGEPLAIN]}$`);Kr("XRANGELOOSE",`^${rr[nr.GTLT]}\\s*${rr[nr.XRANGEPLAINLOOSE]}$`);Kr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${LU}})(?:\\.(\\d{1,${LU}}))?(?:\\.(\\d{1,${LU}}))?`);Kr("COERCE",`${rr[nr.COERCEPLAIN]}(?:$|[^\\d])`);Kr("COERCEFULL",rr[nr.COERCEPLAIN]+`(?:${rr[nr.PRERELEASE]})?(?:${rr[nr.BUILD]})?(?:$|[^\\d])`);Kr("COERCERTL",rr[nr.COERCE],!0);Kr("COERCERTLFULL",rr[nr.COERCEFULL],!0);Kr("LONETILDE","(?:~>?)");Kr("TILDETRIM",`(\\s*)${rr[nr.LONETILDE]}\\s+`,!0);Sp.tildeTrimReplace="$1~";Kr("TILDE",`^${rr[nr.LONETILDE]}${rr[nr.XRANGEPLAIN]}$`);Kr("TILDELOOSE",`^${rr[nr.LONETILDE]}${rr[nr.XRANGEPLAINLOOSE]}$`);Kr("LONECARET","(?:\\^)");Kr("CARETTRIM",`(\\s*)${rr[nr.LONECARET]}\\s+`,!0);Sp.caretTrimReplace="$1^";Kr("CARET",`^${rr[nr.LONECARET]}${rr[nr.XRANGEPLAIN]}$`);Kr("CARETLOOSE",`^${rr[nr.LONECARET]}${rr[nr.XRANGEPLAINLOOSE]}$`);Kr("COMPARATORLOOSE",`^${rr[nr.GTLT]}\\s*(${rr[nr.LOOSEPLAIN]})$|^$`);Kr("COMPARATOR",`^${rr[nr.GTLT]}\\s*(${rr[nr.FULLPLAIN]})$|^$`);Kr("COMPARATORTRIM",`(\\s*)${rr[nr.GTLT]}\\s*(${rr[nr.LOOSEPLAIN]}|${rr[nr.XRANGEPLAIN]})`,!0);Sp.comparatorTrimReplace="$1$2$3";Kr("HYPHENRANGE",`^\\s*(${rr[nr.XRANGEPLAIN]})\\s+-\\s+(${rr[nr.XRANGEPLAIN]})\\s*$`);Kr("HYPHENRANGELOOSE",`^\\s*(${rr[nr.XRANGEPLAINLOOSE]})\\s+-\\s+(${rr[nr.XRANGEPLAINLOOSE]})\\s*$`);Kr("STAR","(<|>)?=?\\s*\\*");Kr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Kr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ik=L((UWt,lie)=>{var MXe=Object.freeze({loose:!0}),_Xe=Object.freeze({}),UXe=t=>t?typeof t!="object"?MXe:t:_Xe;lie.exports=UXe});var _U=L((HWt,fie)=>{var cie=/^[0-9]+$/,uie=(t,e)=>{let r=cie.test(t),s=cie.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:tuie(e,t);fie.exports={compareIdentifiers:uie,rcompareIdentifiers:HXe}});var Go=L((jWt,gie)=>{var sk=fB(),{MAX_LENGTH:Aie,MAX_SAFE_INTEGER:ok}=uB(),{safeRe:pie,t:hie}=vE(),jXe=ik(),{compareIdentifiers:SE}=_U(),UU=class t{constructor(e,r){if(r=jXe(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Aie)throw new TypeError(`version is longer than ${Aie} characters`);sk("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?pie[hie.LOOSE]:pie[hie.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>ok||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ok||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ok||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(a=>{if(/^[0-9]+$/.test(a)){let n=+a;if(n>=0&&n=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(a)}}if(r){let n=[r,a];s===!1&&(n=[r]),SE(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};gie.exports=UU});var _d=L((qWt,mie)=>{var die=Go(),qXe=(t,e,r=!1)=>{if(t instanceof die)return t;try{return new die(t,e)}catch(s){if(!r)return null;throw s}};mie.exports=qXe});var Eie=L((GWt,yie)=>{var GXe=_d(),WXe=(t,e)=>{let r=GXe(t,e);return r?r.version:null};yie.exports=WXe});var Cie=L((WWt,Iie)=>{var YXe=_d(),VXe=(t,e)=>{let r=YXe(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Iie.exports=VXe});var vie=L((YWt,Bie)=>{var wie=Go(),KXe=(t,e,r,s,a)=>{typeof r=="string"&&(a=s,s=r,r=void 0);try{return new wie(t instanceof wie?t.version:t,r).inc(e,s,a).version}catch{return null}};Bie.exports=KXe});var bie=L((VWt,Die)=>{var Sie=_d(),JXe=(t,e)=>{let r=Sie(t,null,!0),s=Sie(e,null,!0),a=r.compare(s);if(a===0)return null;let n=a>0,c=n?r:s,f=n?s:r,p=!!c.prerelease.length;if(!!f.prerelease.length&&!p)return!f.patch&&!f.minor?"major":c.patch?"patch":c.minor?"minor":"major";let E=p?"pre":"";return r.major!==s.major?E+"major":r.minor!==s.minor?E+"minor":r.patch!==s.patch?E+"patch":"prerelease"};Die.exports=JXe});var xie=L((KWt,Pie)=>{var zXe=Go(),ZXe=(t,e)=>new zXe(t,e).major;Pie.exports=ZXe});var Qie=L((JWt,kie)=>{var XXe=Go(),$Xe=(t,e)=>new XXe(t,e).minor;kie.exports=$Xe});var Rie=L((zWt,Tie)=>{var e$e=Go(),t$e=(t,e)=>new e$e(t,e).patch;Tie.exports=t$e});var Nie=L((ZWt,Fie)=>{var r$e=_d(),n$e=(t,e)=>{let r=r$e(t,e);return r&&r.prerelease.length?r.prerelease:null};Fie.exports=n$e});var vc=L((XWt,Lie)=>{var Oie=Go(),i$e=(t,e,r)=>new Oie(t,r).compare(new Oie(e,r));Lie.exports=i$e});var _ie=L(($Wt,Mie)=>{var s$e=vc(),o$e=(t,e,r)=>s$e(e,t,r);Mie.exports=o$e});var Hie=L((eYt,Uie)=>{var a$e=vc(),l$e=(t,e)=>a$e(t,e,!0);Uie.exports=l$e});var ak=L((tYt,qie)=>{var jie=Go(),c$e=(t,e,r)=>{let s=new jie(t,r),a=new jie(e,r);return s.compare(a)||s.compareBuild(a)};qie.exports=c$e});var Wie=L((rYt,Gie)=>{var u$e=ak(),f$e=(t,e)=>t.sort((r,s)=>u$e(r,s,e));Gie.exports=f$e});var Vie=L((nYt,Yie)=>{var A$e=ak(),p$e=(t,e)=>t.sort((r,s)=>A$e(s,r,e));Yie.exports=p$e});var AB=L((iYt,Kie)=>{var h$e=vc(),g$e=(t,e,r)=>h$e(t,e,r)>0;Kie.exports=g$e});var lk=L((sYt,Jie)=>{var d$e=vc(),m$e=(t,e,r)=>d$e(t,e,r)<0;Jie.exports=m$e});var HU=L((oYt,zie)=>{var y$e=vc(),E$e=(t,e,r)=>y$e(t,e,r)===0;zie.exports=E$e});var jU=L((aYt,Zie)=>{var I$e=vc(),C$e=(t,e,r)=>I$e(t,e,r)!==0;Zie.exports=C$e});var ck=L((lYt,Xie)=>{var w$e=vc(),B$e=(t,e,r)=>w$e(t,e,r)>=0;Xie.exports=B$e});var uk=L((cYt,$ie)=>{var v$e=vc(),S$e=(t,e,r)=>v$e(t,e,r)<=0;$ie.exports=S$e});var qU=L((uYt,ese)=>{var D$e=HU(),b$e=jU(),P$e=AB(),x$e=ck(),k$e=lk(),Q$e=uk(),T$e=(t,e,r,s)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return D$e(t,r,s);case"!=":return b$e(t,r,s);case">":return P$e(t,r,s);case">=":return x$e(t,r,s);case"<":return k$e(t,r,s);case"<=":return Q$e(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};ese.exports=T$e});var rse=L((fYt,tse)=>{var R$e=Go(),F$e=_d(),{safeRe:fk,t:Ak}=vE(),N$e=(t,e)=>{if(t instanceof R$e)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?fk[Ak.COERCEFULL]:fk[Ak.COERCE]);else{let p=e.includePrerelease?fk[Ak.COERCERTLFULL]:fk[Ak.COERCERTL],h;for(;(h=p.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),p.lastIndex=h.index+h[1].length+h[2].length;p.lastIndex=-1}if(r===null)return null;let s=r[2],a=r[3]||"0",n=r[4]||"0",c=e.includePrerelease&&r[5]?`-${r[5]}`:"",f=e.includePrerelease&&r[6]?`+${r[6]}`:"";return F$e(`${s}.${a}.${n}${c}${f}`,e)};tse.exports=N$e});var ise=L((AYt,nse)=>{"use strict";nse.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var pk=L((pYt,sse)=>{"use strict";sse.exports=Fn;Fn.Node=Ud;Fn.create=Fn;function Fn(t){var e=this;if(e instanceof Fn||(e=new Fn),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(a){e.push(a)});else if(arguments.length>0)for(var r=0,s=arguments.length;r1)r=e;else if(this.head)s=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;s!==null;a++)r=t(r,s.value,a),s=s.next;return r};Fn.prototype.reduceReverse=function(t,e){var r,s=this.tail;if(arguments.length>1)r=e;else if(this.tail)s=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;s!==null;a--)r=t(r,s.value,a),s=s.prev;return r};Fn.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};Fn.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};Fn.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new Fn;if(ethis.length&&(e=this.length);for(var s=0,a=this.head;a!==null&&sthis.length&&(e=this.length);for(var s=this.length,a=this.tail;a!==null&&s>e;s--)a=a.prev;for(;a!==null&&s>t;s--,a=a.prev)r.push(a.value);return r};Fn.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var s=0,a=this.head;a!==null&&s{"use strict";var _$e=pk(),Hd=Symbol("max"),bp=Symbol("length"),DE=Symbol("lengthCalculator"),hB=Symbol("allowStale"),jd=Symbol("maxAge"),Dp=Symbol("dispose"),ose=Symbol("noDisposeOnSet"),Gs=Symbol("lruList"),_u=Symbol("cache"),lse=Symbol("updateAgeOnGet"),GU=()=>1,YU=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[Hd]=e.max||1/0,s=e.length||GU;if(this[DE]=typeof s!="function"?GU:s,this[hB]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[jd]=e.maxAge||0,this[Dp]=e.dispose,this[ose]=e.noDisposeOnSet||!1,this[lse]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[Hd]=e||1/0,pB(this)}get max(){return this[Hd]}set allowStale(e){this[hB]=!!e}get allowStale(){return this[hB]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[jd]=e,pB(this)}get maxAge(){return this[jd]}set lengthCalculator(e){typeof e!="function"&&(e=GU),e!==this[DE]&&(this[DE]=e,this[bp]=0,this[Gs].forEach(r=>{r.length=this[DE](r.value,r.key),this[bp]+=r.length})),pB(this)}get lengthCalculator(){return this[DE]}get length(){return this[bp]}get itemCount(){return this[Gs].length}rforEach(e,r){r=r||this;for(let s=this[Gs].tail;s!==null;){let a=s.prev;ase(this,e,s,r),s=a}}forEach(e,r){r=r||this;for(let s=this[Gs].head;s!==null;){let a=s.next;ase(this,e,s,r),s=a}}keys(){return this[Gs].toArray().map(e=>e.key)}values(){return this[Gs].toArray().map(e=>e.value)}reset(){this[Dp]&&this[Gs]&&this[Gs].length&&this[Gs].forEach(e=>this[Dp](e.key,e.value)),this[_u]=new Map,this[Gs]=new _$e,this[bp]=0}dump(){return this[Gs].map(e=>hk(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[Gs]}set(e,r,s){if(s=s||this[jd],s&&typeof s!="number")throw new TypeError("maxAge must be a number");let a=s?Date.now():0,n=this[DE](r,e);if(this[_u].has(e)){if(n>this[Hd])return bE(this,this[_u].get(e)),!1;let p=this[_u].get(e).value;return this[Dp]&&(this[ose]||this[Dp](e,p.value)),p.now=a,p.maxAge=s,p.value=r,this[bp]+=n-p.length,p.length=n,this.get(e),pB(this),!0}let c=new VU(e,r,n,a,s);return c.length>this[Hd]?(this[Dp]&&this[Dp](e,r),!1):(this[bp]+=c.length,this[Gs].unshift(c),this[_u].set(e,this[Gs].head),pB(this),!0)}has(e){if(!this[_u].has(e))return!1;let r=this[_u].get(e).value;return!hk(this,r)}get(e){return WU(this,e,!0)}peek(e){return WU(this,e,!1)}pop(){let e=this[Gs].tail;return e?(bE(this,e),e.value):null}del(e){bE(this,this[_u].get(e))}load(e){this.reset();let r=Date.now();for(let s=e.length-1;s>=0;s--){let a=e[s],n=a.e||0;if(n===0)this.set(a.k,a.v);else{let c=n-r;c>0&&this.set(a.k,a.v,c)}}}prune(){this[_u].forEach((e,r)=>WU(this,r,!1))}},WU=(t,e,r)=>{let s=t[_u].get(e);if(s){let a=s.value;if(hk(t,a)){if(bE(t,s),!t[hB])return}else r&&(t[lse]&&(s.value.now=Date.now()),t[Gs].unshiftNode(s));return a.value}},hk=(t,e)=>{if(!e||!e.maxAge&&!t[jd])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[jd]&&r>t[jd]},pB=t=>{if(t[bp]>t[Hd])for(let e=t[Gs].tail;t[bp]>t[Hd]&&e!==null;){let r=e.prev;bE(t,e),e=r}},bE=(t,e)=>{if(e){let r=e.value;t[Dp]&&t[Dp](r.key,r.value),t[bp]-=r.length,t[_u].delete(r.key),t[Gs].removeNode(e)}},VU=class{constructor(e,r,s,a,n){this.key=e,this.value=r,this.length=s,this.now=a,this.maxAge=n||0}},ase=(t,e,r,s)=>{let a=r.value;hk(t,a)&&(bE(t,r),t[hB]||(a=void 0)),a&&e.call(s,a.value,a.key,t)};cse.exports=YU});var Sc=L((gYt,hse)=>{var KU=class t{constructor(e,r){if(r=H$e(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof JU)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(a=>!Ase(a[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let a of this.set)if(a.length===1&&K$e(a[0])){this.set=[a];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&Y$e)|(this.options.loose&&V$e))+":"+e,a=fse.get(s);if(a)return a;let n=this.options.loose,c=n?ol[Ba.HYPHENRANGELOOSE]:ol[Ba.HYPHENRANGE];e=e.replace(c,iet(this.options.includePrerelease)),vi("hyphen replace",e),e=e.replace(ol[Ba.COMPARATORTRIM],q$e),vi("comparator trim",e),e=e.replace(ol[Ba.TILDETRIM],G$e),vi("tilde trim",e),e=e.replace(ol[Ba.CARETTRIM],W$e),vi("caret trim",e);let f=e.split(" ").map(C=>J$e(C,this.options)).join(" ").split(/\s+/).map(C=>net(C,this.options));n&&(f=f.filter(C=>(vi("loose invalid filter",C,this.options),!!C.match(ol[Ba.COMPARATORLOOSE])))),vi("range list",f);let p=new Map,h=f.map(C=>new JU(C,this.options));for(let C of h){if(Ase(C))return[C];p.set(C.value,C)}p.size>1&&p.has("")&&p.delete("");let E=[...p.values()];return fse.set(s,E),E}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>pse(s,r)&&e.set.some(a=>pse(a,r)&&s.every(n=>a.every(c=>n.intersects(c,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new j$e(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",K$e=t=>t.value==="",pse=(t,e)=>{let r=!0,s=t.slice(),a=s.pop();for(;r&&s.length;)r=s.every(n=>a.intersects(n,e)),a=s.pop();return r},J$e=(t,e)=>(vi("comp",t,e),t=X$e(t,e),vi("caret",t),t=z$e(t,e),vi("tildes",t),t=eet(t,e),vi("xrange",t),t=ret(t,e),vi("stars",t),t),va=t=>!t||t.toLowerCase()==="x"||t==="*",z$e=(t,e)=>t.trim().split(/\s+/).map(r=>Z$e(r,e)).join(" "),Z$e=(t,e)=>{let r=e.loose?ol[Ba.TILDELOOSE]:ol[Ba.TILDE];return t.replace(r,(s,a,n,c,f)=>{vi("tilde",t,s,a,n,c,f);let p;return va(a)?p="":va(n)?p=`>=${a}.0.0 <${+a+1}.0.0-0`:va(c)?p=`>=${a}.${n}.0 <${a}.${+n+1}.0-0`:f?(vi("replaceTilde pr",f),p=`>=${a}.${n}.${c}-${f} <${a}.${+n+1}.0-0`):p=`>=${a}.${n}.${c} <${a}.${+n+1}.0-0`,vi("tilde return",p),p})},X$e=(t,e)=>t.trim().split(/\s+/).map(r=>$$e(r,e)).join(" "),$$e=(t,e)=>{vi("caret",t,e);let r=e.loose?ol[Ba.CARETLOOSE]:ol[Ba.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(a,n,c,f,p)=>{vi("caret",t,a,n,c,f,p);let h;return va(n)?h="":va(c)?h=`>=${n}.0.0${s} <${+n+1}.0.0-0`:va(f)?n==="0"?h=`>=${n}.${c}.0${s} <${n}.${+c+1}.0-0`:h=`>=${n}.${c}.0${s} <${+n+1}.0.0-0`:p?(vi("replaceCaret pr",p),n==="0"?c==="0"?h=`>=${n}.${c}.${f}-${p} <${n}.${c}.${+f+1}-0`:h=`>=${n}.${c}.${f}-${p} <${n}.${+c+1}.0-0`:h=`>=${n}.${c}.${f}-${p} <${+n+1}.0.0-0`):(vi("no pr"),n==="0"?c==="0"?h=`>=${n}.${c}.${f}${s} <${n}.${c}.${+f+1}-0`:h=`>=${n}.${c}.${f}${s} <${n}.${+c+1}.0-0`:h=`>=${n}.${c}.${f} <${+n+1}.0.0-0`),vi("caret return",h),h})},eet=(t,e)=>(vi("replaceXRanges",t,e),t.split(/\s+/).map(r=>tet(r,e)).join(" ")),tet=(t,e)=>{t=t.trim();let r=e.loose?ol[Ba.XRANGELOOSE]:ol[Ba.XRANGE];return t.replace(r,(s,a,n,c,f,p)=>{vi("xRange",t,s,a,n,c,f,p);let h=va(n),E=h||va(c),C=E||va(f),S=C;return a==="="&&S&&(a=""),p=e.includePrerelease?"-0":"",h?a===">"||a==="<"?s="<0.0.0-0":s="*":a&&S?(E&&(c=0),f=0,a===">"?(a=">=",E?(n=+n+1,c=0,f=0):(c=+c+1,f=0)):a==="<="&&(a="<",E?n=+n+1:c=+c+1),a==="<"&&(p="-0"),s=`${a+n}.${c}.${f}${p}`):E?s=`>=${n}.0.0${p} <${+n+1}.0.0-0`:C&&(s=`>=${n}.${c}.0${p} <${n}.${+c+1}.0-0`),vi("xRange return",s),s})},ret=(t,e)=>(vi("replaceStars",t,e),t.trim().replace(ol[Ba.STAR],"")),net=(t,e)=>(vi("replaceGTE0",t,e),t.trim().replace(ol[e.includePrerelease?Ba.GTE0PRE:Ba.GTE0],"")),iet=t=>(e,r,s,a,n,c,f,p,h,E,C,S,P)=>(va(s)?r="":va(a)?r=`>=${s}.0.0${t?"-0":""}`:va(n)?r=`>=${s}.${a}.0${t?"-0":""}`:c?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,va(h)?p="":va(E)?p=`<${+h+1}.0.0-0`:va(C)?p=`<${h}.${+E+1}.0-0`:S?p=`<=${h}.${E}.${C}-${S}`:t?p=`<${h}.${E}.${+C+1}-0`:p=`<=${p}`,`${r} ${p}`.trim()),set=(t,e,r)=>{for(let s=0;s0){let a=t[s].semver;if(a.major===e.major&&a.minor===e.minor&&a.patch===e.patch)return!0}return!1}return!0}});var gB=L((dYt,Ise)=>{var dB=Symbol("SemVer ANY"),XU=class t{static get ANY(){return dB}constructor(e,r){if(r=gse(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),ZU("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===dB?this.value="":this.value=this.operator+this.semver.version,ZU("comp",this)}parse(e){let r=this.options.loose?dse[mse.COMPARATORLOOSE]:dse[mse.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new yse(s[2],this.options.loose):this.semver=dB}toString(){return this.value}test(e){if(ZU("Comparator.test",e,this.options.loose),this.semver===dB||e===dB)return!0;if(typeof e=="string")try{e=new yse(e,this.options)}catch{return!1}return zU(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Ese(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Ese(this.value,r).test(e.semver):(r=gse(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||zU(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||zU(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Ise.exports=XU;var gse=ik(),{safeRe:dse,t:mse}=vE(),zU=qU(),ZU=fB(),yse=Go(),Ese=Sc()});var mB=L((mYt,Cse)=>{var oet=Sc(),aet=(t,e,r)=>{try{e=new oet(e,r)}catch{return!1}return e.test(t)};Cse.exports=aet});var Bse=L((yYt,wse)=>{var cet=Sc(),uet=(t,e)=>new cet(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));wse.exports=uet});var Sse=L((EYt,vse)=>{var fet=Go(),Aet=Sc(),pet=(t,e,r)=>{let s=null,a=null,n=null;try{n=new Aet(e,r)}catch{return null}return t.forEach(c=>{n.test(c)&&(!s||a.compare(c)===-1)&&(s=c,a=new fet(s,r))}),s};vse.exports=pet});var bse=L((IYt,Dse)=>{var het=Go(),get=Sc(),det=(t,e,r)=>{let s=null,a=null,n=null;try{n=new get(e,r)}catch{return null}return t.forEach(c=>{n.test(c)&&(!s||a.compare(c)===1)&&(s=c,a=new het(s,r))}),s};Dse.exports=det});var kse=L((CYt,xse)=>{var $U=Go(),met=Sc(),Pse=AB(),yet=(t,e)=>{t=new met(t,e);let r=new $U("0.0.0");if(t.test(r)||(r=new $U("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s{let f=new $U(c.semver.version);switch(c.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!n||Pse(f,n))&&(n=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${c.operator}`)}}),n&&(!r||Pse(r,n))&&(r=n)}return r&&t.test(r)?r:null};xse.exports=yet});var Tse=L((wYt,Qse)=>{var Eet=Sc(),Iet=(t,e)=>{try{return new Eet(t,e).range||"*"}catch{return null}};Qse.exports=Iet});var gk=L((BYt,Ose)=>{var Cet=Go(),Nse=gB(),{ANY:wet}=Nse,Bet=Sc(),vet=mB(),Rse=AB(),Fse=lk(),Det=uk(),bet=ck(),Pet=(t,e,r,s)=>{t=new Cet(t,s),e=new Bet(e,s);let a,n,c,f,p;switch(r){case">":a=Rse,n=Det,c=Fse,f=">",p=">=";break;case"<":a=Fse,n=bet,c=Rse,f="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(vet(t,e,s))return!1;for(let h=0;h{P.semver===wet&&(P=new Nse(">=0.0.0")),C=C||P,S=S||P,a(P.semver,C.semver,s)?C=P:c(P.semver,S.semver,s)&&(S=P)}),C.operator===f||C.operator===p||(!S.operator||S.operator===f)&&n(t,S.semver))return!1;if(S.operator===p&&c(t,S.semver))return!1}return!0};Ose.exports=Pet});var Mse=L((vYt,Lse)=>{var xet=gk(),ket=(t,e,r)=>xet(t,e,">",r);Lse.exports=ket});var Use=L((SYt,_se)=>{var Qet=gk(),Tet=(t,e,r)=>Qet(t,e,"<",r);_se.exports=Tet});var qse=L((DYt,jse)=>{var Hse=Sc(),Ret=(t,e,r)=>(t=new Hse(t,r),e=new Hse(e,r),t.intersects(e,r));jse.exports=Ret});var Wse=L((bYt,Gse)=>{var Fet=mB(),Net=vc();Gse.exports=(t,e,r)=>{let s=[],a=null,n=null,c=t.sort((E,C)=>Net(E,C,r));for(let E of c)Fet(E,e,r)?(n=E,a||(a=E)):(n&&s.push([a,n]),n=null,a=null);a&&s.push([a,null]);let f=[];for(let[E,C]of s)E===C?f.push(E):!C&&E===c[0]?f.push("*"):C?E===c[0]?f.push(`<=${C}`):f.push(`${E} - ${C}`):f.push(`>=${E}`);let p=f.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return p.length{var Yse=Sc(),t4=gB(),{ANY:e4}=t4,yB=mB(),r4=vc(),Oet=(t,e,r={})=>{if(t===e)return!0;t=new Yse(t,r),e=new Yse(e,r);let s=!1;e:for(let a of t.set){for(let n of e.set){let c=Met(a,n,r);if(s=s||c!==null,c)continue e}if(s)return!1}return!0},Let=[new t4(">=0.0.0-0")],Vse=[new t4(">=0.0.0")],Met=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===e4){if(e.length===1&&e[0].semver===e4)return!0;r.includePrerelease?t=Let:t=Vse}if(e.length===1&&e[0].semver===e4){if(r.includePrerelease)return!0;e=Vse}let s=new Set,a,n;for(let P of t)P.operator===">"||P.operator===">="?a=Kse(a,P,r):P.operator==="<"||P.operator==="<="?n=Jse(n,P,r):s.add(P.semver);if(s.size>1)return null;let c;if(a&&n){if(c=r4(a.semver,n.semver,r),c>0)return null;if(c===0&&(a.operator!==">="||n.operator!=="<="))return null}for(let P of s){if(a&&!yB(P,String(a),r)||n&&!yB(P,String(n),r))return null;for(let I of e)if(!yB(P,String(I),r))return!1;return!0}let f,p,h,E,C=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1,S=a&&!r.includePrerelease&&a.semver.prerelease.length?a.semver:!1;C&&C.prerelease.length===1&&n.operator==="<"&&C.prerelease[0]===0&&(C=!1);for(let P of e){if(E=E||P.operator===">"||P.operator===">=",h=h||P.operator==="<"||P.operator==="<=",a){if(S&&P.semver.prerelease&&P.semver.prerelease.length&&P.semver.major===S.major&&P.semver.minor===S.minor&&P.semver.patch===S.patch&&(S=!1),P.operator===">"||P.operator===">="){if(f=Kse(a,P,r),f===P&&f!==a)return!1}else if(a.operator===">="&&!yB(a.semver,String(P),r))return!1}if(n){if(C&&P.semver.prerelease&&P.semver.prerelease.length&&P.semver.major===C.major&&P.semver.minor===C.minor&&P.semver.patch===C.patch&&(C=!1),P.operator==="<"||P.operator==="<="){if(p=Jse(n,P,r),p===P&&p!==n)return!1}else if(n.operator==="<="&&!yB(n.semver,String(P),r))return!1}if(!P.operator&&(n||a)&&c!==0)return!1}return!(a&&h&&!n&&c!==0||n&&E&&!a&&c!==0||S||C)},Kse=(t,e,r)=>{if(!t)return e;let s=r4(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},Jse=(t,e,r)=>{if(!t)return e;let s=r4(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};zse.exports=Oet});var fi=L((xYt,eoe)=>{var n4=vE(),Xse=uB(),_et=Go(),$se=_U(),Uet=_d(),Het=Eie(),jet=Cie(),qet=vie(),Get=bie(),Wet=xie(),Yet=Qie(),Vet=Rie(),Ket=Nie(),Jet=vc(),zet=_ie(),Zet=Hie(),Xet=ak(),$et=Wie(),ett=Vie(),ttt=AB(),rtt=lk(),ntt=HU(),itt=jU(),stt=ck(),ott=uk(),att=qU(),ltt=rse(),ctt=gB(),utt=Sc(),ftt=mB(),Att=Bse(),ptt=Sse(),htt=bse(),gtt=kse(),dtt=Tse(),mtt=gk(),ytt=Mse(),Ett=Use(),Itt=qse(),Ctt=Wse(),wtt=Zse();eoe.exports={parse:Uet,valid:Het,clean:jet,inc:qet,diff:Get,major:Wet,minor:Yet,patch:Vet,prerelease:Ket,compare:Jet,rcompare:zet,compareLoose:Zet,compareBuild:Xet,sort:$et,rsort:ett,gt:ttt,lt:rtt,eq:ntt,neq:itt,gte:stt,lte:ott,cmp:att,coerce:ltt,Comparator:ctt,Range:utt,satisfies:ftt,toComparators:Att,maxSatisfying:ptt,minSatisfying:htt,minVersion:gtt,validRange:dtt,outside:mtt,gtr:ytt,ltr:Ett,intersects:Itt,simplifyRange:Ctt,subset:wtt,SemVer:_et,re:n4.re,src:n4.src,tokens:n4.t,SEMVER_SPEC_VERSION:Xse.SEMVER_SPEC_VERSION,RELEASE_TYPES:Xse.RELEASE_TYPES,compareIdentifiers:$se.compareIdentifiers,rcompareIdentifiers:$se.rcompareIdentifiers}});var roe=L((kYt,toe)=>{"use strict";function Btt(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function qd(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,qd)}Btt(qd,Error);qd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",C;for(C=0;C0){for(C=1,S=1;C{switch(Te[1]){case"|":return xe|Te[3];case"&":return xe&Te[3];case"^":return xe^Te[3]}},$)},S="!",P=Fe("!",!1),I=function($){return!$},R="(",N=Fe("(",!1),U=")",W=Fe(")",!1),te=function($){return $},ie=/^[^ \t\n\r()!|&\^]/,Ae=Ne([" "," ",` +`,"\r","(",")","!","|","&","^"],!0,!1),ce=function($){return e.queryPattern.test($)},me=function($){return e.checkFn($)},pe=ke("whitespace"),Be=/^[ \t\n\r]/,Ce=Ne([" "," ",` +`,"\r"],!1,!1),g=0,we=0,Ee=[{line:1,column:1}],fe=0,se=[],X=0,De;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function Re(){return t.substring(we,g)}function gt(){return _e(we,g)}function j($,oe){throw oe=oe!==void 0?oe:_e(we,g),b([ke($)],t.substring(we,g),oe)}function rt($,oe){throw oe=oe!==void 0?oe:_e(we,g),w($,oe)}function Fe($,oe){return{type:"literal",text:$,ignoreCase:oe}}function Ne($,oe,xe){return{type:"class",parts:$,inverted:oe,ignoreCase:xe}}function Pe(){return{type:"any"}}function Ye(){return{type:"end"}}function ke($){return{type:"other",description:$}}function it($){var oe=Ee[$],xe;if(oe)return oe;for(xe=$-1;!Ee[xe];)xe--;for(oe=Ee[xe],oe={line:oe.line,column:oe.column};xe<$;)t.charCodeAt(xe)===10?(oe.line++,oe.column=1):oe.column++,xe++;return Ee[$]=oe,oe}function _e($,oe){var xe=it($),Te=it(oe);return{start:{offset:$,line:xe.line,column:xe.column},end:{offset:oe,line:Te.line,column:Te.column}}}function x($){gfe&&(fe=g,se=[]),se.push($))}function w($,oe){return new qd($,null,null,oe)}function b($,oe,xe){return new qd(qd.buildMessage($,oe),$,oe,xe)}function y(){var $,oe,xe,Te,lt,Et,qt,ir;if($=g,oe=F(),oe!==r){for(xe=[],Te=g,lt=Z(),lt!==r?(t.charCodeAt(g)===124?(Et=n,g++):(Et=r,X===0&&x(c)),Et===r&&(t.charCodeAt(g)===38?(Et=f,g++):(Et=r,X===0&&x(p)),Et===r&&(t.charCodeAt(g)===94?(Et=h,g++):(Et=r,X===0&&x(E)))),Et!==r?(qt=Z(),qt!==r?(ir=F(),ir!==r?(lt=[lt,Et,qt,ir],Te=lt):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r);Te!==r;)xe.push(Te),Te=g,lt=Z(),lt!==r?(t.charCodeAt(g)===124?(Et=n,g++):(Et=r,X===0&&x(c)),Et===r&&(t.charCodeAt(g)===38?(Et=f,g++):(Et=r,X===0&&x(p)),Et===r&&(t.charCodeAt(g)===94?(Et=h,g++):(Et=r,X===0&&x(E)))),Et!==r?(qt=Z(),qt!==r?(ir=F(),ir!==r?(lt=[lt,Et,qt,ir],Te=lt):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r);xe!==r?(we=$,oe=C(oe,xe),$=oe):(g=$,$=r)}else g=$,$=r;return $}function F(){var $,oe,xe,Te,lt,Et;return $=g,t.charCodeAt(g)===33?(oe=S,g++):(oe=r,X===0&&x(P)),oe!==r?(xe=F(),xe!==r?(we=$,oe=I(xe),$=oe):(g=$,$=r)):(g=$,$=r),$===r&&($=g,t.charCodeAt(g)===40?(oe=R,g++):(oe=r,X===0&&x(N)),oe!==r?(xe=Z(),xe!==r?(Te=y(),Te!==r?(lt=Z(),lt!==r?(t.charCodeAt(g)===41?(Et=U,g++):(Et=r,X===0&&x(W)),Et!==r?(we=$,oe=te(Te),$=oe):(g=$,$=r)):(g=$,$=r)):(g=$,$=r)):(g=$,$=r)):(g=$,$=r),$===r&&($=z())),$}function z(){var $,oe,xe,Te,lt;if($=g,oe=Z(),oe!==r){if(xe=g,Te=[],ie.test(t.charAt(g))?(lt=t.charAt(g),g++):(lt=r,X===0&&x(Ae)),lt!==r)for(;lt!==r;)Te.push(lt),ie.test(t.charAt(g))?(lt=t.charAt(g),g++):(lt=r,X===0&&x(Ae));else Te=r;Te!==r?xe=t.substring(xe,g):xe=Te,xe!==r?(we=g,Te=ce(xe),Te?Te=void 0:Te=r,Te!==r?(we=$,oe=me(xe),$=oe):(g=$,$=r)):(g=$,$=r)}else g=$,$=r;return $}function Z(){var $,oe;for(X++,$=[],Be.test(t.charAt(g))?(oe=t.charAt(g),g++):(oe=r,X===0&&x(Ce));oe!==r;)$.push(oe),Be.test(t.charAt(g))?(oe=t.charAt(g),g++):(oe=r,X===0&&x(Ce));return X--,$===r&&(oe=r,X===0&&x(pe)),$}if(De=a(),De!==r&&g===t.length)return De;throw De!==r&&g{var{parse:Stt}=roe();dk.makeParser=(t=/[a-z]+/)=>(e,r)=>Stt(e,{queryPattern:t,checkFn:r});dk.parse=dk.makeParser()});var soe=L((TYt,ioe)=>{"use strict";ioe.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var i4=L((RYt,aoe)=>{var EB=soe(),ooe={};for(let t of Object.keys(EB))ooe[EB[t]]=t;var hr={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};aoe.exports=hr;for(let t of Object.keys(hr)){if(!("channels"in hr[t]))throw new Error("missing channels property: "+t);if(!("labels"in hr[t]))throw new Error("missing channel labels property: "+t);if(hr[t].labels.length!==hr[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=hr[t];delete hr[t].channels,delete hr[t].labels,Object.defineProperty(hr[t],"channels",{value:e}),Object.defineProperty(hr[t],"labels",{value:r})}hr.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,a=Math.min(e,r,s),n=Math.max(e,r,s),c=n-a,f,p;n===a?f=0:e===n?f=(r-s)/c:r===n?f=2+(s-e)/c:s===n&&(f=4+(e-r)/c),f=Math.min(f*60,360),f<0&&(f+=360);let h=(a+n)/2;return n===a?p=0:h<=.5?p=c/(n+a):p=c/(2-n-a),[f,p*100,h*100]};hr.rgb.hsv=function(t){let e,r,s,a,n,c=t[0]/255,f=t[1]/255,p=t[2]/255,h=Math.max(c,f,p),E=h-Math.min(c,f,p),C=function(S){return(h-S)/6/E+1/2};return E===0?(a=0,n=0):(n=E/h,e=C(c),r=C(f),s=C(p),c===h?a=s-r:f===h?a=1/3+e-s:p===h&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[a*360,n*100,h*100]};hr.rgb.hwb=function(t){let e=t[0],r=t[1],s=t[2],a=hr.rgb.hsl(t)[0],n=1/255*Math.min(e,Math.min(r,s));return s=1-1/255*Math.max(e,Math.max(r,s)),[a,n*100,s*100]};hr.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,a=Math.min(1-e,1-r,1-s),n=(1-e-a)/(1-a)||0,c=(1-r-a)/(1-a)||0,f=(1-s-a)/(1-a)||0;return[n*100,c*100,f*100,a*100]};function Dtt(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}hr.rgb.keyword=function(t){let e=ooe[t];if(e)return e;let r=1/0,s;for(let a of Object.keys(EB)){let n=EB[a],c=Dtt(t,n);c.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let a=e*.4124+r*.3576+s*.1805,n=e*.2126+r*.7152+s*.0722,c=e*.0193+r*.1192+s*.9505;return[a*100,n*100,c*100]};hr.rgb.lab=function(t){let e=hr.rgb.xyz(t),r=e[0],s=e[1],a=e[2];r/=95.047,s/=100,a/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;let n=116*s-16,c=500*(r-s),f=200*(s-a);return[n,c,f]};hr.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100,a,n,c;if(r===0)return c=s*255,[c,c,c];s<.5?a=s*(1+r):a=s+r-s*r;let f=2*s-a,p=[0,0,0];for(let h=0;h<3;h++)n=e+1/3*-(h-1),n<0&&n++,n>1&&n--,6*n<1?c=f+(a-f)*6*n:2*n<1?c=a:3*n<2?c=f+(a-f)*(2/3-n)*6:c=f,p[h]=c*255;return p};hr.hsl.hsv=function(t){let e=t[0],r=t[1]/100,s=t[2]/100,a=r,n=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,a*=n<=1?n:2-n;let c=(s+r)/2,f=s===0?2*a/(n+a):2*r/(s+r);return[e,f*100,c*100]};hr.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,s=t[2]/100,a=Math.floor(e)%6,n=e-Math.floor(e),c=255*s*(1-r),f=255*s*(1-r*n),p=255*s*(1-r*(1-n));switch(s*=255,a){case 0:return[s,p,c];case 1:return[f,s,c];case 2:return[c,s,p];case 3:return[c,f,s];case 4:return[p,c,s];case 5:return[s,c,f]}};hr.hsv.hsl=function(t){let e=t[0],r=t[1]/100,s=t[2]/100,a=Math.max(s,.01),n,c;c=(2-r)*s;let f=(2-r)*a;return n=r*a,n/=f<=1?f:2-f,n=n||0,c/=2,[e,n*100,c*100]};hr.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100,a=r+s,n;a>1&&(r/=a,s/=a);let c=Math.floor(6*e),f=1-s;n=6*e-c,c&1&&(n=1-n);let p=r+n*(f-r),h,E,C;switch(c){default:case 6:case 0:h=f,E=p,C=r;break;case 1:h=p,E=f,C=r;break;case 2:h=r,E=f,C=p;break;case 3:h=r,E=p,C=f;break;case 4:h=p,E=r,C=f;break;case 5:h=f,E=r,C=p;break}return[h*255,E*255,C*255]};hr.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,s=t[2]/100,a=t[3]/100,n=1-Math.min(1,e*(1-a)+a),c=1-Math.min(1,r*(1-a)+a),f=1-Math.min(1,s*(1-a)+a);return[n*255,c*255,f*255]};hr.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,s=t[2]/100,a,n,c;return a=e*3.2406+r*-1.5372+s*-.4986,n=e*-.9689+r*1.8758+s*.0415,c=e*.0557+r*-.204+s*1.057,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,a=Math.min(Math.max(0,a),1),n=Math.min(Math.max(0,n),1),c=Math.min(Math.max(0,c),1),[a*255,n*255,c*255]};hr.xyz.lab=function(t){let e=t[0],r=t[1],s=t[2];e/=95.047,r/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let a=116*r-16,n=500*(e-r),c=200*(r-s);return[a,n,c]};hr.lab.xyz=function(t){let e=t[0],r=t[1],s=t[2],a,n,c;n=(e+16)/116,a=r/500+n,c=n-s/200;let f=n**3,p=a**3,h=c**3;return n=f>.008856?f:(n-16/116)/7.787,a=p>.008856?p:(a-16/116)/7.787,c=h>.008856?h:(c-16/116)/7.787,a*=95.047,n*=100,c*=108.883,[a,n,c]};hr.lab.lch=function(t){let e=t[0],r=t[1],s=t[2],a;a=Math.atan2(s,r)*360/2/Math.PI,a<0&&(a+=360);let c=Math.sqrt(r*r+s*s);return[e,c,a]};hr.lch.lab=function(t){let e=t[0],r=t[1],a=t[2]/360*2*Math.PI,n=r*Math.cos(a),c=r*Math.sin(a);return[e,n,c]};hr.rgb.ansi16=function(t,e=null){let[r,s,a]=t,n=e===null?hr.rgb.hsv(t)[2]:e;if(n=Math.round(n/50),n===0)return 30;let c=30+(Math.round(a/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return n===2&&(c+=60),c};hr.hsv.ansi16=function(t){return hr.rgb.ansi16(hr.hsv.rgb(t),t[2])};hr.rgb.ansi256=function(t){let e=t[0],r=t[1],s=t[2];return e===r&&r===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};hr.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,s=(e&1)*r*255,a=(e>>1&1)*r*255,n=(e>>2&1)*r*255;return[s,a,n]};hr.ansi256.rgb=function(t){if(t>=232){let n=(t-232)*10+8;return[n,n,n]}t-=16;let e,r=Math.floor(t/36)/5*255,s=Math.floor((e=t%36)/6)/5*255,a=e%6/5*255;return[r,s,a]};hr.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};hr.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(f=>f+f).join(""));let s=parseInt(r,16),a=s>>16&255,n=s>>8&255,c=s&255;return[a,n,c]};hr.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,a=Math.max(Math.max(e,r),s),n=Math.min(Math.min(e,r),s),c=a-n,f,p;return c<1?f=n/(1-c):f=0,c<=0?p=0:a===e?p=(r-s)/c%6:a===r?p=2+(s-e)/c:p=4+(e-r)/c,p/=6,p%=1,[p*360,c*100,f*100]};hr.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,s=r<.5?2*e*r:2*e*(1-r),a=0;return s<1&&(a=(r-.5*s)/(1-s)),[t[0],s*100,a*100]};hr.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,s=e*r,a=0;return s<1&&(a=(r-s)/(1-s)),[t[0],s*100,a*100]};hr.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100;if(r===0)return[s*255,s*255,s*255];let a=[0,0,0],n=e%1*6,c=n%1,f=1-c,p=0;switch(Math.floor(n)){case 0:a[0]=1,a[1]=c,a[2]=0;break;case 1:a[0]=f,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=c;break;case 3:a[0]=0,a[1]=f,a[2]=1;break;case 4:a[0]=c,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=f}return p=(1-r)*s,[(r*a[0]+p)*255,(r*a[1]+p)*255,(r*a[2]+p)*255]};hr.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,s=e+r*(1-e),a=0;return s>0&&(a=e/s),[t[0],a*100,s*100]};hr.hcg.hsl=function(t){let e=t[1]/100,s=t[2]/100*(1-e)+.5*e,a=0;return s>0&&s<.5?a=e/(2*s):s>=.5&&s<1&&(a=e/(2*(1-s))),[t[0],a*100,s*100]};hr.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,s=e+r*(1-e);return[t[0],(s-e)*100,(1-s)*100]};hr.hwb.hcg=function(t){let e=t[1]/100,s=1-t[2]/100,a=s-e,n=0;return a<1&&(n=(s-a)/(1-a)),[t[0],a*100,n*100]};hr.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};hr.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};hr.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};hr.gray.hsl=function(t){return[0,0,t[0]]};hr.gray.hsv=hr.gray.hsl;hr.gray.hwb=function(t){return[0,100,t[0]]};hr.gray.cmyk=function(t){return[0,0,0,t[0]]};hr.gray.lab=function(t){return[t[0],0,0]};hr.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,s=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(s.length)+s};hr.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var coe=L((FYt,loe)=>{var mk=i4();function btt(){let t={},e=Object.keys(mk);for(let r=e.length,s=0;s{var s4=i4(),Qtt=coe(),PE={},Ttt=Object.keys(s4);function Rtt(t){let e=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function Ftt(t){let e=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let a=t(r);if(typeof a=="object")for(let n=a.length,c=0;c{PE[t]={},Object.defineProperty(PE[t],"channels",{value:s4[t].channels}),Object.defineProperty(PE[t],"labels",{value:s4[t].labels});let e=Qtt(t);Object.keys(e).forEach(s=>{let a=e[s];PE[t][s]=Ftt(a),PE[t][s].raw=Rtt(a)})});uoe.exports=PE});var IB=L((OYt,doe)=>{"use strict";var Aoe=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,poe=(t,e)=>(...r)=>{let s=t(...r);return`\x1B[${38+e};5;${s}m`},hoe=(t,e)=>(...r)=>{let s=t(...r);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},yk=t=>t,goe=(t,e,r)=>[t,e,r],xE=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let s=r();return Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},o4,kE=(t,e,r,s)=>{o4===void 0&&(o4=foe());let a=s?10:0,n={};for(let[c,f]of Object.entries(o4)){let p=c==="ansi16"?"ansi":c;c===e?n[p]=t(r,a):typeof f=="object"&&(n[p]=t(f[e],a))}return n};function Ntt(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,s]of Object.entries(e)){for(let[a,n]of Object.entries(s))e[a]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},s[a]=e[a],t.set(n[0],n[1]);Object.defineProperty(e,r,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",xE(e.color,"ansi",()=>kE(Aoe,"ansi16",yk,!1)),xE(e.color,"ansi256",()=>kE(poe,"ansi256",yk,!1)),xE(e.color,"ansi16m",()=>kE(hoe,"rgb",goe,!1)),xE(e.bgColor,"ansi",()=>kE(Aoe,"ansi16",yk,!0)),xE(e.bgColor,"ansi256",()=>kE(poe,"ansi256",yk,!0)),xE(e.bgColor,"ansi16m",()=>kE(hoe,"rgb",goe,!0)),e}Object.defineProperty(doe,"exports",{enumerable:!0,get:Ntt})});var yoe=L((LYt,moe)=>{"use strict";moe.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",s=e.indexOf(r+t),a=e.indexOf("--");return s!==-1&&(a===-1||s{"use strict";var Ott=ye("os"),Eoe=ye("tty"),Dc=yoe(),{env:Ps}=process,f0;Dc("no-color")||Dc("no-colors")||Dc("color=false")||Dc("color=never")?f0=0:(Dc("color")||Dc("colors")||Dc("color=true")||Dc("color=always"))&&(f0=1);"FORCE_COLOR"in Ps&&(Ps.FORCE_COLOR==="true"?f0=1:Ps.FORCE_COLOR==="false"?f0=0:f0=Ps.FORCE_COLOR.length===0?1:Math.min(parseInt(Ps.FORCE_COLOR,10),3));function a4(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function l4(t,e){if(f0===0)return 0;if(Dc("color=16m")||Dc("color=full")||Dc("color=truecolor"))return 3;if(Dc("color=256"))return 2;if(t&&!e&&f0===void 0)return 0;let r=f0||0;if(Ps.TERM==="dumb")return r;if(process.platform==="win32"){let s=Ott.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Ps)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(s=>s in Ps)||Ps.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Ps)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ps.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in Ps)return 1;if(Ps.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ps){let s=parseInt((Ps.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ps.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ps.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ps.TERM)||"COLORTERM"in Ps?1:r}function Ltt(t){let e=l4(t,t&&t.isTTY);return a4(e)}Ioe.exports={supportsColor:Ltt,stdout:a4(l4(!0,Eoe.isatty(1))),stderr:a4(l4(!0,Eoe.isatty(2)))}});var woe=L((_Yt,Coe)=>{"use strict";var Mtt=(t,e,r)=>{let s=t.indexOf(e);if(s===-1)return t;let a=e.length,n=0,c="";do c+=t.substr(n,s-n)+e+r,n=s+a,s=t.indexOf(e,n);while(s!==-1);return c+=t.substr(n),c},_tt=(t,e,r,s)=>{let a=0,n="";do{let c=t[s-1]==="\r";n+=t.substr(a,(c?s-1:s)-a)+e+(c?`\r +`:` +`)+r,a=s+1,s=t.indexOf(` +`,a)}while(s!==-1);return n+=t.substr(a),n};Coe.exports={stringReplaceAll:Mtt,stringEncaseCRLFWithFirstIndex:_tt}});var boe=L((UYt,Doe)=>{"use strict";var Utt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Boe=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Htt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,jtt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,qtt=new Map([["n",` +`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Soe(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):qtt.get(t)||t}function Gtt(t,e){let r=[],s=e.trim().split(/\s*,\s*/g),a;for(let n of s){let c=Number(n);if(!Number.isNaN(c))r.push(c);else if(a=n.match(Htt))r.push(a[2].replace(jtt,(f,p,h)=>p?Soe(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function Wtt(t){Boe.lastIndex=0;let e=[],r;for(;(r=Boe.exec(t))!==null;){let s=r[1];if(r[2]){let a=Gtt(s,r[2]);e.push([s].concat(a))}else e.push([s])}return e}function voe(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let s=t;for(let[a,n]of Object.entries(r))if(Array.isArray(n)){if(!(a in s))throw new Error(`Unknown Chalk style: ${a}`);s=n.length>0?s[a](...n):s[a]}return s}Doe.exports=(t,e)=>{let r=[],s=[],a=[];if(e.replace(Utt,(n,c,f,p,h,E)=>{if(c)a.push(Soe(c));else if(p){let C=a.join("");a=[],s.push(r.length===0?C:voe(t,r)(C)),r.push({inverse:f,styles:Wtt(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(voe(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),s.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return s.join("")}});var g4=L((HYt,Qoe)=>{"use strict";var CB=IB(),{stdout:f4,stderr:A4}=c4(),{stringReplaceAll:Ytt,stringEncaseCRLFWithFirstIndex:Vtt}=woe(),Poe=["ansi","ansi","ansi256","ansi16m"],QE=Object.create(null),Ktt=(t,e={})=>{if(e.level>3||e.level<0)throw new Error("The `level` option should be an integer from 0 to 3");let r=f4?f4.level:0;t.level=e.level===void 0?r:e.level},p4=class{constructor(e){return xoe(e)}},xoe=t=>{let e={};return Ktt(e,t),e.template=(...r)=>Ztt(e.template,...r),Object.setPrototypeOf(e,Ek.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=p4,e.template};function Ek(t){return xoe(t)}for(let[t,e]of Object.entries(CB))QE[t]={get(){let r=Ik(this,h4(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};QE.visible={get(){let t=Ik(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var koe=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of koe)QE[t]={get(){let{level:e}=this;return function(...r){let s=h4(CB.color[Poe[e]][t](...r),CB.color.close,this._styler);return Ik(this,s,this._isEmpty)}}};for(let t of koe){let e="bg"+t[0].toUpperCase()+t.slice(1);QE[e]={get(){let{level:r}=this;return function(...s){let a=h4(CB.bgColor[Poe[r]][t](...s),CB.bgColor.close,this._styler);return Ik(this,a,this._isEmpty)}}}}var Jtt=Object.defineProperties(()=>{},{...QE,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),h4=(t,e,r)=>{let s,a;return r===void 0?(s=t,a=e):(s=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:s,closeAll:a,parent:r}},Ik=(t,e,r)=>{let s=(...a)=>ztt(s,a.length===1?""+a[0]:a.join(" "));return s.__proto__=Jtt,s._generator=t,s._styler=e,s._isEmpty=r,s},ztt=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:s,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=Ytt(e,r.close,r.open),r=r.parent;let n=e.indexOf(` +`);return n!==-1&&(e=Vtt(e,a,s,n)),s+e+a},u4,Ztt=(t,...e)=>{let[r]=e;if(!Array.isArray(r))return e.join(" ");let s=e.slice(1),a=[r.raw[0]];for(let n=1;n{"use strict";bc.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;bc.find=(t,e)=>t.nodes.find(r=>r.type===e);bc.exceedsLimit=(t,e,r=1,s)=>s===!1||!bc.isInteger(t)||!bc.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=s;bc.escapeNode=(t,e=0,r)=>{let s=t.nodes[e];s&&(r&&s.type===r||s.type==="open"||s.type==="close")&&s.escaped!==!0&&(s.value="\\"+s.value,s.escaped=!0)};bc.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);bc.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;bc.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;bc.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);bc.flatten=(...t)=>{let e=[],r=s=>{for(let a=0;a{"use strict";var Toe=Ck();Roe.exports=(t,e={})=>{let r=(s,a={})=>{let n=e.escapeInvalid&&Toe.isInvalidBrace(a),c=s.invalid===!0&&e.escapeInvalid===!0,f="";if(s.value)return(n||c)&&Toe.isOpenOrClose(s)?"\\"+s.value:s.value;if(s.value)return s.value;if(s.nodes)for(let p of s.nodes)f+=r(p);return f};return r(t)}});var Noe=L((GYt,Foe)=>{"use strict";Foe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var Goe=L((WYt,qoe)=>{"use strict";var Ooe=Noe(),Gd=(t,e,r)=>{if(Ooe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Ooe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let s={relaxZeros:!0,...r};typeof s.strictZeros=="boolean"&&(s.relaxZeros=s.strictZeros===!1);let a=String(s.relaxZeros),n=String(s.shorthand),c=String(s.capture),f=String(s.wrap),p=t+":"+e+"="+a+n+c+f;if(Gd.cache.hasOwnProperty(p))return Gd.cache[p].result;let h=Math.min(t,e),E=Math.max(t,e);if(Math.abs(h-E)===1){let R=t+"|"+e;return s.capture?`(${R})`:s.wrap===!1?R:`(?:${R})`}let C=joe(t)||joe(e),S={min:t,max:e,a:h,b:E},P=[],I=[];if(C&&(S.isPadded=C,S.maxLen=String(S.max).length),h<0){let R=E<0?Math.abs(E):1;I=Loe(R,Math.abs(h),S,s),h=S.a=0}return E>=0&&(P=Loe(h,E,S,s)),S.negatives=I,S.positives=P,S.result=Xtt(I,P,s),s.capture===!0?S.result=`(${S.result})`:s.wrap!==!1&&P.length+I.length>1&&(S.result=`(?:${S.result})`),Gd.cache[p]=S,S.result};function Xtt(t,e,r){let s=d4(t,e,"-",!1,r)||[],a=d4(e,t,"",!1,r)||[],n=d4(t,e,"-?",!0,r)||[];return s.concat(n).concat(a).join("|")}function $tt(t,e){let r=1,s=1,a=_oe(t,r),n=new Set([e]);for(;t<=a&&a<=e;)n.add(a),r+=1,a=_oe(t,r);for(a=Uoe(e+1,s)-1;t1&&f.count.pop(),f.count.push(E.count[0]),f.string=f.pattern+Hoe(f.count),c=h+1;continue}r.isPadded&&(C=irt(h,r,s)),E.string=C+E.pattern+Hoe(E.count),n.push(E),c=h+1,f=E}return n}function d4(t,e,r,s,a){let n=[];for(let c of t){let{string:f}=c;!s&&!Moe(e,"string",f)&&n.push(r+f),s&&Moe(e,"string",f)&&n.push(r+f)}return n}function trt(t,e){let r=[];for(let s=0;se?1:e>t?-1:0}function Moe(t,e,r){return t.some(s=>s[e]===r)}function _oe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Uoe(t,e){return t-t%Math.pow(10,e)}function Hoe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function nrt(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function joe(t){return/^-?(0+)\d/.test(t)}function irt(t,e,r){if(!e.isPadded)return t;let s=Math.abs(e.maxLen-String(t).length),a=r.relaxZeros!==!1;switch(s){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:return a?`0{0,${s}}`:`0{${s}}`}}Gd.cache={};Gd.clearCache=()=>Gd.cache={};qoe.exports=Gd});var E4=L((YYt,Xoe)=>{"use strict";var srt=ye("util"),Voe=Goe(),Woe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),ort=t=>e=>t===!0?Number(e):String(e),m4=t=>typeof t=="number"||typeof t=="string"&&t!=="",BB=t=>Number.isInteger(+t),y4=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},art=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,lrt=(t,e,r)=>{if(e>0){let s=t[0]==="-"?"-":"";s&&(t=t.slice(1)),t=s+t.padStart(s?e-1:e,"0")}return r===!1?String(t):t},Yoe=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length{t.negatives.sort((c,f)=>cf?1:0),t.positives.sort((c,f)=>cf?1:0);let r=e.capture?"":"?:",s="",a="",n;return t.positives.length&&(s=t.positives.join("|")),t.negatives.length&&(a=`-(${r}${t.negatives.join("|")})`),s&&a?n=`${s}|${a}`:n=s||a,e.wrap?`(${r}${n})`:n},Koe=(t,e,r,s)=>{if(r)return Voe(t,e,{wrap:!1,...s});let a=String.fromCharCode(t);if(t===e)return a;let n=String.fromCharCode(e);return`[${a}-${n}]`},Joe=(t,e,r)=>{if(Array.isArray(t)){let s=r.wrap===!0,a=r.capture?"":"?:";return s?`(${a}${t.join("|")})`:t.join("|")}return Voe(t,e,r)},zoe=(...t)=>new RangeError("Invalid range arguments: "+srt.inspect(...t)),Zoe=(t,e,r)=>{if(r.strictRanges===!0)throw zoe([t,e]);return[]},urt=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},frt=(t,e,r=1,s={})=>{let a=Number(t),n=Number(e);if(!Number.isInteger(a)||!Number.isInteger(n)){if(s.strictRanges===!0)throw zoe([t,e]);return[]}a===0&&(a=0),n===0&&(n=0);let c=a>n,f=String(t),p=String(e),h=String(r);r=Math.max(Math.abs(r),1);let E=y4(f)||y4(p)||y4(h),C=E?Math.max(f.length,p.length,h.length):0,S=E===!1&&art(t,e,s)===!1,P=s.transform||ort(S);if(s.toRegex&&r===1)return Koe(Yoe(t,C),Yoe(e,C),!0,s);let I={negatives:[],positives:[]},R=W=>I[W<0?"negatives":"positives"].push(Math.abs(W)),N=[],U=0;for(;c?a>=n:a<=n;)s.toRegex===!0&&r>1?R(a):N.push(lrt(P(a,U),C,S)),a=c?a-r:a+r,U++;return s.toRegex===!0?r>1?crt(I,s):Joe(N,null,{wrap:!1,...s}):N},Art=(t,e,r=1,s={})=>{if(!BB(t)&&t.length>1||!BB(e)&&e.length>1)return Zoe(t,e,s);let a=s.transform||(S=>String.fromCharCode(S)),n=`${t}`.charCodeAt(0),c=`${e}`.charCodeAt(0),f=n>c,p=Math.min(n,c),h=Math.max(n,c);if(s.toRegex&&r===1)return Koe(p,h,!1,s);let E=[],C=0;for(;f?n>=c:n<=c;)E.push(a(n,C)),n=f?n-r:n+r,C++;return s.toRegex===!0?Joe(E,null,{wrap:!1,options:s}):E},Bk=(t,e,r,s={})=>{if(e==null&&m4(t))return[t];if(!m4(t)||!m4(e))return Zoe(t,e,s);if(typeof r=="function")return Bk(t,e,1,{transform:r});if(Woe(r))return Bk(t,e,0,r);let a={...s};return a.capture===!0&&(a.wrap=!0),r=r||a.step||1,BB(r)?BB(t)&&BB(e)?frt(t,e,r,a):Art(t,e,Math.max(Math.abs(r),1),a):r!=null&&!Woe(r)?urt(r,a):Bk(t,e,1,r)};Xoe.exports=Bk});var tae=L((VYt,eae)=>{"use strict";var prt=E4(),$oe=Ck(),hrt=(t,e={})=>{let r=(s,a={})=>{let n=$oe.isInvalidBrace(a),c=s.invalid===!0&&e.escapeInvalid===!0,f=n===!0||c===!0,p=e.escapeInvalid===!0?"\\":"",h="";if(s.isOpen===!0||s.isClose===!0)return p+s.value;if(s.type==="open")return f?p+s.value:"(";if(s.type==="close")return f?p+s.value:")";if(s.type==="comma")return s.prev.type==="comma"?"":f?s.value:"|";if(s.value)return s.value;if(s.nodes&&s.ranges>0){let E=$oe.reduce(s.nodes),C=prt(...E,{...e,wrap:!1,toRegex:!0});if(C.length!==0)return E.length>1&&C.length>1?`(${C})`:C}if(s.nodes)for(let E of s.nodes)h+=r(E,s);return h};return r(t)};eae.exports=hrt});var iae=L((KYt,nae)=>{"use strict";var grt=E4(),rae=wk(),TE=Ck(),Wd=(t="",e="",r=!1)=>{let s=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?TE.flatten(e).map(a=>`{${a}}`):e;for(let a of t)if(Array.isArray(a))for(let n of a)s.push(Wd(n,e,r));else for(let n of e)r===!0&&typeof n=="string"&&(n=`{${n}}`),s.push(Array.isArray(n)?Wd(a,n,r):a+n);return TE.flatten(s)},drt=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,s=(a,n={})=>{a.queue=[];let c=n,f=n.queue;for(;c.type!=="brace"&&c.type!=="root"&&c.parent;)c=c.parent,f=c.queue;if(a.invalid||a.dollar){f.push(Wd(f.pop(),rae(a,e)));return}if(a.type==="brace"&&a.invalid!==!0&&a.nodes.length===2){f.push(Wd(f.pop(),["{}"]));return}if(a.nodes&&a.ranges>0){let C=TE.reduce(a.nodes);if(TE.exceedsLimit(...C,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let S=grt(...C,e);S.length===0&&(S=rae(a,e)),f.push(Wd(f.pop(),S)),a.nodes=[];return}let p=TE.encloseBrace(a),h=a.queue,E=a;for(;E.type!=="brace"&&E.type!=="root"&&E.parent;)E=E.parent,h=E.queue;for(let C=0;C{"use strict";sae.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` +`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var fae=L((zYt,uae)=>{"use strict";var mrt=wk(),{MAX_LENGTH:aae,CHAR_BACKSLASH:I4,CHAR_BACKTICK:yrt,CHAR_COMMA:Ert,CHAR_DOT:Irt,CHAR_LEFT_PARENTHESES:Crt,CHAR_RIGHT_PARENTHESES:wrt,CHAR_LEFT_CURLY_BRACE:Brt,CHAR_RIGHT_CURLY_BRACE:vrt,CHAR_LEFT_SQUARE_BRACKET:lae,CHAR_RIGHT_SQUARE_BRACKET:cae,CHAR_DOUBLE_QUOTE:Srt,CHAR_SINGLE_QUOTE:Drt,CHAR_NO_BREAK_SPACE:brt,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Prt}=oae(),xrt=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},s=typeof r.maxLength=="number"?Math.min(aae,r.maxLength):aae;if(t.length>s)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${s})`);let a={type:"root",input:t,nodes:[]},n=[a],c=a,f=a,p=0,h=t.length,E=0,C=0,S,P={},I=()=>t[E++],R=N=>{if(N.type==="text"&&f.type==="dot"&&(f.type="text"),f&&f.type==="text"&&N.type==="text"){f.value+=N.value;return}return c.nodes.push(N),N.parent=c,N.prev=f,f=N,N};for(R({type:"bos"});E0){if(c.ranges>0){c.ranges=0;let N=c.nodes.shift();c.nodes=[N,{type:"text",value:mrt(c)}]}R({type:"comma",value:S}),c.commas++;continue}if(S===Irt&&C>0&&c.commas===0){let N=c.nodes;if(C===0||N.length===0){R({type:"text",value:S});continue}if(f.type==="dot"){if(c.range=[],f.value+=S,f.type="range",c.nodes.length!==3&&c.nodes.length!==5){c.invalid=!0,c.ranges=0,f.type="text";continue}c.ranges++,c.args=[];continue}if(f.type==="range"){N.pop();let U=N[N.length-1];U.value+=f.value+S,f=U,c.ranges--;continue}R({type:"dot",value:S});continue}R({type:"text",value:S})}do if(c=n.pop(),c.type!=="root"){c.nodes.forEach(W=>{W.nodes||(W.type==="open"&&(W.isOpen=!0),W.type==="close"&&(W.isClose=!0),W.nodes||(W.type="text"),W.invalid=!0)});let N=n[n.length-1],U=N.nodes.indexOf(c);N.nodes.splice(U,1,...c.nodes)}while(n.length>0);return R({type:"eos"}),a};uae.exports=xrt});var hae=L((ZYt,pae)=>{"use strict";var Aae=wk(),krt=tae(),Qrt=iae(),Trt=fae(),ql=(t,e={})=>{let r=[];if(Array.isArray(t))for(let s of t){let a=ql.create(s,e);Array.isArray(a)?r.push(...a):r.push(a)}else r=[].concat(ql.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};ql.parse=(t,e={})=>Trt(t,e);ql.stringify=(t,e={})=>Aae(typeof t=="string"?ql.parse(t,e):t,e);ql.compile=(t,e={})=>(typeof t=="string"&&(t=ql.parse(t,e)),krt(t,e));ql.expand=(t,e={})=>{typeof t=="string"&&(t=ql.parse(t,e));let r=Qrt(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};ql.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?ql.compile(t,e):ql.expand(t,e);pae.exports=ql});var vB=L((XYt,Eae)=>{"use strict";var Rrt=ye("path"),Kf="\\\\/",gae=`[^${Kf}]`,Pp="\\.",Frt="\\+",Nrt="\\?",vk="\\/",Ort="(?=.)",dae="[^/]",C4=`(?:${vk}|$)`,mae=`(?:^|${vk})`,w4=`${Pp}{1,2}${C4}`,Lrt=`(?!${Pp})`,Mrt=`(?!${mae}${w4})`,_rt=`(?!${Pp}{0,1}${C4})`,Urt=`(?!${w4})`,Hrt=`[^.${vk}]`,jrt=`${dae}*?`,yae={DOT_LITERAL:Pp,PLUS_LITERAL:Frt,QMARK_LITERAL:Nrt,SLASH_LITERAL:vk,ONE_CHAR:Ort,QMARK:dae,END_ANCHOR:C4,DOTS_SLASH:w4,NO_DOT:Lrt,NO_DOTS:Mrt,NO_DOT_SLASH:_rt,NO_DOTS_SLASH:Urt,QMARK_NO_DOT:Hrt,STAR:jrt,START_ANCHOR:mae},qrt={...yae,SLASH_LITERAL:`[${Kf}]`,QMARK:gae,STAR:`${gae}*?`,DOTS_SLASH:`${Pp}{1,2}(?:[${Kf}]|$)`,NO_DOT:`(?!${Pp})`,NO_DOTS:`(?!(?:^|[${Kf}])${Pp}{1,2}(?:[${Kf}]|$))`,NO_DOT_SLASH:`(?!${Pp}{0,1}(?:[${Kf}]|$))`,NO_DOTS_SLASH:`(?!${Pp}{1,2}(?:[${Kf}]|$))`,QMARK_NO_DOT:`[^.${Kf}]`,START_ANCHOR:`(?:^|[${Kf}])`,END_ANCHOR:`(?:[${Kf}]|$)`},Grt={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Eae.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Grt,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Rrt.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?qrt:yae}}});var SB=L(al=>{"use strict";var Wrt=ye("path"),Yrt=process.platform==="win32",{REGEX_BACKSLASH:Vrt,REGEX_REMOVE_BACKSLASH:Krt,REGEX_SPECIAL_CHARS:Jrt,REGEX_SPECIAL_CHARS_GLOBAL:zrt}=vB();al.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);al.hasRegexChars=t=>Jrt.test(t);al.isRegexChar=t=>t.length===1&&al.hasRegexChars(t);al.escapeRegex=t=>t.replace(zrt,"\\$1");al.toPosixSlashes=t=>t.replace(Vrt,"/");al.removeBackslashes=t=>t.replace(Krt,e=>e==="\\"?"":e);al.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};al.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Yrt===!0||Wrt.sep==="\\";al.escapeLast=(t,e,r)=>{let s=t.lastIndexOf(e,r);return s===-1?t:t[s-1]==="\\"?al.escapeLast(t,e,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};al.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};al.wrapOutput=(t,e={},r={})=>{let s=r.contains?"":"^",a=r.contains?"":"$",n=`${s}(?:${t})${a}`;return e.negated===!0&&(n=`(?:^(?!${n}).*$)`),n}});var bae=L((eVt,Dae)=>{"use strict";var Iae=SB(),{CHAR_ASTERISK:B4,CHAR_AT:Zrt,CHAR_BACKWARD_SLASH:DB,CHAR_COMMA:Xrt,CHAR_DOT:v4,CHAR_EXCLAMATION_MARK:S4,CHAR_FORWARD_SLASH:Sae,CHAR_LEFT_CURLY_BRACE:D4,CHAR_LEFT_PARENTHESES:b4,CHAR_LEFT_SQUARE_BRACKET:$rt,CHAR_PLUS:ent,CHAR_QUESTION_MARK:Cae,CHAR_RIGHT_CURLY_BRACE:tnt,CHAR_RIGHT_PARENTHESES:wae,CHAR_RIGHT_SQUARE_BRACKET:rnt}=vB(),Bae=t=>t===Sae||t===DB,vae=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},nnt=(t,e)=>{let r=e||{},s=t.length-1,a=r.parts===!0||r.scanToEnd===!0,n=[],c=[],f=[],p=t,h=-1,E=0,C=0,S=!1,P=!1,I=!1,R=!1,N=!1,U=!1,W=!1,te=!1,ie=!1,Ae=!1,ce=0,me,pe,Be={value:"",depth:0,isGlob:!1},Ce=()=>h>=s,g=()=>p.charCodeAt(h+1),we=()=>(me=pe,p.charCodeAt(++h));for(;h0&&(fe=p.slice(0,E),p=p.slice(E),C-=E),Ee&&I===!0&&C>0?(Ee=p.slice(0,C),se=p.slice(C)):I===!0?(Ee="",se=p):Ee=p,Ee&&Ee!==""&&Ee!=="/"&&Ee!==p&&Bae(Ee.charCodeAt(Ee.length-1))&&(Ee=Ee.slice(0,-1)),r.unescape===!0&&(se&&(se=Iae.removeBackslashes(se)),Ee&&W===!0&&(Ee=Iae.removeBackslashes(Ee)));let X={prefix:fe,input:t,start:E,base:Ee,glob:se,isBrace:S,isBracket:P,isGlob:I,isExtglob:R,isGlobstar:N,negated:te,negatedExtglob:ie};if(r.tokens===!0&&(X.maxDepth=0,Bae(pe)||c.push(Be),X.tokens=c),r.parts===!0||r.tokens===!0){let De;for(let Re=0;Re{"use strict";var Sk=vB(),Gl=SB(),{MAX_LENGTH:Dk,POSIX_REGEX_SOURCE:int,REGEX_NON_SPECIAL_CHARS:snt,REGEX_SPECIAL_CHARS_BACKREF:ont,REPLACEMENTS:Pae}=Sk,ant=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(a=>Gl.escapeRegex(a)).join("..")}return r},RE=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,P4=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Pae[t]||t;let r={...e},s=typeof r.maxLength=="number"?Math.min(Dk,r.maxLength):Dk,a=t.length;if(a>s)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${s}`);let n={type:"bos",value:"",output:r.prepend||""},c=[n],f=r.capture?"":"?:",p=Gl.isWindows(e),h=Sk.globChars(p),E=Sk.extglobChars(h),{DOT_LITERAL:C,PLUS_LITERAL:S,SLASH_LITERAL:P,ONE_CHAR:I,DOTS_SLASH:R,NO_DOT:N,NO_DOT_SLASH:U,NO_DOTS_SLASH:W,QMARK:te,QMARK_NO_DOT:ie,STAR:Ae,START_ANCHOR:ce}=h,me=x=>`(${f}(?:(?!${ce}${x.dot?R:C}).)*?)`,pe=r.dot?"":N,Be=r.dot?te:ie,Ce=r.bash===!0?me(r):Ae;r.capture&&(Ce=`(${Ce})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let g={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:c};t=Gl.removePrefix(t,g),a=t.length;let we=[],Ee=[],fe=[],se=n,X,De=()=>g.index===a-1,Re=g.peek=(x=1)=>t[g.index+x],gt=g.advance=()=>t[++g.index]||"",j=()=>t.slice(g.index+1),rt=(x="",w=0)=>{g.consumed+=x,g.index+=w},Fe=x=>{g.output+=x.output!=null?x.output:x.value,rt(x.value)},Ne=()=>{let x=1;for(;Re()==="!"&&(Re(2)!=="("||Re(3)==="?");)gt(),g.start++,x++;return x%2===0?!1:(g.negated=!0,g.start++,!0)},Pe=x=>{g[x]++,fe.push(x)},Ye=x=>{g[x]--,fe.pop()},ke=x=>{if(se.type==="globstar"){let w=g.braces>0&&(x.type==="comma"||x.type==="brace"),b=x.extglob===!0||we.length&&(x.type==="pipe"||x.type==="paren");x.type!=="slash"&&x.type!=="paren"&&!w&&!b&&(g.output=g.output.slice(0,-se.output.length),se.type="star",se.value="*",se.output=Ce,g.output+=se.output)}if(we.length&&x.type!=="paren"&&(we[we.length-1].inner+=x.value),(x.value||x.output)&&Fe(x),se&&se.type==="text"&&x.type==="text"){se.value+=x.value,se.output=(se.output||"")+x.value;return}x.prev=se,c.push(x),se=x},it=(x,w)=>{let b={...E[w],conditions:1,inner:""};b.prev=se,b.parens=g.parens,b.output=g.output;let y=(r.capture?"(":"")+b.open;Pe("parens"),ke({type:x,value:w,output:g.output?"":I}),ke({type:"paren",extglob:!0,value:gt(),output:y}),we.push(b)},_e=x=>{let w=x.close+(r.capture?")":""),b;if(x.type==="negate"){let y=Ce;if(x.inner&&x.inner.length>1&&x.inner.includes("/")&&(y=me(r)),(y!==Ce||De()||/^\)+$/.test(j()))&&(w=x.close=`)$))${y}`),x.inner.includes("*")&&(b=j())&&/^\.[^\\/.]+$/.test(b)){let F=P4(b,{...e,fastpaths:!1}).output;w=x.close=`)${F})${y})`}x.prev.type==="bos"&&(g.negatedExtglob=!0)}ke({type:"paren",extglob:!0,value:X,output:w}),Ye("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let x=!1,w=t.replace(ont,(b,y,F,z,Z,$)=>z==="\\"?(x=!0,b):z==="?"?y?y+z+(Z?te.repeat(Z.length):""):$===0?Be+(Z?te.repeat(Z.length):""):te.repeat(F.length):z==="."?C.repeat(F.length):z==="*"?y?y+z+(Z?Ce:""):Ce:y?b:`\\${b}`);return x===!0&&(r.unescape===!0?w=w.replace(/\\/g,""):w=w.replace(/\\+/g,b=>b.length%2===0?"\\\\":b?"\\":"")),w===t&&r.contains===!0?(g.output=t,g):(g.output=Gl.wrapOutput(w,g,e),g)}for(;!De();){if(X=gt(),X==="\0")continue;if(X==="\\"){let b=Re();if(b==="/"&&r.bash!==!0||b==="."||b===";")continue;if(!b){X+="\\",ke({type:"text",value:X});continue}let y=/^\\+/.exec(j()),F=0;if(y&&y[0].length>2&&(F=y[0].length,g.index+=F,F%2!==0&&(X+="\\")),r.unescape===!0?X=gt():X+=gt(),g.brackets===0){ke({type:"text",value:X});continue}}if(g.brackets>0&&(X!=="]"||se.value==="["||se.value==="[^")){if(r.posix!==!1&&X===":"){let b=se.value.slice(1);if(b.includes("[")&&(se.posix=!0,b.includes(":"))){let y=se.value.lastIndexOf("["),F=se.value.slice(0,y),z=se.value.slice(y+2),Z=int[z];if(Z){se.value=F+Z,g.backtrack=!0,gt(),!n.output&&c.indexOf(se)===1&&(n.output=I);continue}}}(X==="["&&Re()!==":"||X==="-"&&Re()==="]")&&(X=`\\${X}`),X==="]"&&(se.value==="["||se.value==="[^")&&(X=`\\${X}`),r.posix===!0&&X==="!"&&se.value==="["&&(X="^"),se.value+=X,Fe({value:X});continue}if(g.quotes===1&&X!=='"'){X=Gl.escapeRegex(X),se.value+=X,Fe({value:X});continue}if(X==='"'){g.quotes=g.quotes===1?0:1,r.keepQuotes===!0&&ke({type:"text",value:X});continue}if(X==="("){Pe("parens"),ke({type:"paren",value:X});continue}if(X===")"){if(g.parens===0&&r.strictBrackets===!0)throw new SyntaxError(RE("opening","("));let b=we[we.length-1];if(b&&g.parens===b.parens+1){_e(we.pop());continue}ke({type:"paren",value:X,output:g.parens?")":"\\)"}),Ye("parens");continue}if(X==="["){if(r.nobracket===!0||!j().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(RE("closing","]"));X=`\\${X}`}else Pe("brackets");ke({type:"bracket",value:X});continue}if(X==="]"){if(r.nobracket===!0||se&&se.type==="bracket"&&se.value.length===1){ke({type:"text",value:X,output:`\\${X}`});continue}if(g.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(RE("opening","["));ke({type:"text",value:X,output:`\\${X}`});continue}Ye("brackets");let b=se.value.slice(1);if(se.posix!==!0&&b[0]==="^"&&!b.includes("/")&&(X=`/${X}`),se.value+=X,Fe({value:X}),r.literalBrackets===!1||Gl.hasRegexChars(b))continue;let y=Gl.escapeRegex(se.value);if(g.output=g.output.slice(0,-se.value.length),r.literalBrackets===!0){g.output+=y,se.value=y;continue}se.value=`(${f}${y}|${se.value})`,g.output+=se.value;continue}if(X==="{"&&r.nobrace!==!0){Pe("braces");let b={type:"brace",value:X,output:"(",outputIndex:g.output.length,tokensIndex:g.tokens.length};Ee.push(b),ke(b);continue}if(X==="}"){let b=Ee[Ee.length-1];if(r.nobrace===!0||!b){ke({type:"text",value:X,output:X});continue}let y=")";if(b.dots===!0){let F=c.slice(),z=[];for(let Z=F.length-1;Z>=0&&(c.pop(),F[Z].type!=="brace");Z--)F[Z].type!=="dots"&&z.unshift(F[Z].value);y=ant(z,r),g.backtrack=!0}if(b.comma!==!0&&b.dots!==!0){let F=g.output.slice(0,b.outputIndex),z=g.tokens.slice(b.tokensIndex);b.value=b.output="\\{",X=y="\\}",g.output=F;for(let Z of z)g.output+=Z.output||Z.value}ke({type:"brace",value:X,output:y}),Ye("braces"),Ee.pop();continue}if(X==="|"){we.length>0&&we[we.length-1].conditions++,ke({type:"text",value:X});continue}if(X===","){let b=X,y=Ee[Ee.length-1];y&&fe[fe.length-1]==="braces"&&(y.comma=!0,b="|"),ke({type:"comma",value:X,output:b});continue}if(X==="/"){if(se.type==="dot"&&g.index===g.start+1){g.start=g.index+1,g.consumed="",g.output="",c.pop(),se=n;continue}ke({type:"slash",value:X,output:P});continue}if(X==="."){if(g.braces>0&&se.type==="dot"){se.value==="."&&(se.output=C);let b=Ee[Ee.length-1];se.type="dots",se.output+=X,se.value+=X,b.dots=!0;continue}if(g.braces+g.parens===0&&se.type!=="bos"&&se.type!=="slash"){ke({type:"text",value:X,output:C});continue}ke({type:"dot",value:X,output:C});continue}if(X==="?"){if(!(se&&se.value==="(")&&r.noextglob!==!0&&Re()==="("&&Re(2)!=="?"){it("qmark",X);continue}if(se&&se.type==="paren"){let y=Re(),F=X;if(y==="<"&&!Gl.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(se.value==="("&&!/[!=<:]/.test(y)||y==="<"&&!/<([!=]|\w+>)/.test(j()))&&(F=`\\${X}`),ke({type:"text",value:X,output:F});continue}if(r.dot!==!0&&(se.type==="slash"||se.type==="bos")){ke({type:"qmark",value:X,output:ie});continue}ke({type:"qmark",value:X,output:te});continue}if(X==="!"){if(r.noextglob!==!0&&Re()==="("&&(Re(2)!=="?"||!/[!=<:]/.test(Re(3)))){it("negate",X);continue}if(r.nonegate!==!0&&g.index===0){Ne();continue}}if(X==="+"){if(r.noextglob!==!0&&Re()==="("&&Re(2)!=="?"){it("plus",X);continue}if(se&&se.value==="("||r.regex===!1){ke({type:"plus",value:X,output:S});continue}if(se&&(se.type==="bracket"||se.type==="paren"||se.type==="brace")||g.parens>0){ke({type:"plus",value:X});continue}ke({type:"plus",value:S});continue}if(X==="@"){if(r.noextglob!==!0&&Re()==="("&&Re(2)!=="?"){ke({type:"at",extglob:!0,value:X,output:""});continue}ke({type:"text",value:X});continue}if(X!=="*"){(X==="$"||X==="^")&&(X=`\\${X}`);let b=snt.exec(j());b&&(X+=b[0],g.index+=b[0].length),ke({type:"text",value:X});continue}if(se&&(se.type==="globstar"||se.star===!0)){se.type="star",se.star=!0,se.value+=X,se.output=Ce,g.backtrack=!0,g.globstar=!0,rt(X);continue}let x=j();if(r.noextglob!==!0&&/^\([^?]/.test(x)){it("star",X);continue}if(se.type==="star"){if(r.noglobstar===!0){rt(X);continue}let b=se.prev,y=b.prev,F=b.type==="slash"||b.type==="bos",z=y&&(y.type==="star"||y.type==="globstar");if(r.bash===!0&&(!F||x[0]&&x[0]!=="/")){ke({type:"star",value:X,output:""});continue}let Z=g.braces>0&&(b.type==="comma"||b.type==="brace"),$=we.length&&(b.type==="pipe"||b.type==="paren");if(!F&&b.type!=="paren"&&!Z&&!$){ke({type:"star",value:X,output:""});continue}for(;x.slice(0,3)==="/**";){let oe=t[g.index+4];if(oe&&oe!=="/")break;x=x.slice(3),rt("/**",3)}if(b.type==="bos"&&De()){se.type="globstar",se.value+=X,se.output=me(r),g.output=se.output,g.globstar=!0,rt(X);continue}if(b.type==="slash"&&b.prev.type!=="bos"&&!z&&De()){g.output=g.output.slice(0,-(b.output+se.output).length),b.output=`(?:${b.output}`,se.type="globstar",se.output=me(r)+(r.strictSlashes?")":"|$)"),se.value+=X,g.globstar=!0,g.output+=b.output+se.output,rt(X);continue}if(b.type==="slash"&&b.prev.type!=="bos"&&x[0]==="/"){let oe=x[1]!==void 0?"|$":"";g.output=g.output.slice(0,-(b.output+se.output).length),b.output=`(?:${b.output}`,se.type="globstar",se.output=`${me(r)}${P}|${P}${oe})`,se.value+=X,g.output+=b.output+se.output,g.globstar=!0,rt(X+gt()),ke({type:"slash",value:"/",output:""});continue}if(b.type==="bos"&&x[0]==="/"){se.type="globstar",se.value+=X,se.output=`(?:^|${P}|${me(r)}${P})`,g.output=se.output,g.globstar=!0,rt(X+gt()),ke({type:"slash",value:"/",output:""});continue}g.output=g.output.slice(0,-se.output.length),se.type="globstar",se.output=me(r),se.value+=X,g.output+=se.output,g.globstar=!0,rt(X);continue}let w={type:"star",value:X,output:Ce};if(r.bash===!0){w.output=".*?",(se.type==="bos"||se.type==="slash")&&(w.output=pe+w.output),ke(w);continue}if(se&&(se.type==="bracket"||se.type==="paren")&&r.regex===!0){w.output=X,ke(w);continue}(g.index===g.start||se.type==="slash"||se.type==="dot")&&(se.type==="dot"?(g.output+=U,se.output+=U):r.dot===!0?(g.output+=W,se.output+=W):(g.output+=pe,se.output+=pe),Re()!=="*"&&(g.output+=I,se.output+=I)),ke(w)}for(;g.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(RE("closing","]"));g.output=Gl.escapeLast(g.output,"["),Ye("brackets")}for(;g.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(RE("closing",")"));g.output=Gl.escapeLast(g.output,"("),Ye("parens")}for(;g.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(RE("closing","}"));g.output=Gl.escapeLast(g.output,"{"),Ye("braces")}if(r.strictSlashes!==!0&&(se.type==="star"||se.type==="bracket")&&ke({type:"maybe_slash",value:"",output:`${P}?`}),g.backtrack===!0){g.output="";for(let x of g.tokens)g.output+=x.output!=null?x.output:x.value,x.suffix&&(g.output+=x.suffix)}return g};P4.fastpaths=(t,e)=>{let r={...e},s=typeof r.maxLength=="number"?Math.min(Dk,r.maxLength):Dk,a=t.length;if(a>s)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${s}`);t=Pae[t]||t;let n=Gl.isWindows(e),{DOT_LITERAL:c,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:h,NO_DOT:E,NO_DOTS:C,NO_DOTS_SLASH:S,STAR:P,START_ANCHOR:I}=Sk.globChars(n),R=r.dot?C:E,N=r.dot?S:E,U=r.capture?"":"?:",W={negated:!1,prefix:""},te=r.bash===!0?".*?":P;r.capture&&(te=`(${te})`);let ie=pe=>pe.noglobstar===!0?te:`(${U}(?:(?!${I}${pe.dot?h:c}).)*?)`,Ae=pe=>{switch(pe){case"*":return`${R}${p}${te}`;case".*":return`${c}${p}${te}`;case"*.*":return`${R}${te}${c}${p}${te}`;case"*/*":return`${R}${te}${f}${p}${N}${te}`;case"**":return R+ie(r);case"**/*":return`(?:${R}${ie(r)}${f})?${N}${p}${te}`;case"**/*.*":return`(?:${R}${ie(r)}${f})?${N}${te}${c}${p}${te}`;case"**/.*":return`(?:${R}${ie(r)}${f})?${c}${p}${te}`;default:{let Be=/^(.*?)\.(\w+)$/.exec(pe);if(!Be)return;let Ce=Ae(Be[1]);return Ce?Ce+c+Be[2]:void 0}}},ce=Gl.removePrefix(t,W),me=Ae(ce);return me&&r.strictSlashes!==!0&&(me+=`${f}?`),me};xae.exports=P4});var Tae=L((rVt,Qae)=>{"use strict";var lnt=ye("path"),cnt=bae(),x4=kae(),k4=SB(),unt=vB(),fnt=t=>t&&typeof t=="object"&&!Array.isArray(t),Xi=(t,e,r=!1)=>{if(Array.isArray(t)){let E=t.map(S=>Xi(S,e,r));return S=>{for(let P of E){let I=P(S);if(I)return I}return!1}}let s=fnt(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let a=e||{},n=k4.isWindows(e),c=s?Xi.compileRe(t,e):Xi.makeRe(t,e,!1,!0),f=c.state;delete c.state;let p=()=>!1;if(a.ignore){let E={...e,ignore:null,onMatch:null,onResult:null};p=Xi(a.ignore,E,r)}let h=(E,C=!1)=>{let{isMatch:S,match:P,output:I}=Xi.test(E,c,e,{glob:t,posix:n}),R={glob:t,state:f,regex:c,posix:n,input:E,output:I,match:P,isMatch:S};return typeof a.onResult=="function"&&a.onResult(R),S===!1?(R.isMatch=!1,C?R:!1):p(E)?(typeof a.onIgnore=="function"&&a.onIgnore(R),R.isMatch=!1,C?R:!1):(typeof a.onMatch=="function"&&a.onMatch(R),C?R:!0)};return r&&(h.state=f),h};Xi.test=(t,e,r,{glob:s,posix:a}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let n=r||{},c=n.format||(a?k4.toPosixSlashes:null),f=t===s,p=f&&c?c(t):t;return f===!1&&(p=c?c(t):t,f=p===s),(f===!1||n.capture===!0)&&(n.matchBase===!0||n.basename===!0?f=Xi.matchBase(t,e,r,a):f=e.exec(p)),{isMatch:!!f,match:f,output:p}};Xi.matchBase=(t,e,r,s=k4.isWindows(r))=>(e instanceof RegExp?e:Xi.makeRe(e,r)).test(lnt.basename(t));Xi.isMatch=(t,e,r)=>Xi(e,r)(t);Xi.parse=(t,e)=>Array.isArray(t)?t.map(r=>Xi.parse(r,e)):x4(t,{...e,fastpaths:!1});Xi.scan=(t,e)=>cnt(t,e);Xi.compileRe=(t,e,r=!1,s=!1)=>{if(r===!0)return t.output;let a=e||{},n=a.contains?"":"^",c=a.contains?"":"$",f=`${n}(?:${t.output})${c}`;t&&t.negated===!0&&(f=`^(?!${f}).*$`);let p=Xi.toRegex(f,e);return s===!0&&(p.state=t),p};Xi.makeRe=(t,e={},r=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(a.output=x4.fastpaths(t,e)),a.output||(a=x4(t,e)),Xi.compileRe(a,e,r,s)};Xi.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Xi.constants=unt;Qae.exports=Xi});var Fae=L((nVt,Rae)=>{"use strict";Rae.exports=Tae()});var Sa=L((iVt,Mae)=>{"use strict";var Oae=ye("util"),Lae=hae(),Jf=Fae(),Q4=SB(),Nae=t=>t===""||t==="./",ki=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let s=new Set,a=new Set,n=new Set,c=0,f=E=>{n.add(E.output),r&&r.onResult&&r.onResult(E)};for(let E=0;E!s.has(E));if(r&&h.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(E=>E.replace(/\\/g,"")):e}return h};ki.match=ki;ki.matcher=(t,e)=>Jf(t,e);ki.isMatch=(t,e,r)=>Jf(e,r)(t);ki.any=ki.isMatch;ki.not=(t,e,r={})=>{e=[].concat(e).map(String);let s=new Set,a=[],n=f=>{r.onResult&&r.onResult(f),a.push(f.output)},c=new Set(ki(t,e,{...r,onResult:n}));for(let f of a)c.has(f)||s.add(f);return[...s]};ki.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Oae.inspect(t)}"`);if(Array.isArray(e))return e.some(s=>ki.contains(t,s,r));if(typeof e=="string"){if(Nae(t)||Nae(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return ki.isMatch(t,e,{...r,contains:!0})};ki.matchKeys=(t,e,r)=>{if(!Q4.isObject(t))throw new TypeError("Expected the first argument to be an object");let s=ki(Object.keys(t),e,r),a={};for(let n of s)a[n]=t[n];return a};ki.some=(t,e,r)=>{let s=[].concat(t);for(let a of[].concat(e)){let n=Jf(String(a),r);if(s.some(c=>n(c)))return!0}return!1};ki.every=(t,e,r)=>{let s=[].concat(t);for(let a of[].concat(e)){let n=Jf(String(a),r);if(!s.every(c=>n(c)))return!1}return!0};ki.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Oae.inspect(t)}"`);return[].concat(e).every(s=>Jf(s,r)(t))};ki.capture=(t,e,r)=>{let s=Q4.isWindows(r),n=Jf.makeRe(String(t),{...r,capture:!0}).exec(s?Q4.toPosixSlashes(e):e);if(n)return n.slice(1).map(c=>c===void 0?"":c)};ki.makeRe=(...t)=>Jf.makeRe(...t);ki.scan=(...t)=>Jf.scan(...t);ki.parse=(t,e)=>{let r=[];for(let s of[].concat(t||[]))for(let a of Lae(String(s),e))r.push(Jf.parse(a,e));return r};ki.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(t)?[t]:Lae(t,e)};ki.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return ki.braces(t,{...e,expand:!0})};Mae.exports=ki});var Uae=L((sVt,_ae)=>{"use strict";_ae.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var bk=L((oVt,Hae)=>{"use strict";var Ant=Uae();Hae.exports=t=>typeof t=="string"?t.replace(Ant(),""):t});var qae=L((aVt,jae)=>{function pnt(){this.__data__=[],this.size=0}jae.exports=pnt});var FE=L((lVt,Gae)=>{function hnt(t,e){return t===e||t!==t&&e!==e}Gae.exports=hnt});var bB=L((cVt,Wae)=>{var gnt=FE();function dnt(t,e){for(var r=t.length;r--;)if(gnt(t[r][0],e))return r;return-1}Wae.exports=dnt});var Vae=L((uVt,Yae)=>{var mnt=bB(),ynt=Array.prototype,Ent=ynt.splice;function Int(t){var e=this.__data__,r=mnt(e,t);if(r<0)return!1;var s=e.length-1;return r==s?e.pop():Ent.call(e,r,1),--this.size,!0}Yae.exports=Int});var Jae=L((fVt,Kae)=>{var Cnt=bB();function wnt(t){var e=this.__data__,r=Cnt(e,t);return r<0?void 0:e[r][1]}Kae.exports=wnt});var Zae=L((AVt,zae)=>{var Bnt=bB();function vnt(t){return Bnt(this.__data__,t)>-1}zae.exports=vnt});var $ae=L((pVt,Xae)=>{var Snt=bB();function Dnt(t,e){var r=this.__data__,s=Snt(r,t);return s<0?(++this.size,r.push([t,e])):r[s][1]=e,this}Xae.exports=Dnt});var PB=L((hVt,ele)=>{var bnt=qae(),Pnt=Vae(),xnt=Jae(),knt=Zae(),Qnt=$ae();function NE(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var Tnt=PB();function Rnt(){this.__data__=new Tnt,this.size=0}tle.exports=Rnt});var ile=L((dVt,nle)=>{function Fnt(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}nle.exports=Fnt});var ole=L((mVt,sle)=>{function Nnt(t){return this.__data__.get(t)}sle.exports=Nnt});var lle=L((yVt,ale)=>{function Ont(t){return this.__data__.has(t)}ale.exports=Ont});var T4=L((EVt,cle)=>{var Lnt=typeof global=="object"&&global&&global.Object===Object&&global;cle.exports=Lnt});var Pc=L((IVt,ule)=>{var Mnt=T4(),_nt=typeof self=="object"&&self&&self.Object===Object&&self,Unt=Mnt||_nt||Function("return this")();ule.exports=Unt});var Yd=L((CVt,fle)=>{var Hnt=Pc(),jnt=Hnt.Symbol;fle.exports=jnt});var gle=L((wVt,hle)=>{var Ale=Yd(),ple=Object.prototype,qnt=ple.hasOwnProperty,Gnt=ple.toString,xB=Ale?Ale.toStringTag:void 0;function Wnt(t){var e=qnt.call(t,xB),r=t[xB];try{t[xB]=void 0;var s=!0}catch{}var a=Gnt.call(t);return s&&(e?t[xB]=r:delete t[xB]),a}hle.exports=Wnt});var mle=L((BVt,dle)=>{var Ynt=Object.prototype,Vnt=Ynt.toString;function Knt(t){return Vnt.call(t)}dle.exports=Knt});var Vd=L((vVt,Ile)=>{var yle=Yd(),Jnt=gle(),znt=mle(),Znt="[object Null]",Xnt="[object Undefined]",Ele=yle?yle.toStringTag:void 0;function $nt(t){return t==null?t===void 0?Xnt:Znt:Ele&&Ele in Object(t)?Jnt(t):znt(t)}Ile.exports=$nt});var Wl=L((SVt,Cle)=>{function eit(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}Cle.exports=eit});var Pk=L((DVt,wle)=>{var tit=Vd(),rit=Wl(),nit="[object AsyncFunction]",iit="[object Function]",sit="[object GeneratorFunction]",oit="[object Proxy]";function ait(t){if(!rit(t))return!1;var e=tit(t);return e==iit||e==sit||e==nit||e==oit}wle.exports=ait});var vle=L((bVt,Ble)=>{var lit=Pc(),cit=lit["__core-js_shared__"];Ble.exports=cit});var ble=L((PVt,Dle)=>{var R4=vle(),Sle=function(){var t=/[^.]+$/.exec(R4&&R4.keys&&R4.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function uit(t){return!!Sle&&Sle in t}Dle.exports=uit});var F4=L((xVt,Ple)=>{var fit=Function.prototype,Ait=fit.toString;function pit(t){if(t!=null){try{return Ait.call(t)}catch{}try{return t+""}catch{}}return""}Ple.exports=pit});var kle=L((kVt,xle)=>{var hit=Pk(),git=ble(),dit=Wl(),mit=F4(),yit=/[\\^$.*+?()[\]{}|]/g,Eit=/^\[object .+?Constructor\]$/,Iit=Function.prototype,Cit=Object.prototype,wit=Iit.toString,Bit=Cit.hasOwnProperty,vit=RegExp("^"+wit.call(Bit).replace(yit,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Sit(t){if(!dit(t)||git(t))return!1;var e=hit(t)?vit:Eit;return e.test(mit(t))}xle.exports=Sit});var Tle=L((QVt,Qle)=>{function Dit(t,e){return t?.[e]}Qle.exports=Dit});var A0=L((TVt,Rle)=>{var bit=kle(),Pit=Tle();function xit(t,e){var r=Pit(t,e);return bit(r)?r:void 0}Rle.exports=xit});var xk=L((RVt,Fle)=>{var kit=A0(),Qit=Pc(),Tit=kit(Qit,"Map");Fle.exports=Tit});var kB=L((FVt,Nle)=>{var Rit=A0(),Fit=Rit(Object,"create");Nle.exports=Fit});var Mle=L((NVt,Lle)=>{var Ole=kB();function Nit(){this.__data__=Ole?Ole(null):{},this.size=0}Lle.exports=Nit});var Ule=L((OVt,_le)=>{function Oit(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}_le.exports=Oit});var jle=L((LVt,Hle)=>{var Lit=kB(),Mit="__lodash_hash_undefined__",_it=Object.prototype,Uit=_it.hasOwnProperty;function Hit(t){var e=this.__data__;if(Lit){var r=e[t];return r===Mit?void 0:r}return Uit.call(e,t)?e[t]:void 0}Hle.exports=Hit});var Gle=L((MVt,qle)=>{var jit=kB(),qit=Object.prototype,Git=qit.hasOwnProperty;function Wit(t){var e=this.__data__;return jit?e[t]!==void 0:Git.call(e,t)}qle.exports=Wit});var Yle=L((_Vt,Wle)=>{var Yit=kB(),Vit="__lodash_hash_undefined__";function Kit(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Yit&&e===void 0?Vit:e,this}Wle.exports=Kit});var Kle=L((UVt,Vle)=>{var Jit=Mle(),zit=Ule(),Zit=jle(),Xit=Gle(),$it=Yle();function OE(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var Jle=Kle(),est=PB(),tst=xk();function rst(){this.size=0,this.__data__={hash:new Jle,map:new(tst||est),string:new Jle}}zle.exports=rst});var $le=L((jVt,Xle)=>{function nst(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}Xle.exports=nst});var QB=L((qVt,ece)=>{var ist=$le();function sst(t,e){var r=t.__data__;return ist(e)?r[typeof e=="string"?"string":"hash"]:r.map}ece.exports=sst});var rce=L((GVt,tce)=>{var ost=QB();function ast(t){var e=ost(this,t).delete(t);return this.size-=e?1:0,e}tce.exports=ast});var ice=L((WVt,nce)=>{var lst=QB();function cst(t){return lst(this,t).get(t)}nce.exports=cst});var oce=L((YVt,sce)=>{var ust=QB();function fst(t){return ust(this,t).has(t)}sce.exports=fst});var lce=L((VVt,ace)=>{var Ast=QB();function pst(t,e){var r=Ast(this,t),s=r.size;return r.set(t,e),this.size+=r.size==s?0:1,this}ace.exports=pst});var kk=L((KVt,cce)=>{var hst=Zle(),gst=rce(),dst=ice(),mst=oce(),yst=lce();function LE(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var Est=PB(),Ist=xk(),Cst=kk(),wst=200;function Bst(t,e){var r=this.__data__;if(r instanceof Est){var s=r.__data__;if(!Ist||s.length{var vst=PB(),Sst=rle(),Dst=ile(),bst=ole(),Pst=lle(),xst=fce();function ME(t){var e=this.__data__=new vst(t);this.size=e.size}ME.prototype.clear=Sst;ME.prototype.delete=Dst;ME.prototype.get=bst;ME.prototype.has=Pst;ME.prototype.set=xst;Ace.exports=ME});var hce=L((ZVt,pce)=>{var kst="__lodash_hash_undefined__";function Qst(t){return this.__data__.set(t,kst),this}pce.exports=Qst});var dce=L((XVt,gce)=>{function Tst(t){return this.__data__.has(t)}gce.exports=Tst});var yce=L(($Vt,mce)=>{var Rst=kk(),Fst=hce(),Nst=dce();function Tk(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Rst;++e{function Ost(t,e){for(var r=-1,s=t==null?0:t.length;++r{function Lst(t,e){return t.has(e)}Cce.exports=Lst});var N4=L((r7t,Bce)=>{var Mst=yce(),_st=Ice(),Ust=wce(),Hst=1,jst=2;function qst(t,e,r,s,a,n){var c=r&Hst,f=t.length,p=e.length;if(f!=p&&!(c&&p>f))return!1;var h=n.get(t),E=n.get(e);if(h&&E)return h==e&&E==t;var C=-1,S=!0,P=r&jst?new Mst:void 0;for(n.set(t,e),n.set(e,t);++C{var Gst=Pc(),Wst=Gst.Uint8Array;vce.exports=Wst});var Dce=L((i7t,Sce)=>{function Yst(t){var e=-1,r=Array(t.size);return t.forEach(function(s,a){r[++e]=[a,s]}),r}Sce.exports=Yst});var Pce=L((s7t,bce)=>{function Vst(t){var e=-1,r=Array(t.size);return t.forEach(function(s){r[++e]=s}),r}bce.exports=Vst});var Rce=L((o7t,Tce)=>{var xce=Yd(),kce=O4(),Kst=FE(),Jst=N4(),zst=Dce(),Zst=Pce(),Xst=1,$st=2,eot="[object Boolean]",tot="[object Date]",rot="[object Error]",not="[object Map]",iot="[object Number]",sot="[object RegExp]",oot="[object Set]",aot="[object String]",lot="[object Symbol]",cot="[object ArrayBuffer]",uot="[object DataView]",Qce=xce?xce.prototype:void 0,L4=Qce?Qce.valueOf:void 0;function fot(t,e,r,s,a,n,c){switch(r){case uot:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case cot:return!(t.byteLength!=e.byteLength||!n(new kce(t),new kce(e)));case eot:case tot:case iot:return Kst(+t,+e);case rot:return t.name==e.name&&t.message==e.message;case sot:case aot:return t==e+"";case not:var f=zst;case oot:var p=s&Xst;if(f||(f=Zst),t.size!=e.size&&!p)return!1;var h=c.get(t);if(h)return h==e;s|=$st,c.set(t,e);var E=Jst(f(t),f(e),s,a,n,c);return c.delete(t),E;case lot:if(L4)return L4.call(t)==L4.call(e)}return!1}Tce.exports=fot});var Rk=L((a7t,Fce)=>{function Aot(t,e){for(var r=-1,s=e.length,a=t.length;++r{var pot=Array.isArray;Nce.exports=pot});var M4=L((c7t,Oce)=>{var hot=Rk(),got=xc();function dot(t,e,r){var s=e(t);return got(t)?s:hot(s,r(t))}Oce.exports=dot});var Mce=L((u7t,Lce)=>{function mot(t,e){for(var r=-1,s=t==null?0:t.length,a=0,n=[];++r{function yot(){return[]}_ce.exports=yot});var Fk=L((A7t,Hce)=>{var Eot=Mce(),Iot=_4(),Cot=Object.prototype,wot=Cot.propertyIsEnumerable,Uce=Object.getOwnPropertySymbols,Bot=Uce?function(t){return t==null?[]:(t=Object(t),Eot(Uce(t),function(e){return wot.call(t,e)}))}:Iot;Hce.exports=Bot});var qce=L((p7t,jce)=>{function vot(t,e){for(var r=-1,s=Array(t);++r{function Sot(t){return t!=null&&typeof t=="object"}Gce.exports=Sot});var Yce=L((g7t,Wce)=>{var Dot=Vd(),bot=zf(),Pot="[object Arguments]";function xot(t){return bot(t)&&Dot(t)==Pot}Wce.exports=xot});var TB=L((d7t,Jce)=>{var Vce=Yce(),kot=zf(),Kce=Object.prototype,Qot=Kce.hasOwnProperty,Tot=Kce.propertyIsEnumerable,Rot=Vce(function(){return arguments}())?Vce:function(t){return kot(t)&&Qot.call(t,"callee")&&!Tot.call(t,"callee")};Jce.exports=Rot});var Zce=L((m7t,zce)=>{function Fot(){return!1}zce.exports=Fot});var FB=L((RB,_E)=>{var Not=Pc(),Oot=Zce(),eue=typeof RB=="object"&&RB&&!RB.nodeType&&RB,Xce=eue&&typeof _E=="object"&&_E&&!_E.nodeType&&_E,Lot=Xce&&Xce.exports===eue,$ce=Lot?Not.Buffer:void 0,Mot=$ce?$ce.isBuffer:void 0,_ot=Mot||Oot;_E.exports=_ot});var NB=L((y7t,tue)=>{var Uot=9007199254740991,Hot=/^(?:0|[1-9]\d*)$/;function jot(t,e){var r=typeof t;return e=e??Uot,!!e&&(r=="number"||r!="symbol"&&Hot.test(t))&&t>-1&&t%1==0&&t{var qot=9007199254740991;function Got(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=qot}rue.exports=Got});var iue=L((I7t,nue)=>{var Wot=Vd(),Yot=Nk(),Vot=zf(),Kot="[object Arguments]",Jot="[object Array]",zot="[object Boolean]",Zot="[object Date]",Xot="[object Error]",$ot="[object Function]",eat="[object Map]",tat="[object Number]",rat="[object Object]",nat="[object RegExp]",iat="[object Set]",sat="[object String]",oat="[object WeakMap]",aat="[object ArrayBuffer]",lat="[object DataView]",cat="[object Float32Array]",uat="[object Float64Array]",fat="[object Int8Array]",Aat="[object Int16Array]",pat="[object Int32Array]",hat="[object Uint8Array]",gat="[object Uint8ClampedArray]",dat="[object Uint16Array]",mat="[object Uint32Array]",Si={};Si[cat]=Si[uat]=Si[fat]=Si[Aat]=Si[pat]=Si[hat]=Si[gat]=Si[dat]=Si[mat]=!0;Si[Kot]=Si[Jot]=Si[aat]=Si[zot]=Si[lat]=Si[Zot]=Si[Xot]=Si[$ot]=Si[eat]=Si[tat]=Si[rat]=Si[nat]=Si[iat]=Si[sat]=Si[oat]=!1;function yat(t){return Vot(t)&&Yot(t.length)&&!!Si[Wot(t)]}nue.exports=yat});var Ok=L((C7t,sue)=>{function Eat(t){return function(e){return t(e)}}sue.exports=Eat});var Lk=L((OB,UE)=>{var Iat=T4(),oue=typeof OB=="object"&&OB&&!OB.nodeType&&OB,LB=oue&&typeof UE=="object"&&UE&&!UE.nodeType&&UE,Cat=LB&&LB.exports===oue,U4=Cat&&Iat.process,wat=function(){try{var t=LB&&LB.require&&LB.require("util").types;return t||U4&&U4.binding&&U4.binding("util")}catch{}}();UE.exports=wat});var Mk=L((w7t,cue)=>{var Bat=iue(),vat=Ok(),aue=Lk(),lue=aue&&aue.isTypedArray,Sat=lue?vat(lue):Bat;cue.exports=Sat});var H4=L((B7t,uue)=>{var Dat=qce(),bat=TB(),Pat=xc(),xat=FB(),kat=NB(),Qat=Mk(),Tat=Object.prototype,Rat=Tat.hasOwnProperty;function Fat(t,e){var r=Pat(t),s=!r&&bat(t),a=!r&&!s&&xat(t),n=!r&&!s&&!a&&Qat(t),c=r||s||a||n,f=c?Dat(t.length,String):[],p=f.length;for(var h in t)(e||Rat.call(t,h))&&!(c&&(h=="length"||a&&(h=="offset"||h=="parent")||n&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||kat(h,p)))&&f.push(h);return f}uue.exports=Fat});var _k=L((v7t,fue)=>{var Nat=Object.prototype;function Oat(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Nat;return t===r}fue.exports=Oat});var j4=L((S7t,Aue)=>{function Lat(t,e){return function(r){return t(e(r))}}Aue.exports=Lat});var hue=L((D7t,pue)=>{var Mat=j4(),_at=Mat(Object.keys,Object);pue.exports=_at});var due=L((b7t,gue)=>{var Uat=_k(),Hat=hue(),jat=Object.prototype,qat=jat.hasOwnProperty;function Gat(t){if(!Uat(t))return Hat(t);var e=[];for(var r in Object(t))qat.call(t,r)&&r!="constructor"&&e.push(r);return e}gue.exports=Gat});var MB=L((P7t,mue)=>{var Wat=Pk(),Yat=Nk();function Vat(t){return t!=null&&Yat(t.length)&&!Wat(t)}mue.exports=Vat});var Uk=L((x7t,yue)=>{var Kat=H4(),Jat=due(),zat=MB();function Zat(t){return zat(t)?Kat(t):Jat(t)}yue.exports=Zat});var q4=L((k7t,Eue)=>{var Xat=M4(),$at=Fk(),elt=Uk();function tlt(t){return Xat(t,elt,$at)}Eue.exports=tlt});var wue=L((Q7t,Cue)=>{var Iue=q4(),rlt=1,nlt=Object.prototype,ilt=nlt.hasOwnProperty;function slt(t,e,r,s,a,n){var c=r&rlt,f=Iue(t),p=f.length,h=Iue(e),E=h.length;if(p!=E&&!c)return!1;for(var C=p;C--;){var S=f[C];if(!(c?S in e:ilt.call(e,S)))return!1}var P=n.get(t),I=n.get(e);if(P&&I)return P==e&&I==t;var R=!0;n.set(t,e),n.set(e,t);for(var N=c;++C{var olt=A0(),alt=Pc(),llt=olt(alt,"DataView");Bue.exports=llt});var Due=L((R7t,Sue)=>{var clt=A0(),ult=Pc(),flt=clt(ult,"Promise");Sue.exports=flt});var Pue=L((F7t,bue)=>{var Alt=A0(),plt=Pc(),hlt=Alt(plt,"Set");bue.exports=hlt});var kue=L((N7t,xue)=>{var glt=A0(),dlt=Pc(),mlt=glt(dlt,"WeakMap");xue.exports=mlt});var _B=L((O7t,Lue)=>{var G4=vue(),W4=xk(),Y4=Due(),V4=Pue(),K4=kue(),Oue=Vd(),HE=F4(),Que="[object Map]",ylt="[object Object]",Tue="[object Promise]",Rue="[object Set]",Fue="[object WeakMap]",Nue="[object DataView]",Elt=HE(G4),Ilt=HE(W4),Clt=HE(Y4),wlt=HE(V4),Blt=HE(K4),Kd=Oue;(G4&&Kd(new G4(new ArrayBuffer(1)))!=Nue||W4&&Kd(new W4)!=Que||Y4&&Kd(Y4.resolve())!=Tue||V4&&Kd(new V4)!=Rue||K4&&Kd(new K4)!=Fue)&&(Kd=function(t){var e=Oue(t),r=e==ylt?t.constructor:void 0,s=r?HE(r):"";if(s)switch(s){case Elt:return Nue;case Ilt:return Que;case Clt:return Tue;case wlt:return Rue;case Blt:return Fue}return e});Lue.exports=Kd});var Wue=L((L7t,Gue)=>{var J4=Qk(),vlt=N4(),Slt=Rce(),Dlt=wue(),Mue=_B(),_ue=xc(),Uue=FB(),blt=Mk(),Plt=1,Hue="[object Arguments]",jue="[object Array]",Hk="[object Object]",xlt=Object.prototype,que=xlt.hasOwnProperty;function klt(t,e,r,s,a,n){var c=_ue(t),f=_ue(e),p=c?jue:Mue(t),h=f?jue:Mue(e);p=p==Hue?Hk:p,h=h==Hue?Hk:h;var E=p==Hk,C=h==Hk,S=p==h;if(S&&Uue(t)){if(!Uue(e))return!1;c=!0,E=!1}if(S&&!E)return n||(n=new J4),c||blt(t)?vlt(t,e,r,s,a,n):Slt(t,e,p,r,s,a,n);if(!(r&Plt)){var P=E&&que.call(t,"__wrapped__"),I=C&&que.call(e,"__wrapped__");if(P||I){var R=P?t.value():t,N=I?e.value():e;return n||(n=new J4),a(R,N,r,s,n)}}return S?(n||(n=new J4),Dlt(t,e,r,s,a,n)):!1}Gue.exports=klt});var Jue=L((M7t,Kue)=>{var Qlt=Wue(),Yue=zf();function Vue(t,e,r,s,a){return t===e?!0:t==null||e==null||!Yue(t)&&!Yue(e)?t!==t&&e!==e:Qlt(t,e,r,s,Vue,a)}Kue.exports=Vue});var Zue=L((_7t,zue)=>{var Tlt=Jue();function Rlt(t,e){return Tlt(t,e)}zue.exports=Rlt});var z4=L((U7t,Xue)=>{var Flt=A0(),Nlt=function(){try{var t=Flt(Object,"defineProperty");return t({},"",{}),t}catch{}}();Xue.exports=Nlt});var jk=L((H7t,efe)=>{var $ue=z4();function Olt(t,e,r){e=="__proto__"&&$ue?$ue(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}efe.exports=Olt});var Z4=L((j7t,tfe)=>{var Llt=jk(),Mlt=FE();function _lt(t,e,r){(r!==void 0&&!Mlt(t[e],r)||r===void 0&&!(e in t))&&Llt(t,e,r)}tfe.exports=_lt});var nfe=L((q7t,rfe)=>{function Ult(t){return function(e,r,s){for(var a=-1,n=Object(e),c=s(e),f=c.length;f--;){var p=c[t?f:++a];if(r(n[p],p,n)===!1)break}return e}}rfe.exports=Ult});var sfe=L((G7t,ife)=>{var Hlt=nfe(),jlt=Hlt();ife.exports=jlt});var X4=L((UB,jE)=>{var qlt=Pc(),cfe=typeof UB=="object"&&UB&&!UB.nodeType&&UB,ofe=cfe&&typeof jE=="object"&&jE&&!jE.nodeType&&jE,Glt=ofe&&ofe.exports===cfe,afe=Glt?qlt.Buffer:void 0,lfe=afe?afe.allocUnsafe:void 0;function Wlt(t,e){if(e)return t.slice();var r=t.length,s=lfe?lfe(r):new t.constructor(r);return t.copy(s),s}jE.exports=Wlt});var qk=L((W7t,ffe)=>{var ufe=O4();function Ylt(t){var e=new t.constructor(t.byteLength);return new ufe(e).set(new ufe(t)),e}ffe.exports=Ylt});var $4=L((Y7t,Afe)=>{var Vlt=qk();function Klt(t,e){var r=e?Vlt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}Afe.exports=Klt});var Gk=L((V7t,pfe)=>{function Jlt(t,e){var r=-1,s=t.length;for(e||(e=Array(s));++r{var zlt=Wl(),hfe=Object.create,Zlt=function(){function t(){}return function(e){if(!zlt(e))return{};if(hfe)return hfe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();gfe.exports=Zlt});var Wk=L((J7t,mfe)=>{var Xlt=j4(),$lt=Xlt(Object.getPrototypeOf,Object);mfe.exports=$lt});var e3=L((z7t,yfe)=>{var ect=dfe(),tct=Wk(),rct=_k();function nct(t){return typeof t.constructor=="function"&&!rct(t)?ect(tct(t)):{}}yfe.exports=nct});var Ife=L((Z7t,Efe)=>{var ict=MB(),sct=zf();function oct(t){return sct(t)&&ict(t)}Efe.exports=oct});var t3=L((X7t,wfe)=>{var act=Vd(),lct=Wk(),cct=zf(),uct="[object Object]",fct=Function.prototype,Act=Object.prototype,Cfe=fct.toString,pct=Act.hasOwnProperty,hct=Cfe.call(Object);function gct(t){if(!cct(t)||act(t)!=uct)return!1;var e=lct(t);if(e===null)return!0;var r=pct.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Cfe.call(r)==hct}wfe.exports=gct});var r3=L(($7t,Bfe)=>{function dct(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}Bfe.exports=dct});var Yk=L((eKt,vfe)=>{var mct=jk(),yct=FE(),Ect=Object.prototype,Ict=Ect.hasOwnProperty;function Cct(t,e,r){var s=t[e];(!(Ict.call(t,e)&&yct(s,r))||r===void 0&&!(e in t))&&mct(t,e,r)}vfe.exports=Cct});var Jd=L((tKt,Sfe)=>{var wct=Yk(),Bct=jk();function vct(t,e,r,s){var a=!r;r||(r={});for(var n=-1,c=e.length;++n{function Sct(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}Dfe.exports=Sct});var xfe=L((nKt,Pfe)=>{var Dct=Wl(),bct=_k(),Pct=bfe(),xct=Object.prototype,kct=xct.hasOwnProperty;function Qct(t){if(!Dct(t))return Pct(t);var e=bct(t),r=[];for(var s in t)s=="constructor"&&(e||!kct.call(t,s))||r.push(s);return r}Pfe.exports=Qct});var qE=L((iKt,kfe)=>{var Tct=H4(),Rct=xfe(),Fct=MB();function Nct(t){return Fct(t)?Tct(t,!0):Rct(t)}kfe.exports=Nct});var Tfe=L((sKt,Qfe)=>{var Oct=Jd(),Lct=qE();function Mct(t){return Oct(t,Lct(t))}Qfe.exports=Mct});var Mfe=L((oKt,Lfe)=>{var Rfe=Z4(),_ct=X4(),Uct=$4(),Hct=Gk(),jct=e3(),Ffe=TB(),Nfe=xc(),qct=Ife(),Gct=FB(),Wct=Pk(),Yct=Wl(),Vct=t3(),Kct=Mk(),Ofe=r3(),Jct=Tfe();function zct(t,e,r,s,a,n,c){var f=Ofe(t,r),p=Ofe(e,r),h=c.get(p);if(h){Rfe(t,r,h);return}var E=n?n(f,p,r+"",t,e,c):void 0,C=E===void 0;if(C){var S=Nfe(p),P=!S&&Gct(p),I=!S&&!P&&Kct(p);E=p,S||P||I?Nfe(f)?E=f:qct(f)?E=Hct(f):P?(C=!1,E=_ct(p,!0)):I?(C=!1,E=Uct(p,!0)):E=[]:Vct(p)||Ffe(p)?(E=f,Ffe(f)?E=Jct(f):(!Yct(f)||Wct(f))&&(E=jct(p))):C=!1}C&&(c.set(p,E),a(E,p,s,n,c),c.delete(p)),Rfe(t,r,E)}Lfe.exports=zct});var Hfe=L((aKt,Ufe)=>{var Zct=Qk(),Xct=Z4(),$ct=sfe(),eut=Mfe(),tut=Wl(),rut=qE(),nut=r3();function _fe(t,e,r,s,a){t!==e&&$ct(e,function(n,c){if(a||(a=new Zct),tut(n))eut(t,e,c,r,_fe,s,a);else{var f=s?s(nut(t,c),n,c+"",t,e,a):void 0;f===void 0&&(f=n),Xct(t,c,f)}},rut)}Ufe.exports=_fe});var n3=L((lKt,jfe)=>{function iut(t){return t}jfe.exports=iut});var Gfe=L((cKt,qfe)=>{function sut(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}qfe.exports=sut});var i3=L((uKt,Yfe)=>{var out=Gfe(),Wfe=Math.max;function aut(t,e,r){return e=Wfe(e===void 0?t.length-1:e,0),function(){for(var s=arguments,a=-1,n=Wfe(s.length-e,0),c=Array(n);++a{function lut(t){return function(){return t}}Vfe.exports=lut});var Zfe=L((AKt,zfe)=>{var cut=Kfe(),Jfe=z4(),uut=n3(),fut=Jfe?function(t,e){return Jfe(t,"toString",{configurable:!0,enumerable:!1,value:cut(e),writable:!0})}:uut;zfe.exports=fut});var $fe=L((pKt,Xfe)=>{var Aut=800,put=16,hut=Date.now;function gut(t){var e=0,r=0;return function(){var s=hut(),a=put-(s-r);if(r=s,a>0){if(++e>=Aut)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}Xfe.exports=gut});var s3=L((hKt,eAe)=>{var dut=Zfe(),mut=$fe(),yut=mut(dut);eAe.exports=yut});var rAe=L((gKt,tAe)=>{var Eut=n3(),Iut=i3(),Cut=s3();function wut(t,e){return Cut(Iut(t,e,Eut),t+"")}tAe.exports=wut});var iAe=L((dKt,nAe)=>{var But=FE(),vut=MB(),Sut=NB(),Dut=Wl();function but(t,e,r){if(!Dut(r))return!1;var s=typeof e;return(s=="number"?vut(r)&&Sut(e,r.length):s=="string"&&e in r)?But(r[e],t):!1}nAe.exports=but});var oAe=L((mKt,sAe)=>{var Put=rAe(),xut=iAe();function kut(t){return Put(function(e,r){var s=-1,a=r.length,n=a>1?r[a-1]:void 0,c=a>2?r[2]:void 0;for(n=t.length>3&&typeof n=="function"?(a--,n):void 0,c&&xut(r[0],r[1],c)&&(n=a<3?void 0:n,a=1),e=Object(e);++s{var Qut=Hfe(),Tut=oAe(),Rut=Tut(function(t,e,r,s){Qut(t,e,r,s)});aAe.exports=Rut});var je={};Vt(je,{AsyncActions:()=>l3,BufferStream:()=>a3,CachingStrategy:()=>IAe,DefaultStream:()=>c3,allSettledSafe:()=>Uu,assertNever:()=>f3,bufferStream:()=>WE,buildIgnorePattern:()=>Uut,convertMapsToIndexableObjects:()=>Kk,dynamicRequire:()=>kp,escapeRegExp:()=>Nut,getArrayWithDefault:()=>jB,getFactoryWithDefault:()=>Vl,getMapWithDefault:()=>A3,getSetWithDefault:()=>xp,groupBy:()=>qut,isIndexableObject:()=>o3,isPathLike:()=>Hut,isTaggedYarnVersion:()=>Fut,makeDeferred:()=>mAe,mapAndFilter:()=>Yl,mapAndFind:()=>p0,mergeIntoTarget:()=>wAe,overrideType:()=>Out,parseBoolean:()=>qB,parseInt:()=>YE,parseOptionalBoolean:()=>CAe,plural:()=>Vk,prettifyAsyncErrors:()=>GE,prettifySyncErrors:()=>p3,releaseAfterUseAsync:()=>Mut,replaceEnvVariables:()=>Jk,sortMap:()=>Ws,toMerged:()=>jut,tryParseOptionalBoolean:()=>h3,validateEnum:()=>Lut});function Fut(t){return!!(hAe.default.valid(t)&&t.match(/^[^-]+(-rc\.[0-9]+)?$/))}function Vk(t,{one:e,more:r,zero:s=r}){return t===0?s:t===1?e:r}function Nut(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Out(t){}function f3(t){throw new Error(`Assertion failed: Unexpected object '${t}'`)}function Lut(t,e){let r=Object.values(t);if(!r.includes(e))throw new nt(`Invalid value for enumeration: ${JSON.stringify(e)} (expected one of ${r.map(s=>JSON.stringify(s)).join(", ")})`);return e}function Yl(t,e){let r=[];for(let s of t){let a=e(s);a!==gAe&&r.push(a)}return r}function p0(t,e){for(let r of t){let s=e(r);if(s!==dAe)return s}}function o3(t){return typeof t=="object"&&t!==null}async function Uu(t){let e=await Promise.allSettled(t),r=[];for(let s of e){if(s.status==="rejected")throw s.reason;r.push(s.value)}return r}function Kk(t){if(t instanceof Map&&(t=Object.fromEntries(t)),o3(t))for(let e of Object.keys(t)){let r=t[e];o3(r)&&(t[e]=Kk(r))}return t}function Vl(t,e,r){let s=t.get(e);return typeof s>"u"&&t.set(e,s=r()),s}function jB(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=[]),r}function xp(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=new Set),r}function A3(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=new Map),r}async function Mut(t,e){if(e==null)return await t();try{return await t()}finally{await e()}}async function GE(t,e){try{return await t()}catch(r){throw r.message=e(r.message),r}}function p3(t,e){try{return t()}catch(r){throw r.message=e(r.message),r}}async function WE(t){return await new Promise((e,r)=>{let s=[];t.on("error",a=>{r(a)}),t.on("data",a=>{s.push(a)}),t.on("end",()=>{e(Buffer.concat(s))})})}function mAe(){let t,e;return{promise:new Promise((s,a)=>{t=s,e=a}),resolve:t,reject:e}}function yAe(t){return HB(ue.fromPortablePath(t))}function EAe(path){let physicalPath=ue.fromPortablePath(path),currentCacheEntry=HB.cache[physicalPath];delete HB.cache[physicalPath];let result;try{result=yAe(physicalPath);let freshCacheEntry=HB.cache[physicalPath],dynamicModule=eval("module"),freshCacheIndex=dynamicModule.children.indexOf(freshCacheEntry);freshCacheIndex!==-1&&dynamicModule.children.splice(freshCacheIndex,1)}finally{HB.cache[physicalPath]=currentCacheEntry}return result}function _ut(t){let e=cAe.get(t),r=le.statSync(t);if(e?.mtime===r.mtimeMs)return e.instance;let s=EAe(t);return cAe.set(t,{mtime:r.mtimeMs,instance:s}),s}function kp(t,{cachingStrategy:e=2}={}){switch(e){case 0:return EAe(t);case 1:return _ut(t);case 2:return yAe(t);default:throw new Error("Unsupported caching strategy")}}function Ws(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let s=[];for(let n of e)s.push(r.map(c=>n(c)));let a=r.map((n,c)=>c);return a.sort((n,c)=>{for(let f of s){let p=f[n]f[c]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function Uut(t){return t.length===0?null:t.map(e=>`(${AAe.default.makeRe(e,{windows:!1,dot:!0}).source})`).join("|")}function Jk(t,{env:e}){let r=/\${(?[\d\w_]+)(?:)?(?:-(?[^}]*))?}/g;return t.replace(r,(...s)=>{let{variableName:a,colon:n,fallback:c}=s[s.length-1],f=Object.hasOwn(e,a),p=e[a];if(p||f&&!n)return p;if(c!=null)return c;throw new nt(`Environment variable not found (${a})`)})}function qB(t){switch(t){case"true":case"1":case 1:case!0:return!0;case"false":case"0":case 0:case!1:return!1;default:throw new Error(`Couldn't parse "${t}" as a boolean`)}}function CAe(t){return typeof t>"u"?t:qB(t)}function h3(t){try{return CAe(t)}catch{return null}}function Hut(t){return!!(ue.isAbsolute(t)||t.match(/^(\.{1,2}|~)\//))}function wAe(t,...e){let r=c=>({value:c}),s=r(t),a=e.map(c=>r(c)),{value:n}=(0,fAe.default)(s,...a,(c,f)=>{if(Array.isArray(c)&&Array.isArray(f)){for(let p of f)c.find(h=>(0,uAe.default)(h,p))||c.push(p);return c}});return n}function jut(...t){return wAe({},...t)}function qut(t,e){let r=Object.create(null);for(let s of t){let a=s[e];r[a]??=[],r[a].push(s)}return r}function YE(t){return typeof t=="string"?Number.parseInt(t,10):t}var uAe,fAe,AAe,pAe,hAe,u3,gAe,dAe,a3,l3,c3,HB,cAe,IAe,kc=It(()=>{bt();Wt();uAe=et(Zue()),fAe=et(lAe()),AAe=et(Sa()),pAe=et(Md()),hAe=et(fi()),u3=ye("stream");gAe=Symbol();Yl.skip=gAe;dAe=Symbol();p0.skip=dAe;a3=class extends u3.Transform{constructor(){super(...arguments);this.chunks=[]}_transform(r,s,a){if(s!=="buffer"||!Buffer.isBuffer(r))throw new Error("Assertion failed: BufferStream only accept buffers");this.chunks.push(r),a(null,null)}_flush(r){r(null,Buffer.concat(this.chunks))}};l3=class{constructor(e){this.deferred=new Map;this.promises=new Map;this.limit=(0,pAe.default)(e)}set(e,r){let s=this.deferred.get(e);typeof s>"u"&&this.deferred.set(e,s=mAe());let a=this.limit(()=>r());return this.promises.set(e,a),a.then(()=>{this.promises.get(e)===a&&s.resolve()},n=>{this.promises.get(e)===a&&s.reject(n)}),s.promise}reduce(e,r){let s=this.promises.get(e)??Promise.resolve();this.set(e,()=>r(s))}async wait(){await Promise.all(this.promises.values())}},c3=class extends u3.Transform{constructor(r=Buffer.alloc(0)){super();this.active=!0;this.ifEmpty=r}_transform(r,s,a){if(s!=="buffer"||!Buffer.isBuffer(r))throw new Error("Assertion failed: DefaultStream only accept buffers");this.active=!1,a(null,r)}_flush(r){this.active&&this.ifEmpty.length>0?r(null,this.ifEmpty):r(null)}},HB=eval("require");cAe=new Map;IAe=(s=>(s[s.NoCache=0]="NoCache",s[s.FsTime=1]="FsTime",s[s.Node=2]="Node",s))(IAe||{})});var VE,g3,d3,BAe=It(()=>{VE=(r=>(r.HARD="HARD",r.SOFT="SOFT",r))(VE||{}),g3=(s=>(s.Dependency="Dependency",s.PeerDependency="PeerDependency",s.PeerDependencyMeta="PeerDependencyMeta",s))(g3||{}),d3=(s=>(s.Inactive="inactive",s.Redundant="redundant",s.Active="active",s))(d3||{})});var he={};Vt(he,{LogLevel:()=>eQ,Style:()=>Zk,Type:()=>Ct,addLogFilterSupport:()=>YB,applyColor:()=>po,applyHyperlink:()=>JE,applyStyle:()=>zd,json:()=>Zd,jsonOrPretty:()=>Yut,mark:()=>C3,pretty:()=>Ut,prettyField:()=>Zf,prettyList:()=>I3,prettyTruncatedLocatorList:()=>$k,stripAnsi:()=>KE.default,supportsColor:()=>Xk,supportsHyperlinks:()=>E3,tuple:()=>Hu});function vAe(t){let e=["KiB","MiB","GiB","TiB"],r=e.length;for(;r>1&&t<1024**r;)r-=1;let s=1024**r;return`${Math.floor(t*100/s)/100} ${e[r-1]}`}function Hu(t,e){return[e,t]}function zd(t,e,r){return t.get("enableColors")&&r&2&&(e=WB.default.bold(e)),e}function po(t,e,r){if(!t.get("enableColors"))return e;let s=Gut.get(r);if(s===null)return e;let a=typeof s>"u"?r:y3.level>=3?s[0]:s[1],n=typeof a=="number"?m3.ansi256(a):a.startsWith("#")?m3.hex(a):m3[a];if(typeof n!="function")throw new Error(`Invalid format type ${a}`);return n(e)}function JE(t,e,r){return t.get("enableHyperlinks")?Wut?`\x1B]8;;${r}\x1B\\${e}\x1B]8;;\x1B\\`:`\x1B]8;;${r}\x07${e}\x1B]8;;\x07`:e}function Ut(t,e,r){if(e===null)return po(t,"null",Ct.NULL);if(Object.hasOwn(zk,r))return zk[r].pretty(t,e);if(typeof e!="string")throw new Error(`Assertion failed: Expected the value to be a string, got ${typeof e}`);return po(t,e,r)}function I3(t,e,r,{separator:s=", "}={}){return[...e].map(a=>Ut(t,a,r)).join(s)}function Zd(t,e){if(t===null)return null;if(Object.hasOwn(zk,e))return zk[e].json(t);if(typeof t!="string")throw new Error(`Assertion failed: Expected the value to be a string, got ${typeof t}`);return t}function Yut(t,e,[r,s]){return t?Zd(r,s):Ut(e,r,s)}function C3(t){return{Check:po(t,"\u2713","green"),Cross:po(t,"\u2718","red"),Question:po(t,"?","cyan")}}function Zf(t,{label:e,value:[r,s]}){return`${Ut(t,e,Ct.CODE)}: ${Ut(t,r,s)}`}function $k(t,e,r){let s=[],a=[...e],n=r;for(;a.length>0;){let h=a[0],E=`${Yr(t,h)}, `,C=w3(h).length+2;if(s.length>0&&nh).join("").slice(0,-2);let c="X".repeat(a.length.toString().length),f=`and ${c} more.`,p=a.length;for(;s.length>1&&nh).join(""),f.replace(c,Ut(t,p,Ct.NUMBER))].join("")}function YB(t,{configuration:e}){let r=e.get("logFilters"),s=new Map,a=new Map,n=[];for(let C of r){let S=C.get("level");if(typeof S>"u")continue;let P=C.get("code");typeof P<"u"&&s.set(P,S);let I=C.get("text");typeof I<"u"&&a.set(I,S);let R=C.get("pattern");typeof R<"u"&&n.push([SAe.default.matcher(R,{contains:!0}),S])}n.reverse();let c=(C,S,P)=>{if(C===null||C===0)return P;let I=a.size>0||n.length>0?(0,KE.default)(S):S;if(a.size>0){let R=a.get(I);if(typeof R<"u")return R??P}if(n.length>0){for(let[R,N]of n)if(R(I))return N??P}if(s.size>0){let R=s.get(Vf(C));if(typeof R<"u")return R??P}return P},f=t.reportInfo,p=t.reportWarning,h=t.reportError,E=function(C,S,P,I){switch(c(S,P,I)){case"info":f.call(C,S,P);break;case"warning":p.call(C,S??0,P);break;case"error":h.call(C,S??0,P);break}};t.reportInfo=function(...C){return E(this,...C,"info")},t.reportWarning=function(...C){return E(this,...C,"warning")},t.reportError=function(...C){return E(this,...C,"error")}}var WB,GB,SAe,KE,DAe,Ct,Zk,y3,Xk,E3,m3,Gut,Wo,zk,Wut,eQ,Qc=It(()=>{bt();WB=et(g4()),GB=et(Nd());Wt();SAe=et(Sa()),KE=et(bk()),DAe=ye("util");nk();Yo();Ct={NO_HINT:"NO_HINT",ID:"ID",NULL:"NULL",SCOPE:"SCOPE",NAME:"NAME",RANGE:"RANGE",REFERENCE:"REFERENCE",NUMBER:"NUMBER",PATH:"PATH",URL:"URL",ADDED:"ADDED",REMOVED:"REMOVED",CODE:"CODE",INSPECT:"INSPECT",DURATION:"DURATION",SIZE:"SIZE",SIZE_DIFF:"SIZE_DIFF",IDENT:"IDENT",DESCRIPTOR:"DESCRIPTOR",LOCATOR:"LOCATOR",RESOLUTION:"RESOLUTION",DEPENDENT:"DEPENDENT",PACKAGE_EXTENSION:"PACKAGE_EXTENSION",SETTING:"SETTING",MARKDOWN:"MARKDOWN",MARKDOWN_INLINE:"MARKDOWN_INLINE"},Zk=(e=>(e[e.BOLD=2]="BOLD",e))(Zk||{}),y3=GB.default.GITHUB_ACTIONS?{level:2}:WB.default.supportsColor?{level:WB.default.supportsColor.level}:{level:0},Xk=y3.level!==0,E3=Xk&&!GB.default.GITHUB_ACTIONS&&!GB.default.CIRCLE&&!GB.default.GITLAB,m3=new WB.default.Instance(y3),Gut=new Map([[Ct.NO_HINT,null],[Ct.NULL,["#a853b5",129]],[Ct.SCOPE,["#d75f00",166]],[Ct.NAME,["#d7875f",173]],[Ct.RANGE,["#00afaf",37]],[Ct.REFERENCE,["#87afff",111]],[Ct.NUMBER,["#ffd700",220]],[Ct.PATH,["#d75fd7",170]],[Ct.URL,["#d75fd7",170]],[Ct.ADDED,["#5faf00",70]],[Ct.REMOVED,["#ff3131",160]],[Ct.CODE,["#87afff",111]],[Ct.SIZE,["#ffd700",220]]]),Wo=t=>t;zk={[Ct.ID]:Wo({pretty:(t,e)=>typeof e=="number"?po(t,`${e}`,Ct.NUMBER):po(t,e,Ct.CODE),json:t=>t}),[Ct.INSPECT]:Wo({pretty:(t,e)=>(0,DAe.inspect)(e,{depth:1/0,colors:t.get("enableColors"),compact:!0,breakLength:1/0}),json:t=>t}),[Ct.NUMBER]:Wo({pretty:(t,e)=>po(t,`${e}`,Ct.NUMBER),json:t=>t}),[Ct.IDENT]:Wo({pretty:(t,e)=>$i(t,e),json:t=>cn(t)}),[Ct.LOCATOR]:Wo({pretty:(t,e)=>Yr(t,e),json:t=>cl(t)}),[Ct.DESCRIPTOR]:Wo({pretty:(t,e)=>ri(t,e),json:t=>ll(t)}),[Ct.RESOLUTION]:Wo({pretty:(t,{descriptor:e,locator:r})=>VB(t,e,r),json:({descriptor:t,locator:e})=>({descriptor:ll(t),locator:e!==null?cl(e):null})}),[Ct.DEPENDENT]:Wo({pretty:(t,{locator:e,descriptor:r})=>B3(t,e,r),json:({locator:t,descriptor:e})=>({locator:cl(t),descriptor:ll(e)})}),[Ct.PACKAGE_EXTENSION]:Wo({pretty:(t,e)=>{switch(e.type){case"Dependency":return`${$i(t,e.parentDescriptor)} \u27A4 ${po(t,"dependencies",Ct.CODE)} \u27A4 ${$i(t,e.descriptor)}`;case"PeerDependency":return`${$i(t,e.parentDescriptor)} \u27A4 ${po(t,"peerDependencies",Ct.CODE)} \u27A4 ${$i(t,e.descriptor)}`;case"PeerDependencyMeta":return`${$i(t,e.parentDescriptor)} \u27A4 ${po(t,"peerDependenciesMeta",Ct.CODE)} \u27A4 ${$i(t,Da(e.selector))} \u27A4 ${po(t,e.key,Ct.CODE)}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${e.type}`)}},json:t=>{switch(t.type){case"Dependency":return`${cn(t.parentDescriptor)} > ${cn(t.descriptor)}`;case"PeerDependency":return`${cn(t.parentDescriptor)} >> ${cn(t.descriptor)}`;case"PeerDependencyMeta":return`${cn(t.parentDescriptor)} >> ${t.selector} / ${t.key}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${t.type}`)}}}),[Ct.SETTING]:Wo({pretty:(t,e)=>(t.get(e),JE(t,po(t,e,Ct.CODE),`https://yarnpkg.com/configuration/yarnrc#${e}`)),json:t=>t}),[Ct.DURATION]:Wo({pretty:(t,e)=>{if(e>1e3*60){let r=Math.floor(e/1e3/60),s=Math.ceil((e-r*60*1e3)/1e3);return s===0?`${r}m`:`${r}m ${s}s`}else{let r=Math.floor(e/1e3),s=e-r*1e3;return s===0?`${r}s`:`${r}s ${s}ms`}},json:t=>t}),[Ct.SIZE]:Wo({pretty:(t,e)=>po(t,vAe(e),Ct.NUMBER),json:t=>t}),[Ct.SIZE_DIFF]:Wo({pretty:(t,e)=>{let r=e>=0?"+":"-",s=r==="+"?Ct.REMOVED:Ct.ADDED;return po(t,`${r} ${vAe(Math.max(Math.abs(e),1))}`,s)},json:t=>t}),[Ct.PATH]:Wo({pretty:(t,e)=>po(t,ue.fromPortablePath(e),Ct.PATH),json:t=>ue.fromPortablePath(t)}),[Ct.MARKDOWN]:Wo({pretty:(t,{text:e,format:r,paragraphs:s})=>qo(e,{format:r,paragraphs:s}),json:({text:t})=>t}),[Ct.MARKDOWN_INLINE]:Wo({pretty:(t,e)=>(e=e.replace(/(`+)((?:.|[\n])*?)\1/g,(r,s,a)=>Ut(t,s+a+s,Ct.CODE)),e=e.replace(/(\*\*)((?:.|[\n])*?)\1/g,(r,s,a)=>zd(t,a,2)),e),json:t=>t})};Wut=!!process.env.KONSOLE_VERSION;eQ=(a=>(a.Error="error",a.Warning="warning",a.Info="info",a.Discard="discard",a))(eQ||{})});var bAe=L(zE=>{"use strict";Object.defineProperty(zE,"__esModule",{value:!0});zE.splitWhen=zE.flatten=void 0;function Vut(t){return t.reduce((e,r)=>[].concat(e,r),[])}zE.flatten=Vut;function Kut(t,e){let r=[[]],s=0;for(let a of t)e(a)?(s++,r[s]=[]):r[s].push(a);return r}zE.splitWhen=Kut});var PAe=L(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});tQ.isEnoentCodeError=void 0;function Jut(t){return t.code==="ENOENT"}tQ.isEnoentCodeError=Jut});var xAe=L(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});rQ.createDirentFromStats=void 0;var v3=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function zut(t,e){return new v3(t,e)}rQ.createDirentFromStats=zut});var RAe=L(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.convertPosixPathToPattern=cs.convertWindowsPathToPattern=cs.convertPathToPattern=cs.escapePosixPath=cs.escapeWindowsPath=cs.escape=cs.removeLeadingDotSegment=cs.makeAbsolute=cs.unixify=void 0;var Zut=ye("os"),Xut=ye("path"),kAe=Zut.platform()==="win32",$ut=2,eft=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,tft=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,rft=/^\\\\([.?])/,nft=/\\(?![!()+@[\]{}])/g;function ift(t){return t.replace(/\\/g,"/")}cs.unixify=ift;function sft(t,e){return Xut.resolve(t,e)}cs.makeAbsolute=sft;function oft(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice($ut)}return t}cs.removeLeadingDotSegment=oft;cs.escape=kAe?S3:D3;function S3(t){return t.replace(tft,"\\$2")}cs.escapeWindowsPath=S3;function D3(t){return t.replace(eft,"\\$2")}cs.escapePosixPath=D3;cs.convertPathToPattern=kAe?QAe:TAe;function QAe(t){return S3(t).replace(rft,"//$1").replace(nft,"/")}cs.convertWindowsPathToPattern=QAe;function TAe(t){return D3(t)}cs.convertPosixPathToPattern=TAe});var NAe=L((RKt,FAe)=>{FAe.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var MAe=L((FKt,LAe)=>{var aft=NAe(),OAe={"{":"}","(":")","[":"]"},lft=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,s=-2,a=-2,n=-2,c=-2;ee&&(c===-1||c>s||(c=t.indexOf("\\",e),c===-1||c>s)))||a!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(a=t.indexOf("}",e),a>e&&(c=t.indexOf("\\",e),c===-1||c>a))||n!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(n=t.indexOf(")",e),n>e&&(c=t.indexOf("\\",e),c===-1||c>n))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(rr&&(c=t.indexOf("\\",r),c===-1||c>n))))return!0;if(t[e]==="\\"){var f=t[e+1];e+=2;var p=OAe[f];if(p){var h=t.indexOf(p,e);h!==-1&&(e=h+1)}if(t[e]==="!")return!0}else e++}return!1},cft=function(t){if(t[0]==="!")return!0;for(var e=0;e{"use strict";var uft=MAe(),fft=ye("path").posix.dirname,Aft=ye("os").platform()==="win32",b3="/",pft=/\\/g,hft=/[\{\[].*[\}\]]$/,gft=/(^|[^\\])([\{\[]|\([^\)]+$)/,dft=/\\([\!\*\?\|\[\]\(\)\{\}])/g;_Ae.exports=function(e,r){var s=Object.assign({flipBackslashes:!0},r);s.flipBackslashes&&Aft&&e.indexOf(b3)<0&&(e=e.replace(pft,b3)),hft.test(e)&&(e+=b3),e+="a";do e=fft(e);while(uft(e)||gft.test(e));return e.replace(dft,"$1")}});var KAe=L(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.removeDuplicateSlashes=jr.matchAny=jr.convertPatternsToRe=jr.makeRe=jr.getPatternParts=jr.expandBraceExpansion=jr.expandPatternsWithBraceExpansion=jr.isAffectDepthOfReadingPattern=jr.endsWithSlashGlobStar=jr.hasGlobStar=jr.getBaseDirectory=jr.isPatternRelatedToParentDirectory=jr.getPatternsOutsideCurrentDirectory=jr.getPatternsInsideCurrentDirectory=jr.getPositivePatterns=jr.getNegativePatterns=jr.isPositivePattern=jr.isNegativePattern=jr.convertToNegativePattern=jr.convertToPositivePattern=jr.isDynamicPattern=jr.isStaticPattern=void 0;var mft=ye("path"),yft=UAe(),P3=Sa(),HAe="**",Eft="\\",Ift=/[*?]|^!/,Cft=/\[[^[]*]/,wft=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Bft=/[!*+?@]\([^(]*\)/,vft=/,|\.\./,Sft=/(?!^)\/{2,}/g;function jAe(t,e={}){return!qAe(t,e)}jr.isStaticPattern=jAe;function qAe(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(Eft)||Ift.test(t)||Cft.test(t)||wft.test(t)||e.extglob!==!1&&Bft.test(t)||e.braceExpansion!==!1&&Dft(t))}jr.isDynamicPattern=qAe;function Dft(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let s=t.slice(e,r);return vft.test(s)}function bft(t){return nQ(t)?t.slice(1):t}jr.convertToPositivePattern=bft;function Pft(t){return"!"+t}jr.convertToNegativePattern=Pft;function nQ(t){return t.startsWith("!")&&t[1]!=="("}jr.isNegativePattern=nQ;function GAe(t){return!nQ(t)}jr.isPositivePattern=GAe;function xft(t){return t.filter(nQ)}jr.getNegativePatterns=xft;function kft(t){return t.filter(GAe)}jr.getPositivePatterns=kft;function Qft(t){return t.filter(e=>!x3(e))}jr.getPatternsInsideCurrentDirectory=Qft;function Tft(t){return t.filter(x3)}jr.getPatternsOutsideCurrentDirectory=Tft;function x3(t){return t.startsWith("..")||t.startsWith("./..")}jr.isPatternRelatedToParentDirectory=x3;function Rft(t){return yft(t,{flipBackslashes:!1})}jr.getBaseDirectory=Rft;function Fft(t){return t.includes(HAe)}jr.hasGlobStar=Fft;function WAe(t){return t.endsWith("/"+HAe)}jr.endsWithSlashGlobStar=WAe;function Nft(t){let e=mft.basename(t);return WAe(t)||jAe(e)}jr.isAffectDepthOfReadingPattern=Nft;function Oft(t){return t.reduce((e,r)=>e.concat(YAe(r)),[])}jr.expandPatternsWithBraceExpansion=Oft;function YAe(t){let e=P3.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,s)=>r.length-s.length),e.filter(r=>r!=="")}jr.expandBraceExpansion=YAe;function Lft(t,e){let{parts:r}=P3.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}jr.getPatternParts=Lft;function VAe(t,e){return P3.makeRe(t,e)}jr.makeRe=VAe;function Mft(t,e){return t.map(r=>VAe(r,e))}jr.convertPatternsToRe=Mft;function _ft(t,e){return e.some(r=>r.test(t))}jr.matchAny=_ft;function Uft(t){return t.replace(Sft,"/")}jr.removeDuplicateSlashes=Uft});var XAe=L((LKt,ZAe)=>{"use strict";var Hft=ye("stream"),JAe=Hft.PassThrough,jft=Array.prototype.slice;ZAe.exports=qft;function qft(){let t=[],e=jft.call(arguments),r=!1,s=e[e.length-1];s&&!Array.isArray(s)&&s.pipe==null?e.pop():s={};let a=s.end!==!1,n=s.pipeError===!0;s.objectMode==null&&(s.objectMode=!0),s.highWaterMark==null&&(s.highWaterMark=64*1024);let c=JAe(s);function f(){for(let E=0,C=arguments.length;E0||(r=!1,p())}function P(I){function R(){I.removeListener("merge2UnpipeEnd",R),I.removeListener("end",R),n&&I.removeListener("error",N),S()}function N(U){c.emit("error",U)}if(I._readableState.endEmitted)return S();I.on("merge2UnpipeEnd",R),I.on("end",R),n&&I.on("error",N),I.pipe(c,{end:!1}),I.resume()}for(let I=0;I{"use strict";Object.defineProperty(iQ,"__esModule",{value:!0});iQ.merge=void 0;var Gft=XAe();function Wft(t){let e=Gft(t);return t.forEach(r=>{r.once("error",s=>e.emit("error",s))}),e.once("close",()=>$Ae(t)),e.once("end",()=>$Ae(t)),e}iQ.merge=Wft;function $Ae(t){t.forEach(e=>e.emit("close"))}});var tpe=L(ZE=>{"use strict";Object.defineProperty(ZE,"__esModule",{value:!0});ZE.isEmpty=ZE.isString=void 0;function Yft(t){return typeof t=="string"}ZE.isString=Yft;function Vft(t){return t===""}ZE.isEmpty=Vft});var Qp=L(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.string=Vo.stream=Vo.pattern=Vo.path=Vo.fs=Vo.errno=Vo.array=void 0;var Kft=bAe();Vo.array=Kft;var Jft=PAe();Vo.errno=Jft;var zft=xAe();Vo.fs=zft;var Zft=RAe();Vo.path=Zft;var Xft=KAe();Vo.pattern=Xft;var $ft=epe();Vo.stream=$ft;var eAt=tpe();Vo.string=eAt});var spe=L(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.convertPatternGroupToTask=Ko.convertPatternGroupsToTasks=Ko.groupPatternsByBaseDirectory=Ko.getNegativePatternsAsPositive=Ko.getPositivePatterns=Ko.convertPatternsToTasks=Ko.generate=void 0;var ju=Qp();function tAt(t,e){let r=rpe(t,e),s=rpe(e.ignore,e),a=npe(r),n=ipe(r,s),c=a.filter(E=>ju.pattern.isStaticPattern(E,e)),f=a.filter(E=>ju.pattern.isDynamicPattern(E,e)),p=k3(c,n,!1),h=k3(f,n,!0);return p.concat(h)}Ko.generate=tAt;function rpe(t,e){let r=t;return e.braceExpansion&&(r=ju.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(s=>s.includes("/")?s:`**/${s}`)),r.map(s=>ju.pattern.removeDuplicateSlashes(s))}function k3(t,e,r){let s=[],a=ju.pattern.getPatternsOutsideCurrentDirectory(t),n=ju.pattern.getPatternsInsideCurrentDirectory(t),c=Q3(a),f=Q3(n);return s.push(...T3(c,e,r)),"."in f?s.push(R3(".",n,e,r)):s.push(...T3(f,e,r)),s}Ko.convertPatternsToTasks=k3;function npe(t){return ju.pattern.getPositivePatterns(t)}Ko.getPositivePatterns=npe;function ipe(t,e){return ju.pattern.getNegativePatterns(t).concat(e).map(ju.pattern.convertToPositivePattern)}Ko.getNegativePatternsAsPositive=ipe;function Q3(t){let e={};return t.reduce((r,s)=>{let a=ju.pattern.getBaseDirectory(s);return a in r?r[a].push(s):r[a]=[s],r},e)}Ko.groupPatternsByBaseDirectory=Q3;function T3(t,e,r){return Object.keys(t).map(s=>R3(s,t[s],e,r))}Ko.convertPatternGroupsToTasks=T3;function R3(t,e,r,s){return{dynamic:s,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(ju.pattern.convertToNegativePattern))}}Ko.convertPatternGroupToTask=R3});var ape=L(sQ=>{"use strict";Object.defineProperty(sQ,"__esModule",{value:!0});sQ.read=void 0;function rAt(t,e,r){e.fs.lstat(t,(s,a)=>{if(s!==null){ope(r,s);return}if(!a.isSymbolicLink()||!e.followSymbolicLink){F3(r,a);return}e.fs.stat(t,(n,c)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){ope(r,n);return}F3(r,a);return}e.markSymbolicLink&&(c.isSymbolicLink=()=>!0),F3(r,c)})})}sQ.read=rAt;function ope(t,e){t(e)}function F3(t,e){t(null,e)}});var lpe=L(oQ=>{"use strict";Object.defineProperty(oQ,"__esModule",{value:!0});oQ.read=void 0;function nAt(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let s=e.fs.statSync(t);return e.markSymbolicLink&&(s.isSymbolicLink=()=>!0),s}catch(s){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw s}}oQ.read=nAt});var cpe=L(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});h0.createFileSystemAdapter=h0.FILE_SYSTEM_ADAPTER=void 0;var aQ=ye("fs");h0.FILE_SYSTEM_ADAPTER={lstat:aQ.lstat,stat:aQ.stat,lstatSync:aQ.lstatSync,statSync:aQ.statSync};function iAt(t){return t===void 0?h0.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},h0.FILE_SYSTEM_ADAPTER),t)}h0.createFileSystemAdapter=iAt});var upe=L(O3=>{"use strict";Object.defineProperty(O3,"__esModule",{value:!0});var sAt=cpe(),N3=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=sAt.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};O3.default=N3});var Xd=L(g0=>{"use strict";Object.defineProperty(g0,"__esModule",{value:!0});g0.statSync=g0.stat=g0.Settings=void 0;var fpe=ape(),oAt=lpe(),L3=upe();g0.Settings=L3.default;function aAt(t,e,r){if(typeof e=="function"){fpe.read(t,M3(),e);return}fpe.read(t,M3(e),r)}g0.stat=aAt;function lAt(t,e){let r=M3(e);return oAt.read(t,r)}g0.statSync=lAt;function M3(t={}){return t instanceof L3.default?t:new L3.default(t)}});var hpe=L((VKt,ppe)=>{var Ape;ppe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(Ape||(Ape=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var dpe=L((KKt,gpe)=>{gpe.exports=uAt;var cAt=hpe();function uAt(t,e){let r,s,a,n=!0;Array.isArray(t)?(r=[],s=t.length):(a=Object.keys(t),r={},s=a.length);function c(p){function h(){e&&e(p,r),e=null}n?cAt(h):h()}function f(p,h,E){r[p]=E,(--s===0||h)&&c(h)}s?a?a.forEach(function(p){t[p](function(h,E){f(p,h,E)})}):t.forEach(function(p,h){p(function(E,C){f(h,E,C)})}):c(null),n=!1}});var _3=L(cQ=>{"use strict";Object.defineProperty(cQ,"__esModule",{value:!0});cQ.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var lQ=process.versions.node.split(".");if(lQ[0]===void 0||lQ[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var mpe=Number.parseInt(lQ[0],10),fAt=Number.parseInt(lQ[1],10),ype=10,AAt=10,pAt=mpe>ype,hAt=mpe===ype&&fAt>=AAt;cQ.IS_SUPPORT_READDIR_WITH_FILE_TYPES=pAt||hAt});var Epe=L(uQ=>{"use strict";Object.defineProperty(uQ,"__esModule",{value:!0});uQ.createDirentFromStats=void 0;var U3=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function gAt(t,e){return new U3(t,e)}uQ.createDirentFromStats=gAt});var H3=L(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.fs=void 0;var dAt=Epe();fQ.fs=dAt});var j3=L(AQ=>{"use strict";Object.defineProperty(AQ,"__esModule",{value:!0});AQ.joinPathSegments=void 0;function mAt(t,e,r){return t.endsWith(r)?t+e:t+r+e}AQ.joinPathSegments=mAt});var Spe=L(d0=>{"use strict";Object.defineProperty(d0,"__esModule",{value:!0});d0.readdir=d0.readdirWithFileTypes=d0.read=void 0;var yAt=Xd(),Ipe=dpe(),EAt=_3(),Cpe=H3(),wpe=j3();function IAt(t,e,r){if(!e.stats&&EAt.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Bpe(t,e,r);return}vpe(t,e,r)}d0.read=IAt;function Bpe(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(s,a)=>{if(s!==null){pQ(r,s);return}let n=a.map(f=>({dirent:f,name:f.name,path:wpe.joinPathSegments(t,f.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){q3(r,n);return}let c=n.map(f=>CAt(f,e));Ipe(c,(f,p)=>{if(f!==null){pQ(r,f);return}q3(r,p)})})}d0.readdirWithFileTypes=Bpe;function CAt(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(s,a)=>{if(s!==null){if(e.throwErrorOnBrokenSymbolicLink){r(s);return}r(null,t);return}t.dirent=Cpe.fs.createDirentFromStats(t.name,a),r(null,t)})}}function vpe(t,e,r){e.fs.readdir(t,(s,a)=>{if(s!==null){pQ(r,s);return}let n=a.map(c=>{let f=wpe.joinPathSegments(t,c,e.pathSegmentSeparator);return p=>{yAt.stat(f,e.fsStatSettings,(h,E)=>{if(h!==null){p(h);return}let C={name:c,path:f,dirent:Cpe.fs.createDirentFromStats(c,E)};e.stats&&(C.stats=E),p(null,C)})}});Ipe(n,(c,f)=>{if(c!==null){pQ(r,c);return}q3(r,f)})})}d0.readdir=vpe;function pQ(t,e){t(e)}function q3(t,e){t(null,e)}});var kpe=L(m0=>{"use strict";Object.defineProperty(m0,"__esModule",{value:!0});m0.readdir=m0.readdirWithFileTypes=m0.read=void 0;var wAt=Xd(),BAt=_3(),Dpe=H3(),bpe=j3();function vAt(t,e){return!e.stats&&BAt.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Ppe(t,e):xpe(t,e)}m0.read=vAt;function Ppe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(s=>{let a={dirent:s,name:s.name,path:bpe.joinPathSegments(t,s.name,e.pathSegmentSeparator)};if(a.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let n=e.fs.statSync(a.path);a.dirent=Dpe.fs.createDirentFromStats(a.name,n)}catch(n){if(e.throwErrorOnBrokenSymbolicLink)throw n}return a})}m0.readdirWithFileTypes=Ppe;function xpe(t,e){return e.fs.readdirSync(t).map(s=>{let a=bpe.joinPathSegments(t,s,e.pathSegmentSeparator),n=wAt.statSync(a,e.fsStatSettings),c={name:s,path:a,dirent:Dpe.fs.createDirentFromStats(s,n)};return e.stats&&(c.stats=n),c})}m0.readdir=xpe});var Qpe=L(y0=>{"use strict";Object.defineProperty(y0,"__esModule",{value:!0});y0.createFileSystemAdapter=y0.FILE_SYSTEM_ADAPTER=void 0;var XE=ye("fs");y0.FILE_SYSTEM_ADAPTER={lstat:XE.lstat,stat:XE.stat,lstatSync:XE.lstatSync,statSync:XE.statSync,readdir:XE.readdir,readdirSync:XE.readdirSync};function SAt(t){return t===void 0?y0.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},y0.FILE_SYSTEM_ADAPTER),t)}y0.createFileSystemAdapter=SAt});var Tpe=L(W3=>{"use strict";Object.defineProperty(W3,"__esModule",{value:!0});var DAt=ye("path"),bAt=Xd(),PAt=Qpe(),G3=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=PAt.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,DAt.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new bAt.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};W3.default=G3});var hQ=L(E0=>{"use strict";Object.defineProperty(E0,"__esModule",{value:!0});E0.Settings=E0.scandirSync=E0.scandir=void 0;var Rpe=Spe(),xAt=kpe(),Y3=Tpe();E0.Settings=Y3.default;function kAt(t,e,r){if(typeof e=="function"){Rpe.read(t,V3(),e);return}Rpe.read(t,V3(e),r)}E0.scandir=kAt;function QAt(t,e){let r=V3(e);return xAt.read(t,r)}E0.scandirSync=QAt;function V3(t={}){return t instanceof Y3.default?t:new Y3.default(t)}});var Npe=L((iJt,Fpe)=>{"use strict";function TAt(t){var e=new t,r=e;function s(){var n=e;return n.next?e=n.next:(e=new t,r=e),n.next=null,n}function a(n){r.next=n,r=n}return{get:s,release:a}}Fpe.exports=TAt});var Lpe=L((sJt,K3)=>{"use strict";var RAt=Npe();function Ope(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var s=RAt(FAt),a=null,n=null,c=0,f=null,p={push:R,drain:Tc,saturated:Tc,pause:E,paused:!1,get concurrency(){return r},set concurrency(Ae){if(!(Ae>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=Ae,!p.paused)for(;a&&c=r||p.paused?n?(n.next=me,n=me):(a=me,n=me,p.saturated()):(c++,e.call(t,me.value,me.worked))}function N(Ae,ce){var me=s.get();me.context=t,me.release=U,me.value=Ae,me.callback=ce||Tc,me.errorHandler=f,c>=r||p.paused?a?(me.next=a,a=me):(a=me,n=me,p.saturated()):(c++,e.call(t,me.value,me.worked))}function U(Ae){Ae&&s.release(Ae);var ce=a;ce&&c<=r?p.paused?c--:(n===a&&(n=null),a=ce.next,ce.next=null,e.call(t,ce.value,ce.worked),n===null&&p.empty()):--c===0&&p.drain()}function W(){a=null,n=null,p.drain=Tc}function te(){a=null,n=null,p.drain(),p.drain=Tc}function ie(Ae){f=Ae}}function Tc(){}function FAt(){this.value=null,this.callback=Tc,this.next=null,this.release=Tc,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,s){var a=t.callback,n=t.errorHandler,c=t.value;t.value=null,t.callback=Tc,t.errorHandler&&n(r,c),a.call(t.context,r,s),t.release(t)}}function NAt(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function s(E,C){e.call(this,E).then(function(S){C(null,S)},C)}var a=Ope(t,s,r),n=a.push,c=a.unshift;return a.push=f,a.unshift=p,a.drained=h,a;function f(E){var C=new Promise(function(S,P){n(E,function(I,R){if(I){P(I);return}S(R)})});return C.catch(Tc),C}function p(E){var C=new Promise(function(S,P){c(E,function(I,R){if(I){P(I);return}S(R)})});return C.catch(Tc),C}function h(){if(a.idle())return new Promise(function(S){S()});var E=a.drain,C=new Promise(function(S){a.drain=function(){E(),S()}});return C}}K3.exports=Ope;K3.exports.promise=NAt});var gQ=L(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.joinPathSegments=Xf.replacePathSegmentSeparator=Xf.isAppliedFilter=Xf.isFatalError=void 0;function OAt(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Xf.isFatalError=OAt;function LAt(t,e){return t===null||t(e)}Xf.isAppliedFilter=LAt;function MAt(t,e){return t.split(/[/\\]/).join(e)}Xf.replacePathSegmentSeparator=MAt;function _At(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Xf.joinPathSegments=_At});var Z3=L(z3=>{"use strict";Object.defineProperty(z3,"__esModule",{value:!0});var UAt=gQ(),J3=class{constructor(e,r){this._root=e,this._settings=r,this._root=UAt.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};z3.default=J3});var e8=L($3=>{"use strict";Object.defineProperty($3,"__esModule",{value:!0});var HAt=ye("events"),jAt=hQ(),qAt=Lpe(),dQ=gQ(),GAt=Z3(),X3=class extends GAt.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=jAt.scandir,this._emitter=new HAt.EventEmitter,this._queue=qAt(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let s={directory:e,base:r};this._queue.push(s,a=>{a!==null&&this._handleError(a)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(s,a)=>{if(s!==null){r(s,void 0);return}for(let n of a)this._handleEntry(n,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!dQ.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let s=e.path;r!==void 0&&(e.path=dQ.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),dQ.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&dQ.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(s,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};$3.default=X3});var Mpe=L(r8=>{"use strict";Object.defineProperty(r8,"__esModule",{value:!0});var WAt=e8(),t8=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new WAt.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{YAt(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{VAt(e,this._storage)}),this._reader.read()}};r8.default=t8;function YAt(t,e){t(e)}function VAt(t,e){t(null,e)}});var _pe=L(i8=>{"use strict";Object.defineProperty(i8,"__esModule",{value:!0});var KAt=ye("stream"),JAt=e8(),n8=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new JAt.default(this._root,this._settings),this._stream=new KAt.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};i8.default=n8});var Upe=L(o8=>{"use strict";Object.defineProperty(o8,"__esModule",{value:!0});var zAt=hQ(),mQ=gQ(),ZAt=Z3(),s8=class extends ZAt.default{constructor(){super(...arguments),this._scandir=zAt.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let s=this._scandir(e,this._settings.fsScandirSettings);for(let a of s)this._handleEntry(a,r)}catch(s){this._handleError(s)}}_handleError(e){if(mQ.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let s=e.path;r!==void 0&&(e.path=mQ.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),mQ.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&mQ.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(s,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};o8.default=s8});var Hpe=L(l8=>{"use strict";Object.defineProperty(l8,"__esModule",{value:!0});var XAt=Upe(),a8=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new XAt.default(this._root,this._settings)}read(){return this._reader.read()}};l8.default=a8});var jpe=L(u8=>{"use strict";Object.defineProperty(u8,"__esModule",{value:!0});var $At=ye("path"),ept=hQ(),c8=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,$At.sep),this.fsScandirSettings=new ept.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};u8.default=c8});var EQ=L($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.Settings=$f.walkStream=$f.walkSync=$f.walk=void 0;var qpe=Mpe(),tpt=_pe(),rpt=Hpe(),f8=jpe();$f.Settings=f8.default;function npt(t,e,r){if(typeof e=="function"){new qpe.default(t,yQ()).read(e);return}new qpe.default(t,yQ(e)).read(r)}$f.walk=npt;function ipt(t,e){let r=yQ(e);return new rpt.default(t,r).read()}$f.walkSync=ipt;function spt(t,e){let r=yQ(e);return new tpt.default(t,r).read()}$f.walkStream=spt;function yQ(t={}){return t instanceof f8.default?t:new f8.default(t)}});var IQ=L(p8=>{"use strict";Object.defineProperty(p8,"__esModule",{value:!0});var opt=ye("path"),apt=Xd(),Gpe=Qp(),A8=class{constructor(e){this._settings=e,this._fsStatSettings=new apt.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return opt.resolve(this._settings.cwd,e)}_makeEntry(e,r){let s={name:r,path:r,dirent:Gpe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(s.stats=e),s}_isFatalError(e){return!Gpe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};p8.default=A8});var d8=L(g8=>{"use strict";Object.defineProperty(g8,"__esModule",{value:!0});var lpt=ye("stream"),cpt=Xd(),upt=EQ(),fpt=IQ(),h8=class extends fpt.default{constructor(){super(...arguments),this._walkStream=upt.walkStream,this._stat=cpt.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let s=e.map(this._getFullEntryPath,this),a=new lpt.PassThrough({objectMode:!0});a._write=(n,c,f)=>this._getEntry(s[n],e[n],r).then(p=>{p!==null&&r.entryFilter(p)&&a.push(p),n===s.length-1&&a.end(),f()}).catch(f);for(let n=0;nthis._makeEntry(a,r)).catch(a=>{if(s.errorFilter(a))return null;throw a})}_getStat(e){return new Promise((r,s)=>{this._stat(e,this._fsStatSettings,(a,n)=>a===null?r(n):s(a))})}};g8.default=h8});var Wpe=L(y8=>{"use strict";Object.defineProperty(y8,"__esModule",{value:!0});var Apt=EQ(),ppt=IQ(),hpt=d8(),m8=class extends ppt.default{constructor(){super(...arguments),this._walkAsync=Apt.walk,this._readerStream=new hpt.default(this._settings)}dynamic(e,r){return new Promise((s,a)=>{this._walkAsync(e,r,(n,c)=>{n===null?s(c):a(n)})})}async static(e,r){let s=[],a=this._readerStream.static(e,r);return new Promise((n,c)=>{a.once("error",c),a.on("data",f=>s.push(f)),a.once("end",()=>n(s))})}};y8.default=m8});var Ype=L(I8=>{"use strict";Object.defineProperty(I8,"__esModule",{value:!0});var KB=Qp(),E8=class{constructor(e,r,s){this._patterns=e,this._settings=r,this._micromatchOptions=s,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),s=this._splitSegmentsIntoSections(r);this._storage.push({complete:s.length<=1,pattern:e,segments:r,sections:s})}}_getPatternSegments(e){return KB.pattern.getPatternParts(e,this._micromatchOptions).map(s=>KB.pattern.isDynamicPattern(s,this._settings)?{dynamic:!0,pattern:s,patternRe:KB.pattern.makeRe(s,this._micromatchOptions)}:{dynamic:!1,pattern:s})}_splitSegmentsIntoSections(e){return KB.array.splitWhen(e,r=>r.dynamic&&KB.pattern.hasGlobStar(r.pattern))}};I8.default=E8});var Vpe=L(w8=>{"use strict";Object.defineProperty(w8,"__esModule",{value:!0});var gpt=Ype(),C8=class extends gpt.default{match(e){let r=e.split("/"),s=r.length,a=this._storage.filter(n=>!n.complete||n.segments.length>s);for(let n of a){let c=n.sections[0];if(!n.complete&&s>c.length||r.every((p,h)=>{let E=n.segments[h];return!!(E.dynamic&&E.patternRe.test(p)||!E.dynamic&&E.pattern===p)}))return!0}return!1}};w8.default=C8});var Kpe=L(v8=>{"use strict";Object.defineProperty(v8,"__esModule",{value:!0});var CQ=Qp(),dpt=Vpe(),B8=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,s){let a=this._getMatcher(r),n=this._getNegativePatternsRe(s);return c=>this._filter(e,c,a,n)}_getMatcher(e){return new dpt.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(CQ.pattern.isAffectDepthOfReadingPattern);return CQ.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,s,a){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let n=CQ.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(n,s)?!1:this._isSkippedByNegativePatterns(n,a)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let s=r.split("/").length;if(e==="")return s;let a=e.split("/").length;return s-a}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!CQ.pattern.matchAny(e,r)}};v8.default=B8});var Jpe=L(D8=>{"use strict";Object.defineProperty(D8,"__esModule",{value:!0});var $d=Qp(),S8=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let s=$d.pattern.convertPatternsToRe(e,this._micromatchOptions),a=$d.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}));return n=>this._filter(n,s,a)}_filter(e,r,s){let a=$d.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(a)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e)||this._isSkippedByAbsoluteNegativePatterns(a,s))return!1;let n=e.dirent.isDirectory(),c=this._isMatchToPatterns(a,r,n)&&!this._isMatchToPatterns(a,s,n);return this._settings.unique&&c&&this._createIndexRecord(a),c}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isSkippedByAbsoluteNegativePatterns(e,r){if(!this._settings.absolute)return!1;let s=$d.path.makeAbsolute(this._settings.cwd,e);return $d.pattern.matchAny(s,r)}_isMatchToPatterns(e,r,s){let a=$d.pattern.matchAny(e,r);return!a&&s?$d.pattern.matchAny(e+"/",r):a}};D8.default=S8});var zpe=L(P8=>{"use strict";Object.defineProperty(P8,"__esModule",{value:!0});var mpt=Qp(),b8=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return mpt.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};P8.default=b8});var Xpe=L(k8=>{"use strict";Object.defineProperty(k8,"__esModule",{value:!0});var Zpe=Qp(),x8=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Zpe.path.makeAbsolute(this._settings.cwd,r),r=Zpe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};k8.default=x8});var wQ=L(T8=>{"use strict";Object.defineProperty(T8,"__esModule",{value:!0});var ypt=ye("path"),Ept=Kpe(),Ipt=Jpe(),Cpt=zpe(),wpt=Xpe(),Q8=class{constructor(e){this._settings=e,this.errorFilter=new Cpt.default(this._settings),this.entryFilter=new Ipt.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Ept.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new wpt.default(this._settings)}_getRootDirectory(e){return ypt.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};T8.default=Q8});var $pe=L(F8=>{"use strict";Object.defineProperty(F8,"__esModule",{value:!0});var Bpt=Wpe(),vpt=wQ(),R8=class extends vpt.default{constructor(){super(...arguments),this._reader=new Bpt.default(this._settings)}async read(e){let r=this._getRootDirectory(e),s=this._getReaderOptions(e);return(await this.api(r,e,s)).map(n=>s.transform(n))}api(e,r,s){return r.dynamic?this._reader.dynamic(e,s):this._reader.static(r.patterns,s)}};F8.default=R8});var ehe=L(O8=>{"use strict";Object.defineProperty(O8,"__esModule",{value:!0});var Spt=ye("stream"),Dpt=d8(),bpt=wQ(),N8=class extends bpt.default{constructor(){super(...arguments),this._reader=new Dpt.default(this._settings)}read(e){let r=this._getRootDirectory(e),s=this._getReaderOptions(e),a=this.api(r,e,s),n=new Spt.Readable({objectMode:!0,read:()=>{}});return a.once("error",c=>n.emit("error",c)).on("data",c=>n.emit("data",s.transform(c))).once("end",()=>n.emit("end")),n.once("close",()=>a.destroy()),n}api(e,r,s){return r.dynamic?this._reader.dynamic(e,s):this._reader.static(r.patterns,s)}};O8.default=N8});var the=L(M8=>{"use strict";Object.defineProperty(M8,"__esModule",{value:!0});var Ppt=Xd(),xpt=EQ(),kpt=IQ(),L8=class extends kpt.default{constructor(){super(...arguments),this._walkSync=xpt.walkSync,this._statSync=Ppt.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let s=[];for(let a of e){let n=this._getFullEntryPath(a),c=this._getEntry(n,a,r);c===null||!r.entryFilter(c)||s.push(c)}return s}_getEntry(e,r,s){try{let a=this._getStat(e);return this._makeEntry(a,r)}catch(a){if(s.errorFilter(a))return null;throw a}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};M8.default=L8});var rhe=L(U8=>{"use strict";Object.defineProperty(U8,"__esModule",{value:!0});var Qpt=the(),Tpt=wQ(),_8=class extends Tpt.default{constructor(){super(...arguments),this._reader=new Qpt.default(this._settings)}read(e){let r=this._getRootDirectory(e),s=this._getReaderOptions(e);return this.api(r,e,s).map(s.transform)}api(e,r,s){return r.dynamic?this._reader.dynamic(e,s):this._reader.static(r.patterns,s)}};U8.default=_8});var nhe=L(eI=>{"use strict";Object.defineProperty(eI,"__esModule",{value:!0});eI.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var $E=ye("fs"),Rpt=ye("os"),Fpt=Math.max(Rpt.cpus().length,1);eI.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:$E.lstat,lstatSync:$E.lstatSync,stat:$E.stat,statSync:$E.statSync,readdir:$E.readdir,readdirSync:$E.readdirSync};var H8=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,Fpt),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},eI.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};eI.default=H8});var BQ=L((kJt,she)=>{"use strict";var ihe=spe(),Npt=$pe(),Opt=ehe(),Lpt=rhe(),j8=nhe(),Rc=Qp();async function q8(t,e){qu(t);let r=G8(t,Npt.default,e),s=await Promise.all(r);return Rc.array.flatten(s)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(h,E){qu(h);let C=G8(h,Lpt.default,E);return Rc.array.flatten(C)}t.sync=e;function r(h,E){qu(h);let C=G8(h,Opt.default,E);return Rc.stream.merge(C)}t.stream=r;function s(h,E){qu(h);let C=[].concat(h),S=new j8.default(E);return ihe.generate(C,S)}t.generateTasks=s;function a(h,E){qu(h);let C=new j8.default(E);return Rc.pattern.isDynamicPattern(h,C)}t.isDynamicPattern=a;function n(h){return qu(h),Rc.path.escape(h)}t.escapePath=n;function c(h){return qu(h),Rc.path.convertPathToPattern(h)}t.convertPathToPattern=c;let f;(function(h){function E(S){return qu(S),Rc.path.escapePosixPath(S)}h.escapePath=E;function C(S){return qu(S),Rc.path.convertPosixPathToPattern(S)}h.convertPathToPattern=C})(f=t.posix||(t.posix={}));let p;(function(h){function E(S){return qu(S),Rc.path.escapeWindowsPath(S)}h.escapePath=E;function C(S){return qu(S),Rc.path.convertWindowsPathToPattern(S)}h.convertPathToPattern=C})(p=t.win32||(t.win32={}))})(q8||(q8={}));function G8(t,e,r){let s=[].concat(t),a=new j8.default(r),n=ihe.generate(s,a),c=new e(a);return n.map(c.read,c)}function qu(t){if(![].concat(t).every(s=>Rc.string.isString(s)&&!Rc.string.isEmpty(s)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}she.exports=q8});var Nn={};Vt(Nn,{checksumFile:()=>SQ,checksumPattern:()=>DQ,makeHash:()=>us});function us(...t){let e=(0,vQ.createHash)("sha512"),r="";for(let s of t)typeof s=="string"?r+=s:s&&(r&&(e.update(r),r=""),e.update(s));return r&&e.update(r),e.digest("hex")}async function SQ(t,{baseFs:e,algorithm:r}={baseFs:le,algorithm:"sha512"}){let s=await e.openPromise(t,"r");try{let n=Buffer.allocUnsafeSlow(65536),c=(0,vQ.createHash)(r),f=0;for(;(f=await e.readPromise(s,n,0,65536))!==0;)c.update(f===65536?n:n.slice(0,f));return c.digest("hex")}finally{await e.closePromise(s)}}async function DQ(t,{cwd:e}){let s=(await(0,W8.default)(t,{cwd:ue.fromPortablePath(e),onlyDirectories:!0})).map(f=>`${f}/**/*`),a=await(0,W8.default)([t,...s],{cwd:ue.fromPortablePath(e),onlyFiles:!1});a.sort();let n=await Promise.all(a.map(async f=>{let p=[Buffer.from(f)],h=K.join(e,ue.toPortablePath(f)),E=await le.lstatPromise(h);return E.isSymbolicLink()?p.push(Buffer.from(await le.readlinkPromise(h))):E.isFile()&&p.push(await le.readFilePromise(h)),p.join("\0")})),c=(0,vQ.createHash)("sha512");for(let f of n)c.update(f);return c.digest("hex")}var vQ,W8,I0=It(()=>{bt();vQ=ye("crypto"),W8=et(BQ())});var q={};Vt(q,{allPeerRequests:()=>nv,areDescriptorsEqual:()=>uhe,areIdentsEqual:()=>XB,areLocatorsEqual:()=>$B,areVirtualPackagesEquivalent:()=>Ypt,bindDescriptor:()=>Gpt,bindLocator:()=>Wpt,convertDescriptorToLocator:()=>bQ,convertLocatorToDescriptor:()=>V8,convertPackageToLocator:()=>Hpt,convertToIdent:()=>Upt,convertToManifestRange:()=>rht,copyPackage:()=>zB,devirtualizeDescriptor:()=>ZB,devirtualizeLocator:()=>rI,ensureDevirtualizedDescriptor:()=>jpt,ensureDevirtualizedLocator:()=>qpt,getIdentVendorPath:()=>Z8,isPackageCompatible:()=>TQ,isVirtualDescriptor:()=>Tp,isVirtualLocator:()=>Gu,makeDescriptor:()=>On,makeIdent:()=>ba,makeLocator:()=>Ys,makeRange:()=>kQ,parseDescriptor:()=>C0,parseFileStyleRange:()=>eht,parseIdent:()=>Da,parseLocator:()=>Rp,parseRange:()=>em,prettyDependent:()=>B3,prettyDescriptor:()=>ri,prettyIdent:()=>$i,prettyLocator:()=>Yr,prettyLocatorNoColors:()=>w3,prettyRange:()=>iI,prettyReference:()=>tv,prettyResolution:()=>VB,prettyWorkspace:()=>rv,renamePackage:()=>K8,slugifyIdent:()=>Y8,slugifyLocator:()=>nI,sortDescriptors:()=>sI,stringifyDescriptor:()=>ll,stringifyIdent:()=>cn,stringifyLocator:()=>cl,tryParseDescriptor:()=>ev,tryParseIdent:()=>fhe,tryParseLocator:()=>xQ,tryParseRange:()=>$pt,unwrapIdentFromScope:()=>iht,virtualizeDescriptor:()=>J8,virtualizePackage:()=>z8,wrapIdentIntoScope:()=>nht});function ba(t,e){if(t?.startsWith("@"))throw new Error("Invalid scope: don't prefix it with '@'");return{identHash:us(t,e),scope:t,name:e}}function On(t,e){return{identHash:t.identHash,scope:t.scope,name:t.name,descriptorHash:us(t.identHash,e),range:e}}function Ys(t,e){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:us(t.identHash,e),reference:e}}function Upt(t){return{identHash:t.identHash,scope:t.scope,name:t.name}}function bQ(t){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:t.descriptorHash,reference:t.range}}function V8(t){return{identHash:t.identHash,scope:t.scope,name:t.name,descriptorHash:t.locatorHash,range:t.reference}}function Hpt(t){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:t.locatorHash,reference:t.reference}}function K8(t,e){return{identHash:e.identHash,scope:e.scope,name:e.name,locatorHash:e.locatorHash,reference:e.reference,version:t.version,languageName:t.languageName,linkType:t.linkType,conditions:t.conditions,dependencies:new Map(t.dependencies),peerDependencies:new Map(t.peerDependencies),dependenciesMeta:new Map(t.dependenciesMeta),peerDependenciesMeta:new Map(t.peerDependenciesMeta),bin:new Map(t.bin)}}function zB(t){return K8(t,t)}function J8(t,e){if(e.includes("#"))throw new Error("Invalid entropy");return On(t,`virtual:${e}#${t.range}`)}function z8(t,e){if(e.includes("#"))throw new Error("Invalid entropy");return K8(t,Ys(t,`virtual:${e}#${t.reference}`))}function Tp(t){return t.range.startsWith(JB)}function Gu(t){return t.reference.startsWith(JB)}function ZB(t){if(!Tp(t))throw new Error("Not a virtual descriptor");return On(t,t.range.replace(PQ,""))}function rI(t){if(!Gu(t))throw new Error("Not a virtual descriptor");return Ys(t,t.reference.replace(PQ,""))}function jpt(t){return Tp(t)?On(t,t.range.replace(PQ,"")):t}function qpt(t){return Gu(t)?Ys(t,t.reference.replace(PQ,"")):t}function Gpt(t,e){return t.range.includes("::")?t:On(t,`${t.range}::${tI.default.stringify(e)}`)}function Wpt(t,e){return t.reference.includes("::")?t:Ys(t,`${t.reference}::${tI.default.stringify(e)}`)}function XB(t,e){return t.identHash===e.identHash}function uhe(t,e){return t.descriptorHash===e.descriptorHash}function $B(t,e){return t.locatorHash===e.locatorHash}function Ypt(t,e){if(!Gu(t))throw new Error("Invalid package type");if(!Gu(e))throw new Error("Invalid package type");if(!XB(t,e)||t.dependencies.size!==e.dependencies.size)return!1;for(let r of t.dependencies.values()){let s=e.dependencies.get(r.identHash);if(!s||!uhe(r,s))return!1}return!0}function Da(t){let e=fhe(t);if(!e)throw new Error(`Invalid ident (${t})`);return e}function fhe(t){let e=t.match(Vpt);if(!e)return null;let[,r,s]=e;return ba(typeof r<"u"?r:null,s)}function C0(t,e=!1){let r=ev(t,e);if(!r)throw new Error(`Invalid descriptor (${t})`);return r}function ev(t,e=!1){let r=e?t.match(Kpt):t.match(Jpt);if(!r)return null;let[,s,a,n]=r;if(n==="unknown")throw new Error(`Invalid range (${t})`);let c=typeof s<"u"?s:null,f=typeof n<"u"?n:"unknown";return On(ba(c,a),f)}function Rp(t,e=!1){let r=xQ(t,e);if(!r)throw new Error(`Invalid locator (${t})`);return r}function xQ(t,e=!1){let r=e?t.match(zpt):t.match(Zpt);if(!r)return null;let[,s,a,n]=r;if(n==="unknown")throw new Error(`Invalid reference (${t})`);let c=typeof s<"u"?s:null,f=typeof n<"u"?n:"unknown";return Ys(ba(c,a),f)}function em(t,e){let r=t.match(Xpt);if(r===null)throw new Error(`Invalid range (${t})`);let s=typeof r[1]<"u"?r[1]:null;if(typeof e?.requireProtocol=="string"&&s!==e.requireProtocol)throw new Error(`Invalid protocol (${s})`);if(e?.requireProtocol&&s===null)throw new Error(`Missing protocol (${s})`);let a=typeof r[3]<"u"?decodeURIComponent(r[2]):null;if(e?.requireSource&&a===null)throw new Error(`Missing source (${t})`);let n=typeof r[3]<"u"?decodeURIComponent(r[3]):decodeURIComponent(r[2]),c=e?.parseSelector?tI.default.parse(n):n,f=typeof r[4]<"u"?tI.default.parse(r[4]):null;return{protocol:s,source:a,selector:c,params:f}}function $pt(t,e){try{return em(t,e)}catch{return null}}function eht(t,{protocol:e}){let{selector:r,params:s}=em(t,{requireProtocol:e,requireBindings:!0});if(typeof s.locator!="string")throw new Error(`Assertion failed: Invalid bindings for ${t}`);return{parentLocator:Rp(s.locator,!0),path:r}}function ohe(t){return t=t.replaceAll("%","%25"),t=t.replaceAll(":","%3A"),t=t.replaceAll("#","%23"),t}function tht(t){return t===null?!1:Object.entries(t).length>0}function kQ({protocol:t,source:e,selector:r,params:s}){let a="";return t!==null&&(a+=`${t}`),e!==null&&(a+=`${ohe(e)}#`),a+=ohe(r),tht(s)&&(a+=`::${tI.default.stringify(s)}`),a}function rht(t){let{params:e,protocol:r,source:s,selector:a}=em(t);for(let n in e)n.startsWith("__")&&delete e[n];return kQ({protocol:r,source:s,params:e,selector:a})}function cn(t){return t.scope?`@${t.scope}/${t.name}`:`${t.name}`}function nht(t,e){return t.scope?ba(e,`${t.scope}__${t.name}`):ba(e,t.name)}function iht(t,e){if(t.scope!==e)return t;let r=t.name.indexOf("__");if(r===-1)return ba(null,t.name);let s=t.name.slice(0,r),a=t.name.slice(r+2);return ba(s,a)}function ll(t){return t.scope?`@${t.scope}/${t.name}@${t.range}`:`${t.name}@${t.range}`}function cl(t){return t.scope?`@${t.scope}/${t.name}@${t.reference}`:`${t.name}@${t.reference}`}function Y8(t){return t.scope!==null?`@${t.scope}-${t.name}`:t.name}function nI(t){let{protocol:e,selector:r}=em(t.reference),s=e!==null?e.replace(sht,""):"exotic",a=ahe.default.valid(r),n=a!==null?`${s}-${a}`:`${s}`,c=10;return t.scope?`${Y8(t)}-${n}-${t.locatorHash.slice(0,c)}`:`${Y8(t)}-${n}-${t.locatorHash.slice(0,c)}`}function $i(t,e){return e.scope?`${Ut(t,`@${e.scope}/`,Ct.SCOPE)}${Ut(t,e.name,Ct.NAME)}`:`${Ut(t,e.name,Ct.NAME)}`}function QQ(t){if(t.startsWith(JB)){let e=QQ(t.substring(t.indexOf("#")+1)),r=t.substring(JB.length,JB.length+Mpt);return`${e} [${r}]`}else return t.replace(oht,"?[...]")}function iI(t,e){return`${Ut(t,QQ(e),Ct.RANGE)}`}function ri(t,e){return`${$i(t,e)}${Ut(t,"@",Ct.RANGE)}${iI(t,e.range)}`}function tv(t,e){return`${Ut(t,QQ(e),Ct.REFERENCE)}`}function Yr(t,e){return`${$i(t,e)}${Ut(t,"@",Ct.REFERENCE)}${tv(t,e.reference)}`}function w3(t){return`${cn(t)}@${QQ(t.reference)}`}function sI(t){return Ws(t,[e=>cn(e),e=>e.range])}function rv(t,e){return $i(t,e.anchoredLocator)}function VB(t,e,r){let s=Tp(e)?ZB(e):e;return r===null?`${ri(t,s)} \u2192 ${C3(t).Cross}`:s.identHash===r.identHash?`${ri(t,s)} \u2192 ${tv(t,r.reference)}`:`${ri(t,s)} \u2192 ${Yr(t,r)}`}function B3(t,e,r){return r===null?`${Yr(t,e)}`:`${Yr(t,e)} (via ${iI(t,r.range)})`}function Z8(t){return`node_modules/${cn(t)}`}function TQ(t,e){return t.conditions?_pt(t.conditions,r=>{let[,s,a]=r.match(che),n=e[s];return n?n.includes(a):!0}):!0}function nv(t){let e=new Set;if("children"in t)e.add(t);else for(let r of t.requests.values())e.add(r);for(let r of e)for(let s of r.children.values())e.add(s);return e}var tI,ahe,lhe,JB,Mpt,che,_pt,PQ,Vpt,Kpt,Jpt,zpt,Zpt,Xpt,sht,oht,Yo=It(()=>{tI=et(ye("querystring")),ahe=et(fi()),lhe=et(noe());Qc();I0();kc();Yo();JB="virtual:",Mpt=5,che=/(os|cpu|libc)=([a-z0-9_-]+)/,_pt=(0,lhe.makeParser)(che);PQ=/^[^#]*#/;Vpt=/^(?:@([^/]+?)\/)?([^@/]+)$/;Kpt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))$/,Jpt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))?$/;zpt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))$/,Zpt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))?$/;Xpt=/^([^#:]*:)?((?:(?!::)[^#])*)(?:#((?:(?!::).)*))?(?:::(.*))?$/;sht=/:$/;oht=/\?.*/});var Ahe,phe=It(()=>{Yo();Ahe={hooks:{reduceDependency:(t,e,r,s,{resolver:a,resolveOptions:n})=>{for(let{pattern:c,reference:f}of e.topLevelWorkspace.manifest.resolutions){if(c.from&&(c.from.fullName!==cn(r)||e.configuration.normalizeLocator(Ys(Da(c.from.fullName),c.from.description??r.reference)).locatorHash!==r.locatorHash)||c.descriptor.fullName!==cn(t)||e.configuration.normalizeDependency(On(Rp(c.descriptor.fullName),c.descriptor.description??t.range)).descriptorHash!==t.descriptorHash)continue;return a.bindDescriptor(e.configuration.normalizeDependency(On(t,f)),e.topLevelWorkspace.anchoredLocator,n)}return t},validateProject:async(t,e)=>{for(let r of t.workspaces){let s=rv(t.configuration,r);await t.configuration.triggerHook(a=>a.validateWorkspace,r,{reportWarning:(a,n)=>e.reportWarning(a,`${s}: ${n}`),reportError:(a,n)=>e.reportError(a,`${s}: ${n}`)})}},validateWorkspace:async(t,e)=>{let{manifest:r}=t;r.resolutions.length&&t.cwd!==t.project.cwd&&r.errors.push(new Error("Resolutions field will be ignored"));for(let s of r.errors)e.reportWarning(57,s.message)}}}});var yi,tm=It(()=>{yi=class t{static{this.protocol="workspace:"}supportsDescriptor(e,r){return!!(e.range.startsWith(t.protocol)||r.project.tryWorkspaceByDescriptor(e)!==null)}supportsLocator(e,r){return!!e.reference.startsWith(t.protocol)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){return[s.project.getWorkspaceByDescriptor(e).anchoredLocator]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let s=r.project.getWorkspaceByCwd(e.reference.slice(t.protocol.length));return{...e,version:s.manifest.version||"0.0.0",languageName:"unknown",linkType:"SOFT",conditions:null,dependencies:r.project.configuration.normalizeDependencyMap(new Map([...s.manifest.dependencies,...s.manifest.devDependencies])),peerDependencies:new Map([...s.manifest.peerDependencies]),dependenciesMeta:s.manifest.dependenciesMeta,peerDependenciesMeta:s.manifest.peerDependenciesMeta,bin:s.manifest.bin}}}});var Or={};Vt(Or,{SemVer:()=>yhe.SemVer,clean:()=>lht,getComparator:()=>dhe,mergeComparators:()=>X8,satisfiesWithPrereleases:()=>eA,simplifyRanges:()=>$8,stringifyComparator:()=>mhe,validRange:()=>ul});function eA(t,e,r=!1){if(!t)return!1;let s=`${e}${r}`,a=hhe.get(s);if(typeof a>"u")try{a=new Fp.default.Range(e,{includePrerelease:!0,loose:r})}catch{return!1}finally{hhe.set(s,a||null)}else if(a===null)return!1;let n;try{n=new Fp.default.SemVer(t,a)}catch{return!1}return a.test(n)?!0:(n.prerelease&&(n.prerelease=[]),a.set.some(c=>{for(let f of c)f.semver.prerelease&&(f.semver.prerelease=[]);return c.every(f=>f.test(n))}))}function ul(t){if(t.indexOf(":")!==-1)return null;let e=ghe.get(t);if(typeof e<"u")return e;try{e=new Fp.default.Range(t)}catch{e=null}return ghe.set(t,e),e}function lht(t){let e=aht.exec(t);return e?e[1]:null}function dhe(t){if(t.semver===Fp.default.Comparator.ANY)return{gt:null,lt:null};switch(t.operator){case"":return{gt:[">=",t.semver],lt:["<=",t.semver]};case">":case">=":return{gt:[t.operator,t.semver],lt:null};case"<":case"<=":return{gt:null,lt:[t.operator,t.semver]};default:throw new Error(`Assertion failed: Unexpected comparator operator (${t.operator})`)}}function X8(t){if(t.length===0)return null;let e=null,r=null;for(let s of t){if(s.gt){let a=e!==null?Fp.default.compare(s.gt[1],e[1]):null;(a===null||a>0||a===0&&s.gt[0]===">")&&(e=s.gt)}if(s.lt){let a=r!==null?Fp.default.compare(s.lt[1],r[1]):null;(a===null||a<0||a===0&&s.lt[0]==="<")&&(r=s.lt)}}if(e&&r){let s=Fp.default.compare(e[1],r[1]);if(s===0&&(e[0]===">"||r[0]==="<")||s>0)return null}return{gt:e,lt:r}}function mhe(t){if(t.gt&&t.lt){if(t.gt[0]===">="&&t.lt[0]==="<="&&t.gt[1].version===t.lt[1].version)return t.gt[1].version;if(t.gt[0]===">="&&t.lt[0]==="<"){if(t.lt[1].version===`${t.gt[1].major+1}.0.0-0`)return`^${t.gt[1].version}`;if(t.lt[1].version===`${t.gt[1].major}.${t.gt[1].minor+1}.0-0`)return`~${t.gt[1].version}`}}let e=[];return t.gt&&e.push(t.gt[0]+t.gt[1].version),t.lt&&e.push(t.lt[0]+t.lt[1].version),e.length?e.join(" "):"*"}function $8(t){let e=t.map(cht).map(s=>ul(s).set.map(a=>a.map(n=>dhe(n)))),r=e.shift().map(s=>X8(s)).filter(s=>s!==null);for(let s of e){let a=[];for(let n of r)for(let c of s){let f=X8([n,...c]);f!==null&&a.push(f)}r=a}return r.length===0?null:r.map(s=>mhe(s)).join(" || ")}function cht(t){let e=t.split("||");if(e.length>1){let r=new Set;for(let s of e)e.some(a=>a!==s&&Fp.default.subset(s,a))||r.add(s);if(r.size{Fp=et(fi()),yhe=et(fi()),hhe=new Map;ghe=new Map;aht=/^(?:[\sv=]*?)((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\s*)$/});function Ehe(t){let e=t.match(/^[ \t]+/m);return e?e[0]:" "}function Ihe(t){return t.charCodeAt(0)===65279?t.slice(1):t}function Pa(t){return t.replace(/\\/g,"/")}function RQ(t,{yamlCompatibilityMode:e}){return e?h3(t):typeof t>"u"||typeof t=="boolean"?t:null}function Che(t,e){let r=e.search(/[^!]/);if(r===-1)return"invalid";let s=r%2===0?"":"!",a=e.slice(r);return`${s}${t}=${a}`}function eH(t,e){return e.length===1?Che(t,e[0]):`(${e.map(r=>Che(t,r)).join(" | ")})`}var whe,Ht,oI=It(()=>{bt();Bc();whe=et(fi());tm();kc();Np();Yo();Ht=class t{constructor(){this.indent=" ";this.name=null;this.version=null;this.os=null;this.cpu=null;this.libc=null;this.type=null;this.packageManager=null;this.private=!1;this.license=null;this.main=null;this.module=null;this.browser=null;this.languageName=null;this.bin=new Map;this.scripts=new Map;this.dependencies=new Map;this.devDependencies=new Map;this.peerDependencies=new Map;this.workspaceDefinitions=[];this.dependenciesMeta=new Map;this.peerDependenciesMeta=new Map;this.resolutions=[];this.files=null;this.publishConfig=null;this.installConfig=null;this.preferUnplugged=null;this.raw={};this.errors=[]}static{this.fileName="package.json"}static{this.allDependencies=["dependencies","devDependencies","peerDependencies"]}static{this.hardDependencies=["dependencies","devDependencies"]}static async tryFind(e,{baseFs:r=new Yn}={}){let s=K.join(e,"package.json");try{return await t.fromFile(s,{baseFs:r})}catch(a){if(a.code==="ENOENT")return null;throw a}}static async find(e,{baseFs:r}={}){let s=await t.tryFind(e,{baseFs:r});if(s===null)throw new Error("Manifest not found");return s}static async fromFile(e,{baseFs:r=new Yn}={}){let s=new t;return await s.loadFile(e,{baseFs:r}),s}static fromText(e){let r=new t;return r.loadFromText(e),r}loadFromText(e){let r;try{r=JSON.parse(Ihe(e)||"{}")}catch(s){throw s.message+=` (when parsing ${e})`,s}this.load(r),this.indent=Ehe(e)}async loadFile(e,{baseFs:r=new Yn}){let s=await r.readFilePromise(e,"utf8"),a;try{a=JSON.parse(Ihe(s)||"{}")}catch(n){throw n.message+=` (when parsing ${e})`,n}this.load(a),this.indent=Ehe(s)}load(e,{yamlCompatibilityMode:r=!1}={}){if(typeof e!="object"||e===null)throw new Error(`Utterly invalid manifest data (${e})`);this.raw=e;let s=[];if(this.name=null,typeof e.name=="string")try{this.name=Da(e.name)}catch{s.push(new Error("Parsing failed for the 'name' field"))}if(typeof e.version=="string"?this.version=e.version:this.version=null,Array.isArray(e.os)){let n=[];this.os=n;for(let c of e.os)typeof c!="string"?s.push(new Error("Parsing failed for the 'os' field")):n.push(c)}else this.os=null;if(Array.isArray(e.cpu)){let n=[];this.cpu=n;for(let c of e.cpu)typeof c!="string"?s.push(new Error("Parsing failed for the 'cpu' field")):n.push(c)}else this.cpu=null;if(Array.isArray(e.libc)){let n=[];this.libc=n;for(let c of e.libc)typeof c!="string"?s.push(new Error("Parsing failed for the 'libc' field")):n.push(c)}else this.libc=null;if(typeof e.type=="string"?this.type=e.type:this.type=null,typeof e.packageManager=="string"?this.packageManager=e.packageManager:this.packageManager=null,typeof e.private=="boolean"?this.private=e.private:this.private=!1,typeof e.license=="string"?this.license=e.license:this.license=null,typeof e.languageName=="string"?this.languageName=e.languageName:this.languageName=null,typeof e.main=="string"?this.main=Pa(e.main):this.main=null,typeof e.module=="string"?this.module=Pa(e.module):this.module=null,e.browser!=null)if(typeof e.browser=="string")this.browser=Pa(e.browser);else{this.browser=new Map;for(let[n,c]of Object.entries(e.browser))this.browser.set(Pa(n),typeof c=="string"?Pa(c):c)}else this.browser=null;if(this.bin=new Map,typeof e.bin=="string")e.bin.trim()===""?s.push(new Error("Invalid bin field")):this.name!==null?this.bin.set(this.name.name,Pa(e.bin)):s.push(new Error("String bin field, but no attached package name"));else if(typeof e.bin=="object"&&e.bin!==null)for(let[n,c]of Object.entries(e.bin)){if(typeof c!="string"||c.trim()===""){s.push(new Error(`Invalid bin definition for '${n}'`));continue}let f=Da(n);this.bin.set(f.name,Pa(c))}if(this.scripts=new Map,typeof e.scripts=="object"&&e.scripts!==null)for(let[n,c]of Object.entries(e.scripts)){if(typeof c!="string"){s.push(new Error(`Invalid script definition for '${n}'`));continue}this.scripts.set(n,c)}if(this.dependencies=new Map,typeof e.dependencies=="object"&&e.dependencies!==null)for(let[n,c]of Object.entries(e.dependencies)){if(typeof c!="string"){s.push(new Error(`Invalid dependency range for '${n}'`));continue}let f;try{f=Da(n)}catch{s.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=On(f,c);this.dependencies.set(p.identHash,p)}if(this.devDependencies=new Map,typeof e.devDependencies=="object"&&e.devDependencies!==null)for(let[n,c]of Object.entries(e.devDependencies)){if(typeof c!="string"){s.push(new Error(`Invalid dependency range for '${n}'`));continue}let f;try{f=Da(n)}catch{s.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=On(f,c);this.devDependencies.set(p.identHash,p)}if(this.peerDependencies=new Map,typeof e.peerDependencies=="object"&&e.peerDependencies!==null)for(let[n,c]of Object.entries(e.peerDependencies)){let f;try{f=Da(n)}catch{s.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}(typeof c!="string"||!c.startsWith(yi.protocol)&&!ul(c))&&(s.push(new Error(`Invalid dependency range for '${n}'`)),c="*");let p=On(f,c);this.peerDependencies.set(p.identHash,p)}typeof e.workspaces=="object"&&e.workspaces!==null&&e.workspaces.nohoist&&s.push(new Error("'nohoist' is deprecated, please use 'installConfig.hoistingLimits' instead"));let a=Array.isArray(e.workspaces)?e.workspaces:typeof e.workspaces=="object"&&e.workspaces!==null&&Array.isArray(e.workspaces.packages)?e.workspaces.packages:[];this.workspaceDefinitions=[];for(let n of a){if(typeof n!="string"){s.push(new Error(`Invalid workspace definition for '${n}'`));continue}this.workspaceDefinitions.push({pattern:n})}if(this.dependenciesMeta=new Map,typeof e.dependenciesMeta=="object"&&e.dependenciesMeta!==null)for(let[n,c]of Object.entries(e.dependenciesMeta)){if(typeof c!="object"||c===null){s.push(new Error(`Invalid meta field for '${n}`));continue}let f=C0(n),p=this.ensureDependencyMeta(f),h=RQ(c.built,{yamlCompatibilityMode:r});if(h===null){s.push(new Error(`Invalid built meta field for '${n}'`));continue}let E=RQ(c.optional,{yamlCompatibilityMode:r});if(E===null){s.push(new Error(`Invalid optional meta field for '${n}'`));continue}let C=RQ(c.unplugged,{yamlCompatibilityMode:r});if(C===null){s.push(new Error(`Invalid unplugged meta field for '${n}'`));continue}Object.assign(p,{built:h,optional:E,unplugged:C})}if(this.peerDependenciesMeta=new Map,typeof e.peerDependenciesMeta=="object"&&e.peerDependenciesMeta!==null)for(let[n,c]of Object.entries(e.peerDependenciesMeta)){if(typeof c!="object"||c===null){s.push(new Error(`Invalid meta field for '${n}'`));continue}let f=C0(n),p=this.ensurePeerDependencyMeta(f),h=RQ(c.optional,{yamlCompatibilityMode:r});if(h===null){s.push(new Error(`Invalid optional meta field for '${n}'`));continue}Object.assign(p,{optional:h})}if(this.resolutions=[],typeof e.resolutions=="object"&&e.resolutions!==null)for(let[n,c]of Object.entries(e.resolutions)){if(typeof c!="string"){s.push(new Error(`Invalid resolution entry for '${n}'`));continue}try{this.resolutions.push({pattern:bx(n),reference:c})}catch(f){s.push(f);continue}}if(Array.isArray(e.files)){this.files=new Set;for(let n of e.files){if(typeof n!="string"){s.push(new Error(`Invalid files entry for '${n}'`));continue}this.files.add(n)}}else this.files=null;if(typeof e.publishConfig=="object"&&e.publishConfig!==null){if(this.publishConfig={},typeof e.publishConfig.access=="string"&&(this.publishConfig.access=e.publishConfig.access),typeof e.publishConfig.main=="string"&&(this.publishConfig.main=Pa(e.publishConfig.main)),typeof e.publishConfig.module=="string"&&(this.publishConfig.module=Pa(e.publishConfig.module)),e.publishConfig.browser!=null)if(typeof e.publishConfig.browser=="string")this.publishConfig.browser=Pa(e.publishConfig.browser);else{this.publishConfig.browser=new Map;for(let[n,c]of Object.entries(e.publishConfig.browser))this.publishConfig.browser.set(Pa(n),typeof c=="string"?Pa(c):c)}if(typeof e.publishConfig.registry=="string"&&(this.publishConfig.registry=e.publishConfig.registry),typeof e.publishConfig.bin=="string")this.name!==null?this.publishConfig.bin=new Map([[this.name.name,Pa(e.publishConfig.bin)]]):s.push(new Error("String bin field, but no attached package name"));else if(typeof e.publishConfig.bin=="object"&&e.publishConfig.bin!==null){this.publishConfig.bin=new Map;for(let[n,c]of Object.entries(e.publishConfig.bin)){if(typeof c!="string"){s.push(new Error(`Invalid bin definition for '${n}'`));continue}this.publishConfig.bin.set(n,Pa(c))}}if(Array.isArray(e.publishConfig.executableFiles)){this.publishConfig.executableFiles=new Set;for(let n of e.publishConfig.executableFiles){if(typeof n!="string"){s.push(new Error("Invalid executable file definition"));continue}this.publishConfig.executableFiles.add(Pa(n))}}}else this.publishConfig=null;if(typeof e.installConfig=="object"&&e.installConfig!==null){this.installConfig={};for(let n of Object.keys(e.installConfig))n==="hoistingLimits"?typeof e.installConfig.hoistingLimits=="string"?this.installConfig.hoistingLimits=e.installConfig.hoistingLimits:s.push(new Error("Invalid hoisting limits definition")):n=="selfReferences"?typeof e.installConfig.selfReferences=="boolean"?this.installConfig.selfReferences=e.installConfig.selfReferences:s.push(new Error("Invalid selfReferences definition, must be a boolean value")):s.push(new Error(`Unrecognized installConfig key: ${n}`))}else this.installConfig=null;if(typeof e.optionalDependencies=="object"&&e.optionalDependencies!==null)for(let[n,c]of Object.entries(e.optionalDependencies)){if(typeof c!="string"){s.push(new Error(`Invalid dependency range for '${n}'`));continue}let f;try{f=Da(n)}catch{s.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=On(f,c);this.dependencies.set(p.identHash,p);let h=On(f,"unknown"),E=this.ensureDependencyMeta(h);Object.assign(E,{optional:!0})}typeof e.preferUnplugged=="boolean"?this.preferUnplugged=e.preferUnplugged:this.preferUnplugged=null,this.errors=s}getForScope(e){switch(e){case"dependencies":return this.dependencies;case"devDependencies":return this.devDependencies;case"peerDependencies":return this.peerDependencies;default:throw new Error(`Unsupported value ("${e}")`)}}hasConsumerDependency(e){return!!(this.dependencies.has(e.identHash)||this.peerDependencies.has(e.identHash))}hasHardDependency(e){return!!(this.dependencies.has(e.identHash)||this.devDependencies.has(e.identHash))}hasSoftDependency(e){return!!this.peerDependencies.has(e.identHash)}hasDependency(e){return!!(this.hasHardDependency(e)||this.hasSoftDependency(e))}getConditions(){let e=[];return this.os&&this.os.length>0&&e.push(eH("os",this.os)),this.cpu&&this.cpu.length>0&&e.push(eH("cpu",this.cpu)),this.libc&&this.libc.length>0&&e.push(eH("libc",this.libc)),e.length>0?e.join(" & "):null}ensureDependencyMeta(e){if(e.range!=="unknown"&&!whe.default.valid(e.range))throw new Error(`Invalid meta field range for '${ll(e)}'`);let r=cn(e),s=e.range!=="unknown"?e.range:null,a=this.dependenciesMeta.get(r);a||this.dependenciesMeta.set(r,a=new Map);let n=a.get(s);return n||a.set(s,n={}),n}ensurePeerDependencyMeta(e){if(e.range!=="unknown")throw new Error(`Invalid meta field range for '${ll(e)}'`);let r=cn(e),s=this.peerDependenciesMeta.get(r);return s||this.peerDependenciesMeta.set(r,s={}),s}setRawField(e,r,{after:s=[]}={}){let a=new Set(s.filter(n=>Object.hasOwn(this.raw,n)));if(a.size===0||Object.hasOwn(this.raw,e))this.raw[e]=r;else{let n=this.raw,c=this.raw={},f=!1;for(let p of Object.keys(n))c[p]=n[p],f||(a.delete(p),a.size===0&&(c[e]=r,f=!0))}}exportTo(e,{compatibilityMode:r=!0}={}){if(Object.assign(e,this.raw),this.name!==null?e.name=cn(this.name):delete e.name,this.version!==null?e.version=this.version:delete e.version,this.os!==null?e.os=this.os:delete e.os,this.cpu!==null?e.cpu=this.cpu:delete e.cpu,this.type!==null?e.type=this.type:delete e.type,this.packageManager!==null?e.packageManager=this.packageManager:delete e.packageManager,this.private?e.private=!0:delete e.private,this.license!==null?e.license=this.license:delete e.license,this.languageName!==null?e.languageName=this.languageName:delete e.languageName,this.main!==null?e.main=this.main:delete e.main,this.module!==null?e.module=this.module:delete e.module,this.browser!==null){let n=this.browser;typeof n=="string"?e.browser=n:n instanceof Map&&(e.browser=Object.assign({},...Array.from(n.keys()).sort().map(c=>({[c]:n.get(c)}))))}else delete e.browser;this.bin.size===1&&this.name!==null&&this.bin.has(this.name.name)?e.bin=this.bin.get(this.name.name):this.bin.size>0?e.bin=Object.assign({},...Array.from(this.bin.keys()).sort().map(n=>({[n]:this.bin.get(n)}))):delete e.bin,this.workspaceDefinitions.length>0?this.raw.workspaces&&!Array.isArray(this.raw.workspaces)?e.workspaces={...this.raw.workspaces,packages:this.workspaceDefinitions.map(({pattern:n})=>n)}:e.workspaces=this.workspaceDefinitions.map(({pattern:n})=>n):this.raw.workspaces&&!Array.isArray(this.raw.workspaces)&&Object.keys(this.raw.workspaces).length>0?e.workspaces=this.raw.workspaces:delete e.workspaces;let s=[],a=[];for(let n of this.dependencies.values()){let c=this.dependenciesMeta.get(cn(n)),f=!1;if(r&&c){let p=c.get(null);p&&p.optional&&(f=!0)}f?a.push(n):s.push(n)}s.length>0?e.dependencies=Object.assign({},...sI(s).map(n=>({[cn(n)]:n.range}))):delete e.dependencies,a.length>0?e.optionalDependencies=Object.assign({},...sI(a).map(n=>({[cn(n)]:n.range}))):delete e.optionalDependencies,this.devDependencies.size>0?e.devDependencies=Object.assign({},...sI(this.devDependencies.values()).map(n=>({[cn(n)]:n.range}))):delete e.devDependencies,this.peerDependencies.size>0?e.peerDependencies=Object.assign({},...sI(this.peerDependencies.values()).map(n=>({[cn(n)]:n.range}))):delete e.peerDependencies,e.dependenciesMeta={};for(let[n,c]of Ws(this.dependenciesMeta.entries(),([f,p])=>f))for(let[f,p]of Ws(c.entries(),([h,E])=>h!==null?`0${h}`:"1")){let h=f!==null?ll(On(Da(n),f)):n,E={...p};r&&f===null&&delete E.optional,Object.keys(E).length!==0&&(e.dependenciesMeta[h]=E)}if(Object.keys(e.dependenciesMeta).length===0&&delete e.dependenciesMeta,this.peerDependenciesMeta.size>0?e.peerDependenciesMeta=Object.assign({},...Ws(this.peerDependenciesMeta.entries(),([n,c])=>n).map(([n,c])=>({[n]:c}))):delete e.peerDependenciesMeta,this.resolutions.length>0?e.resolutions=Object.assign({},...this.resolutions.map(({pattern:n,reference:c})=>({[Px(n)]:c}))):delete e.resolutions,this.files!==null?e.files=Array.from(this.files):delete e.files,this.preferUnplugged!==null?e.preferUnplugged=this.preferUnplugged:delete e.preferUnplugged,this.scripts!==null&&this.scripts.size>0){e.scripts??={};for(let n of Object.keys(e.scripts))this.scripts.has(n)||delete e.scripts[n];for(let[n,c]of this.scripts.entries())e.scripts[n]=c}else delete e.scripts;return e}}});var vhe=L((WJt,Bhe)=>{var uht=Pc(),fht=function(){return uht.Date.now()};Bhe.exports=fht});var Dhe=L((YJt,She)=>{var Aht=/\s/;function pht(t){for(var e=t.length;e--&&Aht.test(t.charAt(e)););return e}She.exports=pht});var Phe=L((VJt,bhe)=>{var hht=Dhe(),ght=/^\s+/;function dht(t){return t&&t.slice(0,hht(t)+1).replace(ght,"")}bhe.exports=dht});var aI=L((KJt,xhe)=>{var mht=Vd(),yht=zf(),Eht="[object Symbol]";function Iht(t){return typeof t=="symbol"||yht(t)&&mht(t)==Eht}xhe.exports=Iht});var Rhe=L((JJt,The)=>{var Cht=Phe(),khe=Wl(),wht=aI(),Qhe=NaN,Bht=/^[-+]0x[0-9a-f]+$/i,vht=/^0b[01]+$/i,Sht=/^0o[0-7]+$/i,Dht=parseInt;function bht(t){if(typeof t=="number")return t;if(wht(t))return Qhe;if(khe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=khe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Cht(t);var r=vht.test(t);return r||Sht.test(t)?Dht(t.slice(2),r?2:8):Bht.test(t)?Qhe:+t}The.exports=bht});var Ohe=L((zJt,Nhe)=>{var Pht=Wl(),tH=vhe(),Fhe=Rhe(),xht="Expected a function",kht=Math.max,Qht=Math.min;function Tht(t,e,r){var s,a,n,c,f,p,h=0,E=!1,C=!1,S=!0;if(typeof t!="function")throw new TypeError(xht);e=Fhe(e)||0,Pht(r)&&(E=!!r.leading,C="maxWait"in r,n=C?kht(Fhe(r.maxWait)||0,e):n,S="trailing"in r?!!r.trailing:S);function P(ce){var me=s,pe=a;return s=a=void 0,h=ce,c=t.apply(pe,me),c}function I(ce){return h=ce,f=setTimeout(U,e),E?P(ce):c}function R(ce){var me=ce-p,pe=ce-h,Be=e-me;return C?Qht(Be,n-pe):Be}function N(ce){var me=ce-p,pe=ce-h;return p===void 0||me>=e||me<0||C&&pe>=n}function U(){var ce=tH();if(N(ce))return W(ce);f=setTimeout(U,R(ce))}function W(ce){return f=void 0,S&&s?P(ce):(s=a=void 0,c)}function te(){f!==void 0&&clearTimeout(f),h=0,s=p=a=f=void 0}function ie(){return f===void 0?c:W(tH())}function Ae(){var ce=tH(),me=N(ce);if(s=arguments,a=this,p=ce,me){if(f===void 0)return I(p);if(C)return clearTimeout(f),f=setTimeout(U,e),P(p)}return f===void 0&&(f=setTimeout(U,e)),c}return Ae.cancel=te,Ae.flush=ie,Ae}Nhe.exports=Tht});var rH=L((ZJt,Lhe)=>{var Rht=Ohe(),Fht=Wl(),Nht="Expected a function";function Oht(t,e,r){var s=!0,a=!0;if(typeof t!="function")throw new TypeError(Nht);return Fht(r)&&(s="leading"in r?!!r.leading:s,a="trailing"in r?!!r.trailing:a),Rht(t,e,{leading:s,maxWait:e,trailing:a})}Lhe.exports=Oht});function Mht(t){return typeof t.reportCode<"u"}var Mhe,_he,Uhe,Lht,Yt,ho,Fc=It(()=>{Mhe=et(rH()),_he=ye("stream"),Uhe=ye("string_decoder"),Lht=15,Yt=class extends Error{constructor(r,s,a){super(s);this.reportExtra=a;this.reportCode=r}};ho=class{constructor(){this.cacheHits=new Set;this.cacheMisses=new Set;this.reportedInfos=new Set;this.reportedWarnings=new Set;this.reportedErrors=new Set}getRecommendedLength(){return 180}reportCacheHit(e){this.cacheHits.add(e.locatorHash)}reportCacheMiss(e,r){this.cacheMisses.add(e.locatorHash)}static progressViaCounter(e){let r=0,s,a=new Promise(p=>{s=p}),n=p=>{let h=s;a=new Promise(E=>{s=E}),r=p,h()},c=(p=0)=>{n(r+1)},f=async function*(){for(;r{r=c}),a=(0,Mhe.default)(c=>{let f=r;s=new Promise(p=>{r=p}),e=c,f()},1e3/Lht),n=async function*(){for(;;)await s,yield{title:e}}();return{[Symbol.asyncIterator](){return n},hasProgress:!1,hasTitle:!0,setTitle:a}}async startProgressPromise(e,r){let s=this.reportProgress(e);try{return await r(e)}finally{s.stop()}}startProgressSync(e,r){let s=this.reportProgress(e);try{return r(e)}finally{s.stop()}}reportInfoOnce(e,r,s){let a=s&&s.key?s.key:r;this.reportedInfos.has(a)||(this.reportedInfos.add(a),this.reportInfo(e,r),s?.reportExtra?.(this))}reportWarningOnce(e,r,s){let a=s&&s.key?s.key:r;this.reportedWarnings.has(a)||(this.reportedWarnings.add(a),this.reportWarning(e,r),s?.reportExtra?.(this))}reportErrorOnce(e,r,s){let a=s&&s.key?s.key:r;this.reportedErrors.has(a)||(this.reportedErrors.add(a),this.reportError(e,r),s?.reportExtra?.(this))}reportExceptionOnce(e){Mht(e)?this.reportErrorOnce(e.reportCode,e.message,{key:e,reportExtra:e.reportExtra}):this.reportErrorOnce(1,e.stack||e.message,{key:e})}createStreamReporter(e=null){let r=new _he.PassThrough,s=new Uhe.StringDecoder,a="";return r.on("data",n=>{let c=s.write(n),f;do if(f=c.indexOf(` +`),f!==-1){let p=a+c.substring(0,f);c=c.substring(f+1),a="",e!==null?this.reportInfo(null,`${e} ${p}`):this.reportInfo(null,p)}while(f!==-1);a+=c}),r.on("end",()=>{let n=s.end();n!==""&&(e!==null?this.reportInfo(null,`${e} ${n}`):this.reportInfo(null,n))}),r}}});var lI,nH=It(()=>{Fc();Yo();lI=class{constructor(e){this.fetchers=e}supports(e,r){return!!this.tryFetcher(e,r)}getLocalPath(e,r){return this.getFetcher(e,r).getLocalPath(e,r)}async fetch(e,r){return await this.getFetcher(e,r).fetch(e,r)}tryFetcher(e,r){let s=this.fetchers.find(a=>a.supports(e,r));return s||null}getFetcher(e,r){let s=this.fetchers.find(a=>a.supports(e,r));if(!s)throw new Yt(11,`${Yr(r.project.configuration,e)} isn't supported by any available fetcher`);return s}}});var rm,iH=It(()=>{Yo();rm=class{constructor(e){this.resolvers=e.filter(r=>r)}supportsDescriptor(e,r){return!!this.tryResolverByDescriptor(e,r)}supportsLocator(e,r){return!!this.tryResolverByLocator(e,r)}shouldPersistResolution(e,r){return this.getResolverByLocator(e,r).shouldPersistResolution(e,r)}bindDescriptor(e,r,s){return this.getResolverByDescriptor(e,s).bindDescriptor(e,r,s)}getResolutionDependencies(e,r){return this.getResolverByDescriptor(e,r).getResolutionDependencies(e,r)}async getCandidates(e,r,s){return await this.getResolverByDescriptor(e,s).getCandidates(e,r,s)}async getSatisfying(e,r,s,a){return this.getResolverByDescriptor(e,a).getSatisfying(e,r,s,a)}async resolve(e,r){return await this.getResolverByLocator(e,r).resolve(e,r)}tryResolverByDescriptor(e,r){let s=this.resolvers.find(a=>a.supportsDescriptor(e,r));return s||null}getResolverByDescriptor(e,r){let s=this.resolvers.find(a=>a.supportsDescriptor(e,r));if(!s)throw new Error(`${ri(r.project.configuration,e)} isn't supported by any available resolver`);return s}tryResolverByLocator(e,r){let s=this.resolvers.find(a=>a.supportsLocator(e,r));return s||null}getResolverByLocator(e,r){let s=this.resolvers.find(a=>a.supportsLocator(e,r));if(!s)throw new Error(`${Yr(r.project.configuration,e)} isn't supported by any available resolver`);return s}}});var cI,sH=It(()=>{bt();Yo();cI=class{supports(e){return!!e.reference.startsWith("virtual:")}getLocalPath(e,r){let s=e.reference.indexOf("#");if(s===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(s+1),n=Ys(e,a);return r.fetcher.getLocalPath(n,r)}async fetch(e,r){let s=e.reference.indexOf("#");if(s===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(s+1),n=Ys(e,a),c=await r.fetcher.fetch(n,r);return await this.ensureVirtualLink(e,c,r)}getLocatorFilename(e){return nI(e)}async ensureVirtualLink(e,r,s){let a=r.packageFs.getRealPath(),n=s.project.configuration.get("virtualFolder"),c=this.getLocatorFilename(e),f=fo.makeVirtualPath(n,c,a),p=new Hf(f,{baseFs:r.packageFs,pathUtils:K});return{...r,packageFs:p}}}});var FQ,Hhe=It(()=>{FQ=class t{static{this.protocol="virtual:"}static isVirtualDescriptor(e){return!!e.range.startsWith(t.protocol)}static isVirtualLocator(e){return!!e.reference.startsWith(t.protocol)}supportsDescriptor(e,r){return t.isVirtualDescriptor(e)}supportsLocator(e,r){return t.isVirtualLocator(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){throw new Error('Assertion failed: calling "bindDescriptor" on a virtual descriptor is unsupported')}getResolutionDependencies(e,r){throw new Error('Assertion failed: calling "getResolutionDependencies" on a virtual descriptor is unsupported')}async getCandidates(e,r,s){throw new Error('Assertion failed: calling "getCandidates" on a virtual descriptor is unsupported')}async getSatisfying(e,r,s,a){throw new Error('Assertion failed: calling "getSatisfying" on a virtual descriptor is unsupported')}async resolve(e,r){throw new Error('Assertion failed: calling "resolve" on a virtual locator is unsupported')}}});var uI,oH=It(()=>{bt();tm();uI=class{supports(e){return!!e.reference.startsWith(yi.protocol)}getLocalPath(e,r){return this.getWorkspace(e,r).cwd}async fetch(e,r){let s=this.getWorkspace(e,r).cwd;return{packageFs:new Sn(s),prefixPath:vt.dot,localPath:s}}getWorkspace(e,r){return r.project.getWorkspaceByCwd(e.reference.slice(yi.protocol.length))}}});function iv(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function jhe(t){return typeof t>"u"?3:iv(t)?0:Array.isArray(t)?1:2}function cH(t,e){return Object.hasOwn(t,e)}function Uht(t){return iv(t)&&cH(t,"onConflict")&&typeof t.onConflict=="string"}function Hht(t){if(typeof t>"u")return{onConflict:"default",value:t};if(!Uht(t))return{onConflict:"default",value:t};if(cH(t,"value"))return t;let{onConflict:e,...r}=t;return{onConflict:e,value:r}}function qhe(t,e){let r=iv(t)&&cH(t,e)?t[e]:void 0;return Hht(r)}function fI(t,e){return[t,e,Ghe]}function uH(t){return Array.isArray(t)?t[2]===Ghe:!1}function aH(t,e){if(iv(t)){let r={};for(let s of Object.keys(t))r[s]=aH(t[s],e);return fI(e,r)}return Array.isArray(t)?fI(e,t.map(r=>aH(r,e))):fI(e,t)}function lH(t,e,r,s,a){let n,c=[],f=a,p=0;for(let E=a-1;E>=s;--E){let[C,S]=t[E],{onConflict:P,value:I}=qhe(S,r),R=jhe(I);if(R!==3){if(n??=R,R!==n||P==="hardReset"){p=f;break}if(R===2)return fI(C,I);if(c.unshift([C,I]),P==="reset"){p=E;break}P==="extend"&&E===s&&(s=0),f=E}}if(typeof n>"u")return null;let h=c.map(([E])=>E).join(", ");switch(n){case 1:return fI(h,new Array().concat(...c.map(([E,C])=>C.map(S=>aH(S,E)))));case 0:{let E=Object.assign({},...c.map(([,R])=>R)),C=Object.keys(E),S={},P=t.map(([R,N])=>[R,qhe(N,r).value]),I=_ht(P,([R,N])=>{let U=jhe(N);return U!==0&&U!==3});if(I!==-1){let R=P.slice(I+1);for(let N of C)S[N]=lH(R,e,N,0,R.length)}else for(let R of C)S[R]=lH(P,e,R,p,P.length);return fI(h,S)}default:throw new Error("Assertion failed: Non-extendable value type")}}function Whe(t){return lH(t.map(([e,r])=>[e,{".":r}]),[],".",0,t.length)}function sv(t){return uH(t)?t[1]:t}function NQ(t){let e=uH(t)?t[1]:t;if(Array.isArray(e))return e.map(r=>NQ(r));if(iv(e)){let r={};for(let[s,a]of Object.entries(e))r[s]=NQ(a);return r}return e}function fH(t){return uH(t)?t[0]:null}var _ht,Ghe,Yhe=It(()=>{_ht=(t,e,r)=>{let s=[...t];return s.reverse(),s.findIndex(e,r)};Ghe=Symbol()});var OQ={};Vt(OQ,{getDefaultGlobalFolder:()=>pH,getHomeFolder:()=>AI,isFolderInside:()=>hH});function pH(){if(process.platform==="win32"){let t=ue.toPortablePath(process.env.LOCALAPPDATA||ue.join((0,AH.homedir)(),"AppData","Local"));return K.resolve(t,"Yarn/Berry")}if(process.env.XDG_DATA_HOME){let t=ue.toPortablePath(process.env.XDG_DATA_HOME);return K.resolve(t,"yarn/berry")}return K.resolve(AI(),".yarn/berry")}function AI(){return ue.toPortablePath((0,AH.homedir)()||"/usr/local/share")}function hH(t,e){let r=K.relative(e,t);return r&&!r.startsWith("..")&&!K.isAbsolute(r)}var AH,LQ=It(()=>{bt();AH=ye("os")});var zhe=L(pI=>{"use strict";var uzt=ye("net"),qht=ye("tls"),gH=ye("http"),Vhe=ye("https"),Ght=ye("events"),fzt=ye("assert"),Wht=ye("util");pI.httpOverHttp=Yht;pI.httpsOverHttp=Vht;pI.httpOverHttps=Kht;pI.httpsOverHttps=Jht;function Yht(t){var e=new Op(t);return e.request=gH.request,e}function Vht(t){var e=new Op(t);return e.request=gH.request,e.createSocket=Khe,e.defaultPort=443,e}function Kht(t){var e=new Op(t);return e.request=Vhe.request,e}function Jht(t){var e=new Op(t);return e.request=Vhe.request,e.createSocket=Khe,e.defaultPort=443,e}function Op(t){var e=this;e.options=t||{},e.proxyOptions=e.options.proxy||{},e.maxSockets=e.options.maxSockets||gH.Agent.defaultMaxSockets,e.requests=[],e.sockets=[],e.on("free",function(s,a,n,c){for(var f=Jhe(a,n,c),p=0,h=e.requests.length;p=this.maxSockets){n.requests.push(c);return}n.createSocket(c,function(f){f.on("free",p),f.on("close",h),f.on("agentRemove",h),e.onSocket(f);function p(){n.emit("free",f,c)}function h(E){n.removeSocket(f),f.removeListener("free",p),f.removeListener("close",h),f.removeListener("agentRemove",h)}})};Op.prototype.createSocket=function(e,r){var s=this,a={};s.sockets.push(a);var n=dH({},s.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(n.localAddress=e.localAddress),n.proxyAuth&&(n.headers=n.headers||{},n.headers["Proxy-Authorization"]="Basic "+new Buffer(n.proxyAuth).toString("base64")),w0("making CONNECT request");var c=s.request(n);c.useChunkedEncodingByDefault=!1,c.once("response",f),c.once("upgrade",p),c.once("connect",h),c.once("error",E),c.end();function f(C){C.upgrade=!0}function p(C,S,P){process.nextTick(function(){h(C,S,P)})}function h(C,S,P){if(c.removeAllListeners(),S.removeAllListeners(),C.statusCode!==200){w0("tunneling socket could not be established, statusCode=%d",C.statusCode),S.destroy();var I=new Error("tunneling socket could not be established, statusCode="+C.statusCode);I.code="ECONNRESET",e.request.emit("error",I),s.removeSocket(a);return}if(P.length>0){w0("got illegal response body from proxy"),S.destroy();var I=new Error("got illegal response body from proxy");I.code="ECONNRESET",e.request.emit("error",I),s.removeSocket(a);return}return w0("tunneling connection has established"),s.sockets[s.sockets.indexOf(a)]=S,r(S)}function E(C){c.removeAllListeners(),w0(`tunneling socket could not be established, cause=%s +`,C.message,C.stack);var S=new Error("tunneling socket could not be established, cause="+C.message);S.code="ECONNRESET",e.request.emit("error",S),s.removeSocket(a)}};Op.prototype.removeSocket=function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var s=this.requests.shift();s&&this.createSocket(s,function(a){s.request.onSocket(a)})}};function Khe(t,e){var r=this;Op.prototype.createSocket.call(r,t,function(s){var a=t.request.getHeader("host"),n=dH({},r.options,{socket:s,servername:a?a.replace(/:.*$/,""):t.host}),c=qht.connect(0,n);r.sockets[r.sockets.indexOf(s)]=c,e(c)})}function Jhe(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}function dH(t){for(var e=1,r=arguments.length;e{Zhe.exports=zhe()});var Mp=L((Lp,MQ)=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var $he=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function zht(t){return $he.includes(t)}var Zht=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...$he];function Xht(t){return Zht.includes(t)}var $ht=["null","undefined","string","number","bigint","boolean","symbol"];function e0t(t){return $ht.includes(t)}function hI(t){return e=>typeof e===t}var{toString:e0e}=Object.prototype,ov=t=>{let e=e0e.call(t).slice(8,-1);if(/HTML\w+Element/.test(e)&&be.domElement(t))return"HTMLElement";if(Xht(e))return e},Ai=t=>e=>ov(e)===t;function be(t){if(t===null)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(be.observable(t))return"Observable";if(be.array(t))return"Array";if(be.buffer(t))return"Buffer";let e=ov(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}be.undefined=hI("undefined");be.string=hI("string");var t0t=hI("number");be.number=t=>t0t(t)&&!be.nan(t);be.bigint=hI("bigint");be.function_=hI("function");be.null_=t=>t===null;be.class_=t=>be.function_(t)&&t.toString().startsWith("class ");be.boolean=t=>t===!0||t===!1;be.symbol=hI("symbol");be.numericString=t=>be.string(t)&&!be.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t));be.array=(t,e)=>Array.isArray(t)?be.function_(e)?t.every(e):!0:!1;be.buffer=t=>{var e,r,s,a;return(a=(s=(r=(e=t)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.isBuffer)===null||s===void 0?void 0:s.call(r,t))!==null&&a!==void 0?a:!1};be.blob=t=>Ai("Blob")(t);be.nullOrUndefined=t=>be.null_(t)||be.undefined(t);be.object=t=>!be.null_(t)&&(typeof t=="object"||be.function_(t));be.iterable=t=>{var e;return be.function_((e=t)===null||e===void 0?void 0:e[Symbol.iterator])};be.asyncIterable=t=>{var e;return be.function_((e=t)===null||e===void 0?void 0:e[Symbol.asyncIterator])};be.generator=t=>{var e,r;return be.iterable(t)&&be.function_((e=t)===null||e===void 0?void 0:e.next)&&be.function_((r=t)===null||r===void 0?void 0:r.throw)};be.asyncGenerator=t=>be.asyncIterable(t)&&be.function_(t.next)&&be.function_(t.throw);be.nativePromise=t=>Ai("Promise")(t);var r0t=t=>{var e,r;return be.function_((e=t)===null||e===void 0?void 0:e.then)&&be.function_((r=t)===null||r===void 0?void 0:r.catch)};be.promise=t=>be.nativePromise(t)||r0t(t);be.generatorFunction=Ai("GeneratorFunction");be.asyncGeneratorFunction=t=>ov(t)==="AsyncGeneratorFunction";be.asyncFunction=t=>ov(t)==="AsyncFunction";be.boundFunction=t=>be.function_(t)&&!t.hasOwnProperty("prototype");be.regExp=Ai("RegExp");be.date=Ai("Date");be.error=Ai("Error");be.map=t=>Ai("Map")(t);be.set=t=>Ai("Set")(t);be.weakMap=t=>Ai("WeakMap")(t);be.weakSet=t=>Ai("WeakSet")(t);be.int8Array=Ai("Int8Array");be.uint8Array=Ai("Uint8Array");be.uint8ClampedArray=Ai("Uint8ClampedArray");be.int16Array=Ai("Int16Array");be.uint16Array=Ai("Uint16Array");be.int32Array=Ai("Int32Array");be.uint32Array=Ai("Uint32Array");be.float32Array=Ai("Float32Array");be.float64Array=Ai("Float64Array");be.bigInt64Array=Ai("BigInt64Array");be.bigUint64Array=Ai("BigUint64Array");be.arrayBuffer=Ai("ArrayBuffer");be.sharedArrayBuffer=Ai("SharedArrayBuffer");be.dataView=Ai("DataView");be.enumCase=(t,e)=>Object.values(e).includes(t);be.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype;be.urlInstance=t=>Ai("URL")(t);be.urlString=t=>{if(!be.string(t))return!1;try{return new URL(t),!0}catch{return!1}};be.truthy=t=>!!t;be.falsy=t=>!t;be.nan=t=>Number.isNaN(t);be.primitive=t=>be.null_(t)||e0t(typeof t);be.integer=t=>Number.isInteger(t);be.safeInteger=t=>Number.isSafeInteger(t);be.plainObject=t=>{if(e0e.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};be.typedArray=t=>zht(ov(t));var n0t=t=>be.safeInteger(t)&&t>=0;be.arrayLike=t=>!be.nullOrUndefined(t)&&!be.function_(t)&&n0t(t.length);be.inRange=(t,e)=>{if(be.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(be.array(e)&&e.length===2)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};var i0t=1,s0t=["innerHTML","ownerDocument","style","attributes","nodeValue"];be.domElement=t=>be.object(t)&&t.nodeType===i0t&&be.string(t.nodeName)&&!be.plainObject(t)&&s0t.every(e=>e in t);be.observable=t=>{var e,r,s,a;return t?t===((r=(e=t)[Symbol.observable])===null||r===void 0?void 0:r.call(e))||t===((a=(s=t)["@@observable"])===null||a===void 0?void 0:a.call(s)):!1};be.nodeStream=t=>be.object(t)&&be.function_(t.pipe)&&!be.observable(t);be.infinite=t=>t===1/0||t===-1/0;var t0e=t=>e=>be.integer(e)&&Math.abs(e%2)===t;be.evenInteger=t0e(0);be.oddInteger=t0e(1);be.emptyArray=t=>be.array(t)&&t.length===0;be.nonEmptyArray=t=>be.array(t)&&t.length>0;be.emptyString=t=>be.string(t)&&t.length===0;var o0t=t=>be.string(t)&&!/\S/.test(t);be.emptyStringOrWhitespace=t=>be.emptyString(t)||o0t(t);be.nonEmptyString=t=>be.string(t)&&t.length>0;be.nonEmptyStringAndNotWhitespace=t=>be.string(t)&&!be.emptyStringOrWhitespace(t);be.emptyObject=t=>be.object(t)&&!be.map(t)&&!be.set(t)&&Object.keys(t).length===0;be.nonEmptyObject=t=>be.object(t)&&!be.map(t)&&!be.set(t)&&Object.keys(t).length>0;be.emptySet=t=>be.set(t)&&t.size===0;be.nonEmptySet=t=>be.set(t)&&t.size>0;be.emptyMap=t=>be.map(t)&&t.size===0;be.nonEmptyMap=t=>be.map(t)&&t.size>0;be.propertyKey=t=>be.any([be.string,be.number,be.symbol],t);be.formData=t=>Ai("FormData")(t);be.urlSearchParams=t=>Ai("URLSearchParams")(t);var r0e=(t,e,r)=>{if(!be.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(r.length===0)throw new TypeError("Invalid number of values");return t.call(r,e)};be.any=(t,...e)=>(be.array(t)?t:[t]).some(s=>r0e(Array.prototype.some,s,e));be.all=(t,...e)=>r0e(Array.prototype.every,t,e);var _t=(t,e,r,s={})=>{if(!t){let{multipleValues:a}=s,n=a?`received values of types ${[...new Set(r.map(c=>`\`${be(c)}\``))].join(", ")}`:`received value of type \`${be(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${n}.`)}};Lp.assert={undefined:t=>_t(be.undefined(t),"undefined",t),string:t=>_t(be.string(t),"string",t),number:t=>_t(be.number(t),"number",t),bigint:t=>_t(be.bigint(t),"bigint",t),function_:t=>_t(be.function_(t),"Function",t),null_:t=>_t(be.null_(t),"null",t),class_:t=>_t(be.class_(t),"Class",t),boolean:t=>_t(be.boolean(t),"boolean",t),symbol:t=>_t(be.symbol(t),"symbol",t),numericString:t=>_t(be.numericString(t),"string with a number",t),array:(t,e)=>{_t(be.array(t),"Array",t),e&&t.forEach(e)},buffer:t=>_t(be.buffer(t),"Buffer",t),blob:t=>_t(be.blob(t),"Blob",t),nullOrUndefined:t=>_t(be.nullOrUndefined(t),"null or undefined",t),object:t=>_t(be.object(t),"Object",t),iterable:t=>_t(be.iterable(t),"Iterable",t),asyncIterable:t=>_t(be.asyncIterable(t),"AsyncIterable",t),generator:t=>_t(be.generator(t),"Generator",t),asyncGenerator:t=>_t(be.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>_t(be.nativePromise(t),"native Promise",t),promise:t=>_t(be.promise(t),"Promise",t),generatorFunction:t=>_t(be.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>_t(be.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>_t(be.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>_t(be.boundFunction(t),"Function",t),regExp:t=>_t(be.regExp(t),"RegExp",t),date:t=>_t(be.date(t),"Date",t),error:t=>_t(be.error(t),"Error",t),map:t=>_t(be.map(t),"Map",t),set:t=>_t(be.set(t),"Set",t),weakMap:t=>_t(be.weakMap(t),"WeakMap",t),weakSet:t=>_t(be.weakSet(t),"WeakSet",t),int8Array:t=>_t(be.int8Array(t),"Int8Array",t),uint8Array:t=>_t(be.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>_t(be.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>_t(be.int16Array(t),"Int16Array",t),uint16Array:t=>_t(be.uint16Array(t),"Uint16Array",t),int32Array:t=>_t(be.int32Array(t),"Int32Array",t),uint32Array:t=>_t(be.uint32Array(t),"Uint32Array",t),float32Array:t=>_t(be.float32Array(t),"Float32Array",t),float64Array:t=>_t(be.float64Array(t),"Float64Array",t),bigInt64Array:t=>_t(be.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>_t(be.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>_t(be.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>_t(be.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>_t(be.dataView(t),"DataView",t),enumCase:(t,e)=>_t(be.enumCase(t,e),"EnumCase",t),urlInstance:t=>_t(be.urlInstance(t),"URL",t),urlString:t=>_t(be.urlString(t),"string with a URL",t),truthy:t=>_t(be.truthy(t),"truthy",t),falsy:t=>_t(be.falsy(t),"falsy",t),nan:t=>_t(be.nan(t),"NaN",t),primitive:t=>_t(be.primitive(t),"primitive",t),integer:t=>_t(be.integer(t),"integer",t),safeInteger:t=>_t(be.safeInteger(t),"integer",t),plainObject:t=>_t(be.plainObject(t),"plain object",t),typedArray:t=>_t(be.typedArray(t),"TypedArray",t),arrayLike:t=>_t(be.arrayLike(t),"array-like",t),domElement:t=>_t(be.domElement(t),"HTMLElement",t),observable:t=>_t(be.observable(t),"Observable",t),nodeStream:t=>_t(be.nodeStream(t),"Node.js Stream",t),infinite:t=>_t(be.infinite(t),"infinite number",t),emptyArray:t=>_t(be.emptyArray(t),"empty array",t),nonEmptyArray:t=>_t(be.nonEmptyArray(t),"non-empty array",t),emptyString:t=>_t(be.emptyString(t),"empty string",t),emptyStringOrWhitespace:t=>_t(be.emptyStringOrWhitespace(t),"empty string or whitespace",t),nonEmptyString:t=>_t(be.nonEmptyString(t),"non-empty string",t),nonEmptyStringAndNotWhitespace:t=>_t(be.nonEmptyStringAndNotWhitespace(t),"non-empty string and not whitespace",t),emptyObject:t=>_t(be.emptyObject(t),"empty object",t),nonEmptyObject:t=>_t(be.nonEmptyObject(t),"non-empty object",t),emptySet:t=>_t(be.emptySet(t),"empty set",t),nonEmptySet:t=>_t(be.nonEmptySet(t),"non-empty set",t),emptyMap:t=>_t(be.emptyMap(t),"empty map",t),nonEmptyMap:t=>_t(be.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>_t(be.propertyKey(t),"PropertyKey",t),formData:t=>_t(be.formData(t),"FormData",t),urlSearchParams:t=>_t(be.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>_t(be.evenInteger(t),"even integer",t),oddInteger:t=>_t(be.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>_t(be.directInstanceOf(t,e),"T",t),inRange:(t,e)=>_t(be.inRange(t,e),"in range",t),any:(t,...e)=>_t(be.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>_t(be.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})};Object.defineProperties(be,{class:{value:be.class_},function:{value:be.function_},null:{value:be.null_}});Object.defineProperties(Lp.assert,{class:{value:Lp.assert.class_},function:{value:Lp.assert.function_},null:{value:Lp.assert.null_}});Lp.default=be;MQ.exports=be;MQ.exports.default=be;MQ.exports.assert=Lp.assert});var n0e=L((hzt,mH)=>{"use strict";var _Q=class extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}},UQ=class t{static fn(e){return(...r)=>new t((s,a,n)=>{r.push(n),e(...r).then(s,a)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,s)=>{this._reject=s;let a=f=>{this._isPending=!1,r(f)},n=f=>{this._isPending=!1,s(f)},c=f=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(f)};return Object.defineProperties(c,{shouldReject:{get:()=>this._rejectOnCancel,set:f=>{this._rejectOnCancel=f}}}),e(a,n,c)})}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r()}catch(r){this._reject(r)}this._isCanceled=!0,this._rejectOnCancel&&this._reject(new _Q(e))}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(UQ.prototype,Promise.prototype);mH.exports=UQ;mH.exports.CancelError=_Q});var i0e=L((EH,IH)=>{"use strict";Object.defineProperty(EH,"__esModule",{value:!0});function a0t(t){return t.encrypted}var yH=(t,e)=>{let r;typeof e=="function"?r={connect:e}:r=e;let s=typeof r.connect=="function",a=typeof r.secureConnect=="function",n=typeof r.close=="function",c=()=>{s&&r.connect(),a0t(t)&&a&&(t.authorized?r.secureConnect():t.authorizationError||t.once("secureConnect",r.secureConnect)),n&&t.once("close",r.close)};t.writable&&!t.connecting?c():t.connecting?t.once("connect",c):t.destroyed&&n&&r.close(t._hadError)};EH.default=yH;IH.exports=yH;IH.exports.default=yH});var s0e=L((wH,BH)=>{"use strict";Object.defineProperty(wH,"__esModule",{value:!0});var l0t=i0e(),c0t=Number(process.versions.node.split(".")[0]),CH=t=>{let e={start:Date.now(),socket:void 0,lookup:void 0,connect:void 0,secureConnect:void 0,upload:void 0,response:void 0,end:void 0,error:void 0,abort:void 0,phases:{wait:void 0,dns:void 0,tcp:void 0,tls:void 0,request:void 0,firstByte:void 0,download:void 0,total:void 0}};t.timings=e;let r=c=>{let f=c.emit.bind(c);c.emit=(p,...h)=>(p==="error"&&(e.error=Date.now(),e.phases.total=e.error-e.start,c.emit=f),f(p,...h))};r(t),t.prependOnceListener("abort",()=>{e.abort=Date.now(),(!e.response||c0t>=13)&&(e.phases.total=Date.now()-e.start)});let s=c=>{e.socket=Date.now(),e.phases.wait=e.socket-e.start;let f=()=>{e.lookup=Date.now(),e.phases.dns=e.lookup-e.socket};c.prependOnceListener("lookup",f),l0t.default(c,{connect:()=>{e.connect=Date.now(),e.lookup===void 0&&(c.removeListener("lookup",f),e.lookup=e.connect,e.phases.dns=e.lookup-e.socket),e.phases.tcp=e.connect-e.lookup},secureConnect:()=>{e.secureConnect=Date.now(),e.phases.tls=e.secureConnect-e.connect}})};t.socket?s(t.socket):t.prependOnceListener("socket",s);let a=()=>{var c;e.upload=Date.now(),e.phases.request=e.upload-(c=e.secureConnect,c??e.connect)};return(typeof t.writableFinished=="boolean"?t.writableFinished:t.finished&&t.outputSize===0&&(!t.socket||t.socket.writableLength===0))?a():t.prependOnceListener("finish",a),t.prependOnceListener("response",c=>{e.response=Date.now(),e.phases.firstByte=e.response-e.upload,c.timings=e,r(c),c.prependOnceListener("end",()=>{e.end=Date.now(),e.phases.download=e.end-e.response,e.phases.total=e.end-e.start})}),e};wH.default=CH;BH.exports=CH;BH.exports.default=CH});var A0e=L((gzt,DH)=>{"use strict";var{V4MAPPED:u0t,ADDRCONFIG:f0t,ALL:f0e,promises:{Resolver:o0e},lookup:A0t}=ye("dns"),{promisify:vH}=ye("util"),p0t=ye("os"),gI=Symbol("cacheableLookupCreateConnection"),SH=Symbol("cacheableLookupInstance"),a0e=Symbol("expires"),h0t=typeof f0e=="number",l0e=t=>{if(!(t&&typeof t.createConnection=="function"))throw new Error("Expected an Agent instance as the first argument")},g0t=t=>{for(let e of t)e.family!==6&&(e.address=`::ffff:${e.address}`,e.family=6)},c0e=()=>{let t=!1,e=!1;for(let r of Object.values(p0t.networkInterfaces()))for(let s of r)if(!s.internal&&(s.family==="IPv6"?e=!0:t=!0,t&&e))return{has4:t,has6:e};return{has4:t,has6:e}},d0t=t=>Symbol.iterator in t,u0e={ttl:!0},m0t={all:!0},HQ=class{constructor({cache:e=new Map,maxTtl:r=1/0,fallbackDuration:s=3600,errorTtl:a=.15,resolver:n=new o0e,lookup:c=A0t}={}){if(this.maxTtl=r,this.errorTtl=a,this._cache=e,this._resolver=n,this._dnsLookup=vH(c),this._resolver instanceof o0e?(this._resolve4=this._resolver.resolve4.bind(this._resolver),this._resolve6=this._resolver.resolve6.bind(this._resolver)):(this._resolve4=vH(this._resolver.resolve4.bind(this._resolver)),this._resolve6=vH(this._resolver.resolve6.bind(this._resolver))),this._iface=c0e(),this._pending={},this._nextRemovalTime=!1,this._hostnamesToFallback=new Set,s<1)this._fallback=!1;else{this._fallback=!0;let f=setInterval(()=>{this._hostnamesToFallback.clear()},s*1e3);f.unref&&f.unref()}this.lookup=this.lookup.bind(this),this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear(),this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,r,s){if(typeof r=="function"?(s=r,r={}):typeof r=="number"&&(r={family:r}),!s)throw new Error("Callback must be a function.");this.lookupAsync(e,r).then(a=>{r.all?s(null,a):s(null,a.address,a.family,a.expires,a.ttl)},s)}async lookupAsync(e,r={}){typeof r=="number"&&(r={family:r});let s=await this.query(e);if(r.family===6){let a=s.filter(n=>n.family===6);r.hints&u0t&&(h0t&&r.hints&f0e||a.length===0)?g0t(s):s=a}else r.family===4&&(s=s.filter(a=>a.family===4));if(r.hints&f0t){let{_iface:a}=this;s=s.filter(n=>n.family===6?a.has6:a.has4)}if(s.length===0){let a=new Error(`cacheableLookup ENOTFOUND ${e}`);throw a.code="ENOTFOUND",a.hostname=e,a}return r.all?s:s[0]}async query(e){let r=await this._cache.get(e);if(!r){let s=this._pending[e];if(s)r=await s;else{let a=this.queryAndCache(e);this._pending[e]=a,r=await a}}return r=r.map(s=>({...s})),r}async _resolve(e){let r=async h=>{try{return await h}catch(E){if(E.code==="ENODATA"||E.code==="ENOTFOUND")return[];throw E}},[s,a]=await Promise.all([this._resolve4(e,u0e),this._resolve6(e,u0e)].map(h=>r(h))),n=0,c=0,f=0,p=Date.now();for(let h of s)h.family=4,h.expires=p+h.ttl*1e3,n=Math.max(n,h.ttl);for(let h of a)h.family=6,h.expires=p+h.ttl*1e3,c=Math.max(c,h.ttl);return s.length>0?a.length>0?f=Math.min(n,c):f=n:f=c,{entries:[...s,...a],cacheTtl:f}}async _lookup(e){try{return{entries:await this._dnsLookup(e,{all:!0}),cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,r,s){if(this.maxTtl>0&&s>0){s=Math.min(s,this.maxTtl)*1e3,r[a0e]=Date.now()+s;try{await this._cache.set(e,r,s)}catch(a){this.lookupAsync=async()=>{let n=new Error("Cache Error. Please recreate the CacheableLookup instance.");throw n.cause=a,n}}d0t(this._cache)&&this._tick(s)}}async queryAndCache(e){if(this._hostnamesToFallback.has(e))return this._dnsLookup(e,m0t);try{let r=await this._resolve(e);r.entries.length===0&&this._fallback&&(r=await this._lookup(e),r.entries.length!==0&&this._hostnamesToFallback.add(e));let s=r.entries.length===0?this.errorTtl:r.cacheTtl;return await this._set(e,r.entries,s),delete this._pending[e],r.entries}catch(r){throw delete this._pending[e],r}}_tick(e){let r=this._nextRemovalTime;(!r||e{this._nextRemovalTime=!1;let s=1/0,a=Date.now();for(let[n,c]of this._cache){let f=c[a0e];a>=f?this._cache.delete(n):f("lookup"in r||(r.lookup=this.lookup),e[gI](r,s))}uninstall(e){if(l0e(e),e[gI]){if(e[SH]!==this)throw new Error("The agent is not owned by this CacheableLookup instance");e.createConnection=e[gI],delete e[gI],delete e[SH]}}updateInterfaceInfo(){let{_iface:e}=this;this._iface=c0e(),(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6)&&this._cache.clear()}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}};DH.exports=HQ;DH.exports.default=HQ});var g0e=L((dzt,bH)=>{"use strict";var y0t=typeof URL>"u"?ye("url").URL:URL,E0t="text/plain",I0t="us-ascii",p0e=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),C0t=(t,{stripHash:e})=>{let r=t.match(/^data:([^,]*?),([^#]*?)(?:#(.*))?$/);if(!r)throw new Error(`Invalid URL: ${t}`);let s=r[1].split(";"),a=r[2],n=e?"":r[3],c=!1;s[s.length-1]==="base64"&&(s.pop(),c=!0);let f=(s.shift()||"").toLowerCase(),h=[...s.map(E=>{let[C,S=""]=E.split("=").map(P=>P.trim());return C==="charset"&&(S=S.toLowerCase(),S===I0t)?"":`${C}${S?`=${S}`:""}`}).filter(Boolean)];return c&&h.push("base64"),(h.length!==0||f&&f!==E0t)&&h.unshift(f),`data:${h.join(";")},${c?a.trim():a}${n?`#${n}`:""}`},h0e=(t,e)=>{if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},Reflect.has(e,"normalizeHttps"))throw new Error("options.normalizeHttps is renamed to options.forceHttp");if(Reflect.has(e,"normalizeHttp"))throw new Error("options.normalizeHttp is renamed to options.forceHttps");if(Reflect.has(e,"stripFragment"))throw new Error("options.stripFragment is renamed to options.stripHash");if(t=t.trim(),/^data:/i.test(t))return C0t(t,e);let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let a=new y0t(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&a.protocol==="https:"&&(a.protocol="http:"),e.forceHttps&&a.protocol==="http:"&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash&&(a.hash=""),a.pathname&&(a.pathname=a.pathname.replace(/((?!:).|^)\/{2,}/g,(n,c)=>/^(?!\/)/g.test(c)?`${c}/`:"/")),a.pathname&&(a.pathname=decodeURI(a.pathname)),e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let n=a.pathname.split("/"),c=n[n.length-1];p0e(c,e.removeDirectoryIndex)&&(n=n.slice(0,n.length-1),a.pathname=n.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let n of[...a.searchParams.keys()])p0e(n,e.removeQueryParameters)&&a.searchParams.delete(n);return e.sortQueryParameters&&a.searchParams.sort(),e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,"")),t=a.toString(),(e.removeTrailingSlash||a.pathname==="/")&&a.hash===""&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t};bH.exports=h0e;bH.exports.default=h0e});var y0e=L((mzt,m0e)=>{m0e.exports=d0e;function d0e(t,e){if(t&&e)return d0e(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(s){r[s]=t[s]}),r;function r(){for(var s=new Array(arguments.length),a=0;a{var E0e=y0e();PH.exports=E0e(jQ);PH.exports.strict=E0e(I0e);jQ.proto=jQ(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return jQ(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return I0e(this)},configurable:!0})});function jQ(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function I0e(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}});var kH=L((Ezt,w0e)=>{var w0t=xH(),B0t=function(){},v0t=function(t){return t.setHeader&&typeof t.abort=="function"},S0t=function(t){return t.stdio&&Array.isArray(t.stdio)&&t.stdio.length===3},C0e=function(t,e,r){if(typeof e=="function")return C0e(t,null,e);e||(e={}),r=w0t(r||B0t);var s=t._writableState,a=t._readableState,n=e.readable||e.readable!==!1&&t.readable,c=e.writable||e.writable!==!1&&t.writable,f=function(){t.writable||p()},p=function(){c=!1,n||r.call(t)},h=function(){n=!1,c||r.call(t)},E=function(I){r.call(t,I?new Error("exited with error code: "+I):null)},C=function(I){r.call(t,I)},S=function(){if(n&&!(a&&a.ended))return r.call(t,new Error("premature close"));if(c&&!(s&&s.ended))return r.call(t,new Error("premature close"))},P=function(){t.req.on("finish",p)};return v0t(t)?(t.on("complete",p),t.on("abort",S),t.req?P():t.on("request",P)):c&&!s&&(t.on("end",f),t.on("close",f)),S0t(t)&&t.on("exit",E),t.on("end",h),t.on("finish",p),e.error!==!1&&t.on("error",C),t.on("close",S),function(){t.removeListener("complete",p),t.removeListener("abort",S),t.removeListener("request",P),t.req&&t.req.removeListener("finish",p),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("exit",E),t.removeListener("end",h),t.removeListener("error",C),t.removeListener("close",S)}};w0e.exports=C0e});var S0e=L((Izt,v0e)=>{var D0t=xH(),b0t=kH(),QH=ye("fs"),av=function(){},P0t=/^v?\.0/.test(process.version),qQ=function(t){return typeof t=="function"},x0t=function(t){return!P0t||!QH?!1:(t instanceof(QH.ReadStream||av)||t instanceof(QH.WriteStream||av))&&qQ(t.close)},k0t=function(t){return t.setHeader&&qQ(t.abort)},Q0t=function(t,e,r,s){s=D0t(s);var a=!1;t.on("close",function(){a=!0}),b0t(t,{readable:e,writable:r},function(c){if(c)return s(c);a=!0,s()});var n=!1;return function(c){if(!a&&!n){if(n=!0,x0t(t))return t.close(av);if(k0t(t))return t.abort();if(qQ(t.destroy))return t.destroy();s(c||new Error("stream was destroyed"))}}},B0e=function(t){t()},T0t=function(t,e){return t.pipe(e)},R0t=function(){var t=Array.prototype.slice.call(arguments),e=qQ(t[t.length-1]||av)&&t.pop()||av;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r,s=t.map(function(a,n){var c=n0;return Q0t(a,c,f,function(p){r||(r=p),p&&s.forEach(B0e),!c&&(s.forEach(B0e),e(r))})});return t.reduce(T0t)};v0e.exports=R0t});var b0e=L((Czt,D0e)=>{"use strict";var{PassThrough:F0t}=ye("stream");D0e.exports=t=>{t={...t};let{array:e}=t,{encoding:r}=t,s=r==="buffer",a=!1;e?a=!(r||s):r=r||"utf8",s&&(r=null);let n=new F0t({objectMode:a});r&&n.setEncoding(r);let c=0,f=[];return n.on("data",p=>{f.push(p),a?c=f.length:c+=p.length}),n.getBufferedValue=()=>e?f:s?Buffer.concat(f,c):f.join(""),n.getBufferedLength=()=>c,n}});var P0e=L((wzt,dI)=>{"use strict";var N0t=S0e(),O0t=b0e(),GQ=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function WQ(t,e){if(!t)return Promise.reject(new Error("Expected a stream"));e={maxBuffer:1/0,...e};let{maxBuffer:r}=e,s;return await new Promise((a,n)=>{let c=f=>{f&&(f.bufferedData=s.getBufferedValue()),n(f)};s=N0t(t,O0t(e),f=>{if(f){c(f);return}a()}),s.on("data",()=>{s.getBufferedLength()>r&&c(new GQ)})}),s.getBufferedValue()}dI.exports=WQ;dI.exports.default=WQ;dI.exports.buffer=(t,e)=>WQ(t,{...e,encoding:"buffer"});dI.exports.array=(t,e)=>WQ(t,{...e,array:!0});dI.exports.MaxBufferError=GQ});var k0e=L((vzt,x0e)=>{"use strict";var L0t=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),M0t=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),_0t=new Set([500,502,503,504]),U0t={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},H0t={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function nm(t){let e=parseInt(t,10);return isFinite(e)?e:0}function j0t(t){return t?_0t.has(t.status):!0}function TH(t){let e={};if(!t)return e;let r=t.trim().split(/,/);for(let s of r){let[a,n]=s.split(/=/,2);e[a.trim()]=n===void 0?!0:n.trim().replace(/^"|"$/g,"")}return e}function q0t(t){let e=[];for(let r in t){let s=t[r];e.push(s===!0?r:r+"="+s)}if(e.length)return e.join(", ")}x0e.exports=class{constructor(e,r,{shared:s,cacheHeuristic:a,immutableMinTimeToLive:n,ignoreCargoCult:c,_fromObject:f}={}){if(f){this._fromObject(f);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(e),this._responseTime=this.now(),this._isShared=s!==!1,this._cacheHeuristic=a!==void 0?a:.1,this._immutableMinTtl=n!==void 0?n:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=TH(r.headers["cache-control"]),this._method="method"in e?e.method:"GET",this._url=e.url,this._host=e.headers.host,this._noAuthorization=!e.headers.authorization,this._reqHeaders=r.headers.vary?e.headers:null,this._reqcc=TH(e.headers["cache-control"]),c&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":q0t(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&M0t.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||L0t.has(this._status)))}_hasExplicitExpiration(){return this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires}_assertRequestHasHeaders(e){if(!e||!e.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(e){this._assertRequestHasHeaders(e);let r=TH(e.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(e.headers.pragma)||r["max-age"]&&this.age()>r["max-age"]||r["min-fresh"]&&this.timeToLive()<1e3*r["min-fresh"]||this.stale()&&!(r["max-stale"]&&!this._rescc["must-revalidate"]&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge()))?!1:this._requestMatches(e,!1)}_requestMatches(e,r){return(!this._url||this._url===e.url)&&this._host===e.headers.host&&(!e.method||this._method===e.method||r&&e.method==="HEAD")&&this._varyMatches(e)}_allowsStoringAuthenticated(){return this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"]}_varyMatches(e){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let s of r)if(e.headers[s]!==this._reqHeaders[s])return!1;return!0}_copyWithoutHopByHopHeaders(e){let r={};for(let s in e)U0t[s]||(r[s]=e[s]);if(e.connection){let s=e.connection.trim().split(/\s*,\s*/);for(let a of s)delete r[a]}if(r.warning){let s=r.warning.split(/,/).filter(a=>!/^\s*1[0-9][0-9]/.test(a));s.length?r.warning=s.join(",").trim():delete r.warning}return r}responseHeaders(){let e=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(e.warning=(e.warning?`${e.warning}, `:"")+'113 - "rfc7234 5.5.4"'),e.age=`${Math.round(r)}`,e.date=new Date(this.now()).toUTCString(),e}date(){let e=Date.parse(this._resHeaders.date);return isFinite(e)?e:this._responseTime}age(){let e=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return e+r}_ageValue(){return nm(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return nm(this._rescc["s-maxage"])}if(this._rescc["max-age"])return nm(this._rescc["max-age"]);let e=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let s=Date.parse(this._resHeaders.expires);return Number.isNaN(s)||ss)return Math.max(e,(r-s)/1e3*this._cacheHeuristic)}return e}timeToLive(){let e=this.maxAge()-this.age(),r=e+nm(this._rescc["stale-if-error"]),s=e+nm(this._rescc["stale-while-revalidate"]);return Math.max(0,e,r,s)*1e3}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+nm(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){return this.maxAge()+nm(this._rescc["stale-while-revalidate"])>this.age()}static fromObject(e){return new this(void 0,void 0,{_fromObject:e})}_fromObject(e){if(this._responseTime)throw Error("Reinitialized");if(!e||e.v!==1)throw Error("Invalid serialization");this._responseTime=e.t,this._isShared=e.sh,this._cacheHeuristic=e.ch,this._immutableMinTtl=e.imm!==void 0?e.imm:24*3600*1e3,this._status=e.st,this._resHeaders=e.resh,this._rescc=e.rescc,this._method=e.m,this._url=e.u,this._host=e.h,this._noAuthorization=e.a,this._reqHeaders=e.reqh,this._reqcc=e.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(e){this._assertRequestHasHeaders(e);let r=this._copyWithoutHopByHopHeaders(e.headers);if(delete r["if-range"],!this._requestMatches(e,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let a=r["if-none-match"].split(/,/).filter(n=>!/^\s*W\//.test(n));a.length?r["if-none-match"]=a.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(e,r){if(this._assertRequestHasHeaders(e),this._useStaleIfError()&&j0t(r))return{modified:!1,matches:!1,policy:this};if(!r||!r.headers)throw Error("Response headers missing");let s=!1;if(r.status!==void 0&&r.status!=304?s=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?s=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?s=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?s=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(s=!0),!s)return{policy:new this.constructor(e,r),modified:r.status!=304,matches:!1};let a={};for(let c in this._resHeaders)a[c]=c in r.headers&&!H0t[c]?r.headers[c]:this._resHeaders[c];let n=Object.assign({},r,{status:this._status,method:this._method,headers:a});return{policy:new this.constructor(e,n,{shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl}),modified:!1,matches:!0}}}});var YQ=L((Szt,Q0e)=>{"use strict";Q0e.exports=t=>{let e={};for(let[r,s]of Object.entries(t))e[r.toLowerCase()]=s;return e}});var R0e=L((Dzt,T0e)=>{"use strict";var G0t=ye("stream").Readable,W0t=YQ(),RH=class extends G0t{constructor(e,r,s,a){if(typeof e!="number")throw new TypeError("Argument `statusCode` should be a number");if(typeof r!="object")throw new TypeError("Argument `headers` should be an object");if(!(s instanceof Buffer))throw new TypeError("Argument `body` should be a buffer");if(typeof a!="string")throw new TypeError("Argument `url` should be a string");super(),this.statusCode=e,this.headers=W0t(r),this.body=s,this.url=a}_read(){this.push(this.body),this.push(null)}};T0e.exports=RH});var N0e=L((bzt,F0e)=>{"use strict";var Y0t=["destroy","setTimeout","socket","headers","trailers","rawHeaders","statusCode","httpVersion","httpVersionMinor","httpVersionMajor","rawTrailers","statusMessage"];F0e.exports=(t,e)=>{let r=new Set(Object.keys(t).concat(Y0t));for(let s of r)s in e||(e[s]=typeof t[s]=="function"?t[s].bind(t):t[s])}});var L0e=L((Pzt,O0e)=>{"use strict";var V0t=ye("stream").PassThrough,K0t=N0e(),J0t=t=>{if(!(t&&t.pipe))throw new TypeError("Parameter `response` must be a response stream.");let e=new V0t;return K0t(t,e),t.pipe(e)};O0e.exports=J0t});var M0e=L(FH=>{FH.stringify=function t(e){if(typeof e>"u")return e;if(e&&Buffer.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON&&(e=e.toJSON()),e&&typeof e=="object"){var r="",s=Array.isArray(e);r=s?"[":"{";var a=!0;for(var n in e){var c=typeof e[n]=="function"||!s&&typeof e[n]>"u";Object.hasOwnProperty.call(e,n)&&!c&&(a||(r+=","),a=!1,s?e[n]==null?r+="null":r+=t(e[n]):e[n]!==void 0&&(r+=t(n)+":"+t(e[n])))}return r+=s?"]":"}",r}else return typeof e=="string"?JSON.stringify(/^:/.test(e)?":"+e:e):typeof e>"u"?"null":JSON.stringify(e)};FH.parse=function(t){return JSON.parse(t,function(e,r){return typeof r=="string"?/^:base64:/.test(r)?Buffer.from(r.substring(8),"base64"):/^:/.test(r)?r.substring(1):r:r})}});var j0e=L((kzt,H0e)=>{"use strict";var z0t=ye("events"),_0e=M0e(),Z0t=t=>{let e={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(t.adapter||t.uri){let r=t.adapter||/^[^:+]*/.exec(t.uri)[0];return new(ye(e[r]))(t)}return new Map},U0e=["sqlite","postgres","mysql","mongo","redis","tiered"],NH=class extends z0t{constructor(e,{emitErrors:r=!0,...s}={}){if(super(),this.opts={namespace:"keyv",serialize:_0e.stringify,deserialize:_0e.parse,...typeof e=="string"?{uri:e}:e,...s},!this.opts.store){let n={...this.opts};this.opts.store=Z0t(n)}if(this.opts.compression){let n=this.opts.compression;this.opts.serialize=n.serialize.bind(n),this.opts.deserialize=n.deserialize.bind(n)}typeof this.opts.store.on=="function"&&r&&this.opts.store.on("error",n=>this.emit("error",n)),this.opts.store.namespace=this.opts.namespace;let a=n=>async function*(){for await(let[c,f]of typeof n=="function"?n(this.opts.store.namespace):n){let p=await this.opts.deserialize(f);if(!(this.opts.store.namespace&&!c.includes(this.opts.store.namespace))){if(typeof p.expires=="number"&&Date.now()>p.expires){this.delete(c);continue}yield[this._getKeyUnprefix(c),p.value]}}};typeof this.opts.store[Symbol.iterator]=="function"&&this.opts.store instanceof Map?this.iterator=a(this.opts.store):typeof this.opts.store.iterator=="function"&&this.opts.store.opts&&this._checkIterableAdaptar()&&(this.iterator=a(this.opts.store.iterator.bind(this.opts.store)))}_checkIterableAdaptar(){return U0e.includes(this.opts.store.opts.dialect)||U0e.findIndex(e=>this.opts.store.opts.url.includes(e))>=0}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}_getKeyPrefixArray(e){return e.map(r=>`${this.opts.namespace}:${r}`)}_getKeyUnprefix(e){return e.split(":").splice(1).join(":")}get(e,r){let{store:s}=this.opts,a=Array.isArray(e),n=a?this._getKeyPrefixArray(e):this._getKeyPrefix(e);if(a&&s.getMany===void 0){let c=[];for(let f of n)c.push(Promise.resolve().then(()=>s.get(f)).then(p=>typeof p=="string"?this.opts.deserialize(p):this.opts.compression?this.opts.deserialize(p):p).then(p=>{if(p!=null)return typeof p.expires=="number"&&Date.now()>p.expires?this.delete(f).then(()=>{}):r&&r.raw?p:p.value}));return Promise.allSettled(c).then(f=>{let p=[];for(let h of f)p.push(h.value);return p})}return Promise.resolve().then(()=>a?s.getMany(n):s.get(n)).then(c=>typeof c=="string"?this.opts.deserialize(c):this.opts.compression?this.opts.deserialize(c):c).then(c=>{if(c!=null)return a?c.map((f,p)=>{if(typeof f=="string"&&(f=this.opts.deserialize(f)),f!=null){if(typeof f.expires=="number"&&Date.now()>f.expires){this.delete(e[p]).then(()=>{});return}return r&&r.raw?f:f.value}}):typeof c.expires=="number"&&Date.now()>c.expires?this.delete(e).then(()=>{}):r&&r.raw?c:c.value})}set(e,r,s){let a=this._getKeyPrefix(e);typeof s>"u"&&(s=this.opts.ttl),s===0&&(s=void 0);let{store:n}=this.opts;return Promise.resolve().then(()=>{let c=typeof s=="number"?Date.now()+s:null;return typeof r=="symbol"&&this.emit("error","symbol cannot be serialized"),r={value:r,expires:c},this.opts.serialize(r)}).then(c=>n.set(a,c,s)).then(()=>!0)}delete(e){let{store:r}=this.opts;if(Array.isArray(e)){let a=this._getKeyPrefixArray(e);if(r.deleteMany===void 0){let n=[];for(let c of a)n.push(r.delete(c));return Promise.allSettled(n).then(c=>c.every(f=>f.value===!0))}return Promise.resolve().then(()=>r.deleteMany(a))}let s=this._getKeyPrefix(e);return Promise.resolve().then(()=>r.delete(s))}clear(){let{store:e}=this.opts;return Promise.resolve().then(()=>e.clear())}has(e){let r=this._getKeyPrefix(e),{store:s}=this.opts;return Promise.resolve().then(async()=>typeof s.has=="function"?s.has(r):await s.get(r)!==void 0)}disconnect(){let{store:e}=this.opts;if(typeof e.disconnect=="function")return e.disconnect()}};H0e.exports=NH});var W0e=L((Tzt,G0e)=>{"use strict";var X0t=ye("events"),VQ=ye("url"),$0t=g0e(),egt=P0e(),OH=k0e(),q0e=R0e(),tgt=YQ(),rgt=L0e(),ngt=j0e(),lv=class t{constructor(e,r){if(typeof e!="function")throw new TypeError("Parameter `request` must be a function");return this.cache=new ngt({uri:typeof r=="string"&&r,store:typeof r!="string"&&r,namespace:"cacheable-request"}),this.createCacheableRequest(e)}createCacheableRequest(e){return(r,s)=>{let a;if(typeof r=="string")a=LH(VQ.parse(r)),r={};else if(r instanceof VQ.URL)a=LH(VQ.parse(r.toString())),r={};else{let[C,...S]=(r.path||"").split("?"),P=S.length>0?`?${S.join("?")}`:"";a=LH({...r,pathname:C,search:P})}r={headers:{},method:"GET",cache:!0,strictTtl:!1,automaticFailover:!1,...r,...igt(a)},r.headers=tgt(r.headers);let n=new X0t,c=$0t(VQ.format(a),{stripWWW:!1,removeTrailingSlash:!1,stripAuthentication:!1}),f=`${r.method}:${c}`,p=!1,h=!1,E=C=>{h=!0;let S=!1,P,I=new Promise(N=>{P=()=>{S||(S=!0,N())}}),R=N=>{if(p&&!C.forceRefresh){N.status=N.statusCode;let W=OH.fromObject(p.cachePolicy).revalidatedPolicy(C,N);if(!W.modified){let te=W.policy.responseHeaders();N=new q0e(p.statusCode,te,p.body,p.url),N.cachePolicy=W.policy,N.fromCache=!0}}N.fromCache||(N.cachePolicy=new OH(C,N,C),N.fromCache=!1);let U;C.cache&&N.cachePolicy.storable()?(U=rgt(N),(async()=>{try{let W=egt.buffer(N);if(await Promise.race([I,new Promise(ce=>N.once("end",ce))]),S)return;let te=await W,ie={cachePolicy:N.cachePolicy.toObject(),url:N.url,statusCode:N.fromCache?p.statusCode:N.statusCode,body:te},Ae=C.strictTtl?N.cachePolicy.timeToLive():void 0;C.maxTtl&&(Ae=Ae?Math.min(Ae,C.maxTtl):C.maxTtl),await this.cache.set(f,ie,Ae)}catch(W){n.emit("error",new t.CacheError(W))}})()):C.cache&&p&&(async()=>{try{await this.cache.delete(f)}catch(W){n.emit("error",new t.CacheError(W))}})(),n.emit("response",U||N),typeof s=="function"&&s(U||N)};try{let N=e(C,R);N.once("error",P),N.once("abort",P),n.emit("request",N)}catch(N){n.emit("error",new t.RequestError(N))}};return(async()=>{let C=async P=>{await Promise.resolve();let I=P.cache?await this.cache.get(f):void 0;if(typeof I>"u")return E(P);let R=OH.fromObject(I.cachePolicy);if(R.satisfiesWithoutRevalidation(P)&&!P.forceRefresh){let N=R.responseHeaders(),U=new q0e(I.statusCode,N,I.body,I.url);U.cachePolicy=R,U.fromCache=!0,n.emit("response",U),typeof s=="function"&&s(U)}else p=I,P.headers=R.revalidationHeaders(P),E(P)},S=P=>n.emit("error",new t.CacheError(P));this.cache.once("error",S),n.on("response",()=>this.cache.removeListener("error",S));try{await C(r)}catch(P){r.automaticFailover&&!h&&E(r),n.emit("error",new t.CacheError(P))}})(),n}}};function igt(t){let e={...t};return e.path=`${t.pathname||"/"}${t.search||""}`,delete e.pathname,delete e.search,e}function LH(t){return{protocol:t.protocol,auth:t.auth,hostname:t.hostname||t.host||"localhost",port:t.port,pathname:t.pathname,search:t.search}}lv.RequestError=class extends Error{constructor(t){super(t.message),this.name="RequestError",Object.assign(this,t)}};lv.CacheError=class extends Error{constructor(t){super(t.message),this.name="CacheError",Object.assign(this,t)}};G0e.exports=lv});var V0e=L((Nzt,Y0e)=>{"use strict";var sgt=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];Y0e.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(sgt)),s={};for(let a of r)a in e||(s[a]={get(){let n=t[a];return typeof n=="function"?n.bind(t):n},set(n){t[a]=n},enumerable:!0,configurable:!1});return Object.defineProperties(e,s),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var J0e=L((Ozt,K0e)=>{"use strict";var{Transform:ogt,PassThrough:agt}=ye("stream"),MH=ye("zlib"),lgt=V0e();K0e.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof MH.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let s=!0,a=new ogt({transform(f,p,h){s=!1,h(null,f)},flush(f){f()}}),n=new agt({autoDestroy:!1,destroy(f,p){t.destroy(),p(f)}}),c=r?MH.createBrotliDecompress():MH.createUnzip();return c.once("error",f=>{if(s&&!t.readable){n.end();return}n.destroy(f)}),lgt(t,n),t.pipe(a).pipe(c).pipe(n),n}});var UH=L((Lzt,z0e)=>{"use strict";var _H=class{constructor(e={}){if(!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(e,r){if(this.cache.set(e,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(let[s,a]of this.oldCache.entries())this.onEviction(s,a);this.oldCache=this.cache,this.cache=new Map}}get(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){let r=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,r),r}}set(e,r){return this.cache.has(e)?this.cache.set(e,r):this._set(e,r),this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}delete(e){let r=this.cache.delete(e);return r&&this._size--,this.oldCache.delete(e)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache)yield e;for(let e of this.oldCache){let[r]=e;this.cache.has(r)||(yield e)}}get size(){let e=0;for(let r of this.oldCache.keys())this.cache.has(r)||e++;return Math.min(this._size+e,this.maxSize)}};z0e.exports=_H});var jH=L((Mzt,ege)=>{"use strict";var cgt=ye("events"),ugt=ye("tls"),fgt=ye("http2"),Agt=UH(),xa=Symbol("currentStreamsCount"),Z0e=Symbol("request"),Nc=Symbol("cachedOriginSet"),mI=Symbol("gracefullyClosing"),pgt=["maxDeflateDynamicTableSize","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","localAddress","path","rejectUnauthorized","minDHSize","ca","cert","clientCertEngine","ciphers","key","pfx","servername","minVersion","maxVersion","secureProtocol","crl","honorCipherOrder","ecdhCurve","dhparam","secureOptions","sessionIdContext"],hgt=(t,e,r)=>{let s=0,a=t.length;for(;s>>1;r(t[n],e)?s=n+1:a=n}return s},ggt=(t,e)=>t.remoteSettings.maxConcurrentStreams>e.remoteSettings.maxConcurrentStreams,HH=(t,e)=>{for(let r of t)r[Nc].lengthe[Nc].includes(s))&&r[xa]+e[xa]<=e.remoteSettings.maxConcurrentStreams&&$0e(r)},dgt=(t,e)=>{for(let r of t)e[Nc].lengthr[Nc].includes(s))&&e[xa]+r[xa]<=r.remoteSettings.maxConcurrentStreams&&$0e(e)},X0e=({agent:t,isFree:e})=>{let r={};for(let s in t.sessions){let n=t.sessions[s].filter(c=>{let f=c[im.kCurrentStreamsCount]{t[mI]=!0,t[xa]===0&&t.close()},im=class t extends cgt{constructor({timeout:e=6e4,maxSessions:r=1/0,maxFreeSessions:s=10,maxCachedTlsSessions:a=100}={}){super(),this.sessions={},this.queue={},this.timeout=e,this.maxSessions=r,this.maxFreeSessions=s,this._freeSessionsCount=0,this._sessionsCount=0,this.settings={enablePush:!1},this.tlsSessionCache=new Agt({maxSize:a})}static normalizeOrigin(e,r){return typeof e=="string"&&(e=new URL(e)),r&&e.hostname!==r&&(e.hostname=r),e.origin}normalizeOptions(e){let r="";if(e)for(let s of pgt)e[s]&&(r+=`:${e[s]}`);return r}_tryToCreateNewSession(e,r){if(!(e in this.queue)||!(r in this.queue[e]))return;let s=this.queue[e][r];this._sessionsCount{Array.isArray(s)?(s=[...s],a()):s=[{resolve:a,reject:n}];let c=this.normalizeOptions(r),f=t.normalizeOrigin(e,r&&r.servername);if(f===void 0){for(let{reject:E}of s)E(new TypeError("The `origin` argument needs to be a string or an URL object"));return}if(c in this.sessions){let E=this.sessions[c],C=-1,S=-1,P;for(let I of E){let R=I.remoteSettings.maxConcurrentStreams;if(R=R||I[mI]||I.destroyed)continue;P||(C=R),N>S&&(P=I,S=N)}}if(P){if(s.length!==1){for(let{reject:I}of s){let R=new Error(`Expected the length of listeners to be 1, got ${s.length}. +Please report this to https://github.com/szmarczak/http2-wrapper/`);I(R)}return}s[0].resolve(P);return}}if(c in this.queue){if(f in this.queue[c]){this.queue[c][f].listeners.push(...s),this._tryToCreateNewSession(c,f);return}}else this.queue[c]={};let p=()=>{c in this.queue&&this.queue[c][f]===h&&(delete this.queue[c][f],Object.keys(this.queue[c]).length===0&&delete this.queue[c])},h=()=>{let E=`${f}:${c}`,C=!1;try{let S=fgt.connect(e,{createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(E),...r});S[xa]=0,S[mI]=!1;let P=()=>S[xa]{this.tlsSessionCache.set(E,N)}),S.once("error",N=>{for(let{reject:U}of s)U(N);this.tlsSessionCache.delete(E)}),S.setTimeout(this.timeout,()=>{S.destroy()}),S.once("close",()=>{if(C){I&&this._freeSessionsCount--,this._sessionsCount--;let N=this.sessions[c];N.splice(N.indexOf(S),1),N.length===0&&delete this.sessions[c]}else{let N=new Error("Session closed without receiving a SETTINGS frame");N.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:U}of s)U(N);p()}this._tryToCreateNewSession(c,f)});let R=()=>{if(!(!(c in this.queue)||!P())){for(let N of S[Nc])if(N in this.queue[c]){let{listeners:U}=this.queue[c][N];for(;U.length!==0&&P();)U.shift().resolve(S);let W=this.queue[c];if(W[N].listeners.length===0&&(delete W[N],Object.keys(W).length===0)){delete this.queue[c];break}if(!P())break}}};S.on("origin",()=>{S[Nc]=S.originSet,P()&&(R(),HH(this.sessions[c],S))}),S.once("remoteSettings",()=>{if(S.ref(),S.unref(),this._sessionsCount++,h.destroyed){let N=new Error("Agent has been destroyed");for(let U of s)U.reject(N);S.destroy();return}S[Nc]=S.originSet;{let N=this.sessions;if(c in N){let U=N[c];U.splice(hgt(U,S,ggt),0,S)}else N[c]=[S]}this._freeSessionsCount+=1,C=!0,this.emit("session",S),R(),p(),S[xa]===0&&this._freeSessionsCount>this.maxFreeSessions&&S.close(),s.length!==0&&(this.getSession(f,r,s),s.length=0),S.on("remoteSettings",()=>{R(),HH(this.sessions[c],S)})}),S[Z0e]=S.request,S.request=(N,U)=>{if(S[mI])throw new Error("The session is gracefully closing. No new streams are allowed.");let W=S[Z0e](N,U);return S.ref(),++S[xa],S[xa]===S.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,W.once("close",()=>{if(I=P(),--S[xa],!S.destroyed&&!S.closed&&(dgt(this.sessions[c],S),P()&&!S.closed)){I||(this._freeSessionsCount++,I=!0);let te=S[xa]===0;te&&S.unref(),te&&(this._freeSessionsCount>this.maxFreeSessions||S[mI])?S.close():(HH(this.sessions[c],S),R())}}),W}}catch(S){for(let P of s)P.reject(S);p()}};h.listeners=s,h.completed=!1,h.destroyed=!1,this.queue[c][f]=h,this._tryToCreateNewSession(c,f)})}request(e,r,s,a){return new Promise((n,c)=>{this.getSession(e,r,[{reject:c,resolve:f=>{try{n(f.request(s,a))}catch(p){c(p)}}}])})}createConnection(e,r){return t.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let s=e.port||443,a=e.hostname||e.host;return typeof r.servername>"u"&&(r.servername=a),ugt.connect(s,a,r)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let r of e)r[xa]===0&&r.close()}destroy(e){for(let r of Object.values(this.sessions))for(let s of r)s.destroy(e);for(let r of Object.values(this.queue))for(let s of Object.values(r))s.destroyed=!0;this.queue={}}get freeSessions(){return X0e({agent:this,isFree:!0})}get busySessions(){return X0e({agent:this,isFree:!1})}};im.kCurrentStreamsCount=xa;im.kGracefullyClosing=mI;ege.exports={Agent:im,globalAgent:new im}});var GH=L((_zt,tge)=>{"use strict";var{Readable:mgt}=ye("stream"),qH=class extends mgt{constructor(e,r){super({highWaterMark:r,autoDestroy:!1}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this.connection=e,this._dumped=!1}_destroy(e){this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};tge.exports=qH});var WH=L((Uzt,rge)=>{"use strict";rge.exports=t=>{let e={protocol:t.protocol,hostname:typeof t.hostname=="string"&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return typeof t.port=="string"&&t.port.length!==0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var ige=L((Hzt,nge)=>{"use strict";nge.exports=(t,e,r)=>{for(let s of r)t.on(s,(...a)=>e.emit(s,...a))}});var oge=L((jzt,sge)=>{"use strict";sge.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var lge=L((Gzt,age)=>{"use strict";var yI=(t,e,r)=>{age.exports[e]=class extends t{constructor(...a){super(typeof r=="string"?r:r(a)),this.name=`${super.name} [${e}]`,this.code=e}}};yI(TypeError,"ERR_INVALID_ARG_TYPE",t=>{let e=t[0].includes(".")?"property":"argument",r=t[1],s=Array.isArray(r);return s&&(r=`${r.slice(0,-1).join(", ")} or ${r.slice(-1)}`),`The "${t[0]}" ${e} must be ${s?"one of":"of"} type ${r}. Received ${typeof t[2]}`});yI(TypeError,"ERR_INVALID_PROTOCOL",t=>`Protocol "${t[0]}" not supported. Expected "${t[1]}"`);yI(Error,"ERR_HTTP_HEADERS_SENT",t=>`Cannot ${t[0]} headers after they are sent to the client`);yI(TypeError,"ERR_INVALID_HTTP_TOKEN",t=>`${t[0]} must be a valid HTTP token [${t[1]}]`);yI(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",t=>`Invalid value "${t[0]} for header "${t[1]}"`);yI(TypeError,"ERR_INVALID_CHAR",t=>`Invalid character in ${t[0]} [${t[1]}]`)});var zH=L((Wzt,gge)=>{"use strict";var ygt=ye("http2"),{Writable:Egt}=ye("stream"),{Agent:cge,globalAgent:Igt}=jH(),Cgt=GH(),wgt=WH(),Bgt=ige(),vgt=oge(),{ERR_INVALID_ARG_TYPE:YH,ERR_INVALID_PROTOCOL:Sgt,ERR_HTTP_HEADERS_SENT:uge,ERR_INVALID_HTTP_TOKEN:Dgt,ERR_HTTP_INVALID_HEADER_VALUE:bgt,ERR_INVALID_CHAR:Pgt}=lge(),{HTTP2_HEADER_STATUS:fge,HTTP2_HEADER_METHOD:Age,HTTP2_HEADER_PATH:pge,HTTP2_METHOD_CONNECT:xgt}=ygt.constants,Jo=Symbol("headers"),VH=Symbol("origin"),KH=Symbol("session"),hge=Symbol("options"),KQ=Symbol("flushedHeaders"),cv=Symbol("jobs"),kgt=/^[\^`\-\w!#$%&*+.|~]+$/,Qgt=/[^\t\u0020-\u007E\u0080-\u00FF]/,JH=class extends Egt{constructor(e,r,s){super({autoDestroy:!1});let a=typeof e=="string"||e instanceof URL;if(a&&(e=wgt(e instanceof URL?e:new URL(e))),typeof r=="function"||r===void 0?(s=r,r=a?e:{...e}):r={...e,...r},r.h2session)this[KH]=r.h2session;else if(r.agent===!1)this.agent=new cge({maxFreeSessions:0});else if(typeof r.agent>"u"||r.agent===null)typeof r.createConnection=="function"?(this.agent=new cge({maxFreeSessions:0}),this.agent.createConnection=r.createConnection):this.agent=Igt;else if(typeof r.agent.request=="function")this.agent=r.agent;else throw new YH("options.agent",["Agent-like Object","undefined","false"],r.agent);if(r.protocol&&r.protocol!=="https:")throw new Sgt(r.protocol,"https:");let n=r.port||r.defaultPort||this.agent&&this.agent.defaultPort||443,c=r.hostname||r.host||"localhost";delete r.hostname,delete r.host,delete r.port;let{timeout:f}=r;if(r.timeout=void 0,this[Jo]=Object.create(null),this[cv]=[],this.socket=null,this.connection=null,this.method=r.method||"GET",this.path=r.path,this.res=null,this.aborted=!1,this.reusedSocket=!1,r.headers)for(let[p,h]of Object.entries(r.headers))this.setHeader(p,h);r.auth&&!("authorization"in this[Jo])&&(this[Jo].authorization="Basic "+Buffer.from(r.auth).toString("base64")),r.session=r.tlsSession,r.path=r.socketPath,this[hge]=r,n===443?(this[VH]=`https://${c}`,":authority"in this[Jo]||(this[Jo][":authority"]=c)):(this[VH]=`https://${c}:${n}`,":authority"in this[Jo]||(this[Jo][":authority"]=`${c}:${n}`)),f&&this.setTimeout(f),s&&this.once("response",s),this[KQ]=!1}get method(){return this[Jo][Age]}set method(e){e&&(this[Jo][Age]=e.toUpperCase())}get path(){return this[Jo][pge]}set path(e){e&&(this[Jo][pge]=e)}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write(e,r,s){if(this._mustNotHaveABody){s(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let a=()=>this._request.write(e,r,s);this._request?a():this[cv].push(a)}_final(e){if(this.destroyed)return;this.flushHeaders();let r=()=>{if(this._mustNotHaveABody){e();return}this._request.end(e)};this._request?r():this[cv].push(r)}abort(){this.res&&this.res.complete||(this.aborted||process.nextTick(()=>this.emit("abort")),this.aborted=!0,this.destroy())}_destroy(e,r){this.res&&this.res._dump(),this._request&&this._request.destroy(),r(e)}async flushHeaders(){if(this[KQ]||this.destroyed)return;this[KQ]=!0;let e=this.method===xgt,r=s=>{if(this._request=s,this.destroyed){s.destroy();return}e||Bgt(s,this,["timeout","continue","close","error"]);let a=c=>(...f)=>{!this.writable&&!this.destroyed?c(...f):this.once("finish",()=>{c(...f)})};s.once("response",a((c,f,p)=>{let h=new Cgt(this.socket,s.readableHighWaterMark);this.res=h,h.req=this,h.statusCode=c[fge],h.headers=c,h.rawHeaders=p,h.once("end",()=>{this.aborted?(h.aborted=!0,h.emit("aborted")):(h.complete=!0,h.socket=null,h.connection=null)}),e?(h.upgrade=!0,this.emit("connect",h,s,Buffer.alloc(0))?this.emit("close"):s.destroy()):(s.on("data",E=>{!h._dumped&&!h.push(E)&&s.pause()}),s.once("end",()=>{h.push(null)}),this.emit("response",h)||h._dump())})),s.once("headers",a(c=>this.emit("information",{statusCode:c[fge]}))),s.once("trailers",a((c,f,p)=>{let{res:h}=this;h.trailers=c,h.rawTrailers=p}));let{socket:n}=s.session;this.socket=n,this.connection=n;for(let c of this[cv])c();this.emit("socket",this.socket)};if(this[KH])try{r(this[KH].request(this[Jo]))}catch(s){this.emit("error",s)}else{this.reusedSocket=!0;try{r(await this.agent.request(this[VH],this[hge],this[Jo]))}catch(s){this.emit("error",s)}}}getHeader(e){if(typeof e!="string")throw new YH("name","string",e);return this[Jo][e.toLowerCase()]}get headersSent(){return this[KQ]}removeHeader(e){if(typeof e!="string")throw new YH("name","string",e);if(this.headersSent)throw new uge("remove");delete this[Jo][e.toLowerCase()]}setHeader(e,r){if(this.headersSent)throw new uge("set");if(typeof e!="string"||!kgt.test(e)&&!vgt(e))throw new Dgt("Header name",e);if(typeof r>"u")throw new bgt(r,e);if(Qgt.test(r))throw new Pgt("header content",e);this[Jo][e.toLowerCase()]=r}setNoDelay(){}setSocketKeepAlive(){}setTimeout(e,r){let s=()=>this._request.setTimeout(e,r);return this._request?s():this[cv].push(s),this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize}set maxHeadersCount(e){}};gge.exports=JH});var mge=L((Yzt,dge)=>{"use strict";var Tgt=ye("tls");dge.exports=(t={},e=Tgt.connect)=>new Promise((r,s)=>{let a=!1,n,c=async()=>{await p,n.off("timeout",f),n.off("error",s),t.resolveSocket?(r({alpnProtocol:n.alpnProtocol,socket:n,timeout:a}),a&&(await Promise.resolve(),n.emit("timeout"))):(n.destroy(),r({alpnProtocol:n.alpnProtocol,timeout:a}))},f=async()=>{a=!0,c()},p=(async()=>{try{n=await e(t,c),n.on("error",s),n.once("timeout",f)}catch(h){s(h)}})()})});var Ege=L((Vzt,yge)=>{"use strict";var Rgt=ye("net");yge.exports=t=>{let e=t.host,r=t.headers&&t.headers.host;return r&&(r.startsWith("[")?r.indexOf("]")===-1?e=r:e=r.slice(1,-1):e=r.split(":",1)[0]),Rgt.isIP(e)?"":e}});var wge=L((Kzt,XH)=>{"use strict";var Ige=ye("http"),ZH=ye("https"),Fgt=mge(),Ngt=UH(),Ogt=zH(),Lgt=Ege(),Mgt=WH(),JQ=new Ngt({maxSize:100}),uv=new Map,Cge=(t,e,r)=>{e._httpMessage={shouldKeepAlive:!0};let s=()=>{t.emit("free",e,r)};e.on("free",s);let a=()=>{t.removeSocket(e,r)};e.on("close",a);let n=()=>{t.removeSocket(e,r),e.off("close",a),e.off("free",s),e.off("agentRemove",n)};e.on("agentRemove",n),t.emit("free",e,r)},_gt=async t=>{let e=`${t.host}:${t.port}:${t.ALPNProtocols.sort()}`;if(!JQ.has(e)){if(uv.has(e))return(await uv.get(e)).alpnProtocol;let{path:r,agent:s}=t;t.path=t.socketPath;let a=Fgt(t);uv.set(e,a);try{let{socket:n,alpnProtocol:c}=await a;if(JQ.set(e,c),t.path=r,c==="h2")n.destroy();else{let{globalAgent:f}=ZH,p=ZH.Agent.prototype.createConnection;s?s.createConnection===p?Cge(s,n,t):n.destroy():f.createConnection===p?Cge(f,n,t):n.destroy()}return uv.delete(e),c}catch(n){throw uv.delete(e),n}}return JQ.get(e)};XH.exports=async(t,e,r)=>{if((typeof t=="string"||t instanceof URL)&&(t=Mgt(new URL(t))),typeof e=="function"&&(r=e,e=void 0),e={ALPNProtocols:["h2","http/1.1"],...t,...e,resolveSocket:!0},!Array.isArray(e.ALPNProtocols)||e.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");e.protocol=e.protocol||"https:";let s=e.protocol==="https:";e.host=e.hostname||e.host||"localhost",e.session=e.tlsSession,e.servername=e.servername||Lgt(e),e.port=e.port||(s?443:80),e._defaultAgent=s?ZH.globalAgent:Ige.globalAgent;let a=e.agent;if(a){if(a.addRequest)throw new Error("The `options.agent` object can contain only `http`, `https` or `http2` properties");e.agent=a[s?"https":"http"]}return s&&await _gt(e)==="h2"?(a&&(e.agent=a.http2),new Ogt(e,r)):Ige.request(e,r)};XH.exports.protocolCache=JQ});var vge=L((Jzt,Bge)=>{"use strict";var Ugt=ye("http2"),Hgt=jH(),$H=zH(),jgt=GH(),qgt=wge(),Ggt=(t,e,r)=>new $H(t,e,r),Wgt=(t,e,r)=>{let s=new $H(t,e,r);return s.end(),s};Bge.exports={...Ugt,ClientRequest:$H,IncomingMessage:jgt,...Hgt,request:Ggt,get:Wgt,auto:qgt}});var tj=L(ej=>{"use strict";Object.defineProperty(ej,"__esModule",{value:!0});var Sge=Mp();ej.default=t=>Sge.default.nodeStream(t)&&Sge.default.function_(t.getBoundary)});var xge=L(rj=>{"use strict";Object.defineProperty(rj,"__esModule",{value:!0});var bge=ye("fs"),Pge=ye("util"),Dge=Mp(),Ygt=tj(),Vgt=Pge.promisify(bge.stat);rj.default=async(t,e)=>{if(e&&"content-length"in e)return Number(e["content-length"]);if(!t)return 0;if(Dge.default.string(t))return Buffer.byteLength(t);if(Dge.default.buffer(t))return t.length;if(Ygt.default(t))return Pge.promisify(t.getLength.bind(t))();if(t instanceof bge.ReadStream){let{size:r}=await Vgt(t.path);return r===0?void 0:r}}});var ij=L(nj=>{"use strict";Object.defineProperty(nj,"__esModule",{value:!0});function Kgt(t,e,r){let s={};for(let a of r)s[a]=(...n)=>{e.emit(a,...n)},t.on(a,s[a]);return()=>{for(let a of r)t.off(a,s[a])}}nj.default=Kgt});var kge=L(sj=>{"use strict";Object.defineProperty(sj,"__esModule",{value:!0});sj.default=()=>{let t=[];return{once(e,r,s){e.once(r,s),t.push({origin:e,event:r,fn:s})},unhandleAll(){for(let e of t){let{origin:r,event:s,fn:a}=e;r.removeListener(s,a)}t.length=0}}}});var Tge=L(fv=>{"use strict";Object.defineProperty(fv,"__esModule",{value:!0});fv.TimeoutError=void 0;var Jgt=ye("net"),zgt=kge(),Qge=Symbol("reentry"),Zgt=()=>{},zQ=class extends Error{constructor(e,r){super(`Timeout awaiting '${r}' for ${e}ms`),this.event=r,this.name="TimeoutError",this.code="ETIMEDOUT"}};fv.TimeoutError=zQ;fv.default=(t,e,r)=>{if(Qge in t)return Zgt;t[Qge]=!0;let s=[],{once:a,unhandleAll:n}=zgt.default(),c=(C,S,P)=>{var I;let R=setTimeout(S,C,C,P);(I=R.unref)===null||I===void 0||I.call(R);let N=()=>{clearTimeout(R)};return s.push(N),N},{host:f,hostname:p}=r,h=(C,S)=>{t.destroy(new zQ(C,S))},E=()=>{for(let C of s)C();n()};if(t.once("error",C=>{if(E(),t.listenerCount("error")===0)throw C}),t.once("close",E),a(t,"response",C=>{a(C,"end",E)}),typeof e.request<"u"&&c(e.request,h,"request"),typeof e.socket<"u"){let C=()=>{h(e.socket,"socket")};t.setTimeout(e.socket,C),s.push(()=>{t.removeListener("timeout",C)})}return a(t,"socket",C=>{var S;let{socketPath:P}=t;if(C.connecting){let I=!!(P??Jgt.isIP((S=p??f)!==null&&S!==void 0?S:"")!==0);if(typeof e.lookup<"u"&&!I&&typeof C.address().address>"u"){let R=c(e.lookup,h,"lookup");a(C,"lookup",R)}if(typeof e.connect<"u"){let R=()=>c(e.connect,h,"connect");I?a(C,"connect",R()):a(C,"lookup",N=>{N===null&&a(C,"connect",R())})}typeof e.secureConnect<"u"&&r.protocol==="https:"&&a(C,"connect",()=>{let R=c(e.secureConnect,h,"secureConnect");a(C,"secureConnect",R)})}if(typeof e.send<"u"){let I=()=>c(e.send,h,"send");C.connecting?a(C,"connect",()=>{a(t,"upload-complete",I())}):a(t,"upload-complete",I())}}),typeof e.response<"u"&&a(t,"upload-complete",()=>{let C=c(e.response,h,"response");a(t,"response",C)}),E}});var Fge=L(oj=>{"use strict";Object.defineProperty(oj,"__esModule",{value:!0});var Rge=Mp();oj.default=t=>{t=t;let e={protocol:t.protocol,hostname:Rge.default.string(t.hostname)&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return Rge.default.string(t.port)&&t.port.length>0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var Nge=L(aj=>{"use strict";Object.defineProperty(aj,"__esModule",{value:!0});var Xgt=ye("url"),$gt=["protocol","host","hostname","port","pathname","search"];aj.default=(t,e)=>{var r,s;if(e.path){if(e.pathname)throw new TypeError("Parameters `path` and `pathname` are mutually exclusive.");if(e.search)throw new TypeError("Parameters `path` and `search` are mutually exclusive.");if(e.searchParams)throw new TypeError("Parameters `path` and `searchParams` are mutually exclusive.")}if(e.search&&e.searchParams)throw new TypeError("Parameters `search` and `searchParams` are mutually exclusive.");if(!t){if(!e.protocol)throw new TypeError("No URL protocol specified");t=`${e.protocol}//${(s=(r=e.hostname)!==null&&r!==void 0?r:e.host)!==null&&s!==void 0?s:""}`}let a=new Xgt.URL(t);if(e.path){let n=e.path.indexOf("?");n===-1?e.pathname=e.path:(e.pathname=e.path.slice(0,n),e.search=e.path.slice(n+1)),delete e.path}for(let n of $gt)e[n]&&(a[n]=e[n].toString());return a}});var Oge=L(cj=>{"use strict";Object.defineProperty(cj,"__esModule",{value:!0});var lj=class{constructor(){this.weakMap=new WeakMap,this.map=new Map}set(e,r){typeof e=="object"?this.weakMap.set(e,r):this.map.set(e,r)}get(e){return typeof e=="object"?this.weakMap.get(e):this.map.get(e)}has(e){return typeof e=="object"?this.weakMap.has(e):this.map.has(e)}};cj.default=lj});var fj=L(uj=>{"use strict";Object.defineProperty(uj,"__esModule",{value:!0});var edt=async t=>{let e=[],r=0;for await(let s of t)e.push(s),r+=Buffer.byteLength(s);return Buffer.isBuffer(e[0])?Buffer.concat(e,r):Buffer.from(e.join(""))};uj.default=edt});var Mge=L(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:!0});sm.dnsLookupIpVersionToFamily=sm.isDnsLookupIpVersion=void 0;var Lge={auto:0,ipv4:4,ipv6:6};sm.isDnsLookupIpVersion=t=>t in Lge;sm.dnsLookupIpVersionToFamily=t=>{if(sm.isDnsLookupIpVersion(t))return Lge[t];throw new Error("Invalid DNS lookup IP version")}});var Aj=L(ZQ=>{"use strict";Object.defineProperty(ZQ,"__esModule",{value:!0});ZQ.isResponseOk=void 0;ZQ.isResponseOk=t=>{let{statusCode:e}=t,r=t.request.options.followRedirect?299:399;return e>=200&&e<=r||e===304}});var Uge=L(pj=>{"use strict";Object.defineProperty(pj,"__esModule",{value:!0});var _ge=new Set;pj.default=t=>{_ge.has(t)||(_ge.add(t),process.emitWarning(`Got: ${t}`,{type:"DeprecationWarning"}))}});var Hge=L(hj=>{"use strict";Object.defineProperty(hj,"__esModule",{value:!0});var Di=Mp(),tdt=(t,e)=>{if(Di.default.null_(t.encoding))throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead");Di.assert.any([Di.default.string,Di.default.undefined],t.encoding),Di.assert.any([Di.default.boolean,Di.default.undefined],t.resolveBodyOnly),Di.assert.any([Di.default.boolean,Di.default.undefined],t.methodRewriting),Di.assert.any([Di.default.boolean,Di.default.undefined],t.isStream),Di.assert.any([Di.default.string,Di.default.undefined],t.responseType),t.responseType===void 0&&(t.responseType="text");let{retry:r}=t;if(e?t.retry={...e.retry}:t.retry={calculateDelay:s=>s.computedValue,limit:0,methods:[],statusCodes:[],errorCodes:[],maxRetryAfter:void 0},Di.default.object(r)?(t.retry={...t.retry,...r},t.retry.methods=[...new Set(t.retry.methods.map(s=>s.toUpperCase()))],t.retry.statusCodes=[...new Set(t.retry.statusCodes)],t.retry.errorCodes=[...new Set(t.retry.errorCodes)]):Di.default.number(r)&&(t.retry.limit=r),Di.default.undefined(t.retry.maxRetryAfter)&&(t.retry.maxRetryAfter=Math.min(...[t.timeout.request,t.timeout.connect].filter(Di.default.number))),Di.default.object(t.pagination)){e&&(t.pagination={...e.pagination,...t.pagination});let{pagination:s}=t;if(!Di.default.function_(s.transform))throw new Error("`options.pagination.transform` must be implemented");if(!Di.default.function_(s.shouldContinue))throw new Error("`options.pagination.shouldContinue` must be implemented");if(!Di.default.function_(s.filter))throw new TypeError("`options.pagination.filter` must be implemented");if(!Di.default.function_(s.paginate))throw new Error("`options.pagination.paginate` must be implemented")}return t.responseType==="json"&&t.headers.accept===void 0&&(t.headers.accept="application/json"),t};hj.default=tdt});var jge=L(Av=>{"use strict";Object.defineProperty(Av,"__esModule",{value:!0});Av.retryAfterStatusCodes=void 0;Av.retryAfterStatusCodes=new Set([413,429,503]);var rdt=({attemptCount:t,retryOptions:e,error:r,retryAfter:s})=>{if(t>e.limit)return 0;let a=e.methods.includes(r.options.method),n=e.errorCodes.includes(r.code),c=r.response&&e.statusCodes.includes(r.response.statusCode);if(!a||!n&&!c)return 0;if(r.response){if(s)return e.maxRetryAfter===void 0||s>e.maxRetryAfter?0:s;if(r.response.statusCode===413)return 0}let f=Math.random()*100;return 2**(t-1)*1e3+f};Av.default=rdt});var gv=L(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.UnsupportedProtocolError=Ln.ReadError=Ln.TimeoutError=Ln.UploadError=Ln.CacheError=Ln.HTTPError=Ln.MaxRedirectsError=Ln.RequestError=Ln.setNonEnumerableProperties=Ln.knownHookEvents=Ln.withoutBody=Ln.kIsNormalizedAlready=void 0;var qge=ye("util"),Gge=ye("stream"),ndt=ye("fs"),B0=ye("url"),Wge=ye("http"),gj=ye("http"),idt=ye("https"),sdt=s0e(),odt=A0e(),Yge=W0e(),adt=J0e(),ldt=vge(),cdt=YQ(),at=Mp(),udt=xge(),Vge=tj(),fdt=ij(),Kge=Tge(),Adt=Fge(),Jge=Nge(),pdt=Oge(),hdt=fj(),zge=Mge(),gdt=Aj(),v0=Uge(),ddt=Hge(),mdt=jge(),dj,go=Symbol("request"),eT=Symbol("response"),EI=Symbol("responseSize"),II=Symbol("downloadedSize"),CI=Symbol("bodySize"),wI=Symbol("uploadedSize"),XQ=Symbol("serverResponsesPiped"),Zge=Symbol("unproxyEvents"),Xge=Symbol("isFromCache"),mj=Symbol("cancelTimeouts"),$ge=Symbol("startedReading"),BI=Symbol("stopReading"),$Q=Symbol("triggerRead"),S0=Symbol("body"),pv=Symbol("jobs"),ede=Symbol("originalResponse"),tde=Symbol("retryTimeout");Ln.kIsNormalizedAlready=Symbol("isNormalizedAlready");var ydt=at.default.string(process.versions.brotli);Ln.withoutBody=new Set(["GET","HEAD"]);Ln.knownHookEvents=["init","beforeRequest","beforeRedirect","beforeError","beforeRetry","afterResponse"];function Edt(t){for(let e in t){let r=t[e];if(!at.default.string(r)&&!at.default.number(r)&&!at.default.boolean(r)&&!at.default.null_(r)&&!at.default.undefined(r))throw new TypeError(`The \`searchParams\` value '${String(r)}' must be a string, number, boolean or null`)}}function Idt(t){return at.default.object(t)&&!("statusCode"in t)}var yj=new pdt.default,Cdt=async t=>new Promise((e,r)=>{let s=a=>{r(a)};t.pending||e(),t.once("error",s),t.once("ready",()=>{t.off("error",s),e()})}),wdt=new Set([300,301,302,303,304,307,308]),Bdt=["context","body","json","form"];Ln.setNonEnumerableProperties=(t,e)=>{let r={};for(let s of t)if(s)for(let a of Bdt)a in s&&(r[a]={writable:!0,configurable:!0,enumerable:!1,value:s[a]});Object.defineProperties(e,r)};var fs=class extends Error{constructor(e,r,s){var a;if(super(e),Error.captureStackTrace(this,this.constructor),this.name="RequestError",this.code=r.code,s instanceof aT?(Object.defineProperty(this,"request",{enumerable:!1,value:s}),Object.defineProperty(this,"response",{enumerable:!1,value:s[eT]}),Object.defineProperty(this,"options",{enumerable:!1,value:s.options})):Object.defineProperty(this,"options",{enumerable:!1,value:s}),this.timings=(a=this.request)===null||a===void 0?void 0:a.timings,at.default.string(r.stack)&&at.default.string(this.stack)){let n=this.stack.indexOf(this.message)+this.message.length,c=this.stack.slice(n).split(` +`).reverse(),f=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(` +`).reverse();for(;f.length!==0&&f[0]===c[0];)c.shift();this.stack=`${this.stack.slice(0,n)}${c.reverse().join(` +`)}${f.reverse().join(` +`)}`}}};Ln.RequestError=fs;var tT=class extends fs{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e),this.name="MaxRedirectsError"}};Ln.MaxRedirectsError=tT;var rT=class extends fs{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request),this.name="HTTPError"}};Ln.HTTPError=rT;var nT=class extends fs{constructor(e,r){super(e.message,e,r),this.name="CacheError"}};Ln.CacheError=nT;var iT=class extends fs{constructor(e,r){super(e.message,e,r),this.name="UploadError"}};Ln.UploadError=iT;var sT=class extends fs{constructor(e,r,s){super(e.message,e,s),this.name="TimeoutError",this.event=e.event,this.timings=r}};Ln.TimeoutError=sT;var hv=class extends fs{constructor(e,r){super(e.message,e,r),this.name="ReadError"}};Ln.ReadError=hv;var oT=class extends fs{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e),this.name="UnsupportedProtocolError"}};Ln.UnsupportedProtocolError=oT;var vdt=["socket","connect","continue","information","upgrade","timeout"],aT=class extends Gge.Duplex{constructor(e,r={},s){super({autoDestroy:!1,highWaterMark:0}),this[II]=0,this[wI]=0,this.requestInitialized=!1,this[XQ]=new Set,this.redirects=[],this[BI]=!1,this[$Q]=!1,this[pv]=[],this.retryCount=0,this._progressCallbacks=[];let a=()=>this._unlockWrite(),n=()=>this._lockWrite();this.on("pipe",h=>{h.prependListener("data",a),h.on("data",n),h.prependListener("end",a),h.on("end",n)}),this.on("unpipe",h=>{h.off("data",a),h.off("data",n),h.off("end",a),h.off("end",n)}),this.on("pipe",h=>{h instanceof gj.IncomingMessage&&(this.options.headers={...h.headers,...this.options.headers})});let{json:c,body:f,form:p}=r;if((c||f||p)&&this._lockWrite(),Ln.kIsNormalizedAlready in r)this.options=r;else try{this.options=this.constructor.normalizeArguments(e,r,s)}catch(h){at.default.nodeStream(r.body)&&r.body.destroy(),this.destroy(h);return}(async()=>{var h;try{this.options.body instanceof ndt.ReadStream&&await Cdt(this.options.body);let{url:E}=this.options;if(!E)throw new TypeError("Missing `url` property");if(this.requestUrl=E.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(h=this[go])===null||h===void 0||h.destroy();return}for(let C of this[pv])C();this[pv].length=0,this.requestInitialized=!0}catch(E){if(E instanceof fs){this._beforeError(E);return}this.destroyed||this.destroy(E)}})()}static normalizeArguments(e,r,s){var a,n,c,f,p;let h=r;if(at.default.object(e)&&!at.default.urlInstance(e))r={...s,...e,...r};else{if(e&&r&&r.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");r={...s,...r},e!==void 0&&(r.url=e),at.default.urlInstance(r.url)&&(r.url=new B0.URL(r.url.toString()))}if(r.cache===!1&&(r.cache=void 0),r.dnsCache===!1&&(r.dnsCache=void 0),at.assert.any([at.default.string,at.default.undefined],r.method),at.assert.any([at.default.object,at.default.undefined],r.headers),at.assert.any([at.default.string,at.default.urlInstance,at.default.undefined],r.prefixUrl),at.assert.any([at.default.object,at.default.undefined],r.cookieJar),at.assert.any([at.default.object,at.default.string,at.default.undefined],r.searchParams),at.assert.any([at.default.object,at.default.string,at.default.undefined],r.cache),at.assert.any([at.default.object,at.default.number,at.default.undefined],r.timeout),at.assert.any([at.default.object,at.default.undefined],r.context),at.assert.any([at.default.object,at.default.undefined],r.hooks),at.assert.any([at.default.boolean,at.default.undefined],r.decompress),at.assert.any([at.default.boolean,at.default.undefined],r.ignoreInvalidCookies),at.assert.any([at.default.boolean,at.default.undefined],r.followRedirect),at.assert.any([at.default.number,at.default.undefined],r.maxRedirects),at.assert.any([at.default.boolean,at.default.undefined],r.throwHttpErrors),at.assert.any([at.default.boolean,at.default.undefined],r.http2),at.assert.any([at.default.boolean,at.default.undefined],r.allowGetBody),at.assert.any([at.default.string,at.default.undefined],r.localAddress),at.assert.any([zge.isDnsLookupIpVersion,at.default.undefined],r.dnsLookupIpVersion),at.assert.any([at.default.object,at.default.undefined],r.https),at.assert.any([at.default.boolean,at.default.undefined],r.rejectUnauthorized),r.https&&(at.assert.any([at.default.boolean,at.default.undefined],r.https.rejectUnauthorized),at.assert.any([at.default.function_,at.default.undefined],r.https.checkServerIdentity),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.certificateAuthority),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.key),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.certificate),at.assert.any([at.default.string,at.default.undefined],r.https.passphrase),at.assert.any([at.default.string,at.default.buffer,at.default.array,at.default.undefined],r.https.pfx)),at.assert.any([at.default.object,at.default.undefined],r.cacheOptions),at.default.string(r.method)?r.method=r.method.toUpperCase():r.method="GET",r.headers===s?.headers?r.headers={...r.headers}:r.headers=cdt({...s?.headers,...r.headers}),"slashes"in r)throw new TypeError("The legacy `url.Url` has been deprecated. Use `URL` instead.");if("auth"in r)throw new TypeError("Parameter `auth` is deprecated. Use `username` / `password` instead.");if("searchParams"in r&&r.searchParams&&r.searchParams!==s?.searchParams){let P;if(at.default.string(r.searchParams)||r.searchParams instanceof B0.URLSearchParams)P=new B0.URLSearchParams(r.searchParams);else{Edt(r.searchParams),P=new B0.URLSearchParams;for(let I in r.searchParams){let R=r.searchParams[I];R===null?P.append(I,""):R!==void 0&&P.append(I,R)}}(a=s?.searchParams)===null||a===void 0||a.forEach((I,R)=>{P.has(R)||P.append(R,I)}),r.searchParams=P}if(r.username=(n=r.username)!==null&&n!==void 0?n:"",r.password=(c=r.password)!==null&&c!==void 0?c:"",at.default.undefined(r.prefixUrl)?r.prefixUrl=(f=s?.prefixUrl)!==null&&f!==void 0?f:"":(r.prefixUrl=r.prefixUrl.toString(),r.prefixUrl!==""&&!r.prefixUrl.endsWith("/")&&(r.prefixUrl+="/")),at.default.string(r.url)){if(r.url.startsWith("/"))throw new Error("`input` must not start with a slash when using `prefixUrl`");r.url=Jge.default(r.prefixUrl+r.url,r)}else(at.default.undefined(r.url)&&r.prefixUrl!==""||r.protocol)&&(r.url=Jge.default(r.prefixUrl,r));if(r.url){"port"in r&&delete r.port;let{prefixUrl:P}=r;Object.defineProperty(r,"prefixUrl",{set:R=>{let N=r.url;if(!N.href.startsWith(R))throw new Error(`Cannot change \`prefixUrl\` from ${P} to ${R}: ${N.href}`);r.url=new B0.URL(R+N.href.slice(P.length)),P=R},get:()=>P});let{protocol:I}=r.url;if(I==="unix:"&&(I="http:",r.url=new B0.URL(`http://unix${r.url.pathname}${r.url.search}`)),r.searchParams&&(r.url.search=r.searchParams.toString()),I!=="http:"&&I!=="https:")throw new oT(r);r.username===""?r.username=r.url.username:r.url.username=r.username,r.password===""?r.password=r.url.password:r.url.password=r.password}let{cookieJar:E}=r;if(E){let{setCookie:P,getCookieString:I}=E;at.assert.function_(P),at.assert.function_(I),P.length===4&&I.length===0&&(P=qge.promisify(P.bind(r.cookieJar)),I=qge.promisify(I.bind(r.cookieJar)),r.cookieJar={setCookie:P,getCookieString:I})}let{cache:C}=r;if(C&&(yj.has(C)||yj.set(C,new Yge((P,I)=>{let R=P[go](P,I);return at.default.promise(R)&&(R.once=(N,U)=>{if(N==="error")R.catch(U);else if(N==="abort")(async()=>{try{(await R).once("abort",U)}catch{}})();else throw new Error(`Unknown HTTP2 promise event: ${N}`);return R}),R},C))),r.cacheOptions={...r.cacheOptions},r.dnsCache===!0)dj||(dj=new odt.default),r.dnsCache=dj;else if(!at.default.undefined(r.dnsCache)&&!r.dnsCache.lookup)throw new TypeError(`Parameter \`dnsCache\` must be a CacheableLookup instance or a boolean, got ${at.default(r.dnsCache)}`);at.default.number(r.timeout)?r.timeout={request:r.timeout}:s&&r.timeout!==s.timeout?r.timeout={...s.timeout,...r.timeout}:r.timeout={...r.timeout},r.context||(r.context={});let S=r.hooks===s?.hooks;r.hooks={...r.hooks};for(let P of Ln.knownHookEvents)if(P in r.hooks)if(at.default.array(r.hooks[P]))r.hooks[P]=[...r.hooks[P]];else throw new TypeError(`Parameter \`${P}\` must be an Array, got ${at.default(r.hooks[P])}`);else r.hooks[P]=[];if(s&&!S)for(let P of Ln.knownHookEvents)s.hooks[P].length>0&&(r.hooks[P]=[...s.hooks[P],...r.hooks[P]]);if("family"in r&&v0.default('"options.family" was never documented, please use "options.dnsLookupIpVersion"'),s?.https&&(r.https={...s.https,...r.https}),"rejectUnauthorized"in r&&v0.default('"options.rejectUnauthorized" is now deprecated, please use "options.https.rejectUnauthorized"'),"checkServerIdentity"in r&&v0.default('"options.checkServerIdentity" was never documented, please use "options.https.checkServerIdentity"'),"ca"in r&&v0.default('"options.ca" was never documented, please use "options.https.certificateAuthority"'),"key"in r&&v0.default('"options.key" was never documented, please use "options.https.key"'),"cert"in r&&v0.default('"options.cert" was never documented, please use "options.https.certificate"'),"passphrase"in r&&v0.default('"options.passphrase" was never documented, please use "options.https.passphrase"'),"pfx"in r&&v0.default('"options.pfx" was never documented, please use "options.https.pfx"'),"followRedirects"in r)throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.");if(r.agent){for(let P in r.agent)if(P!=="http"&&P!=="https"&&P!=="http2")throw new TypeError(`Expected the \`options.agent\` properties to be \`http\`, \`https\` or \`http2\`, got \`${P}\``)}return r.maxRedirects=(p=r.maxRedirects)!==null&&p!==void 0?p:0,Ln.setNonEnumerableProperties([s,h],r),ddt.default(r,s)}_lockWrite(){let e=()=>{throw new TypeError("The payload has been already provided")};this.write=e,this.end=e}_unlockWrite(){this.write=super.write,this.end=super.end}async _finalizeBody(){let{options:e}=this,{headers:r}=e,s=!at.default.undefined(e.form),a=!at.default.undefined(e.json),n=!at.default.undefined(e.body),c=s||a||n,f=Ln.withoutBody.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);if(this._cannotHaveBody=f,c){if(f)throw new TypeError(`The \`${e.method}\` method cannot be used with a body`);if([n,s,a].filter(p=>p).length>1)throw new TypeError("The `body`, `json` and `form` options are mutually exclusive");if(n&&!(e.body instanceof Gge.Readable)&&!at.default.string(e.body)&&!at.default.buffer(e.body)&&!Vge.default(e.body))throw new TypeError("The `body` option must be a stream.Readable, string or Buffer");if(s&&!at.default.object(e.form))throw new TypeError("The `form` option must be an Object");{let p=!at.default.string(r["content-type"]);n?(Vge.default(e.body)&&p&&(r["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`),this[S0]=e.body):s?(p&&(r["content-type"]="application/x-www-form-urlencoded"),this[S0]=new B0.URLSearchParams(e.form).toString()):(p&&(r["content-type"]="application/json"),this[S0]=e.stringifyJson(e.json));let h=await udt.default(this[S0],e.headers);at.default.undefined(r["content-length"])&&at.default.undefined(r["transfer-encoding"])&&!f&&!at.default.undefined(h)&&(r["content-length"]=String(h))}}else f?this._lockWrite():this._unlockWrite();this[CI]=Number(r["content-length"])||void 0}async _onResponseBase(e){let{options:r}=this,{url:s}=r;this[ede]=e,r.decompress&&(e=adt(e));let a=e.statusCode,n=e;n.statusMessage=n.statusMessage?n.statusMessage:Wge.STATUS_CODES[a],n.url=r.url.toString(),n.requestUrl=this.requestUrl,n.redirectUrls=this.redirects,n.request=this,n.isFromCache=e.fromCache||!1,n.ip=this.ip,n.retryCount=this.retryCount,this[Xge]=n.isFromCache,this[EI]=Number(e.headers["content-length"])||void 0,this[eT]=e,e.once("end",()=>{this[EI]=this[II],this.emit("downloadProgress",this.downloadProgress)}),e.once("error",f=>{e.destroy(),this._beforeError(new hv(f,this))}),e.once("aborted",()=>{this._beforeError(new hv({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}),this.emit("downloadProgress",this.downloadProgress);let c=e.headers["set-cookie"];if(at.default.object(r.cookieJar)&&c){let f=c.map(async p=>r.cookieJar.setCookie(p,s.toString()));r.ignoreInvalidCookies&&(f=f.map(async p=>p.catch(()=>{})));try{await Promise.all(f)}catch(p){this._beforeError(p);return}}if(r.followRedirect&&e.headers.location&&wdt.has(a)){if(e.resume(),this[go]&&(this[mj](),delete this[go],this[Zge]()),(a===303&&r.method!=="GET"&&r.method!=="HEAD"||!r.methodRewriting)&&(r.method="GET","body"in r&&delete r.body,"json"in r&&delete r.json,"form"in r&&delete r.form,this[S0]=void 0,delete r.headers["content-length"]),this.redirects.length>=r.maxRedirects){this._beforeError(new tT(this));return}try{let p=Buffer.from(e.headers.location,"binary").toString(),h=new B0.URL(p,s),E=h.toString();decodeURI(E),h.hostname!==s.hostname||h.port!==s.port?("host"in r.headers&&delete r.headers.host,"cookie"in r.headers&&delete r.headers.cookie,"authorization"in r.headers&&delete r.headers.authorization,(r.username||r.password)&&(r.username="",r.password="")):(h.username=r.username,h.password=r.password),this.redirects.push(E),r.url=h;for(let C of r.hooks.beforeRedirect)await C(r,n);this.emit("redirect",n,r),await this._makeRequest()}catch(p){this._beforeError(p);return}return}if(r.isStream&&r.throwHttpErrors&&!gdt.isResponseOk(n)){this._beforeError(new rT(n));return}e.on("readable",()=>{this[$Q]&&this._read()}),this.on("resume",()=>{e.resume()}),this.on("pause",()=>{e.pause()}),e.once("end",()=>{this.push(null)}),this.emit("response",e);for(let f of this[XQ])if(!f.headersSent){for(let p in e.headers){let h=r.decompress?p!=="content-encoding":!0,E=e.headers[p];h&&f.setHeader(p,E)}f.statusCode=a}}async _onResponse(e){try{await this._onResponseBase(e)}catch(r){this._beforeError(r)}}_onRequest(e){let{options:r}=this,{timeout:s,url:a}=r;sdt.default(e),this[mj]=Kge.default(e,s,a);let n=r.cache?"cacheableResponse":"response";e.once(n,p=>{this._onResponse(p)}),e.once("error",p=>{var h;e.destroy(),(h=e.res)===null||h===void 0||h.removeAllListeners("end"),p=p instanceof Kge.TimeoutError?new sT(p,this.timings,this):new fs(p.message,p,this),this._beforeError(p)}),this[Zge]=fdt.default(e,this,vdt),this[go]=e,this.emit("uploadProgress",this.uploadProgress);let c=this[S0],f=this.redirects.length===0?this:e;at.default.nodeStream(c)?(c.pipe(f),c.once("error",p=>{this._beforeError(new iT(p,this))})):(this._unlockWrite(),at.default.undefined(c)?(this._cannotHaveBody||this._noPipe)&&(f.end(),this._lockWrite()):(this._writeRequest(c,void 0,()=>{}),f.end(),this._lockWrite())),this.emit("request",e)}async _createCacheableRequest(e,r){return new Promise((s,a)=>{Object.assign(r,Adt.default(e)),delete r.url;let n,c=yj.get(r.cache)(r,async f=>{f._readableState.autoDestroy=!1,n&&(await n).emit("cacheableResponse",f),s(f)});r.url=e,c.once("error",a),c.once("request",async f=>{n=f,s(n)})})}async _makeRequest(){var e,r,s,a,n;let{options:c}=this,{headers:f}=c;for(let U in f)if(at.default.undefined(f[U]))delete f[U];else if(at.default.null_(f[U]))throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${U}\` header`);if(c.decompress&&at.default.undefined(f["accept-encoding"])&&(f["accept-encoding"]=ydt?"gzip, deflate, br":"gzip, deflate"),c.cookieJar){let U=await c.cookieJar.getCookieString(c.url.toString());at.default.nonEmptyString(U)&&(c.headers.cookie=U)}for(let U of c.hooks.beforeRequest){let W=await U(c);if(!at.default.undefined(W)){c.request=()=>W;break}}c.body&&this[S0]!==c.body&&(this[S0]=c.body);let{agent:p,request:h,timeout:E,url:C}=c;if(c.dnsCache&&!("lookup"in c)&&(c.lookup=c.dnsCache.lookup),C.hostname==="unix"){let U=/(?.+?):(?.+)/.exec(`${C.pathname}${C.search}`);if(U?.groups){let{socketPath:W,path:te}=U.groups;Object.assign(c,{socketPath:W,path:te,host:""})}}let S=C.protocol==="https:",P;c.http2?P=ldt.auto:P=S?idt.request:Wge.request;let I=(e=c.request)!==null&&e!==void 0?e:P,R=c.cache?this._createCacheableRequest:I;p&&!c.http2&&(c.agent=p[S?"https":"http"]),c[go]=I,delete c.request,delete c.timeout;let N=c;if(N.shared=(r=c.cacheOptions)===null||r===void 0?void 0:r.shared,N.cacheHeuristic=(s=c.cacheOptions)===null||s===void 0?void 0:s.cacheHeuristic,N.immutableMinTimeToLive=(a=c.cacheOptions)===null||a===void 0?void 0:a.immutableMinTimeToLive,N.ignoreCargoCult=(n=c.cacheOptions)===null||n===void 0?void 0:n.ignoreCargoCult,c.dnsLookupIpVersion!==void 0)try{N.family=zge.dnsLookupIpVersionToFamily(c.dnsLookupIpVersion)}catch{throw new Error("Invalid `dnsLookupIpVersion` option value")}c.https&&("rejectUnauthorized"in c.https&&(N.rejectUnauthorized=c.https.rejectUnauthorized),c.https.checkServerIdentity&&(N.checkServerIdentity=c.https.checkServerIdentity),c.https.certificateAuthority&&(N.ca=c.https.certificateAuthority),c.https.certificate&&(N.cert=c.https.certificate),c.https.key&&(N.key=c.https.key),c.https.passphrase&&(N.passphrase=c.https.passphrase),c.https.pfx&&(N.pfx=c.https.pfx));try{let U=await R(C,N);at.default.undefined(U)&&(U=P(C,N)),c.request=h,c.timeout=E,c.agent=p,c.https&&("rejectUnauthorized"in c.https&&delete N.rejectUnauthorized,c.https.checkServerIdentity&&delete N.checkServerIdentity,c.https.certificateAuthority&&delete N.ca,c.https.certificate&&delete N.cert,c.https.key&&delete N.key,c.https.passphrase&&delete N.passphrase,c.https.pfx&&delete N.pfx),Idt(U)?this._onRequest(U):this.writable?(this.once("finish",()=>{this._onResponse(U)}),this._unlockWrite(),this.end(),this._lockWrite()):this._onResponse(U)}catch(U){throw U instanceof Yge.CacheError?new nT(U,this):new fs(U.message,U,this)}}async _error(e){try{for(let r of this.options.hooks.beforeError)e=await r(e)}catch(r){e=new fs(r.message,r,this)}this.destroy(e)}_beforeError(e){if(this[BI])return;let{options:r}=this,s=this.retryCount+1;this[BI]=!0,e instanceof fs||(e=new fs(e.message,e,this));let a=e,{response:n}=a;(async()=>{if(n&&!n.body){n.setEncoding(this._readableState.encoding);try{n.rawBody=await hdt.default(n),n.body=n.rawBody.toString()}catch{}}if(this.listenerCount("retry")!==0){let c;try{let f;n&&"retry-after"in n.headers&&(f=Number(n.headers["retry-after"]),Number.isNaN(f)?(f=Date.parse(n.headers["retry-after"])-Date.now(),f<=0&&(f=1)):f*=1e3),c=await r.retry.calculateDelay({attemptCount:s,retryOptions:r.retry,error:a,retryAfter:f,computedValue:mdt.default({attemptCount:s,retryOptions:r.retry,error:a,retryAfter:f,computedValue:0})})}catch(f){this._error(new fs(f.message,f,this));return}if(c){let f=async()=>{try{for(let p of this.options.hooks.beforeRetry)await p(this.options,a,s)}catch(p){this._error(new fs(p.message,e,this));return}this.destroyed||(this.destroy(),this.emit("retry",s,e))};this[tde]=setTimeout(f,c);return}}this._error(a)})()}_read(){this[$Q]=!0;let e=this[eT];if(e&&!this[BI]){e.readableLength&&(this[$Q]=!1);let r;for(;(r=e.read())!==null;){this[II]+=r.length,this[$ge]=!0;let s=this.downloadProgress;s.percent<1&&this.emit("downloadProgress",s),this.push(r)}}}_write(e,r,s){let a=()=>{this._writeRequest(e,r,s)};this.requestInitialized?a():this[pv].push(a)}_writeRequest(e,r,s){this[go].destroyed||(this._progressCallbacks.push(()=>{this[wI]+=Buffer.byteLength(e,r);let a=this.uploadProgress;a.percent<1&&this.emit("uploadProgress",a)}),this[go].write(e,r,a=>{!a&&this._progressCallbacks.length>0&&this._progressCallbacks.shift()(),s(a)}))}_final(e){let r=()=>{for(;this._progressCallbacks.length!==0;)this._progressCallbacks.shift()();if(!(go in this)){e();return}if(this[go].destroyed){e();return}this[go].end(s=>{s||(this[CI]=this[wI],this.emit("uploadProgress",this.uploadProgress),this[go].emit("upload-complete")),e(s)})};this.requestInitialized?r():this[pv].push(r)}_destroy(e,r){var s;this[BI]=!0,clearTimeout(this[tde]),go in this&&(this[mj](),!((s=this[eT])===null||s===void 0)&&s.complete||this[go].destroy()),e!==null&&!at.default.undefined(e)&&!(e instanceof fs)&&(e=new fs(e.message,e,this)),r(e)}get _isAboutToError(){return this[BI]}get ip(){var e;return(e=this.socket)===null||e===void 0?void 0:e.remoteAddress}get aborted(){var e,r,s;return((r=(e=this[go])===null||e===void 0?void 0:e.destroyed)!==null&&r!==void 0?r:this.destroyed)&&!(!((s=this[ede])===null||s===void 0)&&s.complete)}get socket(){var e,r;return(r=(e=this[go])===null||e===void 0?void 0:e.socket)!==null&&r!==void 0?r:void 0}get downloadProgress(){let e;return this[EI]?e=this[II]/this[EI]:this[EI]===this[II]?e=1:e=0,{percent:e,transferred:this[II],total:this[EI]}}get uploadProgress(){let e;return this[CI]?e=this[wI]/this[CI]:this[CI]===this[wI]?e=1:e=0,{percent:e,transferred:this[wI],total:this[CI]}}get timings(){var e;return(e=this[go])===null||e===void 0?void 0:e.timings}get isFromCache(){return this[Xge]}pipe(e,r){if(this[$ge])throw new Error("Failed to pipe. The response has been emitted already.");return e instanceof gj.ServerResponse&&this[XQ].add(e),super.pipe(e,r)}unpipe(e){return e instanceof gj.ServerResponse&&this[XQ].delete(e),super.unpipe(e),this}};Ln.default=aT});var dv=L(Wu=>{"use strict";var Sdt=Wu&&Wu.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Ddt=Wu&&Wu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sdt(e,t,r)};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.CancelError=Wu.ParseError=void 0;var rde=gv(),Ej=class extends rde.RequestError{constructor(e,r){let{options:s}=r.request;super(`${e.message} in "${s.url.toString()}"`,e,r.request),this.name="ParseError"}};Wu.ParseError=Ej;var Ij=class extends rde.RequestError{constructor(e){super("Promise was canceled",{},e),this.name="CancelError"}get isCanceled(){return!0}};Wu.CancelError=Ij;Ddt(gv(),Wu)});var ide=L(Cj=>{"use strict";Object.defineProperty(Cj,"__esModule",{value:!0});var nde=dv(),bdt=(t,e,r,s)=>{let{rawBody:a}=t;try{if(e==="text")return a.toString(s);if(e==="json")return a.length===0?"":r(a.toString());if(e==="buffer")return a;throw new nde.ParseError({message:`Unknown body type '${e}'`,name:"Error"},t)}catch(n){throw new nde.ParseError(n,t)}};Cj.default=bdt});var wj=L(D0=>{"use strict";var Pdt=D0&&D0.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),xdt=D0&&D0.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pdt(e,t,r)};Object.defineProperty(D0,"__esModule",{value:!0});var kdt=ye("events"),Qdt=Mp(),Tdt=n0e(),lT=dv(),sde=ide(),ode=gv(),Rdt=ij(),Fdt=fj(),ade=Aj(),Ndt=["request","response","redirect","uploadProgress","downloadProgress"];function lde(t){let e,r,s=new kdt.EventEmitter,a=new Tdt((c,f,p)=>{let h=E=>{let C=new ode.default(void 0,t);C.retryCount=E,C._noPipe=!0,p(()=>C.destroy()),p.shouldReject=!1,p(()=>f(new lT.CancelError(C))),e=C,C.once("response",async I=>{var R;if(I.retryCount=E,I.request.aborted)return;let N;try{N=await Fdt.default(C),I.rawBody=N}catch{return}if(C._isAboutToError)return;let U=((R=I.headers["content-encoding"])!==null&&R!==void 0?R:"").toLowerCase(),W=["gzip","deflate","br"].includes(U),{options:te}=C;if(W&&!te.decompress)I.body=N;else try{I.body=sde.default(I,te.responseType,te.parseJson,te.encoding)}catch(ie){if(I.body=N.toString(),ade.isResponseOk(I)){C._beforeError(ie);return}}try{for(let[ie,Ae]of te.hooks.afterResponse.entries())I=await Ae(I,async ce=>{let me=ode.default.normalizeArguments(void 0,{...ce,retry:{calculateDelay:()=>0},throwHttpErrors:!1,resolveBodyOnly:!1},te);me.hooks.afterResponse=me.hooks.afterResponse.slice(0,ie);for(let Be of me.hooks.beforeRetry)await Be(me);let pe=lde(me);return p(()=>{pe.catch(()=>{}),pe.cancel()}),pe})}catch(ie){C._beforeError(new lT.RequestError(ie.message,ie,C));return}if(!ade.isResponseOk(I)){C._beforeError(new lT.HTTPError(I));return}r=I,c(C.options.resolveBodyOnly?I.body:I)});let S=I=>{if(a.isCanceled)return;let{options:R}=C;if(I instanceof lT.HTTPError&&!R.throwHttpErrors){let{response:N}=I;c(C.options.resolveBodyOnly?N.body:N);return}f(I)};C.once("error",S);let P=C.options.body;C.once("retry",(I,R)=>{var N,U;if(P===((N=R.request)===null||N===void 0?void 0:N.options.body)&&Qdt.default.nodeStream((U=R.request)===null||U===void 0?void 0:U.options.body)){S(R);return}h(I)}),Rdt.default(C,s,Ndt)};h(0)});a.on=(c,f)=>(s.on(c,f),a);let n=c=>{let f=(async()=>{await a;let{options:p}=r.request;return sde.default(r,c,p.parseJson,p.encoding)})();return Object.defineProperties(f,Object.getOwnPropertyDescriptors(a)),f};return a.json=()=>{let{headers:c}=e.options;return!e.writableFinished&&c.accept===void 0&&(c.accept="application/json"),n("json")},a.buffer=()=>n("buffer"),a.text=()=>n("text"),a}D0.default=lde;xdt(dv(),D0)});var cde=L(Bj=>{"use strict";Object.defineProperty(Bj,"__esModule",{value:!0});var Odt=dv();function Ldt(t,...e){let r=(async()=>{if(t instanceof Odt.RequestError)try{for(let a of e)if(a)for(let n of a)t=await n(t)}catch(a){t=a}throw t})(),s=()=>r;return r.json=s,r.text=s,r.buffer=s,r.on=s,r}Bj.default=Ldt});var Ade=L(vj=>{"use strict";Object.defineProperty(vj,"__esModule",{value:!0});var ude=Mp();function fde(t){for(let e of Object.values(t))(ude.default.plainObject(e)||ude.default.array(e))&&fde(e);return Object.freeze(t)}vj.default=fde});var hde=L(pde=>{"use strict";Object.defineProperty(pde,"__esModule",{value:!0})});var Sj=L(Lc=>{"use strict";var Mdt=Lc&&Lc.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),_dt=Lc&&Lc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mdt(e,t,r)};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.defaultHandler=void 0;var gde=Mp(),Oc=wj(),Udt=cde(),uT=gv(),Hdt=Ade(),jdt={RequestError:Oc.RequestError,CacheError:Oc.CacheError,ReadError:Oc.ReadError,HTTPError:Oc.HTTPError,MaxRedirectsError:Oc.MaxRedirectsError,TimeoutError:Oc.TimeoutError,ParseError:Oc.ParseError,CancelError:Oc.CancelError,UnsupportedProtocolError:Oc.UnsupportedProtocolError,UploadError:Oc.UploadError},qdt=async t=>new Promise(e=>{setTimeout(e,t)}),{normalizeArguments:cT}=uT.default,dde=(...t)=>{let e;for(let r of t)e=cT(void 0,r,e);return e},Gdt=t=>t.isStream?new uT.default(void 0,t):Oc.default(t),Wdt=t=>"defaults"in t&&"options"in t.defaults,Ydt=["get","post","put","patch","head","delete"];Lc.defaultHandler=(t,e)=>e(t);var mde=(t,e)=>{if(t)for(let r of t)r(e)},yde=t=>{t._rawHandlers=t.handlers,t.handlers=t.handlers.map(s=>(a,n)=>{let c,f=s(a,p=>(c=n(p),c));if(f!==c&&!a.isStream&&c){let p=f,{then:h,catch:E,finally:C}=p;Object.setPrototypeOf(p,Object.getPrototypeOf(c)),Object.defineProperties(p,Object.getOwnPropertyDescriptors(c)),p.then=h,p.catch=E,p.finally=C}return f});let e=(s,a={},n)=>{var c,f;let p=0,h=E=>t.handlers[p++](E,p===t.handlers.length?Gdt:h);if(gde.default.plainObject(s)){let E={...s,...a};uT.setNonEnumerableProperties([s,a],E),a=E,s=void 0}try{let E;try{mde(t.options.hooks.init,a),mde((c=a.hooks)===null||c===void 0?void 0:c.init,a)}catch(S){E=S}let C=cT(s,a,n??t.options);if(C[uT.kIsNormalizedAlready]=!0,E)throw new Oc.RequestError(E.message,E,C);return h(C)}catch(E){if(a.isStream)throw E;return Udt.default(E,t.options.hooks.beforeError,(f=a.hooks)===null||f===void 0?void 0:f.beforeError)}};e.extend=(...s)=>{let a=[t.options],n=[...t._rawHandlers],c;for(let f of s)Wdt(f)?(a.push(f.defaults.options),n.push(...f.defaults._rawHandlers),c=f.defaults.mutableDefaults):(a.push(f),"handlers"in f&&n.push(...f.handlers),c=f.mutableDefaults);return n=n.filter(f=>f!==Lc.defaultHandler),n.length===0&&n.push(Lc.defaultHandler),yde({options:dde(...a),handlers:n,mutableDefaults:!!c})};let r=async function*(s,a){let n=cT(s,a,t.options);n.resolveBodyOnly=!1;let c=n.pagination;if(!gde.default.object(c))throw new TypeError("`options.pagination` must be implemented");let f=[],{countLimit:p}=c,h=0;for(;h{let n=[];for await(let c of r(s,a))n.push(c);return n},e.paginate.each=r,e.stream=(s,a)=>e(s,{...a,isStream:!0});for(let s of Ydt)e[s]=(a,n)=>e(a,{...n,method:s}),e.stream[s]=(a,n)=>e(a,{...n,method:s,isStream:!0});return Object.assign(e,jdt),Object.defineProperty(e,"defaults",{value:t.mutableDefaults?t:Hdt.default(t),writable:t.mutableDefaults,configurable:t.mutableDefaults,enumerable:!0}),e.mergeOptions=dde,e};Lc.default=yde;_dt(hde(),Lc)});var Cde=L((_p,fT)=>{"use strict";var Vdt=_p&&_p.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Ede=_p&&_p.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vdt(e,t,r)};Object.defineProperty(_p,"__esModule",{value:!0});var Kdt=ye("url"),Ide=Sj(),Jdt={options:{method:"GET",retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:void 0,calculateDelay:({computedValue:t})=>t},timeout:{},headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},hooks:{init:[],beforeRequest:[],beforeRedirect:[],beforeRetry:[],beforeError:[],afterResponse:[]},cache:void 0,dnsCache:void 0,decompress:!0,throwHttpErrors:!0,followRedirect:!0,isStream:!1,responseType:"text",resolveBodyOnly:!1,maxRedirects:10,prefixUrl:"",methodRewriting:!0,ignoreInvalidCookies:!1,context:{},http2:!1,allowGetBody:!1,https:void 0,pagination:{transform:t=>t.request.options.responseType==="json"?t.body:JSON.parse(t.body),paginate:t=>{if(!Reflect.has(t.headers,"link"))return!1;let e=t.headers.link.split(","),r;for(let s of e){let a=s.split(";");if(a[1].includes("next")){r=a[0].trimStart().trim(),r=r.slice(1,-1);break}}return r?{url:new Kdt.URL(r)}:!1},filter:()=>!0,shouldContinue:()=>!0,countLimit:1/0,backoff:0,requestLimit:1e4,stackAllItems:!0},parseJson:t=>JSON.parse(t),stringifyJson:t=>JSON.stringify(t),cacheOptions:{}},handlers:[Ide.defaultHandler],mutableDefaults:!1},Dj=Ide.default(Jdt);_p.default=Dj;fT.exports=Dj;fT.exports.default=Dj;fT.exports.__esModule=!0;Ede(Sj(),_p);Ede(wj(),_p)});var An={};Vt(An,{Method:()=>Pde,del:()=>emt,get:()=>kj,getNetworkSettings:()=>bde,post:()=>Qj,put:()=>$dt,request:()=>mv});function vde(t){let e=new URL(t),r={host:e.hostname,headers:{}};return e.port&&(r.port=Number(e.port)),e.username&&e.password&&(r.proxyAuth=`${e.username}:${e.password}`),{proxy:r}}async function bj(t){return Vl(Bde,t,()=>le.readFilePromise(t).then(e=>(Bde.set(t,e),e)))}function Xdt({statusCode:t,statusMessage:e},r){let s=Ut(r,t,Ct.NUMBER),a=`https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/${t}`;return JE(r,`${s}${e?` (${e})`:""}`,a)}async function AT(t,{configuration:e,customErrorMessage:r}){try{return await t}catch(s){if(s.name!=="HTTPError")throw s;let a=r?.(s,e)??s.response.body?.error;a==null&&(s.message.startsWith("Response code")?a="The remote server failed to provide the requested resource":a=s.message),s.code==="ETIMEDOUT"&&s.event==="socket"&&(a+=`(can be increased via ${Ut(e,"httpTimeout",Ct.SETTING)})`);let n=new Yt(35,a,c=>{s.response&&c.reportError(35,` ${Zf(e,{label:"Response Code",value:Hu(Ct.NO_HINT,Xdt(s.response,e))})}`),s.request&&(c.reportError(35,` ${Zf(e,{label:"Request Method",value:Hu(Ct.NO_HINT,s.request.options.method)})}`),c.reportError(35,` ${Zf(e,{label:"Request URL",value:Hu(Ct.URL,s.request.requestUrl)})}`)),s.request.redirects.length>0&&c.reportError(35,` ${Zf(e,{label:"Request Redirects",value:Hu(Ct.NO_HINT,I3(e,s.request.redirects,Ct.URL))})}`),s.request.retryCount===s.request.options.retry.limit&&c.reportError(35,` ${Zf(e,{label:"Request Retry Count",value:Hu(Ct.NO_HINT,`${Ut(e,s.request.retryCount,Ct.NUMBER)} (can be increased via ${Ut(e,"httpRetry",Ct.SETTING)})`)})}`)});throw n.originalError=s,n}}function bde(t,e){let r=[...e.configuration.get("networkSettings")].sort(([c],[f])=>f.length-c.length),s={enableNetwork:void 0,httpsCaFilePath:void 0,httpProxy:void 0,httpsProxy:void 0,httpsKeyFilePath:void 0,httpsCertFilePath:void 0},a=Object.keys(s),n=typeof t=="string"?new URL(t):t;for(let[c,f]of r)if(xj.default.isMatch(n.hostname,c))for(let p of a){let h=f.get(p);h!==null&&typeof s[p]>"u"&&(s[p]=h)}for(let c of a)typeof s[c]>"u"&&(s[c]=e.configuration.get(c));return s}async function mv(t,e,{configuration:r,headers:s,jsonRequest:a,jsonResponse:n,method:c="GET",wrapNetworkRequest:f}){let p={target:t,body:e,configuration:r,headers:s,jsonRequest:a,jsonResponse:n,method:c},h=async()=>await tmt(t,e,p),E=typeof f<"u"?await f(h,p):h;return await(await r.reduceHook(S=>S.wrapNetworkRequest,E,p))()}async function kj(t,{configuration:e,jsonResponse:r,customErrorMessage:s,wrapNetworkRequest:a,...n}){let c=()=>AT(mv(t,null,{configuration:e,wrapNetworkRequest:a,...n}),{configuration:e,customErrorMessage:s}).then(p=>p.body),f=await(typeof a<"u"?c():Vl(wde,t,()=>c().then(p=>(wde.set(t,p),p))));return r?JSON.parse(f.toString()):f}async function $dt(t,e,{customErrorMessage:r,...s}){return(await AT(mv(t,e,{...s,method:"PUT"}),{customErrorMessage:r,configuration:s.configuration})).body}async function Qj(t,e,{customErrorMessage:r,...s}){return(await AT(mv(t,e,{...s,method:"POST"}),{customErrorMessage:r,configuration:s.configuration})).body}async function emt(t,{customErrorMessage:e,...r}){return(await AT(mv(t,null,{...r,method:"DELETE"}),{customErrorMessage:e,configuration:r.configuration})).body}async function tmt(t,e,{configuration:r,headers:s,jsonRequest:a,jsonResponse:n,method:c="GET"}){let f=typeof t=="string"?new URL(t):t,p=bde(f,{configuration:r});if(p.enableNetwork===!1)throw new Yt(80,`Request to '${f.href}' has been blocked because of your configuration settings`);if(f.protocol==="http:"&&!xj.default.isMatch(f.hostname,r.get("unsafeHttpWhitelist")))throw new Yt(81,`Unsafe http requests must be explicitly whitelisted in your configuration (${f.hostname})`);let E={agent:{http:p.httpProxy?Pj.default.httpOverHttp(vde(p.httpProxy)):zdt,https:p.httpsProxy?Pj.default.httpsOverHttp(vde(p.httpsProxy)):Zdt},headers:s,method:c};E.responseType=n?"json":"buffer",e!==null&&(Buffer.isBuffer(e)||!a&&typeof e=="string"?E.body=e:E.json=e);let C=r.get("httpTimeout"),S=r.get("httpRetry"),P=r.get("enableStrictSsl"),I=p.httpsCaFilePath,R=p.httpsCertFilePath,N=p.httpsKeyFilePath,{default:U}=await Promise.resolve().then(()=>et(Cde())),W=I?await bj(I):void 0,te=R?await bj(R):void 0,ie=N?await bj(N):void 0,Ae=U.extend({timeout:{socket:C},retry:S,https:{rejectUnauthorized:P,certificateAuthority:W,certificate:te,key:ie},...E});return r.getLimit("networkConcurrency")(()=>Ae(f))}var Sde,Dde,xj,Pj,wde,Bde,zdt,Zdt,Pde,pT=It(()=>{bt();Sde=ye("https"),Dde=ye("http"),xj=et(Sa()),Pj=et(Xhe());Fc();Qc();kc();wde=new Map,Bde=new Map,zdt=new Dde.Agent({keepAlive:!0}),Zdt=new Sde.Agent({keepAlive:!0});Pde=(a=>(a.GET="GET",a.PUT="PUT",a.POST="POST",a.DELETE="DELETE",a))(Pde||{})});var As={};Vt(As,{availableParallelism:()=>Rj,getArchitecture:()=>yv,getArchitectureName:()=>omt,getArchitectureSet:()=>Tj,getCaller:()=>umt,major:()=>rmt,openUrl:()=>nmt});function smt(){if(process.platform==="darwin"||process.platform==="win32")return null;let t;try{t=le.readFileSync(imt)}catch{}if(typeof t<"u"){if(t&&(t.includes("GLIBC")||t.includes("libc")))return"glibc";if(t&&t.includes("musl"))return"musl"}let r=(process.report?.getReport()??{}).sharedObjects??[],s=/\/(?:(ld-linux-|[^/]+-linux-gnu\/)|(libc.musl-|ld-musl-))/;return p0(r,a=>{let n=a.match(s);if(!n)return p0.skip;if(n[1])return"glibc";if(n[2])return"musl";throw new Error("Assertion failed: Expected the libc variant to have been detected")})??null}function yv(){return kde=kde??{os:process.platform,cpu:process.arch,libc:smt()}}function omt(t=yv()){return t.libc?`${t.os}-${t.cpu}-${t.libc}`:`${t.os}-${t.cpu}`}function Tj(){let t=yv();return Qde=Qde??{os:[t.os],cpu:[t.cpu],libc:t.libc?[t.libc]:[]}}function cmt(t){let e=amt.exec(t);if(!e)return null;let r=e[2]&&e[2].indexOf("native")===0,s=e[2]&&e[2].indexOf("eval")===0,a=lmt.exec(e[2]);return s&&a!=null&&(e[2]=a[1],e[3]=a[2],e[4]=a[3]),{file:r?null:e[2],methodName:e[1]||"",arguments:r?[e[2]]:[],line:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}function umt(){let e=new Error().stack.split(` +`)[3];return cmt(e)}function Rj(){return typeof hT.default.availableParallelism<"u"?hT.default.availableParallelism():Math.max(1,hT.default.cpus().length)}var hT,rmt,xde,nmt,imt,kde,Qde,amt,lmt,gT=It(()=>{bt();hT=et(ye("os"));dT();kc();rmt=Number(process.versions.node.split(".")[0]),xde=new Map([["darwin","open"],["linux","xdg-open"],["win32","explorer.exe"]]).get(process.platform),nmt=typeof xde<"u"?async t=>{try{return await Fj(xde,[t],{cwd:K.cwd()}),!0}catch{return!1}}:void 0,imt="/usr/bin/ldd";amt=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lmt=/\((\S*)(?::(\d+))(?::(\d+))\)/});function _j(t,e,r,s,a){let n=sv(r);if(s.isArray||s.type==="ANY"&&Array.isArray(n))return Array.isArray(n)?n.map((c,f)=>Nj(t,`${e}[${f}]`,c,s,a)):String(n).split(/,/).map(c=>Nj(t,e,c,s,a));if(Array.isArray(n))throw new Error(`Non-array configuration settings "${e}" cannot be an array`);return Nj(t,e,r,s,a)}function Nj(t,e,r,s,a){let n=sv(r);switch(s.type){case"ANY":return NQ(n);case"SHAPE":return hmt(t,e,r,s,a);case"MAP":return gmt(t,e,r,s,a)}if(n===null&&!s.isNullable&&s.default!==null)throw new Error(`Non-nullable configuration settings "${e}" cannot be set to null`);if(s.values?.includes(n))return n;let f=(()=>{if(s.type==="BOOLEAN"&&typeof n!="string")return qB(n);if(typeof n!="string")throw new Error(`Expected configuration setting "${e}" to be a string, got ${typeof n}`);let p=Jk(n,{env:t.env});switch(s.type){case"ABSOLUTE_PATH":{let h=a,E=fH(r);return E&&E[0]!=="<"&&(h=K.dirname(E)),K.resolve(h,ue.toPortablePath(p))}case"LOCATOR_LOOSE":return Rp(p,!1);case"NUMBER":return parseInt(p);case"LOCATOR":return Rp(p);case"BOOLEAN":return qB(p);default:return p}})();if(s.values&&!s.values.includes(f))throw new Error(`Invalid value, expected one of ${s.values.join(", ")}`);return f}function hmt(t,e,r,s,a){let n=sv(r);if(typeof n!="object"||Array.isArray(n))throw new nt(`Object configuration settings "${e}" must be an object`);let c=Uj(t,s,{ignoreArrays:!0});if(n===null)return c;for(let[f,p]of Object.entries(n)){let h=`${e}.${f}`;if(!s.properties[f])throw new nt(`Unrecognized configuration settings found: ${e}.${f} - run "yarn config -v" to see the list of settings supported in Yarn`);c.set(f,_j(t,h,p,s.properties[f],a))}return c}function gmt(t,e,r,s,a){let n=sv(r),c=new Map;if(typeof n!="object"||Array.isArray(n))throw new nt(`Map configuration settings "${e}" must be an object`);if(n===null)return c;for(let[f,p]of Object.entries(n)){let h=s.normalizeKeys?s.normalizeKeys(f):f,E=`${e}['${h}']`,C=s.valueDefinition;c.set(h,_j(t,E,p,C,a))}return c}function Uj(t,e,{ignoreArrays:r=!1}={}){switch(e.type){case"SHAPE":{if(e.isArray&&!r)return[];let s=new Map;for(let[a,n]of Object.entries(e.properties))s.set(a,Uj(t,n));return s}case"MAP":return e.isArray&&!r?[]:new Map;case"ABSOLUTE_PATH":return e.default===null?null:t.projectCwd===null?Array.isArray(e.default)?e.default.map(s=>K.normalize(s)):K.isAbsolute(e.default)?K.normalize(e.default):e.isNullable?null:void 0:Array.isArray(e.default)?e.default.map(s=>K.resolve(t.projectCwd,s)):K.resolve(t.projectCwd,e.default);default:return e.default}}function yT(t,e,r){if(e.type==="SECRET"&&typeof t=="string"&&r.hideSecrets)return pmt;if(e.type==="ABSOLUTE_PATH"&&typeof t=="string"&&r.getNativePaths)return ue.fromPortablePath(t);if(e.isArray&&Array.isArray(t)){let s=[];for(let a of t)s.push(yT(a,e,r));return s}if(e.type==="MAP"&&t instanceof Map){if(t.size===0)return;let s=new Map;for(let[a,n]of t.entries()){let c=yT(n,e.valueDefinition,r);typeof c<"u"&&s.set(a,c)}return s}if(e.type==="SHAPE"&&t instanceof Map){if(t.size===0)return;let s=new Map;for(let[a,n]of t.entries()){let c=e.properties[a],f=yT(n,c,r);typeof f<"u"&&s.set(a,f)}return s}return t}function dmt(){let t={};for(let[e,r]of Object.entries(process.env))e=e.toLowerCase(),e.startsWith(ET)&&(e=(0,Rde.default)(e.slice(ET.length)),t[e]=r);return t}function Lj(){let t=`${ET}rc_filename`;for(let[e,r]of Object.entries(process.env))if(e.toLowerCase()===t&&typeof r=="string")return r;return Mj}async function Tde(t){try{return await le.readFilePromise(t)}catch{return Buffer.of()}}async function mmt(t,e){return Buffer.compare(...await Promise.all([Tde(t),Tde(e)]))===0}async function ymt(t,e){let[r,s]=await Promise.all([le.statPromise(t),le.statPromise(e)]);return r.dev===s.dev&&r.ino===s.ino}async function Imt({configuration:t,selfPath:e}){let r=t.get("yarnPath");return t.get("ignorePath")||r===null||r===e||await Emt(r,e)?null:r}var Rde,Up,Fde,Nde,Ode,Oj,fmt,Ev,Amt,Hp,ET,Mj,pmt,Iv,Lde,IT,mT,Emt,ze,Cv=It(()=>{bt();Bc();Rde=et(lne()),Up=et(Nd());Wt();Fde=et(tie()),Nde=ye("module"),Ode=et(Md()),Oj=ye("stream");phe();oI();nH();iH();sH();Hhe();oH();tm();Yhe();LQ();Qc();I0();pT();kc();gT();Np();Yo();fmt=function(){if(!Up.GITHUB_ACTIONS||!process.env.GITHUB_EVENT_PATH)return!1;let t=ue.toPortablePath(process.env.GITHUB_EVENT_PATH),e;try{e=le.readJsonSync(t)}catch{return!1}return!(!("repository"in e)||!e.repository||(e.repository.private??!0))}(),Ev=new Set(["@yarnpkg/plugin-constraints","@yarnpkg/plugin-exec","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"]),Amt=new Set(["isTestEnv","injectNpmUser","injectNpmPassword","injectNpm2FaToken","zipDataEpilogue","cacheCheckpointOverride","cacheVersionOverride","lockfileVersionOverride","binFolder","version","flags","profile","gpg","ignoreNode","wrapOutput","home","confDir","registry","ignoreCwd"]),Hp=/^(?!v)[a-z0-9._-]+$/i,ET="yarn_",Mj=".yarnrc.yml",pmt="********",Iv=(E=>(E.ANY="ANY",E.BOOLEAN="BOOLEAN",E.ABSOLUTE_PATH="ABSOLUTE_PATH",E.LOCATOR="LOCATOR",E.LOCATOR_LOOSE="LOCATOR_LOOSE",E.NUMBER="NUMBER",E.STRING="STRING",E.SECRET="SECRET",E.SHAPE="SHAPE",E.MAP="MAP",E))(Iv||{}),Lde=Ct,IT=(r=>(r.JUNCTIONS="junctions",r.SYMLINKS="symlinks",r))(IT||{}),mT={lastUpdateCheck:{description:"Last timestamp we checked whether new Yarn versions were available",type:"STRING",default:null},yarnPath:{description:"Path to the local executable that must be used over the global one",type:"ABSOLUTE_PATH",default:null},ignorePath:{description:"If true, the local executable will be ignored when using the global one",type:"BOOLEAN",default:!1},globalFolder:{description:"Folder where all system-global files are stored",type:"ABSOLUTE_PATH",default:pH()},cacheFolder:{description:"Folder where the cache files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/cache"},compressionLevel:{description:"Zip files compression level, from 0 to 9 or mixed (a variant of 9, which stores some files uncompressed, when compression doesn't yield good results)",type:"NUMBER",values:["mixed",0,1,2,3,4,5,6,7,8,9],default:0},virtualFolder:{description:"Folder where the virtual packages (cf doc) will be mapped on the disk (must be named __virtual__)",type:"ABSOLUTE_PATH",default:"./.yarn/__virtual__"},installStatePath:{description:"Path of the file where the install state will be persisted",type:"ABSOLUTE_PATH",default:"./.yarn/install-state.gz"},immutablePatterns:{description:"Array of glob patterns; files matching them won't be allowed to change during immutable installs",type:"STRING",default:[],isArray:!0},rcFilename:{description:"Name of the files where the configuration can be found",type:"STRING",default:Lj()},enableGlobalCache:{description:"If true, the system-wide cache folder will be used regardless of `cache-folder`",type:"BOOLEAN",default:!0},cacheMigrationMode:{description:"Defines the conditions under which Yarn upgrades should cause the cache archives to be regenerated.",type:"STRING",values:["always","match-spec","required-only"],default:"always"},enableColors:{description:"If true, the CLI is allowed to use colors in its output",type:"BOOLEAN",default:Xk,defaultText:""},enableHyperlinks:{description:"If true, the CLI is allowed to use hyperlinks in its output",type:"BOOLEAN",default:E3,defaultText:""},enableInlineBuilds:{description:"If true, the CLI will print the build output on the command line",type:"BOOLEAN",default:Up.isCI,defaultText:""},enableMessageNames:{description:"If true, the CLI will prefix most messages with codes suitable for search engines",type:"BOOLEAN",default:!0},enableProgressBars:{description:"If true, the CLI is allowed to show a progress bar for long-running events",type:"BOOLEAN",default:!Up.isCI,defaultText:""},enableTimers:{description:"If true, the CLI is allowed to print the time spent executing commands",type:"BOOLEAN",default:!0},enableTips:{description:"If true, installs will print a helpful message every day of the week",type:"BOOLEAN",default:!Up.isCI,defaultText:""},preferInteractive:{description:"If true, the CLI will automatically use the interactive mode when called from a TTY",type:"BOOLEAN",default:!1},preferTruncatedLines:{description:"If true, the CLI will truncate lines that would go beyond the size of the terminal",type:"BOOLEAN",default:!1},progressBarStyle:{description:"Which style of progress bar should be used (only when progress bars are enabled)",type:"STRING",default:void 0,defaultText:""},defaultLanguageName:{description:"Default language mode that should be used when a package doesn't offer any insight",type:"STRING",default:"node"},defaultProtocol:{description:"Default resolution protocol used when resolving pure semver and tag ranges",type:"STRING",default:"npm:"},enableTransparentWorkspaces:{description:"If false, Yarn won't automatically resolve workspace dependencies unless they use the `workspace:` protocol",type:"BOOLEAN",default:!0},supportedArchitectures:{description:"Architectures that Yarn will fetch and inject into the resolver",type:"SHAPE",properties:{os:{description:"Array of supported process.platform strings, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]},cpu:{description:"Array of supported process.arch strings, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]},libc:{description:"Array of supported libc libraries, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]}}},enableMirror:{description:"If true, the downloaded packages will be retrieved and stored in both the local and global folders",type:"BOOLEAN",default:!0},enableNetwork:{description:"If false, Yarn will refuse to use the network if required to",type:"BOOLEAN",default:!0},enableOfflineMode:{description:"If true, Yarn will attempt to retrieve files and metadata from the global cache rather than the network",type:"BOOLEAN",default:!1},httpProxy:{description:"URL of the http proxy that must be used for outgoing http requests",type:"STRING",default:null},httpsProxy:{description:"URL of the http proxy that must be used for outgoing https requests",type:"STRING",default:null},unsafeHttpWhitelist:{description:"List of the hostnames for which http queries are allowed (glob patterns are supported)",type:"STRING",default:[],isArray:!0},httpTimeout:{description:"Timeout of each http request in milliseconds",type:"NUMBER",default:6e4},httpRetry:{description:"Retry times on http failure",type:"NUMBER",default:3},networkConcurrency:{description:"Maximal number of concurrent requests",type:"NUMBER",default:50},taskPoolConcurrency:{description:"Maximal amount of concurrent heavy task processing",type:"NUMBER",default:Rj()},taskPoolMode:{description:"Execution strategy for heavy tasks",type:"STRING",values:["async","workers"],default:"workers"},networkSettings:{description:"Network settings per hostname (glob patterns are supported)",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{httpsCaFilePath:{description:"Path to file containing one or multiple Certificate Authority signing certificates",type:"ABSOLUTE_PATH",default:null},enableNetwork:{description:"If false, the package manager will refuse to use the network if required to",type:"BOOLEAN",default:null},httpProxy:{description:"URL of the http proxy that must be used for outgoing http requests",type:"STRING",default:null},httpsProxy:{description:"URL of the http proxy that must be used for outgoing https requests",type:"STRING",default:null},httpsKeyFilePath:{description:"Path to file containing private key in PEM format",type:"ABSOLUTE_PATH",default:null},httpsCertFilePath:{description:"Path to file containing certificate chain in PEM format",type:"ABSOLUTE_PATH",default:null}}}},httpsCaFilePath:{description:"A path to a file containing one or multiple Certificate Authority signing certificates",type:"ABSOLUTE_PATH",default:null},httpsKeyFilePath:{description:"Path to file containing private key in PEM format",type:"ABSOLUTE_PATH",default:null},httpsCertFilePath:{description:"Path to file containing certificate chain in PEM format",type:"ABSOLUTE_PATH",default:null},enableStrictSsl:{description:"If false, SSL certificate errors will be ignored",type:"BOOLEAN",default:!0},logFilters:{description:"Overrides for log levels",type:"SHAPE",isArray:!0,concatenateValues:!0,properties:{code:{description:"Code of the messages covered by this override",type:"STRING",default:void 0},text:{description:"Code of the texts covered by this override",type:"STRING",default:void 0},pattern:{description:"Code of the patterns covered by this override",type:"STRING",default:void 0},level:{description:"Log level override, set to null to remove override",type:"STRING",values:Object.values(eQ),isNullable:!0,default:void 0}}},enableTelemetry:{description:"If true, telemetry will be periodically sent, following the rules in https://yarnpkg.com/advanced/telemetry",type:"BOOLEAN",default:!0},telemetryInterval:{description:"Minimal amount of time between two telemetry uploads, in days",type:"NUMBER",default:7},telemetryUserId:{description:"If you desire to tell us which project you are, you can set this field. Completely optional and opt-in.",type:"STRING",default:null},enableHardenedMode:{description:"If true, automatically enable --check-resolutions --refresh-lockfile on installs",type:"BOOLEAN",default:Up.isPR&&fmt,defaultText:""},enableScripts:{description:"If true, packages are allowed to have install scripts by default",type:"BOOLEAN",default:!0},enableStrictSettings:{description:"If true, unknown settings will cause Yarn to abort",type:"BOOLEAN",default:!0},enableImmutableCache:{description:"If true, the cache is reputed immutable and actions that would modify it will throw",type:"BOOLEAN",default:!1},enableCacheClean:{description:"If false, disallows the `cache clean` command",type:"BOOLEAN",default:!0},checksumBehavior:{description:"Enumeration defining what to do when a checksum doesn't match expectations",type:"STRING",default:"throw"},injectEnvironmentFiles:{description:"List of all the environment files that Yarn should inject inside the process when it starts",type:"ABSOLUTE_PATH",default:[".env.yarn?"],isArray:!0},packageExtensions:{description:"Map of package corrections to apply on the dependency tree",type:"MAP",valueDefinition:{description:"The extension that will be applied to any package whose version matches the specified range",type:"SHAPE",properties:{dependencies:{description:"The set of dependencies that must be made available to the current package in order for it to work properly",type:"MAP",valueDefinition:{description:"A range",type:"STRING"}},peerDependencies:{description:"Inherited dependencies - the consumer of the package will be tasked to provide them",type:"MAP",valueDefinition:{description:"A semver range",type:"STRING"}},peerDependenciesMeta:{description:"Extra information related to the dependencies listed in the peerDependencies field",type:"MAP",valueDefinition:{description:"The peerDependency meta",type:"SHAPE",properties:{optional:{description:"If true, the selected peer dependency will be marked as optional by the package manager and the consumer omitting it won't be reported as an error",type:"BOOLEAN",default:!1}}}}}}}};Emt=process.platform==="win32"?mmt:ymt;ze=class t{constructor(e){this.isCI=Up.isCI;this.projectCwd=null;this.plugins=new Map;this.settings=new Map;this.values=new Map;this.sources=new Map;this.invalid=new Map;this.env={};this.limits=new Map;this.packageExtensions=null;this.startingCwd=e}static{this.deleteProperty=Symbol()}static{this.telemetry=null}static create(e,r,s){let a=new t(e);typeof r<"u"&&!(r instanceof Map)&&(a.projectCwd=r),a.importSettings(mT);let n=typeof s<"u"?s:r instanceof Map?r:new Map;for(let[c,f]of n)a.activatePlugin(c,f);return a}static async find(e,r,{strict:s=!0,usePathCheck:a=null,useRc:n=!0}={}){let c=dmt();delete c.rcFilename;let f=new t(e),p=await t.findRcFiles(e),h=await t.findFolderRcFile(AI());h&&(p.find(me=>me.path===h.path)||p.unshift(h));let E=Whe(p.map(ce=>[ce.path,ce.data])),C=vt.dot,S=new Set(Object.keys(mT)),P=({yarnPath:ce,ignorePath:me,injectEnvironmentFiles:pe})=>({yarnPath:ce,ignorePath:me,injectEnvironmentFiles:pe}),I=({yarnPath:ce,ignorePath:me,injectEnvironmentFiles:pe,...Be})=>{let Ce={};for(let[g,we]of Object.entries(Be))S.has(g)&&(Ce[g]=we);return Ce},R=({yarnPath:ce,ignorePath:me,...pe})=>{let Be={};for(let[Ce,g]of Object.entries(pe))S.has(Ce)||(Be[Ce]=g);return Be};if(f.importSettings(P(mT)),f.useWithSource("",P(c),e,{strict:!1}),E){let[ce,me]=E;f.useWithSource(ce,P(me),C,{strict:!1})}if(a){if(await Imt({configuration:f,selfPath:a})!==null)return f;f.useWithSource("",{ignorePath:!0},e,{strict:!1,overwrite:!0})}let N=await t.findProjectCwd(e);f.startingCwd=e,f.projectCwd=N;let U=Object.assign(Object.create(null),process.env);f.env=U;let W=await Promise.all(f.get("injectEnvironmentFiles").map(async ce=>{let me=ce.endsWith("?")?await le.readFilePromise(ce.slice(0,-1),"utf8").catch(()=>""):await le.readFilePromise(ce,"utf8");return(0,Fde.parse)(me)}));for(let ce of W)for(let[me,pe]of Object.entries(ce))f.env[me]=Jk(pe,{env:U});if(f.importSettings(I(mT)),f.useWithSource("",I(c),e,{strict:s}),E){let[ce,me]=E;f.useWithSource(ce,I(me),C,{strict:s})}let te=ce=>"default"in ce?ce.default:ce,ie=new Map([["@@core",Ahe]]);if(r!==null)for(let ce of r.plugins.keys())ie.set(ce,te(r.modules.get(ce)));for(let[ce,me]of ie)f.activatePlugin(ce,me);let Ae=new Map([]);if(r!==null){let ce=new Map;for(let[Be,Ce]of r.modules)ce.set(Be,()=>Ce);let me=new Set,pe=async(Be,Ce)=>{let{factory:g,name:we}=kp(Be);if(!g||me.has(we))return;let Ee=new Map(ce),fe=X=>{if((0,Nde.isBuiltin)(X))return kp(X);if(Ee.has(X))return Ee.get(X)();throw new nt(`This plugin cannot access the package referenced via ${X} which is neither a builtin, nor an exposed entry`)},se=await GE(async()=>te(await g(fe)),X=>`${X} (when initializing ${we}, defined in ${Ce})`);ce.set(we,()=>se),me.add(we),Ae.set(we,se)};if(c.plugins)for(let Be of c.plugins.split(";")){let Ce=K.resolve(e,ue.toPortablePath(Be));await pe(Ce,"")}for(let{path:Be,cwd:Ce,data:g}of p)if(n&&Array.isArray(g.plugins))for(let we of g.plugins){let Ee=typeof we!="string"?we.path:we,fe=we?.spec??"",se=we?.checksum??"";if(Ev.has(fe))continue;let X=K.resolve(Ce,ue.toPortablePath(Ee));if(!await le.existsPromise(X)){if(!fe){let gt=Ut(f,K.basename(X,".cjs"),Ct.NAME),j=Ut(f,".gitignore",Ct.NAME),rt=Ut(f,f.values.get("rcFilename"),Ct.NAME),Fe=Ut(f,"https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored",Ct.URL);throw new nt(`Missing source for the ${gt} plugin - please try to remove the plugin from ${rt} then reinstall it manually. This error usually occurs because ${j} is incorrect, check ${Fe} to make sure your plugin folder isn't gitignored.`)}if(!fe.match(/^https?:/)){let gt=Ut(f,K.basename(X,".cjs"),Ct.NAME),j=Ut(f,f.values.get("rcFilename"),Ct.NAME);throw new nt(`Failed to recognize the source for the ${gt} plugin - please try to delete the plugin from ${j} then reinstall it manually.`)}let De=await kj(fe,{configuration:f}),Re=us(De);if(se&&se!==Re){let gt=Ut(f,K.basename(X,".cjs"),Ct.NAME),j=Ut(f,f.values.get("rcFilename"),Ct.NAME),rt=Ut(f,`yarn plugin import ${fe}`,Ct.CODE);throw new nt(`Failed to fetch the ${gt} plugin from its remote location: its checksum seems to have changed. If this is expected, please remove the plugin from ${j} then run ${rt} to reimport it.`)}await le.mkdirPromise(K.dirname(X),{recursive:!0}),await le.writeFilePromise(X,De)}await pe(X,Be)}}for(let[ce,me]of Ae)f.activatePlugin(ce,me);if(f.useWithSource("",R(c),e,{strict:s}),E){let[ce,me]=E;f.useWithSource(ce,R(me),C,{strict:s})}return f.get("enableGlobalCache")&&(f.values.set("cacheFolder",`${f.get("globalFolder")}/cache`),f.sources.set("cacheFolder","")),f}static async findRcFiles(e){let r=Lj(),s=[],a=e,n=null;for(;a!==n;){n=a;let c=K.join(n,r);if(le.existsSync(c)){let f,p;try{p=await le.readFilePromise(c,"utf8"),f=ls(p)}catch{let h="";throw p?.match(/^\s+(?!-)[^:]+\s+\S+/m)&&(h=" (in particular, make sure you list the colons after each key name)"),new nt(`Parse error when loading ${c}; please check it's proper Yaml${h}`)}s.unshift({path:c,cwd:n,data:f})}a=K.dirname(n)}return s}static async findFolderRcFile(e){let r=K.join(e,Er.rc),s;try{s=await le.readFilePromise(r,"utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}let a=ls(s);return{path:r,cwd:e,data:a}}static async findProjectCwd(e){let r=null,s=e,a=null;for(;s!==a;){if(a=s,le.existsSync(K.join(a,Er.lockfile)))return a;le.existsSync(K.join(a,Er.manifest))&&(r=a),s=K.dirname(a)}return r}static async updateConfiguration(e,r,s={}){let a=Lj(),n=K.join(e,a),c=le.existsSync(n)?ls(await le.readFilePromise(n,"utf8")):{},f=!1,p;if(typeof r=="function"){try{p=r(c)}catch{p=r({})}if(p===c)return!1}else{p=c;for(let h of Object.keys(r)){let E=c[h],C=r[h],S;if(typeof C=="function")try{S=C(E)}catch{S=C(void 0)}else S=C;E!==S&&(S===t.deleteProperty?delete p[h]:p[h]=S,f=!0)}if(!f)return!1}return await le.changeFilePromise(n,il(p),{automaticNewlines:!0}),!0}static async addPlugin(e,r){r.length!==0&&await t.updateConfiguration(e,s=>{let a=s.plugins??[];if(a.length===0)return{...s,plugins:r};let n=[],c=[...r];for(let f of a){let p=typeof f!="string"?f.path:f,h=c.find(E=>E.path===p);h?(n.push(h),c=c.filter(E=>E!==h)):n.push(f)}return n.push(...c),{...s,plugins:n}})}static async updateHomeConfiguration(e){let r=AI();return await t.updateConfiguration(r,e)}activatePlugin(e,r){this.plugins.set(e,r),typeof r.configuration<"u"&&this.importSettings(r.configuration)}importSettings(e){for(let[r,s]of Object.entries(e))if(s!=null){if(this.settings.has(r))throw new Error(`Cannot redefine settings "${r}"`);this.settings.set(r,s),this.values.set(r,Uj(this,s))}}useWithSource(e,r,s,a){try{this.use(e,r,s,a)}catch(n){throw n.message+=` (in ${Ut(this,e,Ct.PATH)})`,n}}use(e,r,s,{strict:a=!0,overwrite:n=!1}={}){a=a&&this.get("enableStrictSettings");for(let c of["enableStrictSettings",...Object.keys(r)]){let f=r[c],p=fH(f);if(p&&(e=p),typeof f>"u"||c==="plugins"||e===""&&Amt.has(c))continue;if(c==="rcFilename")throw new nt(`The rcFilename settings can only be set via ${`${ET}RC_FILENAME`.toUpperCase()}, not via a rc file`);let h=this.settings.get(c);if(!h){let C=AI(),S=e[0]!=="<"?K.dirname(e):null;if(a&&!(S!==null?C===S:!1))throw new nt(`Unrecognized or legacy configuration settings found: ${c} - run "yarn config -v" to see the list of settings supported in Yarn`);this.invalid.set(c,e);continue}if(this.sources.has(c)&&!(n||h.type==="MAP"||h.isArray&&h.concatenateValues))continue;let E;try{E=_j(this,c,f,h,s)}catch(C){throw C.message+=` in ${Ut(this,e,Ct.PATH)}`,C}if(c==="enableStrictSettings"&&e!==""){a=E;continue}if(h.type==="MAP"){let C=this.values.get(c);this.values.set(c,new Map(n?[...C,...E]:[...E,...C])),this.sources.set(c,`${this.sources.get(c)}, ${e}`)}else if(h.isArray&&h.concatenateValues){let C=this.values.get(c);this.values.set(c,n?[...C,...E]:[...E,...C]),this.sources.set(c,`${this.sources.get(c)}, ${e}`)}else this.values.set(c,E),this.sources.set(c,e)}}get(e){if(!this.values.has(e))throw new Error(`Invalid configuration key "${e}"`);return this.values.get(e)}getSpecial(e,{hideSecrets:r=!1,getNativePaths:s=!1}){let a=this.get(e),n=this.settings.get(e);if(typeof n>"u")throw new nt(`Couldn't find a configuration settings named "${e}"`);return yT(a,n,{hideSecrets:r,getNativePaths:s})}getSubprocessStreams(e,{header:r,prefix:s,report:a}){let n,c,f=le.createWriteStream(e);if(this.get("enableInlineBuilds")){let p=a.createStreamReporter(`${s} ${Ut(this,"STDOUT","green")}`),h=a.createStreamReporter(`${s} ${Ut(this,"STDERR","red")}`);n=new Oj.PassThrough,n.pipe(p),n.pipe(f),c=new Oj.PassThrough,c.pipe(h),c.pipe(f)}else n=f,c=f,typeof r<"u"&&n.write(`${r} +`);return{stdout:n,stderr:c}}makeResolver(){let e=[];for(let r of this.plugins.values())for(let s of r.resolvers||[])e.push(new s);return new rm([new FQ,new yi,...e])}makeFetcher(){let e=[];for(let r of this.plugins.values())for(let s of r.fetchers||[])e.push(new s);return new lI([new cI,new uI,...e])}getLinkers(){let e=[];for(let r of this.plugins.values())for(let s of r.linkers||[])e.push(new s);return e}getSupportedArchitectures(){let e=yv(),r=this.get("supportedArchitectures"),s=r.get("os");s!==null&&(s=s.map(c=>c==="current"?e.os:c));let a=r.get("cpu");a!==null&&(a=a.map(c=>c==="current"?e.cpu:c));let n=r.get("libc");return n!==null&&(n=Yl(n,c=>c==="current"?e.libc??Yl.skip:c)),{os:s,cpu:a,libc:n}}isInteractive({interactive:e,stdout:r}){return r.isTTY?e??this.get("preferInteractive"):!1}async getPackageExtensions(){if(this.packageExtensions!==null)return this.packageExtensions;this.packageExtensions=new Map;let e=this.packageExtensions,r=(s,a,{userProvided:n=!1}={})=>{if(!ul(s.range))throw new Error("Only semver ranges are allowed as keys for the packageExtensions setting");let c=new Ht;c.load(a,{yamlCompatibilityMode:!0});let f=jB(e,s.identHash),p=[];f.push([s.range,p]);let h={status:"inactive",userProvided:n,parentDescriptor:s};for(let E of c.dependencies.values())p.push({...h,type:"Dependency",descriptor:E});for(let E of c.peerDependencies.values())p.push({...h,type:"PeerDependency",descriptor:E});for(let[E,C]of c.peerDependenciesMeta)for(let[S,P]of Object.entries(C))p.push({...h,type:"PeerDependencyMeta",selector:E,key:S,value:P})};await this.triggerHook(s=>s.registerPackageExtensions,this,r);for(let[s,a]of this.get("packageExtensions"))r(C0(s,!0),Kk(a),{userProvided:!0});return e}normalizeLocator(e){return ul(e.reference)?Ys(e,`${this.get("defaultProtocol")}${e.reference}`):Hp.test(e.reference)?Ys(e,`${this.get("defaultProtocol")}${e.reference}`):e}normalizeDependency(e){return ul(e.range)?On(e,`${this.get("defaultProtocol")}${e.range}`):Hp.test(e.range)?On(e,`${this.get("defaultProtocol")}${e.range}`):e}normalizeDependencyMap(e){return new Map([...e].map(([r,s])=>[r,this.normalizeDependency(s)]))}normalizePackage(e,{packageExtensions:r}){let s=zB(e),a=r.get(e.identHash);if(typeof a<"u"){let c=e.version;if(c!==null){for(let[f,p]of a)if(eA(c,f))for(let h of p)switch(h.status==="inactive"&&(h.status="redundant"),h.type){case"Dependency":typeof s.dependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",s.dependencies.set(h.descriptor.identHash,this.normalizeDependency(h.descriptor)));break;case"PeerDependency":typeof s.peerDependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",s.peerDependencies.set(h.descriptor.identHash,h.descriptor));break;case"PeerDependencyMeta":{let E=s.peerDependenciesMeta.get(h.selector);(typeof E>"u"||!Object.hasOwn(E,h.key)||E[h.key]!==h.value)&&(h.status="active",Vl(s.peerDependenciesMeta,h.selector,()=>({}))[h.key]=h.value)}break;default:f3(h)}}}let n=c=>c.scope?`${c.scope}__${c.name}`:`${c.name}`;for(let c of s.peerDependenciesMeta.keys()){let f=Da(c);s.peerDependencies.has(f.identHash)||s.peerDependencies.set(f.identHash,On(f,"*"))}for(let c of s.peerDependencies.values()){if(c.scope==="types")continue;let f=n(c),p=ba("types",f),h=cn(p);s.peerDependencies.has(p.identHash)||s.peerDependenciesMeta.has(h)||(s.peerDependencies.set(p.identHash,On(p,"*")),s.peerDependenciesMeta.set(h,{optional:!0}))}return s.dependencies=new Map(Ws(s.dependencies,([,c])=>ll(c))),s.peerDependencies=new Map(Ws(s.peerDependencies,([,c])=>ll(c))),s}getLimit(e){return Vl(this.limits,e,()=>(0,Ode.default)(this.get(e)))}async triggerHook(e,...r){for(let s of this.plugins.values()){let a=s.hooks;if(!a)continue;let n=e(a);n&&await n(...r)}}async triggerMultipleHooks(e,r){for(let s of r)await this.triggerHook(e,...s)}async reduceHook(e,r,...s){let a=r;for(let n of this.plugins.values()){let c=n.hooks;if(!c)continue;let f=e(c);f&&(a=await f(a,...s))}return a}async firstHook(e,...r){for(let s of this.plugins.values()){let a=s.hooks;if(!a)continue;let n=e(a);if(!n)continue;let c=await n(...r);if(typeof c<"u")return c}return null}}});var Gr={};Vt(Gr,{EndStrategy:()=>Gj,ExecError:()=>CT,PipeError:()=>wv,execvp:()=>Fj,pipevp:()=>Yu});function om(t){return t!==null&&typeof t.fd=="number"}function Hj(){}function jj(){for(let t of am)t.kill()}async function Yu(t,e,{cwd:r,env:s=process.env,strict:a=!1,stdin:n=null,stdout:c,stderr:f,end:p=2}){let h=["pipe","pipe","pipe"];n===null?h[0]="ignore":om(n)&&(h[0]=n),om(c)&&(h[1]=c),om(f)&&(h[2]=f);let E=(0,qj.default)(t,e,{cwd:ue.fromPortablePath(r),env:{...s,PWD:ue.fromPortablePath(r)},stdio:h});am.add(E),am.size===1&&(process.on("SIGINT",Hj),process.on("SIGTERM",jj)),!om(n)&&n!==null&&n.pipe(E.stdin),om(c)||E.stdout.pipe(c,{end:!1}),om(f)||E.stderr.pipe(f,{end:!1});let C=()=>{for(let S of new Set([c,f]))om(S)||S.end()};return new Promise((S,P)=>{E.on("error",I=>{am.delete(E),am.size===0&&(process.off("SIGINT",Hj),process.off("SIGTERM",jj)),(p===2||p===1)&&C(),P(I)}),E.on("close",(I,R)=>{am.delete(E),am.size===0&&(process.off("SIGINT",Hj),process.off("SIGTERM",jj)),(p===2||p===1&&I!==0)&&C(),I===0||!a?S({code:Wj(I,R)}):P(new wv({fileName:t,code:I,signal:R}))})})}async function Fj(t,e,{cwd:r,env:s=process.env,encoding:a="utf8",strict:n=!1}){let c=["ignore","pipe","pipe"],f=[],p=[],h=ue.fromPortablePath(r);typeof s.PWD<"u"&&(s={...s,PWD:h});let E=(0,qj.default)(t,e,{cwd:h,env:s,stdio:c});return E.stdout.on("data",C=>{f.push(C)}),E.stderr.on("data",C=>{p.push(C)}),await new Promise((C,S)=>{E.on("error",P=>{let I=ze.create(r),R=Ut(I,t,Ct.PATH);S(new Yt(1,`Process ${R} failed to spawn`,N=>{N.reportError(1,` ${Zf(I,{label:"Thrown Error",value:Hu(Ct.NO_HINT,P.message)})}`)}))}),E.on("close",(P,I)=>{let R=a==="buffer"?Buffer.concat(f):Buffer.concat(f).toString(a),N=a==="buffer"?Buffer.concat(p):Buffer.concat(p).toString(a);P===0||!n?C({code:Wj(P,I),stdout:R,stderr:N}):S(new CT({fileName:t,code:P,signal:I,stdout:R,stderr:N}))})})}function Wj(t,e){let r=Cmt.get(e);return typeof r<"u"?128+r:t??1}function wmt(t,e,{configuration:r,report:s}){s.reportError(1,` ${Zf(r,t!==null?{label:"Exit Code",value:Hu(Ct.NUMBER,t)}:{label:"Exit Signal",value:Hu(Ct.CODE,e)})}`)}var qj,Gj,wv,CT,am,Cmt,dT=It(()=>{bt();qj=et(J_());Cv();Fc();Qc();Gj=(s=>(s[s.Never=0]="Never",s[s.ErrorCode=1]="ErrorCode",s[s.Always=2]="Always",s))(Gj||{}),wv=class extends Yt{constructor({fileName:e,code:r,signal:s}){let a=ze.create(K.cwd()),n=Ut(a,e,Ct.PATH);super(1,`Child ${n} reported an error`,c=>{wmt(r,s,{configuration:a,report:c})}),this.code=Wj(r,s)}},CT=class extends wv{constructor({fileName:e,code:r,signal:s,stdout:a,stderr:n}){super({fileName:e,code:r,signal:s}),this.stdout=a,this.stderr=n}};am=new Set;Cmt=new Map([["SIGINT",2],["SIGQUIT",3],["SIGKILL",9],["SIGTERM",15]])});function _de(t){Mde=t}function Bv(){return typeof Yj>"u"&&(Yj=Mde()),Yj}var Yj,Mde,Vj=It(()=>{Mde=()=>{throw new Error("Assertion failed: No libzip instance is available, and no factory was configured")}});var Ude=L((wT,Jj)=>{var Bmt=Object.assign({},ye("fs")),Kj=function(){var t=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(t=t||__filename),function(e){e=e||{};var r=typeof e<"u"?e:{},s,a;r.ready=new Promise(function(Je,st){s=Je,a=st});var n={},c;for(c in r)r.hasOwnProperty(c)&&(n[c]=r[c]);var f=[],p="./this.program",h=function(Je,st){throw st},E=!1,C=!0,S="";function P(Je){return r.locateFile?r.locateFile(Je,S):S+Je}var I,R,N,U;C&&(E?S=ye("path").dirname(S)+"/":S=__dirname+"/",I=function(st,St){var lr=Me(st);return lr?St?lr:lr.toString():(N||(N=Bmt),U||(U=ye("path")),st=U.normalize(st),N.readFileSync(st,St?null:"utf8"))},R=function(st){var St=I(st,!0);return St.buffer||(St=new Uint8Array(St)),we(St.buffer),St},process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),f=process.argv.slice(2),h=function(Je){process.exit(Je)},r.inspect=function(){return"[Emscripten Module object]"});var W=r.print||console.log.bind(console),te=r.printErr||console.warn.bind(console);for(c in n)n.hasOwnProperty(c)&&(r[c]=n[c]);n=null,r.arguments&&(f=r.arguments),r.thisProgram&&(p=r.thisProgram),r.quit&&(h=r.quit);var ie=0,Ae=function(Je){ie=Je},ce;r.wasmBinary&&(ce=r.wasmBinary);var me=r.noExitRuntime||!0;typeof WebAssembly!="object"&&rs("no native wasm support detected");function pe(Je,st,St){switch(st=st||"i8",st.charAt(st.length-1)==="*"&&(st="i32"),st){case"i1":return Ye[Je>>0];case"i8":return Ye[Je>>0];case"i16":return Ih((Je>>1)*2);case"i32":return ro((Je>>2)*4);case"i64":return ro((Je>>2)*4);case"float":return pf((Je>>2)*4);case"double":return Eh((Je>>3)*8);default:rs("invalid type for getValue: "+st)}return null}var Be,Ce=!1,g;function we(Je,st){Je||rs("Assertion failed: "+st)}function Ee(Je){var st=r["_"+Je];return we(st,"Cannot call unknown function "+Je+", make sure it is exported"),st}function fe(Je,st,St,lr,ee){var Ie={string:function(qi){var Tn=0;if(qi!=null&&qi!==0){var Ga=(qi.length<<2)+1;Tn=wi(Ga),gt(qi,Tn,Ga)}return Tn},array:function(qi){var Tn=wi(qi.length);return Fe(qi,Tn),Tn}};function Oe(qi){return st==="string"?De(qi):st==="boolean"?!!qi:qi}var ht=Ee(Je),mt=[],Dt=0;if(lr)for(var tr=0;tr=St)&&ke[lr];)++lr;return X.decode(ke.subarray(Je,lr))}function Re(Je,st,St,lr){if(!(lr>0))return 0;for(var ee=St,Ie=St+lr-1,Oe=0;Oe=55296&&ht<=57343){var mt=Je.charCodeAt(++Oe);ht=65536+((ht&1023)<<10)|mt&1023}if(ht<=127){if(St>=Ie)break;st[St++]=ht}else if(ht<=2047){if(St+1>=Ie)break;st[St++]=192|ht>>6,st[St++]=128|ht&63}else if(ht<=65535){if(St+2>=Ie)break;st[St++]=224|ht>>12,st[St++]=128|ht>>6&63,st[St++]=128|ht&63}else{if(St+3>=Ie)break;st[St++]=240|ht>>18,st[St++]=128|ht>>12&63,st[St++]=128|ht>>6&63,st[St++]=128|ht&63}}return st[St]=0,St-ee}function gt(Je,st,St){return Re(Je,ke,st,St)}function j(Je){for(var st=0,St=0;St=55296&&lr<=57343&&(lr=65536+((lr&1023)<<10)|Je.charCodeAt(++St)&1023),lr<=127?++st:lr<=2047?st+=2:lr<=65535?st+=3:st+=4}return st}function rt(Je){var st=j(Je)+1,St=Ma(st);return St&&Re(Je,Ye,St,st),St}function Fe(Je,st){Ye.set(Je,st)}function Ne(Je,st){return Je%st>0&&(Je+=st-Je%st),Je}var Pe,Ye,ke,it,_e,x,w,b,y,F;function z(Je){Pe=Je,r.HEAP_DATA_VIEW=F=new DataView(Je),r.HEAP8=Ye=new Int8Array(Je),r.HEAP16=it=new Int16Array(Je),r.HEAP32=x=new Int32Array(Je),r.HEAPU8=ke=new Uint8Array(Je),r.HEAPU16=_e=new Uint16Array(Je),r.HEAPU32=w=new Uint32Array(Je),r.HEAPF32=b=new Float32Array(Je),r.HEAPF64=y=new Float64Array(Je)}var Z=r.INITIAL_MEMORY||16777216,$,oe=[],xe=[],Te=[],lt=!1;function Et(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Pt(r.preRun.shift());Rs(oe)}function qt(){lt=!0,Rs(xe)}function ir(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Pr(r.postRun.shift());Rs(Te)}function Pt(Je){oe.unshift(Je)}function gn(Je){xe.unshift(Je)}function Pr(Je){Te.unshift(Je)}var Ir=0,Nr=null,nn=null;function oi(Je){Ir++,r.monitorRunDependencies&&r.monitorRunDependencies(Ir)}function wo(Je){if(Ir--,r.monitorRunDependencies&&r.monitorRunDependencies(Ir),Ir==0&&(Nr!==null&&(clearInterval(Nr),Nr=null),nn)){var st=nn;nn=null,st()}}r.preloadedImages={},r.preloadedAudios={};function rs(Je){r.onAbort&&r.onAbort(Je),Je+="",te(Je),Ce=!0,g=1,Je="abort("+Je+"). Build with -s ASSERTIONS=1 for more info.";var st=new WebAssembly.RuntimeError(Je);throw a(st),st}var eo="data:application/octet-stream;base64,";function Bo(Je){return Je.startsWith(eo)}var Hi="data:application/octet-stream;base64,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QCAAKAJIIgEgASADaiADEAcaAkAgAyAAKAJsIgFNBEAgACABIANrNgJsDAELIABCADcCbAsgACAAKAJoIANrIgE2AmggACAAKAJYIANrNgJYIAEgACgChC5JBEAgACABNgKELgsgAEH8gAEoAgARAwAgAiADaiECCwJAIAAoAgAiASgCBCIERQ0AIAAoAjwhBSAAIAIgBCACIARJGyICBH8gACgCSCAAKAJoaiAFaiEFIAEgBCACazYCBAJAAkACQAJAIAEoAhwiBCgCFEEBaw4CAQACCyAEQaABaiAFIAEoAgAgAkHcgAEoAgARCAAMAgsgASABKAIwIAUgASgCACACQcSAASgCABEEADYCMAwBCyAFIAEoAgAgAhAHGgsgASABKAIAIAJqNgIAIAEgASgCCCACajYCCCAAKAI8BSAFCyACaiICNgI8AkAgACgChC4iASACakEDSQ0AIAAoAmggAWshAQJAIAAoAnRBgQhPBEAgACAAIAAoAkggAWoiAi0AACACLQABIAAoAnwRAAA2AlQMAQsgAUUNACAAIAFBAWsgACgChAERAgAaCyAAKAKELiAAKAI8IgJBAUZrIgRFDQAgACABIAQgACgCgAERBQAgACAAKAKELiAEazYChC4gACgCPCECCyACQYUCSw0AIAAoAgAoAgRFDQAgACgCMCEBDAELCwJAIAAoAkQiAiAAKAJAIgNNDQAgAAJ/IAAoAjwgACgCaGoiASADSwRAIAAoAkggAWpBACACIAFrIgNBggIgA0GCAkkbIgMQGSABIANqDAELIAFBggJqIgEgA00NASAAKAJIIANqQQAgAiADayICIAEgA2siAyACIANJGyIDEBkgACgCQCADags2AkALC50CAQF/AkAgAAJ/IAAoAqAuIgFBwABGBEAgACgCBCAAKAIQaiAAKQOYLjcAACAAQgA3A5guIAAgACgCEEEIajYCEEEADAELIAFBIE4EQCAAKAIEIAAoAhBqIAApA5guPgAAIAAgAEGcLmo1AgA3A5guIAAgACgCEEEEajYCECAAIAAoAqAuQSBrIgE2AqAuCyABQRBOBEAgACgCBCAAKAIQaiAAKQOYLj0AACAAIAAoAhBBAmo2AhAgACAAKQOYLkIQiDcDmC4gACAAKAKgLkEQayIBNgKgLgsgAUEISA0BIAAgACgCECIBQQFqNgIQ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KAJUIgEEfyABQQAgARAiEBkgACgCVAVBAAsQBiAAQQA2AlQLC9wMAgl/AX4jAEFAaiIGJAACQAJAAkACQAJAIAEoAjBBABAjIgVBAkZBACABKAI4QQAQIyIEQQFGGw0AIAVBAUZBACAEQQJGGw0AIAVBAkciAw0BIARBAkcNAQsgASABLwEMQYAQcjsBDEEAIQMMAQsgASABLwEMQf/vA3E7AQxBACEFIANFBEBB9eABIAEoAjAgAEEIahBpIgVFDQILIAJBgAJxBEAgBSEDDAELIARBAkcEQCAFIQMMAQtB9cYBIAEoAjggAEEIahBpIgNFBEAgBRAcDAILIAMgBTYCAAsgASABLwEMQf7/A3EgAS8BUiIFQQBHcjsBDAJAAkACQAJAAn8CQAJAIAEpAyhC/v///w9WDQAgASkDIEL+////D1YNACACQYAEcUUNASABKQNIQv////8PVA0BCyAFQYECa0H//wNxQQNJIQdBAQwBCyAFQYECa0H//wNxIQQgAkGACnFBgApHDQEgBEEDSSEHQQALIQkgBkIcEBciBEUEQCAAQQhqIgAEQCAAQQA2AgQgAEEONgIACyADEBwMBQsgAkGACHEhBQJAAkAgAkGAAnEEQAJAIAUNACABKQMgQv////8PVg0AIAEpAyhCgICAgBBUDQMLIAQgASkDKBAYIAEpAyAhDAwBCwJAAkACQCAFDQAgASkDIEL/////D1YNACABKQMoIgxC/////w9WDQEgASkDSEKAgICAEFQNBAsgASkDKCIMQv////8PVA0BCyAEIAwQGAsgASkDICIMQv////8PWgRAIAQgDBAYCyABKQNIIgxC/////w9UDQELIAQgDBAYCyAELQAARQRAIABBCGoiAARAIABBADYCBCAAQRQ2AgALIAQQCCADEBwMBQtBASEKQQEgBC0AAAR+IAQpAxAFQgALp0H//wNxIAYQRyEFIAQQCCAFIAM2AgAgBw0BDAILIAMhBSAEQQJLDQELIAZCBxAXIgRFBEAgAEEIaiIABEAgAEEANgIEIABBDjYCAAsgBRAcDAMLIARBAhANIARBhxJBAhAsIAQgAS0AUhBwIAQgAS8BEBANIAQtAABFBEAgAEEIaiIABEAgAEEANgIEIABBFDYCAAsgBBAIDAILQYGyAkEHIAYQRyEDIAQQCCADIAU2AgBBASEL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NgIEIABB7A42AhggGiEdDAMLIARB/wFxIgJBwABxRQRAIAggDSADLwECQQJ0aiAdp0F/IAJ0QX9zcUECdGoiAy0AASICayEIIB0gAq2IIR0gAy0AACIERQ0HDAELCyAEQSBxBEAgB0G//gA2AgQgASECDAgLIAdB0f4ANgIEIABB0A42AhggASECDAcLIB1BfyAGdEF/c62DIBt8IhunIQUgCCAEQQ9xIgNrIQggGiAErUIPg4ghHSABIBdrIgYgAjMBAiAaQX8gA3RBf3Otg3ynIgRPDQIgBCAGayIGIBlNDQEgBygCjEdFDQEgB0HR/gA2AgQgAEG5DDYCGAsgASECIAshBQwFCwJAIA5FBEAgDCARIAZraiEDDAELIAYgDk0EQCAMIA4gBmtqIQMMAQsgDCARIAYgDmsiBmtqIQMgBSAGTQ0AIAUgBmshBQJAAkAgASADTSABIA8gAWusIhogBq0iGyAaIBtUGyIapyIGaiICIANLcQ0AIAMgBmogAUsgASADT3ENACABIAMgBhAHGiACIQEMAQsgASADIAMgAWsiASABQR91IgFqIAFzIgIQByACaiEBIBogAq0iHn0iHFANACACIANqIQIDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgASACKQAANwAAIAEgAikAGDcAGCABIAIpABA3ABAgASACKQAINwAIIBpCIH0hGiACQSBqIQIgAUEgaiEBIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAEgAikAADcAACABIAIpABg3ABggASACKQAQNwAQIAEgAikACDcACCABIAIpADg3ADggASACKQAwNwAwIAEgAikAKDcAKCABIAIpACA3ACAgASACKQBYNwBYIAEgAikAUDcAUCABIAIpAEg3AEggASACKQBANwBAIAEgAikAYDcAYCABIAIpAGg3AGggASACKQBwNwBwIAEgAikAeDcAeCACQYABaiECIAFBgAFqIQEgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAEgAikAADcAACABIAIpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCABIAIpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCABIAIoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCABIAIvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCABIAItAAA6AAAgAkEBaiECIAFBAWohAQsgHEIAUg0ACwsgDiEGIAwhAwsgBSAGSwRAAkACQCABIANNIAEgDyABa6wiGiAGrSIbIBogG1QbIhqnIglqIgIgA0txDQAgAyAJaiABSyABIANPcQ0AIAEgAyAJEAcaDAELIAEgAyADIAFrIgEgAUEfdSIBaiABcyIBEAcgAWohAiAaIAGtIh59IhxQDQAgASADaiEBA0ACQCAcIB4gHCAeVBsiG0IgVARAIBshGgwBCyAbIhpCIH0iIEIFiEIBfEIDgyIfUEUEQANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCAaQiB9IRogAUEgaiEBIAJBIGohAiAfQgF9Ih9CAFINAAsLICBC4ABUDQADQCACIAEpAAA3AAAgAiABKQAYNwAYIAIgASkAEDcAECACIAEpAAg3AAggAiABKQA4NwA4IAIgASkAMDcAMCACIAEpACg3ACggAiABKQAgNwAgIAIgASkAWDcAWCACIAEpAFA3AFAgAiABKQBINwBIIAIgASkAQDcAQCACIAEpAGA3AGAgAiABKQBoNwBoIAIgASkAcDcAcCACIAEpAHg3AHggAUGAAWohASACQYABaiECIBpCgAF9IhpCH1YNAAsLIBpCEFoEQCACIAEpAAA3AAAgAiABKQAINwAIIBpCEH0hGiACQRBqIQIgAUEQaiEBCyAaQghaBEAgAiABKQAANwAAIBpCCH0hGiACQQhqIQIgAUEIaiEBCyAaQgRaBEAgAiABKAAANgAAIBpCBH0hGiACQQRqIQIgAUEEaiEBCyAaQgJaBEAgAiABLwAAOwAAIBpCAn0hGiACQQJqIQIgAUECaiEBCyAcIBt9IRwgGlBFBEAgAiABLQAAOgAAIAJBAWohAiABQQFqIQELIBxCAFINAAsLIAUgBmshAUEAIARrIQUCQCAEQQdLBEAgBCEDDAELIAEgBE0EQCAEIQMMAQsgAiAEayEFA0ACQCACIAUpAAA3AAAgBEEBdCEDIAEgBGshASACIARqIQIgBEEDSw0AIAMhBCABIANLDQELC0EAIANrIQULIAIgBWohBAJAIAUgDyACa6wiGiABrSIbIBogG1QbIhqnIgFIIAVBf0pxDQAgBUEBSCABIARqIAJLcQ0AIAIgBCABEAcgAWohAgwDCyACIAQgAyADQR91IgFqIAFzIgEQByABaiECIBogAa0iHn0iHFANAiABIARqIQEDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIBpCIH0hGiABQSBqIQEgAkEgaiECIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCACIAEpADg3ADggAiABKQAwNwAwIAIgASkAKDcAKCACIAEpACA3ACAgAiABKQBYNwBYIAIgASkAUDcAUCACIAEpAEg3AEggAiABKQBANwBAIAIgASkAYDcAYCACIAEpAGg3AGggAiABKQBwNwBwIAIgASkAeDcAeCABQYABaiEBIAJBgAFqIQIgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAIgASkAADcAACACIAEpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCACIAEpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCACIAEoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCACIAEvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCACIAEtAAA6AAAgAkEBaiECIAFBAWohAQsgHFBFDQALDAILAkAgASADTSABIA8gAWusIhogBa0iGyAaIBtUGyIapyIEaiICIANLcQ0AIAMgBGogAUsgASADT3ENACABIAMgBBAHGgwCCyABIAMgAyABayIBIAFBH3UiAWogAXMiARAHIAFqIQIgGiABrSIefSIcUA0BIAEgA2ohAQNAAkAgHCAeIBwgHlQbIhtCIFQEQCAbIRoMAQsgGyIaQiB9IiBCBYhCAXxCA4MiH1BFBEADQCACIAEpAAA3AAAgAiABKQAYNwAYIAIgASkAEDcAECACIAEpAAg3AAggGkIgfSEaIAFBIGohASACQSBqIQIgH0IBfSIfQgBSDQALCyAgQuAAVA0AA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIAIgASkAODcAOCACIAEpADA3ADAgAiABKQAoNwAoIAIgASkAIDcAICACIAEpAFg3AFggAiABKQBQNwBQIAIgASkASDcASCACIAEpAEA3AEAgAiABKQBgNwBgIAIgASkAaDcAaCACIAEpAHA3AHAgAiABKQB4NwB4IAFBgAFqIQEgAkGAAWohAiAaQoABfSIaQh9WDQALCyAaQhBaBEAgAiABKQAANwAAIAIgASkACDcACCAaQhB9IRogAkEQaiECIAFBEGohAQsgGkIIWgRAIAIgASkAADcAACAaQgh9IRogAkEIaiECIAFBCGohAQsgGkIEWgRAIAIgASgAADYAACAaQgR9IRogAkEEaiECIAFBBGohAQsgGkICWgRAIAIgAS8AADsAACAaQgJ9IRogAkECaiECIAFBAmohAQsgHCAbfSEcIBpQRQRAIAIgAS0AADoAACACQQFqIQIgAUEBaiEBCyAcUEUNAAsMAQsCQAJAIBYEQAJAIAQgBUkEQCAHKAKYRyAESw0BCyABIARrIQMCQEEAIARrIgVBf0ogDyABa6wiGiAbIBogG1QbIhqnIgIgBUpxDQAgBUEBSCACIANqIAFLcQ0AIAEgAyACEAcgAmohAgwFCyABIAMgBCAEQR91IgFqIAFzIgEQByABaiECIBogAa0iHn0iHFANBCABIANqIQEDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIBpCIH0hGiABQSBqIQEgAkEgaiECIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCACIAEpADg3ADggAiABKQAwNwAwIAIgASkAKDcAKCACIAEpACA3ACAgAiABKQBYNwBYIAIgASkAUDcAUCACIAEpAEg3AEggAiABKQBANwBAIAIgASkAYDcAYCACIAEpAGg3AGggAiABKQBwNwBwIAIgASkAeDcAeCABQYABaiEBIAJBgAFqIQIgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAIgASkAADcAACACIAEpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCACIAEpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCACIAEoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCACIAEvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCACIAEtAAA6AAAgAkEBaiECIAFBAWohAQsgHFBFDQALDAQLIBAgAWsiCUEBaiIGIAUgBSAGSxshAyABIARrIQIgAUEHcUUNAiADRQ0CIAEgAi0AADoAACACQQFqIQIgAUEBaiIGQQdxQQAgA0EBayIFGw0BIAYhASAFIQMgCSEGDAILAkAgBCAFSQRAIAcoAphHIARLDQELIAEgASAEayIGKQAANwAAIAEgBUEBa0EHcUEBaiIDaiECIAUgA2siBEUNAyADIAZqIQEDQCACIAEpAAA3AAAgAUEIaiEBIAJBCGohAiAEQQhrIgQNAAsMAwsgASAEIAUQPyECDAILIAEgAi0AADoAASAJQQFrIQYgA0ECayEFIAJBAWohAgJAIAFBAmoiCkEHcUUNACAFRQ0AIAEgAi0AADoAAiAJQQJrIQYgA0EDayEFIAJBAWohAgJAIAFBA2oiCkEHcUUNACAFRQ0AIAEgAi0AADoAAyAJQQNrIQYgA0EEayEFIAJBAWohAgJAIAFBBGoiCkEHcUUNACAFRQ0AIAEgAi0AADoABCAJQQRrIQYgA0EFayEFIAJBAWohAgJAIAFBBWoiCkEHcUUNACAFRQ0AIAEgAi0AADoABSAJQQVrIQYgA0EGayEFIAJBAWohAgJAIAFBBmoiCkEHcUUNACAFRQ0AIAEgAi0AADoABiAJQQZrIQYgA0EHayEFIAJBAWohAgJAIAFBB2oiCkEHcUUNACAFRQ0AIAEgAi0AADoAByAJQQdrIQYgA0EIayEDIAFBCGohASACQQFqIQIMBgsgCiEBIAUhAwwFCyAKIQEgBSEDDAQLIAohASAFIQMMAwsgCiEBIAUhAwwCCyAKIQEgBSEDDAELIAohASAFIQMLAkACQCAGQRdNBEAgA0UNASADQQFrIQUgA0EHcSIEBEADQCABIAItAAA6AAAgA0EBayEDIAFBAWohASACQQFqIQIgBEEBayIEDQALCyAFQQdJDQEDQCABIAItAAA6AAAgASACLQABOgABIAEgAi0AAjoAAiABIAItAAM6AAMgASACLQAEOgAEIAEgAi0ABToABSABIAItAAY6AAYgASACLQAHOgAHIAFBCGohASACQQhqIQIgA0EIayIDDQALDAELIAMNAQsgASECDAELIAEgBCADED8hAgsgCyEFDAELIAEgAy0AAjoAACABQQFqIQILIAUgFE8NACACIBNJDQELCyAAIAI2AgwgACAFIAhBA3ZrIgE2AgAgACATIAJrQYMCajYCECAAIBQgAWtBDmo2AgQgByAIQQdxIgA2AogBIAcgHUJ/IACthkJ/hYM+AoQBC+cFAQR/IAMgAiACIANLGyEEIAAgAWshAgJAIABBB3FFDQAgBEUNACAAIAItAAA6AAAgA0EBayEGIAJBAWohAiAAQQFqIgdBB3FBACAEQQFrIgUbRQRAIAchACAFIQQgBiEDDAELIAAgAi0AADoAASADQQJrIQYgBEECayEFIAJBAWohAgJAIABBAmoiB0EHcUUNACAFRQ0AIAAgAi0AADoAAiADQQNrIQYgBEEDayEFIAJBAWohAgJAIABBA2oiB0EHcUUNACAFRQ0AIAAgAi0AADoAAyADQQRrIQYgBEEEayEFIAJBAWohAgJAIABBBGoiB0EHcUUNACAFRQ0AIAAgAi0AADoABCADQQVrIQYgBEEFayEFIAJBAWohAgJAIABBBWoiB0EHcUUNACAFRQ0AIAAgAi0AADoABSADQQZrIQYgBEEGayEFIAJBAWohAgJAIABBBmoiB0EHcUUNACAFRQ0AIAAgAi0AADoABiADQQdrIQYgBEEHayEFIAJBAWohAgJAIABBB2oiB0EHcUUNACAFRQ0AIAAgAi0AADoAByADQQhrIQMgBEEIayEEIABBCGohACACQQFqIQIMBgsgByEAIAUhBCAGIQMMBQsgByEAIAUhBCAGIQMMBAsgByEAIAUhBCAGIQMMAwsgByEAIAUhBCAGIQMMAgsgByEAIAUhBCAGIQMMAQsgByEAIAUhBCAGIQMLAkAgA0EXTQRAIARFDQEgBEEBayEBIARBB3EiAwRAA0AgACACLQAAOgAAIARBAWshBCAAQQFqIQAgAkEBaiECIANBAWsi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CyAAIAMtAAAEfiADKQMQBUIAC6dB//8DcSADKAIEEEcLIQUgAxAICyAEQRBqJAAgBQvgAQICfwF+QTAQCSICRQRAIAEEQCABQQA2AgQgAUEONgIAC0EADwsgAkIANwMIIAJBADYCACACQgA3AxAgAkIANwMYIAJCADcDICACQgA3ACUgAFAEQCACDwsCQCAAQv////8AVg0AIACnQQR0EAkiA0UNACACIAM2AgBBACEBQgEhBANAIAMgAUEEdGoiAUIANwIAIAFCADcABSAAIARSBEAgBKchASAEQgF8IQQMAQsLIAIgADcDCCACIAA3AxAgAg8LIAEEQCABQQA2AgQgAUEONgIAC0EAEBAgAhAGQQAL7gECA38BfiMAQRBrIgQkAAJAIARBDGpCBBAXIgNFBEBBfyECDAELAkAgAQRAIAJBgAZxIQUDQAJAIAUgASgCBHFFDQACQCADKQMIQgBUBEAgA0EAOgAADAELIANCADcDECADQQE6AAALIAMgAS8BCBANIAMgAS8BChANIAMtAABFBEAgAEEIaiIABEAgAEEANgIEIABBFDYCAAtBfyECDAQLQX8hAiAAIARBDGpCBBAbQQBIDQMgATMBCiIGUA0AIAAgASgCDCAGEBtBAEgNAwsgASgCACIBDQALC0EAIQILIAMQCAsgBEEQaiQAIAILPAEBfyAABEAgAUGABnEhAQNAIAEgACgCBHEEQCACIAAvAQpqQQRqIQILIAAoAgAiAA0ACwsgAkH//wNxC5wBAQN/IABFBEBBAA8LIAAhAwNAAn8CQAJAIAAvAQgiAUH04AFNBEAgAUEBRg0BIAFB9cYBRg0BDAILIAFBgbICRg0AIAFB9eABRw0BCyAAKAIAIQEgAEEANgIAIAAoAgwQBiAAEAYgASADIAAgA0YbIQMCQCACRQRAQQAhAgwBCyACIAE2AgALIAEMAQsgACICKAIACyIADQALIAMLsgQCBX8BfgJAAkACQCAAIAGtEBciAQRAIAEtAAANAUEAIQAMAgsgBARAIARBADYCBCAEQQ42AgALQQAPC0EAIQADQCABLQAABH4gASkDCCABKQMQfQVCAAtCBFQNASABEAwhByABIAEQDCIGrRATIghFBEBBACECIAQEQCAEQQA2AgQgBEEVNgIACyABEAggAEUNAwNAIAAoAgAhASAAKAIMEAYg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DCAAQRg2AggLDAMLIAAgBiAFLwFqQQAgBCABEQYAIQEgBhALIAFFDQILAkAgDUUEQCABIQMMAQsgACABIAUvAWgQgQEhAyABEAsgA0UNAQsCQCAJRSAMckUEQCADIQEMAQsgACADQQEQgAEhASADEAsgAUUNAQsgASEDDAELQQAhAwsgBUHwAGokACADC4UBAQF/IAFFBEAgAEEIaiIABEAgAEEANgIEIABBEjYCAAtBAA8LQTgQCSIDRQRAIABBCGoiAARAIABBADYCBCAAQQ42AgALQQAPCyADQQA2AhAgA0IANwIIIANCADcDKCADQQA2AgQgAyACNgIAIANCADcDGCADQQA2AjAgACABQTsgAxBCCw8AIAAgASACQQBBABCCAQusAgECfyABRQRAIABBCGoiAARAIABBADYCBCAAQRI2AgALQQAPCwJAIAJBfUsNACACQf//A3FBCEYNACAAQQhqIgAEQCAAQQA2AgQgAEEQNgIAC0EADwsCQEGwwAAQCSIFBEAgBUEANgIIIAVCADcCACAFQYiBAUGogQEgAxs2AqhAIAUgAjYCFCAFIAM6ABAgBUEAOgAPIAVBADsBDCAFIAMgAkF9SyIGcToADiAFQQggAiAGG0H//wNxIAQgBUGIgQFBqIEBIAMbKAIAEQAAIgI2AqxAIAINASAFEDEgBRAGCyAAQQhqIgAEQCAAQQA2AgQgAEEONgIAC0EADwsgACABQTogBRBCIgAEfyAABSAFKAKsQCAFKAKoQCgCBBEDACAFEDEgBRAGQQALC6ABAQF/IAIgACgCBCIDIAIgA0kbIgIEQCAAIAMgAms2AgQCQAJAAkACQCAAKAIcIgMoAhRBAWsOAgEAAgsgA0GgAWogASAAKAIAIAJB3IABKAIAEQgADAILIAAgACgCMCABIAAoAgAgAkHEgAEoAgARBAA2AjAMAQsgASAAKAIAIAIQBxoLIAAgACgCACACajYCACAAIAAoAgggAmo2AggLC7cCAQR/QX4hAgJAIABFDQAgACgCIEUNACAAKAIkIgRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCICIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcN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DCABajYCDCAGIAYoAgggAWo2AgggBSAFKAIUIAFqNgIUIAUgBSgCECABazYCECAGIAYoAhAgAWsiATYCECABDQAgBiAGKAIENgIIC0EAIQRBACEJIAMoAhBFDQAMCgsgAygCHCgCJCEGIAMgAygCGCIBQQFqNgIYIAEgBmotAAAhASADIARBAWo2AhAgAygCBCAEaiABOgAAIAEEQCADKAIQIQQMAQsLIAMoAhwoAixFDQAgAygCECIGIAlNDQAgBQJ/IAUoAjAhBEEAIAMoAgQgCWoiAUUNABogBCABIAYgCWtB1IABKAIAEQAACzYCMAsgA0HnADYCIAsCQCADKAIcKAIsBEAgAygCDCADKAIQIgFBAmpJBH8gBRAKIAMoAhANAkEABSABCyADKAIEaiAFKAIwOwAAIAMgAygCEEECajYCECADQaABakHkgAEoAgARAQAaCyADQfEANgIgIAUQCiADKAIQRQ0BDAcLDAYLIAUoAgQNAQsgAygCPA0AIApFDQEgAygCIEGaBUYNAQsCfyADKAKIASIBRQRAIAMgChCFAQwBCwJAAkACQCADKAKMAUECaw4CAAECCwJ/AkADQAJAAkAgAygCPA0AIAMQLyADKAI8DQAgCg0BQQAMBAsgAygCSCADKAJoai0AACEEIAMgAygC8C0iAUEBajYC8C0gASADKALsLWpBADoAACADIAMoAvAtIgFBAWo2AvAtIAEgAygC7C1qQQA6AAAgAyADKALwLSIBQQFqNgLwLSABIAMoAuwtaiAEOgAAIAMgBEECdGoiASABLwHkAUEBajsB5AEgAyADKAI8QQFrNgI8IAMgAygCaEEBaiIBNgJoIAMoAvAtIAMoAvQtRw0BQQAhBCADIAMoAlgiBkEATgR/IAMoAkggBmoFQQALIAEgBmtBABAPIAMgAygCaDYCWCADKAIAEAogAygCACgCEA0BDAILCyADQQA2AoQuIApBBEYEQCADIAMoAlgiAUEATgR/IAMoAkggAWoFQQALIAMoAmggAWtBARAPIAMgAygCaDYCWCADKAIAEApBA0ECIAMoAgAoAhAbDAILIAMoAvAtBEBBACEEIAMgAygCWCIBQQBOBH8gAygCSCABagVBAAsgAygCaCABa0EAEA8gAyADKAJoNgJYIAMoAgAQCiADKAIAKAIQRQ0BC0EBIQQLIAQL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bGl0ZXJhbC9sZW5ndGhzIHNldABpbnZhbGlkIGNvZGUgbGVuZ3RocyBzZXQAdW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0AGludmFsaWQgZGlzdGFuY2VzIHNldABpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0AEZpbGUgYWxyZWFkeSBleGlzdHMAdG9vIG1hbnkgbGVuZ3RoIG9yIGRpc3RhbmNlIHN5bWJvbHMAaW52YWxpZCBzdG9yZWQgYmxvY2sgbGVuZ3RocwAlcyVzJXMAYnVmZmVyIGVycm9yAE5vIGVycm9yAHN0cmVhbSBlcnJvcgBUZWxsIGVycm9yAEludGVybmFsIGVycm9yAFNlZWsgZXJyb3IAV3JpdGUgZXJyb3IAZmlsZSBlcnJvcgBSZWFkIGVycm9yAFpsaWIgZXJyb3IAZGF0YSBlcnJvcgBDUkMgZXJyb3IAaW5jb21wYXRpYmxlIHZlcnNpb24AaW52YWxpZCBjb2RlIC0tIG1pc3NpbmcgZW5kLW9mLWJsb2NrAGluY29ycmVjdCBoZWFkZXIgY2hlY2sAaW5jb3JyZWN0IGxlbmd0aCBjaGVjawBpbmNvcnJlY3QgZGF0YSBjaGVjawBpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjawBoZWFkZXIgY3JjIG1pc21hdGNoADEuMi4xMy56bGliLW5nAGludmFsaWQgd2luZG93IHNpemUAUmVhZC1vbmx5IGFyY2hpdmUATm90IGEgemlwIGFyY2hpdmUAUmVzb3VyY2Ugc3RpbGwgaW4gdXNlAE1hbGxvYyBmYWlsdXJlAGludmFsaWQgYmxvY2sgdHlwZQBGYWlsdXJlIHRvIGNyZWF0ZSB0ZW1wb3JhcnkgZmlsZQBDYW4ndCBvcGVuIGZpbGUATm8gc3VjaCBmaWxlAFByZW1hdHVyZSBlbmQgb2YgZmlsZQBDYW4ndCByZW1vdmUgZmlsZQBpbnZhbGlkIGxpdGVyYWwvbGVuZ3RoIGNvZGUAaW52YWxpZCBkaXN0YW5jZSBjb2RlAHVua25vd24gY29tcHJlc3Npb24gbWV0aG9kAHN0cmVhbSBlbmQAQ29tcHJlc3NlZCBkYXRhIGludmFsaWQATXVsdGktZGlzayB6aXAgYXJjaGl2ZXMgbm90IHN1cHBvcnRl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UgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBnAQkA5wAJAOcBCQAXAAkAFwEJAJcACQCXAQkAVwAJAFcBCQDXAAkA1wEJADcACQA3AQkAtwAJALcBCQB3AAkAdwEJAPcACQD3AQkADwAJAA8BCQCPAAkAjwEJAE8ACQBPAQkAzwAJAM8BCQAvAAkALwEJAK8ACQCvAQkAbwAJAG8BCQDvAAkA7wEJAB8ACQAfAQkAnwAJAJ8BCQBfAAkAXwEJAN8ACQDfAQkAPwAJAD8BCQC/AAkA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SXMgYSBkaXJlY3RvcnkAVGV4dCBmaWxlIGJ1c3kARXhlYyBmb3JtYXQgZXJyb3IASW52YWxpZCBhcmd1bWVudABBcmd1bWVudCBsaXN0IHRvbyBsb25nAFN5bWJvbGljIGxpbmsgbG9vcABGaWxlbmFtZSB0b28gbG9uZwBUb28gbWFueSBvcGVuIGZpbGVzIGluIHN5c3RlbQBObyBmaWxlIGRlc2NyaXB0b3JzIGF2YWlsYWJsZQBCYWQgZmlsZSBkZXNjcmlwdG9yAE5vIGNoaWxkIHByb2Nlc3MAQmFkIGFkZHJlc3MARmlsZSB0b28gbGFyZ2UAVG9vIG1hbnkgbGlua3MATm8gbG9ja3MgYXZhaWxhYmxlAFJlc291cmNlIGRlYWRsb2NrIHdvdWxkIG9jY3VyAFN0YXRlIG5vdCByZWNvdmVyYWJsZQBQcmV2aW91cyBvd25lciBkaWVkAE9wZXJhdGlvbiBjYW5jZWxlZABGdW5jdGlvbiBub3QgaW1wbGVtZW50ZWQATm8gbWVzc2FnZSBvZiBkZXNpcmVkIHR5cGUASWRlbnRpZmllciByZW1vdmVkAERldmljZSBub3QgYSBzdHJlYW0ATm8gZGF0YSBhdmFpbGFibGUARGV2aWNlIHRpbWVvdXQAT3V0IG9mIHN0cmVhbXMgcmVzb3VyY2VzAExpbmsgaGFzIGJlZW4gc2V2ZXJlZABQcm90b2NvbCBlcnJvcgBCYWQgbWVzc2FnZQBGaWxlIGRlc2NyaXB0b3IgaW4gYmFkIHN0YXRlAE5vdCBhIHNvY2tldABEZXN0aW5hdGlvbiBhZGRyZXNzIHJlcXVpcmVkAE1lc3NhZ2UgdG9vIGxhcmdlAFByb3RvY29sIHdyb25nIHR5cGUgZm9yIHNvY2tldABQcm90b2NvbCBub3QgYXZhaWxhYmxlAFByb3RvY29sIG5vdCBzdXBwb3J0ZWQAU29ja2V0IHR5cGUgbm90IHN1cHBvcnRlZABOb3Qgc3VwcG9ydGVkAFByb3RvY29sIGZhbWlseSBub3Qgc3VwcG9ydGVkAEFkZHJlc3MgZmFtaWx5IG5vdCBzdXBwb3J0ZWQgYnkgcHJvdG9jb2wAQWRkcmVzcyBub3QgYXZhaWxhYmxlAE5ldHdvcmsgaXMgZG93bgBOZXR3b3JrIHVucmVhY2hhYmxlAENvbm5lY3Rpb24gcmVzZXQgYnkgbmV0d29yawBDb25uZWN0aW9uIGFib3J0ZWQATm8gYnVmZmVyIHNwYWNlIGF2YWlsYWJsZQBTb2NrZXQgaXMgY29ubmVjdGVkAFNvY2tldCBub3QgY29ubmVjdGVkAENhbm5vdCBzZW5kIGFmdGVyIHNvY2tldCBzaHV0ZG93bgBPcGVyYXRpb24gYWxyZWFkeSBpbiBwcm9ncmVzcwBPcGVyYXRpb24gaW4gcHJvZ3Jlc3MAU3RhbGUgZmlsZSBoYW5kbGUAUmVtb3RlIEkvTyBlcnJvcgBRdW90YSBleGNlZWRlZABObyBtZWRpdW0gZm91bmQAV3JvbmcgbWVkaXVtIHR5cGUATm8gZXJyb3IgaW5mb3JtYXRpb24AQcCAAQuFARMAAAAUAAAAFQAAABYAAAAXAAAAGAAAABkAAAAaAAAAGwAAABwAAAAdAAAAHgAAAB8AAAAgAAAAIQAAACIAAAAjAAAAgERQADEAAAAyAAAAMwAAADQAAAA1AAAANgAAADcAAAA4AAAAOQAAADIAAAAzAAAANAAAADUAAAA2AAAANwAAADgAQfSCAQsCXEQAQbCDAQsQ/////////////////////w==";Bo(Hi)||(Hi=P(Hi));function to(Je){try{if(Je==Hi&&ce)return new Uint8Array(ce);var st=Me(Je);if(st)return st;if(R)return R(Je);throw"sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)"}catch(St){rs(St)}}function vo(Je,st){var St,lr,ee;try{ee=to(Je),lr=new WebAssembly.Module(ee),St=new WebAssembly.Instance(lr,st)}catch(Oe){var Ie=Oe.toString();throw te("failed to compile wasm module: "+Ie),(Ie.includes("imported Memory")||Ie.includes("memory import"))&&te("Memory size incompatibility issues may be due to changing INITIAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set INITIAL_MEMORY at runtime to something smaller than it was at compile time)."),Oe}return[St,lr]}function RA(){var Je={a:fu};function st(ee,Ie){var Oe=ee.exports;r.asm=Oe,Be=r.asm.g,z(Be.buffer),$=r.asm.W,gn(r.asm.h),wo("wasm-instantiate")}if(oi("wasm-instantiate"),r.instantiateWasm)try{var St=r.instantiateWasm(Je,st);return St}catch(ee){return te("Module.instantiateWasm callback failed with error: "+ee),!1}var lr=vo(Hi,Je);return st(lr[0]),r.asm}function pf(Je){return F.getFloat32(Je,!0)}function Eh(Je){return F.getFloat64(Je,!0)}function Ih(Je){return F.getInt16(Je,!0)}function ro(Je){return F.getInt32(Je,!0)}function jn(Je,st){F.setInt32(Je,st,!0)}function Rs(Je){for(;Je.length>0;){var st=Je.shift();if(typeof st=="function"){st(r);continue}var St=st.func;typeof St=="number"?st.arg===void 0?$.get(St)():$.get(St)(st.arg):St(st.arg===void 0?null:st.arg)}}function no(Je,st){var St=new Date(ro((Je>>2)*4)*1e3);jn((st>>2)*4,St.getUTCSeconds()),jn((st+4>>2)*4,St.getUTCMinutes()),jn((st+8>>2)*4,St.getUTCHours()),jn((st+12>>2)*4,St.getUTCDate()),jn((st+16>>2)*4,St.getUTCMonth()),jn((st+20>>2)*4,St.getUTCFullYear()-1900),jn((st+24>>2)*4,St.getUTCDay()),jn((st+36>>2)*4,0),jn((st+32>>2)*4,0);var lr=Date.UTC(St.getUTCFullYear(),0,1,0,0,0,0),ee=(St.getTime()-lr)/(1e3*60*60*24)|0;return jn((st+28>>2)*4,ee),no.GMTString||(no.GMTString=rt("GMT")),jn((st+40>>2)*4,no.GMTString),st}function lu(Je,st){return no(Je,st)}function cu(Je,st,St){ke.copyWithin(Je,st,st+St)}function uu(Je){try{return Be.grow(Je-Pe.byteLength+65535>>>16),z(Be.buffer),1}catch{}}function FA(Je){var st=ke.length;Je=Je>>>0;var St=2147483648;if(Je>St)return!1;for(var lr=1;lr<=4;lr*=2){var ee=st*(1+.2/lr);ee=Math.min(ee,Je+100663296);var Ie=Math.min(St,Ne(Math.max(Je,ee),65536)),Oe=uu(Ie);if(Oe)return!0}return!1}function NA(Je){Ae(Je)}function aa(Je){var st=Date.now()/1e3|0;return Je&&jn((Je>>2)*4,st),st}function la(){if(la.called)return;la.called=!0;var Je=new Date().getFullYear(),st=new Date(Je,0,1),St=new Date(Je,6,1),lr=st.getTimezoneOffset(),ee=St.getTimezoneOffset(),Ie=Math.max(lr,ee);jn((Sl()>>2)*4,Ie*60),jn((Cs()>>2)*4,+(lr!=ee));function Oe(fn){var ai=fn.toTimeString().match(/\(([A-Za-z ]+)\)$/);return ai?ai[1]:"GMT"}var ht=Oe(st),mt=Oe(St),Dt=rt(ht),tr=rt(mt);ee>2)*4,Dt),jn((Li()+4>>2)*4,tr)):(jn((Li()>>2)*4,tr),jn((Li()+4>>2)*4,Dt))}function OA(Je){la();var st=Date.UTC(ro((Je+20>>2)*4)+1900,ro((Je+16>>2)*4),ro((Je+12>>2)*4),ro((Je+8>>2)*4),ro((Je+4>>2)*4),ro((Je>>2)*4),0),St=new Date(st);jn((Je+24>>2)*4,St.getUTCDay());var lr=Date.UTC(St.getUTCFullYear(),0,1,0,0,0,0),ee=(St.getTime()-lr)/(1e3*60*60*24)|0;return jn((Je+28>>2)*4,ee),St.getTime()/1e3|0}var gr=typeof atob=="function"?atob:function(Je){var st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",St="",lr,ee,Ie,Oe,ht,mt,Dt,tr=0;Je=Je.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Oe=st.indexOf(Je.charAt(tr++)),ht=st.indexOf(Je.charAt(tr++)),mt=st.indexOf(Je.charAt(tr++)),Dt=st.indexOf(Je.charAt(tr++)),lr=Oe<<2|ht>>4,ee=(ht&15)<<4|mt>>2,Ie=(mt&3)<<6|Dt,St=St+String.fromCharCode(lr),mt!==64&&(St=St+String.fromCharCode(ee)),Dt!==64&&(St=St+String.fromCharCode(Ie));while(tr0||(Et(),Ir>0))return;function st(){Qn||(Qn=!0,r.calledRun=!0,!Ce&&(qt(),s(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),ir()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),st()},1)):st()}if(r.run=pc,r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return pc(),e}}();typeof wT=="object"&&typeof Jj=="object"?Jj.exports=Kj:typeof define=="function"&&define.amd?define([],function(){return Kj}):typeof wT=="object"&&(wT.createModule=Kj)});var jp,Hde,jde,qde=It(()=>{jp=["number","number"],Hde=(X=>(X[X.ZIP_ER_OK=0]="ZIP_ER_OK",X[X.ZIP_ER_MULTIDISK=1]="ZIP_ER_MULTIDISK",X[X.ZIP_ER_RENAME=2]="ZIP_ER_RENAME",X[X.ZIP_ER_CLOSE=3]="ZIP_ER_CLOSE",X[X.ZIP_ER_SEEK=4]="ZIP_ER_SEEK",X[X.ZIP_ER_READ=5]="ZIP_ER_READ",X[X.ZIP_ER_WRITE=6]="ZIP_ER_WRITE",X[X.ZIP_ER_CRC=7]="ZIP_ER_CRC",X[X.ZIP_ER_ZIPCLOSED=8]="ZIP_ER_ZIPCLOSED",X[X.ZIP_ER_NOENT=9]="ZIP_ER_NOENT",X[X.ZIP_ER_EXISTS=10]="ZIP_ER_EXISTS",X[X.ZIP_ER_OPEN=11]="ZIP_ER_OPEN",X[X.ZIP_ER_TMPOPEN=12]="ZIP_ER_TMPOPEN",X[X.ZIP_ER_ZLIB=13]="ZIP_ER_ZLIB",X[X.ZIP_ER_MEMORY=14]="ZIP_ER_MEMORY",X[X.ZIP_ER_CHANGED=15]="ZIP_ER_CHANGED",X[X.ZIP_ER_COMPNOTSUPP=16]="ZIP_ER_COMPNOTSUPP",X[X.ZIP_ER_EOF=17]="ZIP_ER_EOF",X[X.ZIP_ER_INVAL=18]="ZIP_ER_INVAL",X[X.ZIP_ER_NOZIP=19]="ZIP_ER_NOZIP",X[X.ZIP_ER_INTERNAL=20]="ZIP_ER_INTERNAL",X[X.ZIP_ER_INCONS=21]="ZIP_ER_INCONS",X[X.ZIP_ER_REMOVE=22]="ZIP_ER_REMOVE",X[X.ZIP_ER_DELETED=23]="ZIP_ER_DELETED",X[X.ZIP_ER_ENCRNOTSUPP=24]="ZIP_ER_ENCRNOTSUPP",X[X.ZIP_ER_RDONLY=25]="ZIP_ER_RDONLY",X[X.ZIP_ER_NOPASSWD=26]="ZIP_ER_NOPASSWD",X[X.ZIP_ER_WRONGPASSWD=27]="ZIP_ER_WRONGPASSWD",X[X.ZIP_ER_OPNOTSUPP=28]="ZIP_ER_OPNOTSUPP",X[X.ZIP_ER_INUSE=29]="ZIP_ER_INUSE",X[X.ZIP_ER_TELL=30]="ZIP_ER_TELL",X[X.ZIP_ER_COMPRESSED_DATA=31]="ZIP_ER_COMPRESSED_DATA",X))(Hde||{}),jde=t=>({get HEAPU8(){return t.HEAPU8},errors:Hde,SEEK_SET:0,SEEK_CUR:1,SEEK_END:2,ZIP_CHECKCONS:4,ZIP_EXCL:2,ZIP_RDONLY:16,ZIP_FL_OVERWRITE:8192,ZIP_FL_COMPRESSED:4,ZIP_OPSYS_DOS:0,ZIP_OPSYS_AMIGA:1,ZIP_OPSYS_OPENVMS:2,ZIP_OPSYS_UNIX:3,ZIP_OPSYS_VM_CMS:4,ZIP_OPSYS_ATARI_ST:5,ZIP_OPSYS_OS_2:6,ZIP_OPSYS_MACINTOSH:7,ZIP_OPSYS_Z_SYSTEM:8,ZIP_OPSYS_CPM:9,ZIP_OPSYS_WINDOWS_NTFS:10,ZIP_OPSYS_MVS:11,ZIP_OPSYS_VSE:12,ZIP_OPSYS_ACORN_RISC:13,ZIP_OPSYS_VFAT:14,ZIP_OPSYS_ALTERNATE_MVS:15,ZIP_OPSYS_BEOS:16,ZIP_OPSYS_TANDEM:17,ZIP_OPSYS_OS_400:18,ZIP_OPSYS_OS_X:19,ZIP_CM_DEFAULT:-1,ZIP_CM_STORE:0,ZIP_CM_DEFLATE:8,uint08S:t._malloc(1),uint32S:t._malloc(4),malloc:t._malloc,free:t._free,getValue:t.getValue,openFromSource:t.cwrap("zip_open_from_source","number",["number","number","number"]),close:t.cwrap("zip_close","number",["number"]),discard:t.cwrap("zip_discard",null,["number"]),getError:t.cwrap("zip_get_error","number",["number"]),getName:t.cwrap("zip_get_name","string",["number","number","number"]),getNumEntries:t.cwrap("zip_get_num_entries","number",["number","number"]),delete:t.cwrap("zip_delete","number",["number","number"]),statIndex:t.cwrap("zip_stat_index","number",["number",...jp,"number","number"]),fopenIndex:t.cwrap("zip_fopen_index","number",["number",...jp,"number"]),fread:t.cwrap("zip_fread","number",["number","number","number","number"]),fclose:t.cwrap("zip_fclose","number",["number"]),dir:{add:t.cwrap("zip_dir_add","number",["number","string"])},file:{add:t.cwrap("zip_file_add","number",["number","string","number","number"]),getError:t.cwrap("zip_file_get_error","number",["number"]),getExternalAttributes:t.cwrap("zip_file_get_external_attributes","number",["number",...jp,"number","number","number"]),setExternalAttributes:t.cwrap("zip_file_set_external_attributes","number",["number",...jp,"number","number","number"]),setMtime:t.cwrap("zip_file_set_mtime","number",["number",...jp,"number","number"]),setCompression:t.cwrap("zip_set_file_compression","number",["number",...jp,"number","number"])},ext:{countSymlinks:t.cwrap("zip_ext_count_symlinks","number",["number"])},error:{initWithCode:t.cwrap("zip_error_init_with_code",null,["number","number"]),strerror:t.cwrap("zip_error_strerror","string",["number"])},name:{locate:t.cwrap("zip_name_locate","number",["number","string","number"])},source:{fromUnattachedBuffer:t.cwrap("zip_source_buffer_create","number",["number",...jp,"number","number"]),fromBuffer:t.cwrap("zip_source_buffer","number",["number","number",...jp,"number"]),free:t.cwrap("zip_source_free",null,["number"]),keep:t.cwrap("zip_source_keep",null,["number"]),open:t.cwrap("zip_source_open","number",["number"]),close:t.cwrap("zip_source_close","number",["number"]),seek:t.cwrap("zip_source_seek","number",["number",...jp,"number"]),tell:t.cwrap("zip_source_tell","number",["number"]),read:t.cwrap("zip_source_read","number",["number","number","number"]),error:t.cwrap("zip_source_error","number",["number"])},struct:{statS:t.cwrap("zipstruct_statS","number",[]),statSize:t.cwrap("zipstruct_stat_size","number",["number"]),statCompSize:t.cwrap("zipstruct_stat_comp_size","number",["number"]),statCompMethod:t.cwrap("zipstruct_stat_comp_method","number",["number"]),statMtime:t.cwrap("zipstruct_stat_mtime","number",["number"]),statCrc:t.cwrap("zipstruct_stat_crc","number",["number"]),errorS:t.cwrap("zipstruct_errorS","number",[]),errorCodeZip:t.cwrap("zipstruct_error_code_zip","number",["number"])}})});function zj(t,e){let r=t.indexOf(e);if(r<=0)return null;let s=r;for(;r>=0&&(s=r+e.length,t[s]!==K.sep);){if(t[r-1]===K.sep)return null;r=t.indexOf(e,s)}return t.length>s&&t[s]!==K.sep?null:t.slice(0,s)}var tA,Gde=It(()=>{bt();bt();rA();tA=class t extends n0{static async openPromise(e,r){let s=new t(r);try{return await e(s)}finally{s.saveAndClose()}}constructor(e={}){let r=e.fileExtensions,s=e.readOnlyArchives,a=typeof r>"u"?f=>zj(f,".zip"):f=>{for(let p of r){let h=zj(f,p);if(h)return h}return null},n=(f,p)=>new ps(p,{baseFs:f,readOnly:s,stats:f.statSync(p),customZipImplementation:e.customZipImplementation}),c=async(f,p)=>{let h={baseFs:f,readOnly:s,stats:await f.statPromise(p),customZipImplementation:e.customZipImplementation};return()=>new ps(p,h)};super({...e,factorySync:n,factoryPromise:c,getMountPoint:a})}}});var Zj,vI,Xj=It(()=>{Vj();Zj=class extends Error{constructor(e,r){super(e),this.name="Libzip Error",this.code=r}},vI=class{constructor(e){this.filesShouldBeCached=!0;let r="buffer"in e?e.buffer:e.baseFs.readFileSync(e.path);this.libzip=Bv();let s=this.libzip.malloc(4);try{let c=0;e.readOnly&&(c|=this.libzip.ZIP_RDONLY);let f=this.allocateUnattachedSource(r);try{this.zip=this.libzip.openFromSource(f,c,s),this.lzSource=f}catch(p){throw this.libzip.source.free(f),p}if(this.zip===0){let p=this.libzip.struct.errorS();throw this.libzip.error.initWithCode(p,this.libzip.getValue(s,"i32")),this.makeLibzipError(p)}}finally{this.libzip.free(s)}let a=this.libzip.getNumEntries(this.zip,0),n=new Array(a);for(let c=0;c>>0,n=this.libzip.struct.statMtime(r)>>>0,c=this.libzip.struct.statCrc(r)>>>0;return{size:a,mtime:n,crc:c}}makeLibzipError(e){let r=this.libzip.struct.errorCodeZip(e),s=this.libzip.error.strerror(e),a=new Zj(s,this.libzip.errors[r]);if(r===this.libzip.errors.ZIP_ER_CHANGED)throw new Error(`Assertion failed: Unexpected libzip error: ${a.message}`);return a}setFileSource(e,r,s){let a=this.allocateSource(s);try{let n=this.libzip.file.add(this.zip,e,a,this.libzip.ZIP_FL_OVERWRITE);if(n===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));if(r!==null&&this.libzip.file.setCompression(this.zip,n,0,r[0],r[1])===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return n}catch(n){throw this.libzip.source.free(a),n}}setMtime(e,r){if(this.libzip.file.setMtime(this.zip,e,0,r,0)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}getExternalAttributes(e){if(this.libzip.file.getExternalAttributes(this.zip,e,0,0,this.libzip.uint08S,this.libzip.uint32S)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));let s=this.libzip.getValue(this.libzip.uint08S,"i8")>>>0,a=this.libzip.getValue(this.libzip.uint32S,"i32")>>>0;return[s,a]}setExternalAttributes(e,r,s){if(this.libzip.file.setExternalAttributes(this.zip,e,0,0,r,s)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}locate(e){return this.libzip.name.locate(this.zip,e,0)}getFileSource(e){let r=this.libzip.struct.statS();if(this.libzip.statIndex(this.zip,e,0,0,r)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));let a=this.libzip.struct.statCompSize(r),n=this.libzip.struct.statCompMethod(r),c=this.libzip.malloc(a);try{let f=this.libzip.fopenIndex(this.zip,e,0,this.libzip.ZIP_FL_COMPRESSED);if(f===0)throw this.makeLibzipError(this.libzip.getError(this.zip));try{let p=this.libzip.fread(f,c,a,0);if(p===-1)throw this.makeLibzipError(this.libzip.file.getError(f));if(pa)throw new Error("Overread");let h=this.libzip.HEAPU8.subarray(c,c+a);return{data:Buffer.from(h),compressionMethod:n}}finally{this.libzip.fclose(f)}}finally{this.libzip.free(c)}}deleteEntry(e){if(this.libzip.delete(this.zip,e)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}addDirectory(e){let r=this.libzip.dir.add(this.zip,e);if(r===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return r}getBufferAndClose(){try{if(this.libzip.source.keep(this.lzSource),this.libzip.close(this.zip)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));if(this.libzip.source.open(this.lzSource)===-1)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(this.libzip.source.seek(this.lzSource,0,0,this.libzip.SEEK_END)===-1)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));let e=this.libzip.source.tell(this.lzSource);if(e===-1)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(this.libzip.source.seek(this.lzSource,0,0,this.libzip.SEEK_SET)===-1)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));let r=this.libzip.malloc(e);if(!r)throw new Error("Couldn't allocate enough memory");try{let s=this.libzip.source.read(this.lzSource,r,e);if(s===-1)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(se)throw new Error("Overread");let a=Buffer.from(this.libzip.HEAPU8.subarray(r,r+e));return process.env.YARN_IS_TEST_ENV&&process.env.YARN_ZIP_DATA_EPILOGUE&&(a=Buffer.concat([a,Buffer.from(process.env.YARN_ZIP_DATA_EPILOGUE)])),a}finally{this.libzip.free(r)}}finally{this.libzip.source.close(this.lzSource),this.libzip.source.free(this.lzSource)}}allocateBuffer(e){Buffer.isBuffer(e)||(e=Buffer.from(e));let r=this.libzip.malloc(e.byteLength);if(!r)throw new Error("Couldn't allocate enough memory");return new Uint8Array(this.libzip.HEAPU8.buffer,r,e.byteLength).set(e),{buffer:r,byteLength:e.byteLength}}allocateUnattachedSource(e){let r=this.libzip.struct.errorS(),{buffer:s,byteLength:a}=this.allocateBuffer(e),n=this.libzip.source.fromUnattachedBuffer(s,a,0,1,r);if(n===0)throw this.libzip.free(r),this.makeLibzipError(r);return n}allocateSource(e){let{buffer:r,byteLength:s}=this.allocateBuffer(e),a=this.libzip.source.fromBuffer(this.zip,r,s,0,1);if(a===0)throw this.libzip.free(r),this.makeLibzipError(this.libzip.getError(this.zip));return a}discard(){this.libzip.discard(this.zip)}}});function vmt(t){if(typeof t=="string"&&String(+t)===t)return+t;if(typeof t=="number"&&Number.isFinite(t))return t<0?Date.now()/1e3:t;if(Wde.types.isDate(t))return t.getTime()/1e3;throw new Error("Invalid time")}function BT(){return Buffer.from([80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])}var ka,$j,Wde,e6,lm,t6,r6,Yde,ps,vT=It(()=>{bt();bt();bt();bt();bt();bt();ka=ye("fs"),$j=ye("stream"),Wde=ye("util"),e6=et(ye("zlib"));Xj();lm=3,t6=0,r6=8,Yde="mixed";ps=class extends Uf{constructor(r,s={}){super();this.listings=new Map;this.entries=new Map;this.fileSources=new Map;this.fds=new Map;this.nextFd=0;this.ready=!1;this.readOnly=!1;s.readOnly&&(this.readOnly=!0);let a=s;this.level=typeof a.level<"u"?a.level:Yde;let n=s.customZipImplementation??vI;if(typeof r=="string"){let{baseFs:f=new Yn}=a;this.baseFs=f,this.path=r}else this.path=null,this.baseFs=null;if(s.stats)this.stats=s.stats;else if(typeof r=="string")try{this.stats=this.baseFs.statSync(r)}catch(f){if(f.code==="ENOENT"&&a.create)this.stats=el.makeDefaultStats();else throw f}else this.stats=el.makeDefaultStats();typeof r=="string"?s.create?this.zipImpl=new n({buffer:BT(),readOnly:this.readOnly}):this.zipImpl=new n({path:r,baseFs:this.baseFs,readOnly:this.readOnly,size:this.stats.size}):this.zipImpl=new n({buffer:r??BT(),readOnly:this.readOnly}),this.listings.set(vt.root,new Set);let c=this.zipImpl.getListings();for(let f=0;f{this.closeSync(f)}})}async readPromise(r,s,a,n,c){return this.readSync(r,s,a,n,c)}readSync(r,s,a=0,n=s.byteLength,c=-1){let f=this.fds.get(r);if(typeof f>"u")throw or.EBADF("read");let p=c===-1||c===null?f.cursor:c,h=this.readFileSync(f.p);h.copy(s,a,p,p+n);let E=Math.max(0,Math.min(h.length-p,n));return(c===-1||c===null)&&(f.cursor+=E),E}async writePromise(r,s,a,n,c){return typeof s=="string"?this.writeSync(r,s,c):this.writeSync(r,s,a,n,c)}writeSync(r,s,a,n,c){throw typeof this.fds.get(r)>"u"?or.EBADF("read"):new Error("Unimplemented")}async closePromise(r){return this.closeSync(r)}closeSync(r){if(typeof this.fds.get(r)>"u")throw or.EBADF("read");this.fds.delete(r)}createReadStream(r,{encoding:s}={}){if(r===null)throw new Error("Unimplemented");let a=this.openSync(r,"r"),n=Object.assign(new $j.PassThrough({emitClose:!0,autoDestroy:!0,destroy:(f,p)=>{clearImmediate(c),this.closeSync(a),p(f)}}),{close(){n.destroy()},bytesRead:0,path:r,pending:!1}),c=setImmediate(async()=>{try{let f=await this.readFilePromise(r,s);n.bytesRead=f.length,n.end(f)}catch(f){n.destroy(f)}});return n}createWriteStream(r,{encoding:s}={}){if(this.readOnly)throw or.EROFS(`open '${r}'`);if(r===null)throw new Error("Unimplemented");let a=[],n=this.openSync(r,"w"),c=Object.assign(new $j.PassThrough({autoDestroy:!0,emitClose:!0,destroy:(f,p)=>{try{f?p(f):(this.writeFileSync(r,Buffer.concat(a),s),p(null))}catch(h){p(h)}finally{this.closeSync(n)}}}),{close(){c.destroy()},bytesWritten:0,path:r,pending:!1});return c.on("data",f=>{let p=Buffer.from(f);c.bytesWritten+=p.length,a.push(p)}),c}async realpathPromise(r){return this.realpathSync(r)}realpathSync(r){let s=this.resolveFilename(`lstat '${r}'`,r);if(!this.entries.has(s)&&!this.listings.has(s))throw or.ENOENT(`lstat '${r}'`);return s}async existsPromise(r){return this.existsSync(r)}existsSync(r){if(!this.ready)throw or.EBUSY(`archive closed, existsSync '${r}'`);if(this.symlinkCount===0){let a=K.resolve(vt.root,r);return this.entries.has(a)||this.listings.has(a)}let s;try{s=this.resolveFilename(`stat '${r}'`,r,void 0,!1)}catch{return!1}return s===void 0?!1:this.entries.has(s)||this.listings.has(s)}async accessPromise(r,s){return this.accessSync(r,s)}accessSync(r,s=ka.constants.F_OK){let a=this.resolveFilename(`access '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw or.ENOENT(`access '${r}'`);if(this.readOnly&&s&ka.constants.W_OK)throw or.EROFS(`access '${r}'`)}async statPromise(r,s={bigint:!1}){return s.bigint?this.statSync(r,{bigint:!0}):this.statSync(r)}statSync(r,s={bigint:!1,throwIfNoEntry:!0}){let a=this.resolveFilename(`stat '${r}'`,r,void 0,s.throwIfNoEntry);if(a!==void 0){if(!this.entries.has(a)&&!this.listings.has(a)){if(s.throwIfNoEntry===!1)return;throw or.ENOENT(`stat '${r}'`)}if(r[r.length-1]==="/"&&!this.listings.has(a))throw or.ENOTDIR(`stat '${r}'`);return this.statImpl(`stat '${r}'`,a,s)}}async fstatPromise(r,s){return this.fstatSync(r,s)}fstatSync(r,s){let a=this.fds.get(r);if(typeof a>"u")throw or.EBADF("fstatSync");let{p:n}=a,c=this.resolveFilename(`stat '${n}'`,n);if(!this.entries.has(c)&&!this.listings.has(c))throw or.ENOENT(`stat '${n}'`);if(n[n.length-1]==="/"&&!this.listings.has(c))throw or.ENOTDIR(`stat '${n}'`);return this.statImpl(`fstat '${n}'`,c,s)}async lstatPromise(r,s={bigint:!1}){return s.bigint?this.lstatSync(r,{bigint:!0}):this.lstatSync(r)}lstatSync(r,s={bigint:!1,throwIfNoEntry:!0}){let a=this.resolveFilename(`lstat '${r}'`,r,!1,s.throwIfNoEntry);if(a!==void 0){if(!this.entries.has(a)&&!this.listings.has(a)){if(s.throwIfNoEntry===!1)return;throw or.ENOENT(`lstat '${r}'`)}if(r[r.length-1]==="/"&&!this.listings.has(a))throw or.ENOTDIR(`lstat '${r}'`);return this.statImpl(`lstat '${r}'`,a,s)}}statImpl(r,s,a={}){let n=this.entries.get(s);if(typeof n<"u"){let c=this.zipImpl.stat(n),f=c.crc,p=c.size,h=c.mtime*1e3,E=this.stats.uid,C=this.stats.gid,S=512,P=Math.ceil(c.size/S),I=h,R=h,N=h,U=new Date(I),W=new Date(R),te=new Date(N),ie=new Date(h),Ae=this.listings.has(s)?ka.constants.S_IFDIR:this.isSymbolicLink(n)?ka.constants.S_IFLNK:ka.constants.S_IFREG,ce=Ae===ka.constants.S_IFDIR?493:420,me=Ae|this.getUnixMode(n,ce)&511,pe=Object.assign(new el.StatEntry,{uid:E,gid:C,size:p,blksize:S,blocks:P,atime:U,birthtime:W,ctime:te,mtime:ie,atimeMs:I,birthtimeMs:R,ctimeMs:N,mtimeMs:h,mode:me,crc:f});return a.bigint===!0?el.convertToBigIntStats(pe):pe}if(this.listings.has(s)){let c=this.stats.uid,f=this.stats.gid,p=0,h=512,E=0,C=this.stats.mtimeMs,S=this.stats.mtimeMs,P=this.stats.mtimeMs,I=this.stats.mtimeMs,R=new Date(C),N=new Date(S),U=new Date(P),W=new Date(I),te=ka.constants.S_IFDIR|493,Ae=Object.assign(new el.StatEntry,{uid:c,gid:f,size:p,blksize:h,blocks:E,atime:R,birthtime:N,ctime:U,mtime:W,atimeMs:C,birthtimeMs:S,ctimeMs:P,mtimeMs:I,mode:te,crc:0});return a.bigint===!0?el.convertToBigIntStats(Ae):Ae}throw new Error("Unreachable")}getUnixMode(r,s){let[a,n]=this.zipImpl.getExternalAttributes(r);return a!==lm?s:n>>>16}registerListing(r){let s=this.listings.get(r);if(s)return s;this.registerListing(K.dirname(r)).add(K.basename(r));let n=new Set;return this.listings.set(r,n),n}registerEntry(r,s){this.registerListing(K.dirname(r)).add(K.basename(r)),this.entries.set(r,s)}unregisterListing(r){this.listings.delete(r),this.listings.get(K.dirname(r))?.delete(K.basename(r))}unregisterEntry(r){this.unregisterListing(r);let s=this.entries.get(r);this.entries.delete(r),!(typeof s>"u")&&(this.fileSources.delete(s),this.isSymbolicLink(s)&&this.symlinkCount--)}deleteEntry(r,s){this.unregisterEntry(r),this.zipImpl.deleteEntry(s)}resolveFilename(r,s,a=!0,n=!0){if(!this.ready)throw or.EBUSY(`archive closed, ${r}`);let c=K.resolve(vt.root,s);if(c==="/")return vt.root;let f=this.entries.get(c);if(a&&f!==void 0)if(this.symlinkCount!==0&&this.isSymbolicLink(f)){let p=this.getFileSource(f).toString();return this.resolveFilename(r,K.resolve(K.dirname(c),p),!0,n)}else return c;for(;;){let p=this.resolveFilename(r,K.dirname(c),!0,n);if(p===void 0)return p;let h=this.listings.has(p),E=this.entries.has(p);if(!h&&!E){if(n===!1)return;throw or.ENOENT(r)}if(!h)throw or.ENOTDIR(r);if(c=K.resolve(p,K.basename(c)),!a||this.symlinkCount===0)break;let C=this.zipImpl.locate(c.slice(1));if(C===-1)break;if(this.isSymbolicLink(C)){let S=this.getFileSource(C).toString();c=K.resolve(K.dirname(c),S)}else break}return c}setFileSource(r,s){let a=Buffer.isBuffer(s)?s:Buffer.from(s),n=K.relative(vt.root,r),c=null;this.level!=="mixed"&&(c=[this.level===0?t6:r6,this.level]);let f=this.zipImpl.setFileSource(n,c,a);return this.fileSources.set(f,a),f}isSymbolicLink(r){if(this.symlinkCount===0)return!1;let[s,a]=this.zipImpl.getExternalAttributes(r);return s!==lm?!1:(a>>>16&ka.constants.S_IFMT)===ka.constants.S_IFLNK}getFileSource(r,s={asyncDecompress:!1}){let a=this.fileSources.get(r);if(typeof a<"u")return a;let{data:n,compressionMethod:c}=this.zipImpl.getFileSource(r);if(c===t6)return this.zipImpl.filesShouldBeCached&&this.fileSources.set(r,n),n;if(c===r6){if(s.asyncDecompress)return new Promise((f,p)=>{e6.default.inflateRaw(n,(h,E)=>{h?p(h):(this.zipImpl.filesShouldBeCached&&this.fileSources.set(r,E),f(E))})});{let f=e6.default.inflateRawSync(n);return this.zipImpl.filesShouldBeCached&&this.fileSources.set(r,f),f}}else throw new Error(`Unsupported compression method: ${c}`)}async fchmodPromise(r,s){return this.chmodPromise(this.fdToPath(r,"fchmod"),s)}fchmodSync(r,s){return this.chmodSync(this.fdToPath(r,"fchmodSync"),s)}async chmodPromise(r,s){return this.chmodSync(r,s)}chmodSync(r,s){if(this.readOnly)throw or.EROFS(`chmod '${r}'`);s&=493;let a=this.resolveFilename(`chmod '${r}'`,r,!1),n=this.entries.get(a);if(typeof n>"u")throw new Error(`Assertion failed: The entry should have been registered (${a})`);let f=this.getUnixMode(n,ka.constants.S_IFREG|0)&-512|s;this.zipImpl.setExternalAttributes(n,lm,f<<16)}async fchownPromise(r,s,a){return this.chownPromise(this.fdToPath(r,"fchown"),s,a)}fchownSync(r,s,a){return this.chownSync(this.fdToPath(r,"fchownSync"),s,a)}async chownPromise(r,s,a){return this.chownSync(r,s,a)}chownSync(r,s,a){throw new Error("Unimplemented")}async renamePromise(r,s){return this.renameSync(r,s)}renameSync(r,s){throw new Error("Unimplemented")}async copyFilePromise(r,s,a){let{indexSource:n,indexDest:c,resolvedDestP:f}=this.prepareCopyFile(r,s,a),p=await this.getFileSource(n,{asyncDecompress:!0}),h=this.setFileSource(f,p);h!==c&&this.registerEntry(f,h)}copyFileSync(r,s,a=0){let{indexSource:n,indexDest:c,resolvedDestP:f}=this.prepareCopyFile(r,s,a),p=this.getFileSource(n),h=this.setFileSource(f,p);h!==c&&this.registerEntry(f,h)}prepareCopyFile(r,s,a=0){if(this.readOnly)throw or.EROFS(`copyfile '${r} -> '${s}'`);if(a&ka.constants.COPYFILE_FICLONE_FORCE)throw or.ENOSYS("unsupported clone operation",`copyfile '${r}' -> ${s}'`);let n=this.resolveFilename(`copyfile '${r} -> ${s}'`,r),c=this.entries.get(n);if(typeof c>"u")throw or.EINVAL(`copyfile '${r}' -> '${s}'`);let f=this.resolveFilename(`copyfile '${r}' -> ${s}'`,s),p=this.entries.get(f);if(a&(ka.constants.COPYFILE_EXCL|ka.constants.COPYFILE_FICLONE_FORCE)&&typeof p<"u")throw or.EEXIST(`copyfile '${r}' -> '${s}'`);return{indexSource:c,resolvedDestP:f,indexDest:p}}async appendFilePromise(r,s,a){if(this.readOnly)throw or.EROFS(`open '${r}'`);return typeof a>"u"?a={flag:"a"}:typeof a=="string"?a={flag:"a",encoding:a}:typeof a.flag>"u"&&(a={flag:"a",...a}),this.writeFilePromise(r,s,a)}appendFileSync(r,s,a={}){if(this.readOnly)throw or.EROFS(`open '${r}'`);return typeof a>"u"?a={flag:"a"}:typeof a=="string"?a={flag:"a",encoding:a}:typeof a.flag>"u"&&(a={flag:"a",...a}),this.writeFileSync(r,s,a)}fdToPath(r,s){let a=this.fds.get(r)?.p;if(typeof a>"u")throw or.EBADF(s);return a}async writeFilePromise(r,s,a){let{encoding:n,mode:c,index:f,resolvedP:p}=this.prepareWriteFile(r,a);f!==void 0&&typeof a=="object"&&a.flag&&a.flag.includes("a")&&(s=Buffer.concat([await this.getFileSource(f,{asyncDecompress:!0}),Buffer.from(s)])),n!==null&&(s=s.toString(n));let h=this.setFileSource(p,s);h!==f&&this.registerEntry(p,h),c!==null&&await this.chmodPromise(p,c)}writeFileSync(r,s,a){let{encoding:n,mode:c,index:f,resolvedP:p}=this.prepareWriteFile(r,a);f!==void 0&&typeof a=="object"&&a.flag&&a.flag.includes("a")&&(s=Buffer.concat([this.getFileSource(f),Buffer.from(s)])),n!==null&&(s=s.toString(n));let h=this.setFileSource(p,s);h!==f&&this.registerEntry(p,h),c!==null&&this.chmodSync(p,c)}prepareWriteFile(r,s){if(typeof r=="number"&&(r=this.fdToPath(r,"read")),this.readOnly)throw or.EROFS(`open '${r}'`);let a=this.resolveFilename(`open '${r}'`,r);if(this.listings.has(a))throw or.EISDIR(`open '${r}'`);let n=null,c=null;typeof s=="string"?n=s:typeof s=="object"&&({encoding:n=null,mode:c=null}=s);let f=this.entries.get(a);return{encoding:n,mode:c,resolvedP:a,index:f}}async unlinkPromise(r){return this.unlinkSync(r)}unlinkSync(r){if(this.readOnly)throw or.EROFS(`unlink '${r}'`);let s=this.resolveFilename(`unlink '${r}'`,r);if(this.listings.has(s))throw or.EISDIR(`unlink '${r}'`);let a=this.entries.get(s);if(typeof a>"u")throw or.EINVAL(`unlink '${r}'`);this.deleteEntry(s,a)}async utimesPromise(r,s,a){return this.utimesSync(r,s,a)}utimesSync(r,s,a){if(this.readOnly)throw or.EROFS(`utimes '${r}'`);let n=this.resolveFilename(`utimes '${r}'`,r);this.utimesImpl(n,a)}async lutimesPromise(r,s,a){return this.lutimesSync(r,s,a)}lutimesSync(r,s,a){if(this.readOnly)throw or.EROFS(`lutimes '${r}'`);let n=this.resolveFilename(`utimes '${r}'`,r,!1);this.utimesImpl(n,a)}utimesImpl(r,s){this.listings.has(r)&&(this.entries.has(r)||this.hydrateDirectory(r));let a=this.entries.get(r);if(a===void 0)throw new Error("Unreachable");this.zipImpl.setMtime(a,vmt(s))}async mkdirPromise(r,s){return this.mkdirSync(r,s)}mkdirSync(r,{mode:s=493,recursive:a=!1}={}){if(a)return this.mkdirpSync(r,{chmod:s});if(this.readOnly)throw or.EROFS(`mkdir '${r}'`);let n=this.resolveFilename(`mkdir '${r}'`,r);if(this.entries.has(n)||this.listings.has(n))throw or.EEXIST(`mkdir '${r}'`);this.hydrateDirectory(n),this.chmodSync(n,s)}async rmdirPromise(r,s){return this.rmdirSync(r,s)}rmdirSync(r,{recursive:s=!1}={}){if(this.readOnly)throw or.EROFS(`rmdir '${r}'`);if(s){this.removeSync(r);return}let a=this.resolveFilename(`rmdir '${r}'`,r),n=this.listings.get(a);if(!n)throw or.ENOTDIR(`rmdir '${r}'`);if(n.size>0)throw or.ENOTEMPTY(`rmdir '${r}'`);let c=this.entries.get(a);if(typeof c>"u")throw or.EINVAL(`rmdir '${r}'`);this.deleteEntry(r,c)}async rmPromise(r,s){return this.rmSync(r,s)}rmSync(r,{recursive:s=!1}={}){if(this.readOnly)throw or.EROFS(`rm '${r}'`);if(s){this.removeSync(r);return}let a=this.resolveFilename(`rm '${r}'`,r),n=this.listings.get(a);if(!n)throw or.ENOTDIR(`rm '${r}'`);if(n.size>0)throw or.ENOTEMPTY(`rm '${r}'`);let c=this.entries.get(a);if(typeof c>"u")throw or.EINVAL(`rm '${r}'`);this.deleteEntry(r,c)}hydrateDirectory(r){let s=this.zipImpl.addDirectory(K.relative(vt.root,r));return this.registerListing(r),this.registerEntry(r,s),s}async linkPromise(r,s){return this.linkSync(r,s)}linkSync(r,s){throw or.EOPNOTSUPP(`link '${r}' -> '${s}'`)}async symlinkPromise(r,s){return this.symlinkSync(r,s)}symlinkSync(r,s){if(this.readOnly)throw or.EROFS(`symlink '${r}' -> '${s}'`);let a=this.resolveFilename(`symlink '${r}' -> '${s}'`,s);if(this.listings.has(a))throw or.EISDIR(`symlink '${r}' -> '${s}'`);if(this.entries.has(a))throw or.EEXIST(`symlink '${r}' -> '${s}'`);let n=this.setFileSource(a,r);this.registerEntry(a,n),this.zipImpl.setExternalAttributes(n,lm,(ka.constants.S_IFLNK|511)<<16),this.symlinkCount+=1}async readFilePromise(r,s){typeof s=="object"&&(s=s?s.encoding:void 0);let a=await this.readFileBuffer(r,{asyncDecompress:!0});return s?a.toString(s):a}readFileSync(r,s){typeof s=="object"&&(s=s?s.encoding:void 0);let a=this.readFileBuffer(r);return s?a.toString(s):a}readFileBuffer(r,s={asyncDecompress:!1}){typeof r=="number"&&(r=this.fdToPath(r,"read"));let a=this.resolveFilename(`open '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw or.ENOENT(`open '${r}'`);if(r[r.length-1]==="/"&&!this.listings.has(a))throw or.ENOTDIR(`open '${r}'`);if(this.listings.has(a))throw or.EISDIR("read");let n=this.entries.get(a);if(n===void 0)throw new Error("Unreachable");return this.getFileSource(n,s)}async readdirPromise(r,s){return this.readdirSync(r,s)}readdirSync(r,s){let a=this.resolveFilename(`scandir '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw or.ENOENT(`scandir '${r}'`);let n=this.listings.get(a);if(!n)throw or.ENOTDIR(`scandir '${r}'`);if(s?.recursive)if(s?.withFileTypes){let c=Array.from(n,f=>Object.assign(this.statImpl("lstat",K.join(r,f)),{name:f,path:vt.dot}));for(let f of c){if(!f.isDirectory())continue;let p=K.join(f.path,f.name),h=this.listings.get(K.join(a,p));for(let E of h)c.push(Object.assign(this.statImpl("lstat",K.join(r,p,E)),{name:E,path:p}))}return c}else{let c=[...n];for(let f of c){let p=this.listings.get(K.join(a,f));if(!(typeof p>"u"))for(let h of p)c.push(K.join(f,h))}return c}else return s?.withFileTypes?Array.from(n,c=>Object.assign(this.statImpl("lstat",K.join(r,c)),{name:c,path:void 0})):[...n]}async readlinkPromise(r){let s=this.prepareReadlink(r);return(await this.getFileSource(s,{asyncDecompress:!0})).toString()}readlinkSync(r){let s=this.prepareReadlink(r);return this.getFileSource(s).toString()}prepareReadlink(r){let s=this.resolveFilename(`readlink '${r}'`,r,!1);if(!this.entries.has(s)&&!this.listings.has(s))throw or.ENOENT(`readlink '${r}'`);if(r[r.length-1]==="/"&&!this.listings.has(s))throw or.ENOTDIR(`open '${r}'`);if(this.listings.has(s))throw or.EINVAL(`readlink '${r}'`);let a=this.entries.get(s);if(a===void 0)throw new Error("Unreachable");if(!this.isSymbolicLink(a))throw or.EINVAL(`readlink '${r}'`);return a}async truncatePromise(r,s=0){let a=this.resolveFilename(`open '${r}'`,r),n=this.entries.get(a);if(typeof n>"u")throw or.EINVAL(`open '${r}'`);let c=await this.getFileSource(n,{asyncDecompress:!0}),f=Buffer.alloc(s,0);return c.copy(f),await this.writeFilePromise(r,f)}truncateSync(r,s=0){let a=this.resolveFilename(`open '${r}'`,r),n=this.entries.get(a);if(typeof n>"u")throw or.EINVAL(`open '${r}'`);let c=this.getFileSource(n),f=Buffer.alloc(s,0);return c.copy(f),this.writeFileSync(r,f)}async ftruncatePromise(r,s){return this.truncatePromise(this.fdToPath(r,"ftruncate"),s)}ftruncateSync(r,s){return this.truncateSync(this.fdToPath(r,"ftruncateSync"),s)}watch(r,s,a){let n;switch(typeof s){case"function":case"string":case"undefined":n=!0;break;default:({persistent:n=!0}=s);break}if(!n)return{on:()=>{},close:()=>{}};let c=setInterval(()=>{},24*60*60*1e3);return{on:()=>{},close:()=>{clearInterval(c)}}}watchFile(r,s,a){let n=K.resolve(vt.root,r);return sE(this,n,s,a)}unwatchFile(r,s){let a=K.resolve(vt.root,r);return yd(this,a,s)}}});function Kde(t,e,r=Buffer.alloc(0),s){let a=new ps(r),n=C=>C===e||C.startsWith(`${e}/`)?C.slice(0,e.length):null,c=async(C,S)=>()=>a,f=(C,S)=>a,p={...t},h=new Yn(p),E=new n0({baseFs:h,getMountPoint:n,factoryPromise:c,factorySync:f,magicByte:21,maxAge:1/0,typeCheck:s?.typeCheck});return j2(Vde.default,new i0(E)),a}var Vde,Jde=It(()=>{bt();Vde=et(ye("fs"));vT()});var zde=It(()=>{Gde();vT();Jde()});var n6,vv,ST,Zde=It(()=>{bt();vT();n6={CENTRAL_DIRECTORY:33639248,END_OF_CENTRAL_DIRECTORY:101010256},vv=22,ST=class t{constructor(e){this.filesShouldBeCached=!1;if("buffer"in e)throw new Error("Buffer based zip archives are not supported");if(!e.readOnly)throw new Error("Writable zip archives are not supported");this.baseFs=e.baseFs,this.fd=this.baseFs.openSync(e.path,"r");try{this.entries=t.readZipSync(this.fd,this.baseFs,e.size)}catch(r){throw this.baseFs.closeSync(this.fd),this.fd="closed",r}}static readZipSync(e,r,s){if(s=0;N--)if(n.readUInt32LE(N)===n6.END_OF_CENTRAL_DIRECTORY){a=N;break}if(a===-1)throw new Error("Not a zip archive")}let c=n.readUInt16LE(a+10),f=n.readUInt32LE(a+12),p=n.readUInt32LE(a+16),h=n.readUInt16LE(a+20);if(a+h+vv>n.length)throw new Error("Zip archive inconsistent");if(c==65535||f==4294967295||p==4294967295)throw new Error("Zip 64 is not supported");if(f>s)throw new Error("Zip archive inconsistent");if(c>f/46)throw new Error("Zip archive inconsistent");let E=Buffer.alloc(f);if(r.readSync(e,E,0,E.length,p)!==E.length)throw new Error("Zip archive inconsistent");let C=[],S=0,P=0,I=0;for(;PE.length)throw new Error("Zip archive inconsistent");if(E.readUInt32LE(S)!==n6.CENTRAL_DIRECTORY)throw new Error("Zip archive inconsistent");let N=E.readUInt16LE(S+4)>>>8;if(E.readUInt16LE(S+8)&1)throw new Error("Encrypted zip files are not supported");let W=E.readUInt16LE(S+10),te=E.readUInt32LE(S+16),ie=E.readUInt16LE(S+28),Ae=E.readUInt16LE(S+30),ce=E.readUInt16LE(S+32),me=E.readUInt32LE(S+42),pe=E.toString("utf8",S+46,S+46+ie).replaceAll("\0"," ");if(pe.includes("\0"))throw new Error("Invalid ZIP file");let Be=E.readUInt32LE(S+20),Ce=E.readUInt32LE(S+38);C.push({name:pe,os:N,mtime:ui.SAFE_TIME,crc:te,compressionMethod:W,isSymbolicLink:N===lm&&(Ce>>>16&ui.S_IFMT)===ui.S_IFLNK,size:E.readUInt32LE(S+24),compressedSize:Be,externalAttributes:Ce,localHeaderOffset:me}),I+=Be,P+=1,S+=46+ie+Ae+ce}if(I>s)throw new Error("Zip archive inconsistent");if(S!==E.length)throw new Error("Zip archive inconsistent");return C}getExternalAttributes(e){let r=this.entries[e];return[r.os,r.externalAttributes]}getListings(){return this.entries.map(e=>e.name)}getSymlinkCount(){let e=0;for(let r of this.entries)r.isSymbolicLink&&(e+=1);return e}stat(e){let r=this.entries[e];return{crc:r.crc,mtime:r.mtime,size:r.size}}locate(e){for(let r=0;rYde,DEFLATE:()=>r6,JsZipImpl:()=>ST,LibZipImpl:()=>vI,STORE:()=>t6,ZIP_UNIX:()=>lm,ZipFS:()=>ps,ZipOpenFS:()=>tA,getArchivePart:()=>zj,getLibzipPromise:()=>Dmt,getLibzipSync:()=>Smt,makeEmptyArchive:()=>BT,mountMemoryDrive:()=>Kde});function Smt(){return Bv()}async function Dmt(){return Bv()}var Xde,rA=It(()=>{Vj();Xde=et(Ude());qde();zde();Zde();Xj();_de(()=>{let t=(0,Xde.default)();return jde(t)})});var Dv,$de=It(()=>{bt();Wt();bv();Dv=class extends ot{constructor(){super(...arguments);this.cwd=ge.String("--cwd",process.cwd(),{description:"The directory to run the command in"});this.commandName=ge.String();this.args=ge.Proxy()}static{this.usage={description:"run a command using yarn's portable shell",details:` + This command will run a command using Yarn's portable shell. + + Make sure to escape glob patterns, redirections, and other features that might be expanded by your own shell. + + Note: To escape something from Yarn's shell, you might have to escape it twice, the first time from your own shell. + + Note: Don't use this command in Yarn scripts, as Yarn's shell is automatically used. + + For a list of features, visit: https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-shell/README.md. + `,examples:[["Run a simple command","$0 echo Hello"],["Run a command with a glob pattern","$0 echo '*.js'"],["Run a command with a redirection","$0 echo Hello World '>' hello.txt"],["Run a command with an escaped glob pattern (The double escape is needed in Unix shells)",`$0 echo '"*.js"'`],["Run a command with a variable (Double quotes are needed in Unix shells, to prevent them from expanding the variable)",'$0 "GREETING=Hello echo $GREETING World"']]}}async execute(){let r=this.args.length>0?`${this.commandName} ${this.args.join(" ")}`:this.commandName;return await SI(r,[],{cwd:ue.toPortablePath(this.cwd),stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}}});var Kl,eme=It(()=>{Kl=class extends Error{constructor(e){super(e),this.name="ShellError"}}});var PT={};Vt(PT,{fastGlobOptions:()=>nme,isBraceExpansion:()=>i6,isGlobPattern:()=>bmt,match:()=>Pmt,micromatchOptions:()=>bT});function bmt(t){if(!DT.default.scan(t,bT).isGlob)return!1;try{DT.default.parse(t,bT)}catch{return!1}return!0}function Pmt(t,{cwd:e,baseFs:r}){return(0,tme.default)(t,{...nme,cwd:ue.fromPortablePath(e),fs:Cx(rme.default,new i0(r))})}function i6(t){return DT.default.scan(t,bT).isBrace}var tme,rme,DT,bT,nme,ime=It(()=>{bt();tme=et(BQ()),rme=et(ye("fs")),DT=et(Sa()),bT={strictBrackets:!0},nme={onlyDirectories:!1,onlyFiles:!1}});function s6(){}function o6(){for(let t of cm)t.kill()}function lme(t,e,r,s){return a=>{let n=a[0]instanceof nA.Transform?"pipe":a[0],c=a[1]instanceof nA.Transform?"pipe":a[1],f=a[2]instanceof nA.Transform?"pipe":a[2],p=(0,ome.default)(t,e,{...s,stdio:[n,c,f]});return cm.add(p),cm.size===1&&(process.on("SIGINT",s6),process.on("SIGTERM",o6)),a[0]instanceof nA.Transform&&a[0].pipe(p.stdin),a[1]instanceof nA.Transform&&p.stdout.pipe(a[1],{end:!1}),a[2]instanceof nA.Transform&&p.stderr.pipe(a[2],{end:!1}),{stdin:p.stdin,promise:new Promise(h=>{p.on("error",E=>{switch(cm.delete(p),cm.size===0&&(process.off("SIGINT",s6),process.off("SIGTERM",o6)),E.code){case"ENOENT":a[2].write(`command not found: ${t} +`),h(127);break;case"EACCES":a[2].write(`permission denied: ${t} +`),h(128);break;default:a[2].write(`uncaught error: ${E.message} +`),h(1);break}}),p.on("close",E=>{cm.delete(p),cm.size===0&&(process.off("SIGINT",s6),process.off("SIGTERM",o6)),h(E!==null?E:129)})})}}}function cme(t){return e=>{let r=e[0]==="pipe"?new nA.PassThrough:e[0];return{stdin:r,promise:Promise.resolve().then(()=>t({stdin:r,stdout:e[1],stderr:e[2]}))}}}function xT(t,e){return l6.start(t,e)}function sme(t,e=null){let r=new nA.PassThrough,s=new ame.StringDecoder,a="";return r.on("data",n=>{let c=s.write(n),f;do if(f=c.indexOf(` +`),f!==-1){let p=a+c.substring(0,f);c=c.substring(f+1),a="",t(e!==null?`${e} ${p}`:p)}while(f!==-1);a+=c}),r.on("end",()=>{let n=s.end();n!==""&&t(e!==null?`${e} ${n}`:n)}),r}function ume(t,{prefix:e}){return{stdout:sme(r=>t.stdout.write(`${r} +`),t.stdout.isTTY?e:null),stderr:sme(r=>t.stderr.write(`${r} +`),t.stderr.isTTY?e:null)}}var ome,nA,ame,cm,Mc,a6,l6,c6=It(()=>{ome=et(J_()),nA=ye("stream"),ame=ye("string_decoder"),cm=new Set;Mc=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},a6=class{constructor(){this.stream=null}close(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");this.stream.end()}attach(e){this.stream=e}get(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");return this.stream}},l6=class t{constructor(e,r){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=r}static start(e,{stdin:r,stdout:s,stderr:a}){let n=new t(null,e);return n.stdin=r,n.stdout=s,n.stderr=a,n}pipeTo(e,r=1){let s=new t(this,e),a=new a6;return s.pipe=a,s.stdout=this.stdout,s.stderr=this.stderr,(r&1)===1?this.stdout=a:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(r&2)===2?this.stderr=a:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),s}async exec(){let e=["ignore","ignore","ignore"];if(this.pipe)e[0]="pipe";else{if(this.stdin===null)throw new Error("Assertion failed: No input stream registered");e[0]=this.stdin.get()}let r;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");r=this.stdout,e[1]=r.get();let s;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");s=this.stderr,e[2]=s.get();let a=this.implementation(e);return this.pipe&&this.pipe.attach(a.stdin),await a.promise.then(n=>(r.close(),s.close(),n))}async run(){let e=[];for(let s=this;s;s=s.ancestor)e.push(s.exec());return(await Promise.all(e))[0]}}});var Qv={};Vt(Qv,{EntryCommand:()=>Dv,ShellError:()=>Kl,execute:()=>SI,globUtils:()=>PT});function fme(t,e,r){let s=new Jl.PassThrough({autoDestroy:!0});switch(t){case 0:(e&1)===1&&r.stdin.pipe(s,{end:!1}),(e&2)===2&&r.stdin instanceof Jl.Writable&&s.pipe(r.stdin,{end:!1});break;case 1:(e&1)===1&&r.stdout.pipe(s,{end:!1}),(e&2)===2&&s.pipe(r.stdout,{end:!1});break;case 2:(e&1)===1&&r.stderr.pipe(s,{end:!1}),(e&2)===2&&s.pipe(r.stderr,{end:!1});break;default:throw new Kl(`Bad file descriptor: "${t}"`)}return s}function QT(t,e={}){let r={...t,...e};return r.environment={...t.environment,...e.environment},r.variables={...t.variables,...e.variables},r}async function kmt(t,e,r){let s=[],a=new Jl.PassThrough;return a.on("data",n=>s.push(n)),await TT(t,e,QT(r,{stdout:a})),Buffer.concat(s).toString().replace(/[\r\n]+$/,"")}async function Ame(t,e,r){let s=t.map(async n=>{let c=await um(n.args,e,r);return{name:n.name,value:c.join(" ")}});return(await Promise.all(s)).reduce((n,c)=>(n[c.name]=c.value,n),{})}function kT(t){return t.match(/[^ \r\n\t]+/g)||[]}async function yme(t,e,r,s,a=s){switch(t.name){case"$":s(String(process.pid));break;case"#":s(String(e.args.length));break;case"@":if(t.quoted)for(let n of e.args)a(n);else for(let n of e.args){let c=kT(n);for(let f=0;f=0&&n"u"&&(t.defaultValue?c=(await um(t.defaultValue,e,r)).join(" "):t.alternativeValue&&(c="")),typeof c>"u")throw f?new Kl(`Unbound argument #${n}`):new Kl(`Unbound variable "${t.name}"`);if(t.quoted)s(c);else{let p=kT(c);for(let E=0;Es.push(n));let a=Number(s.join(" "));return Number.isNaN(a)?Pv({type:"variable",name:s.join(" ")},e,r):Pv({type:"number",value:a},e,r)}else return Qmt[t.type](await Pv(t.left,e,r),await Pv(t.right,e,r))}async function um(t,e,r){let s=new Map,a=[],n=[],c=E=>{n.push(E)},f=()=>{n.length>0&&a.push(n.join("")),n=[]},p=E=>{c(E),f()},h=(E,C,S)=>{let P=JSON.stringify({type:E,fd:C}),I=s.get(P);typeof I>"u"&&s.set(P,I=[]),I.push(S)};for(let E of t){let C=!1;switch(E.type){case"redirection":{let S=await um(E.args,e,r);for(let P of S)h(E.subtype,E.fd,P)}break;case"argument":for(let S of E.segments)switch(S.type){case"text":c(S.text);break;case"glob":c(S.pattern),C=!0;break;case"shell":{let P=await kmt(S.shell,e,r);if(S.quoted)c(P);else{let I=kT(P);for(let R=0;R"u")throw new Error("Assertion failed: Expected a glob pattern to have been set");let P=await e.glob.match(S,{cwd:r.cwd,baseFs:e.baseFs});if(P.length===0){let I=i6(S)?". Note: Brace expansion of arbitrary strings isn't currently supported. For more details, please read this issue: https://github.com/yarnpkg/berry/issues/22":"";throw new Kl(`No matches found: "${S}"${I}`)}for(let I of P.sort())p(I)}}if(s.size>0){let E=[];for(let[C,S]of s.entries())E.splice(E.length,0,C,String(S.length),...S);a.splice(0,0,"__ysh_set_redirects",...E,"--")}return a}function xv(t,e,r){e.builtins.has(t[0])||(t=["command",...t]);let s=ue.fromPortablePath(r.cwd),a=r.environment;typeof a.PWD<"u"&&(a={...a,PWD:s});let[n,...c]=t;if(n==="command")return lme(c[0],c.slice(1),e,{cwd:s,env:a});let f=e.builtins.get(n);if(typeof f>"u")throw new Error(`Assertion failed: A builtin should exist for "${n}"`);return cme(async({stdin:p,stdout:h,stderr:E})=>{let{stdin:C,stdout:S,stderr:P}=r;r.stdin=p,r.stdout=h,r.stderr=E;try{return await f(c,e,r)}finally{r.stdin=C,r.stdout=S,r.stderr=P}})}function Tmt(t,e,r){return s=>{let a=new Jl.PassThrough,n=TT(t,e,QT(r,{stdin:a}));return{stdin:a,promise:n}}}function Rmt(t,e,r){return s=>{let a=new Jl.PassThrough,n=TT(t,e,r);return{stdin:a,promise:n}}}function pme(t,e,r,s){if(e.length===0)return t;{let a;do a=String(Math.random());while(Object.hasOwn(s.procedures,a));return s.procedures={...s.procedures},s.procedures[a]=t,xv([...e,"__ysh_run_procedure",a],r,s)}}async function hme(t,e,r){let s=t,a=null,n=null;for(;s;){let c=s.then?{...r}:r,f;switch(s.type){case"command":{let p=await um(s.args,e,r),h=await Ame(s.envs,e,r);f=s.envs.length?xv(p,e,QT(c,{environment:h})):xv(p,e,c)}break;case"subshell":{let p=await um(s.args,e,r),h=Tmt(s.subshell,e,c);f=pme(h,p,e,c)}break;case"group":{let p=await um(s.args,e,r),h=Rmt(s.group,e,c);f=pme(h,p,e,c)}break;case"envs":{let p=await Ame(s.envs,e,r);c.environment={...c.environment,...p},f=xv(["true"],e,c)}break}if(typeof f>"u")throw new Error("Assertion failed: An action should have been generated");if(a===null)n=xT(f,{stdin:new Mc(c.stdin),stdout:new Mc(c.stdout),stderr:new Mc(c.stderr)});else{if(n===null)throw new Error("Assertion failed: The execution pipeline should have been setup");switch(a){case"|":n=n.pipeTo(f,1);break;case"|&":n=n.pipeTo(f,3);break}}s.then?(a=s.then.type,s=s.then.chain):s=null}if(n===null)throw new Error("Assertion failed: The execution pipeline should have been setup");return await n.run()}async function Fmt(t,e,r,{background:s=!1}={}){function a(n){let c=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],f=c[n%c.length];return gme.default.hex(f)}if(s){let n=r.nextBackgroundJobIndex++,c=a(n),f=`[${n}]`,p=c(f),{stdout:h,stderr:E}=ume(r,{prefix:p});return r.backgroundJobs.push(hme(t,e,QT(r,{stdout:h,stderr:E})).catch(C=>E.write(`${C.message} +`)).finally(()=>{r.stdout.isTTY&&r.stdout.write(`Job ${p}, '${c(AE(t))}' has ended +`)})),0}return await hme(t,e,r)}async function Nmt(t,e,r,{background:s=!1}={}){let a,n=f=>{a=f,r.variables["?"]=String(f)},c=async f=>{try{return await Fmt(f.chain,e,r,{background:s&&typeof f.then>"u"})}catch(p){if(!(p instanceof Kl))throw p;return r.stderr.write(`${p.message} +`),1}};for(n(await c(t));t.then;){if(r.exitCode!==null)return r.exitCode;switch(t.then.type){case"&&":a===0&&n(await c(t.then.line));break;case"||":a!==0&&n(await c(t.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${t.then.type}"`)}t=t.then.line}return a}async function TT(t,e,r){let s=r.backgroundJobs;r.backgroundJobs=[];let a=0;for(let{command:n,type:c}of t){if(a=await Nmt(n,e,r,{background:c==="&"}),r.exitCode!==null)return r.exitCode;r.variables["?"]=String(a)}return await Promise.all(r.backgroundJobs),r.backgroundJobs=s,a}function Eme(t){switch(t.type){case"variable":return t.name==="@"||t.name==="#"||t.name==="*"||Number.isFinite(parseInt(t.name,10))||"defaultValue"in t&&!!t.defaultValue&&t.defaultValue.some(e=>kv(e))||"alternativeValue"in t&&!!t.alternativeValue&&t.alternativeValue.some(e=>kv(e));case"arithmetic":return u6(t.arithmetic);case"shell":return f6(t.shell);default:return!1}}function kv(t){switch(t.type){case"redirection":return t.args.some(e=>kv(e));case"argument":return t.segments.some(e=>Eme(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${t.type}"`)}}function u6(t){switch(t.type){case"variable":return Eme(t);case"number":return!1;default:return u6(t.left)||u6(t.right)}}function f6(t){return t.some(({command:e})=>{for(;e;){let r=e.chain;for(;r;){let s;switch(r.type){case"subshell":s=f6(r.subshell);break;case"command":s=r.envs.some(a=>a.args.some(n=>kv(n)))||r.args.some(a=>kv(a));break}if(s)return!0;if(!r.then)break;r=r.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function SI(t,e=[],{baseFs:r=new Yn,builtins:s={},cwd:a=ue.toPortablePath(process.cwd()),env:n=process.env,stdin:c=process.stdin,stdout:f=process.stdout,stderr:p=process.stderr,variables:h={},glob:E=PT}={}){let C={};for(let[I,R]of Object.entries(n))typeof R<"u"&&(C[I]=R);let S=new Map(xmt);for(let[I,R]of Object.entries(s))S.set(I,R);c===null&&(c=new Jl.PassThrough,c.end());let P=vx(t,E);if(!f6(P)&&P.length>0&&e.length>0){let{command:I}=P[P.length-1];for(;I.then;)I=I.then.line;let R=I.chain;for(;R.then;)R=R.then.chain;R.type==="command"&&(R.args=R.args.concat(e.map(N=>({type:"argument",segments:[{type:"text",text:N}]}))))}return await TT(P,{args:e,baseFs:r,builtins:S,initialStdin:c,initialStdout:f,initialStderr:p,glob:E},{cwd:a,environment:C,exitCode:null,procedures:{},stdin:c,stdout:f,stderr:p,variables:Object.assign({},h,{"?":0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var gme,dme,Jl,mme,xmt,Qmt,bv=It(()=>{bt();Bc();gme=et(g4()),dme=ye("os"),Jl=ye("stream"),mme=ye("timers/promises");$de();eme();ime();c6();c6();xmt=new Map([["cd",async([t=(0,dme.homedir)(),...e],r,s)=>{let a=K.resolve(s.cwd,ue.toPortablePath(t));if(!(await r.baseFs.statPromise(a).catch(c=>{throw c.code==="ENOENT"?new Kl(`cd: no such file or directory: ${t}`):c})).isDirectory())throw new Kl(`cd: not a directory: ${t}`);return s.cwd=a,0}],["pwd",async(t,e,r)=>(r.stdout.write(`${ue.fromPortablePath(r.cwd)} +`),0)],[":",async(t,e,r)=>0],["true",async(t,e,r)=>0],["false",async(t,e,r)=>1],["exit",async([t,...e],r,s)=>s.exitCode=parseInt(t??s.variables["?"],10)],["echo",async(t,e,r)=>(r.stdout.write(`${t.join(" ")} +`),0)],["sleep",async([t],e,r)=>{if(typeof t>"u")throw new Kl("sleep: missing operand");let s=Number(t);if(Number.isNaN(s))throw new Kl(`sleep: invalid time interval '${t}'`);return await(0,mme.setTimeout)(1e3*s,0)}],["unset",async(t,e,r)=>{for(let s of t)delete r.environment[s],delete r.variables[s];return 0}],["__ysh_run_procedure",async(t,e,r)=>{let s=r.procedures[t[0]];return await xT(s,{stdin:new Mc(r.stdin),stdout:new Mc(r.stdout),stderr:new Mc(r.stderr)}).run()}],["__ysh_set_redirects",async(t,e,r)=>{let s=r.stdin,a=r.stdout,n=r.stderr,c=[],f=[],p=[],h=0;for(;t[h]!=="--";){let C=t[h++],{type:S,fd:P}=JSON.parse(C),I=W=>{switch(P){case null:case 0:c.push(W);break;default:throw new Error(`Unsupported file descriptor: "${P}"`)}},R=W=>{switch(P){case null:case 1:f.push(W);break;case 2:p.push(W);break;default:throw new Error(`Unsupported file descriptor: "${P}"`)}},N=Number(t[h++]),U=h+N;for(let W=h;We.baseFs.createReadStream(K.resolve(r.cwd,ue.toPortablePath(t[W]))));break;case"<<<":I(()=>{let te=new Jl.PassThrough;return process.nextTick(()=>{te.write(`${t[W]} +`),te.end()}),te});break;case"<&":I(()=>fme(Number(t[W]),1,r));break;case">":case">>":{let te=K.resolve(r.cwd,ue.toPortablePath(t[W]));R(te==="/dev/null"?new Jl.Writable({autoDestroy:!0,emitClose:!0,write(ie,Ae,ce){setImmediate(ce)}}):e.baseFs.createWriteStream(te,S===">>"?{flags:"a"}:void 0))}break;case">&":R(fme(Number(t[W]),2,r));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${S}"`)}}if(c.length>0){let C=new Jl.PassThrough;s=C;let S=P=>{if(P===c.length)C.end();else{let I=c[P]();I.pipe(C,{end:!1}),I.on("end",()=>{S(P+1)})}};S(0)}if(f.length>0){let C=new Jl.PassThrough;a=C;for(let S of f)C.pipe(S)}if(p.length>0){let C=new Jl.PassThrough;n=C;for(let S of p)C.pipe(S)}let E=await xT(xv(t.slice(h+1),e,r),{stdin:new Mc(s),stdout:new Mc(a),stderr:new Mc(n)}).run();return await Promise.all(f.map(C=>new Promise((S,P)=>{C.on("error",I=>{P(I)}),C.on("close",()=>{S()}),C.end()}))),await Promise.all(p.map(C=>new Promise((S,P)=>{C.on("error",I=>{P(I)}),C.on("close",()=>{S()}),C.end()}))),E}]]);Qmt={addition:(t,e)=>t+e,subtraction:(t,e)=>t-e,multiplication:(t,e)=>t*e,division:(t,e)=>Math.trunc(t/e)}});var RT=L((y$t,Ime)=>{function Omt(t,e){for(var r=-1,s=t==null?0:t.length,a=Array(s);++r{var Cme=Yd(),Lmt=RT(),Mmt=xc(),_mt=aI(),Umt=1/0,wme=Cme?Cme.prototype:void 0,Bme=wme?wme.toString:void 0;function vme(t){if(typeof t=="string")return t;if(Mmt(t))return Lmt(t,vme)+"";if(_mt(t))return Bme?Bme.call(t):"";var e=t+"";return e=="0"&&1/t==-Umt?"-0":e}Sme.exports=vme});var Tv=L((I$t,bme)=>{var Hmt=Dme();function jmt(t){return t==null?"":Hmt(t)}bme.exports=jmt});var A6=L((C$t,Pme)=>{function qmt(t,e,r){var s=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++s{var Gmt=A6();function Wmt(t,e,r){var s=t.length;return r=r===void 0?s:r,!e&&r>=s?t:Gmt(t,e,r)}xme.exports=Wmt});var p6=L((B$t,Qme)=>{var Ymt="\\ud800-\\udfff",Vmt="\\u0300-\\u036f",Kmt="\\ufe20-\\ufe2f",Jmt="\\u20d0-\\u20ff",zmt=Vmt+Kmt+Jmt,Zmt="\\ufe0e\\ufe0f",Xmt="\\u200d",$mt=RegExp("["+Xmt+Ymt+zmt+Zmt+"]");function eyt(t){return $mt.test(t)}Qme.exports=eyt});var Rme=L((v$t,Tme)=>{function tyt(t){return t.split("")}Tme.exports=tyt});var Hme=L((S$t,Ume)=>{var Fme="\\ud800-\\udfff",ryt="\\u0300-\\u036f",nyt="\\ufe20-\\ufe2f",iyt="\\u20d0-\\u20ff",syt=ryt+nyt+iyt,oyt="\\ufe0e\\ufe0f",ayt="["+Fme+"]",h6="["+syt+"]",g6="\\ud83c[\\udffb-\\udfff]",lyt="(?:"+h6+"|"+g6+")",Nme="[^"+Fme+"]",Ome="(?:\\ud83c[\\udde6-\\uddff]){2}",Lme="[\\ud800-\\udbff][\\udc00-\\udfff]",cyt="\\u200d",Mme=lyt+"?",_me="["+oyt+"]?",uyt="(?:"+cyt+"(?:"+[Nme,Ome,Lme].join("|")+")"+_me+Mme+")*",fyt=_me+Mme+uyt,Ayt="(?:"+[Nme+h6+"?",h6,Ome,Lme,ayt].join("|")+")",pyt=RegExp(g6+"(?="+g6+")|"+Ayt+fyt,"g");function hyt(t){return t.match(pyt)||[]}Ume.exports=hyt});var qme=L((D$t,jme)=>{var gyt=Rme(),dyt=p6(),myt=Hme();function yyt(t){return dyt(t)?myt(t):gyt(t)}jme.exports=yyt});var Wme=L((b$t,Gme)=>{var Eyt=kme(),Iyt=p6(),Cyt=qme(),wyt=Tv();function Byt(t){return function(e){e=wyt(e);var r=Iyt(e)?Cyt(e):void 0,s=r?r[0]:e.charAt(0),a=r?Eyt(r,1).join(""):e.slice(1);return s[t]()+a}}Gme.exports=Byt});var Vme=L((P$t,Yme)=>{var vyt=Wme(),Syt=vyt("toUpperCase");Yme.exports=Syt});var d6=L((x$t,Kme)=>{var Dyt=Tv(),byt=Vme();function Pyt(t){return byt(Dyt(t).toLowerCase())}Kme.exports=Pyt});var Jme=L((k$t,FT)=>{function xyt(){var t=0,e=1,r=2,s=3,a=4,n=5,c=6,f=7,p=8,h=9,E=10,C=11,S=12,P=13,I=14,R=15,N=16,U=17,W=0,te=1,ie=2,Ae=3,ce=4;function me(g,we){return 55296<=g.charCodeAt(we)&&g.charCodeAt(we)<=56319&&56320<=g.charCodeAt(we+1)&&g.charCodeAt(we+1)<=57343}function pe(g,we){we===void 0&&(we=0);var Ee=g.charCodeAt(we);if(55296<=Ee&&Ee<=56319&&we=1){var fe=g.charCodeAt(we-1),se=Ee;return 55296<=fe&&fe<=56319?(fe-55296)*1024+(se-56320)+65536:se}return Ee}function Be(g,we,Ee){var fe=[g].concat(we).concat([Ee]),se=fe[fe.length-2],X=Ee,De=fe.lastIndexOf(I);if(De>1&&fe.slice(1,De).every(function(j){return j==s})&&[s,P,U].indexOf(g)==-1)return ie;var Re=fe.lastIndexOf(a);if(Re>0&&fe.slice(1,Re).every(function(j){return j==a})&&[S,a].indexOf(se)==-1)return fe.filter(function(j){return j==a}).length%2==1?Ae:ce;if(se==t&&X==e)return W;if(se==r||se==t||se==e)return X==I&&we.every(function(j){return j==s})?ie:te;if(X==r||X==t||X==e)return te;if(se==c&&(X==c||X==f||X==h||X==E))return W;if((se==h||se==f)&&(X==f||X==p))return W;if((se==E||se==p)&&X==p)return W;if(X==s||X==R)return W;if(X==n)return W;if(se==S)return W;var gt=fe.indexOf(s)!=-1?fe.lastIndexOf(s)-1:fe.length-2;return[P,U].indexOf(fe[gt])!=-1&&fe.slice(gt+1,-1).every(function(j){return j==s})&&X==I||se==R&&[N,U].indexOf(X)!=-1?W:we.indexOf(a)!=-1?ie:se==a&&X==a?W:te}this.nextBreak=function(g,we){if(we===void 0&&(we=0),we<0)return 0;if(we>=g.length-1)return g.length;for(var Ee=Ce(pe(g,we)),fe=[],se=we+1;se{var kyt=/^(.*?)(\x1b\[[^m]+m|\x1b\]8;;.*?(\x1b\\|\u0007))/,NT;function Qyt(){if(NT)return NT;if(typeof Intl.Segmenter<"u"){let t=new Intl.Segmenter("en",{granularity:"grapheme"});return NT=e=>Array.from(t.segment(e),({segment:r})=>r)}else{let t=Jme(),e=new t;return NT=r=>e.splitGraphemes(r)}}zme.exports=(t,e=0,r=t.length)=>{if(e<0||r<0)throw new RangeError("Negative indices aren't supported by this implementation");let s=r-e,a="",n=0,c=0;for(;t.length>0;){let f=t.match(kyt)||[t,t,void 0],p=Qyt()(f[1]),h=Math.min(e-n,p.length);p=p.slice(h);let E=Math.min(s-c,p.length);a+=p.slice(0,E).join(""),n+=h,c+=E,typeof f[2]<"u"&&(a+=f[2]),t=t.slice(f[0].length)}return a}});var un,Rv=It(()=>{un=process.env.YARN_IS_TEST_ENV?"0.0.0":"4.9.1"});function nye(t,{configuration:e,json:r}){if(!e.get("enableMessageNames"))return"";let a=Vf(t===null?0:t);return!r&&t===null?Ut(e,a,"grey"):a}function m6(t,{configuration:e,json:r}){let s=nye(t,{configuration:e,json:r});if(!s||t===null||t===0)return s;let a=Dr[t],n=`https://yarnpkg.com/advanced/error-codes#${s}---${a}`.toLowerCase();return JE(e,s,n)}async function DI({configuration:t,stdout:e,forceError:r},s){let a=await Ot.start({configuration:t,stdout:e,includeFooter:!1},async n=>{let c=!1,f=!1;for(let p of s)typeof p.option<"u"&&(p.error||r?(f=!0,n.reportError(50,p.message)):(c=!0,n.reportWarning(50,p.message)),p.callback?.());c&&!f&&n.reportSeparator()});return a.hasErrors()?a.exitCode():null}var tye,OT,Tyt,Xme,$me,b0,rye,eye,Ryt,Fyt,LT,Nyt,Ot,Fv=It(()=>{tye=et(Zme()),OT=et(Nd());nk();Fc();Rv();Qc();Tyt="\xB7",Xme=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],$me=80,b0=OT.default.GITHUB_ACTIONS?{start:t=>`::group::${t} +`,end:t=>`::endgroup:: +`}:OT.default.TRAVIS?{start:t=>`travis_fold:start:${t} +`,end:t=>`travis_fold:end:${t} +`}:OT.default.GITLAB?{start:t=>`section_start:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}[collapsed=true]\r\x1B[0K${t} +`,end:t=>`section_end:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r\x1B[0K`}:null,rye=b0!==null,eye=new Date,Ryt=["iTerm.app","Apple_Terminal","WarpTerminal","vscode"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,Fyt=t=>t,LT=Fyt({patrick:{date:[17,3],chars:["\u{1F340}","\u{1F331}"],size:40},simba:{date:[19,7],chars:["\u{1F981}","\u{1F334}"],size:40},jack:{date:[31,10],chars:["\u{1F383}","\u{1F987}"],size:40},hogsfather:{date:[31,12],chars:["\u{1F389}","\u{1F384}"],size:40},default:{chars:["=","-"],size:80}}),Nyt=Ryt&&Object.keys(LT).find(t=>{let e=LT[t];return!(e.date&&(e.date[0]!==eye.getDate()||e.date[1]!==eye.getMonth()+1))})||"default";Ot=class extends ho{constructor({configuration:r,stdout:s,json:a=!1,forceSectionAlignment:n=!1,includeNames:c=!0,includePrefix:f=!0,includeFooter:p=!0,includeLogs:h=!a,includeInfos:E=h,includeWarnings:C=h}){super();this.uncommitted=new Set;this.warningCount=0;this.errorCount=0;this.timerFooter=[];this.startTime=Date.now();this.indent=0;this.level=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.progressStyle=null;this.progressMaxScaledSize=null;if(YB(this,{configuration:r}),this.configuration=r,this.forceSectionAlignment=n,this.includeNames=c,this.includePrefix=f,this.includeFooter=p,this.includeInfos=E,this.includeWarnings=C,this.json=a,this.stdout=s,r.get("enableProgressBars")&&!a&&s.isTTY&&s.columns>22){let S=r.get("progressBarStyle")||Nyt;if(!Object.hasOwn(LT,S))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=LT[S];let P=Math.min(this.getRecommendedLength(),80);this.progressMaxScaledSize=Math.floor(this.progressStyle.size*P/80)}}static async start(r,s){let a=new this(r),n=process.emitWarning;process.emitWarning=(c,f)=>{if(typeof c!="string"){let h=c;c=h.message,f=f??h.name}let p=typeof f<"u"?`${f}: ${c}`:c;a.reportWarning(0,p)},r.includeVersion&&a.reportInfo(0,zd(r.configuration,`Yarn ${un}`,2));try{await s(a)}catch(c){a.reportExceptionOnce(c)}finally{await a.finalize(),process.emitWarning=n}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}getRecommendedLength(){let s=this.progressStyle!==null?this.stdout.columns-1:super.getRecommendedLength();return Math.max(40,s-12-this.indent*2)}startSectionSync({reportHeader:r,reportFooter:s,skipIfEmpty:a},n){let c={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(c):(c.action(),c.committed=!0);let f=Date.now();try{return n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(c),c.committed&&s?.(p-f)}}async startSectionPromise({reportHeader:r,reportFooter:s,skipIfEmpty:a},n){let c={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(c):(c.action(),c.committed=!0);let f=Date.now();try{return await n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(c),c.committed&&s?.(p-f)}}startTimerImpl(r,s,a){return{cb:typeof s=="function"?s:a,reportHeader:()=>{this.level+=1,this.reportInfo(null,`\u250C ${r}`),this.indent+=1,b0!==null&&!this.json&&this.includeInfos&&this.stdout.write(b0.start(r))},reportFooter:f=>{if(this.indent-=1,b0!==null&&!this.json&&this.includeInfos){this.stdout.write(b0.end(r));for(let p of this.timerFooter)p()}this.configuration.get("enableTimers")&&f>200?this.reportInfo(null,`\u2514 Completed in ${Ut(this.configuration,f,Ct.DURATION)}`):this.reportInfo(null,"\u2514 Completed"),this.level-=1},skipIfEmpty:(typeof s=="function"?{}:s).skipIfEmpty}}startTimerSync(r,s,a){let{cb:n,...c}=this.startTimerImpl(r,s,a);return this.startSectionSync(c,n)}async startTimerPromise(r,s,a){let{cb:n,...c}=this.startTimerImpl(r,s,a);return this.startSectionPromise(c,n)}reportSeparator(){this.indent===0?this.writeLine(""):this.reportInfo(null,"")}reportInfo(r,s){if(!this.includeInfos)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"",c=`${this.formatPrefix(n,"blueBright")}${s}`;this.json?this.reportJson({type:"info",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(c)}reportWarning(r,s){if(this.warningCount+=1,!this.includeWarnings)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"warning",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(`${this.formatPrefix(n,"yellowBright")}${s}`)}reportError(r,s){this.errorCount+=1,this.timerFooter.push(()=>this.reportErrorImpl(r,s)),this.reportErrorImpl(r,s)}reportErrorImpl(r,s){this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"error",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(`${this.formatPrefix(n,"redBright")}${s}`,{truncate:!1})}reportFold(r,s){if(!b0)return;let a=`${b0.start(r)}${s}${b0.end(r)}`;this.timerFooter.push(()=>this.stdout.write(a))}reportProgress(r){if(this.progressStyle===null)return{...Promise.resolve(),stop:()=>{}};if(r.hasProgress&&r.hasTitle)throw new Error("Unimplemented: Progress bars can't have both progress and titles.");let s=!1,a=Promise.resolve().then(async()=>{let c={progress:r.hasProgress?0:void 0,title:r.hasTitle?"":void 0};this.progress.set(r,{definition:c,lastScaledSize:r.hasProgress?-1:void 0,lastTitle:void 0}),this.refreshProgress({delta:-1});for await(let{progress:f,title:p}of r)s||c.progress===f&&c.title===p||(c.progress=f,c.title=p,this.refreshProgress());n()}),n=()=>{s||(s=!0,this.progress.delete(r),this.refreshProgress({delta:1}))};return{...a,stop:n}}reportJson(r){this.json&&this.writeLine(`${JSON.stringify(r)}`)}async finalize(){if(!this.includeFooter)return;let r="";this.errorCount>0?r="Failed with errors":this.warningCount>0?r="Done with warnings":r="Done";let s=Ut(this.configuration,Date.now()-this.startTime,Ct.DURATION),a=this.configuration.get("enableTimers")?`${r} in ${s}`:r;this.errorCount>0?this.reportError(0,a):this.warningCount>0?this.reportWarning(0,a):this.reportInfo(0,a)}writeLine(r,{truncate:s}={}){this.clearProgress({clear:!0}),this.stdout.write(`${this.truncate(r,{truncate:s})} +`),this.writeProgress()}writeLines(r,{truncate:s}={}){this.clearProgress({delta:r.length});for(let a of r)this.stdout.write(`${this.truncate(a,{truncate:s})} +`);this.writeProgress()}commit(){let r=this.uncommitted;this.uncommitted=new Set;for(let s of r)s.committed=!0,s.action()}clearProgress({delta:r=0,clear:s=!1}){this.progressStyle!==null&&this.progress.size+r>0&&(this.stdout.write(`\x1B[${this.progress.size+r}A`),(r>0||s)&&this.stdout.write("\x1B[0J"))}writeProgress(){if(this.progressStyle===null||(this.progressTimeout!==null&&clearTimeout(this.progressTimeout),this.progressTimeout=null,this.progress.size===0))return;let r=Date.now();r-this.progressTime>$me&&(this.progressFrame=(this.progressFrame+1)%Xme.length,this.progressTime=r);let s=Xme[this.progressFrame];for(let a of this.progress.values()){let n="";if(typeof a.lastScaledSize<"u"){let h=this.progressStyle.chars[0].repeat(a.lastScaledSize),E=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-a.lastScaledSize);n=` ${h}${E}`}let c=this.formatName(null),f=c?`${c}: `:"",p=a.definition.title?` ${a.definition.title}`:"";this.stdout.write(`${Ut(this.configuration,"\u27A4","blueBright")} ${f}${s}${n}${p} +`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress({force:!0})},$me)}refreshProgress({delta:r=0,force:s=!1}={}){let a=!1,n=!1;if(s||this.progress.size===0)a=!0;else for(let c of this.progress.values()){let f=typeof c.definition.progress<"u"?Math.trunc(this.progressMaxScaledSize*c.definition.progress):void 0,p=c.lastScaledSize;c.lastScaledSize=f;let h=c.lastTitle;if(c.lastTitle=c.definition.title,f!==p||(n=h!==c.definition.title)){a=!0;break}}a&&(this.clearProgress({delta:r,clear:n}),this.writeProgress())}truncate(r,{truncate:s}={}){return this.progressStyle===null&&(s=!1),typeof s>"u"&&(s=this.configuration.get("preferTruncatedLines")),s&&(r=(0,tye.default)(r,0,this.stdout.columns-1)),r}formatName(r){return this.includeNames?nye(r,{configuration:this.configuration,json:this.json}):""}formatPrefix(r,s){return this.includePrefix?`${Ut(this.configuration,"\u27A4",s)} ${r}${this.formatIndent()}`:""}formatNameWithHyperlink(r){return this.includeNames?m6(r,{configuration:this.configuration,json:this.json}):""}formatIndent(){return this.level>0||!this.forceSectionAlignment?"\u2502 ".repeat(this.indent):`${Tyt} `}}});var In={};Vt(In,{PackageManager:()=>oye,detectPackageManager:()=>aye,executePackageAccessibleBinary:()=>Aye,executePackageScript:()=>MT,executePackageShellcode:()=>y6,executeWorkspaceAccessibleBinary:()=>jyt,executeWorkspaceLifecycleScript:()=>uye,executeWorkspaceScript:()=>cye,getPackageAccessibleBinaries:()=>_T,getWorkspaceAccessibleBinaries:()=>fye,hasPackageScript:()=>_yt,hasWorkspaceScript:()=>E6,isNodeScript:()=>I6,makeScriptEnv:()=>Nv,maybeExecuteWorkspaceLifecycleScript:()=>Hyt,prepareExternalProject:()=>Myt});async function P0(t,e,r,s=[]){if(process.platform==="win32"){let a=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${r}" ${s.map(n=>`"${n.replace('"','""')}"`).join(" ")} %*`;await le.writeFilePromise(K.format({dir:t,name:e,ext:".cmd"}),a)}await le.writeFilePromise(K.join(t,e),`#!/bin/sh +exec "${r}" ${s.map(a=>`'${a.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@" +`,{mode:493})}async function aye(t){let e=await Ht.tryFind(t);if(e?.packageManager){let s=xQ(e.packageManager);if(s?.name){let a=`found ${JSON.stringify({packageManager:e.packageManager})} in manifest`,[n]=s.reference.split(".");switch(s.name){case"yarn":return{packageManagerField:!0,packageManager:Number(n)===1?"Yarn Classic":"Yarn",reason:a};case"npm":return{packageManagerField:!0,packageManager:"npm",reason:a};case"pnpm":return{packageManagerField:!0,packageManager:"pnpm",reason:a}}}}let r;try{r=await le.readFilePromise(K.join(t,Er.lockfile),"utf8")}catch{}return r!==void 0?r.match(/^__metadata:$/m)?{packageManager:"Yarn",reason:'"__metadata" key found in yarn.lock'}:{packageManager:"Yarn Classic",reason:'"__metadata" key not found in yarn.lock, must be a Yarn classic lockfile'}:le.existsSync(K.join(t,"package-lock.json"))?{packageManager:"npm",reason:`found npm's "package-lock.json" lockfile`}:le.existsSync(K.join(t,"pnpm-lock.yaml"))?{packageManager:"pnpm",reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function Nv({project:t,locator:e,binFolder:r,ignoreCorepack:s,lifecycleScript:a,baseEnv:n=t?.configuration.env??process.env}){let c={};for(let[E,C]of Object.entries(n))typeof C<"u"&&(c[E.toLowerCase()!=="path"?E:"PATH"]=C);let f=ue.fromPortablePath(r);c.BERRY_BIN_FOLDER=ue.fromPortablePath(f);let p=process.env.COREPACK_ROOT&&!s?ue.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([P0(r,"node",process.execPath),...un!==null?[P0(r,"run",process.execPath,[p,"run"]),P0(r,"yarn",process.execPath,[p]),P0(r,"yarnpkg",process.execPath,[p]),P0(r,"node-gyp",process.execPath,[p,"run","--top-level","node-gyp"])]:[]]),t&&(c.INIT_CWD=ue.fromPortablePath(t.configuration.startingCwd),c.PROJECT_CWD=ue.fromPortablePath(t.cwd)),c.PATH=c.PATH?`${f}${ue.delimiter}${c.PATH}`:`${f}`,c.npm_execpath=`${f}${ue.sep}yarn`,c.npm_node_execpath=`${f}${ue.sep}node`,e){if(!t)throw new Error("Assertion failed: Missing project");let E=t.tryWorkspaceByLocator(e),C=E?E.manifest.version??"":t.storedPackages.get(e.locatorHash).version??"";c.npm_package_name=cn(e),c.npm_package_version=C;let S;if(E)S=E.cwd;else{let P=t.storedPackages.get(e.locatorHash);if(!P)throw new Error(`Package for ${Yr(t.configuration,e)} not found in the project`);let I=t.configuration.getLinkers(),R={project:t,report:new Ot({stdout:new x0.PassThrough,configuration:t.configuration})},N=I.find(U=>U.supportsPackage(P,R));if(!N)throw new Error(`The package ${Yr(t.configuration,P)} isn't supported by any of the available linkers`);S=await N.findPackageLocation(P,R)}c.npm_package_json=ue.fromPortablePath(K.join(S,Er.manifest))}let h=un!==null?`yarn/${un}`:`yarn/${kp("@yarnpkg/core").version}-core`;return c.npm_config_user_agent=`${h} npm/? node/${process.version} ${process.platform} ${process.arch}`,a&&(c.npm_lifecycle_event=a),t&&await t.configuration.triggerHook(E=>E.setupScriptEnvironment,t,c,async(E,C,S)=>await P0(r,E,C,S)),c}async function Myt(t,e,{configuration:r,report:s,workspace:a=null,locator:n=null}){await Lyt(async()=>{await le.mktempPromise(async c=>{let f=K.join(c,"pack.log"),p=null,{stdout:h,stderr:E}=r.getSubprocessStreams(f,{prefix:ue.fromPortablePath(t),report:s}),C=n&&Gu(n)?rI(n):n,S=C?cl(C):"an external project";h.write(`Packing ${S} from sources +`);let P=await aye(t),I;P!==null?(h.write(`Using ${P.packageManager} for bootstrap. Reason: ${P.reason} + +`),I=P.packageManager):(h.write(`No package manager configuration detected; defaulting to Yarn + +`),I="Yarn");let R=I==="Yarn"&&!P?.packageManagerField;await le.mktempPromise(async N=>{let U=await Nv({binFolder:N,ignoreCorepack:R,baseEnv:{...process.env,COREPACK_ENABLE_AUTO_PIN:"0"}}),te=new Map([["Yarn Classic",async()=>{let Ae=a!==null?["workspace",a]:[],ce=K.join(t,Er.manifest),me=await le.readFilePromise(ce),pe=await Yu(process.execPath,[process.argv[1],"set","version","classic","--only-if-needed","--yarn-path"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(pe.code!==0)return pe.code;await le.writeFilePromise(ce,me),await le.appendFilePromise(K.join(t,".npmignore"),`/.yarn +`),h.write(` +`),delete U.NODE_ENV;let Be=await Yu("yarn",["install"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(Be.code!==0)return Be.code;h.write(` +`);let Ce=await Yu("yarn",[...Ae,"pack","--filename",ue.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return Ce.code!==0?Ce.code:0}],["Yarn",async()=>{let Ae=a!==null?["workspace",a]:[];U.YARN_ENABLE_INLINE_BUILDS="1";let ce=K.join(t,Er.lockfile);await le.existsPromise(ce)||await le.writeFilePromise(ce,"");let me=await Yu("yarn",[...Ae,"pack","--install-if-needed","--filename",ue.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return me.code!==0?me.code:0}],["npm",async()=>{if(a!==null){let we=new x0.PassThrough,Ee=WE(we);we.pipe(h,{end:!1});let fe=await Yu("npm",["--version"],{cwd:t,env:U,stdin:p,stdout:we,stderr:E,end:0});if(we.end(),fe.code!==0)return h.end(),E.end(),fe.code;let se=(await Ee).toString().trim();if(!eA(se,">=7.x")){let X=ba(null,"npm"),De=On(X,se),Re=On(X,">=7.x");throw new Error(`Workspaces aren't supported by ${ri(r,De)}; please upgrade to ${ri(r,Re)} (npm has been detected as the primary package manager for ${Ut(r,t,Ct.PATH)})`)}}let Ae=a!==null?["--workspace",a]:[];delete U.npm_config_user_agent,delete U.npm_config_production,delete U.NPM_CONFIG_PRODUCTION,delete U.NODE_ENV;let ce=await Yu("npm",["install","--legacy-peer-deps"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(ce.code!==0)return ce.code;let me=new x0.PassThrough,pe=WE(me);me.pipe(h);let Be=await Yu("npm",["pack","--silent",...Ae],{cwd:t,env:U,stdin:p,stdout:me,stderr:E});if(Be.code!==0)return Be.code;let Ce=(await pe).toString().trim().replace(/^.*\n/s,""),g=K.resolve(t,ue.toPortablePath(Ce));return await le.renamePromise(g,e),0}]]).get(I);if(typeof te>"u")throw new Error("Assertion failed: Unsupported workflow");let ie=await te();if(!(ie===0||typeof ie>"u"))throw le.detachTemp(c),new Yt(58,`Packing the package failed (exit code ${ie}, logs can be found here: ${Ut(r,f,Ct.PATH)})`)})})})}async function _yt(t,e,{project:r}){let s=r.tryWorkspaceByLocator(t);if(s!==null)return E6(s,e);let a=r.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${Yr(r.configuration,t)} not found in the project`);return await tA.openPromise(async n=>{let c=r.configuration,f=r.configuration.getLinkers(),p={project:r,report:new Ot({stdout:new x0.PassThrough,configuration:c})},h=f.find(P=>P.supportsPackage(a,p));if(!h)throw new Error(`The package ${Yr(r.configuration,a)} isn't supported by any of the available linkers`);let E=await h.findPackageLocation(a,p),C=new Sn(E,{baseFs:n});return(await Ht.find(vt.dot,{baseFs:C})).scripts.has(e)})}async function MT(t,e,r,{cwd:s,project:a,stdin:n,stdout:c,stderr:f}){return await le.mktempPromise(async p=>{let{manifest:h,env:E,cwd:C}=await lye(t,{project:a,binFolder:p,cwd:s,lifecycleScript:e}),S=h.scripts.get(e);if(typeof S>"u")return 1;let P=async()=>await SI(S,r,{cwd:C,env:E,stdin:n,stdout:c,stderr:f});return await(await a.configuration.reduceHook(R=>R.wrapScriptExecution,P,a,t,e,{script:S,args:r,cwd:C,env:E,stdin:n,stdout:c,stderr:f}))()})}async function y6(t,e,r,{cwd:s,project:a,stdin:n,stdout:c,stderr:f}){return await le.mktempPromise(async p=>{let{env:h,cwd:E}=await lye(t,{project:a,binFolder:p,cwd:s});return await SI(e,r,{cwd:E,env:h,stdin:n,stdout:c,stderr:f})})}async function Uyt(t,{binFolder:e,cwd:r,lifecycleScript:s}){let a=await Nv({project:t.project,locator:t.anchoredLocator,binFolder:e,lifecycleScript:s});return await C6(e,await fye(t)),typeof r>"u"&&(r=K.dirname(await le.realpathPromise(K.join(t.cwd,"package.json")))),{manifest:t.manifest,binFolder:e,env:a,cwd:r}}async function lye(t,{project:e,binFolder:r,cwd:s,lifecycleScript:a}){let n=e.tryWorkspaceByLocator(t);if(n!==null)return Uyt(n,{binFolder:r,cwd:s,lifecycleScript:a});let c=e.storedPackages.get(t.locatorHash);if(!c)throw new Error(`Package for ${Yr(e.configuration,t)} not found in the project`);return await tA.openPromise(async f=>{let p=e.configuration,h=e.configuration.getLinkers(),E={project:e,report:new Ot({stdout:new x0.PassThrough,configuration:p})},C=h.find(N=>N.supportsPackage(c,E));if(!C)throw new Error(`The package ${Yr(e.configuration,c)} isn't supported by any of the available linkers`);let S=await Nv({project:e,locator:t,binFolder:r,lifecycleScript:a});await C6(r,await _T(t,{project:e}));let P=await C.findPackageLocation(c,E),I=new Sn(P,{baseFs:f}),R=await Ht.find(vt.dot,{baseFs:I});return typeof s>"u"&&(s=P),{manifest:R,binFolder:r,env:S,cwd:s}})}async function cye(t,e,r,{cwd:s,stdin:a,stdout:n,stderr:c}){return await MT(t.anchoredLocator,e,r,{cwd:s,project:t.project,stdin:a,stdout:n,stderr:c})}function E6(t,e){return t.manifest.scripts.has(e)}async function uye(t,e,{cwd:r,report:s}){let{configuration:a}=t.project,n=null;await le.mktempPromise(async c=>{let f=K.join(c,`${e}.log`),p=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${ue.fromPortablePath(t.cwd)}") +`,{stdout:h,stderr:E}=a.getSubprocessStreams(f,{report:s,prefix:Yr(a,t.anchoredLocator),header:p});s.reportInfo(36,`Calling the "${e}" lifecycle script`);let C=await cye(t,e,[],{cwd:r,stdin:n,stdout:h,stderr:E});if(h.end(),E.end(),C!==0)throw le.detachTemp(c),new Yt(36,`${(0,iye.default)(e)} script failed (exit code ${Ut(a,C,Ct.NUMBER)}, logs can be found here: ${Ut(a,f,Ct.PATH)}); run ${Ut(a,`yarn ${e}`,Ct.CODE)} to investigate`)})}async function Hyt(t,e,r){E6(t,e)&&await uye(t,e,r)}function I6(t){let e=K.extname(t);if(e.match(/\.[cm]?[jt]sx?$/))return!0;if(e===".exe"||e===".bin")return!1;let r=Buffer.alloc(4),s;try{s=le.openSync(t,"r")}catch{return!0}try{le.readSync(s,r,0,r.length,0)}finally{le.closeSync(s)}let a=r.readUint32BE();return!(a===3405691582||a===3489328638||a===2135247942||(a&4294901760)===1297743872)}async function _T(t,{project:e}){let r=e.configuration,s=new Map,a=e.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${Yr(r,t)} not found in the project`);let n=new x0.Writable,c=r.getLinkers(),f={project:e,report:new Ot({configuration:r,stdout:n})},p=new Set([t.locatorHash]);for(let E of a.dependencies.values()){let C=e.storedResolutions.get(E.descriptorHash);if(!C)throw new Error(`Assertion failed: The resolution (${ri(r,E)}) should have been registered`);p.add(C)}let h=await Promise.all(Array.from(p,async E=>{let C=e.storedPackages.get(E);if(!C)throw new Error(`Assertion failed: The package (${E}) should have been registered`);if(C.bin.size===0)return Yl.skip;let S=c.find(I=>I.supportsPackage(C,f));if(!S)return Yl.skip;let P=null;try{P=await S.findPackageLocation(C,f)}catch(I){if(I.code==="LOCATOR_NOT_INSTALLED")return Yl.skip;throw I}return{dependency:C,packageLocation:P}}));for(let E of h){if(E===Yl.skip)continue;let{dependency:C,packageLocation:S}=E;for(let[P,I]of C.bin){let R=K.resolve(S,I);s.set(P,[C,ue.fromPortablePath(R),I6(R)])}}return s}async function fye(t){return await _T(t.anchoredLocator,{project:t.project})}async function C6(t,e){await Promise.all(Array.from(e,([r,[,s,a]])=>a?P0(t,r,process.execPath,[s]):P0(t,r,s,[])))}async function Aye(t,e,r,{cwd:s,project:a,stdin:n,stdout:c,stderr:f,nodeArgs:p=[],packageAccessibleBinaries:h}){h??=await _T(t,{project:a});let E=h.get(e);if(!E)throw new Error(`Binary not found (${e}) for ${Yr(a.configuration,t)}`);return await le.mktempPromise(async C=>{let[,S]=E,P=await Nv({project:a,locator:t,binFolder:C});await C6(P.BERRY_BIN_FOLDER,h);let I=I6(ue.toPortablePath(S))?Yu(process.execPath,[...p,S,...r],{cwd:s,env:P,stdin:n,stdout:c,stderr:f}):Yu(S,r,{cwd:s,env:P,stdin:n,stdout:c,stderr:f}),R;try{R=await I}finally{await le.removePromise(P.BERRY_BIN_FOLDER)}return R.code})}async function jyt(t,e,r,{cwd:s,stdin:a,stdout:n,stderr:c,packageAccessibleBinaries:f}){return await Aye(t.anchoredLocator,e,r,{project:t.project,cwd:s,stdin:a,stdout:n,stderr:c,packageAccessibleBinaries:f})}var iye,sye,x0,oye,Oyt,Lyt,w6=It(()=>{bt();bt();rA();bv();iye=et(d6()),sye=et(Md()),x0=ye("stream");oI();Fc();Fv();Rv();dT();Qc();kc();Np();Yo();oye=(a=>(a.Yarn1="Yarn Classic",a.Yarn2="Yarn",a.Npm="npm",a.Pnpm="pnpm",a))(oye||{});Oyt=2,Lyt=(0,sye.default)(Oyt)});var bI=L((X$t,hye)=>{"use strict";var pye=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);hye.exports=t=>t?Object.keys(t).map(e=>[pye.has(e)?pye.get(e):e,t[e]]).reduce((e,r)=>(e[r[0]]=r[1],e),Object.create(null)):{}});var xI=L(($$t,Bye)=>{"use strict";var gye=typeof process=="object"&&process?process:{stdout:null,stderr:null},qyt=ye("events"),dye=ye("stream"),mye=ye("string_decoder").StringDecoder,qp=Symbol("EOF"),Gp=Symbol("maybeEmitEnd"),k0=Symbol("emittedEnd"),UT=Symbol("emittingEnd"),Ov=Symbol("emittedError"),HT=Symbol("closed"),yye=Symbol("read"),jT=Symbol("flush"),Eye=Symbol("flushChunk"),fl=Symbol("encoding"),Wp=Symbol("decoder"),qT=Symbol("flowing"),Lv=Symbol("paused"),PI=Symbol("resume"),Vs=Symbol("bufferLength"),B6=Symbol("bufferPush"),v6=Symbol("bufferShift"),zo=Symbol("objectMode"),Zo=Symbol("destroyed"),S6=Symbol("emitData"),Iye=Symbol("emitEnd"),D6=Symbol("emitEnd2"),Yp=Symbol("async"),Mv=t=>Promise.resolve().then(t),Cye=global._MP_NO_ITERATOR_SYMBOLS_!=="1",Gyt=Cye&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),Wyt=Cye&&Symbol.iterator||Symbol("iterator not implemented"),Yyt=t=>t==="end"||t==="finish"||t==="prefinish",Vyt=t=>t instanceof ArrayBuffer||typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Kyt=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),GT=class{constructor(e,r,s){this.src=e,this.dest=r,this.opts=s,this.ondrain=()=>e[PI](),r.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},b6=class extends GT{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,s){super(e,r,s),this.proxyErrors=a=>r.emit("error",a),e.on("error",this.proxyErrors)}};Bye.exports=class wye extends dye{constructor(e){super(),this[qT]=!1,this[Lv]=!1,this.pipes=[],this.buffer=[],this[zo]=e&&e.objectMode||!1,this[zo]?this[fl]=null:this[fl]=e&&e.encoding||null,this[fl]==="buffer"&&(this[fl]=null),this[Yp]=e&&!!e.async||!1,this[Wp]=this[fl]?new mye(this[fl]):null,this[qp]=!1,this[k0]=!1,this[UT]=!1,this[HT]=!1,this[Ov]=null,this.writable=!0,this.readable=!0,this[Vs]=0,this[Zo]=!1}get bufferLength(){return this[Vs]}get encoding(){return this[fl]}set encoding(e){if(this[zo])throw new Error("cannot set encoding in objectMode");if(this[fl]&&e!==this[fl]&&(this[Wp]&&this[Wp].lastNeed||this[Vs]))throw new Error("cannot change encoding");this[fl]!==e&&(this[Wp]=e?new mye(e):null,this.buffer.length&&(this.buffer=this.buffer.map(r=>this[Wp].write(r)))),this[fl]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[zo]}set objectMode(e){this[zo]=this[zo]||!!e}get async(){return this[Yp]}set async(e){this[Yp]=this[Yp]||!!e}write(e,r,s){if(this[qp])throw new Error("write after end");if(this[Zo])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(s=r,r="utf8"),r||(r="utf8");let a=this[Yp]?Mv:n=>n();return!this[zo]&&!Buffer.isBuffer(e)&&(Kyt(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):Vyt(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[zo]?(this.flowing&&this[Vs]!==0&&this[jT](!0),this.flowing?this.emit("data",e):this[B6](e),this[Vs]!==0&&this.emit("readable"),s&&a(s),this.flowing):e.length?(typeof e=="string"&&!(r===this[fl]&&!this[Wp].lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[fl]&&(e=this[Wp].write(e)),this.flowing&&this[Vs]!==0&&this[jT](!0),this.flowing?this.emit("data",e):this[B6](e),this[Vs]!==0&&this.emit("readable"),s&&a(s),this.flowing):(this[Vs]!==0&&this.emit("readable"),s&&a(s),this.flowing)}read(e){if(this[Zo])return null;if(this[Vs]===0||e===0||e>this[Vs])return this[Gp](),null;this[zo]&&(e=null),this.buffer.length>1&&!this[zo]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[Vs])]);let r=this[yye](e||null,this.buffer[0]);return this[Gp](),r}[yye](e,r){return e===r.length||e===null?this[v6]():(this.buffer[0]=r.slice(e),r=r.slice(0,e),this[Vs]-=e),this.emit("data",r),!this.buffer.length&&!this[qp]&&this.emit("drain"),r}end(e,r,s){return typeof e=="function"&&(s=e,e=null),typeof r=="function"&&(s=r,r="utf8"),e&&this.write(e,r),s&&this.once("end",s),this[qp]=!0,this.writable=!1,(this.flowing||!this[Lv])&&this[Gp](),this}[PI](){this[Zo]||(this[Lv]=!1,this[qT]=!0,this.emit("resume"),this.buffer.length?this[jT]():this[qp]?this[Gp]():this.emit("drain"))}resume(){return this[PI]()}pause(){this[qT]=!1,this[Lv]=!0}get destroyed(){return this[Zo]}get flowing(){return this[qT]}get paused(){return this[Lv]}[B6](e){this[zo]?this[Vs]+=1:this[Vs]+=e.length,this.buffer.push(e)}[v6](){return this.buffer.length&&(this[zo]?this[Vs]-=1:this[Vs]-=this.buffer[0].length),this.buffer.shift()}[jT](e){do;while(this[Eye](this[v6]()));!e&&!this.buffer.length&&!this[qp]&&this.emit("drain")}[Eye](e){return e?(this.emit("data",e),this.flowing):!1}pipe(e,r){if(this[Zo])return;let s=this[k0];return r=r||{},e===gye.stdout||e===gye.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,s?r.end&&e.end():(this.pipes.push(r.proxyErrors?new b6(this,e,r):new GT(this,e,r)),this[Yp]?Mv(()=>this[PI]()):this[PI]()),e}unpipe(e){let r=this.pipes.find(s=>s.dest===e);r&&(this.pipes.splice(this.pipes.indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let s=super.on(e,r);return e==="data"&&!this.pipes.length&&!this.flowing?this[PI]():e==="readable"&&this[Vs]!==0?super.emit("readable"):Yyt(e)&&this[k0]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[Ov]&&(this[Yp]?Mv(()=>r.call(this,this[Ov])):r.call(this,this[Ov])),s}get emittedEnd(){return this[k0]}[Gp](){!this[UT]&&!this[k0]&&!this[Zo]&&this.buffer.length===0&&this[qp]&&(this[UT]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[HT]&&this.emit("close"),this[UT]=!1)}emit(e,r,...s){if(e!=="error"&&e!=="close"&&e!==Zo&&this[Zo])return;if(e==="data")return r?this[Yp]?Mv(()=>this[S6](r)):this[S6](r):!1;if(e==="end")return this[Iye]();if(e==="close"){if(this[HT]=!0,!this[k0]&&!this[Zo])return;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[Ov]=r;let n=super.emit("error",r);return this[Gp](),n}else if(e==="resume"){let n=super.emit("resume");return this[Gp](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let a=super.emit(e,r,...s);return this[Gp](),a}[S6](e){for(let s of this.pipes)s.dest.write(e)===!1&&this.pause();let r=super.emit("data",e);return this[Gp](),r}[Iye](){this[k0]||(this[k0]=!0,this.readable=!1,this[Yp]?Mv(()=>this[D6]()):this[D6]())}[D6](){if(this[Wp]){let r=this[Wp].end();if(r){for(let s of this.pipes)s.dest.write(r);super.emit("data",r)}}for(let r of this.pipes)r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[zo]||(e.dataLength=0);let r=this.promise();return this.on("data",s=>{e.push(s),this[zo]||(e.dataLength+=s.length)}),r.then(()=>e)}concat(){return this[zo]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[zo]?Promise.reject(new Error("cannot concat in objectMode")):this[fl]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,r)=>{this.on(Zo,()=>r(new Error("stream destroyed"))),this.on("error",s=>r(s)),this.on("end",()=>e())})}[Gyt](){return{next:()=>{let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[qp])return Promise.resolve({done:!0});let s=null,a=null,n=h=>{this.removeListener("data",c),this.removeListener("end",f),a(h)},c=h=>{this.removeListener("error",n),this.removeListener("end",f),this.pause(),s({value:h,done:!!this[qp]})},f=()=>{this.removeListener("error",n),this.removeListener("data",c),s({done:!0})},p=()=>n(new Error("stream destroyed"));return new Promise((h,E)=>{a=E,s=h,this.once(Zo,p),this.once("error",n),this.once("end",f),this.once("data",c)})}}}[Wyt](){return{next:()=>{let r=this.read();return{value:r,done:r===null}}}}destroy(e){return this[Zo]?(e?this.emit("error",e):this.emit(Zo),this):(this[Zo]=!0,this.buffer.length=0,this[Vs]=0,typeof this.close=="function"&&!this[HT]&&this.close(),e?this.emit("error",e):this.emit(Zo),this)}static isStream(e){return!!e&&(e instanceof wye||e instanceof dye||e instanceof qyt&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}}});var Sye=L((eer,vye)=>{var Jyt=ye("zlib").constants||{ZLIB_VERNUM:4736};vye.exports=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Jyt))});var q6=L(zl=>{"use strict";var T6=ye("assert"),Q0=ye("buffer").Buffer,Pye=ye("zlib"),fm=zl.constants=Sye(),zyt=xI(),Dye=Q0.concat,Am=Symbol("_superWrite"),QI=class extends Error{constructor(e){super("zlib: "+e.message),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}},Zyt=Symbol("opts"),_v=Symbol("flushFlag"),bye=Symbol("finishFlushFlag"),j6=Symbol("fullFlushFlag"),Ei=Symbol("handle"),WT=Symbol("onError"),kI=Symbol("sawError"),P6=Symbol("level"),x6=Symbol("strategy"),k6=Symbol("ended"),ter=Symbol("_defaultFullFlush"),YT=class extends zyt{constructor(e,r){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");super(e),this[kI]=!1,this[k6]=!1,this[Zyt]=e,this[_v]=e.flush,this[bye]=e.finishFlush;try{this[Ei]=new Pye[r](e)}catch(s){throw new QI(s)}this[WT]=s=>{this[kI]||(this[kI]=!0,this.close(),this.emit("error",s))},this[Ei].on("error",s=>this[WT](new QI(s))),this.once("end",()=>this.close)}close(){this[Ei]&&(this[Ei].close(),this[Ei]=null,this.emit("close"))}reset(){if(!this[kI])return T6(this[Ei],"zlib binding closed"),this[Ei].reset()}flush(e){this.ended||(typeof e!="number"&&(e=this[j6]),this.write(Object.assign(Q0.alloc(0),{[_v]:e})))}end(e,r,s){return e&&this.write(e,r),this.flush(this[bye]),this[k6]=!0,super.end(null,null,s)}get ended(){return this[k6]}write(e,r,s){if(typeof r=="function"&&(s=r,r="utf8"),typeof e=="string"&&(e=Q0.from(e,r)),this[kI])return;T6(this[Ei],"zlib binding closed");let a=this[Ei]._handle,n=a.close;a.close=()=>{};let c=this[Ei].close;this[Ei].close=()=>{},Q0.concat=h=>h;let f;try{let h=typeof e[_v]=="number"?e[_v]:this[_v];f=this[Ei]._processChunk(e,h),Q0.concat=Dye}catch(h){Q0.concat=Dye,this[WT](new QI(h))}finally{this[Ei]&&(this[Ei]._handle=a,a.close=n,this[Ei].close=c,this[Ei].removeAllListeners("error"))}this[Ei]&&this[Ei].on("error",h=>this[WT](new QI(h)));let p;if(f)if(Array.isArray(f)&&f.length>0){p=this[Am](Q0.from(f[0]));for(let h=1;h{this.flush(a),n()};try{this[Ei].params(e,r)}finally{this[Ei].flush=s}this[Ei]&&(this[P6]=e,this[x6]=r)}}}},R6=class extends Vp{constructor(e){super(e,"Deflate")}},F6=class extends Vp{constructor(e){super(e,"Inflate")}},Q6=Symbol("_portable"),N6=class extends Vp{constructor(e){super(e,"Gzip"),this[Q6]=e&&!!e.portable}[Am](e){return this[Q6]?(this[Q6]=!1,e[9]=255,super[Am](e)):super[Am](e)}},O6=class extends Vp{constructor(e){super(e,"Gunzip")}},L6=class extends Vp{constructor(e){super(e,"DeflateRaw")}},M6=class extends Vp{constructor(e){super(e,"InflateRaw")}},_6=class extends Vp{constructor(e){super(e,"Unzip")}},VT=class extends YT{constructor(e,r){e=e||{},e.flush=e.flush||fm.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||fm.BROTLI_OPERATION_FINISH,super(e,r),this[j6]=fm.BROTLI_OPERATION_FLUSH}},U6=class extends VT{constructor(e){super(e,"BrotliCompress")}},H6=class extends VT{constructor(e){super(e,"BrotliDecompress")}};zl.Deflate=R6;zl.Inflate=F6;zl.Gzip=N6;zl.Gunzip=O6;zl.DeflateRaw=L6;zl.InflateRaw=M6;zl.Unzip=_6;typeof Pye.BrotliCompress=="function"?(zl.BrotliCompress=U6,zl.BrotliDecompress=H6):zl.BrotliCompress=zl.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}}});var TI=L((ier,xye)=>{var Xyt=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;xye.exports=Xyt!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/")});var KT=L((oer,kye)=>{"use strict";var $yt=xI(),G6=TI(),W6=Symbol("slurp");kye.exports=class extends $yt{constructor(e,r,s){switch(super(),this.pause(),this.extended=r,this.globalExtended=s,this.header=e,this.startBlockSize=512*Math.ceil(e.size/512),this.blockRemain=this.startBlockSize,this.remain=e.size,this.type=e.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=G6(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=e.size,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=G6(e.linkpath),this.uname=e.uname,this.gname=e.gname,r&&this[W6](r),s&&this[W6](s,!0)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");let s=this.remain,a=this.blockRemain;return this.remain=Math.max(0,s-r),this.blockRemain=Math.max(0,a-r),this.ignore?!0:s>=r?super.write(e):super.write(e.slice(0,s))}[W6](e,r){for(let s in e)e[s]!==null&&e[s]!==void 0&&!(r&&s==="path")&&(this[s]=s==="path"||s==="linkpath"?G6(e[s]):e[s])}}});var Y6=L(JT=>{"use strict";JT.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);JT.code=new Map(Array.from(JT.name).map(t=>[t[1],t[0]]))});var Fye=L((ler,Rye)=>{"use strict";var eEt=(t,e)=>{if(Number.isSafeInteger(t))t<0?rEt(t,e):tEt(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},tEt=(t,e)=>{e[0]=128;for(var r=e.length;r>1;r--)e[r-1]=t&255,t=Math.floor(t/256)},rEt=(t,e)=>{e[0]=255;var r=!1;t=t*-1;for(var s=e.length;s>1;s--){var a=t&255;t=Math.floor(t/256),r?e[s-1]=Qye(a):a===0?e[s-1]=0:(r=!0,e[s-1]=Tye(a))}},nEt=t=>{let e=t[0],r=e===128?sEt(t.slice(1,t.length)):e===255?iEt(t):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},iEt=t=>{for(var e=t.length,r=0,s=!1,a=e-1;a>-1;a--){var n=t[a],c;s?c=Qye(n):n===0?c=n:(s=!0,c=Tye(n)),c!==0&&(r-=c*Math.pow(256,e-a-1))}return r},sEt=t=>{for(var e=t.length,r=0,s=e-1;s>-1;s--){var a=t[s];a!==0&&(r+=a*Math.pow(256,e-s-1))}return r},Qye=t=>(255^t)&255,Tye=t=>(255^t)+1&255;Rye.exports={encode:eEt,parse:nEt}});var FI=L((cer,Oye)=>{"use strict";var V6=Y6(),RI=ye("path").posix,Nye=Fye(),K6=Symbol("slurp"),Zl=Symbol("type"),Z6=class{constructor(e,r,s,a){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[Zl]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(e)?this.decode(e,r||0,s,a):e&&this.set(e)}decode(e,r,s,a){if(r||(r=0),!e||!(e.length>=r+512))throw new Error("need 512 bytes for header");if(this.path=pm(e,r,100),this.mode=T0(e,r+100,8),this.uid=T0(e,r+108,8),this.gid=T0(e,r+116,8),this.size=T0(e,r+124,12),this.mtime=J6(e,r+136,12),this.cksum=T0(e,r+148,12),this[K6](s),this[K6](a,!0),this[Zl]=pm(e,r+156,1),this[Zl]===""&&(this[Zl]="0"),this[Zl]==="0"&&this.path.substr(-1)==="/"&&(this[Zl]="5"),this[Zl]==="5"&&(this.size=0),this.linkpath=pm(e,r+157,100),e.slice(r+257,r+265).toString()==="ustar\x0000")if(this.uname=pm(e,r+265,32),this.gname=pm(e,r+297,32),this.devmaj=T0(e,r+329,8),this.devmin=T0(e,r+337,8),e[r+475]!==0){let c=pm(e,r+345,155);this.path=c+"/"+this.path}else{let c=pm(e,r+345,130);c&&(this.path=c+"/"+this.path),this.atime=J6(e,r+476,12),this.ctime=J6(e,r+488,12)}let n=8*32;for(let c=r;c=r+512))throw new Error("need 512 bytes for header");let s=this.ctime||this.atime?130:155,a=oEt(this.path||"",s),n=a[0],c=a[1];this.needPax=a[2],this.needPax=hm(e,r,100,n)||this.needPax,this.needPax=R0(e,r+100,8,this.mode)||this.needPax,this.needPax=R0(e,r+108,8,this.uid)||this.needPax,this.needPax=R0(e,r+116,8,this.gid)||this.needPax,this.needPax=R0(e,r+124,12,this.size)||this.needPax,this.needPax=z6(e,r+136,12,this.mtime)||this.needPax,e[r+156]=this[Zl].charCodeAt(0),this.needPax=hm(e,r+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",r+257,8),this.needPax=hm(e,r+265,32,this.uname)||this.needPax,this.needPax=hm(e,r+297,32,this.gname)||this.needPax,this.needPax=R0(e,r+329,8,this.devmaj)||this.needPax,this.needPax=R0(e,r+337,8,this.devmin)||this.needPax,this.needPax=hm(e,r+345,s,c)||this.needPax,e[r+475]!==0?this.needPax=hm(e,r+345,155,c)||this.needPax:(this.needPax=hm(e,r+345,130,c)||this.needPax,this.needPax=z6(e,r+476,12,this.atime)||this.needPax,this.needPax=z6(e,r+488,12,this.ctime)||this.needPax);let f=8*32;for(let p=r;p{let s=t,a="",n,c=RI.parse(t).root||".";if(Buffer.byteLength(s)<100)n=[s,a,!1];else{a=RI.dirname(s),s=RI.basename(s);do Buffer.byteLength(s)<=100&&Buffer.byteLength(a)<=e?n=[s,a,!1]:Buffer.byteLength(s)>100&&Buffer.byteLength(a)<=e?n=[s.substr(0,99),a,!0]:(s=RI.join(RI.basename(a),s),a=RI.dirname(a));while(a!==c&&!n);n||(n=[t.substr(0,99),"",!0])}return n},pm=(t,e,r)=>t.slice(e,e+r).toString("utf8").replace(/\0.*/,""),J6=(t,e,r)=>aEt(T0(t,e,r)),aEt=t=>t===null?null:new Date(t*1e3),T0=(t,e,r)=>t[e]&128?Nye.parse(t.slice(e,e+r)):cEt(t,e,r),lEt=t=>isNaN(t)?null:t,cEt=(t,e,r)=>lEt(parseInt(t.slice(e,e+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),uEt={12:8589934591,8:2097151},R0=(t,e,r,s)=>s===null?!1:s>uEt[r]||s<0?(Nye.encode(s,t.slice(e,e+r)),!0):(fEt(t,e,r,s),!1),fEt=(t,e,r,s)=>t.write(AEt(s,r),e,r,"ascii"),AEt=(t,e)=>pEt(Math.floor(t).toString(8),e),pEt=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",z6=(t,e,r,s)=>s===null?!1:R0(t,e,r,s.getTime()/1e3),hEt=new Array(156).join("\0"),hm=(t,e,r,s)=>s===null?!1:(t.write(s+hEt,e,r,"utf8"),s.length!==Buffer.byteLength(s)||s.length>r);Oye.exports=Z6});var zT=L((uer,Lye)=>{"use strict";var gEt=FI(),dEt=ye("path"),Uv=class{constructor(e,r){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=r||!1}encode(){let e=this.encodeBody();if(e==="")return null;let r=Buffer.byteLength(e),s=512*Math.ceil(1+r/512),a=Buffer.allocUnsafe(s);for(let n=0;n<512;n++)a[n]=0;new gEt({path:("PaxHeader/"+dEt.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:r,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(a),a.write(e,512,r,"utf8");for(let n=r+512;n=Math.pow(10,n)&&(n+=1),n+a+s}};Uv.parse=(t,e,r)=>new Uv(mEt(yEt(t),e),r);var mEt=(t,e)=>e?Object.keys(t).reduce((r,s)=>(r[s]=t[s],r),e):t,yEt=t=>t.replace(/\n$/,"").split(` +`).reduce(EEt,Object.create(null)),EEt=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.substr((r+" ").length);let s=e.split("="),a=s.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!a)return t;let n=s.join("=");return t[a]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(a)?new Date(n*1e3):/^[0-9]+$/.test(n)?+n:n,t};Lye.exports=Uv});var NI=L((fer,Mye)=>{Mye.exports=t=>{let e=t.length-1,r=-1;for(;e>-1&&t.charAt(e)==="/";)r=e,e--;return r===-1?t:t.slice(0,r)}});var ZT=L((Aer,_ye)=>{"use strict";_ye.exports=t=>class extends t{warn(e,r,s={}){this.file&&(s.file=this.file),this.cwd&&(s.cwd=this.cwd),s.code=r instanceof Error&&r.code||e,s.tarCode=e,!this.strict&&s.recoverable!==!1?(r instanceof Error&&(s=Object.assign(r,s),r=r.message),this.emit("warn",s.tarCode,r,s)):r instanceof Error?this.emit("error",Object.assign(r,s)):this.emit("error",Object.assign(new Error(`${e}: ${r}`),s))}}});var $6=L((her,Uye)=>{"use strict";var XT=["|","<",">","?",":"],X6=XT.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),IEt=new Map(XT.map((t,e)=>[t,X6[e]])),CEt=new Map(X6.map((t,e)=>[t,XT[e]]));Uye.exports={encode:t=>XT.reduce((e,r)=>e.split(r).join(IEt.get(r)),t),decode:t=>X6.reduce((e,r)=>e.split(r).join(CEt.get(r)),t)}});var eq=L((ger,jye)=>{var{isAbsolute:wEt,parse:Hye}=ye("path").win32;jye.exports=t=>{let e="",r=Hye(t);for(;wEt(t)||r.root;){let s=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.substr(s.length),e+=s,r=Hye(t)}return[e,t]}});var Gye=L((der,qye)=>{"use strict";qye.exports=(t,e,r)=>(t&=4095,r&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t)});var uq=L((Eer,iEe)=>{"use strict";var Zye=xI(),Xye=zT(),$ye=FI(),sA=ye("fs"),Wye=ye("path"),iA=TI(),BEt=NI(),eEe=(t,e)=>e?(t=iA(t).replace(/^\.(\/|$)/,""),BEt(e)+"/"+t):iA(t),vEt=16*1024*1024,Yye=Symbol("process"),Vye=Symbol("file"),Kye=Symbol("directory"),rq=Symbol("symlink"),Jye=Symbol("hardlink"),Hv=Symbol("header"),$T=Symbol("read"),nq=Symbol("lstat"),eR=Symbol("onlstat"),iq=Symbol("onread"),sq=Symbol("onreadlink"),oq=Symbol("openfile"),aq=Symbol("onopenfile"),F0=Symbol("close"),tR=Symbol("mode"),lq=Symbol("awaitDrain"),tq=Symbol("ondrain"),oA=Symbol("prefix"),zye=Symbol("hadError"),tEe=ZT(),SEt=$6(),rEe=eq(),nEe=Gye(),rR=tEe(class extends Zye{constructor(e,r){if(r=r||{},super(r),typeof e!="string")throw new TypeError("path is required");this.path=iA(e),this.portable=!!r.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=r.maxReadSize||vEt,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=iA(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime||null,this.prefix=r.prefix?iA(r.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let s=!1;if(!this.preservePaths){let[a,n]=rEe(this.path);a&&(this.path=n,s=a)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=SEt.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=iA(r.absolute||Wye.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path}),this.statCache.has(this.absolute)?this[eR](this.statCache.get(this.absolute)):this[nq]()}emit(e,...r){return e==="error"&&(this[zye]=!0),super.emit(e,...r)}[nq](){sA.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[eR](r)})}[eR](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=bEt(e),this.emit("stat",e),this[Yye]()}[Yye](){switch(this.type){case"File":return this[Vye]();case"Directory":return this[Kye]();case"SymbolicLink":return this[rq]();default:return this.end()}}[tR](e){return nEe(e,this.type==="Directory",this.portable)}[oA](e){return eEe(e,this.prefix)}[Hv](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new $ye({path:this[oA](this.path),linkpath:this.type==="Link"?this[oA](this.linkpath):this.linkpath,mode:this[tR](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Xye({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[oA](this.path),linkpath:this.type==="Link"?this[oA](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[Kye](){this.path.substr(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Hv](),this.end()}[rq](){sA.readlink(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[sq](r)})}[sq](e){this.linkpath=iA(e),this[Hv](),this.end()}[Jye](e){this.type="Link",this.linkpath=iA(Wye.relative(this.cwd,e)),this.stat.size=0,this[Hv](),this.end()}[Vye](){if(this.stat.nlink>1){let e=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(e)){let r=this.linkCache.get(e);if(r.indexOf(this.cwd)===0)return this[Jye](r)}this.linkCache.set(e,this.absolute)}if(this[Hv](),this.stat.size===0)return this.end();this[oq]()}[oq](){sA.open(this.absolute,"r",(e,r)=>{if(e)return this.emit("error",e);this[aq](r)})}[aq](e){if(this.fd=e,this[zye])return this[F0]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[$T]()}[$T](){let{fd:e,buf:r,offset:s,length:a,pos:n}=this;sA.read(e,r,s,a,n,(c,f)=>{if(c)return this[F0](()=>this.emit("error",c));this[iq](f)})}[F0](e){sA.close(this.fd,e)}[iq](e){if(e<=0&&this.remain>0){let a=new Error("encountered unexpected EOF");return a.path=this.absolute,a.syscall="read",a.code="EOF",this[F0](()=>this.emit("error",a))}if(e>this.remain){let a=new Error("did not encounter expected EOF");return a.path=this.absolute,a.syscall="read",a.code="EOF",this[F0](()=>this.emit("error",a))}if(e===this.remain)for(let a=e;athis[tq]())}[lq](e){this.once("drain",e)}write(e){if(this.blockRemaine?this.emit("error",e):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[$T]()}}),cq=class extends rR{[nq](){this[eR](sA.lstatSync(this.absolute))}[rq](){this[sq](sA.readlinkSync(this.absolute))}[oq](){this[aq](sA.openSync(this.absolute,"r"))}[$T](){let e=!0;try{let{fd:r,buf:s,offset:a,length:n,pos:c}=this,f=sA.readSync(r,s,a,n,c);this[iq](f),e=!1}finally{if(e)try{this[F0](()=>{})}catch{}}}[lq](e){e()}[F0](e){sA.closeSync(this.fd),e()}},DEt=tEe(class extends Zye{constructor(e,r){r=r||{},super(r),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.readEntry=e,this.type=e.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix||null,this.path=iA(e.path),this.mode=this[tR](e.mode),this.uid=this.portable?null:e.uid,this.gid=this.portable?null:e.gid,this.uname=this.portable?null:e.uname,this.gname=this.portable?null:e.gname,this.size=e.size,this.mtime=this.noMtime?null:r.mtime||e.mtime,this.atime=this.portable?null:e.atime,this.ctime=this.portable?null:e.ctime,this.linkpath=iA(e.linkpath),typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let s=!1;if(!this.preservePaths){let[a,n]=rEe(this.path);a&&(this.path=n,s=a)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new $ye({path:this[oA](this.path),linkpath:this.type==="Link"?this[oA](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path}),this.header.encode()&&!this.noPax&&super.write(new Xye({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[oA](this.path),linkpath:this.type==="Link"?this[oA](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),e.pipe(this)}[oA](e){return eEe(e,this.prefix)}[tR](e){return nEe(e,this.type==="Directory",this.portable)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});rR.Sync=cq;rR.Tar=DEt;var bEt=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";iEe.exports=rR});var fR=L((Cer,fEe)=>{"use strict";var cR=class{constructor(e,r){this.path=e||"./",this.absolute=r,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}},PEt=xI(),xEt=q6(),kEt=KT(),Eq=uq(),QEt=Eq.Sync,TEt=Eq.Tar,REt=pk(),sEe=Buffer.alloc(1024),sR=Symbol("onStat"),nR=Symbol("ended"),aA=Symbol("queue"),OI=Symbol("current"),gm=Symbol("process"),iR=Symbol("processing"),oEe=Symbol("processJob"),lA=Symbol("jobs"),fq=Symbol("jobDone"),oR=Symbol("addFSEntry"),aEe=Symbol("addTarEntry"),gq=Symbol("stat"),dq=Symbol("readdir"),aR=Symbol("onreaddir"),lR=Symbol("pipe"),lEe=Symbol("entry"),Aq=Symbol("entryOpt"),mq=Symbol("writeEntryClass"),uEe=Symbol("write"),pq=Symbol("ondrain"),uR=ye("fs"),cEe=ye("path"),FEt=ZT(),hq=TI(),Iq=FEt(class extends PEt{constructor(e){super(e),e=e||Object.create(null),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=hq(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this[mq]=Eq,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,this.zip=null,e.gzip?(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new xEt.Gzip(e.gzip),this.zip.on("data",r=>super.write(r)),this.zip.on("end",r=>super.end()),this.zip.on("drain",r=>this[pq]()),this.on("resume",r=>this.zip.resume())):this.on("drain",this[pq]),this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,this.filter=typeof e.filter=="function"?e.filter:r=>!0,this[aA]=new REt,this[lA]=0,this.jobs=+e.jobs||4,this[iR]=!1,this[nR]=!1}[uEe](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.write(e),this[nR]=!0,this[gm](),this}write(e){if(this[nR])throw new Error("write after end");return e instanceof kEt?this[aEe](e):this[oR](e),this.flowing}[aEe](e){let r=hq(cEe.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let s=new cR(e.path,r,!1);s.entry=new TEt(e,this[Aq](s)),s.entry.on("end",a=>this[fq](s)),this[lA]+=1,this[aA].push(s)}this[gm]()}[oR](e){let r=hq(cEe.resolve(this.cwd,e));this[aA].push(new cR(e,r)),this[gm]()}[gq](e){e.pending=!0,this[lA]+=1;let r=this.follow?"stat":"lstat";uR[r](e.absolute,(s,a)=>{e.pending=!1,this[lA]-=1,s?this.emit("error",s):this[sR](e,a)})}[sR](e,r){this.statCache.set(e.absolute,r),e.stat=r,this.filter(e.path,r)||(e.ignore=!0),this[gm]()}[dq](e){e.pending=!0,this[lA]+=1,uR.readdir(e.absolute,(r,s)=>{if(e.pending=!1,this[lA]-=1,r)return this.emit("error",r);this[aR](e,s)})}[aR](e,r){this.readdirCache.set(e.absolute,r),e.readdir=r,this[gm]()}[gm](){if(!this[iR]){this[iR]=!0;for(let e=this[aA].head;e!==null&&this[lA]this.warn(r,s,a),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[lEe](e){this[lA]+=1;try{return new this[mq](e.path,this[Aq](e)).on("end",()=>this[fq](e)).on("error",r=>this.emit("error",r))}catch(r){this.emit("error",r)}}[pq](){this[OI]&&this[OI].entry&&this[OI].entry.resume()}[lR](e){e.piped=!0,e.readdir&&e.readdir.forEach(a=>{let n=e.path,c=n==="./"?"":n.replace(/\/*$/,"/");this[oR](c+a)});let r=e.entry,s=this.zip;s?r.on("data",a=>{s.write(a)||r.pause()}):r.on("data",a=>{super.write(a)||r.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}}),yq=class extends Iq{constructor(e){super(e),this[mq]=QEt}pause(){}resume(){}[gq](e){let r=this.follow?"statSync":"lstatSync";this[sR](e,uR[r](e.absolute))}[dq](e,r){this[aR](e,uR.readdirSync(e.absolute))}[lR](e){let r=e.entry,s=this.zip;e.readdir&&e.readdir.forEach(a=>{let n=e.path,c=n==="./"?"":n.replace(/\/*$/,"/");this[oR](c+a)}),s?r.on("data",a=>{s.write(a)}):r.on("data",a=>{super[uEe](a)})}};Iq.Sync=yq;fEe.exports=Iq});var GI=L(qv=>{"use strict";var NEt=xI(),OEt=ye("events").EventEmitter,Al=ye("fs"),Bq=Al.writev;if(!Bq){let t=process.binding("fs"),e=t.FSReqWrap||t.FSReqCallback;Bq=(r,s,a,n)=>{let c=(p,h)=>n(p,h,s),f=new e;f.oncomplete=c,t.writeBuffers(r,s,a,f)}}var jI=Symbol("_autoClose"),Vu=Symbol("_close"),jv=Symbol("_ended"),ni=Symbol("_fd"),AEe=Symbol("_finished"),O0=Symbol("_flags"),Cq=Symbol("_flush"),vq=Symbol("_handleChunk"),Sq=Symbol("_makeBuf"),dR=Symbol("_mode"),AR=Symbol("_needDrain"),UI=Symbol("_onerror"),qI=Symbol("_onopen"),wq=Symbol("_onread"),MI=Symbol("_onwrite"),L0=Symbol("_open"),Kp=Symbol("_path"),dm=Symbol("_pos"),cA=Symbol("_queue"),_I=Symbol("_read"),pEe=Symbol("_readSize"),N0=Symbol("_reading"),pR=Symbol("_remain"),hEe=Symbol("_size"),hR=Symbol("_write"),LI=Symbol("_writing"),gR=Symbol("_defaultFlag"),HI=Symbol("_errored"),mR=class extends NEt{constructor(e,r){if(r=r||{},super(r),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[HI]=!1,this[ni]=typeof r.fd=="number"?r.fd:null,this[Kp]=e,this[pEe]=r.readSize||16*1024*1024,this[N0]=!1,this[hEe]=typeof r.size=="number"?r.size:1/0,this[pR]=this[hEe],this[jI]=typeof r.autoClose=="boolean"?r.autoClose:!0,typeof this[ni]=="number"?this[_I]():this[L0]()}get fd(){return this[ni]}get path(){return this[Kp]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[L0](){Al.open(this[Kp],"r",(e,r)=>this[qI](e,r))}[qI](e,r){e?this[UI](e):(this[ni]=r,this.emit("open",r),this[_I]())}[Sq](){return Buffer.allocUnsafe(Math.min(this[pEe],this[pR]))}[_I](){if(!this[N0]){this[N0]=!0;let e=this[Sq]();if(e.length===0)return process.nextTick(()=>this[wq](null,0,e));Al.read(this[ni],e,0,e.length,null,(r,s,a)=>this[wq](r,s,a))}}[wq](e,r,s){this[N0]=!1,e?this[UI](e):this[vq](r,s)&&this[_I]()}[Vu](){if(this[jI]&&typeof this[ni]=="number"){let e=this[ni];this[ni]=null,Al.close(e,r=>r?this.emit("error",r):this.emit("close"))}}[UI](e){this[N0]=!0,this[Vu](),this.emit("error",e)}[vq](e,r){let s=!1;return this[pR]-=e,e>0&&(s=super.write(ethis[qI](e,r))}[qI](e,r){this[gR]&&this[O0]==="r+"&&e&&e.code==="ENOENT"?(this[O0]="w",this[L0]()):e?this[UI](e):(this[ni]=r,this.emit("open",r),this[Cq]())}end(e,r){return e&&this.write(e,r),this[jv]=!0,!this[LI]&&!this[cA].length&&typeof this[ni]=="number"&&this[MI](null,0),this}write(e,r){return typeof e=="string"&&(e=Buffer.from(e,r)),this[jv]?(this.emit("error",new Error("write() after end()")),!1):this[ni]===null||this[LI]||this[cA].length?(this[cA].push(e),this[AR]=!0,!1):(this[LI]=!0,this[hR](e),!0)}[hR](e){Al.write(this[ni],e,0,e.length,this[dm],(r,s)=>this[MI](r,s))}[MI](e,r){e?this[UI](e):(this[dm]!==null&&(this[dm]+=r),this[cA].length?this[Cq]():(this[LI]=!1,this[jv]&&!this[AEe]?(this[AEe]=!0,this[Vu](),this.emit("finish")):this[AR]&&(this[AR]=!1,this.emit("drain"))))}[Cq](){if(this[cA].length===0)this[jv]&&this[MI](null,0);else if(this[cA].length===1)this[hR](this[cA].pop());else{let e=this[cA];this[cA]=[],Bq(this[ni],e,this[dm],(r,s)=>this[MI](r,s))}}[Vu](){if(this[jI]&&typeof this[ni]=="number"){let e=this[ni];this[ni]=null,Al.close(e,r=>r?this.emit("error",r):this.emit("close"))}}},bq=class extends yR{[L0](){let e;if(this[gR]&&this[O0]==="r+")try{e=Al.openSync(this[Kp],this[O0],this[dR])}catch(r){if(r.code==="ENOENT")return this[O0]="w",this[L0]();throw r}else e=Al.openSync(this[Kp],this[O0],this[dR]);this[qI](null,e)}[Vu](){if(this[jI]&&typeof this[ni]=="number"){let e=this[ni];this[ni]=null,Al.closeSync(e),this.emit("close")}}[hR](e){let r=!0;try{this[MI](null,Al.writeSync(this[ni],e,0,e.length,this[dm])),r=!1}finally{if(r)try{this[Vu]()}catch{}}}};qv.ReadStream=mR;qv.ReadStreamSync=Dq;qv.WriteStream=yR;qv.WriteStreamSync=bq});var SR=L((ver,CEe)=>{"use strict";var LEt=ZT(),MEt=FI(),_Et=ye("events"),UEt=pk(),HEt=1024*1024,jEt=KT(),gEe=zT(),qEt=q6(),Pq=Buffer.from([31,139]),_c=Symbol("state"),mm=Symbol("writeEntry"),Jp=Symbol("readEntry"),xq=Symbol("nextEntry"),dEe=Symbol("processEntry"),Uc=Symbol("extendedHeader"),Gv=Symbol("globalExtendedHeader"),M0=Symbol("meta"),mEe=Symbol("emitMeta"),bi=Symbol("buffer"),zp=Symbol("queue"),ym=Symbol("ended"),yEe=Symbol("emittedEnd"),Em=Symbol("emit"),pl=Symbol("unzip"),ER=Symbol("consumeChunk"),IR=Symbol("consumeChunkSub"),kq=Symbol("consumeBody"),EEe=Symbol("consumeMeta"),IEe=Symbol("consumeHeader"),CR=Symbol("consuming"),Qq=Symbol("bufferConcat"),Tq=Symbol("maybeEnd"),Wv=Symbol("writing"),_0=Symbol("aborted"),wR=Symbol("onDone"),Im=Symbol("sawValidEntry"),BR=Symbol("sawNullBlock"),vR=Symbol("sawEOF"),GEt=t=>!0;CEe.exports=LEt(class extends _Et{constructor(e){e=e||{},super(e),this.file=e.file||"",this[Im]=null,this.on(wR,r=>{(this[_c]==="begin"||this[Im]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(wR,e.ondone):this.on(wR,r=>{this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||HEt,this.filter=typeof e.filter=="function"?e.filter:GEt,this.writable=!0,this.readable=!1,this[zp]=new UEt,this[bi]=null,this[Jp]=null,this[mm]=null,this[_c]="begin",this[M0]="",this[Uc]=null,this[Gv]=null,this[ym]=!1,this[pl]=null,this[_0]=!1,this[BR]=!1,this[vR]=!1,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onentry=="function"&&this.on("entry",e.onentry)}[IEe](e,r){this[Im]===null&&(this[Im]=!1);let s;try{s=new MEt(e,r,this[Uc],this[Gv])}catch(a){return this.warn("TAR_ENTRY_INVALID",a)}if(s.nullBlock)this[BR]?(this[vR]=!0,this[_c]==="begin"&&(this[_c]="header"),this[Em]("eof")):(this[BR]=!0,this[Em]("nullBlock"));else if(this[BR]=!1,!s.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:s});else if(!s.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:s});else{let a=s.type;if(/^(Symbolic)?Link$/.test(a)&&!s.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:s});else if(!/^(Symbolic)?Link$/.test(a)&&s.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:s});else{let n=this[mm]=new jEt(s,this[Uc],this[Gv]);if(!this[Im])if(n.remain){let c=()=>{n.invalid||(this[Im]=!0)};n.on("end",c)}else this[Im]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[Em]("ignoredEntry",n),this[_c]="ignore",n.resume()):n.size>0&&(this[M0]="",n.on("data",c=>this[M0]+=c),this[_c]="meta"):(this[Uc]=null,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[Em]("ignoredEntry",n),this[_c]=n.remain?"ignore":"header",n.resume()):(n.remain?this[_c]="body":(this[_c]="header",n.end()),this[Jp]?this[zp].push(n):(this[zp].push(n),this[xq]())))}}}[dEe](e){let r=!0;return e?Array.isArray(e)?this.emit.apply(this,e):(this[Jp]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",s=>this[xq]()),r=!1)):(this[Jp]=null,r=!1),r}[xq](){do;while(this[dEe](this[zp].shift()));if(!this[zp].length){let e=this[Jp];!e||e.flowing||e.size===e.remain?this[Wv]||this.emit("drain"):e.once("drain",s=>this.emit("drain"))}}[kq](e,r){let s=this[mm],a=s.blockRemain,n=a>=e.length&&r===0?e:e.slice(r,r+a);return s.write(n),s.blockRemain||(this[_c]="header",this[mm]=null,s.end()),n.length}[EEe](e,r){let s=this[mm],a=this[kq](e,r);return this[mm]||this[mEe](s),a}[Em](e,r,s){!this[zp].length&&!this[Jp]?this.emit(e,r,s):this[zp].push([e,r,s])}[mEe](e){switch(this[Em]("meta",this[M0]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Uc]=gEe.parse(this[M0],this[Uc],!1);break;case"GlobalExtendedHeader":this[Gv]=gEe.parse(this[M0],this[Gv],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[Uc]=this[Uc]||Object.create(null),this[Uc].path=this[M0].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[Uc]=this[Uc]||Object.create(null),this[Uc].linkpath=this[M0].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+e.type)}}abort(e){this[_0]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e){if(this[_0])return;if(this[pl]===null&&e){if(this[bi]&&(e=Buffer.concat([this[bi],e]),this[bi]=null),e.lengththis[ER](n)),this[pl].on("error",n=>this.abort(n)),this[pl].on("end",n=>{this[ym]=!0,this[ER]()}),this[Wv]=!0;let a=this[pl][s?"end":"write"](e);return this[Wv]=!1,a}}this[Wv]=!0,this[pl]?this[pl].write(e):this[ER](e),this[Wv]=!1;let r=this[zp].length?!1:this[Jp]?this[Jp].flowing:!0;return!r&&!this[zp].length&&this[Jp].once("drain",s=>this.emit("drain")),r}[Qq](e){e&&!this[_0]&&(this[bi]=this[bi]?Buffer.concat([this[bi],e]):e)}[Tq](){if(this[ym]&&!this[yEe]&&!this[_0]&&!this[CR]){this[yEe]=!0;let e=this[mm];if(e&&e.blockRemain){let r=this[bi]?this[bi].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${r} available)`,{entry:e}),this[bi]&&e.write(this[bi]),e.end()}this[Em](wR)}}[ER](e){if(this[CR])this[Qq](e);else if(!e&&!this[bi])this[Tq]();else{if(this[CR]=!0,this[bi]){this[Qq](e);let r=this[bi];this[bi]=null,this[IR](r)}else this[IR](e);for(;this[bi]&&this[bi].length>=512&&!this[_0]&&!this[vR];){let r=this[bi];this[bi]=null,this[IR](r)}this[CR]=!1}(!this[bi]||this[ym])&&this[Tq]()}[IR](e){let r=0,s=e.length;for(;r+512<=s&&!this[_0]&&!this[vR];)switch(this[_c]){case"begin":case"header":this[IEe](e,r),r+=512;break;case"ignore":case"body":r+=this[kq](e,r);break;case"meta":r+=this[EEe](e,r);break;default:throw new Error("invalid state: "+this[_c])}r{"use strict";var WEt=bI(),BEe=SR(),WI=ye("fs"),YEt=GI(),wEe=ye("path"),Rq=NI();SEe.exports=(t,e,r)=>{typeof t=="function"?(r=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),typeof e=="function"&&(r=e,e=null),e?e=Array.from(e):e=[];let s=WEt(t);if(s.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!s.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return e.length&&KEt(s,e),s.noResume||VEt(s),s.file&&s.sync?JEt(s):s.file?zEt(s,r):vEe(s)};var VEt=t=>{let e=t.onentry;t.onentry=e?r=>{e(r),r.resume()}:r=>r.resume()},KEt=(t,e)=>{let r=new Map(e.map(n=>[Rq(n),!0])),s=t.filter,a=(n,c)=>{let f=c||wEe.parse(n).root||".",p=n===f?!1:r.has(n)?r.get(n):a(wEe.dirname(n),f);return r.set(n,p),p};t.filter=s?(n,c)=>s(n,c)&&a(Rq(n)):n=>a(Rq(n))},JEt=t=>{let e=vEe(t),r=t.file,s=!0,a;try{let n=WI.statSync(r),c=t.maxReadSize||16*1024*1024;if(n.size{let r=new BEe(t),s=t.maxReadSize||16*1024*1024,a=t.file,n=new Promise((c,f)=>{r.on("error",f),r.on("end",c),WI.stat(a,(p,h)=>{if(p)f(p);else{let E=new YEt.ReadStream(a,{readSize:s,size:h.size});E.on("error",f),E.pipe(r)}})});return e?n.then(e,e):n},vEe=t=>new BEe(t)});var QEe=L((Der,kEe)=>{"use strict";var ZEt=bI(),bR=fR(),DEe=GI(),bEe=DR(),PEe=ye("path");kEe.exports=(t,e,r)=>{if(typeof e=="function"&&(r=e),Array.isArray(t)&&(e=t,t={}),!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");e=Array.from(e);let s=ZEt(t);if(s.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!s.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return s.file&&s.sync?XEt(s,e):s.file?$Et(s,e,r):s.sync?eIt(s,e):tIt(s,e)};var XEt=(t,e)=>{let r=new bR.Sync(t),s=new DEe.WriteStreamSync(t.file,{mode:t.mode||438});r.pipe(s),xEe(r,e)},$Et=(t,e,r)=>{let s=new bR(t),a=new DEe.WriteStream(t.file,{mode:t.mode||438});s.pipe(a);let n=new Promise((c,f)=>{a.on("error",f),a.on("close",c),s.on("error",f)});return Fq(s,e),r?n.then(r,r):n},xEe=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?bEe({file:PEe.resolve(t.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:s=>t.add(s)}):t.add(r)}),t.end()},Fq=(t,e)=>{for(;e.length;){let r=e.shift();if(r.charAt(0)==="@")return bEe({file:PEe.resolve(t.cwd,r.substr(1)),noResume:!0,onentry:s=>t.add(s)}).then(s=>Fq(t,e));t.add(r)}t.end()},eIt=(t,e)=>{let r=new bR.Sync(t);return xEe(r,e),r},tIt=(t,e)=>{let r=new bR(t);return Fq(r,e),r}});var Nq=L((ber,MEe)=>{"use strict";var rIt=bI(),TEe=fR(),Xl=ye("fs"),REe=GI(),FEe=DR(),NEe=ye("path"),OEe=FI();MEe.exports=(t,e,r)=>{let s=rIt(t);if(!s.file)throw new TypeError("file is required");if(s.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),s.sync?nIt(s,e):sIt(s,e,r)};var nIt=(t,e)=>{let r=new TEe.Sync(t),s=!0,a,n;try{try{a=Xl.openSync(t.file,"r+")}catch(p){if(p.code==="ENOENT")a=Xl.openSync(t.file,"w+");else throw p}let c=Xl.fstatSync(a),f=Buffer.alloc(512);e:for(n=0;nc.size)break;n+=h,t.mtimeCache&&t.mtimeCache.set(p.path,p.mtime)}s=!1,iIt(t,r,n,a,e)}finally{if(s)try{Xl.closeSync(a)}catch{}}},iIt=(t,e,r,s,a)=>{let n=new REe.WriteStreamSync(t.file,{fd:s,start:r});e.pipe(n),oIt(e,a)},sIt=(t,e,r)=>{e=Array.from(e);let s=new TEe(t),a=(c,f,p)=>{let h=(I,R)=>{I?Xl.close(c,N=>p(I)):p(null,R)},E=0;if(f===0)return h(null,0);let C=0,S=Buffer.alloc(512),P=(I,R)=>{if(I)return h(I);if(C+=R,C<512&&R)return Xl.read(c,S,C,S.length-C,E+C,P);if(E===0&&S[0]===31&&S[1]===139)return h(new Error("cannot append to compressed archives"));if(C<512)return h(null,E);let N=new OEe(S);if(!N.cksumValid)return h(null,E);let U=512*Math.ceil(N.size/512);if(E+U+512>f||(E+=U+512,E>=f))return h(null,E);t.mtimeCache&&t.mtimeCache.set(N.path,N.mtime),C=0,Xl.read(c,S,0,512,E,P)};Xl.read(c,S,0,512,E,P)},n=new Promise((c,f)=>{s.on("error",f);let p="r+",h=(E,C)=>{if(E&&E.code==="ENOENT"&&p==="r+")return p="w+",Xl.open(t.file,p,h);if(E)return f(E);Xl.fstat(C,(S,P)=>{if(S)return Xl.close(C,()=>f(S));a(C,P.size,(I,R)=>{if(I)return f(I);let N=new REe.WriteStream(t.file,{fd:C,start:R});s.pipe(N),N.on("error",f),N.on("close",c),LEe(s,e)})})};Xl.open(t.file,p,h)});return r?n.then(r,r):n},oIt=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?FEe({file:NEe.resolve(t.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:s=>t.add(s)}):t.add(r)}),t.end()},LEe=(t,e)=>{for(;e.length;){let r=e.shift();if(r.charAt(0)==="@")return FEe({file:NEe.resolve(t.cwd,r.substr(1)),noResume:!0,onentry:s=>t.add(s)}).then(s=>LEe(t,e));t.add(r)}t.end()}});var UEe=L((Per,_Ee)=>{"use strict";var aIt=bI(),lIt=Nq();_Ee.exports=(t,e,r)=>{let s=aIt(t);if(!s.file)throw new TypeError("file is required");if(s.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),cIt(s),lIt(s,e,r)};var cIt=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(r,s)=>e(r,s)&&!(t.mtimeCache.get(r)>s.mtime):(r,s)=>!(t.mtimeCache.get(r)>s.mtime)}});var qEe=L((xer,jEe)=>{var{promisify:HEe}=ye("util"),U0=ye("fs"),uIt=t=>{if(!t)t={mode:511,fs:U0};else if(typeof t=="object")t={mode:511,fs:U0,...t};else if(typeof t=="number")t={mode:t,fs:U0};else if(typeof t=="string")t={mode:parseInt(t,8),fs:U0};else throw new TypeError("invalid options argument");return t.mkdir=t.mkdir||t.fs.mkdir||U0.mkdir,t.mkdirAsync=HEe(t.mkdir),t.stat=t.stat||t.fs.stat||U0.stat,t.statAsync=HEe(t.stat),t.statSync=t.statSync||t.fs.statSync||U0.statSync,t.mkdirSync=t.mkdirSync||t.fs.mkdirSync||U0.mkdirSync,t};jEe.exports=uIt});var WEe=L((ker,GEe)=>{var fIt=process.platform,{resolve:AIt,parse:pIt}=ye("path"),hIt=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=AIt(t),fIt==="win32"){let e=/[*|"<>?:]/,{root:r}=pIt(t);if(e.test(t.substr(r.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t};GEe.exports=hIt});var zEe=L((Qer,JEe)=>{var{dirname:YEe}=ye("path"),VEe=(t,e,r=void 0)=>r===e?Promise.resolve():t.statAsync(e).then(s=>s.isDirectory()?r:void 0,s=>s.code==="ENOENT"?VEe(t,YEe(e),e):void 0),KEe=(t,e,r=void 0)=>{if(r!==e)try{return t.statSync(e).isDirectory()?r:void 0}catch(s){return s.code==="ENOENT"?KEe(t,YEe(e),e):void 0}};JEe.exports={findMade:VEe,findMadeSync:KEe}});var Mq=L((Ter,XEe)=>{var{dirname:ZEe}=ye("path"),Oq=(t,e,r)=>{e.recursive=!1;let s=ZEe(t);return s===t?e.mkdirAsync(t,e).catch(a=>{if(a.code!=="EISDIR")throw a}):e.mkdirAsync(t,e).then(()=>r||t,a=>{if(a.code==="ENOENT")return Oq(s,e).then(n=>Oq(t,e,n));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;return e.statAsync(t).then(n=>{if(n.isDirectory())return r;throw a},()=>{throw a})})},Lq=(t,e,r)=>{let s=ZEe(t);if(e.recursive=!1,s===t)try{return e.mkdirSync(t,e)}catch(a){if(a.code!=="EISDIR")throw a;return}try{return e.mkdirSync(t,e),r||t}catch(a){if(a.code==="ENOENT")return Lq(t,e,Lq(s,e,r));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;try{if(!e.statSync(t).isDirectory())throw a}catch{throw a}}};XEe.exports={mkdirpManual:Oq,mkdirpManualSync:Lq}});var tIe=L((Rer,eIe)=>{var{dirname:$Ee}=ye("path"),{findMade:gIt,findMadeSync:dIt}=zEe(),{mkdirpManual:mIt,mkdirpManualSync:yIt}=Mq(),EIt=(t,e)=>(e.recursive=!0,$Ee(t)===t?e.mkdirAsync(t,e):gIt(e,t).then(s=>e.mkdirAsync(t,e).then(()=>s).catch(a=>{if(a.code==="ENOENT")return mIt(t,e);throw a}))),IIt=(t,e)=>{if(e.recursive=!0,$Ee(t)===t)return e.mkdirSync(t,e);let s=dIt(e,t);try{return e.mkdirSync(t,e),s}catch(a){if(a.code==="ENOENT")return yIt(t,e);throw a}};eIe.exports={mkdirpNative:EIt,mkdirpNativeSync:IIt}});var sIe=L((Fer,iIe)=>{var rIe=ye("fs"),CIt=process.version,_q=CIt.replace(/^v/,"").split("."),nIe=+_q[0]>10||+_q[0]==10&&+_q[1]>=12,wIt=nIe?t=>t.mkdir===rIe.mkdir:()=>!1,BIt=nIe?t=>t.mkdirSync===rIe.mkdirSync:()=>!1;iIe.exports={useNative:wIt,useNativeSync:BIt}});var fIe=L((Ner,uIe)=>{var YI=qEe(),VI=WEe(),{mkdirpNative:oIe,mkdirpNativeSync:aIe}=tIe(),{mkdirpManual:lIe,mkdirpManualSync:cIe}=Mq(),{useNative:vIt,useNativeSync:SIt}=sIe(),KI=(t,e)=>(t=VI(t),e=YI(e),vIt(e)?oIe(t,e):lIe(t,e)),DIt=(t,e)=>(t=VI(t),e=YI(e),SIt(e)?aIe(t,e):cIe(t,e));KI.sync=DIt;KI.native=(t,e)=>oIe(VI(t),YI(e));KI.manual=(t,e)=>lIe(VI(t),YI(e));KI.nativeSync=(t,e)=>aIe(VI(t),YI(e));KI.manualSync=(t,e)=>cIe(VI(t),YI(e));uIe.exports=KI});var yIe=L((Oer,mIe)=>{"use strict";var Hc=ye("fs"),Cm=ye("path"),bIt=Hc.lchown?"lchown":"chown",PIt=Hc.lchownSync?"lchownSync":"chownSync",pIe=Hc.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),AIe=(t,e,r)=>{try{return Hc[PIt](t,e,r)}catch(s){if(s.code!=="ENOENT")throw s}},xIt=(t,e,r)=>{try{return Hc.chownSync(t,e,r)}catch(s){if(s.code!=="ENOENT")throw s}},kIt=pIe?(t,e,r,s)=>a=>{!a||a.code!=="EISDIR"?s(a):Hc.chown(t,e,r,s)}:(t,e,r,s)=>s,Uq=pIe?(t,e,r)=>{try{return AIe(t,e,r)}catch(s){if(s.code!=="EISDIR")throw s;xIt(t,e,r)}}:(t,e,r)=>AIe(t,e,r),QIt=process.version,hIe=(t,e,r)=>Hc.readdir(t,e,r),TIt=(t,e)=>Hc.readdirSync(t,e);/^v4\./.test(QIt)&&(hIe=(t,e,r)=>Hc.readdir(t,r));var PR=(t,e,r,s)=>{Hc[bIt](t,e,r,kIt(t,e,r,a=>{s(a&&a.code!=="ENOENT"?a:null)}))},gIe=(t,e,r,s,a)=>{if(typeof e=="string")return Hc.lstat(Cm.resolve(t,e),(n,c)=>{if(n)return a(n.code!=="ENOENT"?n:null);c.name=e,gIe(t,c,r,s,a)});if(e.isDirectory())Hq(Cm.resolve(t,e.name),r,s,n=>{if(n)return a(n);let c=Cm.resolve(t,e.name);PR(c,r,s,a)});else{let n=Cm.resolve(t,e.name);PR(n,r,s,a)}},Hq=(t,e,r,s)=>{hIe(t,{withFileTypes:!0},(a,n)=>{if(a){if(a.code==="ENOENT")return s();if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return s(a)}if(a||!n.length)return PR(t,e,r,s);let c=n.length,f=null,p=h=>{if(!f){if(h)return s(f=h);if(--c===0)return PR(t,e,r,s)}};n.forEach(h=>gIe(t,h,e,r,p))})},RIt=(t,e,r,s)=>{if(typeof e=="string")try{let a=Hc.lstatSync(Cm.resolve(t,e));a.name=e,e=a}catch(a){if(a.code==="ENOENT")return;throw a}e.isDirectory()&&dIe(Cm.resolve(t,e.name),r,s),Uq(Cm.resolve(t,e.name),r,s)},dIe=(t,e,r)=>{let s;try{s=TIt(t,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return;if(a.code==="ENOTDIR"||a.code==="ENOTSUP")return Uq(t,e,r);throw a}return s&&s.length&&s.forEach(a=>RIt(t,a,e,r)),Uq(t,e,r)};mIe.exports=Hq;Hq.sync=dIe});var wIe=L((Ler,jq)=>{"use strict";var EIe=fIe(),jc=ye("fs"),xR=ye("path"),IIe=yIe(),Ku=TI(),kR=class extends Error{constructor(e,r){super("Cannot extract through symbolic link"),this.path=r,this.symlink=e}get name(){return"SylinkError"}},QR=class extends Error{constructor(e,r){super(r+": Cannot cd into '"+e+"'"),this.path=e,this.code=r}get name(){return"CwdError"}},TR=(t,e)=>t.get(Ku(e)),Yv=(t,e,r)=>t.set(Ku(e),r),FIt=(t,e)=>{jc.stat(t,(r,s)=>{(r||!s.isDirectory())&&(r=new QR(t,r&&r.code||"ENOTDIR")),e(r)})};jq.exports=(t,e,r)=>{t=Ku(t);let s=e.umask,a=e.mode|448,n=(a&s)!==0,c=e.uid,f=e.gid,p=typeof c=="number"&&typeof f=="number"&&(c!==e.processUid||f!==e.processGid),h=e.preserve,E=e.unlink,C=e.cache,S=Ku(e.cwd),P=(N,U)=>{N?r(N):(Yv(C,t,!0),U&&p?IIe(U,c,f,W=>P(W)):n?jc.chmod(t,a,r):r())};if(C&&TR(C,t)===!0)return P();if(t===S)return FIt(t,P);if(h)return EIe(t,{mode:a}).then(N=>P(null,N),P);let R=Ku(xR.relative(S,t)).split("/");RR(S,R,a,C,E,S,null,P)};var RR=(t,e,r,s,a,n,c,f)=>{if(!e.length)return f(null,c);let p=e.shift(),h=Ku(xR.resolve(t+"/"+p));if(TR(s,h))return RR(h,e,r,s,a,n,c,f);jc.mkdir(h,r,CIe(h,e,r,s,a,n,c,f))},CIe=(t,e,r,s,a,n,c,f)=>p=>{p?jc.lstat(t,(h,E)=>{if(h)h.path=h.path&&Ku(h.path),f(h);else if(E.isDirectory())RR(t,e,r,s,a,n,c,f);else if(a)jc.unlink(t,C=>{if(C)return f(C);jc.mkdir(t,r,CIe(t,e,r,s,a,n,c,f))});else{if(E.isSymbolicLink())return f(new kR(t,t+"/"+e.join("/")));f(p)}}):(c=c||t,RR(t,e,r,s,a,n,c,f))},NIt=t=>{let e=!1,r="ENOTDIR";try{e=jc.statSync(t).isDirectory()}catch(s){r=s.code}finally{if(!e)throw new QR(t,r)}};jq.exports.sync=(t,e)=>{t=Ku(t);let r=e.umask,s=e.mode|448,a=(s&r)!==0,n=e.uid,c=e.gid,f=typeof n=="number"&&typeof c=="number"&&(n!==e.processUid||c!==e.processGid),p=e.preserve,h=e.unlink,E=e.cache,C=Ku(e.cwd),S=N=>{Yv(E,t,!0),N&&f&&IIe.sync(N,n,c),a&&jc.chmodSync(t,s)};if(E&&TR(E,t)===!0)return S();if(t===C)return NIt(C),S();if(p)return S(EIe.sync(t,s));let I=Ku(xR.relative(C,t)).split("/"),R=null;for(let N=I.shift(),U=C;N&&(U+="/"+N);N=I.shift())if(U=Ku(xR.resolve(U)),!TR(E,U))try{jc.mkdirSync(U,s),R=R||U,Yv(E,U,!0)}catch{let te=jc.lstatSync(U);if(te.isDirectory()){Yv(E,U,!0);continue}else if(h){jc.unlinkSync(U),jc.mkdirSync(U,s),R=R||U,Yv(E,U,!0);continue}else if(te.isSymbolicLink())return new kR(U,U+"/"+I.join("/"))}return S(R)}});var Gq=L((Mer,BIe)=>{var qq=Object.create(null),{hasOwnProperty:OIt}=Object.prototype;BIe.exports=t=>(OIt.call(qq,t)||(qq[t]=t.normalize("NFKD")),qq[t])});var bIe=L((_er,DIe)=>{var vIe=ye("assert"),LIt=Gq(),MIt=NI(),{join:SIe}=ye("path"),_It=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,UIt=_It==="win32";DIe.exports=()=>{let t=new Map,e=new Map,r=h=>h.split("/").slice(0,-1).reduce((C,S)=>(C.length&&(S=SIe(C[C.length-1],S)),C.push(S||"/"),C),[]),s=new Set,a=h=>{let E=e.get(h);if(!E)throw new Error("function does not have any path reservations");return{paths:E.paths.map(C=>t.get(C)),dirs:[...E.dirs].map(C=>t.get(C))}},n=h=>{let{paths:E,dirs:C}=a(h);return E.every(S=>S[0]===h)&&C.every(S=>S[0]instanceof Set&&S[0].has(h))},c=h=>s.has(h)||!n(h)?!1:(s.add(h),h(()=>f(h)),!0),f=h=>{if(!s.has(h))return!1;let{paths:E,dirs:C}=e.get(h),S=new Set;return E.forEach(P=>{let I=t.get(P);vIe.equal(I[0],h),I.length===1?t.delete(P):(I.shift(),typeof I[0]=="function"?S.add(I[0]):I[0].forEach(R=>S.add(R)))}),C.forEach(P=>{let I=t.get(P);vIe(I[0]instanceof Set),I[0].size===1&&I.length===1?t.delete(P):I[0].size===1?(I.shift(),S.add(I[0])):I[0].delete(h)}),s.delete(h),S.forEach(P=>c(P)),!0};return{check:n,reserve:(h,E)=>{h=UIt?["win32 parallelization disabled"]:h.map(S=>LIt(MIt(SIe(S))).toLowerCase());let C=new Set(h.map(S=>r(S)).reduce((S,P)=>S.concat(P)));return e.set(E,{dirs:C,paths:h}),h.forEach(S=>{let P=t.get(S);P?P.push(E):t.set(S,[E])}),C.forEach(S=>{let P=t.get(S);P?P[P.length-1]instanceof Set?P[P.length-1].add(E):P.push(new Set([E])):t.set(S,[new Set([E])])}),c(E)}}}});var kIe=L((Uer,xIe)=>{var HIt=process.platform,jIt=HIt==="win32",qIt=global.__FAKE_TESTING_FS__||ye("fs"),{O_CREAT:GIt,O_TRUNC:WIt,O_WRONLY:YIt,UV_FS_O_FILEMAP:PIe=0}=qIt.constants,VIt=jIt&&!!PIe,KIt=512*1024,JIt=PIe|WIt|GIt|YIt;xIe.exports=VIt?t=>t"w"});var $q=L((Her,GIe)=>{"use strict";var zIt=ye("assert"),ZIt=SR(),Mn=ye("fs"),XIt=GI(),Zp=ye("path"),HIe=wIe(),QIe=$6(),$It=bIe(),eCt=eq(),$l=TI(),tCt=NI(),rCt=Gq(),TIe=Symbol("onEntry"),Vq=Symbol("checkFs"),RIe=Symbol("checkFs2"),OR=Symbol("pruneCache"),Kq=Symbol("isReusable"),qc=Symbol("makeFs"),Jq=Symbol("file"),zq=Symbol("directory"),LR=Symbol("link"),FIe=Symbol("symlink"),NIe=Symbol("hardlink"),OIe=Symbol("unsupported"),LIe=Symbol("checkPath"),H0=Symbol("mkdir"),Xo=Symbol("onError"),FR=Symbol("pending"),MIe=Symbol("pend"),JI=Symbol("unpend"),Wq=Symbol("ended"),Yq=Symbol("maybeClose"),Zq=Symbol("skip"),Vv=Symbol("doChown"),Kv=Symbol("uid"),Jv=Symbol("gid"),zv=Symbol("checkedCwd"),jIe=ye("crypto"),qIe=kIe(),nCt=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Zv=nCt==="win32",iCt=(t,e)=>{if(!Zv)return Mn.unlink(t,e);let r=t+".DELETE."+jIe.randomBytes(16).toString("hex");Mn.rename(t,r,s=>{if(s)return e(s);Mn.unlink(r,e)})},sCt=t=>{if(!Zv)return Mn.unlinkSync(t);let e=t+".DELETE."+jIe.randomBytes(16).toString("hex");Mn.renameSync(t,e),Mn.unlinkSync(e)},_Ie=(t,e,r)=>t===t>>>0?t:e===e>>>0?e:r,UIe=t=>rCt(tCt($l(t))).toLowerCase(),oCt=(t,e)=>{e=UIe(e);for(let r of t.keys()){let s=UIe(r);(s===e||s.indexOf(e+"/")===0)&&t.delete(r)}},aCt=t=>{for(let e of t.keys())t.delete(e)},Xv=class extends ZIt{constructor(e){if(e||(e={}),e.ondone=r=>{this[Wq]=!0,this[Yq]()},super(e),this[zv]=!1,this.reservations=$It(),this.transform=typeof e.transform=="function"?e.transform:null,this.writable=!0,this.readable=!1,this[FR]=0,this[Wq]=!1,this.dirCache=e.dirCache||new Map,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Zv,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=$l(Zp.resolve(e.cwd||process.cwd())),this.strip=+e.strip||0,this.processUmask=e.noChmod?0:process.umask(),this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",r=>this[TIe](r))}warn(e,r,s={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(s.recoverable=!1),super.warn(e,r,s)}[Yq](){this[Wq]&&this[FR]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close"))}[LIe](e){if(this.strip){let r=$l(e.path).split("/");if(r.length=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}}if(!this.preservePaths){let r=$l(e.path),s=r.split("/");if(s.includes("..")||Zv&&/^[a-z]:\.\.$/i.test(s[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:r}),!1;let[a,n]=eCt(r);a&&(e.path=n,this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:e,path:r}))}if(Zp.isAbsolute(e.path)?e.absolute=$l(Zp.resolve(e.path)):e.absolute=$l(Zp.resolve(this.cwd,e.path)),!this.preservePaths&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:$l(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=Zp.win32.parse(e.absolute);e.absolute=r+QIe.encode(e.absolute.substr(r.length));let{root:s}=Zp.win32.parse(e.path);e.path=s+QIe.encode(e.path.substr(s.length))}return!0}[TIe](e){if(!this[LIe](e))return e.resume();switch(zIt.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Vq](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[OIe](e)}}[Xo](e,r){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:r}),this[JI](),r.resume())}[H0](e,r,s){HIe($l(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r,noChmod:this.noChmod},s)}[Vv](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[Kv](e){return _Ie(this.uid,e.uid,this.processUid)}[Jv](e){return _Ie(this.gid,e.gid,this.processGid)}[Jq](e,r){let s=e.mode&4095||this.fmode,a=new XIt.WriteStream(e.absolute,{flags:qIe(e.size),mode:s,autoClose:!1});a.on("error",p=>{a.fd&&Mn.close(a.fd,()=>{}),a.write=()=>!0,this[Xo](p,e),r()});let n=1,c=p=>{if(p){a.fd&&Mn.close(a.fd,()=>{}),this[Xo](p,e),r();return}--n===0&&Mn.close(a.fd,h=>{h?this[Xo](h,e):this[JI](),r()})};a.on("finish",p=>{let h=e.absolute,E=a.fd;if(e.mtime&&!this.noMtime){n++;let C=e.atime||new Date,S=e.mtime;Mn.futimes(E,C,S,P=>P?Mn.utimes(h,C,S,I=>c(I&&P)):c())}if(this[Vv](e)){n++;let C=this[Kv](e),S=this[Jv](e);Mn.fchown(E,C,S,P=>P?Mn.chown(h,C,S,I=>c(I&&P)):c())}c()});let f=this.transform&&this.transform(e)||e;f!==e&&(f.on("error",p=>{this[Xo](p,e),r()}),e.pipe(f)),f.pipe(a)}[zq](e,r){let s=e.mode&4095||this.dmode;this[H0](e.absolute,s,a=>{if(a){this[Xo](a,e),r();return}let n=1,c=f=>{--n===0&&(r(),this[JI](),e.resume())};e.mtime&&!this.noMtime&&(n++,Mn.utimes(e.absolute,e.atime||new Date,e.mtime,c)),this[Vv](e)&&(n++,Mn.chown(e.absolute,this[Kv](e),this[Jv](e),c)),c()})}[OIe](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[FIe](e,r){this[LR](e,e.linkpath,"symlink",r)}[NIe](e,r){let s=$l(Zp.resolve(this.cwd,e.linkpath));this[LR](e,s,"link",r)}[MIe](){this[FR]++}[JI](){this[FR]--,this[Yq]()}[Zq](e){this[JI](),e.resume()}[Kq](e,r){return e.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Zv}[Vq](e){this[MIe]();let r=[e.path];e.linkpath&&r.push(e.linkpath),this.reservations.reserve(r,s=>this[RIe](e,s))}[OR](e){e.type==="SymbolicLink"?aCt(this.dirCache):e.type!=="Directory"&&oCt(this.dirCache,e.absolute)}[RIe](e,r){this[OR](e);let s=f=>{this[OR](e),r(f)},a=()=>{this[H0](this.cwd,this.dmode,f=>{if(f){this[Xo](f,e),s();return}this[zv]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let f=$l(Zp.dirname(e.absolute));if(f!==this.cwd)return this[H0](f,this.dmode,p=>{if(p){this[Xo](p,e),s();return}c()})}c()},c=()=>{Mn.lstat(e.absolute,(f,p)=>{if(p&&(this.keep||this.newer&&p.mtime>e.mtime)){this[Zq](e),s();return}if(f||this[Kq](e,p))return this[qc](null,e,s);if(p.isDirectory()){if(e.type==="Directory"){let h=!this.noChmod&&e.mode&&(p.mode&4095)!==e.mode,E=C=>this[qc](C,e,s);return h?Mn.chmod(e.absolute,e.mode,E):E()}if(e.absolute!==this.cwd)return Mn.rmdir(e.absolute,h=>this[qc](h,e,s))}if(e.absolute===this.cwd)return this[qc](null,e,s);iCt(e.absolute,h=>this[qc](h,e,s))})};this[zv]?n():a()}[qc](e,r,s){if(e){this[Xo](e,r),s();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[Jq](r,s);case"Link":return this[NIe](r,s);case"SymbolicLink":return this[FIe](r,s);case"Directory":case"GNUDumpDir":return this[zq](r,s)}}[LR](e,r,s,a){Mn[s](r,e.absolute,n=>{n?this[Xo](n,e):(this[JI](),e.resume()),a()})}},NR=t=>{try{return[null,t()]}catch(e){return[e,null]}},Xq=class extends Xv{[qc](e,r){return super[qc](e,r,()=>{})}[Vq](e){if(this[OR](e),!this[zv]){let n=this[H0](this.cwd,this.dmode);if(n)return this[Xo](n,e);this[zv]=!0}if(e.absolute!==this.cwd){let n=$l(Zp.dirname(e.absolute));if(n!==this.cwd){let c=this[H0](n,this.dmode);if(c)return this[Xo](c,e)}}let[r,s]=NR(()=>Mn.lstatSync(e.absolute));if(s&&(this.keep||this.newer&&s.mtime>e.mtime))return this[Zq](e);if(r||this[Kq](e,s))return this[qc](null,e);if(s.isDirectory()){if(e.type==="Directory"){let c=!this.noChmod&&e.mode&&(s.mode&4095)!==e.mode,[f]=c?NR(()=>{Mn.chmodSync(e.absolute,e.mode)}):[];return this[qc](f,e)}let[n]=NR(()=>Mn.rmdirSync(e.absolute));this[qc](n,e)}let[a]=e.absolute===this.cwd?[]:NR(()=>sCt(e.absolute));this[qc](a,e)}[Jq](e,r){let s=e.mode&4095||this.fmode,a=f=>{let p;try{Mn.closeSync(n)}catch(h){p=h}(f||p)&&this[Xo](f||p,e),r()},n;try{n=Mn.openSync(e.absolute,qIe(e.size),s)}catch(f){return a(f)}let c=this.transform&&this.transform(e)||e;c!==e&&(c.on("error",f=>this[Xo](f,e)),e.pipe(c)),c.on("data",f=>{try{Mn.writeSync(n,f,0,f.length)}catch(p){a(p)}}),c.on("end",f=>{let p=null;if(e.mtime&&!this.noMtime){let h=e.atime||new Date,E=e.mtime;try{Mn.futimesSync(n,h,E)}catch(C){try{Mn.utimesSync(e.absolute,h,E)}catch{p=C}}}if(this[Vv](e)){let h=this[Kv](e),E=this[Jv](e);try{Mn.fchownSync(n,h,E)}catch(C){try{Mn.chownSync(e.absolute,h,E)}catch{p=p||C}}}a(p)})}[zq](e,r){let s=e.mode&4095||this.dmode,a=this[H0](e.absolute,s);if(a){this[Xo](a,e),r();return}if(e.mtime&&!this.noMtime)try{Mn.utimesSync(e.absolute,e.atime||new Date,e.mtime)}catch{}if(this[Vv](e))try{Mn.chownSync(e.absolute,this[Kv](e),this[Jv](e))}catch{}r(),e.resume()}[H0](e,r){try{return HIe.sync($l(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(s){return s}}[LR](e,r,s,a){try{Mn[s+"Sync"](r,e.absolute),a(),e.resume()}catch(n){return this[Xo](n,e)}}};Xv.Sync=Xq;GIe.exports=Xv});var JIe=L((jer,KIe)=>{"use strict";var lCt=bI(),MR=$q(),YIe=ye("fs"),VIe=GI(),WIe=ye("path"),eG=NI();KIe.exports=(t,e,r)=>{typeof t=="function"?(r=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),typeof e=="function"&&(r=e,e=null),e?e=Array.from(e):e=[];let s=lCt(t);if(s.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!s.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return e.length&&cCt(s,e),s.file&&s.sync?uCt(s):s.file?fCt(s,r):s.sync?ACt(s):pCt(s)};var cCt=(t,e)=>{let r=new Map(e.map(n=>[eG(n),!0])),s=t.filter,a=(n,c)=>{let f=c||WIe.parse(n).root||".",p=n===f?!1:r.has(n)?r.get(n):a(WIe.dirname(n),f);return r.set(n,p),p};t.filter=s?(n,c)=>s(n,c)&&a(eG(n)):n=>a(eG(n))},uCt=t=>{let e=new MR.Sync(t),r=t.file,s=YIe.statSync(r),a=t.maxReadSize||16*1024*1024;new VIe.ReadStreamSync(r,{readSize:a,size:s.size}).pipe(e)},fCt=(t,e)=>{let r=new MR(t),s=t.maxReadSize||16*1024*1024,a=t.file,n=new Promise((c,f)=>{r.on("error",f),r.on("close",c),YIe.stat(a,(p,h)=>{if(p)f(p);else{let E=new VIe.ReadStream(a,{readSize:s,size:h.size});E.on("error",f),E.pipe(r)}})});return e?n.then(e,e):n},ACt=t=>new MR.Sync(t),pCt=t=>new MR(t)});var zIe=L(xs=>{"use strict";xs.c=xs.create=QEe();xs.r=xs.replace=Nq();xs.t=xs.list=DR();xs.u=xs.update=UEe();xs.x=xs.extract=JIe();xs.Pack=fR();xs.Unpack=$q();xs.Parse=SR();xs.ReadEntry=KT();xs.WriteEntry=uq();xs.Header=FI();xs.Pax=zT();xs.types=Y6()});var tG,ZIe,j0,$v,eS,XIe=It(()=>{tG=et(Md()),ZIe=ye("worker_threads"),j0=Symbol("kTaskInfo"),$v=class{constructor(e,r){this.fn=e;this.limit=(0,tG.default)(r.poolSize)}run(e){return this.limit(()=>this.fn(e))}},eS=class{constructor(e,r){this.source=e;this.workers=[];this.limit=(0,tG.default)(r.poolSize),this.cleanupInterval=setInterval(()=>{if(this.limit.pendingCount===0&&this.limit.activeCount===0){let s=this.workers.pop();s?s.terminate():clearInterval(this.cleanupInterval)}},5e3).unref()}createWorker(){this.cleanupInterval.refresh();let e=new ZIe.Worker(this.source,{eval:!0,execArgv:[...process.execArgv,"--unhandled-rejections=strict"]});return e.on("message",r=>{if(!e[j0])throw new Error("Assertion failed: Worker sent a result without having a task assigned");e[j0].resolve(r),e[j0]=null,e.unref(),this.workers.push(e)}),e.on("error",r=>{e[j0]?.reject(r),e[j0]=null}),e.on("exit",r=>{r!==0&&e[j0]?.reject(new Error(`Worker exited with code ${r}`)),e[j0]=null}),e}run(e){return this.limit(()=>{let r=this.workers.pop()??this.createWorker();return r.ref(),new Promise((s,a)=>{r[j0]={resolve:s,reject:a},r.postMessage(e)})})}}});var eCe=L((Yer,$Ie)=>{var rG;$Ie.exports.getContent=()=>(typeof rG>"u"&&(rG=ye("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),rG)});var hs={};Vt(hs,{convertToZip:()=>mCt,convertToZipWorker:()=>sG,extractArchiveTo:()=>sCe,getDefaultTaskPool:()=>nCe,getTaskPoolForConfiguration:()=>iCe,makeArchiveFromDirectory:()=>dCt});function hCt(t,e){switch(t){case"async":return new $v(sG,{poolSize:e});case"workers":return new eS((0,iG.getContent)(),{poolSize:e});default:throw new Error(`Assertion failed: Unknown value ${t} for taskPoolMode`)}}function nCe(){return typeof nG>"u"&&(nG=hCt("workers",As.availableParallelism())),nG}function iCe(t){return typeof t>"u"?nCe():Vl(gCt,t,()=>{let e=t.get("taskPoolMode"),r=t.get("taskPoolConcurrency");switch(e){case"async":return new $v(sG,{poolSize:r});case"workers":return new eS((0,iG.getContent)(),{poolSize:r});default:throw new Error(`Assertion failed: Unknown value ${e} for taskPoolMode`)}})}async function sG(t){let{tmpFile:e,tgz:r,compressionLevel:s,extractBufferOpts:a}=t,n=new ps(e,{create:!0,level:s,stats:el.makeDefaultStats()}),c=Buffer.from(r.buffer,r.byteOffset,r.byteLength);return await sCe(c,n,a),n.saveAndClose(),e}async function dCt(t,{baseFs:e=new Yn,prefixPath:r=vt.root,compressionLevel:s,inMemory:a=!1}={}){let n;if(a)n=new ps(null,{level:s});else{let f=await le.mktempPromise(),p=K.join(f,"archive.zip");n=new ps(p,{create:!0,level:s})}let c=K.resolve(vt.root,r);return await n.copyPromise(c,t,{baseFs:e,stableTime:!0,stableSort:!0}),n}async function mCt(t,e={}){let r=await le.mktempPromise(),s=K.join(r,"archive.zip"),a=e.compressionLevel??e.configuration?.get("compressionLevel")??"mixed",n={prefixPath:e.prefixPath,stripComponents:e.stripComponents};return await(e.taskPool??iCe(e.configuration)).run({tmpFile:s,tgz:t,compressionLevel:a,extractBufferOpts:n}),new ps(s,{level:e.compressionLevel})}async function*yCt(t){let e=new rCe.default.Parse,r=new tCe.PassThrough({objectMode:!0,autoDestroy:!0,emitClose:!0});e.on("entry",s=>{r.write(s)}),e.on("error",s=>{r.destroy(s)}),e.on("close",()=>{r.destroyed||r.end()}),e.end(t);for await(let s of r){let a=s;yield a,a.resume()}}async function sCe(t,e,{stripComponents:r=0,prefixPath:s=vt.dot}={}){function a(n){if(n.path[0]==="/")return!0;let c=n.path.split(/\//g);return!!(c.some(f=>f==="..")||c.length<=r)}for await(let n of yCt(t)){if(a(n))continue;let c=K.normalize(ue.toPortablePath(n.path)).replace(/\/$/,"").split(/\//g);if(c.length<=r)continue;let f=c.slice(r).join("/"),p=K.join(s,f),h=420;switch((n.type==="Directory"||(n.mode??0)&73)&&(h|=73),n.type){case"Directory":e.mkdirpSync(K.dirname(p),{chmod:493,utimes:[ui.SAFE_TIME,ui.SAFE_TIME]}),e.mkdirSync(p,{mode:h}),e.utimesSync(p,ui.SAFE_TIME,ui.SAFE_TIME);break;case"OldFile":case"File":e.mkdirpSync(K.dirname(p),{chmod:493,utimes:[ui.SAFE_TIME,ui.SAFE_TIME]}),e.writeFileSync(p,await WE(n),{mode:h}),e.utimesSync(p,ui.SAFE_TIME,ui.SAFE_TIME);break;case"SymbolicLink":e.mkdirpSync(K.dirname(p),{chmod:493,utimes:[ui.SAFE_TIME,ui.SAFE_TIME]}),e.symlinkSync(n.linkpath,p),e.lutimesSync(p,ui.SAFE_TIME,ui.SAFE_TIME);break}}return e}var tCe,rCe,iG,nG,gCt,oCe=It(()=>{Ve();bt();rA();tCe=ye("stream"),rCe=et(zIe());XIe();kc();iG=et(eCe());gCt=new WeakMap});var lCe=L((oG,aCe)=>{(function(t,e){typeof oG=="object"?aCe.exports=e():typeof define=="function"&&define.amd?define(e):t.treeify=e()})(oG,function(){function t(a,n){var c=n?"\u2514":"\u251C";return a?c+="\u2500 ":c+="\u2500\u2500\u2510",c}function e(a,n){var c=[];for(var f in a)a.hasOwnProperty(f)&&(n&&typeof a[f]=="function"||c.push(f));return c}function r(a,n,c,f,p,h,E){var C="",S=0,P,I,R=f.slice(0);if(R.push([n,c])&&f.length>0&&(f.forEach(function(U,W){W>0&&(C+=(U[1]?" ":"\u2502")+" "),!I&&U[0]===n&&(I=!0)}),C+=t(a,c)+a,p&&(typeof n!="object"||n instanceof Date)&&(C+=": "+n),I&&(C+=" (circular ref.)"),E(C)),!I&&typeof n=="object"){var N=e(n,h);N.forEach(function(U){P=++S===N.length,r(U,n[U],P,R,p,h,E)})}}var s={};return s.asLines=function(a,n,c,f){var p=typeof c!="function"?c:!1;r(".",a,!1,[],n,p,f||c)},s.asTree=function(a,n,c){var f="";return r(".",a,!1,[],n,c,function(p){f+=p+` +`}),f},s})});var ks={};Vt(ks,{emitList:()=>ECt,emitTree:()=>ACe,treeNodeToJson:()=>fCe,treeNodeToTreeify:()=>uCe});function uCe(t,{configuration:e}){let r={},s=0,a=(n,c)=>{let f=Array.isArray(n)?n.entries():Object.entries(n);for(let[p,h]of f){if(!h)continue;let{label:E,value:C,children:S}=h,P=[];typeof E<"u"&&P.push(zd(e,E,2)),typeof C<"u"&&P.push(Ut(e,C[0],C[1])),P.length===0&&P.push(zd(e,`${p}`,2));let I=P.join(": ").trim(),R=`\0${s++}\0`,N=c[`${R}${I}`]={};typeof S<"u"&&a(S,N)}};if(typeof t.children>"u")throw new Error("The root node must only contain children");return a(t.children,r),r}function fCe(t){let e=r=>{if(typeof r.children>"u"){if(typeof r.value>"u")throw new Error("Assertion failed: Expected a value to be set if the children are missing");return Zd(r.value[0],r.value[1])}let s=Array.isArray(r.children)?r.children.entries():Object.entries(r.children??{}),a=Array.isArray(r.children)?[]:{};for(let[n,c]of s)c&&(a[ICt(n)]=e(c));return typeof r.value>"u"?a:{value:Zd(r.value[0],r.value[1]),children:a}};return e(t)}function ECt(t,{configuration:e,stdout:r,json:s}){let a=t.map(n=>({value:n}));ACe({children:a},{configuration:e,stdout:r,json:s})}function ACe(t,{configuration:e,stdout:r,json:s,separators:a=0}){if(s){let c=Array.isArray(t.children)?t.children.values():Object.values(t.children??{});for(let f of c)f&&r.write(`${JSON.stringify(fCe(f))} +`);return}let n=(0,cCe.asTree)(uCe(t,{configuration:e}),!1,!1);if(n=n.replace(/\0[0-9]+\0/g,""),a>=1&&(n=n.replace(/^([├└]─)/gm,`\u2502 +$1`).replace(/^│\n/,"")),a>=2)for(let c=0;c<2;++c)n=n.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502 +$2`).replace(/^│\n/,"");if(a>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");r.write(n)}function ICt(t){return typeof t=="string"?t.replace(/^\0[0-9]+\0/,""):t}var cCe,pCe=It(()=>{cCe=et(lCe());Qc()});var _R,hCe=It(()=>{_R=class{constructor(e){this.releaseFunction=e;this.map=new Map}addOrCreate(e,r){let s=this.map.get(e);if(typeof s<"u"){if(s.refCount<=0)throw new Error(`Race condition in RefCountedMap. While adding a new key the refCount is: ${s.refCount} for ${JSON.stringify(e)}`);return s.refCount++,{value:s.value,release:()=>this.release(e)}}else{let a=r();return this.map.set(e,{refCount:1,value:a}),{value:a,release:()=>this.release(e)}}}release(e){let r=this.map.get(e);if(!r)throw new Error(`Unbalanced calls to release. No known instances of: ${JSON.stringify(e)}`);let s=r.refCount;if(s<=0)throw new Error(`Unbalanced calls to release. Too many release vs alloc refcount would become: ${s-1} of ${JSON.stringify(e)}`);s==1?(this.map.delete(e),this.releaseFunction(r.value)):r.refCount--}}});function tS(t){let e=t.match(CCt);if(!e?.groups)throw new Error("Assertion failed: Expected the checksum to match the requested pattern");let r=e.groups.cacheVersion?parseInt(e.groups.cacheVersion):null;return{cacheKey:e.groups.cacheKey??null,cacheVersion:r,cacheSpec:e.groups.cacheSpec??null,hash:e.groups.hash}}var gCe,aG,lG,UR,Jr,CCt,cG=It(()=>{Ve();bt();bt();rA();gCe=ye("crypto"),aG=et(ye("fs"));hCe();Fc();I0();kc();Yo();lG=YE(process.env.YARN_CACHE_CHECKPOINT_OVERRIDE??process.env.YARN_CACHE_VERSION_OVERRIDE??9),UR=YE(process.env.YARN_CACHE_VERSION_OVERRIDE??10),Jr=class t{constructor(e,{configuration:r,immutable:s=r.get("enableImmutableCache"),check:a=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.refCountedZipFsCache=new _R(e=>{e.discardAndClose()});this.cacheId=`-${(0,gCe.randomBytes)(8).toString("hex")}.tmp`;this.configuration=r,this.cwd=e,this.immutable=s,this.check=a;let{cacheSpec:n,cacheKey:c}=t.getCacheKey(r);this.cacheSpec=n,this.cacheKey=c}static async find(e,{immutable:r,check:s}={}){let a=new t(e.get("cacheFolder"),{configuration:e,immutable:r,check:s});return await a.setup(),a}static getCacheKey(e){let r=e.get("compressionLevel"),s=r!=="mixed"?`c${r}`:"";return{cacheKey:[UR,s].join(""),cacheSpec:s}}get mirrorCwd(){if(!this.configuration.get("enableMirror"))return null;let e=`${this.configuration.get("globalFolder")}/cache`;return e!==this.cwd?e:null}getVersionFilename(e){return`${nI(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,r){let a=tS(r).hash.slice(0,10);return`${nI(e)}-${a}.zip`}isChecksumCompatible(e){if(e===null)return!1;let{cacheVersion:r,cacheSpec:s}=tS(e);if(r===null||r{let pe=new ps,Be=K.join(vt.root,Z8(e));return pe.mkdirSync(Be,{recursive:!0}),pe.writeJsonSync(K.join(Be,Er.manifest),{name:cn(e),mocked:!0}),pe},E=async(pe,{isColdHit:Be,controlPath:Ce=null})=>{if(Ce===null&&c.unstablePackages?.has(e.locatorHash))return{isValid:!0,hash:null};let g=r&&!Be?tS(r).cacheKey:this.cacheKey,we=!c.skipIntegrityCheck||!r?`${g}/${await SQ(pe)}`:r;if(Ce!==null){let fe=!c.skipIntegrityCheck||!r?`${this.cacheKey}/${await SQ(Ce)}`:r;if(we!==fe)throw new Yt(18,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}let Ee=null;switch(r!==null&&we!==r&&(this.check?Ee="throw":tS(r).cacheKey!==tS(we).cacheKey?Ee="update":Ee=this.configuration.get("checksumBehavior")),Ee){case null:case"update":return{isValid:!0,hash:we};case"ignore":return{isValid:!0,hash:r};case"reset":return{isValid:!1,hash:r};default:case"throw":throw new Yt(18,"The remote archive doesn't match the expected checksum")}},C=async pe=>{if(!n)throw new Error(`Cache check required but no loader configured for ${Yr(this.configuration,e)}`);let Be=await n(),Ce=Be.getRealPath();Be.saveAndClose(),await le.chmodPromise(Ce,420);let g=await E(pe,{controlPath:Ce,isColdHit:!1});if(!g.isValid)throw new Error("Assertion failed: Expected a valid checksum");return g.hash},S=async()=>{if(f===null||!await le.existsPromise(f)){let pe=await n(),Be=pe.getRealPath();return pe.saveAndClose(),{source:"loader",path:Be}}return{source:"mirror",path:f}},P=async()=>{if(!n)throw new Error(`Cache entry required but missing for ${Yr(this.configuration,e)}`);if(this.immutable)throw new Yt(56,`Cache entry required but missing for ${Yr(this.configuration,e)}`);let{path:pe,source:Be}=await S(),{hash:Ce}=await E(pe,{isColdHit:!0}),g=this.getLocatorPath(e,Ce),we=[];Be!=="mirror"&&f!==null&&we.push(async()=>{let fe=`${f}${this.cacheId}`;await le.copyFilePromise(pe,fe,aG.default.constants.COPYFILE_FICLONE),await le.chmodPromise(fe,420),await le.renamePromise(fe,f)}),(!c.mirrorWriteOnly||f===null)&&we.push(async()=>{let fe=`${g}${this.cacheId}`;await le.copyFilePromise(pe,fe,aG.default.constants.COPYFILE_FICLONE),await le.chmodPromise(fe,420),await le.renamePromise(fe,g)});let Ee=c.mirrorWriteOnly?f??g:g;return await Promise.all(we.map(fe=>fe())),[!1,Ee,Ce]},I=async()=>{let Be=(async()=>{let Ce=c.unstablePackages?.has(e.locatorHash),g=Ce||!r||this.isChecksumCompatible(r)?this.getLocatorPath(e,r):null,we=g!==null?this.markedFiles.has(g)||await p.existsPromise(g):!1,Ee=!!c.mockedPackages?.has(e.locatorHash)&&(!this.check||!we),fe=Ee||we,se=fe?s:a;if(se&&se(),fe){let X=null,De=g;if(!Ee)if(this.check)X=await C(De);else{let Re=await E(De,{isColdHit:!1});if(Re.isValid)X=Re.hash;else return P()}return[Ee,De,X]}else{if(this.immutable&&Ce)throw new Yt(56,`Cache entry required but missing for ${Yr(this.configuration,e)}; consider defining ${he.pretty(this.configuration,"supportedArchitectures",he.Type.CODE)} to cache packages for multiple systems`);return P()}})();this.mutexes.set(e.locatorHash,Be);try{return await Be}finally{this.mutexes.delete(e.locatorHash)}};for(let pe;pe=this.mutexes.get(e.locatorHash);)await pe;let[R,N,U]=await I();R||this.markedFiles.add(N);let W=()=>this.refCountedZipFsCache.addOrCreate(N,()=>R?h():new ps(N,{baseFs:p,readOnly:!0})),te,ie=new oE(()=>p3(()=>(te=W(),te.value),pe=>`Failed to open the cache entry for ${Yr(this.configuration,e)}: ${pe}`),K),Ae=new Hf(N,{baseFs:ie,pathUtils:K}),ce=()=>{te?.release()},me=c.unstablePackages?.has(e.locatorHash)?null:U;return[Ae,ce,me]}},CCt=/^(?:(?(?[0-9]+)(?.*))\/)?(?.*)$/});var HR,dCe=It(()=>{HR=(r=>(r[r.SCRIPT=0]="SCRIPT",r[r.SHELLCODE=1]="SHELLCODE",r))(HR||{})});var wCt,zI,uG=It(()=>{bt();Bc();Np();Yo();wCt=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(t,e,r,s)=>`${r}#commit=${s}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(t,e,r="",s,a)=>`https://${r}github.com/${s}.git#commit=${a}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(t,e,r="",s,a)=>`https://${r}github.com/${s}.git#commit=${a}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,t=>`npm:${t}`],[/^https?:\/\/[^/]+\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(t,e)=>kQ({protocol:"npm:",source:null,selector:t,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,t=>`npm:${t}`]],zI=class{constructor(e){this.resolver=e;this.resolutions=null}async setup(e,{report:r}){let s=K.join(e.cwd,Er.lockfile);if(!le.existsSync(s))return;let a=await le.readFilePromise(s,"utf8"),n=ls(a);if(Object.hasOwn(n,"__metadata"))return;let c=this.resolutions=new Map;for(let f of Object.keys(n)){let p=ev(f);if(!p){r.reportWarning(14,`Failed to parse the string "${f}" into a proper descriptor`);continue}let h=ul(p.range)?On(p,`npm:${p.range}`):p,{version:E,resolved:C}=n[f];if(!C)continue;let S;for(let[I,R]of wCt){let N=C.match(I);if(N){S=R(E,...N);break}}if(!S){r.reportWarning(14,`${ri(e.configuration,h)}: Only some patterns can be imported from legacy lockfiles (not "${C}")`);continue}let P=h;try{let I=em(h.range),R=ev(I.selector,!0);R&&(P=R)}catch{}c.set(h.descriptorHash,Ys(P,S))}}supportsDescriptor(e,r){return this.resolutions?this.resolutions.has(e.descriptorHash):!1}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){if(!this.resolutions)throw new Error("Assertion failed: The resolution store should have been setup");let a=this.resolutions.get(e.descriptorHash);if(!a)throw new Error("Assertion failed: The resolution should have been registered");let n=V8(a),c=s.project.configuration.normalizeDependency(n);return await this.resolver.getCandidates(c,r,s)}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}}});var uA,mCe=It(()=>{Fc();Fv();Qc();uA=class extends ho{constructor({configuration:r,stdout:s,suggestInstall:a=!0}){super();this.errorCount=0;YB(this,{configuration:r}),this.configuration=r,this.stdout=s,this.suggestInstall=a}static async start(r,s){let a=new this(r);try{await s(a)}catch(n){a.reportExceptionOnce(n)}finally{await a.finalize()}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(r){}reportCacheMiss(r){}startSectionSync(r,s){return s()}async startSectionPromise(r,s){return await s()}startTimerSync(r,s,a){return(typeof s=="function"?s:a)()}async startTimerPromise(r,s,a){return await(typeof s=="function"?s:a)()}reportSeparator(){}reportInfo(r,s){}reportWarning(r,s){}reportError(r,s){this.errorCount+=1,this.stdout.write(`${Ut(this.configuration,"\u27A4","redBright")} ${this.formatNameWithHyperlink(r)}: ${s} +`)}reportProgress(r){return{...Promise.resolve().then(async()=>{for await(let{}of r);}),stop:()=>{}}}reportJson(r){}reportFold(r,s){}async finalize(){this.errorCount>0&&(this.stdout.write(` +`),this.stdout.write(`${Ut(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command. +`),this.suggestInstall&&this.stdout.write(`${Ut(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help. +`))}formatNameWithHyperlink(r){return m6(r,{configuration:this.configuration,json:!1})}}});var ZI,fG=It(()=>{Yo();ZI=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return!!(r.project.storedResolutions.get(e.descriptorHash)||r.project.originalPackages.has(bQ(e).locatorHash))}supportsLocator(e,r){return!!(r.project.originalPackages.has(e.locatorHash)&&!r.project.lockfileNeedsRefresh)}shouldPersistResolution(e,r){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,s){let a=s.project.storedResolutions.get(e.descriptorHash);if(a){let c=s.project.originalPackages.get(a);if(c)return[c]}let n=s.project.originalPackages.get(bQ(e).locatorHash);if(n)return[n];throw new Error("Resolution expected from the lockfile data")}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let s=r.project.originalPackages.get(e.locatorHash);if(!s)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return s}}});function Xp(){}function BCt(t,e,r,s,a){for(var n=0,c=e.length,f=0,p=0;nP.length?R:P}),h.value=t.join(E)}else h.value=t.join(r.slice(f,f+h.count));f+=h.count,h.added||(p+=h.count)}}var S=e[c-1];return c>1&&typeof S.value=="string"&&(S.added||S.removed)&&t.equals("",S.value)&&(e[c-2].value+=S.value,e.pop()),e}function vCt(t){return{newPos:t.newPos,components:t.components.slice(0)}}function SCt(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function ICe(t,e,r){return r=SCt(r,{ignoreWhitespace:!0}),dG.diff(t,e,r)}function DCt(t,e,r){return mG.diff(t,e,r)}function jR(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?jR=function(e){return typeof e}:jR=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jR(t)}function AG(t){return xCt(t)||kCt(t)||QCt(t)||TCt()}function xCt(t){if(Array.isArray(t))return pG(t)}function kCt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function QCt(t,e){if(t){if(typeof t=="string")return pG(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pG(t,e)}}function pG(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,s=new Array(e);r"u"&&(c.context=4);var f=DCt(r,s,c);if(!f)return;f.push({value:"",lines:[]});function p(U){return U.map(function(W){return" "+W})}for(var h=[],E=0,C=0,S=[],P=1,I=1,R=function(W){var te=f[W],ie=te.lines||te.value.replace(/\n$/,"").split(` +`);if(te.lines=ie,te.added||te.removed){var Ae;if(!E){var ce=f[W-1];E=P,C=I,ce&&(S=c.context>0?p(ce.lines.slice(-c.context)):[],E-=S.length,C-=S.length)}(Ae=S).push.apply(Ae,AG(ie.map(function(fe){return(te.added?"+":"-")+fe}))),te.added?I+=ie.length:P+=ie.length}else{if(E)if(ie.length<=c.context*2&&W=f.length-2&&ie.length<=c.context){var g=/\n$/.test(r),we=/\n$/.test(s),Ee=ie.length==0&&S.length>Ce.oldLines;!g&&Ee&&r.length>0&&S.splice(Ce.oldLines,0,"\\ No newline at end of file"),(!g&&!Ee||!we)&&S.push("\\ No newline at end of file")}h.push(Ce),E=0,C=0,S=[]}P+=ie.length,I+=ie.length}},N=0;N{Xp.prototype={diff:function(e,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=s.callback;typeof s=="function"&&(a=s,s={}),this.options=s;var n=this;function c(R){return a?(setTimeout(function(){a(void 0,R)},0),!0):R}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var f=r.length,p=e.length,h=1,E=f+p;s.maxEditLength&&(E=Math.min(E,s.maxEditLength));var C=[{newPos:-1,components:[]}],S=this.extractCommon(C[0],r,e,0);if(C[0].newPos+1>=f&&S+1>=p)return c([{value:this.join(r),count:r.length}]);function P(){for(var R=-1*h;R<=h;R+=2){var N=void 0,U=C[R-1],W=C[R+1],te=(W?W.newPos:0)-R;U&&(C[R-1]=void 0);var ie=U&&U.newPos+1=f&&te+1>=p)return c(BCt(n,N.components,r,e,n.useLongestToken));C[R]=N}h++}if(a)(function R(){setTimeout(function(){if(h>E)return a();P()||R()},0)})();else for(;h<=E;){var I=P();if(I)return I}},pushComponent:function(e,r,s){var a=e[e.length-1];a&&a.added===r&&a.removed===s?e[e.length-1]={count:a.count+1,added:r,removed:s}:e.push({count:1,added:r,removed:s})},extractCommon:function(e,r,s,a){for(var n=r.length,c=s.length,f=e.newPos,p=f-a,h=0;f+1"u"?r:c}:s;return typeof t=="string"?t:JSON.stringify(hG(t,null,null,a),a," ")};rS.equals=function(t,e){return Xp.prototype.equals.call(rS,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};gG=new Xp;gG.tokenize=function(t){return t.slice()};gG.join=gG.removeEmpty=function(t){return t}});var BCe=L((Str,wCe)=>{var FCt=xc(),NCt=aI(),OCt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,LCt=/^\w*$/;function MCt(t,e){if(FCt(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||NCt(t)?!0:LCt.test(t)||!OCt.test(t)||e!=null&&t in Object(e)}wCe.exports=MCt});var DCe=L((Dtr,SCe)=>{var vCe=kk(),_Ct="Expected a function";function EG(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(_Ct);var r=function(){var s=arguments,a=e?e.apply(this,s):s[0],n=r.cache;if(n.has(a))return n.get(a);var c=t.apply(this,s);return r.cache=n.set(a,c)||n,c};return r.cache=new(EG.Cache||vCe),r}EG.Cache=vCe;SCe.exports=EG});var PCe=L((btr,bCe)=>{var UCt=DCe(),HCt=500;function jCt(t){var e=UCt(t,function(s){return r.size===HCt&&r.clear(),s}),r=e.cache;return e}bCe.exports=jCt});var IG=L((Ptr,xCe)=>{var qCt=PCe(),GCt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,WCt=/\\(\\)?/g,YCt=qCt(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(GCt,function(r,s,a,n){e.push(a?n.replace(WCt,"$1"):s||r)}),e});xCe.exports=YCt});var wm=L((xtr,kCe)=>{var VCt=xc(),KCt=BCe(),JCt=IG(),zCt=Tv();function ZCt(t,e){return VCt(t)?t:KCt(t,e)?[t]:JCt(zCt(t))}kCe.exports=ZCt});var XI=L((ktr,QCe)=>{var XCt=aI(),$Ct=1/0;function ewt(t){if(typeof t=="string"||XCt(t))return t;var e=t+"";return e=="0"&&1/t==-$Ct?"-0":e}QCe.exports=ewt});var qR=L((Qtr,TCe)=>{var twt=wm(),rwt=XI();function nwt(t,e){e=twt(e,t);for(var r=0,s=e.length;t!=null&&r{var iwt=Yk(),swt=wm(),owt=NB(),RCe=Wl(),awt=XI();function lwt(t,e,r,s){if(!RCe(t))return t;e=swt(e,t);for(var a=-1,n=e.length,c=n-1,f=t;f!=null&&++a{var cwt=qR(),uwt=CG(),fwt=wm();function Awt(t,e,r){for(var s=-1,a=e.length,n={};++s{function pwt(t,e){return t!=null&&e in Object(t)}LCe.exports=pwt});var wG=L((Ntr,_Ce)=>{var hwt=wm(),gwt=TB(),dwt=xc(),mwt=NB(),ywt=Nk(),Ewt=XI();function Iwt(t,e,r){e=hwt(e,t);for(var s=-1,a=e.length,n=!1;++s{var Cwt=MCe(),wwt=wG();function Bwt(t,e){return t!=null&&wwt(t,e,Cwt)}UCe.exports=Bwt});var qCe=L((Ltr,jCe)=>{var vwt=OCe(),Swt=HCe();function Dwt(t,e){return vwt(t,e,function(r,s){return Swt(t,s)})}jCe.exports=Dwt});var VCe=L((Mtr,YCe)=>{var GCe=Yd(),bwt=TB(),Pwt=xc(),WCe=GCe?GCe.isConcatSpreadable:void 0;function xwt(t){return Pwt(t)||bwt(t)||!!(WCe&&t&&t[WCe])}YCe.exports=xwt});var zCe=L((_tr,JCe)=>{var kwt=Rk(),Qwt=VCe();function KCe(t,e,r,s,a){var n=-1,c=t.length;for(r||(r=Qwt),a||(a=[]);++n0&&r(f)?e>1?KCe(f,e-1,r,s,a):kwt(a,f):s||(a[a.length]=f)}return a}JCe.exports=KCe});var XCe=L((Utr,ZCe)=>{var Twt=zCe();function Rwt(t){var e=t==null?0:t.length;return e?Twt(t,1):[]}ZCe.exports=Rwt});var BG=L((Htr,$Ce)=>{var Fwt=XCe(),Nwt=i3(),Owt=s3();function Lwt(t){return Owt(Nwt(t,void 0,Fwt),t+"")}$Ce.exports=Lwt});var vG=L((jtr,ewe)=>{var Mwt=qCe(),_wt=BG(),Uwt=_wt(function(t,e){return t==null?{}:Mwt(t,e)});ewe.exports=Uwt});var GR,twe=It(()=>{Fc();GR=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return this.resolver.supportsDescriptor(e,r)}supportsLocator(e,r){return this.resolver.supportsLocator(e,r)}shouldPersistResolution(e,r){return this.resolver.shouldPersistResolution(e,r)}bindDescriptor(e,r,s){return this.resolver.bindDescriptor(e,r,s)}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,s){throw new Yt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async getSatisfying(e,r,s,a){throw new Yt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async resolve(e,r){throw new Yt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}}});var Wi,SG=It(()=>{Fc();Wi=class extends ho{reportCacheHit(e){}reportCacheMiss(e){}startSectionSync(e,r){return r()}async startSectionPromise(e,r){return await r()}startTimerSync(e,r,s){return(typeof r=="function"?r:s)()}async startTimerPromise(e,r,s){return await(typeof r=="function"?r:s)()}reportSeparator(){}reportInfo(e,r){}reportWarning(e,r){}reportError(e,r){}reportProgress(e){return{...Promise.resolve().then(async()=>{for await(let{}of e);}),stop:()=>{}}}reportJson(e){}reportFold(e,r){}async finalize(){}}});var rwe,$I,DG=It(()=>{bt();rwe=et(BQ());oI();tm();Qc();I0();Np();Yo();$I=class{constructor(e,{project:r}){this.workspacesCwds=new Set;this.project=r,this.cwd=e}async setup(){this.manifest=await Ht.tryFind(this.cwd)??new Ht,this.relativeCwd=K.relative(this.project.cwd,this.cwd)||vt.dot;let e=this.manifest.name?this.manifest.name:ba(null,`${this.computeCandidateName()}-${us(this.relativeCwd).substring(0,6)}`);this.anchoredDescriptor=On(e,`${yi.protocol}${this.relativeCwd}`),this.anchoredLocator=Ys(e,`${yi.protocol}${this.relativeCwd}`);let r=this.manifest.workspaceDefinitions.map(({pattern:a})=>a);if(r.length===0)return;let s=await(0,rwe.default)(r,{cwd:ue.fromPortablePath(this.cwd),onlyDirectories:!0,ignore:["**/node_modules","**/.git","**/.yarn"]});s.sort(),await s.reduce(async(a,n)=>{let c=K.resolve(this.cwd,ue.toPortablePath(n)),f=await le.existsPromise(K.join(c,"package.json"));await a,f&&this.workspacesCwds.add(c)},Promise.resolve())}get anchoredPackage(){let e=this.project.storedPackages.get(this.anchoredLocator.locatorHash);if(!e)throw new Error(`Assertion failed: Expected workspace ${rv(this.project.configuration,this)} (${Ut(this.project.configuration,K.join(this.cwd,Er.manifest),Ct.PATH)}) to have been resolved. Run "yarn install" to update the lockfile`);return e}accepts(e){let r=e.indexOf(":"),s=r!==-1?e.slice(0,r+1):null,a=r!==-1?e.slice(r+1):e;if(s===yi.protocol&&K.normalize(a)===this.relativeCwd||s===yi.protocol&&(a==="*"||a==="^"||a==="~"))return!0;let n=ul(a);return n?s===yi.protocol?n.test(this.manifest.version??"0.0.0"):this.project.configuration.get("enableTransparentWorkspaces")&&this.manifest.version!==null?n.test(this.manifest.version):!1:!1}computeCandidateName(){return this.cwd===this.project.cwd?"root-workspace":`${K.basename(this.cwd)}`||"unnamed-workspace"}getRecursiveWorkspaceDependencies({dependencies:e=Ht.hardDependencies}={}){let r=new Set,s=a=>{for(let n of e)for(let c of a.manifest[n].values()){let f=this.project.tryWorkspaceByDescriptor(c);f===null||r.has(f)||(r.add(f),s(f))}};return s(this),r}getRecursiveWorkspaceDependents({dependencies:e=Ht.hardDependencies}={}){let r=new Set,s=a=>{for(let n of this.project.workspaces)e.some(f=>[...n.manifest[f].values()].some(p=>{let h=this.project.tryWorkspaceByDescriptor(p);return h!==null&&$B(h.anchoredLocator,a.anchoredLocator)}))&&!r.has(n)&&(r.add(n),s(n))};return s(this),r}getRecursiveWorkspaceChildren(){let e=new Set([this]);for(let r of e)for(let s of r.workspacesCwds){let a=this.project.workspacesByCwd.get(s);a&&e.add(a)}return e.delete(this),Array.from(e)}async persistManifest(){let e={};this.manifest.exportTo(e);let r=K.join(this.cwd,Ht.fileName),s=`${JSON.stringify(e,null,this.manifest.indent)} +`;await le.changeFilePromise(r,s,{automaticNewlines:!0}),this.manifest.raw=e}}});function Ywt({project:t,allDescriptors:e,allResolutions:r,allPackages:s,accessibleLocators:a=new Set,optionalBuilds:n=new Set,peerRequirements:c=new Map,peerWarnings:f=[],peerRequirementNodes:p=new Map,volatileDescriptors:h=new Set}){let E=new Map,C=[],S=new Map,P=new Map,I=new Map,R=new Map,N=new Map,U=new Map(t.workspaces.map(ce=>{let me=ce.anchoredLocator.locatorHash,pe=s.get(me);if(typeof pe>"u")throw new Error("Assertion failed: The workspace should have an associated package");return[me,zB(pe)]})),W=()=>{let ce=le.mktempSync(),me=K.join(ce,"stacktrace.log"),pe=String(C.length+1).length,Be=C.map((Ce,g)=>`${`${g+1}.`.padStart(pe," ")} ${cl(Ce)} +`).join("");throw le.writeFileSync(me,Be),le.detachTemp(ce),new Yt(45,`Encountered a stack overflow when resolving peer dependencies; cf ${ue.fromPortablePath(me)}`)},te=ce=>{let me=r.get(ce.descriptorHash);if(typeof me>"u")throw new Error("Assertion failed: The resolution should have been registered");let pe=s.get(me);if(!pe)throw new Error("Assertion failed: The package could not be found");return pe},ie=(ce,me,pe,{top:Be,optional:Ce})=>{C.length>1e3&&W(),C.push(me);let g=Ae(ce,me,pe,{top:Be,optional:Ce});return C.pop(),g},Ae=(ce,me,pe,{top:Be,optional:Ce})=>{if(Ce||n.delete(me.locatorHash),a.has(me.locatorHash))return;a.add(me.locatorHash);let g=s.get(me.locatorHash);if(!g)throw new Error(`Assertion failed: The package (${Yr(t.configuration,me)}) should have been registered`);let we=new Set,Ee=new Map,fe=[],se=[],X=[],De=[];for(let Re of Array.from(g.dependencies.values())){if(g.peerDependencies.has(Re.identHash)&&g.locatorHash!==Be)continue;if(Tp(Re))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");h.delete(Re.descriptorHash);let gt=Ce;if(!gt){let ke=g.dependenciesMeta.get(cn(Re));if(typeof ke<"u"){let it=ke.get(null);typeof it<"u"&&it.optional&&(gt=!0)}}let j=r.get(Re.descriptorHash);if(!j)throw new Error(`Assertion failed: The resolution (${ri(t.configuration,Re)}) should have been registered`);let rt=U.get(j)||s.get(j);if(!rt)throw new Error(`Assertion failed: The package (${j}, resolved from ${ri(t.configuration,Re)}) should have been registered`);if(rt.peerDependencies.size===0){ie(Re,rt,new Map,{top:Be,optional:gt});continue}let Fe,Ne,Pe=new Set,Ye=new Map;fe.push(()=>{Fe=J8(Re,me.locatorHash),Ne=z8(rt,me.locatorHash),g.dependencies.set(Re.identHash,Fe),r.set(Fe.descriptorHash,Ne.locatorHash),e.set(Fe.descriptorHash,Fe),s.set(Ne.locatorHash,Ne),xp(R,Ne.locatorHash).add(Fe.descriptorHash),we.add(Ne.locatorHash)}),se.push(()=>{N.set(Ne.locatorHash,Ye);for(let ke of Ne.peerDependencies.values()){let _e=Vl(Ee,ke.identHash,()=>{let x=pe.get(ke.identHash)??null,w=g.dependencies.get(ke.identHash);return!w&&XB(me,ke)&&(ce.identHash===me.identHash?w=ce:(w=On(me,ce.range),e.set(w.descriptorHash,w),r.set(w.descriptorHash,me.locatorHash),h.delete(w.descriptorHash),x=null)),w||(w=On(ke,"missing:")),{subject:me,ident:ke,provided:w,root:!x,requests:new Map,hash:`p${us(me.locatorHash,ke.identHash).slice(0,5)}`}}).provided;if(_e.range==="missing:"&&Ne.dependencies.has(ke.identHash)){Ne.peerDependencies.delete(ke.identHash);continue}if(Ye.set(ke.identHash,{requester:Ne,descriptor:ke,meta:Ne.peerDependenciesMeta.get(cn(ke)),children:new Map}),Ne.dependencies.set(ke.identHash,_e),Tp(_e)){let x=r.get(_e.descriptorHash);xp(I,x).add(Ne.locatorHash)}S.set(_e.identHash,_e),_e.range==="missing:"&&Pe.add(_e.identHash)}Ne.dependencies=new Map(Ws(Ne.dependencies,([ke,it])=>cn(it)))}),X.push(()=>{if(!s.has(Ne.locatorHash))return;let ke=E.get(rt.locatorHash);typeof ke=="number"&&ke>=2&&W();let it=E.get(rt.locatorHash),_e=typeof it<"u"?it+1:1;E.set(rt.locatorHash,_e),ie(Fe,Ne,Ye,{top:Be,optional:gt}),E.set(rt.locatorHash,_e-1)}),De.push(()=>{let ke=r.get(Fe.descriptorHash);if(typeof ke>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let it=N.get(ke);if(typeof it>"u")throw new Error("Assertion failed: Expected the peer requests to be registered");for(let _e of Ee.values()){let x=it.get(_e.ident.identHash);x&&(_e.requests.set(Fe.descriptorHash,x),p.set(_e.hash,_e),_e.root||pe.get(_e.ident.identHash)?.children.set(Fe.descriptorHash,x))}if(s.has(Ne.locatorHash))for(let _e of Pe)Ne.dependencies.delete(_e)})}for(let Re of[...fe,...se])Re();for(let Re of we){we.delete(Re);let gt=s.get(Re),j=us(rI(gt).locatorHash,...Array.from(gt.dependencies.values(),Pe=>{let Ye=Pe.range!=="missing:"?r.get(Pe.descriptorHash):"missing:";if(typeof Ye>"u")throw new Error(`Assertion failed: Expected the resolution for ${ri(t.configuration,Pe)} to have been registered`);return Ye===Be?`${Ye} (top)`:Ye})),rt=P.get(j);if(typeof rt>"u"){P.set(j,gt);continue}let Fe=xp(R,rt.locatorHash);for(let Pe of R.get(gt.locatorHash)??[])r.set(Pe,rt.locatorHash),Fe.add(Pe);s.delete(gt.locatorHash),a.delete(gt.locatorHash),we.delete(gt.locatorHash);let Ne=I.get(gt.locatorHash);if(Ne!==void 0){let Pe=xp(I,rt.locatorHash);for(let Ye of Ne)Pe.add(Ye),we.add(Ye)}}for(let Re of[...X,...De])Re()};for(let ce of t.workspaces){let me=ce.anchoredLocator;h.delete(ce.anchoredDescriptor.descriptorHash),ie(ce.anchoredDescriptor,me,new Map,{top:me.locatorHash,optional:!1})}for(let ce of p.values()){if(!ce.root)continue;let me=s.get(ce.subject.locatorHash);if(typeof me>"u")continue;for(let Be of ce.requests.values()){let Ce=`p${us(ce.subject.locatorHash,cn(ce.ident),Be.requester.locatorHash).slice(0,5)}`;c.set(Ce,{subject:ce.subject.locatorHash,requested:ce.ident,rootRequester:Be.requester.locatorHash,allRequesters:Array.from(nv(Be),g=>g.requester.locatorHash)})}let pe=[...nv(ce)];if(ce.provided.range!=="missing:"){let Be=te(ce.provided),Ce=Be.version??"0.0.0",g=Ee=>{if(Ee.startsWith(yi.protocol)){if(!t.tryWorkspaceByLocator(Be))return null;Ee=Ee.slice(yi.protocol.length),(Ee==="^"||Ee==="~")&&(Ee="*")}return Ee},we=!0;for(let Ee of pe){let fe=g(Ee.descriptor.range);if(fe===null){we=!1;continue}if(!eA(Ce,fe)){we=!1;let se=`p${us(ce.subject.locatorHash,cn(ce.ident),Ee.requester.locatorHash).slice(0,5)}`;f.push({type:1,subject:me,requested:ce.ident,requester:Ee.requester,version:Ce,hash:se,requirementCount:pe.length})}}if(!we){let Ee=pe.map(fe=>g(fe.descriptor.range));f.push({type:3,node:ce,range:Ee.includes(null)?null:$8(Ee),hash:ce.hash})}}else{let Be=!0;for(let Ce of pe)if(!Ce.meta?.optional){Be=!1;let g=`p${us(ce.subject.locatorHash,cn(ce.ident),Ce.requester.locatorHash).slice(0,5)}`;f.push({type:0,subject:me,requested:ce.ident,requester:Ce.requester,hash:g})}Be||f.push({type:2,node:ce,hash:ce.hash})}}}function*Vwt(t){let e=new Map;if("children"in t)e.set(t,t);else for(let r of t.requests.values())e.set(r,r);for(let[r,s]of e){yield{request:r,root:s};for(let a of r.children.values())e.has(a)||e.set(a,s)}}function Kwt(t,e){let r=[],s=[],a=!1;for(let n of t.peerWarnings)if(!(n.type===1||n.type===0)){if(!t.tryWorkspaceByLocator(n.node.subject)){a=!0;continue}if(n.type===3){let c=t.storedResolutions.get(n.node.provided.descriptorHash);if(typeof c>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let f=t.storedPackages.get(c);if(typeof f>"u")throw new Error("Assertion failed: Expected the package to be registered");let p=p0(Vwt(n.node),({request:C,root:S})=>eA(f.version??"0.0.0",C.descriptor.range)?p0.skip:C===S?$i(t.configuration,C.requester):`${$i(t.configuration,C.requester)} (via ${$i(t.configuration,S.requester)})`),h=[...nv(n.node)].length>1?"and other dependencies request":"requests",E=n.range?iI(t.configuration,n.range):Ut(t.configuration,"but they have non-overlapping ranges!","redBright");r.push(`${$i(t.configuration,n.node.ident)} is listed by your project with version ${tv(t.configuration,f.version??"0.0.0")} (${Ut(t.configuration,n.hash,Ct.CODE)}), which doesn't satisfy what ${p} ${h} (${E}).`)}if(n.type===2){let c=n.node.requests.size>1?" and other dependencies":"";s.push(`${Yr(t.configuration,n.node.subject)} doesn't provide ${$i(t.configuration,n.node.ident)} (${Ut(t.configuration,n.hash,Ct.CODE)}), requested by ${$i(t.configuration,n.node.requests.values().next().value.requester)}${c}.`)}}e.startSectionSync({reportFooter:()=>{e.reportWarning(86,`Some peer dependencies are incorrectly met by your project; run ${Ut(t.configuration,"yarn explain peer-requirements ",Ct.CODE)} for details, where ${Ut(t.configuration,"",Ct.CODE)} is the six-letter p-prefixed code.`)},skipIfEmpty:!0},()=>{for(let n of Ws(r,c=>KE.default(c)))e.reportWarning(60,n);for(let n of Ws(s,c=>KE.default(c)))e.reportWarning(2,n)}),a&&e.reportWarning(86,`Some peer dependencies are incorrectly met by dependencies; run ${Ut(t.configuration,"yarn explain peer-requirements",Ct.CODE)} for details.`)}var WR,YR,VR,swe,xG,PG,kG,KR,Hwt,jwt,nwe,qwt,Gwt,Wwt,ec,bG,JR,iwe,Tt,owe=It(()=>{bt();bt();Bc();Wt();WR=ye("crypto");yG();YR=et(vG()),VR=et(Md()),swe=et(fi()),xG=ye("util"),PG=et(ye("v8")),kG=et(ye("zlib"));cG();Cv();uG();fG();oI();iH();Fc();twe();Fv();SG();tm();DG();LQ();Qc();I0();kc();gT();w6();Np();Yo();KR=YE(process.env.YARN_LOCKFILE_VERSION_OVERRIDE??8),Hwt=3,jwt=/ *, */g,nwe=/\/$/,qwt=32,Gwt=(0,xG.promisify)(kG.default.gzip),Wwt=(0,xG.promisify)(kG.default.gunzip),ec=(r=>(r.UpdateLockfile="update-lockfile",r.SkipBuild="skip-build",r))(ec||{}),bG={restoreLinkersCustomData:["linkersCustomData"],restoreResolutions:["accessibleLocators","conditionalLocators","disabledLocators","optionalBuilds","storedDescriptors","storedResolutions","storedPackages","lockFileChecksum"],restoreBuildState:["skippedBuilds","storedBuildState"]},JR=(a=>(a[a.NotProvided=0]="NotProvided",a[a.NotCompatible=1]="NotCompatible",a[a.NodeNotProvided=2]="NodeNotProvided",a[a.NodeNotCompatible=3]="NodeNotCompatible",a))(JR||{}),iwe=t=>us(`${Hwt}`,t),Tt=class t{constructor(e,{configuration:r}){this.resolutionAliases=new Map;this.workspaces=[];this.workspacesByCwd=new Map;this.workspacesByIdent=new Map;this.storedResolutions=new Map;this.storedDescriptors=new Map;this.storedPackages=new Map;this.storedChecksums=new Map;this.storedBuildState=new Map;this.accessibleLocators=new Set;this.conditionalLocators=new Set;this.disabledLocators=new Set;this.originalPackages=new Map;this.optionalBuilds=new Set;this.skippedBuilds=new Set;this.lockfileLastVersion=null;this.lockfileNeedsRefresh=!1;this.peerRequirements=new Map;this.peerWarnings=[];this.peerRequirementNodes=new Map;this.linkersCustomData=new Map;this.lockFileChecksum=null;this.installStateChecksum=null;this.configuration=r,this.cwd=e}static async find(e,r){if(!e.projectCwd)throw new nt(`No project found in ${r}`);let s=e.projectCwd,a=r,n=null;for(;n!==e.projectCwd;){if(n=a,le.existsSync(K.join(n,Er.manifest))){s=n;break}a=K.dirname(n)}let c=new t(e.projectCwd,{configuration:e});ze.telemetry?.reportProject(c.cwd),await c.setupResolutions(),await c.setupWorkspaces(),ze.telemetry?.reportWorkspaceCount(c.workspaces.length),ze.telemetry?.reportDependencyCount(c.workspaces.reduce((I,R)=>I+R.manifest.dependencies.size+R.manifest.devDependencies.size,0));let f=c.tryWorkspaceByCwd(s);if(f)return{project:c,workspace:f,locator:f.anchoredLocator};let p=await c.findLocatorForLocation(`${s}/`,{strict:!0});if(p)return{project:c,locator:p,workspace:null};let h=Ut(e,c.cwd,Ct.PATH),E=Ut(e,K.relative(c.cwd,s),Ct.PATH),C=`- If ${h} isn't intended to be a project, remove any yarn.lock and/or package.json file there.`,S=`- If ${h} is intended to be a project, it might be that you forgot to list ${E} in its workspace configuration.`,P=`- Finally, if ${h} is fine and you intend ${E} to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.`;throw new nt(`The nearest package directory (${Ut(e,s,Ct.PATH)}) doesn't seem to be part of the project declared in ${Ut(e,c.cwd,Ct.PATH)}. + +${[C,S,P].join(` +`)}`)}async setupResolutions(){this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=K.join(this.cwd,Er.lockfile),r=this.configuration.get("defaultLanguageName");if(le.existsSync(e)){let s=await le.readFilePromise(e,"utf8");this.lockFileChecksum=iwe(s);let a=ls(s);if(a.__metadata){let n=a.__metadata.version,c=a.__metadata.cacheKey;this.lockfileLastVersion=n,this.lockfileNeedsRefresh=n"u")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${f})`);let h=Rp(p.resolution,!0),E=new Ht;E.load(p,{yamlCompatibilityMode:!0});let C=E.version,S=E.languageName||r,P=p.linkType.toUpperCase(),I=p.conditions??null,R=E.dependencies,N=E.peerDependencies,U=E.dependenciesMeta,W=E.peerDependenciesMeta,te=E.bin;if(p.checksum!=null){let Ae=typeof c<"u"&&!p.checksum.includes("/")?`${c}/${p.checksum}`:p.checksum;this.storedChecksums.set(h.locatorHash,Ae)}let ie={...h,version:C,languageName:S,linkType:P,conditions:I,dependencies:R,peerDependencies:N,dependenciesMeta:U,peerDependenciesMeta:W,bin:te};this.originalPackages.set(ie.locatorHash,ie);for(let Ae of f.split(jwt)){let ce=C0(Ae);n<=6&&(ce=this.configuration.normalizeDependency(ce),ce=On(ce,ce.range.replace(/^patch:[^@]+@(?!npm(:|%3A))/,"$1npm%3A"))),this.storedDescriptors.set(ce.descriptorHash,ce),this.storedResolutions.set(ce.descriptorHash,h.locatorHash)}}}else s.includes("yarn lockfile v1")&&(this.lockfileLastVersion=-1)}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=new Set,r=(0,VR.default)(4),s=async(a,n)=>{if(e.has(n))return a;e.add(n);let c=new $I(n,{project:this});await r(()=>c.setup());let f=a.then(()=>{this.addWorkspace(c)});return Array.from(c.workspacesCwds).reduce(s,f)};await s(Promise.resolve(),this.cwd)}addWorkspace(e){let r=this.workspacesByIdent.get(e.anchoredLocator.identHash);if(typeof r<"u")throw new Error(`Duplicate workspace name ${$i(this.configuration,e.anchoredLocator)}: ${ue.fromPortablePath(e.cwd)} conflicts with ${ue.fromPortablePath(r.cwd)}`);this.workspaces.push(e),this.workspacesByCwd.set(e.cwd,e),this.workspacesByIdent.set(e.anchoredLocator.identHash,e)}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){K.isAbsolute(e)||(e=K.resolve(this.cwd,e)),e=K.normalize(e).replace(/\/+$/,"");let r=this.workspacesByCwd.get(e);return r||null}getWorkspaceByCwd(e){let r=this.tryWorkspaceByCwd(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByFilePath(e){let r=null;for(let s of this.workspaces)K.relative(s.cwd,e).startsWith("../")||r&&r.cwd.length>=s.cwd.length||(r=s);return r||null}getWorkspaceByFilePath(e){let r=this.tryWorkspaceByFilePath(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByIdent(e){let r=this.workspacesByIdent.get(e.identHash);return typeof r>"u"?null:r}getWorkspaceByIdent(e){let r=this.tryWorkspaceByIdent(e);if(!r)throw new Error(`Workspace not found (${$i(this.configuration,e)})`);return r}tryWorkspaceByDescriptor(e){if(e.range.startsWith(yi.protocol)){let s=e.range.slice(yi.protocol.length);if(s!=="^"&&s!=="~"&&s!=="*"&&!ul(s))return this.tryWorkspaceByCwd(s)}let r=this.tryWorkspaceByIdent(e);return r===null||(Tp(e)&&(e=ZB(e)),!r.accepts(e.range))?null:r}getWorkspaceByDescriptor(e){let r=this.tryWorkspaceByDescriptor(e);if(r===null)throw new Error(`Workspace not found (${ri(this.configuration,e)})`);return r}tryWorkspaceByLocator(e){let r=this.tryWorkspaceByIdent(e);return r===null||(Gu(e)&&(e=rI(e)),r.anchoredLocator.locatorHash!==e.locatorHash)?null:r}getWorkspaceByLocator(e){let r=this.tryWorkspaceByLocator(e);if(!r)throw new Error(`Workspace not found (${Yr(this.configuration,e)})`);return r}deleteDescriptor(e){this.storedResolutions.delete(e),this.storedDescriptors.delete(e)}deleteLocator(e){this.originalPackages.delete(e),this.storedPackages.delete(e),this.accessibleLocators.delete(e)}forgetResolution(e){if("descriptorHash"in e){let r=this.storedResolutions.get(e.descriptorHash);this.deleteDescriptor(e.descriptorHash);let s=new Set(this.storedResolutions.values());typeof r<"u"&&!s.has(r)&&this.deleteLocator(r)}if("locatorHash"in e){this.deleteLocator(e.locatorHash);for(let[r,s]of this.storedResolutions)s===e.locatorHash&&this.deleteDescriptor(r)}}forgetTransientResolutions(){let e=this.configuration.makeResolver(),r=new Map;for(let[s,a]of this.storedResolutions.entries()){let n=r.get(a);n||r.set(a,n=new Set),n.add(s)}for(let s of this.originalPackages.values()){let a;try{a=e.shouldPersistResolution(s,{project:this,resolver:e})}catch{a=!1}if(!a){this.deleteLocator(s.locatorHash);let n=r.get(s.locatorHash);if(n){r.delete(s.locatorHash);for(let c of n)this.deleteDescriptor(c)}}}}forgetVirtualResolutions(){for(let e of this.storedPackages.values())for(let[r,s]of e.dependencies)Tp(s)&&e.dependencies.set(r,ZB(s))}getDependencyMeta(e,r){let s={},n=this.topLevelWorkspace.manifest.dependenciesMeta.get(cn(e));if(!n)return s;let c=n.get(null);if(c&&Object.assign(s,c),r===null||!swe.default.valid(r))return s;for(let[f,p]of n)f!==null&&f===r&&Object.assign(s,p);return s}async findLocatorForLocation(e,{strict:r=!1}={}){let s=new Wi,a=this.configuration.getLinkers(),n={project:this,report:s};for(let c of a){let f=await c.findPackageLocator(e,n);if(f){if(r&&(await c.findPackageLocation(f,n)).replace(nwe,"")!==e.replace(nwe,""))continue;return f}}return null}async loadUserConfig(){let e=K.join(this.cwd,".pnp.cjs");await le.existsPromise(e)&&kp(e).setup();let r=K.join(this.cwd,"yarn.config.cjs");return await le.existsPromise(r)?kp(r):null}async preparePackage(e,{resolver:r,resolveOptions:s}){let a=await this.configuration.getPackageExtensions(),n=this.configuration.normalizePackage(e,{packageExtensions:a});for(let[c,f]of n.dependencies){let p=await this.configuration.reduceHook(E=>E.reduceDependency,f,this,n,f,{resolver:r,resolveOptions:s});if(!XB(f,p))throw new Error("Assertion failed: The descriptor ident cannot be changed through aliases");let h=r.bindDescriptor(p,n,s);n.dependencies.set(c,h)}return n}async resolveEverything(e){if(!this.workspacesByCwd||!this.workspacesByIdent)throw new Error("Workspaces must have been setup before calling this function");this.forgetVirtualResolutions();let r=new Map(this.originalPackages),s=[];e.lockfileOnly||this.forgetTransientResolutions();let a=e.resolver||this.configuration.makeResolver(),n=new zI(a);await n.setup(this,{report:e.report});let c=e.lockfileOnly?[new GR(a)]:[n,a],f=new rm([new ZI(a),...c]),p=new rm([...c]),h=this.configuration.makeFetcher(),E=e.lockfileOnly?{project:this,report:e.report,resolver:f}:{project:this,report:e.report,resolver:f,fetchOptions:{project:this,cache:e.cache,checksums:this.storedChecksums,report:e.report,fetcher:h,cacheOptions:{mirrorWriteOnly:!0}}},C=new Map,S=new Map,P=new Map,I=new Map,R=new Map,N=new Map,U=this.topLevelWorkspace.anchoredLocator,W=new Set,te=[],ie=Tj(),Ae=this.configuration.getSupportedArchitectures();await e.report.startProgressPromise(ho.progressViaTitle(),async se=>{let X=async rt=>{let Fe=await GE(async()=>await f.resolve(rt,E),ke=>`${Yr(this.configuration,rt)}: ${ke}`);if(!$B(rt,Fe))throw new Error(`Assertion failed: The locator cannot be changed by the resolver (went from ${Yr(this.configuration,rt)} to ${Yr(this.configuration,Fe)})`);I.set(Fe.locatorHash,Fe),!r.delete(Fe.locatorHash)&&!this.tryWorkspaceByLocator(Fe)&&s.push(Fe);let Pe=await this.preparePackage(Fe,{resolver:f,resolveOptions:E}),Ye=Uu([...Pe.dependencies.values()].map(ke=>j(ke)));return te.push(Ye),Ye.catch(()=>{}),S.set(Pe.locatorHash,Pe),Pe},De=async rt=>{let Fe=R.get(rt.locatorHash);if(typeof Fe<"u")return Fe;let Ne=Promise.resolve().then(()=>X(rt));return R.set(rt.locatorHash,Ne),Ne},Re=async(rt,Fe)=>{let Ne=await j(Fe);return C.set(rt.descriptorHash,rt),P.set(rt.descriptorHash,Ne.locatorHash),Ne},gt=async rt=>{se.setTitle(ri(this.configuration,rt));let Fe=this.resolutionAliases.get(rt.descriptorHash);if(typeof Fe<"u")return Re(rt,this.storedDescriptors.get(Fe));let Ne=f.getResolutionDependencies(rt,E),Pe=Object.fromEntries(await Uu(Object.entries(Ne).map(async([it,_e])=>{let x=f.bindDescriptor(_e,U,E),w=await j(x);return W.add(w.locatorHash),[it,w]}))),ke=(await GE(async()=>await f.getCandidates(rt,Pe,E),it=>`${ri(this.configuration,rt)}: ${it}`))[0];if(typeof ke>"u")throw new Yt(82,`${ri(this.configuration,rt)}: No candidates found`);if(e.checkResolutions){let{locators:it}=await p.getSatisfying(rt,Pe,[ke],{...E,resolver:p});if(!it.find(_e=>_e.locatorHash===ke.locatorHash))throw new Yt(78,`Invalid resolution ${VB(this.configuration,rt,ke)}`)}return C.set(rt.descriptorHash,rt),P.set(rt.descriptorHash,ke.locatorHash),De(ke)},j=rt=>{let Fe=N.get(rt.descriptorHash);if(typeof Fe<"u")return Fe;C.set(rt.descriptorHash,rt);let Ne=Promise.resolve().then(()=>gt(rt));return N.set(rt.descriptorHash,Ne),Ne};for(let rt of this.workspaces){let Fe=rt.anchoredDescriptor;te.push(j(Fe))}for(;te.length>0;){let rt=[...te];te.length=0,await Uu(rt)}});let ce=Yl(r.values(),se=>this.tryWorkspaceByLocator(se)?Yl.skip:se);if(s.length>0||ce.length>0){let se=new Set(this.workspaces.flatMap(rt=>{let Fe=S.get(rt.anchoredLocator.locatorHash);if(!Fe)throw new Error("Assertion failed: The workspace should have been resolved");return Array.from(Fe.dependencies.values(),Ne=>{let Pe=P.get(Ne.descriptorHash);if(!Pe)throw new Error("Assertion failed: The resolution should have been registered");return Pe})})),X=rt=>se.has(rt.locatorHash)?"0":"1",De=rt=>cl(rt),Re=Ws(s,[X,De]),gt=Ws(ce,[X,De]),j=e.report.getRecommendedLength();Re.length>0&&e.report.reportInfo(85,`${Ut(this.configuration,"+",Ct.ADDED)} ${$k(this.configuration,Re,j)}`),gt.length>0&&e.report.reportInfo(85,`${Ut(this.configuration,"-",Ct.REMOVED)} ${$k(this.configuration,gt,j)}`)}let me=new Set(this.resolutionAliases.values()),pe=new Set(S.keys()),Be=new Set,Ce=new Map,g=[],we=new Map;Ywt({project:this,accessibleLocators:Be,volatileDescriptors:me,optionalBuilds:pe,peerRequirements:Ce,peerWarnings:g,peerRequirementNodes:we,allDescriptors:C,allResolutions:P,allPackages:S});for(let se of W)pe.delete(se);for(let se of me)C.delete(se),P.delete(se);let Ee=new Set,fe=new Set;for(let se of S.values())se.conditions!=null&&pe.has(se.locatorHash)&&(TQ(se,Ae)||(TQ(se,ie)&&e.report.reportWarningOnce(77,`${Yr(this.configuration,se)}: Your current architecture (${process.platform}-${process.arch}) is supported by this package, but is missing from the ${Ut(this.configuration,"supportedArchitectures",Ct.SETTING)} setting`),fe.add(se.locatorHash)),Ee.add(se.locatorHash));this.storedResolutions=P,this.storedDescriptors=C,this.storedPackages=S,this.accessibleLocators=Be,this.conditionalLocators=Ee,this.disabledLocators=fe,this.originalPackages=I,this.optionalBuilds=pe,this.peerRequirements=Ce,this.peerWarnings=g,this.peerRequirementNodes=we}async fetchEverything({cache:e,report:r,fetcher:s,mode:a,persistProject:n=!0}){let c={mockedPackages:this.disabledLocators,unstablePackages:this.conditionalLocators},f=s||this.configuration.makeFetcher(),p={checksums:this.storedChecksums,project:this,cache:e,fetcher:f,report:r,cacheOptions:c},h=Array.from(new Set(Ws(this.storedResolutions.values(),[I=>{let R=this.storedPackages.get(I);if(!R)throw new Error("Assertion failed: The locator should have been registered");return cl(R)}])));a==="update-lockfile"&&(h=h.filter(I=>!this.storedChecksums.has(I)));let E=!1,C=ho.progressViaCounter(h.length);await r.reportProgress(C);let S=(0,VR.default)(qwt);if(await Uu(h.map(I=>S(async()=>{let R=this.storedPackages.get(I);if(!R)throw new Error("Assertion failed: The locator should have been registered");if(Gu(R))return;let N;try{N=await f.fetch(R,p)}catch(U){U.message=`${Yr(this.configuration,R)}: ${U.message}`,r.reportExceptionOnce(U),E=U;return}N.checksum!=null?this.storedChecksums.set(R.locatorHash,N.checksum):this.storedChecksums.delete(R.locatorHash),N.releaseFs&&N.releaseFs()}).finally(()=>{C.tick()}))),E)throw E;let P=n&&a!=="update-lockfile"?await this.cacheCleanup({cache:e,report:r}):null;if(r.cacheMisses.size>0||P){let R=(await Promise.all([...r.cacheMisses].map(async ce=>{let me=this.storedPackages.get(ce),pe=this.storedChecksums.get(ce)??null,Be=e.getLocatorPath(me,pe);return(await le.statPromise(Be)).size}))).reduce((ce,me)=>ce+me,0)-(P?.size??0),N=r.cacheMisses.size,U=P?.count??0,W=`${Vk(N,{zero:"No new packages",one:"A package was",more:`${Ut(this.configuration,N,Ct.NUMBER)} packages were`})} added to the project`,te=`${Vk(U,{zero:"none were",one:"one was",more:`${Ut(this.configuration,U,Ct.NUMBER)} were`})} removed`,ie=R!==0?` (${Ut(this.configuration,R,Ct.SIZE_DIFF)})`:"",Ae=U>0?N>0?`${W}, and ${te}${ie}.`:`${W}, but ${te}${ie}.`:`${W}${ie}.`;r.reportInfo(13,Ae)}}async linkEverything({cache:e,report:r,fetcher:s,mode:a}){let n={mockedPackages:this.disabledLocators,unstablePackages:this.conditionalLocators,skipIntegrityCheck:!0},c=s||this.configuration.makeFetcher(),f={checksums:this.storedChecksums,project:this,cache:e,fetcher:c,report:r,cacheOptions:n},p=this.configuration.getLinkers(),h={project:this,report:r},E=new Map(p.map(Ee=>{let fe=Ee.makeInstaller(h),se=Ee.getCustomDataKey(),X=this.linkersCustomData.get(se);return typeof X<"u"&&fe.attachCustomData(X),[Ee,fe]})),C=new Map,S=new Map,P=new Map,I=new Map(await Uu([...this.accessibleLocators].map(async Ee=>{let fe=this.storedPackages.get(Ee);if(!fe)throw new Error("Assertion failed: The locator should have been registered");return[Ee,await c.fetch(fe,f)]}))),R=[],N=new Set,U=[];for(let Ee of this.accessibleLocators){let fe=this.storedPackages.get(Ee);if(typeof fe>"u")throw new Error("Assertion failed: The locator should have been registered");let se=I.get(fe.locatorHash);if(typeof se>"u")throw new Error("Assertion failed: The fetch result should have been registered");let X=[],De=gt=>{X.push(gt)},Re=this.tryWorkspaceByLocator(fe);if(Re!==null){let gt=[],{scripts:j}=Re.manifest;for(let Fe of["preinstall","install","postinstall"])j.has(Fe)&>.push({type:0,script:Fe});try{for(let[Fe,Ne]of E)if(Fe.supportsPackage(fe,h)&&(await Ne.installPackage(fe,se,{holdFetchResult:De})).buildRequest!==null)throw new Error("Assertion failed: Linkers can't return build directives for workspaces; this responsibility befalls to the Yarn core")}finally{X.length===0?se.releaseFs?.():R.push(Uu(X).catch(()=>{}).then(()=>{se.releaseFs?.()}))}let rt=K.join(se.packageFs.getRealPath(),se.prefixPath);S.set(fe.locatorHash,rt),!Gu(fe)&>.length>0&&P.set(fe.locatorHash,{buildDirectives:gt,buildLocations:[rt]})}else{let gt=p.find(Fe=>Fe.supportsPackage(fe,h));if(!gt)throw new Yt(12,`${Yr(this.configuration,fe)} isn't supported by any available linker`);let j=E.get(gt);if(!j)throw new Error("Assertion failed: The installer should have been registered");let rt;try{rt=await j.installPackage(fe,se,{holdFetchResult:De})}finally{X.length===0?se.releaseFs?.():R.push(Uu(X).then(()=>{}).then(()=>{se.releaseFs?.()}))}C.set(fe.locatorHash,gt),S.set(fe.locatorHash,rt.packageLocation),rt.buildRequest&&rt.packageLocation&&(rt.buildRequest.skipped?(N.add(fe.locatorHash),this.skippedBuilds.has(fe.locatorHash)||U.push([fe,rt.buildRequest.explain])):P.set(fe.locatorHash,{buildDirectives:rt.buildRequest.directives,buildLocations:[rt.packageLocation]}))}}let W=new Map;for(let Ee of this.accessibleLocators){let fe=this.storedPackages.get(Ee);if(!fe)throw new Error("Assertion failed: The locator should have been registered");let se=this.tryWorkspaceByLocator(fe)!==null,X=async(De,Re)=>{let gt=S.get(fe.locatorHash);if(typeof gt>"u")throw new Error(`Assertion failed: The package (${Yr(this.configuration,fe)}) should have been registered`);let j=[];for(let rt of fe.dependencies.values()){let Fe=this.storedResolutions.get(rt.descriptorHash);if(typeof Fe>"u")throw new Error(`Assertion failed: The resolution (${ri(this.configuration,rt)}, from ${Yr(this.configuration,fe)})should have been registered`);let Ne=this.storedPackages.get(Fe);if(typeof Ne>"u")throw new Error(`Assertion failed: The package (${Fe}, resolved from ${ri(this.configuration,rt)}) should have been registered`);let Pe=this.tryWorkspaceByLocator(Ne)===null?C.get(Fe):null;if(typeof Pe>"u")throw new Error(`Assertion failed: The package (${Fe}, resolved from ${ri(this.configuration,rt)}) should have been registered`);Pe===De||Pe===null?S.get(Ne.locatorHash)!==null&&j.push([rt,Ne]):!se&>!==null&&jB(W,Fe).push(gt)}gt!==null&&await Re.attachInternalDependencies(fe,j)};if(se)for(let[De,Re]of E)De.supportsPackage(fe,h)&&await X(De,Re);else{let De=C.get(fe.locatorHash);if(!De)throw new Error("Assertion failed: The linker should have been found");let Re=E.get(De);if(!Re)throw new Error("Assertion failed: The installer should have been registered");await X(De,Re)}}for(let[Ee,fe]of W){let se=this.storedPackages.get(Ee);if(!se)throw new Error("Assertion failed: The package should have been registered");let X=C.get(se.locatorHash);if(!X)throw new Error("Assertion failed: The linker should have been found");let De=E.get(X);if(!De)throw new Error("Assertion failed: The installer should have been registered");await De.attachExternalDependents(se,fe)}let te=new Map;for(let[Ee,fe]of E){let se=await fe.finalizeInstall();for(let X of se?.records??[])X.buildRequest.skipped?(N.add(X.locator.locatorHash),this.skippedBuilds.has(X.locator.locatorHash)||U.push([X.locator,X.buildRequest.explain])):P.set(X.locator.locatorHash,{buildDirectives:X.buildRequest.directives,buildLocations:X.buildLocations});typeof se?.customData<"u"&&te.set(Ee.getCustomDataKey(),se.customData)}if(this.linkersCustomData=te,await Uu(R),a==="skip-build")return;for(let[,Ee]of Ws(U,([fe])=>cl(fe)))Ee(r);let ie=new Set(P.keys()),Ae=(0,WR.createHash)("sha512");Ae.update(process.versions.node),await this.configuration.triggerHook(Ee=>Ee.globalHashGeneration,this,Ee=>{Ae.update("\0"),Ae.update(Ee)});let ce=Ae.digest("hex"),me=new Map,pe=Ee=>{let fe=me.get(Ee.locatorHash);if(typeof fe<"u")return fe;let se=this.storedPackages.get(Ee.locatorHash);if(typeof se>"u")throw new Error("Assertion failed: The package should have been registered");let X=(0,WR.createHash)("sha512");X.update(Ee.locatorHash),me.set(Ee.locatorHash,"");for(let De of se.dependencies.values()){let Re=this.storedResolutions.get(De.descriptorHash);if(typeof Re>"u")throw new Error(`Assertion failed: The resolution (${ri(this.configuration,De)}) should have been registered`);let gt=this.storedPackages.get(Re);if(typeof gt>"u")throw new Error("Assertion failed: The package should have been registered");X.update(pe(gt))}return fe=X.digest("hex"),me.set(Ee.locatorHash,fe),fe},Be=(Ee,fe)=>{let se=(0,WR.createHash)("sha512");se.update(ce),se.update(pe(Ee));for(let X of fe)se.update(X);return se.digest("hex")},Ce=new Map,g=!1,we=Ee=>{let fe=new Set([Ee.locatorHash]);for(let se of fe){let X=this.storedPackages.get(se);if(!X)throw new Error("Assertion failed: The package should have been registered");for(let De of X.dependencies.values()){let Re=this.storedResolutions.get(De.descriptorHash);if(!Re)throw new Error(`Assertion failed: The resolution (${ri(this.configuration,De)}) should have been registered`);if(Re!==Ee.locatorHash&&ie.has(Re))return!1;let gt=this.storedPackages.get(Re);if(!gt)throw new Error("Assertion failed: The package should have been registered");let j=this.tryWorkspaceByLocator(gt);if(j){if(j.anchoredLocator.locatorHash!==Ee.locatorHash&&ie.has(j.anchoredLocator.locatorHash))return!1;fe.add(j.anchoredLocator.locatorHash)}fe.add(Re)}}return!0};for(;ie.size>0;){let Ee=ie.size,fe=[];for(let se of ie){let X=this.storedPackages.get(se);if(!X)throw new Error("Assertion failed: The package should have been registered");if(!we(X))continue;let De=P.get(X.locatorHash);if(!De)throw new Error("Assertion failed: The build directive should have been registered");let Re=Be(X,De.buildLocations);if(this.storedBuildState.get(X.locatorHash)===Re){Ce.set(X.locatorHash,Re),ie.delete(se);continue}g||(await this.persistInstallStateFile(),g=!0),this.storedBuildState.has(X.locatorHash)?r.reportInfo(8,`${Yr(this.configuration,X)} must be rebuilt because its dependency tree changed`):r.reportInfo(7,`${Yr(this.configuration,X)} must be built because it never has been before or the last one failed`);let gt=De.buildLocations.map(async j=>{if(!K.isAbsolute(j))throw new Error(`Assertion failed: Expected the build location to be absolute (not ${j})`);for(let rt of De.buildDirectives){let Fe=`# This file contains the result of Yarn building a package (${cl(X)}) +`;switch(rt.type){case 0:Fe+=`# Script name: ${rt.script} +`;break;case 1:Fe+=`# Script code: ${rt.script} +`;break}let Ne=null;if(!await le.mktempPromise(async Ye=>{let ke=K.join(Ye,"build.log"),{stdout:it,stderr:_e}=this.configuration.getSubprocessStreams(ke,{header:Fe,prefix:Yr(this.configuration,X),report:r}),x;try{switch(rt.type){case 0:x=await MT(X,rt.script,[],{cwd:j,project:this,stdin:Ne,stdout:it,stderr:_e});break;case 1:x=await y6(X,rt.script,[],{cwd:j,project:this,stdin:Ne,stdout:it,stderr:_e});break}}catch(y){_e.write(y.stack),x=1}if(it.end(),_e.end(),x===0)return!0;le.detachTemp(Ye);let w=`${Yr(this.configuration,X)} couldn't be built successfully (exit code ${Ut(this.configuration,x,Ct.NUMBER)}, logs can be found here: ${Ut(this.configuration,ke,Ct.PATH)})`,b=this.optionalBuilds.has(X.locatorHash);return b?r.reportInfo(9,w):r.reportError(9,w),rye&&r.reportFold(ue.fromPortablePath(ke),le.readFileSync(ke,"utf8")),b}))return!1}return!0});fe.push(...gt,Promise.allSettled(gt).then(j=>{ie.delete(se),j.every(rt=>rt.status==="fulfilled"&&rt.value===!0)&&Ce.set(X.locatorHash,Re)}))}if(await Uu(fe),Ee===ie.size){let se=Array.from(ie).map(X=>{let De=this.storedPackages.get(X);if(!De)throw new Error("Assertion failed: The package should have been registered");return Yr(this.configuration,De)}).join(", ");r.reportError(3,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${se})`);break}}this.storedBuildState=Ce,this.skippedBuilds=N}async installWithNewReport(e,r){return(await Ot.start({configuration:this.configuration,json:e.json,stdout:e.stdout,forceSectionAlignment:!0,includeLogs:!e.json&&!e.quiet,includeVersion:!0},async a=>{await this.install({...r,report:a})})).exitCode()}async install(e){let r=this.configuration.get("nodeLinker");ze.telemetry?.reportInstall(r);let s=!1;if(await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{this.configuration.get("enableOfflineMode")&&e.report.reportWarning(90,"Offline work is enabled; Yarn won't fetch packages from the remote registry if it can avoid it"),await this.configuration.triggerHook(E=>E.validateProject,this,{reportWarning:(E,C)=>{e.report.reportWarning(E,C)},reportError:(E,C)=>{e.report.reportError(E,C),s=!0}})}),s)return;let a=await this.configuration.getPackageExtensions();for(let E of a.values())for(let[,C]of E)for(let S of C)S.status="inactive";let n=K.join(this.cwd,Er.lockfile),c=null;if(e.immutable)try{c=await le.readFilePromise(n,"utf8")}catch(E){throw E.code==="ENOENT"?new Yt(28,"The lockfile would have been created by this install, which is explicitly forbidden."):E}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{Kwt(this,e.report);for(let[,E]of a)for(let[,C]of E)for(let S of C)if(S.userProvided){let P=Ut(this.configuration,S,Ct.PACKAGE_EXTENSION);switch(S.status){case"inactive":e.report.reportWarning(68,`${P}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case"redundant":e.report.reportWarning(69,`${P}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(c!==null){let E=Id(c,this.generateLockfile());if(E!==c){let C=CCe(n,n,c,E,void 0,void 0,{maxEditLength:100});if(C){e.report.reportSeparator();for(let S of C.hunks){e.report.reportInfo(null,`@@ -${S.oldStart},${S.oldLines} +${S.newStart},${S.newLines} @@`);for(let P of S.lines)P.startsWith("+")?e.report.reportError(28,Ut(this.configuration,P,Ct.ADDED)):P.startsWith("-")?e.report.reportError(28,Ut(this.configuration,P,Ct.REMOVED)):e.report.reportInfo(null,Ut(this.configuration,P,"grey"))}e.report.reportSeparator()}throw new Yt(28,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let E of a.values())for(let[,C]of E)for(let S of C)S.userProvided&&S.status==="active"&&ze.telemetry?.reportPackageExtension(Zd(S,Ct.PACKAGE_EXTENSION));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e)});let f=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],p=await Promise.all(f.map(async E=>DQ(E,{cwd:this.cwd})));(typeof e.persistProject>"u"||e.persistProject)&&await this.persist(),await e.report.startTimerPromise("Link step",async()=>{if(e.mode==="update-lockfile"){e.report.reportWarning(73,`Skipped due to ${Ut(this.configuration,"mode=update-lockfile",Ct.CODE)}`);return}await this.linkEverything(e);let E=await Promise.all(f.map(async C=>DQ(C,{cwd:this.cwd})));for(let C=0;C{await this.configuration.triggerHook(E=>E.validateProjectAfterInstall,this,{reportWarning:(E,C)=>{e.report.reportWarning(E,C)},reportError:(E,C)=>{e.report.reportError(E,C),h=!0}})}),!h&&await this.configuration.triggerHook(E=>E.afterAllInstalled,this,e)}generateLockfile(){let e=new Map;for(let[n,c]of this.storedResolutions.entries()){let f=e.get(c);f||e.set(c,f=new Set),f.add(n)}let r={},{cacheKey:s}=Jr.getCacheKey(this.configuration);r.__metadata={version:KR,cacheKey:s};for(let[n,c]of e.entries()){let f=this.originalPackages.get(n);if(!f)continue;let p=[];for(let C of c){let S=this.storedDescriptors.get(C);if(!S)throw new Error("Assertion failed: The descriptor should have been registered");p.push(S)}let h=p.map(C=>ll(C)).sort().join(", "),E=new Ht;E.version=f.linkType==="HARD"?f.version:"0.0.0-use.local",E.languageName=f.languageName,E.dependencies=new Map(f.dependencies),E.peerDependencies=new Map(f.peerDependencies),E.dependenciesMeta=new Map(f.dependenciesMeta),E.peerDependenciesMeta=new Map(f.peerDependenciesMeta),E.bin=new Map(f.bin),r[h]={...E.exportTo({},{compatibilityMode:!1}),linkType:f.linkType.toLowerCase(),resolution:cl(f),checksum:this.storedChecksums.get(f.locatorHash),conditions:f.conditions||void 0}}return`${[`# This file is generated by running "yarn install" inside your project. +`,`# Manual changes might be lost - proceed with caution! +`].join("")} +`+il(r)}async persistLockfile(){let e=K.join(this.cwd,Er.lockfile),r="";try{r=await le.readFilePromise(e,"utf8")}catch{}let s=this.generateLockfile(),a=Id(r,s);a!==r&&(await le.writeFilePromise(e,a),this.lockFileChecksum=iwe(a),this.lockfileNeedsRefresh=!1)}async persistInstallStateFile(){let e=[];for(let c of Object.values(bG))e.push(...c);let r=(0,YR.default)(this,e),s=PG.default.serialize(r),a=us(s);if(this.installStateChecksum===a)return;let n=this.configuration.get("installStatePath");await le.mkdirPromise(K.dirname(n),{recursive:!0}),await le.writeFilePromise(n,await Gwt(s)),this.installStateChecksum=a}async restoreInstallState({restoreLinkersCustomData:e=!0,restoreResolutions:r=!0,restoreBuildState:s=!0}={}){let a=this.configuration.get("installStatePath"),n;try{let c=await Wwt(await le.readFilePromise(a));n=PG.default.deserialize(c),this.installStateChecksum=us(c)}catch{r&&await this.applyLightResolution();return}e&&typeof n.linkersCustomData<"u"&&(this.linkersCustomData=n.linkersCustomData),s&&Object.assign(this,(0,YR.default)(n,bG.restoreBuildState)),r&&(n.lockFileChecksum===this.lockFileChecksum?Object.assign(this,(0,YR.default)(n,bG.restoreResolutions)):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new Wi}),await this.persistInstallStateFile()}async persist(){let e=(0,VR.default)(4);await Promise.all([this.persistLockfile(),...this.workspaces.map(r=>e(()=>r.persistManifest()))])}async cacheCleanup({cache:e,report:r}){if(this.configuration.get("enableGlobalCache"))return null;let s=new Set([".gitignore"]);if(!hH(e.cwd,this.cwd)||!await le.existsPromise(e.cwd))return null;let a=[];for(let c of await le.readdirPromise(e.cwd)){if(s.has(c))continue;let f=K.resolve(e.cwd,c);e.markedFiles.has(f)||(e.immutable?r.reportError(56,`${Ut(this.configuration,K.basename(f),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):a.push(le.lstatPromise(f).then(async p=>(await le.removePromise(f),p.size))))}if(a.length===0)return null;let n=await Promise.all(a);return{count:a.length,size:n.reduce((c,f)=>c+f,0)}}}});function Jwt(t){let s=Math.floor(t.timeNow/864e5),a=t.updateInterval*864e5,n=t.state.lastUpdate??t.timeNow+a+Math.floor(a*t.randomInitialInterval),c=n+a,f=t.state.lastTips??s*864e5,p=f+864e5+8*36e5-t.timeZone,h=c<=t.timeNow,E=p<=t.timeNow,C=null;return(h||E||!t.state.lastUpdate||!t.state.lastTips)&&(C={},C.lastUpdate=h?t.timeNow:n,C.lastTips=f,C.blocks=h?{}:t.state.blocks,C.displayedTips=t.state.displayedTips),{nextState:C,triggerUpdate:h,triggerTips:E,nextTips:E?s*864e5:f}}var eC,awe=It(()=>{bt();Rv();I0();pT();kc();Np();eC=class{constructor(e,r){this.values=new Map;this.hits=new Map;this.enumerators=new Map;this.nextTips=0;this.displayedTips=[];this.shouldCommitTips=!1;this.configuration=e;let s=this.getRegistryPath();this.isNew=!le.existsSync(s),this.shouldShowTips=!1,this.sendReport(r),this.startBuffer()}commitTips(){this.shouldShowTips&&(this.shouldCommitTips=!0)}selectTip(e){let r=new Set(this.displayedTips),s=f=>f&&un?eA(un,f):!1,a=e.map((f,p)=>p).filter(f=>e[f]&&s(e[f]?.selector));if(a.length===0)return null;let n=a.filter(f=>!r.has(f));if(n.length===0){let f=Math.floor(a.length*.2);this.displayedTips=f>0?this.displayedTips.slice(-f):[],n=a.filter(p=>!r.has(p))}let c=n[Math.floor(Math.random()*n.length)];return this.displayedTips.push(c),this.commitTips(),e[c]}reportVersion(e){this.reportValue("version",e.replace(/-git\..*/,"-git"))}reportCommandName(e){this.reportValue("commandName",e||"")}reportPluginName(e){this.reportValue("pluginName",e)}reportProject(e){this.reportEnumerator("projectCount",e)}reportInstall(e){this.reportHit("installCount",e)}reportPackageExtension(e){this.reportValue("packageExtension",e)}reportWorkspaceCount(e){this.reportValue("workspaceCount",String(e))}reportDependencyCount(e){this.reportValue("dependencyCount",String(e))}reportValue(e,r){xp(this.values,e).add(r)}reportEnumerator(e,r){xp(this.enumerators,e).add(us(r))}reportHit(e,r="*"){let s=A3(this.hits,e),a=Vl(s,r,()=>0);s.set(r,a+1)}getRegistryPath(){let e=this.configuration.get("globalFolder");return K.join(e,"telemetry.json")}sendReport(e){let r=this.getRegistryPath(),s;try{s=le.readJsonSync(r)}catch{s={}}let{nextState:a,triggerUpdate:n,triggerTips:c,nextTips:f}=Jwt({state:s,timeNow:Date.now(),timeZone:new Date().getTimezoneOffset()*60*1e3,randomInitialInterval:Math.random(),updateInterval:this.configuration.get("telemetryInterval")});if(this.nextTips=f,this.displayedTips=s.displayedTips??[],a!==null)try{le.mkdirSync(K.dirname(r),{recursive:!0}),le.writeJsonSync(r,a)}catch{return!1}if(c&&this.configuration.get("enableTips")&&(this.shouldShowTips=!0),n){let p=s.blocks??{};if(Object.keys(p).length===0){let h=`https://browser-http-intake.logs.datadoghq.eu/v1/input/${e}?ddsource=yarn`,E=C=>Qj(h,C,{configuration:this.configuration}).catch(()=>{});for(let[C,S]of Object.entries(s.blocks??{})){if(Object.keys(S).length===0)continue;let P=S;P.userId=C,P.reportType="primary";for(let N of Object.keys(P.enumerators??{}))P.enumerators[N]=P.enumerators[N].length;E(P);let I=new Map,R=20;for(let[N,U]of Object.entries(P.values))U.length>0&&I.set(N,U.slice(0,R));for(;I.size>0;){let N={};N.userId=C,N.reportType="secondary",N.metrics={};for(let[U,W]of I)N.metrics[U]=W.shift(),W.length===0&&I.delete(U);E(N)}}}}return!0}applyChanges(){let e=this.getRegistryPath(),r;try{r=le.readJsonSync(e)}catch{r={}}let s=this.configuration.get("telemetryUserId")??"*",a=r.blocks=r.blocks??{},n=a[s]=a[s]??{};for(let c of this.hits.keys()){let f=n.hits=n.hits??{},p=f[c]=f[c]??{};for(let[h,E]of this.hits.get(c))p[h]=(p[h]??0)+E}for(let c of["values","enumerators"])for(let f of this[c].keys()){let p=n[c]=n[c]??{};p[f]=[...new Set([...p[f]??[],...this[c].get(f)??[]])]}this.shouldCommitTips&&(r.lastTips=this.nextTips,r.displayedTips=this.displayedTips),le.mkdirSync(K.dirname(e),{recursive:!0}),le.writeJsonSync(e,r)}startBuffer(){process.on("exit",()=>{try{this.applyChanges()}catch{}})}}});var nS={};Vt(nS,{BuildDirectiveType:()=>HR,CACHE_CHECKPOINT:()=>lG,CACHE_VERSION:()=>UR,Cache:()=>Jr,Configuration:()=>ze,DEFAULT_RC_FILENAME:()=>Mj,FormatType:()=>Lde,InstallMode:()=>ec,LEGACY_PLUGINS:()=>Ev,LOCKFILE_VERSION:()=>KR,LegacyMigrationResolver:()=>zI,LightReport:()=>uA,LinkType:()=>VE,LockfileResolver:()=>ZI,Manifest:()=>Ht,MessageName:()=>Dr,MultiFetcher:()=>lI,PackageExtensionStatus:()=>d3,PackageExtensionType:()=>g3,PeerWarningType:()=>JR,Project:()=>Tt,Report:()=>ho,ReportError:()=>Yt,SettingsType:()=>Iv,StreamReport:()=>Ot,TAG_REGEXP:()=>Hp,TelemetryManager:()=>eC,ThrowReport:()=>Wi,VirtualFetcher:()=>cI,WindowsLinkType:()=>IT,Workspace:()=>$I,WorkspaceFetcher:()=>uI,WorkspaceResolver:()=>yi,YarnVersion:()=>un,execUtils:()=>Gr,folderUtils:()=>OQ,formatUtils:()=>he,hashUtils:()=>Nn,httpUtils:()=>An,miscUtils:()=>je,nodeUtils:()=>As,parseMessageName:()=>rk,reportOptionDeprecations:()=>DI,scriptUtils:()=>In,semverUtils:()=>Or,stringifyMessageName:()=>Vf,structUtils:()=>q,tgzUtils:()=>hs,treeUtils:()=>ks});var Ve=It(()=>{dT();LQ();Qc();I0();pT();kc();gT();w6();Np();Yo();oCe();pCe();cG();Cv();Cv();dCe();uG();mCe();fG();oI();nk();nH();owe();Fc();Fv();awe();SG();sH();oH();tm();DG();Rv();BAe()});var pwe=L((hnr,sS)=>{"use strict";var Zwt=process.env.TERM_PROGRAM==="Hyper",Xwt=process.platform==="win32",uwe=process.platform==="linux",QG={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},fwe=Object.assign({},QG,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),Awe=Object.assign({},QG,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:uwe?"\u25B8":"\u276F",pointerSmall:uwe?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});sS.exports=Xwt&&!Zwt?fwe:Awe;Reflect.defineProperty(sS.exports,"common",{enumerable:!1,value:QG});Reflect.defineProperty(sS.exports,"windows",{enumerable:!1,value:fwe});Reflect.defineProperty(sS.exports,"other",{enumerable:!1,value:Awe})});var Ju=L((gnr,TG)=>{"use strict";var $wt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),e1t=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,hwe=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=n=>{let c=n.open=`\x1B[${n.codes[0]}m`,f=n.close=`\x1B[${n.codes[1]}m`,p=n.regex=new RegExp(`\\u001b\\[${n.codes[1]}m`,"g");return n.wrap=(h,E)=>{h.includes(f)&&(h=h.replace(p,f+c));let C=c+h+f;return E?C.replace(/\r*\n/g,`${f}$&${c}`):C},n},r=(n,c,f)=>typeof n=="function"?n(c):n.wrap(c,f),s=(n,c)=>{if(n===""||n==null)return"";if(t.enabled===!1)return n;if(t.visible===!1)return"";let f=""+n,p=f.includes(` +`),h=c.length;for(h>0&&c.includes("unstyle")&&(c=[...new Set(["unstyle",...c])].reverse());h-- >0;)f=r(t.styles[c[h]],f,p);return f},a=(n,c,f)=>{t.styles[n]=e({name:n,codes:c}),(t.keys[f]||(t.keys[f]=[])).push(n),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(h){t.alias(n,h)},get(){let h=E=>s(E,h.stack);return Reflect.setPrototypeOf(h,t),h.stack=this.stack?this.stack.concat(n):[n],h}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=e1t,t.hasColor=t.hasAnsi=n=>(t.ansiRegex.lastIndex=0,typeof n=="string"&&n!==""&&t.ansiRegex.test(n)),t.alias=(n,c)=>{let f=typeof c=="string"?t[c]:c;if(typeof f!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");f.stack||(Reflect.defineProperty(f,"name",{value:n}),t.styles[n]=f,f.stack=[n]),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(p){t.alias(n,p)},get(){let p=h=>s(h,p.stack);return Reflect.setPrototypeOf(p,t),p.stack=this.stack?this.stack.concat(f.stack):f.stack,p}})},t.theme=n=>{if(!$wt(n))throw new TypeError("Expected theme to be an object");for(let c of Object.keys(n))t.alias(c,n[c]);return t},t.alias("unstyle",n=>typeof n=="string"&&n!==""?(t.ansiRegex.lastIndex=0,n.replace(t.ansiRegex,"")):""),t.alias("noop",n=>n),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=pwe(),t.define=a,t};TG.exports=hwe();TG.exports.create=hwe});var $o=L(pn=>{"use strict";var t1t=Object.prototype.toString,Gc=Ju(),gwe=!1,RG=[],dwe={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};pn.longest=(t,e)=>t.reduce((r,s)=>Math.max(r,e?s[e].length:s.length),0);pn.hasColor=t=>!!t&&Gc.hasColor(t);var ZR=pn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);pn.nativeType=t=>t1t.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");pn.isAsyncFn=t=>pn.nativeType(t)==="asyncfunction";pn.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";pn.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;pn.scrollDown=(t=[])=>[...t.slice(1),t[0]];pn.scrollUp=(t=[])=>[t.pop(),...t];pn.reorder=(t=[])=>{let e=t.slice();return e.sort((r,s)=>r.index>s.index?1:r.index{let s=t.length,a=r===s?0:r<0?s-1:r,n=t[e];t[e]=t[a],t[a]=n};pn.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};pn.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};pn.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:s=` +`+r,width:a=80}=e,n=(s+r).match(/[^\S\n]/g)||[];a-=n.length;let c=`.{1,${a}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,f=t.trim(),p=new RegExp(c,"g"),h=f.match(p)||[];return h=h.map(E=>E.replace(/\n$/,"")),e.padEnd&&(h=h.map(E=>E.padEnd(a," "))),e.padStart&&(h=h.map(E=>E.padStart(a," "))),r+h.join(s)};pn.unmute=t=>{let e=t.stack.find(s=>Gc.keys.color.includes(s));return e?Gc[e]:t.stack.find(s=>s.slice(2)==="bg")?Gc[e.slice(2)]:s=>s};pn.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";pn.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(s=>Gc.keys.color.includes(s));if(e){let s=Gc["bg"+pn.pascal(e)];return s?s.black:t}let r=t.stack.find(s=>s.slice(0,2)==="bg");return r?Gc[r.slice(2).toLowerCase()]||t:Gc.none};pn.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(s=>Gc.keys.color.includes(s)),r=t.stack.find(s=>s.slice(0,2)==="bg");if(e&&!r)return Gc[dwe[e]||e];if(r){let s=r.slice(2).toLowerCase(),a=dwe[s];return a&&Gc["bg"+pn.pascal(a)]||t}return Gc.none};pn.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),s=e>=12?"pm":"am";e=e%12;let a=e===0?12:e,n=r<10?"0"+r:r;return a+":"+n+" "+s};pn.set=(t={},e="",r)=>e.split(".").reduce((s,a,n,c)=>{let f=c.length-1>n?s[a]||{}:r;return!pn.isObject(f)&&n{let s=t[e]==null?e.split(".").reduce((a,n)=>a&&a[n],t):t[e];return s??r};pn.mixin=(t,e)=>{if(!ZR(t))return e;if(!ZR(e))return t;for(let r of Object.keys(e)){let s=Object.getOwnPropertyDescriptor(e,r);if(s.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&ZR(s.value)){let a=Object.getOwnPropertyDescriptor(t,r);ZR(a.value)?t[r]=pn.merge({},t[r],e[r]):Reflect.defineProperty(t,r,s)}else Reflect.defineProperty(t,r,s);else Reflect.defineProperty(t,r,s)}return t};pn.merge=(...t)=>{let e={};for(let r of t)pn.mixin(e,r);return e};pn.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let s of Object.keys(r)){let a=r[s];typeof a=="function"?pn.define(t,s,a.bind(e)):pn.define(t,s,a)}};pn.onExit=t=>{let e=(r,s)=>{gwe||(gwe=!0,RG.forEach(a=>a()),r===!0&&process.exit(128+s))};RG.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),RG.push(t)};pn.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};pn.defineExport=(t,e,r)=>{let s;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(a){s=a},get(){return s?s():r()}})}});var mwe=L(iC=>{"use strict";iC.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};iC.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};iC.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};iC.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};iC.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var Iwe=L((ynr,Ewe)=>{"use strict";var ywe=ye("readline"),r1t=mwe(),n1t=/^(?:\x1b)([a-zA-Z0-9])$/,i1t=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,s1t={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function o1t(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function a1t(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var XR=(t="",e={})=>{let r,s={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t="\x1B"+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=s.sequence||""),s.sequence=s.sequence||t||s.name,t==="\r")s.raw=void 0,s.name="return";else if(t===` +`)s.name="enter";else if(t===" ")s.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x1B\x7F"||t==="\x1B\b")s.name="backspace",s.meta=t.charAt(0)==="\x1B";else if(t==="\x1B"||t==="\x1B\x1B")s.name="escape",s.meta=t.length===2;else if(t===" "||t==="\x1B ")s.name="space",s.meta=t.length===2;else if(t<="")s.name=String.fromCharCode(t.charCodeAt(0)+97-1),s.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")s.name="number";else if(t.length===1&&t>="a"&&t<="z")s.name=t;else if(t.length===1&&t>="A"&&t<="Z")s.name=t.toLowerCase(),s.shift=!0;else if(r=n1t.exec(t))s.meta=!0,s.shift=/^[A-Z]$/.test(r[1]);else if(r=i1t.exec(t)){let a=[...t];a[0]==="\x1B"&&a[1]==="\x1B"&&(s.option=!0);let n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),c=(r[3]||r[5]||1)-1;s.ctrl=!!(c&4),s.meta=!!(c&10),s.shift=!!(c&1),s.code=n,s.name=s1t[n],s.shift=o1t(n)||s.shift,s.ctrl=a1t(n)||s.ctrl}return s};XR.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let s=ywe.createInterface({terminal:!0,input:r});ywe.emitKeypressEvents(r,s);let a=(f,p)=>e(f,XR(f,p),s),n=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",a),s.resume(),()=>{r.isTTY&&r.setRawMode(n),r.removeListener("keypress",a),s.pause(),s.close()}};XR.action=(t,e,r)=>{let s={...r1t,...r};return e.ctrl?(e.action=s.ctrl[e.name],e):e.option&&s.option?(e.action=s.option[e.name],e):e.shift?(e.action=s.shift[e.name],e):(e.action=s.keys[e.name],e)};Ewe.exports=XR});var wwe=L((Enr,Cwe)=>{"use strict";Cwe.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(e)for(let r of Object.keys(e)){let s=e[r];typeof s=="number"&&(s={interval:s}),l1t(t,r,s)}};function l1t(t,e,r={}){let s=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},a=r.interval||120;s.frames=r.frames||[],s.loading=!0;let n=setInterval(()=>{s.ms=Date.now()-s.start,s.tick++,t.render()},a);return s.stop=()=>{s.loading=!1,clearInterval(n)},Reflect.defineProperty(s,"interval",{value:n}),t.once("close",()=>s.stop()),s.stop}});var vwe=L((Inr,Bwe)=>{"use strict";var{define:c1t,width:u1t}=$o(),FG=class{constructor(e){let r=e.options;c1t(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=u1t(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};Bwe.exports=FG});var Dwe=L((Cnr,Swe)=>{"use strict";var NG=$o(),mo=Ju(),OG={default:mo.noop,noop:mo.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||NG.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||NG.complement(this.primary)},primary:mo.cyan,success:mo.green,danger:mo.magenta,strong:mo.bold,warning:mo.yellow,muted:mo.dim,disabled:mo.gray,dark:mo.dim.gray,underline:mo.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};OG.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(mo.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(mo.visible=t.styles.visible);let e=NG.merge({},OG,t.styles);delete e.merge;for(let r of Object.keys(mo))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>mo[r]});for(let r of Object.keys(mo.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>mo[r]});return e};Swe.exports=OG});var Pwe=L((wnr,bwe)=>{"use strict";var LG=process.platform==="win32",$p=Ju(),f1t=$o(),MG={...$p.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:$p.symbols.check,leftAngle:"\u2039",mark:"\u203B",minus:"\u2212",multiplication:"\xD7",obelus:"\xF7",percent:"%",pilcrow:"\xB6",pilcrow2:"\u2761",pencilUpRight:"\u2710",pencilDownRight:"\u270E",pencilRight:"\u270F",plus:"+",plusMinus:"\xB1",pointRight:"\u261E",rightAngle:"\u203A",section:"\xA7",hexagon:{off:"\u2B21",on:"\u2B22",disabled:"\u2B22"},ballot:{on:"\u2611",off:"\u2610",disabled:"\u2612"},stars:{on:"\u2605",off:"\u2606",disabled:"\u2606"},folder:{on:"\u25BC",off:"\u25B6",disabled:"\u25B6"},prefix:{pending:$p.symbols.question,submitted:$p.symbols.check,cancelled:$p.symbols.cross},separator:{pending:$p.symbols.pointerSmall,submitted:$p.symbols.middot,cancelled:$p.symbols.middot},radio:{off:LG?"( )":"\u25EF",on:LG?"(*)":"\u25C9",disabled:LG?"(|)":"\u24BE"},numbers:["\u24EA","\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246A","\u246B","\u246C","\u246D","\u246E","\u246F","\u2470","\u2471","\u2472","\u2473","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325A","\u325B","\u325C","\u325D","\u325E","\u325F","\u32B1","\u32B2","\u32B3","\u32B4","\u32B5","\u32B6","\u32B7","\u32B8","\u32B9","\u32BA","\u32BB","\u32BC","\u32BD","\u32BE","\u32BF"]};MG.merge=t=>{let e=f1t.merge({},$p.symbols,MG,t.symbols);return delete e.merge,e};bwe.exports=MG});var kwe=L((Bnr,xwe)=>{"use strict";var A1t=Dwe(),p1t=Pwe(),h1t=$o();xwe.exports=t=>{t.options=h1t.merge({},t.options.theme,t.options),t.symbols=p1t.merge(t.options),t.styles=A1t.merge(t.options)}});var Nwe=L((Rwe,Fwe)=>{"use strict";var Qwe=process.env.TERM_PROGRAM==="Apple_Terminal",g1t=Ju(),_G=$o(),zu=Fwe.exports=Rwe,Mi="\x1B[",Twe="\x07",UG=!1,q0=zu.code={bell:Twe,beep:Twe,beginning:`${Mi}G`,down:`${Mi}J`,esc:Mi,getPosition:`${Mi}6n`,hide:`${Mi}?25l`,line:`${Mi}2K`,lineEnd:`${Mi}K`,lineStart:`${Mi}1K`,restorePosition:Mi+(Qwe?"8":"u"),savePosition:Mi+(Qwe?"7":"s"),screen:`${Mi}2J`,show:`${Mi}?25h`,up:`${Mi}1J`},Bm=zu.cursor={get hidden(){return UG},hide(){return UG=!0,q0.hide},show(){return UG=!1,q0.show},forward:(t=1)=>`${Mi}${t}C`,backward:(t=1)=>`${Mi}${t}D`,nextLine:(t=1)=>`${Mi}E`.repeat(t),prevLine:(t=1)=>`${Mi}F`.repeat(t),up:(t=1)=>t?`${Mi}${t}A`:"",down:(t=1)=>t?`${Mi}${t}B`:"",right:(t=1)=>t?`${Mi}${t}C`:"",left:(t=1)=>t?`${Mi}${t}D`:"",to(t,e){return e?`${Mi}${e+1};${t+1}H`:`${Mi}${t+1}G`},move(t=0,e=0){let r="";return r+=t<0?Bm.left(-t):t>0?Bm.right(t):"",r+=e<0?Bm.up(-e):e>0?Bm.down(e):"",r},restore(t={}){let{after:e,cursor:r,initial:s,input:a,prompt:n,size:c,value:f}=t;if(s=_G.isPrimitive(s)?String(s):"",a=_G.isPrimitive(a)?String(a):"",f=_G.isPrimitive(f)?String(f):"",c){let p=zu.cursor.up(c)+zu.cursor.to(n.length),h=a.length-r;return h>0&&(p+=zu.cursor.left(h)),p}if(f||e){let p=!a&&s?-s.length:-a.length+r;return e&&(p-=e.length),a===""&&s&&!n.includes(s)&&(p+=s.length),zu.cursor.move(p)}}},HG=zu.erase={screen:q0.screen,up:q0.up,down:q0.down,line:q0.line,lineEnd:q0.lineEnd,lineStart:q0.lineStart,lines(t){let e="";for(let r=0;r{if(!e)return HG.line+Bm.to(0);let r=n=>[...g1t.unstyle(n)].length,s=t.split(/\r?\n/),a=0;for(let n of s)a+=1+Math.floor(Math.max(r(n)-1,0)/e);return(HG.line+Bm.prevLine()).repeat(a-1)+HG.line+Bm.to(0)}});var sC=L((vnr,Lwe)=>{"use strict";var d1t=ye("events"),Owe=Ju(),jG=Iwe(),m1t=wwe(),y1t=vwe(),E1t=kwe(),hl=$o(),vm=Nwe(),qG=class t extends d1t{constructor(e={}){super(),this.name=e.name,this.type=e.type,this.options=e,E1t(this),m1t(this),this.state=new y1t(this),this.initial=[e.initial,e.default].find(r=>r!=null),this.stdout=e.stdout||process.stdout,this.stdin=e.stdin||process.stdin,this.scale=e.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=C1t(this.options.margin),this.setMaxListeners(0),I1t(this)}async keypress(e,r={}){this.keypressed=!0;let s=jG.action(e,jG(e,r),this.options.actions);this.state.keypress=s,this.emit("keypress",e,s),this.emit("state",this.state.clone());let a=this.options[s.action]||this[s.action]||this.dispatch;if(typeof a=="function")return await a.call(this,e,s);this.alert()}alert(){delete this.state.alert,this.options.show===!1?this.emit("alert"):this.stdout.write(vm.code.beep)}cursorHide(){this.stdout.write(vm.cursor.hide()),hl.onExit(()=>this.cursorShow())}cursorShow(){this.stdout.write(vm.cursor.show())}write(e){e&&(this.stdout&&this.state.show!==!1&&this.stdout.write(e),this.state.buffer+=e)}clear(e=0){let r=this.state.buffer;this.state.buffer="",!(!r&&!e||this.options.show===!1)&&this.stdout.write(vm.cursor.down(e)+vm.clear(r,this.width))}restore(){if(this.state.closed||this.options.show===!1)return;let{prompt:e,after:r,rest:s}=this.sections(),{cursor:a,initial:n="",input:c="",value:f=""}=this,p=this.state.size=s.length,h={after:r,cursor:a,initial:n,input:c,prompt:e,size:p,value:f},E=vm.cursor.restore(h);E&&this.stdout.write(E)}sections(){let{buffer:e,input:r,prompt:s}=this.state;s=Owe.unstyle(s);let a=Owe.unstyle(e),n=a.indexOf(s),c=a.slice(0,n),p=a.slice(n).split(` +`),h=p[0],E=p[p.length-1],S=(s+(r?" "+r:"")).length,P=Se.call(this,this.value),this.result=()=>s.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let a=r.onSubmit.bind(this),n=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await a(this.name,this.value,this),n())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,s){let{options:a,state:n,symbols:c,timers:f}=this,p=f&&f[e];n.timer=p;let h=a[e]||n[e]||c[e],E=r&&r[e]!=null?r[e]:await h;if(E==="")return E;let C=await this.resolve(E,n,r,s);return!C&&r&&r[e]?this.resolve(h,n,r,s):C}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,s=this.state;return s.timer=r,hl.isObject(e)&&(e=e[s.status]||e.pending),hl.hasColor(e)?e:(this.styles[s.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return hl.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,s=this.state;s.timer=r;let a=e[s.status]||e.pending||s.separator,n=await this.resolve(a,s);return hl.isObject(n)&&(n=n[s.status]||n.pending),hl.hasColor(n)?n:this.styles.muted(n)}async pointer(e,r){let s=await this.element("pointer",e,r);if(typeof s=="string"&&hl.hasColor(s))return s;if(s){let a=this.styles,n=this.index===r,c=n?a.primary:h=>h,f=await this.resolve(s[n?"on":"off"]||s,this.state),p=hl.hasColor(f)?f:c(f);return n?p:" ".repeat(f.length)}}async indicator(e,r){let s=await this.element("indicator",e,r);if(typeof s=="string"&&hl.hasColor(s))return s;if(s){let a=this.styles,n=e.enabled===!0,c=n?a.success:a.dark,f=s[n?"on":"off"]||s;return hl.hasColor(f)?f:c(f)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return hl.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return hl.resolve(this,e,...r)}get base(){return t.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||hl.height(this.stdout,25)}get width(){return this.options.columns||hl.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,s=[r,e].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return e=>new this(e).run()}};function I1t(t){let e=a=>t[a]===void 0||typeof t[a]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],s=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let a of Object.keys(t.options)){if(r.includes(a)||/^on[A-Z]/.test(a))continue;let n=t.options[a];typeof n=="function"&&e(a)?s.includes(a)||(t[a]=n.bind(t)):typeof t[a]!="function"&&(t[a]=n)}}function C1t(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=a=>a%2===0?` +`:" ",s=[];for(let a=0;a<4;a++){let n=r(a);e[a]?s.push(n.repeat(e[a])):s.push("")}return s}Lwe.exports=qG});var Uwe=L((Snr,_we)=>{"use strict";var w1t=$o(),Mwe={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return Mwe.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};_we.exports=(t,e={})=>{let r=w1t.merge({},Mwe,e.roles);return r[t]||r.default}});var oS=L((Dnr,qwe)=>{"use strict";var B1t=Ju(),v1t=sC(),S1t=Uwe(),$R=$o(),{reorder:GG,scrollUp:D1t,scrollDown:b1t,isObject:Hwe,swap:P1t}=$R,WG=class extends v1t{constructor(e){super(e),this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:s,suggest:a}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(n=>n.enabled=!1),typeof a!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");Hwe(r)&&(r=Object.keys(r)),Array.isArray(r)?(s!=null&&(this.index=this.findIndex(s)),r.forEach(n=>this.enable(this.find(n))),await this.render()):(s!=null&&(r=s),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let s=[],a=0,n=async(c,f)=>{typeof c=="function"&&(c=await c.call(this)),c instanceof Promise&&(c=await c);for(let p=0;p(this.state.loadingChoices=!1,c))}async toChoice(e,r,s){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let a=e.value;if(e=S1t(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,$R.define(e,"parent",s),e.level=s?s.level+1:1,e.indent==null&&(e.indent=s?s.indent+" ":e.indent||""),e.path=s?s.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,B1t.unstyle(e.message).length));let c={...e};return e.reset=(f=c.input,p=c.value)=>{for(let h of Object.keys(c))e[h]=c[h];e.input=f,e.value=p},a==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,s){let a=await this.toChoice(e,r,s);return this.choices.push(a),this.index=this.choices.length-1,this.limit=this.choices.length,a}async newItem(e,r,s){let a={name:"New choice name?",editable:!0,newChoice:!0,...e},n=await this.addChoice(a,r,s);return n.updateChoice=()=>{delete n.newChoice,n.name=n.message=n.input,n.input="",n.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelectedr.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e.choices.forEach(a=>this.toggle(a,r));let s=e.parent;for(;s;){let a=s.choices.filter(n=>this.isDisabled(n));s.enabled=a.every(n=>n.enabled===!0),s=s.parent}return jwe(this,this.choices),this.emit("toggle",e,this),e}enable(e){return this.selected.length>=this.maxSelected?this.alert():(e.enabled=!this.isDisabled(e),e.choices&&e.choices.forEach(this.enable.bind(this)),e)}disable(e){return e.enabled=!1,e.choices&&e.choices.forEach(this.disable.bind(this)),e}number(e){this.num+=e;let r=s=>{let a=Number(s);if(a>this.choices.length-1)return this.alert();let n=this.focused,c=this.choices.find(f=>a===f.index);if(!c.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(c)===-1){let f=GG(this.choices),p=f.indexOf(c);if(n.index>p){let h=f.slice(p,p+this.limit),E=f.filter(C=>!h.includes(C));this.choices=h.concat(E)}else{let h=p-this.limit+1;this.choices=f.slice(h).concat(f.slice(0,h))}}return this.index=this.choices.indexOf(c),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise(s=>{let a=this.choices.length,n=this.num,c=(f=!1,p)=>{clearTimeout(this.numberTimeout),f&&(p=r(n)),this.num="",s(p)};if(n==="0"||n.length===1&&+(n+"0")>a)return c(!0);if(Number(n)>a)return c(!1,this.alert());this.numberTimeout=setTimeout(()=>c(!0),this.delay)})}home(){return this.choices=GG(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,r=GG(this.choices);return this.choices=r.slice(e).concat(r.slice(0,e)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){return this.visible.length<=1?this.alert():this.up()}next(){return this.visible.length<=1?this.alert():this.down()}right(){return this.cursor>=this.input.length?this.alert():(this.cursor++,this.render())}left(){return this.cursor<=0?this.alert():(this.cursor--,this.render())}up(){let e=this.choices.length,r=this.visible.length,s=this.index;return this.options.scroll===!1&&s===0?this.alert():e>r&&s===0?this.scrollUp():(this.index=(s-1%e+e)%e,this.isDisabled()?this.up():this.render())}down(){let e=this.choices.length,r=this.visible.length,s=this.index;return this.options.scroll===!1&&s===r-1?this.alert():e>r&&s===r-1?this.scrollDown():(this.index=(s+1)%e,this.isDisabled()?this.down():this.render())}scrollUp(e=0){return this.choices=D1t(this.choices),this.index=e,this.isDisabled()?this.up():this.render()}scrollDown(e=this.visible.length-1){return this.choices=b1t(this.choices),this.index=e,this.isDisabled()?this.down():this.render()}async shiftUp(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index-1),await this.up(),this.sorting=!1;return}return this.scrollUp(this.index)}async shiftDown(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index+1),await this.down(),this.sorting=!1;return}return this.scrollDown(this.index)}pageUp(){return this.visible.length<=1?this.alert():(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled()?this.up():this.render())}pageDown(){return this.visible.length>=this.choices.length?this.alert():(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled()?this.down():this.render())}swap(e){P1t(this.choices,this.index,e)}isDisabled(e=this.focused){return e&&["disabled","collapsed","hidden","completing","readonly"].some(s=>e[s]===!0)?!0:e&&e.role==="heading"}isEnabled(e=this.focused){if(Array.isArray(e))return e.every(r=>this.isEnabled(r));if(e.choices){let r=e.choices.filter(s=>!this.isDisabled(s));return e.enabled&&r.every(s=>this.isEnabled(s))}return e.enabled&&!this.isDisabled(e)}isChoice(e,r){return e.name===r||e.index===Number(r)}isSelected(e){return Array.isArray(this.initial)?this.initial.some(r=>this.isChoice(e,r)):this.isChoice(e,this.initial)}map(e=[],r="value"){return[].concat(e||[]).reduce((s,a)=>(s[a]=this.find(a,r),s),{})}filter(e,r){let a=typeof e=="function"?e:(f,p)=>[f.name,p].includes(e),c=(this.options.multiple?this.state._choices:this.choices).filter(a);return r?c.map(f=>f[r]):c}find(e,r){if(Hwe(e))return r?e[r]:e;let a=typeof e=="function"?e:(c,f)=>[c.name,f].includes(e),n=this.choices.find(a);if(n)return r?n[r]:n}findIndex(e){return this.choices.indexOf(this.find(e))}async submit(){let e=this.focused;if(!e)return this.alert();if(e.newChoice)return e.input?(e.updateChoice(),this.render()):this.alert();if(this.choices.some(c=>c.newChoice))return this.alert();let{reorder:r,sort:s}=this.options,a=this.multiple===!0,n=this.selected;return n===void 0?this.alert():(Array.isArray(n)&&r!==!1&&s!==!0&&(n=$R.reorder(n)),this.value=a?n.map(c=>c.name):n.name,super.submit())}set choices(e=[]){this.state._choices=this.state._choices||[],this.state.choices=e;for(let r of e)this.state._choices.some(s=>s.name===r.name)||this.state._choices.push(r);if(!this._initial&&this.options.initial){this._initial=!0;let r=this.initial;if(typeof r=="string"||typeof r=="number"){let s=this.find(r);s&&(this.initial=s.index,this.focus(s,!0))}}}get choices(){return jwe(this,this.state.choices||[])}set visible(e){this.state.visible=e}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(e){this.state.limit=e}get limit(){let{state:e,options:r,choices:s}=this,a=e.limit||this._limit||r.limit||s.length;return Math.min(a,this.height)}set value(e){super.value=e}get value(){return typeof super.value!="string"&&super.value===this.initial?this.input:super.value}set index(e){this.state.index=e}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let e=this.choices[this.index];return e&&this.state.submitted&&this.multiple!==!0&&(e.enabled=!0),e}get selectable(){return this.choices.filter(e=>!this.isDisabled(e))}get selected(){return this.multiple?this.enabled:this.focused}};function jwe(t,e){if(e instanceof Promise)return e;if(typeof e=="function"){if($R.isAsyncFn(e))return e;e=e.call(t,t)}for(let r of e){if(Array.isArray(r.choices)){let s=r.choices.filter(a=>!t.isDisabled(a));r.enabled=s.every(a=>a.enabled===!0)}t.isDisabled(r)===!0&&delete r.enabled}return e}qwe.exports=WG});var G0=L((bnr,Gwe)=>{"use strict";var x1t=oS(),YG=$o(),VG=class extends x1t{constructor(e){super(e),this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}separator(){if(this.options.separator)return super.separator();let e=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():e}pointer(e,r){return!this.multiple||this.options.pointer?super.pointer(e,r):""}indicator(e,r){return this.multiple?super.indicator(e,r):""}choiceMessage(e,r){let s=this.resolve(e.message,this.state,e,r);return e.role==="heading"&&!YG.hasColor(s)&&(s=this.styles.strong(s)),this.resolve(s,this.state,e,r)}choiceSeparator(){return":"}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=await this.pointer(e,r),n=await this.indicator(e,r)+(e.pad||""),c=await this.resolve(e.hint,this.state,e,r);c&&!YG.hasColor(c)&&(c=this.styles.muted(c));let f=this.indent(e),p=await this.choiceMessage(e,r),h=()=>[this.margin[3],f+a+n,p,this.margin[1],c].filter(Boolean).join(" ");return e.role==="heading"?h():e.disabled?(YG.hasColor(p)||(p=this.styles.disabled(p)),h()):(s&&(p=this.styles.em(p)),h())}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(n,c)=>await this.renderChoice(n,c)),r=await Promise.all(e);r.length||r.push(this.styles.danger("No matching choices"));let s=this.margin[0]+r.join(` +`),a;return this.options.choicesHeader&&(a=await this.resolve(this.options.choicesHeader,this.state)),[a,s].filter(Boolean).join(` +`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,s="",a=await this.header(),n=await this.prefix(),c=await this.separator(),f=await this.message();this.options.promptLine!==!1&&(s=[n,f,c,""].join(" "),this.state.prompt=s);let p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),C=await this.footer();p&&(s+=p),h&&!s.includes(h)&&(s+=" "+h),e&&!p&&!E.trim()&&this.multiple&&this.emptyError!=null&&(s+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,s,E,C].filter(Boolean).join(` +`)),this.write(this.margin[2]),this.restore()}};Gwe.exports=VG});var Ywe=L((Pnr,Wwe)=>{"use strict";var k1t=G0(),Q1t=(t,e)=>{let r=t.toLowerCase();return s=>{let n=s.toLowerCase().indexOf(r),c=e(s.slice(n,n+r.length));return n>=0?s.slice(0,n)+c+s.slice(n+r.length):s}},KG=class extends k1t{constructor(e){super(e),this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:s}=this.state;return this.input=s.slice(0,r)+e+s.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let s=e.toLowerCase();return r.filter(a=>a.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=Q1t(this.input,e),s=this.choices;this.choices=s.map(a=>({...a,message:r(a.message)})),await super.render(),this.choices=s}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};Wwe.exports=KG});var zG=L((xnr,Vwe)=>{"use strict";var JG=$o();Vwe.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:s="",pos:a,showCursor:n=!0,color:c}=e,f=c||t.styles.placeholder,p=JG.inverse(t.styles.primary),h=R=>p(t.styles.black(R)),E=r,C=" ",S=h(C);if(t.blink&&t.blink.off===!0&&(h=R=>R,S=""),n&&a===0&&s===""&&r==="")return h(C);if(n&&a===0&&(r===s||r===""))return h(s[0])+f(s.slice(1));s=JG.isPrimitive(s)?`${s}`:"",r=JG.isPrimitive(r)?`${r}`:"";let P=s&&s.startsWith(r)&&s!==r,I=P?h(s[r.length]):S;if(a!==r.length&&n===!0&&(E=r.slice(0,a)+h(r[a])+r.slice(a+1),I=""),n===!1&&(I=""),P){let R=t.styles.unstyle(E+I);return E+I+f(s.slice(R.length))}return E+I}});var eF=L((knr,Kwe)=>{"use strict";var T1t=Ju(),R1t=G0(),F1t=zG(),ZG=class extends R1t{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:s,input:a}=r;return r.value=r.input=a.slice(0,s)+e+a.slice(s),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:s}=e;return e.value=e.input=s.slice(0,r-1)+s.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:s}=e;if(s[r]===void 0)return this.alert();let a=`${s}`.slice(0,r)+`${s}`.slice(r+1);return e.value=e.input=a,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:s}=e;return r&&r.startsWith(s)&&s!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let s=await this.resolve(e.separator,this.state,e,r)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:s,styles:a}=this,{cursor:n,initial:c="",name:f,hint:p,input:h=""}=e,{muted:E,submitted:C,primary:S,danger:P}=a,I=p,R=this.index===r,N=e.validate||(()=>!0),U=await this.choiceSeparator(e,r),W=e.message;this.align==="right"&&(W=W.padStart(this.longest+1," ")),this.align==="left"&&(W=W.padEnd(this.longest+1," "));let te=this.values[f]=h||c,ie=h?"success":"dark";await N.call(e,te,this.state)!==!0&&(ie="danger");let Ae=a[ie],ce=Ae(await this.indicator(e,r))+(e.pad||""),me=this.indent(e),pe=()=>[me,ce,W+U,h,I].filter(Boolean).join(" ");if(s.submitted)return W=T1t.unstyle(W),h=C(h),I="",pe();if(e.format)h=await e.format.call(this,h,e,r);else{let Be=this.styles.muted;h=F1t(this,{input:h,initial:c,pos:n,showCursor:R,color:Be})}return this.isValue(h)||(h=this.styles.muted(this.symbols.ellipsis)),e.result&&(this.values[f]=await e.result.call(this,te,e,r)),R&&(W=S(W)),e.error?h+=(h?" ":"")+P(e.error.trim()):e.hint&&(h+=(h?" ":"")+E(e.hint.trim())),pe()}async submit(){return this.value=this.values,super.base.submit.call(this)}};Kwe.exports=ZG});var XG=L((Qnr,zwe)=>{"use strict";var N1t=eF(),O1t=()=>{throw new Error("expected prompt to have a custom authenticate method")},Jwe=(t=O1t)=>{class e extends N1t{constructor(s){super(s)}async submit(){this.value=await t.call(this,this.values,this.state),super.base.submit.call(this)}static create(s){return Jwe(s)}}return e};zwe.exports=Jwe()});var $we=L((Tnr,Xwe)=>{"use strict";var L1t=XG();function M1t(t,e){return t.username===this.options.username&&t.password===this.options.password}var Zwe=(t=M1t)=>{let e=[{name:"username",message:"username"},{name:"password",message:"password",format(s){return this.options.showPassword?s:(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(s.length))}}];class r extends L1t.create(t){constructor(a){super({...a,choices:e})}static create(a){return Zwe(a)}}return r};Xwe.exports=Zwe()});var tF=L((Rnr,e1e)=>{"use strict";var _1t=sC(),{isPrimitive:U1t,hasColor:H1t}=$o(),$G=class extends _1t{constructor(e){super(e),this.cursorHide()}async initialize(){let e=await this.resolve(this.initial,this.state);this.input=await this.cast(e),await super.initialize()}dispatch(e){return this.isValue(e)?(this.input=e,this.submit()):this.alert()}format(e){let{styles:r,state:s}=this;return s.submitted?r.success(e):r.primary(e)}cast(e){return this.isTrue(e)}isTrue(e){return/^[ty1]/i.test(e)}isFalse(e){return/^[fn0]/i.test(e)}isValue(e){return U1t(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");return H1t(e)?e:this.styles.muted(e)}}async render(){let{input:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),c=this.styles.muted(this.default),f=[s,n,c,a].filter(Boolean).join(" ");this.state.prompt=f;let p=await this.header(),h=this.value=this.cast(e),E=await this.format(h),C=await this.error()||await this.hint(),S=await this.footer();C&&!f.includes(C)&&(E+=" "+C),f+=" "+E,this.clear(r),this.write([p,f,S].filter(Boolean).join(` +`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};e1e.exports=$G});var r1e=L((Fnr,t1e)=>{"use strict";var j1t=tF(),e5=class extends j1t{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};t1e.exports=e5});var i1e=L((Nnr,n1e)=>{"use strict";var q1t=G0(),G1t=eF(),oC=G1t.prototype,t5=class extends q1t{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let s=this.focused,a=s.parent||{};return!s.editable&&!a.editable&&(e==="a"||e==="i")?super[e]():oC.dispatch.call(this,e,r)}append(e,r){return oC.append.call(this,e,r)}delete(e,r){return oC.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?oC.next.call(this):super.next()}prev(){return this.focused.editable?oC.prev.call(this):super.prev()}async indicator(e,r){let s=e.indicator||"",a=e.editable?s:super.indicator(e,r);return await this.resolve(a,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?oC.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let s=r.parent?this.value[r.parent.name]:this.value;if(r.editable?s=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(s=r.enabled===!0),e=await r.validate(s,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};n1e.exports=t5});var Sm=L((Onr,s1e)=>{"use strict";var W1t=sC(),Y1t=zG(),{isPrimitive:V1t}=$o(),r5=class extends W1t{constructor(e){super(e),this.initial=V1t(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let s=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!s||s.name!=="return")?this.append(` +`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:s}=this.state;this.input=`${s}`.slice(0,r)+e+`${s}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),s=this.input.slice(e),a=r.split(" ");this.state.clipboard.push(a.pop()),this.input=a.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):Y1t(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),s=await this.separator(),a=await this.message(),n=[r,a,s].filter(Boolean).join(" ");this.state.prompt=n;let c=await this.header(),f=await this.format(),p=await this.error()||await this.hint(),h=await this.footer();p&&!f.includes(p)&&(f+=" "+p),n+=" "+f,this.clear(e),this.write([c,n,h].filter(Boolean).join(` +`)),this.restore()}};s1e.exports=r5});var a1e=L((Lnr,o1e)=>{"use strict";var K1t=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),rF=t=>K1t(t).filter(Boolean);o1e.exports=(t,e={},r="")=>{let{past:s=[],present:a=""}=e,n,c;switch(t){case"prev":case"undo":return n=s.slice(0,s.length-1),c=s[s.length-1]||"",{past:rF([r,...n]),present:c};case"next":case"redo":return n=s.slice(1),c=s[0]||"",{past:rF([...n,r]),present:c};case"save":return{past:rF([...s,r]),present:""};case"remove":return c=rF(s.filter(f=>f!==r)),a="",c.length&&(a=c.pop()),{past:c,present:a};default:throw new Error(`Invalid action: "${t}"`)}}});var i5=L((Mnr,c1e)=>{"use strict";var J1t=Sm(),l1e=a1e(),n5=class extends J1t{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let s=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:s},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=l1e(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){this.store&&(this.data=l1e("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};c1e.exports=n5});var f1e=L((_nr,u1e)=>{"use strict";var z1t=Sm(),s5=class extends z1t{format(){return""}};u1e.exports=s5});var p1e=L((Unr,A1e)=>{"use strict";var Z1t=Sm(),o5=class extends Z1t{constructor(e={}){super(e),this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};A1e.exports=o5});var g1e=L((Hnr,h1e)=>{"use strict";var X1t=G0(),a5=class extends X1t{constructor(e){super({...e,multiple:!0})}};h1e.exports=a5});var c5=L((jnr,d1e)=>{"use strict";var $1t=Sm(),l5=class extends $1t{constructor(e={}){super({style:"number",...e}),this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,s=this.toNumber(this.input);return s>this.max+r?this.alert():(this.input=`${s+r}`,this.render())}down(e){let r=e||this.minor,s=this.toNumber(this.input);return sthis.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};d1e.exports=l5});var y1e=L((qnr,m1e)=>{m1e.exports=c5()});var I1e=L((Gnr,E1e)=>{"use strict";var e2t=Sm(),u5=class extends e2t{constructor(e){super(e),this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};E1e.exports=u5});var B1e=L((Wnr,w1e)=>{"use strict";var t2t=Ju(),r2t=oS(),C1e=$o(),f5=class extends r2t{constructor(e={}){super(e),this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||` + `;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((s,a)=>({name:a+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let s=0;s=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){return this.scaleKey===!1||this.state.submitted?"":["",...this.scale.map(s=>` ${s.name} - ${s.message}`)].map(s=>this.styles.muted(s)).join(` +`)}renderScaleHeading(e){let r=this.scale.map(p=>p.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let s=this.scaleLength-r.join("").length,a=Math.round(s/(r.length-1)),c=r.map(p=>this.styles.strong(p)).join(" ".repeat(a)),f=" ".repeat(this.widths[0]);return this.margin[3]+f+this.margin[1]+c}scaleIndicator(e,r,s){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,s);let a=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):a?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let s=e.scale.map(n=>this.scaleIndicator(e,n,r)),a=this.term==="Hyper"?"":" ";return s.join(a+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=await this.pointer(e,r),n=await e.hint;n&&!C1e.hasColor(n)&&(n=this.styles.muted(n));let c=I=>this.margin[3]+I.replace(/\s+$/,"").padEnd(this.widths[0]," "),f=this.newline,p=this.indent(e),h=await this.resolve(e.message,this.state,e,r),E=await this.renderScale(e,r),C=this.margin[1]+this.margin[3];this.scaleLength=t2t.unstyle(E).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-C.length);let P=C1e.wordWrap(h,{width:this.widths[0],newline:f}).split(` +`).map(I=>c(I)+this.margin[1]);return s&&(E=this.styles.info(E),P=P.map(I=>this.styles.info(I))),P[0]+=E,this.linebreak&&P.push(""),[p+a,P.join(` +`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(a,n)=>await this.renderChoice(a,n)),r=await Promise.all(e),s=await this.renderScaleHeading();return this.margin[0]+[s,...r.map(a=>a.join(" "))].join(` +`)}async render(){let{submitted:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),c="";this.options.promptLine!==!1&&(c=[s,n,a,""].join(" "),this.state.prompt=c);let f=await this.header(),p=await this.format(),h=await this.renderScaleKey(),E=await this.error()||await this.hint(),C=await this.renderChoices(),S=await this.footer(),P=this.emptyError;p&&(c+=p),E&&!c.includes(E)&&(c+=" "+E),e&&!p&&!C.trim()&&this.multiple&&P!=null&&(c+=this.styles.danger(P)),this.clear(r),this.write([f,c,h,C,S].filter(Boolean).join(` +`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};w1e.exports=f5});var D1e=L((Ynr,S1e)=>{"use strict";var v1e=Ju(),n2t=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",p5=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=n2t(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},i2t=async(t={},e={},r=s=>s)=>{let s=new Set,a=t.fields||[],n=t.template,c=[],f=[],p=[],h=1;typeof n=="function"&&(n=await n());let E=-1,C=()=>n[++E],S=()=>n[E+1],P=I=>{I.line=h,c.push(I)};for(P({type:"bos",value:""});Eie.name===U.key);U.field=a.find(ie=>ie.name===U.key),te||(te=new p5(U),f.push(te)),te.lines.push(U.line-1);continue}let R=c[c.length-1];R.type==="text"&&R.line===h?R.value+=I:P({type:"text",value:I})}return P({type:"eos",value:""}),{input:n,tabstops:c,unique:s,keys:p,items:f}};S1e.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),s={...e.values,...e.initial},{tabstops:a,items:n,keys:c}=await i2t(e,s),f=A5("result",t,e),p=A5("format",t,e),h=A5("validate",t,e,!0),E=t.isValue.bind(t);return async(C={},S=!1)=>{let P=0;C.required=r,C.items=n,C.keys=c,C.output="";let I=async(W,te,ie,Ae)=>{let ce=await h(W,te,ie,Ae);return ce===!1?"Invalid field "+ie.name:ce};for(let W of a){let te=W.value,ie=W.key;if(W.type!=="template"){te&&(C.output+=te);continue}if(W.type==="template"){let Ae=n.find(Ce=>Ce.name===ie);e.required===!0&&C.required.add(Ae.name);let ce=[Ae.input,C.values[Ae.value],Ae.value,te].find(E),pe=(Ae.field||{}).message||W.inner;if(S){let Ce=await I(C.values[ie],C,Ae,P);if(Ce&&typeof Ce=="string"||Ce===!1){C.invalid.set(ie,Ce);continue}C.invalid.delete(ie);let g=await f(C.values[ie],C,Ae,P);C.output+=v1e.unstyle(g);continue}Ae.placeholder=!1;let Be=te;te=await p(te,C,Ae,P),ce!==te?(C.values[ie]=ce,te=t.styles.typing(ce),C.missing.delete(pe)):(C.values[ie]=void 0,ce=`<${pe}>`,te=t.styles.primary(ce),Ae.placeholder=!0,C.required.has(ie)&&C.missing.add(pe)),C.missing.has(pe)&&C.validating&&(te=t.styles.warning(ce)),C.invalid.has(ie)&&C.validating&&(te=t.styles.danger(ce)),P===C.index&&(Be!==te?te=t.styles.underline(te):te=t.styles.heading(v1e.unstyle(te))),P++}te&&(C.output+=te)}let R=C.output.split(` +`).map(W=>" "+W),N=n.length,U=0;for(let W of n)C.invalid.has(W.name)&&W.lines.forEach(te=>{R[te][0]===" "&&(R[te]=C.styles.danger(C.symbols.bullet)+R[te].slice(1))}),t.isValue(C.values[W.name])&&U++;return C.completed=(U/N*100).toFixed(0),C.output=R.join(` +`),C.output}};function A5(t,e,r,s){return(a,n,c,f)=>typeof c.field[t]=="function"?c.field[t].call(e,a,n,c,f):[s,a].find(p=>e.isValue(p))}});var P1e=L((Vnr,b1e)=>{"use strict";var s2t=Ju(),o2t=D1e(),a2t=sC(),h5=class extends a2t{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await o2t(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let s=this.getItem(),a=s.input.slice(0,this.cursor),n=s.input.slice(this.cursor);this.input=s.input=`${a}${e}${n}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),s=e.input.slice(0,this.cursor-1);this.input=e.input=`${s}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:s,size:a}=this.state,n=[this.options.newline,` +`].find(W=>W!=null),c=await this.prefix(),f=await this.separator(),p=await this.message(),h=[c,p,f].filter(Boolean).join(" ");this.state.prompt=h;let E=await this.header(),C=await this.error()||"",S=await this.hint()||"",P=s?"":await this.interpolate(this.state),I=this.state.key=r[e]||"",R=await this.format(I),N=await this.footer();R&&(h+=" "+R),S&&!R&&this.state.completed===0&&(h+=" "+S),this.clear(a);let U=[E,h,P,N,C.trim()];this.write(U.filter(Boolean).join(n)),this.restore()}getItem(e){let{items:r,keys:s,index:a}=this.state,n=r.find(c=>c.name===s[a]);return n&&n.input!=null&&(this.input=n.input,this.cursor=n.cursor),n}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:s,values:a}=this.state;if(e.size){let f="";for(let[p,h]of e)f+=`Invalid ${p}: ${h} +`;return this.state.error=f,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let c=s2t.unstyle(s).split(` +`).map(f=>f.slice(1)).join(` +`);return this.value={values:a,result:c},super.submit()}};b1e.exports=h5});var k1e=L((Knr,x1e)=>{"use strict";var l2t="(Use + to sort)",c2t=G0(),g5=class extends c2t{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,l2t].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let s=await super.renderChoice(e,r),a=this.symbols.identicalTo+" ",n=this.index===r&&this.sorting?this.styles.muted(a):" ";return this.options.drag===!1&&(n=""),this.options.numbered===!0?n+`${r+1} - `+s:n+s}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};x1e.exports=g5});var T1e=L((Jnr,Q1e)=>{"use strict";var u2t=oS(),d5=class extends u2t{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(s=>this.styles.muted(s)),this.state.header=r.join(` + `)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let s of r)s.scale=f2t(5,this.options),s.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],s=r.selected;return e.scale.forEach(a=>a.selected=!1),r.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=this.term==="Hyper",n=a?9:8,c=a?"":" ",f=this.symbols.line.repeat(n),p=" ".repeat(n+(a?0:1)),h=te=>(te?this.styles.success("\u25C9"):"\u25EF")+c,E=r+1+".",C=s?this.styles.heading:this.styles.noop,S=await this.resolve(e.message,this.state,e,r),P=this.indent(e),I=P+e.scale.map((te,ie)=>h(ie===e.scaleIdx)).join(f),R=te=>te===e.scaleIdx?C(te):te,N=P+e.scale.map((te,ie)=>R(ie)).join(p),U=()=>[E,S].filter(Boolean).join(" "),W=()=>[U(),I,N," "].filter(Boolean).join(` +`);return s&&(I=this.styles.cyan(I),N=this.styles.cyan(N)),W()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(s,a)=>await this.renderChoice(s,a)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(` +`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),c=[s,n,a].filter(Boolean).join(" ");this.state.prompt=c;let f=await this.header(),p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),C=await this.footer();(p||!h)&&(c+=" "+p),h&&!c.includes(h)&&(c+=" "+h),e&&!p&&!E&&this.multiple&&this.type!=="form"&&(c+=this.styles.danger(this.emptyError)),this.clear(r),this.write([c,f,E,C].filter(Boolean).join(` +`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function f2t(t,e={}){if(Array.isArray(e.scale))return e.scale.map(s=>({...s}));let r=[];for(let s=1;s{R1e.exports=i5()});var O1e=L((Znr,N1e)=>{"use strict";var A2t=tF(),m5=class extends A2t{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=s=>this.styles.primary.underline(s);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),s=await this.prefix(),a=await this.separator(),n=await this.message(),c=await this.format(),f=await this.error()||await this.hint(),p=await this.footer(),h=[s,n,a,c].join(" ");this.state.prompt=h,f&&!h.includes(f)&&(h+=" "+f),this.clear(e),this.write([r,h,p].filter(Boolean).join(` +`)),this.write(this.margin[2]),this.restore()}};N1e.exports=m5});var M1e=L((Xnr,L1e)=>{"use strict";var p2t=G0(),y5=class extends p2t{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let s=await super.toChoices(e,r);if(s.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw new Error("Please specify the index of the correct answer from the list of choices");return s}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};L1e.exports=y5});var U1e=L(E5=>{"use strict";var _1e=$o(),Qs=(t,e)=>{_1e.defineExport(E5,t,e),_1e.defineExport(E5,t.toLowerCase(),e)};Qs("AutoComplete",()=>Ywe());Qs("BasicAuth",()=>$we());Qs("Confirm",()=>r1e());Qs("Editable",()=>i1e());Qs("Form",()=>eF());Qs("Input",()=>i5());Qs("Invisible",()=>f1e());Qs("List",()=>p1e());Qs("MultiSelect",()=>g1e());Qs("Numeral",()=>y1e());Qs("Password",()=>I1e());Qs("Scale",()=>B1e());Qs("Select",()=>G0());Qs("Snippet",()=>P1e());Qs("Sort",()=>k1e());Qs("Survey",()=>T1e());Qs("Text",()=>F1e());Qs("Toggle",()=>O1e());Qs("Quiz",()=>M1e())});var j1e=L((eir,H1e)=>{H1e.exports={ArrayPrompt:oS(),AuthPrompt:XG(),BooleanPrompt:tF(),NumberPrompt:c5(),StringPrompt:Sm()}});var lS=L((tir,G1e)=>{"use strict";var q1e=ye("assert"),C5=ye("events"),W0=$o(),Zu=class extends C5{constructor(e,r){super(),this.options=W0.merge({},e),this.answers={...r}}register(e,r){if(W0.isObject(e)){for(let a of Object.keys(e))this.register(a,e[a]);return this}q1e.equal(typeof r,"function","expected a function");let s=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[s]=r:this.prompts[s]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(W0.merge({},this.options,r))}catch(s){return Promise.reject(s)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=W0.merge({},this.options,e),{type:s,name:a}=e,{set:n,get:c}=W0;if(typeof s=="function"&&(s=await s.call(this,e,this.answers)),!s)return this.answers[a];q1e(this.prompts[s],`Prompt "${s}" is not registered`);let f=new this.prompts[s](r),p=c(this.answers,a);f.state.answers=this.answers,f.enquirer=this,a&&f.on("submit",E=>{this.emit("answer",a,E,f),n(this.answers,a,E)});let h=f.emit.bind(f);return f.emit=(...E)=>(this.emit.call(this,...E),h(...E)),this.emit("prompt",f,this),r.autofill&&p!=null?(f.value=f.input=p,r.autofill==="show"&&await f.submit()):p=f.value=await f.run(),p}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||sC()}static get prompts(){return U1e()}static get types(){return j1e()}static get prompt(){let e=(r,...s)=>{let a=new this(...s),n=a.emit.bind(a);return a.emit=(...c)=>(e.emit(...c),n(...c)),a.prompt(r)};return W0.mixinEmitter(e,new C5),e}};W0.mixinEmitter(Zu,new C5);var I5=Zu.prompts;for(let t of Object.keys(I5)){let e=t.toLowerCase(),r=s=>new I5[t](s).run();Zu.prompt[e]=r,Zu[e]=r,Zu[t]||Reflect.defineProperty(Zu,t,{get:()=>I5[t]})}var aS=t=>{W0.defineExport(Zu,t,()=>Zu.types[t])};aS("ArrayPrompt");aS("AuthPrompt");aS("BooleanPrompt");aS("NumberPrompt");aS("StringPrompt");G1e.exports=Zu});var AS=L((Lir,Z1e)=>{var I2t=qR();function C2t(t,e,r){var s=t==null?void 0:I2t(t,e);return s===void 0?r:s}Z1e.exports=C2t});var e2e=L((qir,$1e)=>{function w2t(t,e){for(var r=-1,s=t==null?0:t.length;++r{var B2t=Jd(),v2t=Uk();function S2t(t,e){return t&&B2t(e,v2t(e),t)}t2e.exports=S2t});var i2e=L((Wir,n2e)=>{var D2t=Jd(),b2t=qE();function P2t(t,e){return t&&D2t(e,b2t(e),t)}n2e.exports=P2t});var o2e=L((Yir,s2e)=>{var x2t=Jd(),k2t=Fk();function Q2t(t,e){return x2t(t,k2t(t),e)}s2e.exports=Q2t});var b5=L((Vir,a2e)=>{var T2t=Rk(),R2t=Wk(),F2t=Fk(),N2t=_4(),O2t=Object.getOwnPropertySymbols,L2t=O2t?function(t){for(var e=[];t;)T2t(e,F2t(t)),t=R2t(t);return e}:N2t;a2e.exports=L2t});var c2e=L((Kir,l2e)=>{var M2t=Jd(),_2t=b5();function U2t(t,e){return M2t(t,_2t(t),e)}l2e.exports=U2t});var P5=L((Jir,u2e)=>{var H2t=M4(),j2t=b5(),q2t=qE();function G2t(t){return H2t(t,q2t,j2t)}u2e.exports=G2t});var A2e=L((zir,f2e)=>{var W2t=Object.prototype,Y2t=W2t.hasOwnProperty;function V2t(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Y2t.call(t,"index")&&(r.index=t.index,r.input=t.input),r}f2e.exports=V2t});var h2e=L((Zir,p2e)=>{var K2t=qk();function J2t(t,e){var r=e?K2t(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}p2e.exports=J2t});var d2e=L((Xir,g2e)=>{var z2t=/\w*$/;function Z2t(t){var e=new t.constructor(t.source,z2t.exec(t));return e.lastIndex=t.lastIndex,e}g2e.exports=Z2t});var C2e=L(($ir,I2e)=>{var m2e=Yd(),y2e=m2e?m2e.prototype:void 0,E2e=y2e?y2e.valueOf:void 0;function X2t(t){return E2e?Object(E2e.call(t)):{}}I2e.exports=X2t});var B2e=L((esr,w2e)=>{var $2t=qk(),eBt=h2e(),tBt=d2e(),rBt=C2e(),nBt=$4(),iBt="[object Boolean]",sBt="[object Date]",oBt="[object Map]",aBt="[object Number]",lBt="[object RegExp]",cBt="[object Set]",uBt="[object String]",fBt="[object Symbol]",ABt="[object ArrayBuffer]",pBt="[object DataView]",hBt="[object Float32Array]",gBt="[object Float64Array]",dBt="[object Int8Array]",mBt="[object Int16Array]",yBt="[object Int32Array]",EBt="[object Uint8Array]",IBt="[object Uint8ClampedArray]",CBt="[object Uint16Array]",wBt="[object Uint32Array]";function BBt(t,e,r){var s=t.constructor;switch(e){case ABt:return $2t(t);case iBt:case sBt:return new s(+t);case pBt:return eBt(t,r);case hBt:case gBt:case dBt:case mBt:case yBt:case EBt:case IBt:case CBt:case wBt:return nBt(t,r);case oBt:return new s;case aBt:case uBt:return new s(t);case lBt:return tBt(t);case cBt:return new s;case fBt:return rBt(t)}}w2e.exports=BBt});var S2e=L((tsr,v2e)=>{var vBt=_B(),SBt=zf(),DBt="[object Map]";function bBt(t){return SBt(t)&&vBt(t)==DBt}v2e.exports=bBt});var x2e=L((rsr,P2e)=>{var PBt=S2e(),xBt=Ok(),D2e=Lk(),b2e=D2e&&D2e.isMap,kBt=b2e?xBt(b2e):PBt;P2e.exports=kBt});var Q2e=L((nsr,k2e)=>{var QBt=_B(),TBt=zf(),RBt="[object Set]";function FBt(t){return TBt(t)&&QBt(t)==RBt}k2e.exports=FBt});var N2e=L((isr,F2e)=>{var NBt=Q2e(),OBt=Ok(),T2e=Lk(),R2e=T2e&&T2e.isSet,LBt=R2e?OBt(R2e):NBt;F2e.exports=LBt});var x5=L((ssr,_2e)=>{var MBt=Qk(),_Bt=e2e(),UBt=Yk(),HBt=r2e(),jBt=i2e(),qBt=X4(),GBt=Gk(),WBt=o2e(),YBt=c2e(),VBt=q4(),KBt=P5(),JBt=_B(),zBt=A2e(),ZBt=B2e(),XBt=e3(),$Bt=xc(),evt=FB(),tvt=x2e(),rvt=Wl(),nvt=N2e(),ivt=Uk(),svt=qE(),ovt=1,avt=2,lvt=4,O2e="[object Arguments]",cvt="[object Array]",uvt="[object Boolean]",fvt="[object Date]",Avt="[object Error]",L2e="[object Function]",pvt="[object GeneratorFunction]",hvt="[object Map]",gvt="[object Number]",M2e="[object Object]",dvt="[object RegExp]",mvt="[object Set]",yvt="[object String]",Evt="[object Symbol]",Ivt="[object WeakMap]",Cvt="[object ArrayBuffer]",wvt="[object DataView]",Bvt="[object Float32Array]",vvt="[object Float64Array]",Svt="[object Int8Array]",Dvt="[object Int16Array]",bvt="[object Int32Array]",Pvt="[object Uint8Array]",xvt="[object Uint8ClampedArray]",kvt="[object Uint16Array]",Qvt="[object Uint32Array]",Ii={};Ii[O2e]=Ii[cvt]=Ii[Cvt]=Ii[wvt]=Ii[uvt]=Ii[fvt]=Ii[Bvt]=Ii[vvt]=Ii[Svt]=Ii[Dvt]=Ii[bvt]=Ii[hvt]=Ii[gvt]=Ii[M2e]=Ii[dvt]=Ii[mvt]=Ii[yvt]=Ii[Evt]=Ii[Pvt]=Ii[xvt]=Ii[kvt]=Ii[Qvt]=!0;Ii[Avt]=Ii[L2e]=Ii[Ivt]=!1;function iF(t,e,r,s,a,n){var c,f=e&ovt,p=e&avt,h=e&lvt;if(r&&(c=a?r(t,s,a,n):r(t)),c!==void 0)return c;if(!rvt(t))return t;var E=$Bt(t);if(E){if(c=zBt(t),!f)return GBt(t,c)}else{var C=JBt(t),S=C==L2e||C==pvt;if(evt(t))return qBt(t,f);if(C==M2e||C==O2e||S&&!a){if(c=p||S?{}:XBt(t),!f)return p?YBt(t,jBt(c,t)):WBt(t,HBt(c,t))}else{if(!Ii[C])return a?t:{};c=ZBt(t,C,f)}}n||(n=new MBt);var P=n.get(t);if(P)return P;n.set(t,c),nvt(t)?t.forEach(function(N){c.add(iF(N,e,r,N,t,n))}):tvt(t)&&t.forEach(function(N,U){c.set(U,iF(N,e,r,U,t,n))});var I=h?p?KBt:VBt:p?svt:ivt,R=E?void 0:I(t);return _Bt(R||t,function(N,U){R&&(U=N,N=t[U]),UBt(c,U,iF(N,e,r,U,t,n))}),c}_2e.exports=iF});var k5=L((osr,U2e)=>{var Tvt=x5(),Rvt=1,Fvt=4;function Nvt(t){return Tvt(t,Rvt|Fvt)}U2e.exports=Nvt});var Q5=L((asr,H2e)=>{var Ovt=CG();function Lvt(t,e,r){return t==null?t:Ovt(t,e,r)}H2e.exports=Lvt});var Y2e=L((psr,W2e)=>{var Mvt=Object.prototype,_vt=Mvt.hasOwnProperty;function Uvt(t,e){return t!=null&&_vt.call(t,e)}W2e.exports=Uvt});var K2e=L((hsr,V2e)=>{var Hvt=Y2e(),jvt=wG();function qvt(t,e){return t!=null&&jvt(t,e,Hvt)}V2e.exports=qvt});var z2e=L((gsr,J2e)=>{function Gvt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}J2e.exports=Gvt});var X2e=L((dsr,Z2e)=>{var Wvt=qR(),Yvt=A6();function Vvt(t,e){return e.length<2?t:Wvt(t,Yvt(e,0,-1))}Z2e.exports=Vvt});var R5=L((msr,$2e)=>{var Kvt=wm(),Jvt=z2e(),zvt=X2e(),Zvt=XI();function Xvt(t,e){return e=Kvt(e,t),t=zvt(t,e),t==null||delete t[Zvt(Jvt(e))]}$2e.exports=Xvt});var F5=L((ysr,eBe)=>{var $vt=R5();function eSt(t,e){return t==null?!0:$vt(t,e)}eBe.exports=eSt});var sBe=L((Vsr,nSt)=>{nSt.exports={name:"@yarnpkg/cli",version:"4.9.1",license:"BSD-2-Clause",main:"./sources/index.ts",exports:{".":"./sources/index.ts","./polyfills":"./sources/polyfills.ts","./package.json":"./package.json"},dependencies:{"@yarnpkg/core":"workspace:^","@yarnpkg/fslib":"workspace:^","@yarnpkg/libzip":"workspace:^","@yarnpkg/parsers":"workspace:^","@yarnpkg/plugin-compat":"workspace:^","@yarnpkg/plugin-constraints":"workspace:^","@yarnpkg/plugin-dlx":"workspace:^","@yarnpkg/plugin-essentials":"workspace:^","@yarnpkg/plugin-exec":"workspace:^","@yarnpkg/plugin-file":"workspace:^","@yarnpkg/plugin-git":"workspace:^","@yarnpkg/plugin-github":"workspace:^","@yarnpkg/plugin-http":"workspace:^","@yarnpkg/plugin-init":"workspace:^","@yarnpkg/plugin-interactive-tools":"workspace:^","@yarnpkg/plugin-jsr":"workspace:^","@yarnpkg/plugin-link":"workspace:^","@yarnpkg/plugin-nm":"workspace:^","@yarnpkg/plugin-npm":"workspace:^","@yarnpkg/plugin-npm-cli":"workspace:^","@yarnpkg/plugin-pack":"workspace:^","@yarnpkg/plugin-patch":"workspace:^","@yarnpkg/plugin-pnp":"workspace:^","@yarnpkg/plugin-pnpm":"workspace:^","@yarnpkg/plugin-stage":"workspace:^","@yarnpkg/plugin-typescript":"workspace:^","@yarnpkg/plugin-version":"workspace:^","@yarnpkg/plugin-workspace-tools":"workspace:^","@yarnpkg/shell":"workspace:^","ci-info":"^4.0.0",clipanion:"^4.0.0-rc.2",semver:"^7.1.2",tslib:"^2.4.0",typanion:"^3.14.0"},devDependencies:{"@types/semver":"^7.1.0","@yarnpkg/builder":"workspace:^","@yarnpkg/monorepo":"workspace:^","@yarnpkg/pnpify":"workspace:^"},peerDependencies:{"@yarnpkg/core":"workspace:^"},scripts:{postpack:"rm -rf lib",prepack:'run build:compile "$(pwd)"',"build:cli+hook":"run build:pnp:hook && builder build bundle","build:cli":"builder build bundle","run:cli":"builder run","update-local":"run build:cli --no-git-hash && rsync -a --delete bundles/ bin/"},publishConfig:{main:"./lib/index.js",bin:null,exports:{".":"./lib/index.js","./package.json":"./package.json"}},files:["/lib/**/*","!/lib/pluginConfiguration.*","!/lib/cli.*"],"@yarnpkg/builder":{bundles:{standard:["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-constraints","@yarnpkg/plugin-dlx","@yarnpkg/plugin-exec","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-jsr","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp","@yarnpkg/plugin-pnpm","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"]}},repository:{type:"git",url:"git+https://github.com/yarnpkg/berry.git",directory:"packages/yarnpkg-cli"},engines:{node:">=18.12.0"}}});var q5=L((Dcr,mBe)=>{"use strict";mBe.exports=function(e,r){r===!0&&(r=0);var s="";if(typeof e=="string")try{s=new URL(e).protocol}catch{}else e&&e.constructor===URL&&(s=e.protocol);var a=s.split(/\:|\+/).filter(Boolean);return typeof r=="number"?a[r]:a}});var EBe=L((bcr,yBe)=>{"use strict";var BSt=q5();function vSt(t){var e={protocols:[],protocol:null,port:null,resource:"",host:"",user:"",password:"",pathname:"",hash:"",search:"",href:t,query:{},parse_failed:!1};try{var r=new URL(t);e.protocols=BSt(r),e.protocol=e.protocols[0],e.port=r.port,e.resource=r.hostname,e.host=r.host,e.user=r.username||"",e.password=r.password||"",e.pathname=r.pathname,e.hash=r.hash.slice(1),e.search=r.search.slice(1),e.href=r.href,e.query=Object.fromEntries(r.searchParams)}catch{e.protocols=["file"],e.protocol=e.protocols[0],e.port="",e.resource="",e.user="",e.pathname="",e.hash="",e.search="",e.href=t,e.query={},e.parse_failed=!0}return e}yBe.exports=vSt});var wBe=L((Pcr,CBe)=>{"use strict";var SSt=EBe();function DSt(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var bSt=DSt(SSt),PSt="text/plain",xSt="us-ascii",IBe=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),kSt=(t,{stripHash:e})=>{let r=/^data:(?[^,]*?),(?[^#]*?)(?:#(?.*))?$/.exec(t);if(!r)throw new Error(`Invalid URL: ${t}`);let{type:s,data:a,hash:n}=r.groups,c=s.split(";");n=e?"":n;let f=!1;c[c.length-1]==="base64"&&(c.pop(),f=!0);let p=(c.shift()||"").toLowerCase(),E=[...c.map(C=>{let[S,P=""]=C.split("=").map(I=>I.trim());return S==="charset"&&(P=P.toLowerCase(),P===xSt)?"":`${S}${P?`=${P}`:""}`}).filter(Boolean)];return f&&E.push("base64"),(E.length>0||p&&p!==PSt)&&E.unshift(p),`data:${E.join(";")},${f?a.trim():a}${n?`#${n}`:""}`};function QSt(t,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},t=t.trim(),/^data:/i.test(t))return kSt(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let a=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&a.protocol==="https:"&&(a.protocol="http:"),e.forceHttps&&a.protocol==="http:"&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash?a.hash="":e.stripTextFragment&&(a.hash=a.hash.replace(/#?:~:text.*?$/i,"")),a.pathname){let c=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,f=0,p="";for(;;){let E=c.exec(a.pathname);if(!E)break;let C=E[0],S=E.index,P=a.pathname.slice(f,S);p+=P.replace(/\/{2,}/g,"/"),p+=C,f=S+C.length}let h=a.pathname.slice(f,a.pathname.length);p+=h.replace(/\/{2,}/g,"/"),a.pathname=p}if(a.pathname)try{a.pathname=decodeURI(a.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let c=a.pathname.split("/"),f=c[c.length-1];IBe(f,e.removeDirectoryIndex)&&(c=c.slice(0,-1),a.pathname=c.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let c of[...a.searchParams.keys()])IBe(c,e.removeQueryParameters)&&a.searchParams.delete(c);if(e.removeQueryParameters===!0&&(a.search=""),e.sortQueryParameters){a.searchParams.sort();try{a.search=decodeURIComponent(a.search)}catch{}}e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,""));let n=t;return t=a.toString(),!e.removeSingleSlash&&a.pathname==="/"&&!n.endsWith("/")&&a.hash===""&&(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||a.pathname==="/")&&a.hash===""&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}var G5=(t,e=!1)=>{let r=/^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/,s=n=>{let c=new Error(n);throw c.subject_url=t,c};(typeof t!="string"||!t.trim())&&s("Invalid url."),t.length>G5.MAX_INPUT_LENGTH&&s("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH."),e&&(typeof e!="object"&&(e={stripHash:!1}),t=QSt(t,e));let a=bSt.default(t);if(a.parse_failed){let n=a.href.match(r);n?(a.protocols=["ssh"],a.protocol="ssh",a.resource=n[2],a.host=n[2],a.user=n[1],a.pathname=`/${n[3]}`,a.parse_failed=!1):s("URL parsing failed.")}return a};G5.MAX_INPUT_LENGTH=2048;CBe.exports=G5});var SBe=L((xcr,vBe)=>{"use strict";var TSt=q5();function BBe(t){if(Array.isArray(t))return t.indexOf("ssh")!==-1||t.indexOf("rsync")!==-1;if(typeof t!="string")return!1;var e=TSt(t);if(t=t.substring(t.indexOf("://")+3),BBe(e))return!0;var r=new RegExp(".([a-zA-Z\\d]+):(\\d+)/");return!t.match(r)&&t.indexOf("@"){"use strict";var RSt=wBe(),DBe=SBe();function FSt(t){var e=RSt(t);return e.token="",e.password==="x-oauth-basic"?e.token=e.user:e.user==="x-token-auth"&&(e.token=e.password),DBe(e.protocols)||e.protocols.length===0&&DBe(t)?e.protocol="ssh":e.protocols.length?e.protocol=e.protocols[0]:(e.protocol="file",e.protocols=["file"]),e.href=e.href.replace(/\/$/,""),e}bBe.exports=FSt});var kBe=L((Qcr,xBe)=>{"use strict";var NSt=PBe();function W5(t){if(typeof t!="string")throw new Error("The url must be a string.");var e=/^([a-z\d-]{1,39})\/([-\.\w]{1,100})$/i;e.test(t)&&(t="https://github.com/"+t);var r=NSt(t),s=r.resource.split("."),a=null;switch(r.toString=function(N){return W5.stringify(this,N)},r.source=s.length>2?s.slice(1-s.length).join("."):r.source=r.resource,r.git_suffix=/\.git$/.test(r.pathname),r.name=decodeURIComponent((r.pathname||r.href).replace(/(^\/)|(\/$)/g,"").replace(/\.git$/,"")),r.owner=decodeURIComponent(r.user),r.source){case"git.cloudforge.com":r.owner=r.user,r.organization=s[0],r.source="cloudforge.com";break;case"visualstudio.com":if(r.resource==="vs-ssh.visualstudio.com"){a=r.name.split("/"),a.length===4&&(r.organization=a[1],r.owner=a[2],r.name=a[3],r.full_name=a[2]+"/"+a[3]);break}else{a=r.name.split("/"),a.length===2?(r.owner=a[1],r.name=a[1],r.full_name="_git/"+r.name):a.length===3?(r.name=a[2],a[0]==="DefaultCollection"?(r.owner=a[2],r.organization=a[0],r.full_name=r.organization+"/_git/"+r.name):(r.owner=a[0],r.full_name=r.owner+"/_git/"+r.name)):a.length===4&&(r.organization=a[0],r.owner=a[1],r.name=a[3],r.full_name=r.organization+"/"+r.owner+"/_git/"+r.name);break}case"dev.azure.com":case"azure.com":if(r.resource==="ssh.dev.azure.com"){a=r.name.split("/"),a.length===4&&(r.organization=a[1],r.owner=a[2],r.name=a[3]);break}else{a=r.name.split("/"),a.length===5?(r.organization=a[0],r.owner=a[1],r.name=a[4],r.full_name="_git/"+r.name):a.length===3?(r.name=a[2],a[0]==="DefaultCollection"?(r.owner=a[2],r.organization=a[0],r.full_name=r.organization+"/_git/"+r.name):(r.owner=a[0],r.full_name=r.owner+"/_git/"+r.name)):a.length===4&&(r.organization=a[0],r.owner=a[1],r.name=a[3],r.full_name=r.organization+"/"+r.owner+"/_git/"+r.name),r.query&&r.query.path&&(r.filepath=r.query.path.replace(/^\/+/g,"")),r.query&&r.query.version&&(r.ref=r.query.version.replace(/^GB/,""));break}default:a=r.name.split("/");var n=a.length-1;if(a.length>=2){var c=a.indexOf("-",2),f=a.indexOf("blob",2),p=a.indexOf("tree",2),h=a.indexOf("commit",2),E=a.indexOf("src",2),C=a.indexOf("raw",2),S=a.indexOf("edit",2);n=c>0?c-1:f>0?f-1:p>0?p-1:h>0?h-1:E>0?E-1:C>0?C-1:S>0?S-1:n,r.owner=a.slice(0,n).join("/"),r.name=a[n],h&&(r.commit=a[n+2])}r.ref="",r.filepathtype="",r.filepath="";var P=a.length>n&&a[n+1]==="-"?n+1:n;a.length>P+2&&["raw","src","blob","tree","edit"].indexOf(a[P+1])>=0&&(r.filepathtype=a[P+1],r.ref=a[P+2],a.length>P+3&&(r.filepath=a.slice(P+3).join("/"))),r.organization=r.owner;break}r.full_name||(r.full_name=r.owner,r.name&&(r.full_name&&(r.full_name+="/"),r.full_name+=r.name)),r.owner.startsWith("scm/")&&(r.source="bitbucket-server",r.owner=r.owner.replace("scm/",""),r.organization=r.owner,r.full_name=r.owner+"/"+r.name);var I=/(projects|users)\/(.*?)\/repos\/(.*?)((\/.*$)|$)/,R=I.exec(r.pathname);return R!=null&&(r.source="bitbucket-server",R[1]==="users"?r.owner="~"+R[2]:r.owner=R[2],r.organization=r.owner,r.name=R[3],a=R[4].split("/"),a.length>1&&(["raw","browse"].indexOf(a[1])>=0?(r.filepathtype=a[1],a.length>2&&(r.filepath=a.slice(2).join("/"))):a[1]==="commits"&&a.length>2&&(r.commit=a[2])),r.full_name=r.owner+"/"+r.name,r.query.at?r.ref=r.query.at:r.ref=""),r}W5.stringify=function(t,e){e=e||(t.protocols&&t.protocols.length?t.protocols.join("+"):t.protocol);var r=t.port?":"+t.port:"",s=t.user||"git",a=t.git_suffix?".git":"";switch(e){case"ssh":return r?"ssh://"+s+"@"+t.resource+r+"/"+t.full_name+a:s+"@"+t.resource+":"+t.full_name+a;case"git+ssh":case"ssh+git":case"ftp":case"ftps":return e+"://"+s+"@"+t.resource+r+"/"+t.full_name+a;case"http":case"https":var n=t.token?OSt(t):t.user&&(t.protocols.includes("http")||t.protocols.includes("https"))?t.user+"@":"";return e+"://"+n+t.resource+r+"/"+LSt(t)+a;default:return t.href}};function OSt(t){switch(t.source){case"bitbucket.org":return"x-token-auth:"+t.token+"@";default:return t.token+"@"}}function LSt(t){switch(t.source){case"bitbucket-server":return"scm/"+t.full_name;default:return""+t.full_name}}xBe.exports=W5});var YBe=L((ufr,WBe)=>{var KSt=RT(),JSt=Gk(),zSt=xc(),ZSt=aI(),XSt=IG(),$St=XI(),eDt=Tv();function tDt(t){return zSt(t)?KSt(t,$St):ZSt(t)?[t]:JSt(XSt(eDt(t)))}WBe.exports=tDt});function sDt(t,e){return e===1&&iDt.has(t[0])}function ES(t){let e=Array.isArray(t)?t:(0,JBe.default)(t);return e.map((s,a)=>rDt.test(s)?`[${s}]`:nDt.test(s)&&!sDt(e,a)?`.${s}`:`[${JSON.stringify(s)}]`).join("").replace(/^\./,"")}function oDt(t,e){let r=[];if(e.methodName!==null&&r.push(he.pretty(t,e.methodName,he.Type.CODE)),e.file!==null){let s=[];s.push(he.pretty(t,e.file,he.Type.PATH)),e.line!==null&&(s.push(he.pretty(t,e.line,he.Type.NUMBER)),e.column!==null&&s.push(he.pretty(t,e.column,he.Type.NUMBER))),r.push(`(${s.join(he.pretty(t,":","grey"))})`)}return r.join(" ")}function lF(t,{manifestUpdates:e,reportedErrors:r},{fix:s}={}){let a=new Map,n=new Map,c=[...r.keys()].map(f=>[f,new Map]);for(let[f,p]of[...c,...e]){let h=r.get(f)?.map(P=>({text:P,fixable:!1}))??[],E=!1,C=t.getWorkspaceByCwd(f),S=C.manifest.exportTo({});for(let[P,I]of p){if(I.size>1){let R=[...I].map(([N,U])=>{let W=he.pretty(t.configuration,N,he.Type.INSPECT),te=U.size>0?oDt(t.configuration,U.values().next().value):null;return te!==null?` +${W} at ${te}`:` +${W}`}).join("");h.push({text:`Conflict detected in constraint targeting ${he.pretty(t.configuration,P,he.Type.CODE)}; conflicting values are:${R}`,fixable:!1})}else{let[[R]]=I,N=(0,VBe.default)(S,P);if(JSON.stringify(N)===JSON.stringify(R))continue;if(!s){let U=typeof N>"u"?`Missing field ${he.pretty(t.configuration,P,he.Type.CODE)}; expected ${he.pretty(t.configuration,R,he.Type.INSPECT)}`:typeof R>"u"?`Extraneous field ${he.pretty(t.configuration,P,he.Type.CODE)} currently set to ${he.pretty(t.configuration,N,he.Type.INSPECT)}`:`Invalid field ${he.pretty(t.configuration,P,he.Type.CODE)}; expected ${he.pretty(t.configuration,R,he.Type.INSPECT)}, found ${he.pretty(t.configuration,N,he.Type.INSPECT)}`;h.push({text:U,fixable:!0});continue}typeof R>"u"?(0,zBe.default)(S,P):(0,KBe.default)(S,P,R),E=!0}E&&a.set(C,S)}h.length>0&&n.set(C,h)}return{changedWorkspaces:a,remainingErrors:n}}function ZBe(t,{configuration:e}){let r={children:[]};for(let[s,a]of t){let n=[];for(let f of a){let p=f.text.split(/\n/);f.fixable&&(p[0]=`${he.pretty(e,"\u2699","gray")} ${p[0]}`),n.push({value:he.tuple(he.Type.NO_HINT,p[0]),children:p.slice(1).map(h=>({value:he.tuple(he.Type.NO_HINT,h)}))})}let c={value:he.tuple(he.Type.LOCATOR,s.anchoredLocator),children:je.sortMap(n,f=>f.value[1])};r.children.push(c)}return r.children=je.sortMap(r.children,s=>s.value[1]),r}var VBe,KBe,JBe,zBe,VC,rDt,nDt,iDt,IS=It(()=>{Ve();VBe=et(AS()),KBe=et(Q5()),JBe=et(YBe()),zBe=et(F5()),VC=class{constructor(e){this.indexedFields=e;this.items=[];this.indexes={};this.clear()}clear(){this.items=[];for(let e of this.indexedFields)this.indexes[e]=new Map}insert(e){this.items.push(e);for(let r of this.indexedFields){let s=Object.hasOwn(e,r)?e[r]:void 0;if(typeof s>"u")continue;je.getArrayWithDefault(this.indexes[r],s).push(e)}return e}find(e){if(typeof e>"u")return this.items;let r=Object.entries(e);if(r.length===0)return this.items;let s=[],a;for(let[c,f]of r){let p=c,h=Object.hasOwn(this.indexes,p)?this.indexes[p]:void 0;if(typeof h>"u"){s.push([p,f]);continue}let E=new Set(h.get(f)??[]);if(E.size===0)return[];if(typeof a>"u")a=E;else for(let C of a)E.has(C)||a.delete(C);if(a.size===0)break}let n=[...a??[]];return s.length>0&&(n=n.filter(c=>{for(let[f,p]of s)if(!(typeof p<"u"?Object.hasOwn(c,f)&&c[f]===p:Object.hasOwn(c,f)===!1))return!1;return!0})),n}},rDt=/^[0-9]+$/,nDt=/^[a-zA-Z0-9_]+$/,iDt=new Set(["scripts",...Ht.allDependencies])});var XBe=L((wfr,s9)=>{var aDt;(function(t){var e=function(){return{"append/2":[new t.type.Rule(new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("L")]),new t.type.Term("foldl",[new t.type.Term("append",[]),new t.type.Var("X"),new t.type.Term("[]",[]),new t.type.Var("L")]))],"append/3":[new t.type.Rule(new t.type.Term("append",[new t.type.Term("[]",[]),new t.type.Var("X"),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("append",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("append",[new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("S")]))],"member/2":[new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("_")])]),null),new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")])]),new t.type.Term("member",[new t.type.Var("X"),new t.type.Var("Xs")]))],"permutation/2":[new t.type.Rule(new t.type.Term("permutation",[new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("permutation",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("permutation",[new t.type.Var("T"),new t.type.Var("P")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("P")]),new t.type.Term("append",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("Y")]),new t.type.Var("S")])])]))],"maplist/2":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("X")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("Xs")])]))],"maplist/3":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs")])]))],"maplist/4":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs")])]))],"maplist/5":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds")])]))],"maplist/6":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es")])]))],"maplist/7":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")]),new t.type.Term(".",[new t.type.Var("F"),new t.type.Var("Fs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E"),new t.type.Var("F")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es"),new t.type.Var("Fs")])]))],"maplist/8":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")]),new t.type.Term(".",[new t.type.Var("F"),new t.type.Var("Fs")]),new t.type.Term(".",[new t.type.Var("G"),new t.type.Var("Gs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E"),new t.type.Var("F"),new t.type.Var("G")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es"),new t.type.Var("Fs"),new t.type.Var("Gs")])]))],"include/3":[new t.type.Rule(new t.type.Term("include",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("include",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("A")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("A"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term("[]",[])]),new t.type.Var("B")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("F"),new t.type.Var("B")]),new t.type.Term(",",[new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("F")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("L"),new t.type.Var("S")])]),new t.type.Term("include",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("S")])])])])]))],"exclude/3":[new t.type.Rule(new t.type.Term("exclude",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("exclude",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("exclude",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("E")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term("[]",[])]),new t.type.Var("Q")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("R"),new t.type.Var("Q")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("R")]),new t.type.Term(",",[new t.type.Term("!",[]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("E")])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("E")])])])])])])]))],"foldl/4":[new t.type.Rule(new t.type.Term("foldl",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Var("I"),new t.type.Var("I")]),null),new t.type.Rule(new t.type.Term("foldl",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("I"),new t.type.Var("R")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("I"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])])])]),new t.type.Var("L2")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P2"),new t.type.Var("L2")]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P2")]),new t.type.Term("foldl",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("R")])])])])]))],"select/3":[new t.type.Rule(new t.type.Term("select",[new t.type.Var("E"),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Xs")]),new t.type.Var("Xs")]),null),new t.type.Rule(new t.type.Term("select",[new t.type.Var("E"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Ys")])]),new t.type.Term("select",[new t.type.Var("E"),new t.type.Var("Xs"),new t.type.Var("Ys")]))],"sum_list/2":[new t.type.Rule(new t.type.Term("sum_list",[new t.type.Term("[]",[]),new t.type.Num(0,!1)]),null),new t.type.Rule(new t.type.Term("sum_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("sum_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term("is",[new t.type.Var("S"),new t.type.Term("+",[new t.type.Var("X"),new t.type.Var("Y")])])]))],"max_list/2":[new t.type.Rule(new t.type.Term("max_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("max_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("max_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Var("Y")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("X")]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("Y")])])]))],"min_list/2":[new t.type.Rule(new t.type.Term("min_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("min_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("min_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("=<",[new t.type.Var("X"),new t.type.Var("Y")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("X")]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("Y")])])]))],"prod_list/2":[new t.type.Rule(new t.type.Term("prod_list",[new t.type.Term("[]",[]),new t.type.Num(1,!1)]),null),new t.type.Rule(new t.type.Term("prod_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("prod_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term("is",[new t.type.Var("S"),new t.type.Term("*",[new t.type.Var("X"),new t.type.Var("Y")])])]))],"last/2":[new t.type.Rule(new t.type.Term("last",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("last",[new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")]),new t.type.Var("X")]),new t.type.Term("last",[new t.type.Var("Xs"),new t.type.Var("X")]))],"prefix/2":[new t.type.Rule(new t.type.Term("prefix",[new t.type.Var("Part"),new t.type.Var("Whole")]),new t.type.Term("append",[new t.type.Var("Part"),new t.type.Var("_"),new t.type.Var("Whole")]))],"nth0/3":[new t.type.Rule(new t.type.Term("nth0",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")])]),new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")]),new t.type.Term("!",[])])])]))],"nth1/3":[new t.type.Rule(new t.type.Term("nth1",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")])]),new t.type.Term(",",[new t.type.Term(">",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")]),new t.type.Term("!",[])])])]))],"nth0/4":[new t.type.Rule(new t.type.Term("nth0",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")])]),new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term("!",[])])])]))],"nth1/4":[new t.type.Rule(new t.type.Term("nth1",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")])]),new t.type.Term(",",[new t.type.Term(">",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term("!",[])])])]))],"nth/5":[new t.type.Rule(new t.type.Term("nth",[new t.type.Var("N"),new t.type.Var("N"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("X"),new t.type.Var("Xs")]),null),new t.type.Rule(new t.type.Term("nth",[new t.type.Var("N"),new t.type.Var("O"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("Y"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Ys")])]),new t.type.Term(",",[new t.type.Term("is",[new t.type.Var("M"),new t.type.Term("+",[new t.type.Var("N"),new t.type.Num(1,!1)])]),new t.type.Term("nth",[new t.type.Var("M"),new t.type.Var("O"),new t.type.Var("Xs"),new t.type.Var("Y"),new t.type.Var("Ys")])]))],"length/2":function(s,a,n){var c=n.args[0],f=n.args[1];if(!t.type.is_variable(f)&&!t.type.is_integer(f))s.throw_error(t.error.type("integer",f,n.indicator));else if(t.type.is_integer(f)&&f.value<0)s.throw_error(t.error.domain("not_less_than_zero",f,n.indicator));else{var p=new t.type.Term("length",[c,new t.type.Num(0,!1),f]);t.type.is_integer(f)&&(p=new t.type.Term(",",[p,new t.type.Term("!",[])])),s.prepend([new t.type.State(a.goal.replace(p),a.substitution,a)])}},"length/3":[new t.type.Rule(new t.type.Term("length",[new t.type.Term("[]",[]),new t.type.Var("N"),new t.type.Var("N")]),null),new t.type.Rule(new t.type.Term("length",[new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("X")]),new t.type.Var("A"),new t.type.Var("N")]),new t.type.Term(",",[new t.type.Term("succ",[new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("length",[new t.type.Var("X"),new t.type.Var("B"),new t.type.Var("N")])]))],"replicate/3":function(s,a,n){var c=n.args[0],f=n.args[1],p=n.args[2];if(t.type.is_variable(f))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_integer(f))s.throw_error(t.error.type("integer",f,n.indicator));else if(f.value<0)s.throw_error(t.error.domain("not_less_than_zero",f,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))s.throw_error(t.error.type("list",p,n.indicator));else{for(var h=new t.type.Term("[]"),E=0;E0;C--)E[C].equals(E[C-1])&&E.splice(C,1);for(var S=new t.type.Term("[]"),C=E.length-1;C>=0;C--)S=new t.type.Term(".",[E[C],S]);s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[S,f])),a.substitution,a)])}}},"msort/2":function(s,a,n){var c=n.args[0],f=n.args[1];if(t.type.is_variable(c))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(f)&&!t.type.is_fully_list(f))s.throw_error(t.error.type("list",f,n.indicator));else{for(var p=[],h=c;h.indicator==="./2";)p.push(h.args[0]),h=h.args[1];if(t.type.is_variable(h))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_empty_list(h))s.throw_error(t.error.type("list",c,n.indicator));else{for(var E=p.sort(t.compare),C=new t.type.Term("[]"),S=E.length-1;S>=0;S--)C=new t.type.Term(".",[E[S],C]);s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[C,f])),a.substitution,a)])}}},"keysort/2":function(s,a,n){var c=n.args[0],f=n.args[1];if(t.type.is_variable(c))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(f)&&!t.type.is_fully_list(f))s.throw_error(t.error.type("list",f,n.indicator));else{for(var p=[],h,E=c;E.indicator==="./2";){if(h=E.args[0],t.type.is_variable(h)){s.throw_error(t.error.instantiation(n.indicator));return}else if(!t.type.is_term(h)||h.indicator!=="-/2"){s.throw_error(t.error.type("pair",h,n.indicator));return}h.args[0].pair=h.args[1],p.push(h.args[0]),E=E.args[1]}if(t.type.is_variable(E))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_empty_list(E))s.throw_error(t.error.type("list",c,n.indicator));else{for(var C=p.sort(t.compare),S=new t.type.Term("[]"),P=C.length-1;P>=0;P--)S=new t.type.Term(".",[new t.type.Term("-",[C[P],C[P].pair]),S]),delete C[P].pair;s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[S,f])),a.substitution,a)])}}},"take/3":function(s,a,n){var c=n.args[0],f=n.args[1],p=n.args[2];if(t.type.is_variable(f)||t.type.is_variable(c))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_list(f))s.throw_error(t.error.type("list",f,n.indicator));else if(!t.type.is_integer(c))s.throw_error(t.error.type("integer",c,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))s.throw_error(t.error.type("list",p,n.indicator));else{for(var h=c.value,E=[],C=f;h>0&&C.indicator==="./2";)E.push(C.args[0]),C=C.args[1],h--;if(h===0){for(var S=new t.type.Term("[]"),h=E.length-1;h>=0;h--)S=new t.type.Term(".",[E[h],S]);s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[S,p])),a.substitution,a)])}}},"drop/3":function(s,a,n){var c=n.args[0],f=n.args[1],p=n.args[2];if(t.type.is_variable(f)||t.type.is_variable(c))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_list(f))s.throw_error(t.error.type("list",f,n.indicator));else if(!t.type.is_integer(c))s.throw_error(t.error.type("integer",c,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))s.throw_error(t.error.type("list",p,n.indicator));else{for(var h=c.value,E=[],C=f;h>0&&C.indicator==="./2";)E.push(C.args[0]),C=C.args[1],h--;h===0&&s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[C,p])),a.substitution,a)])}},"reverse/2":function(s,a,n){var c=n.args[0],f=n.args[1],p=t.type.is_instantiated_list(c),h=t.type.is_instantiated_list(f);if(t.type.is_variable(c)&&t.type.is_variable(f))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(c)&&!t.type.is_fully_list(c))s.throw_error(t.error.type("list",c,n.indicator));else if(!t.type.is_variable(f)&&!t.type.is_fully_list(f))s.throw_error(t.error.type("list",f,n.indicator));else if(!p&&!h)s.throw_error(t.error.instantiation(n.indicator));else{for(var E=p?c:f,C=new t.type.Term("[]",[]);E.indicator==="./2";)C=new t.type.Term(".",[E.args[0],C]),E=E.args[1];s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[C,p?f:c])),a.substitution,a)])}},"list_to_set/2":function(s,a,n){var c=n.args[0],f=n.args[1];if(t.type.is_variable(c))s.throw_error(t.error.instantiation(n.indicator));else{for(var p=c,h=[];p.indicator==="./2";)h.push(p.args[0]),p=p.args[1];if(t.type.is_variable(p))s.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_term(p)||p.indicator!=="[]/0")s.throw_error(t.error.type("list",c,n.indicator));else{for(var E=[],C=new t.type.Term("[]",[]),S,P=0;P=0;P--)C=new t.type.Term(".",[E[P],C]);s.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[f,C])),a.substitution,a)])}}}}},r=["append/2","append/3","member/2","permutation/2","maplist/2","maplist/3","maplist/4","maplist/5","maplist/6","maplist/7","maplist/8","include/3","exclude/3","foldl/4","sum_list/2","max_list/2","min_list/2","prod_list/2","last/2","prefix/2","nth0/3","nth1/3","nth0/4","nth1/4","length/2","replicate/3","select/3","sort/2","msort/2","keysort/2","take/3","drop/3","reverse/2","list_to_set/2"];typeof s9<"u"?s9.exports=function(s){t=s,new t.type.Module("lists",e(),r)}:new t.type.Module("lists",e(),r)})(aDt)});var pve=L($r=>{"use strict";var Pm=process.platform==="win32",o9="aes-256-cbc",lDt="sha256",tve="The current environment doesn't support interactive reading from TTY.",ii=ye("fs"),$Be=process.binding("tty_wrap").TTY,l9=ye("child_process"),K0=ye("path"),c9={prompt:"> ",hideEchoBack:!1,mask:"*",limit:[],limitMessage:"Input another, please.$<( [)limit(])>",defaultInput:"",trueValue:[],falseValue:[],caseSensitive:!1,keepWhitespace:!1,encoding:"utf8",bufferSize:1024,print:void 0,history:!0,cd:!1,phContent:void 0,preCheck:void 0},eh="none",$u,JC,eve=!1,V0,uF,a9,cDt=0,h9="",bm=[],fF,rve=!1,u9=!1,CS=!1;function nve(t){function e(r){return r.replace(/[^\w\u0080-\uFFFF]/g,function(s){return"#"+s.charCodeAt(0)+";"})}return uF.concat(function(r){var s=[];return Object.keys(r).forEach(function(a){r[a]==="boolean"?t[a]&&s.push("--"+a):r[a]==="string"&&t[a]&&s.push("--"+a,e(t[a]))}),s}({display:"string",displayOnly:"boolean",keyIn:"boolean",hideEchoBack:"boolean",mask:"string",limit:"string",caseSensitive:"boolean"}))}function uDt(t,e){function r(U){var W,te="",ie;for(a9=a9||ye("os").tmpdir();;){W=K0.join(a9,U+te);try{ie=ii.openSync(W,"wx")}catch(Ae){if(Ae.code==="EEXIST"){te++;continue}else throw Ae}ii.closeSync(ie);break}return W}var s,a,n,c={},f,p,h=r("readline-sync.stdout"),E=r("readline-sync.stderr"),C=r("readline-sync.exit"),S=r("readline-sync.done"),P=ye("crypto"),I,R,N;I=P.createHash(lDt),I.update(""+process.pid+cDt+++Math.random()),N=I.digest("hex"),R=P.createDecipher(o9,N),s=nve(t),Pm?(a=process.env.ComSpec||"cmd.exe",process.env.Q='"',n=["/V:ON","/S","/C","(%Q%"+a+"%Q% /V:ON /S /C %Q%%Q%"+V0+"%Q%"+s.map(function(U){return" %Q%"+U+"%Q%"}).join("")+" & (echo !ERRORLEVEL!)>%Q%"+C+"%Q%%Q%) 2>%Q%"+E+"%Q% |%Q%"+process.execPath+"%Q% %Q%"+__dirname+"\\encrypt.js%Q% %Q%"+o9+"%Q% %Q%"+N+"%Q% >%Q%"+h+"%Q% & (echo 1)>%Q%"+S+"%Q%"]):(a="/bin/sh",n=["-c",'("'+V0+'"'+s.map(function(U){return" '"+U.replace(/'/g,"'\\''")+"'"}).join("")+'; echo $?>"'+C+'") 2>"'+E+'" |"'+process.execPath+'" "'+__dirname+'/encrypt.js" "'+o9+'" "'+N+'" >"'+h+'"; echo 1 >"'+S+'"']),CS&&CS("_execFileSync",s);try{l9.spawn(a,n,e)}catch(U){c.error=new Error(U.message),c.error.method="_execFileSync - spawn",c.error.program=a,c.error.args=n}for(;ii.readFileSync(S,{encoding:t.encoding}).trim()!=="1";);return(f=ii.readFileSync(C,{encoding:t.encoding}).trim())==="0"?c.input=R.update(ii.readFileSync(h,{encoding:"binary"}),"hex",t.encoding)+R.final(t.encoding):(p=ii.readFileSync(E,{encoding:t.encoding}).trim(),c.error=new Error(tve+(p?` +`+p:"")),c.error.method="_execFileSync",c.error.program=a,c.error.args=n,c.error.extMessage=p,c.error.exitCode=+f),ii.unlinkSync(h),ii.unlinkSync(E),ii.unlinkSync(C),ii.unlinkSync(S),c}function fDt(t){var e,r={},s,a={env:process.env,encoding:t.encoding};if(V0||(Pm?process.env.PSModulePath?(V0="powershell.exe",uF=["-ExecutionPolicy","Bypass","-File",__dirname+"\\read.ps1"]):(V0="cscript.exe",uF=["//nologo",__dirname+"\\read.cs.js"]):(V0="/bin/sh",uF=[__dirname+"/read.sh"])),Pm&&!process.env.PSModulePath&&(a.stdio=[process.stdin]),l9.execFileSync){e=nve(t),CS&&CS("execFileSync",e);try{r.input=l9.execFileSync(V0,e,a)}catch(n){s=n.stderr?(n.stderr+"").trim():"",r.error=new Error(tve+(s?` +`+s:"")),r.error.method="execFileSync",r.error.program=V0,r.error.args=e,r.error.extMessage=s,r.error.exitCode=n.status,r.error.code=n.code,r.error.signal=n.signal}}else r=uDt(t,a);return r.error||(r.input=r.input.replace(/^\s*'|'\s*$/g,""),t.display=""),r}function f9(t){var e="",r=t.display,s=!t.display&&t.keyIn&&t.hideEchoBack&&!t.mask;function a(){var n=fDt(t);if(n.error)throw n.error;return n.input}return u9&&u9(t),function(){var n,c,f;function p(){return n||(n=process.binding("fs"),c=process.binding("constants")),n}if(typeof eh=="string")if(eh=null,Pm){if(f=function(h){var E=h.replace(/^\D+/,"").split("."),C=0;return(E[0]=+E[0])&&(C+=E[0]*1e4),(E[1]=+E[1])&&(C+=E[1]*100),(E[2]=+E[2])&&(C+=E[2]),C}(process.version),!(f>=20302&&f<40204||f>=5e4&&f<50100||f>=50600&&f<60200)&&process.stdin.isTTY)process.stdin.pause(),eh=process.stdin.fd,JC=process.stdin._handle;else try{eh=p().open("CONIN$",c.O_RDWR,parseInt("0666",8)),JC=new $Be(eh,!0)}catch{}if(process.stdout.isTTY)$u=process.stdout.fd;else{try{$u=ii.openSync("\\\\.\\CON","w")}catch{}if(typeof $u!="number")try{$u=p().open("CONOUT$",c.O_RDWR,parseInt("0666",8))}catch{}}}else{if(process.stdin.isTTY){process.stdin.pause();try{eh=ii.openSync("/dev/tty","r"),JC=process.stdin._handle}catch{}}else try{eh=ii.openSync("/dev/tty","r"),JC=new $Be(eh,!1)}catch{}if(process.stdout.isTTY)$u=process.stdout.fd;else try{$u=ii.openSync("/dev/tty","w")}catch{}}}(),function(){var n,c,f=!t.hideEchoBack&&!t.keyIn,p,h,E,C,S;fF="";function P(I){return I===eve?!0:JC.setRawMode(I)!==0?!1:(eve=I,!0)}if(rve||!JC||typeof $u!="number"&&(t.display||!f)){e=a();return}if(t.display&&(ii.writeSync($u,t.display),t.display=""),!t.displayOnly){if(!P(!f)){e=a();return}for(h=t.keyIn?1:t.bufferSize,p=Buffer.allocUnsafe&&Buffer.alloc?Buffer.alloc(h):new Buffer(h),t.keyIn&&t.limit&&(c=new RegExp("[^"+t.limit+"]","g"+(t.caseSensitive?"":"i")));;){E=0;try{E=ii.readSync(eh,p,0,h)}catch(I){if(I.code!=="EOF"){P(!1),e+=a();return}}if(E>0?(C=p.toString(t.encoding,0,E),fF+=C):(C=` +`,fF+="\0"),C&&typeof(S=(C.match(/^(.*?)[\r\n]/)||[])[1])=="string"&&(C=S,n=!0),C&&(C=C.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"")),C&&c&&(C=C.replace(c,"")),C&&(f||(t.hideEchoBack?t.mask&&ii.writeSync($u,new Array(C.length+1).join(t.mask)):ii.writeSync($u,C)),e+=C),!t.keyIn&&n||t.keyIn&&e.length>=h)break}!f&&!s&&ii.writeSync($u,` +`),P(!1)}}(),t.print&&!s&&t.print(r+(t.displayOnly?"":(t.hideEchoBack?new Array(e.length+1).join(t.mask):e)+` +`),t.encoding),t.displayOnly?"":h9=t.keepWhitespace||t.keyIn?e:e.trim()}function ADt(t,e){var r=[];function s(a){a!=null&&(Array.isArray(a)?a.forEach(s):(!e||e(a))&&r.push(a))}return s(t),r}function g9(t){return t.replace(/[\x00-\x7f]/g,function(e){return"\\x"+("00"+e.charCodeAt().toString(16)).substr(-2)})}function Ks(){var t=Array.prototype.slice.call(arguments),e,r;return t.length&&typeof t[0]=="boolean"&&(r=t.shift(),r&&(e=Object.keys(c9),t.unshift(c9))),t.reduce(function(s,a){return a==null||(a.hasOwnProperty("noEchoBack")&&!a.hasOwnProperty("hideEchoBack")&&(a.hideEchoBack=a.noEchoBack,delete a.noEchoBack),a.hasOwnProperty("noTrim")&&!a.hasOwnProperty("keepWhitespace")&&(a.keepWhitespace=a.noTrim,delete a.noTrim),r||(e=Object.keys(a)),e.forEach(function(n){var c;if(a.hasOwnProperty(n))switch(c=a[n],n){case"mask":case"limitMessage":case"defaultInput":case"encoding":c=c!=null?c+"":"",c&&n!=="limitMessage"&&(c=c.replace(/[\r\n]/g,"")),s[n]=c;break;case"bufferSize":!isNaN(c=parseInt(c,10))&&typeof c=="number"&&(s[n]=c);break;case"displayOnly":case"keyIn":case"hideEchoBack":case"caseSensitive":case"keepWhitespace":case"history":case"cd":s[n]=!!c;break;case"limit":case"trueValue":case"falseValue":s[n]=ADt(c,function(f){var p=typeof f;return p==="string"||p==="number"||p==="function"||f instanceof RegExp}).map(function(f){return typeof f=="string"?f.replace(/[\r\n]/g,""):f});break;case"print":case"phContent":case"preCheck":s[n]=typeof c=="function"?c:void 0;break;case"prompt":case"display":s[n]=c??"";break}})),s},{})}function A9(t,e,r){return e.some(function(s){var a=typeof s;return a==="string"?r?t===s:t.toLowerCase()===s.toLowerCase():a==="number"?parseFloat(t)===s:a==="function"?s(t):s instanceof RegExp?s.test(t):!1})}function d9(t,e){var r=K0.normalize(Pm?(process.env.HOMEDRIVE||"")+(process.env.HOMEPATH||""):process.env.HOME||"").replace(/[\/\\]+$/,"");return t=K0.normalize(t),e?t.replace(/^~(?=\/|\\|$)/,r):t.replace(new RegExp("^"+g9(r)+"(?=\\/|\\\\|$)",Pm?"i":""),"~")}function zC(t,e){var r="(?:\\(([\\s\\S]*?)\\))?(\\w+|.-.)(?:\\(([\\s\\S]*?)\\))?",s=new RegExp("(\\$)?(\\$<"+r+">)","g"),a=new RegExp("(\\$)?(\\$\\{"+r+"\\})","g");function n(c,f,p,h,E,C){var S;return f||typeof(S=e(E))!="string"?p:S?(h||"")+S+(C||""):""}return t.replace(s,n).replace(a,n)}function ive(t,e,r){var s,a=[],n=-1,c=0,f="",p;function h(E,C){return C.length>3?(E.push(C[0]+"..."+C[C.length-1]),p=!0):C.length&&(E=E.concat(C)),E}return s=t.reduce(function(E,C){return E.concat((C+"").split(""))},[]).reduce(function(E,C){var S,P;return e||(C=C.toLowerCase()),S=/^\d$/.test(C)?1:/^[A-Z]$/.test(C)?2:/^[a-z]$/.test(C)?3:0,r&&S===0?f+=C:(P=C.charCodeAt(0),S&&S===n&&P===c+1?a.push(C):(E=h(E,a),a=[C],n=S),c=P),E},[]),s=h(s,a),f&&(s.push(f),p=!0),{values:s,suppressed:p}}function sve(t,e){return t.join(t.length>2?", ":e?" / ":"/")}function ove(t,e){var r,s,a={},n;if(e.phContent&&(r=e.phContent(t,e)),typeof r!="string")switch(t){case"hideEchoBack":case"mask":case"defaultInput":case"caseSensitive":case"keepWhitespace":case"encoding":case"bufferSize":case"history":case"cd":r=e.hasOwnProperty(t)?typeof e[t]=="boolean"?e[t]?"on":"off":e[t]+"":"";break;case"limit":case"trueValue":case"falseValue":s=e[e.hasOwnProperty(t+"Src")?t+"Src":t],e.keyIn?(a=ive(s,e.caseSensitive),s=a.values):s=s.filter(function(c){var f=typeof c;return f==="string"||f==="number"}),r=sve(s,a.suppressed);break;case"limitCount":case"limitCountNotZero":r=e[e.hasOwnProperty("limitSrc")?"limitSrc":"limit"].length,r=r||t!=="limitCountNotZero"?r+"":"";break;case"lastInput":r=h9;break;case"cwd":case"CWD":case"cwdHome":r=process.cwd(),t==="CWD"?r=K0.basename(r):t==="cwdHome"&&(r=d9(r));break;case"date":case"time":case"localeDate":case"localeTime":r=new Date()["to"+t.replace(/^./,function(c){return c.toUpperCase()})+"String"]();break;default:typeof(n=(t.match(/^history_m(\d+)$/)||[])[1])=="string"&&(r=bm[bm.length-n]||"")}return r}function ave(t){var e=/^(.)-(.)$/.exec(t),r="",s,a,n,c;if(!e)return null;for(s=e[1].charCodeAt(0),a=e[2].charCodeAt(0),c=s +And the length must be: $`,trueValue:null,falseValue:null,caseSensitive:!0},e,{history:!1,cd:!1,phContent:function(P){return P==="charlist"?r.text:P==="length"?s+"..."+a:null}}),c,f,p,h,E,C,S;for(e=e||{},c=zC(e.charlist?e.charlist+"":"$",ave),(isNaN(s=parseInt(e.min,10))||typeof s!="number")&&(s=12),(isNaN(a=parseInt(e.max,10))||typeof a!="number")&&(a=24),h=new RegExp("^["+g9(c)+"]{"+s+","+a+"}$"),r=ive([c],n.caseSensitive,!0),r.text=sve(r.values,r.suppressed),f=e.confirmMessage!=null?e.confirmMessage:"Reinput a same one to confirm it: ",p=e.unmatchMessage!=null?e.unmatchMessage:"It differs from first one. Hit only the Enter key if you want to retry from first one.",t==null&&(t="Input new password: "),E=n.limitMessage;!S;)n.limit=h,n.limitMessage=E,C=$r.question(t,n),n.limit=[C,""],n.limitMessage=p,S=$r.question(f,n);return C};function uve(t,e,r){var s;function a(n){return s=r(n),!isNaN(s)&&typeof s=="number"}return $r.question(t,Ks({limitMessage:"Input valid number, please."},e,{limit:a,cd:!1})),s}$r.questionInt=function(t,e){return uve(t,e,function(r){return parseInt(r,10)})};$r.questionFloat=function(t,e){return uve(t,e,parseFloat)};$r.questionPath=function(t,e){var r,s="",a=Ks({hideEchoBack:!1,limitMessage:`$Input valid path, please.$<( Min:)min>$<( Max:)max>`,history:!0,cd:!0},e,{keepWhitespace:!1,limit:function(n){var c,f,p;n=d9(n,!0),s="";function h(E){E.split(/\/|\\/).reduce(function(C,S){var P=K0.resolve(C+=S+K0.sep);if(!ii.existsSync(P))ii.mkdirSync(P);else if(!ii.statSync(P).isDirectory())throw new Error("Non directory already exists: "+P);return C},"")}try{if(c=ii.existsSync(n),r=c?ii.realpathSync(n):K0.resolve(n),!e.hasOwnProperty("exists")&&!c||typeof e.exists=="boolean"&&e.exists!==c)return s=(c?"Already exists":"No such file or directory")+": "+r,!1;if(!c&&e.create&&(e.isDirectory?h(r):(h(K0.dirname(r)),ii.closeSync(ii.openSync(r,"w"))),r=ii.realpathSync(r)),c&&(e.min||e.max||e.isFile||e.isDirectory)){if(f=ii.statSync(r),e.isFile&&!f.isFile())return s="Not file: "+r,!1;if(e.isDirectory&&!f.isDirectory())return s="Not directory: "+r,!1;if(e.min&&f.size<+e.min||e.max&&f.size>+e.max)return s="Size "+f.size+" is out of range: "+r,!1}if(typeof e.validate=="function"&&(p=e.validate(r))!==!0)return typeof p=="string"&&(s=p),!1}catch(E){return s=E+"",!1}return!0},phContent:function(n){return n==="error"?s:n!=="min"&&n!=="max"?null:e.hasOwnProperty(n)?e[n]+"":""}});return e=e||{},t==null&&(t='Input path (you can "cd" and "pwd"): '),$r.question(t,a),r};function fve(t,e){var r={},s={};return typeof t=="object"?(Object.keys(t).forEach(function(a){typeof t[a]=="function"&&(s[e.caseSensitive?a:a.toLowerCase()]=t[a])}),r.preCheck=function(a){var n;return r.args=p9(a),n=r.args[0]||"",e.caseSensitive||(n=n.toLowerCase()),r.hRes=n!=="_"&&s.hasOwnProperty(n)?s[n].apply(a,r.args.slice(1)):s.hasOwnProperty("_")?s._.apply(a,r.args):null,{res:a,forceNext:!1}},s.hasOwnProperty("_")||(r.limit=function(){var a=r.args[0]||"";return e.caseSensitive||(a=a.toLowerCase()),s.hasOwnProperty(a)})):r.preCheck=function(a){return r.args=p9(a),r.hRes=typeof t=="function"?t.apply(a,r.args):!0,{res:a,forceNext:!1}},r}$r.promptCL=function(t,e){var r=Ks({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),s=fve(t,r);return r.limit=s.limit,r.preCheck=s.preCheck,$r.prompt(r),s.args};$r.promptLoop=function(t,e){for(var r=Ks({hideEchoBack:!1,trueValue:null,falseValue:null,caseSensitive:!1,history:!0},e);!t($r.prompt(r)););};$r.promptCLLoop=function(t,e){var r=Ks({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),s=fve(t,r);for(r.limit=s.limit,r.preCheck=s.preCheck;$r.prompt(r),!s.hRes;);};$r.promptSimShell=function(t){return $r.prompt(Ks({hideEchoBack:!1,history:!0},t,{prompt:function(){return Pm?"$>":(process.env.USER||"")+(process.env.HOSTNAME?"@"+process.env.HOSTNAME.replace(/\..*$/,""):"")+":$$ "}()}))};function Ave(t,e,r){var s;return t==null&&(t="Are you sure? "),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s*:?\s*$/,"")+" [y/n]: "),s=$r.keyIn(t,Ks(e,{hideEchoBack:!1,limit:r,trueValue:"y",falseValue:"n",caseSensitive:!1})),typeof s=="boolean"?s:""}$r.keyInYN=function(t,e){return Ave(t,e)};$r.keyInYNStrict=function(t,e){return Ave(t,e,"yn")};$r.keyInPause=function(t,e){t==null&&(t="Continue..."),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s+$/,"")+" (Hit any key)"),$r.keyIn(t,Ks({limit:null},e,{hideEchoBack:!0,mask:""}))};$r.keyInSelect=function(t,e,r){var s=Ks({hideEchoBack:!1},r,{trueValue:null,falseValue:null,caseSensitive:!1,phContent:function(p){return p==="itemsCount"?t.length+"":p==="firstItem"?(t[0]+"").trim():p==="lastItem"?(t[t.length-1]+"").trim():null}}),a="",n={},c=49,f=` +`;if(!Array.isArray(t)||!t.length||t.length>35)throw"`items` must be Array (max length: 35).";return t.forEach(function(p,h){var E=String.fromCharCode(c);a+=E,n[E]=h,f+="["+E+"] "+(p+"").trim()+` +`,c=c===57?97:c+1}),(!r||r.cancel!==!1)&&(a+="0",n[0]=-1,f+="[0] "+(r&&r.cancel!=null&&typeof r.cancel!="boolean"?(r.cancel+"").trim():"CANCEL")+` +`),s.limit=a,f+=` +`,e==null&&(e="Choose one from list: "),(e+="")&&((!r||r.guide!==!1)&&(e=e.replace(/\s*:?\s*$/,"")+" [$]: "),f+=e),n[$r.keyIn(f,s).toLowerCase()]};$r.getRawInput=function(){return fF};function wS(t,e){var r;return e.length&&(r={},r[t]=e[0]),$r.setDefaultOptions(r)[t]}$r.setPrint=function(){return wS("print",arguments)};$r.setPrompt=function(){return wS("prompt",arguments)};$r.setEncoding=function(){return wS("encoding",arguments)};$r.setMask=function(){return wS("mask",arguments)};$r.setBufferSize=function(){return wS("bufferSize",arguments)}});var m9=L((vfr,tc)=>{(function(){var t={major:0,minor:2,patch:66,status:"beta"};tau_file_system={files:{},open:function(w,b,y){var F=tau_file_system.files[w];if(!F){if(y==="read")return null;F={path:w,text:"",type:b,get:function(z,Z){return Z===this.text.length||Z>this.text.length?"end_of_file":this.text.substring(Z,Z+z)},put:function(z,Z){return Z==="end_of_file"?(this.text+=z,!0):Z==="past_end_of_file"?null:(this.text=this.text.substring(0,Z)+z+this.text.substring(Z+z.length),!0)},get_byte:function(z){if(z==="end_of_stream")return-1;var Z=Math.floor(z/2);if(this.text.length<=Z)return-1;var $=n(this.text[Math.floor(z/2)],0);return z%2===0?$&255:$/256>>>0},put_byte:function(z,Z){var $=Z==="end_of_stream"?this.text.length:Math.floor(Z/2);if(this.text.length<$)return null;var oe=this.text.length===$?-1:n(this.text[Math.floor(Z/2)],0);return Z%2===0?(oe=oe/256>>>0,oe=(oe&255)<<8|z&255):(oe=oe&255,oe=(z&255)<<8|oe&255),this.text.length===$?this.text+=c(oe):this.text=this.text.substring(0,$)+c(oe)+this.text.substring($+1),!0},flush:function(){return!0},close:function(){var z=tau_file_system.files[this.path];return z?!0:null}},tau_file_system.files[w]=F}return y==="write"&&(F.text=""),F}},tau_user_input={buffer:"",get:function(w,b){for(var y;tau_user_input.buffer.length\?\@\^\~\\]+|'(?:[^']*?(?:\\(?:x?\d+)?\\)*(?:'')*(?:\\')*)*')/,number:/^(?:0o[0-7]+|0x[0-9a-fA-F]+|0b[01]+|0'(?:''|\\[abfnrtv\\'"`]|\\x?\d+\\|[^\\])|\d+(?:\.\d+(?:[eE][+-]?\d+)?)?)/,string:/^(?:"([^"]|""|\\")*"|`([^`]|``|\\`)*`)/,l_brace:/^(?:\[)/,r_brace:/^(?:\])/,l_bracket:/^(?:\{)/,r_bracket:/^(?:\})/,bar:/^(?:\|)/,l_paren:/^(?:\()/,r_paren:/^(?:\))/};function N(w,b){return w.get_flag("char_conversion").id==="on"?b.replace(/./g,function(y){return w.get_char_conversion(y)}):b}function U(w){this.thread=w,this.text="",this.tokens=[]}U.prototype.set_last_tokens=function(w){return this.tokens=w},U.prototype.new_text=function(w){this.text=w,this.tokens=[]},U.prototype.get_tokens=function(w){var b,y=0,F=0,z=0,Z=[],$=!1;if(w){var oe=this.tokens[w-1];y=oe.len,b=N(this.thread,this.text.substr(oe.len)),F=oe.line,z=oe.start}else b=this.text;if(/^\s*$/.test(b))return null;for(;b!=="";){var xe=[],Te=!1;if(/^\n/.exec(b)!==null){F++,z=0,y++,b=b.replace(/\n/,""),$=!0;continue}for(var lt in R)if(R.hasOwnProperty(lt)){var Et=R[lt].exec(b);Et&&xe.push({value:Et[0],name:lt,matches:Et})}if(!xe.length)return this.set_last_tokens([{value:b,matches:[],name:"lexical",line:F,start:z}]);var oe=r(xe,function(Pr,Ir){return Pr.value.length>=Ir.value.length?Pr:Ir});switch(oe.start=z,oe.line=F,b=b.replace(oe.value,""),z+=oe.value.length,y+=oe.value.length,oe.name){case"atom":oe.raw=oe.value,oe.value.charAt(0)==="'"&&(oe.value=S(oe.value.substr(1,oe.value.length-2),"'"),oe.value===null&&(oe.name="lexical",oe.value="unknown escape sequence"));break;case"number":oe.float=oe.value.substring(0,2)!=="0x"&&oe.value.match(/[.eE]/)!==null&&oe.value!=="0'.",oe.value=I(oe.value),oe.blank=Te;break;case"string":var qt=oe.value.charAt(0);oe.value=S(oe.value.substr(1,oe.value.length-2),qt),oe.value===null&&(oe.name="lexical",oe.value="unknown escape sequence");break;case"whitespace":var ir=Z[Z.length-1];ir&&(ir.space=!0),Te=!0;continue;case"r_bracket":Z.length>0&&Z[Z.length-1].name==="l_bracket"&&(oe=Z.pop(),oe.name="atom",oe.value="{}",oe.raw="{}",oe.space=!1);break;case"r_brace":Z.length>0&&Z[Z.length-1].name==="l_brace"&&(oe=Z.pop(),oe.name="atom",oe.value="[]",oe.raw="[]",oe.space=!1);break}oe.len=y,Z.push(oe),Te=!1}var Pt=this.set_last_tokens(Z);return Pt.length===0?null:Pt};function W(w,b,y,F,z){if(!b[y])return{type:f,value:x.error.syntax(b[y-1],"expression expected",!0)};var Z;if(F==="0"){var $=b[y];switch($.name){case"number":return{type:p,len:y+1,value:new x.type.Num($.value,$.float)};case"variable":return{type:p,len:y+1,value:new x.type.Var($.value)};case"string":var oe;switch(w.get_flag("double_quotes").id){case"atom":oe=new j($.value,[]);break;case"codes":oe=new j("[]",[]);for(var xe=$.value.length-1;xe>=0;xe--)oe=new j(".",[new x.type.Num(n($.value,xe),!1),oe]);break;case"chars":oe=new j("[]",[]);for(var xe=$.value.length-1;xe>=0;xe--)oe=new j(".",[new x.type.Term($.value.charAt(xe),[]),oe]);break}return{type:p,len:y+1,value:oe};case"l_paren":var Pt=W(w,b,y+1,w.__get_max_priority(),!0);return Pt.type!==p?Pt:b[Pt.len]&&b[Pt.len].name==="r_paren"?(Pt.len++,Pt):{type:f,derived:!0,value:x.error.syntax(b[Pt.len]?b[Pt.len]:b[Pt.len-1],") or operator expected",!b[Pt.len])};case"l_bracket":var Pt=W(w,b,y+1,w.__get_max_priority(),!0);return Pt.type!==p?Pt:b[Pt.len]&&b[Pt.len].name==="r_bracket"?(Pt.len++,Pt.value=new j("{}",[Pt.value]),Pt):{type:f,derived:!0,value:x.error.syntax(b[Pt.len]?b[Pt.len]:b[Pt.len-1],"} or operator expected",!b[Pt.len])}}var Te=te(w,b,y,z);return Te.type===p||Te.derived||(Te=ie(w,b,y),Te.type===p||Te.derived)?Te:{type:f,derived:!1,value:x.error.syntax(b[y],"unexpected token")}}var lt=w.__get_max_priority(),Et=w.__get_next_priority(F),qt=y;if(b[y].name==="atom"&&b[y+1]&&(b[y].space||b[y+1].name!=="l_paren")){var $=b[y++],ir=w.__lookup_operator_classes(F,$.value);if(ir&&ir.indexOf("fy")>-1){var Pt=W(w,b,y,F,z);if(Pt.type!==f)return $.value==="-"&&!$.space&&x.type.is_number(Pt.value)?{value:new x.type.Num(-Pt.value.value,Pt.value.is_float),len:Pt.len,type:p}:{value:new x.type.Term($.value,[Pt.value]),len:Pt.len,type:p};Z=Pt}else if(ir&&ir.indexOf("fx")>-1){var Pt=W(w,b,y,Et,z);if(Pt.type!==f)return{value:new x.type.Term($.value,[Pt.value]),len:Pt.len,type:p};Z=Pt}}y=qt;var Pt=W(w,b,y,Et,z);if(Pt.type===p){y=Pt.len;var $=b[y];if(b[y]&&(b[y].name==="atom"&&w.__lookup_operator_classes(F,$.value)||b[y].name==="bar"&&w.__lookup_operator_classes(F,"|"))){var gn=Et,Pr=F,ir=w.__lookup_operator_classes(F,$.value);if(ir.indexOf("xf")>-1)return{value:new x.type.Term($.value,[Pt.value]),len:++Pt.len,type:p};if(ir.indexOf("xfx")>-1){var Ir=W(w,b,y+1,gn,z);return Ir.type===p?{value:new x.type.Term($.value,[Pt.value,Ir.value]),len:Ir.len,type:p}:(Ir.derived=!0,Ir)}else if(ir.indexOf("xfy")>-1){var Ir=W(w,b,y+1,Pr,z);return Ir.type===p?{value:new x.type.Term($.value,[Pt.value,Ir.value]),len:Ir.len,type:p}:(Ir.derived=!0,Ir)}else if(Pt.type!==f)for(;;){y=Pt.len;var $=b[y];if($&&$.name==="atom"&&w.__lookup_operator_classes(F,$.value)){var ir=w.__lookup_operator_classes(F,$.value);if(ir.indexOf("yf")>-1)Pt={value:new x.type.Term($.value,[Pt.value]),len:++y,type:p};else if(ir.indexOf("yfx")>-1){var Ir=W(w,b,++y,gn,z);if(Ir.type===f)return Ir.derived=!0,Ir;y=Ir.len,Pt={value:new x.type.Term($.value,[Pt.value,Ir.value]),len:y,type:p}}else break}else break}}else Z={type:f,value:x.error.syntax(b[Pt.len-1],"operator expected")};return Pt}return Pt}function te(w,b,y,F){if(!b[y]||b[y].name==="atom"&&b[y].raw==="."&&!F&&(b[y].space||!b[y+1]||b[y+1].name!=="l_paren"))return{type:f,derived:!1,value:x.error.syntax(b[y-1],"unfounded token")};var z=b[y],Z=[];if(b[y].name==="atom"&&b[y].raw!==","){if(y++,b[y-1].space)return{type:p,len:y,value:new x.type.Term(z.value,Z)};if(b[y]&&b[y].name==="l_paren"){if(b[y+1]&&b[y+1].name==="r_paren")return{type:f,derived:!0,value:x.error.syntax(b[y+1],"argument expected")};var $=W(w,b,++y,"999",!0);if($.type===f)return $.derived?$:{type:f,derived:!0,value:x.error.syntax(b[y]?b[y]:b[y-1],"argument expected",!b[y])};for(Z.push($.value),y=$.len;b[y]&&b[y].name==="atom"&&b[y].value===",";){if($=W(w,b,y+1,"999",!0),$.type===f)return $.derived?$:{type:f,derived:!0,value:x.error.syntax(b[y+1]?b[y+1]:b[y],"argument expected",!b[y+1])};Z.push($.value),y=$.len}if(b[y]&&b[y].name==="r_paren")y++;else return{type:f,derived:!0,value:x.error.syntax(b[y]?b[y]:b[y-1],", or ) expected",!b[y])}}return{type:p,len:y,value:new x.type.Term(z.value,Z)}}return{type:f,derived:!1,value:x.error.syntax(b[y],"term expected")}}function ie(w,b,y){if(!b[y])return{type:f,derived:!1,value:x.error.syntax(b[y-1],"[ expected")};if(b[y]&&b[y].name==="l_brace"){var F=W(w,b,++y,"999",!0),z=[F.value],Z=void 0;if(F.type===f)return b[y]&&b[y].name==="r_brace"?{type:p,len:y+1,value:new x.type.Term("[]",[])}:{type:f,derived:!0,value:x.error.syntax(b[y],"] expected")};for(y=F.len;b[y]&&b[y].name==="atom"&&b[y].value===",";){if(F=W(w,b,y+1,"999",!0),F.type===f)return F.derived?F:{type:f,derived:!0,value:x.error.syntax(b[y+1]?b[y+1]:b[y],"argument expected",!b[y+1])};z.push(F.value),y=F.len}var $=!1;if(b[y]&&b[y].name==="bar"){if($=!0,F=W(w,b,y+1,"999",!0),F.type===f)return F.derived?F:{type:f,derived:!0,value:x.error.syntax(b[y+1]?b[y+1]:b[y],"argument expected",!b[y+1])};Z=F.value,y=F.len}return b[y]&&b[y].name==="r_brace"?{type:p,len:y+1,value:g(z,Z)}:{type:f,derived:!0,value:x.error.syntax(b[y]?b[y]:b[y-1],$?"] expected":", or | or ] expected",!b[y])}}return{type:f,derived:!1,value:x.error.syntax(b[y],"list expected")}}function Ae(w,b,y){var F=b[y].line,z=W(w,b,y,w.__get_max_priority(),!1),Z=null,$;if(z.type!==f)if(y=z.len,b[y]&&b[y].name==="atom"&&b[y].raw===".")if(y++,x.type.is_term(z.value)){if(z.value.indicator===":-/2"?(Z=new x.type.Rule(z.value.args[0],Ce(z.value.args[1])),$={value:Z,len:y,type:p}):z.value.indicator==="-->/2"?(Z=pe(new x.type.Rule(z.value.args[0],z.value.args[1]),w),Z.body=Ce(Z.body),$={value:Z,len:y,type:x.type.is_rule(Z)?p:f}):(Z=new x.type.Rule(z.value,null),$={value:Z,len:y,type:p}),Z){var oe=Z.singleton_variables();oe.length>0&&w.throw_warning(x.warning.singleton(oe,Z.head.indicator,F))}return $}else return{type:f,value:x.error.syntax(b[y],"callable expected")};else return{type:f,value:x.error.syntax(b[y]?b[y]:b[y-1],". or operator expected")};return z}function ce(w,b,y){y=y||{},y.from=y.from?y.from:"$tau-js",y.reconsult=y.reconsult!==void 0?y.reconsult:!0;var F=new U(w),z={},Z;F.new_text(b);var $=0,oe=F.get_tokens($);do{if(oe===null||!oe[$])break;var xe=Ae(w,oe,$);if(xe.type===f)return new j("throw",[xe.value]);if(xe.value.body===null&&xe.value.head.indicator==="?-/1"){var Te=new it(w.session);Te.add_goal(xe.value.head.args[0]),Te.answer(function(Et){x.type.is_error(Et)?w.throw_warning(Et.args[0]):(Et===!1||Et===null)&&w.throw_warning(x.warning.failed_goal(xe.value.head.args[0],xe.len))}),$=xe.len;var lt=!0}else if(xe.value.body===null&&xe.value.head.indicator===":-/1"){var lt=w.run_directive(xe.value.head.args[0]);$=xe.len,xe.value.head.args[0].indicator==="char_conversion/2"&&(oe=F.get_tokens($),$=0)}else{Z=xe.value.head.indicator,y.reconsult!==!1&&z[Z]!==!0&&!w.is_multifile_predicate(Z)&&(w.session.rules[Z]=a(w.session.rules[Z]||[],function(qt){return qt.dynamic}),z[Z]=!0);var lt=w.add_rule(xe.value,y);$=xe.len}if(!lt)return lt}while(!0);return!0}function me(w,b){var y=new U(w);y.new_text(b);var F=0;do{var z=y.get_tokens(F);if(z===null)break;var Z=W(w,z,0,w.__get_max_priority(),!1);if(Z.type!==f){var $=Z.len,oe=$;if(z[$]&&z[$].name==="atom"&&z[$].raw===".")w.add_goal(Ce(Z.value));else{var xe=z[$];return new j("throw",[x.error.syntax(xe||z[$-1],". or operator expected",!xe)])}F=Z.len+1}else return new j("throw",[Z.value])}while(!0);return!0}function pe(w,b){w=w.rename(b);var y=b.next_free_variable(),F=Be(w.body,y,b);return F.error?F.value:(w.body=F.value,w.head.args=w.head.args.concat([y,F.variable]),w.head=new j(w.head.id,w.head.args),w)}function Be(w,b,y){var F;if(x.type.is_term(w)&&w.indicator==="!/0")return{value:w,variable:b,error:!1};if(x.type.is_term(w)&&w.indicator===",/2"){var z=Be(w.args[0],b,y);if(z.error)return z;var Z=Be(w.args[1],z.variable,y);return Z.error?Z:{value:new j(",",[z.value,Z.value]),variable:Z.variable,error:!1}}else{if(x.type.is_term(w)&&w.indicator==="{}/1")return{value:w.args[0],variable:b,error:!1};if(x.type.is_empty_list(w))return{value:new j("true",[]),variable:b,error:!1};if(x.type.is_list(w)){F=y.next_free_variable();for(var $=w,oe;$.indicator==="./2";)oe=$,$=$.args[1];return x.type.is_variable($)?{value:x.error.instantiation("DCG"),variable:b,error:!0}:x.type.is_empty_list($)?(oe.args[1]=F,{value:new j("=",[b,w]),variable:F,error:!1}):{value:x.error.type("list",w,"DCG"),variable:b,error:!0}}else return x.type.is_callable(w)?(F=y.next_free_variable(),w.args=w.args.concat([b,F]),w=new j(w.id,w.args),{value:w,variable:F,error:!1}):{value:x.error.type("callable",w,"DCG"),variable:b,error:!0}}}function Ce(w){return x.type.is_variable(w)?new j("call",[w]):x.type.is_term(w)&&[",/2",";/2","->/2"].indexOf(w.indicator)!==-1?new j(w.id,[Ce(w.args[0]),Ce(w.args[1])]):w}function g(w,b){for(var y=b||new x.type.Term("[]",[]),F=w.length-1;F>=0;F--)y=new x.type.Term(".",[w[F],y]);return y}function we(w,b){for(var y=w.length-1;y>=0;y--)w[y]===b&&w.splice(y,1)}function Ee(w){for(var b={},y=[],F=0;F=0;b--)if(w.charAt(b)==="/")return new j("/",[new j(w.substring(0,b)),new Re(parseInt(w.substring(b+1)),!1)])}function De(w){this.id=w}function Re(w,b){this.is_float=b!==void 0?b:parseInt(w)!==w,this.value=this.is_float?w:parseInt(w)}var gt=0;function j(w,b,y){this.ref=y||++gt,this.id=w,this.args=b||[],this.indicator=w+"/"+this.args.length}var rt=0;function Fe(w,b,y,F,z,Z){this.id=rt++,this.stream=w,this.mode=b,this.alias=y,this.type=F!==void 0?F:"text",this.reposition=z!==void 0?z:!0,this.eof_action=Z!==void 0?Z:"eof_code",this.position=this.mode==="append"?"end_of_stream":0,this.output=this.mode==="write"||this.mode==="append",this.input=this.mode==="read"}function Ne(w){w=w||{},this.links=w}function Pe(w,b,y){b=b||new Ne,y=y||null,this.goal=w,this.substitution=b,this.parent=y}function Ye(w,b,y){this.head=w,this.body=b,this.dynamic=y||!1}function ke(w){w=w===void 0||w<=0?1e3:w,this.rules={},this.src_predicates={},this.rename=0,this.modules=[],this.thread=new it(this),this.total_threads=1,this.renamed_variables={},this.public_predicates={},this.multifile_predicates={},this.limit=w,this.streams={user_input:new Fe(typeof tc<"u"&&tc.exports?nodejs_user_input:tau_user_input,"read","user_input","text",!1,"reset"),user_output:new Fe(typeof tc<"u"&&tc.exports?nodejs_user_output:tau_user_output,"write","user_output","text",!1,"eof_code")},this.file_system=typeof tc<"u"&&tc.exports?nodejs_file_system:tau_file_system,this.standard_input=this.streams.user_input,this.standard_output=this.streams.user_output,this.current_input=this.streams.user_input,this.current_output=this.streams.user_output,this.format_success=function(b){return b.substitution},this.format_error=function(b){return b.goal},this.flag={bounded:x.flag.bounded.value,max_integer:x.flag.max_integer.value,min_integer:x.flag.min_integer.value,integer_rounding_function:x.flag.integer_rounding_function.value,char_conversion:x.flag.char_conversion.value,debug:x.flag.debug.value,max_arity:x.flag.max_arity.value,unknown:x.flag.unknown.value,double_quotes:x.flag.double_quotes.value,occurs_check:x.flag.occurs_check.value,dialect:x.flag.dialect.value,version_data:x.flag.version_data.value,nodejs:x.flag.nodejs.value},this.__loaded_modules=[],this.__char_conversion={},this.__operators={1200:{":-":["fx","xfx"],"-->":["xfx"],"?-":["fx"]},1100:{";":["xfy"]},1050:{"->":["xfy"]},1e3:{",":["xfy"]},900:{"\\+":["fy"]},700:{"=":["xfx"],"\\=":["xfx"],"==":["xfx"],"\\==":["xfx"],"@<":["xfx"],"@=<":["xfx"],"@>":["xfx"],"@>=":["xfx"],"=..":["xfx"],is:["xfx"],"=:=":["xfx"],"=\\=":["xfx"],"<":["xfx"],"=<":["xfx"],">":["xfx"],">=":["xfx"]},600:{":":["xfy"]},500:{"+":["yfx"],"-":["yfx"],"/\\":["yfx"],"\\/":["yfx"]},400:{"*":["yfx"],"/":["yfx"],"//":["yfx"],rem:["yfx"],mod:["yfx"],"<<":["yfx"],">>":["yfx"]},200:{"**":["xfx"],"^":["xfy"],"-":["fy"],"+":["fy"],"\\":["fy"]}}}function it(w){this.epoch=Date.now(),this.session=w,this.session.total_threads++,this.total_steps=0,this.cpu_time=0,this.cpu_time_last=0,this.points=[],this.debugger=!1,this.debugger_states=[],this.level="top_level/0",this.__calls=[],this.current_limit=this.session.limit,this.warnings=[]}function _e(w,b,y){this.id=w,this.rules=b,this.exports=y,x.module[w]=this}_e.prototype.exports_predicate=function(w){return this.exports.indexOf(w)!==-1},De.prototype.unify=function(w,b){if(b&&e(w.variables(),this.id)!==-1&&!x.type.is_variable(w))return null;var y={};return y[this.id]=w,new Ne(y)},Re.prototype.unify=function(w,b){return x.type.is_number(w)&&this.value===w.value&&this.is_float===w.is_float?new Ne:null},j.prototype.unify=function(w,b){if(x.type.is_term(w)&&this.indicator===w.indicator){for(var y=new Ne,F=0;F=0){var F=this.args[0].value,z=Math.floor(F/26),Z=F%26;return"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Z]+(z!==0?z:"")}switch(this.indicator){case"[]/0":case"{}/0":case"!/0":return this.id;case"{}/1":return"{"+this.args[0].toString(w)+"}";case"./2":for(var $="["+this.args[0].toString(w),oe=this.args[1];oe.indicator==="./2";)$+=", "+oe.args[0].toString(w),oe=oe.args[1];return oe.indicator!=="[]/0"&&($+="|"+oe.toString(w)),$+="]",$;case",/2":return"("+this.args[0].toString(w)+", "+this.args[1].toString(w)+")";default:var xe=this.id,Te=w.session?w.session.lookup_operator(this.id,this.args.length):null;if(w.session===void 0||w.ignore_ops||Te===null)return w.quoted&&!/^(!|,|;|[a-z][0-9a-zA-Z_]*)$/.test(xe)&&xe!=="{}"&&xe!=="[]"&&(xe="'"+P(xe)+"'"),xe+(this.args.length?"("+s(this.args,function(ir){return ir.toString(w)}).join(", ")+")":"");var lt=Te.priority>b.priority||Te.priority===b.priority&&(Te.class==="xfy"&&this.indicator!==b.indicator||Te.class==="yfx"&&this.indicator!==b.indicator||this.indicator===b.indicator&&Te.class==="yfx"&&y==="right"||this.indicator===b.indicator&&Te.class==="xfy"&&y==="left");Te.indicator=this.indicator;var Et=lt?"(":"",qt=lt?")":"";return this.args.length===0?"("+this.id+")":["fy","fx"].indexOf(Te.class)!==-1?Et+xe+" "+this.args[0].toString(w,Te)+qt:["yf","xf"].indexOf(Te.class)!==-1?Et+this.args[0].toString(w,Te)+" "+xe+qt:Et+this.args[0].toString(w,Te,"left")+" "+this.id+" "+this.args[1].toString(w,Te,"right")+qt}},Fe.prototype.toString=function(w){return"("+this.id+")"},Ne.prototype.toString=function(w){var b="{";for(var y in this.links)this.links.hasOwnProperty(y)&&(b!=="{"&&(b+=", "),b+=y+"/"+this.links[y].toString(w));return b+="}",b},Pe.prototype.toString=function(w){return this.goal===null?"<"+this.substitution.toString(w)+">":"<"+this.goal.toString(w)+", "+this.substitution.toString(w)+">"},Ye.prototype.toString=function(w){return this.body?this.head.toString(w)+" :- "+this.body.toString(w)+".":this.head.toString(w)+"."},ke.prototype.toString=function(w){for(var b="",y=0;y=0;z--)F=new j(".",[b[z],F]);return F}return new j(this.id,s(this.args,function(Z){return Z.apply(w)}),this.ref)},Fe.prototype.apply=function(w){return this},Ye.prototype.apply=function(w){return new Ye(this.head.apply(w),this.body!==null?this.body.apply(w):null)},Ne.prototype.apply=function(w){var b,y={};for(b in this.links)this.links.hasOwnProperty(b)&&(y[b]=this.links[b].apply(w));return new Ne(y)},j.prototype.select=function(){for(var w=this;w.indicator===",/2";)w=w.args[0];return w},j.prototype.replace=function(w){return this.indicator===",/2"?this.args[0].indicator===",/2"?new j(",",[this.args[0].replace(w),this.args[1]]):w===null?this.args[1]:new j(",",[w,this.args[1]]):w},j.prototype.search=function(w){if(x.type.is_term(w)&&w.ref!==void 0&&this.ref===w.ref)return!0;for(var b=0;bb&&F0&&(b=this.head_point().substitution.domain());e(b,x.format_variable(this.session.rename))!==-1;)this.session.rename++;if(w.id==="_")return new De(x.format_variable(this.session.rename));this.session.renamed_variables[w.id]=x.format_variable(this.session.rename)}return new De(this.session.renamed_variables[w.id])},ke.prototype.next_free_variable=function(){return this.thread.next_free_variable()},it.prototype.next_free_variable=function(){this.session.rename++;var w=[];for(this.points.length>0&&(w=this.head_point().substitution.domain());e(w,x.format_variable(this.session.rename))!==-1;)this.session.rename++;return new De(x.format_variable(this.session.rename))},ke.prototype.is_public_predicate=function(w){return!this.public_predicates.hasOwnProperty(w)||this.public_predicates[w]===!0},it.prototype.is_public_predicate=function(w){return this.session.is_public_predicate(w)},ke.prototype.is_multifile_predicate=function(w){return this.multifile_predicates.hasOwnProperty(w)&&this.multifile_predicates[w]===!0},it.prototype.is_multifile_predicate=function(w){return this.session.is_multifile_predicate(w)},ke.prototype.prepend=function(w){return this.thread.prepend(w)},it.prototype.prepend=function(w){for(var b=w.length-1;b>=0;b--)this.points.push(w[b])},ke.prototype.success=function(w,b){return this.thread.success(w,b)},it.prototype.success=function(w,y){var y=typeof y>"u"?w:y;this.prepend([new Pe(w.goal.replace(null),w.substitution,y)])},ke.prototype.throw_error=function(w){return this.thread.throw_error(w)},it.prototype.throw_error=function(w){this.prepend([new Pe(new j("throw",[w]),new Ne,null,null)])},ke.prototype.step_rule=function(w,b){return this.thread.step_rule(w,b)},it.prototype.step_rule=function(w,b){var y=b.indicator;if(w==="user"&&(w=null),w===null&&this.session.rules.hasOwnProperty(y))return this.session.rules[y];for(var F=w===null?this.session.modules:e(this.session.modules,w)===-1?[]:[w],z=0;z1)&&this.again()},ke.prototype.answers=function(w,b,y){return this.thread.answers(w,b,y)},it.prototype.answers=function(w,b,y){var F=b||1e3,z=this;if(b<=0){y&&y();return}this.answer(function(Z){w(Z),Z!==!1?setTimeout(function(){z.answers(w,b-1,y)},1):y&&y()})},ke.prototype.again=function(w){return this.thread.again(w)},it.prototype.again=function(w){for(var b,y=Date.now();this.__calls.length>0;){for(this.warnings=[],w!==!1&&(this.current_limit=this.session.limit);this.current_limit>0&&this.points.length>0&&this.head_point().goal!==null&&!x.type.is_error(this.head_point().goal);)if(this.current_limit--,this.step()===!0)return;var F=Date.now();this.cpu_time_last=F-y,this.cpu_time+=this.cpu_time_last;var z=this.__calls.shift();this.current_limit<=0?z(null):this.points.length===0?z(!1):x.type.is_error(this.head_point().goal)?(b=this.session.format_error(this.points.pop()),this.points=[],z(b)):(this.debugger&&this.debugger_states.push(this.head_point()),b=this.session.format_success(this.points.pop()),z(b))}},ke.prototype.unfold=function(w){if(w.body===null)return!1;var b=w.head,y=w.body,F=y.select(),z=new it(this),Z=[];z.add_goal(F),z.step();for(var $=z.points.length-1;$>=0;$--){var oe=z.points[$],xe=b.apply(oe.substitution),Te=y.replace(oe.goal);Te!==null&&(Te=Te.apply(oe.substitution)),Z.push(new Ye(xe,Te))}var lt=this.rules[b.indicator],Et=e(lt,w);return Z.length>0&&Et!==-1?(lt.splice.apply(lt,[Et,1].concat(Z)),!0):!1},it.prototype.unfold=function(w){return this.session.unfold(w)},De.prototype.interpret=function(w){return x.error.instantiation(w.level)},Re.prototype.interpret=function(w){return this},j.prototype.interpret=function(w){return x.type.is_unitary_list(this)?this.args[0].interpret(w):x.operate(w,this)},De.prototype.compare=function(w){return this.idw.id?1:0},Re.prototype.compare=function(w){if(this.value===w.value&&this.is_float===w.is_float)return 0;if(this.valuew.value)return 1},j.prototype.compare=function(w){if(this.args.lengthw.args.length||this.args.length===w.args.length&&this.id>w.id)return 1;for(var b=0;bF)return 1;if(w.constructor===Re){if(w.is_float&&b.is_float)return 0;if(w.is_float)return-1;if(b.is_float)return 1}return 0},is_substitution:function(w){return w instanceof Ne},is_state:function(w){return w instanceof Pe},is_rule:function(w){return w instanceof Ye},is_variable:function(w){return w instanceof De},is_stream:function(w){return w instanceof Fe},is_anonymous_var:function(w){return w instanceof De&&w.id==="_"},is_callable:function(w){return w instanceof j},is_number:function(w){return w instanceof Re},is_integer:function(w){return w instanceof Re&&!w.is_float},is_float:function(w){return w instanceof Re&&w.is_float},is_term:function(w){return w instanceof j},is_atom:function(w){return w instanceof j&&w.args.length===0},is_ground:function(w){if(w instanceof De)return!1;if(w instanceof j){for(var b=0;b0},is_list:function(w){return w instanceof j&&(w.indicator==="[]/0"||w.indicator==="./2")},is_empty_list:function(w){return w instanceof j&&w.indicator==="[]/0"},is_non_empty_list:function(w){return w instanceof j&&w.indicator==="./2"},is_fully_list:function(w){for(;w instanceof j&&w.indicator==="./2";)w=w.args[1];return w instanceof De||w instanceof j&&w.indicator==="[]/0"},is_instantiated_list:function(w){for(;w instanceof j&&w.indicator==="./2";)w=w.args[1];return w instanceof j&&w.indicator==="[]/0"},is_unitary_list:function(w){return w instanceof j&&w.indicator==="./2"&&w.args[1]instanceof j&&w.args[1].indicator==="[]/0"},is_character:function(w){return w instanceof j&&(w.id.length===1||w.id.length>0&&w.id.length<=2&&n(w.id,0)>=65536)},is_character_code:function(w){return w instanceof Re&&!w.is_float&&w.value>=0&&w.value<=1114111},is_byte:function(w){return w instanceof Re&&!w.is_float&&w.value>=0&&w.value<=255},is_operator:function(w){return w instanceof j&&x.arithmetic.evaluation[w.indicator]},is_directive:function(w){return w instanceof j&&x.directive[w.indicator]!==void 0},is_builtin:function(w){return w instanceof j&&x.predicate[w.indicator]!==void 0},is_error:function(w){return w instanceof j&&w.indicator==="throw/1"},is_predicate_indicator:function(w){return w instanceof j&&w.indicator==="//2"&&w.args[0]instanceof j&&w.args[0].args.length===0&&w.args[1]instanceof Re&&w.args[1].is_float===!1},is_flag:function(w){return w instanceof j&&w.args.length===0&&x.flag[w.id]!==void 0},is_value_flag:function(w,b){if(!x.type.is_flag(w))return!1;for(var y in x.flag[w.id].allowed)if(x.flag[w.id].allowed.hasOwnProperty(y)&&x.flag[w.id].allowed[y].equals(b))return!0;return!1},is_io_mode:function(w){return x.type.is_atom(w)&&["read","write","append"].indexOf(w.id)!==-1},is_stream_option:function(w){return x.type.is_term(w)&&(w.indicator==="alias/1"&&x.type.is_atom(w.args[0])||w.indicator==="reposition/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")||w.indicator==="type/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="text"||w.args[0].id==="binary")||w.indicator==="eof_action/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="error"||w.args[0].id==="eof_code"||w.args[0].id==="reset"))},is_stream_position:function(w){return x.type.is_integer(w)&&w.value>=0||x.type.is_atom(w)&&(w.id==="end_of_stream"||w.id==="past_end_of_stream")},is_stream_property:function(w){return x.type.is_term(w)&&(w.indicator==="input/0"||w.indicator==="output/0"||w.indicator==="alias/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0]))||w.indicator==="file_name/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0]))||w.indicator==="position/1"&&(x.type.is_variable(w.args[0])||x.type.is_stream_position(w.args[0]))||w.indicator==="reposition/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false"))||w.indicator==="type/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="text"||w.args[0].id==="binary"))||w.indicator==="mode/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="read"||w.args[0].id==="write"||w.args[0].id==="append"))||w.indicator==="eof_action/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="error"||w.args[0].id==="eof_code"||w.args[0].id==="reset"))||w.indicator==="end_of_stream/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="at"||w.args[0].id==="past"||w.args[0].id==="not")))},is_streamable:function(w){return w.__proto__.stream!==void 0},is_read_option:function(w){return x.type.is_term(w)&&["variables/1","variable_names/1","singletons/1"].indexOf(w.indicator)!==-1},is_write_option:function(w){return x.type.is_term(w)&&(w.indicator==="quoted/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")||w.indicator==="ignore_ops/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")||w.indicator==="numbervars/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false"))},is_close_option:function(w){return x.type.is_term(w)&&w.indicator==="force/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")},is_modifiable_flag:function(w){return x.type.is_flag(w)&&x.flag[w.id].changeable},is_module:function(w){return w instanceof j&&w.indicator==="library/1"&&w.args[0]instanceof j&&w.args[0].args.length===0&&x.module[w.args[0].id]!==void 0}},arithmetic:{evaluation:{"e/0":{type_args:null,type_result:!0,fn:function(w){return Math.E}},"pi/0":{type_args:null,type_result:!0,fn:function(w){return Math.PI}},"tau/0":{type_args:null,type_result:!0,fn:function(w){return 2*Math.PI}},"epsilon/0":{type_args:null,type_result:!0,fn:function(w){return Number.EPSILON}},"+/1":{type_args:null,type_result:null,fn:function(w,b){return w}},"-/1":{type_args:null,type_result:null,fn:function(w,b){return-w}},"\\/1":{type_args:!1,type_result:!1,fn:function(w,b){return~w}},"abs/1":{type_args:null,type_result:null,fn:function(w,b){return Math.abs(w)}},"sign/1":{type_args:null,type_result:null,fn:function(w,b){return Math.sign(w)}},"float_integer_part/1":{type_args:!0,type_result:!1,fn:function(w,b){return parseInt(w)}},"float_fractional_part/1":{type_args:!0,type_result:!0,fn:function(w,b){return w-parseInt(w)}},"float/1":{type_args:null,type_result:!0,fn:function(w,b){return parseFloat(w)}},"floor/1":{type_args:!0,type_result:!1,fn:function(w,b){return Math.floor(w)}},"truncate/1":{type_args:!0,type_result:!1,fn:function(w,b){return parseInt(w)}},"round/1":{type_args:!0,type_result:!1,fn:function(w,b){return Math.round(w)}},"ceiling/1":{type_args:!0,type_result:!1,fn:function(w,b){return Math.ceil(w)}},"sin/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.sin(w)}},"cos/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.cos(w)}},"tan/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.tan(w)}},"asin/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.asin(w)}},"acos/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.acos(w)}},"atan/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.atan(w)}},"atan2/2":{type_args:null,type_result:!0,fn:function(w,b,y){return Math.atan2(w,b)}},"exp/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.exp(w)}},"sqrt/1":{type_args:null,type_result:!0,fn:function(w,b){return Math.sqrt(w)}},"log/1":{type_args:null,type_result:!0,fn:function(w,b){return w>0?Math.log(w):x.error.evaluation("undefined",b.__call_indicator)}},"+/2":{type_args:null,type_result:null,fn:function(w,b,y){return w+b}},"-/2":{type_args:null,type_result:null,fn:function(w,b,y){return w-b}},"*/2":{type_args:null,type_result:null,fn:function(w,b,y){return w*b}},"//2":{type_args:null,type_result:!0,fn:function(w,b,y){return b?w/b:x.error.evaluation("zero_division",y.__call_indicator)}},"///2":{type_args:!1,type_result:!1,fn:function(w,b,y){return b?parseInt(w/b):x.error.evaluation("zero_division",y.__call_indicator)}},"**/2":{type_args:null,type_result:!0,fn:function(w,b,y){return Math.pow(w,b)}},"^/2":{type_args:null,type_result:null,fn:function(w,b,y){return Math.pow(w,b)}},"<>/2":{type_args:!1,type_result:!1,fn:function(w,b,y){return w>>b}},"/\\/2":{type_args:!1,type_result:!1,fn:function(w,b,y){return w&b}},"\\//2":{type_args:!1,type_result:!1,fn:function(w,b,y){return w|b}},"xor/2":{type_args:!1,type_result:!1,fn:function(w,b,y){return w^b}},"rem/2":{type_args:!1,type_result:!1,fn:function(w,b,y){return b?w%b:x.error.evaluation("zero_division",y.__call_indicator)}},"mod/2":{type_args:!1,type_result:!1,fn:function(w,b,y){return b?w-parseInt(w/b)*b:x.error.evaluation("zero_division",y.__call_indicator)}},"max/2":{type_args:null,type_result:null,fn:function(w,b,y){return Math.max(w,b)}},"min/2":{type_args:null,type_result:null,fn:function(w,b,y){return Math.min(w,b)}}}},directive:{"dynamic/1":function(w,b){var y=b.args[0];if(x.type.is_variable(y))w.throw_error(x.error.instantiation(b.indicator));else if(!x.type.is_compound(y)||y.indicator!=="//2")w.throw_error(x.error.type("predicate_indicator",y,b.indicator));else if(x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1]))w.throw_error(x.error.instantiation(b.indicator));else if(!x.type.is_atom(y.args[0]))w.throw_error(x.error.type("atom",y.args[0],b.indicator));else if(!x.type.is_integer(y.args[1]))w.throw_error(x.error.type("integer",y.args[1],b.indicator));else{var F=b.args[0].args[0].id+"/"+b.args[0].args[1].value;w.session.public_predicates[F]=!0,w.session.rules[F]||(w.session.rules[F]=[])}},"multifile/1":function(w,b){var y=b.args[0];x.type.is_variable(y)?w.throw_error(x.error.instantiation(b.indicator)):!x.type.is_compound(y)||y.indicator!=="//2"?w.throw_error(x.error.type("predicate_indicator",y,b.indicator)):x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1])?w.throw_error(x.error.instantiation(b.indicator)):x.type.is_atom(y.args[0])?x.type.is_integer(y.args[1])?w.session.multifile_predicates[b.args[0].args[0].id+"/"+b.args[0].args[1].value]=!0:w.throw_error(x.error.type("integer",y.args[1],b.indicator)):w.throw_error(x.error.type("atom",y.args[0],b.indicator))},"set_prolog_flag/2":function(w,b){var y=b.args[0],F=b.args[1];x.type.is_variable(y)||x.type.is_variable(F)?w.throw_error(x.error.instantiation(b.indicator)):x.type.is_atom(y)?x.type.is_flag(y)?x.type.is_value_flag(y,F)?x.type.is_modifiable_flag(y)?w.session.flag[y.id]=F:w.throw_error(x.error.permission("modify","flag",y)):w.throw_error(x.error.domain("flag_value",new j("+",[y,F]),b.indicator)):w.throw_error(x.error.domain("prolog_flag",y,b.indicator)):w.throw_error(x.error.type("atom",y,b.indicator))},"use_module/1":function(w,b){var y=b.args[0];if(x.type.is_variable(y))w.throw_error(x.error.instantiation(b.indicator));else if(!x.type.is_term(y))w.throw_error(x.error.type("term",y,b.indicator));else if(x.type.is_module(y)){var F=y.args[0].id;e(w.session.modules,F)===-1&&w.session.modules.push(F)}},"char_conversion/2":function(w,b){var y=b.args[0],F=b.args[1];x.type.is_variable(y)||x.type.is_variable(F)?w.throw_error(x.error.instantiation(b.indicator)):x.type.is_character(y)?x.type.is_character(F)?y.id===F.id?delete w.session.__char_conversion[y.id]:w.session.__char_conversion[y.id]=F.id:w.throw_error(x.error.type("character",F,b.indicator)):w.throw_error(x.error.type("character",y,b.indicator))},"op/3":function(w,b){var y=b.args[0],F=b.args[1],z=b.args[2];if(x.type.is_variable(y)||x.type.is_variable(F)||x.type.is_variable(z))w.throw_error(x.error.instantiation(b.indicator));else if(!x.type.is_integer(y))w.throw_error(x.error.type("integer",y,b.indicator));else if(!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,b.indicator));else if(!x.type.is_atom(z))w.throw_error(x.error.type("atom",z,b.indicator));else if(y.value<0||y.value>1200)w.throw_error(x.error.domain("operator_priority",y,b.indicator));else if(z.id===",")w.throw_error(x.error.permission("modify","operator",z,b.indicator));else if(z.id==="|"&&(y.value<1001||F.id.length!==3))w.throw_error(x.error.permission("modify","operator",z,b.indicator));else if(["fy","fx","yf","xf","xfx","yfx","xfy"].indexOf(F.id)===-1)w.throw_error(x.error.domain("operator_specifier",F,b.indicator));else{var Z={prefix:null,infix:null,postfix:null};for(var $ in w.session.__operators)if(w.session.__operators.hasOwnProperty($)){var oe=w.session.__operators[$][z.id];oe&&(e(oe,"fx")!==-1&&(Z.prefix={priority:$,type:"fx"}),e(oe,"fy")!==-1&&(Z.prefix={priority:$,type:"fy"}),e(oe,"xf")!==-1&&(Z.postfix={priority:$,type:"xf"}),e(oe,"yf")!==-1&&(Z.postfix={priority:$,type:"yf"}),e(oe,"xfx")!==-1&&(Z.infix={priority:$,type:"xfx"}),e(oe,"xfy")!==-1&&(Z.infix={priority:$,type:"xfy"}),e(oe,"yfx")!==-1&&(Z.infix={priority:$,type:"yfx"}))}var xe;switch(F.id){case"fy":case"fx":xe="prefix";break;case"yf":case"xf":xe="postfix";break;default:xe="infix";break}if(((Z.prefix&&xe==="prefix"||Z.postfix&&xe==="postfix"||Z.infix&&xe==="infix")&&Z[xe].type!==F.id||Z.infix&&xe==="postfix"||Z.postfix&&xe==="infix")&&y.value!==0)w.throw_error(x.error.permission("create","operator",z,b.indicator));else return Z[xe]&&(we(w.session.__operators[Z[xe].priority][z.id],F.id),w.session.__operators[Z[xe].priority][z.id].length===0&&delete w.session.__operators[Z[xe].priority][z.id]),y.value>0&&(w.session.__operators[y.value]||(w.session.__operators[y.value.toString()]={}),w.session.__operators[y.value][z.id]||(w.session.__operators[y.value][z.id]=[]),w.session.__operators[y.value][z.id].push(F.id)),!0}}},predicate:{"op/3":function(w,b,y){x.directive["op/3"](w,y)&&w.success(b)},"current_op/3":function(w,b,y){var F=y.args[0],z=y.args[1],Z=y.args[2],$=[];for(var oe in w.session.__operators)for(var xe in w.session.__operators[oe])for(var Te=0;Te/2"){var F=w.points,z=w.session.format_success,Z=w.session.format_error;w.session.format_success=function(Te){return Te.substitution},w.session.format_error=function(Te){return Te.goal},w.points=[new Pe(y.args[0].args[0],b.substitution,b)];var $=function(Te){w.points=F,w.session.format_success=z,w.session.format_error=Z,Te===!1?w.prepend([new Pe(b.goal.replace(y.args[1]),b.substitution,b)]):x.type.is_error(Te)?w.throw_error(Te.args[0]):Te===null?(w.prepend([b]),w.__calls.shift()(null)):w.prepend([new Pe(b.goal.replace(y.args[0].args[1]).apply(Te),b.substitution.apply(Te),b)])};w.__calls.unshift($)}else{var oe=new Pe(b.goal.replace(y.args[0]),b.substitution,b),xe=new Pe(b.goal.replace(y.args[1]),b.substitution,b);w.prepend([oe,xe])}},"!/0":function(w,b,y){var F,z,Z=[];for(F=b,z=null;F.parent!==null&&F.parent.goal.search(y);)if(z=F,F=F.parent,F.goal!==null){var $=F.goal.select();if($&&$.id==="call"&&$.search(y)){F=z;break}}for(var oe=w.points.length-1;oe>=0;oe--){for(var xe=w.points[oe],Te=xe.parent;Te!==null&&Te!==F.parent;)Te=Te.parent;Te===null&&Te!==F.parent&&Z.push(xe)}w.points=Z.reverse(),w.success(b)},"\\+/1":function(w,b,y){var F=y.args[0];x.type.is_variable(F)?w.throw_error(x.error.instantiation(w.level)):x.type.is_callable(F)?w.prepend([new Pe(b.goal.replace(new j(",",[new j(",",[new j("call",[F]),new j("!",[])]),new j("fail",[])])),b.substitution,b),new Pe(b.goal.replace(null),b.substitution,b)]):w.throw_error(x.error.type("callable",F,w.level))},"->/2":function(w,b,y){var F=b.goal.replace(new j(",",[y.args[0],new j(",",[new j("!"),y.args[1]])]));w.prepend([new Pe(F,b.substitution,b)])},"fail/0":function(w,b,y){},"false/0":function(w,b,y){},"true/0":function(w,b,y){w.success(b)},"call/1":se(1),"call/2":se(2),"call/3":se(3),"call/4":se(4),"call/5":se(5),"call/6":se(6),"call/7":se(7),"call/8":se(8),"once/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("call",[F]),new j("!",[])])),b.substitution,b)])},"forall/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j("\\+",[new j(",",[new j("call",[F]),new j("\\+",[new j("call",[z])])])])),b.substitution,b)])},"repeat/0":function(w,b,y){w.prepend([new Pe(b.goal.replace(null),b.substitution,b),b])},"throw/1":function(w,b,y){x.type.is_variable(y.args[0])?w.throw_error(x.error.instantiation(w.level)):w.throw_error(y.args[0])},"catch/3":function(w,b,y){var F=w.points;w.points=[],w.prepend([new Pe(y.args[0],b.substitution,b)]);var z=w.session.format_success,Z=w.session.format_error;w.session.format_success=function(oe){return oe.substitution},w.session.format_error=function(oe){return oe.goal};var $=function(oe){var xe=w.points;if(w.points=F,w.session.format_success=z,w.session.format_error=Z,x.type.is_error(oe)){for(var Te=[],lt=w.points.length-1;lt>=0;lt--){for(var ir=w.points[lt],Et=ir.parent;Et!==null&&Et!==b.parent;)Et=Et.parent;Et===null&&Et!==b.parent&&Te.push(ir)}w.points=Te;var qt=w.get_flag("occurs_check").indicator==="true/0",ir=new Pe,Pt=x.unify(oe.args[0],y.args[1],qt);Pt!==null?(ir.substitution=b.substitution.apply(Pt),ir.goal=b.goal.replace(y.args[2]).apply(Pt),ir.parent=b,w.prepend([ir])):w.throw_error(oe.args[0])}else if(oe!==!1){for(var gn=oe===null?[]:[new Pe(b.goal.apply(oe).replace(null),b.substitution.apply(oe),b)],Pr=[],lt=xe.length-1;lt>=0;lt--){Pr.push(xe[lt]);var Ir=xe[lt].goal!==null?xe[lt].goal.select():null;if(x.type.is_term(Ir)&&Ir.indicator==="!/0")break}var Nr=s(Pr,function(nn){return nn.goal===null&&(nn.goal=new j("true",[])),nn=new Pe(b.goal.replace(new j("catch",[nn.goal,y.args[1],y.args[2]])),b.substitution.apply(nn.substitution),nn.parent),nn.exclude=y.args[0].variables(),nn}).reverse();w.prepend(Nr),w.prepend(gn),oe===null&&(this.current_limit=0,w.__calls.shift()(null))}};w.__calls.unshift($)},"=/2":function(w,b,y){var F=w.get_flag("occurs_check").indicator==="true/0",z=new Pe,Z=x.unify(y.args[0],y.args[1],F);Z!==null&&(z.goal=b.goal.apply(Z).replace(null),z.substitution=b.substitution.apply(Z),z.parent=b,w.prepend([z]))},"unify_with_occurs_check/2":function(w,b,y){var F=new Pe,z=x.unify(y.args[0],y.args[1],!0);z!==null&&(F.goal=b.goal.apply(z).replace(null),F.substitution=b.substitution.apply(z),F.parent=b,w.prepend([F]))},"\\=/2":function(w,b,y){var F=w.get_flag("occurs_check").indicator==="true/0",z=x.unify(y.args[0],y.args[1],F);z===null&&w.success(b)},"subsumes_term/2":function(w,b,y){var F=w.get_flag("occurs_check").indicator==="true/0",z=x.unify(y.args[1],y.args[0],F);z!==null&&y.args[1].apply(z).equals(y.args[1])&&w.success(b)},"findall/3":function(w,b,y){var F=y.args[0],z=y.args[1],Z=y.args[2];if(x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(z))w.throw_error(x.error.type("callable",z,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_list(Z))w.throw_error(x.error.type("list",Z,y.indicator));else{var $=w.next_free_variable(),oe=new j(",",[z,new j("=",[$,F])]),xe=w.points,Te=w.session.limit,lt=w.session.format_success;w.session.format_success=function(ir){return ir.substitution},w.add_goal(oe,!0,b);var Et=[],qt=function(ir){if(ir!==!1&&ir!==null&&!x.type.is_error(ir))w.__calls.unshift(qt),Et.push(ir.links[$.id]),w.session.limit=w.current_limit;else if(w.points=xe,w.session.limit=Te,w.session.format_success=lt,x.type.is_error(ir))w.throw_error(ir.args[0]);else if(w.current_limit>0){for(var Pt=new j("[]"),gn=Et.length-1;gn>=0;gn--)Pt=new j(".",[Et[gn],Pt]);w.prepend([new Pe(b.goal.replace(new j("=",[Z,Pt])),b.substitution,b)])}};w.__calls.unshift(qt)}},"bagof/3":function(w,b,y){var F,z=y.args[0],Z=y.args[1],$=y.args[2];if(x.type.is_variable(Z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(Z))w.throw_error(x.error.type("callable",Z,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_list($))w.throw_error(x.error.type("list",$,y.indicator));else{var oe=w.next_free_variable(),xe;Z.indicator==="^/2"?(xe=Z.args[0].variables(),Z=Z.args[1]):xe=[],xe=xe.concat(z.variables());for(var Te=Z.variables().filter(function(Nr){return e(xe,Nr)===-1}),lt=new j("[]"),Et=Te.length-1;Et>=0;Et--)lt=new j(".",[new De(Te[Et]),lt]);var qt=new j(",",[Z,new j("=",[oe,new j(",",[lt,z])])]),ir=w.points,Pt=w.session.limit,gn=w.session.format_success;w.session.format_success=function(Nr){return Nr.substitution},w.add_goal(qt,!0,b);var Pr=[],Ir=function(Nr){if(Nr!==!1&&Nr!==null&&!x.type.is_error(Nr)){w.__calls.unshift(Ir);var nn=!1,oi=Nr.links[oe.id].args[0],wo=Nr.links[oe.id].args[1];for(var rs in Pr)if(Pr.hasOwnProperty(rs)){var eo=Pr[rs];if(eo.variables.equals(oi)){eo.answers.push(wo),nn=!0;break}}nn||Pr.push({variables:oi,answers:[wo]}),w.session.limit=w.current_limit}else if(w.points=ir,w.session.limit=Pt,w.session.format_success=gn,x.type.is_error(Nr))w.throw_error(Nr.args[0]);else if(w.current_limit>0){for(var Bo=[],Hi=0;Hi=0;vo--)to=new j(".",[Nr[vo],to]);Bo.push(new Pe(b.goal.replace(new j(",",[new j("=",[lt,Pr[Hi].variables]),new j("=",[$,to])])),b.substitution,b))}w.prepend(Bo)}};w.__calls.unshift(Ir)}},"setof/3":function(w,b,y){var F,z=y.args[0],Z=y.args[1],$=y.args[2];if(x.type.is_variable(Z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(Z))w.throw_error(x.error.type("callable",Z,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_list($))w.throw_error(x.error.type("list",$,y.indicator));else{var oe=w.next_free_variable(),xe;Z.indicator==="^/2"?(xe=Z.args[0].variables(),Z=Z.args[1]):xe=[],xe=xe.concat(z.variables());for(var Te=Z.variables().filter(function(Nr){return e(xe,Nr)===-1}),lt=new j("[]"),Et=Te.length-1;Et>=0;Et--)lt=new j(".",[new De(Te[Et]),lt]);var qt=new j(",",[Z,new j("=",[oe,new j(",",[lt,z])])]),ir=w.points,Pt=w.session.limit,gn=w.session.format_success;w.session.format_success=function(Nr){return Nr.substitution},w.add_goal(qt,!0,b);var Pr=[],Ir=function(Nr){if(Nr!==!1&&Nr!==null&&!x.type.is_error(Nr)){w.__calls.unshift(Ir);var nn=!1,oi=Nr.links[oe.id].args[0],wo=Nr.links[oe.id].args[1];for(var rs in Pr)if(Pr.hasOwnProperty(rs)){var eo=Pr[rs];if(eo.variables.equals(oi)){eo.answers.push(wo),nn=!0;break}}nn||Pr.push({variables:oi,answers:[wo]}),w.session.limit=w.current_limit}else if(w.points=ir,w.session.limit=Pt,w.session.format_success=gn,x.type.is_error(Nr))w.throw_error(Nr.args[0]);else if(w.current_limit>0){for(var Bo=[],Hi=0;Hi=0;vo--)to=new j(".",[Nr[vo],to]);Bo.push(new Pe(b.goal.replace(new j(",",[new j("=",[lt,Pr[Hi].variables]),new j("=",[$,to])])),b.substitution,b))}w.prepend(Bo)}};w.__calls.unshift(Ir)}},"functor/3":function(w,b,y){var F,z=y.args[0],Z=y.args[1],$=y.args[2];if(x.type.is_variable(z)&&(x.type.is_variable(Z)||x.type.is_variable($)))w.throw_error(x.error.instantiation("functor/3"));else if(!x.type.is_variable($)&&!x.type.is_integer($))w.throw_error(x.error.type("integer",y.args[2],"functor/3"));else if(!x.type.is_variable(Z)&&!x.type.is_atomic(Z))w.throw_error(x.error.type("atomic",y.args[1],"functor/3"));else if(x.type.is_integer(Z)&&x.type.is_integer($)&&$.value!==0)w.throw_error(x.error.type("atom",y.args[1],"functor/3"));else if(x.type.is_variable(z)){if(y.args[2].value>=0){for(var oe=[],xe=0;xe<$.value;xe++)oe.push(w.next_free_variable());var Te=x.type.is_integer(Z)?Z:new j(Z.id,oe);w.prepend([new Pe(b.goal.replace(new j("=",[z,Te])),b.substitution,b)])}}else{var lt=x.type.is_integer(z)?z:new j(z.id,[]),Et=x.type.is_integer(z)?new Re(0,!1):new Re(z.args.length,!1),qt=new j(",",[new j("=",[lt,Z]),new j("=",[Et,$])]);w.prepend([new Pe(b.goal.replace(qt),b.substitution,b)])}},"arg/3":function(w,b,y){if(x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1]))w.throw_error(x.error.instantiation(y.indicator));else if(y.args[0].value<0)w.throw_error(x.error.domain("not_less_than_zero",y.args[0],y.indicator));else if(!x.type.is_compound(y.args[1]))w.throw_error(x.error.type("compound",y.args[1],y.indicator));else{var F=y.args[0].value;if(F>0&&F<=y.args[1].args.length){var z=new j("=",[y.args[1].args[F-1],y.args[2]]);w.prepend([new Pe(b.goal.replace(z),b.substitution,b)])}}},"=../2":function(w,b,y){var F;if(x.type.is_variable(y.args[0])&&(x.type.is_variable(y.args[1])||x.type.is_non_empty_list(y.args[1])&&x.type.is_variable(y.args[1].args[0])))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_fully_list(y.args[1]))w.throw_error(x.error.type("list",y.args[1],y.indicator));else if(x.type.is_variable(y.args[0])){if(!x.type.is_variable(y.args[1])){var Z=[];for(F=y.args[1].args[1];F.indicator==="./2";)Z.push(F.args[0]),F=F.args[1];x.type.is_variable(y.args[0])&&x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):Z.length===0&&x.type.is_compound(y.args[1].args[0])?w.throw_error(x.error.type("atomic",y.args[1].args[0],y.indicator)):Z.length>0&&(x.type.is_compound(y.args[1].args[0])||x.type.is_number(y.args[1].args[0]))?w.throw_error(x.error.type("atom",y.args[1].args[0],y.indicator)):Z.length===0?w.prepend([new Pe(b.goal.replace(new j("=",[y.args[1].args[0],y.args[0]],b)),b.substitution,b)]):w.prepend([new Pe(b.goal.replace(new j("=",[new j(y.args[1].args[0].id,Z),y.args[0]])),b.substitution,b)])}}else{if(x.type.is_atomic(y.args[0]))F=new j(".",[y.args[0],new j("[]")]);else{F=new j("[]");for(var z=y.args[0].args.length-1;z>=0;z--)F=new j(".",[y.args[0].args[z],F]);F=new j(".",[new j(y.args[0].id),F])}w.prepend([new Pe(b.goal.replace(new j("=",[F,y.args[1]])),b.substitution,b)])}},"copy_term/2":function(w,b,y){var F=y.args[0].rename(w);w.prepend([new Pe(b.goal.replace(new j("=",[F,y.args[1]])),b.substitution,b.parent)])},"term_variables/2":function(w,b,y){var F=y.args[0],z=y.args[1];if(!x.type.is_fully_list(z))w.throw_error(x.error.type("list",z,y.indicator));else{var Z=g(s(Ee(F.variables()),function($){return new De($)}));w.prepend([new Pe(b.goal.replace(new j("=",[z,Z])),b.substitution,b)])}},"clause/2":function(w,b,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else if(!x.type.is_variable(y.args[1])&&!x.type.is_callable(y.args[1]))w.throw_error(x.error.type("callable",y.args[1],y.indicator));else if(w.session.rules[y.args[0].indicator]!==void 0)if(w.is_public_predicate(y.args[0].indicator)){var F=[];for(var z in w.session.rules[y.args[0].indicator])if(w.session.rules[y.args[0].indicator].hasOwnProperty(z)){var Z=w.session.rules[y.args[0].indicator][z];w.session.renamed_variables={},Z=Z.rename(w),Z.body===null&&(Z.body=new j("true"));var $=new j(",",[new j("=",[Z.head,y.args[0]]),new j("=",[Z.body,y.args[1]])]);F.push(new Pe(b.goal.replace($),b.substitution,b))}w.prepend(F)}else w.throw_error(x.error.permission("access","private_procedure",y.args[0].indicator,y.indicator))},"current_predicate/1":function(w,b,y){var F=y.args[0];if(!x.type.is_variable(F)&&(!x.type.is_compound(F)||F.indicator!=="//2"))w.throw_error(x.error.type("predicate_indicator",F,y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_variable(F.args[0])&&!x.type.is_atom(F.args[0]))w.throw_error(x.error.type("atom",F.args[0],y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_variable(F.args[1])&&!x.type.is_integer(F.args[1]))w.throw_error(x.error.type("integer",F.args[1],y.indicator));else{var z=[];for(var Z in w.session.rules)if(w.session.rules.hasOwnProperty(Z)){var $=Z.lastIndexOf("/"),oe=Z.substr(0,$),xe=parseInt(Z.substr($+1,Z.length-($+1))),Te=new j("/",[new j(oe),new Re(xe,!1)]),lt=new j("=",[Te,F]);z.push(new Pe(b.goal.replace(lt),b.substitution,b))}w.prepend(z)}},"asserta/1":function(w,b,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var F,z;y.args[0].indicator===":-/2"?(F=y.args[0].args[0],z=Ce(y.args[0].args[1])):(F=y.args[0],z=null),x.type.is_callable(F)?z!==null&&!x.type.is_callable(z)?w.throw_error(x.error.type("callable",z,y.indicator)):w.is_public_predicate(F.indicator)?(w.session.rules[F.indicator]===void 0&&(w.session.rules[F.indicator]=[]),w.session.public_predicates[F.indicator]=!0,w.session.rules[F.indicator]=[new Ye(F,z,!0)].concat(w.session.rules[F.indicator]),w.success(b)):w.throw_error(x.error.permission("modify","static_procedure",F.indicator,y.indicator)):w.throw_error(x.error.type("callable",F,y.indicator))}},"assertz/1":function(w,b,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var F,z;y.args[0].indicator===":-/2"?(F=y.args[0].args[0],z=Ce(y.args[0].args[1])):(F=y.args[0],z=null),x.type.is_callable(F)?z!==null&&!x.type.is_callable(z)?w.throw_error(x.error.type("callable",z,y.indicator)):w.is_public_predicate(F.indicator)?(w.session.rules[F.indicator]===void 0&&(w.session.rules[F.indicator]=[]),w.session.public_predicates[F.indicator]=!0,w.session.rules[F.indicator].push(new Ye(F,z,!0)),w.success(b)):w.throw_error(x.error.permission("modify","static_procedure",F.indicator,y.indicator)):w.throw_error(x.error.type("callable",F,y.indicator))}},"retract/1":function(w,b,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var F,z;if(y.args[0].indicator===":-/2"?(F=y.args[0].args[0],z=y.args[0].args[1]):(F=y.args[0],z=new j("true")),typeof b.retract>"u")if(w.is_public_predicate(F.indicator)){if(w.session.rules[F.indicator]!==void 0){for(var Z=[],$=0;$w.get_flag("max_arity").value)w.throw_error(x.error.representation("max_arity",y.indicator));else{var F=y.args[0].args[0].id+"/"+y.args[0].args[1].value;w.is_public_predicate(F)?(delete w.session.rules[F],w.success(b)):w.throw_error(x.error.permission("modify","static_procedure",F,y.indicator))}},"atom_length/2":function(w,b,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_atom(y.args[0]))w.throw_error(x.error.type("atom",y.args[0],y.indicator));else if(!x.type.is_variable(y.args[1])&&!x.type.is_integer(y.args[1]))w.throw_error(x.error.type("integer",y.args[1],y.indicator));else if(x.type.is_integer(y.args[1])&&y.args[1].value<0)w.throw_error(x.error.domain("not_less_than_zero",y.args[1],y.indicator));else{var F=new Re(y.args[0].id.length,!1);w.prepend([new Pe(b.goal.replace(new j("=",[F,y.args[1]])),b.substitution,b)])}},"atom_concat/3":function(w,b,y){var F,z,Z=y.args[0],$=y.args[1],oe=y.args[2];if(x.type.is_variable(oe)&&(x.type.is_variable(Z)||x.type.is_variable($)))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_atom(Z))w.throw_error(x.error.type("atom",Z,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_atom($))w.throw_error(x.error.type("atom",$,y.indicator));else if(!x.type.is_variable(oe)&&!x.type.is_atom(oe))w.throw_error(x.error.type("atom",oe,y.indicator));else{var xe=x.type.is_variable(Z),Te=x.type.is_variable($);if(!xe&&!Te)z=new j("=",[oe,new j(Z.id+$.id)]),w.prepend([new Pe(b.goal.replace(z),b.substitution,b)]);else if(xe&&!Te)F=oe.id.substr(0,oe.id.length-$.id.length),F+$.id===oe.id&&(z=new j("=",[Z,new j(F)]),w.prepend([new Pe(b.goal.replace(z),b.substitution,b)]));else if(Te&&!xe)F=oe.id.substr(Z.id.length),Z.id+F===oe.id&&(z=new j("=",[$,new j(F)]),w.prepend([new Pe(b.goal.replace(z),b.substitution,b)]));else{for(var lt=[],Et=0;Et<=oe.id.length;Et++){var qt=new j(oe.id.substr(0,Et)),ir=new j(oe.id.substr(Et));z=new j(",",[new j("=",[qt,Z]),new j("=",[ir,$])]),lt.push(new Pe(b.goal.replace(z),b.substitution,b))}w.prepend(lt)}}},"sub_atom/5":function(w,b,y){var F,z=y.args[0],Z=y.args[1],$=y.args[2],oe=y.args[3],xe=y.args[4];if(x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_integer(Z))w.throw_error(x.error.type("integer",Z,y.indicator));else if(!x.type.is_variable($)&&!x.type.is_integer($))w.throw_error(x.error.type("integer",$,y.indicator));else if(!x.type.is_variable(oe)&&!x.type.is_integer(oe))w.throw_error(x.error.type("integer",oe,y.indicator));else if(x.type.is_integer(Z)&&Z.value<0)w.throw_error(x.error.domain("not_less_than_zero",Z,y.indicator));else if(x.type.is_integer($)&&$.value<0)w.throw_error(x.error.domain("not_less_than_zero",$,y.indicator));else if(x.type.is_integer(oe)&&oe.value<0)w.throw_error(x.error.domain("not_less_than_zero",oe,y.indicator));else{var Te=[],lt=[],Et=[];if(x.type.is_variable(Z))for(F=0;F<=z.id.length;F++)Te.push(F);else Te.push(Z.value);if(x.type.is_variable($))for(F=0;F<=z.id.length;F++)lt.push(F);else lt.push($.value);if(x.type.is_variable(oe))for(F=0;F<=z.id.length;F++)Et.push(F);else Et.push(oe.value);var qt=[];for(var ir in Te)if(Te.hasOwnProperty(ir)){F=Te[ir];for(var Pt in lt)if(lt.hasOwnProperty(Pt)){var gn=lt[Pt],Pr=z.id.length-F-gn;if(e(Et,Pr)!==-1&&F+gn+Pr===z.id.length){var Ir=z.id.substr(F,gn);if(z.id===z.id.substr(0,F)+Ir+z.id.substr(F+gn,Pr)){var Nr=new j("=",[new j(Ir),xe]),nn=new j("=",[Z,new Re(F)]),oi=new j("=",[$,new Re(gn)]),wo=new j("=",[oe,new Re(Pr)]),rs=new j(",",[new j(",",[new j(",",[nn,oi]),wo]),Nr]);qt.push(new Pe(b.goal.replace(rs),b.substitution,b))}}}}w.prepend(qt)}},"atom_chars/2":function(w,b,y){var F=y.args[0],z=y.args[1];if(x.type.is_variable(F)&&x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(x.type.is_variable(F)){for(var oe=z,xe=x.type.is_variable(F),Te="";oe.indicator==="./2";){if(x.type.is_character(oe.args[0]))Te+=oe.args[0].id;else if(x.type.is_variable(oe.args[0])&&xe){w.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_variable(oe.args[0])){w.throw_error(x.error.type("character",oe.args[0],y.indicator));return}oe=oe.args[1]}x.type.is_variable(oe)&&xe?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_empty_list(oe)&&!x.type.is_variable(oe)?w.throw_error(x.error.type("list",z,y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[new j(Te),F])),b.substitution,b)])}else{for(var Z=new j("[]"),$=F.id.length-1;$>=0;$--)Z=new j(".",[new j(F.id.charAt($)),Z]);w.prepend([new Pe(b.goal.replace(new j("=",[z,Z])),b.substitution,b)])}},"atom_codes/2":function(w,b,y){var F=y.args[0],z=y.args[1];if(x.type.is_variable(F)&&x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(x.type.is_variable(F)){for(var oe=z,xe=x.type.is_variable(F),Te="";oe.indicator==="./2";){if(x.type.is_character_code(oe.args[0]))Te+=c(oe.args[0].value);else if(x.type.is_variable(oe.args[0])&&xe){w.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_variable(oe.args[0])){w.throw_error(x.error.representation("character_code",y.indicator));return}oe=oe.args[1]}x.type.is_variable(oe)&&xe?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_empty_list(oe)&&!x.type.is_variable(oe)?w.throw_error(x.error.type("list",z,y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[new j(Te),F])),b.substitution,b)])}else{for(var Z=new j("[]"),$=F.id.length-1;$>=0;$--)Z=new j(".",[new Re(n(F.id,$),!1),Z]);w.prepend([new Pe(b.goal.replace(new j("=",[z,Z])),b.substitution,b)])}},"char_code/2":function(w,b,y){var F=y.args[0],z=y.args[1];if(x.type.is_variable(F)&&x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_character(F))w.throw_error(x.error.type("character",F,y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_integer(z))w.throw_error(x.error.type("integer",z,y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_character_code(z))w.throw_error(x.error.representation("character_code",y.indicator));else if(x.type.is_variable(z)){var Z=new Re(n(F.id,0),!1);w.prepend([new Pe(b.goal.replace(new j("=",[Z,z])),b.substitution,b)])}else{var $=new j(c(z.value));w.prepend([new Pe(b.goal.replace(new j("=",[$,F])),b.substitution,b)])}},"number_chars/2":function(w,b,y){var F,z=y.args[0],Z=y.args[1];if(x.type.is_variable(z)&&x.type.is_variable(Z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_number(z))w.throw_error(x.error.type("number",z,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_list(Z))w.throw_error(x.error.type("list",Z,y.indicator));else{var $=x.type.is_variable(z);if(!x.type.is_variable(Z)){var oe=Z,xe=!0;for(F="";oe.indicator==="./2";){if(x.type.is_character(oe.args[0]))F+=oe.args[0].id;else if(x.type.is_variable(oe.args[0]))xe=!1;else if(!x.type.is_variable(oe.args[0])){w.throw_error(x.error.type("character",oe.args[0],y.indicator));return}oe=oe.args[1]}if(xe=xe&&x.type.is_empty_list(oe),!x.type.is_empty_list(oe)&&!x.type.is_variable(oe)){w.throw_error(x.error.type("list",Z,y.indicator));return}if(!xe&&$){w.throw_error(x.error.instantiation(y.indicator));return}else if(xe)if(x.type.is_variable(oe)&&$){w.throw_error(x.error.instantiation(y.indicator));return}else{var Te=w.parse(F),lt=Te.value;!x.type.is_number(lt)||Te.tokens[Te.tokens.length-1].space?w.throw_error(x.error.syntax_by_predicate("parseable_number",y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[z,lt])),b.substitution,b)]);return}}if(!$){F=z.toString();for(var Et=new j("[]"),qt=F.length-1;qt>=0;qt--)Et=new j(".",[new j(F.charAt(qt)),Et]);w.prepend([new Pe(b.goal.replace(new j("=",[Z,Et])),b.substitution,b)])}}},"number_codes/2":function(w,b,y){var F,z=y.args[0],Z=y.args[1];if(x.type.is_variable(z)&&x.type.is_variable(Z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_number(z))w.throw_error(x.error.type("number",z,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_list(Z))w.throw_error(x.error.type("list",Z,y.indicator));else{var $=x.type.is_variable(z);if(!x.type.is_variable(Z)){var oe=Z,xe=!0;for(F="";oe.indicator==="./2";){if(x.type.is_character_code(oe.args[0]))F+=c(oe.args[0].value);else if(x.type.is_variable(oe.args[0]))xe=!1;else if(!x.type.is_variable(oe.args[0])){w.throw_error(x.error.type("character_code",oe.args[0],y.indicator));return}oe=oe.args[1]}if(xe=xe&&x.type.is_empty_list(oe),!x.type.is_empty_list(oe)&&!x.type.is_variable(oe)){w.throw_error(x.error.type("list",Z,y.indicator));return}if(!xe&&$){w.throw_error(x.error.instantiation(y.indicator));return}else if(xe)if(x.type.is_variable(oe)&&$){w.throw_error(x.error.instantiation(y.indicator));return}else{var Te=w.parse(F),lt=Te.value;!x.type.is_number(lt)||Te.tokens[Te.tokens.length-1].space?w.throw_error(x.error.syntax_by_predicate("parseable_number",y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[z,lt])),b.substitution,b)]);return}}if(!$){F=z.toString();for(var Et=new j("[]"),qt=F.length-1;qt>=0;qt--)Et=new j(".",[new Re(n(F,qt),!1),Et]);w.prepend([new Pe(b.goal.replace(new j("=",[Z,Et])),b.substitution,b)])}}},"upcase_atom/2":function(w,b,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(F)?!x.type.is_variable(z)&&!x.type.is_atom(z)?w.throw_error(x.error.type("atom",z,y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[z,new j(F.id.toUpperCase(),[])])),b.substitution,b)]):w.throw_error(x.error.type("atom",F,y.indicator))},"downcase_atom/2":function(w,b,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(F)?!x.type.is_variable(z)&&!x.type.is_atom(z)?w.throw_error(x.error.type("atom",z,y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[z,new j(F.id.toLowerCase(),[])])),b.substitution,b)]):w.throw_error(x.error.type("atom",F,y.indicator))},"atomic_list_concat/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j("atomic_list_concat",[F,new j("",[]),z])),b.substitution,b)])},"atomic_list_concat/3":function(w,b,y){var F=y.args[0],z=y.args[1],Z=y.args[2];if(x.type.is_variable(z)||x.type.is_variable(F)&&x.type.is_variable(Z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_list(F))w.throw_error(x.error.type("list",F,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_atom(Z))w.throw_error(x.error.type("atom",Z,y.indicator));else if(x.type.is_variable(Z)){for(var oe="",xe=F;x.type.is_term(xe)&&xe.indicator==="./2";){if(!x.type.is_atom(xe.args[0])&&!x.type.is_number(xe.args[0])){w.throw_error(x.error.type("atomic",xe.args[0],y.indicator));return}oe!==""&&(oe+=z.id),x.type.is_atom(xe.args[0])?oe+=xe.args[0].id:oe+=""+xe.args[0].value,xe=xe.args[1]}oe=new j(oe,[]),x.type.is_variable(xe)?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_term(xe)||xe.indicator!=="[]/0"?w.throw_error(x.error.type("list",F,y.indicator)):w.prepend([new Pe(b.goal.replace(new j("=",[oe,Z])),b.substitution,b)])}else{var $=g(s(Z.id.split(z.id),function(Te){return new j(Te,[])}));w.prepend([new Pe(b.goal.replace(new j("=",[$,F])),b.substitution,b)])}},"@=/2":function(w,b,y){x.compare(y.args[0],y.args[1])>0&&w.success(b)},"@>=/2":function(w,b,y){x.compare(y.args[0],y.args[1])>=0&&w.success(b)},"compare/3":function(w,b,y){var F=y.args[0],z=y.args[1],Z=y.args[2];if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(x.type.is_atom(F)&&["<",">","="].indexOf(F.id)===-1)w.throw_error(x.type.domain("order",F,y.indicator));else{var $=x.compare(z,Z);$=$===0?"=":$===-1?"<":">",w.prepend([new Pe(b.goal.replace(new j("=",[F,new j($,[])])),b.substitution,b)])}},"is/2":function(w,b,y){var F=y.args[1].interpret(w);x.type.is_number(F)?w.prepend([new Pe(b.goal.replace(new j("=",[y.args[0],F],w.level)),b.substitution,b)]):w.throw_error(F)},"between/3":function(w,b,y){var F=y.args[0],z=y.args[1],Z=y.args[2];if(x.type.is_variable(F)||x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_integer(F))w.throw_error(x.error.type("integer",F,y.indicator));else if(!x.type.is_integer(z))w.throw_error(x.error.type("integer",z,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_integer(Z))w.throw_error(x.error.type("integer",Z,y.indicator));else if(x.type.is_variable(Z)){var $=[new Pe(b.goal.replace(new j("=",[Z,F])),b.substitution,b)];F.value=Z.value&&w.success(b)},"succ/2":function(w,b,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)&&x.type.is_variable(z)?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_variable(F)&&!x.type.is_integer(F)?w.throw_error(x.error.type("integer",F,y.indicator)):!x.type.is_variable(z)&&!x.type.is_integer(z)?w.throw_error(x.error.type("integer",z,y.indicator)):!x.type.is_variable(F)&&F.value<0?w.throw_error(x.error.domain("not_less_than_zero",F,y.indicator)):!x.type.is_variable(z)&&z.value<0?w.throw_error(x.error.domain("not_less_than_zero",z,y.indicator)):(x.type.is_variable(z)||z.value>0)&&(x.type.is_variable(F)?w.prepend([new Pe(b.goal.replace(new j("=",[F,new Re(z.value-1,!1)])),b.substitution,b)]):w.prepend([new Pe(b.goal.replace(new j("=",[z,new Re(F.value+1,!1)])),b.substitution,b)]))},"=:=/2":function(w,b,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F===0&&w.success(b)},"=\\=/2":function(w,b,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F!==0&&w.success(b)},"/2":function(w,b,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F>0&&w.success(b)},">=/2":function(w,b,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F>=0&&w.success(b)},"var/1":function(w,b,y){x.type.is_variable(y.args[0])&&w.success(b)},"atom/1":function(w,b,y){x.type.is_atom(y.args[0])&&w.success(b)},"atomic/1":function(w,b,y){x.type.is_atomic(y.args[0])&&w.success(b)},"compound/1":function(w,b,y){x.type.is_compound(y.args[0])&&w.success(b)},"integer/1":function(w,b,y){x.type.is_integer(y.args[0])&&w.success(b)},"float/1":function(w,b,y){x.type.is_float(y.args[0])&&w.success(b)},"number/1":function(w,b,y){x.type.is_number(y.args[0])&&w.success(b)},"nonvar/1":function(w,b,y){x.type.is_variable(y.args[0])||w.success(b)},"ground/1":function(w,b,y){y.variables().length===0&&w.success(b)},"acyclic_term/1":function(w,b,y){for(var F=b.substitution.apply(b.substitution),z=y.args[0].variables(),Z=0;Z0?Pt[Pt.length-1]:null,Pt!==null&&(qt=W(w,Pt,0,w.__get_max_priority(),!1))}if(qt.type===p&&qt.len===Pt.length-1&&gn.value==="."){qt=qt.value.rename(w);var Pr=new j("=",[z,qt]);if(oe.variables){var Ir=g(s(Ee(qt.variables()),function(Nr){return new De(Nr)}));Pr=new j(",",[Pr,new j("=",[oe.variables,Ir])])}if(oe.variable_names){var Ir=g(s(Ee(qt.variables()),function(nn){var oi;for(oi in w.session.renamed_variables)if(w.session.renamed_variables.hasOwnProperty(oi)&&w.session.renamed_variables[oi]===nn)break;return new j("=",[new j(oi,[]),new De(nn)])}));Pr=new j(",",[Pr,new j("=",[oe.variable_names,Ir])])}if(oe.singletons){var Ir=g(s(new Ye(qt,null).singleton_variables(),function(nn){var oi;for(oi in w.session.renamed_variables)if(w.session.renamed_variables.hasOwnProperty(oi)&&w.session.renamed_variables[oi]===nn)break;return new j("=",[new j(oi,[]),new De(nn)])}));Pr=new j(",",[Pr,new j("=",[oe.singletons,Ir])])}w.prepend([new Pe(b.goal.replace(Pr),b.substitution,b)])}else qt.type===p?w.throw_error(x.error.syntax(Pt[qt.len],"unexpected token",!1)):w.throw_error(qt.value)}}},"write/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_output",[new De("S")]),new j("write",[new De("S"),F])])),b.substitution,b)])},"write/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j("write_term",[F,z,new j(".",[new j("quoted",[new j("false",[])]),new j(".",[new j("ignore_ops",[new j("false")]),new j(".",[new j("numbervars",[new j("true")]),new j("[]",[])])])])])),b.substitution,b)])},"writeq/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_output",[new De("S")]),new j("writeq",[new De("S"),F])])),b.substitution,b)])},"writeq/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j("write_term",[F,z,new j(".",[new j("quoted",[new j("true",[])]),new j(".",[new j("ignore_ops",[new j("false")]),new j(".",[new j("numbervars",[new j("true")]),new j("[]",[])])])])])),b.substitution,b)])},"write_canonical/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_output",[new De("S")]),new j("write_canonical",[new De("S"),F])])),b.substitution,b)])},"write_canonical/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j("write_term",[F,z,new j(".",[new j("quoted",[new j("true",[])]),new j(".",[new j("ignore_ops",[new j("true")]),new j(".",[new j("numbervars",[new j("false")]),new j("[]",[])])])])])),b.substitution,b)])},"write_term/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_output",[new De("S")]),new j("write_term",[new De("S"),F,z])])),b.substitution,b)])},"write_term/3":function(w,b,y){var F=y.args[0],z=y.args[1],Z=y.args[2],$=x.type.is_stream(F)?F:w.get_stream_by_alias(F.id);if(x.type.is_variable(F)||x.type.is_variable(Z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_list(Z))w.throw_error(x.error.type("list",Z,y.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))w.throw_error(x.error.domain("stream_or_alias",F,y.indicator));else if(!x.type.is_stream($)||$.stream===null)w.throw_error(x.error.existence("stream",F,y.indicator));else if($.input)w.throw_error(x.error.permission("output","stream",F,y.indicator));else if($.type==="binary")w.throw_error(x.error.permission("output","binary_stream",F,y.indicator));else if($.position==="past_end_of_stream"&&$.eof_action==="error")w.throw_error(x.error.permission("output","past_end_of_stream",F,y.indicator));else{for(var oe={},xe=Z,Te;x.type.is_term(xe)&&xe.indicator==="./2";){if(Te=xe.args[0],x.type.is_variable(Te)){w.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_write_option(Te)){w.throw_error(x.error.domain("write_option",Te,y.indicator));return}oe[Te.id]=Te.args[0].id==="true",xe=xe.args[1]}if(xe.indicator!=="[]/0"){x.type.is_variable(xe)?w.throw_error(x.error.instantiation(y.indicator)):w.throw_error(x.error.type("list",Z,y.indicator));return}else{oe.session=w.session;var lt=z.toString(oe);$.stream.put(lt,$.position),typeof $.position=="number"&&($.position+=lt.length),w.success(b)}}},"halt/0":function(w,b,y){w.points=[]},"halt/1":function(w,b,y){var F=y.args[0];x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_integer(F)?w.points=[]:w.throw_error(x.error.type("integer",F,y.indicator))},"current_prolog_flag/2":function(w,b,y){var F=y.args[0],z=y.args[1];if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_flag(F))w.throw_error(x.error.domain("prolog_flag",F,y.indicator));else{var Z=[];for(var $ in x.flag)if(x.flag.hasOwnProperty($)){var oe=new j(",",[new j("=",[new j($),F]),new j("=",[w.get_flag($),z])]);Z.push(new Pe(b.goal.replace(oe),b.substitution,b))}w.prepend(Z)}},"set_prolog_flag/2":function(w,b,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)||x.type.is_variable(z)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(F)?x.type.is_flag(F)?x.type.is_value_flag(F,z)?x.type.is_modifiable_flag(F)?(w.session.flag[F.id]=z,w.success(b)):w.throw_error(x.error.permission("modify","flag",F)):w.throw_error(x.error.domain("flag_value",new j("+",[F,z]),y.indicator)):w.throw_error(x.error.domain("prolog_flag",F,y.indicator)):w.throw_error(x.error.type("atom",F,y.indicator))}},flag:{bounded:{allowed:[new j("true"),new j("false")],value:new j("true"),changeable:!1},max_integer:{allowed:[new Re(Number.MAX_SAFE_INTEGER)],value:new Re(Number.MAX_SAFE_INTEGER),changeable:!1},min_integer:{allowed:[new Re(Number.MIN_SAFE_INTEGER)],value:new Re(Number.MIN_SAFE_INTEGER),changeable:!1},integer_rounding_function:{allowed:[new j("down"),new j("toward_zero")],value:new j("toward_zero"),changeable:!1},char_conversion:{allowed:[new j("on"),new j("off")],value:new j("on"),changeable:!0},debug:{allowed:[new j("on"),new j("off")],value:new j("off"),changeable:!0},max_arity:{allowed:[new j("unbounded")],value:new j("unbounded"),changeable:!1},unknown:{allowed:[new j("error"),new j("fail"),new j("warning")],value:new j("error"),changeable:!0},double_quotes:{allowed:[new j("chars"),new j("codes"),new j("atom")],value:new j("codes"),changeable:!0},occurs_check:{allowed:[new j("false"),new j("true")],value:new j("false"),changeable:!0},dialect:{allowed:[new j("tau")],value:new j("tau"),changeable:!1},version_data:{allowed:[new j("tau",[new Re(t.major,!1),new Re(t.minor,!1),new Re(t.patch,!1),new j(t.status)])],value:new j("tau",[new Re(t.major,!1),new Re(t.minor,!1),new Re(t.patch,!1),new j(t.status)]),changeable:!1},nodejs:{allowed:[new j("yes"),new j("no")],value:new j(typeof tc<"u"&&tc.exports?"yes":"no"),changeable:!1}},unify:function(w,b,y){y=y===void 0?!1:y;for(var F=[{left:w,right:b}],z={};F.length!==0;){var Z=F.pop();if(w=Z.left,b=Z.right,x.type.is_term(w)&&x.type.is_term(b)){if(w.indicator!==b.indicator)return null;for(var $=0;$z.value?1:0:z}else return F},operate:function(w,b){if(x.type.is_operator(b)){for(var y=x.type.is_operator(b),F=[],z,Z=!1,$=0;$w.get_flag("max_integer").value||z0?w.start+w.matches[0].length:w.start,z=y?new j("token_not_found"):new j("found",[new j(w.value.toString())]),Z=new j(".",[new j("line",[new Re(w.line+1)]),new j(".",[new j("column",[new Re(F+1)]),new j(".",[z,new j("[]",[])])])]);return new j("error",[new j("syntax_error",[new j(b)]),Z])},syntax_by_predicate:function(w,b){return new j("error",[new j("syntax_error",[new j(w)]),X(b)])}},warning:{singleton:function(w,b,y){for(var F=new j("[]"),z=w.length-1;z>=0;z--)F=new j(".",[new De(w[z]),F]);return new j("warning",[new j("singleton_variables",[F,X(b)]),new j(".",[new j("line",[new Re(y,!1)]),new j("[]")])])},failed_goal:function(w,b){return new j("warning",[new j("failed_goal",[w]),new j(".",[new j("line",[new Re(b,!1)]),new j("[]")])])}},format_variable:function(w){return"_"+w},format_answer:function(w,b,F){b instanceof ke&&(b=b.thread);var F=F||{};if(F.session=b?b.session:void 0,x.type.is_error(w))return"uncaught exception: "+w.args[0].toString();if(w===!1)return"false.";if(w===null)return"limit exceeded ;";var z=0,Z="";if(x.type.is_substitution(w)){var $=w.domain(!0);w=w.filter(function(Te,lt){return!x.type.is_variable(lt)||$.indexOf(lt.id)!==-1&&Te!==lt.id})}for(var oe in w.links)w.links.hasOwnProperty(oe)&&(z++,Z!==""&&(Z+=", "),Z+=oe.toString(F)+" = "+w.links[oe].toString(F));var xe=typeof b>"u"||b.points.length>0?" ;":".";return z===0?"true"+xe:Z+xe},flatten_error:function(w){if(!x.type.is_error(w))return null;w=w.args[0];var b={};return b.type=w.args[0].id,b.thrown=b.type==="syntax_error"?null:w.args[1].id,b.expected=null,b.found=null,b.representation=null,b.existence=null,b.existence_type=null,b.line=null,b.column=null,b.permission_operation=null,b.permission_type=null,b.evaluation_type=null,b.type==="type_error"||b.type==="domain_error"?(b.expected=w.args[0].args[0].id,b.found=w.args[0].args[1].toString()):b.type==="syntax_error"?w.args[1].indicator==="./2"?(b.expected=w.args[0].args[0].id,b.found=w.args[1].args[1].args[1].args[0],b.found=b.found.id==="token_not_found"?b.found.id:b.found.args[0].id,b.line=w.args[1].args[0].args[0].value,b.column=w.args[1].args[1].args[0].args[0].value):b.thrown=w.args[1].id:b.type==="permission_error"?(b.found=w.args[0].args[2].toString(),b.permission_operation=w.args[0].args[0].id,b.permission_type=w.args[0].args[1].id):b.type==="evaluation_error"?b.evaluation_type=w.args[0].args[0].id:b.type==="representation_error"?b.representation=w.args[0].args[0].id:b.type==="existence_error"&&(b.existence=w.args[0].args[1].toString(),b.existence_type=w.args[0].args[0].id),b},create:function(w){return new x.type.Session(w)}};typeof tc<"u"?tc.exports=x:window.pl=x})()});function hve(t,e,r){t.prepend(r.map(s=>new gl.default.type.State(e.goal.replace(s),e.substitution,e)))}function y9(t){let e=dve.get(t.session);if(e==null)throw new Error("Assertion failed: A project should have been registered for the active session");return e}function mve(t,e){dve.set(t,e),t.consult(`:- use_module(library(${gDt.id})).`)}var E9,gl,gve,J0,pDt,hDt,dve,gDt,yve=It(()=>{Ve();E9=et(AS()),gl=et(m9()),gve=et(ye("vm")),{is_atom:J0,is_variable:pDt,is_instantiated_list:hDt}=gl.default.type;dve=new WeakMap;gDt=new gl.default.type.Module("constraints",{"project_workspaces_by_descriptor/3":(t,e,r)=>{let[s,a,n]=r.args;if(!J0(s)||!J0(a)){t.throw_error(gl.default.error.instantiation(r.indicator));return}let c=q.parseIdent(s.id),f=q.makeDescriptor(c,a.id),h=y9(t).tryWorkspaceByDescriptor(f);pDt(n)&&h!==null&&hve(t,e,[new gl.default.type.Term("=",[n,new gl.default.type.Term(String(h.relativeCwd))])]),J0(n)&&h!==null&&h.relativeCwd===n.id&&t.success(e)},"workspace_field/3":(t,e,r)=>{let[s,a,n]=r.args;if(!J0(s)||!J0(a)){t.throw_error(gl.default.error.instantiation(r.indicator));return}let f=y9(t).tryWorkspaceByCwd(s.id);if(f==null)return;let p=(0,E9.default)(f.manifest.raw,a.id);typeof p>"u"||hve(t,e,[new gl.default.type.Term("=",[n,new gl.default.type.Term(typeof p=="object"?JSON.stringify(p):p)])])},"workspace_field_test/3":(t,e,r)=>{let[s,a,n]=r.args;t.prepend([new gl.default.type.State(e.goal.replace(new gl.default.type.Term("workspace_field_test",[s,a,n,new gl.default.type.Term("[]",[])])),e.substitution,e)])},"workspace_field_test/4":(t,e,r)=>{let[s,a,n,c]=r.args;if(!J0(s)||!J0(a)||!J0(n)||!hDt(c)){t.throw_error(gl.default.error.instantiation(r.indicator));return}let p=y9(t).tryWorkspaceByCwd(s.id);if(p==null)return;let h=(0,E9.default)(p.manifest.raw,a.id);if(typeof h>"u")return;let E={$$:h};for(let[S,P]of c.toJavaScript().entries())E[`$${S}`]=P;gve.default.runInNewContext(n.id,E)&&t.success(e)}},["project_workspaces_by_descriptor/3","workspace_field/3","workspace_field_test/3","workspace_field_test/4"])});var BS={};Vt(BS,{Constraints:()=>C9,DependencyType:()=>wve});function yo(t){if(t instanceof ZC.default.type.Num)return t.value;if(t instanceof ZC.default.type.Term)switch(t.indicator){case"throw/1":return yo(t.args[0]);case"error/1":return yo(t.args[0]);case"error/2":if(t.args[0]instanceof ZC.default.type.Term&&t.args[0].indicator==="syntax_error/1")return Object.assign(yo(t.args[0]),...yo(t.args[1]));{let e=yo(t.args[0]);return e.message+=` (in ${yo(t.args[1])})`,e}case"syntax_error/1":return new Yt(43,`Syntax error: ${yo(t.args[0])}`);case"existence_error/2":return new Yt(44,`Existence error: ${yo(t.args[0])} ${yo(t.args[1])} not found`);case"instantiation_error/0":return new Yt(75,"Instantiation error: an argument is variable when an instantiated argument was expected");case"line/1":return{line:yo(t.args[0])};case"column/1":return{column:yo(t.args[0])};case"found/1":return{found:yo(t.args[0])};case"./2":return[yo(t.args[0])].concat(yo(t.args[1]));case"//2":return`${yo(t.args[0])}/${yo(t.args[1])}`;default:return t.id}throw`couldn't pretty print because of unsupported node ${t}`}function Ive(t){let e;try{e=yo(t)}catch(r){throw typeof r=="string"?new Yt(42,`Unknown error: ${t} (note: ${r})`):r}return typeof e.line<"u"&&typeof e.column<"u"&&(e.message+=` at line ${e.line}, column ${e.column}`),e}function xm(t){return t.id==="null"?null:`${t.toJavaScript()}`}function dDt(t){if(t.id==="null")return null;{let e=t.toJavaScript();if(typeof e!="string")return JSON.stringify(e);try{return JSON.stringify(JSON.parse(e))}catch{return JSON.stringify(e)}}}function z0(t){return typeof t=="string"?`'${t}'`:"[]"}var Cve,ZC,wve,Eve,I9,C9,vS=It(()=>{Ve();Ve();bt();Cve=et(XBe()),ZC=et(m9());IS();yve();(0,Cve.default)(ZC.default);wve=(s=>(s.Dependencies="dependencies",s.DevDependencies="devDependencies",s.PeerDependencies="peerDependencies",s))(wve||{}),Eve=["dependencies","devDependencies","peerDependencies"];I9=class{constructor(e,r){let s=1e3*e.workspaces.length;this.session=ZC.default.create(s),mve(this.session,e),this.session.consult(":- use_module(library(lists))."),this.session.consult(r)}fetchNextAnswer(){return new Promise(e=>{this.session.answer(r=>{e(r)})})}async*makeQuery(e){let r=this.session.query(e);if(r!==!0)throw Ive(r);for(;;){let s=await this.fetchNextAnswer();if(s===null)throw new Yt(79,"Resolution limit exceeded");if(!s)break;if(s.id==="throw")throw Ive(s);yield s}}};C9=class t{constructor(e){this.source="";this.project=e;let r=e.configuration.get("constraintsPath");le.existsSync(r)&&(this.source=le.readFileSync(r,"utf8"))}static async find(e){return new t(e)}getProjectDatabase(){let e="";for(let r of Eve)e+=`dependency_type(${r}). +`;for(let r of this.project.workspacesByCwd.values()){let s=r.relativeCwd;e+=`workspace(${z0(s)}). +`,e+=`workspace_ident(${z0(s)}, ${z0(q.stringifyIdent(r.anchoredLocator))}). +`,e+=`workspace_version(${z0(s)}, ${z0(r.manifest.version)}). +`;for(let a of Eve)for(let n of r.manifest[a].values())e+=`workspace_has_dependency(${z0(s)}, ${z0(q.stringifyIdent(n))}, ${z0(n.range)}, ${a}). +`}return e+=`workspace(_) :- false. +`,e+=`workspace_ident(_, _) :- false. +`,e+=`workspace_version(_, _) :- false. +`,e+=`workspace_has_dependency(_, _, _, _) :- false. +`,e}getDeclarations(){let e="";return e+=`gen_enforced_dependency(_, _, _, _) :- false. +`,e+=`gen_enforced_field(_, _, _) :- false. +`,e}get fullSource(){return`${this.getProjectDatabase()} +${this.source} +${this.getDeclarations()}`}createSession(){return new I9(this.project,this.fullSource)}async processClassic(){let e=this.createSession();return{enforcedDependencies:await this.genEnforcedDependencies(e),enforcedFields:await this.genEnforcedFields(e)}}async process(){let{enforcedDependencies:e,enforcedFields:r}=await this.processClassic(),s=new Map;for(let{workspace:a,dependencyIdent:n,dependencyRange:c,dependencyType:f}of e){let p=ES([f,q.stringifyIdent(n)]),h=je.getMapWithDefault(s,a.cwd);je.getMapWithDefault(h,p).set(c??void 0,new Set)}for(let{workspace:a,fieldPath:n,fieldValue:c}of r){let f=ES(n),p=je.getMapWithDefault(s,a.cwd);je.getMapWithDefault(p,f).set(JSON.parse(c)??void 0,new Set)}return{manifestUpdates:s,reportedErrors:new Map}}async genEnforcedDependencies(e){let r=[];for await(let s of e.makeQuery("workspace(WorkspaceCwd), dependency_type(DependencyType), gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType).")){let a=K.resolve(this.project.cwd,xm(s.links.WorkspaceCwd)),n=xm(s.links.DependencyIdent),c=xm(s.links.DependencyRange),f=xm(s.links.DependencyType);if(a===null||n===null)throw new Error("Invalid rule");let p=this.project.getWorkspaceByCwd(a),h=q.parseIdent(n);r.push({workspace:p,dependencyIdent:h,dependencyRange:c,dependencyType:f})}return je.sortMap(r,[({dependencyRange:s})=>s!==null?"0":"1",({workspace:s})=>q.stringifyIdent(s.anchoredLocator),({dependencyIdent:s})=>q.stringifyIdent(s)])}async genEnforcedFields(e){let r=[];for await(let s of e.makeQuery("workspace(WorkspaceCwd), gen_enforced_field(WorkspaceCwd, FieldPath, FieldValue).")){let a=K.resolve(this.project.cwd,xm(s.links.WorkspaceCwd)),n=xm(s.links.FieldPath),c=dDt(s.links.FieldValue);if(a===null||n===null)throw new Error("Invalid rule");let f=this.project.getWorkspaceByCwd(a);r.push({workspace:f,fieldPath:n,fieldValue:c})}return je.sortMap(r,[({workspace:s})=>q.stringifyIdent(s.anchoredLocator),({fieldPath:s})=>s])}async*query(e){let r=this.createSession();for await(let s of r.makeQuery(e)){let a={};for(let[n,c]of Object.entries(s.links))n!=="_"&&(a[n]=xm(c));yield a}}}});var Qve=L(gF=>{"use strict";Object.defineProperty(gF,"__esModule",{value:!0});function US(t){let e=[...t.caches],r=e.shift();return r===void 0?kve():{get(s,a,n={miss:()=>Promise.resolve()}){return r.get(s,a,n).catch(()=>US({caches:e}).get(s,a,n))},set(s,a){return r.set(s,a).catch(()=>US({caches:e}).set(s,a))},delete(s){return r.delete(s).catch(()=>US({caches:e}).delete(s))},clear(){return r.clear().catch(()=>US({caches:e}).clear())}}}function kve(){return{get(t,e,r={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}gF.createFallbackableCache=US;gF.createNullCache=kve});var Rve=L((ihr,Tve)=>{Tve.exports=Qve()});var Fve=L(N9=>{"use strict";Object.defineProperty(N9,"__esModule",{value:!0});function NDt(t={serializable:!0}){let e={};return{get(r,s,a={miss:()=>Promise.resolve()}){let n=JSON.stringify(r);if(n in e)return Promise.resolve(t.serializable?JSON.parse(e[n]):e[n]);let c=s(),f=a&&a.miss||(()=>Promise.resolve());return c.then(p=>f(p)).then(()=>c)},set(r,s){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(r){return delete e[JSON.stringify(r)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}N9.createInMemoryCache=NDt});var Ove=L((ohr,Nve)=>{Nve.exports=Fve()});var Mve=L(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});function ODt(t,e,r){let s={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers(){return t===O9.WithinHeaders?s:{}},queryParameters(){return t===O9.WithinQueryParameters?s:{}}}}function LDt(t){let e=0,r=()=>(e++,new Promise(s=>{setTimeout(()=>{s(t(r))},Math.min(100*e,1e3))}));return t(r)}function Lve(t,e=(r,s)=>Promise.resolve()){return Object.assign(t,{wait(r){return Lve(t.then(s=>Promise.all([e(s,r),s])).then(s=>s[1]))}})}function MDt(t){let e=t.length-1;for(e;e>0;e--){let r=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[r],t[r]=s}return t}function _Dt(t,e){return e&&Object.keys(e).forEach(r=>{t[r]=e[r](t)}),t}function UDt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}var HDt="4.22.1",jDt=t=>()=>t.transporter.requester.destroy(),O9={WithinQueryParameters:0,WithinHeaders:1};ef.AuthMode=O9;ef.addMethods=_Dt;ef.createAuth=ODt;ef.createRetryablePromise=LDt;ef.createWaitablePromise=Lve;ef.destroy=jDt;ef.encode=UDt;ef.shuffle=MDt;ef.version=HDt});var HS=L((lhr,_ve)=>{_ve.exports=Mve()});var Uve=L(L9=>{"use strict";Object.defineProperty(L9,"__esModule",{value:!0});var qDt={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};L9.MethodEnum=qDt});var jS=L((uhr,Hve)=>{Hve.exports=Uve()});var rSe=L(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var qve=jS();function M9(t,e){let r=t||{},s=r.data||{};return Object.keys(r).forEach(a=>{["timeout","headers","queryParameters","data","cacheable"].indexOf(a)===-1&&(s[a]=r[a])}),{data:Object.entries(s).length>0?s:void 0,timeout:r.timeout||e,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var qS={Read:1,Write:2,Any:3},aw={Up:1,Down:2,Timeouted:3},Gve=2*60*1e3;function U9(t,e=aw.Up){return{...t,status:e,lastUpdate:Date.now()}}function Wve(t){return t.status===aw.Up||Date.now()-t.lastUpdate>Gve}function Yve(t){return t.status===aw.Timeouted&&Date.now()-t.lastUpdate<=Gve}function H9(t){return typeof t=="string"?{protocol:"https",url:t,accept:qS.Any}:{protocol:t.protocol||"https",url:t.url,accept:t.accept||qS.Any}}function GDt(t,e){return Promise.all(e.map(r=>t.get(r,()=>Promise.resolve(U9(r))))).then(r=>{let s=r.filter(f=>Wve(f)),a=r.filter(f=>Yve(f)),n=[...s,...a],c=n.length>0?n.map(f=>H9(f)):e;return{getTimeout(f,p){return(a.length===0&&f===0?1:a.length+3+f)*p},statelessHosts:c}})}var WDt=({isTimedOut:t,status:e})=>!t&&~~e===0,YDt=t=>{let e=t.status;return t.isTimedOut||WDt(t)||~~(e/100)!==2&&~~(e/100)!==4},VDt=({status:t})=>~~(t/100)===2,KDt=(t,e)=>YDt(t)?e.onRetry(t):VDt(t)?e.onSuccess(t):e.onFail(t);function jve(t,e,r,s){let a=[],n=Zve(r,s),c=Xve(t,s),f=r.method,p=r.method!==qve.MethodEnum.Get?{}:{...r.data,...s.data},h={"x-algolia-agent":t.userAgent.value,...t.queryParameters,...p,...s.queryParameters},E=0,C=(S,P)=>{let I=S.pop();if(I===void 0)throw tSe(_9(a));let R={data:n,headers:c,method:f,url:Jve(I,r.path,h),connectTimeout:P(E,t.timeouts.connect),responseTimeout:P(E,s.timeout)},N=W=>{let te={request:R,response:W,host:I,triesLeft:S.length};return a.push(te),te},U={onSuccess:W=>Vve(W),onRetry(W){let te=N(W);return W.isTimedOut&&E++,Promise.all([t.logger.info("Retryable failure",j9(te)),t.hostsCache.set(I,U9(I,W.isTimedOut?aw.Timeouted:aw.Down))]).then(()=>C(S,P))},onFail(W){throw N(W),Kve(W,_9(a))}};return t.requester.send(R).then(W=>KDt(W,U))};return GDt(t.hostsCache,e).then(S=>C([...S.statelessHosts].reverse(),S.getTimeout))}function JDt(t){let{hostsCache:e,logger:r,requester:s,requestsCache:a,responsesCache:n,timeouts:c,userAgent:f,hosts:p,queryParameters:h,headers:E}=t,C={hostsCache:e,logger:r,requester:s,requestsCache:a,responsesCache:n,timeouts:c,userAgent:f,headers:E,queryParameters:h,hosts:p.map(S=>H9(S)),read(S,P){let I=M9(P,C.timeouts.read),R=()=>jve(C,C.hosts.filter(W=>(W.accept&qS.Read)!==0),S,I);if((I.cacheable!==void 0?I.cacheable:S.cacheable)!==!0)return R();let U={request:S,mappedRequestOptions:I,transporter:{queryParameters:C.queryParameters,headers:C.headers}};return C.responsesCache.get(U,()=>C.requestsCache.get(U,()=>C.requestsCache.set(U,R()).then(W=>Promise.all([C.requestsCache.delete(U),W]),W=>Promise.all([C.requestsCache.delete(U),Promise.reject(W)])).then(([W,te])=>te)),{miss:W=>C.responsesCache.set(U,W)})},write(S,P){return jve(C,C.hosts.filter(I=>(I.accept&qS.Write)!==0),S,M9(P,C.timeouts.write))}};return C}function zDt(t){let e={value:`Algolia for JavaScript (${t})`,add(r){let s=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return e.value.indexOf(s)===-1&&(e.value=`${e.value}${s}`),e}};return e}function Vve(t){try{return JSON.parse(t.content)}catch(e){throw eSe(e.message,t)}}function Kve({content:t,status:e},r){let s=t;try{s=JSON.parse(t).message}catch{}return $ve(s,e,r)}function ZDt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}function Jve(t,e,r){let s=zve(r),a=`${t.protocol}://${t.url}/${e.charAt(0)==="/"?e.substr(1):e}`;return s.length&&(a+=`?${s}`),a}function zve(t){let e=r=>Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Array]";return Object.keys(t).map(r=>ZDt("%s=%s",r,e(t[r])?JSON.stringify(t[r]):t[r])).join("&")}function Zve(t,e){if(t.method===qve.MethodEnum.Get||t.data===void 0&&e.data===void 0)return;let r=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(r)}function Xve(t,e){let r={...t.headers,...e.headers},s={};return Object.keys(r).forEach(a=>{let n=r[a];s[a.toLowerCase()]=n}),s}function _9(t){return t.map(e=>j9(e))}function j9(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function $ve(t,e,r){return{name:"ApiError",message:t,status:e,transporterStackTrace:r}}function eSe(t,e){return{name:"DeserializationError",message:t,response:e}}function tSe(t){return{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:t}}Yi.CallEnum=qS;Yi.HostStatusEnum=aw;Yi.createApiError=$ve;Yi.createDeserializationError=eSe;Yi.createMappedRequestOptions=M9;Yi.createRetryError=tSe;Yi.createStatefulHost=U9;Yi.createStatelessHost=H9;Yi.createTransporter=JDt;Yi.createUserAgent=zDt;Yi.deserializeFailure=Kve;Yi.deserializeSuccess=Vve;Yi.isStatefulHostTimeouted=Yve;Yi.isStatefulHostUp=Wve;Yi.serializeData=Zve;Yi.serializeHeaders=Xve;Yi.serializeQueryParameters=zve;Yi.serializeUrl=Jve;Yi.stackFrameWithoutCredentials=j9;Yi.stackTraceWithoutCredentials=_9});var GS=L((Ahr,nSe)=>{nSe.exports=rSe()});var iSe=L(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});var lw=HS(),XDt=GS(),WS=jS(),$Dt=t=>{let e=t.region||"us",r=lw.createAuth(lw.AuthMode.WithinHeaders,t.appId,t.apiKey),s=XDt.createTransporter({hosts:[{url:`analytics.${e}.algolia.com`}],...t,headers:{...r.headers(),"content-type":"application/json",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}}),a=t.appId;return lw.addMethods({appId:a,transporter:s},t.methods)},ebt=t=>(e,r)=>t.transporter.write({method:WS.MethodEnum.Post,path:"2/abtests",data:e},r),tbt=t=>(e,r)=>t.transporter.write({method:WS.MethodEnum.Delete,path:lw.encode("2/abtests/%s",e)},r),rbt=t=>(e,r)=>t.transporter.read({method:WS.MethodEnum.Get,path:lw.encode("2/abtests/%s",e)},r),nbt=t=>e=>t.transporter.read({method:WS.MethodEnum.Get,path:"2/abtests"},e),ibt=t=>(e,r)=>t.transporter.write({method:WS.MethodEnum.Post,path:lw.encode("2/abtests/%s/stop",e)},r);X0.addABTest=ebt;X0.createAnalyticsClient=$Dt;X0.deleteABTest=tbt;X0.getABTest=rbt;X0.getABTests=nbt;X0.stopABTest=ibt});var oSe=L((hhr,sSe)=>{sSe.exports=iSe()});var lSe=L(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var q9=HS(),sbt=GS(),aSe=jS(),obt=t=>{let e=t.region||"us",r=q9.createAuth(q9.AuthMode.WithinHeaders,t.appId,t.apiKey),s=sbt.createTransporter({hosts:[{url:`personalization.${e}.algolia.com`}],...t,headers:{...r.headers(),"content-type":"application/json",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}});return q9.addMethods({appId:t.appId,transporter:s},t.methods)},abt=t=>e=>t.transporter.read({method:aSe.MethodEnum.Get,path:"1/strategies/personalization"},e),lbt=t=>(e,r)=>t.transporter.write({method:aSe.MethodEnum.Post,path:"1/strategies/personalization",data:e},r);YS.createPersonalizationClient=obt;YS.getPersonalizationStrategy=abt;YS.setPersonalizationStrategy=lbt});var uSe=L((dhr,cSe)=>{cSe.exports=lSe()});var vSe=L(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});var Kt=HS(),dl=GS(),br=jS(),cbt=ye("crypto");function dF(t){let e=r=>t.request(r).then(s=>{if(t.batch!==void 0&&t.batch(s.hits),!t.shouldStop(s))return s.cursor?e({cursor:s.cursor}):e({page:(r.page||0)+1})});return e({})}var ubt=t=>{let e=t.appId,r=Kt.createAuth(t.authMode!==void 0?t.authMode:Kt.AuthMode.WithinHeaders,e,t.apiKey),s=dl.createTransporter({hosts:[{url:`${e}-dsn.algolia.net`,accept:dl.CallEnum.Read},{url:`${e}.algolia.net`,accept:dl.CallEnum.Write}].concat(Kt.shuffle([{url:`${e}-1.algolianet.com`},{url:`${e}-2.algolianet.com`},{url:`${e}-3.algolianet.com`}])),...t,headers:{...r.headers(),"content-type":"application/x-www-form-urlencoded",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}}),a={transporter:s,appId:e,addAlgoliaAgent(n,c){s.userAgent.add({segment:n,version:c})},clearCache(){return Promise.all([s.requestsCache.clear(),s.responsesCache.clear()]).then(()=>{})}};return Kt.addMethods(a,t.methods)};function fSe(){return{name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}}function ASe(){return{name:"ObjectNotFoundError",message:"Object not found."}}function pSe(){return{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."}}var fbt=t=>(e,r)=>{let{queryParameters:s,...a}=r||{},n={acl:e,...s!==void 0?{queryParameters:s}:{}},c=(f,p)=>Kt.createRetryablePromise(h=>VS(t)(f.key,p).catch(E=>{if(E.status!==404)throw E;return h()}));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:"1/keys",data:n},a),c)},Abt=t=>(e,r,s)=>{let a=dl.createMappedRequestOptions(s);return a.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:br.MethodEnum.Post,path:"1/clusters/mapping",data:{cluster:r}},a)},pbt=t=>(e,r,s)=>t.transporter.write({method:br.MethodEnum.Post,path:"1/clusters/mapping/batch",data:{users:e,cluster:r}},s),hbt=t=>(e,r)=>Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(s,a)=>cw(t)(s.taskID,a)),mF=t=>(e,r,s)=>{let a=(n,c)=>KS(t)(e,{methods:{waitTask:gs}}).waitTask(n.taskID,c);return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/operation",e),data:{operation:"copy",destination:r}},s),a)},gbt=t=>(e,r,s)=>mF(t)(e,r,{...s,scope:[EF.Rules]}),dbt=t=>(e,r,s)=>mF(t)(e,r,{...s,scope:[EF.Settings]}),mbt=t=>(e,r,s)=>mF(t)(e,r,{...s,scope:[EF.Synonyms]}),ybt=t=>(e,r)=>e.method===br.MethodEnum.Get?t.transporter.read(e,r):t.transporter.write(e,r),Ebt=t=>(e,r)=>{let s=(a,n)=>Kt.createRetryablePromise(c=>VS(t)(e,n).then(c).catch(f=>{if(f.status!==404)throw f}));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Delete,path:Kt.encode("1/keys/%s",e)},r),s)},Ibt=t=>(e,r,s)=>{let a=r.map(n=>({action:"deleteEntry",body:{objectID:n}}));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},s),(n,c)=>cw(t)(n.taskID,c))},Cbt=()=>(t,e)=>{let r=dl.serializeQueryParameters(e),s=cbt.createHmac("sha256",t).update(r).digest("hex");return Buffer.from(s+r).toString("base64")},VS=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/keys/%s",e)},r),hSe=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/task/%s",e.toString())},r),wbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"/1/dictionaries/*/settings"},e),Bbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"1/logs"},e),vbt=()=>t=>{let e=Buffer.from(t,"base64").toString("ascii"),r=/validUntil=(\d+)/,s=e.match(r);if(s===null)throw pSe();return parseInt(s[1],10)-Math.round(new Date().getTime()/1e3)},Sbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"1/clusters/mapping/top"},e),Dbt=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/clusters/mapping/%s",e)},r),bbt=t=>e=>{let{retrieveMappings:r,...s}=e||{};return r===!0&&(s.getClusters=!0),t.transporter.read({method:br.MethodEnum.Get,path:"1/clusters/mapping/pending"},s)},KS=t=>(e,r={})=>{let s={transporter:t.transporter,appId:t.appId,indexName:e};return Kt.addMethods(s,r.methods)},Pbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"1/keys"},e),xbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"1/clusters"},e),kbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"1/indexes"},e),Qbt=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:"1/clusters/mapping"},e),Tbt=t=>(e,r,s)=>{let a=(n,c)=>KS(t)(e,{methods:{waitTask:gs}}).waitTask(n.taskID,c);return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/operation",e),data:{operation:"move",destination:r}},s),a)},Rbt=t=>(e,r)=>{let s=(a,n)=>Promise.all(Object.keys(a.taskID).map(c=>KS(t)(c,{methods:{waitTask:gs}}).waitTask(a.taskID[c],n)));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:"1/indexes/*/batch",data:{requests:e}},r),s)},Fbt=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:e}},r),Nbt=t=>(e,r)=>{let s=e.map(a=>({...a,params:dl.serializeQueryParameters(a.params||{})}));return t.transporter.read({method:br.MethodEnum.Post,path:"1/indexes/*/queries",data:{requests:s},cacheable:!0},r)},Obt=t=>(e,r)=>Promise.all(e.map(s=>{let{facetName:a,facetQuery:n,...c}=s.params;return KS(t)(s.indexName,{methods:{searchForFacetValues:CSe}}).searchForFacetValues(a,n,{...r,...c})})),Lbt=t=>(e,r)=>{let s=dl.createMappedRequestOptions(r);return s.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:br.MethodEnum.Delete,path:"1/clusters/mapping"},s)},Mbt=t=>(e,r,s)=>{let a=r.map(n=>({action:"addEntry",body:n}));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:a}},s),(n,c)=>cw(t)(n.taskID,c))},_bt=t=>(e,r)=>{let s=(a,n)=>Kt.createRetryablePromise(c=>VS(t)(e,n).catch(f=>{if(f.status!==404)throw f;return c()}));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/keys/%s/restore",e)},r),s)},Ubt=t=>(e,r,s)=>{let a=r.map(n=>({action:"addEntry",body:n}));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},s),(n,c)=>cw(t)(n.taskID,c))},Hbt=t=>(e,r,s)=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("/1/dictionaries/%s/search",e),data:{query:r},cacheable:!0},s),jbt=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Post,path:"1/clusters/mapping/search",data:{query:e}},r),qbt=t=>(e,r)=>Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Put,path:"/1/dictionaries/*/settings",data:e},r),(s,a)=>cw(t)(s.taskID,a)),Gbt=t=>(e,r)=>{let s=Object.assign({},r),{queryParameters:a,...n}=r||{},c=a?{queryParameters:a}:{},f=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"],p=E=>Object.keys(s).filter(C=>f.indexOf(C)!==-1).every(C=>{if(Array.isArray(E[C])&&Array.isArray(s[C])){let S=E[C];return S.length===s[C].length&&S.every((P,I)=>P===s[C][I])}else return E[C]===s[C]}),h=(E,C)=>Kt.createRetryablePromise(S=>VS(t)(e,C).then(P=>p(P)?Promise.resolve():S()));return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Put,path:Kt.encode("1/keys/%s",e),data:c},n),h)},cw=t=>(e,r)=>Kt.createRetryablePromise(s=>hSe(t)(e,r).then(a=>a.status!=="published"?s():void 0)),gSe=t=>(e,r)=>{let s=(a,n)=>gs(t)(a.taskID,n);return Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/batch",t.indexName),data:{requests:e}},r),s)},Wbt=t=>e=>dF({shouldStop:r=>r.cursor===void 0,...e,request:r=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/browse",t.indexName),data:r},e)}),Ybt=t=>e=>{let r={hitsPerPage:1e3,...e};return dF({shouldStop:s=>s.hits.length({...a,hits:a.hits.map(n=>(delete n._highlightResult,n))}))}})},Vbt=t=>e=>{let r={hitsPerPage:1e3,...e};return dF({shouldStop:s=>s.hits.length({...a,hits:a.hits.map(n=>(delete n._highlightResult,n))}))}})},yF=t=>(e,r,s)=>{let{batchSize:a,...n}=s||{},c={taskIDs:[],objectIDs:[]},f=(p=0)=>{let h=[],E;for(E=p;E({action:r,body:C})),n).then(C=>(c.objectIDs=c.objectIDs.concat(C.objectIDs),c.taskIDs.push(C.taskID),E++,f(E)))};return Kt.createWaitablePromise(f(),(p,h)=>Promise.all(p.taskIDs.map(E=>gs(t)(E,h))))},Kbt=t=>e=>Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/clear",t.indexName)},e),(r,s)=>gs(t)(r.taskID,s)),Jbt=t=>e=>{let{forwardToReplicas:r,...s}=e||{},a=dl.createMappedRequestOptions(s);return r&&(a.queryParameters.forwardToReplicas=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/rules/clear",t.indexName)},a),(n,c)=>gs(t)(n.taskID,c))},zbt=t=>e=>{let{forwardToReplicas:r,...s}=e||{},a=dl.createMappedRequestOptions(s);return r&&(a.queryParameters.forwardToReplicas=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/synonyms/clear",t.indexName)},a),(n,c)=>gs(t)(n.taskID,c))},Zbt=t=>(e,r)=>Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/deleteByQuery",t.indexName),data:e},r),(s,a)=>gs(t)(s.taskID,a)),Xbt=t=>e=>Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Delete,path:Kt.encode("1/indexes/%s",t.indexName)},e),(r,s)=>gs(t)(r.taskID,s)),$bt=t=>(e,r)=>Kt.createWaitablePromise(dSe(t)([e],r).then(s=>({taskID:s.taskIDs[0]})),(s,a)=>gs(t)(s.taskID,a)),dSe=t=>(e,r)=>{let s=e.map(a=>({objectID:a}));return yF(t)(s,Qm.DeleteObject,r)},ePt=t=>(e,r)=>{let{forwardToReplicas:s,...a}=r||{},n=dl.createMappedRequestOptions(a);return s&&(n.queryParameters.forwardToReplicas=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Delete,path:Kt.encode("1/indexes/%s/rules/%s",t.indexName,e)},n),(c,f)=>gs(t)(c.taskID,f))},tPt=t=>(e,r)=>{let{forwardToReplicas:s,...a}=r||{},n=dl.createMappedRequestOptions(a);return s&&(n.queryParameters.forwardToReplicas=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Delete,path:Kt.encode("1/indexes/%s/synonyms/%s",t.indexName,e)},n),(c,f)=>gs(t)(c.taskID,f))},rPt=t=>e=>mSe(t)(e).then(()=>!0).catch(r=>{if(r.status!==404)throw r;return!1}),nPt=t=>(e,r,s)=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("1/answers/%s/prediction",t.indexName),data:{query:e,queryLanguages:r},cacheable:!0},s),iPt=t=>(e,r)=>{let{query:s,paginate:a,...n}=r||{},c=0,f=()=>ISe(t)(s||"",{...n,page:c}).then(p=>{for(let[h,E]of Object.entries(p.hits))if(e(E))return{object:E,position:parseInt(h,10),page:c};if(c++,a===!1||c>=p.nbPages)throw ASe();return f()});return f()},sPt=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/indexes/%s/%s",t.indexName,e)},r),oPt=()=>(t,e)=>{for(let[r,s]of Object.entries(t.hits))if(s.objectID===e)return parseInt(r,10);return-1},aPt=t=>(e,r)=>{let{attributesToRetrieve:s,...a}=r||{},n=e.map(c=>({indexName:t.indexName,objectID:c,...s?{attributesToRetrieve:s}:{}}));return t.transporter.read({method:br.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:n}},a)},lPt=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/indexes/%s/rules/%s",t.indexName,e)},r),mSe=t=>e=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/indexes/%s/settings",t.indexName),data:{getVersion:2}},e),cPt=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/indexes/%s/synonyms/%s",t.indexName,e)},r),ySe=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Get,path:Kt.encode("1/indexes/%s/task/%s",t.indexName,e.toString())},r),uPt=t=>(e,r)=>Kt.createWaitablePromise(ESe(t)([e],r).then(s=>({objectID:s.objectIDs[0],taskID:s.taskIDs[0]})),(s,a)=>gs(t)(s.taskID,a)),ESe=t=>(e,r)=>{let{createIfNotExists:s,...a}=r||{},n=s?Qm.PartialUpdateObject:Qm.PartialUpdateObjectNoCreate;return yF(t)(e,n,a)},fPt=t=>(e,r)=>{let{safe:s,autoGenerateObjectIDIfNotExist:a,batchSize:n,...c}=r||{},f=(I,R,N,U)=>Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/operation",I),data:{operation:N,destination:R}},U),(W,te)=>gs(t)(W.taskID,te)),p=Math.random().toString(36).substring(7),h=`${t.indexName}_tmp_${p}`,E=G9({appId:t.appId,transporter:t.transporter,indexName:h}),C=[],S=f(t.indexName,h,"copy",{...c,scope:["settings","synonyms","rules"]});C.push(S);let P=(s?S.wait(c):S).then(()=>{let I=E(e,{...c,autoGenerateObjectIDIfNotExist:a,batchSize:n});return C.push(I),s?I.wait(c):I}).then(()=>{let I=f(h,t.indexName,"move",c);return C.push(I),s?I.wait(c):I}).then(()=>Promise.all(C)).then(([I,R,N])=>({objectIDs:R.objectIDs,taskIDs:[I.taskID,...R.taskIDs,N.taskID]}));return Kt.createWaitablePromise(P,(I,R)=>Promise.all(C.map(N=>N.wait(R))))},APt=t=>(e,r)=>W9(t)(e,{...r,clearExistingRules:!0}),pPt=t=>(e,r)=>Y9(t)(e,{...r,clearExistingSynonyms:!0}),hPt=t=>(e,r)=>Kt.createWaitablePromise(G9(t)([e],r).then(s=>({objectID:s.objectIDs[0],taskID:s.taskIDs[0]})),(s,a)=>gs(t)(s.taskID,a)),G9=t=>(e,r)=>{let{autoGenerateObjectIDIfNotExist:s,...a}=r||{},n=s?Qm.AddObject:Qm.UpdateObject;if(n===Qm.UpdateObject){for(let c of e)if(c.objectID===void 0)return Kt.createWaitablePromise(Promise.reject(fSe()))}return yF(t)(e,n,a)},gPt=t=>(e,r)=>W9(t)([e],r),W9=t=>(e,r)=>{let{forwardToReplicas:s,clearExistingRules:a,...n}=r||{},c=dl.createMappedRequestOptions(n);return s&&(c.queryParameters.forwardToReplicas=1),a&&(c.queryParameters.clearExistingRules=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/rules/batch",t.indexName),data:e},c),(f,p)=>gs(t)(f.taskID,p))},dPt=t=>(e,r)=>Y9(t)([e],r),Y9=t=>(e,r)=>{let{forwardToReplicas:s,clearExistingSynonyms:a,replaceExistingSynonyms:n,...c}=r||{},f=dl.createMappedRequestOptions(c);return s&&(f.queryParameters.forwardToReplicas=1),(n||a)&&(f.queryParameters.replaceExistingSynonyms=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/synonyms/batch",t.indexName),data:e},f),(p,h)=>gs(t)(p.taskID,h))},ISe=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/query",t.indexName),data:{query:e},cacheable:!0},r),CSe=t=>(e,r,s)=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/facets/%s/query",t.indexName,e),data:{facetQuery:r},cacheable:!0},s),wSe=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/rules/search",t.indexName),data:{query:e}},r),BSe=t=>(e,r)=>t.transporter.read({method:br.MethodEnum.Post,path:Kt.encode("1/indexes/%s/synonyms/search",t.indexName),data:{query:e}},r),mPt=t=>(e,r)=>{let{forwardToReplicas:s,...a}=r||{},n=dl.createMappedRequestOptions(a);return s&&(n.queryParameters.forwardToReplicas=1),Kt.createWaitablePromise(t.transporter.write({method:br.MethodEnum.Put,path:Kt.encode("1/indexes/%s/settings",t.indexName),data:e},n),(c,f)=>gs(t)(c.taskID,f))},gs=t=>(e,r)=>Kt.createRetryablePromise(s=>ySe(t)(e,r).then(a=>a.status!=="published"?s():void 0)),yPt={AddObject:"addObject",Analytics:"analytics",Browser:"browse",DeleteIndex:"deleteIndex",DeleteObject:"deleteObject",EditSettings:"editSettings",Inference:"inference",ListIndexes:"listIndexes",Logs:"logs",Personalization:"personalization",Recommendation:"recommendation",Search:"search",SeeUnretrievableAttributes:"seeUnretrievableAttributes",Settings:"settings",Usage:"usage"},Qm={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},EF={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},EPt={None:"none",StopIfEnoughMatches:"stopIfEnoughMatches"},IPt={Synonym:"synonym",OneWaySynonym:"oneWaySynonym",AltCorrection1:"altCorrection1",AltCorrection2:"altCorrection2",Placeholder:"placeholder"};Ft.ApiKeyACLEnum=yPt;Ft.BatchActionEnum=Qm;Ft.ScopeEnum=EF;Ft.StrategyEnum=EPt;Ft.SynonymEnum=IPt;Ft.addApiKey=fbt;Ft.assignUserID=Abt;Ft.assignUserIDs=pbt;Ft.batch=gSe;Ft.browseObjects=Wbt;Ft.browseRules=Ybt;Ft.browseSynonyms=Vbt;Ft.chunkedBatch=yF;Ft.clearDictionaryEntries=hbt;Ft.clearObjects=Kbt;Ft.clearRules=Jbt;Ft.clearSynonyms=zbt;Ft.copyIndex=mF;Ft.copyRules=gbt;Ft.copySettings=dbt;Ft.copySynonyms=mbt;Ft.createBrowsablePromise=dF;Ft.createMissingObjectIDError=fSe;Ft.createObjectNotFoundError=ASe;Ft.createSearchClient=ubt;Ft.createValidUntilNotFoundError=pSe;Ft.customRequest=ybt;Ft.deleteApiKey=Ebt;Ft.deleteBy=Zbt;Ft.deleteDictionaryEntries=Ibt;Ft.deleteIndex=Xbt;Ft.deleteObject=$bt;Ft.deleteObjects=dSe;Ft.deleteRule=ePt;Ft.deleteSynonym=tPt;Ft.exists=rPt;Ft.findAnswers=nPt;Ft.findObject=iPt;Ft.generateSecuredApiKey=Cbt;Ft.getApiKey=VS;Ft.getAppTask=hSe;Ft.getDictionarySettings=wbt;Ft.getLogs=Bbt;Ft.getObject=sPt;Ft.getObjectPosition=oPt;Ft.getObjects=aPt;Ft.getRule=lPt;Ft.getSecuredApiKeyRemainingValidity=vbt;Ft.getSettings=mSe;Ft.getSynonym=cPt;Ft.getTask=ySe;Ft.getTopUserIDs=Sbt;Ft.getUserID=Dbt;Ft.hasPendingMappings=bbt;Ft.initIndex=KS;Ft.listApiKeys=Pbt;Ft.listClusters=xbt;Ft.listIndices=kbt;Ft.listUserIDs=Qbt;Ft.moveIndex=Tbt;Ft.multipleBatch=Rbt;Ft.multipleGetObjects=Fbt;Ft.multipleQueries=Nbt;Ft.multipleSearchForFacetValues=Obt;Ft.partialUpdateObject=uPt;Ft.partialUpdateObjects=ESe;Ft.removeUserID=Lbt;Ft.replaceAllObjects=fPt;Ft.replaceAllRules=APt;Ft.replaceAllSynonyms=pPt;Ft.replaceDictionaryEntries=Mbt;Ft.restoreApiKey=_bt;Ft.saveDictionaryEntries=Ubt;Ft.saveObject=hPt;Ft.saveObjects=G9;Ft.saveRule=gPt;Ft.saveRules=W9;Ft.saveSynonym=dPt;Ft.saveSynonyms=Y9;Ft.search=ISe;Ft.searchDictionaryEntries=Hbt;Ft.searchForFacetValues=CSe;Ft.searchRules=wSe;Ft.searchSynonyms=BSe;Ft.searchUserIDs=jbt;Ft.setDictionarySettings=qbt;Ft.setSettings=mPt;Ft.updateApiKey=Gbt;Ft.waitAppTask=cw;Ft.waitTask=gs});var DSe=L((yhr,SSe)=>{SSe.exports=vSe()});var bSe=L(IF=>{"use strict";Object.defineProperty(IF,"__esModule",{value:!0});function CPt(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var wPt={Debug:1,Info:2,Error:3};IF.LogLevelEnum=wPt;IF.createNullLogger=CPt});var xSe=L((Ihr,PSe)=>{PSe.exports=bSe()});var RSe=L(V9=>{"use strict";Object.defineProperty(V9,"__esModule",{value:!0});var kSe=ye("http"),QSe=ye("https"),BPt=ye("url"),TSe={keepAlive:!0},vPt=new kSe.Agent(TSe),SPt=new QSe.Agent(TSe);function DPt({agent:t,httpAgent:e,httpsAgent:r,requesterOptions:s={}}={}){let a=e||t||vPt,n=r||t||SPt;return{send(c){return new Promise(f=>{let p=BPt.parse(c.url),h=p.query===null?p.pathname:`${p.pathname}?${p.query}`,E={...s,agent:p.protocol==="https:"?n:a,hostname:p.hostname,path:h,method:c.method,headers:{...s&&s.headers?s.headers:{},...c.headers},...p.port!==void 0?{port:p.port||""}:{}},C=(p.protocol==="https:"?QSe:kSe).request(E,R=>{let N=[];R.on("data",U=>{N=N.concat(U)}),R.on("end",()=>{clearTimeout(P),clearTimeout(I),f({status:R.statusCode||0,content:Buffer.concat(N).toString(),isTimedOut:!1})})}),S=(R,N)=>setTimeout(()=>{C.abort(),f({status:0,content:N,isTimedOut:!0})},R*1e3),P=S(c.connectTimeout,"Connection timeout"),I;C.on("error",R=>{clearTimeout(P),clearTimeout(I),f({status:0,content:R.message,isTimedOut:!1})}),C.once("response",()=>{clearTimeout(P),I=S(c.responseTimeout,"Socket timeout")}),c.data!==void 0&&C.write(c.data),C.end()})},destroy(){return a.destroy(),n.destroy(),Promise.resolve()}}}V9.createNodeHttpRequester=DPt});var NSe=L((whr,FSe)=>{FSe.exports=RSe()});var _Se=L((Bhr,MSe)=>{"use strict";var OSe=Rve(),bPt=Ove(),uw=oSe(),J9=HS(),K9=uSe(),jt=DSe(),PPt=xSe(),xPt=NSe(),kPt=GS();function LSe(t,e,r){let s={appId:t,apiKey:e,timeouts:{connect:2,read:5,write:30},requester:xPt.createNodeHttpRequester(),logger:PPt.createNullLogger(),responsesCache:OSe.createNullCache(),requestsCache:OSe.createNullCache(),hostsCache:bPt.createInMemoryCache(),userAgent:kPt.createUserAgent(J9.version).add({segment:"Node.js",version:process.versions.node})},a={...s,...r},n=()=>c=>K9.createPersonalizationClient({...s,...c,methods:{getPersonalizationStrategy:K9.getPersonalizationStrategy,setPersonalizationStrategy:K9.setPersonalizationStrategy}});return jt.createSearchClient({...a,methods:{search:jt.multipleQueries,searchForFacetValues:jt.multipleSearchForFacetValues,multipleBatch:jt.multipleBatch,multipleGetObjects:jt.multipleGetObjects,multipleQueries:jt.multipleQueries,copyIndex:jt.copyIndex,copySettings:jt.copySettings,copyRules:jt.copyRules,copySynonyms:jt.copySynonyms,moveIndex:jt.moveIndex,listIndices:jt.listIndices,getLogs:jt.getLogs,listClusters:jt.listClusters,multipleSearchForFacetValues:jt.multipleSearchForFacetValues,getApiKey:jt.getApiKey,addApiKey:jt.addApiKey,listApiKeys:jt.listApiKeys,updateApiKey:jt.updateApiKey,deleteApiKey:jt.deleteApiKey,restoreApiKey:jt.restoreApiKey,assignUserID:jt.assignUserID,assignUserIDs:jt.assignUserIDs,getUserID:jt.getUserID,searchUserIDs:jt.searchUserIDs,listUserIDs:jt.listUserIDs,getTopUserIDs:jt.getTopUserIDs,removeUserID:jt.removeUserID,hasPendingMappings:jt.hasPendingMappings,generateSecuredApiKey:jt.generateSecuredApiKey,getSecuredApiKeyRemainingValidity:jt.getSecuredApiKeyRemainingValidity,destroy:J9.destroy,clearDictionaryEntries:jt.clearDictionaryEntries,deleteDictionaryEntries:jt.deleteDictionaryEntries,getDictionarySettings:jt.getDictionarySettings,getAppTask:jt.getAppTask,replaceDictionaryEntries:jt.replaceDictionaryEntries,saveDictionaryEntries:jt.saveDictionaryEntries,searchDictionaryEntries:jt.searchDictionaryEntries,setDictionarySettings:jt.setDictionarySettings,waitAppTask:jt.waitAppTask,customRequest:jt.customRequest,initIndex:c=>f=>jt.initIndex(c)(f,{methods:{batch:jt.batch,delete:jt.deleteIndex,findAnswers:jt.findAnswers,getObject:jt.getObject,getObjects:jt.getObjects,saveObject:jt.saveObject,saveObjects:jt.saveObjects,search:jt.search,searchForFacetValues:jt.searchForFacetValues,waitTask:jt.waitTask,setSettings:jt.setSettings,getSettings:jt.getSettings,partialUpdateObject:jt.partialUpdateObject,partialUpdateObjects:jt.partialUpdateObjects,deleteObject:jt.deleteObject,deleteObjects:jt.deleteObjects,deleteBy:jt.deleteBy,clearObjects:jt.clearObjects,browseObjects:jt.browseObjects,getObjectPosition:jt.getObjectPosition,findObject:jt.findObject,exists:jt.exists,saveSynonym:jt.saveSynonym,saveSynonyms:jt.saveSynonyms,getSynonym:jt.getSynonym,searchSynonyms:jt.searchSynonyms,browseSynonyms:jt.browseSynonyms,deleteSynonym:jt.deleteSynonym,clearSynonyms:jt.clearSynonyms,replaceAllObjects:jt.replaceAllObjects,replaceAllSynonyms:jt.replaceAllSynonyms,searchRules:jt.searchRules,getRule:jt.getRule,deleteRule:jt.deleteRule,saveRule:jt.saveRule,saveRules:jt.saveRules,replaceAllRules:jt.replaceAllRules,browseRules:jt.browseRules,clearRules:jt.clearRules}}),initAnalytics:()=>c=>uw.createAnalyticsClient({...s,...c,methods:{addABTest:uw.addABTest,getABTest:uw.getABTest,getABTests:uw.getABTests,stopABTest:uw.stopABTest,deleteABTest:uw.deleteABTest}}),initPersonalization:n,initRecommendation:()=>c=>(a.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),n()(c))}})}LSe.version=J9.version;MSe.exports=LSe});var Z9=L((vhr,z9)=>{var USe=_Se();z9.exports=USe;z9.exports.default=USe});var eW=L((Dhr,qSe)=>{"use strict";var jSe=Object.getOwnPropertySymbols,TPt=Object.prototype.hasOwnProperty,RPt=Object.prototype.propertyIsEnumerable;function FPt(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function NPt(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var s=Object.getOwnPropertyNames(e).map(function(n){return e[n]});if(s.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(n){a[n]=n}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}qSe.exports=NPt()?Object.assign:function(t,e){for(var r,s=FPt(t),a,n=1;n{"use strict";var rW=eW(),fw=60103,YSe=60106;Dn.Fragment=60107;Dn.StrictMode=60108;Dn.Profiler=60114;var VSe=60109,KSe=60110,JSe=60112;Dn.Suspense=60113;var zSe=60115,ZSe=60116;typeof Symbol=="function"&&Symbol.for&&(Wc=Symbol.for,fw=Wc("react.element"),YSe=Wc("react.portal"),Dn.Fragment=Wc("react.fragment"),Dn.StrictMode=Wc("react.strict_mode"),Dn.Profiler=Wc("react.profiler"),VSe=Wc("react.provider"),KSe=Wc("react.context"),JSe=Wc("react.forward_ref"),Dn.Suspense=Wc("react.suspense"),zSe=Wc("react.memo"),ZSe=Wc("react.lazy"));var Wc,GSe=typeof Symbol=="function"&&Symbol.iterator;function OPt(t){return t===null||typeof t!="object"?null:(t=GSe&&t[GSe]||t["@@iterator"],typeof t=="function"?t:null)}function JS(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r{"use strict";oDe.exports=sDe()});var lW=L((xhr,aW)=>{"use strict";var Cn=aW.exports;aW.exports.default=Cn;var Zn="\x1B[",zS="\x1B]",pw="\x07",BF=";",aDe=process.env.TERM_PROGRAM==="Apple_Terminal";Cn.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?Zn+(t+1)+"G":Zn+(e+1)+";"+(t+1)+"H"};Cn.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=Zn+-t+"D":t>0&&(r+=Zn+t+"C"),e<0?r+=Zn+-e+"A":e>0&&(r+=Zn+e+"B"),r};Cn.cursorUp=(t=1)=>Zn+t+"A";Cn.cursorDown=(t=1)=>Zn+t+"B";Cn.cursorForward=(t=1)=>Zn+t+"C";Cn.cursorBackward=(t=1)=>Zn+t+"D";Cn.cursorLeft=Zn+"G";Cn.cursorSavePosition=aDe?"\x1B7":Zn+"s";Cn.cursorRestorePosition=aDe?"\x1B8":Zn+"u";Cn.cursorGetPosition=Zn+"6n";Cn.cursorNextLine=Zn+"E";Cn.cursorPrevLine=Zn+"F";Cn.cursorHide=Zn+"?25l";Cn.cursorShow=Zn+"?25h";Cn.eraseLines=t=>{let e="";for(let r=0;r[zS,"8",BF,BF,e,pw,t,zS,"8",BF,BF,pw].join("");Cn.image=(t,e={})=>{let r=`${zS}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+t.toString("base64")+pw};Cn.iTerm={setCwd:(t=process.cwd())=>`${zS}50;CurrentDir=${t}${pw}`,annotation:(t,e={})=>{let r=`${zS}1337;`,s=typeof e.x<"u",a=typeof e.y<"u";if((s||a)&&!(s&&a&&typeof e.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replace(/\|/g,""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(s?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+pw}}});var cDe=L((khr,cW)=>{"use strict";var lDe=(t,e)=>{for(let r of Reflect.ownKeys(e))Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t};cW.exports=lDe;cW.exports.default=lDe});var fDe=L((Qhr,SF)=>{"use strict";var HPt=cDe(),vF=new WeakMap,uDe=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,s=0,a=t.displayName||t.name||"",n=function(...c){if(vF.set(n,++s),s===1)r=t.apply(this,c),t=null;else if(e.throw===!0)throw new Error(`Function \`${a}\` can only be called once`);return r};return HPt(n,t),vF.set(n,s),n};SF.exports=uDe;SF.exports.default=uDe;SF.exports.callCount=t=>{if(!vF.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return vF.get(t)}});var ADe=L((Thr,DF)=>{DF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&DF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&DF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var AW=L((Rhr,dw)=>{var Qi=global.process,Tm=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};Tm(Qi)?(pDe=ye("assert"),hw=ADe(),hDe=/^win/i.test(Qi.platform),ZS=ye("events"),typeof ZS!="function"&&(ZS=ZS.EventEmitter),Qi.__signal_exit_emitter__?Js=Qi.__signal_exit_emitter__:(Js=Qi.__signal_exit_emitter__=new ZS,Js.count=0,Js.emitted={}),Js.infinite||(Js.setMaxListeners(1/0),Js.infinite=!0),dw.exports=function(t,e){if(!Tm(global.process))return function(){};pDe.equal(typeof t,"function","a callback must be provided for exit handler"),gw===!1&&uW();var r="exit";e&&e.alwaysLast&&(r="afterexit");var s=function(){Js.removeListener(r,t),Js.listeners("exit").length===0&&Js.listeners("afterexit").length===0&&bF()};return Js.on(r,t),s},bF=function(){!gw||!Tm(global.process)||(gw=!1,hw.forEach(function(e){try{Qi.removeListener(e,PF[e])}catch{}}),Qi.emit=xF,Qi.reallyExit=fW,Js.count-=1)},dw.exports.unload=bF,Rm=function(e,r,s){Js.emitted[e]||(Js.emitted[e]=!0,Js.emit(e,r,s))},PF={},hw.forEach(function(t){PF[t]=function(){if(Tm(global.process)){var r=Qi.listeners(t);r.length===Js.count&&(bF(),Rm("exit",null,t),Rm("afterexit",null,t),hDe&&t==="SIGHUP"&&(t="SIGINT"),Qi.kill(Qi.pid,t))}}}),dw.exports.signals=function(){return hw},gw=!1,uW=function(){gw||!Tm(global.process)||(gw=!0,Js.count+=1,hw=hw.filter(function(e){try{return Qi.on(e,PF[e]),!0}catch{return!1}}),Qi.emit=dDe,Qi.reallyExit=gDe)},dw.exports.load=uW,fW=Qi.reallyExit,gDe=function(e){Tm(global.process)&&(Qi.exitCode=e||0,Rm("exit",Qi.exitCode,null),Rm("afterexit",Qi.exitCode,null),fW.call(Qi,Qi.exitCode))},xF=Qi.emit,dDe=function(e,r){if(e==="exit"&&Tm(global.process)){r!==void 0&&(Qi.exitCode=r);var s=xF.apply(this,arguments);return Rm("exit",Qi.exitCode,null),Rm("afterexit",Qi.exitCode,null),s}else return xF.apply(this,arguments)}):dw.exports=function(){return function(){}};var pDe,hw,hDe,ZS,Js,bF,Rm,PF,gw,uW,fW,gDe,xF,dDe});var yDe=L((Fhr,mDe)=>{"use strict";var jPt=fDe(),qPt=AW();mDe.exports=jPt(()=>{qPt(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})});var pW=L(mw=>{"use strict";var GPt=yDe(),kF=!1;mw.show=(t=process.stderr)=>{t.isTTY&&(kF=!1,t.write("\x1B[?25h"))};mw.hide=(t=process.stderr)=>{t.isTTY&&(GPt(),kF=!0,t.write("\x1B[?25l"))};mw.toggle=(t,e)=>{t!==void 0&&(kF=t),kF?mw.show(e):mw.hide(e)}});var wDe=L(XS=>{"use strict";var CDe=XS&&XS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(XS,"__esModule",{value:!0});var EDe=CDe(lW()),IDe=CDe(pW()),WPt=(t,{showCursor:e=!1}={})=>{let r=0,s="",a=!1,n=c=>{!e&&!a&&(IDe.default.hide(),a=!0);let f=c+` +`;f!==s&&(s=f,t.write(EDe.default.eraseLines(r)+f),r=f.split(` +`).length)};return n.clear=()=>{t.write(EDe.default.eraseLines(r)),s="",r=0},n.done=()=>{s="",r=0,e||(IDe.default.show(),a=!1)},n};XS.default={create:WPt}});var BDe=L((Lhr,YPt)=>{YPt.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var DDe=L(rc=>{"use strict";var SDe=BDe(),AA=process.env;Object.defineProperty(rc,"_vendors",{value:SDe.map(function(t){return t.constant})});rc.name=null;rc.isPR=null;SDe.forEach(function(t){var e=Array.isArray(t.env)?t.env:[t.env],r=e.every(function(s){return vDe(s)});if(rc[t.constant]=r,r)switch(rc.name=t.name,typeof t.pr){case"string":rc.isPR=!!AA[t.pr];break;case"object":"env"in t.pr?rc.isPR=t.pr.env in AA&&AA[t.pr.env]!==t.pr.ne:"any"in t.pr?rc.isPR=t.pr.any.some(function(s){return!!AA[s]}):rc.isPR=vDe(t.pr);break;default:rc.isPR=null}});rc.isCI=!!(AA.CI||AA.CONTINUOUS_INTEGRATION||AA.BUILD_NUMBER||AA.RUN_ID||rc.name);function vDe(t){return typeof t=="string"?!!AA[t]:Object.keys(t).every(function(e){return AA[e]===t[e]})}});var PDe=L((_hr,bDe)=>{"use strict";bDe.exports=DDe().isCI});var kDe=L((Uhr,xDe)=>{"use strict";var VPt=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};xDe.exports=(t,{include:e,exclude:r}={})=>{let s=a=>{let n=c=>typeof c=="string"?a===c:c.test(a);return e?e.some(n):r?!r.some(n):!0};for(let[a,n]of VPt(t.constructor.prototype)){if(n==="constructor"||!s(n))continue;let c=Reflect.getOwnPropertyDescriptor(a,n);c&&typeof c.value=="function"&&(t[n]=t[n].bind(t))}return t}});var ODe=L(Vn=>{"use strict";var Ew,tD,FF,IW;typeof performance=="object"&&typeof performance.now=="function"?(QDe=performance,Vn.unstable_now=function(){return QDe.now()}):(hW=Date,TDe=hW.now(),Vn.unstable_now=function(){return hW.now()-TDe});var QDe,hW,TDe;typeof window>"u"||typeof MessageChannel!="function"?(yw=null,gW=null,dW=function(){if(yw!==null)try{var t=Vn.unstable_now();yw(!0,t),yw=null}catch(e){throw setTimeout(dW,0),e}},Ew=function(t){yw!==null?setTimeout(Ew,0,t):(yw=t,setTimeout(dW,0))},tD=function(t,e){gW=setTimeout(t,e)},FF=function(){clearTimeout(gW)},Vn.unstable_shouldYield=function(){return!1},IW=Vn.unstable_forceFrameRate=function(){}):(RDe=window.setTimeout,FDe=window.clearTimeout,typeof console<"u"&&(NDe=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),typeof NDe!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")),$S=!1,eD=null,QF=-1,mW=5,yW=0,Vn.unstable_shouldYield=function(){return Vn.unstable_now()>=yW},IW=function(){},Vn.unstable_forceFrameRate=function(t){0>t||125>>1,a=t[s];if(a!==void 0&&0RF(c,r))p!==void 0&&0>RF(p,c)?(t[s]=p,t[f]=r,s=f):(t[s]=c,t[n]=r,s=n);else if(p!==void 0&&0>RF(p,r))t[s]=p,t[f]=r,s=f;else break e}}return e}return null}function RF(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}var pA=[],$0=[],KPt=1,Yc=null,ea=3,OF=!1,Fm=!1,rD=!1;function wW(t){for(var e=tf($0);e!==null;){if(e.callback===null)NF($0);else if(e.startTime<=t)NF($0),e.sortIndex=e.expirationTime,CW(pA,e);else break;e=tf($0)}}function BW(t){if(rD=!1,wW(t),!Fm)if(tf(pA)!==null)Fm=!0,Ew(vW);else{var e=tf($0);e!==null&&tD(BW,e.startTime-t)}}function vW(t,e){Fm=!1,rD&&(rD=!1,FF()),OF=!0;var r=ea;try{for(wW(e),Yc=tf(pA);Yc!==null&&(!(Yc.expirationTime>e)||t&&!Vn.unstable_shouldYield());){var s=Yc.callback;if(typeof s=="function"){Yc.callback=null,ea=Yc.priorityLevel;var a=s(Yc.expirationTime<=e);e=Vn.unstable_now(),typeof a=="function"?Yc.callback=a:Yc===tf(pA)&&NF(pA),wW(e)}else NF(pA);Yc=tf(pA)}if(Yc!==null)var n=!0;else{var c=tf($0);c!==null&&tD(BW,c.startTime-e),n=!1}return n}finally{Yc=null,ea=r,OF=!1}}var JPt=IW;Vn.unstable_IdlePriority=5;Vn.unstable_ImmediatePriority=1;Vn.unstable_LowPriority=4;Vn.unstable_NormalPriority=3;Vn.unstable_Profiling=null;Vn.unstable_UserBlockingPriority=2;Vn.unstable_cancelCallback=function(t){t.callback=null};Vn.unstable_continueExecution=function(){Fm||OF||(Fm=!0,Ew(vW))};Vn.unstable_getCurrentPriorityLevel=function(){return ea};Vn.unstable_getFirstCallbackNode=function(){return tf(pA)};Vn.unstable_next=function(t){switch(ea){case 1:case 2:case 3:var e=3;break;default:e=ea}var r=ea;ea=e;try{return t()}finally{ea=r}};Vn.unstable_pauseExecution=function(){};Vn.unstable_requestPaint=JPt;Vn.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=ea;ea=t;try{return e()}finally{ea=r}};Vn.unstable_scheduleCallback=function(t,e,r){var s=Vn.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0s?(t.sortIndex=r,CW($0,t),tf(pA)===null&&t===tf($0)&&(rD?FF():rD=!0,tD(BW,r-s))):(t.sortIndex=a,CW(pA,t),Fm||OF||(Fm=!0,Ew(vW))),t};Vn.unstable_wrapCallback=function(t){var e=ea;return function(){var r=ea;ea=e;try{return t.apply(this,arguments)}finally{ea=r}}}});var SW=L((jhr,LDe)=>{"use strict";LDe.exports=ODe()});var MDe=L((qhr,nD)=>{nD.exports=function(e){var r={},s=eW(),a=hn(),n=SW();function c(v){for(var D="https://reactjs.org/docs/error-decoder.html?invariant="+v,Q=1;QUe||V[Se]!==ne[Ue])return` +`+V[Se].replace(" at new "," at ");while(1<=Se&&0<=Ue);break}}}finally{ve=!1,Error.prepareStackTrace=Q}return(v=v?v.displayName||v.name:"")?ac(v):""}var lc=[],Ni=-1;function io(v){return{current:v}}function Rt(v){0>Ni||(v.current=lc[Ni],lc[Ni]=null,Ni--)}function xn(v,D){Ni++,lc[Ni]=v.current,v.current=D}var ca={},ji=io(ca),Oi=io(!1),Oa=ca;function dn(v,D){var Q=v.type.contextTypes;if(!Q)return ca;var H=v.stateNode;if(H&&H.__reactInternalMemoizedUnmaskedChildContext===D)return H.__reactInternalMemoizedMaskedChildContext;var V={},ne;for(ne in Q)V[ne]=D[ne];return H&&(v=v.stateNode,v.__reactInternalMemoizedUnmaskedChildContext=D,v.__reactInternalMemoizedMaskedChildContext=V),V}function Jn(v){return v=v.childContextTypes,v!=null}function hu(){Rt(Oi),Rt(ji)}function Ch(v,D,Q){if(ji.current!==ca)throw Error(c(168));xn(ji,D),xn(Oi,Q)}function La(v,D,Q){var H=v.stateNode;if(v=D.childContextTypes,typeof H.getChildContext!="function")return Q;H=H.getChildContext();for(var V in H)if(!(V in v))throw Error(c(108,g(D)||"Unknown",V));return s({},Q,H)}function Ma(v){return v=(v=v.stateNode)&&v.__reactInternalMemoizedMergedChildContext||ca,Oa=ji.current,xn(ji,v),xn(Oi,Oi.current),!0}function Ua(v,D,Q){var H=v.stateNode;if(!H)throw Error(c(169));Q?(v=La(v,D,Oa),H.__reactInternalMemoizedMergedChildContext=v,Rt(Oi),Rt(ji),xn(ji,v)):Rt(Oi),xn(Oi,Q)}var Xe=null,Ha=null,gf=n.unstable_now;gf();var cc=0,wn=8;function ua(v){if(1&v)return wn=15,1;if(2&v)return wn=14,2;if(4&v)return wn=13,4;var D=24&v;return D!==0?(wn=12,D):v&32?(wn=11,32):(D=192&v,D!==0?(wn=10,D):v&256?(wn=9,256):(D=3584&v,D!==0?(wn=8,D):v&4096?(wn=7,4096):(D=4186112&v,D!==0?(wn=6,D):(D=62914560&v,D!==0?(wn=5,D):v&67108864?(wn=4,67108864):v&134217728?(wn=3,134217728):(D=805306368&v,D!==0?(wn=2,D):1073741824&v?(wn=1,1073741824):(wn=8,v))))))}function _A(v){switch(v){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function UA(v){switch(v){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(c(358,v))}}function fa(v,D){var Q=v.pendingLanes;if(Q===0)return wn=0;var H=0,V=0,ne=v.expiredLanes,Se=v.suspendedLanes,Ue=v.pingedLanes;if(ne!==0)H=ne,V=wn=15;else if(ne=Q&134217727,ne!==0){var At=ne&~Se;At!==0?(H=ua(At),V=wn):(Ue&=ne,Ue!==0&&(H=ua(Ue),V=wn))}else ne=Q&~Se,ne!==0?(H=ua(ne),V=wn):Ue!==0&&(H=ua(Ue),V=wn);if(H===0)return 0;if(H=31-ns(H),H=Q&((0>H?0:1<Q;Q++)D.push(v);return D}function ja(v,D,Q){v.pendingLanes|=D;var H=D-1;v.suspendedLanes&=H,v.pingedLanes&=H,v=v.eventTimes,D=31-ns(D),v[D]=Q}var ns=Math.clz32?Math.clz32:fc,uc=Math.log,gu=Math.LN2;function fc(v){return v===0?32:31-(uc(v)/gu|0)|0}var qa=n.unstable_runWithPriority,Li=n.unstable_scheduleCallback,Cs=n.unstable_cancelCallback,Sl=n.unstable_shouldYield,df=n.unstable_requestPaint,Ac=n.unstable_now,wi=n.unstable_getCurrentPriorityLevel,Qn=n.unstable_ImmediatePriority,pc=n.unstable_UserBlockingPriority,Je=n.unstable_NormalPriority,st=n.unstable_LowPriority,St=n.unstable_IdlePriority,lr={},ee=df!==void 0?df:function(){},Ie=null,Oe=null,ht=!1,mt=Ac(),Dt=1e4>mt?Ac:function(){return Ac()-mt};function tr(){switch(wi()){case Qn:return 99;case pc:return 98;case Je:return 97;case st:return 96;case St:return 95;default:throw Error(c(332))}}function fn(v){switch(v){case 99:return Qn;case 98:return pc;case 97:return Je;case 96:return st;case 95:return St;default:throw Error(c(332))}}function ai(v,D){return v=fn(v),qa(v,D)}function qi(v,D,Q){return v=fn(v),Li(v,D,Q)}function Tn(){if(Oe!==null){var v=Oe;Oe=null,Cs(v)}Ga()}function Ga(){if(!ht&&Ie!==null){ht=!0;var v=0;try{var D=Ie;ai(99,function(){for(;vRn?(Un=kr,kr=null):Un=kr.sibling;var zr=Xt($e,kr,pt[Rn],Zt);if(zr===null){kr===null&&(kr=Un);break}v&&kr&&zr.alternate===null&&D($e,kr),qe=ne(zr,qe,Rn),Xn===null?Sr=zr:Xn.sibling=zr,Xn=zr,kr=Un}if(Rn===pt.length)return Q($e,kr),Sr;if(kr===null){for(;RnRn?(Un=kr,kr=null):Un=kr.sibling;var li=Xt($e,kr,zr.value,Zt);if(li===null){kr===null&&(kr=Un);break}v&&kr&&li.alternate===null&&D($e,kr),qe=ne(li,qe,Rn),Xn===null?Sr=li:Xn.sibling=li,Xn=li,kr=Un}if(zr.done)return Q($e,kr),Sr;if(kr===null){for(;!zr.done;Rn++,zr=pt.next())zr=Lr($e,zr.value,Zt),zr!==null&&(qe=ne(zr,qe,Rn),Xn===null?Sr=zr:Xn.sibling=zr,Xn=zr);return Sr}for(kr=H($e,kr);!zr.done;Rn++,zr=pt.next())zr=zn(kr,$e,Rn,zr.value,Zt),zr!==null&&(v&&zr.alternate!==null&&kr.delete(zr.key===null?Rn:zr.key),qe=ne(zr,qe,Rn),Xn===null?Sr=zr:Xn.sibling=zr,Xn=zr);return v&&kr.forEach(function(Pu){return D($e,Pu)}),Sr}return function($e,qe,pt,Zt){var Sr=typeof pt=="object"&&pt!==null&&pt.type===E&&pt.key===null;Sr&&(pt=pt.props.children);var Xn=typeof pt=="object"&&pt!==null;if(Xn)switch(pt.$$typeof){case p:e:{for(Xn=pt.key,Sr=qe;Sr!==null;){if(Sr.key===Xn){switch(Sr.tag){case 7:if(pt.type===E){Q($e,Sr.sibling),qe=V(Sr,pt.props.children),qe.return=$e,$e=qe;break e}break;default:if(Sr.elementType===pt.type){Q($e,Sr.sibling),qe=V(Sr,pt.props),qe.ref=dt($e,Sr,pt),qe.return=$e,$e=qe;break e}}Q($e,Sr);break}else D($e,Sr);Sr=Sr.sibling}pt.type===E?(qe=Qf(pt.props.children,$e.mode,Zt,pt.key),qe.return=$e,$e=qe):(Zt=od(pt.type,pt.key,pt.props,null,$e.mode,Zt),Zt.ref=dt($e,qe,pt),Zt.return=$e,$e=Zt)}return Se($e);case h:e:{for(Sr=pt.key;qe!==null;){if(qe.key===Sr)if(qe.tag===4&&qe.stateNode.containerInfo===pt.containerInfo&&qe.stateNode.implementation===pt.implementation){Q($e,qe.sibling),qe=V(qe,pt.children||[]),qe.return=$e,$e=qe;break e}else{Q($e,qe);break}else D($e,qe);qe=qe.sibling}qe=Ro(pt,$e.mode,Zt),qe.return=$e,$e=qe}return Se($e)}if(typeof pt=="string"||typeof pt=="number")return pt=""+pt,qe!==null&&qe.tag===6?(Q($e,qe.sibling),qe=V(qe,pt),qe.return=$e,$e=qe):(Q($e,qe),qe=k2(pt,$e.mode,Zt),qe.return=$e,$e=qe),Se($e);if(yf(pt))return mi($e,qe,pt,Zt);if(Ce(pt))return Za($e,qe,pt,Zt);if(Xn&&mu($e,pt),typeof pt>"u"&&!Sr)switch($e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(c(152,g($e.type)||"Component"))}return Q($e,qe)}}var _g=By(!0),n2=By(!1),bh={},ur=io(bh),zi=io(bh),Ef=io(bh);function Wa(v){if(v===bh)throw Error(c(174));return v}function Ug(v,D){xn(Ef,D),xn(zi,v),xn(ur,bh),v=gt(D),Rt(ur),xn(ur,v)}function yu(){Rt(ur),Rt(zi),Rt(Ef)}function If(v){var D=Wa(Ef.current),Q=Wa(ur.current);D=j(Q,v.type,D),Q!==D&&(xn(zi,v),xn(ur,D))}function wt(v){zi.current===v&&(Rt(ur),Rt(zi))}var gi=io(0);function WA(v){for(var D=v;D!==null;){if(D.tag===13){var Q=D.memoizedState;if(Q!==null&&(Q=Q.dehydrated,Q===null||gr(Q)||So(Q)))return D}else if(D.tag===19&&D.memoizedProps.revealOrder!==void 0){if(D.flags&64)return D}else if(D.child!==null){D.child.return=D,D=D.child;continue}if(D===v)break;for(;D.sibling===null;){if(D.return===null||D.return===v)return null;D=D.return}D.sibling.return=D.return,D=D.sibling}return null}var Ya=null,pa=null,Va=!1;function Hg(v,D){var Q=za(5,null,null,0);Q.elementType="DELETED",Q.type="DELETED",Q.stateNode=D,Q.return=v,Q.flags=8,v.lastEffect!==null?(v.lastEffect.nextEffect=Q,v.lastEffect=Q):v.firstEffect=v.lastEffect=Q}function Ph(v,D){switch(v.tag){case 5:return D=la(D,v.type,v.pendingProps),D!==null?(v.stateNode=D,!0):!1;case 6:return D=OA(D,v.pendingProps),D!==null?(v.stateNode=D,!0):!1;case 13:return!1;default:return!1}}function jg(v){if(Va){var D=pa;if(D){var Q=D;if(!Ph(v,D)){if(D=Me(Q),!D||!Ph(v,D)){v.flags=v.flags&-1025|2,Va=!1,Ya=v;return}Hg(Ya,Q)}Ya=v,pa=fu(D)}else v.flags=v.flags&-1025|2,Va=!1,Ya=v}}function vy(v){for(v=v.return;v!==null&&v.tag!==5&&v.tag!==3&&v.tag!==13;)v=v.return;Ya=v}function YA(v){if(!Z||v!==Ya)return!1;if(!Va)return vy(v),Va=!0,!1;var D=v.type;if(v.tag!==5||D!=="head"&&D!=="body"&&!it(D,v.memoizedProps))for(D=pa;D;)Hg(v,D),D=Me(D);if(vy(v),v.tag===13){if(!Z)throw Error(c(316));if(v=v.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(c(317));pa=LA(v)}else pa=Ya?Me(v.stateNode):null;return!0}function qg(){Z&&(pa=Ya=null,Va=!1)}var Eu=[];function Iu(){for(var v=0;vne))throw Error(c(301));ne+=1,xi=is=null,D.updateQueue=null,Cf.current=re,v=Q(H,V)}while(wf)}if(Cf.current=kt,D=is!==null&&is.next!==null,Cu=0,xi=is=qn=null,VA=!1,D)throw Error(c(300));return v}function ss(){var v={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xi===null?qn.memoizedState=xi=v:xi=xi.next=v,xi}function xl(){if(is===null){var v=qn.alternate;v=v!==null?v.memoizedState:null}else v=is.next;var D=xi===null?qn.memoizedState:xi.next;if(D!==null)xi=D,is=v;else{if(v===null)throw Error(c(310));is=v,v={memoizedState:is.memoizedState,baseState:is.baseState,baseQueue:is.baseQueue,queue:is.queue,next:null},xi===null?qn.memoizedState=xi=v:xi=xi.next=v}return xi}function ko(v,D){return typeof D=="function"?D(v):D}function Bf(v){var D=xl(),Q=D.queue;if(Q===null)throw Error(c(311));Q.lastRenderedReducer=v;var H=is,V=H.baseQueue,ne=Q.pending;if(ne!==null){if(V!==null){var Se=V.next;V.next=ne.next,ne.next=Se}H.baseQueue=V=ne,Q.pending=null}if(V!==null){V=V.next,H=H.baseState;var Ue=Se=ne=null,At=V;do{var Gt=At.lane;if((Cu&Gt)===Gt)Ue!==null&&(Ue=Ue.next={lane:0,action:At.action,eagerReducer:At.eagerReducer,eagerState:At.eagerState,next:null}),H=At.eagerReducer===v?At.eagerState:v(H,At.action);else{var vr={lane:Gt,action:At.action,eagerReducer:At.eagerReducer,eagerState:At.eagerState,next:null};Ue===null?(Se=Ue=vr,ne=H):Ue=Ue.next=vr,qn.lanes|=Gt,$g|=Gt}At=At.next}while(At!==null&&At!==V);Ue===null?ne=H:Ue.next=Se,Do(H,D.memoizedState)||(Ke=!0),D.memoizedState=H,D.baseState=ne,D.baseQueue=Ue,Q.lastRenderedState=H}return[D.memoizedState,Q.dispatch]}function vf(v){var D=xl(),Q=D.queue;if(Q===null)throw Error(c(311));Q.lastRenderedReducer=v;var H=Q.dispatch,V=Q.pending,ne=D.memoizedState;if(V!==null){Q.pending=null;var Se=V=V.next;do ne=v(ne,Se.action),Se=Se.next;while(Se!==V);Do(ne,D.memoizedState)||(Ke=!0),D.memoizedState=ne,D.baseQueue===null&&(D.baseState=ne),Q.lastRenderedState=ne}return[ne,H]}function kl(v,D,Q){var H=D._getVersion;H=H(D._source);var V=y?D._workInProgressVersionPrimary:D._workInProgressVersionSecondary;if(V!==null?v=V===H:(v=v.mutableReadLanes,(v=(Cu&v)===v)&&(y?D._workInProgressVersionPrimary=H:D._workInProgressVersionSecondary=H,Eu.push(D))),v)return Q(D._source);throw Eu.push(D),Error(c(350))}function yn(v,D,Q,H){var V=oo;if(V===null)throw Error(c(349));var ne=D._getVersion,Se=ne(D._source),Ue=Cf.current,At=Ue.useState(function(){return kl(V,D,Q)}),Gt=At[1],vr=At[0];At=xi;var Lr=v.memoizedState,Xt=Lr.refs,zn=Xt.getSnapshot,mi=Lr.source;Lr=Lr.subscribe;var Za=qn;return v.memoizedState={refs:Xt,source:D,subscribe:H},Ue.useEffect(function(){Xt.getSnapshot=Q,Xt.setSnapshot=Gt;var $e=ne(D._source);if(!Do(Se,$e)){$e=Q(D._source),Do(vr,$e)||(Gt($e),$e=vs(Za),V.mutableReadLanes|=$e&V.pendingLanes),$e=V.mutableReadLanes,V.entangledLanes|=$e;for(var qe=V.entanglements,pt=$e;0Q?98:Q,function(){v(!0)}),ai(97I2&&(D.flags|=64,V=!0,$A(H,!1),D.lanes=33554432)}else{if(!V)if(v=WA(ne),v!==null){if(D.flags|=64,V=!0,v=v.updateQueue,v!==null&&(D.updateQueue=v,D.flags|=4),$A(H,!0),H.tail===null&&H.tailMode==="hidden"&&!ne.alternate&&!Va)return D=D.lastEffect=H.lastEffect,D!==null&&(D.nextEffect=null),null}else 2*Dt()-H.renderingStartTime>I2&&Q!==1073741824&&(D.flags|=64,V=!0,$A(H,!1),D.lanes=33554432);H.isBackwards?(ne.sibling=D.child,D.child=ne):(v=H.last,v!==null?v.sibling=ne:D.child=ne,H.last=ne)}return H.tail!==null?(v=H.tail,H.rendering=v,H.tail=v.sibling,H.lastEffect=D.lastEffect,H.renderingStartTime=Dt(),v.sibling=null,D=gi.current,xn(gi,V?D&1|2:D&1),v):null;case 23:case 24:return D2(),v!==null&&v.memoizedState!==null!=(D.memoizedState!==null)&&H.mode!=="unstable-defer-without-hiding"&&(D.flags|=4),null}throw Error(c(156,D.tag))}function $L(v){switch(v.tag){case 1:Jn(v.type)&&hu();var D=v.flags;return D&4096?(v.flags=D&-4097|64,v):null;case 3:if(yu(),Rt(Oi),Rt(ji),Iu(),D=v.flags,D&64)throw Error(c(285));return v.flags=D&-4097|64,v;case 5:return wt(v),null;case 13:return Rt(gi),D=v.flags,D&4096?(v.flags=D&-4097|64,v):null;case 19:return Rt(gi),null;case 4:return yu(),null;case 10:return Lg(v),null;case 23:case 24:return D2(),null;default:return null}}function Vg(v,D){try{var Q="",H=D;do Q+=r2(H),H=H.return;while(H);var V=Q}catch(ne){V=` +Error generating stack: `+ne.message+` +`+ne.stack}return{value:v,source:D,stack:V}}function Kg(v,D){try{console.error(D.value)}catch(Q){setTimeout(function(){throw Q})}}var eM=typeof WeakMap=="function"?WeakMap:Map;function a2(v,D,Q){Q=bl(-1,Q),Q.tag=3,Q.payload={element:null};var H=D.value;return Q.callback=function(){Uy||(Uy=!0,C2=H),Kg(v,D)},Q}function Jg(v,D,Q){Q=bl(-1,Q),Q.tag=3;var H=v.type.getDerivedStateFromError;if(typeof H=="function"){var V=D.value;Q.payload=function(){return Kg(v,D),H(V)}}var ne=v.stateNode;return ne!==null&&typeof ne.componentDidCatch=="function"&&(Q.callback=function(){typeof H!="function"&&(gc===null?gc=new Set([this]):gc.add(this),Kg(v,D));var Se=D.stack;this.componentDidCatch(D.value,{componentStack:Se!==null?Se:""})}),Q}var tM=typeof WeakSet=="function"?WeakSet:Set;function l2(v){var D=v.ref;if(D!==null)if(typeof D=="function")try{D(null)}catch(Q){kf(v,Q)}else D.current=null}function xy(v,D){switch(D.tag){case 0:case 11:case 15:case 22:return;case 1:if(D.flags&256&&v!==null){var Q=v.memoizedProps,H=v.memoizedState;v=D.stateNode,D=v.getSnapshotBeforeUpdate(D.elementType===D.type?Q:bo(D.type,Q),H),v.__reactInternalSnapshotBeforeUpdate=D}return;case 3:F&&D.flags&256&&Rs(D.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(c(163))}function Nh(v,D){if(D=D.updateQueue,D=D!==null?D.lastEffect:null,D!==null){var Q=D=D.next;do{if((Q.tag&v)===v){var H=Q.destroy;Q.destroy=void 0,H!==void 0&&H()}Q=Q.next}while(Q!==D)}}function vP(v,D,Q){switch(Q.tag){case 0:case 11:case 15:case 22:if(D=Q.updateQueue,D=D!==null?D.lastEffect:null,D!==null){v=D=D.next;do{if((v.tag&3)===3){var H=v.create;v.destroy=H()}v=v.next}while(v!==D)}if(D=Q.updateQueue,D=D!==null?D.lastEffect:null,D!==null){v=D=D.next;do{var V=v;H=V.next,V=V.tag,V&4&&V&1&&(MP(Q,v),uM(Q,v)),v=H}while(v!==D)}return;case 1:v=Q.stateNode,Q.flags&4&&(D===null?v.componentDidMount():(H=Q.elementType===Q.type?D.memoizedProps:bo(Q.type,D.memoizedProps),v.componentDidUpdate(H,D.memoizedState,v.__reactInternalSnapshotBeforeUpdate))),D=Q.updateQueue,D!==null&&Cy(Q,D,v);return;case 3:if(D=Q.updateQueue,D!==null){if(v=null,Q.child!==null)switch(Q.child.tag){case 5:v=Re(Q.child.stateNode);break;case 1:v=Q.child.stateNode}Cy(Q,D,v)}return;case 5:v=Q.stateNode,D===null&&Q.flags&4&&eo(v,Q.type,Q.memoizedProps,Q);return;case 6:return;case 4:return;case 12:return;case 13:Z&&Q.memoizedState===null&&(Q=Q.alternate,Q!==null&&(Q=Q.memoizedState,Q!==null&&(Q=Q.dehydrated,Q!==null&&Au(Q))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(c(163))}function SP(v,D){if(F)for(var Q=v;;){if(Q.tag===5){var H=Q.stateNode;D?Eh(H):ro(Q.stateNode,Q.memoizedProps)}else if(Q.tag===6)H=Q.stateNode,D?Ih(H):jn(H,Q.memoizedProps);else if((Q.tag!==23&&Q.tag!==24||Q.memoizedState===null||Q===v)&&Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===v)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===v)return;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}}function ky(v,D){if(Ha&&typeof Ha.onCommitFiberUnmount=="function")try{Ha.onCommitFiberUnmount(Xe,D)}catch{}switch(D.tag){case 0:case 11:case 14:case 15:case 22:if(v=D.updateQueue,v!==null&&(v=v.lastEffect,v!==null)){var Q=v=v.next;do{var H=Q,V=H.destroy;if(H=H.tag,V!==void 0)if(H&4)MP(D,Q);else{H=D;try{V()}catch(ne){kf(H,ne)}}Q=Q.next}while(Q!==v)}break;case 1:if(l2(D),v=D.stateNode,typeof v.componentWillUnmount=="function")try{v.props=D.memoizedProps,v.state=D.memoizedState,v.componentWillUnmount()}catch(ne){kf(D,ne)}break;case 5:l2(D);break;case 4:F?xP(v,D):z&&z&&(D=D.stateNode.containerInfo,v=lu(D),FA(D,v))}}function DP(v,D){for(var Q=D;;)if(ky(v,Q),Q.child===null||F&&Q.tag===4){if(Q===D)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===D)return;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}else Q.child.return=Q,Q=Q.child}function Qy(v){v.alternate=null,v.child=null,v.dependencies=null,v.firstEffect=null,v.lastEffect=null,v.memoizedProps=null,v.memoizedState=null,v.pendingProps=null,v.return=null,v.updateQueue=null}function bP(v){return v.tag===5||v.tag===3||v.tag===4}function PP(v){if(F){e:{for(var D=v.return;D!==null;){if(bP(D))break e;D=D.return}throw Error(c(160))}var Q=D;switch(D=Q.stateNode,Q.tag){case 5:var H=!1;break;case 3:D=D.containerInfo,H=!0;break;case 4:D=D.containerInfo,H=!0;break;default:throw Error(c(161))}Q.flags&16&&(pf(D),Q.flags&=-17);e:t:for(Q=v;;){for(;Q.sibling===null;){if(Q.return===null||bP(Q.return)){Q=null;break e}Q=Q.return}for(Q.sibling.return=Q.return,Q=Q.sibling;Q.tag!==5&&Q.tag!==6&&Q.tag!==18;){if(Q.flags&2||Q.child===null||Q.tag===4)continue t;Q.child.return=Q,Q=Q.child}if(!(Q.flags&2)){Q=Q.stateNode;break e}}H?c2(v,Q,D):u2(v,Q,D)}}function c2(v,D,Q){var H=v.tag,V=H===5||H===6;if(V)v=V?v.stateNode:v.stateNode.instance,D?to(Q,v,D):wo(Q,v);else if(H!==4&&(v=v.child,v!==null))for(c2(v,D,Q),v=v.sibling;v!==null;)c2(v,D,Q),v=v.sibling}function u2(v,D,Q){var H=v.tag,V=H===5||H===6;if(V)v=V?v.stateNode:v.stateNode.instance,D?Hi(Q,v,D):oi(Q,v);else if(H!==4&&(v=v.child,v!==null))for(u2(v,D,Q),v=v.sibling;v!==null;)u2(v,D,Q),v=v.sibling}function xP(v,D){for(var Q=D,H=!1,V,ne;;){if(!H){H=Q.return;e:for(;;){if(H===null)throw Error(c(160));switch(V=H.stateNode,H.tag){case 5:ne=!1;break e;case 3:V=V.containerInfo,ne=!0;break e;case 4:V=V.containerInfo,ne=!0;break e}H=H.return}H=!0}if(Q.tag===5||Q.tag===6)DP(v,Q),ne?RA(V,Q.stateNode):vo(V,Q.stateNode);else if(Q.tag===4){if(Q.child!==null){V=Q.stateNode.containerInfo,ne=!0,Q.child.return=Q,Q=Q.child;continue}}else if(ky(v,Q),Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===D)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===D)return;Q=Q.return,Q.tag===4&&(H=!1)}Q.sibling.return=Q.return,Q=Q.sibling}}function f2(v,D){if(F){switch(D.tag){case 0:case 11:case 14:case 15:case 22:Nh(3,D);return;case 1:return;case 5:var Q=D.stateNode;if(Q!=null){var H=D.memoizedProps;v=v!==null?v.memoizedProps:H;var V=D.type,ne=D.updateQueue;D.updateQueue=null,ne!==null&&Bo(Q,ne,V,v,H,D)}return;case 6:if(D.stateNode===null)throw Error(c(162));Q=D.memoizedProps,rs(D.stateNode,v!==null?v.memoizedProps:Q,Q);return;case 3:Z&&(D=D.stateNode,D.hydrate&&(D.hydrate=!1,MA(D.containerInfo)));return;case 12:return;case 13:kP(D),zg(D);return;case 19:zg(D);return;case 17:return;case 23:case 24:SP(D,D.memoizedState!==null);return}throw Error(c(163))}switch(D.tag){case 0:case 11:case 14:case 15:case 22:Nh(3,D);return;case 12:return;case 13:kP(D),zg(D);return;case 19:zg(D);return;case 3:Z&&(Q=D.stateNode,Q.hydrate&&(Q.hydrate=!1,MA(Q.containerInfo)));break;case 23:case 24:return}e:if(z){switch(D.tag){case 1:case 5:case 6:case 20:break e;case 3:case 4:D=D.stateNode,FA(D.containerInfo,D.pendingChildren);break e}throw Error(c(163))}}function kP(v){v.memoizedState!==null&&(E2=Dt(),F&&SP(v.child,!0))}function zg(v){var D=v.updateQueue;if(D!==null){v.updateQueue=null;var Q=v.stateNode;Q===null&&(Q=v.stateNode=new tM),D.forEach(function(H){var V=AM.bind(null,v,H);Q.has(H)||(Q.add(H),H.then(V,V))})}}function rM(v,D){return v!==null&&(v=v.memoizedState,v===null||v.dehydrated!==null)?(D=D.memoizedState,D!==null&&D.dehydrated===null):!1}var Ty=0,Ry=1,Fy=2,Zg=3,Ny=4;if(typeof Symbol=="function"&&Symbol.for){var Xg=Symbol.for;Ty=Xg("selector.component"),Ry=Xg("selector.has_pseudo_class"),Fy=Xg("selector.role"),Zg=Xg("selector.test_id"),Ny=Xg("selector.text")}function Oy(v){var D=$(v);if(D!=null){if(typeof D.memoizedProps["data-testname"]!="string")throw Error(c(364));return D}if(v=ir(v),v===null)throw Error(c(362));return v.stateNode.current}function Df(v,D){switch(D.$$typeof){case Ty:if(v.type===D.value)return!0;break;case Ry:e:{D=D.value,v=[v,0];for(var Q=0;Q";case Ry:return":has("+(bf(v)||"")+")";case Fy:return'[role="'+v.value+'"]';case Ny:return'"'+v.value+'"';case Zg:return'[data-testname="'+v.value+'"]';default:throw Error(c(365,v))}}function A2(v,D){var Q=[];v=[v,0];for(var H=0;HV&&(V=Se),Q&=~ne}if(Q=V,Q=Dt()-Q,Q=(120>Q?120:480>Q?480:1080>Q?1080:1920>Q?1920:3e3>Q?3e3:4320>Q?4320:1960*iM(Q/1960))-Q,10 component higher in the tree to provide a loading indicator or placeholder to display.`)}Bs!==5&&(Bs=2),At=Vg(At,Ue),Xt=Se;do{switch(Xt.tag){case 3:ne=At,Xt.flags|=4096,D&=-D,Xt.lanes|=D;var Xn=a2(Xt,ne,D);Iy(Xt,Xn);break e;case 1:ne=At;var kr=Xt.type,Rn=Xt.stateNode;if(!(Xt.flags&64)&&(typeof kr.getDerivedStateFromError=="function"||Rn!==null&&typeof Rn.componentDidCatch=="function"&&(gc===null||!gc.has(Rn)))){Xt.flags|=4096,D&=-D,Xt.lanes|=D;var Un=Jg(Xt,ne,D);Iy(Xt,Un);break e}}Xt=Xt.return}while(Xt!==null)}LP(Q)}catch(zr){D=zr,Zi===Q&&Q!==null&&(Zi=Q=Q.return);continue}break}while(!0)}function NP(){var v=My.current;return My.current=kt,v===null?kt:v}function sd(v,D){var Q=xr;xr|=16;var H=NP();oo===v&&Os===D||_h(v,D);do try{oM();break}catch(V){FP(v,V)}while(!0);if(Ng(),xr=Q,My.current=H,Zi!==null)throw Error(c(261));return oo=null,Os=0,Bs}function oM(){for(;Zi!==null;)OP(Zi)}function aM(){for(;Zi!==null&&!Sl();)OP(Zi)}function OP(v){var D=HP(v.alternate,v,ep);v.memoizedProps=v.pendingProps,D===null?LP(v):Zi=D,h2.current=null}function LP(v){var D=v;do{var Q=D.alternate;if(v=D.return,D.flags&2048){if(Q=$L(D),Q!==null){Q.flags&=2047,Zi=Q;return}v!==null&&(v.firstEffect=v.lastEffect=null,v.flags|=2048)}else{if(Q=XL(Q,D,ep),Q!==null){Zi=Q;return}if(Q=D,Q.tag!==24&&Q.tag!==23||Q.memoizedState===null||ep&1073741824||!(Q.mode&4)){for(var H=0,V=Q.child;V!==null;)H|=V.lanes|V.childLanes,V=V.sibling;Q.childLanes=H}v!==null&&!(v.flags&2048)&&(v.firstEffect===null&&(v.firstEffect=D.firstEffect),D.lastEffect!==null&&(v.lastEffect!==null&&(v.lastEffect.nextEffect=D.firstEffect),v.lastEffect=D.lastEffect),1Dt()-E2?_h(v,0):m2|=Q),da(v,D)}function AM(v,D){var Q=v.stateNode;Q!==null&&Q.delete(D),D=0,D===0&&(D=v.mode,D&2?D&4?(Su===0&&(Su=Oh),D=kn(62914560&~Su),D===0&&(D=4194304)):D=tr()===99?1:2:D=1),Q=To(),v=qy(v,D),v!==null&&(ja(v,D,Q),da(v,Q))}var HP;HP=function(v,D,Q){var H=D.lanes;if(v!==null)if(v.memoizedProps!==D.pendingProps||Oi.current)Ke=!0;else if(Q&H)Ke=!!(v.flags&16384);else{switch(Ke=!1,D.tag){case 3:by(D),qg();break;case 5:If(D);break;case 1:Jn(D.type)&&Ma(D);break;case 4:Ug(D,D.stateNode.containerInfo);break;case 10:Og(D,D.memoizedProps.value);break;case 13:if(D.memoizedState!==null)return Q&D.child.childLanes?s2(v,D,Q):(xn(gi,gi.current&1),D=Gn(v,D,Q),D!==null?D.sibling:null);xn(gi,gi.current&1);break;case 19:if(H=(Q&D.childLanes)!==0,v.flags&64){if(H)return BP(v,D,Q);D.flags|=64}var V=D.memoizedState;if(V!==null&&(V.rendering=null,V.tail=null,V.lastEffect=null),xn(gi,gi.current),H)break;return null;case 23:case 24:return D.lanes=0,di(v,D,Q)}return Gn(v,D,Q)}else Ke=!1;switch(D.lanes=0,D.tag){case 2:if(H=D.type,v!==null&&(v.alternate=null,D.alternate=null,D.flags|=2),v=D.pendingProps,V=dn(D,ji.current),mf(D,Q),V=Wg(null,D,H,v,V,Q),D.flags|=1,typeof V=="object"&&V!==null&&typeof V.render=="function"&&V.$$typeof===void 0){if(D.tag=1,D.memoizedState=null,D.updateQueue=null,Jn(H)){var ne=!0;Ma(D)}else ne=!1;D.memoizedState=V.state!==null&&V.state!==void 0?V.state:null,Dh(D);var Se=H.getDerivedStateFromProps;typeof Se=="function"&&jA(D,H,Se,v),V.updater=qA,D.stateNode=V,V._reactInternals=D,xo(D,H,v,Q),D=i2(null,D,H,!0,ne,Q)}else D.tag=0,ft(null,D,V,Q),D=D.child;return D;case 16:V=D.elementType;e:{switch(v!==null&&(v.alternate=null,D.alternate=null,D.flags|=2),v=D.pendingProps,ne=V._init,V=ne(V._payload),D.type=V,ne=D.tag=hM(V),v=bo(V,v),ne){case 0:D=zA(null,D,V,v,Q);break e;case 1:D=wP(null,D,V,v,Q);break e;case 11:D=dr(null,D,V,v,Q);break e;case 14:D=Br(null,D,V,bo(V.type,v),H,Q);break e}throw Error(c(306,V,""))}return D;case 0:return H=D.type,V=D.pendingProps,V=D.elementType===H?V:bo(H,V),zA(v,D,H,V,Q);case 1:return H=D.type,V=D.pendingProps,V=D.elementType===H?V:bo(H,V),wP(v,D,H,V,Q);case 3:if(by(D),H=D.updateQueue,v===null||H===null)throw Error(c(282));if(H=D.pendingProps,V=D.memoizedState,V=V!==null?V.element:null,Mg(v,D),HA(D,H,null,Q),H=D.memoizedState.element,H===V)qg(),D=Gn(v,D,Q);else{if(V=D.stateNode,(ne=V.hydrate)&&(Z?(pa=fu(D.stateNode.containerInfo),Ya=D,ne=Va=!0):ne=!1),ne){if(Z&&(v=V.mutableSourceEagerHydrationData,v!=null))for(V=0;V=Gt&&ne>=Lr&&V<=vr&&Se<=Xt){v.splice(D,1);break}else if(H!==Gt||Q.width!==At.width||XtSe){if(!(ne!==Lr||Q.height!==At.height||vrV)){Gt>H&&(At.width+=Gt-H,At.x=H),vrne&&(At.height+=Lr-ne,At.y=ne),XtQ&&(Q=Se)),Se ")+` + +No matching component was found for: + `)+v.join(" > ")}return null},r.getPublicRootInstance=function(v){if(v=v.current,!v.child)return null;switch(v.child.tag){case 5:return Re(v.child.stateNode);default:return v.child.stateNode}},r.injectIntoDevTools=function(v){if(v={bundleType:v.bundleType,version:v.version,rendererPackageName:v.rendererPackageName,rendererConfig:v.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:f.ReactCurrentDispatcher,findHostInstanceByFiber:dM,findFiberByHostInstance:v.findFiberByHostInstance||mM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")v=!1;else{var D=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!D.isDisabled&&D.supportsFiber)try{Xe=D.inject(v),Ha=D}catch{}v=!0}return v},r.observeVisibleRects=function(v,D,Q,H){if(!qt)throw Error(c(363));v=p2(v,D);var V=nn(v,Q,H).disconnect;return{disconnect:function(){V()}}},r.registerMutableSourceForHydration=function(v,D){var Q=D._getVersion;Q=Q(D._source),v.mutableSourceEagerHydrationData==null?v.mutableSourceEagerHydrationData=[D,Q]:v.mutableSourceEagerHydrationData.push(D,Q)},r.runWithPriority=function(v,D){var Q=cc;try{return cc=v,D()}finally{cc=Q}},r.shouldSuspend=function(){return!1},r.unbatchedUpdates=function(v,D){var Q=xr;xr&=-2,xr|=8;try{return v(D)}finally{xr=Q,xr===0&&(Pf(),Tn())}},r.updateContainer=function(v,D,Q,H){var V=D.current,ne=To(),Se=vs(V);e:if(Q){Q=Q._reactInternals;t:{if(we(Q)!==Q||Q.tag!==1)throw Error(c(170));var Ue=Q;do{switch(Ue.tag){case 3:Ue=Ue.stateNode.context;break t;case 1:if(Jn(Ue.type)){Ue=Ue.stateNode.__reactInternalMemoizedMergedChildContext;break t}}Ue=Ue.return}while(Ue!==null);throw Error(c(171))}if(Q.tag===1){var At=Q.type;if(Jn(At)){Q=La(Q,At,Ue);break e}}Q=Ue}else Q=ca;return D.context===null?D.context=Q:D.pendingContext=Q,D=bl(ne,Se),D.payload={element:v},H=H===void 0?null:H,H!==null&&(D.callback=H),Pl(V,D),Rl(V,Se,ne),Se},r}});var UDe=L((Ghr,_De)=>{"use strict";_De.exports=MDe()});var jDe=L((Whr,HDe)=>{"use strict";var zPt={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};HDe.exports=zPt});var YDe=L((Yhr,WDe)=>{"use strict";var ZPt=Object.assign||function(t){for(var e=1;e"}}]),t}(),qDe=function(){LF(t,null,[{key:"fromJS",value:function(r){var s=r.width,a=r.height;return new t(s,a)}}]);function t(e,r){bW(this,t),this.width=e,this.height=r}return LF(t,[{key:"fromJS",value:function(r){r(this.width,this.height)}},{key:"toString",value:function(){return""}}]),t}(),GDe=function(){function t(e,r){bW(this,t),this.unit=e,this.value=r}return LF(t,[{key:"fromJS",value:function(r){r(this.unit,this.value)}},{key:"toString",value:function(){switch(this.unit){case rf.UNIT_POINT:return String(this.value);case rf.UNIT_PERCENT:return this.value+"%";case rf.UNIT_AUTO:return"auto";default:return this.value+"?"}}},{key:"valueOf",value:function(){return this.value}}]),t}();WDe.exports=function(t,e){function r(c,f,p){var h=c[f];c[f]=function(){for(var E=arguments.length,C=Array(E),S=0;S1?C-1:0),P=1;P1&&arguments[1]!==void 0?arguments[1]:NaN,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:rf.DIRECTION_LTR;return c.call(this,f,p,h)}),ZPt({Config:e.Config,Node:e.Node,Layout:t("Layout",XPt),Size:t("Size",qDe),Value:t("Value",GDe),getInstanceCount:function(){return e.getInstanceCount.apply(e,arguments)}},rf)}});var VDe=L((exports,module)=>{(function(t,e){typeof define=="function"&&define.amd?define([],function(){return e}):typeof module=="object"&&module.exports?module.exports=e:(t.nbind=t.nbind||{}).init=e})(exports,function(Module,cb){typeof Module=="function"&&(cb=Module,Module={}),Module.onRuntimeInitialized=function(t,e){return function(){t&&t.apply(this,arguments);try{Module.ccall("nbind_init")}catch(r){e(r);return}e(null,{bind:Module._nbind_value,reflect:Module.NBind.reflect,queryType:Module.NBind.queryType,toggleLightGC:Module.toggleLightGC,lib:Module})}}(Module.onRuntimeInitialized,cb);var Module;Module||(Module=(typeof Module<"u"?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if(Module.ENVIRONMENT==="WEB")ENVIRONMENT_IS_WEB=!0;else if(Module.ENVIRONMENT==="WORKER")ENVIRONMENT_IS_WORKER=!0;else if(Module.ENVIRONMENT==="NODE")ENVIRONMENT_IS_NODE=!0;else if(Module.ENVIRONMENT==="SHELL")ENVIRONMENT_IS_SHELL=!0;else throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof ye=="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,r){nodeFS||(nodeFS={}("")),nodePath||(nodePath={}("")),e=nodePath.normalize(e);var s=nodeFS.readFileSync(e);return r?s:s.toString()},Module.readBinary=function(e){var r=Module.read(e,!0);return r.buffer||(r=new Uint8Array(r)),assert(r.buffer),r},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),typeof printErr<"u"&&(Module.printErr=printErr),typeof read<"u"?Module.read=read:Module.read=function(){throw"no read() available"},Module.readBinary=function(e){if(typeof readbuffer=="function")return new Uint8Array(readbuffer(e));var r=read(e,"binary");return assert(typeof r=="object"),r},typeof scriptArgs<"u"?Module.arguments=scriptArgs:typeof arguments<"u"&&(Module.arguments=arguments),typeof quit=="function"&&(Module.quit=function(t,e){quit(t)});else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(Module.read=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Module.readAsync=function(e,r,s){var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){a.status==200||a.status==0&&a.response?r(a.response):s()},a.onerror=s,a.send(null)},typeof arguments<"u"&&(Module.arguments=arguments),typeof console<"u")Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&typeof dump<"u"?function(t){dump(t)}:function(t){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),typeof Module.setWindowTitle>"u"&&(Module.setWindowTitle=function(t){document.title=t})}else throw"Unknown runtime environment. Where are we?";function globalEval(t){eval.call(null,t)}!Module.load&&Module.read&&(Module.load=function(e){globalEval(Module.read(e))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.quit||(Module.quit=function(t,e){throw e}),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(t){return tempRet0=t,t},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(t){STACKTOP=t},getNativeTypeSize:function(t){switch(t){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(t[t.length-1]==="*")return Runtime.QUANTUM_SIZE;if(t[0]==="i"){var e=parseInt(t.substr(1));return assert(e%8===0),e/8}else return 0}}},getNativeFieldSize:function(t){return Math.max(Runtime.getNativeTypeSize(t),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(t,e){return e==="double"||e==="i64"?t&7&&(assert((t&7)===4),t+=4):assert((t&3)===0),t},getAlignSize:function(t,e,r){return!r&&(t=="i64"||t=="double")?8:t?Math.min(e||(t?Runtime.getNativeFieldSize(t):0),Runtime.QUANTUM_SIZE):Math.min(e,8)},dynCall:function(t,e,r){return r&&r.length?Module["dynCall_"+t].apply(null,[e].concat(r)):Module["dynCall_"+t].call(null,e)},functionPointers:[],addFunction:function(t){for(var e=0;e>2],r=(e+t+15|0)&-16;if(HEAP32[DYNAMICTOP_PTR>>2]=r,r>=TOTAL_MEMORY){var s=enlargeMemory();if(!s)return HEAP32[DYNAMICTOP_PTR>>2]=e,0}return e},alignMemory:function(t,e){var r=t=Math.ceil(t/(e||16))*(e||16);return r},makeBigInt:function(t,e,r){var s=r?+(t>>>0)+ +(e>>>0)*4294967296:+(t>>>0)+ +(e|0)*4294967296;return s},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0;function assert(t,e){t||abort("Assertion failed: "+e)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(t){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(t){var e=Runtime.stackAlloc(t.length);return writeArrayToMemory(t,e),e},stringToC:function(t){var e=0;if(t!=null&&t!==0){var r=(t.length<<2)+1;e=Runtime.stackAlloc(r),stringToUTF8(t,e,r)}return e}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(e,r,s,a,n){var c=getCFunc(e),f=[],p=0;if(a)for(var h=0;h>0]=e;break;case"i8":HEAP8[t>>0]=e;break;case"i16":HEAP16[t>>1]=e;break;case"i32":HEAP32[t>>2]=e;break;case"i64":tempI64=[e>>>0,(tempDouble=e,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t>>2]=tempI64[0],HEAP32[t+4>>2]=tempI64[1];break;case"float":HEAPF32[t>>2]=e;break;case"double":HEAPF64[t>>3]=e;break;default:abort("invalid type for setValue: "+r)}}Module.setValue=setValue;function getValue(t,e,r){switch(e=e||"i8",e.charAt(e.length-1)==="*"&&(e="i32"),e){case"i1":return HEAP8[t>>0];case"i8":return HEAP8[t>>0];case"i16":return HEAP16[t>>1];case"i32":return HEAP32[t>>2];case"i64":return HEAP32[t>>2];case"float":return HEAPF32[t>>2];case"double":return HEAPF64[t>>3];default:abort("invalid type for setValue: "+e)}return null}Module.getValue=getValue;var ALLOC_NORMAL=0,ALLOC_STACK=1,ALLOC_STATIC=2,ALLOC_DYNAMIC=3,ALLOC_NONE=4;Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE;function allocate(t,e,r,s){var a,n;typeof t=="number"?(a=!0,n=t):(a=!1,n=t.length);var c=typeof e=="string"?e:null,f;if(r==ALLOC_NONE?f=s:f=[typeof _malloc=="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][r===void 0?ALLOC_STATIC:r](Math.max(n,c?1:e.length)),a){var s=f,p;for(assert((f&3)==0),p=f+(n&-4);s>2]=0;for(p=f+n;s>0]=0;return f}if(c==="i8")return t.subarray||t.slice?HEAPU8.set(t,f):HEAPU8.set(new Uint8Array(t),f),f;for(var h=0,E,C,S;h>0],r|=s,!(s==0&&!e||(a++,e&&a==e)););e||(e=a);var n="";if(r<128){for(var c=1024,f;e>0;)f=String.fromCharCode.apply(String,HEAPU8.subarray(t,t+Math.min(e,c))),n=n?n+f:f,t+=c,e-=c;return n}return Module.UTF8ToString(t)}Module.Pointer_stringify=Pointer_stringify;function AsciiToString(t){for(var e="";;){var r=HEAP8[t++>>0];if(!r)return e;e+=String.fromCharCode(r)}}Module.AsciiToString=AsciiToString;function stringToAscii(t,e){return writeAsciiToMemory(t,e,!1)}Module.stringToAscii=stringToAscii;var UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(t,e){for(var r=e;t[r];)++r;if(r-e>16&&t.subarray&&UTF8Decoder)return UTF8Decoder.decode(t.subarray(e,r));for(var s,a,n,c,f,p,h="";;){if(s=t[e++],!s)return h;if(!(s&128)){h+=String.fromCharCode(s);continue}if(a=t[e++]&63,(s&224)==192){h+=String.fromCharCode((s&31)<<6|a);continue}if(n=t[e++]&63,(s&240)==224?s=(s&15)<<12|a<<6|n:(c=t[e++]&63,(s&248)==240?s=(s&7)<<18|a<<12|n<<6|c:(f=t[e++]&63,(s&252)==248?s=(s&3)<<24|a<<18|n<<12|c<<6|f:(p=t[e++]&63,s=(s&1)<<30|a<<24|n<<18|c<<12|f<<6|p))),s<65536)h+=String.fromCharCode(s);else{var E=s-65536;h+=String.fromCharCode(55296|E>>10,56320|E&1023)}}}Module.UTF8ArrayToString=UTF8ArrayToString;function UTF8ToString(t){return UTF8ArrayToString(HEAPU8,t)}Module.UTF8ToString=UTF8ToString;function stringToUTF8Array(t,e,r,s){if(!(s>0))return 0;for(var a=r,n=r+s-1,c=0;c=55296&&f<=57343&&(f=65536+((f&1023)<<10)|t.charCodeAt(++c)&1023),f<=127){if(r>=n)break;e[r++]=f}else if(f<=2047){if(r+1>=n)break;e[r++]=192|f>>6,e[r++]=128|f&63}else if(f<=65535){if(r+2>=n)break;e[r++]=224|f>>12,e[r++]=128|f>>6&63,e[r++]=128|f&63}else if(f<=2097151){if(r+3>=n)break;e[r++]=240|f>>18,e[r++]=128|f>>12&63,e[r++]=128|f>>6&63,e[r++]=128|f&63}else if(f<=67108863){if(r+4>=n)break;e[r++]=248|f>>24,e[r++]=128|f>>18&63,e[r++]=128|f>>12&63,e[r++]=128|f>>6&63,e[r++]=128|f&63}else{if(r+5>=n)break;e[r++]=252|f>>30,e[r++]=128|f>>24&63,e[r++]=128|f>>18&63,e[r++]=128|f>>12&63,e[r++]=128|f>>6&63,e[r++]=128|f&63}}return e[r]=0,r-a}Module.stringToUTF8Array=stringToUTF8Array;function stringToUTF8(t,e,r){return stringToUTF8Array(t,HEAPU8,e,r)}Module.stringToUTF8=stringToUTF8;function lengthBytesUTF8(t){for(var e=0,r=0;r=55296&&s<=57343&&(s=65536+((s&1023)<<10)|t.charCodeAt(++r)&1023),s<=127?++e:s<=2047?e+=2:s<=65535?e+=3:s<=2097151?e+=4:s<=67108863?e+=5:e+=6}return e}Module.lengthBytesUTF8=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function demangle(t){var e=Module.___cxa_demangle||Module.__cxa_demangle;if(e){try{var r=t.substr(1),s=lengthBytesUTF8(r)+1,a=_malloc(s);stringToUTF8(r,a,s);var n=_malloc(4),c=e(a,0,0,n);if(getValue(n,"i32")===0&&c)return Pointer_stringify(c)}catch{}finally{a&&_free(a),n&&_free(n),c&&_free(c)}return t}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),t}function demangleAll(t){var e=/__Z[\w\d_]+/g;return t.replace(e,function(r){var s=demangle(r);return r===s?r:r+" ["+s+"]"})}function jsStackTrace(){var t=new Error;if(!t.stack){try{throw new Error(0)}catch(e){t=e}if(!t.stack)return"(no stack trace available)"}return t.stack.toString()}function stackTrace(){var t=jsStackTrace();return Module.extraStackTrace&&(t+=` +`+Module.extraStackTrace()),demangleAll(t)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY0;){var e=t.shift();if(typeof e=="function"){e();continue}var r=e.func;typeof r=="number"?e.arg===void 0?Module.dynCall_v(r):Module.dynCall_vi(r,e.arg):r(e.arg===void 0?null:e.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(t){__ATPRERUN__.unshift(t)}Module.addOnPreRun=addOnPreRun;function addOnInit(t){__ATINIT__.unshift(t)}Module.addOnInit=addOnInit;function addOnPreMain(t){__ATMAIN__.unshift(t)}Module.addOnPreMain=addOnPreMain;function addOnExit(t){__ATEXIT__.unshift(t)}Module.addOnExit=addOnExit;function addOnPostRun(t){__ATPOSTRUN__.unshift(t)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(t,e,r){var s=r>0?r:lengthBytesUTF8(t)+1,a=new Array(s),n=stringToUTF8Array(t,a,0,a.length);return e&&(a.length=n),a}Module.intArrayFromString=intArrayFromString;function intArrayToString(t){for(var e=[],r=0;r255&&(s&=255),e.push(String.fromCharCode(s))}return e.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(t,e,r){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var s,a;r&&(a=e+lengthBytesUTF8(t),s=HEAP8[a]),stringToUTF8(t,e,1/0),r&&(HEAP8[a]=s)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(t,e){HEAP8.set(t,e)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(t,e,r){for(var s=0;s>0]=t.charCodeAt(s);r||(HEAP8[e>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function t(e,r){var s=e>>>16,a=e&65535,n=r>>>16,c=r&65535;return a*c+(s*c+a*n<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(t){return froundBuffer[0]=t,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(t){t=t>>>0;for(var e=0;e<32;e++)if(t&1<<31-e)return e;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(t){return t}function addRunDependency(t){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}Module.addRunDependency=addRunDependency;function removeRunDependency(t){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),runDependencies==0&&(runDependencyWatcher!==null&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var e=dependenciesFulfilled;dependenciesFulfilled=null,e()}}Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(t,e,r,s,a,n,c,f){return _nbind.callbackSignatureList[t].apply(this,arguments)}];function _emscripten_asm_const_iiiiiiii(t,e,r,s,a,n,c,f){return ASM_CONSTS[t](e,r,s,a,n,c,f)}function _emscripten_asm_const_iiiii(t,e,r,s,a){return ASM_CONSTS[t](e,r,s,a)}function _emscripten_asm_const_iiidddddd(t,e,r,s,a,n,c,f,p){return ASM_CONSTS[t](e,r,s,a,n,c,f,p)}function _emscripten_asm_const_iiididi(t,e,r,s,a,n,c){return ASM_CONSTS[t](e,r,s,a,n,c)}function _emscripten_asm_const_iiii(t,e,r,s){return ASM_CONSTS[t](e,r,s)}function _emscripten_asm_const_iiiid(t,e,r,s,a){return ASM_CONSTS[t](e,r,s,a)}function _emscripten_asm_const_iiiiii(t,e,r,s,a,n){return ASM_CONSTS[t](e,r,s,a,n)}STATIC_BASE=Runtime.GLOBAL_BASE,STATICTOP=STATIC_BASE+12800,__ATINIT__.push({func:function(){__GLOBAL__sub_I_Yoga_cpp()}},{func:function(){__GLOBAL__sub_I_nbind_cc()}},{func:function(){__GLOBAL__sub_I_common_cc()}},{func:function(){__GLOBAL__sub_I_Binding_cc()}}),allocate([0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,192,127,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,128,191,0,0,128,191,0,0,192,127,0,0,0,0,0,0,0,0,0,0,128,63,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,190,12,0,0,200,12,0,0,208,12,0,0,216,12,0,0,230,12,0,0,242,12,0,0,1,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,192,127,3,0,0,0,180,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,182,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,4,0,0,0,183,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,184,45,0,0,185,45,0,0,181,45,0,0,181,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,148,4,0,0,3,0,0,0,187,45,0,0,164,4,0,0,188,45,0,0,2,0,0,0,189,45,0,0,164,4,0,0,188,45,0,0,185,45,0,0,164,4,0,0,185,45,0,0,164,4,0,0,188,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,6,0,0,0,1,0,0,0,7,0,0,0,183,45,0,0,182,45,0,0,181,45,0,0,190,45,0,0,190,45,0,0,182,45,0,0,182,45,0,0,185,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,185,45,0,0,48,5,0,0,3,0,0,0,56,5,0,0,1,0,0,0,189,45,0,0,185,45,0,0,164,4,0,0,76,5,0,0,2,0,0,0,191,45,0,0,186,45,0,0,182,45,0,0,185,45,0,0,192,45,0,0,185,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,76,5,0,0,76,5,0,0,136,5,0,0,182,45,0,0,181,45,0,0,2,0,0,0,190,45,0,0,136,5,0,0,56,19,0,0,156,5,0,0,2,0,0,0,184,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0,9,0,0,0,1,0,0,0,10,0,0,0,204,5,0,0,181,45,0,0,181,45,0,0,2,0,0,0,180,45,0,0,204,5,0,0,2,0,0,0,195,45,0,0,236,5,0,0,97,19,0,0,198,45,0,0,211,45,0,0,212,45,0,0,213,45,0,0,214,45,0,0,215,45,0,0,188,45,0,0,182,45,0,0,216,45,0,0,217,45,0,0,218,45,0,0,219,45,0,0,192,45,0,0,181,45,0,0,0,0,0,0,185,45,0,0,110,19,0,0,186,45,0,0,115,19,0,0,221,45,0,0,120,19,0,0,148,4,0,0,132,19,0,0,96,6,0,0,145,19,0,0,222,45,0,0,164,19,0,0,223,45,0,0,173,19,0,0,0,0,0,0,3,0,0,0,104,6,0,0,1,0,0,0,187,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,11,0,0,0,12,0,0,0,1,0,0,0,13,0,0,0,185,45,0,0,224,45,0,0,164,6,0,0,188,45,0,0,172,6,0,0,180,6,0,0,2,0,0,0,188,6,0,0,7,0,0,0,224,45,0,0,7,0,0,0,164,6,0,0,1,0,0,0,213,45,0,0,185,45,0,0,224,45,0,0,172,6,0,0,185,45,0,0,224,45,0,0,164,6,0,0,185,45,0,0,224,45,0,0,211,45,0,0,211,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,172,6,0,0,222,45,0,0,211,45,0,0,224,45,0,0,188,45,0,0,222,45,0,0,211,45,0,0,40,7,0,0,188,45,0,0,2,0,0,0,224,45,0,0,185,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,222,45,0,0,224,45,0,0,148,4,0,0,185,45,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,185,45,0,0,164,6,0,0,148,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,14,0,0,0,15,0,0,0,1,0,0,0,16,0,0,0,148,7,0,0,2,0,0,0,225,45,0,0,183,45,0,0,188,45,0,0,168,7,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,234,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,9,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,242,45,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,110,111,100,101,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,119,104,105,99,104,32,115,116,105,108,108,32,104,97,115,32,99,104,105,108,100,114,101,110,32,97,116,116,97,99,104,101,100,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,115,116,105,108,108,32,97,116,116,97,99,104,101,100,32,116,111,32,97,32,112,97,114,101,110,116,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,99,111,110,102,105,103,0,67,97,110,110,111,116,32,115,101,116,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,67,104,105,108,100,32,97,108,114,101,97,100,121,32,104,97,115,32,97,32,112,97,114,101,110,116,44,32,105,116,32,109,117,115,116,32,98,101,32,114,101,109,111,118,101,100,32,102,105,114,115,116,46,0,67,97,110,110,111,116,32,97,100,100,32,99,104,105,108,100,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,79,110,108,121,32,108,101,97,102,32,110,111,100,101,115,32,119,105,116,104,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,115,104,111,117,108,100,32,109,97,110,117,97,108,108,121,32,109,97,114,107,32,116,104,101,109,115,101,108,118,101,115,32,97,115,32,100,105,114,116,121,0,67,97,110,110,111,116,32,103,101,116,32,108,97,121,111,117,116,32,112,114,111,112,101,114,116,105,101,115,32,111,102,32,109,117,108,116,105,45,101,100,103,101,32,115,104,111,114,116,104,97,110,100,115,0,37,115,37,100,46,123,91,115,107,105,112,112,101,100,93,32,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,61,62,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,37,115,37,100,46,123,37,115,0,42,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,37,115,10,0,37,115,37,100,46,125,37,115,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,79,117,116,32,111,102,32,99,97,99,104,101,32,101,110,116,114,105,101,115,33,10,0,83,99,97,108,101,32,102,97,99,116,111,114,32,115,104,111,117,108,100,32,110,111,116,32,98,101,32,108,101,115,115,32,116,104,97,110,32,122,101,114,111,0,105,110,105,116,105,97,108,0,37,115,10,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,85,78,68,69,70,73,78,69,68,0,69,88,65,67,84,76,89,0,65,84,95,77,79,83,84,0,76,65,89,95,85,78,68,69,70,73,78,69,68,0,76,65,89,95,69,88,65,67,84,76,89,0,76,65,89,95,65,84,95,77,79,83,84,0,97,118,97,105,108,97,98,108,101,87,105,100,116,104,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,119,105,100,116,104,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,97,118,97,105,108,97,98,108,101,72,101,105,103,104,116,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,104,101,105,103,104,116,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,102,108,101,120,0,115,116,114,101,116,99,104,0,109,117,108,116,105,108,105,110,101,45,115,116,114,101,116,99,104,0,69,120,112,101,99,116,101,100,32,110,111,100,101,32,116,111,32,104,97,118,101,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,0,109,101,97,115,117,114,101,0,69,120,112,101,99,116,32,99,117,115,116,111,109,32,98,97,115,101,108,105,110,101,32,102,117,110,99,116,105,111,110,32,116,111,32,110,111,116,32,114,101,116,117,114,110,32,78,97,78,0,97,98,115,45,109,101,97,115,117,114,101,0,97,98,115,45,108,97,121,111,117,116,0,78,111,100,101,0,99,114,101,97,116,101,68,101,102,97,117,108,116,0,99,114,101,97,116,101,87,105,116,104,67,111,110,102,105,103,0,100,101,115,116,114,111,121,0,114,101,115,101,116,0,99,111,112,121,83,116,121,108,101,0,115,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,115,101,116,80,111,115,105,116,105,111,110,0,115,101,116,80,111,115,105,116,105,111,110,80,101,114,99,101,110,116,0,115,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,115,101,116,65,108,105,103,110,73,116,101,109,115,0,115,101,116,65,108,105,103,110,83,101,108,102,0,115,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,115,101,116,70,108,101,120,87,114,97,112,0,115,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,115,101,116,77,97,114,103,105,110,0,115,101,116,77,97,114,103,105,110,80,101,114,99,101,110,116,0,115,101,116,77,97,114,103,105,110,65,117,116,111,0,115,101,116,79,118,101,114,102,108,111,119,0,115,101,116,68,105,115,112,108,97,121,0,115,101,116,70,108,101,120,0,115,101,116,70,108,101,120,66,97,115,105,115,0,115,101,116,70,108,101,120,66,97,115,105,115,80,101,114,99,101,110,116,0,115,101,116,70,108,101,120,71,114,111,119,0,115,101,116,70,108,101,120,83,104,114,105,110,107,0,115,101,116,87,105,100,116,104,0,115,101,116,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,87,105,100,116,104,65,117,116,111,0,115,101,116,72,101,105,103,104,116,0,115,101,116,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,72,101,105,103,104,116,65,117,116,111,0,115,101,116,77,105,110,87,105,100,116,104,0,115,101,116,77,105,110,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,105,110,72,101,105,103,104,116,0,115,101,116,77,105,110,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,77,97,120,87,105,100,116,104,0,115,101,116,77,97,120,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,97,120,72,101,105,103,104,116,0,115,101,116,77,97,120,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,65,115,112,101,99,116,82,97,116,105,111,0,115,101,116,66,111,114,100,101,114,0,115,101,116,80,97,100,100,105,110,103,0,115,101,116,80,97,100,100,105,110,103,80,101,114,99,101,110,116,0,103,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,103,101,116,80,111,115,105,116,105,111,110,0,103,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,103,101,116,65,108,105,103,110,73,116,101,109,115,0,103,101,116,65,108,105,103,110,83,101,108,102,0,103,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,103,101,116,70,108,101,120,87,114,97,112,0,103,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,103,101,116,77,97,114,103,105,110,0,103,101,116,70,108,101,120,66,97,115,105,115,0,103,101,116,70,108,101,120,71,114,111,119,0,103,101,116,70,108,101,120,83,104,114,105,110,107,0,103,101,116,87,105,100,116,104,0,103,101,116,72,101,105,103,104,116,0,103,101,116,77,105,110,87,105,100,116,104,0,103,101,116,77,105,110,72,101,105,103,104,116,0,103,101,116,77,97,120,87,105,100,116,104,0,103,101,116,77,97,120,72,101,105,103,104,116,0,103,101,116,65,115,112,101,99,116,82,97,116,105,111,0,103,101,116,66,111,114,100,101,114,0,103,101,116,79,118,101,114,102,108,111,119,0,103,101,116,68,105,115,112,108,97,121,0,103,101,116,80,97,100,100,105,110,103,0,105,110,115,101,114,116,67,104,105,108,100,0,114,101,109,111,118,101,67,104,105,108,100,0,103,101,116,67,104,105,108,100,67,111,117,110,116,0,103,101,116,80,97,114,101,110,116,0,103,101,116,67,104,105,108,100,0,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,117,110,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,109,97,114,107,68,105,114,116,121,0,105,115,68,105,114,116,121,0,99,97,108,99,117,108,97,116,101,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,76,101,102,116,0,103,101,116,67,111,109,112,117,116,101,100,82,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,84,111,112,0,103,101,116,67,111,109,112,117,116,101,100,66,111,116,116,111,109,0,103,101,116,67,111,109,112,117,116,101,100,87,105,100,116,104,0,103,101,116,67,111,109,112,117,116,101,100,72,101,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,77,97,114,103,105,110,0,103,101,116,67,111,109,112,117,116,101,100,66,111,114,100,101,114,0,103,101,116,67,111,109,112,117,116,101,100,80,97,100,100,105,110,103,0,67,111,110,102,105,103,0,99,114,101,97,116,101,0,115,101,116,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,115,101,116,80,111,105,110,116,83,99,97,108,101,70,97,99,116,111,114,0,105,115,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,86,97,108,117,101,0,76,97,121,111,117,116,0,83,105,122,101,0,103,101,116,73,110,115,116,97,110,99,101,67,111,117,110,116,0,73,110,116,54,52,0,1,1,1,2,2,4,4,4,4,8,8,4,8,118,111,105,100,0,98,111,111,108,0,115,116,100,58,58,115,116,114,105,110,103,0,99,98,70,117,110,99,116,105,111,110,32,38,0,99,111,110,115,116,32,99,98,70,117,110,99,116,105,111,110,32,38,0,69,120,116,101,114,110,97,108,0,66,117,102,102,101,114,0,78,66,105,110,100,73,68,0,78,66,105,110,100,0,98,105,110,100,95,118,97,108,117,101,0,114,101,102,108,101,99,116,0,113,117,101,114,121,84,121,112,101,0,108,97,108,108,111,99,0,108,114,101,115,101,116,0,123,114,101,116,117,114,110,40,95,110,98,105,110,100,46,99,97,108,108,98,97,99,107,83,105,103,110,97,116,117,114,101,76,105,115,116,91,36,48,93,46,97,112,112,108,121,40,116,104,105,115,44,97,114,103,117,109,101,110,116,115,41,41,59,125,0,95,110,98,105,110,100,95,110,101,119,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,46,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);var tempDoublePtr=STATICTOP;STATICTOP+=16;function _atexit(t,e){__ATEXIT__.unshift({func:t,arg:e})}function ___cxa_atexit(){return _atexit.apply(null,arguments)}function _abort(){Module.abort()}function __ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj(){Module.printErr("missing function: _ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj"),abort(-1)}function __decorate(t,e,r,s){var a=arguments.length,n=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var f=t.length-1;f>=0;f--)(c=t[f])&&(n=(a<3?c(n):a>3?c(e,r,n):c(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function _defineHidden(t){return function(e,r){Object.defineProperty(e,r,{configurable:!1,enumerable:!1,value:t,writable:!0})}}var _nbind={};function __nbind_free_external(t){_nbind.externalList[t].dereference(t)}function __nbind_reference_external(t){_nbind.externalList[t].reference()}function _llvm_stackrestore(t){var e=_llvm_stacksave,r=e.LLVM_SAVEDSTACKS[t];e.LLVM_SAVEDSTACKS.splice(t,1),Runtime.stackRestore(r)}function __nbind_register_pool(t,e,r,s){_nbind.Pool.pageSize=t,_nbind.Pool.usedPtr=e/4,_nbind.Pool.rootPtr=r,_nbind.Pool.pagePtr=s/4,HEAP32[e/4]=16909060,HEAP8[e]==1&&(_nbind.bigEndian=!0),HEAP32[e/4]=0,_nbind.makeTypeKindTbl=(n={},n[1024]=_nbind.PrimitiveType,n[64]=_nbind.Int64Type,n[2048]=_nbind.BindClass,n[3072]=_nbind.BindClassPtr,n[4096]=_nbind.SharedClassPtr,n[5120]=_nbind.ArrayType,n[6144]=_nbind.ArrayType,n[7168]=_nbind.CStringType,n[9216]=_nbind.CallbackType,n[10240]=_nbind.BindType,n),_nbind.makeTypeNameTbl={Buffer:_nbind.BufferType,External:_nbind.ExternalType,Int64:_nbind.Int64Type,_nbind_new:_nbind.CreateValueType,bool:_nbind.BooleanType,"cbFunction &":_nbind.CallbackType,"const cbFunction &":_nbind.CallbackType,"const std::string &":_nbind.StringType,"std::string":_nbind.StringType},Module.toggleLightGC=_nbind.toggleLightGC,_nbind.callUpcast=Module.dynCall_ii;var a=_nbind.makeType(_nbind.constructType,{flags:2048,id:0,name:""});a.proto=Module,_nbind.BindClass.list.push(a);var n}function _emscripten_set_main_loop_timing(t,e){if(Browser.mainLoop.timingMode=t,Browser.mainLoop.timingValue=e,!Browser.mainLoop.func)return 1;if(t==0)Browser.mainLoop.scheduler=function(){var c=Math.max(0,Browser.mainLoop.tickStartTime+e-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,c)},Browser.mainLoop.method="timeout";else if(t==1)Browser.mainLoop.scheduler=function(){Browser.requestAnimationFrame(Browser.mainLoop.runner)},Browser.mainLoop.method="rAF";else if(t==2){if(!window.setImmediate){let n=function(c){c.source===window&&c.data===s&&(c.stopPropagation(),r.shift()())};var a=n,r=[],s="setimmediate";window.addEventListener("message",n,!0),window.setImmediate=function(f){r.push(f),ENVIRONMENT_IS_WORKER?(Module.setImmediates===void 0&&(Module.setImmediates=[]),Module.setImmediates.push(f),window.postMessage({target:s})):window.postMessage(s,"*")}}Browser.mainLoop.scheduler=function(){window.setImmediate(Browser.mainLoop.runner)},Browser.mainLoop.method="immediate"}return 0}function _emscripten_get_now(){abort()}function _emscripten_set_main_loop(t,e,r,s,a){Module.noExitRuntime=!0,assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Browser.mainLoop.func=t,Browser.mainLoop.arg=s;var n;typeof s<"u"?n=function(){Module.dynCall_vi(t,s)}:n=function(){Module.dynCall_v(t)};var c=Browser.mainLoop.currentlyRunningMainloop;if(Browser.mainLoop.runner=function(){if(!ABORT){if(Browser.mainLoop.queue.length>0){var p=Date.now(),h=Browser.mainLoop.queue.shift();if(h.func(h.arg),Browser.mainLoop.remainingBlockers){var E=Browser.mainLoop.remainingBlockers,C=E%1==0?E-1:Math.floor(E);h.counted?Browser.mainLoop.remainingBlockers=C:(C=C+.5,Browser.mainLoop.remainingBlockers=(8*E+C)/9)}if(console.log('main loop blocker "'+h.name+'" took '+(Date.now()-p)+" ms"),Browser.mainLoop.updateStatus(),c1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else Browser.mainLoop.timingMode==0&&(Browser.mainLoop.tickStartTime=_emscripten_get_now());Browser.mainLoop.method==="timeout"&&Module.ctx&&(Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Browser.mainLoop.method=""),Browser.mainLoop.runIter(n),!(c0?_emscripten_set_main_loop_timing(0,1e3/e):_emscripten_set_main_loop_timing(1,1),Browser.mainLoop.scheduler()),r)throw"SimulateInfiniteLoop"}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null,Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var t=Browser.mainLoop.timingMode,e=Browser.mainLoop.timingValue,r=Browser.mainLoop.func;Browser.mainLoop.func=null,_emscripten_set_main_loop(r,0,!1,Browser.mainLoop.arg,!0),_emscripten_set_main_loop_timing(t,e),Browser.mainLoop.scheduler()},updateStatus:function(){if(Module.setStatus){var t=Module.statusMessage||"Please wait...",e=Browser.mainLoop.remainingBlockers,r=Browser.mainLoop.expectedBlockers;e?e"u"&&(console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),Module.noImageDecoding=!0);var t={};t.canHandle=function(n){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(n)},t.handle=function(n,c,f,p){var h=null;if(Browser.hasBlobConstructor)try{h=new Blob([n],{type:Browser.getMimetype(c)}),h.size!==n.length&&(h=new Blob([new Uint8Array(n).buffer],{type:Browser.getMimetype(c)}))}catch(P){Runtime.warnOnce("Blob constructor present but fails: "+P+"; falling back to blob builder")}if(!h){var E=new Browser.BlobBuilder;E.append(new Uint8Array(n).buffer),h=E.getBlob()}var C=Browser.URLObject.createObjectURL(h),S=new Image;S.onload=function(){assert(S.complete,"Image "+c+" could not be decoded");var I=document.createElement("canvas");I.width=S.width,I.height=S.height;var R=I.getContext("2d");R.drawImage(S,0,0),Module.preloadedImages[c]=I,Browser.URLObject.revokeObjectURL(C),f&&f(n)},S.onerror=function(I){console.log("Image "+C+" could not be decoded"),p&&p()},S.src=C},Module.preloadPlugins.push(t);var e={};e.canHandle=function(n){return!Module.noAudioDecoding&&n.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},e.handle=function(n,c,f,p){var h=!1;function E(R){h||(h=!0,Module.preloadedAudios[c]=R,f&&f(n))}function C(){h||(h=!0,Module.preloadedAudios[c]=new Audio,p&&p())}if(Browser.hasBlobConstructor){try{var S=new Blob([n],{type:Browser.getMimetype(c)})}catch{return C()}var P=Browser.URLObject.createObjectURL(S),I=new Audio;I.addEventListener("canplaythrough",function(){E(I)},!1),I.onerror=function(N){if(h)return;console.log("warning: browser could not fully decode audio "+c+", trying slower base64 approach");function U(W){for(var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ie="=",Ae="",ce=0,me=0,pe=0;pe=6;){var Be=ce>>me-6&63;me-=6,Ae+=te[Be]}return me==2?(Ae+=te[(ce&3)<<4],Ae+=ie+ie):me==4&&(Ae+=te[(ce&15)<<2],Ae+=ie),Ae}I.src="data:audio/x-"+c.substr(-3)+";base64,"+U(n),E(I)},I.src=P,Browser.safeSetTimeout(function(){E(I)},1e4)}else return C()},Module.preloadPlugins.push(e);function r(){Browser.pointerLock=document.pointerLockElement===Module.canvas||document.mozPointerLockElement===Module.canvas||document.webkitPointerLockElement===Module.canvas||document.msPointerLockElement===Module.canvas}var s=Module.canvas;s&&(s.requestPointerLock=s.requestPointerLock||s.mozRequestPointerLock||s.webkitRequestPointerLock||s.msRequestPointerLock||function(){},s.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},s.exitPointerLock=s.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",r,!1),document.addEventListener("mozpointerlockchange",r,!1),document.addEventListener("webkitpointerlockchange",r,!1),document.addEventListener("mspointerlockchange",r,!1),Module.elementPointerLock&&s.addEventListener("click",function(a){!Browser.pointerLock&&Module.canvas.requestPointerLock&&(Module.canvas.requestPointerLock(),a.preventDefault())},!1))},createContext:function(t,e,r,s){if(e&&Module.ctx&&t==Module.canvas)return Module.ctx;var a,n;if(e){var c={antialias:!1,alpha:!1};if(s)for(var f in s)c[f]=s[f];n=GL.createContext(t,c),n&&(a=GL.getContext(n).GLctx)}else a=t.getContext("2d");return a?(r&&(e||assert(typeof GLctx>"u","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),Module.ctx=a,e&&GL.makeContextCurrent(n),Module.useWebGL=e,Browser.moduleContextCreatedCallbacks.forEach(function(p){p()}),Browser.init()),a):null},destroyContext:function(t,e,r){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen:function(t,e,r){Browser.lockPointer=t,Browser.resizeCanvas=e,Browser.vrDevice=r,typeof Browser.lockPointer>"u"&&(Browser.lockPointer=!0),typeof Browser.resizeCanvas>"u"&&(Browser.resizeCanvas=!1),typeof Browser.vrDevice>"u"&&(Browser.vrDevice=null);var s=Module.canvas;function a(){Browser.isFullscreen=!1;var c=s.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===c?(s.exitFullscreen=document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||function(){},s.exitFullscreen=s.exitFullscreen.bind(document),Browser.lockPointer&&s.requestPointerLock(),Browser.isFullscreen=!0,Browser.resizeCanvas&&Browser.setFullscreenCanvasSize()):(c.parentNode.insertBefore(s,c),c.parentNode.removeChild(c),Browser.resizeCanvas&&Browser.setWindowedCanvasSize()),Module.onFullScreen&&Module.onFullScreen(Browser.isFullscreen),Module.onFullscreen&&Module.onFullscreen(Browser.isFullscreen),Browser.updateCanvasDimensions(s)}Browser.fullscreenHandlersInstalled||(Browser.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("MSFullscreenChange",a,!1));var n=document.createElement("div");s.parentNode.insertBefore(n,s),n.appendChild(s),n.requestFullscreen=n.requestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen||(n.webkitRequestFullscreen?function(){n.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}:null)||(n.webkitRequestFullScreen?function(){n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),r?n.requestFullscreen({vrDisplay:r}):n.requestFullscreen()},requestFullScreen:function(t,e,r){return Module.printErr("Browser.requestFullScreen() is deprecated. Please call Browser.requestFullscreen instead."),Browser.requestFullScreen=function(s,a,n){return Browser.requestFullscreen(s,a,n)},Browser.requestFullscreen(t,e,r)},nextRAF:0,fakeRequestAnimationFrame:function(t){var e=Date.now();if(Browser.nextRAF===0)Browser.nextRAF=e+1e3/60;else for(;e+2>=Browser.nextRAF;)Browser.nextRAF+=1e3/60;var r=Math.max(Browser.nextRAF-e,0);setTimeout(t,r)},requestAnimationFrame:function t(e){typeof window>"u"?Browser.fakeRequestAnimationFrame(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||Browser.fakeRequestAnimationFrame),window.requestAnimationFrame(e))},safeCallback:function(t){return function(){if(!ABORT)return t.apply(null,arguments)}},allowAsyncCallbacks:!0,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=!1},resumeAsyncCallbacks:function(){if(Browser.allowAsyncCallbacks=!0,Browser.queuedAsyncCallbacks.length>0){var t=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[],t.forEach(function(e){e()})}},safeRequestAnimationFrame:function(t){return Browser.requestAnimationFrame(function(){ABORT||(Browser.allowAsyncCallbacks?t():Browser.queuedAsyncCallbacks.push(t))})},safeSetTimeout:function(t,e){return Module.noExitRuntime=!0,setTimeout(function(){ABORT||(Browser.allowAsyncCallbacks?t():Browser.queuedAsyncCallbacks.push(t))},e)},safeSetInterval:function(t,e){return Module.noExitRuntime=!0,setInterval(function(){ABORT||Browser.allowAsyncCallbacks&&t()},e)},getMimetype:function(t){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[t.substr(t.lastIndexOf(".")+1)]},getUserMedia:function(t){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(t)},getMovementX:function(t){return t.movementX||t.mozMovementX||t.webkitMovementX||0},getMovementY:function(t){return t.movementY||t.mozMovementY||t.webkitMovementY||0},getMouseWheelDelta:function(t){var e=0;switch(t.type){case"DOMMouseScroll":e=t.detail;break;case"mousewheel":e=t.wheelDelta;break;case"wheel":e=t.deltaY;break;default:throw"unrecognized mouse wheel event: "+t.type}return e},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(t){if(Browser.pointerLock)t.type!="mousemove"&&"mozMovementX"in t?Browser.mouseMovementX=Browser.mouseMovementY=0:(Browser.mouseMovementX=Browser.getMovementX(t),Browser.mouseMovementY=Browser.getMovementY(t)),typeof SDL<"u"?(Browser.mouseX=SDL.mouseX+Browser.mouseMovementX,Browser.mouseY=SDL.mouseY+Browser.mouseMovementY):(Browser.mouseX+=Browser.mouseMovementX,Browser.mouseY+=Browser.mouseMovementY);else{var e=Module.canvas.getBoundingClientRect(),r=Module.canvas.width,s=Module.canvas.height,a=typeof window.scrollX<"u"?window.scrollX:window.pageXOffset,n=typeof window.scrollY<"u"?window.scrollY:window.pageYOffset;if(t.type==="touchstart"||t.type==="touchend"||t.type==="touchmove"){var c=t.touch;if(c===void 0)return;var f=c.pageX-(a+e.left),p=c.pageY-(n+e.top);f=f*(r/e.width),p=p*(s/e.height);var h={x:f,y:p};if(t.type==="touchstart")Browser.lastTouches[c.identifier]=h,Browser.touches[c.identifier]=h;else if(t.type==="touchend"||t.type==="touchmove"){var E=Browser.touches[c.identifier];E||(E=h),Browser.lastTouches[c.identifier]=E,Browser.touches[c.identifier]=h}return}var C=t.pageX-(a+e.left),S=t.pageY-(n+e.top);C=C*(r/e.width),S=S*(s/e.height),Browser.mouseMovementX=C-Browser.mouseX,Browser.mouseMovementY=S-Browser.mouseY,Browser.mouseX=C,Browser.mouseY=S}},asyncLoad:function(t,e,r,s){var a=s?"":"al "+t;Module.readAsync(t,function(n){assert(n,'Loading data file "'+t+'" failed (no arrayBuffer).'),e(new Uint8Array(n)),a&&removeRunDependency(a)},function(n){if(r)r();else throw'Loading data file "'+t+'" failed.'}),a&&addRunDependency(a)},resizeListeners:[],updateResizeListeners:function(){var t=Module.canvas;Browser.resizeListeners.forEach(function(e){e(t.width,t.height)})},setCanvasSize:function(t,e,r){var s=Module.canvas;Browser.updateCanvasDimensions(s,t,e),r||Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL<"u"){var t=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];t=t|8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=t}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL<"u"){var t=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];t=t&-8388609,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=t}Browser.updateResizeListeners()},updateCanvasDimensions:function(t,e,r){e&&r?(t.widthNative=e,t.heightNative=r):(e=t.widthNative,r=t.heightNative);var s=e,a=r;if(Module.forcedAspectRatio&&Module.forcedAspectRatio>0&&(s/a>2];return e},getStr:function(){var t=Pointer_stringify(SYSCALLS.get());return t},get64:function(){var t=SYSCALLS.get(),e=SYSCALLS.get();return t>=0?assert(e===0):assert(e===-1),t},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall6(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.getStreamFromFD();return FS.close(r),0}catch(s){return(typeof FS>"u"||!(s instanceof FS.ErrnoError))&&abort(s),-s.errno}}function ___syscall54(t,e){SYSCALLS.varargs=e;try{return 0}catch(r){return(typeof FS>"u"||!(r instanceof FS.ErrnoError))&&abort(r),-r.errno}}function _typeModule(t){var e=[[0,1,"X"],[1,1,"const X"],[128,1,"X *"],[256,1,"X &"],[384,1,"X &&"],[512,1,"std::shared_ptr"],[640,1,"std::unique_ptr"],[5120,1,"std::vector"],[6144,2,"std::array"],[9216,-1,"std::function"]];function r(p,h,E,C,S,P){if(h==1){var I=C&896;(I==128||I==256||I==384)&&(p="X const")}var R;return P?R=E.replace("X",p).replace("Y",S):R=p.replace("X",E).replace("Y",S),R.replace(/([*&]) (?=[*&])/g,"$1")}function s(p,h,E,C,S){throw new Error(p+" type "+E.replace("X",h+"?")+(C?" with flag "+C:"")+" in "+S)}function a(p,h,E,C,S,P,I,R){P===void 0&&(P="X"),R===void 0&&(R=1);var N=E(p);if(N)return N;var U=C(p),W=U.placeholderFlag,te=e[W];I&&te&&(P=r(I[2],I[0],P,te[0],"?",!0));var ie;W==0&&(ie="Unbound"),W>=10&&(ie="Corrupt"),R>20&&(ie="Deeply nested"),ie&&s(ie,p,P,W,S||"?");var Ae=U.paramList[0],ce=a(Ae,h,E,C,S,P,te,R+1),me,pe={flags:te[0],id:p,name:"",paramList:[ce]},Be=[],Ce="?";switch(U.placeholderFlag){case 1:me=ce.spec;break;case 2:if((ce.flags&15360)==1024&&ce.spec.ptrSize==1){pe.flags=7168;break}case 3:case 6:case 5:me=ce.spec,ce.flags&15360;break;case 8:Ce=""+U.paramList[1],pe.paramList.push(U.paramList[1]);break;case 9:for(var g=0,we=U.paramList[1];g>2]=t),t}function _llvm_stacksave(){var t=_llvm_stacksave;return t.LLVM_SAVEDSTACKS||(t.LLVM_SAVEDSTACKS=[]),t.LLVM_SAVEDSTACKS.push(Runtime.stackSave()),t.LLVM_SAVEDSTACKS.length-1}function ___syscall140(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.getStreamFromFD(),s=SYSCALLS.get(),a=SYSCALLS.get(),n=SYSCALLS.get(),c=SYSCALLS.get(),f=a;return FS.llseek(r,f,c),HEAP32[n>>2]=r.position,r.getdents&&f===0&&c===0&&(r.getdents=null),0}catch(p){return(typeof FS>"u"||!(p instanceof FS.ErrnoError))&&abort(p),-p.errno}}function ___syscall146(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.get(),s=SYSCALLS.get(),a=SYSCALLS.get(),n=0;___syscall146.buffer||(___syscall146.buffers=[null,[],[]],___syscall146.printChar=function(E,C){var S=___syscall146.buffers[E];assert(S),C===0||C===10?((E===1?Module.print:Module.printErr)(UTF8ArrayToString(S,0)),S.length=0):S.push(C)});for(var c=0;c>2],p=HEAP32[s+(c*8+4)>>2],h=0;h"u"||!(E instanceof FS.ErrnoError))&&abort(E),-E.errno}}function __nbind_finish(){for(var t=0,e=_nbind.BindClass.list;tt.pageSize/2||e>t.pageSize-r){var s=_nbind.typeNameTbl.NBind.proto;return s.lalloc(e)}else return HEAPU32[t.usedPtr]=r+e,t.rootPtr+r},t.lreset=function(e,r){var s=HEAPU32[t.pagePtr];if(s){var a=_nbind.typeNameTbl.NBind.proto;a.lreset(e,r)}else HEAPU32[t.usedPtr]=e},t}();_nbind.Pool=Pool;function constructType(t,e){var r=t==10240?_nbind.makeTypeNameTbl[e.name]||_nbind.BindType:_nbind.makeTypeKindTbl[t],s=new r(e);return typeIdTbl[e.id]=s,_nbind.typeNameTbl[e.name]=s,s}_nbind.constructType=constructType;function getType(t){return typeIdTbl[t]}_nbind.getType=getType;function queryType(t){var e=HEAPU8[t],r=_nbind.structureList[e][1];t/=4,r<0&&(++t,r=HEAPU32[t]+1);var s=Array.prototype.slice.call(HEAPU32.subarray(t+1,t+1+r));return e==9&&(s=[s[0],s.slice(1)]),{paramList:s,placeholderFlag:e}}_nbind.queryType=queryType;function getTypes(t,e){return t.map(function(r){return typeof r=="number"?_nbind.getComplexType(r,constructType,getType,queryType,e):_nbind.typeNameTbl[r]})}_nbind.getTypes=getTypes;function readTypeIdList(t,e){return Array.prototype.slice.call(HEAPU32,t/4,t/4+e)}_nbind.readTypeIdList=readTypeIdList;function readAsciiString(t){for(var e=t;HEAPU8[e++];);return String.fromCharCode.apply("",HEAPU8.subarray(t,e-1))}_nbind.readAsciiString=readAsciiString;function readPolicyList(t){var e={};if(t)for(;;){var r=HEAPU32[t/4];if(!r)break;e[readAsciiString(r)]=!0,t+=4}return e}_nbind.readPolicyList=readPolicyList;function getDynCall(t,e){var r={float32_t:"d",float64_t:"d",int64_t:"d",uint64_t:"d",void:"v"},s=t.map(function(n){return r[n.name]||"i"}).join(""),a=Module["dynCall_"+s];if(!a)throw new Error("dynCall_"+s+" not found for "+e+"("+t.map(function(n){return n.name}).join(", ")+")");return a}_nbind.getDynCall=getDynCall;function addMethod(t,e,r,s){var a=t[e];t.hasOwnProperty(e)&&a?((a.arity||a.arity===0)&&(a=_nbind.makeOverloader(a,a.arity),t[e]=a),a.addMethod(r,s)):(r.arity=s,t[e]=r)}_nbind.addMethod=addMethod;function throwError(t){throw new Error(t)}_nbind.throwError=throwError,_nbind.bigEndian=!1,_a=_typeModule(_typeModule),_nbind.Type=_a.Type,_nbind.makeType=_a.makeType,_nbind.getComplexType=_a.getComplexType,_nbind.structureList=_a.structureList;var BindType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.heap=HEAPU32,r.ptrSize=4,r}return e.prototype.needsWireRead=function(r){return!!this.wireRead||!!this.makeWireRead},e.prototype.needsWireWrite=function(r){return!!this.wireWrite||!!this.makeWireWrite},e}(_nbind.Type);_nbind.BindType=BindType;var PrimitiveType=function(t){__extends(e,t);function e(r){var s=t.call(this,r)||this,a=r.flags&32?{32:HEAPF32,64:HEAPF64}:r.flags&8?{8:HEAPU8,16:HEAPU16,32:HEAPU32}:{8:HEAP8,16:HEAP16,32:HEAP32};return s.heap=a[r.ptrSize*8],s.ptrSize=r.ptrSize,s}return e.prototype.needsWireWrite=function(r){return!!r&&!!r.Strict},e.prototype.makeWireWrite=function(r,s){return s&&s.Strict&&function(a){if(typeof a=="number")return a;throw new Error("Type mismatch")}},e}(BindType);_nbind.PrimitiveType=PrimitiveType;function pushCString(t,e){if(t==null){if(e&&e.Nullable)return 0;throw new Error("Type mismatch")}if(e&&e.Strict){if(typeof t!="string")throw new Error("Type mismatch")}else t=t.toString();var r=Module.lengthBytesUTF8(t)+1,s=_nbind.Pool.lalloc(r);return Module.stringToUTF8Array(t,HEAPU8,s,r),s}_nbind.pushCString=pushCString;function popCString(t){return t===0?null:Module.Pointer_stringify(t)}_nbind.popCString=popCString;var CStringType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.wireRead=popCString,r.wireWrite=pushCString,r.readResources=[_nbind.resources.pool],r.writeResources=[_nbind.resources.pool],r}return e.prototype.makeWireWrite=function(r,s){return function(a){return pushCString(a,s)}},e}(BindType);_nbind.CStringType=CStringType;var BooleanType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.wireRead=function(s){return!!s},r}return e.prototype.needsWireWrite=function(r){return!!r&&!!r.Strict},e.prototype.makeWireRead=function(r){return"!!("+r+")"},e.prototype.makeWireWrite=function(r,s){return s&&s.Strict&&function(a){if(typeof a=="boolean")return a;throw new Error("Type mismatch")}||r},e}(BindType);_nbind.BooleanType=BooleanType;var Wrapper=function(){function t(){}return t.prototype.persist=function(){this.__nbindState|=1},t}();_nbind.Wrapper=Wrapper;function makeBound(t,e){var r=function(s){__extends(a,s);function a(n,c,f,p){var h=s.call(this)||this;if(!(h instanceof a))return new(Function.prototype.bind.apply(a,Array.prototype.concat.apply([null],arguments)));var E=c,C=f,S=p;if(n!==_nbind.ptrMarker){var P=h.__nbindConstructor.apply(h,arguments);E=4608,S=HEAPU32[P/4],C=HEAPU32[P/4+1]}var I={configurable:!0,enumerable:!1,value:null,writable:!1},R={__nbindFlags:E,__nbindPtr:C};S&&(R.__nbindShared=S,_nbind.mark(h));for(var N=0,U=Object.keys(R);N>=1;var r=_nbind.valueList[t];return _nbind.valueList[t]=firstFreeValue,firstFreeValue=t,r}else{if(e)return _nbind.popShared(t,e);throw new Error("Invalid value slot "+t)}}_nbind.popValue=popValue;var valueBase=18446744073709552e3;function push64(t){return typeof t=="number"?t:pushValue(t)*4096+valueBase}function pop64(t){return t=3?c=Buffer.from(n):c=new Buffer(n),c.copy(s)}else getBuffer(s).set(n)}}_nbind.commitBuffer=commitBuffer;var dirtyList=[],gcTimer=0;function sweep(){for(var t=0,e=dirtyList;t>2]=DYNAMIC_BASE,staticSealed=!0;function invoke_viiiii(t,e,r,s,a,n){try{Module.dynCall_viiiii(t,e,r,s,a,n)}catch(c){if(typeof c!="number"&&c!=="longjmp")throw c;Module.setThrew(1,0)}}function invoke_vif(t,e,r){try{Module.dynCall_vif(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_vid(t,e,r){try{Module.dynCall_vid(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_fiff(t,e,r,s){try{return Module.dynCall_fiff(t,e,r,s)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_vi(t,e){try{Module.dynCall_vi(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_vii(t,e,r){try{Module.dynCall_vii(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_ii(t,e){try{return Module.dynCall_ii(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_viddi(t,e,r,s,a){try{Module.dynCall_viddi(t,e,r,s,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}function invoke_vidd(t,e,r,s){try{Module.dynCall_vidd(t,e,r,s)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_iiii(t,e,r,s){try{return Module.dynCall_iiii(t,e,r,s)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_diii(t,e,r,s){try{return Module.dynCall_diii(t,e,r,s)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_di(t,e){try{return Module.dynCall_di(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_iid(t,e,r){try{return Module.dynCall_iid(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_iii(t,e,r){try{return Module.dynCall_iii(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_viiddi(t,e,r,s,a,n){try{Module.dynCall_viiddi(t,e,r,s,a,n)}catch(c){if(typeof c!="number"&&c!=="longjmp")throw c;Module.setThrew(1,0)}}function invoke_viiiiii(t,e,r,s,a,n,c){try{Module.dynCall_viiiiii(t,e,r,s,a,n,c)}catch(f){if(typeof f!="number"&&f!=="longjmp")throw f;Module.setThrew(1,0)}}function invoke_dii(t,e,r){try{return Module.dynCall_dii(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_i(t){try{return Module.dynCall_i(t)}catch(e){if(typeof e!="number"&&e!=="longjmp")throw e;Module.setThrew(1,0)}}function invoke_iiiiii(t,e,r,s,a,n){try{return Module.dynCall_iiiiii(t,e,r,s,a,n)}catch(c){if(typeof c!="number"&&c!=="longjmp")throw c;Module.setThrew(1,0)}}function invoke_viiid(t,e,r,s,a){try{Module.dynCall_viiid(t,e,r,s,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}function invoke_viififi(t,e,r,s,a,n,c){try{Module.dynCall_viififi(t,e,r,s,a,n,c)}catch(f){if(typeof f!="number"&&f!=="longjmp")throw f;Module.setThrew(1,0)}}function invoke_viii(t,e,r,s){try{Module.dynCall_viii(t,e,r,s)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_v(t){try{Module.dynCall_v(t)}catch(e){if(typeof e!="number"&&e!=="longjmp")throw e;Module.setThrew(1,0)}}function invoke_viid(t,e,r,s){try{Module.dynCall_viid(t,e,r,s)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_idd(t,e,r){try{return Module.dynCall_idd(t,e,r)}catch(s){if(typeof s!="number"&&s!=="longjmp")throw s;Module.setThrew(1,0)}}function invoke_viiii(t,e,r,s,a){try{Module.dynCall_viiii(t,e,r,s,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}Module.asmGlobalArg={Math,Int8Array,Int16Array,Int32Array,Uint8Array,Uint16Array,Uint32Array,Float32Array,Float64Array,NaN:NaN,Infinity:1/0},Module.asmLibraryArg={abort,assert,enlargeMemory,getTotalMemory,abortOnCannotGrowMemory,invoke_viiiii,invoke_vif,invoke_vid,invoke_fiff,invoke_vi,invoke_vii,invoke_ii,invoke_viddi,invoke_vidd,invoke_iiii,invoke_diii,invoke_di,invoke_iid,invoke_iii,invoke_viiddi,invoke_viiiiii,invoke_dii,invoke_i,invoke_iiiiii,invoke_viiid,invoke_viififi,invoke_viii,invoke_v,invoke_viid,invoke_idd,invoke_viiii,_emscripten_asm_const_iiiii,_emscripten_asm_const_iiidddddd,_emscripten_asm_const_iiiid,__nbind_reference_external,_emscripten_asm_const_iiiiiiii,_removeAccessorPrefix,_typeModule,__nbind_register_pool,__decorate,_llvm_stackrestore,___cxa_atexit,__extends,__nbind_get_value_object,__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,_emscripten_set_main_loop_timing,__nbind_register_primitive,__nbind_register_type,_emscripten_memcpy_big,__nbind_register_function,___setErrNo,__nbind_register_class,__nbind_finish,_abort,_nbind_value,_llvm_stacksave,___syscall54,_defineHidden,_emscripten_set_main_loop,_emscripten_get_now,__nbind_register_callback_signature,_emscripten_asm_const_iiiiii,__nbind_free_external,_emscripten_asm_const_iiii,_emscripten_asm_const_iiididi,___syscall6,_atexit,___syscall140,___syscall146,DYNAMICTOP_PTR,tempDoublePtr,ABORT,STACKTOP,STACK_MAX,cttz_i8,___dso_handle};var asm=function(t,e,r){var s=new t.Int8Array(r),a=new t.Int16Array(r),n=new t.Int32Array(r),c=new t.Uint8Array(r),f=new t.Uint16Array(r),p=new t.Uint32Array(r),h=new t.Float32Array(r),E=new t.Float64Array(r),C=e.DYNAMICTOP_PTR|0,S=e.tempDoublePtr|0,P=e.ABORT|0,I=e.STACKTOP|0,R=e.STACK_MAX|0,N=e.cttz_i8|0,U=e.___dso_handle|0,W=0,te=0,ie=0,Ae=0,ce=t.NaN,me=t.Infinity,pe=0,Be=0,Ce=0,g=0,we=0,Ee=0,fe=t.Math.floor,se=t.Math.abs,X=t.Math.sqrt,De=t.Math.pow,Re=t.Math.cos,gt=t.Math.sin,j=t.Math.tan,rt=t.Math.acos,Fe=t.Math.asin,Ne=t.Math.atan,Pe=t.Math.atan2,Ye=t.Math.exp,ke=t.Math.log,it=t.Math.ceil,_e=t.Math.imul,x=t.Math.min,w=t.Math.max,b=t.Math.clz32,y=t.Math.fround,F=e.abort,z=e.assert,Z=e.enlargeMemory,$=e.getTotalMemory,oe=e.abortOnCannotGrowMemory,xe=e.invoke_viiiii,Te=e.invoke_vif,lt=e.invoke_vid,Et=e.invoke_fiff,qt=e.invoke_vi,ir=e.invoke_vii,Pt=e.invoke_ii,gn=e.invoke_viddi,Pr=e.invoke_vidd,Ir=e.invoke_iiii,Nr=e.invoke_diii,nn=e.invoke_di,oi=e.invoke_iid,wo=e.invoke_iii,rs=e.invoke_viiddi,eo=e.invoke_viiiiii,Bo=e.invoke_dii,Hi=e.invoke_i,to=e.invoke_iiiiii,vo=e.invoke_viiid,RA=e.invoke_viififi,pf=e.invoke_viii,Eh=e.invoke_v,Ih=e.invoke_viid,ro=e.invoke_idd,jn=e.invoke_viiii,Rs=e._emscripten_asm_const_iiiii,no=e._emscripten_asm_const_iiidddddd,lu=e._emscripten_asm_const_iiiid,cu=e.__nbind_reference_external,uu=e._emscripten_asm_const_iiiiiiii,FA=e._removeAccessorPrefix,NA=e._typeModule,aa=e.__nbind_register_pool,la=e.__decorate,OA=e._llvm_stackrestore,gr=e.___cxa_atexit,So=e.__extends,Me=e.__nbind_get_value_object,fu=e.__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,Cr=e._emscripten_set_main_loop_timing,hf=e.__nbind_register_primitive,LA=e.__nbind_register_type,MA=e._emscripten_memcpy_big,Au=e.__nbind_register_function,pu=e.___setErrNo,ac=e.__nbind_register_class,ve=e.__nbind_finish,Nt=e._abort,lc=e._nbind_value,Ni=e._llvm_stacksave,io=e.___syscall54,Rt=e._defineHidden,xn=e._emscripten_set_main_loop,ca=e._emscripten_get_now,ji=e.__nbind_register_callback_signature,Oi=e._emscripten_asm_const_iiiiii,Oa=e.__nbind_free_external,dn=e._emscripten_asm_const_iiii,Jn=e._emscripten_asm_const_iiididi,hu=e.___syscall6,Ch=e._atexit,La=e.___syscall140,Ma=e.___syscall146,Ua=y(0);let Xe=y(0);function Ha(o){o=o|0;var l=0;return l=I,I=I+o|0,I=I+15&-16,l|0}function gf(){return I|0}function cc(o){o=o|0,I=o}function wn(o,l){o=o|0,l=l|0,I=o,R=l}function ua(o,l){o=o|0,l=l|0,W||(W=o,te=l)}function _A(o){o=o|0,Ee=o}function UA(){return Ee|0}function fa(){var o=0,l=0;Qr(8104,8,400)|0,Qr(8504,408,540)|0,o=9044,l=o+44|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));s[9088]=0,s[9089]=1,n[2273]=0,n[2274]=948,n[2275]=948,gr(17,8104,U|0)|0}function vl(o){o=o|0,ht(o+948|0)}function Mt(o){return o=y(o),((SP(o)|0)&2147483647)>>>0>2139095040|0}function kn(o,l,u){o=o|0,l=l|0,u=u|0;e:do if(n[o+(l<<3)+4>>2]|0)o=o+(l<<3)|0;else{if((l|2|0)==3&&n[o+60>>2]|0){o=o+56|0;break}switch(l|0){case 0:case 2:case 4:case 5:{if(n[o+52>>2]|0){o=o+48|0;break e}break}default:}if(n[o+68>>2]|0){o=o+64|0;break}else{o=(l|1|0)==5?948:u;break}}while(!1);return o|0}function Aa(o){o=o|0;var l=0;return l=ex(1e3)|0,ja(o,(l|0)!=0,2456),n[2276]=(n[2276]|0)+1,Qr(l|0,8104,1e3)|0,s[o+2>>0]|0&&(n[l+4>>2]=2,n[l+12>>2]=4),n[l+976>>2]=o,l|0}function ja(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;d=I,I=I+16|0,A=d,l||(n[A>>2]=u,Yg(o,5,3197,A)),I=d}function ns(){return Aa(956)|0}function uc(o){o=o|0;var l=0;return l=Jt(1e3)|0,gu(l,o),ja(n[o+976>>2]|0,1,2456),n[2276]=(n[2276]|0)+1,n[l+944>>2]=0,l|0}function gu(o,l){o=o|0,l=l|0;var u=0;Qr(o|0,l|0,948)|0,Dy(o+948|0,l+948|0),u=o+960|0,o=l+960|0,l=u+40|0;do n[u>>2]=n[o>>2],u=u+4|0,o=o+4|0;while((u|0)<(l|0))}function fc(o){o=o|0;var l=0,u=0,A=0,d=0;if(l=o+944|0,u=n[l>>2]|0,u|0&&(qa(u+948|0,o)|0,n[l>>2]=0),u=Li(o)|0,u|0){l=0;do n[(Cs(o,l)|0)+944>>2]=0,l=l+1|0;while((l|0)!=(u|0))}u=o+948|0,A=n[u>>2]|0,d=o+952|0,l=n[d>>2]|0,(l|0)!=(A|0)&&(n[d>>2]=l+(~((l+-4-A|0)>>>2)<<2)),Sl(u),tx(o),n[2276]=(n[2276]|0)+-1}function qa(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0;A=n[o>>2]|0,k=o+4|0,u=n[k>>2]|0,m=u;e:do if((A|0)==(u|0))d=A,B=4;else for(o=A;;){if((n[o>>2]|0)==(l|0)){d=o,B=4;break e}if(o=o+4|0,(o|0)==(u|0)){o=0;break}}while(!1);return(B|0)==4&&((d|0)!=(u|0)?(A=d+4|0,o=m-A|0,l=o>>2,l&&(F2(d|0,A|0,o|0)|0,u=n[k>>2]|0),o=d+(l<<2)|0,(u|0)==(o|0)||(n[k>>2]=u+(~((u+-4-o|0)>>>2)<<2)),o=1):o=0),o|0}function Li(o){return o=o|0,(n[o+952>>2]|0)-(n[o+948>>2]|0)>>2|0}function Cs(o,l){o=o|0,l=l|0;var u=0;return u=n[o+948>>2]|0,(n[o+952>>2]|0)-u>>2>>>0>l>>>0?o=n[u+(l<<2)>>2]|0:o=0,o|0}function Sl(o){o=o|0;var l=0,u=0,A=0,d=0;A=I,I=I+32|0,l=A,d=n[o>>2]|0,u=(n[o+4>>2]|0)-d|0,((n[o+8>>2]|0)-d|0)>>>0>u>>>0&&(d=u>>2,ky(l,d,d,o+8|0),DP(o,l),Qy(l)),I=A}function df(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0;_=Li(o)|0;do if(_|0){if((n[(Cs(o,0)|0)+944>>2]|0)==(o|0)){if(!(qa(o+948|0,l)|0))break;Qr(l+400|0,8504,540)|0,n[l+944>>2]=0,Oe(o);break}B=n[(n[o+976>>2]|0)+12>>2]|0,k=o+948|0,T=(B|0)==0,u=0,m=0;do A=n[(n[k>>2]|0)+(m<<2)>>2]|0,(A|0)==(l|0)?Oe(o):(d=uc(A)|0,n[(n[k>>2]|0)+(u<<2)>>2]=d,n[d+944>>2]=o,T||S_[B&15](A,d,o,u),u=u+1|0),m=m+1|0;while((m|0)!=(_|0));if(u>>>0<_>>>0){T=o+948|0,k=o+952|0,B=u,u=n[k>>2]|0;do m=(n[T>>2]|0)+(B<<2)|0,A=m+4|0,d=u-A|0,l=d>>2,l&&(F2(m|0,A|0,d|0)|0,u=n[k>>2]|0),d=u,A=m+(l<<2)|0,(d|0)!=(A|0)&&(u=d+(~((d+-4-A|0)>>>2)<<2)|0,n[k>>2]=u),B=B+1|0;while((B|0)!=(_|0))}}while(!1)}function Ac(o){o=o|0;var l=0,u=0,A=0,d=0;wi(o,(Li(o)|0)==0,2491),wi(o,(n[o+944>>2]|0)==0,2545),l=o+948|0,u=n[l>>2]|0,A=o+952|0,d=n[A>>2]|0,(d|0)!=(u|0)&&(n[A>>2]=d+(~((d+-4-u|0)>>>2)<<2)),Sl(l),l=o+976|0,u=n[l>>2]|0,Qr(o|0,8104,1e3)|0,s[u+2>>0]|0&&(n[o+4>>2]=2,n[o+12>>2]=4),n[l>>2]=u}function wi(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;d=I,I=I+16|0,A=d,l||(n[A>>2]=u,Qo(o,5,3197,A)),I=d}function Qn(){return n[2276]|0}function pc(){var o=0;return o=ex(20)|0,Je((o|0)!=0,2592),n[2277]=(n[2277]|0)+1,n[o>>2]=n[239],n[o+4>>2]=n[240],n[o+8>>2]=n[241],n[o+12>>2]=n[242],n[o+16>>2]=n[243],o|0}function Je(o,l){o=o|0,l=l|0;var u=0,A=0;A=I,I=I+16|0,u=A,o||(n[u>>2]=l,Qo(0,5,3197,u)),I=A}function st(o){o=o|0,tx(o),n[2277]=(n[2277]|0)+-1}function St(o,l){o=o|0,l=l|0;var u=0;l?(wi(o,(Li(o)|0)==0,2629),u=1):(u=0,l=0),n[o+964>>2]=l,n[o+988>>2]=u}function lr(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,m=A+8|0,d=A+4|0,B=A,n[d>>2]=l,wi(o,(n[l+944>>2]|0)==0,2709),wi(o,(n[o+964>>2]|0)==0,2763),ee(o),l=o+948|0,n[B>>2]=(n[l>>2]|0)+(u<<2),n[m>>2]=n[B>>2],Ie(l,m,d)|0,n[(n[d>>2]|0)+944>>2]=o,Oe(o),I=A}function ee(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0;if(u=Li(o)|0,u|0&&(n[(Cs(o,0)|0)+944>>2]|0)!=(o|0)){A=n[(n[o+976>>2]|0)+12>>2]|0,d=o+948|0,m=(A|0)==0,l=0;do B=n[(n[d>>2]|0)+(l<<2)>>2]|0,k=uc(B)|0,n[(n[d>>2]|0)+(l<<2)>>2]=k,n[k+944>>2]=o,m||S_[A&15](B,k,o,l),l=l+1|0;while((l|0)!=(u|0))}}function Ie(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0,tt=0,Ze=0;tt=I,I=I+64|0,G=tt+52|0,k=tt+48|0,ae=tt+28|0,We=tt+24|0,Le=tt+20|0,Qe=tt,A=n[o>>2]|0,m=A,l=A+((n[l>>2]|0)-m>>2<<2)|0,A=o+4|0,d=n[A>>2]|0,B=o+8|0;do if(d>>>0<(n[B>>2]|0)>>>0){if((l|0)==(d|0)){n[l>>2]=n[u>>2],n[A>>2]=(n[A>>2]|0)+4;break}bP(o,l,d,l+4|0),l>>>0<=u>>>0&&(u=(n[A>>2]|0)>>>0>u>>>0?u+4|0:u),n[l>>2]=n[u>>2]}else{A=(d-m>>2)+1|0,d=O(o)|0,d>>>0>>0&&sn(o),M=n[o>>2]|0,_=(n[B>>2]|0)-M|0,m=_>>1,ky(Qe,_>>2>>>0>>1>>>0?m>>>0>>0?A:m:d,l-M>>2,o+8|0),M=Qe+8|0,A=n[M>>2]|0,m=Qe+12|0,_=n[m>>2]|0,B=_,T=A;do if((A|0)==(_|0)){if(_=Qe+4|0,A=n[_>>2]|0,Ze=n[Qe>>2]|0,d=Ze,A>>>0<=Ze>>>0){A=B-d>>1,A=A|0?A:1,ky(ae,A,A>>>2,n[Qe+16>>2]|0),n[We>>2]=n[_>>2],n[Le>>2]=n[M>>2],n[k>>2]=n[We>>2],n[G>>2]=n[Le>>2],c2(ae,k,G),A=n[Qe>>2]|0,n[Qe>>2]=n[ae>>2],n[ae>>2]=A,A=ae+4|0,Ze=n[_>>2]|0,n[_>>2]=n[A>>2],n[A>>2]=Ze,A=ae+8|0,Ze=n[M>>2]|0,n[M>>2]=n[A>>2],n[A>>2]=Ze,A=ae+12|0,Ze=n[m>>2]|0,n[m>>2]=n[A>>2],n[A>>2]=Ze,Qy(ae),A=n[M>>2]|0;break}m=A,B=((m-d>>2)+1|0)/-2|0,k=A+(B<<2)|0,d=T-m|0,m=d>>2,m&&(F2(k|0,A|0,d|0)|0,A=n[_>>2]|0),Ze=k+(m<<2)|0,n[M>>2]=Ze,n[_>>2]=A+(B<<2),A=Ze}while(!1);n[A>>2]=n[u>>2],n[M>>2]=(n[M>>2]|0)+4,l=PP(o,Qe,l)|0,Qy(Qe)}while(!1);return I=tt,l|0}function Oe(o){o=o|0;var l=0;do{if(l=o+984|0,s[l>>0]|0)break;s[l>>0]=1,h[o+504>>2]=y(ce),o=n[o+944>>2]|0}while(o|0)}function ht(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-4-A|0)>>>2)<<2)),yt(u))}function mt(o){return o=o|0,n[o+944>>2]|0}function Dt(o){o=o|0,wi(o,(n[o+964>>2]|0)!=0,2832),Oe(o)}function tr(o){return o=o|0,(s[o+984>>0]|0)!=0|0}function fn(o,l){o=o|0,l=l|0,qYe(o,l,400)|0&&(Qr(o|0,l|0,400)|0,Oe(o))}function ai(o){o=o|0;var l=Xe;return l=y(h[o+44>>2]),o=Mt(l)|0,y(o?y(0):l)}function qi(o){o=o|0;var l=Xe;return l=y(h[o+48>>2]),Mt(l)|0&&(l=s[(n[o+976>>2]|0)+2>>0]|0?y(1):y(0)),y(l)}function Tn(o,l){o=o|0,l=l|0,n[o+980>>2]=l}function Ga(o){return o=o|0,n[o+980>>2]|0}function my(o,l){o=o|0,l=l|0;var u=0;u=o+4|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function t2(o){return o=o|0,n[o+4>>2]|0}function Do(o,l){o=o|0,l=l|0;var u=0;u=o+8|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function yy(o){return o=o|0,n[o+8>>2]|0}function wh(o,l){o=o|0,l=l|0;var u=0;u=o+12|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function r2(o){return o=o|0,n[o+12>>2]|0}function bo(o,l){o=o|0,l=l|0;var u=0;u=o+16|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function Bh(o){return o=o|0,n[o+16>>2]|0}function vh(o,l){o=o|0,l=l|0;var u=0;u=o+20|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function du(o){return o=o|0,n[o+20>>2]|0}function Sh(o,l){o=o|0,l=l|0;var u=0;u=o+24|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function Ng(o){return o=o|0,n[o+24>>2]|0}function Og(o,l){o=o|0,l=l|0;var u=0;u=o+28|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function Lg(o){return o=o|0,n[o+28>>2]|0}function Ey(o,l){o=o|0,l=l|0;var u=0;u=o+32|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function mf(o){return o=o|0,n[o+32>>2]|0}function Po(o,l){o=o|0,l=l|0;var u=0;u=o+36|0,(n[u>>2]|0)!=(l|0)&&(n[u>>2]=l,Oe(o))}function Dl(o){return o=o|0,n[o+36>>2]|0}function Dh(o,l){o=o|0,l=y(l);var u=0;u=o+40|0,y(h[u>>2])!=l&&(h[u>>2]=l,Oe(o))}function Mg(o,l){o=o|0,l=y(l);var u=0;u=o+44|0,y(h[u>>2])!=l&&(h[u>>2]=l,Oe(o))}function bl(o,l){o=o|0,l=y(l);var u=0;u=o+48|0,y(h[u>>2])!=l&&(h[u>>2]=l,Oe(o))}function Pl(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+52|0,d=o+56|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function Iy(o,l){o=o|0,l=y(l);var u=0,A=0;A=o+52|0,u=o+56|0,y(h[A>>2])==l&&(n[u>>2]|0)==2||(h[A>>2]=l,A=Mt(l)|0,n[u>>2]=A?3:2,Oe(o))}function HA(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+52|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function Cy(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=(m^1)&1,d=o+132+(l<<3)|0,l=o+132+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function wy(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=m?0:2,d=o+132+(l<<3)|0,l=o+132+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function jA(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=l+132+(u<<3)|0,l=n[A+4>>2]|0,u=o,n[u>>2]=n[A>>2],n[u+4>>2]=l}function qA(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=(m^1)&1,d=o+60+(l<<3)|0,l=o+60+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function Y(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=m?0:2,d=o+60+(l<<3)|0,l=o+60+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function xt(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=l+60+(u<<3)|0,l=n[A+4>>2]|0,u=o,n[u>>2]=n[A>>2],n[u+4>>2]=l}function GA(o,l){o=o|0,l=l|0;var u=0;u=o+60+(l<<3)+4|0,(n[u>>2]|0)!=3&&(h[o+60+(l<<3)>>2]=y(ce),n[u>>2]=3,Oe(o))}function xo(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=(m^1)&1,d=o+204+(l<<3)|0,l=o+204+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function yf(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=m?0:2,d=o+204+(l<<3)|0,l=o+204+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function dt(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=l+204+(u<<3)|0,l=n[A+4>>2]|0,u=o,n[u>>2]=n[A>>2],n[u+4>>2]=l}function mu(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0,m=0;m=Mt(u)|0,A=(m^1)&1,d=o+276+(l<<3)|0,l=o+276+(l<<3)+4|0,m|y(h[d>>2])==u&&(n[l>>2]|0)==(A|0)||(h[d>>2]=u,n[l>>2]=A,Oe(o))}function By(o,l){return o=o|0,l=l|0,y(h[o+276+(l<<3)>>2])}function _g(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+348|0,d=o+352|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function n2(o,l){o=o|0,l=y(l);var u=0,A=0;A=o+348|0,u=o+352|0,y(h[A>>2])==l&&(n[u>>2]|0)==2||(h[A>>2]=l,A=Mt(l)|0,n[u>>2]=A?3:2,Oe(o))}function bh(o){o=o|0;var l=0;l=o+352|0,(n[l>>2]|0)!=3&&(h[o+348>>2]=y(ce),n[l>>2]=3,Oe(o))}function ur(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+348|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function zi(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+356|0,d=o+360|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function Ef(o,l){o=o|0,l=y(l);var u=0,A=0;A=o+356|0,u=o+360|0,y(h[A>>2])==l&&(n[u>>2]|0)==2||(h[A>>2]=l,A=Mt(l)|0,n[u>>2]=A?3:2,Oe(o))}function Wa(o){o=o|0;var l=0;l=o+360|0,(n[l>>2]|0)!=3&&(h[o+356>>2]=y(ce),n[l>>2]=3,Oe(o))}function Ug(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+356|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function yu(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+364|0,d=o+368|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function If(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=m?0:2,A=o+364|0,d=o+368|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function wt(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+364|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function gi(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+372|0,d=o+376|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function WA(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=m?0:2,A=o+372|0,d=o+376|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function Ya(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+372|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function pa(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+380|0,d=o+384|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function Va(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=m?0:2,A=o+380|0,d=o+384|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function Hg(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+380|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function Ph(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=(m^1)&1,A=o+388|0,d=o+392|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function jg(o,l){o=o|0,l=y(l);var u=0,A=0,d=0,m=0;m=Mt(l)|0,u=m?0:2,A=o+388|0,d=o+392|0,m|y(h[A>>2])==l&&(n[d>>2]|0)==(u|0)||(h[A>>2]=l,n[d>>2]=u,Oe(o))}function vy(o,l){o=o|0,l=l|0;var u=0,A=0;A=l+388|0,u=n[A+4>>2]|0,l=o,n[l>>2]=n[A>>2],n[l+4>>2]=u}function YA(o,l){o=o|0,l=y(l);var u=0;u=o+396|0,y(h[u>>2])!=l&&(h[u>>2]=l,Oe(o))}function qg(o){return o=o|0,y(h[o+396>>2])}function Eu(o){return o=o|0,y(h[o+400>>2])}function Iu(o){return o=o|0,y(h[o+404>>2])}function Cf(o){return o=o|0,y(h[o+408>>2])}function Fs(o){return o=o|0,y(h[o+412>>2])}function Cu(o){return o=o|0,y(h[o+416>>2])}function qn(o){return o=o|0,y(h[o+420>>2])}function is(o,l){switch(o=o|0,l=l|0,wi(o,(l|0)<6,2918),l|0){case 0:{l=(n[o+496>>2]|0)==2?5:4;break}case 2:{l=(n[o+496>>2]|0)==2?4:5;break}default:}return y(h[o+424+(l<<2)>>2])}function xi(o,l){switch(o=o|0,l=l|0,wi(o,(l|0)<6,2918),l|0){case 0:{l=(n[o+496>>2]|0)==2?5:4;break}case 2:{l=(n[o+496>>2]|0)==2?4:5;break}default:}return y(h[o+448+(l<<2)>>2])}function VA(o,l){switch(o=o|0,l=l|0,wi(o,(l|0)<6,2918),l|0){case 0:{l=(n[o+496>>2]|0)==2?5:4;break}case 2:{l=(n[o+496>>2]|0)==2?4:5;break}default:}return y(h[o+472+(l<<2)>>2])}function wf(o,l){o=o|0,l=l|0;var u=0,A=Xe;return u=n[o+4>>2]|0,(u|0)==(n[l+4>>2]|0)?u?(A=y(h[o>>2]),o=y(se(y(A-y(h[l>>2]))))>2]=0,n[A+4>>2]=0,n[A+8>>2]=0,fu(A|0,o|0,l|0,0),Qo(o,3,(s[A+11>>0]|0)<0?n[A>>2]|0:A,u),AVe(A),I=u}function ss(o,l,u,A){o=y(o),l=y(l),u=u|0,A=A|0;var d=Xe;o=y(o*l),d=y(E_(o,y(1)));do if(mn(d,y(0))|0)o=y(o-d);else{if(o=y(o-d),mn(d,y(1))|0){o=y(o+y(1));break}if(u){o=y(o+y(1));break}A||(d>y(.5)?d=y(1):(A=mn(d,y(.5))|0,d=y(A?1:0)),o=y(o+d))}while(!1);return y(o/l)}function xl(o,l,u,A,d,m,B,k,T,_,M,G,ae){o=o|0,l=y(l),u=u|0,A=y(A),d=d|0,m=y(m),B=B|0,k=y(k),T=y(T),_=y(_),M=y(M),G=y(G),ae=ae|0;var We=0,Le=Xe,Qe=Xe,tt=Xe,Ze=Xe,ct=Xe,He=Xe;return T>2]),Le!=y(0))?(tt=y(ss(l,Le,0,0)),Ze=y(ss(A,Le,0,0)),Qe=y(ss(m,Le,0,0)),Le=y(ss(k,Le,0,0))):(Qe=m,tt=l,Le=k,Ze=A),(d|0)==(o|0)?We=mn(Qe,tt)|0:We=0,(B|0)==(u|0)?ae=mn(Le,Ze)|0:ae=0,!We&&(ct=y(l-M),!(ko(o,ct,T)|0))&&!(Bf(o,ct,d,T)|0)?We=vf(o,ct,d,m,T)|0:We=1,!ae&&(He=y(A-G),!(ko(u,He,_)|0))&&!(Bf(u,He,B,_)|0)?ae=vf(u,He,B,k,_)|0:ae=1,ae=We&ae),ae|0}function ko(o,l,u){return o=o|0,l=y(l),u=y(u),(o|0)==1?o=mn(l,u)|0:o=0,o|0}function Bf(o,l,u,A){return o=o|0,l=y(l),u=u|0,A=y(A),(o|0)==2&(u|0)==0?l>=A?o=1:o=mn(l,A)|0:o=0,o|0}function vf(o,l,u,A,d){return o=o|0,l=y(l),u=u|0,A=y(A),d=y(d),(o|0)==2&(u|0)==2&A>l?d<=l?o=1:o=mn(l,d)|0:o=0,o|0}function kl(o,l,u,A,d,m,B,k,T,_,M){o=o|0,l=y(l),u=y(u),A=A|0,d=d|0,m=m|0,B=y(B),k=y(k),T=T|0,_=_|0,M=M|0;var G=0,ae=0,We=0,Le=0,Qe=Xe,tt=Xe,Ze=0,ct=0,He=0,Ge=0,Lt=0,qr=0,fr=0,$t=0,Tr=0,Hr=0,cr=0,Hn=Xe,Fo=Xe,No=Xe,Oo=0,$a=0;cr=I,I=I+160|0,$t=cr+152|0,fr=cr+120|0,qr=cr+104|0,He=cr+72|0,Le=cr+56|0,Lt=cr+8|0,ct=cr,Ge=(n[2279]|0)+1|0,n[2279]=Ge,Tr=o+984|0,s[Tr>>0]|0&&(n[o+512>>2]|0)!=(n[2278]|0)?Ze=4:(n[o+516>>2]|0)==(A|0)?Hr=0:Ze=4,(Ze|0)==4&&(n[o+520>>2]=0,n[o+924>>2]=-1,n[o+928>>2]=-1,h[o+932>>2]=y(-1),h[o+936>>2]=y(-1),Hr=1);e:do if(n[o+964>>2]|0)if(Qe=y(yn(o,2,B)),tt=y(yn(o,0,B)),G=o+916|0,No=y(h[G>>2]),Fo=y(h[o+920>>2]),Hn=y(h[o+932>>2]),xl(d,l,m,u,n[o+924>>2]|0,No,n[o+928>>2]|0,Fo,Hn,y(h[o+936>>2]),Qe,tt,M)|0)Ze=22;else if(We=n[o+520>>2]|0,!We)Ze=21;else for(ae=0;;){if(G=o+524+(ae*24|0)|0,Hn=y(h[G>>2]),Fo=y(h[o+524+(ae*24|0)+4>>2]),No=y(h[o+524+(ae*24|0)+16>>2]),xl(d,l,m,u,n[o+524+(ae*24|0)+8>>2]|0,Hn,n[o+524+(ae*24|0)+12>>2]|0,Fo,No,y(h[o+524+(ae*24|0)+20>>2]),Qe,tt,M)|0){Ze=22;break e}if(ae=ae+1|0,ae>>>0>=We>>>0){Ze=21;break}}else{if(T){if(G=o+916|0,!(mn(y(h[G>>2]),l)|0)){Ze=21;break}if(!(mn(y(h[o+920>>2]),u)|0)){Ze=21;break}if((n[o+924>>2]|0)!=(d|0)){Ze=21;break}G=(n[o+928>>2]|0)==(m|0)?G:0,Ze=22;break}if(We=n[o+520>>2]|0,!We)Ze=21;else for(ae=0;;){if(G=o+524+(ae*24|0)|0,mn(y(h[G>>2]),l)|0&&mn(y(h[o+524+(ae*24|0)+4>>2]),u)|0&&(n[o+524+(ae*24|0)+8>>2]|0)==(d|0)&&(n[o+524+(ae*24|0)+12>>2]|0)==(m|0)){Ze=22;break e}if(ae=ae+1|0,ae>>>0>=We>>>0){Ze=21;break}}}while(!1);do if((Ze|0)==21)s[11697]|0?(G=0,Ze=28):(G=0,Ze=31);else if((Ze|0)==22){if(ae=(s[11697]|0)!=0,!((G|0)!=0&(Hr^1)))if(ae){Ze=28;break}else{Ze=31;break}Le=G+16|0,n[o+908>>2]=n[Le>>2],We=G+20|0,n[o+912>>2]=n[We>>2],(s[11698]|0)==0|ae^1||(n[ct>>2]=wu(Ge)|0,n[ct+4>>2]=Ge,Qo(o,4,2972,ct),ae=n[o+972>>2]|0,ae|0&&op[ae&127](o),d=ha(d,T)|0,m=ha(m,T)|0,$a=+y(h[Le>>2]),Oo=+y(h[We>>2]),n[Lt>>2]=d,n[Lt+4>>2]=m,E[Lt+8>>3]=+l,E[Lt+16>>3]=+u,E[Lt+24>>3]=$a,E[Lt+32>>3]=Oo,n[Lt+40>>2]=_,Qo(o,4,2989,Lt))}while(!1);return(Ze|0)==28&&(ae=wu(Ge)|0,n[Le>>2]=ae,n[Le+4>>2]=Ge,n[Le+8>>2]=Hr?3047:11699,Qo(o,4,3038,Le),ae=n[o+972>>2]|0,ae|0&&op[ae&127](o),Lt=ha(d,T)|0,Ze=ha(m,T)|0,n[He>>2]=Lt,n[He+4>>2]=Ze,E[He+8>>3]=+l,E[He+16>>3]=+u,n[He+24>>2]=_,Qo(o,4,3049,He),Ze=31),(Ze|0)==31&&(Ns(o,l,u,A,d,m,B,k,T,M),s[11697]|0&&(ae=n[2279]|0,Lt=wu(ae)|0,n[qr>>2]=Lt,n[qr+4>>2]=ae,n[qr+8>>2]=Hr?3047:11699,Qo(o,4,3083,qr),ae=n[o+972>>2]|0,ae|0&&op[ae&127](o),Lt=ha(d,T)|0,qr=ha(m,T)|0,Oo=+y(h[o+908>>2]),$a=+y(h[o+912>>2]),n[fr>>2]=Lt,n[fr+4>>2]=qr,E[fr+8>>3]=Oo,E[fr+16>>3]=$a,n[fr+24>>2]=_,Qo(o,4,3092,fr)),n[o+516>>2]=A,G||(ae=o+520|0,G=n[ae>>2]|0,(G|0)==16&&(s[11697]|0&&Qo(o,4,3124,$t),n[ae>>2]=0,G=0),T?G=o+916|0:(n[ae>>2]=G+1,G=o+524+(G*24|0)|0),h[G>>2]=l,h[G+4>>2]=u,n[G+8>>2]=d,n[G+12>>2]=m,n[G+16>>2]=n[o+908>>2],n[G+20>>2]=n[o+912>>2],G=0)),T&&(n[o+416>>2]=n[o+908>>2],n[o+420>>2]=n[o+912>>2],s[o+985>>0]=1,s[Tr>>0]=0),n[2279]=(n[2279]|0)+-1,n[o+512>>2]=n[2278],I=cr,Hr|(G|0)==0|0}function yn(o,l,u){o=o|0,l=l|0,u=y(u);var A=Xe;return A=y(J(o,l,u)),y(A+y(re(o,l,u)))}function Qo(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=I,I=I+16|0,d=m,n[d>>2]=A,o?A=n[o+976>>2]|0:A=0,Qh(A,o,l,u,d),I=m}function wu(o){return o=o|0,(o>>>0>60?3201:3201+(60-o)|0)|0}function ha(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;return d=I,I=I+32|0,u=d+12|0,A=d,n[u>>2]=n[254],n[u+4>>2]=n[255],n[u+8>>2]=n[256],n[A>>2]=n[257],n[A+4>>2]=n[258],n[A+8>>2]=n[259],(o|0)>2?o=11699:o=n[(l?A:u)+(o<<2)>>2]|0,I=d,o|0}function Ns(o,l,u,A,d,m,B,k,T,_){o=o|0,l=y(l),u=y(u),A=A|0,d=d|0,m=m|0,B=y(B),k=y(k),T=T|0,_=_|0;var M=0,G=0,ae=0,We=0,Le=Xe,Qe=Xe,tt=Xe,Ze=Xe,ct=Xe,He=Xe,Ge=Xe,Lt=0,qr=0,fr=0,$t=Xe,Tr=Xe,Hr=0,cr=Xe,Hn=0,Fo=0,No=0,Oo=0,$a=0,Kh=0,Jh=0,dc=0,zh=0,Ff=0,Nf=0,Zh=0,Xh=0,$h=0,on=0,mc=0,e0=0,ku=0,t0=Xe,r0=Xe,Of=Xe,Lf=Xe,Qu=Xe,ao=0,Ml=0,ya=0,yc=0,lp=0,cp=Xe,Mf=Xe,up=Xe,fp=Xe,lo=Xe,_s=Xe,Ec=0,Wn=Xe,Ap=Xe,Lo=Xe,Tu=Xe,Mo=Xe,Ru=Xe,pp=0,hp=0,Fu=Xe,co=Xe,Ic=0,gp=0,dp=0,mp=0,Fr=Xe,ci=0,Us=0,_o=0,uo=0,Mr=0,Ar=0,Cc=0,zt=Xe,yp=0,Bi=0;Cc=I,I=I+16|0,ao=Cc+12|0,Ml=Cc+8|0,ya=Cc+4|0,yc=Cc,wi(o,(d|0)==0|(Mt(l)|0)^1,3326),wi(o,(m|0)==0|(Mt(u)|0)^1,3406),Us=ft(o,A)|0,n[o+496>>2]=Us,Mr=dr(2,Us)|0,Ar=dr(0,Us)|0,h[o+440>>2]=y(J(o,Mr,B)),h[o+444>>2]=y(re(o,Mr,B)),h[o+428>>2]=y(J(o,Ar,B)),h[o+436>>2]=y(re(o,Ar,B)),h[o+464>>2]=y(Br(o,Mr)),h[o+468>>2]=y(_n(o,Mr)),h[o+452>>2]=y(Br(o,Ar)),h[o+460>>2]=y(_n(o,Ar)),h[o+488>>2]=y(di(o,Mr,B)),h[o+492>>2]=y(ws(o,Mr,B)),h[o+476>>2]=y(di(o,Ar,B)),h[o+484>>2]=y(ws(o,Ar,B));do if(n[o+964>>2]|0)zA(o,l,u,d,m,B,k);else{if(_o=o+948|0,uo=(n[o+952>>2]|0)-(n[_o>>2]|0)>>2,!uo){wP(o,l,u,d,m,B,k);break}if(!T&&i2(o,l,u,d,m,B,k)|0)break;ee(o),mc=o+508|0,s[mc>>0]=0,Mr=dr(n[o+4>>2]|0,Us)|0,Ar=by(Mr,Us)|0,ci=de(Mr)|0,e0=n[o+8>>2]|0,gp=o+28|0,ku=(n[gp>>2]|0)!=0,Mo=ci?B:k,Fu=ci?k:B,t0=y(Rh(o,Mr,B)),r0=y(s2(o,Mr,B)),Le=y(Rh(o,Ar,B)),Ru=y(Ka(o,Mr,B)),co=y(Ka(o,Ar,B)),fr=ci?d:m,Ic=ci?m:d,Fr=ci?Ru:co,ct=ci?co:Ru,Tu=y(yn(o,2,B)),Ze=y(yn(o,0,B)),Qe=y(y(Xr(o+364|0,B))-Fr),tt=y(y(Xr(o+380|0,B))-Fr),He=y(y(Xr(o+372|0,k))-ct),Ge=y(y(Xr(o+388|0,k))-ct),Of=ci?Qe:He,Lf=ci?tt:Ge,Tu=y(l-Tu),l=y(Tu-Fr),Mt(l)|0?Fr=l:Fr=y($n(y(hd(l,tt)),Qe)),Ap=y(u-Ze),l=y(Ap-ct),Mt(l)|0?Lo=l:Lo=y($n(y(hd(l,Ge)),He)),Qe=ci?Fr:Lo,Wn=ci?Lo:Fr;e:do if((fr|0)==1)for(A=0,G=0;;){if(M=Cs(o,G)|0,!A)y(ZA(M))>y(0)&&y(Fh(M))>y(0)?A=M:A=0;else if(o2(M)|0){We=0;break e}if(G=G+1|0,G>>>0>=uo>>>0){We=A;break}}else We=0;while(!1);Lt=We+500|0,qr=We+504|0,A=0,M=0,l=y(0),ae=0;do{if(G=n[(n[_o>>2]|0)+(ae<<2)>>2]|0,(n[G+36>>2]|0)==1)Py(G),s[G+985>>0]=1,s[G+984>>0]=0;else{Sf(G),T&&kh(G,ft(G,Us)|0,Qe,Wn,Fr);do if((n[G+24>>2]|0)!=1)if((G|0)==(We|0)){n[Lt>>2]=n[2278],h[qr>>2]=y(0);break}else{BP(o,G,Fr,d,Lo,Fr,Lo,m,Us,_);break}else M|0&&(n[M+960>>2]=G),n[G+960>>2]=0,M=G,A=A|0?A:G;while(!1);_s=y(h[G+504>>2]),l=y(l+y(_s+y(yn(G,Mr,Fr))))}ae=ae+1|0}while((ae|0)!=(uo|0));for(No=l>Qe,Ec=ku&((fr|0)==2&No)?1:fr,Hn=(Ic|0)==1,$a=Hn&(T^1),Kh=(Ec|0)==1,Jh=(Ec|0)==2,dc=976+(Mr<<2)|0,zh=(Ic|2|0)==2,$h=Hn&(ku^1),Ff=1040+(Ar<<2)|0,Nf=1040+(Mr<<2)|0,Zh=976+(Ar<<2)|0,Xh=(Ic|0)!=1,No=ku&((fr|0)!=0&No),Fo=o+976|0,Hn=Hn^1,l=Qe,Hr=0,Oo=0,_s=y(0),Qu=y(0);;){e:do if(Hr>>>0>>0)for(qr=n[_o>>2]|0,ae=0,Ge=y(0),He=y(0),tt=y(0),Qe=y(0),G=0,M=0,We=Hr;;){if(Lt=n[qr+(We<<2)>>2]|0,(n[Lt+36>>2]|0)!=1&&(n[Lt+940>>2]=Oo,(n[Lt+24>>2]|0)!=1)){if(Ze=y(yn(Lt,Mr,Fr)),on=n[dc>>2]|0,u=y(Xr(Lt+380+(on<<3)|0,Mo)),ct=y(h[Lt+504>>2]),u=y(hd(u,ct)),u=y($n(y(Xr(Lt+364+(on<<3)|0,Mo)),u)),ku&(ae|0)!=0&y(Ze+y(He+u))>l){m=ae,Ze=Ge,fr=We;break e}Ze=y(Ze+u),u=y(He+Ze),Ze=y(Ge+Ze),o2(Lt)|0&&(tt=y(tt+y(ZA(Lt))),Qe=y(Qe-y(ct*y(Fh(Lt))))),M|0&&(n[M+960>>2]=Lt),n[Lt+960>>2]=0,ae=ae+1|0,M=Lt,G=G|0?G:Lt}else Ze=Ge,u=He;if(We=We+1|0,We>>>0>>0)Ge=Ze,He=u;else{m=ae,fr=We;break}}else m=0,Ze=y(0),tt=y(0),Qe=y(0),G=0,fr=Hr;while(!1);on=tt>y(0)&tty(0)&QeLf&((Mt(Lf)|0)^1))l=Lf,on=51;else if(s[(n[Fo>>2]|0)+3>>0]|0)on=51;else{if($t!=y(0)&&y(ZA(o))!=y(0)){on=53;break}l=Ze,on=53}while(!1);if((on|0)==51&&(on=0,Mt(l)|0?on=53:(Tr=y(l-Ze),cr=l)),(on|0)==53&&(on=0,Ze>2]|0,We=Try(0),He=y(Tr/$t),tt=y(0),Ze=y(0),l=y(0),M=G;do u=y(Xr(M+380+(ae<<3)|0,Mo)),Qe=y(Xr(M+364+(ae<<3)|0,Mo)),Qe=y(hd(u,y($n(Qe,y(h[M+504>>2]))))),We?(u=y(Qe*y(Fh(M))),u!=y(-0)&&(zt=y(Qe-y(ct*u)),cp=y(Gn(M,Mr,zt,cr,Fr)),zt!=cp)&&(tt=y(tt-y(cp-Qe)),l=y(l+u))):Lt&&(Mf=y(ZA(M)),Mf!=y(0))&&(zt=y(Qe+y(He*Mf)),up=y(Gn(M,Mr,zt,cr,Fr)),zt!=up)&&(tt=y(tt-y(up-Qe)),Ze=y(Ze-Mf)),M=n[M+960>>2]|0;while(M|0);if(l=y(Ge+l),Qe=y(Tr+tt),lp)l=y(0);else{ct=y($t+Ze),We=n[dc>>2]|0,Lt=Qey(0),ct=y(Qe/ct),l=y(0);do{zt=y(Xr(G+380+(We<<3)|0,Mo)),tt=y(Xr(G+364+(We<<3)|0,Mo)),tt=y(hd(zt,y($n(tt,y(h[G+504>>2]))))),Lt?(zt=y(tt*y(Fh(G))),Qe=y(-zt),zt!=y(-0)?(zt=y(He*Qe),Qe=y(Gn(G,Mr,y(tt+(qr?Qe:zt)),cr,Fr))):Qe=tt):ae&&(fp=y(ZA(G)),fp!=y(0))?Qe=y(Gn(G,Mr,y(tt+y(ct*fp)),cr,Fr)):Qe=tt,l=y(l-y(Qe-tt)),Ze=y(yn(G,Mr,Fr)),u=y(yn(G,Ar,Fr)),Qe=y(Qe+Ze),h[Ml>>2]=Qe,n[yc>>2]=1,tt=y(h[G+396>>2]);e:do if(Mt(tt)|0){M=Mt(Wn)|0;do if(!M){if(No|(so(G,Ar,Wn)|0|Hn)||(os(o,G)|0)!=4||(n[(Ql(G,Ar)|0)+4>>2]|0)==3||(n[(Tl(G,Ar)|0)+4>>2]|0)==3)break;h[ao>>2]=Wn,n[ya>>2]=1;break e}while(!1);if(so(G,Ar,Wn)|0){M=n[G+992+(n[Zh>>2]<<2)>>2]|0,zt=y(u+y(Xr(M,Wn))),h[ao>>2]=zt,M=Xh&(n[M+4>>2]|0)==2,n[ya>>2]=((Mt(zt)|0|M)^1)&1;break}else{h[ao>>2]=Wn,n[ya>>2]=M?0:2;break}}else zt=y(Qe-Ze),$t=y(zt/tt),zt=y(tt*zt),n[ya>>2]=1,h[ao>>2]=y(u+(ci?$t:zt));while(!1);Bu(G,Mr,cr,Fr,yc,Ml),Bu(G,Ar,Wn,Fr,ya,ao);do if(!(so(G,Ar,Wn)|0)&&(os(o,G)|0)==4){if((n[(Ql(G,Ar)|0)+4>>2]|0)==3){M=0;break}M=(n[(Tl(G,Ar)|0)+4>>2]|0)!=3}else M=0;while(!1);zt=y(h[Ml>>2]),$t=y(h[ao>>2]),yp=n[yc>>2]|0,Bi=n[ya>>2]|0,kl(G,ci?zt:$t,ci?$t:zt,Us,ci?yp:Bi,ci?Bi:yp,Fr,Lo,T&(M^1),3488,_)|0,s[mc>>0]=s[mc>>0]|s[G+508>>0],G=n[G+960>>2]|0}while(G|0)}}else l=y(0);if(l=y(Tr+l),Bi=l>0]=Bi|c[mc>>0],Jh&l>y(0)?(M=n[dc>>2]|0,n[o+364+(M<<3)+4>>2]|0&&(lo=y(Xr(o+364+(M<<3)|0,Mo)),lo>=y(0))?Qe=y($n(y(0),y(lo-y(cr-l)))):Qe=y(0)):Qe=l,Lt=Hr>>>0>>0,Lt){We=n[_o>>2]|0,ae=Hr,M=0;do G=n[We+(ae<<2)>>2]|0,n[G+24>>2]|0||(M=((n[(Ql(G,Mr)|0)+4>>2]|0)==3&1)+M|0,M=M+((n[(Tl(G,Mr)|0)+4>>2]|0)==3&1)|0),ae=ae+1|0;while((ae|0)!=(fr|0));M?(Ze=y(0),u=y(0)):on=101}else on=101;e:do if((on|0)==101)switch(on=0,e0|0){case 1:{M=0,Ze=y(Qe*y(.5)),u=y(0);break e}case 2:{M=0,Ze=Qe,u=y(0);break e}case 3:{if(m>>>0<=1){M=0,Ze=y(0),u=y(0);break e}u=y((m+-1|0)>>>0),M=0,Ze=y(0),u=y(y($n(Qe,y(0)))/u);break e}case 5:{u=y(Qe/y((m+1|0)>>>0)),M=0,Ze=u;break e}case 4:{u=y(Qe/y(m>>>0)),M=0,Ze=y(u*y(.5));break e}default:{M=0,Ze=y(0),u=y(0);break e}}while(!1);if(l=y(t0+Ze),Lt){tt=y(Qe/y(M|0)),ae=n[_o>>2]|0,G=Hr,Qe=y(0);do{M=n[ae+(G<<2)>>2]|0;e:do if((n[M+36>>2]|0)!=1){switch(n[M+24>>2]|0){case 1:{if(ga(M,Mr)|0){if(!T)break e;zt=y(XA(M,Mr,cr)),zt=y(zt+y(Br(o,Mr))),zt=y(zt+y(J(M,Mr,Fr))),h[M+400+(n[Nf>>2]<<2)>>2]=zt;break e}break}case 0:if(Bi=(n[(Ql(M,Mr)|0)+4>>2]|0)==3,zt=y(tt+l),l=Bi?zt:l,T&&(Bi=M+400+(n[Nf>>2]<<2)|0,h[Bi>>2]=y(l+y(h[Bi>>2]))),Bi=(n[(Tl(M,Mr)|0)+4>>2]|0)==3,zt=y(tt+l),l=Bi?zt:l,$a){zt=y(u+y(yn(M,Mr,Fr))),Qe=Wn,l=y(l+y(zt+y(h[M+504>>2])));break e}else{l=y(l+y(u+y($A(M,Mr,Fr)))),Qe=y($n(Qe,y($A(M,Ar,Fr))));break e}default:}T&&(zt=y(Ze+y(Br(o,Mr))),Bi=M+400+(n[Nf>>2]<<2)|0,h[Bi>>2]=y(zt+y(h[Bi>>2])))}while(!1);G=G+1|0}while((G|0)!=(fr|0))}else Qe=y(0);if(u=y(r0+l),zh?Ze=y(y(Gn(o,Ar,y(co+Qe),Fu,B))-co):Ze=Wn,tt=y(y(Gn(o,Ar,y(co+($h?Wn:Qe)),Fu,B))-co),Lt&T){G=Hr;do{ae=n[(n[_o>>2]|0)+(G<<2)>>2]|0;do if((n[ae+36>>2]|0)!=1){if((n[ae+24>>2]|0)==1){if(ga(ae,Ar)|0){if(zt=y(XA(ae,Ar,Wn)),zt=y(zt+y(Br(o,Ar))),zt=y(zt+y(J(ae,Ar,Fr))),M=n[Ff>>2]|0,h[ae+400+(M<<2)>>2]=zt,!(Mt(zt)|0))break}else M=n[Ff>>2]|0;zt=y(Br(o,Ar)),h[ae+400+(M<<2)>>2]=y(zt+y(J(ae,Ar,Fr)));break}M=os(o,ae)|0;do if((M|0)==4){if((n[(Ql(ae,Ar)|0)+4>>2]|0)==3){on=139;break}if((n[(Tl(ae,Ar)|0)+4>>2]|0)==3){on=139;break}if(so(ae,Ar,Wn)|0){l=Le;break}yp=n[ae+908+(n[dc>>2]<<2)>>2]|0,n[ao>>2]=yp,l=y(h[ae+396>>2]),Bi=Mt(l)|0,Qe=(n[S>>2]=yp,y(h[S>>2])),Bi?l=tt:(Tr=y(yn(ae,Ar,Fr)),zt=y(Qe/l),l=y(l*Qe),l=y(Tr+(ci?zt:l))),h[Ml>>2]=l,h[ao>>2]=y(y(yn(ae,Mr,Fr))+Qe),n[ya>>2]=1,n[yc>>2]=1,Bu(ae,Mr,cr,Fr,ya,ao),Bu(ae,Ar,Wn,Fr,yc,Ml),l=y(h[ao>>2]),Tr=y(h[Ml>>2]),zt=ci?l:Tr,l=ci?Tr:l,Bi=((Mt(zt)|0)^1)&1,kl(ae,zt,l,Us,Bi,((Mt(l)|0)^1)&1,Fr,Lo,1,3493,_)|0,l=Le}else on=139;while(!1);e:do if((on|0)==139){on=0,l=y(Ze-y($A(ae,Ar,Fr)));do if((n[(Ql(ae,Ar)|0)+4>>2]|0)==3){if((n[(Tl(ae,Ar)|0)+4>>2]|0)!=3)break;l=y(Le+y($n(y(0),y(l*y(.5)))));break e}while(!1);if((n[(Tl(ae,Ar)|0)+4>>2]|0)==3){l=Le;break}if((n[(Ql(ae,Ar)|0)+4>>2]|0)==3){l=y(Le+y($n(y(0),l)));break}switch(M|0){case 1:{l=Le;break e}case 2:{l=y(Le+y(l*y(.5)));break e}default:{l=y(Le+l);break e}}}while(!1);zt=y(_s+l),Bi=ae+400+(n[Ff>>2]<<2)|0,h[Bi>>2]=y(zt+y(h[Bi>>2]))}while(!1);G=G+1|0}while((G|0)!=(fr|0))}if(_s=y(_s+tt),Qu=y($n(Qu,u)),m=Oo+1|0,fr>>>0>=uo>>>0)break;l=cr,Hr=fr,Oo=m}do if(T){if(M=m>>>0>1,!M&&!(XL(o)|0))break;if(!(Mt(Wn)|0)){l=y(Wn-_s);e:do switch(n[o+12>>2]|0){case 3:{Le=y(Le+l),He=y(0);break}case 2:{Le=y(Le+y(l*y(.5))),He=y(0);break}case 4:{Wn>_s?He=y(l/y(m>>>0)):He=y(0);break}case 7:if(Wn>_s){Le=y(Le+y(l/y(m<<1>>>0))),He=y(l/y(m>>>0)),He=M?He:y(0);break e}else{Le=y(Le+y(l*y(.5))),He=y(0);break e}case 6:{He=y(l/y(Oo>>>0)),He=Wn>_s&M?He:y(0);break}default:He=y(0)}while(!1);if(m|0)for(Lt=1040+(Ar<<2)|0,qr=976+(Ar<<2)|0,We=0,G=0;;){e:do if(G>>>0>>0)for(Qe=y(0),tt=y(0),l=y(0),ae=G;;){M=n[(n[_o>>2]|0)+(ae<<2)>>2]|0;do if((n[M+36>>2]|0)!=1&&!(n[M+24>>2]|0)){if((n[M+940>>2]|0)!=(We|0))break e;if($L(M,Ar)|0&&(zt=y(h[M+908+(n[qr>>2]<<2)>>2]),l=y($n(l,y(zt+y(yn(M,Ar,Fr)))))),(os(o,M)|0)!=5)break;lo=y(Vg(M)),lo=y(lo+y(J(M,0,Fr))),zt=y(h[M+912>>2]),zt=y(y(zt+y(yn(M,0,Fr)))-lo),lo=y($n(tt,lo)),zt=y($n(Qe,zt)),Qe=zt,tt=lo,l=y($n(l,y(lo+zt)))}while(!1);if(M=ae+1|0,M>>>0>>0)ae=M;else{ae=M;break}}else tt=y(0),l=y(0),ae=G;while(!1);if(ct=y(He+l),u=Le,Le=y(Le+ct),G>>>0>>0){Ze=y(u+tt),M=G;do{G=n[(n[_o>>2]|0)+(M<<2)>>2]|0;e:do if((n[G+36>>2]|0)!=1&&!(n[G+24>>2]|0))switch(os(o,G)|0){case 1:{zt=y(u+y(J(G,Ar,Fr))),h[G+400+(n[Lt>>2]<<2)>>2]=zt;break e}case 3:{zt=y(y(Le-y(re(G,Ar,Fr)))-y(h[G+908+(n[qr>>2]<<2)>>2])),h[G+400+(n[Lt>>2]<<2)>>2]=zt;break e}case 2:{zt=y(u+y(y(ct-y(h[G+908+(n[qr>>2]<<2)>>2]))*y(.5))),h[G+400+(n[Lt>>2]<<2)>>2]=zt;break e}case 4:{if(zt=y(u+y(J(G,Ar,Fr))),h[G+400+(n[Lt>>2]<<2)>>2]=zt,so(G,Ar,Wn)|0||(ci?(Qe=y(h[G+908>>2]),l=y(Qe+y(yn(G,Mr,Fr))),tt=ct):(tt=y(h[G+912>>2]),tt=y(tt+y(yn(G,Ar,Fr))),l=ct,Qe=y(h[G+908>>2])),mn(l,Qe)|0&&mn(tt,y(h[G+912>>2]))|0))break e;kl(G,l,tt,Us,1,1,Fr,Lo,1,3501,_)|0;break e}case 5:{h[G+404>>2]=y(y(Ze-y(Vg(G)))+y(XA(G,0,Wn)));break e}default:break e}while(!1);M=M+1|0}while((M|0)!=(ae|0))}if(We=We+1|0,(We|0)==(m|0))break;G=ae}}}while(!1);if(h[o+908>>2]=y(Gn(o,2,Tu,B,B)),h[o+912>>2]=y(Gn(o,0,Ap,k,B)),Ec|0&&(pp=n[o+32>>2]|0,hp=(Ec|0)==2,!(hp&(pp|0)!=2))?hp&(pp|0)==2&&(l=y(Ru+cr),l=y($n(y(hd(l,y(Kg(o,Mr,Qu,Mo)))),Ru)),on=198):(l=y(Gn(o,Mr,Qu,Mo,B)),on=198),(on|0)==198&&(h[o+908+(n[976+(Mr<<2)>>2]<<2)>>2]=l),Ic|0&&(dp=n[o+32>>2]|0,mp=(Ic|0)==2,!(mp&(dp|0)!=2))?mp&(dp|0)==2&&(l=y(co+Wn),l=y($n(y(hd(l,y(Kg(o,Ar,y(co+_s),Fu)))),co)),on=204):(l=y(Gn(o,Ar,y(co+_s),Fu,B)),on=204),(on|0)==204&&(h[o+908+(n[976+(Ar<<2)>>2]<<2)>>2]=l),T){if((n[gp>>2]|0)==2){G=976+(Ar<<2)|0,ae=1040+(Ar<<2)|0,M=0;do We=Cs(o,M)|0,n[We+24>>2]|0||(yp=n[G>>2]|0,zt=y(h[o+908+(yp<<2)>>2]),Bi=We+400+(n[ae>>2]<<2)|0,zt=y(zt-y(h[Bi>>2])),h[Bi>>2]=y(zt-y(h[We+908+(yp<<2)>>2]))),M=M+1|0;while((M|0)!=(uo|0))}if(A|0){M=ci?Ec:d;do eM(o,A,Fr,M,Lo,Us,_),A=n[A+960>>2]|0;while(A|0)}if(M=(Mr|2|0)==3,G=(Ar|2|0)==3,M|G){A=0;do ae=n[(n[_o>>2]|0)+(A<<2)>>2]|0,(n[ae+36>>2]|0)!=1&&(M&&a2(o,ae,Mr),G&&a2(o,ae,Ar)),A=A+1|0;while((A|0)!=(uo|0))}}}while(!1);I=Cc}function xh(o,l){o=o|0,l=y(l);var u=0;ja(o,l>=y(0),3147),u=l==y(0),h[o+4>>2]=u?y(0):l}function KA(o,l,u,A){o=o|0,l=y(l),u=y(u),A=A|0;var d=Xe,m=Xe,B=0,k=0,T=0;n[2278]=(n[2278]|0)+1,Sf(o),so(o,2,l)|0?(d=y(Xr(n[o+992>>2]|0,l)),T=1,d=y(d+y(yn(o,2,l)))):(d=y(Xr(o+380|0,l)),d>=y(0)?T=2:(T=((Mt(l)|0)^1)&1,d=l)),so(o,0,u)|0?(m=y(Xr(n[o+996>>2]|0,u)),k=1,m=y(m+y(yn(o,0,l)))):(m=y(Xr(o+388|0,u)),m>=y(0)?k=2:(k=((Mt(u)|0)^1)&1,m=u)),B=o+976|0,kl(o,d,m,A,T,k,l,u,1,3189,n[B>>2]|0)|0&&(kh(o,n[o+496>>2]|0,l,u,l),JA(o,y(h[(n[B>>2]|0)+4>>2]),y(0),y(0)),s[11696]|0)&&Gg(o,7)}function Sf(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;k=I,I=I+32|0,B=k+24|0,m=k+16|0,A=k+8|0,d=k,u=0;do l=o+380+(u<<3)|0,n[o+380+(u<<3)+4>>2]|0&&(T=l,_=n[T+4>>2]|0,M=A,n[M>>2]=n[T>>2],n[M+4>>2]=_,M=o+364+(u<<3)|0,_=n[M+4>>2]|0,T=d,n[T>>2]=n[M>>2],n[T+4>>2]=_,n[m>>2]=n[A>>2],n[m+4>>2]=n[A+4>>2],n[B>>2]=n[d>>2],n[B+4>>2]=n[d+4>>2],wf(m,B)|0)||(l=o+348+(u<<3)|0),n[o+992+(u<<2)>>2]=l,u=u+1|0;while((u|0)!=2);I=k}function so(o,l,u){o=o|0,l=l|0,u=y(u);var A=0;switch(o=n[o+992+(n[976+(l<<2)>>2]<<2)>>2]|0,n[o+4>>2]|0){case 0:case 3:{o=0;break}case 1:{y(h[o>>2])>2])>2]|0){case 2:{l=y(y(y(h[o>>2])*l)/y(100));break}case 1:{l=y(h[o>>2]);break}default:l=y(ce)}return y(l)}function kh(o,l,u,A,d){o=o|0,l=l|0,u=y(u),A=y(A),d=y(d);var m=0,B=Xe;l=n[o+944>>2]|0?l:1,m=dr(n[o+4>>2]|0,l)|0,l=by(m,l)|0,u=y(vP(o,m,u)),A=y(vP(o,l,A)),B=y(u+y(J(o,m,d))),h[o+400+(n[1040+(m<<2)>>2]<<2)>>2]=B,u=y(u+y(re(o,m,d))),h[o+400+(n[1e3+(m<<2)>>2]<<2)>>2]=u,u=y(A+y(J(o,l,d))),h[o+400+(n[1040+(l<<2)>>2]<<2)>>2]=u,d=y(A+y(re(o,l,d))),h[o+400+(n[1e3+(l<<2)>>2]<<2)>>2]=d}function JA(o,l,u,A){o=o|0,l=y(l),u=y(u),A=y(A);var d=0,m=0,B=Xe,k=Xe,T=0,_=0,M=Xe,G=0,ae=Xe,We=Xe,Le=Xe,Qe=Xe;if(l!=y(0)&&(d=o+400|0,Qe=y(h[d>>2]),m=o+404|0,Le=y(h[m>>2]),G=o+416|0,We=y(h[G>>2]),_=o+420|0,B=y(h[_>>2]),ae=y(Qe+u),M=y(Le+A),A=y(ae+We),k=y(M+B),T=(n[o+988>>2]|0)==1,h[d>>2]=y(ss(Qe,l,0,T)),h[m>>2]=y(ss(Le,l,0,T)),u=y(E_(y(We*l),y(1))),mn(u,y(0))|0?m=0:m=(mn(u,y(1))|0)^1,u=y(E_(y(B*l),y(1))),mn(u,y(0))|0?d=0:d=(mn(u,y(1))|0)^1,Qe=y(ss(A,l,T&m,T&(m^1))),h[G>>2]=y(Qe-y(ss(ae,l,0,T))),Qe=y(ss(k,l,T&d,T&(d^1))),h[_>>2]=y(Qe-y(ss(M,l,0,T))),m=(n[o+952>>2]|0)-(n[o+948>>2]|0)>>2,m|0)){d=0;do JA(Cs(o,d)|0,l,ae,M),d=d+1|0;while((d|0)!=(m|0))}}function Sy(o,l,u,A,d){switch(o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,u|0){case 5:case 0:{o=n$(n[489]|0,A,d)|0;break}default:o=lVe(A,d)|0}return o|0}function Yg(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;d=I,I=I+16|0,m=d,n[m>>2]=A,Qh(o,0,l,u,m),I=d}function Qh(o,l,u,A,d){if(o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,o=o|0?o:956,v$[n[o+8>>2]&1](o,l,u,A,d)|0,(u|0)==5)Nt();else return}function hc(o,l,u){o=o|0,l=l|0,u=u|0,s[o+l>>0]=u&1}function Dy(o,l){o=o|0,l=l|0;var u=0,A=0;n[o>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,u=l+4|0,A=(n[u>>2]|0)-(n[l>>2]|0)>>2,A|0&&(Th(o,A),kt(o,n[l>>2]|0,n[u>>2]|0,A))}function Th(o,l){o=o|0,l=l|0;var u=0;if((O(o)|0)>>>0>>0&&sn(o),l>>>0>1073741823)Nt();else{u=Jt(l<<2)|0,n[o+4>>2]=u,n[o>>2]=u,n[o+8>>2]=u+(l<<2);return}}function kt(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,A=o+4|0,o=u-l|0,(o|0)>0&&(Qr(n[A>>2]|0,l|0,o|0)|0,n[A>>2]=(n[A>>2]|0)+(o>>>2<<2))}function O(o){return o=o|0,1073741823}function J(o,l,u){return o=o|0,l=l|0,u=y(u),de(l)|0&&n[o+96>>2]|0?o=o+92|0:o=kn(o+60|0,n[1040+(l<<2)>>2]|0,992)|0,y(Ke(o,u))}function re(o,l,u){return o=o|0,l=l|0,u=y(u),de(l)|0&&n[o+104>>2]|0?o=o+100|0:o=kn(o+60|0,n[1e3+(l<<2)>>2]|0,992)|0,y(Ke(o,u))}function de(o){return o=o|0,(o|1|0)==3|0}function Ke(o,l){return o=o|0,l=y(l),(n[o+4>>2]|0)==3?l=y(0):l=y(Xr(o,l)),y(l)}function ft(o,l){return o=o|0,l=l|0,o=n[o>>2]|0,(o|0?o:(l|0)>1?l:1)|0}function dr(o,l){o=o|0,l=l|0;var u=0;e:do if((l|0)==2){switch(o|0){case 2:{o=3;break e}case 3:break;default:{u=4;break e}}o=2}else u=4;while(!1);return o|0}function Br(o,l){o=o|0,l=l|0;var u=Xe;return de(l)|0&&n[o+312>>2]|0&&(u=y(h[o+308>>2]),u>=y(0))||(u=y($n(y(h[(kn(o+276|0,n[1040+(l<<2)>>2]|0,992)|0)>>2]),y(0)))),y(u)}function _n(o,l){o=o|0,l=l|0;var u=Xe;return de(l)|0&&n[o+320>>2]|0&&(u=y(h[o+316>>2]),u>=y(0))||(u=y($n(y(h[(kn(o+276|0,n[1e3+(l<<2)>>2]|0,992)|0)>>2]),y(0)))),y(u)}function di(o,l,u){o=o|0,l=l|0,u=y(u);var A=Xe;return de(l)|0&&n[o+240>>2]|0&&(A=y(Xr(o+236|0,u)),A>=y(0))||(A=y($n(y(Xr(kn(o+204|0,n[1040+(l<<2)>>2]|0,992)|0,u)),y(0)))),y(A)}function ws(o,l,u){o=o|0,l=l|0,u=y(u);var A=Xe;return de(l)|0&&n[o+248>>2]|0&&(A=y(Xr(o+244|0,u)),A>=y(0))||(A=y($n(y(Xr(kn(o+204|0,n[1e3+(l<<2)>>2]|0,992)|0,u)),y(0)))),y(A)}function zA(o,l,u,A,d,m,B){o=o|0,l=y(l),u=y(u),A=A|0,d=d|0,m=y(m),B=y(B);var k=Xe,T=Xe,_=Xe,M=Xe,G=Xe,ae=Xe,We=0,Le=0,Qe=0;Qe=I,I=I+16|0,We=Qe,Le=o+964|0,wi(o,(n[Le>>2]|0)!=0,3519),k=y(Ka(o,2,l)),T=y(Ka(o,0,l)),_=y(yn(o,2,l)),M=y(yn(o,0,l)),Mt(l)|0?G=l:G=y($n(y(0),y(y(l-_)-k))),Mt(u)|0?ae=u:ae=y($n(y(0),y(y(u-M)-T))),(A|0)==1&(d|0)==1?(h[o+908>>2]=y(Gn(o,2,y(l-_),m,m)),l=y(Gn(o,0,y(u-M),B,m))):(S$[n[Le>>2]&1](We,o,G,A,ae,d),G=y(k+y(h[We>>2])),ae=y(l-_),h[o+908>>2]=y(Gn(o,2,(A|2|0)==2?G:ae,m,m)),ae=y(T+y(h[We+4>>2])),l=y(u-M),l=y(Gn(o,0,(d|2|0)==2?ae:l,B,m))),h[o+912>>2]=l,I=Qe}function wP(o,l,u,A,d,m,B){o=o|0,l=y(l),u=y(u),A=A|0,d=d|0,m=y(m),B=y(B);var k=Xe,T=Xe,_=Xe,M=Xe;_=y(Ka(o,2,m)),k=y(Ka(o,0,m)),M=y(yn(o,2,m)),T=y(yn(o,0,m)),l=y(l-M),h[o+908>>2]=y(Gn(o,2,(A|2|0)==2?_:l,m,m)),u=y(u-T),h[o+912>>2]=y(Gn(o,0,(d|2|0)==2?k:u,B,m))}function i2(o,l,u,A,d,m,B){o=o|0,l=y(l),u=y(u),A=A|0,d=d|0,m=y(m),B=y(B);var k=0,T=Xe,_=Xe;return k=(A|0)==2,!(l<=y(0)&k)&&!(u<=y(0)&(d|0)==2)&&!((A|0)==1&(d|0)==1)?o=0:(T=y(yn(o,0,m)),_=y(yn(o,2,m)),k=l>2]=y(Gn(o,2,k?y(0):l,m,m)),l=y(u-T),k=u>2]=y(Gn(o,0,k?y(0):l,B,m)),o=1),o|0}function by(o,l){return o=o|0,l=l|0,Jg(o)|0?o=dr(2,l)|0:o=0,o|0}function Rh(o,l,u){return o=o|0,l=l|0,u=y(u),u=y(di(o,l,u)),y(u+y(Br(o,l)))}function s2(o,l,u){return o=o|0,l=l|0,u=y(u),u=y(ws(o,l,u)),y(u+y(_n(o,l)))}function Ka(o,l,u){o=o|0,l=l|0,u=y(u);var A=Xe;return A=y(Rh(o,l,u)),y(A+y(s2(o,l,u)))}function o2(o){return o=o|0,n[o+24>>2]|0?o=0:y(ZA(o))!=y(0)?o=1:o=y(Fh(o))!=y(0),o|0}function ZA(o){o=o|0;var l=Xe;if(n[o+944>>2]|0){if(l=y(h[o+44>>2]),Mt(l)|0)return l=y(h[o+40>>2]),o=l>y(0)&((Mt(l)|0)^1),y(o?l:y(0))}else l=y(0);return y(l)}function Fh(o){o=o|0;var l=Xe,u=0,A=Xe;do if(n[o+944>>2]|0){if(l=y(h[o+48>>2]),Mt(l)|0){if(u=s[(n[o+976>>2]|0)+2>>0]|0,!(u<<24>>24)&&(A=y(h[o+40>>2]),A>24?y(1):y(0)}}else l=y(0);while(!1);return y(l)}function Py(o){o=o|0;var l=0,u=0;if(eE(o+400|0,0,540)|0,s[o+985>>0]=1,ee(o),u=Li(o)|0,u|0){l=o+948|0,o=0;do Py(n[(n[l>>2]|0)+(o<<2)>>2]|0),o=o+1|0;while((o|0)!=(u|0))}}function BP(o,l,u,A,d,m,B,k,T,_){o=o|0,l=l|0,u=y(u),A=A|0,d=y(d),m=y(m),B=y(B),k=k|0,T=T|0,_=_|0;var M=0,G=Xe,ae=0,We=0,Le=Xe,Qe=Xe,tt=0,Ze=Xe,ct=0,He=Xe,Ge=0,Lt=0,qr=0,fr=0,$t=0,Tr=0,Hr=0,cr=0,Hn=0,Fo=0;Hn=I,I=I+16|0,qr=Hn+12|0,fr=Hn+8|0,$t=Hn+4|0,Tr=Hn,cr=dr(n[o+4>>2]|0,T)|0,Ge=de(cr)|0,G=y(Xr(tM(l)|0,Ge?m:B)),Lt=so(l,2,m)|0,Hr=so(l,0,B)|0;do if(!(Mt(G)|0)&&!(Mt(Ge?u:d)|0)){if(M=l+504|0,!(Mt(y(h[M>>2]))|0)&&(!(l2(n[l+976>>2]|0,0)|0)||(n[l+500>>2]|0)==(n[2278]|0)))break;h[M>>2]=y($n(G,y(Ka(l,cr,m))))}else ae=7;while(!1);do if((ae|0)==7){if(ct=Ge^1,!(ct|Lt^1)){B=y(Xr(n[l+992>>2]|0,m)),h[l+504>>2]=y($n(B,y(Ka(l,2,m))));break}if(!(Ge|Hr^1)){B=y(Xr(n[l+996>>2]|0,B)),h[l+504>>2]=y($n(B,y(Ka(l,0,m))));break}h[qr>>2]=y(ce),h[fr>>2]=y(ce),n[$t>>2]=0,n[Tr>>2]=0,Ze=y(yn(l,2,m)),He=y(yn(l,0,m)),Lt?(Le=y(Ze+y(Xr(n[l+992>>2]|0,m))),h[qr>>2]=Le,n[$t>>2]=1,We=1):(We=0,Le=y(ce)),Hr?(G=y(He+y(Xr(n[l+996>>2]|0,B))),h[fr>>2]=G,n[Tr>>2]=1,M=1):(M=0,G=y(ce)),ae=n[o+32>>2]|0,Ge&(ae|0)==2?ae=2:Mt(Le)|0&&!(Mt(u)|0)&&(h[qr>>2]=u,n[$t>>2]=2,We=2,Le=u),!((ae|0)==2&ct)&&Mt(G)|0&&!(Mt(d)|0)&&(h[fr>>2]=d,n[Tr>>2]=2,M=2,G=d),Qe=y(h[l+396>>2]),tt=Mt(Qe)|0;do if(tt)ae=We;else{if((We|0)==1&ct){h[fr>>2]=y(y(Le-Ze)/Qe),n[Tr>>2]=1,M=1,ae=1;break}Ge&(M|0)==1?(h[qr>>2]=y(Qe*y(G-He)),n[$t>>2]=1,M=1,ae=1):ae=We}while(!1);Fo=Mt(u)|0,We=(os(o,l)|0)!=4,!(Ge|Lt|((A|0)!=1|Fo)|(We|(ae|0)==1))&&(h[qr>>2]=u,n[$t>>2]=1,!tt)&&(h[fr>>2]=y(y(u-Ze)/Qe),n[Tr>>2]=1,M=1),!(Hr|ct|((k|0)!=1|(Mt(d)|0))|(We|(M|0)==1))&&(h[fr>>2]=d,n[Tr>>2]=1,!tt)&&(h[qr>>2]=y(Qe*y(d-He)),n[$t>>2]=1),Bu(l,2,m,m,$t,qr),Bu(l,0,B,m,Tr,fr),u=y(h[qr>>2]),d=y(h[fr>>2]),kl(l,u,d,T,n[$t>>2]|0,n[Tr>>2]|0,m,B,0,3565,_)|0,B=y(h[l+908+(n[976+(cr<<2)>>2]<<2)>>2]),h[l+504>>2]=y($n(B,y(Ka(l,cr,m))))}while(!1);n[l+500>>2]=n[2278],I=Hn}function Gn(o,l,u,A,d){return o=o|0,l=l|0,u=y(u),A=y(A),d=y(d),A=y(Kg(o,l,u,A)),y($n(A,y(Ka(o,l,d))))}function os(o,l){return o=o|0,l=l|0,l=l+20|0,l=n[(n[l>>2]|0?l:o+16|0)>>2]|0,(l|0)==5&&Jg(n[o+4>>2]|0)|0&&(l=1),l|0}function Ql(o,l){return o=o|0,l=l|0,de(l)|0&&n[o+96>>2]|0?l=4:l=n[1040+(l<<2)>>2]|0,o+60+(l<<3)|0}function Tl(o,l){return o=o|0,l=l|0,de(l)|0&&n[o+104>>2]|0?l=5:l=n[1e3+(l<<2)>>2]|0,o+60+(l<<3)|0}function Bu(o,l,u,A,d,m){switch(o=o|0,l=l|0,u=y(u),A=y(A),d=d|0,m=m|0,u=y(Xr(o+380+(n[976+(l<<2)>>2]<<3)|0,u)),u=y(u+y(yn(o,l,A))),n[d>>2]|0){case 2:case 1:{d=Mt(u)|0,A=y(h[m>>2]),h[m>>2]=d|A>2]=2,h[m>>2]=u);break}default:}}function ga(o,l){return o=o|0,l=l|0,o=o+132|0,de(l)|0&&n[(kn(o,4,948)|0)+4>>2]|0?o=1:o=(n[(kn(o,n[1040+(l<<2)>>2]|0,948)|0)+4>>2]|0)!=0,o|0}function XA(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0;return o=o+132|0,de(l)|0&&(A=kn(o,4,948)|0,(n[A+4>>2]|0)!=0)?d=4:(A=kn(o,n[1040+(l<<2)>>2]|0,948)|0,n[A+4>>2]|0?d=4:u=y(0)),(d|0)==4&&(u=y(Xr(A,u))),y(u)}function $A(o,l,u){o=o|0,l=l|0,u=y(u);var A=Xe;return A=y(h[o+908+(n[976+(l<<2)>>2]<<2)>>2]),A=y(A+y(J(o,l,u))),y(A+y(re(o,l,u)))}function XL(o){o=o|0;var l=0,u=0,A=0;e:do if(Jg(n[o+4>>2]|0)|0)l=0;else if((n[o+16>>2]|0)!=5)if(u=Li(o)|0,!u)l=0;else for(l=0;;){if(A=Cs(o,l)|0,!(n[A+24>>2]|0)&&(n[A+20>>2]|0)==5){l=1;break e}if(l=l+1|0,l>>>0>=u>>>0){l=0;break}}else l=1;while(!1);return l|0}function $L(o,l){o=o|0,l=l|0;var u=Xe;return u=y(h[o+908+(n[976+(l<<2)>>2]<<2)>>2]),u>=y(0)&((Mt(u)|0)^1)|0}function Vg(o){o=o|0;var l=Xe,u=0,A=0,d=0,m=0,B=0,k=0,T=Xe;if(u=n[o+968>>2]|0,u)T=y(h[o+908>>2]),l=y(h[o+912>>2]),l=y(I$[u&0](o,T,l)),wi(o,(Mt(l)|0)^1,3573);else{m=Li(o)|0;do if(m|0){for(u=0,d=0;;){if(A=Cs(o,d)|0,n[A+940>>2]|0){B=8;break}if((n[A+24>>2]|0)!=1)if(k=(os(o,A)|0)==5,k){u=A;break}else u=u|0?u:A;if(d=d+1|0,d>>>0>=m>>>0){B=8;break}}if((B|0)==8&&!u)break;return l=y(Vg(u)),y(l+y(h[u+404>>2]))}while(!1);l=y(h[o+912>>2])}return y(l)}function Kg(o,l,u,A){o=o|0,l=l|0,u=y(u),A=y(A);var d=Xe,m=0;return Jg(l)|0?(l=1,m=3):de(l)|0?(l=0,m=3):(A=y(ce),d=y(ce)),(m|0)==3&&(d=y(Xr(o+364+(l<<3)|0,A)),A=y(Xr(o+380+(l<<3)|0,A))),m=A=y(0)&((Mt(A)|0)^1)),u=m?A:u,m=d>=y(0)&((Mt(d)|0)^1)&u>2]|0,m)|0,Le=by(tt,m)|0,Qe=de(tt)|0,G=y(yn(l,2,u)),ae=y(yn(l,0,u)),so(l,2,u)|0?k=y(G+y(Xr(n[l+992>>2]|0,u))):ga(l,2)|0&&xy(l,2)|0?(k=y(h[o+908>>2]),T=y(Br(o,2)),T=y(k-y(T+y(_n(o,2)))),k=y(XA(l,2,u)),k=y(Gn(l,2,y(T-y(k+y(Nh(l,2,u)))),u,u))):k=y(ce),so(l,0,d)|0?T=y(ae+y(Xr(n[l+996>>2]|0,d))):ga(l,0)|0&&xy(l,0)|0?(T=y(h[o+912>>2]),ct=y(Br(o,0)),ct=y(T-y(ct+y(_n(o,0)))),T=y(XA(l,0,d)),T=y(Gn(l,0,y(ct-y(T+y(Nh(l,0,d)))),d,u))):T=y(ce),_=Mt(k)|0,M=Mt(T)|0;do if(_^M&&(We=y(h[l+396>>2]),!(Mt(We)|0)))if(_){k=y(G+y(y(T-ae)*We));break}else{ct=y(ae+y(y(k-G)/We)),T=M?ct:T;break}while(!1);M=Mt(k)|0,_=Mt(T)|0,M|_&&(He=(M^1)&1,A=u>y(0)&((A|0)!=0&M),k=Qe?k:A?u:k,kl(l,k,T,m,Qe?He:A?2:He,M&(_^1)&1,k,T,0,3623,B)|0,k=y(h[l+908>>2]),k=y(k+y(yn(l,2,u))),T=y(h[l+912>>2]),T=y(T+y(yn(l,0,u)))),kl(l,k,T,m,1,1,k,T,1,3635,B)|0,xy(l,tt)|0&&!(ga(l,tt)|0)?(He=n[976+(tt<<2)>>2]|0,ct=y(h[o+908+(He<<2)>>2]),ct=y(ct-y(h[l+908+(He<<2)>>2])),ct=y(ct-y(_n(o,tt))),ct=y(ct-y(re(l,tt,u))),ct=y(ct-y(Nh(l,tt,Qe?u:d))),h[l+400+(n[1040+(tt<<2)>>2]<<2)>>2]=ct):Ze=21;do if((Ze|0)==21){if(!(ga(l,tt)|0)&&(n[o+8>>2]|0)==1){He=n[976+(tt<<2)>>2]|0,ct=y(h[o+908+(He<<2)>>2]),ct=y(y(ct-y(h[l+908+(He<<2)>>2]))*y(.5)),h[l+400+(n[1040+(tt<<2)>>2]<<2)>>2]=ct;break}!(ga(l,tt)|0)&&(n[o+8>>2]|0)==2&&(He=n[976+(tt<<2)>>2]|0,ct=y(h[o+908+(He<<2)>>2]),ct=y(ct-y(h[l+908+(He<<2)>>2])),h[l+400+(n[1040+(tt<<2)>>2]<<2)>>2]=ct)}while(!1);xy(l,Le)|0&&!(ga(l,Le)|0)?(He=n[976+(Le<<2)>>2]|0,ct=y(h[o+908+(He<<2)>>2]),ct=y(ct-y(h[l+908+(He<<2)>>2])),ct=y(ct-y(_n(o,Le))),ct=y(ct-y(re(l,Le,u))),ct=y(ct-y(Nh(l,Le,Qe?d:u))),h[l+400+(n[1040+(Le<<2)>>2]<<2)>>2]=ct):Ze=30;do if((Ze|0)==30&&!(ga(l,Le)|0)){if((os(o,l)|0)==2){He=n[976+(Le<<2)>>2]|0,ct=y(h[o+908+(He<<2)>>2]),ct=y(y(ct-y(h[l+908+(He<<2)>>2]))*y(.5)),h[l+400+(n[1040+(Le<<2)>>2]<<2)>>2]=ct;break}He=(os(o,l)|0)==3,He^(n[o+28>>2]|0)==2&&(He=n[976+(Le<<2)>>2]|0,ct=y(h[o+908+(He<<2)>>2]),ct=y(ct-y(h[l+908+(He<<2)>>2])),h[l+400+(n[1040+(Le<<2)>>2]<<2)>>2]=ct)}while(!1)}function a2(o,l,u){o=o|0,l=l|0,u=u|0;var A=Xe,d=0;d=n[976+(u<<2)>>2]|0,A=y(h[l+908+(d<<2)>>2]),A=y(y(h[o+908+(d<<2)>>2])-A),A=y(A-y(h[l+400+(n[1040+(u<<2)>>2]<<2)>>2])),h[l+400+(n[1e3+(u<<2)>>2]<<2)>>2]=A}function Jg(o){return o=o|0,(o|1|0)==1|0}function tM(o){o=o|0;var l=Xe;switch(n[o+56>>2]|0){case 0:case 3:{l=y(h[o+40>>2]),l>y(0)&((Mt(l)|0)^1)?o=s[(n[o+976>>2]|0)+2>>0]|0?1056:992:o=1056;break}default:o=o+52|0}return o|0}function l2(o,l){return o=o|0,l=l|0,(s[o+l>>0]|0)!=0|0}function xy(o,l){return o=o|0,l=l|0,o=o+132|0,de(l)|0&&n[(kn(o,5,948)|0)+4>>2]|0?o=1:o=(n[(kn(o,n[1e3+(l<<2)>>2]|0,948)|0)+4>>2]|0)!=0,o|0}function Nh(o,l,u){o=o|0,l=l|0,u=y(u);var A=0,d=0;return o=o+132|0,de(l)|0&&(A=kn(o,5,948)|0,(n[A+4>>2]|0)!=0)?d=4:(A=kn(o,n[1e3+(l<<2)>>2]|0,948)|0,n[A+4>>2]|0?d=4:u=y(0)),(d|0)==4&&(u=y(Xr(A,u))),y(u)}function vP(o,l,u){return o=o|0,l=l|0,u=y(u),ga(o,l)|0?u=y(XA(o,l,u)):u=y(-y(Nh(o,l,u))),y(u)}function SP(o){return o=y(o),h[S>>2]=o,n[S>>2]|0|0}function ky(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>1073741823)Nt();else{d=Jt(l<<2)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<2)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<2)}function DP(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function Qy(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-4-l|0)>>>2)<<2)),o=n[o>>2]|0,o|0&&yt(o)}function bP(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;if(B=o+4|0,k=n[B>>2]|0,d=k-A|0,m=d>>2,o=l+(m<<2)|0,o>>>0>>0){A=k;do n[A>>2]=n[o>>2],o=o+4|0,A=(n[B>>2]|0)+4|0,n[B>>2]=A;while(o>>>0>>0)}m|0&&F2(k+(0-m<<2)|0,l|0,d|0)|0}function PP(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0;return k=l+4|0,T=n[k>>2]|0,d=n[o>>2]|0,B=u,m=B-d|0,A=T+(0-(m>>2)<<2)|0,n[k>>2]=A,(m|0)>0&&Qr(A|0,d|0,m|0)|0,d=o+4|0,m=l+8|0,A=(n[d>>2]|0)-B|0,(A|0)>0&&(Qr(n[m>>2]|0,u|0,A|0)|0,n[m>>2]=(n[m>>2]|0)+(A>>>2<<2)),B=n[o>>2]|0,n[o>>2]=n[k>>2],n[k>>2]=B,B=n[d>>2]|0,n[d>>2]=n[m>>2],n[m>>2]=B,B=o+8|0,u=l+12|0,o=n[B>>2]|0,n[B>>2]=n[u>>2],n[u>>2]=o,n[l>>2]=n[k>>2],T|0}function c2(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;if(B=n[l>>2]|0,m=n[u>>2]|0,(B|0)!=(m|0)){d=o+8|0,u=((m+-4-B|0)>>>2)+1|0,o=B,A=n[d>>2]|0;do n[A>>2]=n[o>>2],A=(n[d>>2]|0)+4|0,n[d>>2]=A,o=o+4|0;while((o|0)!=(m|0));n[l>>2]=B+(u<<2)}}function u2(){fa()}function xP(){var o=0;return o=Jt(4)|0,f2(o),o|0}function f2(o){o=o|0,n[o>>2]=pc()|0}function kP(o){o=o|0,o|0&&(zg(o),yt(o))}function zg(o){o=o|0,st(n[o>>2]|0)}function rM(o,l,u){o=o|0,l=l|0,u=u|0,hc(n[o>>2]|0,l,u)}function Ty(o,l){o=o|0,l=y(l),xh(n[o>>2]|0,l)}function Ry(o,l){return o=o|0,l=l|0,l2(n[o>>2]|0,l)|0}function Fy(){var o=0;return o=Jt(8)|0,Zg(o,0),o|0}function Zg(o,l){o=o|0,l=l|0,l?l=Aa(n[l>>2]|0)|0:l=ns()|0,n[o>>2]=l,n[o+4>>2]=0,Tn(l,o)}function Ny(o){o=o|0;var l=0;return l=Jt(8)|0,Zg(l,o),l|0}function Xg(o){o=o|0,o|0&&(Oy(o),yt(o))}function Oy(o){o=o|0;var l=0;fc(n[o>>2]|0),l=o+4|0,o=n[l>>2]|0,n[l>>2]=0,o|0&&(Df(o),yt(o))}function Df(o){o=o|0,bf(o)}function bf(o){o=o|0,o=n[o>>2]|0,o|0&&Oa(o|0)}function A2(o){return o=o|0,Ga(o)|0}function p2(o){o=o|0;var l=0,u=0;u=o+4|0,l=n[u>>2]|0,n[u>>2]=0,l|0&&(Df(l),yt(l)),Ac(n[o>>2]|0)}function Ly(o,l){o=o|0,l=l|0,fn(n[o>>2]|0,n[l>>2]|0)}function nM(o,l){o=o|0,l=l|0,Sh(n[o>>2]|0,l)}function iM(o,l,u){o=o|0,l=l|0,u=+u,Cy(n[o>>2]|0,l,y(u))}function My(o,l,u){o=o|0,l=l|0,u=+u,wy(n[o>>2]|0,l,y(u))}function h2(o,l){o=o|0,l=l|0,wh(n[o>>2]|0,l)}function g2(o,l){o=o|0,l=l|0,bo(n[o>>2]|0,l)}function xr(o,l){o=o|0,l=l|0,vh(n[o>>2]|0,l)}function oo(o,l){o=o|0,l=l|0,my(n[o>>2]|0,l)}function Zi(o,l){o=o|0,l=l|0,Og(n[o>>2]|0,l)}function Os(o,l){o=o|0,l=l|0,Do(n[o>>2]|0,l)}function ep(o,l,u){o=o|0,l=l|0,u=+u,qA(n[o>>2]|0,l,y(u))}function d2(o,l,u){o=o|0,l=l|0,u=+u,Y(n[o>>2]|0,l,y(u))}function Bs(o,l){o=o|0,l=l|0,GA(n[o>>2]|0,l)}function _y(o,l){o=o|0,l=l|0,Ey(n[o>>2]|0,l)}function Oh(o,l){o=o|0,l=l|0,Po(n[o>>2]|0,l)}function $g(o,l){o=o|0,l=+l,Dh(n[o>>2]|0,y(l))}function Lh(o,l){o=o|0,l=+l,Pl(n[o>>2]|0,y(l))}function m2(o,l){o=o|0,l=+l,Iy(n[o>>2]|0,y(l))}function y2(o,l){o=o|0,l=+l,Mg(n[o>>2]|0,y(l))}function E2(o,l){o=o|0,l=+l,bl(n[o>>2]|0,y(l))}function I2(o,l){o=o|0,l=+l,_g(n[o>>2]|0,y(l))}function Pf(o,l){o=o|0,l=+l,n2(n[o>>2]|0,y(l))}function sr(o){o=o|0,bh(n[o>>2]|0)}function Uy(o,l){o=o|0,l=+l,zi(n[o>>2]|0,y(l))}function C2(o,l){o=o|0,l=+l,Ef(n[o>>2]|0,y(l))}function gc(o){o=o|0,Wa(n[o>>2]|0)}function xf(o,l){o=o|0,l=+l,yu(n[o>>2]|0,y(l))}function ed(o,l){o=o|0,l=+l,If(n[o>>2]|0,y(l))}function td(o,l){o=o|0,l=+l,gi(n[o>>2]|0,y(l))}function w2(o,l){o=o|0,l=+l,WA(n[o>>2]|0,y(l))}function B2(o,l){o=o|0,l=+l,pa(n[o>>2]|0,y(l))}function vu(o,l){o=o|0,l=+l,Va(n[o>>2]|0,y(l))}function rd(o,l){o=o|0,l=+l,Ph(n[o>>2]|0,y(l))}function v2(o,l){o=o|0,l=+l,jg(n[o>>2]|0,y(l))}function Hy(o,l){o=o|0,l=+l,YA(n[o>>2]|0,y(l))}function Su(o,l,u){o=o|0,l=l|0,u=+u,mu(n[o>>2]|0,l,y(u))}function jy(o,l,u){o=o|0,l=l|0,u=+u,xo(n[o>>2]|0,l,y(u))}function nd(o,l,u){o=o|0,l=l|0,u=+u,yf(n[o>>2]|0,l,y(u))}function id(o){return o=o|0,Ng(n[o>>2]|0)|0}function To(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;A=I,I=I+16|0,d=A,jA(d,n[l>>2]|0,u),vs(o,d),I=A}function vs(o,l){o=o|0,l=l|0,Rl(o,n[l+4>>2]|0,+y(h[l>>2]))}function Rl(o,l,u){o=o|0,l=l|0,u=+u,n[o>>2]=l,E[o+8>>3]=u}function qy(o){return o=o|0,r2(n[o>>2]|0)|0}function da(o){return o=o|0,Bh(n[o>>2]|0)|0}function QP(o){return o=o|0,du(n[o>>2]|0)|0}function Mh(o){return o=o|0,t2(n[o>>2]|0)|0}function S2(o){return o=o|0,Lg(n[o>>2]|0)|0}function sM(o){return o=o|0,yy(n[o>>2]|0)|0}function TP(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;A=I,I=I+16|0,d=A,xt(d,n[l>>2]|0,u),vs(o,d),I=A}function RP(o){return o=o|0,mf(n[o>>2]|0)|0}function Gy(o){return o=o|0,Dl(n[o>>2]|0)|0}function D2(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,HA(A,n[l>>2]|0),vs(o,A),I=u}function _h(o){return o=o|0,+ +y(ai(n[o>>2]|0))}function FP(o){return o=o|0,+ +y(qi(n[o>>2]|0))}function NP(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,ur(A,n[l>>2]|0),vs(o,A),I=u}function sd(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,Ug(A,n[l>>2]|0),vs(o,A),I=u}function oM(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,wt(A,n[l>>2]|0),vs(o,A),I=u}function aM(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,Ya(A,n[l>>2]|0),vs(o,A),I=u}function OP(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,Hg(A,n[l>>2]|0),vs(o,A),I=u}function LP(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,vy(A,n[l>>2]|0),vs(o,A),I=u}function tp(o){return o=o|0,+ +y(qg(n[o>>2]|0))}function lM(o,l){return o=o|0,l=l|0,+ +y(By(n[o>>2]|0,l))}function cM(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;A=I,I=I+16|0,d=A,dt(d,n[l>>2]|0,u),vs(o,d),I=A}function Du(o,l,u){o=o|0,l=l|0,u=u|0,lr(n[o>>2]|0,n[l>>2]|0,u)}function uM(o,l){o=o|0,l=l|0,df(n[o>>2]|0,n[l>>2]|0)}function MP(o){return o=o|0,Li(n[o>>2]|0)|0}function fM(o){return o=o|0,o=mt(n[o>>2]|0)|0,o?o=A2(o)|0:o=0,o|0}function _P(o,l){return o=o|0,l=l|0,o=Cs(n[o>>2]|0,l)|0,o?o=A2(o)|0:o=0,o|0}function kf(o,l){o=o|0,l=l|0;var u=0,A=0;A=Jt(4)|0,UP(A,l),u=o+4|0,l=n[u>>2]|0,n[u>>2]=A,l|0&&(Df(l),yt(l)),St(n[o>>2]|0,1)}function UP(o,l){o=o|0,l=l|0,gM(o,l)}function AM(o,l,u,A,d,m){o=o|0,l=l|0,u=y(u),A=A|0,d=y(d),m=m|0;var B=0,k=0;B=I,I=I+16|0,k=B,HP(k,Ga(l)|0,+u,A,+d,m),h[o>>2]=y(+E[k>>3]),h[o+4>>2]=y(+E[k+8>>3]),I=B}function HP(o,l,u,A,d,m){o=o|0,l=l|0,u=+u,A=A|0,d=+d,m=m|0;var B=0,k=0,T=0,_=0,M=0;B=I,I=I+32|0,M=B+8|0,_=B+20|0,T=B,k=B+16|0,E[M>>3]=u,n[_>>2]=A,E[T>>3]=d,n[k>>2]=m,Wy(o,n[l+4>>2]|0,M,_,T,k),I=B}function Wy(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0;var B=0,k=0;B=I,I=I+16|0,k=B,Nl(k),l=Ls(l)|0,jP(o,l,+E[u>>3],n[A>>2]|0,+E[d>>3],n[m>>2]|0),Ol(k),I=B}function Ls(o){return o=o|0,n[o>>2]|0}function jP(o,l,u,A,d,m){o=o|0,l=l|0,u=+u,A=A|0,d=+d,m=m|0;var B=0;B=ma(b2()|0)|0,u=+Ja(u),A=Yy(A)|0,d=+Ja(d),pM(o,Jn(0,B|0,l|0,+u,A|0,+d,Yy(m)|0)|0)}function b2(){var o=0;return s[7608]|0||(x2(9120),o=7608,n[o>>2]=1,n[o+4>>2]=0),9120}function ma(o){return o=o|0,n[o+8>>2]|0}function Ja(o){return o=+o,+ +Qf(o)}function Yy(o){return o=o|0,od(o)|0}function pM(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;d=I,I=I+32|0,u=d,A=l,A&1?(za(u,0),Me(A|0,u|0)|0,P2(o,u),hM(u)):(n[o>>2]=n[l>>2],n[o+4>>2]=n[l+4>>2],n[o+8>>2]=n[l+8>>2],n[o+12>>2]=n[l+12>>2]),I=d}function za(o,l){o=o|0,l=l|0,bu(o,l),n[o+8>>2]=0,s[o+24>>0]=0}function P2(o,l){o=o|0,l=l|0,l=l+8|0,n[o>>2]=n[l>>2],n[o+4>>2]=n[l+4>>2],n[o+8>>2]=n[l+8>>2],n[o+12>>2]=n[l+12>>2]}function hM(o){o=o|0,s[o+24>>0]=0}function bu(o,l){o=o|0,l=l|0,n[o>>2]=l}function od(o){return o=o|0,o|0}function Qf(o){return o=+o,+o}function x2(o){o=o|0,Ro(o,k2()|0,4)}function k2(){return 1064}function Ro(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u,n[o+8>>2]=ji(l|0,u+1|0)|0}function gM(o,l){o=o|0,l=l|0,l=n[l>>2]|0,n[o>>2]=l,cu(l|0)}function qP(o){o=o|0;var l=0,u=0;u=o+4|0,l=n[u>>2]|0,n[u>>2]=0,l|0&&(Df(l),yt(l)),St(n[o>>2]|0,0)}function GP(o){o=o|0,Dt(n[o>>2]|0)}function Vy(o){return o=o|0,tr(n[o>>2]|0)|0}function dM(o,l,u,A){o=o|0,l=+l,u=+u,A=A|0,KA(n[o>>2]|0,y(l),y(u),A)}function mM(o){return o=o|0,+ +y(Eu(n[o>>2]|0))}function v(o){return o=o|0,+ +y(Cf(n[o>>2]|0))}function D(o){return o=o|0,+ +y(Iu(n[o>>2]|0))}function Q(o){return o=o|0,+ +y(Fs(n[o>>2]|0))}function H(o){return o=o|0,+ +y(Cu(n[o>>2]|0))}function V(o){return o=o|0,+ +y(qn(n[o>>2]|0))}function ne(o,l){o=o|0,l=l|0,E[o>>3]=+y(Eu(n[l>>2]|0)),E[o+8>>3]=+y(Cf(n[l>>2]|0)),E[o+16>>3]=+y(Iu(n[l>>2]|0)),E[o+24>>3]=+y(Fs(n[l>>2]|0)),E[o+32>>3]=+y(Cu(n[l>>2]|0)),E[o+40>>3]=+y(qn(n[l>>2]|0))}function Se(o,l){return o=o|0,l=l|0,+ +y(is(n[o>>2]|0,l))}function Ue(o,l){return o=o|0,l=l|0,+ +y(xi(n[o>>2]|0,l))}function At(o,l){return o=o|0,l=l|0,+ +y(VA(n[o>>2]|0,l))}function Gt(){return Qn()|0}function vr(){Lr(),Xt(),zn(),mi(),Za(),$e()}function Lr(){Kqe(11713,4938,1)}function Xt(){pqe(10448)}function zn(){K6e(10408)}function mi(){m6e(10324)}function Za(){SHe(10096)}function $e(){qe(9132)}function qe(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0,tt=0,Ze=0,ct=0,He=0,Ge=0,Lt=0,qr=0,fr=0,$t=0,Tr=0,Hr=0,cr=0,Hn=0,Fo=0,No=0,Oo=0,$a=0,Kh=0,Jh=0,dc=0,zh=0,Ff=0,Nf=0,Zh=0,Xh=0,$h=0,on=0,mc=0,e0=0,ku=0,t0=0,r0=0,Of=0,Lf=0,Qu=0,ao=0,Ml=0,ya=0,yc=0,lp=0,cp=0,Mf=0,up=0,fp=0,lo=0,_s=0,Ec=0,Wn=0,Ap=0,Lo=0,Tu=0,Mo=0,Ru=0,pp=0,hp=0,Fu=0,co=0,Ic=0,gp=0,dp=0,mp=0,Fr=0,ci=0,Us=0,_o=0,uo=0,Mr=0,Ar=0,Cc=0;l=I,I=I+672|0,u=l+656|0,Cc=l+648|0,Ar=l+640|0,Mr=l+632|0,uo=l+624|0,_o=l+616|0,Us=l+608|0,ci=l+600|0,Fr=l+592|0,mp=l+584|0,dp=l+576|0,gp=l+568|0,Ic=l+560|0,co=l+552|0,Fu=l+544|0,hp=l+536|0,pp=l+528|0,Ru=l+520|0,Mo=l+512|0,Tu=l+504|0,Lo=l+496|0,Ap=l+488|0,Wn=l+480|0,Ec=l+472|0,_s=l+464|0,lo=l+456|0,fp=l+448|0,up=l+440|0,Mf=l+432|0,cp=l+424|0,lp=l+416|0,yc=l+408|0,ya=l+400|0,Ml=l+392|0,ao=l+384|0,Qu=l+376|0,Lf=l+368|0,Of=l+360|0,r0=l+352|0,t0=l+344|0,ku=l+336|0,e0=l+328|0,mc=l+320|0,on=l+312|0,$h=l+304|0,Xh=l+296|0,Zh=l+288|0,Nf=l+280|0,Ff=l+272|0,zh=l+264|0,dc=l+256|0,Jh=l+248|0,Kh=l+240|0,$a=l+232|0,Oo=l+224|0,No=l+216|0,Fo=l+208|0,Hn=l+200|0,cr=l+192|0,Hr=l+184|0,Tr=l+176|0,$t=l+168|0,fr=l+160|0,qr=l+152|0,Lt=l+144|0,Ge=l+136|0,He=l+128|0,ct=l+120|0,Ze=l+112|0,tt=l+104|0,Qe=l+96|0,Le=l+88|0,We=l+80|0,ae=l+72|0,G=l+64|0,M=l+56|0,_=l+48|0,T=l+40|0,k=l+32|0,B=l+24|0,m=l+16|0,d=l+8|0,A=l,pt(o,3646),Zt(o,3651,2)|0,Sr(o,3665,2)|0,Xn(o,3682,18)|0,n[Cc>>2]=19,n[Cc+4>>2]=0,n[u>>2]=n[Cc>>2],n[u+4>>2]=n[Cc+4>>2],kr(o,3690,u)|0,n[Ar>>2]=1,n[Ar+4>>2]=0,n[u>>2]=n[Ar>>2],n[u+4>>2]=n[Ar+4>>2],Rn(o,3696,u)|0,n[Mr>>2]=2,n[Mr+4>>2]=0,n[u>>2]=n[Mr>>2],n[u+4>>2]=n[Mr+4>>2],Un(o,3706,u)|0,n[uo>>2]=1,n[uo+4>>2]=0,n[u>>2]=n[uo>>2],n[u+4>>2]=n[uo+4>>2],zr(o,3722,u)|0,n[_o>>2]=2,n[_o+4>>2]=0,n[u>>2]=n[_o>>2],n[u+4>>2]=n[_o+4>>2],zr(o,3734,u)|0,n[Us>>2]=3,n[Us+4>>2]=0,n[u>>2]=n[Us>>2],n[u+4>>2]=n[Us+4>>2],Un(o,3753,u)|0,n[ci>>2]=4,n[ci+4>>2]=0,n[u>>2]=n[ci>>2],n[u+4>>2]=n[ci+4>>2],Un(o,3769,u)|0,n[Fr>>2]=5,n[Fr+4>>2]=0,n[u>>2]=n[Fr>>2],n[u+4>>2]=n[Fr+4>>2],Un(o,3783,u)|0,n[mp>>2]=6,n[mp+4>>2]=0,n[u>>2]=n[mp>>2],n[u+4>>2]=n[mp+4>>2],Un(o,3796,u)|0,n[dp>>2]=7,n[dp+4>>2]=0,n[u>>2]=n[dp>>2],n[u+4>>2]=n[dp+4>>2],Un(o,3813,u)|0,n[gp>>2]=8,n[gp+4>>2]=0,n[u>>2]=n[gp>>2],n[u+4>>2]=n[gp+4>>2],Un(o,3825,u)|0,n[Ic>>2]=3,n[Ic+4>>2]=0,n[u>>2]=n[Ic>>2],n[u+4>>2]=n[Ic+4>>2],zr(o,3843,u)|0,n[co>>2]=4,n[co+4>>2]=0,n[u>>2]=n[co>>2],n[u+4>>2]=n[co+4>>2],zr(o,3853,u)|0,n[Fu>>2]=9,n[Fu+4>>2]=0,n[u>>2]=n[Fu>>2],n[u+4>>2]=n[Fu+4>>2],Un(o,3870,u)|0,n[hp>>2]=10,n[hp+4>>2]=0,n[u>>2]=n[hp>>2],n[u+4>>2]=n[hp+4>>2],Un(o,3884,u)|0,n[pp>>2]=11,n[pp+4>>2]=0,n[u>>2]=n[pp>>2],n[u+4>>2]=n[pp+4>>2],Un(o,3896,u)|0,n[Ru>>2]=1,n[Ru+4>>2]=0,n[u>>2]=n[Ru>>2],n[u+4>>2]=n[Ru+4>>2],li(o,3907,u)|0,n[Mo>>2]=2,n[Mo+4>>2]=0,n[u>>2]=n[Mo>>2],n[u+4>>2]=n[Mo+4>>2],li(o,3915,u)|0,n[Tu>>2]=3,n[Tu+4>>2]=0,n[u>>2]=n[Tu>>2],n[u+4>>2]=n[Tu+4>>2],li(o,3928,u)|0,n[Lo>>2]=4,n[Lo+4>>2]=0,n[u>>2]=n[Lo>>2],n[u+4>>2]=n[Lo+4>>2],li(o,3948,u)|0,n[Ap>>2]=5,n[Ap+4>>2]=0,n[u>>2]=n[Ap>>2],n[u+4>>2]=n[Ap+4>>2],li(o,3960,u)|0,n[Wn>>2]=6,n[Wn+4>>2]=0,n[u>>2]=n[Wn>>2],n[u+4>>2]=n[Wn+4>>2],li(o,3974,u)|0,n[Ec>>2]=7,n[Ec+4>>2]=0,n[u>>2]=n[Ec>>2],n[u+4>>2]=n[Ec+4>>2],li(o,3983,u)|0,n[_s>>2]=20,n[_s+4>>2]=0,n[u>>2]=n[_s>>2],n[u+4>>2]=n[_s+4>>2],kr(o,3999,u)|0,n[lo>>2]=8,n[lo+4>>2]=0,n[u>>2]=n[lo>>2],n[u+4>>2]=n[lo+4>>2],li(o,4012,u)|0,n[fp>>2]=9,n[fp+4>>2]=0,n[u>>2]=n[fp>>2],n[u+4>>2]=n[fp+4>>2],li(o,4022,u)|0,n[up>>2]=21,n[up+4>>2]=0,n[u>>2]=n[up>>2],n[u+4>>2]=n[up+4>>2],kr(o,4039,u)|0,n[Mf>>2]=10,n[Mf+4>>2]=0,n[u>>2]=n[Mf>>2],n[u+4>>2]=n[Mf+4>>2],li(o,4053,u)|0,n[cp>>2]=11,n[cp+4>>2]=0,n[u>>2]=n[cp>>2],n[u+4>>2]=n[cp+4>>2],li(o,4065,u)|0,n[lp>>2]=12,n[lp+4>>2]=0,n[u>>2]=n[lp>>2],n[u+4>>2]=n[lp+4>>2],li(o,4084,u)|0,n[yc>>2]=13,n[yc+4>>2]=0,n[u>>2]=n[yc>>2],n[u+4>>2]=n[yc+4>>2],li(o,4097,u)|0,n[ya>>2]=14,n[ya+4>>2]=0,n[u>>2]=n[ya>>2],n[u+4>>2]=n[ya+4>>2],li(o,4117,u)|0,n[Ml>>2]=15,n[Ml+4>>2]=0,n[u>>2]=n[Ml>>2],n[u+4>>2]=n[Ml+4>>2],li(o,4129,u)|0,n[ao>>2]=16,n[ao+4>>2]=0,n[u>>2]=n[ao>>2],n[u+4>>2]=n[ao+4>>2],li(o,4148,u)|0,n[Qu>>2]=17,n[Qu+4>>2]=0,n[u>>2]=n[Qu>>2],n[u+4>>2]=n[Qu+4>>2],li(o,4161,u)|0,n[Lf>>2]=18,n[Lf+4>>2]=0,n[u>>2]=n[Lf>>2],n[u+4>>2]=n[Lf+4>>2],li(o,4181,u)|0,n[Of>>2]=5,n[Of+4>>2]=0,n[u>>2]=n[Of>>2],n[u+4>>2]=n[Of+4>>2],zr(o,4196,u)|0,n[r0>>2]=6,n[r0+4>>2]=0,n[u>>2]=n[r0>>2],n[u+4>>2]=n[r0+4>>2],zr(o,4206,u)|0,n[t0>>2]=7,n[t0+4>>2]=0,n[u>>2]=n[t0>>2],n[u+4>>2]=n[t0+4>>2],zr(o,4217,u)|0,n[ku>>2]=3,n[ku+4>>2]=0,n[u>>2]=n[ku>>2],n[u+4>>2]=n[ku+4>>2],Pu(o,4235,u)|0,n[e0>>2]=1,n[e0+4>>2]=0,n[u>>2]=n[e0>>2],n[u+4>>2]=n[e0+4>>2],yM(o,4251,u)|0,n[mc>>2]=4,n[mc+4>>2]=0,n[u>>2]=n[mc>>2],n[u+4>>2]=n[mc+4>>2],Pu(o,4263,u)|0,n[on>>2]=5,n[on+4>>2]=0,n[u>>2]=n[on>>2],n[u+4>>2]=n[on+4>>2],Pu(o,4279,u)|0,n[$h>>2]=6,n[$h+4>>2]=0,n[u>>2]=n[$h>>2],n[u+4>>2]=n[$h+4>>2],Pu(o,4293,u)|0,n[Xh>>2]=7,n[Xh+4>>2]=0,n[u>>2]=n[Xh>>2],n[u+4>>2]=n[Xh+4>>2],Pu(o,4306,u)|0,n[Zh>>2]=8,n[Zh+4>>2]=0,n[u>>2]=n[Zh>>2],n[u+4>>2]=n[Zh+4>>2],Pu(o,4323,u)|0,n[Nf>>2]=9,n[Nf+4>>2]=0,n[u>>2]=n[Nf>>2],n[u+4>>2]=n[Nf+4>>2],Pu(o,4335,u)|0,n[Ff>>2]=2,n[Ff+4>>2]=0,n[u>>2]=n[Ff>>2],n[u+4>>2]=n[Ff+4>>2],yM(o,4353,u)|0,n[zh>>2]=12,n[zh+4>>2]=0,n[u>>2]=n[zh>>2],n[u+4>>2]=n[zh+4>>2],ad(o,4363,u)|0,n[dc>>2]=1,n[dc+4>>2]=0,n[u>>2]=n[dc>>2],n[u+4>>2]=n[dc+4>>2],rp(o,4376,u)|0,n[Jh>>2]=2,n[Jh+4>>2]=0,n[u>>2]=n[Jh>>2],n[u+4>>2]=n[Jh+4>>2],rp(o,4388,u)|0,n[Kh>>2]=13,n[Kh+4>>2]=0,n[u>>2]=n[Kh>>2],n[u+4>>2]=n[Kh+4>>2],ad(o,4402,u)|0,n[$a>>2]=14,n[$a+4>>2]=0,n[u>>2]=n[$a>>2],n[u+4>>2]=n[$a+4>>2],ad(o,4411,u)|0,n[Oo>>2]=15,n[Oo+4>>2]=0,n[u>>2]=n[Oo>>2],n[u+4>>2]=n[Oo+4>>2],ad(o,4421,u)|0,n[No>>2]=16,n[No+4>>2]=0,n[u>>2]=n[No>>2],n[u+4>>2]=n[No+4>>2],ad(o,4433,u)|0,n[Fo>>2]=17,n[Fo+4>>2]=0,n[u>>2]=n[Fo>>2],n[u+4>>2]=n[Fo+4>>2],ad(o,4446,u)|0,n[Hn>>2]=18,n[Hn+4>>2]=0,n[u>>2]=n[Hn>>2],n[u+4>>2]=n[Hn+4>>2],ad(o,4458,u)|0,n[cr>>2]=3,n[cr+4>>2]=0,n[u>>2]=n[cr>>2],n[u+4>>2]=n[cr+4>>2],rp(o,4471,u)|0,n[Hr>>2]=1,n[Hr+4>>2]=0,n[u>>2]=n[Hr>>2],n[u+4>>2]=n[Hr+4>>2],WP(o,4486,u)|0,n[Tr>>2]=10,n[Tr+4>>2]=0,n[u>>2]=n[Tr>>2],n[u+4>>2]=n[Tr+4>>2],Pu(o,4496,u)|0,n[$t>>2]=11,n[$t+4>>2]=0,n[u>>2]=n[$t>>2],n[u+4>>2]=n[$t+4>>2],Pu(o,4508,u)|0,n[fr>>2]=3,n[fr+4>>2]=0,n[u>>2]=n[fr>>2],n[u+4>>2]=n[fr+4>>2],yM(o,4519,u)|0,n[qr>>2]=4,n[qr+4>>2]=0,n[u>>2]=n[qr>>2],n[u+4>>2]=n[qr+4>>2],rLe(o,4530,u)|0,n[Lt>>2]=19,n[Lt+4>>2]=0,n[u>>2]=n[Lt>>2],n[u+4>>2]=n[Lt+4>>2],nLe(o,4542,u)|0,n[Ge>>2]=12,n[Ge+4>>2]=0,n[u>>2]=n[Ge>>2],n[u+4>>2]=n[Ge+4>>2],iLe(o,4554,u)|0,n[He>>2]=13,n[He+4>>2]=0,n[u>>2]=n[He>>2],n[u+4>>2]=n[He+4>>2],sLe(o,4568,u)|0,n[ct>>2]=2,n[ct+4>>2]=0,n[u>>2]=n[ct>>2],n[u+4>>2]=n[ct+4>>2],oLe(o,4578,u)|0,n[Ze>>2]=20,n[Ze+4>>2]=0,n[u>>2]=n[Ze>>2],n[u+4>>2]=n[Ze+4>>2],aLe(o,4587,u)|0,n[tt>>2]=22,n[tt+4>>2]=0,n[u>>2]=n[tt>>2],n[u+4>>2]=n[tt+4>>2],kr(o,4602,u)|0,n[Qe>>2]=23,n[Qe+4>>2]=0,n[u>>2]=n[Qe>>2],n[u+4>>2]=n[Qe+4>>2],kr(o,4619,u)|0,n[Le>>2]=14,n[Le+4>>2]=0,n[u>>2]=n[Le>>2],n[u+4>>2]=n[Le+4>>2],lLe(o,4629,u)|0,n[We>>2]=1,n[We+4>>2]=0,n[u>>2]=n[We>>2],n[u+4>>2]=n[We+4>>2],cLe(o,4637,u)|0,n[ae>>2]=4,n[ae+4>>2]=0,n[u>>2]=n[ae>>2],n[u+4>>2]=n[ae+4>>2],rp(o,4653,u)|0,n[G>>2]=5,n[G+4>>2]=0,n[u>>2]=n[G>>2],n[u+4>>2]=n[G+4>>2],rp(o,4669,u)|0,n[M>>2]=6,n[M+4>>2]=0,n[u>>2]=n[M>>2],n[u+4>>2]=n[M+4>>2],rp(o,4686,u)|0,n[_>>2]=7,n[_+4>>2]=0,n[u>>2]=n[_>>2],n[u+4>>2]=n[_+4>>2],rp(o,4701,u)|0,n[T>>2]=8,n[T+4>>2]=0,n[u>>2]=n[T>>2],n[u+4>>2]=n[T+4>>2],rp(o,4719,u)|0,n[k>>2]=9,n[k+4>>2]=0,n[u>>2]=n[k>>2],n[u+4>>2]=n[k+4>>2],rp(o,4736,u)|0,n[B>>2]=21,n[B+4>>2]=0,n[u>>2]=n[B>>2],n[u+4>>2]=n[B+4>>2],uLe(o,4754,u)|0,n[m>>2]=2,n[m+4>>2]=0,n[u>>2]=n[m>>2],n[u+4>>2]=n[m+4>>2],WP(o,4772,u)|0,n[d>>2]=3,n[d+4>>2]=0,n[u>>2]=n[d>>2],n[u+4>>2]=n[d+4>>2],WP(o,4790,u)|0,n[A>>2]=4,n[A+4>>2]=0,n[u>>2]=n[A>>2],n[u+4>>2]=n[A+4>>2],WP(o,4808,u)|0,I=l}function pt(o,l){o=o|0,l=l|0;var u=0;u=dHe()|0,n[o>>2]=u,mHe(u,l),Wh(n[o>>2]|0)}function Zt(o,l,u){return o=o|0,l=l|0,u=u|0,rHe(o,Bn(l)|0,u,0),o|0}function Sr(o,l,u){return o=o|0,l=l|0,u=u|0,U8e(o,Bn(l)|0,u,0),o|0}function Xn(o,l,u){return o=o|0,l=l|0,u=u|0,D8e(o,Bn(l)|0,u,0),o|0}function kr(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],u8e(o,l,d),I=A,o|0}function Rn(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],W3e(o,l,d),I=A,o|0}function Un(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],x3e(o,l,d),I=A,o|0}function zr(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],p3e(o,l,d),I=A,o|0}function li(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Z4e(o,l,d),I=A,o|0}function Pu(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],N4e(o,l,d),I=A,o|0}function yM(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],E4e(o,l,d),I=A,o|0}function ad(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],WUe(o,l,d),I=A,o|0}function rp(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],xUe(o,l,d),I=A,o|0}function WP(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],pUe(o,l,d),I=A,o|0}function rLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Z_e(o,l,d),I=A,o|0}function nLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],N_e(o,l,d),I=A,o|0}function iLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],I_e(o,l,d),I=A,o|0}function sLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],s_e(o,l,d),I=A,o|0}function oLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],jMe(o,l,d),I=A,o|0}function aLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],SMe(o,l,d),I=A,o|0}function lLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],cMe(o,l,d),I=A,o|0}function cLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],WLe(o,l,d),I=A,o|0}function uLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],fLe(o,l,d),I=A,o|0}function fLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ALe(o,u,d,1),I=A}function Bn(o){return o=o|0,o|0}function ALe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=EM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=pLe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,hLe(m,A)|0,A),I=d}function EM(){var o=0,l=0;if(s[7616]|0||(eZ(9136),gr(24,9136,U|0)|0,l=7616,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9136)|0)){o=9136,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));eZ(9136)}return 9136}function pLe(o){return o=o|0,0}function hLe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=EM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],$z(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(mLe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function vn(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0;var B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0;B=I,I=I+32|0,ae=B+24|0,G=B+20|0,T=B+16|0,M=B+12|0,_=B+8|0,k=B+4|0,We=B,n[G>>2]=l,n[T>>2]=u,n[M>>2]=A,n[_>>2]=d,n[k>>2]=m,m=o+28|0,n[We>>2]=n[m>>2],n[ae>>2]=n[We>>2],gLe(o+24|0,ae,G,M,_,T,k)|0,n[m>>2]=n[n[m>>2]>>2],I=B}function gLe(o,l,u,A,d,m,B){return o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,B=B|0,o=dLe(l)|0,l=Jt(24)|0,Xz(l+4|0,n[u>>2]|0,n[A>>2]|0,n[d>>2]|0,n[m>>2]|0,n[B>>2]|0),n[l>>2]=n[o>>2],n[o>>2]=l,l|0}function dLe(o){return o=o|0,n[o>>2]|0}function Xz(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,n[o>>2]=l,n[o+4>>2]=u,n[o+8>>2]=A,n[o+12>>2]=d,n[o+16>>2]=m}function yr(o,l){return o=o|0,l=l|0,l|o|0}function $z(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function mLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=yLe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,ELe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],$z(m,A,u),n[T>>2]=(n[T>>2]|0)+12,ILe(o,k),CLe(k),I=_;return}}function yLe(o){return o=o|0,357913941}function ELe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function ILe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function CLe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function eZ(o){o=o|0,vLe(o)}function wLe(o){o=o|0,BLe(o+24|0)}function Ur(o){return o=o|0,n[o>>2]|0}function BLe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function vLe(o){o=o|0;var l=0;l=en()|0,tn(o,2,3,l,SLe()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function en(){return 9228}function SLe(){return 1140}function DLe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;return u=I,I=I+16|0,A=u+8|0,d=u,m=bLe(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],l=PLe(l,A)|0,I=u,l|0}function tn(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,n[o>>2]=l,n[o+4>>2]=u,n[o+8>>2]=A,n[o+12>>2]=d,n[o+16>>2]=m}function bLe(o){return o=o|0,(n[(EM()|0)+24>>2]|0)+(o*12|0)|0}function PLe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;return d=I,I=I+48|0,A=d,u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),ap[u&31](A,o),A=xLe(A)|0,I=d,A|0}function xLe(o){o=o|0;var l=0,u=0,A=0,d=0;return d=I,I=I+32|0,l=d+12|0,u=d,A=IM(tZ()|0)|0,A?(CM(l,A),wM(u,l),kLe(o,u),o=BM(l)|0):o=QLe(o)|0,I=d,o|0}function tZ(){var o=0;return s[7632]|0||(HLe(9184),gr(25,9184,U|0)|0,o=7632,n[o>>2]=1,n[o+4>>2]=0),9184}function IM(o){return o=o|0,n[o+36>>2]|0}function CM(o,l){o=o|0,l=l|0,n[o>>2]=l,n[o+4>>2]=o,n[o+8>>2]=0}function wM(o,l){o=o|0,l=l|0,n[o>>2]=n[l>>2],n[o+4>>2]=n[l+4>>2],n[o+8>>2]=0}function kLe(o,l){o=o|0,l=l|0,NLe(l,o,o+8|0,o+16|0,o+24|0,o+32|0,o+40|0)|0}function BM(o){return o=o|0,n[(n[o+4>>2]|0)+8>>2]|0}function QLe(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0,T=0;T=I,I=I+16|0,u=T+4|0,A=T,d=Fl(8)|0,m=d,B=Jt(48)|0,k=B,l=k+48|0;do n[k>>2]=n[o>>2],k=k+4|0,o=o+4|0;while((k|0)<(l|0));return l=m+4|0,n[l>>2]=B,k=Jt(8)|0,B=n[l>>2]|0,n[A>>2]=0,n[u>>2]=n[A>>2],rZ(k,B,u),n[d>>2]=k,I=T,m|0}function rZ(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,u=Jt(16)|0,n[u+4>>2]=0,n[u+8>>2]=0,n[u>>2]=1092,n[u+12>>2]=l,n[o+4>>2]=u}function TLe(o){o=o|0,$y(o),yt(o)}function RLe(o){o=o|0,o=n[o+12>>2]|0,o|0&&yt(o)}function FLe(o){o=o|0,yt(o)}function NLe(o,l,u,A,d,m,B){return o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,B=B|0,m=OLe(n[o>>2]|0,l,u,A,d,m,B)|0,B=o+4|0,n[(n[B>>2]|0)+8>>2]=m,n[(n[B>>2]|0)+8>>2]|0}function OLe(o,l,u,A,d,m,B){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,B=B|0;var k=0,T=0;return k=I,I=I+16|0,T=k,Nl(T),o=Ls(o)|0,B=LLe(o,+E[l>>3],+E[u>>3],+E[A>>3],+E[d>>3],+E[m>>3],+E[B>>3])|0,Ol(T),I=k,B|0}function LLe(o,l,u,A,d,m,B){o=o|0,l=+l,u=+u,A=+A,d=+d,m=+m,B=+B;var k=0;return k=ma(MLe()|0)|0,l=+Ja(l),u=+Ja(u),A=+Ja(A),d=+Ja(d),m=+Ja(m),no(0,k|0,o|0,+l,+u,+A,+d,+m,+ +Ja(B))|0}function MLe(){var o=0;return s[7624]|0||(_Le(9172),o=7624,n[o>>2]=1,n[o+4>>2]=0),9172}function _Le(o){o=o|0,Ro(o,ULe()|0,6)}function ULe(){return 1112}function HLe(o){o=o|0,Uh(o)}function jLe(o){o=o|0,nZ(o+24|0),iZ(o+16|0)}function nZ(o){o=o|0,GLe(o)}function iZ(o){o=o|0,qLe(o)}function qLe(o){o=o|0;var l=0,u=0;if(l=n[o>>2]|0,l|0)do u=l,l=n[l>>2]|0,yt(u);while(l|0);n[o>>2]=0}function GLe(o){o=o|0;var l=0,u=0;if(l=n[o>>2]|0,l|0)do u=l,l=n[l>>2]|0,yt(u);while(l|0);n[o>>2]=0}function Uh(o){o=o|0;var l=0;n[o+16>>2]=0,n[o+20>>2]=0,l=o+24|0,n[l>>2]=0,n[o+28>>2]=l,n[o+36>>2]=0,s[o+40>>0]=0,s[o+41>>0]=0}function WLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],YLe(o,u,d,0),I=A}function YLe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=vM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=VLe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,KLe(m,A)|0,A),I=d}function vM(){var o=0,l=0;if(s[7640]|0||(oZ(9232),gr(26,9232,U|0)|0,l=7640,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9232)|0)){o=9232,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));oZ(9232)}return 9232}function VLe(o){return o=o|0,0}function KLe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=vM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],sZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(JLe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function sZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function JLe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=zLe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,ZLe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],sZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,XLe(o,k),$Le(k),I=_;return}}function zLe(o){return o=o|0,357913941}function ZLe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function XLe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function $Le(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function oZ(o){o=o|0,rMe(o)}function eMe(o){o=o|0,tMe(o+24|0)}function tMe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function rMe(o){o=o|0;var l=0;l=en()|0,tn(o,2,1,l,nMe()|0,3),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function nMe(){return 1144}function iMe(o,l,u,A,d){o=o|0,l=l|0,u=+u,A=+A,d=d|0;var m=0,B=0,k=0,T=0;m=I,I=I+16|0,B=m+8|0,k=m,T=sMe(o)|0,o=n[T+4>>2]|0,n[k>>2]=n[T>>2],n[k+4>>2]=o,n[B>>2]=n[k>>2],n[B+4>>2]=n[k+4>>2],oMe(l,B,u,A,d),I=m}function sMe(o){return o=o|0,(n[(vM()|0)+24>>2]|0)+(o*12|0)|0}function oMe(o,l,u,A,d){o=o|0,l=l|0,u=+u,A=+A,d=d|0;var m=0,B=0,k=0,T=0,_=0;_=I,I=I+16|0,B=_+2|0,k=_+1|0,T=_,m=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(m=n[(n[o>>2]|0)+m>>2]|0),Tf(B,u),u=+Rf(B,u),Tf(k,A),A=+Rf(k,A),np(T,d),T=ip(T,d)|0,C$[m&1](o,u,A,T),I=_}function Tf(o,l){o=o|0,l=+l}function Rf(o,l){return o=o|0,l=+l,+ +lMe(l)}function np(o,l){o=o|0,l=l|0}function ip(o,l){return o=o|0,l=l|0,aMe(l)|0}function aMe(o){return o=o|0,o|0}function lMe(o){return o=+o,+o}function cMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],uMe(o,u,d,1),I=A}function uMe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=SM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=fMe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,AMe(m,A)|0,A),I=d}function SM(){var o=0,l=0;if(s[7648]|0||(lZ(9268),gr(27,9268,U|0)|0,l=7648,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9268)|0)){o=9268,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));lZ(9268)}return 9268}function fMe(o){return o=o|0,0}function AMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=SM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],aZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(pMe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function aZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function pMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=hMe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,gMe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],aZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,dMe(o,k),mMe(k),I=_;return}}function hMe(o){return o=o|0,357913941}function gMe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function dMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function mMe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function lZ(o){o=o|0,IMe(o)}function yMe(o){o=o|0,EMe(o+24|0)}function EMe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function IMe(o){o=o|0;var l=0;l=en()|0,tn(o,2,4,l,CMe()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function CMe(){return 1160}function wMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;return u=I,I=I+16|0,A=u+8|0,d=u,m=BMe(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],l=vMe(l,A)|0,I=u,l|0}function BMe(o){return o=o|0,(n[(SM()|0)+24>>2]|0)+(o*12|0)|0}function vMe(o,l){o=o|0,l=l|0;var u=0;return u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),cZ(dd[u&31](o)|0)|0}function cZ(o){return o=o|0,o&1|0}function SMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],DMe(o,u,d,0),I=A}function DMe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=DM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=bMe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,PMe(m,A)|0,A),I=d}function DM(){var o=0,l=0;if(s[7656]|0||(fZ(9304),gr(28,9304,U|0)|0,l=7656,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9304)|0)){o=9304,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));fZ(9304)}return 9304}function bMe(o){return o=o|0,0}function PMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=DM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],uZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(xMe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function uZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function xMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=kMe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,QMe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],uZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,TMe(o,k),RMe(k),I=_;return}}function kMe(o){return o=o|0,357913941}function QMe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function TMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function RMe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function fZ(o){o=o|0,OMe(o)}function FMe(o){o=o|0,NMe(o+24|0)}function NMe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function OMe(o){o=o|0;var l=0;l=en()|0,tn(o,2,5,l,LMe()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function LMe(){return 1164}function MMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,d=A+8|0,m=A,B=_Me(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],UMe(l,d,u),I=A}function _Me(o){return o=o|0,(n[(DM()|0)+24>>2]|0)+(o*12|0)|0}function UMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),Hh(d,u),u=jh(d,u)|0,ap[A&31](o,u),qh(d),I=m}function Hh(o,l){o=o|0,l=l|0,HMe(o,l)}function jh(o,l){return o=o|0,l=l|0,o|0}function qh(o){o=o|0,Df(o)}function HMe(o,l){o=o|0,l=l|0,bM(o,l)}function bM(o,l){o=o|0,l=l|0,n[o>>2]=l}function jMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],qMe(o,u,d,0),I=A}function qMe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=PM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=GMe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,WMe(m,A)|0,A),I=d}function PM(){var o=0,l=0;if(s[7664]|0||(pZ(9340),gr(29,9340,U|0)|0,l=7664,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9340)|0)){o=9340,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));pZ(9340)}return 9340}function GMe(o){return o=o|0,0}function WMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=PM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],AZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(YMe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function AZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function YMe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=VMe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,KMe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],AZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,JMe(o,k),zMe(k),I=_;return}}function VMe(o){return o=o|0,357913941}function KMe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function JMe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function zMe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function pZ(o){o=o|0,$Me(o)}function ZMe(o){o=o|0,XMe(o+24|0)}function XMe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function $Me(o){o=o|0;var l=0;l=en()|0,tn(o,2,4,l,e_e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function e_e(){return 1180}function t_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=r_e(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],u=n_e(l,d,u)|0,I=A,u|0}function r_e(o){return o=o|0,(n[(PM()|0)+24>>2]|0)+(o*12|0)|0}function n_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;return m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),ld(d,u),d=cd(d,u)|0,d=YP(v_[A&15](o,d)|0)|0,I=m,d|0}function ld(o,l){o=o|0,l=l|0}function cd(o,l){return o=o|0,l=l|0,i_e(l)|0}function YP(o){return o=o|0,o|0}function i_e(o){return o=o|0,o|0}function s_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],o_e(o,u,d,0),I=A}function o_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=xM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=a_e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,l_e(m,A)|0,A),I=d}function xM(){var o=0,l=0;if(s[7672]|0||(gZ(9376),gr(30,9376,U|0)|0,l=7672,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9376)|0)){o=9376,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));gZ(9376)}return 9376}function a_e(o){return o=o|0,0}function l_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=xM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],hZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(c_e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function hZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function c_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=u_e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,f_e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],hZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,A_e(o,k),p_e(k),I=_;return}}function u_e(o){return o=o|0,357913941}function f_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function A_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function p_e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function gZ(o){o=o|0,d_e(o)}function h_e(o){o=o|0,g_e(o+24|0)}function g_e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function d_e(o){o=o|0;var l=0;l=en()|0,tn(o,2,5,l,dZ()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function dZ(){return 1196}function m_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;return u=I,I=I+16|0,A=u+8|0,d=u,m=y_e(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],l=E_e(l,A)|0,I=u,l|0}function y_e(o){return o=o|0,(n[(xM()|0)+24>>2]|0)+(o*12|0)|0}function E_e(o,l){o=o|0,l=l|0;var u=0;return u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),YP(dd[u&31](o)|0)|0}function I_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],C_e(o,u,d,1),I=A}function C_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=kM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=w_e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,B_e(m,A)|0,A),I=d}function kM(){var o=0,l=0;if(s[7680]|0||(yZ(9412),gr(31,9412,U|0)|0,l=7680,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9412)|0)){o=9412,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));yZ(9412)}return 9412}function w_e(o){return o=o|0,0}function B_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=kM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],mZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(v_e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function mZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function v_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=S_e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,D_e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],mZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,b_e(o,k),P_e(k),I=_;return}}function S_e(o){return o=o|0,357913941}function D_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function b_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function P_e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function yZ(o){o=o|0,Q_e(o)}function x_e(o){o=o|0,k_e(o+24|0)}function k_e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function Q_e(o){o=o|0;var l=0;l=en()|0,tn(o,2,6,l,EZ()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function EZ(){return 1200}function T_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;return u=I,I=I+16|0,A=u+8|0,d=u,m=R_e(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],l=F_e(l,A)|0,I=u,l|0}function R_e(o){return o=o|0,(n[(kM()|0)+24>>2]|0)+(o*12|0)|0}function F_e(o,l){o=o|0,l=l|0;var u=0;return u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),VP(dd[u&31](o)|0)|0}function VP(o){return o=o|0,o|0}function N_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],O_e(o,u,d,0),I=A}function O_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=QM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=L_e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,M_e(m,A)|0,A),I=d}function QM(){var o=0,l=0;if(s[7688]|0||(CZ(9448),gr(32,9448,U|0)|0,l=7688,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9448)|0)){o=9448,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));CZ(9448)}return 9448}function L_e(o){return o=o|0,0}function M_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=QM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],IZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(__e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function IZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function __e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=U_e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,H_e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],IZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,j_e(o,k),q_e(k),I=_;return}}function U_e(o){return o=o|0,357913941}function H_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function j_e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function q_e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function CZ(o){o=o|0,Y_e(o)}function G_e(o){o=o|0,W_e(o+24|0)}function W_e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function Y_e(o){o=o|0;var l=0;l=en()|0,tn(o,2,6,l,wZ()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function wZ(){return 1204}function V_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,d=A+8|0,m=A,B=K_e(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],J_e(l,d,u),I=A}function K_e(o){return o=o|0,(n[(QM()|0)+24>>2]|0)+(o*12|0)|0}function J_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),TM(d,u),d=RM(d,u)|0,ap[A&31](o,d),I=m}function TM(o,l){o=o|0,l=l|0}function RM(o,l){return o=o|0,l=l|0,z_e(l)|0}function z_e(o){return o=o|0,o|0}function Z_e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],X_e(o,u,d,0),I=A}function X_e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=FM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=$_e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,eUe(m,A)|0,A),I=d}function FM(){var o=0,l=0;if(s[7696]|0||(vZ(9484),gr(33,9484,U|0)|0,l=7696,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9484)|0)){o=9484,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));vZ(9484)}return 9484}function $_e(o){return o=o|0,0}function eUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=FM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],BZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(tUe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function BZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function tUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=rUe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,nUe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],BZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,iUe(o,k),sUe(k),I=_;return}}function rUe(o){return o=o|0,357913941}function nUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function iUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function sUe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function vZ(o){o=o|0,lUe(o)}function oUe(o){o=o|0,aUe(o+24|0)}function aUe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function lUe(o){o=o|0;var l=0;l=en()|0,tn(o,2,1,l,cUe()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function cUe(){return 1212}function uUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;d=I,I=I+16|0,m=d+8|0,B=d,k=fUe(o)|0,o=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=o,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],AUe(l,m,u,A),I=d}function fUe(o){return o=o|0,(n[(FM()|0)+24>>2]|0)+(o*12|0)|0}function AUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;k=I,I=I+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(d=n[(n[o>>2]|0)+d>>2]|0),TM(m,u),m=RM(m,u)|0,ld(B,A),B=cd(B,A)|0,L2[d&15](o,m,B),I=k}function pUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],hUe(o,u,d,1),I=A}function hUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=NM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=gUe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,dUe(m,A)|0,A),I=d}function NM(){var o=0,l=0;if(s[7704]|0||(DZ(9520),gr(34,9520,U|0)|0,l=7704,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9520)|0)){o=9520,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));DZ(9520)}return 9520}function gUe(o){return o=o|0,0}function dUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=NM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],SZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(mUe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function SZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function mUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=yUe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,EUe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],SZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,IUe(o,k),CUe(k),I=_;return}}function yUe(o){return o=o|0,357913941}function EUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function IUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function CUe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function DZ(o){o=o|0,vUe(o)}function wUe(o){o=o|0,BUe(o+24|0)}function BUe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function vUe(o){o=o|0;var l=0;l=en()|0,tn(o,2,1,l,SUe()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function SUe(){return 1224}function DUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;return d=I,I=I+16|0,m=d+8|0,B=d,k=bUe(o)|0,o=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=o,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],A=+PUe(l,m,u),I=d,+A}function bUe(o){return o=o|0,(n[(NM()|0)+24>>2]|0)+(o*12|0)|0}function PUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),np(d,u),d=ip(d,u)|0,B=+Qf(+B$[A&7](o,d)),I=m,+B}function xUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],kUe(o,u,d,1),I=A}function kUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=OM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=QUe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,TUe(m,A)|0,A),I=d}function OM(){var o=0,l=0;if(s[7712]|0||(PZ(9556),gr(35,9556,U|0)|0,l=7712,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9556)|0)){o=9556,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));PZ(9556)}return 9556}function QUe(o){return o=o|0,0}function TUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=OM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],bZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(RUe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function bZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function RUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=FUe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,NUe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],bZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,OUe(o,k),LUe(k),I=_;return}}function FUe(o){return o=o|0,357913941}function NUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function OUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function LUe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function PZ(o){o=o|0,UUe(o)}function MUe(o){o=o|0,_Ue(o+24|0)}function _Ue(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function UUe(o){o=o|0;var l=0;l=en()|0,tn(o,2,5,l,HUe()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function HUe(){return 1232}function jUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=qUe(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],u=+GUe(l,d),I=A,+u}function qUe(o){return o=o|0,(n[(OM()|0)+24>>2]|0)+(o*12|0)|0}function GUe(o,l){o=o|0,l=l|0;var u=0;return u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),+ +Qf(+w$[u&15](o))}function WUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],YUe(o,u,d,1),I=A}function YUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=LM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=VUe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,KUe(m,A)|0,A),I=d}function LM(){var o=0,l=0;if(s[7720]|0||(kZ(9592),gr(36,9592,U|0)|0,l=7720,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9592)|0)){o=9592,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));kZ(9592)}return 9592}function VUe(o){return o=o|0,0}function KUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=LM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],xZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(JUe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function xZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function JUe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=zUe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,ZUe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],xZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,XUe(o,k),$Ue(k),I=_;return}}function zUe(o){return o=o|0,357913941}function ZUe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function XUe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function $Ue(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function kZ(o){o=o|0,r4e(o)}function e4e(o){o=o|0,t4e(o+24|0)}function t4e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function r4e(o){o=o|0;var l=0;l=en()|0,tn(o,2,7,l,n4e()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function n4e(){return 1276}function i4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;return u=I,I=I+16|0,A=u+8|0,d=u,m=s4e(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],l=o4e(l,A)|0,I=u,l|0}function s4e(o){return o=o|0,(n[(LM()|0)+24>>2]|0)+(o*12|0)|0}function o4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;return d=I,I=I+16|0,A=d,u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),ap[u&31](A,o),A=QZ(A)|0,I=d,A|0}function QZ(o){o=o|0;var l=0,u=0,A=0,d=0;return d=I,I=I+32|0,l=d+12|0,u=d,A=IM(TZ()|0)|0,A?(CM(l,A),wM(u,l),a4e(o,u),o=BM(l)|0):o=l4e(o)|0,I=d,o|0}function TZ(){var o=0;return s[7736]|0||(y4e(9640),gr(25,9640,U|0)|0,o=7736,n[o>>2]=1,n[o+4>>2]=0),9640}function a4e(o,l){o=o|0,l=l|0,A4e(l,o,o+8|0)|0}function l4e(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0;return u=I,I=I+16|0,d=u+4|0,B=u,A=Fl(8)|0,l=A,k=Jt(16)|0,n[k>>2]=n[o>>2],n[k+4>>2]=n[o+4>>2],n[k+8>>2]=n[o+8>>2],n[k+12>>2]=n[o+12>>2],m=l+4|0,n[m>>2]=k,o=Jt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],MM(o,m,d),n[A>>2]=o,I=u,l|0}function MM(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,u=Jt(16)|0,n[u+4>>2]=0,n[u+8>>2]=0,n[u>>2]=1244,n[u+12>>2]=l,n[o+4>>2]=u}function c4e(o){o=o|0,$y(o),yt(o)}function u4e(o){o=o|0,o=n[o+12>>2]|0,o|0&&yt(o)}function f4e(o){o=o|0,yt(o)}function A4e(o,l,u){return o=o|0,l=l|0,u=u|0,l=p4e(n[o>>2]|0,l,u)|0,u=o+4|0,n[(n[u>>2]|0)+8>>2]=l,n[(n[u>>2]|0)+8>>2]|0}function p4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;return A=I,I=I+16|0,d=A,Nl(d),o=Ls(o)|0,u=h4e(o,n[l>>2]|0,+E[u>>3])|0,Ol(d),I=A,u|0}function h4e(o,l,u){o=o|0,l=l|0,u=+u;var A=0;return A=ma(g4e()|0)|0,l=Yy(l)|0,lu(0,A|0,o|0,l|0,+ +Ja(u))|0}function g4e(){var o=0;return s[7728]|0||(d4e(9628),o=7728,n[o>>2]=1,n[o+4>>2]=0),9628}function d4e(o){o=o|0,Ro(o,m4e()|0,2)}function m4e(){return 1264}function y4e(o){o=o|0,Uh(o)}function E4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],I4e(o,u,d,1),I=A}function I4e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=_M()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=C4e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,w4e(m,A)|0,A),I=d}function _M(){var o=0,l=0;if(s[7744]|0||(FZ(9684),gr(37,9684,U|0)|0,l=7744,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9684)|0)){o=9684,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));FZ(9684)}return 9684}function C4e(o){return o=o|0,0}function w4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=_M()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],RZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(B4e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function RZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function B4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=v4e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,S4e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],RZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,D4e(o,k),b4e(k),I=_;return}}function v4e(o){return o=o|0,357913941}function S4e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function D4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function b4e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function FZ(o){o=o|0,k4e(o)}function P4e(o){o=o|0,x4e(o+24|0)}function x4e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function k4e(o){o=o|0;var l=0;l=en()|0,tn(o,2,5,l,Q4e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function Q4e(){return 1280}function T4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=R4e(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],u=F4e(l,d,u)|0,I=A,u|0}function R4e(o){return o=o|0,(n[(_M()|0)+24>>2]|0)+(o*12|0)|0}function F4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return B=I,I=I+32|0,d=B,m=B+16|0,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),np(m,u),m=ip(m,u)|0,L2[A&15](d,o,m),m=QZ(d)|0,I=B,m|0}function N4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],O4e(o,u,d,1),I=A}function O4e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=UM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=L4e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,M4e(m,A)|0,A),I=d}function UM(){var o=0,l=0;if(s[7752]|0||(OZ(9720),gr(38,9720,U|0)|0,l=7752,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9720)|0)){o=9720,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));OZ(9720)}return 9720}function L4e(o){return o=o|0,0}function M4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=UM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],NZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(_4e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function NZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function _4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=U4e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,H4e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],NZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,j4e(o,k),q4e(k),I=_;return}}function U4e(o){return o=o|0,357913941}function H4e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function j4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function q4e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function OZ(o){o=o|0,Y4e(o)}function G4e(o){o=o|0,W4e(o+24|0)}function W4e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function Y4e(o){o=o|0;var l=0;l=en()|0,tn(o,2,8,l,V4e()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function V4e(){return 1288}function K4e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;return u=I,I=I+16|0,A=u+8|0,d=u,m=J4e(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],l=z4e(l,A)|0,I=u,l|0}function J4e(o){return o=o|0,(n[(UM()|0)+24>>2]|0)+(o*12|0)|0}function z4e(o,l){o=o|0,l=l|0;var u=0;return u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),od(dd[u&31](o)|0)|0}function Z4e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],X4e(o,u,d,0),I=A}function X4e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=HM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=$4e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,e3e(m,A)|0,A),I=d}function HM(){var o=0,l=0;if(s[7760]|0||(MZ(9756),gr(39,9756,U|0)|0,l=7760,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9756)|0)){o=9756,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));MZ(9756)}return 9756}function $4e(o){return o=o|0,0}function e3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=HM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],LZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(t3e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function LZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function t3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=r3e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,n3e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],LZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,i3e(o,k),s3e(k),I=_;return}}function r3e(o){return o=o|0,357913941}function n3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function i3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function s3e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function MZ(o){o=o|0,l3e(o)}function o3e(o){o=o|0,a3e(o+24|0)}function a3e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function l3e(o){o=o|0;var l=0;l=en()|0,tn(o,2,8,l,c3e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function c3e(){return 1292}function u3e(o,l,u){o=o|0,l=l|0,u=+u;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,d=A+8|0,m=A,B=f3e(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],A3e(l,d,u),I=A}function f3e(o){return o=o|0,(n[(HM()|0)+24>>2]|0)+(o*12|0)|0}function A3e(o,l,u){o=o|0,l=l|0,u=+u;var A=0,d=0,m=0;m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),Tf(d,u),u=+Rf(d,u),E$[A&31](o,u),I=m}function p3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],h3e(o,u,d,0),I=A}function h3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=jM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=g3e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,d3e(m,A)|0,A),I=d}function jM(){var o=0,l=0;if(s[7768]|0||(UZ(9792),gr(40,9792,U|0)|0,l=7768,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9792)|0)){o=9792,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));UZ(9792)}return 9792}function g3e(o){return o=o|0,0}function d3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=jM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],_Z(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(m3e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function _Z(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function m3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=y3e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,E3e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],_Z(m,A,u),n[T>>2]=(n[T>>2]|0)+12,I3e(o,k),C3e(k),I=_;return}}function y3e(o){return o=o|0,357913941}function E3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function I3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function C3e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function UZ(o){o=o|0,v3e(o)}function w3e(o){o=o|0,B3e(o+24|0)}function B3e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function v3e(o){o=o|0;var l=0;l=en()|0,tn(o,2,1,l,S3e()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function S3e(){return 1300}function D3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=+A;var d=0,m=0,B=0,k=0;d=I,I=I+16|0,m=d+8|0,B=d,k=b3e(o)|0,o=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=o,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],P3e(l,m,u,A),I=d}function b3e(o){return o=o|0,(n[(jM()|0)+24>>2]|0)+(o*12|0)|0}function P3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=+A;var d=0,m=0,B=0,k=0;k=I,I=I+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(d=n[(n[o>>2]|0)+d>>2]|0),np(m,u),m=ip(m,u)|0,Tf(B,A),A=+Rf(B,A),b$[d&15](o,m,A),I=k}function x3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],k3e(o,u,d,0),I=A}function k3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=qM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=Q3e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,T3e(m,A)|0,A),I=d}function qM(){var o=0,l=0;if(s[7776]|0||(jZ(9828),gr(41,9828,U|0)|0,l=7776,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9828)|0)){o=9828,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));jZ(9828)}return 9828}function Q3e(o){return o=o|0,0}function T3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=qM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],HZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(R3e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function HZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function R3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=F3e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,N3e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],HZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,O3e(o,k),L3e(k),I=_;return}}function F3e(o){return o=o|0,357913941}function N3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function O3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function L3e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function jZ(o){o=o|0,U3e(o)}function M3e(o){o=o|0,_3e(o+24|0)}function _3e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function U3e(o){o=o|0;var l=0;l=en()|0,tn(o,2,7,l,H3e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function H3e(){return 1312}function j3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,d=A+8|0,m=A,B=q3e(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],G3e(l,d,u),I=A}function q3e(o){return o=o|0,(n[(qM()|0)+24>>2]|0)+(o*12|0)|0}function G3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),np(d,u),d=ip(d,u)|0,ap[A&31](o,d),I=m}function W3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Y3e(o,u,d,0),I=A}function Y3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=GM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=V3e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,K3e(m,A)|0,A),I=d}function GM(){var o=0,l=0;if(s[7784]|0||(GZ(9864),gr(42,9864,U|0)|0,l=7784,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9864)|0)){o=9864,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));GZ(9864)}return 9864}function V3e(o){return o=o|0,0}function K3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=GM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],qZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(J3e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function qZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function J3e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=z3e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,Z3e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],qZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,X3e(o,k),$3e(k),I=_;return}}function z3e(o){return o=o|0,357913941}function Z3e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function X3e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function $3e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function GZ(o){o=o|0,r8e(o)}function e8e(o){o=o|0,t8e(o+24|0)}function t8e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function r8e(o){o=o|0;var l=0;l=en()|0,tn(o,2,8,l,n8e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function n8e(){return 1320}function i8e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,d=A+8|0,m=A,B=s8e(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],o8e(l,d,u),I=A}function s8e(o){return o=o|0,(n[(GM()|0)+24>>2]|0)+(o*12|0)|0}function o8e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),a8e(d,u),d=l8e(d,u)|0,ap[A&31](o,d),I=m}function a8e(o,l){o=o|0,l=l|0}function l8e(o,l){return o=o|0,l=l|0,c8e(l)|0}function c8e(o){return o=o|0,o|0}function u8e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],f8e(o,u,d,0),I=A}function f8e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=WM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=A8e(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,p8e(m,A)|0,A),I=d}function WM(){var o=0,l=0;if(s[7792]|0||(YZ(9900),gr(43,9900,U|0)|0,l=7792,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9900)|0)){o=9900,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));YZ(9900)}return 9900}function A8e(o){return o=o|0,0}function p8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=WM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],WZ(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(h8e(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function WZ(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function h8e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=g8e(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,d8e(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],WZ(m,A,u),n[T>>2]=(n[T>>2]|0)+12,m8e(o,k),y8e(k),I=_;return}}function g8e(o){return o=o|0,357913941}function d8e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function m8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function y8e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function YZ(o){o=o|0,C8e(o)}function E8e(o){o=o|0,I8e(o+24|0)}function I8e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function C8e(o){o=o|0;var l=0;l=en()|0,tn(o,2,22,l,w8e()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function w8e(){return 1344}function B8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0;u=I,I=I+16|0,A=u+8|0,d=u,m=v8e(o)|0,o=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=o,n[A>>2]=n[d>>2],n[A+4>>2]=n[d+4>>2],S8e(l,A),I=u}function v8e(o){return o=o|0,(n[(WM()|0)+24>>2]|0)+(o*12|0)|0}function S8e(o,l){o=o|0,l=l|0;var u=0;u=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(u=n[(n[o>>2]|0)+u>>2]|0),op[u&127](o)}function D8e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=YM()|0,o=b8e(u)|0,vn(m,l,d,o,P8e(u,A)|0,A)}function YM(){var o=0,l=0;if(s[7800]|0||(KZ(9936),gr(44,9936,U|0)|0,l=7800,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9936)|0)){o=9936,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));KZ(9936)}return 9936}function b8e(o){return o=o|0,o|0}function P8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=YM()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(VZ(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(x8e(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function VZ(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function x8e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=k8e(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,Q8e(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,VZ(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,T8e(o,d),R8e(d),I=k;return}}function k8e(o){return o=o|0,536870911}function Q8e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function T8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function R8e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function KZ(o){o=o|0,O8e(o)}function F8e(o){o=o|0,N8e(o+24|0)}function N8e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function O8e(o){o=o|0;var l=0;l=en()|0,tn(o,1,23,l,wZ()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function L8e(o,l){o=o|0,l=l|0,_8e(n[(M8e(o)|0)>>2]|0,l)}function M8e(o){return o=o|0,(n[(YM()|0)+24>>2]|0)+(o<<3)|0}function _8e(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,TM(A,l),l=RM(A,l)|0,op[o&127](l),I=u}function U8e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=VM()|0,o=H8e(u)|0,vn(m,l,d,o,j8e(u,A)|0,A)}function VM(){var o=0,l=0;if(s[7808]|0||(zZ(9972),gr(45,9972,U|0)|0,l=7808,n[l>>2]=1,n[l+4>>2]=0),!(Ur(9972)|0)){o=9972,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));zZ(9972)}return 9972}function H8e(o){return o=o|0,o|0}function j8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=VM()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(JZ(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(q8e(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function JZ(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function q8e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=G8e(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,W8e(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,JZ(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,Y8e(o,d),V8e(d),I=k;return}}function G8e(o){return o=o|0,536870911}function W8e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function Y8e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function V8e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function zZ(o){o=o|0,z8e(o)}function K8e(o){o=o|0,J8e(o+24|0)}function J8e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function z8e(o){o=o|0;var l=0;l=en()|0,tn(o,1,9,l,Z8e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function Z8e(){return 1348}function X8e(o,l){return o=o|0,l=l|0,eHe(n[($8e(o)|0)>>2]|0,l)|0}function $8e(o){return o=o|0,(n[(VM()|0)+24>>2]|0)+(o<<3)|0}function eHe(o,l){o=o|0,l=l|0;var u=0,A=0;return u=I,I=I+16|0,A=u,ZZ(A,l),l=XZ(A,l)|0,l=YP(dd[o&31](l)|0)|0,I=u,l|0}function ZZ(o,l){o=o|0,l=l|0}function XZ(o,l){return o=o|0,l=l|0,tHe(l)|0}function tHe(o){return o=o|0,o|0}function rHe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=KM()|0,o=nHe(u)|0,vn(m,l,d,o,iHe(u,A)|0,A)}function KM(){var o=0,l=0;if(s[7816]|0||(eX(10008),gr(46,10008,U|0)|0,l=7816,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10008)|0)){o=10008,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));eX(10008)}return 10008}function nHe(o){return o=o|0,o|0}function iHe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=KM()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?($Z(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(sHe(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function $Z(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function sHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=oHe(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,aHe(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,$Z(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,lHe(o,d),cHe(d),I=k;return}}function oHe(o){return o=o|0,536870911}function aHe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function lHe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function cHe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function eX(o){o=o|0,AHe(o)}function uHe(o){o=o|0,fHe(o+24|0)}function fHe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function AHe(o){o=o|0;var l=0;l=en()|0,tn(o,1,15,l,dZ()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function pHe(o){return o=o|0,gHe(n[(hHe(o)|0)>>2]|0)|0}function hHe(o){return o=o|0,(n[(KM()|0)+24>>2]|0)+(o<<3)|0}function gHe(o){return o=o|0,YP(ax[o&7]()|0)|0}function dHe(){var o=0;return s[7832]|0||(vHe(10052),gr(25,10052,U|0)|0,o=7832,n[o>>2]=1,n[o+4>>2]=0),10052}function mHe(o,l){o=o|0,l=l|0,n[o>>2]=yHe()|0,n[o+4>>2]=EHe()|0,n[o+12>>2]=l,n[o+8>>2]=IHe()|0,n[o+32>>2]=2}function yHe(){return 11709}function EHe(){return 1188}function IHe(){return KP()|0}function CHe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(wHe(u),yt(u)):l|0&&(Oy(l),yt(l))}function Gh(o,l){return o=o|0,l=l|0,l&o|0}function wHe(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function KP(){var o=0;return s[7824]|0||(n[2511]=BHe()|0,n[2512]=0,o=7824,n[o>>2]=1,n[o+4>>2]=0),10044}function BHe(){return 0}function vHe(o){o=o|0,Uh(o)}function SHe(o){o=o|0;var l=0,u=0,A=0,d=0,m=0;l=I,I=I+32|0,u=l+24|0,m=l+16|0,d=l+8|0,A=l,DHe(o,4827),bHe(o,4834,3)|0,PHe(o,3682,47)|0,n[m>>2]=9,n[m+4>>2]=0,n[u>>2]=n[m>>2],n[u+4>>2]=n[m+4>>2],xHe(o,4841,u)|0,n[d>>2]=1,n[d+4>>2]=0,n[u>>2]=n[d>>2],n[u+4>>2]=n[d+4>>2],kHe(o,4871,u)|0,n[A>>2]=10,n[A+4>>2]=0,n[u>>2]=n[A>>2],n[u+4>>2]=n[A+4>>2],QHe(o,4891,u)|0,I=l}function DHe(o,l){o=o|0,l=l|0;var u=0;u=c6e()|0,n[o>>2]=u,u6e(u,l),Wh(n[o>>2]|0)}function bHe(o,l,u){return o=o|0,l=l|0,u=u|0,Vje(o,Bn(l)|0,u,0),o|0}function PHe(o,l,u){return o=o|0,l=l|0,u=u|0,Tje(o,Bn(l)|0,u,0),o|0}function xHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],pje(o,l,d),I=A,o|0}function kHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],KHe(o,l,d),I=A,o|0}function QHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=n[u+4>>2]|0,n[m>>2]=n[u>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],THe(o,l,d),I=A,o|0}function THe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],RHe(o,u,d,1),I=A}function RHe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=JM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=FHe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,NHe(m,A)|0,A),I=d}function JM(){var o=0,l=0;if(s[7840]|0||(rX(10100),gr(48,10100,U|0)|0,l=7840,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10100)|0)){o=10100,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));rX(10100)}return 10100}function FHe(o){return o=o|0,0}function NHe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=JM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],tX(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(OHe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function tX(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function OHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=LHe(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,MHe(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],tX(m,A,u),n[T>>2]=(n[T>>2]|0)+12,_He(o,k),UHe(k),I=_;return}}function LHe(o){return o=o|0,357913941}function MHe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function _He(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function UHe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function rX(o){o=o|0,qHe(o)}function HHe(o){o=o|0,jHe(o+24|0)}function jHe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function qHe(o){o=o|0;var l=0;l=en()|0,tn(o,2,6,l,GHe()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function GHe(){return 1364}function WHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;return A=I,I=I+16|0,d=A+8|0,m=A,B=YHe(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],u=VHe(l,d,u)|0,I=A,u|0}function YHe(o){return o=o|0,(n[(JM()|0)+24>>2]|0)+(o*12|0)|0}function VHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;return m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),np(d,u),d=ip(d,u)|0,d=cZ(v_[A&15](o,d)|0)|0,I=m,d|0}function KHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],JHe(o,u,d,0),I=A}function JHe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=zM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=zHe(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,ZHe(m,A)|0,A),I=d}function zM(){var o=0,l=0;if(s[7848]|0||(iX(10136),gr(49,10136,U|0)|0,l=7848,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10136)|0)){o=10136,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));iX(10136)}return 10136}function zHe(o){return o=o|0,0}function ZHe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=zM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],nX(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(XHe(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function nX(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function XHe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=$He(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,eje(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],nX(m,A,u),n[T>>2]=(n[T>>2]|0)+12,tje(o,k),rje(k),I=_;return}}function $He(o){return o=o|0,357913941}function eje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function tje(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function rje(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function iX(o){o=o|0,sje(o)}function nje(o){o=o|0,ije(o+24|0)}function ije(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function sje(o){o=o|0;var l=0;l=en()|0,tn(o,2,9,l,oje()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function oje(){return 1372}function aje(o,l,u){o=o|0,l=l|0,u=+u;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,d=A+8|0,m=A,B=lje(o)|0,o=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=o,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],cje(l,d,u),I=A}function lje(o){return o=o|0,(n[(zM()|0)+24>>2]|0)+(o*12|0)|0}function cje(o,l,u){o=o|0,l=l|0,u=+u;var A=0,d=0,m=0,B=Xe;m=I,I=I+16|0,d=m,A=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(A=n[(n[o>>2]|0)+A>>2]|0),uje(d,u),B=y(fje(d,u)),y$[A&1](o,B),I=m}function uje(o,l){o=o|0,l=+l}function fje(o,l){return o=o|0,l=+l,y(Aje(l))}function Aje(o){return o=+o,y(o)}function pje(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,d=A+8|0,m=A,k=n[u>>2]|0,B=n[u+4>>2]|0,u=Bn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],hje(o,u,d,0),I=A}function hje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0,T=0,_=0,M=0;d=I,I=I+32|0,m=d+16|0,M=d+8|0,k=d,_=n[u>>2]|0,T=n[u+4>>2]|0,B=n[o>>2]|0,o=ZM()|0,n[M>>2]=_,n[M+4>>2]=T,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],u=gje(m)|0,n[k>>2]=_,n[k+4>>2]=T,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],vn(B,l,o,u,dje(m,A)|0,A),I=d}function ZM(){var o=0,l=0;if(s[7856]|0||(oX(10172),gr(50,10172,U|0)|0,l=7856,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10172)|0)){o=10172,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));oX(10172)}return 10172}function gje(o){return o=o|0,0}function dje(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0;return M=I,I=I+32|0,d=M+24|0,B=M+16|0,k=M,T=M+8|0,m=n[o>>2]|0,A=n[o+4>>2]|0,n[k>>2]=m,n[k+4>>2]=A,G=ZM()|0,_=G+24|0,o=yr(l,4)|0,n[T>>2]=o,l=G+28|0,u=n[l>>2]|0,u>>>0<(n[G+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=A,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],sX(u,d,o),o=(n[l>>2]|0)+12|0,n[l>>2]=o):(mje(_,k,T),o=n[l>>2]|0),I=M,((o-(n[_>>2]|0)|0)/12|0)+-1|0}function sX(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=n[l+4>>2]|0,n[o>>2]=n[l>>2],n[o+4>>2]=A,n[o+8>>2]=u}function mje(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;if(_=I,I=I+48|0,A=_+32|0,B=_+24|0,k=_,T=o+4|0,d=(((n[T>>2]|0)-(n[o>>2]|0)|0)/12|0)+1|0,m=yje(o)|0,m>>>0>>0)sn(o);else{M=n[o>>2]|0,ae=((n[o+8>>2]|0)-M|0)/12|0,G=ae<<1,Eje(k,ae>>>0>>1>>>0?G>>>0>>0?d:G:m,((n[T>>2]|0)-M|0)/12|0,o+8|0),T=k+8|0,m=n[T>>2]|0,d=n[l+4>>2]|0,u=n[u>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[A>>2]=n[B>>2],n[A+4>>2]=n[B+4>>2],sX(m,A,u),n[T>>2]=(n[T>>2]|0)+12,Ije(o,k),Cje(k),I=_;return}}function yje(o){return o=o|0,357913941}function Eje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>357913941)Nt();else{d=Jt(l*12|0)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u*12|0)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l*12|0)}function Ije(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function Cje(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~(((A+-12-l|0)>>>0)/12|0)*12|0)),o=n[o>>2]|0,o|0&&yt(o)}function oX(o){o=o|0,vje(o)}function wje(o){o=o|0,Bje(o+24|0)}function Bje(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~(((l+-12-A|0)>>>0)/12|0)*12|0)),yt(u))}function vje(o){o=o|0;var l=0;l=en()|0,tn(o,2,3,l,Sje()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function Sje(){return 1380}function Dje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;d=I,I=I+16|0,m=d+8|0,B=d,k=bje(o)|0,o=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=o,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],Pje(l,m,u,A),I=d}function bje(o){return o=o|0,(n[(ZM()|0)+24>>2]|0)+(o*12|0)|0}function Pje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;k=I,I=I+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,o=o+(l>>1)|0,l&1&&(d=n[(n[o>>2]|0)+d>>2]|0),np(m,u),m=ip(m,u)|0,xje(B,A),B=kje(B,A)|0,L2[d&15](o,m,B),I=k}function xje(o,l){o=o|0,l=l|0}function kje(o,l){return o=o|0,l=l|0,Qje(l)|0}function Qje(o){return o=o|0,(o|0)!=0|0}function Tje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=XM()|0,o=Rje(u)|0,vn(m,l,d,o,Fje(u,A)|0,A)}function XM(){var o=0,l=0;if(s[7864]|0||(lX(10208),gr(51,10208,U|0)|0,l=7864,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10208)|0)){o=10208,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));lX(10208)}return 10208}function Rje(o){return o=o|0,o|0}function Fje(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=XM()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(aX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(Nje(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function aX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function Nje(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=Oje(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,Lje(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,aX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,Mje(o,d),_je(d),I=k;return}}function Oje(o){return o=o|0,536870911}function Lje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function Mje(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function _je(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function lX(o){o=o|0,jje(o)}function Uje(o){o=o|0,Hje(o+24|0)}function Hje(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function jje(o){o=o|0;var l=0;l=en()|0,tn(o,1,24,l,qje()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function qje(){return 1392}function Gje(o,l){o=o|0,l=l|0,Yje(n[(Wje(o)|0)>>2]|0,l)}function Wje(o){return o=o|0,(n[(XM()|0)+24>>2]|0)+(o<<3)|0}function Yje(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,ZZ(A,l),l=XZ(A,l)|0,op[o&127](l),I=u}function Vje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=$M()|0,o=Kje(u)|0,vn(m,l,d,o,Jje(u,A)|0,A)}function $M(){var o=0,l=0;if(s[7872]|0||(uX(10244),gr(52,10244,U|0)|0,l=7872,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10244)|0)){o=10244,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));uX(10244)}return 10244}function Kje(o){return o=o|0,o|0}function Jje(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=$M()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(cX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(zje(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function cX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function zje(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=Zje(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,Xje(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,cX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,$je(o,d),e6e(d),I=k;return}}function Zje(o){return o=o|0,536870911}function Xje(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function $je(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function e6e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function uX(o){o=o|0,n6e(o)}function t6e(o){o=o|0,r6e(o+24|0)}function r6e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function n6e(o){o=o|0;var l=0;l=en()|0,tn(o,1,16,l,i6e()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function i6e(){return 1400}function s6e(o){return o=o|0,a6e(n[(o6e(o)|0)>>2]|0)|0}function o6e(o){return o=o|0,(n[($M()|0)+24>>2]|0)+(o<<3)|0}function a6e(o){return o=o|0,l6e(ax[o&7]()|0)|0}function l6e(o){return o=o|0,o|0}function c6e(){var o=0;return s[7880]|0||(d6e(10280),gr(25,10280,U|0)|0,o=7880,n[o>>2]=1,n[o+4>>2]=0),10280}function u6e(o,l){o=o|0,l=l|0,n[o>>2]=f6e()|0,n[o+4>>2]=A6e()|0,n[o+12>>2]=l,n[o+8>>2]=p6e()|0,n[o+32>>2]=4}function f6e(){return 11711}function A6e(){return 1356}function p6e(){return KP()|0}function h6e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(g6e(u),yt(u)):l|0&&(zg(l),yt(l))}function g6e(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function d6e(o){o=o|0,Uh(o)}function m6e(o){o=o|0,y6e(o,4920),E6e(o)|0,I6e(o)|0}function y6e(o,l){o=o|0,l=l|0;var u=0;u=TZ()|0,n[o>>2]=u,H6e(u,l),Wh(n[o>>2]|0)}function E6e(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,Q6e()|0),o|0}function I6e(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,C6e()|0),o|0}function C6e(){var o=0;return s[7888]|0||(fX(10328),gr(53,10328,U|0)|0,o=7888,n[o>>2]=1,n[o+4>>2]=0),Ur(10328)|0||fX(10328),10328}function ud(o,l){o=o|0,l=l|0,vn(o,0,l,0,0,0)}function fX(o){o=o|0,v6e(o),fd(o,10)}function w6e(o){o=o|0,B6e(o+24|0)}function B6e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function v6e(o){o=o|0;var l=0;l=en()|0,tn(o,5,1,l,P6e()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function S6e(o,l,u){o=o|0,l=l|0,u=+u,D6e(o,l,u)}function fd(o,l){o=o|0,l=l|0,n[o+20>>2]=l}function D6e(o,l,u){o=o|0,l=l|0,u=+u;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+16|0,m=A+8|0,k=A+13|0,d=A,B=A+12|0,np(k,l),n[m>>2]=ip(k,l)|0,Tf(B,u),E[d>>3]=+Rf(B,u),b6e(o,m,d),I=A}function b6e(o,l,u){o=o|0,l=l|0,u=u|0,Rl(o+8|0,n[l>>2]|0,+E[u>>3]),s[o+24>>0]=1}function P6e(){return 1404}function x6e(o,l){return o=o|0,l=+l,k6e(o,l)|0}function k6e(o,l){o=o|0,l=+l;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return A=I,I=I+16|0,m=A+4|0,B=A+8|0,k=A,d=Fl(8)|0,u=d,T=Jt(16)|0,np(m,o),o=ip(m,o)|0,Tf(B,l),Rl(T,o,+Rf(B,l)),B=u+4|0,n[B>>2]=T,o=Jt(8)|0,B=n[B>>2]|0,n[k>>2]=0,n[m>>2]=n[k>>2],MM(o,B,m),n[d>>2]=o,I=A,u|0}function Q6e(){var o=0;return s[7896]|0||(AX(10364),gr(54,10364,U|0)|0,o=7896,n[o>>2]=1,n[o+4>>2]=0),Ur(10364)|0||AX(10364),10364}function AX(o){o=o|0,F6e(o),fd(o,55)}function T6e(o){o=o|0,R6e(o+24|0)}function R6e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function F6e(o){o=o|0;var l=0;l=en()|0,tn(o,5,4,l,M6e()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function N6e(o){o=o|0,O6e(o)}function O6e(o){o=o|0,L6e(o)}function L6e(o){o=o|0,pX(o+8|0),s[o+24>>0]=1}function pX(o){o=o|0,n[o>>2]=0,E[o+8>>3]=0}function M6e(){return 1424}function _6e(){return U6e()|0}function U6e(){var o=0,l=0,u=0,A=0,d=0,m=0,B=0;return l=I,I=I+16|0,d=l+4|0,B=l,u=Fl(8)|0,o=u,A=Jt(16)|0,pX(A),m=o+4|0,n[m>>2]=A,A=Jt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],MM(A,m,d),n[u>>2]=A,I=l,o|0}function H6e(o,l){o=o|0,l=l|0,n[o>>2]=j6e()|0,n[o+4>>2]=q6e()|0,n[o+12>>2]=l,n[o+8>>2]=G6e()|0,n[o+32>>2]=5}function j6e(){return 11710}function q6e(){return 1416}function G6e(){return JP()|0}function W6e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(Y6e(u),yt(u)):l|0&&yt(l)}function Y6e(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function JP(){var o=0;return s[7904]|0||(n[2600]=V6e()|0,n[2601]=0,o=7904,n[o>>2]=1,n[o+4>>2]=0),10400}function V6e(){return n[357]|0}function K6e(o){o=o|0,J6e(o,4926),z6e(o)|0}function J6e(o,l){o=o|0,l=l|0;var u=0;u=tZ()|0,n[o>>2]=u,aqe(u,l),Wh(n[o>>2]|0)}function z6e(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,Z6e()|0),o|0}function Z6e(){var o=0;return s[7912]|0||(hX(10412),gr(56,10412,U|0)|0,o=7912,n[o>>2]=1,n[o+4>>2]=0),Ur(10412)|0||hX(10412),10412}function hX(o){o=o|0,eqe(o),fd(o,57)}function X6e(o){o=o|0,$6e(o+24|0)}function $6e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function eqe(o){o=o|0;var l=0;l=en()|0,tn(o,5,5,l,iqe()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function tqe(o){o=o|0,rqe(o)}function rqe(o){o=o|0,nqe(o)}function nqe(o){o=o|0;var l=0,u=0;l=o+8|0,u=l+48|0;do n[l>>2]=0,l=l+4|0;while((l|0)<(u|0));s[o+56>>0]=1}function iqe(){return 1432}function sqe(){return oqe()|0}function oqe(){var o=0,l=0,u=0,A=0,d=0,m=0,B=0,k=0;B=I,I=I+16|0,o=B+4|0,l=B,u=Fl(8)|0,A=u,d=Jt(48)|0,m=d,k=m+48|0;do n[m>>2]=0,m=m+4|0;while((m|0)<(k|0));return m=A+4|0,n[m>>2]=d,k=Jt(8)|0,m=n[m>>2]|0,n[l>>2]=0,n[o>>2]=n[l>>2],rZ(k,m,o),n[u>>2]=k,I=B,A|0}function aqe(o,l){o=o|0,l=l|0,n[o>>2]=lqe()|0,n[o+4>>2]=cqe()|0,n[o+12>>2]=l,n[o+8>>2]=uqe()|0,n[o+32>>2]=6}function lqe(){return 11704}function cqe(){return 1436}function uqe(){return JP()|0}function fqe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(Aqe(u),yt(u)):l|0&&yt(l)}function Aqe(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function pqe(o){o=o|0,hqe(o,4933),gqe(o)|0,dqe(o)|0}function hqe(o,l){o=o|0,l=l|0;var u=0;u=Uqe()|0,n[o>>2]=u,Hqe(u,l),Wh(n[o>>2]|0)}function gqe(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,kqe()|0),o|0}function dqe(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,mqe()|0),o|0}function mqe(){var o=0;return s[7920]|0||(gX(10452),gr(58,10452,U|0)|0,o=7920,n[o>>2]=1,n[o+4>>2]=0),Ur(10452)|0||gX(10452),10452}function gX(o){o=o|0,Iqe(o),fd(o,1)}function yqe(o){o=o|0,Eqe(o+24|0)}function Eqe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function Iqe(o){o=o|0;var l=0;l=en()|0,tn(o,5,1,l,vqe()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function Cqe(o,l,u){o=o|0,l=+l,u=+u,wqe(o,l,u)}function wqe(o,l,u){o=o|0,l=+l,u=+u;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+32|0,m=A+8|0,k=A+17|0,d=A,B=A+16|0,Tf(k,l),E[m>>3]=+Rf(k,l),Tf(B,u),E[d>>3]=+Rf(B,u),Bqe(o,m,d),I=A}function Bqe(o,l,u){o=o|0,l=l|0,u=u|0,dX(o+8|0,+E[l>>3],+E[u>>3]),s[o+24>>0]=1}function dX(o,l,u){o=o|0,l=+l,u=+u,E[o>>3]=l,E[o+8>>3]=u}function vqe(){return 1472}function Sqe(o,l){return o=+o,l=+l,Dqe(o,l)|0}function Dqe(o,l){o=+o,l=+l;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return A=I,I=I+16|0,B=A+4|0,k=A+8|0,T=A,d=Fl(8)|0,u=d,m=Jt(16)|0,Tf(B,o),o=+Rf(B,o),Tf(k,l),dX(m,o,+Rf(k,l)),k=u+4|0,n[k>>2]=m,m=Jt(8)|0,k=n[k>>2]|0,n[T>>2]=0,n[B>>2]=n[T>>2],mX(m,k,B),n[d>>2]=m,I=A,u|0}function mX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,u=Jt(16)|0,n[u+4>>2]=0,n[u+8>>2]=0,n[u>>2]=1452,n[u+12>>2]=l,n[o+4>>2]=u}function bqe(o){o=o|0,$y(o),yt(o)}function Pqe(o){o=o|0,o=n[o+12>>2]|0,o|0&&yt(o)}function xqe(o){o=o|0,yt(o)}function kqe(){var o=0;return s[7928]|0||(yX(10488),gr(59,10488,U|0)|0,o=7928,n[o>>2]=1,n[o+4>>2]=0),Ur(10488)|0||yX(10488),10488}function yX(o){o=o|0,Rqe(o),fd(o,60)}function Qqe(o){o=o|0,Tqe(o+24|0)}function Tqe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function Rqe(o){o=o|0;var l=0;l=en()|0,tn(o,5,6,l,Lqe()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function Fqe(o){o=o|0,Nqe(o)}function Nqe(o){o=o|0,Oqe(o)}function Oqe(o){o=o|0,EX(o+8|0),s[o+24>>0]=1}function EX(o){o=o|0,n[o>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,n[o+12>>2]=0}function Lqe(){return 1492}function Mqe(){return _qe()|0}function _qe(){var o=0,l=0,u=0,A=0,d=0,m=0,B=0;return l=I,I=I+16|0,d=l+4|0,B=l,u=Fl(8)|0,o=u,A=Jt(16)|0,EX(A),m=o+4|0,n[m>>2]=A,A=Jt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],mX(A,m,d),n[u>>2]=A,I=l,o|0}function Uqe(){var o=0;return s[7936]|0||(Vqe(10524),gr(25,10524,U|0)|0,o=7936,n[o>>2]=1,n[o+4>>2]=0),10524}function Hqe(o,l){o=o|0,l=l|0,n[o>>2]=jqe()|0,n[o+4>>2]=qqe()|0,n[o+12>>2]=l,n[o+8>>2]=Gqe()|0,n[o+32>>2]=7}function jqe(){return 11700}function qqe(){return 1484}function Gqe(){return JP()|0}function Wqe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(Yqe(u),yt(u)):l|0&&yt(l)}function Yqe(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function Vqe(o){o=o|0,Uh(o)}function Kqe(o,l,u){o=o|0,l=l|0,u=u|0,o=Bn(l)|0,l=Jqe(u)|0,u=zqe(u,0)|0,DGe(o,l,u,e_()|0,0)}function Jqe(o){return o=o|0,o|0}function zqe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=e_()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(CX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(nGe(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function e_(){var o=0,l=0;if(s[7944]|0||(IX(10568),gr(61,10568,U|0)|0,l=7944,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10568)|0)){o=10568,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));IX(10568)}return 10568}function IX(o){o=o|0,$qe(o)}function Zqe(o){o=o|0,Xqe(o+24|0)}function Xqe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function $qe(o){o=o|0;var l=0;l=en()|0,tn(o,1,17,l,EZ()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function eGe(o){return o=o|0,rGe(n[(tGe(o)|0)>>2]|0)|0}function tGe(o){return o=o|0,(n[(e_()|0)+24>>2]|0)+(o<<3)|0}function rGe(o){return o=o|0,VP(ax[o&7]()|0)|0}function CX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function nGe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=iGe(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,sGe(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,CX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,oGe(o,d),aGe(d),I=k;return}}function iGe(o){return o=o|0,536870911}function sGe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function oGe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function aGe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function lGe(){cGe()}function cGe(){uGe(10604)}function uGe(o){o=o|0,fGe(o,4955)}function fGe(o,l){o=o|0,l=l|0;var u=0;u=AGe()|0,n[o>>2]=u,pGe(u,l),Wh(n[o>>2]|0)}function AGe(){var o=0;return s[7952]|0||(wGe(10612),gr(25,10612,U|0)|0,o=7952,n[o>>2]=1,n[o+4>>2]=0),10612}function pGe(o,l){o=o|0,l=l|0,n[o>>2]=mGe()|0,n[o+4>>2]=yGe()|0,n[o+12>>2]=l,n[o+8>>2]=EGe()|0,n[o+32>>2]=8}function Wh(o){o=o|0;var l=0,u=0;l=I,I=I+16|0,u=l,Ky()|0,n[u>>2]=o,hGe(10608,u),I=l}function Ky(){return s[11714]|0||(n[2652]=0,gr(62,10608,U|0)|0,s[11714]=1),10608}function hGe(o,l){o=o|0,l=l|0;var u=0;u=Jt(8)|0,n[u+4>>2]=n[l>>2],n[u>>2]=n[o>>2],n[o>>2]=u}function gGe(o){o=o|0,dGe(o)}function dGe(o){o=o|0;var l=0,u=0;if(l=n[o>>2]|0,l|0)do u=l,l=n[l>>2]|0,yt(u);while(l|0);n[o>>2]=0}function mGe(){return 11715}function yGe(){return 1496}function EGe(){return KP()|0}function IGe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(CGe(u),yt(u)):l|0&&yt(l)}function CGe(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function wGe(o){o=o|0,Uh(o)}function BGe(o,l){o=o|0,l=l|0;var u=0,A=0;Ky()|0,u=n[2652]|0;e:do if(u|0){for(;A=n[u+4>>2]|0,!(A|0&&!(r$(t_(A)|0,o)|0));)if(u=n[u>>2]|0,!u)break e;vGe(A,l)}while(!1)}function t_(o){return o=o|0,n[o+12>>2]|0}function vGe(o,l){o=o|0,l=l|0;var u=0;o=o+36|0,u=n[o>>2]|0,u|0&&(Df(u),yt(u)),u=Jt(4)|0,UP(u,l),n[o>>2]=u}function r_(){return s[11716]|0||(n[2664]=0,gr(63,10656,U|0)|0,s[11716]=1),10656}function wX(){var o=0;return s[11717]|0?o=n[2665]|0:(SGe(),n[2665]=1504,s[11717]=1,o=1504),o|0}function SGe(){s[11740]|0||(s[11718]=yr(yr(8,0)|0,0)|0,s[11719]=yr(yr(0,0)|0,0)|0,s[11720]=yr(yr(0,16)|0,0)|0,s[11721]=yr(yr(8,0)|0,0)|0,s[11722]=yr(yr(0,0)|0,0)|0,s[11723]=yr(yr(8,0)|0,0)|0,s[11724]=yr(yr(0,0)|0,0)|0,s[11725]=yr(yr(8,0)|0,0)|0,s[11726]=yr(yr(0,0)|0,0)|0,s[11727]=yr(yr(8,0)|0,0)|0,s[11728]=yr(yr(0,0)|0,0)|0,s[11729]=yr(yr(0,0)|0,32)|0,s[11730]=yr(yr(0,0)|0,32)|0,s[11740]=1)}function BX(){return 1572}function DGe(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0,_=0,M=0;m=I,I=I+32|0,M=m+16|0,_=m+12|0,T=m+8|0,k=m+4|0,B=m,n[M>>2]=o,n[_>>2]=l,n[T>>2]=u,n[k>>2]=A,n[B>>2]=d,r_()|0,bGe(10656,M,_,T,k,B),I=m}function bGe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0;var B=0;B=Jt(24)|0,Xz(B+4|0,n[l>>2]|0,n[u>>2]|0,n[A>>2]|0,n[d>>2]|0,n[m>>2]|0),n[B>>2]=n[o>>2],n[o>>2]=B}function vX(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0,tt=0,Ze=0,ct=0;if(ct=I,I=I+32|0,Le=ct+20|0,Qe=ct+8|0,tt=ct+4|0,Ze=ct,l=n[l>>2]|0,l|0){We=Le+4|0,T=Le+8|0,_=Qe+4|0,M=Qe+8|0,G=Qe+8|0,ae=Le+8|0;do{if(B=l+4|0,k=n_(B)|0,k|0){if(d=Q2(k)|0,n[Le>>2]=0,n[We>>2]=0,n[T>>2]=0,A=(T2(k)|0)+1|0,PGe(Le,A),A|0)for(;A=A+-1|0,xu(Qe,n[d>>2]|0),m=n[We>>2]|0,m>>>0<(n[ae>>2]|0)>>>0?(n[m>>2]=n[Qe>>2],n[We>>2]=(n[We>>2]|0)+4):i_(Le,Qe),A;)d=d+4|0;A=R2(k)|0,n[Qe>>2]=0,n[_>>2]=0,n[M>>2]=0;e:do if(n[A>>2]|0)for(d=0,m=0;;){if((d|0)==(m|0)?xGe(Qe,A):(n[d>>2]=n[A>>2],n[_>>2]=(n[_>>2]|0)+4),A=A+4|0,!(n[A>>2]|0))break e;d=n[_>>2]|0,m=n[G>>2]|0}while(!1);n[tt>>2]=zP(B)|0,n[Ze>>2]=Ur(k)|0,kGe(u,o,tt,Ze,Le,Qe),s_(Qe),sp(Le)}l=n[l>>2]|0}while(l|0)}I=ct}function n_(o){return o=o|0,n[o+12>>2]|0}function Q2(o){return o=o|0,n[o+12>>2]|0}function T2(o){return o=o|0,n[o+16>>2]|0}function PGe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;d=I,I=I+32|0,u=d,A=n[o>>2]|0,(n[o+8>>2]|0)-A>>2>>>0>>0&&(TX(u,l,(n[o+4>>2]|0)-A>>2,o+8|0),RX(o,u),FX(u)),I=d}function i_(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0;if(B=I,I=I+32|0,u=B,A=o+4|0,d=((n[A>>2]|0)-(n[o>>2]|0)>>2)+1|0,m=QX(o)|0,m>>>0>>0)sn(o);else{k=n[o>>2]|0,_=(n[o+8>>2]|0)-k|0,T=_>>1,TX(u,_>>2>>>0>>1>>>0?T>>>0>>0?d:T:m,(n[A>>2]|0)-k>>2,o+8|0),m=u+8|0,n[n[m>>2]>>2]=n[l>>2],n[m>>2]=(n[m>>2]|0)+4,RX(o,u),FX(u),I=B;return}}function R2(o){return o=o|0,n[o+8>>2]|0}function xGe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0;if(B=I,I=I+32|0,u=B,A=o+4|0,d=((n[A>>2]|0)-(n[o>>2]|0)>>2)+1|0,m=kX(o)|0,m>>>0>>0)sn(o);else{k=n[o>>2]|0,_=(n[o+8>>2]|0)-k|0,T=_>>1,JGe(u,_>>2>>>0>>1>>>0?T>>>0>>0?d:T:m,(n[A>>2]|0)-k>>2,o+8|0),m=u+8|0,n[n[m>>2]>>2]=n[l>>2],n[m>>2]=(n[m>>2]|0)+4,zGe(o,u),ZGe(u),I=B;return}}function zP(o){return o=o|0,n[o>>2]|0}function kGe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,QGe(o,l,u,A,d,m)}function s_(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-4-A|0)>>>2)<<2)),yt(u))}function sp(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-4-A|0)>>>2)<<2)),yt(u))}function QGe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0;var B=0,k=0,T=0,_=0,M=0,G=0;B=I,I=I+48|0,M=B+40|0,k=B+32|0,G=B+24|0,T=B+12|0,_=B,Nl(k),o=Ls(o)|0,n[G>>2]=n[l>>2],u=n[u>>2]|0,A=n[A>>2]|0,o_(T,d),TGe(_,m),n[M>>2]=n[G>>2],RGe(o,M,u,A,T,_),s_(_),sp(T),Ol(k),I=B}function o_(o,l){o=o|0,l=l|0;var u=0,A=0;n[o>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,u=l+4|0,A=(n[u>>2]|0)-(n[l>>2]|0)>>2,A|0&&(VGe(o,A),KGe(o,n[l>>2]|0,n[u>>2]|0,A))}function TGe(o,l){o=o|0,l=l|0;var u=0,A=0;n[o>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,u=l+4|0,A=(n[u>>2]|0)-(n[l>>2]|0)>>2,A|0&&(WGe(o,A),YGe(o,n[l>>2]|0,n[u>>2]|0,A))}function RGe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0;var B=0,k=0,T=0,_=0,M=0,G=0;B=I,I=I+32|0,M=B+28|0,G=B+24|0,k=B+12|0,T=B,_=ma(FGe()|0)|0,n[G>>2]=n[l>>2],n[M>>2]=n[G>>2],l=Ad(M)|0,u=SX(u)|0,A=a_(A)|0,n[k>>2]=n[d>>2],M=d+4|0,n[k+4>>2]=n[M>>2],G=d+8|0,n[k+8>>2]=n[G>>2],n[G>>2]=0,n[M>>2]=0,n[d>>2]=0,d=l_(k)|0,n[T>>2]=n[m>>2],M=m+4|0,n[T+4>>2]=n[M>>2],G=m+8|0,n[T+8>>2]=n[G>>2],n[G>>2]=0,n[M>>2]=0,n[m>>2]=0,uu(0,_|0,o|0,l|0,u|0,A|0,d|0,NGe(T)|0)|0,s_(T),sp(k),I=B}function FGe(){var o=0;return s[7968]|0||(qGe(10708),o=7968,n[o>>2]=1,n[o+4>>2]=0),10708}function Ad(o){return o=o|0,bX(o)|0}function SX(o){return o=o|0,DX(o)|0}function a_(o){return o=o|0,VP(o)|0}function l_(o){return o=o|0,LGe(o)|0}function NGe(o){return o=o|0,OGe(o)|0}function OGe(o){o=o|0;var l=0,u=0,A=0;if(A=(n[o+4>>2]|0)-(n[o>>2]|0)|0,u=A>>2,A=Fl(A+4|0)|0,n[A>>2]=u,u|0){l=0;do n[A+4+(l<<2)>>2]=DX(n[(n[o>>2]|0)+(l<<2)>>2]|0)|0,l=l+1|0;while((l|0)!=(u|0))}return A|0}function DX(o){return o=o|0,o|0}function LGe(o){o=o|0;var l=0,u=0,A=0;if(A=(n[o+4>>2]|0)-(n[o>>2]|0)|0,u=A>>2,A=Fl(A+4|0)|0,n[A>>2]=u,u|0){l=0;do n[A+4+(l<<2)>>2]=bX((n[o>>2]|0)+(l<<2)|0)|0,l=l+1|0;while((l|0)!=(u|0))}return A|0}function bX(o){o=o|0;var l=0,u=0,A=0,d=0;return d=I,I=I+32|0,l=d+12|0,u=d,A=IM(PX()|0)|0,A?(CM(l,A),wM(u,l),EYe(o,u),o=BM(l)|0):o=MGe(o)|0,I=d,o|0}function PX(){var o=0;return s[7960]|0||(jGe(10664),gr(25,10664,U|0)|0,o=7960,n[o>>2]=1,n[o+4>>2]=0),10664}function MGe(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0;return u=I,I=I+16|0,d=u+4|0,B=u,A=Fl(8)|0,l=A,k=Jt(4)|0,n[k>>2]=n[o>>2],m=l+4|0,n[m>>2]=k,o=Jt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],xX(o,m,d),n[A>>2]=o,I=u,l|0}function xX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,u=Jt(16)|0,n[u+4>>2]=0,n[u+8>>2]=0,n[u>>2]=1656,n[u+12>>2]=l,n[o+4>>2]=u}function _Ge(o){o=o|0,$y(o),yt(o)}function UGe(o){o=o|0,o=n[o+12>>2]|0,o|0&&yt(o)}function HGe(o){o=o|0,yt(o)}function jGe(o){o=o|0,Uh(o)}function qGe(o){o=o|0,Ro(o,GGe()|0,5)}function GGe(){return 1676}function WGe(o,l){o=o|0,l=l|0;var u=0;if((kX(o)|0)>>>0>>0&&sn(o),l>>>0>1073741823)Nt();else{u=Jt(l<<2)|0,n[o+4>>2]=u,n[o>>2]=u,n[o+8>>2]=u+(l<<2);return}}function YGe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,A=o+4|0,o=u-l|0,(o|0)>0&&(Qr(n[A>>2]|0,l|0,o|0)|0,n[A>>2]=(n[A>>2]|0)+(o>>>2<<2))}function kX(o){return o=o|0,1073741823}function VGe(o,l){o=o|0,l=l|0;var u=0;if((QX(o)|0)>>>0>>0&&sn(o),l>>>0>1073741823)Nt();else{u=Jt(l<<2)|0,n[o+4>>2]=u,n[o>>2]=u,n[o+8>>2]=u+(l<<2);return}}function KGe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,A=o+4|0,o=u-l|0,(o|0)>0&&(Qr(n[A>>2]|0,l|0,o|0)|0,n[A>>2]=(n[A>>2]|0)+(o>>>2<<2))}function QX(o){return o=o|0,1073741823}function JGe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>1073741823)Nt();else{d=Jt(l<<2)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<2)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<2)}function zGe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function ZGe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-4-l|0)>>>2)<<2)),o=n[o>>2]|0,o|0&&yt(o)}function TX(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>1073741823)Nt();else{d=Jt(l<<2)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<2)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<2)}function RX(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function FX(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-4-l|0)>>>2)<<2)),o=n[o>>2]|0,o|0&&yt(o)}function XGe(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0;if(Qe=I,I=I+32|0,M=Qe+20|0,G=Qe+12|0,_=Qe+16|0,ae=Qe+4|0,We=Qe,Le=Qe+8|0,k=wX()|0,m=n[k>>2]|0,B=n[m>>2]|0,B|0)for(T=n[k+8>>2]|0,k=n[k+4>>2]|0;xu(M,B),$Ge(o,M,k,T),m=m+4|0,B=n[m>>2]|0,B;)T=T+1|0,k=k+1|0;if(m=BX()|0,B=n[m>>2]|0,B|0)do xu(M,B),n[G>>2]=n[m+4>>2],e5e(l,M,G),m=m+8|0,B=n[m>>2]|0;while(B|0);if(m=n[(Ky()|0)>>2]|0,m|0)do l=n[m+4>>2]|0,xu(M,n[(Jy(l)|0)>>2]|0),n[G>>2]=t_(l)|0,t5e(u,M,G),m=n[m>>2]|0;while(m|0);if(xu(_,0),m=r_()|0,n[M>>2]=n[_>>2],vX(M,m,d),m=n[(Ky()|0)>>2]|0,m|0){o=M+4|0,l=M+8|0,u=M+8|0;do{if(T=n[m+4>>2]|0,xu(G,n[(Jy(T)|0)>>2]|0),r5e(ae,NX(T)|0),B=n[ae>>2]|0,B|0){n[M>>2]=0,n[o>>2]=0,n[l>>2]=0;do xu(We,n[(Jy(n[B+4>>2]|0)|0)>>2]|0),k=n[o>>2]|0,k>>>0<(n[u>>2]|0)>>>0?(n[k>>2]=n[We>>2],n[o>>2]=(n[o>>2]|0)+4):i_(M,We),B=n[B>>2]|0;while(B|0);n5e(A,G,M),sp(M)}n[Le>>2]=n[G>>2],_=OX(T)|0,n[M>>2]=n[Le>>2],vX(M,_,d),iZ(ae),m=n[m>>2]|0}while(m|0)}I=Qe}function $Ge(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,g5e(o,l,u,A)}function e5e(o,l,u){o=o|0,l=l|0,u=u|0,h5e(o,l,u)}function Jy(o){return o=o|0,o|0}function t5e(o,l,u){o=o|0,l=l|0,u=u|0,u5e(o,l,u)}function NX(o){return o=o|0,o+16|0}function r5e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;if(m=I,I=I+16|0,d=m+8|0,u=m,n[o>>2]=0,A=n[l>>2]|0,n[d>>2]=A,n[u>>2]=o,u=c5e(u)|0,A|0){if(A=Jt(12)|0,B=(LX(d)|0)+4|0,o=n[B+4>>2]|0,l=A+4|0,n[l>>2]=n[B>>2],n[l+4>>2]=o,l=n[n[d>>2]>>2]|0,n[d>>2]=l,!l)o=A;else for(l=A;o=Jt(12)|0,T=(LX(d)|0)+4|0,k=n[T+4>>2]|0,B=o+4|0,n[B>>2]=n[T>>2],n[B+4>>2]=k,n[l>>2]=o,B=n[n[d>>2]>>2]|0,n[d>>2]=B,B;)l=o;n[o>>2]=n[u>>2],n[u>>2]=A}I=m}function n5e(o,l,u){o=o|0,l=l|0,u=u|0,i5e(o,l,u)}function OX(o){return o=o|0,o+24|0}function i5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+32|0,B=A+24|0,d=A+16|0,k=A+12|0,m=A,Nl(d),o=Ls(o)|0,n[k>>2]=n[l>>2],o_(m,u),n[B>>2]=n[k>>2],s5e(o,B,m),sp(m),Ol(d),I=A}function s5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=I,I=I+32|0,B=A+16|0,k=A+12|0,d=A,m=ma(o5e()|0)|0,n[k>>2]=n[l>>2],n[B>>2]=n[k>>2],l=Ad(B)|0,n[d>>2]=n[u>>2],B=u+4|0,n[d+4>>2]=n[B>>2],k=u+8|0,n[d+8>>2]=n[k>>2],n[k>>2]=0,n[B>>2]=0,n[u>>2]=0,Rs(0,m|0,o|0,l|0,l_(d)|0)|0,sp(d),I=A}function o5e(){var o=0;return s[7976]|0||(a5e(10720),o=7976,n[o>>2]=1,n[o+4>>2]=0),10720}function a5e(o){o=o|0,Ro(o,l5e()|0,2)}function l5e(){return 1732}function c5e(o){return o=o|0,n[o>>2]|0}function LX(o){return o=o|0,n[o>>2]|0}function u5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+32|0,m=A+16|0,d=A+8|0,B=A,Nl(d),o=Ls(o)|0,n[B>>2]=n[l>>2],u=n[u>>2]|0,n[m>>2]=n[B>>2],MX(o,m,u),Ol(d),I=A}function MX(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+16|0,m=A+4|0,B=A,d=ma(f5e()|0)|0,n[B>>2]=n[l>>2],n[m>>2]=n[B>>2],l=Ad(m)|0,Rs(0,d|0,o|0,l|0,SX(u)|0)|0,I=A}function f5e(){var o=0;return s[7984]|0||(A5e(10732),o=7984,n[o>>2]=1,n[o+4>>2]=0),10732}function A5e(o){o=o|0,Ro(o,p5e()|0,2)}function p5e(){return 1744}function h5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;A=I,I=I+32|0,m=A+16|0,d=A+8|0,B=A,Nl(d),o=Ls(o)|0,n[B>>2]=n[l>>2],u=n[u>>2]|0,n[m>>2]=n[B>>2],MX(o,m,u),Ol(d),I=A}function g5e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;d=I,I=I+32|0,B=d+16|0,m=d+8|0,k=d,Nl(m),o=Ls(o)|0,n[k>>2]=n[l>>2],u=s[u>>0]|0,A=s[A>>0]|0,n[B>>2]=n[k>>2],d5e(o,B,u,A),Ol(m),I=d}function d5e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;d=I,I=I+16|0,B=d+4|0,k=d,m=ma(m5e()|0)|0,n[k>>2]=n[l>>2],n[B>>2]=n[k>>2],l=Ad(B)|0,u=zy(u)|0,Oi(0,m|0,o|0,l|0,u|0,zy(A)|0)|0,I=d}function m5e(){var o=0;return s[7992]|0||(E5e(10744),o=7992,n[o>>2]=1,n[o+4>>2]=0),10744}function zy(o){return o=o|0,y5e(o)|0}function y5e(o){return o=o|0,o&255|0}function E5e(o){o=o|0,Ro(o,I5e()|0,3)}function I5e(){return 1756}function C5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;switch(ae=I,I=I+32|0,k=ae+8|0,T=ae+4|0,_=ae+20|0,M=ae,bM(o,0),A=yYe(l)|0,n[k>>2]=0,G=k+4|0,n[G>>2]=0,n[k+8>>2]=0,A<<24>>24){case 0:{s[_>>0]=0,w5e(T,u,_),ZP(o,T)|0,bf(T);break}case 8:{G=h_(l)|0,s[_>>0]=8,xu(M,n[G+4>>2]|0),B5e(T,u,_,M,G+8|0),ZP(o,T)|0,bf(T);break}case 9:{if(m=h_(l)|0,l=n[m+4>>2]|0,l|0)for(B=k+8|0,d=m+12|0;l=l+-1|0,xu(T,n[d>>2]|0),A=n[G>>2]|0,A>>>0<(n[B>>2]|0)>>>0?(n[A>>2]=n[T>>2],n[G>>2]=(n[G>>2]|0)+4):i_(k,T),l;)d=d+4|0;s[_>>0]=9,xu(M,n[m+8>>2]|0),v5e(T,u,_,M,k),ZP(o,T)|0,bf(T);break}default:G=h_(l)|0,s[_>>0]=A,xu(M,n[G+4>>2]|0),S5e(T,u,_,M),ZP(o,T)|0,bf(T)}sp(k),I=ae}function w5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;A=I,I=I+16|0,d=A,Nl(d),l=Ls(l)|0,M5e(o,l,s[u>>0]|0),Ol(d),I=A}function ZP(o,l){o=o|0,l=l|0;var u=0;return u=n[o>>2]|0,u|0&&Oa(u|0),n[o>>2]=n[l>>2],n[l>>2]=0,o|0}function B5e(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0;m=I,I=I+32|0,k=m+16|0,B=m+8|0,T=m,Nl(B),l=Ls(l)|0,u=s[u>>0]|0,n[T>>2]=n[A>>2],d=n[d>>2]|0,n[k>>2]=n[T>>2],F5e(o,l,u,k,d),Ol(B),I=m}function v5e(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0,_=0;m=I,I=I+32|0,T=m+24|0,B=m+16|0,_=m+12|0,k=m,Nl(B),l=Ls(l)|0,u=s[u>>0]|0,n[_>>2]=n[A>>2],o_(k,d),n[T>>2]=n[_>>2],k5e(o,l,u,T,k),sp(k),Ol(B),I=m}function S5e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;d=I,I=I+32|0,B=d+16|0,m=d+8|0,k=d,Nl(m),l=Ls(l)|0,u=s[u>>0]|0,n[k>>2]=n[A>>2],n[B>>2]=n[k>>2],D5e(o,l,u,B),Ol(m),I=d}function D5e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0,B=0,k=0;d=I,I=I+16|0,m=d+4|0,k=d,B=ma(b5e()|0)|0,u=zy(u)|0,n[k>>2]=n[A>>2],n[m>>2]=n[k>>2],XP(o,Rs(0,B|0,l|0,u|0,Ad(m)|0)|0),I=d}function b5e(){var o=0;return s[8e3]|0||(P5e(10756),o=8e3,n[o>>2]=1,n[o+4>>2]=0),10756}function XP(o,l){o=o|0,l=l|0,bM(o,l)}function P5e(o){o=o|0,Ro(o,x5e()|0,2)}function x5e(){return 1772}function k5e(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0,_=0;m=I,I=I+32|0,T=m+16|0,_=m+12|0,B=m,k=ma(Q5e()|0)|0,u=zy(u)|0,n[_>>2]=n[A>>2],n[T>>2]=n[_>>2],A=Ad(T)|0,n[B>>2]=n[d>>2],T=d+4|0,n[B+4>>2]=n[T>>2],_=d+8|0,n[B+8>>2]=n[_>>2],n[_>>2]=0,n[T>>2]=0,n[d>>2]=0,XP(o,Oi(0,k|0,l|0,u|0,A|0,l_(B)|0)|0),sp(B),I=m}function Q5e(){var o=0;return s[8008]|0||(T5e(10768),o=8008,n[o>>2]=1,n[o+4>>2]=0),10768}function T5e(o){o=o|0,Ro(o,R5e()|0,3)}function R5e(){return 1784}function F5e(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0;m=I,I=I+16|0,k=m+4|0,T=m,B=ma(N5e()|0)|0,u=zy(u)|0,n[T>>2]=n[A>>2],n[k>>2]=n[T>>2],A=Ad(k)|0,XP(o,Oi(0,B|0,l|0,u|0,A|0,a_(d)|0)|0),I=m}function N5e(){var o=0;return s[8016]|0||(O5e(10780),o=8016,n[o>>2]=1,n[o+4>>2]=0),10780}function O5e(o){o=o|0,Ro(o,L5e()|0,3)}function L5e(){return 1800}function M5e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;A=ma(_5e()|0)|0,XP(o,dn(0,A|0,l|0,zy(u)|0)|0)}function _5e(){var o=0;return s[8024]|0||(U5e(10792),o=8024,n[o>>2]=1,n[o+4>>2]=0),10792}function U5e(o){o=o|0,Ro(o,H5e()|0,1)}function H5e(){return 1816}function j5e(){q5e(),G5e(),W5e()}function q5e(){n[2702]=A$(65536)|0}function G5e(){f9e(10856)}function W5e(){Y5e(10816)}function Y5e(o){o=o|0,V5e(o,5044),K5e(o)|0}function V5e(o,l){o=o|0,l=l|0;var u=0;u=PX()|0,n[o>>2]=u,s9e(u,l),Wh(n[o>>2]|0)}function K5e(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,J5e()|0),o|0}function J5e(){var o=0;return s[8032]|0||(_X(10820),gr(64,10820,U|0)|0,o=8032,n[o>>2]=1,n[o+4>>2]=0),Ur(10820)|0||_X(10820),10820}function _X(o){o=o|0,X5e(o),fd(o,25)}function z5e(o){o=o|0,Z5e(o+24|0)}function Z5e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function X5e(o){o=o|0;var l=0;l=en()|0,tn(o,5,18,l,r9e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function $5e(o,l){o=o|0,l=l|0,e9e(o,l)}function e9e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;u=I,I=I+16|0,A=u,d=u+4|0,ld(d,l),n[A>>2]=cd(d,l)|0,t9e(o,A),I=u}function t9e(o,l){o=o|0,l=l|0,UX(o+4|0,n[l>>2]|0),s[o+8>>0]=1}function UX(o,l){o=o|0,l=l|0,n[o>>2]=l}function r9e(){return 1824}function n9e(o){return o=o|0,i9e(o)|0}function i9e(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0;return u=I,I=I+16|0,d=u+4|0,B=u,A=Fl(8)|0,l=A,k=Jt(4)|0,ld(d,o),UX(k,cd(d,o)|0),m=l+4|0,n[m>>2]=k,o=Jt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],xX(o,m,d),n[A>>2]=o,I=u,l|0}function Fl(o){o=o|0;var l=0,u=0;return o=o+7&-8,o>>>0<=32768&&(l=n[2701]|0,o>>>0<=(65536-l|0)>>>0)?(u=(n[2702]|0)+l|0,n[2701]=l+o,o=u):(o=A$(o+8|0)|0,n[o>>2]=n[2703],n[2703]=o,o=o+8|0),o|0}function s9e(o,l){o=o|0,l=l|0,n[o>>2]=o9e()|0,n[o+4>>2]=a9e()|0,n[o+12>>2]=l,n[o+8>>2]=l9e()|0,n[o+32>>2]=9}function o9e(){return 11744}function a9e(){return 1832}function l9e(){return JP()|0}function c9e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(u9e(u),yt(u)):l|0&&yt(l)}function u9e(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function f9e(o){o=o|0,A9e(o,5052),p9e(o)|0,h9e(o,5058,26)|0,g9e(o,5069,1)|0,d9e(o,5077,10)|0,m9e(o,5087,19)|0,y9e(o,5094,27)|0}function A9e(o,l){o=o|0,l=l|0;var u=0;u=uYe()|0,n[o>>2]=u,fYe(u,l),Wh(n[o>>2]|0)}function p9e(o){o=o|0;var l=0;return l=n[o>>2]|0,ud(l,zWe()|0),o|0}function h9e(o,l,u){return o=o|0,l=l|0,u=u|0,TWe(o,Bn(l)|0,u,0),o|0}function g9e(o,l,u){return o=o|0,l=l|0,u=u|0,mWe(o,Bn(l)|0,u,0),o|0}function d9e(o,l,u){return o=o|0,l=l|0,u=u|0,J9e(o,Bn(l)|0,u,0),o|0}function m9e(o,l,u){return o=o|0,l=l|0,u=u|0,F9e(o,Bn(l)|0,u,0),o|0}function HX(o,l){o=o|0,l=l|0;var u=0,A=0;e:for(;;){for(u=n[2703]|0;;){if((u|0)==(l|0))break e;if(A=n[u>>2]|0,n[2703]=A,!u)u=A;else break}yt(u)}n[2701]=o}function y9e(o,l,u){return o=o|0,l=l|0,u=u|0,E9e(o,Bn(l)|0,u,0),o|0}function E9e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=c_()|0,o=I9e(u)|0,vn(m,l,d,o,C9e(u,A)|0,A)}function c_(){var o=0,l=0;if(s[8040]|0||(qX(10860),gr(65,10860,U|0)|0,l=8040,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10860)|0)){o=10860,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));qX(10860)}return 10860}function I9e(o){return o=o|0,o|0}function C9e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=c_()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(jX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(w9e(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function jX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function w9e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=B9e(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,v9e(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,jX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,S9e(o,d),D9e(d),I=k;return}}function B9e(o){return o=o|0,536870911}function v9e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function S9e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function D9e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function qX(o){o=o|0,x9e(o)}function b9e(o){o=o|0,P9e(o+24|0)}function P9e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function x9e(o){o=o|0;var l=0;l=en()|0,tn(o,1,11,l,k9e()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function k9e(){return 1840}function Q9e(o,l,u){o=o|0,l=l|0,u=u|0,R9e(n[(T9e(o)|0)>>2]|0,l,u)}function T9e(o){return o=o|0,(n[(c_()|0)+24>>2]|0)+(o<<3)|0}function R9e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;A=I,I=I+16|0,m=A+1|0,d=A,ld(m,l),l=cd(m,l)|0,ld(d,u),u=cd(d,u)|0,ap[o&31](l,u),I=A}function F9e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=u_()|0,o=N9e(u)|0,vn(m,l,d,o,O9e(u,A)|0,A)}function u_(){var o=0,l=0;if(s[8048]|0||(WX(10896),gr(66,10896,U|0)|0,l=8048,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10896)|0)){o=10896,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));WX(10896)}return 10896}function N9e(o){return o=o|0,o|0}function O9e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=u_()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(GX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(L9e(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function GX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function L9e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=M9e(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,_9e(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,GX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,U9e(o,d),H9e(d),I=k;return}}function M9e(o){return o=o|0,536870911}function _9e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function U9e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function H9e(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function WX(o){o=o|0,G9e(o)}function j9e(o){o=o|0,q9e(o+24|0)}function q9e(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function G9e(o){o=o|0;var l=0;l=en()|0,tn(o,1,11,l,W9e()|0,1),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function W9e(){return 1852}function Y9e(o,l){return o=o|0,l=l|0,K9e(n[(V9e(o)|0)>>2]|0,l)|0}function V9e(o){return o=o|0,(n[(u_()|0)+24>>2]|0)+(o<<3)|0}function K9e(o,l){o=o|0,l=l|0;var u=0,A=0;return u=I,I=I+16|0,A=u,ld(A,l),l=cd(A,l)|0,l=VP(dd[o&31](l)|0)|0,I=u,l|0}function J9e(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=f_()|0,o=z9e(u)|0,vn(m,l,d,o,Z9e(u,A)|0,A)}function f_(){var o=0,l=0;if(s[8056]|0||(VX(10932),gr(67,10932,U|0)|0,l=8056,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10932)|0)){o=10932,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));VX(10932)}return 10932}function z9e(o){return o=o|0,o|0}function Z9e(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=f_()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(YX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(X9e(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function YX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function X9e(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=$9e(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,eWe(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,YX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,tWe(o,d),rWe(d),I=k;return}}function $9e(o){return o=o|0,536870911}function eWe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function tWe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function rWe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function VX(o){o=o|0,sWe(o)}function nWe(o){o=o|0,iWe(o+24|0)}function iWe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function sWe(o){o=o|0;var l=0;l=en()|0,tn(o,1,7,l,oWe()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function oWe(){return 1860}function aWe(o,l,u){return o=o|0,l=l|0,u=u|0,cWe(n[(lWe(o)|0)>>2]|0,l,u)|0}function lWe(o){return o=o|0,(n[(f_()|0)+24>>2]|0)+(o<<3)|0}function cWe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0;return A=I,I=I+32|0,B=A+12|0,m=A+8|0,k=A,T=A+16|0,d=A+4|0,uWe(T,l),fWe(k,T,l),Hh(d,u),u=jh(d,u)|0,n[B>>2]=n[k>>2],L2[o&15](m,B,u),u=AWe(m)|0,bf(m),qh(d),I=A,u|0}function uWe(o,l){o=o|0,l=l|0}function fWe(o,l,u){o=o|0,l=l|0,u=u|0,pWe(o,u)}function AWe(o){return o=o|0,Ls(o)|0}function pWe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0;d=I,I=I+16|0,u=d,A=l,A&1?(hWe(u,0),Me(A|0,u|0)|0,gWe(o,u),dWe(u)):n[o>>2]=n[l>>2],I=d}function hWe(o,l){o=o|0,l=l|0,bu(o,l),n[o+4>>2]=0,s[o+8>>0]=0}function gWe(o,l){o=o|0,l=l|0,n[o>>2]=n[l+4>>2]}function dWe(o){o=o|0,s[o+8>>0]=0}function mWe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=A_()|0,o=yWe(u)|0,vn(m,l,d,o,EWe(u,A)|0,A)}function A_(){var o=0,l=0;if(s[8064]|0||(JX(10968),gr(68,10968,U|0)|0,l=8064,n[l>>2]=1,n[l+4>>2]=0),!(Ur(10968)|0)){o=10968,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));JX(10968)}return 10968}function yWe(o){return o=o|0,o|0}function EWe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=A_()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(KX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(IWe(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function KX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function IWe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=CWe(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,wWe(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,KX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,BWe(o,d),vWe(d),I=k;return}}function CWe(o){return o=o|0,536870911}function wWe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function BWe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function vWe(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function JX(o){o=o|0,bWe(o)}function SWe(o){o=o|0,DWe(o+24|0)}function DWe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function bWe(o){o=o|0;var l=0;l=en()|0,tn(o,1,1,l,PWe()|0,5),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function PWe(){return 1872}function xWe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,QWe(n[(kWe(o)|0)>>2]|0,l,u,A,d,m)}function kWe(o){return o=o|0,(n[(A_()|0)+24>>2]|0)+(o<<3)|0}function QWe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0;var B=0,k=0,T=0,_=0,M=0,G=0;B=I,I=I+32|0,k=B+16|0,T=B+12|0,_=B+8|0,M=B+4|0,G=B,Hh(k,l),l=jh(k,l)|0,Hh(T,u),u=jh(T,u)|0,Hh(_,A),A=jh(_,A)|0,Hh(M,d),d=jh(M,d)|0,Hh(G,m),m=jh(G,m)|0,m$[o&1](l,u,A,d,m),qh(G),qh(M),qh(_),qh(T),qh(k),I=B}function TWe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;m=n[o>>2]|0,d=p_()|0,o=RWe(u)|0,vn(m,l,d,o,FWe(u,A)|0,A)}function p_(){var o=0,l=0;if(s[8072]|0||(ZX(11004),gr(69,11004,U|0)|0,l=8072,n[l>>2]=1,n[l+4>>2]=0),!(Ur(11004)|0)){o=11004,l=o+36|0;do n[o>>2]=0,o=o+4|0;while((o|0)<(l|0));ZX(11004)}return 11004}function RWe(o){return o=o|0,o|0}function FWe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0,k=0,T=0;return k=I,I=I+16|0,d=k,m=k+4|0,n[d>>2]=o,T=p_()|0,B=T+24|0,l=yr(l,4)|0,n[m>>2]=l,u=T+28|0,A=n[u>>2]|0,A>>>0<(n[T+32>>2]|0)>>>0?(zX(A,o,l),l=(n[u>>2]|0)+8|0,n[u>>2]=l):(NWe(B,d,m),l=n[u>>2]|0),I=k,(l-(n[B>>2]|0)>>3)+-1|0}function zX(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,n[o+4>>2]=u}function NWe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0;if(k=I,I=I+32|0,d=k,m=o+4|0,B=((n[m>>2]|0)-(n[o>>2]|0)>>3)+1|0,A=OWe(o)|0,A>>>0>>0)sn(o);else{T=n[o>>2]|0,M=(n[o+8>>2]|0)-T|0,_=M>>2,LWe(d,M>>3>>>0>>1>>>0?_>>>0>>0?B:_:A,(n[m>>2]|0)-T>>3,o+8|0),B=d+8|0,zX(n[B>>2]|0,n[l>>2]|0,n[u>>2]|0),n[B>>2]=(n[B>>2]|0)+8,MWe(o,d),_We(d),I=k;return}}function OWe(o){return o=o|0,536870911}function LWe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0;n[o+12>>2]=0,n[o+16>>2]=A;do if(l)if(l>>>0>536870911)Nt();else{d=Jt(l<<3)|0;break}else d=0;while(!1);n[o>>2]=d,A=d+(u<<3)|0,n[o+8>>2]=A,n[o+4>>2]=A,n[o+12>>2]=d+(l<<3)}function MWe(o,l){o=o|0,l=l|0;var u=0,A=0,d=0,m=0,B=0;A=n[o>>2]|0,B=o+4|0,m=l+4|0,d=(n[B>>2]|0)-A|0,u=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=u,(d|0)>0?(Qr(u|0,A|0,d|0)|0,A=m,u=n[m>>2]|0):A=m,m=n[o>>2]|0,n[o>>2]=u,n[A>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=o+8|0,B=l+12|0,o=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=o,n[l>>2]=n[A>>2]}function _We(o){o=o|0;var l=0,u=0,A=0;l=n[o+4>>2]|0,u=o+8|0,A=n[u>>2]|0,(A|0)!=(l|0)&&(n[u>>2]=A+(~((A+-8-l|0)>>>3)<<3)),o=n[o>>2]|0,o|0&&yt(o)}function ZX(o){o=o|0,jWe(o)}function UWe(o){o=o|0,HWe(o+24|0)}function HWe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function jWe(o){o=o|0;var l=0;l=en()|0,tn(o,1,12,l,qWe()|0,2),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function qWe(){return 1896}function GWe(o,l,u){o=o|0,l=l|0,u=u|0,YWe(n[(WWe(o)|0)>>2]|0,l,u)}function WWe(o){return o=o|0,(n[(p_()|0)+24>>2]|0)+(o<<3)|0}function YWe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;A=I,I=I+16|0,m=A+4|0,d=A,VWe(m,l),l=KWe(m,l)|0,Hh(d,u),u=jh(d,u)|0,ap[o&31](l,u),qh(d),I=A}function VWe(o,l){o=o|0,l=l|0}function KWe(o,l){return o=o|0,l=l|0,JWe(l)|0}function JWe(o){return o=o|0,o|0}function zWe(){var o=0;return s[8080]|0||(XX(11040),gr(70,11040,U|0)|0,o=8080,n[o>>2]=1,n[o+4>>2]=0),Ur(11040)|0||XX(11040),11040}function XX(o){o=o|0,$We(o),fd(o,71)}function ZWe(o){o=o|0,XWe(o+24|0)}function XWe(o){o=o|0;var l=0,u=0,A=0;u=n[o>>2]|0,A=u,u|0&&(o=o+4|0,l=n[o>>2]|0,(l|0)!=(u|0)&&(n[o>>2]=l+(~((l+-8-A|0)>>>3)<<3)),yt(u))}function $We(o){o=o|0;var l=0;l=en()|0,tn(o,5,7,l,nYe()|0,0),n[o+24>>2]=0,n[o+28>>2]=0,n[o+32>>2]=0}function eYe(o){o=o|0,tYe(o)}function tYe(o){o=o|0,rYe(o)}function rYe(o){o=o|0,s[o+8>>0]=1}function nYe(){return 1936}function iYe(){return sYe()|0}function sYe(){var o=0,l=0,u=0,A=0,d=0,m=0,B=0;return l=I,I=I+16|0,d=l+4|0,B=l,u=Fl(8)|0,o=u,m=o+4|0,n[m>>2]=Jt(1)|0,A=Jt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],oYe(A,m,d),n[u>>2]=A,I=l,o|0}function oYe(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]=l,u=Jt(16)|0,n[u+4>>2]=0,n[u+8>>2]=0,n[u>>2]=1916,n[u+12>>2]=l,n[o+4>>2]=u}function aYe(o){o=o|0,$y(o),yt(o)}function lYe(o){o=o|0,o=n[o+12>>2]|0,o|0&&yt(o)}function cYe(o){o=o|0,yt(o)}function uYe(){var o=0;return s[8088]|0||(mYe(11076),gr(25,11076,U|0)|0,o=8088,n[o>>2]=1,n[o+4>>2]=0),11076}function fYe(o,l){o=o|0,l=l|0,n[o>>2]=AYe()|0,n[o+4>>2]=pYe()|0,n[o+12>>2]=l,n[o+8>>2]=hYe()|0,n[o+32>>2]=10}function AYe(){return 11745}function pYe(){return 1940}function hYe(){return KP()|0}function gYe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,(Gh(A,896)|0)==512?u|0&&(dYe(u),yt(u)):l|0&&yt(l)}function dYe(o){o=o|0,o=n[o+4>>2]|0,o|0&&Yh(o)}function mYe(o){o=o|0,Uh(o)}function xu(o,l){o=o|0,l=l|0,n[o>>2]=l}function h_(o){return o=o|0,n[o>>2]|0}function yYe(o){return o=o|0,s[n[o>>2]>>0]|0}function EYe(o,l){o=o|0,l=l|0;var u=0,A=0;u=I,I=I+16|0,A=u,n[A>>2]=n[o>>2],IYe(l,A)|0,I=u}function IYe(o,l){o=o|0,l=l|0;var u=0;return u=CYe(n[o>>2]|0,l)|0,l=o+4|0,n[(n[l>>2]|0)+8>>2]=u,n[(n[l>>2]|0)+8>>2]|0}function CYe(o,l){o=o|0,l=l|0;var u=0,A=0;return u=I,I=I+16|0,A=u,Nl(A),o=Ls(o)|0,l=wYe(o,n[l>>2]|0)|0,Ol(A),I=u,l|0}function Nl(o){o=o|0,n[o>>2]=n[2701],n[o+4>>2]=n[2703]}function wYe(o,l){o=o|0,l=l|0;var u=0;return u=ma(BYe()|0)|0,dn(0,u|0,o|0,a_(l)|0)|0}function Ol(o){o=o|0,HX(n[o>>2]|0,n[o+4>>2]|0)}function BYe(){var o=0;return s[8096]|0||(vYe(11120),o=8096,n[o>>2]=1,n[o+4>>2]=0),11120}function vYe(o){o=o|0,Ro(o,SYe()|0,1)}function SYe(){return 1948}function DYe(){bYe()}function bYe(){var o=0,l=0,u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0;if(Le=I,I=I+16|0,M=Le+4|0,G=Le,aa(65536,10804,n[2702]|0,10812),u=wX()|0,l=n[u>>2]|0,o=n[l>>2]|0,o|0)for(A=n[u+8>>2]|0,u=n[u+4>>2]|0;hf(o|0,c[u>>0]|0|0,s[A>>0]|0),l=l+4|0,o=n[l>>2]|0,o;)A=A+1|0,u=u+1|0;if(o=BX()|0,l=n[o>>2]|0,l|0)do LA(l|0,n[o+4>>2]|0),o=o+8|0,l=n[o>>2]|0;while(l|0);LA(PYe()|0,5167),_=Ky()|0,o=n[_>>2]|0;e:do if(o|0){do xYe(n[o+4>>2]|0),o=n[o>>2]|0;while(o|0);if(o=n[_>>2]|0,o|0){T=_;do{for(;d=o,o=n[o>>2]|0,d=n[d+4>>2]|0,!!(kYe(d)|0);)if(n[G>>2]=T,n[M>>2]=n[G>>2],QYe(_,M)|0,!o)break e;if(TYe(d),T=n[T>>2]|0,l=$X(d)|0,m=Ni()|0,B=I,I=I+((1*(l<<2)|0)+15&-16)|0,k=I,I=I+((1*(l<<2)|0)+15&-16)|0,l=n[(NX(d)|0)>>2]|0,l|0)for(u=B,A=k;n[u>>2]=n[(Jy(n[l+4>>2]|0)|0)>>2],n[A>>2]=n[l+8>>2],l=n[l>>2]|0,l;)u=u+4|0,A=A+4|0;Qe=Jy(d)|0,l=RYe(d)|0,u=$X(d)|0,A=FYe(d)|0,ac(Qe|0,l|0,B|0,k|0,u|0,A|0,t_(d)|0),OA(m|0)}while(o|0)}}while(!1);if(o=n[(r_()|0)>>2]|0,o|0)do Qe=o+4|0,_=n_(Qe)|0,d=R2(_)|0,m=Q2(_)|0,B=(T2(_)|0)+1|0,k=$P(_)|0,T=e$(Qe)|0,_=Ur(_)|0,M=zP(Qe)|0,G=g_(Qe)|0,Au(0,d|0,m|0,B|0,k|0,T|0,_|0,M|0,G|0,d_(Qe)|0),o=n[o>>2]|0;while(o|0);o=n[(Ky()|0)>>2]|0;e:do if(o|0){t:for(;;){if(l=n[o+4>>2]|0,l|0&&(ae=n[(Jy(l)|0)>>2]|0,We=n[(OX(l)|0)>>2]|0,We|0)){u=We;do{l=u+4|0,A=n_(l)|0;r:do if(A|0)switch(Ur(A)|0){case 0:break t;case 4:case 3:case 2:{k=R2(A)|0,T=Q2(A)|0,_=(T2(A)|0)+1|0,M=$P(A)|0,G=Ur(A)|0,Qe=zP(l)|0,Au(ae|0,k|0,T|0,_|0,M|0,0,G|0,Qe|0,g_(l)|0,d_(l)|0);break r}case 1:{B=R2(A)|0,k=Q2(A)|0,T=(T2(A)|0)+1|0,_=$P(A)|0,M=e$(l)|0,G=Ur(A)|0,Qe=zP(l)|0,Au(ae|0,B|0,k|0,T|0,_|0,M|0,G|0,Qe|0,g_(l)|0,d_(l)|0);break r}case 5:{_=R2(A)|0,M=Q2(A)|0,G=(T2(A)|0)+1|0,Qe=$P(A)|0,Au(ae|0,_|0,M|0,G|0,Qe|0,NYe(A)|0,Ur(A)|0,0,0,0);break r}default:break r}while(!1);u=n[u>>2]|0}while(u|0)}if(o=n[o>>2]|0,!o)break e}Nt()}while(!1);ve(),I=Le}function PYe(){return 11703}function xYe(o){o=o|0,s[o+40>>0]=0}function kYe(o){return o=o|0,(s[o+40>>0]|0)!=0|0}function QYe(o,l){return o=o|0,l=l|0,l=OYe(l)|0,o=n[l>>2]|0,n[l>>2]=n[o>>2],yt(o),n[l>>2]|0}function TYe(o){o=o|0,s[o+40>>0]=1}function $X(o){return o=o|0,n[o+20>>2]|0}function RYe(o){return o=o|0,n[o+8>>2]|0}function FYe(o){return o=o|0,n[o+32>>2]|0}function $P(o){return o=o|0,n[o+4>>2]|0}function e$(o){return o=o|0,n[o+4>>2]|0}function g_(o){return o=o|0,n[o+8>>2]|0}function d_(o){return o=o|0,n[o+16>>2]|0}function NYe(o){return o=o|0,n[o+20>>2]|0}function OYe(o){return o=o|0,n[o>>2]|0}function ex(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0,tt=0,Ze=0,ct=0,He=0,Ge=0,Lt=0;Lt=I,I=I+16|0,ae=Lt;do if(o>>>0<245){if(_=o>>>0<11?16:o+11&-8,o=_>>>3,G=n[2783]|0,u=G>>>o,u&3|0)return l=(u&1^1)+o|0,o=11172+(l<<1<<2)|0,u=o+8|0,A=n[u>>2]|0,d=A+8|0,m=n[d>>2]|0,(o|0)==(m|0)?n[2783]=G&~(1<>2]=o,n[u>>2]=m),Ge=l<<3,n[A+4>>2]=Ge|3,Ge=A+Ge+4|0,n[Ge>>2]=n[Ge>>2]|1,Ge=d,I=Lt,Ge|0;if(M=n[2785]|0,_>>>0>M>>>0){if(u|0)return l=2<>>12&16,l=l>>>B,u=l>>>5&8,l=l>>>u,d=l>>>2&4,l=l>>>d,o=l>>>1&2,l=l>>>o,A=l>>>1&1,A=(u|B|d|o|A)+(l>>>A)|0,l=11172+(A<<1<<2)|0,o=l+8|0,d=n[o>>2]|0,B=d+8|0,u=n[B>>2]|0,(l|0)==(u|0)?(o=G&~(1<>2]=l,n[o>>2]=u,o=G),m=(A<<3)-_|0,n[d+4>>2]=_|3,A=d+_|0,n[A+4>>2]=m|1,n[A+m>>2]=m,M|0&&(d=n[2788]|0,l=M>>>3,u=11172+(l<<1<<2)|0,l=1<>2]|0):(n[2783]=o|l,l=u,o=u+8|0),n[o>>2]=d,n[l+12>>2]=d,n[d+8>>2]=l,n[d+12>>2]=u),n[2785]=m,n[2788]=A,Ge=B,I=Lt,Ge|0;if(k=n[2784]|0,k){if(u=(k&0-k)+-1|0,B=u>>>12&16,u=u>>>B,m=u>>>5&8,u=u>>>m,T=u>>>2&4,u=u>>>T,A=u>>>1&2,u=u>>>A,o=u>>>1&1,o=n[11436+((m|B|T|A|o)+(u>>>o)<<2)>>2]|0,u=(n[o+4>>2]&-8)-_|0,A=n[o+16+(((n[o+16>>2]|0)==0&1)<<2)>>2]|0,!A)T=o,m=u;else{do B=(n[A+4>>2]&-8)-_|0,T=B>>>0>>0,u=T?B:u,o=T?A:o,A=n[A+16+(((n[A+16>>2]|0)==0&1)<<2)>>2]|0;while(A|0);T=o,m=u}if(B=T+_|0,T>>>0>>0){d=n[T+24>>2]|0,l=n[T+12>>2]|0;do if((l|0)==(T|0)){if(o=T+20|0,l=n[o>>2]|0,!l&&(o=T+16|0,l=n[o>>2]|0,!l)){u=0;break}for(;;){if(u=l+20|0,A=n[u>>2]|0,A|0){l=A,o=u;continue}if(u=l+16|0,A=n[u>>2]|0,A)l=A,o=u;else break}n[o>>2]=0,u=l}else u=n[T+8>>2]|0,n[u+12>>2]=l,n[l+8>>2]=u,u=l;while(!1);do if(d|0){if(l=n[T+28>>2]|0,o=11436+(l<<2)|0,(T|0)==(n[o>>2]|0)){if(n[o>>2]=u,!u){n[2784]=k&~(1<>2]|0)!=(T|0)&1)<<2)>>2]=u,!u)break;n[u+24>>2]=d,l=n[T+16>>2]|0,l|0&&(n[u+16>>2]=l,n[l+24>>2]=u),l=n[T+20>>2]|0,l|0&&(n[u+20>>2]=l,n[l+24>>2]=u)}while(!1);return m>>>0<16?(Ge=m+_|0,n[T+4>>2]=Ge|3,Ge=T+Ge+4|0,n[Ge>>2]=n[Ge>>2]|1):(n[T+4>>2]=_|3,n[B+4>>2]=m|1,n[B+m>>2]=m,M|0&&(A=n[2788]|0,l=M>>>3,u=11172+(l<<1<<2)|0,l=1<>2]|0):(n[2783]=G|l,l=u,o=u+8|0),n[o>>2]=A,n[l+12>>2]=A,n[A+8>>2]=l,n[A+12>>2]=u),n[2785]=m,n[2788]=B),Ge=T+8|0,I=Lt,Ge|0}else G=_}else G=_}else G=_}else if(o>>>0<=4294967231)if(o=o+11|0,_=o&-8,T=n[2784]|0,T){A=0-_|0,o=o>>>8,o?_>>>0>16777215?k=31:(G=(o+1048320|0)>>>16&8,He=o<>>16&4,He=He<>>16&2,k=14-(M|G|k)+(He<>>15)|0,k=_>>>(k+7|0)&1|k<<1):k=0,u=n[11436+(k<<2)>>2]|0;e:do if(!u)u=0,o=0,He=57;else for(o=0,B=_<<((k|0)==31?0:25-(k>>>1)|0),m=0;;){if(d=(n[u+4>>2]&-8)-_|0,d>>>0>>0)if(d)o=u,A=d;else{o=u,A=0,d=u,He=61;break e}if(d=n[u+20>>2]|0,u=n[u+16+(B>>>31<<2)>>2]|0,m=(d|0)==0|(d|0)==(u|0)?m:d,d=(u|0)==0,d){u=m,He=57;break}else B=B<<((d^1)&1)}while(!1);if((He|0)==57){if((u|0)==0&(o|0)==0){if(o=2<>>12&16,G=G>>>B,m=G>>>5&8,G=G>>>m,k=G>>>2&4,G=G>>>k,M=G>>>1&2,G=G>>>M,u=G>>>1&1,o=0,u=n[11436+((m|B|k|M|u)+(G>>>u)<<2)>>2]|0}u?(d=u,He=61):(k=o,B=A)}if((He|0)==61)for(;;)if(He=0,u=(n[d+4>>2]&-8)-_|0,G=u>>>0>>0,u=G?u:A,o=G?d:o,d=n[d+16+(((n[d+16>>2]|0)==0&1)<<2)>>2]|0,d)A=u,He=61;else{k=o,B=u;break}if(k|0&&B>>>0<((n[2785]|0)-_|0)>>>0){if(m=k+_|0,k>>>0>=m>>>0)return Ge=0,I=Lt,Ge|0;d=n[k+24>>2]|0,l=n[k+12>>2]|0;do if((l|0)==(k|0)){if(o=k+20|0,l=n[o>>2]|0,!l&&(o=k+16|0,l=n[o>>2]|0,!l)){l=0;break}for(;;){if(u=l+20|0,A=n[u>>2]|0,A|0){l=A,o=u;continue}if(u=l+16|0,A=n[u>>2]|0,A)l=A,o=u;else break}n[o>>2]=0}else Ge=n[k+8>>2]|0,n[Ge+12>>2]=l,n[l+8>>2]=Ge;while(!1);do if(d){if(o=n[k+28>>2]|0,u=11436+(o<<2)|0,(k|0)==(n[u>>2]|0)){if(n[u>>2]=l,!l){A=T&~(1<>2]|0)!=(k|0)&1)<<2)>>2]=l,!l){A=T;break}n[l+24>>2]=d,o=n[k+16>>2]|0,o|0&&(n[l+16>>2]=o,n[o+24>>2]=l),o=n[k+20>>2]|0,o&&(n[l+20>>2]=o,n[o+24>>2]=l),A=T}else A=T;while(!1);do if(B>>>0>=16){if(n[k+4>>2]=_|3,n[m+4>>2]=B|1,n[m+B>>2]=B,l=B>>>3,B>>>0<256){u=11172+(l<<1<<2)|0,o=n[2783]|0,l=1<>2]|0):(n[2783]=o|l,l=u,o=u+8|0),n[o>>2]=m,n[l+12>>2]=m,n[m+8>>2]=l,n[m+12>>2]=u;break}if(l=B>>>8,l?B>>>0>16777215?l=31:(He=(l+1048320|0)>>>16&8,Ge=l<>>16&4,Ge=Ge<>>16&2,l=14-(ct|He|l)+(Ge<>>15)|0,l=B>>>(l+7|0)&1|l<<1):l=0,u=11436+(l<<2)|0,n[m+28>>2]=l,o=m+16|0,n[o+4>>2]=0,n[o>>2]=0,o=1<>2]=m,n[m+24>>2]=u,n[m+12>>2]=m,n[m+8>>2]=m;break}for(o=B<<((l|0)==31?0:25-(l>>>1)|0),u=n[u>>2]|0;;){if((n[u+4>>2]&-8|0)==(B|0)){He=97;break}if(A=u+16+(o>>>31<<2)|0,l=n[A>>2]|0,l)o=o<<1,u=l;else{He=96;break}}if((He|0)==96){n[A>>2]=m,n[m+24>>2]=u,n[m+12>>2]=m,n[m+8>>2]=m;break}else if((He|0)==97){He=u+8|0,Ge=n[He>>2]|0,n[Ge+12>>2]=m,n[He>>2]=m,n[m+8>>2]=Ge,n[m+12>>2]=u,n[m+24>>2]=0;break}}else Ge=B+_|0,n[k+4>>2]=Ge|3,Ge=k+Ge+4|0,n[Ge>>2]=n[Ge>>2]|1;while(!1);return Ge=k+8|0,I=Lt,Ge|0}else G=_}else G=_;else G=-1;while(!1);if(u=n[2785]|0,u>>>0>=G>>>0)return l=u-G|0,o=n[2788]|0,l>>>0>15?(Ge=o+G|0,n[2788]=Ge,n[2785]=l,n[Ge+4>>2]=l|1,n[Ge+l>>2]=l,n[o+4>>2]=G|3):(n[2785]=0,n[2788]=0,n[o+4>>2]=u|3,Ge=o+u+4|0,n[Ge>>2]=n[Ge>>2]|1),Ge=o+8|0,I=Lt,Ge|0;if(B=n[2786]|0,B>>>0>G>>>0)return ct=B-G|0,n[2786]=ct,Ge=n[2789]|0,He=Ge+G|0,n[2789]=He,n[He+4>>2]=ct|1,n[Ge+4>>2]=G|3,Ge=Ge+8|0,I=Lt,Ge|0;if(n[2901]|0?o=n[2903]|0:(n[2903]=4096,n[2902]=4096,n[2904]=-1,n[2905]=-1,n[2906]=0,n[2894]=0,o=ae&-16^1431655768,n[ae>>2]=o,n[2901]=o,o=4096),k=G+48|0,T=G+47|0,m=o+T|0,d=0-o|0,_=m&d,_>>>0<=G>>>0||(o=n[2893]|0,o|0&&(M=n[2891]|0,ae=M+_|0,ae>>>0<=M>>>0|ae>>>0>o>>>0)))return Ge=0,I=Lt,Ge|0;e:do if(n[2894]&4)l=0,He=133;else{u=n[2789]|0;t:do if(u){for(A=11580;o=n[A>>2]|0,!(o>>>0<=u>>>0&&(Qe=A+4|0,(o+(n[Qe>>2]|0)|0)>>>0>u>>>0));)if(o=n[A+8>>2]|0,o)A=o;else{He=118;break t}if(l=m-B&d,l>>>0<2147483647)if(o=Vh(l|0)|0,(o|0)==((n[A>>2]|0)+(n[Qe>>2]|0)|0)){if((o|0)!=-1){B=l,m=o,He=135;break e}}else A=o,He=126;else l=0}else He=118;while(!1);do if((He|0)==118)if(u=Vh(0)|0,(u|0)!=-1&&(l=u,We=n[2902]|0,Le=We+-1|0,l=(Le&l|0?(Le+l&0-We)-l|0:0)+_|0,We=n[2891]|0,Le=l+We|0,l>>>0>G>>>0&l>>>0<2147483647)){if(Qe=n[2893]|0,Qe|0&&Le>>>0<=We>>>0|Le>>>0>Qe>>>0){l=0;break}if(o=Vh(l|0)|0,(o|0)==(u|0)){B=l,m=u,He=135;break e}else A=o,He=126}else l=0;while(!1);do if((He|0)==126){if(u=0-l|0,!(k>>>0>l>>>0&(l>>>0<2147483647&(A|0)!=-1)))if((A|0)==-1){l=0;break}else{B=l,m=A,He=135;break e}if(o=n[2903]|0,o=T-l+o&0-o,o>>>0>=2147483647){B=l,m=A,He=135;break e}if((Vh(o|0)|0)==-1){Vh(u|0)|0,l=0;break}else{B=o+l|0,m=A,He=135;break e}}while(!1);n[2894]=n[2894]|4,He=133}while(!1);if((He|0)==133&&_>>>0<2147483647&&(ct=Vh(_|0)|0,Qe=Vh(0)|0,tt=Qe-ct|0,Ze=tt>>>0>(G+40|0)>>>0,!((ct|0)==-1|Ze^1|ct>>>0>>0&((ct|0)!=-1&(Qe|0)!=-1)^1))&&(B=Ze?tt:l,m=ct,He=135),(He|0)==135){l=(n[2891]|0)+B|0,n[2891]=l,l>>>0>(n[2892]|0)>>>0&&(n[2892]=l),T=n[2789]|0;do if(T){for(l=11580;;){if(o=n[l>>2]|0,u=l+4|0,A=n[u>>2]|0,(m|0)==(o+A|0)){He=145;break}if(d=n[l+8>>2]|0,d)l=d;else break}if((He|0)==145&&!(n[l+12>>2]&8|0)&&T>>>0>>0&T>>>0>=o>>>0){n[u>>2]=A+B,Ge=T+8|0,Ge=Ge&7|0?0-Ge&7:0,He=T+Ge|0,Ge=(n[2786]|0)+(B-Ge)|0,n[2789]=He,n[2786]=Ge,n[He+4>>2]=Ge|1,n[He+Ge+4>>2]=40,n[2790]=n[2905];break}for(m>>>0<(n[2787]|0)>>>0&&(n[2787]=m),u=m+B|0,l=11580;;){if((n[l>>2]|0)==(u|0)){He=153;break}if(o=n[l+8>>2]|0,o)l=o;else break}if((He|0)==153&&!(n[l+12>>2]&8|0)){n[l>>2]=m,M=l+4|0,n[M>>2]=(n[M>>2]|0)+B,M=m+8|0,M=m+(M&7|0?0-M&7:0)|0,l=u+8|0,l=u+(l&7|0?0-l&7:0)|0,_=M+G|0,k=l-M-G|0,n[M+4>>2]=G|3;do if((l|0)!=(T|0)){if((l|0)==(n[2788]|0)){Ge=(n[2785]|0)+k|0,n[2785]=Ge,n[2788]=_,n[_+4>>2]=Ge|1,n[_+Ge>>2]=Ge;break}if(o=n[l+4>>2]|0,(o&3|0)==1){B=o&-8,A=o>>>3;e:do if(o>>>0<256)if(o=n[l+8>>2]|0,u=n[l+12>>2]|0,(u|0)==(o|0)){n[2783]=n[2783]&~(1<>2]=u,n[u+8>>2]=o;break}else{m=n[l+24>>2]|0,o=n[l+12>>2]|0;do if((o|0)==(l|0)){if(A=l+16|0,u=A+4|0,o=n[u>>2]|0,!o)if(o=n[A>>2]|0,o)u=A;else{o=0;break}for(;;){if(A=o+20|0,d=n[A>>2]|0,d|0){o=d,u=A;continue}if(A=o+16|0,d=n[A>>2]|0,d)o=d,u=A;else break}n[u>>2]=0}else Ge=n[l+8>>2]|0,n[Ge+12>>2]=o,n[o+8>>2]=Ge;while(!1);if(!m)break;u=n[l+28>>2]|0,A=11436+(u<<2)|0;do if((l|0)!=(n[A>>2]|0)){if(n[m+16+(((n[m+16>>2]|0)!=(l|0)&1)<<2)>>2]=o,!o)break e}else{if(n[A>>2]=o,o|0)break;n[2784]=n[2784]&~(1<>2]=m,u=l+16|0,A=n[u>>2]|0,A|0&&(n[o+16>>2]=A,n[A+24>>2]=o),u=n[u+4>>2]|0,!u)break;n[o+20>>2]=u,n[u+24>>2]=o}while(!1);l=l+B|0,d=B+k|0}else d=k;if(l=l+4|0,n[l>>2]=n[l>>2]&-2,n[_+4>>2]=d|1,n[_+d>>2]=d,l=d>>>3,d>>>0<256){u=11172+(l<<1<<2)|0,o=n[2783]|0,l=1<>2]|0):(n[2783]=o|l,l=u,o=u+8|0),n[o>>2]=_,n[l+12>>2]=_,n[_+8>>2]=l,n[_+12>>2]=u;break}l=d>>>8;do if(!l)l=0;else{if(d>>>0>16777215){l=31;break}He=(l+1048320|0)>>>16&8,Ge=l<>>16&4,Ge=Ge<>>16&2,l=14-(ct|He|l)+(Ge<>>15)|0,l=d>>>(l+7|0)&1|l<<1}while(!1);if(A=11436+(l<<2)|0,n[_+28>>2]=l,o=_+16|0,n[o+4>>2]=0,n[o>>2]=0,o=n[2784]|0,u=1<>2]=_,n[_+24>>2]=A,n[_+12>>2]=_,n[_+8>>2]=_;break}for(o=d<<((l|0)==31?0:25-(l>>>1)|0),u=n[A>>2]|0;;){if((n[u+4>>2]&-8|0)==(d|0)){He=194;break}if(A=u+16+(o>>>31<<2)|0,l=n[A>>2]|0,l)o=o<<1,u=l;else{He=193;break}}if((He|0)==193){n[A>>2]=_,n[_+24>>2]=u,n[_+12>>2]=_,n[_+8>>2]=_;break}else if((He|0)==194){He=u+8|0,Ge=n[He>>2]|0,n[Ge+12>>2]=_,n[He>>2]=_,n[_+8>>2]=Ge,n[_+12>>2]=u,n[_+24>>2]=0;break}}else Ge=(n[2786]|0)+k|0,n[2786]=Ge,n[2789]=_,n[_+4>>2]=Ge|1;while(!1);return Ge=M+8|0,I=Lt,Ge|0}for(l=11580;o=n[l>>2]|0,!(o>>>0<=T>>>0&&(Ge=o+(n[l+4>>2]|0)|0,Ge>>>0>T>>>0));)l=n[l+8>>2]|0;d=Ge+-47|0,o=d+8|0,o=d+(o&7|0?0-o&7:0)|0,d=T+16|0,o=o>>>0>>0?T:o,l=o+8|0,u=m+8|0,u=u&7|0?0-u&7:0,He=m+u|0,u=B+-40-u|0,n[2789]=He,n[2786]=u,n[He+4>>2]=u|1,n[He+u+4>>2]=40,n[2790]=n[2905],u=o+4|0,n[u>>2]=27,n[l>>2]=n[2895],n[l+4>>2]=n[2896],n[l+8>>2]=n[2897],n[l+12>>2]=n[2898],n[2895]=m,n[2896]=B,n[2898]=0,n[2897]=l,l=o+24|0;do He=l,l=l+4|0,n[l>>2]=7;while((He+8|0)>>>0>>0);if((o|0)!=(T|0)){if(m=o-T|0,n[u>>2]=n[u>>2]&-2,n[T+4>>2]=m|1,n[o>>2]=m,l=m>>>3,m>>>0<256){u=11172+(l<<1<<2)|0,o=n[2783]|0,l=1<>2]|0):(n[2783]=o|l,l=u,o=u+8|0),n[o>>2]=T,n[l+12>>2]=T,n[T+8>>2]=l,n[T+12>>2]=u;break}if(l=m>>>8,l?m>>>0>16777215?u=31:(He=(l+1048320|0)>>>16&8,Ge=l<>>16&4,Ge=Ge<>>16&2,u=14-(ct|He|u)+(Ge<>>15)|0,u=m>>>(u+7|0)&1|u<<1):u=0,A=11436+(u<<2)|0,n[T+28>>2]=u,n[T+20>>2]=0,n[d>>2]=0,l=n[2784]|0,o=1<>2]=T,n[T+24>>2]=A,n[T+12>>2]=T,n[T+8>>2]=T;break}for(o=m<<((u|0)==31?0:25-(u>>>1)|0),u=n[A>>2]|0;;){if((n[u+4>>2]&-8|0)==(m|0)){He=216;break}if(A=u+16+(o>>>31<<2)|0,l=n[A>>2]|0,l)o=o<<1,u=l;else{He=215;break}}if((He|0)==215){n[A>>2]=T,n[T+24>>2]=u,n[T+12>>2]=T,n[T+8>>2]=T;break}else if((He|0)==216){He=u+8|0,Ge=n[He>>2]|0,n[Ge+12>>2]=T,n[He>>2]=T,n[T+8>>2]=Ge,n[T+12>>2]=u,n[T+24>>2]=0;break}}}else{Ge=n[2787]|0,(Ge|0)==0|m>>>0>>0&&(n[2787]=m),n[2895]=m,n[2896]=B,n[2898]=0,n[2792]=n[2901],n[2791]=-1,l=0;do Ge=11172+(l<<1<<2)|0,n[Ge+12>>2]=Ge,n[Ge+8>>2]=Ge,l=l+1|0;while((l|0)!=32);Ge=m+8|0,Ge=Ge&7|0?0-Ge&7:0,He=m+Ge|0,Ge=B+-40-Ge|0,n[2789]=He,n[2786]=Ge,n[He+4>>2]=Ge|1,n[He+Ge+4>>2]=40,n[2790]=n[2905]}while(!1);if(l=n[2786]|0,l>>>0>G>>>0)return ct=l-G|0,n[2786]=ct,Ge=n[2789]|0,He=Ge+G|0,n[2789]=He,n[He+4>>2]=ct|1,n[Ge+4>>2]=G|3,Ge=Ge+8|0,I=Lt,Ge|0}return n[(Zy()|0)>>2]=12,Ge=0,I=Lt,Ge|0}function tx(o){o=o|0;var l=0,u=0,A=0,d=0,m=0,B=0,k=0,T=0;if(o){u=o+-8|0,d=n[2787]|0,o=n[o+-4>>2]|0,l=o&-8,T=u+l|0;do if(o&1)k=u,B=u;else{if(A=n[u>>2]|0,!(o&3)||(B=u+(0-A)|0,m=A+l|0,B>>>0>>0))return;if((B|0)==(n[2788]|0)){if(o=T+4|0,l=n[o>>2]|0,(l&3|0)!=3){k=B,l=m;break}n[2785]=m,n[o>>2]=l&-2,n[B+4>>2]=m|1,n[B+m>>2]=m;return}if(u=A>>>3,A>>>0<256)if(o=n[B+8>>2]|0,l=n[B+12>>2]|0,(l|0)==(o|0)){n[2783]=n[2783]&~(1<>2]=l,n[l+8>>2]=o,k=B,l=m;break}d=n[B+24>>2]|0,o=n[B+12>>2]|0;do if((o|0)==(B|0)){if(u=B+16|0,l=u+4|0,o=n[l>>2]|0,!o)if(o=n[u>>2]|0,o)l=u;else{o=0;break}for(;;){if(u=o+20|0,A=n[u>>2]|0,A|0){o=A,l=u;continue}if(u=o+16|0,A=n[u>>2]|0,A)o=A,l=u;else break}n[l>>2]=0}else k=n[B+8>>2]|0,n[k+12>>2]=o,n[o+8>>2]=k;while(!1);if(d){if(l=n[B+28>>2]|0,u=11436+(l<<2)|0,(B|0)==(n[u>>2]|0)){if(n[u>>2]=o,!o){n[2784]=n[2784]&~(1<>2]|0)!=(B|0)&1)<<2)>>2]=o,!o){k=B,l=m;break}n[o+24>>2]=d,l=B+16|0,u=n[l>>2]|0,u|0&&(n[o+16>>2]=u,n[u+24>>2]=o),l=n[l+4>>2]|0,l?(n[o+20>>2]=l,n[l+24>>2]=o,k=B,l=m):(k=B,l=m)}else k=B,l=m}while(!1);if(!(B>>>0>=T>>>0)&&(o=T+4|0,A=n[o>>2]|0,!!(A&1))){if(A&2)n[o>>2]=A&-2,n[k+4>>2]=l|1,n[B+l>>2]=l,d=l;else{if(o=n[2788]|0,(T|0)==(n[2789]|0)){if(T=(n[2786]|0)+l|0,n[2786]=T,n[2789]=k,n[k+4>>2]=T|1,(k|0)!=(o|0))return;n[2788]=0,n[2785]=0;return}if((T|0)==(o|0)){T=(n[2785]|0)+l|0,n[2785]=T,n[2788]=B,n[k+4>>2]=T|1,n[B+T>>2]=T;return}d=(A&-8)+l|0,u=A>>>3;do if(A>>>0<256)if(l=n[T+8>>2]|0,o=n[T+12>>2]|0,(o|0)==(l|0)){n[2783]=n[2783]&~(1<>2]=o,n[o+8>>2]=l;break}else{m=n[T+24>>2]|0,o=n[T+12>>2]|0;do if((o|0)==(T|0)){if(u=T+16|0,l=u+4|0,o=n[l>>2]|0,!o)if(o=n[u>>2]|0,o)l=u;else{u=0;break}for(;;){if(u=o+20|0,A=n[u>>2]|0,A|0){o=A,l=u;continue}if(u=o+16|0,A=n[u>>2]|0,A)o=A,l=u;else break}n[l>>2]=0,u=o}else u=n[T+8>>2]|0,n[u+12>>2]=o,n[o+8>>2]=u,u=o;while(!1);if(m|0){if(o=n[T+28>>2]|0,l=11436+(o<<2)|0,(T|0)==(n[l>>2]|0)){if(n[l>>2]=u,!u){n[2784]=n[2784]&~(1<>2]|0)!=(T|0)&1)<<2)>>2]=u,!u)break;n[u+24>>2]=m,o=T+16|0,l=n[o>>2]|0,l|0&&(n[u+16>>2]=l,n[l+24>>2]=u),o=n[o+4>>2]|0,o|0&&(n[u+20>>2]=o,n[o+24>>2]=u)}}while(!1);if(n[k+4>>2]=d|1,n[B+d>>2]=d,(k|0)==(n[2788]|0)){n[2785]=d;return}}if(o=d>>>3,d>>>0<256){u=11172+(o<<1<<2)|0,l=n[2783]|0,o=1<>2]|0):(n[2783]=l|o,o=u,l=u+8|0),n[l>>2]=k,n[o+12>>2]=k,n[k+8>>2]=o,n[k+12>>2]=u;return}o=d>>>8,o?d>>>0>16777215?o=31:(B=(o+1048320|0)>>>16&8,T=o<>>16&4,T=T<>>16&2,o=14-(m|B|o)+(T<>>15)|0,o=d>>>(o+7|0)&1|o<<1):o=0,A=11436+(o<<2)|0,n[k+28>>2]=o,n[k+20>>2]=0,n[k+16>>2]=0,l=n[2784]|0,u=1<>>1)|0),u=n[A>>2]|0;;){if((n[u+4>>2]&-8|0)==(d|0)){o=73;break}if(A=u+16+(l>>>31<<2)|0,o=n[A>>2]|0,o)l=l<<1,u=o;else{o=72;break}}if((o|0)==72){n[A>>2]=k,n[k+24>>2]=u,n[k+12>>2]=k,n[k+8>>2]=k;break}else if((o|0)==73){B=u+8|0,T=n[B>>2]|0,n[T+12>>2]=k,n[B>>2]=k,n[k+8>>2]=T,n[k+12>>2]=u,n[k+24>>2]=0;break}}else n[2784]=l|u,n[A>>2]=k,n[k+24>>2]=A,n[k+12>>2]=k,n[k+8>>2]=k;while(!1);if(T=(n[2791]|0)+-1|0,n[2791]=T,!T)o=11588;else return;for(;o=n[o>>2]|0,o;)o=o+8|0;n[2791]=-1}}}function LYe(){return 11628}function MYe(o){o=o|0;var l=0,u=0;return l=I,I=I+16|0,u=l,n[u>>2]=HYe(n[o+60>>2]|0)|0,o=rx(hu(6,u|0)|0)|0,I=l,o|0}function t$(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0;G=I,I=I+48|0,_=G+16|0,m=G,d=G+32|0,k=o+28|0,A=n[k>>2]|0,n[d>>2]=A,T=o+20|0,A=(n[T>>2]|0)-A|0,n[d+4>>2]=A,n[d+8>>2]=l,n[d+12>>2]=u,A=A+u|0,B=o+60|0,n[m>>2]=n[B>>2],n[m+4>>2]=d,n[m+8>>2]=2,m=rx(Ma(146,m|0)|0)|0;e:do if((A|0)!=(m|0)){for(l=2;!((m|0)<0);)if(A=A-m|0,We=n[d+4>>2]|0,ae=m>>>0>We>>>0,d=ae?d+8|0:d,l=(ae<<31>>31)+l|0,We=m-(ae?We:0)|0,n[d>>2]=(n[d>>2]|0)+We,ae=d+4|0,n[ae>>2]=(n[ae>>2]|0)-We,n[_>>2]=n[B>>2],n[_+4>>2]=d,n[_+8>>2]=l,m=rx(Ma(146,_|0)|0)|0,(A|0)==(m|0)){M=3;break e}n[o+16>>2]=0,n[k>>2]=0,n[T>>2]=0,n[o>>2]=n[o>>2]|32,(l|0)==2?u=0:u=u-(n[d+4>>2]|0)|0}else M=3;while(!1);return(M|0)==3&&(We=n[o+44>>2]|0,n[o+16>>2]=We+(n[o+48>>2]|0),n[k>>2]=We,n[T>>2]=We),I=G,u|0}function _Ye(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;return d=I,I=I+32|0,m=d,A=d+20|0,n[m>>2]=n[o+60>>2],n[m+4>>2]=0,n[m+8>>2]=l,n[m+12>>2]=A,n[m+16>>2]=u,(rx(La(140,m|0)|0)|0)<0?(n[A>>2]=-1,o=-1):o=n[A>>2]|0,I=d,o|0}function rx(o){return o=o|0,o>>>0>4294963200&&(n[(Zy()|0)>>2]=0-o,o=-1),o|0}function Zy(){return(UYe()|0)+64|0}function UYe(){return m_()|0}function m_(){return 2084}function HYe(o){return o=o|0,o|0}function jYe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;return d=I,I=I+32|0,A=d,n[o+36>>2]=1,!(n[o>>2]&64|0)&&(n[A>>2]=n[o+60>>2],n[A+4>>2]=21523,n[A+8>>2]=d+16,io(54,A|0)|0)&&(s[o+75>>0]=-1),A=t$(o,l,u)|0,I=d,A|0}function r$(o,l){o=o|0,l=l|0;var u=0,A=0;if(u=s[o>>0]|0,A=s[l>>0]|0,!(u<<24>>24)||u<<24>>24!=A<<24>>24)o=A;else{do o=o+1|0,l=l+1|0,u=s[o>>0]|0,A=s[l>>0]|0;while(!(!(u<<24>>24)||u<<24>>24!=A<<24>>24));o=A}return(u&255)-(o&255)|0}function qYe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0;e:do if(!u)o=0;else{for(;A=s[o>>0]|0,d=s[l>>0]|0,A<<24>>24==d<<24>>24;)if(u=u+-1|0,u)o=o+1|0,l=l+1|0;else{o=0;break e}o=(A&255)-(d&255)|0}while(!1);return o|0}function n$(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0;Qe=I,I=I+224|0,M=Qe+120|0,G=Qe+80|0,We=Qe,Le=Qe+136|0,A=G,d=A+40|0;do n[A>>2]=0,A=A+4|0;while((A|0)<(d|0));return n[M>>2]=n[u>>2],(y_(0,l,M,We,G)|0)<0?u=-1:((n[o+76>>2]|0)>-1?ae=GYe(o)|0:ae=0,u=n[o>>2]|0,_=u&32,(s[o+74>>0]|0)<1&&(n[o>>2]=u&-33),A=o+48|0,n[A>>2]|0?u=y_(o,l,M,We,G)|0:(d=o+44|0,m=n[d>>2]|0,n[d>>2]=Le,B=o+28|0,n[B>>2]=Le,k=o+20|0,n[k>>2]=Le,n[A>>2]=80,T=o+16|0,n[T>>2]=Le+80,u=y_(o,l,M,We,G)|0,m&&(ox[n[o+36>>2]&7](o,0,0)|0,u=n[k>>2]|0?u:-1,n[d>>2]=m,n[A>>2]=0,n[T>>2]=0,n[B>>2]=0,n[k>>2]=0)),A=n[o>>2]|0,n[o>>2]=A|_,ae|0&&WYe(o),u=A&32|0?-1:u),I=Qe,u|0}function y_(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0,tt=0,Ze=0,ct=0,He=0,Ge=0,Lt=0,qr=0,fr=0,$t=0,Tr=0,Hr=0,cr=0;cr=I,I=I+64|0,fr=cr+16|0,$t=cr,Lt=cr+24|0,Tr=cr+8|0,Hr=cr+20|0,n[fr>>2]=l,ct=(o|0)!=0,He=Lt+40|0,Ge=He,Lt=Lt+39|0,qr=Tr+4|0,B=0,m=0,M=0;e:for(;;){do if((m|0)>-1)if((B|0)>(2147483647-m|0)){n[(Zy()|0)>>2]=75,m=-1;break}else{m=B+m|0;break}while(!1);if(B=s[l>>0]|0,B<<24>>24)k=l;else{Ze=87;break}t:for(;;){switch(B<<24>>24){case 37:{B=k,Ze=9;break t}case 0:{B=k;break t}default:}tt=k+1|0,n[fr>>2]=tt,B=s[tt>>0]|0,k=tt}t:do if((Ze|0)==9)for(;;){if(Ze=0,(s[k+1>>0]|0)!=37)break t;if(B=B+1|0,k=k+2|0,n[fr>>2]=k,(s[k>>0]|0)==37)Ze=9;else break}while(!1);if(B=B-l|0,ct&&Ss(o,l,B),B|0){l=k;continue}T=k+1|0,B=(s[T>>0]|0)+-48|0,B>>>0<10?(tt=(s[k+2>>0]|0)==36,Qe=tt?B:-1,M=tt?1:M,T=tt?k+3|0:T):Qe=-1,n[fr>>2]=T,B=s[T>>0]|0,k=(B<<24>>24)+-32|0;t:do if(k>>>0<32)for(_=0,G=B;;){if(B=1<>2]=T,B=s[T>>0]|0,k=(B<<24>>24)+-32|0,k>>>0>=32)break;G=B}else _=0;while(!1);if(B<<24>>24==42){if(k=T+1|0,B=(s[k>>0]|0)+-48|0,B>>>0<10&&(s[T+2>>0]|0)==36)n[d+(B<<2)>>2]=10,B=n[A+((s[k>>0]|0)+-48<<3)>>2]|0,M=1,T=T+3|0;else{if(M|0){m=-1;break}ct?(M=(n[u>>2]|0)+3&-4,B=n[M>>2]|0,n[u>>2]=M+4,M=0,T=k):(B=0,M=0,T=k)}n[fr>>2]=T,tt=(B|0)<0,B=tt?0-B|0:B,_=tt?_|8192:_}else{if(B=i$(fr)|0,(B|0)<0){m=-1;break}T=n[fr>>2]|0}do if((s[T>>0]|0)==46){if((s[T+1>>0]|0)!=42){n[fr>>2]=T+1,k=i$(fr)|0,T=n[fr>>2]|0;break}if(G=T+2|0,k=(s[G>>0]|0)+-48|0,k>>>0<10&&(s[T+3>>0]|0)==36){n[d+(k<<2)>>2]=10,k=n[A+((s[G>>0]|0)+-48<<3)>>2]|0,T=T+4|0,n[fr>>2]=T;break}if(M|0){m=-1;break e}ct?(tt=(n[u>>2]|0)+3&-4,k=n[tt>>2]|0,n[u>>2]=tt+4):k=0,n[fr>>2]=G,T=G}else k=-1;while(!1);for(Le=0;;){if(((s[T>>0]|0)+-65|0)>>>0>57){m=-1;break e}if(tt=T+1|0,n[fr>>2]=tt,G=s[(s[T>>0]|0)+-65+(5178+(Le*58|0))>>0]|0,ae=G&255,(ae+-1|0)>>>0<8)Le=ae,T=tt;else break}if(!(G<<24>>24)){m=-1;break}We=(Qe|0)>-1;do if(G<<24>>24==19)if(We){m=-1;break e}else Ze=49;else{if(We){n[d+(Qe<<2)>>2]=ae,We=A+(Qe<<3)|0,Qe=n[We+4>>2]|0,Ze=$t,n[Ze>>2]=n[We>>2],n[Ze+4>>2]=Qe,Ze=49;break}if(!ct){m=0;break e}s$($t,ae,u)}while(!1);if((Ze|0)==49&&(Ze=0,!ct)){B=0,l=tt;continue}T=s[T>>0]|0,T=(Le|0)!=0&(T&15|0)==3?T&-33:T,We=_&-65537,Qe=_&8192|0?We:_;t:do switch(T|0){case 110:switch((Le&255)<<24>>24){case 0:{n[n[$t>>2]>>2]=m,B=0,l=tt;continue e}case 1:{n[n[$t>>2]>>2]=m,B=0,l=tt;continue e}case 2:{B=n[$t>>2]|0,n[B>>2]=m,n[B+4>>2]=((m|0)<0)<<31>>31,B=0,l=tt;continue e}case 3:{a[n[$t>>2]>>1]=m,B=0,l=tt;continue e}case 4:{s[n[$t>>2]>>0]=m,B=0,l=tt;continue e}case 6:{n[n[$t>>2]>>2]=m,B=0,l=tt;continue e}case 7:{B=n[$t>>2]|0,n[B>>2]=m,n[B+4>>2]=((m|0)<0)<<31>>31,B=0,l=tt;continue e}default:{B=0,l=tt;continue e}}case 112:{T=120,k=k>>>0>8?k:8,l=Qe|8,Ze=61;break}case 88:case 120:{l=Qe,Ze=61;break}case 111:{T=$t,l=n[T>>2]|0,T=n[T+4>>2]|0,ae=VYe(l,T,He)|0,We=Ge-ae|0,_=0,G=5642,k=(Qe&8|0)==0|(k|0)>(We|0)?k:We+1|0,We=Qe,Ze=67;break}case 105:case 100:if(T=$t,l=n[T>>2]|0,T=n[T+4>>2]|0,(T|0)<0){l=nx(0,0,l|0,T|0)|0,T=Ee,_=$t,n[_>>2]=l,n[_+4>>2]=T,_=1,G=5642,Ze=66;break t}else{_=(Qe&2049|0)!=0&1,G=Qe&2048|0?5643:Qe&1|0?5644:5642,Ze=66;break t}case 117:{T=$t,_=0,G=5642,l=n[T>>2]|0,T=n[T+4>>2]|0,Ze=66;break}case 99:{s[Lt>>0]=n[$t>>2],l=Lt,_=0,G=5642,ae=He,T=1,k=We;break}case 109:{T=KYe(n[(Zy()|0)>>2]|0)|0,Ze=71;break}case 115:{T=n[$t>>2]|0,T=T|0?T:5652,Ze=71;break}case 67:{n[Tr>>2]=n[$t>>2],n[qr>>2]=0,n[$t>>2]=Tr,ae=-1,T=Tr,Ze=75;break}case 83:{l=n[$t>>2]|0,k?(ae=k,T=l,Ze=75):(Ms(o,32,B,0,Qe),l=0,Ze=84);break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{B=zYe(o,+E[$t>>3],B,k,Qe,T)|0,l=tt;continue e}default:_=0,G=5642,ae=He,T=k,k=Qe}while(!1);t:do if((Ze|0)==61)Qe=$t,Le=n[Qe>>2]|0,Qe=n[Qe+4>>2]|0,ae=YYe(Le,Qe,He,T&32)|0,G=(l&8|0)==0|(Le|0)==0&(Qe|0)==0,_=G?0:2,G=G?5642:5642+(T>>4)|0,We=l,l=Le,T=Qe,Ze=67;else if((Ze|0)==66)ae=Xy(l,T,He)|0,We=Qe,Ze=67;else if((Ze|0)==71)Ze=0,Qe=JYe(T,0,k)|0,Le=(Qe|0)==0,l=T,_=0,G=5642,ae=Le?T+k|0:Qe,T=Le?k:Qe-T|0,k=We;else if((Ze|0)==75){for(Ze=0,G=T,l=0,k=0;_=n[G>>2]|0,!(!_||(k=o$(Hr,_)|0,(k|0)<0|k>>>0>(ae-l|0)>>>0));)if(l=k+l|0,ae>>>0>l>>>0)G=G+4|0;else break;if((k|0)<0){m=-1;break e}if(Ms(o,32,B,l,Qe),!l)l=0,Ze=84;else for(_=0;;){if(k=n[T>>2]|0,!k){Ze=84;break t}if(k=o$(Hr,k)|0,_=k+_|0,(_|0)>(l|0)){Ze=84;break t}if(Ss(o,Hr,k),_>>>0>=l>>>0){Ze=84;break}else T=T+4|0}}while(!1);if((Ze|0)==67)Ze=0,T=(l|0)!=0|(T|0)!=0,Qe=(k|0)!=0|T,T=((T^1)&1)+(Ge-ae)|0,l=Qe?ae:He,ae=He,T=Qe?(k|0)>(T|0)?k:T:k,k=(k|0)>-1?We&-65537:We;else if((Ze|0)==84){Ze=0,Ms(o,32,B,l,Qe^8192),B=(B|0)>(l|0)?B:l,l=tt;continue}Le=ae-l|0,We=(T|0)<(Le|0)?Le:T,Qe=We+_|0,B=(B|0)<(Qe|0)?Qe:B,Ms(o,32,B,Qe,k),Ss(o,G,_),Ms(o,48,B,Qe,k^65536),Ms(o,48,We,Le,0),Ss(o,l,Le),Ms(o,32,B,Qe,k^8192),l=tt}e:do if((Ze|0)==87&&!o)if(!M)m=0;else{for(m=1;l=n[d+(m<<2)>>2]|0,!!l;)if(s$(A+(m<<3)|0,l,u),m=m+1|0,(m|0)>=10){m=1;break e}for(;;){if(n[d+(m<<2)>>2]|0){m=-1;break e}if(m=m+1|0,(m|0)>=10){m=1;break}}}while(!1);return I=cr,m|0}function GYe(o){return o=o|0,0}function WYe(o){o=o|0}function Ss(o,l,u){o=o|0,l=l|0,u=u|0,n[o>>2]&32||sVe(l,u,o)|0}function i$(o){o=o|0;var l=0,u=0,A=0;if(u=n[o>>2]|0,A=(s[u>>0]|0)+-48|0,A>>>0<10){l=0;do l=A+(l*10|0)|0,u=u+1|0,n[o>>2]=u,A=(s[u>>0]|0)+-48|0;while(A>>>0<10)}else l=0;return l|0}function s$(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;e:do if(l>>>0<=20)do switch(l|0){case 9:{A=(n[u>>2]|0)+3&-4,l=n[A>>2]|0,n[u>>2]=A+4,n[o>>2]=l;break e}case 10:{A=(n[u>>2]|0)+3&-4,l=n[A>>2]|0,n[u>>2]=A+4,A=o,n[A>>2]=l,n[A+4>>2]=((l|0)<0)<<31>>31;break e}case 11:{A=(n[u>>2]|0)+3&-4,l=n[A>>2]|0,n[u>>2]=A+4,A=o,n[A>>2]=l,n[A+4>>2]=0;break e}case 12:{A=(n[u>>2]|0)+7&-8,l=A,d=n[l>>2]|0,l=n[l+4>>2]|0,n[u>>2]=A+8,A=o,n[A>>2]=d,n[A+4>>2]=l;break e}case 13:{d=(n[u>>2]|0)+3&-4,A=n[d>>2]|0,n[u>>2]=d+4,A=(A&65535)<<16>>16,d=o,n[d>>2]=A,n[d+4>>2]=((A|0)<0)<<31>>31;break e}case 14:{d=(n[u>>2]|0)+3&-4,A=n[d>>2]|0,n[u>>2]=d+4,d=o,n[d>>2]=A&65535,n[d+4>>2]=0;break e}case 15:{d=(n[u>>2]|0)+3&-4,A=n[d>>2]|0,n[u>>2]=d+4,A=(A&255)<<24>>24,d=o,n[d>>2]=A,n[d+4>>2]=((A|0)<0)<<31>>31;break e}case 16:{d=(n[u>>2]|0)+3&-4,A=n[d>>2]|0,n[u>>2]=d+4,d=o,n[d>>2]=A&255,n[d+4>>2]=0;break e}case 17:{d=(n[u>>2]|0)+7&-8,m=+E[d>>3],n[u>>2]=d+8,E[o>>3]=m;break e}case 18:{d=(n[u>>2]|0)+7&-8,m=+E[d>>3],n[u>>2]=d+8,E[o>>3]=m;break e}default:break e}while(!1);while(!1)}function YYe(o,l,u,A){if(o=o|0,l=l|0,u=u|0,A=A|0,!((o|0)==0&(l|0)==0))do u=u+-1|0,s[u>>0]=c[5694+(o&15)>>0]|0|A,o=ix(o|0,l|0,4)|0,l=Ee;while(!((o|0)==0&(l|0)==0));return u|0}function VYe(o,l,u){if(o=o|0,l=l|0,u=u|0,!((o|0)==0&(l|0)==0))do u=u+-1|0,s[u>>0]=o&7|48,o=ix(o|0,l|0,3)|0,l=Ee;while(!((o|0)==0&(l|0)==0));return u|0}function Xy(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;if(l>>>0>0|(l|0)==0&o>>>0>4294967295){for(;A=w_(o|0,l|0,10,0)|0,u=u+-1|0,s[u>>0]=A&255|48,A=o,o=C_(o|0,l|0,10,0)|0,l>>>0>9|(l|0)==9&A>>>0>4294967295;)l=Ee;l=o}else l=o;if(l)for(;u=u+-1|0,s[u>>0]=(l>>>0)%10|0|48,!(l>>>0<10);)l=(l>>>0)/10|0;return u|0}function KYe(o){return o=o|0,tVe(o,n[(eVe()|0)+188>>2]|0)|0}function JYe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;m=l&255,A=(u|0)!=0;e:do if(A&(o&3|0)!=0)for(d=l&255;;){if((s[o>>0]|0)==d<<24>>24){B=6;break e}if(o=o+1|0,u=u+-1|0,A=(u|0)!=0,!(A&(o&3|0)!=0)){B=5;break}}else B=5;while(!1);(B|0)==5&&(A?B=6:u=0);e:do if((B|0)==6&&(d=l&255,(s[o>>0]|0)!=d<<24>>24)){A=_e(m,16843009)|0;t:do if(u>>>0>3){for(;m=n[o>>2]^A,!((m&-2139062144^-2139062144)&m+-16843009|0);)if(o=o+4|0,u=u+-4|0,u>>>0<=3){B=11;break t}}else B=11;while(!1);if((B|0)==11&&!u){u=0;break}for(;;){if((s[o>>0]|0)==d<<24>>24)break e;if(o=o+1|0,u=u+-1|0,!u){u=0;break}}}while(!1);return(u|0?o:0)|0}function Ms(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0;if(B=I,I=I+256|0,m=B,(u|0)>(A|0)&(d&73728|0)==0){if(d=u-A|0,eE(m|0,l|0,(d>>>0<256?d:256)|0)|0,d>>>0>255){l=u-A|0;do Ss(o,m,256),d=d+-256|0;while(d>>>0>255);d=l&255}Ss(o,m,d)}I=B}function o$(o,l){return o=o|0,l=l|0,o?o=XYe(o,l,0)|0:o=0,o|0}function zYe(o,l,u,A,d,m){o=o|0,l=+l,u=u|0,A=A|0,d=d|0,m=m|0;var B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0,Qe=0,tt=0,Ze=0,ct=0,He=0,Ge=0,Lt=0,qr=0,fr=0,$t=0,Tr=0,Hr=0,cr=0,Hn=0;Hn=I,I=I+560|0,T=Hn+8|0,tt=Hn,cr=Hn+524|0,Hr=cr,_=Hn+512|0,n[tt>>2]=0,Tr=_+12|0,a$(l)|0,(Ee|0)<0?(l=-l,fr=1,qr=5659):(fr=(d&2049|0)!=0&1,qr=d&2048|0?5662:d&1|0?5665:5660),a$(l)|0,$t=Ee&2146435072;do if($t>>>0<2146435072|($t|0)==2146435072&!1){if(We=+ZYe(l,tt)*2,B=We!=0,B&&(n[tt>>2]=(n[tt>>2]|0)+-1),ct=m|32,(ct|0)==97){Le=m&32,ae=Le|0?qr+9|0:qr,G=fr|2,B=12-A|0;do if(A>>>0>11|(B|0)==0)l=We;else{l=8;do B=B+-1|0,l=l*16;while(B|0);if((s[ae>>0]|0)==45){l=-(l+(-We-l));break}else{l=We+l-l;break}}while(!1);k=n[tt>>2]|0,B=(k|0)<0?0-k|0:k,B=Xy(B,((B|0)<0)<<31>>31,Tr)|0,(B|0)==(Tr|0)&&(B=_+11|0,s[B>>0]=48),s[B+-1>>0]=(k>>31&2)+43,M=B+-2|0,s[M>>0]=m+15,_=(A|0)<1,T=(d&8|0)==0,B=cr;do $t=~~l,k=B+1|0,s[B>>0]=c[5694+$t>>0]|Le,l=(l-+($t|0))*16,(k-Hr|0)==1&&!(T&(_&l==0))?(s[k>>0]=46,B=B+2|0):B=k;while(l!=0);$t=B-Hr|0,Hr=Tr-M|0,Tr=(A|0)!=0&($t+-2|0)<(A|0)?A+2|0:$t,B=Hr+G+Tr|0,Ms(o,32,u,B,d),Ss(o,ae,G),Ms(o,48,u,B,d^65536),Ss(o,cr,$t),Ms(o,48,Tr-$t|0,0,0),Ss(o,M,Hr),Ms(o,32,u,B,d^8192);break}k=(A|0)<0?6:A,B?(B=(n[tt>>2]|0)+-28|0,n[tt>>2]=B,l=We*268435456):(l=We,B=n[tt>>2]|0),$t=(B|0)<0?T:T+288|0,T=$t;do Ge=~~l>>>0,n[T>>2]=Ge,T=T+4|0,l=(l-+(Ge>>>0))*1e9;while(l!=0);if((B|0)>0)for(_=$t,G=T;;){if(M=(B|0)<29?B:29,B=G+-4|0,B>>>0>=_>>>0){T=0;do He=p$(n[B>>2]|0,0,M|0)|0,He=I_(He|0,Ee|0,T|0,0)|0,Ge=Ee,Ze=w_(He|0,Ge|0,1e9,0)|0,n[B>>2]=Ze,T=C_(He|0,Ge|0,1e9,0)|0,B=B+-4|0;while(B>>>0>=_>>>0);T&&(_=_+-4|0,n[_>>2]=T)}for(T=G;!(T>>>0<=_>>>0);)if(B=T+-4|0,!(n[B>>2]|0))T=B;else break;if(B=(n[tt>>2]|0)-M|0,n[tt>>2]=B,(B|0)>0)G=T;else break}else _=$t;if((B|0)<0){A=((k+25|0)/9|0)+1|0,Qe=(ct|0)==102;do{if(Le=0-B|0,Le=(Le|0)<9?Le:9,_>>>0>>0){M=(1<>>Le,ae=0,B=_;do Ge=n[B>>2]|0,n[B>>2]=(Ge>>>Le)+ae,ae=_e(Ge&M,G)|0,B=B+4|0;while(B>>>0>>0);B=n[_>>2]|0?_:_+4|0,ae?(n[T>>2]=ae,_=B,B=T+4|0):(_=B,B=T)}else _=n[_>>2]|0?_:_+4|0,B=T;T=Qe?$t:_,T=(B-T>>2|0)>(A|0)?T+(A<<2)|0:B,B=(n[tt>>2]|0)+Le|0,n[tt>>2]=B}while((B|0)<0);B=_,A=T}else B=_,A=T;if(Ge=$t,B>>>0>>0){if(T=(Ge-B>>2)*9|0,M=n[B>>2]|0,M>>>0>=10){_=10;do _=_*10|0,T=T+1|0;while(M>>>0>=_>>>0)}}else T=0;if(Qe=(ct|0)==103,Ze=(k|0)!=0,_=k-((ct|0)!=102?T:0)+((Ze&Qe)<<31>>31)|0,(_|0)<(((A-Ge>>2)*9|0)+-9|0)){if(_=_+9216|0,Le=$t+4+(((_|0)/9|0)+-1024<<2)|0,_=((_|0)%9|0)+1|0,(_|0)<9){M=10;do M=M*10|0,_=_+1|0;while((_|0)!=9)}else M=10;if(G=n[Le>>2]|0,ae=(G>>>0)%(M>>>0)|0,_=(Le+4|0)==(A|0),_&(ae|0)==0)_=Le;else if(We=((G>>>0)/(M>>>0)|0)&1|0?9007199254740994:9007199254740992,He=(M|0)/2|0,l=ae>>>0>>0?.5:_&(ae|0)==(He|0)?1:1.5,fr&&(He=(s[qr>>0]|0)==45,l=He?-l:l,We=He?-We:We),_=G-ae|0,n[Le>>2]=_,We+l!=We){if(He=_+M|0,n[Le>>2]=He,He>>>0>999999999)for(T=Le;_=T+-4|0,n[T>>2]=0,_>>>0>>0&&(B=B+-4|0,n[B>>2]=0),He=(n[_>>2]|0)+1|0,n[_>>2]=He,He>>>0>999999999;)T=_;else _=Le;if(T=(Ge-B>>2)*9|0,G=n[B>>2]|0,G>>>0>=10){M=10;do M=M*10|0,T=T+1|0;while(G>>>0>=M>>>0)}}else _=Le;_=_+4|0,_=A>>>0>_>>>0?_:A,He=B}else _=A,He=B;for(ct=_;;){if(ct>>>0<=He>>>0){tt=0;break}if(B=ct+-4|0,!(n[B>>2]|0))ct=B;else{tt=1;break}}A=0-T|0;do if(Qe)if(B=((Ze^1)&1)+k|0,(B|0)>(T|0)&(T|0)>-5?(M=m+-1|0,k=B+-1-T|0):(M=m+-2|0,k=B+-1|0),B=d&8,B)Le=B;else{if(tt&&(Lt=n[ct+-4>>2]|0,(Lt|0)!=0))if((Lt>>>0)%10|0)_=0;else{_=0,B=10;do B=B*10|0,_=_+1|0;while(!((Lt>>>0)%(B>>>0)|0|0))}else _=9;if(B=((ct-Ge>>2)*9|0)+-9|0,(M|32|0)==102){Le=B-_|0,Le=(Le|0)>0?Le:0,k=(k|0)<(Le|0)?k:Le,Le=0;break}else{Le=B+T-_|0,Le=(Le|0)>0?Le:0,k=(k|0)<(Le|0)?k:Le,Le=0;break}}else M=m,Le=d&8;while(!1);if(Qe=k|Le,G=(Qe|0)!=0&1,ae=(M|32|0)==102,ae)Ze=0,B=(T|0)>0?T:0;else{if(B=(T|0)<0?A:T,B=Xy(B,((B|0)<0)<<31>>31,Tr)|0,_=Tr,(_-B|0)<2)do B=B+-1|0,s[B>>0]=48;while((_-B|0)<2);s[B+-1>>0]=(T>>31&2)+43,B=B+-2|0,s[B>>0]=M,Ze=B,B=_-B|0}if(B=fr+1+k+G+B|0,Ms(o,32,u,B,d),Ss(o,qr,fr),Ms(o,48,u,B,d^65536),ae){M=He>>>0>$t>>>0?$t:He,Le=cr+9|0,G=Le,ae=cr+8|0,_=M;do{if(T=Xy(n[_>>2]|0,0,Le)|0,(_|0)==(M|0))(T|0)==(Le|0)&&(s[ae>>0]=48,T=ae);else if(T>>>0>cr>>>0){eE(cr|0,48,T-Hr|0)|0;do T=T+-1|0;while(T>>>0>cr>>>0)}Ss(o,T,G-T|0),_=_+4|0}while(_>>>0<=$t>>>0);if(Qe|0&&Ss(o,5710,1),_>>>0>>0&(k|0)>0)for(;;){if(T=Xy(n[_>>2]|0,0,Le)|0,T>>>0>cr>>>0){eE(cr|0,48,T-Hr|0)|0;do T=T+-1|0;while(T>>>0>cr>>>0)}if(Ss(o,T,(k|0)<9?k:9),_=_+4|0,T=k+-9|0,_>>>0>>0&(k|0)>9)k=T;else{k=T;break}}Ms(o,48,k+9|0,9,0)}else{if(Qe=tt?ct:He+4|0,(k|0)>-1){tt=cr+9|0,Le=(Le|0)==0,A=tt,G=0-Hr|0,ae=cr+8|0,M=He;do{T=Xy(n[M>>2]|0,0,tt)|0,(T|0)==(tt|0)&&(s[ae>>0]=48,T=ae);do if((M|0)==(He|0)){if(_=T+1|0,Ss(o,T,1),Le&(k|0)<1){T=_;break}Ss(o,5710,1),T=_}else{if(T>>>0<=cr>>>0)break;eE(cr|0,48,T+G|0)|0;do T=T+-1|0;while(T>>>0>cr>>>0)}while(!1);Hr=A-T|0,Ss(o,T,(k|0)>(Hr|0)?Hr:k),k=k-Hr|0,M=M+4|0}while(M>>>0>>0&(k|0)>-1)}Ms(o,48,k+18|0,18,0),Ss(o,Ze,Tr-Ze|0)}Ms(o,32,u,B,d^8192)}else cr=(m&32|0)!=0,B=fr+3|0,Ms(o,32,u,B,d&-65537),Ss(o,qr,fr),Ss(o,l!=l|!1?cr?5686:5690:cr?5678:5682,3),Ms(o,32,u,B,d^8192);while(!1);return I=Hn,((B|0)<(u|0)?u:B)|0}function a$(o){o=+o;var l=0;return E[S>>3]=o,l=n[S>>2]|0,Ee=n[S+4>>2]|0,l|0}function ZYe(o,l){return o=+o,l=l|0,+ +l$(o,l)}function l$(o,l){o=+o,l=l|0;var u=0,A=0,d=0;switch(E[S>>3]=o,u=n[S>>2]|0,A=n[S+4>>2]|0,d=ix(u|0,A|0,52)|0,d&2047){case 0:{o!=0?(o=+l$(o*18446744073709552e3,l),u=(n[l>>2]|0)+-64|0):u=0,n[l>>2]=u;break}case 2047:break;default:n[l>>2]=(d&2047)+-1022,n[S>>2]=u,n[S+4>>2]=A&-2146435073|1071644672,o=+E[S>>3]}return+o}function XYe(o,l,u){o=o|0,l=l|0,u=u|0;do if(o){if(l>>>0<128){s[o>>0]=l,o=1;break}if(!(n[n[($Ye()|0)+188>>2]>>2]|0))if((l&-128|0)==57216){s[o>>0]=l,o=1;break}else{n[(Zy()|0)>>2]=84,o=-1;break}if(l>>>0<2048){s[o>>0]=l>>>6|192,s[o+1>>0]=l&63|128,o=2;break}if(l>>>0<55296|(l&-8192|0)==57344){s[o>>0]=l>>>12|224,s[o+1>>0]=l>>>6&63|128,s[o+2>>0]=l&63|128,o=3;break}if((l+-65536|0)>>>0<1048576){s[o>>0]=l>>>18|240,s[o+1>>0]=l>>>12&63|128,s[o+2>>0]=l>>>6&63|128,s[o+3>>0]=l&63|128,o=4;break}else{n[(Zy()|0)>>2]=84,o=-1;break}}else o=1;while(!1);return o|0}function $Ye(){return m_()|0}function eVe(){return m_()|0}function tVe(o,l){o=o|0,l=l|0;var u=0,A=0;for(A=0;;){if((c[5712+A>>0]|0)==(o|0)){o=2;break}if(u=A+1|0,(u|0)==87){u=5800,A=87,o=5;break}else A=u}if((o|0)==2&&(A?(u=5800,o=5):u=5800),(o|0)==5)for(;;){do o=u,u=u+1|0;while(s[o>>0]|0);if(A=A+-1|0,A)o=5;else break}return rVe(u,n[l+20>>2]|0)|0}function rVe(o,l){return o=o|0,l=l|0,nVe(o,l)|0}function nVe(o,l){return o=o|0,l=l|0,l?l=iVe(n[l>>2]|0,n[l+4>>2]|0,o)|0:l=0,(l|0?l:o)|0}function iVe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0;ae=(n[o>>2]|0)+1794895138|0,m=pd(n[o+8>>2]|0,ae)|0,A=pd(n[o+12>>2]|0,ae)|0,d=pd(n[o+16>>2]|0,ae)|0;e:do if(m>>>0>>2>>>0&&(G=l-(m<<2)|0,A>>>0>>0&d>>>0>>0)&&!((d|A)&3|0)){for(G=A>>>2,M=d>>>2,_=0;;){if(k=m>>>1,T=_+k|0,B=T<<1,d=B+G|0,A=pd(n[o+(d<<2)>>2]|0,ae)|0,d=pd(n[o+(d+1<<2)>>2]|0,ae)|0,!(d>>>0>>0&A>>>0<(l-d|0)>>>0)){A=0;break e}if(s[o+(d+A)>>0]|0){A=0;break e}if(A=r$(u,o+d|0)|0,!A)break;if(A=(A|0)<0,(m|0)==1){A=0;break e}else _=A?_:T,m=A?k:m-k|0}A=B+M|0,d=pd(n[o+(A<<2)>>2]|0,ae)|0,A=pd(n[o+(A+1<<2)>>2]|0,ae)|0,A>>>0>>0&d>>>0<(l-A|0)>>>0?A=s[o+(A+d)>>0]|0?0:o+A|0:A=0}else A=0;while(!1);return A|0}function pd(o,l){o=o|0,l=l|0;var u=0;return u=d$(o|0)|0,(l|0?u:o)|0}function sVe(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0,k=0;A=u+16|0,d=n[A>>2]|0,d?m=5:oVe(u)|0?A=0:(d=n[A>>2]|0,m=5);e:do if((m|0)==5){if(k=u+20|0,B=n[k>>2]|0,A=B,(d-B|0)>>>0>>0){A=ox[n[u+36>>2]&7](u,o,l)|0;break}t:do if((s[u+75>>0]|0)>-1){for(B=l;;){if(!B){m=0,d=o;break t}if(d=B+-1|0,(s[o+d>>0]|0)==10)break;B=d}if(A=ox[n[u+36>>2]&7](u,o,B)|0,A>>>0>>0)break e;m=B,d=o+B|0,l=l-B|0,A=n[k>>2]|0}else m=0,d=o;while(!1);Qr(A|0,d|0,l|0)|0,n[k>>2]=(n[k>>2]|0)+l,A=m+l|0}while(!1);return A|0}function oVe(o){o=o|0;var l=0,u=0;return l=o+74|0,u=s[l>>0]|0,s[l>>0]=u+255|u,l=n[o>>2]|0,l&8?(n[o>>2]=l|32,o=-1):(n[o+8>>2]=0,n[o+4>>2]=0,u=n[o+44>>2]|0,n[o+28>>2]=u,n[o+20>>2]=u,n[o+16>>2]=u+(n[o+48>>2]|0),o=0),o|0}function $n(o,l){o=y(o),l=y(l);var u=0,A=0;u=c$(o)|0;do if((u&2147483647)>>>0<=2139095040){if(A=c$(l)|0,(A&2147483647)>>>0<=2139095040)if((A^u|0)<0){o=(u|0)<0?l:o;break}else{o=o>2]=o,n[S>>2]|0|0}function hd(o,l){o=y(o),l=y(l);var u=0,A=0;u=u$(o)|0;do if((u&2147483647)>>>0<=2139095040){if(A=u$(l)|0,(A&2147483647)>>>0<=2139095040)if((A^u|0)<0){o=(u|0)<0?o:l;break}else{o=o>2]=o,n[S>>2]|0|0}function E_(o,l){o=y(o),l=y(l);var u=0,A=0,d=0,m=0,B=0,k=0,T=0,_=0;m=(h[S>>2]=o,n[S>>2]|0),k=(h[S>>2]=l,n[S>>2]|0),u=m>>>23&255,B=k>>>23&255,T=m&-2147483648,d=k<<1;e:do if(d|0&&!((u|0)==255|((aVe(l)|0)&2147483647)>>>0>2139095040)){if(A=m<<1,A>>>0<=d>>>0)return l=y(o*y(0)),y((A|0)==(d|0)?l:o);if(u)A=m&8388607|8388608;else{if(u=m<<9,(u|0)>-1){A=u,u=0;do u=u+-1|0,A=A<<1;while((A|0)>-1)}else u=0;A=m<<1-u}if(B)k=k&8388607|8388608;else{if(m=k<<9,(m|0)>-1){d=0;do d=d+-1|0,m=m<<1;while((m|0)>-1)}else d=0;B=d,k=k<<1-d}d=A-k|0,m=(d|0)>-1;t:do if((u|0)>(B|0)){for(;;){if(m)if(d)A=d;else break;if(A=A<<1,u=u+-1|0,d=A-k|0,m=(d|0)>-1,(u|0)<=(B|0))break t}l=y(o*y(0));break e}while(!1);if(m)if(d)A=d;else{l=y(o*y(0));break}if(A>>>0<8388608)do A=A<<1,u=u+-1|0;while(A>>>0<8388608);(u|0)>0?u=A+-8388608|u<<23:u=A>>>(1-u|0),l=(n[S>>2]=u|T,y(h[S>>2]))}else _=3;while(!1);return(_|0)==3&&(l=y(o*l),l=y(l/l)),y(l)}function aVe(o){return o=y(o),h[S>>2]=o,n[S>>2]|0|0}function lVe(o,l){return o=o|0,l=l|0,n$(n[582]|0,o,l)|0}function sn(o){o=o|0,Nt()}function $y(o){o=o|0}function cVe(o,l){return o=o|0,l=l|0,0}function uVe(o){return o=o|0,(f$(o+4|0)|0)==-1?(op[n[(n[o>>2]|0)+8>>2]&127](o),o=1):o=0,o|0}function f$(o){o=o|0;var l=0;return l=n[o>>2]|0,n[o>>2]=l+-1,l+-1|0}function Yh(o){o=o|0,uVe(o)|0&&fVe(o)}function fVe(o){o=o|0;var l=0;l=o+8|0,n[l>>2]|0&&(f$(l)|0)!=-1||op[n[(n[o>>2]|0)+16>>2]&127](o)}function Jt(o){o=o|0;var l=0;for(l=o|0?o:1;o=ex(l)|0,!(o|0);){if(o=pVe()|0,!o){o=0;break}D$[o&0]()}return o|0}function A$(o){return o=o|0,Jt(o)|0}function yt(o){o=o|0,tx(o)}function AVe(o){o=o|0,(s[o+11>>0]|0)<0&&yt(n[o>>2]|0)}function pVe(){var o=0;return o=n[2923]|0,n[2923]=o+0,o|0}function hVe(){}function nx(o,l,u,A){return o=o|0,l=l|0,u=u|0,A=A|0,A=l-A-(u>>>0>o>>>0|0)>>>0,Ee=A,o-u>>>0|0|0}function I_(o,l,u,A){return o=o|0,l=l|0,u=u|0,A=A|0,u=o+u>>>0,Ee=l+A+(u>>>0>>0|0)>>>0,u|0|0}function eE(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0,B=0;if(m=o+u|0,l=l&255,(u|0)>=67){for(;o&3;)s[o>>0]=l,o=o+1|0;for(A=m&-4|0,d=A-64|0,B=l|l<<8|l<<16|l<<24;(o|0)<=(d|0);)n[o>>2]=B,n[o+4>>2]=B,n[o+8>>2]=B,n[o+12>>2]=B,n[o+16>>2]=B,n[o+20>>2]=B,n[o+24>>2]=B,n[o+28>>2]=B,n[o+32>>2]=B,n[o+36>>2]=B,n[o+40>>2]=B,n[o+44>>2]=B,n[o+48>>2]=B,n[o+52>>2]=B,n[o+56>>2]=B,n[o+60>>2]=B,o=o+64|0;for(;(o|0)<(A|0);)n[o>>2]=B,o=o+4|0}for(;(o|0)<(m|0);)s[o>>0]=l,o=o+1|0;return m-u|0}function p$(o,l,u){return o=o|0,l=l|0,u=u|0,(u|0)<32?(Ee=l<>>32-u,o<>>u,o>>>u|(l&(1<>>u-32|0)}function Qr(o,l,u){o=o|0,l=l|0,u=u|0;var A=0,d=0,m=0;if((u|0)>=8192)return MA(o|0,l|0,u|0)|0;if(m=o|0,d=o+u|0,(o&3)==(l&3)){for(;o&3;){if(!u)return m|0;s[o>>0]=s[l>>0]|0,o=o+1|0,l=l+1|0,u=u-1|0}for(u=d&-4|0,A=u-64|0;(o|0)<=(A|0);)n[o>>2]=n[l>>2],n[o+4>>2]=n[l+4>>2],n[o+8>>2]=n[l+8>>2],n[o+12>>2]=n[l+12>>2],n[o+16>>2]=n[l+16>>2],n[o+20>>2]=n[l+20>>2],n[o+24>>2]=n[l+24>>2],n[o+28>>2]=n[l+28>>2],n[o+32>>2]=n[l+32>>2],n[o+36>>2]=n[l+36>>2],n[o+40>>2]=n[l+40>>2],n[o+44>>2]=n[l+44>>2],n[o+48>>2]=n[l+48>>2],n[o+52>>2]=n[l+52>>2],n[o+56>>2]=n[l+56>>2],n[o+60>>2]=n[l+60>>2],o=o+64|0,l=l+64|0;for(;(o|0)<(u|0);)n[o>>2]=n[l>>2],o=o+4|0,l=l+4|0}else for(u=d-4|0;(o|0)<(u|0);)s[o>>0]=s[l>>0]|0,s[o+1>>0]=s[l+1>>0]|0,s[o+2>>0]=s[l+2>>0]|0,s[o+3>>0]=s[l+3>>0]|0,o=o+4|0,l=l+4|0;for(;(o|0)<(d|0);)s[o>>0]=s[l>>0]|0,o=o+1|0,l=l+1|0;return m|0}function h$(o){o=o|0;var l=0;return l=s[N+(o&255)>>0]|0,(l|0)<8?l|0:(l=s[N+(o>>8&255)>>0]|0,(l|0)<8?l+8|0:(l=s[N+(o>>16&255)>>0]|0,(l|0)<8?l+16|0:(s[N+(o>>>24)>>0]|0)+24|0))}function g$(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0;var m=0,B=0,k=0,T=0,_=0,M=0,G=0,ae=0,We=0,Le=0;if(M=o,T=l,_=T,B=u,ae=A,k=ae,!_)return m=(d|0)!=0,k?m?(n[d>>2]=o|0,n[d+4>>2]=l&0,ae=0,d=0,Ee=ae,d|0):(ae=0,d=0,Ee=ae,d|0):(m&&(n[d>>2]=(M>>>0)%(B>>>0),n[d+4>>2]=0),ae=0,d=(M>>>0)/(B>>>0)>>>0,Ee=ae,d|0);m=(k|0)==0;do if(B){if(!m){if(m=(b(k|0)|0)-(b(_|0)|0)|0,m>>>0<=31){G=m+1|0,k=31-m|0,l=m-31>>31,B=G,o=M>>>(G>>>0)&l|_<>>(G>>>0)&l,m=0,k=M<>2]=o|0,n[d+4>>2]=T|l&0,ae=0,d=0,Ee=ae,d|0):(ae=0,d=0,Ee=ae,d|0)}if(m=B-1|0,m&B|0){k=(b(B|0)|0)+33-(b(_|0)|0)|0,Le=64-k|0,G=32-k|0,T=G>>31,We=k-32|0,l=We>>31,B=k,o=G-1>>31&_>>>(We>>>0)|(_<>>(k>>>0))&l,l=l&_>>>(k>>>0),m=M<>>(We>>>0))&T|M<>31;break}return d|0&&(n[d>>2]=m&M,n[d+4>>2]=0),(B|0)==1?(We=T|l&0,Le=o|0|0,Ee=We,Le|0):(Le=h$(B|0)|0,We=_>>>(Le>>>0)|0,Le=_<<32-Le|M>>>(Le>>>0)|0,Ee=We,Le|0)}else{if(m)return d|0&&(n[d>>2]=(_>>>0)%(B>>>0),n[d+4>>2]=0),We=0,Le=(_>>>0)/(B>>>0)>>>0,Ee=We,Le|0;if(!M)return d|0&&(n[d>>2]=0,n[d+4>>2]=(_>>>0)%(k>>>0)),We=0,Le=(_>>>0)/(k>>>0)>>>0,Ee=We,Le|0;if(m=k-1|0,!(m&k))return d|0&&(n[d>>2]=o|0,n[d+4>>2]=m&_|l&0),We=0,Le=_>>>((h$(k|0)|0)>>>0),Ee=We,Le|0;if(m=(b(k|0)|0)-(b(_|0)|0)|0,m>>>0<=30){l=m+1|0,k=31-m|0,B=l,o=_<>>(l>>>0),l=_>>>(l>>>0),m=0,k=M<>2]=o|0,n[d+4>>2]=T|l&0,We=0,Le=0,Ee=We,Le|0):(We=0,Le=0,Ee=We,Le|0)}while(!1);if(!B)_=k,T=0,k=0;else{G=u|0|0,M=ae|A&0,_=I_(G|0,M|0,-1,-1)|0,u=Ee,T=k,k=0;do A=T,T=m>>>31|T<<1,m=k|m<<1,A=o<<1|A>>>31|0,ae=o>>>31|l<<1|0,nx(_|0,u|0,A|0,ae|0)|0,Le=Ee,We=Le>>31|((Le|0)<0?-1:0)<<1,k=We&1,o=nx(A|0,ae|0,We&G|0,(((Le|0)<0?-1:0)>>31|((Le|0)<0?-1:0)<<1)&M|0)|0,l=Ee,B=B-1|0;while(B|0);_=T,T=0}return B=0,d|0&&(n[d>>2]=o,n[d+4>>2]=l),We=(m|0)>>>31|(_|B)<<1|(B<<1|m>>>31)&0|T,Le=(m<<1|0)&-2|k,Ee=We,Le|0}function C_(o,l,u,A){return o=o|0,l=l|0,u=u|0,A=A|0,g$(o,l,u,A,0)|0}function Vh(o){o=o|0;var l=0,u=0;return u=o+15&-16|0,l=n[C>>2]|0,o=l+u|0,(u|0)>0&(o|0)<(l|0)|(o|0)<0?(oe()|0,pu(12),-1):(n[C>>2]=o,(o|0)>($()|0)&&!(Z()|0)?(n[C>>2]=l,pu(12),-1):l|0)}function F2(o,l,u){o=o|0,l=l|0,u=u|0;var A=0;if((l|0)<(o|0)&(o|0)<(l+u|0)){for(A=o,l=l+u|0,o=o+u|0;(u|0)>0;)o=o-1|0,l=l-1|0,u=u-1|0,s[o>>0]=s[l>>0]|0;o=A}else Qr(o,l,u)|0;return o|0}function w_(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0;var d=0,m=0;return m=I,I=I+16|0,d=m|0,g$(o,l,u,A,d)|0,I=m,Ee=n[d+4>>2]|0,n[d>>2]|0|0}function d$(o){return o=o|0,(o&255)<<24|(o>>8&255)<<16|(o>>16&255)<<8|o>>>24|0}function gVe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,m$[o&1](l|0,u|0,A|0,d|0,m|0)}function dVe(o,l,u){o=o|0,l=l|0,u=y(u),y$[o&1](l|0,y(u))}function mVe(o,l,u){o=o|0,l=l|0,u=+u,E$[o&31](l|0,+u)}function yVe(o,l,u,A){return o=o|0,l=l|0,u=y(u),A=y(A),y(I$[o&0](l|0,y(u),y(A)))}function EVe(o,l){o=o|0,l=l|0,op[o&127](l|0)}function IVe(o,l,u){o=o|0,l=l|0,u=u|0,ap[o&31](l|0,u|0)}function CVe(o,l){return o=o|0,l=l|0,dd[o&31](l|0)|0}function wVe(o,l,u,A,d){o=o|0,l=l|0,u=+u,A=+A,d=d|0,C$[o&1](l|0,+u,+A,d|0)}function BVe(o,l,u,A){o=o|0,l=l|0,u=+u,A=+A,n7e[o&1](l|0,+u,+A)}function vVe(o,l,u,A){return o=o|0,l=l|0,u=u|0,A=A|0,ox[o&7](l|0,u|0,A|0)|0}function SVe(o,l,u,A){return o=o|0,l=l|0,u=u|0,A=A|0,+i7e[o&1](l|0,u|0,A|0)}function DVe(o,l){return o=o|0,l=l|0,+w$[o&15](l|0)}function bVe(o,l,u){return o=o|0,l=l|0,u=+u,s7e[o&1](l|0,+u)|0}function PVe(o,l,u){return o=o|0,l=l|0,u=u|0,v_[o&15](l|0,u|0)|0}function xVe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=+A,d=+d,m=m|0,o7e[o&1](l|0,u|0,+A,+d,m|0)}function kVe(o,l,u,A,d,m,B){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,B=B|0,a7e[o&1](l|0,u|0,A|0,d|0,m|0,B|0)}function QVe(o,l,u){return o=o|0,l=l|0,u=u|0,+B$[o&7](l|0,u|0)}function TVe(o){return o=o|0,ax[o&7]()|0}function RVe(o,l,u,A,d,m){return o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,v$[o&1](l|0,u|0,A|0,d|0,m|0)|0}function FVe(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=+d,l7e[o&1](l|0,u|0,A|0,+d)}function NVe(o,l,u,A,d,m,B){o=o|0,l=l|0,u=u|0,A=y(A),d=d|0,m=y(m),B=B|0,S$[o&1](l|0,u|0,y(A),d|0,y(m),B|0)}function OVe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,L2[o&15](l|0,u|0,A|0)}function LVe(o){o=o|0,D$[o&0]()}function MVe(o,l,u,A){o=o|0,l=l|0,u=u|0,A=+A,b$[o&15](l|0,u|0,+A)}function _Ve(o,l,u){return o=o|0,l=+l,u=+u,c7e[o&1](+l,+u)|0}function UVe(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,S_[o&15](l|0,u|0,A|0,d|0)}function HVe(o,l,u,A,d){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,F(0)}function jVe(o,l){o=o|0,l=y(l),F(1)}function Xa(o,l){o=o|0,l=+l,F(2)}function qVe(o,l,u){return o=o|0,l=y(l),u=y(u),F(3),Xe}function wr(o){o=o|0,F(4)}function N2(o,l){o=o|0,l=l|0,F(5)}function Ll(o){return o=o|0,F(6),0}function GVe(o,l,u,A){o=o|0,l=+l,u=+u,A=A|0,F(7)}function WVe(o,l,u){o=o|0,l=+l,u=+u,F(8)}function YVe(o,l,u){return o=o|0,l=l|0,u=u|0,F(9),0}function VVe(o,l,u){return o=o|0,l=l|0,u=u|0,F(10),0}function gd(o){return o=o|0,F(11),0}function KVe(o,l){return o=o|0,l=+l,F(12),0}function O2(o,l){return o=o|0,l=l|0,F(13),0}function JVe(o,l,u,A,d){o=o|0,l=l|0,u=+u,A=+A,d=d|0,F(14)}function zVe(o,l,u,A,d,m){o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,m=m|0,F(15)}function B_(o,l){return o=o|0,l=l|0,F(16),0}function ZVe(){return F(17),0}function XVe(o,l,u,A,d){return o=o|0,l=l|0,u=u|0,A=A|0,d=d|0,F(18),0}function $Ve(o,l,u,A){o=o|0,l=l|0,u=u|0,A=+A,F(19)}function e7e(o,l,u,A,d,m){o=o|0,l=l|0,u=y(u),A=A|0,d=y(d),m=m|0,F(20)}function sx(o,l,u){o=o|0,l=l|0,u=u|0,F(21)}function t7e(){F(22)}function tE(o,l,u){o=o|0,l=l|0,u=+u,F(23)}function r7e(o,l){return o=+o,l=+l,F(24),0}function rE(o,l,u,A){o=o|0,l=l|0,u=u|0,A=A|0,F(25)}var m$=[HVe,XGe],y$=[jVe,Ty],E$=[Xa,$g,Lh,m2,y2,E2,I2,Pf,Uy,C2,xf,ed,td,w2,B2,vu,rd,v2,Hy,Xa,Xa,Xa,Xa,Xa,Xa,Xa,Xa,Xa,Xa,Xa,Xa,Xa],I$=[qVe],op=[wr,$y,TLe,RLe,FLe,c4e,u4e,f4e,bqe,Pqe,xqe,_Ge,UGe,HGe,aYe,lYe,cYe,vl,Xg,p2,sr,gc,qP,GP,wLe,jLe,eMe,yMe,FMe,ZMe,h_e,x_e,G_e,oUe,wUe,MUe,e4e,P4e,G4e,o3e,w3e,M3e,e8e,E8e,F8e,K8e,uHe,kP,HHe,nje,wje,Uje,t6e,w6e,T6e,N6e,X6e,tqe,yqe,Qqe,Fqe,Zqe,gGe,nZ,z5e,b9e,j9e,nWe,SWe,UWe,ZWe,eYe,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr,wr],ap=[N2,Ly,nM,h2,g2,xr,oo,Zi,Os,Bs,_y,Oh,D2,NP,sd,oM,aM,OP,LP,uM,kf,ne,B8e,L8e,Gje,$5e,BGe,HX,N2,N2,N2,N2],dd=[Ll,MYe,Ny,id,qy,da,QP,Mh,S2,sM,RP,Gy,MP,fM,Vy,pHe,s6e,eGe,n9e,Fl,Ll,Ll,Ll,Ll,Ll,Ll,Ll,Ll,Ll,Ll,Ll,Ll],C$=[GVe,dM],n7e=[WVe,Cqe],ox=[YVe,t$,_Ye,jYe,t_e,T4e,WHe,aWe],i7e=[VVe,DUe],w$=[gd,_h,FP,tp,mM,v,D,Q,H,V,gd,gd,gd,gd,gd,gd],s7e=[KVe,x6e],v_=[O2,cVe,_P,DLe,wMe,m_e,T_e,i4e,K4e,X8e,Ry,Y9e,O2,O2,O2,O2],o7e=[JVe,iMe],a7e=[zVe,xWe],B$=[B_,lM,Se,Ue,At,jUe,B_,B_],ax=[ZVe,Gt,Fy,xP,_6e,sqe,Mqe,iYe],v$=[XVe,Sy],l7e=[$Ve,D3e],S$=[e7e,AM],L2=[sx,To,TP,cM,Du,MMe,V_e,j3e,i8e,rM,C5e,Q9e,GWe,sx,sx,sx],D$=[t7e],b$=[tE,iM,My,ep,d2,Su,jy,nd,u3e,aje,S6e,tE,tE,tE,tE,tE],c7e=[r7e,Sqe],S_=[rE,uUe,CHe,Dje,h6e,W6e,fqe,Wqe,IGe,c9e,gYe,rE,rE,rE,rE,rE];return{_llvm_bswap_i32:d$,dynCall_idd:_Ve,dynCall_i:TVe,_i64Subtract:nx,___udivdi3:C_,dynCall_vif:dVe,setThrew:ua,dynCall_viii:OVe,_bitshift64Lshr:ix,_bitshift64Shl:p$,dynCall_vi:EVe,dynCall_viiddi:xVe,dynCall_diii:SVe,dynCall_iii:PVe,_memset:eE,_sbrk:Vh,_memcpy:Qr,__GLOBAL__sub_I_Yoga_cpp:u2,dynCall_vii:IVe,___uremdi3:w_,dynCall_vid:mVe,stackAlloc:Ha,_nbind_init:DYe,getTempRet0:UA,dynCall_di:DVe,dynCall_iid:bVe,setTempRet0:_A,_i64Add:I_,dynCall_fiff:yVe,dynCall_iiii:vVe,_emscripten_get_global_libc:LYe,dynCall_viid:MVe,dynCall_viiid:FVe,dynCall_viififi:NVe,dynCall_ii:CVe,__GLOBAL__sub_I_Binding_cc:j5e,dynCall_viiii:UVe,dynCall_iiiiii:RVe,stackSave:gf,dynCall_viiiii:gVe,__GLOBAL__sub_I_nbind_cc:vr,dynCall_vidd:BVe,_free:tx,runPostSets:hVe,dynCall_viiiiii:kVe,establishStackSpace:wn,_memmove:F2,stackRestore:cc,_malloc:ex,__GLOBAL__sub_I_common_cc:lGe,dynCall_viddi:wVe,dynCall_dii:QVe,dynCall_v:LVe}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer),_llvm_bswap_i32=Module._llvm_bswap_i32=asm._llvm_bswap_i32,getTempRet0=Module.getTempRet0=asm.getTempRet0,___udivdi3=Module.___udivdi3=asm.___udivdi3,setThrew=Module.setThrew=asm.setThrew,_bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,_bitshift64Shl=Module._bitshift64Shl=asm._bitshift64Shl,_memset=Module._memset=asm._memset,_sbrk=Module._sbrk=asm._sbrk,_memcpy=Module._memcpy=asm._memcpy,stackAlloc=Module.stackAlloc=asm.stackAlloc,___uremdi3=Module.___uremdi3=asm.___uremdi3,_nbind_init=Module._nbind_init=asm._nbind_init,_i64Subtract=Module._i64Subtract=asm._i64Subtract,setTempRet0=Module.setTempRet0=asm.setTempRet0,_i64Add=Module._i64Add=asm._i64Add,_emscripten_get_global_libc=Module._emscripten_get_global_libc=asm._emscripten_get_global_libc,__GLOBAL__sub_I_Yoga_cpp=Module.__GLOBAL__sub_I_Yoga_cpp=asm.__GLOBAL__sub_I_Yoga_cpp,__GLOBAL__sub_I_Binding_cc=Module.__GLOBAL__sub_I_Binding_cc=asm.__GLOBAL__sub_I_Binding_cc,stackSave=Module.stackSave=asm.stackSave,__GLOBAL__sub_I_nbind_cc=Module.__GLOBAL__sub_I_nbind_cc=asm.__GLOBAL__sub_I_nbind_cc,_free=Module._free=asm._free,runPostSets=Module.runPostSets=asm.runPostSets,establishStackSpace=Module.establishStackSpace=asm.establishStackSpace,_memmove=Module._memmove=asm._memmove,stackRestore=Module.stackRestore=asm.stackRestore,_malloc=Module._malloc=asm._malloc,__GLOBAL__sub_I_common_cc=Module.__GLOBAL__sub_I_common_cc=asm.__GLOBAL__sub_I_common_cc,dynCall_viiiii=Module.dynCall_viiiii=asm.dynCall_viiiii,dynCall_vif=Module.dynCall_vif=asm.dynCall_vif,dynCall_vid=Module.dynCall_vid=asm.dynCall_vid,dynCall_fiff=Module.dynCall_fiff=asm.dynCall_fiff,dynCall_vi=Module.dynCall_vi=asm.dynCall_vi,dynCall_vii=Module.dynCall_vii=asm.dynCall_vii,dynCall_ii=Module.dynCall_ii=asm.dynCall_ii,dynCall_viddi=Module.dynCall_viddi=asm.dynCall_viddi,dynCall_vidd=Module.dynCall_vidd=asm.dynCall_vidd,dynCall_iiii=Module.dynCall_iiii=asm.dynCall_iiii,dynCall_diii=Module.dynCall_diii=asm.dynCall_diii,dynCall_di=Module.dynCall_di=asm.dynCall_di,dynCall_iid=Module.dynCall_iid=asm.dynCall_iid,dynCall_iii=Module.dynCall_iii=asm.dynCall_iii,dynCall_viiddi=Module.dynCall_viiddi=asm.dynCall_viiddi,dynCall_viiiiii=Module.dynCall_viiiiii=asm.dynCall_viiiiii,dynCall_dii=Module.dynCall_dii=asm.dynCall_dii,dynCall_i=Module.dynCall_i=asm.dynCall_i,dynCall_iiiiii=Module.dynCall_iiiiii=asm.dynCall_iiiiii,dynCall_viiid=Module.dynCall_viiid=asm.dynCall_viiid,dynCall_viififi=Module.dynCall_viififi=asm.dynCall_viififi,dynCall_viii=Module.dynCall_viii=asm.dynCall_viii,dynCall_v=Module.dynCall_v=asm.dynCall_v,dynCall_viid=Module.dynCall_viid=asm.dynCall_viid,dynCall_idd=Module.dynCall_idd=asm.dynCall_idd,dynCall_viiii=Module.dynCall_viiii=asm.dynCall_viiii;Runtime.stackAlloc=Module.stackAlloc,Runtime.stackSave=Module.stackSave,Runtime.stackRestore=Module.stackRestore,Runtime.establishStackSpace=Module.establishStackSpace,Runtime.setTempRet0=Module.setTempRet0,Runtime.getTempRet0=Module.getTempRet0,Module.asm=asm;function ExitStatus(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function t(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=t)},Module.callMain=Module.callMain=function t(e){e=e||[],ensureInitRuntime();var r=e.length+1;function s(){for(var p=0;p<3;p++)a.push(0)}var a=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];s();for(var n=0;n0||(preRun(),runDependencies>0)||Module.calledRun)return;function e(){Module.calledRun||(Module.calledRun=!0,!ABORT&&(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(t),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),e()},1)):e()}Module.run=Module.run=run;function exit(t,e){e&&Module.noExitRuntime||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=t,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(t)),ENVIRONMENT_IS_NODE&&process.exit(t),Module.quit(t,new ExitStatus(t)))}Module.exit=Module.exit=exit;var abortDecorators=[];function abort(t){Module.onAbort&&Module.onAbort(t),t!==void 0?(Module.print(t),Module.printErr(t),t=JSON.stringify(t)):t="",ABORT=!0,EXITSTATUS=1;var e=` +If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,r="abort("+t+") at "+stackTrace()+e;throw abortDecorators&&abortDecorators.forEach(function(s){r=s(r,t)}),r}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var Nm=L((Khr,KDe)=>{"use strict";var $Pt=YDe(),ext=VDe(),PW=!1,xW=null;ext({},function(t,e){if(!PW){if(PW=!0,t)throw t;xW=e}});if(!PW)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");KDe.exports=$Pt(xW.bind,xW.lib)});var QW=L((Jhr,kW)=>{"use strict";var JDe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);kW.exports=JDe;kW.exports.default=JDe});var ZDe=L((zhr,zDe)=>{"use strict";zDe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var iD=L((Zhr,TW)=>{"use strict";var txt=bk(),rxt=QW(),nxt=ZDe(),XDe=t=>{if(typeof t!="string"||t.length===0||(t=txt(t),t.length===0))return 0;t=t.replace(nxt()," ");let e=0;for(let r=0;r=127&&s<=159||s>=768&&s<=879||(s>65535&&r++,e+=rxt(s)?2:1)}return e};TW.exports=XDe;TW.exports.default=XDe});var FW=L((Xhr,RW)=>{"use strict";var ixt=iD(),$De=t=>{let e=0;for(let r of t.split(` +`))e=Math.max(e,ixt(r));return e};RW.exports=$De;RW.exports.default=$De});var ebe=L(sD=>{"use strict";var sxt=sD&&sD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sD,"__esModule",{value:!0});var oxt=sxt(FW()),NW={};sD.default=t=>{if(t.length===0)return{width:0,height:0};if(NW[t])return NW[t];let e=oxt.default(t),r=t.split(` +`).length;return NW[t]={width:e,height:r},{width:e,height:r}}});var tbe=L(oD=>{"use strict";var axt=oD&&oD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(oD,"__esModule",{value:!0});var bn=axt(Nm()),lxt=(t,e)=>{"position"in e&&t.setPositionType(e.position==="absolute"?bn.default.POSITION_TYPE_ABSOLUTE:bn.default.POSITION_TYPE_RELATIVE)},cxt=(t,e)=>{"marginLeft"in e&&t.setMargin(bn.default.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(bn.default.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(bn.default.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(bn.default.EDGE_BOTTOM,e.marginBottom||0)},uxt=(t,e)=>{"paddingLeft"in e&&t.setPadding(bn.default.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(bn.default.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(bn.default.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(bn.default.EDGE_BOTTOM,e.paddingBottom||0)},fxt=(t,e)=>{var r;"flexGrow"in e&&t.setFlexGrow((r=e.flexGrow)!==null&&r!==void 0?r:0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(bn.default.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(bn.default.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(bn.default.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(bn.default.ALIGN_FLEX_END)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(bn.default.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(bn.default.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(bn.default.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(bn.default.ALIGN_FLEX_END)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(bn.default.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(bn.default.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(bn.default.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(bn.default.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(bn.default.JUSTIFY_SPACE_AROUND))},Axt=(t,e)=>{var r,s;"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth((r=e.minWidth)!==null&&r!==void 0?r:0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight((s=e.minHeight)!==null&&s!==void 0?s:0))},pxt=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?bn.default.DISPLAY_FLEX:bn.default.DISPLAY_NONE)},hxt=(t,e)=>{if("borderStyle"in e){let r=typeof e.borderStyle=="string"?1:0;t.setBorder(bn.default.EDGE_TOP,r),t.setBorder(bn.default.EDGE_BOTTOM,r),t.setBorder(bn.default.EDGE_LEFT,r),t.setBorder(bn.default.EDGE_RIGHT,r)}};oD.default=(t,e={})=>{lxt(t,e),cxt(t,e),uxt(t,e),fxt(t,e),Axt(t,e),pxt(t,e),hxt(t,e)}});var ibe=L((t0r,nbe)=>{"use strict";var aD=iD(),gxt=bk(),dxt=IB(),LW=new Set(["\x1B","\x9B"]),mxt=39,rbe=t=>`${LW.values().next().value}[${t}m`,yxt=t=>t.split(" ").map(e=>aD(e)),OW=(t,e,r)=>{let s=[...e],a=!1,n=aD(gxt(t[t.length-1]));for(let[c,f]of s.entries()){let p=aD(f);if(n+p<=r?t[t.length-1]+=f:(t.push(f),n=0),LW.has(f))a=!0;else if(a&&f==="m"){a=!1;continue}a||(n+=p,n===r&&c0&&t.length>1&&(t[t.length-2]+=t.pop())},Ext=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(aD(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Ixt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let s="",a="",n,c=yxt(t),f=[""];for(let[p,h]of t.split(" ").entries()){r.trim!==!1&&(f[f.length-1]=f[f.length-1].trimLeft());let E=aD(f[f.length-1]);if(p!==0&&(E>=e&&(r.wordWrap===!1||r.trim===!1)&&(f.push(""),E=0),(E>0||r.trim===!1)&&(f[f.length-1]+=" ",E++)),r.hard&&c[p]>e){let C=e-E,S=1+Math.floor((c[p]-C-1)/e);Math.floor((c[p]-1)/e)e&&E>0&&c[p]>0){if(r.wordWrap===!1&&Ee&&r.wordWrap===!1){OW(f,h,e);continue}f[f.length-1]+=h}r.trim!==!1&&(f=f.map(Ext)),s=f.join(` +`);for(let[p,h]of[...s].entries()){if(a+=h,LW.has(h)){let C=parseFloat(/\d[^m]*/.exec(s.slice(p,p+4)));n=C===mxt?null:C}let E=dxt.codes.get(Number(n));n&&E&&(s[p+1]===` +`?a+=rbe(E):h===` +`&&(a+=rbe(n)))}return a};nbe.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,` +`).split(` +`).map(s=>Ixt(s,e,r)).join(` +`)});var abe=L((r0r,obe)=>{"use strict";var sbe="[\uD800-\uDBFF][\uDC00-\uDFFF]",Cxt=t=>t&&t.exact?new RegExp(`^${sbe}$`):new RegExp(sbe,"g");obe.exports=Cxt});var MW=L((n0r,fbe)=>{"use strict";var wxt=QW(),Bxt=abe(),lbe=IB(),ube=["\x1B","\x9B"],MF=t=>`${ube[0]}[${t}m`,cbe=(t,e,r)=>{let s=[];t=[...t];for(let a of t){let n=a;a.match(";")&&(a=a.split(";")[0][0]+"0");let c=lbe.codes.get(parseInt(a,10));if(c){let f=t.indexOf(c.toString());f>=0?t.splice(f,1):s.push(MF(e?c:n))}else if(e){s.push(MF(0));break}else s.push(MF(n))}if(e&&(s=s.filter((a,n)=>s.indexOf(a)===n),r!==void 0)){let a=MF(lbe.codes.get(parseInt(r,10)));s=s.reduce((n,c)=>c===a?[c,...n]:[...n,c],[])}return s.join("")};fbe.exports=(t,e,r)=>{let s=[...t.normalize()],a=[];r=typeof r=="number"?r:s.length;let n=!1,c,f=0,p="";for(let[h,E]of s.entries()){let C=!1;if(ube.includes(E)){let S=/\d[^m]*/.exec(t.slice(h,h+18));c=S&&S.length>0?S[0]:void 0,fe&&f<=r)p+=E;else if(f===e&&!n&&c!==void 0)p=cbe(a);else if(f>=r){p+=cbe(a,!0,c);break}}return p}});var pbe=L((i0r,Abe)=>{"use strict";var eg=MW(),vxt=iD();function _F(t,e,r){if(t.charAt(e)===" ")return e;for(let s=1;s<=3;s++)if(r){if(t.charAt(e+s)===" ")return e+s}else if(t.charAt(e-s)===" ")return e-s;return e}Abe.exports=(t,e,r)=>{r={position:"end",preferTruncationOnSpace:!1,...r};let{position:s,space:a,preferTruncationOnSpace:n}=r,c="\u2026",f=1;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof e}`);if(e<1)return"";if(e===1)return c;let p=vxt(t);if(p<=e)return t;if(s==="start"){if(n){let h=_F(t,p-e+1,!0);return c+eg(t,h,p).trim()}return a===!0&&(c+=" ",f=2),c+eg(t,p-e+f,p)}if(s==="middle"){a===!0&&(c=" "+c+" ",f=3);let h=Math.floor(e/2);if(n){let E=_F(t,h),C=_F(t,p-(e-h)+1,!0);return eg(t,0,E)+c+eg(t,C,p).trim()}return eg(t,0,h)+c+eg(t,p-(e-h)+f,p)}if(s==="end"){if(n){let h=_F(t,e-1);return eg(t,0,h)+c}return a===!0&&(c=" "+c,f=2),eg(t,0,e-f)+c}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${s}`)}});var UW=L(lD=>{"use strict";var hbe=lD&&lD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lD,"__esModule",{value:!0});var Sxt=hbe(ibe()),Dxt=hbe(pbe()),_W={};lD.default=(t,e,r)=>{let s=t+String(e)+String(r);if(_W[s])return _W[s];let a=t;if(r==="wrap"&&(a=Sxt.default(t,e,{trim:!1,hard:!0})),r.startsWith("truncate")){let n="end";r==="truncate-middle"&&(n="middle"),r==="truncate-start"&&(n="start"),a=Dxt.default(t,e,{position:n})}return _W[s]=a,a}});var jW=L(HW=>{"use strict";Object.defineProperty(HW,"__esModule",{value:!0});var gbe=t=>{let e="";if(t.childNodes.length>0)for(let r of t.childNodes){let s="";r.nodeName==="#text"?s=r.nodeValue:((r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text")&&(s=gbe(r)),s.length>0&&typeof r.internal_transform=="function"&&(s=r.internal_transform(s))),e+=s}return e};HW.default=gbe});var qW=L(Pi=>{"use strict";var cD=Pi&&Pi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.setTextNodeValue=Pi.createTextNode=Pi.setStyle=Pi.setAttribute=Pi.removeChildNode=Pi.insertBeforeNode=Pi.appendChildNode=Pi.createNode=Pi.TEXT_NAME=void 0;var bxt=cD(Nm()),dbe=cD(ebe()),Pxt=cD(tbe()),xxt=cD(UW()),kxt=cD(jW());Pi.TEXT_NAME="#text";Pi.createNode=t=>{var e;let r={nodeName:t,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:t==="ink-virtual-text"?void 0:bxt.default.Node.create()};return t==="ink-text"&&((e=r.yogaNode)===null||e===void 0||e.setMeasureFunc(Qxt.bind(null,r))),r};Pi.appendChildNode=(t,e)=>{var r;e.parentNode&&Pi.removeChildNode(e.parentNode,e),e.parentNode=t,t.childNodes.push(e),e.yogaNode&&((r=t.yogaNode)===null||r===void 0||r.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&UF(t)};Pi.insertBeforeNode=(t,e,r)=>{var s,a;e.parentNode&&Pi.removeChildNode(e.parentNode,e),e.parentNode=t;let n=t.childNodes.indexOf(r);if(n>=0){t.childNodes.splice(n,0,e),e.yogaNode&&((s=t.yogaNode)===null||s===void 0||s.insertChild(e.yogaNode,n));return}t.childNodes.push(e),e.yogaNode&&((a=t.yogaNode)===null||a===void 0||a.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&UF(t)};Pi.removeChildNode=(t,e)=>{var r,s;e.yogaNode&&((s=(r=e.parentNode)===null||r===void 0?void 0:r.yogaNode)===null||s===void 0||s.removeChild(e.yogaNode)),e.parentNode=null;let a=t.childNodes.indexOf(e);a>=0&&t.childNodes.splice(a,1),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&UF(t)};Pi.setAttribute=(t,e,r)=>{t.attributes[e]=r};Pi.setStyle=(t,e)=>{t.style=e,t.yogaNode&&Pxt.default(t.yogaNode,e)};Pi.createTextNode=t=>{let e={nodeName:"#text",nodeValue:t,yogaNode:void 0,parentNode:null,style:{}};return Pi.setTextNodeValue(e,t),e};var Qxt=function(t,e){var r,s;let a=t.nodeName==="#text"?t.nodeValue:kxt.default(t),n=dbe.default(a);if(n.width<=e||n.width>=1&&e>0&&e<1)return n;let c=(s=(r=t.style)===null||r===void 0?void 0:r.textWrap)!==null&&s!==void 0?s:"wrap",f=xxt.default(a,e,c);return dbe.default(f)},mbe=t=>{var e;if(!(!t||!t.parentNode))return(e=t.yogaNode)!==null&&e!==void 0?e:mbe(t.parentNode)},UF=t=>{let e=mbe(t);e?.markDirty()};Pi.setTextNodeValue=(t,e)=>{typeof e!="string"&&(e=String(e)),t.nodeValue=e,UF(t)}});var wbe=L(uD=>{"use strict";var Cbe=uD&&uD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uD,"__esModule",{value:!0});var ybe=SW(),Txt=Cbe(UDe()),Ebe=Cbe(Nm()),ta=qW(),Ibe=t=>{t?.unsetMeasureFunc(),t?.freeRecursive()};uD.default=Txt.default({schedulePassiveEffects:ybe.unstable_scheduleCallback,cancelPassiveEffects:ybe.unstable_cancelCallback,now:Date.now,getRootHostContext:()=>({isInsideText:!1}),prepareForCommit:()=>null,preparePortalMount:()=>null,clearContainer:()=>!1,shouldDeprioritizeSubtree:()=>!1,resetAfterCommit:t=>{if(t.isStaticDirty){t.isStaticDirty=!1,typeof t.onImmediateRender=="function"&&t.onImmediateRender();return}typeof t.onRender=="function"&&t.onRender()},getChildHostContext:(t,e)=>{let r=t.isInsideText,s=e==="ink-text"||e==="ink-virtual-text";return r===s?t:{isInsideText:s}},shouldSetTextContent:()=>!1,createInstance:(t,e,r,s)=>{if(s.isInsideText&&t==="ink-box")throw new Error(" can\u2019t be nested inside component");let a=t==="ink-text"&&s.isInsideText?"ink-virtual-text":t,n=ta.createNode(a);for(let[c,f]of Object.entries(e))c!=="children"&&(c==="style"?ta.setStyle(n,f):c==="internal_transform"?n.internal_transform=f:c==="internal_static"?n.internal_static=!0:ta.setAttribute(n,c,f));return n},createTextInstance:(t,e,r)=>{if(!r.isInsideText)throw new Error(`Text string "${t}" must be rendered inside component`);return ta.createTextNode(t)},resetTextContent:()=>{},hideTextInstance:t=>{ta.setTextNodeValue(t,"")},unhideTextInstance:(t,e)=>{ta.setTextNodeValue(t,e)},getPublicInstance:t=>t,hideInstance:t=>{var e;(e=t.yogaNode)===null||e===void 0||e.setDisplay(Ebe.default.DISPLAY_NONE)},unhideInstance:t=>{var e;(e=t.yogaNode)===null||e===void 0||e.setDisplay(Ebe.default.DISPLAY_FLEX)},appendInitialChild:ta.appendChildNode,appendChild:ta.appendChildNode,insertBefore:ta.insertBeforeNode,finalizeInitialChildren:(t,e,r,s)=>(t.internal_static&&(s.isStaticDirty=!0,s.staticNode=t),!1),supportsMutation:!0,appendChildToContainer:ta.appendChildNode,insertInContainerBefore:ta.insertBeforeNode,removeChildFromContainer:(t,e)=>{ta.removeChildNode(t,e),Ibe(e.yogaNode)},prepareUpdate:(t,e,r,s,a)=>{t.internal_static&&(a.isStaticDirty=!0);let n={},c=Object.keys(s);for(let f of c)if(s[f]!==r[f]){if(f==="style"&&typeof s.style=="object"&&typeof r.style=="object"){let h=s.style,E=r.style,C=Object.keys(h);for(let S of C){if(S==="borderStyle"||S==="borderColor"){if(typeof n.style!="object"){let P={};n.style=P}n.style.borderStyle=h.borderStyle,n.style.borderColor=h.borderColor}if(h[S]!==E[S]){if(typeof n.style!="object"){let P={};n.style=P}n.style[S]=h[S]}}continue}n[f]=s[f]}return n},commitUpdate:(t,e)=>{for(let[r,s]of Object.entries(e))r!=="children"&&(r==="style"?ta.setStyle(t,s):r==="internal_transform"?t.internal_transform=s:r==="internal_static"?t.internal_static=!0:ta.setAttribute(t,r,s))},commitTextUpdate:(t,e,r)=>{ta.setTextNodeValue(t,r)},removeChild:(t,e)=>{ta.removeChildNode(t,e),Ibe(e.yogaNode)}})});var vbe=L((c0r,Bbe)=>{"use strict";Bbe.exports=(t,e=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(e===0)return t;let s=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(s,r.indent.repeat(e))}});var Sbe=L(fD=>{"use strict";var Rxt=fD&&fD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fD,"__esModule",{value:!0});var HF=Rxt(Nm());fD.default=t=>t.getComputedWidth()-t.getComputedPadding(HF.default.EDGE_LEFT)-t.getComputedPadding(HF.default.EDGE_RIGHT)-t.getComputedBorder(HF.default.EDGE_LEFT)-t.getComputedBorder(HF.default.EDGE_RIGHT)});var Dbe=L((f0r,Fxt)=>{Fxt.exports={single:{topLeft:"\u250C",topRight:"\u2510",bottomRight:"\u2518",bottomLeft:"\u2514",vertical:"\u2502",horizontal:"\u2500"},double:{topLeft:"\u2554",topRight:"\u2557",bottomRight:"\u255D",bottomLeft:"\u255A",vertical:"\u2551",horizontal:"\u2550"},round:{topLeft:"\u256D",topRight:"\u256E",bottomRight:"\u256F",bottomLeft:"\u2570",vertical:"\u2502",horizontal:"\u2500"},bold:{topLeft:"\u250F",topRight:"\u2513",bottomRight:"\u251B",bottomLeft:"\u2517",vertical:"\u2503",horizontal:"\u2501"},singleDouble:{topLeft:"\u2553",topRight:"\u2556",bottomRight:"\u255C",bottomLeft:"\u2559",vertical:"\u2551",horizontal:"\u2500"},doubleSingle:{topLeft:"\u2552",topRight:"\u2555",bottomRight:"\u255B",bottomLeft:"\u2558",vertical:"\u2502",horizontal:"\u2550"},classic:{topLeft:"+",topRight:"+",bottomRight:"+",bottomLeft:"+",vertical:"|",horizontal:"-"}}});var Pbe=L((A0r,GW)=>{"use strict";var bbe=Dbe();GW.exports=bbe;GW.exports.default=bbe});var kbe=L((p0r,xbe)=>{"use strict";var Nxt=(t,e,r)=>{let s=t.indexOf(e);if(s===-1)return t;let a=e.length,n=0,c="";do c+=t.substr(n,s-n)+e+r,n=s+a,s=t.indexOf(e,n);while(s!==-1);return c+=t.substr(n),c},Oxt=(t,e,r,s)=>{let a=0,n="";do{let c=t[s-1]==="\r";n+=t.substr(a,(c?s-1:s)-a)+e+(c?`\r +`:` +`)+r,a=s+1,s=t.indexOf(` +`,a)}while(s!==-1);return n+=t.substr(a),n};xbe.exports={stringReplaceAll:Nxt,stringEncaseCRLFWithFirstIndex:Oxt}});var Nbe=L((h0r,Fbe)=>{"use strict";var Lxt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Qbe=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Mxt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,_xt=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Uxt=new Map([["n",` +`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Rbe(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):Uxt.get(t)||t}function Hxt(t,e){let r=[],s=e.trim().split(/\s*,\s*/g),a;for(let n of s){let c=Number(n);if(!Number.isNaN(c))r.push(c);else if(a=n.match(Mxt))r.push(a[2].replace(_xt,(f,p,h)=>p?Rbe(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function jxt(t){Qbe.lastIndex=0;let e=[],r;for(;(r=Qbe.exec(t))!==null;){let s=r[1];if(r[2]){let a=Hxt(s,r[2]);e.push([s].concat(a))}else e.push([s])}return e}function Tbe(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let s=t;for(let[a,n]of Object.entries(r))if(Array.isArray(n)){if(!(a in s))throw new Error(`Unknown Chalk style: ${a}`);s=n.length>0?s[a](...n):s[a]}return s}Fbe.exports=(t,e)=>{let r=[],s=[],a=[];if(e.replace(Lxt,(n,c,f,p,h,E)=>{if(c)a.push(Rbe(c));else if(p){let C=a.join("");a=[],s.push(r.length===0?C:Tbe(t,r)(C)),r.push({inverse:f,styles:jxt(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(Tbe(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),s.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return s.join("")}});var YF=L((g0r,Hbe)=>{"use strict";var AD=IB(),{stdout:YW,stderr:VW}=c4(),{stringReplaceAll:qxt,stringEncaseCRLFWithFirstIndex:Gxt}=kbe(),{isArray:jF}=Array,Lbe=["ansi","ansi","ansi256","ansi16m"],Iw=Object.create(null),Wxt=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=YW?YW.level:0;t.level=e.level===void 0?r:e.level},KW=class{constructor(e){return Mbe(e)}},Mbe=t=>{let e={};return Wxt(e,t),e.template=(...r)=>Ube(e.template,...r),Object.setPrototypeOf(e,qF.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=KW,e.template};function qF(t){return Mbe(t)}for(let[t,e]of Object.entries(AD))Iw[t]={get(){let r=GF(this,JW(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};Iw.visible={get(){let t=GF(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var _be=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of _be)Iw[t]={get(){let{level:e}=this;return function(...r){let s=JW(AD.color[Lbe[e]][t](...r),AD.color.close,this._styler);return GF(this,s,this._isEmpty)}}};for(let t of _be){let e="bg"+t[0].toUpperCase()+t.slice(1);Iw[e]={get(){let{level:r}=this;return function(...s){let a=JW(AD.bgColor[Lbe[r]][t](...s),AD.bgColor.close,this._styler);return GF(this,a,this._isEmpty)}}}}var Yxt=Object.defineProperties(()=>{},{...Iw,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),JW=(t,e,r)=>{let s,a;return r===void 0?(s=t,a=e):(s=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:s,closeAll:a,parent:r}},GF=(t,e,r)=>{let s=(...a)=>jF(a[0])&&jF(a[0].raw)?Obe(s,Ube(s,...a)):Obe(s,a.length===1?""+a[0]:a.join(" "));return Object.setPrototypeOf(s,Yxt),s._generator=t,s._styler=e,s._isEmpty=r,s},Obe=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:s,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=qxt(e,r.close,r.open),r=r.parent;let n=e.indexOf(` +`);return n!==-1&&(e=Gxt(e,a,s,n)),s+e+a},WW,Ube=(t,...e)=>{let[r]=e;if(!jF(r)||!jF(r.raw))return e.join(" ");let s=e.slice(1),a=[r.raw[0]];for(let n=1;n{"use strict";var Vxt=hD&&hD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hD,"__esModule",{value:!0});var pD=Vxt(YF()),Kxt=/^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Jxt=/^(ansi|ansi256)\(\s?(\d+)\s?\)$/,VF=(t,e)=>e==="foreground"?t:"bg"+t[0].toUpperCase()+t.slice(1);hD.default=(t,e,r)=>{if(!e)return t;if(e in pD.default){let a=VF(e,r);return pD.default[a](t)}if(e.startsWith("#")){let a=VF("hex",r);return pD.default[a](e)(t)}if(e.startsWith("ansi")){let a=Jxt.exec(e);if(!a)return t;let n=VF(a[1],r),c=Number(a[2]);return pD.default[n](c)(t)}if(e.startsWith("rgb")||e.startsWith("hsl")||e.startsWith("hsv")||e.startsWith("hwb")){let a=Kxt.exec(e);if(!a)return t;let n=VF(a[1],r),c=Number(a[2]),f=Number(a[3]),p=Number(a[4]);return pD.default[n](c,f,p)(t)}return t}});var qbe=L(gD=>{"use strict";var jbe=gD&&gD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gD,"__esModule",{value:!0});var zxt=jbe(Pbe()),ZW=jbe(zW());gD.default=(t,e,r,s)=>{if(typeof r.style.borderStyle=="string"){let a=r.yogaNode.getComputedWidth(),n=r.yogaNode.getComputedHeight(),c=r.style.borderColor,f=zxt.default[r.style.borderStyle],p=ZW.default(f.topLeft+f.horizontal.repeat(a-2)+f.topRight,c,"foreground"),h=(ZW.default(f.vertical,c,"foreground")+` +`).repeat(n-2),E=ZW.default(f.bottomLeft+f.horizontal.repeat(a-2)+f.bottomRight,c,"foreground");s.write(t,e,p,{transformers:[]}),s.write(t,e+1,h,{transformers:[]}),s.write(t+a-1,e+1,h,{transformers:[]}),s.write(t,e+n-1,E,{transformers:[]})}}});var Wbe=L(dD=>{"use strict";var Om=dD&&dD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dD,"__esModule",{value:!0});var Zxt=Om(Nm()),Xxt=Om(FW()),$xt=Om(vbe()),ekt=Om(UW()),tkt=Om(Sbe()),rkt=Om(jW()),nkt=Om(qbe()),ikt=(t,e)=>{var r;let s=(r=t.childNodes[0])===null||r===void 0?void 0:r.yogaNode;if(s){let a=s.getComputedLeft(),n=s.getComputedTop();e=` +`.repeat(n)+$xt.default(e,a)}return e},Gbe=(t,e,r)=>{var s;let{offsetX:a=0,offsetY:n=0,transformers:c=[],skipStaticElements:f}=r;if(f&&t.internal_static)return;let{yogaNode:p}=t;if(p){if(p.getDisplay()===Zxt.default.DISPLAY_NONE)return;let h=a+p.getComputedLeft(),E=n+p.getComputedTop(),C=c;if(typeof t.internal_transform=="function"&&(C=[t.internal_transform,...c]),t.nodeName==="ink-text"){let S=rkt.default(t);if(S.length>0){let P=Xxt.default(S),I=tkt.default(p);if(P>I){let R=(s=t.style.textWrap)!==null&&s!==void 0?s:"wrap";S=ekt.default(S,I,R)}S=ikt(t,S),e.write(h,E,S,{transformers:C})}return}if(t.nodeName==="ink-box"&&nkt.default(h,E,t,e),t.nodeName==="ink-root"||t.nodeName==="ink-box")for(let S of t.childNodes)Gbe(S,e,{offsetX:h,offsetY:E,transformers:C,skipStaticElements:f})}};dD.default=Gbe});var Kbe=L(mD=>{"use strict";var Vbe=mD&&mD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mD,"__esModule",{value:!0});var Ybe=Vbe(MW()),skt=Vbe(iD()),XW=class{constructor(e){this.writes=[];let{width:r,height:s}=e;this.width=r,this.height=s}write(e,r,s,a){let{transformers:n}=a;s&&this.writes.push({x:e,y:r,text:s,transformers:n})}get(){let e=[];for(let s=0;ss.trimRight()).join(` +`),height:e.length}}};mD.default=XW});var Zbe=L(yD=>{"use strict";var $W=yD&&yD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yD,"__esModule",{value:!0});var okt=$W(Nm()),Jbe=$W(Wbe()),zbe=$W(Kbe());yD.default=(t,e)=>{var r;if(t.yogaNode.setWidth(e),t.yogaNode){t.yogaNode.calculateLayout(void 0,void 0,okt.default.DIRECTION_LTR);let s=new zbe.default({width:t.yogaNode.getComputedWidth(),height:t.yogaNode.getComputedHeight()});Jbe.default(t,s,{skipStaticElements:!0});let a;!((r=t.staticNode)===null||r===void 0)&&r.yogaNode&&(a=new zbe.default({width:t.staticNode.yogaNode.getComputedWidth(),height:t.staticNode.yogaNode.getComputedHeight()}),Jbe.default(t.staticNode,a,{skipStaticElements:!1}));let{output:n,height:c}=s.get();return{output:n,outputHeight:c,staticOutput:a?`${a.get().output} +`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var tPe=L((C0r,ePe)=>{"use strict";var Xbe=ye("stream"),$be=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],eY={},akt=t=>{let e=new Xbe.PassThrough,r=new Xbe.PassThrough;e.write=a=>t("stdout",a),r.write=a=>t("stderr",a);let s=new console.Console(e,r);for(let a of $be)eY[a]=console[a],console[a]=s[a];return()=>{for(let a of $be)console[a]=eY[a];eY={}}};ePe.exports=akt});var rY=L(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:!0});tY.default=new WeakMap});var iY=L(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:!0});var lkt=hn(),rPe=lkt.createContext({exit:()=>{}});rPe.displayName="InternalAppContext";nY.default=rPe});var oY=L(sY=>{"use strict";Object.defineProperty(sY,"__esModule",{value:!0});var ckt=hn(),nPe=ckt.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});nPe.displayName="InternalStdinContext";sY.default=nPe});var lY=L(aY=>{"use strict";Object.defineProperty(aY,"__esModule",{value:!0});var ukt=hn(),iPe=ukt.createContext({stdout:void 0,write:()=>{}});iPe.displayName="InternalStdoutContext";aY.default=iPe});var uY=L(cY=>{"use strict";Object.defineProperty(cY,"__esModule",{value:!0});var fkt=hn(),sPe=fkt.createContext({stderr:void 0,write:()=>{}});sPe.displayName="InternalStderrContext";cY.default=sPe});var KF=L(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:!0});var Akt=hn(),oPe=Akt.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{},focus:()=>{}});oPe.displayName="InternalFocusContext";fY.default=oPe});var lPe=L((P0r,aPe)=>{"use strict";var pkt=/[|\\{}()[\]^$+*?.-]/g;aPe.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(pkt,"\\$&")}});var APe=L((x0r,fPe)=>{"use strict";var hkt=lPe(),gkt=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",uPe=[].concat(ye("module").builtinModules,"bootstrap_node","node").map(t=>new RegExp(`(?:\\((?:node:)?${t}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${t}(?:\\.js)?:\\d+:\\d+$)`));uPe.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var AY=class t{constructor(e){e={ignoredPackages:[],...e},"internals"in e||(e.internals=t.nodeInternals()),"cwd"in e||(e.cwd=gkt),this._cwd=e.cwd.replace(/\\/g,"/"),this._internals=[].concat(e.internals,dkt(e.ignoredPackages)),this._wrapCallSite=e.wrapCallSite||!1}static nodeInternals(){return[...uPe]}clean(e,r=0){r=" ".repeat(r),Array.isArray(e)||(e=e.split(` +`)),!/^\s*at /.test(e[0])&&/^\s*at /.test(e[1])&&(e=e.slice(1));let s=!1,a=null,n=[];return e.forEach(c=>{if(c=c.replace(/\\/g,"/"),this._internals.some(p=>p.test(c)))return;let f=/^\s*at /.test(c);s?c=c.trimEnd().replace(/^(\s+)at /,"$1"):(c=c.trim(),f&&(c=c.slice(3))),c=c.replace(`${this._cwd}/`,""),c&&(f?(a&&(n.push(a),a=null),n.push(c)):(s=!0,a=c))}),n.map(c=>`${r}${c} +`).join("")}captureString(e,r=this.captureString){typeof e=="function"&&(r=e,e=1/0);let{stackTraceLimit:s}=Error;e&&(Error.stackTraceLimit=e);let a={};Error.captureStackTrace(a,r);let{stack:n}=a;return Error.stackTraceLimit=s,this.clean(n)}capture(e,r=this.capture){typeof e=="function"&&(r=e,e=1/0);let{prepareStackTrace:s,stackTraceLimit:a}=Error;Error.prepareStackTrace=(f,p)=>this._wrapCallSite?p.map(this._wrapCallSite):p,e&&(Error.stackTraceLimit=e);let n={};Error.captureStackTrace(n,r);let{stack:c}=n;return Object.assign(Error,{prepareStackTrace:s,stackTraceLimit:a}),c}at(e=this.at){let[r]=this.capture(1,e);if(!r)return{};let s={line:r.getLineNumber(),column:r.getColumnNumber()};cPe(s,r.getFileName(),this._cwd),r.isConstructor()&&(s.constructor=!0),r.isEval()&&(s.evalOrigin=r.getEvalOrigin()),r.isNative()&&(s.native=!0);let a;try{a=r.getTypeName()}catch{}a&&a!=="Object"&&a!=="[object Object]"&&(s.type=a);let n=r.getFunctionName();n&&(s.function=n);let c=r.getMethodName();return c&&n!==c&&(s.method=c),s}parseLine(e){let r=e&&e.match(mkt);if(!r)return null;let s=r[1]==="new",a=r[2],n=r[3],c=r[4],f=Number(r[5]),p=Number(r[6]),h=r[7],E=r[8],C=r[9],S=r[10]==="native",P=r[11]===")",I,R={};if(E&&(R.line=Number(E)),C&&(R.column=Number(C)),P&&h){let N=0;for(let U=h.length-1;U>0;U--)if(h.charAt(U)===")")N++;else if(h.charAt(U)==="("&&h.charAt(U-1)===" "&&(N--,N===-1&&h.charAt(U-1)===" ")){let W=h.slice(0,U-1);h=h.slice(U+1),a+=` (${W}`;break}}if(a){let N=a.match(ykt);N&&(a=N[1],I=N[2])}return cPe(R,h,this._cwd),s&&(R.constructor=!0),n&&(R.evalOrigin=n,R.evalLine=f,R.evalColumn=p,R.evalFile=c&&c.replace(/\\/g,"/")),S&&(R.native=!0),a&&(R.function=a),I&&a!==I&&(R.method=I),R}};function cPe(t,e,r){e&&(e=e.replace(/\\/g,"/"),e.startsWith(`${r}/`)&&(e=e.slice(r.length+1)),t.file=e)}function dkt(t){if(t.length===0)return[];let e=t.map(r=>hkt(r));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${e.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var mkt=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),ykt=/^(.*?) \[as (.*?)\]$/;fPe.exports=AY});var hPe=L((k0r,pPe)=>{"use strict";pPe.exports=(t,e)=>t.replace(/^\t+/gm,r=>" ".repeat(r.length*(e||2)))});var dPe=L((Q0r,gPe)=>{"use strict";var Ekt=hPe(),Ikt=(t,e)=>{let r=[],s=t-e,a=t+e;for(let n=s;n<=a;n++)r.push(n);return r};gPe.exports=(t,e,r)=>{if(typeof t!="string")throw new TypeError("Source code is missing.");if(!e||e<1)throw new TypeError("Line number must start from `1`.");if(t=Ekt(t).split(/\r?\n/),!(e>t.length))return r={around:3,...r},Ikt(e,r.around).filter(s=>t[s-1]!==void 0).map(s=>({line:s,value:t[s-1]}))}});var JF=L(nf=>{"use strict";var Ckt=nf&&nf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),wkt=nf&&nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bkt=nf&&nf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Ckt(e,t,r);return wkt(e,t),e},vkt=nf&&nf.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a{var{children:r}=t,s=vkt(t,["children"]);let a=Object.assign(Object.assign({},s),{marginLeft:s.marginLeft||s.marginX||s.margin||0,marginRight:s.marginRight||s.marginX||s.margin||0,marginTop:s.marginTop||s.marginY||s.margin||0,marginBottom:s.marginBottom||s.marginY||s.margin||0,paddingLeft:s.paddingLeft||s.paddingX||s.padding||0,paddingRight:s.paddingRight||s.paddingX||s.padding||0,paddingTop:s.paddingTop||s.paddingY||s.padding||0,paddingBottom:s.paddingBottom||s.paddingY||s.padding||0});return mPe.default.createElement("ink-box",{ref:e,style:a},r)});pY.displayName="Box";pY.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};nf.default=pY});var dY=L(ED=>{"use strict";var hY=ED&&ED.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ED,"__esModule",{value:!0});var Skt=hY(hn()),Cw=hY(YF()),yPe=hY(zW()),gY=({color:t,backgroundColor:e,dimColor:r,bold:s,italic:a,underline:n,strikethrough:c,inverse:f,wrap:p,children:h})=>{if(h==null)return null;let E=C=>(r&&(C=Cw.default.dim(C)),t&&(C=yPe.default(C,t,"foreground")),e&&(C=yPe.default(C,e,"background")),s&&(C=Cw.default.bold(C)),a&&(C=Cw.default.italic(C)),n&&(C=Cw.default.underline(C)),c&&(C=Cw.default.strikethrough(C)),f&&(C=Cw.default.inverse(C)),C);return Skt.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row",textWrap:p},internal_transform:E},h)};gY.displayName="Text";gY.defaultProps={dimColor:!1,bold:!1,italic:!1,underline:!1,strikethrough:!1,wrap:"wrap"};ED.default=gY});var wPe=L(sf=>{"use strict";var Dkt=sf&&sf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),bkt=sf&&sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pkt=sf&&sf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Dkt(e,t,r);return bkt(e,t),e},ID=sf&&sf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sf,"__esModule",{value:!0});var EPe=Pkt(ye("fs")),Ts=ID(hn()),IPe=ID(APe()),xkt=ID(dPe()),rh=ID(JF()),hA=ID(dY()),CPe=new IPe.default({cwd:process.cwd(),internals:IPe.default.nodeInternals()}),kkt=({error:t})=>{let e=t.stack?t.stack.split(` +`).slice(1):void 0,r=e?CPe.parseLine(e[0]):void 0,s,a=0;if(r?.file&&r?.line&&EPe.existsSync(r.file)){let n=EPe.readFileSync(r.file,"utf8");if(s=xkt.default(n,r.line),s)for(let{line:c}of s)a=Math.max(a,String(c).length)}return Ts.default.createElement(rh.default,{flexDirection:"column",padding:1},Ts.default.createElement(rh.default,null,Ts.default.createElement(hA.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),Ts.default.createElement(hA.default,null," ",t.message)),r&&Ts.default.createElement(rh.default,{marginTop:1},Ts.default.createElement(hA.default,{dimColor:!0},r.file,":",r.line,":",r.column)),r&&s&&Ts.default.createElement(rh.default,{marginTop:1,flexDirection:"column"},s.map(({line:n,value:c})=>Ts.default.createElement(rh.default,{key:n},Ts.default.createElement(rh.default,{width:a+1},Ts.default.createElement(hA.default,{dimColor:n!==r.line,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0},String(n).padStart(a," "),":")),Ts.default.createElement(hA.default,{key:n,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0}," "+c)))),t.stack&&Ts.default.createElement(rh.default,{marginTop:1,flexDirection:"column"},t.stack.split(` +`).slice(1).map(n=>{let c=CPe.parseLine(n);return c?Ts.default.createElement(rh.default,{key:n},Ts.default.createElement(hA.default,{dimColor:!0},"- "),Ts.default.createElement(hA.default,{dimColor:!0,bold:!0},c.function),Ts.default.createElement(hA.default,{dimColor:!0,color:"gray"}," ","(",c.file,":",c.line,":",c.column,")")):Ts.default.createElement(rh.default,{key:n},Ts.default.createElement(hA.default,{dimColor:!0},"- "),Ts.default.createElement(hA.default,{dimColor:!0,bold:!0},n))})))};sf.default=kkt});var vPe=L(of=>{"use strict";var Qkt=of&&of.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Tkt=of&&of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rkt=of&&of.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Qkt(e,t,r);return Tkt(e,t),e},Mm=of&&of.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(of,"__esModule",{value:!0});var Lm=Rkt(hn()),BPe=Mm(pW()),Fkt=Mm(iY()),Nkt=Mm(oY()),Okt=Mm(lY()),Lkt=Mm(uY()),Mkt=Mm(KF()),_kt=Mm(wPe()),Ukt=" ",Hkt="\x1B[Z",jkt="\x1B",zF=class extends Lm.PureComponent{constructor(){super(...arguments),this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=e=>{let{stdin:r}=this.props;if(!this.isRawModeSupported())throw r===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default. +Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink. +Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.addListener("data",this.handleInput),r.resume(),r.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("data",this.handleInput),r.pause())},this.handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===jkt&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===Ukt&&this.focusNext(),e===Hkt&&this.focusPrevious())},this.handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focus=e=>{this.setState(r=>r.focusables.some(a=>a?.id===e)?{activeFocusId:e}:r)},this.focusNext=()=>{this.setState(e=>{var r;let s=(r=e.focusables[0])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findNextFocusable(e)||s}})},this.focusPrevious=()=>{this.setState(e=>{var r;let s=(r=e.focusables[e.focusables.length-1])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findPreviousFocusable(e)||s}})},this.addFocusable=(e,{autoFocus:r})=>{this.setState(s=>{let a=s.activeFocusId;return!a&&r&&(a=e),{activeFocusId:a,focusables:[...s.focusables,{id:e,isActive:!0}]}})},this.removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(s=>s.id!==e)}))},this.activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(s=>s.id!==e?s:{id:e,isActive:!0})}))},this.deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(s=>s.id!==e?s:{id:e,isActive:!1})}))},this.findNextFocusable=e=>{var r;let s=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=s+1;a{var r;let s=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=s-1;a>=0;a--)if(!((r=e.focusables[a])===null||r===void 0)&&r.isActive)return e.focusables[a].id}}static getDerivedStateFromError(e){return{error:e}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return Lm.default.createElement(Fkt.default.Provider,{value:{exit:this.handleExit}},Lm.default.createElement(Nkt.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},Lm.default.createElement(Okt.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},Lm.default.createElement(Lkt.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},Lm.default.createElement(Mkt.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious,focus:this.focus}},this.state.error?Lm.default.createElement(_kt.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){BPe.default.hide(this.props.stdout)}componentWillUnmount(){BPe.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(e){this.handleExit(e)}};of.default=zF;zF.displayName="InternalApp"});var bPe=L(af=>{"use strict";var qkt=af&&af.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Gkt=af&&af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wkt=af&&af.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&qkt(e,t,r);return Gkt(e,t),e},lf=af&&af.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(af,"__esModule",{value:!0});var Ykt=lf(hn()),SPe=rH(),Vkt=lf(wDe()),Kkt=lf(lW()),Jkt=lf(PDe()),zkt=lf(kDe()),mY=lf(wbe()),Zkt=lf(Zbe()),Xkt=lf(AW()),$kt=lf(tPe()),eQt=Wkt(qW()),tQt=lf(rY()),rQt=lf(vPe()),ww=process.env.CI==="false"?!1:Jkt.default,DPe=()=>{},yY=class{constructor(e){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:r,outputHeight:s,staticOutput:a}=Zkt.default(this.rootNode,this.options.stdout.columns||80),n=a&&a!==` +`;if(this.options.debug){n&&(this.fullStaticOutput+=a),this.options.stdout.write(this.fullStaticOutput+r);return}if(ww){n&&this.options.stdout.write(a),this.lastOutput=r;return}if(n&&(this.fullStaticOutput+=a),s>=this.options.stdout.rows){this.options.stdout.write(Kkt.default.clearTerminal+this.fullStaticOutput+r),this.lastOutput=r;return}n&&(this.log.clear(),this.options.stdout.write(a),this.log(r)),!n&&r!==this.lastOutput&&this.throttledLog(r),this.lastOutput=r},zkt.default(this),this.options=e,this.rootNode=eQt.createNode("ink-root"),this.rootNode.onRender=e.debug?this.onRender:SPe(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=Vkt.default.create(e.stdout),this.throttledLog=e.debug?this.log:SPe(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=mY.default.createContainer(this.rootNode,0,!1,null),this.unsubscribeExit=Xkt.default(this.unmount,{alwaysLast:!1}),e.patchConsole&&this.patchConsole(),ww||(e.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{e.stdout.off("resize",this.onRender)})}render(e){let r=Ykt.default.createElement(rQt.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},e);mY.default.updateContainer(r,this.container,null,DPe)}writeToStdout(e){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(e+this.fullStaticOutput+this.lastOutput);return}if(ww){this.options.stdout.write(e);return}this.log.clear(),this.options.stdout.write(e),this.log(this.lastOutput)}}writeToStderr(e){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(e),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(ww){this.options.stderr.write(e);return}this.log.clear(),this.options.stderr.write(e),this.log(this.lastOutput)}}unmount(e){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),ww?this.options.stdout.write(this.lastOutput+` +`):this.options.debug||this.log.done(),this.isUnmounted=!0,mY.default.updateContainer(null,this.container,null,DPe),tQt.default.delete(this.options.stdout),e instanceof Error?this.rejectExitPromise(e):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((e,r)=>{this.resolveExitPromise=e,this.rejectExitPromise=r})),this.exitPromise}clear(){!ww&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=$kt.default((e,r)=>{e==="stdout"&&this.writeToStdout(r),e==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}};af.default=yY});var xPe=L(CD=>{"use strict";var PPe=CD&&CD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(CD,"__esModule",{value:!0});var nQt=PPe(bPe()),ZF=PPe(rY()),iQt=ye("stream"),sQt=(t,e)=>{let r=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},oQt(e)),s=aQt(r.stdout,()=>new nQt.default(r));return s.render(t),{rerender:s.render,unmount:()=>s.unmount(),waitUntilExit:s.waitUntilExit,cleanup:()=>ZF.default.delete(r.stdout),clear:s.clear}};CD.default=sQt;var oQt=(t={})=>t instanceof iQt.Stream?{stdout:t,stdin:process.stdin}:t,aQt=(t,e)=>{let r;return ZF.default.has(t)?r=ZF.default.get(t):(r=e(),ZF.default.set(t,r)),r}});var QPe=L(nh=>{"use strict";var lQt=nh&&nh.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),cQt=nh&&nh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uQt=nh&&nh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&lQt(e,t,r);return cQt(e,t),e};Object.defineProperty(nh,"__esModule",{value:!0});var wD=uQt(hn()),kPe=t=>{let{items:e,children:r,style:s}=t,[a,n]=wD.useState(0),c=wD.useMemo(()=>e.slice(a),[e,a]);wD.useLayoutEffect(()=>{n(e.length)},[e.length]);let f=c.map((h,E)=>r(h,a+E)),p=wD.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},s),[s]);return wD.default.createElement("ink-box",{internal_static:!0,style:p},f)};kPe.displayName="Static";nh.default=kPe});var RPe=L(BD=>{"use strict";var fQt=BD&&BD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(BD,"__esModule",{value:!0});var AQt=fQt(hn()),TPe=({children:t,transform:e})=>t==null?null:AQt.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:e},t);TPe.displayName="Transform";BD.default=TPe});var NPe=L(vD=>{"use strict";var pQt=vD&&vD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vD,"__esModule",{value:!0});var hQt=pQt(hn()),FPe=({count:t=1})=>hQt.default.createElement("ink-text",null,` +`.repeat(t));FPe.displayName="Newline";vD.default=FPe});var MPe=L(SD=>{"use strict";var OPe=SD&&SD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(SD,"__esModule",{value:!0});var gQt=OPe(hn()),dQt=OPe(JF()),LPe=()=>gQt.default.createElement(dQt.default,{flexGrow:1});LPe.displayName="Spacer";SD.default=LPe});var XF=L(DD=>{"use strict";var mQt=DD&&DD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(DD,"__esModule",{value:!0});var yQt=hn(),EQt=mQt(oY()),IQt=()=>yQt.useContext(EQt.default);DD.default=IQt});var UPe=L(bD=>{"use strict";var CQt=bD&&bD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bD,"__esModule",{value:!0});var _Pe=hn(),wQt=CQt(XF()),BQt=(t,e={})=>{let{stdin:r,setRawMode:s,internal_exitOnCtrlC:a}=wQt.default();_Pe.useEffect(()=>{if(e.isActive!==!1)return s(!0),()=>{s(!1)}},[e.isActive,s]),_Pe.useEffect(()=>{if(e.isActive===!1)return;let n=c=>{let f=String(c),p={upArrow:f==="\x1B[A",downArrow:f==="\x1B[B",leftArrow:f==="\x1B[D",rightArrow:f==="\x1B[C",pageDown:f==="\x1B[6~",pageUp:f==="\x1B[5~",return:f==="\r",escape:f==="\x1B",ctrl:!1,shift:!1,tab:f===" "||f==="\x1B[Z",backspace:f==="\b",delete:f==="\x7F"||f==="\x1B[3~",meta:!1};f<=""&&!p.return&&(f=String.fromCharCode(f.charCodeAt(0)+97-1),p.ctrl=!0),f.startsWith("\x1B")&&(f=f.slice(1),p.meta=!0);let h=f>="A"&&f<="Z",E=f>="\u0410"&&f<="\u042F";f.length===1&&(h||E)&&(p.shift=!0),p.tab&&f==="[Z"&&(p.shift=!0),(p.tab||p.backspace||p.delete)&&(f=""),(!(f==="c"&&p.ctrl)||!a)&&t(f,p)};return r?.on("data",n),()=>{r?.off("data",n)}},[e.isActive,r,a,t])};bD.default=BQt});var HPe=L(PD=>{"use strict";var vQt=PD&&PD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(PD,"__esModule",{value:!0});var SQt=hn(),DQt=vQt(iY()),bQt=()=>SQt.useContext(DQt.default);PD.default=bQt});var jPe=L(xD=>{"use strict";var PQt=xD&&xD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xD,"__esModule",{value:!0});var xQt=hn(),kQt=PQt(lY()),QQt=()=>xQt.useContext(kQt.default);xD.default=QQt});var qPe=L(kD=>{"use strict";var TQt=kD&&kD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kD,"__esModule",{value:!0});var RQt=hn(),FQt=TQt(uY()),NQt=()=>RQt.useContext(FQt.default);kD.default=NQt});var WPe=L(TD=>{"use strict";var GPe=TD&&TD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(TD,"__esModule",{value:!0});var QD=hn(),OQt=GPe(KF()),LQt=GPe(XF()),MQt=({isActive:t=!0,autoFocus:e=!1,id:r}={})=>{let{isRawModeSupported:s,setRawMode:a}=LQt.default(),{activeId:n,add:c,remove:f,activate:p,deactivate:h,focus:E}=QD.useContext(OQt.default),C=QD.useMemo(()=>r??Math.random().toString().slice(2,7),[r]);return QD.useEffect(()=>(c(C,{autoFocus:e}),()=>{f(C)}),[C,e]),QD.useEffect(()=>{t?p(C):h(C)},[t,C]),QD.useEffect(()=>{if(!(!s||!t))return a(!0),()=>{a(!1)}},[t]),{isFocused:!!C&&n===C,focus:E}};TD.default=MQt});var YPe=L(RD=>{"use strict";var _Qt=RD&&RD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(RD,"__esModule",{value:!0});var UQt=hn(),HQt=_Qt(KF()),jQt=()=>{let t=UQt.useContext(HQt.default);return{enableFocus:t.enableFocus,disableFocus:t.disableFocus,focusNext:t.focusNext,focusPrevious:t.focusPrevious,focus:t.focus}};RD.default=jQt});var VPe=L(EY=>{"use strict";Object.defineProperty(EY,"__esModule",{value:!0});EY.default=t=>{var e,r,s,a;return{width:(r=(e=t.yogaNode)===null||e===void 0?void 0:e.getComputedWidth())!==null&&r!==void 0?r:0,height:(a=(s=t.yogaNode)===null||s===void 0?void 0:s.getComputedHeight())!==null&&a!==void 0?a:0}}});var Vc=L(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});var qQt=xPe();Object.defineProperty(Eo,"render",{enumerable:!0,get:function(){return qQt.default}});var GQt=JF();Object.defineProperty(Eo,"Box",{enumerable:!0,get:function(){return GQt.default}});var WQt=dY();Object.defineProperty(Eo,"Text",{enumerable:!0,get:function(){return WQt.default}});var YQt=QPe();Object.defineProperty(Eo,"Static",{enumerable:!0,get:function(){return YQt.default}});var VQt=RPe();Object.defineProperty(Eo,"Transform",{enumerable:!0,get:function(){return VQt.default}});var KQt=NPe();Object.defineProperty(Eo,"Newline",{enumerable:!0,get:function(){return KQt.default}});var JQt=MPe();Object.defineProperty(Eo,"Spacer",{enumerable:!0,get:function(){return JQt.default}});var zQt=UPe();Object.defineProperty(Eo,"useInput",{enumerable:!0,get:function(){return zQt.default}});var ZQt=HPe();Object.defineProperty(Eo,"useApp",{enumerable:!0,get:function(){return ZQt.default}});var XQt=XF();Object.defineProperty(Eo,"useStdin",{enumerable:!0,get:function(){return XQt.default}});var $Qt=jPe();Object.defineProperty(Eo,"useStdout",{enumerable:!0,get:function(){return $Qt.default}});var eTt=qPe();Object.defineProperty(Eo,"useStderr",{enumerable:!0,get:function(){return eTt.default}});var tTt=WPe();Object.defineProperty(Eo,"useFocus",{enumerable:!0,get:function(){return tTt.default}});var rTt=YPe();Object.defineProperty(Eo,"useFocusManager",{enumerable:!0,get:function(){return rTt.default}});var nTt=VPe();Object.defineProperty(Eo,"measureElement",{enumerable:!0,get:function(){return nTt.default}})});var CY={};Vt(CY,{Gem:()=>IY});var KPe,_m,IY,$F=It(()=>{KPe=et(Vc()),_m=et(hn()),IY=(0,_m.memo)(({active:t})=>{let e=(0,_m.useMemo)(()=>t?"\u25C9":"\u25EF",[t]),r=(0,_m.useMemo)(()=>t?"green":"yellow",[t]);return _m.default.createElement(KPe.Text,{color:r},e)})});var zPe={};Vt(zPe,{useKeypress:()=>Um});function Um({active:t},e,r){let{stdin:s}=(0,JPe.useStdin)(),a=(0,eN.useCallback)((n,c)=>e(n,c),r);(0,eN.useEffect)(()=>{if(!(!t||!s))return s.on("keypress",a),()=>{s.off("keypress",a)}},[t,a,s])}var JPe,eN,FD=It(()=>{JPe=et(Vc()),eN=et(hn())});var XPe={};Vt(XPe,{FocusRequest:()=>ZPe,useFocusRequest:()=>wY});var ZPe,wY,BY=It(()=>{FD();ZPe=(r=>(r.BEFORE="before",r.AFTER="after",r))(ZPe||{}),wY=function({active:t},e,r){Um({active:t},(s,a)=>{a.name==="tab"&&(a.shift?e("before"):e("after"))},r)}});var $Pe={};Vt($Pe,{useListInput:()=>ND});var ND,tN=It(()=>{FD();ND=function(t,e,{active:r,minus:s,plus:a,set:n,loop:c=!0}){Um({active:r},(f,p)=>{let h=e.indexOf(t);switch(p.name){case s:{let E=h-1;if(c){n(e[(e.length+E)%e.length]);return}if(E<0)return;n(e[E])}break;case a:{let E=h+1;if(c){n(e[E%e.length]);return}if(E>=e.length)return;n(e[E])}break}},[e,t,a,n,c])}});var rN={};Vt(rN,{ScrollableItems:()=>iTt});var tg,ml,iTt,nN=It(()=>{tg=et(Vc()),ml=et(hn());BY();tN();iTt=({active:t=!0,children:e=[],radius:r=10,size:s=1,loop:a=!0,onFocusRequest:n,willReachEnd:c})=>{let f=N=>{if(N.key===null)throw new Error("Expected all children to have a key");return N.key},p=ml.default.Children.map(e,N=>f(N)),h=p[0],[E,C]=(0,ml.useState)(h),S=p.indexOf(E);(0,ml.useEffect)(()=>{p.includes(E)||C(h)},[e]),(0,ml.useEffect)(()=>{c&&S>=p.length-2&&c()},[S]),wY({active:t&&!!n},N=>{n?.(N)},[n]),ND(E,p,{active:t,minus:"up",plus:"down",set:C,loop:a});let P=S-r,I=S+r;I>p.length&&(P-=I-p.length,I=p.length),P<0&&(I+=-P,P=0),I>=p.length&&(I=p.length-1);let R=[];for(let N=P;N<=I;++N){let U=p[N],W=t&&U===E;R.push(ml.default.createElement(tg.Box,{key:U,height:s},ml.default.createElement(tg.Box,{marginLeft:1,marginRight:1},ml.default.createElement(tg.Text,null,W?ml.default.createElement(tg.Text,{color:"cyan",bold:!0},">"):" ")),ml.default.createElement(tg.Box,null,ml.default.cloneElement(e[N],{active:W}))))}return ml.default.createElement(tg.Box,{flexDirection:"column",width:"100%"},R)}});var exe,ih,txe,vY,rxe,SY=It(()=>{exe=et(Vc()),ih=et(hn()),txe=ye("readline"),vY=ih.default.createContext(null),rxe=({children:t})=>{let{stdin:e,setRawMode:r}=(0,exe.useStdin)();(0,ih.useEffect)(()=>{r&&r(!0),e&&(0,txe.emitKeypressEvents)(e)},[e,r]);let[s,a]=(0,ih.useState)(new Map),n=(0,ih.useMemo)(()=>({getAll:()=>s,get:c=>s.get(c),set:(c,f)=>a(new Map([...s,[c,f]]))}),[s,a]);return ih.default.createElement(vY.Provider,{value:n,children:t})}});var DY={};Vt(DY,{useMinistore:()=>sTt});function sTt(t,e){let r=(0,iN.useContext)(vY);if(r===null)throw new Error("Expected this hook to run with a ministore context attached");if(typeof t>"u")return r.getAll();let s=(0,iN.useCallback)(n=>{r.set(t,n)},[t,r.set]),a=r.get(t);return typeof a>"u"&&(a=e),[a,s]}var iN,bY=It(()=>{iN=et(hn());SY()});var oN={};Vt(oN,{renderForm:()=>oTt});async function oTt(t,e,{stdin:r,stdout:s,stderr:a}){let n,c=p=>{let{exit:h}=(0,sN.useApp)();Um({active:!0},(E,C)=>{C.name==="return"&&(n=p,h())},[h,p])},{waitUntilExit:f}=(0,sN.render)(PY.default.createElement(rxe,null,PY.default.createElement(t,{...e,useSubmit:c})),{stdin:r,stdout:s,stderr:a});return await f(),n}var sN,PY,aN=It(()=>{sN=et(Vc()),PY=et(hn());SY();FD()});var oxe=L(OD=>{"use strict";Object.defineProperty(OD,"__esModule",{value:!0});OD.UncontrolledTextInput=void 0;var ixe=hn(),xY=hn(),nxe=Vc(),Hm=YF(),sxe=({value:t,placeholder:e="",focus:r=!0,mask:s,highlightPastedText:a=!1,showCursor:n=!0,onChange:c,onSubmit:f})=>{let[{cursorOffset:p,cursorWidth:h},E]=xY.useState({cursorOffset:(t||"").length,cursorWidth:0});xY.useEffect(()=>{E(R=>{if(!r||!n)return R;let N=t||"";return R.cursorOffset>N.length-1?{cursorOffset:N.length,cursorWidth:0}:R})},[t,r,n]);let C=a?h:0,S=s?s.repeat(t.length):t,P=S,I=e?Hm.grey(e):void 0;if(n&&r){I=e.length>0?Hm.inverse(e[0])+Hm.grey(e.slice(1)):Hm.inverse(" "),P=S.length>0?"":Hm.inverse(" ");let R=0;for(let N of S)R>=p-C&&R<=p?P+=Hm.inverse(N):P+=N,R++;S.length>0&&p===S.length&&(P+=Hm.inverse(" "))}return nxe.useInput((R,N)=>{if(N.upArrow||N.downArrow||N.ctrl&&R==="c"||N.tab||N.shift&&N.tab)return;if(N.return){f&&f(t);return}let U=p,W=t,te=0;N.leftArrow?n&&U--:N.rightArrow?n&&U++:N.backspace||N.delete?p>0&&(W=t.slice(0,p-1)+t.slice(p,t.length),U--):(W=t.slice(0,p)+R+t.slice(p,t.length),U+=R.length,R.length>1&&(te=R.length)),p<0&&(U=0),p>t.length&&(U=t.length),E({cursorOffset:U,cursorWidth:te}),W!==t&&c(W)},{isActive:r}),ixe.createElement(nxe.Text,null,e?S.length>0?P:I:P)};OD.default=sxe;OD.UncontrolledTextInput=({initialValue:t="",...e})=>{let[r,s]=xY.useState(t);return ixe.createElement(sxe,Object.assign({},e,{value:r,onChange:s}))}});var cxe={};Vt(cxe,{Pad:()=>kY});var axe,lxe,kY,QY=It(()=>{axe=et(Vc()),lxe=et(hn()),kY=({length:t,active:e})=>{if(t===0)return null;let r=t>1?` ${"-".repeat(t-1)}`:" ";return lxe.default.createElement(axe.Text,{dimColor:!e},r)}});var uxe={};Vt(uxe,{ItemOptions:()=>aTt});var MD,rg,aTt,fxe=It(()=>{MD=et(Vc()),rg=et(hn());tN();$F();QY();aTt=function({active:t,skewer:e,options:r,value:s,onChange:a,sizes:n=[]}){let c=r.filter(({label:p})=>!!p).map(({value:p})=>p),f=r.findIndex(p=>p.value===s&&p.label!="");return ND(s,c,{active:t,minus:"left",plus:"right",set:a}),rg.default.createElement(rg.default.Fragment,null,r.map(({label:p},h)=>{let E=h===f,C=n[h]-1||0,S=p.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),P=Math.max(0,C-S.length-2);return p?rg.default.createElement(MD.Box,{key:p,width:C,marginLeft:1},rg.default.createElement(MD.Text,{wrap:"truncate"},rg.default.createElement(IY,{active:E})," ",p),e?rg.default.createElement(kY,{active:t,length:P}):null):rg.default.createElement(MD.Box,{key:`spacer-${h}`,width:C,marginLeft:1})}))}});var Dxe=L((Ndr,Sxe)=>{var jY;Sxe.exports=()=>(typeof jY>"u"&&(jY=ye("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),jY)});var Vxe=L((omr,Yxe)=>{var ZY=Symbol("arg flag"),Kc=class t extends Error{constructor(e,r){super(e),this.name="ArgError",this.code=r,Object.setPrototypeOf(this,t.prototype)}};function tb(t,{argv:e=process.argv.slice(2),permissive:r=!1,stopAtPositional:s=!1}={}){if(!t)throw new Kc("argument specification object is required","ARG_CONFIG_NO_SPEC");let a={_:[]},n={},c={};for(let f of Object.keys(t)){if(!f)throw new Kc("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(f[0]!=="-")throw new Kc(`argument key must start with '-' but found: '${f}'`,"ARG_CONFIG_NONOPT_KEY");if(f.length===1)throw new Kc(`argument key must have a name; singular '-' keys are not allowed: ${f}`,"ARG_CONFIG_NONAME_KEY");if(typeof t[f]=="string"){n[f]=t[f];continue}let p=t[f],h=!1;if(Array.isArray(p)&&p.length===1&&typeof p[0]=="function"){let[E]=p;p=(C,S,P=[])=>(P.push(E(C,S,P[P.length-1])),P),h=E===Boolean||E[ZY]===!0}else if(typeof p=="function")h=p===Boolean||p[ZY]===!0;else throw new Kc(`type missing or not a function or valid array type: ${f}`,"ARG_CONFIG_VAD_TYPE");if(f[1]!=="-"&&f.length>2)throw new Kc(`short argument keys (with a single hyphen) must have only one character: ${f}`,"ARG_CONFIG_SHORTOPT_TOOLONG");c[f]=[p,h]}for(let f=0,p=e.length;f0){a._=a._.concat(e.slice(f));break}if(h==="--"){a._=a._.concat(e.slice(f+1));break}if(h.length>1&&h[0]==="-"){let E=h[1]==="-"||h.length===2?[h]:h.slice(1).split("").map(C=>`-${C}`);for(let C=0;C1&&e[f+1][0]==="-"&&!(e[f+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(N===Number||typeof BigInt<"u"&&N===BigInt))){let W=P===R?"":` (alias for ${R})`;throw new Kc(`option requires argument: ${P}${W}`,"ARG_MISSING_REQUIRED_LONGARG")}a[R]=N(e[f+1],R,a[R]),++f}else a[R]=N(I,R,a[R])}}else a._.push(h)}return a}tb.flag=t=>(t[ZY]=!0,t);tb.COUNT=tb.flag((t,e,r)=>(r||0)+1);tb.ArgError=Kc;Yxe.exports=tb});var tke=L((Omr,eke)=>{var tV;eke.exports=()=>(typeof tV>"u"&&(tV=ye("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),tV)});var oke=L((aV,lV)=>{(function(t){aV&&typeof aV=="object"&&typeof lV<"u"?lV.exports=t():typeof define=="function"&&define.amd?define([],t):typeof window<"u"?window.isWindows=t():typeof global<"u"?global.isWindows=t():typeof self<"u"?self.isWindows=t():this.isWindows=t()})(function(){"use strict";return function(){return process&&(process.platform==="win32"||/^(msys|cygwin)$/.test(process.env.OSTYPE))}})});var uke=L((Fyr,cke)=>{"use strict";cV.ifExists=lRt;var xw=ye("util"),Jc=ye("path"),ake=oke(),sRt=/^#!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/,oRt={createPwshFile:!0,createCmdFile:ake(),fs:ye("fs")},aRt=new Map([[".js","node"],[".cjs","node"],[".mjs","node"],[".cmd","cmd"],[".bat","cmd"],[".ps1","pwsh"],[".sh","sh"]]);function lke(t){let e={...oRt,...t},r=e.fs;return e.fs_={chmod:r.chmod?xw.promisify(r.chmod):async()=>{},mkdir:xw.promisify(r.mkdir),readFile:xw.promisify(r.readFile),stat:xw.promisify(r.stat),unlink:xw.promisify(r.unlink),writeFile:xw.promisify(r.writeFile)},e}async function cV(t,e,r){let s=lke(r);await s.fs_.stat(t),await uRt(t,e,s)}function lRt(t,e,r){return cV(t,e,r).catch(()=>{})}function cRt(t,e){return e.fs_.unlink(t).catch(()=>{})}async function uRt(t,e,r){let s=await gRt(t,r);return await fRt(e,r),ARt(t,e,s,r)}function fRt(t,e){return e.fs_.mkdir(Jc.dirname(t),{recursive:!0})}function ARt(t,e,r,s){let a=lke(s),n=[{generator:yRt,extension:""}];return a.createCmdFile&&n.push({generator:mRt,extension:".cmd"}),a.createPwshFile&&n.push({generator:ERt,extension:".ps1"}),Promise.all(n.map(c=>dRt(t,e+c.extension,r,c.generator,a)))}function pRt(t,e){return cRt(t,e)}function hRt(t,e){return IRt(t,e)}async function gRt(t,e){let a=(await e.fs_.readFile(t,"utf8")).trim().split(/\r*\n/)[0].match(sRt);if(!a){let n=Jc.extname(t).toLowerCase();return{program:aRt.get(n)||null,additionalArgs:""}}return{program:a[1],additionalArgs:a[2]}}async function dRt(t,e,r,s,a){let n=a.preserveSymlinks?"--preserve-symlinks":"",c=[r.additionalArgs,n].filter(f=>f).join(" ");return a=Object.assign({},a,{prog:r.program,args:c}),await pRt(e,a),await a.fs_.writeFile(e,s(t,e,a),"utf8"),hRt(e,a)}function mRt(t,e,r){let a=Jc.relative(Jc.dirname(e),t).split("/").join("\\"),n=Jc.isAbsolute(a)?`"${a}"`:`"%~dp0\\${a}"`,c,f=r.prog,p=r.args||"",h=uV(r.nodePath).win32;f?(c=`"%~dp0\\${f}.exe"`,a=n):(f=n,p="",a="");let E=r.progArgs?`${r.progArgs.join(" ")} `:"",C=h?`@SET NODE_PATH=${h}\r +`:"";return c?C+=`@IF EXIST ${c} (\r + ${c} ${p} ${a} ${E}%*\r +) ELSE (\r + @SETLOCAL\r + @SET PATHEXT=%PATHEXT:;.JS;=;%\r + ${f} ${p} ${a} ${E}%*\r +)\r +`:C+=`@${f} ${p} ${a} ${E}%*\r +`,C}function yRt(t,e,r){let s=Jc.relative(Jc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n;s=s.split("\\").join("/");let c=Jc.isAbsolute(s)?`"${s}"`:`"$basedir/${s}"`,f=r.args||"",p=uV(r.nodePath).posix;a?(n=`"$basedir/${r.prog}"`,s=c):(a=c,f="",s="");let h=r.progArgs?`${r.progArgs.join(" ")} `:"",E=`#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") + +case \`uname\` in + *CYGWIN*) basedir=\`cygpath -w "$basedir"\`;; +esac + +`,C=r.nodePath?`export NODE_PATH="${p}" +`:"";return n?E+=`${C}if [ -x ${n} ]; then + exec ${n} ${f} ${s} ${h}"$@" +else + exec ${a} ${f} ${s} ${h}"$@" +fi +`:E+=`${C}${a} ${f} ${s} ${h}"$@" +exit $? +`,E}function ERt(t,e,r){let s=Jc.relative(Jc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n=a&&`"${a}$exe"`,c;s=s.split("\\").join("/");let f=Jc.isAbsolute(s)?`"${s}"`:`"$basedir/${s}"`,p=r.args||"",h=uV(r.nodePath),E=h.win32,C=h.posix;n?(c=`"$basedir/${r.prog}$exe"`,s=f):(n=f,p="",s="");let S=r.progArgs?`${r.progArgs.join(" ")} `:"",P=`#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +${r.nodePath?`$env_node_path=$env:NODE_PATH +$env:NODE_PATH="${E}" +`:""}if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +}`;return r.nodePath&&(P+=` else { + $env:NODE_PATH="${C}" +}`),c?P+=` +$ret=0 +if (Test-Path ${c}) { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & ${c} ${p} ${s} ${S}$args + } else { + & ${c} ${p} ${s} ${S}$args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & ${n} ${p} ${s} ${S}$args + } else { + & ${n} ${p} ${s} ${S}$args + } + $ret=$LASTEXITCODE +} +${r.nodePath?`$env:NODE_PATH=$env_node_path +`:""}exit $ret +`:P+=` +# Support pipeline input +if ($MyInvocation.ExpectingInput) { + $input | & ${n} ${p} ${s} ${S}$args +} else { + & ${n} ${p} ${s} ${S}$args +} +${r.nodePath?`$env:NODE_PATH=$env_node_path +`:""}exit $LASTEXITCODE +`,P}function IRt(t,e){return e.fs_.chmod(t,493)}function uV(t){if(!t)return{win32:"",posix:""};let e=typeof t=="string"?t.split(Jc.delimiter):Array.from(t),r={};for(let s=0;s`/mnt/${f.toLowerCase()}`):e[s];r.win32=r.win32?`${r.win32};${a}`:a,r.posix=r.posix?`${r.posix}:${n}`:n,r[s]={win32:a,posix:n}}return r}cke.exports=cV});var vV=L((tIr,kke)=>{kke.exports=ye("stream")});var Fke=L((rIr,Rke)=>{"use strict";function Qke(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,s)}return r}function JRt(t){for(var e=1;e0?this.tail.next=s:this.head=s,this.tail=s,++this.length}},{key:"unshift",value:function(r){var s={data:r,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var s=this.head,a=""+s.data;s=s.next;)a+=r+s.data;return a}},{key:"concat",value:function(r){if(this.length===0)return CN.alloc(0);for(var s=CN.allocUnsafe(r>>>0),a=this.head,n=0;a;)rFt(a.data,s,n),n+=a.data.length,a=a.next;return s}},{key:"consume",value:function(r,s){var a;return rc.length?c.length:r;if(f===c.length?n+=c:n+=c.slice(0,r),r-=f,r===0){f===c.length?(++a,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=c.slice(f));break}++a}return this.length-=a,n}},{key:"_getBuffer",value:function(r){var s=CN.allocUnsafe(r),a=this.head,n=1;for(a.data.copy(s),r-=a.data.length;a=a.next;){var c=a.data,f=r>c.length?c.length:r;if(c.copy(s,s.length-r,0,f),r-=f,r===0){f===c.length?(++n,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=c.slice(f));break}++n}return this.length-=n,s}},{key:tFt,value:function(r,s){return SV(this,JRt({},s,{depth:0,customInspect:!1}))}}]),t}()});var bV=L((nIr,Oke)=>{"use strict";function nFt(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(DV,this,t)):process.nextTick(DV,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(n){!e&&n?r._writableState?r._writableState.errorEmitted?process.nextTick(wN,r):(r._writableState.errorEmitted=!0,process.nextTick(Nke,r,n)):process.nextTick(Nke,r,n):e?(process.nextTick(wN,r),e(n)):process.nextTick(wN,r)}),this)}function Nke(t,e){DV(t,e),wN(t)}function wN(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function iFt(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function DV(t,e){t.emit("error",e)}function sFt(t,e){var r=t._readableState,s=t._writableState;r&&r.autoDestroy||s&&s.autoDestroy?t.destroy(e):t.emit("error",e)}Oke.exports={destroy:nFt,undestroy:iFt,errorOrDestroy:sFt}});var cg=L((iIr,_ke)=>{"use strict";var Mke={};function Zc(t,e,r){r||(r=Error);function s(n,c,f){return typeof e=="string"?e:e(n,c,f)}class a extends r{constructor(c,f,p){super(s(c,f,p))}}a.prototype.name=r.name,a.prototype.code=t,Mke[t]=a}function Lke(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(s=>String(s)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function oFt(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function aFt(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function lFt(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Zc("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Zc("ERR_INVALID_ARG_TYPE",function(t,e,r){let s;typeof e=="string"&&oFt(e,"not ")?(s="must not be",e=e.replace(/^not /,"")):s="must be";let a;if(aFt(t," argument"))a=`The ${t} ${s} ${Lke(e,"type")}`;else{let n=lFt(t,".")?"property":"argument";a=`The "${t}" ${n} ${s} ${Lke(e,"type")}`}return a+=`. Received type ${typeof r}`,a},TypeError);Zc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Zc("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Zc("ERR_STREAM_PREMATURE_CLOSE","Premature close");Zc("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Zc("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Zc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Zc("ERR_STREAM_WRITE_AFTER_END","write after end");Zc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Zc("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Zc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");_ke.exports.codes=Mke});var PV=L((sIr,Uke)=>{"use strict";var cFt=cg().codes.ERR_INVALID_OPT_VALUE;function uFt(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function fFt(t,e,r,s){var a=uFt(e,s,r);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var n=s?r:"highWaterMark";throw new cFt(n,a)}return Math.floor(a)}return t.objectMode?16:16*1024}Uke.exports={getHighWaterMark:fFt}});var Hke=L((oIr,xV)=>{typeof Object.create=="function"?xV.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:xV.exports=function(e,r){if(r){e.super_=r;var s=function(){};s.prototype=r.prototype,e.prototype=new s,e.prototype.constructor=e}}});var ug=L((aIr,QV)=>{try{if(kV=ye("util"),typeof kV.inherits!="function")throw"";QV.exports=kV.inherits}catch{QV.exports=Hke()}var kV});var qke=L((lIr,jke)=>{jke.exports=ye("util").deprecate});var FV=L((cIr,Jke)=>{"use strict";Jke.exports=Vi;function Wke(t){var e=this;this.next=null,this.entry=null,this.finish=function(){MFt(e,t)}}var Fw;Vi.WritableState=hb;var AFt={deprecate:qke()},Yke=vV(),vN=ye("buffer").Buffer,pFt=global.Uint8Array||function(){};function hFt(t){return vN.from(t)}function gFt(t){return vN.isBuffer(t)||t instanceof pFt}var RV=bV(),dFt=PV(),mFt=dFt.getHighWaterMark,fg=cg().codes,yFt=fg.ERR_INVALID_ARG_TYPE,EFt=fg.ERR_METHOD_NOT_IMPLEMENTED,IFt=fg.ERR_MULTIPLE_CALLBACK,CFt=fg.ERR_STREAM_CANNOT_PIPE,wFt=fg.ERR_STREAM_DESTROYED,BFt=fg.ERR_STREAM_NULL_VALUES,vFt=fg.ERR_STREAM_WRITE_AFTER_END,SFt=fg.ERR_UNKNOWN_ENCODING,Nw=RV.errorOrDestroy;ug()(Vi,Yke);function DFt(){}function hb(t,e,r){Fw=Fw||Vm(),t=t||{},typeof r!="boolean"&&(r=e instanceof Fw),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=mFt(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=t.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){RFt(e,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Wke(this)}hb.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(hb.prototype,"buffer",{get:AFt.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var BN;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(BN=Function.prototype[Symbol.hasInstance],Object.defineProperty(Vi,Symbol.hasInstance,{value:function(e){return BN.call(this,e)?!0:this!==Vi?!1:e&&e._writableState instanceof hb}})):BN=function(e){return e instanceof this};function Vi(t){Fw=Fw||Vm();var e=this instanceof Fw;if(!e&&!BN.call(Vi,this))return new Vi(t);this._writableState=new hb(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Yke.call(this)}Vi.prototype.pipe=function(){Nw(this,new CFt)};function bFt(t,e){var r=new vFt;Nw(t,r),process.nextTick(e,r)}function PFt(t,e,r,s){var a;return r===null?a=new BFt:typeof r!="string"&&!e.objectMode&&(a=new yFt("chunk",["string","Buffer"],r)),a?(Nw(t,a),process.nextTick(s,a),!1):!0}Vi.prototype.write=function(t,e,r){var s=this._writableState,a=!1,n=!s.objectMode&&gFt(t);return n&&!vN.isBuffer(t)&&(t=hFt(t)),typeof e=="function"&&(r=e,e=null),n?e="buffer":e||(e=s.defaultEncoding),typeof r!="function"&&(r=DFt),s.ending?bFt(this,r):(n||PFt(this,s,t,r))&&(s.pendingcb++,a=kFt(this,s,n,t,e,r)),a};Vi.prototype.cork=function(){this._writableState.corked++};Vi.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Vke(this,t))};Vi.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new SFt(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Vi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function xFt(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=vN.from(e,r)),e}Object.defineProperty(Vi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function kFt(t,e,r,s,a,n){if(!r){var c=xFt(e,s,a);s!==c&&(r=!0,a="buffer",s=c)}var f=e.objectMode?1:s.length;e.length+=f;var p=e.length{"use strict";var _Ft=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Zke.exports=yA;var zke=LV(),OV=FV();ug()(yA,zke);for(NV=_Ft(OV.prototype),SN=0;SN{var bN=ye("buffer"),uh=bN.Buffer;function Xke(t,e){for(var r in t)e[r]=t[r]}uh.from&&uh.alloc&&uh.allocUnsafe&&uh.allocUnsafeSlow?$ke.exports=bN:(Xke(bN,MV),MV.Buffer=Ow);function Ow(t,e,r){return uh(t,e,r)}Xke(uh,Ow);Ow.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return uh(t,e,r)};Ow.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var s=uh(t);return e!==void 0?typeof r=="string"?s.fill(e,r):s.fill(e):s.fill(0),s};Ow.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return uh(t)};Ow.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bN.SlowBuffer(t)}});var HV=L(rQe=>{"use strict";var UV=eQe().Buffer,tQe=UV.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function jFt(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function qFt(t){var e=jFt(t);if(typeof e!="string"&&(UV.isEncoding===tQe||!tQe(t)))throw new Error("Unknown encoding: "+t);return e||t}rQe.StringDecoder=gb;function gb(t){this.encoding=qFt(t);var e;switch(this.encoding){case"utf16le":this.text=JFt,this.end=zFt,e=4;break;case"utf8":this.fillLast=YFt,e=4;break;case"base64":this.text=ZFt,this.end=XFt,e=3;break;default:this.write=$Ft,this.end=eNt;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=UV.allocUnsafe(e)}gb.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function GFt(t,e,r){var s=e.length-1;if(s=0?(a>0&&(t.lastNeed=a-1),a):--s=0?(a>0&&(t.lastNeed=a-2),a):--s=0?(a>0&&(a===2?a=0:t.lastNeed=a-3),a):0))}function WFt(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function YFt(t){var e=this.lastTotal-this.lastNeed,r=WFt(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function VFt(t,e){var r=GFt(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var s=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,s),t.toString("utf8",e,s)}function KFt(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function JFt(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var s=r.charCodeAt(r.length-1);if(s>=55296&&s<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function zFt(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function ZFt(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function XFt(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function $Ft(t){return t.toString(this.encoding)}function eNt(t){return t&&t.length?this.write(t):""}});var PN=L((AIr,sQe)=>{"use strict";var nQe=cg().codes.ERR_STREAM_PREMATURE_CLOSE;function tNt(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,s=new Array(r),a=0;a{"use strict";var xN;function Ag(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var iNt=PN(),pg=Symbol("lastResolve"),Km=Symbol("lastReject"),db=Symbol("error"),kN=Symbol("ended"),Jm=Symbol("lastPromise"),jV=Symbol("handlePromise"),zm=Symbol("stream");function hg(t,e){return{value:t,done:e}}function sNt(t){var e=t[pg];if(e!==null){var r=t[zm].read();r!==null&&(t[Jm]=null,t[pg]=null,t[Km]=null,e(hg(r,!1)))}}function oNt(t){process.nextTick(sNt,t)}function aNt(t,e){return function(r,s){t.then(function(){if(e[kN]){r(hg(void 0,!0));return}e[jV](r,s)},s)}}var lNt=Object.getPrototypeOf(function(){}),cNt=Object.setPrototypeOf((xN={get stream(){return this[zm]},next:function(){var e=this,r=this[db];if(r!==null)return Promise.reject(r);if(this[kN])return Promise.resolve(hg(void 0,!0));if(this[zm].destroyed)return new Promise(function(c,f){process.nextTick(function(){e[db]?f(e[db]):c(hg(void 0,!0))})});var s=this[Jm],a;if(s)a=new Promise(aNt(s,this));else{var n=this[zm].read();if(n!==null)return Promise.resolve(hg(n,!1));a=new Promise(this[jV])}return this[Jm]=a,a}},Ag(xN,Symbol.asyncIterator,function(){return this}),Ag(xN,"return",function(){var e=this;return new Promise(function(r,s){e[zm].destroy(null,function(a){if(a){s(a);return}r(hg(void 0,!0))})})}),xN),lNt),uNt=function(e){var r,s=Object.create(cNt,(r={},Ag(r,zm,{value:e,writable:!0}),Ag(r,pg,{value:null,writable:!0}),Ag(r,Km,{value:null,writable:!0}),Ag(r,db,{value:null,writable:!0}),Ag(r,kN,{value:e._readableState.endEmitted,writable:!0}),Ag(r,jV,{value:function(n,c){var f=s[zm].read();f?(s[Jm]=null,s[pg]=null,s[Km]=null,n(hg(f,!1))):(s[pg]=n,s[Km]=c)},writable:!0}),r));return s[Jm]=null,iNt(e,function(a){if(a&&a.code!=="ERR_STREAM_PREMATURE_CLOSE"){var n=s[Km];n!==null&&(s[Jm]=null,s[pg]=null,s[Km]=null,n(a)),s[db]=a;return}var c=s[pg];c!==null&&(s[Jm]=null,s[pg]=null,s[Km]=null,c(hg(void 0,!0))),s[kN]=!0}),e.on("readable",oNt.bind(null,s)),s};oQe.exports=uNt});var fQe=L((hIr,uQe)=>{"use strict";function lQe(t,e,r,s,a,n,c){try{var f=t[n](c),p=f.value}catch(h){r(h);return}f.done?e(p):Promise.resolve(p).then(s,a)}function fNt(t){return function(){var e=this,r=arguments;return new Promise(function(s,a){var n=t.apply(e,r);function c(p){lQe(n,s,a,c,f,"next",p)}function f(p){lQe(n,s,a,c,f,"throw",p)}c(void 0)})}}function cQe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,s)}return r}function ANt(t){for(var e=1;e{"use strict";CQe.exports=Pn;var Lw;Pn.ReadableState=gQe;var gIr=ye("events").EventEmitter,hQe=function(e,r){return e.listeners(r).length},yb=vV(),QN=ye("buffer").Buffer,dNt=global.Uint8Array||function(){};function mNt(t){return QN.from(t)}function yNt(t){return QN.isBuffer(t)||t instanceof dNt}var qV=ye("util"),ln;qV&&qV.debuglog?ln=qV.debuglog("stream"):ln=function(){};var ENt=Fke(),zV=bV(),INt=PV(),CNt=INt.getHighWaterMark,TN=cg().codes,wNt=TN.ERR_INVALID_ARG_TYPE,BNt=TN.ERR_STREAM_PUSH_AFTER_EOF,vNt=TN.ERR_METHOD_NOT_IMPLEMENTED,SNt=TN.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Mw,GV,WV;ug()(Pn,yb);var mb=zV.errorOrDestroy,YV=["error","close","destroy","pause","resume"];function DNt(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function gQe(t,e,r){Lw=Lw||Vm(),t=t||{},typeof r!="boolean"&&(r=e instanceof Lw),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=CNt(this,t,"readableHighWaterMark",r),this.buffer=new ENt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Mw||(Mw=HV().StringDecoder),this.decoder=new Mw(t.encoding),this.encoding=t.encoding)}function Pn(t){if(Lw=Lw||Vm(),!(this instanceof Pn))return new Pn(t);var e=this instanceof Lw;this._readableState=new gQe(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),yb.call(this)}Object.defineProperty(Pn.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Pn.prototype.destroy=zV.destroy;Pn.prototype._undestroy=zV.undestroy;Pn.prototype._destroy=function(t,e){e(t)};Pn.prototype.push=function(t,e){var r=this._readableState,s;return r.objectMode?s=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=QN.from(t,e),e=""),s=!0),dQe(this,t,e,!1,s)};Pn.prototype.unshift=function(t){return dQe(this,t,null,!0,!1)};function dQe(t,e,r,s,a){ln("readableAddChunk",e);var n=t._readableState;if(e===null)n.reading=!1,xNt(t,n);else{var c;if(a||(c=bNt(n,e)),c)mb(t,c);else if(n.objectMode||e&&e.length>0)if(typeof e!="string"&&!n.objectMode&&Object.getPrototypeOf(e)!==QN.prototype&&(e=mNt(e)),s)n.endEmitted?mb(t,new SNt):VV(t,n,e,!0);else if(n.ended)mb(t,new BNt);else{if(n.destroyed)return!1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?VV(t,n,e,!1):JV(t,n)):VV(t,n,e,!1)}else s||(n.reading=!1,JV(t,n))}return!n.ended&&(n.length=AQe?t=AQe:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function pQe(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=PNt(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Pn.prototype.read=function(t){ln("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return ln("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?KV(this):RN(this),null;if(t=pQe(t,e),t===0&&e.ended)return e.length===0&&KV(this),null;var s=e.needReadable;ln("need readable",s),(e.length===0||e.length-t0?a=EQe(t,e):a=null,a===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&KV(this)),a!==null&&this.emit("data",a),a};function xNt(t,e){if(ln("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?RN(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,mQe(t)))}}function RN(t){var e=t._readableState;ln("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(ln("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(mQe,t))}function mQe(t){var e=t._readableState;ln("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,ZV(t)}function JV(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(kNt,t,e))}function kNt(t,e){for(;!e.reading&&!e.ended&&(e.length1&&IQe(s.pipes,t)!==-1)&&!h&&(ln("false write response, pause",s.awaitDrain),s.awaitDrain++),r.pause())}function S(N){ln("onerror",N),R(),t.removeListener("error",S),hQe(t,"error")===0&&mb(t,N)}DNt(t,"error",S);function P(){t.removeListener("finish",I),R()}t.once("close",P);function I(){ln("onfinish"),t.removeListener("close",P),R()}t.once("finish",I);function R(){ln("unpipe"),r.unpipe(t)}return t.emit("pipe",r),s.flowing||(ln("pipe resume"),r.resume()),t};function QNt(t){return function(){var r=t._readableState;ln("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&hQe(t,"data")&&(r.flowing=!0,ZV(t))}}Pn.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var s=e.pipes,a=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var n=0;n0,s.flowing!==!1&&this.resume()):t==="readable"&&!s.endEmitted&&!s.readableListening&&(s.readableListening=s.needReadable=!0,s.flowing=!1,s.emittedReadable=!1,ln("on readable",s.length,s.reading),s.length?RN(this):s.reading||process.nextTick(TNt,this)),r};Pn.prototype.addListener=Pn.prototype.on;Pn.prototype.removeListener=function(t,e){var r=yb.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(yQe,this),r};Pn.prototype.removeAllListeners=function(t){var e=yb.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(yQe,this),e};function yQe(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function TNt(t){ln("readable nexttick read 0"),t.read(0)}Pn.prototype.resume=function(){var t=this._readableState;return t.flowing||(ln("resume"),t.flowing=!t.readableListening,RNt(this,t)),t.paused=!1,this};function RNt(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(FNt,t,e))}function FNt(t,e){ln("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ZV(t),e.flowing&&!e.reading&&t.read(0)}Pn.prototype.pause=function(){return ln("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ln("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function ZV(t){var e=t._readableState;for(ln("flow",e.flowing);e.flowing&&t.read()!==null;);}Pn.prototype.wrap=function(t){var e=this,r=this._readableState,s=!1;t.on("end",function(){if(ln("wrapped end"),r.decoder&&!r.ended){var c=r.decoder.end();c&&c.length&&e.push(c)}e.push(null)}),t.on("data",function(c){if(ln("wrapped data"),r.decoder&&(c=r.decoder.write(c)),!(r.objectMode&&c==null)&&!(!r.objectMode&&(!c||!c.length))){var f=e.push(c);f||(s=!0,t.pause())}});for(var a in t)this[a]===void 0&&typeof t[a]=="function"&&(this[a]=function(f){return function(){return t[f].apply(t,arguments)}}(a));for(var n=0;n=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function KV(t){var e=t._readableState;ln("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(NNt,e,t))}function NNt(t,e){if(ln("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Pn.from=function(t,e){return WV===void 0&&(WV=fQe()),WV(Pn,t,e)});function IQe(t,e){for(var r=0,s=t.length;r{"use strict";BQe.exports=fh;var FN=cg().codes,ONt=FN.ERR_METHOD_NOT_IMPLEMENTED,LNt=FN.ERR_MULTIPLE_CALLBACK,MNt=FN.ERR_TRANSFORM_ALREADY_TRANSFORMING,_Nt=FN.ERR_TRANSFORM_WITH_LENGTH_0,NN=Vm();ug()(fh,NN);function UNt(t,e){var r=this._transformState;r.transforming=!1;var s=r.writecb;if(s===null)return this.emit("error",new LNt);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),s(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length{"use strict";SQe.exports=Eb;var vQe=XV();ug()(Eb,vQe);function Eb(t){if(!(this instanceof Eb))return new Eb(t);vQe.call(this,t)}Eb.prototype._transform=function(t,e,r){r(null,t)}});var QQe=L((EIr,kQe)=>{"use strict";var $V;function jNt(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var xQe=cg().codes,qNt=xQe.ERR_MISSING_ARGS,GNt=xQe.ERR_STREAM_DESTROYED;function bQe(t){if(t)throw t}function WNt(t){return t.setHeader&&typeof t.abort=="function"}function YNt(t,e,r,s){s=jNt(s);var a=!1;t.on("close",function(){a=!0}),$V===void 0&&($V=PN()),$V(t,{readable:e,writable:r},function(c){if(c)return s(c);a=!0,s()});var n=!1;return function(c){if(!a&&!n){if(n=!0,WNt(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();s(c||new GNt("pipe"))}}}function PQe(t){t()}function VNt(t,e){return t.pipe(e)}function KNt(t){return!t.length||typeof t[t.length-1]!="function"?bQe:t.pop()}function JNt(){for(var t=arguments.length,e=new Array(t),r=0;r0;return YNt(c,p,h,function(E){a||(a=E),E&&n.forEach(PQe),!p&&(n.forEach(PQe),s(a))})});return e.reduce(VNt)}kQe.exports=JNt});var _w=L((Xc,Cb)=>{var Ib=ye("stream");process.env.READABLE_STREAM==="disable"&&Ib?(Cb.exports=Ib.Readable,Object.assign(Cb.exports,Ib),Cb.exports.Stream=Ib):(Xc=Cb.exports=LV(),Xc.Stream=Ib||Xc,Xc.Readable=Xc,Xc.Writable=FV(),Xc.Duplex=Vm(),Xc.Transform=XV(),Xc.PassThrough=DQe(),Xc.finished=PN(),Xc.pipeline=QQe())});var FQe=L((IIr,RQe)=>{"use strict";var{Buffer:uf}=ye("buffer"),TQe=Symbol.for("BufferList");function Ci(t){if(!(this instanceof Ci))return new Ci(t);Ci._init.call(this,t)}Ci._init=function(e){Object.defineProperty(this,TQe,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};Ci.prototype._new=function(e){return new Ci(e)};Ci.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let s=0;sthis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};Ci.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};Ci.prototype.copy=function(e,r,s,a){if((typeof s!="number"||s<0)&&(s=0),(typeof a!="number"||a>this.length)&&(a=this.length),s>=this.length||a<=0)return e||uf.alloc(0);let n=!!e,c=this._offset(s),f=a-s,p=f,h=n&&r||0,E=c[1];if(s===0&&a===this.length){if(!n)return this._bufs.length===1?this._bufs[0]:uf.concat(this._bufs,this.length);for(let C=0;CS)this._bufs[C].copy(e,h,E),h+=S;else{this._bufs[C].copy(e,h,E,E+p),h+=S;break}p-=S,E&&(E=0)}return e.length>h?e.slice(0,h):e};Ci.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let s=this._offset(e),a=this._offset(r),n=this._bufs.slice(s[0],a[0]+1);return a[1]===0?n.pop():n[n.length-1]=n[n.length-1].slice(0,a[1]),s[1]!==0&&(n[0]=n[0].slice(s[1])),this._new(n)};Ci.prototype.toString=function(e,r,s){return this.slice(r,s).toString(e)};Ci.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};Ci.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let s=this._offset(e),a=s[0],n=s[1];for(;a=t.length){let p=c.indexOf(t,n);if(p!==-1)return this._reverseOffset([a,p]);n=c.length-t.length+1}else{let p=this._reverseOffset([a,n]);if(this._match(p,t))return p;n++}n=0}return-1};Ci.prototype._match=function(t,e){if(this.length-t{"use strict";var e7=_w().Duplex,zNt=ug(),wb=FQe();function na(t){if(!(this instanceof na))return new na(t);if(typeof t=="function"){this._callback=t;let e=function(s){this._callback&&(this._callback(s),this._callback=null)}.bind(this);this.on("pipe",function(s){s.on("error",e)}),this.on("unpipe",function(s){s.removeListener("error",e)}),t=null}wb._init.call(this,t),e7.call(this)}zNt(na,e7);Object.assign(na.prototype,wb.prototype);na.prototype._new=function(e){return new na(e)};na.prototype._write=function(e,r,s){this._appendBuffer(e),typeof s=="function"&&s()};na.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};na.prototype.end=function(e){e7.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};na.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};na.prototype._isBufferList=function(e){return e instanceof na||e instanceof wb||na.isBufferList(e)};na.isBufferList=wb.isBufferList;ON.exports=na;ON.exports.BufferListStream=na;ON.exports.BufferList=wb});var n7=L(Hw=>{var ZNt=Buffer.alloc,XNt="0000000000000000000",$Nt="7777777777777777777",OQe=48,LQe=Buffer.from("ustar\0","binary"),eOt=Buffer.from("00","binary"),tOt=Buffer.from("ustar ","binary"),rOt=Buffer.from(" \0","binary"),nOt=parseInt("7777",8),Bb=257,r7=263,iOt=function(t,e,r){return typeof t!="number"?r:(t=~~t,t>=e?e:t>=0||(t+=e,t>=0)?t:0)},sOt=function(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},oOt=function(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},MQe=function(t,e,r,s){for(;re?$Nt.slice(0,e)+" ":XNt.slice(0,e-t.length)+t+" "};function aOt(t){var e;if(t[0]===128)e=!0;else if(t[0]===255)e=!1;else return null;for(var r=[],s=t.length-1;s>0;s--){var a=t[s];e?r.push(a):r.push(255-a)}var n=0,c=r.length;for(s=0;s=Math.pow(10,r)&&r++,e+r+t};Hw.decodeLongPath=function(t,e){return Uw(t,0,t.length,e)};Hw.encodePax=function(t){var e="";t.name&&(e+=t7(" path="+t.name+` +`)),t.linkname&&(e+=t7(" linkpath="+t.linkname+` +`));var r=t.pax;if(r)for(var s in r)e+=t7(" "+s+"="+r[s]+` +`);return Buffer.from(e)};Hw.decodePax=function(t){for(var e={};t.length;){for(var r=0;r100;){var a=r.indexOf("/");if(a===-1)return null;s+=s?"/"+r.slice(0,a):r.slice(0,a),r=r.slice(a+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(s)>155||t.linkname&&Buffer.byteLength(t.linkname)>100?null:(e.write(r),e.write(gg(t.mode&nOt,6),100),e.write(gg(t.uid,6),108),e.write(gg(t.gid,6),116),e.write(gg(t.size,11),124),e.write(gg(t.mtime.getTime()/1e3|0,11),136),e[156]=OQe+oOt(t.type),t.linkname&&e.write(t.linkname,157),LQe.copy(e,Bb),eOt.copy(e,r7),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(gg(t.devmajor||0,6),329),e.write(gg(t.devminor||0,6),337),s&&e.write(s,345),e.write(gg(_Qe(e),6),148),e)};Hw.decode=function(t,e,r){var s=t[156]===0?0:t[156]-OQe,a=Uw(t,0,100,e),n=dg(t,100,8),c=dg(t,108,8),f=dg(t,116,8),p=dg(t,124,12),h=dg(t,136,12),E=sOt(s),C=t[157]===0?null:Uw(t,157,100,e),S=Uw(t,265,32),P=Uw(t,297,32),I=dg(t,329,8),R=dg(t,337,8),N=_Qe(t);if(N===8*32)return null;if(N!==dg(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(LQe.compare(t,Bb,Bb+6)===0)t[345]&&(a=Uw(t,345,155,e)+"/"+a);else if(!(tOt.compare(t,Bb,Bb+6)===0&&rOt.compare(t,r7,r7+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return s===0&&a&&a[a.length-1]==="/"&&(s=5),{name:a,mode:n,uid:c,gid:f,size:p,mtime:new Date(1e3*h),type:E,linkname:C,uname:S,gname:P,devmajor:I,devminor:R}}});var YQe=L((BIr,WQe)=>{var HQe=ye("util"),lOt=NQe(),vb=n7(),jQe=_w().Writable,qQe=_w().PassThrough,GQe=function(){},UQe=function(t){return t&=511,t&&512-t},cOt=function(t,e){var r=new LN(t,e);return r.end(),r},uOt=function(t,e){return e.path&&(t.name=e.path),e.linkpath&&(t.linkname=e.linkpath),e.size&&(t.size=parseInt(e.size,10)),t.pax=e,t},LN=function(t,e){this._parent=t,this.offset=e,qQe.call(this,{autoDestroy:!1})};HQe.inherits(LN,qQe);LN.prototype.destroy=function(t){this._parent.destroy(t)};var Ah=function(t){if(!(this instanceof Ah))return new Ah(t);jQe.call(this,t),t=t||{},this._offset=0,this._buffer=lOt(),this._missing=0,this._partial=!1,this._onparse=GQe,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var e=this,r=e._buffer,s=function(){e._continue()},a=function(S){if(e._locked=!1,S)return e.destroy(S);e._stream||s()},n=function(){e._stream=null;var S=UQe(e._header.size);S?e._parse(S,c):e._parse(512,C),e._locked||s()},c=function(){e._buffer.consume(UQe(e._header.size)),e._parse(512,C),s()},f=function(){var S=e._header.size;e._paxGlobal=vb.decodePax(r.slice(0,S)),r.consume(S),n()},p=function(){var S=e._header.size;e._pax=vb.decodePax(r.slice(0,S)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),r.consume(S),n()},h=function(){var S=e._header.size;this._gnuLongPath=vb.decodeLongPath(r.slice(0,S),t.filenameEncoding),r.consume(S),n()},E=function(){var S=e._header.size;this._gnuLongLinkPath=vb.decodeLongPath(r.slice(0,S),t.filenameEncoding),r.consume(S),n()},C=function(){var S=e._offset,P;try{P=e._header=vb.decode(r.slice(0,512),t.filenameEncoding,t.allowUnknownFormat)}catch(I){e.emit("error",I)}if(r.consume(512),!P){e._parse(512,C),s();return}if(P.type==="gnu-long-path"){e._parse(P.size,h),s();return}if(P.type==="gnu-long-link-path"){e._parse(P.size,E),s();return}if(P.type==="pax-global-header"){e._parse(P.size,f),s();return}if(P.type==="pax-header"){e._parse(P.size,p),s();return}if(e._gnuLongPath&&(P.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(P.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=P=uOt(P,e._pax),e._pax=null),e._locked=!0,!P.size||P.type==="directory"){e._parse(512,C),e.emit("entry",P,cOt(e,S),a);return}e._stream=new LN(e,S),e.emit("entry",P,e._stream,a),e._parse(P.size,n),s()};this._onheader=C,this._parse(512,C)};HQe.inherits(Ah,jQe);Ah.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.emit("close"))};Ah.prototype._parse=function(t,e){this._destroyed||(this._offset+=t,this._missing=t,e===this._onheader&&(this._partial=!1),this._onparse=e)};Ah.prototype._continue=function(){if(!this._destroyed){var t=this._cb;this._cb=GQe,this._overflow?this._write(this._overflow,void 0,t):t()}};Ah.prototype._write=function(t,e,r){if(!this._destroyed){var s=this._stream,a=this._buffer,n=this._missing;if(t.length&&(this._partial=!0),t.lengthn&&(c=t.slice(n),t=t.slice(0,n)),s?s.end(t):a.append(t),this._overflow=c,this._onparse()}};Ah.prototype._final=function(t){if(this._partial)return this.destroy(new Error("Unexpected end of data"));t()};WQe.exports=Ah});var KQe=L((vIr,VQe)=>{VQe.exports=ye("fs").constants||ye("constants")});var $Qe=L((SIr,XQe)=>{var jw=KQe(),JQe=kH(),_N=ug(),fOt=Buffer.alloc,zQe=_w().Readable,qw=_w().Writable,AOt=ye("string_decoder").StringDecoder,MN=n7(),pOt=parseInt("755",8),hOt=parseInt("644",8),ZQe=fOt(1024),s7=function(){},i7=function(t,e){e&=511,e&&t.push(ZQe.slice(0,512-e))};function gOt(t){switch(t&jw.S_IFMT){case jw.S_IFBLK:return"block-device";case jw.S_IFCHR:return"character-device";case jw.S_IFDIR:return"directory";case jw.S_IFIFO:return"fifo";case jw.S_IFLNK:return"symlink"}return"file"}var UN=function(t){qw.call(this),this.written=0,this._to=t,this._destroyed=!1};_N(UN,qw);UN.prototype._write=function(t,e,r){if(this.written+=t.length,this._to.push(t))return r();this._to._drain=r};UN.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var HN=function(){qw.call(this),this.linkname="",this._decoder=new AOt("utf-8"),this._destroyed=!1};_N(HN,qw);HN.prototype._write=function(t,e,r){this.linkname+=this._decoder.write(t),r()};HN.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var Sb=function(){qw.call(this),this._destroyed=!1};_N(Sb,qw);Sb.prototype._write=function(t,e,r){r(new Error("No body allowed for this entry"))};Sb.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var EA=function(t){if(!(this instanceof EA))return new EA(t);zQe.call(this,t),this._drain=s7,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};_N(EA,zQe);EA.prototype.entry=function(t,e,r){if(this._stream)throw new Error("already piping an entry");if(!(this._finalized||this._destroyed)){typeof e=="function"&&(r=e,e=null),r||(r=s7);var s=this;if((!t.size||t.type==="symlink")&&(t.size=0),t.type||(t.type=gOt(t.mode)),t.mode||(t.mode=t.type==="directory"?pOt:hOt),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),typeof e=="string"&&(e=Buffer.from(e)),Buffer.isBuffer(e)){t.size=e.length,this._encode(t);var a=this.push(e);return i7(s,t.size),a?process.nextTick(r):this._drain=r,new Sb}if(t.type==="symlink"&&!t.linkname){var n=new HN;return JQe(n,function(f){if(f)return s.destroy(),r(f);t.linkname=n.linkname,s._encode(t),r()}),n}if(this._encode(t),t.type!=="file"&&t.type!=="contiguous-file")return process.nextTick(r),new Sb;var c=new UN(this);return this._stream=c,JQe(c,function(f){if(s._stream=null,f)return s.destroy(),r(f);if(c.written!==t.size)return s.destroy(),r(new Error("size mismatch"));i7(s,t.size),s._finalizing&&s.finalize(),r()}),c}};EA.prototype.finalize=function(){if(this._stream){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(ZQe),this.push(null))};EA.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())};EA.prototype._encode=function(t){if(!t.pax){var e=MN.encode(t);if(e){this.push(e);return}}this._encodePax(t)};EA.prototype._encodePax=function(t){var e=MN.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:e.length,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(MN.encode(r)),this.push(e),i7(this,e.length),r.size=t.size,r.type=t.type,this.push(MN.encode(r))};EA.prototype._read=function(t){var e=this._drain;this._drain=s7,e()};XQe.exports=EA});var eTe=L(o7=>{o7.extract=YQe();o7.pack=$Qe()});var pTe=L(Ra=>{"use strict";var POt=Ra&&Ra.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Minipass=Ra.isWritable=Ra.isReadable=Ra.isStream=void 0;var lTe=typeof process=="object"&&process?process:{stdout:null,stderr:null},y7=ye("node:events"),ATe=POt(ye("node:stream")),xOt=ye("node:string_decoder"),kOt=t=>!!t&&typeof t=="object"&&(t instanceof zN||t instanceof ATe.default||(0,Ra.isReadable)(t)||(0,Ra.isWritable)(t));Ra.isStream=kOt;var QOt=t=>!!t&&typeof t=="object"&&t instanceof y7.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==ATe.default.Writable.prototype.pipe;Ra.isReadable=QOt;var TOt=t=>!!t&&typeof t=="object"&&t instanceof y7.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function";Ra.isWritable=TOt;var ph=Symbol("EOF"),hh=Symbol("maybeEmitEnd"),mg=Symbol("emittedEnd"),GN=Symbol("emittingEnd"),Db=Symbol("emittedError"),WN=Symbol("closed"),cTe=Symbol("read"),YN=Symbol("flush"),uTe=Symbol("flushChunk"),ff=Symbol("encoding"),Ww=Symbol("decoder"),zs=Symbol("flowing"),bb=Symbol("paused"),Yw=Symbol("resume"),Zs=Symbol("buffer"),Ta=Symbol("pipes"),Xs=Symbol("bufferLength"),A7=Symbol("bufferPush"),VN=Symbol("bufferShift"),ia=Symbol("objectMode"),ts=Symbol("destroyed"),p7=Symbol("error"),h7=Symbol("emitData"),fTe=Symbol("emitEnd"),g7=Symbol("emitEnd2"),CA=Symbol("async"),d7=Symbol("abort"),KN=Symbol("aborted"),Pb=Symbol("signal"),Zm=Symbol("dataListeners"),nc=Symbol("discarded"),xb=t=>Promise.resolve().then(t),ROt=t=>t(),FOt=t=>t==="end"||t==="finish"||t==="prefinish",NOt=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,OOt=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),JN=class{src;dest;opts;ondrain;constructor(e,r,s){this.src=e,this.dest=r,this.opts=s,this.ondrain=()=>e[Yw](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},m7=class extends JN{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,s){super(e,r,s),this.proxyErrors=a=>r.emit("error",a),e.on("error",this.proxyErrors)}},LOt=t=>!!t.objectMode,MOt=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",zN=class extends y7.EventEmitter{[zs]=!1;[bb]=!1;[Ta]=[];[Zs]=[];[ia];[ff];[CA];[Ww];[ph]=!1;[mg]=!1;[GN]=!1;[WN]=!1;[Db]=null;[Xs]=0;[ts]=!1;[Pb];[KN]=!1;[Zm]=0;[nc]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");LOt(r)?(this[ia]=!0,this[ff]=null):MOt(r)?(this[ff]=r.encoding,this[ia]=!1):(this[ia]=!1,this[ff]=null),this[CA]=!!r.async,this[Ww]=this[ff]?new xOt.StringDecoder(this[ff]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Zs]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Ta]});let{signal:s}=r;s&&(this[Pb]=s,s.aborted?this[d7]():s.addEventListener("abort",()=>this[d7]()))}get bufferLength(){return this[Xs]}get encoding(){return this[ff]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ia]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[CA]}set async(e){this[CA]=this[CA]||!!e}[d7](){this[KN]=!0,this.emit("abort",this[Pb]?.reason),this.destroy(this[Pb]?.reason)}get aborted(){return this[KN]}set aborted(e){}write(e,r,s){if(this[KN])return!1;if(this[ph])throw new Error("write after end");if(this[ts])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(s=r,r="utf8"),r||(r="utf8");let a=this[CA]?xb:ROt;if(!this[ia]&&!Buffer.isBuffer(e)){if(OOt(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(NOt(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[ia]?(this[zs]&&this[Xs]!==0&&this[YN](!0),this[zs]?this.emit("data",e):this[A7](e),this[Xs]!==0&&this.emit("readable"),s&&a(s),this[zs]):e.length?(typeof e=="string"&&!(r===this[ff]&&!this[Ww]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[ff]&&(e=this[Ww].write(e)),this[zs]&&this[Xs]!==0&&this[YN](!0),this[zs]?this.emit("data",e):this[A7](e),this[Xs]!==0&&this.emit("readable"),s&&a(s),this[zs]):(this[Xs]!==0&&this.emit("readable"),s&&a(s),this[zs])}read(e){if(this[ts])return null;if(this[nc]=!1,this[Xs]===0||e===0||e&&e>this[Xs])return this[hh](),null;this[ia]&&(e=null),this[Zs].length>1&&!this[ia]&&(this[Zs]=[this[ff]?this[Zs].join(""):Buffer.concat(this[Zs],this[Xs])]);let r=this[cTe](e||null,this[Zs][0]);return this[hh](),r}[cTe](e,r){if(this[ia])this[VN]();else{let s=r;e===s.length||e===null?this[VN]():typeof s=="string"?(this[Zs][0]=s.slice(e),r=s.slice(0,e),this[Xs]-=e):(this[Zs][0]=s.subarray(e),r=s.subarray(0,e),this[Xs]-=e)}return this.emit("data",r),!this[Zs].length&&!this[ph]&&this.emit("drain"),r}end(e,r,s){return typeof e=="function"&&(s=e,e=void 0),typeof r=="function"&&(s=r,r="utf8"),e!==void 0&&this.write(e,r),s&&this.once("end",s),this[ph]=!0,this.writable=!1,(this[zs]||!this[bb])&&this[hh](),this}[Yw](){this[ts]||(!this[Zm]&&!this[Ta].length&&(this[nc]=!0),this[bb]=!1,this[zs]=!0,this.emit("resume"),this[Zs].length?this[YN]():this[ph]?this[hh]():this.emit("drain"))}resume(){return this[Yw]()}pause(){this[zs]=!1,this[bb]=!0,this[nc]=!1}get destroyed(){return this[ts]}get flowing(){return this[zs]}get paused(){return this[bb]}[A7](e){this[ia]?this[Xs]+=1:this[Xs]+=e.length,this[Zs].push(e)}[VN](){return this[ia]?this[Xs]-=1:this[Xs]-=this[Zs][0].length,this[Zs].shift()}[YN](e=!1){do;while(this[uTe](this[VN]())&&this[Zs].length);!e&&!this[Zs].length&&!this[ph]&&this.emit("drain")}[uTe](e){return this.emit("data",e),this[zs]}pipe(e,r){if(this[ts])return e;this[nc]=!1;let s=this[mg];return r=r||{},e===lTe.stdout||e===lTe.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,s?r.end&&e.end():(this[Ta].push(r.proxyErrors?new m7(this,e,r):new JN(this,e,r)),this[CA]?xb(()=>this[Yw]()):this[Yw]()),e}unpipe(e){let r=this[Ta].find(s=>s.dest===e);r&&(this[Ta].length===1?(this[zs]&&this[Zm]===0&&(this[zs]=!1),this[Ta]=[]):this[Ta].splice(this[Ta].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let s=super.on(e,r);if(e==="data")this[nc]=!1,this[Zm]++,!this[Ta].length&&!this[zs]&&this[Yw]();else if(e==="readable"&&this[Xs]!==0)super.emit("readable");else if(FOt(e)&&this[mg])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Db]){let a=r;this[CA]?xb(()=>a.call(this,this[Db])):a.call(this,this[Db])}return s}removeListener(e,r){return this.off(e,r)}off(e,r){let s=super.off(e,r);return e==="data"&&(this[Zm]=this.listeners("data").length,this[Zm]===0&&!this[nc]&&!this[Ta].length&&(this[zs]=!1)),s}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Zm]=0,!this[nc]&&!this[Ta].length&&(this[zs]=!1)),r}get emittedEnd(){return this[mg]}[hh](){!this[GN]&&!this[mg]&&!this[ts]&&this[Zs].length===0&&this[ph]&&(this[GN]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[WN]&&this.emit("close"),this[GN]=!1)}emit(e,...r){let s=r[0];if(e!=="error"&&e!=="close"&&e!==ts&&this[ts])return!1;if(e==="data")return!this[ia]&&!s?!1:this[CA]?(xb(()=>this[h7](s)),!0):this[h7](s);if(e==="end")return this[fTe]();if(e==="close"){if(this[WN]=!0,!this[mg]&&!this[ts])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[Db]=s,super.emit(p7,s);let n=!this[Pb]||this.listeners("error").length?super.emit("error",s):!1;return this[hh](),n}else if(e==="resume"){let n=super.emit("resume");return this[hh](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let a=super.emit(e,...r);return this[hh](),a}[h7](e){for(let s of this[Ta])s.dest.write(e)===!1&&this.pause();let r=this[nc]?!1:super.emit("data",e);return this[hh](),r}[fTe](){return this[mg]?!1:(this[mg]=!0,this.readable=!1,this[CA]?(xb(()=>this[g7]()),!0):this[g7]())}[g7](){if(this[Ww]){let r=this[Ww].end();if(r){for(let s of this[Ta])s.dest.write(r);this[nc]||super.emit("data",r)}}for(let r of this[Ta])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[ia]||(e.dataLength=0);let r=this.promise();return this.on("data",s=>{e.push(s),this[ia]||(e.dataLength+=s.length)}),await r,e}async concat(){if(this[ia])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ff]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(ts,()=>r(new Error("stream destroyed"))),this.on("error",s=>r(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[nc]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let a=this.read();if(a!==null)return Promise.resolve({done:!1,value:a});if(this[ph])return r();let n,c,f=C=>{this.off("data",p),this.off("end",h),this.off(ts,E),r(),c(C)},p=C=>{this.off("error",f),this.off("end",h),this.off(ts,E),this.pause(),n({value:C,done:!!this[ph]})},h=()=>{this.off("error",f),this.off("data",p),this.off(ts,E),r(),n({done:!0,value:void 0})},E=()=>f(new Error("stream destroyed"));return new Promise((C,S)=>{c=S,n=C,this.once(ts,E),this.once("error",f),this.once("end",h),this.once("data",p)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[nc]=!1;let e=!1,r=()=>(this.pause(),this.off(p7,r),this.off(ts,r),this.off("end",r),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return r();let a=this.read();return a===null?r():{done:!1,value:a}};return this.once("end",r),this.once(p7,r),this.once(ts,r),{next:s,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[ts])return e?this.emit("error",e):this.emit(ts),this;this[ts]=!0,this[nc]=!0,this[Zs].length=0,this[Xs]=0;let r=this;return typeof r.close=="function"&&!this[WN]&&r.close(),e?this.emit("error",e):this.emit(ts),this}static get isStream(){return Ra.isStream}};Ra.Minipass=zN});var dTe=L((YIr,wA)=>{"use strict";var Qb=ye("crypto"),{Minipass:_Ot}=pTe(),I7=["sha512","sha384","sha256"],w7=["sha512"],UOt=/^[a-z0-9+/]+(?:=?=?)$/i,HOt=/^([a-z0-9]+)-([^?]+)([?\S*]*)$/,jOt=/^([a-z0-9]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)?$/,qOt=/^[\x21-\x7E]+$/,Tb=t=>t?.length?`?${t.join("?")}`:"",C7=class extends _Ot{#t;#r;#i;constructor(e){super(),this.size=0,this.opts=e,this.#e(),e?.algorithms?this.algorithms=[...e.algorithms]:this.algorithms=[...w7],this.algorithm!==null&&!this.algorithms.includes(this.algorithm)&&this.algorithms.push(this.algorithm),this.hashes=this.algorithms.map(Qb.createHash)}#e(){this.sri=this.opts?.integrity?ic(this.opts?.integrity,this.opts):null,this.expectedSize=this.opts?.size,this.sri?this.sri.isHash?(this.goodSri=!0,this.algorithm=this.sri.algorithm):(this.goodSri=!this.sri.isEmpty(),this.algorithm=this.sri.pickAlgorithm(this.opts)):this.algorithm=null,this.digests=this.goodSri?this.sri[this.algorithm]:null,this.optString=Tb(this.opts?.options)}on(e,r){return e==="size"&&this.#r?r(this.#r):e==="integrity"&&this.#t?r(this.#t):e==="verified"&&this.#i?r(this.#i):super.on(e,r)}emit(e,r){return e==="end"&&this.#n(),super.emit(e,r)}write(e){return this.size+=e.length,this.hashes.forEach(r=>r.update(e)),super.write(e)}#n(){this.goodSri||this.#e();let e=ic(this.hashes.map((s,a)=>`${this.algorithms[a]}-${s.digest("base64")}${this.optString}`).join(" "),this.opts),r=this.goodSri&&e.match(this.sri,this.opts);if(typeof this.expectedSize=="number"&&this.size!==this.expectedSize){let s=new Error(`stream size mismatch when checking ${this.sri}. + Wanted: ${this.expectedSize} + Found: ${this.size}`);s.code="EBADSIZE",s.found=this.size,s.expected=this.expectedSize,s.sri=this.sri,this.emit("error",s)}else if(this.sri&&!r){let s=new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${e}. (${this.size} bytes)`);s.code="EINTEGRITY",s.found=e,s.expected=this.digests,s.algorithm=this.algorithm,s.sri=this.sri,this.emit("error",s)}else this.#r=this.size,this.emit("size",this.size),this.#t=e,this.emit("integrity",e),r&&(this.#i=r,this.emit("verified",r))}},gh=class{get isHash(){return!0}constructor(e,r){let s=r?.strict;this.source=e.trim(),this.digest="",this.algorithm="",this.options=[];let a=this.source.match(s?jOt:HOt);if(!a||s&&!I7.includes(a[1]))return;this.algorithm=a[1],this.digest=a[2];let n=a[3];n&&(this.options=n.slice(1).split("?"))}hexDigest(){return this.digest&&Buffer.from(this.digest,"base64").toString("hex")}toJSON(){return this.toString()}match(e,r){let s=ic(e,r);if(!s)return!1;if(s.isIntegrity){let a=s.pickAlgorithm(r,[this.algorithm]);if(!a)return!1;let n=s[a].find(c=>c.digest===this.digest);return n||!1}return s.digest===this.digest?s:!1}toString(e){return e?.strict&&!(I7.includes(this.algorithm)&&this.digest.match(UOt)&&this.options.every(r=>r.match(qOt)))?"":`${this.algorithm}-${this.digest}${Tb(this.options)}`}};function hTe(t,e,r,s){let a=t!=="",n=!1,c="",f=s.length-1;for(let h=0;hs[a].find(c=>n.digest===c.digest)))throw new Error("hashes do not match, cannot update integrity")}else this[a]=s[a]}match(e,r){let s=ic(e,r);if(!s)return!1;let a=s.pickAlgorithm(r,Object.keys(this));return!!a&&this[a]&&s[a]&&this[a].find(n=>s[a].find(c=>n.digest===c.digest))||!1}pickAlgorithm(e,r){let s=e?.pickAlgorithm||ZOt,a=Object.keys(this).filter(n=>r?.length?r.includes(n):!0);return a.length?a.reduce((n,c)=>s(n,c)||n):null}};wA.exports.parse=ic;function ic(t,e){if(!t)return null;if(typeof t=="string")return E7(t,e);if(t.algorithm&&t.digest){let r=new Xm;return r[t.algorithm]=[t],E7(kb(r,e),e)}else return E7(kb(t,e),e)}function E7(t,e){if(e?.single)return new gh(t,e);let r=t.trim().split(/\s+/).reduce((s,a)=>{let n=new gh(a,e);if(n.algorithm&&n.digest){let c=n.algorithm;s[c]||(s[c]=[]),s[c].push(n)}return s},new Xm);return r.isEmpty()?null:r}wA.exports.stringify=kb;function kb(t,e){return t.algorithm&&t.digest?gh.prototype.toString.call(t,e):typeof t=="string"?kb(ic(t,e),e):Xm.prototype.toString.call(t,e)}wA.exports.fromHex=GOt;function GOt(t,e,r){let s=Tb(r?.options);return ic(`${e}-${Buffer.from(t,"hex").toString("base64")}${s}`,r)}wA.exports.fromData=WOt;function WOt(t,e){let r=e?.algorithms||[...w7],s=Tb(e?.options);return r.reduce((a,n)=>{let c=Qb.createHash(n).update(t).digest("base64"),f=new gh(`${n}-${c}${s}`,e);if(f.algorithm&&f.digest){let p=f.algorithm;a[p]||(a[p]=[]),a[p].push(f)}return a},new Xm)}wA.exports.fromStream=YOt;function YOt(t,e){let r=B7(e);return new Promise((s,a)=>{t.pipe(r),t.on("error",a),r.on("error",a);let n;r.on("integrity",c=>{n=c}),r.on("end",()=>s(n)),r.resume()})}wA.exports.checkData=VOt;function VOt(t,e,r){if(e=ic(e,r),!e||!Object.keys(e).length){if(r?.error)throw Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"});return!1}let s=e.pickAlgorithm(r),a=Qb.createHash(s).update(t).digest("base64"),n=ic({algorithm:s,digest:a}),c=n.match(e,r);if(r=r||{},c||!r.error)return c;if(typeof r.size=="number"&&t.length!==r.size){let f=new Error(`data size mismatch when checking ${e}. + Wanted: ${r.size} + Found: ${t.length}`);throw f.code="EBADSIZE",f.found=t.length,f.expected=r.size,f.sri=e,f}else{let f=new Error(`Integrity checksum failed when using ${s}: Wanted ${e}, but got ${n}. (${t.length} bytes)`);throw f.code="EINTEGRITY",f.found=n,f.expected=e,f.algorithm=s,f.sri=e,f}}wA.exports.checkStream=KOt;function KOt(t,e,r){if(r=r||Object.create(null),r.integrity=e,e=ic(e,r),!e||!Object.keys(e).length)return Promise.reject(Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"}));let s=B7(r);return new Promise((a,n)=>{t.pipe(s),t.on("error",n),s.on("error",n);let c;s.on("verified",f=>{c=f}),s.on("end",()=>a(c)),s.resume()})}wA.exports.integrityStream=B7;function B7(t=Object.create(null)){return new C7(t)}wA.exports.create=JOt;function JOt(t){let e=t?.algorithms||[...w7],r=Tb(t?.options),s=e.map(Qb.createHash);return{update:function(a,n){return s.forEach(c=>c.update(a,n)),this},digest:function(){return e.reduce((n,c)=>{let f=s.shift().digest("base64"),p=new gh(`${c}-${f}${r}`,t);if(p.algorithm&&p.digest){let h=p.algorithm;n[h]||(n[h]=[]),n[h].push(p)}return n},new Xm)}}}var zOt=Qb.getHashes(),gTe=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>zOt.includes(t));function ZOt(t,e){return gTe.indexOf(t.toLowerCase())>=gTe.indexOf(e.toLowerCase())?t:e}});var v7=L(yg=>{"use strict";Object.defineProperty(yg,"__esModule",{value:!0});yg.Signature=yg.Envelope=void 0;yg.Envelope={fromJSON(t){return{payload:ZN(t.payload)?Buffer.from(mTe(t.payload)):Buffer.alloc(0),payloadType:ZN(t.payloadType)?globalThis.String(t.payloadType):"",signatures:globalThis.Array.isArray(t?.signatures)?t.signatures.map(e=>yg.Signature.fromJSON(e)):[]}},toJSON(t){let e={};return t.payload.length!==0&&(e.payload=yTe(t.payload)),t.payloadType!==""&&(e.payloadType=t.payloadType),t.signatures?.length&&(e.signatures=t.signatures.map(r=>yg.Signature.toJSON(r))),e}};yg.Signature={fromJSON(t){return{sig:ZN(t.sig)?Buffer.from(mTe(t.sig)):Buffer.alloc(0),keyid:ZN(t.keyid)?globalThis.String(t.keyid):""}},toJSON(t){let e={};return t.sig.length!==0&&(e.sig=yTe(t.sig)),t.keyid!==""&&(e.keyid=t.keyid),e}};function mTe(t){return Uint8Array.from(globalThis.Buffer.from(t,"base64"))}function yTe(t){return globalThis.Buffer.from(t).toString("base64")}function ZN(t){return t!=null}});var ITe=L(XN=>{"use strict";Object.defineProperty(XN,"__esModule",{value:!0});XN.Timestamp=void 0;XN.Timestamp={fromJSON(t){return{seconds:ETe(t.seconds)?globalThis.String(t.seconds):"0",nanos:ETe(t.nanos)?globalThis.Number(t.nanos):0}},toJSON(t){let e={};return t.seconds!=="0"&&(e.seconds=t.seconds),t.nanos!==0&&(e.nanos=Math.round(t.nanos)),e}};function ETe(t){return t!=null}});var Vw=L(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.TimeRange=_r.X509CertificateChain=_r.SubjectAlternativeName=_r.X509Certificate=_r.DistinguishedName=_r.ObjectIdentifierValuePair=_r.ObjectIdentifier=_r.PublicKeyIdentifier=_r.PublicKey=_r.RFC3161SignedTimestamp=_r.LogId=_r.MessageSignature=_r.HashOutput=_r.SubjectAlternativeNameType=_r.PublicKeyDetails=_r.HashAlgorithm=void 0;_r.hashAlgorithmFromJSON=wTe;_r.hashAlgorithmToJSON=BTe;_r.publicKeyDetailsFromJSON=vTe;_r.publicKeyDetailsToJSON=STe;_r.subjectAlternativeNameTypeFromJSON=DTe;_r.subjectAlternativeNameTypeToJSON=bTe;var XOt=ITe(),El;(function(t){t[t.HASH_ALGORITHM_UNSPECIFIED=0]="HASH_ALGORITHM_UNSPECIFIED",t[t.SHA2_256=1]="SHA2_256",t[t.SHA2_384=2]="SHA2_384",t[t.SHA2_512=3]="SHA2_512",t[t.SHA3_256=4]="SHA3_256",t[t.SHA3_384=5]="SHA3_384"})(El||(_r.HashAlgorithm=El={}));function wTe(t){switch(t){case 0:case"HASH_ALGORITHM_UNSPECIFIED":return El.HASH_ALGORITHM_UNSPECIFIED;case 1:case"SHA2_256":return El.SHA2_256;case 2:case"SHA2_384":return El.SHA2_384;case 3:case"SHA2_512":return El.SHA2_512;case 4:case"SHA3_256":return El.SHA3_256;case 5:case"SHA3_384":return El.SHA3_384;default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum HashAlgorithm")}}function BTe(t){switch(t){case El.HASH_ALGORITHM_UNSPECIFIED:return"HASH_ALGORITHM_UNSPECIFIED";case El.SHA2_256:return"SHA2_256";case El.SHA2_384:return"SHA2_384";case El.SHA2_512:return"SHA2_512";case El.SHA3_256:return"SHA3_256";case El.SHA3_384:return"SHA3_384";default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum HashAlgorithm")}}var rn;(function(t){t[t.PUBLIC_KEY_DETAILS_UNSPECIFIED=0]="PUBLIC_KEY_DETAILS_UNSPECIFIED",t[t.PKCS1_RSA_PKCS1V5=1]="PKCS1_RSA_PKCS1V5",t[t.PKCS1_RSA_PSS=2]="PKCS1_RSA_PSS",t[t.PKIX_RSA_PKCS1V5=3]="PKIX_RSA_PKCS1V5",t[t.PKIX_RSA_PSS=4]="PKIX_RSA_PSS",t[t.PKIX_RSA_PKCS1V15_2048_SHA256=9]="PKIX_RSA_PKCS1V15_2048_SHA256",t[t.PKIX_RSA_PKCS1V15_3072_SHA256=10]="PKIX_RSA_PKCS1V15_3072_SHA256",t[t.PKIX_RSA_PKCS1V15_4096_SHA256=11]="PKIX_RSA_PKCS1V15_4096_SHA256",t[t.PKIX_RSA_PSS_2048_SHA256=16]="PKIX_RSA_PSS_2048_SHA256",t[t.PKIX_RSA_PSS_3072_SHA256=17]="PKIX_RSA_PSS_3072_SHA256",t[t.PKIX_RSA_PSS_4096_SHA256=18]="PKIX_RSA_PSS_4096_SHA256",t[t.PKIX_ECDSA_P256_HMAC_SHA_256=6]="PKIX_ECDSA_P256_HMAC_SHA_256",t[t.PKIX_ECDSA_P256_SHA_256=5]="PKIX_ECDSA_P256_SHA_256",t[t.PKIX_ECDSA_P384_SHA_384=12]="PKIX_ECDSA_P384_SHA_384",t[t.PKIX_ECDSA_P521_SHA_512=13]="PKIX_ECDSA_P521_SHA_512",t[t.PKIX_ED25519=7]="PKIX_ED25519",t[t.PKIX_ED25519_PH=8]="PKIX_ED25519_PH",t[t.LMS_SHA256=14]="LMS_SHA256",t[t.LMOTS_SHA256=15]="LMOTS_SHA256"})(rn||(_r.PublicKeyDetails=rn={}));function vTe(t){switch(t){case 0:case"PUBLIC_KEY_DETAILS_UNSPECIFIED":return rn.PUBLIC_KEY_DETAILS_UNSPECIFIED;case 1:case"PKCS1_RSA_PKCS1V5":return rn.PKCS1_RSA_PKCS1V5;case 2:case"PKCS1_RSA_PSS":return rn.PKCS1_RSA_PSS;case 3:case"PKIX_RSA_PKCS1V5":return rn.PKIX_RSA_PKCS1V5;case 4:case"PKIX_RSA_PSS":return rn.PKIX_RSA_PSS;case 9:case"PKIX_RSA_PKCS1V15_2048_SHA256":return rn.PKIX_RSA_PKCS1V15_2048_SHA256;case 10:case"PKIX_RSA_PKCS1V15_3072_SHA256":return rn.PKIX_RSA_PKCS1V15_3072_SHA256;case 11:case"PKIX_RSA_PKCS1V15_4096_SHA256":return rn.PKIX_RSA_PKCS1V15_4096_SHA256;case 16:case"PKIX_RSA_PSS_2048_SHA256":return rn.PKIX_RSA_PSS_2048_SHA256;case 17:case"PKIX_RSA_PSS_3072_SHA256":return rn.PKIX_RSA_PSS_3072_SHA256;case 18:case"PKIX_RSA_PSS_4096_SHA256":return rn.PKIX_RSA_PSS_4096_SHA256;case 6:case"PKIX_ECDSA_P256_HMAC_SHA_256":return rn.PKIX_ECDSA_P256_HMAC_SHA_256;case 5:case"PKIX_ECDSA_P256_SHA_256":return rn.PKIX_ECDSA_P256_SHA_256;case 12:case"PKIX_ECDSA_P384_SHA_384":return rn.PKIX_ECDSA_P384_SHA_384;case 13:case"PKIX_ECDSA_P521_SHA_512":return rn.PKIX_ECDSA_P521_SHA_512;case 7:case"PKIX_ED25519":return rn.PKIX_ED25519;case 8:case"PKIX_ED25519_PH":return rn.PKIX_ED25519_PH;case 14:case"LMS_SHA256":return rn.LMS_SHA256;case 15:case"LMOTS_SHA256":return rn.LMOTS_SHA256;default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum PublicKeyDetails")}}function STe(t){switch(t){case rn.PUBLIC_KEY_DETAILS_UNSPECIFIED:return"PUBLIC_KEY_DETAILS_UNSPECIFIED";case rn.PKCS1_RSA_PKCS1V5:return"PKCS1_RSA_PKCS1V5";case rn.PKCS1_RSA_PSS:return"PKCS1_RSA_PSS";case rn.PKIX_RSA_PKCS1V5:return"PKIX_RSA_PKCS1V5";case rn.PKIX_RSA_PSS:return"PKIX_RSA_PSS";case rn.PKIX_RSA_PKCS1V15_2048_SHA256:return"PKIX_RSA_PKCS1V15_2048_SHA256";case rn.PKIX_RSA_PKCS1V15_3072_SHA256:return"PKIX_RSA_PKCS1V15_3072_SHA256";case rn.PKIX_RSA_PKCS1V15_4096_SHA256:return"PKIX_RSA_PKCS1V15_4096_SHA256";case rn.PKIX_RSA_PSS_2048_SHA256:return"PKIX_RSA_PSS_2048_SHA256";case rn.PKIX_RSA_PSS_3072_SHA256:return"PKIX_RSA_PSS_3072_SHA256";case rn.PKIX_RSA_PSS_4096_SHA256:return"PKIX_RSA_PSS_4096_SHA256";case rn.PKIX_ECDSA_P256_HMAC_SHA_256:return"PKIX_ECDSA_P256_HMAC_SHA_256";case rn.PKIX_ECDSA_P256_SHA_256:return"PKIX_ECDSA_P256_SHA_256";case rn.PKIX_ECDSA_P384_SHA_384:return"PKIX_ECDSA_P384_SHA_384";case rn.PKIX_ECDSA_P521_SHA_512:return"PKIX_ECDSA_P521_SHA_512";case rn.PKIX_ED25519:return"PKIX_ED25519";case rn.PKIX_ED25519_PH:return"PKIX_ED25519_PH";case rn.LMS_SHA256:return"LMS_SHA256";case rn.LMOTS_SHA256:return"LMOTS_SHA256";default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum PublicKeyDetails")}}var BA;(function(t){t[t.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED=0]="SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED",t[t.EMAIL=1]="EMAIL",t[t.URI=2]="URI",t[t.OTHER_NAME=3]="OTHER_NAME"})(BA||(_r.SubjectAlternativeNameType=BA={}));function DTe(t){switch(t){case 0:case"SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED":return BA.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED;case 1:case"EMAIL":return BA.EMAIL;case 2:case"URI":return BA.URI;case 3:case"OTHER_NAME":return BA.OTHER_NAME;default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum SubjectAlternativeNameType")}}function bTe(t){switch(t){case BA.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED:return"SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED";case BA.EMAIL:return"EMAIL";case BA.URI:return"URI";case BA.OTHER_NAME:return"OTHER_NAME";default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum SubjectAlternativeNameType")}}_r.HashOutput={fromJSON(t){return{algorithm:ms(t.algorithm)?wTe(t.algorithm):0,digest:ms(t.digest)?Buffer.from($m(t.digest)):Buffer.alloc(0)}},toJSON(t){let e={};return t.algorithm!==0&&(e.algorithm=BTe(t.algorithm)),t.digest.length!==0&&(e.digest=ey(t.digest)),e}};_r.MessageSignature={fromJSON(t){return{messageDigest:ms(t.messageDigest)?_r.HashOutput.fromJSON(t.messageDigest):void 0,signature:ms(t.signature)?Buffer.from($m(t.signature)):Buffer.alloc(0)}},toJSON(t){let e={};return t.messageDigest!==void 0&&(e.messageDigest=_r.HashOutput.toJSON(t.messageDigest)),t.signature.length!==0&&(e.signature=ey(t.signature)),e}};_r.LogId={fromJSON(t){return{keyId:ms(t.keyId)?Buffer.from($m(t.keyId)):Buffer.alloc(0)}},toJSON(t){let e={};return t.keyId.length!==0&&(e.keyId=ey(t.keyId)),e}};_r.RFC3161SignedTimestamp={fromJSON(t){return{signedTimestamp:ms(t.signedTimestamp)?Buffer.from($m(t.signedTimestamp)):Buffer.alloc(0)}},toJSON(t){let e={};return t.signedTimestamp.length!==0&&(e.signedTimestamp=ey(t.signedTimestamp)),e}};_r.PublicKey={fromJSON(t){return{rawBytes:ms(t.rawBytes)?Buffer.from($m(t.rawBytes)):void 0,keyDetails:ms(t.keyDetails)?vTe(t.keyDetails):0,validFor:ms(t.validFor)?_r.TimeRange.fromJSON(t.validFor):void 0}},toJSON(t){let e={};return t.rawBytes!==void 0&&(e.rawBytes=ey(t.rawBytes)),t.keyDetails!==0&&(e.keyDetails=STe(t.keyDetails)),t.validFor!==void 0&&(e.validFor=_r.TimeRange.toJSON(t.validFor)),e}};_r.PublicKeyIdentifier={fromJSON(t){return{hint:ms(t.hint)?globalThis.String(t.hint):""}},toJSON(t){let e={};return t.hint!==""&&(e.hint=t.hint),e}};_r.ObjectIdentifier={fromJSON(t){return{id:globalThis.Array.isArray(t?.id)?t.id.map(e=>globalThis.Number(e)):[]}},toJSON(t){let e={};return t.id?.length&&(e.id=t.id.map(r=>Math.round(r))),e}};_r.ObjectIdentifierValuePair={fromJSON(t){return{oid:ms(t.oid)?_r.ObjectIdentifier.fromJSON(t.oid):void 0,value:ms(t.value)?Buffer.from($m(t.value)):Buffer.alloc(0)}},toJSON(t){let e={};return t.oid!==void 0&&(e.oid=_r.ObjectIdentifier.toJSON(t.oid)),t.value.length!==0&&(e.value=ey(t.value)),e}};_r.DistinguishedName={fromJSON(t){return{organization:ms(t.organization)?globalThis.String(t.organization):"",commonName:ms(t.commonName)?globalThis.String(t.commonName):""}},toJSON(t){let e={};return t.organization!==""&&(e.organization=t.organization),t.commonName!==""&&(e.commonName=t.commonName),e}};_r.X509Certificate={fromJSON(t){return{rawBytes:ms(t.rawBytes)?Buffer.from($m(t.rawBytes)):Buffer.alloc(0)}},toJSON(t){let e={};return t.rawBytes.length!==0&&(e.rawBytes=ey(t.rawBytes)),e}};_r.SubjectAlternativeName={fromJSON(t){return{type:ms(t.type)?DTe(t.type):0,identity:ms(t.regexp)?{$case:"regexp",regexp:globalThis.String(t.regexp)}:ms(t.value)?{$case:"value",value:globalThis.String(t.value)}:void 0}},toJSON(t){let e={};return t.type!==0&&(e.type=bTe(t.type)),t.identity?.$case==="regexp"?e.regexp=t.identity.regexp:t.identity?.$case==="value"&&(e.value=t.identity.value),e}};_r.X509CertificateChain={fromJSON(t){return{certificates:globalThis.Array.isArray(t?.certificates)?t.certificates.map(e=>_r.X509Certificate.fromJSON(e)):[]}},toJSON(t){let e={};return t.certificates?.length&&(e.certificates=t.certificates.map(r=>_r.X509Certificate.toJSON(r))),e}};_r.TimeRange={fromJSON(t){return{start:ms(t.start)?CTe(t.start):void 0,end:ms(t.end)?CTe(t.end):void 0}},toJSON(t){let e={};return t.start!==void 0&&(e.start=t.start.toISOString()),t.end!==void 0&&(e.end=t.end.toISOString()),e}};function $m(t){return Uint8Array.from(globalThis.Buffer.from(t,"base64"))}function ey(t){return globalThis.Buffer.from(t).toString("base64")}function $Ot(t){let e=(globalThis.Number(t.seconds)||0)*1e3;return e+=(t.nanos||0)/1e6,new globalThis.Date(e)}function CTe(t){return t instanceof globalThis.Date?t:typeof t=="string"?new globalThis.Date(t):$Ot(XOt.Timestamp.fromJSON(t))}function ms(t){return t!=null}});var S7=L(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.TransparencyLogEntry=ys.InclusionPromise=ys.InclusionProof=ys.Checkpoint=ys.KindVersion=void 0;var PTe=Vw();ys.KindVersion={fromJSON(t){return{kind:Fa(t.kind)?globalThis.String(t.kind):"",version:Fa(t.version)?globalThis.String(t.version):""}},toJSON(t){let e={};return t.kind!==""&&(e.kind=t.kind),t.version!==""&&(e.version=t.version),e}};ys.Checkpoint={fromJSON(t){return{envelope:Fa(t.envelope)?globalThis.String(t.envelope):""}},toJSON(t){let e={};return t.envelope!==""&&(e.envelope=t.envelope),e}};ys.InclusionProof={fromJSON(t){return{logIndex:Fa(t.logIndex)?globalThis.String(t.logIndex):"0",rootHash:Fa(t.rootHash)?Buffer.from($N(t.rootHash)):Buffer.alloc(0),treeSize:Fa(t.treeSize)?globalThis.String(t.treeSize):"0",hashes:globalThis.Array.isArray(t?.hashes)?t.hashes.map(e=>Buffer.from($N(e))):[],checkpoint:Fa(t.checkpoint)?ys.Checkpoint.fromJSON(t.checkpoint):void 0}},toJSON(t){let e={};return t.logIndex!=="0"&&(e.logIndex=t.logIndex),t.rootHash.length!==0&&(e.rootHash=eO(t.rootHash)),t.treeSize!=="0"&&(e.treeSize=t.treeSize),t.hashes?.length&&(e.hashes=t.hashes.map(r=>eO(r))),t.checkpoint!==void 0&&(e.checkpoint=ys.Checkpoint.toJSON(t.checkpoint)),e}};ys.InclusionPromise={fromJSON(t){return{signedEntryTimestamp:Fa(t.signedEntryTimestamp)?Buffer.from($N(t.signedEntryTimestamp)):Buffer.alloc(0)}},toJSON(t){let e={};return t.signedEntryTimestamp.length!==0&&(e.signedEntryTimestamp=eO(t.signedEntryTimestamp)),e}};ys.TransparencyLogEntry={fromJSON(t){return{logIndex:Fa(t.logIndex)?globalThis.String(t.logIndex):"0",logId:Fa(t.logId)?PTe.LogId.fromJSON(t.logId):void 0,kindVersion:Fa(t.kindVersion)?ys.KindVersion.fromJSON(t.kindVersion):void 0,integratedTime:Fa(t.integratedTime)?globalThis.String(t.integratedTime):"0",inclusionPromise:Fa(t.inclusionPromise)?ys.InclusionPromise.fromJSON(t.inclusionPromise):void 0,inclusionProof:Fa(t.inclusionProof)?ys.InclusionProof.fromJSON(t.inclusionProof):void 0,canonicalizedBody:Fa(t.canonicalizedBody)?Buffer.from($N(t.canonicalizedBody)):Buffer.alloc(0)}},toJSON(t){let e={};return t.logIndex!=="0"&&(e.logIndex=t.logIndex),t.logId!==void 0&&(e.logId=PTe.LogId.toJSON(t.logId)),t.kindVersion!==void 0&&(e.kindVersion=ys.KindVersion.toJSON(t.kindVersion)),t.integratedTime!=="0"&&(e.integratedTime=t.integratedTime),t.inclusionPromise!==void 0&&(e.inclusionPromise=ys.InclusionPromise.toJSON(t.inclusionPromise)),t.inclusionProof!==void 0&&(e.inclusionProof=ys.InclusionProof.toJSON(t.inclusionProof)),t.canonicalizedBody.length!==0&&(e.canonicalizedBody=eO(t.canonicalizedBody)),e}};function $N(t){return Uint8Array.from(globalThis.Buffer.from(t,"base64"))}function eO(t){return globalThis.Buffer.from(t).toString("base64")}function Fa(t){return t!=null}});var D7=L($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.Bundle=$c.VerificationMaterial=$c.TimestampVerificationData=void 0;var xTe=v7(),vA=Vw(),kTe=S7();$c.TimestampVerificationData={fromJSON(t){return{rfc3161Timestamps:globalThis.Array.isArray(t?.rfc3161Timestamps)?t.rfc3161Timestamps.map(e=>vA.RFC3161SignedTimestamp.fromJSON(e)):[]}},toJSON(t){let e={};return t.rfc3161Timestamps?.length&&(e.rfc3161Timestamps=t.rfc3161Timestamps.map(r=>vA.RFC3161SignedTimestamp.toJSON(r))),e}};$c.VerificationMaterial={fromJSON(t){return{content:Eg(t.publicKey)?{$case:"publicKey",publicKey:vA.PublicKeyIdentifier.fromJSON(t.publicKey)}:Eg(t.x509CertificateChain)?{$case:"x509CertificateChain",x509CertificateChain:vA.X509CertificateChain.fromJSON(t.x509CertificateChain)}:Eg(t.certificate)?{$case:"certificate",certificate:vA.X509Certificate.fromJSON(t.certificate)}:void 0,tlogEntries:globalThis.Array.isArray(t?.tlogEntries)?t.tlogEntries.map(e=>kTe.TransparencyLogEntry.fromJSON(e)):[],timestampVerificationData:Eg(t.timestampVerificationData)?$c.TimestampVerificationData.fromJSON(t.timestampVerificationData):void 0}},toJSON(t){let e={};return t.content?.$case==="publicKey"?e.publicKey=vA.PublicKeyIdentifier.toJSON(t.content.publicKey):t.content?.$case==="x509CertificateChain"?e.x509CertificateChain=vA.X509CertificateChain.toJSON(t.content.x509CertificateChain):t.content?.$case==="certificate"&&(e.certificate=vA.X509Certificate.toJSON(t.content.certificate)),t.tlogEntries?.length&&(e.tlogEntries=t.tlogEntries.map(r=>kTe.TransparencyLogEntry.toJSON(r))),t.timestampVerificationData!==void 0&&(e.timestampVerificationData=$c.TimestampVerificationData.toJSON(t.timestampVerificationData)),e}};$c.Bundle={fromJSON(t){return{mediaType:Eg(t.mediaType)?globalThis.String(t.mediaType):"",verificationMaterial:Eg(t.verificationMaterial)?$c.VerificationMaterial.fromJSON(t.verificationMaterial):void 0,content:Eg(t.messageSignature)?{$case:"messageSignature",messageSignature:vA.MessageSignature.fromJSON(t.messageSignature)}:Eg(t.dsseEnvelope)?{$case:"dsseEnvelope",dsseEnvelope:xTe.Envelope.fromJSON(t.dsseEnvelope)}:void 0}},toJSON(t){let e={};return t.mediaType!==""&&(e.mediaType=t.mediaType),t.verificationMaterial!==void 0&&(e.verificationMaterial=$c.VerificationMaterial.toJSON(t.verificationMaterial)),t.content?.$case==="messageSignature"?e.messageSignature=vA.MessageSignature.toJSON(t.content.messageSignature):t.content?.$case==="dsseEnvelope"&&(e.dsseEnvelope=xTe.Envelope.toJSON(t.content.dsseEnvelope)),e}};function Eg(t){return t!=null}});var b7=L(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.ClientTrustConfig=Ti.SigningConfig=Ti.TrustedRoot=Ti.CertificateAuthority=Ti.TransparencyLogInstance=void 0;var Il=Vw();Ti.TransparencyLogInstance={fromJSON(t){return{baseUrl:sa(t.baseUrl)?globalThis.String(t.baseUrl):"",hashAlgorithm:sa(t.hashAlgorithm)?(0,Il.hashAlgorithmFromJSON)(t.hashAlgorithm):0,publicKey:sa(t.publicKey)?Il.PublicKey.fromJSON(t.publicKey):void 0,logId:sa(t.logId)?Il.LogId.fromJSON(t.logId):void 0,checkpointKeyId:sa(t.checkpointKeyId)?Il.LogId.fromJSON(t.checkpointKeyId):void 0}},toJSON(t){let e={};return t.baseUrl!==""&&(e.baseUrl=t.baseUrl),t.hashAlgorithm!==0&&(e.hashAlgorithm=(0,Il.hashAlgorithmToJSON)(t.hashAlgorithm)),t.publicKey!==void 0&&(e.publicKey=Il.PublicKey.toJSON(t.publicKey)),t.logId!==void 0&&(e.logId=Il.LogId.toJSON(t.logId)),t.checkpointKeyId!==void 0&&(e.checkpointKeyId=Il.LogId.toJSON(t.checkpointKeyId)),e}};Ti.CertificateAuthority={fromJSON(t){return{subject:sa(t.subject)?Il.DistinguishedName.fromJSON(t.subject):void 0,uri:sa(t.uri)?globalThis.String(t.uri):"",certChain:sa(t.certChain)?Il.X509CertificateChain.fromJSON(t.certChain):void 0,validFor:sa(t.validFor)?Il.TimeRange.fromJSON(t.validFor):void 0}},toJSON(t){let e={};return t.subject!==void 0&&(e.subject=Il.DistinguishedName.toJSON(t.subject)),t.uri!==""&&(e.uri=t.uri),t.certChain!==void 0&&(e.certChain=Il.X509CertificateChain.toJSON(t.certChain)),t.validFor!==void 0&&(e.validFor=Il.TimeRange.toJSON(t.validFor)),e}};Ti.TrustedRoot={fromJSON(t){return{mediaType:sa(t.mediaType)?globalThis.String(t.mediaType):"",tlogs:globalThis.Array.isArray(t?.tlogs)?t.tlogs.map(e=>Ti.TransparencyLogInstance.fromJSON(e)):[],certificateAuthorities:globalThis.Array.isArray(t?.certificateAuthorities)?t.certificateAuthorities.map(e=>Ti.CertificateAuthority.fromJSON(e)):[],ctlogs:globalThis.Array.isArray(t?.ctlogs)?t.ctlogs.map(e=>Ti.TransparencyLogInstance.fromJSON(e)):[],timestampAuthorities:globalThis.Array.isArray(t?.timestampAuthorities)?t.timestampAuthorities.map(e=>Ti.CertificateAuthority.fromJSON(e)):[]}},toJSON(t){let e={};return t.mediaType!==""&&(e.mediaType=t.mediaType),t.tlogs?.length&&(e.tlogs=t.tlogs.map(r=>Ti.TransparencyLogInstance.toJSON(r))),t.certificateAuthorities?.length&&(e.certificateAuthorities=t.certificateAuthorities.map(r=>Ti.CertificateAuthority.toJSON(r))),t.ctlogs?.length&&(e.ctlogs=t.ctlogs.map(r=>Ti.TransparencyLogInstance.toJSON(r))),t.timestampAuthorities?.length&&(e.timestampAuthorities=t.timestampAuthorities.map(r=>Ti.CertificateAuthority.toJSON(r))),e}};Ti.SigningConfig={fromJSON(t){return{mediaType:sa(t.mediaType)?globalThis.String(t.mediaType):"",caUrl:sa(t.caUrl)?globalThis.String(t.caUrl):"",oidcUrl:sa(t.oidcUrl)?globalThis.String(t.oidcUrl):"",tlogUrls:globalThis.Array.isArray(t?.tlogUrls)?t.tlogUrls.map(e=>globalThis.String(e)):[],tsaUrls:globalThis.Array.isArray(t?.tsaUrls)?t.tsaUrls.map(e=>globalThis.String(e)):[]}},toJSON(t){let e={};return t.mediaType!==""&&(e.mediaType=t.mediaType),t.caUrl!==""&&(e.caUrl=t.caUrl),t.oidcUrl!==""&&(e.oidcUrl=t.oidcUrl),t.tlogUrls?.length&&(e.tlogUrls=t.tlogUrls),t.tsaUrls?.length&&(e.tsaUrls=t.tsaUrls),e}};Ti.ClientTrustConfig={fromJSON(t){return{mediaType:sa(t.mediaType)?globalThis.String(t.mediaType):"",trustedRoot:sa(t.trustedRoot)?Ti.TrustedRoot.fromJSON(t.trustedRoot):void 0,signingConfig:sa(t.signingConfig)?Ti.SigningConfig.fromJSON(t.signingConfig):void 0}},toJSON(t){let e={};return t.mediaType!==""&&(e.mediaType=t.mediaType),t.trustedRoot!==void 0&&(e.trustedRoot=Ti.TrustedRoot.toJSON(t.trustedRoot)),t.signingConfig!==void 0&&(e.signingConfig=Ti.SigningConfig.toJSON(t.signingConfig)),e}};function sa(t){return t!=null}});var RTe=L(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.Input=Vr.Artifact=Vr.ArtifactVerificationOptions_ObserverTimestampOptions=Vr.ArtifactVerificationOptions_TlogIntegratedTimestampOptions=Vr.ArtifactVerificationOptions_TimestampAuthorityOptions=Vr.ArtifactVerificationOptions_CtlogOptions=Vr.ArtifactVerificationOptions_TlogOptions=Vr.ArtifactVerificationOptions=Vr.PublicKeyIdentities=Vr.CertificateIdentities=Vr.CertificateIdentity=void 0;var QTe=D7(),Ig=Vw(),TTe=b7();Vr.CertificateIdentity={fromJSON(t){return{issuer:hi(t.issuer)?globalThis.String(t.issuer):"",san:hi(t.san)?Ig.SubjectAlternativeName.fromJSON(t.san):void 0,oids:globalThis.Array.isArray(t?.oids)?t.oids.map(e=>Ig.ObjectIdentifierValuePair.fromJSON(e)):[]}},toJSON(t){let e={};return t.issuer!==""&&(e.issuer=t.issuer),t.san!==void 0&&(e.san=Ig.SubjectAlternativeName.toJSON(t.san)),t.oids?.length&&(e.oids=t.oids.map(r=>Ig.ObjectIdentifierValuePair.toJSON(r))),e}};Vr.CertificateIdentities={fromJSON(t){return{identities:globalThis.Array.isArray(t?.identities)?t.identities.map(e=>Vr.CertificateIdentity.fromJSON(e)):[]}},toJSON(t){let e={};return t.identities?.length&&(e.identities=t.identities.map(r=>Vr.CertificateIdentity.toJSON(r))),e}};Vr.PublicKeyIdentities={fromJSON(t){return{publicKeys:globalThis.Array.isArray(t?.publicKeys)?t.publicKeys.map(e=>Ig.PublicKey.fromJSON(e)):[]}},toJSON(t){let e={};return t.publicKeys?.length&&(e.publicKeys=t.publicKeys.map(r=>Ig.PublicKey.toJSON(r))),e}};Vr.ArtifactVerificationOptions={fromJSON(t){return{signers:hi(t.certificateIdentities)?{$case:"certificateIdentities",certificateIdentities:Vr.CertificateIdentities.fromJSON(t.certificateIdentities)}:hi(t.publicKeys)?{$case:"publicKeys",publicKeys:Vr.PublicKeyIdentities.fromJSON(t.publicKeys)}:void 0,tlogOptions:hi(t.tlogOptions)?Vr.ArtifactVerificationOptions_TlogOptions.fromJSON(t.tlogOptions):void 0,ctlogOptions:hi(t.ctlogOptions)?Vr.ArtifactVerificationOptions_CtlogOptions.fromJSON(t.ctlogOptions):void 0,tsaOptions:hi(t.tsaOptions)?Vr.ArtifactVerificationOptions_TimestampAuthorityOptions.fromJSON(t.tsaOptions):void 0,integratedTsOptions:hi(t.integratedTsOptions)?Vr.ArtifactVerificationOptions_TlogIntegratedTimestampOptions.fromJSON(t.integratedTsOptions):void 0,observerOptions:hi(t.observerOptions)?Vr.ArtifactVerificationOptions_ObserverTimestampOptions.fromJSON(t.observerOptions):void 0}},toJSON(t){let e={};return t.signers?.$case==="certificateIdentities"?e.certificateIdentities=Vr.CertificateIdentities.toJSON(t.signers.certificateIdentities):t.signers?.$case==="publicKeys"&&(e.publicKeys=Vr.PublicKeyIdentities.toJSON(t.signers.publicKeys)),t.tlogOptions!==void 0&&(e.tlogOptions=Vr.ArtifactVerificationOptions_TlogOptions.toJSON(t.tlogOptions)),t.ctlogOptions!==void 0&&(e.ctlogOptions=Vr.ArtifactVerificationOptions_CtlogOptions.toJSON(t.ctlogOptions)),t.tsaOptions!==void 0&&(e.tsaOptions=Vr.ArtifactVerificationOptions_TimestampAuthorityOptions.toJSON(t.tsaOptions)),t.integratedTsOptions!==void 0&&(e.integratedTsOptions=Vr.ArtifactVerificationOptions_TlogIntegratedTimestampOptions.toJSON(t.integratedTsOptions)),t.observerOptions!==void 0&&(e.observerOptions=Vr.ArtifactVerificationOptions_ObserverTimestampOptions.toJSON(t.observerOptions)),e}};Vr.ArtifactVerificationOptions_TlogOptions={fromJSON(t){return{threshold:hi(t.threshold)?globalThis.Number(t.threshold):0,performOnlineVerification:hi(t.performOnlineVerification)?globalThis.Boolean(t.performOnlineVerification):!1,disable:hi(t.disable)?globalThis.Boolean(t.disable):!1}},toJSON(t){let e={};return t.threshold!==0&&(e.threshold=Math.round(t.threshold)),t.performOnlineVerification!==!1&&(e.performOnlineVerification=t.performOnlineVerification),t.disable!==!1&&(e.disable=t.disable),e}};Vr.ArtifactVerificationOptions_CtlogOptions={fromJSON(t){return{threshold:hi(t.threshold)?globalThis.Number(t.threshold):0,disable:hi(t.disable)?globalThis.Boolean(t.disable):!1}},toJSON(t){let e={};return t.threshold!==0&&(e.threshold=Math.round(t.threshold)),t.disable!==!1&&(e.disable=t.disable),e}};Vr.ArtifactVerificationOptions_TimestampAuthorityOptions={fromJSON(t){return{threshold:hi(t.threshold)?globalThis.Number(t.threshold):0,disable:hi(t.disable)?globalThis.Boolean(t.disable):!1}},toJSON(t){let e={};return t.threshold!==0&&(e.threshold=Math.round(t.threshold)),t.disable!==!1&&(e.disable=t.disable),e}};Vr.ArtifactVerificationOptions_TlogIntegratedTimestampOptions={fromJSON(t){return{threshold:hi(t.threshold)?globalThis.Number(t.threshold):0,disable:hi(t.disable)?globalThis.Boolean(t.disable):!1}},toJSON(t){let e={};return t.threshold!==0&&(e.threshold=Math.round(t.threshold)),t.disable!==!1&&(e.disable=t.disable),e}};Vr.ArtifactVerificationOptions_ObserverTimestampOptions={fromJSON(t){return{threshold:hi(t.threshold)?globalThis.Number(t.threshold):0,disable:hi(t.disable)?globalThis.Boolean(t.disable):!1}},toJSON(t){let e={};return t.threshold!==0&&(e.threshold=Math.round(t.threshold)),t.disable!==!1&&(e.disable=t.disable),e}};Vr.Artifact={fromJSON(t){return{data:hi(t.artifactUri)?{$case:"artifactUri",artifactUri:globalThis.String(t.artifactUri)}:hi(t.artifact)?{$case:"artifact",artifact:Buffer.from(eLt(t.artifact))}:hi(t.artifactDigest)?{$case:"artifactDigest",artifactDigest:Ig.HashOutput.fromJSON(t.artifactDigest)}:void 0}},toJSON(t){let e={};return t.data?.$case==="artifactUri"?e.artifactUri=t.data.artifactUri:t.data?.$case==="artifact"?e.artifact=tLt(t.data.artifact):t.data?.$case==="artifactDigest"&&(e.artifactDigest=Ig.HashOutput.toJSON(t.data.artifactDigest)),e}};Vr.Input={fromJSON(t){return{artifactTrustRoot:hi(t.artifactTrustRoot)?TTe.TrustedRoot.fromJSON(t.artifactTrustRoot):void 0,artifactVerificationOptions:hi(t.artifactVerificationOptions)?Vr.ArtifactVerificationOptions.fromJSON(t.artifactVerificationOptions):void 0,bundle:hi(t.bundle)?QTe.Bundle.fromJSON(t.bundle):void 0,artifact:hi(t.artifact)?Vr.Artifact.fromJSON(t.artifact):void 0}},toJSON(t){let e={};return t.artifactTrustRoot!==void 0&&(e.artifactTrustRoot=TTe.TrustedRoot.toJSON(t.artifactTrustRoot)),t.artifactVerificationOptions!==void 0&&(e.artifactVerificationOptions=Vr.ArtifactVerificationOptions.toJSON(t.artifactVerificationOptions)),t.bundle!==void 0&&(e.bundle=QTe.Bundle.toJSON(t.bundle)),t.artifact!==void 0&&(e.artifact=Vr.Artifact.toJSON(t.artifact)),e}};function eLt(t){return Uint8Array.from(globalThis.Buffer.from(t,"base64"))}function tLt(t){return globalThis.Buffer.from(t).toString("base64")}function hi(t){return t!=null}});var Rb=L(eu=>{"use strict";var rLt=eu&&eu.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Kw=eu&&eu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rLt(e,t,r)};Object.defineProperty(eu,"__esModule",{value:!0});Kw(v7(),eu);Kw(D7(),eu);Kw(Vw(),eu);Kw(S7(),eu);Kw(b7(),eu);Kw(RTe(),eu)});var tO=L(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.BUNDLE_V03_MEDIA_TYPE=Cl.BUNDLE_V03_LEGACY_MEDIA_TYPE=Cl.BUNDLE_V02_MEDIA_TYPE=Cl.BUNDLE_V01_MEDIA_TYPE=void 0;Cl.isBundleWithCertificateChain=nLt;Cl.isBundleWithPublicKey=iLt;Cl.isBundleWithMessageSignature=sLt;Cl.isBundleWithDsseEnvelope=oLt;Cl.BUNDLE_V01_MEDIA_TYPE="application/vnd.dev.sigstore.bundle+json;version=0.1";Cl.BUNDLE_V02_MEDIA_TYPE="application/vnd.dev.sigstore.bundle+json;version=0.2";Cl.BUNDLE_V03_LEGACY_MEDIA_TYPE="application/vnd.dev.sigstore.bundle+json;version=0.3";Cl.BUNDLE_V03_MEDIA_TYPE="application/vnd.dev.sigstore.bundle.v0.3+json";function nLt(t){return t.verificationMaterial.content.$case==="x509CertificateChain"}function iLt(t){return t.verificationMaterial.content.$case==="publicKey"}function sLt(t){return t.content.$case==="messageSignature"}function oLt(t){return t.content.$case==="dsseEnvelope"}});var NTe=L(nO=>{"use strict";Object.defineProperty(nO,"__esModule",{value:!0});nO.toMessageSignatureBundle=lLt;nO.toDSSEBundle=cLt;var aLt=Rb(),rO=tO();function lLt(t){return{mediaType:t.certificateChain?rO.BUNDLE_V02_MEDIA_TYPE:rO.BUNDLE_V03_MEDIA_TYPE,content:{$case:"messageSignature",messageSignature:{messageDigest:{algorithm:aLt.HashAlgorithm.SHA2_256,digest:t.digest},signature:t.signature}},verificationMaterial:FTe(t)}}function cLt(t){return{mediaType:t.certificateChain?rO.BUNDLE_V02_MEDIA_TYPE:rO.BUNDLE_V03_MEDIA_TYPE,content:{$case:"dsseEnvelope",dsseEnvelope:uLt(t)},verificationMaterial:FTe(t)}}function uLt(t){return{payloadType:t.artifactType,payload:t.artifact,signatures:[fLt(t)]}}function fLt(t){return{keyid:t.keyHint||"",sig:t.signature}}function FTe(t){return{content:ALt(t),tlogEntries:[],timestampVerificationData:{rfc3161Timestamps:[]}}}function ALt(t){return t.certificate?t.certificateChain?{$case:"x509CertificateChain",x509CertificateChain:{certificates:[{rawBytes:t.certificate}]}}:{$case:"certificate",certificate:{rawBytes:t.certificate}}:{$case:"publicKey",publicKey:{hint:t.keyHint||""}}}});var x7=L(iO=>{"use strict";Object.defineProperty(iO,"__esModule",{value:!0});iO.ValidationError=void 0;var P7=class extends Error{constructor(e,r){super(e),this.fields=r}};iO.ValidationError=P7});var k7=L(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.assertBundle=pLt;ty.assertBundleV01=OTe;ty.isBundleV01=hLt;ty.assertBundleV02=gLt;ty.assertBundleLatest=dLt;var sO=x7();function pLt(t){let e=oO(t);if(e.length>0)throw new sO.ValidationError("invalid bundle",e)}function OTe(t){let e=[];if(e.push(...oO(t)),e.push(...mLt(t)),e.length>0)throw new sO.ValidationError("invalid v0.1 bundle",e)}function hLt(t){try{return OTe(t),!0}catch{return!1}}function gLt(t){let e=[];if(e.push(...oO(t)),e.push(...LTe(t)),e.length>0)throw new sO.ValidationError("invalid v0.2 bundle",e)}function dLt(t){let e=[];if(e.push(...oO(t)),e.push(...LTe(t)),e.push(...yLt(t)),e.length>0)throw new sO.ValidationError("invalid bundle",e)}function oO(t){let e=[];if((t.mediaType===void 0||!t.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\+json;version=\d\.\d/)&&!t.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\.v\d\.\d\+json/))&&e.push("mediaType"),t.content===void 0)e.push("content");else switch(t.content.$case){case"messageSignature":t.content.messageSignature.messageDigest===void 0?e.push("content.messageSignature.messageDigest"):t.content.messageSignature.messageDigest.digest.length===0&&e.push("content.messageSignature.messageDigest.digest"),t.content.messageSignature.signature.length===0&&e.push("content.messageSignature.signature");break;case"dsseEnvelope":t.content.dsseEnvelope.payload.length===0&&e.push("content.dsseEnvelope.payload"),t.content.dsseEnvelope.signatures.length!==1?e.push("content.dsseEnvelope.signatures"):t.content.dsseEnvelope.signatures[0].sig.length===0&&e.push("content.dsseEnvelope.signatures[0].sig");break}if(t.verificationMaterial===void 0)e.push("verificationMaterial");else{if(t.verificationMaterial.content===void 0)e.push("verificationMaterial.content");else switch(t.verificationMaterial.content.$case){case"x509CertificateChain":t.verificationMaterial.content.x509CertificateChain.certificates.length===0&&e.push("verificationMaterial.content.x509CertificateChain.certificates"),t.verificationMaterial.content.x509CertificateChain.certificates.forEach((r,s)=>{r.rawBytes.length===0&&e.push(`verificationMaterial.content.x509CertificateChain.certificates[${s}].rawBytes`)});break;case"certificate":t.verificationMaterial.content.certificate.rawBytes.length===0&&e.push("verificationMaterial.content.certificate.rawBytes");break}t.verificationMaterial.tlogEntries===void 0?e.push("verificationMaterial.tlogEntries"):t.verificationMaterial.tlogEntries.length>0&&t.verificationMaterial.tlogEntries.forEach((r,s)=>{r.logId===void 0&&e.push(`verificationMaterial.tlogEntries[${s}].logId`),r.kindVersion===void 0&&e.push(`verificationMaterial.tlogEntries[${s}].kindVersion`)})}return e}function mLt(t){let e=[];return t.verificationMaterial&&t.verificationMaterial.tlogEntries?.length>0&&t.verificationMaterial.tlogEntries.forEach((r,s)=>{r.inclusionPromise===void 0&&e.push(`verificationMaterial.tlogEntries[${s}].inclusionPromise`)}),e}function LTe(t){let e=[];return t.verificationMaterial&&t.verificationMaterial.tlogEntries?.length>0&&t.verificationMaterial.tlogEntries.forEach((r,s)=>{r.inclusionProof===void 0?e.push(`verificationMaterial.tlogEntries[${s}].inclusionProof`):r.inclusionProof.checkpoint===void 0&&e.push(`verificationMaterial.tlogEntries[${s}].inclusionProof.checkpoint`)}),e}function yLt(t){let e=[];return t.verificationMaterial?.content?.$case==="x509CertificateChain"&&e.push("verificationMaterial.content.$case"),e}});var _Te=L(SA=>{"use strict";Object.defineProperty(SA,"__esModule",{value:!0});SA.envelopeToJSON=SA.envelopeFromJSON=SA.bundleToJSON=SA.bundleFromJSON=void 0;var aO=Rb(),MTe=tO(),Q7=k7(),ELt=t=>{let e=aO.Bundle.fromJSON(t);switch(e.mediaType){case MTe.BUNDLE_V01_MEDIA_TYPE:(0,Q7.assertBundleV01)(e);break;case MTe.BUNDLE_V02_MEDIA_TYPE:(0,Q7.assertBundleV02)(e);break;default:(0,Q7.assertBundleLatest)(e);break}return e};SA.bundleFromJSON=ELt;var ILt=t=>aO.Bundle.toJSON(t);SA.bundleToJSON=ILt;var CLt=t=>aO.Envelope.fromJSON(t);SA.envelopeFromJSON=CLt;var wLt=t=>aO.Envelope.toJSON(t);SA.envelopeToJSON=wLt});var Nb=L(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.isBundleV01=Zr.assertBundleV02=Zr.assertBundleV01=Zr.assertBundleLatest=Zr.assertBundle=Zr.envelopeToJSON=Zr.envelopeFromJSON=Zr.bundleToJSON=Zr.bundleFromJSON=Zr.ValidationError=Zr.isBundleWithPublicKey=Zr.isBundleWithMessageSignature=Zr.isBundleWithDsseEnvelope=Zr.isBundleWithCertificateChain=Zr.BUNDLE_V03_MEDIA_TYPE=Zr.BUNDLE_V03_LEGACY_MEDIA_TYPE=Zr.BUNDLE_V02_MEDIA_TYPE=Zr.BUNDLE_V01_MEDIA_TYPE=Zr.toMessageSignatureBundle=Zr.toDSSEBundle=void 0;var UTe=NTe();Object.defineProperty(Zr,"toDSSEBundle",{enumerable:!0,get:function(){return UTe.toDSSEBundle}});Object.defineProperty(Zr,"toMessageSignatureBundle",{enumerable:!0,get:function(){return UTe.toMessageSignatureBundle}});var Cg=tO();Object.defineProperty(Zr,"BUNDLE_V01_MEDIA_TYPE",{enumerable:!0,get:function(){return Cg.BUNDLE_V01_MEDIA_TYPE}});Object.defineProperty(Zr,"BUNDLE_V02_MEDIA_TYPE",{enumerable:!0,get:function(){return Cg.BUNDLE_V02_MEDIA_TYPE}});Object.defineProperty(Zr,"BUNDLE_V03_LEGACY_MEDIA_TYPE",{enumerable:!0,get:function(){return Cg.BUNDLE_V03_LEGACY_MEDIA_TYPE}});Object.defineProperty(Zr,"BUNDLE_V03_MEDIA_TYPE",{enumerable:!0,get:function(){return Cg.BUNDLE_V03_MEDIA_TYPE}});Object.defineProperty(Zr,"isBundleWithCertificateChain",{enumerable:!0,get:function(){return Cg.isBundleWithCertificateChain}});Object.defineProperty(Zr,"isBundleWithDsseEnvelope",{enumerable:!0,get:function(){return Cg.isBundleWithDsseEnvelope}});Object.defineProperty(Zr,"isBundleWithMessageSignature",{enumerable:!0,get:function(){return Cg.isBundleWithMessageSignature}});Object.defineProperty(Zr,"isBundleWithPublicKey",{enumerable:!0,get:function(){return Cg.isBundleWithPublicKey}});var BLt=x7();Object.defineProperty(Zr,"ValidationError",{enumerable:!0,get:function(){return BLt.ValidationError}});var lO=_Te();Object.defineProperty(Zr,"bundleFromJSON",{enumerable:!0,get:function(){return lO.bundleFromJSON}});Object.defineProperty(Zr,"bundleToJSON",{enumerable:!0,get:function(){return lO.bundleToJSON}});Object.defineProperty(Zr,"envelopeFromJSON",{enumerable:!0,get:function(){return lO.envelopeFromJSON}});Object.defineProperty(Zr,"envelopeToJSON",{enumerable:!0,get:function(){return lO.envelopeToJSON}});var Fb=k7();Object.defineProperty(Zr,"assertBundle",{enumerable:!0,get:function(){return Fb.assertBundle}});Object.defineProperty(Zr,"assertBundleLatest",{enumerable:!0,get:function(){return Fb.assertBundleLatest}});Object.defineProperty(Zr,"assertBundleV01",{enumerable:!0,get:function(){return Fb.assertBundleV01}});Object.defineProperty(Zr,"assertBundleV02",{enumerable:!0,get:function(){return Fb.assertBundleV02}});Object.defineProperty(Zr,"isBundleV01",{enumerable:!0,get:function(){return Fb.isBundleV01}})});var Ob=L(uO=>{"use strict";Object.defineProperty(uO,"__esModule",{value:!0});uO.ByteStream=void 0;var T7=class extends Error{},cO=class t{constructor(e){this.start=0,e?(this.buf=e,this.view=Buffer.from(e)):(this.buf=new ArrayBuffer(0),this.view=Buffer.from(this.buf))}get buffer(){return this.view.subarray(0,this.start)}get length(){return this.view.byteLength}get position(){return this.start}seek(e){this.start=e}slice(e,r){let s=e+r;if(s>this.length)throw new T7("request past end of buffer");return this.view.subarray(e,s)}appendChar(e){this.ensureCapacity(1),this.view[this.start]=e,this.start+=1}appendUint16(e){this.ensureCapacity(2);let r=new Uint16Array([e]),s=new Uint8Array(r.buffer);this.view[this.start]=s[1],this.view[this.start+1]=s[0],this.start+=2}appendUint24(e){this.ensureCapacity(3);let r=new Uint32Array([e]),s=new Uint8Array(r.buffer);this.view[this.start]=s[2],this.view[this.start+1]=s[1],this.view[this.start+2]=s[0],this.start+=3}appendView(e){this.ensureCapacity(e.length),this.view.set(e,this.start),this.start+=e.length}getBlock(e){if(e<=0)return Buffer.alloc(0);if(this.start+e>this.view.length)throw new Error("request past end of buffer");let r=this.view.subarray(this.start,this.start+e);return this.start+=e,r}getUint8(){return this.getBlock(1)[0]}getUint16(){let e=this.getBlock(2);return e[0]<<8|e[1]}ensureCapacity(e){if(this.start+e>this.view.byteLength){let r=t.BLOCK_SIZE+(e>t.BLOCK_SIZE?e:0);this.realloc(this.view.byteLength+r)}}realloc(e){let r=new ArrayBuffer(e),s=Buffer.from(r);s.set(this.view),this.buf=r,this.view=s}};uO.ByteStream=cO;cO.BLOCK_SIZE=1024});var fO=L(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});Jw.ASN1TypeError=Jw.ASN1ParseError=void 0;var R7=class extends Error{};Jw.ASN1ParseError=R7;var F7=class extends Error{};Jw.ASN1TypeError=F7});var jTe=L(AO=>{"use strict";Object.defineProperty(AO,"__esModule",{value:!0});AO.decodeLength=vLt;AO.encodeLength=SLt;var HTe=fO();function vLt(t){let e=t.getUint8();if(!(e&128))return e;let r=e&127;if(r>6)throw new HTe.ASN1ParseError("length exceeds 6 byte limit");let s=0;for(let a=0;a0n;)r.unshift(Number(e&255n)),e=e>>8n;return Buffer.from([128|r.length,...r])}});var GTe=L(wg=>{"use strict";Object.defineProperty(wg,"__esModule",{value:!0});wg.parseInteger=PLt;wg.parseStringASCII=qTe;wg.parseTime=xLt;wg.parseOID=kLt;wg.parseBoolean=QLt;wg.parseBitString=TLt;var DLt=/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?Z$/,bLt=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?Z$/;function PLt(t){let e=0,r=t.length,s=t[e],a=s>127,n=a?255:0;for(;s==n&&++e=50?1900:2e3,s[1]=a.toString()}return new Date(`${s[1]}-${s[2]}-${s[3]}T${s[4]}:${s[5]}:${s[6]}Z`)}function kLt(t){let e=0,r=t.length,s=t[e++],a=Math.floor(s/40),n=s%40,c=`${a}.${n}`,f=0;for(;e=f;--p)a.push(c>>p&1)}return a}});var YTe=L(pO=>{"use strict";Object.defineProperty(pO,"__esModule",{value:!0});pO.ASN1Tag=void 0;var WTe=fO(),ry={BOOLEAN:1,INTEGER:2,BIT_STRING:3,OCTET_STRING:4,OBJECT_IDENTIFIER:6,SEQUENCE:16,SET:17,PRINTABLE_STRING:19,UTC_TIME:23,GENERALIZED_TIME:24},N7={UNIVERSAL:0,APPLICATION:1,CONTEXT_SPECIFIC:2,PRIVATE:3},O7=class{constructor(e){if(this.number=e&31,this.constructed=(e&32)===32,this.class=e>>6,this.number===31)throw new WTe.ASN1ParseError("long form tags not supported");if(this.class===N7.UNIVERSAL&&this.number===0)throw new WTe.ASN1ParseError("unsupported tag 0x00")}isUniversal(){return this.class===N7.UNIVERSAL}isContextSpecific(e){let r=this.class===N7.CONTEXT_SPECIFIC;return e!==void 0?r&&this.number===e:r}isBoolean(){return this.isUniversal()&&this.number===ry.BOOLEAN}isInteger(){return this.isUniversal()&&this.number===ry.INTEGER}isBitString(){return this.isUniversal()&&this.number===ry.BIT_STRING}isOctetString(){return this.isUniversal()&&this.number===ry.OCTET_STRING}isOID(){return this.isUniversal()&&this.number===ry.OBJECT_IDENTIFIER}isUTCTime(){return this.isUniversal()&&this.number===ry.UTC_TIME}isGeneralizedTime(){return this.isUniversal()&&this.number===ry.GENERALIZED_TIME}toDER(){return this.number|(this.constructed?32:0)|this.class<<6}};pO.ASN1Tag=O7});var zTe=L(gO=>{"use strict";Object.defineProperty(gO,"__esModule",{value:!0});gO.ASN1Obj=void 0;var L7=Ob(),ny=fO(),KTe=jTe(),zw=GTe(),RLt=YTe(),hO=class{constructor(e,r,s){this.tag=e,this.value=r,this.subs=s}static parseBuffer(e){return JTe(new L7.ByteStream(e))}toDER(){let e=new L7.ByteStream;if(this.subs.length>0)for(let a of this.subs)e.appendView(a.toDER());else e.appendView(this.value);let r=e.buffer,s=new L7.ByteStream;return s.appendChar(this.tag.toDER()),s.appendView((0,KTe.encodeLength)(r.length)),s.appendView(r),s.buffer}toBoolean(){if(!this.tag.isBoolean())throw new ny.ASN1TypeError("not a boolean");return(0,zw.parseBoolean)(this.value)}toInteger(){if(!this.tag.isInteger())throw new ny.ASN1TypeError("not an integer");return(0,zw.parseInteger)(this.value)}toOID(){if(!this.tag.isOID())throw new ny.ASN1TypeError("not an OID");return(0,zw.parseOID)(this.value)}toDate(){switch(!0){case this.tag.isUTCTime():return(0,zw.parseTime)(this.value,!0);case this.tag.isGeneralizedTime():return(0,zw.parseTime)(this.value,!1);default:throw new ny.ASN1TypeError("not a date")}}toBitString(){if(!this.tag.isBitString())throw new ny.ASN1TypeError("not a bit string");return(0,zw.parseBitString)(this.value)}};gO.ASN1Obj=hO;function JTe(t){let e=new RLt.ASN1Tag(t.getUint8()),r=(0,KTe.decodeLength)(t),s=t.slice(t.position,r),a=t.position,n=[];if(e.constructed)n=VTe(t,r);else if(e.isOctetString())try{n=VTe(t,r)}catch{}return n.length===0&&t.seek(a+r),new hO(e,s,n)}function VTe(t,e){let r=t.position+e;if(r>t.length)throw new ny.ASN1ParseError("invalid length");let s=[];for(;t.position{"use strict";Object.defineProperty(dO,"__esModule",{value:!0});dO.ASN1Obj=void 0;var FLt=zTe();Object.defineProperty(dO,"ASN1Obj",{enumerable:!0,get:function(){return FLt.ASN1Obj}})});var Zw=L(Bg=>{"use strict";var NLt=Bg&&Bg.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bg,"__esModule",{value:!0});Bg.createPublicKey=OLt;Bg.digest=LLt;Bg.verify=MLt;Bg.bufferEqual=_Lt;var Lb=NLt(ye("crypto"));function OLt(t,e="spki"){return typeof t=="string"?Lb.default.createPublicKey(t):Lb.default.createPublicKey({key:t,format:"der",type:e})}function LLt(t,...e){let r=Lb.default.createHash(t);for(let s of e)r.update(s);return r.digest()}function MLt(t,e,r,s){try{return Lb.default.verify(s,t,e,r)}catch{return!1}}function _Lt(t,e){try{return Lb.default.timingSafeEqual(t,e)}catch{return!1}}});var ZTe=L(M7=>{"use strict";Object.defineProperty(M7,"__esModule",{value:!0});M7.preAuthEncoding=HLt;var ULt="DSSEv1";function HLt(t,e){let r=[ULt,t.length,t,e.length,""].join(" ");return Buffer.concat([Buffer.from(r,"ascii"),e])}});var eRe=L(yO=>{"use strict";Object.defineProperty(yO,"__esModule",{value:!0});yO.base64Encode=jLt;yO.base64Decode=qLt;var XTe="base64",$Te="utf-8";function jLt(t){return Buffer.from(t,$Te).toString(XTe)}function qLt(t){return Buffer.from(t,XTe).toString($Te)}});var tRe=L(U7=>{"use strict";Object.defineProperty(U7,"__esModule",{value:!0});U7.canonicalize=_7;function _7(t){let e="";if(t===null||typeof t!="object"||t.toJSON!=null)e+=JSON.stringify(t);else if(Array.isArray(t)){e+="[";let r=!0;t.forEach(s=>{r||(e+=","),r=!1,e+=_7(s)}),e+="]"}else{e+="{";let r=!0;Object.keys(t).sort().forEach(s=>{r||(e+=","),r=!1,e+=JSON.stringify(s),e+=":",e+=_7(t[s])}),e+="}"}return e}});var H7=L(EO=>{"use strict";Object.defineProperty(EO,"__esModule",{value:!0});EO.toDER=YLt;EO.fromDER=VLt;var GLt=/-----BEGIN (.*)-----/,WLt=/-----END (.*)-----/;function YLt(t){let e="";return t.split(` +`).forEach(r=>{r.match(GLt)||r.match(WLt)||(e+=r)}),Buffer.from(e,"base64")}function VLt(t,e="CERTIFICATE"){let s=t.toString("base64").match(/.{1,64}/g)||"";return[`-----BEGIN ${e}-----`,...s,`-----END ${e}-----`].join(` +`).concat(` +`)}});var IO=L(Xw=>{"use strict";Object.defineProperty(Xw,"__esModule",{value:!0});Xw.SHA2_HASH_ALGOS=Xw.ECDSA_SIGNATURE_ALGOS=void 0;Xw.ECDSA_SIGNATURE_ALGOS={"1.2.840.10045.4.3.1":"sha224","1.2.840.10045.4.3.2":"sha256","1.2.840.10045.4.3.3":"sha384","1.2.840.10045.4.3.4":"sha512"};Xw.SHA2_HASH_ALGOS={"2.16.840.1.101.3.4.2.1":"sha256","2.16.840.1.101.3.4.2.2":"sha384","2.16.840.1.101.3.4.2.3":"sha512"}});var q7=L(CO=>{"use strict";Object.defineProperty(CO,"__esModule",{value:!0});CO.RFC3161TimestampVerificationError=void 0;var j7=class extends Error{};CO.RFC3161TimestampVerificationError=j7});var nRe=L(DA=>{"use strict";var KLt=DA&&DA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),JLt=DA&&DA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zLt=DA&&DA.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KLt(e,t,r);return JLt(e,t),e};Object.defineProperty(DA,"__esModule",{value:!0});DA.TSTInfo=void 0;var rRe=zLt(Zw()),ZLt=IO(),XLt=q7(),G7=class{constructor(e){this.root=e}get version(){return this.root.subs[0].toInteger()}get genTime(){return this.root.subs[4].toDate()}get messageImprintHashAlgorithm(){let e=this.messageImprintObj.subs[0].subs[0].toOID();return ZLt.SHA2_HASH_ALGOS[e]}get messageImprintHashedMessage(){return this.messageImprintObj.subs[1].value}get raw(){return this.root.toDER()}verify(e){let r=rRe.digest(this.messageImprintHashAlgorithm,e);if(!rRe.bufferEqual(r,this.messageImprintHashedMessage))throw new XLt.RFC3161TimestampVerificationError("message imprint does not match artifact")}get messageImprintObj(){return this.root.subs[2]}};DA.TSTInfo=G7});var sRe=L(bA=>{"use strict";var $Lt=bA&&bA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),eMt=bA&&bA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tMt=bA&&bA.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Lt(e,t,r);return eMt(e,t),e};Object.defineProperty(bA,"__esModule",{value:!0});bA.RFC3161Timestamp=void 0;var rMt=mO(),W7=tMt(Zw()),iRe=IO(),Mb=q7(),nMt=nRe(),iMt="1.2.840.113549.1.7.2",sMt="1.2.840.113549.1.9.16.1.4",oMt="1.2.840.113549.1.9.4",Y7=class t{constructor(e){this.root=e}static parse(e){let r=rMt.ASN1Obj.parseBuffer(e);return new t(r)}get status(){return this.pkiStatusInfoObj.subs[0].toInteger()}get contentType(){return this.contentTypeObj.toOID()}get eContentType(){return this.eContentTypeObj.toOID()}get signingTime(){return this.tstInfo.genTime}get signerIssuer(){return this.signerSidObj.subs[0].value}get signerSerialNumber(){return this.signerSidObj.subs[1].value}get signerDigestAlgorithm(){let e=this.signerDigestAlgorithmObj.subs[0].toOID();return iRe.SHA2_HASH_ALGOS[e]}get signatureAlgorithm(){let e=this.signatureAlgorithmObj.subs[0].toOID();return iRe.ECDSA_SIGNATURE_ALGOS[e]}get signatureValue(){return this.signatureValueObj.value}get tstInfo(){return new nMt.TSTInfo(this.eContentObj.subs[0].subs[0])}verify(e,r){if(!this.timeStampTokenObj)throw new Mb.RFC3161TimestampVerificationError("timeStampToken is missing");if(this.contentType!==iMt)throw new Mb.RFC3161TimestampVerificationError(`incorrect content type: ${this.contentType}`);if(this.eContentType!==sMt)throw new Mb.RFC3161TimestampVerificationError(`incorrect encapsulated content type: ${this.eContentType}`);this.tstInfo.verify(e),this.verifyMessageDigest(),this.verifySignature(r)}verifyMessageDigest(){let e=W7.digest(this.signerDigestAlgorithm,this.tstInfo.raw),r=this.messageDigestAttributeObj.subs[1].subs[0].value;if(!W7.bufferEqual(e,r))throw new Mb.RFC3161TimestampVerificationError("signed data does not match tstInfo")}verifySignature(e){let r=this.signedAttrsObj.toDER();if(r[0]=49,!W7.verify(r,e,this.signatureValue,this.signatureAlgorithm))throw new Mb.RFC3161TimestampVerificationError("signature verification failed")}get pkiStatusInfoObj(){return this.root.subs[0]}get timeStampTokenObj(){return this.root.subs[1]}get contentTypeObj(){return this.timeStampTokenObj.subs[0]}get signedDataObj(){return this.timeStampTokenObj.subs.find(r=>r.tag.isContextSpecific(0)).subs[0]}get encapContentInfoObj(){return this.signedDataObj.subs[2]}get signerInfosObj(){let e=this.signedDataObj;return e.subs[e.subs.length-1]}get signerInfoObj(){return this.signerInfosObj.subs[0]}get eContentTypeObj(){return this.encapContentInfoObj.subs[0]}get eContentObj(){return this.encapContentInfoObj.subs[1]}get signedAttrsObj(){return this.signerInfoObj.subs.find(r=>r.tag.isContextSpecific(0))}get messageDigestAttributeObj(){return this.signedAttrsObj.subs.find(r=>r.subs[0].tag.isOID()&&r.subs[0].toOID()===oMt)}get signerSidObj(){return this.signerInfoObj.subs[1]}get signerDigestAlgorithmObj(){return this.signerInfoObj.subs[2]}get signatureAlgorithmObj(){return this.signerInfoObj.subs[4]}get signatureValueObj(){return this.signerInfoObj.subs[5]}};bA.RFC3161Timestamp=Y7});var oRe=L(wO=>{"use strict";Object.defineProperty(wO,"__esModule",{value:!0});wO.RFC3161Timestamp=void 0;var aMt=sRe();Object.defineProperty(wO,"RFC3161Timestamp",{enumerable:!0,get:function(){return aMt.RFC3161Timestamp}})});var lRe=L(PA=>{"use strict";var lMt=PA&&PA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),cMt=PA&&PA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uMt=PA&&PA.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lMt(e,t,r);return cMt(e,t),e};Object.defineProperty(PA,"__esModule",{value:!0});PA.SignedCertificateTimestamp=void 0;var fMt=uMt(Zw()),aRe=Ob(),V7=class t{constructor(e){this.version=e.version,this.logID=e.logID,this.timestamp=e.timestamp,this.extensions=e.extensions,this.hashAlgorithm=e.hashAlgorithm,this.signatureAlgorithm=e.signatureAlgorithm,this.signature=e.signature}get datetime(){return new Date(Number(this.timestamp.readBigInt64BE()))}get algorithm(){switch(this.hashAlgorithm){case 0:return"none";case 1:return"md5";case 2:return"sha1";case 3:return"sha224";case 4:return"sha256";case 5:return"sha384";case 6:return"sha512";default:return"unknown"}}verify(e,r){let s=new aRe.ByteStream;return s.appendChar(this.version),s.appendChar(0),s.appendView(this.timestamp),s.appendUint16(1),s.appendView(e),s.appendUint16(this.extensions.byteLength),this.extensions.byteLength>0&&s.appendView(this.extensions),fMt.verify(s.buffer,r,this.signature,this.algorithm)}static parse(e){let r=new aRe.ByteStream(e),s=r.getUint8(),a=r.getBlock(32),n=r.getBlock(8),c=r.getUint16(),f=r.getBlock(c),p=r.getUint8(),h=r.getUint8(),E=r.getUint16(),C=r.getBlock(E);if(r.position!==e.length)throw new Error("SCT buffer length mismatch");return new t({version:s,logID:a,timestamp:n,extensions:f,hashAlgorithm:p,signatureAlgorithm:h,signature:C})}};PA.SignedCertificateTimestamp=V7});var eK=L(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.X509SCTExtension=oa.X509SubjectKeyIDExtension=oa.X509AuthorityKeyIDExtension=oa.X509SubjectAlternativeNameExtension=oa.X509KeyUsageExtension=oa.X509BasicConstraintsExtension=oa.X509Extension=void 0;var AMt=Ob(),pMt=lRe(),dh=class{constructor(e){this.root=e}get oid(){return this.root.subs[0].toOID()}get critical(){return this.root.subs.length===3?this.root.subs[1].toBoolean():!1}get value(){return this.extnValueObj.value}get valueObj(){return this.extnValueObj}get extnValueObj(){return this.root.subs[this.root.subs.length-1]}};oa.X509Extension=dh;var K7=class extends dh{get isCA(){return this.sequence.subs[0]?.toBoolean()??!1}get pathLenConstraint(){return this.sequence.subs.length>1?this.sequence.subs[1].toInteger():void 0}get sequence(){return this.extnValueObj.subs[0]}};oa.X509BasicConstraintsExtension=K7;var J7=class extends dh{get digitalSignature(){return this.bitString[0]===1}get keyCertSign(){return this.bitString[5]===1}get crlSign(){return this.bitString[6]===1}get bitString(){return this.extnValueObj.subs[0].toBitString()}};oa.X509KeyUsageExtension=J7;var z7=class extends dh{get rfc822Name(){return this.findGeneralName(1)?.value.toString("ascii")}get uri(){return this.findGeneralName(6)?.value.toString("ascii")}otherName(e){let r=this.findGeneralName(0);return r===void 0||r.subs[0].toOID()!==e?void 0:r.subs[1].subs[0].value.toString("ascii")}findGeneralName(e){return this.generalNames.find(r=>r.tag.isContextSpecific(e))}get generalNames(){return this.extnValueObj.subs[0].subs}};oa.X509SubjectAlternativeNameExtension=z7;var Z7=class extends dh{get keyIdentifier(){return this.findSequenceMember(0)?.value}findSequenceMember(e){return this.sequence.subs.find(r=>r.tag.isContextSpecific(e))}get sequence(){return this.extnValueObj.subs[0]}};oa.X509AuthorityKeyIDExtension=Z7;var X7=class extends dh{get keyIdentifier(){return this.extnValueObj.subs[0].value}};oa.X509SubjectKeyIDExtension=X7;var $7=class extends dh{constructor(e){super(e)}get signedCertificateTimestamps(){let e=this.extnValueObj.subs[0].value,r=new AMt.ByteStream(e),s=r.getUint16()+2,a=[];for(;r.position{"use strict";var hMt=sc&&sc.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),gMt=sc&&sc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uRe=sc&&sc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hMt(e,t,r);return gMt(e,t),e};Object.defineProperty(sc,"__esModule",{value:!0});sc.X509Certificate=sc.EXTENSION_OID_SCT=void 0;var dMt=mO(),cRe=uRe(Zw()),mMt=IO(),yMt=uRe(H7()),iy=eK(),EMt="2.5.29.14",IMt="2.5.29.15",CMt="2.5.29.17",wMt="2.5.29.19",BMt="2.5.29.35";sc.EXTENSION_OID_SCT="1.3.6.1.4.1.11129.2.4.2";var tK=class t{constructor(e){this.root=e}static parse(e){let r=typeof e=="string"?yMt.toDER(e):e,s=dMt.ASN1Obj.parseBuffer(r);return new t(s)}get tbsCertificate(){return this.tbsCertificateObj}get version(){return`v${(this.versionObj.subs[0].toInteger()+BigInt(1)).toString()}`}get serialNumber(){return this.serialNumberObj.value}get notBefore(){return this.validityObj.subs[0].toDate()}get notAfter(){return this.validityObj.subs[1].toDate()}get issuer(){return this.issuerObj.value}get subject(){return this.subjectObj.value}get publicKey(){return this.subjectPublicKeyInfoObj.toDER()}get signatureAlgorithm(){let e=this.signatureAlgorithmObj.subs[0].toOID();return mMt.ECDSA_SIGNATURE_ALGOS[e]}get signatureValue(){return this.signatureValueObj.value.subarray(1)}get subjectAltName(){let e=this.extSubjectAltName;return e?.uri||e?.rfc822Name}get extensions(){return this.extensionsObj?.subs[0]?.subs||[]}get extKeyUsage(){let e=this.findExtension(IMt);return e?new iy.X509KeyUsageExtension(e):void 0}get extBasicConstraints(){let e=this.findExtension(wMt);return e?new iy.X509BasicConstraintsExtension(e):void 0}get extSubjectAltName(){let e=this.findExtension(CMt);return e?new iy.X509SubjectAlternativeNameExtension(e):void 0}get extAuthorityKeyID(){let e=this.findExtension(BMt);return e?new iy.X509AuthorityKeyIDExtension(e):void 0}get extSubjectKeyID(){let e=this.findExtension(EMt);return e?new iy.X509SubjectKeyIDExtension(e):void 0}get extSCT(){let e=this.findExtension(sc.EXTENSION_OID_SCT);return e?new iy.X509SCTExtension(e):void 0}get isCA(){let e=this.extBasicConstraints?.isCA||!1;return this.extKeyUsage?e&&this.extKeyUsage.keyCertSign:e}extension(e){let r=this.findExtension(e);return r?new iy.X509Extension(r):void 0}verify(e){let r=e?.publicKey||this.publicKey,s=cRe.createPublicKey(r);return cRe.verify(this.tbsCertificate.toDER(),s,this.signatureValue,this.signatureAlgorithm)}validForDate(e){return this.notBefore<=e&&e<=this.notAfter}equals(e){return this.root.toDER().equals(e.root.toDER())}clone(){let e=this.root.toDER(),r=Buffer.alloc(e.length);return e.copy(r),t.parse(r)}findExtension(e){return this.extensions.find(r=>r.subs[0].toOID()===e)}get tbsCertificateObj(){return this.root.subs[0]}get signatureAlgorithmObj(){return this.root.subs[1]}get signatureValueObj(){return this.root.subs[2]}get versionObj(){return this.tbsCertificateObj.subs[0]}get serialNumberObj(){return this.tbsCertificateObj.subs[1]}get issuerObj(){return this.tbsCertificateObj.subs[3]}get validityObj(){return this.tbsCertificateObj.subs[4]}get subjectObj(){return this.tbsCertificateObj.subs[5]}get subjectPublicKeyInfoObj(){return this.tbsCertificateObj.subs[6]}get extensionsObj(){return this.tbsCertificateObj.subs.find(e=>e.tag.isContextSpecific(3))}};sc.X509Certificate=tK});var pRe=L(vg=>{"use strict";Object.defineProperty(vg,"__esModule",{value:!0});vg.X509SCTExtension=vg.X509Certificate=vg.EXTENSION_OID_SCT=void 0;var ARe=fRe();Object.defineProperty(vg,"EXTENSION_OID_SCT",{enumerable:!0,get:function(){return ARe.EXTENSION_OID_SCT}});Object.defineProperty(vg,"X509Certificate",{enumerable:!0,get:function(){return ARe.X509Certificate}});var vMt=eK();Object.defineProperty(vg,"X509SCTExtension",{enumerable:!0,get:function(){return vMt.X509SCTExtension}})});var wl=L(Kn=>{"use strict";var SMt=Kn&&Kn.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),DMt=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_b=Kn&&Kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SMt(e,t,r);return DMt(e,t),e};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.X509SCTExtension=Kn.X509Certificate=Kn.EXTENSION_OID_SCT=Kn.ByteStream=Kn.RFC3161Timestamp=Kn.pem=Kn.json=Kn.encoding=Kn.dsse=Kn.crypto=Kn.ASN1Obj=void 0;var bMt=mO();Object.defineProperty(Kn,"ASN1Obj",{enumerable:!0,get:function(){return bMt.ASN1Obj}});Kn.crypto=_b(Zw());Kn.dsse=_b(ZTe());Kn.encoding=_b(eRe());Kn.json=_b(tRe());Kn.pem=_b(H7());var PMt=oRe();Object.defineProperty(Kn,"RFC3161Timestamp",{enumerable:!0,get:function(){return PMt.RFC3161Timestamp}});var xMt=Ob();Object.defineProperty(Kn,"ByteStream",{enumerable:!0,get:function(){return xMt.ByteStream}});var rK=pRe();Object.defineProperty(Kn,"EXTENSION_OID_SCT",{enumerable:!0,get:function(){return rK.EXTENSION_OID_SCT}});Object.defineProperty(Kn,"X509Certificate",{enumerable:!0,get:function(){return rK.X509Certificate}});Object.defineProperty(Kn,"X509SCTExtension",{enumerable:!0,get:function(){return rK.X509SCTExtension}})});var hRe=L(nK=>{"use strict";Object.defineProperty(nK,"__esModule",{value:!0});nK.extractJWTSubject=QMt;var kMt=wl();function QMt(t){let e=t.split(".",3),r=JSON.parse(kMt.encoding.base64Decode(e[1]));switch(r.iss){case"https://accounts.google.com":case"https://oauth2.sigstore.dev/auth":return r.email;default:return r.sub}}});var gRe=L((kCr,TMt)=>{TMt.exports={name:"@sigstore/sign",version:"3.1.0",description:"Sigstore signing library",main:"dist/index.js",types:"dist/index.d.ts",scripts:{clean:"shx rm -rf dist *.tsbuildinfo",build:"tsc --build",test:"jest"},files:["dist"],author:"bdehamer@github.com",license:"Apache-2.0",repository:{type:"git",url:"git+https://github.com/sigstore/sigstore-js.git"},bugs:{url:"https://github.com/sigstore/sigstore-js/issues"},homepage:"https://github.com/sigstore/sigstore-js/tree/main/packages/sign#readme",publishConfig:{provenance:!0},devDependencies:{"@sigstore/jest":"^0.0.0","@sigstore/mock":"^0.10.0","@sigstore/rekor-types":"^3.0.0","@types/make-fetch-happen":"^10.0.4","@types/promise-retry":"^1.1.6"},dependencies:{"@sigstore/bundle":"^3.1.0","@sigstore/core":"^2.0.0","@sigstore/protobuf-specs":"^0.4.0","make-fetch-happen":"^14.0.2","proc-log":"^5.0.0","promise-retry":"^2.0.1"},engines:{node:"^18.17.0 || >=20.5.0"}}});var mRe=L($w=>{"use strict";var RMt=$w&&$w.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($w,"__esModule",{value:!0});$w.getUserAgent=void 0;var dRe=RMt(ye("os")),FMt=()=>{let t=gRe().version,e=process.version,r=dRe.default.platform(),s=dRe.default.arch();return`sigstore-js/${t} (Node ${e}) (${r}/${s})`};$w.getUserAgent=FMt});var Sg=L(Ki=>{"use strict";var NMt=Ki&&Ki.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),OMt=Ki&&Ki.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRe=Ki&&Ki.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[s.length]=a);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),a=0;a{"use strict";Object.defineProperty(BO,"__esModule",{value:!0});BO.BaseBundleBuilder=void 0;var iK=class{constructor(e){this.signer=e.signer,this.witnesses=e.witnesses}async create(e){let r=await this.prepare(e).then(f=>this.signer.sign(f)),s=await this.package(e,r),a=await Promise.all(this.witnesses.map(f=>f.testify(s.content,LMt(r.key)))),n=[],c=[];return a.forEach(({tlogEntries:f,rfc3161Timestamps:p})=>{n.push(...f??[]),c.push(...p??[])}),s.verificationMaterial.tlogEntries=n,s.verificationMaterial.timestampVerificationData={rfc3161Timestamps:c},s}async prepare(e){return e.data}};BO.BaseBundleBuilder=iK;function LMt(t){switch(t.$case){case"publicKey":return t.publicKey;case"x509Certificate":return t.certificate}}});var aK=L(xA=>{"use strict";var MMt=xA&&xA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),_Mt=xA&&xA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UMt=xA&&xA.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[s.length]=a);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),a=0;a{"use strict";Object.defineProperty(vO,"__esModule",{value:!0});vO.DSSEBundleBuilder=void 0;var qMt=Sg(),GMt=sK(),WMt=aK(),lK=class extends GMt.BaseBundleBuilder{constructor(e){super(e),this.certificateChain=e.certificateChain??!1}async prepare(e){let r=IRe(e);return qMt.dsse.preAuthEncoding(r.type,r.data)}async package(e,r){return(0,WMt.toDSSEBundle)(IRe(e),r,this.certificateChain)}};vO.DSSEBundleBuilder=lK;function IRe(t){return{...t,type:t.type??""}}});var wRe=L(SO=>{"use strict";Object.defineProperty(SO,"__esModule",{value:!0});SO.MessageSignatureBundleBuilder=void 0;var YMt=sK(),VMt=aK(),cK=class extends YMt.BaseBundleBuilder{constructor(e){super(e)}async package(e,r){return(0,VMt.toMessageSignatureBundle)(e,r)}};SO.MessageSignatureBundleBuilder=cK});var BRe=L(e1=>{"use strict";Object.defineProperty(e1,"__esModule",{value:!0});e1.MessageSignatureBundleBuilder=e1.DSSEBundleBuilder=void 0;var KMt=CRe();Object.defineProperty(e1,"DSSEBundleBuilder",{enumerable:!0,get:function(){return KMt.DSSEBundleBuilder}});var JMt=wRe();Object.defineProperty(e1,"MessageSignatureBundleBuilder",{enumerable:!0,get:function(){return JMt.MessageSignatureBundleBuilder}})});var bO=L(DO=>{"use strict";Object.defineProperty(DO,"__esModule",{value:!0});DO.HTTPError=void 0;var uK=class extends Error{constructor({status:e,message:r,location:s}){super(`(${e}) ${r}`),this.statusCode=e,this.location=s}};DO.HTTPError=uK});var t1=L(Hb=>{"use strict";Object.defineProperty(Hb,"__esModule",{value:!0});Hb.InternalError=void 0;Hb.internalError=ZMt;var zMt=bO(),PO=class extends Error{constructor({code:e,message:r,cause:s}){super(r),this.name=this.constructor.name,this.cause=s,this.code=e}};Hb.InternalError=PO;function ZMt(t,e,r){throw t instanceof zMt.HTTPError&&(r+=` - ${t.message}`),new PO({code:e,message:r,cause:t})}});var xO=L((UCr,vRe)=>{vRe.exports=fetch});var SRe=L(r1=>{"use strict";var XMt=r1&&r1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r1,"__esModule",{value:!0});r1.CIContextProvider=void 0;var $Mt=XMt(xO()),e_t=[t_t,r_t],fK=class{constructor(e="sigstore"){this.audience=e}async getToken(){return Promise.any(e_t.map(e=>e(this.audience))).catch(()=>Promise.reject("CI: no tokens available"))}};r1.CIContextProvider=fK;async function t_t(t){if(!process.env.ACTIONS_ID_TOKEN_REQUEST_URL||!process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN)return Promise.reject("no token available");let e=new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);return e.searchParams.append("audience",t),(await(0,$Mt.default)(e.href,{retry:2,headers:{Accept:"application/json",Authorization:`Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`}})).json().then(s=>s.value)}async function r_t(){return process.env.SIGSTORE_ID_TOKEN?process.env.SIGSTORE_ID_TOKEN:Promise.reject("no token available")}});var DRe=L(kO=>{"use strict";Object.defineProperty(kO,"__esModule",{value:!0});kO.CIContextProvider=void 0;var n_t=SRe();Object.defineProperty(kO,"CIContextProvider",{enumerable:!0,get:function(){return n_t.CIContextProvider}})});var PRe=L((qCr,bRe)=>{var i_t=Symbol("proc-log.meta");bRe.exports={META:i_t,output:{LEVELS:["standard","error","buffer","flush"],KEYS:{standard:"standard",error:"error",buffer:"buffer",flush:"flush"},standard:function(...t){return process.emit("output","standard",...t)},error:function(...t){return process.emit("output","error",...t)},buffer:function(...t){return process.emit("output","buffer",...t)},flush:function(...t){return process.emit("output","flush",...t)}},log:{LEVELS:["notice","error","warn","info","verbose","http","silly","timing","pause","resume"],KEYS:{notice:"notice",error:"error",warn:"warn",info:"info",verbose:"verbose",http:"http",silly:"silly",timing:"timing",pause:"pause",resume:"resume"},error:function(...t){return process.emit("log","error",...t)},notice:function(...t){return process.emit("log","notice",...t)},warn:function(...t){return process.emit("log","warn",...t)},info:function(...t){return process.emit("log","info",...t)},verbose:function(...t){return process.emit("log","verbose",...t)},http:function(...t){return process.emit("log","http",...t)},silly:function(...t){return process.emit("log","silly",...t)},timing:function(...t){return process.emit("log","timing",...t)},pause:function(){return process.emit("log","pause")},resume:function(){return process.emit("log","resume")}},time:{LEVELS:["start","end"],KEYS:{start:"start",end:"end"},start:function(t,e){process.emit("time","start",t);function r(){return process.emit("time","end",t)}if(typeof e=="function"){let s=e();return s&&s.finally?s.finally(r):(r(),s)}return r},end:function(t){return process.emit("time","end",t)}},input:{LEVELS:["start","end","read"],KEYS:{start:"start",end:"end",read:"read"},start:function(t){process.emit("input","start");function e(){return process.emit("input","end")}if(typeof t=="function"){let r=t();return r&&r.finally?r.finally(e):(e(),r)}return e},end:function(){return process.emit("input","end")},read:function(...t){let e,r,s=new Promise((a,n)=>{e=a,r=n});return process.emit("input","read",e,r,...t),s}}}});var QRe=L((GCr,kRe)=>{"use strict";function xRe(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function s_t(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=void 0),e!=null&&(r.code=e);try{return xRe(t,r)}catch{r.message=t.message,r.stack=t.stack;let a=function(){};return a.prototype=Object.create(Object.getPrototypeOf(t)),xRe(new a,r)}}kRe.exports=s_t});var RRe=L((WCr,TRe)=>{function tu(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}TRe.exports=tu;tu.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};tu.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};tu.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var s=this,a=setTimeout(function(){s._attempts++,s._operationTimeoutCb&&(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref&&s._timeout.unref()),s._fn(s._attempts)},r);return this._options.unref&&a.unref(),!0};tu.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};tu.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};tu.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};tu.prototype.start=tu.prototype.try;tu.prototype.errors=function(){return this._errors};tu.prototype.attempts=function(){return this._attempts};tu.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,s=0;s=r&&(e=a,r=c)}return e}});var FRe=L(sy=>{var o_t=RRe();sy.operation=function(t){var e=sy.timeouts(t);return new o_t(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};sy.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],a=0;a{NRe.exports=FRe()});var _Re=L((KCr,MRe)=>{"use strict";var a_t=QRe(),l_t=ORe(),c_t=Object.prototype.hasOwnProperty;function LRe(t){return t&&t.code==="EPROMISERETRY"&&c_t.call(t,"retried")}function u_t(t,e){var r,s;return typeof t=="object"&&typeof e=="function"&&(r=e,e=t,t=r),s=l_t.operation(e),new Promise(function(a,n){s.attempt(function(c){Promise.resolve().then(function(){return t(function(f){throw LRe(f)&&(f=f.retried),a_t(new Error("Retrying"),"EPROMISERETRY",{retried:f})},c)}).then(a,function(f){LRe(f)&&(f=f.retried,s.retry(f||new Error))||n(f)})})})}MRe.exports=u_t});var QO=L(jb=>{"use strict";var HRe=jb&&jb.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jb,"__esModule",{value:!0});jb.fetchWithRetry=w_t;var f_t=ye("http2"),A_t=HRe(xO()),URe=PRe(),p_t=HRe(_Re()),h_t=Sg(),g_t=bO(),{HTTP2_HEADER_LOCATION:d_t,HTTP2_HEADER_CONTENT_TYPE:m_t,HTTP2_HEADER_USER_AGENT:y_t,HTTP_STATUS_INTERNAL_SERVER_ERROR:E_t,HTTP_STATUS_TOO_MANY_REQUESTS:I_t,HTTP_STATUS_REQUEST_TIMEOUT:C_t}=f_t.constants;async function w_t(t,e){return(0,p_t.default)(async(r,s)=>{let a=e.method||"POST",n={[y_t]:h_t.ua.getUserAgent(),...e.headers},c=await(0,A_t.default)(t,{method:a,headers:n,body:e.body,timeout:e.timeout,retry:!1}).catch(f=>(URe.log.http("fetch",`${a} ${t} attempt ${s} failed with ${f}`),r(f)));if(c.ok)return c;{let f=await B_t(c);if(URe.log.http("fetch",`${a} ${t} attempt ${s} failed with ${c.status}`),v_t(c.status))return r(f);throw f}},S_t(e.retry))}var B_t=async t=>{let e=t.statusText,r=t.headers.get(d_t)||void 0;if(t.headers.get(m_t)?.includes("application/json"))try{e=(await t.json()).message||e}catch{}return new g_t.HTTPError({status:t.status,message:e,location:r})},v_t=t=>[C_t,I_t].includes(t)||t>=E_t,S_t=t=>typeof t=="boolean"?{retries:t?1:0}:typeof t=="number"?{retries:t}:{retries:0,...t}});var jRe=L(TO=>{"use strict";Object.defineProperty(TO,"__esModule",{value:!0});TO.Fulcio=void 0;var D_t=QO(),AK=class{constructor(e){this.options=e}async createSigningCertificate(e){let{baseURL:r,retry:s,timeout:a}=this.options,n=`${r}/api/v2/signingCert`;return(await(0,D_t.fetchWithRetry)(n,{headers:{"Content-Type":"application/json"},body:JSON.stringify(e),timeout:a,retry:s})).json()}};TO.Fulcio=AK});var qRe=L(RO=>{"use strict";Object.defineProperty(RO,"__esModule",{value:!0});RO.CAClient=void 0;var b_t=t1(),P_t=jRe(),pK=class{constructor(e){this.fulcio=new P_t.Fulcio({baseURL:e.fulcioBaseURL,retry:e.retry,timeout:e.timeout})}async createSigningCertificate(e,r,s){let a=x_t(e,r,s);try{let n=await this.fulcio.createSigningCertificate(a);return(n.signedCertificateEmbeddedSct?n.signedCertificateEmbeddedSct:n.signedCertificateDetachedSct).chain.certificates}catch(n){(0,b_t.internalError)(n,"CA_CREATE_SIGNING_CERTIFICATE_ERROR","error creating signing certificate")}}};RO.CAClient=pK;function x_t(t,e,r){return{credentials:{oidcIdentityToken:t},publicKeyRequest:{publicKey:{algorithm:"ECDSA",content:e},proofOfPossession:r.toString("base64")}}}});var WRe=L(n1=>{"use strict";var k_t=n1&&n1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n1,"__esModule",{value:!0});n1.EphemeralSigner=void 0;var GRe=k_t(ye("crypto")),Q_t="ec",T_t="P-256",hK=class{constructor(){this.keypair=GRe.default.generateKeyPairSync(Q_t,{namedCurve:T_t})}async sign(e){let r=GRe.default.sign(null,e,this.keypair.privateKey),s=this.keypair.publicKey.export({format:"pem",type:"spki"}).toString("ascii");return{signature:r,key:{$case:"publicKey",publicKey:s}}}};n1.EphemeralSigner=hK});var YRe=L(oy=>{"use strict";Object.defineProperty(oy,"__esModule",{value:!0});oy.FulcioSigner=oy.DEFAULT_FULCIO_URL=void 0;var gK=t1(),R_t=Sg(),F_t=qRe(),N_t=WRe();oy.DEFAULT_FULCIO_URL="https://fulcio.sigstore.dev";var dK=class{constructor(e){this.ca=new F_t.CAClient({...e,fulcioBaseURL:e.fulcioBaseURL||oy.DEFAULT_FULCIO_URL}),this.identityProvider=e.identityProvider,this.keyHolder=e.keyHolder||new N_t.EphemeralSigner}async sign(e){let r=await this.getIdentityToken(),s;try{s=R_t.oidc.extractJWTSubject(r)}catch(f){throw new gK.InternalError({code:"IDENTITY_TOKEN_PARSE_ERROR",message:`invalid identity token: ${r}`,cause:f})}let a=await this.keyHolder.sign(Buffer.from(s));if(a.key.$case!=="publicKey")throw new gK.InternalError({code:"CA_CREATE_SIGNING_CERTIFICATE_ERROR",message:"unexpected format for signing key"});let n=await this.ca.createSigningCertificate(r,a.key.publicKey,a.signature);return{signature:(await this.keyHolder.sign(e)).signature,key:{$case:"x509Certificate",certificate:n[0]}}}async getIdentityToken(){try{return await this.identityProvider.getToken()}catch(e){throw new gK.InternalError({code:"IDENTITY_TOKEN_READ_ERROR",message:"error retrieving identity token",cause:e})}}};oy.FulcioSigner=dK});var KRe=L(i1=>{"use strict";Object.defineProperty(i1,"__esModule",{value:!0});i1.FulcioSigner=i1.DEFAULT_FULCIO_URL=void 0;var VRe=YRe();Object.defineProperty(i1,"DEFAULT_FULCIO_URL",{enumerable:!0,get:function(){return VRe.DEFAULT_FULCIO_URL}});Object.defineProperty(i1,"FulcioSigner",{enumerable:!0,get:function(){return VRe.FulcioSigner}})});var ZRe=L(FO=>{"use strict";Object.defineProperty(FO,"__esModule",{value:!0});FO.Rekor=void 0;var JRe=QO(),mK=class{constructor(e){this.options=e}async createEntry(e){let{baseURL:r,timeout:s,retry:a}=this.options,n=`${r}/api/v1/log/entries`,f=await(await(0,JRe.fetchWithRetry)(n,{headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e),timeout:s,retry:a})).json();return zRe(f)}async getEntry(e){let{baseURL:r,timeout:s,retry:a}=this.options,n=`${r}/api/v1/log/entries/${e}`,f=await(await(0,JRe.fetchWithRetry)(n,{method:"GET",headers:{Accept:"application/json"},timeout:s,retry:a})).json();return zRe(f)}};FO.Rekor=mK;function zRe(t){let e=Object.entries(t);if(e.length!=1)throw new Error("Received multiple entries in Rekor response");let[r,s]=e[0];return{...s,uuid:r}}});var $Re=L(NO=>{"use strict";Object.defineProperty(NO,"__esModule",{value:!0});NO.TLogClient=void 0;var XRe=t1(),O_t=bO(),L_t=ZRe(),yK=class{constructor(e){this.fetchOnConflict=e.fetchOnConflict??!1,this.rekor=new L_t.Rekor({baseURL:e.rekorBaseURL,retry:e.retry,timeout:e.timeout})}async createEntry(e){let r;try{r=await this.rekor.createEntry(e)}catch(s){if(M_t(s)&&this.fetchOnConflict){let a=s.location.split("/").pop()||"";try{r=await this.rekor.getEntry(a)}catch(n){(0,XRe.internalError)(n,"TLOG_FETCH_ENTRY_ERROR","error fetching tlog entry")}}else(0,XRe.internalError)(s,"TLOG_CREATE_ENTRY_ERROR","error creating tlog entry")}return r}};NO.TLogClient=yK;function M_t(t){return t instanceof O_t.HTTPError&&t.statusCode===409&&t.location!==void 0}});var eFe=L(EK=>{"use strict";Object.defineProperty(EK,"__esModule",{value:!0});EK.toProposedEntry=U_t;var __t=Nb(),Dg=Sg(),qb="sha256";function U_t(t,e,r="dsse"){switch(t.$case){case"dsseEnvelope":return r==="intoto"?q_t(t.dsseEnvelope,e):j_t(t.dsseEnvelope,e);case"messageSignature":return H_t(t.messageSignature,e)}}function H_t(t,e){let r=t.messageDigest.digest.toString("hex"),s=t.signature.toString("base64"),a=Dg.encoding.base64Encode(e);return{apiVersion:"0.0.1",kind:"hashedrekord",spec:{data:{hash:{algorithm:qb,value:r}},signature:{content:s,publicKey:{content:a}}}}}function j_t(t,e){let r=JSON.stringify((0,__t.envelopeToJSON)(t)),s=Dg.encoding.base64Encode(e);return{apiVersion:"0.0.1",kind:"dsse",spec:{proposedContent:{envelope:r,verifiers:[s]}}}}function q_t(t,e){let r=Dg.crypto.digest(qb,t.payload).toString("hex"),s=G_t(t,e),a=Dg.encoding.base64Encode(t.payload.toString("base64")),n=Dg.encoding.base64Encode(t.signatures[0].sig.toString("base64")),c=t.signatures[0].keyid,f=Dg.encoding.base64Encode(e),p={payloadType:t.payloadType,payload:a,signatures:[{sig:n,publicKey:f}]};return c.length>0&&(p.signatures[0].keyid=c),{apiVersion:"0.0.2",kind:"intoto",spec:{content:{envelope:p,hash:{algorithm:qb,value:s},payloadHash:{algorithm:qb,value:r}}}}}function G_t(t,e){let r={payloadType:t.payloadType,payload:t.payload.toString("base64"),signatures:[{sig:t.signatures[0].sig.toString("base64"),publicKey:e}]};return t.signatures[0].keyid.length>0&&(r.signatures[0].keyid=t.signatures[0].keyid),Dg.crypto.digest(qb,Dg.json.canonicalize(r)).toString("hex")}});var tFe=L(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.RekorWitness=ay.DEFAULT_REKOR_URL=void 0;var W_t=Sg(),Y_t=$Re(),V_t=eFe();ay.DEFAULT_REKOR_URL="https://rekor.sigstore.dev";var IK=class{constructor(e){this.entryType=e.entryType,this.tlog=new Y_t.TLogClient({...e,rekorBaseURL:e.rekorBaseURL||ay.DEFAULT_REKOR_URL})}async testify(e,r){let s=(0,V_t.toProposedEntry)(e,r,this.entryType),a=await this.tlog.createEntry(s);return K_t(a)}};ay.RekorWitness=IK;function K_t(t){let e=Buffer.from(t.logID,"hex"),r=W_t.encoding.base64Decode(t.body),s=JSON.parse(r),a=t?.verification?.signedEntryTimestamp?J_t(t.verification.signedEntryTimestamp):void 0,n=t?.verification?.inclusionProof?z_t(t.verification.inclusionProof):void 0;return{tlogEntries:[{logIndex:t.logIndex.toString(),logId:{keyId:e},integratedTime:t.integratedTime.toString(),kindVersion:{kind:s.kind,version:s.apiVersion},inclusionPromise:a,inclusionProof:n,canonicalizedBody:Buffer.from(t.body,"base64")}]}}function J_t(t){return{signedEntryTimestamp:Buffer.from(t,"base64")}}function z_t(t){return{logIndex:t.logIndex.toString(),treeSize:t.treeSize.toString(),rootHash:Buffer.from(t.rootHash,"hex"),hashes:t.hashes.map(e=>Buffer.from(e,"hex")),checkpoint:{envelope:t.checkpoint}}}});var rFe=L(OO=>{"use strict";Object.defineProperty(OO,"__esModule",{value:!0});OO.TimestampAuthority=void 0;var Z_t=QO(),CK=class{constructor(e){this.options=e}async createTimestamp(e){let{baseURL:r,timeout:s,retry:a}=this.options,n=`${r}/api/v1/timestamp`;return(await(0,Z_t.fetchWithRetry)(n,{headers:{"Content-Type":"application/json"},body:JSON.stringify(e),timeout:s,retry:a})).buffer()}};OO.TimestampAuthority=CK});var iFe=L(LO=>{"use strict";Object.defineProperty(LO,"__esModule",{value:!0});LO.TSAClient=void 0;var X_t=t1(),$_t=rFe(),eUt=Sg(),nFe="sha256",wK=class{constructor(e){this.tsa=new $_t.TimestampAuthority({baseURL:e.tsaBaseURL,retry:e.retry,timeout:e.timeout})}async createTimestamp(e){let r={artifactHash:eUt.crypto.digest(nFe,e).toString("base64"),hashAlgorithm:nFe};try{return await this.tsa.createTimestamp(r)}catch(s){(0,X_t.internalError)(s,"TSA_CREATE_TIMESTAMP_ERROR","error creating timestamp")}}};LO.TSAClient=wK});var sFe=L(MO=>{"use strict";Object.defineProperty(MO,"__esModule",{value:!0});MO.TSAWitness=void 0;var tUt=iFe(),BK=class{constructor(e){this.tsa=new tUt.TSAClient({tsaBaseURL:e.tsaBaseURL,retry:e.retry,timeout:e.timeout})}async testify(e){let r=rUt(e);return{rfc3161Timestamps:[{signedTimestamp:await this.tsa.createTimestamp(r)}]}}};MO.TSAWitness=BK;function rUt(t){switch(t.$case){case"dsseEnvelope":return t.dsseEnvelope.signatures[0].sig;case"messageSignature":return t.messageSignature.signature}}});var aFe=L(bg=>{"use strict";Object.defineProperty(bg,"__esModule",{value:!0});bg.TSAWitness=bg.RekorWitness=bg.DEFAULT_REKOR_URL=void 0;var oFe=tFe();Object.defineProperty(bg,"DEFAULT_REKOR_URL",{enumerable:!0,get:function(){return oFe.DEFAULT_REKOR_URL}});Object.defineProperty(bg,"RekorWitness",{enumerable:!0,get:function(){return oFe.RekorWitness}});var nUt=sFe();Object.defineProperty(bg,"TSAWitness",{enumerable:!0,get:function(){return nUt.TSAWitness}})});var SK=L(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.TSAWitness=Es.RekorWitness=Es.DEFAULT_REKOR_URL=Es.FulcioSigner=Es.DEFAULT_FULCIO_URL=Es.CIContextProvider=Es.InternalError=Es.MessageSignatureBundleBuilder=Es.DSSEBundleBuilder=void 0;var lFe=BRe();Object.defineProperty(Es,"DSSEBundleBuilder",{enumerable:!0,get:function(){return lFe.DSSEBundleBuilder}});Object.defineProperty(Es,"MessageSignatureBundleBuilder",{enumerable:!0,get:function(){return lFe.MessageSignatureBundleBuilder}});var iUt=t1();Object.defineProperty(Es,"InternalError",{enumerable:!0,get:function(){return iUt.InternalError}});var sUt=DRe();Object.defineProperty(Es,"CIContextProvider",{enumerable:!0,get:function(){return sUt.CIContextProvider}});var cFe=KRe();Object.defineProperty(Es,"DEFAULT_FULCIO_URL",{enumerable:!0,get:function(){return cFe.DEFAULT_FULCIO_URL}});Object.defineProperty(Es,"FulcioSigner",{enumerable:!0,get:function(){return cFe.FulcioSigner}});var vK=aFe();Object.defineProperty(Es,"DEFAULT_REKOR_URL",{enumerable:!0,get:function(){return vK.DEFAULT_REKOR_URL}});Object.defineProperty(Es,"RekorWitness",{enumerable:!0,get:function(){return vK.RekorWitness}});Object.defineProperty(Es,"TSAWitness",{enumerable:!0,get:function(){return vK.TSAWitness}})});var fFe=L(Gb=>{"use strict";var uFe=Gb&&Gb.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gb,"__esModule",{value:!0});Gb.appDataPath=aUt;var oUt=uFe(ye("os")),s1=uFe(ye("path"));function aUt(t){let e=oUt.default.homedir();switch(process.platform){case"darwin":{let r=s1.default.join(e,"Library","Application Support");return s1.default.join(r,t)}case"win32":{let r=process.env.LOCALAPPDATA||s1.default.join(e,"AppData","Local");return s1.default.join(r,t,"Data")}default:{let r=process.env.XDG_DATA_HOME||s1.default.join(e,".local","share");return s1.default.join(r,t)}}}});var kA=L(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.UnsupportedAlgorithmError=Bl.CryptoError=Bl.LengthOrHashMismatchError=Bl.UnsignedMetadataError=Bl.RepositoryError=Bl.ValueError=void 0;var DK=class extends Error{};Bl.ValueError=DK;var Wb=class extends Error{};Bl.RepositoryError=Wb;var bK=class extends Wb{};Bl.UnsignedMetadataError=bK;var PK=class extends Wb{};Bl.LengthOrHashMismatchError=PK;var _O=class extends Error{};Bl.CryptoError=_O;var xK=class extends _O{};Bl.UnsupportedAlgorithmError=xK});var pFe=L(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});Pg.isDefined=lUt;Pg.isObject=AFe;Pg.isStringArray=cUt;Pg.isObjectArray=uUt;Pg.isStringRecord=fUt;Pg.isObjectRecord=AUt;function lUt(t){return t!==void 0}function AFe(t){return typeof t=="object"&&t!==null}function cUt(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function uUt(t){return Array.isArray(t)&&t.every(AFe)}function fUt(t){return typeof t=="object"&&t!==null&&Object.keys(t).every(e=>typeof e=="string")&&Object.values(t).every(e=>typeof e=="string")}function AUt(t){return typeof t=="object"&&t!==null&&Object.keys(t).every(e=>typeof e=="string")&&Object.values(t).every(e=>typeof e=="object"&&e!==null)}});var QK=L((pwr,dFe)=>{var hFe=",",pUt=":",hUt="[",gUt="]",dUt="{",mUt="}";function kK(t){let e=[];if(typeof t=="string")e.push(gFe(t));else if(typeof t=="boolean")e.push(JSON.stringify(t));else if(Number.isInteger(t))e.push(JSON.stringify(t));else if(t===null)e.push(JSON.stringify(t));else if(Array.isArray(t)){e.push(hUt);let r=!0;t.forEach(s=>{r||e.push(hFe),r=!1,e.push(kK(s))}),e.push(gUt)}else if(typeof t=="object"){e.push(dUt);let r=!0;Object.keys(t).sort().forEach(s=>{r||e.push(hFe),r=!1,e.push(gFe(s)),e.push(pUt),e.push(kK(t[s]))}),e.push(mUt)}else throw new TypeError("cannot encode "+t.toString());return e.join("")}function gFe(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}dFe.exports={canonicalize:kK}});var mFe=L(o1=>{"use strict";var yUt=o1&&o1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(o1,"__esModule",{value:!0});o1.verifySignature=void 0;var EUt=QK(),IUt=yUt(ye("crypto")),CUt=(t,e,r)=>{let s=Buffer.from((0,EUt.canonicalize)(t));return IUt.default.verify(void 0,s,e,Buffer.from(r,"hex"))};o1.verifySignature=CUt});var Af=L(ru=>{"use strict";var wUt=ru&&ru.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),BUt=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yFe=ru&&ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wUt(e,t,r);return BUt(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.crypto=ru.guard=void 0;ru.guard=yFe(pFe());ru.crypto=yFe(mFe())});var ly=L(mh=>{"use strict";var vUt=mh&&mh.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mh,"__esModule",{value:!0});mh.Signed=mh.MetadataKind=void 0;mh.isMetadataKind=DUt;var SUt=vUt(ye("util")),Yb=kA(),TK=Af(),EFe=["1","0","31"],RK;(function(t){t.Root="root",t.Timestamp="timestamp",t.Snapshot="snapshot",t.Targets="targets"})(RK||(mh.MetadataKind=RK={}));function DUt(t){return typeof t=="string"&&Object.values(RK).includes(t)}var FK=class t{constructor(e){this.specVersion=e.specVersion||EFe.join(".");let r=this.specVersion.split(".");if(!(r.length===2||r.length===3)||!r.every(s=>bUt(s)))throw new Yb.ValueError("Failed to parse specVersion");if(r[0]!=EFe[0])throw new Yb.ValueError("Unsupported specVersion");this.expires=e.expires,this.version=e.version,this.unrecognizedFields=e.unrecognizedFields||{}}equals(e){return e instanceof t?this.specVersion===e.specVersion&&this.expires===e.expires&&this.version===e.version&&SUt.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields):!1}isExpired(e){return e||(e=new Date),e>=new Date(this.expires)}static commonFieldsFromJSON(e){let{spec_version:r,expires:s,version:a,...n}=e;if(TK.guard.isDefined(r)){if(typeof r!="string")throw new TypeError("spec_version must be a string")}else throw new Yb.ValueError("spec_version is not defined");if(TK.guard.isDefined(s)){if(typeof s!="string")throw new TypeError("expires must be a string")}else throw new Yb.ValueError("expires is not defined");if(TK.guard.isDefined(a)){if(typeof a!="number")throw new TypeError("version must be a number")}else throw new Yb.ValueError("version is not defined");return{specVersion:r,expires:s,version:a,unrecognizedFields:n}}};mh.Signed=FK;function bUt(t){return!isNaN(Number(t))}});var Vb=L(kg=>{"use strict";var IFe=kg&&kg.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kg,"__esModule",{value:!0});kg.TargetFile=kg.MetaFile=void 0;var CFe=IFe(ye("crypto")),HO=IFe(ye("util")),xg=kA(),UO=Af(),NK=class t{constructor(e){if(e.version<=0)throw new xg.ValueError("Metafile version must be at least 1");e.length!==void 0&&wFe(e.length),this.version=e.version,this.length=e.length,this.hashes=e.hashes,this.unrecognizedFields=e.unrecognizedFields||{}}equals(e){return e instanceof t?this.version===e.version&&this.length===e.length&&HO.default.isDeepStrictEqual(this.hashes,e.hashes)&&HO.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields):!1}verify(e){if(this.length!==void 0&&e.length!==this.length)throw new xg.LengthOrHashMismatchError(`Expected length ${this.length} but got ${e.length}`);this.hashes&&Object.entries(this.hashes).forEach(([r,s])=>{let a;try{a=CFe.default.createHash(r)}catch{throw new xg.LengthOrHashMismatchError(`Hash algorithm ${r} not supported`)}let n=a.update(e).digest("hex");if(n!==s)throw new xg.LengthOrHashMismatchError(`Expected hash ${s} but got ${n}`)})}toJSON(){let e={version:this.version,...this.unrecognizedFields};return this.length!==void 0&&(e.length=this.length),this.hashes&&(e.hashes=this.hashes),e}static fromJSON(e){let{version:r,length:s,hashes:a,...n}=e;if(typeof r!="number")throw new TypeError("version must be a number");if(UO.guard.isDefined(s)&&typeof s!="number")throw new TypeError("length must be a number");if(UO.guard.isDefined(a)&&!UO.guard.isStringRecord(a))throw new TypeError("hashes must be string keys and values");return new t({version:r,length:s,hashes:a,unrecognizedFields:n})}};kg.MetaFile=NK;var OK=class t{constructor(e){wFe(e.length),this.length=e.length,this.path=e.path,this.hashes=e.hashes,this.unrecognizedFields=e.unrecognizedFields||{}}get custom(){let e=this.unrecognizedFields.custom;return!e||Array.isArray(e)||typeof e!="object"?{}:e}equals(e){return e instanceof t?this.length===e.length&&this.path===e.path&&HO.default.isDeepStrictEqual(this.hashes,e.hashes)&&HO.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields):!1}async verify(e){let r=0,s=Object.keys(this.hashes).reduce((a,n)=>{try{a[n]=CFe.default.createHash(n)}catch{throw new xg.LengthOrHashMismatchError(`Hash algorithm ${n} not supported`)}return a},{});for await(let a of e)r+=a.length,Object.values(s).forEach(n=>{n.update(a)});if(r!==this.length)throw new xg.LengthOrHashMismatchError(`Expected length ${this.length} but got ${r}`);Object.entries(s).forEach(([a,n])=>{let c=this.hashes[a],f=n.digest("hex");if(f!==c)throw new xg.LengthOrHashMismatchError(`Expected hash ${c} but got ${f}`)})}toJSON(){return{length:this.length,hashes:this.hashes,...this.unrecognizedFields}}static fromJSON(e,r){let{length:s,hashes:a,...n}=r;if(typeof s!="number")throw new TypeError("length must be a number");if(!UO.guard.isStringRecord(a))throw new TypeError("hashes must have string keys and values");return new t({length:s,path:e,hashes:a,unrecognizedFields:n})}};kg.TargetFile=OK;function wFe(t){if(t<0)throw new xg.ValueError("Length must be at least 0")}});var BFe=L(LK=>{"use strict";Object.defineProperty(LK,"__esModule",{value:!0});LK.encodeOIDString=xUt;var PUt=6;function xUt(t){let e=t.split("."),r=parseInt(e[0],10)*40+parseInt(e[1],10),s=[];e.slice(2).forEach(n=>{let c=kUt(parseInt(n,10));s.push(...c)});let a=Buffer.from([r,...s]);return Buffer.from([PUt,a.length,...a])}function kUt(t){let e=[],r=0;for(;t>0;)e.unshift(t&127|r),t>>=7,r=128;return e}});var bFe=L(Jb=>{"use strict";var QUt=Jb&&Jb.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jb,"__esModule",{value:!0});Jb.getPublicKey=NUt;var a1=QUt(ye("crypto")),Kb=kA(),MK=BFe(),jO=48,vFe=3,SFe=0,TUt="1.3.101.112",RUt="1.2.840.10045.2.1",FUt="1.2.840.10045.3.1.7",_K="-----BEGIN PUBLIC KEY-----";function NUt(t){switch(t.keyType){case"rsa":return OUt(t);case"ed25519":return LUt(t);case"ecdsa":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":return MUt(t);default:throw new Kb.UnsupportedAlgorithmError(`Unsupported key type: ${t.keyType}`)}}function OUt(t){if(!t.keyVal.startsWith(_K))throw new Kb.CryptoError("Invalid key format");let e=a1.default.createPublicKey(t.keyVal);switch(t.scheme){case"rsassa-pss-sha256":return{key:e,padding:a1.default.constants.RSA_PKCS1_PSS_PADDING};default:throw new Kb.UnsupportedAlgorithmError(`Unsupported RSA scheme: ${t.scheme}`)}}function LUt(t){let e;if(t.keyVal.startsWith(_K))e=a1.default.createPublicKey(t.keyVal);else{if(!DFe(t.keyVal))throw new Kb.CryptoError("Invalid key format");e=a1.default.createPublicKey({key:_Ut.hexToDER(t.keyVal),format:"der",type:"spki"})}return{key:e}}function MUt(t){let e;if(t.keyVal.startsWith(_K))e=a1.default.createPublicKey(t.keyVal);else{if(!DFe(t.keyVal))throw new Kb.CryptoError("Invalid key format");e=a1.default.createPublicKey({key:UUt.hexToDER(t.keyVal),format:"der",type:"spki"})}return{key:e}}var _Ut={hexToDER:t=>{let e=Buffer.from(t,"hex"),r=(0,MK.encodeOIDString)(TUt),s=Buffer.concat([Buffer.concat([Buffer.from([jO]),Buffer.from([r.length]),r]),Buffer.concat([Buffer.from([vFe]),Buffer.from([e.length+1]),Buffer.from([SFe]),e])]);return Buffer.concat([Buffer.from([jO]),Buffer.from([s.length]),s])}},UUt={hexToDER:t=>{let e=Buffer.from(t,"hex"),r=Buffer.concat([Buffer.from([vFe]),Buffer.from([e.length+1]),Buffer.from([SFe]),e]),s=Buffer.concat([(0,MK.encodeOIDString)(RUt),(0,MK.encodeOIDString)(FUt)]),a=Buffer.concat([Buffer.from([jO]),Buffer.from([s.length]),s]);return Buffer.concat([Buffer.from([jO]),Buffer.from([a.length+r.length]),a,r])}},DFe=t=>/^[0-9a-fA-F]+$/.test(t)});var qO=L(l1=>{"use strict";var HUt=l1&&l1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(l1,"__esModule",{value:!0});l1.Key=void 0;var PFe=HUt(ye("util")),zb=kA(),xFe=Af(),jUt=bFe(),UK=class t{constructor(e){let{keyID:r,keyType:s,scheme:a,keyVal:n,unrecognizedFields:c}=e;this.keyID=r,this.keyType=s,this.scheme=a,this.keyVal=n,this.unrecognizedFields=c||{}}verifySignature(e){let r=e.signatures[this.keyID];if(!r)throw new zb.UnsignedMetadataError("no signature for key found in metadata");if(!this.keyVal.public)throw new zb.UnsignedMetadataError("no public key found");let s=(0,jUt.getPublicKey)({keyType:this.keyType,scheme:this.scheme,keyVal:this.keyVal.public}),a=e.signed.toJSON();try{if(!xFe.crypto.verifySignature(a,s,r.sig))throw new zb.UnsignedMetadataError(`failed to verify ${this.keyID} signature`)}catch(n){throw n instanceof zb.UnsignedMetadataError?n:new zb.UnsignedMetadataError(`failed to verify ${this.keyID} signature`)}}equals(e){return e instanceof t?this.keyID===e.keyID&&this.keyType===e.keyType&&this.scheme===e.scheme&&PFe.default.isDeepStrictEqual(this.keyVal,e.keyVal)&&PFe.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields):!1}toJSON(){return{keytype:this.keyType,scheme:this.scheme,keyval:this.keyVal,...this.unrecognizedFields}}static fromJSON(e,r){let{keytype:s,scheme:a,keyval:n,...c}=r;if(typeof s!="string")throw new TypeError("keytype must be a string");if(typeof a!="string")throw new TypeError("scheme must be a string");if(!xFe.guard.isStringRecord(n))throw new TypeError("keyval must be a string record");return new t({keyID:e,keyType:s,scheme:a,keyVal:n,unrecognizedFields:c})}};l1.Key=UK});var FFe=L((Cwr,RFe)=>{"use strict";RFe.exports=QFe;function QFe(t,e,r){t instanceof RegExp&&(t=kFe(t,r)),e instanceof RegExp&&(e=kFe(e,r));var s=TFe(t,e,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+t.length,s[1]),post:r.slice(s[1]+e.length)}}function kFe(t,e){var r=e.match(t);return r?r[0]:null}QFe.range=TFe;function TFe(t,e,r){var s,a,n,c,f,p=r.indexOf(t),h=r.indexOf(e,p+1),E=p;if(p>=0&&h>0){for(s=[],n=r.length;E>=0&&!f;)E==p?(s.push(E),p=r.indexOf(t,E+1)):s.length==1?f=[s.pop(),h]:(a=s.pop(),a=0?p:h;s.length&&(f=[n,c])}return f}});var jFe=L((wwr,HFe)=>{var NFe=FFe();HFe.exports=WUt;var OFe="\0SLASH"+Math.random()+"\0",LFe="\0OPEN"+Math.random()+"\0",jK="\0CLOSE"+Math.random()+"\0",MFe="\0COMMA"+Math.random()+"\0",_Fe="\0PERIOD"+Math.random()+"\0";function HK(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function qUt(t){return t.split("\\\\").join(OFe).split("\\{").join(LFe).split("\\}").join(jK).split("\\,").join(MFe).split("\\.").join(_Fe)}function GUt(t){return t.split(OFe).join("\\").split(LFe).join("{").split(jK).join("}").split(MFe).join(",").split(_Fe).join(".")}function UFe(t){if(!t)return[""];var e=[],r=NFe("{","}",t);if(!r)return t.split(",");var s=r.pre,a=r.body,n=r.post,c=s.split(",");c[c.length-1]+="{"+a+"}";var f=UFe(n);return n.length&&(c[c.length-1]+=f.shift(),c.push.apply(c,f)),e.push.apply(e,c),e}function WUt(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Zb(qUt(t),!0).map(GUt)):[]}function YUt(t){return"{"+t+"}"}function VUt(t){return/^-?0\d/.test(t)}function KUt(t,e){return t<=e}function JUt(t,e){return t>=e}function Zb(t,e){var r=[],s=NFe("{","}",t);if(!s)return[t];var a=s.pre,n=s.post.length?Zb(s.post,!1):[""];if(/\$$/.test(s.pre))for(var c=0;c=0;if(!E&&!C)return s.post.match(/,.*\}/)?(t=s.pre+"{"+s.body+jK+s.post,Zb(t)):[t];var S;if(E)S=s.body.split(/\.\./);else if(S=UFe(s.body),S.length===1&&(S=Zb(S[0],!1).map(YUt),S.length===1))return n.map(function(Ce){return s.pre+S[0]+Ce});var P;if(E){var I=HK(S[0]),R=HK(S[1]),N=Math.max(S[0].length,S[1].length),U=S.length==3?Math.abs(HK(S[2])):1,W=KUt,te=R0){var pe=new Array(me+1).join("0");Ae<0?ce="-"+pe+ce.slice(1):ce=pe+ce}}P.push(ce)}}else{P=[];for(var Be=0;Be{"use strict";Object.defineProperty(GO,"__esModule",{value:!0});GO.assertValidPattern=void 0;var zUt=1024*64,ZUt=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>zUt)throw new TypeError("pattern is too long")};GO.assertValidPattern=ZUt});var WFe=L(WO=>{"use strict";Object.defineProperty(WO,"__esModule",{value:!0});WO.parseClass=void 0;var XUt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Xb=t=>t.replace(/[[\]\\-]/g,"\\$&"),$Ut=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),GFe=t=>t.join(""),e4t=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let s=[],a=[],n=r+1,c=!1,f=!1,p=!1,h=!1,E=r,C="";e:for(;nC?s.push(Xb(C)+"-"+Xb(R)):R===C&&s.push(Xb(R)),C="",n++;continue}if(t.startsWith("-]",n+1)){s.push(Xb(R+"-")),n+=2;continue}if(t.startsWith("-",n+1)){C=R,n+=2;continue}s.push(Xb(R)),n++}if(E{"use strict";Object.defineProperty(YO,"__esModule",{value:!0});YO.unescape=void 0;var t4t=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");YO.unescape=t4t});var WK=L(zO=>{"use strict";Object.defineProperty(zO,"__esModule",{value:!0});zO.AST=void 0;var r4t=WFe(),KO=VO(),n4t=new Set(["!","?","+","*","@"]),YFe=t=>n4t.has(t),i4t="(?!(?:^|/)\\.\\.?(?:$|/))",JO="(?!\\.)",s4t=new Set(["[","."]),o4t=new Set(["..","."]),a4t=new Set("().*{}+?[]^$\\!"),l4t=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),GK="[^/]",VFe=GK+"*?",KFe=GK+"+?",qK=class t{type;#t;#r;#i=!1;#e=[];#n;#o;#l;#a=!1;#s;#c;#f=!1;constructor(e,r,s={}){this.type=e,e&&(this.#r=!0),this.#n=r,this.#t=this.#n?this.#n.#t:this,this.#s=this.#t===this?s:this.#t.#s,this.#l=this.#t===this?[]:this.#t.#l,e==="!"&&!this.#t.#a&&this.#l.push(this),this.#o=this.#n?this.#n.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#c=this.#e.map(e=>String(e)).join("")}#p(){if(this!==this.#t)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let e;for(;e=this.#l.pop();){if(e.type!=="!")continue;let r=e,s=r.#n;for(;s;){for(let a=r.#o+1;!s.type&&atypeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#a&&this.#n?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#n?.isStart())return!1;if(this.#o===0)return!0;let e=this.#n;for(let r=0;r{let[I,R,N,U]=typeof P=="string"?t.#h(P,this.#r,p):P.toRegExpSource(e);return this.#r=this.#r||N,this.#i=this.#i||U,I}).join(""),E="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&o4t.has(this.#e[0]))){let I=s4t,R=r&&I.has(h.charAt(0))||h.startsWith("\\.")&&I.has(h.charAt(2))||h.startsWith("\\.\\.")&&I.has(h.charAt(4)),N=!r&&!e&&I.has(h.charAt(0));E=R?i4t:N?JO:""}let C="";return this.isEnd()&&this.#t.#a&&this.#n?.type==="!"&&(C="(?:$|\\/)"),[E+h+C,(0,KO.unescape)(h),this.#r=!!this.#r,this.#i]}let s=this.type==="*"||this.type==="+",a=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#A(r);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let p=this.toString();return this.#e=[p],this.type=null,this.#r=void 0,[p,(0,KO.unescape)(this.toString()),!1,!1]}let c=!s||e||r||!JO?"":this.#A(!0);c===n&&(c=""),c&&(n=`(?:${n})(?:${c})*?`);let f="";if(this.type==="!"&&this.#f)f=(this.isStart()&&!r?JO:"")+KFe;else{let p=this.type==="!"?"))"+(this.isStart()&&!r&&!e?JO:"")+VFe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&c?")":this.type==="*"&&c?")?":`)${this.type}`;f=a+n+p}return[f,(0,KO.unescape)(n),this.#r=!!this.#r,this.#i]}#A(e){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[s,a,n,c]=r.toRegExpSource(e);return this.#i=this.#i||c,s}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#h(e,r,s=!1){let a=!1,n="",c=!1;for(let f=0;f{"use strict";Object.defineProperty(ZO,"__esModule",{value:!0});ZO.escape=void 0;var c4t=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");ZO.escape=c4t});var tNe=L(pr=>{"use strict";var u4t=pr&&pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pr,"__esModule",{value:!0});pr.unescape=pr.escape=pr.AST=pr.Minimatch=pr.match=pr.makeRe=pr.braceExpand=pr.defaults=pr.filter=pr.GLOBSTAR=pr.sep=pr.minimatch=void 0;var f4t=u4t(jFe()),XO=qFe(),ZFe=WK(),A4t=YK(),p4t=VO(),h4t=(t,e,r={})=>((0,XO.assertValidPattern)(e),!r.nocomment&&e.charAt(0)==="#"?!1:new cy(e,r).match(t));pr.minimatch=h4t;var g4t=/^\*+([^+@!?\*\[\(]*)$/,d4t=t=>e=>!e.startsWith(".")&&e.endsWith(t),m4t=t=>e=>e.endsWith(t),y4t=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),E4t=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),I4t=/^\*+\.\*+$/,C4t=t=>!t.startsWith(".")&&t.includes("."),w4t=t=>t!=="."&&t!==".."&&t.includes("."),B4t=/^\.\*+$/,v4t=t=>t!=="."&&t!==".."&&t.startsWith("."),S4t=/^\*+$/,D4t=t=>t.length!==0&&!t.startsWith("."),b4t=t=>t.length!==0&&t!=="."&&t!=="..",P4t=/^\?+([^+@!?\*\[\(]*)?$/,x4t=([t,e=""])=>{let r=XFe([t]);return e?(e=e.toLowerCase(),s=>r(s)&&s.toLowerCase().endsWith(e)):r},k4t=([t,e=""])=>{let r=$Fe([t]);return e?(e=e.toLowerCase(),s=>r(s)&&s.toLowerCase().endsWith(e)):r},Q4t=([t,e=""])=>{let r=$Fe([t]);return e?s=>r(s)&&s.endsWith(e):r},T4t=([t,e=""])=>{let r=XFe([t]);return e?s=>r(s)&&s.endsWith(e):r},XFe=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},$Fe=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},eNe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",JFe={win32:{sep:"\\"},posix:{sep:"/"}};pr.sep=eNe==="win32"?JFe.win32.sep:JFe.posix.sep;pr.minimatch.sep=pr.sep;pr.GLOBSTAR=Symbol("globstar **");pr.minimatch.GLOBSTAR=pr.GLOBSTAR;var R4t="[^/]",F4t=R4t+"*?",N4t="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",O4t="(?:(?!(?:\\/|^)\\.).)*?",L4t=(t,e={})=>r=>(0,pr.minimatch)(r,t,e);pr.filter=L4t;pr.minimatch.filter=pr.filter;var nu=(t,e={})=>Object.assign({},t,e),M4t=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return pr.minimatch;let e=pr.minimatch;return Object.assign((s,a,n={})=>e(s,a,nu(t,n)),{Minimatch:class extends e.Minimatch{constructor(a,n={}){super(a,nu(t,n))}static defaults(a){return e.defaults(nu(t,a)).Minimatch}},AST:class extends e.AST{constructor(a,n,c={}){super(a,n,nu(t,c))}static fromGlob(a,n={}){return e.AST.fromGlob(a,nu(t,n))}},unescape:(s,a={})=>e.unescape(s,nu(t,a)),escape:(s,a={})=>e.escape(s,nu(t,a)),filter:(s,a={})=>e.filter(s,nu(t,a)),defaults:s=>e.defaults(nu(t,s)),makeRe:(s,a={})=>e.makeRe(s,nu(t,a)),braceExpand:(s,a={})=>e.braceExpand(s,nu(t,a)),match:(s,a,n={})=>e.match(s,a,nu(t,n)),sep:e.sep,GLOBSTAR:pr.GLOBSTAR})};pr.defaults=M4t;pr.minimatch.defaults=pr.defaults;var _4t=(t,e={})=>((0,XO.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,f4t.default)(t));pr.braceExpand=_4t;pr.minimatch.braceExpand=pr.braceExpand;var U4t=(t,e={})=>new cy(t,e).makeRe();pr.makeRe=U4t;pr.minimatch.makeRe=pr.makeRe;var H4t=(t,e,r={})=>{let s=new cy(e,r);return t=t.filter(a=>s.match(a)),s.options.nonull&&!t.length&&t.push(e),t};pr.match=H4t;pr.minimatch.match=pr.match;var zFe=/[?*]|[+@!]\(.*?\)|\[|\]/,j4t=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),cy=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,r={}){(0,XO.assertValidPattern)(e),r=r||{},this.options=r,this.pattern=e,this.platform=r.platform||eNe,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let a=this.globParts.map((n,c,f)=>{if(this.isWindows&&this.windowsNoMagicRoot){let p=n[0]===""&&n[1]===""&&(n[2]==="?"||!zFe.test(n[2]))&&!zFe.test(n[3]),h=/^[a-z]:/i.test(n[0]);if(p)return[...n.slice(0,4),...n.slice(4).map(E=>this.parse(E))];if(h)return[n[0],...n.slice(1).map(E=>this.parse(E))]}return n.map(p=>this.parse(p))});if(this.debug(this.pattern,a),this.set=a.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let s=-1;for(;(s=r.indexOf("**",s+1))!==-1;){let a=s;for(;r[a+1]==="**";)a++;a!==s&&r.splice(s,a-s)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((s,a)=>{let n=s[s.length-1];return a==="**"&&n==="**"?s:a===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(s.pop(),s):(s.push(a),s)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let a=1;aa&&s.splice(a+1,c-a);let f=s[a+1],p=s[a+2],h=s[a+3];if(f!==".."||!p||p==="."||p===".."||!h||h==="."||h==="..")continue;r=!0,s.splice(a,1);let E=s.slice(0);E[a]="**",e.push(E),a--}if(!this.preserveMultipleSlashes){for(let c=1;cr.length)}partsMatch(e,r,s=!1){let a=0,n=0,c=[],f="";for(;ate?r=r.slice(ie):te>ie&&(e=e.slice(te)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var c=0,f=0,p=e.length,h=r.length;c>> no match, partial?`,e,S,r,P),S===p))}let R;if(typeof E=="string"?(R=C===E,this.debug("string match",E,C,R)):(R=E.test(C),this.debug("pattern match",E,C,R)),!R)return!1}if(c===p&&f===h)return!0;if(c===p)return s;if(f===h)return c===p-1&&e[c]==="";throw new Error("wtf?")}braceExpand(){return(0,pr.braceExpand)(this.pattern,this.options)}parse(e){(0,XO.assertValidPattern)(e);let r=this.options;if(e==="**")return pr.GLOBSTAR;if(e==="")return"";let s,a=null;(s=e.match(S4t))?a=r.dot?b4t:D4t:(s=e.match(g4t))?a=(r.nocase?r.dot?E4t:y4t:r.dot?m4t:d4t)(s[1]):(s=e.match(P4t))?a=(r.nocase?r.dot?k4t:x4t:r.dot?Q4t:T4t)(s):(s=e.match(I4t))?a=r.dot?w4t:C4t:(s=e.match(B4t))&&(a=v4t);let n=ZFe.AST.fromGlob(e,this.options).toMMPattern();return a&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:a}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,s=r.noglobstar?F4t:r.dot?N4t:O4t,a=new Set(r.nocase?["i"]:[]),n=e.map(p=>{let h=p.map(E=>{if(E instanceof RegExp)for(let C of E.flags.split(""))a.add(C);return typeof E=="string"?j4t(E):E===pr.GLOBSTAR?pr.GLOBSTAR:E._src});return h.forEach((E,C)=>{let S=h[C+1],P=h[C-1];E!==pr.GLOBSTAR||P===pr.GLOBSTAR||(P===void 0?S!==void 0&&S!==pr.GLOBSTAR?h[C+1]="(?:\\/|"+s+"\\/)?"+S:h[C]=s:S===void 0?h[C-1]=P+"(?:\\/|"+s+")?":S!==pr.GLOBSTAR&&(h[C-1]=P+"(?:\\/|\\/"+s+"\\/)"+S,h[C+1]=pr.GLOBSTAR))}),h.filter(E=>E!==pr.GLOBSTAR).join("/")}).join("|"),[c,f]=e.length>1?["(?:",")"]:["",""];n="^"+c+n+f+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...a].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let a=this.slashSplit(e);this.debug(this.pattern,"split",a);let n=this.set;this.debug(this.pattern,"set",n);let c=a[a.length-1];if(!c)for(let f=a.length-2;!c&&f>=0;f--)c=a[f];for(let f=0;f{"use strict";var rNe=iu&&iu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iu,"__esModule",{value:!0});iu.SuccinctRoles=iu.DelegatedRole=iu.Role=iu.TOP_LEVEL_ROLE_NAMES=void 0;var nNe=rNe(ye("crypto")),Y4t=tNe(),$O=rNe(ye("util")),eL=kA(),uy=Af();iu.TOP_LEVEL_ROLE_NAMES=["root","targets","snapshot","timestamp"];var $b=class t{constructor(e){let{keyIDs:r,threshold:s,unrecognizedFields:a}=e;if(V4t(r))throw new eL.ValueError("duplicate key IDs found");if(s<1)throw new eL.ValueError("threshold must be at least 1");this.keyIDs=r,this.threshold=s,this.unrecognizedFields=a||{}}equals(e){return e instanceof t?this.threshold===e.threshold&&$O.default.isDeepStrictEqual(this.keyIDs,e.keyIDs)&&$O.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields):!1}toJSON(){return{keyids:this.keyIDs,threshold:this.threshold,...this.unrecognizedFields}}static fromJSON(e){let{keyids:r,threshold:s,...a}=e;if(!uy.guard.isStringArray(r))throw new TypeError("keyids must be an array");if(typeof s!="number")throw new TypeError("threshold must be a number");return new t({keyIDs:r,threshold:s,unrecognizedFields:a})}};iu.Role=$b;function V4t(t){return new Set(t).size!==t.length}var VK=class t extends $b{constructor(e){super(e);let{name:r,terminating:s,paths:a,pathHashPrefixes:n}=e;if(this.name=r,this.terminating=s,e.paths&&e.pathHashPrefixes)throw new eL.ValueError("paths and pathHashPrefixes are mutually exclusive");this.paths=a,this.pathHashPrefixes=n}equals(e){return e instanceof t?super.equals(e)&&this.name===e.name&&this.terminating===e.terminating&&$O.default.isDeepStrictEqual(this.paths,e.paths)&&$O.default.isDeepStrictEqual(this.pathHashPrefixes,e.pathHashPrefixes):!1}isDelegatedPath(e){if(this.paths)return this.paths.some(r=>J4t(e,r));if(this.pathHashPrefixes){let s=nNe.default.createHash("sha256").update(e).digest("hex");return this.pathHashPrefixes.some(a=>s.startsWith(a))}return!1}toJSON(){let e={...super.toJSON(),name:this.name,terminating:this.terminating};return this.paths&&(e.paths=this.paths),this.pathHashPrefixes&&(e.path_hash_prefixes=this.pathHashPrefixes),e}static fromJSON(e){let{keyids:r,threshold:s,name:a,terminating:n,paths:c,path_hash_prefixes:f,...p}=e;if(!uy.guard.isStringArray(r))throw new TypeError("keyids must be an array of strings");if(typeof s!="number")throw new TypeError("threshold must be a number");if(typeof a!="string")throw new TypeError("name must be a string");if(typeof n!="boolean")throw new TypeError("terminating must be a boolean");if(uy.guard.isDefined(c)&&!uy.guard.isStringArray(c))throw new TypeError("paths must be an array of strings");if(uy.guard.isDefined(f)&&!uy.guard.isStringArray(f))throw new TypeError("path_hash_prefixes must be an array of strings");return new t({keyIDs:r,threshold:s,name:a,terminating:n,paths:c,pathHashPrefixes:f,unrecognizedFields:p})}};iu.DelegatedRole=VK;var K4t=(t,e)=>t.map((r,s)=>[r,e[s]]);function J4t(t,e){let r=t.split("/"),s=e.split("/");return s.length!=r.length?!1:K4t(r,s).every(([a,n])=>(0,Y4t.minimatch)(a,n))}var KK=class t extends $b{constructor(e){super(e);let{bitLength:r,namePrefix:s}=e;if(r<=0||r>32)throw new eL.ValueError("bitLength must be between 1 and 32");this.bitLength=r,this.namePrefix=s,this.numberOfBins=Math.pow(2,r),this.suffixLen=(this.numberOfBins-1).toString(16).length}equals(e){return e instanceof t?super.equals(e)&&this.bitLength===e.bitLength&&this.namePrefix===e.namePrefix:!1}getRoleForTarget(e){let a=nNe.default.createHash("sha256").update(e).digest().subarray(0,4),n=32-this.bitLength,f=(a.readUInt32BE()>>>n).toString(16).padStart(this.suffixLen,"0");return`${this.namePrefix}-${f}`}*getRoles(){for(let e=0;e{"use strict";var z4t=c1&&c1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(c1,"__esModule",{value:!0});c1.Root=void 0;var iNe=z4t(ye("util")),zK=ly(),sNe=kA(),Z4t=qO(),tL=JK(),rL=Af(),ZK=class t extends zK.Signed{constructor(e){if(super(e),this.type=zK.MetadataKind.Root,this.keys=e.keys||{},this.consistentSnapshot=e.consistentSnapshot??!0,!e.roles)this.roles=tL.TOP_LEVEL_ROLE_NAMES.reduce((r,s)=>({...r,[s]:new tL.Role({keyIDs:[],threshold:1})}),{});else{let r=new Set(Object.keys(e.roles));if(!tL.TOP_LEVEL_ROLE_NAMES.every(s=>r.has(s)))throw new sNe.ValueError("missing top-level role");this.roles=e.roles}}addKey(e,r){if(!this.roles[r])throw new sNe.ValueError(`role ${r} does not exist`);this.roles[r].keyIDs.includes(e.keyID)||this.roles[r].keyIDs.push(e.keyID),this.keys[e.keyID]=e}equals(e){return e instanceof t?super.equals(e)&&this.consistentSnapshot===e.consistentSnapshot&&iNe.default.isDeepStrictEqual(this.keys,e.keys)&&iNe.default.isDeepStrictEqual(this.roles,e.roles):!1}toJSON(){return{_type:this.type,spec_version:this.specVersion,version:this.version,expires:this.expires,keys:X4t(this.keys),roles:$4t(this.roles),consistent_snapshot:this.consistentSnapshot,...this.unrecognizedFields}}static fromJSON(e){let{unrecognizedFields:r,...s}=zK.Signed.commonFieldsFromJSON(e),{keys:a,roles:n,consistent_snapshot:c,...f}=r;if(typeof c!="boolean")throw new TypeError("consistent_snapshot must be a boolean");return new t({...s,keys:e3t(a),roles:t3t(n),consistentSnapshot:c,unrecognizedFields:f})}};c1.Root=ZK;function X4t(t){return Object.entries(t).reduce((e,[r,s])=>({...e,[r]:s.toJSON()}),{})}function $4t(t){return Object.entries(t).reduce((e,[r,s])=>({...e,[r]:s.toJSON()}),{})}function e3t(t){let e;if(rL.guard.isDefined(t)){if(!rL.guard.isObjectRecord(t))throw new TypeError("keys must be an object");e=Object.entries(t).reduce((r,[s,a])=>({...r,[s]:Z4t.Key.fromJSON(s,a)}),{})}return e}function t3t(t){let e;if(rL.guard.isDefined(t)){if(!rL.guard.isObjectRecord(t))throw new TypeError("roles must be an object");e=Object.entries(t).reduce((r,[s,a])=>({...r,[s]:tL.Role.fromJSON(a)}),{})}return e}});var eJ=L(nL=>{"use strict";Object.defineProperty(nL,"__esModule",{value:!0});nL.Signature=void 0;var $K=class t{constructor(e){let{keyID:r,sig:s}=e;this.keyID=r,this.sig=s}toJSON(){return{keyid:this.keyID,sig:this.sig}}static fromJSON(e){let{keyid:r,sig:s}=e;if(typeof r!="string")throw new TypeError("keyid must be a string");if(typeof s!="string")throw new TypeError("sig must be a string");return new t({keyID:r,sig:s})}};nL.Signature=$K});var nJ=L(u1=>{"use strict";var r3t=u1&&u1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(u1,"__esModule",{value:!0});u1.Snapshot=void 0;var n3t=r3t(ye("util")),tJ=ly(),aNe=Vb(),oNe=Af(),rJ=class t extends tJ.Signed{constructor(e){super(e),this.type=tJ.MetadataKind.Snapshot,this.meta=e.meta||{"targets.json":new aNe.MetaFile({version:1})}}equals(e){return e instanceof t?super.equals(e)&&n3t.default.isDeepStrictEqual(this.meta,e.meta):!1}toJSON(){return{_type:this.type,meta:i3t(this.meta),spec_version:this.specVersion,version:this.version,expires:this.expires,...this.unrecognizedFields}}static fromJSON(e){let{unrecognizedFields:r,...s}=tJ.Signed.commonFieldsFromJSON(e),{meta:a,...n}=r;return new t({...s,meta:s3t(a),unrecognizedFields:n})}};u1.Snapshot=rJ;function i3t(t){return Object.entries(t).reduce((e,[r,s])=>({...e,[r]:s.toJSON()}),{})}function s3t(t){let e;if(oNe.guard.isDefined(t))if(oNe.guard.isObjectRecord(t))e=Object.entries(t).reduce((r,[s,a])=>({...r,[s]:aNe.MetaFile.fromJSON(a)}),{});else throw new TypeError("meta field is malformed");return e}});var lNe=L(f1=>{"use strict";var o3t=f1&&f1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(f1,"__esModule",{value:!0});f1.Delegations=void 0;var iL=o3t(ye("util")),a3t=kA(),l3t=qO(),iJ=JK(),sL=Af(),sJ=class t{constructor(e){if(this.keys=e.keys,this.unrecognizedFields=e.unrecognizedFields||{},e.roles&&Object.keys(e.roles).some(r=>iJ.TOP_LEVEL_ROLE_NAMES.includes(r)))throw new a3t.ValueError("Delegated role name conflicts with top-level role name");this.succinctRoles=e.succinctRoles,this.roles=e.roles}equals(e){return e instanceof t?iL.default.isDeepStrictEqual(this.keys,e.keys)&&iL.default.isDeepStrictEqual(this.roles,e.roles)&&iL.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields)&&iL.default.isDeepStrictEqual(this.succinctRoles,e.succinctRoles):!1}*rolesForTarget(e){if(this.roles)for(let r of Object.values(this.roles))r.isDelegatedPath(e)&&(yield{role:r.name,terminating:r.terminating});else this.succinctRoles&&(yield{role:this.succinctRoles.getRoleForTarget(e),terminating:!0})}toJSON(){let e={keys:c3t(this.keys),...this.unrecognizedFields};return this.roles?e.roles=u3t(this.roles):this.succinctRoles&&(e.succinct_roles=this.succinctRoles.toJSON()),e}static fromJSON(e){let{keys:r,roles:s,succinct_roles:a,...n}=e,c;return sL.guard.isObject(a)&&(c=iJ.SuccinctRoles.fromJSON(a)),new t({keys:f3t(r),roles:A3t(s),unrecognizedFields:n,succinctRoles:c})}};f1.Delegations=sJ;function c3t(t){return Object.entries(t).reduce((e,[r,s])=>({...e,[r]:s.toJSON()}),{})}function u3t(t){return Object.values(t).map(e=>e.toJSON())}function f3t(t){if(!sL.guard.isObjectRecord(t))throw new TypeError("keys is malformed");return Object.entries(t).reduce((e,[r,s])=>({...e,[r]:l3t.Key.fromJSON(r,s)}),{})}function A3t(t){let e;if(sL.guard.isDefined(t)){if(!sL.guard.isObjectArray(t))throw new TypeError("roles is malformed");e=t.reduce((r,s)=>{let a=iJ.DelegatedRole.fromJSON(s);return{...r,[a.name]:a}},{})}return e}});var lJ=L(A1=>{"use strict";var p3t=A1&&A1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(A1,"__esModule",{value:!0});A1.Targets=void 0;var cNe=p3t(ye("util")),oJ=ly(),h3t=lNe(),g3t=Vb(),oL=Af(),aJ=class t extends oJ.Signed{constructor(e){super(e),this.type=oJ.MetadataKind.Targets,this.targets=e.targets||{},this.delegations=e.delegations}addTarget(e){this.targets[e.path]=e}equals(e){return e instanceof t?super.equals(e)&&cNe.default.isDeepStrictEqual(this.targets,e.targets)&&cNe.default.isDeepStrictEqual(this.delegations,e.delegations):!1}toJSON(){let e={_type:this.type,spec_version:this.specVersion,version:this.version,expires:this.expires,targets:d3t(this.targets),...this.unrecognizedFields};return this.delegations&&(e.delegations=this.delegations.toJSON()),e}static fromJSON(e){let{unrecognizedFields:r,...s}=oJ.Signed.commonFieldsFromJSON(e),{targets:a,delegations:n,...c}=r;return new t({...s,targets:m3t(a),delegations:y3t(n),unrecognizedFields:c})}};A1.Targets=aJ;function d3t(t){return Object.entries(t).reduce((e,[r,s])=>({...e,[r]:s.toJSON()}),{})}function m3t(t){let e;if(oL.guard.isDefined(t))if(oL.guard.isObjectRecord(t))e=Object.entries(t).reduce((r,[s,a])=>({...r,[s]:g3t.TargetFile.fromJSON(s,a)}),{});else throw new TypeError("targets must be an object");return e}function y3t(t){let e;if(oL.guard.isDefined(t))if(oL.guard.isObject(t))e=h3t.Delegations.fromJSON(t);else throw new TypeError("delegations must be an object");return e}});var AJ=L(aL=>{"use strict";Object.defineProperty(aL,"__esModule",{value:!0});aL.Timestamp=void 0;var cJ=ly(),uNe=Vb(),uJ=Af(),fJ=class t extends cJ.Signed{constructor(e){super(e),this.type=cJ.MetadataKind.Timestamp,this.snapshotMeta=e.snapshotMeta||new uNe.MetaFile({version:1})}equals(e){return e instanceof t?super.equals(e)&&this.snapshotMeta.equals(e.snapshotMeta):!1}toJSON(){return{_type:this.type,spec_version:this.specVersion,version:this.version,expires:this.expires,meta:{"snapshot.json":this.snapshotMeta.toJSON()},...this.unrecognizedFields}}static fromJSON(e){let{unrecognizedFields:r,...s}=cJ.Signed.commonFieldsFromJSON(e),{meta:a,...n}=r;return new t({...s,snapshotMeta:E3t(a),unrecognizedFields:n})}};aL.Timestamp=fJ;function E3t(t){let e;if(uJ.guard.isDefined(t)){let r=t["snapshot.json"];if(!uJ.guard.isDefined(r)||!uJ.guard.isObject(r))throw new TypeError("missing snapshot.json in meta");e=uNe.MetaFile.fromJSON(r)}return e}});var ANe=L(h1=>{"use strict";var I3t=h1&&h1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(h1,"__esModule",{value:!0});h1.Metadata=void 0;var C3t=QK(),fNe=I3t(ye("util")),p1=ly(),eP=kA(),w3t=XK(),B3t=eJ(),v3t=nJ(),S3t=lJ(),D3t=AJ(),pJ=Af(),hJ=class t{constructor(e,r,s){this.signed=e,this.signatures=r||{},this.unrecognizedFields=s||{}}sign(e,r=!0){let s=Buffer.from((0,C3t.canonicalize)(this.signed.toJSON())),a=e(s);r||(this.signatures={}),this.signatures[a.keyID]=a}verifyDelegate(e,r){let s,a={};switch(this.signed.type){case p1.MetadataKind.Root:a=this.signed.keys,s=this.signed.roles[e];break;case p1.MetadataKind.Targets:if(!this.signed.delegations)throw new eP.ValueError(`No delegations found for ${e}`);a=this.signed.delegations.keys,this.signed.delegations.roles?s=this.signed.delegations.roles[e]:this.signed.delegations.succinctRoles&&this.signed.delegations.succinctRoles.isDelegatedRole(e)&&(s=this.signed.delegations.succinctRoles);break;default:throw new TypeError("invalid metadata type")}if(!s)throw new eP.ValueError(`no delegation found for ${e}`);let n=new Set;if(s.keyIDs.forEach(c=>{let f=a[c];if(f)try{f.verifySignature(r),n.add(f.keyID)}catch{}}),n.sizer.toJSON()),signed:this.signed.toJSON(),...this.unrecognizedFields}}static fromJSON(e,r){let{signed:s,signatures:a,...n}=r;if(!pJ.guard.isDefined(s)||!pJ.guard.isObject(s))throw new TypeError("signed is not defined");if(e!==s._type)throw new eP.ValueError(`expected '${e}', got ${s._type}`);if(!pJ.guard.isObjectArray(a))throw new TypeError("signatures is not an array");let c;switch(e){case p1.MetadataKind.Root:c=w3t.Root.fromJSON(s);break;case p1.MetadataKind.Timestamp:c=D3t.Timestamp.fromJSON(s);break;case p1.MetadataKind.Snapshot:c=v3t.Snapshot.fromJSON(s);break;case p1.MetadataKind.Targets:c=S3t.Targets.fromJSON(s);break;default:throw new TypeError("invalid metadata type")}let f={};return a.forEach(p=>{let h=B3t.Signature.fromJSON(p);if(f[h.keyID])throw new eP.ValueError(`multiple signatures found for keyid: ${h.keyID}`);f[h.keyID]=h}),new t(c,f,n)}};h1.Metadata=hJ});var lL=L(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.Timestamp=Ri.Targets=Ri.Snapshot=Ri.Signature=Ri.Root=Ri.Metadata=Ri.Key=Ri.TargetFile=Ri.MetaFile=Ri.ValueError=Ri.MetadataKind=void 0;var b3t=ly();Object.defineProperty(Ri,"MetadataKind",{enumerable:!0,get:function(){return b3t.MetadataKind}});var P3t=kA();Object.defineProperty(Ri,"ValueError",{enumerable:!0,get:function(){return P3t.ValueError}});var pNe=Vb();Object.defineProperty(Ri,"MetaFile",{enumerable:!0,get:function(){return pNe.MetaFile}});Object.defineProperty(Ri,"TargetFile",{enumerable:!0,get:function(){return pNe.TargetFile}});var x3t=qO();Object.defineProperty(Ri,"Key",{enumerable:!0,get:function(){return x3t.Key}});var k3t=ANe();Object.defineProperty(Ri,"Metadata",{enumerable:!0,get:function(){return k3t.Metadata}});var Q3t=XK();Object.defineProperty(Ri,"Root",{enumerable:!0,get:function(){return Q3t.Root}});var T3t=eJ();Object.defineProperty(Ri,"Signature",{enumerable:!0,get:function(){return T3t.Signature}});var R3t=nJ();Object.defineProperty(Ri,"Snapshot",{enumerable:!0,get:function(){return R3t.Snapshot}});var F3t=lJ();Object.defineProperty(Ri,"Targets",{enumerable:!0,get:function(){return F3t.Targets}});var N3t=AJ();Object.defineProperty(Ri,"Timestamp",{enumerable:!0,get:function(){return N3t.Timestamp}})});var gNe=L((Uwr,hNe)=>{var g1=1e3,d1=g1*60,m1=d1*60,fy=m1*24,O3t=fy*7,L3t=fy*365.25;hNe.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return M3t(t);if(r==="number"&&isFinite(t))return e.long?U3t(t):_3t(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function M3t(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return r*L3t;case"weeks":case"week":case"w":return r*O3t;case"days":case"day":case"d":return r*fy;case"hours":case"hour":case"hrs":case"hr":case"h":return r*m1;case"minutes":case"minute":case"mins":case"min":case"m":return r*d1;case"seconds":case"second":case"secs":case"sec":case"s":return r*g1;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function _3t(t){var e=Math.abs(t);return e>=fy?Math.round(t/fy)+"d":e>=m1?Math.round(t/m1)+"h":e>=d1?Math.round(t/d1)+"m":e>=g1?Math.round(t/g1)+"s":t+"ms"}function U3t(t){var e=Math.abs(t);return e>=fy?cL(t,e,fy,"day"):e>=m1?cL(t,e,m1,"hour"):e>=d1?cL(t,e,d1,"minute"):e>=g1?cL(t,e,g1,"second"):t+" ms"}function cL(t,e,r,s){var a=e>=r*1.5;return Math.round(t/r)+" "+s+(a?"s":"")}});var gJ=L((Hwr,dNe)=>{function H3t(t){r.debug=r,r.default=r,r.coerce=p,r.disable=c,r.enable=a,r.enabled=f,r.humanize=gNe(),r.destroy=h,Object.keys(t).forEach(E=>{r[E]=t[E]}),r.names=[],r.skips=[],r.formatters={};function e(E){let C=0;for(let S=0;S{if(ce==="%%")return"%";ie++;let pe=r.formatters[me];if(typeof pe=="function"){let Be=N[ie];ce=pe.call(U,Be),N.splice(ie,1),ie--}return ce}),r.formatArgs.call(U,N),(U.log||r.log).apply(U,N)}return R.namespace=E,R.useColors=r.useColors(),R.color=r.selectColor(E),R.extend=s,R.destroy=r.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>S!==null?S:(P!==r.namespaces&&(P=r.namespaces,I=r.enabled(E)),I),set:N=>{S=N}}),typeof r.init=="function"&&r.init(R),R}function s(E,C){let S=r(this.namespace+(typeof C>"u"?":":C)+E);return S.log=this.log,S}function a(E){r.save(E),r.namespaces=E,r.names=[],r.skips=[];let C=(typeof E=="string"?E:"").trim().replace(" ",",").split(",").filter(Boolean);for(let S of C)S[0]==="-"?r.skips.push(S.slice(1)):r.names.push(S)}function n(E,C){let S=0,P=0,I=-1,R=0;for(;S"-"+C)].join(",");return r.enable(""),E}function f(E){for(let C of r.skips)if(n(E,C))return!1;for(let C of r.names)if(n(E,C))return!0;return!1}function p(E){return E instanceof Error?E.stack||E.message:E}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}dNe.exports=H3t});var mNe=L((oc,uL)=>{oc.formatArgs=q3t;oc.save=G3t;oc.load=W3t;oc.useColors=j3t;oc.storage=Y3t();oc.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();oc.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function j3t(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function q3t(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+uL.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(r++,a==="%c"&&(s=r))}),t.splice(s,0,e)}oc.log=console.debug||console.log||(()=>{});function G3t(t){try{t?oc.storage.setItem("debug",t):oc.storage.removeItem("debug")}catch{}}function W3t(){let t;try{t=oc.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Y3t(){try{return localStorage}catch{}}uL.exports=gJ()(oc);var{formatters:V3t}=uL.exports;V3t.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ENe=L(($s,AL)=>{var K3t=ye("tty"),fL=ye("util");$s.init=t8t;$s.log=X3t;$s.formatArgs=z3t;$s.save=$3t;$s.load=e8t;$s.useColors=J3t;$s.destroy=fL.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");$s.colors=[6,2,3,4,5,1];try{let t=ye("supports-color");t&&(t.stderr||t).level>=2&&($s.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}$s.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(a,n)=>n.toUpperCase()),s=process.env[e];return/^(yes|on|true|enabled)$/i.test(s)?s=!0:/^(no|off|false|disabled)$/i.test(s)?s=!1:s==="null"?s=null:s=Number(s),t[r]=s,t},{});function J3t(){return"colors"in $s.inspectOpts?!!$s.inspectOpts.colors:K3t.isatty(process.stderr.fd)}function z3t(t){let{namespace:e,useColors:r}=this;if(r){let s=this.color,a="\x1B[3"+(s<8?s:"8;5;"+s),n=` ${a};1m${e} \x1B[0m`;t[0]=n+t[0].split(` +`).join(` +`+n),t.push(a+"m+"+AL.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Z3t()+e+" "+t[0]}function Z3t(){return $s.inspectOpts.hideDate?"":new Date().toISOString()+" "}function X3t(...t){return process.stderr.write(fL.formatWithOptions($s.inspectOpts,...t)+` +`)}function $3t(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function e8t(){return process.env.DEBUG}function t8t(t){t.inspectOpts={};let e=Object.keys($s.inspectOpts);for(let r=0;re.trim()).join(" ")};yNe.O=function(t){return this.inspectOpts.colors=this.useColors,fL.inspect(t,this.inspectOpts)}});var mJ=L((jwr,dJ)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?dJ.exports=mNe():dJ.exports=ENe()});var hL=L(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.DownloadHTTPError=Ji.DownloadLengthMismatchError=Ji.DownloadError=Ji.ExpiredMetadataError=Ji.EqualVersionError=Ji.BadVersionError=Ji.RepositoryError=Ji.PersistError=Ji.RuntimeError=Ji.ValueError=void 0;var yJ=class extends Error{};Ji.ValueError=yJ;var EJ=class extends Error{};Ji.RuntimeError=EJ;var IJ=class extends Error{};Ji.PersistError=IJ;var tP=class extends Error{};Ji.RepositoryError=tP;var pL=class extends tP{};Ji.BadVersionError=pL;var CJ=class extends pL{};Ji.EqualVersionError=CJ;var wJ=class extends tP{};Ji.ExpiredMetadataError=wJ;var rP=class extends Error{};Ji.DownloadError=rP;var BJ=class extends rP{};Ji.DownloadLengthMismatchError=BJ;var vJ=class extends rP{constructor(e,r){super(e),this.statusCode=r}};Ji.DownloadHTTPError=vJ});var CNe=L(y1=>{"use strict";var DJ=y1&&y1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(y1,"__esModule",{value:!0});y1.withTempFile=void 0;var SJ=DJ(ye("fs/promises")),r8t=DJ(ye("os")),INe=DJ(ye("path")),n8t=async t=>i8t(async e=>t(INe.default.join(e,"tempfile")));y1.withTempFile=n8t;var i8t=async t=>{let e=await SJ.default.realpath(r8t.default.tmpdir()),r=await SJ.default.mkdtemp(e+INe.default.sep);try{return await t(r)}finally{await SJ.default.rm(r,{force:!0,recursive:!0,maxRetries:3})}}});var PJ=L(Qg=>{"use strict";var dL=Qg&&Qg.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qg,"__esModule",{value:!0});Qg.DefaultFetcher=Qg.BaseFetcher=void 0;var s8t=dL(mJ()),wNe=dL(ye("fs")),o8t=dL(xO()),a8t=dL(ye("util")),BNe=hL(),l8t=CNe(),c8t=(0,s8t.default)("tuf:fetch"),gL=class{async downloadFile(e,r,s){return(0,l8t.withTempFile)(async a=>{let n=await this.fetch(e),c=0,f=wNe.default.createWriteStream(a);try{for await(let p of n){let h=Buffer.from(p);if(c+=h.length,c>r)throw new BNe.DownloadLengthMismatchError("Max length reached");await u8t(f,h)}}finally{await a8t.default.promisify(f.close).bind(f)()}return s(a)})}async downloadBytes(e,r){return this.downloadFile(e,r,async s=>{let a=wNe.default.createReadStream(s),n=[];for await(let c of a)n.push(c);return Buffer.concat(n)})}};Qg.BaseFetcher=gL;var bJ=class extends gL{constructor(e={}){super(),this.timeout=e.timeout,this.retry=e.retry}async fetch(e){c8t("GET %s",e);let r=await(0,o8t.default)(e,{timeout:this.timeout,retry:this.retry});if(!r.ok||!r?.body)throw new BNe.DownloadHTTPError("Failed to download",r.status);return r.body}};Qg.DefaultFetcher=bJ;var u8t=async(t,e)=>new Promise((r,s)=>{t.write(e,a=>{a&&s(a),r(!0)})})});var vNe=L(mL=>{"use strict";Object.defineProperty(mL,"__esModule",{value:!0});mL.defaultConfig=void 0;mL.defaultConfig={maxRootRotations:256,maxDelegations:32,rootMaxLength:512e3,timestampMaxLength:16384,snapshotMaxLength:2e6,targetsMaxLength:5e6,prefixTargetsWithHash:!0,fetchTimeout:1e5,fetchRetries:void 0,fetchRetry:2}});var SNe=L(yL=>{"use strict";Object.defineProperty(yL,"__esModule",{value:!0});yL.TrustedMetadataStore=void 0;var Is=lL(),Ui=hL(),xJ=class{constructor(e){this.trustedSet={},this.referenceTime=new Date,this.loadTrustedRoot(e)}get root(){if(!this.trustedSet.root)throw new ReferenceError("No trusted root metadata");return this.trustedSet.root}get timestamp(){return this.trustedSet.timestamp}get snapshot(){return this.trustedSet.snapshot}get targets(){return this.trustedSet.targets}getRole(e){return this.trustedSet[e]}updateRoot(e){let r=JSON.parse(e.toString("utf8")),s=Is.Metadata.fromJSON(Is.MetadataKind.Root,r);if(s.signed.type!=Is.MetadataKind.Root)throw new Ui.RepositoryError(`Expected 'root', got ${s.signed.type}`);if(this.root.verifyDelegate(Is.MetadataKind.Root,s),s.signed.version!=this.root.signed.version+1)throw new Ui.BadVersionError(`Expected version ${this.root.signed.version+1}, got ${s.signed.version}`);return s.verifyDelegate(Is.MetadataKind.Root,s),this.trustedSet.root=s,s}updateTimestamp(e){if(this.snapshot)throw new Ui.RuntimeError("Cannot update timestamp after snapshot");if(this.root.signed.isExpired(this.referenceTime))throw new Ui.ExpiredMetadataError("Final root.json is expired");let r=JSON.parse(e.toString("utf8")),s=Is.Metadata.fromJSON(Is.MetadataKind.Timestamp,r);if(s.signed.type!=Is.MetadataKind.Timestamp)throw new Ui.RepositoryError(`Expected 'timestamp', got ${s.signed.type}`);if(this.root.verifyDelegate(Is.MetadataKind.Timestamp,s),this.timestamp){if(s.signed.version{let p=n.signed.meta[c];if(!p)throw new Ui.RepositoryError(`Missing file ${c} in new snapshot`);if(p.version{"use strict";Object.defineProperty(kJ,"__esModule",{value:!0});kJ.join=A8t;var f8t=ye("url");function A8t(t,e){return new f8t.URL(p8t(t)+h8t(e)).toString()}function p8t(t){return t.endsWith("/")?t:t+"/"}function h8t(t){return t.startsWith("/")?t.slice(1):t}});var bNe=L(su=>{"use strict";var g8t=su&&su.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),d8t=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RJ=su&&su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g8t(e,t,r);return d8t(e,t),e},m8t=su&&su.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(su,"__esModule",{value:!0});su.Updater=void 0;var QA=lL(),y8t=m8t(mJ()),E1=RJ(ye("fs")),EL=RJ(ye("path")),E8t=vNe(),Ay=hL(),I8t=PJ(),C8t=SNe(),nP=RJ(DNe()),QJ=(0,y8t.default)("tuf:cache"),TJ=class{constructor(e){let{metadataDir:r,metadataBaseUrl:s,targetDir:a,targetBaseUrl:n,fetcher:c,config:f}=e;this.dir=r,this.metadataBaseUrl=s,this.targetDir=a,this.targetBaseUrl=n,this.forceCache=e.forceCache??!1;let p=this.loadLocalMetadata(QA.MetadataKind.Root);this.trustedSet=new C8t.TrustedMetadataStore(p),this.config={...E8t.defaultConfig,...f},this.fetcher=c||new I8t.DefaultFetcher({timeout:this.config.fetchTimeout,retry:this.config.fetchRetries??this.config.fetchRetry})}async refresh(){if(this.forceCache)try{await this.loadTimestamp({checkRemote:!1})}catch{await this.loadRoot(),await this.loadTimestamp()}else await this.loadRoot(),await this.loadTimestamp();await this.loadSnapshot(),await this.loadTargets(QA.MetadataKind.Targets,QA.MetadataKind.Root)}async getTargetInfo(e){return this.trustedSet.targets||await this.refresh(),this.preorderDepthFirstWalk(e)}async downloadTarget(e,r,s){let a=r||this.generateTargetPath(e);if(!s){if(!this.targetBaseUrl)throw new Ay.ValueError("Target base URL not set");s=this.targetBaseUrl}let n=e.path;if(this.trustedSet.root.signed.consistentSnapshot&&this.config.prefixTargetsWithHash){let p=Object.values(e.hashes),{dir:h,base:E}=EL.parse(n),C=`${p[0]}.${E}`;n=h?`${h}/${C}`:C}let f=nP.join(s,n);return await this.fetcher.downloadFile(f,e.length,async p=>{await e.verify(E1.createReadStream(p)),QJ("WRITE %s",a),E1.copyFileSync(p,a)}),a}async findCachedTarget(e,r){r||(r=this.generateTargetPath(e));try{if(E1.existsSync(r))return await e.verify(E1.createReadStream(r)),r}catch{return}}loadLocalMetadata(e){let r=EL.join(this.dir,`${e}.json`);return QJ("READ %s",r),E1.readFileSync(r)}async loadRoot(){let r=this.trustedSet.root.signed.version+1,s=r+this.config.maxRootRotations;for(let a=r;a0;){let{roleName:a,parentRoleName:n}=r.pop();if(s.has(a))continue;let c=(await this.loadTargets(a,n))?.signed;if(!c)continue;let f=c.targets?.[e];if(f)return f;if(s.add(a),c.delegations){let p=[],h=c.delegations.rolesForTarget(e);for(let{role:E,terminating:C}of h)if(p.push({roleName:E,parentRoleName:a}),C){r.splice(0);break}p.reverse(),r.push(...p)}}}generateTargetPath(e){if(!this.targetDir)throw new Ay.ValueError("Target directory not set");let r=encodeURIComponent(e.path);return EL.join(this.targetDir,r)}persistMetadata(e,r){let s=encodeURIComponent(e);try{let a=EL.join(this.dir,`${s}.json`);QJ("WRITE %s",a),E1.writeFileSync(a,r.toString("utf8"))}catch(a){throw new Ay.PersistError(`Failed to persist metadata ${s} error: ${a}`)}}};su.Updater=TJ});var PNe=L(Tg=>{"use strict";Object.defineProperty(Tg,"__esModule",{value:!0});Tg.Updater=Tg.BaseFetcher=Tg.TargetFile=void 0;var w8t=lL();Object.defineProperty(Tg,"TargetFile",{enumerable:!0,get:function(){return w8t.TargetFile}});var B8t=PJ();Object.defineProperty(Tg,"BaseFetcher",{enumerable:!0,get:function(){return B8t.BaseFetcher}});var v8t=bNe();Object.defineProperty(Tg,"Updater",{enumerable:!0,get:function(){return v8t.Updater}})});var NJ=L(IL=>{"use strict";Object.defineProperty(IL,"__esModule",{value:!0});IL.TUFError=void 0;var FJ=class extends Error{constructor({code:e,message:r,cause:s}){super(r),this.code=e,this.cause=s,this.name=this.constructor.name}};IL.TUFError=FJ});var xNe=L(iP=>{"use strict";var S8t=iP&&iP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iP,"__esModule",{value:!0});iP.readTarget=b8t;var D8t=S8t(ye("fs")),CL=NJ();async function b8t(t,e){let r=await P8t(t,e);return new Promise((s,a)=>{D8t.default.readFile(r,"utf-8",(n,c)=>{n?a(new CL.TUFError({code:"TUF_READ_TARGET_ERROR",message:`error reading target ${r}`,cause:n})):s(c)})})}async function P8t(t,e){let r;try{r=await t.getTargetInfo(e)}catch(a){throw new CL.TUFError({code:"TUF_REFRESH_METADATA_ERROR",message:"error refreshing TUF metadata",cause:a})}if(!r)throw new CL.TUFError({code:"TUF_FIND_TARGET_ERROR",message:`target ${e} not found`});let s=await t.findCachedTarget(r);if(!s)try{s=await t.downloadTarget(r)}catch(a){throw new CL.TUFError({code:"TUF_DOWNLOAD_TARGET_ERROR",message:`error downloading target ${s}`,cause:a})}return s}});var kNe=L(($wr,x8t)=>{x8t.exports={"https://tuf-repo-cdn.sigstore.dev":{"root.json":"ewogInNpZ25hdHVyZXMiOiBbCiAgewogICAia2V5aWQiOiAiNmYyNjAwODlkNTkyM2RhZjIwMTY2Y2E2NTdjNTQzYWY2MTgzNDZhYjk3MTg4NGE5OTk2MmIwMTk4OGJiZTBjMyIsCiAgICJzaWciOiAiMzA0NjAyMjEwMDhhYjFmNmYxN2Q0ZjllNmQ3ZGNmMWM4ODkxMmI2YjUzY2MxMDM4ODY0NGFlMWYwOWJjMzdhMDgyY2QwNjAwM2UwMjIxMDBlMTQ1ZWY0YzdiNzgyZDRlODEwN2I1MzQzN2U2NjlkMDQ3Njg5MmNlOTk5OTAzYWUzM2QxNDQ0ODM2Njk5NmU3IgogIH0sCiAgewogICAia2V5aWQiOiAiZTcxYTU0ZDU0MzgzNWJhODZhZGFkOTQ2MDM3OWM3NjQxZmI4NzI2ZDE2NGVhNzY2ODAxYTFjNTIyYWJhN2VhMiIsCiAgICJzaWciOiAiMzA0NTAyMjEwMGM3NjhiMmY4NmRhOTk1NjkwMTljMTYwYTA4MWRhNTRhZTM2YzM0YzBhMzEyMGQzY2I2OWI1M2I3ZDExMzc1OGUwMjIwNGY2NzE1MThmNjE3YjIwZDQ2NTM3ZmFlNmMzYjYzYmFlODkxM2Y0ZjE5NjIxNTYxMDVjYzRmMDE5YWMzNWM2YSIKICB9LAogIHsKICAgImtleWlkIjogIjIyZjRjYWVjNmQ4ZTZmOTU1NWFmNjZiM2Q0YzNjYjA2YTNiYjIzZmRjN2UzOWM5MTZjNjFmNDYyZTZmNTJiMDYiLAogICAic2lnIjogIjMwNDUwMjIxMDBiNDQzNGU2OTk1ZDM2OGQyM2U3NDc1OWFjZDBjYjkwMTNjODNhNWQzNTExZjBmOTk3ZWM1NGM0NTZhZTQzNTBhMDIyMDE1YjBlMjY1ZDE4MmQyYjYxZGM3NGUxNTVkOThiM2MzZmJlNTY0YmEwNTI4NmFhMTRjOGRmMDJjOWI3NTY1MTYiCiAgfSwKICB7CiAgICJrZXlpZCI6ICI2MTY0MzgzODEyNWI0NDBiNDBkYjY5NDJmNWNiNWEzMWMwZGMwNDM2ODMxNmViMmFhYTU4Yjk1OTA0YTU4MjIyIiwKICAgInNpZyI6ICIzMDQ1MDIyMTAwODJjNTg0MTFkOTg5ZWI5Zjg2MTQxMDg1N2Q0MjM4MTU5MGVjOTQyNGRiZGFhNTFlNzhlZDEzNTE1NDMxOTA0ZTAyMjAxMTgxODVkYTZhNmMyOTQ3MTMxYzE3Nzk3ZTJiYjc2MjBjZTI2ZTVmMzAxZDFjZWFjNWYyYTdlNThmOWRjZjJlIgogIH0sCiAgewogICAia2V5aWQiOiAiYTY4N2U1YmY0ZmFiODJiMGVlNThkNDZlMDVjOTUzNTE0NWEyYzlhZmI0NThmNDNkNDJiNDVjYTBmZGNlMmE3MCIsCiAgICJzaWciOiAiMzA0NjAyMjEwMGM3ODUxMzg1NGNhZTljMzJlYWE2Yjg4ZTE4OTEyZjQ4MDA2YzI3NTdhMjU4ZjkxNzMxMmNhYmE3NTk0OGViOWUwMjIxMDBkOWUxYjRjZTBhZGZlOWZkMmUyMTQ4ZDdmYTI3YTJmNDBiYTExMjJiZDY5ZGE3NjEyZDhkMTc3NmIwMTNjOTFkIgogIH0sCiAgewogICAia2V5aWQiOiAiZmRmYTgzYTA3YjVhODM1ODliODdkZWQ0MWY3N2YzOWQyMzJhZDkxZjdjY2U1Mjg2OGRhY2QwNmJhMDg5ODQ5ZiIsCiAgICJzaWciOiAiMzA0NTAyMjA1NjQ4M2EyZDVkOWVhOWNlYzZlMTFlYWRmYjMzYzQ4NGI2MTQyOThmYWNhMTVhY2YxYzQzMWIxMWVkN2Y3MzRjMDIyMTAwZDBjMWQ3MjZhZjkyYTg3ZTRlNjY0NTljYTVhZGYzOGEwNWI0NGUxZjk0MzE4NDIzZjk1NGJhZThiY2E1YmIyZSIKICB9LAogIHsKICAgImtleWlkIjogImUyZjU5YWNiOTQ4ODUxOTQwN2UxOGNiZmM5MzI5NTEwYmUwM2MwNGFjYTk5MjlkMmYwMzAxMzQzZmVjODU1MjMiLAogICAic2lnIjogIjMwNDYwMjIxMDBkMDA0ZGU4ODAyNGMzMmRjNTY1M2E5ZjQ4NDNjZmM1MjE1NDI3MDQ4YWQ5NjAwZDJjZjljOTY5ZTZlZGZmM2QyMDIyMTAwZDllYmI3OThmNWZjNjZhZjEwODk5ZGVjZTAxNGE4NjI4Y2NmM2M1NDAyY2Q0YTQyNzAyMDc0NzJmOGY2ZTcxMiIKICB9LAogIHsKICAgImtleWlkIjogIjNjMzQ0YWEwNjhmZDRjYzRlODdkYzUwYjYxMmMwMjQzMWZiYzc3MWU5NTAwMzk5MzY4M2EyYjBiZjI2MGNmMGUiLAogICAic2lnIjogIjMwNDYwMjIxMDBiN2IwOTk5NmM0NWNhMmQ0YjA1NjAzZTU2YmFlZmEyOTcxOGEwYjcxMTQ3Y2Y4YzZlNjYzNDliYWE2MTQ3N2RmMDIyMTAwYzRkYTgwYzcxN2I0ZmE3YmJhMGZkNWM3MmRhOGEwNDk5MzU4YjAxMzU4YjIzMDlmNDFkMTQ1NmVhMWU3ZTFkOSIKICB9LAogIHsKICAgImtleWlkIjogImVjODE2Njk3MzRlMDE3OTk2YzViODVmM2QwMmMzZGUxZGQ0NjM3YTE1MjAxOWZlMWFmMTI1ZDJmOTM2OGI5NWUiLAogICAic2lnIjogIjMwNDYwMjIxMDBiZTk3ODJjMzA3NDRlNDExYTgyZmE4NWI1MTM4ZDYwMWNlMTQ4YmMxOTI1OGFlYzY0ZTdlYzI0NDc4ZjM4ODEyMDIyMTAwY2FlZjYzZGNhZjFhNGI5YTUwMGQzYmQwZTNmMTY0ZWMxOGYxYjYzZDdhOTQ2MGQ5YWNhYjEwNjZkYjBmMDE2ZCIKICB9LAogIHsKICAgImtleWlkIjogIjFlMWQ2NWNlOThiMTBhZGRhZDQ3NjRmZWJmN2RkYTJkMDQzNmIzZDNhMzg5MzU3OWMwZGRkYWVhMjBlNTQ4NDkiLAogICAic2lnIjogIjMwNDUwMjIwNzQ2ZWMzZjg1MzRjZTU1NTMxZDBkMDFmZjY0OTY0ZWY0NDBkMWU3ZDJjNGMxNDI0MDliOGU5NzY5ZjFhZGE2ZjAyMjEwMGUzYjkyOWZjZDkzZWExOGZlYWEwODI1ODg3YTcyMTA0ODk4NzlhNjY3ODBjMDdhODNmNGJkNDZlMmYwOWFiM2IiCiAgfQogXSwKICJzaWduZWQiOiB7CiAgIl90eXBlIjogInJvb3QiLAogICJjb25zaXN0ZW50X3NuYXBzaG90IjogdHJ1ZSwKICAiZXhwaXJlcyI6ICIyMDI1LTAyLTE5VDA4OjA0OjMyWiIsCiAgImtleXMiOiB7CiAgICIyMmY0Y2FlYzZkOGU2Zjk1NTVhZjY2YjNkNGMzY2IwNmEzYmIyM2ZkYzdlMzljOTE2YzYxZjQ2MmU2ZjUyYjA2IjogewogICAgImtleWlkX2hhc2hfYWxnb3JpdGhtcyI6IFsKICAgICAic2hhMjU2IiwKICAgICAic2hhNTEyIgogICAgXSwKICAgICJrZXl0eXBlIjogImVjZHNhIiwKICAgICJrZXl2YWwiOiB7CiAgICAgInB1YmxpYyI6ICItLS0tLUJFR0lOIFBVQkxJQyBLRVktLS0tLVxuTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFekJ6Vk9tSENQb2pNVkxTSTM2NFdpaVY4TlByRFxuNklnUnhWbGlza3ovdit5M0pFUjVtY1ZHY09ObGlEY1dNQzVKMmxmSG1qUE5QaGI0SDd4bThMemZTQT09XG4tLS0tLUVORCBQVUJMSUMgS0VZLS0tLS1cbiIKICAgIH0sCiAgICAic2NoZW1lIjogImVjZHNhLXNoYTItbmlzdHAyNTYiLAogICAgIngtdHVmLW9uLWNpLWtleW93bmVyIjogIkBzYW50aWFnb3RvcnJlcyIKICAgfSwKICAgIjYxNjQzODM4MTI1YjQ0MGI0MGRiNjk0MmY1Y2I1YTMxYzBkYzA0MzY4MzE2ZWIyYWFhNThiOTU5MDRhNTgyMjIiOiB7CiAgICAia2V5aWRfaGFzaF9hbGdvcml0aG1zIjogWwogICAgICJzaGEyNTYiLAogICAgICJzaGE1MTIiCiAgICBdLAogICAgImtleXR5cGUiOiAiZWNkc2EiLAogICAgImtleXZhbCI6IHsKICAgICAicHVibGljIjogIi0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tXG5NRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVpbmlrU3NBUW1Za05lSDVlWXEvQ25JekxhYWNPXG54bFNhYXdRRE93cUt5L3RDcXhxNXh4UFNKYzIxSzRXSWhzOUd5T2tLZnp1ZVkzR0lMemNNSlo0Y1d3PT1cbi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLVxuIgogICAgfSwKICAgICJzY2hlbWUiOiAiZWNkc2Etc2hhMi1uaXN0cDI1NiIsCiAgICAieC10dWYtb24tY2kta2V5b3duZXIiOiAiQGJvYmNhbGxhd2F5IgogICB9LAogICAiNmYyNjAwODlkNTkyM2RhZjIwMTY2Y2E2NTdjNTQzYWY2MTgzNDZhYjk3MTg4NGE5OTk2MmIwMTk4OGJiZTBjMyI6IHsKICAgICJrZXlpZF9oYXNoX2FsZ29yaXRobXMiOiBbCiAgICAgInNoYTI1NiIsCiAgICAgInNoYTUxMiIKICAgIF0sCiAgICAia2V5dHlwZSI6ICJlY2RzYSIsCiAgICAia2V5dmFsIjogewogICAgICJwdWJsaWMiOiAiLS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS1cbk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRXk4WEtzbWhCWURJOEpjMEd3ekJ4ZUtheDBjbTVcblNUS0VVNjVIUEZ1blVuNDFzVDhwaTBGak00SWtIei9ZVW13bUxVTzBXdDdseGhqNkJrTElLNHFZQXc9PVxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXG4iCiAgICB9LAogICAgInNjaGVtZSI6ICJlY2RzYS1zaGEyLW5pc3RwMjU2IiwKICAgICJ4LXR1Zi1vbi1jaS1rZXlvd25lciI6ICJAZGxvcmVuYyIKICAgfSwKICAgIjcyNDdmMGRiYWQ4NWIxNDdlMTg2M2JhZGU3NjEyNDNjYzc4NWRjYjdhYTQxMGU3MTA1ZGQzZDJiNjFhMzZkMmMiOiB7CiAgICAia2V5aWRfaGFzaF9hbGdvcml0aG1zIjogWwogICAgICJzaGEyNTYiLAogICAgICJzaGE1MTIiCiAgICBdLAogICAgImtleXR5cGUiOiAiZWNkc2EiLAogICAgImtleXZhbCI6IHsKICAgICAicHVibGljIjogIi0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tXG5NRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVXUmlHcjUraiszSjVTc0grWnRyNW5FMkgyd083XG5CVituTzNzOTNnTGNhMThxVE96SFkxb1d5QUdEeWtNU3NHVFVCU3Q5RCtBbjBLZktzRDJtZlNNNDJRPT1cbi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLVxuIgogICAgfSwKICAgICJzY2hlbWUiOiAiZWNkc2Etc2hhMi1uaXN0cDI1NiIsCiAgICAieC10dWYtb24tY2ktb25saW5lLXVyaSI6ICJnY3BrbXM6Ly9wcm9qZWN0cy9zaWdzdG9yZS1yb290LXNpZ25pbmcvbG9jYXRpb25zL2dsb2JhbC9rZXlSaW5ncy9yb290L2NyeXB0b0tleXMvdGltZXN0YW1wIgogICB9LAogICAiYTY4N2U1YmY0ZmFiODJiMGVlNThkNDZlMDVjOTUzNTE0NWEyYzlhZmI0NThmNDNkNDJiNDVjYTBmZGNlMmE3MCI6IHsKICAgICJrZXlpZF9oYXNoX2FsZ29yaXRobXMiOiBbCiAgICAgInNoYTI1NiIsCiAgICAgInNoYTUxMiIKICAgIF0sCiAgICAia2V5dHlwZSI6ICJlY2RzYSIsCiAgICAia2V5dmFsIjogewogICAgICJwdWJsaWMiOiAiLS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS1cbk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTBnaHJoOTJMdzFZcjNpZEdWNVdxQ3RNREI4Q3hcbitEOGhkQzR3MlpMTklwbFZSb1ZHTHNrWWEzZ2hlTXlPamlKOGtQaTE1YVEyLy83UCtvajdVdkpQR3c9PVxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXG4iCiAgICB9LAogICAgInNjaGVtZSI6ICJlY2RzYS1zaGEyLW5pc3RwMjU2IiwKICAgICJ4LXR1Zi1vbi1jaS1rZXlvd25lciI6ICJAam9zaHVhZ2wiCiAgIH0sCiAgICJlNzFhNTRkNTQzODM1YmE4NmFkYWQ5NDYwMzc5Yzc2NDFmYjg3MjZkMTY0ZWE3NjY4MDFhMWM1MjJhYmE3ZWEyIjogewogICAgImtleWlkX2hhc2hfYWxnb3JpdGhtcyI6IFsKICAgICAic2hhMjU2IiwKICAgICAic2hhNTEyIgogICAgXSwKICAgICJrZXl0eXBlIjogImVjZHNhIiwKICAgICJrZXl2YWwiOiB7CiAgICAgInB1YmxpYyI6ICItLS0tLUJFR0lOIFBVQkxJQyBLRVktLS0tLVxuTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFRVhzejNTWlhGYjhqTVY0Mmo2cEpseWpialI4S1xuTjNCd29jZXhxNkxNSWI1cXNXS09RdkxOMTZOVWVmTGM0SHN3T291bVJzVlZhYWpTcFFTNmZvYmtSdz09XG4tLS0tLUVORCBQVUJMSUMgS0VZLS0tLS1cbiIKICAgIH0sCiAgICAic2NoZW1lIjogImVjZHNhLXNoYTItbmlzdHAyNTYiLAogICAgIngtdHVmLW9uLWNpLWtleW93bmVyIjogIkBtbm02NzgiCiAgIH0KICB9LAogICJyb2xlcyI6IHsKICAgInJvb3QiOiB7CiAgICAia2V5aWRzIjogWwogICAgICI2ZjI2MDA4OWQ1OTIzZGFmMjAxNjZjYTY1N2M1NDNhZjYxODM0NmFiOTcxODg0YTk5OTYyYjAxOTg4YmJlMGMzIiwKICAgICAiZTcxYTU0ZDU0MzgzNWJhODZhZGFkOTQ2MDM3OWM3NjQxZmI4NzI2ZDE2NGVhNzY2ODAxYTFjNTIyYWJhN2VhMiIsCiAgICAgIjIyZjRjYWVjNmQ4ZTZmOTU1NWFmNjZiM2Q0YzNjYjA2YTNiYjIzZmRjN2UzOWM5MTZjNjFmNDYyZTZmNTJiMDYiLAogICAgICI2MTY0MzgzODEyNWI0NDBiNDBkYjY5NDJmNWNiNWEzMWMwZGMwNDM2ODMxNmViMmFhYTU4Yjk1OTA0YTU4MjIyIiwKICAgICAiYTY4N2U1YmY0ZmFiODJiMGVlNThkNDZlMDVjOTUzNTE0NWEyYzlhZmI0NThmNDNkNDJiNDVjYTBmZGNlMmE3MCIKICAgIF0sCiAgICAidGhyZXNob2xkIjogMwogICB9LAogICAic25hcHNob3QiOiB7CiAgICAia2V5aWRzIjogWwogICAgICI3MjQ3ZjBkYmFkODViMTQ3ZTE4NjNiYWRlNzYxMjQzY2M3ODVkY2I3YWE0MTBlNzEwNWRkM2QyYjYxYTM2ZDJjIgogICAgXSwKICAgICJ0aHJlc2hvbGQiOiAxLAogICAgIngtdHVmLW9uLWNpLWV4cGlyeS1wZXJpb2QiOiAzNjUwLAogICAgIngtdHVmLW9uLWNpLXNpZ25pbmctcGVyaW9kIjogMzY1CiAgIH0sCiAgICJ0YXJnZXRzIjogewogICAgImtleWlkcyI6IFsKICAgICAiNmYyNjAwODlkNTkyM2RhZjIwMTY2Y2E2NTdjNTQzYWY2MTgzNDZhYjk3MTg4NGE5OTk2MmIwMTk4OGJiZTBjMyIsCiAgICAgImU3MWE1NGQ1NDM4MzViYTg2YWRhZDk0NjAzNzljNzY0MWZiODcyNmQxNjRlYTc2NjgwMWExYzUyMmFiYTdlYTIiLAogICAgICIyMmY0Y2FlYzZkOGU2Zjk1NTVhZjY2YjNkNGMzY2IwNmEzYmIyM2ZkYzdlMzljOTE2YzYxZjQ2MmU2ZjUyYjA2IiwKICAgICAiNjE2NDM4MzgxMjViNDQwYjQwZGI2OTQyZjVjYjVhMzFjMGRjMDQzNjgzMTZlYjJhYWE1OGI5NTkwNGE1ODIyMiIsCiAgICAgImE2ODdlNWJmNGZhYjgyYjBlZTU4ZDQ2ZTA1Yzk1MzUxNDVhMmM5YWZiNDU4ZjQzZDQyYjQ1Y2EwZmRjZTJhNzAiCiAgICBdLAogICAgInRocmVzaG9sZCI6IDMKICAgfSwKICAgInRpbWVzdGFtcCI6IHsKICAgICJrZXlpZHMiOiBbCiAgICAgIjcyNDdmMGRiYWQ4NWIxNDdlMTg2M2JhZGU3NjEyNDNjYzc4NWRjYjdhYTQxMGU3MTA1ZGQzZDJiNjFhMzZkMmMiCiAgICBdLAogICAgInRocmVzaG9sZCI6IDEsCiAgICAieC10dWYtb24tY2ktZXhwaXJ5LXBlcmlvZCI6IDcsCiAgICAieC10dWYtb24tY2ktc2lnbmluZy1wZXJpb2QiOiA0CiAgIH0KICB9LAogICJzcGVjX3ZlcnNpb24iOiAiMS4wIiwKICAidmVyc2lvbiI6IDEwLAogICJ4LXR1Zi1vbi1jaS1leHBpcnktcGVyaW9kIjogMTgyLAogICJ4LXR1Zi1vbi1jaS1zaWduaW5nLXBlcmlvZCI6IDMxCiB9Cn0=",targets:{"trusted_root.json":"ewogICJtZWRpYVR5cGUiOiAiYXBwbGljYXRpb24vdm5kLmRldi5zaWdzdG9yZS50cnVzdGVkcm9vdCtqc29uO3ZlcnNpb249MC4xIiwKICAidGxvZ3MiOiBbCiAgICB7CiAgICAgICJiYXNlVXJsIjogImh0dHBzOi8vcmVrb3Iuc2lnc3RvcmUuZGV2IiwKICAgICAgImhhc2hBbGdvcml0aG0iOiAiU0hBMl8yNTYiLAogICAgICAicHVibGljS2V5IjogewogICAgICAgICJyYXdCeXRlcyI6ICJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUUyRzJZKzJ0YWJkVFY1QmNHaUJJeDBhOWZBRndya0JibUxTR3RrczRMM3FYNnlZWTB6dWZCbmhDOFVyL2l5NTVHaFdQLzlBL2JZMkxoQzMwTTkrUll0dz09IiwKICAgICAgICAia2V5RGV0YWlscyI6ICJQS0lYX0VDRFNBX1AyNTZfU0hBXzI1NiIsCiAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgInN0YXJ0IjogIjIwMjEtMDEtMTJUMTE6NTM6MjcuMDAwWiIKICAgICAgICB9CiAgICAgIH0sCiAgICAgICJsb2dJZCI6IHsKICAgICAgICAia2V5SWQiOiAid05JOWF0UUdseitWV2ZPNkxSeWdINFFVZlkvOFc0UkZ3aVQ1aTVXUmdCMD0iCiAgICAgIH0KICAgIH0KICBdLAogICJjZXJ0aWZpY2F0ZUF1dGhvcml0aWVzIjogWwogICAgewogICAgICAic3ViamVjdCI6IHsKICAgICAgICAib3JnYW5pemF0aW9uIjogInNpZ3N0b3JlLmRldiIsCiAgICAgICAgImNvbW1vbk5hbWUiOiAic2lnc3RvcmUiCiAgICAgIH0sCiAgICAgICJ1cmkiOiAiaHR0cHM6Ly9mdWxjaW8uc2lnc3RvcmUuZGV2IiwKICAgICAgImNlcnRDaGFpbiI6IHsKICAgICAgICAiY2VydGlmaWNhdGVzIjogWwogICAgICAgICAgewogICAgICAgICAgICAicmF3Qnl0ZXMiOiAiTUlJQitEQ0NBWDZnQXdJQkFnSVROVmtEWm9DaW9mUERzeTdkZm02Z2VMYnVoekFLQmdncWhrak9QUVFEQXpBcU1SVXdFd1lEVlFRS0V3eHphV2R6ZEc5eVpTNWtaWFl4RVRBUEJnTlZCQU1UQ0hOcFozTjBiM0psTUI0WERUSXhNRE13TnpBek1qQXlPVm9YRFRNeE1ESXlNekF6TWpBeU9Wb3dLakVWTUJNR0ExVUVDaE1NYzJsbmMzUnZjbVV1WkdWMk1SRXdEd1lEVlFRREV3aHphV2R6ZEc5eVpUQjJNQkFHQnlxR1NNNDlBZ0VHQlN1QkJBQWlBMklBQkxTeUE3SWk1aytwTk84WkVXWTB5bGVtV0Rvd09rTmEza0wrR1pFNVo1R1dlaEw5L0E5YlJOQTNSYnJzWjVpMEpjYXN0YVJMN1NwNWZwL2pENWR4cWMvVWRUVm5sdlMxNmFuKzJZZnN3ZS9RdUxvbFJVQ3JjT0UyKzJpQTUrdHpkNk5tTUdRd0RnWURWUjBQQVFIL0JBUURBZ0VHTUJJR0ExVWRFd0VCL3dRSU1BWUJBZjhDQVFFd0hRWURWUjBPQkJZRUZNakZIUUJCbWlRcE1sRWs2dzJ1U3UxS0J0UHNNQjhHQTFVZEl3UVlNQmFBRk1qRkhRQkJtaVFwTWxFazZ3MnVTdTFLQnRQc01Bb0dDQ3FHU000OUJBTURBMmdBTUdVQ01IOGxpV0pmTXVpNnZYWEJoakRnWTRNd3NsbU4vVEp4VmUvODNXckZvbXdtTmYwNTZ5MVg0OEY5YzRtM2Ezb3pYQUl4QUtqUmF5NS9hai9qc0tLR0lrbVFhdGpJOHV1cEhyLytDeEZ2YUpXbXBZcU5rTERHUlUrOW9yemg1aEkyUnJjdWFRPT0iCiAgICAgICAgICB9CiAgICAgICAgXQogICAgICB9LAogICAgICAidmFsaWRGb3IiOiB7CiAgICAgICAgInN0YXJ0IjogIjIwMjEtMDMtMDdUMDM6MjA6MjkuMDAwWiIsCiAgICAgICAgImVuZCI6ICIyMDIyLTEyLTMxVDIzOjU5OjU5Ljk5OVoiCiAgICAgIH0KICAgIH0sCiAgICB7CiAgICAgICJzdWJqZWN0IjogewogICAgICAgICJvcmdhbml6YXRpb24iOiAic2lnc3RvcmUuZGV2IiwKICAgICAgICAiY29tbW9uTmFtZSI6ICJzaWdzdG9yZSIKICAgICAgfSwKICAgICAgInVyaSI6ICJodHRwczovL2Z1bGNpby5zaWdzdG9yZS5kZXYiLAogICAgICAiY2VydENoYWluIjogewogICAgICAgICJjZXJ0aWZpY2F0ZXMiOiBbCiAgICAgICAgICB7CiAgICAgICAgICAgICJyYXdCeXRlcyI6ICJNSUlDR2pDQ0FhR2dBd0lCQWdJVUFMblZpVmZuVTBickphc21Sa0hybi9VbmZhUXdDZ1lJS29aSXpqMEVBd013S2pFVk1CTUdBMVVFQ2hNTWMybG5jM1J2Y21VdVpHVjJNUkV3RHdZRFZRUURFd2h6YVdkemRHOXlaVEFlRncweU1qQTBNVE15TURBMk1UVmFGdzB6TVRFd01EVXhNelUyTlRoYU1EY3hGVEFUQmdOVkJBb1RESE5wWjNOMGIzSmxMbVJsZGpFZU1Cd0dBMVVFQXhNVmMybG5jM1J2Y21VdGFXNTBaWEp0WldScFlYUmxNSFl3RUFZSEtvWkl6ajBDQVFZRks0RUVBQ0lEWWdBRThSVlMveXNIK05PdnVEWnlQSVp0aWxnVUY5TmxhcllwQWQ5SFAxdkJCSDFVNUNWNzdMU1M3czBaaUg0bkU3SHY3cHRTNkx2dlIvU1RrNzk4TFZnTXpMbEo0SGVJZkYzdEhTYWV4TGNZcFNBU3Ixa1MwTi9SZ0JKei85aldDaVhubzNzd2VUQU9CZ05WSFE4QkFmOEVCQU1DQVFZd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3TXdFZ1lEVlIwVEFRSC9CQWd3QmdFQi93SUJBREFkQmdOVkhRNEVGZ1FVMzlQcHoxWWtFWmI1cU5qcEtGV2l4aTRZWkQ4d0h3WURWUjBqQkJnd0ZvQVVXTUFlWDVGRnBXYXBlc3lRb1pNaTBDckZ4Zm93Q2dZSUtvWkl6ajBFQXdNRFp3QXdaQUl3UENzUUs0RFlpWllEUElhRGk1SEZLbmZ4WHg2QVNTVm1FUmZzeW5ZQmlYMlg2U0pSblpVODQvOURaZG5GdnZ4bUFqQk90NlFwQmxjNEovMER4dmtUQ3FwY2x2emlMNkJDQ1BuamRsSUIzUHUzQnhzUG15Z1VZN0lpMnpiZENkbGlpb3c9IgogICAgICAgICAgfSwKICAgICAgICAgIHsKICAgICAgICAgICAgInJhd0J5dGVzIjogIk1JSUI5ekNDQVh5Z0F3SUJBZ0lVQUxaTkFQRmR4SFB3amVEbG9Ed3lZQ2hBTy80d0NnWUlLb1pJemowRUF3TXdLakVWTUJNR0ExVUVDaE1NYzJsbmMzUnZjbVV1WkdWMk1SRXdEd1lEVlFRREV3aHphV2R6ZEc5eVpUQWVGdzB5TVRFd01EY3hNelUyTlRsYUZ3MHpNVEV3TURVeE16VTJOVGhhTUNveEZUQVRCZ05WQkFvVERITnBaM04wYjNKbExtUmxkakVSTUE4R0ExVUVBeE1JYzJsbmMzUnZjbVV3ZGpBUUJnY3Foa2pPUFFJQkJnVXJnUVFBSWdOaUFBVDdYZUZUNHJiM1BRR3dTNElhanRMazMvT2xucGdhbmdhQmNsWXBzWUJyNWkrNHluQjA3Y2ViM0xQME9JT1pkeGV4WDY5YzVpVnV5SlJRK0h6MDV5aStVRjN1QldBbEhwaVM1c2gwK0gyR0hFN1NYcmsxRUM1bTFUcjE5TDlnZzkyall6QmhNQTRHQTFVZER3RUIvd1FFQXdJQkJqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01CMEdBMVVkRGdRV0JCUll3QjVma1VXbFpxbDZ6SkNoa3lMUUtzWEYrakFmQmdOVkhTTUVHREFXZ0JSWXdCNWZrVVdsWnFsNnpKQ2hreUxRS3NYRitqQUtCZ2dxaGtqT1BRUURBd05wQURCbUFqRUFqMW5IZVhacCsxM05XQk5hK0VEc0RQOEcxV1dnMXRDTVdQL1dIUHFwYVZvMGpoc3dlTkZaZ1NzMGVFN3dZSTRxQWpFQTJXQjlvdDk4c0lrb0YzdlpZZGQzL1Z0V0I1YjlUTk1lYTdJeC9zdEo1VGZjTExlQUJMRTRCTkpPc1E0dm5CSEoiCiAgICAgICAgICB9CiAgICAgICAgXQogICAgICB9LAogICAgICAidmFsaWRGb3IiOiB7CiAgICAgICAgInN0YXJ0IjogIjIwMjItMDQtMTNUMjA6MDY6MTUuMDAwWiIKICAgICAgfQogICAgfQogIF0sCiAgImN0bG9ncyI6IFsKICAgIHsKICAgICAgImJhc2VVcmwiOiAiaHR0cHM6Ly9jdGZlLnNpZ3N0b3JlLmRldi90ZXN0IiwKICAgICAgImhhc2hBbGdvcml0aG0iOiAiU0hBMl8yNTYiLAogICAgICAicHVibGljS2V5IjogewogICAgICAgICJyYXdCeXRlcyI6ICJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUViZndSK1JKdWRYc2NnUkJScEtYMVhGRHkzUHl1ZER4ei9TZm5SaTFmVDhla3BmQmQyTzF1b3o3anIzWjhuS3p4QTY5RVVRK2VGQ0ZJM3pldWJQV1U3dz09IiwKICAgICAgICAia2V5RGV0YWlscyI6ICJQS0lYX0VDRFNBX1AyNTZfU0hBXzI1NiIsCiAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgInN0YXJ0IjogIjIwMjEtMDMtMTRUMDA6MDA6MDAuMDAwWiIsCiAgICAgICAgICAiZW5kIjogIjIwMjItMTAtMzFUMjM6NTk6NTkuOTk5WiIKICAgICAgICB9CiAgICAgIH0sCiAgICAgICJsb2dJZCI6IHsKICAgICAgICAia2V5SWQiOiAiQ0dDUzhDaFMvMmhGMGRGcko0U2NSV2NZckJZOXd6alNiZWE4SWdZMmIzST0iCiAgICAgIH0KICAgIH0sCiAgICB7CiAgICAgICJiYXNlVXJsIjogImh0dHBzOi8vY3RmZS5zaWdzdG9yZS5kZXYvMjAyMiIsCiAgICAgICJoYXNoQWxnb3JpdGhtIjogIlNIQTJfMjU2IiwKICAgICAgInB1YmxpY0tleSI6IHsKICAgICAgICAicmF3Qnl0ZXMiOiAiTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFaVBTbEZpMENtRlRmRWpDVXFGOUh1Q0VjWVhOS0FhWWFsSUptQlo4eXllelBqVHFoeHJLQnBNbmFvY1Z0TEpCSTFlTTN1WG5RelFHQUpkSjRnczlGeXc9PSIsCiAgICAgICAgImtleURldGFpbHMiOiAiUEtJWF9FQ0RTQV9QMjU2X1NIQV8yNTYiLAogICAgICAgICJ2YWxpZEZvciI6IHsKICAgICAgICAgICJzdGFydCI6ICIyMDIyLTEwLTIwVDAwOjAwOjAwLjAwMFoiCiAgICAgICAgfQogICAgICB9LAogICAgICAibG9nSWQiOiB7CiAgICAgICAgImtleUlkIjogIjNUMHdhc2JIRVRKakdSNGNtV2MzQXFKS1hyamVQSzMvaDRweWdDOHA3bzQ9IgogICAgICB9CiAgICB9CiAgXSwKICAidGltZXN0YW1wQXV0aG9yaXRpZXMiOiBbCiAgICB7CiAgICAgICJzdWJqZWN0IjogewogICAgICAgICJvcmdhbml6YXRpb24iOiAiR2l0SHViLCBJbmMuIiwKICAgICAgICAiY29tbW9uTmFtZSI6ICJJbnRlcm5hbCBTZXJ2aWNlcyBSb290IgogICAgICB9LAogICAgICAiY2VydENoYWluIjogewogICAgICAgICJjZXJ0aWZpY2F0ZXMiOiBbCiAgICAgICAgICB7CiAgICAgICAgICAgICJyYXdCeXRlcyI6ICJNSUlCM0RDQ0FXS2dBd0lCQWdJVWNoa05zSDM2WGEwNGIxTHFJYytxcjlEVmVjTXdDZ1lJS29aSXpqMEVBd013TWpFVk1CTUdBMVVFQ2hNTVIybDBTSFZpTENCSmJtTXVNUmt3RndZRFZRUURFeEJVVTBFZ2FXNTBaWEp0WldScFlYUmxNQjRYRFRJek1EUXhOREF3TURBd01Gb1hEVEkwTURReE16QXdNREF3TUZvd01qRVZNQk1HQTFVRUNoTU1SMmwwU0hWaUxDQkpibU11TVJrd0Z3WURWUVFERXhCVVUwRWdWR2x0WlhOMFlXMXdhVzVuTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFVUQ1Wk5iU3FZTWQ2cjhxcE9PRVg5aWJHblpUOUdzdVhPaHIvZjhVOUZKdWdCR0V4S1lwNDBPVUxTMGVyalpXN3hWOXhWNTJObkpmNU9lRHE0ZTVaS3FOV01GUXdEZ1lEVlIwUEFRSC9CQVFEQWdlQU1CTUdBMVVkSlFRTU1Bb0dDQ3NHQVFVRkJ3TUlNQXdHQTFVZEV3RUIvd1FDTUFBd0h3WURWUjBqQkJnd0ZvQVVhVzFSdWRPZ1Z0MGxlcVkwV0tZYnVQcjQ3d0F3Q2dZSUtvWkl6ajBFQXdNRGFBQXdaUUl3YlVIOUh2RDRlakNaSk9XUW5xQWxrcVVSbGx2dTlNOCtWcUxiaVJLK3pTZlpDWndzaWxqUm44TVFRUlNrWEVFNUFqRUFnK1Z4cXRvamZWZnU4RGh6emhDeDlHS0VUYkpIYjE5aVY3Mm1NS1ViREFGbXpaNmJROGI1NFpiOHRpZHk1YVdlIgogICAgICAgICAgfSwKICAgICAgICAgIHsKICAgICAgICAgICAgInJhd0J5dGVzIjogIk1JSUNFRENDQVpXZ0F3SUJBZ0lVWDhaTzVRWFA3dk40ZE1RNWU5c1UzbnViOE9nd0NnWUlLb1pJemowRUF3TXdPREVWTUJNR0ExVUVDaE1NUjJsMFNIVmlMQ0JKYm1NdU1SOHdIUVlEVlFRREV4WkpiblJsY201aGJDQlRaWEoyYVdObGN5QlNiMjkwTUI0WERUSXpNRFF4TkRBd01EQXdNRm9YRFRJNE1EUXhNakF3TURBd01Gb3dNakVWTUJNR0ExVUVDaE1NUjJsMFNIVmlMQ0JKYm1NdU1Sa3dGd1lEVlFRREV4QlVVMEVnYVc1MFpYSnRaV1JwWVhSbE1IWXdFQVlIS29aSXpqMENBUVlGSzRFRUFDSURZZ0FFdk1MWS9kVFZidklKWUFOQXVzekV3Sm5RRTFsbGZ0eW55TUtJTWhoNDhIbXFiVnI1eWd5YnpzTFJMVktiQldPZFoyMWFlSnorZ1ppeXRaZXRxY3lGOVdsRVI1TkVNZjZKVjdaTm9qUXB4SHE0UkhHb0dTY2VRdi9xdlRpWnhFREtvMll3WkRBT0JnTlZIUThCQWY4RUJBTUNBUVl3RWdZRFZSMFRBUUgvQkFnd0JnRUIvd0lCQURBZEJnTlZIUTRFRmdRVWFXMVJ1ZE9nVnQwbGVxWTBXS1lidVByNDd3QXdId1lEVlIwakJCZ3dGb0FVOU5ZWWxvYm5BRzRjMC9xanh5SC9scS93eitRd0NnWUlLb1pJemowRUF3TURhUUF3WmdJeEFLMUIxODV5Z0NySVlGbElzM0dqc3dqbndTTUc2TFk4d29MVmRha0tEWnhWYThmOGNxTXMxRGhjeEowKzA5dzk1UUl4QU8rdEJ6Wms3dmpVSjlpSmdENFI2WldUeFFXS3FObTc0ak85OW8rbzlzdjRGSS9TWlRaVEZ5TW4wSUpFSGRObXlBPT0iCiAgICAgICAgICB9LAogICAgICAgICAgewogICAgICAgICAgICAicmF3Qnl0ZXMiOiAiTUlJQjlEQ0NBWHFnQXdJQkFnSVVhL0pBa2RVaks0SlV3c3F0YWlSSkdXaHFMU293Q2dZSUtvWkl6ajBFQXdNd09ERVZNQk1HQTFVRUNoTU1SMmwwU0hWaUxDQkpibU11TVI4d0hRWURWUVFERXhaSmJuUmxjbTVoYkNCVFpYSjJhV05sY3lCU2IyOTBNQjRYRFRJek1EUXhOREF3TURBd01Gb1hEVE16TURReE1UQXdNREF3TUZvd09ERVZNQk1HQTFVRUNoTU1SMmwwU0hWaUxDQkpibU11TVI4d0hRWURWUVFERXhaSmJuUmxjbTVoYkNCVFpYSjJhV05sY3lCU2IyOTBNSFl3RUFZSEtvWkl6ajBDQVFZRks0RUVBQ0lEWWdBRWY5akZBWHh6NGt4NjhBSFJNT2tGQmhmbERjTVR2emFYejR4L0ZDY1hqSi8xcUVLb24vcVBJR25hVVJza0R0eU5iTkRPcGVKVERERnF0NDhpTVBybnpweDZJWndxZW1mVUpONHhCRVpmemErcFl0L2l5b2QrOXRacjIwUlJXU3YvbzBVd1F6QU9CZ05WSFE4QkFmOEVCQU1DQVFZd0VnWURWUjBUQVFIL0JBZ3dCZ0VCL3dJQkFqQWRCZ05WSFE0RUZnUVU5TllZbG9ibkFHNGMwL3FqeHlIL2xxL3d6K1F3Q2dZSUtvWkl6ajBFQXdNRGFBQXdaUUl4QUxaTFo4QmdSWHpLeExNTU45VklsTytlNGhyQm5OQmdGN3R6N0hucm93djJOZXRaRXJJQUNLRnltQmx2V0R2dE1BSXdaTytraTZzc1ExYnNabzk4TzhtRUFmMk5aN2lpQ2dERFUwVndqZWNvNnp5ZWgwekJUczkvN2dWNkFITlE1M3hEIgogICAgICAgICAgfQogICAgICAgIF0KICAgICAgfSwKICAgICAgInZhbGlkRm9yIjogewogICAgICAgICJzdGFydCI6ICIyMDIzLTA0LTE0VDAwOjAwOjAwLjAwMFoiCiAgICAgIH0KICAgIH0KICBdCn0K","registry.npmjs.org%2Fkeys.json":"ewogICAgImtleXMiOiBbCiAgICAgICAgewogICAgICAgICAgICAia2V5SWQiOiAiU0hBMjU2OmpsM2J3c3d1ODBQampva0NnaDBvMnc1YzJVNExoUUFFNTdnajljejFrekEiLAogICAgICAgICAgICAia2V5VXNhZ2UiOiAibnBtOnNpZ25hdHVyZXMiLAogICAgICAgICAgICAicHVibGljS2V5IjogewogICAgICAgICAgICAgICAgInJhd0J5dGVzIjogIk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTFPbGIzek1BRkZ4WEtIaUlrUU81Y0ozWWhsNWk2VVBwK0lodXRlQkpidUhjQTVVb2dLbzBFV3RsV3dXNktTYUtvVE5FWUw3SmxDUWlWbmtoQmt0VWdnPT0iLAogICAgICAgICAgICAgICAgImtleURldGFpbHMiOiAiUEtJWF9FQ0RTQV9QMjU2X1NIQV8yNTYiLAogICAgICAgICAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgICAgICAgICAgICJzdGFydCI6ICIxOTk5LTAxLTAxVDAwOjAwOjAwLjAwMFoiLAogICAgICAgICAgICAgICAgICAgICJlbmQiOiAiMjAyNS0wMS0yOVQwMDowMDowMC4wMDBaIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJrZXlJZCI6ICJTSEEyNTY6amwzYndzd3U4MFBqam9rQ2doMG8ydzVjMlU0TGhRQUU1N2dqOWN6MWt6QSIsCiAgICAgICAgICAgICJrZXlVc2FnZSI6ICJucG06YXR0ZXN0YXRpb25zIiwKICAgICAgICAgICAgInB1YmxpY0tleSI6IHsKICAgICAgICAgICAgICAgICJyYXdCeXRlcyI6ICJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUUxT2xiM3pNQUZGeFhLSGlJa1FPNWNKM1lobDVpNlVQcCtJaHV0ZUJKYnVIY0E1VW9nS28wRVd0bFd3VzZLU2FLb1RORVlMN0psQ1FpVm5raEJrdFVnZz09IiwKICAgICAgICAgICAgICAgICJrZXlEZXRhaWxzIjogIlBLSVhfRUNEU0FfUDI1Nl9TSEFfMjU2IiwKICAgICAgICAgICAgICAgICJ2YWxpZEZvciI6IHsKICAgICAgICAgICAgICAgICAgICAic3RhcnQiOiAiMjAyMi0xMi0wMVQwMDowMDowMC4wMDBaIiwKICAgICAgICAgICAgICAgICAgICAiZW5kIjogIjIwMjUtMDEtMjlUMDA6MDA6MDAuMDAwWiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAia2V5SWQiOiAiU0hBMjU2OkRoUTh3UjVBUEJ2RkhMRi8rVGMrQVl2UE9kVHBjSURxT2h4c0JIUndDN1UiLAogICAgICAgICAgICAia2V5VXNhZ2UiOiAibnBtOnNpZ25hdHVyZXMiLAogICAgICAgICAgICAicHVibGljS2V5IjogewogICAgICAgICAgICAgICAgInJhd0J5dGVzIjogIk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRVk2WWE3VysrN2FVUHp2TVRyZXpINlljeDNjK0hPS1lDY05HeWJKWlNDSnEvZmQ3UWE4dXVBS3RkSWtVUXRRaUVLRVJoQW1FNWxNTUpoUDhPa0RPYTJnPT0iLAogICAgICAgICAgICAgICAgImtleURldGFpbHMiOiAiUEtJWF9FQ0RTQV9QMjU2X1NIQV8yNTYiLAogICAgICAgICAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgICAgICAgICAgICJzdGFydCI6ICIyMDI1LTAxLTEzVDAwOjAwOjAwLjAwMFoiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImtleUlkIjogIlNIQTI1NjpEaFE4d1I1QVBCdkZITEYvK1RjK0FZdlBPZFRwY0lEcU9oeHNCSFJ3QzdVIiwKICAgICAgICAgICAgImtleVVzYWdlIjogIm5wbTphdHRlc3RhdGlvbnMiLAogICAgICAgICAgICAicHVibGljS2V5IjogewogICAgICAgICAgICAgICAgInJhd0J5dGVzIjogIk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRVk2WWE3VysrN2FVUHp2TVRyZXpINlljeDNjK0hPS1lDY05HeWJKWlNDSnEvZmQ3UWE4dXVBS3RkSWtVUXRRaUVLRVJoQW1FNWxNTUpoUDhPa0RPYTJnPT0iLAogICAgICAgICAgICAgICAgImtleURldGFpbHMiOiAiUEtJWF9FQ0RTQV9QMjU2X1NIQV8yNTYiLAogICAgICAgICAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgICAgICAgICAgICJzdGFydCI6ICIyMDI1LTAxLTEzVDAwOjAwOjAwLjAwMFoiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICBdCn0K"}}}});var TNe=L(I1=>{"use strict";var QNe=I1&&I1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(I1,"__esModule",{value:!0});I1.TUFClient=void 0;var Rg=QNe(ye("fs")),sP=QNe(ye("path")),k8t=PNe(),Q8t=wL(),T8t=xNe(),LJ="targets",OJ=class{constructor(e){let r=new URL(e.mirrorURL),s=encodeURIComponent(r.host+r.pathname.replace(/\/$/,"")),a=sP.default.join(e.cachePath,s);R8t(a),F8t({cachePath:a,mirrorURL:e.mirrorURL,tufRootPath:e.rootPath,forceInit:e.forceInit}),this.updater=N8t({mirrorURL:e.mirrorURL,cachePath:a,forceCache:e.forceCache,retry:e.retry,timeout:e.timeout})}async refresh(){return this.updater.refresh()}getTarget(e){return(0,T8t.readTarget)(this.updater,e)}};I1.TUFClient=OJ;function R8t(t){let e=sP.default.join(t,LJ);Rg.default.existsSync(t)||Rg.default.mkdirSync(t,{recursive:!0}),Rg.default.existsSync(e)||Rg.default.mkdirSync(e)}function F8t({cachePath:t,mirrorURL:e,tufRootPath:r,forceInit:s}){let a=sP.default.join(t,"root.json");if(!Rg.default.existsSync(a)||s)if(r)Rg.default.copyFileSync(r,a);else{let c=kNe()[e];if(!c)throw new Q8t.TUFError({code:"TUF_INIT_CACHE_ERROR",message:`No root.json found for mirror: ${e}`});Rg.default.writeFileSync(a,Buffer.from(c["root.json"],"base64")),Object.entries(c.targets).forEach(([f,p])=>{Rg.default.writeFileSync(sP.default.join(t,LJ,f),Buffer.from(p,"base64"))})}}function N8t(t){let e={fetchTimeout:t.timeout,fetchRetry:t.retry};return new k8t.Updater({metadataBaseUrl:t.mirrorURL,targetBaseUrl:`${t.mirrorURL}/targets`,metadataDir:t.cachePath,targetDir:sP.default.join(t.cachePath,LJ),forceCache:t.forceCache,config:e})}});var wL=L(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.TUFError=yh.DEFAULT_MIRROR_URL=void 0;yh.getTrustedRoot=q8t;yh.initTUF=G8t;var O8t=Rb(),L8t=fFe(),M8t=TNe();yh.DEFAULT_MIRROR_URL="https://tuf-repo-cdn.sigstore.dev";var _8t="sigstore-js",U8t={retries:2},H8t=5e3,j8t="trusted_root.json";async function q8t(t={}){let r=await RNe(t).getTarget(j8t);return O8t.TrustedRoot.fromJSON(JSON.parse(r))}async function G8t(t={}){let e=RNe(t);return e.refresh().then(()=>e)}function RNe(t){return new M8t.TUFClient({cachePath:t.cachePath||(0,L8t.appDataPath)(_8t),rootPath:t.rootPath,mirrorURL:t.mirrorURL||yh.DEFAULT_MIRROR_URL,retry:t.retry??U8t,timeout:t.timeout??H8t,forceCache:t.forceCache??!1,forceInit:t.forceInit??t.force??!1})}var W8t=NJ();Object.defineProperty(yh,"TUFError",{enumerable:!0,get:function(){return W8t.TUFError}})});var FNe=L(BL=>{"use strict";Object.defineProperty(BL,"__esModule",{value:!0});BL.DSSESignatureContent=void 0;var oP=wl(),MJ=class{constructor(e){this.env=e}compareDigest(e){return oP.crypto.bufferEqual(e,oP.crypto.digest("sha256",this.env.payload))}compareSignature(e){return oP.crypto.bufferEqual(e,this.signature)}verifySignature(e){return oP.crypto.verify(this.preAuthEncoding,e,this.signature)}get signature(){return this.env.signatures.length>0?this.env.signatures[0].sig:Buffer.from("")}get preAuthEncoding(){return oP.dsse.preAuthEncoding(this.env.payloadType,this.env.payload)}};BL.DSSESignatureContent=MJ});var NNe=L(vL=>{"use strict";Object.defineProperty(vL,"__esModule",{value:!0});vL.MessageSignatureContent=void 0;var _J=wl(),UJ=class{constructor(e,r){this.signature=e.signature,this.messageDigest=e.messageDigest.digest,this.artifact=r}compareSignature(e){return _J.crypto.bufferEqual(e,this.signature)}compareDigest(e){return _J.crypto.bufferEqual(e,this.messageDigest)}verifySignature(e){return _J.crypto.verify(this.artifact,e,this.signature)}};vL.MessageSignatureContent=UJ});var LNe=L(SL=>{"use strict";Object.defineProperty(SL,"__esModule",{value:!0});SL.toSignedEntity=K8t;SL.signatureContent=ONe;var HJ=wl(),Y8t=FNe(),V8t=NNe();function K8t(t,e){let{tlogEntries:r,timestampVerificationData:s}=t.verificationMaterial,a=[];for(let n of r)a.push({$case:"transparency-log",tlogEntry:n});for(let n of s?.rfc3161Timestamps??[])a.push({$case:"timestamp-authority",timestamp:HJ.RFC3161Timestamp.parse(n.signedTimestamp)});return{signature:ONe(t,e),key:J8t(t),tlogEntries:r,timestamps:a}}function ONe(t,e){switch(t.content.$case){case"dsseEnvelope":return new Y8t.DSSESignatureContent(t.content.dsseEnvelope);case"messageSignature":return new V8t.MessageSignatureContent(t.content.messageSignature,e)}}function J8t(t){switch(t.verificationMaterial.content.$case){case"publicKey":return{$case:"public-key",hint:t.verificationMaterial.content.publicKey.hint};case"x509CertificateChain":return{$case:"certificate",certificate:HJ.X509Certificate.parse(t.verificationMaterial.content.x509CertificateChain.certificates[0].rawBytes)};case"certificate":return{$case:"certificate",certificate:HJ.X509Certificate.parse(t.verificationMaterial.content.certificate.rawBytes)}}}});var Co=L(C1=>{"use strict";Object.defineProperty(C1,"__esModule",{value:!0});C1.PolicyError=C1.VerificationError=void 0;var DL=class extends Error{constructor({code:e,message:r,cause:s}){super(r),this.code=e,this.cause=s,this.name=this.constructor.name}},jJ=class extends DL{};C1.VerificationError=jJ;var qJ=class extends DL{};C1.PolicyError=qJ});var MNe=L(bL=>{"use strict";Object.defineProperty(bL,"__esModule",{value:!0});bL.filterCertAuthorities=z8t;bL.filterTLogAuthorities=Z8t;function z8t(t,e){return t.filter(r=>r.validFor.start<=e.start&&r.validFor.end>=e.end)}function Z8t(t,e){return t.filter(r=>e.logID&&!r.logID.equals(e.logID)?!1:r.validFor.start<=e.targetDate&&e.targetDate<=r.validFor.end)}});var hy=L(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.filterTLogAuthorities=py.filterCertAuthorities=void 0;py.toTrustMaterial=$8t;var GJ=wl(),aP=Rb(),X8t=Co(),WJ=new Date(0),YJ=new Date(864e13),HNe=MNe();Object.defineProperty(py,"filterCertAuthorities",{enumerable:!0,get:function(){return HNe.filterCertAuthorities}});Object.defineProperty(py,"filterTLogAuthorities",{enumerable:!0,get:function(){return HNe.filterTLogAuthorities}});function $8t(t,e){let r=typeof e=="function"?e:eHt(e);return{certificateAuthorities:t.certificateAuthorities.map(UNe),timestampAuthorities:t.timestampAuthorities.map(UNe),tlogs:t.tlogs.map(_Ne),ctlogs:t.ctlogs.map(_Ne),publicKey:r}}function _Ne(t){let e=t.publicKey.keyDetails,r=e===aP.PublicKeyDetails.PKCS1_RSA_PKCS1V5||e===aP.PublicKeyDetails.PKIX_RSA_PKCS1V5||e===aP.PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256||e===aP.PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256||e===aP.PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256?"pkcs1":"spki";return{logID:t.logId.keyId,publicKey:GJ.crypto.createPublicKey(t.publicKey.rawBytes,r),validFor:{start:t.publicKey.validFor?.start||WJ,end:t.publicKey.validFor?.end||YJ}}}function UNe(t){return{certChain:t.certChain.certificates.map(e=>GJ.X509Certificate.parse(e.rawBytes)),validFor:{start:t.validFor?.start||WJ,end:t.validFor?.end||YJ}}}function eHt(t){return e=>{let r=(t||{})[e];if(!r)throw new X8t.VerificationError({code:"PUBLIC_KEY_ERROR",message:`key not found: ${e}`});return{publicKey:GJ.crypto.createPublicKey(r.rawBytes),validFor:s=>(r.validFor?.start||WJ)<=s&&(r.validFor?.end||YJ)>=s}}}});var VJ=L(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});lP.CertificateChainVerifier=void 0;lP.verifyCertificateChain=rHt;var gy=Co(),tHt=hy();function rHt(t,e){let r=(0,tHt.filterCertAuthorities)(e,{start:t.notBefore,end:t.notAfter}),s;for(let a of r)try{return new PL({trustedCerts:a.certChain,untrustedCert:t}).verify()}catch(n){s=n}throw new gy.VerificationError({code:"CERTIFICATE_ERROR",message:"Failed to verify certificate chain",cause:s})}var PL=class{constructor(e){this.untrustedCert=e.untrustedCert,this.trustedCerts=e.trustedCerts,this.localCerts=nHt([...e.trustedCerts,e.untrustedCert])}verify(){let e=this.sort();return this.checkPath(e),e}sort(){let e=this.untrustedCert,r=this.buildPaths(e);if(r=r.filter(a=>a.some(n=>this.trustedCerts.includes(n))),r.length===0)throw new gy.VerificationError({code:"CERTIFICATE_ERROR",message:"no trusted certificate path found"});let s=r.reduce((a,n)=>a.length{if(s&&a.extSubjectKeyID){a.extSubjectKeyID.keyIdentifier.equals(s)&&r.push(a);return}a.subject.equals(e.issuer)&&r.push(a)}),r=r.filter(a=>{try{return e.verify(a)}catch{return!1}}),r)}checkPath(e){if(e.length<1)throw new gy.VerificationError({code:"CERTIFICATE_ERROR",message:"certificate chain must contain at least one certificate"});if(!e.slice(1).every(s=>s.isCA))throw new gy.VerificationError({code:"CERTIFICATE_ERROR",message:"intermediate certificate is not a CA"});for(let s=e.length-2;s>=0;s--)if(!e[s].issuer.equals(e[s+1].subject))throw new gy.VerificationError({code:"CERTIFICATE_ERROR",message:"incorrect certificate name chaining"});for(let s=0;s{"use strict";Object.defineProperty(KJ,"__esModule",{value:!0});KJ.verifySCTs=oHt;var xL=wl(),iHt=Co(),sHt=hy();function oHt(t,e,r){let s,a=t.clone();for(let p=0;p{if(!(0,sHt.filterTLogAuthorities)(r,{logID:p.logID,targetDate:p.datetime}).some(C=>p.verify(n.buffer,C.publicKey)))throw new iHt.VerificationError({code:"CERTIFICATE_ERROR",message:"SCT verification failed"});return p.logID})}});var GNe=L(kL=>{"use strict";Object.defineProperty(kL,"__esModule",{value:!0});kL.verifyPublicKey=AHt;kL.verifyCertificate=pHt;var aHt=wl(),qNe=Co(),lHt=VJ(),cHt=jNe(),uHt="1.3.6.1.4.1.57264.1.1",fHt="1.3.6.1.4.1.57264.1.8";function AHt(t,e,r){let s=r.publicKey(t);return e.forEach(a=>{if(!s.validFor(a))throw new qNe.VerificationError({code:"PUBLIC_KEY_ERROR",message:`Public key is not valid for timestamp: ${a.toISOString()}`})}),{key:s.publicKey}}function pHt(t,e,r){let s=(0,lHt.verifyCertificateChain)(t,r.certificateAuthorities);if(!e.every(n=>s.every(c=>c.validForDate(n))))throw new qNe.VerificationError({code:"CERTIFICATE_ERROR",message:"certificate is not valid or expired at the specified date"});return{scts:(0,cHt.verifySCTs)(s[0],s[1],r.ctlogs),signer:hHt(s[0])}}function hHt(t){let e,r=t.extension(fHt);r?e=r.valueObj.subs?.[0]?.value.toString("ascii"):e=t.extension(uHt)?.value.toString("ascii");let s={extensions:{issuer:e},subjectAlternativeName:t.subjectAltName};return{key:aHt.crypto.createPublicKey(t.publicKey),identity:s}}});var YNe=L(QL=>{"use strict";Object.defineProperty(QL,"__esModule",{value:!0});QL.verifySubjectAlternativeName=gHt;QL.verifyExtensions=dHt;var WNe=Co();function gHt(t,e){if(e===void 0||!e.match(t))throw new WNe.PolicyError({code:"UNTRUSTED_SIGNER_ERROR",message:`certificate identity error - expected ${t}, got ${e}`})}function dHt(t,e={}){let r;for(r in t)if(e[r]!==t[r])throw new WNe.PolicyError({code:"UNTRUSTED_SIGNER_ERROR",message:`invalid certificate extension - expected ${r}=${t[r]}, got ${r}=${e[r]}`})}});var VNe=L($J=>{"use strict";Object.defineProperty($J,"__esModule",{value:!0});$J.verifyCheckpoint=EHt;var zJ=wl(),w1=Co(),mHt=hy(),JJ=` + +`,yHt=/\u2014 (\S+) (\S+)\n/g;function EHt(t,e){let r=(0,mHt.filterTLogAuthorities)(e,{targetDate:new Date(Number(t.integratedTime)*1e3)}),s=t.inclusionProof,a=ZJ.fromString(s.checkpoint.envelope),n=XJ.fromString(a.note);if(!IHt(a,r))throw new w1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"invalid checkpoint signature"});if(!zJ.crypto.bufferEqual(n.logHash,s.rootHash))throw new w1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"root hash mismatch"})}function IHt(t,e){let r=Buffer.from(t.note,"utf-8");return t.signatures.every(s=>{let a=e.find(n=>zJ.crypto.bufferEqual(n.logID.subarray(0,4),s.keyHint));return a?zJ.crypto.verify(r,a.publicKey,s.signature):!1})}var ZJ=class t{constructor(e,r){this.note=e,this.signatures=r}static fromString(e){if(!e.includes(JJ))throw new w1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"missing checkpoint separator"});let r=e.indexOf(JJ),s=e.slice(0,r+1),n=e.slice(r+JJ.length).matchAll(yHt),c=Array.from(n,f=>{let[,p,h]=f,E=Buffer.from(h,"base64");if(E.length<5)throw new w1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"malformed checkpoint signature"});return{name:p,keyHint:E.subarray(0,4),signature:E.subarray(4)}});if(c.length===0)throw new w1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"no signatures found in checkpoint"});return new t(s,c)}},XJ=class t{constructor(e,r,s,a){this.origin=e,this.logSize=r,this.logHash=s,this.rest=a}static fromString(e){let r=e.trimEnd().split(` +`);if(r.length<3)throw new w1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"too few lines in checkpoint header"});let s=r[0],a=BigInt(r[1]),n=Buffer.from(r[2],"base64"),c=r.slice(3);return new t(s,a,n,c)}}});var KNe=L(nz=>{"use strict";Object.defineProperty(nz,"__esModule",{value:!0});nz.verifyMerkleInclusion=BHt;var rz=wl(),ez=Co(),CHt=Buffer.from([0]),wHt=Buffer.from([1]);function BHt(t){let e=t.inclusionProof,r=BigInt(e.logIndex),s=BigInt(e.treeSize);if(r<0n||r>=s)throw new ez.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:`invalid index: ${r}`});let{inner:a,border:n}=vHt(r,s);if(e.hashes.length!==a+n)throw new ez.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"invalid hash count"});let c=e.hashes.slice(0,a),f=e.hashes.slice(a),p=kHt(t.canonicalizedBody),h=DHt(SHt(p,c,r),f);if(!rz.crypto.bufferEqual(h,e.rootHash))throw new ez.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"calculated root hash does not match inclusion proof"})}function vHt(t,e){let r=bHt(t,e),s=PHt(t>>BigInt(r));return{inner:r,border:s}}function SHt(t,e,r){return e.reduce((s,a,n)=>r>>BigInt(n)&BigInt(1)?tz(a,s):tz(s,a),t)}function DHt(t,e){return e.reduce((r,s)=>tz(s,r),t)}function bHt(t,e){return xHt(t^e-BigInt(1))}function PHt(t){return t.toString(2).split("1").length-1}function xHt(t){return t===0n?0:t.toString(2).length}function tz(t,e){return rz.crypto.digest("sha256",wHt,t,e)}function kHt(t){return rz.crypto.digest("sha256",CHt,t)}});var zNe=L(iz=>{"use strict";Object.defineProperty(iz,"__esModule",{value:!0});iz.verifyTLogSET=RHt;var JNe=wl(),QHt=Co(),THt=hy();function RHt(t,e){if(!(0,THt.filterTLogAuthorities)(e,{logID:t.logId.keyId,targetDate:new Date(Number(t.integratedTime)*1e3)}).some(a=>{let n=FHt(t),c=Buffer.from(JNe.json.canonicalize(n),"utf8"),f=t.inclusionPromise.signedEntryTimestamp;return JNe.crypto.verify(c,a.publicKey,f)}))throw new QHt.VerificationError({code:"TLOG_INCLUSION_PROMISE_ERROR",message:"inclusion promise could not be verified"})}function FHt(t){let{integratedTime:e,logIndex:r,logId:s,canonicalizedBody:a}=t;return{body:a.toString("base64"),integratedTime:Number(e),logIndex:Number(r),logID:s.keyId.toString("hex")}}});var ZNe=L(az=>{"use strict";Object.defineProperty(az,"__esModule",{value:!0});az.verifyRFC3161Timestamp=LHt;var sz=wl(),oz=Co(),NHt=VJ(),OHt=hy();function LHt(t,e,r){let s=t.signingTime;if(r=(0,OHt.filterCertAuthorities)(r,{start:s,end:s}),r=_Ht(r,{serialNumber:t.signerSerialNumber,issuer:t.signerIssuer}),!r.some(n=>{try{return MHt(t,e,n),!0}catch{return!1}}))throw new oz.VerificationError({code:"TIMESTAMP_ERROR",message:"timestamp could not be verified"})}function MHt(t,e,r){let[s,...a]=r.certChain,n=sz.crypto.createPublicKey(s.publicKey),c=t.signingTime;try{new NHt.CertificateChainVerifier({untrustedCert:s,trustedCerts:a}).verify()}catch{throw new oz.VerificationError({code:"TIMESTAMP_ERROR",message:"invalid certificate chain"})}if(!r.certChain.every(p=>p.validForDate(c)))throw new oz.VerificationError({code:"TIMESTAMP_ERROR",message:"timestamp was signed with an expired certificate"});t.verify(e,n)}function _Ht(t,e){return t.filter(r=>r.certChain.length>0&&sz.crypto.bufferEqual(r.certChain[0].serialNumber,e.serialNumber)&&sz.crypto.bufferEqual(r.certChain[0].issuer,e.issuer))}});var XNe=L(TL=>{"use strict";Object.defineProperty(TL,"__esModule",{value:!0});TL.verifyTSATimestamp=WHt;TL.verifyTLogTimestamp=YHt;var UHt=Co(),HHt=VNe(),jHt=KNe(),qHt=zNe(),GHt=ZNe();function WHt(t,e,r){return(0,GHt.verifyRFC3161Timestamp)(t,e,r),{type:"timestamp-authority",logID:t.signerSerialNumber,timestamp:t.signingTime}}function YHt(t,e){let r=!1;if(VHt(t)&&((0,qHt.verifyTLogSET)(t,e),r=!0),KHt(t)&&((0,jHt.verifyMerkleInclusion)(t),(0,HHt.verifyCheckpoint)(t,e),r=!0),!r)throw new UHt.VerificationError({code:"TLOG_MISSING_INCLUSION_ERROR",message:"inclusion could not be verified"});return{type:"transparency-log",logID:t.logId.keyId,timestamp:new Date(Number(t.integratedTime)*1e3)}}function VHt(t){return t.inclusionPromise!==void 0}function KHt(t){return t.inclusionProof!==void 0}});var $Ne=L(lz=>{"use strict";Object.defineProperty(lz,"__esModule",{value:!0});lz.verifyDSSETLogBody=JHt;var RL=Co();function JHt(t,e){switch(t.apiVersion){case"0.0.1":return zHt(t,e);default:throw new RL.VerificationError({code:"TLOG_BODY_ERROR",message:`unsupported dsse version: ${t.apiVersion}`})}}function zHt(t,e){if(t.spec.signatures?.length!==1)throw new RL.VerificationError({code:"TLOG_BODY_ERROR",message:"signature count mismatch"});let r=t.spec.signatures[0].signature;if(!e.compareSignature(Buffer.from(r,"base64")))throw new RL.VerificationError({code:"TLOG_BODY_ERROR",message:"tlog entry signature mismatch"});let s=t.spec.payloadHash?.value||"";if(!e.compareDigest(Buffer.from(s,"hex")))throw new RL.VerificationError({code:"TLOG_BODY_ERROR",message:"DSSE payload hash mismatch"})}});var eOe=L(uz=>{"use strict";Object.defineProperty(uz,"__esModule",{value:!0});uz.verifyHashedRekordTLogBody=ZHt;var cz=Co();function ZHt(t,e){switch(t.apiVersion){case"0.0.1":return XHt(t,e);default:throw new cz.VerificationError({code:"TLOG_BODY_ERROR",message:`unsupported hashedrekord version: ${t.apiVersion}`})}}function XHt(t,e){let r=t.spec.signature.content||"";if(!e.compareSignature(Buffer.from(r,"base64")))throw new cz.VerificationError({code:"TLOG_BODY_ERROR",message:"signature mismatch"});let s=t.spec.data.hash?.value||"";if(!e.compareDigest(Buffer.from(s,"hex")))throw new cz.VerificationError({code:"TLOG_BODY_ERROR",message:"digest mismatch"})}});var tOe=L(fz=>{"use strict";Object.defineProperty(fz,"__esModule",{value:!0});fz.verifyIntotoTLogBody=$Ht;var FL=Co();function $Ht(t,e){switch(t.apiVersion){case"0.0.2":return ejt(t,e);default:throw new FL.VerificationError({code:"TLOG_BODY_ERROR",message:`unsupported intoto version: ${t.apiVersion}`})}}function ejt(t,e){if(t.spec.content.envelope.signatures?.length!==1)throw new FL.VerificationError({code:"TLOG_BODY_ERROR",message:"signature count mismatch"});let r=tjt(t.spec.content.envelope.signatures[0].sig);if(!e.compareSignature(Buffer.from(r,"base64")))throw new FL.VerificationError({code:"TLOG_BODY_ERROR",message:"tlog entry signature mismatch"});let s=t.spec.content.payloadHash?.value||"";if(!e.compareDigest(Buffer.from(s,"hex")))throw new FL.VerificationError({code:"TLOG_BODY_ERROR",message:"DSSE payload hash mismatch"})}function tjt(t){return Buffer.from(t,"base64").toString("utf-8")}});var nOe=L(Az=>{"use strict";Object.defineProperty(Az,"__esModule",{value:!0});Az.verifyTLogBody=sjt;var rOe=Co(),rjt=$Ne(),njt=eOe(),ijt=tOe();function sjt(t,e){let{kind:r,version:s}=t.kindVersion,a=JSON.parse(t.canonicalizedBody.toString("utf8"));if(r!==a.kind||s!==a.apiVersion)throw new rOe.VerificationError({code:"TLOG_BODY_ERROR",message:`kind/version mismatch - expected: ${r}/${s}, received: ${a.kind}/${a.apiVersion}`});switch(a.kind){case"dsse":return(0,rjt.verifyDSSETLogBody)(a,e);case"intoto":return(0,ijt.verifyIntotoTLogBody)(a,e);case"hashedrekord":return(0,njt.verifyHashedRekordTLogBody)(a,e);default:throw new rOe.VerificationError({code:"TLOG_BODY_ERROR",message:`unsupported kind: ${r}`})}}});var lOe=L(NL=>{"use strict";Object.defineProperty(NL,"__esModule",{value:!0});NL.Verifier=void 0;var ojt=ye("util"),B1=Co(),iOe=GNe(),sOe=YNe(),oOe=XNe(),ajt=nOe(),pz=class{constructor(e,r={}){this.trustMaterial=e,this.options={ctlogThreshold:r.ctlogThreshold??1,tlogThreshold:r.tlogThreshold??1,tsaThreshold:r.tsaThreshold??0}}verify(e,r){let s=this.verifyTimestamps(e),a=this.verifySigningKey(e,s);return this.verifyTLogs(e),this.verifySignature(e,a),r&&this.verifyPolicy(r,a.identity||{}),a}verifyTimestamps(e){let r=0,s=0,a=e.timestamps.map(n=>{switch(n.$case){case"timestamp-authority":return s++,(0,oOe.verifyTSATimestamp)(n.timestamp,e.signature.signature,this.trustMaterial.timestampAuthorities);case"transparency-log":return r++,(0,oOe.verifyTLogTimestamp)(n.tlogEntry,this.trustMaterial.tlogs)}});if(aOe(a))throw new B1.VerificationError({code:"TIMESTAMP_ERROR",message:"duplicate timestamp"});if(rn.timestamp)}verifySigningKey({key:e},r){switch(e.$case){case"public-key":return(0,iOe.verifyPublicKey)(e.hint,r,this.trustMaterial);case"certificate":{let s=(0,iOe.verifyCertificate)(e.certificate,r,this.trustMaterial);if(aOe(s.scts))throw new B1.VerificationError({code:"CERTIFICATE_ERROR",message:"duplicate SCT"});if(s.scts.length(0,ajt.verifyTLogBody)(s,e))}verifySignature(e,r){if(!e.signature.verifySignature(r.key))throw new B1.VerificationError({code:"SIGNATURE_ERROR",message:"signature verification failed"})}verifyPolicy(e,r){e.subjectAlternativeName&&(0,sOe.verifySubjectAlternativeName)(e.subjectAlternativeName,r.subjectAlternativeName),e.extensions&&(0,sOe.verifyExtensions)(e.extensions,r.extensions)}};NL.Verifier=pz;function aOe(t){for(let e=0;e{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.Verifier=ou.toTrustMaterial=ou.VerificationError=ou.PolicyError=ou.toSignedEntity=void 0;var ljt=LNe();Object.defineProperty(ou,"toSignedEntity",{enumerable:!0,get:function(){return ljt.toSignedEntity}});var cOe=Co();Object.defineProperty(ou,"PolicyError",{enumerable:!0,get:function(){return cOe.PolicyError}});Object.defineProperty(ou,"VerificationError",{enumerable:!0,get:function(){return cOe.VerificationError}});var cjt=hy();Object.defineProperty(ou,"toTrustMaterial",{enumerable:!0,get:function(){return cjt.toTrustMaterial}});var ujt=lOe();Object.defineProperty(ou,"Verifier",{enumerable:!0,get:function(){return ujt.Verifier}})});var uOe=L(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.DEFAULT_TIMEOUT=Na.DEFAULT_RETRY=void 0;Na.createBundleBuilder=pjt;Na.createKeyFinder=hjt;Na.createVerificationPolicy=gjt;var fjt=wl(),v1=SK(),Ajt=OL();Na.DEFAULT_RETRY={retries:2};Na.DEFAULT_TIMEOUT=5e3;function pjt(t,e){let r={signer:djt(e),witnesses:yjt(e)};switch(t){case"messageSignature":return new v1.MessageSignatureBundleBuilder(r);case"dsseEnvelope":return new v1.DSSEBundleBuilder({...r,certificateChain:e.legacyCompatibility})}}function hjt(t){return e=>{let r=t(e);if(!r)throw new Ajt.VerificationError({code:"PUBLIC_KEY_ERROR",message:`key not found: ${e}`});return{publicKey:fjt.crypto.createPublicKey(r),validFor:()=>!0}}}function gjt(t){let e={},r=t.certificateIdentityEmail||t.certificateIdentityURI;return r&&(e.subjectAlternativeName=r),t.certificateIssuer&&(e.extensions={issuer:t.certificateIssuer}),e}function djt(t){return new v1.FulcioSigner({fulcioBaseURL:t.fulcioURL,identityProvider:t.identityProvider||mjt(t),retry:t.retry??Na.DEFAULT_RETRY,timeout:t.timeout??Na.DEFAULT_TIMEOUT})}function mjt(t){let e=t.identityToken;return e?{getToken:()=>Promise.resolve(e)}:new v1.CIContextProvider("sigstore")}function yjt(t){let e=[];return Ejt(t)&&e.push(new v1.RekorWitness({rekorBaseURL:t.rekorURL,entryType:t.legacyCompatibility?"intoto":"dsse",fetchOnConflict:!1,retry:t.retry??Na.DEFAULT_RETRY,timeout:t.timeout??Na.DEFAULT_TIMEOUT})),Ijt(t)&&e.push(new v1.TSAWitness({tsaBaseURL:t.tsaServerURL,retry:t.retry??Na.DEFAULT_RETRY,timeout:t.timeout??Na.DEFAULT_TIMEOUT})),e}function Ejt(t){return t.tlogUpload!==!1}function Ijt(t){return t.tsaServerURL!==void 0}});var pOe=L(au=>{"use strict";var Cjt=au&&au.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),wjt=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fOe=au&&au.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[s.length]=a);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),a=0;aa.verify(t,s))}async function AOe(t={}){let e=await Bjt.getTrustedRoot({mirrorURL:t.tufMirrorURL,rootPath:t.tufRootPath,cachePath:t.tufCachePath,forceCache:t.tufForceCache,retry:t.retry??S1.DEFAULT_RETRY,timeout:t.timeout??S1.DEFAULT_TIMEOUT}),r=t.keySelector?S1.createKeyFinder(t.keySelector):void 0,s=(0,hz.toTrustMaterial)(e,r),a={ctlogThreshold:t.ctLogThreshold,tlogThreshold:t.tlogThreshold},n=new hz.Verifier(s,a),c=S1.createVerificationPolicy(t);return{verify:(f,p)=>{let h=(0,gz.bundleFromJSON)(f),E=(0,hz.toSignedEntity)(h,p);n.verify(E,c)}}}});var gOe=L(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.verify=Fi.sign=Fi.createVerifier=Fi.attest=Fi.VerificationError=Fi.PolicyError=Fi.TUFError=Fi.InternalError=Fi.DEFAULT_REKOR_URL=Fi.DEFAULT_FULCIO_URL=Fi.ValidationError=void 0;var bjt=Nb();Object.defineProperty(Fi,"ValidationError",{enumerable:!0,get:function(){return bjt.ValidationError}});var dz=SK();Object.defineProperty(Fi,"DEFAULT_FULCIO_URL",{enumerable:!0,get:function(){return dz.DEFAULT_FULCIO_URL}});Object.defineProperty(Fi,"DEFAULT_REKOR_URL",{enumerable:!0,get:function(){return dz.DEFAULT_REKOR_URL}});Object.defineProperty(Fi,"InternalError",{enumerable:!0,get:function(){return dz.InternalError}});var Pjt=wL();Object.defineProperty(Fi,"TUFError",{enumerable:!0,get:function(){return Pjt.TUFError}});var hOe=OL();Object.defineProperty(Fi,"PolicyError",{enumerable:!0,get:function(){return hOe.PolicyError}});Object.defineProperty(Fi,"VerificationError",{enumerable:!0,get:function(){return hOe.VerificationError}});var LL=pOe();Object.defineProperty(Fi,"attest",{enumerable:!0,get:function(){return LL.attest}});Object.defineProperty(Fi,"createVerifier",{enumerable:!0,get:function(){return LL.createVerifier}});Object.defineProperty(Fi,"sign",{enumerable:!0,get:function(){return LL.sign}});Object.defineProperty(Fi,"verify",{enumerable:!0,get:function(){return LL.verify}})});var GOe=L((xSr,qOe)=>{var M6t=t3();function _6t(t){return M6t(t)?void 0:t}qOe.exports=_6t});var YOe=L((kSr,WOe)=>{var U6t=RT(),H6t=x5(),j6t=R5(),q6t=wm(),G6t=Jd(),W6t=GOe(),Y6t=BG(),V6t=P5(),K6t=1,J6t=2,z6t=4,Z6t=Y6t(function(t,e){var r={};if(t==null)return r;var s=!1;e=U6t(e,function(n){return n=q6t(n,t),s||(s=n.length>1),n}),G6t(t,V6t(t),r),s&&(r=H6t(r,K6t|J6t|z6t,W6t));for(var a=e.length;a--;)j6t(r,e[a]);return r});WOe.exports=Z6t});bt();Ve();bt();var ZOe=ye("child_process"),XOe=et(Nd());Wt();var tC=new Map([]);var iS={};Vt(iS,{BaseCommand:()=>ut,WorkspaceRequiredError:()=>ar,getCli:()=>cwe,getDynamicLibs:()=>lwe,getPluginConfiguration:()=>nC,openWorkspace:()=>rC,pluginCommands:()=>tC,runExit:()=>zR});Wt();var ut=class extends ot{constructor(){super(...arguments);this.cwd=ge.String("--cwd",{hidden:!0})}validateAndExecute(){if(typeof this.cwd<"u")throw new nt("The --cwd option is ambiguous when used anywhere else than the very first parameter provided in the command line, before even the command path");return super.validateAndExecute()}};Ve();bt();Wt();var ar=class extends nt{constructor(e,r){let s=K.relative(e,r),a=K.join(e,Ht.fileName);super(`This command can only be run from within a workspace of your project (${s} isn't a workspace of ${a}).`)}};Ve();bt();rA();Bc();bv();Wt();var zwt=et(fi());Ul();var lwe=()=>new Map([["@yarnpkg/cli",iS],["@yarnpkg/core",nS],["@yarnpkg/fslib",q2],["@yarnpkg/libzip",Sv],["@yarnpkg/parsers",Z2],["@yarnpkg/shell",Qv],["clipanion",cB],["semver",zwt],["typanion",Ia]]);Ve();async function rC(t,e){let{project:r,workspace:s}=await Tt.find(t,e);if(!s)throw new ar(r.cwd,e);return s}Ve();bt();rA();Bc();bv();Wt();var oqt=et(fi());Ul();var $5={};Vt($5,{AddCommand:()=>aC,BinCommand:()=>lC,CacheCleanCommand:()=>cC,ClipanionCommand:()=>gC,ConfigCommand:()=>pC,ConfigGetCommand:()=>uC,ConfigSetCommand:()=>fC,ConfigUnsetCommand:()=>AC,DedupeCommand:()=>hC,EntryCommand:()=>mC,ExecCommand:()=>EC,ExplainCommand:()=>wC,ExplainPeerRequirementsCommand:()=>IC,HelpCommand:()=>dC,InfoCommand:()=>BC,LinkCommand:()=>SC,NodeCommand:()=>DC,PluginCheckCommand:()=>bC,PluginImportCommand:()=>kC,PluginImportSourcesCommand:()=>QC,PluginListCommand:()=>PC,PluginRemoveCommand:()=>TC,PluginRuntimeCommand:()=>RC,RebuildCommand:()=>FC,RemoveCommand:()=>NC,RunCommand:()=>LC,RunIndexCommand:()=>OC,SetResolutionCommand:()=>MC,SetVersionCommand:()=>CC,SetVersionSourcesCommand:()=>xC,UnlinkCommand:()=>_C,UpCommand:()=>UC,VersionCommand:()=>yC,WhyCommand:()=>HC,WorkspaceCommand:()=>YC,WorkspacesListCommand:()=>WC,YarnCommand:()=>vC,dedupeUtils:()=>oF,default:()=>WSt,suggestUtils:()=>Xu});var UBe=et(Nd());Ve();Ve();Ve();Wt();var z1e=et(lS());Ul();var Xu={};Vt(Xu,{Modifier:()=>B5,Strategy:()=>nF,Target:()=>cS,WorkspaceModifier:()=>W1e,applyModifier:()=>d2t,extractDescriptorFromPath:()=>v5,extractRangeModifier:()=>Y1e,fetchDescriptorFrom:()=>S5,findProjectDescriptors:()=>J1e,getModifier:()=>uS,getSuggestedDescriptors:()=>fS,makeWorkspaceDescriptor:()=>K1e,toWorkspaceModifier:()=>V1e});Ve();Ve();bt();var w5=et(fi()),h2t="workspace:",cS=(s=>(s.REGULAR="dependencies",s.DEVELOPMENT="devDependencies",s.PEER="peerDependencies",s))(cS||{}),B5=(s=>(s.CARET="^",s.TILDE="~",s.EXACT="",s))(B5||{}),W1e=(s=>(s.CARET="^",s.TILDE="~",s.EXACT="*",s))(W1e||{}),nF=(n=>(n.KEEP="keep",n.REUSE="reuse",n.PROJECT="project",n.LATEST="latest",n.CACHE="cache",n))(nF||{});function uS(t,e){return t.exact?"":t.caret?"^":t.tilde?"~":e.configuration.get("defaultSemverRangePrefix")}var g2t=/^([\^~]?)[0-9]+(?:\.[0-9]+){0,2}(?:-\S+)?$/;function Y1e(t,{project:e}){let r=t.match(g2t);return r?r[1]:e.configuration.get("defaultSemverRangePrefix")}function d2t(t,e){let{protocol:r,source:s,params:a,selector:n}=q.parseRange(t.range);return w5.default.valid(n)&&(n=`${e}${t.range}`),q.makeDescriptor(t,q.makeRange({protocol:r,source:s,params:a,selector:n}))}function V1e(t){switch(t){case"^":return"^";case"~":return"~";case"":return"*";default:throw new Error(`Assertion failed: Unknown modifier: "${t}"`)}}function K1e(t,e){return q.makeDescriptor(t.anchoredDescriptor,`${h2t}${V1e(e)}`)}async function J1e(t,{project:e,target:r}){let s=new Map,a=n=>{let c=s.get(n.descriptorHash);return c||s.set(n.descriptorHash,c={descriptor:n,locators:[]}),c};for(let n of e.workspaces)if(r==="peerDependencies"){let c=n.manifest.peerDependencies.get(t.identHash);c!==void 0&&a(c).locators.push(n.anchoredLocator)}else{let c=n.manifest.dependencies.get(t.identHash),f=n.manifest.devDependencies.get(t.identHash);r==="devDependencies"?f!==void 0?a(f).locators.push(n.anchoredLocator):c!==void 0&&a(c).locators.push(n.anchoredLocator):c!==void 0?a(c).locators.push(n.anchoredLocator):f!==void 0&&a(f).locators.push(n.anchoredLocator)}return s}async function v5(t,{cwd:e,workspace:r}){return await y2t(async s=>{K.isAbsolute(t)||(t=K.relative(r.cwd,K.resolve(e,t)),t.match(/^\.{0,2}\//)||(t=`./${t}`));let{project:a}=r,n=await S5(q.makeIdent(null,"archive"),t,{project:r.project,cache:s,workspace:r});if(!n)throw new Error("Assertion failed: The descriptor should have been found");let c=new Wi,f=a.configuration.makeResolver(),p=a.configuration.makeFetcher(),h={checksums:a.storedChecksums,project:a,cache:s,fetcher:p,report:c,resolver:f},E=f.bindDescriptor(n,r.anchoredLocator,h),C=q.convertDescriptorToLocator(E),S=await p.fetch(C,h),P=await Ht.find(S.prefixPath,{baseFs:S.packageFs});if(!P.name)throw new Error("Target path doesn't have a name");return q.makeDescriptor(P.name,t)})}function m2t(t){if(t.range==="unknown")return{type:"resolve",range:"latest"};if(Or.validRange(t.range))return{type:"fixed",range:t.range};if(Hp.test(t.range))return{type:"resolve",range:t.range};let e=t.range.match(/^(?:jsr:|npm:)(.*)/);if(!e)return{type:"fixed",range:t.range};let[,r]=e,s=`${q.stringifyIdent(t)}@`;return r.startsWith(s)&&(r=r.slice(s.length)),Or.validRange(r)?{type:"fixed",range:t.range}:Hp.test(r)?{type:"resolve",range:t.range}:{type:"fixed",range:t.range}}async function fS(t,{project:e,workspace:r,cache:s,target:a,fixed:n,modifier:c,strategies:f,maxResults:p=1/0}){if(!(p>=0))throw new Error(`Invalid maxResults (${p})`);let h=!n||t.range==="unknown"?m2t(t):{type:"fixed",range:t.range};if(h.type==="fixed")return{suggestions:[{descriptor:t,name:`Use ${q.prettyDescriptor(e.configuration,t)}`,reason:"(unambiguous explicit request)"}],rejections:[]};let E=typeof r<"u"&&r!==null&&r.manifest[a].get(t.identHash)||null,C=[],S=[],P=async I=>{try{await I()}catch(R){S.push(R)}};for(let I of f){if(C.length>=p)break;switch(I){case"keep":await P(async()=>{E&&C.push({descriptor:E,name:`Keep ${q.prettyDescriptor(e.configuration,E)}`,reason:"(no changes)"})});break;case"reuse":await P(async()=>{for(let{descriptor:R,locators:N}of(await J1e(t,{project:e,target:a})).values()){if(N.length===1&&N[0].locatorHash===r.anchoredLocator.locatorHash&&f.includes("keep"))continue;let U=`(originally used by ${q.prettyLocator(e.configuration,N[0])}`;U+=N.length>1?` and ${N.length-1} other${N.length>2?"s":""})`:")",C.push({descriptor:R,name:`Reuse ${q.prettyDescriptor(e.configuration,R)}`,reason:U})}});break;case"cache":await P(async()=>{for(let R of e.storedDescriptors.values())R.identHash===t.identHash&&C.push({descriptor:R,name:`Reuse ${q.prettyDescriptor(e.configuration,R)}`,reason:"(already used somewhere in the lockfile)"})});break;case"project":await P(async()=>{if(r.manifest.name!==null&&t.identHash===r.manifest.name.identHash)return;let R=e.tryWorkspaceByIdent(t);if(R===null)return;let N=K1e(R,c);C.push({descriptor:N,name:`Attach ${q.prettyDescriptor(e.configuration,N)}`,reason:`(local workspace at ${he.pretty(e.configuration,R.relativeCwd,he.Type.PATH)})`})});break;case"latest":{let R=e.configuration.get("enableNetwork"),N=e.configuration.get("enableOfflineMode");await P(async()=>{if(a==="peerDependencies")C.push({descriptor:q.makeDescriptor(t,"*"),name:"Use *",reason:"(catch-all peer dependency pattern)"});else if(!R&&!N)C.push({descriptor:null,name:"Resolve from latest",reason:he.pretty(e.configuration,"(unavailable because enableNetwork is toggled off)","grey")});else{let U=await S5(t,h.range,{project:e,cache:s,workspace:r,modifier:c});U&&C.push({descriptor:U,name:`Use ${q.prettyDescriptor(e.configuration,U)}`,reason:`(resolved from ${N?"the cache":"latest"})`})}})}break}}return{suggestions:C.slice(0,p),rejections:S.slice(0,p)}}async function S5(t,e,{project:r,cache:s,workspace:a,preserveModifier:n=!0,modifier:c}){let f=r.configuration.normalizeDependency(q.makeDescriptor(t,e)),p=new Wi,h=r.configuration.makeFetcher(),E=r.configuration.makeResolver(),C={project:r,fetcher:h,cache:s,checksums:r.storedChecksums,report:p,cacheOptions:{skipIntegrityCheck:!0}},S={...C,resolver:E,fetchOptions:C},P=E.bindDescriptor(f,a.anchoredLocator,S),I=await E.getCandidates(P,{},S);if(I.length===0)return null;let R=I[0],{protocol:N,source:U,params:W,selector:te}=q.parseRange(q.convertToManifestRange(R.reference));if(N===r.configuration.get("defaultProtocol")&&(N=null),w5.default.valid(te)){let ie=te;if(typeof c<"u")te=c+te;else if(n!==!1){let me=typeof n=="string"?n:f.range;te=Y1e(me,{project:r})+te}let Ae=q.makeDescriptor(R,q.makeRange({protocol:N,source:U,params:W,selector:te}));(await E.getCandidates(r.configuration.normalizeDependency(Ae),{},S)).length!==1&&(te=ie)}return q.makeDescriptor(R,q.makeRange({protocol:N,source:U,params:W,selector:te}))}async function y2t(t){return await le.mktempPromise(async e=>{let r=ze.create(e);return r.useWithSource(e,{enableMirror:!1,compressionLevel:0},e,{overwrite:!0}),await t(new Jr(e,{configuration:r,check:!1,immutable:!1}))})}var aC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.fixed=ge.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=ge.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=ge.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=ge.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.dev=ge.Boolean("-D,--dev",!1,{description:"Add a package as a dev dependency"});this.peer=ge.Boolean("-P,--peer",!1,{description:"Add a package as a peer dependency"});this.optional=ge.Boolean("-O,--optional",!1,{description:"Add / upgrade a package to an optional regular / peer dependency"});this.preferDev=ge.Boolean("--prefer-dev",!1,{description:"Add / upgrade a package to a dev dependency"});this.interactive=ge.Boolean("-i,--interactive",{description:"Reuse the specified package from other workspaces in the project"});this.cached=ge.Boolean("--cached",!1,{description:"Reuse the highest version already used somewhere within the project"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Ao(ec)});this.silent=ge.Boolean("--silent",{hidden:!0});this.packages=ge.Rest()}static{this.paths=[["add"]]}static{this.usage=ot.Usage({description:"add dependencies to the project",details:"\n This command adds a package to the package.json for the nearest workspace.\n\n - If it didn't exist before, the package will by default be added to the regular `dependencies` field, but this behavior can be overriden thanks to the `-D,--dev` flag (which will cause the dependency to be added to the `devDependencies` field instead) and the `-P,--peer` flag (which will do the same but for `peerDependencies`).\n\n - If the package was already listed in your dependencies, it will by default be upgraded whether it's part of your `dependencies` or `devDependencies` (it won't ever update `peerDependencies`, though).\n\n - If set, the `--prefer-dev` flag will operate as a more flexible `-D,--dev` in that it will add the package to your `devDependencies` if it isn't already listed in either `dependencies` or `devDependencies`, but it will also happily upgrade your `dependencies` if that's what you already use (whereas `-D,--dev` would throw an exception).\n\n - If set, the `-O,--optional` flag will add the package to the `optionalDependencies` field and, in combination with the `-P,--peer` flag, it will add the package as an optional peer dependency. If the package was already listed in your `dependencies`, it will be upgraded to `optionalDependencies`. If the package was already listed in your `peerDependencies`, in combination with the `-P,--peer` flag, it will be upgraded to an optional peer dependency: `\"peerDependenciesMeta\": { \"\": { \"optional\": true } }`\n\n - If the added package doesn't specify a range at all its `latest` tag will be resolved and the returned version will be used to generate a new semver range (using the `^` modifier by default unless otherwise configured via the `defaultSemverRangePrefix` configuration, or the `~` modifier if `-T,--tilde` is specified, or no modifier at all if `-E,--exact` is specified). Two exceptions to this rule: the first one is that if the package is a workspace then its local version will be used, and the second one is that if you use `-P,--peer` the default range will be `*` and won't be resolved at all.\n\n - If the added package specifies a range (such as `^1.0.0`, `latest`, or `rc`), Yarn will add this range as-is in the resulting package.json entry (in particular, tags such as `rc` will be encoded as-is rather than being converted into a semver range).\n\n If the `--cached` option is used, Yarn will preferably reuse the highest version already used somewhere within the project, even if through a transitive dependency.\n\n If the `-i,--interactive` option is used (or if the `preferInteractive` settings is toggled on) the command will first try to check whether other workspaces in the project use the specified package and, if so, will offer to reuse them.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n For a compilation of all the supported protocols, please consult the dedicated page from our website: https://yarnpkg.com/protocols.\n ",examples:[["Add a regular package to the current workspace","$0 add lodash"],["Add a specific version for a package to the current workspace","$0 add lodash@1.2.3"],["Add a package from a GitHub repository (the master branch) to the current workspace using a URL","$0 add lodash@https://github.com/lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol","$0 add lodash@github:lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol (shorthand)","$0 add lodash@lodash/lodash"],["Add a package from a specific branch of a GitHub repository to the current workspace using the GitHub protocol (shorthand)","$0 add lodash-es@lodash/lodash#es"],["Add a local package (gzipped tarball format) to the current workspace","$0 add local-package-name@file:../path/to/local-package-name-v0.1.2.tgz"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=this.fixed,f=r.isInteractive({interactive:this.interactive,stdout:this.context.stdout}),p=f||r.get("preferReuse"),h=uS(this,s),E=[p?"reuse":void 0,"project",this.cached?"cache":void 0,"latest"].filter(W=>typeof W<"u"),C=f?1/0:1,S=W=>{let te=q.tryParseDescriptor(W.slice(4));return te?te.range==="unknown"?q.makeDescriptor(te,`jsr:${q.stringifyIdent(te)}@latest`):q.makeDescriptor(te,`jsr:${te.range}`):null},P=await Promise.all(this.packages.map(async W=>{let te=W.match(/^\.{0,2}\//)?await v5(W,{cwd:this.context.cwd,workspace:a}):W.startsWith("jsr:")?S(W):q.tryParseDescriptor(W),ie=W.match(/^(https?:|git@github)/);if(ie)throw new nt(`It seems you are trying to add a package using a ${he.pretty(r,`${ie[0]}...`,he.Type.RANGE)} url; we now require package names to be explicitly specified. +Try running the command again with the package name prefixed: ${he.pretty(r,"yarn add",he.Type.CODE)} ${he.pretty(r,q.makeDescriptor(q.makeIdent(null,"my-package"),`${ie[0]}...`),he.Type.DESCRIPTOR)}`);if(!te)throw new nt(`The ${he.pretty(r,W,he.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);let Ae=E2t(a,te,{dev:this.dev,peer:this.peer,preferDev:this.preferDev,optional:this.optional});return await Promise.all(Ae.map(async me=>{let pe=await fS(te,{project:s,workspace:a,cache:n,fixed:c,target:me,modifier:h,strategies:E,maxResults:C});return{request:te,suggestedDescriptors:pe,target:me}}))})).then(W=>W.flat()),I=await uA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async W=>{for(let{request:te,suggestedDescriptors:{suggestions:ie,rejections:Ae}}of P)if(ie.filter(me=>me.descriptor!==null).length===0){let[me]=Ae;if(typeof me>"u")throw new Error("Assertion failed: Expected an error to have been set");s.configuration.get("enableNetwork")?W.reportError(27,`${q.prettyDescriptor(r,te)} can't be resolved to a satisfying range`):W.reportError(27,`${q.prettyDescriptor(r,te)} can't be resolved to a satisfying range (note: network resolution has been disabled)`),W.reportSeparator(),W.reportExceptionOnce(me)}});if(I.hasErrors())return I.exitCode();let R=!1,N=[],U=[];for(let{suggestedDescriptors:{suggestions:W},target:te}of P){let ie,Ae=W.filter(Be=>Be.descriptor!==null),ce=Ae[0].descriptor,me=Ae.every(Be=>q.areDescriptorsEqual(Be.descriptor,ce));Ae.length===1||me?ie=ce:(R=!0,{answer:ie}=await(0,z1e.prompt)({type:"select",name:"answer",message:"Which range do you want to use?",choices:W.map(({descriptor:Be,name:Ce,reason:g})=>Be?{name:Ce,hint:g,descriptor:Be}:{name:Ce,hint:g,disabled:!0}),onCancel:()=>process.exit(130),result(Be){return this.find(Be,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let pe=a.manifest[te].get(ie.identHash);(typeof pe>"u"||pe.descriptorHash!==ie.descriptorHash)&&(a.manifest[te].set(ie.identHash,ie),this.optional&&(te==="dependencies"?a.manifest.ensureDependencyMeta({...ie,range:"unknown"}).optional=!0:te==="peerDependencies"&&(a.manifest.ensurePeerDependencyMeta({...ie,range:"unknown"}).optional=!0)),typeof pe>"u"?N.push([a,te,ie,E]):U.push([a,te,pe,ie]))}return await r.triggerMultipleHooks(W=>W.afterWorkspaceDependencyAddition,N),await r.triggerMultipleHooks(W=>W.afterWorkspaceDependencyReplacement,U),R&&this.context.stdout.write(` +`),await s.installWithNewReport({json:this.json,stdout:this.context.stdout,quiet:this.context.quiet},{cache:n,mode:this.mode})}};function E2t(t,e,{dev:r,peer:s,preferDev:a,optional:n}){let c=t.manifest.dependencies.has(e.identHash),f=t.manifest.devDependencies.has(e.identHash),p=t.manifest.peerDependencies.has(e.identHash);if((r||s)&&c)throw new nt(`Package "${q.prettyIdent(t.project.configuration,e)}" is already listed as a regular dependency - remove the -D,-P flags or remove it from your dependencies first`);if(!r&&!s&&p)throw new nt(`Package "${q.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - use either of -D or -P, or remove it from your peer dependencies first`);if(n&&f)throw new nt(`Package "${q.prettyIdent(t.project.configuration,e)}" is already listed as a dev dependency - remove the -O flag or remove it from your dev dependencies first`);if(n&&!s&&p)throw new nt(`Package "${q.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);if((r||a)&&n)throw new nt(`Package "${q.prettyIdent(t.project.configuration,e)}" cannot simultaneously be a dev dependency and an optional dependency`);let h=[];return s&&h.push("peerDependencies"),(r||a)&&h.push("devDependencies"),n&&h.push("dependencies"),h.length>0?h:f?["devDependencies"]:p?["peerDependencies"]:["dependencies"]}Ve();Ve();Wt();var lC=class extends ut{constructor(){super(...arguments);this.verbose=ge.Boolean("-v,--verbose",!1,{description:"Print both the binary name and the locator of the package that provides the binary"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.name=ge.String({required:!1})}static{this.paths=[["bin"]]}static{this.usage=ot.Usage({description:"get the path to a binary script",details:` + When used without arguments, this command will print the list of all the binaries available in the current workspace. Adding the \`-v,--verbose\` flag will cause the output to contain both the binary name and the locator of the package that provides the binary. + + When an argument is specified, this command will just print the path to the binary on the standard output and exit. Note that the reported path may be stored within a zip archive. + `,examples:[["List all the available binaries","$0 bin"],["Print the path to a specific binary","$0 bin eslint"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,locator:a}=await Tt.find(r,this.context.cwd);if(await s.restoreInstallState(),this.name){let f=(await In.getPackageAccessibleBinaries(a,{project:s})).get(this.name);if(!f)throw new nt(`Couldn't find a binary named "${this.name}" for package "${q.prettyLocator(r,a)}"`);let[,p]=f;return this.context.stdout.write(`${p} +`),0}return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async c=>{let f=await In.getPackageAccessibleBinaries(a,{project:s}),h=Array.from(f.keys()).reduce((E,C)=>Math.max(E,C.length),0);for(let[E,[C,S]]of f)c.reportJson({name:E,source:q.stringifyIdent(C),path:S});if(this.verbose)for(let[E,[C]]of f)c.reportInfo(null,`${E.padEnd(h," ")} ${q.prettyLocator(r,C)}`);else for(let E of f.keys())c.reportInfo(null,E)})).exitCode()}};Ve();bt();Wt();var cC=class extends ut{constructor(){super(...arguments);this.mirror=ge.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=ge.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}static{this.paths=[["cache","clean"],["cache","clear"]]}static{this.usage=ot.Usage({description:"remove the shared cache files",details:` + This command will remove all the files from the cache. + `,examples:[["Remove all the local archives","$0 cache clean"],["Remove all the archives stored in the ~/.yarn directory","$0 cache clean --mirror"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(!r.get("enableCacheClean"))throw new nt("Cache cleaning is currently disabled. To enable it, set `enableCacheClean: true` in your configuration file. Note: Cache cleaning is typically not required and should be avoided when using Zero-Installs.");let s=await Jr.find(r);return(await Ot.start({configuration:r,stdout:this.context.stdout},async()=>{let n=(this.all||this.mirror)&&s.mirrorCwd!==null,c=!this.mirror;n&&(await le.removePromise(s.mirrorCwd),await r.triggerHook(f=>f.cleanGlobalArtifacts,r)),c&&await le.removePromise(s.cwd)})).exitCode()}};Ve();Wt();var X1e=et(AS()),D5=ye("util"),uC=class extends ut{constructor(){super(...arguments);this.why=ge.Boolean("--why",!1,{description:"Print the explanation for why a setting has its value"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=ge.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=ge.String()}static{this.paths=[["config","get"]]}static{this.usage=ot.Usage({description:"read a configuration settings",details:` + This command will print a configuration setting. + + Secrets (such as tokens) will be redacted from the output by default. If this behavior isn't desired, set the \`--no-redacted\` to get the untransformed value. + `,examples:[["Print a simple configuration setting","yarn config get yarnPath"],["Print a complex configuration setting","yarn config get packageExtensions"],["Print a nested field from the configuration",`yarn config get 'npmScopes["my-company"].npmRegistryServer'`],["Print a token from the configuration","yarn config get npmAuthToken --no-redacted"],["Print a configuration setting as JSON","yarn config get packageExtensions --json"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=this.name.replace(/[.[].*$/,""),a=this.name.replace(/^[^.[]*/,"");if(typeof r.settings.get(s)>"u")throw new nt(`Couldn't find a configuration settings named "${s}"`);let c=r.getSpecial(s,{hideSecrets:!this.unsafe,getNativePaths:!0}),f=je.convertMapsToIndexableObjects(c),p=a?(0,X1e.default)(f,a):f,h=await Ot.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async E=>{E.reportJson(p)});if(!this.json){if(typeof p=="string")return this.context.stdout.write(`${p} +`),h.exitCode();D5.inspect.styles.name="cyan",this.context.stdout.write(`${(0,D5.inspect)(p,{depth:1/0,colors:r.get("enableColors"),compact:!1})} +`)}return h.exitCode()}};Ve();Wt();var j2e=et(k5()),q2e=et(AS()),G2e=et(Q5()),T5=ye("util"),fC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=ge.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ge.String();this.value=ge.String()}static{this.paths=[["config","set"]]}static{this.usage=ot.Usage({description:"change a configuration settings",details:` + This command will set a configuration setting. + + When used without the \`--json\` flag, it can only set a simple configuration setting (a string, a number, or a boolean). + + When used with the \`--json\` flag, it can set both simple and complex configuration settings, including Arrays and Objects. + `,examples:[["Set a simple configuration setting (a string, a number, or a boolean)","yarn config set initScope myScope"],["Set a simple configuration setting (a string, a number, or a boolean) using the `--json` flag",'yarn config set initScope --json \\"myScope\\"'],["Set a complex configuration setting (an Array) using the `--json` flag",`yarn config set unsafeHttpWhitelist --json '["*.example.com", "example.com"]'`],["Set a complex configuration setting (an Object) using the `--json` flag",`yarn config set packageExtensions --json '{ "@babel/parser@*": { "dependencies": { "@babel/types": "*" } } }'`],["Set a nested configuration setting",'yarn config set npmScopes.company.npmRegistryServer "https://npm.example.com"'],["Set a nested configuration setting using indexed access for non-simple keys",`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=()=>{if(!r.projectCwd)throw new nt("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new nt(`Couldn't find a configuration settings named "${a}"`);if(a==="enableStrictSettings")throw new nt("This setting only affects the file it's in, and thus cannot be set from the CLI");let f=this.json?JSON.parse(this.value):this.value;await(this.home?I=>ze.updateHomeConfiguration(I):I=>ze.updateConfiguration(s(),I))(I=>{if(n){let R=(0,j2e.default)(I);return(0,G2e.default)(R,this.name,f),R}else return{...I,[a]:f}});let E=(await ze.find(this.context.cwd,this.context.plugins)).getSpecial(a,{hideSecrets:!0,getNativePaths:!0}),C=je.convertMapsToIndexableObjects(E),S=n?(0,q2e.default)(C,n):C;return(await Ot.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async I=>{T5.inspect.styles.name="cyan",I.reportInfo(0,`Successfully set ${this.name} to ${(0,T5.inspect)(S,{depth:1/0,colors:r.get("enableColors"),compact:!1})}`)})).exitCode()}};Ve();Wt();var tBe=et(k5()),rBe=et(K2e()),nBe=et(F5()),AC=class extends ut{constructor(){super(...arguments);this.home=ge.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ge.String()}static{this.paths=[["config","unset"]]}static{this.usage=ot.Usage({description:"unset a configuration setting",details:` + This command will unset a configuration setting. + `,examples:[["Unset a simple configuration setting","yarn config unset initScope"],["Unset a complex configuration setting","yarn config unset packageExtensions"],["Unset a nested configuration setting","yarn config unset npmScopes.company.npmRegistryServer"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=()=>{if(!r.projectCwd)throw new nt("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new nt(`Couldn't find a configuration settings named "${a}"`);let f=this.home?h=>ze.updateHomeConfiguration(h):h=>ze.updateConfiguration(s(),h);return(await Ot.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async h=>{let E=!1;await f(C=>{if(!(0,rBe.default)(C,this.name))return h.reportWarning(0,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),E=!0,C;let S=n?(0,tBe.default)(C):{...C};return(0,nBe.default)(S,this.name),S}),E||h.reportInfo(0,`Successfully unset ${this.name}`)})).exitCode()}};Ve();bt();Wt();var sF=ye("util"),pC=class extends ut{constructor(){super(...arguments);this.noDefaults=ge.Boolean("--no-defaults",!1,{description:"Omit the default values from the display"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.verbose=ge.Boolean("-v,--verbose",{hidden:!0});this.why=ge.Boolean("--why",{hidden:!0});this.names=ge.Rest()}static{this.paths=[["config"]]}static{this.usage=ot.Usage({description:"display the current configuration",details:` + This command prints the current active configuration settings. + `,examples:[["Print the active configuration settings","$0 config"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins,{strict:!1}),s=await DI({configuration:r,stdout:this.context.stdout,forceError:this.json},[{option:this.verbose,message:"The --verbose option is deprecated, the settings' descriptions are now always displayed"},{option:this.why,message:"The --why option is deprecated, the settings' sources are now always displayed"}]);if(s!==null)return s;let a=this.names.length>0?[...new Set(this.names)].sort():[...r.settings.keys()].sort(),n,c=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async f=>{if(r.invalid.size>0&&!this.json){for(let[p,h]of r.invalid)f.reportError(34,`Invalid configuration key "${p}" in ${h}`);f.reportSeparator()}if(this.json)for(let p of a){if(this.noDefaults&&!r.sources.has(p))continue;let h=r.settings.get(p);typeof h>"u"&&f.reportError(34,`No configuration key named "${p}"`);let E=r.getSpecial(p,{hideSecrets:!0,getNativePaths:!0}),C=r.sources.get(p)??"",S=C&&C[0]!=="<"?ue.fromPortablePath(C):C;f.reportJson({key:p,effective:E,source:S,...h})}else{let p={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},h={},E={children:h};for(let C of a){if(this.noDefaults&&!r.sources.has(C))continue;let S=r.settings.get(C),P=r.sources.get(C)??"",I=r.getSpecial(C,{hideSecrets:!0,getNativePaths:!0}),R={Description:{label:"Description",value:he.tuple(he.Type.MARKDOWN,{text:S.description,format:this.cli.format(),paragraphs:!1})},Source:{label:"Source",value:he.tuple(P[0]==="<"?he.Type.CODE:he.Type.PATH,P)}};h[C]={value:he.tuple(he.Type.CODE,C),children:R};let N=(U,W)=>{for(let[te,ie]of W)if(ie instanceof Map){let Ae={};U[te]={children:Ae},N(Ae,ie)}else U[te]={label:te,value:he.tuple(he.Type.NO_HINT,(0,sF.inspect)(ie,p))}};I instanceof Map?N(R,I):R.Value={label:"Value",value:he.tuple(he.Type.NO_HINT,(0,sF.inspect)(I,p))}}a.length!==1&&(n=void 0),ks.emitTree(E,{configuration:r,json:this.json,stdout:this.context.stdout,separators:2})}});if(!this.json&&typeof n<"u"){let f=a[0],p=(0,sF.inspect)(r.getSpecial(f,{hideSecrets:!0,getNativePaths:!0}),{colors:r.get("enableColors")});this.context.stdout.write(` +`),this.context.stdout.write(`${p} +`)}return c.exitCode()}};Ve();Wt();Ul();var oF={};Vt(oF,{Strategy:()=>pS,acceptedStrategies:()=>tSt,dedupe:()=>N5});Ve();Ve();var iBe=et(Sa()),pS=(e=>(e.HIGHEST="highest",e))(pS||{}),tSt=new Set(Object.values(pS)),rSt={highest:async(t,e,{resolver:r,fetcher:s,resolveOptions:a,fetchOptions:n})=>{let c=new Map;for(let[p,h]of t.storedResolutions){let E=t.storedDescriptors.get(p);if(typeof E>"u")throw new Error(`Assertion failed: The descriptor (${p}) should have been registered`);je.getSetWithDefault(c,E.identHash).add(h)}let f=new Map(je.mapAndFilter(t.storedDescriptors.values(),p=>q.isVirtualDescriptor(p)?je.mapAndFilter.skip:[p.descriptorHash,je.makeDeferred()]));for(let p of t.storedDescriptors.values()){let h=f.get(p.descriptorHash);if(typeof h>"u")throw new Error(`Assertion failed: The descriptor (${p.descriptorHash}) should have been registered`);let E=t.storedResolutions.get(p.descriptorHash);if(typeof E>"u")throw new Error(`Assertion failed: The resolution (${p.descriptorHash}) should have been registered`);let C=t.originalPackages.get(E);if(typeof C>"u")throw new Error(`Assertion failed: The package (${E}) should have been registered`);Promise.resolve().then(async()=>{let S=r.getResolutionDependencies(p,a),P=Object.fromEntries(await je.allSettledSafe(Object.entries(S).map(async([te,ie])=>{let Ae=f.get(ie.descriptorHash);if(typeof Ae>"u")throw new Error(`Assertion failed: The descriptor (${ie.descriptorHash}) should have been registered`);let ce=await Ae.promise;if(!ce)throw new Error("Assertion failed: Expected the dependency to have been through the dedupe process itself");return[te,ce.updatedPackage]})));if(e.length&&!iBe.default.isMatch(q.stringifyIdent(p),e)||!r.shouldPersistResolution(C,a))return C;let I=c.get(p.identHash);if(typeof I>"u")throw new Error(`Assertion failed: The resolutions (${p.identHash}) should have been registered`);if(I.size===1)return C;let R=[...I].map(te=>{let ie=t.originalPackages.get(te);if(typeof ie>"u")throw new Error(`Assertion failed: The package (${te}) should have been registered`);return ie}),N=await r.getSatisfying(p,P,R,a),U=N.locators?.[0];if(typeof U>"u"||!N.sorted)return C;let W=t.originalPackages.get(U.locatorHash);if(typeof W>"u")throw new Error(`Assertion failed: The package (${U.locatorHash}) should have been registered`);return W}).then(async S=>{let P=await t.preparePackage(S,{resolver:r,resolveOptions:a});h.resolve({descriptor:p,currentPackage:C,updatedPackage:S,resolvedPackage:P})}).catch(S=>{h.reject(S)})}return[...f.values()].map(p=>p.promise)}};async function N5(t,{strategy:e,patterns:r,cache:s,report:a}){let{configuration:n}=t,c=new Wi,f=n.makeResolver(),p=n.makeFetcher(),h={cache:s,checksums:t.storedChecksums,fetcher:p,project:t,report:c,cacheOptions:{skipIntegrityCheck:!0}},E={project:t,resolver:f,report:c,fetchOptions:h};return await a.startTimerPromise("Deduplication step",async()=>{let C=rSt[e],S=await C(t,r,{resolver:f,resolveOptions:E,fetcher:p,fetchOptions:h}),P=ho.progressViaCounter(S.length);await a.reportProgress(P);let I=0;await Promise.all(S.map(U=>U.then(W=>{if(W===null||W.currentPackage.locatorHash===W.updatedPackage.locatorHash)return;I++;let{descriptor:te,currentPackage:ie,updatedPackage:Ae}=W;a.reportInfo(0,`${q.prettyDescriptor(n,te)} can be deduped from ${q.prettyLocator(n,ie)} to ${q.prettyLocator(n,Ae)}`),a.reportJson({descriptor:q.stringifyDescriptor(te),currentResolution:q.stringifyLocator(ie),updatedResolution:q.stringifyLocator(Ae)}),t.storedResolutions.set(te.descriptorHash,Ae.locatorHash)}).finally(()=>P.tick())));let R;switch(I){case 0:R="No packages";break;case 1:R="One package";break;default:R=`${I} packages`}let N=he.pretty(n,e,he.Type.CODE);return a.reportInfo(0,`${R} can be deduped using the ${N} strategy`),I})}var hC=class extends ut{constructor(){super(...arguments);this.strategy=ge.String("-s,--strategy","highest",{description:"The strategy to use when deduping dependencies",validator:Ao(pS)});this.check=ge.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Ao(ec)});this.patterns=ge.Rest()}static{this.paths=[["dedupe"]]}static{this.usage=ot.Usage({description:"deduplicate dependencies with overlapping ranges",details:"\n Duplicates are defined as descriptors with overlapping ranges being resolved and locked to different locators. They are a natural consequence of Yarn's deterministic installs, but they can sometimes pile up and unnecessarily increase the size of your project.\n\n This command dedupes dependencies in the current project using different strategies (only one is implemented at the moment):\n\n - `highest`: Reuses (where possible) the locators with the highest versions. This means that dependencies can only be upgraded, never downgraded. It's also guaranteed that it never takes more than a single pass to dedupe the entire dependency tree.\n\n **Note:** Even though it never produces a wrong dependency tree, this command should be used with caution, as it modifies the dependency tree, which can sometimes cause problems when packages don't strictly follow semver recommendations. Because of this, it is recommended to also review the changes manually.\n\n If set, the `-c,--check` flag will only report the found duplicates, without persisting the modified dependency tree. If changes are found, the command will exit with a non-zero exit code, making it suitable for CI purposes.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n ### In-depth explanation:\n\n Yarn doesn't deduplicate dependencies by default, otherwise installs wouldn't be deterministic and the lockfile would be useless. What it actually does is that it tries to not duplicate dependencies in the first place.\n\n **Example:** If `foo@^2.3.4` (a dependency of a dependency) has already been resolved to `foo@2.3.4`, running `yarn add foo@*`will cause Yarn to reuse `foo@2.3.4`, even if the latest `foo` is actually `foo@2.10.14`, thus preventing unnecessary duplication.\n\n Duplication happens when Yarn can't unlock dependencies that have already been locked inside the lockfile.\n\n **Example:** If `foo@^2.3.4` (a dependency of a dependency) has already been resolved to `foo@2.3.4`, running `yarn add foo@2.10.14` will cause Yarn to install `foo@2.10.14` because the existing resolution doesn't satisfy the range `2.10.14`. This behavior can lead to (sometimes) unwanted duplication, since now the lockfile contains 2 separate resolutions for the 2 `foo` descriptors, even though they have overlapping ranges, which means that the lockfile can be simplified so that both descriptors resolve to `foo@2.10.14`.\n ",examples:[["Dedupe all packages","$0 dedupe"],["Dedupe all packages using a specific strategy","$0 dedupe --strategy highest"],["Dedupe a specific package","$0 dedupe lodash"],["Dedupe all packages with the `@babel/*` scope","$0 dedupe '@babel/*'"],["Check for duplicates (can be used as a CI step)","$0 dedupe --check"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd),a=await Jr.find(r);await s.restoreInstallState({restoreResolutions:!1});let n=0,c=await Ot.start({configuration:r,includeFooter:!1,stdout:this.context.stdout,json:this.json},async f=>{n=await N5(s,{strategy:this.strategy,patterns:this.patterns,cache:a,report:f})});return c.hasErrors()?c.exitCode():this.check?n?1:0:await s.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:a,mode:this.mode})}};Ve();Wt();var gC=class extends ut{static{this.paths=[["--clipanion=definitions"]]}async execute(){let{plugins:e}=await ze.find(this.context.cwd,this.context.plugins),r=[];for(let c of e){let{commands:f}=c[1];if(f){let h=wa.from(f).definitions();r.push([c[0],h])}}let s=this.cli.definitions(),a=(c,f)=>c.split(" ").slice(1).join()===f.split(" ").slice(1).join(),n=sBe()["@yarnpkg/builder"].bundles.standard;for(let c of r){let f=c[1];for(let p of f)s.find(h=>a(h.path,p.path)).plugin={name:c[0],isDefault:n.includes(c[0])}}this.context.stdout.write(`${JSON.stringify(s,null,2)} +`)}};var dC=class extends ut{static{this.paths=[["help"],["--help"],["-h"]]}async execute(){this.context.stdout.write(this.cli.usage(null))}};Ve();bt();Wt();var mC=class extends ut{constructor(){super(...arguments);this.leadingArgument=ge.String();this.args=ge.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!q.tryParseIdent(this.leadingArgument)){let r=K.resolve(this.context.cwd,ue.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:r})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}};Ve();var yC=class extends ut{static{this.paths=[["-v"],["--version"]]}async execute(){this.context.stdout.write(`${un||""} +`)}};Ve();Ve();Wt();var EC=class extends ut{constructor(){super(...arguments);this.commandName=ge.String();this.args=ge.Proxy()}static{this.paths=[["exec"]]}static{this.usage=ot.Usage({description:"execute a shell script",details:` + This command simply executes a shell script within the context of the root directory of the active workspace using the portable shell. + + It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment). + `,examples:[["Execute a single shell command","$0 exec echo Hello World"],["Execute a shell script",'$0 exec "tsc & babel src --out-dir lib"']]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,locator:a}=await Tt.find(r,this.context.cwd);return await s.restoreInstallState(),await In.executePackageShellcode(a,this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,project:s})}};Ve();Wt();Ul();var IC=class extends ut{constructor(){super(...arguments);this.hash=ge.String({required:!1,validator:Jx(wE(),[tB(/^p[0-9a-f]{5}$/)])})}static{this.paths=[["explain","peer-requirements"]]}static{this.usage=ot.Usage({description:"explain a set of peer requirements",details:` + A peer requirement represents all peer requests that a subject must satisfy when providing a requested package to requesters. + + When the hash argument is specified, this command prints a detailed explanation of the peer requirement corresponding to the hash and whether it is satisfied or not. + + When used without arguments, this command lists all peer requirements and the corresponding hash that can be used to get detailed information about a given requirement. + + **Note:** A hash is a six-letter p-prefixed code that can be obtained from peer dependency warnings or from the list of all peer requirements (\`yarn explain peer-requirements\`). + `,examples:[["Explain the corresponding peer requirement for a hash","$0 explain peer-requirements p1a4ed"],["List all peer requirements","$0 explain peer-requirements"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);return await s.restoreInstallState({restoreResolutions:!1}),await s.applyLightResolution(),typeof this.hash<"u"?await iSt(this.hash,s,{stdout:this.context.stdout}):await sSt(s,{stdout:this.context.stdout})}};async function iSt(t,e,r){let s=e.peerRequirementNodes.get(t);if(typeof s>"u")throw new Error(`No peerDependency requirements found for hash: "${t}"`);let a=new Set,n=p=>a.has(p.requester.locatorHash)?{value:he.tuple(he.Type.DEPENDENT,{locator:p.requester,descriptor:p.descriptor}),children:p.children.size>0?[{value:he.tuple(he.Type.NO_HINT,"...")}]:[]}:(a.add(p.requester.locatorHash),{value:he.tuple(he.Type.DEPENDENT,{locator:p.requester,descriptor:p.descriptor}),children:Object.fromEntries(Array.from(p.children.values(),h=>[q.stringifyLocator(h.requester),n(h)]))}),c=e.peerWarnings.find(p=>p.hash===t);return(await Ot.start({configuration:e.configuration,stdout:r.stdout,includeFooter:!1,includePrefix:!1},async p=>{let h=he.mark(e.configuration),E=c?h.Cross:h.Check;if(p.reportInfo(0,`Package ${he.pretty(e.configuration,s.subject,he.Type.LOCATOR)} is requested to provide ${he.pretty(e.configuration,s.ident,he.Type.IDENT)} by its descendants`),p.reportSeparator(),p.reportInfo(0,he.pretty(e.configuration,s.subject,he.Type.LOCATOR)),ks.emitTree({children:Object.fromEntries(Array.from(s.requests.values(),C=>[q.stringifyLocator(C.requester),n(C)]))},{configuration:e.configuration,stdout:r.stdout,json:!1}),p.reportSeparator(),s.provided.range==="missing:"){let C=c?"":" , but all peer requests are optional";p.reportInfo(0,`${E} Package ${he.pretty(e.configuration,s.subject,he.Type.LOCATOR)} does not provide ${he.pretty(e.configuration,s.ident,he.Type.IDENT)}${C}.`)}else{let C=e.storedResolutions.get(s.provided.descriptorHash);if(!C)throw new Error("Assertion failed: Expected the descriptor to be registered");let S=e.storedPackages.get(C);if(!S)throw new Error("Assertion failed: Expected the package to be registered");p.reportInfo(0,`${E} Package ${he.pretty(e.configuration,s.subject,he.Type.LOCATOR)} provides ${he.pretty(e.configuration,s.ident,he.Type.IDENT)} with version ${q.prettyReference(e.configuration,S.version??"0.0.0")}, ${c?"which does not satisfy all requests.":"which satisfies all requests"}`),c?.type===3&&(c.range?p.reportInfo(0,` The combined requested range is ${he.pretty(e.configuration,c.range,he.Type.RANGE)}`):p.reportInfo(0," Unfortunately, the requested ranges have no overlap"))}})).exitCode()}async function sSt(t,e){return(await Ot.start({configuration:t.configuration,stdout:e.stdout,includeFooter:!1,includePrefix:!1},async s=>{let a=he.mark(t.configuration),n=je.sortMap(t.peerRequirementNodes,[([,c])=>q.stringifyLocator(c.subject),([,c])=>q.stringifyIdent(c.ident)]);for(let[,c]of n.values()){if(!c.root)continue;let f=t.peerWarnings.find(E=>E.hash===c.hash),p=[...q.allPeerRequests(c)],h;if(p.length>2?h=` and ${p.length-1} other dependencies`:p.length===2?h=" and 1 other dependency":h="",c.provided.range!=="missing:"){let E=t.storedResolutions.get(c.provided.descriptorHash);if(!E)throw new Error("Assertion failed: Expected the resolution to have been registered");let C=t.storedPackages.get(E);if(!C)throw new Error("Assertion failed: Expected the provided package to have been registered");let S=`${he.pretty(t.configuration,c.hash,he.Type.CODE)} \u2192 ${f?a.Cross:a.Check} ${q.prettyLocator(t.configuration,c.subject)} provides ${q.prettyLocator(t.configuration,C)} to ${q.prettyLocator(t.configuration,p[0].requester)}${h}`;f?s.reportWarning(0,S):s.reportInfo(0,S)}else{let E=`${he.pretty(t.configuration,c.hash,he.Type.CODE)} \u2192 ${f?a.Cross:a.Check} ${q.prettyLocator(t.configuration,c.subject)} doesn't provide ${q.prettyIdent(t.configuration,c.ident)} to ${q.prettyLocator(t.configuration,p[0].requester)}${h}`;f?s.reportWarning(0,E):s.reportInfo(0,E)}}})).exitCode()}Ve();Wt();Ul();Ve();Ve();bt();Wt();var oBe=et(fi()),CC=class extends ut{constructor(){super(...arguments);this.useYarnPath=ge.Boolean("--yarn-path",{description:"Set the yarnPath setting even if the version can be accessed by Corepack"});this.onlyIfNeeded=ge.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=ge.String()}static{this.paths=[["set","version"]]}static{this.usage=ot.Usage({description:"lock the Yarn version used by the project",details:"\n This command will set a specific release of Yarn to be used by Corepack: https://nodejs.org/api/corepack.html.\n\n By default it only will set the `packageManager` field at the root of your project, but if the referenced release cannot be represented this way, if you already have `yarnPath` configured, or if you set the `--yarn-path` command line flag, then the release will also be downloaded from the Yarn GitHub repository, stored inside your project, and referenced via the `yarnPath` settings from your project `.yarnrc.yml` file.\n\n A very good use case for this command is to enforce the version of Yarn used by any single member of your team inside the same project - by doing this you ensure that you have control over Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting different behavior.\n\n The version specifier can be:\n\n - a tag:\n - `latest` / `berry` / `stable` -> the most recent stable berry (`>=2.0.0`) release\n - `canary` -> the most recent canary (release candidate) berry (`>=2.0.0`) release\n - `classic` -> the most recent classic (`^0.x || ^1.x`) release\n\n - a semver range (e.g. `2.x`) -> the most recent version satisfying the range (limited to berry releases)\n\n - a semver version (e.g. `2.4.1`, `1.22.1`)\n\n - a local file referenced through either a relative or absolute path\n\n - `self` -> the version used to invoke the command\n ",examples:[["Download the latest release from the Yarn repository","$0 set version latest"],["Download the latest canary release from the Yarn repository","$0 set version canary"],["Download the latest classic release from the Yarn repository","$0 set version classic"],["Download the most recent Yarn 3 build","$0 set version 3.x"],["Download a specific Yarn 2 build","$0 set version 2.0.0-rc.30"],["Switch back to a specific Yarn 1 release","$0 set version 1.22.1"],["Use a release from the local filesystem","$0 set version ./yarn.cjs"],["Use a release from a URL","$0 set version https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js"],["Download the version used to invoke the command","$0 set version self"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(this.onlyIfNeeded&&r.get("yarnPath")){let f=r.sources.get("yarnPath");if(!f)throw new Error("Assertion failed: Expected 'yarnPath' to have a source");let p=r.projectCwd??r.startingCwd;if(K.contains(p,f))return 0}let s=()=>{if(typeof un>"u")throw new nt("The --install flag can only be used without explicit version specifier from the Yarn CLI");return`file://${process.argv[1]}`},a,n=(f,p)=>({version:p,url:f.replace(/\{\}/g,p)});if(this.version==="self")a={url:s(),version:un??"self"};else if(this.version==="latest"||this.version==="berry"||this.version==="stable")a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await hS(r,"stable"));else if(this.version==="canary")a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await hS(r,"canary"));else if(this.version==="classic")a={url:"https://classic.yarnpkg.com/latest.js",version:"classic"};else if(this.version.match(/^https?:/))a={url:this.version,version:"remote"};else if(this.version.match(/^\.{0,2}[\\/]/)||ue.isAbsolute(this.version))a={url:`file://${K.resolve(ue.toPortablePath(this.version))}`,version:"file"};else if(Or.satisfiesWithPrereleases(this.version,">=2.0.0"))a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",this.version);else if(Or.satisfiesWithPrereleases(this.version,"^0.x || ^1.x"))a=n("https://github.com/yarnpkg/yarn/releases/download/v{}/yarn-{}.js",this.version);else if(Or.validRange(this.version))a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await oSt(r,this.version));else throw new nt(`Invalid version descriptor "${this.version}"`);return(await Ot.start({configuration:r,stdout:this.context.stdout,includeLogs:!this.context.quiet},async f=>{let p=async()=>{let h="file://";return a.url.startsWith(h)?(f.reportInfo(0,`Retrieving ${he.pretty(r,a.url,he.Type.PATH)}`),await le.readFilePromise(a.url.slice(h.length))):(f.reportInfo(0,`Downloading ${he.pretty(r,a.url,he.Type.URL)}`),await An.get(a.url,{configuration:r}))};await O5(r,a.version,p,{report:f,useYarnPath:this.useYarnPath})})).exitCode()}};async function oSt(t,e){let s=(await An.get("https://repo.yarnpkg.com/tags",{configuration:t,jsonResponse:!0})).tags.filter(a=>Or.satisfiesWithPrereleases(a,e));if(s.length===0)throw new nt(`No matching release found for range ${he.pretty(t,e,he.Type.RANGE)}.`);return s[0]}async function hS(t,e){let r=await An.get("https://repo.yarnpkg.com/tags",{configuration:t,jsonResponse:!0});if(!r.latest[e])throw new nt(`Tag ${he.pretty(t,e,he.Type.RANGE)} not found`);return r.latest[e]}async function O5(t,e,r,{report:s,useYarnPath:a}){let n,c=async()=>(typeof n>"u"&&(n=await r()),n);if(e===null){let te=await c();await le.mktempPromise(async ie=>{let Ae=K.join(ie,"yarn.cjs");await le.writeFilePromise(Ae,te);let{stdout:ce}=await Gr.execvp(process.execPath,[ue.fromPortablePath(Ae),"--version"],{cwd:ie,env:{...t.env,YARN_IGNORE_PATH:"1"}});if(e=ce.trim(),!oBe.default.valid(e))throw new Error(`Invalid semver version. ${he.pretty(t,"yarn --version",he.Type.CODE)} returned: +${e}`)})}let f=t.projectCwd??t.startingCwd,p=K.resolve(f,".yarn/releases"),h=K.resolve(p,`yarn-${e}.cjs`),E=K.relative(t.startingCwd,h),C=je.isTaggedYarnVersion(e),S=t.get("yarnPath"),P=!C,I=P||!!S||!!a;if(a===!1){if(P)throw new Yt(0,"You explicitly opted out of yarnPath usage in your command line, but the version you specified cannot be represented by Corepack");I=!1}else!I&&!process.env.COREPACK_ROOT&&(s.reportWarning(0,`You don't seem to have ${he.applyHyperlink(t,"Corepack","https://nodejs.org/api/corepack.html")} enabled; we'll have to rely on ${he.applyHyperlink(t,"yarnPath","https://yarnpkg.com/configuration/yarnrc#yarnPath")} instead`),I=!0);if(I){let te=await c();s.reportInfo(0,`Saving the new release in ${he.pretty(t,E,"magenta")}`),await le.removePromise(K.dirname(h)),await le.mkdirPromise(K.dirname(h),{recursive:!0}),await le.writeFilePromise(h,te,{mode:493}),await ze.updateConfiguration(f,{yarnPath:K.relative(f,h)})}else await le.removePromise(K.dirname(h)),await ze.updateConfiguration(f,{yarnPath:ze.deleteProperty});let R=await Ht.tryFind(f)||new Ht;R.packageManager=`yarn@${C?e:await hS(t,"stable")}`;let N={};R.exportTo(N);let U=K.join(f,Ht.fileName),W=`${JSON.stringify(N,null,R.indent)} +`;return await le.changeFilePromise(U,W,{automaticNewlines:!0}),{bundleVersion:e}}function aBe(t){return Dr[rk(t)]}var aSt=/## (?YN[0-9]{4}) - `(?[A-Z_]+)`\n\n(?
(?:.(?!##))+)/gs;async function lSt(t){let r=`https://repo.yarnpkg.com/${je.isTaggedYarnVersion(un)?un:await hS(t,"canary")}/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx`,s=await An.get(r,{configuration:t});return new Map(Array.from(s.toString().matchAll(aSt),({groups:a})=>{if(!a)throw new Error("Assertion failed: Expected the match to have been successful");let n=aBe(a.code);if(a.name!==n)throw new Error(`Assertion failed: Invalid error code data: Expected "${a.name}" to be named "${n}"`);return[a.code,a.details]}))}var wC=class extends ut{constructor(){super(...arguments);this.code=ge.String({required:!1,validator:rB(wE(),[tB(/^YN[0-9]{4}$/)])});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["explain"]]}static{this.usage=ot.Usage({description:"explain an error code",details:` + When the code argument is specified, this command prints its name and its details. + + When used without arguments, this command lists all error codes and their names. + `,examples:[["Explain an error code","$0 explain YN0006"],["List all error codes","$0 explain"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(typeof this.code<"u"){let s=aBe(this.code),a=he.pretty(r,s,he.Type.CODE),n=this.cli.format().header(`${this.code} - ${a}`),f=(await lSt(r)).get(this.code),p=typeof f<"u"?he.jsonOrPretty(this.json,r,he.tuple(he.Type.MARKDOWN,{text:f,format:this.cli.format(),paragraphs:!0})):`This error code does not have a description. + +You can help us by editing this page on GitHub \u{1F642}: +${he.jsonOrPretty(this.json,r,he.tuple(he.Type.URL,"https://github.com/yarnpkg/berry/blob/master/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx"))} +`;this.json?this.context.stdout.write(`${JSON.stringify({code:this.code,name:s,details:p})} +`):this.context.stdout.write(`${n} + +${p} +`)}else{let s={children:je.mapAndFilter(Object.entries(Dr),([a,n])=>Number.isNaN(Number(a))?je.mapAndFilter.skip:{label:Vf(Number(a)),value:he.tuple(he.Type.CODE,n)})};ks.emitTree(s,{configuration:r,stdout:this.context.stdout,json:this.json})}}};Ve();bt();Wt();var lBe=et(Sa()),BC=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=ge.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=ge.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=ge.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=ge.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=ge.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=ge.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=ge.Rest()}static{this.paths=[["info"]]}static{this.usage=ot.Usage({description:"see information related to packages",details:"\n This command prints various information related to the specified packages, accepting glob patterns.\n\n By default, if the locator reference is missing, Yarn will default to print the information about all the matching direct dependencies of the package for the active workspace. To instead print all versions of the package that are direct dependencies of any of your workspaces, use the `-A,--all` flag. Adding the `-R,--recursive` flag will also report transitive dependencies.\n\n Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options (`--dependents`, `--manifest`, `--virtuals`, ...) described in the option descriptions.\n\n Note that this command will only print the information directly related to the selected packages - if you wish to know why the package is there in the first place, use `yarn why` which will do just that (it also provides a `-R,--recursive` flag that may be of some help).\n ",examples:[["Show information about Lodash","$0 info lodash"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a&&!this.all)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let c=new Set(this.extra);this.cache&&c.add("cache"),this.dependents&&c.add("dependents"),this.manifest&&c.add("manifest");let f=(ie,{recursive:Ae})=>{let ce=ie.anchoredLocator.locatorHash,me=new Map,pe=[ce];for(;pe.length>0;){let Be=pe.shift();if(me.has(Be))continue;let Ce=s.storedPackages.get(Be);if(typeof Ce>"u")throw new Error("Assertion failed: Expected the package to be registered");if(me.set(Be,Ce),q.isVirtualLocator(Ce)&&pe.push(q.devirtualizeLocator(Ce).locatorHash),!(!Ae&&Be!==ce))for(let g of Ce.dependencies.values()){let we=s.storedResolutions.get(g.descriptorHash);if(typeof we>"u")throw new Error("Assertion failed: Expected the resolution to be registered");pe.push(we)}}return me.values()},p=({recursive:ie})=>{let Ae=new Map;for(let ce of s.workspaces)for(let me of f(ce,{recursive:ie}))Ae.set(me.locatorHash,me);return Ae.values()},h=({all:ie,recursive:Ae})=>ie&&Ae?s.storedPackages.values():ie?p({recursive:Ae}):f(a,{recursive:Ae}),E=({all:ie,recursive:Ae})=>{let ce=h({all:ie,recursive:Ae}),me=this.patterns.map(Ce=>{let g=q.parseLocator(Ce),we=lBe.default.makeRe(q.stringifyIdent(g)),Ee=q.isVirtualLocator(g),fe=Ee?q.devirtualizeLocator(g):g;return se=>{let X=q.stringifyIdent(se);if(!we.test(X))return!1;if(g.reference==="unknown")return!0;let De=q.isVirtualLocator(se),Re=De?q.devirtualizeLocator(se):se;return!(Ee&&De&&g.reference!==se.reference||fe.reference!==Re.reference)}}),pe=je.sortMap([...ce],Ce=>q.stringifyLocator(Ce));return{selection:pe.filter(Ce=>me.length===0||me.some(g=>g(Ce))),sortedLookup:pe}},{selection:C,sortedLookup:S}=E({all:this.all,recursive:this.recursive});if(C.length===0)throw new nt("No package matched your request");let P=new Map;if(this.dependents)for(let ie of S)for(let Ae of ie.dependencies.values()){let ce=s.storedResolutions.get(Ae.descriptorHash);if(typeof ce>"u")throw new Error("Assertion failed: Expected the resolution to be registered");je.getArrayWithDefault(P,ce).push(ie)}let I=new Map;for(let ie of S){if(!q.isVirtualLocator(ie))continue;let Ae=q.devirtualizeLocator(ie);je.getArrayWithDefault(I,Ae.locatorHash).push(ie)}let R={},N={children:R},U=r.makeFetcher(),W={project:s,fetcher:U,cache:n,checksums:s.storedChecksums,report:new Wi,cacheOptions:{skipIntegrityCheck:!0}},te=[async(ie,Ae,ce)=>{if(!Ae.has("manifest"))return;let me=await U.fetch(ie,W),pe;try{pe=await Ht.find(me.prefixPath,{baseFs:me.packageFs})}finally{me.releaseFs?.()}ce("Manifest",{License:he.tuple(he.Type.NO_HINT,pe.license),Homepage:he.tuple(he.Type.URL,pe.raw.homepage??null)})},async(ie,Ae,ce)=>{if(!Ae.has("cache"))return;let me=s.storedChecksums.get(ie.locatorHash)??null,pe=n.getLocatorPath(ie,me),Be;if(pe!==null)try{Be=await le.statPromise(pe)}catch{}let Ce=typeof Be<"u"?[Be.size,he.Type.SIZE]:void 0;ce("Cache",{Checksum:he.tuple(he.Type.NO_HINT,me),Path:he.tuple(he.Type.PATH,pe),Size:Ce})}];for(let ie of C){let Ae=q.isVirtualLocator(ie);if(!this.virtuals&&Ae)continue;let ce={},me={value:[ie,he.Type.LOCATOR],children:ce};if(R[q.stringifyLocator(ie)]=me,this.nameOnly){delete me.children;continue}let pe=I.get(ie.locatorHash);typeof pe<"u"&&(ce.Instances={label:"Instances",value:he.tuple(he.Type.NUMBER,pe.length)}),ce.Version={label:"Version",value:he.tuple(he.Type.NO_HINT,ie.version)};let Be=(g,we)=>{let Ee={};if(ce[g]=Ee,Array.isArray(we))Ee.children=we.map(fe=>({value:fe}));else{let fe={};Ee.children=fe;for(let[se,X]of Object.entries(we))typeof X>"u"||(fe[se]={label:se,value:X})}};if(!Ae){for(let g of te)await g(ie,c,Be);await r.triggerHook(g=>g.fetchPackageInfo,ie,c,Be)}ie.bin.size>0&&!Ae&&Be("Exported Binaries",[...ie.bin.keys()].map(g=>he.tuple(he.Type.PATH,g)));let Ce=P.get(ie.locatorHash);typeof Ce<"u"&&Ce.length>0&&Be("Dependents",Ce.map(g=>he.tuple(he.Type.LOCATOR,g))),ie.dependencies.size>0&&!Ae&&Be("Dependencies",[...ie.dependencies.values()].map(g=>{let we=s.storedResolutions.get(g.descriptorHash),Ee=typeof we<"u"?s.storedPackages.get(we)??null:null;return he.tuple(he.Type.RESOLUTION,{descriptor:g,locator:Ee})})),ie.peerDependencies.size>0&&Ae&&Be("Peer dependencies",[...ie.peerDependencies.values()].map(g=>{let we=ie.dependencies.get(g.identHash),Ee=typeof we<"u"?s.storedResolutions.get(we.descriptorHash)??null:null,fe=Ee!==null?s.storedPackages.get(Ee)??null:null;return he.tuple(he.Type.RESOLUTION,{descriptor:g,locator:fe})}))}ks.emitTree(N,{configuration:r,json:this.json,stdout:this.context.stdout,separators:this.nameOnly?0:2})}};Ve();bt();Bc();var aF=et(Nd());Wt();var L5=et(fi());Ul();var cSt=[{selector:t=>t===-1,name:"nodeLinker",value:"node-modules"},{selector:t=>t!==-1&&t<8,name:"enableGlobalCache",value:!1},{selector:t=>t!==-1&&t<8,name:"compressionLevel",value:"mixed"}],vC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.immutable=ge.Boolean("--immutable",{description:"Abort with an error exit code if the lockfile was to be modified"});this.immutableCache=ge.Boolean("--immutable-cache",{description:"Abort with an error exit code if the cache folder was to be modified"});this.refreshLockfile=ge.Boolean("--refresh-lockfile",{description:"Refresh the package metadata stored in the lockfile"});this.checkCache=ge.Boolean("--check-cache",{description:"Always refetch the packages and ensure that their checksums are consistent"});this.checkResolutions=ge.Boolean("--check-resolutions",{description:"Validates that the package resolutions are coherent"});this.inlineBuilds=ge.Boolean("--inline-builds",{description:"Verbosely print the output of the build steps of dependencies"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Ao(ec)});this.cacheFolder=ge.String("--cache-folder",{hidden:!0});this.frozenLockfile=ge.Boolean("--frozen-lockfile",{hidden:!0});this.ignoreEngines=ge.Boolean("--ignore-engines",{hidden:!0});this.nonInteractive=ge.Boolean("--non-interactive",{hidden:!0});this.preferOffline=ge.Boolean("--prefer-offline",{hidden:!0});this.production=ge.Boolean("--production",{hidden:!0});this.registry=ge.String("--registry",{hidden:!0});this.silent=ge.Boolean("--silent",{hidden:!0});this.networkTimeout=ge.String("--network-timeout",{hidden:!0})}static{this.paths=[["install"],ot.Default]}static{this.usage=ot.Usage({description:"install the project dependencies",details:"\n This command sets up your project if needed. The installation is split into four different steps that each have their own characteristics:\n\n - **Resolution:** First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ).\n\n - **Fetch:** Then we download all the dependencies if needed, and make sure that they're all stored within our cache (check the value of `cacheFolder` in `yarn config` to see where the cache files are stored).\n\n - **Link:** Then we send the dependency tree information to internal plugins tasked with writing them on the disk in some form (for example by generating the `.pnp.cjs` file you might know).\n\n - **Build:** Once the dependency tree has been written on the disk, the package manager will now be free to run the build scripts for all packages that might need it, in a topological order compatible with the way they depend on one another. See https://yarnpkg.com/advanced/lifecycle-scripts for detail.\n\n Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your `.pnp.cjs` file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.\n\n If the `--immutable` option is set (defaults to true on CI), Yarn will abort with an error exit code if the lockfile was to be modified (other paths can be added using the `immutablePatterns` configuration setting). For backward compatibility we offer an alias under the name of `--frozen-lockfile`, but it will be removed in a later release.\n\n If the `--immutable-cache` option is set, Yarn will abort with an error exit code if the cache folder was to be modified (either because files would be added, or because they'd be removed).\n\n If the `--refresh-lockfile` option is set, Yarn will keep the same resolution for the packages currently in the lockfile but will refresh their metadata. If used together with `--immutable`, it can validate that the lockfile information are consistent. This flag is enabled by default when Yarn detects it runs within a pull request context.\n\n If the `--check-cache` option is set, Yarn will always refetch the packages and will ensure that their checksum matches what's 1/ described in the lockfile 2/ inside the existing cache files (if present). This is recommended as part of your CI workflow if you're both following the Zero-Installs model and accepting PRs from third-parties, as they'd otherwise have the ability to alter the checked-in packages before submitting them.\n\n If the `--inline-builds` option is set, Yarn will verbosely print the output of the build steps of your dependencies (instead of writing them into individual files). This is likely useful mostly for debug purposes only when using Docker-like environments.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n ",examples:[["Install the project","$0 install"],["Validate a project when using Zero-Installs","$0 install --immutable --immutable-cache"],["Validate a project when using Zero-Installs (slightly safer if you accept external PRs)","$0 install --immutable --immutable-cache --check-cache"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);typeof this.inlineBuilds<"u"&&r.useWithSource("",{enableInlineBuilds:this.inlineBuilds},r.startingCwd,{overwrite:!0});let s=!!process.env.FUNCTION_TARGET||!!process.env.GOOGLE_RUNTIME,a=await DI({configuration:r,stdout:this.context.stdout},[{option:this.ignoreEngines,message:"The --ignore-engines option is deprecated; engine checking isn't a core feature anymore",error:!aF.default.VERCEL},{option:this.registry,message:"The --registry option is deprecated; prefer setting npmRegistryServer in your .yarnrc.yml file"},{option:this.preferOffline,message:"The --prefer-offline flag is deprecated; use the --cached flag with 'yarn add' instead",error:!aF.default.VERCEL},{option:this.production,message:"The --production option is deprecated on 'install'; use 'yarn workspaces focus' instead",error:!0},{option:this.nonInteractive,message:"The --non-interactive option is deprecated",error:!s},{option:this.frozenLockfile,message:"The --frozen-lockfile option is deprecated; use --immutable and/or --immutable-cache instead",callback:()=>this.immutable=this.frozenLockfile},{option:this.cacheFolder,message:"The cache-folder option has been deprecated; use rc settings instead",error:!aF.default.NETLIFY}]);if(a!==null)return a;let n=this.mode==="update-lockfile";if(n&&(this.immutable||this.immutableCache))throw new nt(`${he.pretty(r,"--immutable",he.Type.CODE)} and ${he.pretty(r,"--immutable-cache",he.Type.CODE)} cannot be used with ${he.pretty(r,"--mode=update-lockfile",he.Type.CODE)}`);let c=(this.immutable??r.get("enableImmutableInstalls"))&&!n,f=this.immutableCache&&!n;if(r.projectCwd!==null){let R=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async N=>{let U=!1;await ASt(r,c)&&(N.reportInfo(48,"Automatically removed core plugins that are now builtins \u{1F44D}"),U=!0),await fSt(r,c)&&(N.reportInfo(48,"Automatically fixed merge conflicts \u{1F44D}"),U=!0),U&&N.reportSeparator()});if(R.hasErrors())return R.exitCode()}if(r.projectCwd!==null){let R=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async N=>{if(ze.telemetry?.isNew)ze.telemetry.commitTips(),N.reportInfo(65,"Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry"),N.reportInfo(65,`Run ${he.pretty(r,"yarn config set --home enableTelemetry 0",he.Type.CODE)} to disable`),N.reportSeparator();else if(ze.telemetry?.shouldShowTips){let U=await An.get("https://repo.yarnpkg.com/tags",{configuration:r,jsonResponse:!0}).catch(()=>null);if(U!==null){let W=null;if(un!==null){let ie=L5.default.prerelease(un)?"canary":"stable",Ae=U.latest[ie];L5.default.gt(Ae,un)&&(W=[ie,Ae])}if(W)ze.telemetry.commitTips(),N.reportInfo(88,`${he.applyStyle(r,`A new ${W[0]} version of Yarn is available:`,he.Style.BOLD)} ${q.prettyReference(r,W[1])}!`),N.reportInfo(88,`Upgrade now by running ${he.pretty(r,`yarn set version ${W[1]}`,he.Type.CODE)}`),N.reportSeparator();else{let te=ze.telemetry.selectTip(U.tips);te&&(N.reportInfo(89,he.pretty(r,te.message,he.Type.MARKDOWN_INLINE)),te.url&&N.reportInfo(89,`Learn more at ${te.url}`),N.reportSeparator())}}}});if(R.hasErrors())return R.exitCode()}let{project:p,workspace:h}=await Tt.find(r,this.context.cwd),E=p.lockfileLastVersion;if(E!==null){let R=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async N=>{let U={};for(let W of cSt)W.selector(E)&&typeof r.sources.get(W.name)>"u"&&(r.use("",{[W.name]:W.value},p.cwd,{overwrite:!0}),U[W.name]=W.value);Object.keys(U).length>0&&(await ze.updateConfiguration(p.cwd,U),N.reportInfo(87,"Migrated your project to the latest Yarn version \u{1F680}"),N.reportSeparator())});if(R.hasErrors())return R.exitCode()}let C=await Jr.find(r,{immutable:f,check:this.checkCache});if(!h)throw new ar(p.cwd,this.context.cwd);await p.restoreInstallState({restoreResolutions:!1});let S=r.get("enableHardenedMode");S&&typeof r.sources.get("enableHardenedMode")>"u"&&await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async R=>{R.reportWarning(0,"Yarn detected that the current workflow is executed from a public pull request. For safety the hardened mode has been enabled."),R.reportWarning(0,`It will prevent malicious lockfile manipulations, in exchange for a slower install time. You can opt-out if necessary; check our ${he.applyHyperlink(r,"documentation","https://yarnpkg.com/features/security#hardened-mode")} for more details.`),R.reportSeparator()}),(this.refreshLockfile??S)&&(p.lockfileNeedsRefresh=!0);let P=this.checkResolutions??S;return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,forceSectionAlignment:!0,includeLogs:!0,includeVersion:!0},async R=>{await p.install({cache:C,report:R,immutable:c,checkResolutions:P,mode:this.mode})})).exitCode()}},uSt="<<<<<<<";async function fSt(t,e){if(!t.projectCwd)return!1;let r=K.join(t.projectCwd,Er.lockfile);if(!await le.existsPromise(r)||!(await le.readFilePromise(r,"utf8")).includes(uSt))return!1;if(e)throw new Yt(47,"Cannot autofix a lockfile when running an immutable install");let a=await Gr.execvp("git",["rev-parse","MERGE_HEAD","HEAD"],{cwd:t.projectCwd});if(a.code!==0&&(a=await Gr.execvp("git",["rev-parse","REBASE_HEAD","HEAD"],{cwd:t.projectCwd})),a.code!==0&&(a=await Gr.execvp("git",["rev-parse","CHERRY_PICK_HEAD","HEAD"],{cwd:t.projectCwd})),a.code!==0)throw new Yt(83,"Git returned an error when trying to find the commits pertaining to the conflict");let n=await Promise.all(a.stdout.trim().split(/\n/).map(async f=>{let p=await Gr.execvp("git",["show",`${f}:./${Er.lockfile}`],{cwd:t.projectCwd});if(p.code!==0)throw new Yt(83,`Git returned an error when trying to access the lockfile content in ${f}`);try{return ls(p.stdout)}catch{throw new Yt(46,"A variant of the conflicting lockfile failed to parse")}}));n=n.filter(f=>!!f.__metadata);for(let f of n){if(f.__metadata.version<7)for(let p of Object.keys(f)){if(p==="__metadata")continue;let h=q.parseDescriptor(p,!0),E=t.normalizeDependency(h),C=q.stringifyDescriptor(E);C!==p&&(f[C]=f[p],delete f[p])}for(let p of Object.keys(f)){if(p==="__metadata")continue;let h=f[p].checksum;typeof h>"u"||h.includes("/")||(f[p].checksum=`${f.__metadata.cacheKey}/${h}`)}}let c=Object.assign({},...n);c.__metadata.version=`${Math.min(...n.map(f=>parseInt(f.__metadata.version??0)))}`,c.__metadata.cacheKey="merged";for(let[f,p]of Object.entries(c))typeof p=="string"&&delete c[f];return await le.changeFilePromise(r,il(c),{automaticNewlines:!0}),!0}async function ASt(t,e){if(!t.projectCwd)return!1;let r=[],s=K.join(t.projectCwd,".yarn/plugins/@yarnpkg");return await ze.updateConfiguration(t.projectCwd,{plugins:n=>{if(!Array.isArray(n))return n;let c=n.filter(f=>{if(!f.path)return!0;let p=K.resolve(t.projectCwd,f.path),h=Ev.has(f.spec)&&K.contains(s,p);return h&&r.push(p),!h});return c.length===0?ze.deleteProperty:c.length===n.length?n:c}},{immutable:e})?(await Promise.all(r.map(async n=>{await le.removePromise(n)})),!0):!1}Ve();bt();Wt();var SC=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Link all workspaces belonging to the target projects to the current one"});this.private=ge.Boolean("-p,--private",!1,{description:"Also link private workspaces belonging to the target projects to the current one"});this.relative=ge.Boolean("-r,--relative",!1,{description:"Link workspaces using relative paths instead of absolute paths"});this.destinations=ge.Rest()}static{this.paths=[["link"]]}static{this.usage=ot.Usage({description:"connect the local project to another one",details:"\n This command will set a new `resolutions` field in the project-level manifest and point it to the workspace at the specified location (even if part of another project).\n ",examples:[["Register one or more remote workspaces for use in the current project","$0 link ~/ts-loader ~/jest"],["Register all workspaces from a remote project for use in the current project","$0 link ~/jest --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=s.topLevelWorkspace,f=[];for(let p of this.destinations){let h=K.resolve(this.context.cwd,ue.toPortablePath(p)),E=await ze.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:C,workspace:S}=await Tt.find(E,h);if(s.cwd===C.cwd)throw new nt(`Invalid destination '${p}'; Can't link the project to itself`);if(!S)throw new ar(C.cwd,h);if(this.all){let P=!1;for(let I of C.workspaces)I.manifest.name&&(!I.manifest.private||this.private)&&(f.push(I),P=!0);if(!P)throw new nt(`No workspace found to be linked in the target project: ${p}`)}else{if(!S.manifest.name)throw new nt(`The target workspace at '${p}' doesn't have a name and thus cannot be linked`);if(S.manifest.private&&!this.private)throw new nt(`The target workspace at '${p}' is marked private - use the --private flag to link it anyway`);f.push(S)}}for(let p of f){let h=q.stringifyIdent(p.anchoredLocator),E=this.relative?K.relative(s.cwd,p.cwd):p.cwd;c.manifest.resolutions.push({pattern:{descriptor:{fullName:h}},reference:`portal:${E}`})}return await s.installWithNewReport({stdout:this.context.stdout},{cache:n})}};Wt();var DC=class extends ut{constructor(){super(...arguments);this.args=ge.Proxy()}static{this.paths=[["node"]]}static{this.usage=ot.Usage({description:"run node with the hook already setup",details:` + This command simply runs Node. It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment). + + The Node process will use the exact same version of Node as the one used to run Yarn itself, which might be a good way to ensure that your commands always use a consistent Node version. + `,examples:[["Run a Node script","$0 node ./my-script.js"]]})}async execute(){return this.cli.run(["exec","node",...this.args])}};Ve();Wt();var bC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","check"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"find all third-party plugins that differ from their own spec",details:` + Check only the plugins from https. + + If this command detects any plugin differences in the CI environment, it will throw an error. + `,examples:[["find all third-party plugins that differ from their own spec","$0 plugin check"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=await ze.findRcFiles(this.context.cwd);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{for(let c of s)if(c.data?.plugins)for(let f of c.data.plugins){if(!f.checksum||!f.spec.match(/^https?:/))continue;let p=await An.get(f.spec,{configuration:r}),h=Nn.makeHash(p);if(f.checksum===h)continue;let E=he.pretty(r,f.path,he.Type.PATH),C=he.pretty(r,f.spec,he.Type.URL),S=`${E} is different from the file provided by ${C}`;n.reportJson({...f,newChecksum:h}),n.reportError(0,S)}})).exitCode()}};Ve();Ve();bt();Wt();var pBe=ye("os");Ve();bt();Wt();var cBe=ye("os");Ve();Bc();Wt();var pSt="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function Dm(t,e){let r=await An.get(pSt,{configuration:t}),s=ls(r.toString());return Object.fromEntries(Object.entries(s).filter(([a,n])=>!e||Or.satisfiesWithPrereleases(e,n.range??"<4.0.0-rc.1")))}var PC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","list"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"list the available official plugins",details:"\n This command prints the plugins available directly from the Yarn repository. Only those plugins can be referenced by name in `yarn plugin import`.\n ",examples:[["List the official plugins","$0 plugin list"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{let n=await Dm(r,un);for(let[c,{experimental:f,...p}]of Object.entries(n)){let h=c;f&&(h+=" [experimental]"),a.reportJson({name:c,experimental:f,...p}),a.reportInfo(null,h)}})).exitCode()}};var hSt=/^[0-9]+$/,gSt=process.platform==="win32";function uBe(t){return hSt.test(t)?`pull/${t}/head`:t}var dSt=({repository:t,branch:e},r)=>[["git","init",ue.fromPortablePath(r)],["git","remote","add","origin",t],["git","fetch","origin","--depth=1",uBe(e)],["git","reset","--hard","FETCH_HEAD"]],mSt=({branch:t})=>[["git","fetch","origin","--depth=1",uBe(t),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx","-e","packages/yarnpkg-cli/bundles"]],ySt=({plugins:t,noMinify:e},r,s)=>[["yarn","build:cli",...new Array().concat(...t.map(a=>["--plugin",K.resolve(s,a)])),...e?["--no-minify"]:[],"|"],[gSt?"move":"mv","packages/yarnpkg-cli/bundles/yarn.js",ue.fromPortablePath(r),"|"]],xC=class extends ut{constructor(){super(...arguments);this.installPath=ge.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ge.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ge.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=ge.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.dryRun=ge.Boolean("-n,--dry-run",!1,{description:"If set, the bundle will be built but not added to the project"});this.noMinify=ge.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=ge.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=ge.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}static{this.paths=[["set","version","from","sources"]]}static{this.usage=ot.Usage({description:"build Yarn from master",details:` + This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project. + + By default, it also updates all contrib plugins to the same commit the bundle is built from. This behavior can be disabled by using the \`--skip-plugins\` flag. + `,examples:[["Build Yarn from master","$0 set version from sources"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd),a=typeof this.installPath<"u"?K.resolve(this.context.cwd,ue.toPortablePath(this.installPath)):K.resolve(ue.toPortablePath((0,cBe.tmpdir)()),"yarnpkg-sources",Nn.makeHash(this.repository).slice(0,6));return(await Ot.start({configuration:r,stdout:this.context.stdout},async c=>{await M5(this,{configuration:r,report:c,target:a}),c.reportSeparator(),c.reportInfo(0,"Building a fresh bundle"),c.reportSeparator();let f=await Gr.execvp("git",["rev-parse","--short","HEAD"],{cwd:a,strict:!0}),p=K.join(a,`packages/yarnpkg-cli/bundles/yarn-${f.stdout.trim()}.js`);le.existsSync(p)||(await gS(ySt(this,p,a),{configuration:r,context:this.context,target:a}),c.reportSeparator());let h=await le.readFilePromise(p);if(!this.dryRun){let{bundleVersion:E}=await O5(r,null,async()=>h,{report:c});this.skipPlugins||await ESt(this,E,{project:s,report:c,target:a})}})).exitCode()}};async function gS(t,{configuration:e,context:r,target:s}){for(let[a,...n]of t){let c=n[n.length-1]==="|";if(c&&n.pop(),c)await Gr.pipevp(a,n,{cwd:s,stdin:r.stdin,stdout:r.stdout,stderr:r.stderr,strict:!0});else{r.stdout.write(`${he.pretty(e,` $ ${[a,...n].join(" ")}`,"grey")} +`);try{await Gr.execvp(a,n,{cwd:s,strict:!0})}catch(f){throw r.stdout.write(f.stdout||f.stack),f}}}}async function M5(t,{configuration:e,report:r,target:s}){let a=!1;if(!t.force&&le.existsSync(K.join(s,".git"))){r.reportInfo(0,"Fetching the latest commits"),r.reportSeparator();try{await gS(mSt(t),{configuration:e,context:t.context,target:s}),a=!0}catch{r.reportSeparator(),r.reportWarning(0,"Repository update failed; we'll try to regenerate it")}}a||(r.reportInfo(0,"Cloning the remote repository"),r.reportSeparator(),await le.removePromise(s),await le.mkdirPromise(s,{recursive:!0}),await gS(dSt(t,s),{configuration:e,context:t.context,target:s}))}async function ESt(t,e,{project:r,report:s,target:a}){let n=await Dm(r.configuration,e),c=new Set(Object.keys(n));for(let f of r.configuration.plugins.keys())c.has(f)&&await _5(f,t,{project:r,report:s,target:a})}Ve();Ve();bt();Wt();var fBe=et(fi()),ABe=ye("vm");var kC=class extends ut{constructor(){super(...arguments);this.name=ge.String();this.checksum=ge.Boolean("--checksum",!0,{description:"Whether to care if this plugin is modified"})}static{this.paths=[["plugin","import"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"download a plugin",details:` + This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations. + + Three types of plugin references are accepted: + + - If the plugin is stored within the Yarn repository, it can be referenced by name. + - Third-party plugins can be referenced directly through their public urls. + - Local plugins can be referenced by their path on the disk. + + If the \`--no-checksum\` option is set, Yarn will no longer care if the plugin is modified. + + Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package). + `,examples:[['Download and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import @yarnpkg/plugin-exec"],['Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import exec"],["Download and activate a community plugin","$0 plugin import https://example.org/path/to/plugin.js"],["Activate a local plugin","$0 plugin import ./path/to/plugin.js"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Ot.start({configuration:r,stdout:this.context.stdout},async a=>{let{project:n}=await Tt.find(r,this.context.cwd),c,f;if(this.name.match(/^\.{0,2}[\\/]/)||ue.isAbsolute(this.name)){let p=K.resolve(this.context.cwd,ue.toPortablePath(this.name));a.reportInfo(0,`Reading ${he.pretty(r,p,he.Type.PATH)}`),c=K.relative(n.cwd,p),f=await le.readFilePromise(p)}else{let p;if(this.name.match(/^https?:/)){try{new URL(this.name)}catch{throw new Yt(52,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}c=this.name,p=this.name}else{let h=q.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(h.reference!=="unknown"&&!fBe.default.valid(h.reference))throw new Yt(0,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let E=q.stringifyIdent(h),C=await Dm(r,un);if(!Object.hasOwn(C,E)){let S=`Couldn't find a plugin named ${q.prettyIdent(r,h)} on the remote registry. +`;throw r.plugins.has(E)?S+=`A plugin named ${q.prettyIdent(r,h)} is already installed; possibly attempting to import a built-in plugin.`:S+=`Note that only the plugins referenced on our website (${he.pretty(r,"https://github.com/yarnpkg/berry/blob/master/plugins.yml",he.Type.URL)}) can be referenced by their name; any other plugin will have to be referenced through its public url (for example ${he.pretty(r,"https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js",he.Type.URL)}).`,new Yt(51,S)}c=E,p=C[E].url,h.reference!=="unknown"?p=p.replace(/\/master\//,`/${E}/${h.reference}/`):un!==null&&(p=p.replace(/\/master\//,`/@yarnpkg/cli/${un}/`))}a.reportInfo(0,`Downloading ${he.pretty(r,p,"green")}`),f=await An.get(p,{configuration:r})}await U5(c,f,{checksum:this.checksum,project:n,report:a})})).exitCode()}};async function U5(t,e,{checksum:r=!0,project:s,report:a}){let{configuration:n}=s,c={},f={exports:c};(0,ABe.runInNewContext)(e.toString(),{module:f,exports:c});let h=`.yarn/plugins/${f.exports.name}.cjs`,E=K.resolve(s.cwd,h);a.reportInfo(0,`Saving the new plugin in ${he.pretty(n,h,"magenta")}`),await le.mkdirPromise(K.dirname(E),{recursive:!0}),await le.writeFilePromise(E,e);let C={path:h,spec:t};r&&(C.checksum=Nn.makeHash(e)),await ze.addPlugin(s.cwd,[C])}var ISt=({pluginName:t,noMinify:e},r)=>[["yarn",`build:${t}`,...e?["--no-minify"]:[],"|"]],QC=class extends ut{constructor(){super(...arguments);this.installPath=ge.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ge.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ge.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=ge.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=ge.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=ge.String()}static{this.paths=[["plugin","import","from","sources"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"build a plugin from sources",details:` + This command clones the Yarn repository into a temporary folder, builds the specified contrib plugin and updates the configuration to reference it in further CLI invocations. + + The plugins can be referenced by their short name if sourced from the official Yarn repository. + `,examples:[['Build and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import from sources @yarnpkg/plugin-exec"],['Build and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import from sources exec"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=typeof this.installPath<"u"?K.resolve(this.context.cwd,ue.toPortablePath(this.installPath)):K.resolve(ue.toPortablePath((0,pBe.tmpdir)()),"yarnpkg-sources",Nn.makeHash(this.repository).slice(0,6));return(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{let{project:c}=await Tt.find(r,this.context.cwd),f=q.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),p=q.stringifyIdent(f),h=await Dm(r,un);if(!Object.hasOwn(h,p))throw new Yt(51,`Couldn't find a plugin named "${p}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);let E=p;await M5(this,{configuration:r,report:n,target:s}),await _5(E,this,{project:c,report:n,target:s})})).exitCode()}};async function _5(t,{context:e,noMinify:r},{project:s,report:a,target:n}){let c=t.replace(/@yarnpkg\//,""),{configuration:f}=s;a.reportSeparator(),a.reportInfo(0,`Building a fresh ${c}`),a.reportSeparator(),await gS(ISt({pluginName:c,noMinify:r},n),{configuration:f,context:e,target:n}),a.reportSeparator();let p=K.resolve(n,`packages/${c}/bundles/${t}.js`),h=await le.readFilePromise(p);await U5(t,h,{project:s,report:a})}Ve();bt();Wt();var TC=class extends ut{constructor(){super(...arguments);this.name=ge.String()}static{this.paths=[["plugin","remove"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"remove a plugin",details:` + This command deletes the specified plugin from the .yarn/plugins folder and removes it from the configuration. + + **Note:** The plugins have to be referenced by their name property, which can be obtained using the \`yarn plugin runtime\` command. Shorthands are not allowed. + `,examples:[["Remove a plugin imported from the Yarn repository","$0 plugin remove @yarnpkg/plugin-typescript"],["Remove a plugin imported from a local file","$0 plugin remove my-local-plugin"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);return(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{let c=this.name,f=q.parseIdent(c);if(!r.plugins.has(c))throw new nt(`${q.prettyIdent(r,f)} isn't referenced by the current configuration`);let p=`.yarn/plugins/${c}.cjs`,h=K.resolve(s.cwd,p);le.existsSync(h)&&(n.reportInfo(0,`Removing ${he.pretty(r,p,he.Type.PATH)}...`),await le.removePromise(h)),n.reportInfo(0,"Updating the configuration..."),await ze.updateConfiguration(s.cwd,{plugins:E=>{if(!Array.isArray(E))return E;let C=E.filter(S=>S.path!==p);return C.length===0?ze.deleteProperty:C.length===E.length?E:C}})})).exitCode()}};Ve();Wt();var RC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","runtime"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"list the active plugins",details:` + This command prints the currently active plugins. Will be displayed both builtin plugins and external plugins. + `,examples:[["List the currently active plugins","$0 plugin runtime"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{for(let n of r.plugins.keys()){let c=this.context.plugins.plugins.has(n),f=n;c&&(f+=" [builtin]"),a.reportJson({name:n,builtin:c}),a.reportInfo(null,`${f}`)}})).exitCode()}};Ve();Ve();Wt();var FC=class extends ut{constructor(){super(...arguments);this.idents=ge.Rest()}static{this.paths=[["rebuild"]]}static{this.usage=ot.Usage({description:"rebuild the project's native packages",details:` + This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again. + + Note that while Yarn forgets the compilation, the previous artifacts aren't erased from the filesystem and may affect the next builds (in good or bad). To avoid this, you may remove the .yarn/unplugged folder, or any other relevant location where packages might have been stored (Yarn may offer a way to do that automatically in the future). + + By default all packages will be rebuilt, but you can filter the list by specifying the names of the packages you want to clear from memory. + `,examples:[["Rebuild all packages","$0 rebuild"],["Rebuild fsevents only","$0 rebuild fsevents"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);let c=new Set;for(let f of this.idents)c.add(q.parseIdent(f).identHash);if(await s.restoreInstallState({restoreResolutions:!1}),await s.resolveEverything({cache:n,report:new Wi}),c.size>0)for(let f of s.storedPackages.values())c.has(f.identHash)&&(s.storedBuildState.delete(f.locatorHash),s.skippedBuilds.delete(f.locatorHash));else s.storedBuildState.clear(),s.skippedBuilds.clear();return await s.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Ve();Ve();Ve();Wt();var H5=et(Sa());Ul();var NC=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Ao(ec)});this.patterns=ge.Rest()}static{this.paths=[["remove"]]}static{this.usage=ot.Usage({description:"remove dependencies from the project",details:` + This command will remove the packages matching the specified patterns from the current workspace. + + If the \`--mode=\` option is set, Yarn will change which artifacts are generated. The modes currently supported are: + + - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run. + + - \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost. + + This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them. + `,examples:[["Remove a dependency from the current project","$0 remove lodash"],["Remove a dependency from all workspaces at once","$0 remove lodash --all"],["Remove all dependencies starting with `eslint-`","$0 remove 'eslint-*'"],["Remove all dependencies with the `@babel` scope","$0 remove '@babel/*'"],["Remove all dependencies matching `react-dom` or `react-helmet`","$0 remove 'react-{dom,helmet}'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=this.all?s.workspaces:[a],f=["dependencies","devDependencies","peerDependencies"],p=[],h=!1,E=[];for(let I of this.patterns){let R=!1,N=q.parseIdent(I);for(let U of c){let W=[...U.manifest.peerDependenciesMeta.keys()];for(let te of(0,H5.default)(W,I))U.manifest.peerDependenciesMeta.delete(te),h=!0,R=!0;for(let te of f){let ie=U.manifest.getForScope(te),Ae=[...ie.values()].map(ce=>q.stringifyIdent(ce));for(let ce of(0,H5.default)(Ae,q.stringifyIdent(N))){let{identHash:me}=q.parseIdent(ce),pe=ie.get(me);if(typeof pe>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");U.manifest[te].delete(me),E.push([U,te,pe]),h=!0,R=!0}}}R||p.push(I)}let C=p.length>1?"Patterns":"Pattern",S=p.length>1?"don't":"doesn't",P=this.all?"any":"this";if(p.length>0)throw new nt(`${C} ${he.prettyList(r,p,he.Type.CODE)} ${S} match any packages referenced by ${P} workspace`);return h?(await r.triggerMultipleHooks(I=>I.afterWorkspaceDependencyRemoval,E),await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})):0}};Ve();Ve();Wt();var hBe=ye("util"),OC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["run"]]}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);return(await Ot.start({configuration:r,stdout:this.context.stdout,json:this.json},async c=>{let f=a.manifest.scripts,p=je.sortMap(f.keys(),C=>C),h={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},E=p.reduce((C,S)=>Math.max(C,S.length),0);for(let[C,S]of f.entries())c.reportInfo(null,`${C.padEnd(E," ")} ${(0,hBe.inspect)(S,h)}`),c.reportJson({name:C,script:S})})).exitCode()}};Ve();Ve();Wt();var LC=class extends ut{constructor(){super(...arguments);this.inspect=ge.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=ge.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=ge.Boolean("-T,--top-level",!1,{description:"Check the root workspace for scripts and/or binaries instead of the current one"});this.binariesOnly=ge.Boolean("-B,--binaries-only",!1,{description:"Ignore any user defined scripts and only check for binaries"});this.require=ge.String("--require",{description:"Forwarded to the underlying Node process when executing a binary"});this.silent=ge.Boolean("--silent",{hidden:!0});this.scriptName=ge.String();this.args=ge.Proxy()}static{this.paths=[["run"]]}static{this.usage=ot.Usage({description:"run a script defined in the package.json",details:` + This command will run a tool. The exact tool that will be executed will depend on the current state of your workspace: + + - If the \`scripts\` field from your local package.json contains a matching script name, its definition will get executed. + + - Otherwise, if one of the local workspace's dependencies exposes a binary with a matching name, this binary will get executed. + + - Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed. + + Whatever happens, the cwd of the spawned process will be the workspace that declares the script (which makes it possible to call commands cross-workspaces using the third syntax). + `,examples:[["Run the tests from the local workspace","$0 run test"],['Same thing, but without the "run" keyword',"$0 test"],["Inspect Webpack while running","$0 run --inspect-brk webpack"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a,locator:n}=await Tt.find(r,this.context.cwd);await s.restoreInstallState();let c=this.topLevel?s.topLevelWorkspace.anchoredLocator:n;if(!this.binariesOnly&&await In.hasPackageScript(c,this.scriptName,{project:s}))return await In.executePackageScript(c,this.scriptName,this.args,{project:s,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let f=await In.getPackageAccessibleBinaries(c,{project:s});if(f.get(this.scriptName)){let h=[];return this.inspect&&(typeof this.inspect=="string"?h.push(`--inspect=${this.inspect}`):h.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?h.push(`--inspect-brk=${this.inspectBrk}`):h.push("--inspect-brk")),this.require&&h.push(`--require=${this.require}`),await In.executePackageAccessibleBinary(c,this.scriptName,this.args,{cwd:this.context.cwd,project:s,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:h,packageAccessibleBinaries:f})}if(!this.topLevel&&!this.binariesOnly&&a&&this.scriptName.includes(":")){let E=(await Promise.all(s.workspaces.map(async C=>C.manifest.scripts.has(this.scriptName)?C:null))).filter(C=>C!==null);if(E.length===1)return await In.executeWorkspaceScript(E[0],this.scriptName,this.args,{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}if(this.topLevel)throw this.scriptName==="node-gyp"?new nt(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${q.prettyLocator(r,n)}). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.`):new nt(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${q.prettyLocator(r,n)}).`);{if(this.scriptName==="global")throw new nt("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let h=[this.scriptName].concat(this.args);for(let[E,C]of tC)for(let S of C)if(h.length>=S.length&&JSON.stringify(h.slice(0,S.length))===JSON.stringify(S))throw new nt(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${E} plugin. You can install it with "yarn plugin import ${E}".`);throw new nt(`Couldn't find a script named "${this.scriptName}".`)}}};Ve();Ve();Wt();var MC=class extends ut{constructor(){super(...arguments);this.descriptor=ge.String();this.resolution=ge.String()}static{this.paths=[["set","resolution"]]}static{this.usage=ot.Usage({description:"enforce a package resolution",details:'\n This command updates the resolution table so that `descriptor` is resolved by `resolution`.\n\n Note that by default this command only affect the current resolution table - meaning that this "manual override" will disappear if you remove the lockfile, or if the package disappear from the table. If you wish to make the enforced resolution persist whatever happens, edit the `resolutions` field in your top-level manifest.\n\n Note that no attempt is made at validating that `resolution` is a valid resolution entry for `descriptor`.\n ',examples:[["Force all instances of lodash@npm:^1.2.3 to resolve to 1.5.0","$0 set resolution lodash@npm:^1.2.3 npm:1.5.0"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(await s.restoreInstallState({restoreResolutions:!1}),!a)throw new ar(s.cwd,this.context.cwd);let c=q.parseDescriptor(this.descriptor,!0),f=q.makeDescriptor(c,this.resolution);return s.storedDescriptors.set(c.descriptorHash,c),s.storedDescriptors.set(f.descriptorHash,f),s.resolutionAliases.set(c.descriptorHash,f.descriptorHash),await s.installWithNewReport({stdout:this.context.stdout},{cache:n})}};Ve();bt();Wt();var gBe=et(Sa()),_C=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=ge.Rest()}static{this.paths=[["unlink"]]}static{this.usage=ot.Usage({description:"disconnect the local project from another one",details:` + This command will remove any resolutions in the project-level manifest that would have been added via a yarn link with similar arguments. + `,examples:[["Unregister a remote workspace in the current project","$0 unlink ~/ts-loader"],["Unregister all workspaces from a remote project in the current project","$0 unlink ~/jest --all"],["Unregister all previously linked workspaces","$0 unlink --all"],["Unregister all workspaces matching a glob","$0 unlink '@babel/*' 'pkg-{a,b}'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);let c=s.topLevelWorkspace,f=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:p,reference:h}of c.manifest.resolutions)h.startsWith("portal:")&&f.add(p.descriptor.fullName);if(this.leadingArguments.length>0)for(let p of this.leadingArguments){let h=K.resolve(this.context.cwd,ue.toPortablePath(p));if(je.isPathLike(p)){let E=await ze.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:C,workspace:S}=await Tt.find(E,h);if(!S)throw new ar(C.cwd,h);if(this.all){for(let P of C.workspaces)P.manifest.name&&f.add(q.stringifyIdent(P.anchoredLocator));if(f.size===0)throw new nt("No workspace found to be unlinked in the target project")}else{if(!S.manifest.name)throw new nt("The target workspace doesn't have a name and thus cannot be unlinked");f.add(q.stringifyIdent(S.anchoredLocator))}}else{let E=[...c.manifest.resolutions.map(({pattern:C})=>C.descriptor.fullName)];for(let C of(0,gBe.default)(E,p))f.add(C)}}return c.manifest.resolutions=c.manifest.resolutions.filter(({pattern:p})=>!f.has(p.descriptor.fullName)),await s.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Ve();Ve();Ve();Wt();var dBe=et(lS()),j5=et(Sa());Ul();var UC=class extends ut{constructor(){super(...arguments);this.interactive=ge.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.fixed=ge.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=ge.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=ge.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=ge.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Ao(ec)});this.patterns=ge.Rest()}static{this.paths=[["up"]]}static{this.usage=ot.Usage({description:"upgrade dependencies across the project",details:"\n This command upgrades the packages matching the list of specified patterns to their latest available version across the whole project (regardless of whether they're part of `dependencies` or `devDependencies` - `peerDependencies` won't be affected). This is a project-wide command: all workspaces will be upgraded in the process.\n\n If `-R,--recursive` is set the command will change behavior and no other switch will be allowed. When operating under this mode `yarn up` will force all ranges matching the selected packages to be resolved again (often to the highest available versions) before being stored in the lockfile. It however won't touch your manifests anymore, so depending on your needs you might want to run both `yarn up` and `yarn up -R` to cover all bases.\n\n If `-i,--interactive` is set (or if the `preferInteractive` settings is toggled on) the command will offer various choices, depending on the detected upgrade paths. Some upgrades require this flag in order to resolve ambiguities.\n\n The, `-C,--caret`, `-E,--exact` and `-T,--tilde` options have the same meaning as in the `add` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n Generally you can see `yarn up` as a counterpart to what was `yarn upgrade --latest` in Yarn 1 (ie it ignores the ranges previously listed in your manifests), but unlike `yarn upgrade` which only upgraded dependencies in the current workspace, `yarn up` will upgrade all workspaces at the same time.\n\n This command accepts glob patterns as arguments (if valid Descriptors and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n **Note:** The ranges have to be static, only the package scopes and names can contain glob patterns.\n ",examples:[["Upgrade all instances of lodash to the latest release","$0 up lodash"],["Upgrade all instances of lodash to the latest release, but ask confirmation for each","$0 up lodash -i"],["Upgrade all instances of lodash to 1.2.3","$0 up lodash@1.2.3"],["Upgrade all instances of packages with the `@babel` scope to the latest release","$0 up '@babel/*'"],["Upgrade all instances of packages containing the word `jest` to the latest release","$0 up '*jest*'"],["Upgrade all instances of packages with the `@babel` scope to 7.0.0","$0 up '@babel/*@7.0.0'"]]})}static{this.schema=[iB("recursive",Wf.Forbids,["interactive","exact","tilde","caret"],{ignore:[void 0,!1]})]}async execute(){return this.recursive?await this.executeUpRecursive():await this.executeUpClassic()}async executeUpRecursive(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=[...s.storedDescriptors.values()],f=c.map(E=>q.stringifyIdent(E)),p=new Set;for(let E of this.patterns){if(q.parseDescriptor(E).range!=="unknown")throw new nt("Ranges aren't allowed when using --recursive");for(let C of(0,j5.default)(f,E)){let S=q.parseIdent(C);p.add(S.identHash)}}let h=c.filter(E=>p.has(E.identHash));for(let E of h)s.storedDescriptors.delete(E.descriptorHash),s.storedResolutions.delete(E.descriptorHash);return await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}async executeUpClassic(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=this.fixed,f=r.isInteractive({interactive:this.interactive,stdout:this.context.stdout}),p=uS(this,s),h=f?["keep","reuse","project","latest"]:["project","latest"],E=[],C=[];for(let N of this.patterns){let U=!1,W=q.parseDescriptor(N),te=q.stringifyIdent(W);for(let ie of s.workspaces)for(let Ae of["dependencies","devDependencies"]){let me=[...ie.manifest.getForScope(Ae).values()].map(Be=>q.stringifyIdent(Be)),pe=te==="*"?me:(0,j5.default)(me,te);for(let Be of pe){let Ce=q.parseIdent(Be),g=ie.manifest[Ae].get(Ce.identHash);if(typeof g>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let we=q.makeDescriptor(Ce,W.range);E.push(Promise.resolve().then(async()=>[ie,Ae,g,await fS(we,{project:s,workspace:ie,cache:n,target:Ae,fixed:c,modifier:p,strategies:h})])),U=!0}}U||C.push(N)}if(C.length>1)throw new nt(`Patterns ${he.prettyList(r,C,he.Type.CODE)} don't match any packages referenced by any workspace`);if(C.length>0)throw new nt(`Pattern ${he.prettyList(r,C,he.Type.CODE)} doesn't match any packages referenced by any workspace`);let S=await Promise.all(E),P=await uA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async N=>{for(let[,,U,{suggestions:W,rejections:te}]of S){let ie=W.filter(Ae=>Ae.descriptor!==null);if(ie.length===0){let[Ae]=te;if(typeof Ae>"u")throw new Error("Assertion failed: Expected an error to have been set");let ce=this.cli.error(Ae);s.configuration.get("enableNetwork")?N.reportError(27,`${q.prettyDescriptor(r,U)} can't be resolved to a satisfying range + +${ce}`):N.reportError(27,`${q.prettyDescriptor(r,U)} can't be resolved to a satisfying range (note: network resolution has been disabled) + +${ce}`)}else ie.length>1&&!f&&N.reportError(27,`${q.prettyDescriptor(r,U)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(P.hasErrors())return P.exitCode();let I=!1,R=[];for(let[N,U,,{suggestions:W}]of S){let te,ie=W.filter(pe=>pe.descriptor!==null),Ae=ie[0].descriptor,ce=ie.every(pe=>q.areDescriptorsEqual(pe.descriptor,Ae));ie.length===1||ce?te=Ae:(I=!0,{answer:te}=await(0,dBe.prompt)({type:"select",name:"answer",message:`Which range do you want to use in ${q.prettyWorkspace(r,N)} \u276F ${U}?`,choices:W.map(({descriptor:pe,name:Be,reason:Ce})=>pe?{name:Be,hint:Ce,descriptor:pe}:{name:Be,hint:Ce,disabled:!0}),onCancel:()=>process.exit(130),result(pe){return this.find(pe,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let me=N.manifest[U].get(te.identHash);if(typeof me>"u")throw new Error("Assertion failed: This descriptor should have a matching entry");if(me.descriptorHash!==te.descriptorHash)N.manifest[U].set(te.identHash,te),R.push([N,U,me,te]);else{let pe=r.makeResolver(),Be={project:s,resolver:pe},Ce=r.normalizeDependency(me),g=pe.bindDescriptor(Ce,N.anchoredLocator,Be);s.forgetResolution(g)}}return await r.triggerMultipleHooks(N=>N.afterWorkspaceDependencyReplacement,R),I&&this.context.stdout.write(` +`),await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}};Ve();Ve();Ve();Wt();var HC=class extends ut{constructor(){super(...arguments);this.recursive=ge.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=ge.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=ge.String()}static{this.paths=[["why"]]}static{this.usage=ot.Usage({description:"display the reason why a package is needed",details:` + This command prints the exact reasons why a package appears in the dependency tree. + + If \`-R,--recursive\` is set, the listing will go in depth and will list, for each workspaces, what are all the paths that lead to the dependency. Note that the display is somewhat optimized in that it will not print the package listing twice for a single package, so if you see a leaf named "Foo" when looking for "Bar", it means that "Foo" already got printed higher in the tree. + `,examples:[["Explain why lodash is used in your project","$0 why lodash"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=q.parseIdent(this.package).identHash,c=this.recursive?wSt(s,n,{configuration:r,peers:this.peers}):CSt(s,n,{configuration:r,peers:this.peers});ks.emitTree(c,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1})}};function CSt(t,e,{configuration:r,peers:s}){let a=je.sortMap(t.storedPackages.values(),f=>q.stringifyLocator(f)),n={},c={children:n};for(let f of a){let p={};for(let E of f.dependencies.values()){if(!s&&f.peerDependencies.has(E.identHash))continue;let C=t.storedResolutions.get(E.descriptorHash);if(!C)throw new Error("Assertion failed: The resolution should have been registered");let S=t.storedPackages.get(C);if(!S)throw new Error("Assertion failed: The package should have been registered");if(S.identHash!==e)continue;{let I=q.stringifyLocator(f);n[I]={value:[f,he.Type.LOCATOR],children:p}}let P=q.stringifyLocator(S);p[P]={value:[{descriptor:E,locator:S},he.Type.DEPENDENT]}}}return c}function wSt(t,e,{configuration:r,peers:s}){let a=je.sortMap(t.workspaces,S=>q.stringifyLocator(S.anchoredLocator)),n=new Set,c=new Set,f=S=>{if(n.has(S.locatorHash))return c.has(S.locatorHash);if(n.add(S.locatorHash),S.identHash===e)return c.add(S.locatorHash),!0;let P=!1;S.identHash===e&&(P=!0);for(let I of S.dependencies.values()){if(!s&&S.peerDependencies.has(I.identHash))continue;let R=t.storedResolutions.get(I.descriptorHash);if(!R)throw new Error("Assertion failed: The resolution should have been registered");let N=t.storedPackages.get(R);if(!N)throw new Error("Assertion failed: The package should have been registered");f(N)&&(P=!0)}return P&&c.add(S.locatorHash),P};for(let S of a)f(S.anchoredPackage);let p=new Set,h={},E={children:h},C=(S,P,I)=>{if(!c.has(S.locatorHash))return;let R=I!==null?he.tuple(he.Type.DEPENDENT,{locator:S,descriptor:I}):he.tuple(he.Type.LOCATOR,S),N={},U={value:R,children:N},W=q.stringifyLocator(S);if(P[W]=U,!(I!==null&&t.tryWorkspaceByLocator(S))&&!p.has(S.locatorHash)){p.add(S.locatorHash);for(let te of S.dependencies.values()){if(!s&&S.peerDependencies.has(te.identHash))continue;let ie=t.storedResolutions.get(te.descriptorHash);if(!ie)throw new Error("Assertion failed: The resolution should have been registered");let Ae=t.storedPackages.get(ie);if(!Ae)throw new Error("Assertion failed: The package should have been registered");C(Ae,N,te)}}};for(let S of a)C(S.anchoredPackage,h,null);return E}Ve();var X5={};Vt(X5,{GitFetcher:()=>mS,GitResolver:()=>yS,default:()=>qSt,gitUtils:()=>Qa});Ve();bt();var Qa={};Vt(Qa,{TreeishProtocols:()=>dS,clone:()=>Z5,fetchBase:()=>MBe,fetchChangedFiles:()=>_Be,fetchChangedWorkspaces:()=>HSt,fetchRoot:()=>LBe,isGitUrl:()=>GC,lsRemote:()=>OBe,normalizeLocator:()=>USt,normalizeRepoUrl:()=>jC,resolveUrl:()=>z5,splitRepoUrl:()=>Y0,validateRepoUrl:()=>J5});Ve();bt();Wt();var RBe=et(kBe()),FBe=et(d6()),qC=et(ye("querystring")),V5=et(fi());function Y5(t,e,r){let s=t.indexOf(r);return t.lastIndexOf(e,s>-1?s:1/0)}function QBe(t){try{return new URL(t)}catch{return}}function MSt(t){let e=Y5(t,"@","#"),r=Y5(t,":","#");return r>e&&(t=`${t.slice(0,r)}/${t.slice(r+1)}`),Y5(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`ssh://${t}`),t}function TBe(t){return QBe(t)||QBe(MSt(t))}function jC(t,{git:e=!1}={}){if(t=t.replace(/^git\+https:/,"https:"),t=t.replace(/^(?:github:|https:\/\/github\.com\/|git:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)(?:\.git)?(#.*)?$/,"https://github.com/$1/$2.git$3"),t=t.replace(/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/,"https://github.com/$1/$2.git#$3"),e){let r=TBe(t);r&&(t=r.href),t=t.replace(/^git\+([^:]+):/,"$1:")}return t}function NBe(){return{...process.env,GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND||`${process.env.GIT_SSH||"ssh"} -o BatchMode=yes`}}var _St=[/^ssh:/,/^git(?:\+[^:]+)?:/,/^(?:git\+)?https?:[^#]+\/[^#]+(?:\.git)(?:#.*)?$/,/^git@[^#]+\/[^#]+\.git(?:#.*)?$/,/^(?:github:|https:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z._0-9-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z._0-9-]+?)(?:\.git)?(?:#.*)?$/,/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/],dS=(a=>(a.Commit="commit",a.Head="head",a.Tag="tag",a.Semver="semver",a))(dS||{});function GC(t){return t?_St.some(e=>!!t.match(e)):!1}function Y0(t){t=jC(t);let e=t.indexOf("#");if(e===-1)return{repo:t,treeish:{protocol:"head",request:"HEAD"},extra:{}};let r=t.slice(0,e),s=t.slice(e+1);if(s.match(/^[a-z]+=/)){let a=qC.default.parse(s);for(let[p,h]of Object.entries(a))if(typeof h!="string")throw new Error(`Assertion failed: The ${p} parameter must be a literal string`);let n=Object.values(dS).find(p=>Object.hasOwn(a,p)),[c,f]=typeof n<"u"?[n,a[n]]:["head","HEAD"];for(let p of Object.values(dS))delete a[p];return{repo:r,treeish:{protocol:c,request:f},extra:a}}else{let a=s.indexOf(":"),[n,c]=a===-1?[null,s]:[s.slice(0,a),s.slice(a+1)];return{repo:r,treeish:{protocol:n,request:c},extra:{}}}}function USt(t){return q.makeLocator(t,jC(t.reference))}function J5(t,{configuration:e}){let r=jC(t,{git:!0});if(!An.getNetworkSettings(`https://${(0,RBe.default)(r).resource}`,{configuration:e}).enableNetwork)throw new Yt(80,`Request to '${r}' has been blocked because of your configuration settings`);return r}async function OBe(t,e){let r=J5(t,{configuration:e}),s=await K5("listing refs",["ls-remote",r],{cwd:e.startingCwd,env:NBe()},{configuration:e,normalizedRepoUrl:r}),a=new Map,n=/^([a-f0-9]{40})\t([^\n]+)/gm,c;for(;(c=n.exec(s.stdout))!==null;)a.set(c[2],c[1]);return a}async function z5(t,e){let{repo:r,treeish:{protocol:s,request:a},extra:n}=Y0(t),c=await OBe(r,e),f=(h,E)=>{switch(h){case"commit":{if(!E.match(/^[a-f0-9]{40}$/))throw new Error("Invalid commit hash");return qC.default.stringify({...n,commit:E})}case"head":{let C=c.get(E==="HEAD"?E:`refs/heads/${E}`);if(typeof C>"u")throw new Error(`Unknown head ("${E}")`);return qC.default.stringify({...n,commit:C})}case"tag":{let C=c.get(`refs/tags/${E}`);if(typeof C>"u")throw new Error(`Unknown tag ("${E}")`);return qC.default.stringify({...n,commit:C})}case"semver":{let C=Or.validRange(E);if(!C)throw new Error(`Invalid range ("${E}")`);let S=new Map([...c.entries()].filter(([I])=>I.startsWith("refs/tags/")).map(([I,R])=>[V5.default.parse(I.slice(10)),R]).filter(I=>I[0]!==null)),P=V5.default.maxSatisfying([...S.keys()],C);if(P===null)throw new Error(`No matching range ("${E}")`);return qC.default.stringify({...n,commit:S.get(P)})}case null:{let C;if((C=p("commit",E))!==null||(C=p("tag",E))!==null||(C=p("head",E))!==null)return C;throw E.match(/^[a-f0-9]+$/)?new Error(`Couldn't resolve "${E}" as either a commit, a tag, or a head - if a commit, use the 40-characters commit hash`):new Error(`Couldn't resolve "${E}" as either a commit, a tag, or a head`)}default:throw new Error(`Invalid Git resolution protocol ("${h}")`)}},p=(h,E)=>{try{return f(h,E)}catch{return null}};return jC(`${r}#${f(s,a)}`)}async function Z5(t,e){return await e.getLimit("cloneConcurrency")(async()=>{let{repo:r,treeish:{protocol:s,request:a}}=Y0(t);if(s!=="commit")throw new Error("Invalid treeish protocol when cloning");let n=J5(r,{configuration:e}),c=await le.mktempPromise(),f={cwd:c,env:NBe()};return await K5("cloning the repository",["clone","-c core.autocrlf=false",n,ue.fromPortablePath(c)],f,{configuration:e,normalizedRepoUrl:n}),await K5("switching branch",["checkout",`${a}`],f,{configuration:e,normalizedRepoUrl:n}),c})}async function LBe(t){let e,r=t;do{if(e=r,await le.existsPromise(K.join(e,".git")))return e;r=K.dirname(e)}while(r!==e);return null}async function MBe(t,{baseRefs:e}){if(e.length===0)throw new nt("Can't run this command with zero base refs specified.");let r=[];for(let f of e){let{code:p}=await Gr.execvp("git",["merge-base",f,"HEAD"],{cwd:t});p===0&&r.push(f)}if(r.length===0)throw new nt(`No ancestor could be found between any of HEAD and ${e.join(", ")}`);let{stdout:s}=await Gr.execvp("git",["merge-base","HEAD",...r],{cwd:t,strict:!0}),a=s.trim(),{stdout:n}=await Gr.execvp("git",["show","--quiet","--pretty=format:%s",a],{cwd:t,strict:!0}),c=n.trim();return{hash:a,title:c}}async function _Be(t,{base:e,project:r}){let s=je.buildIgnorePattern(r.configuration.get("changesetIgnorePatterns")),{stdout:a}=await Gr.execvp("git",["diff","--name-only",`${e}`],{cwd:t,strict:!0}),n=a.split(/\r\n|\r|\n/).filter(h=>h.length>0).map(h=>K.resolve(t,ue.toPortablePath(h))),{stdout:c}=await Gr.execvp("git",["ls-files","--others","--exclude-standard"],{cwd:t,strict:!0}),f=c.split(/\r\n|\r|\n/).filter(h=>h.length>0).map(h=>K.resolve(t,ue.toPortablePath(h))),p=[...new Set([...n,...f].sort())];return s?p.filter(h=>!K.relative(r.cwd,h).match(s)):p}async function HSt({ref:t,project:e}){if(e.configuration.projectCwd===null)throw new nt("This command can only be run from within a Yarn project");let r=[K.resolve(e.cwd,Er.lockfile),K.resolve(e.cwd,e.configuration.get("cacheFolder")),K.resolve(e.cwd,e.configuration.get("installStatePath")),K.resolve(e.cwd,e.configuration.get("virtualFolder"))];await e.configuration.triggerHook(c=>c.populateYarnPaths,e,c=>{c!=null&&r.push(c)});let s=await LBe(e.configuration.projectCwd);if(s==null)throw new nt("This command can only be run on Git repositories");let a=await MBe(s,{baseRefs:typeof t=="string"?[t]:e.configuration.get("changesetBaseRefs")}),n=await _Be(s,{base:a.hash,project:e});return new Set(je.mapAndFilter(n,c=>{let f=e.tryWorkspaceByFilePath(c);return f===null?je.mapAndFilter.skip:r.some(p=>c.startsWith(p))?je.mapAndFilter.skip:f}))}async function K5(t,e,r,{configuration:s,normalizedRepoUrl:a}){try{return await Gr.execvp("git",e,{...r,strict:!0})}catch(n){if(!(n instanceof Gr.ExecError))throw n;let c=n.reportExtra,f=n.stderr.toString();throw new Yt(1,`Failed ${t}`,p=>{p.reportError(1,` ${he.prettyField(s,{label:"Repository URL",value:he.tuple(he.Type.URL,a)})}`);for(let h of f.matchAll(/^(.+?): (.*)$/gm)){let[,E,C]=h;E=E.toLowerCase();let S=E==="error"?"Error":`${(0,FBe.default)(E)} Error`;p.reportError(1,` ${he.prettyField(s,{label:S,value:he.tuple(he.Type.NO_HINT,C)})}`)}c?.(p)})}}var mS=class{supports(e,r){return GC(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,a=new Map(r.checksums);a.set(e.locatorHash,s);let n={...r,checksums:a},c=await this.downloadHosted(e,n);if(c!==null)return c;let[f,p,h]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote repository`),loader:()=>this.cloneFromRemote(e,n),...r.cacheOptions});return{packageFs:f,releaseFs:p,prefixPath:q.getIdentVendorPath(e),checksum:h}}async downloadHosted(e,r){return r.project.configuration.reduceHook(s=>s.fetchHostedRepository,null,e,r)}async cloneFromRemote(e,r){let s=Y0(e.reference),a=await Z5(e.reference,r.project.configuration),n=K.resolve(a,s.extra.cwd??vt.dot),c=K.join(n,"package.tgz");await In.prepareExternalProject(n,c,{configuration:r.project.configuration,report:r.report,workspace:s.extra.workspace,locator:e});let f=await le.readFilePromise(c);return await je.releaseAfterUseAsync(async()=>await hs.convertToZip(f,{configuration:r.project.configuration,prefixPath:q.getIdentVendorPath(e),stripComponents:1}))}};Ve();Ve();var yS=class{supportsDescriptor(e,r){return GC(e.range)}supportsLocator(e,r){return GC(e.reference)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){let a=await z5(e.range,s.project.configuration);return[q.makeLocator(e,a)]}async getSatisfying(e,r,s,a){let n=Y0(e.range);return{locators:s.filter(f=>{if(f.identHash!==e.identHash)return!1;let p=Y0(f.reference);return!(n.repo!==p.repo||n.treeish.protocol==="commit"&&n.treeish.request!==p.treeish.request)}),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ht.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var jSt={configuration:{changesetBaseRefs:{description:"The base git refs that the current HEAD is compared against when detecting changes. Supports git branches, tags, and commits.",type:"STRING",isArray:!0,isNullable:!1,default:["master","origin/master","upstream/master","main","origin/main","upstream/main"]},changesetIgnorePatterns:{description:"Array of glob patterns; files matching them will be ignored when fetching the changed files",type:"STRING",default:[],isArray:!0},cloneConcurrency:{description:"Maximal number of concurrent clones",type:"NUMBER",default:2}},fetchers:[mS],resolvers:[yS]};var qSt=jSt;Wt();var WC=class extends ut{constructor(){super(...arguments);this.since=ge.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.noPrivate=ge.Boolean("--no-private",{description:"Exclude workspaces that have the private field set to true"});this.verbose=ge.Boolean("-v,--verbose",!1,{description:"Also return the cross-dependencies between workspaces"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["workspaces","list"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"list all available workspaces",details:"\n This command will print the list of all workspaces in the project.\n\n - If `--since` is set, Yarn will only list workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--no-private` is set, Yarn will not list any workspaces that have the `private` field set to `true`.\n\n - If both the `-v,--verbose` and `--json` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{let c=this.since?await Qa.fetchChangedWorkspaces({ref:this.since,project:s}):s.workspaces,f=new Set(c);if(this.recursive)for(let p of[...c].map(h=>h.getRecursiveWorkspaceDependents()))for(let h of p)f.add(h);for(let p of f){let{manifest:h}=p;if(h.private&&this.noPrivate)continue;let E;if(this.verbose){let C=new Set,S=new Set;for(let P of Ht.hardDependencies)for(let[I,R]of h.getForScope(P)){let N=s.tryWorkspaceByDescriptor(R);N===null?s.workspacesByIdent.has(I)&&S.add(R):C.add(N)}E={workspaceDependencies:Array.from(C).map(P=>P.relativeCwd),mismatchedWorkspaceDependencies:Array.from(S).map(P=>q.stringifyDescriptor(P))}}n.reportInfo(null,`${p.relativeCwd}`),n.reportJson({location:p.relativeCwd,name:h.name?q.stringifyIdent(h.name):null,...E})}})).exitCode()}};Ve();Ve();Wt();var YC=class extends ut{constructor(){super(...arguments);this.workspaceName=ge.String();this.commandName=ge.String();this.args=ge.Proxy()}static{this.paths=[["workspace"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"run a command within the specified workspace",details:` + This command will run a given sub-command on a single workspace. + `,examples:[["Add a package to a single workspace","yarn workspace components add -D react"],["Run build script on a single workspace","yarn workspace components run build"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=s.workspaces,c=new Map(n.map(p=>[q.stringifyIdent(p.anchoredLocator),p])),f=c.get(this.workspaceName);if(f===void 0){let p=Array.from(c.keys()).sort();throw new nt(`Workspace '${this.workspaceName}' not found. Did you mean any of the following: + - ${p.join(` + - `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:f.cwd})}};var GSt={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:"BOOLEAN",default:UBe.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:"STRING",values:["^","~",""],default:"^"},preferReuse:{description:"If true, `yarn add` will attempt to reuse the most common dependency range in other workspaces.",type:"BOOLEAN",default:!1}},commands:[cC,uC,fC,AC,MC,xC,CC,WC,gC,dC,mC,yC,aC,lC,pC,hC,EC,IC,wC,BC,vC,SC,_C,DC,bC,QC,kC,TC,PC,RC,FC,NC,OC,LC,UC,HC,YC]},WSt=GSt;var i9={};Vt(i9,{default:()=>VSt});Ve();var Qt={optional:!0},e9=[["@tailwindcss/aspect-ratio@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@tailwindcss/line-clamp@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@fullhuman/postcss-purgecss@3.1.3 || 3.1.3-alpha.0",{peerDependencies:{postcss:"^8.0.0"}}],["@samverschueren/stream-to-observable@<0.3.1",{peerDependenciesMeta:{rxjs:Qt,zenObservable:Qt}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:Qt,zenObservable:Qt}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{"supports-color":Qt}}],["got@<11",{dependencies:{"@types/responselike":"^1.0.0","@types/keyv":"^3.1.1"}}],["cacheable-lookup@<4.1.2",{dependencies:{"@types/keyv":"^3.1.1"}}],["http-link-dataloader@*",{peerDependencies:{graphql:"^0.13.1 || ^14.0.0"}}],["typescript-language-server@*",{dependencies:{"vscode-jsonrpc":"^5.0.1","vscode-languageserver-protocol":"^3.15.0"}}],["postcss-syntax@*",{peerDependenciesMeta:{"postcss-html":Qt,"postcss-jsx":Qt,"postcss-less":Qt,"postcss-markdown":Qt,"postcss-scss":Qt}}],["jss-plugin-rule-value-function@<=10.1.1",{dependencies:{"tiny-warning":"^1.0.2"}}],["ink-select-input@<4.1.0",{peerDependencies:{react:"^16.8.2"}}],["license-webpack-plugin@<2.3.18",{peerDependenciesMeta:{webpack:Qt}}],["snowpack@>=3.3.0",{dependencies:{"node-gyp":"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:Qt}}],["reactcss@*",{peerDependencies:{react:"*"}}],["react-color@<=2.19.0",{peerDependencies:{react:"*"}}],["gatsby-plugin-i18n@*",{dependencies:{ramda:"^0.24.1"}}],["useragent@^2.0.0",{dependencies:{request:"^2.88.0",yamlparser:"0.0.x",semver:"5.5.x"}}],["@apollographql/apollo-tools@<=0.5.2",{peerDependencies:{graphql:"^14.2.1 || ^15.0.0"}}],["material-table@^2.0.0",{dependencies:{"@babel/runtime":"^7.11.2"}}],["@babel/parser@*",{dependencies:{"@babel/types":"^7.8.3"}}],["fork-ts-checker-webpack-plugin@<=6.3.4",{peerDependencies:{eslint:">= 6",typescript:">= 2.7",webpack:">= 4","vue-template-compiler":"*"},peerDependenciesMeta:{eslint:Qt,"vue-template-compiler":Qt}}],["rc-animate@<=3.1.1",{peerDependencies:{react:">=16.9.0","react-dom":">=16.9.0"}}],["react-bootstrap-table2-paginator@*",{dependencies:{classnames:"^2.2.6"}}],["react-draggable@<=4.4.3",{peerDependencies:{react:">= 16.3.0","react-dom":">= 16.3.0"}}],["apollo-upload-client@<14",{peerDependencies:{graphql:"14 - 15"}}],["react-instantsearch-core@<=6.7.0",{peerDependencies:{algoliasearch:">= 3.1 < 5"}}],["react-instantsearch-dom@<=6.7.0",{dependencies:{"react-fast-compare":"^3.0.0"}}],["ws@<7.2.1",{peerDependencies:{bufferutil:"^4.0.1","utf-8-validate":"^5.0.2"},peerDependenciesMeta:{bufferutil:Qt,"utf-8-validate":Qt}}],["react-portal@<4.2.2",{peerDependencies:{"react-dom":"^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"}}],["react-scripts@<=4.0.1",{peerDependencies:{react:"*"}}],["testcafe@<=1.10.1",{dependencies:{"@babel/plugin-transform-for-of":"^7.12.1","@babel/runtime":"^7.12.5"}}],["testcafe-legacy-api@<=4.2.0",{dependencies:{"testcafe-hammerhead":"^17.0.1","read-file-relative":"^1.2.0"}}],["@google-cloud/firestore@<=4.9.3",{dependencies:{protobufjs:"^6.8.6"}}],["gatsby-source-apiserver@*",{dependencies:{"babel-polyfill":"^6.26.0"}}],["@webpack-cli/package-utils@<=1.0.1-alpha.4",{dependencies:{"cross-spawn":"^7.0.3"}}],["gatsby-remark-prismjs@<3.3.28",{dependencies:{lodash:"^4"}}],["gatsby-plugin-favicon@*",{peerDependencies:{webpack:"*"}}],["gatsby-plugin-sharp@<=4.6.0-next.3",{dependencies:{debug:"^4.3.1"}}],["gatsby-react-router-scroll@<=5.6.0-next.0",{dependencies:{"prop-types":"^15.7.2"}}],["@rebass/forms@*",{dependencies:{"@styled-system/should-forward-prop":"^5.0.0"},peerDependencies:{react:"^16.8.6"}}],["rebass@*",{peerDependencies:{react:"^16.8.6"}}],["@ant-design/react-slick@<=0.28.3",{peerDependencies:{react:">=16.0.0"}}],["mqtt@<4.2.7",{dependencies:{duplexify:"^4.1.1"}}],["vue-cli-plugin-vuetify@<=2.0.3",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":Qt,"vuetify-loader":Qt}}],["vue-cli-plugin-vuetify@<=2.0.4",{dependencies:{"null-loader":"^3.0.0"}}],["vue-cli-plugin-vuetify@>=2.4.3",{peerDependencies:{vue:"*"}}],["@vuetify/cli-plugin-utils@<=0.0.4",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":Qt}}],["@vue/cli-plugin-typescript@<=5.0.0-alpha.0",{dependencies:{"babel-loader":"^8.1.0"}}],["@vue/cli-plugin-typescript@<=5.0.0-beta.0",{dependencies:{"@babel/core":"^7.12.16"},peerDependencies:{"vue-template-compiler":"^2.0.0"},peerDependenciesMeta:{"vue-template-compiler":Qt}}],["cordova-ios@<=6.3.0",{dependencies:{underscore:"^1.9.2"}}],["cordova-lib@<=10.0.1",{dependencies:{underscore:"^1.9.2"}}],["git-node-fs@*",{peerDependencies:{"js-git":"^0.7.8"},peerDependenciesMeta:{"js-git":Qt}}],["consolidate@<0.16.0",{peerDependencies:{mustache:"^3.0.0"},peerDependenciesMeta:{mustache:Qt}}],["consolidate@<=0.16.0",{peerDependencies:{velocityjs:"^2.0.1",tinyliquid:"^0.2.34","liquid-node":"^3.0.1",jade:"^1.11.0","then-jade":"*",dust:"^0.3.0","dustjs-helpers":"^1.7.4","dustjs-linkedin":"^2.7.5",swig:"^1.4.2","swig-templates":"^2.0.3","razor-tmpl":"^1.3.1",atpl:">=0.7.6",liquor:"^0.0.5",twig:"^1.15.2",ejs:"^3.1.5",eco:"^1.1.0-rc-3",jazz:"^0.0.18",jqtpl:"~1.1.0",hamljs:"^0.6.2",hamlet:"^0.3.3",whiskers:"^0.4.0","haml-coffee":"^1.14.1","hogan.js":"^3.0.2",templayed:">=0.2.3",handlebars:"^4.7.6",underscore:"^1.11.0",lodash:"^4.17.20",pug:"^3.0.0","then-pug":"*",qejs:"^3.0.5",walrus:"^0.10.1",mustache:"^4.0.1",just:"^0.1.8",ect:"^0.5.9",mote:"^0.2.0",toffee:"^0.3.6",dot:"^1.1.3","bracket-template":"^1.1.5",ractive:"^1.3.12",nunjucks:"^3.2.2",htmling:"^0.0.8","babel-core":"^6.26.3",plates:"~0.4.11","react-dom":"^16.13.1",react:"^16.13.1","arc-templates":"^0.5.3",vash:"^0.13.0",slm:"^2.0.0",marko:"^3.14.4",teacup:"^2.0.0","coffee-script":"^1.12.7",squirrelly:"^5.1.0",twing:"^5.0.2"},peerDependenciesMeta:{velocityjs:Qt,tinyliquid:Qt,"liquid-node":Qt,jade:Qt,"then-jade":Qt,dust:Qt,"dustjs-helpers":Qt,"dustjs-linkedin":Qt,swig:Qt,"swig-templates":Qt,"razor-tmpl":Qt,atpl:Qt,liquor:Qt,twig:Qt,ejs:Qt,eco:Qt,jazz:Qt,jqtpl:Qt,hamljs:Qt,hamlet:Qt,whiskers:Qt,"haml-coffee":Qt,"hogan.js":Qt,templayed:Qt,handlebars:Qt,underscore:Qt,lodash:Qt,pug:Qt,"then-pug":Qt,qejs:Qt,walrus:Qt,mustache:Qt,just:Qt,ect:Qt,mote:Qt,toffee:Qt,dot:Qt,"bracket-template":Qt,ractive:Qt,nunjucks:Qt,htmling:Qt,"babel-core":Qt,plates:Qt,"react-dom":Qt,react:Qt,"arc-templates":Qt,vash:Qt,slm:Qt,marko:Qt,teacup:Qt,"coffee-script":Qt,squirrelly:Qt,twing:Qt}}],["vue-loader@<=16.3.3",{peerDependencies:{"@vue/compiler-sfc":"^3.0.8",webpack:"^4.1.0 || ^5.0.0-0"},peerDependenciesMeta:{"@vue/compiler-sfc":Qt}}],["vue-loader@^16.7.0",{peerDependencies:{"@vue/compiler-sfc":"^3.0.8",vue:"^3.2.13"},peerDependenciesMeta:{"@vue/compiler-sfc":Qt,vue:Qt}}],["scss-parser@<=1.0.5",{dependencies:{lodash:"^4.17.21"}}],["query-ast@<1.0.5",{dependencies:{lodash:"^4.17.21"}}],["redux-thunk@<=2.3.0",{peerDependencies:{redux:"^4.0.0"}}],["skypack@<=0.3.2",{dependencies:{tar:"^6.1.0"}}],["@npmcli/metavuln-calculator@<2.0.0",{dependencies:{"json-parse-even-better-errors":"^2.3.1"}}],["bin-links@<2.3.0",{dependencies:{"mkdirp-infer-owner":"^1.0.2"}}],["rollup-plugin-polyfill-node@<=0.8.0",{peerDependencies:{rollup:"^1.20.0 || ^2.0.0"}}],["snowpack@<3.8.6",{dependencies:{"magic-string":"^0.25.7"}}],["elm-webpack-loader@*",{dependencies:{temp:"^0.9.4"}}],["winston-transport@<=4.4.0",{dependencies:{logform:"^2.2.0"}}],["jest-vue-preprocessor@*",{dependencies:{"@babel/core":"7.8.7","@babel/template":"7.8.6"},peerDependencies:{pug:"^2.0.4"},peerDependenciesMeta:{pug:Qt}}],["redux-persist@*",{peerDependencies:{react:">=16"},peerDependenciesMeta:{react:Qt}}],["sodium@>=3",{dependencies:{"node-gyp":"^3.8.0"}}],["babel-plugin-graphql-tag@<=3.1.0",{peerDependencies:{graphql:"^14.0.0 || ^15.0.0"}}],["@playwright/test@<=1.14.1",{dependencies:{"jest-matcher-utils":"^26.4.2"}}],...["babel-plugin-remove-graphql-queries@<3.14.0-next.1","babel-preset-gatsby-package@<1.14.0-next.1","create-gatsby@<1.14.0-next.1","gatsby-admin@<0.24.0-next.1","gatsby-cli@<3.14.0-next.1","gatsby-core-utils@<2.14.0-next.1","gatsby-design-tokens@<3.14.0-next.1","gatsby-legacy-polyfills@<1.14.0-next.1","gatsby-plugin-benchmark-reporting@<1.14.0-next.1","gatsby-plugin-graphql-config@<0.23.0-next.1","gatsby-plugin-image@<1.14.0-next.1","gatsby-plugin-mdx@<2.14.0-next.1","gatsby-plugin-netlify-cms@<5.14.0-next.1","gatsby-plugin-no-sourcemaps@<3.14.0-next.1","gatsby-plugin-page-creator@<3.14.0-next.1","gatsby-plugin-preact@<5.14.0-next.1","gatsby-plugin-preload-fonts@<2.14.0-next.1","gatsby-plugin-schema-snapshot@<2.14.0-next.1","gatsby-plugin-styletron@<6.14.0-next.1","gatsby-plugin-subfont@<3.14.0-next.1","gatsby-plugin-utils@<1.14.0-next.1","gatsby-recipes@<0.25.0-next.1","gatsby-source-shopify@<5.6.0-next.1","gatsby-source-wikipedia@<3.14.0-next.1","gatsby-transformer-screenshot@<3.14.0-next.1","gatsby-worker@<0.5.0-next.1"].map(t=>[t,{dependencies:{"@babel/runtime":"^7.14.8"}}]),["gatsby-core-utils@<2.14.0-next.1",{dependencies:{got:"8.3.2"}}],["gatsby-plugin-gatsby-cloud@<=3.1.0-next.0",{dependencies:{"gatsby-core-utils":"^2.13.0-next.0"}}],["gatsby-plugin-gatsby-cloud@<=3.2.0-next.1",{peerDependencies:{webpack:"*"}}],["babel-plugin-remove-graphql-queries@<=3.14.0-next.1",{dependencies:{"gatsby-core-utils":"^2.8.0-next.1"}}],["gatsby-plugin-netlify@3.13.0-next.1",{dependencies:{"gatsby-core-utils":"^2.13.0-next.0"}}],["clipanion-v3-codemod@<=0.2.0",{peerDependencies:{jscodeshift:"^0.11.0"}}],["react-live@*",{peerDependencies:{"react-dom":"*",react:"*"}}],["webpack@<4.44.1",{peerDependenciesMeta:{"webpack-cli":Qt,"webpack-command":Qt}}],["webpack@<5.0.0-beta.23",{peerDependenciesMeta:{"webpack-cli":Qt}}],["webpack-dev-server@<3.10.2",{peerDependenciesMeta:{"webpack-cli":Qt}}],["@docusaurus/responsive-loader@<1.5.0",{peerDependenciesMeta:{sharp:Qt,jimp:Qt}}],["eslint-module-utils@*",{peerDependenciesMeta:{"eslint-import-resolver-node":Qt,"eslint-import-resolver-typescript":Qt,"eslint-import-resolver-webpack":Qt,"@typescript-eslint/parser":Qt}}],["eslint-plugin-import@*",{peerDependenciesMeta:{"@typescript-eslint/parser":Qt}}],["critters-webpack-plugin@<3.0.2",{peerDependenciesMeta:{"html-webpack-plugin":Qt}}],["terser@<=5.10.0",{dependencies:{acorn:"^8.5.0"}}],["babel-preset-react-app@10.0.x <10.0.2",{dependencies:{"@babel/plugin-proposal-private-property-in-object":"^7.16.7"}}],["eslint-config-react-app@*",{peerDependenciesMeta:{typescript:Qt}}],["@vue/eslint-config-typescript@<11.0.0",{peerDependenciesMeta:{typescript:Qt}}],["unplugin-vue2-script-setup@<0.9.1",{peerDependencies:{"@vue/composition-api":"^1.4.3","@vue/runtime-dom":"^3.2.26"}}],["@cypress/snapshot@*",{dependencies:{debug:"^3.2.7"}}],["auto-relay@<=0.14.0",{peerDependencies:{"reflect-metadata":"^0.1.13"}}],["vue-template-babel-compiler@<1.2.0",{peerDependencies:{"vue-template-compiler":"^2.6.0"}}],["@parcel/transformer-image@<2.5.0",{peerDependencies:{"@parcel/core":"*"}}],["@parcel/transformer-js@<2.5.0",{peerDependencies:{"@parcel/core":"*"}}],["parcel@*",{peerDependenciesMeta:{"@parcel/core":Qt}}],["react-scripts@*",{peerDependencies:{eslint:"*"}}],["focus-trap-react@^8.0.0",{dependencies:{tabbable:"^5.3.2"}}],["react-rnd@<10.3.7",{peerDependencies:{react:">=16.3.0","react-dom":">=16.3.0"}}],["connect-mongo@<5.0.0",{peerDependencies:{"express-session":"^1.17.1"}}],["vue-i18n@<9",{peerDependencies:{vue:"^2"}}],["vue-router@<4",{peerDependencies:{vue:"^2"}}],["unified@<10",{dependencies:{"@types/unist":"^2.0.0"}}],["react-github-btn@<=1.3.0",{peerDependencies:{react:">=16.3.0"}}],["react-dev-utils@*",{peerDependencies:{typescript:">=2.7",webpack:">=4"},peerDependenciesMeta:{typescript:Qt}}],["@asyncapi/react-component@<=1.0.0-next.39",{peerDependencies:{react:">=16.8.0","react-dom":">=16.8.0"}}],["xo@*",{peerDependencies:{webpack:">=1.11.0"},peerDependenciesMeta:{webpack:Qt}}],["babel-plugin-remove-graphql-queries@<=4.20.0-next.0",{dependencies:{"@babel/types":"^7.15.4"}}],["gatsby-plugin-page-creator@<=4.20.0-next.1",{dependencies:{"fs-extra":"^10.1.0"}}],["gatsby-plugin-utils@<=3.14.0-next.1",{dependencies:{fastq:"^1.13.0"},peerDependencies:{graphql:"^15.0.0"}}],["gatsby-plugin-mdx@<3.1.0-next.1",{dependencies:{mkdirp:"^1.0.4"}}],["gatsby-plugin-mdx@^2",{peerDependencies:{gatsby:"^3.0.0-next"}}],["fdir@<=5.2.0",{peerDependencies:{picomatch:"2.x"},peerDependenciesMeta:{picomatch:Qt}}],["babel-plugin-transform-typescript-metadata@<=0.3.2",{peerDependencies:{"@babel/core":"^7","@babel/traverse":"^7"},peerDependenciesMeta:{"@babel/traverse":Qt}}],["graphql-compose@>=9.0.10",{peerDependencies:{graphql:"^14.2.0 || ^15.0.0 || ^16.0.0"}}],["vite-plugin-vuetify@<=1.0.2",{peerDependencies:{vue:"^3.0.0"}}],["webpack-plugin-vuetify@<=2.0.1",{peerDependencies:{vue:"^3.2.6"}}],["eslint-import-resolver-vite@<2.0.1",{dependencies:{debug:"^4.3.4",resolve:"^1.22.8"}}],["notistack@^3.0.0",{dependencies:{csstype:"^3.0.10"}}]];var t9;function HBe(){return typeof t9>"u"&&(t9=ye("zlib").brotliDecompressSync(Buffer.from("G7weAByFTVk3Vs7UfHhq4yykgEM7pbW7TI43SG2S5tvGrwHBAzdz+s/npQ6tgEvobvxisrPIadkXeUAJotBn5bDZ5kAhcRqsIHe3F75Walet5hNalwgFDtxb0BiDUjiUQkjG0yW2hto9HPgiCkm316d6bC0kST72YN7D7rfkhCE9x4J0XwB0yavalxpUu2t9xszHrmtwalOxT7VslsxWcB1qpqZwERUra4psWhTV8BgwWeizurec82Caf1ABL11YMfbf8FJ9JBceZOkgmvrQPbC9DUldX/yMbmX06UQluCEjSwUoyO+EZPIjofr+/oAZUck2enraRD+oWLlnlYnj8xB+gwSo9lmmks4fXv574qSqcWA6z21uYkzMu3EWj+K23RxeQlLqiE35/rC8GcS4CGkKHKKq+zAIQwD9iRDNfiAqueLLpicFFrNsAI4zeTD/eO9MHcnRa5m8UT+M2+V+AkFST4BlKneiAQRSdST8KEAIyFlULt6wa9EBd0Ds28VmpaxquJdVt+nwdEs5xUskI13OVtFyY0UrQIRAlCuvvWivvlSKQfTO+2Q8OyUR1W5RvetaPz4jD27hdtwHFFA1Ptx6Ee/t2cY2rg2G46M1pNDRf2pWhvpy8pqMnuI3++4OF3+7OFIWXGjh+o7Nr2jNvbiYcQdQS1h903/jVFgOpA0yJ78z+x759bFA0rq+6aY5qPB4FzS3oYoLupDUhD9nDz6F6H7hpnlMf18KNKDu4IKjTWwrAnY6MFQw1W6ymOALHlFyCZmQhldg1MQHaMVVQTVgDC60TfaBqG++Y8PEoFhN/PBTZT175KNP/BlHDYGOOBmnBdzqJKplZ/ljiVG0ZBzfqeBRrrUkn6rA54462SgiliKoYVnbeptMdXNfAuaupIEi0bApF10TlgHfmEJAPUVidRVFyDupSem5po5vErPqWKhKbUIp0LozpYsIKK57dM/HKr+nguF+7924IIWMICkQ8JUigs9D+W+c4LnNoRtPPKNRUiCYmP+Jfo2lfKCKw8qpraEeWU3uiNRO6zcyKQoXPR5htmzzLznke7b4YbXW3I1lIRzmgG02Udb58U+7TpwyN7XymCgH+wuPDthZVQvRZuEP+SnLtMicz9m5zASWOBiAcLmkuFlTKuHspSIhCBD0yUPKcxu81A+4YD78rA2vtwsUEday9WNyrShyrl60rWmA+SmbYZkQOwFJWArxRYYc5jGhA5ikxYw1rx3ei4NmeX/lKiwpZ9Ln1tV2Ae7sArvxuVLbJjqJRjW1vFXAyHpvLG+8MJ6T2Ubx5M2KDa2SN6vuIGxJ9WQM9Mk3Q7aCNiZONXllhqq24DmoLbQfW2rYWsOgHWjtOmIQMyMKdiHZDjoyIq5+U700nZ6odJAoYXPQBvFNiQ78d5jaXliBqLTJEqUCwi+LiH2mx92EmNKDsJL74Z613+3lf20pxkV1+erOrjj8pW00vsPaahKUM+05ssd5uwM7K482KWEf3TCwlg/o3e5ngto7qSMz7YteIgCsF1UOcsLk7F7MxWbvrPMY473ew0G+noVL8EPbkmEMftMSeL6HFub/zy+2JQ==","base64")).toString()),t9}var r9;function jBe(){return typeof r9>"u"&&(r9=ye("zlib").brotliDecompressSync(Buffer.from("G8MSIIzURnVBnObTcvb3XE6v2S9Qgc2K801Oa5otNKEtK8BINZNcaQHy+9/vf/WXBimwutXC33P2DPc64pps5rz7NGGWaOKNSPL4Y2KRE8twut2lFOIN+OXPtRmPMRhMTILib2bEQx43az2I5d3YS8Roa5UZpF/ujHb3Djd3GDvYUfvFYSUQ39vb2cmifp/rgB4J/65JK3wRBTvMBoNBmn3mbXC63/gbBkW/2IRPri0O8bcsRBsmarF328pAln04nyJFkwUAvNu934supAqLtyerZZpJ8I8suJHhf/ocMV+scKwa8NOiDKIPXw6Ex/EEZD6TEGaW8N5zvNHYF10l6Lfooj7D5W2k3dgvQSbp2Wv8TGOayS978gxlOLVjTGXs66ozewbrjwElLtyrYNnWTfzzdEutgROUFPVMhnMoy8EjJLLlWwIEoySxliim9kYW30JUHiPVyjt0iAw/ZpPmCbUCltYPnq6ZNblIKhTNhqS/oqC9iya5sGKZTOVsTEg34n92uZTf2iPpcZih8rPW8CzA+adIGmyCPcKdLMsBLShd+zuEbTrqpwuh+DLmracZcjPC5Sdf5odDAhKpFuOsQS67RT+1VgWWygSv3YwxDnylc04/PYuaMeIzhBkLrvs7e/OUzRTF56MmfY6rI63QtEjEQzq637zQqJ39nNhu3NmoRRhW/086bHGBUtx0PE0j3aEGvkdh9WJC8y8j8mqqke9/dQ5la+Q3ba4RlhvTbnfQhPDDab3tUifkjKuOsp13mXEmO00Mu88F/M67R7LXfoFDFLNtgCSWjWX+3Jn1371pJTK9xPBiMJafvDjtFyAzu8rxeQ0TKMQXNPs5xxiBOd+BRJP8KP88XPtJIbZKh/cdW8KvBUkpqKpGoiIaA32c3/JnQr4efXt85mXvidOvn/eU3Pase1typLYBalJ14mCso9h79nuMOuCa/kZAOkJHmTjP5RM2WNoPasZUAnT1TAE/NH25hUxcQv6hQWR/m1PKk4ooXMcM4SR1iYU3fUohvqk4RY2hbmTVVIXv6TvqO+0doOjgeVFAcom+RlwJQmOVH7pr1Q9LoJT6n1DeQEB+NHygsATbIwTcOKZlJsY8G4+suX1uQLjUWwLjjs0mvSvZcLTpIGAekeR7GCgl8eo3ndAqEe2XCav4huliHjdbIPBsGJuPX7lrO9HX1UbXRH5opOe1x6JsOSgHZR+EaxuXVhpLLxm6jk1LJtZfHSc6BKPun3CpYYVMJGwEUyk8MTGG0XL5MfEwaXpnc9TKnBmlGn6nHiGREc3ysn47XIBDzA+YvFdjZzVIEDcKGpS6PbUJehFRjEne8D0lVU1XuRtlgszq6pTNlQ/3MzNOEgCWPyTct22V2mEi2krizn5VDo9B19/X2DB3hCGRMM7ONbtnAcIx/OWB1u5uPbW1gsH8irXxT/IzG0PoXWYjhbMsH3KTuoOl5o17PulcgvsfTSnKFM354GWI8luqZnrswWjiXy3G+Vbyo1KMopFmmvBwNELgaS8z8dNZchx/Cl/xjddxhMcyqtzFyONb2Zdu90NkI8pAeufe7YlXrp53v8Dj/l8vWeVspRKBGXScBBPI/HinSTGmLDOGGOCIyH0JFdOZx0gWsacNlQLJMIrBhqRxXxHF/5pseWwejlAAvZ3klZSDSYY8mkToaWejXhgNomeGtx1DTLEUFMRkgF5yFB22WYdJnaWN14r1YJj81hGi45+jrADS5nYRhCiSlCJJ1nL8pYX+HDSMhdTEWyRcgHVp/IsUIZYMfT+YYncUQPgcxNGCHfZ88vDdrcUuaGIl6zhAsiaq7R5dfqrqXH/JcBhfjT8D0azayIyEz75Nxp6YkcyDxlJq3EXnJUpqDohJJOysL1t1uNiHESlvsxPb5cpbW0+ICZqJmUZus1BMW0F5IVBODLIo2zHHjA0=","base64")).toString()),r9}var n9;function qBe(){return typeof n9>"u"&&(n9=ye("zlib").brotliDecompressSync(Buffer.from("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","base64")).toString()),n9}var GBe=new Map([[q.makeIdent(null,"fsevents").identHash,HBe],[q.makeIdent(null,"resolve").identHash,jBe],[q.makeIdent(null,"typescript").identHash,qBe]]),YSt={hooks:{registerPackageExtensions:async(t,e)=>{for(let[r,s]of e9)e(q.parseDescriptor(r,!0),s)},getBuiltinPatch:async(t,e)=>{let r="compat/";if(!e.startsWith(r))return;let s=q.parseIdent(e.slice(r.length)),a=GBe.get(s.identHash)?.();return typeof a<"u"?a:null},reduceDependency:async(t,e,r,s)=>typeof GBe.get(t.identHash)>"u"?t:q.makeDescriptor(t,q.makeRange({protocol:"patch:",source:q.stringifyDescriptor(t),selector:`optional!builtin`,params:null}))}},VSt=YSt;var w9={};Vt(w9,{ConstraintsCheckCommand:()=>ew,ConstraintsQueryCommand:()=>XC,ConstraintsSourceCommand:()=>$C,default:()=>IDt});Ve();Ve();IS();var KC=class{constructor(e){this.project=e}createEnvironment(){let e=new VC(["cwd","ident"]),r=new VC(["workspace","type","ident"]),s=new VC(["ident"]),a={manifestUpdates:new Map,reportedErrors:new Map},n=new Map,c=new Map;for(let f of this.project.storedPackages.values()){let p=Array.from(f.peerDependencies.values(),h=>[q.stringifyIdent(h),h.range]);n.set(f.locatorHash,{workspace:null,ident:q.stringifyIdent(f),version:f.version,dependencies:new Map,peerDependencies:new Map(p.filter(([h])=>f.peerDependenciesMeta.get(h)?.optional!==!0)),optionalPeerDependencies:new Map(p.filter(([h])=>f.peerDependenciesMeta.get(h)?.optional===!0))})}for(let f of this.project.storedPackages.values()){let p=n.get(f.locatorHash);p.dependencies=new Map(Array.from(f.dependencies.values(),h=>{let E=this.project.storedResolutions.get(h.descriptorHash);if(typeof E>"u")throw new Error("Assertion failed: The resolution should have been registered");let C=n.get(E);if(typeof C>"u")throw new Error("Assertion failed: The package should have been registered");return[q.stringifyIdent(h),C]})),p.dependencies.delete(p.ident)}for(let f of this.project.workspaces){let p=q.stringifyIdent(f.anchoredLocator),h=f.manifest.exportTo({}),E=n.get(f.anchoredLocator.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");let C=(R,N,{caller:U=As.getCaller()}={})=>{let W=ES(R),te=je.getMapWithDefault(a.manifestUpdates,f.cwd),ie=je.getMapWithDefault(te,W),Ae=je.getSetWithDefault(ie,N);U!==null&&Ae.add(U)},S=R=>C(R,void 0,{caller:As.getCaller()}),P=R=>{je.getArrayWithDefault(a.reportedErrors,f.cwd).push(R)},I=e.insert({cwd:f.relativeCwd,ident:p,manifest:h,pkg:E,set:C,unset:S,error:P});c.set(f,I);for(let R of Ht.allDependencies)for(let N of f.manifest[R].values()){let U=q.stringifyIdent(N),W=()=>{C([R,U],void 0,{caller:As.getCaller()})},te=Ae=>{C([R,U],Ae,{caller:As.getCaller()})},ie=null;if(R!=="peerDependencies"&&(R!=="dependencies"||!f.manifest.devDependencies.has(N.identHash))){let Ae=f.anchoredPackage.dependencies.get(N.identHash);if(Ae){if(typeof Ae>"u")throw new Error("Assertion failed: The dependency should have been registered");let ce=this.project.storedResolutions.get(Ae.descriptorHash);if(typeof ce>"u")throw new Error("Assertion failed: The resolution should have been registered");let me=n.get(ce);if(typeof me>"u")throw new Error("Assertion failed: The package should have been registered");ie=me}}r.insert({workspace:I,ident:U,range:N.range,type:R,resolution:ie,update:te,delete:W,error:P})}}for(let f of this.project.storedPackages.values()){let p=this.project.tryWorkspaceByLocator(f);if(!p)continue;let h=c.get(p);if(typeof h>"u")throw new Error("Assertion failed: The workspace should have been registered");let E=n.get(f.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");E.workspace=h}return{workspaces:e,dependencies:r,packages:s,result:a}}async process(){let e=this.createEnvironment(),r={Yarn:{workspace:a=>e.workspaces.find(a)[0]??null,workspaces:a=>e.workspaces.find(a),dependency:a=>e.dependencies.find(a)[0]??null,dependencies:a=>e.dependencies.find(a),package:a=>e.packages.find(a)[0]??null,packages:a=>e.packages.find(a)}},s=await this.project.loadUserConfig();return s?.constraints?(await s.constraints(r),e.result):null}};Ve();Ve();Wt();var XC=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.query=ge.String()}static{this.paths=[["constraints","query"]]}static{this.usage=ot.Usage({category:"Constraints-related commands",description:"query the constraints fact database",details:` + This command will output all matches to the given prolog query. + `,examples:[["List all dependencies throughout the workspace","yarn constraints query 'workspace_has_dependency(_, DependencyName, _, _).'"]]})}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(vS(),BS)),s=await ze.find(this.context.cwd,this.context.plugins),{project:a}=await Tt.find(s,this.context.cwd),n=await r.find(a),c=this.query;return c.endsWith(".")||(c=`${c}.`),(await Ot.start({configuration:s,json:this.json,stdout:this.context.stdout},async p=>{for await(let h of n.query(c)){let E=Array.from(Object.entries(h)),C=E.length,S=E.reduce((P,[I])=>Math.max(P,I.length),0);for(let P=0;P(vS(),BS)),s=await ze.find(this.context.cwd,this.context.plugins),{project:a}=await Tt.find(s,this.context.cwd),n=await r.find(a);this.context.stdout.write(this.verbose?n.fullSource:n.source)}};Ve();Ve();Wt();IS();var ew=class extends ut{constructor(){super(...arguments);this.fix=ge.Boolean("--fix",!1,{description:"Attempt to automatically fix unambiguous issues, following a multi-pass process"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["constraints"]]}static{this.usage=ot.Usage({category:"Constraints-related commands",description:"check that the project constraints are met",details:` + This command will run constraints on your project and emit errors for each one that is found but isn't met. If any error is emitted the process will exit with a non-zero exit code. + + If the \`--fix\` flag is used, Yarn will attempt to automatically fix the issues the best it can, following a multi-pass process (with a maximum of 10 iterations). Some ambiguous patterns cannot be autofixed, in which case you'll have to manually specify the right resolution. + + For more information as to how to write constraints, please consult our dedicated page on our website: https://yarnpkg.com/features/constraints. + `,examples:[["Check that all constraints are satisfied","yarn constraints"],["Autofix all unmet constraints","yarn constraints --fix"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);await s.restoreInstallState();let a=await s.loadUserConfig(),n;if(a?.constraints)n=new KC(s);else{let{Constraints:h}=await Promise.resolve().then(()=>(vS(),BS));n=await h.find(s)}let c,f=!1,p=!1;for(let h=this.fix?10:1;h>0;--h){let E=await n.process();if(!E)break;let{changedWorkspaces:C,remainingErrors:S}=lF(s,E,{fix:this.fix}),P=[];for(let[I,R]of C){let N=I.manifest.indent;I.manifest=new Ht,I.manifest.indent=N,I.manifest.load(R),P.push(I.persistManifest())}if(await Promise.all(P),!(C.size>0&&h>1)){c=ZBe(S,{configuration:r}),f=!1,p=!0;for(let[,I]of S)for(let R of I)R.fixable?f=!0:p=!1}}if(c.children.length===0)return 0;if(f){let h=p?`Those errors can all be fixed by running ${he.pretty(r,"yarn constraints --fix",he.Type.CODE)}`:`Errors prefixed by '\u2699' can be fixed by running ${he.pretty(r,"yarn constraints --fix",he.Type.CODE)}`;await Ot.start({configuration:r,stdout:this.context.stdout,includeNames:!1,includeFooter:!1},async E=>{E.reportInfo(0,h),E.reportSeparator()})}return c.children=je.sortMap(c.children,h=>h.value[1]),ks.emitTree(c,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1}),1}};IS();var EDt={configuration:{enableConstraintsChecks:{description:"If true, constraints will run during installs",type:"BOOLEAN",default:!1},constraintsPath:{description:"The path of the constraints file.",type:"ABSOLUTE_PATH",default:"./constraints.pro"}},commands:[XC,$C,ew],hooks:{async validateProjectAfterInstall(t,{reportError:e}){if(!t.configuration.get("enableConstraintsChecks"))return;let r=await t.loadUserConfig(),s;if(r?.constraints)s=new KC(t);else{let{Constraints:c}=await Promise.resolve().then(()=>(vS(),BS));s=await c.find(t)}let a=await s.process();if(!a)return;let{remainingErrors:n}=lF(t,a);if(n.size!==0)if(t.configuration.isCI)for(let[c,f]of n)for(let p of f)e(84,`${he.pretty(t.configuration,c.anchoredLocator,he.Type.IDENT)}: ${p.text}`);else e(84,`Constraint check failed; run ${he.pretty(t.configuration,"yarn constraints",he.Type.CODE)} for more details`)}}},IDt=EDt;var B9={};Vt(B9,{CreateCommand:()=>tw,DlxCommand:()=>rw,default:()=>wDt});Ve();Wt();var tw=class extends ut{constructor(){super(...arguments);this.pkg=ge.String("-p,--package",{description:"The package to run the provided command from"});this.quiet=ge.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ge.String();this.args=ge.Proxy()}static{this.paths=[["create"]]}async execute(){let r=[];this.pkg&&r.push("--package",this.pkg),this.quiet&&r.push("--quiet");let s=this.command.replace(/^(@[^@/]+)(@|$)/,"$1/create$2"),a=q.parseDescriptor(s),n=a.name.match(/^create(-|$)/)?a:a.scope?q.makeIdent(a.scope,`create-${a.name}`):q.makeIdent(null,`create-${a.name}`),c=q.stringifyIdent(n);return a.range!=="unknown"&&(c+=`@${a.range}`),this.cli.run(["dlx",...r,c,...this.args])}};Ve();Ve();bt();Wt();var rw=class extends ut{constructor(){super(...arguments);this.packages=ge.Array("-p,--package",{description:"The package(s) to install before running the command"});this.quiet=ge.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ge.String();this.args=ge.Proxy()}static{this.paths=[["dlx"]]}static{this.usage=ot.Usage({description:"run a package in a temporary environment",details:"\n This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd.\n\n By default Yarn will download the package named `command`, but this can be changed through the use of the `-p,--package` flag which will instruct Yarn to still run the same command but from a different package.\n\n Using `yarn dlx` as a replacement of `yarn add` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through `dlx` - neither their name, nor their version).\n ",examples:[["Use create-react-app to create a new React app","yarn dlx create-react-app ./my-app"],["Install multiple packages for a single command",`yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`]]})}async execute(){return ze.telemetry=null,await le.mktempPromise(async r=>{let s=K.join(r,`dlx-${process.pid}`);await le.mkdirPromise(s),await le.writeFilePromise(K.join(s,"package.json"),`{} +`),await le.writeFilePromise(K.join(s,"yarn.lock"),"");let a=K.join(s,".yarnrc.yml"),n=await ze.findProjectCwd(this.context.cwd),f={enableGlobalCache:!(await ze.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),enableTelemetry:!1,logFilters:[{code:Vf(68),level:he.LogLevel.Discard}]},p=n!==null?K.join(n,".yarnrc.yml"):null;p!==null&&le.existsSync(p)?(await le.copyFilePromise(p,a),await ze.updateConfiguration(s,N=>{let U=je.toMerged(N,f);return Array.isArray(N.plugins)&&(U.plugins=N.plugins.map(W=>{let te=typeof W=="string"?W:W.path,ie=ue.isAbsolute(te)?te:ue.resolve(ue.fromPortablePath(n),te);return typeof W=="string"?ie:{path:ie,spec:W.spec}})),U})):await le.writeJsonPromise(a,f);let h=this.packages??[this.command],E=q.parseDescriptor(this.command).name,C=await this.cli.run(["add","--fixed","--",...h],{cwd:s,quiet:this.quiet});if(C!==0)return C;this.quiet||this.context.stdout.write(` +`);let S=await ze.find(s,this.context.plugins),{project:P,workspace:I}=await Tt.find(S,s);if(I===null)throw new ar(P.cwd,s);await P.restoreInstallState();let R=await In.getWorkspaceAccessibleBinaries(I);return R.has(E)===!1&&R.size===1&&typeof this.packages>"u"&&(E=Array.from(R)[0][0]),await In.executeWorkspaceAccessibleBinary(I,E,this.args,{packageAccessibleBinaries:R,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};var CDt={commands:[tw,rw]},wDt=CDt;var D9={};Vt(D9,{ExecFetcher:()=>DS,ExecResolver:()=>bS,default:()=>SDt,execUtils:()=>AF});Ve();Ve();bt();var fA="exec:";var AF={};Vt(AF,{loadGeneratorFile:()=>SS,makeLocator:()=>S9,makeSpec:()=>Bve,parseSpec:()=>v9});Ve();bt();function v9(t){let{params:e,selector:r}=q.parseRange(t),s=ue.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?q.parseLocator(e.locator):null,path:s}}function Bve({parentLocator:t,path:e,generatorHash:r,protocol:s}){let a=t!==null?{locator:q.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return q.makeRange({protocol:s,source:e,selector:e,params:{...n,...a}})}function S9(t,{parentLocator:e,path:r,generatorHash:s,protocol:a}){return q.makeLocator(t,Bve({parentLocator:e,path:r,generatorHash:s,protocol:a}))}async function SS(t,e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(t,{protocol:e}),n=K.isAbsolute(a)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await r.fetcher.fetch(s,r),c=n.localPath?{packageFs:new Sn(vt.root),prefixPath:K.relative(vt.root,n.localPath)}:n;n!==c&&n.releaseFs&&n.releaseFs();let f=c.packageFs,p=K.join(c.prefixPath,a);return await f.readFilePromise(p,"utf8")}var DS=class{supports(e,r){return!!e.reference.startsWith(fA)}getLocalPath(e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(e.reference,{protocol:fA});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:c}}async fetchFromDisk(e,r){let s=await SS(e.reference,fA,r);return le.mktempPromise(async a=>{let n=K.join(a,"generator.js");return await le.writeFilePromise(n,s),le.mktempPromise(async c=>{if(await this.generatePackage(c,e,n,r),!le.existsSync(K.join(c,"build")))throw new Error("The script should have generated a build directory");return await hs.makeArchiveFromDirectory(K.join(c,"build"),{prefixPath:q.getIdentVendorPath(e),compressionLevel:r.project.configuration.get("compressionLevel")})})})}async generatePackage(e,r,s,a){return await le.mktempPromise(async n=>{let c=await In.makeScriptEnv({project:a.project,binFolder:n}),f=K.join(e,"runtime.js");return await le.mktempPromise(async p=>{let h=K.join(p,"buildfile.log"),E=K.join(e,"generator"),C=K.join(e,"build");await le.mkdirPromise(E),await le.mkdirPromise(C);let S={tempDir:ue.fromPortablePath(E),buildDir:ue.fromPortablePath(C),locator:q.stringifyLocator(r)};await le.writeFilePromise(f,` + // Expose 'Module' as a global variable + Object.defineProperty(global, 'Module', { + get: () => require('module'), + configurable: true, + enumerable: false, + }); + + // Expose non-hidden built-in modules as global variables + for (const name of Module.builtinModules.filter((name) => name !== 'module' && !name.startsWith('_'))) { + Object.defineProperty(global, name, { + get: () => require(name), + configurable: true, + enumerable: false, + }); + } + + // Expose the 'execEnv' global variable + Object.defineProperty(global, 'execEnv', { + value: { + ...${JSON.stringify(S)}, + }, + enumerable: true, + }); + `);let P=c.NODE_OPTIONS||"",I=/\s*--require\s+\S*\.pnp\.c?js\s*/g;P=P.replace(I," ").trim(),c.NODE_OPTIONS=P;let{stdout:R,stderr:N}=a.project.configuration.getSubprocessStreams(h,{header:`# This file contains the result of Yarn generating a package (${q.stringifyLocator(r)}) +`,prefix:q.prettyLocator(a.project.configuration,r),report:a.report}),{code:U}=await Gr.pipevp(process.execPath,["--require",ue.fromPortablePath(f),ue.fromPortablePath(s),q.stringifyIdent(r)],{cwd:e,env:c,stdin:null,stdout:R,stderr:N});if(U!==0)throw le.detachTemp(p),new Error(`Package generation failed (exit code ${U}, logs can be found here: ${he.pretty(a.project.configuration,h,he.Type.PATH)})`)})})}};Ve();Ve();var BDt=2,bS=class{supportsDescriptor(e,r){return!!e.range.startsWith(fA)}supportsLocator(e,r){return!!e.reference.startsWith(fA)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return q.bindDescriptor(e,{locator:q.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=v9(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let c=await SS(q.makeRange({protocol:fA,source:a,selector:a,params:{locator:q.stringifyLocator(n)}}),fA,s.fetchOptions),f=Nn.makeHash(`${BDt}`,c).slice(0,6);return[S9(e,{parentLocator:n,path:a,generatorHash:f,protocol:fA})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ht.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var vDt={fetchers:[DS],resolvers:[bS]},SDt=vDt;var P9={};Vt(P9,{FileFetcher:()=>QS,FileResolver:()=>TS,TarballFileFetcher:()=>RS,TarballFileResolver:()=>NS,default:()=>PDt,fileUtils:()=>km});Ve();bt();var nw=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,PS=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,es="file:";var km={};Vt(km,{fetchArchiveFromLocator:()=>kS,makeArchiveFromLocator:()=>pF,makeBufferFromLocator:()=>b9,makeLocator:()=>iw,makeSpec:()=>vve,parseSpec:()=>xS});Ve();bt();function xS(t){let{params:e,selector:r}=q.parseRange(t),s=ue.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?q.parseLocator(e.locator):null,path:s}}function vve({parentLocator:t,path:e,hash:r,protocol:s}){let a=t!==null?{locator:q.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return q.makeRange({protocol:s,source:e,selector:e,params:{...n,...a}})}function iw(t,{parentLocator:e,path:r,hash:s,protocol:a}){return q.makeLocator(t,vve({parentLocator:e,path:r,hash:s,protocol:a}))}async function kS(t,e){let{parentLocator:r,path:s}=q.parseFileStyleRange(t.reference,{protocol:es}),a=K.isAbsolute(s)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await e.fetcher.fetch(r,e),n=a.localPath?{packageFs:new Sn(vt.root),prefixPath:K.relative(vt.root,a.localPath)}:a;a!==n&&a.releaseFs&&a.releaseFs();let c=n.packageFs,f=K.join(n.prefixPath,s);return await je.releaseAfterUseAsync(async()=>await c.readFilePromise(f),n.releaseFs)}async function pF(t,{protocol:e,fetchOptions:r,inMemory:s=!1}){let{parentLocator:a,path:n}=q.parseFileStyleRange(t.reference,{protocol:e}),c=K.isAbsolute(n)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await r.fetcher.fetch(a,r),f=c.localPath?{packageFs:new Sn(vt.root),prefixPath:K.relative(vt.root,c.localPath)}:c;c!==f&&c.releaseFs&&c.releaseFs();let p=f.packageFs,h=K.join(f.prefixPath,n);return await je.releaseAfterUseAsync(async()=>await hs.makeArchiveFromDirectory(h,{baseFs:p,prefixPath:q.getIdentVendorPath(t),compressionLevel:r.project.configuration.get("compressionLevel"),inMemory:s}),f.releaseFs)}async function b9(t,{protocol:e,fetchOptions:r}){return(await pF(t,{protocol:e,fetchOptions:r,inMemory:!0})).getBufferAndClose()}var QS=class{supports(e,r){return!!e.reference.startsWith(es)}getLocalPath(e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(e.reference,{protocol:es});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:c}}async fetchFromDisk(e,r){return pF(e,{protocol:es,fetchOptions:r})}};Ve();Ve();var DDt=2,TS=class{supportsDescriptor(e,r){return e.range.match(nw)?!0:!!e.range.startsWith(es)}supportsLocator(e,r){return!!e.reference.startsWith(es)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return nw.test(e.range)&&(e=q.makeDescriptor(e,`${es}${e.range}`)),q.bindDescriptor(e,{locator:q.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=xS(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let c=await b9(q.makeLocator(e,q.makeRange({protocol:es,source:a,selector:a,params:{locator:q.stringifyLocator(n)}})),{protocol:es,fetchOptions:s.fetchOptions}),f=Nn.makeHash(`${DDt}`,c).slice(0,6);return[iw(e,{parentLocator:n,path:a,hash:f,protocol:es})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ht.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};Ve();var RS=class{supports(e,r){return PS.test(e.reference)?!!e.reference.startsWith(es):!1}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),checksum:c}}async fetchFromDisk(e,r){let s=await kS(e,r);return await hs.convertToZip(s,{configuration:r.project.configuration,prefixPath:q.getIdentVendorPath(e),stripComponents:1})}};Ve();Ve();Ve();var NS=class{supportsDescriptor(e,r){return PS.test(e.range)?!!(e.range.startsWith(es)||nw.test(e.range)):!1}supportsLocator(e,r){return PS.test(e.reference)?!!e.reference.startsWith(es):!1}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return nw.test(e.range)&&(e=q.makeDescriptor(e,`${es}${e.range}`)),q.bindDescriptor(e,{locator:q.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=xS(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let c=iw(e,{parentLocator:n,path:a,hash:"",protocol:es}),f=await kS(c,s.fetchOptions),p=Nn.makeHash(f).slice(0,6);return[iw(e,{parentLocator:n,path:a,hash:p,protocol:es})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ht.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var bDt={fetchers:[RS,QS],resolvers:[NS,TS]},PDt=bDt;var Q9={};Vt(Q9,{GithubFetcher:()=>OS,default:()=>kDt,githubUtils:()=>hF});Ve();bt();var hF={};Vt(hF,{invalidGithubUrlMessage:()=>bve,isGithubUrl:()=>x9,parseGithubUrl:()=>k9});var Sve=et(ye("querystring")),Dve=[/^https?:\/\/(?:([^/]+?)@)?github.com\/([^/#]+)\/([^/#]+)\/tarball\/([^/#]+)(?:#(.*))?$/,/^https?:\/\/(?:([^/]+?)@)?github.com\/([^/#]+)\/([^/#]+?)(?:\.git)?(?:#(.*))?$/];function x9(t){return t?Dve.some(e=>!!t.match(e)):!1}function k9(t){let e;for(let f of Dve)if(e=t.match(f),e)break;if(!e)throw new Error(bve(t));let[,r,s,a,n="master"]=e,{commit:c}=Sve.default.parse(n);return n=c||n.replace(/[^:]*:/,""),{auth:r,username:s,reponame:a,treeish:n}}function bve(t){return`Input cannot be parsed as a valid GitHub URL ('${t}').`}var OS=class{supports(e,r){return!!x9(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from GitHub`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),checksum:c}}async fetchFromNetwork(e,r){let s=await An.get(this.getLocatorUrl(e,r),{configuration:r.project.configuration});return await le.mktempPromise(async a=>{let n=new Sn(a);await hs.extractArchiveTo(s,n,{stripComponents:1});let c=Qa.splitRepoUrl(e.reference),f=K.join(a,"package.tgz");await In.prepareExternalProject(a,f,{configuration:r.project.configuration,report:r.report,workspace:c.extra.workspace,locator:e});let p=await le.readFilePromise(f);return await hs.convertToZip(p,{configuration:r.project.configuration,prefixPath:q.getIdentVendorPath(e),stripComponents:1})})}getLocatorUrl(e,r){let{auth:s,username:a,reponame:n,treeish:c}=k9(e.reference);return`https://${s?`${s}@`:""}github.com/${a}/${n}/archive/${c}.tar.gz`}};var xDt={hooks:{async fetchHostedRepository(t,e,r){if(t!==null)return t;let s=new OS;if(!s.supports(e,r))return null;try{return await s.fetch(e,r)}catch{return null}}}},kDt=xDt;var T9={};Vt(T9,{TarballHttpFetcher:()=>MS,TarballHttpResolver:()=>_S,default:()=>TDt});Ve();function LS(t){let e;try{e=new URL(t)}catch{return!1}return!(e.protocol!=="http:"&&e.protocol!=="https:"||!e.pathname.match(/(\.tar\.gz|\.tgz|\/[^.]+)$/))}var MS=class{supports(e,r){return LS(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),checksum:c}}async fetchFromNetwork(e,r){let s=await An.get(e.reference,{configuration:r.project.configuration});return await hs.convertToZip(s,{configuration:r.project.configuration,prefixPath:q.getIdentVendorPath(e),stripComponents:1})}};Ve();Ve();var _S=class{supportsDescriptor(e,r){return LS(e.range)}supportsLocator(e,r){return LS(e.reference)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){return[q.convertDescriptorToLocator(e)]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ht.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var QDt={fetchers:[MS],resolvers:[_S]},TDt=QDt;var R9={};Vt(R9,{InitCommand:()=>Z0,InitInitializerCommand:()=>sw,default:()=>FDt});Wt();Ve();Ve();bt();Wt();var Z0=class extends ut{constructor(){super(...arguments);this.private=ge.Boolean("-p,--private",!1,{description:"Initialize a private package"});this.workspace=ge.Boolean("-w,--workspace",!1,{description:"Initialize a workspace root with a `packages/` directory"});this.install=ge.String("-i,--install",!1,{tolerateBoolean:!0,description:"Initialize a package with a specific bundle that will be locked in the project"});this.name=ge.String("-n,--name",{description:"Initialize a package with the given name"});this.usev2=ge.Boolean("-2",!1,{hidden:!0});this.yes=ge.Boolean("-y,--yes",{hidden:!0})}static{this.paths=[["init"]]}static{this.usage=ot.Usage({description:"create a new package",details:"\n This command will setup a new package in your local directory.\n\n If the `-p,--private` or `-w,--workspace` options are set, the package will be private by default.\n\n If the `-w,--workspace` option is set, the package will be configured to accept a set of workspaces in the `packages/` directory.\n\n If the `-i,--install` option is given a value, Yarn will first download it using `yarn set version` and only then forward the init call to the newly downloaded bundle. Without arguments, the downloaded bundle will be `latest`.\n\n The initial settings of the manifest can be changed by using the `initScope` and `initFields` configuration values. Additionally, Yarn will generate an EditorConfig file whose rules can be altered via `initEditorConfig`, and will initialize a Git repository in the current directory.\n ",examples:[["Create a new package in the local directory","yarn init"],["Create a new private package in the local directory","yarn init -p"],["Create a new package and store the Yarn release inside","yarn init -i=latest"],["Create a new private package and defines it as a workspace root","yarn init -w"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=typeof this.install=="string"?this.install:this.usev2||this.install===!0?"latest":null;return s!==null?await this.executeProxy(r,s):await this.executeRegular(r)}async executeProxy(r,s){if(r.projectCwd!==null&&r.projectCwd!==this.context.cwd)throw new nt("Cannot use the --install flag from within a project subdirectory");le.existsSync(this.context.cwd)||await le.mkdirPromise(this.context.cwd,{recursive:!0});let a=K.join(this.context.cwd,Er.lockfile);le.existsSync(a)||await le.writeFilePromise(a,"");let n=await this.cli.run(["set","version",s],{quiet:!0});if(n!==0)return n;let c=[];return this.private&&c.push("-p"),this.workspace&&c.push("-w"),this.name&&c.push(`-n=${this.name}`),this.yes&&c.push("-y"),await le.mktempPromise(async f=>{let{code:p}=await Gr.pipevp("yarn",["init",...c],{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,env:await In.makeScriptEnv({binFolder:f})});return p})}async initialize(){}async executeRegular(r){let s=null;try{s=(await Tt.find(r,this.context.cwd)).project}catch{s=null}le.existsSync(this.context.cwd)||await le.mkdirPromise(this.context.cwd,{recursive:!0});let a=await Ht.tryFind(this.context.cwd),n=a??new Ht,c=Object.fromEntries(r.get("initFields").entries());n.load(c),n.name=n.name??q.makeIdent(r.get("initScope"),this.name??K.basename(this.context.cwd)),n.packageManager=un&&je.isTaggedYarnVersion(un)?`yarn@${un}`:null,(!a&&this.workspace||this.private)&&(n.private=!0),this.workspace&&n.workspaceDefinitions.length===0&&(await le.mkdirPromise(K.join(this.context.cwd,"packages"),{recursive:!0}),n.workspaceDefinitions=[{pattern:"packages/*"}]);let f={};n.exportTo(f);let p=K.join(this.context.cwd,Ht.fileName);await le.changeFilePromise(p,`${JSON.stringify(f,null,2)} +`,{automaticNewlines:!0});let h=[p],E=K.join(this.context.cwd,"README.md");if(le.existsSync(E)||(await le.writeFilePromise(E,`# ${q.stringifyIdent(n.name)} +`),h.push(E)),!s||s.cwd===this.context.cwd){let C=K.join(this.context.cwd,Er.lockfile);le.existsSync(C)||(await le.writeFilePromise(C,""),h.push(C));let P=[".yarn/*","!.yarn/patches","!.yarn/plugins","!.yarn/releases","!.yarn/sdks","!.yarn/versions","","# Whether you use PnP or not, the node_modules folder is often used to store","# build artifacts that should be gitignored","node_modules","","# Swap the comments on the following lines if you wish to use zero-installs","# In that case, don't forget to run `yarn config set enableGlobalCache false`!","# Documentation here: https://yarnpkg.com/features/caching#zero-installs","","#!.yarn/cache",".pnp.*"].map(Ae=>`${Ae} +`).join(""),I=K.join(this.context.cwd,".gitignore");le.existsSync(I)||(await le.writeFilePromise(I,P),h.push(I));let N=["/.yarn/** linguist-vendored","/.yarn/releases/* binary","/.yarn/plugins/**/* binary","/.pnp.* binary linguist-generated"].map(Ae=>`${Ae} +`).join(""),U=K.join(this.context.cwd,".gitattributes");le.existsSync(U)||(await le.writeFilePromise(U,N),h.push(U));let W={"*":{charset:"utf-8",endOfLine:"lf",indentSize:2,indentStyle:"space",insertFinalNewline:!0}};je.mergeIntoTarget(W,r.get("initEditorConfig"));let te=`root = true +`;for(let[Ae,ce]of Object.entries(W)){te+=` +[${Ae}] +`;for(let[me,pe]of Object.entries(ce)){let Be=me.replace(/[A-Z]/g,Ce=>`_${Ce.toLowerCase()}`);te+=`${Be} = ${pe} +`}}let ie=K.join(this.context.cwd,".editorconfig");le.existsSync(ie)||(await le.writeFilePromise(ie,te),h.push(ie)),await this.cli.run(["install"],{quiet:!0}),await this.initialize(),le.existsSync(K.join(this.context.cwd,".git"))||(await Gr.execvp("git",["init"],{cwd:this.context.cwd}),await Gr.execvp("git",["add","--",...h],{cwd:this.context.cwd}),await Gr.execvp("git",["commit","--allow-empty","-m","First commit"],{cwd:this.context.cwd}))}}};var sw=class extends Z0{constructor(){super(...arguments);this.initializer=ge.String();this.argv=ge.Proxy()}static{this.paths=[["init"]]}async initialize(){this.context.stdout.write(` +`),await this.cli.run(["dlx",this.initializer,...this.argv],{quiet:!0})}};var RDt={configuration:{initScope:{description:"Scope used when creating packages via the init command",type:"STRING",default:null},initFields:{description:"Additional fields to set when creating packages via the init command",type:"MAP",valueDefinition:{description:"",type:"ANY"}},initEditorConfig:{description:"Extra rules to define in the generator editorconfig",type:"MAP",valueDefinition:{description:"",type:"ANY"}}},commands:[Z0,sw]},FDt=RDt;var TY={};Vt(TY,{SearchCommand:()=>Bw,UpgradeInteractiveCommand:()=>vw,default:()=>cTt});Ve();var xve=et(ye("os"));function ow({stdout:t}){if(xve.default.endianness()==="BE")throw new Error("Interactive commands cannot be used on big-endian systems because ink depends on yoga-layout-prebuilt which only supports little-endian architectures");if(!t.isTTY)throw new Error("Interactive commands can only be used inside a TTY environment")}Wt();var HSe=et(Z9()),X9={appId:"OFCNCOG2CU",apiKey:"6fe4476ee5a1832882e326b506d14126",indexName:"npm-search"},QPt=(0,HSe.default)(X9.appId,X9.apiKey).initIndex(X9.indexName),$9=async(t,e=0)=>await QPt.search(t,{analyticsTags:["yarn-plugin-interactive-tools"],attributesToRetrieve:["name","version","owner","repository","humanDownloadsLast30Days"],page:e,hitsPerPage:10});var LD=["regular","dev","peer"],Bw=class extends ut{static{this.paths=[["search"]]}static{this.usage=ot.Usage({category:"Interactive commands",description:"open the search interface",details:` + This command opens a fullscreen terminal interface where you can search for and install packages from the npm registry. + `,examples:[["Open the search window","yarn search"]]})}async execute(){ow(this.context);let{Gem:e}=await Promise.resolve().then(()=>($F(),CY)),{ScrollableItems:r}=await Promise.resolve().then(()=>(nN(),rN)),{useKeypress:s}=await Promise.resolve().then(()=>(FD(),zPe)),{useMinistore:a}=await Promise.resolve().then(()=>(bY(),DY)),{renderForm:n}=await Promise.resolve().then(()=>(aN(),oN)),{default:c}=await Promise.resolve().then(()=>et(oxe())),{Box:f,Text:p}=await Promise.resolve().then(()=>et(Vc())),{default:h,useEffect:E,useState:C}=await Promise.resolve().then(()=>et(hn())),S=await ze.find(this.context.cwd,this.context.plugins),P=()=>h.createElement(f,{flexDirection:"row"},h.createElement(f,{flexDirection:"column",width:48},h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to move between packages.")),h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select a package.")),h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," again to change the target."))),h.createElement(f,{flexDirection:"column"},h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to install the selected packages.")),h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to abort.")))),I=()=>h.createElement(h.Fragment,null,h.createElement(f,{width:15},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Owner")),h.createElement(f,{width:11},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Version")),h.createElement(f,{width:10},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Downloads"))),R=()=>h.createElement(f,{width:17},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Target")),N=({hit:pe,active:Be})=>{let[Ce,g]=a(pe.name,null);s({active:Be},(fe,se)=>{if(se.name!=="space")return;if(!Ce){g(LD[0]);return}let X=LD.indexOf(Ce)+1;X===LD.length?g(null):g(LD[X])},[Ce,g]);let we=q.parseIdent(pe.name),Ee=q.prettyIdent(S,we);return h.createElement(f,null,h.createElement(f,{width:45},h.createElement(p,{bold:!0,wrap:"wrap"},Ee)),h.createElement(f,{width:14,marginLeft:1},h.createElement(p,{bold:!0,wrap:"truncate"},pe.owner.name)),h.createElement(f,{width:10,marginLeft:1},h.createElement(p,{italic:!0,wrap:"truncate"},pe.version)),h.createElement(f,{width:16,marginLeft:1},h.createElement(p,null,pe.humanDownloadsLast30Days)))},U=({name:pe,active:Be})=>{let[Ce]=a(pe,null),g=q.parseIdent(pe);return h.createElement(f,null,h.createElement(f,{width:47},h.createElement(p,{bold:!0}," - ",q.prettyIdent(S,g))),LD.map(we=>h.createElement(f,{key:we,width:14,marginLeft:1},h.createElement(p,null," ",h.createElement(e,{active:Ce===we})," ",h.createElement(p,{bold:!0},we)))))},W=()=>h.createElement(f,{marginTop:1},h.createElement(p,null,"Powered by Algolia.")),ie=await n(({useSubmit:pe})=>{let Be=a();pe(Be);let Ce=Array.from(Be.keys()).filter(j=>Be.get(j)!==null),[g,we]=C(""),[Ee,fe]=C(0),[se,X]=C([]),De=j=>{j.match(/\t| /)||we(j)},Re=async()=>{fe(0);let j=await $9(g);j.query===g&&X(j.hits)},gt=async()=>{let j=await $9(g,Ee+1);j.query===g&&j.page-1===Ee&&(fe(j.page),X([...se,...j.hits]))};return E(()=>{g?Re():X([])},[g]),h.createElement(f,{flexDirection:"column"},h.createElement(P,null),h.createElement(f,{flexDirection:"row",marginTop:1},h.createElement(p,{bold:!0},"Search: "),h.createElement(f,{width:41},h.createElement(c,{value:g,onChange:De,placeholder:"i.e. babel, webpack, react...",showCursor:!1})),h.createElement(I,null)),se.length?h.createElement(r,{radius:2,loop:!1,children:se.map(j=>h.createElement(N,{key:j.name,hit:j,active:!1})),willReachEnd:gt}):h.createElement(p,{color:"gray"},"Start typing..."),h.createElement(f,{flexDirection:"row",marginTop:1},h.createElement(f,{width:49},h.createElement(p,{bold:!0},"Selected:")),h.createElement(R,null)),Ce.length?Ce.map(j=>h.createElement(U,{key:j,name:j,active:!1})):h.createElement(p,{color:"gray"},"No selected packages..."),h.createElement(W,null))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof ie>"u")return 1;let Ae=Array.from(ie.keys()).filter(pe=>ie.get(pe)==="regular"),ce=Array.from(ie.keys()).filter(pe=>ie.get(pe)==="dev"),me=Array.from(ie.keys()).filter(pe=>ie.get(pe)==="peer");return Ae.length&&await this.cli.run(["add",...Ae]),ce.length&&await this.cli.run(["add","--dev",...ce]),me&&await this.cli.run(["add","--peer",...me]),0}};Ve();Wt();yG();var pxe=et(fi()),Axe=/^((?:[\^~]|>=?)?)([0-9]+)(\.[0-9]+)(\.[0-9]+)((?:-\S+)?)$/;function hxe(t,e){return t.length>0?[t.slice(0,e)].concat(hxe(t.slice(e),e)):[]}var vw=class extends ut{static{this.paths=[["upgrade-interactive"]]}static{this.usage=ot.Usage({category:"Interactive commands",description:"open the upgrade interface",details:` + This command opens a fullscreen terminal interface where you can see any out of date packages used by your application, their status compared to the latest versions available on the remote registry, and select packages to upgrade. + `,examples:[["Open the upgrade window","yarn upgrade-interactive"]]})}async execute(){ow(this.context);let{ItemOptions:e}=await Promise.resolve().then(()=>(fxe(),uxe)),{Pad:r}=await Promise.resolve().then(()=>(QY(),cxe)),{ScrollableItems:s}=await Promise.resolve().then(()=>(nN(),rN)),{useMinistore:a}=await Promise.resolve().then(()=>(bY(),DY)),{renderForm:n}=await Promise.resolve().then(()=>(aN(),oN)),{Box:c,Text:f}=await Promise.resolve().then(()=>et(Vc())),{default:p,useEffect:h,useRef:E,useState:C}=await Promise.resolve().then(()=>et(hn())),S=await ze.find(this.context.cwd,this.context.plugins),{project:P,workspace:I}=await Tt.find(S,this.context.cwd),R=await Jr.find(S);if(!I)throw new ar(P.cwd,this.context.cwd);await P.restoreInstallState({restoreResolutions:!1});let N=this.context.stdout.rows-7,U=(we,Ee)=>{let fe=ICe(we,Ee),se="";for(let X of fe)X.added?se+=he.pretty(S,X.value,"green"):X.removed||(se+=X.value);return se},W=(we,Ee)=>{if(we===Ee)return Ee;let fe=q.parseRange(we),se=q.parseRange(Ee),X=fe.selector.match(Axe),De=se.selector.match(Axe);if(!X||!De)return U(we,Ee);let Re=["gray","red","yellow","green","magenta"],gt=null,j="";for(let rt=1;rt{let se=await Xu.fetchDescriptorFrom(we,fe,{project:P,cache:R,preserveModifier:Ee,workspace:I});return se!==null?se.range:we.range},ie=async we=>{let Ee=pxe.default.valid(we.range)?`^${we.range}`:we.range,[fe,se]=await Promise.all([te(we,we.range,Ee).catch(()=>null),te(we,we.range,"latest").catch(()=>null)]),X=[{value:null,label:we.range}];return fe&&fe!==we.range?X.push({value:fe,label:W(we.range,fe)}):X.push({value:null,label:""}),se&&se!==fe&&se!==we.range?X.push({value:se,label:W(we.range,se)}):X.push({value:null,label:""}),X},Ae=()=>p.createElement(c,{flexDirection:"row"},p.createElement(c,{flexDirection:"column",width:49},p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},""),"/",p.createElement(f,{bold:!0,color:"cyanBright"},"")," to select packages.")),p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},""),"/",p.createElement(f,{bold:!0,color:"cyanBright"},"")," to select versions."))),p.createElement(c,{flexDirection:"column"},p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},"")," to install.")),p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},"")," to abort.")))),ce=()=>p.createElement(c,{flexDirection:"row",paddingTop:1,paddingBottom:1},p.createElement(c,{width:50},p.createElement(f,{bold:!0},p.createElement(f,{color:"greenBright"},"?")," Pick the packages you want to upgrade.")),p.createElement(c,{width:17},p.createElement(f,{bold:!0,underline:!0,color:"gray"},"Current")),p.createElement(c,{width:17},p.createElement(f,{bold:!0,underline:!0,color:"gray"},"Range")),p.createElement(c,{width:17},p.createElement(f,{bold:!0,underline:!0,color:"gray"},"Latest"))),me=({active:we,descriptor:Ee,suggestions:fe})=>{let[se,X]=a(Ee.descriptorHash,null),De=q.stringifyIdent(Ee),Re=Math.max(0,45-De.length);return p.createElement(p.Fragment,null,p.createElement(c,null,p.createElement(c,{width:45},p.createElement(f,{bold:!0},q.prettyIdent(S,Ee)),p.createElement(r,{active:we,length:Re})),p.createElement(e,{active:we,options:fe,value:se,skewer:!0,onChange:X,sizes:[17,17,17]})))},pe=({dependencies:we})=>{let[Ee,fe]=C(we.map(()=>null)),se=E(!0),X=async De=>{let Re=await ie(De);return Re.filter(gt=>gt.label!=="").length<=1?null:{descriptor:De,suggestions:Re}};return h(()=>()=>{se.current=!1},[]),h(()=>{let De=Math.trunc(N*1.75),Re=we.slice(0,De),gt=we.slice(De),j=hxe(gt,N),rt=Re.map(X).reduce(async(Fe,Ne)=>{await Fe;let Pe=await Ne;Pe!==null&&se.current&&fe(Ye=>{let ke=Ye.findIndex(_e=>_e===null),it=[...Ye];return it[ke]=Pe,it})},Promise.resolve());j.reduce((Fe,Ne)=>Promise.all(Ne.map(Pe=>Promise.resolve().then(()=>X(Pe)))).then(async Pe=>{Pe=Pe.filter(Ye=>Ye!==null),await Fe,se.current&&fe(Ye=>{let ke=Ye.findIndex(it=>it===null);return Ye.slice(0,ke).concat(Pe).concat(Ye.slice(ke+Pe.length))})}),rt).then(()=>{se.current&&fe(Fe=>Fe.filter(Ne=>Ne!==null))})},[]),Ee.length?p.createElement(s,{radius:N>>1,children:Ee.map((De,Re)=>De!==null?p.createElement(me,{key:Re,active:!1,descriptor:De.descriptor,suggestions:De.suggestions}):p.createElement(f,{key:Re},"Loading..."))}):p.createElement(f,null,"No upgrades found")},Ce=await n(({useSubmit:we})=>{we(a());let Ee=new Map;for(let se of P.workspaces)for(let X of["dependencies","devDependencies"])for(let De of se.manifest[X].values())P.tryWorkspaceByDescriptor(De)===null&&(De.range.startsWith("link:")||Ee.set(De.descriptorHash,De));let fe=je.sortMap(Ee.values(),se=>q.stringifyDescriptor(se));return p.createElement(c,{flexDirection:"column"},p.createElement(Ae,null),p.createElement(ce,null),p.createElement(pe,{dependencies:fe}))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof Ce>"u")return 1;let g=!1;for(let we of P.workspaces)for(let Ee of["dependencies","devDependencies"]){let fe=we.manifest[Ee];for(let se of fe.values()){let X=Ce.get(se.descriptorHash);typeof X<"u"&&X!==null&&(fe.set(se.identHash,q.makeDescriptor(se,X)),g=!0)}}return g?await P.installWithNewReport({quiet:this.context.quiet,stdout:this.context.stdout},{cache:R}):0}};var lTt={commands:[Bw,vw]},cTt=lTt;var FY={};Vt(FY,{default:()=>pTt});Ve();var _D="jsr:";Ve();Ve();function Sw(t){let e=t.range.slice(4);if(Or.validRange(e))return q.makeDescriptor(t,`npm:${q.stringifyIdent(q.wrapIdentIntoScope(t,"jsr"))}@${e}`);let r=q.tryParseDescriptor(e,!0);if(r!==null)return q.makeDescriptor(t,`npm:${q.stringifyIdent(q.wrapIdentIntoScope(r,"jsr"))}@${r.range}`);throw new Error(`Invalid range: ${t.range}`)}function Dw(t){return q.makeLocator(q.wrapIdentIntoScope(t,"jsr"),`npm:${t.reference.slice(4)}`)}function RY(t){return q.makeLocator(q.unwrapIdentFromScope(t,"jsr"),`jsr:${t.reference.slice(4)}`)}var lN=class{supports(e,r){return e.reference.startsWith(_D)}getLocalPath(e,r){let s=Dw(e);return r.fetcher.getLocalPath(s,r)}fetch(e,r){let s=Dw(e);return r.fetcher.fetch(s,r)}};var cN=class{supportsDescriptor(e,r){return!!e.range.startsWith(_D)}supportsLocator(e,r){return!!e.reference.startsWith(_D)}shouldPersistResolution(e,r){let s=Dw(e);return r.resolver.shouldPersistResolution(s,r)}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{inner:Sw(e)}}async getCandidates(e,r,s){let a=s.project.configuration.normalizeDependency(Sw(e));return(await s.resolver.getCandidates(a,r,s)).map(c=>RY(c))}async getSatisfying(e,r,s,a){let n=a.project.configuration.normalizeDependency(Sw(e));return a.resolver.getSatisfying(n,r,s,a)}async resolve(e,r){let s=Dw(e),a=await r.resolver.resolve(s,r);return{...a,...RY(a)}}};var uTt=["dependencies","devDependencies","peerDependencies"];function fTt(t,e){for(let r of uTt)for(let s of t.manifest.getForScope(r).values()){if(!s.range.startsWith("jsr:"))continue;let a=Sw(s),n=r==="dependencies"?q.makeDescriptor(s,"unknown"):null,c=n!==null&&t.manifest.ensureDependencyMeta(n).optional?"optionalDependencies":r;e[c][q.stringifyIdent(s)]=a.range}}var ATt={hooks:{beforeWorkspacePacking:fTt},resolvers:[cN],fetchers:[lN]},pTt=ATt;var NY={};Vt(NY,{LinkFetcher:()=>UD,LinkResolver:()=>HD,PortalFetcher:()=>jD,PortalResolver:()=>qD,default:()=>gTt});Ve();bt();var sh="portal:",oh="link:";var UD=class{supports(e,r){return!!e.reference.startsWith(oh)}getLocalPath(e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(e.reference,{protocol:oh});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(e.reference,{protocol:oh}),n=K.isAbsolute(a)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await r.fetcher.fetch(s,r),c=n.localPath?{packageFs:new Sn(vt.root),prefixPath:K.relative(vt.root,n.localPath),localPath:vt.root}:n;n!==c&&n.releaseFs&&n.releaseFs();let f=c.packageFs,p=K.resolve(c.localPath??c.packageFs.getRealPath(),c.prefixPath,a);return n.localPath?{packageFs:new Sn(p,{baseFs:f}),releaseFs:c.releaseFs,prefixPath:vt.dot,discardFromLookup:!0,localPath:p}:{packageFs:new jf(p,{baseFs:f}),releaseFs:c.releaseFs,prefixPath:vt.dot,discardFromLookup:!0}}};Ve();bt();var HD=class{supportsDescriptor(e,r){return!!e.range.startsWith(oh)}supportsLocator(e,r){return!!e.reference.startsWith(oh)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return q.bindDescriptor(e,{locator:q.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){let a=e.range.slice(oh.length);return[q.makeLocator(e,`${oh}${ue.toPortablePath(a)}`)]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){return{...e,version:"0.0.0",languageName:r.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:null,dependencies:new Map,peerDependencies:new Map,dependenciesMeta:new Map,peerDependenciesMeta:new Map,bin:new Map}}};Ve();bt();var jD=class{supports(e,r){return!!e.reference.startsWith(sh)}getLocalPath(e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(e.reference,{protocol:sh});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let{parentLocator:s,path:a}=q.parseFileStyleRange(e.reference,{protocol:sh}),n=K.isAbsolute(a)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await r.fetcher.fetch(s,r),c=n.localPath?{packageFs:new Sn(vt.root),prefixPath:K.relative(vt.root,n.localPath),localPath:vt.root}:n;n!==c&&n.releaseFs&&n.releaseFs();let f=c.packageFs,p=K.resolve(c.localPath??c.packageFs.getRealPath(),c.prefixPath,a);return n.localPath?{packageFs:new Sn(p,{baseFs:f}),releaseFs:c.releaseFs,prefixPath:vt.dot,localPath:p}:{packageFs:new jf(p,{baseFs:f}),releaseFs:c.releaseFs,prefixPath:vt.dot}}};Ve();Ve();bt();var qD=class{supportsDescriptor(e,r){return!!e.range.startsWith(sh)}supportsLocator(e,r){return!!e.reference.startsWith(sh)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return q.bindDescriptor(e,{locator:q.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){let a=e.range.slice(sh.length);return[q.makeLocator(e,`${sh}${ue.toPortablePath(a)}`)]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ht.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var hTt={fetchers:[UD,jD],resolvers:[HD,qD]},gTt=hTt;var yV={};Vt(yV,{NodeModulesLinker:()=>ib,NodeModulesMode:()=>hV,PnpLooseLinker:()=>sb,default:()=>QRt});bt();Ve();bt();bt();var LY=(t,e)=>`${t}@${e}`,gxe=(t,e)=>{let r=e.indexOf("#"),s=r>=0?e.substring(r+1):e;return LY(t,s)};var mxe=(t,e={})=>{let r=e.debugLevel||Number(process.env.NM_DEBUG_LEVEL||-1),s=e.check||r>=9,a=e.hoistingLimits||new Map,n={check:s,debugLevel:r,hoistingLimits:a,fastLookupPossible:!0},c;n.debugLevel>=0&&(c=Date.now());let f=wTt(t,n),p=!1,h=0;do{let E=MY(f,[f],new Set([f.locator]),new Map,n);p=E.anotherRoundNeeded||E.isGraphChanged,n.fastLookupPossible=!1,h++}while(p);if(n.debugLevel>=0&&console.log(`hoist time: ${Date.now()-c}ms, rounds: ${h}`),n.debugLevel>=1){let E=GD(f);if(MY(f,[f],new Set([f.locator]),new Map,n).isGraphChanged)throw new Error(`The hoisting result is not terminal, prev tree: +${E}, next tree: +${GD(f)}`);let S=yxe(f);if(S)throw new Error(`${S}, after hoisting finished: +${GD(f)}`)}return n.debugLevel>=2&&console.log(GD(f)),BTt(f)},dTt=t=>{let e=t[t.length-1],r=new Map,s=new Set,a=n=>{if(!s.has(n)){s.add(n);for(let c of n.hoistedDependencies.values())r.set(c.name,c);for(let c of n.dependencies.values())n.peerNames.has(c.name)||a(c)}};return a(e),r},mTt=t=>{let e=t[t.length-1],r=new Map,s=new Set,a=new Set,n=(c,f)=>{if(s.has(c))return;s.add(c);for(let h of c.hoistedDependencies.values())if(!f.has(h.name)){let E;for(let C of t)E=C.dependencies.get(h.name),E&&r.set(E.name,E)}let p=new Set;for(let h of c.dependencies.values())p.add(h.name);for(let h of c.dependencies.values())c.peerNames.has(h.name)||n(h,p)};return n(e,a),r},dxe=(t,e)=>{if(e.decoupled)return e;let{name:r,references:s,ident:a,locator:n,dependencies:c,originalDependencies:f,hoistedDependencies:p,peerNames:h,reasons:E,isHoistBorder:C,hoistPriority:S,dependencyKind:P,hoistedFrom:I,hoistedTo:R}=e,N={name:r,references:new Set(s),ident:a,locator:n,dependencies:new Map(c),originalDependencies:new Map(f),hoistedDependencies:new Map(p),peerNames:new Set(h),reasons:new Map(E),decoupled:!0,isHoistBorder:C,hoistPriority:S,dependencyKind:P,hoistedFrom:new Map(I),hoistedTo:new Map(R)},U=N.dependencies.get(r);return U&&U.ident==N.ident&&N.dependencies.set(r,N),t.dependencies.set(N.name,N),N},yTt=(t,e)=>{let r=new Map([[t.name,[t.ident]]]);for(let a of t.dependencies.values())t.peerNames.has(a.name)||r.set(a.name,[a.ident]);let s=Array.from(e.keys());s.sort((a,n)=>{let c=e.get(a),f=e.get(n);if(f.hoistPriority!==c.hoistPriority)return f.hoistPriority-c.hoistPriority;{let p=c.dependents.size+c.peerDependents.size;return f.dependents.size+f.peerDependents.size-p}});for(let a of s){let n=a.substring(0,a.indexOf("@",1)),c=a.substring(n.length+1);if(!t.peerNames.has(n)){let f=r.get(n);f||(f=[],r.set(n,f)),f.indexOf(c)<0&&f.push(c)}}return r},OY=t=>{let e=new Set,r=(s,a=new Set)=>{if(!a.has(s)){a.add(s);for(let n of s.peerNames)if(!t.peerNames.has(n)){let c=t.dependencies.get(n);c&&!e.has(c)&&r(c,a)}e.add(s)}};for(let s of t.dependencies.values())t.peerNames.has(s.name)||r(s);return e},MY=(t,e,r,s,a,n=new Set)=>{let c=e[e.length-1];if(n.has(c))return{anotherRoundNeeded:!1,isGraphChanged:!1};n.add(c);let f=vTt(c),p=yTt(c,f),h=t==c?new Map:a.fastLookupPossible?dTt(e):mTt(e),E,C=!1,S=!1,P=new Map(Array.from(p.entries()).map(([R,N])=>[R,N[0]])),I=new Map;do{let R=CTt(t,e,r,h,P,p,s,I,a);R.isGraphChanged&&(S=!0),R.anotherRoundNeeded&&(C=!0),E=!1;for(let[N,U]of p)U.length>1&&!c.dependencies.has(N)&&(P.delete(N),U.shift(),P.set(N,U[0]),E=!0)}while(E);for(let R of c.dependencies.values())if(!c.peerNames.has(R.name)&&!r.has(R.locator)){r.add(R.locator);let N=MY(t,[...e,R],r,I,a);N.isGraphChanged&&(S=!0),N.anotherRoundNeeded&&(C=!0),r.delete(R.locator)}return{anotherRoundNeeded:C,isGraphChanged:S}},ETt=t=>{for(let[e,r]of t.dependencies)if(!t.peerNames.has(e)&&r.ident!==t.ident)return!0;return!1},ITt=(t,e,r,s,a,n,c,f,{outputReason:p,fastLookupPossible:h})=>{let E,C=null,S=new Set;p&&(E=`${Array.from(e).map(N=>Io(N)).join("\u2192")}`);let P=r[r.length-1],R=!(s.ident===P.ident);if(p&&!R&&(C="- self-reference"),R&&(R=s.dependencyKind!==1,p&&!R&&(C="- workspace")),R&&s.dependencyKind===2&&(R=!ETt(s),p&&!R&&(C="- external soft link with unhoisted dependencies")),R&&(R=!t.peerNames.has(s.name),p&&!R&&(C=`- cannot shadow peer: ${Io(t.originalDependencies.get(s.name).locator)} at ${E}`)),R){let N=!1,U=a.get(s.name);if(N=!U||U.ident===s.ident,p&&!N&&(C=`- filled by: ${Io(U.locator)} at ${E}`),N)for(let W=r.length-1;W>=1;W--){let ie=r[W].dependencies.get(s.name);if(ie&&ie.ident!==s.ident){N=!1;let Ae=f.get(P);Ae||(Ae=new Set,f.set(P,Ae)),Ae.add(s.name),p&&(C=`- filled by ${Io(ie.locator)} at ${r.slice(0,W).map(ce=>Io(ce.locator)).join("\u2192")}`);break}}R=N}if(R&&(R=n.get(s.name)===s.ident,p&&!R&&(C=`- filled by: ${Io(c.get(s.name)[0])} at ${E}`)),R){let N=!0,U=new Set(s.peerNames);for(let W=r.length-1;W>=1;W--){let te=r[W];for(let ie of U){if(te.peerNames.has(ie)&&te.originalDependencies.has(ie))continue;let Ae=te.dependencies.get(ie);Ae&&t.dependencies.get(ie)!==Ae&&(W===r.length-1?S.add(Ae):(S=null,N=!1,p&&(C=`- peer dependency ${Io(Ae.locator)} from parent ${Io(te.locator)} was not hoisted to ${E}`))),U.delete(ie)}if(!N)break}R=N}if(R&&!h)for(let N of s.hoistedDependencies.values()){let U=a.get(N.name)||t.dependencies.get(N.name);if(!U||N.ident!==U.ident){R=!1,p&&(C=`- previously hoisted dependency mismatch, needed: ${Io(N.locator)}, available: ${Io(U?.locator)}`);break}}return S!==null&&S.size>0?{isHoistable:2,dependsOn:S,reason:C}:{isHoistable:R?0:1,reason:C}},uN=t=>`${t.name}@${t.locator}`,CTt=(t,e,r,s,a,n,c,f,p)=>{let h=e[e.length-1],E=new Set,C=!1,S=!1,P=(U,W,te,ie,Ae)=>{if(E.has(ie))return;let ce=[...W,uN(ie)],me=[...te,uN(ie)],pe=new Map,Be=new Map;for(let fe of OY(ie)){let se=ITt(h,r,[h,...U,ie],fe,s,a,n,f,{outputReason:p.debugLevel>=2,fastLookupPossible:p.fastLookupPossible});if(Be.set(fe,se),se.isHoistable===2)for(let X of se.dependsOn){let De=pe.get(X.name)||new Set;De.add(fe.name),pe.set(X.name,De)}}let Ce=new Set,g=(fe,se,X)=>{if(!Ce.has(fe)){Ce.add(fe),Be.set(fe,{isHoistable:1,reason:X});for(let De of pe.get(fe.name)||[])g(ie.dependencies.get(De),se,p.debugLevel>=2?`- peer dependency ${Io(fe.locator)} from parent ${Io(ie.locator)} was not hoisted`:"")}};for(let[fe,se]of Be)se.isHoistable===1&&g(fe,se,se.reason);let we=!1;for(let fe of Be.keys())if(!Ce.has(fe)){S=!0;let se=c.get(ie);se&&se.has(fe.name)&&(C=!0),we=!0,ie.dependencies.delete(fe.name),ie.hoistedDependencies.set(fe.name,fe),ie.reasons.delete(fe.name);let X=h.dependencies.get(fe.name);if(p.debugLevel>=2){let De=Array.from(W).concat([ie.locator]).map(gt=>Io(gt)).join("\u2192"),Re=h.hoistedFrom.get(fe.name);Re||(Re=[],h.hoistedFrom.set(fe.name,Re)),Re.push(De),ie.hoistedTo.set(fe.name,Array.from(e).map(gt=>Io(gt.locator)).join("\u2192"))}if(!X)h.ident!==fe.ident&&(h.dependencies.set(fe.name,fe),Ae.add(fe));else for(let De of fe.references)X.references.add(De)}if(ie.dependencyKind===2&&we&&(C=!0),p.check){let fe=yxe(t);if(fe)throw new Error(`${fe}, after hoisting dependencies of ${[h,...U,ie].map(se=>Io(se.locator)).join("\u2192")}: +${GD(t)}`)}let Ee=OY(ie);for(let fe of Ee)if(Ce.has(fe)){let se=Be.get(fe);if((a.get(fe.name)===fe.ident||!ie.reasons.has(fe.name))&&se.isHoistable!==0&&ie.reasons.set(fe.name,se.reason),!fe.isHoistBorder&&me.indexOf(uN(fe))<0){E.add(ie);let De=dxe(ie,fe);P([...U,ie],ce,me,De,R),E.delete(ie)}}},I,R=new Set(OY(h)),N=Array.from(e).map(U=>uN(U));do{I=R,R=new Set;for(let U of I){if(U.locator===h.locator||U.isHoistBorder)continue;let W=dxe(h,U);P([],Array.from(r),N,W,R)}}while(R.size>0);return{anotherRoundNeeded:C,isGraphChanged:S}},yxe=t=>{let e=[],r=new Set,s=new Set,a=(n,c,f)=>{if(r.has(n)||(r.add(n),s.has(n)))return;let p=new Map(c);for(let h of n.dependencies.values())n.peerNames.has(h.name)||p.set(h.name,h);for(let h of n.originalDependencies.values()){let E=p.get(h.name),C=()=>`${Array.from(s).concat([n]).map(S=>Io(S.locator)).join("\u2192")}`;if(n.peerNames.has(h.name)){let S=c.get(h.name);(S!==E||!S||S.ident!==h.ident)&&e.push(`${C()} - broken peer promise: expected ${h.ident} but found ${S&&S.ident}`)}else{let S=f.hoistedFrom.get(n.name),P=n.hoistedTo.get(h.name),I=`${S?` hoisted from ${S.join(", ")}`:""}`,R=`${P?` hoisted to ${P}`:""}`,N=`${C()}${I}`;E?E.ident!==h.ident&&e.push(`${N} - broken require promise for ${h.name}${R}: expected ${h.ident}, but found: ${E.ident}`):e.push(`${N} - broken require promise: no required dependency ${h.name}${R} found`)}}s.add(n);for(let h of n.dependencies.values())n.peerNames.has(h.name)||a(h,p,n);s.delete(n)};return a(t,t.dependencies,t),e.join(` +`)},wTt=(t,e)=>{let{identName:r,name:s,reference:a,peerNames:n}=t,c={name:s,references:new Set([a]),locator:LY(r,a),ident:gxe(r,a),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(n),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistPriority:0,dependencyKind:1,hoistedFrom:new Map,hoistedTo:new Map},f=new Map([[t,c]]),p=(h,E)=>{let C=f.get(h),S=!!C;if(!C){let{name:P,identName:I,reference:R,peerNames:N,hoistPriority:U,dependencyKind:W}=h,te=e.hoistingLimits.get(E.locator);C={name:P,references:new Set([R]),locator:LY(I,R),ident:gxe(I,R),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(N),reasons:new Map,decoupled:!0,isHoistBorder:te?te.has(P):!1,hoistPriority:U||0,dependencyKind:W||0,hoistedFrom:new Map,hoistedTo:new Map},f.set(h,C)}if(E.dependencies.set(h.name,C),E.originalDependencies.set(h.name,C),S){let P=new Set,I=R=>{if(!P.has(R)){P.add(R),R.decoupled=!1;for(let N of R.dependencies.values())R.peerNames.has(N.name)||I(N)}};I(C)}else for(let P of h.dependencies)p(P,C)};for(let h of t.dependencies)p(h,c);return c},_Y=t=>t.substring(0,t.indexOf("@",1)),BTt=t=>{let e={name:t.name,identName:_Y(t.locator),references:new Set(t.references),dependencies:new Set},r=new Set([t]),s=(a,n,c)=>{let f=r.has(a),p;if(n===a)p=c;else{let{name:h,references:E,locator:C}=a;p={name:h,identName:_Y(C),references:E,dependencies:new Set}}if(c.dependencies.add(p),!f){r.add(a);for(let h of a.dependencies.values())a.peerNames.has(h.name)||s(h,a,p);r.delete(a)}};for(let a of t.dependencies.values())s(a,t,e);return e},vTt=t=>{let e=new Map,r=new Set([t]),s=c=>`${c.name}@${c.ident}`,a=c=>{let f=s(c),p=e.get(f);return p||(p={dependents:new Set,peerDependents:new Set,hoistPriority:0},e.set(f,p)),p},n=(c,f)=>{let p=!!r.has(f);if(a(f).dependents.add(c.ident),!p){r.add(f);for(let E of f.dependencies.values()){let C=a(E);C.hoistPriority=Math.max(C.hoistPriority,E.hoistPriority),f.peerNames.has(E.name)?C.peerDependents.add(f.ident):n(f,E)}}};for(let c of t.dependencies.values())t.peerNames.has(c.name)||n(t,c);return e},Io=t=>{if(!t)return"none";let e=t.indexOf("@",1),r=t.substring(0,e);r.endsWith("$wsroot$")&&(r=`wh:${r.replace("$wsroot$","")}`);let s=t.substring(e+1);if(s==="workspace:.")return".";if(s){let a=(s.indexOf("#")>0?s.split("#")[1]:s).replace("npm:","");return s.startsWith("virtual")&&(r=`v:${r}`),a.startsWith("workspace")&&(r=`w:${r}`,a=""),`${r}${a?`@${a}`:""}`}else return`${r}`};var GD=t=>{let e=0,r=(a,n,c="")=>{if(e>5e4||n.has(a))return"";e++;let f=Array.from(a.dependencies.values()).sort((h,E)=>h.name===E.name?0:h.name>E.name?1:-1),p="";n.add(a);for(let h=0;h":"")+(S!==E.name?`a:${E.name}:`:"")+Io(E.locator)+(C?` ${C}`:"")} +`,p+=r(E,n,`${c}${h5e4?` +Tree is too large, part of the tree has been dunped +`:"")};var WD=(s=>(s.WORKSPACES="workspaces",s.DEPENDENCIES="dependencies",s.NONE="none",s))(WD||{}),Exe="node_modules",ng="$wsroot$";var YD=(t,e)=>{let{packageTree:r,hoistingLimits:s,errors:a,preserveSymlinksRequired:n}=DTt(t,e),c=null;if(a.length===0){let f=mxe(r,{hoistingLimits:s});c=PTt(t,f,e)}return{tree:c,errors:a,preserveSymlinksRequired:n}},gA=t=>`${t.name}@${t.reference}`,HY=t=>{let e=new Map;for(let[r,s]of t.entries())if(!s.dirList){let a=e.get(s.locator);a||(a={target:s.target,linkType:s.linkType,locations:[],aliases:s.aliases},e.set(s.locator,a)),a.locations.push(r)}for(let r of e.values())r.locations=r.locations.sort((s,a)=>{let n=s.split(K.delimiter).length,c=a.split(K.delimiter).length;return a===s?0:n!==c?c-n:a>s?1:-1});return e},Ixe=(t,e)=>{let r=q.isVirtualLocator(t)?q.devirtualizeLocator(t):t,s=q.isVirtualLocator(e)?q.devirtualizeLocator(e):e;return q.areLocatorsEqual(r,s)},UY=(t,e,r,s)=>{if(t.linkType!=="SOFT")return!1;let a=ue.toPortablePath(r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation);return K.contains(s,a)===null},STt=t=>{let e=t.getPackageInformation(t.topLevel);if(e===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");if(t.findPackageLocator(e.packageLocation)===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let s=ue.toPortablePath(e.packageLocation.slice(0,-1)),a=new Map,n={children:new Map},c=t.getDependencyTreeRoots(),f=new Map,p=new Set,h=(S,P)=>{let I=gA(S);if(p.has(I))return;p.add(I);let R=t.getPackageInformation(S);if(R){let N=P?gA(P):"";if(gA(S)!==N&&R.linkType==="SOFT"&&!S.reference.startsWith("link:")&&!UY(R,S,t,s)){let U=Cxe(R,S,t);(!f.get(U)||S.reference.startsWith("workspace:"))&&f.set(U,S)}for(let[U,W]of R.packageDependencies)W!==null&&(R.packagePeers.has(U)||h(t.getLocator(U,W),S))}};for(let S of c)h(S,null);let E=s.split(K.sep);for(let S of f.values()){let P=t.getPackageInformation(S),R=ue.toPortablePath(P.packageLocation.slice(0,-1)).split(K.sep).slice(E.length),N=n;for(let U of R){let W=N.children.get(U);W||(W={children:new Map},N.children.set(U,W)),N=W}N.workspaceLocator=S}let C=(S,P)=>{if(S.workspaceLocator){let I=gA(P),R=a.get(I);R||(R=new Set,a.set(I,R)),R.add(S.workspaceLocator)}for(let I of S.children.values())C(I,S.workspaceLocator||P)};for(let S of n.children.values())C(S,n.workspaceLocator);return a},DTt=(t,e)=>{let r=[],s=!1,a=new Map,n=STt(t),c=t.getPackageInformation(t.topLevel);if(c===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let f=t.findPackageLocator(c.packageLocation);if(f===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let p=ue.toPortablePath(c.packageLocation.slice(0,-1)),h={name:f.name,identName:f.name,reference:f.reference,peerNames:c.packagePeers,dependencies:new Set,dependencyKind:1},E=new Map,C=(P,I)=>`${gA(I)}:${P}`,S=(P,I,R,N,U,W,te,ie)=>{let Ae=C(P,R),ce=E.get(Ae),me=!!ce;!me&&R.name===f.name&&R.reference===f.reference&&(ce=h,E.set(Ae,h));let pe=UY(I,R,t,p);if(!ce){let fe=0;pe?fe=2:I.linkType==="SOFT"&&R.name.endsWith(ng)&&(fe=1),ce={name:P,identName:R.name,reference:R.reference,dependencies:new Set,peerNames:fe===1?new Set:I.packagePeers,dependencyKind:fe},E.set(Ae,ce)}let Be;if(pe?Be=2:U.linkType==="SOFT"?Be=1:Be=0,ce.hoistPriority=Math.max(ce.hoistPriority||0,Be),ie&&!pe){let fe=gA({name:N.identName,reference:N.reference}),se=a.get(fe)||new Set;a.set(fe,se),se.add(ce.name)}let Ce=new Map(I.packageDependencies);if(e.project){let fe=e.project.workspacesByCwd.get(ue.toPortablePath(I.packageLocation.slice(0,-1)));if(fe){let se=new Set([...Array.from(fe.manifest.peerDependencies.values(),X=>q.stringifyIdent(X)),...Array.from(fe.manifest.peerDependenciesMeta.keys())]);for(let X of se)Ce.has(X)||(Ce.set(X,W.get(X)||null),ce.peerNames.add(X))}}let g=gA({name:R.name.replace(ng,""),reference:R.reference}),we=n.get(g);if(we)for(let fe of we)Ce.set(`${fe.name}${ng}`,fe.reference);(I!==U||I.linkType!=="SOFT"||!pe&&(!e.selfReferencesByCwd||e.selfReferencesByCwd.get(te)))&&N.dependencies.add(ce);let Ee=R!==f&&I.linkType==="SOFT"&&!R.name.endsWith(ng)&&!pe;if(!me&&!Ee){let fe=new Map;for(let[se,X]of Ce)if(X!==null){let De=t.getLocator(se,X),Re=t.getLocator(se.replace(ng,""),X),gt=t.getPackageInformation(Re);if(gt===null)throw new Error("Assertion failed: Expected the package to have been registered");let j=UY(gt,De,t,p);if(e.validateExternalSoftLinks&&e.project&&j){gt.packageDependencies.size>0&&(s=!0);for(let[Ye,ke]of gt.packageDependencies)if(ke!==null){let it=q.parseLocator(Array.isArray(ke)?`${ke[0]}@${ke[1]}`:`${Ye}@${ke}`);if(gA(it)!==gA(De)){let _e=Ce.get(Ye);if(_e){let x=q.parseLocator(Array.isArray(_e)?`${_e[0]}@${_e[1]}`:`${Ye}@${_e}`);Ixe(x,it)||r.push({messageName:71,text:`Cannot link ${q.prettyIdent(e.project.configuration,q.parseIdent(De.name))} into ${q.prettyLocator(e.project.configuration,q.parseLocator(`${R.name}@${R.reference}`))} dependency ${q.prettyLocator(e.project.configuration,it)} conflicts with parent dependency ${q.prettyLocator(e.project.configuration,x)}`})}else{let x=fe.get(Ye);if(x){let w=x.target,b=q.parseLocator(Array.isArray(w)?`${w[0]}@${w[1]}`:`${Ye}@${w}`);Ixe(b,it)||r.push({messageName:71,text:`Cannot link ${q.prettyIdent(e.project.configuration,q.parseIdent(De.name))} into ${q.prettyLocator(e.project.configuration,q.parseLocator(`${R.name}@${R.reference}`))} dependency ${q.prettyLocator(e.project.configuration,it)} conflicts with dependency ${q.prettyLocator(e.project.configuration,b)} from sibling portal ${q.prettyIdent(e.project.configuration,q.parseIdent(x.portal.name))}`})}else fe.set(Ye,{target:it.reference,portal:De})}}}}let rt=e.hoistingLimitsByCwd?.get(te),Fe=j?te:K.relative(p,ue.toPortablePath(gt.packageLocation))||vt.dot,Ne=e.hoistingLimitsByCwd?.get(Fe);S(se,gt,De,ce,I,Ce,Fe,rt==="dependencies"||Ne==="dependencies"||Ne==="workspaces")}}};return S(f.name,c,f,h,c,c.packageDependencies,vt.dot,!1),{packageTree:h,hoistingLimits:a,errors:r,preserveSymlinksRequired:s}};function Cxe(t,e,r){let s=r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation;return ue.toPortablePath(s||t.packageLocation)}function bTt(t,e,r){let s=e.getLocator(t.name.replace(ng,""),t.reference),a=e.getPackageInformation(s);if(a===null)throw new Error("Assertion failed: Expected the package to be registered");return r.pnpifyFs?{linkType:"SOFT",target:ue.toPortablePath(a.packageLocation)}:{linkType:a.linkType,target:Cxe(a,t,e)}}var PTt=(t,e,r)=>{let s=new Map,a=(E,C,S)=>{let{linkType:P,target:I}=bTt(E,t,r);return{locator:gA(E),nodePath:C,target:I,linkType:P,aliases:S}},n=E=>{let[C,S]=E.split("/");return S?{scope:C,name:S}:{scope:null,name:C}},c=new Set,f=(E,C,S)=>{if(c.has(E))return;c.add(E);let P=Array.from(E.references).sort().join("#");for(let I of E.dependencies){let R=Array.from(I.references).sort().join("#");if(I.identName===E.identName.replace(ng,"")&&R===P)continue;let N=Array.from(I.references).sort(),U={name:I.identName,reference:N[0]},{name:W,scope:te}=n(I.name),ie=te?[te,W]:[W],Ae=K.join(C,Exe),ce=K.join(Ae,...ie),me=`${S}/${U.name}`,pe=a(U,S,N.slice(1)),Be=!1;if(pe.linkType==="SOFT"&&r.project){let Ce=r.project.workspacesByCwd.get(pe.target.slice(0,-1));Be=!!(Ce&&!Ce.manifest.name)}if(!I.name.endsWith(ng)&&!Be){let Ce=s.get(ce);if(Ce){if(Ce.dirList)throw new Error(`Assertion failed: ${ce} cannot merge dir node with leaf node`);{let Ee=q.parseLocator(Ce.locator),fe=q.parseLocator(pe.locator);if(Ce.linkType!==pe.linkType)throw new Error(`Assertion failed: ${ce} cannot merge nodes with different link types ${Ce.nodePath}/${q.stringifyLocator(Ee)} and ${S}/${q.stringifyLocator(fe)}`);if(Ee.identHash!==fe.identHash)throw new Error(`Assertion failed: ${ce} cannot merge nodes with different idents ${Ce.nodePath}/${q.stringifyLocator(Ee)} and ${S}/s${q.stringifyLocator(fe)}`);pe.aliases=[...pe.aliases,...Ce.aliases,q.parseLocator(Ce.locator).reference]}}s.set(ce,pe);let g=ce.split("/"),we=g.indexOf(Exe);for(let Ee=g.length-1;we>=0&&Ee>we;Ee--){let fe=ue.toPortablePath(g.slice(0,Ee).join(K.sep)),se=g[Ee],X=s.get(fe);if(!X)s.set(fe,{dirList:new Set([se])});else if(X.dirList){if(X.dirList.has(se))break;X.dirList.add(se)}}}f(I,pe.linkType==="SOFT"?pe.target:ce,me)}},p=a({name:e.name,reference:Array.from(e.references)[0]},"",[]),h=p.target;return s.set(h,p),f(e,h,""),s};Ve();Ve();bt();bt();rA();Bc();var oV={};Vt(oV,{PnpInstaller:()=>Gm,PnpLinker:()=>og,UnplugCommand:()=>Pw,default:()=>iRt,getPnpPath:()=>ag,jsInstallUtils:()=>mA,pnpUtils:()=>nb,quotePathIfNeeded:()=>ske});bt();var ike=ye("url");Ve();Ve();bt();bt();var wxe={DEFAULT:{collapsed:!1,next:{"*":"DEFAULT"}},TOP_LEVEL:{collapsed:!1,next:{fallbackExclusionList:"FALLBACK_EXCLUSION_LIST",packageRegistryData:"PACKAGE_REGISTRY_DATA","*":"DEFAULT"}},FALLBACK_EXCLUSION_LIST:{collapsed:!1,next:{"*":"FALLBACK_EXCLUSION_ENTRIES"}},FALLBACK_EXCLUSION_ENTRIES:{collapsed:!0,next:{"*":"FALLBACK_EXCLUSION_DATA"}},FALLBACK_EXCLUSION_DATA:{collapsed:!0,next:{"*":"DEFAULT"}},PACKAGE_REGISTRY_DATA:{collapsed:!1,next:{"*":"PACKAGE_REGISTRY_ENTRIES"}},PACKAGE_REGISTRY_ENTRIES:{collapsed:!0,next:{"*":"PACKAGE_STORE_DATA"}},PACKAGE_STORE_DATA:{collapsed:!1,next:{"*":"PACKAGE_STORE_ENTRIES"}},PACKAGE_STORE_ENTRIES:{collapsed:!0,next:{"*":"PACKAGE_INFORMATION_DATA"}},PACKAGE_INFORMATION_DATA:{collapsed:!1,next:{packageDependencies:"PACKAGE_DEPENDENCIES","*":"DEFAULT"}},PACKAGE_DEPENDENCIES:{collapsed:!1,next:{"*":"PACKAGE_DEPENDENCY"}},PACKAGE_DEPENDENCY:{collapsed:!0,next:{"*":"DEFAULT"}}};function xTt(t,e,r){let s="";s+="[";for(let a=0,n=t.length;a"u"||(f!==0&&(a+=", "),a+=JSON.stringify(p),a+=": ",a+=fN(p,h,e,r).replace(/^ +/g,""),f+=1)}return a+="}",a}function TTt(t,e,r){let s=Object.keys(t),a=`${r} `,n="";n+=r,n+=`{ +`;let c=0;for(let f=0,p=s.length;f"u"||(c!==0&&(n+=",",n+=` +`),n+=a,n+=JSON.stringify(h),n+=": ",n+=fN(h,E,e,a).replace(/^ +/g,""),c+=1)}return c!==0&&(n+=` +`),n+=r,n+="}",n}function fN(t,e,r,s){let{next:a}=wxe[r],n=a[t]||a["*"];return Bxe(e,n,s)}function Bxe(t,e,r){let{collapsed:s}=wxe[e];return Array.isArray(t)?s?xTt(t,e,r):kTt(t,e,r):typeof t=="object"&&t!==null?s?QTt(t,e,r):TTt(t,e,r):JSON.stringify(t)}function vxe(t){return Bxe(t,"TOP_LEVEL","")}function VD(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let s=[];for(let n of e)s.push(r.map(c=>n(c)));let a=r.map((n,c)=>c);return a.sort((n,c)=>{for(let f of s){let p=f[n]f[c]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function RTt(t){let e=new Map,r=VD(t.fallbackExclusionList||[],[({name:s,reference:a})=>s,({name:s,reference:a})=>a]);for(let{name:s,reference:a}of r){let n=e.get(s);typeof n>"u"&&e.set(s,n=new Set),n.add(a)}return Array.from(e).map(([s,a])=>[s,Array.from(a)])}function FTt(t){return VD(t.fallbackPool||[],([e])=>e)}function NTt(t){let e=[],r=t.dependencyTreeRoots.find(s=>t.packageRegistry.get(s.name)?.get(s.reference)?.packageLocation==="./");for(let[s,a]of VD(t.packageRegistry,([n])=>n===null?"0":`1${n}`)){if(s===null)continue;let n=[];e.push([s,n]);for(let[c,{packageLocation:f,packageDependencies:p,packagePeers:h,linkType:E,discardFromLookup:C}]of VD(a,([S])=>S===null?"0":`1${S}`)){if(c===null)continue;let S=[];s!==null&&c!==null&&!p.has(s)&&S.push([s,c]);for(let[U,W]of p)S.push([U,W]);let P=VD(S,([U])=>U),I=h&&h.size>0?Array.from(h):void 0,N={packageLocation:f,packageDependencies:P,packagePeers:I,linkType:E,discardFromLookup:C||void 0};n.push([c,N]),r&&s===r.name&&c===r.reference&&e.unshift([null,[[null,N]]])}}return e}function KD(t){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost."],dependencyTreeRoots:t.dependencyTreeRoots,enableTopLevelFallback:t.enableTopLevelFallback||!1,ignorePatternData:t.ignorePattern||null,pnpZipBackend:t.pnpZipBackend,fallbackExclusionList:RTt(t),fallbackPool:FTt(t),packageRegistryData:NTt(t)}}var bxe=et(Dxe());function Pxe(t,e){return[t?`${t} +`:"",`/* eslint-disable */ +`,`// @ts-nocheck +`,`"use strict"; +`,` +`,e,` +`,(0,bxe.default)()].join("")}function OTt(t){return JSON.stringify(t,null,2)}function LTt(t){return`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,`\\ +`)}'`}function MTt(t){return[`const RAW_RUNTIME_STATE = +`,`${LTt(vxe(t))}; + +`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) { +`,` return hydrateRuntimeState(JSON.parse(RAW_RUNTIME_STATE), {basePath: basePath || __dirname}); +`,`} +`].join("")}function _Tt(){return[`function $$SETUP_STATE(hydrateRuntimeState, basePath) { +`,` const fs = require('fs'); +`,` const path = require('path'); +`,` const pnpDataFilepath = path.resolve(__dirname, ${JSON.stringify(Er.pnpData)}); +`,` return hydrateRuntimeState(JSON.parse(fs.readFileSync(pnpDataFilepath, 'utf8')), {basePath: basePath || __dirname}); +`,`} +`].join("")}function xxe(t){let e=KD(t),r=MTt(e);return Pxe(t.shebang,r)}function kxe(t){let e=KD(t),r=_Tt(),s=Pxe(t.shebang,r);return{dataFile:OTt(e),loaderFile:s}}bt();function qY(t,{basePath:e}){let r=ue.toPortablePath(e),s=K.resolve(r),a=t.ignorePatternData!==null?new RegExp(t.ignorePatternData):null,n=new Map,c=new Map(t.packageRegistryData.map(([C,S])=>[C,new Map(S.map(([P,I])=>{if(C===null!=(P===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let R=I.discardFromLookup??!1,N={name:C,reference:P},U=n.get(I.packageLocation);U?(U.discardFromLookup=U.discardFromLookup&&R,R||(U.locator=N)):n.set(I.packageLocation,{locator:N,discardFromLookup:R});let W=null;return[P,{packageDependencies:new Map(I.packageDependencies),packagePeers:new Set(I.packagePeers),linkType:I.linkType,discardFromLookup:R,get packageLocation(){return W||(W=K.join(s,I.packageLocation))}}]}))])),f=new Map(t.fallbackExclusionList.map(([C,S])=>[C,new Set(S)])),p=new Map(t.fallbackPool),h=t.dependencyTreeRoots,E=t.enableTopLevelFallback;return{basePath:r,dependencyTreeRoots:h,enableTopLevelFallback:E,fallbackExclusionList:f,pnpZipBackend:t.pnpZipBackend,fallbackPool:p,ignorePattern:a,packageLocatorsByLocations:n,packageRegistry:c}}bt();bt();var lh=ye("module"),qm=ye("url"),$Y=ye("util");var ra=ye("url");var Fxe=et(ye("assert"));var GY=Array.isArray,JD=JSON.stringify,zD=Object.getOwnPropertyNames,jm=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),WY=(t,e)=>RegExp.prototype.exec.call(t,e),YY=(t,...e)=>RegExp.prototype[Symbol.replace].apply(t,e),ig=(t,...e)=>String.prototype.endsWith.apply(t,e),VY=(t,...e)=>String.prototype.includes.apply(t,e),KY=(t,...e)=>String.prototype.lastIndexOf.apply(t,e),ZD=(t,...e)=>String.prototype.indexOf.apply(t,e),Qxe=(t,...e)=>String.prototype.replace.apply(t,e),sg=(t,...e)=>String.prototype.slice.apply(t,e),dA=(t,...e)=>String.prototype.startsWith.apply(t,e),Txe=Map,Rxe=JSON.parse;function XD(t,e,r){return class extends r{constructor(...s){super(e(...s)),this.code=t,this.name=`${r.name} [${t}]`}}}var Nxe=XD("ERR_PACKAGE_IMPORT_NOT_DEFINED",(t,e,r)=>`Package import specifier "${t}" is not defined${e?` in package ${e}package.json`:""} imported from ${r}`,TypeError),JY=XD("ERR_INVALID_MODULE_SPECIFIER",(t,e,r=void 0)=>`Invalid module "${t}" ${e}${r?` imported from ${r}`:""}`,TypeError),Oxe=XD("ERR_INVALID_PACKAGE_TARGET",(t,e,r,s=!1,a=void 0)=>{let n=typeof r=="string"&&!s&&r.length&&!dA(r,"./");return e==="."?((0,Fxe.default)(s===!1),`Invalid "exports" main target ${JD(r)} defined in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`):`Invalid "${s?"imports":"exports"}" target ${JD(r)} defined for '${e}' in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`},Error),$D=XD("ERR_INVALID_PACKAGE_CONFIG",(t,e,r)=>`Invalid package config ${t}${e?` while importing ${e}`:""}${r?`. ${r}`:""}`,Error),Lxe=XD("ERR_PACKAGE_PATH_NOT_EXPORTED",(t,e,r=void 0)=>e==="."?`No "exports" main defined in ${t}package.json${r?` imported from ${r}`:""}`:`Package subpath '${e}' is not defined by "exports" in ${t}package.json${r?` imported from ${r}`:""}`,Error);var pN=ye("url");function Mxe(t,e){let r=Object.create(null);for(let s=0;se):t+e}eb(r,t,s,c,a)}WY(Uxe,sg(t,2))!==null&&eb(r,t,s,c,a);let p=new URL(t,s),h=p.pathname,E=new URL(".",s).pathname;if(dA(h,E)||eb(r,t,s,c,a),e==="")return p;if(WY(Uxe,e)!==null){let C=n?Qxe(r,"*",()=>e):r+e;jTt(C,s,c,a)}return n?new URL(YY(Hxe,p.href,()=>e)):new URL(e,p)}function GTt(t){let e=+t;return`${e}`!==t?!1:e>=0&&e<4294967295}function bw(t,e,r,s,a,n,c,f){if(typeof e=="string")return qTt(e,r,s,t,a,n,c,f);if(GY(e)){if(e.length===0)return null;let p;for(let h=0;hn?-1:n>a||r===-1?1:s===-1||t.length>e.length?-1:e.length>t.length?1:0}function WTt(t,e,r){if(typeof t=="string"||GY(t))return!0;if(typeof t!="object"||t===null)return!1;let s=zD(t),a=!1,n=0;for(let c=0;c=h.length&&ig(e,C)&&qxe(n,h)===1&&KY(h,"*")===E&&(n=h,c=sg(e,E,e.length-C.length))}}if(n){let p=r[n],h=bw(t,p,c,n,s,!0,!1,a);return h==null&&zY(e,t,s),h}zY(e,t,s)}function Wxe({name:t,base:e,conditions:r,readFileSyncFn:s}){if(t==="#"||dA(t,"#/")||ig(t,"/")){let c="is not a valid internal imports specifier name";throw new JY(t,c,(0,ra.fileURLToPath)(e))}let a,n=_xe(e,s);if(n.exists){a=(0,ra.pathToFileURL)(n.pjsonPath);let c=n.imports;if(c)if(jm(c,t)&&!VY(t,"*")){let f=bw(a,c[t],"",t,e,!1,!0,r);if(f!=null)return f}else{let f="",p,h=zD(c);for(let E=0;E=C.length&&ig(t,P)&&qxe(f,C)===1&&KY(C,"*")===S&&(f=C,p=sg(t,S,t.length-P.length))}}if(f){let E=c[f],C=bw(a,E,p,f,e,!0,!0,r);if(C!=null)return C}}}HTt(t,a,e)}bt();var VTt=new Set(["BUILTIN_NODE_RESOLUTION_FAILED","MISSING_DEPENDENCY","MISSING_PEER_DEPENDENCY","QUALIFIED_PATH_RESOLUTION_FAILED","UNDECLARED_DEPENDENCY"]);function ds(t,e,r={},s){s??=VTt.has(t)?"MODULE_NOT_FOUND":t;let a={configurable:!0,writable:!0,enumerable:!1};return Object.defineProperties(new Error(e),{code:{...a,value:s},pnpCode:{...a,value:t},data:{...a,value:r}})}function cf(t){return ue.normalize(ue.fromPortablePath(t))}var Jxe=et(Vxe());function zxe(t){return KTt(),XY[t]}var XY;function KTt(){XY||(XY={"--conditions":[],...Kxe(JTt()),...Kxe(process.execArgv)})}function Kxe(t){return(0,Jxe.default)({"--conditions":[String],"-C":"--conditions"},{argv:t,permissive:!0})}function JTt(){let t=[],e=zTt(process.env.NODE_OPTIONS||"",t);return t.length,e}function zTt(t,e){let r=[],s=!1,a=!0;for(let n=0;nparseInt(t,10)),Zxe=yl>19||yl===19&&ah>=2||yl===18&&ah>=13,lmr=yl===20&&ah<6||yl===19&&ah>=3,cmr=yl>19||yl===19&&ah>=6,umr=yl>=21||yl===20&&ah>=10||yl===18&&ah>=19,fmr=yl>=21||yl===20&&ah>=10||yl===18&&ah>=20,Amr=yl>=22;function Xxe(t){if(process.env.WATCH_REPORT_DEPENDENCIES&&process.send)if(t=t.map(e=>ue.fromPortablePath(fo.resolveVirtual(ue.toPortablePath(e)))),Zxe)process.send({"watch:require":t});else for(let e of t)process.send({"watch:require":e})}function eV(t,e){let r=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,s=Number(process.env.PNP_DEBUG_LEVEL),a=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,n=/^(\/|\.{1,2}(\/|$))/,c=/\/$/,f=/^\.{0,2}\//,p={name:null,reference:null},h=[],E=new Set;if(t.enableTopLevelFallback===!0&&h.push(p),e.compatibilityMode!==!1)for(let Fe of["react-scripts","gatsby"]){let Ne=t.packageRegistry.get(Fe);if(Ne)for(let Pe of Ne.keys()){if(Pe===null)throw new Error("Assertion failed: This reference shouldn't be null");h.push({name:Fe,reference:Pe})}}let{ignorePattern:C,packageRegistry:S,packageLocatorsByLocations:P}=t;function I(Fe,Ne){return{fn:Fe,args:Ne,error:null,result:null}}function R(Fe){let Ne=process.stderr?.hasColors?.()??process.stdout.isTTY,Pe=(it,_e)=>`\x1B[${it}m${_e}\x1B[0m`,Ye=Fe.error;console.error(Ye?Pe("31;1",`\u2716 ${Fe.error?.message.replace(/\n.*/s,"")}`):Pe("33;1","\u203C Resolution")),Fe.args.length>0&&console.error();for(let it of Fe.args)console.error(` ${Pe("37;1","In \u2190")} ${(0,$Y.inspect)(it,{colors:Ne,compact:!0})}`);Fe.result&&(console.error(),console.error(` ${Pe("37;1","Out \u2192")} ${(0,$Y.inspect)(Fe.result,{colors:Ne,compact:!0})}`));let ke=new Error().stack.match(/(?<=^ +)at.*/gm)?.slice(2)??[];if(ke.length>0){console.error();for(let it of ke)console.error(` ${Pe("38;5;244",it)}`)}console.error()}function N(Fe,Ne){if(e.allowDebug===!1)return Ne;if(Number.isFinite(s)){if(s>=2)return(...Pe)=>{let Ye=I(Fe,Pe);try{return Ye.result=Ne(...Pe)}catch(ke){throw Ye.error=ke}finally{R(Ye)}};if(s>=1)return(...Pe)=>{try{return Ne(...Pe)}catch(Ye){let ke=I(Fe,Pe);throw ke.error=Ye,R(ke),Ye}}}return Ne}function U(Fe){let Ne=g(Fe);if(!Ne)throw ds("INTERNAL","Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return Ne}function W(Fe){if(Fe.name===null)return!0;for(let Ne of t.dependencyTreeRoots)if(Ne.name===Fe.name&&Ne.reference===Fe.reference)return!0;return!1}let te=new Set(["node","require",...zxe("--conditions")]);function ie(Fe,Ne=te,Pe){let Ye=fe(K.join(Fe,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(Ye===null)throw ds("INTERNAL",`The locator that owns the "${Fe}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:ke}=U(Ye),it=K.join(ke,Er.manifest);if(!e.fakeFs.existsSync(it))return null;let _e=JSON.parse(e.fakeFs.readFileSync(it,"utf8"));if(_e.exports==null)return null;let x=K.contains(ke,Fe);if(x===null)throw ds("INTERNAL","unqualifiedPath doesn't contain the packageLocation (this is probably an internal error)");x!=="."&&!f.test(x)&&(x=`./${x}`);try{let w=Gxe({packageJSONUrl:(0,qm.pathToFileURL)(ue.fromPortablePath(it)),packageSubpath:x,exports:_e.exports,base:Pe?(0,qm.pathToFileURL)(ue.fromPortablePath(Pe)):null,conditions:Ne});return ue.toPortablePath((0,qm.fileURLToPath)(w))}catch(w){throw ds("EXPORTS_RESOLUTION_FAILED",w.message,{unqualifiedPath:cf(Fe),locator:Ye,pkgJson:_e,subpath:cf(x),conditions:Ne},w.code)}}function Ae(Fe,Ne,{extensions:Pe}){let Ye;try{Ne.push(Fe),Ye=e.fakeFs.statSync(Fe)}catch{}if(Ye&&!Ye.isDirectory())return e.fakeFs.realpathSync(Fe);if(Ye&&Ye.isDirectory()){let ke;try{ke=JSON.parse(e.fakeFs.readFileSync(K.join(Fe,Er.manifest),"utf8"))}catch{}let it;if(ke&&ke.main&&(it=K.resolve(Fe,ke.main)),it&&it!==Fe){let _e=Ae(it,Ne,{extensions:Pe});if(_e!==null)return _e}}for(let ke=0,it=Pe.length;ke{let x=JSON.stringify(_e.name);if(Ye.has(x))return;Ye.add(x);let w=we(_e);for(let b of w)if(U(b).packagePeers.has(Fe))ke(b);else{let F=Pe.get(b.name);typeof F>"u"&&Pe.set(b.name,F=new Set),F.add(b.reference)}};ke(Ne);let it=[];for(let _e of[...Pe.keys()].sort())for(let x of[...Pe.get(_e)].sort())it.push({name:_e,reference:x});return it}function fe(Fe,{resolveIgnored:Ne=!1,includeDiscardFromLookup:Pe=!1}={}){if(pe(Fe)&&!Ne)return null;let Ye=K.relative(t.basePath,Fe);Ye.match(n)||(Ye=`./${Ye}`),Ye.endsWith("/")||(Ye=`${Ye}/`);do{let ke=P.get(Ye);if(typeof ke>"u"||ke.discardFromLookup&&!Pe){Ye=Ye.substring(0,Ye.lastIndexOf("/",Ye.length-2)+1);continue}return ke.locator}while(Ye!=="");return null}function se(Fe){try{return e.fakeFs.readFileSync(ue.toPortablePath(Fe),"utf8")}catch(Ne){if(Ne.code==="ENOENT")return;throw Ne}}function X(Fe,Ne,{considerBuiltins:Pe=!0}={}){if(Fe.startsWith("#"))throw new Error("resolveToUnqualified can not handle private import mappings");if(Fe==="pnpapi")return ue.toPortablePath(e.pnpapiResolution);if(Pe&&(0,lh.isBuiltin)(Fe))return null;let Ye=cf(Fe),ke=Ne&&cf(Ne);if(Ne&&pe(Ne)&&(!K.isAbsolute(Fe)||fe(Fe)===null)){let x=me(Fe,Ne);if(x===!1)throw ds("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp) + +Require request: "${Ye}" +Required by: ${ke} +`,{request:Ye,issuer:ke});return ue.toPortablePath(x)}let it,_e=Fe.match(a);if(_e){if(!Ne)throw ds("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:Ye,issuer:ke});let[,x,w]=_e,b=fe(Ne);if(!b){let Te=me(Fe,Ne);if(Te===!1)throw ds("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree). + +Require path: "${Ye}" +Required by: ${ke} +`,{request:Ye,issuer:ke});return ue.toPortablePath(Te)}let F=U(b).packageDependencies.get(x),z=null;if(F==null&&b.name!==null){let Te=t.fallbackExclusionList.get(b.name);if(!Te||!Te.has(b.reference)){for(let Et=0,qt=h.length;EtW(lt))?Z=ds("MISSING_PEER_DEPENDENCY",`${b.name} tried to access ${x} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==Ye?` (via "${Ye}")`:""} +Required by: ${b.name}@${b.reference} (via ${ke}) +${Te.map(lt=>`Ancestor breaking the chain: ${lt.name}@${lt.reference} +`).join("")} +`,{request:Ye,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x,brokenAncestors:Te}):Z=ds("MISSING_PEER_DEPENDENCY",`${b.name} tried to access ${x} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==Ye?` (via "${Ye}")`:""} +Required by: ${b.name}@${b.reference} (via ${ke}) + +${Te.map(lt=>`Ancestor breaking the chain: ${lt.name}@${lt.reference} +`).join("")} +`,{request:Ye,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x,brokenAncestors:Te})}else F===void 0&&(!Pe&&(0,lh.isBuiltin)(Fe)?W(b)?Z=ds("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==Ye?` (via "${Ye}")`:""} +Required by: ${ke} +`,{request:Ye,issuer:ke,dependencyName:x}):Z=ds("UNDECLARED_DEPENDENCY",`${b.name} tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in ${b.name}'s dependencies, this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==Ye?` (via "${Ye}")`:""} +Required by: ${ke} +`,{request:Ye,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x}):W(b)?Z=ds("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==Ye?` (via "${Ye}")`:""} +Required by: ${ke} +`,{request:Ye,issuer:ke,dependencyName:x}):Z=ds("UNDECLARED_DEPENDENCY",`${b.name} tried to access ${x}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==Ye?` (via "${Ye}")`:""} +Required by: ${b.name}@${b.reference} (via ${ke}) +`,{request:Ye,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x}));if(F==null){if(z===null||Z===null)throw Z||new Error("Assertion failed: Expected an error to have been set");F=z;let Te=Z.message.replace(/\n.*/g,"");Z.message=Te,!E.has(Te)&&s!==0&&(E.add(Te),process.emitWarning(Z))}let $=Array.isArray(F)?{name:F[0],reference:F[1]}:{name:x,reference:F},oe=U($);if(!oe.packageLocation)throw ds("MISSING_DEPENDENCY",`A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod. + +Required package: ${$.name}@${$.reference}${$.name!==Ye?` (via "${Ye}")`:""} +Required by: ${b.name}@${b.reference} (via ${ke}) +`,{request:Ye,issuer:ke,dependencyLocator:Object.assign({},$)});let xe=oe.packageLocation;w?it=K.join(xe,w):it=xe}else if(K.isAbsolute(Fe))it=K.normalize(Fe);else{if(!Ne)throw ds("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:Ye,issuer:ke});let x=K.resolve(Ne);Ne.match(c)?it=K.normalize(K.join(x,Fe)):it=K.normalize(K.join(K.dirname(x),Fe))}return K.normalize(it)}function De(Fe,Ne,Pe=te,Ye){if(n.test(Fe))return Ne;let ke=ie(Ne,Pe,Ye);return ke?K.normalize(ke):Ne}function Re(Fe,{extensions:Ne=Object.keys(lh.Module._extensions)}={}){let Pe=[],Ye=Ae(Fe,Pe,{extensions:Ne});if(Ye)return K.normalize(Ye);{Xxe(Pe.map(_e=>ue.fromPortablePath(_e)));let ke=cf(Fe),it=fe(Fe);if(it){let{packageLocation:_e}=U(it),x=!0;try{e.fakeFs.accessSync(_e)}catch(w){if(w?.code==="ENOENT")x=!1;else{let b=(w?.message??w??"empty exception thrown").replace(/^[A-Z]/,y=>y.toLowerCase());throw ds("QUALIFIED_PATH_RESOLUTION_FAILED",`Required package exists but could not be accessed (${b}). + +Missing package: ${it.name}@${it.reference} +Expected package location: ${cf(_e)} +`,{unqualifiedPath:ke,extensions:Ne})}}if(!x){let w=_e.includes("/unplugged/")?"Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).":"Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.";throw ds("QUALIFIED_PATH_RESOLUTION_FAILED",`${w} + +Missing package: ${it.name}@${it.reference} +Expected package location: ${cf(_e)} +`,{unqualifiedPath:ke,extensions:Ne})}}throw ds("QUALIFIED_PATH_RESOLUTION_FAILED",`Qualified path resolution failed: we looked for the following paths, but none could be accessed. + +Source path: ${ke} +${Pe.map(_e=>`Not found: ${cf(_e)} +`).join("")}`,{unqualifiedPath:ke,extensions:Ne})}}function gt(Fe,Ne,Pe){if(!Ne)throw new Error("Assertion failed: An issuer is required to resolve private import mappings");let Ye=Wxe({name:Fe,base:(0,qm.pathToFileURL)(ue.fromPortablePath(Ne)),conditions:Pe.conditions??te,readFileSyncFn:se});if(Ye instanceof URL)return Re(ue.toPortablePath((0,qm.fileURLToPath)(Ye)),{extensions:Pe.extensions});if(Ye.startsWith("#"))throw new Error("Mapping from one private import to another isn't allowed");return j(Ye,Ne,Pe)}function j(Fe,Ne,Pe={}){try{if(Fe.startsWith("#"))return gt(Fe,Ne,Pe);let{considerBuiltins:Ye,extensions:ke,conditions:it}=Pe,_e=X(Fe,Ne,{considerBuiltins:Ye});if(Fe==="pnpapi")return _e;if(_e===null)return null;let x=()=>Ne!==null?pe(Ne):!1,w=(!Ye||!(0,lh.isBuiltin)(Fe))&&!x()?De(Fe,_e,it,Ne):_e;return Re(w,{extensions:ke})}catch(Ye){throw Object.hasOwn(Ye,"pnpCode")&&Object.assign(Ye.data,{request:cf(Fe),issuer:Ne&&cf(Ne)}),Ye}}function rt(Fe){let Ne=K.normalize(Fe),Pe=fo.resolveVirtual(Ne);return Pe!==Ne?Pe:null}return{VERSIONS:Be,topLevel:Ce,getLocator:(Fe,Ne)=>Array.isArray(Ne)?{name:Ne[0],reference:Ne[1]}:{name:Fe,reference:Ne},getDependencyTreeRoots:()=>[...t.dependencyTreeRoots],getAllLocators(){let Fe=[];for(let[Ne,Pe]of S)for(let Ye of Pe.keys())Ne!==null&&Ye!==null&&Fe.push({name:Ne,reference:Ye});return Fe},getPackageInformation:Fe=>{let Ne=g(Fe);if(Ne===null)return null;let Pe=ue.fromPortablePath(Ne.packageLocation);return{...Ne,packageLocation:Pe}},findPackageLocator:Fe=>fe(ue.toPortablePath(Fe)),resolveToUnqualified:N("resolveToUnqualified",(Fe,Ne,Pe)=>{let Ye=Ne!==null?ue.toPortablePath(Ne):null,ke=X(ue.toPortablePath(Fe),Ye,Pe);return ke===null?null:ue.fromPortablePath(ke)}),resolveUnqualified:N("resolveUnqualified",(Fe,Ne)=>ue.fromPortablePath(Re(ue.toPortablePath(Fe),Ne))),resolveRequest:N("resolveRequest",(Fe,Ne,Pe)=>{let Ye=Ne!==null?ue.toPortablePath(Ne):null,ke=j(ue.toPortablePath(Fe),Ye,Pe);return ke===null?null:ue.fromPortablePath(ke)}),resolveVirtual:N("resolveVirtual",Fe=>{let Ne=rt(ue.toPortablePath(Fe));return Ne!==null?ue.fromPortablePath(Ne):null})}}bt();var $xe=(t,e,r)=>{let s=KD(t),a=qY(s,{basePath:e}),n=ue.join(e,Er.pnpCjs);return eV(a,{fakeFs:r,pnpapiResolution:n})};var rV=et(tke());Wt();var mA={};Vt(mA,{checkManifestCompatibility:()=>rke,extractBuildRequest:()=>hN,getExtractHint:()=>nV,hasBindingGyp:()=>iV});Ve();bt();function rke(t){return q.isPackageCompatible(t,As.getArchitectureSet())}function hN(t,e,r,{configuration:s}){let a=[];for(let n of["preinstall","install","postinstall"])e.manifest.scripts.has(n)&&a.push({type:0,script:n});return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&a.push({type:1,script:"node-gyp rebuild"}),a.length===0?null:t.linkType!=="HARD"?{skipped:!0,explain:n=>n.reportWarningOnce(6,`${q.prettyLocator(s,t)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`)}:r&&r.built===!1?{skipped:!0,explain:n=>n.reportInfoOnce(5,`${q.prettyLocator(s,t)} lists build scripts, but its build has been explicitly disabled through configuration.`)}:!s.get("enableScripts")&&!r.built?{skipped:!0,explain:n=>n.reportWarningOnce(4,`${q.prettyLocator(s,t)} lists build scripts, but all build scripts have been disabled.`)}:rke(t)?{skipped:!1,directives:a}:{skipped:!0,explain:n=>n.reportWarningOnce(76,`${q.prettyLocator(s,t)} The ${As.getArchitectureName()} architecture is incompatible with this package, build skipped.`)}}var XTt=new Set([".exe",".bin",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function nV(t){return t.packageFs.getExtractHint({relevantExtensions:XTt})}function iV(t){let e=K.join(t.prefixPath,"binding.gyp");return t.packageFs.existsSync(e)}var nb={};Vt(nb,{getUnpluggedPath:()=>rb});Ve();bt();function rb(t,{configuration:e}){return K.resolve(e.get("pnpUnpluggedFolder"),q.slugifyLocator(t))}var $Tt=new Set([q.makeIdent(null,"open").identHash,q.makeIdent(null,"opn").identHash]),og=class{constructor(){this.mode="strict";this.pnpCache=new Map}getCustomDataKey(){return JSON.stringify({name:"PnpLinker",version:2})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the PnP linker to be enabled");let s=ag(r.project).cjs;if(!le.existsSync(s))throw new nt(`The project in ${he.pretty(r.project.configuration,`${r.project.cwd}/package.json`,he.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let a=je.getFactoryWithDefault(this.pnpCache,s,()=>je.dynamicRequire(s,{cachingStrategy:je.CachingStrategy.FsTime})),n={name:q.stringifyIdent(e),reference:e.reference},c=a.getPackageInformation(n);if(!c)throw new nt(`Couldn't find ${q.prettyLocator(r.project.configuration,e)} in the currently installed PnP map - running an install might help`);return ue.toPortablePath(c.packageLocation)}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let s=ag(r.project).cjs;if(!le.existsSync(s))return null;let n=je.getFactoryWithDefault(this.pnpCache,s,()=>je.dynamicRequire(s,{cachingStrategy:je.CachingStrategy.FsTime})).findPackageLocator(ue.fromPortablePath(e));return n?q.makeLocator(q.parseIdent(n.name),n.reference):null}makeInstaller(e){return new Gm(e)}isEnabled(e){return!(e.project.configuration.get("nodeLinker")!=="pnp"||e.project.configuration.get("pnpMode")!==this.mode)}},Gm=class{constructor(e){this.opts=e;this.mode="strict";this.asyncActions=new je.AsyncActions(10);this.packageRegistry=new Map;this.virtualTemplates=new Map;this.isESMLoaderRequired=!1;this.customData={store:new Map};this.unpluggedPaths=new Set;this.opts=e}attachCustomData(e){this.customData=e}async installPackage(e,r,s){let a=q.stringifyIdent(e),n=e.reference,c=!!this.opts.project.tryWorkspaceByLocator(e),f=q.isVirtualLocator(e),p=e.peerDependencies.size>0&&!f,h=!p&&!c,E=!p&&e.linkType!=="SOFT",C,S;if(h||E){let te=f?q.devirtualizeLocator(e):e;C=this.customData.store.get(te.locatorHash),typeof C>"u"&&(C=await eRt(r),e.linkType==="HARD"&&this.customData.store.set(te.locatorHash,C)),C.manifest.type==="module"&&(this.isESMLoaderRequired=!0),S=this.opts.project.getDependencyMeta(te,e.version)}let P=h?hN(e,C,S,{configuration:this.opts.project.configuration}):null,I=E?await this.unplugPackageIfNeeded(e,C,r,S,s):r.packageFs;if(K.isAbsolute(r.prefixPath))throw new Error(`Assertion failed: Expected the prefix path (${r.prefixPath}) to be relative to the parent`);let R=K.resolve(I.getRealPath(),r.prefixPath),N=sV(this.opts.project.cwd,R),U=new Map,W=new Set;if(f){for(let te of e.peerDependencies.values())U.set(q.stringifyIdent(te),null),W.add(q.stringifyIdent(te));if(!c){let te=q.devirtualizeLocator(e);this.virtualTemplates.set(te.locatorHash,{location:sV(this.opts.project.cwd,fo.resolveVirtual(R)),locator:te})}}return je.getMapWithDefault(this.packageRegistry,a).set(n,{packageLocation:N,packageDependencies:U,packagePeers:W,linkType:e.linkType,discardFromLookup:r.discardFromLookup||!1}),{packageLocation:R,buildRequest:P}}async attachInternalDependencies(e,r){let s=this.getPackageInformation(e);for(let[a,n]of r){let c=q.areIdentsEqual(a,n)?n.reference:[q.stringifyIdent(n),n.reference];s.packageDependencies.set(q.stringifyIdent(a),c)}}async attachExternalDependents(e,r){for(let s of r)this.getDiskInformation(s).packageDependencies.set(q.stringifyIdent(e),e.reference)}async finalizeInstall(){if(this.opts.project.configuration.get("pnpMode")!==this.mode)return;let e=ag(this.opts.project);if(this.isEsmEnabled()||await le.removePromise(e.esmLoader),this.opts.project.configuration.get("nodeLinker")!=="pnp"){await le.removePromise(e.cjs),await le.removePromise(e.data),await le.removePromise(e.esmLoader),await le.removePromise(this.opts.project.configuration.get("pnpUnpluggedFolder"));return}for(let{locator:C,location:S}of this.virtualTemplates.values())je.getMapWithDefault(this.packageRegistry,q.stringifyIdent(C)).set(C.reference,{packageLocation:S,packageDependencies:new Map,packagePeers:new Set,linkType:"SOFT",discardFromLookup:!1});let r=this.opts.project.configuration.get("pnpFallbackMode"),s=this.opts.project.workspaces.map(({anchoredLocator:C})=>({name:q.stringifyIdent(C),reference:C.reference})),a=r!=="none",n=[],c=new Map,f=je.buildIgnorePattern([".yarn/sdks/**",...this.opts.project.configuration.get("pnpIgnorePatterns")]),p=this.packageRegistry,h=this.opts.project.configuration.get("pnpShebang"),E=this.opts.project.configuration.get("pnpZipBackend");if(r==="dependencies-only")for(let C of this.opts.project.storedPackages.values())this.opts.project.tryWorkspaceByLocator(C)&&n.push({name:q.stringifyIdent(C),reference:C.reference});return await this.asyncActions.wait(),await this.finalizeInstallWithPnp({dependencyTreeRoots:s,enableTopLevelFallback:a,fallbackExclusionList:n,fallbackPool:c,ignorePattern:f,pnpZipBackend:E,packageRegistry:p,shebang:h}),{customData:this.customData}}async transformPnpSettings(e){}isEsmEnabled(){if(this.opts.project.configuration.sources.has("pnpEnableEsmLoader"))return this.opts.project.configuration.get("pnpEnableEsmLoader");if(this.isESMLoaderRequired)return!0;for(let e of this.opts.project.workspaces)if(e.manifest.type==="module")return!0;return!1}async finalizeInstallWithPnp(e){let r=ag(this.opts.project),s=await this.locateNodeModules(e.ignorePattern);if(s.length>0){this.opts.report.reportWarning(31,"One or more node_modules have been detected and will be removed. This operation may take some time.");for(let n of s)await le.removePromise(n)}if(await this.transformPnpSettings(e),this.opts.project.configuration.get("pnpEnableInlining")){let n=xxe(e);await le.changeFilePromise(r.cjs,n,{automaticNewlines:!0,mode:493}),await le.removePromise(r.data)}else{let{dataFile:n,loaderFile:c}=kxe(e);await le.changeFilePromise(r.cjs,c,{automaticNewlines:!0,mode:493}),await le.changeFilePromise(r.data,n,{automaticNewlines:!0,mode:420})}this.isEsmEnabled()&&(this.opts.report.reportWarning(0,"ESM support for PnP uses the experimental loader API and is therefore experimental"),await le.changeFilePromise(r.esmLoader,(0,rV.default)(),{automaticNewlines:!0,mode:420}));let a=this.opts.project.configuration.get("pnpUnpluggedFolder");if(this.unpluggedPaths.size===0)await le.removePromise(a);else for(let n of await le.readdirPromise(a)){let c=K.resolve(a,n);this.unpluggedPaths.has(c)||await le.removePromise(c)}}async locateNodeModules(e){let r=[],s=e?new RegExp(e):null;for(let a of this.opts.project.workspaces){let n=K.join(a.cwd,"node_modules");if(s&&s.test(K.relative(this.opts.project.cwd,a.cwd))||!le.existsSync(n))continue;let c=await le.readdirPromise(n,{withFileTypes:!0}),f=c.filter(p=>!p.isDirectory()||p.name===".bin"||!p.name.startsWith("."));if(f.length===c.length)r.push(n);else for(let p of f)r.push(K.join(n,p.name))}return r}async unplugPackageIfNeeded(e,r,s,a,n){return this.shouldBeUnplugged(e,r,a)?this.unplugPackage(e,s,n):s.packageFs}shouldBeUnplugged(e,r,s){return typeof s.unplugged<"u"?s.unplugged:$Tt.has(e.identHash)||e.conditions!=null?!0:r.manifest.preferUnplugged!==null?r.manifest.preferUnplugged:!!(hN(e,r,s,{configuration:this.opts.project.configuration})?.skipped===!1||r.misc.extractHint)}async unplugPackage(e,r,s){let a=rb(e,{configuration:this.opts.project.configuration});return this.opts.project.disabledLocators.has(e.locatorHash)?new Hf(a,{baseFs:r.packageFs,pathUtils:K}):(this.unpluggedPaths.add(a),s.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{let n=K.join(a,r.prefixPath,".ready");await le.existsPromise(n)||(this.opts.project.storedBuildState.delete(e.locatorHash),await le.mkdirPromise(a,{recursive:!0}),await le.copyPromise(a,vt.dot,{baseFs:r.packageFs,overwrite:!1}),await le.writeFilePromise(n,""))})),new Sn(a))}getPackageInformation(e){let r=q.stringifyIdent(e),s=e.reference,a=this.packageRegistry.get(r);if(!a)throw new Error(`Assertion failed: The package information store should have been available (for ${q.prettyIdent(this.opts.project.configuration,e)})`);let n=a.get(s);if(!n)throw new Error(`Assertion failed: The package information should have been available (for ${q.prettyLocator(this.opts.project.configuration,e)})`);return n}getDiskInformation(e){let r=je.getMapWithDefault(this.packageRegistry,"@@disk"),s=sV(this.opts.project.cwd,e);return je.getFactoryWithDefault(r,s,()=>({packageLocation:s,packageDependencies:new Map,packagePeers:new Set,linkType:"SOFT",discardFromLookup:!1}))}};function sV(t,e){let r=K.relative(t,e);return r.match(/^\.{0,2}\//)||(r=`./${r}`),r.replace(/\/?$/,"/")}async function eRt(t){let e=await Ht.tryFind(t.prefixPath,{baseFs:t.packageFs})??new Ht,r=new Set(["preinstall","install","postinstall"]);for(let s of e.scripts.keys())r.has(s)||e.scripts.delete(s);return{manifest:{scripts:e.scripts,preferUnplugged:e.preferUnplugged,type:e.type},misc:{extractHint:nV(t),hasBindingGyp:iV(t)}}}Ve();Ve();Wt();var nke=et(Sa());var Pw=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Unplug direct dependencies from the entire project"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Unplug both direct and transitive dependencies"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=ge.Rest()}static{this.paths=[["unplug"]]}static{this.usage=ot.Usage({description:"force the unpacking of a list of packages",details:"\n This command will add the selectors matching the specified patterns to the list of packages that must be unplugged when installed.\n\n A package being unplugged means that instead of being referenced directly through its archive, it will be unpacked at install time in the directory configured via `pnpUnpluggedFolder`. Note that unpacking packages this way is generally not recommended because it'll make it harder to store your packages within the repository. However, it's a good approach to quickly and safely debug some packages, and can even sometimes be required depending on the context (for example when the package contains shellscripts).\n\n Running the command will set a persistent flag inside your top-level `package.json`, in the `dependenciesMeta` field. As such, to undo its effects, you'll need to revert the changes made to the manifest and run `yarn install` to apply the modification.\n\n By default, only direct dependencies from the current workspace are affected. If `-A,--all` is set, direct dependencies from the entire project are affected. Using the `-R,--recursive` flag will affect transitive dependencies as well as direct ones.\n\n This command accepts glob patterns inside the scope and name components (not the range). Make sure to escape the patterns to prevent your own shell from trying to expand them.\n ",examples:[["Unplug the lodash dependency from the active workspace","yarn unplug lodash"],["Unplug all instances of lodash referenced by any workspace","yarn unplug lodash -A"],["Unplug all instances of lodash referenced by the active workspace and its dependencies","yarn unplug lodash -R"],["Unplug all instances of lodash, anywhere","yarn unplug lodash -AR"],["Unplug one specific version of lodash","yarn unplug lodash@1.2.3"],["Unplug all packages with the `@babel` scope","yarn unplug '@babel/*'"],["Unplug all packages (only for testing, not recommended)","yarn unplug -R '*'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);if(r.get("nodeLinker")!=="pnp")throw new nt("This command can only be used if the `nodeLinker` option is set to `pnp`");await s.restoreInstallState();let c=new Set(this.patterns),f=this.patterns.map(P=>{let I=q.parseDescriptor(P),R=I.range!=="unknown"?I:q.makeDescriptor(I,"*");if(!Or.validRange(R.range))throw new nt(`The range of the descriptor patterns must be a valid semver range (${q.prettyDescriptor(r,R)})`);return N=>{let U=q.stringifyIdent(N);return!nke.default.isMatch(U,q.stringifyIdent(R))||N.version&&!Or.satisfiesWithPrereleases(N.version,R.range)?!1:(c.delete(P),!0)}}),p=()=>{let P=[];for(let I of s.storedPackages.values())!s.tryWorkspaceByLocator(I)&&!q.isVirtualLocator(I)&&f.some(R=>R(I))&&P.push(I);return P},h=P=>{let I=new Set,R=[],N=(U,W)=>{if(I.has(U.locatorHash))return;let te=!!s.tryWorkspaceByLocator(U);if(!(W>0&&!this.recursive&&te)&&(I.add(U.locatorHash),!s.tryWorkspaceByLocator(U)&&f.some(ie=>ie(U))&&R.push(U),!(W>0&&!this.recursive)))for(let ie of U.dependencies.values()){let Ae=s.storedResolutions.get(ie.descriptorHash);if(!Ae)throw new Error("Assertion failed: The resolution should have been registered");let ce=s.storedPackages.get(Ae);if(!ce)throw new Error("Assertion failed: The package should have been registered");N(ce,W+1)}};for(let U of P)N(U.anchoredPackage,0);return R},E,C;if(this.all&&this.recursive?(E=p(),C="the project"):this.all?(E=h(s.workspaces),C="any workspace"):(E=h([a]),C="this workspace"),c.size>1)throw new nt(`Patterns ${he.prettyList(r,c,he.Type.CODE)} don't match any packages referenced by ${C}`);if(c.size>0)throw new nt(`Pattern ${he.prettyList(r,c,he.Type.CODE)} doesn't match any packages referenced by ${C}`);E=je.sortMap(E,P=>q.stringifyLocator(P));let S=await Ot.start({configuration:r,stdout:this.context.stdout,json:this.json},async P=>{for(let I of E){let R=I.version??"unknown",N=s.topLevelWorkspace.manifest.ensureDependencyMeta(q.makeDescriptor(I,R));N.unplugged=!0,P.reportInfo(0,`Will unpack ${q.prettyLocator(r,I)} to ${he.pretty(r,rb(I,{configuration:r}),he.Type.PATH)}`),P.reportJson({locator:q.stringifyLocator(I),version:R})}await s.topLevelWorkspace.persistManifest(),this.json||P.reportSeparator()});return S.hasErrors()?S.exitCode():await s.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};var ag=t=>({cjs:K.join(t.cwd,Er.pnpCjs),data:K.join(t.cwd,Er.pnpData),esmLoader:K.join(t.cwd,Er.pnpEsmLoader)}),ske=t=>/\s/.test(t)?JSON.stringify(t):t;async function tRt(t,e,r){let s=/\s*--require\s+\S*\.pnp\.c?js\s*/g,a=/\s*--experimental-loader\s+\S*\.pnp\.loader\.mjs\s*/,n=(e.NODE_OPTIONS??"").replace(s," ").replace(a," ").trim();if(t.configuration.get("nodeLinker")!=="pnp"){e.NODE_OPTIONS=n||void 0;return}let c=ag(t),f=`--require ${ske(ue.fromPortablePath(c.cjs))}`;le.existsSync(c.esmLoader)&&(f=`${f} --experimental-loader ${(0,ike.pathToFileURL)(ue.fromPortablePath(c.esmLoader)).href}`),le.existsSync(c.cjs)&&(e.NODE_OPTIONS=n?`${f} ${n}`:f)}async function rRt(t,e){let r=ag(t);e(r.cjs),e(r.data),e(r.esmLoader),e(t.configuration.get("pnpUnpluggedFolder"))}var nRt={hooks:{populateYarnPaths:rRt,setupScriptEnvironment:tRt},configuration:{nodeLinker:{description:'The linker used for installing Node packages, one of: "pnp", "pnpm", or "node-modules"',type:"STRING",default:"pnp"},minizip:{description:"Whether Yarn should use minizip to extract archives",type:"BOOLEAN",default:!1},winLinkType:{description:"Whether Yarn should use Windows Junctions or symlinks when creating links on Windows.",type:"STRING",values:["junctions","symlinks"],default:"junctions"},pnpMode:{description:"If 'strict', generates standard PnP maps. If 'loose', merges them with the n_m resolution.",type:"STRING",default:"strict"},pnpShebang:{description:"String to prepend to the generated PnP script",type:"STRING",default:"#!/usr/bin/env node"},pnpIgnorePatterns:{description:"Array of glob patterns; files matching them will use the classic resolution",type:"STRING",default:[],isArray:!0},pnpZipBackend:{description:"Whether to use the experimental js implementation for the ZipFS",type:"STRING",values:["libzip","js"],default:"libzip"},pnpEnableEsmLoader:{description:"If true, Yarn will generate an ESM loader (`.pnp.loader.mjs`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.",type:"BOOLEAN",default:!1},pnpEnableInlining:{description:"If true, the PnP data will be inlined along with the generated loader",type:"BOOLEAN",default:!0},pnpFallbackMode:{description:"If true, the generated PnP loader will follow the top-level fallback rule",type:"STRING",default:"dependencies-only"},pnpUnpluggedFolder:{description:"Folder where the unplugged packages must be stored",type:"ABSOLUTE_PATH",default:"./.yarn/unplugged"}},linkers:[og],commands:[Pw]},iRt=nRt;var pke=et(uke());Wt();var pV=et(ye("crypto")),hke=et(ye("fs")),gke=1,_i="node_modules",gN=".bin",dke=".yarn-state.yml",CRt=1e3,hV=(s=>(s.CLASSIC="classic",s.HARDLINKS_LOCAL="hardlinks-local",s.HARDLINKS_GLOBAL="hardlinks-global",s))(hV||{}),ib=class{constructor(){this.installStateCache=new Map}getCustomDataKey(){return JSON.stringify({name:"NodeModulesLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the node-modules linker to be enabled");let s=r.project.tryWorkspaceByLocator(e);if(s)return s.cwd;let a=await je.getFactoryWithDefault(this.installStateCache,r.project.cwd,async()=>await AV(r.project,{unrollAliases:!0}));if(a===null)throw new nt("Couldn't find the node_modules state file - running an install might help (findPackageLocation)");let n=a.locatorMap.get(q.stringifyLocator(e));if(!n){let p=new nt(`Couldn't find ${q.prettyLocator(r.project.configuration,e)} in the currently installed node_modules map - running an install might help`);throw p.code="LOCATOR_NOT_INSTALLED",p}let c=n.locations.sort((p,h)=>p.split(K.sep).length-h.split(K.sep).length),f=K.join(r.project.configuration.startingCwd,_i);return c.find(p=>K.contains(f,p))||n.locations[0]}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let s=await je.getFactoryWithDefault(this.installStateCache,r.project.cwd,async()=>await AV(r.project,{unrollAliases:!0}));if(s===null)return null;let{locationRoot:a,segments:n}=dN(K.resolve(e),{skipPrefix:r.project.cwd}),c=s.locationTree.get(a);if(!c)return null;let f=c.locator;for(let p of n){if(c=c.children.get(p),!c)break;f=c.locator||f}return q.parseLocator(f)}makeInstaller(e){return new fV(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="node-modules"}},fV=class{constructor(e){this.opts=e;this.localStore=new Map;this.realLocatorChecksums=new Map;this.customData={store:new Map}}attachCustomData(e){this.customData=e}async installPackage(e,r){let s=K.resolve(r.packageFs.getRealPath(),r.prefixPath),a=this.customData.store.get(e.locatorHash);if(typeof a>"u"&&(a=await wRt(e,r),e.linkType==="HARD"&&this.customData.store.set(e.locatorHash,a)),!q.isPackageCompatible(e,this.opts.project.configuration.getSupportedArchitectures()))return{packageLocation:null,buildRequest:null};let n=new Map,c=new Set;n.has(q.stringifyIdent(e))||n.set(q.stringifyIdent(e),e.reference);let f=e;if(q.isVirtualLocator(e)){f=q.devirtualizeLocator(e);for(let E of e.peerDependencies.values())n.set(q.stringifyIdent(E),null),c.add(q.stringifyIdent(E))}let p={packageLocation:`${ue.fromPortablePath(s)}/`,packageDependencies:n,packagePeers:c,linkType:e.linkType,discardFromLookup:r.discardFromLookup??!1};this.localStore.set(e.locatorHash,{pkg:e,customPackageData:a,dependencyMeta:this.opts.project.getDependencyMeta(e,e.version),pnpNode:p});let h=r.checksum?r.checksum.substring(r.checksum.indexOf("/")+1):null;return this.realLocatorChecksums.set(f.locatorHash,h),{packageLocation:s,buildRequest:null}}async attachInternalDependencies(e,r){let s=this.localStore.get(e.locatorHash);if(typeof s>"u")throw new Error("Assertion failed: Expected information object to have been registered");for(let[a,n]of r){let c=q.areIdentsEqual(a,n)?n.reference:[q.stringifyIdent(n),n.reference];s.pnpNode.packageDependencies.set(q.stringifyIdent(a),c)}}async attachExternalDependents(e,r){throw new Error("External dependencies haven't been implemented for the node-modules linker")}async finalizeInstall(){if(this.opts.project.configuration.get("nodeLinker")!=="node-modules")return;let e=new fo({baseFs:new tA({maxOpenFiles:80,readOnlyArchives:!0})}),r=await AV(this.opts.project),s=this.opts.project.configuration.get("nmMode");(r===null||s!==r.nmMode)&&(this.opts.project.storedBuildState.clear(),r={locatorMap:new Map,binSymlinks:new Map,locationTree:new Map,nmMode:s,mtimeMs:0});let a=new Map(this.opts.project.workspaces.map(S=>{let P=this.opts.project.configuration.get("nmHoistingLimits");try{P=je.validateEnum(WD,S.manifest.installConfig?.hoistingLimits??P)}catch{let I=q.prettyWorkspace(this.opts.project.configuration,S);this.opts.report.reportWarning(57,`${I}: Invalid 'installConfig.hoistingLimits' value. Expected one of ${Object.values(WD).join(", ")}, using default: "${P}"`)}return[S.relativeCwd,P]})),n=new Map(this.opts.project.workspaces.map(S=>{let P=this.opts.project.configuration.get("nmSelfReferences");return P=S.manifest.installConfig?.selfReferences??P,[S.relativeCwd,P]})),c={VERSIONS:{std:1},topLevel:{name:null,reference:null},getLocator:(S,P)=>Array.isArray(P)?{name:P[0],reference:P[1]}:{name:S,reference:P},getDependencyTreeRoots:()=>this.opts.project.workspaces.map(S=>{let P=S.anchoredLocator;return{name:q.stringifyIdent(P),reference:P.reference}}),getPackageInformation:S=>{let P=S.reference===null?this.opts.project.topLevelWorkspace.anchoredLocator:q.makeLocator(q.parseIdent(S.name),S.reference),I=this.localStore.get(P.locatorHash);if(typeof I>"u")throw new Error("Assertion failed: Expected the package reference to have been registered");return I.pnpNode},findPackageLocator:S=>{let P=this.opts.project.tryWorkspaceByCwd(ue.toPortablePath(S));if(P!==null){let I=P.anchoredLocator;return{name:q.stringifyIdent(I),reference:I.reference}}throw new Error("Assertion failed: Unimplemented")},resolveToUnqualified:()=>{throw new Error("Assertion failed: Unimplemented")},resolveUnqualified:()=>{throw new Error("Assertion failed: Unimplemented")},resolveRequest:()=>{throw new Error("Assertion failed: Unimplemented")},resolveVirtual:S=>ue.fromPortablePath(fo.resolveVirtual(ue.toPortablePath(S)))},{tree:f,errors:p,preserveSymlinksRequired:h}=YD(c,{pnpifyFs:!1,validateExternalSoftLinks:!0,hoistingLimitsByCwd:a,project:this.opts.project,selfReferencesByCwd:n});if(!f){for(let{messageName:S,text:P}of p)this.opts.report.reportError(S,P);return}let E=HY(f);await PRt(r,E,{baseFs:e,project:this.opts.project,report:this.opts.report,realLocatorChecksums:this.realLocatorChecksums,loadManifest:async S=>{let P=q.parseLocator(S),I=this.localStore.get(P.locatorHash);if(typeof I>"u")throw new Error("Assertion failed: Expected the slot to exist");return I.customPackageData.manifest}});let C=[];for(let[S,P]of E.entries()){if(Eke(S))continue;let I=q.parseLocator(S),R=this.localStore.get(I.locatorHash);if(typeof R>"u")throw new Error("Assertion failed: Expected the slot to exist");if(this.opts.project.tryWorkspaceByLocator(R.pkg))continue;let N=mA.extractBuildRequest(R.pkg,R.customPackageData,R.dependencyMeta,{configuration:this.opts.project.configuration});N&&C.push({buildLocations:P.locations,locator:I,buildRequest:N})}return h&&this.opts.report.reportWarning(72,`The application uses portals and that's why ${he.pretty(this.opts.project.configuration,"--preserve-symlinks",he.Type.CODE)} Node option is required for launching it`),{customData:this.customData,records:C}}};async function wRt(t,e){let r=await Ht.tryFind(e.prefixPath,{baseFs:e.packageFs})??new Ht,s=new Set(["preinstall","install","postinstall"]);for(let a of r.scripts.keys())s.has(a)||r.scripts.delete(a);return{manifest:{bin:r.bin,scripts:r.scripts},misc:{hasBindingGyp:mA.hasBindingGyp(e)}}}async function BRt(t,e,r,s,{installChangedByUser:a}){let n="";n+=`# Warning: This file is automatically generated. Removing it is fine, but will +`,n+=`# cause your node_modules installation to become invalidated. +`,n+=` +`,n+=`__metadata: +`,n+=` version: ${gke} +`,n+=` nmMode: ${s.value} +`;let c=Array.from(e.keys()).sort(),f=q.stringifyLocator(t.topLevelWorkspace.anchoredLocator);for(let E of c){let C=e.get(E);n+=` +`,n+=`${JSON.stringify(E)}: +`,n+=` locations: +`;for(let S of C.locations){let P=K.contains(t.cwd,S);if(P===null)throw new Error(`Assertion failed: Expected the path to be within the project (${S})`);n+=` - ${JSON.stringify(P)} +`}if(C.aliases.length>0){n+=` aliases: +`;for(let S of C.aliases)n+=` - ${JSON.stringify(S)} +`}if(E===f&&r.size>0){n+=` bin: +`;for(let[S,P]of r){let I=K.contains(t.cwd,S);if(I===null)throw new Error(`Assertion failed: Expected the path to be within the project (${S})`);n+=` ${JSON.stringify(I)}: +`;for(let[R,N]of P){let U=K.relative(K.join(S,_i),N);n+=` ${JSON.stringify(R)}: ${JSON.stringify(U)} +`}}}}let p=t.cwd,h=K.join(p,_i,dke);a&&await le.removePromise(h),await le.changeFilePromise(h,n,{automaticNewlines:!0})}async function AV(t,{unrollAliases:e=!1}={}){let r=t.cwd,s=K.join(r,_i,dke),a;try{a=await le.statPromise(s)}catch{}if(!a)return null;let n=ls(await le.readFilePromise(s,"utf8"));if(n.__metadata.version>gke)return null;let c=n.__metadata.nmMode||"classic",f=new Map,p=new Map;delete n.__metadata;for(let[h,E]of Object.entries(n)){let C=E.locations.map(P=>K.join(r,P)),S=E.bin;if(S)for(let[P,I]of Object.entries(S)){let R=K.join(r,ue.toPortablePath(P)),N=je.getMapWithDefault(p,R);for(let[U,W]of Object.entries(I))N.set(U,ue.toPortablePath([R,_i,W].join(K.sep)))}if(f.set(h,{target:vt.dot,linkType:"HARD",locations:C,aliases:E.aliases||[]}),e&&E.aliases)for(let P of E.aliases){let{scope:I,name:R}=q.parseLocator(h),N=q.makeLocator(q.makeIdent(I,R),P),U=q.stringifyLocator(N);f.set(U,{target:vt.dot,linkType:"HARD",locations:C,aliases:[]})}}return{locatorMap:f,binSymlinks:p,locationTree:mke(f,{skipPrefix:t.cwd}),nmMode:c,mtimeMs:a.mtimeMs}}var kw=async(t,e)=>{if(t.split(K.sep).indexOf(_i)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${t}`);try{let r;if(!e.innerLoop&&(r=await le.lstatPromise(t),!r.isDirectory()&&!r.isSymbolicLink()||r.isSymbolicLink()&&!e.isWorkspaceDir)){await le.unlinkPromise(t);return}let s=await le.readdirPromise(t,{withFileTypes:!0});for(let n of s){let c=K.join(t,n.name);n.isDirectory()?(n.name!==_i||e&&e.innerLoop)&&await kw(c,{innerLoop:!0,contentsOnly:!1}):await le.unlinkPromise(c)}let a=!e.innerLoop&&e.isWorkspaceDir&&r?.isSymbolicLink();!e.contentsOnly&&!a&&await le.rmdirPromise(t)}catch(r){if(r.code!=="ENOENT"&&r.code!=="ENOTEMPTY")throw r}},fke=4,dN=(t,{skipPrefix:e})=>{let r=K.contains(e,t);if(r===null)throw new Error(`Assertion failed: Writing attempt prevented to ${t} which is outside project root: ${e}`);let s=r.split(K.sep).filter(p=>p!==""),a=s.indexOf(_i),n=s.slice(0,a).join(K.sep),c=K.join(e,n),f=s.slice(a);return{locationRoot:c,segments:f}},mke=(t,{skipPrefix:e})=>{let r=new Map;if(t===null)return r;let s=()=>({children:new Map,linkType:"HARD"});for(let[a,n]of t.entries()){if(n.linkType==="SOFT"&&K.contains(e,n.target)!==null){let f=je.getFactoryWithDefault(r,n.target,s);f.locator=a,f.linkType=n.linkType}for(let c of n.locations){let{locationRoot:f,segments:p}=dN(c,{skipPrefix:e}),h=je.getFactoryWithDefault(r,f,s);for(let E=0;E{if(process.platform==="win32"&&r==="junctions"){let s;try{s=await le.lstatPromise(t)}catch{}if(!s||s.isDirectory()){await le.symlinkPromise(t,e,"junction");return}}await le.symlinkPromise(K.relative(K.dirname(e),t),e)};async function yke(t,e,r){let s=K.join(t,`${pV.default.randomBytes(16).toString("hex")}.tmp`);try{await le.writeFilePromise(s,r);try{await le.linkPromise(s,e)}catch{}}finally{await le.unlinkPromise(s)}}async function vRt({srcPath:t,dstPath:e,entry:r,globalHardlinksStore:s,baseFs:a,nmMode:n}){if(r.kind==="file"){if(n.value==="hardlinks-global"&&s&&r.digest){let f=K.join(s,r.digest.substring(0,2),`${r.digest.substring(2)}.dat`),p;try{let h=await le.statPromise(f);if(h&&(!r.mtimeMs||h.mtimeMs>r.mtimeMs||h.mtimeMs{await le.mkdirPromise(t,{recursive:!0});let f=async(E=vt.dot)=>{let C=K.join(e,E),S=await r.readdirPromise(C,{withFileTypes:!0}),P=new Map;for(let I of S){let R=K.join(E,I.name),N,U=K.join(C,I.name);if(I.isFile()){if(N={kind:"file",mode:(await r.lstatPromise(U)).mode},a.value==="hardlinks-global"){let W=await Nn.checksumFile(U,{baseFs:r,algorithm:"sha1"});N.digest=W}}else if(I.isDirectory())N={kind:"directory"};else if(I.isSymbolicLink())N={kind:"symlink",symlinkTo:await r.readlinkPromise(U)};else throw new Error(`Unsupported file type (file: ${U}, mode: 0o${await r.statSync(U).mode.toString(8).padStart(6,"0")})`);if(P.set(R,N),I.isDirectory()&&R!==_i){let W=await f(R);for(let[te,ie]of W)P.set(te,ie)}}return P},p;if(a.value==="hardlinks-global"&&s&&c){let E=K.join(s,c.substring(0,2),`${c.substring(2)}.json`);try{p=new Map(Object.entries(JSON.parse(await le.readFilePromise(E,"utf8"))))}catch{p=await f()}}else p=await f();let h=!1;for(let[E,C]of p){let S=K.join(e,E),P=K.join(t,E);if(C.kind==="directory")await le.mkdirPromise(P,{recursive:!0});else if(C.kind==="file"){let I=C.mtimeMs;await vRt({srcPath:S,dstPath:P,entry:C,nmMode:a,baseFs:r,globalHardlinksStore:s}),C.mtimeMs!==I&&(h=!0)}else C.kind==="symlink"&&await gV(K.resolve(K.dirname(P),C.symlinkTo),P,n)}if(a.value==="hardlinks-global"&&s&&h&&c){let E=K.join(s,c.substring(0,2),`${c.substring(2)}.json`);await le.removePromise(E),await yke(s,E,Buffer.from(JSON.stringify(Object.fromEntries(p))))}};function DRt(t,e,r,s){let a=new Map,n=new Map,c=new Map,f=!1,p=(h,E,C,S,P)=>{let I=!0,R=K.join(h,E),N=new Set;if(E===_i||E.startsWith("@")){let W;try{W=le.statSync(R)}catch{}I=!!W,W?W.mtimeMs>r?(f=!0,N=new Set(le.readdirSync(R))):N=new Set(C.children.get(E).children.keys()):f=!0;let te=e.get(h);if(te){let ie=K.join(h,_i,gN),Ae;try{Ae=le.statSync(ie)}catch{}if(!Ae)f=!0;else if(Ae.mtimeMs>r){f=!0;let ce=new Set(le.readdirSync(ie)),me=new Map;n.set(h,me);for(let[pe,Be]of te)ce.has(pe)&&me.set(pe,Be)}else n.set(h,te)}}else I=P.has(E);let U=C.children.get(E);if(I){let{linkType:W,locator:te}=U,ie={children:new Map,linkType:W,locator:te};if(S.children.set(E,ie),te){let Ae=je.getSetWithDefault(c,te);Ae.add(R),c.set(te,Ae)}for(let Ae of U.children.keys())p(R,Ae,U,ie,N)}else U.locator&&s.storedBuildState.delete(q.parseLocator(U.locator).locatorHash)};for(let[h,E]of t){let{linkType:C,locator:S}=E,P={children:new Map,linkType:C,locator:S};if(a.set(h,P),S){let I=je.getSetWithDefault(c,E.locator);I.add(h),c.set(E.locator,I)}E.children.has(_i)&&p(h,_i,E,P,new Set)}return{locationTree:a,binSymlinks:n,locatorLocations:c,installChangedByUser:f}}function Eke(t){let e=q.parseDescriptor(t);return q.isVirtualDescriptor(e)&&(e=q.devirtualizeDescriptor(e)),e.range.startsWith("link:")}async function bRt(t,e,r,{loadManifest:s}){let a=new Map;for(let[f,{locations:p}]of t){let h=Eke(f)?null:await s(f,p[0]),E=new Map;if(h)for(let[C,S]of h.bin){let P=K.join(p[0],S);S!==""&&le.existsSync(P)&&E.set(C,S)}a.set(f,E)}let n=new Map,c=(f,p,h)=>{let E=new Map,C=K.contains(r,f);if(h.locator&&C!==null){let S=a.get(h.locator);for(let[P,I]of S){let R=K.join(f,ue.toPortablePath(I));E.set(P,R)}for(let[P,I]of h.children){let R=K.join(f,P),N=c(R,R,I);N.size>0&&n.set(f,new Map([...n.get(f)||new Map,...N]))}}else for(let[S,P]of h.children){let I=c(K.join(f,S),p,P);for(let[R,N]of I)E.set(R,N)}return E};for(let[f,p]of e){let h=c(f,f,p);h.size>0&&n.set(f,new Map([...n.get(f)||new Map,...h]))}return n}var Ake=(t,e)=>{if(!t||!e)return t===e;let r=q.parseLocator(t);q.isVirtualLocator(r)&&(r=q.devirtualizeLocator(r));let s=q.parseLocator(e);return q.isVirtualLocator(s)&&(s=q.devirtualizeLocator(s)),q.areLocatorsEqual(r,s)};function dV(t){return K.join(t.get("globalFolder"),"store")}async function PRt(t,e,{baseFs:r,project:s,report:a,loadManifest:n,realLocatorChecksums:c}){let f=K.join(s.cwd,_i),{locationTree:p,binSymlinks:h,locatorLocations:E,installChangedByUser:C}=DRt(t.locationTree,t.binSymlinks,t.mtimeMs,s),S=mke(e,{skipPrefix:s.cwd}),P=[],I=async({srcDir:Be,dstDir:Ce,linkType:g,globalHardlinksStore:we,nmMode:Ee,windowsLinkType:fe,packageChecksum:se})=>{let X=(async()=>{try{g==="SOFT"?(await le.mkdirPromise(K.dirname(Ce),{recursive:!0}),await gV(K.resolve(Be),Ce,fe)):await SRt(Ce,Be,{baseFs:r,globalHardlinksStore:we,nmMode:Ee,windowsLinkType:fe,packageChecksum:se})}catch(De){throw De.message=`While persisting ${Be} -> ${Ce} ${De.message}`,De}finally{ie.tick()}})().then(()=>P.splice(P.indexOf(X),1));P.push(X),P.length>fke&&await Promise.race(P)},R=async(Be,Ce,g)=>{let we=(async()=>{let Ee=async(fe,se,X)=>{try{X.innerLoop||await le.mkdirPromise(se,{recursive:!0});let De=await le.readdirPromise(fe,{withFileTypes:!0});for(let Re of De){if(!X.innerLoop&&Re.name===gN)continue;let gt=K.join(fe,Re.name),j=K.join(se,Re.name);Re.isDirectory()?(Re.name!==_i||X&&X.innerLoop)&&(await le.mkdirPromise(j,{recursive:!0}),await Ee(gt,j,{...X,innerLoop:!0})):me.value==="hardlinks-local"||me.value==="hardlinks-global"?await le.linkPromise(gt,j):await le.copyFilePromise(gt,j,hke.default.constants.COPYFILE_FICLONE)}}catch(De){throw X.innerLoop||(De.message=`While cloning ${fe} -> ${se} ${De.message}`),De}finally{X.innerLoop||ie.tick()}};await Ee(Be,Ce,g)})().then(()=>P.splice(P.indexOf(we),1));P.push(we),P.length>fke&&await Promise.race(P)},N=async(Be,Ce,g)=>{if(g)for(let[we,Ee]of Ce.children){let fe=g.children.get(we);await N(K.join(Be,we),Ee,fe)}else{Ce.children.has(_i)&&await kw(K.join(Be,_i),{contentsOnly:!1});let we=K.basename(Be)===_i&&p.has(K.join(K.dirname(Be)));await kw(Be,{contentsOnly:Be===f,isWorkspaceDir:we})}};for(let[Be,Ce]of p){let g=S.get(Be);for(let[we,Ee]of Ce.children){if(we===".")continue;let fe=g&&g.children.get(we),se=K.join(Be,we);await N(se,Ee,fe)}}let U=async(Be,Ce,g)=>{if(g){Ake(Ce.locator,g.locator)||await kw(Be,{contentsOnly:Ce.linkType==="HARD"});for(let[we,Ee]of Ce.children){let fe=g.children.get(we);await U(K.join(Be,we),Ee,fe)}}else{Ce.children.has(_i)&&await kw(K.join(Be,_i),{contentsOnly:!0});let we=K.basename(Be)===_i&&S.has(K.join(K.dirname(Be)));await kw(Be,{contentsOnly:Ce.linkType==="HARD",isWorkspaceDir:we})}};for(let[Be,Ce]of S){let g=p.get(Be);for(let[we,Ee]of Ce.children){if(we===".")continue;let fe=g&&g.children.get(we);await U(K.join(Be,we),Ee,fe)}}let W=new Map,te=[];for(let[Be,Ce]of E)for(let g of Ce){let{locationRoot:we,segments:Ee}=dN(g,{skipPrefix:s.cwd}),fe=S.get(we),se=we;if(fe){for(let X of Ee)if(se=K.join(se,X),fe=fe.children.get(X),!fe)break;if(fe){let X=Ake(fe.locator,Be),De=e.get(fe.locator),Re=De.target,gt=se,j=De.linkType;if(X)W.has(Re)||W.set(Re,gt);else if(Re!==gt){let rt=q.parseLocator(fe.locator);q.isVirtualLocator(rt)&&(rt=q.devirtualizeLocator(rt)),te.push({srcDir:Re,dstDir:gt,linkType:j,realLocatorHash:rt.locatorHash})}}}}for(let[Be,{locations:Ce}]of e.entries())for(let g of Ce){let{locationRoot:we,segments:Ee}=dN(g,{skipPrefix:s.cwd}),fe=p.get(we),se=S.get(we),X=we,De=e.get(Be),Re=q.parseLocator(Be);q.isVirtualLocator(Re)&&(Re=q.devirtualizeLocator(Re));let gt=Re.locatorHash,j=De.target,rt=g;if(j===rt)continue;let Fe=De.linkType;for(let Ne of Ee)se=se.children.get(Ne);if(!fe)te.push({srcDir:j,dstDir:rt,linkType:Fe,realLocatorHash:gt});else for(let Ne of Ee)if(X=K.join(X,Ne),fe=fe.children.get(Ne),!fe){te.push({srcDir:j,dstDir:rt,linkType:Fe,realLocatorHash:gt});break}}let ie=ho.progressViaCounter(te.length),Ae=a.reportProgress(ie),ce=s.configuration.get("nmMode"),me={value:ce},pe=s.configuration.get("winLinkType");try{let Be=me.value==="hardlinks-global"?`${dV(s.configuration)}/v1`:null;if(Be&&!await le.existsPromise(Be)){await le.mkdirpPromise(Be);for(let g=0;g<256;g++)await le.mkdirPromise(K.join(Be,g.toString(16).padStart(2,"0")))}for(let g of te)(g.linkType==="SOFT"||!W.has(g.srcDir))&&(W.set(g.srcDir,g.dstDir),await I({...g,globalHardlinksStore:Be,nmMode:me,windowsLinkType:pe,packageChecksum:c.get(g.realLocatorHash)||null}));await Promise.all(P),P.length=0;for(let g of te){let we=W.get(g.srcDir);g.linkType!=="SOFT"&&g.dstDir!==we&&await R(we,g.dstDir,{nmMode:me})}await Promise.all(P),await le.mkdirPromise(f,{recursive:!0});let Ce=await bRt(e,S,s.cwd,{loadManifest:n});await xRt(h,Ce,s.cwd,pe),await BRt(s,e,Ce,me,{installChangedByUser:C}),ce=="hardlinks-global"&&me.value=="hardlinks-local"&&a.reportWarningOnce(74,"'nmMode' has been downgraded to 'hardlinks-local' due to global cache and install folder being on different devices")}finally{Ae.stop()}}async function xRt(t,e,r,s){for(let a of t.keys()){if(K.contains(r,a)===null)throw new Error(`Assertion failed. Excepted bin symlink location to be inside project dir, instead it was at ${a}`);if(!e.has(a)){let n=K.join(a,_i,gN);await le.removePromise(n)}}for(let[a,n]of e){if(K.contains(r,a)===null)throw new Error(`Assertion failed. Excepted bin symlink location to be inside project dir, instead it was at ${a}`);let c=K.join(a,_i,gN),f=t.get(a)||new Map;await le.mkdirPromise(c,{recursive:!0});for(let p of f.keys())n.has(p)||(await le.removePromise(K.join(c,p)),process.platform==="win32"&&await le.removePromise(K.join(c,`${p}.cmd`)));for(let[p,h]of n){let E=f.get(p),C=K.join(c,p);E!==h&&(process.platform==="win32"?await(0,pke.default)(ue.fromPortablePath(h),ue.fromPortablePath(C),{createPwshFile:!1}):(await le.removePromise(C),await gV(h,C,s),K.contains(r,await le.realpathPromise(h))!==null&&await le.chmodPromise(h,493)))}}}Ve();bt();rA();var sb=class extends og{constructor(){super(...arguments);this.mode="loose"}makeInstaller(r){return new mV(r)}},mV=class extends Gm{constructor(){super(...arguments);this.mode="loose"}async transformPnpSettings(r){let s=new fo({baseFs:new tA({maxOpenFiles:80,readOnlyArchives:!0})}),a=$xe(r,this.opts.project.cwd,s),{tree:n,errors:c}=YD(a,{pnpifyFs:!1,project:this.opts.project});if(!n){for(let{messageName:C,text:S}of c)this.opts.report.reportError(C,S);return}let f=new Map;r.fallbackPool=f;let p=(C,S)=>{let P=q.parseLocator(S.locator),I=q.stringifyIdent(P);I===C?f.set(C,P.reference):f.set(C,[I,P.reference])},h=K.join(this.opts.project.cwd,Er.nodeModules),E=n.get(h);if(!(typeof E>"u")){if("target"in E)throw new Error("Assertion failed: Expected the root junction point to be a directory");for(let C of E.dirList){let S=K.join(h,C),P=n.get(S);if(typeof P>"u")throw new Error("Assertion failed: Expected the child to have been registered");if("target"in P)p(C,P);else for(let I of P.dirList){let R=K.join(S,I),N=n.get(R);if(typeof N>"u")throw new Error("Assertion failed: Expected the subchild to have been registered");if("target"in N)p(`${C}/${I}`,N);else throw new Error("Assertion failed: Expected the leaf junction to be a package")}}}}};var kRt={hooks:{cleanGlobalArtifacts:async t=>{let e=dV(t);await le.removePromise(e)}},configuration:{nmHoistingLimits:{description:"Prevents packages to be hoisted past specific levels",type:"STRING",values:["workspaces","dependencies","none"],default:"none"},nmMode:{description:"Defines in which measure Yarn must use hardlinks and symlinks when generated `node_modules` directories.",type:"STRING",values:["classic","hardlinks-local","hardlinks-global"],default:"classic"},nmSelfReferences:{description:"Defines whether the linker should generate self-referencing symlinks for workspaces.",type:"BOOLEAN",default:!0}},linkers:[ib,sb]},QRt=kRt;var yz={};Vt(yz,{NpmHttpFetcher:()=>lb,NpmRemapResolver:()=>ub,NpmSemverFetcher:()=>ch,NpmSemverResolver:()=>fb,NpmTagResolver:()=>Ab,default:()=>Hjt,npmConfigUtils:()=>pi,npmHttpUtils:()=>an,npmPublishUtils:()=>D1});Ve();var bke=et(fi());var si="npm:";var an={};Vt(an,{AuthType:()=>vke,customPackageError:()=>Wm,del:()=>WRt,get:()=>Ym,getIdentUrl:()=>mN,getPackageMetadata:()=>Rw,handleInvalidAuthenticationError:()=>lg,post:()=>qRt,put:()=>GRt});Ve();Ve();bt();var CV=et(lS()),wke=et(vG()),Bke=et(fi());var pi={};Vt(pi,{RegistryType:()=>Ike,getAuditRegistry:()=>TRt,getAuthConfiguration:()=>IV,getDefaultRegistry:()=>ob,getPublishRegistry:()=>RRt,getRegistryConfiguration:()=>Cke,getScopeConfiguration:()=>EV,getScopeRegistry:()=>Qw,normalizeRegistry:()=>zc});var Ike=(s=>(s.AUDIT_REGISTRY="npmAuditRegistry",s.FETCH_REGISTRY="npmRegistryServer",s.PUBLISH_REGISTRY="npmPublishRegistry",s))(Ike||{});function zc(t){return t.replace(/\/$/,"")}function TRt({configuration:t}){return ob({configuration:t,type:"npmAuditRegistry"})}function RRt(t,{configuration:e}){return t.publishConfig?.registry?zc(t.publishConfig.registry):t.name?Qw(t.name.scope,{configuration:e,type:"npmPublishRegistry"}):ob({configuration:e,type:"npmPublishRegistry"})}function Qw(t,{configuration:e,type:r="npmRegistryServer"}){let s=EV(t,{configuration:e});if(s===null)return ob({configuration:e,type:r});let a=s.get(r);return a===null?ob({configuration:e,type:r}):zc(a)}function ob({configuration:t,type:e="npmRegistryServer"}){let r=t.get(e);return zc(r!==null?r:t.get("npmRegistryServer"))}function Cke(t,{configuration:e}){let r=e.get("npmRegistries"),s=zc(t),a=r.get(s);if(typeof a<"u")return a;let n=r.get(s.replace(/^[a-z]+:/,""));return typeof n<"u"?n:null}var FRt=new Map([["npmRegistryServer","https://npm.jsr.io/"]]);function EV(t,{configuration:e}){if(t===null)return null;let s=e.get("npmScopes").get(t);return s||(t==="jsr"?FRt:null)}function IV(t,{configuration:e,ident:r}){let s=r&&EV(r.scope,{configuration:e});return s?.get("npmAuthIdent")||s?.get("npmAuthToken")?s:Cke(t,{configuration:e})||e}var vke=(a=>(a[a.NO_AUTH=0]="NO_AUTH",a[a.BEST_EFFORT=1]="BEST_EFFORT",a[a.CONFIGURATION=2]="CONFIGURATION",a[a.ALWAYS_AUTH=3]="ALWAYS_AUTH",a))(vke||{});async function lg(t,{attemptedAs:e,registry:r,headers:s,configuration:a}){if(EN(t))throw new Yt(41,"Invalid OTP token");if(t.originalError?.name==="HTTPError"&&t.originalError?.response.statusCode===401)throw new Yt(41,`Invalid authentication (${typeof e!="string"?`as ${await VRt(r,s,{configuration:a})}`:`attempted as ${e}`})`)}function Wm(t,e){let r=t.response?.statusCode;return r?r===404?"Package not found":r>=500&&r<600?`The registry appears to be down (using a ${he.applyHyperlink(e,"local cache","https://yarnpkg.com/advanced/lexicon#local-cache")} might have protected you against such outages)`:null:null}function mN(t){return t.scope?`/@${t.scope}%2f${t.name}`:`/${t.name}`}var Ske=new Map,NRt=new Map;async function ORt(t){return await je.getFactoryWithDefault(Ske,t,async()=>{let e=null;try{e=await le.readJsonPromise(t)}catch{}return e})}async function LRt(t,e,{configuration:r,cached:s,registry:a,headers:n,version:c,...f}){return await je.getFactoryWithDefault(NRt,t,async()=>await Ym(mN(e),{...f,customErrorMessage:Wm,configuration:r,registry:a,ident:e,headers:{...n,"If-None-Match":s?.etag,"If-Modified-Since":s?.lastModified},wrapNetworkRequest:async p=>async()=>{let h=await p();if(h.statusCode===304){if(s===null)throw new Error("Assertion failed: cachedMetadata should not be null");return{...h,body:s.metadata}}let E=_Rt(JSON.parse(h.body.toString())),C={metadata:E,etag:h.headers.etag,lastModified:h.headers["last-modified"]};return Ske.set(t,Promise.resolve(C)),Promise.resolve().then(async()=>{let S=`${t}-${process.pid}.tmp`;await le.mkdirPromise(K.dirname(S),{recursive:!0}),await le.writeJsonPromise(S,C,{compact:!0}),await le.renamePromise(S,t)}).catch(()=>{}),{...h,body:E}}}))}function MRt(t){return t.scope!==null?`@${t.scope}-${t.name}-${t.scope.length}`:t.name}async function Rw(t,{cache:e,project:r,registry:s,headers:a,version:n,...c}){let{configuration:f}=r;s=ab(f,{ident:t,registry:s});let p=HRt(f,s),h=K.join(p,`${MRt(t)}.json`),E=null;if(!r.lockfileNeedsRefresh&&(E=await ORt(h),E)){if(typeof n<"u"&&typeof E.metadata.versions[n]<"u")return E.metadata;if(f.get("enableOfflineMode")){let C=structuredClone(E.metadata),S=new Set;if(e){for(let I of Object.keys(C.versions)){let R=q.makeLocator(t,`npm:${I}`),N=e.getLocatorMirrorPath(R);(!N||!le.existsSync(N))&&(delete C.versions[I],S.add(I))}let P=C["dist-tags"].latest;if(S.has(P)){let I=Object.keys(E.metadata.versions).sort(Bke.default.compare),R=I.indexOf(P);for(;S.has(I[R])&&R>=0;)R-=1;R>=0?C["dist-tags"].latest=I[R]:delete C["dist-tags"].latest}}return C}}return await LRt(h,t,{...c,configuration:f,cached:E,registry:s,headers:a,version:n})}var Dke=["name","dist.tarball","bin","scripts","os","cpu","libc","dependencies","dependenciesMeta","optionalDependencies","peerDependencies","peerDependenciesMeta","deprecated"];function _Rt(t){return{"dist-tags":t["dist-tags"],versions:Object.fromEntries(Object.entries(t.versions).map(([e,r])=>[e,(0,wke.default)(r,Dke)]))}}var URt=Nn.makeHash(...Dke).slice(0,6);function HRt(t,e){let r=jRt(t),s=new URL(e);return K.join(r,URt,s.hostname)}function jRt(t){return K.join(t.get("globalFolder"),"metadata/npm")}async function Ym(t,{configuration:e,headers:r,ident:s,authType:a,registry:n,...c}){n=ab(e,{ident:s,registry:n}),s&&s.scope&&typeof a>"u"&&(a=1);let f=await yN(n,{authType:a,configuration:e,ident:s});f&&(r={...r,authorization:f});try{return await An.get(t.charAt(0)==="/"?`${n}${t}`:t,{configuration:e,headers:r,...c})}catch(p){throw await lg(p,{registry:n,configuration:e,headers:r}),p}}async function qRt(t,e,{attemptedAs:r,configuration:s,headers:a,ident:n,authType:c=3,registry:f,otp:p,...h}){f=ab(s,{ident:n,registry:f});let E=await yN(f,{authType:c,configuration:s,ident:n});E&&(a={...a,authorization:E}),p&&(a={...a,...Tw(p)});try{return await An.post(f+t,e,{configuration:s,headers:a,...h})}catch(C){if(!EN(C)||p)throw await lg(C,{attemptedAs:r,registry:f,configuration:s,headers:a}),C;p=await wV(C,{configuration:s});let S={...a,...Tw(p)};try{return await An.post(`${f}${t}`,e,{configuration:s,headers:S,...h})}catch(P){throw await lg(P,{attemptedAs:r,registry:f,configuration:s,headers:a}),P}}}async function GRt(t,e,{attemptedAs:r,configuration:s,headers:a,ident:n,authType:c=3,registry:f,otp:p,...h}){f=ab(s,{ident:n,registry:f});let E=await yN(f,{authType:c,configuration:s,ident:n});E&&(a={...a,authorization:E}),p&&(a={...a,...Tw(p)});try{return await An.put(f+t,e,{configuration:s,headers:a,...h})}catch(C){if(!EN(C))throw await lg(C,{attemptedAs:r,registry:f,configuration:s,headers:a}),C;p=await wV(C,{configuration:s});let S={...a,...Tw(p)};try{return await An.put(`${f}${t}`,e,{configuration:s,headers:S,...h})}catch(P){throw await lg(P,{attemptedAs:r,registry:f,configuration:s,headers:a}),P}}}async function WRt(t,{attemptedAs:e,configuration:r,headers:s,ident:a,authType:n=3,registry:c,otp:f,...p}){c=ab(r,{ident:a,registry:c});let h=await yN(c,{authType:n,configuration:r,ident:a});h&&(s={...s,authorization:h}),f&&(s={...s,...Tw(f)});try{return await An.del(c+t,{configuration:r,headers:s,...p})}catch(E){if(!EN(E)||f)throw await lg(E,{attemptedAs:e,registry:c,configuration:r,headers:s}),E;f=await wV(E,{configuration:r});let C={...s,...Tw(f)};try{return await An.del(`${c}${t}`,{configuration:r,headers:C,...p})}catch(S){throw await lg(S,{attemptedAs:e,registry:c,configuration:r,headers:s}),S}}}function ab(t,{ident:e,registry:r}){if(typeof r>"u"&&e)return Qw(e.scope,{configuration:t});if(typeof r!="string")throw new Error("Assertion failed: The registry should be a string");return zc(r)}async function yN(t,{authType:e=2,configuration:r,ident:s}){let a=IV(t,{configuration:r,ident:s}),n=YRt(a,e);if(!n)return null;let c=await r.reduceHook(f=>f.getNpmAuthenticationHeader,void 0,t,{configuration:r,ident:s});if(c)return c;if(a.get("npmAuthToken"))return`Bearer ${a.get("npmAuthToken")}`;if(a.get("npmAuthIdent")){let f=a.get("npmAuthIdent");return f.includes(":")?`Basic ${Buffer.from(f).toString("base64")}`:`Basic ${f}`}if(n&&e!==1)throw new Yt(33,"No authentication configured for request");return null}function YRt(t,e){switch(e){case 2:return t.get("npmAlwaysAuth");case 1:case 3:return!0;case 0:return!1;default:throw new Error("Unreachable")}}async function VRt(t,e,{configuration:r}){if(typeof e>"u"||typeof e.authorization>"u")return"an anonymous user";try{return(await An.get(new URL(`${t}/-/whoami`).href,{configuration:r,headers:e,jsonResponse:!0})).username??"an unknown user"}catch{return"an unknown user"}}async function wV(t,{configuration:e}){let r=t.originalError?.response.headers["npm-notice"];if(r&&(await Ot.start({configuration:e,stdout:process.stdout,includeFooter:!1},async a=>{if(a.reportInfo(0,r.replace(/(https?:\/\/\S+)/g,he.pretty(e,"$1",he.Type.URL))),!process.env.YARN_IS_TEST_ENV){let n=r.match(/open (https?:\/\/\S+)/i);if(n&&As.openUrl){let{openNow:c}=await(0,CV.prompt)({type:"confirm",name:"openNow",message:"Do you want to try to open this url now?",required:!0,initial:!0,onCancel:()=>process.exit(130)});c&&(await As.openUrl(n[1])||(a.reportSeparator(),a.reportWarning(0,"We failed to automatically open the url; you'll have to open it yourself in your browser of choice.")))}}}),process.stdout.write(` +`)),process.env.YARN_IS_TEST_ENV)return process.env.YARN_INJECT_NPM_2FA_TOKEN||"";let{otp:s}=await(0,CV.prompt)({type:"password",name:"otp",message:"One-time password:",required:!0,onCancel:()=>process.exit(130)});return process.stdout.write(` +`),s}function EN(t){if(t.originalError?.name!=="HTTPError")return!1;try{return(t.originalError?.response.headers["www-authenticate"].split(/,\s*/).map(r=>r.toLowerCase())).includes("otp")}catch{return!1}}function Tw(t){return{"npm-otp":t}}var lb=class{supports(e,r){if(!e.reference.startsWith(si))return!1;let{selector:s,params:a}=q.parseRange(e.reference);return!(!bke.default.valid(s)||a===null||typeof a.__archiveUrl!="string")}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),checksum:c}}async fetchFromNetwork(e,r){let{params:s}=q.parseRange(e.reference);if(s===null||typeof s.__archiveUrl!="string")throw new Error("Assertion failed: The archiveUrl querystring parameter should have been available");let a=await Ym(s.__archiveUrl,{customErrorMessage:Wm,configuration:r.project.configuration,ident:e});return await hs.convertToZip(a,{configuration:r.project.configuration,prefixPath:q.getIdentVendorPath(e),stripComponents:1})}};Ve();var ub=class{supportsDescriptor(e,r){return!(!e.range.startsWith(si)||!q.tryParseDescriptor(e.range.slice(si.length),!0))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){let s=r.project.configuration.normalizeDependency(q.parseDescriptor(e.range.slice(si.length),!0));return r.resolver.getResolutionDependencies(s,r)}async getCandidates(e,r,s){let a=s.project.configuration.normalizeDependency(q.parseDescriptor(e.range.slice(si.length),!0));return await s.resolver.getCandidates(a,r,s)}async getSatisfying(e,r,s,a){let n=a.project.configuration.normalizeDependency(q.parseDescriptor(e.range.slice(si.length),!0));return a.resolver.getSatisfying(n,r,s,a)}resolve(e,r){throw new Error("Unreachable")}};Ve();Ve();var Pke=et(fi());var ch=class t{supports(e,r){if(!e.reference.startsWith(si))return!1;let s=new URL(e.reference);return!(!Pke.default.valid(s.pathname)||s.searchParams.has("__archiveUrl"))}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote registry`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),checksum:c}}async fetchFromNetwork(e,r){let s;try{s=await Ym(t.getLocatorUrl(e),{customErrorMessage:Wm,configuration:r.project.configuration,ident:e})}catch{s=await Ym(t.getLocatorUrl(e).replace(/%2f/g,"/"),{customErrorMessage:Wm,configuration:r.project.configuration,ident:e})}return await hs.convertToZip(s,{configuration:r.project.configuration,prefixPath:q.getIdentVendorPath(e),stripComponents:1})}static isConventionalTarballUrl(e,r,{configuration:s}){let a=Qw(e.scope,{configuration:s}),n=t.getLocatorUrl(e);return r=r.replace(/^https?:(\/\/(?:[^/]+\.)?npmjs.org(?:$|\/))/,"https:$1"),a=a.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r=r.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r===a+n||r===a+n.replace(/%2f/g,"/")}static getLocatorUrl(e){let r=Or.clean(e.reference.slice(si.length));if(r===null)throw new Yt(10,"The npm semver resolver got selected, but the version isn't semver");return`${mN(e)}/-/${e.name}-${r}.tgz`}};Ve();Ve();Ve();var BV=et(fi());var IN=q.makeIdent(null,"node-gyp"),KRt=/\b(node-gyp|prebuild-install)\b/,fb=class{supportsDescriptor(e,r){return e.range.startsWith(si)?!!Or.validRange(e.range.slice(si.length)):!1}supportsLocator(e,r){if(!e.reference.startsWith(si))return!1;let{selector:s}=q.parseRange(e.reference);return!!BV.default.valid(s)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){let a=Or.validRange(e.range.slice(si.length));if(a===null)throw new Error(`Expected a valid range, got ${e.range.slice(si.length)}`);let n=await Rw(e,{cache:s.fetchOptions?.cache,project:s.project,version:BV.default.valid(a.raw)?a.raw:void 0}),c=je.mapAndFilter(Object.keys(n.versions),h=>{try{let E=new Or.SemVer(h);if(a.test(E))return E}catch{}return je.mapAndFilter.skip}),f=c.filter(h=>!n.versions[h.raw].deprecated),p=f.length>0?f:c;return p.sort((h,E)=>-h.compare(E)),p.map(h=>{let E=q.makeLocator(e,`${si}${h.raw}`),C=n.versions[h.raw].dist.tarball;return ch.isConventionalTarballUrl(E,C,{configuration:s.project.configuration})?E:q.bindLocator(E,{__archiveUrl:C})})}async getSatisfying(e,r,s,a){let n=Or.validRange(e.range.slice(si.length));if(n===null)throw new Error(`Expected a valid range, got ${e.range.slice(si.length)}`);return{locators:je.mapAndFilter(s,p=>{if(p.identHash!==e.identHash)return je.mapAndFilter.skip;let h=q.tryParseRange(p.reference,{requireProtocol:si});if(!h)return je.mapAndFilter.skip;let E=new Or.SemVer(h.selector);return n.test(E)?{locator:p,version:E}:je.mapAndFilter.skip}).sort((p,h)=>-p.version.compare(h.version)).map(({locator:p})=>p),sorted:!0}}async resolve(e,r){let{selector:s}=q.parseRange(e.reference),a=Or.clean(s);if(a===null)throw new Yt(10,"The npm semver resolver got selected, but the version isn't semver");let n=await Rw(e,{cache:r.fetchOptions?.cache,project:r.project,version:a});if(!Object.hasOwn(n,"versions"))throw new Yt(15,'Registry returned invalid data for - missing "versions" field');if(!Object.hasOwn(n.versions,a))throw new Yt(16,`Registry failed to return reference "${a}"`);let c=new Ht;if(c.load(n.versions[a]),!c.dependencies.has(IN.identHash)&&!c.peerDependencies.has(IN.identHash)){for(let f of c.scripts.values())if(f.match(KRt)){c.dependencies.set(IN.identHash,q.makeDescriptor(IN,"latest"));break}}return{...e,version:a,languageName:"node",linkType:"HARD",conditions:c.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(c.dependencies),peerDependencies:c.peerDependencies,dependenciesMeta:c.dependenciesMeta,peerDependenciesMeta:c.peerDependenciesMeta,bin:c.bin}}};Ve();Ve();var xke=et(fi());var Ab=class{supportsDescriptor(e,r){return!(!e.range.startsWith(si)||!Hp.test(e.range.slice(si.length)))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){let a=e.range.slice(si.length),n=await Rw(e,{cache:s.fetchOptions?.cache,project:s.project});if(!Object.hasOwn(n,"dist-tags"))throw new Yt(15,'Registry returned invalid data - missing "dist-tags" field');let c=n["dist-tags"];if(!Object.hasOwn(c,a))throw new Yt(16,`Registry failed to return tag "${a}"`);let f=c[a],p=q.makeLocator(e,`${si}${f}`),h=n.versions[f].dist.tarball;return ch.isConventionalTarballUrl(p,h,{configuration:s.project.configuration})?[p]:[q.bindLocator(p,{__archiveUrl:h})]}async getSatisfying(e,r,s,a){let n=[];for(let c of s){if(c.identHash!==e.identHash)continue;let f=q.tryParseRange(c.reference,{requireProtocol:si});if(!(!f||!xke.default.valid(f.selector))){if(f.params?.__archiveUrl){let p=q.makeRange({protocol:si,selector:f.selector,source:null,params:null}),[h]=await a.resolver.getCandidates(q.makeDescriptor(e,p),r,a);if(c.reference!==h.reference)continue}n.push(c)}}return{locators:n,sorted:!1}}async resolve(e,r){throw new Error("Unreachable")}};var D1={};Vt(D1,{getGitHead:()=>_jt,getPublishAccess:()=>EOe,getReadmeContent:()=>IOe,makePublishBody:()=>Mjt});Ve();Ve();bt();var f7={};Vt(f7,{PackCommand:()=>Gw,default:()=>bOt,packUtils:()=>IA});Ve();Ve();Ve();bt();Wt();var IA={};Vt(IA,{genPackList:()=>qN,genPackStream:()=>u7,genPackageManifest:()=>oTe,hasPackScripts:()=>l7,prepareForPack:()=>c7});Ve();bt();var a7=et(Sa()),iTe=et(eTe()),sTe=ye("zlib"),dOt=["/package.json","/readme","/readme.*","/license","/license.*","/licence","/licence.*","/changelog","/changelog.*"],mOt=["/package.tgz",".github",".git",".hg","node_modules",".npmignore",".gitignore",".#*",".DS_Store"];async function l7(t){return!!(In.hasWorkspaceScript(t,"prepack")||In.hasWorkspaceScript(t,"postpack"))}async function c7(t,{report:e},r){await In.maybeExecuteWorkspaceLifecycleScript(t,"prepack",{report:e});try{let s=K.join(t.cwd,Ht.fileName);await le.existsPromise(s)&&await t.manifest.loadFile(s,{baseFs:le}),await r()}finally{await In.maybeExecuteWorkspaceLifecycleScript(t,"postpack",{report:e})}}async function u7(t,e){typeof e>"u"&&(e=await qN(t));let r=new Set;for(let n of t.manifest.publishConfig?.executableFiles??new Set)r.add(K.normalize(n));for(let n of t.manifest.bin.values())r.add(K.normalize(n));let s=iTe.default.pack();process.nextTick(async()=>{for(let n of e){let c=K.normalize(n),f=K.resolve(t.cwd,c),p=K.join("package",c),h=await le.lstatPromise(f),E={name:p,mtime:new Date(ui.SAFE_TIME*1e3)},C=r.has(c)?493:420,S,P,I=new Promise((N,U)=>{S=N,P=U}),R=N=>{N?P(N):S()};if(h.isFile()){let N;c==="package.json"?N=Buffer.from(JSON.stringify(await oTe(t),null,2)):N=await le.readFilePromise(f),s.entry({...E,mode:C,type:"file"},N,R)}else h.isSymbolicLink()?s.entry({...E,mode:C,type:"symlink",linkname:await le.readlinkPromise(f)},R):R(new Error(`Unsupported file type ${h.mode} for ${ue.fromPortablePath(c)}`));await I}s.finalize()});let a=(0,sTe.createGzip)();return s.pipe(a),a}async function oTe(t){let e=JSON.parse(JSON.stringify(t.manifest.raw));return await t.project.configuration.triggerHook(r=>r.beforeWorkspacePacking,t,e),e}async function qN(t){let e=t.project,r=e.configuration,s={accept:[],reject:[]};for(let C of mOt)s.reject.push(C);for(let C of dOt)s.accept.push(C);s.reject.push(r.get("rcFilename"));let a=C=>{if(C===null||!C.startsWith(`${t.cwd}/`))return;let S=K.relative(t.cwd,C),P=K.resolve(vt.root,S);s.reject.push(P)};a(K.resolve(e.cwd,Er.lockfile)),a(r.get("cacheFolder")),a(r.get("globalFolder")),a(r.get("installStatePath")),a(r.get("virtualFolder")),a(r.get("yarnPath")),await r.triggerHook(C=>C.populateYarnPaths,e,C=>{a(C)});for(let C of e.workspaces){let S=K.relative(t.cwd,C.cwd);S!==""&&!S.match(/^(\.\.)?\//)&&s.reject.push(`/${S}`)}let n={accept:[],reject:[]},c=t.manifest.publishConfig?.main??t.manifest.main,f=t.manifest.publishConfig?.module??t.manifest.module,p=t.manifest.publishConfig?.browser??t.manifest.browser,h=t.manifest.publishConfig?.bin??t.manifest.bin;c!=null&&n.accept.push(K.resolve(vt.root,c)),f!=null&&n.accept.push(K.resolve(vt.root,f)),typeof p=="string"&&n.accept.push(K.resolve(vt.root,p));for(let C of h.values())n.accept.push(K.resolve(vt.root,C));if(p instanceof Map)for(let[C,S]of p.entries())n.accept.push(K.resolve(vt.root,C)),typeof S=="string"&&n.accept.push(K.resolve(vt.root,S));let E=t.manifest.files!==null;if(E){n.reject.push("/*");for(let C of t.manifest.files)aTe(n.accept,C,{cwd:vt.root})}return await yOt(t.cwd,{hasExplicitFileList:E,globalList:s,ignoreList:n})}async function yOt(t,{hasExplicitFileList:e,globalList:r,ignoreList:s}){let a=[],n=new jf(t),c=[[vt.root,[s]]];for(;c.length>0;){let[f,p]=c.pop(),h=await n.lstatPromise(f);if(!rTe(f,{globalList:r,ignoreLists:h.isDirectory()?null:p}))if(h.isDirectory()){let E=await n.readdirPromise(f),C=!1,S=!1;if(!e||f!==vt.root)for(let R of E)C=C||R===".gitignore",S=S||R===".npmignore";let P=S?await tTe(n,f,".npmignore"):C?await tTe(n,f,".gitignore"):null,I=P!==null?[P].concat(p):p;rTe(f,{globalList:r,ignoreLists:p})&&(I=[...p,{accept:[],reject:["**/*"]}]);for(let R of E)c.push([K.resolve(f,R),I])}else(h.isFile()||h.isSymbolicLink())&&a.push(K.relative(vt.root,f))}return a.sort()}async function tTe(t,e,r){let s={accept:[],reject:[]},a=await t.readFilePromise(K.join(e,r),"utf8");for(let n of a.split(/\n/g))aTe(s.reject,n,{cwd:e});return s}function EOt(t,{cwd:e}){let r=t[0]==="!";return r&&(t=t.slice(1)),t.match(/\.{0,1}\//)&&(t=K.resolve(e,t)),r&&(t=`!${t}`),t}function aTe(t,e,{cwd:r}){let s=e.trim();s===""||s[0]==="#"||t.push(EOt(s,{cwd:r}))}function rTe(t,{globalList:e,ignoreLists:r}){let s=jN(t,e.accept);if(s!==0)return s===2;let a=jN(t,e.reject);if(a!==0)return a===1;if(r!==null)for(let n of r){let c=jN(t,n.accept);if(c!==0)return c===2;let f=jN(t,n.reject);if(f!==0)return f===1}return!1}function jN(t,e){let r=e,s=[];for(let a=0;a{await c7(a,{report:p},async()=>{p.reportJson({base:ue.fromPortablePath(a.cwd)});let h=await qN(a);for(let E of h)p.reportInfo(null,ue.fromPortablePath(E)),p.reportJson({location:ue.fromPortablePath(E)});if(!this.dryRun){let E=await u7(a,h);await le.mkdirPromise(K.dirname(c),{recursive:!0});let C=le.createWriteStream(c);E.pipe(C),await new Promise(S=>{C.on("finish",S)})}}),this.dryRun||(p.reportInfo(0,`Package archive generated in ${he.pretty(r,c,he.Type.PATH)}`),p.reportJson({output:ue.fromPortablePath(c)}))})).exitCode()}};function IOt(t,{workspace:e}){let r=t.replace("%s",COt(e)).replace("%v",wOt(e));return ue.toPortablePath(r)}function COt(t){return t.manifest.name!==null?q.slugifyIdent(t.manifest.name):"package"}function wOt(t){return t.manifest.version!==null?t.manifest.version:"unknown"}var BOt=["dependencies","devDependencies","peerDependencies"],vOt="workspace:",SOt=(t,e)=>{e.publishConfig&&(e.publishConfig.type&&(e.type=e.publishConfig.type),e.publishConfig.main&&(e.main=e.publishConfig.main),e.publishConfig.browser&&(e.browser=e.publishConfig.browser),e.publishConfig.module&&(e.module=e.publishConfig.module),e.publishConfig.exports&&(e.exports=e.publishConfig.exports),e.publishConfig.imports&&(e.imports=e.publishConfig.imports),e.publishConfig.bin&&(e.bin=e.publishConfig.bin));let r=t.project;for(let s of BOt)for(let a of t.manifest.getForScope(s).values()){let n=r.tryWorkspaceByDescriptor(a),c=q.parseRange(a.range);if(c.protocol===vOt)if(n===null){if(r.tryWorkspaceByIdent(a)===null)throw new Yt(21,`${q.prettyDescriptor(r.configuration,a)}: No local workspace found for this range`)}else{let f;q.areDescriptorsEqual(a,n.anchoredDescriptor)||c.selector==="*"?f=n.manifest.version??"0.0.0":c.selector==="~"||c.selector==="^"?f=`${c.selector}${n.manifest.version??"0.0.0"}`:f=c.selector;let p=s==="dependencies"?q.makeDescriptor(a,"unknown"):null,h=p!==null&&t.manifest.ensureDependencyMeta(p).optional?"optionalDependencies":s;e[h][q.stringifyIdent(a)]=f}}},DOt={hooks:{beforeWorkspacePacking:SOt},commands:[Gw]},bOt=DOt;var yOe=et(dTe());Ve();var dOe=et(gOe()),{env:Bt}=process,xjt="application/vnd.in-toto+json",kjt="https://in-toto.io/Statement/v0.1",Qjt="https://in-toto.io/Statement/v1",Tjt="https://slsa.dev/provenance/v0.2",Rjt="https://slsa.dev/provenance/v1",Fjt="https://github.com/actions/runner",Njt="https://slsa-framework.github.io/github-actions-buildtypes/workflow/v1",Ojt="https://github.com/npm/cli/gitlab",Ljt="v0alpha1",mOe=async(t,e)=>{let r;if(Bt.GITHUB_ACTIONS){if(!Bt.ACTIONS_ID_TOKEN_REQUEST_URL)throw new Yt(91,'Provenance generation in GitHub Actions requires "write" access to the "id-token" permission');let s=(Bt.GITHUB_WORKFLOW_REF||"").replace(`${Bt.GITHUB_REPOSITORY}/`,""),a=s.indexOf("@"),n=s.slice(0,a),c=s.slice(a+1);r={_type:Qjt,subject:t,predicateType:Rjt,predicate:{buildDefinition:{buildType:Njt,externalParameters:{workflow:{ref:c,repository:`${Bt.GITHUB_SERVER_URL}/${Bt.GITHUB_REPOSITORY}`,path:n}},internalParameters:{github:{event_name:Bt.GITHUB_EVENT_NAME,repository_id:Bt.GITHUB_REPOSITORY_ID,repository_owner_id:Bt.GITHUB_REPOSITORY_OWNER_ID}},resolvedDependencies:[{uri:`git+${Bt.GITHUB_SERVER_URL}/${Bt.GITHUB_REPOSITORY}@${Bt.GITHUB_REF}`,digest:{gitCommit:Bt.GITHUB_SHA}}]},runDetails:{builder:{id:`${Fjt}/${Bt.RUNNER_ENVIRONMENT}`},metadata:{invocationId:`${Bt.GITHUB_SERVER_URL}/${Bt.GITHUB_REPOSITORY}/actions/runs/${Bt.GITHUB_RUN_ID}/attempts/${Bt.GITHUB_RUN_ATTEMPT}`}}}}}else if(Bt.GITLAB_CI){if(!Bt.SIGSTORE_ID_TOKEN)throw new Yt(91,`Provenance generation in GitLab CI requires "SIGSTORE_ID_TOKEN" with "sigstore" audience to be present in "id_tokens". For more info see: +https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html`);r={_type:kjt,subject:t,predicateType:Tjt,predicate:{buildType:`${Ojt}/${Ljt}`,builder:{id:`${Bt.CI_PROJECT_URL}/-/runners/${Bt.CI_RUNNER_ID}`},invocation:{configSource:{uri:`git+${Bt.CI_PROJECT_URL}`,digest:{sha1:Bt.CI_COMMIT_SHA},entryPoint:Bt.CI_JOB_NAME},parameters:{CI:Bt.CI,CI_API_GRAPHQL_URL:Bt.CI_API_GRAPHQL_URL,CI_API_V4_URL:Bt.CI_API_V4_URL,CI_BUILD_BEFORE_SHA:Bt.CI_BUILD_BEFORE_SHA,CI_BUILD_ID:Bt.CI_BUILD_ID,CI_BUILD_NAME:Bt.CI_BUILD_NAME,CI_BUILD_REF:Bt.CI_BUILD_REF,CI_BUILD_REF_NAME:Bt.CI_BUILD_REF_NAME,CI_BUILD_REF_SLUG:Bt.CI_BUILD_REF_SLUG,CI_BUILD_STAGE:Bt.CI_BUILD_STAGE,CI_COMMIT_BEFORE_SHA:Bt.CI_COMMIT_BEFORE_SHA,CI_COMMIT_BRANCH:Bt.CI_COMMIT_BRANCH,CI_COMMIT_REF_NAME:Bt.CI_COMMIT_REF_NAME,CI_COMMIT_REF_PROTECTED:Bt.CI_COMMIT_REF_PROTECTED,CI_COMMIT_REF_SLUG:Bt.CI_COMMIT_REF_SLUG,CI_COMMIT_SHA:Bt.CI_COMMIT_SHA,CI_COMMIT_SHORT_SHA:Bt.CI_COMMIT_SHORT_SHA,CI_COMMIT_TIMESTAMP:Bt.CI_COMMIT_TIMESTAMP,CI_COMMIT_TITLE:Bt.CI_COMMIT_TITLE,CI_CONFIG_PATH:Bt.CI_CONFIG_PATH,CI_DEFAULT_BRANCH:Bt.CI_DEFAULT_BRANCH,CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX:Bt.CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX,CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX:Bt.CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX,CI_DEPENDENCY_PROXY_SERVER:Bt.CI_DEPENDENCY_PROXY_SERVER,CI_DEPENDENCY_PROXY_USER:Bt.CI_DEPENDENCY_PROXY_USER,CI_JOB_ID:Bt.CI_JOB_ID,CI_JOB_NAME:Bt.CI_JOB_NAME,CI_JOB_NAME_SLUG:Bt.CI_JOB_NAME_SLUG,CI_JOB_STAGE:Bt.CI_JOB_STAGE,CI_JOB_STARTED_AT:Bt.CI_JOB_STARTED_AT,CI_JOB_URL:Bt.CI_JOB_URL,CI_NODE_TOTAL:Bt.CI_NODE_TOTAL,CI_PAGES_DOMAIN:Bt.CI_PAGES_DOMAIN,CI_PAGES_URL:Bt.CI_PAGES_URL,CI_PIPELINE_CREATED_AT:Bt.CI_PIPELINE_CREATED_AT,CI_PIPELINE_ID:Bt.CI_PIPELINE_ID,CI_PIPELINE_IID:Bt.CI_PIPELINE_IID,CI_PIPELINE_SOURCE:Bt.CI_PIPELINE_SOURCE,CI_PIPELINE_URL:Bt.CI_PIPELINE_URL,CI_PROJECT_CLASSIFICATION_LABEL:Bt.CI_PROJECT_CLASSIFICATION_LABEL,CI_PROJECT_DESCRIPTION:Bt.CI_PROJECT_DESCRIPTION,CI_PROJECT_ID:Bt.CI_PROJECT_ID,CI_PROJECT_NAME:Bt.CI_PROJECT_NAME,CI_PROJECT_NAMESPACE:Bt.CI_PROJECT_NAMESPACE,CI_PROJECT_NAMESPACE_ID:Bt.CI_PROJECT_NAMESPACE_ID,CI_PROJECT_PATH:Bt.CI_PROJECT_PATH,CI_PROJECT_PATH_SLUG:Bt.CI_PROJECT_PATH_SLUG,CI_PROJECT_REPOSITORY_LANGUAGES:Bt.CI_PROJECT_REPOSITORY_LANGUAGES,CI_PROJECT_ROOT_NAMESPACE:Bt.CI_PROJECT_ROOT_NAMESPACE,CI_PROJECT_TITLE:Bt.CI_PROJECT_TITLE,CI_PROJECT_URL:Bt.CI_PROJECT_URL,CI_PROJECT_VISIBILITY:Bt.CI_PROJECT_VISIBILITY,CI_REGISTRY:Bt.CI_REGISTRY,CI_REGISTRY_IMAGE:Bt.CI_REGISTRY_IMAGE,CI_REGISTRY_USER:Bt.CI_REGISTRY_USER,CI_RUNNER_DESCRIPTION:Bt.CI_RUNNER_DESCRIPTION,CI_RUNNER_ID:Bt.CI_RUNNER_ID,CI_RUNNER_TAGS:Bt.CI_RUNNER_TAGS,CI_SERVER_HOST:Bt.CI_SERVER_HOST,CI_SERVER_NAME:Bt.CI_SERVER_NAME,CI_SERVER_PORT:Bt.CI_SERVER_PORT,CI_SERVER_PROTOCOL:Bt.CI_SERVER_PROTOCOL,CI_SERVER_REVISION:Bt.CI_SERVER_REVISION,CI_SERVER_SHELL_SSH_HOST:Bt.CI_SERVER_SHELL_SSH_HOST,CI_SERVER_SHELL_SSH_PORT:Bt.CI_SERVER_SHELL_SSH_PORT,CI_SERVER_URL:Bt.CI_SERVER_URL,CI_SERVER_VERSION:Bt.CI_SERVER_VERSION,CI_SERVER_VERSION_MAJOR:Bt.CI_SERVER_VERSION_MAJOR,CI_SERVER_VERSION_MINOR:Bt.CI_SERVER_VERSION_MINOR,CI_SERVER_VERSION_PATCH:Bt.CI_SERVER_VERSION_PATCH,CI_TEMPLATE_REGISTRY_HOST:Bt.CI_TEMPLATE_REGISTRY_HOST,GITLAB_CI:Bt.GITLAB_CI,GITLAB_FEATURES:Bt.GITLAB_FEATURES,GITLAB_USER_ID:Bt.GITLAB_USER_ID,GITLAB_USER_LOGIN:Bt.GITLAB_USER_LOGIN,RUNNER_GENERATE_ARTIFACTS_METADATA:Bt.RUNNER_GENERATE_ARTIFACTS_METADATA},environment:{name:Bt.CI_RUNNER_DESCRIPTION,architecture:Bt.CI_RUNNER_EXECUTABLE_ARCH,server:Bt.CI_SERVER_URL,project:Bt.CI_PROJECT_PATH,job:{id:Bt.CI_JOB_ID},pipeline:{id:Bt.CI_PIPELINE_ID,ref:Bt.CI_CONFIG_PATH}}},metadata:{buildInvocationId:`${Bt.CI_JOB_URL}`,completeness:{parameters:!0,environment:!0,materials:!1},reproducible:!1},materials:[{uri:`git+${Bt.CI_PROJECT_URL}`,digest:{sha1:Bt.CI_COMMIT_SHA}}]}}}else throw new Yt(91,"Provenance generation is only supported in GitHub Actions and GitLab CI");return dOe.attest(Buffer.from(JSON.stringify(r)),xjt,e)};async function Mjt(t,e,{access:r,tag:s,registry:a,gitHead:n,provenance:c}){let f=t.manifest.name,p=t.manifest.version,h=q.stringifyIdent(f),E=yOe.default.fromData(e,{algorithms:["sha1","sha512"]}),C=r??EOe(t,f),S=await IOe(t),P=await IA.genPackageManifest(t),I=`${h}-${p}.tgz`,R=new URL(`${zc(a)}/${h}/-/${I}`),N={[I]:{content_type:"application/octet-stream",data:e.toString("base64"),length:e.length}};if(c){let U={name:`pkg:npm/${h.replace(/^@/,"%40")}@${p}`,digest:{sha512:E.sha512[0].hexDigest()}},W=await mOe([U]),te=JSON.stringify(W);N[`${h}-${p}.sigstore`]={content_type:W.mediaType,data:te,length:te.length}}return{_id:h,_attachments:N,name:h,access:C,"dist-tags":{[s]:p},versions:{[p]:{...P,_id:`${h}@${p}`,name:h,version:p,gitHead:n,dist:{shasum:E.sha1[0].hexDigest(),integrity:E.sha512[0].toString(),tarball:R.toString()}}},readme:S}}async function _jt(t){try{let{stdout:e}=await Gr.execvp("git",["rev-parse","--revs-only","HEAD"],{cwd:t});return e.trim()===""?void 0:e.trim()}catch{return}}function EOe(t,e){let r=t.project.configuration;return t.manifest.publishConfig&&typeof t.manifest.publishConfig.access=="string"?t.manifest.publishConfig.access:r.get("npmPublishAccess")!==null?r.get("npmPublishAccess"):e.scope?"restricted":"public"}async function IOe(t){let e=ue.toPortablePath(`${t.cwd}/README.md`),r=t.manifest.name,a=`# ${q.stringifyIdent(r)} +`;try{a=await le.readFilePromise(e,"utf8")}catch(n){if(n.code==="ENOENT")return a;throw n}return a}var mz={npmAlwaysAuth:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"BOOLEAN",default:!1},npmAuthIdent:{description:"Authentication identity for the npm registry (_auth in npm and yarn v1)",type:"SECRET",default:null},npmAuthToken:{description:"Authentication token for the npm registry (_authToken in npm and yarn v1)",type:"SECRET",default:null}},COe={npmAuditRegistry:{description:"Registry to query for audit reports",type:"STRING",default:null},npmPublishRegistry:{description:"Registry to push packages to",type:"STRING",default:null},npmRegistryServer:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"STRING",default:"https://registry.yarnpkg.com"}},Ujt={configuration:{...mz,...COe,npmScopes:{description:"Settings per package scope",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{...mz,...COe}}},npmRegistries:{description:"Settings per registry",type:"MAP",normalizeKeys:zc,valueDefinition:{description:"",type:"SHAPE",properties:{...mz}}}},fetchers:[lb,ch],resolvers:[ub,fb,Ab]},Hjt=Ujt;var bz={};Vt(bz,{NpmAuditCommand:()=>P1,NpmInfoCommand:()=>x1,NpmLoginCommand:()=>k1,NpmLogoutCommand:()=>T1,NpmPublishCommand:()=>R1,NpmTagAddCommand:()=>N1,NpmTagListCommand:()=>F1,NpmTagRemoveCommand:()=>O1,NpmWhoamiCommand:()=>L1,default:()=>Kjt,npmAuditTypes:()=>fP,npmAuditUtils:()=>ML});Ve();Ve();Wt();var Bz=et(Sa());Ul();var fP={};Vt(fP,{Environment:()=>cP,Severity:()=>uP});var cP=(s=>(s.All="all",s.Production="production",s.Development="development",s))(cP||{}),uP=(n=>(n.Info="info",n.Low="low",n.Moderate="moderate",n.High="high",n.Critical="critical",n))(uP||{});var ML={};Vt(ML,{allSeverities:()=>b1,getPackages:()=>wz,getReportTree:()=>Iz,getSeverityInclusions:()=>Ez,getTopLevelDependencies:()=>Cz});Ve();var wOe=et(fi());var b1=["info","low","moderate","high","critical"];function Ez(t){if(typeof t>"u")return new Set(b1);let e=b1.indexOf(t),r=b1.slice(e);return new Set(r)}function Iz(t){let e={},r={children:e};for(let[s,a]of je.sortMap(Object.entries(t),n=>n[0]))for(let n of je.sortMap(a,c=>`${c.id}`))e[`${s}/${n.id}`]={value:he.tuple(he.Type.IDENT,q.parseIdent(s)),children:{ID:typeof n.id<"u"&&{label:"ID",value:he.tuple(he.Type.ID,n.id)},Issue:{label:"Issue",value:he.tuple(he.Type.NO_HINT,n.title)},URL:typeof n.url<"u"&&{label:"URL",value:he.tuple(he.Type.URL,n.url)},Severity:{label:"Severity",value:he.tuple(he.Type.NO_HINT,n.severity)},"Vulnerable Versions":{label:"Vulnerable Versions",value:he.tuple(he.Type.RANGE,n.vulnerable_versions)},"Tree Versions":{label:"Tree Versions",children:[...n.versions].sort(wOe.default.compare).map(c=>({value:he.tuple(he.Type.REFERENCE,c)}))},Dependents:{label:"Dependents",children:je.sortMap(n.dependents,c=>q.stringifyLocator(c)).map(c=>({value:he.tuple(he.Type.LOCATOR,c)}))}}};return r}function Cz(t,e,{all:r,environment:s}){let a=[],n=r?t.workspaces:[e],c=["all","production"].includes(s),f=["all","development"].includes(s);for(let p of n)for(let h of p.anchoredPackage.dependencies.values())(p.manifest.devDependencies.has(h.identHash)?!f:!c)||a.push({workspace:p,dependency:h});return a}function wz(t,e,{recursive:r}){let s=new Map,a=new Set,n=[],c=(f,p)=>{let h=t.storedResolutions.get(p.descriptorHash);if(typeof h>"u")throw new Error("Assertion failed: The resolution should have been registered");if(!a.has(h))a.add(h);else return;let E=t.storedPackages.get(h);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");if(q.ensureDevirtualizedLocator(E).reference.startsWith("npm:")&&E.version!==null){let S=q.stringifyIdent(E),P=je.getMapWithDefault(s,S);je.getArrayWithDefault(P,E.version).push(f)}if(r)for(let S of E.dependencies.values())n.push([E,S])};for(let{workspace:f,dependency:p}of e)n.push([f.anchoredLocator,p]);for(;n.length>0;){let[f,p]=n.shift();c(f,p)}return s}var P1=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Audit dependencies from all workspaces"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Audit transitive dependencies as well"});this.environment=ge.String("--environment","all",{description:"Which environments to cover",validator:Ao(cP)});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.noDeprecations=ge.Boolean("--no-deprecations",!1,{description:"Don't warn about deprecated packages"});this.severity=ge.String("--severity","info",{description:"Minimal severity requested for packages to be displayed",validator:Ao(uP)});this.excludes=ge.Array("--exclude",[],{description:"Array of glob patterns of packages to exclude from audit"});this.ignores=ge.Array("--ignore",[],{description:"Array of glob patterns of advisory ID's to ignore in the audit report"})}static{this.paths=[["npm","audit"]]}static{this.usage=ot.Usage({description:"perform a vulnerability audit against the installed packages",details:` + This command checks for known security reports on the packages you use. The reports are by default extracted from the npm registry, and may or may not be relevant to your actual program (not all vulnerabilities affect all code paths). + + For consistency with our other commands the default is to only check the direct dependencies for the active workspace. To extend this search to all workspaces, use \`-A,--all\`. To extend this search to both direct and transitive dependencies, use \`-R,--recursive\`. + + Applying the \`--severity\` flag will limit the audit table to vulnerabilities of the corresponding severity and above. Valid values are ${b1.map(r=>`\`${r}\``).join(", ")}. + + If the \`--json\` flag is set, Yarn will print the output exactly as received from the registry. Regardless of this flag, the process will exit with a non-zero exit code if a report is found for the selected packages. + + If certain packages produce false positives for a particular environment, the \`--exclude\` flag can be used to exclude any number of packages from the audit. This can also be set in the configuration file with the \`npmAuditExcludePackages\` option. + + If particular advisories are needed to be ignored, the \`--ignore\` flag can be used with Advisory ID's to ignore any number of advisories in the audit report. This can also be set in the configuration file with the \`npmAuditIgnoreAdvisories\` option. + + To understand the dependency tree requiring vulnerable packages, check the raw report with the \`--json\` flag or use \`yarn why package\` to get more information as to who depends on them. + `,examples:[["Checks for known security issues with the installed packages. The output is a list of known issues.","yarn npm audit"],["Audit dependencies in all workspaces","yarn npm audit --all"],["Limit auditing to `dependencies` (excludes `devDependencies`)","yarn npm audit --environment production"],["Show audit report as valid JSON","yarn npm audit --json"],["Audit all direct and transitive dependencies","yarn npm audit --recursive"],["Output moderate (or more severe) vulnerabilities","yarn npm audit --severity moderate"],["Exclude certain packages","yarn npm audit --exclude package1 --exclude package2"],["Ignore specific advisories","yarn npm audit --ignore 1234567 --ignore 7654321"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=Cz(s,a,{all:this.all,environment:this.environment}),c=wz(s,n,{recursive:this.recursive}),f=Array.from(new Set([...r.get("npmAuditExcludePackages"),...this.excludes])),p=Object.create(null);for(let[N,U]of c)f.some(W=>Bz.default.isMatch(N,W))||(p[N]=[...U.keys()]);let h=pi.getAuditRegistry({configuration:r}),E,C=await uA.start({configuration:r,stdout:this.context.stdout},async()=>{let N=an.post("/-/npm/v1/security/advisories/bulk",p,{authType:an.AuthType.BEST_EFFORT,configuration:r,jsonResponse:!0,registry:h}),U=this.noDeprecations?[]:await Promise.all(Array.from(Object.entries(p),async([te,ie])=>{let Ae=await an.getPackageMetadata(q.parseIdent(te),{project:s});return je.mapAndFilter(ie,ce=>{let{deprecated:me}=Ae.versions[ce];return me?[te,ce,me]:je.mapAndFilter.skip})})),W=await N;for(let[te,ie,Ae]of U.flat(1))Object.hasOwn(W,te)&&W[te].some(ce=>Or.satisfiesWithPrereleases(ie,ce.vulnerable_versions))||(W[te]??=[],W[te].push({id:`${te} (deprecation)`,title:(typeof Ae=="string"?Ae:"").trim()||"This package has been deprecated.",severity:"moderate",vulnerable_versions:ie}));E=W});if(C.hasErrors())return C.exitCode();let S=Ez(this.severity),P=Array.from(new Set([...r.get("npmAuditIgnoreAdvisories"),...this.ignores])),I=Object.create(null);for(let[N,U]of Object.entries(E)){let W=U.filter(te=>!Bz.default.isMatch(`${te.id}`,P)&&S.has(te.severity));W.length>0&&(I[N]=W.map(te=>{let ie=c.get(N);if(typeof ie>"u")throw new Error("Assertion failed: Expected the registry to only return packages that were requested");let Ae=[...ie.keys()].filter(me=>Or.satisfiesWithPrereleases(me,te.vulnerable_versions)),ce=new Map;for(let me of Ae)for(let pe of ie.get(me))ce.set(pe.locatorHash,pe);return{...te,versions:Ae,dependents:[...ce.values()]}}))}let R=Object.keys(I).length>0;return R?(ks.emitTree(Iz(I),{configuration:r,json:this.json,stdout:this.context.stdout,separators:2}),1):(await Ot.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async N=>{N.reportInfo(1,"No audit suggestions")}),R?1:0)}};Ve();Ve();bt();Wt();var vz=et(fi()),Sz=ye("util"),x1=class extends ut{constructor(){super(...arguments);this.fields=ge.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=ge.Rest()}static{this.paths=[["npm","info"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"show information about a package",details:"\n This command fetches information about a package from the npm registry and prints it in a tree format.\n\n The package does not have to be installed locally, but needs to have been published (in particular, local changes will be ignored even for workspaces).\n\n Append `@` to the package argument to provide information specific to the latest version that satisfies the range or to the corresponding tagged version. If the range is invalid or if there is no version satisfying the range, the command will print a warning and fall back to the latest version.\n\n If the `-f,--fields` option is set, it's a comma-separated list of fields which will be used to only display part of the package information.\n\n By default, this command won't return the `dist`, `readme`, and `users` fields, since they are often very long. To explicitly request those fields, explicitly list them with the `--fields` flag or request the output in JSON mode.\n ",examples:[["Show all available information about react (except the `dist`, `readme`, and `users` fields)","yarn npm info react"],["Show all available information about react as valid JSON (including the `dist`, `readme`, and `users` fields)","yarn npm info react --json"],["Show all available information about react@16.12.0","yarn npm info react@16.12.0"],["Show all available information about react@next","yarn npm info react@next"],["Show the description of react","yarn npm info react --fields description"],["Show all available versions of react","yarn npm info react --fields versions"],["Show the readme of react","yarn npm info react --fields readme"],["Show a few fields of react","yarn npm info react --fields homepage,repository"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd),a=typeof this.fields<"u"?new Set(["name",...this.fields.split(/\s*,\s*/)]):null,n=[],c=!1,f=await Ot.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async p=>{for(let h of this.packages){let E;if(h==="."){let ie=s.topLevelWorkspace;if(!ie.manifest.name)throw new nt(`Missing ${he.pretty(r,"name",he.Type.CODE)} field in ${ue.fromPortablePath(K.join(ie.cwd,Er.manifest))}`);E=q.makeDescriptor(ie.manifest.name,"unknown")}else E=q.parseDescriptor(h);let C=an.getIdentUrl(E),S=Dz(await an.get(C,{configuration:r,ident:E,jsonResponse:!0,customErrorMessage:an.customPackageError})),P=Object.keys(S.versions).sort(vz.default.compareLoose),R=S["dist-tags"].latest||P[P.length-1],N=Or.validRange(E.range);if(N){let ie=vz.default.maxSatisfying(P,N);ie!==null?R=ie:(p.reportWarning(0,`Unmet range ${q.prettyRange(r,E.range)}; falling back to the latest version`),c=!0)}else Object.hasOwn(S["dist-tags"],E.range)?R=S["dist-tags"][E.range]:E.range!=="unknown"&&(p.reportWarning(0,`Unknown tag ${q.prettyRange(r,E.range)}; falling back to the latest version`),c=!0);let U=S.versions[R],W={...S,...U,version:R,versions:P},te;if(a!==null){te={};for(let ie of a){let Ae=W[ie];if(typeof Ae<"u")te[ie]=Ae;else{p.reportWarning(1,`The ${he.pretty(r,ie,he.Type.CODE)} field doesn't exist inside ${q.prettyIdent(r,E)}'s information`),c=!0;continue}}}else this.json||(delete W.dist,delete W.readme,delete W.users),te=W;p.reportJson(te),this.json||n.push(te)}});Sz.inspect.styles.name="cyan";for(let p of n)(p!==n[0]||c)&&this.context.stdout.write(` +`),this.context.stdout.write(`${(0,Sz.inspect)(p,{depth:1/0,colors:!0,compact:!1})} +`);return f.exitCode()}};function Dz(t){if(Array.isArray(t)){let e=[];for(let r of t)r=Dz(r),r&&e.push(r);return e}else if(typeof t=="object"&&t!==null){let e={};for(let r of Object.keys(t)){if(r.startsWith("_"))continue;let s=Dz(t[r]);s&&(e[r]=s)}return e}else return t||null}Ve();Ve();Wt();var BOe=et(lS()),k1=class extends ut{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Login to the publish registry"});this.alwaysAuth=ge.Boolean("--always-auth",{description:"Set the npmAlwaysAuth configuration"})}static{this.paths=[["npm","login"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"store new login info to access the npm registry",details:"\n This command will ask you for your username, password, and 2FA One-Time-Password (when it applies). It will then modify your local configuration (in your home folder, never in the project itself) to reference the new tokens thus generated.\n\n Adding the `-s,--scope` flag will cause the authentication to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the authentication to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n ",examples:[["Login to the default registry","yarn npm login"],["Login to the registry linked to the @my-scope registry","yarn npm login --scope my-scope"],["Login to the publish registry for the current package","yarn npm login --publish"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=await _L({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await Ot.start({configuration:r,stdout:this.context.stdout,includeFooter:!1},async n=>{let c=await Gjt({configuration:r,registry:s,report:n,stdin:this.context.stdin,stdout:this.context.stdout}),f=await jjt(s,c,r);return await qjt(s,f,{alwaysAuth:this.alwaysAuth,scope:this.scope}),n.reportInfo(0,"Successfully logged in")})).exitCode()}};async function _L({scope:t,publish:e,configuration:r,cwd:s}){return t&&e?pi.getScopeRegistry(t,{configuration:r,type:pi.RegistryType.PUBLISH_REGISTRY}):t?pi.getScopeRegistry(t,{configuration:r}):e?pi.getPublishRegistry((await rC(r,s)).manifest,{configuration:r}):pi.getDefaultRegistry({configuration:r})}async function jjt(t,e,r){let s=`/-/user/org.couchdb.user:${encodeURIComponent(e.name)}`,a={_id:`org.couchdb.user:${e.name}`,name:e.name,password:e.password,type:"user",roles:[],date:new Date().toISOString()},n={attemptedAs:e.name,configuration:r,registry:t,jsonResponse:!0,authType:an.AuthType.NO_AUTH};try{return(await an.put(s,a,n)).token}catch(E){if(!(E.originalError?.name==="HTTPError"&&E.originalError?.response.statusCode===409))throw E}let c={...n,authType:an.AuthType.NO_AUTH,headers:{authorization:`Basic ${Buffer.from(`${e.name}:${e.password}`).toString("base64")}`}},f=await an.get(s,c);for(let[E,C]of Object.entries(f))(!a[E]||E==="roles")&&(a[E]=C);let p=`${s}/-rev/${a._rev}`;return(await an.put(p,a,c)).token}async function qjt(t,e,{alwaysAuth:r,scope:s}){let a=c=>f=>{let p=je.isIndexableObject(f)?f:{},h=p[c],E=je.isIndexableObject(h)?h:{};return{...p,[c]:{...E,...r!==void 0?{npmAlwaysAuth:r}:{},npmAuthToken:e}}},n=s?{npmScopes:a(s)}:{npmRegistries:a(t)};return await ze.updateHomeConfiguration(n)}async function Gjt({configuration:t,registry:e,report:r,stdin:s,stdout:a}){r.reportInfo(0,`Logging in to ${he.pretty(t,e,he.Type.URL)}`);let n=!1;if(e.match(/^https:\/\/npm\.pkg\.github\.com(\/|$)/)&&(r.reportInfo(0,"You seem to be using the GitHub Package Registry. Tokens must be generated with the 'repo', 'write:packages', and 'read:packages' permissions."),n=!0),r.reportSeparator(),t.env.YARN_IS_TEST_ENV)return{name:t.env.YARN_INJECT_NPM_USER||"",password:t.env.YARN_INJECT_NPM_PASSWORD||""};let c=await(0,BOe.prompt)([{type:"input",name:"name",message:"Username:",required:!0,onCancel:()=>process.exit(130),stdin:s,stdout:a},{type:"password",name:"password",message:n?"Token:":"Password:",required:!0,onCancel:()=>process.exit(130),stdin:s,stdout:a}]);return r.reportSeparator(),c}Ve();Ve();Wt();var Q1=new Set(["npmAuthIdent","npmAuthToken"]),T1=class extends ut{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Logout of the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Logout of the publish registry"});this.all=ge.Boolean("-A,--all",!1,{description:"Logout of all registries"})}static{this.paths=[["npm","logout"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"logout of the npm registry",details:"\n This command will log you out by modifying your local configuration (in your home folder, never in the project itself) to delete all credentials linked to a registry.\n\n Adding the `-s,--scope` flag will cause the deletion to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the deletion to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n\n Adding the `-A,--all` flag will cause the deletion to be done against all registries and scopes.\n ",examples:[["Logout of the default registry","yarn npm logout"],["Logout of the @my-scope scope","yarn npm logout --scope my-scope"],["Logout of the publish registry for the current package","yarn npm logout --publish"],["Logout of all registries","yarn npm logout --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=async()=>{let n=await _L({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope}),c=await ze.find(this.context.cwd,this.context.plugins),f=q.makeIdent(this.scope??null,"pkg");return!pi.getAuthConfiguration(n,{configuration:c,ident:f}).get("npmAuthToken")};return(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{if(this.all&&(await Yjt(),n.reportInfo(0,"Successfully logged out from everything")),this.scope){await vOe("npmScopes",this.scope),await s()?n.reportInfo(0,`Successfully logged out from ${this.scope}`):n.reportWarning(0,"Scope authentication settings removed, but some other ones settings still apply to it");return}let c=await _L({configuration:r,cwd:this.context.cwd,publish:this.publish});await vOe("npmRegistries",c),await s()?n.reportInfo(0,`Successfully logged out from ${c}`):n.reportWarning(0,"Registry authentication settings removed, but some other ones settings still apply to it")})).exitCode()}};function Wjt(t,e){let r=t[e];if(!je.isIndexableObject(r))return!1;let s=new Set(Object.keys(r));if([...Q1].every(n=>!s.has(n)))return!1;for(let n of Q1)s.delete(n);if(s.size===0)return t[e]=void 0,!0;let a={...r};for(let n of Q1)delete a[n];return t[e]=a,!0}async function Yjt(){let t=e=>{let r=!1,s=je.isIndexableObject(e)?{...e}:{};s.npmAuthToken&&(delete s.npmAuthToken,r=!0);for(let a of Object.keys(s))Wjt(s,a)&&(r=!0);if(Object.keys(s).length!==0)return r?s:e};return await ze.updateHomeConfiguration({npmRegistries:t,npmScopes:t})}async function vOe(t,e){return await ze.updateHomeConfiguration({[t]:r=>{let s=je.isIndexableObject(r)?r:{};if(!Object.hasOwn(s,e))return r;let a=s[e],n=je.isIndexableObject(a)?a:{},c=new Set(Object.keys(n));if([...Q1].every(p=>!c.has(p)))return r;for(let p of Q1)c.delete(p);if(c.size===0)return Object.keys(s).length===1?void 0:{...s,[e]:void 0};let f={};for(let p of Q1)f[p]=void 0;return{...s,[e]:{...n,...f}}}})}Ve();Wt();var R1=class extends ut{constructor(){super(...arguments);this.access=ge.String("--access",{description:"The access for the published package (public or restricted)"});this.tag=ge.String("--tag","latest",{description:"The tag on the registry that the package should be attached to"});this.tolerateRepublish=ge.Boolean("--tolerate-republish",!1,{description:"Warn and exit when republishing an already existing version of a package"});this.otp=ge.String("--otp",{description:"The OTP token to use with the command"});this.provenance=ge.Boolean("--provenance",!1,{description:"Generate provenance for the package. Only available in GitHub Actions and GitLab CI. Can be set globally through the `npmPublishProvenance` setting or the `YARN_NPM_CONFIG_PROVENANCE` environment variable, or per-package through the `publishConfig.provenance` field in package.json."})}static{this.paths=[["npm","publish"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"publish the active workspace to the npm registry",details:'\n This command will pack the active workspace into a fresh archive and upload it to the npm registry.\n\n The package will by default be attached to the `latest` tag on the registry, but this behavior can be overridden by using the `--tag` option.\n\n Note that for legacy reasons scoped packages are by default published with an access set to `restricted` (aka "private packages"). This requires you to register for a paid npm plan. In case you simply wish to publish a public scoped package to the registry (for free), just add the `--access public` flag. This behavior can be enabled by default through the `npmPublishAccess` settings.\n ',examples:[["Publish the active workspace","yarn npm publish"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);if(a.manifest.private)throw new nt("Private workspaces cannot be published");if(a.manifest.name===null||a.manifest.version===null)throw new nt("Workspaces must have valid names and versions to be published on an external registry");await s.restoreInstallState();let n=a.manifest.name,c=a.manifest.version,f=pi.getPublishRegistry(a.manifest,{configuration:r});return(await Ot.start({configuration:r,stdout:this.context.stdout},async h=>{if(this.tolerateRepublish)try{let E=await an.get(an.getIdentUrl(n),{configuration:r,registry:f,ident:n,jsonResponse:!0});if(!Object.hasOwn(E,"versions"))throw new Yt(15,'Registry returned invalid data for - missing "versions" field');if(Object.hasOwn(E.versions,c)){h.reportWarning(0,`Registry already knows about version ${c}; skipping.`);return}}catch(E){if(E.originalError?.response?.statusCode!==404)throw E}await In.maybeExecuteWorkspaceLifecycleScript(a,"prepublish",{report:h}),await IA.prepareForPack(a,{report:h},async()=>{let E=await IA.genPackList(a);for(let N of E)h.reportInfo(null,N);let C=await IA.genPackStream(a,E),S=await je.bufferStream(C),P=await D1.getGitHead(a.cwd),I=!1;a.manifest.publishConfig&&"provenance"in a.manifest.publishConfig?(I=!!a.manifest.publishConfig.provenance,I?h.reportInfo(null,"Generating provenance statement because `publishConfig.provenance` field is set."):h.reportInfo(null,"Skipping provenance statement because `publishConfig.provenance` field is set to false.")):this.provenance?(I=!0,h.reportInfo(null,"Generating provenance statement because `--provenance` flag is set.")):r.get("npmPublishProvenance")&&(I=!0,h.reportInfo(null,"Generating provenance statement because `npmPublishProvenance` setting is set."));let R=await D1.makePublishBody(a,S,{access:this.access,tag:this.tag,registry:f,gitHead:P,provenance:I});await an.put(an.getIdentUrl(n),R,{configuration:r,registry:f,ident:n,otp:this.otp,jsonResponse:!0})}),h.reportInfo(0,"Package archive published")})).exitCode()}};Ve();Wt();var SOe=et(fi());Ve();bt();Wt();var F1=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=ge.String({required:!1})}static{this.paths=[["npm","tag","list"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"list all dist-tags of a package",details:` + This command will list all tags of a package from the npm registry. + + If the package is not specified, Yarn will default to the current workspace. + `,examples:[["List all tags of package `my-pkg`","yarn npm tag list my-pkg"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n;if(typeof this.package<"u")n=q.parseIdent(this.package);else{if(!a)throw new ar(s.cwd,this.context.cwd);if(!a.manifest.name)throw new nt(`Missing 'name' field in ${ue.fromPortablePath(K.join(a.cwd,Er.manifest))}`);n=a.manifest.name}let c=await AP(n,r),p={children:je.sortMap(Object.entries(c),([h])=>h).map(([h,E])=>({value:he.tuple(he.Type.RESOLUTION,{descriptor:q.makeDescriptor(n,h),locator:q.makeLocator(n,E)})}))};return ks.emitTree(p,{configuration:r,json:this.json,stdout:this.context.stdout})}};async function AP(t,e){let r=`/-/package${an.getIdentUrl(t)}/dist-tags`;return an.get(r,{configuration:e,ident:t,jsonResponse:!0,customErrorMessage:an.customPackageError})}var N1=class extends ut{constructor(){super(...arguments);this.package=ge.String();this.tag=ge.String()}static{this.paths=[["npm","tag","add"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"add a tag for a specific version of a package",details:` + This command will add a tag to the npm registry for a specific version of a package. If the tag already exists, it will be overwritten. + `,examples:[["Add a `beta` tag for version `2.3.4-beta.4` of package `my-pkg`","yarn npm tag add my-pkg@2.3.4-beta.4 beta"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=q.parseDescriptor(this.package,!0),c=n.range;if(!SOe.default.valid(c))throw new nt(`The range ${he.pretty(r,n.range,he.Type.RANGE)} must be a valid semver version`);let f=pi.getPublishRegistry(a.manifest,{configuration:r}),p=he.pretty(r,n,he.Type.IDENT),h=he.pretty(r,c,he.Type.RANGE),E=he.pretty(r,this.tag,he.Type.CODE);return(await Ot.start({configuration:r,stdout:this.context.stdout},async S=>{let P=await AP(n,r);Object.hasOwn(P,this.tag)&&P[this.tag]===c&&S.reportWarning(0,`Tag ${E} is already set to version ${h}`);let I=`/-/package${an.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await an.put(I,c,{configuration:r,registry:f,ident:n,jsonRequest:!0,jsonResponse:!0}),S.reportInfo(0,`Tag ${E} added to version ${h} of package ${p}`)})).exitCode()}};Ve();Wt();var O1=class extends ut{constructor(){super(...arguments);this.package=ge.String();this.tag=ge.String()}static{this.paths=[["npm","tag","remove"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"remove a tag from a package",details:` + This command will remove a tag from a package from the npm registry. + `,examples:[["Remove the `beta` tag from package `my-pkg`","yarn npm tag remove my-pkg beta"]]})}async execute(){if(this.tag==="latest")throw new nt("The 'latest' tag cannot be removed.");let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=q.parseIdent(this.package),c=pi.getPublishRegistry(a.manifest,{configuration:r}),f=he.pretty(r,this.tag,he.Type.CODE),p=he.pretty(r,n,he.Type.IDENT),h=await AP(n,r);if(!Object.hasOwn(h,this.tag))throw new nt(`${f} is not a tag of package ${p}`);return(await Ot.start({configuration:r,stdout:this.context.stdout},async C=>{let S=`/-/package${an.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await an.del(S,{configuration:r,registry:c,ident:n,jsonResponse:!0}),C.reportInfo(0,`Tag ${f} removed from package ${p}`)})).exitCode()}};Ve();Ve();Wt();var L1=class extends ut{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Print username for the publish registry"})}static{this.paths=[["npm","whoami"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"display the name of the authenticated user",details:"\n Print the username associated with the current authentication settings to the standard output.\n\n When using `-s,--scope`, the username printed will be the one that matches the authentication settings of the registry associated with the given scope (those settings can be overriden using the `npmRegistries` map, and the registry associated with the scope is configured via the `npmScopes` map).\n\n When using `--publish`, the registry we'll select will by default be the one used when publishing packages (`publishConfig.registry` or `npmPublishRegistry` if available, otherwise we'll fallback to the regular `npmRegistryServer`).\n ",examples:[["Print username for the default registry","yarn npm whoami"],["Print username for the registry on a given scope","yarn npm whoami --scope company"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s;return this.scope&&this.publish?s=pi.getScopeRegistry(this.scope,{configuration:r,type:pi.RegistryType.PUBLISH_REGISTRY}):this.scope?s=pi.getScopeRegistry(this.scope,{configuration:r}):this.publish?s=pi.getPublishRegistry((await rC(r,this.context.cwd)).manifest,{configuration:r}):s=pi.getDefaultRegistry({configuration:r}),(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{let c;try{c=await an.get("/-/whoami",{configuration:r,registry:s,authType:an.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?q.makeIdent(this.scope,""):void 0})}catch(f){if(f.response?.statusCode===401||f.response?.statusCode===403){n.reportError(41,"Authentication failed - your credentials may have expired");return}else throw f}n.reportInfo(0,c.username)})).exitCode()}};var Vjt={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:"STRING",default:null},npmPublishProvenance:{description:"Whether to generate provenance for the published packages",type:"BOOLEAN",default:!1},npmAuditExcludePackages:{description:"Array of glob patterns of packages to exclude from npm audit",type:"STRING",default:[],isArray:!0},npmAuditIgnoreAdvisories:{description:"Array of glob patterns of advisory IDs to exclude from npm audit",type:"STRING",default:[],isArray:!0}},commands:[P1,x1,k1,T1,R1,N1,F1,O1,L1]},Kjt=Vjt;var Fz={};Vt(Fz,{PatchCommand:()=>q1,PatchCommitCommand:()=>j1,PatchFetcher:()=>mP,PatchResolver:()=>yP,default:()=>A6t,patchUtils:()=>dy});Ve();Ve();bt();rA();var dy={};Vt(dy,{applyPatchFile:()=>HL,diffFolders:()=>Tz,ensureUnpatchedDescriptor:()=>Pz,ensureUnpatchedLocator:()=>qL,extractPackageToDisk:()=>Qz,extractPatchFlags:()=>TOe,isParentRequired:()=>kz,isPatchDescriptor:()=>jL,isPatchLocator:()=>Fg,loadPatchFiles:()=>dP,makeDescriptor:()=>WL,makeLocator:()=>xz,makePatchHash:()=>Rz,parseDescriptor:()=>hP,parseLocator:()=>gP,parsePatchFile:()=>pP,unpatchDescriptor:()=>c6t,unpatchLocator:()=>u6t});Ve();bt();Ve();bt();var Jjt=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function M1(t){return K.relative(vt.root,K.resolve(vt.root,ue.toPortablePath(t)))}function zjt(t){let e=t.trim().match(Jjt);if(!e)throw new Error(`Bad header line: '${t}'`);return{original:{start:Math.max(Number(e[1]),1),length:Number(e[3]||1)},patched:{start:Math.max(Number(e[4]),1),length:Number(e[6]||1)}}}var Zjt=420,Xjt=493;var DOe=()=>({semverExclusivity:null,diffLineFromPath:null,diffLineToPath:null,oldMode:null,newMode:null,deletedFileMode:null,newFileMode:null,renameFrom:null,renameTo:null,beforeHash:null,afterHash:null,fromPath:null,toPath:null,hunks:null}),$jt=t=>({header:zjt(t),parts:[]}),e6t={"@":"header","-":"deletion","+":"insertion"," ":"context","\\":"pragma",undefined:"context"};function t6t(t){let e=[],r=DOe(),s="parsing header",a=null,n=null;function c(){a&&(n&&(a.parts.push(n),n=null),r.hunks.push(a),a=null)}function f(){c(),e.push(r),r=DOe()}for(let p=0;p0?"patch":"mode change",W=null;switch(U){case"rename":{if(!E||!C)throw new Error("Bad parser state: rename from & to not given");e.push({type:"rename",semverExclusivity:s,fromPath:M1(E),toPath:M1(C)}),W=C}break;case"file deletion":{let te=a||I;if(!te)throw new Error("Bad parse state: no path given for file deletion");e.push({type:"file deletion",semverExclusivity:s,hunk:N&&N[0]||null,path:M1(te),mode:UL(p),hash:S})}break;case"file creation":{let te=n||R;if(!te)throw new Error("Bad parse state: no path given for file creation");e.push({type:"file creation",semverExclusivity:s,hunk:N&&N[0]||null,path:M1(te),mode:UL(h),hash:P})}break;case"patch":case"mode change":W=R||n;break;default:je.assertNever(U);break}W&&c&&f&&c!==f&&e.push({type:"mode change",semverExclusivity:s,path:M1(W),oldMode:UL(c),newMode:UL(f)}),W&&N&&N.length&&e.push({type:"patch",semverExclusivity:s,path:M1(W),hunks:N,beforeHash:S,afterHash:P})}if(e.length===0)throw new Error("Unable to parse patch file: No changes found. Make sure the patch is a valid UTF8 encoded string");return e}function UL(t){let e=parseInt(t,8)&511;if(e!==Zjt&&e!==Xjt)throw new Error(`Unexpected file mode string: ${t}`);return e}function pP(t){let e=t.split(/\n/g);return e[e.length-1]===""&&e.pop(),r6t(t6t(e))}function n6t(t){let e=0,r=0;for(let{type:s,lines:a}of t.parts)switch(s){case"context":r+=a.length,e+=a.length;break;case"deletion":e+=a.length;break;case"insertion":r+=a.length;break;default:je.assertNever(s);break}if(e!==t.header.original.length||r!==t.header.patched.length){let s=a=>a<0?a:`+${a}`;throw new Error(`hunk header integrity check failed (expected @@ ${s(t.header.original.length)} ${s(t.header.patched.length)} @@, got @@ ${s(e)} ${s(r)} @@)`)}}Ve();bt();var _1=class extends Error{constructor(r,s){super(`Cannot apply hunk #${r+1}`);this.hunk=s}};async function U1(t,e,r){let s=await t.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await t.lutimesPromise(e,s.atime,s.mtime)}async function HL(t,{baseFs:e=new Yn,dryRun:r=!1,version:s=null}={}){for(let a of t)if(!(a.semverExclusivity!==null&&s!==null&&!Or.satisfiesWithPrereleases(s,a.semverExclusivity)))switch(a.type){case"file deletion":if(r){if(!e.existsSync(a.path))throw new Error(`Trying to delete a file that doesn't exist: ${a.path}`)}else await U1(e,K.dirname(a.path),async()=>{await e.unlinkPromise(a.path)});break;case"rename":if(r){if(!e.existsSync(a.fromPath))throw new Error(`Trying to move a file that doesn't exist: ${a.fromPath}`)}else await U1(e,K.dirname(a.fromPath),async()=>{await U1(e,K.dirname(a.toPath),async()=>{await U1(e,a.fromPath,async()=>(await e.movePromise(a.fromPath,a.toPath),a.toPath))})});break;case"file creation":if(r){if(e.existsSync(a.path))throw new Error(`Trying to create a file that already exists: ${a.path}`)}else{let n=a.hunk?a.hunk.parts[0].lines.join(` +`)+(a.hunk.parts[0].noNewlineAtEndOfFile?"":` +`):"";await e.mkdirpPromise(K.dirname(a.path),{chmod:493,utimes:[ui.SAFE_TIME,ui.SAFE_TIME]}),await e.writeFilePromise(a.path,n,{mode:a.mode}),await e.utimesPromise(a.path,ui.SAFE_TIME,ui.SAFE_TIME)}break;case"patch":await U1(e,a.path,async()=>{await o6t(a,{baseFs:e,dryRun:r})});break;case"mode change":{let c=(await e.statPromise(a.path)).mode;if(bOe(a.newMode)!==bOe(c))continue;await U1(e,a.path,async()=>{await e.chmodPromise(a.path,a.newMode)})}break;default:je.assertNever(a);break}}function bOe(t){return(t&64)>0}function POe(t){return t.replace(/\s+$/,"")}function s6t(t,e){return POe(t)===POe(e)}async function o6t({hunks:t,path:e},{baseFs:r,dryRun:s=!1}){let a=await r.statSync(e).mode,c=(await r.readFileSync(e,"utf8")).split(/\n/),f=[],p=0,h=0;for(let C of t){let S=Math.max(h,C.header.patched.start+p),P=Math.max(0,S-h),I=Math.max(0,c.length-S-C.header.original.length),R=Math.max(P,I),N=0,U=0,W=null;for(;N<=R;){if(N<=P&&(U=S-N,W=xOe(C,c,U),W!==null)){N=-N;break}if(N<=I&&(U=S+N,W=xOe(C,c,U),W!==null))break;N+=1}if(W===null)throw new _1(t.indexOf(C),C);f.push(W),p+=N,h=U+C.header.original.length}if(s)return;let E=0;for(let C of f)for(let S of C)switch(S.type){case"splice":{let P=S.index+E;c.splice(P,S.numToDelete,...S.linesToInsert),E+=S.linesToInsert.length-S.numToDelete}break;case"pop":c.pop();break;case"push":c.push(S.line);break;default:je.assertNever(S);break}await r.writeFilePromise(e,c.join(` +`),{mode:a})}function xOe(t,e,r){let s=[];for(let a of t.parts)switch(a.type){case"context":case"deletion":{for(let n of a.lines){let c=e[r];if(c==null||!s6t(c,n))return null;r+=1}a.type==="deletion"&&(s.push({type:"splice",index:r-a.lines.length,numToDelete:a.lines.length,linesToInsert:[]}),a.noNewlineAtEndOfFile&&s.push({type:"push",line:""}))}break;case"insertion":s.push({type:"splice",index:r,numToDelete:0,linesToInsert:a.lines}),a.noNewlineAtEndOfFile&&s.push({type:"pop"});break;default:je.assertNever(a.type);break}return s}var l6t=/^builtin<([^>]+)>$/;function H1(t,e){let{protocol:r,source:s,selector:a,params:n}=q.parseRange(t);if(r!=="patch:")throw new Error("Invalid patch range");if(s===null)throw new Error("Patch locators must explicitly define their source");let c=a?a.split(/&/).map(E=>ue.toPortablePath(E)):[],f=n&&typeof n.locator=="string"?q.parseLocator(n.locator):null,p=n&&typeof n.version=="string"?n.version:null,h=e(s);return{parentLocator:f,sourceItem:h,patchPaths:c,sourceVersion:p}}function jL(t){return t.range.startsWith("patch:")}function Fg(t){return t.reference.startsWith("patch:")}function hP(t){let{sourceItem:e,...r}=H1(t.range,q.parseDescriptor);return{...r,sourceDescriptor:e}}function gP(t){let{sourceItem:e,...r}=H1(t.reference,q.parseLocator);return{...r,sourceLocator:e}}function c6t(t){let{sourceItem:e}=H1(t.range,q.parseDescriptor);return e}function u6t(t){let{sourceItem:e}=H1(t.reference,q.parseLocator);return e}function Pz(t){if(!jL(t))return t;let{sourceItem:e}=H1(t.range,q.parseDescriptor);return e}function qL(t){if(!Fg(t))return t;let{sourceItem:e}=H1(t.reference,q.parseLocator);return e}function kOe({parentLocator:t,sourceItem:e,patchPaths:r,sourceVersion:s,patchHash:a},n){let c=t!==null?{locator:q.stringifyLocator(t)}:{},f=typeof s<"u"?{version:s}:{},p=typeof a<"u"?{hash:a}:{};return q.makeRange({protocol:"patch:",source:n(e),selector:r.join("&"),params:{...f,...p,...c}})}function WL(t,{parentLocator:e,sourceDescriptor:r,patchPaths:s}){return q.makeDescriptor(t,kOe({parentLocator:e,sourceItem:r,patchPaths:s},q.stringifyDescriptor))}function xz(t,{parentLocator:e,sourcePackage:r,patchPaths:s,patchHash:a}){return q.makeLocator(t,kOe({parentLocator:e,sourceItem:r,sourceVersion:r.version,patchPaths:s,patchHash:a},q.stringifyLocator))}function QOe({onAbsolute:t,onRelative:e,onProject:r,onBuiltin:s},a){let n=a.lastIndexOf("!");n!==-1&&(a=a.slice(n+1));let c=a.match(l6t);return c!==null?s(c[1]):a.startsWith("~/")?r(a.slice(2)):K.isAbsolute(a)?t(a):e(a)}function TOe(t){let e=t.lastIndexOf("!");return{optional:(e!==-1?new Set(t.slice(0,e).split(/!/)):new Set).has("optional")}}function kz(t){return QOe({onAbsolute:()=>!1,onRelative:()=>!0,onProject:()=>!1,onBuiltin:()=>!1},t)}async function dP(t,e,r){let s=t!==null?await r.fetcher.fetch(t,r):null,a=s&&s.localPath?{packageFs:new Sn(vt.root),prefixPath:K.relative(vt.root,s.localPath)}:s;s&&s!==a&&s.releaseFs&&s.releaseFs();let n=await je.releaseAfterUseAsync(async()=>await Promise.all(e.map(async c=>{let f=TOe(c),p=await QOe({onAbsolute:async h=>await le.readFilePromise(h,"utf8"),onRelative:async h=>{if(a===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await a.packageFs.readFilePromise(K.join(a.prefixPath,h),"utf8")},onProject:async h=>await le.readFilePromise(K.join(r.project.cwd,h),"utf8"),onBuiltin:async h=>await r.project.configuration.firstHook(E=>E.getBuiltinPatch,r.project,h)},c);return{...f,source:p}})));for(let c of n)typeof c.source=="string"&&(c.source=c.source.replace(/\r\n?/g,` +`));return n}async function Qz(t,{cache:e,project:r}){let s=r.storedPackages.get(t.locatorHash);if(typeof s>"u")throw new Error("Assertion failed: Expected the package to be registered");let a=qL(t),n=r.storedChecksums,c=new Wi,f=await le.mktempPromise(),p=K.join(f,"source"),h=K.join(f,"user"),E=K.join(f,".yarn-patch.json"),C=r.configuration.makeFetcher(),S=[];try{let P,I;if(t.locatorHash===a.locatorHash){let R=await C.fetch(t,{cache:e,project:r,fetcher:C,checksums:n,report:c});S.push(()=>R.releaseFs?.()),P=R,I=R}else P=await C.fetch(t,{cache:e,project:r,fetcher:C,checksums:n,report:c}),S.push(()=>P.releaseFs?.()),I=await C.fetch(t,{cache:e,project:r,fetcher:C,checksums:n,report:c}),S.push(()=>I.releaseFs?.());await Promise.all([le.copyPromise(p,P.prefixPath,{baseFs:P.packageFs}),le.copyPromise(h,I.prefixPath,{baseFs:I.packageFs}),le.writeJsonPromise(E,{locator:q.stringifyLocator(t),version:s.version})])}finally{for(let P of S)P()}return le.detachTemp(f),h}async function Tz(t,e){let r=ue.fromPortablePath(t).replace(/\\/g,"/"),s=ue.fromPortablePath(e).replace(/\\/g,"/"),{stdout:a,stderr:n}=await Gr.execvp("git",["-c","core.safecrlf=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--no-renames","--text",r,s],{cwd:ue.toPortablePath(process.cwd()),env:{...process.env,GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""}});if(n.length>0)throw new Error(`Unable to diff directories. Make sure you have a recent version of 'git' available in PATH. +The following error was reported by 'git': +${n}`);let c=r.startsWith("/")?f=>f.slice(1):f=>f;return a.replace(new RegExp(`(a|b)(${je.escapeRegExp(`/${c(r)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${je.escapeRegExp(`/${c(s)}/`)}`,"g"),"$1/").replace(new RegExp(je.escapeRegExp(`${r}/`),"g"),"").replace(new RegExp(je.escapeRegExp(`${s}/`),"g"),"")}function Rz(t,e){let r=[];for(let{source:s}of t){if(s===null)continue;let a=pP(s);for(let n of a){let{semverExclusivity:c,...f}=n;c!==null&&e!==null&&!Or.satisfiesWithPrereleases(e,c)||r.push(JSON.stringify(f))}}return Nn.makeHash(`${3}`,...r).slice(0,6)}Ve();function ROe(t,{configuration:e,report:r}){for(let s of t.parts)for(let a of s.lines)switch(s.type){case"context":r.reportInfo(null,` ${he.pretty(e,a,"grey")}`);break;case"deletion":r.reportError(28,`- ${he.pretty(e,a,he.Type.REMOVED)}`);break;case"insertion":r.reportError(28,`+ ${he.pretty(e,a,he.Type.ADDED)}`);break;default:je.assertNever(s.type)}}var mP=class{supports(e,r){return!!Fg(e)}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${q.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:q.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:c}}async patchPackage(e,r){let{parentLocator:s,sourceLocator:a,sourceVersion:n,patchPaths:c}=gP(e),f=await dP(s,c,r),p=await le.mktempPromise(),h=K.join(p,"current.zip"),E=await r.fetcher.fetch(a,r),C=q.getIdentVendorPath(e),S=new ps(h,{create:!0,level:r.project.configuration.get("compressionLevel")});await je.releaseAfterUseAsync(async()=>{await S.copyPromise(C,E.prefixPath,{baseFs:E.packageFs,stableSort:!0})},E.releaseFs),S.saveAndClose();for(let{source:P,optional:I}of f){if(P===null)continue;let R=new ps(h,{level:r.project.configuration.get("compressionLevel")}),N=new Sn(K.resolve(vt.root,C),{baseFs:R});try{await HL(pP(P),{baseFs:N,version:n})}catch(U){if(!(U instanceof _1))throw U;let W=r.project.configuration.get("enableInlineHunks"),te=!W&&!I?" (set enableInlineHunks for details)":"",ie=`${q.prettyLocator(r.project.configuration,e)}: ${U.message}${te}`,Ae=ce=>{W&&ROe(U.hunk,{configuration:r.project.configuration,report:ce})};if(R.discardAndClose(),I){r.report.reportWarningOnce(66,ie,{reportExtra:Ae});continue}else throw new Yt(66,ie,Ae)}R.saveAndClose()}return new ps(h,{level:r.project.configuration.get("compressionLevel")})}};Ve();var yP=class{supportsDescriptor(e,r){return!!jL(e)}supportsLocator(e,r){return!!Fg(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){let{patchPaths:a}=hP(e);return a.every(n=>!kz(n))?e:q.bindDescriptor(e,{locator:q.stringifyLocator(r)})}getResolutionDependencies(e,r){let{sourceDescriptor:s}=hP(e);return{sourceDescriptor:r.project.configuration.normalizeDependency(s)}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:a,patchPaths:n}=hP(e),c=await dP(a,n,s.fetchOptions),f=r.sourceDescriptor;if(typeof f>"u")throw new Error("Assertion failed: The dependency should have been resolved");let p=Rz(c,f.version);return[xz(e,{parentLocator:a,sourcePackage:f,patchPaths:n,patchHash:p})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let{sourceLocator:s}=gP(e);return{...await r.resolver.resolve(s,r),...e}}};Ve();bt();Wt();var j1=class extends ut{constructor(){super(...arguments);this.save=ge.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=ge.String()}static{this.paths=[["patch-commit"]]}static{this.usage=ot.Usage({description:"generate a patch out of a directory",details:"\n By default, this will print a patchfile on stdout based on the diff between the folder passed in and the original version of the package. Such file is suitable for consumption with the `patch:` protocol.\n\n With the `-s,--save` option set, the patchfile won't be printed on stdout anymore and will instead be stored within a local file (by default kept within `.yarn/patches`, but configurable via the `patchFolder` setting). A `resolutions` entry will also be added to your top-level manifest, referencing the patched package via the `patch:` protocol.\n\n Note that only folders generated by `yarn patch` are accepted as valid input for `yarn patch-commit`.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=K.resolve(this.context.cwd,ue.toPortablePath(this.patchFolder)),c=K.join(n,"../source"),f=K.join(n,"../.yarn-patch.json");if(!le.existsSync(c))throw new nt("The argument folder didn't get created by 'yarn patch'");let p=await Tz(c,n),h=await le.readJsonPromise(f),E=q.parseLocator(h.locator,!0);if(!s.storedPackages.has(E.locatorHash))throw new nt("No package found in the project for the given locator");if(!this.save){this.context.stdout.write(p);return}let C=r.get("patchFolder"),S=K.join(C,`${q.slugifyLocator(E)}.patch`);await le.mkdirPromise(C,{recursive:!0}),await le.writeFilePromise(S,p);let P=[],I=new Map;for(let R of s.storedPackages.values()){if(q.isVirtualLocator(R))continue;let N=R.dependencies.get(E.identHash);if(!N)continue;let U=q.ensureDevirtualizedDescriptor(N),W=Pz(U),te=s.storedResolutions.get(W.descriptorHash);if(!te)throw new Error("Assertion failed: Expected the resolution to have been registered");if(!s.storedPackages.get(te))throw new Error("Assertion failed: Expected the package to have been registered");let Ae=s.tryWorkspaceByLocator(R);if(Ae)P.push(Ae);else{let ce=s.originalPackages.get(R.locatorHash);if(!ce)throw new Error("Assertion failed: Expected the original package to have been registered");let me=ce.dependencies.get(N.identHash);if(!me)throw new Error("Assertion failed: Expected the original dependency to have been registered");I.set(me.descriptorHash,me)}}for(let R of P)for(let N of Ht.hardDependencies){let U=R.manifest[N].get(E.identHash);if(!U)continue;let W=WL(U,{parentLocator:null,sourceDescriptor:q.convertLocatorToDescriptor(E),patchPaths:[K.join(Er.home,K.relative(s.cwd,S))]});R.manifest[N].set(U.identHash,W)}for(let R of I.values()){let N=WL(R,{parentLocator:null,sourceDescriptor:q.convertLocatorToDescriptor(E),patchPaths:[K.join(Er.home,K.relative(s.cwd,S))]});s.topLevelWorkspace.manifest.resolutions.push({pattern:{descriptor:{fullName:q.stringifyIdent(N),description:R.range}},reference:N.range})}await s.persist()}};Ve();bt();Wt();var q1=class extends ut{constructor(){super(...arguments);this.update=ge.Boolean("-u,--update",!1,{description:"Reapply local patches that already apply to this packages"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=ge.String()}static{this.paths=[["patch"]]}static{this.usage=ot.Usage({description:"prepare a package for patching",details:"\n This command will cause a package to be extracted in a temporary directory intended to be editable at will.\n\n Once you're done with your changes, run `yarn patch-commit -s path` (with `path` being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the `patch:` protocol. Run `yarn patch-commit -h` for more details.\n\n Calling the command when you already have a patch won't import it by default (in other words, the default behavior is to reset existing patches). However, adding the `-u,--update` flag will import any current patch.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let c=q.parseLocator(this.package);if(c.reference==="unknown"){let f=je.mapAndFilter([...s.storedPackages.values()],p=>p.identHash!==c.identHash?je.mapAndFilter.skip:q.isVirtualLocator(p)?je.mapAndFilter.skip:Fg(p)!==this.update?je.mapAndFilter.skip:p);if(f.length===0)throw new nt("No package found in the project for the given locator");if(f.length>1)throw new nt(`Multiple candidate packages found; explicitly choose one of them (use \`yarn why \` to get more information as to who depends on them): +${f.map(p=>` +- ${q.prettyLocator(r,p)}`).join("")}`);c=f[0]}if(!s.storedPackages.has(c.locatorHash))throw new nt("No package found in the project for the given locator");await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async f=>{let p=qL(c),h=await Qz(c,{cache:n,project:s});f.reportJson({locator:q.stringifyLocator(p),path:ue.fromPortablePath(h)});let E=this.update?" along with its current modifications":"";f.reportInfo(0,`Package ${q.prettyLocator(r,p)} got extracted with success${E}!`),f.reportInfo(0,`You can now edit the following folder: ${he.pretty(r,ue.fromPortablePath(h),"magenta")}`),f.reportInfo(0,`Once you are done run ${he.pretty(r,`yarn patch-commit -s ${process.platform==="win32"?'"':""}${ue.fromPortablePath(h)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};var f6t={configuration:{enableInlineHunks:{description:"If true, the installs will print unmatched patch hunks",type:"BOOLEAN",default:!1},patchFolder:{description:"Folder where the patch files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/patches"}},commands:[j1,q1],fetchers:[mP],resolvers:[yP]},A6t=f6t;var Lz={};Vt(Lz,{PnpmLinker:()=>EP,default:()=>y6t});Ve();bt();Wt();var EP=class{getCustomDataKey(){return JSON.stringify({name:"PnpmLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the pnpm linker to be enabled");let s=this.getCustomDataKey(),a=r.project.linkersCustomData.get(s);if(!a)throw new nt(`The project in ${he.pretty(r.project.configuration,`${r.project.cwd}/package.json`,he.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=a.pathsByLocator.get(e.locatorHash);if(typeof n>"u")throw new nt(`Couldn't find ${q.prettyLocator(r.project.configuration,e)} in the currently installed pnpm map - running an install might help`);return n.packageLocation}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let s=this.getCustomDataKey(),a=r.project.linkersCustomData.get(s);if(!a)throw new nt(`The project in ${he.pretty(r.project.configuration,`${r.project.cwd}/package.json`,he.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=e.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);if(n){let p=a.locatorByPath.get(n[1]);if(p)return p}let c=e,f=e;do{f=c,c=K.dirname(f);let p=a.locatorByPath.get(f);if(p)return p}while(c!==f);return null}makeInstaller(e){return new Nz(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="pnpm"}},Nz=class{constructor(e){this.opts=e;this.asyncActions=new je.AsyncActions(10);this.customData={pathsByLocator:new Map,locatorByPath:new Map};this.indexFolderPromise=px(le,{indexPath:K.join(e.project.configuration.get("globalFolder"),"index")})}attachCustomData(e){}async installPackage(e,r,s){switch(e.linkType){case"SOFT":return this.installPackageSoft(e,r,s);case"HARD":return this.installPackageHard(e,r,s)}throw new Error("Assertion failed: Unsupported package link type")}async installPackageSoft(e,r,s){let a=K.resolve(r.packageFs.getRealPath(),r.prefixPath),n=this.opts.project.tryWorkspaceByLocator(e)?K.join(a,Er.nodeModules):null;return this.customData.pathsByLocator.set(e.locatorHash,{packageLocation:a,dependenciesLocation:n}),{packageLocation:a,buildRequest:null}}async installPackageHard(e,r,s){let a=h6t(e,{project:this.opts.project}),n=a.packageLocation;this.customData.locatorByPath.set(n,q.stringifyLocator(e)),this.customData.pathsByLocator.set(e.locatorHash,a),s.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{await le.mkdirPromise(n,{recursive:!0}),await le.copyPromise(n,r.prefixPath,{baseFs:r.packageFs,overwrite:!1,linkStrategy:{type:"HardlinkFromIndex",indexPath:await this.indexFolderPromise,autoRepair:!0}})}));let f=q.isVirtualLocator(e)?q.devirtualizeLocator(e):e,p={manifest:await Ht.tryFind(r.prefixPath,{baseFs:r.packageFs})??new Ht,misc:{hasBindingGyp:mA.hasBindingGyp(r)}},h=this.opts.project.getDependencyMeta(f,e.version),E=mA.extractBuildRequest(e,p,h,{configuration:this.opts.project.configuration});return{packageLocation:n,buildRequest:E}}async attachInternalDependencies(e,r){if(this.opts.project.configuration.get("nodeLinker")!=="pnpm"||!FOe(e,{project:this.opts.project}))return;let s=this.customData.pathsByLocator.get(e.locatorHash);if(typeof s>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${q.stringifyLocator(e)})`);let{dependenciesLocation:a}=s;a&&this.asyncActions.reduce(e.locatorHash,async n=>{await le.mkdirPromise(a,{recursive:!0});let c=await g6t(a),f=new Map(c),p=[n],h=(C,S)=>{let P=S;FOe(S,{project:this.opts.project})||(this.opts.report.reportWarningOnce(0,"The pnpm linker doesn't support providing different versions to workspaces' peer dependencies"),P=q.devirtualizeLocator(S));let I=this.customData.pathsByLocator.get(P.locatorHash);if(typeof I>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${q.stringifyLocator(S)})`);let R=q.stringifyIdent(C),N=K.join(a,R),U=K.relative(K.dirname(N),I.packageLocation),W=f.get(R);f.delete(R),p.push(Promise.resolve().then(async()=>{if(W){if(W.isSymbolicLink()&&await le.readlinkPromise(N)===U)return;await le.removePromise(N)}await le.mkdirpPromise(K.dirname(N)),process.platform=="win32"&&this.opts.project.configuration.get("winLinkType")==="junctions"?await le.symlinkPromise(I.packageLocation,N,"junction"):await le.symlinkPromise(U,N)}))},E=!1;for(let[C,S]of r)C.identHash===e.identHash&&(E=!0),h(C,S);!E&&!this.opts.project.tryWorkspaceByLocator(e)&&h(q.convertLocatorToDescriptor(e),e),p.push(d6t(a,f)),await Promise.all(p)})}async attachExternalDependents(e,r){throw new Error("External dependencies haven't been implemented for the pnpm linker")}async finalizeInstall(){let e=NOe(this.opts.project);if(this.opts.project.configuration.get("nodeLinker")!=="pnpm")await le.removePromise(e);else{let r;try{r=new Set(await le.readdirPromise(e))}catch{r=new Set}for(let{dependenciesLocation:s}of this.customData.pathsByLocator.values()){if(!s)continue;let a=K.contains(e,s);if(a===null)continue;let[n]=a.split(K.sep);r.delete(n)}await Promise.all([...r].map(async s=>{await le.removePromise(K.join(e,s))}))}return await this.asyncActions.wait(),await Oz(e),this.opts.project.configuration.get("nodeLinker")!=="node-modules"&&await Oz(p6t(this.opts.project)),{customData:this.customData}}};function p6t(t){return K.join(t.cwd,Er.nodeModules)}function NOe(t){return t.configuration.get("pnpmStoreFolder")}function h6t(t,{project:e}){let r=q.slugifyLocator(t),s=NOe(e),a=K.join(s,r,"package"),n=K.join(s,r,Er.nodeModules);return{packageLocation:a,dependenciesLocation:n}}function FOe(t,{project:e}){return!q.isVirtualLocator(t)||!e.tryWorkspaceByLocator(t)}async function g6t(t){let e=new Map,r=[];try{r=await le.readdirPromise(t,{withFileTypes:!0})}catch(s){if(s.code!=="ENOENT")throw s}try{for(let s of r)if(!s.name.startsWith("."))if(s.name.startsWith("@")){let a=await le.readdirPromise(K.join(t,s.name),{withFileTypes:!0});if(a.length===0)e.set(s.name,s);else for(let n of a)e.set(`${s.name}/${n.name}`,n)}else e.set(s.name,s)}catch(s){if(s.code!=="ENOENT")throw s}return e}async function d6t(t,e){let r=[],s=new Set;for(let a of e.keys()){r.push(le.removePromise(K.join(t,a)));let n=q.tryParseIdent(a)?.scope;n&&s.add(`@${n}`)}return Promise.all(r).then(()=>Promise.all([...s].map(a=>Oz(K.join(t,a)))))}async function Oz(t){try{await le.rmdirPromise(t)}catch(e){if(e.code!=="ENOENT"&&e.code!=="ENOTEMPTY")throw e}}var m6t={configuration:{pnpmStoreFolder:{description:"By default, the store is stored in the 'node_modules/.store' of the project. Sometimes in CI scenario's it is convenient to store this in a different location so it can be cached and reused.",type:"ABSOLUTE_PATH",default:"./node_modules/.store"}},linkers:[EP]},y6t=m6t;var Gz={};Vt(Gz,{StageCommand:()=>G1,default:()=>x6t,stageUtils:()=>VL});Ve();bt();Wt();Ve();bt();var VL={};Vt(VL,{ActionType:()=>Mz,checkConsensus:()=>YL,expandDirectory:()=>Hz,findConsensus:()=>jz,findVcsRoot:()=>_z,genCommitMessage:()=>qz,getCommitPrefix:()=>OOe,isYarnFile:()=>Uz});bt();var Mz=(n=>(n[n.CREATE=0]="CREATE",n[n.DELETE=1]="DELETE",n[n.ADD=2]="ADD",n[n.REMOVE=3]="REMOVE",n[n.MODIFY=4]="MODIFY",n))(Mz||{});async function _z(t,{marker:e}){do if(!le.existsSync(K.join(t,e)))t=K.dirname(t);else return t;while(t!=="/");return null}function Uz(t,{roots:e,names:r}){if(r.has(K.basename(t)))return!0;do if(!e.has(t))t=K.dirname(t);else return!0;while(t!=="/");return!1}function Hz(t){let e=[],r=[t];for(;r.length>0;){let s=r.pop(),a=le.readdirSync(s);for(let n of a){let c=K.resolve(s,n);le.lstatSync(c).isDirectory()?r.push(c):e.push(c)}}return e}function YL(t,e){let r=0,s=0;for(let a of t)a!=="wip"&&(e.test(a)?r+=1:s+=1);return r>=s}function jz(t){let e=YL(t,/^(\w\(\w+\):\s*)?\w+s/),r=YL(t,/^(\w\(\w+\):\s*)?[A-Z]/),s=YL(t,/^\w\(\w+\):/);return{useThirdPerson:e,useUpperCase:r,useComponent:s}}function OOe(t){return t.useComponent?"chore(yarn): ":""}var E6t=new Map([[0,"create"],[1,"delete"],[2,"add"],[3,"remove"],[4,"update"]]);function qz(t,e){let r=OOe(t),s=[],a=e.slice().sort((n,c)=>n[0]-c[0]);for(;a.length>0;){let[n,c]=a.shift(),f=E6t.get(n);t.useUpperCase&&s.length===0&&(f=`${f[0].toUpperCase()}${f.slice(1)}`),t.useThirdPerson&&(f+="s");let p=[c];for(;a.length>0&&a[0][0]===n;){let[,E]=a.shift();p.push(E)}p.sort();let h=p.shift();p.length===1?h+=" (and one other)":p.length>1&&(h+=` (and ${p.length} others)`),s.push(`${f} ${h}`)}return`${r}${s.join(", ")}`}var I6t="Commit generated via `yarn stage`",C6t=11;async function LOe(t){let{code:e,stdout:r}=await Gr.execvp("git",["log","-1","--pretty=format:%H"],{cwd:t});return e===0?r.trim():null}async function w6t(t,e){let r=[],s=e.filter(h=>K.basename(h.path)==="package.json");for(let{action:h,path:E}of s){let C=K.relative(t,E);if(h===4){let S=await LOe(t),{stdout:P}=await Gr.execvp("git",["show",`${S}:${C}`],{cwd:t,strict:!0}),I=await Ht.fromText(P),R=await Ht.fromFile(E),N=new Map([...R.dependencies,...R.devDependencies]),U=new Map([...I.dependencies,...I.devDependencies]);for(let[W,te]of U){let ie=q.stringifyIdent(te),Ae=N.get(W);Ae?Ae.range!==te.range&&r.push([4,`${ie} to ${Ae.range}`]):r.push([3,ie])}for(let[W,te]of N)U.has(W)||r.push([2,q.stringifyIdent(te)])}else if(h===0){let S=await Ht.fromFile(E);S.name?r.push([0,q.stringifyIdent(S.name)]):r.push([0,"a package"])}else if(h===1){let S=await LOe(t),{stdout:P}=await Gr.execvp("git",["show",`${S}:${C}`],{cwd:t,strict:!0}),I=await Ht.fromText(P);I.name?r.push([1,q.stringifyIdent(I.name)]):r.push([1,"a package"])}else throw new Error("Assertion failed: Unsupported action type")}let{code:a,stdout:n}=await Gr.execvp("git",["log",`-${C6t}`,"--pretty=format:%s"],{cwd:t}),c=a===0?n.split(/\n/g).filter(h=>h!==""):[],f=jz(c);return qz(f,r)}var B6t={0:[" A ","?? "],4:[" M "],1:[" D "]},v6t={0:["A "],4:["M "],1:["D "]},MOe={async findRoot(t){return await _z(t,{marker:".git"})},async filterChanges(t,e,r,s){let{stdout:a}=await Gr.execvp("git",["status","-s"],{cwd:t,strict:!0}),n=a.toString().split(/\n/g),c=s?.staged?v6t:B6t;return[].concat(...n.map(p=>{if(p==="")return[];let h=p.slice(0,3),E=K.resolve(t,p.slice(3));if(!s?.staged&&h==="?? "&&p.endsWith("/"))return Hz(E).map(C=>({action:0,path:C}));{let S=[0,4,1].find(P=>c[P].includes(h));return S!==void 0?[{action:S,path:E}]:[]}})).filter(p=>Uz(p.path,{roots:e,names:r}))},async genCommitMessage(t,e){return await w6t(t,e)},async makeStage(t,e){let r=e.map(s=>ue.fromPortablePath(s.path));await Gr.execvp("git",["add","--",...r],{cwd:t,strict:!0})},async makeCommit(t,e,r){let s=e.map(a=>ue.fromPortablePath(a.path));await Gr.execvp("git",["add","-N","--",...s],{cwd:t,strict:!0}),await Gr.execvp("git",["commit","-m",`${r} + +${I6t} +`,"--",...s],{cwd:t,strict:!0})},async makeReset(t,e){let r=e.map(s=>ue.fromPortablePath(s.path));await Gr.execvp("git",["reset","HEAD","--",...r],{cwd:t,strict:!0})}};var S6t=[MOe],G1=class extends ut{constructor(){super(...arguments);this.commit=ge.Boolean("-c,--commit",!1,{description:"Commit the staged files"});this.reset=ge.Boolean("-r,--reset",!1,{description:"Remove all files from the staging area"});this.dryRun=ge.Boolean("-n,--dry-run",!1,{description:"Print the commit message and the list of modified files without staging / committing"});this.update=ge.Boolean("-u,--update",!1,{hidden:!0})}static{this.paths=[["stage"]]}static{this.usage=ot.Usage({description:"add all yarn files to your vcs",details:"\n This command will add to your staging area the files belonging to Yarn (typically any modified `package.json` and `.yarnrc.yml` files, but also linker-generated files, cache data, etc). It will take your ignore list into account, so the cache files won't be added if the cache is ignored in a `.gitignore` file (assuming you use Git).\n\n Running `--reset` will instead remove them from the staging area (the changes will still be there, but won't be committed until you stage them back).\n\n Since the staging area is a non-existent concept in Mercurial, Yarn will always create a new commit when running this command on Mercurial repositories. You can get this behavior when using Git by using the `--commit` flag which will directly create a commit.\n ",examples:[["Adds all modified project files to the staging area","yarn stage"],["Creates a new commit containing all modified project files","yarn stage --commit"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd),{driver:a,root:n}=await D6t(s.cwd),c=[r.get("cacheFolder"),r.get("globalFolder"),r.get("virtualFolder"),r.get("yarnPath")];await r.triggerHook(C=>C.populateYarnPaths,s,C=>{c.push(C)});let f=new Set;for(let C of c)for(let S of b6t(n,C))f.add(S);let p=new Set([r.get("rcFilename"),Er.lockfile,Er.manifest]),h=await a.filterChanges(n,f,p),E=await a.genCommitMessage(n,h);if(this.dryRun)if(this.commit)this.context.stdout.write(`${E} +`);else for(let C of h)this.context.stdout.write(`${ue.fromPortablePath(C.path)} +`);else if(this.reset){let C=await a.filterChanges(n,f,p,{staged:!0});C.length===0?this.context.stdout.write("No staged changes found!"):await a.makeReset(n,C)}else h.length===0?this.context.stdout.write("No changes found!"):this.commit?await a.makeCommit(n,h,E):(await a.makeStage(n,h),this.context.stdout.write(E))}};async function D6t(t){let e=null,r=null;for(let s of S6t)if((r=await s.findRoot(t))!==null){e=s;break}if(e===null||r===null)throw new nt("No stage driver has been found for your current project");return{driver:e,root:r}}function b6t(t,e){let r=[];if(e===null)return r;for(;;){(e===t||e.startsWith(`${t}/`))&&r.push(e);let s;try{s=le.statSync(e)}catch{break}if(s.isSymbolicLink())e=K.resolve(K.dirname(e),le.readlinkSync(e));else break}return r}var P6t={commands:[G1]},x6t=P6t;var Wz={};Vt(Wz,{default:()=>L6t});Ve();Ve();bt();var HOe=et(fi());Ve();var _Oe=et(Z9()),k6t="e8e1bd300d860104bb8c58453ffa1eb4",Q6t="OFCNCOG2CU",UOe=async(t,e)=>{let r=q.stringifyIdent(t),a=T6t(e).initIndex("npm-search");try{return(await a.getObject(r,{attributesToRetrieve:["types"]})).types?.ts==="definitely-typed"}catch{return!1}},T6t=t=>(0,_Oe.default)(Q6t,k6t,{requester:{async send(r){try{let s=await An.request(r.url,r.data||null,{configuration:t,headers:r.headers});return{content:s.body,isTimedOut:!1,status:s.statusCode}}catch(s){return{content:s.response.body,isTimedOut:!1,status:s.response.statusCode}}}}});var jOe=t=>t.scope?`${t.scope}__${t.name}`:`${t.name}`,R6t=async(t,e,r,s)=>{if(r.scope==="types")return;let{project:a}=t,{configuration:n}=a;if(!(n.get("tsEnableAutoTypes")??(le.existsSync(K.join(t.cwd,"tsconfig.json"))||le.existsSync(K.join(a.cwd,"tsconfig.json")))))return;let f=n.makeResolver(),p={project:a,resolver:f,report:new Wi};if(!await UOe(r,n))return;let E=jOe(r),C=q.parseRange(r.range).selector;if(!Or.validRange(C)){let N=n.normalizeDependency(r),U=await f.getCandidates(N,{},p);C=q.parseRange(U[0].reference).selector}let S=HOe.default.coerce(C);if(S===null)return;let P=`${Xu.Modifier.CARET}${S.major}`,I=q.makeDescriptor(q.makeIdent("types",E),P),R=je.mapAndFind(a.workspaces,N=>{let U=N.manifest.dependencies.get(r.identHash)?.descriptorHash,W=N.manifest.devDependencies.get(r.identHash)?.descriptorHash;if(U!==r.descriptorHash&&W!==r.descriptorHash)return je.mapAndFind.skip;let te=[];for(let ie of Ht.allDependencies){let Ae=N.manifest[ie].get(I.identHash);typeof Ae>"u"||te.push([ie,Ae])}return te.length===0?je.mapAndFind.skip:te});if(typeof R<"u")for(let[N,U]of R)t.manifest[N].set(U.identHash,U);else{try{let N=n.normalizeDependency(I);if((await f.getCandidates(N,{},p)).length===0)return}catch{return}t.manifest[Xu.Target.DEVELOPMENT].set(I.identHash,I)}},F6t=async(t,e,r)=>{if(r.scope==="types")return;let{project:s}=t,{configuration:a}=s;if(!(a.get("tsEnableAutoTypes")??(le.existsSync(K.join(t.cwd,"tsconfig.json"))||le.existsSync(K.join(s.cwd,"tsconfig.json")))))return;let c=jOe(r),f=q.makeIdent("types",c);for(let p of Ht.allDependencies)typeof t.manifest[p].get(f.identHash)>"u"||t.manifest[p].delete(f.identHash)},N6t=(t,e)=>{e.publishConfig&&e.publishConfig.typings&&(e.typings=e.publishConfig.typings),e.publishConfig&&e.publishConfig.types&&(e.types=e.publishConfig.types)},O6t={configuration:{tsEnableAutoTypes:{description:"Whether Yarn should auto-install @types/ dependencies on 'yarn add'",type:"BOOLEAN",isNullable:!0,default:null}},hooks:{afterWorkspaceDependencyAddition:R6t,afterWorkspaceDependencyRemoval:F6t,beforeWorkspacePacking:N6t}},L6t=O6t;var zz={};Vt(zz,{VersionApplyCommand:()=>J1,VersionCheckCommand:()=>z1,VersionCommand:()=>Z1,default:()=>rqt,versionUtils:()=>K1});Ve();Ve();Wt();var K1={};Vt(K1,{Decision:()=>Y1,applyPrerelease:()=>KOe,applyReleases:()=>Jz,applyStrategy:()=>JL,clearVersionFiles:()=>Yz,getUndecidedDependentWorkspaces:()=>CP,getUndecidedWorkspaces:()=>KL,openVersionFile:()=>V1,requireMoreDecisions:()=>$6t,resolveVersionFiles:()=>IP,suggestStrategy:()=>Kz,updateVersionFiles:()=>Vz,validateReleaseDecision:()=>W1});Ve();bt();Bc();Wt();var VOe=et(YOe()),TA=et(fi()),X6t=/^(>=|[~^]|)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,Y1=(c=>(c.UNDECIDED="undecided",c.DECLINE="decline",c.MAJOR="major",c.MINOR="minor",c.PATCH="patch",c.PRERELEASE="prerelease",c))(Y1||{});function W1(t){let e=TA.default.valid(t);return e||je.validateEnum((0,VOe.default)(Y1,"UNDECIDED"),t)}async function IP(t,{prerelease:e=null}={}){let r=new Map,s=t.configuration.get("deferredVersionFolder");if(!le.existsSync(s))return r;let a=await le.readdirPromise(s);for(let n of a){if(!n.endsWith(".yml"))continue;let c=K.join(s,n),f=await le.readFilePromise(c,"utf8"),p=ls(f);for(let[h,E]of Object.entries(p.releases||{})){if(E==="decline")continue;let C=q.parseIdent(h),S=t.tryWorkspaceByIdent(C);if(S===null)throw new Error(`Assertion failed: Expected a release definition file to only reference existing workspaces (${K.basename(c)} references ${h})`);if(S.manifest.version===null)throw new Error(`Assertion failed: Expected the workspace to have a version (${q.prettyLocator(t.configuration,S.anchoredLocator)})`);let P=S.manifest.raw.stableVersion??S.manifest.version,I=r.get(S),R=JL(P,W1(E));if(R===null)throw new Error(`Assertion failed: Expected ${P} to support being bumped via strategy ${E}`);let N=typeof I<"u"?TA.default.gt(R,I)?R:I:R;r.set(S,N)}}return e&&(r=new Map([...r].map(([n,c])=>[n,KOe(c,{current:n.manifest.version,prerelease:e})]))),r}async function Yz(t){let e=t.configuration.get("deferredVersionFolder");le.existsSync(e)&&await le.removePromise(e)}async function Vz(t,e){let r=new Set(e),s=t.configuration.get("deferredVersionFolder");if(!le.existsSync(s))return;let a=await le.readdirPromise(s);for(let n of a){if(!n.endsWith(".yml"))continue;let c=K.join(s,n),f=await le.readFilePromise(c,"utf8"),p=ls(f),h=p?.releases;if(h){for(let E of Object.keys(h)){let C=q.parseIdent(E),S=t.tryWorkspaceByIdent(C);(S===null||r.has(S))&&delete p.releases[E]}Object.keys(p.releases).length>0?await le.changeFilePromise(c,il(new il.PreserveOrdering(p))):await le.unlinkPromise(c)}}}async function V1(t,{allowEmpty:e=!1}={}){let r=t.configuration;if(r.projectCwd===null)throw new nt("This command can only be run from within a Yarn project");let s=await Qa.fetchRoot(r.projectCwd),a=s!==null?await Qa.fetchBase(s,{baseRefs:r.get("changesetBaseRefs")}):null,n=s!==null?await Qa.fetchChangedFiles(s,{base:a.hash,project:t}):[],c=r.get("deferredVersionFolder"),f=n.filter(P=>K.contains(c,P)!==null);if(f.length>1)throw new nt(`Your current branch contains multiple versioning files; this isn't supported: +- ${f.map(P=>ue.fromPortablePath(P)).join(` +- `)}`);let p=new Set(je.mapAndFilter(n,P=>{let I=t.tryWorkspaceByFilePath(P);return I===null?je.mapAndFilter.skip:I}));if(f.length===0&&p.size===0&&!e)return null;let h=f.length===1?f[0]:K.join(c,`${Nn.makeHash(Math.random().toString()).slice(0,8)}.yml`),E=le.existsSync(h)?await le.readFilePromise(h,"utf8"):"{}",C=ls(E),S=new Map;for(let P of C.declined||[]){let I=q.parseIdent(P),R=t.getWorkspaceByIdent(I);S.set(R,"decline")}for(let[P,I]of Object.entries(C.releases||{})){let R=q.parseIdent(P),N=t.getWorkspaceByIdent(R);S.set(N,W1(I))}return{project:t,root:s,baseHash:a!==null?a.hash:null,baseTitle:a!==null?a.title:null,changedFiles:new Set(n),changedWorkspaces:p,releaseRoots:new Set([...p].filter(P=>P.manifest.version!==null)),releases:S,async saveAll(){let P={},I=[],R=[];for(let N of t.workspaces){if(N.manifest.version===null)continue;let U=q.stringifyIdent(N.anchoredLocator),W=S.get(N);W==="decline"?I.push(U):typeof W<"u"?P[U]=W1(W):p.has(N)&&R.push(U)}await le.mkdirPromise(K.dirname(h),{recursive:!0}),await le.changeFilePromise(h,il(new il.PreserveOrdering({releases:Object.keys(P).length>0?P:void 0,declined:I.length>0?I:void 0,undecided:R.length>0?R:void 0})))}}}function $6t(t){return KL(t).size>0||CP(t).length>0}function KL(t){let e=new Set;for(let r of t.changedWorkspaces)r.manifest.version!==null&&(t.releases.has(r)||e.add(r));return e}function CP(t,{include:e=new Set}={}){let r=[],s=new Map(je.mapAndFilter([...t.releases],([n,c])=>c==="decline"?je.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n])),a=new Map(je.mapAndFilter([...t.releases],([n,c])=>c!=="decline"?je.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n]));for(let n of t.project.workspaces)if(!(!e.has(n)&&(a.has(n.anchoredLocator.locatorHash)||s.has(n.anchoredLocator.locatorHash)))&&n.manifest.version!==null)for(let c of Ht.hardDependencies)for(let f of n.manifest.getForScope(c).values()){let p=t.project.tryWorkspaceByDescriptor(f);p!==null&&s.has(p.anchoredLocator.locatorHash)&&r.push([n,p])}return r}function Kz(t,e){let r=TA.default.clean(e);for(let s of Object.values(Y1))if(s!=="undecided"&&s!=="decline"&&TA.default.inc(t,s)===r)return s;return null}function JL(t,e){if(TA.default.valid(e))return e;if(t===null)throw new nt(`Cannot apply the release strategy "${e}" unless the workspace already has a valid version`);if(!TA.default.valid(t))throw new nt(`Cannot apply the release strategy "${e}" on a non-semver version (${t})`);let r=TA.default.inc(t,e);if(r===null)throw new nt(`Cannot apply the release strategy "${e}" on the specified version (${t})`);return r}function Jz(t,e,{report:r,exact:s}){let a=new Map;for(let n of t.workspaces)for(let c of Ht.allDependencies)for(let f of n.manifest[c].values()){let p=t.tryWorkspaceByDescriptor(f);if(p===null||!e.has(p))continue;je.getArrayWithDefault(a,p).push([n,c,f.identHash])}for(let[n,c]of e){let f=n.manifest.version;n.manifest.version=c,TA.default.prerelease(c)===null?delete n.manifest.raw.stableVersion:n.manifest.raw.stableVersion||(n.manifest.raw.stableVersion=f);let p=n.manifest.name!==null?q.stringifyIdent(n.manifest.name):null;r.reportInfo(0,`${q.prettyLocator(t.configuration,n.anchoredLocator)}: Bumped to ${c}`),r.reportJson({cwd:ue.fromPortablePath(n.cwd),ident:p,oldVersion:f,newVersion:c});let h=a.get(n);if(!(typeof h>"u"))for(let[E,C,S]of h){let P=E.manifest[C].get(S);if(typeof P>"u")throw new Error("Assertion failed: The dependency should have existed");let I=P.range,R=!1;if(I.startsWith(yi.protocol)&&(I=I.slice(yi.protocol.length),R=!0,I===n.relativeCwd))continue;let N=I.match(X6t);if(!N){r.reportWarning(0,`Couldn't auto-upgrade range ${I} (in ${q.prettyLocator(t.configuration,E.anchoredLocator)})`);continue}let U=s?`${c}`:`${N[1]}${c}`;R&&(U=`${yi.protocol}${U}`);let W=q.makeDescriptor(P,U);E.manifest[C].set(S,W)}}}var eqt=new Map([["%n",{extract:t=>t.length>=1?[t[0],t.slice(1)]:null,generate:(t=0)=>`${t+1}`}]]);function KOe(t,{current:e,prerelease:r}){let s=new TA.default.SemVer(e),a=s.prerelease.slice(),n=[];s.prerelease=[],s.format()!==t&&(a.length=0);let c=!0,f=r.split(/\./g);for(let p of f){let h=eqt.get(p);if(typeof h>"u")n.push(p),a[0]===p?a.shift():c=!1;else{let E=c?h.extract(a):null;E!==null&&typeof E[0]=="number"?(n.push(h.generate(E[0])),a=E[1]):(n.push(h.generate()),c=!1)}}return s.prerelease&&(s.prerelease=[]),`${t}-${n.join(".")}`}var J1=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("--all",!1,{description:"Apply the deferred version changes on all workspaces"});this.dryRun=ge.Boolean("--dry-run",!1,{description:"Print the versions without actually generating the package archive"});this.prerelease=ge.String("--prerelease",{description:"Add a prerelease identifier to new versions",tolerateBoolean:!0});this.exact=ge.Boolean("--exact",!1,{description:"Use the exact version of each package, removes any range. Useful for nightly releases where the range might match another version."});this.recursive=ge.Boolean("-R,--recursive",{description:"Release the transitive workspaces as well"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["version","apply"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"apply all the deferred version bumps at once",details:` + This command will apply the deferred version changes and remove their definitions from the repository. + + Note that if \`--prerelease\` is set, the given prerelease identifier (by default \`rc.%n\`) will be used on all new versions and the version definitions will be kept as-is. + + By default only the current workspace will be bumped, but you can configure this behavior by using one of: + + - \`--recursive\` to also apply the version bump on its dependencies + - \`--all\` to apply the version bump on all packages in the repository + + Note that this command will also update the \`workspace:\` references across all your local workspaces, thus ensuring that they keep referring to the same workspaces even after the version bump. + `,examples:[["Apply the version change to the local workspace","yarn version apply"],["Apply the version change to all the workspaces in the local workspace","yarn version apply --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async f=>{let p=this.prerelease?typeof this.prerelease!="boolean"?this.prerelease:"rc.%n":null,h=await IP(s,{prerelease:p}),E=new Map;if(this.all)E=h;else{let C=this.recursive?a.getRecursiveWorkspaceDependencies():[a];for(let S of C){let P=h.get(S);typeof P<"u"&&E.set(S,P)}}if(E.size===0){let C=h.size>0?" Did you want to add --all?":"";f.reportWarning(0,`The current workspace doesn't seem to require a version bump.${C}`);return}Jz(s,E,{report:f,exact:this.exact}),this.dryRun||(p||(this.all?await Yz(s):await Vz(s,[...E.keys()])),f.reportSeparator())});return this.dryRun||c.hasErrors()?c.exitCode():await s.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};Ve();bt();Wt();var zL=et(fi());var z1=class extends ut{constructor(){super(...arguments);this.interactive=ge.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}static{this.paths=[["version","check"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"check that all the relevant packages have been bumped",details:"\n **Warning:** This command currently requires Git.\n\n This command will check that all the packages covered by the files listed in argument have been properly bumped or declined to bump.\n\n In the case of a bump, the check will also cover transitive packages - meaning that should `Foo` be bumped, a package `Bar` depending on `Foo` will require a decision as to whether `Bar` will need to be bumped. This check doesn't cross packages that have declined to bump.\n\n In case no arguments are passed to the function, the list of modified files will be generated by comparing the HEAD against `master`.\n ",examples:[["Check whether the modified packages need a bump","yarn version check"]]})}async execute(){return this.interactive?await this.executeInteractive():await this.executeStandard()}async executeInteractive(){ow(this.context);let{Gem:r}=await Promise.resolve().then(()=>($F(),CY)),{ScrollableItems:s}=await Promise.resolve().then(()=>(nN(),rN)),{FocusRequest:a}=await Promise.resolve().then(()=>(BY(),XPe)),{useListInput:n}=await Promise.resolve().then(()=>(tN(),$Pe)),{renderForm:c}=await Promise.resolve().then(()=>(aN(),oN)),{Box:f,Text:p}=await Promise.resolve().then(()=>et(Vc())),{default:h,useCallback:E,useState:C}=await Promise.resolve().then(()=>et(hn())),S=await ze.find(this.context.cwd,this.context.plugins),{project:P,workspace:I}=await Tt.find(S,this.context.cwd);if(!I)throw new ar(P.cwd,this.context.cwd);await P.restoreInstallState();let R=await V1(P);if(R===null||R.releaseRoots.size===0)return 0;if(R.root===null)throw new nt("This command can only be run on Git repositories");let N=()=>h.createElement(f,{flexDirection:"row",paddingBottom:1},h.createElement(f,{flexDirection:"column",width:60},h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select workspaces.")),h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select release strategies."))),h.createElement(f,{flexDirection:"column"},h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to save.")),h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to abort.")))),U=({workspace:me,active:pe,decision:Be,setDecision:Ce})=>{let g=me.manifest.raw.stableVersion??me.manifest.version;if(g===null)throw new Error(`Assertion failed: The version should have been set (${q.prettyLocator(S,me.anchoredLocator)})`);if(zL.default.prerelease(g)!==null)throw new Error(`Assertion failed: Prerelease identifiers shouldn't be found (${g})`);let we=["undecided","decline","patch","minor","major"];n(Be,we,{active:pe,minus:"left",plus:"right",set:Ce});let Ee=Be==="undecided"?h.createElement(p,{color:"yellow"},g):Be==="decline"?h.createElement(p,{color:"green"},g):h.createElement(p,null,h.createElement(p,{color:"magenta"},g)," \u2192 ",h.createElement(p,{color:"green"},zL.default.valid(Be)?Be:zL.default.inc(g,Be)));return h.createElement(f,{flexDirection:"column"},h.createElement(f,null,h.createElement(p,null,q.prettyLocator(S,me.anchoredLocator)," - ",Ee)),h.createElement(f,null,we.map(fe=>h.createElement(f,{key:fe,paddingLeft:2},h.createElement(p,null,h.createElement(r,{active:fe===Be})," ",fe)))))},W=me=>{let pe=new Set(R.releaseRoots),Be=new Map([...me].filter(([Ce])=>pe.has(Ce)));for(;;){let Ce=CP({project:R.project,releases:Be}),g=!1;if(Ce.length>0){for(let[we]of Ce)if(!pe.has(we)){pe.add(we),g=!0;let Ee=me.get(we);typeof Ee<"u"&&Be.set(we,Ee)}}if(!g)break}return{relevantWorkspaces:pe,relevantReleases:Be}},te=()=>{let[me,pe]=C(()=>new Map(R.releases)),Be=E((Ce,g)=>{let we=new Map(me);g!=="undecided"?we.set(Ce,g):we.delete(Ce);let{relevantReleases:Ee}=W(we);pe(Ee)},[me,pe]);return[me,Be]},ie=({workspaces:me,releases:pe})=>{let Be=[];Be.push(`${me.size} total`);let Ce=0,g=0;for(let we of me){let Ee=pe.get(we);typeof Ee>"u"?g+=1:Ee!=="decline"&&(Ce+=1)}return Be.push(`${Ce} release${Ce===1?"":"s"}`),Be.push(`${g} remaining`),h.createElement(p,{color:"yellow"},Be.join(", "))},ce=await c(({useSubmit:me})=>{let[pe,Be]=te();me(pe);let{relevantWorkspaces:Ce}=W(pe),g=new Set([...Ce].filter(se=>!R.releaseRoots.has(se))),[we,Ee]=C(0),fe=E(se=>{switch(se){case a.BEFORE:Ee(we-1);break;case a.AFTER:Ee(we+1);break}},[we,Ee]);return h.createElement(f,{flexDirection:"column"},h.createElement(N,null),h.createElement(f,null,h.createElement(p,{wrap:"wrap"},"The following files have been modified in your local checkout.")),h.createElement(f,{flexDirection:"column",marginTop:1,paddingLeft:2},[...R.changedFiles].map(se=>h.createElement(f,{key:se},h.createElement(p,null,h.createElement(p,{color:"grey"},ue.fromPortablePath(R.root)),ue.sep,ue.relative(ue.fromPortablePath(R.root),ue.fromPortablePath(se)))))),R.releaseRoots.size>0&&h.createElement(h.Fragment,null,h.createElement(f,{marginTop:1},h.createElement(p,{wrap:"wrap"},"Because of those files having been modified, the following workspaces may need to be released again (note that private workspaces are also shown here, because even though they won't be published, releasing them will allow us to flag their dependents for potential re-release):")),g.size>3?h.createElement(f,{marginTop:1},h.createElement(ie,{workspaces:R.releaseRoots,releases:pe})):null,h.createElement(f,{marginTop:1,flexDirection:"column"},h.createElement(s,{active:we%2===0,radius:1,size:2,onFocusRequest:fe},[...R.releaseRoots].map(se=>h.createElement(U,{key:se.cwd,workspace:se,decision:pe.get(se)||"undecided",setDecision:X=>Be(se,X)}))))),g.size>0?h.createElement(h.Fragment,null,h.createElement(f,{marginTop:1},h.createElement(p,{wrap:"wrap"},"The following workspaces depend on other workspaces that have been marked for release, and thus may need to be released as well:")),h.createElement(f,null,h.createElement(p,null,"(Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to move the focus between the workspace groups.)")),g.size>5?h.createElement(f,{marginTop:1},h.createElement(ie,{workspaces:g,releases:pe})):null,h.createElement(f,{marginTop:1,flexDirection:"column"},h.createElement(s,{active:we%2===1,radius:2,size:2,onFocusRequest:fe},[...g].map(se=>h.createElement(U,{key:se.cwd,workspace:se,decision:pe.get(se)||"undecided",setDecision:X=>Be(se,X)}))))):null)},{versionFile:R},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof ce>"u")return 1;R.releases.clear();for(let[me,pe]of ce)R.releases.set(me,pe);await R.saveAll()}async executeStandard(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);return await s.restoreInstallState(),(await Ot.start({configuration:r,stdout:this.context.stdout},async c=>{let f=await V1(s);if(f===null||f.releaseRoots.size===0)return;if(f.root===null)throw new nt("This command can only be run on Git repositories");if(c.reportInfo(0,`Your PR was started right after ${he.pretty(r,f.baseHash.slice(0,7),"yellow")} ${he.pretty(r,f.baseTitle,"magenta")}`),f.changedFiles.size>0){c.reportInfo(0,"You have changed the following files since then:"),c.reportSeparator();for(let S of f.changedFiles)c.reportInfo(null,`${he.pretty(r,ue.fromPortablePath(f.root),"gray")}${ue.sep}${ue.relative(ue.fromPortablePath(f.root),ue.fromPortablePath(S))}`)}let p=!1,h=!1,E=KL(f);if(E.size>0){p||c.reportSeparator();for(let S of E)c.reportError(0,`${q.prettyLocator(r,S.anchoredLocator)} has been modified but doesn't have a release strategy attached`);p=!0}let C=CP(f);for(let[S,P]of C)h||c.reportSeparator(),c.reportError(0,`${q.prettyLocator(r,S.anchoredLocator)} doesn't have a release strategy attached, but depends on ${q.prettyWorkspace(r,P)} which is planned for release.`),h=!0;(p||h)&&(c.reportSeparator(),c.reportInfo(0,"This command detected that at least some workspaces have received modifications without explicit instructions as to how they had to be released (if needed)."),c.reportInfo(0,"To correct these errors, run `yarn version check --interactive` then follow the instructions."))})).exitCode()}};Ve();Wt();var ZL=et(fi());var Z1=class extends ut{constructor(){super(...arguments);this.deferred=ge.Boolean("-d,--deferred",{description:"Prepare the version to be bumped during the next release cycle"});this.immediate=ge.Boolean("-i,--immediate",{description:"Bump the version immediately"});this.strategy=ge.String()}static{this.paths=[["version"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"apply a new version to the current package",details:"\n This command will bump the version number for the given package, following the specified strategy:\n\n - If `major`, the first number from the semver range will be increased (`X.0.0`).\n - If `minor`, the second number from the semver range will be increased (`0.X.0`).\n - If `patch`, the third number from the semver range will be increased (`0.0.X`).\n - If prefixed by `pre` (`premajor`, ...), a `-0` suffix will be set (`0.0.0-0`).\n - If `prerelease`, the suffix will be increased (`0.0.0-X`); the third number from the semver range will also be increased if there was no suffix in the previous version.\n - If `decline`, the nonce will be increased for `yarn version check` to pass without version bump.\n - If a valid semver range, it will be used as new version.\n - If unspecified, Yarn will ask you for guidance.\n\n For more information about the `--deferred` flag, consult our documentation (https://yarnpkg.com/features/release-workflow#deferred-versioning).\n ",examples:[["Immediately bump the version to the next major","yarn version major"],["Prepare the version to be bumped to the next major","yarn version major --deferred"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=r.get("preferDeferredVersions");this.deferred&&(n=!0),this.immediate&&(n=!1);let c=ZL.default.valid(this.strategy),f=this.strategy==="decline",p;if(c)if(a.manifest.version!==null){let E=Kz(a.manifest.version,this.strategy);E!==null?p=E:p=this.strategy}else p=this.strategy;else{let E=a.manifest.version;if(!f){if(E===null)throw new nt("Can't bump the version if there wasn't a version to begin with - use 0.0.0 as initial version then run the command again.");if(typeof E!="string"||!ZL.default.valid(E))throw new nt(`Can't bump the version (${E}) if it's not valid semver`)}p=W1(this.strategy)}if(!n){let C=(await IP(s)).get(a);if(typeof C<"u"&&p!=="decline"){let S=JL(a.manifest.version,p);if(ZL.default.lt(S,C))throw new nt(`Can't bump the version to one that would be lower than the current deferred one (${C})`)}}let h=await V1(s,{allowEmpty:!0});return h.releases.set(a,p),await h.saveAll(),n?0:await this.cli.run(["version","apply"])}};var tqt={configuration:{deferredVersionFolder:{description:"Folder where are stored the versioning files",type:"ABSOLUTE_PATH",default:"./.yarn/versions"},preferDeferredVersions:{description:"If true, running `yarn version` will assume the `--deferred` flag unless `--immediate` is set",type:"BOOLEAN",default:!1}},commands:[J1,z1,Z1]},rqt=tqt;var Zz={};Vt(Zz,{WorkspacesFocusCommand:()=>X1,WorkspacesForeachCommand:()=>e2,default:()=>sqt});Ve();Ve();Wt();var X1=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=ge.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=ge.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=ge.Rest()}static{this.paths=[["workspaces","focus"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Jr.find(r);await s.restoreInstallState({restoreResolutions:!1});let c;if(this.all)c=new Set(s.workspaces);else if(this.workspaces.length===0){if(!a)throw new ar(s.cwd,this.context.cwd);c=new Set([a])}else c=new Set(this.workspaces.map(f=>s.getWorkspaceByIdent(q.parseIdent(f))));for(let f of c)for(let p of this.production?["dependencies"]:Ht.hardDependencies)for(let h of f.manifest.getForScope(p).values()){let E=s.tryWorkspaceByDescriptor(h);E!==null&&c.add(E)}for(let f of s.workspaces)c.has(f)?this.production&&f.manifest.devDependencies.clear():(f.manifest.installConfig=f.manifest.installConfig||{},f.manifest.installConfig.selfReferences=!1,f.manifest.dependencies.clear(),f.manifest.devDependencies.clear(),f.manifest.peerDependencies.clear(),f.manifest.scripts.clear());return await s.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n,persistProject:!1})}};Ve();Ve();Ve();Wt();var $1=et(Sa()),zOe=et(Md());Ul();var e2=class extends ut{constructor(){super(...arguments);this.from=ge.Array("--from",{description:"An array of glob pattern idents or paths from which to base any recursion"});this.all=ge.Boolean("-A,--all",{description:"Run the command on all workspaces of a project"});this.recursive=ge.Boolean("-R,--recursive",{description:"Run the command on the current workspace and all of its recursive dependencies"});this.worktree=ge.Boolean("-W,--worktree",{description:"Run the command on all workspaces of the current worktree"});this.verbose=ge.Counter("-v,--verbose",{description:"Increase level of logging verbosity up to 2 times"});this.parallel=ge.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=ge.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=ge.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:vU([Ao(["unlimited"]),rB(BU(),[DU(),SU(1)])])});this.topological=ge.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=ge.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=ge.Array("--include",[],{description:"An array of glob pattern idents or paths; only matching workspaces will be traversed"});this.exclude=ge.Array("--exclude",[],{description:"An array of glob pattern idents or paths; matching workspaces won't be traversed"});this.publicOnly=ge.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=ge.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.dryRun=ge.Boolean("-n,--dry-run",{description:"Print the commands that would be run, without actually running them"});this.commandName=ge.String();this.args=ge.Proxy()}static{this.paths=[["workspaces","foreach"]]}static{this.usage=ot.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `-W,--worktree` is set, Yarn will find workspaces to run the command on by looking at the current worktree.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - If `--dry-run` is set, Yarn will explain what it would do without actually doing anything.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them. You can also use the `--no-private` flag to avoid running the command in private workspaces.\n\n The `-v,--verbose` flag can be passed up to twice: once to prefix output lines with the originating workspace's name, and again to include start/finish/timing log lines. Maximum verbosity is enabled by default in terminal environments.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish all packages","yarn workspaces foreach -A --no-private npm publish --tolerate-republish"],["Run the build script on all descendant packages","yarn workspaces foreach -A run build"],["Run the build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -Apt run build"],["Run the build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -Rpt --from '{workspace-a,workspace-b}' run build"]]})}static{this.schema=[iB("all",Wf.Forbids,["from","recursive","since","worktree"],{missingIf:"undefined"}),bU(["all","recursive","since","worktree"],{missingIf:"undefined"})]}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!this.all&&!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=this.cli.process([this.commandName,...this.args]),c=n.path.length===1&&n.path[0]==="run"&&typeof n.scriptName<"u"?n.scriptName:null;if(n.path.length===0)throw new nt("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let f=Ce=>{this.dryRun&&this.context.stdout.write(`${Ce} +`)},p=()=>{let Ce=this.from.map(g=>$1.default.matcher(g));return s.workspaces.filter(g=>{let we=q.stringifyIdent(g.anchoredLocator),Ee=g.relativeCwd;return Ce.some(fe=>fe(we)||fe(Ee))})},h=[];if(this.since?(f("Option --since is set; selecting the changed workspaces as root for workspace selection"),h=Array.from(await Qa.fetchChangedWorkspaces({ref:this.since,project:s}))):this.from?(f("Option --from is set; selecting the specified workspaces"),h=[...p()]):this.worktree?(f("Option --worktree is set; selecting the current workspace"),h=[a]):this.recursive?(f("Option --recursive is set; selecting the current workspace"),h=[a]):this.all&&(f("Option --all is set; selecting all workspaces"),h=[...s.workspaces]),this.dryRun&&!this.all){for(let Ce of h)f(` +- ${Ce.relativeCwd} + ${q.prettyLocator(r,Ce.anchoredLocator)}`);h.length>0&&f("")}let E;if(this.recursive?this.since?(f("Option --recursive --since is set; recursively selecting all dependent workspaces"),E=new Set(h.map(Ce=>[...Ce.getRecursiveWorkspaceDependents()]).flat())):(f("Option --recursive is set; recursively selecting all transitive dependencies"),E=new Set(h.map(Ce=>[...Ce.getRecursiveWorkspaceDependencies()]).flat())):this.worktree?(f("Option --worktree is set; recursively selecting all nested workspaces"),E=new Set(h.map(Ce=>[...Ce.getRecursiveWorkspaceChildren()]).flat())):E=null,E!==null&&(h=[...new Set([...h,...E])],this.dryRun))for(let Ce of E)f(` +- ${Ce.relativeCwd} + ${q.prettyLocator(r,Ce.anchoredLocator)}`);let C=[],S=!1;if(c?.includes(":")){for(let Ce of s.workspaces)if(Ce.manifest.scripts.has(c)&&(S=!S,S===!1))break}for(let Ce of h){if(c&&!Ce.manifest.scripts.has(c)&&!S&&!(await In.getWorkspaceAccessibleBinaries(Ce)).has(c)){f(`Excluding ${Ce.relativeCwd} because it doesn't have a "${c}" script`);continue}if(!(c===r.env.npm_lifecycle_event&&Ce.cwd===a.cwd)){if(this.include.length>0&&!$1.default.isMatch(q.stringifyIdent(Ce.anchoredLocator),this.include)&&!$1.default.isMatch(Ce.relativeCwd,this.include)){f(`Excluding ${Ce.relativeCwd} because it doesn't match the --include filter`);continue}if(this.exclude.length>0&&($1.default.isMatch(q.stringifyIdent(Ce.anchoredLocator),this.exclude)||$1.default.isMatch(Ce.relativeCwd,this.exclude))){f(`Excluding ${Ce.relativeCwd} because it matches the --exclude filter`);continue}if(this.publicOnly&&Ce.manifest.private===!0){f(`Excluding ${Ce.relativeCwd} because it's a private workspace and --no-private was set`);continue}C.push(Ce)}}if(this.dryRun)return 0;let P=this.verbose??(this.context.stdout.isTTY?1/0:0),I=P>0,R=P>1,N=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(As.availableParallelism()/2):1,U=N===1?!1:this.parallel,W=U?this.interlaced:!0,te=(0,zOe.default)(N),ie=new Map,Ae=new Set,ce=0,me=null,pe=!1,Be=await Ot.start({configuration:r,stdout:this.context.stdout,includePrefix:!1},async Ce=>{let g=async(we,{commandIndex:Ee})=>{if(pe)return-1;!U&&R&&Ee>1&&Ce.reportSeparator();let fe=nqt(we,{configuration:r,label:I,commandIndex:Ee}),[se,X]=JOe(Ce,{prefix:fe,interlaced:W}),[De,Re]=JOe(Ce,{prefix:fe,interlaced:W});try{R&&Ce.reportInfo(null,`${fe?`${fe} `:""}Process started`);let gt=Date.now(),j=await this.cli.run([this.commandName,...this.args],{cwd:we.cwd,stdout:se,stderr:De})||0;se.end(),De.end(),await X,await Re;let rt=Date.now();if(R){let Fe=r.get("enableTimers")?`, completed in ${he.pretty(r,rt-gt,he.Type.DURATION)}`:"";Ce.reportInfo(null,`${fe?`${fe} `:""}Process exited (exit code ${j})${Fe}`)}return j===130&&(pe=!0,me=j),j}catch(gt){throw se.end(),De.end(),await X,await Re,gt}};for(let we of C)ie.set(we.anchoredLocator.locatorHash,we);for(;ie.size>0&&!Ce.hasErrors();){let we=[];for(let[X,De]of ie){if(Ae.has(De.anchoredDescriptor.descriptorHash))continue;let Re=!0;if(this.topological||this.topologicalDev){let gt=this.topologicalDev?new Map([...De.manifest.dependencies,...De.manifest.devDependencies]):De.manifest.dependencies;for(let j of gt.values()){let rt=s.tryWorkspaceByDescriptor(j);if(Re=rt===null||!ie.has(rt.anchoredLocator.locatorHash),!Re)break}}if(Re&&(Ae.add(De.anchoredDescriptor.descriptorHash),we.push(te(async()=>{let gt=await g(De,{commandIndex:++ce});return ie.delete(X),Ae.delete(De.anchoredDescriptor.descriptorHash),{workspace:De,exitCode:gt}})),!U))break}if(we.length===0){let X=Array.from(ie.values()).map(De=>q.prettyLocator(r,De.anchoredLocator)).join(", ");Ce.reportError(3,`Dependency cycle detected (${X})`);return}let Ee=await Promise.all(we);Ee.forEach(({workspace:X,exitCode:De})=>{De!==0&&Ce.reportError(0,`The command failed in workspace ${q.prettyLocator(r,X.anchoredLocator)} with exit code ${De}`)});let se=Ee.map(X=>X.exitCode).find(X=>X!==0);(this.topological||this.topologicalDev)&&typeof se<"u"&&Ce.reportError(0,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return me!==null?me:Be.exitCode()}};function JOe(t,{prefix:e,interlaced:r}){let s=t.createStreamReporter(e),a=new je.DefaultStream;a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()});let n=new Promise(f=>{s.on("finish",()=>{f(a.active)})});if(r)return[a,n];let c=new je.BufferStream;return c.pipe(a,{end:!1}),c.on("finish",()=>{a.end()}),[c,n]}function nqt(t,{configuration:e,commandIndex:r,label:s}){if(!s)return null;let n=`[${q.stringifyIdent(t.anchoredLocator)}]:`,c=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],f=c[r%c.length];return he.pretty(e,n,f)}var iqt={commands:[X1,e2]},sqt=iqt;var nC=()=>({modules:new Map([["@yarnpkg/cli",iS],["@yarnpkg/core",nS],["@yarnpkg/fslib",q2],["@yarnpkg/libzip",Sv],["@yarnpkg/parsers",Z2],["@yarnpkg/shell",Qv],["clipanion",cB],["semver",oqt],["typanion",Ia],["@yarnpkg/plugin-essentials",$5],["@yarnpkg/plugin-compat",i9],["@yarnpkg/plugin-constraints",w9],["@yarnpkg/plugin-dlx",B9],["@yarnpkg/plugin-exec",D9],["@yarnpkg/plugin-file",P9],["@yarnpkg/plugin-git",X5],["@yarnpkg/plugin-github",Q9],["@yarnpkg/plugin-http",T9],["@yarnpkg/plugin-init",R9],["@yarnpkg/plugin-interactive-tools",TY],["@yarnpkg/plugin-jsr",FY],["@yarnpkg/plugin-link",NY],["@yarnpkg/plugin-nm",yV],["@yarnpkg/plugin-npm",yz],["@yarnpkg/plugin-npm-cli",bz],["@yarnpkg/plugin-pack",f7],["@yarnpkg/plugin-patch",Fz],["@yarnpkg/plugin-pnp",oV],["@yarnpkg/plugin-pnpm",Lz],["@yarnpkg/plugin-stage",Gz],["@yarnpkg/plugin-typescript",Wz],["@yarnpkg/plugin-version",zz],["@yarnpkg/plugin-workspace-tools",Zz]]),plugins:new Set(["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-constraints","@yarnpkg/plugin-dlx","@yarnpkg/plugin-exec","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-jsr","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp","@yarnpkg/plugin-pnpm","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"])});function $Oe({cwd:t,pluginConfiguration:e}){let r=new wa({binaryLabel:"Yarn Package Manager",binaryName:"yarn",binaryVersion:un??""});return Object.assign(r,{defaultContext:{...wa.defaultContext,cwd:t,plugins:e,quiet:!1,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr}})}function aqt(t){if(je.parseOptionalBoolean(process.env.YARN_IGNORE_NODE))return!0;let r=process.versions.node,s=">=18.12.0";if(Or.satisfiesWithPrereleases(r,s))return!0;let a=new nt(`This tool requires a Node version compatible with ${s} (got ${r}). Upgrade Node, or set \`YARN_IGNORE_NODE=1\` in your environment.`);return wa.defaultContext.stdout.write(t.error(a)),!1}async function eLe({selfPath:t,pluginConfiguration:e}){return await ze.find(ue.toPortablePath(process.cwd()),e,{strict:!1,usePathCheck:t})}function lqt(t,e,{yarnPath:r}){if(!le.existsSync(r))return t.error(new Error(`The "yarn-path" option has been set, but the specified location doesn't exist (${r}).`)),1;process.on("SIGINT",()=>{});let s={stdio:"inherit",env:{...process.env,YARN_IGNORE_PATH:"1"}};try{(0,ZOe.execFileSync)(process.execPath,[ue.fromPortablePath(r),...e],s)}catch(a){return a.status??1}return 0}function cqt(t,e){let r=null,s=e;return e.length>=2&&e[0]==="--cwd"?(r=ue.toPortablePath(e[1]),s=e.slice(2)):e.length>=1&&e[0].startsWith("--cwd=")?(r=ue.toPortablePath(e[0].slice(6)),s=e.slice(1)):e[0]==="add"&&e[e.length-2]==="--cwd"&&(r=ue.toPortablePath(e[e.length-1]),s=e.slice(0,e.length-2)),t.defaultContext.cwd=r!==null?K.resolve(r):K.cwd(),s}function uqt(t,{configuration:e}){if(!e.get("enableTelemetry")||XOe.isCI||!process.stdout.isTTY)return;ze.telemetry=new eC(e,"puba9cdc10ec5790a2cf4969dd413a47270");let s=/^@yarnpkg\/plugin-(.*)$/;for(let a of e.plugins.keys())tC.has(a.match(s)?.[1]??"")&&ze.telemetry?.reportPluginName(a);t.binaryVersion&&ze.telemetry.reportVersion(t.binaryVersion)}function tLe(t,{configuration:e}){for(let r of e.plugins.values())for(let s of r.commands||[])t.register(s)}async function fqt(t,e,{selfPath:r,pluginConfiguration:s}){if(!aqt(t))return 1;let a=await eLe({selfPath:r,pluginConfiguration:s}),n=a.get("yarnPath"),c=a.get("ignorePath");if(n&&!c)return lqt(t,e,{yarnPath:n});delete process.env.YARN_IGNORE_PATH;let f=cqt(t,e);uqt(t,{configuration:a}),tLe(t,{configuration:a});let p=t.process(f,t.defaultContext);return p.help||ze.telemetry?.reportCommandName(p.path.join(" ")),await t.run(p,t.defaultContext)}async function cwe({cwd:t=K.cwd(),pluginConfiguration:e=nC()}={}){let r=$Oe({cwd:t,pluginConfiguration:e}),s=await eLe({pluginConfiguration:e,selfPath:null});return tLe(r,{configuration:s}),r}async function zR(t,{cwd:e=K.cwd(),selfPath:r,pluginConfiguration:s}){let a=$Oe({cwd:e,pluginConfiguration:s});function n(){wa.defaultContext.stdout.write(`ERROR: Yarn is terminating due to an unexpected empty event loop. +Please report this issue at https://github.com/yarnpkg/berry/issues.`)}process.once("beforeExit",n);try{process.exitCode=42,process.exitCode=await fqt(a,t,{selfPath:r,pluginConfiguration:s})}catch(c){wa.defaultContext.stdout.write(a.error(c)),process.exitCode=1}finally{process.off("beforeExit",n),await le.rmtempPromise()}}zR(process.argv.slice(2),{cwd:K.cwd(),selfPath:ue.toPortablePath(ue.resolve(process.argv[1])),pluginConfiguration:nC()});})(); +/** + @license + Copyright (c) 2015, Rebecca Turner + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + */ +/** + @license + Copyright Node.js contributors. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. +*/ +/** + @license + The MIT License (MIT) + + Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +/** + @license + Copyright Joyent, Inc. and other Node contributors. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +/*! Bundled license information: + +is-number/index.js: + (*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + *) + +to-regex-range/index.js: + (*! + * to-regex-range + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + *) + +fill-range/index.js: + (*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + *) + +is-extglob/index.js: + (*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + *) + +is-glob/index.js: + (*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + *) + +queue-microtask/index.js: + (*! queue-microtask. MIT License. Feross Aboukhadijeh *) + +run-parallel/index.js: + (*! run-parallel. MIT License. Feross Aboukhadijeh *) + +git-url-parse/lib/index.js: + (*! + * buildToken + * Builds OAuth token prefix (helper function) + * + * @name buildToken + * @function + * @param {GitUrl} obj The parsed Git url object. + * @return {String} token prefix + *) + +object-assign/index.js: + (* + object-assign + (c) Sindre Sorhus + @license MIT + *) + +react/cjs/react.production.min.js: + (** @license React v17.0.2 + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +scheduler/cjs/scheduler.production.min.js: + (** @license React v0.20.2 + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +react-reconciler/cjs/react-reconciler.production.min.js: + (** @license React v0.26.2 + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +is-windows/index.js: + (*! + * is-windows + * + * Copyright © 2015-2018, Jon Schlinkert. + * Released under the MIT License. + *) +*/ diff --git a/.yarnrc.yml b/.yarnrc.yml index faf95a5095..43ecbba31d 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -6,4 +6,4 @@ enableGlobalCache: false nodeLinker: node-modules -yarnPath: .yarn/releases/yarn-4.7.0.cjs +yarnPath: .yarn/releases/yarn-4.9.1.cjs diff --git a/package.json b/package.json index bc0ae99205..de9099d988 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monorepo", - "packageManager": "yarn@4.7.0", + "packageManager": "yarn@4.9.1", "private": true, "workspaces": [ "packages/bots/liquidator", diff --git a/packages/chains/src/base/assets.ts b/packages/chains/src/base/assets.ts index bba986e3d2..0f31eb6c02 100644 --- a/packages/chains/src/base/assets.ts +++ b/packages/chains/src/base/assets.ts @@ -46,6 +46,7 @@ export const msUSD = "0x526728DBc96689597F85ae4cd716d4f7fCcBAE9d"; export const ionicUSDC = "0x23479229e52Ab6aaD312D0B03DF9F33B46753B5e"; export const ionicWETH = "0x5A32099837D89E3a794a44fb131CBbAD41f87a8C"; export const mBASIS = "0x1C2757c1FeF1038428b5bEF062495ce94BBe92b2"; +export const smUSDC = "0x616a4E1db48e22028f6bbf20444Cd3b8e3273738"; export const assets: SupportedAsset[] = [ { @@ -54,7 +55,10 @@ export const assets: SupportedAsset[] = [ name: "Wrapped Ether", decimals: 18, oracle: OracleTypes.FixedNativePriceOracle, - extraDocs: wrappedAssetDocs(SupportedChains.base) + extraDocs: wrappedAssetDocs(SupportedChains.base), + initialSupplyCap: parseEther(String(1_500)).toString(), + initialBorrowCap: parseEther(String(1_200)).toString(), + initialCf: "0.85" }, { symbol: assetSymbols.USDC, @@ -66,7 +70,10 @@ export const assets: SupportedAsset[] = [ aggregator: "0x4ba73879B0C073Db595aBE9Ba27104D83f024286", feedBaseCurrency: ChainlinkFeedBaseCurrency.USD }, - extraDocs: defaultDocs("https://basescan.org", USDC) + extraDocs: defaultDocs("https://basescan.org", USDC), + initialSupplyCap: parseUnits(String(10_000_000_000), 6).toString(), + initialBorrowCap: parseUnits(String(8_000_000_000), 6).toString(), + initialCf: "0.85" }, { symbol: assetSymbols.wstETH, @@ -480,6 +487,17 @@ export const assets: SupportedAsset[] = [ initialCf: "0.10", initialSupplyCap: parseEther(String(99_000)).toString(), initialBorrowCap: parseEther(String(99_000)).toString() + }, + { + symbol: assetSymbols.smUSDC, + underlying: smUSDC, + name: "Seamless USDC Vault", + decimals: 18, + oracle: OracleTypes.ERC4626Oracle, + extraDocs: defaultDocs("https://basescan.org", smUSDC), + initialSupplyCap: parseEther(String(2_000)).toString(), + initialBorrowCap: "1", + initialCf: "0.80" } // DO NOT ADD TO MARKET UNLESS PROPER ORACLE IS DEPLOYED // { diff --git a/packages/contracts/chainDeploy/mainnets/base.ts b/packages/contracts/chainDeploy/mainnets/base.ts index 52aadd52fa..0afe97ee82 100644 --- a/packages/contracts/chainDeploy/mainnets/base.ts +++ b/packages/contracts/chainDeploy/mainnets/base.ts @@ -81,24 +81,24 @@ export const deploy = async ({ publicClient ); - //// Pyth Oracle - await deployPythPriceOracle({ - run, - viem, - getNamedAccounts, - deployments, - deployConfig, - pythAssets: base.assets - .filter((asset) => asset.oracle === OracleTypes.PythPriceOracle) - .map((asset) => ({ - feed: (asset.oracleSpecificParams as PythSpecificParams).feed as Hex, - underlying: asset.underlying - })), - nativeTokenUsdFeed: "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", - pythAddress: "0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a", - usdToken: base.chainAddresses.STABLE_TOKEN as Address, - chainId - }); + // //// Pyth Oracle + // await deployPythPriceOracle({ + // run, + // viem, + // getNamedAccounts, + // deployments, + // deployConfig, + // pythAssets: base.assets + // .filter((asset) => asset.oracle === OracleTypes.PythPriceOracle) + // .map((asset) => ({ + // feed: (asset.oracleSpecificParams as PythSpecificParams).feed as Hex, + // underlying: asset.underlying + // })), + // nativeTokenUsdFeed: "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", + // pythAddress: "0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a", + // usdToken: base.chainAddresses.STABLE_TOKEN as Address, + // chainId + // }); // //// ERC4626 Oracle await deployErc4626PriceOracle({ diff --git a/packages/contracts/chainDeploy/mainnets/mode.ts b/packages/contracts/chainDeploy/mainnets/mode.ts index 486ae293bd..231d1f43cf 100644 --- a/packages/contracts/chainDeploy/mainnets/mode.ts +++ b/packages/contracts/chainDeploy/mainnets/mode.ts @@ -36,13 +36,16 @@ export const deployConfig: ChainDeployConfig = { }, wtoken: mode.chainAddresses.W_TOKEN as Address, veION: { - lpTokens: ["0xC6A394952c097004F83d2dfB61715d245A38735a"], - lpStakingStrategies: [], - lpStakingWalletImplementations: [], - lpExternalStakingContracts: [], - lpTokenWhitelistStatuses: [true], - lpTokenTypes: [0], - minimumLockAmounts: [parseEther("0.01")], + lpTokens: ["0xC6A394952c097004F83d2dfB61715d245A38735a", "0x690A74d2eC0175a69C0962B309E03021C0b5002E"], + lpStakingStrategies: ["VeloAeroStakingStrategy", "VeloAeroStakingStrategy"], + lpStakingWalletImplementations: ["VeloAeroStakingWallet", "VeloAeroStakingWallet"], + lpExternalStakingContracts: [ + "0x3f385FeDd141F57323dD91aA735C7243382831D8", + "0x8ff8b21a0736738b25597D32d8f7cf658f39f157" + ], + lpTokenWhitelistStatuses: [true, true], + lpTokenTypes: [0, 1], + minimumLockAmounts: [parseEther("0.01"), parseEther("0.01")], minimumLockDuration: 6 * 30 * 24 * 60 * 60, maxEarlyWithdrawFee: parseEther("0.8"), maxVotingNum: 20 diff --git a/packages/contracts/contracts/bridge/xERC20LayerZero.sol b/packages/contracts/contracts/bridge/xERC20LayerZero.sol deleted file mode 100644 index f117abcbf1..0000000000 --- a/packages/contracts/contracts/bridge/xERC20LayerZero.sol +++ /dev/null @@ -1,232 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.22; - -import { OApp, Origin, MessagingFee, MessagingReceipt } from "@layerzerolabs/oapp-evm/contracts/oapp/OApp.sol"; -import { OptionsBuilder } from "@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol"; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import { IXERC20 } from "./interface/IXERC20.sol"; - -contract xERC20LayerZero is Ownable, OApp { - using OptionsBuilder for bytes; - - uint256 public feeBps; - mapping(address => mapping(uint32 => address)) public mappedTokens; - mapping(uint32 => uint32) public chainIdToEid; - mapping(uint32 => uint32) public eidToChainId; - - event TokenMapped(address indexed _token, uint32 indexed _chainId, address indexed _dstToken); - event ChainIdToEidSet(uint32 indexed _chainId, uint32 indexed _eid); - event EidToChainIdSet(uint32 indexed _eid, uint32 indexed _chainId); - event FeeBpsSet(uint256 indexed _feeBps); - event TokenSent( - address indexed _token, - uint256 _amount, - address indexed _to, - uint32 indexed _dstChainId, - bytes32 _guid - ); - event TokenReceived( - address indexed _token, - uint256 _amount, - address indexed _to, - uint32 indexed _srcChainId, - bytes32 _guid - ); - - error TokenNotSet(); - error ChainIdNotSet(); - error OriginNotMirrorAdapter(); - - constructor(uint256 _feeBps, address _endpoint) OApp(_endpoint, msg.sender) Ownable() { - feeBps = _feeBps; - - // known chain ids - // Set initial chain ID to EID mappings - setChainIdToEid(8453, 30184); // base - setChainIdToEid(10, 30111); // optimism - setChainIdToEid(252, 30255); // fraxtal - setChainIdToEid(60808, 30279); // bob - setChainIdToEid(34443, 30260); // mode - - // Set initial EID to chain ID mappings - setEidToChainId(30184, 8453); // base - setEidToChainId(30111, 10); // optimism - setEidToChainId(30255, 252); // fraxtal - setEidToChainId(30279, 60808); // bob - setEidToChainId(30260, 34443); // mode - } - - // ADMIN FUNCTIONS - function setFeeBps(uint256 _feeBps) public onlyOwner { - feeBps = _feeBps; - emit FeeBpsSet(_feeBps); - } - - function setMappedToken(uint32 _chainId, address _srcToken, address _dstToken) public onlyOwner { - mappedTokens[_srcToken][_chainId] = _dstToken; - emit TokenMapped(_srcToken, _chainId, _dstToken); - } - - function setChainIdToEid(uint32 _chainId, uint32 _eid) public onlyOwner { - chainIdToEid[_chainId] = _eid; - emit ChainIdToEidSet(_chainId, _eid); - } - - function setEidToChainId(uint32 _eid, uint32 _chainId) public onlyOwner { - eidToChainId[_eid] = _chainId; - emit EidToChainIdSet(_eid, _chainId); - } - - function withdrawFee(address _token) public onlyOwner { - uint256 _amount = IERC20(_token).balanceOf(address(this)); - IERC20(_token).transfer(msg.sender, _amount); - } - - function withdrawFee(address _token, uint256 _amount) public onlyOwner { - IERC20(_token).transfer(msg.sender, _amount); - } - - function withdrawEth() public onlyOwner { - uint256 _amount = address(this).balance; - payable(msg.sender).transfer(_amount); - } - - function withdrawEth(uint256 _amount) public onlyOwner { - payable(msg.sender).transfer(_amount); - } - - // PUBLIC FUNCTIONS - function quote( - uint32 _dstChainId, - address _token, - uint256 _amount, - address _to - ) external view returns (uint256 nativeFee, uint256 zroFee) { - bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(50000, 0); - return _quoteInternal(_dstChainId, _token, _amount, _to, options, false); - } - - function quote( - uint32 _dstChainId, // destination endpoint id - address _token, - uint256 _amount, - address _to, - bytes memory _options, // your message execution options - bool _payInLzToken // boolean for which token to return fee in - ) external view returns (uint256 nativeFee, uint256 zroFee) { - return _quoteInternal(_dstChainId, _token, _amount, _to, _options, _payInLzToken); - } - - function send( - address _token, - uint256 _amount, - address _to, - uint32 _dstChainId - ) external payable { - bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(50000, 0); - _send(_dstChainId, _token, _amount, _to, options); - } - - /** - * @notice Sends tokens to a destination chain - * - * @param _token The token to send - * @param _amount The amount of tokens to send - * @param _to The address to send the tokens to - * @param _dstChainId The destination chain id - * @param _options The options to send the tokens with - */ - function send( - address _token, - uint256 _amount, - address _to, - uint32 _dstChainId, - bytes calldata _options - ) external payable { - _send(_dstChainId, _token, _amount, _to, _options); - } - - // INTERNAL FUNCTIONS - function _quoteInternal( - uint32 _dstChainId, - address _token, - uint256 _amount, - address _to, - bytes memory _options, - bool _payInLzToken - ) internal view returns (uint256 nativeFee, uint256 zroFee) { - uint32 _dstEid = chainIdToEid[_dstChainId]; - if (_dstEid == 0) { - revert ChainIdNotSet(); - } - uint256 _amountAfterFee = (_amount * (10000 - feeBps)) / 10000; - bytes memory _payload = abi.encode(_to, _token, _amountAfterFee); - MessagingFee memory fee = _quote(_dstEid, _payload, _options, _payInLzToken); - return (fee.nativeFee, fee.lzTokenFee); - } - - function _send( - uint32 _dstChainId, - address _token, - uint256 _amount, - address _to, - bytes memory _options - ) internal { - uint32 _dstEid = chainIdToEid[_dstChainId]; - if (_dstEid == 0) { - revert ChainIdNotSet(); - } - - // transfer tokens to this contract - IERC20(_token).transferFrom(msg.sender, address(this), _amount); - - // take fee and burn the tokens - uint256 _amountAfterFee = (_amount * (10000 - feeBps)) / 10000; - IXERC20(_token).burn(address(this), _amountAfterFee); - - bytes memory _payload = abi.encode(_to, _token, _amountAfterFee); - MessagingReceipt memory _receipt = _lzSend( - _dstEid, - _payload, - _options, - // Fee in native gas and ZRO token. - MessagingFee(msg.value, 0), - // Refund address in case of failed source message. - payable(msg.sender) - ); - emit TokenSent(_token, _amountAfterFee, _to, _dstChainId, _receipt.guid); - } - - // LAYERZERO FUNCTIONS - /** - * @dev Called when data is received from the protocol. It overrides the equivalent function in the parent contract. - * Protocol messages are defined as packets, comprised of the following parameters. - * @param _origin A struct containing information about where the packet came from. - * @param _guid A global unique identifier for tracking the packet. - * @param payload Encoded message. - */ - function _lzReceive( - Origin calldata _origin, - bytes32 _guid, - bytes calldata payload, - address, // Executor address as specified by the OApp. - bytes calldata // Any extra data or options to trigger on receipt. - ) internal override { - // Decode the payload to get the message - (address _to, address _srcToken, uint256 _amount) = abi.decode(payload, (address, address, uint256)); - - uint32 _srcChainId = eidToChainId[_origin.srcEid]; - // get the mapped token using the current chain id and received source token - address _dstToken = mappedTokens[_srcToken][_srcChainId]; - if (_dstToken == address(0)) { - revert TokenNotSet(); - } - - // mint the tokens to the destination address - IXERC20(_dstToken).mint(_to, _amount); - emit TokenReceived(_dstToken, _amount, _to, _srcChainId, _guid); - } - - receive() external payable {} -} diff --git a/packages/contracts/contracts/compound/CErc20RewardsDelegateMorpho.sol b/packages/contracts/contracts/compound/CErc20RewardsDelegateMorpho.sol new file mode 100644 index 0000000000..b4da19afde --- /dev/null +++ b/packages/contracts/contracts/compound/CErc20RewardsDelegateMorpho.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.8.0; + +import "./CErc20RewardsDelegate.sol"; + +contract CErc20RewardsDelegateMorpho is CErc20Delegate { + event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount); + + function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) { + uint8 fnsCount = 1; + + bytes4[] memory superFunctionSelectors = super._getExtensionFunctions(); + functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount); + + for (uint256 i = 0; i < superFunctionSelectors.length; i++) { + functionSelectors[i] = superFunctionSelectors[i]; + } + + functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector; + + require(fnsCount == 0, "use the correct array length"); + } + + /** + * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract. + * @param rewardToken The reward strategy for which the rewards are being claimed. + * @param claimable The amount of tokens to claim and forward. + * @param proof The proof required to validate the claim. + * @dev Only callable by the governance. + */ + function claim( + address morphoURD, + address rewardToken, + address distributor, + uint256 claimable, + bytes32[] memory proof + ) external isAuthorized { + uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof); + EIP20Interface(rewardToken).approve(distributor, claimedAmount); + IDistributor(distributor).distribute(rewardToken, claimedAmount); + emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount); + } + + function delegateType() public pure virtual override returns (uint8) { + return 5; + } +} + +interface IDistributor { + function distribute(address _rewardToken, uint256 _amount) external; +} + +interface IMorphoClaim { + function claim( + address account, + address reward, + uint256 claimable, + bytes32[] memory proof + ) external returns (uint256 amount); +} diff --git a/packages/contracts/contracts/compound/CTokenInterfaces.sol b/packages/contracts/contracts/compound/CTokenInterfaces.sol index 231a652379..8d9c3e64d8 100644 --- a/packages/contracts/contracts/compound/CTokenInterfaces.sol +++ b/packages/contracts/contracts/compound/CTokenInterfaces.sol @@ -250,11 +250,7 @@ interface CTokenFirstExtensionInterface { function transfer(address dst, uint256 amount) external returns (bool); - function transferFrom( - address src, - address dst, - uint256 amount - ) external returns (bool); + function transferFrom(address src, address dst, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); @@ -270,15 +266,7 @@ interface CTokenFirstExtensionInterface { function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256); - function getAccountSnapshot(address account) - external - view - returns ( - uint256, - uint256, - uint256, - uint256 - ); + function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256); function borrowRatePerBlock() external view returns (uint256); @@ -322,19 +310,11 @@ interface CTokenSecondExtensionInterface { function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256); - function liquidateBorrow( - address borrower, - uint256 repayAmount, - address cTokenCollateral - ) external returns (uint256); + function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256); function getCash() external view returns (uint256); - function seize( - address liquidator, - address borrower, - uint256 seizeTokens - ) external returns (uint256); + function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256); /*** Admin Functions ***/ diff --git a/packages/contracts/contracts/compound/CTokenMinter.sol b/packages/contracts/contracts/compound/CTokenMinter.sol new file mode 100644 index 0000000000..f399ccb88f --- /dev/null +++ b/packages/contracts/contracts/compound/CTokenMinter.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.8.0; + +import "./CToken.sol"; +import "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; +import "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol"; + +contract CTokenMinter is Initializable, OwnableUpgradeable { + ICErc20 public collateralMarket; + uint256 public startTime; + uint256 public endTime; + + modifier onlyDuringMintWindow() { + require(block.timestamp >= startTime && block.timestamp <= endTime, "Minting not allowed at this time"); + _; + } + + function initialize(address _cTokenAddress, uint256 _startTime, uint256 _endTime) public initializer { + require(_startTime < _endTime, "Invalid time window"); + __Ownable_init(); + collateralMarket = ICErc20(_cTokenAddress); + startTime = _startTime; + endTime = _endTime; + } + + function mint(uint256 mintAmount) external onlyDuringMintWindow { + // MINT LOGIC + } + + function setMintWindow(uint256 _newStartTime, uint256 _newEndTime) external onlyOwner { + require(_newStartTime < _newEndTime, "Invalid time window"); + startTime = _newStartTime; + endTime = _newEndTime; + } +} diff --git a/packages/contracts/contracts/ionic/MorphoBribeDistributor.sol b/packages/contracts/contracts/ionic/MorphoBribeDistributor.sol new file mode 100644 index 0000000000..b99789a926 --- /dev/null +++ b/packages/contracts/contracts/ionic/MorphoBribeDistributor.sol @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.22; + +import { IBribeRewards } from "../veION/interfaces/IBribeRewards.sol"; +import { IERC20, SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import { OwnableUpgradeable } from "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol"; + +/** + * @title MorphoBribeDistributor + * @dev This contract handles the distribution of bribe tokens to the Morpho protocol. + */ +contract MorphoBribeDistributor is OwnableUpgradeable { + using SafeERC20 for IERC20; + + /// @notice Address of the Morpho market + address public morphoMarket; + /// @notice Address of the Morpho bribes contract + address public morphoBribes; + + event Initialized(address indexed morphoMarket, address indexed morphoBribes); + event Distributed(address indexed from, uint256 amount); + event MorphoMarketSet(address indexed newMorphoMarket); + event MorphoBribesSet(address indexed newMorphoBribes); + event BribeTokenSet(address indexed newBribeToken); + + /** + * @dev Modifier to restrict access to only the Morpho market + */ + modifier onlyMorphoMarket() { + require(msg.sender == morphoMarket, "Caller is not the Morpho Market"); + _; + } + + /** + * @notice Initializes the MorphoBribeDistributor contract + * @param _morphoMarket Address of the Morpho market + * @param _morphoBribes Address of the Morpho bribes contract + */ + function initialize(address _morphoMarket, address _morphoBribes) public initializer { + __Ownable_init(); + morphoMarket = _morphoMarket; + morphoBribes = _morphoBribes; + emit Initialized(_morphoMarket, _morphoBribes); + } + + /** + * @notice Distributes bribe tokens to the Morpho bribes contract + * @param _amount Amount of tokens to distribute + */ + function distribute(address _rewardToken, uint256 _amount) external onlyMorphoMarket { + IERC20(_rewardToken).safeTransferFrom(msg.sender, address(this), _amount); + IERC20(_rewardToken).approve(morphoBribes, _amount); + IBribeRewards(morphoBribes).notifyRewardAmount(_rewardToken, _amount); + emit Distributed(msg.sender, _amount); + } + + /** + * @notice Sets the address of the Morpho market + * @param _morphoMarket New address of the Morpho market + */ + function setMorphoMarket(address _morphoMarket) external onlyOwner { + morphoMarket = _morphoMarket; + emit MorphoMarketSet(_morphoMarket); + } + + /** + * @notice Sets the address of the Morpho bribes contract + * @param _morphoBribes New address of the Morpho bribes contract + */ + function setMorphoBribes(address _morphoBribes) external onlyOwner { + morphoBribes = _morphoBribes; + emit MorphoBribesSet(_morphoBribes); + } +} diff --git a/packages/contracts/contracts/ionic/strategies/flywheel/rewards/FlywheelInstantRewards.sol b/packages/contracts/contracts/ionic/strategies/flywheel/rewards/FlywheelInstantRewards.sol new file mode 100644 index 0000000000..bc5f7110c3 --- /dev/null +++ b/packages/contracts/contracts/ionic/strategies/flywheel/rewards/FlywheelInstantRewards.sol @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.10; + +import { Auth, Authority } from "solmate/auth/Auth.sol"; +import { BaseFlywheelRewards } from "./BaseFlywheelRewards.sol"; +import { SafeTransferLib, ERC20 } from "solmate/utils/SafeTransferLib.sol"; +import { IonicFlywheelCore } from "../IonicFlywheelCore.sol"; + +/** + * @title FlywheelInstantRewards + * @author Jourdan DUnkley (https://github.com/jourdanDunkley) + * @notice This contract handles the instant reward distribution for strategies. + * It allows setting and transferring rewards for specific strategies. + */ +contract FlywheelInstantRewards is Auth, BaseFlywheelRewards { + using SafeTransferLib for ERC20; + + event RewardsSet(ERC20 indexed strategy, uint256 amount); + + /// @notice Mapping to store the reward amount for each strategy. + mapping(ERC20 => uint256) rewardAmount; + /// @notice Mapping to track if a strategy has new rewards to be distributed. + mapping(ERC20 => bool) rewardsNew; + + /** + * @notice Constructor to initialize the FlywheelInstantRewards contract. + * @param _flywheel The flywheel core contract. + * @param _owner The owner of the contract. + * @param _authority The authority contract for authentication. + */ + constructor( + IonicFlywheelCore _flywheel, + address _owner, + Authority _authority + ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {} + + /** + * @notice Set the reward amount for a specific strategy. + * @param _amount The amount of rewards to be set for the strategy. + * @param _strategy The strategy for which the rewards are being set. + * @dev Requires authentication to execute. + */ + function setRewards(ERC20 _strategy, uint256 _amount) external requiresAuth { + rewardAmount[_strategy] = _amount; + rewardsNew[_strategy] = true; + rewardToken.safeTransferFrom(msg.sender, address(this), _amount); + emit RewardsSet(_strategy, _amount); + } + + /** + * @notice Calculate and transfer accrued rewards to the flywheel core. + * @param strategy The strategy to accrue rewards for. + * @return amount The amount of tokens accrued and transferred. + * @dev This function can only be called by the flywheel core. + */ + function getAccruedRewards( + ERC20 strategy, + uint32 /* lastUpdatedTimestamp */ + ) external override onlyFlywheel returns (uint256 amount) { + if (rewardsNew[strategy]) { + amount = rewardAmount[strategy]; + rewardsNew[strategy] = false; + } else { + amount = 0; + } + } +} diff --git a/packages/contracts/contracts/test/DevTesting.t.sol b/packages/contracts/contracts/test/DevTesting.t.sol index 20b27ede8d..cf82ceebe8 100644 --- a/packages/contracts/contracts/test/DevTesting.t.sol +++ b/packages/contracts/contracts/test/DevTesting.t.sol @@ -164,6 +164,28 @@ contract DevTesting is BaseTest { } } + function testLockOnLisk() public debuggingOnly fork(LISK_MAINNET) { + address veIONAddress = 0x6136BeC00Ba7C6d44BB10ee8683C792a0F8cDd6a; + + address[] memory tokenAddress = new address[](1); + tokenAddress[0] = 0x076d0CD6228B042aA28E1E6A0894Cf6C97abc23b; + + uint256[] memory tokenAmount = new uint256[](1); + tokenAmount[0] = 3024400000000000000; + + uint256[] memory duration = new uint256[](1); + duration[0] = 15552000; + + bool[] memory stakeUnderlying = new bool[](1); + stakeUnderlying[0] = true; + + veION veionContract = veION(veIONAddress); + vm.prank(0x89bf9BAaeE2d451477CF850fE4c0d89bb796B1aD); + uint256 tokenId = veionContract.createLock(tokenAddress, tokenAmount, duration, stakeUnderlying); + + emit log_named_uint("Created veION lock with tokenId", tokenId); + } + function testModeLiquidationShortfall() public debuggingOnly fork(MODE_MAINNET) { (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity( 0xa75F9C8246f7269279bE4c969e7Bc6Eb619cC204 diff --git a/packages/contracts/contracts/test/config/BaseTest.t.sol b/packages/contracts/contracts/test/config/BaseTest.t.sol index cde7bd04d3..ef25a17148 100644 --- a/packages/contracts/contracts/test/config/BaseTest.t.sol +++ b/packages/contracts/contracts/test/config/BaseTest.t.sol @@ -22,6 +22,7 @@ abstract contract BaseTest is Test { uint128 constant ZKEVM_MAINNET = 1101; uint128 constant MODE_MAINNET = 34443; uint128 constant BASE_MAINNET = 8453; + uint128 constant LISK_MAINNET = 1135; // taken from ERC1967Upgrade bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; @@ -132,6 +133,8 @@ abstract contract BaseTest is Test { forkIds[chainid] = vm.createFork(vm.rpcUrl("mode")) + 100; } else if (chainid == BASE_MAINNET) { forkIds[chainid] = vm.createFork(vm.rpcUrl("base")) + 100; + } else if (chainid == LISK_MAINNET) { + forkIds[chainid] = vm.createFork(vm.rpcUrl("lisk")) + 100; } } @@ -162,6 +165,8 @@ abstract contract BaseTest is Test { forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl("mode_archive")) + 100; } else if (chainid == BASE_MAINNET) { forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl("base_archive")) + 100; + } else if (chainid == LISK_MAINNET) { + forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl("lisk_archive")) + 100; } } return forkIds[chainidWithOffset] - 100; @@ -234,11 +239,7 @@ abstract contract BaseTest is Test { return array; } - function asArray( - address value0, - address value1, - address value2 - ) public pure returns (address[] memory) { + function asArray(address value0, address value1, address value2) public pure returns (address[] memory) { address[] memory array = new address[](3); array[0] = value0; array[1] = value1; @@ -278,11 +279,7 @@ abstract contract BaseTest is Test { return array; } - function asArray( - bytes memory value0, - bytes memory value1, - bytes memory value2 - ) public pure returns (bytes[] memory) { + function asArray(bytes memory value0, bytes memory value1, bytes memory value2) public pure returns (bytes[] memory) { bytes[] memory array = new bytes[](3); array[0] = value0; array[1] = value1; diff --git a/packages/contracts/deploy/03-deploy-ctokens-set-extensions.ts b/packages/contracts/deploy/03-deploy-ctokens-set-extensions.ts index bee050bb71..99a11efb0c 100644 --- a/packages/contracts/deploy/03-deploy-ctokens-set-extensions.ts +++ b/packages/contracts/deploy/03-deploy-ctokens-set-extensions.ts @@ -3,6 +3,7 @@ import { Address, encodeAbiParameters, Hash, parseAbiParameters, zeroAddress } f import { prepareAndLogTransaction } from "../chainDeploy/helpers/logging"; import { chainIdtoChain } from "@ionicprotocol/chains"; +import { base } from "viem/chains"; const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getChainId }) => { const { deployer, multisig } = await getNamedAccounts(); @@ -37,21 +38,29 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh await publicClient.waitForTransactionReceipt({ hash: erc20Del.transactionHash as Hash }); console.log("CErc20Delegate: ", erc20Del.address); - const erc20PluginDel = await deployments.deploy("CErc20PluginDelegate", { + // const erc20PluginDel = await deployments.deploy("CErc20PluginDelegate", { + // from: deployer, + // args: [], + // log: true, + // waitConfirmations: 1 + // }); + // console.log("CErc20PluginDelegate: ", erc20PluginDel.address); + + const erc20RewardsDel = await deployments.deploy("CErc20RewardsDelegate", { from: deployer, args: [], log: true, waitConfirmations: 1 }); - console.log("CErc20PluginDelegate: ", erc20PluginDel.address); + console.log("CErc20RewardsDelegate: ", erc20RewardsDel.address); - const erc20RewardsDel = await deployments.deploy("CErc20RewardsDelegate", { + const erc20MorphoDel = await deployments.deploy("CErc20RewardsDelegateMorpho", { from: deployer, args: [], log: true, waitConfirmations: 1 }); - console.log("CErc20RewardsDelegate: ", erc20RewardsDel.address); + console.log("CErc20RewardsDelegateMorpho: ", erc20MorphoDel.address); // const erc20PluginRewardsDel = await deployments.deploy("CErc20PluginRewardsDelegate", { // from: deployer, @@ -122,25 +131,91 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh } } + // { + // // CErc20PluginDelegate + // const erc20PluginDelExtensions = await fuseFeeDistributor.read.getCErc20DelegateExtensions([ + // erc20PluginDel.address as Address + // ]); + // if ( + // erc20PluginDelExtensions.length == 0 || + // erc20PluginDelExtensions[0] != erc20PluginDel.address || + // erc20PluginDelExtensions[1] != cTokenFirstExtension.address + // ) { + // if ((await fuseFeeDistributor.read.owner()).toLowerCase() !== deployer.toLowerCase()) { + // await prepareAndLogTransaction({ + // contractInstance: fuseFeeDistributor, + // functionName: "_setCErc20DelegateExtensions", + // args: [ + // erc20PluginDel.address as Address, + // [erc20PluginDel.address as Address, cTokenFirstExtension.address as Address] + // ], + // description: "Set CErc20PluginDelegate Extensions", + // inputs: [ + // { internalType: "address", name: "cErc20Delegate", type: "address" }, + // { internalType: "address[]", name: "extensions", type: "address[]" } + // ] + // }); + // } else { + // tx = await fuseFeeDistributor.write._setCErc20DelegateExtensions([ + // erc20PluginDel.address as Address, + // [erc20PluginDel.address as Address, cTokenFirstExtension.address as Address] + // ]); + // await publicClient.waitForTransactionReceipt({ hash: tx }); + // console.log(`configured the extensions for the CErc20PluginDelegate ${erc20PluginDel.address}`); + // } + // } else { + // console.log(`CErc20PluginDelegate extensions already configured`); + // } + + // const [latestCErc20PluginDelegate] = await fuseFeeDistributor.read.latestCErc20Delegate([2]); + // if (latestCErc20PluginDelegate === zeroAddress || latestCErc20PluginDelegate !== erc20PluginDel.address) { + // if ((await fuseFeeDistributor.read.owner()).toLowerCase() !== deployer.toLowerCase()) { + // await prepareAndLogTransaction({ + // contractInstance: fuseFeeDistributor, + // functionName: "_setLatestCErc20Delegate", + // args: [2, erc20PluginDel.address as Address, becomeImplementationData], + // description: "Set Latest CErc20PluginDelegate", + // inputs: [ + // { internalType: "uint8", name: "delegateType", type: "uint8" }, + // { internalType: "address", name: "newImplementation", type: "address" }, + // { internalType: "bytes", name: "becomeImplementationData", type: "bytes" } + // ] + // }); + // } else { + // tx = await fuseFeeDistributor.write._setLatestCErc20Delegate([ + // 2, + // erc20PluginDel.address as Address, + // becomeImplementationData + // ]); + // await publicClient.waitForTransactionReceipt({ hash: tx }); + // console.log( + // `Set the latest CErc20PluginDelegate implementation from ${latestCErc20PluginDelegate} to ${erc20PluginDel.address}` + // ); + // } + // } else { + // console.log(`No change in the latest CErc20PluginDelegate implementation ${erc20PluginDel.address}`); + // } + // } + { - // CErc20PluginDelegate - const erc20PluginDelExtensions = await fuseFeeDistributor.read.getCErc20DelegateExtensions([ - erc20PluginDel.address as Address + // CErc20RewardsDelegate + const erc20RewardsDelExtensions = await fuseFeeDistributor.read.getCErc20DelegateExtensions([ + erc20RewardsDel.address as Address ]); if ( - erc20PluginDelExtensions.length == 0 || - erc20PluginDelExtensions[0] != erc20PluginDel.address || - erc20PluginDelExtensions[1] != cTokenFirstExtension.address + erc20RewardsDelExtensions.length == 0 || + erc20RewardsDelExtensions[0] != erc20RewardsDel.address || + erc20RewardsDelExtensions[1] != cTokenFirstExtension.address ) { if ((await fuseFeeDistributor.read.owner()).toLowerCase() !== deployer.toLowerCase()) { await prepareAndLogTransaction({ contractInstance: fuseFeeDistributor, functionName: "_setCErc20DelegateExtensions", args: [ - erc20PluginDel.address as Address, - [erc20PluginDel.address as Address, cTokenFirstExtension.address as Address] + erc20RewardsDel.address as Address, + [erc20RewardsDel.address as Address, cTokenFirstExtension.address as Address] ], - description: "Set CErc20PluginDelegate Extensions", + description: "Set CErc20RewardsDelegate Extensions", inputs: [ { internalType: "address", name: "cErc20Delegate", type: "address" }, { internalType: "address[]", name: "extensions", type: "address[]" } @@ -148,24 +223,23 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh }); } else { tx = await fuseFeeDistributor.write._setCErc20DelegateExtensions([ - erc20PluginDel.address as Address, - [erc20PluginDel.address as Address, cTokenFirstExtension.address as Address] + erc20RewardsDel.address as Address, + [erc20RewardsDel.address as Address, cTokenFirstExtension.address as Address] ]); await publicClient.waitForTransactionReceipt({ hash: tx }); - console.log(`configured the extensions for the CErc20PluginDelegate ${erc20PluginDel.address}`); + console.log(`configured the extensions for the CErc20RewardsDelegate ${erc20RewardsDel.address}`); } } else { - console.log(`CErc20PluginDelegate extensions already configured`); + console.log(`CErc20RewardsDelegate extensions already configured`); } - - const [latestCErc20PluginDelegate] = await fuseFeeDistributor.read.latestCErc20Delegate([2]); - if (latestCErc20PluginDelegate === zeroAddress || latestCErc20PluginDelegate !== erc20PluginDel.address) { + const [latestCErc20RewardsDelegate] = await fuseFeeDistributor.read.latestCErc20Delegate([3]); + if (latestCErc20RewardsDelegate === zeroAddress || latestCErc20RewardsDelegate !== erc20RewardsDel.address) { if ((await fuseFeeDistributor.read.owner()).toLowerCase() !== deployer.toLowerCase()) { await prepareAndLogTransaction({ contractInstance: fuseFeeDistributor, functionName: "_setLatestCErc20Delegate", - args: [2, erc20PluginDel.address as Address, becomeImplementationData], - description: "Set Latest CErc20PluginDelegate", + args: [3, erc20RewardsDel.address as Address, becomeImplementationData], + description: "Set Latest CErc20RewardsDelegate", inputs: [ { internalType: "uint8", name: "delegateType", type: "uint8" }, { internalType: "address", name: "newImplementation", type: "address" }, @@ -174,39 +248,39 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh }); } else { tx = await fuseFeeDistributor.write._setLatestCErc20Delegate([ - 2, - erc20PluginDel.address as Address, + 3, + erc20RewardsDel.address as Address, becomeImplementationData ]); await publicClient.waitForTransactionReceipt({ hash: tx }); console.log( - `Set the latest CErc20PluginDelegate implementation from ${latestCErc20PluginDelegate} to ${erc20PluginDel.address}` + `Set the latest CErc20RewardsDelegate implementation from ${latestCErc20RewardsDelegate} to ${erc20RewardsDel.address}` ); } } else { - console.log(`No change in the latest CErc20PluginDelegate implementation ${erc20PluginDel.address}`); + console.log(`No change in the latest CErc20RewardsDelegate implementation ${erc20RewardsDel.address}`); } } { - // CErc20RewardsDelegate - const erc20RewardsDelExtensions = await fuseFeeDistributor.read.getCErc20DelegateExtensions([ - erc20RewardsDel.address as Address + // CErc20RewardsDelegateMorpho + const erc20MorphoDelExtensions = await fuseFeeDistributor.read.getCErc20DelegateExtensions([ + erc20MorphoDel.address as Address ]); if ( - erc20RewardsDelExtensions.length == 0 || - erc20RewardsDelExtensions[0] != erc20RewardsDel.address || - erc20RewardsDelExtensions[1] != cTokenFirstExtension.address + erc20MorphoDelExtensions.length == 0 || + erc20MorphoDelExtensions[0] != erc20MorphoDel.address || + erc20MorphoDelExtensions[1] != cTokenFirstExtension.address ) { if ((await fuseFeeDistributor.read.owner()).toLowerCase() !== deployer.toLowerCase()) { await prepareAndLogTransaction({ contractInstance: fuseFeeDistributor, functionName: "_setCErc20DelegateExtensions", args: [ - erc20RewardsDel.address as Address, - [erc20RewardsDel.address as Address, cTokenFirstExtension.address as Address] + erc20MorphoDel.address as Address, + [erc20MorphoDel.address as Address, cTokenFirstExtension.address as Address] ], - description: "Set CErc20RewardsDelegate Extensions", + description: "Set CErc20RewardsDelegateMorpho Extensions", inputs: [ { internalType: "address", name: "cErc20Delegate", type: "address" }, { internalType: "address[]", name: "extensions", type: "address[]" } @@ -214,23 +288,26 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh }); } else { tx = await fuseFeeDistributor.write._setCErc20DelegateExtensions([ - erc20RewardsDel.address as Address, - [erc20RewardsDel.address as Address, cTokenFirstExtension.address as Address] + erc20MorphoDel.address as Address, + [erc20MorphoDel.address as Address, cTokenFirstExtension.address as Address] ]); await publicClient.waitForTransactionReceipt({ hash: tx }); - console.log(`configured the extensions for the CErc20RewardsDelegate ${erc20RewardsDel.address}`); + console.log(`configured the extensions for the CErc20RewardsDelegateMorpho ${erc20MorphoDel.address}`); } } else { - console.log(`CErc20RewardsDelegate extensions already configured`); + console.log(`CErc20RewardsDelegateMorpho extensions already configured`); } - const [latestCErc20RewardsDelegate] = await fuseFeeDistributor.read.latestCErc20Delegate([3]); - if (latestCErc20RewardsDelegate === zeroAddress || latestCErc20RewardsDelegate !== erc20RewardsDel.address) { + const [latestCErc20RewardsDelegateMorpho] = await fuseFeeDistributor.read.latestCErc20Delegate([5]); + if ( + latestCErc20RewardsDelegateMorpho === zeroAddress || + latestCErc20RewardsDelegateMorpho !== erc20MorphoDel.address + ) { if ((await fuseFeeDistributor.read.owner()).toLowerCase() !== deployer.toLowerCase()) { await prepareAndLogTransaction({ contractInstance: fuseFeeDistributor, functionName: "_setLatestCErc20Delegate", - args: [3, erc20RewardsDel.address as Address, becomeImplementationData], - description: "Set Latest CErc20RewardsDelegate", + args: [5, erc20MorphoDel.address as Address, becomeImplementationData], + description: "Set Latest CErc20RewardsDelegateMorpho", inputs: [ { internalType: "uint8", name: "delegateType", type: "uint8" }, { internalType: "address", name: "newImplementation", type: "address" }, @@ -239,17 +316,17 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh }); } else { tx = await fuseFeeDistributor.write._setLatestCErc20Delegate([ - 3, - erc20RewardsDel.address as Address, + 5, + erc20MorphoDel.address as Address, becomeImplementationData ]); await publicClient.waitForTransactionReceipt({ hash: tx }); console.log( - `Set the latest CErc20RewardsDelegate implementation from ${latestCErc20RewardsDelegate} to ${erc20RewardsDel.address}` + `Set the latest CErc20RewardsDelegate implementation from ${latestCErc20RewardsDelegateMorpho} to ${erc20RewardsDel.address}` ); } } else { - console.log(`No change in the latest CErc20RewardsDelegate implementation ${erc20RewardsDel.address}`); + console.log(`No change in the latest CErc20RewardsDelegate implementation ${erc20MorphoDel.address}`); } } diff --git a/packages/contracts/deploy/21-deploy-veion.ts b/packages/contracts/deploy/21-deploy-veion.ts index 5fcb43ea70..562655adb0 100644 --- a/packages/contracts/deploy/21-deploy-veion.ts +++ b/packages/contracts/deploy/21-deploy-veion.ts @@ -84,11 +84,40 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh console.log(`Extensions Set: ${veIONFirstExtension.address}, ${veIONSecondExtension.address}`); const IveION = await viem.getContractAt("IveION", (await deployments.get("veION")).address as Address); - const owner = (await veION.read.owner()) as Address; + const veIONOwner = (await veION.read.owner()) as Address; + + // ╔══════════════════════════════════════════╗ + // ║ SET LP TOKEN TYPE ║ + // ╚══════════════════════════════════════════╝ + for (let i = 0; i < veParams.lpTokens.length; i++) { + const token = veParams.lpTokens[i]; + const type = veParams.lpTokenTypes[i]; + if (veIONOwner.toLowerCase() !== deployer.toLowerCase()) { + await prepareAndLogTransaction({ + contractInstance: veION, + functionName: "setLpTokenType", + args: [token, type], + description: `Set LP Token Type: ${token} to ${type}`, + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint8", name: "_type", type: "uint8" } + ] + }); + } else { + hash = await IveION.write.setLpTokenType([token, type]); + const receipt = await publicClient.waitForTransactionReceipt({ hash }); + if (receipt.status === "success") { + console.log(`Successfully set Lp Type: ${token}, ${type}`); + } else { + console.error(`Transaction ${hash} failed: ${receipt.status}`); + } + } + } // ╔══════════════════════════════════════════╗ // ║ SET LP TOKEN TYPE ║ // ╚══════════════════════════════════════════╝ + const owner = (await veION.read.owner()) as Address; for (let i = 0; i < veParams.lpTokens.length; i++) { const token = veParams.lpTokens[i]; const type = veParams.lpTokenTypes[i]; @@ -320,27 +349,34 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh try { console.log(`Deploying ${stakingWalletImplementationName} implementation...`); - stakingWalletImplementation = await deployments.deploy(stakingWalletImplementationName, { - from: deployer, - log: true - }); + stakingWalletImplementation = await deployments.deploy( + `${stakingWalletImplementationName}_${stakingTokenAddress}`, + { + contract: stakingWalletImplementationName, + from: deployer, + log: true + } + ); + if (stakingWalletImplementation.transactionHash) + await publicClient.waitForTransactionReceipt({ hash: stakingWalletImplementation.transactionHash as Hash }); console.log(`${stakingWalletImplementationName} deployed at: ${stakingWalletImplementation.address}`); } catch (error) { console.error(`Error deploying ${stakingWalletImplementationName}:`, error); } - stakingWalletImplementation = await viem.getContractAt( - stakingWalletImplementationName, - (await deployments.get(stakingWalletImplementationName)).address as Address - ); + // stakingWalletImplementation = await viem.getContractAt( + // `${stakingWalletImplementationName}`, + // (await deployments.get(`${stakingWalletImplementationName}_${stakingTokenAddress}`)).address as Address + // ); // ╔══════════════════════════════════════════╗ // ║ SET STAKING STRATEGY ║ // ╚══════════════════════════════════════════╝ let stakeStrategy; try { - stakeStrategy = await deployments.deploy(stakingStrategyName, { + stakeStrategy = await deployments.deploy(`${stakingStrategyName}_${stakingTokenAddress}`, { + contract: stakingStrategyName, from: deployer, log: true, proxy: { @@ -348,28 +384,30 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh execute: { init: { methodName: "initialize", - args: [veION.address, stakingTokenAddress, externalStakingContract, stakingWalletImplementation.address] + args: [veION.address, stakingTokenAddress, externalStakingContract, stakingWalletImplementation!.address] } - }, - owner: multisig + } + // owner: multisig } }); + if (stakeStrategy.transactionHash) + await publicClient.waitForTransactionReceipt({ hash: stakeStrategy.transactionHash as Hash }); console.log(`${stakingStrategyName} deployed at: ${stakeStrategy.address}`); } catch (error) { console.error(`Error deploying ${stakingStrategyName}:`, error); } - stakeStrategy = await viem.getContractAt( - stakingStrategyName, - (await deployments.get(stakingStrategyName)).address as Address - ); + // stakeStrategy = await viem.getContractAt( + // stakingStrategyName, + // (await deployments.get(stakingStrategyName)).address as Address + // ); - const txHash = await IveION.write.setStakeStrategy([tokenType, stakeStrategy.address]); + const txHash = await IveION.write.setStakeStrategy([tokenType, stakeStrategy!.address as Address]); const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash }); if (receipt.status === "success") { console.log( - `Successfully set staking strategy to : ${stakeStrategy.address} (${stakingStrategyName}) with staking wallet ${stakingWalletImplementationName} for token ${stakingTokenAddress}, type ${tokenType}` + `Successfully set staking strategy to : ${stakeStrategy!.address} (${stakingStrategyName}) with staking wallet ${stakingWalletImplementationName} for token ${stakingTokenAddress}, type ${tokenType}` ); } else { console.error(`Transaction ${hash} failed: ${receipt.status}`); diff --git a/packages/contracts/deploy/22-deploy-voter.ts b/packages/contracts/deploy/22-deploy-voter.ts index a111756a4a..b21cb90a87 100644 --- a/packages/contracts/deploy/22-deploy-voter.ts +++ b/packages/contracts/deploy/22-deploy-voter.ts @@ -86,6 +86,15 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh // ║ ADD MARKETS ║ // ║ Configuring which LP tokens are allowed ║ // ╚══════════════════════════════════════════╝ + const marketsLength = await voter.read.marketsLength(); + const marketAlreadyAdded: { marketAddress: Address; side: number }[] = []; + for (let i = 0; i < marketsLength; i++) { + const market = await voter.read.markets([BigInt(i)]); + marketAlreadyAdded.push({ marketAddress: market[0], side: market[1] }); + } + const marketAlreadyAddedAddresses = marketAlreadyAdded.map((market) => market.marketAddress); + console.log(marketAlreadyAddedAddresses); + const allMarkets: { marketAddress: Address; side: number }[] = []; const [, pools] = await poolDirectory.read.getActivePools(); for (let i = 0; i < pools.length; i++) { @@ -95,9 +104,11 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh const markets = await comptroller.read.getAllMarkets(); console.log(`Setting up ${markets.length} Markets`); for (const market of markets) { - allMarkets.push({ marketAddress: market, side: 0 }); - allMarkets.push({ marketAddress: market, side: 1 }); - console.log(`Setting up ${market}`); + if (!marketAlreadyAddedAddresses.includes(market)) { + allMarkets.push({ marketAddress: market, side: 0 }); + allMarkets.push({ marketAddress: market, side: 1 }); + console.log(`Setting up ${market}`); + } } } catch (error) { console.error(`Error processing pool ${pool.name}:`, error); @@ -116,6 +127,19 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh console.error(`Error adding markets ${error}`); } + const marketsWithoutRewardAccumulator: { marketAddress: Address; side: number }[] = []; + for (const market of marketAlreadyAdded) { + try { + const rewardAccumulatorAddress = await voter.read.marketToRewardAccumulators([market.marketAddress, 0]); + if (rewardAccumulatorAddress === zeroAddress) { + marketsWithoutRewardAccumulator.push(market); + } + } catch (error) { + console.error(`Error querying reward accumulator for market ${market.marketAddress}:`, error); + } + } + console.log("Markets without accumulators", marketsWithoutRewardAccumulator); + // ╔══════════════════════════════════════════╗ // ║ DEPLOY REWARD ACCUMULATORS ║ // ║ AND SET THEM IN THE VOTER CONTRACT ║ @@ -127,7 +151,7 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh // Loop through allMarkets to deploy a RewardAccumulator for each market and configure it let counter = 0; - for (const market of allMarkets) { + for (const market of marketsWithoutRewardAccumulator) { const deploymentName = `RewardAccumulator_${market.marketAddress}_${market.side}`; try { // Deploy RewardAccumulator @@ -151,7 +175,7 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh await publicClient.waitForTransactionReceipt({ hash: rewardAccumulatorDeployment.transactionHash as Hash }); } console.log( - `Deployed RewardAccumulator at: ${rewardAccumulatorDeployment.address}, Counter: ${++counter}/${allMarkets.length}` + `Deployed RewardAccumulator at: ${rewardAccumulatorDeployment.address}, Counter: ${++counter}/${marketsWithoutRewardAccumulator.length}` ); // Collect data for setMarketRewardAccumulators diff --git a/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb.json b/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb.json new file mode 100644 index 0000000000..47552165e2 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb.json @@ -0,0 +1,1125 @@ +{ + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "transactionIndex": 83, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020808000000000001000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000808000000000000000000000400000000000000000000000000000000000000000000080000000000000800000001000000000000040000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000800000000000000000000000000000", + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf", + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "logs": [ + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000001bde1474083be208eb3671fed03872d504ab1f08" + ], + "data": "0x", + "logIndex": 276, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + }, + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 277, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + }, + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 278, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + }, + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 279, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + } + ], + "blockNumber": 25919830, + "cumulativeGasUsed": "15250891", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1bdE1474083BE208EB3671FED03872D504ab1f08", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x1bdE1474083BE208EB3671FED03872D504ab1f08", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Implementation.json new file mode 100644 index 0000000000..eef740a263 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x1bdE1474083BE208EB3671FED03872D504ab1f08", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xddc75274e4a6385d4eba3c8baebda388272b02d6381e7de73605ac96e7940c6b", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x1bdE1474083BE208EB3671FED03872D504ab1f08", + "transactionIndex": 105, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000100000000000000000000000000004000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x54f9ca6f01eacac9a101030ca79bdca3afdc5e6cdb4f47f1a7ea441b995adae8", + "transactionHash": "0xddc75274e4a6385d4eba3c8baebda388272b02d6381e7de73605ac96e7940c6b", + "logs": [ + { + "transactionIndex": 105, + "blockNumber": 25919826, + "transactionHash": "0xddc75274e4a6385d4eba3c8baebda388272b02d6381e7de73605ac96e7940c6b", + "address": "0x1bdE1474083BE208EB3671FED03872D504ab1f08", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 346, + "blockHash": "0x54f9ca6f01eacac9a101030ca79bdca3afdc5e6cdb4f47f1a7ea441b995adae8" + } + ], + "blockNumber": 25919826, + "cumulativeGasUsed": "18499154", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Proxy.json new file mode 100644 index 0000000000..225450240d --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "transactionIndex": 83, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020808000000000001000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000808000000000000000000000400000000000000000000000000000000000000000000080000000000000800000001000000000000040000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000800000000000000000000000000000", + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf", + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "logs": [ + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000001bde1474083be208eb3671fed03872d504ab1f08" + ], + "data": "0x", + "logIndex": 276, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + }, + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 277, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + }, + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 278, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + }, + { + "transactionIndex": 83, + "blockNumber": 25919830, + "transactionHash": "0x80fd934003095dba7ebc4075ed38af4a25b2e4342be80543c04a822a93a00944", + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 279, + "blockHash": "0x2fd32d46c01571c408fe67af255758727b3a29e9118d9ea62afbb505b0526aaf" + } + ], + "blockNumber": 25919830, + "cumulativeGasUsed": "15250891", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1bdE1474083BE208EB3671FED03872D504ab1f08", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B.json b/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B.json new file mode 100644 index 0000000000..717f4cdb76 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B.json @@ -0,0 +1,1125 @@ +{ + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "transactionIndex": 134, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000008000000000000000000000000000000002000001000000000000000000000000000000010000020000000000000800000880410000800000000000000000002000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745", + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "logs": [ + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000061f501eb77c4962b712238c39e653508a042da64" + ], + "data": "0x", + "logIndex": 432, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + }, + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 433, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + }, + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 434, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + }, + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 435, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + } + ], + "blockNumber": 25919740, + "cumulativeGasUsed": "28175788", + "status": 1, + "byzantium": true + }, + "args": [ + "0x61F501Eb77C4962b712238c39e653508a042dA64", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x61F501Eb77C4962b712238c39e653508a042dA64", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Implementation.json new file mode 100644 index 0000000000..7450d7be82 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x61F501Eb77C4962b712238c39e653508a042dA64", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xb96b133a9e4a755ab0c6d39c55b65a12fd65e520b29fabd137b2d7fe2a54902c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x61F501Eb77C4962b712238c39e653508a042dA64", + "transactionIndex": 122, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000008000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000", + "blockHash": "0xa24281f9e9eb942d60a209515be571d6eed0f52f28a3c0399b7e5291654cd0d0", + "transactionHash": "0xb96b133a9e4a755ab0c6d39c55b65a12fd65e520b29fabd137b2d7fe2a54902c", + "logs": [ + { + "transactionIndex": 122, + "blockNumber": 25919736, + "transactionHash": "0xb96b133a9e4a755ab0c6d39c55b65a12fd65e520b29fabd137b2d7fe2a54902c", + "address": "0x61F501Eb77C4962b712238c39e653508a042dA64", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 433, + "blockHash": "0xa24281f9e9eb942d60a209515be571d6eed0f52f28a3c0399b7e5291654cd0d0" + } + ], + "blockNumber": 25919736, + "cumulativeGasUsed": "24314823", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Proxy.json new file mode 100644 index 0000000000..fa2af0d141 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "transactionIndex": 134, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000008000000000000000000000000000000002000001000000000000000000000000000000010000020000000000000800000880410000800000000000000000002000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745", + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "logs": [ + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000061f501eb77c4962b712238c39e653508a042da64" + ], + "data": "0x", + "logIndex": 432, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + }, + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 433, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + }, + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 434, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + }, + { + "transactionIndex": 134, + "blockNumber": 25919740, + "transactionHash": "0xa691ec81c967d4c0310cdbc986860e41bc39c646281be89febef89c2a70e8147", + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 435, + "blockHash": "0x4043042323536a50d4c0de2ab06b5422d11ad311d6739adda4a3d0d6ba2f9745" + } + ], + "blockNumber": 25919740, + "cumulativeGasUsed": "28175788", + "status": 1, + "byzantium": true + }, + "args": [ + "0x61F501Eb77C4962b712238c39e653508a042dA64", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea.json b/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea.json new file mode 100644 index 0000000000..b7854fc414 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea.json @@ -0,0 +1,1125 @@ +{ + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "transactionIndex": 120, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000024800000000000000000000000000000000000000800000000000000000800000000000000000000000000000000010000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000000000000000080000000000000800000000000000000000080000000000400000000000000000000000000000000001000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000800000000000000000", + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c", + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "logs": [ + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000723eb1b00a8da4b184f65f55aba4bc558a381d5b" + ], + "data": "0x", + "logIndex": 152, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + }, + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 153, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + }, + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 154, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + }, + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 155, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + } + ], + "blockNumber": 25919777, + "cumulativeGasUsed": "17932915", + "status": 1, + "byzantium": true + }, + "args": [ + "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Implementation.json new file mode 100644 index 0000000000..64d457d1d2 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7bdeb8dafc8bdb398734f55d9f9de07a3c1ffe7ccda079e973d73a97a2875303", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B", + "transactionIndex": 151, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000080000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6af20743ee9e1fadff725a2b91382c6a521d689244feda14b327dffc713b222f", + "transactionHash": "0x7bdeb8dafc8bdb398734f55d9f9de07a3c1ffe7ccda079e973d73a97a2875303", + "logs": [ + { + "transactionIndex": 151, + "blockNumber": 25919772, + "transactionHash": "0x7bdeb8dafc8bdb398734f55d9f9de07a3c1ffe7ccda079e973d73a97a2875303", + "address": "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 511, + "blockHash": "0x6af20743ee9e1fadff725a2b91382c6a521d689244feda14b327dffc713b222f" + } + ], + "blockNumber": 25919772, + "cumulativeGasUsed": "33799760", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Proxy.json new file mode 100644 index 0000000000..02613d5a2f --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "transactionIndex": 120, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000024800000000000000000000000000000000000000800000000000000000800000000000000000000000000000000010000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000000000000000080000000000000800000000000000000000080000000000400000000000000000000000000000000001000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000800000000000000000", + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c", + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "logs": [ + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000723eb1b00a8da4b184f65f55aba4bc558a381d5b" + ], + "data": "0x", + "logIndex": 152, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + }, + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 153, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + }, + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 154, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + }, + { + "transactionIndex": 120, + "blockNumber": 25919777, + "transactionHash": "0xbca6961296d12e20b1d524e4a3c6a25aa5fe89540a3d39810f16c7e47111d0dd", + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 155, + "blockHash": "0x63b11f434ea91271803e4632c26fe6cb331d57afd14308ba5aacf730cf13c88c" + } + ], + "blockNumber": 25919777, + "cumulativeGasUsed": "17932915", + "status": 1, + "byzantium": true + }, + "args": [ + "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6.json b/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6.json new file mode 100644 index 0000000000..d0158afe75 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6.json @@ -0,0 +1,1125 @@ +{ + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "transactionIndex": 114, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000401000000000000000000000000800000000000020000400000000800000800000000800000000000000000000000400000000000000000000000002000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000008000000000000000000000000200000000000000000000000000000000", + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb", + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "logs": [ + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000d292fefc0b637d602c5ee11618dfbf8f756f3f30" + ], + "data": "0x", + "logIndex": 336, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + }, + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 337, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + }, + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 338, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + }, + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 339, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + } + ], + "blockNumber": 25919795, + "cumulativeGasUsed": "19558936", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Implementation.json new file mode 100644 index 0000000000..d6ae8cfe7c --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd964b56f7350664fb134fd6e15f9f988a93f2ec400bc713e25d54749b4add68d", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30", + "transactionIndex": 96, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000002000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3578e7182a749a81300a9985bc26a4715e37c939a2af61db0d8c153482677db7", + "transactionHash": "0xd964b56f7350664fb134fd6e15f9f988a93f2ec400bc713e25d54749b4add68d", + "logs": [ + { + "transactionIndex": 96, + "blockNumber": 25919791, + "transactionHash": "0xd964b56f7350664fb134fd6e15f9f988a93f2ec400bc713e25d54749b4add68d", + "address": "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 313, + "blockHash": "0x3578e7182a749a81300a9985bc26a4715e37c939a2af61db0d8c153482677db7" + } + ], + "blockNumber": 25919791, + "cumulativeGasUsed": "17813009", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Proxy.json new file mode 100644 index 0000000000..3135ecc083 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "transactionIndex": 114, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000401000000000000000000000000800000000000020000400000000800000800000000800000000000000000000000400000000000000000000000002000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000008000000000000000000000000200000000000000000000000000000000", + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb", + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "logs": [ + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000d292fefc0b637d602c5ee11618dfbf8f756f3f30" + ], + "data": "0x", + "logIndex": 336, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + }, + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 337, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + }, + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 338, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + }, + { + "transactionIndex": 114, + "blockNumber": 25919795, + "transactionHash": "0xfb46d3bc9c9b2d60b60766460d9ac24fa0728f5b68198c7f9adaa9645c5344e8", + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 339, + "blockHash": "0x2fa8ba2f864710305d18e07e1317d100c095ba8c16d11ccb2de1b7d464a6e0bb" + } + ], + "blockNumber": 25919795, + "cumulativeGasUsed": "19558936", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88.json b/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88.json new file mode 100644 index 0000000000..769d48823b --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88.json @@ -0,0 +1,1125 @@ +{ + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "transactionIndex": 92, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000002000000004000000000000000000002000201000000000000000000000000000000000000420000000000400800000800000000800000000000000000000000400000000000000400000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd", + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "logs": [ + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000003e1ae0dd5a4b0802db10027b425994bb437dc935" + ], + "data": "0x", + "logIndex": 207, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + }, + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 208, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + }, + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 209, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + }, + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 210, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + } + ], + "blockNumber": 25919866, + "cumulativeGasUsed": "23059390", + "status": 1, + "byzantium": true + }, + "args": [ + "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Implementation.json new file mode 100644 index 0000000000..a535364497 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x54e9a28cabcd0f3ef6222b6cfe981c49e7581a34c14f48ca44b8a1205e8373f7", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935", + "transactionIndex": 86, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000400000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000", + "blockHash": "0xd3444aa730798c9599f6cdb36cb7f2d66b8703ba9924ab6f409ed41c6b360a46", + "transactionHash": "0x54e9a28cabcd0f3ef6222b6cfe981c49e7581a34c14f48ca44b8a1205e8373f7", + "logs": [ + { + "transactionIndex": 86, + "blockNumber": 25919861, + "transactionHash": "0x54e9a28cabcd0f3ef6222b6cfe981c49e7581a34c14f48ca44b8a1205e8373f7", + "address": "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 212, + "blockHash": "0xd3444aa730798c9599f6cdb36cb7f2d66b8703ba9924ab6f409ed41c6b360a46" + } + ], + "blockNumber": 25919861, + "cumulativeGasUsed": "19976196", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Proxy.json new file mode 100644 index 0000000000..cc19fd96c6 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "transactionIndex": 92, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000002000000004000000000000000000002000201000000000000000000000000000000000000420000000000400800000800000000800000000000000000000000400000000000000400000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd", + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "logs": [ + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000003e1ae0dd5a4b0802db10027b425994bb437dc935" + ], + "data": "0x", + "logIndex": 207, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + }, + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 208, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + }, + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 209, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + }, + { + "transactionIndex": 92, + "blockNumber": 25919866, + "transactionHash": "0x8c1277af026453be1ae8f3c4fc8cdbdefc71bbd2c593bd1864f80f17c668272c", + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 210, + "blockHash": "0xf3ac44a2dedfe916a3b776675bd4083dc67e35e1c6c328974798b066e34e9edd" + } + ], + "blockNumber": 25919866, + "cumulativeGasUsed": "23059390", + "status": 1, + "byzantium": true + }, + "args": [ + "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59.json b/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59.json new file mode 100644 index 0000000000..63ab7c7dcd --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59.json @@ -0,0 +1,1125 @@ +{ + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "transactionIndex": 77, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000800000000020800000000000000000020000000000000004000800000000000000000000000000000000000000000000000000000000000000000002080001000000000000000000000000000000000000020000000000000800000800000000800000000000000000004000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000010000000000000000000000000000000000000", + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b", + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "logs": [ + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000029b35f3fca158fd2853aef591c67be3ebe736b54" + ], + "data": "0x", + "logIndex": 215, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + }, + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 216, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + }, + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 217, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + }, + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 218, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + } + ], + "blockNumber": 25919812, + "cumulativeGasUsed": "16241911", + "status": 1, + "byzantium": true + }, + "args": [ + "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Implementation.json new file mode 100644 index 0000000000..ccd3025f70 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xb956fb1557feecd80b7d5989f48cc58119f349a303818d867832a1c6f4652cfc", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54", + "transactionIndex": 81, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbeb8c37d9afe0b94b42703d09aaf5c8c1ce6bcd753eac9a67300df6a86b9aa28", + "transactionHash": "0xb956fb1557feecd80b7d5989f48cc58119f349a303818d867832a1c6f4652cfc", + "logs": [ + { + "transactionIndex": 81, + "blockNumber": 25919808, + "transactionHash": "0xb956fb1557feecd80b7d5989f48cc58119f349a303818d867832a1c6f4652cfc", + "address": "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 94, + "blockHash": "0xbeb8c37d9afe0b94b42703d09aaf5c8c1ce6bcd753eac9a67300df6a86b9aa28" + } + ], + "blockNumber": 25919808, + "cumulativeGasUsed": "14930441", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Proxy.json new file mode 100644 index 0000000000..37c649eaa7 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "transactionIndex": 77, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000800000000020800000000000000000020000000000000004000800000000000000000000000000000000000000000000000000000000000000000002080001000000000000000000000000000000000000020000000000000800000800000000800000000000000000004000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000010000000000000000000000000000000000000", + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b", + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "logs": [ + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000029b35f3fca158fd2853aef591c67be3ebe736b54" + ], + "data": "0x", + "logIndex": 215, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + }, + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 216, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + }, + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 217, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + }, + { + "transactionIndex": 77, + "blockNumber": 25919812, + "transactionHash": "0xb4ea8b8f46a8606081a26bee311a21b3f7c8012f4ded7e683688df9bee603e49", + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 218, + "blockHash": "0x00aba291d5fda1adba9e65492af4ecd73609f79b286d16a6ae6d561691a3573b" + } + ], + "blockNumber": 25919812, + "cumulativeGasUsed": "16241911", + "status": 1, + "byzantium": true + }, + "args": [ + "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945.json b/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945.json new file mode 100644 index 0000000000..6d73fb834c --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945.json @@ -0,0 +1,1125 @@ +{ + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "transactionIndex": 77, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400002000000000020800000000000000000000000000000000000000800040000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000002000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000001020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000400000000400000000000000000000000", + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8", + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "logs": [ + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000071f2b15c8c4518038f07752a9fc882623859011b" + ], + "data": "0x", + "logIndex": 174, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + }, + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 175, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + }, + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 176, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + }, + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 177, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + } + ], + "blockNumber": 25919758, + "cumulativeGasUsed": "17897044", + "status": 1, + "byzantium": true + }, + "args": [ + "0x71f2b15c8c4518038f07752A9FC882623859011b", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x71f2b15c8c4518038f07752A9FC882623859011b", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Implementation.json new file mode 100644 index 0000000000..68c94fb264 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x71f2b15c8c4518038f07752A9FC882623859011b", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3aaea4af5c328d9cf708fb27741d675354223cea1577dfc5a66b8ac12c4319d3", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x71f2b15c8c4518038f07752A9FC882623859011b", + "transactionIndex": 88, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000080000000000000000040000000000000000000000000000400000000000000000000000000000000000000000000000000000000000020040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb09a7333b9d0c1e7f3848bacbaa508d194fc49704d7dc52824e4295a2f7fd577", + "transactionHash": "0x3aaea4af5c328d9cf708fb27741d675354223cea1577dfc5a66b8ac12c4319d3", + "logs": [ + { + "transactionIndex": 88, + "blockNumber": 25919754, + "transactionHash": "0x3aaea4af5c328d9cf708fb27741d675354223cea1577dfc5a66b8ac12c4319d3", + "address": "0x71f2b15c8c4518038f07752A9FC882623859011b", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 189, + "blockHash": "0xb09a7333b9d0c1e7f3848bacbaa508d194fc49704d7dc52824e4295a2f7fd577" + } + ], + "blockNumber": 25919754, + "cumulativeGasUsed": "30693361", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Proxy.json new file mode 100644 index 0000000000..960c80af41 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "transactionIndex": 77, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400002000000000020800000000000000000000000000000000000000800040000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000002000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000001020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000400000000400000000000000000000000", + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8", + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "logs": [ + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000071f2b15c8c4518038f07752a9fc882623859011b" + ], + "data": "0x", + "logIndex": 174, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + }, + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 175, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + }, + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 176, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + }, + { + "transactionIndex": 77, + "blockNumber": 25919758, + "transactionHash": "0xbde89e758b1943c7a9337a9eee0fca7a7c0da1a71cec171a9254b081123caa54", + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 177, + "blockHash": "0xcb8be5bc72f3e1caf8f53aeb1ba44b89efd5dfd8862cf843cd5d08ea96ccafd8" + } + ], + "blockNumber": 25919758, + "cumulativeGasUsed": "17897044", + "status": 1, + "byzantium": true + }, + "args": [ + "0x71f2b15c8c4518038f07752A9FC882623859011b", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810.json b/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810.json new file mode 100644 index 0000000000..eceade44be --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810.json @@ -0,0 +1,1125 @@ +{ + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "transactionIndex": 96, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000201000000000000000000000000000000000000020000400000000800000800000000800000000000000000000000400000000000000000000000000000200000000000000080000200000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000080000000008000000000000000000000000000000000000", + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a", + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "logs": [ + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000a047d852476f9f8ac04b336c230a1f1085568c57" + ], + "data": "0x", + "logIndex": 286, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + }, + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 287, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + }, + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 288, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + }, + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 289, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + } + ], + "blockNumber": 25919848, + "cumulativeGasUsed": "24436022", + "status": 1, + "byzantium": true + }, + "args": [ + "0xa047d852476F9F8aC04b336C230a1f1085568C57", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0xa047d852476F9F8aC04b336C230a1f1085568C57", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Implementation.json new file mode 100644 index 0000000000..7351014cff --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0xa047d852476F9F8aC04b336C230a1f1085568C57", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x19a172199d24818c940af2d4c19f1c5075c995ca44df73cf09d458e2c39f916b", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xa047d852476F9F8aC04b336C230a1f1085568C57", + "transactionIndex": 62, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000800000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0b4f1dcbc9ad1ed8f8bf8f079de45b067cf6ae81fa032b88b04d5ab973540151", + "transactionHash": "0x19a172199d24818c940af2d4c19f1c5075c995ca44df73cf09d458e2c39f916b", + "logs": [ + { + "transactionIndex": 62, + "blockNumber": 25919844, + "transactionHash": "0x19a172199d24818c940af2d4c19f1c5075c995ca44df73cf09d458e2c39f916b", + "address": "0xa047d852476F9F8aC04b336C230a1f1085568C57", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 105, + "blockHash": "0x0b4f1dcbc9ad1ed8f8bf8f079de45b067cf6ae81fa032b88b04d5ab973540151" + } + ], + "blockNumber": 25919844, + "cumulativeGasUsed": "14277934", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Proxy.json new file mode 100644 index 0000000000..31c192a8b0 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "transactionIndex": 96, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000201000000000000000000000000000000000000020000400000000800000800000000800000000000000000000000400000000000000000000000000000200000000000000080000200000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000080000000008000000000000000000000000000000000000", + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a", + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "logs": [ + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000a047d852476f9f8ac04b336c230a1f1085568c57" + ], + "data": "0x", + "logIndex": 286, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + }, + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 287, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + }, + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 288, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + }, + { + "transactionIndex": 96, + "blockNumber": 25919848, + "transactionHash": "0xb457712c455f41b84f372b6c64a9a27a7f2ae08fd81cf0691cbcfd8788c19b54", + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 289, + "blockHash": "0x2e45d5690cc3145e9de81675a76558f701c9cbc1fd5627732dd128ee72ac1f0a" + } + ], + "blockNumber": 25919848, + "cumulativeGasUsed": "24436022", + "status": 1, + "byzantium": true + }, + "args": [ + "0xa047d852476F9F8aC04b336C230a1f1085568C57", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38.json b/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38.json new file mode 100644 index 0000000000..4eeb76be69 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38.json @@ -0,0 +1,1125 @@ +{ + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x21D595170F2125D87194581222c97cD75FB0A573", + "transactionIndex": 79, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000001020800000200000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000008000000000080000000000000800000000000100000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000800000000020000000000004000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a", + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "logs": [ + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000a95312baeb4c96699331988cebaf5798e5233610" + ], + "data": "0x", + "logIndex": 190, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + }, + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 191, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + }, + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 192, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + }, + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 193, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + } + ], + "blockNumber": 25919884, + "cumulativeGasUsed": "16173250", + "status": 1, + "byzantium": true + }, + "args": [ + "0xA95312BAEb4C96699331988cEBaF5798e5233610", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0xA95312BAEb4C96699331988cEBaF5798e5233610", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Implementation.json new file mode 100644 index 0000000000..6960d4be2c --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0xA95312BAEb4C96699331988cEBaF5798e5233610", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x98343edc7c9fb4070b397eac52b7938e806706da0bb00a89f334ae3416fd8f5b", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xA95312BAEb4C96699331988cEBaF5798e5233610", + "transactionIndex": 117, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000", + "blockHash": "0x00760af0e8c57b1fc5a5c48abcd3cd84e2b58ae19c5ce0c50b523b5e23aba8d1", + "transactionHash": "0x98343edc7c9fb4070b397eac52b7938e806706da0bb00a89f334ae3416fd8f5b", + "logs": [ + { + "transactionIndex": 117, + "blockNumber": 25919880, + "transactionHash": "0x98343edc7c9fb4070b397eac52b7938e806706da0bb00a89f334ae3416fd8f5b", + "address": "0xA95312BAEb4C96699331988cEBaF5798e5233610", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 238, + "blockHash": "0x00760af0e8c57b1fc5a5c48abcd3cd84e2b58ae19c5ce0c50b523b5e23aba8d1" + } + ], + "blockNumber": 25919880, + "cumulativeGasUsed": "36639444", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Proxy.json new file mode 100644 index 0000000000..d34e4607e2 --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x21D595170F2125D87194581222c97cD75FB0A573", + "transactionIndex": 79, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000001020800000200000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000008000000000080000000000000800000000000100000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000800000000020000000000004000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a", + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "logs": [ + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000a95312baeb4c96699331988cebaf5798e5233610" + ], + "data": "0x", + "logIndex": 190, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + }, + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 191, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + }, + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 192, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + }, + { + "transactionIndex": 79, + "blockNumber": 25919884, + "transactionHash": "0xa8514851a64401f56f6c03dca4cb079f33d3940fc691790ba3b819b15ceed232", + "address": "0x21D595170F2125D87194581222c97cD75FB0A573", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 193, + "blockHash": "0xb5992abf5c8a3962545df10f1fac4409a62991bc9a14d7c1a553340cdb79f41a" + } + ], + "blockNumber": 25919884, + "cumulativeGasUsed": "16173250", + "status": 1, + "byzantium": true + }, + "args": [ + "0xA95312BAEb4C96699331988cEBaF5798e5233610", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D.json b/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D.json new file mode 100644 index 0000000000..dcc7fa7c2b --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D.json @@ -0,0 +1,1125 @@ +{ + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "transactionIndex": 127, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000021800000000000020000000000000000000000000800000000000000000000000000000000000000000000000000000000001000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000000000000000090000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000400000000400000000000000000020000000000000000000000000000000000000000000000000000000000040000000", + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c", + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "logs": [ + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000414e7b43b8b82adf0b02c84e9ec02aa82d87b2aa" + ], + "data": "0x", + "logIndex": 280, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + }, + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 281, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + }, + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 282, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + }, + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 283, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + } + ], + "blockNumber": 25919903, + "cumulativeGasUsed": "30285226", + "status": 1, + "byzantium": true + }, + "args": [ + "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x669A6F5421dA53696fa06f1043CF127d380f6EB9", + "0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27" + ] + }, + "implementation": "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Implementation.json b/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Implementation.json new file mode 100644 index 0000000000..140c319adb --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Implementation.json @@ -0,0 +1,1442 @@ +{ + "address": "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "epochStart", + "type": "uint256" + } + ], + "name": "HistoricalPriceNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidEscrowToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidGauge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVotingEscrow", + "type": "error" + }, + { + "inputs": [], + "name": "SingleTokenExpected", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "HistoricalPriceSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardNotification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllLpRewardTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getCheckpoint", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceOf", + "type": "uint256" + } + ], + "internalType": "struct IBribeRewards.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getPriorBalanceIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + } + ], + "name": "getPriorSupplyIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "historicalPrices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_ve", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lastEarn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsListLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "setHistoricalPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyNumCheckpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenRewardsPerEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ve", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xcc74bf8938c51335a40d81a383de74722a5280cf4a656b8735bbe5aa8951726d", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA", + "transactionIndex": 63, + "gasUsed": "2066887", + "logsBloom": "0x00000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000200000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000", + "blockHash": "0xde00461326168cc9824c54c79d3def77b6f4cd9425eaed54cf559e26b77bb78c", + "transactionHash": "0xcc74bf8938c51335a40d81a383de74722a5280cf4a656b8735bbe5aa8951726d", + "logs": [ + { + "transactionIndex": 63, + "blockNumber": 25919898, + "transactionHash": "0xcc74bf8938c51335a40d81a383de74722a5280cf4a656b8735bbe5aa8951726d", + "address": "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 255, + "blockHash": "0xde00461326168cc9824c54c79d3def77b6f4cd9425eaed54cf559e26b77bb78c" + } + ], + "blockNumber": 25919898, + "cumulativeGasUsed": "19091610", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochStart\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEscrowToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGauge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVotingEscrow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SingleTokenExpected\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"HistoricalPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardNotification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"checkpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllLpRewardTokens\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getCheckpoint\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"balanceOf\",\"type\":\"uint256\"}],\"internalType\":\"struct IBribeRewards.Checkpoint\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getPriorBalanceIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"getPriorSupplyIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"historicalPrices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isReward\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastEarn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setHistoricalPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyNumCheckpoints\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenRewardsPerEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"voter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"deposit(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be deposited for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}},\"earned(address,uint256)\":{\"params\":{\"token\":\"Address of the reward token\",\"tokenId\":\"Unique identifier of the veNFT\"},\"returns\":{\"_0\":\"Amount of the reward token earned\"}},\"getAllLpRewardTokens()\":{\"returns\":{\"_0\":\"Array of LP token addresses\"}},\"getCheckpoint(uint256,address,uint256)\":{\"params\":{\"index\":\"The index of the checkpoint to retrieve\",\"lpToken\":\"The LP token address\",\"tokenId\":\"The ID of the veION token\"},\"returns\":{\"_0\":\"The checkpoint data\"}},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"lpToken\":\"Address of the liquidity pool token\",\"timestamp\":\"The timestamp to get the balance at\",\"tokenId\":\"The veNFT token ID to check\"},\"returns\":{\"_0\":\"The balance index at the given timestamp\"}},\"getPriorSupplyIndex(uint256,address)\":{\"details\":\"Timestamp must be in the past or present.\",\"params\":{\"timestamp\":\"The timestamp to get the supply index at\"},\"returns\":{\"_0\":\"The supply index at the given timestamp\"}},\"getReward(uint256,address[])\":{\"details\":\"If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\",\"params\":{\"tokenId\":\"Unique identifier of the veNFT\",\"tokens\":\"Array of tokens to claim rewards for\"}},\"initialize(address,address)\":{\"details\":\"This function is called only once during contract deployment\",\"params\":{\"_ve\":\"The address of the veION contract\",\"_voter\":\"The address of the voter contract\"}},\"notifyRewardAmount(address,uint256)\":{\"params\":{\"amount\":\"Amount of the reward token to be added\",\"token\":\"Address of the reward token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardsListLength()\":{\"returns\":{\"_0\":\"The length of the rewards array\"}},\"setHistoricalPrices(uint256,address,uint256)\":{\"params\":{\"epochTimestamp\":\"The timestamp of the epoch\",\"lpToken\":\"The LP token address\",\"price\":\"The price to set\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdraw(address,uint256,uint256)\":{\"details\":\"Can only be called internally by authorized entities.\",\"params\":{\"amount\":\"Amount to be withdrawn for the veNFT\",\"lpToken\":\"Address of the liquidity pool token\",\"tokenId\":\"Unique identifier of the veNFT\"}}},\"title\":\"BribeRewards Contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DURATION()\":{\"notice\":\"Duration of the reward period in seconds\"},\"balanceOf(uint256,address)\":{\"notice\":\"Balance of LP tokens for each tokenId and reward token\"},\"checkpoints(uint256,address,uint256)\":{\"notice\":\"A record of balance checkpoints for each account, by index\"},\"deposit(address,uint256,uint256)\":{\"notice\":\"Deposit an amount into the bribe rewards contract for a specific veNFT\"},\"earned(address,uint256)\":{\"notice\":\"Calculate the rewards earned for a specific token and veNFT\"},\"getAllLpRewardTokens()\":{\"notice\":\"Gets all LP tokens that can receive rewards\"},\"getCheckpoint(uint256,address,uint256)\":{\"notice\":\"Gets a specific checkpoint for a token\"},\"getPriorBalanceIndex(uint256,address,uint256)\":{\"notice\":\"Get the prior balance index for a veNFT at a specific timestamp\"},\"getPriorSupplyIndex(uint256,address)\":{\"notice\":\"Get the prior supply index at a specific timestamp\"},\"getReward(uint256,address[])\":{\"notice\":\"This function can accept any token, regardless of its whitelisting status.\"},\"historicalPrices(address,uint256)\":{\"notice\":\"Historical prices for each reward token and epoch\"},\"initialize(address,address)\":{\"notice\":\"Initializes the BribeRewards contract with the voter and veION addresses\"},\"isReward(address)\":{\"notice\":\"Mapping to check if an address is a reward token\"},\"lastEarn(address,uint256)\":{\"notice\":\"Last earned timestamp for each reward token and tokenId\"},\"notifyRewardAmount(address,uint256)\":{\"notice\":\"Notify the contract about new rewards for stakers\"},\"numCheckpoints(uint256,address)\":{\"notice\":\"The number of checkpoints for each account\"},\"rewards(uint256)\":{\"notice\":\"List of reward tokens\"},\"rewardsListLength()\":{\"notice\":\"Returns the total number of reward tokens\"},\"setHistoricalPrices(uint256,address,uint256)\":{\"notice\":\"Sets historical prices for LP tokens at specific epochs\"},\"supplyCheckpoints(uint256,address)\":{\"notice\":\"A record of balance checkpoints for each token, by index\"},\"supplyNumCheckpoints(address)\":{\"notice\":\"The number of supply checkpoints for each token\"},\"tokenRewardsPerEpoch(address,uint256)\":{\"notice\":\"Rewards per epoch for each reward token\"},\"totalSupply(address)\":{\"notice\":\"Total supply of LP tokens for each reward token\"},\"ve()\":{\"notice\":\"Address of the veION contract\"},\"voter()\":{\"notice\":\"Address of the voter contract\"},\"withdraw(address,uint256,uint256)\":{\"notice\":\"Withdraw an amount from the bribe rewards contract for a specific veNFT\"}},\"notice\":\"This contract allows veION to benefit from bribes when voting for various markets\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/BribeRewards.sol\":\"BribeRewards\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module that helps prevent reentrant calls to a function.\\r\\n *\\r\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\r\\n * available, which can be applied to functions to make sure there are no nested\\r\\n * (reentrant) calls to them.\\r\\n *\\r\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\r\\n * `nonReentrant` may not call one another. This can be worked around by making\\r\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\r\\n * points to them.\\r\\n *\\r\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\r\\n * to protect against it, check out our blog post\\r\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\r\\n */\\r\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\r\\n // Booleans are more expensive than uint256 or any type that takes up a full\\r\\n // word because each write operation emits an extra SLOAD to first read the\\r\\n // slot's contents, replace the bits taken up by the boolean, and then write\\r\\n // back. This is the compiler's defense against contract upgrades and\\r\\n // pointer aliasing, and it cannot be disabled.\\r\\n\\r\\n // The values being non-zero value makes deployment a bit more expensive,\\r\\n // but in exchange the refund on every call to nonReentrant will be lower in\\r\\n // amount. Since refunds are capped to a percentage of the total\\r\\n // transaction's gas, it is best to keep them low in cases like this one, to\\r\\n // increase the likelihood of the full refund coming into effect.\\r\\n uint256 private constant _NOT_ENTERED = 1;\\r\\n uint256 private constant _ENTERED = 2;\\r\\n\\r\\n uint256 private _status;\\r\\n\\r\\n function __ReentrancyGuard_init() internal onlyInitializing {\\r\\n __ReentrancyGuard_init_unchained();\\r\\n }\\r\\n\\r\\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n * Calling a `nonReentrant` function from another `nonReentrant`\\r\\n * function is not supported. It is possible to prevent this from happening\\r\\n * by making the `nonReentrant` function external, and making it call a\\r\\n * `private` function that does the actual work.\\r\\n */\\r\\n modifier nonReentrant() {\\r\\n _nonReentrantBefore();\\r\\n _;\\r\\n _nonReentrantAfter();\\r\\n }\\r\\n\\r\\n function _nonReentrantBefore() private {\\r\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\r\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\r\\n\\r\\n // Any calls to nonReentrant after this point will fail\\r\\n _status = _ENTERED;\\r\\n }\\r\\n\\r\\n function _nonReentrantAfter() private {\\r\\n // By storing the original value once again, a refund is triggered (see\\r\\n // https://eips.ethereum.org/EIPS/eip-2200)\\r\\n _status = _NOT_ENTERED;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xd714b70818f7513fc0c34e4248742ac27f0cda15c44621de90872a2f1848c036\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC721Upgradeable.sol\\\";\\r\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\r\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\r\\n * {ERC721Enumerable}.\\r\\n */\\r\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n using StringsUpgradeable for uint256;\\r\\n\\r\\n // Token name\\r\\n string private _name;\\r\\n\\r\\n // Token symbol\\r\\n string private _symbol;\\r\\n\\r\\n // Mapping from token ID to owner address\\r\\n mapping(uint256 => address) private _owners;\\r\\n\\r\\n // Mapping owner address to token count\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n // Mapping from token ID to approved address\\r\\n mapping(uint256 => address) private _tokenApprovals;\\r\\n\\r\\n // Mapping from owner to operator approvals\\r\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\r\\n */\\r\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC721_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\r\\n return\\r\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\r\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\r\\n super.supportsInterface(interfaceId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-balanceOf}.\\r\\n */\\r\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\r\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\r\\n return _balances[owner];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-ownerOf}.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\r\\n address owner = _ownerOf(tokenId);\\r\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\r\\n return owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-name}.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-symbol}.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721Metadata-tokenURI}.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n string memory baseURI = _baseURI();\\r\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\r\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\r\\n * by default, can be overridden in child contracts.\\r\\n */\\r\\n function _baseURI() internal view virtual returns (string memory) {\\r\\n return \\\"\\\";\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-approve}.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) public virtual override {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\r\\n\\r\\n require(\\r\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\r\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\r\\n );\\r\\n\\r\\n _approve(to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-getApproved}.\\r\\n */\\r\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\r\\n _requireMinted(tokenId);\\r\\n\\r\\n return _tokenApprovals[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-setApprovalForAll}.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\r\\n _setApprovalForAll(_msgSender(), operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-isApprovedForAll}.\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\r\\n return _operatorApprovals[owner][operator];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-transferFrom}.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n //solhint-disable-next-line max-line-length\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n\\r\\n _transfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) public virtual override {\\r\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC721-safeTransferFrom}.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) public virtual override {\\r\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\r\\n _safeTransfer(from, to, tokenId, data);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\r\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _transfer(from, to, tokenId);\\r\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\r\\n */\\r\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\r\\n return _owners[tokenId];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `tokenId` exists.\\r\\n *\\r\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Tokens start existing when they are minted (`_mint`),\\r\\n * and stop existing when they are burned (`_burn`).\\r\\n */\\r\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\r\\n return _ownerOf(tokenId) != address(0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\r\\n _safeMint(to, tokenId, \\\"\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\r\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\r\\n */\\r\\n function _safeMint(\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) internal virtual {\\r\\n _mint(to, tokenId);\\r\\n require(\\r\\n _checkOnERC721Received(address(0), to, tokenId, data),\\r\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Mints `tokenId` and transfers it to `to`.\\r\\n *\\r\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must not exist.\\r\\n * - `to` cannot be the zero address.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _mint(address to, uint256 tokenId) internal virtual {\\r\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), to, tokenId);\\r\\n\\r\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\r\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\r\\n\\r\\n unchecked {\\r\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\r\\n // Given that tokens are minted one by one, it is impossible in practice that\\r\\n // this ever happens. Might change if we allow batch minting.\\r\\n // The ERC fails to describe this case.\\r\\n _balances[to] += 1;\\r\\n }\\r\\n\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(address(0), to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(address(0), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `tokenId`.\\r\\n * The approval is cleared when the token is burned.\\r\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _burn(uint256 tokenId) internal virtual {\\r\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n _beforeTokenTransfer(owner, address(0), tokenId);\\r\\n\\r\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\r\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\r\\n\\r\\n // Clear approvals\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\r\\n // out than the owner initially received through minting and transferring in.\\r\\n _balances[owner] -= 1;\\r\\n }\\r\\n delete _owners[tokenId];\\r\\n\\r\\n emit Transfer(owner, address(0), tokenId);\\r\\n\\r\\n _afterTokenTransfer(owner, address(0), tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` from `from` to `to`.\\r\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, tokenId);\\r\\n\\r\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\r\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\r\\n\\r\\n // Clear approvals from the previous owner\\r\\n delete _tokenApprovals[tokenId];\\r\\n\\r\\n unchecked {\\r\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\r\\n // `from`'s balance is the number of token held, which is at least one before the current\\r\\n // transfer.\\r\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\r\\n // all 2**256 token ids to be minted, which in practice is impossible.\\r\\n _balances[from] -= 1;\\r\\n _balances[to] += 1;\\r\\n }\\r\\n _owners[tokenId] = to;\\r\\n\\r\\n emit Transfer(from, to, tokenId);\\r\\n\\r\\n _afterTokenTransfer(from, to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `to` to operate on `tokenId`\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function _approve(address to, uint256 tokenId) internal virtual {\\r\\n _tokenApprovals[tokenId] = to;\\r\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Approve `operator` to operate on all of `owner` tokens\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function _setApprovalForAll(\\r\\n address owner,\\r\\n address operator,\\r\\n bool approved\\r\\n ) internal virtual {\\r\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\r\\n _operatorApprovals[owner][operator] = approved;\\r\\n emit ApprovalForAll(owner, operator, approved);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Reverts if the `tokenId` has not been minted yet.\\r\\n */\\r\\n function _requireMinted(uint256 tokenId) internal view virtual {\\r\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\r\\n * The call is not executed if the target address is not a contract.\\r\\n *\\r\\n * @param from address representing the previous owner of the given token ID\\r\\n * @param to target address that will receive the tokens\\r\\n * @param tokenId uint256 ID of the token to be transferred\\r\\n * @param data bytes optional data to send along with the call\\r\\n * @return bool whether the call correctly returned the expected magic value\\r\\n */\\r\\n function _checkOnERC721Received(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes memory data\\r\\n ) private returns (bool) {\\r\\n if (to.isContract()) {\\r\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\r\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\r\\n } catch (bytes memory reason) {\\r\\n if (reason.length == 0) {\\r\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\r\\n } else {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n revert(add(32, reason), mload(reason))\\r\\n }\\r\\n }\\r\\n }\\r\\n } else {\\r\\n return true;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\\r\\n * See {_beforeConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\r\\n * transferred to `to`.\\r\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\r\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\\r\\n * See {_afterConsecutiveTokenTransfer}.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_beforeTokenTransfer}.\\r\\n */\\r\\n function _beforeConsecutiveTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256, /*first*/\\r\\n uint96 size\\r\\n ) internal virtual {\\r\\n if (from != address(0)) {\\r\\n _balances[from] -= size;\\r\\n }\\r\\n if (to != address(0)) {\\r\\n _balances[to] += size;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after \\\"consecutive token transfers\\\" as defined in ERC2309 and implemented in\\r\\n * {ERC721Consecutive}.\\r\\n * Calling conditions are similar to {_afterTokenTransfer}.\\r\\n */\\r\\n function _afterConsecutiveTokenTransfer(\\r\\n address, /*from*/\\r\\n address, /*to*/\\r\\n uint256, /*first*/\\r\\n uint96 /*size*/\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[44] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x8fa55fe262246cd5c68823bda0e2f30503417458aed446c65bcefa347e6ed423\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC721 token receiver interface\\r\\n * @dev Interface for any contract that wants to support safeTransfers\\r\\n * from ERC721 asset contracts.\\r\\n */\\r\\ninterface IERC721ReceiverUpgradeable {\\r\\n /**\\r\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\r\\n * by `operator` from `from`, this function is called.\\r\\n *\\r\\n * It must return its Solidity selector to confirm the token transfer.\\r\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\r\\n *\\r\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\r\\n */\\r\\n function onERC721Received(\\r\\n address operator,\\r\\n address from,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external returns (bytes4);\\r\\n}\\r\\n\",\"keccak256\":\"0xcad00cdc85bd1718e26dc693cf50fefe6c3bd2ca51c95f3ef13cc6d04be4928b\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Required interface of an ERC721 compliant contract.\\r\\n */\\r\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\r\\n */\\r\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of tokens in ``owner``'s account.\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @dev Returns the owner of the `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\r\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must exist and be owned by `from`.\\r\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\r\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function safeTransferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Transfers `tokenId` token from `from` to `to`.\\r\\n *\\r\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\r\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\r\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `tokenId` token must be owned by `from`.\\r\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 tokenId\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\r\\n * The approval is cleared when the token is transferred.\\r\\n *\\r\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The caller must own the token or be an approved operator.\\r\\n * - `tokenId` must exist.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address to, uint256 tokenId) external;\\r\\n\\r\\n /**\\r\\n * @dev Approve or remove `operator` as an operator for the caller.\\r\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - The `operator` cannot be the caller.\\r\\n *\\r\\n * Emits an {ApprovalForAll} event.\\r\\n */\\r\\n function setApprovalForAll(address operator, bool _approved) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the account approved for `tokenId` token.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `tokenId` must exist.\\r\\n */\\r\\n function getApproved(uint256 tokenId) external view returns (address operator);\\r\\n\\r\\n /**\\r\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\r\\n *\\r\\n * See {setApprovalForAll}\\r\\n */\\r\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x6adefd9cd927dc57cd2da9550681d51dad15a91d4d254075588cf3e9503e6c99\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\r\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\r\\n */\\r\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\r\\n /**\\r\\n * @dev Returns the token collection name.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the token collection symbol.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\r\\n */\\r\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x8ba9a190699be6b3e5f965fe650bf0ac8bd01ed4d7b394411c6e50b98dcaaa90\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./math/MathUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev String operations.\\r\\n */\\r\\nlibrary StringsUpgradeable {\\r\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\r\\n uint8 private constant _ADDRESS_LENGTH = 20;\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\r\\n */\\r\\n function toString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n uint256 length = MathUpgradeable.log10(value) + 1;\\r\\n string memory buffer = new string(length);\\r\\n uint256 ptr;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n ptr := add(buffer, add(32, length))\\r\\n }\\r\\n while (true) {\\r\\n ptr--;\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\r\\n }\\r\\n value /= 10;\\r\\n if (value == 0) break;\\r\\n }\\r\\n return buffer;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(uint256 value) internal pure returns (string memory) {\\r\\n unchecked {\\r\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\r\\n */\\r\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\r\\n bytes memory buffer = new bytes(2 * length + 2);\\r\\n buffer[0] = \\\"0\\\";\\r\\n buffer[1] = \\\"x\\\";\\r\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\r\\n buffer[i] = _SYMBOLS[value & 0xf];\\r\\n value >>= 4;\\r\\n }\\r\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\r\\n return string(buffer);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\r\\n */\\r\\n function toHexString(address addr) internal pure returns (string memory) {\\r\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6a607b1dc1f0ff724ad56ff94293ec5c374e27f35f26ae5e29210edaf046b4c6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC165Upgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC165} interface.\\r\\n *\\r\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\r\\n * for the additional interface id that will be supported. For example:\\r\\n *\\r\\n * ```solidity\\r\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\r\\n */\\r\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\r\\n function __ERC165_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __ERC165_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n /**\\r\\n * @dev See {IERC165-supportsInterface}.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\r\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x33686001615c14053a34d85fa60f5495c6461d457abfa93276feaf1ad4582039\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC165 standard, as defined in the\\r\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\r\\n *\\r\\n * Implementers can declare support of contract interfaces, which can then be\\r\\n * queried by others ({ERC165Checker}).\\r\\n *\\r\\n * For an implementation, see {ERC165}.\\r\\n */\\r\\ninterface IERC165Upgradeable {\\r\\n /**\\r\\n * @dev Returns true if this contract implements the interface defined by\\r\\n * `interfaceId`. See the corresponding\\r\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\r\\n * to learn more about how these ids are created.\\r\\n *\\r\\n * This function call must use less than 30 000 gas.\\r\\n */\\r\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xa3a86fd8399ff01763901b64ed4603d979787747d7b83f70d6d3c7d4f6b79214\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary MathUpgradeable {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x75646aade069b63a3ebf8535f49dce3ac575d1e367f031cf1f7b3d8a748e0756\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Standard math utilities missing in the Solidity language.\\r\\n */\\r\\nlibrary Math {\\r\\n enum Rounding {\\r\\n Down, // Toward negative infinity\\r\\n Up, // Toward infinity\\r\\n Zero // Toward zero\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the largest of two numbers.\\r\\n */\\r\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a > b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the smallest of two numbers.\\r\\n */\\r\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return a < b ? a : b;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the average of two numbers. The result is rounded towards\\r\\n * zero.\\r\\n */\\r\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b) / 2 can overflow.\\r\\n return (a & b) + (a ^ b) / 2;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the ceiling of the division of two numbers.\\r\\n *\\r\\n * This differs from standard division with `/` in that it rounds up instead\\r\\n * of rounding down.\\r\\n */\\r\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\r\\n return a == 0 ? 0 : (a - 1) / b + 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\r\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\r\\n * with further edits by Uniswap Labs also under MIT license.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator\\r\\n ) internal pure returns (uint256 result) {\\r\\n unchecked {\\r\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\r\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\r\\n // variables such that product = prod1 * 2^256 + prod0.\\r\\n uint256 prod0; // Least significant 256 bits of the product\\r\\n uint256 prod1; // Most significant 256 bits of the product\\r\\n assembly {\\r\\n let mm := mulmod(x, y, not(0))\\r\\n prod0 := mul(x, y)\\r\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\r\\n }\\r\\n\\r\\n // Handle non-overflow cases, 256 by 256 division.\\r\\n if (prod1 == 0) {\\r\\n return prod0 / denominator;\\r\\n }\\r\\n\\r\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\r\\n require(denominator > prod1);\\r\\n\\r\\n ///////////////////////////////////////////////\\r\\n // 512 by 256 division.\\r\\n ///////////////////////////////////////////////\\r\\n\\r\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\r\\n uint256 remainder;\\r\\n assembly {\\r\\n // Compute remainder using mulmod.\\r\\n remainder := mulmod(x, y, denominator)\\r\\n\\r\\n // Subtract 256 bit number from 512 bit number.\\r\\n prod1 := sub(prod1, gt(remainder, prod0))\\r\\n prod0 := sub(prod0, remainder)\\r\\n }\\r\\n\\r\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\r\\n // See https://cs.stackexchange.com/q/138556/92363.\\r\\n\\r\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\r\\n uint256 twos = denominator & (~denominator + 1);\\r\\n assembly {\\r\\n // Divide denominator by twos.\\r\\n denominator := div(denominator, twos)\\r\\n\\r\\n // Divide [prod1 prod0] by twos.\\r\\n prod0 := div(prod0, twos)\\r\\n\\r\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\r\\n twos := add(div(sub(0, twos), twos), 1)\\r\\n }\\r\\n\\r\\n // Shift in bits from prod1 into prod0.\\r\\n prod0 |= prod1 * twos;\\r\\n\\r\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\r\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\r\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\r\\n uint256 inverse = (3 * denominator) ^ 2;\\r\\n\\r\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\r\\n // in modular arithmetic, doubling the correct bits in each step.\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\r\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\r\\n\\r\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\r\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\r\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\r\\n // is no longer required.\\r\\n result = prod0 * inverse;\\r\\n return result;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\r\\n */\\r\\n function mulDiv(\\r\\n uint256 x,\\r\\n uint256 y,\\r\\n uint256 denominator,\\r\\n Rounding rounding\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 result = mulDiv(x, y, denominator);\\r\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\r\\n result += 1;\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\r\\n *\\r\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\r\\n */\\r\\n function sqrt(uint256 a) internal pure returns (uint256) {\\r\\n if (a == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\r\\n //\\r\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\r\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\r\\n //\\r\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\r\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\r\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\r\\n //\\r\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\r\\n uint256 result = 1 << (log2(a) >> 1);\\r\\n\\r\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\r\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\r\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\r\\n // into the expected uint128 result.\\r\\n unchecked {\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n result = (result + a / result) >> 1;\\r\\n return min(result, a / result);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\r\\n */\\r\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = sqrt(a);\\r\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 128;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n value >>= 8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 4 > 0) {\\r\\n value >>= 4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 2 > 0) {\\r\\n value >>= 2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 1 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log2(value);\\r\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >= 10**64) {\\r\\n value /= 10**64;\\r\\n result += 64;\\r\\n }\\r\\n if (value >= 10**32) {\\r\\n value /= 10**32;\\r\\n result += 32;\\r\\n }\\r\\n if (value >= 10**16) {\\r\\n value /= 10**16;\\r\\n result += 16;\\r\\n }\\r\\n if (value >= 10**8) {\\r\\n value /= 10**8;\\r\\n result += 8;\\r\\n }\\r\\n if (value >= 10**4) {\\r\\n value /= 10**4;\\r\\n result += 4;\\r\\n }\\r\\n if (value >= 10**2) {\\r\\n value /= 10**2;\\r\\n result += 2;\\r\\n }\\r\\n if (value >= 10**1) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log10(value);\\r\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 256, rounded down, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n *\\r\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\r\\n */\\r\\n function log256(uint256 value) internal pure returns (uint256) {\\r\\n uint256 result = 0;\\r\\n unchecked {\\r\\n if (value >> 128 > 0) {\\r\\n value >>= 128;\\r\\n result += 16;\\r\\n }\\r\\n if (value >> 64 > 0) {\\r\\n value >>= 64;\\r\\n result += 8;\\r\\n }\\r\\n if (value >> 32 > 0) {\\r\\n value >>= 32;\\r\\n result += 4;\\r\\n }\\r\\n if (value >> 16 > 0) {\\r\\n value >>= 16;\\r\\n result += 2;\\r\\n }\\r\\n if (value >> 8 > 0) {\\r\\n result += 1;\\r\\n }\\r\\n }\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\r\\n * Returns 0 if given 0.\\r\\n */\\r\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n uint256 result = log256(value);\\r\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x0f1ee6a346d1d174ada2074c0e1edd7db7da4c872df37a46e2f6296011f9a8ce\",\"license\":\"MIT\"},\"contracts/veION/BribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\r\\nimport { IBribeRewards } from \\\"./interfaces/IBribeRewards.sol\\\";\\r\\nimport { IVoter } from \\\"./interfaces/IVoter.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IonicTimeLibrary } from \\\"./libraries/IonicTimeLibrary.sol\\\";\\r\\nimport { ERC721Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BribeRewards Contract\\r\\n * @notice This contract allows veION to benefit from bribes when voting for various markets\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 State Variables \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Duration of the reward period in seconds\\r\\n uint256 public constant DURATION = 7 days;\\r\\n /// @notice Address of the voter contract\\r\\n address public voter;\\r\\n /// @notice Address of the veION contract\\r\\n address public ve;\\r\\n /// @notice List of reward tokens\\r\\n address[] public rewards;\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Mappings \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n /// @notice Mapping to check if an address is a reward token\\r\\n mapping(address => bool) public isReward;\\r\\n /// @notice Total supply of LP tokens for each reward token\\r\\n mapping(address => uint256) public totalSupply;\\r\\n /// @notice Balance of LP tokens for each tokenId and reward token\\r\\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\\r\\n /// @notice Rewards per epoch for each reward token\\r\\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\\r\\n /// @notice Last earned timestamp for each reward token and tokenId\\r\\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\\r\\n /// @notice A record of balance checkpoints for each account, by index\\r\\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\\r\\n /// @notice The number of checkpoints for each account\\r\\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\\r\\n /// @notice A record of balance checkpoints for each token, by index\\r\\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\\r\\n /// @notice The number of supply checkpoints for each token\\r\\n mapping(address => uint256) public supplyNumCheckpoints;\\r\\n /// @notice Historical prices for each reward token and epoch\\r\\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\\r\\n\\r\\n /**\\r\\n * @notice Modifier to restrict access to only the voter contract\\r\\n * @dev Ensures that the caller is the voter contract\\r\\n */\\r\\n modifier onlyVoter() {\\r\\n require(msg.sender == voter, \\\"Caller is not the voter\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\\r\\n * @dev This function is called only once during contract deployment\\r\\n * @param _voter The address of the voter contract\\r\\n * @param _ve The address of the veION contract\\r\\n */\\r\\n function initialize(address _voter, address _ve) public initializer {\\r\\n __ReentrancyGuard_init();\\r\\n __Ownable2Step_init();\\r\\n voter = _voter;\\r\\n ve = _ve;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 External Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] += amount;\\r\\n balanceOf[tokenId][lpToken] += amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Deposit(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\\r\\n address sender = msg.sender;\\r\\n\\r\\n totalSupply[lpToken] -= amount;\\r\\n balanceOf[tokenId][lpToken] -= amount;\\r\\n\\r\\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\\r\\n _writeSupplyCheckpoint(lpToken);\\r\\n\\r\\n emit Withdraw(sender, tokenId, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @inheritdoc IBribeRewards\\r\\n * @notice This function can accept any token, regardless of its whitelisting status.\\r\\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\\r\\n */\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\\r\\n address sender = msg.sender;\\r\\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\\r\\n\\r\\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\\r\\n _getReward(_owner, tokenId, tokens);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\\r\\n address sender = msg.sender;\\r\\n\\r\\n if (!isReward[token]) {\\r\\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\\r\\n isReward[token] = true;\\r\\n rewards.push(token);\\r\\n }\\r\\n\\r\\n _notifyRewardAmount(sender, token, amount);\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Internal Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @dev used with all getReward implementations\\r\\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\\r\\n // check if token whitelisted\\r\\n uint256 _length = tokens.length;\\r\\n for (uint256 i = 0; i < _length; i++) {\\r\\n uint256 _reward = earned(tokens[i], tokenId);\\r\\n lastEarn[tokens[i]][tokenId] = block.timestamp;\\r\\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\\r\\n\\r\\n emit RewardsClaimed(recipient, tokens[i], _reward);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Writes a new checkpoint for a token's balance\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param balance The balance to record\\r\\n */\\r\\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\\r\\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\\r\\n } else {\\r\\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\\r\\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @notice Writes a new checkpoint for total supply\\r\\n /// @param lpToken The LP token address\\r\\n function _writeSupplyCheckpoint(address lpToken) internal {\\r\\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\\r\\n uint256 _timestamp = block.timestamp;\\r\\n\\r\\n if (\\r\\n _nCheckPoints > 0 &&\\r\\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\\r\\n IonicTimeLibrary.epochStart(_timestamp)\\r\\n ) {\\r\\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n } else {\\r\\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\\r\\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev used within all notifyRewardAmount implementations\\r\\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\\r\\n if (amount == 0) revert AmountCannotBeZero();\\r\\n IERC20(token).safeTransferFrom(sender, address(this), amount);\\r\\n\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\\r\\n tokenRewardsPerEpoch[token][epochStart] += amount;\\r\\n\\r\\n emit RewardNotification(sender, token, epochStart, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculates the ETH value of a token amount at a specific epoch\\r\\n * @param amount The amount of tokens\\r\\n * @param lpToken The LP token address\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @return The ETH value of the tokens\\r\\n */\\r\\n function _getTokenEthValueAt(\\r\\n uint256 amount,\\r\\n address lpToken,\\r\\n uint256 epochTimestamp\\r\\n ) internal view returns (uint256) {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\\r\\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\\r\\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\\r\\n return ethValue;\\r\\n }\\r\\n\\r\\n // \\u2554\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2557\\r\\n // \\u2551 Pure/View Functions \\u2551\\r\\n // \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\r\\n\\r\\n /// @notice Returns the total number of reward tokens\\r\\n /// @return The length of the rewards array\\r\\n function rewardsListLength() external view returns (uint256) {\\r\\n return rewards.length;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function earned(address token, uint256 tokenId) public view returns (uint256) {\\r\\n EarnedVars memory vars;\\r\\n vars.totalReward = 0;\\r\\n address[] memory lpTokens = getAllLpRewardTokens();\\r\\n uint256 lpTokensLength = lpTokens.length;\\r\\n for (uint256 j = 0; j < lpTokensLength; j++) {\\r\\n address lpToken = lpTokens[j];\\r\\n\\r\\n if (numCheckpoints[tokenId][lpToken] == 0) {\\r\\n continue;\\r\\n }\\r\\n\\r\\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\\r\\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n\\r\\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\\r\\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\\r\\n\\r\\n if (vars.numEpochs > 0) {\\r\\n for (uint256 i = 0; i < vars.numEpochs; i++) {\\r\\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\\r\\n cp0 = checkpoints[tokenId][lpToken][vars.index];\\r\\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\\r\\n\\r\\n vars.supplyValue = 0;\\r\\n for (uint256 k = 0; k < lpTokensLength; k++) {\\r\\n address currentLpToken = lpTokens[k];\\r\\n uint256 supplyAmount = Math.max(\\r\\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\\r\\n 1\\r\\n );\\r\\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\\r\\n }\\r\\n if (vars.supplyValue > 0) {\\r\\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\\r\\n }\\r\\n vars.currTs += DURATION;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return vars.totalReward;\\r\\n }\\r\\n\\r\\n /// @notice Gets all LP tokens that can receive rewards\\r\\n /// @return Array of LP token addresses\\r\\n function getAllLpRewardTokens() public view returns (address[] memory) {\\r\\n return IVoter(voter).getAllLpRewardTokens();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets historical prices for LP tokens at specific epochs\\r\\n * @param epochTimestamp The timestamp of the epoch\\r\\n * @param lpToken The LP token address\\r\\n * @param price The price to set\\r\\n */\\r\\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\\r\\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\\r\\n historicalPrices[lpToken][epochStart] = price;\\r\\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets a specific checkpoint for a token\\r\\n * @param tokenId The ID of the veION token\\r\\n * @param lpToken The LP token address\\r\\n * @param index The index of the checkpoint to retrieve\\r\\n * @return The checkpoint data\\r\\n */\\r\\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\\r\\n return checkpoints[tokenId][lpToken][index];\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\\r\\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IBribeRewards\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\\r\\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\\r\\n if (nCheckpoints == 0) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n // First check most recent balance\\r\\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\\r\\n return (nCheckpoints - 1);\\r\\n }\\r\\n\\r\\n // Next check implicit zero balance\\r\\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\\r\\n return 0;\\r\\n }\\r\\n\\r\\n uint256 lower = 0;\\r\\n uint256 upper = nCheckpoints - 1;\\r\\n while (upper > lower) {\\r\\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\\r\\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\\r\\n if (cp.timestamp == timestamp) {\\r\\n return center;\\r\\n } else if (cp.timestamp < timestamp) {\\r\\n lower = center;\\r\\n } else {\\r\\n upper = center - 1;\\r\\n }\\r\\n }\\r\\n return lower;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb6262c850b053665690a9d889a9fbad7dc35279596ab094b80a41b7955c99bae\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IVoter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IVoter\\r\\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\\r\\n */\\r\\ninterface IVoter {\\r\\n /// @notice Error thrown when a user has already voted or deposited.\\r\\n error AlreadyVotedOrDeposited();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error DistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\\r\\n error RewardAccumulatorDoesNotExist(address _pool);\\r\\n\\r\\n /// @notice Error thrown when a reward accumulator is not alive.\\r\\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\\r\\n\\r\\n /// @notice Error thrown when a market already exists.\\r\\n error MarketAlreadyExists();\\r\\n\\r\\n /// @notice Error thrown when the maximum voting number is too low.\\r\\n error MaximumVotingNumberTooLow();\\r\\n\\r\\n /// @notice Error thrown when array lengths do not match.\\r\\n error MismatchedArrayLengths();\\r\\n\\r\\n /// @notice Error thrown when there are non-zero votes.\\r\\n error NonZeroVotes();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the owner.\\r\\n error NotOwner();\\r\\n\\r\\n /// @notice Error thrown when an action is attempted outside the distribution window.\\r\\n error NotDistributeWindow();\\r\\n\\r\\n /// @notice Error thrown when the caller is not the governor.\\r\\n error NotGovernor();\\r\\n\\r\\n /// @notice Error thrown when an NFT is not whitelisted.\\r\\n error NotWhitelistedNFT();\\r\\n\\r\\n /// @notice Error thrown when the same value is provided.\\r\\n error SameValue();\\r\\n\\r\\n /// @notice Error thrown when there are too many pools.\\r\\n error TooManyPools();\\r\\n\\r\\n /// @notice Error thrown when array lengths are unequal.\\r\\n error UnequalLengths();\\r\\n\\r\\n /// @notice Error thrown when an address is zero.\\r\\n error ZeroAddress();\\r\\n\\r\\n /// @notice Error thrown when the tokens array is empty.\\r\\n error TokensArrayEmpty();\\r\\n\\r\\n /// @notice Error thrown when the weight is zero.\\r\\n error ZeroWeight();\\r\\n\\r\\n /**\\r\\n * @notice Struct to store vote details.\\r\\n * @param marketVotes Array of market addresses voted for.\\r\\n * @param marketVoteSides Array of market sides voted for.\\r\\n * @param votes Array of vote weights.\\r\\n * @param usedWeight Total weight used in voting.\\r\\n */\\r\\n struct VoteDetails {\\r\\n address[] marketVotes;\\r\\n MarketSide[] marketVoteSides;\\r\\n uint256[] votes;\\r\\n uint256 usedWeight;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store market information.\\r\\n * @param marketAddress Address of the market.\\r\\n * @param side Side of the market (Supply or Borrow).\\r\\n */\\r\\n struct Market {\\r\\n address marketAddress;\\r\\n MarketSide side;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store variables used in voting.\\r\\n * @param totalWeight Total weight available for voting.\\r\\n * @param usedWeight Weight used in voting.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param rewardAccumulator Address of the reward accumulator.\\r\\n * @param marketWeight Weight of the market.\\r\\n * @param bribes Address of the bribes.\\r\\n */\\r\\n struct VoteVars {\\r\\n uint256 totalWeight;\\r\\n uint256 usedWeight;\\r\\n address market;\\r\\n MarketSide marketSide;\\r\\n address rewardAccumulator;\\r\\n uint256 marketWeight;\\r\\n address bribes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Struct to store local variables used in voting.\\r\\n * @param sender Address of the sender.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n * @param votingLPs Array of voting LP addresses.\\r\\n * @param votingLPBalances Array of voting LP balances.\\r\\n * @param boosts Array of boosts.\\r\\n */\\r\\n struct VoteLocalVars {\\r\\n address sender;\\r\\n uint256 timestamp;\\r\\n address[] votingLPs;\\r\\n uint256[] votingLPBalances;\\r\\n uint256[] boosts;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Enum to represent the side of a market.\\r\\n */\\r\\n enum MarketSide {\\r\\n Supply,\\r\\n Borrow\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is cast.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Voted(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a vote is abstained.\\r\\n * @param voter Address of the voter.\\r\\n * @param pool Address of the pool.\\r\\n * @param tokenId ID of the token.\\r\\n * @param weight Weight of the vote.\\r\\n * @param totalWeight Total weight of the vote.\\r\\n * @param timestamp Timestamp of the vote.\\r\\n */\\r\\n event Abstained(\\r\\n address indexed voter,\\r\\n address indexed pool,\\r\\n uint256 indexed tokenId,\\r\\n uint256 weight,\\r\\n uint256 totalWeight,\\r\\n uint256 timestamp\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a reward is notified.\\r\\n * @param sender Address of the sender.\\r\\n * @param reward Address of the reward.\\r\\n * @param amount Amount of the reward.\\r\\n */\\r\\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a token is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when an NFT is whitelisted.\\r\\n * @param whitelister Address of the whitelister.\\r\\n * @param tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\\r\\n\\r\\n event LpTokensSet(address[] indexed lpTokens);\\r\\n event MpoSet(address indexed mpo);\\r\\n event GovernorSet(address indexed governor);\\r\\n event MarketsAdded(Market[] markets);\\r\\n event MarketRewardAccumulatorsSet(\\r\\n address[] indexed markets,\\r\\n MarketSide[] indexed marketSides,\\r\\n address[] indexed rewardAccumulators\\r\\n );\\r\\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\\r\\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\\r\\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\\r\\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\\r\\n\\r\\n /**\\r\\n * @notice Get the weight of a market.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The weight of the market.\\r\\n */\\r\\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the votes for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param market Address of the market.\\r\\n * @param marketSide Side of the market.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The votes for the token.\\r\\n */\\r\\n function votes(\\r\\n uint256 tokenId,\\r\\n address market,\\r\\n MarketSide marketSide,\\r\\n address lpToken\\r\\n ) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the used weights for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @param lpToken Address of the LP token.\\r\\n * @return The used weights for the token.\\r\\n */\\r\\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the last voted timestamp for a token.\\r\\n * @param tokenId ID of the token.\\r\\n * @return The last voted timestamp for the token.\\r\\n */\\r\\n function lastVoted(uint256 tokenId) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Check if a token is whitelisted.\\r\\n * @param token Address of the token.\\r\\n * @return True if the token is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedToken(address token) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Check if an NFT is whitelisted.\\r\\n * @param tokenId ID of the token.\\r\\n * @return True if the NFT is whitelisted, false otherwise.\\r\\n */\\r\\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the ve contract.\\r\\n * @return The address of the ve contract.\\r\\n */\\r\\n function ve() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Get the address of the governor.\\r\\n * @return The address of the governor.\\r\\n */\\r\\n function governor() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Update voting balances in voting rewards contracts.\\r\\n * @param _tokenId ID of veNFT whose balance you wish to update.\\r\\n */\\r\\n function poke(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Vote for pools. Votes distributed proportionally based on weights.\\r\\n * @dev Can only vote or deposit into a managed NFT once per epoch.\\r\\n * Can only vote for gauges that have not been killed.\\r\\n * Throws if length of _poolVote and _weights do not match.\\r\\n * @param _tokenId ID of veNFT you are voting with.\\r\\n * @param _poolVote Array of pools you are voting for.\\r\\n * @param _marketVoteSide Array of market vote sides you are voting for.\\r\\n * @param _weights Weights of pools.\\r\\n */\\r\\n function vote(\\r\\n uint256 _tokenId,\\r\\n address[] calldata _poolVote,\\r\\n MarketSide[] calldata _marketVoteSide,\\r\\n uint256[] calldata _weights\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\\r\\n * @dev Cannot reset in the same epoch that you voted in.\\r\\n * Can vote or deposit into a managed NFT again after reset.\\r\\n * @param _tokenId ID of veNFT that you are resetting.\\r\\n */\\r\\n function reset(uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Distributes rewards to eligible markets.\\r\\n */\\r\\n function distributeRewards() external;\\r\\n\\r\\n /**\\r\\n * @notice Claim bribes for a given NFT.\\r\\n * @dev Utility to help batch bribe claims.\\r\\n * @param _bribes Array of BribeVotingReward contracts to collect from.\\r\\n * @param _tokens Array of tokens that are used as bribes.\\r\\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\\r\\n */\\r\\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token for use in bribes.\\r\\n * @dev Throws if not called by governor.\\r\\n * @param _token Address of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistToken(address _token, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\\r\\n * @dev Throws if not called by governor.\\r\\n * Throws if already whitelisted.\\r\\n * @param _tokenId ID of the token.\\r\\n * @param _bool Boolean indicating whitelist status.\\r\\n */\\r\\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the LP tokens.\\r\\n * @param _lpTokens Array of LP token addresses.\\r\\n */\\r\\n function setLpTokens(address[] memory _lpTokens) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the Master Price Oracle (MPO) address.\\r\\n * @param _mpo Address of the Master Price Oracle.\\r\\n */\\r\\n function setMpo(address _mpo) external;\\r\\n\\r\\n /**\\r\\n * @notice Set a new governor.\\r\\n * @param _governor Address of the new governor.\\r\\n */\\r\\n function setGovernor(address _governor) external;\\r\\n\\r\\n /**\\r\\n * @notice Add new markets.\\r\\n * @param _markets Array of Market structs to be added.\\r\\n */\\r\\n function addMarkets(Market[] calldata _markets) external;\\r\\n\\r\\n /**\\r\\n * @notice Set reward accumulators for markets.\\r\\n * @param _markets Array of market addresses.\\r\\n * @param _marketSides Array of market sides.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n */\\r\\n function setMarketRewardAccumulators(\\r\\n address[] calldata _markets,\\r\\n MarketSide[] calldata _marketSides,\\r\\n address[] calldata _rewardAccumulators\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @notice Set bribes for reward accumulators.\\r\\n * @param _rewardAccumulators Array of reward accumulator addresses.\\r\\n * @param _bribes Array of bribe addresses.\\r\\n */\\r\\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\\r\\n\\r\\n /**\\r\\n * @notice Set the maximum number of votes.\\r\\n * @param _maxVotingNum Maximum number of votes allowed.\\r\\n */\\r\\n function setMaxVotingNum(uint256 _maxVotingNum) external;\\r\\n\\r\\n /**\\r\\n * @notice Toggle the alive status of a reward accumulator.\\r\\n * @param _market Address of the market.\\r\\n * @param _marketSide Side of the market.\\r\\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\\r\\n */\\r\\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the epoch start for.\\r\\n * @return The start of the epoch.\\r\\n */\\r\\n function epochStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the next epoch for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the next epoch for.\\r\\n * @return The next epoch.\\r\\n */\\r\\n function epochNext(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the start of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting start for.\\r\\n * @return The start of the voting period.\\r\\n */\\r\\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the end of the voting period for a given timestamp.\\r\\n * @param _timestamp The timestamp to calculate the voting end for.\\r\\n * @return The end of the voting period.\\r\\n */\\r\\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the number of markets.\\r\\n * @return The number of markets.\\r\\n */\\r\\n function marketsLength() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get all LP reward tokens.\\r\\n * @return An array of addresses representing all LP reward tokens.\\r\\n */\\r\\n function getAllLpRewardTokens() external view returns (address[] memory);\\r\\n\\r\\n /**\\r\\n * @notice Get vote details for a specific token ID and LP asset.\\r\\n * @param _tokenId The ID of the token.\\r\\n * @param _lpAsset The address of the LP asset.\\r\\n * @return A struct containing vote details.\\r\\n */\\r\\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\\r\\n}\\r\\n\",\"keccak256\":\"0xdc61ea567a04ef73efb279313e914aea054d643cf9e665706676d99b1fe8e448\",\"license\":\"UNLICENSED\"},\"contracts/veION/libraries/IonicTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nlibrary IonicTimeLibrary {\\r\\n uint256 internal constant _WEEK = 7 days;\\r\\n\\r\\n /// @dev Returns start of epoch based on current timestamp\\r\\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK);\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of next epoch / end of current epoch\\r\\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns start of voting window\\r\\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + 1 hours;\\r\\n }\\r\\n }\\r\\n\\r\\n /// @dev Returns end of voting window / beginning of unrestricted voting window\\r\\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\\r\\n unchecked {\\r\\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa46de2e4b8f98426a594ff95b16b15d52375c4ade8eabfb82f7bd3d8ad416d7c\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6123ee80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638760e6221161010f578063e30c3978116100a2578063f25e55a511610071578063f25e55a5146104fa578063f2fde38b14610525578063f301af4214610538578063f5f8d3651461054b57600080fd5b8063e30c3978146104ae578063e4dc2aa4146104bf578063e6886396146104df578063eac74562146104e757600080fd5b8063b5c5f672116100de578063b5c5f6721461044a578063b66503cf1461045d578063d2980eb014610470578063d82ada501461048357600080fd5b80638760e622146103a85780638da5cb5b146103d657806392777b29146103e75780639a8c3e911461041257600080fd5b806346c96aac1161018757806357b353251161015657806357b353251461033c5780636e13fffe14610383578063715018a61461039857806379ba5097146103a057600080fd5b806346c96aac146102c3578063485cc955146102d65780634d5ce038146102e9578063524bafc81461031c57600080fd5b80631be05289116101c35780631be05289146102505780631f8507161461025a5780633656eec2146102855780633e491d47146102b057600080fd5b80630efe6a8b146101ea5780631056dfe8146101ff57806315b42e5e14610212575b600080fd5b6101fd6101f8366004611eda565b61055e565b005b6101fd61020d366004611f0f565b61067a565b61023d610220366004611f47565b60d560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61023d62093a8081565b60ca5461026d906001600160a01b031681565b6040516001600160a01b039091168152602001610247565b61023d610293366004611f73565b60ce60209081526000928352604080842090915290825290205481565b61023d6102be366004611f47565b6106e3565b60c95461026d906001600160a01b031681565b6101fd6102e4366004611fa3565b610a7d565b61030c6102f7366004611fd1565b60cc6020526000908152604090205460ff1681565b6040519015158152602001610247565b61023d61032a366004611fd1565b60d46020526000908152604090205481565b61036e61034a366004611f73565b60d36020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610247565b61038b610bc8565b6040516102479190611fee565b6101fd610c3f565b6101fd610c53565b6103bb6103b6366004611f0f565b610ccd565b60408051825181526020928301519281019290925201610247565b6065546001600160a01b031661026d565b61023d6103f5366004611f47565b60cf60209081526000928352604080842090915290825290205481565b61036e610420366004611f0f565b60d16020908152600093845260408085208252928452828420905282529020805460019091015482565b6101fd610458366004611eda565b610d22565b6101fd61046b366004611f47565b610e27565b61023d61047e366004611f73565b610f5b565b61023d610491366004611f73565b60d260209081526000928352604080842090915290825290205481565b6097546001600160a01b031661026d565b61023d6104cd366004611fd1565b60cd6020526000908152604090205481565b60cb5461023d565b61023d6104f5366004611f0f565b6110db565b61023d610508366004611f47565b60d060209081526000928352604080842090915290825290205481565b6101fd610533366004611fd1565b61126b565b61026d61054636600461203b565b6112dc565b6101fd6105593660046120bf565b611306565b60c9546001600160a01b031633146105915760405162461bcd60e51b81526004016105889061216a565b60405180910390fd5b6001600160a01b038316600090815260cd60205260408120805433928592916105bb9084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152812080548592906105f29084906121b7565b9091555050600082815260ce602090815260408083206001600160a01b03881684529091529020546106279083908690611471565b610630846115da565b81816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161066c91815260200190565b60405180910390a350505050565b610682611738565b6001600160a01b038216600081815260d56020908152604080832062093a8088068803808552908352928190208590555184815291929186917ff62974ed7e8fa605d2bf41382cae245ff3153382d14e491a73ecdcede5da58e6910161066c565b600061073b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000808252610748610bc8565b805190915060005b81811015610a6f57600083828151811061076c5761076c6121ca565b602090810291909101810151600089815260d2835260408082206001600160a01b03841683529093529182205490925090036107a85750610a67565b6001600160a01b038816600090815260d0602090815260408083208a845290915290205462093a8081069003608086018190526107e890889083906110db565b60a08601908152600088815260d1602090815260408083206001600160a01b0386168452825280832093518352928152908290208251808401909352805480845260019091015491830191909152608087015161084c9162093a8081069003611792565b6080870181905262093a8090610867904283810690036121e0565b61087191906121f3565b60c0870181905215610a645760005b8660c00151811015610a62576108b08984600162093a808b608001516108a691906121b7565b6104f591906121e0565b60a0880190815260008a815260d1602090815260408083206001600160a01b03881684528252808320935183529281529082902082518084019093528054835260010154908201819052608089015191935061090d9185906117a8565b60608801526000604088018190525b858110156109de576000878281518110610938576109386121ca565b6020026020010151905060006109af60d36000610973600162093a808f6080015161096391906121b7565b61096d91906121e0565b86610f5b565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020600101546001611792565b90506109c081838c608001516117a8565b8a6040018181516109d191906121b7565b905250505060010161091c565b50604087015115610a42576040808801516001600160a01b038c16600090815260cf602090815283822060808c01518352905291909120546060890151610a259190612215565b610a2f91906121f3565b87518890610a3e9083906121b7565b9052505b62093a8087608001818151610a5791906121b7565b905250600101610880565b505b50505b600101610750565b505090519150505b92915050565b600054610100900460ff1615808015610a9d5750600054600160ff909116105b80610ab75750303b158015610ab7575060005460ff166001145b610b1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610588565b6000805460ff191660011790558015610b3d576000805461ff0019166101001790555b610b45611851565b610b4d611880565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610bc3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60c95460408051633709ffff60e11b815290516060926001600160a01b031691636e13fffe9160048083019260009291908290030181865afa158015610c12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c3a919081019061222c565b905090565b610c47611738565b610c5160006118af565b565b60975433906001600160a01b03168114610cc15760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610588565b610cca816118af565b50565b6040805180820182526000808252602091820181905285815260d182528281206001600160a01b03861682528252828120848252825282902082518084019093528054835260010154908201525b9392505050565b60c9546001600160a01b03163314610d4c5760405162461bcd60e51b81526004016105889061216a565b6001600160a01b038316600090815260cd6020526040812080543392859291610d769084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b038816845290915281208054859290610dad9084906121e0565b9091555050600082815260ce602090815260408083206001600160a01b0388168452909152902054610de29083908690611471565b610deb846115da565b81816001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688560405161066c91815260200190565b610e2f6118c8565b6001600160a01b038216600090815260cc6020526040902054339060ff16610f425760c95460405163559bfa4360e11b81526001600160a01b0385811660048301529091169063ab37f48690602401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906122bb565b610edc576040516307c241ad60e51b815260040160405180910390fd5b6001600160a01b038316600081815260cc60205260408120805460ff1916600190811790915560cb805491820181559091527fa7ce836d032b2bf62b7e2097a8e0a6d8aeb35405ad15271e96d3b0188a1d06fb0180546001600160a01b03191690911790555b610f4d818484611921565b50610f5760018055565b5050565b6001600160a01b038116600090815260d46020526040812054808203610f85576000915050610a77565b8360d36000610f956001856121e0565b8152602080820192909252604090810160009081206001600160a01b038816825290925290205411610fd457610fcc6001826121e0565b915050610a77565b6001600160a01b03831660009081527f938258ec6d8d468a3507d140e1c026dc2afa285c097847a088da7b50946fb91b602052604090205484101561101d576000915050610a77565b60008061102b6001846121e0565b90505b818111156110d2576000600261104484846121e0565b61104e91906121f3565b61105890836121e0565b600081815260d3602090815260408083206001600160a01b038b1684528252918290208251808401909352805480845260019091015491830191909152919250908890036110ac57509350610a7792505050565b80518811156110bd578193506110cb565b6110c86001836121e0565b92505b505061102e565b50949350505050565b600083815260d2602090815260408083206001600160a01b038616845290915281205480820361110f576000915050610d1b565b600085815260d1602090815260408083206001600160a01b03881684529091528120849161113e6001856121e0565b81526020019081526020016000206000015411611168576111606001826121e0565b915050610d1b565b600085815260d1602090815260408083206001600160a01b038816845282528083208380529091529020548310156111a4576000915050610d1b565b6000806111b26001846121e0565b90505b8181111561126157600060026111cb84846121e0565b6111d591906121f3565b6111df90836121e0565b600089815260d1602090815260408083206001600160a01b038c168452825280832084845282529182902082518084019093528054808452600190910154918301919091529192509087900361123b57509350610d1b92505050565b805187111561124c5781935061125a565b6112576001836121e0565b92505b50506111b5565b5095945050505050565b611273611738565b609780546001600160a01b0383166001600160a01b031990911681179091556112a46065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60cb81815481106112ec57600080fd5b6000918252602090912001546001600160a01b0316905081565b61130e6118c8565b60c9546001600160a01b031633146113385760405162461bcd60e51b81526004016105889061216a565b60ca546040516331a9108f60e11b815260048101849052339182916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906122dd565b6001600160a01b0316141580156113ce575060c9546001600160a01b03828116911614155b156113eb576040516282b42960e81b815260040160405180910390fd5b60ca546040516331a9108f60e11b8152600481018590526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145991906122dd565b9050611466818585611a01565b5050610f5760018055565b600083815260d2602090815260408083206001600160a01b03861684529091529020544281158015906114f7575062093a8081068103600086815260d1602090815260408083206001600160a01b038916845290915281206114f5916114d86001876121e0565b81526020019081526020016000206000015462093a808106900390565b145b1561155e576040805180820182528281526020808201869052600088815260d182528381206001600160a01b0389168252909152918220909161153b6001866121e0565b8152602080820192909252604001600020825181559101516001909101556115d3565b6040805180820182528281526020808201868152600089815260d183528481206001600160a01b038a16825283528481208782529092529290209051815590516001918201556115af9083906121b7565b600086815260d2602090815260408083206001600160a01b03891684529091529020555b5050505050565b6001600160a01b038116600090815260d4602052604090205442811580159061164c575062093a808106810361164a60d360006116186001876121e0565b8152602080820192909252604090810160009081206001600160a01b038916825290925290205462093a808106900390565b145b156116c3576040805180820182528281526001600160a01b038516600090815260cd602090815292812054928201929092529060d39061168d6001866121e0565b8152602080820192909252604090810160009081206001600160a01b038816825283522082518155910151600190910155505050565b6040805180820182528281526001600160a01b038516600081815260cd60209081528482205481850190815287835260d382528583209383529290529290922090518155905160019182015561171a9083906121b7565b6001600160a01b038416600090815260d46020526040902055505050565b6065546001600160a01b03163314610c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610588565b60008183116117a15781610d1b565b5090919050565b6001600160a01b038216600090815260d56020908152604080832062093a80850685038085529252822054820361180457604051631e1bcf4b60e21b81526001600160a01b038516600482015260248101829052604401610588565b6001600160a01b038416600090815260d56020908152604080832084845290915281205490670de0b6b3a764000061183c8389612215565b61184691906121f3565b979650505050505050565b600054610100900460ff166118785760405162461bcd60e51b8152600401610588906122fa565b610c51611b29565b600054610100900460ff166118a75760405162461bcd60e51b8152600401610588906122fa565b610c51611b50565b609780546001600160a01b0319169055610cca81611b80565b60026001540361191a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610588565b6002600155565b806000036119425760405163d11b25af60e01b815260040160405180910390fd5b6119576001600160a01b038316843084611bd2565b60006119684262093a808106900390565b6001600160a01b038416600090815260cf602090815260408083208484529091528120805492935084929091906119a09084906121b7565b9250508190555080836001600160a01b0316856001600160a01b03167fd6ed593743eef6a29ec2399492c6063a60ca178ec420caf8ac3eceff9cb9a559856040516119ed91815260200190565b60405180910390a450505050565b60018055565b805160005b818110156115d3576000611a33848381518110611a2557611a256121ca565b6020026020010151866106e3565b90504260d06000868581518110611a4c57611a4c6121ca565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015611aba57611aba8682868581518110611a9a57611a9a6121ca565b60200260200101516001600160a01b0316611c439092919063ffffffff16565b838281518110611acc57611acc6121ca565b60200260200101516001600160a01b0316866001600160a01b03167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c783604051611b1891815260200190565b60405180910390a350600101611a06565b600054610100900460ff166119fb5760405162461bcd60e51b8152600401610588906122fa565b600054610100900460ff16611b775760405162461bcd60e51b8152600401610588906122fa565b610c51336118af565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c3d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611c73565b50505050565b6040516001600160a01b038316602482015260448101829052610bc390849063a9059cbb60e01b90606401611c06565b6000611cc8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d459092919063ffffffff16565b805190915015610bc35780806020019051810190611ce691906122bb565b610bc35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610588565b6060611d548484600085611d5c565b949350505050565b606082471015611dbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610588565b600080866001600160a01b03168587604051611dd99190612369565b60006040518083038185875af1925050503d8060008114611e16576040519150601f19603f3d011682016040523d82523d6000602084013e611e1b565b606091505b50915091506118468783838760608315611e96578251600003611e8f576001600160a01b0385163b611e8f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610588565b5081611d54565b611d548383815115611eab5781518083602001fd5b8060405162461bcd60e51b81526004016105889190612385565b6001600160a01b0381168114610cca57600080fd5b600080600060608486031215611eef57600080fd5b8335611efa81611ec5565b95602085013595506040909401359392505050565b600080600060608486031215611f2457600080fd5b833592506020840135611f3681611ec5565b929592945050506040919091013590565b60008060408385031215611f5a57600080fd5b8235611f6581611ec5565b946020939093013593505050565b60008060408385031215611f8657600080fd5b823591506020830135611f9881611ec5565b809150509250929050565b60008060408385031215611fb657600080fd5b8235611fc181611ec5565b91506020830135611f9881611ec5565b600060208284031215611fe357600080fd5b8135610d1b81611ec5565b6020808252825182820181905260009190848201906040850190845b8181101561202f5783516001600160a01b03168352928401929184019160010161200a565b50909695505050505050565b60006020828403121561204d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561209357612093612054565b604052919050565b600067ffffffffffffffff8211156120b5576120b5612054565b5060051b60200190565b600080604083850312156120d257600080fd5b8235915060208084013567ffffffffffffffff8111156120f157600080fd5b8401601f8101861361210257600080fd5b80356121156121108261209b565b61206a565b81815260059190911b8201830190838101908883111561213457600080fd5b928401925b8284101561215b57833561214c81611ec5565b82529284019290840190612139565b80955050505050509250929050565b60208082526017908201527f43616c6c6572206973206e6f742074686520766f746572000000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7757610a776121a1565b634e487b7160e01b600052603260045260246000fd5b81810381811115610a7757610a776121a1565b60008261221057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610a7757610a776121a1565b6000602080838503121561223f57600080fd5b825167ffffffffffffffff81111561225657600080fd5b8301601f8101851361226757600080fd5b80516122756121108261209b565b81815260059190911b8201830190838101908783111561229457600080fd5b928401925b828410156118465783516122ac81611ec5565b82529284019290840190612299565b6000602082840312156122cd57600080fd5b81518015158114610d1b57600080fd5b6000602082840312156122ef57600080fd5b8151610d1b81611ec5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612360578181015183820152602001612348565b50506000910152565b6000825161237b818460208701612345565b9190910192915050565b60208152600082518060208401526123a4816040850160208701612345565b601f01601f1916919091016040019291505056fea2646970667358221220f78685991f7fea8227b7b8bcdaba997d53e2d6a658b7b51a2efb0c4edf2e76bc64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "deposit(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be deposited for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + }, + "earned(address,uint256)": { + "params": { + "token": "Address of the reward token", + "tokenId": "Unique identifier of the veNFT" + }, + "returns": { + "_0": "Amount of the reward token earned" + } + }, + "getAllLpRewardTokens()": { + "returns": { + "_0": "Array of LP token addresses" + } + }, + "getCheckpoint(uint256,address,uint256)": { + "params": { + "index": "The index of the checkpoint to retrieve", + "lpToken": "The LP token address", + "tokenId": "The ID of the veION token" + }, + "returns": { + "_0": "The checkpoint data" + } + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "details": "Timestamp must be in the past or present.", + "params": { + "lpToken": "Address of the liquidity pool token", + "timestamp": "The timestamp to get the balance at", + "tokenId": "The veNFT token ID to check" + }, + "returns": { + "_0": "The balance index at the given timestamp" + } + }, + "getPriorSupplyIndex(uint256,address)": { + "details": "Timestamp must be in the past or present.", + "params": { + "timestamp": "The timestamp to get the supply index at" + }, + "returns": { + "_0": "The supply index at the given timestamp" + } + }, + "getReward(uint256,address[])": { + "details": "If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.", + "params": { + "tokenId": "Unique identifier of the veNFT", + "tokens": "Array of tokens to claim rewards for" + } + }, + "initialize(address,address)": { + "details": "This function is called only once during contract deployment", + "params": { + "_ve": "The address of the veION contract", + "_voter": "The address of the voter contract" + } + }, + "notifyRewardAmount(address,uint256)": { + "params": { + "amount": "Amount of the reward token to be added", + "token": "Address of the reward token" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardsListLength()": { + "returns": { + "_0": "The length of the rewards array" + } + }, + "setHistoricalPrices(uint256,address,uint256)": { + "params": { + "epochTimestamp": "The timestamp of the epoch", + "lpToken": "The LP token address", + "price": "The price to set" + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdraw(address,uint256,uint256)": { + "details": "Can only be called internally by authorized entities.", + "params": { + "amount": "Amount to be withdrawn for the veNFT", + "lpToken": "Address of the liquidity pool token", + "tokenId": "Unique identifier of the veNFT" + } + } + }, + "title": "BribeRewards Contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "DURATION()": { + "notice": "Duration of the reward period in seconds" + }, + "balanceOf(uint256,address)": { + "notice": "Balance of LP tokens for each tokenId and reward token" + }, + "checkpoints(uint256,address,uint256)": { + "notice": "A record of balance checkpoints for each account, by index" + }, + "deposit(address,uint256,uint256)": { + "notice": "Deposit an amount into the bribe rewards contract for a specific veNFT" + }, + "earned(address,uint256)": { + "notice": "Calculate the rewards earned for a specific token and veNFT" + }, + "getAllLpRewardTokens()": { + "notice": "Gets all LP tokens that can receive rewards" + }, + "getCheckpoint(uint256,address,uint256)": { + "notice": "Gets a specific checkpoint for a token" + }, + "getPriorBalanceIndex(uint256,address,uint256)": { + "notice": "Get the prior balance index for a veNFT at a specific timestamp" + }, + "getPriorSupplyIndex(uint256,address)": { + "notice": "Get the prior supply index at a specific timestamp" + }, + "getReward(uint256,address[])": { + "notice": "This function can accept any token, regardless of its whitelisting status." + }, + "historicalPrices(address,uint256)": { + "notice": "Historical prices for each reward token and epoch" + }, + "initialize(address,address)": { + "notice": "Initializes the BribeRewards contract with the voter and veION addresses" + }, + "isReward(address)": { + "notice": "Mapping to check if an address is a reward token" + }, + "lastEarn(address,uint256)": { + "notice": "Last earned timestamp for each reward token and tokenId" + }, + "notifyRewardAmount(address,uint256)": { + "notice": "Notify the contract about new rewards for stakers" + }, + "numCheckpoints(uint256,address)": { + "notice": "The number of checkpoints for each account" + }, + "rewards(uint256)": { + "notice": "List of reward tokens" + }, + "rewardsListLength()": { + "notice": "Returns the total number of reward tokens" + }, + "setHistoricalPrices(uint256,address,uint256)": { + "notice": "Sets historical prices for LP tokens at specific epochs" + }, + "supplyCheckpoints(uint256,address)": { + "notice": "A record of balance checkpoints for each token, by index" + }, + "supplyNumCheckpoints(address)": { + "notice": "The number of supply checkpoints for each token" + }, + "tokenRewardsPerEpoch(address,uint256)": { + "notice": "Rewards per epoch for each reward token" + }, + "totalSupply(address)": { + "notice": "Total supply of LP tokens for each reward token" + }, + "ve()": { + "notice": "Address of the veION contract" + }, + "voter()": { + "notice": "Address of the voter contract" + }, + "withdraw(address,uint256,uint256)": { + "notice": "Withdraw an amount from the bribe rewards contract for a specific veNFT" + } + }, + "notice": "This contract allows veION to benefit from bribes when voting for various markets", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 3646, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3704, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6909, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_owner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "_pendingOwner", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 103585, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "voter", + "offset": 0, + "slot": "201", + "type": "t_address" + }, + { + "astId": 103588, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "ve", + "offset": 0, + "slot": "202", + "type": "t_address" + }, + { + "astId": 103592, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "rewards", + "offset": 0, + "slot": "203", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 103597, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "isReward", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 103602, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "totalSupply", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103609, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103616, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "tokenRewardsPerEpoch", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103623, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "lastEarn", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 103633, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "checkpoints", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))" + }, + { + "astId": 103640, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "numCheckpoints", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 103648, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyCheckpoints", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))" + }, + { + "astId": 103653, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supplyNumCheckpoints", + "offset": 0, + "slot": "212", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 103660, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "historicalPrices", + "offset": 0, + "slot": "213", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IBribeRewards.SupplyCheckpoint)", + "numberOfBytes": "32", + "value": "t_struct(SupplyCheckpoint)107036_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => mapping(uint256 => struct IBribeRewards.Checkpoint)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_struct(Checkpoint)107030_storage))" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => struct IBribeRewards.SupplyCheckpoint))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SupplyCheckpoint)107036_storage)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Checkpoint)107030_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IBribeRewards.Checkpoint)", + "numberOfBytes": "32", + "value": "t_struct(Checkpoint)107030_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Checkpoint)107030_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.Checkpoint", + "members": [ + { + "astId": 107027, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107029, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SupplyCheckpoint)107036_storage": { + "encoding": "inplace", + "label": "struct IBribeRewards.SupplyCheckpoint", + "members": [ + { + "astId": 107033, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "timestamp", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 107035, + "contract": "contracts/veION/BribeRewards.sol:BribeRewards", + "label": "supply", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Proxy.json b/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Proxy.json new file mode 100644 index 0000000000..6294acca4b --- /dev/null +++ b/packages/contracts/deployments/base/BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "transactionIndex": 127, + "gasUsed": "840319", + "logsBloom": "0x00000000000000000000000000000000400000000000000021800000000000020000000000000000000000000800000000000000000000000000000000000000000000000000000000001000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000000000000000090000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000400000000400000000000000000020000000000000000000000000000000000000000000000000000000000040000000", + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c", + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "logs": [ + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000414e7b43b8b82adf0b02c84e9ec02aa82d87b2aa" + ], + "data": "0x", + "logIndex": 280, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + }, + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 281, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + }, + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 282, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + }, + { + "transactionIndex": 127, + "blockNumber": 25919903, + "transactionHash": "0xc0b16f74b521c6189df1b61c565d43ccd1d5420238ea7048d2edf2b30c2d5ad2", + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 283, + "blockHash": "0x0b7c6e1c6d0fd47e5beb381376e0ed58543c9ebb0e15ac0c1dc60e96cea3927c" + } + ], + "blockNumber": 25919903, + "cumulativeGasUsed": "30285226", + "status": 1, + "byzantium": true + }, + "args": [ + "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000669a6f5421da53696fa06f1043cf127d380f6eb90000000000000000000000008865e0678e3b1bd0f5302e4c178a4b576f6aaa27" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/CErc20Delegate.json b/packages/contracts/deployments/base/CErc20Delegate.json index 3070c4a7a3..f56247db63 100644 --- a/packages/contracts/deployments/base/CErc20Delegate.json +++ b/packages/contracts/deployments/base/CErc20Delegate.json @@ -1532,4 +1532,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/contracts/deployments/base/CErc20RewardsDelegate.json b/packages/contracts/deployments/base/CErc20RewardsDelegate.json index b40ed0243f..0e1f972ecc 100644 --- a/packages/contracts/deployments/base/CErc20RewardsDelegate.json +++ b/packages/contracts/deployments/base/CErc20RewardsDelegate.json @@ -1560,4 +1560,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/contracts/deployments/base/CErc20RewardsDelegateMorpho.json b/packages/contracts/deployments/base/CErc20RewardsDelegateMorpho.json new file mode 100644 index 0000000000..41f2b4f393 --- /dev/null +++ b/packages/contracts/deployments/base/CErc20RewardsDelegateMorpho.json @@ -0,0 +1,1601 @@ +{ + "address": "0x13197fdb0A96Ff25E3455D77b1a75f65e3B03CFe", + "abi": [ + { + "inputs": [], + "name": "CallerIsNotEOA", + "type": "error" + }, + { + "inputs": [], + "name": "InteractionNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "cTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldAdminFeeMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newAdminFeeMantissa", + "type": "uint256" + } + ], + "name": "NewAdminFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldIonicFeeMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newIonicFeeMantissa", + "type": "uint256" + } + ], + "name": "NewIonicFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "reward", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "claimedAmount", + "type": "uint256" + } + ], + "name": "RewardsClaimedAndSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "_getExtensionFunctions", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "withdrawAmount", + "type": "uint256" + } + ], + "name": "_withdrawAdminFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "withdrawAmount", + "type": "uint256" + } + ], + "name": "_withdrawIonicFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adminFeeMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ap", + "outputs": [ + { + "internalType": "contract AddressesProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "morphoURD", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "address", + "name": "distributor", + "type": "address" + }, + { + "internalType": "uint256", + "name": "claimable", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract IonicComptroller", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractType", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "delegateType", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "feeSeizeShareMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ionicAdmin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ionicFeeMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "cTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolSeizeShareMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "selfTransferIn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "selfTransferOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAdminFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalIonicFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x0c4ebe53c4e09b6e8f64e477b975774ee0a6ba5e528c1c69150deae1cbc749fd", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x13197fdb0A96Ff25E3455D77b1a75f65e3B03CFe", + "transactionIndex": 94, + "gasUsed": "5351078", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0952d4579ee3b8d47d3bb5bda370d97d25a2c51bf016638e964c5703ed6fd1ab", + "transactionHash": "0x0c4ebe53c4e09b6e8f64e477b975774ee0a6ba5e528c1c69150deae1cbc749fd", + "logs": [], + "blockNumber": 25921381, + "cumulativeGasUsed": "28604033", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 5, + "solcInputHash": "a198deba20a3c9464a98ef0313fee382", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"CallerIsNotEOA\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InteractionNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cashPrior\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"interestAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"AccrueInterest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountBorrows\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"Borrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"LiquidateBorrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"}],\"name\":\"Mint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldAdminFeeMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newAdminFeeMantissa\",\"type\":\"uint256\"}],\"name\":\"NewAdminFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldIonicFeeMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newIonicFeeMantissa\",\"type\":\"uint256\"}],\"name\":\"NewIonicFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract InterestRateModel\",\"name\":\"oldInterestRateModel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract InterestRateModel\",\"name\":\"newInterestRateModel\",\"type\":\"address\"}],\"name\":\"NewMarketInterestRateModel\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldReserveFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newReserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewReserveFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"Redeem\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountBorrows\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"RepayBorrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"benefactor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"addAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTotalReserves\",\"type\":\"uint256\"}],\"name\":\"ReservesAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reduceAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTotalReserves\",\"type\":\"uint256\"}],\"name\":\"ReservesReduced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"reward\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"claimedAmount\",\"type\":\"uint256\"}],\"name\":\"RewardsClaimedAndSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"_becomeImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"_withdrawAdminFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"_withdrawIonicFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFeeMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ap\",\"outputs\":[{\"internalType\":\"contract AddressesProvider\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"}],\"name\":\"borrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"morphoURD\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"distributor\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"claimable\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"comptroller\",\"outputs\":[{\"internalType\":\"contract IonicComptroller\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"contractType\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delegateType\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeSeizeShareMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRateModel\",\"outputs\":[{\"internalType\":\"contract InterestRateModel\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicFeeMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"}],\"name\":\"liquidateBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolSeizeShareMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"}],\"name\":\"redeemUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reserveFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"selfTransferIn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"selfTransferOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAdminFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalIonicFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"underlying\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Failure(uint256,uint256,uint256)\":{\"details\":\"`error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.*\"}},\"kind\":\"dev\",\"methods\":{\"_getExtensionFunctions()\":{\"returns\":{\"functionSelectors\":\"a list of all the function selectors that this logic extension exposes\"}},\"_withdrawAdminFees(uint256)\":{\"params\":{\"withdrawAmount\":\"Amount of fees to withdraw\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_withdrawIonicFees(uint256)\":{\"params\":{\"withdrawAmount\":\"Amount of fees to withdraw\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"borrow(uint256)\":{\"params\":{\"borrowAmount\":\"The amount of the underlying asset to borrow\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"claim(address,address,address,uint256,bytes32[])\":{\"details\":\"Only callable by the governance.\",\"params\":{\"claimable\":\"The amount of tokens to claim and forward.\",\"proof\":\"The proof required to validate the claim.\",\"rewardToken\":\"The reward strategy for which the rewards are being claimed.\"}},\"getCash()\":{\"returns\":{\"_0\":\"The quantity of underlying asset owned by this contract\"}},\"liquidateBorrow(address,uint256,address)\":{\"params\":{\"borrower\":\"The borrower of this cToken to be liquidated\",\"cTokenCollateral\":\"The market in which to seize collateral from the borrower\",\"repayAmount\":\"The amount of the underlying borrowed asset to repay\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"mint(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"mintAmount\":\"The amount of the underlying asset to supply\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"redeem(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"redeemTokens\":\"The number of cTokens to redeem into underlying\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"redeemUnderlying(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"redeemAmount\":\"The amount of underlying to redeem\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"repayBorrow(uint256)\":{\"params\":{\"repayAmount\":\"The amount to repay\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"repayBorrowBehalf(address,uint256)\":{\"params\":{\"borrower\":\"the account with the debt being payed off\",\"repayAmount\":\"The amount to repay\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"seize(address,address,uint256)\":{\"details\":\"Will fail unless called by another cToken during the process of liquidation. Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\",\"params\":{\"borrower\":\"The account having collateral seized\",\"liquidator\":\"The account receiving seized collateral\",\"seizeTokens\":\"The number of cTokens to seize\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}}},\"version\":1},\"userdoc\":{\"events\":{\"AccrueInterest(uint256,uint256,uint256,uint256)\":{\"notice\":\"Event emitted when interest is accrued\"},\"Approval(address,address,uint256)\":{\"notice\":\"EIP20 Approval event\"},\"Borrow(address,uint256,uint256,uint256)\":{\"notice\":\"Event emitted when underlying is borrowed\"},\"LiquidateBorrow(address,address,uint256,address,uint256)\":{\"notice\":\"Event emitted when a borrow is liquidated\"},\"Mint(address,uint256,uint256)\":{\"notice\":\"Event emitted when tokens are minted\"},\"NewAdminFee(uint256,uint256)\":{\"notice\":\"Event emitted when the admin fee is changed\"},\"NewIonicFee(uint256,uint256)\":{\"notice\":\"Event emitted when the Ionic fee is changed\"},\"NewMarketInterestRateModel(address,address)\":{\"notice\":\"Event emitted when interestRateModel is changed\"},\"NewReserveFactor(uint256,uint256)\":{\"notice\":\"Event emitted when the reserve factor is changed\"},\"Redeem(address,uint256,uint256)\":{\"notice\":\"Event emitted when tokens are redeemed\"},\"RepayBorrow(address,address,uint256,uint256,uint256)\":{\"notice\":\"Event emitted when a borrow is repaid\"},\"ReservesAdded(address,uint256,uint256)\":{\"notice\":\"Event emitted when the reserves are added\"},\"ReservesReduced(address,uint256,uint256)\":{\"notice\":\"Event emitted when the reserves are reduced\"},\"Transfer(address,address,uint256)\":{\"notice\":\"EIP20 Transfer event\"}},\"kind\":\"user\",\"methods\":{\"_becomeImplementation(bytes)\":{\"notice\":\"Called by the delegator on a delegate to initialize it for duty\"},\"_withdrawAdminFees(uint256)\":{\"notice\":\"Accrues interest and reduces admin fees by transferring to admin\"},\"_withdrawIonicFees(uint256)\":{\"notice\":\"Accrues interest and reduces Ionic fees by transferring to Ionic\"},\"accrualBlockNumber()\":{\"notice\":\"Block number that interest was last accrued at\"},\"adminFeeMantissa()\":{\"notice\":\"Fraction of interest currently set aside for admin fees\"},\"ap()\":{\"notice\":\"Addresses Provider\"},\"borrow(uint256)\":{\"notice\":\"Sender borrows assets from the protocol to their own address\"},\"borrowIndex()\":{\"notice\":\"Accumulator of the total earned interest rate since the opening of the market\"},\"claim(address,address,address,uint256,bytes32[])\":{\"notice\":\"Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\"},\"comptroller()\":{\"notice\":\"Contract which oversees inter-cToken operations\"},\"decimals()\":{\"notice\":\"EIP-20 token decimals for this token\"},\"getCash()\":{\"notice\":\"Get cash balance of this cToken in the underlying asset\"},\"interestRateModel()\":{\"notice\":\"Model which tells what the current interest rate should be\"},\"ionicFeeMantissa()\":{\"notice\":\"Fraction of interest currently set aside for Ionic fees\"},\"liquidateBorrow(address,uint256,address)\":{\"notice\":\"The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator.\"},\"mint(uint256)\":{\"notice\":\"Sender supplies assets into the market and receives cTokens in exchange\"},\"name()\":{\"notice\":\"EIP-20 token name for this token\"},\"redeem(uint256)\":{\"notice\":\"Sender redeems cTokens in exchange for the underlying asset\"},\"redeemUnderlying(uint256)\":{\"notice\":\"Sender redeems cTokens in exchange for a specified amount of underlying asset\"},\"repayBorrow(uint256)\":{\"notice\":\"Sender repays their own borrow\"},\"repayBorrowBehalf(address,uint256)\":{\"notice\":\"Sender repays a borrow belonging to borrower\"},\"reserveFactorMantissa()\":{\"notice\":\"Fraction of interest currently set aside for reserves\"},\"seize(address,address,uint256)\":{\"notice\":\"Transfers collateral tokens (this market) to the liquidator.\"},\"symbol()\":{\"notice\":\"EIP-20 token symbol for this token\"},\"totalAdminFees()\":{\"notice\":\"Total amount of admin fees of the underlying held in this market\"},\"totalBorrows()\":{\"notice\":\"Total amount of outstanding borrows of the underlying in this market\"},\"totalIonicFees()\":{\"notice\":\"Total amount of Ionic fees of the underlying held in this market\"},\"totalReserves()\":{\"notice\":\"Total amount of reserves of the underlying held in this market\"},\"totalSupply()\":{\"notice\":\"Total number of tokens in circulation\"},\"underlying()\":{\"notice\":\"Underlying asset for this CToken\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/CErc20RewardsDelegateMorpho.sol\":\"CErc20RewardsDelegateMorpho\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IERC20Upgradeable.sol\\\";\\r\\nimport \\\"./extensions/IERC20MetadataUpgradeable.sol\\\";\\r\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Implementation of the {IERC20} interface.\\r\\n *\\r\\n * This implementation is agnostic to the way tokens are created. This means\\r\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\r\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\r\\n *\\r\\n * TIP: For a detailed writeup see our guide\\r\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\r\\n * to implement supply mechanisms].\\r\\n *\\r\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\r\\n * instead returning `false` on failure. This behavior is nonetheless\\r\\n * conventional and does not conflict with the expectations of ERC20\\r\\n * applications.\\r\\n *\\r\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\r\\n * This allows applications to reconstruct the allowance for all accounts just\\r\\n * by listening to said events. Other implementations of the EIP may not emit\\r\\n * these events, as it isn't required by the specification.\\r\\n *\\r\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\r\\n * functions have been added to mitigate the well-known issues around setting\\r\\n * allowances. See {IERC20-approve}.\\r\\n */\\r\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\\r\\n mapping(address => uint256) private _balances;\\r\\n\\r\\n mapping(address => mapping(address => uint256)) private _allowances;\\r\\n\\r\\n uint256 private _totalSupply;\\r\\n\\r\\n string private _name;\\r\\n string private _symbol;\\r\\n\\r\\n /**\\r\\n * @dev Sets the values for {name} and {symbol}.\\r\\n *\\r\\n * The default value of {decimals} is 18. To select a different value for\\r\\n * {decimals} you should overload it.\\r\\n *\\r\\n * All two of these values are immutable: they can only be set once during\\r\\n * construction.\\r\\n */\\r\\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n __ERC20_init_unchained(name_, symbol_);\\r\\n }\\r\\n\\r\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\r\\n _name = name_;\\r\\n _symbol = symbol_;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the name of the token.\\r\\n */\\r\\n function name() public view virtual override returns (string memory) {\\r\\n return _name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the symbol of the token, usually a shorter version of the\\r\\n * name.\\r\\n */\\r\\n function symbol() public view virtual override returns (string memory) {\\r\\n return _symbol;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of decimals used to get its user representation.\\r\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\r\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\r\\n *\\r\\n * Tokens usually opt for a value of 18, imitating the relationship between\\r\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\r\\n * overridden;\\r\\n *\\r\\n * NOTE: This information is only used for _display_ purposes: it in\\r\\n * no way affects any of the arithmetic of the contract, including\\r\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\r\\n */\\r\\n function decimals() public view virtual override returns (uint8) {\\r\\n return 18;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC20-totalSupply}.\\r\\n */\\r\\n function totalSupply() public view virtual override returns (uint256) {\\r\\n return _totalSupply;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC20-balanceOf}.\\r\\n */\\r\\n function balanceOf(address account) public view virtual override returns (uint256) {\\r\\n return _balances[account];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC20-transfer}.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `to` cannot be the zero address.\\r\\n * - the caller must have a balance of at least `amount`.\\r\\n */\\r\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\r\\n address owner = _msgSender();\\r\\n _transfer(owner, to, amount);\\r\\n return true;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC20-allowance}.\\r\\n */\\r\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\r\\n return _allowances[owner][spender];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC20-approve}.\\r\\n *\\r\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\r\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n */\\r\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\r\\n address owner = _msgSender();\\r\\n _approve(owner, spender, amount);\\r\\n return true;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev See {IERC20-transferFrom}.\\r\\n *\\r\\n * Emits an {Approval} event indicating the updated allowance. This is not\\r\\n * required by the EIP. See the note at the beginning of {ERC20}.\\r\\n *\\r\\n * NOTE: Does not update the allowance if the current allowance\\r\\n * is the maximum `uint256`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` and `to` cannot be the zero address.\\r\\n * - `from` must have a balance of at least `amount`.\\r\\n * - the caller must have allowance for ``from``'s tokens of at least\\r\\n * `amount`.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) public virtual override returns (bool) {\\r\\n address spender = _msgSender();\\r\\n _spendAllowance(from, spender, amount);\\r\\n _transfer(from, to, amount);\\r\\n return true;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\r\\n *\\r\\n * This is an alternative to {approve} that can be used as a mitigation for\\r\\n * problems described in {IERC20-approve}.\\r\\n *\\r\\n * Emits an {Approval} event indicating the updated allowance.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n */\\r\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\r\\n address owner = _msgSender();\\r\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\r\\n return true;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\r\\n *\\r\\n * This is an alternative to {approve} that can be used as a mitigation for\\r\\n * problems described in {IERC20-approve}.\\r\\n *\\r\\n * Emits an {Approval} event indicating the updated allowance.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `spender` must have allowance for the caller of at least\\r\\n * `subtractedValue`.\\r\\n */\\r\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\r\\n address owner = _msgSender();\\r\\n uint256 currentAllowance = allowance(owner, spender);\\r\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\r\\n unchecked {\\r\\n _approve(owner, spender, currentAllowance - subtractedValue);\\r\\n }\\r\\n\\r\\n return true;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` of tokens from `from` to `to`.\\r\\n *\\r\\n * This internal function is equivalent to {transfer}, and can be used to\\r\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `from` cannot be the zero address.\\r\\n * - `to` cannot be the zero address.\\r\\n * - `from` must have a balance of at least `amount`.\\r\\n */\\r\\n function _transfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) internal virtual {\\r\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\r\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(from, to, amount);\\r\\n\\r\\n uint256 fromBalance = _balances[from];\\r\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\r\\n unchecked {\\r\\n _balances[from] = fromBalance - amount;\\r\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\r\\n // decrementing then incrementing.\\r\\n _balances[to] += amount;\\r\\n }\\r\\n\\r\\n emit Transfer(from, to, amount);\\r\\n\\r\\n _afterTokenTransfer(from, to, amount);\\r\\n }\\r\\n\\r\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\r\\n * the total supply.\\r\\n *\\r\\n * Emits a {Transfer} event with `from` set to the zero address.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `account` cannot be the zero address.\\r\\n */\\r\\n function _mint(address account, uint256 amount) internal virtual {\\r\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(address(0), account, amount);\\r\\n\\r\\n _totalSupply += amount;\\r\\n unchecked {\\r\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\r\\n _balances[account] += amount;\\r\\n }\\r\\n emit Transfer(address(0), account, amount);\\r\\n\\r\\n _afterTokenTransfer(address(0), account, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Destroys `amount` tokens from `account`, reducing the\\r\\n * total supply.\\r\\n *\\r\\n * Emits a {Transfer} event with `to` set to the zero address.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `account` cannot be the zero address.\\r\\n * - `account` must have at least `amount` tokens.\\r\\n */\\r\\n function _burn(address account, uint256 amount) internal virtual {\\r\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\r\\n\\r\\n _beforeTokenTransfer(account, address(0), amount);\\r\\n\\r\\n uint256 accountBalance = _balances[account];\\r\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\r\\n unchecked {\\r\\n _balances[account] = accountBalance - amount;\\r\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\r\\n _totalSupply -= amount;\\r\\n }\\r\\n\\r\\n emit Transfer(account, address(0), amount);\\r\\n\\r\\n _afterTokenTransfer(account, address(0), amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\r\\n *\\r\\n * This internal function is equivalent to `approve`, and can be used to\\r\\n * e.g. set automatic allowances for certain subsystems, etc.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `owner` cannot be the zero address.\\r\\n * - `spender` cannot be the zero address.\\r\\n */\\r\\n function _approve(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 amount\\r\\n ) internal virtual {\\r\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\r\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\r\\n\\r\\n _allowances[owner][spender] = amount;\\r\\n emit Approval(owner, spender, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\r\\n *\\r\\n * Does not update the allowance amount in case of infinite allowance.\\r\\n * Revert if not enough allowance is available.\\r\\n *\\r\\n * Might emit an {Approval} event.\\r\\n */\\r\\n function _spendAllowance(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 amount\\r\\n ) internal virtual {\\r\\n uint256 currentAllowance = allowance(owner, spender);\\r\\n if (currentAllowance != type(uint256).max) {\\r\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\r\\n unchecked {\\r\\n _approve(owner, spender, currentAllowance - amount);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before any transfer of tokens. This includes\\r\\n * minting and burning.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\r\\n * will be transferred to `to`.\\r\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\r\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _beforeTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called after any transfer of tokens. This includes\\r\\n * minting and burning.\\r\\n *\\r\\n * Calling conditions:\\r\\n *\\r\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\r\\n * has been transferred to `to`.\\r\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\r\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\r\\n * - `from` and `to` are never both zero.\\r\\n *\\r\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\r\\n */\\r\\n function _afterTokenTransfer(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) internal virtual {}\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[45] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x1d80b4eeb5e280428128cb596c2fe266a305be12afe34e04f8f1841e3a45f677\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xffeed6b3cac845b2af4afb30d87cecbd45dec3c408360c157a3db08e28b45043\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\r\\n *\\r\\n * _Available since v4.1._\\r\\n */\\r\\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\\r\\n /**\\r\\n * @dev Returns the name of the token.\\r\\n */\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the symbol of the token.\\r\\n */\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n /**\\r\\n * @dev Returns the decimals places of the token.\\r\\n */\\r\\n function decimals() external view returns (uint8);\\r\\n}\\r\\n\",\"keccak256\":\"0x56492cd2e84fdbc5f39c722ebdbf4ec02a262ac026fdc40f2ad2eb0cda0c76b9\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20PermitUpgradeable {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xa4ef4473f068f5f97b73e442f554e4464a581c2200c23181287b4c8eee5de777\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20Upgradeable.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20PermitUpgradeable.sol\\\";\\r\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20Upgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20Upgradeable token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20Upgradeable token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20PermitUpgradeable token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5735e7a8ab4d99d6cbef359228e76c7c2057f13f9a22d014458951409ea30f7c\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\r\\n * `CREATE2` can be used to compute in advance the address where a smart\\r\\n * contract will be deployed, which allows for interesting new mechanisms known\\r\\n * as 'counterfactual interactions'.\\r\\n *\\r\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\r\\n * information.\\r\\n */\\r\\nlibrary Create2Upgradeable {\\r\\n /**\\r\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\r\\n * will be deployed can be known in advance via {computeAddress}.\\r\\n *\\r\\n * The bytecode for a contract can be obtained from Solidity with\\r\\n * `type(contractName).creationCode`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `bytecode` must not be empty.\\r\\n * - `salt` must have not been used for `bytecode` already.\\r\\n * - the factory must have a balance of at least `amount`.\\r\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\r\\n */\\r\\n function deploy(\\r\\n uint256 amount,\\r\\n bytes32 salt,\\r\\n bytes memory bytecode\\r\\n ) internal returns (address addr) {\\r\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\r\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\r\\n }\\r\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\r\\n * `bytecodeHash` or `salt` will result in a new destination address.\\r\\n */\\r\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\r\\n return computeAddress(salt, bytecodeHash, address(this));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\r\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\r\\n */\\r\\n function computeAddress(\\r\\n bytes32 salt,\\r\\n bytes32 bytecodeHash,\\r\\n address deployer\\r\\n ) internal pure returns (address addr) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let ptr := mload(0x40) // Get free memory pointer\\r\\n\\r\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\r\\n // |-------------------|---------------------------------------------------------------------------|\\r\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\r\\n // | salt | BBBBBBBBBBBBB...BB |\\r\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\r\\n // | 0xFF | FF |\\r\\n // |-------------------|---------------------------------------------------------------------------|\\r\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\r\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\r\\n\\r\\n mstore(add(ptr, 0x40), bytecodeHash)\\r\\n mstore(add(ptr, 0x20), salt)\\r\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\r\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\r\\n mstore8(start, 0xff)\\r\\n addr := keccak256(start, 85)\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x778948e768c275be0ce00e060e619fe7d0ef759a7875da0cb82f0b281d9be655\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\r\\n * proxy whose upgrades are fully controlled by the current implementation.\\r\\n */\\r\\ninterface IERC1822Proxiable {\\r\\n /**\\r\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\r\\n * address.\\r\\n *\\r\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\r\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\r\\n * function revert if invoked through a proxy.\\r\\n */\\r\\n function proxiableUUID() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xe768c5863db91751a70d25c9dac899ec5078c6bacfbc02878652e454aa416b9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../Proxy.sol\\\";\\r\\nimport \\\"./ERC1967Upgrade.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\r\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\r\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\r\\n * implementation behind the proxy.\\r\\n */\\r\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\r\\n /**\\r\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\r\\n *\\r\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\r\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\r\\n */\\r\\n constructor(address _logic, bytes memory _data) payable {\\r\\n _upgradeToAndCall(_logic, _data, false);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address.\\r\\n */\\r\\n function _implementation() internal view virtual override returns (address impl) {\\r\\n return ERC1967Upgrade._getImplementation();\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xca719d0df6d77207f38b638f8e5e85df03434b47a1045b5b686a36df9bea601f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../beacon/IBeacon.sol\\\";\\r\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\r\\nimport \\\"../../utils/Address.sol\\\";\\r\\nimport \\\"../../utils/StorageSlot.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This abstract contract provides getters and event emitting update functions for\\r\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\r\\n *\\r\\n * _Available since v4.1._\\r\\n *\\r\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\r\\n */\\r\\nabstract contract ERC1967Upgrade {\\r\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\r\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\r\\n\\r\\n /**\\r\\n * @dev Storage slot with the address of the current implementation.\\r\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\r\\n * validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the implementation is upgraded.\\r\\n */\\r\\n event Upgraded(address indexed implementation);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address.\\r\\n */\\r\\n function _getImplementation() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new address in the EIP1967 implementation slot.\\r\\n */\\r\\n function _setImplementation(address newImplementation) private {\\r\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\r\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeTo(address newImplementation) internal {\\r\\n _setImplementation(newImplementation);\\r\\n emit Upgraded(newImplementation);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade with additional setup call.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeToAndCall(\\r\\n address newImplementation,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n _upgradeTo(newImplementation);\\r\\n if (data.length > 0 || forceCall) {\\r\\n Address.functionDelegateCall(newImplementation, data);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeToAndCallUUPS(\\r\\n address newImplementation,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\r\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\r\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\r\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\r\\n _setImplementation(newImplementation);\\r\\n } else {\\r\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\r\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\r\\n } catch {\\r\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\r\\n }\\r\\n _upgradeToAndCall(newImplementation, data, forceCall);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Storage slot with the admin of the contract.\\r\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\r\\n * validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the admin account has changed.\\r\\n */\\r\\n event AdminChanged(address previousAdmin, address newAdmin);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current admin.\\r\\n */\\r\\n function _getAdmin() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new address in the EIP1967 admin slot.\\r\\n */\\r\\n function _setAdmin(address newAdmin) private {\\r\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\r\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the admin of the proxy.\\r\\n *\\r\\n * Emits an {AdminChanged} event.\\r\\n */\\r\\n function _changeAdmin(address newAdmin) internal {\\r\\n emit AdminChanged(_getAdmin(), newAdmin);\\r\\n _setAdmin(newAdmin);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\r\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the beacon is upgraded.\\r\\n */\\r\\n event BeaconUpgraded(address indexed beacon);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current beacon.\\r\\n */\\r\\n function _getBeacon() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\r\\n */\\r\\n function _setBeacon(address newBeacon) private {\\r\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\r\\n require(\\r\\n Address.isContract(IBeacon(newBeacon).implementation()),\\r\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\r\\n );\\r\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\r\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\r\\n *\\r\\n * Emits a {BeaconUpgraded} event.\\r\\n */\\r\\n function _upgradeBeaconToAndCall(\\r\\n address newBeacon,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n _setBeacon(newBeacon);\\r\\n emit BeaconUpgraded(newBeacon);\\r\\n if (data.length > 0 || forceCall) {\\r\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb9b4ac05179724cbcb7621bdab336a09eb32d07e07b425e0216263ad80388145\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\r\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\r\\n * be specified by overriding the virtual {_implementation} function.\\r\\n *\\r\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\r\\n * different contract through the {_delegate} function.\\r\\n *\\r\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\r\\n */\\r\\nabstract contract Proxy {\\r\\n /**\\r\\n * @dev Delegates the current call to `implementation`.\\r\\n *\\r\\n * This function does not return to its internal call site, it will return directly to the external caller.\\r\\n */\\r\\n function _delegate(address implementation) internal virtual {\\r\\n assembly {\\r\\n // Copy msg.data. We take full control of memory in this inline assembly\\r\\n // block because it will not return to Solidity code. We overwrite the\\r\\n // Solidity scratch pad at memory position 0.\\r\\n calldatacopy(0, 0, calldatasize())\\r\\n\\r\\n // Call the implementation.\\r\\n // out and outsize are 0 because we don't know the size yet.\\r\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\r\\n\\r\\n // Copy the returned data.\\r\\n returndatacopy(0, 0, returndatasize())\\r\\n\\r\\n switch result\\r\\n // delegatecall returns 0 on error.\\r\\n case 0 {\\r\\n revert(0, returndatasize())\\r\\n }\\r\\n default {\\r\\n return(0, returndatasize())\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\r\\n * and {_fallback} should delegate.\\r\\n */\\r\\n function _implementation() internal view virtual returns (address);\\r\\n\\r\\n /**\\r\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\r\\n *\\r\\n * This function does not return to its internal call site, it will return directly to the external caller.\\r\\n */\\r\\n function _fallback() internal virtual {\\r\\n _beforeFallback();\\r\\n _delegate(_implementation());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\r\\n * function in the contract matches the call data.\\r\\n */\\r\\n fallback() external payable virtual {\\r\\n _fallback();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\r\\n * is empty.\\r\\n */\\r\\n receive() external payable virtual {\\r\\n _fallback();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\r\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\r\\n *\\r\\n * If overridden should call `super._beforeFallback()`.\\r\\n */\\r\\n function _beforeFallback() internal virtual {}\\r\\n}\\r\\n\",\"keccak256\":\"0x62c6b919abeeb4c9146ffbb325fc03b5f2d55a29b8e719b8ff62daab48123565\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\r\\n */\\r\\ninterface IBeacon {\\r\\n /**\\r\\n * @dev Must return an address that can be used as a delegate call target.\\r\\n *\\r\\n * {BeaconProxy} will check that this address is a contract.\\r\\n */\\r\\n function implementation() external view returns (address);\\r\\n}\\r\\n\",\"keccak256\":\"0xd3effc3ce6d1c85e1aae2ba5c6f28434c2eef52e1fc48b15096a176dcfee5853\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\r\\n *\\r\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\r\\n * clashing], which can potentially be used in an attack, this contract uses the\\r\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\r\\n * things that go hand in hand:\\r\\n *\\r\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\r\\n * that call matches one of the admin functions exposed by the proxy itself.\\r\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\r\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\r\\n * \\\"admin cannot fallback to proxy target\\\".\\r\\n *\\r\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\r\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\r\\n * to sudden errors when trying to call a function from the proxy implementation.\\r\\n *\\r\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\r\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\r\\n */\\r\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\r\\n /**\\r\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\r\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\r\\n */\\r\\n constructor(\\r\\n address _logic,\\r\\n address admin_,\\r\\n bytes memory _data\\r\\n ) payable ERC1967Proxy(_logic, _data) {\\r\\n _changeAdmin(admin_);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\r\\n */\\r\\n modifier ifAdmin() {\\r\\n if (msg.sender == _getAdmin()) {\\r\\n _;\\r\\n } else {\\r\\n _fallback();\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current admin.\\r\\n *\\r\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\r\\n *\\r\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\r\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\r\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\r\\n */\\r\\n function admin() external ifAdmin returns (address admin_) {\\r\\n admin_ = _getAdmin();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation.\\r\\n *\\r\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\r\\n *\\r\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\r\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\r\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\r\\n */\\r\\n function implementation() external ifAdmin returns (address implementation_) {\\r\\n implementation_ = _implementation();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the admin of the proxy.\\r\\n *\\r\\n * Emits an {AdminChanged} event.\\r\\n *\\r\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\r\\n */\\r\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\r\\n _changeAdmin(newAdmin);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Upgrade the implementation of the proxy.\\r\\n *\\r\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\r\\n */\\r\\n function upgradeTo(address newImplementation) external ifAdmin {\\r\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\r\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\r\\n * proxied contract.\\r\\n *\\r\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\r\\n */\\r\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\r\\n _upgradeToAndCall(newImplementation, data, true);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current admin.\\r\\n */\\r\\n function _admin() internal view virtual returns (address) {\\r\\n return _getAdmin();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\r\\n */\\r\\n function _beforeFallback() internal virtual override {\\r\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\r\\n super._beforeFallback();\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2ec94f608eee8e1531e5210bc67bf8f3b3c28e0a7d7e6f65342d08809548ff1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Library for reading and writing primitive types to specific storage slots.\\r\\n *\\r\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\r\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\r\\n *\\r\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\r\\n *\\r\\n * Example usage to set ERC1967 implementation slot:\\r\\n * ```\\r\\n * contract ERC1967 {\\r\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\r\\n *\\r\\n * function _getImplementation() internal view returns (address) {\\r\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\r\\n * }\\r\\n *\\r\\n * function _setImplementation(address newImplementation) internal {\\r\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\r\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\r\\n */\\r\\nlibrary StorageSlot {\\r\\n struct AddressSlot {\\r\\n address value;\\r\\n }\\r\\n\\r\\n struct BooleanSlot {\\r\\n bool value;\\r\\n }\\r\\n\\r\\n struct Bytes32Slot {\\r\\n bytes32 value;\\r\\n }\\r\\n\\r\\n struct Uint256Slot {\\r\\n uint256 value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\r\\n */\\r\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\r\\n */\\r\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\r\\n */\\r\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\r\\n */\\r\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb61a2a836d1e25029f013b03fa606fb6bcea10a9cc93ee2eb85d47b389d18c74\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\r\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Library for managing\\r\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\r\\n * types.\\r\\n *\\r\\n * Sets have the following properties:\\r\\n *\\r\\n * - Elements are added, removed, and checked for existence in constant time\\r\\n * (O(1)).\\r\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\r\\n *\\r\\n * ```\\r\\n * contract Example {\\r\\n * // Add the library methods\\r\\n * using EnumerableSet for EnumerableSet.AddressSet;\\r\\n *\\r\\n * // Declare a set state variable\\r\\n * EnumerableSet.AddressSet private mySet;\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\r\\n * and `uint256` (`UintSet`) are supported.\\r\\n *\\r\\n * [WARNING]\\r\\n * ====\\r\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\r\\n * unusable.\\r\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\r\\n *\\r\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\r\\n * array of EnumerableSet.\\r\\n * ====\\r\\n */\\r\\nlibrary EnumerableSet {\\r\\n // To implement this library for multiple types with as little code\\r\\n // repetition as possible, we write it in terms of a generic Set type with\\r\\n // bytes32 values.\\r\\n // The Set implementation uses private functions, and user-facing\\r\\n // implementations (such as AddressSet) are just wrappers around the\\r\\n // underlying Set.\\r\\n // This means that we can only create new EnumerableSets for types that fit\\r\\n // in bytes32.\\r\\n\\r\\n struct Set {\\r\\n // Storage of set values\\r\\n bytes32[] _values;\\r\\n // Position of the value in the `values` array, plus 1 because index 0\\r\\n // means a value is not in the set.\\r\\n mapping(bytes32 => uint256) _indexes;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Add a value to a set. O(1).\\r\\n *\\r\\n * Returns true if the value was added to the set, that is if it was not\\r\\n * already present.\\r\\n */\\r\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\r\\n if (!_contains(set, value)) {\\r\\n set._values.push(value);\\r\\n // The value is stored at length-1, but we add 1 to all indexes\\r\\n // and use 0 as a sentinel value\\r\\n set._indexes[value] = set._values.length;\\r\\n return true;\\r\\n } else {\\r\\n return false;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Removes a value from a set. O(1).\\r\\n *\\r\\n * Returns true if the value was removed from the set, that is if it was\\r\\n * present.\\r\\n */\\r\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\r\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\r\\n uint256 valueIndex = set._indexes[value];\\r\\n\\r\\n if (valueIndex != 0) {\\r\\n // Equivalent to contains(set, value)\\r\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\r\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\r\\n // This modifies the order of the array, as noted in {at}.\\r\\n\\r\\n uint256 toDeleteIndex = valueIndex - 1;\\r\\n uint256 lastIndex = set._values.length - 1;\\r\\n\\r\\n if (lastIndex != toDeleteIndex) {\\r\\n bytes32 lastValue = set._values[lastIndex];\\r\\n\\r\\n // Move the last value to the index where the value to delete is\\r\\n set._values[toDeleteIndex] = lastValue;\\r\\n // Update the index for the moved value\\r\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\r\\n }\\r\\n\\r\\n // Delete the slot where the moved value was stored\\r\\n set._values.pop();\\r\\n\\r\\n // Delete the index for the deleted slot\\r\\n delete set._indexes[value];\\r\\n\\r\\n return true;\\r\\n } else {\\r\\n return false;\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns true if the value is in the set. O(1).\\r\\n */\\r\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\r\\n return set._indexes[value] != 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of values on the set. O(1).\\r\\n */\\r\\n function _length(Set storage set) private view returns (uint256) {\\r\\n return set._values.length;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the value stored at position `index` in the set. O(1).\\r\\n *\\r\\n * Note that there are no guarantees on the ordering of values inside the\\r\\n * array, and it may change when more values are added or removed.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `index` must be strictly less than {length}.\\r\\n */\\r\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\r\\n return set._values[index];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the entire set in an array\\r\\n *\\r\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\r\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\r\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\r\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\r\\n */\\r\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\r\\n return set._values;\\r\\n }\\r\\n\\r\\n // Bytes32Set\\r\\n\\r\\n struct Bytes32Set {\\r\\n Set _inner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Add a value to a set. O(1).\\r\\n *\\r\\n * Returns true if the value was added to the set, that is if it was not\\r\\n * already present.\\r\\n */\\r\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\r\\n return _add(set._inner, value);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Removes a value from a set. O(1).\\r\\n *\\r\\n * Returns true if the value was removed from the set, that is if it was\\r\\n * present.\\r\\n */\\r\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\r\\n return _remove(set._inner, value);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns true if the value is in the set. O(1).\\r\\n */\\r\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\r\\n return _contains(set._inner, value);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of values in the set. O(1).\\r\\n */\\r\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\r\\n return _length(set._inner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the value stored at position `index` in the set. O(1).\\r\\n *\\r\\n * Note that there are no guarantees on the ordering of values inside the\\r\\n * array, and it may change when more values are added or removed.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `index` must be strictly less than {length}.\\r\\n */\\r\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\r\\n return _at(set._inner, index);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the entire set in an array\\r\\n *\\r\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\r\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\r\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\r\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\r\\n */\\r\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\r\\n bytes32[] memory store = _values(set._inner);\\r\\n bytes32[] memory result;\\r\\n\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n result := store\\r\\n }\\r\\n\\r\\n return result;\\r\\n }\\r\\n\\r\\n // AddressSet\\r\\n\\r\\n struct AddressSet {\\r\\n Set _inner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Add a value to a set. O(1).\\r\\n *\\r\\n * Returns true if the value was added to the set, that is if it was not\\r\\n * already present.\\r\\n */\\r\\n function add(AddressSet storage set, address value) internal returns (bool) {\\r\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Removes a value from a set. O(1).\\r\\n *\\r\\n * Returns true if the value was removed from the set, that is if it was\\r\\n * present.\\r\\n */\\r\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\r\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns true if the value is in the set. O(1).\\r\\n */\\r\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\r\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of values in the set. O(1).\\r\\n */\\r\\n function length(AddressSet storage set) internal view returns (uint256) {\\r\\n return _length(set._inner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the value stored at position `index` in the set. O(1).\\r\\n *\\r\\n * Note that there are no guarantees on the ordering of values inside the\\r\\n * array, and it may change when more values are added or removed.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `index` must be strictly less than {length}.\\r\\n */\\r\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\r\\n return address(uint160(uint256(_at(set._inner, index))));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the entire set in an array\\r\\n *\\r\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\r\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\r\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\r\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\r\\n */\\r\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\r\\n bytes32[] memory store = _values(set._inner);\\r\\n address[] memory result;\\r\\n\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n result := store\\r\\n }\\r\\n\\r\\n return result;\\r\\n }\\r\\n\\r\\n // UintSet\\r\\n\\r\\n struct UintSet {\\r\\n Set _inner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Add a value to a set. O(1).\\r\\n *\\r\\n * Returns true if the value was added to the set, that is if it was not\\r\\n * already present.\\r\\n */\\r\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\r\\n return _add(set._inner, bytes32(value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Removes a value from a set. O(1).\\r\\n *\\r\\n * Returns true if the value was removed from the set, that is if it was\\r\\n * present.\\r\\n */\\r\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\r\\n return _remove(set._inner, bytes32(value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns true if the value is in the set. O(1).\\r\\n */\\r\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\r\\n return _contains(set._inner, bytes32(value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the number of values in the set. O(1).\\r\\n */\\r\\n function length(UintSet storage set) internal view returns (uint256) {\\r\\n return _length(set._inner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the value stored at position `index` in the set. O(1).\\r\\n *\\r\\n * Note that there are no guarantees on the ordering of values inside the\\r\\n * array, and it may change when more values are added or removed.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `index` must be strictly less than {length}.\\r\\n */\\r\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\r\\n return uint256(_at(set._inner, index));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Return the entire set in an array\\r\\n *\\r\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\r\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\r\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\r\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\r\\n */\\r\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\r\\n bytes32[] memory store = _values(set._inner);\\r\\n uint256[] memory result;\\r\\n\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n result := store\\r\\n }\\r\\n\\r\\n return result;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8d88c669dab804dbc1aa5d683fd9ef598c9a820df114785571d1e2cbe54a7fc9\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/ILiquidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { ICErc20 } from \\\"./compound/CTokenInterfaces.sol\\\";\\r\\nimport \\\"./liquidators/IRedemptionStrategy.sol\\\";\\r\\nimport \\\"./liquidators/IFundsConversionStrategy.sol\\\";\\r\\n\\r\\ninterface ILiquidator {\\r\\n /**\\r\\n * borrower The borrower's Ethereum address.\\r\\n * repayAmount The amount to repay to liquidate the unhealthy loan.\\r\\n * cErc20 The borrowed CErc20 contract to repay.\\r\\n * cTokenCollateral The cToken collateral contract to be liquidated.\\r\\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\\r\\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \\\"special\\\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\\r\\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\\r\\n */\\r\\n struct LiquidateToTokensWithFlashSwapVars {\\r\\n address borrower;\\r\\n uint256 repayAmount;\\r\\n ICErc20 cErc20;\\r\\n ICErc20 cTokenCollateral;\\r\\n address flashSwapContract;\\r\\n uint256 minProfitAmount;\\r\\n IRedemptionStrategy[] redemptionStrategies;\\r\\n bytes[] strategyData;\\r\\n IFundsConversionStrategy[] debtFundingStrategies;\\r\\n bytes[] debtFundingStrategiesData;\\r\\n }\\r\\n\\r\\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\\r\\n\\r\\n function safeLiquidate(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n ICErc20 cErc20,\\r\\n ICErc20 cTokenCollateral,\\r\\n uint256 minOutputAmount\\r\\n ) external returns (uint256);\\r\\n\\r\\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\\r\\n external\\r\\n returns (uint256);\\r\\n\\r\\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\\r\\n\\r\\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\\r\\n external;\\r\\n\\r\\n function setExpressRelay(address _expressRelay) external;\\r\\n\\r\\n function setPoolLens(address _poolLens) external;\\r\\n\\r\\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x3f2b340419b73f137dab6a50a9fd68f887254bca4cc4bfade2c705cbcbaca995\",\"license\":\"MIT\"},\"contracts/IonicUniV3Liquidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\\\";\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\r\\n\\r\\nimport \\\"./liquidators/IRedemptionStrategy.sol\\\";\\r\\nimport \\\"./liquidators/IFundsConversionStrategy.sol\\\";\\r\\nimport \\\"./ILiquidator.sol\\\";\\r\\n\\r\\nimport \\\"./external/uniswap/IUniswapV3FlashCallback.sol\\\";\\r\\nimport \\\"./external/uniswap/IUniswapV3Pool.sol\\\";\\r\\nimport \\\"./external/pyth/IExpressRelay.sol\\\";\\r\\nimport \\\"./external/pyth/IExpressRelayFeeReceiver.sol\\\";\\r\\nimport { IUniswapV3Quoter } from \\\"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\\\";\\r\\nimport { IFlashLoanReceiver } from \\\"./ionic/IFlashLoanReceiver.sol\\\";\\r\\n\\r\\nimport { ICErc20 } from \\\"./compound/CTokenInterfaces.sol\\\";\\r\\n\\r\\nimport \\\"./PoolLens.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title IonicUniV3Liquidator\\r\\n * @author Veliko Minkov (https://github.com/vminkov)\\r\\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\\r\\n */\\r\\ncontract IonicUniV3Liquidator is\\r\\n OwnableUpgradeable,\\r\\n ILiquidator,\\r\\n IUniswapV3FlashCallback,\\r\\n IExpressRelayFeeReceiver,\\r\\n IFlashLoanReceiver\\r\\n{\\r\\n using AddressUpgradeable for address payable;\\r\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\r\\n\\r\\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\\r\\n /**\\r\\n * @dev Cached liquidator profit exchange source.\\r\\n * ERC20 token address or the zero address for NATIVE.\\r\\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\\r\\n */\\r\\n address private _liquidatorProfitExchangeSource;\\r\\n\\r\\n /**\\r\\n * @dev Cached flash swap amount.\\r\\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\\r\\n */\\r\\n uint256 private _flashSwapAmount;\\r\\n\\r\\n /**\\r\\n * @dev Cached flash swap token.\\r\\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\\r\\n */\\r\\n address private _flashSwapToken;\\r\\n\\r\\n address public W_NATIVE_ADDRESS;\\r\\n mapping(address => bool) public redemptionStrategiesWhitelist;\\r\\n IUniswapV3Quoter public quoter;\\r\\n\\r\\n /**\\r\\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\\r\\n */\\r\\n IExpressRelay public expressRelay;\\r\\n /**\\r\\n * @dev Pool Lens.\\r\\n */\\r\\n PoolLens public lens;\\r\\n /**\\r\\n * @dev Health Factor below which PER permissioning is bypassed.\\r\\n */\\r\\n uint256 public healthFactorThreshold;\\r\\n\\r\\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\\r\\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\\r\\n require(currentHealthFactor < healthFactorThreshold, \\\"HF not low enough, reserving for PYTH\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n function initialize(address _wtoken, address _quoter) external initializer {\\r\\n __Ownable_init();\\r\\n W_NATIVE_ADDRESS = _wtoken;\\r\\n quoter = IUniswapV3Quoter(_quoter);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\\r\\n * @param borrower The borrower's Ethereum address.\\r\\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\\r\\n * @param cErc20 The borrowed cErc20 to repay.\\r\\n * @param cTokenCollateral The cToken collateral to be liquidated.\\r\\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\\r\\n */\\r\\n function _safeLiquidate(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n ICErc20 cErc20,\\r\\n ICErc20 cTokenCollateral,\\r\\n uint256 minOutputAmount\\r\\n ) internal returns (uint256) {\\r\\n // Transfer tokens in, approve to cErc20, and liquidate borrow\\r\\n require(repayAmount > 0, \\\"Repay amount (transaction value) must be greater than 0.\\\");\\r\\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\\r\\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\\r\\n underlying.approve(address(cErc20), repayAmount);\\r\\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \\\"Liquidation failed.\\\");\\r\\n\\r\\n // Redeem seized cTokens for underlying asset\\r\\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\\r\\n require(seizedCTokenAmount > 0, \\\"No cTokens seized.\\\");\\r\\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\\r\\n require(redeemResult == 0, \\\"Error calling redeeming seized cToken: error code not equal to 0\\\");\\r\\n\\r\\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\\r\\n }\\r\\n\\r\\n function safeLiquidate(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n ICErc20 cErc20,\\r\\n ICErc20 cTokenCollateral,\\r\\n uint256 minOutputAmount\\r\\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\\r\\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\\r\\n }\\r\\n\\r\\n function safeLiquidatePyth(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n ICErc20 cErc20,\\r\\n ICErc20 cTokenCollateral,\\r\\n uint256 minOutputAmount\\r\\n ) external returns (uint256) {\\r\\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \\\"invalid liquidation\\\");\\r\\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\\r\\n }\\r\\n\\r\\n function safeLiquidateWithAggregator(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n ICErc20 cErc20,\\r\\n ICErc20 cTokenCollateral,\\r\\n address aggregatorTarget,\\r\\n bytes memory aggregatorData\\r\\n ) external {\\r\\n // Transfer tokens in, approve to cErc20, and liquidate borrow\\r\\n require(repayAmount > 0, \\\"Repay amount (transaction value) must be greater than 0.\\\");\\r\\n cErc20.flash(\\r\\n repayAmount,\\r\\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\\r\\n );\\r\\n }\\r\\n\\r\\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\\r\\n (\\r\\n address borrower,\\r\\n ICErc20 cErc20,\\r\\n ICErc20 cTokenCollateral,\\r\\n address aggregatorTarget,\\r\\n bytes memory aggregatorData,\\r\\n address liquidator\\r\\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\\r\\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\\r\\n underlyingBorrow.approve(address(cErc20), amount);\\r\\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \\\"Liquidation failed.\\\");\\r\\n\\r\\n // Redeem seized cTokens for underlying asset\\r\\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\\r\\n {\\r\\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\\r\\n require(seizedCTokenAmount > 0, \\\"No cTokens seized.\\\");\\r\\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\\r\\n require(redeemResult == 0, \\\"Error calling redeeming seized cToken: error code not equal to 0\\\");\\r\\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\\r\\n\\r\\n // Call the aggregator\\r\\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\\r\\n (bool success, ) = aggregatorTarget.call(aggregatorData);\\r\\n require(success, \\\"Aggregator call failed\\\");\\r\\n }\\r\\n\\r\\n // receive profits\\r\\n {\\r\\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\\r\\n require(receivedAmount >= amount, \\\"Not received enough collateral after swap.\\\");\\r\\n uint256 profitBorrow = receivedAmount - amount;\\r\\n if (profitBorrow > 0) {\\r\\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\\r\\n }\\r\\n\\r\\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\\r\\n if (profitCollateral > 0) {\\r\\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\\r\\n }\\r\\n }\\r\\n\\r\\n // pay back flashloan\\r\\n underlyingBorrow.approve(address(cErc20), amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers seized funds to the sender.\\r\\n * @param erc20Contract The address of the token to transfer.\\r\\n * @param minOutputAmount The minimum amount to transfer.\\r\\n */\\r\\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\\r\\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\\r\\n uint256 seizedOutputAmount = token.balanceOf(address(this));\\r\\n require(seizedOutputAmount >= minOutputAmount, \\\"Minimum token output amount not satified.\\\");\\r\\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\\r\\n\\r\\n return seizedOutputAmount;\\r\\n }\\r\\n\\r\\n function safeLiquidateToTokensWithFlashLoan(\\r\\n LiquidateToTokensWithFlashSwapVars calldata vars\\r\\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\\r\\n // Input validation\\r\\n require(vars.repayAmount > 0, \\\"Repay amount must be greater than 0.\\\");\\r\\n\\r\\n // we want to calculate the needed flashSwapAmount on-chain to\\r\\n // avoid errors due to changing market conditions\\r\\n // between the time of calculating and including the tx in a block\\r\\n uint256 fundingAmount = vars.repayAmount;\\r\\n IERC20Upgradeable fundingToken;\\r\\n if (vars.debtFundingStrategies.length > 0) {\\r\\n require(\\r\\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\\r\\n \\\"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\\\"\\r\\n );\\r\\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\\r\\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\\r\\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\\r\\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\\r\\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\\r\\n }\\r\\n } else {\\r\\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\\r\\n }\\r\\n\\r\\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\\r\\n _flashSwapAmount = fundingAmount;\\r\\n _flashSwapToken = address(fundingToken);\\r\\n\\r\\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\\r\\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\\r\\n flashSwapPool.flash(\\r\\n address(this),\\r\\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\\r\\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\\r\\n msg.data\\r\\n );\\r\\n\\r\\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Receives NATIVE from liquidations and flashloans.\\r\\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\\r\\n */\\r\\n receive() external payable {\\r\\n require(payable(msg.sender).isContract(), \\\"Sender is not a contract.\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice receiveAuctionProceedings function - receives native token from the express relay\\r\\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\\r\\n */\\r\\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\\r\\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\\r\\n }\\r\\n\\r\\n function withdrawAll() external onlyOwner {\\r\\n uint256 balance = address(this).balance;\\r\\n require(balance > 0, \\\"No Ether left to withdraw\\\");\\r\\n\\r\\n // Transfer all Ether to the owner\\r\\n (bool sent, ) = msg.sender.call{ value: balance }(\\\"\\\");\\r\\n require(sent, \\\"Failed to send Ether\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Callback function for Uniswap flashloans.\\r\\n */\\r\\n\\r\\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\\r\\n uniswapV3FlashCallback(fee0, fee1, data);\\r\\n }\\r\\n\\r\\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\\r\\n uniswapV3FlashCallback(fee0, fee1, data);\\r\\n }\\r\\n\\r\\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\\r\\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\\r\\n // Decode params\\r\\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\\r\\n\\r\\n // Post token flashloan\\r\\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\\r\\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\\r\\n */\\r\\n function postFlashLoanTokens(\\r\\n LiquidateToTokensWithFlashSwapVars memory vars,\\r\\n uint256 fee0,\\r\\n uint256 fee1\\r\\n ) private returns (address) {\\r\\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\\r\\n uint256 debtRepaymentAmount = _flashSwapAmount;\\r\\n\\r\\n if (vars.debtFundingStrategies.length > 0) {\\r\\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\\r\\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\\r\\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\\r\\n debtRepaymentToken,\\r\\n debtRepaymentAmount,\\r\\n vars.debtFundingStrategies[i - 1],\\r\\n vars.debtFundingStrategiesData[i - 1]\\r\\n );\\r\\n }\\r\\n }\\r\\n\\r\\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\\r\\n {\\r\\n address underlyingBorrow = vars.cErc20.underlying();\\r\\n require(\\r\\n address(debtRepaymentToken) == underlyingBorrow,\\r\\n \\\"the debt repayment funds should be converted to the underlying debt token\\\"\\r\\n );\\r\\n require(debtRepaymentAmount >= vars.repayAmount, \\\"debt repayment amount not enough\\\");\\r\\n // Approve repayAmount to cErc20\\r\\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\\r\\n\\r\\n // Liquidate borrow\\r\\n require(\\r\\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\\r\\n \\\"Liquidation failed.\\\"\\r\\n );\\r\\n\\r\\n // Redeem seized cTokens for underlying asset\\r\\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\\r\\n require(seizedCTokenAmount > 0, \\\"No cTokens seized.\\\");\\r\\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\\r\\n require(redeemResult == 0, \\\"Error calling redeeming seized cToken: error code not equal to 0\\\");\\r\\n }\\r\\n\\r\\n // Repay flashloan\\r\\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Repays token flashloans.\\r\\n */\\r\\n function repayTokenFlashLoan(\\r\\n ICErc20 cTokenCollateral,\\r\\n IRedemptionStrategy[] memory redemptionStrategies,\\r\\n bytes[] memory strategyData,\\r\\n uint256 fee0,\\r\\n uint256 fee1\\r\\n ) private returns (address) {\\r\\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\\r\\n uint256 flashSwapReturnAmount = _flashSwapAmount;\\r\\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\\r\\n flashSwapReturnAmount += fee0;\\r\\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\\r\\n flashSwapReturnAmount += fee1;\\r\\n } else {\\r\\n revert(\\\"wrong pool or _flashSwapToken\\\");\\r\\n }\\r\\n\\r\\n // Swap cTokenCollateral for cErc20 via Uniswap\\r\\n // Check underlying collateral seized\\r\\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\\r\\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\\r\\n\\r\\n // Redeem custom collateral if liquidation strategy is set\\r\\n if (redemptionStrategies.length > 0) {\\r\\n require(\\r\\n redemptionStrategies.length == strategyData.length,\\r\\n \\\"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\\\"\\r\\n );\\r\\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\\r\\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\\r\\n underlyingCollateral,\\r\\n underlyingCollateralSeized,\\r\\n redemptionStrategies[i],\\r\\n strategyData[i]\\r\\n );\\r\\n }\\r\\n\\r\\n // Check if we can repay directly one of the sides with collateral\\r\\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\\r\\n // Repay flashloan directly with collateral\\r\\n uint256 collateralRequired;\\r\\n if (address(underlyingCollateral) == _flashSwapToken) {\\r\\n // repay the borrowed asset directly\\r\\n collateralRequired = flashSwapReturnAmount;\\r\\n\\r\\n // Repay flashloan\\r\\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\\r\\n } else {\\r\\n // TODO swap within the same pool and then repay the FL to the pool\\r\\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\\r\\n\\r\\n {\\r\\n collateralRequired = quoter.quoteExactOutputSingle(\\r\\n zeroForOne ? pool.token0() : pool.token1(),\\r\\n zeroForOne ? pool.token1() : pool.token0(),\\r\\n pool.fee(),\\r\\n _flashSwapAmount,\\r\\n 0 // sqrtPriceLimitX96\\r\\n );\\r\\n }\\r\\n require(\\r\\n collateralRequired <= underlyingCollateralSeized,\\r\\n \\\"Token flashloan return amount greater than seized collateral.\\\"\\r\\n );\\r\\n\\r\\n // Repay flashloan\\r\\n pool.swap(\\r\\n address(pool),\\r\\n zeroForOne,\\r\\n int256(collateralRequired),\\r\\n 0, // sqrtPriceLimitX96\\r\\n \\\"\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n return address(underlyingCollateral);\\r\\n } else {\\r\\n revert(\\\"the redemptions strategy did not swap to the flash swapped pool assets\\\");\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev for security reasons only whitelisted redemption strategies may be used.\\r\\n * Each whitelisted redemption strategy has to be checked to not be able to\\r\\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\\r\\n */\\r\\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\\r\\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev for security reasons only whitelisted redemption strategies may be used.\\r\\n * Each whitelisted redemption strategy has to be checked to not be able to\\r\\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\\r\\n */\\r\\n function _whitelistRedemptionStrategies(\\r\\n IRedemptionStrategy[] calldata strategies,\\r\\n bool[] calldata whitelisted\\r\\n ) external onlyOwner {\\r\\n require(\\r\\n strategies.length > 0 && strategies.length == whitelisted.length,\\r\\n \\\"list of strategies empty or whitelist does not match its length\\\"\\r\\n );\\r\\n\\r\\n for (uint256 i = 0; i < strategies.length; i++) {\\r\\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\\r\\n }\\r\\n }\\r\\n\\r\\n function setExpressRelay(address _expressRelay) external onlyOwner {\\r\\n expressRelay = IExpressRelay(_expressRelay);\\r\\n }\\r\\n\\r\\n function setPoolLens(address _poolLens) external onlyOwner {\\r\\n lens = PoolLens(_poolLens);\\r\\n }\\r\\n\\r\\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\\r\\n require(_healthFactorThreshold <= 1e18, \\\"Invalid Health Factor Threshold\\\");\\r\\n healthFactorThreshold = _healthFactorThreshold;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Redeem \\\"special\\\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\\r\\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\\r\\n */\\r\\n function redeemCustomCollateral(\\r\\n IERC20Upgradeable underlyingCollateral,\\r\\n uint256 underlyingCollateralSeized,\\r\\n IRedemptionStrategy strategy,\\r\\n bytes memory strategyData\\r\\n ) private returns (IERC20Upgradeable, uint256) {\\r\\n require(redemptionStrategiesWhitelist[address(strategy)], \\\"only whitelisted redemption strategies can be used\\\");\\r\\n\\r\\n bytes memory returndata = _functionDelegateCall(\\r\\n address(strategy),\\r\\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\\r\\n );\\r\\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\\r\\n }\\r\\n\\r\\n function convertCustomFunds(\\r\\n IERC20Upgradeable inputToken,\\r\\n uint256 inputAmount,\\r\\n IFundsConversionStrategy strategy,\\r\\n bytes memory strategyData\\r\\n ) private returns (IERC20Upgradeable, uint256) {\\r\\n require(redemptionStrategiesWhitelist[address(strategy)], \\\"only whitelisted redemption strategies can be used\\\");\\r\\n\\r\\n bytes memory returndata = _functionDelegateCall(\\r\\n address(strategy),\\r\\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\\r\\n );\\r\\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\\r\\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\\r\\n */\\r\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\r\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\r\\n\\r\\n // solhint-disable-next-line avoid-low-level-calls\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return _verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\\r\\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\\r\\n */\\r\\n function _verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) private pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n\\r\\n // solhint-disable-next-line no-inline-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf55a078157fe8e8ed85957fa01df7058b306dd7050cf57b5f9f7b74207ad4561\",\"license\":\"MIT\"},\"contracts/PoolDirectory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\\\";\\r\\n\\r\\nimport { IonicComptroller } from \\\"./compound/ComptrollerInterface.sol\\\";\\r\\nimport { BasePriceOracle } from \\\"./oracles/BasePriceOracle.sol\\\";\\r\\nimport { Unitroller } from \\\"./compound/Unitroller.sol\\\";\\r\\nimport \\\"./ionic/SafeOwnableUpgradeable.sol\\\";\\r\\nimport \\\"./ionic/DiamondExtension.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title PoolDirectory\\r\\n * @author David Lucid (https://github.com/davidlucid)\\r\\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\\r\\n */\\r\\ncontract PoolDirectory is SafeOwnableUpgradeable {\\r\\n /**\\r\\n * @dev Initializes a deployer whitelist if desired.\\r\\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\\r\\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\\r\\n */\\r\\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\\r\\n __SafeOwnable_init(msg.sender);\\r\\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\\r\\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Struct for a Ionic interest rate pool.\\r\\n */\\r\\n struct Pool {\\r\\n string name;\\r\\n address creator;\\r\\n address comptroller;\\r\\n uint256 blockPosted;\\r\\n uint256 timestampPosted;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Array of Ionic interest rate pools.\\r\\n */\\r\\n Pool[] public pools;\\r\\n\\r\\n /**\\r\\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\\r\\n */\\r\\n mapping(address => uint256[]) private _poolsByAccount;\\r\\n\\r\\n /**\\r\\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\\r\\n */\\r\\n mapping(address => bool) public poolExists;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when a new Ionic pool is added to the directory.\\r\\n */\\r\\n event PoolRegistered(uint256 index, Pool pool);\\r\\n\\r\\n /**\\r\\n * @dev Booleans indicating if the deployer whitelist is enforced.\\r\\n */\\r\\n bool public enforceDeployerWhitelist;\\r\\n\\r\\n /**\\r\\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\\r\\n */\\r\\n mapping(address => bool) public deployerWhitelist;\\r\\n\\r\\n /**\\r\\n * @dev Controls if the deployer whitelist is to be enforced.\\r\\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\\r\\n */\\r\\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\\r\\n enforceDeployerWhitelist = enforce;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\\r\\n * @param deployers Array of Ethereum accounts to be whitelisted.\\r\\n * @param status Whether to add or remove the accounts.\\r\\n */\\r\\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\\r\\n require(deployers.length > 0, \\\"No deployers supplied.\\\");\\r\\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\\r\\n * @param name The name of the pool.\\r\\n * @param comptroller The pool's Comptroller proxy contract address.\\r\\n * @return The index of the registered Ionic pool.\\r\\n */\\r\\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\\r\\n require(!poolExists[comptroller], \\\"Pool already exists in the directory.\\\");\\r\\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \\\"Sender is not on deployer whitelist.\\\");\\r\\n require(bytes(name).length <= 100, \\\"No pool name supplied.\\\");\\r\\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\\r\\n pools.push(pool);\\r\\n _poolsByAccount[msg.sender].push(pools.length - 1);\\r\\n poolExists[comptroller] = true;\\r\\n emit PoolRegistered(pools.length - 1, pool);\\r\\n return pools.length - 1;\\r\\n }\\r\\n\\r\\n function _deprecatePool(address comptroller) external onlyOwner {\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n if (pools[i].comptroller == comptroller) {\\r\\n _deprecatePool(i);\\r\\n break;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function _deprecatePool(uint256 index) public onlyOwner {\\r\\n Pool storage ionicPool = pools[index];\\r\\n\\r\\n require(ionicPool.comptroller != address(0), \\\"pool already deprecated\\\");\\r\\n\\r\\n // swap with the last pool of the creator and delete\\r\\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\\r\\n for (uint256 i = 0; i < creatorPools.length; i++) {\\r\\n if (creatorPools[i] == index) {\\r\\n creatorPools[i] = creatorPools[creatorPools.length - 1];\\r\\n creatorPools.pop();\\r\\n break;\\r\\n }\\r\\n }\\r\\n\\r\\n // leave it to true to deny the re-registering of the same pool\\r\\n poolExists[ionicPool.comptroller] = true;\\r\\n\\r\\n // nullify the storage\\r\\n ionicPool.comptroller = address(0);\\r\\n ionicPool.creator = address(0);\\r\\n ionicPool.name = \\\"\\\";\\r\\n ionicPool.blockPosted = 0;\\r\\n ionicPool.timestampPosted = 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deploys a new Ionic pool and adds to the directory.\\r\\n * @param name The name of the pool.\\r\\n * @param implementation The Comptroller implementation contract address.\\r\\n * @param constructorData Encoded construction data for `Unitroller constructor()`\\r\\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\\r\\n * @param closeFactor The pool's close factor (scaled by 1e18).\\r\\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\\r\\n * @param priceOracle The pool's PriceOracle contract address.\\r\\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\\r\\n */\\r\\n function deployPool(\\r\\n string memory name,\\r\\n address implementation,\\r\\n bytes calldata constructorData,\\r\\n bool enforceWhitelist,\\r\\n uint256 closeFactor,\\r\\n uint256 liquidationIncentive,\\r\\n address priceOracle\\r\\n ) external returns (uint256, address) {\\r\\n // Input validation\\r\\n require(implementation != address(0), \\\"No Comptroller implementation contract address specified.\\\");\\r\\n require(priceOracle != address(0), \\\"No PriceOracle contract address specified.\\\");\\r\\n\\r\\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\\r\\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\\r\\n address proxy = Create2Upgradeable.deploy(\\r\\n 0,\\r\\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\\r\\n unitrollerCreationCode\\r\\n );\\r\\n\\r\\n // Setup the pool\\r\\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\\r\\n // Set up the extensions\\r\\n comptrollerProxy._upgrade();\\r\\n\\r\\n // Set pool parameters\\r\\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \\\"Failed to set pool close factor.\\\");\\r\\n require(\\r\\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\\r\\n \\\"Failed to set pool liquidation incentive.\\\"\\r\\n );\\r\\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \\\"Failed to set pool price oracle.\\\");\\r\\n\\r\\n // Whitelist\\r\\n if (enforceWhitelist)\\r\\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \\\"Failed to enforce supplier/borrower whitelist.\\\");\\r\\n\\r\\n // Make msg.sender the admin\\r\\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \\\"Failed to set pending admin on Unitroller.\\\");\\r\\n\\r\\n // Register the pool with this PoolDirectory\\r\\n return (_registerPool(name, proxy), proxy);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\\r\\n uint256 count = 0;\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n if (pools[i].comptroller != address(0)) count++;\\r\\n }\\r\\n\\r\\n Pool[] memory activePools = new Pool[](count);\\r\\n uint256[] memory poolIds = new uint256[](count);\\r\\n\\r\\n uint256 index = 0;\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n if (pools[i].comptroller != address(0)) {\\r\\n poolIds[index] = i;\\r\\n activePools[index] = pools[i];\\r\\n index++;\\r\\n }\\r\\n }\\r\\n\\r\\n return (poolIds, activePools);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all Ionic pools' data.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getAllPools() public view returns (Pool[] memory) {\\r\\n uint256 count = 0;\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n if (pools[i].comptroller != address(0)) count++;\\r\\n }\\r\\n\\r\\n Pool[] memory result = new Pool[](count);\\r\\n\\r\\n uint256 index = 0;\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n if (pools[i].comptroller != address(0)) {\\r\\n result[index++] = pools[i];\\r\\n }\\r\\n }\\r\\n\\r\\n return result;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all public Ionic pool indexes and data.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\\r\\n uint256 arrayLength = 0;\\r\\n\\r\\n (, Pool[] memory activePools) = getActivePools();\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\\r\\n if (enforceWhitelist) continue;\\r\\n } catch {}\\r\\n\\r\\n arrayLength++;\\r\\n }\\r\\n\\r\\n uint256[] memory indexes = new uint256[](arrayLength);\\r\\n Pool[] memory publicPools = new Pool[](arrayLength);\\r\\n uint256 index = 0;\\r\\n\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\\r\\n if (enforceWhitelist) continue;\\r\\n } catch {}\\r\\n\\r\\n indexes[index] = i;\\r\\n publicPools[index] = activePools[i];\\r\\n index++;\\r\\n }\\r\\n\\r\\n return (indexes, publicPools);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all public Ionic pool indexes and data.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\\r\\n uint256 arrayLength = 0;\\r\\n\\r\\n (, Pool[] memory activePools) = getActivePools();\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\\r\\n if (!isUsing) continue;\\r\\n } catch {}\\r\\n\\r\\n arrayLength++;\\r\\n }\\r\\n\\r\\n uint256[] memory indexes = new uint256[](arrayLength);\\r\\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\\r\\n uint256 index = 0;\\r\\n\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\\r\\n if (!isUsing) continue;\\r\\n } catch {}\\r\\n\\r\\n indexes[index] = i;\\r\\n poolsOfUser[index] = activePools[i];\\r\\n index++;\\r\\n }\\r\\n\\r\\n return (indexes, poolsOfUser);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\\r\\n */\\r\\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\\r\\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\\r\\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\\r\\n (, Pool[] memory activePools) = getActivePools();\\r\\n\\r\\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\\r\\n indexes[i] = _poolsByAccount[account][i];\\r\\n accountPools[i] = activePools[_poolsByAccount[account][i]];\\r\\n }\\r\\n\\r\\n return (indexes, accountPools);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Modify existing Ionic pool name.\\r\\n */\\r\\n function setPoolName(uint256 index, string calldata name) external {\\r\\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\\r\\n require(\\r\\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\\r\\n \\\"!permission\\\"\\r\\n );\\r\\n pools[index].name = name;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\\r\\n */\\r\\n mapping(address => bool) public adminWhitelist;\\r\\n\\r\\n /**\\r\\n * @dev used as salt for the creation of new pools\\r\\n */\\r\\n uint256 public poolsCounter;\\r\\n\\r\\n /**\\r\\n * @dev Event emitted when the admin whitelist is updated.\\r\\n */\\r\\n event AdminWhitelistUpdated(address[] admins, bool status);\\r\\n\\r\\n /**\\r\\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\\r\\n * @param admins Array of Ethereum accounts to be whitelisted.\\r\\n * @param status Whether to add or remove the accounts.\\r\\n */\\r\\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\\r\\n require(admins.length > 0, \\\"No admins supplied.\\\");\\r\\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\\r\\n emit AdminWhitelistUpdated(admins, status);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\\r\\n uint256 arrayLength = 0;\\r\\n\\r\\n (, Pool[] memory activePools) = getActivePools();\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\\r\\n\\r\\n try comptroller.admin() returns (address admin) {\\r\\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\\r\\n } catch {}\\r\\n\\r\\n arrayLength++;\\r\\n }\\r\\n\\r\\n uint256[] memory indexes = new uint256[](arrayLength);\\r\\n Pool[] memory publicPools = new Pool[](arrayLength);\\r\\n uint256 index = 0;\\r\\n\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\\r\\n\\r\\n try comptroller.admin() returns (address admin) {\\r\\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\\r\\n } catch {}\\r\\n\\r\\n indexes[index] = i;\\r\\n publicPools[index] = activePools[i];\\r\\n index++;\\r\\n }\\r\\n\\r\\n return (indexes, publicPools);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\\r\\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getVerifiedPoolsOfWhitelistedAccount(\\r\\n address account\\r\\n ) external view returns (uint256[] memory, Pool[] memory) {\\r\\n uint256 arrayLength = 0;\\r\\n (, Pool[] memory activePools) = getActivePools();\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\\r\\n\\r\\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\\r\\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\\r\\n } catch {}\\r\\n\\r\\n arrayLength++;\\r\\n }\\r\\n\\r\\n uint256[] memory indexes = new uint256[](arrayLength);\\r\\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\\r\\n uint256 index = 0;\\r\\n\\r\\n for (uint256 i = 0; i < activePools.length; i++) {\\r\\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\\r\\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\\r\\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\\r\\n } catch {}\\r\\n\\r\\n indexes[index] = i;\\r\\n accountWhitelistedPools[index] = activePools[i];\\r\\n index++;\\r\\n }\\r\\n\\r\\n return (indexes, accountWhitelistedPools);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xe9bb4c31e9754eee3efb8be80bea9cb52f4a49732373ffd9de5426338d86bb62\",\"license\":\"MIT\"},\"contracts/PoolLens.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\\\";\\r\\n\\r\\nimport { IonicComptroller } from \\\"./compound/ComptrollerInterface.sol\\\";\\r\\nimport { BasePriceOracle } from \\\"./oracles/BasePriceOracle.sol\\\";\\r\\nimport { ICErc20 } from \\\"./compound/CTokenInterfaces.sol\\\";\\r\\n\\r\\nimport { PoolDirectory } from \\\"./PoolDirectory.sol\\\";\\r\\nimport { MasterPriceOracle } from \\\"./oracles/MasterPriceOracle.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title PoolLens\\r\\n * @author David Lucid (https://github.com/davidlucid)\\r\\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\\r\\n */\\r\\ncontract PoolLens is Initializable {\\r\\n error ComptrollerError(uint256 errCode);\\r\\n\\r\\n /**\\r\\n * @notice Initialize the `PoolDirectory` contract object.\\r\\n * @param _directory The PoolDirectory\\r\\n * @param _name Name for the nativeToken\\r\\n * @param _symbol Symbol for the nativeToken\\r\\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\\r\\n * @param _hardcodedNames Harcoded name for these tokens\\r\\n * @param _hardcodedSymbols Harcoded symbol for these tokens\\r\\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\\r\\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\\r\\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\\r\\n */\\r\\n function initialize(\\r\\n PoolDirectory _directory,\\r\\n string memory _name,\\r\\n string memory _symbol,\\r\\n address[] memory _hardcodedAddresses,\\r\\n string[] memory _hardcodedNames,\\r\\n string[] memory _hardcodedSymbols,\\r\\n string[] memory _uniswapLPTokenNames,\\r\\n string[] memory _uniswapLPTokenSymbols,\\r\\n string[] memory _uniswapLPTokenDisplayNames\\r\\n ) public initializer {\\r\\n require(address(_directory) != address(0), \\\"PoolDirectory instance cannot be the zero address.\\\");\\r\\n require(\\r\\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\\r\\n \\\"Hardcoded addresses lengths not equal.\\\"\\r\\n );\\r\\n require(\\r\\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\\r\\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\\r\\n \\\"Uniswap LP token names lengths not equal.\\\"\\r\\n );\\r\\n\\r\\n directory = _directory;\\r\\n name = _name;\\r\\n symbol = _symbol;\\r\\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\\r\\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\\r\\n }\\r\\n\\r\\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\\r\\n uniswapData.push(\\r\\n UniswapData({\\r\\n name: _uniswapLPTokenNames[i],\\r\\n symbol: _uniswapLPTokenSymbols[i],\\r\\n displayName: _uniswapLPTokenDisplayNames[i]\\r\\n })\\r\\n );\\r\\n }\\r\\n }\\r\\n\\r\\n string public name;\\r\\n string public symbol;\\r\\n\\r\\n struct TokenData {\\r\\n string name;\\r\\n string symbol;\\r\\n }\\r\\n mapping(address => TokenData) hardcoded;\\r\\n\\r\\n struct UniswapData {\\r\\n string name; // ie \\\"Uniswap V2\\\" or \\\"SushiSwap LP Token\\\"\\r\\n string symbol; // ie \\\"UNI-V2\\\" or \\\"SLP\\\"\\r\\n string displayName; // ie \\\"SushiSwap\\\" or \\\"Uniswap\\\"\\r\\n }\\r\\n UniswapData[] uniswapData;\\r\\n\\r\\n /**\\r\\n * @notice `PoolDirectory` contract object.\\r\\n */\\r\\n PoolDirectory public directory;\\r\\n\\r\\n /**\\r\\n * @dev Struct for Ionic pool summary data.\\r\\n */\\r\\n struct IonicPoolData {\\r\\n uint256 totalSupply;\\r\\n uint256 totalBorrow;\\r\\n address[] underlyingTokens;\\r\\n string[] underlyingSymbols;\\r\\n bool whitelistedAdmin;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n */\\r\\n function getPublicPoolsWithData()\\r\\n external\\r\\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\\r\\n {\\r\\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\\r\\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\\r\\n return (indexes, publicPools, data, errored);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n */\\r\\n function getPublicPoolsByVerificationWithData(\\r\\n bool whitelistedAdmin\\r\\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\\r\\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\\r\\n whitelistedAdmin\\r\\n );\\r\\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\\r\\n return (indexes, publicPools, data, errored);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n */\\r\\n function getPoolsByAccountWithData(\\r\\n address account\\r\\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\\r\\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\\r\\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\\r\\n return (indexes, accountPools, data, errored);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n */\\r\\n function getPoolsOIonicrWithData(\\r\\n address user\\r\\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\\r\\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\\r\\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\\r\\n return (indexes, userPools, data, errored);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n */\\r\\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\\r\\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\\r\\n bool[] memory errored = new bool[](pools.length);\\r\\n\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\\r\\n uint256 _totalSupply,\\r\\n uint256 _totalBorrow,\\r\\n address[] memory _underlyingTokens,\\r\\n string[] memory _underlyingSymbols,\\r\\n bool _whitelistedAdmin\\r\\n ) {\\r\\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\\r\\n } catch {\\r\\n errored[i] = true;\\r\\n }\\r\\n }\\r\\n\\r\\n return (data, errored);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\\r\\n */\\r\\n function getPoolSummary(\\r\\n IonicComptroller comptroller\\r\\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\\r\\n uint256 totalBorrow = 0;\\r\\n uint256 totalSupply = 0;\\r\\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\\r\\n address[] memory underlyingTokens = new address[](cTokens.length);\\r\\n string[] memory underlyingSymbols = new string[](cTokens.length);\\r\\n BasePriceOracle oracle = comptroller.oracle();\\r\\n\\r\\n for (uint256 i = 0; i < cTokens.length; i++) {\\r\\n ICErc20 cToken = cTokens[i];\\r\\n (bool isListed, ) = comptroller.markets(address(cToken));\\r\\n if (!isListed) continue;\\r\\n cToken.accrueInterest();\\r\\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\\r\\n uint256 assetTotalSupply = cToken.getCash() +\\r\\n assetTotalBorrow -\\r\\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\\r\\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\\r\\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\\r\\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\\r\\n\\r\\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\\r\\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\\r\\n }\\r\\n\\r\\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\\r\\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Struct for a Ionic pool asset.\\r\\n */\\r\\n struct PoolAsset {\\r\\n address cToken;\\r\\n address underlyingToken;\\r\\n string underlyingName;\\r\\n string underlyingSymbol;\\r\\n uint256 underlyingDecimals;\\r\\n uint256 underlyingBalance;\\r\\n uint256 supplyRatePerBlock;\\r\\n uint256 borrowRatePerBlock;\\r\\n uint256 totalSupply;\\r\\n uint256 totalBorrow;\\r\\n uint256 supplyBalance;\\r\\n uint256 borrowBalance;\\r\\n uint256 liquidity;\\r\\n bool membership;\\r\\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\\r\\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\\r\\n address oracle;\\r\\n uint256 collateralFactor;\\r\\n uint256 reserveFactor;\\r\\n uint256 adminFee;\\r\\n uint256 ionicFee;\\r\\n bool borrowGuardianPaused;\\r\\n bool mintGuardianPaused;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns data on the specified assets of the specified Ionic pool.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\\r\\n * @param cTokens The cToken contract addresses of the assets to query.\\r\\n * @param user The user for which to get account data.\\r\\n * @return An array of Ionic pool assets.\\r\\n */\\r\\n function getPoolAssetsWithData(\\r\\n IonicComptroller comptroller,\\r\\n ICErc20[] memory cTokens,\\r\\n address user\\r\\n ) internal returns (PoolAsset[] memory) {\\r\\n uint256 arrayLength = 0;\\r\\n\\r\\n for (uint256 i = 0; i < cTokens.length; i++) {\\r\\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\\r\\n if (isListed) arrayLength++;\\r\\n }\\r\\n\\r\\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\\r\\n uint256 index = 0;\\r\\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\\r\\n\\r\\n for (uint256 i = 0; i < cTokens.length; i++) {\\r\\n // Check if market is listed and get collateral factor\\r\\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\\r\\n if (!isListed) continue;\\r\\n\\r\\n // Start adding data to PoolAsset\\r\\n PoolAsset memory asset;\\r\\n ICErc20 cToken = cTokens[i];\\r\\n asset.cToken = address(cToken);\\r\\n\\r\\n cToken.accrueInterest();\\r\\n\\r\\n // Get underlying asset data\\r\\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\\r\\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\\r\\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\\r\\n asset.underlyingDecimals = underlying.decimals();\\r\\n asset.underlyingBalance = underlying.balanceOf(user);\\r\\n\\r\\n // Get cToken data\\r\\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\\r\\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\\r\\n asset.liquidity = cToken.getCash();\\r\\n asset.totalBorrow = cToken.totalBorrowsCurrent();\\r\\n asset.totalSupply =\\r\\n asset.liquidity +\\r\\n asset.totalBorrow -\\r\\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\\r\\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\\r\\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\\r\\n asset.membership = comptroller.checkMembership(user, cToken);\\r\\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\\r\\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\\r\\n\\r\\n // Get oracle for this cToken\\r\\n asset.oracle = address(oracle);\\r\\n\\r\\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\\r\\n asset.oracle = address(_oracle);\\r\\n } catch {}\\r\\n\\r\\n // More cToken data\\r\\n asset.collateralFactor = collateralFactorMantissa;\\r\\n asset.reserveFactor = cToken.reserveFactorMantissa();\\r\\n asset.adminFee = cToken.adminFeeMantissa();\\r\\n asset.ionicFee = cToken.ionicFeeMantissa();\\r\\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\\r\\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\\r\\n\\r\\n // Add to assets array and increment index\\r\\n detailedAssets[index] = asset;\\r\\n index++;\\r\\n }\\r\\n\\r\\n return (detailedAssets);\\r\\n }\\r\\n\\r\\n function getBorrowCapsPerCollateral(\\r\\n ICErc20 borrowedAsset,\\r\\n IonicComptroller comptroller\\r\\n )\\r\\n internal\\r\\n view\\r\\n returns (\\r\\n address[] memory collateral,\\r\\n uint256[] memory borrowCapsAgainstCollateral,\\r\\n bool[] memory borrowingBlacklistedAgainstCollateral\\r\\n )\\r\\n {\\r\\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\\r\\n\\r\\n collateral = new address[](poolMarkets.length);\\r\\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\\r\\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\\r\\n\\r\\n for (uint256 i = 0; i < poolMarkets.length; i++) {\\r\\n address collateralAddress = address(poolMarkets[i]);\\r\\n if (collateralAddress != address(borrowedAsset)) {\\r\\n collateral[i] = collateralAddress;\\r\\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\\r\\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\\r\\n address(borrowedAsset),\\r\\n collateralAddress\\r\\n );\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns the `name` and `symbol` of `token`.\\r\\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\\r\\n * @param token An ERC20 token contract object.\\r\\n * @return The `name` and `symbol`.\\r\\n */\\r\\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\\r\\n // i.e. MKR is a DSToken and uses bytes32\\r\\n if (bytes(hardcoded[token].symbol).length != 0) {\\r\\n return (hardcoded[token].name, hardcoded[token].symbol);\\r\\n }\\r\\n\\r\\n // Get name and symbol from token contract\\r\\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\\r\\n string memory _name = tokenContract.name();\\r\\n string memory _symbol = tokenContract.symbol();\\r\\n\\r\\n return (_name, _symbol);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns the assets of the specified Ionic pool.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\\r\\n * @return An array of Ionic pool assets.\\r\\n */\\r\\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\\r\\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Struct for a Ionic pool user.\\r\\n */\\r\\n struct IonicPoolUser {\\r\\n address account;\\r\\n uint256 totalBorrow;\\r\\n uint256 totalCollateral;\\r\\n uint256 health;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of PoolAsset for a specific user\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\\r\\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\\r\\n return assets;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice returns the total supply cap for each asset in the pool\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\\r\\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\\r\\n\\r\\n address[] memory assets = new address[](poolMarkets.length);\\r\\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\\r\\n for (uint256 i = 0; i < poolMarkets.length; i++) {\\r\\n assets[i] = address(poolMarkets[i]);\\r\\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\\r\\n }\\r\\n\\r\\n return (assets, supplyCapsPerAsset);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getSupplyCapsDataForPool(\\r\\n IonicComptroller comptroller\\r\\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\\r\\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\\r\\n\\r\\n address[] memory assets = new address[](poolMarkets.length);\\r\\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\\r\\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\\r\\n for (uint256 i = 0; i < poolMarkets.length; i++) {\\r\\n assets[i] = address(poolMarkets[i]);\\r\\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\\r\\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\\r\\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\\r\\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\\r\\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\\r\\n }\\r\\n\\r\\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getBorrowCapsForAsset(\\r\\n ICErc20 asset\\r\\n )\\r\\n public\\r\\n view\\r\\n returns (\\r\\n address[] memory collateral,\\r\\n uint256[] memory borrowCapsPerCollateral,\\r\\n bool[] memory collateralBlacklisted,\\r\\n uint256 totalBorrowCap\\r\\n )\\r\\n {\\r\\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\\r\\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\\r\\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getBorrowCapsDataForAsset(\\r\\n ICErc20 asset\\r\\n )\\r\\n public\\r\\n view\\r\\n returns (\\r\\n address[] memory collateral,\\r\\n uint256[] memory borrowCapsPerCollateral,\\r\\n bool[] memory collateralBlacklisted,\\r\\n uint256 totalBorrowCap,\\r\\n uint256 nonWhitelistedTotalBorrows\\r\\n )\\r\\n {\\r\\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\\r\\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\\r\\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\\r\\n uint256 totalBorrows = asset.totalBorrowsCurrent();\\r\\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\\r\\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\\r\\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\\r\\n * Note that the whitelist does not have to be enforced.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n */\\r\\n function getWhitelistedPoolsByAccount(\\r\\n address account\\r\\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\\r\\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\\r\\n uint256 arrayLength = 0;\\r\\n\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\\r\\n\\r\\n if (comptroller.whitelist(account)) arrayLength++;\\r\\n }\\r\\n\\r\\n uint256[] memory indexes = new uint256[](arrayLength);\\r\\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\\r\\n uint256 index = 0;\\r\\n\\r\\n for (uint256 i = 0; i < pools.length; i++) {\\r\\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\\r\\n\\r\\n if (comptroller.whitelist(account)) {\\r\\n indexes[index] = i;\\r\\n accountPools[index] = pools[i];\\r\\n index++;\\r\\n break;\\r\\n }\\r\\n }\\r\\n\\r\\n return (indexes, accountPools);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\\r\\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\\r\\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\\r\\n */\\r\\n function getWhitelistedPoolsByAccountWithData(\\r\\n address account\\r\\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\\r\\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\\r\\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\\r\\n return (indexes, accountPools, data, errored);\\r\\n }\\r\\n\\r\\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\\r\\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\\r\\n }\\r\\n\\r\\n function getHealthFactorHypothetical(\\r\\n IonicComptroller pool,\\r\\n address account,\\r\\n address cTokenModify,\\r\\n uint256 redeemTokens,\\r\\n uint256 borrowAmount,\\r\\n uint256 repayAmount\\r\\n ) public view returns (uint256) {\\r\\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\\r\\n account,\\r\\n cTokenModify,\\r\\n redeemTokens,\\r\\n borrowAmount,\\r\\n repayAmount\\r\\n );\\r\\n\\r\\n if (err != 0) revert ComptrollerError(err);\\r\\n\\r\\n if (shortfall > 0) {\\r\\n // HF < 1.0\\r\\n return (collateralValue * 1e18) / (collateralValue + shortfall);\\r\\n } else {\\r\\n // HF >= 1.0\\r\\n if (collateralValue <= liquidity) return type(uint256).max;\\r\\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5b6d96afad160740c329f092949bc6659da9feb919affe30a32db4db990344c0\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nlibrary PrudentiaLib {\\r\\n struct PrudentiaConfig {\\r\\n address controller; // Adrastia Prudentia controller address\\r\\n uint8 offset; // Offset for delayed rate activation\\r\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x73ceb0717c7795db9d43c13e729e7f76e1cab444d845fc9897a34b8bf7909096\",\"license\":\"UNLICENSED\"},\"contracts/compound/CErc20Delegate.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./CToken.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title Compound's CErc20Delegate Contract\\r\\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\\r\\n * @author Compound\\r\\n */\\r\\ncontract CErc20Delegate is CErc20 {\\r\\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\\r\\n uint8 fnsCount = 3;\\r\\n\\r\\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\\r\\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\\r\\n\\r\\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\\r\\n functionSelectors[i] = superFunctionSelectors[i];\\r\\n }\\r\\n\\r\\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\\r\\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\\r\\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\\r\\n\\r\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Called by the delegator on a delegate to initialize it for duty\\r\\n */\\r\\n function _becomeImplementation(bytes memory) public virtual override {\\r\\n require(msg.sender == address(this) || hasAdminRights(), \\\"!self || !admin\\\");\\r\\n }\\r\\n\\r\\n function delegateType() public pure virtual override returns (uint8) {\\r\\n return 1;\\r\\n }\\r\\n\\r\\n function contractType() external pure virtual override returns (string memory) {\\r\\n return \\\"CErc20Delegate\\\";\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb1157cca59b3ff316e58b25b8b4f0118930207f2dcea51eb0bcf6f495538143f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CErc20RewardsDelegate.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./CErc20Delegate.sol\\\";\\r\\nimport \\\"./EIP20Interface.sol\\\";\\r\\n\\r\\ncontract CErc20RewardsDelegate is CErc20Delegate {\\r\\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\\r\\n uint8 fnsCount = 2;\\r\\n\\r\\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\\r\\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\\r\\n\\r\\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\\r\\n functionSelectors[i] = superFunctionSelectors[i];\\r\\n }\\r\\n\\r\\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\\r\\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\\r\\n\\r\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\r\\n }\\r\\n \\r\\n /// @notice A reward token claim function\\r\\n /// to be overridden for use cases where rewardToken needs to be pulled in\\r\\n function claim() external {}\\r\\n\\r\\n /// @notice token approval function\\r\\n function approve(address _token, address _spender) external {\\r\\n require(hasAdminRights(), \\\"!admin\\\");\\r\\n require(_token != underlying, \\\"!underlying\\\");\\r\\n\\r\\n EIP20Interface(_token).approve(_spender, type(uint256).max);\\r\\n }\\r\\n\\r\\n function delegateType() public pure virtual override returns (uint8) {\\r\\n return 3;\\r\\n }\\r\\n\\r\\n function contractType() external pure override returns (string memory) {\\r\\n return \\\"CErc20RewardsDelegate\\\";\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x30601fe5c9082b405aa975665dc989acd7caeb35f36c7c8f0d89851d4f6e4d21\",\"license\":\"UNLICENSED\"},\"contracts/compound/CErc20RewardsDelegateMorpho.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./CErc20RewardsDelegate.sol\\\";\\r\\n\\r\\ncontract CErc20RewardsDelegateMorpho is CErc20Delegate {\\r\\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\\r\\n\\r\\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\\r\\n uint8 fnsCount = 1;\\r\\n\\r\\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\\r\\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\\r\\n\\r\\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\\r\\n functionSelectors[i] = superFunctionSelectors[i];\\r\\n }\\r\\n\\r\\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\\r\\n\\r\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\\r\\n * @param rewardToken The reward strategy for which the rewards are being claimed.\\r\\n * @param claimable The amount of tokens to claim and forward.\\r\\n * @param proof The proof required to validate the claim.\\r\\n * @dev Only callable by the governance.\\r\\n */\\r\\n function claim(\\r\\n address morphoURD,\\r\\n address rewardToken,\\r\\n address distributor,\\r\\n uint256 claimable,\\r\\n bytes32[] memory proof\\r\\n ) external isAuthorized {\\r\\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\\r\\n EIP20Interface(rewardToken).approve(distributor, claimedAmount);\\r\\n IDistributor(distributor).distribute(rewardToken, claimedAmount);\\r\\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\\r\\n }\\r\\n\\r\\n function delegateType() public pure virtual override returns (uint8) {\\r\\n return 5;\\r\\n }\\r\\n}\\r\\n\\r\\ninterface IDistributor {\\r\\n function distribute(address _rewardToken, uint256 _amount) external;\\r\\n}\\r\\n\\r\\ninterface IMorphoClaim {\\r\\n function claim(\\r\\n address account,\\r\\n address reward,\\r\\n uint256 claimable,\\r\\n bytes32[] memory proof\\r\\n ) external returns (uint256 amount);\\r\\n}\\r\\n\",\"keccak256\":\"0x31942d7f665857f51924affb365b3eaf73ea031010109e47016dc9e747047314\",\"license\":\"UNLICENSED\"},\"contracts/compound/CToken.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\r\\nimport { CTokenSecondExtensionBase, ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\r\\nimport { TokenErrorReporter } from \\\"./ErrorReporter.sol\\\";\\r\\nimport { Exponential } from \\\"./Exponential.sol\\\";\\r\\nimport { EIP20Interface } from \\\"./EIP20Interface.sol\\\";\\r\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\r\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\r\\nimport { IFeeDistributor } from \\\"./IFeeDistributor.sol\\\";\\r\\nimport { CTokenOracleProtected } from \\\"./CTokenOracleProtected.sol\\\";\\r\\n\\r\\nimport { DiamondExtension, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\r\\nimport { PoolLens } from \\\"../PoolLens.sol\\\";\\r\\nimport { IonicUniV3Liquidator } from \\\"../IonicUniV3Liquidator.sol\\\";\\r\\nimport { IHypernativeOracle } from \\\"../external/hypernative/interfaces/IHypernativeOracle.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title Compound's CErc20 Contract\\r\\n * @notice CTokens which wrap an EIP-20 underlying\\r\\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\\r\\n * @author Compound\\r\\n */\\r\\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\\r\\n modifier isAuthorized() {\\r\\n require(\\r\\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\\r\\n \\\"not authorized\\\"\\r\\n );\\r\\n _;\\r\\n }\\r\\n\\r\\n modifier isMinHFThresholdExceeded(address borrower) {\\r\\n PoolLens lens = PoolLens(ap.getAddress(\\\"PoolLens\\\"));\\r\\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\\\"IonicUniV3Liquidator\\\")));\\r\\n\\r\\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\\r\\n require(msg.sender == address(liquidator), \\\"Health factor not low enough for non-permissioned liquidations\\\");\\r\\n _;\\r\\n } else {\\r\\n _;\\r\\n }\\r\\n }\\r\\n\\r\\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\\r\\n uint8 fnsCount = 13;\\r\\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\\r\\n functionSelectors[--fnsCount] = this.mint.selector;\\r\\n functionSelectors[--fnsCount] = this.redeem.selector;\\r\\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\\r\\n functionSelectors[--fnsCount] = this.borrow.selector;\\r\\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\\r\\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\\r\\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\\r\\n functionSelectors[--fnsCount] = this.getCash.selector;\\r\\n functionSelectors[--fnsCount] = this.seize.selector;\\r\\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\\r\\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\\r\\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\\r\\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\\r\\n\\r\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\r\\n return functionSelectors;\\r\\n }\\r\\n\\r\\n /*** User Interface ***/\\r\\n\\r\\n /**\\r\\n * @notice Sender supplies assets into the market and receives cTokens in exchange\\r\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\r\\n * @param mintAmount The amount of the underlying asset to supply\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n (uint256 err, ) = mintInternal(mintAmount);\\r\\n return err;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender redeems cTokens in exchange for the underlying asset\\r\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\r\\n * @param redeemTokens The number of cTokens to redeem into underlying\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n return redeemInternal(redeemTokens);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\\r\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\r\\n * @param redeemAmount The amount of underlying to redeem\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n return redeemUnderlyingInternal(redeemAmount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender borrows assets from the protocol to their own address\\r\\n * @param borrowAmount The amount of the underlying asset to borrow\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n return borrowInternal(borrowAmount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender repays their own borrow\\r\\n * @param repayAmount The amount to repay\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n (uint256 err, ) = repayBorrowInternal(repayAmount);\\r\\n return err;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender repays a borrow belonging to borrower\\r\\n * @param borrower the account with the debt being payed off\\r\\n * @param repayAmount The amount to repay\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\\r\\n return err;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice The sender liquidates the borrowers collateral.\\r\\n * The collateral seized is transferred to the liquidator.\\r\\n * @param borrower The borrower of this cToken to be liquidated\\r\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\r\\n * @param cTokenCollateral The market in which to seize collateral from the borrower\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function liquidateBorrow(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n address cTokenCollateral\\r\\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\\r\\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\\r\\n return err;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Get cash balance of this cToken in the underlying asset\\r\\n * @return The quantity of underlying asset owned by this contract\\r\\n */\\r\\n function getCash() external view override returns (uint256) {\\r\\n return getCashInternal();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\r\\n * @dev Will fail unless called by another cToken during the process of liquidation.\\r\\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\\r\\n * @param liquidator The account receiving seized collateral\\r\\n * @param borrower The account having collateral seized\\r\\n * @param seizeTokens The number of cTokens to seize\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function seize(\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 seizeTokens\\r\\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\\r\\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\\r\\n }\\r\\n\\r\\n function selfTransferOut(address to, uint256 amount) external override {\\r\\n require(msg.sender == address(this), \\\"!self\\\");\\r\\n doTransferOut(to, amount);\\r\\n }\\r\\n\\r\\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\\r\\n require(msg.sender == address(this), \\\"!self\\\");\\r\\n return doTransferIn(from, amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\\r\\n * @param withdrawAmount Amount of fees to withdraw\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\\r\\n }\\r\\n\\r\\n if (getCashInternal() < withdrawAmount) {\\r\\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\\r\\n }\\r\\n\\r\\n if (withdrawAmount > totalIonicFees) {\\r\\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\\r\\n totalIonicFees = totalIonicFeesNew;\\r\\n\\r\\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\r\\n doTransferOut(address(ionicAdmin), withdrawAmount);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Accrues interest and reduces admin fees by transferring to admin\\r\\n * @param withdrawAmount Amount of fees to withdraw\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\\r\\n }\\r\\n\\r\\n // Fail gracefully if protocol has insufficient underlying cash\\r\\n if (getCashInternal() < withdrawAmount) {\\r\\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\\r\\n }\\r\\n\\r\\n if (withdrawAmount > totalAdminFees) {\\r\\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n totalAdminFees = totalAdminFees - withdrawAmount;\\r\\n\\r\\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\r\\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /*** Safe Token ***/\\r\\n\\r\\n /**\\r\\n * @notice Gets balance of this contract in terms of the underlying\\r\\n * @dev This excludes the value of the current message, if any\\r\\n * @return The quantity of underlying tokens owned by this contract\\r\\n */\\r\\n function getCashInternal() internal view virtual returns (uint256) {\\r\\n return EIP20Interface(underlying).balanceOf(address(this));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\\r\\n * This will revert due to insufficient balance or insufficient allowance.\\r\\n * This function returns the actual amount received,\\r\\n * which may be less than `amount` if there is a fee attached to the transfer.\\r\\n *\\r\\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\\r\\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\\r\\n */\\r\\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\\r\\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\\r\\n _callOptionalReturn(\\r\\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\\r\\n \\\"TOKEN_TRANSFER_IN_FAILED\\\"\\r\\n );\\r\\n\\r\\n // Calculate the amount that was *actually* transferred\\r\\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\\r\\n require(balanceAfter >= balanceBefore, \\\"TOKEN_TRANSFER_IN_OVERFLOW\\\");\\r\\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\\r\\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\\r\\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\\r\\n * it is >= amount, this should not revert in normal conditions.\\r\\n *\\r\\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\\r\\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\\r\\n */\\r\\n function doTransferOut(address to, uint256 amount) internal virtual {\\r\\n _callOptionalReturn(\\r\\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\\r\\n \\\"TOKEN_TRANSFER_OUT_FAILED\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n * @param errorMessage The revert string to return on failure.\\r\\n */\\r\\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\\r\\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\\r\\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender supplies assets into the market and receives cTokens in exchange\\r\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\r\\n * @param mintAmount The amount of the underlying asset to supply\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\r\\n */\\r\\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\\r\\n return mintFresh(msg.sender, mintAmount);\\r\\n }\\r\\n\\r\\n struct MintLocalVars {\\r\\n Error err;\\r\\n MathError mathErr;\\r\\n uint256 exchangeRateMantissa;\\r\\n uint256 mintTokens;\\r\\n uint256 totalSupplyNew;\\r\\n uint256 accountTokensNew;\\r\\n uint256 actualMintAmount;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice User supplies assets into the market and receives cTokens in exchange\\r\\n * @dev Assumes interest has already been accrued up to the current block\\r\\n * @param minter The address of the account which is supplying the assets\\r\\n * @param mintAmount The amount of the underlying asset to supply\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\r\\n */\\r\\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\\r\\n /* Fail if mint not allowed */\\r\\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\\r\\n if (allowed != 0) {\\r\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\\r\\n }\\r\\n\\r\\n /* Verify market's block number equals current block number */\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\\r\\n }\\r\\n\\r\\n MintLocalVars memory vars;\\r\\n\\r\\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\\r\\n\\r\\n // Check max supply\\r\\n // unused function\\r\\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\\r\\n if (allowed != 0) {\\r\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\\r\\n } */\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n /*\\r\\n * We call `doTransferIn` for the minter and the mintAmount.\\r\\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\\r\\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\\r\\n * side-effects occurred. The function returns the amount actually transferred,\\r\\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\\r\\n * of cash.\\r\\n */\\r\\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\\r\\n\\r\\n /*\\r\\n * We get the current exchange rate and calculate the number of cTokens to be minted:\\r\\n * mintTokens = actualMintAmount / exchangeRate\\r\\n */\\r\\n\\r\\n // mintTokens is rounded down here - correct\\r\\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\\r\\n vars.actualMintAmount,\\r\\n Exp({ mantissa: vars.exchangeRateMantissa })\\r\\n );\\r\\n require(vars.mathErr == MathError.NO_ERROR, \\\"MINT_EXCHANGE_CALCULATION_FAILED\\\");\\r\\n require(vars.mintTokens > 0, \\\"MINT_ZERO_CTOKENS_REJECTED\\\");\\r\\n\\r\\n /*\\r\\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\\r\\n * totalSupplyNew = totalSupply + mintTokens\\r\\n * accountTokensNew = accountTokens[minter] + mintTokens\\r\\n */\\r\\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\\r\\n\\r\\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\\r\\n\\r\\n /* We write previously calculated values into storage */\\r\\n totalSupply = vars.totalSupplyNew;\\r\\n accountTokens[minter] = vars.accountTokensNew;\\r\\n\\r\\n /* We emit a Mint event, and a Transfer event */\\r\\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\\r\\n emit Transfer(address(this), minter, vars.mintTokens);\\r\\n\\r\\n /* We call the defense hook */\\r\\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\\r\\n\\r\\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender redeems cTokens in exchange for the underlying asset\\r\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\r\\n * @param redeemTokens The number of cTokens to redeem into underlying\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\\r\\n return redeemFresh(msg.sender, redeemTokens, 0);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\\r\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\r\\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\\r\\n return redeemFresh(msg.sender, 0, redeemAmount);\\r\\n }\\r\\n\\r\\n struct RedeemLocalVars {\\r\\n Error err;\\r\\n MathError mathErr;\\r\\n uint256 exchangeRateMantissa;\\r\\n uint256 redeemTokens;\\r\\n uint256 redeemAmount;\\r\\n uint256 totalSupplyNew;\\r\\n uint256 accountTokensNew;\\r\\n }\\r\\n\\r\\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\\r\\n res = (x * 1e18) / y;\\r\\n if (x % y != 0) res += 1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice User redeems cTokens in exchange for the underlying asset\\r\\n * @dev Assumes interest has already been accrued up to the current block\\r\\n * @param redeemer The address of the account which is redeeming the tokens\\r\\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\\r\\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function redeemFresh(\\r\\n address redeemer,\\r\\n uint256 redeemTokensIn,\\r\\n uint256 redeemAmountIn\\r\\n ) internal returns (uint256) {\\r\\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \\\"!redeem tokens or amount\\\");\\r\\n\\r\\n RedeemLocalVars memory vars;\\r\\n\\r\\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\\r\\n\\r\\n if (redeemTokensIn > 0) {\\r\\n // don't allow dust tokens/assets to be left after\\r\\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\\r\\n\\r\\n /*\\r\\n * We calculate the exchange rate and the amount of underlying to be redeemed:\\r\\n * redeemTokens = redeemTokensIn\\r\\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\\r\\n */\\r\\n vars.redeemTokens = redeemTokensIn;\\r\\n\\r\\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\\r\\n Exp({ mantissa: vars.exchangeRateMantissa }),\\r\\n redeemTokensIn\\r\\n );\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return\\r\\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\\r\\n }\\r\\n } else {\\r\\n if (redeemAmountIn == type(uint256).max) {\\r\\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\\r\\n }\\r\\n\\r\\n // don't allow dust tokens/assets to be left after\\r\\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\\r\\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\\r\\n\\r\\n /*\\r\\n * We get the current exchange rate and calculate the amount to be redeemed:\\r\\n * redeemTokens = redeemAmountIn / exchangeRate\\r\\n * redeemAmount = redeemAmountIn\\r\\n */\\r\\n\\r\\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\\r\\n\\r\\n // don't allow dust tokens/assets to be left after\\r\\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\\r\\n\\r\\n vars.redeemAmount = redeemAmountIn;\\r\\n }\\r\\n\\r\\n /* Fail if redeem not allowed */\\r\\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\\r\\n if (allowed != 0) {\\r\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\\r\\n }\\r\\n\\r\\n /* Verify market's block number equals current block number */\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\\r\\n }\\r\\n\\r\\n /*\\r\\n * We calculate the new total supply and redeemer balance, checking for underflow:\\r\\n * totalSupplyNew = totalSupply - redeemTokens\\r\\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\\r\\n */\\r\\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return\\r\\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\\r\\n }\\r\\n\\r\\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return\\r\\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\\r\\n }\\r\\n\\r\\n /* Fail gracefully if protocol has insufficient cash */\\r\\n if (getCashInternal() < vars.redeemAmount) {\\r\\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n /* We write previously calculated values into storage */\\r\\n totalSupply = vars.totalSupplyNew;\\r\\n accountTokens[redeemer] = vars.accountTokensNew;\\r\\n\\r\\n /*\\r\\n * We invoke doTransferOut for the redeemer and the redeemAmount.\\r\\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\\r\\n * On success, the cToken has redeemAmount less of cash.\\r\\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\r\\n */\\r\\n doTransferOut(redeemer, vars.redeemAmount);\\r\\n\\r\\n /* We emit a Transfer event, and a Redeem event */\\r\\n emit Transfer(redeemer, address(this), vars.redeemTokens);\\r\\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\\r\\n\\r\\n /* We call the defense hook */\\r\\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender borrows assets from the protocol to their own address\\r\\n * @param borrowAmount The amount of the underlying asset to borrow\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\\r\\n return borrowFresh(msg.sender, borrowAmount);\\r\\n }\\r\\n\\r\\n struct BorrowLocalVars {\\r\\n MathError mathErr;\\r\\n uint256 accountBorrows;\\r\\n uint256 accountBorrowsNew;\\r\\n uint256 totalBorrowsNew;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Users borrow assets from the protocol to their own address\\r\\n * @param borrowAmount The amount of the underlying asset to borrow\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\\r\\n /* Fail if borrow not allowed */\\r\\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\\r\\n if (allowed != 0) {\\r\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\\r\\n }\\r\\n\\r\\n /* Verify market's block number equals current block number */\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\\r\\n }\\r\\n\\r\\n /* Fail gracefully if protocol has insufficient underlying cash */\\r\\n uint256 cashPrior = getCashInternal();\\r\\n\\r\\n if (cashPrior < borrowAmount) {\\r\\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\\r\\n }\\r\\n\\r\\n BorrowLocalVars memory vars;\\r\\n\\r\\n /*\\r\\n * We calculate the new borrower and total borrow balances, failing on overflow:\\r\\n * accountBorrowsNew = accountBorrows + borrowAmount\\r\\n * totalBorrowsNew = totalBorrows + borrowAmount\\r\\n */\\r\\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\\r\\n\\r\\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return\\r\\n failOpaque(\\r\\n Error.MATH_ERROR,\\r\\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\r\\n uint256(vars.mathErr)\\r\\n );\\r\\n }\\r\\n\\r\\n // Check min borrow for this user for this asset\\r\\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\\r\\n if (allowed != 0) {\\r\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\\r\\n }\\r\\n\\r\\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return\\r\\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n /* We write the previously calculated values into storage */\\r\\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\\r\\n accountBorrows[borrower].interestIndex = borrowIndex;\\r\\n totalBorrows = vars.totalBorrowsNew;\\r\\n\\r\\n /*\\r\\n * We invoke doTransferOut for the borrower and the borrowAmount.\\r\\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\\r\\n * On success, the cToken borrowAmount less of cash.\\r\\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\r\\n */\\r\\n doTransferOut(borrower, borrowAmount);\\r\\n\\r\\n /* We emit a Borrow event */\\r\\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\\r\\n\\r\\n /* We call the defense hook */\\r\\n comptroller.borrowVerify(address(this), borrower);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender repays their own borrow\\r\\n * @param repayAmount The amount to repay\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\r\\n */\\r\\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\\r\\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sender repays a borrow belonging to borrower\\r\\n * @param borrower the account with the debt being payed off\\r\\n * @param repayAmount The amount to repay\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\r\\n */\\r\\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\\r\\n internal\\r\\n nonReentrant(false)\\r\\n returns (uint256, uint256)\\r\\n {\\r\\n asCTokenExtension().accrueInterest();\\r\\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\\r\\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\\r\\n }\\r\\n\\r\\n struct RepayBorrowLocalVars {\\r\\n Error err;\\r\\n MathError mathErr;\\r\\n uint256 repayAmount;\\r\\n uint256 borrowerIndex;\\r\\n uint256 accountBorrows;\\r\\n uint256 accountBorrowsNew;\\r\\n uint256 totalBorrowsNew;\\r\\n uint256 actualRepayAmount;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Borrows are repaid by another user (possibly the borrower).\\r\\n * @param payer the account paying off the borrow\\r\\n * @param borrower the account with the debt being payed off\\r\\n * @param repayAmount the amount of undelrying tokens being returned\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\r\\n */\\r\\n function repayBorrowFresh(\\r\\n address payer,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) internal returns (uint256, uint256) {\\r\\n /* Fail if repayBorrow not allowed */\\r\\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\\r\\n if (allowed != 0) {\\r\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\\r\\n }\\r\\n\\r\\n /* Verify market's block number equals current block number */\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\\r\\n }\\r\\n\\r\\n RepayBorrowLocalVars memory vars;\\r\\n\\r\\n /* We remember the original borrowerIndex for verification purposes */\\r\\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\\r\\n\\r\\n /* We fetch the amount the borrower owes, with accumulated interest */\\r\\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\\r\\n\\r\\n /* If repayAmount == -1, repayAmount = accountBorrows */\\r\\n if (repayAmount == type(uint256).max) {\\r\\n vars.repayAmount = vars.accountBorrows;\\r\\n } else {\\r\\n vars.repayAmount = repayAmount;\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n /*\\r\\n * We call doTransferIn for the payer and the repayAmount\\r\\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\\r\\n * On success, the cToken holds an additional repayAmount of cash.\\r\\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\\r\\n * it returns the amount actually transferred, in case of a fee.\\r\\n */\\r\\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\\r\\n\\r\\n /*\\r\\n * We calculate the new borrower and total borrow balances, failing on underflow:\\r\\n * accountBorrowsNew = accountBorrows - actualRepayAmount\\r\\n * totalBorrowsNew = totalBorrows - actualRepayAmount\\r\\n */\\r\\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\\r\\n require(vars.mathErr == MathError.NO_ERROR, \\\"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\\\");\\r\\n\\r\\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\\r\\n require(vars.mathErr == MathError.NO_ERROR, \\\"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\\\");\\r\\n\\r\\n /* We write the previously calculated values into storage */\\r\\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\\r\\n accountBorrows[borrower].interestIndex = borrowIndex;\\r\\n totalBorrows = vars.totalBorrowsNew;\\r\\n\\r\\n /* We emit a RepayBorrow event */\\r\\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\\r\\n\\r\\n /* We call the defense hook */\\r\\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\\r\\n\\r\\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice The sender liquidates the borrowers collateral.\\r\\n * The collateral seized is transferred to the liquidator.\\r\\n * @param borrower The borrower of this cToken to be liquidated\\r\\n * @param cTokenCollateral The market in which to seize collateral from the borrower\\r\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\r\\n */\\r\\n function liquidateBorrowInternal(\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n address cTokenCollateral\\r\\n ) internal nonReentrant(false) returns (uint256, uint256) {\\r\\n asCTokenExtension().accrueInterest();\\r\\n ICErc20(cTokenCollateral).accrueInterest();\\r\\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\\r\\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice The liquidator liquidates the borrowers collateral.\\r\\n * The collateral seized is transferred to the liquidator.\\r\\n * @param borrower The borrower of this cToken to be liquidated\\r\\n * @param liquidator The address repaying the borrow and seizing collateral\\r\\n * @param cTokenCollateral The market in which to seize collateral from the borrower\\r\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\r\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\r\\n */\\r\\n function liquidateBorrowFresh(\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n address cTokenCollateral\\r\\n ) internal returns (uint256, uint256) {\\r\\n /* Fail if liquidate not allowed */\\r\\n uint256 allowed = comptroller.liquidateBorrowAllowed(\\r\\n address(this),\\r\\n cTokenCollateral,\\r\\n liquidator,\\r\\n borrower,\\r\\n repayAmount\\r\\n );\\r\\n if (allowed != 0) {\\r\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\\r\\n }\\r\\n\\r\\n /* Verify market's block number equals current block number */\\r\\n if (accrualBlockNumber != block.number) {\\r\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\\r\\n }\\r\\n\\r\\n /* Verify cTokenCollateral market's block number equals current block number */\\r\\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\\r\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\\r\\n }\\r\\n\\r\\n /* Fail if borrower = liquidator */\\r\\n if (borrower == liquidator) {\\r\\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\\r\\n }\\r\\n\\r\\n /* Fail if repayAmount = 0 */\\r\\n if (repayAmount == 0) {\\r\\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\\r\\n }\\r\\n\\r\\n /* Fail if repayAmount = -1 */\\r\\n if (repayAmount == type(uint256).max) {\\r\\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\\r\\n }\\r\\n\\r\\n /* Fail if repayBorrow fails */\\r\\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\\r\\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\\r\\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n /* We calculate the number of collateral tokens that will be seized */\\r\\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\\r\\n address(this),\\r\\n cTokenCollateral,\\r\\n actualRepayAmount\\r\\n );\\r\\n require(amountSeizeError == uint256(Error.NO_ERROR), \\\"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\\\");\\r\\n\\r\\n /* Revert if borrower collateral token balance < seizeTokens */\\r\\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \\\"LIQUIDATE_SEIZE_TOO_MUCH\\\");\\r\\n\\r\\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\\r\\n uint256 seizeError;\\r\\n if (cTokenCollateral == address(this)) {\\r\\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\\r\\n } else {\\r\\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\\r\\n }\\r\\n\\r\\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\\r\\n require(seizeError == uint256(Error.NO_ERROR), \\\"!seize\\\");\\r\\n\\r\\n /* We emit a LiquidateBorrow event */\\r\\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\\r\\n\\r\\n /* We call the defense hook */\\r\\n // unused function\\r\\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\\r\\n\\r\\n return (uint256(Error.NO_ERROR), actualRepayAmount);\\r\\n }\\r\\n\\r\\n struct SeizeInternalLocalVars {\\r\\n MathError mathErr;\\r\\n uint256 borrowerTokensNew;\\r\\n uint256 liquidatorTokensNew;\\r\\n uint256 liquidatorSeizeTokens;\\r\\n uint256 protocolSeizeTokens;\\r\\n uint256 protocolSeizeAmount;\\r\\n uint256 exchangeRateMantissa;\\r\\n uint256 totalReservesNew;\\r\\n uint256 totalIonicFeeNew;\\r\\n uint256 totalSupplyNew;\\r\\n uint256 feeSeizeTokens;\\r\\n uint256 feeSeizeAmount;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\r\\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\\r\\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\\r\\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\\r\\n * @param liquidator The account receiving seized collateral\\r\\n * @param borrower The account having collateral seized\\r\\n * @param seizeTokens The number of cTokens to seize\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function seizeInternal(\\r\\n address seizerToken,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 seizeTokens\\r\\n ) internal returns (uint256) {\\r\\n /* Fail if seize not allowed */\\r\\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\\r\\n if (allowed != 0) {\\r\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\\r\\n }\\r\\n\\r\\n /* Fail if borrower = liquidator */\\r\\n if (borrower == liquidator) {\\r\\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\\r\\n }\\r\\n\\r\\n SeizeInternalLocalVars memory vars;\\r\\n\\r\\n /*\\r\\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\\r\\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\\r\\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\\r\\n */\\r\\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\\r\\n }\\r\\n\\r\\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\\r\\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\\r\\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\\r\\n\\r\\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\\r\\n\\r\\n vars.protocolSeizeAmount = mul_ScalarTruncate(\\r\\n Exp({ mantissa: vars.exchangeRateMantissa }),\\r\\n vars.protocolSeizeTokens\\r\\n );\\r\\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\\r\\n\\r\\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\\r\\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\\r\\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\\r\\n\\r\\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\\r\\n if (vars.mathErr != MathError.NO_ERROR) {\\r\\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\\r\\n }\\r\\n\\r\\n /////////////////////////\\r\\n // EFFECTS & INTERACTIONS\\r\\n // (No safe failures beyond this point)\\r\\n\\r\\n /* We write the previously calculated values into storage */\\r\\n totalReserves = vars.totalReservesNew;\\r\\n totalSupply = vars.totalSupplyNew;\\r\\n totalIonicFees = vars.totalIonicFeeNew;\\r\\n\\r\\n accountTokens[borrower] = vars.borrowerTokensNew;\\r\\n accountTokens[liquidator] = vars.liquidatorTokensNew;\\r\\n\\r\\n /* Emit a Transfer event */\\r\\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\\r\\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\\r\\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\\r\\n\\r\\n /* We call the defense hook */\\r\\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n function asCTokenExtension() internal view returns (ICErc20) {\\r\\n return ICErc20(address(this));\\r\\n }\\r\\n\\r\\n /*** Reentrancy Guard ***/\\r\\n\\r\\n /**\\r\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\r\\n */\\r\\n modifier nonReentrant(bool localOnly) {\\r\\n _beforeNonReentrant(localOnly);\\r\\n _;\\r\\n _afterNonReentrant(localOnly);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\\r\\n * Saves space because function modifier code is \\\"inlined\\\" into every function with the modifier).\\r\\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\\r\\n */\\r\\n function _beforeNonReentrant(bool localOnly) private {\\r\\n require(_notEntered, \\\"re-entered\\\");\\r\\n if (!localOnly) comptroller._beforeNonReentrant();\\r\\n _notEntered = false;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\\r\\n * Saves space because function modifier code is \\\"inlined\\\" into every function with the modifier).\\r\\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\\r\\n */\\r\\n function _afterNonReentrant(bool localOnly) private {\\r\\n _notEntered = true; // get a gas-refund post-Istanbul\\r\\n if (!localOnly) comptroller._afterNonReentrant();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n * @param errorMessage The revert string to return on failure.\\r\\n */\\r\\n function _functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.call(data);\\r\\n\\r\\n if (!success) {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n\\r\\n // solhint-disable-next-line no-inline-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n return returndata;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x826dab3bd46cf8dd7659073fb95ea9db7e71b73fe74d31c0d8d3a32ef58e84e3\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\r\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\r\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\r\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\r\\n\\r\\nabstract contract CTokenAdminStorage {\\r\\n /*\\r\\n * Administrator for Ionic\\r\\n */\\r\\n address payable public ionicAdmin;\\r\\n}\\r\\n\\r\\nabstract contract CErc20Storage is CTokenAdminStorage {\\r\\n /**\\r\\n * @dev Guard variable for re-entrancy checks\\r\\n */\\r\\n bool internal _notEntered;\\r\\n\\r\\n /**\\r\\n * @notice EIP-20 token name for this token\\r\\n */\\r\\n string public name;\\r\\n\\r\\n /**\\r\\n * @notice EIP-20 token symbol for this token\\r\\n */\\r\\n string public symbol;\\r\\n\\r\\n /**\\r\\n * @notice EIP-20 token decimals for this token\\r\\n */\\r\\n uint8 public decimals;\\r\\n\\r\\n /*\\r\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\r\\n */\\r\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\r\\n\\r\\n /*\\r\\n * Maximum fraction of interest that can be set aside for reserves + fees\\r\\n */\\r\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\r\\n\\r\\n /**\\r\\n * @notice Contract which oversees inter-cToken operations\\r\\n */\\r\\n IonicComptroller public comptroller;\\r\\n\\r\\n /**\\r\\n * @notice Model which tells what the current interest rate should be\\r\\n */\\r\\n InterestRateModel public interestRateModel;\\r\\n\\r\\n /*\\r\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\r\\n */\\r\\n uint256 internal initialExchangeRateMantissa;\\r\\n\\r\\n /**\\r\\n * @notice Fraction of interest currently set aside for admin fees\\r\\n */\\r\\n uint256 public adminFeeMantissa;\\r\\n\\r\\n /**\\r\\n * @notice Fraction of interest currently set aside for Ionic fees\\r\\n */\\r\\n uint256 public ionicFeeMantissa;\\r\\n\\r\\n /**\\r\\n * @notice Fraction of interest currently set aside for reserves\\r\\n */\\r\\n uint256 public reserveFactorMantissa;\\r\\n\\r\\n /**\\r\\n * @notice Block number that interest was last accrued at\\r\\n */\\r\\n uint256 public accrualBlockNumber;\\r\\n\\r\\n /**\\r\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\r\\n */\\r\\n uint256 public borrowIndex;\\r\\n\\r\\n /**\\r\\n * @notice Total amount of outstanding borrows of the underlying in this market\\r\\n */\\r\\n uint256 public totalBorrows;\\r\\n\\r\\n /**\\r\\n * @notice Total amount of reserves of the underlying held in this market\\r\\n */\\r\\n uint256 public totalReserves;\\r\\n\\r\\n /**\\r\\n * @notice Total amount of admin fees of the underlying held in this market\\r\\n */\\r\\n uint256 public totalAdminFees;\\r\\n\\r\\n /**\\r\\n * @notice Total amount of Ionic fees of the underlying held in this market\\r\\n */\\r\\n uint256 public totalIonicFees;\\r\\n\\r\\n /**\\r\\n * @notice Total number of tokens in circulation\\r\\n */\\r\\n uint256 public totalSupply;\\r\\n\\r\\n /*\\r\\n * Official record of token balances for each account\\r\\n */\\r\\n mapping(address => uint256) internal accountTokens;\\r\\n\\r\\n /*\\r\\n * Approved token transfer amounts on behalf of others\\r\\n */\\r\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\r\\n\\r\\n /**\\r\\n * @notice Container for borrow balance information\\r\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\r\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\r\\n */\\r\\n struct BorrowSnapshot {\\r\\n uint256 principal;\\r\\n uint256 interestIndex;\\r\\n }\\r\\n\\r\\n /*\\r\\n * Mapping of account addresses to outstanding borrow balances\\r\\n */\\r\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\r\\n\\r\\n /*\\r\\n * Share of seized collateral that is added to reserves\\r\\n */\\r\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\r\\n\\r\\n /*\\r\\n * Share of seized collateral taken as fees\\r\\n */\\r\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\r\\n\\r\\n /**\\r\\n * @notice Underlying asset for this CToken\\r\\n */\\r\\n address public underlying;\\r\\n\\r\\n /**\\r\\n * @notice Addresses Provider\\r\\n */\\r\\n AddressesProvider public ap;\\r\\n}\\r\\n\\r\\nabstract contract CTokenBaseEvents {\\r\\n /* ERC20 */\\r\\n\\r\\n /**\\r\\n * @notice EIP20 Transfer event\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\r\\n\\r\\n /*** Admin Events ***/\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when interestRateModel is changed\\r\\n */\\r\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when the reserve factor is changed\\r\\n */\\r\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when the admin fee is changed\\r\\n */\\r\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when the Ionic fee is changed\\r\\n */\\r\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\r\\n\\r\\n /**\\r\\n * @notice EIP20 Approval event\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when interest is accrued\\r\\n */\\r\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\r\\n}\\r\\n\\r\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\r\\n event Flash(address receiver, uint256 amount);\\r\\n}\\r\\n\\r\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\r\\n /*** Market Events ***/\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when tokens are minted\\r\\n */\\r\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when tokens are redeemed\\r\\n */\\r\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when underlying is borrowed\\r\\n */\\r\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a borrow is repaid\\r\\n */\\r\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when a borrow is liquidated\\r\\n */\\r\\n event LiquidateBorrow(\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 repayAmount,\\r\\n address cTokenCollateral,\\r\\n uint256 seizeTokens\\r\\n );\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when the reserves are added\\r\\n */\\r\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\r\\n\\r\\n /**\\r\\n * @notice Event emitted when the reserves are reduced\\r\\n */\\r\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\r\\n}\\r\\n\\r\\ninterface CTokenFirstExtensionInterface {\\r\\n /*** User Interface ***/\\r\\n\\r\\n function transfer(address dst, uint256 amount) external returns (bool);\\r\\n\\r\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\\r\\n\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n function balanceOf(address owner) external view returns (uint256);\\r\\n\\r\\n /*** Admin Functions ***/\\r\\n\\r\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\r\\n\\r\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\r\\n\\r\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\r\\n\\r\\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\\r\\n\\r\\n function borrowRatePerBlock() external view returns (uint256);\\r\\n\\r\\n function supplyRatePerBlock() external view returns (uint256);\\r\\n\\r\\n function exchangeRateCurrent() external view returns (uint256);\\r\\n\\r\\n function accrueInterest() external returns (uint256);\\r\\n\\r\\n function totalBorrowsCurrent() external view returns (uint256);\\r\\n\\r\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\r\\n\\r\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\r\\n\\r\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\r\\n\\r\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\r\\n\\r\\n function flash(uint256 amount, bytes calldata data) external;\\r\\n\\r\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\r\\n\\r\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\r\\n\\r\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\r\\n\\r\\n function registerInSFS() external returns (uint256);\\r\\n}\\r\\n\\r\\ninterface CTokenSecondExtensionInterface {\\r\\n function mint(uint256 mintAmount) external returns (uint256);\\r\\n\\r\\n function redeem(uint256 redeemTokens) external returns (uint256);\\r\\n\\r\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\r\\n\\r\\n function borrow(uint256 borrowAmount) external returns (uint256);\\r\\n\\r\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\r\\n\\r\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\r\\n\\r\\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\\r\\n\\r\\n function getCash() external view returns (uint256);\\r\\n\\r\\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\\r\\n\\r\\n /*** Admin Functions ***/\\r\\n\\r\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\r\\n\\r\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\r\\n\\r\\n function selfTransferOut(address to, uint256 amount) external;\\r\\n\\r\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\r\\n}\\r\\n\\r\\ninterface CDelegatorInterface {\\r\\n function implementation() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Called by the admin to update the implementation of the delegator\\r\\n * @param implementation_ The address of the new implementation for delegation\\r\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\r\\n */\\r\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\r\\n\\r\\n /**\\r\\n * @dev upgrades the implementation if necessary\\r\\n */\\r\\n function _upgrade() external;\\r\\n}\\r\\n\\r\\ninterface CDelegateInterface {\\r\\n /**\\r\\n * @notice Called by the delegator on a delegate to initialize it for duty\\r\\n * @dev Should revert if any issues arise which make it unfit for delegation\\r\\n * @param data The encoded bytes data for any initialization\\r\\n */\\r\\n function _becomeImplementation(bytes calldata data) external;\\r\\n\\r\\n function delegateType() external pure returns (uint8);\\r\\n\\r\\n function contractType() external pure returns (string memory);\\r\\n}\\r\\n\\r\\nabstract contract CErc20AdminBase is CErc20Storage {\\r\\n /**\\r\\n * @notice Returns a boolean indicating if the sender has admin rights\\r\\n */\\r\\n function hasAdminRights() internal view returns (bool) {\\r\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\r\\n return\\r\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\r\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\r\\n }\\r\\n}\\r\\n\\r\\nabstract contract CErc20FirstExtensionBase is\\r\\n CErc20AdminBase,\\r\\n CTokenFirstExtensionEvents,\\r\\n CTokenFirstExtensionInterface\\r\\n{}\\r\\n\\r\\nabstract contract CTokenSecondExtensionBase is\\r\\n CErc20AdminBase,\\r\\n CTokenSecondExtensionEvents,\\r\\n CTokenSecondExtensionInterface,\\r\\n CDelegateInterface\\r\\n{}\\r\\n\\r\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\r\\n\\r\\ninterface CErc20StorageInterface {\\r\\n function admin() external view returns (address);\\r\\n\\r\\n function adminHasRights() external view returns (bool);\\r\\n\\r\\n function ionicAdmin() external view returns (address);\\r\\n\\r\\n function ionicAdminHasRights() external view returns (bool);\\r\\n\\r\\n function comptroller() external view returns (IonicComptroller);\\r\\n\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n function decimals() external view returns (uint8);\\r\\n\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n function adminFeeMantissa() external view returns (uint256);\\r\\n\\r\\n function ionicFeeMantissa() external view returns (uint256);\\r\\n\\r\\n function reserveFactorMantissa() external view returns (uint256);\\r\\n\\r\\n function protocolSeizeShareMantissa() external view returns (uint256);\\r\\n\\r\\n function feeSeizeShareMantissa() external view returns (uint256);\\r\\n\\r\\n function totalReserves() external view returns (uint256);\\r\\n\\r\\n function totalAdminFees() external view returns (uint256);\\r\\n\\r\\n function totalIonicFees() external view returns (uint256);\\r\\n\\r\\n function totalBorrows() external view returns (uint256);\\r\\n\\r\\n function accrualBlockNumber() external view returns (uint256);\\r\\n\\r\\n function underlying() external view returns (address);\\r\\n\\r\\n function borrowIndex() external view returns (uint256);\\r\\n\\r\\n function interestRateModel() external view returns (address);\\r\\n}\\r\\n\\r\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\r\\n function plugin() external view returns (address);\\r\\n}\\r\\n\\r\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\r\\n function approve(address, address) external;\\r\\n}\\r\\n\\r\\ninterface ICErc20 is\\r\\n CErc20StorageInterface,\\r\\n CTokenSecondExtensionInterface,\\r\\n CTokenFirstExtensionInterface,\\r\\n CDelegatorInterface,\\r\\n CDelegateInterface\\r\\n{}\\r\\n\\r\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\r\\n function _updatePlugin(address _plugin) external;\\r\\n}\\r\\n\\r\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\r\\n\",\"keccak256\":\"0x76eb28ebb8f5a81452d085510ff67296cbeb63108296ff2e8ff55b463a3fbfdd\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenOracleProtected.sol\":{\"content\":\"// SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.22;\\r\\n\\r\\nimport { CErc20Storage } from \\\"./CTokenInterfaces.sol\\\";\\r\\nimport { IHypernativeOracle } from \\\"../external/hypernative/interfaces/IHypernativeOracle.sol\\\";\\r\\n\\r\\ncontract CTokenOracleProtected is CErc20Storage {\\r\\n error InteractionNotAllowed();\\r\\n error CallerIsNotEOA();\\r\\n\\r\\n modifier onlyOracleApproved() {\\r\\n address oracleAddress = ap.getAddress(\\\"HYPERNATIVE_ORACLE\\\");\\r\\n\\r\\n if (oracleAddress == address(0)) {\\r\\n _;\\r\\n return;\\r\\n }\\r\\n\\r\\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\\r\\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\\r\\n _;\\r\\n }\\r\\n\\r\\n modifier onlyOracleApprovedAllowEOA() {\\r\\n address oracleAddress = ap.getAddress(\\\"HYPERNATIVE_ORACLE\\\");\\r\\n\\r\\n if (oracleAddress == address(0)) {\\r\\n _;\\r\\n return;\\r\\n }\\r\\n\\r\\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\\r\\n oracle.validateBlacklistedAccountInteraction(msg.sender);\\r\\n if (tx.origin == msg.sender) {\\r\\n _;\\r\\n return;\\r\\n }\\r\\n\\r\\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\\r\\n _;\\r\\n }\\r\\n\\r\\n modifier onlyNotBlacklistedEOA() {\\r\\n address oracleAddress = ap.getAddress(\\\"HYPERNATIVE_ORACLE\\\");\\r\\n\\r\\n if (oracleAddress == address(0)) {\\r\\n _;\\r\\n return;\\r\\n }\\r\\n\\r\\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\\r\\n if (msg.sender != tx.origin) {\\r\\n revert CallerIsNotEOA();\\r\\n }\\r\\n oracle.validateBlacklistedAccountInteraction(msg.sender);\\r\\n _;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb50bf66c2756a0cb9989524e82997458ae2d57198186dcc7a12cc840777f2e83\",\"license\":\"Unlicense\"},\"contracts/compound/CarefulMath.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/**\\r\\n * @title Careful Math\\r\\n * @author Compound\\r\\n * @notice Derived from OpenZeppelin's SafeMath library\\r\\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\\r\\n */\\r\\ncontract CarefulMath {\\r\\n /**\\r\\n * @dev Possible error codes that we can return\\r\\n */\\r\\n enum MathError {\\r\\n NO_ERROR,\\r\\n DIVISION_BY_ZERO,\\r\\n INTEGER_OVERFLOW,\\r\\n INTEGER_UNDERFLOW\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiplies two numbers, returns an error on overflow.\\r\\n */\\r\\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\r\\n if (a == 0) {\\r\\n return (MathError.NO_ERROR, 0);\\r\\n }\\r\\n\\r\\n uint256 c;\\r\\n unchecked {\\r\\n c = a * b;\\r\\n }\\r\\n\\r\\n if (c / a != b) {\\r\\n return (MathError.INTEGER_OVERFLOW, 0);\\r\\n } else {\\r\\n return (MathError.NO_ERROR, c);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Integer division of two numbers, truncating the quotient.\\r\\n */\\r\\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\r\\n if (b == 0) {\\r\\n return (MathError.DIVISION_BY_ZERO, 0);\\r\\n }\\r\\n\\r\\n return (MathError.NO_ERROR, a / b);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\\r\\n */\\r\\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\r\\n if (b <= a) {\\r\\n return (MathError.NO_ERROR, a - b);\\r\\n } else {\\r\\n return (MathError.INTEGER_UNDERFLOW, 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Adds two numbers, returns an error on overflow.\\r\\n */\\r\\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\r\\n uint256 c;\\r\\n unchecked {\\r\\n c = a + b;\\r\\n }\\r\\n\\r\\n if (c >= a) {\\r\\n return (MathError.NO_ERROR, c);\\r\\n } else {\\r\\n return (MathError.INTEGER_OVERFLOW, 0);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev add a and b and then subtract c\\r\\n */\\r\\n function addThenSubUInt(\\r\\n uint256 a,\\r\\n uint256 b,\\r\\n uint256 c\\r\\n ) internal pure returns (MathError, uint256) {\\r\\n (MathError err0, uint256 sum) = addUInt(a, b);\\r\\n\\r\\n if (err0 != MathError.NO_ERROR) {\\r\\n return (err0, 0);\\r\\n }\\r\\n\\r\\n return subUInt(sum, c);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8b239b72390c003598f41db5a809cbfdad091bd4c3a164952c35d396caa65201\",\"license\":\"UNLICENSED\"},\"contracts/compound/Comptroller.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\r\\nimport { ComptrollerErrorReporter } from \\\"./ErrorReporter.sol\\\";\\r\\nimport { Exponential } from \\\"./Exponential.sol\\\";\\r\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\r\\nimport { Unitroller } from \\\"./Unitroller.sol\\\";\\r\\nimport { IFeeDistributor } from \\\"./IFeeDistributor.sol\\\";\\r\\nimport { IIonicFlywheel } from \\\"../ionic/strategies/flywheel/IIonicFlywheel.sol\\\";\\r\\nimport { DiamondExtension, DiamondBase, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\r\\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \\\"./ComptrollerInterface.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title Compound's Comptroller Contract\\r\\n * @author Compound\\r\\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\\r\\n */\\r\\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\\r\\n using EnumerableSet for EnumerableSet.AddressSet;\\r\\n\\r\\n /// @notice Emitted when an admin supports a market\\r\\n event MarketListed(ICErc20 cToken);\\r\\n\\r\\n /// @notice Emitted when an account enters a market\\r\\n event MarketEntered(ICErc20 cToken, address account);\\r\\n\\r\\n /// @notice Emitted when an account exits a market\\r\\n event MarketExited(ICErc20 cToken, address account);\\r\\n\\r\\n /// @notice Emitted when close factor is changed by admin\\r\\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\\r\\n\\r\\n /// @notice Emitted when a collateral factor is changed by admin\\r\\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\\r\\n\\r\\n /// @notice Emitted when liquidation incentive is changed by admin\\r\\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\\r\\n\\r\\n /// @notice Emitted when price oracle is changed\\r\\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\\r\\n\\r\\n /// @notice Emitted when the whitelist enforcement is changed\\r\\n event WhitelistEnforcementChanged(bool enforce);\\r\\n\\r\\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\\r\\n event AddedRewardsDistributor(address rewardsDistributor);\\r\\n\\r\\n // closeFactorMantissa must be strictly greater than this value\\r\\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\\r\\n\\r\\n // closeFactorMantissa must not exceed this value\\r\\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\\r\\n\\r\\n // No collateralFactorMantissa may exceed this value\\r\\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\\r\\n\\r\\n // liquidationIncentiveMantissa must be no less than this value\\r\\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\\r\\n\\r\\n // liquidationIncentiveMantissa must be no greater than this value\\r\\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\\r\\n\\r\\n modifier isAuthorized() {\\r\\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \\\"not authorized\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\r\\n * @param cToken The address of the cToken.\\r\\n */\\r\\n function effectiveSupplyCaps(\\r\\n address cToken\\r\\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\\r\\n return ComptrollerBase.effectiveSupplyCaps(cToken);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\r\\n * @param cToken The address of the cToken.\\r\\n */\\r\\n function effectiveBorrowCaps(\\r\\n address cToken\\r\\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\\r\\n return ComptrollerBase.effectiveBorrowCaps(cToken);\\r\\n }\\r\\n\\r\\n /*** Assets You Are In ***/\\r\\n\\r\\n /**\\r\\n * @notice Returns the assets an account has entered\\r\\n * @param account The address of the account to pull assets for\\r\\n * @return A dynamic list with the assets the account has entered\\r\\n */\\r\\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\\r\\n ICErc20[] memory assetsIn = accountAssets[account];\\r\\n\\r\\n return assetsIn;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns whether the given account is entered in the given asset\\r\\n * @param account The address of the account to check\\r\\n * @param cToken The cToken to check\\r\\n * @return True if the account is in the asset, otherwise false.\\r\\n */\\r\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\\r\\n return markets[address(cToken)].accountMembership[account];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Add assets to be included in account liquidity calculation\\r\\n * @param cTokens The list of addresses of the cToken markets to be enabled\\r\\n * @return Success indicator for whether each corresponding market was entered\\r\\n */\\r\\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\\r\\n uint256 len = cTokens.length;\\r\\n\\r\\n uint256[] memory results = new uint256[](len);\\r\\n for (uint256 i = 0; i < len; i++) {\\r\\n ICErc20 cToken = ICErc20(cTokens[i]);\\r\\n\\r\\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\\r\\n }\\r\\n\\r\\n return results;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Add the market to the borrower's \\\"assets in\\\" for liquidity calculations\\r\\n * @param cToken The market to enter\\r\\n * @param borrower The address of the account to modify\\r\\n * @return Success indicator for whether the market was entered\\r\\n */\\r\\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\\r\\n Market storage marketToJoin = markets[address(cToken)];\\r\\n\\r\\n if (!marketToJoin.isListed) {\\r\\n // market is not listed, cannot join\\r\\n return Error.MARKET_NOT_LISTED;\\r\\n }\\r\\n\\r\\n if (marketToJoin.accountMembership[borrower] == true) {\\r\\n // already joined\\r\\n return Error.NO_ERROR;\\r\\n }\\r\\n\\r\\n // survived the gauntlet, add to list\\r\\n // NOTE: we store these somewhat redundantly as a significant optimization\\r\\n // this avoids having to iterate through the list for the most common use cases\\r\\n // that is, only when we need to perform liquidity checks\\r\\n // and not whenever we want to check if an account is in a particular market\\r\\n marketToJoin.accountMembership[borrower] = true;\\r\\n accountAssets[borrower].push(cToken);\\r\\n\\r\\n // Add to allBorrowers\\r\\n if (!borrowers[borrower]) {\\r\\n allBorrowers.push(borrower);\\r\\n borrowers[borrower] = true;\\r\\n borrowerIndexes[borrower] = allBorrowers.length - 1;\\r\\n }\\r\\n\\r\\n emit MarketEntered(cToken, borrower);\\r\\n\\r\\n return Error.NO_ERROR;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Removes asset from sender's account liquidity calculation\\r\\n * @dev Sender must not have an outstanding borrow balance in the asset,\\r\\n * or be providing necessary collateral for an outstanding borrow.\\r\\n * @param cTokenAddress The address of the asset to be removed\\r\\n * @return Whether or not the account successfully exited the market\\r\\n */\\r\\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\\r\\n // TODO\\r\\n require(markets[cTokenAddress].isListed, \\\"!Comptroller:exitMarket\\\");\\r\\n\\r\\n ICErc20 cToken = ICErc20(cTokenAddress);\\r\\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\\r\\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\\r\\n require(oErr == 0, \\\"!exitMarket\\\"); // semi-opaque error code\\r\\n\\r\\n /* Fail if the sender has a borrow balance */\\r\\n if (amountOwed != 0) {\\r\\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\\r\\n }\\r\\n\\r\\n /* Fail if the sender is not permitted to redeem all of their tokens */\\r\\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\\r\\n if (allowed != 0) {\\r\\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\\r\\n }\\r\\n\\r\\n Market storage marketToExit = markets[cTokenAddress];\\r\\n\\r\\n /* Return true if the sender is not already \\u2018in\\u2019 the market */\\r\\n if (!marketToExit.accountMembership[msg.sender]) {\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /* Set cToken account membership to false */\\r\\n delete marketToExit.accountMembership[msg.sender];\\r\\n\\r\\n /* Delete cToken from the account\\u2019s list of assets */\\r\\n // load into memory for faster iteration\\r\\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\\r\\n uint256 len = userAssetList.length;\\r\\n uint256 assetIndex = len;\\r\\n for (uint256 i = 0; i < len; i++) {\\r\\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\\r\\n assetIndex = i;\\r\\n break;\\r\\n }\\r\\n }\\r\\n\\r\\n // We *must* have found the asset in the list or our redundant data structure is broken\\r\\n assert(assetIndex < len);\\r\\n\\r\\n // copy last item in list to location of item to be removed, reduce length by 1\\r\\n ICErc20[] storage storedList = accountAssets[msg.sender];\\r\\n storedList[assetIndex] = storedList[storedList.length - 1];\\r\\n storedList.pop();\\r\\n\\r\\n // If the user has exited all markets, remove them from the `allBorrowers` array\\r\\n if (storedList.length == 0) {\\r\\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\\r\\n allBorrowers.pop(); // Reduce length by 1\\r\\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\\r\\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\\r\\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\\r\\n }\\r\\n\\r\\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /*** Policy Hooks ***/\\r\\n\\r\\n /**\\r\\n * @notice Checks if the account should be allowed to mint tokens in the given market\\r\\n * @param cTokenAddress The market to verify the mint against\\r\\n * @param minter The account which would get the minted tokens\\r\\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\\r\\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\r\\n */\\r\\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\\r\\n // Pausing is a very serious situation - we revert to sound the alarms\\r\\n require(!mintGuardianPaused[cTokenAddress], \\\"!mint:paused\\\");\\r\\n\\r\\n // Make sure market is listed\\r\\n if (!markets[cTokenAddress].isListed) {\\r\\n return uint256(Error.MARKET_NOT_LISTED);\\r\\n }\\r\\n\\r\\n // Make sure minter is whitelisted\\r\\n if (enforceWhitelist && !whitelist[minter]) {\\r\\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\\r\\n }\\r\\n\\r\\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\\r\\n\\r\\n // Supply cap of 0 corresponds to unlimited supplying\\r\\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\\r\\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\\r\\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\\r\\n uint256 nonWhitelistedTotalSupply;\\r\\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\\r\\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\\r\\n\\r\\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \\\"!supply cap\\\");\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPreSupplierAction(cTokenAddress, minter);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the account should be allowed to redeem tokens in the given market\\r\\n * @param cToken The market to verify the redeem against\\r\\n * @param redeemer The account which would redeem the tokens\\r\\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\\r\\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\r\\n */\\r\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\\r\\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\\r\\n if (allowed != uint256(Error.NO_ERROR)) {\\r\\n return allowed;\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPreSupplierAction(cToken, redeemer);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n function redeemAllowedInternal(\\r\\n address cToken,\\r\\n address redeemer,\\r\\n uint256 redeemTokens\\r\\n ) internal view returns (uint256) {\\r\\n if (!markets[cToken].isListed) {\\r\\n return uint256(Error.MARKET_NOT_LISTED);\\r\\n }\\r\\n\\r\\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\\r\\n if (!markets[cToken].accountMembership[redeemer]) {\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\\r\\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\r\\n redeemer,\\r\\n ICErc20(cToken),\\r\\n redeemTokens,\\r\\n 0,\\r\\n 0\\r\\n );\\r\\n if (err != Error.NO_ERROR) {\\r\\n return uint256(err);\\r\\n }\\r\\n if (shortfall > 0) {\\r\\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\\r\\n }\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Validates mint and reverts on rejection. May emit logs.\\r\\n * @param cToken Asset being minted\\r\\n * @param minter The address minting the tokens\\r\\n * @param actualMintAmount The amount of the underlying asset being minted\\r\\n * @param mintTokens The number of tokens being minted\\r\\n */\\r\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\\r\\n // Add minter to suppliers mapping\\r\\n suppliers[minter] = true;\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPostSupplierAction(cToken, minter);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Validates redeem and reverts on rejection. May emit logs.\\r\\n * @param cToken Asset being redeemed\\r\\n * @param redeemer The address redeeming the tokens\\r\\n * @param redeemAmount The amount of the underlying asset being redeemed\\r\\n * @param redeemTokens The number of tokens being redeemed\\r\\n */\\r\\n function redeemVerify(\\r\\n address cToken,\\r\\n address redeemer,\\r\\n uint256 redeemAmount,\\r\\n uint256 redeemTokens\\r\\n ) external override {\\r\\n require(markets[msg.sender].isListed, \\\"!market\\\");\\r\\n\\r\\n // Require tokens is zero or amount is also zero\\r\\n if (redeemTokens == 0 && redeemAmount > 0) {\\r\\n revert(\\\"!zero\\\");\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPostSupplierAction(cToken, redeemer);\\r\\n }\\r\\n\\r\\n function getMaxRedeemOrBorrow(\\r\\n address account,\\r\\n ICErc20 cTokenModify,\\r\\n bool isBorrow\\r\\n ) external view override returns (uint256) {\\r\\n address cToken = address(cTokenModify);\\r\\n // Accrue interest\\r\\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\\r\\n\\r\\n // Get account liquidity\\r\\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\r\\n account,\\r\\n isBorrow ? cTokenModify : ICErc20(address(0)),\\r\\n 0,\\r\\n 0,\\r\\n 0\\r\\n );\\r\\n require(err == Error.NO_ERROR, \\\"!liquidity\\\");\\r\\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\\r\\n\\r\\n // Get max borrow/redeem\\r\\n uint256 maxBorrowOrRedeemAmount;\\r\\n\\r\\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\\r\\n // Max redeem = balance of underlying if not used as collateral\\r\\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\\r\\n } else {\\r\\n // Avoid \\\"stack too deep\\\" error by separating this logic\\r\\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\\r\\n\\r\\n // Redeem only: max out at underlying balance\\r\\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\\r\\n }\\r\\n\\r\\n // Get max borrow or redeem considering cToken liquidity\\r\\n uint256 cTokenLiquidity = cTokenModify.getCash();\\r\\n\\r\\n // Return the minimum of the two maximums\\r\\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \\\"stack too deep\\\" errors.\\r\\n */\\r\\n function _getMaxRedeemOrBorrow(\\r\\n uint256 liquidity,\\r\\n ICErc20 cTokenModify,\\r\\n bool isBorrow\\r\\n ) internal view returns (uint256) {\\r\\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\\r\\n\\r\\n // Get the normalized price of the asset\\r\\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\\r\\n require(conversionFactor > 0, \\\"!oracle\\\");\\r\\n\\r\\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\\r\\n if (!isBorrow) {\\r\\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\\r\\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\\r\\n }\\r\\n\\r\\n // Get max borrow or redeem considering excess account liquidity\\r\\n return (liquidity * 1e18) / conversionFactor;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\\r\\n * @param cToken The market to verify the borrow against\\r\\n * @param borrower The account which would borrow the asset\\r\\n * @param borrowAmount The amount of underlying the account would borrow\\r\\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\r\\n */\\r\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\\r\\n // Pausing is a very serious situation - we revert to sound the alarms\\r\\n require(!borrowGuardianPaused[cToken], \\\"!borrow:paused\\\");\\r\\n\\r\\n // Make sure market is listed\\r\\n if (!markets[cToken].isListed) {\\r\\n return uint256(Error.MARKET_NOT_LISTED);\\r\\n }\\r\\n\\r\\n if (!markets[cToken].accountMembership[borrower]) {\\r\\n // only cTokens may call borrowAllowed if borrower not in market\\r\\n require(msg.sender == cToken, \\\"!ctoken\\\");\\r\\n\\r\\n // attempt to add borrower to the market\\r\\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\\r\\n if (err != Error.NO_ERROR) {\\r\\n return uint256(err);\\r\\n }\\r\\n\\r\\n // it should be impossible to break the important invariant\\r\\n assert(markets[cToken].accountMembership[borrower]);\\r\\n }\\r\\n\\r\\n // Make sure oracle price is available\\r\\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\\r\\n return uint256(Error.PRICE_ERROR);\\r\\n }\\r\\n\\r\\n // Make sure borrower is whitelisted\\r\\n if (enforceWhitelist && !whitelist[borrower]) {\\r\\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\\r\\n }\\r\\n\\r\\n uint256 borrowCap = effectiveBorrowCaps(cToken);\\r\\n\\r\\n // Borrow cap of 0 corresponds to unlimited borrowing\\r\\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\\r\\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\\r\\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\\r\\n uint256 nonWhitelistedTotalBorrows;\\r\\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\\r\\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\\r\\n\\r\\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \\\"!borrow:cap\\\");\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPreBorrowerAction(cToken, borrower);\\r\\n\\r\\n // Perform a hypothetical liquidity check to guard against shortfall\\r\\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\\r\\n if (err != uint256(Error.NO_ERROR)) {\\r\\n return err;\\r\\n }\\r\\n if (shortfall > 0) {\\r\\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\\r\\n }\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Validates borrow the underlying asset of the given market\\r\\n * @param cToken The market to verify the borrow against\\r\\n * @param borrower The account which borrowed the asset\\r\\n */\\r\\n function borrowVerify(address cToken, address borrower) external override {\\r\\n // Keep the flywheel moving\\r\\n flywheelPostBorrowerAction(cToken, borrower);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\\r\\n * @param cToken Asset whose underlying is being borrowed\\r\\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\\r\\n */\\r\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\\r\\n // Check if min borrow exists\\r\\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\\r\\n\\r\\n if (minBorrowEth > 0) {\\r\\n // Get new underlying borrow balance of account for this cToken\\r\\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\\r\\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\\r\\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\\r\\n Exp({ mantissa: oraclePriceMantissa }),\\r\\n accountBorrowsNew\\r\\n );\\r\\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\\r\\n\\r\\n // Check against min borrow\\r\\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\\r\\n }\\r\\n\\r\\n // Return no error\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the account should be allowed to repay a borrow in the given market\\r\\n * @param cToken The market to verify the repay against\\r\\n * @param payer The account which would repay the asset\\r\\n * @param borrower The account which would borrowed the asset\\r\\n * @param repayAmount The amount of the underlying asset the account would repay\\r\\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\r\\n */\\r\\n function repayBorrowAllowed(\\r\\n address cToken,\\r\\n address payer,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) external override returns (uint256) {\\r\\n // Make sure market is listed\\r\\n if (!markets[cToken].isListed) {\\r\\n return uint256(Error.MARKET_NOT_LISTED);\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPreBorrowerAction(cToken, borrower);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Validates that blacklisted balances are updated after borrow repayment\\r\\n * @param cToken The market to verify the repay against\\r\\n * @param payer The account which repayed the asset\\r\\n * @param borrower The account which borrowed the asset\\r\\n * @param repayAmount The amount of the underlying asset the account repayed\\r\\n */\\r\\n function repayBorrowVerify(\\r\\n address cToken,\\r\\n address payer,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) external override {\\r\\n // Keep the flywheel moving\\r\\n flywheelPostBorrowerAction(cToken, borrower);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the liquidation should be allowed to occur\\r\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\r\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\r\\n * @param liquidator The address repaying the borrow and seizing the collateral\\r\\n * @param borrower The address of the borrower\\r\\n * @param repayAmount The amount of underlying being repaid\\r\\n */\\r\\n function liquidateBorrowAllowed(\\r\\n address cTokenBorrowed,\\r\\n address cTokenCollateral,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) external override returns (uint256) {\\r\\n // Make sure markets are listed\\r\\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\\r\\n return uint256(Error.MARKET_NOT_LISTED);\\r\\n }\\r\\n\\r\\n // Get borrowers' underlying borrow balance\\r\\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\\r\\n\\r\\n /* allow accounts to be liquidated if the market is deprecated */\\r\\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\\r\\n require(borrowBalance >= repayAmount, \\\"!borrow>repay\\\");\\r\\n } else {\\r\\n /* The borrower must have shortfall in order to be liquidateable */\\r\\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\r\\n borrower,\\r\\n ICErc20(address(0)),\\r\\n 0,\\r\\n 0,\\r\\n 0\\r\\n );\\r\\n if (err != Error.NO_ERROR) {\\r\\n return uint256(err);\\r\\n }\\r\\n\\r\\n if (shortfall == 0) {\\r\\n return uint256(Error.INSUFFICIENT_SHORTFALL);\\r\\n }\\r\\n\\r\\n /* The liquidator may not repay more than what is allowed by the closeFactor */\\r\\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\\r\\n if (repayAmount > maxClose) {\\r\\n return uint256(Error.TOO_MUCH_REPAY);\\r\\n }\\r\\n }\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the seizing of assets should be allowed to occur\\r\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\r\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\r\\n * @param liquidator The address repaying the borrow and seizing the collateral\\r\\n * @param borrower The address of the borrower\\r\\n * @param seizeTokens The number of collateral tokens to seize\\r\\n */\\r\\n function seizeAllowed(\\r\\n address cTokenCollateral,\\r\\n address cTokenBorrowed,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 seizeTokens\\r\\n ) external override returns (uint256) {\\r\\n // Pausing is a very serious situation - we revert to sound the alarms\\r\\n require(!seizeGuardianPaused, \\\"!seize:paused\\\");\\r\\n\\r\\n // Make sure markets are listed\\r\\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\\r\\n return uint256(Error.MARKET_NOT_LISTED);\\r\\n }\\r\\n\\r\\n // Make sure cToken Comptrollers are identical\\r\\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\\r\\n return uint256(Error.COMPTROLLER_MISMATCH);\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Validates that blacklisted balances are updated after seizing of assets\\r\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\r\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\r\\n * @param liquidator The address repaying the borrow and seizing the collateral\\r\\n * @param borrower The address of the borrower\\r\\n * @param seizeTokens The number of collateral tokens to seize\\r\\n */\\r\\n function seizeVerify(\\r\\n address cTokenCollateral,\\r\\n address cTokenBorrowed,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 seizeTokens\\r\\n ) external override {\\r\\n // Keep the flywheel moving\\r\\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Checks if the account should be allowed to transfer tokens in the given market\\r\\n * @param cToken The market to verify the transfer against\\r\\n * @param src The account which sources the tokens\\r\\n * @param dst The account which receives the tokens\\r\\n * @param transferTokens The number of cTokens to transfer\\r\\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\r\\n */\\r\\n function transferAllowed(\\r\\n address cToken,\\r\\n address src,\\r\\n address dst,\\r\\n uint256 transferTokens\\r\\n ) external override returns (uint256) {\\r\\n // Pausing is a very serious situation - we revert to sound the alarms\\r\\n require(!transferGuardianPaused, \\\"!transfer:paused\\\");\\r\\n\\r\\n // Currently the only consideration is whether or not\\r\\n // the src is allowed to redeem this many tokens\\r\\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\\r\\n if (allowed != uint256(Error.NO_ERROR)) {\\r\\n return allowed;\\r\\n }\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPreTransferAction(cToken, src, dst);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n\\r\\n /**\\r\\n * @notice Validates that blacklisted balances are updated after transfering assets\\r\\n * @param cToken The market to verify the transfer against\\r\\n * @param src The account which sources the tokens\\r\\n * @param dst The account which receives the tokens\\r\\n * @param transferTokens The number of cTokens to transfer\\r\\n */\\r\\n function transferVerify(\\r\\n address cToken,\\r\\n address src,\\r\\n address dst,\\r\\n uint256 transferTokens\\r\\n ) external override {\\r\\n\\r\\n // Keep the flywheel moving\\r\\n flywheelPostTransferAction(cToken, src, dst);\\r\\n }\\r\\n\\r\\n /*** Flywheel Hooks ***/\\r\\n\\r\\n /**\\r\\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\\r\\n * @param cToken The relevant market\\r\\n * @param supplier The minter/redeemer\\r\\n */\\r\\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\r\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Keeps the flywheel moving post-mint and post-redeem\\r\\n * @param cToken The relevant market\\r\\n * @param supplier The minter/redeemer\\r\\n */\\r\\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\r\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\\r\\n * @param cToken The relevant market\\r\\n * @param borrower The borrower\\r\\n */\\r\\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\r\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Keeps the flywheel moving post-borrow and post-repay\\r\\n * @param cToken The relevant market\\r\\n * @param borrower The borrower\\r\\n */\\r\\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\r\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\\r\\n * @param cToken The relevant market\\r\\n * @param src The account which sources the tokens\\r\\n * @param dst The account which receives the tokens\\r\\n */\\r\\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\r\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Keeps the flywheel moving post-transfer and post-seize\\r\\n * @param cToken The relevant market\\r\\n * @param src The account which sources the tokens\\r\\n * @param dst The account which receives the tokens\\r\\n */\\r\\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\r\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\\r\\n }\\r\\n\\r\\n /*** Liquidity/Liquidation Calculations ***/\\r\\n\\r\\n /**\\r\\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\\r\\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\\r\\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\\r\\n */\\r\\n struct AccountLiquidityLocalVars {\\r\\n ICErc20 asset;\\r\\n uint256 sumCollateral;\\r\\n uint256 sumBorrowPlusEffects;\\r\\n uint256 cTokenBalance;\\r\\n uint256 borrowBalance;\\r\\n uint256 exchangeRateMantissa;\\r\\n uint256 oraclePriceMantissa;\\r\\n Exp collateralFactor;\\r\\n Exp exchangeRate;\\r\\n Exp oraclePrice;\\r\\n Exp tokensToDenom;\\r\\n uint256 borrowCapForCollateral;\\r\\n uint256 borrowedAssetPrice;\\r\\n uint256 assetAsCollateralValueCap;\\r\\n }\\r\\n\\r\\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\\r\\n (\\r\\n Error err,\\r\\n uint256 collateralValue,\\r\\n uint256 liquidity,\\r\\n uint256 shortfall\\r\\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\\r\\n return (uint256(err), collateralValue, liquidity, shortfall);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\\r\\n * @param cTokenModify The market to hypothetically redeem/borrow in\\r\\n * @param account The account to determine liquidity for\\r\\n * @param redeemTokens The number of tokens to hypothetically redeem\\r\\n * @param borrowAmount The amount of underlying to hypothetically borrow\\r\\n * @return (possible error code (semi-opaque),\\r\\n hypothetical account liquidity in excess of collateral requirements,\\r\\n * hypothetical account shortfall below collateral requirements)\\r\\n */\\r\\n function getHypotheticalAccountLiquidity(\\r\\n address account,\\r\\n address cTokenModify,\\r\\n uint256 redeemTokens,\\r\\n uint256 borrowAmount,\\r\\n uint256 repayAmount\\r\\n ) public view returns (uint256, uint256, uint256, uint256) {\\r\\n (\\r\\n Error err,\\r\\n uint256 collateralValue,\\r\\n uint256 liquidity,\\r\\n uint256 shortfall\\r\\n ) = getHypotheticalAccountLiquidityInternal(\\r\\n account,\\r\\n ICErc20(cTokenModify),\\r\\n redeemTokens,\\r\\n borrowAmount,\\r\\n repayAmount\\r\\n );\\r\\n return (uint256(err), collateralValue, liquidity, shortfall);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\\r\\n * @param cTokenModify The market to hypothetically redeem/borrow in\\r\\n * @param account The account to determine liquidity for\\r\\n * @param redeemTokens The number of tokens to hypothetically redeem\\r\\n * @param borrowAmount The amount of underlying to hypothetically borrow\\r\\n * @return (possible error code,\\r\\n hypothetical account collateral value,\\r\\n hypothetical account liquidity in excess of collateral requirements,\\r\\n * hypothetical account shortfall below collateral requirements)\\r\\n */\\r\\n function getHypotheticalAccountLiquidityInternal(\\r\\n address account,\\r\\n ICErc20 cTokenModify,\\r\\n uint256 redeemTokens,\\r\\n uint256 borrowAmount,\\r\\n uint256 repayAmount\\r\\n ) internal view returns (Error, uint256, uint256, uint256) {\\r\\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\\r\\n\\r\\n if (address(cTokenModify) != address(0)) {\\r\\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\\r\\n }\\r\\n\\r\\n // For each asset the account is in\\r\\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\\r\\n vars.asset = accountAssets[account][i];\\r\\n\\r\\n {\\r\\n // Read the balances and exchange rate from the cToken\\r\\n uint256 oErr;\\r\\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\\r\\n account\\r\\n );\\r\\n if (oErr != 0) {\\r\\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\\r\\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\\r\\n }\\r\\n }\\r\\n {\\r\\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\\r\\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\\r\\n\\r\\n // Get the normalized price of the asset\\r\\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\\r\\n if (vars.oraclePriceMantissa == 0) {\\r\\n return (Error.PRICE_ERROR, 0, 0, 0);\\r\\n }\\r\\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\\r\\n\\r\\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\\r\\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\\r\\n }\\r\\n {\\r\\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\\r\\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\\r\\n vars.asset,\\r\\n cTokenModify,\\r\\n redeemTokens > 0,\\r\\n account\\r\\n );\\r\\n\\r\\n // accumulate the collateral value to sumCollateral\\r\\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\\r\\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\\r\\n assetCollateralValue = vars.assetAsCollateralValueCap;\\r\\n vars.sumCollateral += assetCollateralValue;\\r\\n }\\r\\n\\r\\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\\r\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\r\\n vars.oraclePrice,\\r\\n vars.borrowBalance,\\r\\n vars.sumBorrowPlusEffects\\r\\n );\\r\\n\\r\\n // Calculate effects of interacting with cTokenModify\\r\\n if (vars.asset == cTokenModify) {\\r\\n // redeem effect\\r\\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\\r\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\r\\n vars.tokensToDenom,\\r\\n redeemTokens,\\r\\n vars.sumBorrowPlusEffects\\r\\n );\\r\\n\\r\\n // borrow effect\\r\\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\\r\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\r\\n vars.oraclePrice,\\r\\n borrowAmount,\\r\\n vars.sumBorrowPlusEffects\\r\\n );\\r\\n\\r\\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\\r\\n if (repayEffect >= vars.sumBorrowPlusEffects) {\\r\\n vars.sumBorrowPlusEffects = 0;\\r\\n } else {\\r\\n vars.sumBorrowPlusEffects -= repayEffect;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n // These are safe, as the underflow condition is checked first\\r\\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\\r\\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\\r\\n } else {\\r\\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\\r\\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\\r\\n * @param cTokenBorrowed The address of the borrowed cToken\\r\\n * @param cTokenCollateral The address of the collateral cToken\\r\\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\\r\\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\\r\\n */\\r\\n function liquidateCalculateSeizeTokens(\\r\\n address cTokenBorrowed,\\r\\n address cTokenCollateral,\\r\\n uint256 actualRepayAmount\\r\\n ) external view override returns (uint256, uint256) {\\r\\n /* Read oracle prices for borrowed and collateral markets */\\r\\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\\r\\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\\r\\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\\r\\n return (uint256(Error.PRICE_ERROR), 0);\\r\\n }\\r\\n\\r\\n /*\\r\\n * Get the exchange rate and calculate the number of collateral tokens to seize:\\r\\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\\r\\n * seizeTokens = seizeAmount / exchangeRate\\r\\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\\r\\n */\\r\\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\\r\\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\\r\\n uint256 seizeTokens;\\r\\n Exp memory numerator;\\r\\n Exp memory denominator;\\r\\n Exp memory ratio;\\r\\n\\r\\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\\r\\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\\r\\n\\r\\n /*\\r\\n * The liquidation penalty includes\\r\\n * - the liquidator incentive\\r\\n * - the protocol fees (Ionic admin fees)\\r\\n * - the market fee\\r\\n */\\r\\n Exp memory totalPenaltyMantissa = add_(\\r\\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\\r\\n Exp({ mantissa: feeSeizeShareMantissa })\\r\\n );\\r\\n\\r\\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\\r\\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\\r\\n ratio = div_(numerator, denominator);\\r\\n\\r\\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\\r\\n return (uint256(Error.NO_ERROR), seizeTokens);\\r\\n }\\r\\n\\r\\n /*** Admin Functions ***/\\r\\n\\r\\n /**\\r\\n * @notice Add a RewardsDistributor contracts.\\r\\n * @dev Admin function to add a RewardsDistributor contract\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _addRewardsDistributor(address distributor) external returns (uint256) {\\r\\n require(hasAdminRights(), \\\"!admin\\\");\\r\\n\\r\\n // Check marker method\\r\\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \\\"!isRewardsDistributor\\\");\\r\\n\\r\\n // Check for existing RewardsDistributor\\r\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \\\"!added\\\");\\r\\n\\r\\n // Add RewardsDistributor to array\\r\\n rewardsDistributors.push(distributor);\\r\\n emit AddedRewardsDistributor(distributor);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the whitelist enforcement for the comptroller\\r\\n * @dev Admin function to set a new whitelist enforcement boolean\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Check if `enforceWhitelist` already equals `enforce`\\r\\n if (enforceWhitelist == enforce) {\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n // Set comptroller's `enforceWhitelist` to `enforce`\\r\\n enforceWhitelist = enforce;\\r\\n\\r\\n // Emit WhitelistEnforcementChanged(bool enforce);\\r\\n emit WhitelistEnforcementChanged(enforce);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the whitelist `statuses` for `suppliers`\\r\\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Set whitelist statuses for suppliers\\r\\n for (uint256 i = 0; i < suppliers.length; i++) {\\r\\n address supplier = suppliers[i];\\r\\n\\r\\n if (statuses[i]) {\\r\\n // If not already whitelisted, add to whitelist\\r\\n if (!whitelist[supplier]) {\\r\\n whitelist[supplier] = true;\\r\\n whitelistArray.push(supplier);\\r\\n whitelistIndexes[supplier] = whitelistArray.length - 1;\\r\\n }\\r\\n } else {\\r\\n // If whitelisted, remove from whitelist\\r\\n if (whitelist[supplier]) {\\r\\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\\r\\n whitelistArray.pop(); // Reduce length by 1\\r\\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\\r\\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\\r\\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets a new price oracle for the comptroller\\r\\n * @dev Admin function to set a new price oracle\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Track the old oracle for the comptroller\\r\\n BasePriceOracle oldOracle = oracle;\\r\\n\\r\\n // Set comptroller's oracle to newOracle\\r\\n oracle = newOracle;\\r\\n\\r\\n // Emit NewPriceOracle(oldOracle, newOracle)\\r\\n emit NewPriceOracle(oldOracle, newOracle);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the closeFactor used when liquidating borrows\\r\\n * @dev Admin function to set closeFactor\\r\\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\\r\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\r\\n */\\r\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Check limits\\r\\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\\r\\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\\r\\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\\r\\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\\r\\n }\\r\\n\\r\\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\\r\\n if (lessThanExp(highLimit, newCloseFactorExp)) {\\r\\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\\r\\n }\\r\\n\\r\\n // Set pool close factor to new close factor, remember old value\\r\\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\\r\\n closeFactorMantissa = newCloseFactorMantissa;\\r\\n\\r\\n // Emit event\\r\\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the collateralFactor for a market\\r\\n * @dev Admin function to set per-market collateralFactor\\r\\n * @param cToken The market to set the factor on\\r\\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\\r\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\r\\n */\\r\\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Verify market is listed\\r\\n Market storage market = markets[address(cToken)];\\r\\n if (!market.isListed) {\\r\\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\\r\\n }\\r\\n\\r\\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\\r\\n\\r\\n // Check collateral factor <= 0.9\\r\\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\\r\\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\\r\\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\\r\\n }\\r\\n\\r\\n // If collateral factor != 0, fail if price == 0\\r\\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\\r\\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\\r\\n }\\r\\n\\r\\n // Set market's collateral factor to new collateral factor, remember old value\\r\\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\\r\\n market.collateralFactorMantissa = newCollateralFactorMantissa;\\r\\n\\r\\n // Emit event with asset, old collateral factor, and new collateral factor\\r\\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets liquidationIncentive\\r\\n * @dev Admin function to set liquidationIncentive\\r\\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\\r\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\r\\n */\\r\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Check de-scaled min <= newLiquidationIncentive <= max\\r\\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\\r\\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\\r\\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\\r\\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\\r\\n }\\r\\n\\r\\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\\r\\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\\r\\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\\r\\n }\\r\\n\\r\\n // Save current value for use in log\\r\\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\\r\\n\\r\\n // Set liquidation incentive to new incentive\\r\\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\\r\\n\\r\\n // Emit event with old incentive, new incentive\\r\\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Add the market to the markets mapping and set it as listed\\r\\n * @dev Admin function to set isListed and add support for the market\\r\\n * @param cToken The address of the market (token) to list\\r\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\r\\n */\\r\\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Is market already listed?\\r\\n if (markets[address(cToken)].isListed) {\\r\\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\\r\\n }\\r\\n\\r\\n // Check cToken.comptroller == this\\r\\n require(address(cToken.comptroller()) == address(this), \\\"!comptroller\\\");\\r\\n\\r\\n // Make sure market is not already listed\\r\\n address underlying = ICErc20(address(cToken)).underlying();\\r\\n\\r\\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\\r\\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\\r\\n }\\r\\n\\r\\n // List market and emit event\\r\\n Market storage market = markets[address(cToken)];\\r\\n market.isListed = true;\\r\\n market.collateralFactorMantissa = 0;\\r\\n allMarkets.push(cToken);\\r\\n cTokensByUnderlying[underlying] = cToken;\\r\\n emit MarketListed(cToken);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\\r\\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\\r\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\r\\n */\\r\\n function _deployMarket(\\r\\n uint8 delegateType,\\r\\n bytes calldata constructorData,\\r\\n bytes calldata becomeImplData,\\r\\n uint256 collateralFactorMantissa\\r\\n ) external returns (uint256) {\\r\\n // Check caller is admin\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\\r\\n bool oldIonicAdminHasRights = ionicAdminHasRights;\\r\\n ionicAdminHasRights = true;\\r\\n\\r\\n // Deploy via Ionic admin\\r\\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\\r\\n // Reset Ionic admin rights to the original value\\r\\n ionicAdminHasRights = oldIonicAdminHasRights;\\r\\n // Support market here in the Comptroller\\r\\n uint256 err = _supportMarket(cToken);\\r\\n\\r\\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\\r\\n\\r\\n // Set collateral factor\\r\\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\\r\\n }\\r\\n\\r\\n function _becomeImplementation() external {\\r\\n require(msg.sender == address(this), \\\"!self call\\\");\\r\\n\\r\\n if (!_notEnteredInitialized) {\\r\\n _notEntered = true;\\r\\n _notEnteredInitialized = true;\\r\\n }\\r\\n }\\r\\n\\r\\n /*** Helper Functions ***/\\r\\n\\r\\n /**\\r\\n * @notice Returns true if the given cToken market has been deprecated\\r\\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\\r\\n * @param cToken The market to check if deprecated\\r\\n */\\r\\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\\r\\n return\\r\\n markets[address(cToken)].collateralFactorMantissa == 0 &&\\r\\n borrowGuardianPaused[address(cToken)] == true &&\\r\\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\\r\\n }\\r\\n\\r\\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\\r\\n return ComptrollerExtensionInterface(address(this));\\r\\n }\\r\\n\\r\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\\r\\n uint8 fnsCount = 32;\\r\\n\\r\\n functionSelectors = new bytes4[](fnsCount);\\r\\n\\r\\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\\r\\n functionSelectors[--fnsCount] = this._deployMarket.selector;\\r\\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\\r\\n functionSelectors[--fnsCount] = this.checkMembership.selector;\\r\\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\\r\\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\\r\\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\\r\\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\\r\\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\\r\\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\\r\\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\\r\\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\\r\\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\\r\\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\\r\\n functionSelectors[--fnsCount] = this.exitMarket.selector;\\r\\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\\r\\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\\r\\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\\r\\n functionSelectors[--fnsCount] = this.mintVerify.selector;\\r\\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\\r\\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\\r\\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\\r\\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\\r\\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\\r\\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\\r\\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\\r\\n\\r\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\r\\n }\\r\\n\\r\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\r\\n\\r\\n /**\\r\\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\\r\\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\\r\\n */\\r\\n function _beforeNonReentrant() external override {\\r\\n require(markets[msg.sender].isListed, \\\"!Comptroller:_beforeNonReentrant\\\");\\r\\n require(_notEntered, \\\"!reentered\\\");\\r\\n _notEntered = false;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\\r\\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\\r\\n */\\r\\n function _afterNonReentrant() external override {\\r\\n require(markets[msg.sender].isListed, \\\"!Comptroller:_afterNonReentrant\\\");\\r\\n _notEntered = true; // get a gas-refund post-Istanbul\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7cc6778cf8c2f4b1474ce2fbeb640f0180e3eafd8f710d5c18285c352e081211\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\r\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\r\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\r\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\r\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\r\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\r\\n\\r\\ninterface ComptrollerInterface {\\r\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\r\\n\\r\\n function _becomeImplementation() external;\\r\\n\\r\\n function _deployMarket(\\r\\n uint8 delegateType,\\r\\n bytes memory constructorData,\\r\\n bytes calldata becomeImplData,\\r\\n uint256 collateralFactorMantissa\\r\\n ) external returns (uint256);\\r\\n\\r\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\r\\n\\r\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\r\\n\\r\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\r\\n\\r\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\r\\n\\r\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\r\\n\\r\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\r\\n\\r\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\r\\n\\r\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\r\\n\\r\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\r\\n\\r\\n function getHypotheticalAccountLiquidity(\\r\\n address account,\\r\\n address cTokenModify,\\r\\n uint256 redeemTokens,\\r\\n uint256 borrowAmount,\\r\\n uint256 repayAmount\\r\\n ) external view returns (uint256, uint256, uint256, uint256);\\r\\n\\r\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\r\\n\\r\\n /*** Assets You Are In ***/\\r\\n\\r\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\r\\n\\r\\n function exitMarket(address cToken) external returns (uint256);\\r\\n\\r\\n /*** Policy Hooks ***/\\r\\n\\r\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\r\\n\\r\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\r\\n\\r\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\r\\n\\r\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\r\\n\\r\\n function borrowVerify(address cToken, address borrower) external;\\r\\n\\r\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\r\\n\\r\\n function repayBorrowAllowed(\\r\\n address cToken,\\r\\n address payer,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) external returns (uint256);\\r\\n\\r\\n function repayBorrowVerify(\\r\\n address cToken,\\r\\n address payer,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) external;\\r\\n\\r\\n function liquidateBorrowAllowed(\\r\\n address cTokenBorrowed,\\r\\n address cTokenCollateral,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 repayAmount\\r\\n ) external returns (uint256);\\r\\n\\r\\n function seizeAllowed(\\r\\n address cTokenCollateral,\\r\\n address cTokenBorrowed,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 seizeTokens\\r\\n ) external returns (uint256);\\r\\n \\r\\n function seizeVerify(\\r\\n address cTokenCollateral,\\r\\n address cTokenBorrowed,\\r\\n address liquidator,\\r\\n address borrower,\\r\\n uint256 seizeTokens\\r\\n ) external;\\r\\n\\r\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\r\\n \\r\\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\r\\n\\r\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\r\\n\\r\\n /*** Liquidity/Liquidation Calculations ***/\\r\\n\\r\\n function getAccountLiquidity(\\r\\n address account\\r\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\r\\n\\r\\n function liquidateCalculateSeizeTokens(\\r\\n address cTokenBorrowed,\\r\\n address cTokenCollateral,\\r\\n uint256 repayAmount\\r\\n ) external view returns (uint256, uint256);\\r\\n\\r\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\r\\n\\r\\n function _beforeNonReentrant() external;\\r\\n\\r\\n function _afterNonReentrant() external;\\r\\n\\r\\n /*** New supply and borrow cap view functions ***/\\r\\n\\r\\n /**\\r\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\r\\n * @param cToken The address of the cToken.\\r\\n */\\r\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\r\\n\\r\\n /**\\r\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\r\\n * @param cToken The address of the cToken.\\r\\n */\\r\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\r\\n}\\r\\n\\r\\ninterface ComptrollerStorageInterface {\\r\\n function admin() external view returns (address);\\r\\n\\r\\n function adminHasRights() external view returns (bool);\\r\\n\\r\\n function ionicAdmin() external view returns (address);\\r\\n\\r\\n function ionicAdminHasRights() external view returns (bool);\\r\\n\\r\\n function pendingAdmin() external view returns (address);\\r\\n\\r\\n function oracle() external view returns (BasePriceOracle);\\r\\n\\r\\n function pauseGuardian() external view returns (address);\\r\\n\\r\\n function closeFactorMantissa() external view returns (uint256);\\r\\n\\r\\n function liquidationIncentiveMantissa() external view returns (uint256);\\r\\n\\r\\n function isUserOfPool(address user) external view returns (bool);\\r\\n\\r\\n function whitelist(address account) external view returns (bool);\\r\\n\\r\\n function enforceWhitelist() external view returns (bool);\\r\\n\\r\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\r\\n\\r\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\r\\n\\r\\n function suppliers(address account) external view returns (bool);\\r\\n\\r\\n function cTokensByUnderlying(address) external view returns (address);\\r\\n\\r\\n /**\\r\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\r\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\r\\n * `effectiveSupplyCaps` to get the correct supply cap.\\r\\n * @param cToken The address of the cToken.\\r\\n * @return The supply cap in the units of the underlying asset.\\r\\n */\\r\\n function supplyCaps(address cToken) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\r\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\r\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\r\\n * @param cToken The address of the cToken.\\r\\n * @return The borrow cap in the units of the underlying asset.\\r\\n */\\r\\n function borrowCaps(address cToken) external view returns (uint256);\\r\\n\\r\\n function markets(address cToken) external view returns (bool, uint256);\\r\\n\\r\\n function accountAssets(address, uint256) external view returns (address);\\r\\n\\r\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\r\\n\\r\\n function mintGuardianPaused(address cToken) external view returns (bool);\\r\\n\\r\\n function rewardsDistributors(uint256) external view returns (address);\\r\\n}\\r\\n\\r\\ninterface SFSRegister {\\r\\n function register(address _recipient) external returns (uint256 tokenId);\\r\\n}\\r\\n\\r\\ninterface ComptrollerExtensionInterface {\\r\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\r\\n\\r\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\r\\n\\r\\n function getAllMarkets() external view returns (ICErc20[] memory);\\r\\n\\r\\n function getAllBorrowers() external view returns (address[] memory);\\r\\n\\r\\n function getAllBorrowersCount() external view returns (uint256);\\r\\n\\r\\n function getPaginatedBorrowers(\\r\\n uint256 page,\\r\\n uint256 pageSize\\r\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\r\\n\\r\\n function getRewardsDistributors() external view returns (address[] memory);\\r\\n\\r\\n function getAccruingFlywheels() external view returns (address[] memory);\\r\\n\\r\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\r\\n\\r\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\r\\n\\r\\n function _setBorrowCapForCollateralWhitelist(\\r\\n address cTokenBorrow,\\r\\n address cTokenCollateral,\\r\\n address account,\\r\\n bool whitelisted\\r\\n ) external;\\r\\n\\r\\n function isBorrowCapForCollateralWhitelisted(\\r\\n address cTokenBorrow,\\r\\n address cTokenCollateral,\\r\\n address account\\r\\n ) external view returns (bool);\\r\\n\\r\\n function _blacklistBorrowingAgainstCollateral(\\r\\n address cTokenBorrow,\\r\\n address cTokenCollateral,\\r\\n bool blacklisted\\r\\n ) external;\\r\\n\\r\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\r\\n address cTokenBorrow,\\r\\n address cTokenCollateral,\\r\\n address account,\\r\\n bool whitelisted\\r\\n ) external;\\r\\n\\r\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\r\\n address cTokenBorrow,\\r\\n address cTokenCollateral,\\r\\n address account\\r\\n ) external view returns (bool);\\r\\n\\r\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\r\\n\\r\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\r\\n\\r\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\r\\n\\r\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\r\\n\\r\\n function getWhitelist() external view returns (address[] memory);\\r\\n\\r\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\r\\n\\r\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\r\\n\\r\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\r\\n\\r\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\r\\n\\r\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\r\\n\\r\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\r\\n\\r\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\r\\n\\r\\n function _setTransferPaused(bool state) external returns (bool);\\r\\n\\r\\n function _setSeizePaused(bool state) external returns (bool);\\r\\n\\r\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\r\\n\\r\\n function getAssetAsCollateralValueCap(\\r\\n ICErc20 collateral,\\r\\n ICErc20 cTokenModify,\\r\\n bool redeeming,\\r\\n address account\\r\\n ) external view returns (uint256);\\r\\n\\r\\n function registerInSFS() external returns (uint256);\\r\\n}\\r\\n\\r\\ninterface ComptrollerPrudentiaCapsExtInterface {\\r\\n /**\\r\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\r\\n * @return The config.\\r\\n */\\r\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\r\\n\\r\\n /**\\r\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\r\\n * @return The config.\\r\\n */\\r\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\r\\n\\r\\n /**\\r\\n * @notice Sets the Adrastia Prudentia supply cap config.\\r\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\r\\n * @param newConfig The new config.\\r\\n */\\r\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the Adrastia Prudentia supply cap config.\\r\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\r\\n * @param newConfig The new config.\\r\\n */\\r\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\r\\n}\\r\\n\\r\\ninterface UnitrollerInterface {\\r\\n function comptrollerImplementation() external view returns (address);\\r\\n\\r\\n function _upgrade() external;\\r\\n\\r\\n function _acceptAdmin() external returns (uint256);\\r\\n\\r\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\r\\n\\r\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\r\\n}\\r\\n\\r\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\r\\n\\r\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\r\\n\\r\\ninterface IonicComptroller is\\r\\n ComptrollerInterface,\\r\\n ComptrollerExtensionInterface,\\r\\n UnitrollerInterface,\\r\\n ComptrollerStorageInterface\\r\\n{\\r\\n\\r\\n}\\r\\n\\r\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\r\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\r\\n bool public constant isComptroller = true;\\r\\n\\r\\n /**\\r\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\r\\n * @param cToken The address of the cToken.\\r\\n */\\r\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\r\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\r\\n\\r\\n // Check if we're using Adrastia Prudentia for the supply cap\\r\\n if (capConfig.controller != address(0)) {\\r\\n // We have a controller, so we're using Adrastia Prudentia\\r\\n\\r\\n address underlyingToken = ICErc20(cToken).underlying();\\r\\n\\r\\n // Get the supply cap from Adrastia Prudentia\\r\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\r\\n\\r\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\r\\n // must scale the supply cap to get the correct amount\\r\\n\\r\\n int256 scaleByDecimals = 18;\\r\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\r\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\r\\n if (success && data.length == 32) {\\r\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\r\\n }\\r\\n\\r\\n scaleByDecimals += capConfig.decimalShift;\\r\\n\\r\\n if (scaleByDecimals >= 0) {\\r\\n // We're scaling up, so we need to multiply\\r\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\r\\n } else {\\r\\n // We're scaling down, so we need to divide\\r\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\r\\n }\\r\\n } else {\\r\\n // We don't have a controller, so we're using the local supply cap\\r\\n\\r\\n // Get the supply cap from the local supply cap\\r\\n supplyCap = supplyCaps[cToken];\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\r\\n * @param cToken The address of the cToken.\\r\\n */\\r\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\r\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\r\\n\\r\\n // Check if we're using Adrastia Prudentia for the borrow cap\\r\\n if (capConfig.controller != address(0)) {\\r\\n // We have a controller, so we're using Adrastia Prudentia\\r\\n\\r\\n address underlyingToken = ICErc20(cToken).underlying();\\r\\n\\r\\n // Get the borrow cap from Adrastia Prudentia\\r\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\r\\n\\r\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\r\\n // must scale the supply cap to get the correct amount\\r\\n\\r\\n int256 scaleByDecimals = 18;\\r\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\r\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\r\\n if (success && data.length == 32) {\\r\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\r\\n }\\r\\n\\r\\n scaleByDecimals += capConfig.decimalShift;\\r\\n\\r\\n if (scaleByDecimals >= 0) {\\r\\n // We're scaling up, so we need to multiply\\r\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\r\\n } else {\\r\\n // We're scaling down, so we need to divide\\r\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\r\\n }\\r\\n } else {\\r\\n // We don't have a controller, so we're using the local borrow cap\\r\\n borrowCap = borrowCaps[cToken];\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf61761da6983d08f8e88335f8aa96a342a1246069d77fa7c2f533e315939674b\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./IFeeDistributor.sol\\\";\\r\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\r\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\r\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\r\\n\\r\\ncontract UnitrollerAdminStorage {\\r\\n /*\\r\\n * Administrator for Ionic\\r\\n */\\r\\n address payable public ionicAdmin;\\r\\n\\r\\n /**\\r\\n * @notice Administrator for this contract\\r\\n */\\r\\n address public admin;\\r\\n\\r\\n /**\\r\\n * @notice Pending administrator for this contract\\r\\n */\\r\\n address public pendingAdmin;\\r\\n\\r\\n /**\\r\\n * @notice Whether or not the Ionic admin has admin rights\\r\\n */\\r\\n bool public ionicAdminHasRights = true;\\r\\n\\r\\n /**\\r\\n * @notice Whether or not the admin has admin rights\\r\\n */\\r\\n bool public adminHasRights = true;\\r\\n\\r\\n /**\\r\\n * @notice Returns a boolean indicating if the sender has admin rights\\r\\n */\\r\\n function hasAdminRights() internal view returns (bool) {\\r\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\r\\n }\\r\\n}\\r\\n\\r\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\r\\n /**\\r\\n * @notice Oracle which gives the price of any given asset\\r\\n */\\r\\n BasePriceOracle public oracle;\\r\\n\\r\\n /**\\r\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\r\\n */\\r\\n uint256 public closeFactorMantissa;\\r\\n\\r\\n /**\\r\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\r\\n */\\r\\n uint256 public liquidationIncentiveMantissa;\\r\\n\\r\\n /*\\r\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\r\\n */\\r\\n uint256 internal maxAssets;\\r\\n\\r\\n /**\\r\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\r\\n */\\r\\n mapping(address => ICErc20[]) public accountAssets;\\r\\n}\\r\\n\\r\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\r\\n struct Market {\\r\\n // Whether or not this market is listed\\r\\n bool isListed;\\r\\n // Multiplier representing the most one can borrow against their collateral in this market.\\r\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\r\\n // Must be between 0 and 1, and stored as a mantissa.\\r\\n uint256 collateralFactorMantissa;\\r\\n // Per-market mapping of \\\"accounts in this asset\\\"\\r\\n mapping(address => bool) accountMembership;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Official mapping of cTokens -> Market metadata\\r\\n * @dev Used e.g. to determine if a market is supported\\r\\n */\\r\\n mapping(address => Market) public markets;\\r\\n\\r\\n /// @notice A list of all markets\\r\\n ICErc20[] public allMarkets;\\r\\n\\r\\n /**\\r\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\r\\n */\\r\\n mapping(address => bool) internal borrowers;\\r\\n\\r\\n /// @notice A list of all borrowers who have entered markets\\r\\n address[] public allBorrowers;\\r\\n\\r\\n // Indexes of borrower account addresses in the `allBorrowers` array\\r\\n mapping(address => uint256) internal borrowerIndexes;\\r\\n\\r\\n /**\\r\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\r\\n */\\r\\n mapping(address => bool) public suppliers;\\r\\n\\r\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\r\\n mapping(address => ICErc20) public cTokensByUnderlying;\\r\\n\\r\\n /// @notice Whether or not the supplier whitelist is enforced\\r\\n bool public enforceWhitelist;\\r\\n\\r\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\r\\n mapping(address => bool) public whitelist;\\r\\n\\r\\n /// @notice An array of all whitelisted accounts\\r\\n address[] public whitelistArray;\\r\\n\\r\\n // Indexes of account addresses in the `whitelistArray` array\\r\\n mapping(address => uint256) internal whitelistIndexes;\\r\\n\\r\\n /**\\r\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\r\\n * Actions which allow users to remove their own assets cannot be paused.\\r\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\r\\n */\\r\\n address public pauseGuardian;\\r\\n bool public _mintGuardianPaused;\\r\\n bool public _borrowGuardianPaused;\\r\\n bool public transferGuardianPaused;\\r\\n bool public seizeGuardianPaused;\\r\\n mapping(address => bool) public mintGuardianPaused;\\r\\n mapping(address => bool) public borrowGuardianPaused;\\r\\n}\\r\\n\\r\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\r\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\r\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\r\\n address public borrowCapGuardian;\\r\\n\\r\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\r\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\r\\n mapping(address => uint256) public borrowCaps;\\r\\n\\r\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\r\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\r\\n mapping(address => uint256) public supplyCaps;\\r\\n\\r\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\r\\n address[] public rewardsDistributors;\\r\\n\\r\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\r\\n bool internal _notEntered;\\r\\n\\r\\n /// @dev Whether or not _notEntered has been initialized\\r\\n bool internal _notEnteredInitialized;\\r\\n\\r\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\r\\n address[] public nonAccruingRewardsDistributors;\\r\\n\\r\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\r\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\r\\n\\r\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\r\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\r\\n\\r\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\r\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\r\\n\\r\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\r\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\r\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\r\\n\\r\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\r\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\r\\n\\r\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\r\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\r\\n}\\r\\n\\r\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\r\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\r\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\r\\n\\r\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\r\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\r\\n}\\r\\n\",\"keccak256\":\"0xd9a1883a27323dfb24d44f1965b3f4c9bafca60490f00e6de60f9a0d8230fbc0\",\"license\":\"UNLICENSED\"},\"contracts/compound/EIP20Interface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/**\\r\\n * @title ERC 20 Token Standard Interface\\r\\n * https://eips.ethereum.org/EIPS/eip-20\\r\\n */\\r\\ninterface EIP20Interface {\\r\\n function name() external view returns (string memory);\\r\\n\\r\\n function symbol() external view returns (string memory);\\r\\n\\r\\n function decimals() external view returns (uint8);\\r\\n\\r\\n /**\\r\\n * @notice Get the total number of tokens in circulation\\r\\n * @return uint256 The supply of tokens\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Gets the balance of the specified address\\r\\n * @param owner The address from which the balance will be retrieved\\r\\n * @return balance uint256 The balance\\r\\n */\\r\\n function balanceOf(address owner) external view returns (uint256 balance);\\r\\n\\r\\n /**\\r\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\r\\n * @param dst The address of the destination account\\r\\n * @param amount The number of tokens to transfer\\r\\n * @return success bool Whether or not the transfer succeeded\\r\\n */\\r\\n function transfer(address dst, uint256 amount) external returns (bool success);\\r\\n\\r\\n /**\\r\\n * @notice Transfer `amount` tokens from `src` to `dst`\\r\\n * @param src The address of the source account\\r\\n * @param dst The address of the destination account\\r\\n * @param amount The number of tokens to transfer\\r\\n * @return success bool Whether or not the transfer succeeded\\r\\n */\\r\\n function transferFrom(\\r\\n address src,\\r\\n address dst,\\r\\n uint256 amount\\r\\n ) external returns (bool success);\\r\\n\\r\\n /**\\r\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\r\\n * @dev This will overwrite the approval amount for `spender`\\r\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\r\\n * @param spender The address of the account which may transfer tokens\\r\\n * @param amount The number of tokens that are approved (-1 means infinite)\\r\\n * @return success bool Whether or not the approval succeeded\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool success);\\r\\n\\r\\n /**\\r\\n * @notice Get the current allowance from `owner` for `spender`\\r\\n * @param owner The address of the account which owns the tokens to be spent\\r\\n * @param spender The address of the account which may transfer tokens\\r\\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256 remaining);\\r\\n\\r\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\r\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\r\\n}\\r\\n\",\"keccak256\":\"0x8c79087af350fd8e58172bcc60f59e33208d6fba18d74b4e8568ef722444b95c\",\"license\":\"UNLICENSED\"},\"contracts/compound/ErrorReporter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\ncontract ComptrollerErrorReporter {\\r\\n enum Error {\\r\\n NO_ERROR,\\r\\n UNAUTHORIZED,\\r\\n COMPTROLLER_MISMATCH,\\r\\n INSUFFICIENT_SHORTFALL,\\r\\n INSUFFICIENT_LIQUIDITY,\\r\\n INVALID_CLOSE_FACTOR,\\r\\n INVALID_COLLATERAL_FACTOR,\\r\\n INVALID_LIQUIDATION_INCENTIVE,\\r\\n MARKET_NOT_LISTED,\\r\\n MARKET_ALREADY_LISTED,\\r\\n MATH_ERROR,\\r\\n NONZERO_BORROW_BALANCE,\\r\\n PRICE_ERROR,\\r\\n REJECTION,\\r\\n SNAPSHOT_ERROR,\\r\\n TOO_MANY_ASSETS,\\r\\n TOO_MUCH_REPAY,\\r\\n SUPPLIER_NOT_WHITELISTED,\\r\\n BORROW_BELOW_MIN,\\r\\n SUPPLY_ABOVE_MAX,\\r\\n NONZERO_TOTAL_SUPPLY\\r\\n }\\r\\n\\r\\n enum FailureInfo {\\r\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\r\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\r\\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\\r\\n EXIT_MARKET_BALANCE_OWED,\\r\\n EXIT_MARKET_REJECTION,\\r\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\r\\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\\r\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\r\\n SET_CLOSE_FACTOR_VALIDATION,\\r\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\r\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\r\\n SET_COLLATERAL_FACTOR_VALIDATION,\\r\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\r\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\r\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\r\\n SET_PENDING_ADMIN_OWNER_CHECK,\\r\\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\\r\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\r\\n SET_PRICE_ORACLE_OWNER_CHECK,\\r\\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\\r\\n SET_WHITELIST_STATUS_OWNER_CHECK,\\r\\n SUPPORT_MARKET_EXISTS,\\r\\n SUPPORT_MARKET_OWNER_CHECK,\\r\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\r\\n UNSUPPORT_MARKET_OWNER_CHECK,\\r\\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\\r\\n UNSUPPORT_MARKET_IN_USE\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\r\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\r\\n **/\\r\\n event Failure(uint256 error, uint256 info, uint256 detail);\\r\\n\\r\\n /**\\r\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\r\\n */\\r\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\r\\n emit Failure(uint256(err), uint256(info), 0);\\r\\n\\r\\n return uint256(err);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\r\\n */\\r\\n function failOpaque(\\r\\n Error err,\\r\\n FailureInfo info,\\r\\n uint256 opaqueError\\r\\n ) internal returns (uint256) {\\r\\n emit Failure(uint256(err), uint256(info), opaqueError);\\r\\n\\r\\n return uint256(err);\\r\\n }\\r\\n}\\r\\n\\r\\ncontract TokenErrorReporter {\\r\\n enum Error {\\r\\n NO_ERROR,\\r\\n UNAUTHORIZED,\\r\\n BAD_INPUT,\\r\\n COMPTROLLER_REJECTION,\\r\\n COMPTROLLER_CALCULATION_ERROR,\\r\\n INTEREST_RATE_MODEL_ERROR,\\r\\n INVALID_ACCOUNT_PAIR,\\r\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\r\\n INVALID_COLLATERAL_FACTOR,\\r\\n MATH_ERROR,\\r\\n MARKET_NOT_FRESH,\\r\\n MARKET_NOT_LISTED,\\r\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\r\\n TOKEN_INSUFFICIENT_BALANCE,\\r\\n TOKEN_INSUFFICIENT_CASH,\\r\\n TOKEN_TRANSFER_IN_FAILED,\\r\\n TOKEN_TRANSFER_OUT_FAILED,\\r\\n UTILIZATION_ABOVE_MAX\\r\\n }\\r\\n\\r\\n /*\\r\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\r\\n * This is because FailureInfo grows significantly faster, and\\r\\n * the order of Error has some meaning, while the order of FailureInfo\\r\\n * is entirely arbitrary.\\r\\n */\\r\\n enum FailureInfo {\\r\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\r\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\\r\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\r\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\r\\n BORROW_ACCRUE_INTEREST_FAILED,\\r\\n BORROW_CASH_NOT_AVAILABLE,\\r\\n BORROW_FRESHNESS_CHECK,\\r\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\r\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\r\\n BORROW_MARKET_NOT_LISTED,\\r\\n BORROW_COMPTROLLER_REJECTION,\\r\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\r\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\r\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\r\\n LIQUIDATE_COMPTROLLER_REJECTION,\\r\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\r\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\r\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\r\\n LIQUIDATE_FRESHNESS_CHECK,\\r\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\r\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\r\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\r\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\r\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\r\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\r\\n LIQUIDATE_SEIZE_TOO_MUCH,\\r\\n MINT_ACCRUE_INTEREST_FAILED,\\r\\n MINT_COMPTROLLER_REJECTION,\\r\\n MINT_EXCHANGE_CALCULATION_FAILED,\\r\\n MINT_EXCHANGE_RATE_READ_FAILED,\\r\\n MINT_FRESHNESS_CHECK,\\r\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\r\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\r\\n MINT_TRANSFER_IN_FAILED,\\r\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\r\\n NEW_UTILIZATION_RATE_ABOVE_MAX,\\r\\n REDEEM_ACCRUE_INTEREST_FAILED,\\r\\n REDEEM_COMPTROLLER_REJECTION,\\r\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\r\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\r\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\r\\n REDEEM_FRESHNESS_CHECK,\\r\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\r\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\r\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\r\\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\\r\\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\\r\\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\\r\\n WITHDRAW_IONIC_FEES_VALIDATION,\\r\\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\\r\\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\\r\\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\\r\\n WITHDRAW_ADMIN_FEES_VALIDATION,\\r\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\r\\n REDUCE_RESERVES_ADMIN_CHECK,\\r\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\r\\n REDUCE_RESERVES_FRESH_CHECK,\\r\\n REDUCE_RESERVES_VALIDATION,\\r\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\r\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\r\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\r\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\r\\n REPAY_BORROW_FRESHNESS_CHECK,\\r\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\r\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\r\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\r\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\r\\n SET_COLLATERAL_FACTOR_VALIDATION,\\r\\n SET_COMPTROLLER_OWNER_CHECK,\\r\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\r\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\r\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\r\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\r\\n SET_PENDING_ADMIN_OWNER_CHECK,\\r\\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\\r\\n SET_ADMIN_FEE_ADMIN_CHECK,\\r\\n SET_ADMIN_FEE_FRESH_CHECK,\\r\\n SET_ADMIN_FEE_BOUNDS_CHECK,\\r\\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\\r\\n SET_IONIC_FEE_FRESH_CHECK,\\r\\n SET_IONIC_FEE_BOUNDS_CHECK,\\r\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\r\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\r\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\r\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\r\\n TRANSFER_COMPTROLLER_REJECTION,\\r\\n TRANSFER_NOT_ALLOWED,\\r\\n TRANSFER_NOT_ENOUGH,\\r\\n TRANSFER_TOO_MUCH,\\r\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\r\\n ADD_RESERVES_FRESH_CHECK,\\r\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\r\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\r\\n **/\\r\\n event Failure(uint256 error, uint256 info, uint256 detail);\\r\\n\\r\\n /**\\r\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\r\\n */\\r\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\r\\n emit Failure(uint256(err), uint256(info), 0);\\r\\n\\r\\n return uint256(err);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\r\\n */\\r\\n function failOpaque(\\r\\n Error err,\\r\\n FailureInfo info,\\r\\n uint256 opaqueError\\r\\n ) internal returns (uint256) {\\r\\n emit Failure(uint256(err), uint256(info), opaqueError);\\r\\n\\r\\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x697b3e9bf684672cd1cf351ddc31daa5989f23c1d10698fafd244bcbe01c80ad\",\"license\":\"UNLICENSED\"},\"contracts/compound/Exponential.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./CarefulMath.sol\\\";\\r\\nimport \\\"./ExponentialNoError.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title Exponential module for storing fixed-precision decimals\\r\\n * @author Compound\\r\\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\\r\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\r\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\r\\n * `Exp({mantissa: 5100000000000000000})`.\\r\\n */\\r\\ncontract Exponential is CarefulMath, ExponentialNoError {\\r\\n /**\\r\\n * @dev Creates an exponential from numerator and denominator values.\\r\\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\\r\\n * or if `denom` is zero.\\r\\n */\\r\\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\\r\\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\\r\\n if (err0 != MathError.NO_ERROR) {\\r\\n return (err0, Exp({ mantissa: 0 }));\\r\\n }\\r\\n\\r\\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\\r\\n if (err1 != MathError.NO_ERROR) {\\r\\n return (err1, Exp({ mantissa: 0 }));\\r\\n }\\r\\n\\r\\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Adds two exponentials, returning a new exponential.\\r\\n */\\r\\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\r\\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\\r\\n\\r\\n return (error, Exp({ mantissa: result }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Subtracts two exponentials, returning a new exponential.\\r\\n */\\r\\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\r\\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\\r\\n\\r\\n return (error, Exp({ mantissa: result }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiply an Exp by a scalar, returning a new Exp.\\r\\n */\\r\\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\\r\\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\\r\\n if (err0 != MathError.NO_ERROR) {\\r\\n return (err0, Exp({ mantissa: 0 }));\\r\\n }\\r\\n\\r\\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\r\\n */\\r\\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\\r\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\r\\n if (err != MathError.NO_ERROR) {\\r\\n return (err, 0);\\r\\n }\\r\\n\\r\\n return (MathError.NO_ERROR, truncate(product));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Divide an Exp by a scalar, returning a new Exp.\\r\\n */\\r\\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\\r\\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\\r\\n if (err0 != MathError.NO_ERROR) {\\r\\n return (err0, Exp({ mantissa: 0 }));\\r\\n }\\r\\n\\r\\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Divide a scalar by an Exp, returning a new Exp.\\r\\n */\\r\\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\\r\\n /*\\r\\n We are doing this as:\\r\\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\\r\\n\\r\\n How it works:\\r\\n Exp = a / b;\\r\\n Scalar = s;\\r\\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\\r\\n */\\r\\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\\r\\n if (err0 != MathError.NO_ERROR) {\\r\\n return (err0, Exp({ mantissa: 0 }));\\r\\n }\\r\\n return getExp(numerator, divisor.mantissa);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\\r\\n */\\r\\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\\r\\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\\r\\n if (err != MathError.NO_ERROR) {\\r\\n return (err, 0);\\r\\n }\\r\\n\\r\\n return (MathError.NO_ERROR, truncate(fraction));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiplies two exponentials, returning a new exponential.\\r\\n */\\r\\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\r\\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\\r\\n if (err0 != MathError.NO_ERROR) {\\r\\n return (err0, Exp({ mantissa: 0 }));\\r\\n }\\r\\n\\r\\n // We add half the scale before dividing so that we get rounding instead of truncation.\\r\\n // See \\\"Listing 6\\\" and text above it at https://accu.org/index.php/journals/1717\\r\\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\\r\\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\\r\\n if (err1 != MathError.NO_ERROR) {\\r\\n return (err1, Exp({ mantissa: 0 }));\\r\\n }\\r\\n\\r\\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\\r\\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\\r\\n assert(err2 == MathError.NO_ERROR);\\r\\n\\r\\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\\r\\n */\\r\\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\\r\\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiplies three exponentials, returning a new exponential.\\r\\n */\\r\\n function mulExp3(\\r\\n Exp memory a,\\r\\n Exp memory b,\\r\\n Exp memory c\\r\\n ) internal pure returns (MathError, Exp memory) {\\r\\n (MathError err, Exp memory ab) = mulExp(a, b);\\r\\n if (err != MathError.NO_ERROR) {\\r\\n return (err, ab);\\r\\n }\\r\\n return mulExp(ab, c);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Divides two exponentials, returning a new exponential.\\r\\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\\r\\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\\r\\n */\\r\\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\r\\n return getExp(a.mantissa, b.mantissa);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xd51e0c325f05c7334695b843e36187b236080df4058f801530798c9dada7cee7\",\"license\":\"UNLICENSED\"},\"contracts/compound/ExponentialNoError.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/**\\r\\n * @title Exponential module for storing fixed-precision decimals\\r\\n * @author Compound\\r\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\r\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\r\\n * `Exp({mantissa: 5100000000000000000})`.\\r\\n */\\r\\ncontract ExponentialNoError {\\r\\n uint256 constant expScale = 1e18;\\r\\n uint256 constant doubleScale = 1e36;\\r\\n uint256 constant halfExpScale = expScale / 2;\\r\\n uint256 constant mantissaOne = expScale;\\r\\n\\r\\n struct Exp {\\r\\n uint256 mantissa;\\r\\n }\\r\\n\\r\\n struct Double {\\r\\n uint256 mantissa;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Truncates the given exp to a whole number value.\\r\\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\\r\\n */\\r\\n function truncate(Exp memory exp) internal pure returns (uint256) {\\r\\n // Note: We are not using careful math here as we're performing a division that cannot fail\\r\\n return exp.mantissa / expScale;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\r\\n */\\r\\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\\r\\n Exp memory product = mul_(a, scalar);\\r\\n return truncate(product);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\r\\n */\\r\\n function mul_ScalarTruncateAddUInt(\\r\\n Exp memory a,\\r\\n uint256 scalar,\\r\\n uint256 addend\\r\\n ) internal pure returns (uint256) {\\r\\n Exp memory product = mul_(a, scalar);\\r\\n return add_(truncate(product), addend);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Checks if first Exp is less than second Exp.\\r\\n */\\r\\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\r\\n return left.mantissa < right.mantissa;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Checks if left Exp <= right Exp.\\r\\n */\\r\\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\r\\n return left.mantissa <= right.mantissa;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Checks if left Exp > right Exp.\\r\\n */\\r\\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\r\\n return left.mantissa > right.mantissa;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev returns true if Exp is exactly zero\\r\\n */\\r\\n function isZeroExp(Exp memory value) internal pure returns (bool) {\\r\\n return value.mantissa == 0;\\r\\n }\\r\\n\\r\\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\\r\\n require(n < 2**224, errorMessage);\\r\\n return uint224(n);\\r\\n }\\r\\n\\r\\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\\r\\n require(n < 2**32, errorMessage);\\r\\n return uint32(n);\\r\\n }\\r\\n\\r\\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\r\\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\\r\\n }\\r\\n\\r\\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\\r\\n }\\r\\n\\r\\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return add_(a, b, \\\"addition overflow\\\");\\r\\n }\\r\\n\\r\\n function add_(\\r\\n uint256 a,\\r\\n uint256 b,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (uint256) {\\r\\n uint256 c = a + b;\\r\\n require(c >= a, errorMessage);\\r\\n return c;\\r\\n }\\r\\n\\r\\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\r\\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\\r\\n }\\r\\n\\r\\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\\r\\n }\\r\\n\\r\\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return sub_(a, b, \\\"subtraction underflow\\\");\\r\\n }\\r\\n\\r\\n function sub_(\\r\\n uint256 a,\\r\\n uint256 b,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (uint256) {\\r\\n require(b <= a, errorMessage);\\r\\n return a - b;\\r\\n }\\r\\n\\r\\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\r\\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\\r\\n }\\r\\n\\r\\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\\r\\n return Exp({ mantissa: mul_(a.mantissa, b) });\\r\\n }\\r\\n\\r\\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\\r\\n return mul_(a, b.mantissa) / expScale;\\r\\n }\\r\\n\\r\\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\\r\\n }\\r\\n\\r\\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: mul_(a.mantissa, b) });\\r\\n }\\r\\n\\r\\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\\r\\n return mul_(a, b.mantissa) / doubleScale;\\r\\n }\\r\\n\\r\\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return mul_(a, b, \\\"multiplication overflow\\\");\\r\\n }\\r\\n\\r\\n function mul_(\\r\\n uint256 a,\\r\\n uint256 b,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (uint256) {\\r\\n if (a == 0 || b == 0) {\\r\\n return 0;\\r\\n }\\r\\n uint256 c = a * b;\\r\\n require(c / a == b, errorMessage);\\r\\n return c;\\r\\n }\\r\\n\\r\\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\r\\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\\r\\n }\\r\\n\\r\\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\\r\\n return Exp({ mantissa: div_(a.mantissa, b) });\\r\\n }\\r\\n\\r\\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\\r\\n return div_(mul_(a, expScale), b.mantissa);\\r\\n }\\r\\n\\r\\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\\r\\n }\\r\\n\\r\\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: div_(a.mantissa, b) });\\r\\n }\\r\\n\\r\\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\\r\\n return div_(mul_(a, doubleScale), b.mantissa);\\r\\n }\\r\\n\\r\\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\\r\\n return div_(a, b, \\\"divide by zero\\\");\\r\\n }\\r\\n\\r\\n function div_(\\r\\n uint256 a,\\r\\n uint256 b,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (uint256) {\\r\\n require(b > 0, errorMessage);\\r\\n return a / b;\\r\\n }\\r\\n\\r\\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\\r\\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x86050d33a690c9c459727b364478f49a3d889eb872c13ca3e79f1aa11fe7a49b\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\r\\n\\r\\ninterface IFeeDistributor {\\r\\n function minBorrowEth() external view returns (uint256);\\r\\n\\r\\n function maxUtilizationRate() external view returns (uint256);\\r\\n\\r\\n function interestFeeRate() external view returns (uint256);\\r\\n\\r\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\r\\n\\r\\n function latestCErc20Delegate(uint8 delegateType)\\r\\n external\\r\\n view\\r\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\r\\n\\r\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\r\\n\\r\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\r\\n\\r\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\r\\n\\r\\n function deployCErc20(\\r\\n uint8 delegateType,\\r\\n bytes calldata constructorData,\\r\\n bytes calldata becomeImplData\\r\\n ) external returns (address);\\r\\n\\r\\n function canCall(\\r\\n address pool,\\r\\n address user,\\r\\n address target,\\r\\n bytes4 functionSig\\r\\n ) external view returns (bool);\\r\\n\\r\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\r\\n\\r\\n fallback() external payable;\\r\\n\\r\\n receive() external payable;\\r\\n}\\r\\n\",\"keccak256\":\"0x82c4f1084fa6efa0a2b94fecd41d1bdff9fe5fd1a16df06b0effc414614d9057\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/**\\r\\n * @title Compound's InterestRateModel Interface\\r\\n * @author Compound\\r\\n */\\r\\nabstract contract InterestRateModel {\\r\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\r\\n bool public constant isInterestRateModel = true;\\r\\n\\r\\n /**\\r\\n * @notice Calculates the current borrow interest rate per block\\r\\n * @param cash The total amount of cash the market has\\r\\n * @param borrows The total amount of borrows the market has outstanding\\r\\n * @param reserves The total amount of reserves the market has\\r\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\r\\n */\\r\\n function getBorrowRate(\\r\\n uint256 cash,\\r\\n uint256 borrows,\\r\\n uint256 reserves\\r\\n ) public view virtual returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Calculates the current supply interest rate per block\\r\\n * @param cash The total amount of cash the market has\\r\\n * @param borrows The total amount of borrows the market has outstanding\\r\\n * @param reserves The total amount of reserves the market has\\r\\n * @param reserveFactorMantissa The current reserve factor the market has\\r\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\r\\n */\\r\\n function getSupplyRate(\\r\\n uint256 cash,\\r\\n uint256 borrows,\\r\\n uint256 reserves,\\r\\n uint256 reserveFactorMantissa\\r\\n ) public view virtual returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x5200b4cd947a8cc34ee58af9b69279cc17189752b57d044f64a122de40f0db85\",\"license\":\"UNLICENSED\"},\"contracts/compound/Unitroller.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./ErrorReporter.sol\\\";\\r\\nimport \\\"./ComptrollerStorage.sol\\\";\\r\\nimport \\\"./Comptroller.sol\\\";\\r\\nimport { DiamondExtension, DiamondBase, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title Unitroller\\r\\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\\r\\n * CTokens should reference this contract as their comptroller.\\r\\n */\\r\\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\\r\\n /**\\r\\n * @notice Event emitted when the admin rights are changed\\r\\n */\\r\\n event AdminRightsToggled(bool hasRights);\\r\\n\\r\\n /**\\r\\n * @notice Emitted when pendingAdmin is changed\\r\\n */\\r\\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\\r\\n\\r\\n /**\\r\\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\\r\\n */\\r\\n event NewAdmin(address oldAdmin, address newAdmin);\\r\\n\\r\\n constructor(address payable _ionicAdmin) {\\r\\n admin = msg.sender;\\r\\n ionicAdmin = _ionicAdmin;\\r\\n }\\r\\n\\r\\n /*** Admin Functions ***/\\r\\n\\r\\n /**\\r\\n * @notice Toggles admin rights.\\r\\n * @param hasRights Boolean indicating if the admin is to have rights.\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n // Check that rights have not already been set to the desired value\\r\\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\\r\\n\\r\\n adminHasRights = hasRights;\\r\\n emit AdminRightsToggled(hasRights);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\\r\\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\\r\\n * @param newPendingAdmin New pending admin.\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\\r\\n if (!hasAdminRights()) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\\r\\n }\\r\\n\\r\\n address oldPendingAdmin = pendingAdmin;\\r\\n pendingAdmin = newPendingAdmin;\\r\\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\\r\\n * @dev Admin function for pending admin to accept role and update admin\\r\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\r\\n */\\r\\n function _acceptAdmin() public returns (uint256) {\\r\\n // Check caller is pendingAdmin and pendingAdmin \\u2260 address(0)\\r\\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\\r\\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\\r\\n }\\r\\n\\r\\n // Save current values for inclusion in log\\r\\n address oldAdmin = admin;\\r\\n address oldPendingAdmin = pendingAdmin;\\r\\n\\r\\n admin = pendingAdmin;\\r\\n pendingAdmin = address(0);\\r\\n\\r\\n emit NewAdmin(oldAdmin, admin);\\r\\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\\r\\n\\r\\n return uint256(Error.NO_ERROR);\\r\\n }\\r\\n\\r\\n function comptrollerImplementation() public view returns (address) {\\r\\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\\\"_deployMarket(uint8,bytes,bytes,uint256)\\\"))));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev upgrades the implementation if necessary\\r\\n */\\r\\n function _upgrade() external {\\r\\n require(msg.sender == address(this) || hasAdminRights(), \\\"!self || !admin\\\");\\r\\n\\r\\n address currentImplementation = comptrollerImplementation();\\r\\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\\r\\n currentImplementation\\r\\n );\\r\\n\\r\\n _updateExtensions(latestComptrollerImplementation);\\r\\n\\r\\n if (currentImplementation != latestComptrollerImplementation) {\\r\\n // reinitialize\\r\\n _functionCall(address(this), abi.encodeWithSignature(\\\"_becomeImplementation()\\\"), \\\"!become impl\\\");\\r\\n }\\r\\n }\\r\\n\\r\\n function _functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.call(data);\\r\\n\\r\\n if (!success) {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n\\r\\n // solhint-disable-next-line no-inline-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n return returndata;\\r\\n }\\r\\n\\r\\n function _updateExtensions(address currentComptroller) internal {\\r\\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\\r\\n address[] memory currentExtensions = LibDiamond.listExtensions();\\r\\n\\r\\n // removed the current (old) extensions\\r\\n for (uint256 i = 0; i < currentExtensions.length; i++) {\\r\\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\\r\\n }\\r\\n // add the new extensions\\r\\n for (uint256 i = 0; i < latestExtensions.length; i++) {\\r\\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev register a logic extension\\r\\n * @param extensionToAdd the extension whose functions are to be added\\r\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\r\\n */\\r\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\\r\\n require(hasAdminRights(), \\\"!unauthorized\\\");\\r\\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x35e800749bbf00a0457e7302c897583619867a06f26c831adbb7610ffb923f3d\",\"license\":\"UNLICENSED\"},\"contracts/external/hypernative/interfaces/IHypernativeOracle.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity ^0.8.22;\\r\\n\\r\\ninterface IHypernativeOracle {\\r\\n function register(address account, bool isStrictMode) external;\\r\\n function validateForbiddenAccountInteraction(address sender) external view;\\r\\n function validateForbiddenContextInteraction(address origin, address sender) external view;\\r\\n function validateBlacklistedAccountInteraction(address sender) external;\\r\\n}\",\"keccak256\":\"0xb69cb5048064cc315748dbaf172012992c96bc809edd2e1105610fd2dee928bb\",\"license\":\"MIT\"},\"contracts/external/pyth/IExpressRelay.sol\":{\"content\":\"// SPDX-License-Identifier: Apache 2\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface IExpressRelay {\\r\\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\\r\\n // This will return true if and only if it's being called while executing the auction winner(s) call.\\r\\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\\r\\n // @param permissionId The id that represents the action being gated\\r\\n // @return permissioned True if the permission is allowed, false otherwise\\r\\n function isPermissioned(\\r\\n address protocolFeeReceiver,\\r\\n bytes calldata permissionId\\r\\n ) external view returns (bool permissioned);\\r\\n}\\r\\n\",\"keccak256\":\"0xd2b2d82a2d74dbe7b3e4808ff4fd21ee768dba55fd7aac7bc2bf4a9128791ac3\",\"license\":\"Apache 2\"},\"contracts/external/pyth/IExpressRelayFeeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: Apache 2\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface IExpressRelayFeeReceiver {\\r\\n // Receive the proceeds of an auction.\\r\\n // @param permissionKey The permission key where the auction was conducted on.\\r\\n function receiveAuctionProceedings(\\r\\n bytes calldata permissionKey\\r\\n ) external payable;\\r\\n}\\r\\n\",\"keccak256\":\"0xe73d8306814ca37b1a611ba268a671ba9d227a1e5b5921ddc4c2514f5b593e9b\",\"license\":\"Apache 2\"},\"contracts/external/uniswap/IUniswapV3FlashCallback.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\r\\npragma solidity >=0.5.0;\\r\\n\\r\\n/// @title Callback for IUniswapV3PoolActions#flash\\r\\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\\r\\ninterface IUniswapV3FlashCallback {\\r\\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\\r\\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\\r\\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\\r\\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\\r\\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\\r\\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\\r\\n function uniswapV3FlashCallback(\\r\\n uint256 fee0,\\r\\n uint256 fee1,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x0597a75c28ad243e5eef7aa33b9b87ac989585a9719e8783b8f84fdb6b8c415b\",\"license\":\"GPL-2.0-or-later\"},\"contracts/external/uniswap/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./IUniswapV3PoolActions.sol\\\";\\r\\n\\r\\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\\r\\n function token0() external view returns (address);\\r\\n\\r\\n function token1() external view returns (address);\\r\\n\\r\\n function fee() external view returns (uint24);\\r\\n\\r\\n function slot0()\\r\\n external\\r\\n view\\r\\n returns (\\r\\n uint160 sqrtPriceX96,\\r\\n int24 tick,\\r\\n uint16 observationIndex,\\r\\n uint16 observationCardinality,\\r\\n uint16 observationCardinalityNext,\\r\\n uint8 feeProtocol,\\r\\n bool unlocked\\r\\n );\\r\\n\\r\\n function liquidity() external view returns (uint128);\\r\\n\\r\\n function observe(uint32[] calldata secondsAgos)\\r\\n external\\r\\n view\\r\\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\\r\\n\\r\\n function observations(uint256 index)\\r\\n external\\r\\n view\\r\\n returns (\\r\\n uint32 blockTimestamp,\\r\\n int56 tickCumulative,\\r\\n uint160 liquidityCumulative,\\r\\n bool initialized\\r\\n );\\r\\n\\r\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\r\\n\\r\\n function ticks(int24 tick)\\r\\n external\\r\\n view\\r\\n returns (\\r\\n uint128 liquidityGross,\\r\\n int128 liquidityNet,\\r\\n uint256 feeGrowthOutside0X128,\\r\\n uint256 feeGrowthOutside1X128,\\r\\n int56 tickCumulativeOutside,\\r\\n uint160 secondsPerLiquidityOutsideX128,\\r\\n uint32 secondsOutside,\\r\\n bool initialized\\r\\n );\\r\\n\\r\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\r\\n\\r\\n function positions(bytes32 key)\\r\\n external\\r\\n view\\r\\n returns (\\r\\n uint128 _liquidity,\\r\\n uint256 feeGrowthInside0LastX128,\\r\\n uint256 feeGrowthInside1LastX128,\\r\\n uint128 tokensOwed0,\\r\\n uint128 tokensOwed1\\r\\n );\\r\\n}\\r\\n\",\"keccak256\":\"0x239265a7c024ab6a9b5f9babcfd5adc7367d554743553e21f52406a24a4d82ca\",\"license\":\"GPL-3.0-only\"},\"contracts/external/uniswap/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\r\\npragma solidity >=0.5.0;\\r\\n\\r\\n/// @title Permissionless pool actions\\r\\n/// @notice Contains pool methods that can be called by anyone\\r\\ninterface IUniswapV3PoolActions {\\r\\n /// @notice Sets the initial price for the pool\\r\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\r\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\r\\n function initialize(uint160 sqrtPriceX96) external;\\r\\n\\r\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\r\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\r\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\r\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\r\\n /// @param recipient The address for which the liquidity will be created\\r\\n /// @param tickLower The lower tick of the position in which to add liquidity\\r\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\r\\n /// @param amount The amount of liquidity to mint\\r\\n /// @param data Any data that should be passed through to the callback\\r\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\r\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\r\\n function mint(\\r\\n address recipient,\\r\\n int24 tickLower,\\r\\n int24 tickUpper,\\r\\n uint128 amount,\\r\\n bytes calldata data\\r\\n ) external returns (uint256 amount0, uint256 amount1);\\r\\n\\r\\n /// @notice Collects tokens owed to a position\\r\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\r\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\r\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\r\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\r\\n /// @param recipient The address which should receive the fees collected\\r\\n /// @param tickLower The lower tick of the position for which to collect fees\\r\\n /// @param tickUpper The upper tick of the position for which to collect fees\\r\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\r\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\r\\n /// @return amount0 The amount of fees collected in token0\\r\\n /// @return amount1 The amount of fees collected in token1\\r\\n function collect(\\r\\n address recipient,\\r\\n int24 tickLower,\\r\\n int24 tickUpper,\\r\\n uint128 amount0Requested,\\r\\n uint128 amount1Requested\\r\\n ) external returns (uint128 amount0, uint128 amount1);\\r\\n\\r\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\r\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\r\\n /// @dev Fees must be collected separately via a call to #collect\\r\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\r\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\r\\n /// @param amount How much liquidity to burn\\r\\n /// @return amount0 The amount of token0 sent to the recipient\\r\\n /// @return amount1 The amount of token1 sent to the recipient\\r\\n function burn(\\r\\n int24 tickLower,\\r\\n int24 tickUpper,\\r\\n uint128 amount\\r\\n ) external returns (uint256 amount0, uint256 amount1);\\r\\n\\r\\n /// @notice Swap token0 for token1, or token1 for token0\\r\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\r\\n /// @param recipient The address to receive the output of the swap\\r\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\r\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\r\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\r\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\r\\n /// @param data Any data to be passed through to the callback\\r\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\r\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\r\\n function swap(\\r\\n address recipient,\\r\\n bool zeroForOne,\\r\\n int256 amountSpecified,\\r\\n uint160 sqrtPriceLimitX96,\\r\\n bytes calldata data\\r\\n ) external returns (int256 amount0, int256 amount1);\\r\\n\\r\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\r\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\r\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\r\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\r\\n /// @param recipient The address which will receive the token0 and token1 amounts\\r\\n /// @param amount0 The amount of token0 to send\\r\\n /// @param amount1 The amount of token1 to send\\r\\n /// @param data Any data to be passed through to the callback\\r\\n function flash(\\r\\n address recipient,\\r\\n uint256 amount0,\\r\\n uint256 amount1,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n\\r\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\r\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\r\\n /// the input observationCardinalityNext.\\r\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\r\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xb892e91ed78445cf50726f786fd4a465353fcf7c64b76c704145ee0c8736d705\",\"license\":\"GPL-2.0-or-later\"},\"contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\r\\npragma solidity >=0.7.5;\\r\\npragma abicoder v2;\\r\\n\\r\\n/// @title Quoter Interface\\r\\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\\r\\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\\r\\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\\r\\ninterface IUniswapV3Quoter {\\r\\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\\r\\n /// @param path The path of the swap, i.e. each token pair and the pool fee\\r\\n /// @param amountIn The amount of the first token to swap\\r\\n /// @return amountOut The amount of the last token that would be received\\r\\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\\r\\n\\r\\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\\r\\n /// @param tokenIn The token being swapped in\\r\\n /// @param tokenOut The token being swapped out\\r\\n /// @param fee The fee of the token pool to consider for the pair\\r\\n /// @param amountIn The desired input amount\\r\\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\\r\\n /// @return amountOut The amount of `tokenOut` that would be received\\r\\n function quoteExactInputSingle(\\r\\n address tokenIn,\\r\\n address tokenOut,\\r\\n uint24 fee,\\r\\n uint256 amountIn,\\r\\n uint160 sqrtPriceLimitX96\\r\\n ) external returns (uint256 amountOut);\\r\\n\\r\\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\\r\\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\\r\\n /// @param amountOut The amount of the last token to receive\\r\\n /// @return amountIn The amount of first token required to be paid\\r\\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\\r\\n\\r\\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\\r\\n /// @param tokenIn The token being swapped in\\r\\n /// @param tokenOut The token being swapped out\\r\\n /// @param fee The fee of the token pool to consider for the pair\\r\\n /// @param amountOut The desired output amount\\r\\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\\r\\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\\r\\n function quoteExactOutputSingle(\\r\\n address tokenIn,\\r\\n address tokenOut,\\r\\n uint24 fee,\\r\\n uint256 amountOut,\\r\\n uint160 sqrtPriceLimitX96\\r\\n ) external returns (uint256 amountIn);\\r\\n}\\r\\n\",\"keccak256\":\"0xbc56edae8632cd47290b47aefbf3f132fe00417daa4811306930511b214f1f47\",\"license\":\"GPL-2.0-or-later\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title AddressesProvider\\r\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\r\\n * contract addresses that change between deploys and across chains\\r\\n * @author Veliko Minkov \\r\\n */\\r\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\r\\n mapping(string => address) private _addresses;\\r\\n mapping(address => Contract) public plugins;\\r\\n mapping(address => Contract) public flywheelRewards;\\r\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\r\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\r\\n JarvisPool[] public jarvisPoolsConfig;\\r\\n CurveSwapPool[] public curveSwapPoolsConfig;\\r\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\r\\n\\r\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\r\\n function initialize(address owner) public initializer {\\r\\n __SafeOwnable_init(owner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\r\\n */\\r\\n struct Contract {\\r\\n address addr;\\r\\n string contractInterface;\\r\\n }\\r\\n\\r\\n struct RedemptionStrategy {\\r\\n address addr;\\r\\n string contractInterface;\\r\\n address outputToken;\\r\\n }\\r\\n\\r\\n struct FundingStrategy {\\r\\n address addr;\\r\\n string contractInterface;\\r\\n address inputToken;\\r\\n }\\r\\n\\r\\n struct JarvisPool {\\r\\n address syntheticToken;\\r\\n address collateralToken;\\r\\n address liquidityPool;\\r\\n uint256 expirationTime;\\r\\n }\\r\\n\\r\\n struct CurveSwapPool {\\r\\n address poolAddress;\\r\\n address[] coins;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\r\\n * @param rewardToken the reward token address\\r\\n * @param flywheelRewardsModule the flywheel rewards module address\\r\\n * @param contractInterface a string that uniquely identifies the contract's interface\\r\\n */\\r\\n function setFlywheelRewards(\\r\\n address rewardToken,\\r\\n address flywheelRewardsModule,\\r\\n string calldata contractInterface\\r\\n ) public onlyOwner {\\r\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\r\\n * @param asset the asset address\\r\\n * @param plugin the ERC4626 plugin address\\r\\n * @param contractInterface a string that uniquely identifies the contract's interface\\r\\n */\\r\\n function setPlugin(\\r\\n address asset,\\r\\n address plugin,\\r\\n string calldata contractInterface\\r\\n ) public onlyOwner {\\r\\n plugins[asset] = Contract(plugin, contractInterface);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\r\\n * @param asset the asset address\\r\\n * @param strategy redemption strategy address\\r\\n * @param contractInterface a string that uniquely identifies the contract's interface\\r\\n */\\r\\n function setRedemptionStrategy(\\r\\n address asset,\\r\\n address strategy,\\r\\n string calldata contractInterface,\\r\\n address outputToken\\r\\n ) public onlyOwner {\\r\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\r\\n }\\r\\n\\r\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\r\\n return redemptionStrategiesConfig[asset];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\r\\n * @param asset the asset address\\r\\n * @param strategy funding strategy address\\r\\n * @param contractInterface a string that uniquely identifies the contract's interface\\r\\n */\\r\\n function setFundingStrategy(\\r\\n address asset,\\r\\n address strategy,\\r\\n string calldata contractInterface,\\r\\n address inputToken\\r\\n ) public onlyOwner {\\r\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\r\\n }\\r\\n\\r\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\r\\n return fundingStrategiesConfig[asset];\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\r\\n * @param syntheticToken the synthetic token address\\r\\n * @param collateralToken the collateral token address\\r\\n * @param liquidityPool the liquidity pool address\\r\\n * @param expirationTime the operation expiration time\\r\\n */\\r\\n function setJarvisPool(\\r\\n address syntheticToken,\\r\\n address collateralToken,\\r\\n address liquidityPool,\\r\\n uint256 expirationTime\\r\\n ) public onlyOwner {\\r\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\r\\n }\\r\\n\\r\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\r\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\r\\n * @param id The id\\r\\n * @param newAddress The address to set\\r\\n */\\r\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\r\\n _addresses[id] = newAddress;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an address by id\\r\\n * @return The address\\r\\n */\\r\\n function getAddress(string calldata id) public view returns (address) {\\r\\n return _addresses[id];\\r\\n }\\r\\n\\r\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\r\\n return curveSwapPoolsConfig;\\r\\n }\\r\\n\\r\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\r\\n return jarvisPoolsConfig;\\r\\n }\\r\\n\\r\\n function setBalancerPoolForTokens(\\r\\n address inputToken,\\r\\n address outputToken,\\r\\n address pool\\r\\n ) external onlyOwner {\\r\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\r\\n }\\r\\n\\r\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\r\\n return balancerPoolForTokens[inputToken][outputToken];\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x323d5d342776b9b74acbeb95c44d88f7006e07119e2033f8effdf29896b92963\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\r\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\r\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\r\\n\\r\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\r\\n\\r\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\r\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\r\\n PoolRolesAuthority public poolAuthLogic;\\r\\n address public leveredPositionsFactory;\\r\\n bool public noAuthRequired;\\r\\n\\r\\n function initialize(address _leveredPositionsFactory) public initializer {\\r\\n __SafeOwnable_init(msg.sender);\\r\\n leveredPositionsFactory = _leveredPositionsFactory;\\r\\n poolAuthLogic = new PoolRolesAuthority();\\r\\n }\\r\\n\\r\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\r\\n leveredPositionsFactory = _leveredPositionsFactory;\\r\\n poolAuthLogic = new PoolRolesAuthority();\\r\\n // for Neon the auth is not required\\r\\n noAuthRequired = block.chainid == 245022934;\\r\\n }\\r\\n\\r\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\r\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\r\\n\\r\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\r\\n auth = PoolRolesAuthority(address(proxy));\\r\\n auth.initialize(address(this));\\r\\n poolsAuthorities[pool] = auth;\\r\\n\\r\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\r\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\r\\n // sets the registry owner as the auth owner\\r\\n reconfigureAuthority(pool);\\r\\n }\\r\\n\\r\\n function reconfigureAuthority(address poolAddress) public {\\r\\n IonicComptroller pool = IonicComptroller(poolAddress);\\r\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\r\\n\\r\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\r\\n require(address(auth) != address(0), \\\"no such authority\\\");\\r\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\r\\n\\r\\n auth.configureRegistryCapabilities();\\r\\n auth.configurePoolSupplierCapabilities(pool);\\r\\n auth.configurePoolBorrowerCapabilities(pool);\\r\\n // everyone can be a liquidator\\r\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\r\\n auth.configureLeveredPositionCapabilities(pool);\\r\\n\\r\\n if (auth.owner() != owner()) {\\r\\n auth.setOwner(owner());\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function canCall(\\r\\n address pool,\\r\\n address user,\\r\\n address target,\\r\\n bytes4 functionSig\\r\\n ) external view returns (bool) {\\r\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\r\\n if (address(authorityForPool) == address(0)) {\\r\\n return noAuthRequired;\\r\\n } else {\\r\\n // allow only if an auth exists and it allows the action\\r\\n return authorityForPool.canCall(user, target, functionSig);\\r\\n }\\r\\n }\\r\\n\\r\\n function setUserRole(\\r\\n address pool,\\r\\n address user,\\r\\n uint8 role,\\r\\n bool enabled\\r\\n ) external {\\r\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\r\\n\\r\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\r\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\r\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\r\\n\\r\\n poolAuth.setUserRole(user, role, enabled);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x115f92e8254ecbff415758b256fde2d110032db2d7124b3b4cefd9f4f7691051\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/**\\r\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\r\\n * to map the functions when looking up the extension contract to delegate to.\\r\\n */\\r\\nabstract contract DiamondExtension {\\r\\n /**\\r\\n * @return a list of all the function selectors that this logic extension exposes\\r\\n */\\r\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\r\\n}\\r\\n\\r\\n// When no function exists for function called\\r\\nerror FunctionNotFound(bytes4 _functionSelector);\\r\\n\\r\\n// When no extension exists for function called\\r\\nerror ExtensionNotFound(bytes4 _functionSelector);\\r\\n\\r\\n// When the function is already added\\r\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\r\\n\\r\\nabstract contract DiamondBase {\\r\\n /**\\r\\n * @dev register a logic extension\\r\\n * @param extensionToAdd the extension whose functions are to be added\\r\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\r\\n */\\r\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\r\\n\\r\\n function _listExtensions() public view returns (address[] memory) {\\r\\n return LibDiamond.listExtensions();\\r\\n }\\r\\n\\r\\n fallback() external {\\r\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\r\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\r\\n // Execute external function from extension using delegatecall and return any value.\\r\\n assembly {\\r\\n // copy function selector and any arguments\\r\\n calldatacopy(0, 0, calldatasize())\\r\\n // execute function call using the extension\\r\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\r\\n // get any return value\\r\\n returndatacopy(0, 0, returndatasize())\\r\\n // return any return value or error back to the caller\\r\\n switch result\\r\\n case 0 {\\r\\n revert(0, returndatasize())\\r\\n }\\r\\n default {\\r\\n return(0, returndatasize())\\r\\n }\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n/**\\r\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\r\\n */\\r\\nlibrary LibDiamond {\\r\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\r\\n\\r\\n struct Function {\\r\\n address extension;\\r\\n bytes4 selector;\\r\\n }\\r\\n\\r\\n struct LogicStorage {\\r\\n Function[] functions;\\r\\n address[] extensions;\\r\\n }\\r\\n\\r\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\r\\n return getExtensionForSelector(msgSig, diamondStorage());\\r\\n }\\r\\n\\r\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\r\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\r\\n assembly {\\r\\n ds.slot := position\\r\\n }\\r\\n }\\r\\n\\r\\n function listExtensions() internal view returns (address[] memory) {\\r\\n return diamondStorage().extensions;\\r\\n }\\r\\n\\r\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\r\\n if (address(extensionToReplace) != address(0)) {\\r\\n removeExtension(extensionToReplace);\\r\\n }\\r\\n addExtension(extensionToAdd);\\r\\n }\\r\\n\\r\\n function removeExtension(DiamondExtension extension) internal {\\r\\n LogicStorage storage ds = diamondStorage();\\r\\n // remove all functions of the extension to replace\\r\\n removeExtensionFunctions(extension);\\r\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\r\\n if (ds.extensions[i] == address(extension)) {\\r\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\r\\n ds.extensions.pop();\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function addExtension(DiamondExtension extension) internal {\\r\\n LogicStorage storage ds = diamondStorage();\\r\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\r\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\r\\n }\\r\\n addExtensionFunctions(extension);\\r\\n ds.extensions.push(address(extension));\\r\\n }\\r\\n\\r\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\r\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\r\\n LogicStorage storage ds = diamondStorage();\\r\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\r\\n bytes4 selectorToRemove = fnsToRemove[i];\\r\\n // must never fail\\r\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\r\\n // swap with the last element in the selectorAtIndex array and remove the last element\\r\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\r\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\r\\n ds.functions.pop();\\r\\n }\\r\\n }\\r\\n\\r\\n function addExtensionFunctions(DiamondExtension extension) internal {\\r\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\r\\n LogicStorage storage ds = diamondStorage();\\r\\n uint16 functionsCount = uint16(ds.functions.length);\\r\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\r\\n bytes4 selector = fnsToAdd[functionsIndex];\\r\\n address oldImplementation = getExtensionForSelector(selector, ds);\\r\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\r\\n ds.functions.push(Function(address(extension), selector));\\r\\n functionsCount++;\\r\\n }\\r\\n }\\r\\n\\r\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\r\\n uint256 fnsLen = ds.functions.length;\\r\\n for (uint256 i = 0; i < fnsLen; i++) {\\r\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\r\\n }\\r\\n\\r\\n return address(0);\\r\\n }\\r\\n\\r\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\r\\n uint16 fnsLen = uint16(ds.functions.length);\\r\\n for (uint16 i = 0; i < fnsLen; i++) {\\r\\n if (ds.functions[i].selector == selector) return i;\\r\\n }\\r\\n\\r\\n return type(uint16).max;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8574cedf33192f4f8df52688205ae7dab899ca95e66b1b56bf0932c99584e720\",\"license\":\"UNLICENSED\"},\"contracts/ionic/IFlashLoanReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\ninterface IFlashLoanReceiver {\\r\\n function receiveFlashLoan(\\r\\n address borrowedAsset,\\r\\n uint256 borrowedAmount,\\r\\n bytes calldata data\\r\\n ) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x37453991fcb1f5e70db457dcf246611fa9292ce316778cb9f87ff65db5e2adac\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\r\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\r\\n\\r\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\n\\r\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\r\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\r\\n _disableInitializers();\\r\\n }\\r\\n\\r\\n function initialize(address _owner) public initializer {\\r\\n owner = _owner;\\r\\n authority = this;\\r\\n }\\r\\n\\r\\n // up to 256 roles\\r\\n uint8 public constant REGISTRY_ROLE = 0;\\r\\n uint8 public constant SUPPLIER_ROLE = 1;\\r\\n uint8 public constant BORROWER_ROLE = 2;\\r\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\r\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\r\\n\\r\\n function configureRegistryCapabilities() external requiresAuth {\\r\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\r\\n setRoleCapability(\\r\\n REGISTRY_ROLE,\\r\\n address(this),\\r\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\r\\n true\\r\\n );\\r\\n setRoleCapability(\\r\\n REGISTRY_ROLE,\\r\\n address(this),\\r\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\r\\n true\\r\\n );\\r\\n setRoleCapability(\\r\\n REGISTRY_ROLE,\\r\\n address(this),\\r\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\r\\n true\\r\\n );\\r\\n setRoleCapability(\\r\\n REGISTRY_ROLE,\\r\\n address(this),\\r\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\r\\n true\\r\\n );\\r\\n setRoleCapability(\\r\\n REGISTRY_ROLE,\\r\\n address(this),\\r\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\r\\n true\\r\\n );\\r\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\r\\n }\\r\\n\\r\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n _setPublicPoolSupplierCapabilities(pool, true);\\r\\n }\\r\\n\\r\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n _setPublicPoolSupplierCapabilities(pool, false);\\r\\n }\\r\\n\\r\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\r\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\r\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\r\\n for (uint256 j = 0; j < selectors.length; j++) {\\r\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\r\\n }\\r\\n\\r\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\r\\n uint8 fnsCount = 6;\\r\\n selectors = new bytes4[](fnsCount);\\r\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\r\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\r\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\r\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\r\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\r\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\r\\n\\r\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\r\\n return selectors;\\r\\n }\\r\\n\\r\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\r\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\r\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\r\\n for (uint256 j = 0; j < selectors.length; j++) {\\r\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n _setPublicPoolBorrowerCapabilities(pool, true);\\r\\n }\\r\\n\\r\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n _setPublicPoolBorrowerCapabilities(pool, false);\\r\\n }\\r\\n\\r\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\r\\n }\\r\\n }\\r\\n\\r\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\r\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\r\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\r\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\r\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\r\\n }\\r\\n }\\r\\n\\r\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\r\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\r\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\r\\n }\\r\\n }\\r\\n\\r\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\r\\n // TODO this leaves redeeming open for everyone\\r\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\r\\n }\\r\\n }\\r\\n\\r\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\r\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\r\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\r\\n\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\r\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7434a55635e552d7121207af735f647fd17eaeddf3a839a9f521552c9c114f37\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\r\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\r\\n * that will shift the other.\\r\\n */\\r\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\r\\n /**\\r\\n * @notice Pending owner of this contract\\r\\n */\\r\\n address public pendingOwner;\\r\\n\\r\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\r\\n __Ownable_init();\\r\\n _transferOwnership(owner_);\\r\\n }\\r\\n\\r\\n struct AddressSlot {\\r\\n address value;\\r\\n }\\r\\n\\r\\n modifier onlyOwnerOrAdmin() {\\r\\n bool isOwner = owner() == _msgSender();\\r\\n if (!isOwner) {\\r\\n address admin = _getProxyAdmin();\\r\\n bool isAdmin = admin == _msgSender();\\r\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\r\\n }\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Emitted when pendingOwner is changed\\r\\n */\\r\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\r\\n\\r\\n /**\\r\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\r\\n */\\r\\n event NewOwner(address oldOwner, address newOwner);\\r\\n\\r\\n /**\\r\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\r\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\r\\n * @param newPendingOwner New pending owner.\\r\\n */\\r\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\r\\n // Save current value, if any, for inclusion in log\\r\\n address oldPendingOwner = pendingOwner;\\r\\n\\r\\n // Store pendingOwner with value newPendingOwner\\r\\n pendingOwner = newPendingOwner;\\r\\n\\r\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\r\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\r\\n * @dev Owner function for pending owner to accept role and update owner\\r\\n */\\r\\n function _acceptOwner() public {\\r\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\r\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\r\\n\\r\\n // Save current values for inclusion in log\\r\\n address oldOwner = owner();\\r\\n address oldPendingOwner = pendingOwner;\\r\\n\\r\\n // Store owner with value pendingOwner\\r\\n _transferOwnership(pendingOwner);\\r\\n\\r\\n // Clear the pending value\\r\\n pendingOwner = address(0);\\r\\n\\r\\n emit NewOwner(oldOwner, pendingOwner);\\r\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\r\\n }\\r\\n\\r\\n function renounceOwnership() public override onlyOwner {\\r\\n // do not remove this overriding fn\\r\\n revert(\\\"not used anymore\\\");\\r\\n }\\r\\n\\r\\n function transferOwnership(address newOwner) public override onlyOwner {\\r\\n emit NewPendingOwner(pendingOwner, newOwner);\\r\\n pendingOwner = newOwner;\\r\\n }\\r\\n\\r\\n function _getProxyAdmin() internal view returns (address admin) {\\r\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\r\\n AddressSlot storage adminSlot;\\r\\n assembly {\\r\\n adminSlot.slot := _ADMIN_SLOT\\r\\n }\\r\\n admin = adminSlot.value;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x389aa135a3fffcece620da7c3a2f9d823cd5eaf7ae2882774dc62a03fa848b63\",\"license\":\"UNLICENSED\"},\"contracts/ionic/strategies/flywheel/IIonicFlywheel.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity ^0.8.10;\\r\\n\\r\\nimport { ERC20 } from \\\"solmate/tokens/ERC20.sol\\\";\\r\\n\\r\\ninterface IIonicFlywheel {\\r\\n function isRewardsDistributor() external returns (bool);\\r\\n\\r\\n function isFlywheel() external returns (bool);\\r\\n\\r\\n function flywheelPreSupplierAction(address market, address supplier) external;\\r\\n\\r\\n function flywheelPostSupplierAction(address market, address supplier) external;\\r\\n\\r\\n function flywheelPreBorrowerAction(address market, address borrower) external;\\r\\n\\r\\n function flywheelPostBorrowerAction(address market, address borrower) external;\\r\\n\\r\\n function flywheelPreTransferAction(address market, address src, address dst) external;\\r\\n\\r\\n function flywheelPostTransferAction(address market, address src, address dst) external;\\r\\n\\r\\n function compAccrued(address user) external view returns (uint256);\\r\\n\\r\\n function addMarketForRewards(ERC20 strategy) external;\\r\\n\\r\\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\\r\\n}\\r\\n\",\"keccak256\":\"0x084399519e0a61c3a2c5f0a301a80c18c5e1d67d3ec381a84e491ec016d3d26b\",\"license\":\"AGPL-3.0-only\"},\"contracts/liquidators/IFundsConversionStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"./IRedemptionStrategy.sol\\\";\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\n\\r\\ninterface IFundsConversionStrategy is IRedemptionStrategy {\\r\\n function convert(\\r\\n IERC20Upgradeable inputToken,\\r\\n uint256 inputAmount,\\r\\n bytes memory strategyData\\r\\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\\r\\n\\r\\n function estimateInputAmount(\\r\\n uint256 outputAmount,\\r\\n bytes memory strategyData\\r\\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\\r\\n}\\r\\n\",\"keccak256\":\"0xd9edd3860ba4db670e5c954f11411470f282b48a92f79a976490cec6153a042d\",\"license\":\"UNLICENSED\"},\"contracts/liquidators/IRedemptionStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title IRedemptionStrategy\\r\\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\\r\\n * @author David Lucid (https://github.com/davidlucid)\\r\\n */\\r\\ninterface IRedemptionStrategy {\\r\\n /**\\r\\n * @notice Redeems custom collateral `token` for an underlying token.\\r\\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\\r\\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\\r\\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\\r\\n * @return outputToken The underlying ERC20 token outputted.\\r\\n * @return outputAmount The quantity of underlying tokens outputted.\\r\\n */\\r\\n function redeem(\\r\\n IERC20Upgradeable inputToken,\\r\\n uint256 inputAmount,\\r\\n bytes memory strategyData\\r\\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\\r\\n\\r\\n function name() external view returns (string memory);\\r\\n}\\r\\n\",\"keccak256\":\"0x6bc7b33efe0f0c96a34b05e4e103bb76e9c8c9cf9c64f8584af7e30d6f349274\",\"license\":\"UNLICENSED\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title BasePriceOracle\\r\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\r\\n * @dev Implements the `PriceOracle` interface.\\r\\n * @author David Lucid (https://github.com/davidlucid)\\r\\n */\\r\\ninterface BasePriceOracle {\\r\\n /**\\r\\n * @notice Get the price of an underlying asset.\\r\\n * @param underlying The underlying asset to get the price of.\\r\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\r\\n * Zero means the price is unavailable.\\r\\n */\\r\\n function price(address underlying) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Get the underlying price of a cToken asset\\r\\n * @param cToken The cToken to get the underlying price of\\r\\n * @return The underlying asset price mantissa (scaled by 1e18).\\r\\n * Zero means the price is unavailable.\\r\\n */\\r\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x6a5989a21e27cf7ed176bcdd37ebfc6b1948df3facd1e2009c3ff3a7fc4bee3d\",\"license\":\"UNLICENSED\"},\"contracts/oracles/MasterPriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\n\\r\\nimport { ICErc20 } from \\\"../compound/CTokenInterfaces.sol\\\";\\r\\n\\r\\nimport { BasePriceOracle } from \\\"./BasePriceOracle.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title MasterPriceOracle\\r\\n * @notice Use a combination of price oracles.\\r\\n * @dev Implements `PriceOracle`.\\r\\n * @author David Lucid (https://github.com/davidlucid)\\r\\n */\\r\\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\\r\\n /**\\r\\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\\r\\n */\\r\\n mapping(address => BasePriceOracle) public oracles;\\r\\n\\r\\n /**\\r\\n * @dev Default/fallback `PriceOracle`.\\r\\n */\\r\\n BasePriceOracle public defaultOracle;\\r\\n\\r\\n /**\\r\\n * @dev The administrator of this `MasterPriceOracle`.\\r\\n */\\r\\n address public admin;\\r\\n\\r\\n /**\\r\\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\\r\\n */\\r\\n bool internal noAdminOverwrite;\\r\\n\\r\\n /**\\r\\n * @dev The Wrapped native asset address.\\r\\n */\\r\\n address public wtoken;\\r\\n\\r\\n /**\\r\\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\\r\\n */\\r\\n mapping(address => BasePriceOracle) public fallbackOracles;\\r\\n\\r\\n /**\\r\\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\\r\\n */\\r\\n function canAdminOverwrite() external view returns (bool) {\\r\\n return !noAdminOverwrite;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Event emitted when `admin` is changed.\\r\\n */\\r\\n event NewAdmin(address oldAdmin, address newAdmin);\\r\\n\\r\\n /**\\r\\n * @dev Event emitted when the default oracle is changed.\\r\\n */\\r\\n event NewDefaultOracle(address oldOracle, address newOracle);\\r\\n\\r\\n /**\\r\\n * @dev Event emitted when an underlying token's oracle is changed.\\r\\n */\\r\\n event NewOracle(address underlying, address oldOracle, address newOracle);\\r\\n\\r\\n /**\\r\\n * @dev Initialize state variables.\\r\\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\\r\\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\\r\\n * @param _defaultOracle The default `PriceOracle` contract to use.\\r\\n * @param _admin The admin who can assign oracles to underlying tokens.\\r\\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\\r\\n * @param _wtoken The Wrapped native asset address\\r\\n */\\r\\n function initialize(\\r\\n address[] memory underlyings,\\r\\n BasePriceOracle[] memory _oracles,\\r\\n BasePriceOracle _defaultOracle,\\r\\n address _admin,\\r\\n bool _canAdminOverwrite,\\r\\n address _wtoken\\r\\n ) external initializer {\\r\\n // Input validation\\r\\n require(underlyings.length == _oracles.length, \\\"Lengths of both arrays must be equal.\\\");\\r\\n\\r\\n // Initialize state variables\\r\\n for (uint256 i = 0; i < underlyings.length; i++) {\\r\\n address underlying = underlyings[i];\\r\\n BasePriceOracle newOracle = _oracles[i];\\r\\n oracles[underlying] = newOracle;\\r\\n emit NewOracle(underlying, address(0), address(newOracle));\\r\\n }\\r\\n\\r\\n defaultOracle = _defaultOracle;\\r\\n admin = _admin;\\r\\n noAdminOverwrite = !_canAdminOverwrite;\\r\\n wtoken = _wtoken;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Sets `_oracles` for `underlyings`.\\r\\n */\\r\\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\\r\\n // Input validation\\r\\n require(\\r\\n underlyings.length > 0 && underlyings.length == _oracles.length,\\r\\n \\\"Lengths of both arrays must be equal and greater than 0.\\\"\\r\\n );\\r\\n\\r\\n // Assign oracles to underlying tokens\\r\\n for (uint256 i = 0; i < underlyings.length; i++) {\\r\\n address underlying = underlyings[i];\\r\\n address oldOracle = address(oracles[underlying]);\\r\\n if (noAdminOverwrite)\\r\\n require(\\r\\n oldOracle == address(0),\\r\\n \\\"Admin cannot overwrite existing assignments of oracles to underlying tokens.\\\"\\r\\n );\\r\\n BasePriceOracle newOracle = _oracles[i];\\r\\n oracles[underlying] = newOracle;\\r\\n emit NewOracle(underlying, oldOracle, address(newOracle));\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Sets `_oracles` for `underlyings`.\\r\\n */\\r\\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\\r\\n // Input validation\\r\\n require(\\r\\n underlyings.length > 0 && underlyings.length == _oracles.length,\\r\\n \\\"Lengths of both arrays must be equal and greater than 0.\\\"\\r\\n );\\r\\n\\r\\n // Assign oracles to underlying tokens\\r\\n for (uint256 i = 0; i < underlyings.length; i++) {\\r\\n address underlying = underlyings[i];\\r\\n address oldOracle = address(fallbackOracles[underlying]);\\r\\n if (noAdminOverwrite)\\r\\n require(\\r\\n oldOracle == address(0),\\r\\n \\\"Admin cannot overwrite existing assignments of oracles to underlying tokens.\\\"\\r\\n );\\r\\n BasePriceOracle newOracle = _oracles[i];\\r\\n fallbackOracles[underlying] = newOracle;\\r\\n emit NewOracle(underlying, oldOracle, address(newOracle));\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the default price oracle\\r\\n */\\r\\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\\r\\n BasePriceOracle oldOracle = defaultOracle;\\r\\n defaultOracle = newOracle;\\r\\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the admin and emits an event.\\r\\n */\\r\\n function changeAdmin(address newAdmin) external onlyAdmin {\\r\\n address oldAdmin = admin;\\r\\n admin = newAdmin;\\r\\n emit NewAdmin(oldAdmin, newAdmin);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier that checks if `msg.sender == admin`.\\r\\n */\\r\\n modifier onlyAdmin() {\\r\\n require(msg.sender == admin, \\\"Sender is not the admin.\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Returns the price in ETH of the token underlying `cToken`.\\r\\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\\r\\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\\r\\n */\\r\\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\\r\\n // Get underlying ERC20 token address\\r\\n address underlying = address(ICErc20(address(cToken)).underlying());\\r\\n\\r\\n if (underlying == wtoken) return 1e18;\\r\\n\\r\\n BasePriceOracle oracle = oracles[underlying];\\r\\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\\r\\n\\r\\n if (address(oracle) != address(0)) {\\r\\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\\r\\n if (underlyingPrice == 0) {\\r\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\\r\\n } else {\\r\\n return underlyingPrice;\\r\\n }\\r\\n } catch {\\r\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\\r\\n }\\r\\n } else {\\r\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\\r\\n }\\r\\n revert(\\\"Price oracle not found for this underlying token address.\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\\r\\n */\\r\\n function price(address underlying) public view override returns (uint256) {\\r\\n // Return 1e18 for WETH\\r\\n if (underlying == wtoken) return 1e18;\\r\\n\\r\\n // Get underlying price from assigned oracle\\r\\n BasePriceOracle oracle = oracles[underlying];\\r\\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\\r\\n\\r\\n if (address(oracle) != address(0)) {\\r\\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\\r\\n if (underlyingPrice == 0) {\\r\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\\r\\n } else {\\r\\n return underlyingPrice;\\r\\n }\\r\\n } catch {\\r\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\\r\\n }\\r\\n } else {\\r\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\\r\\n }\\r\\n revert(\\\"Price oracle not found for this underlying token address.\\\");\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xa2738a573f967b51620f0783677766b4aa7312ad340eb0af7db4782a0e514f24\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\r\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\r\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\r\\nabstract contract Auth {\\r\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\r\\n\\r\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\r\\n\\r\\n address public owner;\\r\\n\\r\\n Authority public authority;\\r\\n\\r\\n constructor(address _owner, Authority _authority) {\\r\\n owner = _owner;\\r\\n authority = _authority;\\r\\n\\r\\n emit OwnerUpdated(msg.sender, _owner);\\r\\n emit AuthorityUpdated(msg.sender, _authority);\\r\\n }\\r\\n\\r\\n modifier requiresAuth() virtual {\\r\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\r\\n\\r\\n _;\\r\\n }\\r\\n\\r\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\r\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\r\\n\\r\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\r\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\r\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\r\\n }\\r\\n\\r\\n function setAuthority(Authority newAuthority) public virtual {\\r\\n // We check if the caller is the owner first because we want to ensure they can\\r\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\r\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\r\\n\\r\\n authority = newAuthority;\\r\\n\\r\\n emit AuthorityUpdated(msg.sender, newAuthority);\\r\\n }\\r\\n\\r\\n function setOwner(address newOwner) public virtual requiresAuth {\\r\\n owner = newOwner;\\r\\n\\r\\n emit OwnerUpdated(msg.sender, newOwner);\\r\\n }\\r\\n}\\r\\n\\r\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\r\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\r\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\r\\ninterface Authority {\\r\\n function canCall(\\r\\n address user,\\r\\n address target,\\r\\n bytes4 functionSig\\r\\n ) external view returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x2bc7e46ecae8db6dbd482164eb79665c0ebec7f970e442c5ac5cce870248eee6\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\r\\n\\r\\n/// @notice Role based Authority that supports up to 256 roles.\\r\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\r\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\r\\ncontract RolesAuthority is Auth, Authority {\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n EVENTS\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\r\\n\\r\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\r\\n\\r\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n CONSTRUCTOR\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n ROLE/USER STORAGE\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n mapping(address => bytes32) public getUserRoles;\\r\\n\\r\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\r\\n\\r\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\r\\n\\r\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\r\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\r\\n }\\r\\n\\r\\n function doesRoleHaveCapability(\\r\\n uint8 role,\\r\\n address target,\\r\\n bytes4 functionSig\\r\\n ) public view virtual returns (bool) {\\r\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\r\\n }\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n AUTHORIZATION LOGIC\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n function canCall(\\r\\n address user,\\r\\n address target,\\r\\n bytes4 functionSig\\r\\n ) public view virtual override returns (bool) {\\r\\n return\\r\\n isCapabilityPublic[target][functionSig] ||\\r\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\r\\n }\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n ROLE CAPABILITY CONFIGURATION LOGIC\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n function setPublicCapability(\\r\\n address target,\\r\\n bytes4 functionSig,\\r\\n bool enabled\\r\\n ) public virtual requiresAuth {\\r\\n isCapabilityPublic[target][functionSig] = enabled;\\r\\n\\r\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\r\\n }\\r\\n\\r\\n function setRoleCapability(\\r\\n uint8 role,\\r\\n address target,\\r\\n bytes4 functionSig,\\r\\n bool enabled\\r\\n ) public virtual requiresAuth {\\r\\n if (enabled) {\\r\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\r\\n } else {\\r\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\r\\n }\\r\\n\\r\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\r\\n }\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n USER ROLE ASSIGNMENT LOGIC\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n function setUserRole(\\r\\n address user,\\r\\n uint8 role,\\r\\n bool enabled\\r\\n ) public virtual requiresAuth {\\r\\n if (enabled) {\\r\\n getUserRoles[user] |= bytes32(1 << role);\\r\\n } else {\\r\\n getUserRoles[user] &= ~bytes32(1 << role);\\r\\n }\\r\\n\\r\\n emit UserRoleUpdated(user, role, enabled);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7ed785380b96bd42a221fb9eb792b5e9f5834efec72ba38dda93c5e176df860d\",\"license\":\"AGPL-3.0-only\"},\"solmate/tokens/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity >=0.8.0;\\r\\n\\r\\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\\r\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\\r\\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\\r\\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\\r\\nabstract contract ERC20 {\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n EVENTS\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\r\\n\\r\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n METADATA STORAGE\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n string public name;\\r\\n\\r\\n string public symbol;\\r\\n\\r\\n uint8 public immutable decimals;\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n ERC20 STORAGE\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n uint256 public totalSupply;\\r\\n\\r\\n mapping(address => uint256) public balanceOf;\\r\\n\\r\\n mapping(address => mapping(address => uint256)) public allowance;\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n EIP-2612 STORAGE\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n uint256 internal immutable INITIAL_CHAIN_ID;\\r\\n\\r\\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\\r\\n\\r\\n mapping(address => uint256) public nonces;\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n CONSTRUCTOR\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n constructor(\\r\\n string memory _name,\\r\\n string memory _symbol,\\r\\n uint8 _decimals\\r\\n ) {\\r\\n name = _name;\\r\\n symbol = _symbol;\\r\\n decimals = _decimals;\\r\\n\\r\\n INITIAL_CHAIN_ID = block.chainid;\\r\\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\\r\\n }\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n ERC20 LOGIC\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n function approve(address spender, uint256 amount) public virtual returns (bool) {\\r\\n allowance[msg.sender][spender] = amount;\\r\\n\\r\\n emit Approval(msg.sender, spender, amount);\\r\\n\\r\\n return true;\\r\\n }\\r\\n\\r\\n function transfer(address to, uint256 amount) public virtual returns (bool) {\\r\\n balanceOf[msg.sender] -= amount;\\r\\n\\r\\n // Cannot overflow because the sum of all user\\r\\n // balances can't exceed the max uint256 value.\\r\\n unchecked {\\r\\n balanceOf[to] += amount;\\r\\n }\\r\\n\\r\\n emit Transfer(msg.sender, to, amount);\\r\\n\\r\\n return true;\\r\\n }\\r\\n\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) public virtual returns (bool) {\\r\\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\\r\\n\\r\\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\\r\\n\\r\\n balanceOf[from] -= amount;\\r\\n\\r\\n // Cannot overflow because the sum of all user\\r\\n // balances can't exceed the max uint256 value.\\r\\n unchecked {\\r\\n balanceOf[to] += amount;\\r\\n }\\r\\n\\r\\n emit Transfer(from, to, amount);\\r\\n\\r\\n return true;\\r\\n }\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n EIP-2612 LOGIC\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) public virtual {\\r\\n require(deadline >= block.timestamp, \\\"PERMIT_DEADLINE_EXPIRED\\\");\\r\\n\\r\\n // Unchecked because the only math done is incrementing\\r\\n // the owner's nonce which cannot realistically overflow.\\r\\n unchecked {\\r\\n address recoveredAddress = ecrecover(\\r\\n keccak256(\\r\\n abi.encodePacked(\\r\\n \\\"\\\\x19\\\\x01\\\",\\r\\n DOMAIN_SEPARATOR(),\\r\\n keccak256(\\r\\n abi.encode(\\r\\n keccak256(\\r\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\r\\n ),\\r\\n owner,\\r\\n spender,\\r\\n value,\\r\\n nonces[owner]++,\\r\\n deadline\\r\\n )\\r\\n )\\r\\n )\\r\\n ),\\r\\n v,\\r\\n r,\\r\\n s\\r\\n );\\r\\n\\r\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"INVALID_SIGNER\\\");\\r\\n\\r\\n allowance[recoveredAddress][spender] = value;\\r\\n }\\r\\n\\r\\n emit Approval(owner, spender, value);\\r\\n }\\r\\n\\r\\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\\r\\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\\r\\n }\\r\\n\\r\\n function computeDomainSeparator() internal view virtual returns (bytes32) {\\r\\n return\\r\\n keccak256(\\r\\n abi.encode(\\r\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\r\\n keccak256(bytes(name)),\\r\\n keccak256(\\\"1\\\"),\\r\\n block.chainid,\\r\\n address(this)\\r\\n )\\r\\n );\\r\\n }\\r\\n\\r\\n /*//////////////////////////////////////////////////////////////\\r\\n INTERNAL MINT/BURN LOGIC\\r\\n //////////////////////////////////////////////////////////////*/\\r\\n\\r\\n function _mint(address to, uint256 amount) internal virtual {\\r\\n totalSupply += amount;\\r\\n\\r\\n // Cannot overflow because the sum of all user\\r\\n // balances can't exceed the max uint256 value.\\r\\n unchecked {\\r\\n balanceOf[to] += amount;\\r\\n }\\r\\n\\r\\n emit Transfer(address(0), to, amount);\\r\\n }\\r\\n\\r\\n function _burn(address from, uint256 amount) internal virtual {\\r\\n balanceOf[from] -= amount;\\r\\n\\r\\n // Cannot underflow because a user's balance\\r\\n // will never be larger than the total supply.\\r\\n unchecked {\\r\\n totalSupply -= amount;\\r\\n }\\r\\n\\r\\n emit Transfer(from, address(0), amount);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8d662fa38a1129c3f86ae334f646b5db4fe0a0de25d0782d86e275975e3dc75c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50615fd480620000216000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c806389f8132e11610130578063b0d58e49116100b8578063c91a424f1161007c578063c91a424f1461045d578063cb2ef6f714610470578063db006a751461049a578063f3fdb15a146104ad578063f5e3c462146104c057600080fd5b8063b0d58e491461040c578063b2a02ff11461041f578063be99f11914610432578063c3bf11cd14610441578063c5ebeaec1461044a57600080fd5b80639826394b116100ff5780639826394b146103c1578063a0712d68146103ca578063a21d1ade146103dd578063a7b820df146103f0578063aa5af0fd1461040357600080fd5b806389f8132e146103925780638d02d9a1146103a75780638f840ddd146103b057806395d89b41146103b957600080fd5b80633b1d21a2116101be57806361feacff1161018257806361feacff1461034c5780636752e702146103555780636c540baf146103635780636f307dc31461036c578063852a12e31461037f57600080fd5b80633b1d21a2146102e55780633c4f743c146102ed57806347bd37181461031857806356e67728146103215780635fe3b5671461033457600080fd5b8063173b990411610205578063173b99041461029e57806318160ddd146102a75780632608f818146102b05780632c436e5b146102c3578063313ce567146102d857600080fd5b8063067db1b31461023757806306fdde031461024c5780630e7527021461026a578063135f13341461028b575b600080fd5b61024a610245366004615896565b6104d3565b005b61025461051d565b60405161026191906158e6565b60405180910390f35b61027d610278366004615919565b6105ab565b604051908152602001610261565b61027d610299366004615896565b6107cb565b61027d60085481565b61027d600f5481565b61027d6102be366004615896565b610817565b60055b60405160ff9091168152602001610261565b6003546102c69060ff1681565b61027d610a47565b601454610300906001600160a01b031681565b6040516001600160a01b039091168152602001610261565b61027d600b5481565b61024a61032f366004615979565b610a56565b6003546103009061010090046001600160a01b031681565b61027d600d5481565b61027d666379da05b6000081565b61027d60095481565b601354610300906001600160a01b031681565b61027d61038d366004615919565b610aa8565b61039a610cbe565b6040516102619190615a0e565b61027d60065481565b61027d600c5481565b610254610e20565b61027d600e5481565b61027d6103d8366004615919565b610e2d565b61024a6103eb366004615a5c565b61103a565b61027d6103fe366004615919565b61127b565b61027d600a5481565b61027d61041a366004615919565b611609565b61027d61042d366004615b46565b6118c8565b61027d67016345785d8a000081565b61027d60075481565b61027d610458366004615919565b611a62565b600054610300906001600160a01b031681565b60408051808201909152600e81526d43457263323044656c656761746560901b6020820152610254565b61027d6104a8366004615919565b611c69565b600454610300906001600160a01b031681565b61027d6104ce366004615b87565b611e70565b33301461050f5760405162461bcd60e51b815260206004820152600560248201526410b9b2b63360d91b60448201526064015b60405180910390fd5b61051982826126cf565b5050565b6001805461052a90615bc9565b80601f016020809104026020016040519081016040528092919081815260200182805461055690615bc9565b80156105a35780601f10610578576101008083540402835291602001916105a3565b820191906000526020600020905b81548152906001019060200180831161058657829003601f168201915b505050505081565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb8926105f89261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610615573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106399190615c30565b6106555760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061068490600401615c7a565b602060405180830381865afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c59190615ca6565b90506001600160a01b0381166106e95760006106e084612750565b50949350505050565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b15801561072c57600080fd5b505af1158015610740573d6000803e3d6000fd5b50503332039150610762905057600061075885612750565b5095945050505050565b604051633108c13b60e01b81526001600160a01b03821690633108c13b906107909032903390600401615cc3565b60006040518083038186803b1580156107a857600080fd5b505afa1580156107bc573d6000803e3d6000fd5b50505050600061075885612750565b60003330146108045760405162461bcd60e51b815260206004820152600560248201526410b9b2b63360d91b6044820152606401610506565b61080e83836127e1565b90505b92915050565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb8926108649261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190615c30565b6108c15760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906108f090600401615c7a565b602060405180830381865afa15801561090d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109319190615ca6565b90506001600160a01b03811661095757600061094d85856129b4565b5092505050610811565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b15801561099a57600080fd5b505af11580156109ae573d6000803e3d6000fd5b505033320391506109d290505760006109c786866129b4565b509350505050610811565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90610a009032903390600401615cc3565b60006040518083038186803b158015610a1857600080fd5b505afa158015610a2c573d6000803e3d6000fd5b505050506000610a3c86866129b4565b509695505050505050565b6000610a51612a47565b905090565b33301480610a675750610a67612ab4565b610aa55760405162461bcd60e51b815260206004820152600f60248201526e10b9b2b633103e3e1010b0b236b4b760891b6044820152606401610506565b50565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892610af59261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190615c30565b610b525760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610b8190600401615c7a565b602060405180830381865afa158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190615ca6565b90506001600160a01b038116610be257610bdb83612c31565b9392505050565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015610c2557600080fd5b505af1158015610c39573d6000803e3d6000fd5b50503332039150610c57905057610c4f84612c31565b949350505050565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90610c859032903390600401615cc3565b60006040518083038186803b158015610c9d57600080fd5b505afa158015610cb1573d6000803e3d6000fd5b50505050610c4f84612c31565b606060016000610ccc612cb9565b90508160ff168151610cde9190615cf3565b67ffffffffffffffff811115610cf657610cf6615932565b604051908082528060200260200182016040528015610d1f578160200160208202803683370190505b50925060005b8151811015610d7b57818181518110610d4057610d40615d06565b6020026020010151848281518110610d5a57610d5a615d06565b6001600160e01b031990921660209283029190910190910152600101610d25565b50805163510e8d6f60e11b908490610d9285615d1c565b9450610da19060ff8616615cf3565b81518110610db157610db1615d06565b6001600160e01b03199092166020928302919091019091015260ff821615610e1b5760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610506565b505090565b6002805461052a90615bc9565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892610e7a9261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190615c30565b610ed75760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610f0690600401615c7a565b602060405180830381865afa158015610f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f479190615ca6565b90506001600160a01b038116610f625760006106e084612e29565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015610fa557600080fd5b505af1158015610fb9573d6000803e3d6000fd5b50503332039150610fd1905057600061075885612e29565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90610fff9032903390600401615cc3565b60006040518083038186803b15801561101757600080fd5b505afa15801561102b573d6000803e3d6000fd5b50505050600061075885612e29565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169363df595cb89361108493610100900416913391309190356001600160e01b03191690600401615bfd565b602060405180830381865afa1580156110a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c59190615c30565b6110e15760405162461bcd60e51b815260040161050690615c52565b604051637d5f6a0960e11b81526000906001600160a01b0387169063fabed41290611116903090899088908890600401615d39565b6020604051808303816000875af1158015611135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111599190615da3565b60405163095ea7b360e01b81526001600160a01b038681166004830152602482018390529192509086169063095ea7b3906044016020604051808303816000875af11580156111ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d09190615c30565b50604051631f72642160e31b81526001600160a01b0386811660048301526024820183905285169063fb93210890604401600060405180830381600087803b15801561121b57600080fd5b505af115801561122f573d6000803e3d6000fd5b50506040518381526001600160a01b03881692503091507ffe419fd3f83b80440f2b7ab5329d4879725f0da535d9c47c050f918d3455bdb89060200160405180910390a3505050505050565b60008061128781612ea6565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906112b690600401615c7a565b602060405180830381865afa1580156112d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f79190615ca6565b90506001600160a01b03811661144f57306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611347573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136b9190615da3565b50436009541461138857611381600a6039612f6a565b9250611449565b83611391612a47565b10156113a357611381600e6038612f6a565b600d548411156113b9576113816002603a612f6a565b83600d546113c79190615dbc565b600d55600354604080516303e1469160e61b815290516114449261010090046001600160a01b03169163f851a4409160048083019260209291908290030181865afa15801561141a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143e9190615ca6565b856126cf565b600092505b506115fa565b604051633108c13b60e01b815281906001600160a01b03821690633108c13b9061147f9032903390600401615cc3565b60006040518083038186803b15801561149757600080fd5b505afa1580156114ab573d6000803e3d6000fd5b505050506114b63090565b6001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156114f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115199190615da3565b5043600954146115365761152f600a6039612f6a565b93506115f7565b8461153f612a47565b10156115515761152f600e6038612f6a565b600d548511156115675761152f6002603a612f6a565b84600d546115759190615dbc565b600d55600354604080516303e1469160e61b815290516115f29261010090046001600160a01b03169163f851a4409160048083019260209291908290030181865afa1580156115c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ec9190615ca6565b866126cf565b600093505b50505b61160381612fe3565b50919050565b60008061161581612ea6565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061164490600401615c7a565b602060405180830381865afa158015611661573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116859190615ca6565b90506001600160a01b03811661177957306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156116d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f99190615da3565b50436009541461170f57611381600a6035612f6a565b83611718612a47565b101561172a57611381600e6034612f6a565b600e548411156117405761138160026036612f6a565b600084600e546117509190615dbc565b600e81905560005490915061176e906001600160a01b0316866126cf565b6000935050506115fa565b604051633108c13b60e01b815281906001600160a01b03821690633108c13b906117a99032903390600401615cc3565b60006040518083038186803b1580156117c157600080fd5b505afa1580156117d5573d6000803e3d6000fd5b505050506117e03090565b6001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af115801561181f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118439190615da3565b5043600954146118595761152f600a6035612f6a565b84611862612a47565b10156118745761152f600e6034612f6a565b600e5485111561188a5761152f60026036612f6a565b600085600e5461189a9190615dbc565b600e8190556000549091506118b8906001600160a01b0316876126cf565b6000945050505061160381612fe3565b600060016118d581612ea6565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061190490600401615c7a565b602060405180830381865afa158015611921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119459190615ca6565b90506001600160a01b0381166119695761196133878787613066565b925050611a51565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b1580156119ac57600080fd5b505af11580156119c0573d6000803e3d6000fd5b505033320391506119e29050576119d933888888613066565b93505050611a51565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90611a109032903390600401615cc3565b60006040518083038186803b158015611a2857600080fd5b505afa158015611a3c573d6000803e3d6000fd5b50505050611a4c33888888613066565b935050505b611a5a81612fe3565b509392505050565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892611aaf9261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015611acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af09190615c30565b611b0c5760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611b3b90600401615c7a565b602060405180830381865afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7c9190615ca6565b90506001600160a01b038116611b9557610bdb836135af565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015611bd857600080fd5b505af1158015611bec573d6000803e3d6000fd5b50503332039150611c02905057610c4f846135af565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90611c309032903390600401615cc3565b60006040518083038186803b158015611c4857600080fd5b505afa158015611c5c573d6000803e3d6000fd5b50505050610c4f846135af565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892611cb69261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015611cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf79190615c30565b611d135760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611d4290600401615c7a565b602060405180830381865afa158015611d5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d839190615ca6565b90506001600160a01b038116611d9c57610bdb8361362a565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015611ddf57600080fd5b505af1158015611df3573d6000803e3d6000fd5b50503332039150611e09905057610c4f8461362a565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90611e379032903390600401615cc3565b60006040518083038186803b158015611e4f57600080fd5b505afa158015611e63573d6000803e3d6000fd5b50505050610c4f8461362a565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892611ebd9261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015611eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611efe9190615c30565b611f1a5760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611f4990600401615c7a565b602060405180830381865afa158015611f66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8a9190615ca6565b90506001600160a01b0381166121bf5760145460405163bf40fac160e01b815286916000916001600160a01b039091169063bf40fac190611fcd90600401615de5565b602060405180830381865afa158015611fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200e9190615ca6565b60145460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac19061204290600401615e07565b602060405180830381865afa15801561205f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120839190615ca6565b9050806001600160a01b0316632c89aa2e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e79190615da3565b6003546040516357c89a7d60e01b81526001600160a01b03808616926357c89a7d9261211e92899261010090041690600401615cc3565b602060405180830381865afa15801561213b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215f9190615da3565b11156121a457336001600160a01b0382161461218d5760405162461bcd60e51b815260040161050690615e35565b600061219a8989896136a7565b5095506121b69050565b60006121b18989896136a7565b509550505b50505050610bdb565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b15801561220257600080fd5b505af1158015612216573d6000803e3d6000fd5b5050333203915061244990505760145460405163bf40fac160e01b815287916000916001600160a01b039091169063bf40fac19061225690600401615de5565b602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122979190615ca6565b60145460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac1906122cb90600401615e07565b602060405180830381865afa1580156122e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230c9190615ca6565b9050806001600160a01b0316632c89aa2e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561234c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123709190615da3565b6003546040516357c89a7d60e01b81526001600160a01b03808616926357c89a7d926123a792899261010090041690600401615cc3565b602060405180830381865afa1580156123c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e89190615da3565b111561242d57336001600160a01b038216146124165760405162461bcd60e51b815260040161050690615e35565b60006124238a8a8a6136a7565b50965061243f9050565b600061243a8a8a8a6136a7565b509650505b5050505050610bdb565b604051633108c13b60e01b81526001600160a01b03821690633108c13b906124779032903390600401615cc3565b60006040518083038186803b15801561248f57600080fd5b505afa1580156124a3573d6000803e3d6000fd5b505060145460405163bf40fac160e01b8152899350600092506001600160a01b039091169063bf40fac1906124da90600401615de5565b602060405180830381865afa1580156124f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251b9190615ca6565b60145460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac19061254f90600401615e07565b602060405180830381865afa15801561256c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125909190615ca6565b9050806001600160a01b0316632c89aa2e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f49190615da3565b6003546040516357c89a7d60e01b81526001600160a01b03808616926357c89a7d9261262b92899261010090041690600401615cc3565b602060405180830381865afa158015612648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266c9190615da3565b11156126b157336001600160a01b0382161461269a5760405162461bcd60e51b815260040161050690615e35565b60006126a78a8a8a6136a7565b5096506126c39050565b60006126be8a8a8a6136a7565b509650505b50505050509392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091018252602080820180516001600160e01b031663a9059cbb60e01b1790528251808401909352601983527f544f4b454e5f5452414e534645525f4f55545f4641494c45440000000000000090830152610519916137a1565b600080600061275e81612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af115801561279e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c29190615da3565b506127ce3333866137ff565b925092506127db81612fe3565b50915091565b6013546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561282e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128529190615da3565b90506128e26323b872dd60e01b85308660405160240161287493929190615e92565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050506040518060400160405280601881526020017f544f4b454e5f5452414e534645525f494e5f4641494c454400000000000000008152506137a1565b6013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561292b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294f9190615da3565b9050818110156129a15760405162461bcd60e51b815260206004820152601a60248201527f544f4b454e5f5452414e534645525f494e5f4f564552464c4f570000000000006044820152606401610506565b6129ab8282615dbc565b95945050505050565b60008060006129c281612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a269190615da3565b50612a323386866137ff565b92509250612a3f81612fe3565b509250929050565b6013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612a90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a519190615da3565b600080600360019054906101000a90046001600160a01b03169050806001600160a01b031663f851a4406040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b319190615ca6565b6001600160a01b0316336001600160a01b0316148015612bae5750806001600160a01b0316630a755ec26040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bae9190615c30565b80612c2b57506000546001600160a01b031633148015612c2b5750806001600160a01b031663cf6bfd2d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c2b9190615c30565b91505090565b600080612c3d81612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612c7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca19190615da3565b50612cae33600085613c93565b915061160381612fe3565b606060036000612cc76142db565b90508160ff168151612cd99190615cf3565b67ffffffffffffffff811115612cf157612cf1615932565b604051908082528060200260200182016040528015612d1a578160200160208202803683370190505b50925060005b8151811015612d7657818181518110612d3b57612d3b615d06565b6020026020010151848281518110612d5557612d55615d06565b6001600160e01b031990921660209283029190910190910152600101612d20565b50805163cb2ef6f760e01b908490612d8d85615d1c565b9450612d9c9060ff8616615cf3565b81518110612dac57612dac615d06565b6001600160e01b0319909216602092830291909101909101528051632c436e5b60e01b908490612ddb85615d1c565b9450612dea9060ff8616615cf3565b81518110612dfa57612dfa615d06565b6001600160e01b0319909216602092830291909101909101528051630adccee560e31b908490610d9285615d1c565b6000806000612e3781612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9b9190615da3565b506127ce33856146a3565b600054600160a01b900460ff16612eec5760405162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b6044820152606401610506565b80612f5a57600360019054906101000a90046001600160a01b03166001600160a01b031663c90c20b16040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612f4157600080fd5b505af1158015612f55573d6000803e3d6000fd5b505050505b506000805460ff60a01b19169055565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0836011811115612f9f57612f9f615dcf565b836061811115612fb157612fb1615dcf565b60408051928352602083019190915260009082015260600160405180910390a182601181111561080e5761080e615dcf565b6000805460ff60a01b1916600160a01b17905580610aa557600360019054906101000a90046001600160a01b03166001600160a01b031663632e51426040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561304b57600080fd5b505af115801561305f573d6000803e3d6000fd5b5050505050565b60035460405163d02f735160e01b815260009182916101009091046001600160a01b03169063d02f7351906130a79030908a908a908a908a90600401615eb6565b6020604051808303816000875af11580156130c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ea9190615da3565b90508015613107576130ff6003601d83614aae565b915050610c4f565b846001600160a01b0316846001600160a01b03160361312c576130ff6006601e612f6a565b613191604080516101808101909152806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b0385166000908152601060205260409020546131b49085614b50565b60208301819052828260038111156131ce576131ce615dcf565b60038111156131df576131df615dcf565b90525060009050815160038111156131f9576131f9615dcf565b14613229576132206009601c8360000151600381111561321b5761321b615dcf565b614aae565b92505050610c4f565b613248846040518060200160405280666379da05b60000815250614b7b565b6080820152604080516020810190915267016345785d8a0000815261326e908590614b7b565b610140820181905260808201516132859086615dbc565b61328f9190615dbc565b6060820152306001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132f69190615da3565b60c08201908152604080516020810190915290518152608082015161331b9190614b9e565b60a0820152604080516020810190915260c082015181526101408201516133429190614b9e565b61016082015260a0810151600c5461335a9190615cf3565b60e08201526101408101516080820151600f546133779190615dbc565b6133819190615dbc565b610120820152610160810151600e5461339a9190615cf3565b6101008201526001600160a01b03861660009081526010602052604090205460608201516133c89190614bb6565b60408301819052828260038111156133e2576133e2615dcf565b60038111156133f3576133f3615dcf565b905250600090508151600381111561340d5761340d615dcf565b1461342f576132206009601b8360000151600381111561321b5761321b615dcf565b60e0810151600c55610120810151600f55610100810151600e556020808201516001600160a01b0387811660008181526010855260408082209490945583860151928b1680825290849020929092556060850151925192835290929091600080516020615f7f833981519152910160405180910390a3306001600160a01b0316856001600160a01b0316600080516020615f7f83398151915283608001516040516134dc91815260200190565b60405180910390a360a081015160e08201516040805130815260208101939093528201527fa91e67c5ea634cd43a12c5a482724b03de01e85ca68702a53d0c2f45cb7c1dc59060600160405180910390a1600354604051636d35bf9160e01b81526101009091046001600160a01b031690636d35bf91906135699030908b908b908b908b90600401615eb6565b600060405180830381600087803b15801561358357600080fd5b505af1158015613597573d6000803e3d6000fd5b50600092506135a4915050565b979650505050505050565b6000806135bb81612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156135fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361f9190615da3565b50612cae3384614bdc565b60008061363681612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015613676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061369a9190615da3565b50612cae33846000613c93565b60008060006136b581612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156136f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137199190615da3565b50836001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af115801561375a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377e9190615da3565b5061378b33878787614fa1565b9250925061379881612fe3565b50935093915050565b6013546000906137bb906001600160a01b03168484615449565b8051909150156137fa57808060200190518101906137d99190615c30565b82906137f85760405162461bcd60e51b815260040161050691906158e6565b505b505050565b600354604051631200453160e11b81523060048201526001600160a01b03858116602483015284811660448301526064820184905260009283928392610100909204909116906324008a62906084016020604051808303816000875af115801561386d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138919190615da3565b905080156138b2576138a66003604383614aae565b60009250925050613c8b565b43600954146138c7576138a6600a6044612f6a565b6139106040805161010081019091528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b0386166000908152601260205260409020600101546060820152306040516305eff7ef60e21b81526001600160a01b03888116600483015291909116906317bfdfbc90602401602060405180830381865afa15801561397a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399e9190615da3565b6080820152600185016139ba57608081015160408201526139c2565b604081018590525b6139d08782604001516127e1565b60e0820181905260808201516139e591614b50565b60a0830181905260208301826003811115613a0257613a02615dcf565b6003811115613a1357613a13615dcf565b9052506000905081602001516003811115613a3057613a30615dcf565b14613aa35760405162461bcd60e51b815260206004820152603a60248201527f52455041595f424f52524f575f4e45575f4143434f554e545f424f52524f575f60448201527f42414c414e43455f43414c43554c4154494f4e5f4641494c45440000000000006064820152608401610506565b613ab3600b548260e00151614b50565b60c0830181905260208301826003811115613ad057613ad0615dcf565b6003811115613ae157613ae1615dcf565b9052506000905081602001516003811115613afe57613afe615dcf565b14613b655760405162461bcd60e51b815260206004820152603160248201527f52455041595f424f52524f575f4e45575f544f54414c5f42414c414e43455f43604482015270105310d55310551253d397d19052531151607a1b6064820152608401610506565b60a081810180516001600160a01b03898116600081815260126020908152604091829020948555600a5460019095019490945560c0870151600b81905560e088015195518251948f16855294840192909252820193909352606081019190915260808101919091527f1a2a22cb034d26d1854bdc6666a5b91fe25efbbb5dcad3b0355478d6f5c362a1910160405180910390a160035460e082015160405163efcb03dd60e01b81523060048201526001600160a01b038a8116602483015289811660448301526064820192909252610100909204169063efcb03dd90608401600060405180830381600087803b158015613c5e57600080fd5b505af1158015613c72573d6000803e3d6000fd5b5060009250613c7f915050565b8160e001519350935050505b935093915050565b6000821580613ca0575081155b613cec5760405162461bcd60e51b815260206004820152601860248201527f2172656465656d20746f6b656e73206f7220616d6f756e7400000000000000006044820152606401610506565b613d2d6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b306001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d8f9190615da3565b60408201528315613e525761138884600f54613dab9190615dbc565b1015613db757600f5493505b6060810184905260408051602081018252908201518152613dd890856154dc565b6080830181905260208301826003811115613df557613df5615dcf565b6003811115613e0657613e06615dcf565b9052506000905081602001516003811115613e2357613e23615dcf565b14613e4d57613e456009602c8360200151600381111561321b5761321b615dcf565b915050610bdb565b613f99565b6000198303613edf57600354604051630cbb414760e11b81526001600160a01b0387811660048301523060248301526000604483015261010090920490911690631976828e90606401602060405180830381865afa158015613eb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613edc9190615da3565b92505b6000306001600160a01b0316634aeb3d9a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f439190615da3565b90506103e8613f528583615dbc565b1015613f5c578093505b613f6a84836040015161552e565b60608301819052600f546103e891613f8191615dbc565b1015613f9057600f5460608301525b50608081018390525b600354606082015160405163eabe7d9160e01b815260009261010090046001600160a01b03169163eabe7d9191613fd79130918b9190600401615e92565b6020604051808303816000875af1158015613ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061401a9190615da3565b905080156140385761402f6003602b83614aae565b92505050610bdb565b436009541461404d5761402f600a602f612f6a565b61405d600f548360600151614b50565b60a084018190526020840182600381111561407a5761407a615dcf565b600381111561408b5761408b615dcf565b90525060009050826020015160038111156140a8576140a8615dcf565b146140ca5761402f600960318460200151600381111561321b5761321b615dcf565b6001600160a01b03861660009081526010602052604090205460608301516140f29190614b50565b60c084018190526020840182600381111561410f5761410f615dcf565b600381111561412057614120615dcf565b905250600090508260200151600381111561413d5761413d615dcf565b1461415f5761402f600960308460200151600381111561321b5761321b615dcf565b816080015161416c612a47565b101561417e5761402f600e6032612f6a565b60a0820151600f5560c08201516001600160a01b03871660009081526010602052604090205560808201516141b49087906126cf565b306001600160a01b0316866001600160a01b0316600080516020615f7f83398151915284606001516040516141eb91815260200190565b60405180910390a36080820151606080840151604080516001600160a01b038b16815260208101949094528301527fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929910160405180910390a1600354608083015160608401516040516351dff98960e01b81523060048201526001600160a01b038a811660248301526044820193909352606481019190915261010090920416906351dff989906084015b600060405180830381600087803b1580156142b057600080fd5b505af11580156142c4573d6000803e3d6000fd5b50600092506142d1915050565b9695505050505050565b60408051600d8082526101c082019092526060919060009082602082016101a08036833701905050905063140e25ad60e31b8161431784615d1c565b93508360ff168151811061432d5761432d615d06565b6001600160e01b03199092166020928302919091019091015263db006a7560e01b8161435884615d1c565b93508360ff168151811061436e5761436e615d06565b6001600160e01b03199092166020928302919091019091015263852a12e360e01b8161439984615d1c565b93508360ff16815181106143af576143af615d06565b6001600160e01b03199092166020928302919091019091015263317afabb60e21b816143da84615d1c565b93508360ff16815181106143f0576143f0615d06565b6001600160e01b03199092166020928302919091019091015263073a938160e11b8161441b84615d1c565b93508360ff168151811061443157614431615d06565b6001600160e01b0319909216602092830291909101909101526304c11f0360e31b8161445c84615d1c565b93508360ff168151811061447257614472615d06565b6001600160e01b031990921660209283029190910190910152637af1e23160e11b8161449d84615d1c565b93508360ff16815181106144b3576144b3615d06565b6001600160e01b031990921660209283029190910190910152631d8e90d160e11b816144de84615d1c565b93508360ff16815181106144f4576144f4615d06565b6001600160e01b03199092166020928302919091019091015263b2a02ff160e01b8161451f84615d1c565b93508360ff168151811061453557614535615d06565b6001600160e01b03199092166020928302919091019091015263067db1b360e01b8161456084615d1c565b93508360ff168151811061457657614576615d06565b6001600160e01b0319909216602092830291909101909101526304d7c4cd60e21b816145a184615d1c565b93508360ff16815181106145b7576145b7615d06565b6001600160e01b03199092166020928302919091019091015263b0d58e4960e01b816145e284615d1c565b93508360ff16815181106145f8576145f8615d06565b6001600160e01b03199092166020928302919091019091015263a7b820df60e01b8161462384615d1c565b93508360ff168151811061463957614639615d06565b6001600160e01b03199092166020928302919091019091015260ff8216156108115760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610506565b600354604051634ef4c3e160e01b81526000918291829161010090046001600160a01b031690634ef4c3e1906146e190309089908990600401615e92565b6020604051808303816000875af1158015614700573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147249190615da3565b90508015614745576147396003602183614aae565b60009250925050614aa7565b436009541461475a57614739600a6024612f6a565b61479b6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b306001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156147d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147fd9190615da3565b604082015261480c86866127e1565b60c082018190526040805160208101825290830151815261482d9190615569565b606083018190526020830182600381111561484a5761484a615dcf565b600381111561485b5761485b615dcf565b905250600090508160200151600381111561487857614878615dcf565b146148c55760405162461bcd60e51b815260206004820181905260248201527f4d494e545f45584348414e47455f43414c43554c4154494f4e5f4641494c45446044820152606401610506565b60008160600151116149195760405162461bcd60e51b815260206004820152601a60248201527f4d494e545f5a45524f5f43544f4b454e535f52454a45435445440000000000006044820152606401610506565b8060600151600f5461492b9190615cf3565b608082015260608101516001600160a01b0387166000908152601060205260409020546149589190615cf3565b60a082018190526080820151600f556001600160a01b0387166000818152601060209081526040918290209390935560c0840151606080860151835194855294840191909152908201929092527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f910160405180910390a1856001600160a01b0316306001600160a01b0316600080516020615f7f8339815191528360600151604051614a0791815260200190565b60405180910390a360035460c082015160608301516040516341c728b960e01b81523060048201526001600160a01b038a811660248301526044820193909352606481019190915261010090920416906341c728b990608401600060405180830381600087803b158015614a7a57600080fd5b505af1158015614a8e573d6000803e3d6000fd5b5060009250614a9b915050565b8160c001519350935050505b9250929050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846011811115614ae357614ae3615dcf565b846061811115614af557614af5615dcf565b604080519283526020830191909152810184905260600160405180910390a16003846011811115614b2857614b28615dcf565b14614b4457836011811115614b3f57614b3f615dcf565b610c4f565b610c4f826103e8615cf3565b600080838311614b6f576000614b668486615dbc565b91509150614aa7565b50600390506000614aa7565b6000670de0b6b3a7640000614b94848460000151615579565b61080e9190615eff565b600080614bab84846155bb565b9050610c4f816155ec565b600080838301848110614bce57600092509050614aa7565b600260009250925050614aa7565b60035460405163368f515360e21b815260009182916101009091046001600160a01b03169063da3d454c90614c1990309088908890600401615e92565b6020604051808303816000875af1158015614c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c5c9190615da3565b90508015614c7957614c716003601083614aae565b915050610811565b4360095414614c8e57614c71600a600c612f6a565b6000614c98612a47565b905083811015614cb757614cae600e600b612f6a565b92505050610811565b614ce3604080516080810190915280600081526020016000815260200160008152602001600081525090565b306040516305eff7ef60e21b81526001600160a01b03888116600483015291909116906317bfdfbc90602401602060405180830381865afa158015614d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d509190615da3565b60208201819052614d619086614bb6565b6040830181905282826003811115614d7b57614d7b615dcf565b6003811115614d8c57614d8c615dcf565b9052506000905081516003811115614da657614da6615dcf565b14614dd257614dc86009600e8360000151600381111561321b5761321b615dcf565b9350505050610811565b6003546040828101519051631de6c8a560e21b815230600482015260248101919091526101009091046001600160a01b03169063779b229490604401602060405180830381865afa158015614e2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e4f9190615da3565b92508215614e6457614dc86003601085614aae565b614e70600b5486614bb6565b6060830181905282826003811115614e8a57614e8a615dcf565b6003811115614e9b57614e9b615dcf565b9052506000905081516003811115614eb557614eb5615dcf565b14614ed757614dc86009600d8360000151600381111561321b5761321b615dcf565b6040808201516001600160a01b0388166000908152601260205291909120908155600a546001909101556060810151600b55614f1386866126cf565b60408082015160608084015183516001600160a01b038b168152602081018a9052938401929092528201527f13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab809060800160405180910390a1600354604051639614b53b60e01b81526101009091046001600160a01b031690639614b53b906142969030908a90600401615cc3565b600354604051632fe3f38f60e11b81526000918291829161010090046001600160a01b031690635fc7e71e90614fe390309088908c908c908c90600401615eb6565b6020604051808303816000875af1158015615002573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150269190615da3565b905080156150475761503b6003601483614aae565b60009250925050615440565b436009541461505c5761503b600a6018612f6a565b43846001600160a01b0316636c540baf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561509b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150bf9190615da3565b146150d05761503b600a6013612f6a565b866001600160a01b0316866001600160a01b0316036150f55761503b60066019612f6a565b846000036151095761503b60076017612f6a565b600019850361511e5761503b60076016612f6a565b60008061512c8989896137ff565b909250905081156151615761515382601181111561514c5761514c615dcf565b601a612f6a565b600094509450505050615440565b60035460405163c488847b60e01b815260009182916101009091046001600160a01b03169063c488847b9061519e9030908c908890600401615e92565b6040805180830381865afa1580156151ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906151de9190615f13565b9092509050811561524d5760405162461bcd60e51b815260206004820152603360248201527f4c49515549444154455f434f4d5054524f4c4c45525f43414c43554c4154455f604482015272105353d5539517d4d152569157d19052531151606a1b6064820152608401610506565b6040516370a0823160e01b81526001600160a01b038b811660048301528291908a16906370a0823190602401602060405180830381865afa158015615296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906152ba9190615da3565b10156153085760405162461bcd60e51b815260206004820152601860248201527f4c49515549444154455f5345495a455f544f4f5f4d55434800000000000000006044820152606401610506565b6000306001600160a01b038a160361532d57615326308d8d85613066565b90506153a3565b60405163b2a02ff160e01b81526001600160a01b038a169063b2a02ff19061535d908f908f908790600401615e92565b6020604051808303816000875af115801561537c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906153a09190615da3565b90505b80156153da5760405162461bcd60e51b8152602060048201526006602482015265217365697a6560d01b6044820152606401610506565b604080516001600160a01b038e811682528d811660208301528183018790528b1660608201526080810184905290517f298637f684da70674f26509b10f07ec2fbc77a335ab1e7d6215a4b2484d8bb529181900360a00190a16000975092955050505050505b94509492505050565b6060600080856001600160a01b0316856040516154669190615f37565b6000604051808303816000865af19150503d80600081146154a3576040519150601f19603f3d011682016040523d82523d6000602084013e6154a8565b606091505b5091509150816129ab578051156154c25780518082602001fd5b8360405162461bcd60e51b815260040161050691906158e6565b6000806000806154ec8686615604565b9092509050600082600381111561550557615505615dcf565b146155165750915060009050614aa7565b6000615521826155ec565b9350935050509250929050565b60008161554384670de0b6b3a7640000615f53565b61554d9190615eff565b90506155598284615f6a565b156108115761080e600182615cf3565b6000806000806154ec8686615680565b600061080e83836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f770000000000000000008152506156f3565b60408051602081019091526000815260405180602001604052806155e3856000015185615579565b90529392505050565b805160009061081190670de0b6b3a764000090615eff565b600061561c6040518060200160405280600081525090565b60008061562d866000015186615746565b9092509050600082600381111561564657615646615dcf565b1461566557506040805160208101909152600081529092509050614aa7565b60408051602081019091529081526000969095509350505050565b60006156986040518060200160405280600081525090565b6000806156ad670de0b6b3a764000087615746565b909250905060008260038111156156c6576156c6615dcf565b146156e557506040805160208101909152600081529092509050614aa7565b615521818660000151615788565b6000831580615700575082155b1561570d57506000610bdb565b60006157198486615f53565b9050836157268683615eff565b1483906106e05760405162461bcd60e51b815260040161050691906158e6565b6000808360000361575c57506000905080614aa7565b8383028361576a8683615eff565b1461577d57600260009250925050614aa7565b600092509050614aa7565b60006157a06040518060200160405280600081525090565b6000806157b586670de0b6b3a7640000615746565b909250905060008260038111156157ce576157ce615dcf565b146157ed57506040805160208101909152600081529092509050614aa7565b6000806157fa8388615853565b9092509050600082600381111561581357615813615dcf565b146158365781604051806020016040528060008152509550955050505050614aa7565b604080516020810190915290815260009890975095505050505050565b6000808260000361586a5750600190506000614aa7565b60006158768486615eff565b915091509250929050565b6001600160a01b0381168114610aa557600080fd5b600080604083850312156158a957600080fd5b82356158b481615881565b946020939093013593505050565b60005b838110156158dd5781810151838201526020016158c5565b50506000910152565b60208152600082518060208401526159058160408501602087016158c2565b601f01601f19169190910160400192915050565b60006020828403121561592b57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561597157615971615932565b604052919050565b6000602080838503121561598c57600080fd5b823567ffffffffffffffff808211156159a457600080fd5b818501915085601f8301126159b857600080fd5b8135818111156159ca576159ca615932565b6159dc601f8201601f19168501615948565b915080825286848285010111156159f257600080fd5b8084840185840137600090820190930192909252509392505050565b6020808252825182820181905260009190848201906040850190845b81811015615a505783516001600160e01b03191683529284019291840191600101615a2a565b50909695505050505050565b600080600080600060a08688031215615a7457600080fd5b8535615a7f81615881565b9450602086810135615a9081615881565b94506040870135615aa081615881565b935060608701359250608087013567ffffffffffffffff80821115615ac457600080fd5b818901915089601f830112615ad857600080fd5b813581811115615aea57615aea615932565b8060051b9150615afb848301615948565b818152918301840191848101908c841115615b1557600080fd5b938501935b83851015615b3357843582529385019390850190615b1a565b8096505050505050509295509295909350565b600080600060608486031215615b5b57600080fd5b8335615b6681615881565b92506020840135615b7681615881565b929592945050506040919091013590565b600080600060608486031215615b9c57600080fd5b8335615ba781615881565b9250602084013591506040840135615bbe81615881565b809150509250925092565b600181811c90821680615bdd57607f821691505b60208210810361160357634e487b7160e01b600052602260045260246000fd5b6001600160a01b0394851681529284166020840152921660408201526001600160e01b0319909116606082015260800190565b600060208284031215615c4257600080fd5b81518015158114610bdb57600080fd5b6020808252600e908201526d1b9bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60208082526012908201527148595045524e41544956455f4f5241434c4560701b604082015260600190565b600060208284031215615cb857600080fd5b8151610bdb81615881565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561081157610811615cdd565b634e487b7160e01b600052603260045260246000fd5b600060ff821680615d2f57615d2f615cdd565b6000190192915050565b6001600160a01b03858116825284166020808301919091526040820184905260806060830181905283519083018190526000918481019160a085019190845b81811015615d9457845184529382019392820192600101615d78565b50919998505050505050505050565b600060208284031215615db557600080fd5b5051919050565b8181038181111561081157610811615cdd565b634e487b7160e01b600052602160045260246000fd5b602080825260089082015267506f6f6c4c656e7360c01b604082015260600190565b60208082526014908201527324b7b734b1aab734ab19a634b8bab4b230ba37b960611b604082015260600190565b6020808252603e908201527f4865616c746820666163746f72206e6f74206c6f7720656e6f75676820666f7260408201527f206e6f6e2d7065726d697373696f6e6564206c69717569646174696f6e730000606082015260800190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039586168152938516602085015291841660408401529092166060820152608081019190915260a00190565b634e487b7160e01b600052601260045260246000fd5b600082615f0e57615f0e615ee9565b500490565b60008060408385031215615f2657600080fd5b505080516020909101519092909150565b60008251615f498184602087016158c2565b9190910192915050565b808202811582820484141761081157610811615cdd565b600082615f7957615f79615ee9565b50069056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122096273ff376dee875a984487ffefe362dd083ef93556fd381c04eb76a92e44bad64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102325760003560e01c806389f8132e11610130578063b0d58e49116100b8578063c91a424f1161007c578063c91a424f1461045d578063cb2ef6f714610470578063db006a751461049a578063f3fdb15a146104ad578063f5e3c462146104c057600080fd5b8063b0d58e491461040c578063b2a02ff11461041f578063be99f11914610432578063c3bf11cd14610441578063c5ebeaec1461044a57600080fd5b80639826394b116100ff5780639826394b146103c1578063a0712d68146103ca578063a21d1ade146103dd578063a7b820df146103f0578063aa5af0fd1461040357600080fd5b806389f8132e146103925780638d02d9a1146103a75780638f840ddd146103b057806395d89b41146103b957600080fd5b80633b1d21a2116101be57806361feacff1161018257806361feacff1461034c5780636752e702146103555780636c540baf146103635780636f307dc31461036c578063852a12e31461037f57600080fd5b80633b1d21a2146102e55780633c4f743c146102ed57806347bd37181461031857806356e67728146103215780635fe3b5671461033457600080fd5b8063173b990411610205578063173b99041461029e57806318160ddd146102a75780632608f818146102b05780632c436e5b146102c3578063313ce567146102d857600080fd5b8063067db1b31461023757806306fdde031461024c5780630e7527021461026a578063135f13341461028b575b600080fd5b61024a610245366004615896565b6104d3565b005b61025461051d565b60405161026191906158e6565b60405180910390f35b61027d610278366004615919565b6105ab565b604051908152602001610261565b61027d610299366004615896565b6107cb565b61027d60085481565b61027d600f5481565b61027d6102be366004615896565b610817565b60055b60405160ff9091168152602001610261565b6003546102c69060ff1681565b61027d610a47565b601454610300906001600160a01b031681565b6040516001600160a01b039091168152602001610261565b61027d600b5481565b61024a61032f366004615979565b610a56565b6003546103009061010090046001600160a01b031681565b61027d600d5481565b61027d666379da05b6000081565b61027d60095481565b601354610300906001600160a01b031681565b61027d61038d366004615919565b610aa8565b61039a610cbe565b6040516102619190615a0e565b61027d60065481565b61027d600c5481565b610254610e20565b61027d600e5481565b61027d6103d8366004615919565b610e2d565b61024a6103eb366004615a5c565b61103a565b61027d6103fe366004615919565b61127b565b61027d600a5481565b61027d61041a366004615919565b611609565b61027d61042d366004615b46565b6118c8565b61027d67016345785d8a000081565b61027d60075481565b61027d610458366004615919565b611a62565b600054610300906001600160a01b031681565b60408051808201909152600e81526d43457263323044656c656761746560901b6020820152610254565b61027d6104a8366004615919565b611c69565b600454610300906001600160a01b031681565b61027d6104ce366004615b87565b611e70565b33301461050f5760405162461bcd60e51b815260206004820152600560248201526410b9b2b63360d91b60448201526064015b60405180910390fd5b61051982826126cf565b5050565b6001805461052a90615bc9565b80601f016020809104026020016040519081016040528092919081815260200182805461055690615bc9565b80156105a35780601f10610578576101008083540402835291602001916105a3565b820191906000526020600020905b81548152906001019060200180831161058657829003601f168201915b505050505081565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb8926105f89261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610615573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106399190615c30565b6106555760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061068490600401615c7a565b602060405180830381865afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c59190615ca6565b90506001600160a01b0381166106e95760006106e084612750565b50949350505050565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b15801561072c57600080fd5b505af1158015610740573d6000803e3d6000fd5b50503332039150610762905057600061075885612750565b5095945050505050565b604051633108c13b60e01b81526001600160a01b03821690633108c13b906107909032903390600401615cc3565b60006040518083038186803b1580156107a857600080fd5b505afa1580156107bc573d6000803e3d6000fd5b50505050600061075885612750565b60003330146108045760405162461bcd60e51b815260206004820152600560248201526410b9b2b63360d91b6044820152606401610506565b61080e83836127e1565b90505b92915050565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb8926108649261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190615c30565b6108c15760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906108f090600401615c7a565b602060405180830381865afa15801561090d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109319190615ca6565b90506001600160a01b03811661095757600061094d85856129b4565b5092505050610811565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b15801561099a57600080fd5b505af11580156109ae573d6000803e3d6000fd5b505033320391506109d290505760006109c786866129b4565b509350505050610811565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90610a009032903390600401615cc3565b60006040518083038186803b158015610a1857600080fd5b505afa158015610a2c573d6000803e3d6000fd5b505050506000610a3c86866129b4565b509695505050505050565b6000610a51612a47565b905090565b33301480610a675750610a67612ab4565b610aa55760405162461bcd60e51b815260206004820152600f60248201526e10b9b2b633103e3e1010b0b236b4b760891b6044820152606401610506565b50565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892610af59261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190615c30565b610b525760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610b8190600401615c7a565b602060405180830381865afa158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190615ca6565b90506001600160a01b038116610be257610bdb83612c31565b9392505050565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015610c2557600080fd5b505af1158015610c39573d6000803e3d6000fd5b50503332039150610c57905057610c4f84612c31565b949350505050565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90610c859032903390600401615cc3565b60006040518083038186803b158015610c9d57600080fd5b505afa158015610cb1573d6000803e3d6000fd5b50505050610c4f84612c31565b606060016000610ccc612cb9565b90508160ff168151610cde9190615cf3565b67ffffffffffffffff811115610cf657610cf6615932565b604051908082528060200260200182016040528015610d1f578160200160208202803683370190505b50925060005b8151811015610d7b57818181518110610d4057610d40615d06565b6020026020010151848281518110610d5a57610d5a615d06565b6001600160e01b031990921660209283029190910190910152600101610d25565b50805163510e8d6f60e11b908490610d9285615d1c565b9450610da19060ff8616615cf3565b81518110610db157610db1615d06565b6001600160e01b03199092166020928302919091019091015260ff821615610e1b5760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610506565b505090565b6002805461052a90615bc9565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892610e7a9261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190615c30565b610ed75760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610f0690600401615c7a565b602060405180830381865afa158015610f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f479190615ca6565b90506001600160a01b038116610f625760006106e084612e29565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015610fa557600080fd5b505af1158015610fb9573d6000803e3d6000fd5b50503332039150610fd1905057600061075885612e29565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90610fff9032903390600401615cc3565b60006040518083038186803b15801561101757600080fd5b505afa15801561102b573d6000803e3d6000fd5b50505050600061075885612e29565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169363df595cb89361108493610100900416913391309190356001600160e01b03191690600401615bfd565b602060405180830381865afa1580156110a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c59190615c30565b6110e15760405162461bcd60e51b815260040161050690615c52565b604051637d5f6a0960e11b81526000906001600160a01b0387169063fabed41290611116903090899088908890600401615d39565b6020604051808303816000875af1158015611135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111599190615da3565b60405163095ea7b360e01b81526001600160a01b038681166004830152602482018390529192509086169063095ea7b3906044016020604051808303816000875af11580156111ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d09190615c30565b50604051631f72642160e31b81526001600160a01b0386811660048301526024820183905285169063fb93210890604401600060405180830381600087803b15801561121b57600080fd5b505af115801561122f573d6000803e3d6000fd5b50506040518381526001600160a01b03881692503091507ffe419fd3f83b80440f2b7ab5329d4879725f0da535d9c47c050f918d3455bdb89060200160405180910390a3505050505050565b60008061128781612ea6565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906112b690600401615c7a565b602060405180830381865afa1580156112d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f79190615ca6565b90506001600160a01b03811661144f57306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611347573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136b9190615da3565b50436009541461138857611381600a6039612f6a565b9250611449565b83611391612a47565b10156113a357611381600e6038612f6a565b600d548411156113b9576113816002603a612f6a565b83600d546113c79190615dbc565b600d55600354604080516303e1469160e61b815290516114449261010090046001600160a01b03169163f851a4409160048083019260209291908290030181865afa15801561141a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143e9190615ca6565b856126cf565b600092505b506115fa565b604051633108c13b60e01b815281906001600160a01b03821690633108c13b9061147f9032903390600401615cc3565b60006040518083038186803b15801561149757600080fd5b505afa1580156114ab573d6000803e3d6000fd5b505050506114b63090565b6001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156114f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115199190615da3565b5043600954146115365761152f600a6039612f6a565b93506115f7565b8461153f612a47565b10156115515761152f600e6038612f6a565b600d548511156115675761152f6002603a612f6a565b84600d546115759190615dbc565b600d55600354604080516303e1469160e61b815290516115f29261010090046001600160a01b03169163f851a4409160048083019260209291908290030181865afa1580156115c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ec9190615ca6565b866126cf565b600093505b50505b61160381612fe3565b50919050565b60008061161581612ea6565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061164490600401615c7a565b602060405180830381865afa158015611661573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116859190615ca6565b90506001600160a01b03811661177957306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156116d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f99190615da3565b50436009541461170f57611381600a6035612f6a565b83611718612a47565b101561172a57611381600e6034612f6a565b600e548411156117405761138160026036612f6a565b600084600e546117509190615dbc565b600e81905560005490915061176e906001600160a01b0316866126cf565b6000935050506115fa565b604051633108c13b60e01b815281906001600160a01b03821690633108c13b906117a99032903390600401615cc3565b60006040518083038186803b1580156117c157600080fd5b505afa1580156117d5573d6000803e3d6000fd5b505050506117e03090565b6001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af115801561181f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118439190615da3565b5043600954146118595761152f600a6035612f6a565b84611862612a47565b10156118745761152f600e6034612f6a565b600e5485111561188a5761152f60026036612f6a565b600085600e5461189a9190615dbc565b600e8190556000549091506118b8906001600160a01b0316876126cf565b6000945050505061160381612fe3565b600060016118d581612ea6565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061190490600401615c7a565b602060405180830381865afa158015611921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119459190615ca6565b90506001600160a01b0381166119695761196133878787613066565b925050611a51565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b1580156119ac57600080fd5b505af11580156119c0573d6000803e3d6000fd5b505033320391506119e29050576119d933888888613066565b93505050611a51565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90611a109032903390600401615cc3565b60006040518083038186803b158015611a2857600080fd5b505afa158015611a3c573d6000803e3d6000fd5b50505050611a4c33888888613066565b935050505b611a5a81612fe3565b509392505050565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892611aaf9261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015611acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af09190615c30565b611b0c5760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611b3b90600401615c7a565b602060405180830381865afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7c9190615ca6565b90506001600160a01b038116611b9557610bdb836135af565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015611bd857600080fd5b505af1158015611bec573d6000803e3d6000fd5b50503332039150611c02905057610c4f846135af565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90611c309032903390600401615cc3565b60006040518083038186803b158015611c4857600080fd5b505afa158015611c5c573d6000803e3d6000fd5b50505050610c4f846135af565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892611cb69261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015611cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf79190615c30565b611d135760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611d4290600401615c7a565b602060405180830381865afa158015611d5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d839190615ca6565b90506001600160a01b038116611d9c57610bdb8361362a565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b158015611ddf57600080fd5b505af1158015611df3573d6000803e3d6000fd5b50503332039150611e09905057610c4f8461362a565b604051633108c13b60e01b81526001600160a01b03821690633108c13b90611e379032903390600401615cc3565b60006040518083038186803b158015611e4f57600080fd5b505afa158015611e63573d6000803e3d6000fd5b50505050610c4f8461362a565b60008054600354604051631beb2b9760e31b81526001600160a01b039283169263df595cb892611ebd9261010090910490911690339030906001600160e01b031988351690600401615bfd565b602060405180830381865afa158015611eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611efe9190615c30565b611f1a5760405162461bcd60e51b815260040161050690615c52565b60145460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611f4990600401615c7a565b602060405180830381865afa158015611f66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8a9190615ca6565b90506001600160a01b0381166121bf5760145460405163bf40fac160e01b815286916000916001600160a01b039091169063bf40fac190611fcd90600401615de5565b602060405180830381865afa158015611fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200e9190615ca6565b60145460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac19061204290600401615e07565b602060405180830381865afa15801561205f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120839190615ca6565b9050806001600160a01b0316632c89aa2e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e79190615da3565b6003546040516357c89a7d60e01b81526001600160a01b03808616926357c89a7d9261211e92899261010090041690600401615cc3565b602060405180830381865afa15801561213b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215f9190615da3565b11156121a457336001600160a01b0382161461218d5760405162461bcd60e51b815260040161050690615e35565b600061219a8989896136a7565b5095506121b69050565b60006121b18989896136a7565b509550505b50505050610bdb565b60405163b230eab960e01b815233600482015281906001600160a01b0382169063b230eab990602401600060405180830381600087803b15801561220257600080fd5b505af1158015612216573d6000803e3d6000fd5b5050333203915061244990505760145460405163bf40fac160e01b815287916000916001600160a01b039091169063bf40fac19061225690600401615de5565b602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122979190615ca6565b60145460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac1906122cb90600401615e07565b602060405180830381865afa1580156122e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230c9190615ca6565b9050806001600160a01b0316632c89aa2e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561234c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123709190615da3565b6003546040516357c89a7d60e01b81526001600160a01b03808616926357c89a7d926123a792899261010090041690600401615cc3565b602060405180830381865afa1580156123c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e89190615da3565b111561242d57336001600160a01b038216146124165760405162461bcd60e51b815260040161050690615e35565b60006124238a8a8a6136a7565b50965061243f9050565b600061243a8a8a8a6136a7565b509650505b5050505050610bdb565b604051633108c13b60e01b81526001600160a01b03821690633108c13b906124779032903390600401615cc3565b60006040518083038186803b15801561248f57600080fd5b505afa1580156124a3573d6000803e3d6000fd5b505060145460405163bf40fac160e01b8152899350600092506001600160a01b039091169063bf40fac1906124da90600401615de5565b602060405180830381865afa1580156124f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251b9190615ca6565b60145460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac19061254f90600401615e07565b602060405180830381865afa15801561256c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125909190615ca6565b9050806001600160a01b0316632c89aa2e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f49190615da3565b6003546040516357c89a7d60e01b81526001600160a01b03808616926357c89a7d9261262b92899261010090041690600401615cc3565b602060405180830381865afa158015612648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266c9190615da3565b11156126b157336001600160a01b0382161461269a5760405162461bcd60e51b815260040161050690615e35565b60006126a78a8a8a6136a7565b5096506126c39050565b60006126be8a8a8a6136a7565b509650505b50505050509392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091018252602080820180516001600160e01b031663a9059cbb60e01b1790528251808401909352601983527f544f4b454e5f5452414e534645525f4f55545f4641494c45440000000000000090830152610519916137a1565b600080600061275e81612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af115801561279e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c29190615da3565b506127ce3333866137ff565b925092506127db81612fe3565b50915091565b6013546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561282e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128529190615da3565b90506128e26323b872dd60e01b85308660405160240161287493929190615e92565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050506040518060400160405280601881526020017f544f4b454e5f5452414e534645525f494e5f4641494c454400000000000000008152506137a1565b6013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561292b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294f9190615da3565b9050818110156129a15760405162461bcd60e51b815260206004820152601a60248201527f544f4b454e5f5452414e534645525f494e5f4f564552464c4f570000000000006044820152606401610506565b6129ab8282615dbc565b95945050505050565b60008060006129c281612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a269190615da3565b50612a323386866137ff565b92509250612a3f81612fe3565b509250929050565b6013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612a90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a519190615da3565b600080600360019054906101000a90046001600160a01b03169050806001600160a01b031663f851a4406040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b319190615ca6565b6001600160a01b0316336001600160a01b0316148015612bae5750806001600160a01b0316630a755ec26040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bae9190615c30565b80612c2b57506000546001600160a01b031633148015612c2b5750806001600160a01b031663cf6bfd2d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c2b9190615c30565b91505090565b600080612c3d81612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612c7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca19190615da3565b50612cae33600085613c93565b915061160381612fe3565b606060036000612cc76142db565b90508160ff168151612cd99190615cf3565b67ffffffffffffffff811115612cf157612cf1615932565b604051908082528060200260200182016040528015612d1a578160200160208202803683370190505b50925060005b8151811015612d7657818181518110612d3b57612d3b615d06565b6020026020010151848281518110612d5557612d55615d06565b6001600160e01b031990921660209283029190910190910152600101612d20565b50805163cb2ef6f760e01b908490612d8d85615d1c565b9450612d9c9060ff8616615cf3565b81518110612dac57612dac615d06565b6001600160e01b0319909216602092830291909101909101528051632c436e5b60e01b908490612ddb85615d1c565b9450612dea9060ff8616615cf3565b81518110612dfa57612dfa615d06565b6001600160e01b0319909216602092830291909101909101528051630adccee560e31b908490610d9285615d1c565b6000806000612e3781612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9b9190615da3565b506127ce33856146a3565b600054600160a01b900460ff16612eec5760405162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b6044820152606401610506565b80612f5a57600360019054906101000a90046001600160a01b03166001600160a01b031663c90c20b16040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612f4157600080fd5b505af1158015612f55573d6000803e3d6000fd5b505050505b506000805460ff60a01b19169055565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0836011811115612f9f57612f9f615dcf565b836061811115612fb157612fb1615dcf565b60408051928352602083019190915260009082015260600160405180910390a182601181111561080e5761080e615dcf565b6000805460ff60a01b1916600160a01b17905580610aa557600360019054906101000a90046001600160a01b03166001600160a01b031663632e51426040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561304b57600080fd5b505af115801561305f573d6000803e3d6000fd5b5050505050565b60035460405163d02f735160e01b815260009182916101009091046001600160a01b03169063d02f7351906130a79030908a908a908a908a90600401615eb6565b6020604051808303816000875af11580156130c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ea9190615da3565b90508015613107576130ff6003601d83614aae565b915050610c4f565b846001600160a01b0316846001600160a01b03160361312c576130ff6006601e612f6a565b613191604080516101808101909152806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b0385166000908152601060205260409020546131b49085614b50565b60208301819052828260038111156131ce576131ce615dcf565b60038111156131df576131df615dcf565b90525060009050815160038111156131f9576131f9615dcf565b14613229576132206009601c8360000151600381111561321b5761321b615dcf565b614aae565b92505050610c4f565b613248846040518060200160405280666379da05b60000815250614b7b565b6080820152604080516020810190915267016345785d8a0000815261326e908590614b7b565b610140820181905260808201516132859086615dbc565b61328f9190615dbc565b6060820152306001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132f69190615da3565b60c08201908152604080516020810190915290518152608082015161331b9190614b9e565b60a0820152604080516020810190915260c082015181526101408201516133429190614b9e565b61016082015260a0810151600c5461335a9190615cf3565b60e08201526101408101516080820151600f546133779190615dbc565b6133819190615dbc565b610120820152610160810151600e5461339a9190615cf3565b6101008201526001600160a01b03861660009081526010602052604090205460608201516133c89190614bb6565b60408301819052828260038111156133e2576133e2615dcf565b60038111156133f3576133f3615dcf565b905250600090508151600381111561340d5761340d615dcf565b1461342f576132206009601b8360000151600381111561321b5761321b615dcf565b60e0810151600c55610120810151600f55610100810151600e556020808201516001600160a01b0387811660008181526010855260408082209490945583860151928b1680825290849020929092556060850151925192835290929091600080516020615f7f833981519152910160405180910390a3306001600160a01b0316856001600160a01b0316600080516020615f7f83398151915283608001516040516134dc91815260200190565b60405180910390a360a081015160e08201516040805130815260208101939093528201527fa91e67c5ea634cd43a12c5a482724b03de01e85ca68702a53d0c2f45cb7c1dc59060600160405180910390a1600354604051636d35bf9160e01b81526101009091046001600160a01b031690636d35bf91906135699030908b908b908b908b90600401615eb6565b600060405180830381600087803b15801561358357600080fd5b505af1158015613597573d6000803e3d6000fd5b50600092506135a4915050565b979650505050505050565b6000806135bb81612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156135fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361f9190615da3565b50612cae3384614bdc565b60008061363681612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af1158015613676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061369a9190615da3565b50612cae33846000613c93565b60008060006136b581612ea6565b306001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af11580156136f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137199190615da3565b50836001600160a01b031663a6afed956040518163ffffffff1660e01b81526004016020604051808303816000875af115801561375a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377e9190615da3565b5061378b33878787614fa1565b9250925061379881612fe3565b50935093915050565b6013546000906137bb906001600160a01b03168484615449565b8051909150156137fa57808060200190518101906137d99190615c30565b82906137f85760405162461bcd60e51b815260040161050691906158e6565b505b505050565b600354604051631200453160e11b81523060048201526001600160a01b03858116602483015284811660448301526064820184905260009283928392610100909204909116906324008a62906084016020604051808303816000875af115801561386d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138919190615da3565b905080156138b2576138a66003604383614aae565b60009250925050613c8b565b43600954146138c7576138a6600a6044612f6a565b6139106040805161010081019091528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b0386166000908152601260205260409020600101546060820152306040516305eff7ef60e21b81526001600160a01b03888116600483015291909116906317bfdfbc90602401602060405180830381865afa15801561397a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399e9190615da3565b6080820152600185016139ba57608081015160408201526139c2565b604081018590525b6139d08782604001516127e1565b60e0820181905260808201516139e591614b50565b60a0830181905260208301826003811115613a0257613a02615dcf565b6003811115613a1357613a13615dcf565b9052506000905081602001516003811115613a3057613a30615dcf565b14613aa35760405162461bcd60e51b815260206004820152603a60248201527f52455041595f424f52524f575f4e45575f4143434f554e545f424f52524f575f60448201527f42414c414e43455f43414c43554c4154494f4e5f4641494c45440000000000006064820152608401610506565b613ab3600b548260e00151614b50565b60c0830181905260208301826003811115613ad057613ad0615dcf565b6003811115613ae157613ae1615dcf565b9052506000905081602001516003811115613afe57613afe615dcf565b14613b655760405162461bcd60e51b815260206004820152603160248201527f52455041595f424f52524f575f4e45575f544f54414c5f42414c414e43455f43604482015270105310d55310551253d397d19052531151607a1b6064820152608401610506565b60a081810180516001600160a01b03898116600081815260126020908152604091829020948555600a5460019095019490945560c0870151600b81905560e088015195518251948f16855294840192909252820193909352606081019190915260808101919091527f1a2a22cb034d26d1854bdc6666a5b91fe25efbbb5dcad3b0355478d6f5c362a1910160405180910390a160035460e082015160405163efcb03dd60e01b81523060048201526001600160a01b038a8116602483015289811660448301526064820192909252610100909204169063efcb03dd90608401600060405180830381600087803b158015613c5e57600080fd5b505af1158015613c72573d6000803e3d6000fd5b5060009250613c7f915050565b8160e001519350935050505b935093915050565b6000821580613ca0575081155b613cec5760405162461bcd60e51b815260206004820152601860248201527f2172656465656d20746f6b656e73206f7220616d6f756e7400000000000000006044820152606401610506565b613d2d6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b306001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d8f9190615da3565b60408201528315613e525761138884600f54613dab9190615dbc565b1015613db757600f5493505b6060810184905260408051602081018252908201518152613dd890856154dc565b6080830181905260208301826003811115613df557613df5615dcf565b6003811115613e0657613e06615dcf565b9052506000905081602001516003811115613e2357613e23615dcf565b14613e4d57613e456009602c8360200151600381111561321b5761321b615dcf565b915050610bdb565b613f99565b6000198303613edf57600354604051630cbb414760e11b81526001600160a01b0387811660048301523060248301526000604483015261010090920490911690631976828e90606401602060405180830381865afa158015613eb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613edc9190615da3565b92505b6000306001600160a01b0316634aeb3d9a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f439190615da3565b90506103e8613f528583615dbc565b1015613f5c578093505b613f6a84836040015161552e565b60608301819052600f546103e891613f8191615dbc565b1015613f9057600f5460608301525b50608081018390525b600354606082015160405163eabe7d9160e01b815260009261010090046001600160a01b03169163eabe7d9191613fd79130918b9190600401615e92565b6020604051808303816000875af1158015613ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061401a9190615da3565b905080156140385761402f6003602b83614aae565b92505050610bdb565b436009541461404d5761402f600a602f612f6a565b61405d600f548360600151614b50565b60a084018190526020840182600381111561407a5761407a615dcf565b600381111561408b5761408b615dcf565b90525060009050826020015160038111156140a8576140a8615dcf565b146140ca5761402f600960318460200151600381111561321b5761321b615dcf565b6001600160a01b03861660009081526010602052604090205460608301516140f29190614b50565b60c084018190526020840182600381111561410f5761410f615dcf565b600381111561412057614120615dcf565b905250600090508260200151600381111561413d5761413d615dcf565b1461415f5761402f600960308460200151600381111561321b5761321b615dcf565b816080015161416c612a47565b101561417e5761402f600e6032612f6a565b60a0820151600f5560c08201516001600160a01b03871660009081526010602052604090205560808201516141b49087906126cf565b306001600160a01b0316866001600160a01b0316600080516020615f7f83398151915284606001516040516141eb91815260200190565b60405180910390a36080820151606080840151604080516001600160a01b038b16815260208101949094528301527fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929910160405180910390a1600354608083015160608401516040516351dff98960e01b81523060048201526001600160a01b038a811660248301526044820193909352606481019190915261010090920416906351dff989906084015b600060405180830381600087803b1580156142b057600080fd5b505af11580156142c4573d6000803e3d6000fd5b50600092506142d1915050565b9695505050505050565b60408051600d8082526101c082019092526060919060009082602082016101a08036833701905050905063140e25ad60e31b8161431784615d1c565b93508360ff168151811061432d5761432d615d06565b6001600160e01b03199092166020928302919091019091015263db006a7560e01b8161435884615d1c565b93508360ff168151811061436e5761436e615d06565b6001600160e01b03199092166020928302919091019091015263852a12e360e01b8161439984615d1c565b93508360ff16815181106143af576143af615d06565b6001600160e01b03199092166020928302919091019091015263317afabb60e21b816143da84615d1c565b93508360ff16815181106143f0576143f0615d06565b6001600160e01b03199092166020928302919091019091015263073a938160e11b8161441b84615d1c565b93508360ff168151811061443157614431615d06565b6001600160e01b0319909216602092830291909101909101526304c11f0360e31b8161445c84615d1c565b93508360ff168151811061447257614472615d06565b6001600160e01b031990921660209283029190910190910152637af1e23160e11b8161449d84615d1c565b93508360ff16815181106144b3576144b3615d06565b6001600160e01b031990921660209283029190910190910152631d8e90d160e11b816144de84615d1c565b93508360ff16815181106144f4576144f4615d06565b6001600160e01b03199092166020928302919091019091015263b2a02ff160e01b8161451f84615d1c565b93508360ff168151811061453557614535615d06565b6001600160e01b03199092166020928302919091019091015263067db1b360e01b8161456084615d1c565b93508360ff168151811061457657614576615d06565b6001600160e01b0319909216602092830291909101909101526304d7c4cd60e21b816145a184615d1c565b93508360ff16815181106145b7576145b7615d06565b6001600160e01b03199092166020928302919091019091015263b0d58e4960e01b816145e284615d1c565b93508360ff16815181106145f8576145f8615d06565b6001600160e01b03199092166020928302919091019091015263a7b820df60e01b8161462384615d1c565b93508360ff168151811061463957614639615d06565b6001600160e01b03199092166020928302919091019091015260ff8216156108115760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610506565b600354604051634ef4c3e160e01b81526000918291829161010090046001600160a01b031690634ef4c3e1906146e190309089908990600401615e92565b6020604051808303816000875af1158015614700573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147249190615da3565b90508015614745576147396003602183614aae565b60009250925050614aa7565b436009541461475a57614739600a6024612f6a565b61479b6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b306001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156147d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147fd9190615da3565b604082015261480c86866127e1565b60c082018190526040805160208101825290830151815261482d9190615569565b606083018190526020830182600381111561484a5761484a615dcf565b600381111561485b5761485b615dcf565b905250600090508160200151600381111561487857614878615dcf565b146148c55760405162461bcd60e51b815260206004820181905260248201527f4d494e545f45584348414e47455f43414c43554c4154494f4e5f4641494c45446044820152606401610506565b60008160600151116149195760405162461bcd60e51b815260206004820152601a60248201527f4d494e545f5a45524f5f43544f4b454e535f52454a45435445440000000000006044820152606401610506565b8060600151600f5461492b9190615cf3565b608082015260608101516001600160a01b0387166000908152601060205260409020546149589190615cf3565b60a082018190526080820151600f556001600160a01b0387166000818152601060209081526040918290209390935560c0840151606080860151835194855294840191909152908201929092527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f910160405180910390a1856001600160a01b0316306001600160a01b0316600080516020615f7f8339815191528360600151604051614a0791815260200190565b60405180910390a360035460c082015160608301516040516341c728b960e01b81523060048201526001600160a01b038a811660248301526044820193909352606481019190915261010090920416906341c728b990608401600060405180830381600087803b158015614a7a57600080fd5b505af1158015614a8e573d6000803e3d6000fd5b5060009250614a9b915050565b8160c001519350935050505b9250929050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846011811115614ae357614ae3615dcf565b846061811115614af557614af5615dcf565b604080519283526020830191909152810184905260600160405180910390a16003846011811115614b2857614b28615dcf565b14614b4457836011811115614b3f57614b3f615dcf565b610c4f565b610c4f826103e8615cf3565b600080838311614b6f576000614b668486615dbc565b91509150614aa7565b50600390506000614aa7565b6000670de0b6b3a7640000614b94848460000151615579565b61080e9190615eff565b600080614bab84846155bb565b9050610c4f816155ec565b600080838301848110614bce57600092509050614aa7565b600260009250925050614aa7565b60035460405163368f515360e21b815260009182916101009091046001600160a01b03169063da3d454c90614c1990309088908890600401615e92565b6020604051808303816000875af1158015614c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c5c9190615da3565b90508015614c7957614c716003601083614aae565b915050610811565b4360095414614c8e57614c71600a600c612f6a565b6000614c98612a47565b905083811015614cb757614cae600e600b612f6a565b92505050610811565b614ce3604080516080810190915280600081526020016000815260200160008152602001600081525090565b306040516305eff7ef60e21b81526001600160a01b03888116600483015291909116906317bfdfbc90602401602060405180830381865afa158015614d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d509190615da3565b60208201819052614d619086614bb6565b6040830181905282826003811115614d7b57614d7b615dcf565b6003811115614d8c57614d8c615dcf565b9052506000905081516003811115614da657614da6615dcf565b14614dd257614dc86009600e8360000151600381111561321b5761321b615dcf565b9350505050610811565b6003546040828101519051631de6c8a560e21b815230600482015260248101919091526101009091046001600160a01b03169063779b229490604401602060405180830381865afa158015614e2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e4f9190615da3565b92508215614e6457614dc86003601085614aae565b614e70600b5486614bb6565b6060830181905282826003811115614e8a57614e8a615dcf565b6003811115614e9b57614e9b615dcf565b9052506000905081516003811115614eb557614eb5615dcf565b14614ed757614dc86009600d8360000151600381111561321b5761321b615dcf565b6040808201516001600160a01b0388166000908152601260205291909120908155600a546001909101556060810151600b55614f1386866126cf565b60408082015160608084015183516001600160a01b038b168152602081018a9052938401929092528201527f13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab809060800160405180910390a1600354604051639614b53b60e01b81526101009091046001600160a01b031690639614b53b906142969030908a90600401615cc3565b600354604051632fe3f38f60e11b81526000918291829161010090046001600160a01b031690635fc7e71e90614fe390309088908c908c908c90600401615eb6565b6020604051808303816000875af1158015615002573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150269190615da3565b905080156150475761503b6003601483614aae565b60009250925050615440565b436009541461505c5761503b600a6018612f6a565b43846001600160a01b0316636c540baf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561509b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150bf9190615da3565b146150d05761503b600a6013612f6a565b866001600160a01b0316866001600160a01b0316036150f55761503b60066019612f6a565b846000036151095761503b60076017612f6a565b600019850361511e5761503b60076016612f6a565b60008061512c8989896137ff565b909250905081156151615761515382601181111561514c5761514c615dcf565b601a612f6a565b600094509450505050615440565b60035460405163c488847b60e01b815260009182916101009091046001600160a01b03169063c488847b9061519e9030908c908890600401615e92565b6040805180830381865afa1580156151ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906151de9190615f13565b9092509050811561524d5760405162461bcd60e51b815260206004820152603360248201527f4c49515549444154455f434f4d5054524f4c4c45525f43414c43554c4154455f604482015272105353d5539517d4d152569157d19052531151606a1b6064820152608401610506565b6040516370a0823160e01b81526001600160a01b038b811660048301528291908a16906370a0823190602401602060405180830381865afa158015615296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906152ba9190615da3565b10156153085760405162461bcd60e51b815260206004820152601860248201527f4c49515549444154455f5345495a455f544f4f5f4d55434800000000000000006044820152606401610506565b6000306001600160a01b038a160361532d57615326308d8d85613066565b90506153a3565b60405163b2a02ff160e01b81526001600160a01b038a169063b2a02ff19061535d908f908f908790600401615e92565b6020604051808303816000875af115801561537c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906153a09190615da3565b90505b80156153da5760405162461bcd60e51b8152602060048201526006602482015265217365697a6560d01b6044820152606401610506565b604080516001600160a01b038e811682528d811660208301528183018790528b1660608201526080810184905290517f298637f684da70674f26509b10f07ec2fbc77a335ab1e7d6215a4b2484d8bb529181900360a00190a16000975092955050505050505b94509492505050565b6060600080856001600160a01b0316856040516154669190615f37565b6000604051808303816000865af19150503d80600081146154a3576040519150601f19603f3d011682016040523d82523d6000602084013e6154a8565b606091505b5091509150816129ab578051156154c25780518082602001fd5b8360405162461bcd60e51b815260040161050691906158e6565b6000806000806154ec8686615604565b9092509050600082600381111561550557615505615dcf565b146155165750915060009050614aa7565b6000615521826155ec565b9350935050509250929050565b60008161554384670de0b6b3a7640000615f53565b61554d9190615eff565b90506155598284615f6a565b156108115761080e600182615cf3565b6000806000806154ec8686615680565b600061080e83836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f770000000000000000008152506156f3565b60408051602081019091526000815260405180602001604052806155e3856000015185615579565b90529392505050565b805160009061081190670de0b6b3a764000090615eff565b600061561c6040518060200160405280600081525090565b60008061562d866000015186615746565b9092509050600082600381111561564657615646615dcf565b1461566557506040805160208101909152600081529092509050614aa7565b60408051602081019091529081526000969095509350505050565b60006156986040518060200160405280600081525090565b6000806156ad670de0b6b3a764000087615746565b909250905060008260038111156156c6576156c6615dcf565b146156e557506040805160208101909152600081529092509050614aa7565b615521818660000151615788565b6000831580615700575082155b1561570d57506000610bdb565b60006157198486615f53565b9050836157268683615eff565b1483906106e05760405162461bcd60e51b815260040161050691906158e6565b6000808360000361575c57506000905080614aa7565b8383028361576a8683615eff565b1461577d57600260009250925050614aa7565b600092509050614aa7565b60006157a06040518060200160405280600081525090565b6000806157b586670de0b6b3a7640000615746565b909250905060008260038111156157ce576157ce615dcf565b146157ed57506040805160208101909152600081529092509050614aa7565b6000806157fa8388615853565b9092509050600082600381111561581357615813615dcf565b146158365781604051806020016040528060008152509550955050505050614aa7565b604080516020810190915290815260009890975095505050505050565b6000808260000361586a5750600190506000614aa7565b60006158768486615eff565b915091509250929050565b6001600160a01b0381168114610aa557600080fd5b600080604083850312156158a957600080fd5b82356158b481615881565b946020939093013593505050565b60005b838110156158dd5781810151838201526020016158c5565b50506000910152565b60208152600082518060208401526159058160408501602087016158c2565b601f01601f19169190910160400192915050565b60006020828403121561592b57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561597157615971615932565b604052919050565b6000602080838503121561598c57600080fd5b823567ffffffffffffffff808211156159a457600080fd5b818501915085601f8301126159b857600080fd5b8135818111156159ca576159ca615932565b6159dc601f8201601f19168501615948565b915080825286848285010111156159f257600080fd5b8084840185840137600090820190930192909252509392505050565b6020808252825182820181905260009190848201906040850190845b81811015615a505783516001600160e01b03191683529284019291840191600101615a2a565b50909695505050505050565b600080600080600060a08688031215615a7457600080fd5b8535615a7f81615881565b9450602086810135615a9081615881565b94506040870135615aa081615881565b935060608701359250608087013567ffffffffffffffff80821115615ac457600080fd5b818901915089601f830112615ad857600080fd5b813581811115615aea57615aea615932565b8060051b9150615afb848301615948565b818152918301840191848101908c841115615b1557600080fd5b938501935b83851015615b3357843582529385019390850190615b1a565b8096505050505050509295509295909350565b600080600060608486031215615b5b57600080fd5b8335615b6681615881565b92506020840135615b7681615881565b929592945050506040919091013590565b600080600060608486031215615b9c57600080fd5b8335615ba781615881565b9250602084013591506040840135615bbe81615881565b809150509250925092565b600181811c90821680615bdd57607f821691505b60208210810361160357634e487b7160e01b600052602260045260246000fd5b6001600160a01b0394851681529284166020840152921660408201526001600160e01b0319909116606082015260800190565b600060208284031215615c4257600080fd5b81518015158114610bdb57600080fd5b6020808252600e908201526d1b9bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60208082526012908201527148595045524e41544956455f4f5241434c4560701b604082015260600190565b600060208284031215615cb857600080fd5b8151610bdb81615881565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561081157610811615cdd565b634e487b7160e01b600052603260045260246000fd5b600060ff821680615d2f57615d2f615cdd565b6000190192915050565b6001600160a01b03858116825284166020808301919091526040820184905260806060830181905283519083018190526000918481019160a085019190845b81811015615d9457845184529382019392820192600101615d78565b50919998505050505050505050565b600060208284031215615db557600080fd5b5051919050565b8181038181111561081157610811615cdd565b634e487b7160e01b600052602160045260246000fd5b602080825260089082015267506f6f6c4c656e7360c01b604082015260600190565b60208082526014908201527324b7b734b1aab734ab19a634b8bab4b230ba37b960611b604082015260600190565b6020808252603e908201527f4865616c746820666163746f72206e6f74206c6f7720656e6f75676820666f7260408201527f206e6f6e2d7065726d697373696f6e6564206c69717569646174696f6e730000606082015260800190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039586168152938516602085015291841660408401529092166060820152608081019190915260a00190565b634e487b7160e01b600052601260045260246000fd5b600082615f0e57615f0e615ee9565b500490565b60008060408385031215615f2657600080fd5b505080516020909101519092909150565b60008251615f498184602087016158c2565b9190910192915050565b808202811582820484141761081157610811615cdd565b600082615f7957615f79615ee9565b50069056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122096273ff376dee875a984487ffefe362dd083ef93556fd381c04eb76a92e44bad64736f6c63430008160033", + "devdoc": { + "events": { + "Failure(uint256,uint256,uint256)": { + "details": "`error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.*" + } + }, + "kind": "dev", + "methods": { + "_getExtensionFunctions()": { + "returns": { + "functionSelectors": "a list of all the function selectors that this logic extension exposes" + } + }, + "_withdrawAdminFees(uint256)": { + "params": { + "withdrawAmount": "Amount of fees to withdraw" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "_withdrawIonicFees(uint256)": { + "params": { + "withdrawAmount": "Amount of fees to withdraw" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "borrow(uint256)": { + "params": { + "borrowAmount": "The amount of the underlying asset to borrow" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "claim(address,address,address,uint256,bytes32[])": { + "details": "Only callable by the governance.", + "params": { + "claimable": "The amount of tokens to claim and forward.", + "proof": "The proof required to validate the claim.", + "rewardToken": "The reward strategy for which the rewards are being claimed." + } + }, + "getCash()": { + "returns": { + "_0": "The quantity of underlying asset owned by this contract" + } + }, + "liquidateBorrow(address,uint256,address)": { + "params": { + "borrower": "The borrower of this cToken to be liquidated", + "cTokenCollateral": "The market in which to seize collateral from the borrower", + "repayAmount": "The amount of the underlying borrowed asset to repay" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "mint(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "mintAmount": "The amount of the underlying asset to supply" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "redeem(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "redeemTokens": "The number of cTokens to redeem into underlying" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "redeemUnderlying(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "redeemAmount": "The amount of underlying to redeem" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "repayBorrow(uint256)": { + "params": { + "repayAmount": "The amount to repay" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "repayBorrowBehalf(address,uint256)": { + "params": { + "borrower": "the account with the debt being payed off", + "repayAmount": "The amount to repay" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + }, + "seize(address,address,uint256)": { + "details": "Will fail unless called by another cToken during the process of liquidation. Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.", + "params": { + "borrower": "The account having collateral seized", + "liquidator": "The account receiving seized collateral", + "seizeTokens": "The number of cTokens to seize" + }, + "returns": { + "_0": "uint 0=success, otherwise a failure (see ErrorReporter.sol for details)" + } + } + }, + "version": 1 + }, + "userdoc": { + "events": { + "AccrueInterest(uint256,uint256,uint256,uint256)": { + "notice": "Event emitted when interest is accrued" + }, + "Approval(address,address,uint256)": { + "notice": "EIP20 Approval event" + }, + "Borrow(address,uint256,uint256,uint256)": { + "notice": "Event emitted when underlying is borrowed" + }, + "LiquidateBorrow(address,address,uint256,address,uint256)": { + "notice": "Event emitted when a borrow is liquidated" + }, + "Mint(address,uint256,uint256)": { + "notice": "Event emitted when tokens are minted" + }, + "NewAdminFee(uint256,uint256)": { + "notice": "Event emitted when the admin fee is changed" + }, + "NewIonicFee(uint256,uint256)": { + "notice": "Event emitted when the Ionic fee is changed" + }, + "NewMarketInterestRateModel(address,address)": { + "notice": "Event emitted when interestRateModel is changed" + }, + "NewReserveFactor(uint256,uint256)": { + "notice": "Event emitted when the reserve factor is changed" + }, + "Redeem(address,uint256,uint256)": { + "notice": "Event emitted when tokens are redeemed" + }, + "RepayBorrow(address,address,uint256,uint256,uint256)": { + "notice": "Event emitted when a borrow is repaid" + }, + "ReservesAdded(address,uint256,uint256)": { + "notice": "Event emitted when the reserves are added" + }, + "ReservesReduced(address,uint256,uint256)": { + "notice": "Event emitted when the reserves are reduced" + }, + "Transfer(address,address,uint256)": { + "notice": "EIP20 Transfer event" + } + }, + "kind": "user", + "methods": { + "_becomeImplementation(bytes)": { + "notice": "Called by the delegator on a delegate to initialize it for duty" + }, + "_withdrawAdminFees(uint256)": { + "notice": "Accrues interest and reduces admin fees by transferring to admin" + }, + "_withdrawIonicFees(uint256)": { + "notice": "Accrues interest and reduces Ionic fees by transferring to Ionic" + }, + "accrualBlockNumber()": { + "notice": "Block number that interest was last accrued at" + }, + "adminFeeMantissa()": { + "notice": "Fraction of interest currently set aside for admin fees" + }, + "ap()": { + "notice": "Addresses Provider" + }, + "borrow(uint256)": { + "notice": "Sender borrows assets from the protocol to their own address" + }, + "borrowIndex()": { + "notice": "Accumulator of the total earned interest rate since the opening of the market" + }, + "claim(address,address,address,uint256,bytes32[])": { + "notice": "Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract." + }, + "comptroller()": { + "notice": "Contract which oversees inter-cToken operations" + }, + "decimals()": { + "notice": "EIP-20 token decimals for this token" + }, + "getCash()": { + "notice": "Get cash balance of this cToken in the underlying asset" + }, + "interestRateModel()": { + "notice": "Model which tells what the current interest rate should be" + }, + "ionicFeeMantissa()": { + "notice": "Fraction of interest currently set aside for Ionic fees" + }, + "liquidateBorrow(address,uint256,address)": { + "notice": "The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator." + }, + "mint(uint256)": { + "notice": "Sender supplies assets into the market and receives cTokens in exchange" + }, + "name()": { + "notice": "EIP-20 token name for this token" + }, + "redeem(uint256)": { + "notice": "Sender redeems cTokens in exchange for the underlying asset" + }, + "redeemUnderlying(uint256)": { + "notice": "Sender redeems cTokens in exchange for a specified amount of underlying asset" + }, + "repayBorrow(uint256)": { + "notice": "Sender repays their own borrow" + }, + "repayBorrowBehalf(address,uint256)": { + "notice": "Sender repays a borrow belonging to borrower" + }, + "reserveFactorMantissa()": { + "notice": "Fraction of interest currently set aside for reserves" + }, + "seize(address,address,uint256)": { + "notice": "Transfers collateral tokens (this market) to the liquidator." + }, + "symbol()": { + "notice": "EIP-20 token symbol for this token" + }, + "totalAdminFees()": { + "notice": "Total amount of admin fees of the underlying held in this market" + }, + "totalBorrows()": { + "notice": "Total amount of outstanding borrows of the underlying in this market" + }, + "totalIonicFees()": { + "notice": "Total amount of Ionic fees of the underlying held in this market" + }, + "totalReserves()": { + "notice": "Total amount of reserves of the underlying held in this market" + }, + "totalSupply()": { + "notice": "Total number of tokens in circulation" + }, + "underlying()": { + "notice": "Underlying asset for this CToken" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 14350, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "ionicAdmin", + "offset": 0, + "slot": "0", + "type": "t_address_payable" + }, + { + "astId": 14356, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "_notEntered", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 14359, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "name", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 14362, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "symbol", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + }, + { + "astId": 14365, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "decimals", + "offset": 0, + "slot": "3", + "type": "t_uint8" + }, + { + "astId": 14375, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "comptroller", + "offset": 1, + "slot": "3", + "type": "t_contract(IonicComptroller)20272" + }, + { + "astId": 14379, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "interestRateModel", + "offset": 0, + "slot": "4", + "type": "t_contract(InterestRateModel)22608" + }, + { + "astId": 14381, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "initialExchangeRateMantissa", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 14384, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "adminFeeMantissa", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 14387, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "ionicFeeMantissa", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 14390, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "reserveFactorMantissa", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 14393, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "accrualBlockNumber", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 14396, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "borrowIndex", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 14399, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "totalBorrows", + "offset": 0, + "slot": "11", + "type": "t_uint256" + }, + { + "astId": 14402, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "totalReserves", + "offset": 0, + "slot": "12", + "type": "t_uint256" + }, + { + "astId": 14405, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "totalAdminFees", + "offset": 0, + "slot": "13", + "type": "t_uint256" + }, + { + "astId": 14408, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "totalIonicFees", + "offset": 0, + "slot": "14", + "type": "t_uint256" + }, + { + "astId": 14411, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "totalSupply", + "offset": 0, + "slot": "15", + "type": "t_uint256" + }, + { + "astId": 14415, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "accountTokens", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 14421, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "transferAllowances", + "offset": 0, + "slot": "17", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 14432, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "accountBorrows", + "offset": 0, + "slot": "18", + "type": "t_mapping(t_address,t_struct(BorrowSnapshot)14427_storage)" + }, + { + "astId": 14441, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "underlying", + "offset": 0, + "slot": "19", + "type": "t_address" + }, + { + "astId": 14445, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "ap", + "offset": 0, + "slot": "20", + "type": "t_contract(AddressesProvider)23693" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_address_payable": { + "encoding": "inplace", + "label": "address payable", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(AddressesProvider)23693": { + "encoding": "inplace", + "label": "contract AddressesProvider", + "numberOfBytes": "20" + }, + "t_contract(InterestRateModel)22608": { + "encoding": "inplace", + "label": "contract InterestRateModel", + "numberOfBytes": "20" + }, + "t_contract(IonicComptroller)20272": { + "encoding": "inplace", + "label": "contract IonicComptroller", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(BorrowSnapshot)14427_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct CErc20Storage.BorrowSnapshot)", + "numberOfBytes": "32", + "value": "t_struct(BorrowSnapshot)14427_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BorrowSnapshot)14427_storage": { + "encoding": "inplace", + "label": "struct CErc20Storage.BorrowSnapshot", + "members": [ + { + "astId": 14424, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "principal", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 14426, + "contract": "contracts/compound/CErc20RewardsDelegateMorpho.sol:CErc20RewardsDelegateMorpho", + "label": "interestIndex", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/CTokenFirstExtension.json b/packages/contracts/deployments/base/CTokenFirstExtension.json index 75d426afb8..b2379f9429 100644 --- a/packages/contracts/deployments/base/CTokenFirstExtension.json +++ b/packages/contracts/deployments/base/CTokenFirstExtension.json @@ -1521,4 +1521,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/contracts/deployments/base/Comptroller.json b/packages/contracts/deployments/base/Comptroller.json index 70f7dc557a..d94add822d 100644 --- a/packages/contracts/deployments/base/Comptroller.json +++ b/packages/contracts/deployments/base/Comptroller.json @@ -1,5 +1,5 @@ { - "address": "0xc63Ee58A68C22BFd7900ab5C3eB94D0f3d1442e9", + "address": "0x7E98caf24A84ae15Fb5De8C5f1C4D261c3Cf9833", "abi": [ { "anonymous": false, @@ -1638,28 +1638,28 @@ "type": "function" } ], - "transactionHash": "0x663ae556d3ade0f38f7049844b031aca466fbd5c05c0c414bfeed8706edc1250", + "transactionHash": "0x0c5d812fc629b7261da3187ad487e9e5f6af68f5d7a1af2bbcda227f2e09dccb", "receipt": { "to": null, "from": "0x1155b614971f16758C92c4890eD338C9e3ede6b7", - "contractAddress": "0xc63Ee58A68C22BFd7900ab5C3eB94D0f3d1442e9", - "transactionIndex": 161, + "contractAddress": "0x7E98caf24A84ae15Fb5De8C5f1C4D261c3Cf9833", + "transactionIndex": 171, "gasUsed": "5275020", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xfaf9463f083ffc0b6c2c951efd3f3e7a290e81178f0a998134f3bfcd479f5cf8", - "transactionHash": "0x663ae556d3ade0f38f7049844b031aca466fbd5c05c0c414bfeed8706edc1250", + "blockHash": "0xf47e28e67143ef4264d46b6119dab016e2a396ec6451032715e35930e70815fd", + "transactionHash": "0x0c5d812fc629b7261da3187ad487e9e5f6af68f5d7a1af2bbcda227f2e09dccb", "logs": [], - "blockNumber": 26677901, - "cumulativeGasUsed": "41331159", + "blockNumber": 29834081, + "cumulativeGasUsed": "62474938", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 4, - "solcInputHash": "fe43f5a289121fe7e668332909112399", - "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardsDistributor\",\"type\":\"address\"}],\"name\":\"AddedRewardsDistributor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"MarketEntered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"MarketExited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"MarketListed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldCloseFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newCloseFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewCloseFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldCollateralFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newCollateralFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewCollateralFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldLiquidationIncentiveMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newLiquidationIncentiveMantissa\",\"type\":\"uint256\"}],\"name\":\"NewLiquidationIncentive\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract BasePriceOracle\",\"name\":\"oldPriceOracle\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract BasePriceOracle\",\"name\":\"newPriceOracle\",\"type\":\"address\"}],\"name\":\"NewPriceOracle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enforce\",\"type\":\"bool\"}],\"name\":\"WhitelistEnforcementChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"distributor\",\"type\":\"address\"}],\"name\":\"_addRewardsDistributor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_afterNonReentrant\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_becomeImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_beforeNonReentrant\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"delegateType\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"constructorData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"becomeImplData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_deployMarket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newCloseFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_setCloseFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newCollateralFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_setCollateralFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newLiquidationIncentiveMantissa\",\"type\":\"uint256\"}],\"name\":\"_setLiquidationIncentive\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"newOracle\",\"type\":\"address\"}],\"name\":\"_setPriceOracle\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enforce\",\"type\":\"bool\"}],\"name\":\"_setWhitelistEnforcement\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"suppliers\",\"type\":\"address[]\"},{\"internalType\":\"bool[]\",\"name\":\"statuses\",\"type\":\"bool[]\"}],\"name\":\"_setWhitelistStatuses\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"accountAssets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allBorrowers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"}],\"name\":\"borrowAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCapForCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowCapGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"borrowVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"accountBorrowsNew\",\"type\":\"uint256\"}],\"name\":\"borrowWithinLimits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowingAgainstCollateralBlacklist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"cTokensByUnderlying\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"checkMembership\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"closeFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveBorrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveSupplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplyCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforceWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"cTokens\",\"type\":\"address[]\"}],\"name\":\"enterMarkets\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenAddress\",\"type\":\"address\"}],\"name\":\"exitMarket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAssetsIn\",\"outputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenModify\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"getHypotheticalAccountLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"contract ICErc20\",\"name\":\"cTokenModify\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isBorrow\",\"type\":\"bool\"}],\"name\":\"getMaxRedeemOrBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isComptroller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"liquidateBorrowAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"actualRepayAmount\",\"type\":\"uint256\"}],\"name\":\"liquidateCalculateSeizeTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationIncentiveMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"markets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isListed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mintAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"actualMintAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"}],\"name\":\"mintVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nonAccruingRewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeemAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeemVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seizeAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seizeGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seizeVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"suppliers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"src\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"transferTokens\",\"type\":\"uint256\"}],\"name\":\"transferAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transferGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"src\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"transferTokens\",\"type\":\"uint256\"}],\"name\":\"transferVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistArray\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Compound\",\"details\":\"This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\",\"events\":{\"Failure(uint256,uint256,uint256)\":{\"details\":\"`error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.*\"}},\"kind\":\"dev\",\"methods\":{\"_addRewardsDistributor(address)\":{\"details\":\"Admin function to add a RewardsDistributor contract\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_afterNonReentrant()\":{\"details\":\"Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention. Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\"},\"_beforeNonReentrant()\":{\"details\":\"Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention. Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\"},\"_deployMarket(uint8,bytes,bytes,uint256)\":{\"details\":\"Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See enum Error for details)\"}},\"_getExtensionFunctions()\":{\"returns\":{\"functionSelectors\":\"a list of all the function selectors that this logic extension exposes\"}},\"_setCloseFactor(uint256)\":{\"details\":\"Admin function to set closeFactor\",\"params\":{\"newCloseFactorMantissa\":\"New close factor, scaled by 1e18\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See ErrorReporter for details)\"}},\"_setCollateralFactor(address,uint256)\":{\"details\":\"Admin function to set per-market collateralFactor\",\"params\":{\"cToken\":\"The market to set the factor on\",\"newCollateralFactorMantissa\":\"The new collateral factor, scaled by 1e18\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See ErrorReporter for details)\"}},\"_setLiquidationIncentive(uint256)\":{\"details\":\"Admin function to set liquidationIncentive\",\"params\":{\"newLiquidationIncentiveMantissa\":\"New liquidationIncentive scaled by 1e18\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See ErrorReporter for details)\"}},\"_setPriceOracle(address)\":{\"details\":\"Admin function to set a new price oracle\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_setWhitelistEnforcement(bool)\":{\"details\":\"Admin function to set a new whitelist enforcement boolean\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_setWhitelistStatuses(address[],bool[])\":{\"details\":\"Admin function to set the whitelist `statuses` for `suppliers`\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"borrowAllowed(address,address,uint256)\":{\"params\":{\"borrowAmount\":\"The amount of underlying the account would borrow\",\"borrower\":\"The account which would borrow the asset\",\"cToken\":\"The market to verify the borrow against\"},\"returns\":{\"_0\":\"0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"borrowVerify(address,address)\":{\"params\":{\"borrower\":\"The account which borrowed the asset\",\"cToken\":\"The market to verify the borrow against\"}},\"borrowWithinLimits(address,uint256)\":{\"params\":{\"accountBorrowsNew\":\"The user's new borrow balance of the underlying asset\",\"cToken\":\"Asset whose underlying is being borrowed\"}},\"checkMembership(address,address)\":{\"params\":{\"account\":\"The address of the account to check\",\"cToken\":\"The cToken to check\"},\"returns\":{\"_0\":\"True if the account is in the asset, otherwise false.\"}},\"effectiveBorrowCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"effectiveSupplyCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"enterMarkets(address[])\":{\"params\":{\"cTokens\":\"The list of addresses of the cToken markets to be enabled\"},\"returns\":{\"_0\":\"Success indicator for whether each corresponding market was entered\"}},\"exitMarket(address)\":{\"details\":\"Sender must not have an outstanding borrow balance in the asset, or be providing necessary collateral for an outstanding borrow.\",\"params\":{\"cTokenAddress\":\"The address of the asset to be removed\"},\"returns\":{\"_0\":\"Whether or not the account successfully exited the market\"}},\"getAssetsIn(address)\":{\"params\":{\"account\":\"The address of the account to pull assets for\"},\"returns\":{\"_0\":\"A dynamic list with the assets the account has entered\"}},\"getHypotheticalAccountLiquidity(address,address,uint256,uint256,uint256)\":{\"params\":{\"account\":\"The account to determine liquidity for\",\"borrowAmount\":\"The amount of underlying to hypothetically borrow\",\"cTokenModify\":\"The market to hypothetically redeem/borrow in\",\"redeemTokens\":\"The number of tokens to hypothetically redeem\"},\"returns\":{\"_0\":\"(possible error code (semi-opaque), hypothetical account liquidity in excess of collateral requirements, hypothetical account shortfall below collateral requirements)\"}},\"isDeprecated(address)\":{\"details\":\"All borrows in a deprecated cToken market can be immediately liquidated\",\"params\":{\"cToken\":\"The market to check if deprecated\"}},\"liquidateBorrowAllowed(address,address,address,address,uint256)\":{\"params\":{\"borrower\":\"The address of the borrower\",\"cTokenBorrowed\":\"Asset which was borrowed by the borrower\",\"cTokenCollateral\":\"Asset which was used as collateral and will be seized\",\"liquidator\":\"The address repaying the borrow and seizing the collateral\",\"repayAmount\":\"The amount of underlying being repaid\"}},\"liquidateCalculateSeizeTokens(address,address,uint256)\":{\"details\":\"Used in liquidation (called in cToken.liquidateBorrowFresh)\",\"params\":{\"actualRepayAmount\":\"The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\",\"cTokenBorrowed\":\"The address of the borrowed cToken\",\"cTokenCollateral\":\"The address of the collateral cToken\"},\"returns\":{\"_0\":\"(errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\"}},\"mintAllowed(address,address,uint256)\":{\"params\":{\"cTokenAddress\":\"The market to verify the mint against\",\"mintAmount\":\"The amount of underlying being supplied to the market in exchange for tokens\",\"minter\":\"The account which would get the minted tokens\"},\"returns\":{\"_0\":\"0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"mintVerify(address,address,uint256,uint256)\":{\"params\":{\"actualMintAmount\":\"The amount of the underlying asset being minted\",\"cToken\":\"Asset being minted\",\"mintTokens\":\"The number of tokens being minted\",\"minter\":\"The address minting the tokens\"}},\"redeemAllowed(address,address,uint256)\":{\"params\":{\"cToken\":\"The market to verify the redeem against\",\"redeemTokens\":\"The number of cTokens to exchange for the underlying asset in the market\",\"redeemer\":\"The account which would redeem the tokens\"},\"returns\":{\"_0\":\"0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"redeemVerify(address,address,uint256,uint256)\":{\"params\":{\"cToken\":\"Asset being redeemed\",\"redeemAmount\":\"The amount of the underlying asset being redeemed\",\"redeemTokens\":\"The number of tokens being redeemed\",\"redeemer\":\"The address redeeming the tokens\"}},\"repayBorrowAllowed(address,address,address,uint256)\":{\"params\":{\"borrower\":\"The account which would borrowed the asset\",\"cToken\":\"The market to verify the repay against\",\"payer\":\"The account which would repay the asset\",\"repayAmount\":\"The amount of the underlying asset the account would repay\"},\"returns\":{\"_0\":\"0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"repayBorrowVerify(address,address,address,uint256)\":{\"params\":{\"borrower\":\"The account which borrowed the asset\",\"cToken\":\"The market to verify the repay against\",\"payer\":\"The account which repayed the asset\",\"repayAmount\":\"The amount of the underlying asset the account repayed\"}},\"seizeAllowed(address,address,address,address,uint256)\":{\"params\":{\"borrower\":\"The address of the borrower\",\"cTokenBorrowed\":\"Asset which was borrowed by the borrower\",\"cTokenCollateral\":\"Asset which was used as collateral and will be seized\",\"liquidator\":\"The address repaying the borrow and seizing the collateral\",\"seizeTokens\":\"The number of collateral tokens to seize\"}},\"seizeVerify(address,address,address,address,uint256)\":{\"params\":{\"borrower\":\"The address of the borrower\",\"cTokenBorrowed\":\"Asset which was borrowed by the borrower\",\"cTokenCollateral\":\"Asset which was used as collateral and will be seized\",\"liquidator\":\"The address repaying the borrow and seizing the collateral\",\"seizeTokens\":\"The number of collateral tokens to seize\"}},\"transferAllowed(address,address,address,uint256)\":{\"params\":{\"cToken\":\"The market to verify the transfer against\",\"dst\":\"The account which receives the tokens\",\"src\":\"The account which sources the tokens\",\"transferTokens\":\"The number of cTokens to transfer\"},\"returns\":{\"_0\":\"0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"transferVerify(address,address,address,uint256)\":{\"params\":{\"cToken\":\"The market to verify the transfer against\",\"dst\":\"The account which receives the tokens\",\"src\":\"The account which sources the tokens\",\"transferTokens\":\"The number of cTokens to transfer\"}}},\"title\":\"Compound's Comptroller Contract\",\"version\":1},\"userdoc\":{\"events\":{\"AddedRewardsDistributor(address)\":{\"notice\":\"Emitted when a new RewardsDistributor contract is added to hooks\"},\"MarketEntered(address,address)\":{\"notice\":\"Emitted when an account enters a market\"},\"MarketExited(address,address)\":{\"notice\":\"Emitted when an account exits a market\"},\"MarketListed(address)\":{\"notice\":\"Emitted when an admin supports a market\"},\"NewCloseFactor(uint256,uint256)\":{\"notice\":\"Emitted when close factor is changed by admin\"},\"NewCollateralFactor(address,uint256,uint256)\":{\"notice\":\"Emitted when a collateral factor is changed by admin\"},\"NewLiquidationIncentive(uint256,uint256)\":{\"notice\":\"Emitted when liquidation incentive is changed by admin\"},\"NewPriceOracle(address,address)\":{\"notice\":\"Emitted when price oracle is changed\"},\"WhitelistEnforcementChanged(bool)\":{\"notice\":\"Emitted when the whitelist enforcement is changed\"}},\"kind\":\"user\",\"methods\":{\"_addRewardsDistributor(address)\":{\"notice\":\"Add a RewardsDistributor contracts.\"},\"_deployMarket(uint8,bytes,bytes,uint256)\":{\"notice\":\"Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\"},\"_setCloseFactor(uint256)\":{\"notice\":\"Sets the closeFactor used when liquidating borrows\"},\"_setCollateralFactor(address,uint256)\":{\"notice\":\"Sets the collateralFactor for a market\"},\"_setLiquidationIncentive(uint256)\":{\"notice\":\"Sets liquidationIncentive\"},\"_setPriceOracle(address)\":{\"notice\":\"Sets a new price oracle for the comptroller\"},\"_setWhitelistEnforcement(bool)\":{\"notice\":\"Sets the whitelist enforcement for the comptroller\"},\"_setWhitelistStatuses(address[],bool[])\":{\"notice\":\"Sets the whitelist `statuses` for `suppliers`\"},\"accountAssets(address,uint256)\":{\"notice\":\"Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\"},\"admin()\":{\"notice\":\"Administrator for this contract\"},\"adminHasRights()\":{\"notice\":\"Whether or not the admin has admin rights\"},\"allBorrowers(uint256)\":{\"notice\":\"A list of all borrowers who have entered markets\"},\"allMarkets(uint256)\":{\"notice\":\"A list of all markets\"},\"borrowAllowed(address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to borrow the underlying asset of the given market\"},\"borrowCapGuardian()\":{\"notice\":\"The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\"},\"borrowCaps(address)\":{\"notice\":\"Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\"},\"borrowVerify(address,address)\":{\"notice\":\"Validates borrow the underlying asset of the given market\"},\"borrowWithinLimits(address,uint256)\":{\"notice\":\"Checks if the account should be allowed to borrow the underlying asset of the given market\"},\"cTokensByUnderlying(address)\":{\"notice\":\"All cTokens addresses mapped by their underlying token addresses\"},\"checkMembership(address,address)\":{\"notice\":\"Returns whether the given account is entered in the given asset\"},\"closeFactorMantissa()\":{\"notice\":\"Multiplier used to calculate the maximum repayAmount when liquidating a borrow\"},\"effectiveBorrowCaps(address)\":{\"notice\":\"Gets the borrow cap of a cToken in the units of the underlying asset.\"},\"effectiveSupplyCaps(address)\":{\"notice\":\"Gets the supply cap of a cToken in the units of the underlying asset.\"},\"enforceWhitelist()\":{\"notice\":\"Whether or not the supplier whitelist is enforced\"},\"enterMarkets(address[])\":{\"notice\":\"Add assets to be included in account liquidity calculation\"},\"exitMarket(address)\":{\"notice\":\"Removes asset from sender's account liquidity calculation\"},\"getAssetsIn(address)\":{\"notice\":\"Returns the assets an account has entered\"},\"getHypotheticalAccountLiquidity(address,address,uint256,uint256,uint256)\":{\"notice\":\"Determine what the account liquidity would be if the given amounts were redeemed/borrowed\"},\"ionicAdminHasRights()\":{\"notice\":\"Whether or not the Ionic admin has admin rights\"},\"isComptroller()\":{\"notice\":\"Indicator that this is a Comptroller contract (for inspection)\"},\"isDeprecated(address)\":{\"notice\":\"Returns true if the given cToken market has been deprecated\"},\"liquidateBorrowAllowed(address,address,address,address,uint256)\":{\"notice\":\"Checks if the liquidation should be allowed to occur\"},\"liquidateCalculateSeizeTokens(address,address,uint256)\":{\"notice\":\"Calculate number of tokens of collateral asset to seize given an underlying amount\"},\"liquidationIncentiveMantissa()\":{\"notice\":\"Multiplier representing the discount on collateral that a liquidator receives\"},\"markets(address)\":{\"notice\":\"Official mapping of cTokens -> Market metadata\"},\"mintAllowed(address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to mint tokens in the given market\"},\"mintVerify(address,address,uint256,uint256)\":{\"notice\":\"Validates mint and reverts on rejection. May emit logs.\"},\"nonAccruingRewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor to list for claiming, but not to notify of flywheel changes.\"},\"oracle()\":{\"notice\":\"Oracle which gives the price of any given asset\"},\"pauseGuardian()\":{\"notice\":\"The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing / transfer can only be paused globally, not by market.\"},\"pendingAdmin()\":{\"notice\":\"Pending administrator for this contract\"},\"redeemAllowed(address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to redeem tokens in the given market\"},\"redeemVerify(address,address,uint256,uint256)\":{\"notice\":\"Validates redeem and reverts on rejection. May emit logs.\"},\"repayBorrowAllowed(address,address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to repay a borrow in the given market\"},\"repayBorrowVerify(address,address,address,uint256)\":{\"notice\":\"Validates that blacklisted balances are updated after borrow repayment\"},\"rewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor contracts to notify of flywheel changes.\"},\"seizeAllowed(address,address,address,address,uint256)\":{\"notice\":\"Checks if the seizing of assets should be allowed to occur\"},\"seizeVerify(address,address,address,address,uint256)\":{\"notice\":\"Validates that blacklisted balances are updated after seizing of assets\"},\"supplyCaps(address)\":{\"notice\":\"Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\"},\"transferAllowed(address,address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to transfer tokens in the given market\"},\"transferVerify(address,address,address,uint256)\":{\"notice\":\"Validates that blacklisted balances are updated after transfering assets\"},\"whitelist(address)\":{\"notice\":\"Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\"},\"whitelistArray(uint256)\":{\"notice\":\"An array of all whitelisted accounts\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/Comptroller.sol\":\"Comptroller\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(\\n address src,\\n address dst,\\n uint256 amount\\n ) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256\\n );\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral\\n ) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x7cc75051a5fa860b9ee93d0ba1ac0608921f02308aeff786ce8bbd8d8a70489a\",\"license\":\"UNLICENSED\"},\"contracts/compound/CarefulMath.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Careful Math\\n * @author Compound\\n * @notice Derived from OpenZeppelin's SafeMath library\\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\\n */\\ncontract CarefulMath {\\n /**\\n * @dev Possible error codes that we can return\\n */\\n enum MathError {\\n NO_ERROR,\\n DIVISION_BY_ZERO,\\n INTEGER_OVERFLOW,\\n INTEGER_UNDERFLOW\\n }\\n\\n /**\\n * @dev Multiplies two numbers, returns an error on overflow.\\n */\\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n if (a == 0) {\\n return (MathError.NO_ERROR, 0);\\n }\\n\\n uint256 c;\\n unchecked {\\n c = a * b;\\n }\\n\\n if (c / a != b) {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n } else {\\n return (MathError.NO_ERROR, c);\\n }\\n }\\n\\n /**\\n * @dev Integer division of two numbers, truncating the quotient.\\n */\\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n if (b == 0) {\\n return (MathError.DIVISION_BY_ZERO, 0);\\n }\\n\\n return (MathError.NO_ERROR, a / b);\\n }\\n\\n /**\\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\\n */\\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n if (b <= a) {\\n return (MathError.NO_ERROR, a - b);\\n } else {\\n return (MathError.INTEGER_UNDERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev Adds two numbers, returns an error on overflow.\\n */\\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n uint256 c;\\n unchecked {\\n c = a + b;\\n }\\n\\n if (c >= a) {\\n return (MathError.NO_ERROR, c);\\n } else {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev add a and b and then subtract c\\n */\\n function addThenSubUInt(\\n uint256 a,\\n uint256 b,\\n uint256 c\\n ) internal pure returns (MathError, uint256) {\\n (MathError err0, uint256 sum) = addUInt(a, b);\\n\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, 0);\\n }\\n\\n return subUInt(sum, c);\\n }\\n}\\n\",\"keccak256\":\"0x7425598d767521ba25277a7f95273c4705721aef0d7f2cd855cb6a61de709a7c\",\"license\":\"UNLICENSED\"},\"contracts/compound/Comptroller.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { ComptrollerErrorReporter } from \\\"./ErrorReporter.sol\\\";\\nimport { Exponential } from \\\"./Exponential.sol\\\";\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { Unitroller } from \\\"./Unitroller.sol\\\";\\nimport { IFeeDistributor } from \\\"./IFeeDistributor.sol\\\";\\nimport { IIonicFlywheel } from \\\"../ionic/strategies/flywheel/IIonicFlywheel.sol\\\";\\nimport { DiamondExtension, DiamondBase, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \\\"./ComptrollerInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @title Compound's Comptroller Contract\\n * @author Compound\\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\\n */\\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice Emitted when an admin supports a market\\n event MarketListed(ICErc20 cToken);\\n\\n /// @notice Emitted when an account enters a market\\n event MarketEntered(ICErc20 cToken, address account);\\n\\n /// @notice Emitted when an account exits a market\\n event MarketExited(ICErc20 cToken, address account);\\n\\n /// @notice Emitted when close factor is changed by admin\\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\\n\\n /// @notice Emitted when a collateral factor is changed by admin\\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\\n\\n /// @notice Emitted when liquidation incentive is changed by admin\\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\\n\\n /// @notice Emitted when price oracle is changed\\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\\n\\n /// @notice Emitted when the whitelist enforcement is changed\\n event WhitelistEnforcementChanged(bool enforce);\\n\\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\\n event AddedRewardsDistributor(address rewardsDistributor);\\n\\n // closeFactorMantissa must be strictly greater than this value\\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\\n\\n // closeFactorMantissa must not exceed this value\\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\\n\\n // No collateralFactorMantissa may exceed this value\\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\\n\\n // liquidationIncentiveMantissa must be no less than this value\\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\\n\\n // liquidationIncentiveMantissa must be no greater than this value\\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\\n\\n modifier isAuthorized() {\\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \\\"not authorized\\\");\\n _;\\n }\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(\\n address cToken\\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\\n return ComptrollerBase.effectiveSupplyCaps(cToken);\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(\\n address cToken\\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\\n return ComptrollerBase.effectiveBorrowCaps(cToken);\\n }\\n\\n /*** Assets You Are In ***/\\n\\n /**\\n * @notice Returns the assets an account has entered\\n * @param account The address of the account to pull assets for\\n * @return A dynamic list with the assets the account has entered\\n */\\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\\n ICErc20[] memory assetsIn = accountAssets[account];\\n\\n return assetsIn;\\n }\\n\\n /**\\n * @notice Returns whether the given account is entered in the given asset\\n * @param account The address of the account to check\\n * @param cToken The cToken to check\\n * @return True if the account is in the asset, otherwise false.\\n */\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\\n return markets[address(cToken)].accountMembership[account];\\n }\\n\\n /**\\n * @notice Add assets to be included in account liquidity calculation\\n * @param cTokens The list of addresses of the cToken markets to be enabled\\n * @return Success indicator for whether each corresponding market was entered\\n */\\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\\n uint256 len = cTokens.length;\\n\\n uint256[] memory results = new uint256[](len);\\n for (uint256 i = 0; i < len; i++) {\\n ICErc20 cToken = ICErc20(cTokens[i]);\\n\\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\\n }\\n\\n return results;\\n }\\n\\n /**\\n * @notice Add the market to the borrower's \\\"assets in\\\" for liquidity calculations\\n * @param cToken The market to enter\\n * @param borrower The address of the account to modify\\n * @return Success indicator for whether the market was entered\\n */\\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\\n Market storage marketToJoin = markets[address(cToken)];\\n\\n if (!marketToJoin.isListed) {\\n // market is not listed, cannot join\\n return Error.MARKET_NOT_LISTED;\\n }\\n\\n if (marketToJoin.accountMembership[borrower] == true) {\\n // already joined\\n return Error.NO_ERROR;\\n }\\n\\n // survived the gauntlet, add to list\\n // NOTE: we store these somewhat redundantly as a significant optimization\\n // this avoids having to iterate through the list for the most common use cases\\n // that is, only when we need to perform liquidity checks\\n // and not whenever we want to check if an account is in a particular market\\n marketToJoin.accountMembership[borrower] = true;\\n accountAssets[borrower].push(cToken);\\n\\n // Add to allBorrowers\\n if (!borrowers[borrower]) {\\n allBorrowers.push(borrower);\\n borrowers[borrower] = true;\\n borrowerIndexes[borrower] = allBorrowers.length - 1;\\n }\\n\\n emit MarketEntered(cToken, borrower);\\n\\n return Error.NO_ERROR;\\n }\\n\\n /**\\n * @notice Removes asset from sender's account liquidity calculation\\n * @dev Sender must not have an outstanding borrow balance in the asset,\\n * or be providing necessary collateral for an outstanding borrow.\\n * @param cTokenAddress The address of the asset to be removed\\n * @return Whether or not the account successfully exited the market\\n */\\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\\n // TODO\\n require(markets[cTokenAddress].isListed, \\\"!Comptroller:exitMarket\\\");\\n\\n ICErc20 cToken = ICErc20(cTokenAddress);\\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\\n require(oErr == 0, \\\"!exitMarket\\\"); // semi-opaque error code\\n\\n /* Fail if the sender has a borrow balance */\\n if (amountOwed != 0) {\\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\\n }\\n\\n /* Fail if the sender is not permitted to redeem all of their tokens */\\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\\n if (allowed != 0) {\\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\\n }\\n\\n Market storage marketToExit = markets[cTokenAddress];\\n\\n /* Return true if the sender is not already \\u2018in\\u2019 the market */\\n if (!marketToExit.accountMembership[msg.sender]) {\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /* Set cToken account membership to false */\\n delete marketToExit.accountMembership[msg.sender];\\n\\n /* Delete cToken from the account\\u2019s list of assets */\\n // load into memory for faster iteration\\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\\n uint256 len = userAssetList.length;\\n uint256 assetIndex = len;\\n for (uint256 i = 0; i < len; i++) {\\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\\n assetIndex = i;\\n break;\\n }\\n }\\n\\n // We *must* have found the asset in the list or our redundant data structure is broken\\n assert(assetIndex < len);\\n\\n // copy last item in list to location of item to be removed, reduce length by 1\\n ICErc20[] storage storedList = accountAssets[msg.sender];\\n storedList[assetIndex] = storedList[storedList.length - 1];\\n storedList.pop();\\n\\n // If the user has exited all markets, remove them from the `allBorrowers` array\\n if (storedList.length == 0) {\\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\\n allBorrowers.pop(); // Reduce length by 1\\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\\n }\\n\\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /*** Policy Hooks ***/\\n\\n /**\\n * @notice Checks if the account should be allowed to mint tokens in the given market\\n * @param cTokenAddress The market to verify the mint against\\n * @param minter The account which would get the minted tokens\\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!mintGuardianPaused[cTokenAddress], \\\"!mint:paused\\\");\\n\\n // Make sure market is listed\\n if (!markets[cTokenAddress].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Make sure minter is whitelisted\\n if (enforceWhitelist && !whitelist[minter]) {\\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\\n }\\n\\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\\n\\n // Supply cap of 0 corresponds to unlimited supplying\\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\\n uint256 nonWhitelistedTotalSupply;\\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\\n\\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \\\"!supply cap\\\");\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreSupplierAction(cTokenAddress, minter);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to redeem tokens in the given market\\n * @param cToken The market to verify the redeem against\\n * @param redeemer The account which would redeem the tokens\\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\\n if (allowed != uint256(Error.NO_ERROR)) {\\n return allowed;\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreSupplierAction(cToken, redeemer);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function redeemAllowedInternal(\\n address cToken,\\n address redeemer,\\n uint256 redeemTokens\\n ) internal view returns (uint256) {\\n if (!markets[cToken].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\\n if (!markets[cToken].accountMembership[redeemer]) {\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\n redeemer,\\n ICErc20(cToken),\\n redeemTokens,\\n 0,\\n 0\\n );\\n if (err != Error.NO_ERROR) {\\n return uint256(err);\\n }\\n if (shortfall > 0) {\\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates mint and reverts on rejection. May emit logs.\\n * @param cToken Asset being minted\\n * @param minter The address minting the tokens\\n * @param actualMintAmount The amount of the underlying asset being minted\\n * @param mintTokens The number of tokens being minted\\n */\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\\n // Add minter to suppliers mapping\\n suppliers[minter] = true;\\n\\n // Keep the flywheel moving\\n flywheelPostSupplierAction(cToken, minter);\\n }\\n\\n /**\\n * @notice Validates redeem and reverts on rejection. May emit logs.\\n * @param cToken Asset being redeemed\\n * @param redeemer The address redeeming the tokens\\n * @param redeemAmount The amount of the underlying asset being redeemed\\n * @param redeemTokens The number of tokens being redeemed\\n */\\n function redeemVerify(\\n address cToken,\\n address redeemer,\\n uint256 redeemAmount,\\n uint256 redeemTokens\\n ) external override {\\n require(markets[msg.sender].isListed, \\\"!market\\\");\\n\\n // Require tokens is zero or amount is also zero\\n if (redeemTokens == 0 && redeemAmount > 0) {\\n revert(\\\"!zero\\\");\\n }\\n\\n // Keep the flywheel moving\\n flywheelPostSupplierAction(cToken, redeemer);\\n }\\n\\n function getMaxRedeemOrBorrow(\\n address account,\\n ICErc20 cTokenModify,\\n bool isBorrow\\n ) external view override returns (uint256) {\\n address cToken = address(cTokenModify);\\n // Accrue interest\\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\\n\\n // Get account liquidity\\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\n account,\\n isBorrow ? cTokenModify : ICErc20(address(0)),\\n 0,\\n 0,\\n 0\\n );\\n require(err == Error.NO_ERROR, \\\"!liquidity\\\");\\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\\n\\n // Get max borrow/redeem\\n uint256 maxBorrowOrRedeemAmount;\\n\\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\\n // Max redeem = balance of underlying if not used as collateral\\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\\n } else {\\n // Avoid \\\"stack too deep\\\" error by separating this logic\\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\\n\\n // Redeem only: max out at underlying balance\\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\\n }\\n\\n // Get max borrow or redeem considering cToken liquidity\\n uint256 cTokenLiquidity = cTokenModify.getCash();\\n\\n // Return the minimum of the two maximums\\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\\n }\\n\\n /**\\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \\\"stack too deep\\\" errors.\\n */\\n function _getMaxRedeemOrBorrow(\\n uint256 liquidity,\\n ICErc20 cTokenModify,\\n bool isBorrow\\n ) internal view returns (uint256) {\\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\\n\\n // Get the normalized price of the asset\\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\\n require(conversionFactor > 0, \\\"!oracle\\\");\\n\\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\\n if (!isBorrow) {\\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\\n }\\n\\n // Get max borrow or redeem considering excess account liquidity\\n return (liquidity * 1e18) / conversionFactor;\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\\n * @param cToken The market to verify the borrow against\\n * @param borrower The account which would borrow the asset\\n * @param borrowAmount The amount of underlying the account would borrow\\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!borrowGuardianPaused[cToken], \\\"!borrow:paused\\\");\\n\\n // Make sure market is listed\\n if (!markets[cToken].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n if (!markets[cToken].accountMembership[borrower]) {\\n // only cTokens may call borrowAllowed if borrower not in market\\n require(msg.sender == cToken, \\\"!ctoken\\\");\\n\\n // attempt to add borrower to the market\\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\\n if (err != Error.NO_ERROR) {\\n return uint256(err);\\n }\\n\\n // it should be impossible to break the important invariant\\n assert(markets[cToken].accountMembership[borrower]);\\n }\\n\\n // Make sure oracle price is available\\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\\n return uint256(Error.PRICE_ERROR);\\n }\\n\\n // Make sure borrower is whitelisted\\n if (enforceWhitelist && !whitelist[borrower]) {\\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\\n }\\n\\n uint256 borrowCap = effectiveBorrowCaps(cToken);\\n\\n // Borrow cap of 0 corresponds to unlimited borrowing\\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\\n uint256 nonWhitelistedTotalBorrows;\\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\\n\\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \\\"!borrow:cap\\\");\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreBorrowerAction(cToken, borrower);\\n\\n // Perform a hypothetical liquidity check to guard against shortfall\\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\\n if (err != uint256(Error.NO_ERROR)) {\\n return err;\\n }\\n if (shortfall > 0) {\\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates borrow the underlying asset of the given market\\n * @param cToken The market to verify the borrow against\\n * @param borrower The account which borrowed the asset\\n */\\n function borrowVerify(address cToken, address borrower) external override {\\n // Keep the flywheel moving\\n flywheelPostBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\\n * @param cToken Asset whose underlying is being borrowed\\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\\n */\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\\n // Check if min borrow exists\\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\\n\\n if (minBorrowEth > 0) {\\n // Get new underlying borrow balance of account for this cToken\\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\\n Exp({ mantissa: oraclePriceMantissa }),\\n accountBorrowsNew\\n );\\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\\n\\n // Check against min borrow\\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\\n }\\n\\n // Return no error\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to repay a borrow in the given market\\n * @param cToken The market to verify the repay against\\n * @param payer The account which would repay the asset\\n * @param borrower The account which would borrowed the asset\\n * @param repayAmount The amount of the underlying asset the account would repay\\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external override returns (uint256) {\\n // Make sure market is listed\\n if (!markets[cToken].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreBorrowerAction(cToken, borrower);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates that blacklisted balances are updated after borrow repayment\\n * @param cToken The market to verify the repay against\\n * @param payer The account which repayed the asset\\n * @param borrower The account which borrowed the asset\\n * @param repayAmount The amount of the underlying asset the account repayed\\n */\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external override {\\n // Keep the flywheel moving\\n flywheelPostBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Checks if the liquidation should be allowed to occur\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\n * @param liquidator The address repaying the borrow and seizing the collateral\\n * @param borrower The address of the borrower\\n * @param repayAmount The amount of underlying being repaid\\n */\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external override returns (uint256) {\\n // Make sure markets are listed\\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Get borrowers' underlying borrow balance\\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\\n\\n /* allow accounts to be liquidated if the market is deprecated */\\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\\n require(borrowBalance >= repayAmount, \\\"!borrow>repay\\\");\\n } else {\\n /* The borrower must have shortfall in order to be liquidateable */\\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\n borrower,\\n ICErc20(address(0)),\\n 0,\\n 0,\\n 0\\n );\\n if (err != Error.NO_ERROR) {\\n return uint256(err);\\n }\\n\\n if (shortfall == 0) {\\n return uint256(Error.INSUFFICIENT_SHORTFALL);\\n }\\n\\n /* The liquidator may not repay more than what is allowed by the closeFactor */\\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\\n if (repayAmount > maxClose) {\\n return uint256(Error.TOO_MUCH_REPAY);\\n }\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Checks if the seizing of assets should be allowed to occur\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\n * @param liquidator The address repaying the borrow and seizing the collateral\\n * @param borrower The address of the borrower\\n * @param seizeTokens The number of collateral tokens to seize\\n */\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!seizeGuardianPaused, \\\"!seize:paused\\\");\\n\\n // Make sure markets are listed\\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Make sure cToken Comptrollers are identical\\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\\n return uint256(Error.COMPTROLLER_MISMATCH);\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates that blacklisted balances are updated after seizing of assets\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\n * @param liquidator The address repaying the borrow and seizing the collateral\\n * @param borrower The address of the borrower\\n * @param seizeTokens The number of collateral tokens to seize\\n */\\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external override {\\n // Keep the flywheel moving\\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to transfer tokens in the given market\\n * @param cToken The market to verify the transfer against\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n * @param transferTokens The number of cTokens to transfer\\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function transferAllowed(\\n address cToken,\\n address src,\\n address dst,\\n uint256 transferTokens\\n ) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!transferGuardianPaused, \\\"!transfer:paused\\\");\\n\\n // Currently the only consideration is whether or not\\n // the src is allowed to redeem this many tokens\\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\\n if (allowed != uint256(Error.NO_ERROR)) {\\n return allowed;\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreTransferAction(cToken, src, dst);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n\\n /**\\n * @notice Validates that blacklisted balances are updated after transfering assets\\n * @param cToken The market to verify the transfer against\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n * @param transferTokens The number of cTokens to transfer\\n */\\n function transferVerify(\\n address cToken,\\n address src,\\n address dst,\\n uint256 transferTokens\\n ) external override {\\n\\n // Keep the flywheel moving\\n flywheelPostTransferAction(cToken, src, dst);\\n }\\n\\n /*** Flywheel Hooks ***/\\n\\n /**\\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\\n * @param cToken The relevant market\\n * @param supplier The minter/redeemer\\n */\\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving post-mint and post-redeem\\n * @param cToken The relevant market\\n * @param supplier The minter/redeemer\\n */\\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\\n * @param cToken The relevant market\\n * @param borrower The borrower\\n */\\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving post-borrow and post-repay\\n * @param cToken The relevant market\\n * @param borrower The borrower\\n */\\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\\n * @param cToken The relevant market\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n */\\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving post-transfer and post-seize\\n * @param cToken The relevant market\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n */\\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\\n }\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n /**\\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\\n */\\n struct AccountLiquidityLocalVars {\\n ICErc20 asset;\\n uint256 sumCollateral;\\n uint256 sumBorrowPlusEffects;\\n uint256 cTokenBalance;\\n uint256 borrowBalance;\\n uint256 exchangeRateMantissa;\\n uint256 oraclePriceMantissa;\\n Exp collateralFactor;\\n Exp exchangeRate;\\n Exp oraclePrice;\\n Exp tokensToDenom;\\n uint256 borrowCapForCollateral;\\n uint256 borrowedAssetPrice;\\n uint256 assetAsCollateralValueCap;\\n }\\n\\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\\n (\\n Error err,\\n uint256 collateralValue,\\n uint256 liquidity,\\n uint256 shortfall\\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\\n return (uint256(err), collateralValue, liquidity, shortfall);\\n }\\n\\n /**\\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\\n * @param cTokenModify The market to hypothetically redeem/borrow in\\n * @param account The account to determine liquidity for\\n * @param redeemTokens The number of tokens to hypothetically redeem\\n * @param borrowAmount The amount of underlying to hypothetically borrow\\n * @return (possible error code (semi-opaque),\\n hypothetical account liquidity in excess of collateral requirements,\\n * hypothetical account shortfall below collateral requirements)\\n */\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) public view returns (uint256, uint256, uint256, uint256) {\\n (\\n Error err,\\n uint256 collateralValue,\\n uint256 liquidity,\\n uint256 shortfall\\n ) = getHypotheticalAccountLiquidityInternal(\\n account,\\n ICErc20(cTokenModify),\\n redeemTokens,\\n borrowAmount,\\n repayAmount\\n );\\n return (uint256(err), collateralValue, liquidity, shortfall);\\n }\\n\\n /**\\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\\n * @param cTokenModify The market to hypothetically redeem/borrow in\\n * @param account The account to determine liquidity for\\n * @param redeemTokens The number of tokens to hypothetically redeem\\n * @param borrowAmount The amount of underlying to hypothetically borrow\\n * @return (possible error code,\\n hypothetical account collateral value,\\n hypothetical account liquidity in excess of collateral requirements,\\n * hypothetical account shortfall below collateral requirements)\\n */\\n function getHypotheticalAccountLiquidityInternal(\\n address account,\\n ICErc20 cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) internal view returns (Error, uint256, uint256, uint256) {\\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\\n\\n if (address(cTokenModify) != address(0)) {\\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\\n }\\n\\n // For each asset the account is in\\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\\n vars.asset = accountAssets[account][i];\\n\\n {\\n // Read the balances and exchange rate from the cToken\\n uint256 oErr;\\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\\n account\\n );\\n if (oErr != 0) {\\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\\n }\\n }\\n {\\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\\n\\n // Get the normalized price of the asset\\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\\n if (vars.oraclePriceMantissa == 0) {\\n return (Error.PRICE_ERROR, 0, 0, 0);\\n }\\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\\n\\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\\n }\\n {\\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\\n vars.asset,\\n cTokenModify,\\n redeemTokens > 0,\\n account\\n );\\n\\n // accumulate the collateral value to sumCollateral\\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\\n assetCollateralValue = vars.assetAsCollateralValueCap;\\n vars.sumCollateral += assetCollateralValue;\\n }\\n\\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\n vars.oraclePrice,\\n vars.borrowBalance,\\n vars.sumBorrowPlusEffects\\n );\\n\\n // Calculate effects of interacting with cTokenModify\\n if (vars.asset == cTokenModify) {\\n // redeem effect\\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\n vars.tokensToDenom,\\n redeemTokens,\\n vars.sumBorrowPlusEffects\\n );\\n\\n // borrow effect\\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\n vars.oraclePrice,\\n borrowAmount,\\n vars.sumBorrowPlusEffects\\n );\\n\\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\\n if (repayEffect >= vars.sumBorrowPlusEffects) {\\n vars.sumBorrowPlusEffects = 0;\\n } else {\\n vars.sumBorrowPlusEffects -= repayEffect;\\n }\\n }\\n }\\n\\n // These are safe, as the underflow condition is checked first\\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\\n } else {\\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\\n }\\n }\\n\\n /**\\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\\n * @param cTokenBorrowed The address of the borrowed cToken\\n * @param cTokenCollateral The address of the collateral cToken\\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\\n */\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 actualRepayAmount\\n ) external view override returns (uint256, uint256) {\\n /* Read oracle prices for borrowed and collateral markets */\\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\\n return (uint256(Error.PRICE_ERROR), 0);\\n }\\n\\n /*\\n * Get the exchange rate and calculate the number of collateral tokens to seize:\\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\\n * seizeTokens = seizeAmount / exchangeRate\\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\\n */\\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\\n uint256 seizeTokens;\\n Exp memory numerator;\\n Exp memory denominator;\\n Exp memory ratio;\\n\\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\\n\\n /*\\n * The liquidation penalty includes\\n * - the liquidator incentive\\n * - the protocol fees (Ionic admin fees)\\n * - the market fee\\n */\\n Exp memory totalPenaltyMantissa = add_(\\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\\n Exp({ mantissa: feeSeizeShareMantissa })\\n );\\n\\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\\n ratio = div_(numerator, denominator);\\n\\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\\n return (uint256(Error.NO_ERROR), seizeTokens);\\n }\\n\\n /*** Admin Functions ***/\\n\\n /**\\n * @notice Add a RewardsDistributor contracts.\\n * @dev Admin function to add a RewardsDistributor contract\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _addRewardsDistributor(address distributor) external returns (uint256) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n // Check marker method\\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \\\"!isRewardsDistributor\\\");\\n\\n // Check for existing RewardsDistributor\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \\\"!added\\\");\\n\\n // Add RewardsDistributor to array\\n rewardsDistributors.push(distributor);\\n emit AddedRewardsDistributor(distributor);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the whitelist enforcement for the comptroller\\n * @dev Admin function to set a new whitelist enforcement boolean\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\\n }\\n\\n // Check if `enforceWhitelist` already equals `enforce`\\n if (enforceWhitelist == enforce) {\\n return uint256(Error.NO_ERROR);\\n }\\n\\n // Set comptroller's `enforceWhitelist` to `enforce`\\n enforceWhitelist = enforce;\\n\\n // Emit WhitelistEnforcementChanged(bool enforce);\\n emit WhitelistEnforcementChanged(enforce);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the whitelist `statuses` for `suppliers`\\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\\n }\\n\\n // Set whitelist statuses for suppliers\\n for (uint256 i = 0; i < suppliers.length; i++) {\\n address supplier = suppliers[i];\\n\\n if (statuses[i]) {\\n // If not already whitelisted, add to whitelist\\n if (!whitelist[supplier]) {\\n whitelist[supplier] = true;\\n whitelistArray.push(supplier);\\n whitelistIndexes[supplier] = whitelistArray.length - 1;\\n }\\n } else {\\n // If whitelisted, remove from whitelist\\n if (whitelist[supplier]) {\\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\\n whitelistArray.pop(); // Reduce length by 1\\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\\n }\\n }\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets a new price oracle for the comptroller\\n * @dev Admin function to set a new price oracle\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\\n }\\n\\n // Track the old oracle for the comptroller\\n BasePriceOracle oldOracle = oracle;\\n\\n // Set comptroller's oracle to newOracle\\n oracle = newOracle;\\n\\n // Emit NewPriceOracle(oldOracle, newOracle)\\n emit NewPriceOracle(oldOracle, newOracle);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the closeFactor used when liquidating borrows\\n * @dev Admin function to set closeFactor\\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\n */\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\\n }\\n\\n // Check limits\\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\\n }\\n\\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\\n if (lessThanExp(highLimit, newCloseFactorExp)) {\\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\\n }\\n\\n // Set pool close factor to new close factor, remember old value\\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\\n closeFactorMantissa = newCloseFactorMantissa;\\n\\n // Emit event\\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the collateralFactor for a market\\n * @dev Admin function to set per-market collateralFactor\\n * @param cToken The market to set the factor on\\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\n */\\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\\n }\\n\\n // Verify market is listed\\n Market storage market = markets[address(cToken)];\\n if (!market.isListed) {\\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\\n }\\n\\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\\n\\n // Check collateral factor <= 0.9\\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\\n }\\n\\n // If collateral factor != 0, fail if price == 0\\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\\n }\\n\\n // Set market's collateral factor to new collateral factor, remember old value\\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\\n market.collateralFactorMantissa = newCollateralFactorMantissa;\\n\\n // Emit event with asset, old collateral factor, and new collateral factor\\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets liquidationIncentive\\n * @dev Admin function to set liquidationIncentive\\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\n */\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\\n }\\n\\n // Check de-scaled min <= newLiquidationIncentive <= max\\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\\n }\\n\\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\\n }\\n\\n // Save current value for use in log\\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\\n\\n // Set liquidation incentive to new incentive\\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\\n\\n // Emit event with old incentive, new incentive\\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Add the market to the markets mapping and set it as listed\\n * @dev Admin function to set isListed and add support for the market\\n * @param cToken The address of the market (token) to list\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\\n }\\n\\n // Is market already listed?\\n if (markets[address(cToken)].isListed) {\\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\\n }\\n\\n // Check cToken.comptroller == this\\n require(address(cToken.comptroller()) == address(this), \\\"!comptroller\\\");\\n\\n // Make sure market is not already listed\\n address underlying = ICErc20(address(cToken)).underlying();\\n\\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\\n }\\n\\n // List market and emit event\\n Market storage market = markets[address(cToken)];\\n market.isListed = true;\\n market.collateralFactorMantissa = 0;\\n allMarkets.push(cToken);\\n cTokensByUnderlying[underlying] = cToken;\\n emit MarketListed(cToken);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _deployMarket(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\\n }\\n\\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\\n bool oldIonicAdminHasRights = ionicAdminHasRights;\\n ionicAdminHasRights = true;\\n\\n // Deploy via Ionic admin\\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\\n // Reset Ionic admin rights to the original value\\n ionicAdminHasRights = oldIonicAdminHasRights;\\n // Support market here in the Comptroller\\n uint256 err = _supportMarket(cToken);\\n\\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\\n\\n // Set collateral factor\\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\\n }\\n\\n function _becomeImplementation() external {\\n require(msg.sender == address(this), \\\"!self call\\\");\\n\\n if (!_notEnteredInitialized) {\\n _notEntered = true;\\n _notEnteredInitialized = true;\\n }\\n }\\n\\n /*** Helper Functions ***/\\n\\n /**\\n * @notice Returns true if the given cToken market has been deprecated\\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\\n * @param cToken The market to check if deprecated\\n */\\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\\n return\\n markets[address(cToken)].collateralFactorMantissa == 0 &&\\n borrowGuardianPaused[address(cToken)] == true &&\\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\\n }\\n\\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\\n return ComptrollerExtensionInterface(address(this));\\n }\\n\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\\n uint8 fnsCount = 36;\\n\\n functionSelectors = new bytes4[](fnsCount);\\n\\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\\n functionSelectors[--fnsCount] = this._deployMarket.selector;\\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\\n functionSelectors[--fnsCount] = this.checkMembership.selector;\\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\\n functionSelectors[--fnsCount] = this.exitMarket.selector;\\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\\n functionSelectors[--fnsCount] = this.mintVerify.selector;\\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\\n functionSelectors[--fnsCount] = this.borrowVerify.selector;\\n functionSelectors[--fnsCount] = this.repayBorrowVerify.selector;\\n functionSelectors[--fnsCount] = this.seizeVerify.selector;\\n functionSelectors[--fnsCount] = this.transferVerify.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n }\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n /**\\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\\n */\\n function _beforeNonReentrant() external override {\\n require(markets[msg.sender].isListed, \\\"!Comptroller:_beforeNonReentrant\\\");\\n require(_notEntered, \\\"!reentered\\\");\\n _notEntered = false;\\n }\\n\\n /**\\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\\n */\\n function _afterNonReentrant() external override {\\n require(markets[msg.sender].isListed, \\\"!Comptroller:_afterNonReentrant\\\");\\n _notEntered = true; // get a gas-refund post-Istanbul\\n }\\n}\\n\",\"keccak256\":\"0xa6b293d5874fcf90c2a720d0fd3a1a43f916fd633c553dd4a5aa7171a1d57bb8\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowVerify(address cToken, address borrower) external;\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n \\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external;\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n \\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x266ec3c26b454cfa72bab45fa8e0bc9e3d44e8ec0cd4770304a14cc84c8f80d3\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/ErrorReporter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\ncontract ComptrollerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n COMPTROLLER_MISMATCH,\\n INSUFFICIENT_SHORTFALL,\\n INSUFFICIENT_LIQUIDITY,\\n INVALID_CLOSE_FACTOR,\\n INVALID_COLLATERAL_FACTOR,\\n INVALID_LIQUIDATION_INCENTIVE,\\n MARKET_NOT_LISTED,\\n MARKET_ALREADY_LISTED,\\n MATH_ERROR,\\n NONZERO_BORROW_BALANCE,\\n PRICE_ERROR,\\n REJECTION,\\n SNAPSHOT_ERROR,\\n TOO_MANY_ASSETS,\\n TOO_MUCH_REPAY,\\n SUPPLIER_NOT_WHITELISTED,\\n BORROW_BELOW_MIN,\\n SUPPLY_ABOVE_MAX,\\n NONZERO_TOTAL_SUPPLY\\n }\\n\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\\n EXIT_MARKET_BALANCE_OWED,\\n EXIT_MARKET_REJECTION,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\n SET_CLOSE_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_PRICE_ORACLE_OWNER_CHECK,\\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\\n SET_WHITELIST_STATUS_OWNER_CHECK,\\n SUPPORT_MARKET_EXISTS,\\n SUPPORT_MARKET_OWNER_CHECK,\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\n UNSUPPORT_MARKET_OWNER_CHECK,\\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\\n UNSUPPORT_MARKET_IN_USE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return uint256(err);\\n }\\n}\\n\\ncontract TokenErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n BAD_INPUT,\\n COMPTROLLER_REJECTION,\\n COMPTROLLER_CALCULATION_ERROR,\\n INTEREST_RATE_MODEL_ERROR,\\n INVALID_ACCOUNT_PAIR,\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\n INVALID_COLLATERAL_FACTOR,\\n MATH_ERROR,\\n MARKET_NOT_FRESH,\\n MARKET_NOT_LISTED,\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\n TOKEN_INSUFFICIENT_BALANCE,\\n TOKEN_INSUFFICIENT_CASH,\\n TOKEN_TRANSFER_IN_FAILED,\\n TOKEN_TRANSFER_OUT_FAILED,\\n UTILIZATION_ABOVE_MAX\\n }\\n\\n /*\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\n * This is because FailureInfo grows significantly faster, and\\n * the order of Error has some meaning, while the order of FailureInfo\\n * is entirely arbitrary.\\n */\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n BORROW_ACCRUE_INTEREST_FAILED,\\n BORROW_CASH_NOT_AVAILABLE,\\n BORROW_FRESHNESS_CHECK,\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n BORROW_MARKET_NOT_LISTED,\\n BORROW_COMPTROLLER_REJECTION,\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n LIQUIDATE_COMPTROLLER_REJECTION,\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n LIQUIDATE_FRESHNESS_CHECK,\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_ACCRUE_INTEREST_FAILED,\\n MINT_COMPTROLLER_REJECTION,\\n MINT_EXCHANGE_CALCULATION_FAILED,\\n MINT_EXCHANGE_RATE_READ_FAILED,\\n MINT_FRESHNESS_CHECK,\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n MINT_TRANSFER_IN_FAILED,\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\n NEW_UTILIZATION_RATE_ABOVE_MAX,\\n REDEEM_ACCRUE_INTEREST_FAILED,\\n REDEEM_COMPTROLLER_REJECTION,\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\n REDEEM_FRESHNESS_CHECK,\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\\n WITHDRAW_IONIC_FEES_VALIDATION,\\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\\n WITHDRAW_ADMIN_FEES_VALIDATION,\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\n REDUCE_RESERVES_ADMIN_CHECK,\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\n REDUCE_RESERVES_FRESH_CHECK,\\n REDUCE_RESERVES_VALIDATION,\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\n REPAY_BORROW_FRESHNESS_CHECK,\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COMPTROLLER_OWNER_CHECK,\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\\n SET_ADMIN_FEE_ADMIN_CHECK,\\n SET_ADMIN_FEE_FRESH_CHECK,\\n SET_ADMIN_FEE_BOUNDS_CHECK,\\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\\n SET_IONIC_FEE_FRESH_CHECK,\\n SET_IONIC_FEE_BOUNDS_CHECK,\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\n TRANSFER_COMPTROLLER_REJECTION,\\n TRANSFER_NOT_ALLOWED,\\n TRANSFER_NOT_ENOUGH,\\n TRANSFER_TOO_MUCH,\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\n ADD_RESERVES_FRESH_CHECK,\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\\n }\\n}\\n\",\"keccak256\":\"0xad342553cda4d7b7e40678c636a406bc2785be2117a29d9b1cb52e747726745e\",\"license\":\"UNLICENSED\"},\"contracts/compound/Exponential.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./CarefulMath.sol\\\";\\nimport \\\"./ExponentialNoError.sol\\\";\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Compound\\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract Exponential is CarefulMath, ExponentialNoError {\\n /**\\n * @dev Creates an exponential from numerator and denominator values.\\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\\n * or if `denom` is zero.\\n */\\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\\n }\\n\\n /**\\n * @dev Adds two exponentials, returning a new exponential.\\n */\\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Subtracts two exponentials, returning a new exponential.\\n */\\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, returning a new Exp.\\n */\\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(product));\\n }\\n\\n /**\\n * @dev Divide an Exp by a scalar, returning a new Exp.\\n */\\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, returning a new Exp.\\n */\\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\\n /*\\n We are doing this as:\\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\\n\\n How it works:\\n Exp = a / b;\\n Scalar = s;\\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\\n */\\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n return getExp(numerator, divisor.mantissa);\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\\n */\\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(fraction));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials, returning a new exponential.\\n */\\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n // We add half the scale before dividing so that we get rounding instead of truncation.\\n // See \\\"Listing 6\\\" and text above it at https://accu.org/index.php/journals/1717\\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\\n assert(err2 == MathError.NO_ERROR);\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\\n */\\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\\n }\\n\\n /**\\n * @dev Multiplies three exponentials, returning a new exponential.\\n */\\n function mulExp3(\\n Exp memory a,\\n Exp memory b,\\n Exp memory c\\n ) internal pure returns (MathError, Exp memory) {\\n (MathError err, Exp memory ab) = mulExp(a, b);\\n if (err != MathError.NO_ERROR) {\\n return (err, ab);\\n }\\n return mulExp(ab, c);\\n }\\n\\n /**\\n * @dev Divides two exponentials, returning a new exponential.\\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\\n */\\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n return getExp(a.mantissa, b.mantissa);\\n }\\n}\\n\",\"keccak256\":\"0xf1b6442cbde756ce56dc5507487b1769905147f390fdf88e1d59a66bc3e2161e\",\"license\":\"UNLICENSED\"},\"contracts/compound/ExponentialNoError.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Compound\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract ExponentialNoError {\\n uint256 constant expScale = 1e18;\\n uint256 constant doubleScale = 1e36;\\n uint256 constant halfExpScale = expScale / 2;\\n uint256 constant mantissaOne = expScale;\\n\\n struct Exp {\\n uint256 mantissa;\\n }\\n\\n struct Double {\\n uint256 mantissa;\\n }\\n\\n /**\\n * @dev Truncates the given exp to a whole number value.\\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\\n */\\n function truncate(Exp memory exp) internal pure returns (uint256) {\\n // Note: We are not using careful math here as we're performing a division that cannot fail\\n return exp.mantissa / expScale;\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\\n Exp memory product = mul_(a, scalar);\\n return truncate(product);\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\n */\\n function mul_ScalarTruncateAddUInt(\\n Exp memory a,\\n uint256 scalar,\\n uint256 addend\\n ) internal pure returns (uint256) {\\n Exp memory product = mul_(a, scalar);\\n return add_(truncate(product), addend);\\n }\\n\\n /**\\n * @dev Checks if first Exp is less than second Exp.\\n */\\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa < right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp <= right Exp.\\n */\\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa <= right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp > right Exp.\\n */\\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa > right.mantissa;\\n }\\n\\n /**\\n * @dev returns true if Exp is exactly zero\\n */\\n function isZeroExp(Exp memory value) internal pure returns (bool) {\\n return value.mantissa == 0;\\n }\\n\\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\\n require(n < 2**224, errorMessage);\\n return uint224(n);\\n }\\n\\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\\n require(n < 2**32, errorMessage);\\n return uint32(n);\\n }\\n\\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return add_(a, b, \\\"addition overflow\\\");\\n }\\n\\n function add_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, errorMessage);\\n return c;\\n }\\n\\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return sub_(a, b, \\\"subtraction underflow\\\");\\n }\\n\\n function sub_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\\n }\\n\\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\\n return mul_(a, b.mantissa) / expScale;\\n }\\n\\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\\n }\\n\\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\\n return mul_(a, b.mantissa) / doubleScale;\\n }\\n\\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return mul_(a, b, \\\"multiplication overflow\\\");\\n }\\n\\n function mul_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n if (a == 0 || b == 0) {\\n return 0;\\n }\\n uint256 c = a * b;\\n require(c / a == b, errorMessage);\\n return c;\\n }\\n\\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\\n }\\n\\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\\n return div_(mul_(a, expScale), b.mantissa);\\n }\\n\\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\\n }\\n\\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\\n return div_(mul_(a, doubleScale), b.mantissa);\\n }\\n\\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return div_(a, b, \\\"divide by zero\\\");\\n }\\n\\n function div_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\\n }\\n}\\n\",\"keccak256\":\"0xec0df0038026b4e9c272de575121befd31d3a306fec5f157aaf1625fc08cfe69\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/compound/Unitroller.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./ErrorReporter.sol\\\";\\nimport \\\"./ComptrollerStorage.sol\\\";\\nimport \\\"./Comptroller.sol\\\";\\nimport { DiamondExtension, DiamondBase, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\n\\n/**\\n * @title Unitroller\\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\\n * CTokens should reference this contract as their comptroller.\\n */\\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\\n /**\\n * @notice Event emitted when the admin rights are changed\\n */\\n event AdminRightsToggled(bool hasRights);\\n\\n /**\\n * @notice Emitted when pendingAdmin is changed\\n */\\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\\n\\n /**\\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\\n */\\n event NewAdmin(address oldAdmin, address newAdmin);\\n\\n constructor(address payable _ionicAdmin) {\\n admin = msg.sender;\\n ionicAdmin = _ionicAdmin;\\n }\\n\\n /*** Admin Functions ***/\\n\\n /**\\n * @notice Toggles admin rights.\\n * @param hasRights Boolean indicating if the admin is to have rights.\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\\n }\\n\\n // Check that rights have not already been set to the desired value\\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\\n\\n adminHasRights = hasRights;\\n emit AdminRightsToggled(hasRights);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\\n * @param newPendingAdmin New pending admin.\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\\n }\\n\\n address oldPendingAdmin = pendingAdmin;\\n pendingAdmin = newPendingAdmin;\\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\\n * @dev Admin function for pending admin to accept role and update admin\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _acceptAdmin() public returns (uint256) {\\n // Check caller is pendingAdmin and pendingAdmin \\u2260 address(0)\\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\\n }\\n\\n // Save current values for inclusion in log\\n address oldAdmin = admin;\\n address oldPendingAdmin = pendingAdmin;\\n\\n admin = pendingAdmin;\\n pendingAdmin = address(0);\\n\\n emit NewAdmin(oldAdmin, admin);\\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function comptrollerImplementation() public view returns (address) {\\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\\\"_deployMarket(uint8,bytes,bytes,uint256)\\\"))));\\n }\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external {\\n require(msg.sender == address(this) || hasAdminRights(), \\\"!self || !admin\\\");\\n\\n address currentImplementation = comptrollerImplementation();\\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\\n currentImplementation\\n );\\n\\n _updateExtensions(latestComptrollerImplementation);\\n\\n if (currentImplementation != latestComptrollerImplementation) {\\n // reinitialize\\n _functionCall(address(this), abi.encodeWithSignature(\\\"_becomeImplementation()\\\"), \\\"!become impl\\\");\\n }\\n }\\n\\n function _functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.call(data);\\n\\n if (!success) {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n\\n return returndata;\\n }\\n\\n function _updateExtensions(address currentComptroller) internal {\\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\\n address[] memory currentExtensions = LibDiamond.listExtensions();\\n\\n // removed the current (old) extensions\\n for (uint256 i = 0; i < currentExtensions.length; i++) {\\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\\n }\\n // add the new extensions\\n for (uint256 i = 0; i < latestExtensions.length; i++) {\\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\\n }\\n }\\n\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\\n require(hasAdminRights(), \\\"!unauthorized\\\");\\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\\n }\\n}\\n\",\"keccak256\":\"0xcea89eb6bccd6ab62b57e42d483fd3638a0296ec9aae45d21f80a521004cc9e8\",\"license\":\"UNLICENSED\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x233d26db3755cf0c7bf0bba3a695a742bbfc15fd168fb76bbe307c5ac259b5bf\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x74641db987b6d12c8c412818b8a7708332778736193b2cb127ea54e80b334186\",\"license\":\"UNLICENSED\"},\"contracts/ionic/strategies/flywheel/IIonicFlywheel.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.10;\\n\\nimport { ERC20 } from \\\"solmate/tokens/ERC20.sol\\\";\\n\\ninterface IIonicFlywheel {\\n function isRewardsDistributor() external returns (bool);\\n\\n function isFlywheel() external returns (bool);\\n\\n function flywheelPreSupplierAction(address market, address supplier) external;\\n\\n function flywheelPostSupplierAction(address market, address supplier) external;\\n\\n function flywheelPreBorrowerAction(address market, address borrower) external;\\n\\n function flywheelPostBorrowerAction(address market, address borrower) external;\\n\\n function flywheelPreTransferAction(address market, address src, address dst) external;\\n\\n function flywheelPostTransferAction(address market, address src, address dst) external;\\n\\n function compAccrued(address user) external view returns (uint256);\\n\\n function addMarketForRewards(ERC20 strategy) external;\\n\\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\\n}\\n\",\"keccak256\":\"0x4516d96eef3e82e306678e481dcd06f150e460955eca73fa028ee63e0ceaa7e6\",\"license\":\"AGPL-3.0-only\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"},\"solmate/tokens/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\\nabstract contract ERC20 {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /*//////////////////////////////////////////////////////////////\\n METADATA STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n string public name;\\n\\n string public symbol;\\n\\n uint8 public immutable decimals;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 public totalSupply;\\n\\n mapping(address => uint256) public balanceOf;\\n\\n mapping(address => mapping(address => uint256)) public allowance;\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal immutable INITIAL_CHAIN_ID;\\n\\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\\n\\n mapping(address => uint256) public nonces;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n string memory _name,\\n string memory _symbol,\\n uint8 _decimals\\n ) {\\n name = _name;\\n symbol = _symbol;\\n decimals = _decimals;\\n\\n INITIAL_CHAIN_ID = block.chainid;\\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function approve(address spender, uint256 amount) public virtual returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n\\n return true;\\n }\\n\\n function transfer(address to, uint256 amount) public virtual returns (bool) {\\n balanceOf[msg.sender] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(msg.sender, to, amount);\\n\\n return true;\\n }\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual returns (bool) {\\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\\n\\n balanceOf[from] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n return true;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual {\\n require(deadline >= block.timestamp, \\\"PERMIT_DEADLINE_EXPIRED\\\");\\n\\n // Unchecked because the only math done is incrementing\\n // the owner's nonce which cannot realistically overflow.\\n unchecked {\\n address recoveredAddress = ecrecover(\\n keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\n ),\\n owner,\\n spender,\\n value,\\n nonces[owner]++,\\n deadline\\n )\\n )\\n )\\n ),\\n v,\\n r,\\n s\\n );\\n\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"INVALID_SIGNER\\\");\\n\\n allowance[recoveredAddress][spender] = value;\\n }\\n\\n emit Approval(owner, spender, value);\\n }\\n\\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\\n }\\n\\n function computeDomainSeparator() internal view virtual returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\n keccak256(bytes(name)),\\n keccak256(\\\"1\\\"),\\n block.chainid,\\n address(this)\\n )\\n );\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL MINT/BURN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function _mint(address to, uint256 amount) internal virtual {\\n totalSupply += amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(address(0), to, amount);\\n }\\n\\n function _burn(address from, uint256 amount) internal virtual {\\n balanceOf[from] -= amount;\\n\\n // Cannot underflow because a user's balance\\n // will never be larger than the total supply.\\n unchecked {\\n totalSupply -= amount;\\n }\\n\\n emit Transfer(from, address(0), amount);\\n }\\n}\\n\",\"keccak256\":\"0xcdfd8db76b2a3415620e4d18cc5545f3d50de792dbf2c3dd5adb40cbe6f94b10\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526002805461ffff60a01b191661010160a01b17905534801561002557600080fd5b50615e0780620000366000396000f3fe608060405234801561001057600080fd5b50600436106104065760003560e01c80637e361b1111610220578063c299823811610130578063da3d454c116100b8578063e875544611610087578063e875544614610a25578063eabe7d9114610a2e578063ede4edd014610a41578063efcb03dd14610a54578063f851a44014610a6757600080fd5b8063da3d454c146109d8578063dce15449146109eb578063e4028eee146109fe578063e6653f3d14610a1157600080fd5b8063c90c20b1116100ff578063c90c20b114610983578063c91a424f1461098b578063cf6bfd2d1461099e578063d02f7351146109b2578063d251fefc146109c557600080fd5b8063c299823814610915578063c488847b14610935578063c6c5b0dd1461095d578063c8c9c9751461097057600080fd5b80639614b53b116101b3578063b095721011610182578063b0957210146108bc578063b1034882146108c9578063b452ef62146108dc578063b9b5b153146108ef578063bdcdc2581461090257600080fd5b80639614b53b146108525780639b19251a14610865578063abfceffc14610888578063ac0b0bb7146108a857600080fd5b8063929fe9a1116101ef578063929fe9a1146107c0578063940cd6f11461080157806394543c151461082c578063952adf5a1461083f57600080fd5b80637e361b111461074057806387f763031461075357806389f8132e146107675780638e8f294b1461077c57600080fd5b80634ef4c3e11161031b578063632e5142116102ae5780636d35bf911161027d5780636d35bf91146106d1578063731f0c2b146106e45780637515bafa14610707578063779b22941461071a5780637dc0d1d01461072d57600080fd5b8063632e5142146106805780636a56947e146106885780636bd02b8a1461069b5780636d154ea5146106ae57600080fd5b806355ee1fe1116102ea57806355ee1fe11461061f5780635d72de62146106325780635ec88c791461063a5780635fc7e71e1461066d57600080fd5b80634ef4c3e1146105d35780634fd42e17146105e657806351dff989146105f957806352d84d1e1461060c57600080fd5b806324a3d6221161039e57806331ff47fa1161036d57806331ff47fa146105585780633c94786f1461058157806341c728b9146105955780634a584432146105aa5780634ada90af146105ca57600080fd5b806324a3d6221461050c578063267822471461051f5780632ccf47a414610532578063317b0b771461054557600080fd5b80631976828e116103da5780631976828e1461048d5780631c819e43146104a057806321af4569146104ce57806324008a62146104f957600080fd5b80627e3dd21461040b57806302c3bcbb146104285780630a755ec21461045657806316dc15fe1461046a575b600080fd5b610413600181565b60405190151581526020015b60405180910390f35b61044861043636600461539c565b60186020526000908152604090205481565b60405190815260200161041f565b60025461041390600160a81b900460ff1681565b61041361047836600461539c565b600d6020526000908152604090205460ff1681565b61044861049b3660046153c7565b610a7a565b6104136104ae366004615412565b601d60209081526000928352604080842090915290825290205460ff1681565b6016546104e1906001600160a01b031681565b6040516001600160a01b03909116815260200161041f565b61044861050736600461544b565b610c6f565b6013546104e1906001600160a01b031681565b6002546104e1906001600160a01b031681565b61044861054036600461539c565b610cb1565b61044861055336600461549c565b610cc2565b6104e161056636600461539c565b600e602052600090815260409020546001600160a01b031681565b60135461041390600160a01b900460ff1681565b6105a86105a33660046154b5565b610d96565b005b6104486105b836600461539c565b60176020526000908152604090205481565b61044860055481565b6104486105e13660046154fb565b610dc9565b6104486105f436600461549c565b611015565b6105a86106073660046154b5565b6110d1565b6104e161061a36600461549c565b611167565b61044861062d36600461539c565b611191565b6105a8611211565b61064d61064836600461539c565b61126e565b60408051948552602085019390935291830152606082015260800161041f565b61044861067b36600461553c565b6112b2565b6105a8611476565b6105a861069636600461544b565b6114e4565b6104e16106a936600461549c565b6114ef565b6104136106bc36600461539c565b60156020526000908152604090205460ff1681565b6105a86106df36600461553c565b6114ff565b6104136106f236600461539c565b60146020526000908152604090205460ff1681565b6104e161071536600461549c565b611511565b6104486107283660046155a0565b611521565b6003546104e1906001600160a01b031681565b61064d61074e3660046155cc565b61167f565b60135461041390600160b01b900460ff1681565b61076f6116c9565b60405161041f919061561d565b6107a961078a36600461539c565b6008602052600090815260409020805460019091015460ff9091169082565b60408051921515835260208301919091520161041f565b6104136107ce366004615412565b6001600160a01b038082166000908152600860209081526040808320938616835260029093019052205460ff1692915050565b61044861080f366004615412565b601c60209081526000928352604080842090915290825290205481565b61041361083a36600461539c565b612069565b61044861084d36600461566b565b6121d3565b6105a8610860366004615412565b612252565b61041361087336600461539c565b60106020526000908152604090205460ff1681565b61089b61089636600461539c565b612260565b60405161041f9190615688565b60135461041390600160b81b900460ff1681565b600f546104139060ff1681565b6104486108d736600461539c565b6122d6565b6104486108ea36600461571a565b6122e1565b6104486108fd36600461539c565b6124bf565b61044861091036600461544b565b61269d565b6109286109233660046157ec565b612720565b60405161041f919061589e565b6109486109433660046154fb565b6128a0565b6040805192835260208301919091520161041f565b6104e161096b36600461549c565b612bcc565b61044861097e36600461591b565b612bdc565b6105a8612e79565b6000546104e1906001600160a01b031681565b60025461041390600160a01b900460ff1681565b6104486109c036600461553c565b612f23565b6104e16109d336600461549c565b6130aa565b6104486109e63660046154fb565b6130ba565b6104e16109f93660046155a0565b613538565b610448610a0c3660046155a0565b613570565b60135461041390600160a81b900460ff1681565b61044860045481565b610448610a3c3660046154fb565b6136fa565b610448610a4f36600461539c565b613717565b6105a8610a6236600461544b565b613c9a565b6001546104e1906001600160a01b031681565b604051633af9e66960e01b81526001600160a01b0384811660048301526000918491839190831690633af9e66990602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190615987565b90506000806000610b0f8988610b03576000610b05565b895b6000806000613ca4565b929550935090915060009050836014811115610b2d57610b2d6159a0565b14610b6c5760405162461bcd60e51b815260206004820152600a602482015269216c697175696469747960b01b60448201526064015b60405180910390fd5b8015610b8057600095505050505050610c68565b600087158015610bba57506001600160a01b038087166000908152600860209081526040808320938e16835260029093019052205460ff16155b15610bc6575083610be8565b610bd1838a8a61411f565b905087158015610be057508085105b15610be85750835b6000896001600160a01b0316633b1d21a26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4c9190615987565b905080821115610c5c5780610c5e565b815b9750505050505050505b9392505050565b6001600160a01b03841660009081526008602052604081205460ff16610c995760085b9050610ca9565b610ca3858461423b565b60005b90505b949350505050565b6000610cbc826142dc565b92915050565b6000610ccc61454e565b610cdc57610cbc600160076145a2565b6040805160208082018352848252825190810190925266b1a2bc2ec50000808352815191929111610d1357610ca9600560086145a2565b6040805160208101909152670c7d713b49da000080825283511115610d4757610d3e600560086145a2565b95945050505050565b600480549086905560408051828152602081018890527f3b9670cf975d26958e754b57098eaa2ac914d8d2a31b83257997b9f346110fd991015b60405180910390a160005b9695505050505050565b6001600160a01b0383166000908152600d60205260409020805460ff19166001179055610dc3848461461b565b50505050565b6001600160a01b03831660009081526014602052604081205460ff1615610e215760405162461bcd60e51b815260206004820152600c60248201526b085b5a5b9d0e9c185d5cd95960a21b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff16610e4b5760085b9050610c68565b600f5460ff168015610e7657506001600160a01b03831660009081526010602052604090205460ff16155b15610e82576011610e44565b6000610e8d85610cb1565b90508015801590610ebc57506001600160a01b03851660009081526020805260409020610eba90856146b7565b155b15611000576000856001600160a01b0316634aeb3d9a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190615987565b9050600030604051637db121fd60e11b81526001600160a01b038981166004830152919091169063fb6243fa90602401602060405180830381865afa158015610f72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f969190615987565b90506000828210610fa957506000610fb6565b610fb382846159cc565b90505b83610fc187836159df565b10610ffc5760405162461bcd60e51b815260206004820152600b60248201526a021737570706c79206361760ac1b6044820152606401610b63565b5050505b61100a85856146d9565b600095945050505050565b600061101f61454e565b61102f57610cbc6001600d6145a2565b60408051602080820183528482528251908101909252670de0b6b3a76400008083528151919291101561106857610ca96007600e6145a2565b60408051602081019091526714d1120d7b1600008082528351111561109357610d3e6007600e6145a2565b600580549086905560408051828152602081018890527faeba5a6c40a8ac138134bff1aaa65debf25971188a58804bad717f82f0ec13169101610d81565b3360009081526008602052604090205460ff1661111a5760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610b63565b801580156111285750600082115b1561115d5760405162461bcd60e51b8152602060048201526005602482015264217a65726f60d81b6044820152606401610b63565b610dc3848461461b565b6009818154811061117757600080fd5b6000918252602090912001546001600160a01b0316905081565b600061119b61454e565b6111ab57610cbc600160126145a2565b600380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910160405180910390a160009392505050565b33301461124d5760405162461bcd60e51b815260206004820152600a602482015269085cd95b198818d85b1b60b21b6044820152606401610b63565b601a54610100900460ff1661126c57601a805461ffff19166101011790555b565b60008060008060008060008061128989600080600080613ca4565b93509350935093508360148111156112a3576112a36159a0565b99929850909650945092505050565b6001600160a01b03851660009081526008602052604081205460ff1615806112f357506001600160a01b03851660009081526008602052604090205460ff16155b156113025760085b9050610d3e565b6040516305eff7ef60e21b81526001600160a01b038481166004830152600091908816906317bfdfbc90602401602060405180830381865afa15801561134c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113709190615987565b905061137b87612069565b156113c557828110156113c05760405162461bcd60e51b815260206004820152600d60248201526c21626f72726f773e726570617960981b6044820152606401610b63565b611469565b6000806113d786600080600080613ca4565b935050509150600060148111156113f0576113f06159a0565b826014811115611402576114026159a0565b1461142357816014811115611419576114196159a0565b9350505050610d3e565b80600003611432576003611419565b600061144e604051806020016040528060045481525085614774565b905080861115611465576010945050505050610d3e565b5050505b5060009695505050505050565b3360009081526008602052604090205460ff166114d55760405162461bcd60e51b815260206004820152601f60248201527f21436f6d7074726f6c6c65723a5f61667465724e6f6e5265656e7472616e74006044820152606401610b63565b601a805460ff19166001179055565b610dc384848461478c565b601b818154811061117757600080fd5b61150a85838561478c565b5050505050565b600b818154811061117757600080fd5b600080546040805163fdb25fb160e01b8152905183926001600160a01b03169163fdb25fb19160048083019260209291908290030181865afa15801561156b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158f9190615987565b905080156116755760035460405163fc57d4df60e01b81526001600160a01b038681166004830152600092169063fc57d4df90602401602060405180830381865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190615987565b90508060000361161b57600c92505050610cbc565b60008061163660405180602001604052808581525087614830565b9092509050600082600381111561164f5761164f6159a0565b1461166257600a5b945050505050610cbc565b83811015611671576012611657565b5050505b6000949350505050565b6000806000806000806000806116988d8d8d8d8d613ca4565b93509350935093508360148111156116b2576116b26159a0565b975091955093509150505b95509550955095915050565b6040805160248082526104a08201909252606091908160208201610480803683370190505091506394543c1560e01b82611702836159f2565b92508260ff168151811061171857611718615a0f565b6001600160e01b031990921660209283029190910190910152635a2977b160e11b82611743836159f2565b92508260ff168151811061175957611759615a0f565b6001600160e01b031990921660209283029190910190910152632aff3bff60e21b82611784836159f2565b92508260ff168151811061179a5761179a615a0f565b6001600160e01b03199092166020928302919091019091015263929fe9a160e01b826117c5836159f2565b92508260ff16815181106117db576117db615a0f565b6001600160e01b0319909216602092830291909101909101526355ee1fe160e01b82611806836159f2565b92508260ff168151811061181c5761181c615a0f565b6001600160e01b03199092166020928302919091019091015263317b0b7760e01b82611847836159f2565b92508260ff168151811061185d5761185d615a0f565b6001600160e01b031990921660209283029190910190910152637201477760e11b82611888836159f2565b92508260ff168151811061189e5761189e615a0f565b6001600160e01b031990921660209283029190910190910152634fd42e1760e01b826118c9836159f2565b92508260ff16815181106118df576118df615a0f565b6001600160e01b031990921660209283029190910190910152634a956fad60e11b8261190a836159f2565b92508260ff168151811061192057611920615a0f565b6001600160e01b03199092166020928302919091019091015263c8c9c97560e01b8261194b836159f2565b92508260ff168151811061196157611961615a0f565b6001600160e01b03199092166020928302919091019091015263b9b5b15360e01b8261198c836159f2565b92508260ff16815181106119a2576119a2615a0f565b6001600160e01b031990921660209283029190910190910152637e361b1160e01b826119cd836159f2565b92508260ff16815181106119e3576119e3615a0f565b6001600160e01b031990921660209283029190910190910152630cbb414760e11b82611a0e836159f2565b92508260ff1681518110611a2457611a24615a0f565b6001600160e01b031990921660209283029190910190910152631853304760e31b82611a4f836159f2565b92508260ff1681518110611a6557611a65615a0f565b6001600160e01b031990921660209283029190910190910152630ede4edd60e41b82611a90836159f2565b92508260ff1681518110611aa657611aa6615a0f565b6001600160e01b031990921660209283029190910190910152634ef4c3e160e01b82611ad1836159f2565b92508260ff1681518110611ae757611ae7615a0f565b6001600160e01b03199092166020928302919091019091015263eabe7d9160e01b82611b12836159f2565b92508260ff1681518110611b2857611b28615a0f565b6001600160e01b0319909216602092830291909101909101526351dff98960e01b82611b53836159f2565b92508260ff1681518110611b6957611b69615a0f565b6001600160e01b03199092166020928302919091019091015263368f515360e21b82611b94836159f2565b92508260ff1681518110611baa57611baa615a0f565b6001600160e01b031990921660209283029190910190910152631de6c8a560e21b82611bd5836159f2565b92508260ff1681518110611beb57611beb615a0f565b6001600160e01b031990921660209283029190910190910152631200453160e11b82611c16836159f2565b92508260ff1681518110611c2c57611c2c615a0f565b6001600160e01b031990921660209283029190910190910152632fe3f38f60e11b82611c57836159f2565b92508260ff1681518110611c6d57611c6d615a0f565b6001600160e01b03199092166020928302919091019091015263d02f735160e01b82611c98836159f2565b92508260ff1681518110611cae57611cae615a0f565b6001600160e01b0319909216602092830291909101909101526317b9b84b60e31b82611cd9836159f2565b92508260ff1681518110611cef57611cef615a0f565b6001600160e01b0319909216602092830291909101909101526341c728b960e01b82611d1a836159f2565b92508260ff1681518110611d3057611d30615a0f565b6001600160e01b031990921660209283029190910190910152635ec88c7960e01b82611d5b836159f2565b92508260ff1681518110611d7157611d71615a0f565b6001600160e01b03199092166020928302919091019091015263c488847b60e01b82611d9c836159f2565b92508260ff1681518110611db257611db2615a0f565b6001600160e01b03199092166020928302919091019091015263c90c20b160e01b82611ddd836159f2565b92508260ff1681518110611df357611df3615a0f565b6001600160e01b03199092166020928302919091019091015263319728a160e11b82611e1e836159f2565b92508260ff1681518110611e3457611e34615a0f565b6001600160e01b031990921660209283029190910190910152632eb96f3160e11b82611e5f836159f2565b92508260ff1681518110611e7557611e75615a0f565b6001600160e01b031990921660209283029190910190910152630b33d1e960e21b82611ea0836159f2565b92508260ff1681518110611eb657611eb6615a0f565b6001600160e01b031990921660209283029190910190910152635881a44160e11b82611ee1836159f2565b92508260ff1681518110611ef757611ef7615a0f565b6001600160e01b031990921660209283029190910190910152639614b53b60e01b82611f22836159f2565b92508260ff1681518110611f3857611f38615a0f565b6001600160e01b03199092166020928302919091019091015263efcb03dd60e01b82611f63836159f2565b92508260ff1681518110611f7957611f79615a0f565b6001600160e01b031990921660209283029190910190910152636d35bf9160e01b82611fa4836159f2565b92508260ff1681518110611fba57611fba615a0f565b6001600160e01b03199092166020928302919091019091015263352b4a3f60e11b82611fe5836159f2565b92508260ff1681518110611ffb57611ffb615a0f565b6001600160e01b03199092166020928302919091019091015260ff8116156120655760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610b63565b5090565b6001600160a01b0381166000908152600860205260408120600101541580156120af57506001600160a01b03821660009081526015602052604090205460ff1615156001145b8015610cbc57506121c3612185836001600160a01b031663173b99046040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190615987565b846001600160a01b0316638d02d9a16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121809190615987565b614883565b836001600160a01b031663c3bf11cd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b670de0b6b3a76400001492915050565b60006121dd61454e565b6121ed57610cbc600160136145a2565b600f5482151560ff909116151503612206576000610cbc565b600f805460ff19168315159081179091556040519081527f84c7d948374a180eddab35d27d2f7a94167a1ff4e79467f1e89c061984190a1e906020015b60405180910390a16000610cbc565b61225c82826148b9565b5050565b6001600160a01b03811660009081526007602090815260408083208054825181850281018501909352808352606094938301828280156122c957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122ab575b5093979650505050505050565b6000610cbc82614955565b60006122eb61454e565b612302576122fb600160166145a2565b9050610d8c565b60028054600160a01b60ff60a01b1982168117909255600080546040516328f816b560e11b81529390920460ff169290916001600160a01b0316906351f02d6a90612359908c908c908c908c908c90600401615a4e565b6020604051808303816000875af1158015612378573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239c9190615a7e565b6002805460ff60a01b1916600160a01b85151502179055905060006123c0826149f4565b905060008054906101000a90046001600160a01b03166001600160a01b0316638aac2f0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124379190615a7e565b604051635a89ef5160e01b81523060048201526001600160a01b039190911690635a89ef5190602401600060405180830381600087803b15801561247a57600080fd5b505af115801561248e573d6000803e3d6000fd5b506000925061249b915050565b81146124a757806124b1565b6124b18286613570565b9a9950505050505050505050565b60006124c961454e565b6124fe5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610b63565b816001600160a01b031663abc6d72d6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561253e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125629190615a9b565b6125a65760405162461bcd60e51b815260206004820152601560248201527410b4b9a932bbb0b93239a234b9ba3934b13aba37b960591b6044820152606401610b63565b60005b60195481101561261e57601981815481106125c6576125c6615a0f565b6000918252602090912001546001600160a01b03908116908416036126165760405162461bcd60e51b815260206004820152600660248201526508585919195960d21b6044820152606401610b63565b6001016125a9565b50601980546001810182556000919091527f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950180546001600160a01b0319166001600160a01b0384169081179091556040519081527f98ef1187fb6fd2bc85f8996489877eb2b5428f9e9bdfc068c9ad6c2ea82eacc790602001612243565b601354600090600160b01b900460ff16156126ed5760405162461bcd60e51b815260206004820152601060248201526f085d1c985b9cd9995c8e9c185d5cd95960821b6044820152606401610b63565b60006126fa868685614c3b565b90508015612709579050610ca9565b612714868686614d03565b60009695505050505050565b60008054604051631beb2b9760e31b81526060926001600160a01b039092169163df595cb8916127659130913391839190356001600160e01b03191690600401615ab8565b602060405180830381865afa158015612782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a69190615a9b565b6127e35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b815160008167ffffffffffffffff811115612800576128006157a5565b604051908082528060200260200182016040528015612829578160200160208202803683370190505b50905060005b8281101561289657600085828151811061284b5761284b615a0f565b6020026020010151905061285f8133614da7565b6014811115612870576128706159a0565b83838151811061288257612882615a0f565b60209081029190910101525060010161282f565b509150505b919050565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092839283929091169063fc57d4df90602401602060405180830381865afa1580156128f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129159190615987565b60035460405163fc57d4df60e01b81526001600160a01b0388811660048301529293506000929091169063fc57d4df90602401602060405180830381865afa158015612965573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129899190615987565b9050811580612996575080155b156129aa57600c6000935093505050612bc4565b60008690506000816001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a139190615987565b90506000612a2d6040518060200160405280600081525090565b6040805160208101909152600081526040805160208101909152600081526000866001600160a01b0316636752e7026040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aaf9190615987565b90506000876001600160a01b031663be99f1196040518163ffffffff1660e01b8152600401602060405180830381865afa158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b159190615987565b90506000612b58612b446040518060200160405280600554815250604051806020016040528087815250614f41565b604051806020016040528085815250614f41565b9050612b728160405180602001604052808e815250614f76565b9550612b9a60405180602001604052808c81525060405180602001604052808b815250614f76565b9450612ba68686614fb5565b9350612bb2848f614774565b60009d509b5050505050505050505050505b935093915050565b6019818154811061117757600080fd5b6000612be661454e565b612bf657610c92600160146145a2565b60005b84811015612e71576000868683818110612c1557612c15615a0f565b9050602002016020810190612c2a919061539c565b9050848483818110612c3e57612c3e615a0f565b9050602002016020810190612c53919061566b565b15612d0b576001600160a01b03811660009081526010602052604090205460ff16612d06576001600160a01b0381166000818152601060205260408120805460ff19166001908117909155601180548083018255928190527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6890920180546001600160a01b03191690931790925554612cec91906159cc565b6001600160a01b0382166000908152601260205260409020555b612e68565b6001600160a01b03811660009081526010602052604090205460ff1615612e685760118054612d3c906001906159cc565b81548110612d4c57612d4c615a0f565b60009182526020808320909101546001600160a01b0384811684526012909252604090922054601180549290931692918110612d8a57612d8a615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506011805480612dc957612dc9615aeb565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038316825260129081905260408220546011805491939184908110612e1d57612e1d615a0f565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822094909455918416825260128352808220829055601090925220805460ff191690555b50600101612bf9565b506000610ca6565b3360009081526008602052604090205460ff16612ed85760405162461bcd60e51b815260206004820181905260248201527f21436f6d7074726f6c6c65723a5f6265666f72654e6f6e5265656e7472616e746044820152606401610b63565b601a5460ff16612f175760405162461bcd60e51b815260206004820152600a602482015269085c99595b9d195c995960b21b6044820152606401610b63565b601a805460ff19169055565b601354600090600160b81b900460ff1615612f705760405162461bcd60e51b815260206004820152600d60248201526c085cd95a5e994e9c185d5cd959609a1b6044820152606401610b63565b6001600160a01b03861660009081526008602052604090205460ff161580612fb157506001600160a01b03851660009081526008602052604090205460ff16155b15612fbd5760086112fb565b846001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301f9190615a7e565b6001600160a01b0316866001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308a9190615a7e565b6001600160a01b03161461309f5760026112fb565b612714868486614d03565b6011818154811061117757600080fd5b6001600160a01b03831660009081526015602052604081205460ff16156131145760405162461bcd60e51b815260206004820152600e60248201526d08589bdc9c9bddce9c185d5cd95960921b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff1661313b576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff1661322a57336001600160a01b038516146131ae5760405162461bcd60e51b815260206004820152600760248201526610b1ba37b5b2b760c91b6044820152606401610b63565b60006131ba3385614da7565b905060008160148111156131d0576131d06159a0565b146131ef578060148111156131e7576131e76159a0565b915050610c68565b6001600160a01b038086166000908152600860209081526040808320938816835260029093019052205460ff1661322857613228615b01565b505b60035460405163fc57d4df60e01b81526001600160a01b0386811660048301529091169063fc57d4df90602401602060405180830381865afa158015613274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132989190615987565b6000036132a657600c610e44565b600f5460ff1680156132d157506001600160a01b03831660009081526010602052604090205460ff16155b156132dd576011610e44565b60006132e8856122d6565b9050801580159061331857506001600160a01b038516600090815260216020526040902061331690856146b7565b155b1561345c576000856001600160a01b03166373acee986040518163ffffffff1660e01b8152600401602060405180830381865afa15801561335d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133819190615987565b9050600030604051631d3965af60e11b81526001600160a01b0389811660048301529190911690633a72cb5e90602401602060405180830381865afa1580156133ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f29190615987565b9050600082821061340557506000613412565b61340f82846159cc565b90505b8361341d87836159df565b106134585760405162461bcd60e51b815260206004820152600b60248201526a021626f72726f773a6361760ac1b6044820152606401610b63565b5050505b613466858561423b565b604051637e361b1160e01b81526001600160a01b0380861660048301528616602482015260006044820181905260648201859052608482018190529081903090637e361b119060a401608060405180830381865afa1580156134cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f09190615b17565b93505050915060006014811115613509576135096159a0565b821461351957509150610c689050565b801561352b5760049350505050610c68565b6000979650505050505050565b6007602052816000526040600020818154811061355457600080fd5b6000918252602090912001546001600160a01b03169150829050565b600061357a61454e565b6135915761358a600160096145a2565b9050610cbc565b6001600160a01b0383166000908152600860205260409020805460ff166135c6576135be6008600a6145a2565b915050610cbc565b60408051602080820183528582528251908101909252670c7d713b49da00008252906135f481835190511090565b1561360f576136056006600b6145a2565b9350505050610cbc565b8415801590613689575060035460405163fc57d4df60e01b81526001600160a01b0388811660048301529091169063fc57d4df90602401602060405180830381865afa158015613663573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136879190615987565b155b1561369957613605600c806145a2565b60018301805490869055604080516001600160a01b0389168152602081018390529081018790527f70483e6592cd5182d45ac970e05bc62cdcc90e9d8ef2c2dbe686cf383bcd7fc59060600160405180910390a16000979650505050505050565b600080613708858585614c3b565b90508015611000579050610c68565b60008054604051631beb2b9760e31b81526001600160a01b039091169063df595cb890613759903090339082906001600160e01b031988351690600401615ab8565b602060405180830381865afa158015613776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379a9190615a9b565b6137d75760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b6001600160a01b03821660009081526008602052604090205460ff1661383f5760405162461bcd60e51b815260206004820152601760248201527f21436f6d7074726f6c6c65723a657869744d61726b65740000000000000000006044820152606401610b63565b6040516361bfb47160e11b81523360048201528290600090819081906001600160a01b0385169063c37f68e290602401608060405180830381865afa15801561388c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b09190615b17565b50925092509250826000146138f55760405162461bcd60e51b815260206004820152600b60248201526a08595e1a5d13585c9ad95d60aa1b6044820152606401610b63565b801561390757610d8c600b60036145a2565b6000613914873385614c3b565b9050801561393457613929600d600483614fef565b979650505050505050565b6001600160a01b0387166000908152600860209081526040808320338452600281019092529091205460ff1661397257600098975050505050505050565b3360009081526002820160209081526040808320805460ff1916905560078252808320805482518185028101850190935280835291929091908301828280156139e457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116139c6575b5050835193945083925060009150505b82811015613a3e578b6001600160a01b0316848281518110613a1857613a18615a0f565b60200260200101516001600160a01b031603613a3657809150613a3e565b6001016139f4565b50818110613a4e57613a4e615b01565b33600090815260076020526040902080548190613a6d906001906159cc565b81548110613a7d57613a7d615a0f565b9060005260206000200160009054906101000a90046001600160a01b0316818381548110613aad57613aad615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080805480613aeb57613aeb615aeb565b600082815260208120820160001990810180546001600160a01b031916905590910190915581549003613c4757600b8054613b28906001906159cc565b81548110613b3857613b38615a0f565b6000918252602080832090910154338352600c909152604090912054600b80546001600160a01b03909316929091908110613b7557613b75615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b805480613bb457613bb4615aeb565b60008281526020808220830160001990810180546001600160a01b0319169055909201909255338252600c908190526040822054600b805491939184908110613bff57613bff615a0f565b60009182526020808320909101546001600160a01b03168352828101939093526040918201812093909355338352600c8252808320839055600a9091529020805460ff191690555b604080516001600160a01b038e1681523360208201527fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d910160405180910390a160009c9b505050505050505050505050565b610dc384836148b9565b600080600080613cb26152bc565b6001600160a01b03891615613d365760035460405163fc57d4df60e01b81526001600160a01b038b811660048301529091169063fc57d4df90602401602060405180830381865afa158015613d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d2f9190615987565b6101808201525b60005b6001600160a01b038b166000908152600760205260409020548110156140bb576001600160a01b038b166000908152600760205260409020805482908110613d8357613d83615a0f565b60009182526020822001546001600160a01b039081168085526040516361bfb47160e11b8152918e1660048301529063c37f68e290602401608060405180830381865afa158015613dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dfc9190615b17565b60a08701526080860152606085015290508015613e2a57600e600080600096509650965096505050506116bd565b50604080516020808201835284516001600160a01b0390811660009081526008835284902060010154835260e08601929092528251908101835260a085015181526101008501526003548451925163fc57d4df60e01b81529282166004840152169063fc57d4df90602401602060405180830381865afa158015613eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ed69190615987565b60c08301819052600003613efa57600c6000806000955095509550955050506116bd565b604080516020810190915260c0830151815261012083015260e0820151610100830151613f3591613f2a91614f76565b836101200151614f76565b610140830152308251604051633c1f884b60e11b81526001600160a01b0391821660048201528c821660248201528b151560448201528d8216606482015291169063783f109690608401602060405180830381865afa158015613f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fc09190615987565b6101a08301526101408201516060830151600091613fdd91614774565b9050826101a00151811115613ff457506101a08201515b808360200181815161400691906159df565b9052505061012082015160808301516040840151614025929190615067565b604083015281516001600160a01b03808c169116036140b3576140528261014001518a8460400151615067565b6040830181905261012083015161406a918a90615067565b60408301526101208201516000906140829089614774565b90508260400151811061409b57600060408401526140b1565b80836040018181516140ad91906159cc565b9052505b505b600101613d39565b508060400151816020015111156140f45760208101516040820151600091906140e490826159cc565b60009450945094509450506116bd565b6000816020015160008360200151846040015161411191906159cc565b9450945094509450506116bd565b60008360000361413157506000610c68565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092169063fc57d4df90602401602060405180830381865afa15801561417c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141a09190615987565b9050600081116141dc5760405162461bcd60e51b8152602060048201526007602482015266216f7261636c6560c81b6044820152606401610b63565b8261421e576001600160a01b038416600090815260086020526040902060010154670de0b6b3a76400006142108383615b4d565b61421a9190615b64565b9150505b8061423186670de0b6b3a7640000615b4d565b610d3e9190615b64565b60005b6019548110156142d7576019818154811061425b5761425b615a0f565b600091825260209091200154604051631cdc2c5d60e31b81526001600160a01b03858116600483015284811660248301529091169063e6e162e890604401600060405180830381600087803b1580156142b357600080fd5b505af11580156142c7573d6000803e3d6000fd5b50506001909201915061423e9050565b505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561452c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143829190615a7e565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156143db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143ff9190615b9e565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916144589190615c39565b600060405180830381855afa9150503d8060008114614493576040519150601f19603f3d011682016040523d82523d6000602084013e614498565b606091505b50915091508180156144ab575080516020145b156144ca57808060200190518101906144c49190615c55565b60ff1692505b60408501516144dc9060000b84615c72565b925060008312614502576144f183600a615d76565b6144fb9087615b4d565b9550614523565b61450b83615d82565b61451690600a615d76565b6145209087615b64565b95505b50505050614548565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546000906001600160a01b0316331480156145745750600254600160a81b900460ff165b8061459d57506000546001600160a01b03163314801561459d5750600254600160a01b900460ff165b905090565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156145d7576145d76159a0565b83601a8111156145e9576145e96159a0565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610c6857610c686159a0565b60005b6019548110156142d7576019818154811061463b5761463b615a0f565b600091825260209091200154604051630509462560e21b81526001600160a01b038581166004830152848116602483015290911690631425189490604401600060405180830381600087803b15801561469357600080fd5b505af11580156146a7573d6000803e3d6000fd5b50506001909201915061461e9050565b6001600160a01b03811660009081526001830160205260408120541515610c68565b60005b6019548110156142d757601981815481106146f9576146f9615a0f565b60009182526020909120015460405162e48b0f60e51b81526001600160a01b038581166004830152848116602483015290911690631c9161e090604401600060405180830381600087803b15801561475057600080fd5b505af1158015614764573d6000803e3d6000fd5b5050600190920191506146dc9050565b6000806147818484615088565b9050610ca9816150b0565b60005b601954811015610dc357601981815481106147ac576147ac615a0f565b600091825260209091200154604051632a29f11f60e21b81526001600160a01b038681166004830152858116602483015284811660448301529091169063a8a7c47c90606401600060405180830381600087803b15801561480c57600080fd5b505af1158015614820573d6000803e3d6000fd5b50506001909201915061478f9050565b60008060008061484086866150c8565b90925090506000826003811115614859576148596159a0565b1461486a575091506000905061487c565b6000614875826150b0565b9350935050505b9250929050565b6000610c688383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b815250615144565b60005b6019548110156142d757601981815481106148d9576148d9615a0f565b60009182526020909120015460405163d27c545360e01b81526001600160a01b03858116600483015284811660248301529091169063d27c545390604401600060405180830381600087803b15801561493157600080fd5b505af1158015614945573d6000803e3d6000fd5b5050600190920191506148bc9050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b93830193909352156149d7576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60006149fe61454e565b614a0e57610cbc600160166145a2565b6001600160a01b03821660009081526008602052604090205460ff1615614a3b57610cbc600960156145a2565b306001600160a01b0316826001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614aa79190615a7e565b6001600160a01b031614614aec5760405162461bcd60e51b815260206004820152600c60248201526b10b1b7b6b83a3937b63632b960a11b6044820152606401610b63565b6000826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b509190615a7e565b6001600160a01b038082166000908152600e60205260409020549192501615614b7f57610c68600960156145a2565b6001600160a01b038381166000818152600860209081526040808320805460ff1916600190811782558082018590556009805491820190557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b031990811687179091559587168452600e835292819020805490951684179094559251918252917fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f910160405180910390a16000610ca9565b6001600160a01b03831660009081526008602052604081205460ff16614c62576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff16614c9a576000610e44565b600080614cab858786600080613ca4565b93505050915060006014811115614cc457614cc46159a0565b826014811115614cd657614cd66159a0565b14614cf657816014811115614ced57614ced6159a0565b92505050610c68565b8015612714576004614ced565b60005b601954811015610dc35760198181548110614d2357614d23615a0f565b600091825260209091200154604051634e081c9560e01b81526001600160a01b0386811660048301528581166024830152848116604483015290911690634e081c9590606401600060405180830381600087803b158015614d8357600080fd5b505af1158015614d97573d6000803e3d6000fd5b505060019092019150614d069050565b6001600160a01b0382166000908152600860205260408120805460ff16614dd2576008915050610cbc565b6001600160a01b038316600090815260028201602052604090205460ff161515600103614e03576000915050610cbc565b6001600160a01b03838116600081815260028401602090815260408083208054600160ff199091168117909155600783528184208054918201815584528284200180546001600160a01b031916958a1695909517909455918152600a909152205460ff16614ef457600b8054600180820183557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990910180546001600160a01b0319166001600160a01b0387169081179091556000908152600a60205260409020805460ff1916821790559054614eda91906159cc565b6001600160a01b0384166000908152600c60205260409020555b604080516001600160a01b038087168252851660208201527f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a5910160405180910390a15060009392505050565b6040805160208101909152600081526040518060200160405280614f6d85600001518560000151614883565b90529392505050565b6040805160208101909152600081526040518060200160405280670de0b6b3a7640000614fab8660000151866000015161517e565b614f6d9190615b64565b6040805160208101909152600081526040518060200160405280614f6d614fe88660000151670de0b6b3a764000061517e565b85516151c0565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846014811115615024576150246159a0565b84601a811115615036576150366159a0565b604080519283526020830191909152810184905260600160405180910390a1836014811115610ca957610ca96159a0565b6000806150748585615088565b9050610d3e615082826150b0565b84614883565b6040805160208101909152600081526040518060200160405280614f6d85600001518561517e565b8051600090610cbc90670de0b6b3a764000090615b64565b60006150e06040518060200160405280600081525090565b6000806150f18660000151866151f3565b9092509050600082600381111561510a5761510a6159a0565b146151295750604080516020810190915260008152909250905061487c565b60408051602081019091529081526000969095509350505050565b60008061515184866159df565b905082858210156151755760405162461bcd60e51b8152600401610b639190615d9e565b50949350505050565b6000610c6883836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f7700000000000000000081525061523d565b6000610c6883836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250615290565b600080836000036152095750600090508061487c565b838302836152178683615b64565b1461522a5760026000925092505061487c565b60009250905061487c565b509250929050565b600083158061524a575082155b1561525757506000610c68565b60006152638486615b4d565b9050836152708683615b64565b1483906151755760405162461bcd60e51b8152600401610b639190615d9e565b600081836152b15760405162461bcd60e51b8152600401610b639190615d9e565b50610ca98385615b64565b604051806101c0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016153186040518060200160405280600081525090565b81526020016153336040518060200160405280600081525090565b815260200161534e6040518060200160405280600081525090565b81526020016153696040518060200160405280600081525090565b81526020016000815260200160008152602001600081525090565b6001600160a01b038116811461539957600080fd5b50565b6000602082840312156153ae57600080fd5b8135610c6881615384565b801515811461539957600080fd5b6000806000606084860312156153dc57600080fd5b83356153e781615384565b925060208401356153f781615384565b91506040840135615407816153b9565b809150509250925092565b6000806040838503121561542557600080fd5b823561543081615384565b9150602083013561544081615384565b809150509250929050565b6000806000806080858703121561546157600080fd5b843561546c81615384565b9350602085013561547c81615384565b9250604085013561548c81615384565b9396929550929360600135925050565b6000602082840312156154ae57600080fd5b5035919050565b600080600080608085870312156154cb57600080fd5b84356154d681615384565b935060208501356154e681615384565b93969395505050506040820135916060013590565b60008060006060848603121561551057600080fd5b833561551b81615384565b9250602084013561552b81615384565b929592945050506040919091013590565b600080600080600060a0868803121561555457600080fd5b853561555f81615384565b9450602086013561556f81615384565b9350604086013561557f81615384565b9250606086013561558f81615384565b949793965091946080013592915050565b600080604083850312156155b357600080fd5b82356155be81615384565b946020939093013593505050565b600080600080600060a086880312156155e457600080fd5b85356155ef81615384565b945060208601356155ff81615384565b94979496505050506040830135926060810135926080909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160e01b03191683529284019291840191600101615639565b50909695505050505050565b60006020828403121561567d57600080fd5b8135610c68816153b9565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160a01b0316835292840192918401916001016156a4565b60ff8116811461539957600080fd5b60008083601f8401126156ea57600080fd5b50813567ffffffffffffffff81111561570257600080fd5b60208301915083602082850101111561487c57600080fd5b6000806000806000806080878903121561573357600080fd5b863561573e816156c9565b9550602087013567ffffffffffffffff8082111561575b57600080fd5b6157678a838b016156d8565b9097509550604089013591508082111561578057600080fd5b5061578d89828a016156d8565b979a9699509497949695606090950135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156157e4576157e46157a5565b604052919050565b600060208083850312156157ff57600080fd5b823567ffffffffffffffff8082111561581757600080fd5b818501915085601f83011261582b57600080fd5b81358181111561583d5761583d6157a5565b8060051b915061584e8483016157bb565b818152918301840191848101908884111561586857600080fd5b938501935b83851015615892578435925061588283615384565b828252938501939085019061586d565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561565f578351835292840192918401916001016158ba565b60008083601f8401126158e857600080fd5b50813567ffffffffffffffff81111561590057600080fd5b6020830191508360208260051b850101111561487c57600080fd5b6000806000806040858703121561593157600080fd5b843567ffffffffffffffff8082111561594957600080fd5b615955888389016158d6565b9096509450602087013591508082111561596e57600080fd5b5061597b878288016158d6565b95989497509550505050565b60006020828403121561599957600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610cbc57610cbc6159b6565b80820180821115610cbc57610cbc6159b6565b600060ff821680615a0557615a056159b6565b6000190192915050565b634e487b7160e01b600052603260045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60ff86168152606060208201526000615a6b606083018688615a25565b8281036040840152615892818587615a25565b600060208284031215615a9057600080fd5b8151610c6881615384565b600060208284031215615aad57600080fd5b8151610c68816153b9565b6001600160a01b0394851681529284166020840152921660408201526001600160e01b0319909116606082015260800190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60008060008060808587031215615b2d57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbc57610cbc6159b6565b600082615b8157634e487b7160e01b600052601260045260246000fd5b500490565b805167ffffffffffffffff8116811461289b57600080fd5b600060608284031215615bb057600080fd5b6040516060810181811067ffffffffffffffff82111715615bd357615bd36157a5565b604052615bdf83615b86565b8152615bed60208401615b86565b6020820152604083015163ffffffff81168114615c0957600080fd5b60408201529392505050565b60005b83811015615c30578181015183820152602001615c18565b50506000910152565b60008251615c4b818460208701615c15565b9190910192915050565b600060208284031215615c6757600080fd5b8151610c68816156c9565b8082018281126000831280158216821582161715615c9257615c926159b6565b505092915050565b600181815b80851115615235578160001904821115615cbb57615cbb6159b6565b80851615615cc857918102915b93841c9390800290615c9f565b600082615ce457506001610cbc565b81615cf157506000610cbc565b8160018114615d075760028114615d1157615d2d565b6001915050610cbc565b60ff841115615d2257615d226159b6565b50506001821b610cbc565b5060208310610133831016604e8410600b8410161715615d50575081810a610cbc565b615d5a8383615c9a565b8060001904821115615d6e57615d6e6159b6565b029392505050565b6000610c688383615cd5565b6000600160ff1b8201615d9757615d976159b6565b5060000390565b6020815260008251806020840152615dbd816040850160208701615c15565b601f01601f1916919091016040019291505056fea2646970667358221220d9f93c110e8cd1b5baaa4cd98b1209822d474748896ab5a95ec21b2e101cb0b364736f6c63430008160033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106104065760003560e01c80637e361b1111610220578063c299823811610130578063da3d454c116100b8578063e875544611610087578063e875544614610a25578063eabe7d9114610a2e578063ede4edd014610a41578063efcb03dd14610a54578063f851a44014610a6757600080fd5b8063da3d454c146109d8578063dce15449146109eb578063e4028eee146109fe578063e6653f3d14610a1157600080fd5b8063c90c20b1116100ff578063c90c20b114610983578063c91a424f1461098b578063cf6bfd2d1461099e578063d02f7351146109b2578063d251fefc146109c557600080fd5b8063c299823814610915578063c488847b14610935578063c6c5b0dd1461095d578063c8c9c9751461097057600080fd5b80639614b53b116101b3578063b095721011610182578063b0957210146108bc578063b1034882146108c9578063b452ef62146108dc578063b9b5b153146108ef578063bdcdc2581461090257600080fd5b80639614b53b146108525780639b19251a14610865578063abfceffc14610888578063ac0b0bb7146108a857600080fd5b8063929fe9a1116101ef578063929fe9a1146107c0578063940cd6f11461080157806394543c151461082c578063952adf5a1461083f57600080fd5b80637e361b111461074057806387f763031461075357806389f8132e146107675780638e8f294b1461077c57600080fd5b80634ef4c3e11161031b578063632e5142116102ae5780636d35bf911161027d5780636d35bf91146106d1578063731f0c2b146106e45780637515bafa14610707578063779b22941461071a5780637dc0d1d01461072d57600080fd5b8063632e5142146106805780636a56947e146106885780636bd02b8a1461069b5780636d154ea5146106ae57600080fd5b806355ee1fe1116102ea57806355ee1fe11461061f5780635d72de62146106325780635ec88c791461063a5780635fc7e71e1461066d57600080fd5b80634ef4c3e1146105d35780634fd42e17146105e657806351dff989146105f957806352d84d1e1461060c57600080fd5b806324a3d6221161039e57806331ff47fa1161036d57806331ff47fa146105585780633c94786f1461058157806341c728b9146105955780634a584432146105aa5780634ada90af146105ca57600080fd5b806324a3d6221461050c578063267822471461051f5780632ccf47a414610532578063317b0b771461054557600080fd5b80631976828e116103da5780631976828e1461048d5780631c819e43146104a057806321af4569146104ce57806324008a62146104f957600080fd5b80627e3dd21461040b57806302c3bcbb146104285780630a755ec21461045657806316dc15fe1461046a575b600080fd5b610413600181565b60405190151581526020015b60405180910390f35b61044861043636600461539c565b60186020526000908152604090205481565b60405190815260200161041f565b60025461041390600160a81b900460ff1681565b61041361047836600461539c565b600d6020526000908152604090205460ff1681565b61044861049b3660046153c7565b610a7a565b6104136104ae366004615412565b601d60209081526000928352604080842090915290825290205460ff1681565b6016546104e1906001600160a01b031681565b6040516001600160a01b03909116815260200161041f565b61044861050736600461544b565b610c6f565b6013546104e1906001600160a01b031681565b6002546104e1906001600160a01b031681565b61044861054036600461539c565b610cb1565b61044861055336600461549c565b610cc2565b6104e161056636600461539c565b600e602052600090815260409020546001600160a01b031681565b60135461041390600160a01b900460ff1681565b6105a86105a33660046154b5565b610d96565b005b6104486105b836600461539c565b60176020526000908152604090205481565b61044860055481565b6104486105e13660046154fb565b610dc9565b6104486105f436600461549c565b611015565b6105a86106073660046154b5565b6110d1565b6104e161061a36600461549c565b611167565b61044861062d36600461539c565b611191565b6105a8611211565b61064d61064836600461539c565b61126e565b60408051948552602085019390935291830152606082015260800161041f565b61044861067b36600461553c565b6112b2565b6105a8611476565b6105a861069636600461544b565b6114e4565b6104e16106a936600461549c565b6114ef565b6104136106bc36600461539c565b60156020526000908152604090205460ff1681565b6105a86106df36600461553c565b6114ff565b6104136106f236600461539c565b60146020526000908152604090205460ff1681565b6104e161071536600461549c565b611511565b6104486107283660046155a0565b611521565b6003546104e1906001600160a01b031681565b61064d61074e3660046155cc565b61167f565b60135461041390600160b01b900460ff1681565b61076f6116c9565b60405161041f919061561d565b6107a961078a36600461539c565b6008602052600090815260409020805460019091015460ff9091169082565b60408051921515835260208301919091520161041f565b6104136107ce366004615412565b6001600160a01b038082166000908152600860209081526040808320938616835260029093019052205460ff1692915050565b61044861080f366004615412565b601c60209081526000928352604080842090915290825290205481565b61041361083a36600461539c565b612069565b61044861084d36600461566b565b6121d3565b6105a8610860366004615412565b612252565b61041361087336600461539c565b60106020526000908152604090205460ff1681565b61089b61089636600461539c565b612260565b60405161041f9190615688565b60135461041390600160b81b900460ff1681565b600f546104139060ff1681565b6104486108d736600461539c565b6122d6565b6104486108ea36600461571a565b6122e1565b6104486108fd36600461539c565b6124bf565b61044861091036600461544b565b61269d565b6109286109233660046157ec565b612720565b60405161041f919061589e565b6109486109433660046154fb565b6128a0565b6040805192835260208301919091520161041f565b6104e161096b36600461549c565b612bcc565b61044861097e36600461591b565b612bdc565b6105a8612e79565b6000546104e1906001600160a01b031681565b60025461041390600160a01b900460ff1681565b6104486109c036600461553c565b612f23565b6104e16109d336600461549c565b6130aa565b6104486109e63660046154fb565b6130ba565b6104e16109f93660046155a0565b613538565b610448610a0c3660046155a0565b613570565b60135461041390600160a81b900460ff1681565b61044860045481565b610448610a3c3660046154fb565b6136fa565b610448610a4f36600461539c565b613717565b6105a8610a6236600461544b565b613c9a565b6001546104e1906001600160a01b031681565b604051633af9e66960e01b81526001600160a01b0384811660048301526000918491839190831690633af9e66990602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190615987565b90506000806000610b0f8988610b03576000610b05565b895b6000806000613ca4565b929550935090915060009050836014811115610b2d57610b2d6159a0565b14610b6c5760405162461bcd60e51b815260206004820152600a602482015269216c697175696469747960b01b60448201526064015b60405180910390fd5b8015610b8057600095505050505050610c68565b600087158015610bba57506001600160a01b038087166000908152600860209081526040808320938e16835260029093019052205460ff16155b15610bc6575083610be8565b610bd1838a8a61411f565b905087158015610be057508085105b15610be85750835b6000896001600160a01b0316633b1d21a26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4c9190615987565b905080821115610c5c5780610c5e565b815b9750505050505050505b9392505050565b6001600160a01b03841660009081526008602052604081205460ff16610c995760085b9050610ca9565b610ca3858461423b565b60005b90505b949350505050565b6000610cbc826142dc565b92915050565b6000610ccc61454e565b610cdc57610cbc600160076145a2565b6040805160208082018352848252825190810190925266b1a2bc2ec50000808352815191929111610d1357610ca9600560086145a2565b6040805160208101909152670c7d713b49da000080825283511115610d4757610d3e600560086145a2565b95945050505050565b600480549086905560408051828152602081018890527f3b9670cf975d26958e754b57098eaa2ac914d8d2a31b83257997b9f346110fd991015b60405180910390a160005b9695505050505050565b6001600160a01b0383166000908152600d60205260409020805460ff19166001179055610dc3848461461b565b50505050565b6001600160a01b03831660009081526014602052604081205460ff1615610e215760405162461bcd60e51b815260206004820152600c60248201526b085b5a5b9d0e9c185d5cd95960a21b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff16610e4b5760085b9050610c68565b600f5460ff168015610e7657506001600160a01b03831660009081526010602052604090205460ff16155b15610e82576011610e44565b6000610e8d85610cb1565b90508015801590610ebc57506001600160a01b03851660009081526020805260409020610eba90856146b7565b155b15611000576000856001600160a01b0316634aeb3d9a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190615987565b9050600030604051637db121fd60e11b81526001600160a01b038981166004830152919091169063fb6243fa90602401602060405180830381865afa158015610f72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f969190615987565b90506000828210610fa957506000610fb6565b610fb382846159cc565b90505b83610fc187836159df565b10610ffc5760405162461bcd60e51b815260206004820152600b60248201526a021737570706c79206361760ac1b6044820152606401610b63565b5050505b61100a85856146d9565b600095945050505050565b600061101f61454e565b61102f57610cbc6001600d6145a2565b60408051602080820183528482528251908101909252670de0b6b3a76400008083528151919291101561106857610ca96007600e6145a2565b60408051602081019091526714d1120d7b1600008082528351111561109357610d3e6007600e6145a2565b600580549086905560408051828152602081018890527faeba5a6c40a8ac138134bff1aaa65debf25971188a58804bad717f82f0ec13169101610d81565b3360009081526008602052604090205460ff1661111a5760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610b63565b801580156111285750600082115b1561115d5760405162461bcd60e51b8152602060048201526005602482015264217a65726f60d81b6044820152606401610b63565b610dc3848461461b565b6009818154811061117757600080fd5b6000918252602090912001546001600160a01b0316905081565b600061119b61454e565b6111ab57610cbc600160126145a2565b600380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910160405180910390a160009392505050565b33301461124d5760405162461bcd60e51b815260206004820152600a602482015269085cd95b198818d85b1b60b21b6044820152606401610b63565b601a54610100900460ff1661126c57601a805461ffff19166101011790555b565b60008060008060008060008061128989600080600080613ca4565b93509350935093508360148111156112a3576112a36159a0565b99929850909650945092505050565b6001600160a01b03851660009081526008602052604081205460ff1615806112f357506001600160a01b03851660009081526008602052604090205460ff16155b156113025760085b9050610d3e565b6040516305eff7ef60e21b81526001600160a01b038481166004830152600091908816906317bfdfbc90602401602060405180830381865afa15801561134c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113709190615987565b905061137b87612069565b156113c557828110156113c05760405162461bcd60e51b815260206004820152600d60248201526c21626f72726f773e726570617960981b6044820152606401610b63565b611469565b6000806113d786600080600080613ca4565b935050509150600060148111156113f0576113f06159a0565b826014811115611402576114026159a0565b1461142357816014811115611419576114196159a0565b9350505050610d3e565b80600003611432576003611419565b600061144e604051806020016040528060045481525085614774565b905080861115611465576010945050505050610d3e565b5050505b5060009695505050505050565b3360009081526008602052604090205460ff166114d55760405162461bcd60e51b815260206004820152601f60248201527f21436f6d7074726f6c6c65723a5f61667465724e6f6e5265656e7472616e74006044820152606401610b63565b601a805460ff19166001179055565b610dc384848461478c565b601b818154811061117757600080fd5b61150a85838561478c565b5050505050565b600b818154811061117757600080fd5b600080546040805163fdb25fb160e01b8152905183926001600160a01b03169163fdb25fb19160048083019260209291908290030181865afa15801561156b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158f9190615987565b905080156116755760035460405163fc57d4df60e01b81526001600160a01b038681166004830152600092169063fc57d4df90602401602060405180830381865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190615987565b90508060000361161b57600c92505050610cbc565b60008061163660405180602001604052808581525087614830565b9092509050600082600381111561164f5761164f6159a0565b1461166257600a5b945050505050610cbc565b83811015611671576012611657565b5050505b6000949350505050565b6000806000806000806000806116988d8d8d8d8d613ca4565b93509350935093508360148111156116b2576116b26159a0565b975091955093509150505b95509550955095915050565b6040805160248082526104a08201909252606091908160208201610480803683370190505091506394543c1560e01b82611702836159f2565b92508260ff168151811061171857611718615a0f565b6001600160e01b031990921660209283029190910190910152635a2977b160e11b82611743836159f2565b92508260ff168151811061175957611759615a0f565b6001600160e01b031990921660209283029190910190910152632aff3bff60e21b82611784836159f2565b92508260ff168151811061179a5761179a615a0f565b6001600160e01b03199092166020928302919091019091015263929fe9a160e01b826117c5836159f2565b92508260ff16815181106117db576117db615a0f565b6001600160e01b0319909216602092830291909101909101526355ee1fe160e01b82611806836159f2565b92508260ff168151811061181c5761181c615a0f565b6001600160e01b03199092166020928302919091019091015263317b0b7760e01b82611847836159f2565b92508260ff168151811061185d5761185d615a0f565b6001600160e01b031990921660209283029190910190910152637201477760e11b82611888836159f2565b92508260ff168151811061189e5761189e615a0f565b6001600160e01b031990921660209283029190910190910152634fd42e1760e01b826118c9836159f2565b92508260ff16815181106118df576118df615a0f565b6001600160e01b031990921660209283029190910190910152634a956fad60e11b8261190a836159f2565b92508260ff168151811061192057611920615a0f565b6001600160e01b03199092166020928302919091019091015263c8c9c97560e01b8261194b836159f2565b92508260ff168151811061196157611961615a0f565b6001600160e01b03199092166020928302919091019091015263b9b5b15360e01b8261198c836159f2565b92508260ff16815181106119a2576119a2615a0f565b6001600160e01b031990921660209283029190910190910152637e361b1160e01b826119cd836159f2565b92508260ff16815181106119e3576119e3615a0f565b6001600160e01b031990921660209283029190910190910152630cbb414760e11b82611a0e836159f2565b92508260ff1681518110611a2457611a24615a0f565b6001600160e01b031990921660209283029190910190910152631853304760e31b82611a4f836159f2565b92508260ff1681518110611a6557611a65615a0f565b6001600160e01b031990921660209283029190910190910152630ede4edd60e41b82611a90836159f2565b92508260ff1681518110611aa657611aa6615a0f565b6001600160e01b031990921660209283029190910190910152634ef4c3e160e01b82611ad1836159f2565b92508260ff1681518110611ae757611ae7615a0f565b6001600160e01b03199092166020928302919091019091015263eabe7d9160e01b82611b12836159f2565b92508260ff1681518110611b2857611b28615a0f565b6001600160e01b0319909216602092830291909101909101526351dff98960e01b82611b53836159f2565b92508260ff1681518110611b6957611b69615a0f565b6001600160e01b03199092166020928302919091019091015263368f515360e21b82611b94836159f2565b92508260ff1681518110611baa57611baa615a0f565b6001600160e01b031990921660209283029190910190910152631de6c8a560e21b82611bd5836159f2565b92508260ff1681518110611beb57611beb615a0f565b6001600160e01b031990921660209283029190910190910152631200453160e11b82611c16836159f2565b92508260ff1681518110611c2c57611c2c615a0f565b6001600160e01b031990921660209283029190910190910152632fe3f38f60e11b82611c57836159f2565b92508260ff1681518110611c6d57611c6d615a0f565b6001600160e01b03199092166020928302919091019091015263d02f735160e01b82611c98836159f2565b92508260ff1681518110611cae57611cae615a0f565b6001600160e01b0319909216602092830291909101909101526317b9b84b60e31b82611cd9836159f2565b92508260ff1681518110611cef57611cef615a0f565b6001600160e01b0319909216602092830291909101909101526341c728b960e01b82611d1a836159f2565b92508260ff1681518110611d3057611d30615a0f565b6001600160e01b031990921660209283029190910190910152635ec88c7960e01b82611d5b836159f2565b92508260ff1681518110611d7157611d71615a0f565b6001600160e01b03199092166020928302919091019091015263c488847b60e01b82611d9c836159f2565b92508260ff1681518110611db257611db2615a0f565b6001600160e01b03199092166020928302919091019091015263c90c20b160e01b82611ddd836159f2565b92508260ff1681518110611df357611df3615a0f565b6001600160e01b03199092166020928302919091019091015263319728a160e11b82611e1e836159f2565b92508260ff1681518110611e3457611e34615a0f565b6001600160e01b031990921660209283029190910190910152632eb96f3160e11b82611e5f836159f2565b92508260ff1681518110611e7557611e75615a0f565b6001600160e01b031990921660209283029190910190910152630b33d1e960e21b82611ea0836159f2565b92508260ff1681518110611eb657611eb6615a0f565b6001600160e01b031990921660209283029190910190910152635881a44160e11b82611ee1836159f2565b92508260ff1681518110611ef757611ef7615a0f565b6001600160e01b031990921660209283029190910190910152639614b53b60e01b82611f22836159f2565b92508260ff1681518110611f3857611f38615a0f565b6001600160e01b03199092166020928302919091019091015263efcb03dd60e01b82611f63836159f2565b92508260ff1681518110611f7957611f79615a0f565b6001600160e01b031990921660209283029190910190910152636d35bf9160e01b82611fa4836159f2565b92508260ff1681518110611fba57611fba615a0f565b6001600160e01b03199092166020928302919091019091015263352b4a3f60e11b82611fe5836159f2565b92508260ff1681518110611ffb57611ffb615a0f565b6001600160e01b03199092166020928302919091019091015260ff8116156120655760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610b63565b5090565b6001600160a01b0381166000908152600860205260408120600101541580156120af57506001600160a01b03821660009081526015602052604090205460ff1615156001145b8015610cbc57506121c3612185836001600160a01b031663173b99046040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190615987565b846001600160a01b0316638d02d9a16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121809190615987565b614883565b836001600160a01b031663c3bf11cd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b670de0b6b3a76400001492915050565b60006121dd61454e565b6121ed57610cbc600160136145a2565b600f5482151560ff909116151503612206576000610cbc565b600f805460ff19168315159081179091556040519081527f84c7d948374a180eddab35d27d2f7a94167a1ff4e79467f1e89c061984190a1e906020015b60405180910390a16000610cbc565b61225c82826148b9565b5050565b6001600160a01b03811660009081526007602090815260408083208054825181850281018501909352808352606094938301828280156122c957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122ab575b5093979650505050505050565b6000610cbc82614955565b60006122eb61454e565b612302576122fb600160166145a2565b9050610d8c565b60028054600160a01b60ff60a01b1982168117909255600080546040516328f816b560e11b81529390920460ff169290916001600160a01b0316906351f02d6a90612359908c908c908c908c908c90600401615a4e565b6020604051808303816000875af1158015612378573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239c9190615a7e565b6002805460ff60a01b1916600160a01b85151502179055905060006123c0826149f4565b905060008054906101000a90046001600160a01b03166001600160a01b0316638aac2f0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124379190615a7e565b604051635a89ef5160e01b81523060048201526001600160a01b039190911690635a89ef5190602401600060405180830381600087803b15801561247a57600080fd5b505af115801561248e573d6000803e3d6000fd5b506000925061249b915050565b81146124a757806124b1565b6124b18286613570565b9a9950505050505050505050565b60006124c961454e565b6124fe5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610b63565b816001600160a01b031663abc6d72d6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561253e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125629190615a9b565b6125a65760405162461bcd60e51b815260206004820152601560248201527410b4b9a932bbb0b93239a234b9ba3934b13aba37b960591b6044820152606401610b63565b60005b60195481101561261e57601981815481106125c6576125c6615a0f565b6000918252602090912001546001600160a01b03908116908416036126165760405162461bcd60e51b815260206004820152600660248201526508585919195960d21b6044820152606401610b63565b6001016125a9565b50601980546001810182556000919091527f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950180546001600160a01b0319166001600160a01b0384169081179091556040519081527f98ef1187fb6fd2bc85f8996489877eb2b5428f9e9bdfc068c9ad6c2ea82eacc790602001612243565b601354600090600160b01b900460ff16156126ed5760405162461bcd60e51b815260206004820152601060248201526f085d1c985b9cd9995c8e9c185d5cd95960821b6044820152606401610b63565b60006126fa868685614c3b565b90508015612709579050610ca9565b612714868686614d03565b60009695505050505050565b60008054604051631beb2b9760e31b81526060926001600160a01b039092169163df595cb8916127659130913391839190356001600160e01b03191690600401615ab8565b602060405180830381865afa158015612782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a69190615a9b565b6127e35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b815160008167ffffffffffffffff811115612800576128006157a5565b604051908082528060200260200182016040528015612829578160200160208202803683370190505b50905060005b8281101561289657600085828151811061284b5761284b615a0f565b6020026020010151905061285f8133614da7565b6014811115612870576128706159a0565b83838151811061288257612882615a0f565b60209081029190910101525060010161282f565b509150505b919050565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092839283929091169063fc57d4df90602401602060405180830381865afa1580156128f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129159190615987565b60035460405163fc57d4df60e01b81526001600160a01b0388811660048301529293506000929091169063fc57d4df90602401602060405180830381865afa158015612965573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129899190615987565b9050811580612996575080155b156129aa57600c6000935093505050612bc4565b60008690506000816001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a139190615987565b90506000612a2d6040518060200160405280600081525090565b6040805160208101909152600081526040805160208101909152600081526000866001600160a01b0316636752e7026040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aaf9190615987565b90506000876001600160a01b031663be99f1196040518163ffffffff1660e01b8152600401602060405180830381865afa158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b159190615987565b90506000612b58612b446040518060200160405280600554815250604051806020016040528087815250614f41565b604051806020016040528085815250614f41565b9050612b728160405180602001604052808e815250614f76565b9550612b9a60405180602001604052808c81525060405180602001604052808b815250614f76565b9450612ba68686614fb5565b9350612bb2848f614774565b60009d509b5050505050505050505050505b935093915050565b6019818154811061117757600080fd5b6000612be661454e565b612bf657610c92600160146145a2565b60005b84811015612e71576000868683818110612c1557612c15615a0f565b9050602002016020810190612c2a919061539c565b9050848483818110612c3e57612c3e615a0f565b9050602002016020810190612c53919061566b565b15612d0b576001600160a01b03811660009081526010602052604090205460ff16612d06576001600160a01b0381166000818152601060205260408120805460ff19166001908117909155601180548083018255928190527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6890920180546001600160a01b03191690931790925554612cec91906159cc565b6001600160a01b0382166000908152601260205260409020555b612e68565b6001600160a01b03811660009081526010602052604090205460ff1615612e685760118054612d3c906001906159cc565b81548110612d4c57612d4c615a0f565b60009182526020808320909101546001600160a01b0384811684526012909252604090922054601180549290931692918110612d8a57612d8a615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506011805480612dc957612dc9615aeb565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038316825260129081905260408220546011805491939184908110612e1d57612e1d615a0f565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822094909455918416825260128352808220829055601090925220805460ff191690555b50600101612bf9565b506000610ca6565b3360009081526008602052604090205460ff16612ed85760405162461bcd60e51b815260206004820181905260248201527f21436f6d7074726f6c6c65723a5f6265666f72654e6f6e5265656e7472616e746044820152606401610b63565b601a5460ff16612f175760405162461bcd60e51b815260206004820152600a602482015269085c99595b9d195c995960b21b6044820152606401610b63565b601a805460ff19169055565b601354600090600160b81b900460ff1615612f705760405162461bcd60e51b815260206004820152600d60248201526c085cd95a5e994e9c185d5cd959609a1b6044820152606401610b63565b6001600160a01b03861660009081526008602052604090205460ff161580612fb157506001600160a01b03851660009081526008602052604090205460ff16155b15612fbd5760086112fb565b846001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301f9190615a7e565b6001600160a01b0316866001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308a9190615a7e565b6001600160a01b03161461309f5760026112fb565b612714868486614d03565b6011818154811061117757600080fd5b6001600160a01b03831660009081526015602052604081205460ff16156131145760405162461bcd60e51b815260206004820152600e60248201526d08589bdc9c9bddce9c185d5cd95960921b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff1661313b576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff1661322a57336001600160a01b038516146131ae5760405162461bcd60e51b815260206004820152600760248201526610b1ba37b5b2b760c91b6044820152606401610b63565b60006131ba3385614da7565b905060008160148111156131d0576131d06159a0565b146131ef578060148111156131e7576131e76159a0565b915050610c68565b6001600160a01b038086166000908152600860209081526040808320938816835260029093019052205460ff1661322857613228615b01565b505b60035460405163fc57d4df60e01b81526001600160a01b0386811660048301529091169063fc57d4df90602401602060405180830381865afa158015613274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132989190615987565b6000036132a657600c610e44565b600f5460ff1680156132d157506001600160a01b03831660009081526010602052604090205460ff16155b156132dd576011610e44565b60006132e8856122d6565b9050801580159061331857506001600160a01b038516600090815260216020526040902061331690856146b7565b155b1561345c576000856001600160a01b03166373acee986040518163ffffffff1660e01b8152600401602060405180830381865afa15801561335d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133819190615987565b9050600030604051631d3965af60e11b81526001600160a01b0389811660048301529190911690633a72cb5e90602401602060405180830381865afa1580156133ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f29190615987565b9050600082821061340557506000613412565b61340f82846159cc565b90505b8361341d87836159df565b106134585760405162461bcd60e51b815260206004820152600b60248201526a021626f72726f773a6361760ac1b6044820152606401610b63565b5050505b613466858561423b565b604051637e361b1160e01b81526001600160a01b0380861660048301528616602482015260006044820181905260648201859052608482018190529081903090637e361b119060a401608060405180830381865afa1580156134cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f09190615b17565b93505050915060006014811115613509576135096159a0565b821461351957509150610c689050565b801561352b5760049350505050610c68565b6000979650505050505050565b6007602052816000526040600020818154811061355457600080fd5b6000918252602090912001546001600160a01b03169150829050565b600061357a61454e565b6135915761358a600160096145a2565b9050610cbc565b6001600160a01b0383166000908152600860205260409020805460ff166135c6576135be6008600a6145a2565b915050610cbc565b60408051602080820183528582528251908101909252670c7d713b49da00008252906135f481835190511090565b1561360f576136056006600b6145a2565b9350505050610cbc565b8415801590613689575060035460405163fc57d4df60e01b81526001600160a01b0388811660048301529091169063fc57d4df90602401602060405180830381865afa158015613663573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136879190615987565b155b1561369957613605600c806145a2565b60018301805490869055604080516001600160a01b0389168152602081018390529081018790527f70483e6592cd5182d45ac970e05bc62cdcc90e9d8ef2c2dbe686cf383bcd7fc59060600160405180910390a16000979650505050505050565b600080613708858585614c3b565b90508015611000579050610c68565b60008054604051631beb2b9760e31b81526001600160a01b039091169063df595cb890613759903090339082906001600160e01b031988351690600401615ab8565b602060405180830381865afa158015613776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379a9190615a9b565b6137d75760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b6001600160a01b03821660009081526008602052604090205460ff1661383f5760405162461bcd60e51b815260206004820152601760248201527f21436f6d7074726f6c6c65723a657869744d61726b65740000000000000000006044820152606401610b63565b6040516361bfb47160e11b81523360048201528290600090819081906001600160a01b0385169063c37f68e290602401608060405180830381865afa15801561388c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b09190615b17565b50925092509250826000146138f55760405162461bcd60e51b815260206004820152600b60248201526a08595e1a5d13585c9ad95d60aa1b6044820152606401610b63565b801561390757610d8c600b60036145a2565b6000613914873385614c3b565b9050801561393457613929600d600483614fef565b979650505050505050565b6001600160a01b0387166000908152600860209081526040808320338452600281019092529091205460ff1661397257600098975050505050505050565b3360009081526002820160209081526040808320805460ff1916905560078252808320805482518185028101850190935280835291929091908301828280156139e457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116139c6575b5050835193945083925060009150505b82811015613a3e578b6001600160a01b0316848281518110613a1857613a18615a0f565b60200260200101516001600160a01b031603613a3657809150613a3e565b6001016139f4565b50818110613a4e57613a4e615b01565b33600090815260076020526040902080548190613a6d906001906159cc565b81548110613a7d57613a7d615a0f565b9060005260206000200160009054906101000a90046001600160a01b0316818381548110613aad57613aad615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080805480613aeb57613aeb615aeb565b600082815260208120820160001990810180546001600160a01b031916905590910190915581549003613c4757600b8054613b28906001906159cc565b81548110613b3857613b38615a0f565b6000918252602080832090910154338352600c909152604090912054600b80546001600160a01b03909316929091908110613b7557613b75615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b805480613bb457613bb4615aeb565b60008281526020808220830160001990810180546001600160a01b0319169055909201909255338252600c908190526040822054600b805491939184908110613bff57613bff615a0f565b60009182526020808320909101546001600160a01b03168352828101939093526040918201812093909355338352600c8252808320839055600a9091529020805460ff191690555b604080516001600160a01b038e1681523360208201527fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d910160405180910390a160009c9b505050505050505050505050565b610dc384836148b9565b600080600080613cb26152bc565b6001600160a01b03891615613d365760035460405163fc57d4df60e01b81526001600160a01b038b811660048301529091169063fc57d4df90602401602060405180830381865afa158015613d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d2f9190615987565b6101808201525b60005b6001600160a01b038b166000908152600760205260409020548110156140bb576001600160a01b038b166000908152600760205260409020805482908110613d8357613d83615a0f565b60009182526020822001546001600160a01b039081168085526040516361bfb47160e11b8152918e1660048301529063c37f68e290602401608060405180830381865afa158015613dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dfc9190615b17565b60a08701526080860152606085015290508015613e2a57600e600080600096509650965096505050506116bd565b50604080516020808201835284516001600160a01b0390811660009081526008835284902060010154835260e08601929092528251908101835260a085015181526101008501526003548451925163fc57d4df60e01b81529282166004840152169063fc57d4df90602401602060405180830381865afa158015613eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ed69190615987565b60c08301819052600003613efa57600c6000806000955095509550955050506116bd565b604080516020810190915260c0830151815261012083015260e0820151610100830151613f3591613f2a91614f76565b836101200151614f76565b610140830152308251604051633c1f884b60e11b81526001600160a01b0391821660048201528c821660248201528b151560448201528d8216606482015291169063783f109690608401602060405180830381865afa158015613f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fc09190615987565b6101a08301526101408201516060830151600091613fdd91614774565b9050826101a00151811115613ff457506101a08201515b808360200181815161400691906159df565b9052505061012082015160808301516040840151614025929190615067565b604083015281516001600160a01b03808c169116036140b3576140528261014001518a8460400151615067565b6040830181905261012083015161406a918a90615067565b60408301526101208201516000906140829089614774565b90508260400151811061409b57600060408401526140b1565b80836040018181516140ad91906159cc565b9052505b505b600101613d39565b508060400151816020015111156140f45760208101516040820151600091906140e490826159cc565b60009450945094509450506116bd565b6000816020015160008360200151846040015161411191906159cc565b9450945094509450506116bd565b60008360000361413157506000610c68565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092169063fc57d4df90602401602060405180830381865afa15801561417c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141a09190615987565b9050600081116141dc5760405162461bcd60e51b8152602060048201526007602482015266216f7261636c6560c81b6044820152606401610b63565b8261421e576001600160a01b038416600090815260086020526040902060010154670de0b6b3a76400006142108383615b4d565b61421a9190615b64565b9150505b8061423186670de0b6b3a7640000615b4d565b610d3e9190615b64565b60005b6019548110156142d7576019818154811061425b5761425b615a0f565b600091825260209091200154604051631cdc2c5d60e31b81526001600160a01b03858116600483015284811660248301529091169063e6e162e890604401600060405180830381600087803b1580156142b357600080fd5b505af11580156142c7573d6000803e3d6000fd5b50506001909201915061423e9050565b505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561452c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143829190615a7e565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156143db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143ff9190615b9e565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916144589190615c39565b600060405180830381855afa9150503d8060008114614493576040519150601f19603f3d011682016040523d82523d6000602084013e614498565b606091505b50915091508180156144ab575080516020145b156144ca57808060200190518101906144c49190615c55565b60ff1692505b60408501516144dc9060000b84615c72565b925060008312614502576144f183600a615d76565b6144fb9087615b4d565b9550614523565b61450b83615d82565b61451690600a615d76565b6145209087615b64565b95505b50505050614548565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546000906001600160a01b0316331480156145745750600254600160a81b900460ff165b8061459d57506000546001600160a01b03163314801561459d5750600254600160a01b900460ff165b905090565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156145d7576145d76159a0565b83601a8111156145e9576145e96159a0565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610c6857610c686159a0565b60005b6019548110156142d7576019818154811061463b5761463b615a0f565b600091825260209091200154604051630509462560e21b81526001600160a01b038581166004830152848116602483015290911690631425189490604401600060405180830381600087803b15801561469357600080fd5b505af11580156146a7573d6000803e3d6000fd5b50506001909201915061461e9050565b6001600160a01b03811660009081526001830160205260408120541515610c68565b60005b6019548110156142d757601981815481106146f9576146f9615a0f565b60009182526020909120015460405162e48b0f60e51b81526001600160a01b038581166004830152848116602483015290911690631c9161e090604401600060405180830381600087803b15801561475057600080fd5b505af1158015614764573d6000803e3d6000fd5b5050600190920191506146dc9050565b6000806147818484615088565b9050610ca9816150b0565b60005b601954811015610dc357601981815481106147ac576147ac615a0f565b600091825260209091200154604051632a29f11f60e21b81526001600160a01b038681166004830152858116602483015284811660448301529091169063a8a7c47c90606401600060405180830381600087803b15801561480c57600080fd5b505af1158015614820573d6000803e3d6000fd5b50506001909201915061478f9050565b60008060008061484086866150c8565b90925090506000826003811115614859576148596159a0565b1461486a575091506000905061487c565b6000614875826150b0565b9350935050505b9250929050565b6000610c688383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b815250615144565b60005b6019548110156142d757601981815481106148d9576148d9615a0f565b60009182526020909120015460405163d27c545360e01b81526001600160a01b03858116600483015284811660248301529091169063d27c545390604401600060405180830381600087803b15801561493157600080fd5b505af1158015614945573d6000803e3d6000fd5b5050600190920191506148bc9050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b93830193909352156149d7576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60006149fe61454e565b614a0e57610cbc600160166145a2565b6001600160a01b03821660009081526008602052604090205460ff1615614a3b57610cbc600960156145a2565b306001600160a01b0316826001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614aa79190615a7e565b6001600160a01b031614614aec5760405162461bcd60e51b815260206004820152600c60248201526b10b1b7b6b83a3937b63632b960a11b6044820152606401610b63565b6000826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b509190615a7e565b6001600160a01b038082166000908152600e60205260409020549192501615614b7f57610c68600960156145a2565b6001600160a01b038381166000818152600860209081526040808320805460ff1916600190811782558082018590556009805491820190557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b031990811687179091559587168452600e835292819020805490951684179094559251918252917fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f910160405180910390a16000610ca9565b6001600160a01b03831660009081526008602052604081205460ff16614c62576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff16614c9a576000610e44565b600080614cab858786600080613ca4565b93505050915060006014811115614cc457614cc46159a0565b826014811115614cd657614cd66159a0565b14614cf657816014811115614ced57614ced6159a0565b92505050610c68565b8015612714576004614ced565b60005b601954811015610dc35760198181548110614d2357614d23615a0f565b600091825260209091200154604051634e081c9560e01b81526001600160a01b0386811660048301528581166024830152848116604483015290911690634e081c9590606401600060405180830381600087803b158015614d8357600080fd5b505af1158015614d97573d6000803e3d6000fd5b505060019092019150614d069050565b6001600160a01b0382166000908152600860205260408120805460ff16614dd2576008915050610cbc565b6001600160a01b038316600090815260028201602052604090205460ff161515600103614e03576000915050610cbc565b6001600160a01b03838116600081815260028401602090815260408083208054600160ff199091168117909155600783528184208054918201815584528284200180546001600160a01b031916958a1695909517909455918152600a909152205460ff16614ef457600b8054600180820183557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990910180546001600160a01b0319166001600160a01b0387169081179091556000908152600a60205260409020805460ff1916821790559054614eda91906159cc565b6001600160a01b0384166000908152600c60205260409020555b604080516001600160a01b038087168252851660208201527f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a5910160405180910390a15060009392505050565b6040805160208101909152600081526040518060200160405280614f6d85600001518560000151614883565b90529392505050565b6040805160208101909152600081526040518060200160405280670de0b6b3a7640000614fab8660000151866000015161517e565b614f6d9190615b64565b6040805160208101909152600081526040518060200160405280614f6d614fe88660000151670de0b6b3a764000061517e565b85516151c0565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846014811115615024576150246159a0565b84601a811115615036576150366159a0565b604080519283526020830191909152810184905260600160405180910390a1836014811115610ca957610ca96159a0565b6000806150748585615088565b9050610d3e615082826150b0565b84614883565b6040805160208101909152600081526040518060200160405280614f6d85600001518561517e565b8051600090610cbc90670de0b6b3a764000090615b64565b60006150e06040518060200160405280600081525090565b6000806150f18660000151866151f3565b9092509050600082600381111561510a5761510a6159a0565b146151295750604080516020810190915260008152909250905061487c565b60408051602081019091529081526000969095509350505050565b60008061515184866159df565b905082858210156151755760405162461bcd60e51b8152600401610b639190615d9e565b50949350505050565b6000610c6883836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f7700000000000000000081525061523d565b6000610c6883836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250615290565b600080836000036152095750600090508061487c565b838302836152178683615b64565b1461522a5760026000925092505061487c565b60009250905061487c565b509250929050565b600083158061524a575082155b1561525757506000610c68565b60006152638486615b4d565b9050836152708683615b64565b1483906151755760405162461bcd60e51b8152600401610b639190615d9e565b600081836152b15760405162461bcd60e51b8152600401610b639190615d9e565b50610ca98385615b64565b604051806101c0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016153186040518060200160405280600081525090565b81526020016153336040518060200160405280600081525090565b815260200161534e6040518060200160405280600081525090565b81526020016153696040518060200160405280600081525090565b81526020016000815260200160008152602001600081525090565b6001600160a01b038116811461539957600080fd5b50565b6000602082840312156153ae57600080fd5b8135610c6881615384565b801515811461539957600080fd5b6000806000606084860312156153dc57600080fd5b83356153e781615384565b925060208401356153f781615384565b91506040840135615407816153b9565b809150509250925092565b6000806040838503121561542557600080fd5b823561543081615384565b9150602083013561544081615384565b809150509250929050565b6000806000806080858703121561546157600080fd5b843561546c81615384565b9350602085013561547c81615384565b9250604085013561548c81615384565b9396929550929360600135925050565b6000602082840312156154ae57600080fd5b5035919050565b600080600080608085870312156154cb57600080fd5b84356154d681615384565b935060208501356154e681615384565b93969395505050506040820135916060013590565b60008060006060848603121561551057600080fd5b833561551b81615384565b9250602084013561552b81615384565b929592945050506040919091013590565b600080600080600060a0868803121561555457600080fd5b853561555f81615384565b9450602086013561556f81615384565b9350604086013561557f81615384565b9250606086013561558f81615384565b949793965091946080013592915050565b600080604083850312156155b357600080fd5b82356155be81615384565b946020939093013593505050565b600080600080600060a086880312156155e457600080fd5b85356155ef81615384565b945060208601356155ff81615384565b94979496505050506040830135926060810135926080909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160e01b03191683529284019291840191600101615639565b50909695505050505050565b60006020828403121561567d57600080fd5b8135610c68816153b9565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160a01b0316835292840192918401916001016156a4565b60ff8116811461539957600080fd5b60008083601f8401126156ea57600080fd5b50813567ffffffffffffffff81111561570257600080fd5b60208301915083602082850101111561487c57600080fd5b6000806000806000806080878903121561573357600080fd5b863561573e816156c9565b9550602087013567ffffffffffffffff8082111561575b57600080fd5b6157678a838b016156d8565b9097509550604089013591508082111561578057600080fd5b5061578d89828a016156d8565b979a9699509497949695606090950135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156157e4576157e46157a5565b604052919050565b600060208083850312156157ff57600080fd5b823567ffffffffffffffff8082111561581757600080fd5b818501915085601f83011261582b57600080fd5b81358181111561583d5761583d6157a5565b8060051b915061584e8483016157bb565b818152918301840191848101908884111561586857600080fd5b938501935b83851015615892578435925061588283615384565b828252938501939085019061586d565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561565f578351835292840192918401916001016158ba565b60008083601f8401126158e857600080fd5b50813567ffffffffffffffff81111561590057600080fd5b6020830191508360208260051b850101111561487c57600080fd5b6000806000806040858703121561593157600080fd5b843567ffffffffffffffff8082111561594957600080fd5b615955888389016158d6565b9096509450602087013591508082111561596e57600080fd5b5061597b878288016158d6565b95989497509550505050565b60006020828403121561599957600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610cbc57610cbc6159b6565b80820180821115610cbc57610cbc6159b6565b600060ff821680615a0557615a056159b6565b6000190192915050565b634e487b7160e01b600052603260045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60ff86168152606060208201526000615a6b606083018688615a25565b8281036040840152615892818587615a25565b600060208284031215615a9057600080fd5b8151610c6881615384565b600060208284031215615aad57600080fd5b8151610c68816153b9565b6001600160a01b0394851681529284166020840152921660408201526001600160e01b0319909116606082015260800190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60008060008060808587031215615b2d57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbc57610cbc6159b6565b600082615b8157634e487b7160e01b600052601260045260246000fd5b500490565b805167ffffffffffffffff8116811461289b57600080fd5b600060608284031215615bb057600080fd5b6040516060810181811067ffffffffffffffff82111715615bd357615bd36157a5565b604052615bdf83615b86565b8152615bed60208401615b86565b6020820152604083015163ffffffff81168114615c0957600080fd5b60408201529392505050565b60005b83811015615c30578181015183820152602001615c18565b50506000910152565b60008251615c4b818460208701615c15565b9190910192915050565b600060208284031215615c6757600080fd5b8151610c68816156c9565b8082018281126000831280158216821582161715615c9257615c926159b6565b505092915050565b600181815b80851115615235578160001904821115615cbb57615cbb6159b6565b80851615615cc857918102915b93841c9390800290615c9f565b600082615ce457506001610cbc565b81615cf157506000610cbc565b8160018114615d075760028114615d1157615d2d565b6001915050610cbc565b60ff841115615d2257615d226159b6565b50506001821b610cbc565b5060208310610133831016604e8410600b8410161715615d50575081810a610cbc565b615d5a8383615c9a565b8060001904821115615d6e57615d6e6159b6565b029392505050565b6000610c688383615cd5565b6000600160ff1b8201615d9757615d976159b6565b5060000390565b6020815260008251806020840152615dbd816040850160208701615c15565b601f01601f1916919091016040019291505056fea2646970667358221220d9f93c110e8cd1b5baaa4cd98b1209822d474748896ab5a95ec21b2e101cb0b364736f6c63430008160033", + "numDeployments": 5, + "solcInputHash": "b983f3d49ecb24251a5a4f735e4e3ec3", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardsDistributor\",\"type\":\"address\"}],\"name\":\"AddedRewardsDistributor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"MarketEntered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"MarketExited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"MarketListed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldCloseFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newCloseFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewCloseFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldCollateralFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newCollateralFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewCollateralFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldLiquidationIncentiveMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newLiquidationIncentiveMantissa\",\"type\":\"uint256\"}],\"name\":\"NewLiquidationIncentive\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract BasePriceOracle\",\"name\":\"oldPriceOracle\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract BasePriceOracle\",\"name\":\"newPriceOracle\",\"type\":\"address\"}],\"name\":\"NewPriceOracle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enforce\",\"type\":\"bool\"}],\"name\":\"WhitelistEnforcementChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"distributor\",\"type\":\"address\"}],\"name\":\"_addRewardsDistributor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_afterNonReentrant\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_becomeImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_beforeNonReentrant\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"delegateType\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"constructorData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"becomeImplData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_deployMarket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newCloseFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_setCloseFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newCollateralFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_setCollateralFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newLiquidationIncentiveMantissa\",\"type\":\"uint256\"}],\"name\":\"_setLiquidationIncentive\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"newOracle\",\"type\":\"address\"}],\"name\":\"_setPriceOracle\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"enforce\",\"type\":\"bool\"}],\"name\":\"_setWhitelistEnforcement\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"suppliers\",\"type\":\"address[]\"},{\"internalType\":\"bool[]\",\"name\":\"statuses\",\"type\":\"bool[]\"}],\"name\":\"_setWhitelistStatuses\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"accountAssets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allBorrowers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"}],\"name\":\"borrowAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCapForCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowCapGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"}],\"name\":\"borrowVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"accountBorrowsNew\",\"type\":\"uint256\"}],\"name\":\"borrowWithinLimits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowingAgainstCollateralBlacklist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"cTokensByUnderlying\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"checkMembership\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"closeFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveBorrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveSupplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplyCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforceWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"cTokens\",\"type\":\"address[]\"}],\"name\":\"enterMarkets\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenAddress\",\"type\":\"address\"}],\"name\":\"exitMarket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAssetsIn\",\"outputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenModify\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"getHypotheticalAccountLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"contract ICErc20\",\"name\":\"cTokenModify\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isBorrow\",\"type\":\"bool\"}],\"name\":\"getMaxRedeemOrBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isComptroller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"liquidateBorrowAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"actualRepayAmount\",\"type\":\"uint256\"}],\"name\":\"liquidateCalculateSeizeTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationIncentiveMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"markets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isListed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mintAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"actualMintAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"}],\"name\":\"mintVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nonAccruingRewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeemAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeemVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seizeAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seizeGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenBorrowed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seizeVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"suppliers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"src\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"transferTokens\",\"type\":\"uint256\"}],\"name\":\"transferAllowed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transferGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"src\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"transferTokens\",\"type\":\"uint256\"}],\"name\":\"transferVerify\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistArray\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Compound\",\"details\":\"This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\",\"events\":{\"Failure(uint256,uint256,uint256)\":{\"details\":\"`error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.*\"}},\"kind\":\"dev\",\"methods\":{\"_addRewardsDistributor(address)\":{\"details\":\"Admin function to add a RewardsDistributor contract\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_afterNonReentrant()\":{\"details\":\"Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention. Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\"},\"_beforeNonReentrant()\":{\"details\":\"Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention. Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\"},\"_deployMarket(uint8,bytes,bytes,uint256)\":{\"details\":\"Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See enum Error for details)\"}},\"_getExtensionFunctions()\":{\"returns\":{\"functionSelectors\":\"a list of all the function selectors that this logic extension exposes\"}},\"_setCloseFactor(uint256)\":{\"details\":\"Admin function to set closeFactor\",\"params\":{\"newCloseFactorMantissa\":\"New close factor, scaled by 1e18\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See ErrorReporter for details)\"}},\"_setCollateralFactor(address,uint256)\":{\"details\":\"Admin function to set per-market collateralFactor\",\"params\":{\"cToken\":\"The market to set the factor on\",\"newCollateralFactorMantissa\":\"The new collateral factor, scaled by 1e18\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See ErrorReporter for details)\"}},\"_setLiquidationIncentive(uint256)\":{\"details\":\"Admin function to set liquidationIncentive\",\"params\":{\"newLiquidationIncentiveMantissa\":\"New liquidationIncentive scaled by 1e18\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See ErrorReporter for details)\"}},\"_setPriceOracle(address)\":{\"details\":\"Admin function to set a new price oracle\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_setWhitelistEnforcement(bool)\":{\"details\":\"Admin function to set a new whitelist enforcement boolean\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"_setWhitelistStatuses(address[],bool[])\":{\"details\":\"Admin function to set the whitelist `statuses` for `suppliers`\",\"returns\":{\"_0\":\"uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\"}},\"borrowAllowed(address,address,uint256)\":{\"params\":{\"borrowAmount\":\"The amount of underlying the account would borrow\",\"borrower\":\"The account which would borrow the asset\",\"cToken\":\"The market to verify the borrow against\"},\"returns\":{\"_0\":\"0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"borrowVerify(address,address)\":{\"params\":{\"borrower\":\"The account which borrowed the asset\",\"cToken\":\"The market to verify the borrow against\"}},\"borrowWithinLimits(address,uint256)\":{\"params\":{\"accountBorrowsNew\":\"The user's new borrow balance of the underlying asset\",\"cToken\":\"Asset whose underlying is being borrowed\"}},\"checkMembership(address,address)\":{\"params\":{\"account\":\"The address of the account to check\",\"cToken\":\"The cToken to check\"},\"returns\":{\"_0\":\"True if the account is in the asset, otherwise false.\"}},\"effectiveBorrowCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"effectiveSupplyCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"enterMarkets(address[])\":{\"params\":{\"cTokens\":\"The list of addresses of the cToken markets to be enabled\"},\"returns\":{\"_0\":\"Success indicator for whether each corresponding market was entered\"}},\"exitMarket(address)\":{\"details\":\"Sender must not have an outstanding borrow balance in the asset, or be providing necessary collateral for an outstanding borrow.\",\"params\":{\"cTokenAddress\":\"The address of the asset to be removed\"},\"returns\":{\"_0\":\"Whether or not the account successfully exited the market\"}},\"getAssetsIn(address)\":{\"params\":{\"account\":\"The address of the account to pull assets for\"},\"returns\":{\"_0\":\"A dynamic list with the assets the account has entered\"}},\"getHypotheticalAccountLiquidity(address,address,uint256,uint256,uint256)\":{\"params\":{\"account\":\"The account to determine liquidity for\",\"borrowAmount\":\"The amount of underlying to hypothetically borrow\",\"cTokenModify\":\"The market to hypothetically redeem/borrow in\",\"redeemTokens\":\"The number of tokens to hypothetically redeem\"},\"returns\":{\"_0\":\"(possible error code (semi-opaque), hypothetical account liquidity in excess of collateral requirements, hypothetical account shortfall below collateral requirements)\"}},\"isDeprecated(address)\":{\"details\":\"All borrows in a deprecated cToken market can be immediately liquidated\",\"params\":{\"cToken\":\"The market to check if deprecated\"}},\"liquidateBorrowAllowed(address,address,address,address,uint256)\":{\"params\":{\"borrower\":\"The address of the borrower\",\"cTokenBorrowed\":\"Asset which was borrowed by the borrower\",\"cTokenCollateral\":\"Asset which was used as collateral and will be seized\",\"liquidator\":\"The address repaying the borrow and seizing the collateral\",\"repayAmount\":\"The amount of underlying being repaid\"}},\"liquidateCalculateSeizeTokens(address,address,uint256)\":{\"details\":\"Used in liquidation (called in cToken.liquidateBorrowFresh)\",\"params\":{\"actualRepayAmount\":\"The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\",\"cTokenBorrowed\":\"The address of the borrowed cToken\",\"cTokenCollateral\":\"The address of the collateral cToken\"},\"returns\":{\"_0\":\"(errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\"}},\"mintAllowed(address,address,uint256)\":{\"params\":{\"cTokenAddress\":\"The market to verify the mint against\",\"mintAmount\":\"The amount of underlying being supplied to the market in exchange for tokens\",\"minter\":\"The account which would get the minted tokens\"},\"returns\":{\"_0\":\"0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"mintVerify(address,address,uint256,uint256)\":{\"params\":{\"actualMintAmount\":\"The amount of the underlying asset being minted\",\"cToken\":\"Asset being minted\",\"mintTokens\":\"The number of tokens being minted\",\"minter\":\"The address minting the tokens\"}},\"redeemAllowed(address,address,uint256)\":{\"params\":{\"cToken\":\"The market to verify the redeem against\",\"redeemTokens\":\"The number of cTokens to exchange for the underlying asset in the market\",\"redeemer\":\"The account which would redeem the tokens\"},\"returns\":{\"_0\":\"0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"redeemVerify(address,address,uint256,uint256)\":{\"params\":{\"cToken\":\"Asset being redeemed\",\"redeemAmount\":\"The amount of the underlying asset being redeemed\",\"redeemTokens\":\"The number of tokens being redeemed\",\"redeemer\":\"The address redeeming the tokens\"}},\"repayBorrowAllowed(address,address,address,uint256)\":{\"params\":{\"borrower\":\"The account which would borrowed the asset\",\"cToken\":\"The market to verify the repay against\",\"payer\":\"The account which would repay the asset\",\"repayAmount\":\"The amount of the underlying asset the account would repay\"},\"returns\":{\"_0\":\"0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"repayBorrowVerify(address,address,address,uint256)\":{\"params\":{\"borrower\":\"The account which borrowed the asset\",\"cToken\":\"The market to verify the repay against\",\"payer\":\"The account which repayed the asset\",\"repayAmount\":\"The amount of the underlying asset the account repayed\"}},\"seizeAllowed(address,address,address,address,uint256)\":{\"params\":{\"borrower\":\"The address of the borrower\",\"cTokenBorrowed\":\"Asset which was borrowed by the borrower\",\"cTokenCollateral\":\"Asset which was used as collateral and will be seized\",\"liquidator\":\"The address repaying the borrow and seizing the collateral\",\"seizeTokens\":\"The number of collateral tokens to seize\"}},\"seizeVerify(address,address,address,address,uint256)\":{\"params\":{\"borrower\":\"The address of the borrower\",\"cTokenBorrowed\":\"Asset which was borrowed by the borrower\",\"cTokenCollateral\":\"Asset which was used as collateral and will be seized\",\"liquidator\":\"The address repaying the borrow and seizing the collateral\",\"seizeTokens\":\"The number of collateral tokens to seize\"}},\"transferAllowed(address,address,address,uint256)\":{\"params\":{\"cToken\":\"The market to verify the transfer against\",\"dst\":\"The account which receives the tokens\",\"src\":\"The account which sources the tokens\",\"transferTokens\":\"The number of cTokens to transfer\"},\"returns\":{\"_0\":\"0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\"}},\"transferVerify(address,address,address,uint256)\":{\"params\":{\"cToken\":\"The market to verify the transfer against\",\"dst\":\"The account which receives the tokens\",\"src\":\"The account which sources the tokens\",\"transferTokens\":\"The number of cTokens to transfer\"}}},\"title\":\"Compound's Comptroller Contract\",\"version\":1},\"userdoc\":{\"events\":{\"AddedRewardsDistributor(address)\":{\"notice\":\"Emitted when a new RewardsDistributor contract is added to hooks\"},\"MarketEntered(address,address)\":{\"notice\":\"Emitted when an account enters a market\"},\"MarketExited(address,address)\":{\"notice\":\"Emitted when an account exits a market\"},\"MarketListed(address)\":{\"notice\":\"Emitted when an admin supports a market\"},\"NewCloseFactor(uint256,uint256)\":{\"notice\":\"Emitted when close factor is changed by admin\"},\"NewCollateralFactor(address,uint256,uint256)\":{\"notice\":\"Emitted when a collateral factor is changed by admin\"},\"NewLiquidationIncentive(uint256,uint256)\":{\"notice\":\"Emitted when liquidation incentive is changed by admin\"},\"NewPriceOracle(address,address)\":{\"notice\":\"Emitted when price oracle is changed\"},\"WhitelistEnforcementChanged(bool)\":{\"notice\":\"Emitted when the whitelist enforcement is changed\"}},\"kind\":\"user\",\"methods\":{\"_addRewardsDistributor(address)\":{\"notice\":\"Add a RewardsDistributor contracts.\"},\"_deployMarket(uint8,bytes,bytes,uint256)\":{\"notice\":\"Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\"},\"_setCloseFactor(uint256)\":{\"notice\":\"Sets the closeFactor used when liquidating borrows\"},\"_setCollateralFactor(address,uint256)\":{\"notice\":\"Sets the collateralFactor for a market\"},\"_setLiquidationIncentive(uint256)\":{\"notice\":\"Sets liquidationIncentive\"},\"_setPriceOracle(address)\":{\"notice\":\"Sets a new price oracle for the comptroller\"},\"_setWhitelistEnforcement(bool)\":{\"notice\":\"Sets the whitelist enforcement for the comptroller\"},\"_setWhitelistStatuses(address[],bool[])\":{\"notice\":\"Sets the whitelist `statuses` for `suppliers`\"},\"accountAssets(address,uint256)\":{\"notice\":\"Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\"},\"admin()\":{\"notice\":\"Administrator for this contract\"},\"adminHasRights()\":{\"notice\":\"Whether or not the admin has admin rights\"},\"allBorrowers(uint256)\":{\"notice\":\"A list of all borrowers who have entered markets\"},\"allMarkets(uint256)\":{\"notice\":\"A list of all markets\"},\"borrowAllowed(address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to borrow the underlying asset of the given market\"},\"borrowCapGuardian()\":{\"notice\":\"The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\"},\"borrowCaps(address)\":{\"notice\":\"Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\"},\"borrowVerify(address,address)\":{\"notice\":\"Validates borrow the underlying asset of the given market\"},\"borrowWithinLimits(address,uint256)\":{\"notice\":\"Checks if the account should be allowed to borrow the underlying asset of the given market\"},\"cTokensByUnderlying(address)\":{\"notice\":\"All cTokens addresses mapped by their underlying token addresses\"},\"checkMembership(address,address)\":{\"notice\":\"Returns whether the given account is entered in the given asset\"},\"closeFactorMantissa()\":{\"notice\":\"Multiplier used to calculate the maximum repayAmount when liquidating a borrow\"},\"effectiveBorrowCaps(address)\":{\"notice\":\"Gets the borrow cap of a cToken in the units of the underlying asset.\"},\"effectiveSupplyCaps(address)\":{\"notice\":\"Gets the supply cap of a cToken in the units of the underlying asset.\"},\"enforceWhitelist()\":{\"notice\":\"Whether or not the supplier whitelist is enforced\"},\"enterMarkets(address[])\":{\"notice\":\"Add assets to be included in account liquidity calculation\"},\"exitMarket(address)\":{\"notice\":\"Removes asset from sender's account liquidity calculation\"},\"getAssetsIn(address)\":{\"notice\":\"Returns the assets an account has entered\"},\"getHypotheticalAccountLiquidity(address,address,uint256,uint256,uint256)\":{\"notice\":\"Determine what the account liquidity would be if the given amounts were redeemed/borrowed\"},\"ionicAdminHasRights()\":{\"notice\":\"Whether or not the Ionic admin has admin rights\"},\"isComptroller()\":{\"notice\":\"Indicator that this is a Comptroller contract (for inspection)\"},\"isDeprecated(address)\":{\"notice\":\"Returns true if the given cToken market has been deprecated\"},\"liquidateBorrowAllowed(address,address,address,address,uint256)\":{\"notice\":\"Checks if the liquidation should be allowed to occur\"},\"liquidateCalculateSeizeTokens(address,address,uint256)\":{\"notice\":\"Calculate number of tokens of collateral asset to seize given an underlying amount\"},\"liquidationIncentiveMantissa()\":{\"notice\":\"Multiplier representing the discount on collateral that a liquidator receives\"},\"markets(address)\":{\"notice\":\"Official mapping of cTokens -> Market metadata\"},\"mintAllowed(address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to mint tokens in the given market\"},\"mintVerify(address,address,uint256,uint256)\":{\"notice\":\"Validates mint and reverts on rejection. May emit logs.\"},\"nonAccruingRewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor to list for claiming, but not to notify of flywheel changes.\"},\"oracle()\":{\"notice\":\"Oracle which gives the price of any given asset\"},\"pauseGuardian()\":{\"notice\":\"The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing / transfer can only be paused globally, not by market.\"},\"pendingAdmin()\":{\"notice\":\"Pending administrator for this contract\"},\"redeemAllowed(address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to redeem tokens in the given market\"},\"redeemVerify(address,address,uint256,uint256)\":{\"notice\":\"Validates redeem and reverts on rejection. May emit logs.\"},\"repayBorrowAllowed(address,address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to repay a borrow in the given market\"},\"repayBorrowVerify(address,address,address,uint256)\":{\"notice\":\"Validates that blacklisted balances are updated after borrow repayment\"},\"rewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor contracts to notify of flywheel changes.\"},\"seizeAllowed(address,address,address,address,uint256)\":{\"notice\":\"Checks if the seizing of assets should be allowed to occur\"},\"seizeVerify(address,address,address,address,uint256)\":{\"notice\":\"Validates that blacklisted balances are updated after seizing of assets\"},\"supplyCaps(address)\":{\"notice\":\"Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\"},\"transferAllowed(address,address,address,uint256)\":{\"notice\":\"Checks if the account should be allowed to transfer tokens in the given market\"},\"transferVerify(address,address,address,uint256)\":{\"notice\":\"Validates that blacklisted balances are updated after transfering assets\"},\"whitelist(address)\":{\"notice\":\"Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\"},\"whitelistArray(uint256)\":{\"notice\":\"An array of all whitelisted accounts\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/Comptroller.sol\":\"Comptroller\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x98f176ae2753880b0751466561ae0d66c4de612f238454deb1b89243b5067beb\",\"license\":\"UNLICENSED\"},\"contracts/compound/CarefulMath.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Careful Math\\n * @author Compound\\n * @notice Derived from OpenZeppelin's SafeMath library\\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\\n */\\ncontract CarefulMath {\\n /**\\n * @dev Possible error codes that we can return\\n */\\n enum MathError {\\n NO_ERROR,\\n DIVISION_BY_ZERO,\\n INTEGER_OVERFLOW,\\n INTEGER_UNDERFLOW\\n }\\n\\n /**\\n * @dev Multiplies two numbers, returns an error on overflow.\\n */\\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n if (a == 0) {\\n return (MathError.NO_ERROR, 0);\\n }\\n\\n uint256 c;\\n unchecked {\\n c = a * b;\\n }\\n\\n if (c / a != b) {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n } else {\\n return (MathError.NO_ERROR, c);\\n }\\n }\\n\\n /**\\n * @dev Integer division of two numbers, truncating the quotient.\\n */\\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n if (b == 0) {\\n return (MathError.DIVISION_BY_ZERO, 0);\\n }\\n\\n return (MathError.NO_ERROR, a / b);\\n }\\n\\n /**\\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\\n */\\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n if (b <= a) {\\n return (MathError.NO_ERROR, a - b);\\n } else {\\n return (MathError.INTEGER_UNDERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev Adds two numbers, returns an error on overflow.\\n */\\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\\n uint256 c;\\n unchecked {\\n c = a + b;\\n }\\n\\n if (c >= a) {\\n return (MathError.NO_ERROR, c);\\n } else {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev add a and b and then subtract c\\n */\\n function addThenSubUInt(\\n uint256 a,\\n uint256 b,\\n uint256 c\\n ) internal pure returns (MathError, uint256) {\\n (MathError err0, uint256 sum) = addUInt(a, b);\\n\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, 0);\\n }\\n\\n return subUInt(sum, c);\\n }\\n}\\n\",\"keccak256\":\"0x7425598d767521ba25277a7f95273c4705721aef0d7f2cd855cb6a61de709a7c\",\"license\":\"UNLICENSED\"},\"contracts/compound/Comptroller.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { ComptrollerErrorReporter } from \\\"./ErrorReporter.sol\\\";\\nimport { Exponential } from \\\"./Exponential.sol\\\";\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { Unitroller } from \\\"./Unitroller.sol\\\";\\nimport { IFeeDistributor } from \\\"./IFeeDistributor.sol\\\";\\nimport { IIonicFlywheel } from \\\"../ionic/strategies/flywheel/IIonicFlywheel.sol\\\";\\nimport { DiamondExtension, DiamondBase, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \\\"./ComptrollerInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @title Compound's Comptroller Contract\\n * @author Compound\\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\\n */\\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice Emitted when an admin supports a market\\n event MarketListed(ICErc20 cToken);\\n\\n /// @notice Emitted when an account enters a market\\n event MarketEntered(ICErc20 cToken, address account);\\n\\n /// @notice Emitted when an account exits a market\\n event MarketExited(ICErc20 cToken, address account);\\n\\n /// @notice Emitted when close factor is changed by admin\\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\\n\\n /// @notice Emitted when a collateral factor is changed by admin\\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\\n\\n /// @notice Emitted when liquidation incentive is changed by admin\\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\\n\\n /// @notice Emitted when price oracle is changed\\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\\n\\n /// @notice Emitted when the whitelist enforcement is changed\\n event WhitelistEnforcementChanged(bool enforce);\\n\\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\\n event AddedRewardsDistributor(address rewardsDistributor);\\n\\n // closeFactorMantissa must be strictly greater than this value\\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\\n\\n // closeFactorMantissa must not exceed this value\\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\\n\\n // No collateralFactorMantissa may exceed this value\\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\\n\\n // liquidationIncentiveMantissa must be no less than this value\\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\\n\\n // liquidationIncentiveMantissa must be no greater than this value\\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\\n\\n modifier isAuthorized() {\\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \\\"not authorized\\\");\\n _;\\n }\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(\\n address cToken\\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\\n return ComptrollerBase.effectiveSupplyCaps(cToken);\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(\\n address cToken\\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\\n return ComptrollerBase.effectiveBorrowCaps(cToken);\\n }\\n\\n /*** Assets You Are In ***/\\n\\n /**\\n * @notice Returns the assets an account has entered\\n * @param account The address of the account to pull assets for\\n * @return A dynamic list with the assets the account has entered\\n */\\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\\n ICErc20[] memory assetsIn = accountAssets[account];\\n\\n return assetsIn;\\n }\\n\\n /**\\n * @notice Returns whether the given account is entered in the given asset\\n * @param account The address of the account to check\\n * @param cToken The cToken to check\\n * @return True if the account is in the asset, otherwise false.\\n */\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\\n return markets[address(cToken)].accountMembership[account];\\n }\\n\\n /**\\n * @notice Add assets to be included in account liquidity calculation\\n * @param cTokens The list of addresses of the cToken markets to be enabled\\n * @return Success indicator for whether each corresponding market was entered\\n */\\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\\n uint256 len = cTokens.length;\\n\\n uint256[] memory results = new uint256[](len);\\n for (uint256 i = 0; i < len; i++) {\\n ICErc20 cToken = ICErc20(cTokens[i]);\\n\\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\\n }\\n\\n return results;\\n }\\n\\n /**\\n * @notice Add the market to the borrower's \\\"assets in\\\" for liquidity calculations\\n * @param cToken The market to enter\\n * @param borrower The address of the account to modify\\n * @return Success indicator for whether the market was entered\\n */\\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\\n Market storage marketToJoin = markets[address(cToken)];\\n\\n if (!marketToJoin.isListed) {\\n // market is not listed, cannot join\\n return Error.MARKET_NOT_LISTED;\\n }\\n\\n if (marketToJoin.accountMembership[borrower] == true) {\\n // already joined\\n return Error.NO_ERROR;\\n }\\n\\n // survived the gauntlet, add to list\\n // NOTE: we store these somewhat redundantly as a significant optimization\\n // this avoids having to iterate through the list for the most common use cases\\n // that is, only when we need to perform liquidity checks\\n // and not whenever we want to check if an account is in a particular market\\n marketToJoin.accountMembership[borrower] = true;\\n accountAssets[borrower].push(cToken);\\n\\n // Add to allBorrowers\\n if (!borrowers[borrower]) {\\n allBorrowers.push(borrower);\\n borrowers[borrower] = true;\\n borrowerIndexes[borrower] = allBorrowers.length - 1;\\n }\\n\\n emit MarketEntered(cToken, borrower);\\n\\n return Error.NO_ERROR;\\n }\\n\\n /**\\n * @notice Removes asset from sender's account liquidity calculation\\n * @dev Sender must not have an outstanding borrow balance in the asset,\\n * or be providing necessary collateral for an outstanding borrow.\\n * @param cTokenAddress The address of the asset to be removed\\n * @return Whether or not the account successfully exited the market\\n */\\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\\n // TODO\\n require(markets[cTokenAddress].isListed, \\\"!Comptroller:exitMarket\\\");\\n\\n ICErc20 cToken = ICErc20(cTokenAddress);\\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\\n require(oErr == 0, \\\"!exitMarket\\\"); // semi-opaque error code\\n\\n /* Fail if the sender has a borrow balance */\\n if (amountOwed != 0) {\\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\\n }\\n\\n /* Fail if the sender is not permitted to redeem all of their tokens */\\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\\n if (allowed != 0) {\\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\\n }\\n\\n Market storage marketToExit = markets[cTokenAddress];\\n\\n /* Return true if the sender is not already \\u2018in\\u2019 the market */\\n if (!marketToExit.accountMembership[msg.sender]) {\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /* Set cToken account membership to false */\\n delete marketToExit.accountMembership[msg.sender];\\n\\n /* Delete cToken from the account\\u2019s list of assets */\\n // load into memory for faster iteration\\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\\n uint256 len = userAssetList.length;\\n uint256 assetIndex = len;\\n for (uint256 i = 0; i < len; i++) {\\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\\n assetIndex = i;\\n break;\\n }\\n }\\n\\n // We *must* have found the asset in the list or our redundant data structure is broken\\n assert(assetIndex < len);\\n\\n // copy last item in list to location of item to be removed, reduce length by 1\\n ICErc20[] storage storedList = accountAssets[msg.sender];\\n storedList[assetIndex] = storedList[storedList.length - 1];\\n storedList.pop();\\n\\n // If the user has exited all markets, remove them from the `allBorrowers` array\\n if (storedList.length == 0) {\\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\\n allBorrowers.pop(); // Reduce length by 1\\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\\n }\\n\\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /*** Policy Hooks ***/\\n\\n /**\\n * @notice Checks if the account should be allowed to mint tokens in the given market\\n * @param cTokenAddress The market to verify the mint against\\n * @param minter The account which would get the minted tokens\\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!mintGuardianPaused[cTokenAddress], \\\"!mint:paused\\\");\\n\\n // Make sure market is listed\\n if (!markets[cTokenAddress].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Make sure minter is whitelisted\\n if (enforceWhitelist && !whitelist[minter]) {\\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\\n }\\n\\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\\n\\n // Supply cap of 0 corresponds to unlimited supplying\\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\\n uint256 nonWhitelistedTotalSupply;\\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\\n\\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \\\"!supply cap\\\");\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreSupplierAction(cTokenAddress, minter);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to redeem tokens in the given market\\n * @param cToken The market to verify the redeem against\\n * @param redeemer The account which would redeem the tokens\\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\\n if (allowed != uint256(Error.NO_ERROR)) {\\n return allowed;\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreSupplierAction(cToken, redeemer);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function redeemAllowedInternal(\\n address cToken,\\n address redeemer,\\n uint256 redeemTokens\\n ) internal view returns (uint256) {\\n if (!markets[cToken].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\\n if (!markets[cToken].accountMembership[redeemer]) {\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\n redeemer,\\n ICErc20(cToken),\\n redeemTokens,\\n 0,\\n 0\\n );\\n if (err != Error.NO_ERROR) {\\n return uint256(err);\\n }\\n if (shortfall > 0) {\\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates mint and reverts on rejection. May emit logs.\\n * @param cToken Asset being minted\\n * @param minter The address minting the tokens\\n * @param actualMintAmount The amount of the underlying asset being minted\\n * @param mintTokens The number of tokens being minted\\n */\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\\n // Add minter to suppliers mapping\\n suppliers[minter] = true;\\n\\n // Keep the flywheel moving\\n flywheelPostSupplierAction(cToken, minter);\\n }\\n\\n /**\\n * @notice Validates redeem and reverts on rejection. May emit logs.\\n * @param cToken Asset being redeemed\\n * @param redeemer The address redeeming the tokens\\n * @param redeemAmount The amount of the underlying asset being redeemed\\n * @param redeemTokens The number of tokens being redeemed\\n */\\n function redeemVerify(\\n address cToken,\\n address redeemer,\\n uint256 redeemAmount,\\n uint256 redeemTokens\\n ) external override {\\n require(markets[msg.sender].isListed, \\\"!market\\\");\\n\\n // Require tokens is zero or amount is also zero\\n if (redeemTokens == 0 && redeemAmount > 0) {\\n revert(\\\"!zero\\\");\\n }\\n\\n // Keep the flywheel moving\\n flywheelPostSupplierAction(cToken, redeemer);\\n }\\n\\n function getMaxRedeemOrBorrow(\\n address account,\\n ICErc20 cTokenModify,\\n bool isBorrow\\n ) external view override returns (uint256) {\\n address cToken = address(cTokenModify);\\n // Accrue interest\\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\\n\\n // Get account liquidity\\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\n account,\\n isBorrow ? cTokenModify : ICErc20(address(0)),\\n 0,\\n 0,\\n 0\\n );\\n require(err == Error.NO_ERROR, \\\"!liquidity\\\");\\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\\n\\n // Get max borrow/redeem\\n uint256 maxBorrowOrRedeemAmount;\\n\\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\\n // Max redeem = balance of underlying if not used as collateral\\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\\n } else {\\n // Avoid \\\"stack too deep\\\" error by separating this logic\\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\\n\\n // Redeem only: max out at underlying balance\\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\\n }\\n\\n // Get max borrow or redeem considering cToken liquidity\\n uint256 cTokenLiquidity = cTokenModify.getCash();\\n\\n // Return the minimum of the two maximums\\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\\n }\\n\\n /**\\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \\\"stack too deep\\\" errors.\\n */\\n function _getMaxRedeemOrBorrow(\\n uint256 liquidity,\\n ICErc20 cTokenModify,\\n bool isBorrow\\n ) internal view returns (uint256) {\\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\\n\\n // Get the normalized price of the asset\\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\\n require(conversionFactor > 0, \\\"!oracle\\\");\\n\\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\\n if (!isBorrow) {\\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\\n }\\n\\n // Get max borrow or redeem considering excess account liquidity\\n return (liquidity * 1e18) / conversionFactor;\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\\n * @param cToken The market to verify the borrow against\\n * @param borrower The account which would borrow the asset\\n * @param borrowAmount The amount of underlying the account would borrow\\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!borrowGuardianPaused[cToken], \\\"!borrow:paused\\\");\\n\\n // Make sure market is listed\\n if (!markets[cToken].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n if (!markets[cToken].accountMembership[borrower]) {\\n // only cTokens may call borrowAllowed if borrower not in market\\n require(msg.sender == cToken, \\\"!ctoken\\\");\\n\\n // attempt to add borrower to the market\\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\\n if (err != Error.NO_ERROR) {\\n return uint256(err);\\n }\\n\\n // it should be impossible to break the important invariant\\n assert(markets[cToken].accountMembership[borrower]);\\n }\\n\\n // Make sure oracle price is available\\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\\n return uint256(Error.PRICE_ERROR);\\n }\\n\\n // Make sure borrower is whitelisted\\n if (enforceWhitelist && !whitelist[borrower]) {\\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\\n }\\n\\n uint256 borrowCap = effectiveBorrowCaps(cToken);\\n\\n // Borrow cap of 0 corresponds to unlimited borrowing\\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\\n uint256 nonWhitelistedTotalBorrows;\\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\\n\\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \\\"!borrow:cap\\\");\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreBorrowerAction(cToken, borrower);\\n\\n // Perform a hypothetical liquidity check to guard against shortfall\\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\\n if (err != uint256(Error.NO_ERROR)) {\\n return err;\\n }\\n if (shortfall > 0) {\\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates borrow the underlying asset of the given market\\n * @param cToken The market to verify the borrow against\\n * @param borrower The account which borrowed the asset\\n */\\n function borrowVerify(address cToken, address borrower) external override {\\n // Keep the flywheel moving\\n flywheelPostBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\\n * @param cToken Asset whose underlying is being borrowed\\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\\n */\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\\n // Check if min borrow exists\\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\\n\\n if (minBorrowEth > 0) {\\n // Get new underlying borrow balance of account for this cToken\\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\\n Exp({ mantissa: oraclePriceMantissa }),\\n accountBorrowsNew\\n );\\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\\n\\n // Check against min borrow\\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\\n }\\n\\n // Return no error\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to repay a borrow in the given market\\n * @param cToken The market to verify the repay against\\n * @param payer The account which would repay the asset\\n * @param borrower The account which would borrowed the asset\\n * @param repayAmount The amount of the underlying asset the account would repay\\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external override returns (uint256) {\\n // Make sure market is listed\\n if (!markets[cToken].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreBorrowerAction(cToken, borrower);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates that blacklisted balances are updated after borrow repayment\\n * @param cToken The market to verify the repay against\\n * @param payer The account which repayed the asset\\n * @param borrower The account which borrowed the asset\\n * @param repayAmount The amount of the underlying asset the account repayed\\n */\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external override {\\n // Keep the flywheel moving\\n flywheelPostBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Checks if the liquidation should be allowed to occur\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\n * @param liquidator The address repaying the borrow and seizing the collateral\\n * @param borrower The address of the borrower\\n * @param repayAmount The amount of underlying being repaid\\n */\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external override returns (uint256) {\\n // Make sure markets are listed\\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Get borrowers' underlying borrow balance\\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\\n\\n /* allow accounts to be liquidated if the market is deprecated */\\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\\n require(borrowBalance >= repayAmount, \\\"!borrow>repay\\\");\\n } else {\\n /* The borrower must have shortfall in order to be liquidateable */\\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\\n borrower,\\n ICErc20(address(0)),\\n 0,\\n 0,\\n 0\\n );\\n if (err != Error.NO_ERROR) {\\n return uint256(err);\\n }\\n\\n if (shortfall == 0) {\\n return uint256(Error.INSUFFICIENT_SHORTFALL);\\n }\\n\\n /* The liquidator may not repay more than what is allowed by the closeFactor */\\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\\n if (repayAmount > maxClose) {\\n return uint256(Error.TOO_MUCH_REPAY);\\n }\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Checks if the seizing of assets should be allowed to occur\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\n * @param liquidator The address repaying the borrow and seizing the collateral\\n * @param borrower The address of the borrower\\n * @param seizeTokens The number of collateral tokens to seize\\n */\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!seizeGuardianPaused, \\\"!seize:paused\\\");\\n\\n // Make sure markets are listed\\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\\n return uint256(Error.MARKET_NOT_LISTED);\\n }\\n\\n // Make sure cToken Comptrollers are identical\\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\\n return uint256(Error.COMPTROLLER_MISMATCH);\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Validates that blacklisted balances are updated after seizing of assets\\n * @param cTokenCollateral Asset which was used as collateral and will be seized\\n * @param cTokenBorrowed Asset which was borrowed by the borrower\\n * @param liquidator The address repaying the borrow and seizing the collateral\\n * @param borrower The address of the borrower\\n * @param seizeTokens The number of collateral tokens to seize\\n */\\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external override {\\n // Keep the flywheel moving\\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\\n }\\n\\n /**\\n * @notice Checks if the account should be allowed to transfer tokens in the given market\\n * @param cToken The market to verify the transfer against\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n * @param transferTokens The number of cTokens to transfer\\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\\n */\\n function transferAllowed(\\n address cToken,\\n address src,\\n address dst,\\n uint256 transferTokens\\n ) external override returns (uint256) {\\n // Pausing is a very serious situation - we revert to sound the alarms\\n require(!transferGuardianPaused, \\\"!transfer:paused\\\");\\n\\n // Currently the only consideration is whether or not\\n // the src is allowed to redeem this many tokens\\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\\n if (allowed != uint256(Error.NO_ERROR)) {\\n return allowed;\\n }\\n\\n // Keep the flywheel moving\\n flywheelPreTransferAction(cToken, src, dst);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n\\n /**\\n * @notice Validates that blacklisted balances are updated after transfering assets\\n * @param cToken The market to verify the transfer against\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n * @param transferTokens The number of cTokens to transfer\\n */\\n function transferVerify(\\n address cToken,\\n address src,\\n address dst,\\n uint256 transferTokens\\n ) external override {\\n\\n // Keep the flywheel moving\\n flywheelPostTransferAction(cToken, src, dst);\\n }\\n\\n /*** Flywheel Hooks ***/\\n\\n /**\\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\\n * @param cToken The relevant market\\n * @param supplier The minter/redeemer\\n */\\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving post-mint and post-redeem\\n * @param cToken The relevant market\\n * @param supplier The minter/redeemer\\n */\\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\\n * @param cToken The relevant market\\n * @param borrower The borrower\\n */\\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving post-borrow and post-repay\\n * @param cToken The relevant market\\n * @param borrower The borrower\\n */\\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\\n * @param cToken The relevant market\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n */\\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\\n }\\n\\n /**\\n * @notice Keeps the flywheel moving post-transfer and post-seize\\n * @param cToken The relevant market\\n * @param src The account which sources the tokens\\n * @param dst The account which receives the tokens\\n */\\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\\n }\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n /**\\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\\n */\\n struct AccountLiquidityLocalVars {\\n ICErc20 asset;\\n uint256 sumCollateral;\\n uint256 sumBorrowPlusEffects;\\n uint256 cTokenBalance;\\n uint256 borrowBalance;\\n uint256 exchangeRateMantissa;\\n uint256 oraclePriceMantissa;\\n Exp collateralFactor;\\n Exp exchangeRate;\\n Exp oraclePrice;\\n Exp tokensToDenom;\\n uint256 borrowCapForCollateral;\\n uint256 borrowedAssetPrice;\\n uint256 assetAsCollateralValueCap;\\n }\\n\\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\\n (\\n Error err,\\n uint256 collateralValue,\\n uint256 liquidity,\\n uint256 shortfall\\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\\n return (uint256(err), collateralValue, liquidity, shortfall);\\n }\\n\\n /**\\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\\n * @param cTokenModify The market to hypothetically redeem/borrow in\\n * @param account The account to determine liquidity for\\n * @param redeemTokens The number of tokens to hypothetically redeem\\n * @param borrowAmount The amount of underlying to hypothetically borrow\\n * @return (possible error code (semi-opaque),\\n hypothetical account liquidity in excess of collateral requirements,\\n * hypothetical account shortfall below collateral requirements)\\n */\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) public view returns (uint256, uint256, uint256, uint256) {\\n (\\n Error err,\\n uint256 collateralValue,\\n uint256 liquidity,\\n uint256 shortfall\\n ) = getHypotheticalAccountLiquidityInternal(\\n account,\\n ICErc20(cTokenModify),\\n redeemTokens,\\n borrowAmount,\\n repayAmount\\n );\\n return (uint256(err), collateralValue, liquidity, shortfall);\\n }\\n\\n /**\\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\\n * @param cTokenModify The market to hypothetically redeem/borrow in\\n * @param account The account to determine liquidity for\\n * @param redeemTokens The number of tokens to hypothetically redeem\\n * @param borrowAmount The amount of underlying to hypothetically borrow\\n * @return (possible error code,\\n hypothetical account collateral value,\\n hypothetical account liquidity in excess of collateral requirements,\\n * hypothetical account shortfall below collateral requirements)\\n */\\n function getHypotheticalAccountLiquidityInternal(\\n address account,\\n ICErc20 cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) internal view returns (Error, uint256, uint256, uint256) {\\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\\n\\n if (address(cTokenModify) != address(0)) {\\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\\n }\\n\\n // For each asset the account is in\\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\\n vars.asset = accountAssets[account][i];\\n\\n {\\n // Read the balances and exchange rate from the cToken\\n uint256 oErr;\\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\\n account\\n );\\n if (oErr != 0) {\\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\\n }\\n }\\n {\\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\\n\\n // Get the normalized price of the asset\\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\\n if (vars.oraclePriceMantissa == 0) {\\n return (Error.PRICE_ERROR, 0, 0, 0);\\n }\\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\\n\\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\\n }\\n {\\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\\n vars.asset,\\n cTokenModify,\\n redeemTokens > 0,\\n account\\n );\\n\\n // accumulate the collateral value to sumCollateral\\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\\n assetCollateralValue = vars.assetAsCollateralValueCap;\\n vars.sumCollateral += assetCollateralValue;\\n }\\n\\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\n vars.oraclePrice,\\n vars.borrowBalance,\\n vars.sumBorrowPlusEffects\\n );\\n\\n // Calculate effects of interacting with cTokenModify\\n if (vars.asset == cTokenModify) {\\n // redeem effect\\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\n vars.tokensToDenom,\\n redeemTokens,\\n vars.sumBorrowPlusEffects\\n );\\n\\n // borrow effect\\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\\n vars.oraclePrice,\\n borrowAmount,\\n vars.sumBorrowPlusEffects\\n );\\n\\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\\n if (repayEffect >= vars.sumBorrowPlusEffects) {\\n vars.sumBorrowPlusEffects = 0;\\n } else {\\n vars.sumBorrowPlusEffects -= repayEffect;\\n }\\n }\\n }\\n\\n // These are safe, as the underflow condition is checked first\\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\\n } else {\\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\\n }\\n }\\n\\n /**\\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\\n * @param cTokenBorrowed The address of the borrowed cToken\\n * @param cTokenCollateral The address of the collateral cToken\\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\\n */\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 actualRepayAmount\\n ) external view override returns (uint256, uint256) {\\n /* Read oracle prices for borrowed and collateral markets */\\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\\n return (uint256(Error.PRICE_ERROR), 0);\\n }\\n\\n /*\\n * Get the exchange rate and calculate the number of collateral tokens to seize:\\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\\n * seizeTokens = seizeAmount / exchangeRate\\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\\n */\\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\\n uint256 seizeTokens;\\n Exp memory numerator;\\n Exp memory denominator;\\n Exp memory ratio;\\n\\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\\n\\n /*\\n * The liquidation penalty includes\\n * - the liquidator incentive\\n * - the protocol fees (Ionic admin fees)\\n * - the market fee\\n */\\n Exp memory totalPenaltyMantissa = add_(\\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\\n Exp({ mantissa: feeSeizeShareMantissa })\\n );\\n\\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\\n ratio = div_(numerator, denominator);\\n\\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\\n return (uint256(Error.NO_ERROR), seizeTokens);\\n }\\n\\n /*** Admin Functions ***/\\n\\n /**\\n * @notice Add a RewardsDistributor contracts.\\n * @dev Admin function to add a RewardsDistributor contract\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _addRewardsDistributor(address distributor) external returns (uint256) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n // Check marker method\\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \\\"!isRewardsDistributor\\\");\\n\\n // Check for existing RewardsDistributor\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \\\"!added\\\");\\n\\n // Add RewardsDistributor to array\\n rewardsDistributors.push(distributor);\\n emit AddedRewardsDistributor(distributor);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the whitelist enforcement for the comptroller\\n * @dev Admin function to set a new whitelist enforcement boolean\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\\n }\\n\\n // Check if `enforceWhitelist` already equals `enforce`\\n if (enforceWhitelist == enforce) {\\n return uint256(Error.NO_ERROR);\\n }\\n\\n // Set comptroller's `enforceWhitelist` to `enforce`\\n enforceWhitelist = enforce;\\n\\n // Emit WhitelistEnforcementChanged(bool enforce);\\n emit WhitelistEnforcementChanged(enforce);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the whitelist `statuses` for `suppliers`\\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\\n }\\n\\n // Set whitelist statuses for suppliers\\n for (uint256 i = 0; i < suppliers.length; i++) {\\n address supplier = suppliers[i];\\n\\n if (statuses[i]) {\\n // If not already whitelisted, add to whitelist\\n if (!whitelist[supplier]) {\\n whitelist[supplier] = true;\\n whitelistArray.push(supplier);\\n whitelistIndexes[supplier] = whitelistArray.length - 1;\\n }\\n } else {\\n // If whitelisted, remove from whitelist\\n if (whitelist[supplier]) {\\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\\n whitelistArray.pop(); // Reduce length by 1\\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\\n }\\n }\\n }\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets a new price oracle for the comptroller\\n * @dev Admin function to set a new price oracle\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\\n }\\n\\n // Track the old oracle for the comptroller\\n BasePriceOracle oldOracle = oracle;\\n\\n // Set comptroller's oracle to newOracle\\n oracle = newOracle;\\n\\n // Emit NewPriceOracle(oldOracle, newOracle)\\n emit NewPriceOracle(oldOracle, newOracle);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the closeFactor used when liquidating borrows\\n * @dev Admin function to set closeFactor\\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\n */\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\\n }\\n\\n // Check limits\\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\\n }\\n\\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\\n if (lessThanExp(highLimit, newCloseFactorExp)) {\\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\\n }\\n\\n // Set pool close factor to new close factor, remember old value\\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\\n closeFactorMantissa = newCloseFactorMantissa;\\n\\n // Emit event\\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets the collateralFactor for a market\\n * @dev Admin function to set per-market collateralFactor\\n * @param cToken The market to set the factor on\\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\n */\\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\\n }\\n\\n // Verify market is listed\\n Market storage market = markets[address(cToken)];\\n if (!market.isListed) {\\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\\n }\\n\\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\\n\\n // Check collateral factor <= 0.9\\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\\n }\\n\\n // If collateral factor != 0, fail if price == 0\\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\\n }\\n\\n // Set market's collateral factor to new collateral factor, remember old value\\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\\n market.collateralFactorMantissa = newCollateralFactorMantissa;\\n\\n // Emit event with asset, old collateral factor, and new collateral factor\\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets liquidationIncentive\\n * @dev Admin function to set liquidationIncentive\\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\\n */\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\\n }\\n\\n // Check de-scaled min <= newLiquidationIncentive <= max\\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\\n }\\n\\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\\n }\\n\\n // Save current value for use in log\\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\\n\\n // Set liquidation incentive to new incentive\\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\\n\\n // Emit event with old incentive, new incentive\\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Add the market to the markets mapping and set it as listed\\n * @dev Admin function to set isListed and add support for the market\\n * @param cToken The address of the market (token) to list\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\\n }\\n\\n // Is market already listed?\\n if (markets[address(cToken)].isListed) {\\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\\n }\\n\\n // Check cToken.comptroller == this\\n require(address(cToken.comptroller()) == address(this), \\\"!comptroller\\\");\\n\\n // Make sure market is not already listed\\n address underlying = ICErc20(address(cToken)).underlying();\\n\\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\\n }\\n\\n // List market and emit event\\n Market storage market = markets[address(cToken)];\\n market.isListed = true;\\n market.collateralFactorMantissa = 0;\\n allMarkets.push(cToken);\\n cTokensByUnderlying[underlying] = cToken;\\n emit MarketListed(cToken);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _deployMarket(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256) {\\n // Check caller is admin\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\\n }\\n\\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\\n bool oldIonicAdminHasRights = ionicAdminHasRights;\\n ionicAdminHasRights = true;\\n\\n // Deploy via Ionic admin\\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\\n // Reset Ionic admin rights to the original value\\n ionicAdminHasRights = oldIonicAdminHasRights;\\n // Support market here in the Comptroller\\n uint256 err = _supportMarket(cToken);\\n\\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\\n\\n // Set collateral factor\\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\\n }\\n\\n function _becomeImplementation() external {\\n require(msg.sender == address(this), \\\"!self call\\\");\\n\\n if (!_notEnteredInitialized) {\\n _notEntered = true;\\n _notEnteredInitialized = true;\\n }\\n }\\n\\n /*** Helper Functions ***/\\n\\n /**\\n * @notice Returns true if the given cToken market has been deprecated\\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\\n * @param cToken The market to check if deprecated\\n */\\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\\n return\\n markets[address(cToken)].collateralFactorMantissa == 0 &&\\n borrowGuardianPaused[address(cToken)] == true &&\\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\\n }\\n\\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\\n return ComptrollerExtensionInterface(address(this));\\n }\\n\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\\n uint8 fnsCount = 36;\\n\\n functionSelectors = new bytes4[](fnsCount);\\n\\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\\n functionSelectors[--fnsCount] = this._deployMarket.selector;\\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\\n functionSelectors[--fnsCount] = this.checkMembership.selector;\\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\\n functionSelectors[--fnsCount] = this.exitMarket.selector;\\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\\n functionSelectors[--fnsCount] = this.mintVerify.selector;\\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\\n functionSelectors[--fnsCount] = this.borrowVerify.selector;\\n functionSelectors[--fnsCount] = this.repayBorrowVerify.selector;\\n functionSelectors[--fnsCount] = this.seizeVerify.selector;\\n functionSelectors[--fnsCount] = this.transferVerify.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n }\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n /**\\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\\n */\\n function _beforeNonReentrant() external override {\\n require(markets[msg.sender].isListed, \\\"!Comptroller:_beforeNonReentrant\\\");\\n require(_notEntered, \\\"!reentered\\\");\\n _notEntered = false;\\n }\\n\\n /**\\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\\n */\\n function _afterNonReentrant() external override {\\n require(markets[msg.sender].isListed, \\\"!Comptroller:_afterNonReentrant\\\");\\n _notEntered = true; // get a gas-refund post-Istanbul\\n }\\n}\\n\",\"keccak256\":\"0xa6b293d5874fcf90c2a720d0fd3a1a43f916fd633c553dd4a5aa7171a1d57bb8\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowVerify(address cToken, address borrower) external;\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n \\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external;\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n \\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x266ec3c26b454cfa72bab45fa8e0bc9e3d44e8ec0cd4770304a14cc84c8f80d3\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/ErrorReporter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\ncontract ComptrollerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n COMPTROLLER_MISMATCH,\\n INSUFFICIENT_SHORTFALL,\\n INSUFFICIENT_LIQUIDITY,\\n INVALID_CLOSE_FACTOR,\\n INVALID_COLLATERAL_FACTOR,\\n INVALID_LIQUIDATION_INCENTIVE,\\n MARKET_NOT_LISTED,\\n MARKET_ALREADY_LISTED,\\n MATH_ERROR,\\n NONZERO_BORROW_BALANCE,\\n PRICE_ERROR,\\n REJECTION,\\n SNAPSHOT_ERROR,\\n TOO_MANY_ASSETS,\\n TOO_MUCH_REPAY,\\n SUPPLIER_NOT_WHITELISTED,\\n BORROW_BELOW_MIN,\\n SUPPLY_ABOVE_MAX,\\n NONZERO_TOTAL_SUPPLY\\n }\\n\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\\n EXIT_MARKET_BALANCE_OWED,\\n EXIT_MARKET_REJECTION,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\n SET_CLOSE_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_PRICE_ORACLE_OWNER_CHECK,\\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\\n SET_WHITELIST_STATUS_OWNER_CHECK,\\n SUPPORT_MARKET_EXISTS,\\n SUPPORT_MARKET_OWNER_CHECK,\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\n UNSUPPORT_MARKET_OWNER_CHECK,\\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\\n UNSUPPORT_MARKET_IN_USE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return uint256(err);\\n }\\n}\\n\\ncontract TokenErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n BAD_INPUT,\\n COMPTROLLER_REJECTION,\\n COMPTROLLER_CALCULATION_ERROR,\\n INTEREST_RATE_MODEL_ERROR,\\n INVALID_ACCOUNT_PAIR,\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\n INVALID_COLLATERAL_FACTOR,\\n MATH_ERROR,\\n MARKET_NOT_FRESH,\\n MARKET_NOT_LISTED,\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\n TOKEN_INSUFFICIENT_BALANCE,\\n TOKEN_INSUFFICIENT_CASH,\\n TOKEN_TRANSFER_IN_FAILED,\\n TOKEN_TRANSFER_OUT_FAILED,\\n UTILIZATION_ABOVE_MAX\\n }\\n\\n /*\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\n * This is because FailureInfo grows significantly faster, and\\n * the order of Error has some meaning, while the order of FailureInfo\\n * is entirely arbitrary.\\n */\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n BORROW_ACCRUE_INTEREST_FAILED,\\n BORROW_CASH_NOT_AVAILABLE,\\n BORROW_FRESHNESS_CHECK,\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n BORROW_MARKET_NOT_LISTED,\\n BORROW_COMPTROLLER_REJECTION,\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n LIQUIDATE_COMPTROLLER_REJECTION,\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n LIQUIDATE_FRESHNESS_CHECK,\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_ACCRUE_INTEREST_FAILED,\\n MINT_COMPTROLLER_REJECTION,\\n MINT_EXCHANGE_CALCULATION_FAILED,\\n MINT_EXCHANGE_RATE_READ_FAILED,\\n MINT_FRESHNESS_CHECK,\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n MINT_TRANSFER_IN_FAILED,\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\n NEW_UTILIZATION_RATE_ABOVE_MAX,\\n REDEEM_ACCRUE_INTEREST_FAILED,\\n REDEEM_COMPTROLLER_REJECTION,\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\n REDEEM_FRESHNESS_CHECK,\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\\n WITHDRAW_IONIC_FEES_VALIDATION,\\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\\n WITHDRAW_ADMIN_FEES_VALIDATION,\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\n REDUCE_RESERVES_ADMIN_CHECK,\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\n REDUCE_RESERVES_FRESH_CHECK,\\n REDUCE_RESERVES_VALIDATION,\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\n REPAY_BORROW_FRESHNESS_CHECK,\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COMPTROLLER_OWNER_CHECK,\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\\n SET_ADMIN_FEE_ADMIN_CHECK,\\n SET_ADMIN_FEE_FRESH_CHECK,\\n SET_ADMIN_FEE_BOUNDS_CHECK,\\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\\n SET_IONIC_FEE_FRESH_CHECK,\\n SET_IONIC_FEE_BOUNDS_CHECK,\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\n TRANSFER_COMPTROLLER_REJECTION,\\n TRANSFER_NOT_ALLOWED,\\n TRANSFER_NOT_ENOUGH,\\n TRANSFER_TOO_MUCH,\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\n ADD_RESERVES_FRESH_CHECK,\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\\n }\\n}\\n\",\"keccak256\":\"0xad342553cda4d7b7e40678c636a406bc2785be2117a29d9b1cb52e747726745e\",\"license\":\"UNLICENSED\"},\"contracts/compound/Exponential.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./CarefulMath.sol\\\";\\nimport \\\"./ExponentialNoError.sol\\\";\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Compound\\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract Exponential is CarefulMath, ExponentialNoError {\\n /**\\n * @dev Creates an exponential from numerator and denominator values.\\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\\n * or if `denom` is zero.\\n */\\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\\n }\\n\\n /**\\n * @dev Adds two exponentials, returning a new exponential.\\n */\\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Subtracts two exponentials, returning a new exponential.\\n */\\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, returning a new Exp.\\n */\\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(product));\\n }\\n\\n /**\\n * @dev Divide an Exp by a scalar, returning a new Exp.\\n */\\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, returning a new Exp.\\n */\\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\\n /*\\n We are doing this as:\\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\\n\\n How it works:\\n Exp = a / b;\\n Scalar = s;\\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\\n */\\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n return getExp(numerator, divisor.mantissa);\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\\n */\\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(fraction));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials, returning a new exponential.\\n */\\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n // We add half the scale before dividing so that we get rounding instead of truncation.\\n // See \\\"Listing 6\\\" and text above it at https://accu.org/index.php/journals/1717\\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\\n assert(err2 == MathError.NO_ERROR);\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\\n */\\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\\n }\\n\\n /**\\n * @dev Multiplies three exponentials, returning a new exponential.\\n */\\n function mulExp3(\\n Exp memory a,\\n Exp memory b,\\n Exp memory c\\n ) internal pure returns (MathError, Exp memory) {\\n (MathError err, Exp memory ab) = mulExp(a, b);\\n if (err != MathError.NO_ERROR) {\\n return (err, ab);\\n }\\n return mulExp(ab, c);\\n }\\n\\n /**\\n * @dev Divides two exponentials, returning a new exponential.\\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\\n */\\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n return getExp(a.mantissa, b.mantissa);\\n }\\n}\\n\",\"keccak256\":\"0xf1b6442cbde756ce56dc5507487b1769905147f390fdf88e1d59a66bc3e2161e\",\"license\":\"UNLICENSED\"},\"contracts/compound/ExponentialNoError.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Compound\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract ExponentialNoError {\\n uint256 constant expScale = 1e18;\\n uint256 constant doubleScale = 1e36;\\n uint256 constant halfExpScale = expScale / 2;\\n uint256 constant mantissaOne = expScale;\\n\\n struct Exp {\\n uint256 mantissa;\\n }\\n\\n struct Double {\\n uint256 mantissa;\\n }\\n\\n /**\\n * @dev Truncates the given exp to a whole number value.\\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\\n */\\n function truncate(Exp memory exp) internal pure returns (uint256) {\\n // Note: We are not using careful math here as we're performing a division that cannot fail\\n return exp.mantissa / expScale;\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\\n Exp memory product = mul_(a, scalar);\\n return truncate(product);\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\n */\\n function mul_ScalarTruncateAddUInt(\\n Exp memory a,\\n uint256 scalar,\\n uint256 addend\\n ) internal pure returns (uint256) {\\n Exp memory product = mul_(a, scalar);\\n return add_(truncate(product), addend);\\n }\\n\\n /**\\n * @dev Checks if first Exp is less than second Exp.\\n */\\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa < right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp <= right Exp.\\n */\\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa <= right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp > right Exp.\\n */\\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa > right.mantissa;\\n }\\n\\n /**\\n * @dev returns true if Exp is exactly zero\\n */\\n function isZeroExp(Exp memory value) internal pure returns (bool) {\\n return value.mantissa == 0;\\n }\\n\\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\\n require(n < 2**224, errorMessage);\\n return uint224(n);\\n }\\n\\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\\n require(n < 2**32, errorMessage);\\n return uint32(n);\\n }\\n\\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return add_(a, b, \\\"addition overflow\\\");\\n }\\n\\n function add_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, errorMessage);\\n return c;\\n }\\n\\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return sub_(a, b, \\\"subtraction underflow\\\");\\n }\\n\\n function sub_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\\n }\\n\\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\\n return mul_(a, b.mantissa) / expScale;\\n }\\n\\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\\n }\\n\\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\\n return mul_(a, b.mantissa) / doubleScale;\\n }\\n\\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return mul_(a, b, \\\"multiplication overflow\\\");\\n }\\n\\n function mul_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n if (a == 0 || b == 0) {\\n return 0;\\n }\\n uint256 c = a * b;\\n require(c / a == b, errorMessage);\\n return c;\\n }\\n\\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\\n }\\n\\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\\n return div_(mul_(a, expScale), b.mantissa);\\n }\\n\\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\\n }\\n\\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\\n return div_(mul_(a, doubleScale), b.mantissa);\\n }\\n\\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\\n return div_(a, b, \\\"divide by zero\\\");\\n }\\n\\n function div_(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\\n }\\n}\\n\",\"keccak256\":\"0xec0df0038026b4e9c272de575121befd31d3a306fec5f157aaf1625fc08cfe69\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/compound/Unitroller.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./ErrorReporter.sol\\\";\\nimport \\\"./ComptrollerStorage.sol\\\";\\nimport \\\"./Comptroller.sol\\\";\\nimport { DiamondExtension, DiamondBase, LibDiamond } from \\\"../ionic/DiamondExtension.sol\\\";\\n\\n/**\\n * @title Unitroller\\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\\n * CTokens should reference this contract as their comptroller.\\n */\\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\\n /**\\n * @notice Event emitted when the admin rights are changed\\n */\\n event AdminRightsToggled(bool hasRights);\\n\\n /**\\n * @notice Emitted when pendingAdmin is changed\\n */\\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\\n\\n /**\\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\\n */\\n event NewAdmin(address oldAdmin, address newAdmin);\\n\\n constructor(address payable _ionicAdmin) {\\n admin = msg.sender;\\n ionicAdmin = _ionicAdmin;\\n }\\n\\n /*** Admin Functions ***/\\n\\n /**\\n * @notice Toggles admin rights.\\n * @param hasRights Boolean indicating if the admin is to have rights.\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\\n }\\n\\n // Check that rights have not already been set to the desired value\\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\\n\\n adminHasRights = hasRights;\\n emit AdminRightsToggled(hasRights);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\\n * @param newPendingAdmin New pending admin.\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\\n }\\n\\n address oldPendingAdmin = pendingAdmin;\\n pendingAdmin = newPendingAdmin;\\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\\n * @dev Admin function for pending admin to accept role and update admin\\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\\n */\\n function _acceptAdmin() public returns (uint256) {\\n // Check caller is pendingAdmin and pendingAdmin \\u2260 address(0)\\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\\n }\\n\\n // Save current values for inclusion in log\\n address oldAdmin = admin;\\n address oldPendingAdmin = pendingAdmin;\\n\\n admin = pendingAdmin;\\n pendingAdmin = address(0);\\n\\n emit NewAdmin(oldAdmin, admin);\\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function comptrollerImplementation() public view returns (address) {\\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\\\"_deployMarket(uint8,bytes,bytes,uint256)\\\"))));\\n }\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external {\\n require(msg.sender == address(this) || hasAdminRights(), \\\"!self || !admin\\\");\\n\\n address currentImplementation = comptrollerImplementation();\\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\\n currentImplementation\\n );\\n\\n _updateExtensions(latestComptrollerImplementation);\\n\\n if (currentImplementation != latestComptrollerImplementation) {\\n // reinitialize\\n _functionCall(address(this), abi.encodeWithSignature(\\\"_becomeImplementation()\\\"), \\\"!become impl\\\");\\n }\\n }\\n\\n function _functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.call(data);\\n\\n if (!success) {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n\\n return returndata;\\n }\\n\\n function _updateExtensions(address currentComptroller) internal {\\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\\n address[] memory currentExtensions = LibDiamond.listExtensions();\\n\\n // removed the current (old) extensions\\n for (uint256 i = 0; i < currentExtensions.length; i++) {\\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\\n }\\n // add the new extensions\\n for (uint256 i = 0; i < latestExtensions.length; i++) {\\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\\n }\\n }\\n\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\\n require(hasAdminRights(), \\\"!unauthorized\\\");\\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\\n }\\n}\\n\",\"keccak256\":\"0xcea89eb6bccd6ab62b57e42d483fd3638a0296ec9aae45d21f80a521004cc9e8\",\"license\":\"UNLICENSED\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x233d26db3755cf0c7bf0bba3a695a742bbfc15fd168fb76bbe307c5ac259b5bf\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x74641db987b6d12c8c412818b8a7708332778736193b2cb127ea54e80b334186\",\"license\":\"UNLICENSED\"},\"contracts/ionic/strategies/flywheel/IIonicFlywheel.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.10;\\n\\nimport { ERC20 } from \\\"solmate/tokens/ERC20.sol\\\";\\n\\ninterface IIonicFlywheel {\\n function isRewardsDistributor() external returns (bool);\\n\\n function isFlywheel() external returns (bool);\\n\\n function flywheelPreSupplierAction(address market, address supplier) external;\\n\\n function flywheelPostSupplierAction(address market, address supplier) external;\\n\\n function flywheelPreBorrowerAction(address market, address borrower) external;\\n\\n function flywheelPostBorrowerAction(address market, address borrower) external;\\n\\n function flywheelPreTransferAction(address market, address src, address dst) external;\\n\\n function flywheelPostTransferAction(address market, address src, address dst) external;\\n\\n function compAccrued(address user) external view returns (uint256);\\n\\n function addMarketForRewards(ERC20 strategy) external;\\n\\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\\n}\\n\",\"keccak256\":\"0x4516d96eef3e82e306678e481dcd06f150e460955eca73fa028ee63e0ceaa7e6\",\"license\":\"AGPL-3.0-only\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"},\"solmate/tokens/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\\nabstract contract ERC20 {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /*//////////////////////////////////////////////////////////////\\n METADATA STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n string public name;\\n\\n string public symbol;\\n\\n uint8 public immutable decimals;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 public totalSupply;\\n\\n mapping(address => uint256) public balanceOf;\\n\\n mapping(address => mapping(address => uint256)) public allowance;\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal immutable INITIAL_CHAIN_ID;\\n\\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\\n\\n mapping(address => uint256) public nonces;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n string memory _name,\\n string memory _symbol,\\n uint8 _decimals\\n ) {\\n name = _name;\\n symbol = _symbol;\\n decimals = _decimals;\\n\\n INITIAL_CHAIN_ID = block.chainid;\\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function approve(address spender, uint256 amount) public virtual returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n\\n return true;\\n }\\n\\n function transfer(address to, uint256 amount) public virtual returns (bool) {\\n balanceOf[msg.sender] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(msg.sender, to, amount);\\n\\n return true;\\n }\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual returns (bool) {\\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\\n\\n balanceOf[from] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n return true;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual {\\n require(deadline >= block.timestamp, \\\"PERMIT_DEADLINE_EXPIRED\\\");\\n\\n // Unchecked because the only math done is incrementing\\n // the owner's nonce which cannot realistically overflow.\\n unchecked {\\n address recoveredAddress = ecrecover(\\n keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\n ),\\n owner,\\n spender,\\n value,\\n nonces[owner]++,\\n deadline\\n )\\n )\\n )\\n ),\\n v,\\n r,\\n s\\n );\\n\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"INVALID_SIGNER\\\");\\n\\n allowance[recoveredAddress][spender] = value;\\n }\\n\\n emit Approval(owner, spender, value);\\n }\\n\\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\\n }\\n\\n function computeDomainSeparator() internal view virtual returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\n keccak256(bytes(name)),\\n keccak256(\\\"1\\\"),\\n block.chainid,\\n address(this)\\n )\\n );\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL MINT/BURN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function _mint(address to, uint256 amount) internal virtual {\\n totalSupply += amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(address(0), to, amount);\\n }\\n\\n function _burn(address from, uint256 amount) internal virtual {\\n balanceOf[from] -= amount;\\n\\n // Cannot underflow because a user's balance\\n // will never be larger than the total supply.\\n unchecked {\\n totalSupply -= amount;\\n }\\n\\n emit Transfer(from, address(0), amount);\\n }\\n}\\n\",\"keccak256\":\"0xcdfd8db76b2a3415620e4d18cc5545f3d50de792dbf2c3dd5adb40cbe6f94b10\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60806040526002805461ffff60a01b191661010160a01b17905534801561002557600080fd5b50615e0780620000366000396000f3fe608060405234801561001057600080fd5b50600436106104065760003560e01c80637e361b1111610220578063c299823811610130578063da3d454c116100b8578063e875544611610087578063e875544614610a25578063eabe7d9114610a2e578063ede4edd014610a41578063efcb03dd14610a54578063f851a44014610a6757600080fd5b8063da3d454c146109d8578063dce15449146109eb578063e4028eee146109fe578063e6653f3d14610a1157600080fd5b8063c90c20b1116100ff578063c90c20b114610983578063c91a424f1461098b578063cf6bfd2d1461099e578063d02f7351146109b2578063d251fefc146109c557600080fd5b8063c299823814610915578063c488847b14610935578063c6c5b0dd1461095d578063c8c9c9751461097057600080fd5b80639614b53b116101b3578063b095721011610182578063b0957210146108bc578063b1034882146108c9578063b452ef62146108dc578063b9b5b153146108ef578063bdcdc2581461090257600080fd5b80639614b53b146108525780639b19251a14610865578063abfceffc14610888578063ac0b0bb7146108a857600080fd5b8063929fe9a1116101ef578063929fe9a1146107c0578063940cd6f11461080157806394543c151461082c578063952adf5a1461083f57600080fd5b80637e361b111461074057806387f763031461075357806389f8132e146107675780638e8f294b1461077c57600080fd5b80634ef4c3e11161031b578063632e5142116102ae5780636d35bf911161027d5780636d35bf91146106d1578063731f0c2b146106e45780637515bafa14610707578063779b22941461071a5780637dc0d1d01461072d57600080fd5b8063632e5142146106805780636a56947e146106885780636bd02b8a1461069b5780636d154ea5146106ae57600080fd5b806355ee1fe1116102ea57806355ee1fe11461061f5780635d72de62146106325780635ec88c791461063a5780635fc7e71e1461066d57600080fd5b80634ef4c3e1146105d35780634fd42e17146105e657806351dff989146105f957806352d84d1e1461060c57600080fd5b806324a3d6221161039e57806331ff47fa1161036d57806331ff47fa146105585780633c94786f1461058157806341c728b9146105955780634a584432146105aa5780634ada90af146105ca57600080fd5b806324a3d6221461050c578063267822471461051f5780632ccf47a414610532578063317b0b771461054557600080fd5b80631976828e116103da5780631976828e1461048d5780631c819e43146104a057806321af4569146104ce57806324008a62146104f957600080fd5b80627e3dd21461040b57806302c3bcbb146104285780630a755ec21461045657806316dc15fe1461046a575b600080fd5b610413600181565b60405190151581526020015b60405180910390f35b61044861043636600461539c565b60186020526000908152604090205481565b60405190815260200161041f565b60025461041390600160a81b900460ff1681565b61041361047836600461539c565b600d6020526000908152604090205460ff1681565b61044861049b3660046153c7565b610a7a565b6104136104ae366004615412565b601d60209081526000928352604080842090915290825290205460ff1681565b6016546104e1906001600160a01b031681565b6040516001600160a01b03909116815260200161041f565b61044861050736600461544b565b610c6f565b6013546104e1906001600160a01b031681565b6002546104e1906001600160a01b031681565b61044861054036600461539c565b610cb1565b61044861055336600461549c565b610cc2565b6104e161056636600461539c565b600e602052600090815260409020546001600160a01b031681565b60135461041390600160a01b900460ff1681565b6105a86105a33660046154b5565b610d96565b005b6104486105b836600461539c565b60176020526000908152604090205481565b61044860055481565b6104486105e13660046154fb565b610dc9565b6104486105f436600461549c565b611015565b6105a86106073660046154b5565b6110d1565b6104e161061a36600461549c565b611167565b61044861062d36600461539c565b611191565b6105a8611211565b61064d61064836600461539c565b61126e565b60408051948552602085019390935291830152606082015260800161041f565b61044861067b36600461553c565b6112b2565b6105a8611476565b6105a861069636600461544b565b6114e4565b6104e16106a936600461549c565b6114ef565b6104136106bc36600461539c565b60156020526000908152604090205460ff1681565b6105a86106df36600461553c565b6114ff565b6104136106f236600461539c565b60146020526000908152604090205460ff1681565b6104e161071536600461549c565b611511565b6104486107283660046155a0565b611521565b6003546104e1906001600160a01b031681565b61064d61074e3660046155cc565b61167f565b60135461041390600160b01b900460ff1681565b61076f6116c9565b60405161041f919061561d565b6107a961078a36600461539c565b6008602052600090815260409020805460019091015460ff9091169082565b60408051921515835260208301919091520161041f565b6104136107ce366004615412565b6001600160a01b038082166000908152600860209081526040808320938616835260029093019052205460ff1692915050565b61044861080f366004615412565b601c60209081526000928352604080842090915290825290205481565b61041361083a36600461539c565b612069565b61044861084d36600461566b565b6121d3565b6105a8610860366004615412565b612252565b61041361087336600461539c565b60106020526000908152604090205460ff1681565b61089b61089636600461539c565b612260565b60405161041f9190615688565b60135461041390600160b81b900460ff1681565b600f546104139060ff1681565b6104486108d736600461539c565b6122d6565b6104486108ea36600461571a565b6122e1565b6104486108fd36600461539c565b6124bf565b61044861091036600461544b565b61269d565b6109286109233660046157ec565b612720565b60405161041f919061589e565b6109486109433660046154fb565b6128a0565b6040805192835260208301919091520161041f565b6104e161096b36600461549c565b612bcc565b61044861097e36600461591b565b612bdc565b6105a8612e79565b6000546104e1906001600160a01b031681565b60025461041390600160a01b900460ff1681565b6104486109c036600461553c565b612f23565b6104e16109d336600461549c565b6130aa565b6104486109e63660046154fb565b6130ba565b6104e16109f93660046155a0565b613538565b610448610a0c3660046155a0565b613570565b60135461041390600160a81b900460ff1681565b61044860045481565b610448610a3c3660046154fb565b6136fa565b610448610a4f36600461539c565b613717565b6105a8610a6236600461544b565b613c9a565b6001546104e1906001600160a01b031681565b604051633af9e66960e01b81526001600160a01b0384811660048301526000918491839190831690633af9e66990602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190615987565b90506000806000610b0f8988610b03576000610b05565b895b6000806000613ca4565b929550935090915060009050836014811115610b2d57610b2d6159a0565b14610b6c5760405162461bcd60e51b815260206004820152600a602482015269216c697175696469747960b01b60448201526064015b60405180910390fd5b8015610b8057600095505050505050610c68565b600087158015610bba57506001600160a01b038087166000908152600860209081526040808320938e16835260029093019052205460ff16155b15610bc6575083610be8565b610bd1838a8a61411f565b905087158015610be057508085105b15610be85750835b6000896001600160a01b0316633b1d21a26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4c9190615987565b905080821115610c5c5780610c5e565b815b9750505050505050505b9392505050565b6001600160a01b03841660009081526008602052604081205460ff16610c995760085b9050610ca9565b610ca3858461423b565b60005b90505b949350505050565b6000610cbc826142dc565b92915050565b6000610ccc61454e565b610cdc57610cbc600160076145a2565b6040805160208082018352848252825190810190925266b1a2bc2ec50000808352815191929111610d1357610ca9600560086145a2565b6040805160208101909152670c7d713b49da000080825283511115610d4757610d3e600560086145a2565b95945050505050565b600480549086905560408051828152602081018890527f3b9670cf975d26958e754b57098eaa2ac914d8d2a31b83257997b9f346110fd991015b60405180910390a160005b9695505050505050565b6001600160a01b0383166000908152600d60205260409020805460ff19166001179055610dc3848461461b565b50505050565b6001600160a01b03831660009081526014602052604081205460ff1615610e215760405162461bcd60e51b815260206004820152600c60248201526b085b5a5b9d0e9c185d5cd95960a21b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff16610e4b5760085b9050610c68565b600f5460ff168015610e7657506001600160a01b03831660009081526010602052604090205460ff16155b15610e82576011610e44565b6000610e8d85610cb1565b90508015801590610ebc57506001600160a01b03851660009081526020805260409020610eba90856146b7565b155b15611000576000856001600160a01b0316634aeb3d9a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190615987565b9050600030604051637db121fd60e11b81526001600160a01b038981166004830152919091169063fb6243fa90602401602060405180830381865afa158015610f72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f969190615987565b90506000828210610fa957506000610fb6565b610fb382846159cc565b90505b83610fc187836159df565b10610ffc5760405162461bcd60e51b815260206004820152600b60248201526a021737570706c79206361760ac1b6044820152606401610b63565b5050505b61100a85856146d9565b600095945050505050565b600061101f61454e565b61102f57610cbc6001600d6145a2565b60408051602080820183528482528251908101909252670de0b6b3a76400008083528151919291101561106857610ca96007600e6145a2565b60408051602081019091526714d1120d7b1600008082528351111561109357610d3e6007600e6145a2565b600580549086905560408051828152602081018890527faeba5a6c40a8ac138134bff1aaa65debf25971188a58804bad717f82f0ec13169101610d81565b3360009081526008602052604090205460ff1661111a5760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610b63565b801580156111285750600082115b1561115d5760405162461bcd60e51b8152602060048201526005602482015264217a65726f60d81b6044820152606401610b63565b610dc3848461461b565b6009818154811061117757600080fd5b6000918252602090912001546001600160a01b0316905081565b600061119b61454e565b6111ab57610cbc600160126145a2565b600380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910160405180910390a160009392505050565b33301461124d5760405162461bcd60e51b815260206004820152600a602482015269085cd95b198818d85b1b60b21b6044820152606401610b63565b601a54610100900460ff1661126c57601a805461ffff19166101011790555b565b60008060008060008060008061128989600080600080613ca4565b93509350935093508360148111156112a3576112a36159a0565b99929850909650945092505050565b6001600160a01b03851660009081526008602052604081205460ff1615806112f357506001600160a01b03851660009081526008602052604090205460ff16155b156113025760085b9050610d3e565b6040516305eff7ef60e21b81526001600160a01b038481166004830152600091908816906317bfdfbc90602401602060405180830381865afa15801561134c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113709190615987565b905061137b87612069565b156113c557828110156113c05760405162461bcd60e51b815260206004820152600d60248201526c21626f72726f773e726570617960981b6044820152606401610b63565b611469565b6000806113d786600080600080613ca4565b935050509150600060148111156113f0576113f06159a0565b826014811115611402576114026159a0565b1461142357816014811115611419576114196159a0565b9350505050610d3e565b80600003611432576003611419565b600061144e604051806020016040528060045481525085614774565b905080861115611465576010945050505050610d3e565b5050505b5060009695505050505050565b3360009081526008602052604090205460ff166114d55760405162461bcd60e51b815260206004820152601f60248201527f21436f6d7074726f6c6c65723a5f61667465724e6f6e5265656e7472616e74006044820152606401610b63565b601a805460ff19166001179055565b610dc384848461478c565b601b818154811061117757600080fd5b61150a85838561478c565b5050505050565b600b818154811061117757600080fd5b600080546040805163fdb25fb160e01b8152905183926001600160a01b03169163fdb25fb19160048083019260209291908290030181865afa15801561156b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158f9190615987565b905080156116755760035460405163fc57d4df60e01b81526001600160a01b038681166004830152600092169063fc57d4df90602401602060405180830381865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190615987565b90508060000361161b57600c92505050610cbc565b60008061163660405180602001604052808581525087614830565b9092509050600082600381111561164f5761164f6159a0565b1461166257600a5b945050505050610cbc565b83811015611671576012611657565b5050505b6000949350505050565b6000806000806000806000806116988d8d8d8d8d613ca4565b93509350935093508360148111156116b2576116b26159a0565b975091955093509150505b95509550955095915050565b6040805160248082526104a08201909252606091908160208201610480803683370190505091506394543c1560e01b82611702836159f2565b92508260ff168151811061171857611718615a0f565b6001600160e01b031990921660209283029190910190910152635a2977b160e11b82611743836159f2565b92508260ff168151811061175957611759615a0f565b6001600160e01b031990921660209283029190910190910152632aff3bff60e21b82611784836159f2565b92508260ff168151811061179a5761179a615a0f565b6001600160e01b03199092166020928302919091019091015263929fe9a160e01b826117c5836159f2565b92508260ff16815181106117db576117db615a0f565b6001600160e01b0319909216602092830291909101909101526355ee1fe160e01b82611806836159f2565b92508260ff168151811061181c5761181c615a0f565b6001600160e01b03199092166020928302919091019091015263317b0b7760e01b82611847836159f2565b92508260ff168151811061185d5761185d615a0f565b6001600160e01b031990921660209283029190910190910152637201477760e11b82611888836159f2565b92508260ff168151811061189e5761189e615a0f565b6001600160e01b031990921660209283029190910190910152634fd42e1760e01b826118c9836159f2565b92508260ff16815181106118df576118df615a0f565b6001600160e01b031990921660209283029190910190910152634a956fad60e11b8261190a836159f2565b92508260ff168151811061192057611920615a0f565b6001600160e01b03199092166020928302919091019091015263c8c9c97560e01b8261194b836159f2565b92508260ff168151811061196157611961615a0f565b6001600160e01b03199092166020928302919091019091015263b9b5b15360e01b8261198c836159f2565b92508260ff16815181106119a2576119a2615a0f565b6001600160e01b031990921660209283029190910190910152637e361b1160e01b826119cd836159f2565b92508260ff16815181106119e3576119e3615a0f565b6001600160e01b031990921660209283029190910190910152630cbb414760e11b82611a0e836159f2565b92508260ff1681518110611a2457611a24615a0f565b6001600160e01b031990921660209283029190910190910152631853304760e31b82611a4f836159f2565b92508260ff1681518110611a6557611a65615a0f565b6001600160e01b031990921660209283029190910190910152630ede4edd60e41b82611a90836159f2565b92508260ff1681518110611aa657611aa6615a0f565b6001600160e01b031990921660209283029190910190910152634ef4c3e160e01b82611ad1836159f2565b92508260ff1681518110611ae757611ae7615a0f565b6001600160e01b03199092166020928302919091019091015263eabe7d9160e01b82611b12836159f2565b92508260ff1681518110611b2857611b28615a0f565b6001600160e01b0319909216602092830291909101909101526351dff98960e01b82611b53836159f2565b92508260ff1681518110611b6957611b69615a0f565b6001600160e01b03199092166020928302919091019091015263368f515360e21b82611b94836159f2565b92508260ff1681518110611baa57611baa615a0f565b6001600160e01b031990921660209283029190910190910152631de6c8a560e21b82611bd5836159f2565b92508260ff1681518110611beb57611beb615a0f565b6001600160e01b031990921660209283029190910190910152631200453160e11b82611c16836159f2565b92508260ff1681518110611c2c57611c2c615a0f565b6001600160e01b031990921660209283029190910190910152632fe3f38f60e11b82611c57836159f2565b92508260ff1681518110611c6d57611c6d615a0f565b6001600160e01b03199092166020928302919091019091015263d02f735160e01b82611c98836159f2565b92508260ff1681518110611cae57611cae615a0f565b6001600160e01b0319909216602092830291909101909101526317b9b84b60e31b82611cd9836159f2565b92508260ff1681518110611cef57611cef615a0f565b6001600160e01b0319909216602092830291909101909101526341c728b960e01b82611d1a836159f2565b92508260ff1681518110611d3057611d30615a0f565b6001600160e01b031990921660209283029190910190910152635ec88c7960e01b82611d5b836159f2565b92508260ff1681518110611d7157611d71615a0f565b6001600160e01b03199092166020928302919091019091015263c488847b60e01b82611d9c836159f2565b92508260ff1681518110611db257611db2615a0f565b6001600160e01b03199092166020928302919091019091015263c90c20b160e01b82611ddd836159f2565b92508260ff1681518110611df357611df3615a0f565b6001600160e01b03199092166020928302919091019091015263319728a160e11b82611e1e836159f2565b92508260ff1681518110611e3457611e34615a0f565b6001600160e01b031990921660209283029190910190910152632eb96f3160e11b82611e5f836159f2565b92508260ff1681518110611e7557611e75615a0f565b6001600160e01b031990921660209283029190910190910152630b33d1e960e21b82611ea0836159f2565b92508260ff1681518110611eb657611eb6615a0f565b6001600160e01b031990921660209283029190910190910152635881a44160e11b82611ee1836159f2565b92508260ff1681518110611ef757611ef7615a0f565b6001600160e01b031990921660209283029190910190910152639614b53b60e01b82611f22836159f2565b92508260ff1681518110611f3857611f38615a0f565b6001600160e01b03199092166020928302919091019091015263efcb03dd60e01b82611f63836159f2565b92508260ff1681518110611f7957611f79615a0f565b6001600160e01b031990921660209283029190910190910152636d35bf9160e01b82611fa4836159f2565b92508260ff1681518110611fba57611fba615a0f565b6001600160e01b03199092166020928302919091019091015263352b4a3f60e11b82611fe5836159f2565b92508260ff1681518110611ffb57611ffb615a0f565b6001600160e01b03199092166020928302919091019091015260ff8116156120655760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610b63565b5090565b6001600160a01b0381166000908152600860205260408120600101541580156120af57506001600160a01b03821660009081526015602052604090205460ff1615156001145b8015610cbc57506121c3612185836001600160a01b031663173b99046040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190615987565b846001600160a01b0316638d02d9a16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121809190615987565b614883565b836001600160a01b031663c3bf11cd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b670de0b6b3a76400001492915050565b60006121dd61454e565b6121ed57610cbc600160136145a2565b600f5482151560ff909116151503612206576000610cbc565b600f805460ff19168315159081179091556040519081527f84c7d948374a180eddab35d27d2f7a94167a1ff4e79467f1e89c061984190a1e906020015b60405180910390a16000610cbc565b61225c82826148b9565b5050565b6001600160a01b03811660009081526007602090815260408083208054825181850281018501909352808352606094938301828280156122c957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122ab575b5093979650505050505050565b6000610cbc82614955565b60006122eb61454e565b612302576122fb600160166145a2565b9050610d8c565b60028054600160a01b60ff60a01b1982168117909255600080546040516328f816b560e11b81529390920460ff169290916001600160a01b0316906351f02d6a90612359908c908c908c908c908c90600401615a4e565b6020604051808303816000875af1158015612378573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239c9190615a7e565b6002805460ff60a01b1916600160a01b85151502179055905060006123c0826149f4565b905060008054906101000a90046001600160a01b03166001600160a01b0316638aac2f0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124379190615a7e565b604051635a89ef5160e01b81523060048201526001600160a01b039190911690635a89ef5190602401600060405180830381600087803b15801561247a57600080fd5b505af115801561248e573d6000803e3d6000fd5b506000925061249b915050565b81146124a757806124b1565b6124b18286613570565b9a9950505050505050505050565b60006124c961454e565b6124fe5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610b63565b816001600160a01b031663abc6d72d6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561253e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125629190615a9b565b6125a65760405162461bcd60e51b815260206004820152601560248201527410b4b9a932bbb0b93239a234b9ba3934b13aba37b960591b6044820152606401610b63565b60005b60195481101561261e57601981815481106125c6576125c6615a0f565b6000918252602090912001546001600160a01b03908116908416036126165760405162461bcd60e51b815260206004820152600660248201526508585919195960d21b6044820152606401610b63565b6001016125a9565b50601980546001810182556000919091527f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950180546001600160a01b0319166001600160a01b0384169081179091556040519081527f98ef1187fb6fd2bc85f8996489877eb2b5428f9e9bdfc068c9ad6c2ea82eacc790602001612243565b601354600090600160b01b900460ff16156126ed5760405162461bcd60e51b815260206004820152601060248201526f085d1c985b9cd9995c8e9c185d5cd95960821b6044820152606401610b63565b60006126fa868685614c3b565b90508015612709579050610ca9565b612714868686614d03565b60009695505050505050565b60008054604051631beb2b9760e31b81526060926001600160a01b039092169163df595cb8916127659130913391839190356001600160e01b03191690600401615ab8565b602060405180830381865afa158015612782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a69190615a9b565b6127e35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b815160008167ffffffffffffffff811115612800576128006157a5565b604051908082528060200260200182016040528015612829578160200160208202803683370190505b50905060005b8281101561289657600085828151811061284b5761284b615a0f565b6020026020010151905061285f8133614da7565b6014811115612870576128706159a0565b83838151811061288257612882615a0f565b60209081029190910101525060010161282f565b509150505b919050565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092839283929091169063fc57d4df90602401602060405180830381865afa1580156128f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129159190615987565b60035460405163fc57d4df60e01b81526001600160a01b0388811660048301529293506000929091169063fc57d4df90602401602060405180830381865afa158015612965573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129899190615987565b9050811580612996575080155b156129aa57600c6000935093505050612bc4565b60008690506000816001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a139190615987565b90506000612a2d6040518060200160405280600081525090565b6040805160208101909152600081526040805160208101909152600081526000866001600160a01b0316636752e7026040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aaf9190615987565b90506000876001600160a01b031663be99f1196040518163ffffffff1660e01b8152600401602060405180830381865afa158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b159190615987565b90506000612b58612b446040518060200160405280600554815250604051806020016040528087815250614f41565b604051806020016040528085815250614f41565b9050612b728160405180602001604052808e815250614f76565b9550612b9a60405180602001604052808c81525060405180602001604052808b815250614f76565b9450612ba68686614fb5565b9350612bb2848f614774565b60009d509b5050505050505050505050505b935093915050565b6019818154811061117757600080fd5b6000612be661454e565b612bf657610c92600160146145a2565b60005b84811015612e71576000868683818110612c1557612c15615a0f565b9050602002016020810190612c2a919061539c565b9050848483818110612c3e57612c3e615a0f565b9050602002016020810190612c53919061566b565b15612d0b576001600160a01b03811660009081526010602052604090205460ff16612d06576001600160a01b0381166000818152601060205260408120805460ff19166001908117909155601180548083018255928190527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6890920180546001600160a01b03191690931790925554612cec91906159cc565b6001600160a01b0382166000908152601260205260409020555b612e68565b6001600160a01b03811660009081526010602052604090205460ff1615612e685760118054612d3c906001906159cc565b81548110612d4c57612d4c615a0f565b60009182526020808320909101546001600160a01b0384811684526012909252604090922054601180549290931692918110612d8a57612d8a615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506011805480612dc957612dc9615aeb565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038316825260129081905260408220546011805491939184908110612e1d57612e1d615a0f565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822094909455918416825260128352808220829055601090925220805460ff191690555b50600101612bf9565b506000610ca6565b3360009081526008602052604090205460ff16612ed85760405162461bcd60e51b815260206004820181905260248201527f21436f6d7074726f6c6c65723a5f6265666f72654e6f6e5265656e7472616e746044820152606401610b63565b601a5460ff16612f175760405162461bcd60e51b815260206004820152600a602482015269085c99595b9d195c995960b21b6044820152606401610b63565b601a805460ff19169055565b601354600090600160b81b900460ff1615612f705760405162461bcd60e51b815260206004820152600d60248201526c085cd95a5e994e9c185d5cd959609a1b6044820152606401610b63565b6001600160a01b03861660009081526008602052604090205460ff161580612fb157506001600160a01b03851660009081526008602052604090205460ff16155b15612fbd5760086112fb565b846001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301f9190615a7e565b6001600160a01b0316866001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308a9190615a7e565b6001600160a01b03161461309f5760026112fb565b612714868486614d03565b6011818154811061117757600080fd5b6001600160a01b03831660009081526015602052604081205460ff16156131145760405162461bcd60e51b815260206004820152600e60248201526d08589bdc9c9bddce9c185d5cd95960921b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff1661313b576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff1661322a57336001600160a01b038516146131ae5760405162461bcd60e51b815260206004820152600760248201526610b1ba37b5b2b760c91b6044820152606401610b63565b60006131ba3385614da7565b905060008160148111156131d0576131d06159a0565b146131ef578060148111156131e7576131e76159a0565b915050610c68565b6001600160a01b038086166000908152600860209081526040808320938816835260029093019052205460ff1661322857613228615b01565b505b60035460405163fc57d4df60e01b81526001600160a01b0386811660048301529091169063fc57d4df90602401602060405180830381865afa158015613274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132989190615987565b6000036132a657600c610e44565b600f5460ff1680156132d157506001600160a01b03831660009081526010602052604090205460ff16155b156132dd576011610e44565b60006132e8856122d6565b9050801580159061331857506001600160a01b038516600090815260216020526040902061331690856146b7565b155b1561345c576000856001600160a01b03166373acee986040518163ffffffff1660e01b8152600401602060405180830381865afa15801561335d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133819190615987565b9050600030604051631d3965af60e11b81526001600160a01b0389811660048301529190911690633a72cb5e90602401602060405180830381865afa1580156133ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f29190615987565b9050600082821061340557506000613412565b61340f82846159cc565b90505b8361341d87836159df565b106134585760405162461bcd60e51b815260206004820152600b60248201526a021626f72726f773a6361760ac1b6044820152606401610b63565b5050505b613466858561423b565b604051637e361b1160e01b81526001600160a01b0380861660048301528616602482015260006044820181905260648201859052608482018190529081903090637e361b119060a401608060405180830381865afa1580156134cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f09190615b17565b93505050915060006014811115613509576135096159a0565b821461351957509150610c689050565b801561352b5760049350505050610c68565b6000979650505050505050565b6007602052816000526040600020818154811061355457600080fd5b6000918252602090912001546001600160a01b03169150829050565b600061357a61454e565b6135915761358a600160096145a2565b9050610cbc565b6001600160a01b0383166000908152600860205260409020805460ff166135c6576135be6008600a6145a2565b915050610cbc565b60408051602080820183528582528251908101909252670c7d713b49da00008252906135f481835190511090565b1561360f576136056006600b6145a2565b9350505050610cbc565b8415801590613689575060035460405163fc57d4df60e01b81526001600160a01b0388811660048301529091169063fc57d4df90602401602060405180830381865afa158015613663573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136879190615987565b155b1561369957613605600c806145a2565b60018301805490869055604080516001600160a01b0389168152602081018390529081018790527f70483e6592cd5182d45ac970e05bc62cdcc90e9d8ef2c2dbe686cf383bcd7fc59060600160405180910390a16000979650505050505050565b600080613708858585614c3b565b90508015611000579050610c68565b60008054604051631beb2b9760e31b81526001600160a01b039091169063df595cb890613759903090339082906001600160e01b031988351690600401615ab8565b602060405180830381865afa158015613776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379a9190615a9b565b6137d75760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b6001600160a01b03821660009081526008602052604090205460ff1661383f5760405162461bcd60e51b815260206004820152601760248201527f21436f6d7074726f6c6c65723a657869744d61726b65740000000000000000006044820152606401610b63565b6040516361bfb47160e11b81523360048201528290600090819081906001600160a01b0385169063c37f68e290602401608060405180830381865afa15801561388c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b09190615b17565b50925092509250826000146138f55760405162461bcd60e51b815260206004820152600b60248201526a08595e1a5d13585c9ad95d60aa1b6044820152606401610b63565b801561390757610d8c600b60036145a2565b6000613914873385614c3b565b9050801561393457613929600d600483614fef565b979650505050505050565b6001600160a01b0387166000908152600860209081526040808320338452600281019092529091205460ff1661397257600098975050505050505050565b3360009081526002820160209081526040808320805460ff1916905560078252808320805482518185028101850190935280835291929091908301828280156139e457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116139c6575b5050835193945083925060009150505b82811015613a3e578b6001600160a01b0316848281518110613a1857613a18615a0f565b60200260200101516001600160a01b031603613a3657809150613a3e565b6001016139f4565b50818110613a4e57613a4e615b01565b33600090815260076020526040902080548190613a6d906001906159cc565b81548110613a7d57613a7d615a0f565b9060005260206000200160009054906101000a90046001600160a01b0316818381548110613aad57613aad615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080805480613aeb57613aeb615aeb565b600082815260208120820160001990810180546001600160a01b031916905590910190915581549003613c4757600b8054613b28906001906159cc565b81548110613b3857613b38615a0f565b6000918252602080832090910154338352600c909152604090912054600b80546001600160a01b03909316929091908110613b7557613b75615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b805480613bb457613bb4615aeb565b60008281526020808220830160001990810180546001600160a01b0319169055909201909255338252600c908190526040822054600b805491939184908110613bff57613bff615a0f565b60009182526020808320909101546001600160a01b03168352828101939093526040918201812093909355338352600c8252808320839055600a9091529020805460ff191690555b604080516001600160a01b038e1681523360208201527fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d910160405180910390a160009c9b505050505050505050505050565b610dc384836148b9565b600080600080613cb26152bc565b6001600160a01b03891615613d365760035460405163fc57d4df60e01b81526001600160a01b038b811660048301529091169063fc57d4df90602401602060405180830381865afa158015613d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d2f9190615987565b6101808201525b60005b6001600160a01b038b166000908152600760205260409020548110156140bb576001600160a01b038b166000908152600760205260409020805482908110613d8357613d83615a0f565b60009182526020822001546001600160a01b039081168085526040516361bfb47160e11b8152918e1660048301529063c37f68e290602401608060405180830381865afa158015613dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dfc9190615b17565b60a08701526080860152606085015290508015613e2a57600e600080600096509650965096505050506116bd565b50604080516020808201835284516001600160a01b0390811660009081526008835284902060010154835260e08601929092528251908101835260a085015181526101008501526003548451925163fc57d4df60e01b81529282166004840152169063fc57d4df90602401602060405180830381865afa158015613eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ed69190615987565b60c08301819052600003613efa57600c6000806000955095509550955050506116bd565b604080516020810190915260c0830151815261012083015260e0820151610100830151613f3591613f2a91614f76565b836101200151614f76565b610140830152308251604051633c1f884b60e11b81526001600160a01b0391821660048201528c821660248201528b151560448201528d8216606482015291169063783f109690608401602060405180830381865afa158015613f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fc09190615987565b6101a08301526101408201516060830151600091613fdd91614774565b9050826101a00151811115613ff457506101a08201515b808360200181815161400691906159df565b9052505061012082015160808301516040840151614025929190615067565b604083015281516001600160a01b03808c169116036140b3576140528261014001518a8460400151615067565b6040830181905261012083015161406a918a90615067565b60408301526101208201516000906140829089614774565b90508260400151811061409b57600060408401526140b1565b80836040018181516140ad91906159cc565b9052505b505b600101613d39565b508060400151816020015111156140f45760208101516040820151600091906140e490826159cc565b60009450945094509450506116bd565b6000816020015160008360200151846040015161411191906159cc565b9450945094509450506116bd565b60008360000361413157506000610c68565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092169063fc57d4df90602401602060405180830381865afa15801561417c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141a09190615987565b9050600081116141dc5760405162461bcd60e51b8152602060048201526007602482015266216f7261636c6560c81b6044820152606401610b63565b8261421e576001600160a01b038416600090815260086020526040902060010154670de0b6b3a76400006142108383615b4d565b61421a9190615b64565b9150505b8061423186670de0b6b3a7640000615b4d565b610d3e9190615b64565b60005b6019548110156142d7576019818154811061425b5761425b615a0f565b600091825260209091200154604051631cdc2c5d60e31b81526001600160a01b03858116600483015284811660248301529091169063e6e162e890604401600060405180830381600087803b1580156142b357600080fd5b505af11580156142c7573d6000803e3d6000fd5b50506001909201915061423e9050565b505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561452c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143829190615a7e565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156143db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143ff9190615b9e565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916144589190615c39565b600060405180830381855afa9150503d8060008114614493576040519150601f19603f3d011682016040523d82523d6000602084013e614498565b606091505b50915091508180156144ab575080516020145b156144ca57808060200190518101906144c49190615c55565b60ff1692505b60408501516144dc9060000b84615c72565b925060008312614502576144f183600a615d76565b6144fb9087615b4d565b9550614523565b61450b83615d82565b61451690600a615d76565b6145209087615b64565b95505b50505050614548565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546000906001600160a01b0316331480156145745750600254600160a81b900460ff165b8061459d57506000546001600160a01b03163314801561459d5750600254600160a01b900460ff165b905090565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156145d7576145d76159a0565b83601a8111156145e9576145e96159a0565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610c6857610c686159a0565b60005b6019548110156142d7576019818154811061463b5761463b615a0f565b600091825260209091200154604051630509462560e21b81526001600160a01b038581166004830152848116602483015290911690631425189490604401600060405180830381600087803b15801561469357600080fd5b505af11580156146a7573d6000803e3d6000fd5b50506001909201915061461e9050565b6001600160a01b03811660009081526001830160205260408120541515610c68565b60005b6019548110156142d757601981815481106146f9576146f9615a0f565b60009182526020909120015460405162e48b0f60e51b81526001600160a01b038581166004830152848116602483015290911690631c9161e090604401600060405180830381600087803b15801561475057600080fd5b505af1158015614764573d6000803e3d6000fd5b5050600190920191506146dc9050565b6000806147818484615088565b9050610ca9816150b0565b60005b601954811015610dc357601981815481106147ac576147ac615a0f565b600091825260209091200154604051632a29f11f60e21b81526001600160a01b038681166004830152858116602483015284811660448301529091169063a8a7c47c90606401600060405180830381600087803b15801561480c57600080fd5b505af1158015614820573d6000803e3d6000fd5b50506001909201915061478f9050565b60008060008061484086866150c8565b90925090506000826003811115614859576148596159a0565b1461486a575091506000905061487c565b6000614875826150b0565b9350935050505b9250929050565b6000610c688383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b815250615144565b60005b6019548110156142d757601981815481106148d9576148d9615a0f565b60009182526020909120015460405163d27c545360e01b81526001600160a01b03858116600483015284811660248301529091169063d27c545390604401600060405180830381600087803b15801561493157600080fd5b505af1158015614945573d6000803e3d6000fd5b5050600190920191506148bc9050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b93830193909352156149d7576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60006149fe61454e565b614a0e57610cbc600160166145a2565b6001600160a01b03821660009081526008602052604090205460ff1615614a3b57610cbc600960156145a2565b306001600160a01b0316826001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614aa79190615a7e565b6001600160a01b031614614aec5760405162461bcd60e51b815260206004820152600c60248201526b10b1b7b6b83a3937b63632b960a11b6044820152606401610b63565b6000826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b509190615a7e565b6001600160a01b038082166000908152600e60205260409020549192501615614b7f57610c68600960156145a2565b6001600160a01b038381166000818152600860209081526040808320805460ff1916600190811782558082018590556009805491820190557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b031990811687179091559587168452600e835292819020805490951684179094559251918252917fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f910160405180910390a16000610ca9565b6001600160a01b03831660009081526008602052604081205460ff16614c62576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff16614c9a576000610e44565b600080614cab858786600080613ca4565b93505050915060006014811115614cc457614cc46159a0565b826014811115614cd657614cd66159a0565b14614cf657816014811115614ced57614ced6159a0565b92505050610c68565b8015612714576004614ced565b60005b601954811015610dc35760198181548110614d2357614d23615a0f565b600091825260209091200154604051634e081c9560e01b81526001600160a01b0386811660048301528581166024830152848116604483015290911690634e081c9590606401600060405180830381600087803b158015614d8357600080fd5b505af1158015614d97573d6000803e3d6000fd5b505060019092019150614d069050565b6001600160a01b0382166000908152600860205260408120805460ff16614dd2576008915050610cbc565b6001600160a01b038316600090815260028201602052604090205460ff161515600103614e03576000915050610cbc565b6001600160a01b03838116600081815260028401602090815260408083208054600160ff199091168117909155600783528184208054918201815584528284200180546001600160a01b031916958a1695909517909455918152600a909152205460ff16614ef457600b8054600180820183557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990910180546001600160a01b0319166001600160a01b0387169081179091556000908152600a60205260409020805460ff1916821790559054614eda91906159cc565b6001600160a01b0384166000908152600c60205260409020555b604080516001600160a01b038087168252851660208201527f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a5910160405180910390a15060009392505050565b6040805160208101909152600081526040518060200160405280614f6d85600001518560000151614883565b90529392505050565b6040805160208101909152600081526040518060200160405280670de0b6b3a7640000614fab8660000151866000015161517e565b614f6d9190615b64565b6040805160208101909152600081526040518060200160405280614f6d614fe88660000151670de0b6b3a764000061517e565b85516151c0565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846014811115615024576150246159a0565b84601a811115615036576150366159a0565b604080519283526020830191909152810184905260600160405180910390a1836014811115610ca957610ca96159a0565b6000806150748585615088565b9050610d3e615082826150b0565b84614883565b6040805160208101909152600081526040518060200160405280614f6d85600001518561517e565b8051600090610cbc90670de0b6b3a764000090615b64565b60006150e06040518060200160405280600081525090565b6000806150f18660000151866151f3565b9092509050600082600381111561510a5761510a6159a0565b146151295750604080516020810190915260008152909250905061487c565b60408051602081019091529081526000969095509350505050565b60008061515184866159df565b905082858210156151755760405162461bcd60e51b8152600401610b639190615d9e565b50949350505050565b6000610c6883836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f7700000000000000000081525061523d565b6000610c6883836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250615290565b600080836000036152095750600090508061487c565b838302836152178683615b64565b1461522a5760026000925092505061487c565b60009250905061487c565b509250929050565b600083158061524a575082155b1561525757506000610c68565b60006152638486615b4d565b9050836152708683615b64565b1483906151755760405162461bcd60e51b8152600401610b639190615d9e565b600081836152b15760405162461bcd60e51b8152600401610b639190615d9e565b50610ca98385615b64565b604051806101c0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016153186040518060200160405280600081525090565b81526020016153336040518060200160405280600081525090565b815260200161534e6040518060200160405280600081525090565b81526020016153696040518060200160405280600081525090565b81526020016000815260200160008152602001600081525090565b6001600160a01b038116811461539957600080fd5b50565b6000602082840312156153ae57600080fd5b8135610c6881615384565b801515811461539957600080fd5b6000806000606084860312156153dc57600080fd5b83356153e781615384565b925060208401356153f781615384565b91506040840135615407816153b9565b809150509250925092565b6000806040838503121561542557600080fd5b823561543081615384565b9150602083013561544081615384565b809150509250929050565b6000806000806080858703121561546157600080fd5b843561546c81615384565b9350602085013561547c81615384565b9250604085013561548c81615384565b9396929550929360600135925050565b6000602082840312156154ae57600080fd5b5035919050565b600080600080608085870312156154cb57600080fd5b84356154d681615384565b935060208501356154e681615384565b93969395505050506040820135916060013590565b60008060006060848603121561551057600080fd5b833561551b81615384565b9250602084013561552b81615384565b929592945050506040919091013590565b600080600080600060a0868803121561555457600080fd5b853561555f81615384565b9450602086013561556f81615384565b9350604086013561557f81615384565b9250606086013561558f81615384565b949793965091946080013592915050565b600080604083850312156155b357600080fd5b82356155be81615384565b946020939093013593505050565b600080600080600060a086880312156155e457600080fd5b85356155ef81615384565b945060208601356155ff81615384565b94979496505050506040830135926060810135926080909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160e01b03191683529284019291840191600101615639565b50909695505050505050565b60006020828403121561567d57600080fd5b8135610c68816153b9565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160a01b0316835292840192918401916001016156a4565b60ff8116811461539957600080fd5b60008083601f8401126156ea57600080fd5b50813567ffffffffffffffff81111561570257600080fd5b60208301915083602082850101111561487c57600080fd5b6000806000806000806080878903121561573357600080fd5b863561573e816156c9565b9550602087013567ffffffffffffffff8082111561575b57600080fd5b6157678a838b016156d8565b9097509550604089013591508082111561578057600080fd5b5061578d89828a016156d8565b979a9699509497949695606090950135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156157e4576157e46157a5565b604052919050565b600060208083850312156157ff57600080fd5b823567ffffffffffffffff8082111561581757600080fd5b818501915085601f83011261582b57600080fd5b81358181111561583d5761583d6157a5565b8060051b915061584e8483016157bb565b818152918301840191848101908884111561586857600080fd5b938501935b83851015615892578435925061588283615384565b828252938501939085019061586d565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561565f578351835292840192918401916001016158ba565b60008083601f8401126158e857600080fd5b50813567ffffffffffffffff81111561590057600080fd5b6020830191508360208260051b850101111561487c57600080fd5b6000806000806040858703121561593157600080fd5b843567ffffffffffffffff8082111561594957600080fd5b615955888389016158d6565b9096509450602087013591508082111561596e57600080fd5b5061597b878288016158d6565b95989497509550505050565b60006020828403121561599957600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610cbc57610cbc6159b6565b80820180821115610cbc57610cbc6159b6565b600060ff821680615a0557615a056159b6565b6000190192915050565b634e487b7160e01b600052603260045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60ff86168152606060208201526000615a6b606083018688615a25565b8281036040840152615892818587615a25565b600060208284031215615a9057600080fd5b8151610c6881615384565b600060208284031215615aad57600080fd5b8151610c68816153b9565b6001600160a01b0394851681529284166020840152921660408201526001600160e01b0319909116606082015260800190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60008060008060808587031215615b2d57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbc57610cbc6159b6565b600082615b8157634e487b7160e01b600052601260045260246000fd5b500490565b805167ffffffffffffffff8116811461289b57600080fd5b600060608284031215615bb057600080fd5b6040516060810181811067ffffffffffffffff82111715615bd357615bd36157a5565b604052615bdf83615b86565b8152615bed60208401615b86565b6020820152604083015163ffffffff81168114615c0957600080fd5b60408201529392505050565b60005b83811015615c30578181015183820152602001615c18565b50506000910152565b60008251615c4b818460208701615c15565b9190910192915050565b600060208284031215615c6757600080fd5b8151610c68816156c9565b8082018281126000831280158216821582161715615c9257615c926159b6565b505092915050565b600181815b80851115615235578160001904821115615cbb57615cbb6159b6565b80851615615cc857918102915b93841c9390800290615c9f565b600082615ce457506001610cbc565b81615cf157506000610cbc565b8160018114615d075760028114615d1157615d2d565b6001915050610cbc565b60ff841115615d2257615d226159b6565b50506001821b610cbc565b5060208310610133831016604e8410600b8410161715615d50575081810a610cbc565b615d5a8383615c9a565b8060001904821115615d6e57615d6e6159b6565b029392505050565b6000610c688383615cd5565b6000600160ff1b8201615d9757615d976159b6565b5060000390565b6020815260008251806020840152615dbd816040850160208701615c15565b601f01601f1916919091016040019291505056fea2646970667358221220207585e6ea295e0bcb79c18e9bc75865f59f2f4f261ff0bc21c503e3f9d9059064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106104065760003560e01c80637e361b1111610220578063c299823811610130578063da3d454c116100b8578063e875544611610087578063e875544614610a25578063eabe7d9114610a2e578063ede4edd014610a41578063efcb03dd14610a54578063f851a44014610a6757600080fd5b8063da3d454c146109d8578063dce15449146109eb578063e4028eee146109fe578063e6653f3d14610a1157600080fd5b8063c90c20b1116100ff578063c90c20b114610983578063c91a424f1461098b578063cf6bfd2d1461099e578063d02f7351146109b2578063d251fefc146109c557600080fd5b8063c299823814610915578063c488847b14610935578063c6c5b0dd1461095d578063c8c9c9751461097057600080fd5b80639614b53b116101b3578063b095721011610182578063b0957210146108bc578063b1034882146108c9578063b452ef62146108dc578063b9b5b153146108ef578063bdcdc2581461090257600080fd5b80639614b53b146108525780639b19251a14610865578063abfceffc14610888578063ac0b0bb7146108a857600080fd5b8063929fe9a1116101ef578063929fe9a1146107c0578063940cd6f11461080157806394543c151461082c578063952adf5a1461083f57600080fd5b80637e361b111461074057806387f763031461075357806389f8132e146107675780638e8f294b1461077c57600080fd5b80634ef4c3e11161031b578063632e5142116102ae5780636d35bf911161027d5780636d35bf91146106d1578063731f0c2b146106e45780637515bafa14610707578063779b22941461071a5780637dc0d1d01461072d57600080fd5b8063632e5142146106805780636a56947e146106885780636bd02b8a1461069b5780636d154ea5146106ae57600080fd5b806355ee1fe1116102ea57806355ee1fe11461061f5780635d72de62146106325780635ec88c791461063a5780635fc7e71e1461066d57600080fd5b80634ef4c3e1146105d35780634fd42e17146105e657806351dff989146105f957806352d84d1e1461060c57600080fd5b806324a3d6221161039e57806331ff47fa1161036d57806331ff47fa146105585780633c94786f1461058157806341c728b9146105955780634a584432146105aa5780634ada90af146105ca57600080fd5b806324a3d6221461050c578063267822471461051f5780632ccf47a414610532578063317b0b771461054557600080fd5b80631976828e116103da5780631976828e1461048d5780631c819e43146104a057806321af4569146104ce57806324008a62146104f957600080fd5b80627e3dd21461040b57806302c3bcbb146104285780630a755ec21461045657806316dc15fe1461046a575b600080fd5b610413600181565b60405190151581526020015b60405180910390f35b61044861043636600461539c565b60186020526000908152604090205481565b60405190815260200161041f565b60025461041390600160a81b900460ff1681565b61041361047836600461539c565b600d6020526000908152604090205460ff1681565b61044861049b3660046153c7565b610a7a565b6104136104ae366004615412565b601d60209081526000928352604080842090915290825290205460ff1681565b6016546104e1906001600160a01b031681565b6040516001600160a01b03909116815260200161041f565b61044861050736600461544b565b610c6f565b6013546104e1906001600160a01b031681565b6002546104e1906001600160a01b031681565b61044861054036600461539c565b610cb1565b61044861055336600461549c565b610cc2565b6104e161056636600461539c565b600e602052600090815260409020546001600160a01b031681565b60135461041390600160a01b900460ff1681565b6105a86105a33660046154b5565b610d96565b005b6104486105b836600461539c565b60176020526000908152604090205481565b61044860055481565b6104486105e13660046154fb565b610dc9565b6104486105f436600461549c565b611015565b6105a86106073660046154b5565b6110d1565b6104e161061a36600461549c565b611167565b61044861062d36600461539c565b611191565b6105a8611211565b61064d61064836600461539c565b61126e565b60408051948552602085019390935291830152606082015260800161041f565b61044861067b36600461553c565b6112b2565b6105a8611476565b6105a861069636600461544b565b6114e4565b6104e16106a936600461549c565b6114ef565b6104136106bc36600461539c565b60156020526000908152604090205460ff1681565b6105a86106df36600461553c565b6114ff565b6104136106f236600461539c565b60146020526000908152604090205460ff1681565b6104e161071536600461549c565b611511565b6104486107283660046155a0565b611521565b6003546104e1906001600160a01b031681565b61064d61074e3660046155cc565b61167f565b60135461041390600160b01b900460ff1681565b61076f6116c9565b60405161041f919061561d565b6107a961078a36600461539c565b6008602052600090815260409020805460019091015460ff9091169082565b60408051921515835260208301919091520161041f565b6104136107ce366004615412565b6001600160a01b038082166000908152600860209081526040808320938616835260029093019052205460ff1692915050565b61044861080f366004615412565b601c60209081526000928352604080842090915290825290205481565b61041361083a36600461539c565b612069565b61044861084d36600461566b565b6121d3565b6105a8610860366004615412565b612252565b61041361087336600461539c565b60106020526000908152604090205460ff1681565b61089b61089636600461539c565b612260565b60405161041f9190615688565b60135461041390600160b81b900460ff1681565b600f546104139060ff1681565b6104486108d736600461539c565b6122d6565b6104486108ea36600461571a565b6122e1565b6104486108fd36600461539c565b6124bf565b61044861091036600461544b565b61269d565b6109286109233660046157ec565b612720565b60405161041f919061589e565b6109486109433660046154fb565b6128a0565b6040805192835260208301919091520161041f565b6104e161096b36600461549c565b612bcc565b61044861097e36600461591b565b612bdc565b6105a8612e79565b6000546104e1906001600160a01b031681565b60025461041390600160a01b900460ff1681565b6104486109c036600461553c565b612f23565b6104e16109d336600461549c565b6130aa565b6104486109e63660046154fb565b6130ba565b6104e16109f93660046155a0565b613538565b610448610a0c3660046155a0565b613570565b60135461041390600160a81b900460ff1681565b61044860045481565b610448610a3c3660046154fb565b6136fa565b610448610a4f36600461539c565b613717565b6105a8610a6236600461544b565b613c9a565b6001546104e1906001600160a01b031681565b604051633af9e66960e01b81526001600160a01b0384811660048301526000918491839190831690633af9e66990602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190615987565b90506000806000610b0f8988610b03576000610b05565b895b6000806000613ca4565b929550935090915060009050836014811115610b2d57610b2d6159a0565b14610b6c5760405162461bcd60e51b815260206004820152600a602482015269216c697175696469747960b01b60448201526064015b60405180910390fd5b8015610b8057600095505050505050610c68565b600087158015610bba57506001600160a01b038087166000908152600860209081526040808320938e16835260029093019052205460ff16155b15610bc6575083610be8565b610bd1838a8a61411f565b905087158015610be057508085105b15610be85750835b6000896001600160a01b0316633b1d21a26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4c9190615987565b905080821115610c5c5780610c5e565b815b9750505050505050505b9392505050565b6001600160a01b03841660009081526008602052604081205460ff16610c995760085b9050610ca9565b610ca3858461423b565b60005b90505b949350505050565b6000610cbc826142dc565b92915050565b6000610ccc61454e565b610cdc57610cbc600160076145a2565b6040805160208082018352848252825190810190925266b1a2bc2ec50000808352815191929111610d1357610ca9600560086145a2565b6040805160208101909152670c7d713b49da000080825283511115610d4757610d3e600560086145a2565b95945050505050565b600480549086905560408051828152602081018890527f3b9670cf975d26958e754b57098eaa2ac914d8d2a31b83257997b9f346110fd991015b60405180910390a160005b9695505050505050565b6001600160a01b0383166000908152600d60205260409020805460ff19166001179055610dc3848461461b565b50505050565b6001600160a01b03831660009081526014602052604081205460ff1615610e215760405162461bcd60e51b815260206004820152600c60248201526b085b5a5b9d0e9c185d5cd95960a21b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff16610e4b5760085b9050610c68565b600f5460ff168015610e7657506001600160a01b03831660009081526010602052604090205460ff16155b15610e82576011610e44565b6000610e8d85610cb1565b90508015801590610ebc57506001600160a01b03851660009081526020805260409020610eba90856146b7565b155b15611000576000856001600160a01b0316634aeb3d9a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190615987565b9050600030604051637db121fd60e11b81526001600160a01b038981166004830152919091169063fb6243fa90602401602060405180830381865afa158015610f72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f969190615987565b90506000828210610fa957506000610fb6565b610fb382846159cc565b90505b83610fc187836159df565b10610ffc5760405162461bcd60e51b815260206004820152600b60248201526a021737570706c79206361760ac1b6044820152606401610b63565b5050505b61100a85856146d9565b600095945050505050565b600061101f61454e565b61102f57610cbc6001600d6145a2565b60408051602080820183528482528251908101909252670de0b6b3a76400008083528151919291101561106857610ca96007600e6145a2565b60408051602081019091526714d1120d7b1600008082528351111561109357610d3e6007600e6145a2565b600580549086905560408051828152602081018890527faeba5a6c40a8ac138134bff1aaa65debf25971188a58804bad717f82f0ec13169101610d81565b3360009081526008602052604090205460ff1661111a5760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610b63565b801580156111285750600082115b1561115d5760405162461bcd60e51b8152602060048201526005602482015264217a65726f60d81b6044820152606401610b63565b610dc3848461461b565b6009818154811061117757600080fd5b6000918252602090912001546001600160a01b0316905081565b600061119b61454e565b6111ab57610cbc600160126145a2565b600380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910160405180910390a160009392505050565b33301461124d5760405162461bcd60e51b815260206004820152600a602482015269085cd95b198818d85b1b60b21b6044820152606401610b63565b601a54610100900460ff1661126c57601a805461ffff19166101011790555b565b60008060008060008060008061128989600080600080613ca4565b93509350935093508360148111156112a3576112a36159a0565b99929850909650945092505050565b6001600160a01b03851660009081526008602052604081205460ff1615806112f357506001600160a01b03851660009081526008602052604090205460ff16155b156113025760085b9050610d3e565b6040516305eff7ef60e21b81526001600160a01b038481166004830152600091908816906317bfdfbc90602401602060405180830381865afa15801561134c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113709190615987565b905061137b87612069565b156113c557828110156113c05760405162461bcd60e51b815260206004820152600d60248201526c21626f72726f773e726570617960981b6044820152606401610b63565b611469565b6000806113d786600080600080613ca4565b935050509150600060148111156113f0576113f06159a0565b826014811115611402576114026159a0565b1461142357816014811115611419576114196159a0565b9350505050610d3e565b80600003611432576003611419565b600061144e604051806020016040528060045481525085614774565b905080861115611465576010945050505050610d3e565b5050505b5060009695505050505050565b3360009081526008602052604090205460ff166114d55760405162461bcd60e51b815260206004820152601f60248201527f21436f6d7074726f6c6c65723a5f61667465724e6f6e5265656e7472616e74006044820152606401610b63565b601a805460ff19166001179055565b610dc384848461478c565b601b818154811061117757600080fd5b61150a85838561478c565b5050505050565b600b818154811061117757600080fd5b600080546040805163fdb25fb160e01b8152905183926001600160a01b03169163fdb25fb19160048083019260209291908290030181865afa15801561156b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158f9190615987565b905080156116755760035460405163fc57d4df60e01b81526001600160a01b038681166004830152600092169063fc57d4df90602401602060405180830381865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190615987565b90508060000361161b57600c92505050610cbc565b60008061163660405180602001604052808581525087614830565b9092509050600082600381111561164f5761164f6159a0565b1461166257600a5b945050505050610cbc565b83811015611671576012611657565b5050505b6000949350505050565b6000806000806000806000806116988d8d8d8d8d613ca4565b93509350935093508360148111156116b2576116b26159a0565b975091955093509150505b95509550955095915050565b6040805160248082526104a08201909252606091908160208201610480803683370190505091506394543c1560e01b82611702836159f2565b92508260ff168151811061171857611718615a0f565b6001600160e01b031990921660209283029190910190910152635a2977b160e11b82611743836159f2565b92508260ff168151811061175957611759615a0f565b6001600160e01b031990921660209283029190910190910152632aff3bff60e21b82611784836159f2565b92508260ff168151811061179a5761179a615a0f565b6001600160e01b03199092166020928302919091019091015263929fe9a160e01b826117c5836159f2565b92508260ff16815181106117db576117db615a0f565b6001600160e01b0319909216602092830291909101909101526355ee1fe160e01b82611806836159f2565b92508260ff168151811061181c5761181c615a0f565b6001600160e01b03199092166020928302919091019091015263317b0b7760e01b82611847836159f2565b92508260ff168151811061185d5761185d615a0f565b6001600160e01b031990921660209283029190910190910152637201477760e11b82611888836159f2565b92508260ff168151811061189e5761189e615a0f565b6001600160e01b031990921660209283029190910190910152634fd42e1760e01b826118c9836159f2565b92508260ff16815181106118df576118df615a0f565b6001600160e01b031990921660209283029190910190910152634a956fad60e11b8261190a836159f2565b92508260ff168151811061192057611920615a0f565b6001600160e01b03199092166020928302919091019091015263c8c9c97560e01b8261194b836159f2565b92508260ff168151811061196157611961615a0f565b6001600160e01b03199092166020928302919091019091015263b9b5b15360e01b8261198c836159f2565b92508260ff16815181106119a2576119a2615a0f565b6001600160e01b031990921660209283029190910190910152637e361b1160e01b826119cd836159f2565b92508260ff16815181106119e3576119e3615a0f565b6001600160e01b031990921660209283029190910190910152630cbb414760e11b82611a0e836159f2565b92508260ff1681518110611a2457611a24615a0f565b6001600160e01b031990921660209283029190910190910152631853304760e31b82611a4f836159f2565b92508260ff1681518110611a6557611a65615a0f565b6001600160e01b031990921660209283029190910190910152630ede4edd60e41b82611a90836159f2565b92508260ff1681518110611aa657611aa6615a0f565b6001600160e01b031990921660209283029190910190910152634ef4c3e160e01b82611ad1836159f2565b92508260ff1681518110611ae757611ae7615a0f565b6001600160e01b03199092166020928302919091019091015263eabe7d9160e01b82611b12836159f2565b92508260ff1681518110611b2857611b28615a0f565b6001600160e01b0319909216602092830291909101909101526351dff98960e01b82611b53836159f2565b92508260ff1681518110611b6957611b69615a0f565b6001600160e01b03199092166020928302919091019091015263368f515360e21b82611b94836159f2565b92508260ff1681518110611baa57611baa615a0f565b6001600160e01b031990921660209283029190910190910152631de6c8a560e21b82611bd5836159f2565b92508260ff1681518110611beb57611beb615a0f565b6001600160e01b031990921660209283029190910190910152631200453160e11b82611c16836159f2565b92508260ff1681518110611c2c57611c2c615a0f565b6001600160e01b031990921660209283029190910190910152632fe3f38f60e11b82611c57836159f2565b92508260ff1681518110611c6d57611c6d615a0f565b6001600160e01b03199092166020928302919091019091015263d02f735160e01b82611c98836159f2565b92508260ff1681518110611cae57611cae615a0f565b6001600160e01b0319909216602092830291909101909101526317b9b84b60e31b82611cd9836159f2565b92508260ff1681518110611cef57611cef615a0f565b6001600160e01b0319909216602092830291909101909101526341c728b960e01b82611d1a836159f2565b92508260ff1681518110611d3057611d30615a0f565b6001600160e01b031990921660209283029190910190910152635ec88c7960e01b82611d5b836159f2565b92508260ff1681518110611d7157611d71615a0f565b6001600160e01b03199092166020928302919091019091015263c488847b60e01b82611d9c836159f2565b92508260ff1681518110611db257611db2615a0f565b6001600160e01b03199092166020928302919091019091015263c90c20b160e01b82611ddd836159f2565b92508260ff1681518110611df357611df3615a0f565b6001600160e01b03199092166020928302919091019091015263319728a160e11b82611e1e836159f2565b92508260ff1681518110611e3457611e34615a0f565b6001600160e01b031990921660209283029190910190910152632eb96f3160e11b82611e5f836159f2565b92508260ff1681518110611e7557611e75615a0f565b6001600160e01b031990921660209283029190910190910152630b33d1e960e21b82611ea0836159f2565b92508260ff1681518110611eb657611eb6615a0f565b6001600160e01b031990921660209283029190910190910152635881a44160e11b82611ee1836159f2565b92508260ff1681518110611ef757611ef7615a0f565b6001600160e01b031990921660209283029190910190910152639614b53b60e01b82611f22836159f2565b92508260ff1681518110611f3857611f38615a0f565b6001600160e01b03199092166020928302919091019091015263efcb03dd60e01b82611f63836159f2565b92508260ff1681518110611f7957611f79615a0f565b6001600160e01b031990921660209283029190910190910152636d35bf9160e01b82611fa4836159f2565b92508260ff1681518110611fba57611fba615a0f565b6001600160e01b03199092166020928302919091019091015263352b4a3f60e11b82611fe5836159f2565b92508260ff1681518110611ffb57611ffb615a0f565b6001600160e01b03199092166020928302919091019091015260ff8116156120655760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610b63565b5090565b6001600160a01b0381166000908152600860205260408120600101541580156120af57506001600160a01b03821660009081526015602052604090205460ff1615156001145b8015610cbc57506121c3612185836001600160a01b031663173b99046040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190615987565b846001600160a01b0316638d02d9a16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121809190615987565b614883565b836001600160a01b031663c3bf11cd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561215c573d6000803e3d6000fd5b670de0b6b3a76400001492915050565b60006121dd61454e565b6121ed57610cbc600160136145a2565b600f5482151560ff909116151503612206576000610cbc565b600f805460ff19168315159081179091556040519081527f84c7d948374a180eddab35d27d2f7a94167a1ff4e79467f1e89c061984190a1e906020015b60405180910390a16000610cbc565b61225c82826148b9565b5050565b6001600160a01b03811660009081526007602090815260408083208054825181850281018501909352808352606094938301828280156122c957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122ab575b5093979650505050505050565b6000610cbc82614955565b60006122eb61454e565b612302576122fb600160166145a2565b9050610d8c565b60028054600160a01b60ff60a01b1982168117909255600080546040516328f816b560e11b81529390920460ff169290916001600160a01b0316906351f02d6a90612359908c908c908c908c908c90600401615a4e565b6020604051808303816000875af1158015612378573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239c9190615a7e565b6002805460ff60a01b1916600160a01b85151502179055905060006123c0826149f4565b905060008054906101000a90046001600160a01b03166001600160a01b0316638aac2f0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124379190615a7e565b604051635a89ef5160e01b81523060048201526001600160a01b039190911690635a89ef5190602401600060405180830381600087803b15801561247a57600080fd5b505af115801561248e573d6000803e3d6000fd5b506000925061249b915050565b81146124a757806124b1565b6124b18286613570565b9a9950505050505050505050565b60006124c961454e565b6124fe5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610b63565b816001600160a01b031663abc6d72d6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561253e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125629190615a9b565b6125a65760405162461bcd60e51b815260206004820152601560248201527410b4b9a932bbb0b93239a234b9ba3934b13aba37b960591b6044820152606401610b63565b60005b60195481101561261e57601981815481106125c6576125c6615a0f565b6000918252602090912001546001600160a01b03908116908416036126165760405162461bcd60e51b815260206004820152600660248201526508585919195960d21b6044820152606401610b63565b6001016125a9565b50601980546001810182556000919091527f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950180546001600160a01b0319166001600160a01b0384169081179091556040519081527f98ef1187fb6fd2bc85f8996489877eb2b5428f9e9bdfc068c9ad6c2ea82eacc790602001612243565b601354600090600160b01b900460ff16156126ed5760405162461bcd60e51b815260206004820152601060248201526f085d1c985b9cd9995c8e9c185d5cd95960821b6044820152606401610b63565b60006126fa868685614c3b565b90508015612709579050610ca9565b612714868686614d03565b60009695505050505050565b60008054604051631beb2b9760e31b81526060926001600160a01b039092169163df595cb8916127659130913391839190356001600160e01b03191690600401615ab8565b602060405180830381865afa158015612782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a69190615a9b565b6127e35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b815160008167ffffffffffffffff811115612800576128006157a5565b604051908082528060200260200182016040528015612829578160200160208202803683370190505b50905060005b8281101561289657600085828151811061284b5761284b615a0f565b6020026020010151905061285f8133614da7565b6014811115612870576128706159a0565b83838151811061288257612882615a0f565b60209081029190910101525060010161282f565b509150505b919050565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092839283929091169063fc57d4df90602401602060405180830381865afa1580156128f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129159190615987565b60035460405163fc57d4df60e01b81526001600160a01b0388811660048301529293506000929091169063fc57d4df90602401602060405180830381865afa158015612965573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129899190615987565b9050811580612996575080155b156129aa57600c6000935093505050612bc4565b60008690506000816001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a139190615987565b90506000612a2d6040518060200160405280600081525090565b6040805160208101909152600081526040805160208101909152600081526000866001600160a01b0316636752e7026040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aaf9190615987565b90506000876001600160a01b031663be99f1196040518163ffffffff1660e01b8152600401602060405180830381865afa158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b159190615987565b90506000612b58612b446040518060200160405280600554815250604051806020016040528087815250614f41565b604051806020016040528085815250614f41565b9050612b728160405180602001604052808e815250614f76565b9550612b9a60405180602001604052808c81525060405180602001604052808b815250614f76565b9450612ba68686614fb5565b9350612bb2848f614774565b60009d509b5050505050505050505050505b935093915050565b6019818154811061117757600080fd5b6000612be661454e565b612bf657610c92600160146145a2565b60005b84811015612e71576000868683818110612c1557612c15615a0f565b9050602002016020810190612c2a919061539c565b9050848483818110612c3e57612c3e615a0f565b9050602002016020810190612c53919061566b565b15612d0b576001600160a01b03811660009081526010602052604090205460ff16612d06576001600160a01b0381166000818152601060205260408120805460ff19166001908117909155601180548083018255928190527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6890920180546001600160a01b03191690931790925554612cec91906159cc565b6001600160a01b0382166000908152601260205260409020555b612e68565b6001600160a01b03811660009081526010602052604090205460ff1615612e685760118054612d3c906001906159cc565b81548110612d4c57612d4c615a0f565b60009182526020808320909101546001600160a01b0384811684526012909252604090922054601180549290931692918110612d8a57612d8a615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506011805480612dc957612dc9615aeb565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038316825260129081905260408220546011805491939184908110612e1d57612e1d615a0f565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822094909455918416825260128352808220829055601090925220805460ff191690555b50600101612bf9565b506000610ca6565b3360009081526008602052604090205460ff16612ed85760405162461bcd60e51b815260206004820181905260248201527f21436f6d7074726f6c6c65723a5f6265666f72654e6f6e5265656e7472616e746044820152606401610b63565b601a5460ff16612f175760405162461bcd60e51b815260206004820152600a602482015269085c99595b9d195c995960b21b6044820152606401610b63565b601a805460ff19169055565b601354600090600160b81b900460ff1615612f705760405162461bcd60e51b815260206004820152600d60248201526c085cd95a5e994e9c185d5cd959609a1b6044820152606401610b63565b6001600160a01b03861660009081526008602052604090205460ff161580612fb157506001600160a01b03851660009081526008602052604090205460ff16155b15612fbd5760086112fb565b846001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301f9190615a7e565b6001600160a01b0316866001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308a9190615a7e565b6001600160a01b03161461309f5760026112fb565b612714868486614d03565b6011818154811061117757600080fd5b6001600160a01b03831660009081526015602052604081205460ff16156131145760405162461bcd60e51b815260206004820152600e60248201526d08589bdc9c9bddce9c185d5cd95960921b6044820152606401610b63565b6001600160a01b03841660009081526008602052604090205460ff1661313b576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff1661322a57336001600160a01b038516146131ae5760405162461bcd60e51b815260206004820152600760248201526610b1ba37b5b2b760c91b6044820152606401610b63565b60006131ba3385614da7565b905060008160148111156131d0576131d06159a0565b146131ef578060148111156131e7576131e76159a0565b915050610c68565b6001600160a01b038086166000908152600860209081526040808320938816835260029093019052205460ff1661322857613228615b01565b505b60035460405163fc57d4df60e01b81526001600160a01b0386811660048301529091169063fc57d4df90602401602060405180830381865afa158015613274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132989190615987565b6000036132a657600c610e44565b600f5460ff1680156132d157506001600160a01b03831660009081526010602052604090205460ff16155b156132dd576011610e44565b60006132e8856122d6565b9050801580159061331857506001600160a01b038516600090815260216020526040902061331690856146b7565b155b1561345c576000856001600160a01b03166373acee986040518163ffffffff1660e01b8152600401602060405180830381865afa15801561335d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133819190615987565b9050600030604051631d3965af60e11b81526001600160a01b0389811660048301529190911690633a72cb5e90602401602060405180830381865afa1580156133ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f29190615987565b9050600082821061340557506000613412565b61340f82846159cc565b90505b8361341d87836159df565b106134585760405162461bcd60e51b815260206004820152600b60248201526a021626f72726f773a6361760ac1b6044820152606401610b63565b5050505b613466858561423b565b604051637e361b1160e01b81526001600160a01b0380861660048301528616602482015260006044820181905260648201859052608482018190529081903090637e361b119060a401608060405180830381865afa1580156134cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f09190615b17565b93505050915060006014811115613509576135096159a0565b821461351957509150610c689050565b801561352b5760049350505050610c68565b6000979650505050505050565b6007602052816000526040600020818154811061355457600080fd5b6000918252602090912001546001600160a01b03169150829050565b600061357a61454e565b6135915761358a600160096145a2565b9050610cbc565b6001600160a01b0383166000908152600860205260409020805460ff166135c6576135be6008600a6145a2565b915050610cbc565b60408051602080820183528582528251908101909252670c7d713b49da00008252906135f481835190511090565b1561360f576136056006600b6145a2565b9350505050610cbc565b8415801590613689575060035460405163fc57d4df60e01b81526001600160a01b0388811660048301529091169063fc57d4df90602401602060405180830381865afa158015613663573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136879190615987565b155b1561369957613605600c806145a2565b60018301805490869055604080516001600160a01b0389168152602081018390529081018790527f70483e6592cd5182d45ac970e05bc62cdcc90e9d8ef2c2dbe686cf383bcd7fc59060600160405180910390a16000979650505050505050565b600080613708858585614c3b565b90508015611000579050610c68565b60008054604051631beb2b9760e31b81526001600160a01b039091169063df595cb890613759903090339082906001600160e01b031988351690600401615ab8565b602060405180830381865afa158015613776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379a9190615a9b565b6137d75760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610b63565b6001600160a01b03821660009081526008602052604090205460ff1661383f5760405162461bcd60e51b815260206004820152601760248201527f21436f6d7074726f6c6c65723a657869744d61726b65740000000000000000006044820152606401610b63565b6040516361bfb47160e11b81523360048201528290600090819081906001600160a01b0385169063c37f68e290602401608060405180830381865afa15801561388c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b09190615b17565b50925092509250826000146138f55760405162461bcd60e51b815260206004820152600b60248201526a08595e1a5d13585c9ad95d60aa1b6044820152606401610b63565b801561390757610d8c600b60036145a2565b6000613914873385614c3b565b9050801561393457613929600d600483614fef565b979650505050505050565b6001600160a01b0387166000908152600860209081526040808320338452600281019092529091205460ff1661397257600098975050505050505050565b3360009081526002820160209081526040808320805460ff1916905560078252808320805482518185028101850190935280835291929091908301828280156139e457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116139c6575b5050835193945083925060009150505b82811015613a3e578b6001600160a01b0316848281518110613a1857613a18615a0f565b60200260200101516001600160a01b031603613a3657809150613a3e565b6001016139f4565b50818110613a4e57613a4e615b01565b33600090815260076020526040902080548190613a6d906001906159cc565b81548110613a7d57613a7d615a0f565b9060005260206000200160009054906101000a90046001600160a01b0316818381548110613aad57613aad615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080805480613aeb57613aeb615aeb565b600082815260208120820160001990810180546001600160a01b031916905590910190915581549003613c4757600b8054613b28906001906159cc565b81548110613b3857613b38615a0f565b6000918252602080832090910154338352600c909152604090912054600b80546001600160a01b03909316929091908110613b7557613b75615a0f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b805480613bb457613bb4615aeb565b60008281526020808220830160001990810180546001600160a01b0319169055909201909255338252600c908190526040822054600b805491939184908110613bff57613bff615a0f565b60009182526020808320909101546001600160a01b03168352828101939093526040918201812093909355338352600c8252808320839055600a9091529020805460ff191690555b604080516001600160a01b038e1681523360208201527fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d910160405180910390a160009c9b505050505050505050505050565b610dc384836148b9565b600080600080613cb26152bc565b6001600160a01b03891615613d365760035460405163fc57d4df60e01b81526001600160a01b038b811660048301529091169063fc57d4df90602401602060405180830381865afa158015613d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d2f9190615987565b6101808201525b60005b6001600160a01b038b166000908152600760205260409020548110156140bb576001600160a01b038b166000908152600760205260409020805482908110613d8357613d83615a0f565b60009182526020822001546001600160a01b039081168085526040516361bfb47160e11b8152918e1660048301529063c37f68e290602401608060405180830381865afa158015613dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dfc9190615b17565b60a08701526080860152606085015290508015613e2a57600e600080600096509650965096505050506116bd565b50604080516020808201835284516001600160a01b0390811660009081526008835284902060010154835260e08601929092528251908101835260a085015181526101008501526003548451925163fc57d4df60e01b81529282166004840152169063fc57d4df90602401602060405180830381865afa158015613eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ed69190615987565b60c08301819052600003613efa57600c6000806000955095509550955050506116bd565b604080516020810190915260c0830151815261012083015260e0820151610100830151613f3591613f2a91614f76565b836101200151614f76565b610140830152308251604051633c1f884b60e11b81526001600160a01b0391821660048201528c821660248201528b151560448201528d8216606482015291169063783f109690608401602060405180830381865afa158015613f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fc09190615987565b6101a08301526101408201516060830151600091613fdd91614774565b9050826101a00151811115613ff457506101a08201515b808360200181815161400691906159df565b9052505061012082015160808301516040840151614025929190615067565b604083015281516001600160a01b03808c169116036140b3576140528261014001518a8460400151615067565b6040830181905261012083015161406a918a90615067565b60408301526101208201516000906140829089614774565b90508260400151811061409b57600060408401526140b1565b80836040018181516140ad91906159cc565b9052505b505b600101613d39565b508060400151816020015111156140f45760208101516040820151600091906140e490826159cc565b60009450945094509450506116bd565b6000816020015160008360200151846040015161411191906159cc565b9450945094509450506116bd565b60008360000361413157506000610c68565b60035460405163fc57d4df60e01b81526001600160a01b038581166004830152600092169063fc57d4df90602401602060405180830381865afa15801561417c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141a09190615987565b9050600081116141dc5760405162461bcd60e51b8152602060048201526007602482015266216f7261636c6560c81b6044820152606401610b63565b8261421e576001600160a01b038416600090815260086020526040902060010154670de0b6b3a76400006142108383615b4d565b61421a9190615b64565b9150505b8061423186670de0b6b3a7640000615b4d565b610d3e9190615b64565b60005b6019548110156142d7576019818154811061425b5761425b615a0f565b600091825260209091200154604051631cdc2c5d60e31b81526001600160a01b03858116600483015284811660248301529091169063e6e162e890604401600060405180830381600087803b1580156142b357600080fd5b505af11580156142c7573d6000803e3d6000fd5b50506001909201915061423e9050565b505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561452c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143829190615a7e565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156143db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143ff9190615b9e565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916144589190615c39565b600060405180830381855afa9150503d8060008114614493576040519150601f19603f3d011682016040523d82523d6000602084013e614498565b606091505b50915091508180156144ab575080516020145b156144ca57808060200190518101906144c49190615c55565b60ff1692505b60408501516144dc9060000b84615c72565b925060008312614502576144f183600a615d76565b6144fb9087615b4d565b9550614523565b61450b83615d82565b61451690600a615d76565b6145209087615b64565b95505b50505050614548565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546000906001600160a01b0316331480156145745750600254600160a81b900460ff165b8061459d57506000546001600160a01b03163314801561459d5750600254600160a01b900460ff165b905090565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156145d7576145d76159a0565b83601a8111156145e9576145e96159a0565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610c6857610c686159a0565b60005b6019548110156142d7576019818154811061463b5761463b615a0f565b600091825260209091200154604051630509462560e21b81526001600160a01b038581166004830152848116602483015290911690631425189490604401600060405180830381600087803b15801561469357600080fd5b505af11580156146a7573d6000803e3d6000fd5b50506001909201915061461e9050565b6001600160a01b03811660009081526001830160205260408120541515610c68565b60005b6019548110156142d757601981815481106146f9576146f9615a0f565b60009182526020909120015460405162e48b0f60e51b81526001600160a01b038581166004830152848116602483015290911690631c9161e090604401600060405180830381600087803b15801561475057600080fd5b505af1158015614764573d6000803e3d6000fd5b5050600190920191506146dc9050565b6000806147818484615088565b9050610ca9816150b0565b60005b601954811015610dc357601981815481106147ac576147ac615a0f565b600091825260209091200154604051632a29f11f60e21b81526001600160a01b038681166004830152858116602483015284811660448301529091169063a8a7c47c90606401600060405180830381600087803b15801561480c57600080fd5b505af1158015614820573d6000803e3d6000fd5b50506001909201915061478f9050565b60008060008061484086866150c8565b90925090506000826003811115614859576148596159a0565b1461486a575091506000905061487c565b6000614875826150b0565b9350935050505b9250929050565b6000610c688383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b815250615144565b60005b6019548110156142d757601981815481106148d9576148d9615a0f565b60009182526020909120015460405163d27c545360e01b81526001600160a01b03858116600483015284811660248301529091169063d27c545390604401600060405180830381600087803b15801561493157600080fd5b505af1158015614945573d6000803e3d6000fd5b5050600190920191506148bc9050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b93830193909352156149d7576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561435e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60006149fe61454e565b614a0e57610cbc600160166145a2565b6001600160a01b03821660009081526008602052604090205460ff1615614a3b57610cbc600960156145a2565b306001600160a01b0316826001600160a01b0316635fe3b5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614aa79190615a7e565b6001600160a01b031614614aec5760405162461bcd60e51b815260206004820152600c60248201526b10b1b7b6b83a3937b63632b960a11b6044820152606401610b63565b6000826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b509190615a7e565b6001600160a01b038082166000908152600e60205260409020549192501615614b7f57610c68600960156145a2565b6001600160a01b038381166000818152600860209081526040808320805460ff1916600190811782558082018590556009805491820190557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b031990811687179091559587168452600e835292819020805490951684179094559251918252917fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f910160405180910390a16000610ca9565b6001600160a01b03831660009081526008602052604081205460ff16614c62576008610e44565b6001600160a01b038085166000908152600860209081526040808320938716835260029093019052205460ff16614c9a576000610e44565b600080614cab858786600080613ca4565b93505050915060006014811115614cc457614cc46159a0565b826014811115614cd657614cd66159a0565b14614cf657816014811115614ced57614ced6159a0565b92505050610c68565b8015612714576004614ced565b60005b601954811015610dc35760198181548110614d2357614d23615a0f565b600091825260209091200154604051634e081c9560e01b81526001600160a01b0386811660048301528581166024830152848116604483015290911690634e081c9590606401600060405180830381600087803b158015614d8357600080fd5b505af1158015614d97573d6000803e3d6000fd5b505060019092019150614d069050565b6001600160a01b0382166000908152600860205260408120805460ff16614dd2576008915050610cbc565b6001600160a01b038316600090815260028201602052604090205460ff161515600103614e03576000915050610cbc565b6001600160a01b03838116600081815260028401602090815260408083208054600160ff199091168117909155600783528184208054918201815584528284200180546001600160a01b031916958a1695909517909455918152600a909152205460ff16614ef457600b8054600180820183557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990910180546001600160a01b0319166001600160a01b0387169081179091556000908152600a60205260409020805460ff1916821790559054614eda91906159cc565b6001600160a01b0384166000908152600c60205260409020555b604080516001600160a01b038087168252851660208201527f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a5910160405180910390a15060009392505050565b6040805160208101909152600081526040518060200160405280614f6d85600001518560000151614883565b90529392505050565b6040805160208101909152600081526040518060200160405280670de0b6b3a7640000614fab8660000151866000015161517e565b614f6d9190615b64565b6040805160208101909152600081526040518060200160405280614f6d614fe88660000151670de0b6b3a764000061517e565b85516151c0565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846014811115615024576150246159a0565b84601a811115615036576150366159a0565b604080519283526020830191909152810184905260600160405180910390a1836014811115610ca957610ca96159a0565b6000806150748585615088565b9050610d3e615082826150b0565b84614883565b6040805160208101909152600081526040518060200160405280614f6d85600001518561517e565b8051600090610cbc90670de0b6b3a764000090615b64565b60006150e06040518060200160405280600081525090565b6000806150f18660000151866151f3565b9092509050600082600381111561510a5761510a6159a0565b146151295750604080516020810190915260008152909250905061487c565b60408051602081019091529081526000969095509350505050565b60008061515184866159df565b905082858210156151755760405162461bcd60e51b8152600401610b639190615d9e565b50949350505050565b6000610c6883836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f7700000000000000000081525061523d565b6000610c6883836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250615290565b600080836000036152095750600090508061487c565b838302836152178683615b64565b1461522a5760026000925092505061487c565b60009250905061487c565b509250929050565b600083158061524a575082155b1561525757506000610c68565b60006152638486615b4d565b9050836152708683615b64565b1483906151755760405162461bcd60e51b8152600401610b639190615d9e565b600081836152b15760405162461bcd60e51b8152600401610b639190615d9e565b50610ca98385615b64565b604051806101c0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016153186040518060200160405280600081525090565b81526020016153336040518060200160405280600081525090565b815260200161534e6040518060200160405280600081525090565b81526020016153696040518060200160405280600081525090565b81526020016000815260200160008152602001600081525090565b6001600160a01b038116811461539957600080fd5b50565b6000602082840312156153ae57600080fd5b8135610c6881615384565b801515811461539957600080fd5b6000806000606084860312156153dc57600080fd5b83356153e781615384565b925060208401356153f781615384565b91506040840135615407816153b9565b809150509250925092565b6000806040838503121561542557600080fd5b823561543081615384565b9150602083013561544081615384565b809150509250929050565b6000806000806080858703121561546157600080fd5b843561546c81615384565b9350602085013561547c81615384565b9250604085013561548c81615384565b9396929550929360600135925050565b6000602082840312156154ae57600080fd5b5035919050565b600080600080608085870312156154cb57600080fd5b84356154d681615384565b935060208501356154e681615384565b93969395505050506040820135916060013590565b60008060006060848603121561551057600080fd5b833561551b81615384565b9250602084013561552b81615384565b929592945050506040919091013590565b600080600080600060a0868803121561555457600080fd5b853561555f81615384565b9450602086013561556f81615384565b9350604086013561557f81615384565b9250606086013561558f81615384565b949793965091946080013592915050565b600080604083850312156155b357600080fd5b82356155be81615384565b946020939093013593505050565b600080600080600060a086880312156155e457600080fd5b85356155ef81615384565b945060208601356155ff81615384565b94979496505050506040830135926060810135926080909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160e01b03191683529284019291840191600101615639565b50909695505050505050565b60006020828403121561567d57600080fd5b8135610c68816153b9565b6020808252825182820181905260009190848201906040850190845b8181101561565f5783516001600160a01b0316835292840192918401916001016156a4565b60ff8116811461539957600080fd5b60008083601f8401126156ea57600080fd5b50813567ffffffffffffffff81111561570257600080fd5b60208301915083602082850101111561487c57600080fd5b6000806000806000806080878903121561573357600080fd5b863561573e816156c9565b9550602087013567ffffffffffffffff8082111561575b57600080fd5b6157678a838b016156d8565b9097509550604089013591508082111561578057600080fd5b5061578d89828a016156d8565b979a9699509497949695606090950135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156157e4576157e46157a5565b604052919050565b600060208083850312156157ff57600080fd5b823567ffffffffffffffff8082111561581757600080fd5b818501915085601f83011261582b57600080fd5b81358181111561583d5761583d6157a5565b8060051b915061584e8483016157bb565b818152918301840191848101908884111561586857600080fd5b938501935b83851015615892578435925061588283615384565b828252938501939085019061586d565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561565f578351835292840192918401916001016158ba565b60008083601f8401126158e857600080fd5b50813567ffffffffffffffff81111561590057600080fd5b6020830191508360208260051b850101111561487c57600080fd5b6000806000806040858703121561593157600080fd5b843567ffffffffffffffff8082111561594957600080fd5b615955888389016158d6565b9096509450602087013591508082111561596e57600080fd5b5061597b878288016158d6565b95989497509550505050565b60006020828403121561599957600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610cbc57610cbc6159b6565b80820180821115610cbc57610cbc6159b6565b600060ff821680615a0557615a056159b6565b6000190192915050565b634e487b7160e01b600052603260045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60ff86168152606060208201526000615a6b606083018688615a25565b8281036040840152615892818587615a25565b600060208284031215615a9057600080fd5b8151610c6881615384565b600060208284031215615aad57600080fd5b8151610c68816153b9565b6001600160a01b0394851681529284166020840152921660408201526001600160e01b0319909116606082015260800190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60008060008060808587031215615b2d57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbc57610cbc6159b6565b600082615b8157634e487b7160e01b600052601260045260246000fd5b500490565b805167ffffffffffffffff8116811461289b57600080fd5b600060608284031215615bb057600080fd5b6040516060810181811067ffffffffffffffff82111715615bd357615bd36157a5565b604052615bdf83615b86565b8152615bed60208401615b86565b6020820152604083015163ffffffff81168114615c0957600080fd5b60408201529392505050565b60005b83811015615c30578181015183820152602001615c18565b50506000910152565b60008251615c4b818460208701615c15565b9190910192915050565b600060208284031215615c6757600080fd5b8151610c68816156c9565b8082018281126000831280158216821582161715615c9257615c926159b6565b505092915050565b600181815b80851115615235578160001904821115615cbb57615cbb6159b6565b80851615615cc857918102915b93841c9390800290615c9f565b600082615ce457506001610cbc565b81615cf157506000610cbc565b8160018114615d075760028114615d1157615d2d565b6001915050610cbc565b60ff841115615d2257615d226159b6565b50506001821b610cbc565b5060208310610133831016604e8410600b8410161715615d50575081810a610cbc565b615d5a8383615c9a565b8060001904821115615d6e57615d6e6159b6565b029392505050565b6000610c688383615cd5565b6000600160ff1b8201615d9757615d976159b6565b5060000390565b6020815260008251806020840152615dbd816040850160208701615c15565b601f01601f1916919091016040019291505056fea2646970667358221220207585e6ea295e0bcb79c18e9bc75865f59f2f4f261ff0bc21c503e3f9d9059064736f6c63430008160033", "devdoc": { "author": "Compound", "details": "This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).", @@ -2135,7 +2135,7 @@ "storageLayout": { "storage": [ { - "astId": 34249, + "astId": 35919, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "ionicAdmin", "offset": 0, @@ -2143,7 +2143,7 @@ "type": "t_address_payable" }, { - "astId": 34252, + "astId": 35922, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "admin", "offset": 0, @@ -2151,7 +2151,7 @@ "type": "t_address" }, { - "astId": 34255, + "astId": 35925, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "pendingAdmin", "offset": 0, @@ -2159,7 +2159,7 @@ "type": "t_address" }, { - "astId": 34259, + "astId": 35929, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "ionicAdminHasRights", "offset": 20, @@ -2167,7 +2167,7 @@ "type": "t_bool" }, { - "astId": 34263, + "astId": 35933, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "adminHasRights", "offset": 21, @@ -2175,15 +2175,15 @@ "type": "t_bool" }, { - "astId": 34296, + "astId": 35966, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "oracle", "offset": 0, "slot": "3", - "type": "t_contract(BasePriceOracle)61853" + "type": "t_contract(BasePriceOracle)66819" }, { - "astId": 34299, + "astId": 35969, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "closeFactorMantissa", "offset": 0, @@ -2191,7 +2191,7 @@ "type": "t_uint256" }, { - "astId": 34302, + "astId": 35972, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "liquidationIncentiveMantissa", "offset": 0, @@ -2199,7 +2199,7 @@ "type": "t_uint256" }, { - "astId": 34304, + "astId": 35974, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "maxAssets", "offset": 0, @@ -2207,31 +2207,31 @@ "type": "t_uint256" }, { - "astId": 34311, + "astId": 35981, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "accountAssets", "offset": 0, "slot": "7", - "type": "t_mapping(t_address,t_array(t_contract(ICErc20)26625)dyn_storage)" + "type": "t_mapping(t_address,t_array(t_contract(ICErc20)28192)dyn_storage)" }, { - "astId": 34329, + "astId": 35999, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "markets", "offset": 0, "slot": "8", - "type": "t_mapping(t_address,t_struct(Market)34323_storage)" + "type": "t_mapping(t_address,t_struct(Market)35993_storage)" }, { - "astId": 34334, + "astId": 36004, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "allMarkets", "offset": 0, "slot": "9", - "type": "t_array(t_contract(ICErc20)26625)dyn_storage" + "type": "t_array(t_contract(ICErc20)28192)dyn_storage" }, { - "astId": 34339, + "astId": 36009, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowers", "offset": 0, @@ -2239,7 +2239,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34343, + "astId": 36013, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "allBorrowers", "offset": 0, @@ -2247,7 +2247,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34347, + "astId": 36017, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowerIndexes", "offset": 0, @@ -2255,7 +2255,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34352, + "astId": 36022, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "suppliers", "offset": 0, @@ -2263,15 +2263,15 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34358, + "astId": 36028, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "cTokensByUnderlying", "offset": 0, "slot": "14", - "type": "t_mapping(t_address,t_contract(ICErc20)26625)" + "type": "t_mapping(t_address,t_contract(ICErc20)28192)" }, { - "astId": 34361, + "astId": 36031, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "enforceWhitelist", "offset": 0, @@ -2279,7 +2279,7 @@ "type": "t_bool" }, { - "astId": 34366, + "astId": 36036, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "whitelist", "offset": 0, @@ -2287,7 +2287,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34370, + "astId": 36040, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "whitelistArray", "offset": 0, @@ -2295,7 +2295,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34374, + "astId": 36044, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "whitelistIndexes", "offset": 0, @@ -2303,7 +2303,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34377, + "astId": 36047, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "pauseGuardian", "offset": 0, @@ -2311,7 +2311,7 @@ "type": "t_address" }, { - "astId": 34379, + "astId": 36049, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_mintGuardianPaused", "offset": 20, @@ -2319,7 +2319,7 @@ "type": "t_bool" }, { - "astId": 34381, + "astId": 36051, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_borrowGuardianPaused", "offset": 21, @@ -2327,7 +2327,7 @@ "type": "t_bool" }, { - "astId": 34383, + "astId": 36053, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "transferGuardianPaused", "offset": 22, @@ -2335,7 +2335,7 @@ "type": "t_bool" }, { - "astId": 34385, + "astId": 36055, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "seizeGuardianPaused", "offset": 23, @@ -2343,7 +2343,7 @@ "type": "t_bool" }, { - "astId": 34389, + "astId": 36059, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "mintGuardianPaused", "offset": 0, @@ -2351,7 +2351,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34393, + "astId": 36063, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowGuardianPaused", "offset": 0, @@ -2359,7 +2359,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34399, + "astId": 36069, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowCapGuardian", "offset": 0, @@ -2367,7 +2367,7 @@ "type": "t_address" }, { - "astId": 34404, + "astId": 36074, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowCaps", "offset": 0, @@ -2375,7 +2375,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34409, + "astId": 36079, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "supplyCaps", "offset": 0, @@ -2383,7 +2383,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34413, + "astId": 36083, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "rewardsDistributors", "offset": 0, @@ -2391,7 +2391,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34416, + "astId": 36086, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_notEntered", "offset": 0, @@ -2399,7 +2399,7 @@ "type": "t_bool" }, { - "astId": 34419, + "astId": 36089, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_notEnteredInitialized", "offset": 1, @@ -2407,7 +2407,7 @@ "type": "t_bool" }, { - "astId": 34423, + "astId": 36093, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "nonAccruingRewardsDistributors", "offset": 0, @@ -2415,7 +2415,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34430, + "astId": 36100, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowCapForCollateral", "offset": 0, @@ -2423,7 +2423,7 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" }, { - "astId": 34437, + "astId": 36107, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowingAgainstCollateralBlacklist", "offset": 0, @@ -2431,52 +2431,52 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 34445, + "astId": 36115, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowCapForCollateralWhitelist", "offset": 0, "slot": "30", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))" }, { - "astId": 34453, + "astId": 36123, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowingAgainstCollateralBlacklistWhitelist", "offset": 0, "slot": "31", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))" }, { - "astId": 34459, + "astId": 36129, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "supplyCapWhitelist", "offset": 0, "slot": "32", - "type": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "type": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, { - "astId": 34465, + "astId": 36135, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowCapWhitelist", "offset": 0, "slot": "33", - "type": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "type": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, { - "astId": 34472, + "astId": 36142, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "borrowCapConfig", "offset": 0, "slot": "34", - "type": "t_struct(PrudentiaConfig)19800_storage" + "type": "t_struct(PrudentiaConfig)21191_storage" }, { - "astId": 34476, + "astId": 36146, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "supplyCapConfig", "offset": 0, "slot": "35", - "type": "t_struct(PrudentiaConfig)19800_storage" + "type": "t_struct(PrudentiaConfig)21191_storage" } ], "types": { @@ -2502,8 +2502,8 @@ "label": "bytes32[]", "numberOfBytes": "32" }, - "t_array(t_contract(ICErc20)26625)dyn_storage": { - "base": "t_contract(ICErc20)26625", + "t_array(t_contract(ICErc20)28192)dyn_storage": { + "base": "t_contract(ICErc20)28192", "encoding": "dynamic_array", "label": "contract ICErc20[]", "numberOfBytes": "32" @@ -2518,12 +2518,12 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(BasePriceOracle)61853": { + "t_contract(BasePriceOracle)66819": { "encoding": "inplace", "label": "contract BasePriceOracle", "numberOfBytes": "20" }, - "t_contract(ICErc20)26625": { + "t_contract(ICErc20)28192": { "encoding": "inplace", "label": "contract ICErc20", "numberOfBytes": "20" @@ -2533,12 +2533,12 @@ "label": "int8", "numberOfBytes": "1" }, - "t_mapping(t_address,t_array(t_contract(ICErc20)26625)dyn_storage)": { + "t_mapping(t_address,t_array(t_contract(ICErc20)28192)dyn_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract ICErc20[])", "numberOfBytes": "32", - "value": "t_array(t_contract(ICErc20)26625)dyn_storage" + "value": "t_array(t_contract(ICErc20)28192)dyn_storage" }, "t_mapping(t_address,t_bool)": { "encoding": "mapping", @@ -2547,12 +2547,12 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_address,t_contract(ICErc20)26625)": { + "t_mapping(t_address,t_contract(ICErc20)28192)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract ICErc20)", "numberOfBytes": "32", - "value": "t_contract(ICErc20)26625" + "value": "t_contract(ICErc20)28192" }, "t_mapping(t_address,t_mapping(t_address,t_bool))": { "encoding": "mapping", @@ -2561,12 +2561,12 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_bool)" }, - "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))": { + "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(address => struct EnumerableSet.AddressSet))", "numberOfBytes": "32", - "value": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "value": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, "t_mapping(t_address,t_mapping(t_address,t_uint256))": { "encoding": "mapping", @@ -2575,19 +2575,19 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_uint256)" }, - "t_mapping(t_address,t_struct(AddressSet)8457_storage)": { + "t_mapping(t_address,t_struct(AddressSet)9069_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct EnumerableSet.AddressSet)", "numberOfBytes": "32", - "value": "t_struct(AddressSet)8457_storage" + "value": "t_struct(AddressSet)9069_storage" }, - "t_mapping(t_address,t_struct(Market)34323_storage)": { + "t_mapping(t_address,t_struct(Market)35993_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ComptrollerV2Storage.Market)", "numberOfBytes": "32", - "value": "t_struct(Market)34323_storage" + "value": "t_struct(Market)35993_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -2603,27 +2603,27 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(AddressSet)8457_storage": { + "t_struct(AddressSet)9069_storage": { "encoding": "inplace", "label": "struct EnumerableSet.AddressSet", "members": [ { - "astId": 8456, + "astId": 9068, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_inner", "offset": 0, "slot": "0", - "type": "t_struct(Set)8142_storage" + "type": "t_struct(Set)8754_storage" } ], "numberOfBytes": "64" }, - "t_struct(Market)34323_storage": { + "t_struct(Market)35993_storage": { "encoding": "inplace", "label": "struct ComptrollerV2Storage.Market", "members": [ { - "astId": 34316, + "astId": 35986, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "isListed", "offset": 0, @@ -2631,7 +2631,7 @@ "type": "t_bool" }, { - "astId": 34318, + "astId": 35988, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "collateralFactorMantissa", "offset": 0, @@ -2639,7 +2639,7 @@ "type": "t_uint256" }, { - "astId": 34322, + "astId": 35992, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "accountMembership", "offset": 0, @@ -2649,12 +2649,12 @@ ], "numberOfBytes": "96" }, - "t_struct(PrudentiaConfig)19800_storage": { + "t_struct(PrudentiaConfig)21191_storage": { "encoding": "inplace", "label": "struct PrudentiaLib.PrudentiaConfig", "members": [ { - "astId": 19795, + "astId": 21186, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "controller", "offset": 0, @@ -2662,7 +2662,7 @@ "type": "t_address" }, { - "astId": 19797, + "astId": 21188, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "offset", "offset": 20, @@ -2670,7 +2670,7 @@ "type": "t_uint8" }, { - "astId": 19799, + "astId": 21190, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "decimalShift", "offset": 21, @@ -2680,12 +2680,12 @@ ], "numberOfBytes": "32" }, - "t_struct(Set)8142_storage": { + "t_struct(Set)8754_storage": { "encoding": "inplace", "label": "struct EnumerableSet.Set", "members": [ { - "astId": 8137, + "astId": 8749, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_values", "offset": 0, @@ -2693,7 +2693,7 @@ "type": "t_array(t_bytes32)dyn_storage" }, { - "astId": 8141, + "astId": 8753, "contract": "contracts/compound/Comptroller.sol:Comptroller", "label": "_indexes", "offset": 0, diff --git a/packages/contracts/deployments/base/ComptrollerFirstExtension.json b/packages/contracts/deployments/base/ComptrollerFirstExtension.json index 6d7e8a802f..8d0ee0c8c7 100644 --- a/packages/contracts/deployments/base/ComptrollerFirstExtension.json +++ b/packages/contracts/deployments/base/ComptrollerFirstExtension.json @@ -1,5 +1,5 @@ { - "address": "0x0C7d81F299dD96bF01432dE64f262E48AfF4F5ea", + "address": "0xC35a8090c13879438E3bF6aC5f1DCFD0Ef6f34c0", "abi": [ { "anonymous": false, @@ -1419,28 +1419,28 @@ "type": "function" } ], - "transactionHash": "0x77f0d615aac06f2f42970dc9b72eb9dba2ab95008a0c692405a1ae45ac118ee6", + "transactionHash": "0x8d100e9714fa25b22a45d73672c4190e65a78abef7fb284e006e9b0c28fa9fa8", "receipt": { "to": null, "from": "0x1155b614971f16758C92c4890eD338C9e3ede6b7", - "contractAddress": "0x0C7d81F299dD96bF01432dE64f262E48AfF4F5ea", - "transactionIndex": 183, + "contractAddress": "0xC35a8090c13879438E3bF6aC5f1DCFD0Ef6f34c0", + "transactionIndex": 78, "gasUsed": "3575655", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc9047d99120989af8ef046617b89fa5ee465e922739bb8fcd6fd2a65da50bfb1", - "transactionHash": "0x77f0d615aac06f2f42970dc9b72eb9dba2ab95008a0c692405a1ae45ac118ee6", + "blockHash": "0x8efcf5ba9b5efbf42e07dac1e2cecb8db4377599de5270f3717daf01507b6084", + "transactionHash": "0x8d100e9714fa25b22a45d73672c4190e65a78abef7fb284e006e9b0c28fa9fa8", "logs": [], - "blockNumber": 26592646, - "cumulativeGasUsed": "63984586", + "blockNumber": 29834088, + "cumulativeGasUsed": "31710751", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 2, - "solcInputHash": "6008ad86aa2c4274c6330382b8ed4717", - "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"action\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"pauseState\",\"type\":\"bool\"}],\"name\":\"ActionPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"action\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"pauseState\",\"type\":\"bool\"}],\"name\":\"MarketActionPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"MarketUnlisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBorrowCap\",\"type\":\"uint256\"}],\"name\":\"NewBorrowCap\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldBorrowCapGuardian\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newBorrowCapGuardian\",\"type\":\"address\"}],\"name\":\"NewBorrowCapGuardian\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldPauseGuardian\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newPauseGuardian\",\"type\":\"address\"}],\"name\":\"NewPauseGuardian\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSupplyCap\",\"type\":\"uint256\"}],\"name\":\"NewSupplyCap\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"blacklisted\",\"type\":\"bool\"}],\"name\":\"_blacklistBorrowingAgainstCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_blacklistBorrowingAgainstCollateralWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_borrowCapWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"flywheelAddress\",\"type\":\"address\"}],\"name\":\"_removeFlywheel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"name\":\"_setBorrowCapForCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_setBorrowCapForCollateralWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newBorrowCapGuardian\",\"type\":\"address\"}],\"name\":\"_setBorrowCapGuardian\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setBorrowPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"cTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"newBorrowCaps\",\"type\":\"uint256[]\"}],\"name\":\"_setMarketBorrowCaps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"cTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"newSupplyCaps\",\"type\":\"uint256[]\"}],\"name\":\"_setMarketSupplyCaps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setMintPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newPauseGuardian\",\"type\":\"address\"}],\"name\":\"_setPauseGuardian\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setSeizePaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setTransferPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_supplyCapWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"_unsupportMarket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"accountAssets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"flywheelAddress\",\"type\":\"address\"}],\"name\":\"addNonAccruingFlywheel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allBorrowers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCapForCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowCapGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowingAgainstCollateralBlacklist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"cTokensByUnderlying\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"closeFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveBorrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveSupplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplyCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforceWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAccruingFlywheels\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllBorrowers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllBorrowersCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"contract ICErc20\",\"name\":\"cTokenModify\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"redeeming\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAssetAsCollateralValueCap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"page\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pageSize\",\"type\":\"uint256\"}],\"name\":\"getPaginatedBorrowers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalPages\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_pageOfBorrowers\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardsDistributors\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWhitelist\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"getWhitelistedBorrowersBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowed\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"getWhitelistedSuppliersSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplied\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBlacklistBorrowingAgainstCollateralWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBorrowCapForCollateralWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBorrowCapWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isComptroller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isSupplyCapWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"isUserOfPool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationIncentiveMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"markets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isListed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nonAccruingRewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registerInSFS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seizeGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"suppliers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transferGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistArray\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Failure(uint256,uint256,uint256)\":{\"details\":\"`error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.*\"}},\"kind\":\"dev\",\"methods\":{\"_getExtensionFunctions()\":{\"returns\":{\"_0\":\"a list of all the function selectors that this logic extension exposes\"}},\"_removeFlywheel(address)\":{\"details\":\"Removes a flywheel from the accruing or non-accruing array\",\"params\":{\"flywheelAddress\":\"The address of the flywheel to remove from the accruing or non-accruing array\"},\"returns\":{\"_0\":\"true if the flywheel was found and removed\"}},\"_setBorrowCapGuardian(address)\":{\"params\":{\"newBorrowCapGuardian\":\"The address of the new Borrow Cap Guardian\"}},\"_setMarketBorrowCaps(address[],uint256[])\":{\"details\":\"Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\",\"params\":{\"cTokens\":\"The addresses of the markets (tokens) to change the borrow caps for\",\"newBorrowCaps\":\"The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\"}},\"_setMarketSupplyCaps(address[],uint256[])\":{\"details\":\"Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\",\"params\":{\"cTokens\":\"The addresses of the markets (tokens) to change the supply caps for\",\"newSupplyCaps\":\"The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\"}},\"_setPauseGuardian(address)\":{\"params\":{\"newPauseGuardian\":\"The address of the new Pause Guardian\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See enum Error for details)\"}},\"_unsupportMarket(address)\":{\"details\":\"Admin function unset isListed and collateralFactorMantissa and unadd support for the market\",\"params\":{\"cToken\":\"The address of the market (token) to unlist\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See enum Error for details)\"}},\"addNonAccruingFlywheel(address)\":{\"details\":\"Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\",\"params\":{\"flywheelAddress\":\"The address of the flywheel to add to the non-accruing\"}},\"effectiveBorrowCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"effectiveSupplyCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"getAllBorrowers()\":{\"details\":\"The automatic getter may be used to access an individual borrower.\",\"returns\":{\"_0\":\"The list of borrower account addresses\"}},\"getAllMarkets()\":{\"details\":\"The automatic getter may be used to access an individual market.\",\"returns\":{\"_0\":\"The list of market addresses\"}},\"getWhitelist()\":{\"details\":\"The automatic getter may be used to access an individual whitelist status.\",\"returns\":{\"_0\":\"The list of borrower account addresses\"}}},\"version\":1},\"userdoc\":{\"events\":{\"ActionPaused(string,bool)\":{\"notice\":\"Emitted when an action is paused globally\"},\"MarketActionPaused(address,string,bool)\":{\"notice\":\"Emitted when an action is paused on a market\"},\"MarketUnlisted(address)\":{\"notice\":\"Emitted when an admin unsupports a market\"},\"NewBorrowCap(address,uint256)\":{\"notice\":\"Emitted when borrow cap for a cToken is changed\"},\"NewBorrowCapGuardian(address,address)\":{\"notice\":\"Emitted when borrow cap guardian is changed\"},\"NewPauseGuardian(address,address)\":{\"notice\":\"Emitted when pause guardian is changed\"},\"NewSupplyCap(address,uint256)\":{\"notice\":\"Emitted when supply cap for a cToken is changed\"}},\"kind\":\"user\",\"methods\":{\"_setBorrowCapGuardian(address)\":{\"notice\":\"Admin function to change the Borrow Cap Guardian\"},\"_setMarketBorrowCaps(address[],uint256[])\":{\"notice\":\"Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\"},\"_setMarketSupplyCaps(address[],uint256[])\":{\"notice\":\"Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\"},\"_setPauseGuardian(address)\":{\"notice\":\"Admin function to change the Pause Guardian\"},\"_unsupportMarket(address)\":{\"notice\":\"Removed a market from the markets mapping and sets it as unlisted\"},\"accountAssets(address,uint256)\":{\"notice\":\"Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\"},\"addNonAccruingFlywheel(address)\":{\"notice\":\"Returns true if the accruing flyhwheel was found and replaced\"},\"admin()\":{\"notice\":\"Administrator for this contract\"},\"adminHasRights()\":{\"notice\":\"Whether or not the admin has admin rights\"},\"allBorrowers(uint256)\":{\"notice\":\"A list of all borrowers who have entered markets\"},\"allMarkets(uint256)\":{\"notice\":\"A list of all markets\"},\"borrowCapGuardian()\":{\"notice\":\"The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\"},\"borrowCaps(address)\":{\"notice\":\"Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\"},\"cTokensByUnderlying(address)\":{\"notice\":\"All cTokens addresses mapped by their underlying token addresses\"},\"closeFactorMantissa()\":{\"notice\":\"Multiplier used to calculate the maximum repayAmount when liquidating a borrow\"},\"effectiveBorrowCaps(address)\":{\"notice\":\"Gets the borrow cap of a cToken in the units of the underlying asset.\"},\"effectiveSupplyCaps(address)\":{\"notice\":\"Gets the supply cap of a cToken in the units of the underlying asset.\"},\"enforceWhitelist()\":{\"notice\":\"Whether or not the supplier whitelist is enforced\"},\"getAllBorrowers()\":{\"notice\":\"Return all of the borrowers\"},\"getAllMarkets()\":{\"notice\":\"Return all of the markets\"},\"getRewardsDistributors()\":{\"notice\":\"Returns an array of all accruing and non-accruing flywheels\"},\"getWhitelist()\":{\"notice\":\"Return all of the whitelist\"},\"ionicAdminHasRights()\":{\"notice\":\"Whether or not the Ionic admin has admin rights\"},\"isComptroller()\":{\"notice\":\"Indicator that this is a Comptroller contract (for inspection)\"},\"liquidationIncentiveMantissa()\":{\"notice\":\"Multiplier representing the discount on collateral that a liquidator receives\"},\"markets(address)\":{\"notice\":\"Official mapping of cTokens -> Market metadata\"},\"nonAccruingRewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor to list for claiming, but not to notify of flywheel changes.\"},\"oracle()\":{\"notice\":\"Oracle which gives the price of any given asset\"},\"pauseGuardian()\":{\"notice\":\"The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing / transfer can only be paused globally, not by market.\"},\"pendingAdmin()\":{\"notice\":\"Pending administrator for this contract\"},\"rewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor contracts to notify of flywheel changes.\"},\"supplyCaps(address)\":{\"notice\":\"Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\"},\"whitelist(address)\":{\"notice\":\"Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\"},\"whitelistArray(uint256)\":{\"notice\":\"An array of all whitelisted accounts\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/ComptrollerFirstExtension.sol\":\"ComptrollerFirstExtension\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(\\n address src,\\n address dst,\\n uint256 amount\\n ) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256\\n );\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral\\n ) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x7cc75051a5fa860b9ee93d0ba1ac0608921f02308aeff786ce8bbd8d8a70489a\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerFirstExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerErrorReporter } from \\\"../compound/ErrorReporter.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { ComptrollerExtensionInterface, ComptrollerBase, SFSRegister } from \\\"./ComptrollerInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract ComptrollerFirstExtension is\\n DiamondExtension,\\n ComptrollerBase,\\n ComptrollerExtensionInterface,\\n ComptrollerErrorReporter\\n{\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice Emitted when supply cap for a cToken is changed\\n event NewSupplyCap(ICErc20 indexed cToken, uint256 newSupplyCap);\\n\\n /// @notice Emitted when borrow cap for a cToken is changed\\n event NewBorrowCap(ICErc20 indexed cToken, uint256 newBorrowCap);\\n\\n /// @notice Emitted when borrow cap guardian is changed\\n event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian);\\n\\n /// @notice Emitted when pause guardian is changed\\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\\n\\n /// @notice Emitted when an action is paused globally\\n event ActionPaused(string action, bool pauseState);\\n\\n /// @notice Emitted when an action is paused on a market\\n event MarketActionPaused(ICErc20 cToken, string action, bool pauseState);\\n\\n /// @notice Emitted when an admin unsupports a market\\n event MarketUnlisted(ICErc20 cToken);\\n\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\\n uint8 fnsCount = 33;\\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\\n functionSelectors[--fnsCount] = this.addNonAccruingFlywheel.selector;\\n functionSelectors[--fnsCount] = this._setMarketSupplyCaps.selector;\\n functionSelectors[--fnsCount] = this._setMarketBorrowCaps.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateralWhitelist.selector;\\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateralWhitelist.selector;\\n functionSelectors[--fnsCount] = this._supplyCapWhitelist.selector;\\n functionSelectors[--fnsCount] = this._borrowCapWhitelist.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapGuardian.selector;\\n functionSelectors[--fnsCount] = this._setPauseGuardian.selector;\\n functionSelectors[--fnsCount] = this._setMintPaused.selector;\\n functionSelectors[--fnsCount] = this._setBorrowPaused.selector;\\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\\n functionSelectors[--fnsCount] = this._unsupportMarket.selector;\\n functionSelectors[--fnsCount] = this.getAllMarkets.selector;\\n functionSelectors[--fnsCount] = this.getAllBorrowers.selector;\\n functionSelectors[--fnsCount] = this.getAllBorrowersCount.selector;\\n functionSelectors[--fnsCount] = this.getPaginatedBorrowers.selector;\\n functionSelectors[--fnsCount] = this.getWhitelist.selector;\\n functionSelectors[--fnsCount] = this.getRewardsDistributors.selector;\\n functionSelectors[--fnsCount] = this.isUserOfPool.selector;\\n functionSelectors[--fnsCount] = this.getAccruingFlywheels.selector;\\n functionSelectors[--fnsCount] = this._removeFlywheel.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateral.selector;\\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateral.selector;\\n functionSelectors[--fnsCount] = this.isBorrowCapForCollateralWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.isBlacklistBorrowingAgainstCollateralWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.isSupplyCapWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.isBorrowCapWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.getWhitelistedSuppliersSupply.selector;\\n functionSelectors[--fnsCount] = this.getWhitelistedBorrowersBorrows.selector;\\n functionSelectors[--fnsCount] = this.getAssetAsCollateralValueCap.selector;\\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return functionSelectors;\\n }\\n\\n /**\\n * @notice Returns true if the accruing flyhwheel was found and replaced\\n * @dev Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\\n * @param flywheelAddress The address of the flywheel to add to the non-accruing\\n */\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n require(flywheelAddress != address(0), \\\"!flywheel\\\");\\n\\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\\n require(flywheelAddress != nonAccruingRewardsDistributors[i], \\\"!alreadyadded\\\");\\n }\\n\\n // add it to the non-accruing\\n nonAccruingRewardsDistributors.push(flywheelAddress);\\n\\n // remove it from the accruing\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\\n if (flywheelAddress == rewardsDistributors[i]) {\\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\\n rewardsDistributors.pop();\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256) {\\n if (address(collateral) == address(cTokenModify) && !redeeming) {\\n // the collateral asset counts as 0 liquidity when borrowed\\n return 0;\\n }\\n\\n uint256 assetAsCollateralValueCap = type(uint256).max;\\n if (address(cTokenModify) != address(0)) {\\n // if the borrowed asset is blacklisted against this collateral & account is not whitelisted\\n if (\\n borrowingAgainstCollateralBlacklist[address(cTokenModify)][address(collateral)] &&\\n !borrowingAgainstCollateralBlacklistWhitelist[address(cTokenModify)][address(collateral)].contains(account)\\n ) {\\n assetAsCollateralValueCap = 0;\\n } else {\\n // for each user the value of this kind of collateral is capped regardless of the amount borrowed\\n // denominated in the borrowed asset\\n uint256 borrowCapForCollateral = borrowCapForCollateral[address(cTokenModify)][address(collateral)];\\n // check if set to any value & account is not whitelisted\\n if (\\n borrowCapForCollateral != 0 &&\\n !borrowCapForCollateralWhitelist[address(cTokenModify)][address(collateral)].contains(account)\\n ) {\\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\\n // this asset usage as collateral is capped at the native value of the borrow cap\\n assetAsCollateralValueCap = (borrowCapForCollateral * borrowedAssetPrice) / 1e18;\\n }\\n }\\n }\\n\\n uint256 supplyCap = effectiveSupplyCaps(address(collateral));\\n\\n // if there is any supply cap, don't allow donations to the market/plugin to go around it\\n if (supplyCap > 0 && !supplyCapWhitelist[address(collateral)].contains(account)) {\\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateral);\\n uint256 supplyCapValue = (supplyCap * collateralAssetPrice) / 1e18;\\n supplyCapValue = (supplyCapValue * markets[address(collateral)].collateralFactorMantissa) / 1e18;\\n if (supplyCapValue < assetAsCollateralValueCap) assetAsCollateralValueCap = supplyCapValue;\\n }\\n\\n return assetAsCollateralValueCap;\\n }\\n\\n /**\\n * @notice Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\\n * @dev Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\\n * @param cTokens The addresses of the markets (tokens) to change the supply caps for\\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\\n */\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n uint256 numMarkets = cTokens.length;\\n uint256 numSupplyCaps = newSupplyCaps.length;\\n\\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \\\"!input\\\");\\n\\n for (uint256 i = 0; i < numMarkets; i++) {\\n supplyCaps[address(cTokens[i])] = newSupplyCaps[i];\\n emit NewSupplyCap(cTokens[i], newSupplyCaps[i]);\\n }\\n }\\n\\n /**\\n * @notice Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\\n * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\\n * @param cTokens The addresses of the markets (tokens) to change the borrow caps for\\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\\n */\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n uint256 numMarkets = cTokens.length;\\n uint256 numBorrowCaps = newBorrowCaps.length;\\n\\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \\\"!input\\\");\\n\\n for (uint256 i = 0; i < numMarkets; i++) {\\n borrowCaps[address(cTokens[i])] = newBorrowCaps[i];\\n emit NewBorrowCap(cTokens[i], newBorrowCaps[i]);\\n }\\n }\\n\\n /**\\n * @notice Admin function to change the Borrow Cap Guardian\\n * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian\\n */\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external {\\n require(msg.sender == admin, \\\"!admin\\\");\\n\\n // Save current value for inclusion in log\\n address oldBorrowCapGuardian = borrowCapGuardian;\\n\\n // Store borrowCapGuardian with value newBorrowCapGuardian\\n borrowCapGuardian = newBorrowCapGuardian;\\n\\n // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)\\n emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);\\n }\\n\\n /**\\n * @notice Admin function to change the Pause Guardian\\n * @param newPauseGuardian The address of the new Pause Guardian\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _setPauseGuardian(address newPauseGuardian) public returns (uint256) {\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK);\\n }\\n\\n // Save current value for inclusion in log\\n address oldPauseGuardian = pauseGuardian;\\n\\n // Store pauseGuardian with value newPauseGuardian\\n pauseGuardian = newPauseGuardian;\\n\\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\\n emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function _setMintPaused(ICErc20 cToken, bool state) public returns (bool) {\\n require(markets[address(cToken)].isListed, \\\"!market\\\");\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n mintGuardianPaused[address(cToken)] = state;\\n emit MarketActionPaused(cToken, \\\"Mint\\\", state);\\n return state;\\n }\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) public returns (bool) {\\n require(markets[address(cToken)].isListed, \\\"!market\\\");\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n borrowGuardianPaused[address(cToken)] = state;\\n emit MarketActionPaused(cToken, \\\"Borrow\\\", state);\\n return state;\\n }\\n\\n function _setTransferPaused(bool state) public returns (bool) {\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n transferGuardianPaused = state;\\n emit ActionPaused(\\\"Transfer\\\", state);\\n return state;\\n }\\n\\n function _setSeizePaused(bool state) public returns (bool) {\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n seizeGuardianPaused = state;\\n emit ActionPaused(\\\"Seize\\\", state);\\n return state;\\n }\\n\\n /**\\n * @notice Removed a market from the markets mapping and sets it as unlisted\\n * @dev Admin function unset isListed and collateralFactorMantissa and unadd support for the market\\n * @param cToken The address of the market (token) to unlist\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256) {\\n // Check admin rights\\n if (!hasAdminRights()) return fail(Error.UNAUTHORIZED, FailureInfo.UNSUPPORT_MARKET_OWNER_CHECK);\\n\\n // Check if market is already unlisted\\n if (!markets[address(cToken)].isListed)\\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNSUPPORT_MARKET_DOES_NOT_EXIST);\\n\\n // Check if market is in use\\n if (cToken.totalSupply() > 0) return fail(Error.NONZERO_TOTAL_SUPPLY, FailureInfo.UNSUPPORT_MARKET_IN_USE);\\n\\n // Unlist market\\n delete markets[address(cToken)];\\n\\n /* Delete cToken from allMarkets */\\n // load into memory for faster iteration\\n ICErc20[] memory _allMarkets = allMarkets;\\n uint256 len = _allMarkets.length;\\n uint256 assetIndex = len;\\n for (uint256 i = 0; i < len; i++) {\\n if (_allMarkets[i] == cToken) {\\n assetIndex = i;\\n break;\\n }\\n }\\n\\n // We *must* have found the asset in the list or our redundant data structure is broken\\n assert(assetIndex < len);\\n\\n // copy last item in list to location of item to be removed, reduce length by 1\\n allMarkets[assetIndex] = allMarkets[allMarkets.length - 1];\\n allMarkets.pop();\\n\\n cTokensByUnderlying[ICErc20(address(cToken)).underlying()] = ICErc20(address(0));\\n emit MarketUnlisted(cToken);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n borrowCapForCollateral[cTokenBorrow][cTokenCollateral] = borrowCap;\\n }\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].add(account);\\n else borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\\n }\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) public view returns (bool) {\\n return borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\\n }\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n borrowingAgainstCollateralBlacklist[cTokenBorrow][cTokenCollateral] = blacklisted;\\n }\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].add(account);\\n else borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\\n }\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) public view returns (bool) {\\n return borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\\n }\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) supplyCapWhitelist[cToken].add(account);\\n else supplyCapWhitelist[cToken].remove(account);\\n }\\n\\n function isSupplyCapWhitelisted(address cToken, address account) public view returns (bool) {\\n return supplyCapWhitelist[cToken].contains(account);\\n }\\n\\n function getWhitelistedSuppliersSupply(address cToken) public view returns (uint256 supplied) {\\n address[] memory whitelistedSuppliers = supplyCapWhitelist[cToken].values();\\n for (uint256 i = 0; i < whitelistedSuppliers.length; i++) {\\n supplied += ICErc20(cToken).balanceOfUnderlying(whitelistedSuppliers[i]);\\n }\\n }\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) borrowCapWhitelist[cToken].add(account);\\n else borrowCapWhitelist[cToken].remove(account);\\n }\\n\\n function isBorrowCapWhitelisted(address cToken, address account) public view returns (bool) {\\n return borrowCapWhitelist[cToken].contains(account);\\n }\\n\\n function getWhitelistedBorrowersBorrows(address cToken) public view returns (uint256 borrowed) {\\n address[] memory whitelistedBorrowers = borrowCapWhitelist[cToken].values();\\n for (uint256 i = 0; i < whitelistedBorrowers.length; i++) {\\n borrowed += ICErc20(cToken).borrowBalanceCurrent(whitelistedBorrowers[i]);\\n }\\n }\\n\\n /**\\n * @notice Return all of the markets\\n * @dev The automatic getter may be used to access an individual market.\\n * @return The list of market addresses\\n */\\n function getAllMarkets() public view returns (ICErc20[] memory) {\\n return allMarkets;\\n }\\n\\n /**\\n * @notice Return all of the borrowers\\n * @dev The automatic getter may be used to access an individual borrower.\\n * @return The list of borrower account addresses\\n */\\n function getAllBorrowers() public view returns (address[] memory) {\\n return allBorrowers;\\n }\\n\\n function getAllBorrowersCount() public view returns (uint256) {\\n return allBorrowers.length;\\n }\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) public view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) {\\n uint256 allBorrowersCount = allBorrowers.length;\\n if (allBorrowersCount == 0) {\\n return (0, new address[](0));\\n }\\n\\n if (pageSize == 0) pageSize = 300;\\n uint256 currentPageSize = pageSize;\\n uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize;\\n\\n _totalPages = allBorrowersCount / pageSize;\\n if (sizeOfPageFromRemainder > 0) {\\n _totalPages++;\\n if (page + 1 == _totalPages) {\\n currentPageSize = sizeOfPageFromRemainder;\\n }\\n }\\n\\n if (page + 1 > _totalPages) {\\n return (_totalPages, new address[](0));\\n }\\n\\n uint256 offset = page * pageSize;\\n _pageOfBorrowers = new address[](currentPageSize);\\n for (uint256 i = 0; i < currentPageSize; i++) {\\n _pageOfBorrowers[i] = allBorrowers[i + offset];\\n }\\n }\\n\\n /**\\n * @notice Return all of the whitelist\\n * @dev The automatic getter may be used to access an individual whitelist status.\\n * @return The list of borrower account addresses\\n */\\n function getWhitelist() external view returns (address[] memory) {\\n return whitelistArray;\\n }\\n\\n /**\\n * @notice Returns an array of all accruing and non-accruing flywheels\\n */\\n function getRewardsDistributors() external view returns (address[] memory) {\\n address[] memory allFlywheels = new address[](rewardsDistributors.length + nonAccruingRewardsDistributors.length);\\n\\n uint8 i = 0;\\n while (i < rewardsDistributors.length) {\\n allFlywheels[i] = rewardsDistributors[i];\\n i++;\\n }\\n uint8 j = 0;\\n while (j < nonAccruingRewardsDistributors.length) {\\n allFlywheels[i + j] = nonAccruingRewardsDistributors[j];\\n j++;\\n }\\n\\n return allFlywheels;\\n }\\n\\n function getAccruingFlywheels() external view returns (address[] memory) {\\n return rewardsDistributors;\\n }\\n\\n /**\\n * @dev Removes a flywheel from the accruing or non-accruing array\\n * @param flywheelAddress The address of the flywheel to remove from the accruing or non-accruing array\\n * @return true if the flywheel was found and removed\\n */\\n function _removeFlywheel(address flywheelAddress) external returns (bool) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n require(flywheelAddress != address(0), \\\"!flywheel\\\");\\n\\n // remove it from the accruing\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\\n if (flywheelAddress == rewardsDistributors[i]) {\\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\\n rewardsDistributors.pop();\\n return true;\\n }\\n }\\n\\n // or remove it from the non-accruing\\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\\n if (flywheelAddress == nonAccruingRewardsDistributors[i]) {\\n nonAccruingRewardsDistributors[i] = nonAccruingRewardsDistributors[nonAccruingRewardsDistributors.length - 1];\\n nonAccruingRewardsDistributors.pop();\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n function isUserOfPool(address user) external view returns (bool) {\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n address marketAddress = address(allMarkets[i]);\\n if (markets[marketAddress].accountMembership[user]) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n function registerInSFS() external returns (uint256) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\\n\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n allMarkets[i].registerInSFS();\\n }\\n\\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\\n }\\n}\\n\",\"keccak256\":\"0x91bbdc157e7acfd7fa311d0af3c95886771f700fa03ca1ad86cb8eda56c50c6a\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowVerify(address cToken, address borrower) external;\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n \\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external;\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n \\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x266ec3c26b454cfa72bab45fa8e0bc9e3d44e8ec0cd4770304a14cc84c8f80d3\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/ErrorReporter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\ncontract ComptrollerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n COMPTROLLER_MISMATCH,\\n INSUFFICIENT_SHORTFALL,\\n INSUFFICIENT_LIQUIDITY,\\n INVALID_CLOSE_FACTOR,\\n INVALID_COLLATERAL_FACTOR,\\n INVALID_LIQUIDATION_INCENTIVE,\\n MARKET_NOT_LISTED,\\n MARKET_ALREADY_LISTED,\\n MATH_ERROR,\\n NONZERO_BORROW_BALANCE,\\n PRICE_ERROR,\\n REJECTION,\\n SNAPSHOT_ERROR,\\n TOO_MANY_ASSETS,\\n TOO_MUCH_REPAY,\\n SUPPLIER_NOT_WHITELISTED,\\n BORROW_BELOW_MIN,\\n SUPPLY_ABOVE_MAX,\\n NONZERO_TOTAL_SUPPLY\\n }\\n\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\\n EXIT_MARKET_BALANCE_OWED,\\n EXIT_MARKET_REJECTION,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\n SET_CLOSE_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_PRICE_ORACLE_OWNER_CHECK,\\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\\n SET_WHITELIST_STATUS_OWNER_CHECK,\\n SUPPORT_MARKET_EXISTS,\\n SUPPORT_MARKET_OWNER_CHECK,\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\n UNSUPPORT_MARKET_OWNER_CHECK,\\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\\n UNSUPPORT_MARKET_IN_USE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return uint256(err);\\n }\\n}\\n\\ncontract TokenErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n BAD_INPUT,\\n COMPTROLLER_REJECTION,\\n COMPTROLLER_CALCULATION_ERROR,\\n INTEREST_RATE_MODEL_ERROR,\\n INVALID_ACCOUNT_PAIR,\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\n INVALID_COLLATERAL_FACTOR,\\n MATH_ERROR,\\n MARKET_NOT_FRESH,\\n MARKET_NOT_LISTED,\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\n TOKEN_INSUFFICIENT_BALANCE,\\n TOKEN_INSUFFICIENT_CASH,\\n TOKEN_TRANSFER_IN_FAILED,\\n TOKEN_TRANSFER_OUT_FAILED,\\n UTILIZATION_ABOVE_MAX\\n }\\n\\n /*\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\n * This is because FailureInfo grows significantly faster, and\\n * the order of Error has some meaning, while the order of FailureInfo\\n * is entirely arbitrary.\\n */\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n BORROW_ACCRUE_INTEREST_FAILED,\\n BORROW_CASH_NOT_AVAILABLE,\\n BORROW_FRESHNESS_CHECK,\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n BORROW_MARKET_NOT_LISTED,\\n BORROW_COMPTROLLER_REJECTION,\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n LIQUIDATE_COMPTROLLER_REJECTION,\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n LIQUIDATE_FRESHNESS_CHECK,\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_ACCRUE_INTEREST_FAILED,\\n MINT_COMPTROLLER_REJECTION,\\n MINT_EXCHANGE_CALCULATION_FAILED,\\n MINT_EXCHANGE_RATE_READ_FAILED,\\n MINT_FRESHNESS_CHECK,\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n MINT_TRANSFER_IN_FAILED,\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\n NEW_UTILIZATION_RATE_ABOVE_MAX,\\n REDEEM_ACCRUE_INTEREST_FAILED,\\n REDEEM_COMPTROLLER_REJECTION,\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\n REDEEM_FRESHNESS_CHECK,\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\\n WITHDRAW_IONIC_FEES_VALIDATION,\\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\\n WITHDRAW_ADMIN_FEES_VALIDATION,\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\n REDUCE_RESERVES_ADMIN_CHECK,\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\n REDUCE_RESERVES_FRESH_CHECK,\\n REDUCE_RESERVES_VALIDATION,\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\n REPAY_BORROW_FRESHNESS_CHECK,\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COMPTROLLER_OWNER_CHECK,\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\\n SET_ADMIN_FEE_ADMIN_CHECK,\\n SET_ADMIN_FEE_FRESH_CHECK,\\n SET_ADMIN_FEE_BOUNDS_CHECK,\\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\\n SET_IONIC_FEE_FRESH_CHECK,\\n SET_IONIC_FEE_BOUNDS_CHECK,\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\n TRANSFER_COMPTROLLER_REJECTION,\\n TRANSFER_NOT_ALLOWED,\\n TRANSFER_NOT_ENOUGH,\\n TRANSFER_TOO_MUCH,\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\n ADD_RESERVES_FRESH_CHECK,\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\\n }\\n}\\n\",\"keccak256\":\"0xad342553cda4d7b7e40678c636a406bc2785be2117a29d9b1cb52e747726745e\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x233d26db3755cf0c7bf0bba3a695a742bbfc15fd168fb76bbe307c5ac259b5bf\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x74641db987b6d12c8c412818b8a7708332778736193b2cb127ea54e80b334186\",\"license\":\"UNLICENSED\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526002805461ffff60a01b191661010160a01b17905534801561002557600080fd5b50613f48806100356000396000f3fe608060405234801561001057600080fd5b50600436106103fb5760003560e01c80637515bafa11610215578063be945a6411610125578063d9e0ea6b116100b8578063e875544611610087578063e875544614610986578063ee5b9a2f1461098f578063f851a440146109a2578063f874eb0c146109b5578063fb6243fa146109c857600080fd5b8063d9e0ea6b1461092b578063dce154491461093e578063e6653f3d14610951578063e68065911461096557600080fd5b8063cf6bfd2d116100f4578063cf6bfd2d146108e9578063d01f63f5146108fd578063d219fca714610905578063d251fefc1461091857600080fd5b8063be945a641461089d578063c6c5b0dd146108b0578063c76ae260146108c3578063c91a424f146108d657600080fd5b80638ebf6364116101a8578063ac0b0bb711610177578063ac0b0bb714610841578063b0772d0b14610855578063b09572101461086a578063b103488214610877578063b32538011461088a57600080fd5b80638ebf6364146107cd578063940cd6f1146107e05780639b19251a1461080b578063a5fb48571461082e57600080fd5b8063819605a8116101e4578063819605a81461074d57806387f763031461076057806389f8132e146107745780638e8f294b1461078957600080fd5b80637515bafa1461070c578063783f10961461071f5780637dc0d1d0146107325780637f15e2161461074557600080fd5b80633605b51b1161031057806351a485e4116102a3578063607ef6c111610272578063607ef6c11461068d578063692fd2a9146106a05780636bd02b8a146106b35780636d154ea5146106c6578063731f0c2b146106e957600080fd5b806351a485e41461064157806351c8491d1461065457806352d84d1e146106675780635f5af1aa1461067a57600080fd5b80633c94786f116102df5780633c94786f146105fc5780634a584432146106105780634a76e727146106305780634ada90af1461063857600080fd5b80633605b51b146105b9578063391957d7146105c15780633a72cb5e146105d65780633bcf7ec1146105e957600080fd5b80631c819e4311610393578063267822471161036257806326782247146105425780632ccf47a4146105555780632d70db781461056857806331ff47fa1461057b57806332abcdbe146105a457600080fd5b80631c819e43146104c357806321af4569146104f15780632273f40e1461051c57806324a3d6221461052f57600080fd5b8063109908ce116103cf578063109908ce1461047257806315c3b9b01461048557806316dc15fe1461048d57806318c882a5146104b057600080fd5b80627e3dd21461040057806302c3bcbb1461041d578063088e0fce1461044b5780630a755ec21461045e575b600080fd5b610408600181565b60405190151581526020015b60405180910390f35b61043d61042b3660046136af565b60186020526000908152604090205481565b604051908152602001610414565b6104086104593660046136cc565b6109db565b60025461040890600160a81b900460ff1681565b6104086104803660046136af565b610a14565b600b5461043d565b61040861049b3660046136af565b600d6020526000908152604090205460ff1681565b6104086104be36600461372c565b610c5e565b6104086104d1366004613761565b601d60209081526000928352604080842090915290825290205460ff1681565b601654610504906001600160a01b031681565b6040516001600160a01b039091168152602001610414565b61040861052a366004613761565b610da4565b601354610504906001600160a01b031681565b600254610504906001600160a01b031681565b61043d6105633660046136af565b610dcc565b61040861057636600461379a565b61103e565b6105046105893660046136af565b600e602052600090815260409020546001600160a01b031681565b6105ac611121565b60405161041491906137fa565b6105ac611183565b6105d46105cf3660046136af565b6112eb565b005b61043d6105e43660046136af565b611376565b6104086105f736600461372c565b611457565b60135461040890600160a01b900460ff1681565b61043d61061e3660046136af565b60176020526000908152604090205481565b6105ac61158e565b61043d60055481565b6105d461064f366004613852565b6115ee565b6105d46106623660046138be565b61176d565b610504610675366004613905565b6117df565b61043d6106883660046136af565b611809565b6105d461069b366004613852565b611889565b6104086106ae3660046136af565b6119ff565b6105046106c1366004613905565b611b86565b6104086106d43660046136af565b60156020526000908152604090205460ff1681565b6104086106f73660046136af565b60146020526000908152604090205460ff1681565b61050461071a366004613905565b611b96565b61043d61072d36600461391e565b611ba6565b600354610504906001600160a01b031681565b61043d611e76565b61043d61075b3660046136af565b611fe0565b60135461040890600160b01b900460ff1681565b61077c61230b565b6040516104149190613978565b6107b66107973660046136af565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610414565b6104086107db36600461379a565b612be7565b61043d6107ee366004613761565b601c60209081526000928352604080842090915290825290205481565b6104086108193660046136af565b60106020526000908152604090205460ff1681565b6105d461083c3660046139c6565b612cc1565b60135461040890600160b81b900460ff1681565b61085d612d11565b6040516104149190613a07565b600f546104089060ff1681565b61043d6108853660046136af565b612d71565b610408610898366004613761565b612e10565b6105d46108ab3660046138be565b612e32565b6105046108be366004613905565b612ea0565b6105d46108d1366004613a48565b612eb0565b600054610504906001600160a01b031681565b60025461040890600160a01b900460ff1681565b6105ac612f45565b6105d4610913366004613a48565b612fa5565b610504610926366004613905565b61302d565b6104086109393660046136af565b61303d565b61050461094c366004613aa2565b6130b4565b60135461040890600160a81b900460ff1681565b610978610973366004613ace565b6130ec565b604051610414929190613af0565b61043d60045481565b6105d461099d3660046138be565b61326b565b600154610504906001600160a01b031681565b6104086109c33660046136cc565b6132c9565b61043d6109d63660046136af565b6132fa565b6001600160a01b038084166000908152601e602090815260408083209386168352929052908120610a0c90836133d3565b949350505050565b6000610a1e6133f5565b610a435760405162461bcd60e51b8152600401610a3a90613b09565b60405180910390fd5b6001600160a01b038216610a855760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601954811015610b825760198181548110610aa557610aa5613b29565b6000918252602090912001546001600160a01b0390811690841603610b7a5760198054610ad490600190613b55565b81548110610ae457610ae4613b29565b600091825260209091200154601980546001600160a01b039092169183908110610b1057610b10613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506019805480610b4f57610b4f613b68565b600082815260209020810160001990810180546001600160a01b031916905501905550600192915050565b600101610a88565b5060005b601b54811015610c5557601b8181548110610ba357610ba3613b29565b6000918252602090912001546001600160a01b0390811690841603610c4d57601b8054610bd290600190613b55565b81548110610be257610be2613b29565b600091825260209091200154601b80546001600160a01b039092169183908110610c0e57610c0e613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550601b805480610b4f57610b4f613b68565b600101610b86565b50600092915050565b6001600160a01b03821660009081526008602052604081205460ff16610cb05760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b0316331480610ccc5750610ccc6133f5565b610ce85760405162461bcd60e51b8152600401610a3a90613b7e565b610cf06133f5565b80610cfd57506001821515145b610d195760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260156020908152604091829020805460ff19168615159081179091558251938452606091840182905260069184019190915265426f72726f7760d01b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a0015b60405180910390a150805b92915050565b6001600160a01b03821660009081526020805260408120610dc590836133d3565b9392505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561101c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e729190613ba1565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa158015610ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eef9190613bec565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b03861691610f489190613c71565b600060405180830381855afa9150503d8060008114610f83576040519150601f19603f3d011682016040523d82523d6000602084013e610f88565b606091505b5091509150818015610f9b575080516020145b15610fba5780806020019051810190610fb49190613ca0565b60ff1692505b6040850151610fcc9060000b84613cc3565b925060008312610ff257610fe183600a613dcf565b610feb9087613ddb565b9550611013565b610ffb83613df2565b61100690600a613dcf565b6110109087613e24565b95505b50505050611038565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6013546000906001600160a01b031633148061105d575061105d6133f5565b6110795760405162461bcd60e51b8152600401610a3a90613b7e565b6110816133f5565b8061108e57506001821515145b6110aa5760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b81b0260ff60b81b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600590820152645365697a6560d81b6060820152901515602082015260800190565b60405180910390a15090565b6060600b80548060200260200160405190810160405280929190818152602001828054801561117957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161115b575b5050505050905090565b601b546019546060916000916111999190613e38565b67ffffffffffffffff8111156111b1576111b1613bbe565b6040519080825280602002602001820160405280156111da578160200160208202803683370190505b50905060005b60195460ff821610156112605760198160ff168154811061120357611203613b29565b9060005260206000200160009054906101000a90046001600160a01b0316828260ff168151811061123657611236613b29565b6001600160a01b03909216602092830291909101909101528061125881613e4b565b9150506111e0565b60005b601b5460ff821610156112e357601b8160ff168154811061128657611286613b29565b6000918252602090912001546001600160a01b0316836112a68385613e6a565b60ff16815181106112b9576112b9613b29565b6001600160a01b0390921660209283029190910190910152806112db81613e4b565b915050611263565b509092915050565b6001546001600160a01b031633146113155760405162461bcd60e51b8152600401610a3a90613b09565b601680546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527feda98690e518e9a05f8ec6837663e188211b2da8f4906648b323f2c1d4434e29910160405180910390a15050565b6001600160a01b0381166000908152602160205260408120819061139990613449565b905060005b815181101561145057836001600160a01b03166317bfdfbc8383815181106113c8576113c8613b29565b60200260200101516040518263ffffffff1660e01b81526004016113fb91906001600160a01b0391909116815260200190565b602060405180830381865afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190613e83565b6114469084613e38565b925060010161139e565b5050919050565b6001600160a01b03821660009081526008602052604081205460ff166114a95760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b03163314806114c557506114c56133f5565b6114e15760405162461bcd60e51b8152600401610a3a90613b7e565b6114e96133f5565b806114f657506001821515145b6115125760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260146020908152604091829020805460ff19168615159081179091558251938452606091840182905260049184019190915263135a5b9d60e21b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a001610d93565b60606019805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b6001546001600160a01b031633148061161157506016546001600160a01b031633145b61162d5760405162461bcd60e51b8152600401610a3a90613b09565b8281811580159061163d57508082145b6116725760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061168f5761168f613b29565b90506020020135601860008989858181106116ac576116ac613b29565b90506020020160208101906116c191906136af565b6001600160a01b031681526020810191909152604001600020558686828181106116ed576116ed613b29565b905060200201602081019061170291906136af565b6001600160a01b03167f9e0ad9cee10bdf36b7fbd38910c0bdff0f275ace679b45b922381c2723d676f886868481811061173e5761173e613b29565b9050602002013560405161175491815260200190565b60405180910390a2600101611675565b50505050505050565b6117756133f5565b6117915760405162461bcd60e51b8152600401610a3a90613b09565b80156117be576001600160a01b038316600090815260208052604090206117b89083613456565b50505050565b6001600160a01b038316600090815260208052604090206117b8908361346b565b600981815481106117ef57600080fd5b6000918252602090912001546001600160a01b0316905081565b60006118136133f5565b61182357610d9e60016017613480565b601380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f0613b6ee6a04f0d09f390e4d9318894b9f6ac7fd83897cd8d18896ba579c401e910160405180910390a160009392505050565b6001546001600160a01b03163314806118ac57506016546001600160a01b031633145b6118c85760405162461bcd60e51b8152600401610a3a90613b09565b828181158015906118d857508082145b61190d5760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061192a5761192a613b29565b905060200201356017600089898581811061194757611947613b29565b905060200201602081019061195c91906136af565b6001600160a01b0316815260208101919091526040016000205586868281811061198857611988613b29565b905060200201602081019061199d91906136af565b6001600160a01b03167f6f1951b2aad10f3fc81b86d91105b413a5b3f847a34bbc5ce1904201b14438f68686848181106119d9576119d9613b29565b905060200201356040516119ef91815260200190565b60405180910390a2600101611910565b6000611a096133f5565b611a255760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038216611a675760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601b54811015611ae657601b8181548110611a8757611a87613b29565b6000918252602090912001546001600160a01b0390811690841603611ade5760405162461bcd60e51b815260206004820152600d60248201526c08585b1c9958591e5859191959609a1b6044820152606401610a3a565b600101611a6a565b50601b805460018101825560009182527f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc10180546001600160a01b0319166001600160a01b0385161790555b601954811015610c555760198181548110611b4f57611b4f613b29565b6000918252602090912001546001600160a01b0390811690841603611b7e5760198054610ad490600190613b55565b600101611b32565b601b81815481106117ef57600080fd5b600b81815481106117ef57600080fd5b6000836001600160a01b0316856001600160a01b0316148015611bc7575082155b15611bd457506000610a0c565b6000196001600160a01b03851615611d4e576001600160a01b038086166000908152601d60209081526040808320938a168352929052205460ff168015611c4757506001600160a01b038086166000908152601f60209081526040808320938a16835292905220611c4590846133d3565b155b15611c5457506000611d4e565b6001600160a01b038086166000908152601c60209081526040808320938a16835292905220548015801590611cb557506001600160a01b038087166000908152601e60209081526040808320938b16835292905220611cb390856133d3565b155b15611d4c5760035460405163fc57d4df60e01b81526001600160a01b038881166004830152600092169063fc57d4df90602401602060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d299190613e83565b9050670de0b6b3a7640000611d3e8284613ddb565b611d489190613e24565b9250505b505b6000611d5987610dcc565b9050600081118015611d8957506001600160a01b03871660009081526020805260409020611d8790856133d3565b155b15611e6c5760035460405163fc57d4df60e01b81526001600160a01b038981166004830152600092169063fc57d4df90602401602060405180830381865afa158015611dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dfd9190613e83565b90506000670de0b6b3a7640000611e148385613ddb565b611e1e9190613e24565b6001600160a01b038a16600090815260086020526040902060010154909150670de0b6b3a764000090611e519083613ddb565b611e5b9190613e24565b905083811015611e69578093505b50505b5095945050505050565b6000611e806133f5565b611e9c5760405162461bcd60e51b8152600401610a3a90613b09565b738680ceabcb9b56913c519c069add6bc3494b702060005b600954811015611f5b5760098181548110611ed157611ed1613b29565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b0316637f15e2166040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f529190613e83565b50600101611eb4565b50604051632210724360e11b8152738fba84867ba458e7c6e2c024d2de3d0b5c3ea1c260048201526001600160a01b03821690634420e486906024016020604051808303816000875af1158015611fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fda9190613e83565b91505090565b6000611fea6133f5565b611ffa57610d9e60016018613480565b6001600160a01b03821660009081526008602052604090205460ff1661202657610d9e60086019613480565b6000826001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208a9190613e83565b111561209c57610d9e6014601a613480565b6001600160a01b0382166000908152600860209081526040808320805460ff1916815560010183905560098054825181850281018501909352808352919290919083018282801561211657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120f8575b5050835193945083925060009150505b8281101561217057856001600160a01b031684828151811061214a5761214a613b29565b60200260200101516001600160a01b03160361216857809150612170565b600101612126565b5081811061218057612180613eb2565b6009805461219090600190613b55565b815481106121a0576121a0613b29565b600091825260209091200154600980546001600160a01b0390921691839081106121cc576121cc613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061220b5761220b613b68565b6001900381819060005260206000200160006101000a8154906001600160a01b03021916905590556000600e6000876001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190613ba1565b6001600160a01b039081168252602080830193909352604091820160002080546001600160a01b031916948216949094179093555191871682527f302feb03efd5741df80efe7f97f5d93d74d46a542a3d312d0faae64fa1f3e0e9910160405180910390a1600095945050505050565b60408051602180825261044082019092526060919060009082602082016104208036833701905050905063692fd2a960e01b8161234784613ec8565b93508360ff168151811061235d5761235d613b29565b6001600160e01b031990921660209283029190910190910152631469217960e21b8161238884613ec8565b93508360ff168151811061239e5761239e613b29565b6001600160e01b03199092166020928302919091019091015263607ef6c160e01b816123c984613ec8565b93508360ff16815181106123df576123df613b29565b6001600160e01b03199092166020928302919091019091015263d219fca760e01b8161240a84613ec8565b93508360ff168151811061242057612420613b29565b6001600160e01b03199092166020928302919091019091015263063b571360e51b8161244b84613ec8565b93508360ff168151811061246157612461613b29565b6001600160e01b0319909216602092830291909101909101526351c8491d60e01b8161248c84613ec8565b93508360ff16815181106124a2576124a2613b29565b6001600160e01b031990921660209283029190910190910152632fa5169960e21b816124cd84613ec8565b93508360ff16815181106124e3576124e3613b29565b6001600160e01b03199092166020928302919091019091015263391957d760e01b8161250e84613ec8565b93508360ff168151811061252457612524613b29565b6001600160e01b031990921660209283029190910190910152632fad78d560e11b8161254f84613ec8565b93508360ff168151811061256557612565613b29565b6001600160e01b031990921660209283029190910190910152633bcf7ec160e01b8161259084613ec8565b93508360ff16815181106125a6576125a6613b29565b6001600160e01b0319909216602092830291909101909101526318c882a560e01b816125d184613ec8565b93508360ff16815181106125e7576125e7613b29565b6001600160e01b0319909216602092830291909101909101526323afd8d960e21b8161261284613ec8565b93508360ff168151811061262857612628613b29565b6001600160e01b0319909216602092830291909101909101526305ae1b6f60e31b8161265384613ec8565b93508360ff168151811061266957612669613b29565b6001600160e01b031990921660209283029190910190910152631032c0b560e31b8161269484613ec8565b93508360ff16815181106126aa576126aa613b29565b6001600160e01b03199092166020928302919091019091015263b0772d0b60e01b816126d584613ec8565b93508360ff16815181106126eb576126eb613b29565b6001600160e01b031990921660209283029190910190910152631955e6df60e11b8161271684613ec8565b93508360ff168151811061272c5761272c613b29565b6001600160e01b03199092166020928302919091019091015263015c3b9b60e41b8161275784613ec8565b93508360ff168151811061276d5761276d613b29565b6001600160e01b03199092166020928302919091019091015263e680659160e01b8161279884613ec8565b93508360ff16815181106127ae576127ae613b29565b6001600160e01b03199092166020928302919091019091015263d01f63f560e01b816127d984613ec8565b93508360ff16815181106127ef576127ef613b29565b6001600160e01b031990921660209283029190910190910152633605b51b60e01b8161281a84613ec8565b93508360ff168151811061283057612830613b29565b6001600160e01b03199092166020928302919091019091015263d9e0ea6b60e01b8161285b84613ec8565b93508360ff168151811061287157612871613b29565b6001600160e01b031990921660209283029190910190910152634a76e72760e01b8161289c84613ec8565b93508360ff16815181106128b2576128b2613b29565b6001600160e01b03199092166020928302919091019091015263084c846760e11b816128dd84613ec8565b93508360ff16815181106128f3576128f3613b29565b6001600160e01b03199092166020928302919091019091015263a5fb485760e01b8161291e84613ec8565b93508360ff168151811061293457612934613b29565b6001600160e01b03199092166020928302919091019091015263ee5b9a2f60e01b8161295f84613ec8565b93508360ff168151811061297557612975613b29565b6001600160e01b03199092166020928302919091019091015263044707e760e11b816129a084613ec8565b93508360ff16815181106129b6576129b6613b29565b6001600160e01b031990921660209283029190910190910152633e1d3ac360e21b816129e184613ec8565b93508360ff16815181106129f7576129f7613b29565b6001600160e01b031990921660209283029190910190910152631139fa0760e11b81612a2284613ec8565b93508360ff1681518110612a3857612a38613b29565b6001600160e01b03199092166020928302919091019091015263b325380160e01b81612a6384613ec8565b93508360ff1681518110612a7957612a79613b29565b6001600160e01b031990921660209283029190910190910152637db121fd60e11b81612aa484613ec8565b93508360ff1681518110612aba57612aba613b29565b6001600160e01b031990921660209283029190910190910152631d3965af60e11b81612ae584613ec8565b93508360ff1681518110612afb57612afb613b29565b6001600160e01b031990921660209283029190910190910152633c1f884b60e11b81612b2684613ec8565b93508360ff1681518110612b3c57612b3c613b29565b6001600160e01b031990921660209283029190910190910152633f8af10b60e11b81612b6784613ec8565b93508360ff1681518110612b7d57612b7d613b29565b6001600160e01b03199092166020928302919091019091015260ff821615610d9e5760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610a3a565b6013546000906001600160a01b0316331480612c065750612c066133f5565b612c225760405162461bcd60e51b8152600401610a3a90613b7e565b612c2a6133f5565b80612c3757506001821515145b612c535760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b01b0260ff60b01b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600890820152672a3930b739b332b960c11b6060820152901515602082015260800190565b612cc96133f5565b612ce55760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601c602090815260408083209490951682529290925291902055565b60606009805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215612df3576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b6001600160a01b0382166000908152602160205260408120610dc590836133d3565b612e3a6133f5565b612e565760405162461bcd60e51b8152600401610a3a90613b09565b8015612e7e576001600160a01b03831660009081526021602052604090206117b89083613456565b6001600160a01b03831660009081526021602052604090206117b8908361346b565b601981815481106117ef57600080fd5b612eb86133f5565b612ed45760405162461bcd60e51b8152600401610a3a90613b09565b8015612f0f576001600160a01b038085166000908152601f60209081526040808320938716835292905220612f099083613456565b506117b8565b6001600160a01b038085166000908152601f60209081526040808320938716835292905220612f3e908361346b565b5050505050565b60606011805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b612fad6133f5565b612fc95760405162461bcd60e51b8152600401610a3a90613b09565b8015612ffe576001600160a01b038085166000908152601e60209081526040808320938716835292905220612f099083613456565b6001600160a01b038085166000908152601e60209081526040808320938716835292905220612f3e908361346b565b601181815481106117ef57600080fd5b6000805b600954811015610c555760006009828154811061306057613060613b29565b60009182526020808320909101546001600160a01b03908116808452600883526040808520928916855260029092019092529091205490915060ff16156130ab575060019392505050565b50600101613041565b600760205281600052604060002081815481106130d057600080fd5b6000918252602090912001546001600160a01b03169150829050565b600b5460009060609080830361311657604080516000808252602082019092529250925050613264565b836000036131245761012c93505b8360006131318284613ee5565b905061313d8684613e24565b94508015613168578461314f81613ef9565b955085905061315f886001613e38565b03613168578091505b84613174886001613e38565b111561319457505060408051600081526020810190915291506132649050565b60006131a08789613ddb565b90508267ffffffffffffffff8111156131bb576131bb613bbe565b6040519080825280602002602001820160405280156131e4578160200160208202803683370190505b50945060005b8381101561325e57600b6131fe8383613e38565b8154811061320e5761320e613b29565b9060005260206000200160009054906101000a90046001600160a01b031686828151811061323e5761323e613b29565b6001600160a01b03909216602092830291909101909101526001016131ea565b50505050505b9250929050565b6132736133f5565b61328f5760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601d6020908152604080832094909516825292909252919020805460ff1916911515919091179055565b6001600160a01b038084166000908152601f602090815260408083209386168352929052908120610a0c90836133d3565b6001600160a01b03811660009081526020805260408120819061331c90613449565b905060005b815181101561145057836001600160a01b0316633af9e66983838151811061334b5761334b613b29565b60200260200101516040518263ffffffff1660e01b815260040161337e91906001600160a01b0391909116815260200190565b602060405180830381865afa15801561339b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133bf9190613e83565b6133c99084613e38565b9250600101613321565b6001600160a01b03811660009081526001830160205260408120541515610dc5565b6001546000906001600160a01b03163314801561341b5750600254600160a81b900460ff165b8061344457506000546001600160a01b0316331480156134445750600254600160a01b900460ff165b905090565b60606000610dc5836134f9565b6000610dc5836001600160a01b038416613555565b6000610dc5836001600160a01b0384166135a4565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156134b5576134b5613e9c565b83601a8111156134c7576134c7613e9c565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610dc557610dc5613e9c565b60608160000180548060200260200160405190810160405280929190818152602001828054801561354957602002820191906000526020600020905b815481526020019060010190808311613535575b50505050509050919050565b600081815260018301602052604081205461359c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d9e565b506000610d9e565b6000818152600183016020526040812054801561368d5760006135c8600183613b55565b85549091506000906135dc90600190613b55565b90508181146136415760008660000182815481106135fc576135fc613b29565b906000526020600020015490508087600001848154811061361f5761361f613b29565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061365257613652613b68565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d9e565b6000915050610d9e565b6001600160a01b03811681146136ac57600080fd5b50565b6000602082840312156136c157600080fd5b8135610dc581613697565b6000806000606084860312156136e157600080fd5b83356136ec81613697565b925060208401356136fc81613697565b9150604084013561370c81613697565b809150509250925092565b8035801515811461372757600080fd5b919050565b6000806040838503121561373f57600080fd5b823561374a81613697565b915061375860208401613717565b90509250929050565b6000806040838503121561377457600080fd5b823561377f81613697565b9150602083013561378f81613697565b809150509250929050565b6000602082840312156137ac57600080fd5b610dc582613717565b60008151808452602080850194506020840160005b838110156137ef5781516001600160a01b0316875295820195908201906001016137ca565b509495945050505050565b602081526000610dc560208301846137b5565b60008083601f84011261381f57600080fd5b50813567ffffffffffffffff81111561383757600080fd5b6020830191508360208260051b850101111561326457600080fd5b6000806000806040858703121561386857600080fd5b843567ffffffffffffffff8082111561388057600080fd5b61388c8883890161380d565b909650945060208701359150808211156138a557600080fd5b506138b28782880161380d565b95989497509550505050565b6000806000606084860312156138d357600080fd5b83356138de81613697565b925060208401356138ee81613697565b91506138fc60408501613717565b90509250925092565b60006020828403121561391757600080fd5b5035919050565b6000806000806080858703121561393457600080fd5b843561393f81613697565b9350602085013561394f81613697565b925061395d60408601613717565b9150606085013561396d81613697565b939692955090935050565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160e01b03191683529284019291840191600101613994565b50909695505050505050565b6000806000606084860312156139db57600080fd5b83356139e681613697565b925060208401356139f681613697565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160a01b031683529284019291840191600101613a23565b60008060008060808587031215613a5e57600080fd5b8435613a6981613697565b93506020850135613a7981613697565b92506040850135613a8981613697565b9150613a9760608601613717565b905092959194509250565b60008060408385031215613ab557600080fd5b8235613ac081613697565b946020939093013593505050565b60008060408385031215613ae157600080fd5b50508035926020909101359150565b828152604060208201526000610a0c60408301846137b5565b60208082526006908201526510b0b236b4b760d11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610d9e57610d9e613b3f565b634e487b7160e01b600052603160045260246000fd5b60208082526009908201526810b3bab0b93234b0b760b91b604082015260600190565b600060208284031215613bb357600080fd5b8151610dc581613697565b634e487b7160e01b600052604160045260246000fd5b805167ffffffffffffffff8116811461372757600080fd5b600060608284031215613bfe57600080fd5b6040516060810181811067ffffffffffffffff82111715613c2f57634e487b7160e01b600052604160045260246000fd5b604052613c3b83613bd4565b8152613c4960208401613bd4565b6020820152604083015163ffffffff81168114613c6557600080fd5b60408201529392505050565b6000825160005b81811015613c925760208186018101518583015201613c78565b506000920191825250919050565b600060208284031215613cb257600080fd5b815160ff81168114610dc557600080fd5b8082018281126000831280158216821582161715613ce357613ce3613b3f565b505092915050565b600181815b80851115613d26578160001904821115613d0c57613d0c613b3f565b80851615613d1957918102915b93841c9390800290613cf0565b509250929050565b600082613d3d57506001610d9e565b81613d4a57506000610d9e565b8160018114613d605760028114613d6a57613d86565b6001915050610d9e565b60ff841115613d7b57613d7b613b3f565b50506001821b610d9e565b5060208310610133831016604e8410600b8410161715613da9575081810a610d9e565b613db38383613ceb565b8060001904821115613dc757613dc7613b3f565b029392505050565b6000610dc58383613d2e565b8082028115828204841417610d9e57610d9e613b3f565b6000600160ff1b8201613e0757613e07613b3f565b5060000390565b634e487b7160e01b600052601260045260246000fd5b600082613e3357613e33613e0e565b500490565b80820180821115610d9e57610d9e613b3f565b600060ff821660ff8103613e6157613e61613b3f565b60010192915050565b60ff8181168382160190811115610d9e57610d9e613b3f565b600060208284031215613e9557600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b600060ff821680613edb57613edb613b3f565b6000190192915050565b600082613ef457613ef4613e0e565b500690565b600060018201613f0b57613f0b613b3f565b506001019056fea2646970667358221220b2f6c6f72545793b55ffe094a2a52377eedce77266c9e0bade1809fee8a91e5764736f6c63430008160033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106103fb5760003560e01c80637515bafa11610215578063be945a6411610125578063d9e0ea6b116100b8578063e875544611610087578063e875544614610986578063ee5b9a2f1461098f578063f851a440146109a2578063f874eb0c146109b5578063fb6243fa146109c857600080fd5b8063d9e0ea6b1461092b578063dce154491461093e578063e6653f3d14610951578063e68065911461096557600080fd5b8063cf6bfd2d116100f4578063cf6bfd2d146108e9578063d01f63f5146108fd578063d219fca714610905578063d251fefc1461091857600080fd5b8063be945a641461089d578063c6c5b0dd146108b0578063c76ae260146108c3578063c91a424f146108d657600080fd5b80638ebf6364116101a8578063ac0b0bb711610177578063ac0b0bb714610841578063b0772d0b14610855578063b09572101461086a578063b103488214610877578063b32538011461088a57600080fd5b80638ebf6364146107cd578063940cd6f1146107e05780639b19251a1461080b578063a5fb48571461082e57600080fd5b8063819605a8116101e4578063819605a81461074d57806387f763031461076057806389f8132e146107745780638e8f294b1461078957600080fd5b80637515bafa1461070c578063783f10961461071f5780637dc0d1d0146107325780637f15e2161461074557600080fd5b80633605b51b1161031057806351a485e4116102a3578063607ef6c111610272578063607ef6c11461068d578063692fd2a9146106a05780636bd02b8a146106b35780636d154ea5146106c6578063731f0c2b146106e957600080fd5b806351a485e41461064157806351c8491d1461065457806352d84d1e146106675780635f5af1aa1461067a57600080fd5b80633c94786f116102df5780633c94786f146105fc5780634a584432146106105780634a76e727146106305780634ada90af1461063857600080fd5b80633605b51b146105b9578063391957d7146105c15780633a72cb5e146105d65780633bcf7ec1146105e957600080fd5b80631c819e4311610393578063267822471161036257806326782247146105425780632ccf47a4146105555780632d70db781461056857806331ff47fa1461057b57806332abcdbe146105a457600080fd5b80631c819e43146104c357806321af4569146104f15780632273f40e1461051c57806324a3d6221461052f57600080fd5b8063109908ce116103cf578063109908ce1461047257806315c3b9b01461048557806316dc15fe1461048d57806318c882a5146104b057600080fd5b80627e3dd21461040057806302c3bcbb1461041d578063088e0fce1461044b5780630a755ec21461045e575b600080fd5b610408600181565b60405190151581526020015b60405180910390f35b61043d61042b3660046136af565b60186020526000908152604090205481565b604051908152602001610414565b6104086104593660046136cc565b6109db565b60025461040890600160a81b900460ff1681565b6104086104803660046136af565b610a14565b600b5461043d565b61040861049b3660046136af565b600d6020526000908152604090205460ff1681565b6104086104be36600461372c565b610c5e565b6104086104d1366004613761565b601d60209081526000928352604080842090915290825290205460ff1681565b601654610504906001600160a01b031681565b6040516001600160a01b039091168152602001610414565b61040861052a366004613761565b610da4565b601354610504906001600160a01b031681565b600254610504906001600160a01b031681565b61043d6105633660046136af565b610dcc565b61040861057636600461379a565b61103e565b6105046105893660046136af565b600e602052600090815260409020546001600160a01b031681565b6105ac611121565b60405161041491906137fa565b6105ac611183565b6105d46105cf3660046136af565b6112eb565b005b61043d6105e43660046136af565b611376565b6104086105f736600461372c565b611457565b60135461040890600160a01b900460ff1681565b61043d61061e3660046136af565b60176020526000908152604090205481565b6105ac61158e565b61043d60055481565b6105d461064f366004613852565b6115ee565b6105d46106623660046138be565b61176d565b610504610675366004613905565b6117df565b61043d6106883660046136af565b611809565b6105d461069b366004613852565b611889565b6104086106ae3660046136af565b6119ff565b6105046106c1366004613905565b611b86565b6104086106d43660046136af565b60156020526000908152604090205460ff1681565b6104086106f73660046136af565b60146020526000908152604090205460ff1681565b61050461071a366004613905565b611b96565b61043d61072d36600461391e565b611ba6565b600354610504906001600160a01b031681565b61043d611e76565b61043d61075b3660046136af565b611fe0565b60135461040890600160b01b900460ff1681565b61077c61230b565b6040516104149190613978565b6107b66107973660046136af565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610414565b6104086107db36600461379a565b612be7565b61043d6107ee366004613761565b601c60209081526000928352604080842090915290825290205481565b6104086108193660046136af565b60106020526000908152604090205460ff1681565b6105d461083c3660046139c6565b612cc1565b60135461040890600160b81b900460ff1681565b61085d612d11565b6040516104149190613a07565b600f546104089060ff1681565b61043d6108853660046136af565b612d71565b610408610898366004613761565b612e10565b6105d46108ab3660046138be565b612e32565b6105046108be366004613905565b612ea0565b6105d46108d1366004613a48565b612eb0565b600054610504906001600160a01b031681565b60025461040890600160a01b900460ff1681565b6105ac612f45565b6105d4610913366004613a48565b612fa5565b610504610926366004613905565b61302d565b6104086109393660046136af565b61303d565b61050461094c366004613aa2565b6130b4565b60135461040890600160a81b900460ff1681565b610978610973366004613ace565b6130ec565b604051610414929190613af0565b61043d60045481565b6105d461099d3660046138be565b61326b565b600154610504906001600160a01b031681565b6104086109c33660046136cc565b6132c9565b61043d6109d63660046136af565b6132fa565b6001600160a01b038084166000908152601e602090815260408083209386168352929052908120610a0c90836133d3565b949350505050565b6000610a1e6133f5565b610a435760405162461bcd60e51b8152600401610a3a90613b09565b60405180910390fd5b6001600160a01b038216610a855760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601954811015610b825760198181548110610aa557610aa5613b29565b6000918252602090912001546001600160a01b0390811690841603610b7a5760198054610ad490600190613b55565b81548110610ae457610ae4613b29565b600091825260209091200154601980546001600160a01b039092169183908110610b1057610b10613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506019805480610b4f57610b4f613b68565b600082815260209020810160001990810180546001600160a01b031916905501905550600192915050565b600101610a88565b5060005b601b54811015610c5557601b8181548110610ba357610ba3613b29565b6000918252602090912001546001600160a01b0390811690841603610c4d57601b8054610bd290600190613b55565b81548110610be257610be2613b29565b600091825260209091200154601b80546001600160a01b039092169183908110610c0e57610c0e613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550601b805480610b4f57610b4f613b68565b600101610b86565b50600092915050565b6001600160a01b03821660009081526008602052604081205460ff16610cb05760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b0316331480610ccc5750610ccc6133f5565b610ce85760405162461bcd60e51b8152600401610a3a90613b7e565b610cf06133f5565b80610cfd57506001821515145b610d195760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260156020908152604091829020805460ff19168615159081179091558251938452606091840182905260069184019190915265426f72726f7760d01b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a0015b60405180910390a150805b92915050565b6001600160a01b03821660009081526020805260408120610dc590836133d3565b9392505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561101c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e729190613ba1565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa158015610ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eef9190613bec565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b03861691610f489190613c71565b600060405180830381855afa9150503d8060008114610f83576040519150601f19603f3d011682016040523d82523d6000602084013e610f88565b606091505b5091509150818015610f9b575080516020145b15610fba5780806020019051810190610fb49190613ca0565b60ff1692505b6040850151610fcc9060000b84613cc3565b925060008312610ff257610fe183600a613dcf565b610feb9087613ddb565b9550611013565b610ffb83613df2565b61100690600a613dcf565b6110109087613e24565b95505b50505050611038565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6013546000906001600160a01b031633148061105d575061105d6133f5565b6110795760405162461bcd60e51b8152600401610a3a90613b7e565b6110816133f5565b8061108e57506001821515145b6110aa5760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b81b0260ff60b81b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600590820152645365697a6560d81b6060820152901515602082015260800190565b60405180910390a15090565b6060600b80548060200260200160405190810160405280929190818152602001828054801561117957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161115b575b5050505050905090565b601b546019546060916000916111999190613e38565b67ffffffffffffffff8111156111b1576111b1613bbe565b6040519080825280602002602001820160405280156111da578160200160208202803683370190505b50905060005b60195460ff821610156112605760198160ff168154811061120357611203613b29565b9060005260206000200160009054906101000a90046001600160a01b0316828260ff168151811061123657611236613b29565b6001600160a01b03909216602092830291909101909101528061125881613e4b565b9150506111e0565b60005b601b5460ff821610156112e357601b8160ff168154811061128657611286613b29565b6000918252602090912001546001600160a01b0316836112a68385613e6a565b60ff16815181106112b9576112b9613b29565b6001600160a01b0390921660209283029190910190910152806112db81613e4b565b915050611263565b509092915050565b6001546001600160a01b031633146113155760405162461bcd60e51b8152600401610a3a90613b09565b601680546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527feda98690e518e9a05f8ec6837663e188211b2da8f4906648b323f2c1d4434e29910160405180910390a15050565b6001600160a01b0381166000908152602160205260408120819061139990613449565b905060005b815181101561145057836001600160a01b03166317bfdfbc8383815181106113c8576113c8613b29565b60200260200101516040518263ffffffff1660e01b81526004016113fb91906001600160a01b0391909116815260200190565b602060405180830381865afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190613e83565b6114469084613e38565b925060010161139e565b5050919050565b6001600160a01b03821660009081526008602052604081205460ff166114a95760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b03163314806114c557506114c56133f5565b6114e15760405162461bcd60e51b8152600401610a3a90613b7e565b6114e96133f5565b806114f657506001821515145b6115125760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260146020908152604091829020805460ff19168615159081179091558251938452606091840182905260049184019190915263135a5b9d60e21b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a001610d93565b60606019805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b6001546001600160a01b031633148061161157506016546001600160a01b031633145b61162d5760405162461bcd60e51b8152600401610a3a90613b09565b8281811580159061163d57508082145b6116725760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061168f5761168f613b29565b90506020020135601860008989858181106116ac576116ac613b29565b90506020020160208101906116c191906136af565b6001600160a01b031681526020810191909152604001600020558686828181106116ed576116ed613b29565b905060200201602081019061170291906136af565b6001600160a01b03167f9e0ad9cee10bdf36b7fbd38910c0bdff0f275ace679b45b922381c2723d676f886868481811061173e5761173e613b29565b9050602002013560405161175491815260200190565b60405180910390a2600101611675565b50505050505050565b6117756133f5565b6117915760405162461bcd60e51b8152600401610a3a90613b09565b80156117be576001600160a01b038316600090815260208052604090206117b89083613456565b50505050565b6001600160a01b038316600090815260208052604090206117b8908361346b565b600981815481106117ef57600080fd5b6000918252602090912001546001600160a01b0316905081565b60006118136133f5565b61182357610d9e60016017613480565b601380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f0613b6ee6a04f0d09f390e4d9318894b9f6ac7fd83897cd8d18896ba579c401e910160405180910390a160009392505050565b6001546001600160a01b03163314806118ac57506016546001600160a01b031633145b6118c85760405162461bcd60e51b8152600401610a3a90613b09565b828181158015906118d857508082145b61190d5760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061192a5761192a613b29565b905060200201356017600089898581811061194757611947613b29565b905060200201602081019061195c91906136af565b6001600160a01b0316815260208101919091526040016000205586868281811061198857611988613b29565b905060200201602081019061199d91906136af565b6001600160a01b03167f6f1951b2aad10f3fc81b86d91105b413a5b3f847a34bbc5ce1904201b14438f68686848181106119d9576119d9613b29565b905060200201356040516119ef91815260200190565b60405180910390a2600101611910565b6000611a096133f5565b611a255760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038216611a675760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601b54811015611ae657601b8181548110611a8757611a87613b29565b6000918252602090912001546001600160a01b0390811690841603611ade5760405162461bcd60e51b815260206004820152600d60248201526c08585b1c9958591e5859191959609a1b6044820152606401610a3a565b600101611a6a565b50601b805460018101825560009182527f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc10180546001600160a01b0319166001600160a01b0385161790555b601954811015610c555760198181548110611b4f57611b4f613b29565b6000918252602090912001546001600160a01b0390811690841603611b7e5760198054610ad490600190613b55565b600101611b32565b601b81815481106117ef57600080fd5b600b81815481106117ef57600080fd5b6000836001600160a01b0316856001600160a01b0316148015611bc7575082155b15611bd457506000610a0c565b6000196001600160a01b03851615611d4e576001600160a01b038086166000908152601d60209081526040808320938a168352929052205460ff168015611c4757506001600160a01b038086166000908152601f60209081526040808320938a16835292905220611c4590846133d3565b155b15611c5457506000611d4e565b6001600160a01b038086166000908152601c60209081526040808320938a16835292905220548015801590611cb557506001600160a01b038087166000908152601e60209081526040808320938b16835292905220611cb390856133d3565b155b15611d4c5760035460405163fc57d4df60e01b81526001600160a01b038881166004830152600092169063fc57d4df90602401602060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d299190613e83565b9050670de0b6b3a7640000611d3e8284613ddb565b611d489190613e24565b9250505b505b6000611d5987610dcc565b9050600081118015611d8957506001600160a01b03871660009081526020805260409020611d8790856133d3565b155b15611e6c5760035460405163fc57d4df60e01b81526001600160a01b038981166004830152600092169063fc57d4df90602401602060405180830381865afa158015611dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dfd9190613e83565b90506000670de0b6b3a7640000611e148385613ddb565b611e1e9190613e24565b6001600160a01b038a16600090815260086020526040902060010154909150670de0b6b3a764000090611e519083613ddb565b611e5b9190613e24565b905083811015611e69578093505b50505b5095945050505050565b6000611e806133f5565b611e9c5760405162461bcd60e51b8152600401610a3a90613b09565b738680ceabcb9b56913c519c069add6bc3494b702060005b600954811015611f5b5760098181548110611ed157611ed1613b29565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b0316637f15e2166040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f529190613e83565b50600101611eb4565b50604051632210724360e11b8152738fba84867ba458e7c6e2c024d2de3d0b5c3ea1c260048201526001600160a01b03821690634420e486906024016020604051808303816000875af1158015611fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fda9190613e83565b91505090565b6000611fea6133f5565b611ffa57610d9e60016018613480565b6001600160a01b03821660009081526008602052604090205460ff1661202657610d9e60086019613480565b6000826001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208a9190613e83565b111561209c57610d9e6014601a613480565b6001600160a01b0382166000908152600860209081526040808320805460ff1916815560010183905560098054825181850281018501909352808352919290919083018282801561211657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120f8575b5050835193945083925060009150505b8281101561217057856001600160a01b031684828151811061214a5761214a613b29565b60200260200101516001600160a01b03160361216857809150612170565b600101612126565b5081811061218057612180613eb2565b6009805461219090600190613b55565b815481106121a0576121a0613b29565b600091825260209091200154600980546001600160a01b0390921691839081106121cc576121cc613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061220b5761220b613b68565b6001900381819060005260206000200160006101000a8154906001600160a01b03021916905590556000600e6000876001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190613ba1565b6001600160a01b039081168252602080830193909352604091820160002080546001600160a01b031916948216949094179093555191871682527f302feb03efd5741df80efe7f97f5d93d74d46a542a3d312d0faae64fa1f3e0e9910160405180910390a1600095945050505050565b60408051602180825261044082019092526060919060009082602082016104208036833701905050905063692fd2a960e01b8161234784613ec8565b93508360ff168151811061235d5761235d613b29565b6001600160e01b031990921660209283029190910190910152631469217960e21b8161238884613ec8565b93508360ff168151811061239e5761239e613b29565b6001600160e01b03199092166020928302919091019091015263607ef6c160e01b816123c984613ec8565b93508360ff16815181106123df576123df613b29565b6001600160e01b03199092166020928302919091019091015263d219fca760e01b8161240a84613ec8565b93508360ff168151811061242057612420613b29565b6001600160e01b03199092166020928302919091019091015263063b571360e51b8161244b84613ec8565b93508360ff168151811061246157612461613b29565b6001600160e01b0319909216602092830291909101909101526351c8491d60e01b8161248c84613ec8565b93508360ff16815181106124a2576124a2613b29565b6001600160e01b031990921660209283029190910190910152632fa5169960e21b816124cd84613ec8565b93508360ff16815181106124e3576124e3613b29565b6001600160e01b03199092166020928302919091019091015263391957d760e01b8161250e84613ec8565b93508360ff168151811061252457612524613b29565b6001600160e01b031990921660209283029190910190910152632fad78d560e11b8161254f84613ec8565b93508360ff168151811061256557612565613b29565b6001600160e01b031990921660209283029190910190910152633bcf7ec160e01b8161259084613ec8565b93508360ff16815181106125a6576125a6613b29565b6001600160e01b0319909216602092830291909101909101526318c882a560e01b816125d184613ec8565b93508360ff16815181106125e7576125e7613b29565b6001600160e01b0319909216602092830291909101909101526323afd8d960e21b8161261284613ec8565b93508360ff168151811061262857612628613b29565b6001600160e01b0319909216602092830291909101909101526305ae1b6f60e31b8161265384613ec8565b93508360ff168151811061266957612669613b29565b6001600160e01b031990921660209283029190910190910152631032c0b560e31b8161269484613ec8565b93508360ff16815181106126aa576126aa613b29565b6001600160e01b03199092166020928302919091019091015263b0772d0b60e01b816126d584613ec8565b93508360ff16815181106126eb576126eb613b29565b6001600160e01b031990921660209283029190910190910152631955e6df60e11b8161271684613ec8565b93508360ff168151811061272c5761272c613b29565b6001600160e01b03199092166020928302919091019091015263015c3b9b60e41b8161275784613ec8565b93508360ff168151811061276d5761276d613b29565b6001600160e01b03199092166020928302919091019091015263e680659160e01b8161279884613ec8565b93508360ff16815181106127ae576127ae613b29565b6001600160e01b03199092166020928302919091019091015263d01f63f560e01b816127d984613ec8565b93508360ff16815181106127ef576127ef613b29565b6001600160e01b031990921660209283029190910190910152633605b51b60e01b8161281a84613ec8565b93508360ff168151811061283057612830613b29565b6001600160e01b03199092166020928302919091019091015263d9e0ea6b60e01b8161285b84613ec8565b93508360ff168151811061287157612871613b29565b6001600160e01b031990921660209283029190910190910152634a76e72760e01b8161289c84613ec8565b93508360ff16815181106128b2576128b2613b29565b6001600160e01b03199092166020928302919091019091015263084c846760e11b816128dd84613ec8565b93508360ff16815181106128f3576128f3613b29565b6001600160e01b03199092166020928302919091019091015263a5fb485760e01b8161291e84613ec8565b93508360ff168151811061293457612934613b29565b6001600160e01b03199092166020928302919091019091015263ee5b9a2f60e01b8161295f84613ec8565b93508360ff168151811061297557612975613b29565b6001600160e01b03199092166020928302919091019091015263044707e760e11b816129a084613ec8565b93508360ff16815181106129b6576129b6613b29565b6001600160e01b031990921660209283029190910190910152633e1d3ac360e21b816129e184613ec8565b93508360ff16815181106129f7576129f7613b29565b6001600160e01b031990921660209283029190910190910152631139fa0760e11b81612a2284613ec8565b93508360ff1681518110612a3857612a38613b29565b6001600160e01b03199092166020928302919091019091015263b325380160e01b81612a6384613ec8565b93508360ff1681518110612a7957612a79613b29565b6001600160e01b031990921660209283029190910190910152637db121fd60e11b81612aa484613ec8565b93508360ff1681518110612aba57612aba613b29565b6001600160e01b031990921660209283029190910190910152631d3965af60e11b81612ae584613ec8565b93508360ff1681518110612afb57612afb613b29565b6001600160e01b031990921660209283029190910190910152633c1f884b60e11b81612b2684613ec8565b93508360ff1681518110612b3c57612b3c613b29565b6001600160e01b031990921660209283029190910190910152633f8af10b60e11b81612b6784613ec8565b93508360ff1681518110612b7d57612b7d613b29565b6001600160e01b03199092166020928302919091019091015260ff821615610d9e5760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610a3a565b6013546000906001600160a01b0316331480612c065750612c066133f5565b612c225760405162461bcd60e51b8152600401610a3a90613b7e565b612c2a6133f5565b80612c3757506001821515145b612c535760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b01b0260ff60b01b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600890820152672a3930b739b332b960c11b6060820152901515602082015260800190565b612cc96133f5565b612ce55760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601c602090815260408083209490951682529290925291902055565b60606009805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215612df3576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b6001600160a01b0382166000908152602160205260408120610dc590836133d3565b612e3a6133f5565b612e565760405162461bcd60e51b8152600401610a3a90613b09565b8015612e7e576001600160a01b03831660009081526021602052604090206117b89083613456565b6001600160a01b03831660009081526021602052604090206117b8908361346b565b601981815481106117ef57600080fd5b612eb86133f5565b612ed45760405162461bcd60e51b8152600401610a3a90613b09565b8015612f0f576001600160a01b038085166000908152601f60209081526040808320938716835292905220612f099083613456565b506117b8565b6001600160a01b038085166000908152601f60209081526040808320938716835292905220612f3e908361346b565b5050505050565b60606011805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b612fad6133f5565b612fc95760405162461bcd60e51b8152600401610a3a90613b09565b8015612ffe576001600160a01b038085166000908152601e60209081526040808320938716835292905220612f099083613456565b6001600160a01b038085166000908152601e60209081526040808320938716835292905220612f3e908361346b565b601181815481106117ef57600080fd5b6000805b600954811015610c555760006009828154811061306057613060613b29565b60009182526020808320909101546001600160a01b03908116808452600883526040808520928916855260029092019092529091205490915060ff16156130ab575060019392505050565b50600101613041565b600760205281600052604060002081815481106130d057600080fd5b6000918252602090912001546001600160a01b03169150829050565b600b5460009060609080830361311657604080516000808252602082019092529250925050613264565b836000036131245761012c93505b8360006131318284613ee5565b905061313d8684613e24565b94508015613168578461314f81613ef9565b955085905061315f886001613e38565b03613168578091505b84613174886001613e38565b111561319457505060408051600081526020810190915291506132649050565b60006131a08789613ddb565b90508267ffffffffffffffff8111156131bb576131bb613bbe565b6040519080825280602002602001820160405280156131e4578160200160208202803683370190505b50945060005b8381101561325e57600b6131fe8383613e38565b8154811061320e5761320e613b29565b9060005260206000200160009054906101000a90046001600160a01b031686828151811061323e5761323e613b29565b6001600160a01b03909216602092830291909101909101526001016131ea565b50505050505b9250929050565b6132736133f5565b61328f5760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601d6020908152604080832094909516825292909252919020805460ff1916911515919091179055565b6001600160a01b038084166000908152601f602090815260408083209386168352929052908120610a0c90836133d3565b6001600160a01b03811660009081526020805260408120819061331c90613449565b905060005b815181101561145057836001600160a01b0316633af9e66983838151811061334b5761334b613b29565b60200260200101516040518263ffffffff1660e01b815260040161337e91906001600160a01b0391909116815260200190565b602060405180830381865afa15801561339b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133bf9190613e83565b6133c99084613e38565b9250600101613321565b6001600160a01b03811660009081526001830160205260408120541515610dc5565b6001546000906001600160a01b03163314801561341b5750600254600160a81b900460ff165b8061344457506000546001600160a01b0316331480156134445750600254600160a01b900460ff165b905090565b60606000610dc5836134f9565b6000610dc5836001600160a01b038416613555565b6000610dc5836001600160a01b0384166135a4565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156134b5576134b5613e9c565b83601a8111156134c7576134c7613e9c565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610dc557610dc5613e9c565b60608160000180548060200260200160405190810160405280929190818152602001828054801561354957602002820191906000526020600020905b815481526020019060010190808311613535575b50505050509050919050565b600081815260018301602052604081205461359c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d9e565b506000610d9e565b6000818152600183016020526040812054801561368d5760006135c8600183613b55565b85549091506000906135dc90600190613b55565b90508181146136415760008660000182815481106135fc576135fc613b29565b906000526020600020015490508087600001848154811061361f5761361f613b29565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061365257613652613b68565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d9e565b6000915050610d9e565b6001600160a01b03811681146136ac57600080fd5b50565b6000602082840312156136c157600080fd5b8135610dc581613697565b6000806000606084860312156136e157600080fd5b83356136ec81613697565b925060208401356136fc81613697565b9150604084013561370c81613697565b809150509250925092565b8035801515811461372757600080fd5b919050565b6000806040838503121561373f57600080fd5b823561374a81613697565b915061375860208401613717565b90509250929050565b6000806040838503121561377457600080fd5b823561377f81613697565b9150602083013561378f81613697565b809150509250929050565b6000602082840312156137ac57600080fd5b610dc582613717565b60008151808452602080850194506020840160005b838110156137ef5781516001600160a01b0316875295820195908201906001016137ca565b509495945050505050565b602081526000610dc560208301846137b5565b60008083601f84011261381f57600080fd5b50813567ffffffffffffffff81111561383757600080fd5b6020830191508360208260051b850101111561326457600080fd5b6000806000806040858703121561386857600080fd5b843567ffffffffffffffff8082111561388057600080fd5b61388c8883890161380d565b909650945060208701359150808211156138a557600080fd5b506138b28782880161380d565b95989497509550505050565b6000806000606084860312156138d357600080fd5b83356138de81613697565b925060208401356138ee81613697565b91506138fc60408501613717565b90509250925092565b60006020828403121561391757600080fd5b5035919050565b6000806000806080858703121561393457600080fd5b843561393f81613697565b9350602085013561394f81613697565b925061395d60408601613717565b9150606085013561396d81613697565b939692955090935050565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160e01b03191683529284019291840191600101613994565b50909695505050505050565b6000806000606084860312156139db57600080fd5b83356139e681613697565b925060208401356139f681613697565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160a01b031683529284019291840191600101613a23565b60008060008060808587031215613a5e57600080fd5b8435613a6981613697565b93506020850135613a7981613697565b92506040850135613a8981613697565b9150613a9760608601613717565b905092959194509250565b60008060408385031215613ab557600080fd5b8235613ac081613697565b946020939093013593505050565b60008060408385031215613ae157600080fd5b50508035926020909101359150565b828152604060208201526000610a0c60408301846137b5565b60208082526006908201526510b0b236b4b760d11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610d9e57610d9e613b3f565b634e487b7160e01b600052603160045260246000fd5b60208082526009908201526810b3bab0b93234b0b760b91b604082015260600190565b600060208284031215613bb357600080fd5b8151610dc581613697565b634e487b7160e01b600052604160045260246000fd5b805167ffffffffffffffff8116811461372757600080fd5b600060608284031215613bfe57600080fd5b6040516060810181811067ffffffffffffffff82111715613c2f57634e487b7160e01b600052604160045260246000fd5b604052613c3b83613bd4565b8152613c4960208401613bd4565b6020820152604083015163ffffffff81168114613c6557600080fd5b60408201529392505050565b6000825160005b81811015613c925760208186018101518583015201613c78565b506000920191825250919050565b600060208284031215613cb257600080fd5b815160ff81168114610dc557600080fd5b8082018281126000831280158216821582161715613ce357613ce3613b3f565b505092915050565b600181815b80851115613d26578160001904821115613d0c57613d0c613b3f565b80851615613d1957918102915b93841c9390800290613cf0565b509250929050565b600082613d3d57506001610d9e565b81613d4a57506000610d9e565b8160018114613d605760028114613d6a57613d86565b6001915050610d9e565b60ff841115613d7b57613d7b613b3f565b50506001821b610d9e565b5060208310610133831016604e8410600b8410161715613da9575081810a610d9e565b613db38383613ceb565b8060001904821115613dc757613dc7613b3f565b029392505050565b6000610dc58383613d2e565b8082028115828204841417610d9e57610d9e613b3f565b6000600160ff1b8201613e0757613e07613b3f565b5060000390565b634e487b7160e01b600052601260045260246000fd5b600082613e3357613e33613e0e565b500490565b80820180821115610d9e57610d9e613b3f565b600060ff821660ff8103613e6157613e61613b3f565b60010192915050565b60ff8181168382160190811115610d9e57610d9e613b3f565b600060208284031215613e9557600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b600060ff821680613edb57613edb613b3f565b6000190192915050565b600082613ef457613ef4613e0e565b500690565b600060018201613f0b57613f0b613b3f565b506001019056fea2646970667358221220b2f6c6f72545793b55ffe094a2a52377eedce77266c9e0bade1809fee8a91e5764736f6c63430008160033", + "numDeployments": 3, + "solcInputHash": "b983f3d49ecb24251a5a4f735e4e3ec3", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"action\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"pauseState\",\"type\":\"bool\"}],\"name\":\"ActionPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"action\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"pauseState\",\"type\":\"bool\"}],\"name\":\"MarketActionPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"MarketUnlisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBorrowCap\",\"type\":\"uint256\"}],\"name\":\"NewBorrowCap\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldBorrowCapGuardian\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newBorrowCapGuardian\",\"type\":\"address\"}],\"name\":\"NewBorrowCapGuardian\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldPauseGuardian\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newPauseGuardian\",\"type\":\"address\"}],\"name\":\"NewPauseGuardian\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSupplyCap\",\"type\":\"uint256\"}],\"name\":\"NewSupplyCap\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"blacklisted\",\"type\":\"bool\"}],\"name\":\"_blacklistBorrowingAgainstCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_blacklistBorrowingAgainstCollateralWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_borrowCapWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"flywheelAddress\",\"type\":\"address\"}],\"name\":\"_removeFlywheel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"name\":\"_setBorrowCapForCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_setBorrowCapForCollateralWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newBorrowCapGuardian\",\"type\":\"address\"}],\"name\":\"_setBorrowCapGuardian\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setBorrowPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"cTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"newBorrowCaps\",\"type\":\"uint256[]\"}],\"name\":\"_setMarketBorrowCaps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"cTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"newSupplyCaps\",\"type\":\"uint256[]\"}],\"name\":\"_setMarketSupplyCaps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setMintPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newPauseGuardian\",\"type\":\"address\"}],\"name\":\"_setPauseGuardian\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setSeizePaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"_setTransferPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"_supplyCapWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"_unsupportMarket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"accountAssets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"flywheelAddress\",\"type\":\"address\"}],\"name\":\"addNonAccruingFlywheel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allBorrowers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCapForCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowCapGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowingAgainstCollateralBlacklist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"cTokensByUnderlying\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"closeFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveBorrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveSupplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplyCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforceWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAccruingFlywheels\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllBorrowers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllBorrowersCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"contract ICErc20\",\"name\":\"cTokenModify\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"redeeming\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAssetAsCollateralValueCap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"page\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pageSize\",\"type\":\"uint256\"}],\"name\":\"getPaginatedBorrowers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalPages\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_pageOfBorrowers\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardsDistributors\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWhitelist\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"getWhitelistedBorrowersBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowed\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"getWhitelistedSuppliersSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplied\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBlacklistBorrowingAgainstCollateralWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cTokenBorrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cTokenCollateral\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBorrowCapForCollateralWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isBorrowCapWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isComptroller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isSupplyCapWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"isUserOfPool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationIncentiveMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"markets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isListed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nonAccruingRewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registerInSFS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seizeGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"suppliers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transferGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistArray\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Failure(uint256,uint256,uint256)\":{\"details\":\"`error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.*\"}},\"kind\":\"dev\",\"methods\":{\"_getExtensionFunctions()\":{\"returns\":{\"_0\":\"a list of all the function selectors that this logic extension exposes\"}},\"_removeFlywheel(address)\":{\"details\":\"Removes a flywheel from the accruing or non-accruing array\",\"params\":{\"flywheelAddress\":\"The address of the flywheel to remove from the accruing or non-accruing array\"},\"returns\":{\"_0\":\"true if the flywheel was found and removed\"}},\"_setBorrowCapGuardian(address)\":{\"params\":{\"newBorrowCapGuardian\":\"The address of the new Borrow Cap Guardian\"}},\"_setMarketBorrowCaps(address[],uint256[])\":{\"details\":\"Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\",\"params\":{\"cTokens\":\"The addresses of the markets (tokens) to change the borrow caps for\",\"newBorrowCaps\":\"The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\"}},\"_setMarketSupplyCaps(address[],uint256[])\":{\"details\":\"Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\",\"params\":{\"cTokens\":\"The addresses of the markets (tokens) to change the supply caps for\",\"newSupplyCaps\":\"The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\"}},\"_setPauseGuardian(address)\":{\"params\":{\"newPauseGuardian\":\"The address of the new Pause Guardian\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See enum Error for details)\"}},\"_unsupportMarket(address)\":{\"details\":\"Admin function unset isListed and collateralFactorMantissa and unadd support for the market\",\"params\":{\"cToken\":\"The address of the market (token) to unlist\"},\"returns\":{\"_0\":\"uint 0=success, otherwise a failure. (See enum Error for details)\"}},\"addNonAccruingFlywheel(address)\":{\"details\":\"Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\",\"params\":{\"flywheelAddress\":\"The address of the flywheel to add to the non-accruing\"}},\"effectiveBorrowCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"effectiveSupplyCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"getAllBorrowers()\":{\"details\":\"The automatic getter may be used to access an individual borrower.\",\"returns\":{\"_0\":\"The list of borrower account addresses\"}},\"getAllMarkets()\":{\"details\":\"The automatic getter may be used to access an individual market.\",\"returns\":{\"_0\":\"The list of market addresses\"}},\"getWhitelist()\":{\"details\":\"The automatic getter may be used to access an individual whitelist status.\",\"returns\":{\"_0\":\"The list of borrower account addresses\"}}},\"version\":1},\"userdoc\":{\"events\":{\"ActionPaused(string,bool)\":{\"notice\":\"Emitted when an action is paused globally\"},\"MarketActionPaused(address,string,bool)\":{\"notice\":\"Emitted when an action is paused on a market\"},\"MarketUnlisted(address)\":{\"notice\":\"Emitted when an admin unsupports a market\"},\"NewBorrowCap(address,uint256)\":{\"notice\":\"Emitted when borrow cap for a cToken is changed\"},\"NewBorrowCapGuardian(address,address)\":{\"notice\":\"Emitted when borrow cap guardian is changed\"},\"NewPauseGuardian(address,address)\":{\"notice\":\"Emitted when pause guardian is changed\"},\"NewSupplyCap(address,uint256)\":{\"notice\":\"Emitted when supply cap for a cToken is changed\"}},\"kind\":\"user\",\"methods\":{\"_setBorrowCapGuardian(address)\":{\"notice\":\"Admin function to change the Borrow Cap Guardian\"},\"_setMarketBorrowCaps(address[],uint256[])\":{\"notice\":\"Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\"},\"_setMarketSupplyCaps(address[],uint256[])\":{\"notice\":\"Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\"},\"_setPauseGuardian(address)\":{\"notice\":\"Admin function to change the Pause Guardian\"},\"_unsupportMarket(address)\":{\"notice\":\"Removed a market from the markets mapping and sets it as unlisted\"},\"accountAssets(address,uint256)\":{\"notice\":\"Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\"},\"addNonAccruingFlywheel(address)\":{\"notice\":\"Returns true if the accruing flyhwheel was found and replaced\"},\"admin()\":{\"notice\":\"Administrator for this contract\"},\"adminHasRights()\":{\"notice\":\"Whether or not the admin has admin rights\"},\"allBorrowers(uint256)\":{\"notice\":\"A list of all borrowers who have entered markets\"},\"allMarkets(uint256)\":{\"notice\":\"A list of all markets\"},\"borrowCapGuardian()\":{\"notice\":\"The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\"},\"borrowCaps(address)\":{\"notice\":\"Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\"},\"cTokensByUnderlying(address)\":{\"notice\":\"All cTokens addresses mapped by their underlying token addresses\"},\"closeFactorMantissa()\":{\"notice\":\"Multiplier used to calculate the maximum repayAmount when liquidating a borrow\"},\"effectiveBorrowCaps(address)\":{\"notice\":\"Gets the borrow cap of a cToken in the units of the underlying asset.\"},\"effectiveSupplyCaps(address)\":{\"notice\":\"Gets the supply cap of a cToken in the units of the underlying asset.\"},\"enforceWhitelist()\":{\"notice\":\"Whether or not the supplier whitelist is enforced\"},\"getAllBorrowers()\":{\"notice\":\"Return all of the borrowers\"},\"getAllMarkets()\":{\"notice\":\"Return all of the markets\"},\"getRewardsDistributors()\":{\"notice\":\"Returns an array of all accruing and non-accruing flywheels\"},\"getWhitelist()\":{\"notice\":\"Return all of the whitelist\"},\"ionicAdminHasRights()\":{\"notice\":\"Whether or not the Ionic admin has admin rights\"},\"isComptroller()\":{\"notice\":\"Indicator that this is a Comptroller contract (for inspection)\"},\"liquidationIncentiveMantissa()\":{\"notice\":\"Multiplier representing the discount on collateral that a liquidator receives\"},\"markets(address)\":{\"notice\":\"Official mapping of cTokens -> Market metadata\"},\"nonAccruingRewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor to list for claiming, but not to notify of flywheel changes.\"},\"oracle()\":{\"notice\":\"Oracle which gives the price of any given asset\"},\"pauseGuardian()\":{\"notice\":\"The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing / transfer can only be paused globally, not by market.\"},\"pendingAdmin()\":{\"notice\":\"Pending administrator for this contract\"},\"rewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor contracts to notify of flywheel changes.\"},\"supplyCaps(address)\":{\"notice\":\"Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\"},\"whitelist(address)\":{\"notice\":\"Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\"},\"whitelistArray(uint256)\":{\"notice\":\"An array of all whitelisted accounts\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/ComptrollerFirstExtension.sol\":\"ComptrollerFirstExtension\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x98f176ae2753880b0751466561ae0d66c4de612f238454deb1b89243b5067beb\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerFirstExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerErrorReporter } from \\\"../compound/ErrorReporter.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { ComptrollerExtensionInterface, ComptrollerBase, SFSRegister } from \\\"./ComptrollerInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract ComptrollerFirstExtension is\\n DiamondExtension,\\n ComptrollerBase,\\n ComptrollerExtensionInterface,\\n ComptrollerErrorReporter\\n{\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice Emitted when supply cap for a cToken is changed\\n event NewSupplyCap(ICErc20 indexed cToken, uint256 newSupplyCap);\\n\\n /// @notice Emitted when borrow cap for a cToken is changed\\n event NewBorrowCap(ICErc20 indexed cToken, uint256 newBorrowCap);\\n\\n /// @notice Emitted when borrow cap guardian is changed\\n event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian);\\n\\n /// @notice Emitted when pause guardian is changed\\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\\n\\n /// @notice Emitted when an action is paused globally\\n event ActionPaused(string action, bool pauseState);\\n\\n /// @notice Emitted when an action is paused on a market\\n event MarketActionPaused(ICErc20 cToken, string action, bool pauseState);\\n\\n /// @notice Emitted when an admin unsupports a market\\n event MarketUnlisted(ICErc20 cToken);\\n\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\\n uint8 fnsCount = 33;\\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\\n functionSelectors[--fnsCount] = this.addNonAccruingFlywheel.selector;\\n functionSelectors[--fnsCount] = this._setMarketSupplyCaps.selector;\\n functionSelectors[--fnsCount] = this._setMarketBorrowCaps.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateralWhitelist.selector;\\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateralWhitelist.selector;\\n functionSelectors[--fnsCount] = this._supplyCapWhitelist.selector;\\n functionSelectors[--fnsCount] = this._borrowCapWhitelist.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapGuardian.selector;\\n functionSelectors[--fnsCount] = this._setPauseGuardian.selector;\\n functionSelectors[--fnsCount] = this._setMintPaused.selector;\\n functionSelectors[--fnsCount] = this._setBorrowPaused.selector;\\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\\n functionSelectors[--fnsCount] = this._unsupportMarket.selector;\\n functionSelectors[--fnsCount] = this.getAllMarkets.selector;\\n functionSelectors[--fnsCount] = this.getAllBorrowers.selector;\\n functionSelectors[--fnsCount] = this.getAllBorrowersCount.selector;\\n functionSelectors[--fnsCount] = this.getPaginatedBorrowers.selector;\\n functionSelectors[--fnsCount] = this.getWhitelist.selector;\\n functionSelectors[--fnsCount] = this.getRewardsDistributors.selector;\\n functionSelectors[--fnsCount] = this.isUserOfPool.selector;\\n functionSelectors[--fnsCount] = this.getAccruingFlywheels.selector;\\n functionSelectors[--fnsCount] = this._removeFlywheel.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateral.selector;\\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateral.selector;\\n functionSelectors[--fnsCount] = this.isBorrowCapForCollateralWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.isBlacklistBorrowingAgainstCollateralWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.isSupplyCapWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.isBorrowCapWhitelisted.selector;\\n functionSelectors[--fnsCount] = this.getWhitelistedSuppliersSupply.selector;\\n functionSelectors[--fnsCount] = this.getWhitelistedBorrowersBorrows.selector;\\n functionSelectors[--fnsCount] = this.getAssetAsCollateralValueCap.selector;\\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return functionSelectors;\\n }\\n\\n /**\\n * @notice Returns true if the accruing flyhwheel was found and replaced\\n * @dev Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\\n * @param flywheelAddress The address of the flywheel to add to the non-accruing\\n */\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n require(flywheelAddress != address(0), \\\"!flywheel\\\");\\n\\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\\n require(flywheelAddress != nonAccruingRewardsDistributors[i], \\\"!alreadyadded\\\");\\n }\\n\\n // add it to the non-accruing\\n nonAccruingRewardsDistributors.push(flywheelAddress);\\n\\n // remove it from the accruing\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\\n if (flywheelAddress == rewardsDistributors[i]) {\\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\\n rewardsDistributors.pop();\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256) {\\n if (address(collateral) == address(cTokenModify) && !redeeming) {\\n // the collateral asset counts as 0 liquidity when borrowed\\n return 0;\\n }\\n\\n uint256 assetAsCollateralValueCap = type(uint256).max;\\n if (address(cTokenModify) != address(0)) {\\n // if the borrowed asset is blacklisted against this collateral & account is not whitelisted\\n if (\\n borrowingAgainstCollateralBlacklist[address(cTokenModify)][address(collateral)] &&\\n !borrowingAgainstCollateralBlacklistWhitelist[address(cTokenModify)][address(collateral)].contains(account)\\n ) {\\n assetAsCollateralValueCap = 0;\\n } else {\\n // for each user the value of this kind of collateral is capped regardless of the amount borrowed\\n // denominated in the borrowed asset\\n uint256 borrowCapForCollateral = borrowCapForCollateral[address(cTokenModify)][address(collateral)];\\n // check if set to any value & account is not whitelisted\\n if (\\n borrowCapForCollateral != 0 &&\\n !borrowCapForCollateralWhitelist[address(cTokenModify)][address(collateral)].contains(account)\\n ) {\\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\\n // this asset usage as collateral is capped at the native value of the borrow cap\\n assetAsCollateralValueCap = (borrowCapForCollateral * borrowedAssetPrice) / 1e18;\\n }\\n }\\n }\\n\\n uint256 supplyCap = effectiveSupplyCaps(address(collateral));\\n\\n // if there is any supply cap, don't allow donations to the market/plugin to go around it\\n if (supplyCap > 0 && !supplyCapWhitelist[address(collateral)].contains(account)) {\\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateral);\\n uint256 supplyCapValue = (supplyCap * collateralAssetPrice) / 1e18;\\n supplyCapValue = (supplyCapValue * markets[address(collateral)].collateralFactorMantissa) / 1e18;\\n if (supplyCapValue < assetAsCollateralValueCap) assetAsCollateralValueCap = supplyCapValue;\\n }\\n\\n return assetAsCollateralValueCap;\\n }\\n\\n /**\\n * @notice Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\\n * @dev Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\\n * @param cTokens The addresses of the markets (tokens) to change the supply caps for\\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\\n */\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n uint256 numMarkets = cTokens.length;\\n uint256 numSupplyCaps = newSupplyCaps.length;\\n\\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \\\"!input\\\");\\n\\n for (uint256 i = 0; i < numMarkets; i++) {\\n supplyCaps[address(cTokens[i])] = newSupplyCaps[i];\\n emit NewSupplyCap(cTokens[i], newSupplyCaps[i]);\\n }\\n }\\n\\n /**\\n * @notice Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\\n * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\\n * @param cTokens The addresses of the markets (tokens) to change the borrow caps for\\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\\n */\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n uint256 numMarkets = cTokens.length;\\n uint256 numBorrowCaps = newBorrowCaps.length;\\n\\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \\\"!input\\\");\\n\\n for (uint256 i = 0; i < numMarkets; i++) {\\n borrowCaps[address(cTokens[i])] = newBorrowCaps[i];\\n emit NewBorrowCap(cTokens[i], newBorrowCaps[i]);\\n }\\n }\\n\\n /**\\n * @notice Admin function to change the Borrow Cap Guardian\\n * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian\\n */\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external {\\n require(msg.sender == admin, \\\"!admin\\\");\\n\\n // Save current value for inclusion in log\\n address oldBorrowCapGuardian = borrowCapGuardian;\\n\\n // Store borrowCapGuardian with value newBorrowCapGuardian\\n borrowCapGuardian = newBorrowCapGuardian;\\n\\n // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)\\n emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);\\n }\\n\\n /**\\n * @notice Admin function to change the Pause Guardian\\n * @param newPauseGuardian The address of the new Pause Guardian\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _setPauseGuardian(address newPauseGuardian) public returns (uint256) {\\n if (!hasAdminRights()) {\\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK);\\n }\\n\\n // Save current value for inclusion in log\\n address oldPauseGuardian = pauseGuardian;\\n\\n // Store pauseGuardian with value newPauseGuardian\\n pauseGuardian = newPauseGuardian;\\n\\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\\n emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function _setMintPaused(ICErc20 cToken, bool state) public returns (bool) {\\n require(markets[address(cToken)].isListed, \\\"!market\\\");\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n mintGuardianPaused[address(cToken)] = state;\\n emit MarketActionPaused(cToken, \\\"Mint\\\", state);\\n return state;\\n }\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) public returns (bool) {\\n require(markets[address(cToken)].isListed, \\\"!market\\\");\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n borrowGuardianPaused[address(cToken)] = state;\\n emit MarketActionPaused(cToken, \\\"Borrow\\\", state);\\n return state;\\n }\\n\\n function _setTransferPaused(bool state) public returns (bool) {\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n transferGuardianPaused = state;\\n emit ActionPaused(\\\"Transfer\\\", state);\\n return state;\\n }\\n\\n function _setSeizePaused(bool state) public returns (bool) {\\n require(msg.sender == pauseGuardian || hasAdminRights(), \\\"!guardian\\\");\\n require(hasAdminRights() || state == true, \\\"!admin\\\");\\n\\n seizeGuardianPaused = state;\\n emit ActionPaused(\\\"Seize\\\", state);\\n return state;\\n }\\n\\n /**\\n * @notice Removed a market from the markets mapping and sets it as unlisted\\n * @dev Admin function unset isListed and collateralFactorMantissa and unadd support for the market\\n * @param cToken The address of the market (token) to unlist\\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\\n */\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256) {\\n // Check admin rights\\n if (!hasAdminRights()) return fail(Error.UNAUTHORIZED, FailureInfo.UNSUPPORT_MARKET_OWNER_CHECK);\\n\\n // Check if market is already unlisted\\n if (!markets[address(cToken)].isListed)\\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNSUPPORT_MARKET_DOES_NOT_EXIST);\\n\\n // Check if market is in use\\n if (cToken.totalSupply() > 0) return fail(Error.NONZERO_TOTAL_SUPPLY, FailureInfo.UNSUPPORT_MARKET_IN_USE);\\n\\n // Unlist market\\n delete markets[address(cToken)];\\n\\n /* Delete cToken from allMarkets */\\n // load into memory for faster iteration\\n ICErc20[] memory _allMarkets = allMarkets;\\n uint256 len = _allMarkets.length;\\n uint256 assetIndex = len;\\n for (uint256 i = 0; i < len; i++) {\\n if (_allMarkets[i] == cToken) {\\n assetIndex = i;\\n break;\\n }\\n }\\n\\n // We *must* have found the asset in the list or our redundant data structure is broken\\n assert(assetIndex < len);\\n\\n // copy last item in list to location of item to be removed, reduce length by 1\\n allMarkets[assetIndex] = allMarkets[allMarkets.length - 1];\\n allMarkets.pop();\\n\\n cTokensByUnderlying[ICErc20(address(cToken)).underlying()] = ICErc20(address(0));\\n emit MarketUnlisted(cToken);\\n\\n return uint256(Error.NO_ERROR);\\n }\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n borrowCapForCollateral[cTokenBorrow][cTokenCollateral] = borrowCap;\\n }\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].add(account);\\n else borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\\n }\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) public view returns (bool) {\\n return borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\\n }\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n borrowingAgainstCollateralBlacklist[cTokenBorrow][cTokenCollateral] = blacklisted;\\n }\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].add(account);\\n else borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\\n }\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) public view returns (bool) {\\n return borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\\n }\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) supplyCapWhitelist[cToken].add(account);\\n else supplyCapWhitelist[cToken].remove(account);\\n }\\n\\n function isSupplyCapWhitelisted(address cToken, address account) public view returns (bool) {\\n return supplyCapWhitelist[cToken].contains(account);\\n }\\n\\n function getWhitelistedSuppliersSupply(address cToken) public view returns (uint256 supplied) {\\n address[] memory whitelistedSuppliers = supplyCapWhitelist[cToken].values();\\n for (uint256 i = 0; i < whitelistedSuppliers.length; i++) {\\n supplied += ICErc20(cToken).balanceOfUnderlying(whitelistedSuppliers[i]);\\n }\\n }\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) public {\\n require(hasAdminRights(), \\\"!admin\\\");\\n\\n if (whitelisted) borrowCapWhitelist[cToken].add(account);\\n else borrowCapWhitelist[cToken].remove(account);\\n }\\n\\n function isBorrowCapWhitelisted(address cToken, address account) public view returns (bool) {\\n return borrowCapWhitelist[cToken].contains(account);\\n }\\n\\n function getWhitelistedBorrowersBorrows(address cToken) public view returns (uint256 borrowed) {\\n address[] memory whitelistedBorrowers = borrowCapWhitelist[cToken].values();\\n for (uint256 i = 0; i < whitelistedBorrowers.length; i++) {\\n borrowed += ICErc20(cToken).borrowBalanceCurrent(whitelistedBorrowers[i]);\\n }\\n }\\n\\n /**\\n * @notice Return all of the markets\\n * @dev The automatic getter may be used to access an individual market.\\n * @return The list of market addresses\\n */\\n function getAllMarkets() public view returns (ICErc20[] memory) {\\n return allMarkets;\\n }\\n\\n /**\\n * @notice Return all of the borrowers\\n * @dev The automatic getter may be used to access an individual borrower.\\n * @return The list of borrower account addresses\\n */\\n function getAllBorrowers() public view returns (address[] memory) {\\n return allBorrowers;\\n }\\n\\n function getAllBorrowersCount() public view returns (uint256) {\\n return allBorrowers.length;\\n }\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) public view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) {\\n uint256 allBorrowersCount = allBorrowers.length;\\n if (allBorrowersCount == 0) {\\n return (0, new address[](0));\\n }\\n\\n if (pageSize == 0) pageSize = 300;\\n uint256 currentPageSize = pageSize;\\n uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize;\\n\\n _totalPages = allBorrowersCount / pageSize;\\n if (sizeOfPageFromRemainder > 0) {\\n _totalPages++;\\n if (page + 1 == _totalPages) {\\n currentPageSize = sizeOfPageFromRemainder;\\n }\\n }\\n\\n if (page + 1 > _totalPages) {\\n return (_totalPages, new address[](0));\\n }\\n\\n uint256 offset = page * pageSize;\\n _pageOfBorrowers = new address[](currentPageSize);\\n for (uint256 i = 0; i < currentPageSize; i++) {\\n _pageOfBorrowers[i] = allBorrowers[i + offset];\\n }\\n }\\n\\n /**\\n * @notice Return all of the whitelist\\n * @dev The automatic getter may be used to access an individual whitelist status.\\n * @return The list of borrower account addresses\\n */\\n function getWhitelist() external view returns (address[] memory) {\\n return whitelistArray;\\n }\\n\\n /**\\n * @notice Returns an array of all accruing and non-accruing flywheels\\n */\\n function getRewardsDistributors() external view returns (address[] memory) {\\n address[] memory allFlywheels = new address[](rewardsDistributors.length + nonAccruingRewardsDistributors.length);\\n\\n uint8 i = 0;\\n while (i < rewardsDistributors.length) {\\n allFlywheels[i] = rewardsDistributors[i];\\n i++;\\n }\\n uint8 j = 0;\\n while (j < nonAccruingRewardsDistributors.length) {\\n allFlywheels[i + j] = nonAccruingRewardsDistributors[j];\\n j++;\\n }\\n\\n return allFlywheels;\\n }\\n\\n function getAccruingFlywheels() external view returns (address[] memory) {\\n return rewardsDistributors;\\n }\\n\\n /**\\n * @dev Removes a flywheel from the accruing or non-accruing array\\n * @param flywheelAddress The address of the flywheel to remove from the accruing or non-accruing array\\n * @return true if the flywheel was found and removed\\n */\\n function _removeFlywheel(address flywheelAddress) external returns (bool) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n require(flywheelAddress != address(0), \\\"!flywheel\\\");\\n\\n // remove it from the accruing\\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\\n if (flywheelAddress == rewardsDistributors[i]) {\\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\\n rewardsDistributors.pop();\\n return true;\\n }\\n }\\n\\n // or remove it from the non-accruing\\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\\n if (flywheelAddress == nonAccruingRewardsDistributors[i]) {\\n nonAccruingRewardsDistributors[i] = nonAccruingRewardsDistributors[nonAccruingRewardsDistributors.length - 1];\\n nonAccruingRewardsDistributors.pop();\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n function isUserOfPool(address user) external view returns (bool) {\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n address marketAddress = address(allMarkets[i]);\\n if (markets[marketAddress].accountMembership[user]) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n function registerInSFS() external returns (uint256) {\\n require(hasAdminRights(), \\\"!admin\\\");\\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\\n\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n allMarkets[i].registerInSFS();\\n }\\n\\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\\n }\\n}\\n\",\"keccak256\":\"0x91bbdc157e7acfd7fa311d0af3c95886771f700fa03ca1ad86cb8eda56c50c6a\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowVerify(address cToken, address borrower) external;\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n \\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external;\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n \\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x266ec3c26b454cfa72bab45fa8e0bc9e3d44e8ec0cd4770304a14cc84c8f80d3\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/ErrorReporter.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\ncontract ComptrollerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n COMPTROLLER_MISMATCH,\\n INSUFFICIENT_SHORTFALL,\\n INSUFFICIENT_LIQUIDITY,\\n INVALID_CLOSE_FACTOR,\\n INVALID_COLLATERAL_FACTOR,\\n INVALID_LIQUIDATION_INCENTIVE,\\n MARKET_NOT_LISTED,\\n MARKET_ALREADY_LISTED,\\n MATH_ERROR,\\n NONZERO_BORROW_BALANCE,\\n PRICE_ERROR,\\n REJECTION,\\n SNAPSHOT_ERROR,\\n TOO_MANY_ASSETS,\\n TOO_MUCH_REPAY,\\n SUPPLIER_NOT_WHITELISTED,\\n BORROW_BELOW_MIN,\\n SUPPLY_ABOVE_MAX,\\n NONZERO_TOTAL_SUPPLY\\n }\\n\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\\n EXIT_MARKET_BALANCE_OWED,\\n EXIT_MARKET_REJECTION,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\n SET_CLOSE_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_PRICE_ORACLE_OWNER_CHECK,\\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\\n SET_WHITELIST_STATUS_OWNER_CHECK,\\n SUPPORT_MARKET_EXISTS,\\n SUPPORT_MARKET_OWNER_CHECK,\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\n UNSUPPORT_MARKET_OWNER_CHECK,\\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\\n UNSUPPORT_MARKET_IN_USE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return uint256(err);\\n }\\n}\\n\\ncontract TokenErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n BAD_INPUT,\\n COMPTROLLER_REJECTION,\\n COMPTROLLER_CALCULATION_ERROR,\\n INTEREST_RATE_MODEL_ERROR,\\n INVALID_ACCOUNT_PAIR,\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\n INVALID_COLLATERAL_FACTOR,\\n MATH_ERROR,\\n MARKET_NOT_FRESH,\\n MARKET_NOT_LISTED,\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\n TOKEN_INSUFFICIENT_BALANCE,\\n TOKEN_INSUFFICIENT_CASH,\\n TOKEN_TRANSFER_IN_FAILED,\\n TOKEN_TRANSFER_OUT_FAILED,\\n UTILIZATION_ABOVE_MAX\\n }\\n\\n /*\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\n * This is because FailureInfo grows significantly faster, and\\n * the order of Error has some meaning, while the order of FailureInfo\\n * is entirely arbitrary.\\n */\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n BORROW_ACCRUE_INTEREST_FAILED,\\n BORROW_CASH_NOT_AVAILABLE,\\n BORROW_FRESHNESS_CHECK,\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n BORROW_MARKET_NOT_LISTED,\\n BORROW_COMPTROLLER_REJECTION,\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n LIQUIDATE_COMPTROLLER_REJECTION,\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n LIQUIDATE_FRESHNESS_CHECK,\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_ACCRUE_INTEREST_FAILED,\\n MINT_COMPTROLLER_REJECTION,\\n MINT_EXCHANGE_CALCULATION_FAILED,\\n MINT_EXCHANGE_RATE_READ_FAILED,\\n MINT_FRESHNESS_CHECK,\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n MINT_TRANSFER_IN_FAILED,\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\n NEW_UTILIZATION_RATE_ABOVE_MAX,\\n REDEEM_ACCRUE_INTEREST_FAILED,\\n REDEEM_COMPTROLLER_REJECTION,\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\n REDEEM_FRESHNESS_CHECK,\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\\n WITHDRAW_IONIC_FEES_VALIDATION,\\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\\n WITHDRAW_ADMIN_FEES_VALIDATION,\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\n REDUCE_RESERVES_ADMIN_CHECK,\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\n REDUCE_RESERVES_FRESH_CHECK,\\n REDUCE_RESERVES_VALIDATION,\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\n REPAY_BORROW_FRESHNESS_CHECK,\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COMPTROLLER_OWNER_CHECK,\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\\n SET_ADMIN_FEE_ADMIN_CHECK,\\n SET_ADMIN_FEE_FRESH_CHECK,\\n SET_ADMIN_FEE_BOUNDS_CHECK,\\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\\n SET_IONIC_FEE_FRESH_CHECK,\\n SET_IONIC_FEE_BOUNDS_CHECK,\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\n TRANSFER_COMPTROLLER_REJECTION,\\n TRANSFER_NOT_ALLOWED,\\n TRANSFER_NOT_ENOUGH,\\n TRANSFER_TOO_MUCH,\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\n ADD_RESERVES_FRESH_CHECK,\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\\n }\\n\\n /**\\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\\n **/\\n event Failure(uint256 error, uint256 info, uint256 detail);\\n\\n /**\\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\\n */\\n function fail(Error err, FailureInfo info) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), 0);\\n\\n return uint256(err);\\n }\\n\\n /**\\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\\n */\\n function failOpaque(\\n Error err,\\n FailureInfo info,\\n uint256 opaqueError\\n ) internal returns (uint256) {\\n emit Failure(uint256(err), uint256(info), opaqueError);\\n\\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\\n }\\n}\\n\",\"keccak256\":\"0xad342553cda4d7b7e40678c636a406bc2785be2117a29d9b1cb52e747726745e\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x233d26db3755cf0c7bf0bba3a695a742bbfc15fd168fb76bbe307c5ac259b5bf\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x74641db987b6d12c8c412818b8a7708332778736193b2cb127ea54e80b334186\",\"license\":\"UNLICENSED\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60806040526002805461ffff60a01b191661010160a01b17905534801561002557600080fd5b50613f48806100356000396000f3fe608060405234801561001057600080fd5b50600436106103fb5760003560e01c80637515bafa11610215578063be945a6411610125578063d9e0ea6b116100b8578063e875544611610087578063e875544614610986578063ee5b9a2f1461098f578063f851a440146109a2578063f874eb0c146109b5578063fb6243fa146109c857600080fd5b8063d9e0ea6b1461092b578063dce154491461093e578063e6653f3d14610951578063e68065911461096557600080fd5b8063cf6bfd2d116100f4578063cf6bfd2d146108e9578063d01f63f5146108fd578063d219fca714610905578063d251fefc1461091857600080fd5b8063be945a641461089d578063c6c5b0dd146108b0578063c76ae260146108c3578063c91a424f146108d657600080fd5b80638ebf6364116101a8578063ac0b0bb711610177578063ac0b0bb714610841578063b0772d0b14610855578063b09572101461086a578063b103488214610877578063b32538011461088a57600080fd5b80638ebf6364146107cd578063940cd6f1146107e05780639b19251a1461080b578063a5fb48571461082e57600080fd5b8063819605a8116101e4578063819605a81461074d57806387f763031461076057806389f8132e146107745780638e8f294b1461078957600080fd5b80637515bafa1461070c578063783f10961461071f5780637dc0d1d0146107325780637f15e2161461074557600080fd5b80633605b51b1161031057806351a485e4116102a3578063607ef6c111610272578063607ef6c11461068d578063692fd2a9146106a05780636bd02b8a146106b35780636d154ea5146106c6578063731f0c2b146106e957600080fd5b806351a485e41461064157806351c8491d1461065457806352d84d1e146106675780635f5af1aa1461067a57600080fd5b80633c94786f116102df5780633c94786f146105fc5780634a584432146106105780634a76e727146106305780634ada90af1461063857600080fd5b80633605b51b146105b9578063391957d7146105c15780633a72cb5e146105d65780633bcf7ec1146105e957600080fd5b80631c819e4311610393578063267822471161036257806326782247146105425780632ccf47a4146105555780632d70db781461056857806331ff47fa1461057b57806332abcdbe146105a457600080fd5b80631c819e43146104c357806321af4569146104f15780632273f40e1461051c57806324a3d6221461052f57600080fd5b8063109908ce116103cf578063109908ce1461047257806315c3b9b01461048557806316dc15fe1461048d57806318c882a5146104b057600080fd5b80627e3dd21461040057806302c3bcbb1461041d578063088e0fce1461044b5780630a755ec21461045e575b600080fd5b610408600181565b60405190151581526020015b60405180910390f35b61043d61042b3660046136af565b60186020526000908152604090205481565b604051908152602001610414565b6104086104593660046136cc565b6109db565b60025461040890600160a81b900460ff1681565b6104086104803660046136af565b610a14565b600b5461043d565b61040861049b3660046136af565b600d6020526000908152604090205460ff1681565b6104086104be36600461372c565b610c5e565b6104086104d1366004613761565b601d60209081526000928352604080842090915290825290205460ff1681565b601654610504906001600160a01b031681565b6040516001600160a01b039091168152602001610414565b61040861052a366004613761565b610da4565b601354610504906001600160a01b031681565b600254610504906001600160a01b031681565b61043d6105633660046136af565b610dcc565b61040861057636600461379a565b61103e565b6105046105893660046136af565b600e602052600090815260409020546001600160a01b031681565b6105ac611121565b60405161041491906137fa565b6105ac611183565b6105d46105cf3660046136af565b6112eb565b005b61043d6105e43660046136af565b611376565b6104086105f736600461372c565b611457565b60135461040890600160a01b900460ff1681565b61043d61061e3660046136af565b60176020526000908152604090205481565b6105ac61158e565b61043d60055481565b6105d461064f366004613852565b6115ee565b6105d46106623660046138be565b61176d565b610504610675366004613905565b6117df565b61043d6106883660046136af565b611809565b6105d461069b366004613852565b611889565b6104086106ae3660046136af565b6119ff565b6105046106c1366004613905565b611b86565b6104086106d43660046136af565b60156020526000908152604090205460ff1681565b6104086106f73660046136af565b60146020526000908152604090205460ff1681565b61050461071a366004613905565b611b96565b61043d61072d36600461391e565b611ba6565b600354610504906001600160a01b031681565b61043d611e76565b61043d61075b3660046136af565b611fe0565b60135461040890600160b01b900460ff1681565b61077c61230b565b6040516104149190613978565b6107b66107973660046136af565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610414565b6104086107db36600461379a565b612be7565b61043d6107ee366004613761565b601c60209081526000928352604080842090915290825290205481565b6104086108193660046136af565b60106020526000908152604090205460ff1681565b6105d461083c3660046139c6565b612cc1565b60135461040890600160b81b900460ff1681565b61085d612d11565b6040516104149190613a07565b600f546104089060ff1681565b61043d6108853660046136af565b612d71565b610408610898366004613761565b612e10565b6105d46108ab3660046138be565b612e32565b6105046108be366004613905565b612ea0565b6105d46108d1366004613a48565b612eb0565b600054610504906001600160a01b031681565b60025461040890600160a01b900460ff1681565b6105ac612f45565b6105d4610913366004613a48565b612fa5565b610504610926366004613905565b61302d565b6104086109393660046136af565b61303d565b61050461094c366004613aa2565b6130b4565b60135461040890600160a81b900460ff1681565b610978610973366004613ace565b6130ec565b604051610414929190613af0565b61043d60045481565b6105d461099d3660046138be565b61326b565b600154610504906001600160a01b031681565b6104086109c33660046136cc565b6132c9565b61043d6109d63660046136af565b6132fa565b6001600160a01b038084166000908152601e602090815260408083209386168352929052908120610a0c90836133d3565b949350505050565b6000610a1e6133f5565b610a435760405162461bcd60e51b8152600401610a3a90613b09565b60405180910390fd5b6001600160a01b038216610a855760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601954811015610b825760198181548110610aa557610aa5613b29565b6000918252602090912001546001600160a01b0390811690841603610b7a5760198054610ad490600190613b55565b81548110610ae457610ae4613b29565b600091825260209091200154601980546001600160a01b039092169183908110610b1057610b10613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506019805480610b4f57610b4f613b68565b600082815260209020810160001990810180546001600160a01b031916905501905550600192915050565b600101610a88565b5060005b601b54811015610c5557601b8181548110610ba357610ba3613b29565b6000918252602090912001546001600160a01b0390811690841603610c4d57601b8054610bd290600190613b55565b81548110610be257610be2613b29565b600091825260209091200154601b80546001600160a01b039092169183908110610c0e57610c0e613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550601b805480610b4f57610b4f613b68565b600101610b86565b50600092915050565b6001600160a01b03821660009081526008602052604081205460ff16610cb05760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b0316331480610ccc5750610ccc6133f5565b610ce85760405162461bcd60e51b8152600401610a3a90613b7e565b610cf06133f5565b80610cfd57506001821515145b610d195760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260156020908152604091829020805460ff19168615159081179091558251938452606091840182905260069184019190915265426f72726f7760d01b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a0015b60405180910390a150805b92915050565b6001600160a01b03821660009081526020805260408120610dc590836133d3565b9392505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561101c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e729190613ba1565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa158015610ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eef9190613bec565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b03861691610f489190613c71565b600060405180830381855afa9150503d8060008114610f83576040519150601f19603f3d011682016040523d82523d6000602084013e610f88565b606091505b5091509150818015610f9b575080516020145b15610fba5780806020019051810190610fb49190613ca0565b60ff1692505b6040850151610fcc9060000b84613cc3565b925060008312610ff257610fe183600a613dcf565b610feb9087613ddb565b9550611013565b610ffb83613df2565b61100690600a613dcf565b6110109087613e24565b95505b50505050611038565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6013546000906001600160a01b031633148061105d575061105d6133f5565b6110795760405162461bcd60e51b8152600401610a3a90613b7e565b6110816133f5565b8061108e57506001821515145b6110aa5760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b81b0260ff60b81b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600590820152645365697a6560d81b6060820152901515602082015260800190565b60405180910390a15090565b6060600b80548060200260200160405190810160405280929190818152602001828054801561117957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161115b575b5050505050905090565b601b546019546060916000916111999190613e38565b67ffffffffffffffff8111156111b1576111b1613bbe565b6040519080825280602002602001820160405280156111da578160200160208202803683370190505b50905060005b60195460ff821610156112605760198160ff168154811061120357611203613b29565b9060005260206000200160009054906101000a90046001600160a01b0316828260ff168151811061123657611236613b29565b6001600160a01b03909216602092830291909101909101528061125881613e4b565b9150506111e0565b60005b601b5460ff821610156112e357601b8160ff168154811061128657611286613b29565b6000918252602090912001546001600160a01b0316836112a68385613e6a565b60ff16815181106112b9576112b9613b29565b6001600160a01b0390921660209283029190910190910152806112db81613e4b565b915050611263565b509092915050565b6001546001600160a01b031633146113155760405162461bcd60e51b8152600401610a3a90613b09565b601680546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527feda98690e518e9a05f8ec6837663e188211b2da8f4906648b323f2c1d4434e29910160405180910390a15050565b6001600160a01b0381166000908152602160205260408120819061139990613449565b905060005b815181101561145057836001600160a01b03166317bfdfbc8383815181106113c8576113c8613b29565b60200260200101516040518263ffffffff1660e01b81526004016113fb91906001600160a01b0391909116815260200190565b602060405180830381865afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190613e83565b6114469084613e38565b925060010161139e565b5050919050565b6001600160a01b03821660009081526008602052604081205460ff166114a95760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b03163314806114c557506114c56133f5565b6114e15760405162461bcd60e51b8152600401610a3a90613b7e565b6114e96133f5565b806114f657506001821515145b6115125760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260146020908152604091829020805460ff19168615159081179091558251938452606091840182905260049184019190915263135a5b9d60e21b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a001610d93565b60606019805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b6001546001600160a01b031633148061161157506016546001600160a01b031633145b61162d5760405162461bcd60e51b8152600401610a3a90613b09565b8281811580159061163d57508082145b6116725760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061168f5761168f613b29565b90506020020135601860008989858181106116ac576116ac613b29565b90506020020160208101906116c191906136af565b6001600160a01b031681526020810191909152604001600020558686828181106116ed576116ed613b29565b905060200201602081019061170291906136af565b6001600160a01b03167f9e0ad9cee10bdf36b7fbd38910c0bdff0f275ace679b45b922381c2723d676f886868481811061173e5761173e613b29565b9050602002013560405161175491815260200190565b60405180910390a2600101611675565b50505050505050565b6117756133f5565b6117915760405162461bcd60e51b8152600401610a3a90613b09565b80156117be576001600160a01b038316600090815260208052604090206117b89083613456565b50505050565b6001600160a01b038316600090815260208052604090206117b8908361346b565b600981815481106117ef57600080fd5b6000918252602090912001546001600160a01b0316905081565b60006118136133f5565b61182357610d9e60016017613480565b601380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f0613b6ee6a04f0d09f390e4d9318894b9f6ac7fd83897cd8d18896ba579c401e910160405180910390a160009392505050565b6001546001600160a01b03163314806118ac57506016546001600160a01b031633145b6118c85760405162461bcd60e51b8152600401610a3a90613b09565b828181158015906118d857508082145b61190d5760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061192a5761192a613b29565b905060200201356017600089898581811061194757611947613b29565b905060200201602081019061195c91906136af565b6001600160a01b0316815260208101919091526040016000205586868281811061198857611988613b29565b905060200201602081019061199d91906136af565b6001600160a01b03167f6f1951b2aad10f3fc81b86d91105b413a5b3f847a34bbc5ce1904201b14438f68686848181106119d9576119d9613b29565b905060200201356040516119ef91815260200190565b60405180910390a2600101611910565b6000611a096133f5565b611a255760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038216611a675760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601b54811015611ae657601b8181548110611a8757611a87613b29565b6000918252602090912001546001600160a01b0390811690841603611ade5760405162461bcd60e51b815260206004820152600d60248201526c08585b1c9958591e5859191959609a1b6044820152606401610a3a565b600101611a6a565b50601b805460018101825560009182527f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc10180546001600160a01b0319166001600160a01b0385161790555b601954811015610c555760198181548110611b4f57611b4f613b29565b6000918252602090912001546001600160a01b0390811690841603611b7e5760198054610ad490600190613b55565b600101611b32565b601b81815481106117ef57600080fd5b600b81815481106117ef57600080fd5b6000836001600160a01b0316856001600160a01b0316148015611bc7575082155b15611bd457506000610a0c565b6000196001600160a01b03851615611d4e576001600160a01b038086166000908152601d60209081526040808320938a168352929052205460ff168015611c4757506001600160a01b038086166000908152601f60209081526040808320938a16835292905220611c4590846133d3565b155b15611c5457506000611d4e565b6001600160a01b038086166000908152601c60209081526040808320938a16835292905220548015801590611cb557506001600160a01b038087166000908152601e60209081526040808320938b16835292905220611cb390856133d3565b155b15611d4c5760035460405163fc57d4df60e01b81526001600160a01b038881166004830152600092169063fc57d4df90602401602060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d299190613e83565b9050670de0b6b3a7640000611d3e8284613ddb565b611d489190613e24565b9250505b505b6000611d5987610dcc565b9050600081118015611d8957506001600160a01b03871660009081526020805260409020611d8790856133d3565b155b15611e6c5760035460405163fc57d4df60e01b81526001600160a01b038981166004830152600092169063fc57d4df90602401602060405180830381865afa158015611dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dfd9190613e83565b90506000670de0b6b3a7640000611e148385613ddb565b611e1e9190613e24565b6001600160a01b038a16600090815260086020526040902060010154909150670de0b6b3a764000090611e519083613ddb565b611e5b9190613e24565b905083811015611e69578093505b50505b5095945050505050565b6000611e806133f5565b611e9c5760405162461bcd60e51b8152600401610a3a90613b09565b738680ceabcb9b56913c519c069add6bc3494b702060005b600954811015611f5b5760098181548110611ed157611ed1613b29565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b0316637f15e2166040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f529190613e83565b50600101611eb4565b50604051632210724360e11b8152738fba84867ba458e7c6e2c024d2de3d0b5c3ea1c260048201526001600160a01b03821690634420e486906024016020604051808303816000875af1158015611fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fda9190613e83565b91505090565b6000611fea6133f5565b611ffa57610d9e60016018613480565b6001600160a01b03821660009081526008602052604090205460ff1661202657610d9e60086019613480565b6000826001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208a9190613e83565b111561209c57610d9e6014601a613480565b6001600160a01b0382166000908152600860209081526040808320805460ff1916815560010183905560098054825181850281018501909352808352919290919083018282801561211657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120f8575b5050835193945083925060009150505b8281101561217057856001600160a01b031684828151811061214a5761214a613b29565b60200260200101516001600160a01b03160361216857809150612170565b600101612126565b5081811061218057612180613eb2565b6009805461219090600190613b55565b815481106121a0576121a0613b29565b600091825260209091200154600980546001600160a01b0390921691839081106121cc576121cc613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061220b5761220b613b68565b6001900381819060005260206000200160006101000a8154906001600160a01b03021916905590556000600e6000876001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190613ba1565b6001600160a01b039081168252602080830193909352604091820160002080546001600160a01b031916948216949094179093555191871682527f302feb03efd5741df80efe7f97f5d93d74d46a542a3d312d0faae64fa1f3e0e9910160405180910390a1600095945050505050565b60408051602180825261044082019092526060919060009082602082016104208036833701905050905063692fd2a960e01b8161234784613ec8565b93508360ff168151811061235d5761235d613b29565b6001600160e01b031990921660209283029190910190910152631469217960e21b8161238884613ec8565b93508360ff168151811061239e5761239e613b29565b6001600160e01b03199092166020928302919091019091015263607ef6c160e01b816123c984613ec8565b93508360ff16815181106123df576123df613b29565b6001600160e01b03199092166020928302919091019091015263d219fca760e01b8161240a84613ec8565b93508360ff168151811061242057612420613b29565b6001600160e01b03199092166020928302919091019091015263063b571360e51b8161244b84613ec8565b93508360ff168151811061246157612461613b29565b6001600160e01b0319909216602092830291909101909101526351c8491d60e01b8161248c84613ec8565b93508360ff16815181106124a2576124a2613b29565b6001600160e01b031990921660209283029190910190910152632fa5169960e21b816124cd84613ec8565b93508360ff16815181106124e3576124e3613b29565b6001600160e01b03199092166020928302919091019091015263391957d760e01b8161250e84613ec8565b93508360ff168151811061252457612524613b29565b6001600160e01b031990921660209283029190910190910152632fad78d560e11b8161254f84613ec8565b93508360ff168151811061256557612565613b29565b6001600160e01b031990921660209283029190910190910152633bcf7ec160e01b8161259084613ec8565b93508360ff16815181106125a6576125a6613b29565b6001600160e01b0319909216602092830291909101909101526318c882a560e01b816125d184613ec8565b93508360ff16815181106125e7576125e7613b29565b6001600160e01b0319909216602092830291909101909101526323afd8d960e21b8161261284613ec8565b93508360ff168151811061262857612628613b29565b6001600160e01b0319909216602092830291909101909101526305ae1b6f60e31b8161265384613ec8565b93508360ff168151811061266957612669613b29565b6001600160e01b031990921660209283029190910190910152631032c0b560e31b8161269484613ec8565b93508360ff16815181106126aa576126aa613b29565b6001600160e01b03199092166020928302919091019091015263b0772d0b60e01b816126d584613ec8565b93508360ff16815181106126eb576126eb613b29565b6001600160e01b031990921660209283029190910190910152631955e6df60e11b8161271684613ec8565b93508360ff168151811061272c5761272c613b29565b6001600160e01b03199092166020928302919091019091015263015c3b9b60e41b8161275784613ec8565b93508360ff168151811061276d5761276d613b29565b6001600160e01b03199092166020928302919091019091015263e680659160e01b8161279884613ec8565b93508360ff16815181106127ae576127ae613b29565b6001600160e01b03199092166020928302919091019091015263d01f63f560e01b816127d984613ec8565b93508360ff16815181106127ef576127ef613b29565b6001600160e01b031990921660209283029190910190910152633605b51b60e01b8161281a84613ec8565b93508360ff168151811061283057612830613b29565b6001600160e01b03199092166020928302919091019091015263d9e0ea6b60e01b8161285b84613ec8565b93508360ff168151811061287157612871613b29565b6001600160e01b031990921660209283029190910190910152634a76e72760e01b8161289c84613ec8565b93508360ff16815181106128b2576128b2613b29565b6001600160e01b03199092166020928302919091019091015263084c846760e11b816128dd84613ec8565b93508360ff16815181106128f3576128f3613b29565b6001600160e01b03199092166020928302919091019091015263a5fb485760e01b8161291e84613ec8565b93508360ff168151811061293457612934613b29565b6001600160e01b03199092166020928302919091019091015263ee5b9a2f60e01b8161295f84613ec8565b93508360ff168151811061297557612975613b29565b6001600160e01b03199092166020928302919091019091015263044707e760e11b816129a084613ec8565b93508360ff16815181106129b6576129b6613b29565b6001600160e01b031990921660209283029190910190910152633e1d3ac360e21b816129e184613ec8565b93508360ff16815181106129f7576129f7613b29565b6001600160e01b031990921660209283029190910190910152631139fa0760e11b81612a2284613ec8565b93508360ff1681518110612a3857612a38613b29565b6001600160e01b03199092166020928302919091019091015263b325380160e01b81612a6384613ec8565b93508360ff1681518110612a7957612a79613b29565b6001600160e01b031990921660209283029190910190910152637db121fd60e11b81612aa484613ec8565b93508360ff1681518110612aba57612aba613b29565b6001600160e01b031990921660209283029190910190910152631d3965af60e11b81612ae584613ec8565b93508360ff1681518110612afb57612afb613b29565b6001600160e01b031990921660209283029190910190910152633c1f884b60e11b81612b2684613ec8565b93508360ff1681518110612b3c57612b3c613b29565b6001600160e01b031990921660209283029190910190910152633f8af10b60e11b81612b6784613ec8565b93508360ff1681518110612b7d57612b7d613b29565b6001600160e01b03199092166020928302919091019091015260ff821615610d9e5760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610a3a565b6013546000906001600160a01b0316331480612c065750612c066133f5565b612c225760405162461bcd60e51b8152600401610a3a90613b7e565b612c2a6133f5565b80612c3757506001821515145b612c535760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b01b0260ff60b01b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600890820152672a3930b739b332b960c11b6060820152901515602082015260800190565b612cc96133f5565b612ce55760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601c602090815260408083209490951682529290925291902055565b60606009805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215612df3576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b6001600160a01b0382166000908152602160205260408120610dc590836133d3565b612e3a6133f5565b612e565760405162461bcd60e51b8152600401610a3a90613b09565b8015612e7e576001600160a01b03831660009081526021602052604090206117b89083613456565b6001600160a01b03831660009081526021602052604090206117b8908361346b565b601981815481106117ef57600080fd5b612eb86133f5565b612ed45760405162461bcd60e51b8152600401610a3a90613b09565b8015612f0f576001600160a01b038085166000908152601f60209081526040808320938716835292905220612f099083613456565b506117b8565b6001600160a01b038085166000908152601f60209081526040808320938716835292905220612f3e908361346b565b5050505050565b60606011805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b612fad6133f5565b612fc95760405162461bcd60e51b8152600401610a3a90613b09565b8015612ffe576001600160a01b038085166000908152601e60209081526040808320938716835292905220612f099083613456565b6001600160a01b038085166000908152601e60209081526040808320938716835292905220612f3e908361346b565b601181815481106117ef57600080fd5b6000805b600954811015610c555760006009828154811061306057613060613b29565b60009182526020808320909101546001600160a01b03908116808452600883526040808520928916855260029092019092529091205490915060ff16156130ab575060019392505050565b50600101613041565b600760205281600052604060002081815481106130d057600080fd5b6000918252602090912001546001600160a01b03169150829050565b600b5460009060609080830361311657604080516000808252602082019092529250925050613264565b836000036131245761012c93505b8360006131318284613ee5565b905061313d8684613e24565b94508015613168578461314f81613ef9565b955085905061315f886001613e38565b03613168578091505b84613174886001613e38565b111561319457505060408051600081526020810190915291506132649050565b60006131a08789613ddb565b90508267ffffffffffffffff8111156131bb576131bb613bbe565b6040519080825280602002602001820160405280156131e4578160200160208202803683370190505b50945060005b8381101561325e57600b6131fe8383613e38565b8154811061320e5761320e613b29565b9060005260206000200160009054906101000a90046001600160a01b031686828151811061323e5761323e613b29565b6001600160a01b03909216602092830291909101909101526001016131ea565b50505050505b9250929050565b6132736133f5565b61328f5760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601d6020908152604080832094909516825292909252919020805460ff1916911515919091179055565b6001600160a01b038084166000908152601f602090815260408083209386168352929052908120610a0c90836133d3565b6001600160a01b03811660009081526020805260408120819061331c90613449565b905060005b815181101561145057836001600160a01b0316633af9e66983838151811061334b5761334b613b29565b60200260200101516040518263ffffffff1660e01b815260040161337e91906001600160a01b0391909116815260200190565b602060405180830381865afa15801561339b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133bf9190613e83565b6133c99084613e38565b9250600101613321565b6001600160a01b03811660009081526001830160205260408120541515610dc5565b6001546000906001600160a01b03163314801561341b5750600254600160a81b900460ff165b8061344457506000546001600160a01b0316331480156134445750600254600160a01b900460ff165b905090565b60606000610dc5836134f9565b6000610dc5836001600160a01b038416613555565b6000610dc5836001600160a01b0384166135a4565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156134b5576134b5613e9c565b83601a8111156134c7576134c7613e9c565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610dc557610dc5613e9c565b60608160000180548060200260200160405190810160405280929190818152602001828054801561354957602002820191906000526020600020905b815481526020019060010190808311613535575b50505050509050919050565b600081815260018301602052604081205461359c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d9e565b506000610d9e565b6000818152600183016020526040812054801561368d5760006135c8600183613b55565b85549091506000906135dc90600190613b55565b90508181146136415760008660000182815481106135fc576135fc613b29565b906000526020600020015490508087600001848154811061361f5761361f613b29565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061365257613652613b68565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d9e565b6000915050610d9e565b6001600160a01b03811681146136ac57600080fd5b50565b6000602082840312156136c157600080fd5b8135610dc581613697565b6000806000606084860312156136e157600080fd5b83356136ec81613697565b925060208401356136fc81613697565b9150604084013561370c81613697565b809150509250925092565b8035801515811461372757600080fd5b919050565b6000806040838503121561373f57600080fd5b823561374a81613697565b915061375860208401613717565b90509250929050565b6000806040838503121561377457600080fd5b823561377f81613697565b9150602083013561378f81613697565b809150509250929050565b6000602082840312156137ac57600080fd5b610dc582613717565b60008151808452602080850194506020840160005b838110156137ef5781516001600160a01b0316875295820195908201906001016137ca565b509495945050505050565b602081526000610dc560208301846137b5565b60008083601f84011261381f57600080fd5b50813567ffffffffffffffff81111561383757600080fd5b6020830191508360208260051b850101111561326457600080fd5b6000806000806040858703121561386857600080fd5b843567ffffffffffffffff8082111561388057600080fd5b61388c8883890161380d565b909650945060208701359150808211156138a557600080fd5b506138b28782880161380d565b95989497509550505050565b6000806000606084860312156138d357600080fd5b83356138de81613697565b925060208401356138ee81613697565b91506138fc60408501613717565b90509250925092565b60006020828403121561391757600080fd5b5035919050565b6000806000806080858703121561393457600080fd5b843561393f81613697565b9350602085013561394f81613697565b925061395d60408601613717565b9150606085013561396d81613697565b939692955090935050565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160e01b03191683529284019291840191600101613994565b50909695505050505050565b6000806000606084860312156139db57600080fd5b83356139e681613697565b925060208401356139f681613697565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160a01b031683529284019291840191600101613a23565b60008060008060808587031215613a5e57600080fd5b8435613a6981613697565b93506020850135613a7981613697565b92506040850135613a8981613697565b9150613a9760608601613717565b905092959194509250565b60008060408385031215613ab557600080fd5b8235613ac081613697565b946020939093013593505050565b60008060408385031215613ae157600080fd5b50508035926020909101359150565b828152604060208201526000610a0c60408301846137b5565b60208082526006908201526510b0b236b4b760d11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610d9e57610d9e613b3f565b634e487b7160e01b600052603160045260246000fd5b60208082526009908201526810b3bab0b93234b0b760b91b604082015260600190565b600060208284031215613bb357600080fd5b8151610dc581613697565b634e487b7160e01b600052604160045260246000fd5b805167ffffffffffffffff8116811461372757600080fd5b600060608284031215613bfe57600080fd5b6040516060810181811067ffffffffffffffff82111715613c2f57634e487b7160e01b600052604160045260246000fd5b604052613c3b83613bd4565b8152613c4960208401613bd4565b6020820152604083015163ffffffff81168114613c6557600080fd5b60408201529392505050565b6000825160005b81811015613c925760208186018101518583015201613c78565b506000920191825250919050565b600060208284031215613cb257600080fd5b815160ff81168114610dc557600080fd5b8082018281126000831280158216821582161715613ce357613ce3613b3f565b505092915050565b600181815b80851115613d26578160001904821115613d0c57613d0c613b3f565b80851615613d1957918102915b93841c9390800290613cf0565b509250929050565b600082613d3d57506001610d9e565b81613d4a57506000610d9e565b8160018114613d605760028114613d6a57613d86565b6001915050610d9e565b60ff841115613d7b57613d7b613b3f565b50506001821b610d9e565b5060208310610133831016604e8410600b8410161715613da9575081810a610d9e565b613db38383613ceb565b8060001904821115613dc757613dc7613b3f565b029392505050565b6000610dc58383613d2e565b8082028115828204841417610d9e57610d9e613b3f565b6000600160ff1b8201613e0757613e07613b3f565b5060000390565b634e487b7160e01b600052601260045260246000fd5b600082613e3357613e33613e0e565b500490565b80820180821115610d9e57610d9e613b3f565b600060ff821660ff8103613e6157613e61613b3f565b60010192915050565b60ff8181168382160190811115610d9e57610d9e613b3f565b600060208284031215613e9557600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b600060ff821680613edb57613edb613b3f565b6000190192915050565b600082613ef457613ef4613e0e565b500690565b600060018201613f0b57613f0b613b3f565b506001019056fea26469706673582212207cbda4348031c590e5539d55a93cef1577703e5383fb879ebc5fea01cb6d4cd064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106103fb5760003560e01c80637515bafa11610215578063be945a6411610125578063d9e0ea6b116100b8578063e875544611610087578063e875544614610986578063ee5b9a2f1461098f578063f851a440146109a2578063f874eb0c146109b5578063fb6243fa146109c857600080fd5b8063d9e0ea6b1461092b578063dce154491461093e578063e6653f3d14610951578063e68065911461096557600080fd5b8063cf6bfd2d116100f4578063cf6bfd2d146108e9578063d01f63f5146108fd578063d219fca714610905578063d251fefc1461091857600080fd5b8063be945a641461089d578063c6c5b0dd146108b0578063c76ae260146108c3578063c91a424f146108d657600080fd5b80638ebf6364116101a8578063ac0b0bb711610177578063ac0b0bb714610841578063b0772d0b14610855578063b09572101461086a578063b103488214610877578063b32538011461088a57600080fd5b80638ebf6364146107cd578063940cd6f1146107e05780639b19251a1461080b578063a5fb48571461082e57600080fd5b8063819605a8116101e4578063819605a81461074d57806387f763031461076057806389f8132e146107745780638e8f294b1461078957600080fd5b80637515bafa1461070c578063783f10961461071f5780637dc0d1d0146107325780637f15e2161461074557600080fd5b80633605b51b1161031057806351a485e4116102a3578063607ef6c111610272578063607ef6c11461068d578063692fd2a9146106a05780636bd02b8a146106b35780636d154ea5146106c6578063731f0c2b146106e957600080fd5b806351a485e41461064157806351c8491d1461065457806352d84d1e146106675780635f5af1aa1461067a57600080fd5b80633c94786f116102df5780633c94786f146105fc5780634a584432146106105780634a76e727146106305780634ada90af1461063857600080fd5b80633605b51b146105b9578063391957d7146105c15780633a72cb5e146105d65780633bcf7ec1146105e957600080fd5b80631c819e4311610393578063267822471161036257806326782247146105425780632ccf47a4146105555780632d70db781461056857806331ff47fa1461057b57806332abcdbe146105a457600080fd5b80631c819e43146104c357806321af4569146104f15780632273f40e1461051c57806324a3d6221461052f57600080fd5b8063109908ce116103cf578063109908ce1461047257806315c3b9b01461048557806316dc15fe1461048d57806318c882a5146104b057600080fd5b80627e3dd21461040057806302c3bcbb1461041d578063088e0fce1461044b5780630a755ec21461045e575b600080fd5b610408600181565b60405190151581526020015b60405180910390f35b61043d61042b3660046136af565b60186020526000908152604090205481565b604051908152602001610414565b6104086104593660046136cc565b6109db565b60025461040890600160a81b900460ff1681565b6104086104803660046136af565b610a14565b600b5461043d565b61040861049b3660046136af565b600d6020526000908152604090205460ff1681565b6104086104be36600461372c565b610c5e565b6104086104d1366004613761565b601d60209081526000928352604080842090915290825290205460ff1681565b601654610504906001600160a01b031681565b6040516001600160a01b039091168152602001610414565b61040861052a366004613761565b610da4565b601354610504906001600160a01b031681565b600254610504906001600160a01b031681565b61043d6105633660046136af565b610dcc565b61040861057636600461379a565b61103e565b6105046105893660046136af565b600e602052600090815260409020546001600160a01b031681565b6105ac611121565b60405161041491906137fa565b6105ac611183565b6105d46105cf3660046136af565b6112eb565b005b61043d6105e43660046136af565b611376565b6104086105f736600461372c565b611457565b60135461040890600160a01b900460ff1681565b61043d61061e3660046136af565b60176020526000908152604090205481565b6105ac61158e565b61043d60055481565b6105d461064f366004613852565b6115ee565b6105d46106623660046138be565b61176d565b610504610675366004613905565b6117df565b61043d6106883660046136af565b611809565b6105d461069b366004613852565b611889565b6104086106ae3660046136af565b6119ff565b6105046106c1366004613905565b611b86565b6104086106d43660046136af565b60156020526000908152604090205460ff1681565b6104086106f73660046136af565b60146020526000908152604090205460ff1681565b61050461071a366004613905565b611b96565b61043d61072d36600461391e565b611ba6565b600354610504906001600160a01b031681565b61043d611e76565b61043d61075b3660046136af565b611fe0565b60135461040890600160b01b900460ff1681565b61077c61230b565b6040516104149190613978565b6107b66107973660046136af565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610414565b6104086107db36600461379a565b612be7565b61043d6107ee366004613761565b601c60209081526000928352604080842090915290825290205481565b6104086108193660046136af565b60106020526000908152604090205460ff1681565b6105d461083c3660046139c6565b612cc1565b60135461040890600160b81b900460ff1681565b61085d612d11565b6040516104149190613a07565b600f546104089060ff1681565b61043d6108853660046136af565b612d71565b610408610898366004613761565b612e10565b6105d46108ab3660046138be565b612e32565b6105046108be366004613905565b612ea0565b6105d46108d1366004613a48565b612eb0565b600054610504906001600160a01b031681565b60025461040890600160a01b900460ff1681565b6105ac612f45565b6105d4610913366004613a48565b612fa5565b610504610926366004613905565b61302d565b6104086109393660046136af565b61303d565b61050461094c366004613aa2565b6130b4565b60135461040890600160a81b900460ff1681565b610978610973366004613ace565b6130ec565b604051610414929190613af0565b61043d60045481565b6105d461099d3660046138be565b61326b565b600154610504906001600160a01b031681565b6104086109c33660046136cc565b6132c9565b61043d6109d63660046136af565b6132fa565b6001600160a01b038084166000908152601e602090815260408083209386168352929052908120610a0c90836133d3565b949350505050565b6000610a1e6133f5565b610a435760405162461bcd60e51b8152600401610a3a90613b09565b60405180910390fd5b6001600160a01b038216610a855760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601954811015610b825760198181548110610aa557610aa5613b29565b6000918252602090912001546001600160a01b0390811690841603610b7a5760198054610ad490600190613b55565b81548110610ae457610ae4613b29565b600091825260209091200154601980546001600160a01b039092169183908110610b1057610b10613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506019805480610b4f57610b4f613b68565b600082815260209020810160001990810180546001600160a01b031916905501905550600192915050565b600101610a88565b5060005b601b54811015610c5557601b8181548110610ba357610ba3613b29565b6000918252602090912001546001600160a01b0390811690841603610c4d57601b8054610bd290600190613b55565b81548110610be257610be2613b29565b600091825260209091200154601b80546001600160a01b039092169183908110610c0e57610c0e613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550601b805480610b4f57610b4f613b68565b600101610b86565b50600092915050565b6001600160a01b03821660009081526008602052604081205460ff16610cb05760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b0316331480610ccc5750610ccc6133f5565b610ce85760405162461bcd60e51b8152600401610a3a90613b7e565b610cf06133f5565b80610cfd57506001821515145b610d195760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260156020908152604091829020805460ff19168615159081179091558251938452606091840182905260069184019190915265426f72726f7760d01b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a0015b60405180910390a150805b92915050565b6001600160a01b03821660009081526020805260408120610dc590836133d3565b9392505050565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561101c576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e729190613ba1565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa158015610ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eef9190613bec565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b03861691610f489190613c71565b600060405180830381855afa9150503d8060008114610f83576040519150601f19603f3d011682016040523d82523d6000602084013e610f88565b606091505b5091509150818015610f9b575080516020145b15610fba5780806020019051810190610fb49190613ca0565b60ff1692505b6040850151610fcc9060000b84613cc3565b925060008312610ff257610fe183600a613dcf565b610feb9087613ddb565b9550611013565b610ffb83613df2565b61100690600a613dcf565b6110109087613e24565b95505b50505050611038565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6013546000906001600160a01b031633148061105d575061105d6133f5565b6110795760405162461bcd60e51b8152600401610a3a90613b7e565b6110816133f5565b8061108e57506001821515145b6110aa5760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b81b0260ff60b81b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600590820152645365697a6560d81b6060820152901515602082015260800190565b60405180910390a15090565b6060600b80548060200260200160405190810160405280929190818152602001828054801561117957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161115b575b5050505050905090565b601b546019546060916000916111999190613e38565b67ffffffffffffffff8111156111b1576111b1613bbe565b6040519080825280602002602001820160405280156111da578160200160208202803683370190505b50905060005b60195460ff821610156112605760198160ff168154811061120357611203613b29565b9060005260206000200160009054906101000a90046001600160a01b0316828260ff168151811061123657611236613b29565b6001600160a01b03909216602092830291909101909101528061125881613e4b565b9150506111e0565b60005b601b5460ff821610156112e357601b8160ff168154811061128657611286613b29565b6000918252602090912001546001600160a01b0316836112a68385613e6a565b60ff16815181106112b9576112b9613b29565b6001600160a01b0390921660209283029190910190910152806112db81613e4b565b915050611263565b509092915050565b6001546001600160a01b031633146113155760405162461bcd60e51b8152600401610a3a90613b09565b601680546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527feda98690e518e9a05f8ec6837663e188211b2da8f4906648b323f2c1d4434e29910160405180910390a15050565b6001600160a01b0381166000908152602160205260408120819061139990613449565b905060005b815181101561145057836001600160a01b03166317bfdfbc8383815181106113c8576113c8613b29565b60200260200101516040518263ffffffff1660e01b81526004016113fb91906001600160a01b0391909116815260200190565b602060405180830381865afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190613e83565b6114469084613e38565b925060010161139e565b5050919050565b6001600160a01b03821660009081526008602052604081205460ff166114a95760405162461bcd60e51b8152602060048201526007602482015266085b585c9ad95d60ca1b6044820152606401610a3a565b6013546001600160a01b03163314806114c557506114c56133f5565b6114e15760405162461bcd60e51b8152600401610a3a90613b7e565b6114e96133f5565b806114f657506001821515145b6115125760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038316600081815260146020908152604091829020805460ff19168615159081179091558251938452606091840182905260049184019190915263135a5b9d60e21b6080840152908201527f4ab2c577b7459254dd330a38beef1d66ae70ba1ab28db7147d52d3a752a03cdc9060a001610d93565b60606019805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b6001546001600160a01b031633148061161157506016546001600160a01b031633145b61162d5760405162461bcd60e51b8152600401610a3a90613b09565b8281811580159061163d57508082145b6116725760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061168f5761168f613b29565b90506020020135601860008989858181106116ac576116ac613b29565b90506020020160208101906116c191906136af565b6001600160a01b031681526020810191909152604001600020558686828181106116ed576116ed613b29565b905060200201602081019061170291906136af565b6001600160a01b03167f9e0ad9cee10bdf36b7fbd38910c0bdff0f275ace679b45b922381c2723d676f886868481811061173e5761173e613b29565b9050602002013560405161175491815260200190565b60405180910390a2600101611675565b50505050505050565b6117756133f5565b6117915760405162461bcd60e51b8152600401610a3a90613b09565b80156117be576001600160a01b038316600090815260208052604090206117b89083613456565b50505050565b6001600160a01b038316600090815260208052604090206117b8908361346b565b600981815481106117ef57600080fd5b6000918252602090912001546001600160a01b0316905081565b60006118136133f5565b61182357610d9e60016017613480565b601380546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f0613b6ee6a04f0d09f390e4d9318894b9f6ac7fd83897cd8d18896ba579c401e910160405180910390a160009392505050565b6001546001600160a01b03163314806118ac57506016546001600160a01b031633145b6118c85760405162461bcd60e51b8152600401610a3a90613b09565b828181158015906118d857508082145b61190d5760405162461bcd60e51b8152602060048201526006602482015265085a5b9c1d5d60d21b6044820152606401610a3a565b60005b828110156117645784848281811061192a5761192a613b29565b905060200201356017600089898581811061194757611947613b29565b905060200201602081019061195c91906136af565b6001600160a01b0316815260208101919091526040016000205586868281811061198857611988613b29565b905060200201602081019061199d91906136af565b6001600160a01b03167f6f1951b2aad10f3fc81b86d91105b413a5b3f847a34bbc5ce1904201b14438f68686848181106119d9576119d9613b29565b905060200201356040516119ef91815260200190565b60405180910390a2600101611910565b6000611a096133f5565b611a255760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b038216611a675760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b6044820152606401610a3a565b60005b601b54811015611ae657601b8181548110611a8757611a87613b29565b6000918252602090912001546001600160a01b0390811690841603611ade5760405162461bcd60e51b815260206004820152600d60248201526c08585b1c9958591e5859191959609a1b6044820152606401610a3a565b600101611a6a565b50601b805460018101825560009182527f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc10180546001600160a01b0319166001600160a01b0385161790555b601954811015610c555760198181548110611b4f57611b4f613b29565b6000918252602090912001546001600160a01b0390811690841603611b7e5760198054610ad490600190613b55565b600101611b32565b601b81815481106117ef57600080fd5b600b81815481106117ef57600080fd5b6000836001600160a01b0316856001600160a01b0316148015611bc7575082155b15611bd457506000610a0c565b6000196001600160a01b03851615611d4e576001600160a01b038086166000908152601d60209081526040808320938a168352929052205460ff168015611c4757506001600160a01b038086166000908152601f60209081526040808320938a16835292905220611c4590846133d3565b155b15611c5457506000611d4e565b6001600160a01b038086166000908152601c60209081526040808320938a16835292905220548015801590611cb557506001600160a01b038087166000908152601e60209081526040808320938b16835292905220611cb390856133d3565b155b15611d4c5760035460405163fc57d4df60e01b81526001600160a01b038881166004830152600092169063fc57d4df90602401602060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d299190613e83565b9050670de0b6b3a7640000611d3e8284613ddb565b611d489190613e24565b9250505b505b6000611d5987610dcc565b9050600081118015611d8957506001600160a01b03871660009081526020805260409020611d8790856133d3565b155b15611e6c5760035460405163fc57d4df60e01b81526001600160a01b038981166004830152600092169063fc57d4df90602401602060405180830381865afa158015611dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dfd9190613e83565b90506000670de0b6b3a7640000611e148385613ddb565b611e1e9190613e24565b6001600160a01b038a16600090815260086020526040902060010154909150670de0b6b3a764000090611e519083613ddb565b611e5b9190613e24565b905083811015611e69578093505b50505b5095945050505050565b6000611e806133f5565b611e9c5760405162461bcd60e51b8152600401610a3a90613b09565b738680ceabcb9b56913c519c069add6bc3494b702060005b600954811015611f5b5760098181548110611ed157611ed1613b29565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b0316637f15e2166040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f529190613e83565b50600101611eb4565b50604051632210724360e11b8152738fba84867ba458e7c6e2c024d2de3d0b5c3ea1c260048201526001600160a01b03821690634420e486906024016020604051808303816000875af1158015611fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fda9190613e83565b91505090565b6000611fea6133f5565b611ffa57610d9e60016018613480565b6001600160a01b03821660009081526008602052604090205460ff1661202657610d9e60086019613480565b6000826001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208a9190613e83565b111561209c57610d9e6014601a613480565b6001600160a01b0382166000908152600860209081526040808320805460ff1916815560010183905560098054825181850281018501909352808352919290919083018282801561211657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120f8575b5050835193945083925060009150505b8281101561217057856001600160a01b031684828151811061214a5761214a613b29565b60200260200101516001600160a01b03160361216857809150612170565b600101612126565b5081811061218057612180613eb2565b6009805461219090600190613b55565b815481106121a0576121a0613b29565b600091825260209091200154600980546001600160a01b0390921691839081106121cc576121cc613b29565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061220b5761220b613b68565b6001900381819060005260206000200160006101000a8154906001600160a01b03021916905590556000600e6000876001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190613ba1565b6001600160a01b039081168252602080830193909352604091820160002080546001600160a01b031916948216949094179093555191871682527f302feb03efd5741df80efe7f97f5d93d74d46a542a3d312d0faae64fa1f3e0e9910160405180910390a1600095945050505050565b60408051602180825261044082019092526060919060009082602082016104208036833701905050905063692fd2a960e01b8161234784613ec8565b93508360ff168151811061235d5761235d613b29565b6001600160e01b031990921660209283029190910190910152631469217960e21b8161238884613ec8565b93508360ff168151811061239e5761239e613b29565b6001600160e01b03199092166020928302919091019091015263607ef6c160e01b816123c984613ec8565b93508360ff16815181106123df576123df613b29565b6001600160e01b03199092166020928302919091019091015263d219fca760e01b8161240a84613ec8565b93508360ff168151811061242057612420613b29565b6001600160e01b03199092166020928302919091019091015263063b571360e51b8161244b84613ec8565b93508360ff168151811061246157612461613b29565b6001600160e01b0319909216602092830291909101909101526351c8491d60e01b8161248c84613ec8565b93508360ff16815181106124a2576124a2613b29565b6001600160e01b031990921660209283029190910190910152632fa5169960e21b816124cd84613ec8565b93508360ff16815181106124e3576124e3613b29565b6001600160e01b03199092166020928302919091019091015263391957d760e01b8161250e84613ec8565b93508360ff168151811061252457612524613b29565b6001600160e01b031990921660209283029190910190910152632fad78d560e11b8161254f84613ec8565b93508360ff168151811061256557612565613b29565b6001600160e01b031990921660209283029190910190910152633bcf7ec160e01b8161259084613ec8565b93508360ff16815181106125a6576125a6613b29565b6001600160e01b0319909216602092830291909101909101526318c882a560e01b816125d184613ec8565b93508360ff16815181106125e7576125e7613b29565b6001600160e01b0319909216602092830291909101909101526323afd8d960e21b8161261284613ec8565b93508360ff168151811061262857612628613b29565b6001600160e01b0319909216602092830291909101909101526305ae1b6f60e31b8161265384613ec8565b93508360ff168151811061266957612669613b29565b6001600160e01b031990921660209283029190910190910152631032c0b560e31b8161269484613ec8565b93508360ff16815181106126aa576126aa613b29565b6001600160e01b03199092166020928302919091019091015263b0772d0b60e01b816126d584613ec8565b93508360ff16815181106126eb576126eb613b29565b6001600160e01b031990921660209283029190910190910152631955e6df60e11b8161271684613ec8565b93508360ff168151811061272c5761272c613b29565b6001600160e01b03199092166020928302919091019091015263015c3b9b60e41b8161275784613ec8565b93508360ff168151811061276d5761276d613b29565b6001600160e01b03199092166020928302919091019091015263e680659160e01b8161279884613ec8565b93508360ff16815181106127ae576127ae613b29565b6001600160e01b03199092166020928302919091019091015263d01f63f560e01b816127d984613ec8565b93508360ff16815181106127ef576127ef613b29565b6001600160e01b031990921660209283029190910190910152633605b51b60e01b8161281a84613ec8565b93508360ff168151811061283057612830613b29565b6001600160e01b03199092166020928302919091019091015263d9e0ea6b60e01b8161285b84613ec8565b93508360ff168151811061287157612871613b29565b6001600160e01b031990921660209283029190910190910152634a76e72760e01b8161289c84613ec8565b93508360ff16815181106128b2576128b2613b29565b6001600160e01b03199092166020928302919091019091015263084c846760e11b816128dd84613ec8565b93508360ff16815181106128f3576128f3613b29565b6001600160e01b03199092166020928302919091019091015263a5fb485760e01b8161291e84613ec8565b93508360ff168151811061293457612934613b29565b6001600160e01b03199092166020928302919091019091015263ee5b9a2f60e01b8161295f84613ec8565b93508360ff168151811061297557612975613b29565b6001600160e01b03199092166020928302919091019091015263044707e760e11b816129a084613ec8565b93508360ff16815181106129b6576129b6613b29565b6001600160e01b031990921660209283029190910190910152633e1d3ac360e21b816129e184613ec8565b93508360ff16815181106129f7576129f7613b29565b6001600160e01b031990921660209283029190910190910152631139fa0760e11b81612a2284613ec8565b93508360ff1681518110612a3857612a38613b29565b6001600160e01b03199092166020928302919091019091015263b325380160e01b81612a6384613ec8565b93508360ff1681518110612a7957612a79613b29565b6001600160e01b031990921660209283029190910190910152637db121fd60e11b81612aa484613ec8565b93508360ff1681518110612aba57612aba613b29565b6001600160e01b031990921660209283029190910190910152631d3965af60e11b81612ae584613ec8565b93508360ff1681518110612afb57612afb613b29565b6001600160e01b031990921660209283029190910190910152633c1f884b60e11b81612b2684613ec8565b93508360ff1681518110612b3c57612b3c613b29565b6001600160e01b031990921660209283029190910190910152633f8af10b60e11b81612b6784613ec8565b93508360ff1681518110612b7d57612b7d613b29565b6001600160e01b03199092166020928302919091019091015260ff821615610d9e5760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610a3a565b6013546000906001600160a01b0316331480612c065750612c066133f5565b612c225760405162461bcd60e51b8152600401610a3a90613b7e565b612c2a6133f5565b80612c3757506001821515145b612c535760405162461bcd60e51b8152600401610a3a90613b09565b60138054831515600160b01b0260ff60b01b199091161790556040517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de0906111159084906040808252600890820152672a3930b739b332b960c11b6060820152901515602082015260800190565b612cc96133f5565b612ce55760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601c602090815260408083209490951682529290925291902055565b60606009805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215612df3576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e4e573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b6001600160a01b0382166000908152602160205260408120610dc590836133d3565b612e3a6133f5565b612e565760405162461bcd60e51b8152600401610a3a90613b09565b8015612e7e576001600160a01b03831660009081526021602052604090206117b89083613456565b6001600160a01b03831660009081526021602052604090206117b8908361346b565b601981815481106117ef57600080fd5b612eb86133f5565b612ed45760405162461bcd60e51b8152600401610a3a90613b09565b8015612f0f576001600160a01b038085166000908152601f60209081526040808320938716835292905220612f099083613456565b506117b8565b6001600160a01b038085166000908152601f60209081526040808320938716835292905220612f3e908361346b565b5050505050565b60606011805480602002602001604051908101604052809291908181526020018280548015611179576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161115b575050505050905090565b612fad6133f5565b612fc95760405162461bcd60e51b8152600401610a3a90613b09565b8015612ffe576001600160a01b038085166000908152601e60209081526040808320938716835292905220612f099083613456565b6001600160a01b038085166000908152601e60209081526040808320938716835292905220612f3e908361346b565b601181815481106117ef57600080fd5b6000805b600954811015610c555760006009828154811061306057613060613b29565b60009182526020808320909101546001600160a01b03908116808452600883526040808520928916855260029092019092529091205490915060ff16156130ab575060019392505050565b50600101613041565b600760205281600052604060002081815481106130d057600080fd5b6000918252602090912001546001600160a01b03169150829050565b600b5460009060609080830361311657604080516000808252602082019092529250925050613264565b836000036131245761012c93505b8360006131318284613ee5565b905061313d8684613e24565b94508015613168578461314f81613ef9565b955085905061315f886001613e38565b03613168578091505b84613174886001613e38565b111561319457505060408051600081526020810190915291506132649050565b60006131a08789613ddb565b90508267ffffffffffffffff8111156131bb576131bb613bbe565b6040519080825280602002602001820160405280156131e4578160200160208202803683370190505b50945060005b8381101561325e57600b6131fe8383613e38565b8154811061320e5761320e613b29565b9060005260206000200160009054906101000a90046001600160a01b031686828151811061323e5761323e613b29565b6001600160a01b03909216602092830291909101909101526001016131ea565b50505050505b9250929050565b6132736133f5565b61328f5760405162461bcd60e51b8152600401610a3a90613b09565b6001600160a01b039283166000908152601d6020908152604080832094909516825292909252919020805460ff1916911515919091179055565b6001600160a01b038084166000908152601f602090815260408083209386168352929052908120610a0c90836133d3565b6001600160a01b03811660009081526020805260408120819061331c90613449565b905060005b815181101561145057836001600160a01b0316633af9e66983838151811061334b5761334b613b29565b60200260200101516040518263ffffffff1660e01b815260040161337e91906001600160a01b0391909116815260200190565b602060405180830381865afa15801561339b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133bf9190613e83565b6133c99084613e38565b9250600101613321565b6001600160a01b03811660009081526001830160205260408120541515610dc5565b6001546000906001600160a01b03163314801561341b5750600254600160a81b900460ff165b8061344457506000546001600160a01b0316331480156134445750600254600160a01b900460ff165b905090565b60606000610dc5836134f9565b6000610dc5836001600160a01b038416613555565b6000610dc5836001600160a01b0384166135a4565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360148111156134b5576134b5613e9c565b83601a8111156134c7576134c7613e9c565b60408051928352602083019190915260009082015260600160405180910390a1826014811115610dc557610dc5613e9c565b60608160000180548060200260200160405190810160405280929190818152602001828054801561354957602002820191906000526020600020905b815481526020019060010190808311613535575b50505050509050919050565b600081815260018301602052604081205461359c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d9e565b506000610d9e565b6000818152600183016020526040812054801561368d5760006135c8600183613b55565b85549091506000906135dc90600190613b55565b90508181146136415760008660000182815481106135fc576135fc613b29565b906000526020600020015490508087600001848154811061361f5761361f613b29565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061365257613652613b68565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d9e565b6000915050610d9e565b6001600160a01b03811681146136ac57600080fd5b50565b6000602082840312156136c157600080fd5b8135610dc581613697565b6000806000606084860312156136e157600080fd5b83356136ec81613697565b925060208401356136fc81613697565b9150604084013561370c81613697565b809150509250925092565b8035801515811461372757600080fd5b919050565b6000806040838503121561373f57600080fd5b823561374a81613697565b915061375860208401613717565b90509250929050565b6000806040838503121561377457600080fd5b823561377f81613697565b9150602083013561378f81613697565b809150509250929050565b6000602082840312156137ac57600080fd5b610dc582613717565b60008151808452602080850194506020840160005b838110156137ef5781516001600160a01b0316875295820195908201906001016137ca565b509495945050505050565b602081526000610dc560208301846137b5565b60008083601f84011261381f57600080fd5b50813567ffffffffffffffff81111561383757600080fd5b6020830191508360208260051b850101111561326457600080fd5b6000806000806040858703121561386857600080fd5b843567ffffffffffffffff8082111561388057600080fd5b61388c8883890161380d565b909650945060208701359150808211156138a557600080fd5b506138b28782880161380d565b95989497509550505050565b6000806000606084860312156138d357600080fd5b83356138de81613697565b925060208401356138ee81613697565b91506138fc60408501613717565b90509250925092565b60006020828403121561391757600080fd5b5035919050565b6000806000806080858703121561393457600080fd5b843561393f81613697565b9350602085013561394f81613697565b925061395d60408601613717565b9150606085013561396d81613697565b939692955090935050565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160e01b03191683529284019291840191600101613994565b50909695505050505050565b6000806000606084860312156139db57600080fd5b83356139e681613697565b925060208401356139f681613697565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b818110156139ba5783516001600160a01b031683529284019291840191600101613a23565b60008060008060808587031215613a5e57600080fd5b8435613a6981613697565b93506020850135613a7981613697565b92506040850135613a8981613697565b9150613a9760608601613717565b905092959194509250565b60008060408385031215613ab557600080fd5b8235613ac081613697565b946020939093013593505050565b60008060408385031215613ae157600080fd5b50508035926020909101359150565b828152604060208201526000610a0c60408301846137b5565b60208082526006908201526510b0b236b4b760d11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610d9e57610d9e613b3f565b634e487b7160e01b600052603160045260246000fd5b60208082526009908201526810b3bab0b93234b0b760b91b604082015260600190565b600060208284031215613bb357600080fd5b8151610dc581613697565b634e487b7160e01b600052604160045260246000fd5b805167ffffffffffffffff8116811461372757600080fd5b600060608284031215613bfe57600080fd5b6040516060810181811067ffffffffffffffff82111715613c2f57634e487b7160e01b600052604160045260246000fd5b604052613c3b83613bd4565b8152613c4960208401613bd4565b6020820152604083015163ffffffff81168114613c6557600080fd5b60408201529392505050565b6000825160005b81811015613c925760208186018101518583015201613c78565b506000920191825250919050565b600060208284031215613cb257600080fd5b815160ff81168114610dc557600080fd5b8082018281126000831280158216821582161715613ce357613ce3613b3f565b505092915050565b600181815b80851115613d26578160001904821115613d0c57613d0c613b3f565b80851615613d1957918102915b93841c9390800290613cf0565b509250929050565b600082613d3d57506001610d9e565b81613d4a57506000610d9e565b8160018114613d605760028114613d6a57613d86565b6001915050610d9e565b60ff841115613d7b57613d7b613b3f565b50506001821b610d9e565b5060208310610133831016604e8410600b8410161715613da9575081810a610d9e565b613db38383613ceb565b8060001904821115613dc757613dc7613b3f565b029392505050565b6000610dc58383613d2e565b8082028115828204841417610d9e57610d9e613b3f565b6000600160ff1b8201613e0757613e07613b3f565b5060000390565b634e487b7160e01b600052601260045260246000fd5b600082613e3357613e33613e0e565b500490565b80820180821115610d9e57610d9e613b3f565b600060ff821660ff8103613e6157613e61613b3f565b60010192915050565b60ff8181168382160190811115610d9e57610d9e613b3f565b600060208284031215613e9557600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b600060ff821680613edb57613edb613b3f565b6000190192915050565b600082613ef457613ef4613e0e565b500690565b600060018201613f0b57613f0b613b3f565b506001019056fea26469706673582212207cbda4348031c590e5539d55a93cef1577703e5383fb879ebc5fea01cb6d4cd064736f6c63430008160033", "devdoc": { "events": { "Failure(uint256,uint256,uint256)": { @@ -1670,7 +1670,7 @@ "storageLayout": { "storage": [ { - "astId": 34213, + "astId": 35919, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "ionicAdmin", "offset": 0, @@ -1678,7 +1678,7 @@ "type": "t_address_payable" }, { - "astId": 34216, + "astId": 35922, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "admin", "offset": 0, @@ -1686,7 +1686,7 @@ "type": "t_address" }, { - "astId": 34219, + "astId": 35925, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "pendingAdmin", "offset": 0, @@ -1694,7 +1694,7 @@ "type": "t_address" }, { - "astId": 34223, + "astId": 35929, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "ionicAdminHasRights", "offset": 20, @@ -1702,7 +1702,7 @@ "type": "t_bool" }, { - "astId": 34227, + "astId": 35933, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "adminHasRights", "offset": 21, @@ -1710,15 +1710,15 @@ "type": "t_bool" }, { - "astId": 34260, + "astId": 35966, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "oracle", "offset": 0, "slot": "3", - "type": "t_contract(BasePriceOracle)61817" + "type": "t_contract(BasePriceOracle)66819" }, { - "astId": 34263, + "astId": 35969, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "closeFactorMantissa", "offset": 0, @@ -1726,7 +1726,7 @@ "type": "t_uint256" }, { - "astId": 34266, + "astId": 35972, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "liquidationIncentiveMantissa", "offset": 0, @@ -1734,7 +1734,7 @@ "type": "t_uint256" }, { - "astId": 34268, + "astId": 35974, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "maxAssets", "offset": 0, @@ -1742,31 +1742,31 @@ "type": "t_uint256" }, { - "astId": 34275, + "astId": 35981, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "accountAssets", "offset": 0, "slot": "7", - "type": "t_mapping(t_address,t_array(t_contract(ICErc20)26625)dyn_storage)" + "type": "t_mapping(t_address,t_array(t_contract(ICErc20)28192)dyn_storage)" }, { - "astId": 34293, + "astId": 35999, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "markets", "offset": 0, "slot": "8", - "type": "t_mapping(t_address,t_struct(Market)34287_storage)" + "type": "t_mapping(t_address,t_struct(Market)35993_storage)" }, { - "astId": 34298, + "astId": 36004, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "allMarkets", "offset": 0, "slot": "9", - "type": "t_array(t_contract(ICErc20)26625)dyn_storage" + "type": "t_array(t_contract(ICErc20)28192)dyn_storage" }, { - "astId": 34303, + "astId": 36009, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowers", "offset": 0, @@ -1774,7 +1774,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34307, + "astId": 36013, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "allBorrowers", "offset": 0, @@ -1782,7 +1782,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34311, + "astId": 36017, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowerIndexes", "offset": 0, @@ -1790,7 +1790,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34316, + "astId": 36022, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "suppliers", "offset": 0, @@ -1798,15 +1798,15 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34322, + "astId": 36028, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "cTokensByUnderlying", "offset": 0, "slot": "14", - "type": "t_mapping(t_address,t_contract(ICErc20)26625)" + "type": "t_mapping(t_address,t_contract(ICErc20)28192)" }, { - "astId": 34325, + "astId": 36031, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "enforceWhitelist", "offset": 0, @@ -1814,7 +1814,7 @@ "type": "t_bool" }, { - "astId": 34330, + "astId": 36036, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "whitelist", "offset": 0, @@ -1822,7 +1822,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34334, + "astId": 36040, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "whitelistArray", "offset": 0, @@ -1830,7 +1830,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34338, + "astId": 36044, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "whitelistIndexes", "offset": 0, @@ -1838,7 +1838,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34341, + "astId": 36047, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "pauseGuardian", "offset": 0, @@ -1846,7 +1846,7 @@ "type": "t_address" }, { - "astId": 34343, + "astId": 36049, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_mintGuardianPaused", "offset": 20, @@ -1854,7 +1854,7 @@ "type": "t_bool" }, { - "astId": 34345, + "astId": 36051, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_borrowGuardianPaused", "offset": 21, @@ -1862,7 +1862,7 @@ "type": "t_bool" }, { - "astId": 34347, + "astId": 36053, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "transferGuardianPaused", "offset": 22, @@ -1870,7 +1870,7 @@ "type": "t_bool" }, { - "astId": 34349, + "astId": 36055, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "seizeGuardianPaused", "offset": 23, @@ -1878,7 +1878,7 @@ "type": "t_bool" }, { - "astId": 34353, + "astId": 36059, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "mintGuardianPaused", "offset": 0, @@ -1886,7 +1886,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34357, + "astId": 36063, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowGuardianPaused", "offset": 0, @@ -1894,7 +1894,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34363, + "astId": 36069, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowCapGuardian", "offset": 0, @@ -1902,7 +1902,7 @@ "type": "t_address" }, { - "astId": 34368, + "astId": 36074, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowCaps", "offset": 0, @@ -1910,7 +1910,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34373, + "astId": 36079, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "supplyCaps", "offset": 0, @@ -1918,7 +1918,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34377, + "astId": 36083, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "rewardsDistributors", "offset": 0, @@ -1926,7 +1926,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34380, + "astId": 36086, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_notEntered", "offset": 0, @@ -1934,7 +1934,7 @@ "type": "t_bool" }, { - "astId": 34383, + "astId": 36089, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_notEnteredInitialized", "offset": 1, @@ -1942,7 +1942,7 @@ "type": "t_bool" }, { - "astId": 34387, + "astId": 36093, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "nonAccruingRewardsDistributors", "offset": 0, @@ -1950,7 +1950,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34394, + "astId": 36100, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowCapForCollateral", "offset": 0, @@ -1958,7 +1958,7 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" }, { - "astId": 34401, + "astId": 36107, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowingAgainstCollateralBlacklist", "offset": 0, @@ -1966,52 +1966,52 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 34409, + "astId": 36115, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowCapForCollateralWhitelist", "offset": 0, "slot": "30", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))" }, { - "astId": 34417, + "astId": 36123, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowingAgainstCollateralBlacklistWhitelist", "offset": 0, "slot": "31", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))" }, { - "astId": 34423, + "astId": 36129, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "supplyCapWhitelist", "offset": 0, "slot": "32", - "type": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "type": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, { - "astId": 34429, + "astId": 36135, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowCapWhitelist", "offset": 0, "slot": "33", - "type": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "type": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, { - "astId": 34436, + "astId": 36142, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "borrowCapConfig", "offset": 0, "slot": "34", - "type": "t_struct(PrudentiaConfig)19800_storage" + "type": "t_struct(PrudentiaConfig)21191_storage" }, { - "astId": 34440, + "astId": 36146, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "supplyCapConfig", "offset": 0, "slot": "35", - "type": "t_struct(PrudentiaConfig)19800_storage" + "type": "t_struct(PrudentiaConfig)21191_storage" } ], "types": { @@ -2037,8 +2037,8 @@ "label": "bytes32[]", "numberOfBytes": "32" }, - "t_array(t_contract(ICErc20)26625)dyn_storage": { - "base": "t_contract(ICErc20)26625", + "t_array(t_contract(ICErc20)28192)dyn_storage": { + "base": "t_contract(ICErc20)28192", "encoding": "dynamic_array", "label": "contract ICErc20[]", "numberOfBytes": "32" @@ -2053,12 +2053,12 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(BasePriceOracle)61817": { + "t_contract(BasePriceOracle)66819": { "encoding": "inplace", "label": "contract BasePriceOracle", "numberOfBytes": "20" }, - "t_contract(ICErc20)26625": { + "t_contract(ICErc20)28192": { "encoding": "inplace", "label": "contract ICErc20", "numberOfBytes": "20" @@ -2068,12 +2068,12 @@ "label": "int8", "numberOfBytes": "1" }, - "t_mapping(t_address,t_array(t_contract(ICErc20)26625)dyn_storage)": { + "t_mapping(t_address,t_array(t_contract(ICErc20)28192)dyn_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract ICErc20[])", "numberOfBytes": "32", - "value": "t_array(t_contract(ICErc20)26625)dyn_storage" + "value": "t_array(t_contract(ICErc20)28192)dyn_storage" }, "t_mapping(t_address,t_bool)": { "encoding": "mapping", @@ -2082,12 +2082,12 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_address,t_contract(ICErc20)26625)": { + "t_mapping(t_address,t_contract(ICErc20)28192)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract ICErc20)", "numberOfBytes": "32", - "value": "t_contract(ICErc20)26625" + "value": "t_contract(ICErc20)28192" }, "t_mapping(t_address,t_mapping(t_address,t_bool))": { "encoding": "mapping", @@ -2096,12 +2096,12 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_bool)" }, - "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))": { + "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(address => struct EnumerableSet.AddressSet))", "numberOfBytes": "32", - "value": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "value": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, "t_mapping(t_address,t_mapping(t_address,t_uint256))": { "encoding": "mapping", @@ -2110,19 +2110,19 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_uint256)" }, - "t_mapping(t_address,t_struct(AddressSet)8457_storage)": { + "t_mapping(t_address,t_struct(AddressSet)9069_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct EnumerableSet.AddressSet)", "numberOfBytes": "32", - "value": "t_struct(AddressSet)8457_storage" + "value": "t_struct(AddressSet)9069_storage" }, - "t_mapping(t_address,t_struct(Market)34287_storage)": { + "t_mapping(t_address,t_struct(Market)35993_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ComptrollerV2Storage.Market)", "numberOfBytes": "32", - "value": "t_struct(Market)34287_storage" + "value": "t_struct(Market)35993_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -2138,27 +2138,27 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(AddressSet)8457_storage": { + "t_struct(AddressSet)9069_storage": { "encoding": "inplace", "label": "struct EnumerableSet.AddressSet", "members": [ { - "astId": 8456, + "astId": 9068, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_inner", "offset": 0, "slot": "0", - "type": "t_struct(Set)8142_storage" + "type": "t_struct(Set)8754_storage" } ], "numberOfBytes": "64" }, - "t_struct(Market)34287_storage": { + "t_struct(Market)35993_storage": { "encoding": "inplace", "label": "struct ComptrollerV2Storage.Market", "members": [ { - "astId": 34280, + "astId": 35986, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "isListed", "offset": 0, @@ -2166,7 +2166,7 @@ "type": "t_bool" }, { - "astId": 34282, + "astId": 35988, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "collateralFactorMantissa", "offset": 0, @@ -2174,7 +2174,7 @@ "type": "t_uint256" }, { - "astId": 34286, + "astId": 35992, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "accountMembership", "offset": 0, @@ -2184,12 +2184,12 @@ ], "numberOfBytes": "96" }, - "t_struct(PrudentiaConfig)19800_storage": { + "t_struct(PrudentiaConfig)21191_storage": { "encoding": "inplace", "label": "struct PrudentiaLib.PrudentiaConfig", "members": [ { - "astId": 19795, + "astId": 21186, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "controller", "offset": 0, @@ -2197,7 +2197,7 @@ "type": "t_address" }, { - "astId": 19797, + "astId": 21188, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "offset", "offset": 20, @@ -2205,7 +2205,7 @@ "type": "t_uint8" }, { - "astId": 19799, + "astId": 21190, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "decimalShift", "offset": 21, @@ -2215,12 +2215,12 @@ ], "numberOfBytes": "32" }, - "t_struct(Set)8142_storage": { + "t_struct(Set)8754_storage": { "encoding": "inplace", "label": "struct EnumerableSet.Set", "members": [ { - "astId": 8137, + "astId": 8749, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_values", "offset": 0, @@ -2228,7 +2228,7 @@ "type": "t_array(t_bytes32)dyn_storage" }, { - "astId": 8141, + "astId": 8753, "contract": "contracts/compound/ComptrollerFirstExtension.sol:ComptrollerFirstExtension", "label": "_indexes", "offset": 0, diff --git a/packages/contracts/deployments/base/ComptrollerPrudentiaCapsExt.json b/packages/contracts/deployments/base/ComptrollerPrudentiaCapsExt.json index d737b67a58..f22331ebed 100644 --- a/packages/contracts/deployments/base/ComptrollerPrudentiaCapsExt.json +++ b/packages/contracts/deployments/base/ComptrollerPrudentiaCapsExt.json @@ -1,5 +1,5 @@ { - "address": "0x3C1c62d04ccA26DCD17e670325cd435541625daD", + "address": "0xD22130E50EC505acEc884C7842b62f5baa6131a0", "abi": [ { "anonymous": false, @@ -811,28 +811,28 @@ "type": "function" } ], - "transactionHash": "0x8a0b3f0d3f7bccef663cac1bb14d902b5ea6170adda775ab0424f99f0ba9abc2", + "transactionHash": "0xf0da242f90c04284403dac872cd3bc502dc6c0b3cb41205dd324b25322e1bea9", "receipt": { "to": null, "from": "0x1155b614971f16758C92c4890eD338C9e3ede6b7", - "contractAddress": "0x3C1c62d04ccA26DCD17e670325cd435541625daD", - "transactionIndex": 131, + "contractAddress": "0xD22130E50EC505acEc884C7842b62f5baa6131a0", + "transactionIndex": 166, "gasUsed": "1128854", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1555198ae21174937927dbbc7c3629eea938ae7af82b6b27a19fc436339a6944", - "transactionHash": "0x8a0b3f0d3f7bccef663cac1bb14d902b5ea6170adda775ab0424f99f0ba9abc2", + "blockHash": "0x41976d5d5bc40426c3954e848c3c63d70804a9915511b20b400dd74d1f13ac32", + "transactionHash": "0xf0da242f90c04284403dac872cd3bc502dc6c0b3cb41205dd324b25322e1bea9", "logs": [], - "blockNumber": 26592653, - "cumulativeGasUsed": "39662239", + "blockNumber": 29834095, + "cumulativeGasUsed": "36230614", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "6008ad86aa2c4274c6330382b8ed4717", - "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"oldConfig\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"NewBorrowCapConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"oldConfig\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"NewSupplyCapConfig\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"_setBorrowCapConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"_setSupplyCapConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"accountAssets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allBorrowers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCapForCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowCapGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowingAgainstCollateralBlacklist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"cTokensByUnderlying\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"closeFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveBorrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveSupplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplyCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforceWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBorrowCapConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSupplyCapConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isComptroller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationIncentiveMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"markets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isListed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nonAccruingRewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seizeGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"suppliers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transferGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistArray\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\",\"events\":{\"NewBorrowCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"params\":{\"newConfig\":\"The new config.\",\"oldConfig\":\"The old config.\"}},\"NewSupplyCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"params\":{\"newConfig\":\"The new config.\",\"oldConfig\":\"The old config.\"}}},\"kind\":\"dev\",\"methods\":{\"_getExtensionFunctions()\":{\"returns\":{\"_0\":\"a list of all the function selectors that this logic extension exposes\"}},\"_setBorrowCapConfig((address,uint8,int8))\":{\"details\":\"Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\",\"params\":{\"newConfig\":\"The new config.\"}},\"_setSupplyCapConfig((address,uint8,int8))\":{\"details\":\"Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\",\"params\":{\"newConfig\":\"The new config.\"}},\"effectiveBorrowCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"effectiveSupplyCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"getBorrowCapConfig()\":{\"returns\":{\"_0\":\"The config.\"}},\"getSupplyCapConfig()\":{\"returns\":{\"_0\":\"The config.\"}}},\"title\":\"ComptrollerPrudentiaCapsExt\",\"version\":1},\"userdoc\":{\"events\":{\"NewBorrowCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"notice\":\"Emitted when the Adrastia Prudentia borrow cap config is changed.\"},\"NewSupplyCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"notice\":\"Emitted when the Adrastia Prudentia supply cap config is changed.\"}},\"kind\":\"user\",\"methods\":{\"_setBorrowCapConfig((address,uint8,int8))\":{\"notice\":\"Sets the Adrastia Prudentia supply cap config.\"},\"_setSupplyCapConfig((address,uint8,int8))\":{\"notice\":\"Sets the Adrastia Prudentia supply cap config.\"},\"accountAssets(address,uint256)\":{\"notice\":\"Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\"},\"admin()\":{\"notice\":\"Administrator for this contract\"},\"adminHasRights()\":{\"notice\":\"Whether or not the admin has admin rights\"},\"allBorrowers(uint256)\":{\"notice\":\"A list of all borrowers who have entered markets\"},\"allMarkets(uint256)\":{\"notice\":\"A list of all markets\"},\"borrowCapGuardian()\":{\"notice\":\"The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\"},\"borrowCaps(address)\":{\"notice\":\"Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\"},\"cTokensByUnderlying(address)\":{\"notice\":\"All cTokens addresses mapped by their underlying token addresses\"},\"closeFactorMantissa()\":{\"notice\":\"Multiplier used to calculate the maximum repayAmount when liquidating a borrow\"},\"effectiveBorrowCaps(address)\":{\"notice\":\"Gets the borrow cap of a cToken in the units of the underlying asset.\"},\"effectiveSupplyCaps(address)\":{\"notice\":\"Gets the supply cap of a cToken in the units of the underlying asset.\"},\"enforceWhitelist()\":{\"notice\":\"Whether or not the supplier whitelist is enforced\"},\"getBorrowCapConfig()\":{\"notice\":\"Retrieves Adrastia Prudentia borrow cap config from storage.\"},\"getSupplyCapConfig()\":{\"notice\":\"Retrieves Adrastia Prudentia supply cap config from storage.\"},\"ionicAdminHasRights()\":{\"notice\":\"Whether or not the Ionic admin has admin rights\"},\"isComptroller()\":{\"notice\":\"Indicator that this is a Comptroller contract (for inspection)\"},\"liquidationIncentiveMantissa()\":{\"notice\":\"Multiplier representing the discount on collateral that a liquidator receives\"},\"markets(address)\":{\"notice\":\"Official mapping of cTokens -> Market metadata\"},\"nonAccruingRewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor to list for claiming, but not to notify of flywheel changes.\"},\"oracle()\":{\"notice\":\"Oracle which gives the price of any given asset\"},\"pauseGuardian()\":{\"notice\":\"The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing / transfer can only be paused globally, not by market.\"},\"pendingAdmin()\":{\"notice\":\"Pending administrator for this contract\"},\"rewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor contracts to notify of flywheel changes.\"},\"supplyCaps(address)\":{\"notice\":\"Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\"},\"whitelist(address)\":{\"notice\":\"Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\"},\"whitelistArray(uint256)\":{\"notice\":\"An array of all whitelisted accounts\"}},\"notice\":\"A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/ComptrollerPrudentiaCapsExt.sol\":\"ComptrollerPrudentiaCapsExt\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(\\n address src,\\n address dst,\\n uint256 amount\\n ) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256\\n );\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral\\n ) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x7cc75051a5fa860b9ee93d0ba1ac0608921f02308aeff786ce8bbd8d8a70489a\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowVerify(address cToken, address borrower) external;\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n \\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external;\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n \\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x266ec3c26b454cfa72bab45fa8e0bc9e3d44e8ec0cd4770304a14cc84c8f80d3\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerPrudentiaCapsExt.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { ComptrollerPrudentiaCapsExtInterface, ComptrollerBase } from \\\"./ComptrollerInterface.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\n/**\\n * @title ComptrollerPrudentiaCapsExt\\n * @author Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\\n * @notice A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\\n */\\ncontract ComptrollerPrudentiaCapsExt is DiamondExtension, ComptrollerBase, ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Emitted when the Adrastia Prudentia supply cap config is changed.\\n * @param oldConfig The old config.\\n * @param newConfig The new config.\\n */\\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\\n\\n /**\\n * @notice Emitted when the Adrastia Prudentia borrow cap config is changed.\\n * @param oldConfig The old config.\\n * @param newConfig The new config.\\n */\\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n PrudentiaLib.PrudentiaConfig memory oldConfig = supplyCapConfig;\\n supplyCapConfig = newConfig;\\n\\n emit NewSupplyCapConfig(oldConfig, newConfig);\\n }\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n PrudentiaLib.PrudentiaConfig memory oldConfig = borrowCapConfig;\\n borrowCapConfig = newConfig;\\n\\n emit NewBorrowCapConfig(oldConfig, newConfig);\\n }\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\\n return borrowCapConfig;\\n }\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\\n return supplyCapConfig;\\n }\\n\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\\n uint8 fnsCount = 4;\\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\\n functionSelectors[--fnsCount] = this._setSupplyCapConfig.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapConfig.selector;\\n functionSelectors[--fnsCount] = this.getBorrowCapConfig.selector;\\n functionSelectors[--fnsCount] = this.getSupplyCapConfig.selector;\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return functionSelectors;\\n }\\n}\\n\",\"keccak256\":\"0x2a7a6be36f2446bee628c65ebf4a7f2b79cd27279df271e4929a6c4395e13cfd\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x233d26db3755cf0c7bf0bba3a695a742bbfc15fd168fb76bbe307c5ac259b5bf\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x74641db987b6d12c8c412818b8a7708332778736193b2cb127ea54e80b334186\",\"license\":\"UNLICENSED\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526002805461ffff60a01b191661010160a01b17905534801561002557600080fd5b5061130b806100356000396000f3fe608060405234801561001057600080fd5b506004361061023c5760003560e01c80637515bafa1161013b578063b1034882116100b8578063dbfb09d61161007c578063dbfb09d614610665578063dce1544914610678578063e6653f3d1461068b578063e87554461461069f578063f851a440146106a857600080fd5b8063b103488214610605578063c6c5b0dd14610618578063c91a424f1461062b578063cf6bfd2d1461063e578063d251fefc1461065257600080fd5b80638e8f294b116100ff5780638e8f294b14610552578063940cd6f1146105965780639b19251a146105c1578063ac0b0bb7146105e4578063b0957210146105f857600080fd5b80637515bafa146104a65780637dc0d1d0146104b957806387f76303146104cc57806389f8132e146104e05780638d3df1b2146104f557600080fd5b80632ccf47a4116101c95780634ada90af1161018d5780634ada90af1461043157806352d84d1e1461043a5780636bd02b8a1461044d5780636d154ea514610460578063731f0c2b1461048357600080fd5b80632ccf47a4146103ac5780632d6af6b0146103bf57806331ff47fa146103d45780633c94786f146103fd5780634a5844321461041157600080fd5b806316dc15fe1161021057806316dc15fe1461030a5780631c819e431461032d57806321af45691461035b57806324a3d62214610386578063267822471461039957600080fd5b80627e3dd21461024157806302c3bcbb1461025e5780630a755ec21461028c5780630dd0cefa146102a0575b600080fd5b610249600181565b60405190151581526020015b60405180910390f35b61027e61026c366004610dc0565b60186020526000908152604090205481565b604051908152602001610255565b60025461024990600160a81b900460ff1681565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526022546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b6040516102559190610de4565b610249610318366004610dc0565b600d6020526000908152604090205460ff1681565b61024961033b366004610e14565b601d60209081526000928352604080842090915290825290205460ff1681565b60165461036e906001600160a01b031681565b6040516001600160a01b039091168152602001610255565b60135461036e906001600160a01b031681565b60025461036e906001600160a01b031681565b61027e6103ba366004610dc0565b6106bb565b6103d26103cd366004610e4d565b61092d565b005b61036e6103e2366004610dc0565b600e602052600090815260409020546001600160a01b031681565b60135461024990600160a01b900460ff1681565b61027e61041f366004610dc0565b60176020526000908152604090205481565b61027e60055481565b61036e610448366004610e5f565b610a11565b61036e61045b366004610e5f565b610a3b565b61024961046e366004610dc0565b60156020526000908152604090205460ff1681565b610249610491366004610dc0565b60146020526000908152604090205460ff1681565b61036e6104b4366004610e5f565b610a4b565b60035461036e906001600160a01b031681565b60135461024990600160b01b900460ff1681565b6104e8610a5b565b6040516102559190610e78565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526023546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b61057f610560366004610dc0565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610255565b61027e6105a4366004610e14565b601c60209081526000928352604080842090915290825290205481565b6102496105cf366004610dc0565b60106020526000908152604090205460ff1681565b60135461024990600160b81b900460ff1681565b600f546102499060ff1681565b61027e610613366004610dc0565b610bde565b61036e610626366004610e5f565b610c7d565b60005461036e906001600160a01b031681565b60025461024990600160a01b900460ff1681565b61036e610660366004610e5f565b610c8d565b6103d2610673366004610e4d565b610c9d565b61036e610686366004610ec6565b610d70565b60135461024990600160a81b900460ff1681565b61027e60045481565b60015461036e906001600160a01b031681565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561090b576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610ef2565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156107ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107de9190610f2c565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916108379190610fb1565b600060405180830381855afa9150503d8060008114610872576040519150601f19603f3d011682016040523d82523d6000602084013e610877565b606091505b509150915081801561088a575080516020145b156108a957808060200190518101906108a39190610fef565b60ff1692505b60408501516108bb9060000b84611022565b9250600083126108e1576108d083600a61112e565b6108da908761113a565b9550610902565b6108ea83611151565b6108f590600a61112e565b6108ff908761116d565b95505b50505050610927565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546001600160a01b031633148061095057506016546001600160a01b031633145b61098a5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b60448201526064015b60405180910390fd5b60408051606081018252602380546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b928201929092529082906109d1828261119e565b9050507f1fd35ea350fffd290d8aecb52fb5db35cf6ce7a0cbb0dfa33a50607998fa193f8183604051610a05929190611229565b60405180910390a15050565b60098181548110610a2157600080fd5b6000918252602090912001546001600160a01b0316905081565b601b8181548110610a2157600080fd5b600b8181548110610a2157600080fd5b60408051600480825260a082019092526060919060009082602082016080803683370190505090506302d6af6b60e41b81610a95846112a2565b93508360ff1681518110610aab57610aab6112bf565b6001600160e01b031990921660209283029190910190910152636dfd84eb60e11b81610ad6846112a2565b93508360ff1681518110610aec57610aec6112bf565b6001600160e01b0319909216602092830291909101909101526306e8677d60e11b81610b17846112a2565b93508360ff1681518110610b2d57610b2d6112bf565b6001600160e01b03199092166020928302919091019091015263469ef8d960e11b81610b58846112a2565b93508360ff1681518110610b6e57610b6e6112bf565b6001600160e01b03199092166020928302919091019091015260ff821615610bd85760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610981565b92915050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215610c60576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60198181548110610a2157600080fd5b60118181548110610a2157600080fd5b6001546001600160a01b0316331480610cc057506016546001600160a01b031633145b610cf55760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610981565b60408051606081018252602280546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b92820192909252908290610d3c828261119e565b9050507f1f259051c3c5d7c898a1194cce1b9e9a037675b276b1dff78534ff76d6ef12928183604051610a05929190611229565b60076020528160005260406000208181548110610d8c57600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381168114610dbd57600080fd5b50565b600060208284031215610dd257600080fd5b8135610ddd81610da8565b9392505050565b81516001600160a01b0316815260208083015160ff169082015260408083015160000b9082015260608101610bd8565b60008060408385031215610e2757600080fd5b8235610e3281610da8565b91506020830135610e4281610da8565b809150509250929050565b60006060828403121561092757600080fd5b600060208284031215610e7157600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610eba5783516001600160e01b03191683529284019291840191600101610e94565b50909695505050505050565b60008060408385031215610ed957600080fd5b8235610ee481610da8565b946020939093013593505050565b600060208284031215610f0457600080fd5b8151610ddd81610da8565b805167ffffffffffffffff81168114610f2757600080fd5b919050565b600060608284031215610f3e57600080fd5b6040516060810181811067ffffffffffffffff82111715610f6f57634e487b7160e01b600052604160045260246000fd5b604052610f7b83610f0f565b8152610f8960208401610f0f565b6020820152604083015163ffffffff81168114610fa557600080fd5b60408201529392505050565b6000825160005b81811015610fd25760208186018101518583015201610fb8565b506000920191825250919050565b60ff81168114610dbd57600080fd5b60006020828403121561100157600080fd5b8151610ddd81610fe0565b634e487b7160e01b600052601160045260246000fd5b80820182811260008312801582168215821617156110425761104261100c565b505092915050565b600181815b8085111561108557816000190482111561106b5761106b61100c565b8085161561107857918102915b93841c939080029061104f565b509250929050565b60008261109c57506001610bd8565b816110a957506000610bd8565b81600181146110bf57600281146110c9576110e5565b6001915050610bd8565b60ff8411156110da576110da61100c565b50506001821b610bd8565b5060208310610133831016604e8410600b8410161715611108575081810a610bd8565b611112838361104a565b80600019048211156111265761112661100c565b029392505050565b6000610ddd838361108d565b8082028115828204841417610bd857610bd861100c565b6000600160ff1b82016111665761116661100c565b5060000390565b60008261118a57634e487b7160e01b600052601260045260246000fd5b500490565b8060000b8114610dbd57600080fd5b81356111a981610da8565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356111d581610fe0565b60ff60a01b60a09190911b166001600160a81b0319821683178117845560408501356112008161118f565b8060a81b60ff60a81b168469ffffffffffffffffffff60b01b8516178317178555505050505050565b82516001600160a01b0316815260208084015160ff169082015260408084015160000b9082015260c08101823561125f81610da8565b6001600160a01b03166060830152602083013561127b81610fe0565b60ff16608083015260408301356112918161118f565b8060000b60a0840152509392505050565b600060ff8216806112b5576112b561100c565b6000190192915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212209f40a5d99da6cce05e36861ed8c19eff87d9fa3e9b51592a6502115cf60a78bd64736f6c63430008160033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061023c5760003560e01c80637515bafa1161013b578063b1034882116100b8578063dbfb09d61161007c578063dbfb09d614610665578063dce1544914610678578063e6653f3d1461068b578063e87554461461069f578063f851a440146106a857600080fd5b8063b103488214610605578063c6c5b0dd14610618578063c91a424f1461062b578063cf6bfd2d1461063e578063d251fefc1461065257600080fd5b80638e8f294b116100ff5780638e8f294b14610552578063940cd6f1146105965780639b19251a146105c1578063ac0b0bb7146105e4578063b0957210146105f857600080fd5b80637515bafa146104a65780637dc0d1d0146104b957806387f76303146104cc57806389f8132e146104e05780638d3df1b2146104f557600080fd5b80632ccf47a4116101c95780634ada90af1161018d5780634ada90af1461043157806352d84d1e1461043a5780636bd02b8a1461044d5780636d154ea514610460578063731f0c2b1461048357600080fd5b80632ccf47a4146103ac5780632d6af6b0146103bf57806331ff47fa146103d45780633c94786f146103fd5780634a5844321461041157600080fd5b806316dc15fe1161021057806316dc15fe1461030a5780631c819e431461032d57806321af45691461035b57806324a3d62214610386578063267822471461039957600080fd5b80627e3dd21461024157806302c3bcbb1461025e5780630a755ec21461028c5780630dd0cefa146102a0575b600080fd5b610249600181565b60405190151581526020015b60405180910390f35b61027e61026c366004610dc0565b60186020526000908152604090205481565b604051908152602001610255565b60025461024990600160a81b900460ff1681565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526022546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b6040516102559190610de4565b610249610318366004610dc0565b600d6020526000908152604090205460ff1681565b61024961033b366004610e14565b601d60209081526000928352604080842090915290825290205460ff1681565b60165461036e906001600160a01b031681565b6040516001600160a01b039091168152602001610255565b60135461036e906001600160a01b031681565b60025461036e906001600160a01b031681565b61027e6103ba366004610dc0565b6106bb565b6103d26103cd366004610e4d565b61092d565b005b61036e6103e2366004610dc0565b600e602052600090815260409020546001600160a01b031681565b60135461024990600160a01b900460ff1681565b61027e61041f366004610dc0565b60176020526000908152604090205481565b61027e60055481565b61036e610448366004610e5f565b610a11565b61036e61045b366004610e5f565b610a3b565b61024961046e366004610dc0565b60156020526000908152604090205460ff1681565b610249610491366004610dc0565b60146020526000908152604090205460ff1681565b61036e6104b4366004610e5f565b610a4b565b60035461036e906001600160a01b031681565b60135461024990600160b01b900460ff1681565b6104e8610a5b565b6040516102559190610e78565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526023546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b61057f610560366004610dc0565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610255565b61027e6105a4366004610e14565b601c60209081526000928352604080842090915290825290205481565b6102496105cf366004610dc0565b60106020526000908152604090205460ff1681565b60135461024990600160b81b900460ff1681565b600f546102499060ff1681565b61027e610613366004610dc0565b610bde565b61036e610626366004610e5f565b610c7d565b60005461036e906001600160a01b031681565b60025461024990600160a01b900460ff1681565b61036e610660366004610e5f565b610c8d565b6103d2610673366004610e4d565b610c9d565b61036e610686366004610ec6565b610d70565b60135461024990600160a81b900460ff1681565b61027e60045481565b60015461036e906001600160a01b031681565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561090b576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610ef2565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156107ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107de9190610f2c565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916108379190610fb1565b600060405180830381855afa9150503d8060008114610872576040519150601f19603f3d011682016040523d82523d6000602084013e610877565b606091505b509150915081801561088a575080516020145b156108a957808060200190518101906108a39190610fef565b60ff1692505b60408501516108bb9060000b84611022565b9250600083126108e1576108d083600a61112e565b6108da908761113a565b9550610902565b6108ea83611151565b6108f590600a61112e565b6108ff908761116d565b95505b50505050610927565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546001600160a01b031633148061095057506016546001600160a01b031633145b61098a5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b60448201526064015b60405180910390fd5b60408051606081018252602380546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b928201929092529082906109d1828261119e565b9050507f1fd35ea350fffd290d8aecb52fb5db35cf6ce7a0cbb0dfa33a50607998fa193f8183604051610a05929190611229565b60405180910390a15050565b60098181548110610a2157600080fd5b6000918252602090912001546001600160a01b0316905081565b601b8181548110610a2157600080fd5b600b8181548110610a2157600080fd5b60408051600480825260a082019092526060919060009082602082016080803683370190505090506302d6af6b60e41b81610a95846112a2565b93508360ff1681518110610aab57610aab6112bf565b6001600160e01b031990921660209283029190910190910152636dfd84eb60e11b81610ad6846112a2565b93508360ff1681518110610aec57610aec6112bf565b6001600160e01b0319909216602092830291909101909101526306e8677d60e11b81610b17846112a2565b93508360ff1681518110610b2d57610b2d6112bf565b6001600160e01b03199092166020928302919091019091015263469ef8d960e11b81610b58846112a2565b93508360ff1681518110610b6e57610b6e6112bf565b6001600160e01b03199092166020928302919091019091015260ff821615610bd85760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610981565b92915050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215610c60576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60198181548110610a2157600080fd5b60118181548110610a2157600080fd5b6001546001600160a01b0316331480610cc057506016546001600160a01b031633145b610cf55760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610981565b60408051606081018252602280546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b92820192909252908290610d3c828261119e565b9050507f1f259051c3c5d7c898a1194cce1b9e9a037675b276b1dff78534ff76d6ef12928183604051610a05929190611229565b60076020528160005260406000208181548110610d8c57600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381168114610dbd57600080fd5b50565b600060208284031215610dd257600080fd5b8135610ddd81610da8565b9392505050565b81516001600160a01b0316815260208083015160ff169082015260408083015160000b9082015260608101610bd8565b60008060408385031215610e2757600080fd5b8235610e3281610da8565b91506020830135610e4281610da8565b809150509250929050565b60006060828403121561092757600080fd5b600060208284031215610e7157600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610eba5783516001600160e01b03191683529284019291840191600101610e94565b50909695505050505050565b60008060408385031215610ed957600080fd5b8235610ee481610da8565b946020939093013593505050565b600060208284031215610f0457600080fd5b8151610ddd81610da8565b805167ffffffffffffffff81168114610f2757600080fd5b919050565b600060608284031215610f3e57600080fd5b6040516060810181811067ffffffffffffffff82111715610f6f57634e487b7160e01b600052604160045260246000fd5b604052610f7b83610f0f565b8152610f8960208401610f0f565b6020820152604083015163ffffffff81168114610fa557600080fd5b60408201529392505050565b6000825160005b81811015610fd25760208186018101518583015201610fb8565b506000920191825250919050565b60ff81168114610dbd57600080fd5b60006020828403121561100157600080fd5b8151610ddd81610fe0565b634e487b7160e01b600052601160045260246000fd5b80820182811260008312801582168215821617156110425761104261100c565b505092915050565b600181815b8085111561108557816000190482111561106b5761106b61100c565b8085161561107857918102915b93841c939080029061104f565b509250929050565b60008261109c57506001610bd8565b816110a957506000610bd8565b81600181146110bf57600281146110c9576110e5565b6001915050610bd8565b60ff8411156110da576110da61100c565b50506001821b610bd8565b5060208310610133831016604e8410600b8410161715611108575081810a610bd8565b611112838361104a565b80600019048211156111265761112661100c565b029392505050565b6000610ddd838361108d565b8082028115828204841417610bd857610bd861100c565b6000600160ff1b82016111665761116661100c565b5060000390565b60008261118a57634e487b7160e01b600052601260045260246000fd5b500490565b8060000b8114610dbd57600080fd5b81356111a981610da8565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356111d581610fe0565b60ff60a01b60a09190911b166001600160a81b0319821683178117845560408501356112008161118f565b8060a81b60ff60a81b168469ffffffffffffffffffff60b01b8516178317178555505050505050565b82516001600160a01b0316815260208084015160ff169082015260408084015160000b9082015260c08101823561125f81610da8565b6001600160a01b03166060830152602083013561127b81610fe0565b60ff16608083015260408301356112918161118f565b8060000b60a0840152509392505050565b600060ff8216806112b5576112b561100c565b6000190192915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212209f40a5d99da6cce05e36861ed8c19eff87d9fa3e9b51592a6502115cf60a78bd64736f6c63430008160033", + "numDeployments": 2, + "solcInputHash": "b983f3d49ecb24251a5a4f735e4e3ec3", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"oldConfig\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"NewBorrowCapConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"oldConfig\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"indexed\":false,\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"NewSupplyCapConfig\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_getExtensionFunctions\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"_setBorrowCapConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"_setSupplyCapConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"accountAssets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allBorrowers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allMarkets\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCapForCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowCapGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"borrowingAgainstCollateralBlacklist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"cTokensByUnderlying\",\"outputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"closeFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveBorrowCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"effectiveSupplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"supplyCap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforceWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBorrowCapConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSupplyCapConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"offset\",\"type\":\"uint8\"},{\"internalType\":\"int8\",\"name\":\"decimalShift\",\"type\":\"int8\"}],\"internalType\":\"struct PrudentiaLib.PrudentiaConfig\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ionicAdminHasRights\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isComptroller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationIncentiveMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"markets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isListed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"collateralFactorMantissa\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mintGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nonAccruingRewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract BasePriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseGuardian\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardsDistributors\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seizeGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"suppliers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"supplyCaps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transferGuardianPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistArray\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\",\"events\":{\"NewBorrowCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"params\":{\"newConfig\":\"The new config.\",\"oldConfig\":\"The old config.\"}},\"NewSupplyCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"params\":{\"newConfig\":\"The new config.\",\"oldConfig\":\"The old config.\"}}},\"kind\":\"dev\",\"methods\":{\"_getExtensionFunctions()\":{\"returns\":{\"_0\":\"a list of all the function selectors that this logic extension exposes\"}},\"_setBorrowCapConfig((address,uint8,int8))\":{\"details\":\"Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\",\"params\":{\"newConfig\":\"The new config.\"}},\"_setSupplyCapConfig((address,uint8,int8))\":{\"details\":\"Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\",\"params\":{\"newConfig\":\"The new config.\"}},\"effectiveBorrowCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"effectiveSupplyCaps(address)\":{\"params\":{\"cToken\":\"The address of the cToken.\"}},\"getBorrowCapConfig()\":{\"returns\":{\"_0\":\"The config.\"}},\"getSupplyCapConfig()\":{\"returns\":{\"_0\":\"The config.\"}}},\"title\":\"ComptrollerPrudentiaCapsExt\",\"version\":1},\"userdoc\":{\"events\":{\"NewBorrowCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"notice\":\"Emitted when the Adrastia Prudentia borrow cap config is changed.\"},\"NewSupplyCapConfig((address,uint8,int8),(address,uint8,int8))\":{\"notice\":\"Emitted when the Adrastia Prudentia supply cap config is changed.\"}},\"kind\":\"user\",\"methods\":{\"_setBorrowCapConfig((address,uint8,int8))\":{\"notice\":\"Sets the Adrastia Prudentia supply cap config.\"},\"_setSupplyCapConfig((address,uint8,int8))\":{\"notice\":\"Sets the Adrastia Prudentia supply cap config.\"},\"accountAssets(address,uint256)\":{\"notice\":\"Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\"},\"admin()\":{\"notice\":\"Administrator for this contract\"},\"adminHasRights()\":{\"notice\":\"Whether or not the admin has admin rights\"},\"allBorrowers(uint256)\":{\"notice\":\"A list of all borrowers who have entered markets\"},\"allMarkets(uint256)\":{\"notice\":\"A list of all markets\"},\"borrowCapGuardian()\":{\"notice\":\"The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\"},\"borrowCaps(address)\":{\"notice\":\"Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\"},\"cTokensByUnderlying(address)\":{\"notice\":\"All cTokens addresses mapped by their underlying token addresses\"},\"closeFactorMantissa()\":{\"notice\":\"Multiplier used to calculate the maximum repayAmount when liquidating a borrow\"},\"effectiveBorrowCaps(address)\":{\"notice\":\"Gets the borrow cap of a cToken in the units of the underlying asset.\"},\"effectiveSupplyCaps(address)\":{\"notice\":\"Gets the supply cap of a cToken in the units of the underlying asset.\"},\"enforceWhitelist()\":{\"notice\":\"Whether or not the supplier whitelist is enforced\"},\"getBorrowCapConfig()\":{\"notice\":\"Retrieves Adrastia Prudentia borrow cap config from storage.\"},\"getSupplyCapConfig()\":{\"notice\":\"Retrieves Adrastia Prudentia supply cap config from storage.\"},\"ionicAdminHasRights()\":{\"notice\":\"Whether or not the Ionic admin has admin rights\"},\"isComptroller()\":{\"notice\":\"Indicator that this is a Comptroller contract (for inspection)\"},\"liquidationIncentiveMantissa()\":{\"notice\":\"Multiplier representing the discount on collateral that a liquidator receives\"},\"markets(address)\":{\"notice\":\"Official mapping of cTokens -> Market metadata\"},\"nonAccruingRewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor to list for claiming, but not to notify of flywheel changes.\"},\"oracle()\":{\"notice\":\"Oracle which gives the price of any given asset\"},\"pauseGuardian()\":{\"notice\":\"The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing / transfer can only be paused globally, not by market.\"},\"pendingAdmin()\":{\"notice\":\"Pending administrator for this contract\"},\"rewardsDistributors(uint256)\":{\"notice\":\"RewardsDistributor contracts to notify of flywheel changes.\"},\"supplyCaps(address)\":{\"notice\":\"Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\"},\"whitelist(address)\":{\"notice\":\"Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\"},\"whitelistArray(uint256)\":{\"notice\":\"An array of all whitelisted accounts\"}},\"notice\":\"A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/compound/ComptrollerPrudentiaCapsExt.sol\":\"ComptrollerPrudentiaCapsExt\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x98f176ae2753880b0751466561ae0d66c4de612f238454deb1b89243b5067beb\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowVerify(address cToken, address borrower) external;\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function repayBorrowVerify(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n \\n function seizeVerify(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external;\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n \\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x266ec3c26b454cfa72bab45fa8e0bc9e3d44e8ec0cd4770304a14cc84c8f80d3\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerPrudentiaCapsExt.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { ComptrollerPrudentiaCapsExtInterface, ComptrollerBase } from \\\"./ComptrollerInterface.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\n/**\\n * @title ComptrollerPrudentiaCapsExt\\n * @author Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\\n * @notice A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\\n */\\ncontract ComptrollerPrudentiaCapsExt is DiamondExtension, ComptrollerBase, ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Emitted when the Adrastia Prudentia supply cap config is changed.\\n * @param oldConfig The old config.\\n * @param newConfig The new config.\\n */\\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\\n\\n /**\\n * @notice Emitted when the Adrastia Prudentia borrow cap config is changed.\\n * @param oldConfig The old config.\\n * @param newConfig The new config.\\n */\\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n PrudentiaLib.PrudentiaConfig memory oldConfig = supplyCapConfig;\\n supplyCapConfig = newConfig;\\n\\n emit NewSupplyCapConfig(oldConfig, newConfig);\\n }\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \\\"!admin\\\");\\n\\n PrudentiaLib.PrudentiaConfig memory oldConfig = borrowCapConfig;\\n borrowCapConfig = newConfig;\\n\\n emit NewBorrowCapConfig(oldConfig, newConfig);\\n }\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\\n return borrowCapConfig;\\n }\\n\\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\\n return supplyCapConfig;\\n }\\n\\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\\n uint8 fnsCount = 4;\\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\\n functionSelectors[--fnsCount] = this._setSupplyCapConfig.selector;\\n functionSelectors[--fnsCount] = this._setBorrowCapConfig.selector;\\n functionSelectors[--fnsCount] = this.getBorrowCapConfig.selector;\\n functionSelectors[--fnsCount] = this.getSupplyCapConfig.selector;\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return functionSelectors;\\n }\\n}\\n\",\"keccak256\":\"0x2a7a6be36f2446bee628c65ebf4a7f2b79cd27279df271e4929a6c4395e13cfd\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x233d26db3755cf0c7bf0bba3a695a742bbfc15fd168fb76bbe307c5ac259b5bf\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x74641db987b6d12c8c412818b8a7708332778736193b2cb127ea54e80b334186\",\"license\":\"UNLICENSED\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60806040526002805461ffff60a01b191661010160a01b17905534801561002557600080fd5b5061130b806100356000396000f3fe608060405234801561001057600080fd5b506004361061023c5760003560e01c80637515bafa1161013b578063b1034882116100b8578063dbfb09d61161007c578063dbfb09d614610665578063dce1544914610678578063e6653f3d1461068b578063e87554461461069f578063f851a440146106a857600080fd5b8063b103488214610605578063c6c5b0dd14610618578063c91a424f1461062b578063cf6bfd2d1461063e578063d251fefc1461065257600080fd5b80638e8f294b116100ff5780638e8f294b14610552578063940cd6f1146105965780639b19251a146105c1578063ac0b0bb7146105e4578063b0957210146105f857600080fd5b80637515bafa146104a65780637dc0d1d0146104b957806387f76303146104cc57806389f8132e146104e05780638d3df1b2146104f557600080fd5b80632ccf47a4116101c95780634ada90af1161018d5780634ada90af1461043157806352d84d1e1461043a5780636bd02b8a1461044d5780636d154ea514610460578063731f0c2b1461048357600080fd5b80632ccf47a4146103ac5780632d6af6b0146103bf57806331ff47fa146103d45780633c94786f146103fd5780634a5844321461041157600080fd5b806316dc15fe1161021057806316dc15fe1461030a5780631c819e431461032d57806321af45691461035b57806324a3d62214610386578063267822471461039957600080fd5b80627e3dd21461024157806302c3bcbb1461025e5780630a755ec21461028c5780630dd0cefa146102a0575b600080fd5b610249600181565b60405190151581526020015b60405180910390f35b61027e61026c366004610dc0565b60186020526000908152604090205481565b604051908152602001610255565b60025461024990600160a81b900460ff1681565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526022546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b6040516102559190610de4565b610249610318366004610dc0565b600d6020526000908152604090205460ff1681565b61024961033b366004610e14565b601d60209081526000928352604080842090915290825290205460ff1681565b60165461036e906001600160a01b031681565b6040516001600160a01b039091168152602001610255565b60135461036e906001600160a01b031681565b60025461036e906001600160a01b031681565b61027e6103ba366004610dc0565b6106bb565b6103d26103cd366004610e4d565b61092d565b005b61036e6103e2366004610dc0565b600e602052600090815260409020546001600160a01b031681565b60135461024990600160a01b900460ff1681565b61027e61041f366004610dc0565b60176020526000908152604090205481565b61027e60055481565b61036e610448366004610e5f565b610a11565b61036e61045b366004610e5f565b610a3b565b61024961046e366004610dc0565b60156020526000908152604090205460ff1681565b610249610491366004610dc0565b60146020526000908152604090205460ff1681565b61036e6104b4366004610e5f565b610a4b565b60035461036e906001600160a01b031681565b60135461024990600160b01b900460ff1681565b6104e8610a5b565b6040516102559190610e78565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526023546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b61057f610560366004610dc0565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610255565b61027e6105a4366004610e14565b601c60209081526000928352604080842090915290825290205481565b6102496105cf366004610dc0565b60106020526000908152604090205460ff1681565b60135461024990600160b81b900460ff1681565b600f546102499060ff1681565b61027e610613366004610dc0565b610bde565b61036e610626366004610e5f565b610c7d565b60005461036e906001600160a01b031681565b60025461024990600160a01b900460ff1681565b61036e610660366004610e5f565b610c8d565b6103d2610673366004610e4d565b610c9d565b61036e610686366004610ec6565b610d70565b60135461024990600160a81b900460ff1681565b61027e60045481565b60015461036e906001600160a01b031681565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561090b576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610ef2565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156107ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107de9190610f2c565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916108379190610fb1565b600060405180830381855afa9150503d8060008114610872576040519150601f19603f3d011682016040523d82523d6000602084013e610877565b606091505b509150915081801561088a575080516020145b156108a957808060200190518101906108a39190610fef565b60ff1692505b60408501516108bb9060000b84611022565b9250600083126108e1576108d083600a61112e565b6108da908761113a565b9550610902565b6108ea83611151565b6108f590600a61112e565b6108ff908761116d565b95505b50505050610927565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546001600160a01b031633148061095057506016546001600160a01b031633145b61098a5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b60448201526064015b60405180910390fd5b60408051606081018252602380546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b928201929092529082906109d1828261119e565b9050507f1fd35ea350fffd290d8aecb52fb5db35cf6ce7a0cbb0dfa33a50607998fa193f8183604051610a05929190611229565b60405180910390a15050565b60098181548110610a2157600080fd5b6000918252602090912001546001600160a01b0316905081565b601b8181548110610a2157600080fd5b600b8181548110610a2157600080fd5b60408051600480825260a082019092526060919060009082602082016080803683370190505090506302d6af6b60e41b81610a95846112a2565b93508360ff1681518110610aab57610aab6112bf565b6001600160e01b031990921660209283029190910190910152636dfd84eb60e11b81610ad6846112a2565b93508360ff1681518110610aec57610aec6112bf565b6001600160e01b0319909216602092830291909101909101526306e8677d60e11b81610b17846112a2565b93508360ff1681518110610b2d57610b2d6112bf565b6001600160e01b03199092166020928302919091019091015263469ef8d960e11b81610b58846112a2565b93508360ff1681518110610b6e57610b6e6112bf565b6001600160e01b03199092166020928302919091019091015260ff821615610bd85760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610981565b92915050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215610c60576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60198181548110610a2157600080fd5b60118181548110610a2157600080fd5b6001546001600160a01b0316331480610cc057506016546001600160a01b031633145b610cf55760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610981565b60408051606081018252602280546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b92820192909252908290610d3c828261119e565b9050507f1f259051c3c5d7c898a1194cce1b9e9a037675b276b1dff78534ff76d6ef12928183604051610a05929190611229565b60076020528160005260406000208181548110610d8c57600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381168114610dbd57600080fd5b50565b600060208284031215610dd257600080fd5b8135610ddd81610da8565b9392505050565b81516001600160a01b0316815260208083015160ff169082015260408083015160000b9082015260608101610bd8565b60008060408385031215610e2757600080fd5b8235610e3281610da8565b91506020830135610e4281610da8565b809150509250929050565b60006060828403121561092757600080fd5b600060208284031215610e7157600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610eba5783516001600160e01b03191683529284019291840191600101610e94565b50909695505050505050565b60008060408385031215610ed957600080fd5b8235610ee481610da8565b946020939093013593505050565b600060208284031215610f0457600080fd5b8151610ddd81610da8565b805167ffffffffffffffff81168114610f2757600080fd5b919050565b600060608284031215610f3e57600080fd5b6040516060810181811067ffffffffffffffff82111715610f6f57634e487b7160e01b600052604160045260246000fd5b604052610f7b83610f0f565b8152610f8960208401610f0f565b6020820152604083015163ffffffff81168114610fa557600080fd5b60408201529392505050565b6000825160005b81811015610fd25760208186018101518583015201610fb8565b506000920191825250919050565b60ff81168114610dbd57600080fd5b60006020828403121561100157600080fd5b8151610ddd81610fe0565b634e487b7160e01b600052601160045260246000fd5b80820182811260008312801582168215821617156110425761104261100c565b505092915050565b600181815b8085111561108557816000190482111561106b5761106b61100c565b8085161561107857918102915b93841c939080029061104f565b509250929050565b60008261109c57506001610bd8565b816110a957506000610bd8565b81600181146110bf57600281146110c9576110e5565b6001915050610bd8565b60ff8411156110da576110da61100c565b50506001821b610bd8565b5060208310610133831016604e8410600b8410161715611108575081810a610bd8565b611112838361104a565b80600019048211156111265761112661100c565b029392505050565b6000610ddd838361108d565b8082028115828204841417610bd857610bd861100c565b6000600160ff1b82016111665761116661100c565b5060000390565b60008261118a57634e487b7160e01b600052601260045260246000fd5b500490565b8060000b8114610dbd57600080fd5b81356111a981610da8565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356111d581610fe0565b60ff60a01b60a09190911b166001600160a81b0319821683178117845560408501356112008161118f565b8060a81b60ff60a81b168469ffffffffffffffffffff60b01b8516178317178555505050505050565b82516001600160a01b0316815260208084015160ff169082015260408084015160000b9082015260c08101823561125f81610da8565b6001600160a01b03166060830152602083013561127b81610fe0565b60ff16608083015260408301356112918161118f565b8060000b60a0840152509392505050565b600060ff8216806112b5576112b561100c565b6000190192915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212204ccb593df9e0f3da0696b79dbd580b283258e8d12292d9318d37dddc7d347acb64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061023c5760003560e01c80637515bafa1161013b578063b1034882116100b8578063dbfb09d61161007c578063dbfb09d614610665578063dce1544914610678578063e6653f3d1461068b578063e87554461461069f578063f851a440146106a857600080fd5b8063b103488214610605578063c6c5b0dd14610618578063c91a424f1461062b578063cf6bfd2d1461063e578063d251fefc1461065257600080fd5b80638e8f294b116100ff5780638e8f294b14610552578063940cd6f1146105965780639b19251a146105c1578063ac0b0bb7146105e4578063b0957210146105f857600080fd5b80637515bafa146104a65780637dc0d1d0146104b957806387f76303146104cc57806389f8132e146104e05780638d3df1b2146104f557600080fd5b80632ccf47a4116101c95780634ada90af1161018d5780634ada90af1461043157806352d84d1e1461043a5780636bd02b8a1461044d5780636d154ea514610460578063731f0c2b1461048357600080fd5b80632ccf47a4146103ac5780632d6af6b0146103bf57806331ff47fa146103d45780633c94786f146103fd5780634a5844321461041157600080fd5b806316dc15fe1161021057806316dc15fe1461030a5780631c819e431461032d57806321af45691461035b57806324a3d62214610386578063267822471461039957600080fd5b80627e3dd21461024157806302c3bcbb1461025e5780630a755ec21461028c5780630dd0cefa146102a0575b600080fd5b610249600181565b60405190151581526020015b60405180910390f35b61027e61026c366004610dc0565b60186020526000908152604090205481565b604051908152602001610255565b60025461024990600160a81b900460ff1681565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526022546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b6040516102559190610de4565b610249610318366004610dc0565b600d6020526000908152604090205460ff1681565b61024961033b366004610e14565b601d60209081526000928352604080842090915290825290205460ff1681565b60165461036e906001600160a01b031681565b6040516001600160a01b039091168152602001610255565b60135461036e906001600160a01b031681565b60025461036e906001600160a01b031681565b61027e6103ba366004610dc0565b6106bb565b6103d26103cd366004610e4d565b61092d565b005b61036e6103e2366004610dc0565b600e602052600090815260409020546001600160a01b031681565b60135461024990600160a01b900460ff1681565b61027e61041f366004610dc0565b60176020526000908152604090205481565b61027e60055481565b61036e610448366004610e5f565b610a11565b61036e61045b366004610e5f565b610a3b565b61024961046e366004610dc0565b60156020526000908152604090205460ff1681565b610249610491366004610dc0565b60146020526000908152604090205460ff1681565b61036e6104b4366004610e5f565b610a4b565b60035461036e906001600160a01b031681565b60135461024990600160b01b900460ff1681565b6104e8610a5b565b6040516102559190610e78565b6102fd604080516060810182526000808252602082018190529181019190915250604080516060810182526023546001600160a01b038116825260ff600160a01b8204166020830152600160a81b900460000b9181019190915290565b61057f610560366004610dc0565b6008602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610255565b61027e6105a4366004610e14565b601c60209081526000928352604080842090915290825290205481565b6102496105cf366004610dc0565b60106020526000908152604090205460ff1681565b60135461024990600160b81b900460ff1681565b600f546102499060ff1681565b61027e610613366004610dc0565b610bde565b61036e610626366004610e5f565b610c7d565b60005461036e906001600160a01b031681565b60025461024990600160a01b900460ff1681565b61036e610660366004610e5f565b610c8d565b6103d2610673366004610e4d565b610c9d565b61036e610686366004610ec6565b610d70565b60135461024990600160a81b900460ff1681565b61027e60045481565b60015461036e906001600160a01b031681565b604080516060810182526023546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b938301939093521561090b576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610ef2565b8251602084015160405163197c92ab60e31b81526001600160a01b03808516600483015260ff9092166024820152929350169063cbe4955890604401606060405180830381865afa1580156107ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107de9190610f2c565b602090810151604080516004815260248101825292830180516001600160e01b031663313ce56760e01b1790525167ffffffffffffffff909116945060129160009182916001600160a01b038616916108379190610fb1565b600060405180830381855afa9150503d8060008114610872576040519150601f19603f3d011682016040523d82523d6000602084013e610877565b606091505b509150915081801561088a575080516020145b156108a957808060200190518101906108a39190610fef565b60ff1692505b60408501516108bb9060000b84611022565b9250600083126108e1576108d083600a61112e565b6108da908761113a565b9550610902565b6108ea83611151565b6108f590600a61112e565b6108ff908761116d565b95505b50505050610927565b6001600160a01b03831660009081526018602052604090205491505b50919050565b6001546001600160a01b031633148061095057506016546001600160a01b031633145b61098a5760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b60448201526064015b60405180910390fd5b60408051606081018252602380546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b928201929092529082906109d1828261119e565b9050507f1fd35ea350fffd290d8aecb52fb5db35cf6ce7a0cbb0dfa33a50607998fa193f8183604051610a05929190611229565b60405180910390a15050565b60098181548110610a2157600080fd5b6000918252602090912001546001600160a01b0316905081565b601b8181548110610a2157600080fd5b600b8181548110610a2157600080fd5b60408051600480825260a082019092526060919060009082602082016080803683370190505090506302d6af6b60e41b81610a95846112a2565b93508360ff1681518110610aab57610aab6112bf565b6001600160e01b031990921660209283029190910190910152636dfd84eb60e11b81610ad6846112a2565b93508360ff1681518110610aec57610aec6112bf565b6001600160e01b0319909216602092830291909101909101526306e8677d60e11b81610b17846112a2565b93508360ff1681518110610b2d57610b2d6112bf565b6001600160e01b03199092166020928302919091019091015263469ef8d960e11b81610b58846112a2565b93508360ff1681518110610b6e57610b6e6112bf565b6001600160e01b03199092166020928302919091019091015260ff821615610bd85760405162461bcd60e51b815260206004820152601c60248201527f7573652074686520636f7272656374206172726179206c656e677468000000006044820152606401610981565b92915050565b604080516060810182526022546001600160a01b03811680835260ff600160a01b8304166020840152600160a81b909104600090810b9383019390935215610c60576000836001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073d573d6000803e3d6000fd5b50506001600160a01b031660009081526017602052604090205490565b60198181548110610a2157600080fd5b60118181548110610a2157600080fd5b6001546001600160a01b0316331480610cc057506016546001600160a01b031633145b610cf55760405162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b6044820152606401610981565b60408051606081018252602280546001600160a01b038116835260ff600160a01b8204166020840152600160a81b900460000b92820192909252908290610d3c828261119e565b9050507f1f259051c3c5d7c898a1194cce1b9e9a037675b276b1dff78534ff76d6ef12928183604051610a05929190611229565b60076020528160005260406000208181548110610d8c57600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381168114610dbd57600080fd5b50565b600060208284031215610dd257600080fd5b8135610ddd81610da8565b9392505050565b81516001600160a01b0316815260208083015160ff169082015260408083015160000b9082015260608101610bd8565b60008060408385031215610e2757600080fd5b8235610e3281610da8565b91506020830135610e4281610da8565b809150509250929050565b60006060828403121561092757600080fd5b600060208284031215610e7157600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610eba5783516001600160e01b03191683529284019291840191600101610e94565b50909695505050505050565b60008060408385031215610ed957600080fd5b8235610ee481610da8565b946020939093013593505050565b600060208284031215610f0457600080fd5b8151610ddd81610da8565b805167ffffffffffffffff81168114610f2757600080fd5b919050565b600060608284031215610f3e57600080fd5b6040516060810181811067ffffffffffffffff82111715610f6f57634e487b7160e01b600052604160045260246000fd5b604052610f7b83610f0f565b8152610f8960208401610f0f565b6020820152604083015163ffffffff81168114610fa557600080fd5b60408201529392505050565b6000825160005b81811015610fd25760208186018101518583015201610fb8565b506000920191825250919050565b60ff81168114610dbd57600080fd5b60006020828403121561100157600080fd5b8151610ddd81610fe0565b634e487b7160e01b600052601160045260246000fd5b80820182811260008312801582168215821617156110425761104261100c565b505092915050565b600181815b8085111561108557816000190482111561106b5761106b61100c565b8085161561107857918102915b93841c939080029061104f565b509250929050565b60008261109c57506001610bd8565b816110a957506000610bd8565b81600181146110bf57600281146110c9576110e5565b6001915050610bd8565b60ff8411156110da576110da61100c565b50506001821b610bd8565b5060208310610133831016604e8410600b8410161715611108575081810a610bd8565b611112838361104a565b80600019048211156111265761112661100c565b029392505050565b6000610ddd838361108d565b8082028115828204841417610bd857610bd861100c565b6000600160ff1b82016111665761116661100c565b5060000390565b60008261118a57634e487b7160e01b600052601260045260246000fd5b500490565b8060000b8114610dbd57600080fd5b81356111a981610da8565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356111d581610fe0565b60ff60a01b60a09190911b166001600160a81b0319821683178117845560408501356112008161118f565b8060a81b60ff60a81b168469ffffffffffffffffffff60b01b8516178317178555505050505050565b82516001600160a01b0316815260208084015160ff169082015260408084015160000b9082015260c08101823561125f81610da8565b6001600160a01b03166060830152602083013561127b81610fe0565b60ff16608083015260408301356112918161118f565b8060000b60a0840152509392505050565b600060ff8216806112b5576112b561100c565b6000190192915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212204ccb593df9e0f3da0696b79dbd580b283258e8d12292d9318d37dddc7d347acb64736f6c63430008160033", "devdoc": { "author": "Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)", "events": { @@ -994,7 +994,7 @@ "storageLayout": { "storage": [ { - "astId": 34213, + "astId": 35919, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "ionicAdmin", "offset": 0, @@ -1002,7 +1002,7 @@ "type": "t_address_payable" }, { - "astId": 34216, + "astId": 35922, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "admin", "offset": 0, @@ -1010,7 +1010,7 @@ "type": "t_address" }, { - "astId": 34219, + "astId": 35925, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "pendingAdmin", "offset": 0, @@ -1018,7 +1018,7 @@ "type": "t_address" }, { - "astId": 34223, + "astId": 35929, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "ionicAdminHasRights", "offset": 20, @@ -1026,7 +1026,7 @@ "type": "t_bool" }, { - "astId": 34227, + "astId": 35933, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "adminHasRights", "offset": 21, @@ -1034,15 +1034,15 @@ "type": "t_bool" }, { - "astId": 34260, + "astId": 35966, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "oracle", "offset": 0, "slot": "3", - "type": "t_contract(BasePriceOracle)61817" + "type": "t_contract(BasePriceOracle)66819" }, { - "astId": 34263, + "astId": 35969, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "closeFactorMantissa", "offset": 0, @@ -1050,7 +1050,7 @@ "type": "t_uint256" }, { - "astId": 34266, + "astId": 35972, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "liquidationIncentiveMantissa", "offset": 0, @@ -1058,7 +1058,7 @@ "type": "t_uint256" }, { - "astId": 34268, + "astId": 35974, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "maxAssets", "offset": 0, @@ -1066,31 +1066,31 @@ "type": "t_uint256" }, { - "astId": 34275, + "astId": 35981, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "accountAssets", "offset": 0, "slot": "7", - "type": "t_mapping(t_address,t_array(t_contract(ICErc20)26625)dyn_storage)" + "type": "t_mapping(t_address,t_array(t_contract(ICErc20)28192)dyn_storage)" }, { - "astId": 34293, + "astId": 35999, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "markets", "offset": 0, "slot": "8", - "type": "t_mapping(t_address,t_struct(Market)34287_storage)" + "type": "t_mapping(t_address,t_struct(Market)35993_storage)" }, { - "astId": 34298, + "astId": 36004, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "allMarkets", "offset": 0, "slot": "9", - "type": "t_array(t_contract(ICErc20)26625)dyn_storage" + "type": "t_array(t_contract(ICErc20)28192)dyn_storage" }, { - "astId": 34303, + "astId": 36009, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowers", "offset": 0, @@ -1098,7 +1098,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34307, + "astId": 36013, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "allBorrowers", "offset": 0, @@ -1106,7 +1106,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34311, + "astId": 36017, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowerIndexes", "offset": 0, @@ -1114,7 +1114,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34316, + "astId": 36022, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "suppliers", "offset": 0, @@ -1122,15 +1122,15 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34322, + "astId": 36028, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "cTokensByUnderlying", "offset": 0, "slot": "14", - "type": "t_mapping(t_address,t_contract(ICErc20)26625)" + "type": "t_mapping(t_address,t_contract(ICErc20)28192)" }, { - "astId": 34325, + "astId": 36031, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "enforceWhitelist", "offset": 0, @@ -1138,7 +1138,7 @@ "type": "t_bool" }, { - "astId": 34330, + "astId": 36036, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "whitelist", "offset": 0, @@ -1146,7 +1146,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34334, + "astId": 36040, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "whitelistArray", "offset": 0, @@ -1154,7 +1154,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34338, + "astId": 36044, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "whitelistIndexes", "offset": 0, @@ -1162,7 +1162,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34341, + "astId": 36047, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "pauseGuardian", "offset": 0, @@ -1170,7 +1170,7 @@ "type": "t_address" }, { - "astId": 34343, + "astId": 36049, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_mintGuardianPaused", "offset": 20, @@ -1178,7 +1178,7 @@ "type": "t_bool" }, { - "astId": 34345, + "astId": 36051, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_borrowGuardianPaused", "offset": 21, @@ -1186,7 +1186,7 @@ "type": "t_bool" }, { - "astId": 34347, + "astId": 36053, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "transferGuardianPaused", "offset": 22, @@ -1194,7 +1194,7 @@ "type": "t_bool" }, { - "astId": 34349, + "astId": 36055, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "seizeGuardianPaused", "offset": 23, @@ -1202,7 +1202,7 @@ "type": "t_bool" }, { - "astId": 34353, + "astId": 36059, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "mintGuardianPaused", "offset": 0, @@ -1210,7 +1210,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34357, + "astId": 36063, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowGuardianPaused", "offset": 0, @@ -1218,7 +1218,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 34363, + "astId": 36069, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowCapGuardian", "offset": 0, @@ -1226,7 +1226,7 @@ "type": "t_address" }, { - "astId": 34368, + "astId": 36074, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowCaps", "offset": 0, @@ -1234,7 +1234,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34373, + "astId": 36079, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "supplyCaps", "offset": 0, @@ -1242,7 +1242,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 34377, + "astId": 36083, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "rewardsDistributors", "offset": 0, @@ -1250,7 +1250,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34380, + "astId": 36086, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_notEntered", "offset": 0, @@ -1258,7 +1258,7 @@ "type": "t_bool" }, { - "astId": 34383, + "astId": 36089, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_notEnteredInitialized", "offset": 1, @@ -1266,7 +1266,7 @@ "type": "t_bool" }, { - "astId": 34387, + "astId": 36093, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "nonAccruingRewardsDistributors", "offset": 0, @@ -1274,7 +1274,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 34394, + "astId": 36100, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowCapForCollateral", "offset": 0, @@ -1282,7 +1282,7 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" }, { - "astId": 34401, + "astId": 36107, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowingAgainstCollateralBlacklist", "offset": 0, @@ -1290,52 +1290,52 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 34409, + "astId": 36115, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowCapForCollateralWhitelist", "offset": 0, "slot": "30", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))" }, { - "astId": 34417, + "astId": 36123, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowingAgainstCollateralBlacklistWhitelist", "offset": 0, "slot": "31", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))" }, { - "astId": 34423, + "astId": 36129, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "supplyCapWhitelist", "offset": 0, "slot": "32", - "type": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "type": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, { - "astId": 34429, + "astId": 36135, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowCapWhitelist", "offset": 0, "slot": "33", - "type": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "type": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, { - "astId": 34436, + "astId": 36142, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "borrowCapConfig", "offset": 0, "slot": "34", - "type": "t_struct(PrudentiaConfig)19800_storage" + "type": "t_struct(PrudentiaConfig)21191_storage" }, { - "astId": 34440, + "astId": 36146, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "supplyCapConfig", "offset": 0, "slot": "35", - "type": "t_struct(PrudentiaConfig)19800_storage" + "type": "t_struct(PrudentiaConfig)21191_storage" } ], "types": { @@ -1361,8 +1361,8 @@ "label": "bytes32[]", "numberOfBytes": "32" }, - "t_array(t_contract(ICErc20)26625)dyn_storage": { - "base": "t_contract(ICErc20)26625", + "t_array(t_contract(ICErc20)28192)dyn_storage": { + "base": "t_contract(ICErc20)28192", "encoding": "dynamic_array", "label": "contract ICErc20[]", "numberOfBytes": "32" @@ -1377,12 +1377,12 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(BasePriceOracle)61817": { + "t_contract(BasePriceOracle)66819": { "encoding": "inplace", "label": "contract BasePriceOracle", "numberOfBytes": "20" }, - "t_contract(ICErc20)26625": { + "t_contract(ICErc20)28192": { "encoding": "inplace", "label": "contract ICErc20", "numberOfBytes": "20" @@ -1392,12 +1392,12 @@ "label": "int8", "numberOfBytes": "1" }, - "t_mapping(t_address,t_array(t_contract(ICErc20)26625)dyn_storage)": { + "t_mapping(t_address,t_array(t_contract(ICErc20)28192)dyn_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract ICErc20[])", "numberOfBytes": "32", - "value": "t_array(t_contract(ICErc20)26625)dyn_storage" + "value": "t_array(t_contract(ICErc20)28192)dyn_storage" }, "t_mapping(t_address,t_bool)": { "encoding": "mapping", @@ -1406,12 +1406,12 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_address,t_contract(ICErc20)26625)": { + "t_mapping(t_address,t_contract(ICErc20)28192)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract ICErc20)", "numberOfBytes": "32", - "value": "t_contract(ICErc20)26625" + "value": "t_contract(ICErc20)28192" }, "t_mapping(t_address,t_mapping(t_address,t_bool))": { "encoding": "mapping", @@ -1420,12 +1420,12 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_bool)" }, - "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)8457_storage))": { + "t_mapping(t_address,t_mapping(t_address,t_struct(AddressSet)9069_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(address => struct EnumerableSet.AddressSet))", "numberOfBytes": "32", - "value": "t_mapping(t_address,t_struct(AddressSet)8457_storage)" + "value": "t_mapping(t_address,t_struct(AddressSet)9069_storage)" }, "t_mapping(t_address,t_mapping(t_address,t_uint256))": { "encoding": "mapping", @@ -1434,19 +1434,19 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_uint256)" }, - "t_mapping(t_address,t_struct(AddressSet)8457_storage)": { + "t_mapping(t_address,t_struct(AddressSet)9069_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct EnumerableSet.AddressSet)", "numberOfBytes": "32", - "value": "t_struct(AddressSet)8457_storage" + "value": "t_struct(AddressSet)9069_storage" }, - "t_mapping(t_address,t_struct(Market)34287_storage)": { + "t_mapping(t_address,t_struct(Market)35993_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ComptrollerV2Storage.Market)", "numberOfBytes": "32", - "value": "t_struct(Market)34287_storage" + "value": "t_struct(Market)35993_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -1462,27 +1462,27 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(AddressSet)8457_storage": { + "t_struct(AddressSet)9069_storage": { "encoding": "inplace", "label": "struct EnumerableSet.AddressSet", "members": [ { - "astId": 8456, + "astId": 9068, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_inner", "offset": 0, "slot": "0", - "type": "t_struct(Set)8142_storage" + "type": "t_struct(Set)8754_storage" } ], "numberOfBytes": "64" }, - "t_struct(Market)34287_storage": { + "t_struct(Market)35993_storage": { "encoding": "inplace", "label": "struct ComptrollerV2Storage.Market", "members": [ { - "astId": 34280, + "astId": 35986, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "isListed", "offset": 0, @@ -1490,7 +1490,7 @@ "type": "t_bool" }, { - "astId": 34282, + "astId": 35988, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "collateralFactorMantissa", "offset": 0, @@ -1498,7 +1498,7 @@ "type": "t_uint256" }, { - "astId": 34286, + "astId": 35992, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "accountMembership", "offset": 0, @@ -1508,12 +1508,12 @@ ], "numberOfBytes": "96" }, - "t_struct(PrudentiaConfig)19800_storage": { + "t_struct(PrudentiaConfig)21191_storage": { "encoding": "inplace", "label": "struct PrudentiaLib.PrudentiaConfig", "members": [ { - "astId": 19795, + "astId": 21186, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "controller", "offset": 0, @@ -1521,7 +1521,7 @@ "type": "t_address" }, { - "astId": 19797, + "astId": 21188, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "offset", "offset": 20, @@ -1529,7 +1529,7 @@ "type": "t_uint8" }, { - "astId": 19799, + "astId": 21190, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "decimalShift", "offset": 21, @@ -1539,12 +1539,12 @@ ], "numberOfBytes": "32" }, - "t_struct(Set)8142_storage": { + "t_struct(Set)8754_storage": { "encoding": "inplace", "label": "struct EnumerableSet.Set", "members": [ { - "astId": 8137, + "astId": 8749, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_values", "offset": 0, @@ -1552,7 +1552,7 @@ "type": "t_array(t_bytes32)dyn_storage" }, { - "astId": 8141, + "astId": 8753, "contract": "contracts/compound/ComptrollerPrudentiaCapsExt.sol:ComptrollerPrudentiaCapsExt", "label": "_indexes", "offset": 0, diff --git a/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e.json b/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e.json new file mode 100644 index 0000000000..9c809f5c82 --- /dev/null +++ b/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e.json @@ -0,0 +1,513 @@ +{ + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBribeToken", + "type": "address" + } + ], + "name": "BribeTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Distributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "morphoMarket", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "morphoBribes", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoBribes", + "type": "address" + } + ], + "name": "MorphoBribesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoMarket", + "type": "address" + } + ], + "name": "MorphoMarketSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "distribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + }, + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "morphoBribes", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "morphoMarket", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "setMorphoBribes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + } + ], + "name": "setMorphoMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "transactionIndex": 110, + "gasUsed": "817143", + "logsBloom": "0x00000000000000000008000000000000400000000000000020800000000000000000000000800000000000000800000000000000040000000000000400000000000004000000000000000000008002000001000040000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000001000000000000000000000000000400080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000040000400000024000000000020000000000020000000000000000000000000000000000000040004000000000000", + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1", + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "logs": [ + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000de621f25bf616124e0548137e6dadae98a3b9124" + ], + "data": "0x", + "logIndex": 276, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 277, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc2", + "0x000000000000000000000000b68eb52a33374cd8512d8021fde3b6871a62c52e", + "0x00000000000000000000000021d595170f2125d87194581222c97cd75fb0a573" + ], + "data": "0x", + "logIndex": 278, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 279, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 280, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + } + ], + "blockNumber": 25921075, + "cumulativeGasUsed": "24250389", + "status": 1, + "byzantium": true + }, + "args": [ + "0xDE621F25bF616124E0548137e6dadAe98a3B9124", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000b68eb52a33374cd8512d8021fde3b6871a62c52e00000000000000000000000021d595170f2125d87194581222c97cd75fb0a573" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e", + "0x21D595170F2125D87194581222c97cD75FB0A573" + ] + }, + "implementation": "0xDE621F25bF616124E0548137e6dadAe98a3B9124", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Implementation.json b/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Implementation.json new file mode 100644 index 0000000000..9b58aa4994 --- /dev/null +++ b/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Implementation.json @@ -0,0 +1,418 @@ +{ + "address": "0xDE621F25bF616124E0548137e6dadAe98a3B9124", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBribeToken", + "type": "address" + } + ], + "name": "BribeTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Distributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "morphoMarket", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "morphoBribes", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoBribes", + "type": "address" + } + ], + "name": "MorphoBribesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoMarket", + "type": "address" + } + ], + "name": "MorphoMarketSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "distribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + }, + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "morphoBribes", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "morphoMarket", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "setMorphoBribes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + } + ], + "name": "setMorphoMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7f5265a2f3f8b43094b8116f894adaaee498041f4539eac00772450cd785d093", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xDE621F25bF616124E0548137e6dadAe98a3B9124", + "transactionIndex": 115, + "gasUsed": "660476", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x91d3e4f4fc3eed97dff7c4bd755f1550247b069b86b1a0cc0321472a3f587782", + "transactionHash": "0x7f5265a2f3f8b43094b8116f894adaaee498041f4539eac00772450cd785d093", + "logs": [], + "blockNumber": 25921071, + "cumulativeGasUsed": "27467622", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a198deba20a3c9464a98ef0313fee382", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBribeToken\",\"type\":\"address\"}],\"name\":\"BribeTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Distributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"morphoMarket\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"morphoBribes\",\"type\":\"address\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newMorphoBribes\",\"type\":\"address\"}],\"name\":\"MorphoBribesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newMorphoMarket\",\"type\":\"address\"}],\"name\":\"MorphoMarketSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"distribute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_morphoMarket\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_morphoBribes\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"morphoBribes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"morphoMarket\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_morphoBribes\",\"type\":\"address\"}],\"name\":\"setMorphoBribes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_morphoMarket\",\"type\":\"address\"}],\"name\":\"setMorphoMarket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract handles the distribution of bribe tokens to the Morpho protocol.\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"distribute(address,uint256)\":{\"params\":{\"_amount\":\"Amount of tokens to distribute\"}},\"initialize(address,address)\":{\"params\":{\"_morphoBribes\":\"Address of the Morpho bribes contract\",\"_morphoMarket\":\"Address of the Morpho market\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setMorphoBribes(address)\":{\"params\":{\"_morphoBribes\":\"New address of the Morpho bribes contract\"}},\"setMorphoMarket(address)\":{\"params\":{\"_morphoMarket\":\"New address of the Morpho market\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"MorphoBribeDistributor\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"distribute(address,uint256)\":{\"notice\":\"Distributes bribe tokens to the Morpho bribes contract\"},\"initialize(address,address)\":{\"notice\":\"Initializes the MorphoBribeDistributor contract\"},\"morphoBribes()\":{\"notice\":\"Address of the Morpho bribes contract\"},\"morphoMarket()\":{\"notice\":\"Address of the Morpho market\"},\"setMorphoBribes(address)\":{\"notice\":\"Sets the address of the Morpho bribes contract\"},\"setMorphoMarket(address)\":{\"notice\":\"Sets the address of the Morpho market\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ionic/MorphoBribeDistributor.sol\":\"MorphoBribeDistributor\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/ionic/MorphoBribeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { IBribeRewards } from \\\"../veION/interfaces/IBribeRewards.sol\\\";\\r\\nimport { IERC20, SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { OwnableUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title MorphoBribeDistributor\\r\\n * @dev This contract handles the distribution of bribe tokens to the Morpho protocol.\\r\\n */\\r\\ncontract MorphoBribeDistributor is OwnableUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n /// @notice Address of the Morpho market\\r\\n address public morphoMarket;\\r\\n /// @notice Address of the Morpho bribes contract\\r\\n address public morphoBribes;\\r\\n\\r\\n event Initialized(address indexed morphoMarket, address indexed morphoBribes);\\r\\n event Distributed(address indexed from, uint256 amount);\\r\\n event MorphoMarketSet(address indexed newMorphoMarket);\\r\\n event MorphoBribesSet(address indexed newMorphoBribes);\\r\\n event BribeTokenSet(address indexed newBribeToken);\\r\\n\\r\\n /**\\r\\n * @dev Modifier to restrict access to only the Morpho market\\r\\n */\\r\\n modifier onlyMorphoMarket() {\\r\\n require(msg.sender == morphoMarket, \\\"Caller is not the Morpho Market\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the MorphoBribeDistributor contract\\r\\n * @param _morphoMarket Address of the Morpho market\\r\\n * @param _morphoBribes Address of the Morpho bribes contract\\r\\n */\\r\\n function initialize(address _morphoMarket, address _morphoBribes) public initializer {\\r\\n __Ownable_init();\\r\\n morphoMarket = _morphoMarket;\\r\\n morphoBribes = _morphoBribes;\\r\\n emit Initialized(_morphoMarket, _morphoBribes);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Distributes bribe tokens to the Morpho bribes contract\\r\\n * @param _amount Amount of tokens to distribute\\r\\n */\\r\\n function distribute(address _rewardToken, uint256 _amount) external onlyMorphoMarket {\\r\\n IERC20(_rewardToken).safeTransferFrom(msg.sender, address(this), _amount);\\r\\n IERC20(_rewardToken).approve(morphoBribes, _amount);\\r\\n IBribeRewards(morphoBribes).notifyRewardAmount(_rewardToken, _amount);\\r\\n emit Distributed(msg.sender, _amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the Morpho market\\r\\n * @param _morphoMarket New address of the Morpho market\\r\\n */\\r\\n function setMorphoMarket(address _morphoMarket) external onlyOwner {\\r\\n morphoMarket = _morphoMarket;\\r\\n emit MorphoMarketSet(_morphoMarket);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the Morpho bribes contract\\r\\n * @param _morphoBribes New address of the Morpho bribes contract\\r\\n */\\r\\n function setMorphoBribes(address _morphoBribes) external onlyOwner {\\r\\n morphoBribes = _morphoBribes;\\r\\n emit MorphoBribesSet(_morphoBribes);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xd65afb2939fd06941fc15f518028811c5b710722dbaea1af3f59e01c7662835c\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610afb806100206000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a6146101025780638da5cb5b1461010a5780639085752e1461011b578063f2fde38b1461012e578063fb9321081461014157600080fd5b80630cb3d7de1461009857806342913b98146100ad578063485cc955146100dc5780635db526b8146100ef575b600080fd5b6100ab6100a6366004610966565b610154565b005b6066546100c0906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100ab6100ea366004610988565b6101a6565b6065546100c0906001600160a01b031681565b6100ab610318565b6033546001600160a01b03166100c0565b6100ab610129366004610966565b61032c565b6100ab61013c366004610966565b61037e565b6100ab61014f3660046109bb565b6103f7565b61015c61057d565b606680546001600160a01b0319166001600160a01b0383169081179091556040517fcaf262dbe223e6b3b567ee0679224dc31ef9f12f768063f367131de7b97604b890600090a250565b600054610100900460ff16158080156101c65750600054600160ff909116105b806101e05750303b1580156101e0575060005460ff166001145b6102485760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561026b576000805461ff0019166101001790555b6102736105d7565b606580546001600160a01b03199081166001600160a01b03868116918217909355606680549092169285169283179091556040517f3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc290600090a38015610313576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b61032061057d565b61032a6000610606565b565b61033461057d565b606580546001600160a01b0319166001600160a01b0383169081179091556040517f64275ebd7c54c5d745cd7bf4a8eb118b5865edcd08710b73e7ca7d89e881a2d890600090a250565b61038661057d565b6001600160a01b0381166103eb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b6103f481610606565b50565b6065546001600160a01b031633146104515760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f7420746865204d6f7270686f204d61726b657400604482015260640161023f565b6104666001600160a01b038316333084610658565b60665460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529083169063095ea7b3906044016020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd91906109e5565b5060665460405163b66503cf60e01b81526001600160a01b038481166004830152602482018490529091169063b66503cf90604401600060405180830381600087803b15801561052c57600080fd5b505af1158015610540573d6000803e3d6000fd5b50506040518381523392507fb649c98f58055c520df0dcb5709eff2e931217ff2fb1e21376130d31bbb1c0af915060200160405180910390a25050565b6033546001600160a01b0316331461032a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161023f565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161023f90610a07565b61032a6106b8565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526106b29085906106e8565b50505050565b600054610100900460ff166106df5760405162461bcd60e51b815260040161023f90610a07565b61032a33610606565b600061073d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107ba9092919063ffffffff16565b805190915015610313578080602001905181019061075b91906109e5565b6103135760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161023f565b60606107c984846000856107d1565b949350505050565b6060824710156108325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161023f565b600080866001600160a01b0316858760405161084e9190610a76565b60006040518083038185875af1925050503d806000811461088b576040519150601f19603f3d011682016040523d82523d6000602084013e610890565b606091505b50915091506108a1878383876108ac565b979650505050505050565b6060831561091b578251600003610914576001600160a01b0385163b6109145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161023f565b50816107c9565b6107c983838151156109305781518083602001fd5b8060405162461bcd60e51b815260040161023f9190610a92565b80356001600160a01b038116811461096157600080fd5b919050565b60006020828403121561097857600080fd5b6109818261094a565b9392505050565b6000806040838503121561099b57600080fd5b6109a48361094a565b91506109b26020840161094a565b90509250929050565b600080604083850312156109ce57600080fd5b6109d78361094a565b946020939093013593505050565b6000602082840312156109f757600080fd5b8151801515811461098157600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015610a6d578181015183820152602001610a55565b50506000910152565b60008251610a88818460208701610a52565b9190910192915050565b6020815260008251806020840152610ab1816040850160208701610a52565b601f01601f1916919091016040019291505056fea264697066735822122040271407380f177433edc7b5b62c3693ecffb96ba32de68272826214376b2d5f64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a6146101025780638da5cb5b1461010a5780639085752e1461011b578063f2fde38b1461012e578063fb9321081461014157600080fd5b80630cb3d7de1461009857806342913b98146100ad578063485cc955146100dc5780635db526b8146100ef575b600080fd5b6100ab6100a6366004610966565b610154565b005b6066546100c0906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100ab6100ea366004610988565b6101a6565b6065546100c0906001600160a01b031681565b6100ab610318565b6033546001600160a01b03166100c0565b6100ab610129366004610966565b61032c565b6100ab61013c366004610966565b61037e565b6100ab61014f3660046109bb565b6103f7565b61015c61057d565b606680546001600160a01b0319166001600160a01b0383169081179091556040517fcaf262dbe223e6b3b567ee0679224dc31ef9f12f768063f367131de7b97604b890600090a250565b600054610100900460ff16158080156101c65750600054600160ff909116105b806101e05750303b1580156101e0575060005460ff166001145b6102485760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561026b576000805461ff0019166101001790555b6102736105d7565b606580546001600160a01b03199081166001600160a01b03868116918217909355606680549092169285169283179091556040517f3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc290600090a38015610313576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b61032061057d565b61032a6000610606565b565b61033461057d565b606580546001600160a01b0319166001600160a01b0383169081179091556040517f64275ebd7c54c5d745cd7bf4a8eb118b5865edcd08710b73e7ca7d89e881a2d890600090a250565b61038661057d565b6001600160a01b0381166103eb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b6103f481610606565b50565b6065546001600160a01b031633146104515760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f7420746865204d6f7270686f204d61726b657400604482015260640161023f565b6104666001600160a01b038316333084610658565b60665460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529083169063095ea7b3906044016020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd91906109e5565b5060665460405163b66503cf60e01b81526001600160a01b038481166004830152602482018490529091169063b66503cf90604401600060405180830381600087803b15801561052c57600080fd5b505af1158015610540573d6000803e3d6000fd5b50506040518381523392507fb649c98f58055c520df0dcb5709eff2e931217ff2fb1e21376130d31bbb1c0af915060200160405180910390a25050565b6033546001600160a01b0316331461032a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161023f565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161023f90610a07565b61032a6106b8565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526106b29085906106e8565b50505050565b600054610100900460ff166106df5760405162461bcd60e51b815260040161023f90610a07565b61032a33610606565b600061073d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107ba9092919063ffffffff16565b805190915015610313578080602001905181019061075b91906109e5565b6103135760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161023f565b60606107c984846000856107d1565b949350505050565b6060824710156108325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161023f565b600080866001600160a01b0316858760405161084e9190610a76565b60006040518083038185875af1925050503d806000811461088b576040519150601f19603f3d011682016040523d82523d6000602084013e610890565b606091505b50915091506108a1878383876108ac565b979650505050505050565b6060831561091b578251600003610914576001600160a01b0385163b6109145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161023f565b50816107c9565b6107c983838151156109305781518083602001fd5b8060405162461bcd60e51b815260040161023f9190610a92565b80356001600160a01b038116811461096157600080fd5b919050565b60006020828403121561097857600080fd5b6109818261094a565b9392505050565b6000806040838503121561099b57600080fd5b6109a48361094a565b91506109b26020840161094a565b90509250929050565b600080604083850312156109ce57600080fd5b6109d78361094a565b946020939093013593505050565b6000602082840312156109f757600080fd5b8151801515811461098157600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015610a6d578181015183820152602001610a55565b50506000910152565b60008251610a88818460208701610a52565b9190910192915050565b6020815260008251806020840152610ab1816040850160208701610a52565b601f01601f1916919091016040019291505056fea264697066735822122040271407380f177433edc7b5b62c3693ecffb96ba32de68272826214376b2d5f64736f6c63430008160033", + "devdoc": { + "details": "This contract handles the distribution of bribe tokens to the Morpho protocol.", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "distribute(address,uint256)": { + "params": { + "_amount": "Amount of tokens to distribute" + } + }, + "initialize(address,address)": { + "params": { + "_morphoBribes": "Address of the Morpho bribes contract", + "_morphoMarket": "Address of the Morpho market" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setMorphoBribes(address)": { + "params": { + "_morphoBribes": "New address of the Morpho bribes contract" + } + }, + "setMorphoMarket(address)": { + "params": { + "_morphoMarket": "New address of the Morpho market" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "MorphoBribeDistributor", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "distribute(address,uint256)": { + "notice": "Distributes bribe tokens to the Morpho bribes contract" + }, + "initialize(address,address)": { + "notice": "Initializes the MorphoBribeDistributor contract" + }, + "morphoBribes()": { + "notice": "Address of the Morpho bribes contract" + }, + "morphoMarket()": { + "notice": "Address of the Morpho market" + }, + "setMorphoBribes(address)": { + "notice": "Sets the address of the Morpho bribes contract" + }, + "setMorphoMarket(address)": { + "notice": "Sets the address of the Morpho market" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 412, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 415, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 2763, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 24650, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "morphoMarket", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 24653, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "morphoBribes", + "offset": 0, + "slot": "102", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Proxy.json b/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Proxy.json new file mode 100644 index 0000000000..f5ea7f60e0 --- /dev/null +++ b/packages/contracts/deployments/base/MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Proxy.json @@ -0,0 +1,275 @@ +{ + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "transactionIndex": 110, + "gasUsed": "817143", + "logsBloom": "0x00000000000000000008000000000000400000000000000020800000000000000000000000800000000000000800000000000000040000000000000400000000000004000000000000000000008002000001000040000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000001000000000000000000000000000400080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000040000400000024000000000020000000000020000000000000000000000000000000000000040004000000000000", + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1", + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "logs": [ + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000de621f25bf616124e0548137e6dadae98a3b9124" + ], + "data": "0x", + "logIndex": 276, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 277, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc2", + "0x000000000000000000000000b68eb52a33374cd8512d8021fde3b6871a62c52e", + "0x00000000000000000000000021d595170f2125d87194581222c97cd75fb0a573" + ], + "data": "0x", + "logIndex": 278, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 279, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + }, + { + "transactionIndex": 110, + "blockNumber": 25921075, + "transactionHash": "0x86f2530f598db89035b1e05ec58a25036cb33bd8e8b460c19ee2d35d277168d2", + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 280, + "blockHash": "0x1a7ade625ee6d1ed06d084655856d16e8a4a8243b82cdd5516f9f55bc45a3af1" + } + ], + "blockNumber": 25921075, + "cumulativeGasUsed": "24250389", + "status": 1, + "byzantium": true + }, + "args": [ + "0xDE621F25bF616124E0548137e6dadAe98a3B9124", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000b68eb52a33374cd8512d8021fde3b6871a62c52e00000000000000000000000021d595170f2125d87194581222c97cd75fb0a573" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808.json b/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808.json new file mode 100644 index 0000000000..9bc3ea4ded --- /dev/null +++ b/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808.json @@ -0,0 +1,513 @@ +{ + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBribeToken", + "type": "address" + } + ], + "name": "BribeTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Distributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "morphoMarket", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "morphoBribes", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoBribes", + "type": "address" + } + ], + "name": "MorphoBribesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoMarket", + "type": "address" + } + ], + "name": "MorphoMarketSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "distribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + }, + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "morphoBribes", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "morphoMarket", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "setMorphoBribes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + } + ], + "name": "setMorphoMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "transactionIndex": 205, + "gasUsed": "817143", + "logsBloom": "0x000002000000000000000000000000005000000400000000208040000a0000000000090000000000000000000800000000000000000000000000000000000000000004000000000000000000000002000001000040000000000000000000000000000000020000000000000800000800000000800000008000000000000000400000000000000000000000000800000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000002000000000020000000000000000000040000040000000400000004000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26", + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "logs": [ + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000b98c673f7973a996fb9106b7d1d21e5b7b0a888a" + ], + "data": "0x", + "logIndex": 572, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 573, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc2", + "0x000000000000000000000000a2403211f91d4be497f54ce620ab8e1da770d808", + "0x00000000000000000000000084d0fb659b2ea9a11b3e53561bfb148638912618" + ], + "data": "0x", + "logIndex": 574, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 575, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 576, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + } + ], + "blockNumber": 25920992, + "cumulativeGasUsed": "37175590", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB98c673F7973a996FB9106B7d1D21E5B7b0A888a", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000a2403211f91d4be497f54ce620ab8e1da770d80800000000000000000000000084d0fb659b2ea9a11b3e53561bfb148638912618" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0xa2403211F91D4be497F54ce620Ab8e1dA770d808", + "0x84D0Fb659b2eA9A11B3e53561bFB148638912618" + ] + }, + "implementation": "0xB98c673F7973a996FB9106B7d1D21E5B7b0A888a", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Implementation.json b/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Implementation.json new file mode 100644 index 0000000000..cd79a3c224 --- /dev/null +++ b/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Implementation.json @@ -0,0 +1,418 @@ +{ + "address": "0xB98c673F7973a996FB9106B7d1D21E5B7b0A888a", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBribeToken", + "type": "address" + } + ], + "name": "BribeTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Distributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "morphoMarket", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "morphoBribes", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoBribes", + "type": "address" + } + ], + "name": "MorphoBribesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newMorphoMarket", + "type": "address" + } + ], + "name": "MorphoMarketSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "distribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + }, + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "morphoBribes", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "morphoMarket", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoBribes", + "type": "address" + } + ], + "name": "setMorphoBribes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_morphoMarket", + "type": "address" + } + ], + "name": "setMorphoMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xef02fba012511c4d5c34c5c90182ad27d326540887dc32a96b5a120289a00596", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xB98c673F7973a996FB9106B7d1D21E5B7b0A888a", + "transactionIndex": 149, + "gasUsed": "660476", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb335ebb9372f2ba75dbe64d2e938ec7901a7800754e57fd1882ce0583f5027ba", + "transactionHash": "0xef02fba012511c4d5c34c5c90182ad27d326540887dc32a96b5a120289a00596", + "logs": [], + "blockNumber": 25920988, + "cumulativeGasUsed": "27348137", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a198deba20a3c9464a98ef0313fee382", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBribeToken\",\"type\":\"address\"}],\"name\":\"BribeTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Distributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"morphoMarket\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"morphoBribes\",\"type\":\"address\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newMorphoBribes\",\"type\":\"address\"}],\"name\":\"MorphoBribesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newMorphoMarket\",\"type\":\"address\"}],\"name\":\"MorphoMarketSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"distribute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_morphoMarket\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_morphoBribes\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"morphoBribes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"morphoMarket\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_morphoBribes\",\"type\":\"address\"}],\"name\":\"setMorphoBribes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_morphoMarket\",\"type\":\"address\"}],\"name\":\"setMorphoMarket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract handles the distribution of bribe tokens to the Morpho protocol.\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"distribute(address,uint256)\":{\"params\":{\"_amount\":\"Amount of tokens to distribute\"}},\"initialize(address,address)\":{\"params\":{\"_morphoBribes\":\"Address of the Morpho bribes contract\",\"_morphoMarket\":\"Address of the Morpho market\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setMorphoBribes(address)\":{\"params\":{\"_morphoBribes\":\"New address of the Morpho bribes contract\"}},\"setMorphoMarket(address)\":{\"params\":{\"_morphoMarket\":\"New address of the Morpho market\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"MorphoBribeDistributor\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"distribute(address,uint256)\":{\"notice\":\"Distributes bribe tokens to the Morpho bribes contract\"},\"initialize(address,address)\":{\"notice\":\"Initializes the MorphoBribeDistributor contract\"},\"morphoBribes()\":{\"notice\":\"Address of the Morpho bribes contract\"},\"morphoMarket()\":{\"notice\":\"Address of the Morpho market\"},\"setMorphoBribes(address)\":{\"notice\":\"Sets the address of the Morpho bribes contract\"},\"setMorphoMarket(address)\":{\"notice\":\"Sets the address of the Morpho market\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ionic/MorphoBribeDistributor.sol\":\"MorphoBribeDistributor\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/ionic/MorphoBribeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { IBribeRewards } from \\\"../veION/interfaces/IBribeRewards.sol\\\";\\r\\nimport { IERC20, SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { OwnableUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title MorphoBribeDistributor\\r\\n * @dev This contract handles the distribution of bribe tokens to the Morpho protocol.\\r\\n */\\r\\ncontract MorphoBribeDistributor is OwnableUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n /// @notice Address of the Morpho market\\r\\n address public morphoMarket;\\r\\n /// @notice Address of the Morpho bribes contract\\r\\n address public morphoBribes;\\r\\n\\r\\n event Initialized(address indexed morphoMarket, address indexed morphoBribes);\\r\\n event Distributed(address indexed from, uint256 amount);\\r\\n event MorphoMarketSet(address indexed newMorphoMarket);\\r\\n event MorphoBribesSet(address indexed newMorphoBribes);\\r\\n event BribeTokenSet(address indexed newBribeToken);\\r\\n\\r\\n /**\\r\\n * @dev Modifier to restrict access to only the Morpho market\\r\\n */\\r\\n modifier onlyMorphoMarket() {\\r\\n require(msg.sender == morphoMarket, \\\"Caller is not the Morpho Market\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the MorphoBribeDistributor contract\\r\\n * @param _morphoMarket Address of the Morpho market\\r\\n * @param _morphoBribes Address of the Morpho bribes contract\\r\\n */\\r\\n function initialize(address _morphoMarket, address _morphoBribes) public initializer {\\r\\n __Ownable_init();\\r\\n morphoMarket = _morphoMarket;\\r\\n morphoBribes = _morphoBribes;\\r\\n emit Initialized(_morphoMarket, _morphoBribes);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Distributes bribe tokens to the Morpho bribes contract\\r\\n * @param _amount Amount of tokens to distribute\\r\\n */\\r\\n function distribute(address _rewardToken, uint256 _amount) external onlyMorphoMarket {\\r\\n IERC20(_rewardToken).safeTransferFrom(msg.sender, address(this), _amount);\\r\\n IERC20(_rewardToken).approve(morphoBribes, _amount);\\r\\n IBribeRewards(morphoBribes).notifyRewardAmount(_rewardToken, _amount);\\r\\n emit Distributed(msg.sender, _amount);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the Morpho market\\r\\n * @param _morphoMarket New address of the Morpho market\\r\\n */\\r\\n function setMorphoMarket(address _morphoMarket) external onlyOwner {\\r\\n morphoMarket = _morphoMarket;\\r\\n emit MorphoMarketSet(_morphoMarket);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the Morpho bribes contract\\r\\n * @param _morphoBribes New address of the Morpho bribes contract\\r\\n */\\r\\n function setMorphoBribes(address _morphoBribes) external onlyOwner {\\r\\n morphoBribes = _morphoBribes;\\r\\n emit MorphoBribesSet(_morphoBribes);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xd65afb2939fd06941fc15f518028811c5b710722dbaea1af3f59e01c7662835c\",\"license\":\"UNLICENSED\"},\"contracts/veION/interfaces/IBribeRewards.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IBribeRewards {\\r\\n /// @notice A checkpoint for marking balance\\r\\n struct Checkpoint {\\r\\n uint256 timestamp;\\r\\n uint256 balanceOf;\\r\\n }\\r\\n\\r\\n /// @notice A checkpoint for marking supply\\r\\n struct SupplyCheckpoint {\\r\\n uint256 timestamp;\\r\\n uint256 supply;\\r\\n }\\r\\n\\r\\n struct EarnedVars {\\r\\n uint256 totalReward;\\r\\n uint256 reward;\\r\\n uint256 supplyValue;\\r\\n uint256 epochBalanceValue;\\r\\n uint256 currTs;\\r\\n uint256 index;\\r\\n uint256 numEpochs;\\r\\n uint256 overallBalance;\\r\\n uint256 overallSupply;\\r\\n uint256 historicalPrice;\\r\\n }\\r\\n\\r\\n error InvalidReward();\\r\\n error Unauthorized();\\r\\n error InvalidGauge();\\r\\n error InvalidEscrowToken();\\r\\n error SingleTokenExpected();\\r\\n error InvalidVotingEscrow();\\r\\n error TokenNotWhitelisted();\\r\\n error AmountCannotBeZero();\\r\\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\\r\\n\\r\\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\\r\\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\\r\\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\\r\\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\\r\\n\\r\\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be deposited for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\\r\\n /// @dev Can only be called internally by authorized entities.\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param amount Amount to be withdrawn for the veNFT\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\\r\\n\\r\\n /// @notice Claim the rewards earned by a veNFT holder\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @param tokens Array of tokens to claim rewards for\\r\\n function getReward(uint256 tokenId, address[] memory tokens) external;\\r\\n\\r\\n /// @notice Notify the contract about new rewards for stakers\\r\\n /// @param token Address of the reward token\\r\\n /// @param amount Amount of the reward token to be added\\r\\n function notifyRewardAmount(address token, uint256 amount) external;\\r\\n\\r\\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param tokenId The veNFT token ID to check\\r\\n /// @param lpToken Address of the liquidity pool token\\r\\n /// @param timestamp The timestamp to get the balance at\\r\\n /// @return The balance index at the given timestamp\\r\\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the prior supply index at a specific timestamp\\r\\n /// @dev Timestamp must be in the past or present.\\r\\n /// @param timestamp The timestamp to get the supply index at\\r\\n /// @return The supply index at the given timestamp\\r\\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\\r\\n\\r\\n /// @notice Calculate the rewards earned for a specific token and veNFT\\r\\n /// @param token Address of the reward token\\r\\n /// @param tokenId Unique identifier of the veNFT\\r\\n /// @return Amount of the reward token earned\\r\\n function earned(address token, uint256 tokenId) external view returns (uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0x71a54e6c66bc6412a7bed2b37bfe2efe0d977ce3e0c6f69a0412d4b07bfe9bbb\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610afb806100206000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a6146101025780638da5cb5b1461010a5780639085752e1461011b578063f2fde38b1461012e578063fb9321081461014157600080fd5b80630cb3d7de1461009857806342913b98146100ad578063485cc955146100dc5780635db526b8146100ef575b600080fd5b6100ab6100a6366004610966565b610154565b005b6066546100c0906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100ab6100ea366004610988565b6101a6565b6065546100c0906001600160a01b031681565b6100ab610318565b6033546001600160a01b03166100c0565b6100ab610129366004610966565b61032c565b6100ab61013c366004610966565b61037e565b6100ab61014f3660046109bb565b6103f7565b61015c61057d565b606680546001600160a01b0319166001600160a01b0383169081179091556040517fcaf262dbe223e6b3b567ee0679224dc31ef9f12f768063f367131de7b97604b890600090a250565b600054610100900460ff16158080156101c65750600054600160ff909116105b806101e05750303b1580156101e0575060005460ff166001145b6102485760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561026b576000805461ff0019166101001790555b6102736105d7565b606580546001600160a01b03199081166001600160a01b03868116918217909355606680549092169285169283179091556040517f3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc290600090a38015610313576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b61032061057d565b61032a6000610606565b565b61033461057d565b606580546001600160a01b0319166001600160a01b0383169081179091556040517f64275ebd7c54c5d745cd7bf4a8eb118b5865edcd08710b73e7ca7d89e881a2d890600090a250565b61038661057d565b6001600160a01b0381166103eb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b6103f481610606565b50565b6065546001600160a01b031633146104515760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f7420746865204d6f7270686f204d61726b657400604482015260640161023f565b6104666001600160a01b038316333084610658565b60665460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529083169063095ea7b3906044016020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd91906109e5565b5060665460405163b66503cf60e01b81526001600160a01b038481166004830152602482018490529091169063b66503cf90604401600060405180830381600087803b15801561052c57600080fd5b505af1158015610540573d6000803e3d6000fd5b50506040518381523392507fb649c98f58055c520df0dcb5709eff2e931217ff2fb1e21376130d31bbb1c0af915060200160405180910390a25050565b6033546001600160a01b0316331461032a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161023f565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161023f90610a07565b61032a6106b8565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526106b29085906106e8565b50505050565b600054610100900460ff166106df5760405162461bcd60e51b815260040161023f90610a07565b61032a33610606565b600061073d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107ba9092919063ffffffff16565b805190915015610313578080602001905181019061075b91906109e5565b6103135760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161023f565b60606107c984846000856107d1565b949350505050565b6060824710156108325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161023f565b600080866001600160a01b0316858760405161084e9190610a76565b60006040518083038185875af1925050503d806000811461088b576040519150601f19603f3d011682016040523d82523d6000602084013e610890565b606091505b50915091506108a1878383876108ac565b979650505050505050565b6060831561091b578251600003610914576001600160a01b0385163b6109145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161023f565b50816107c9565b6107c983838151156109305781518083602001fd5b8060405162461bcd60e51b815260040161023f9190610a92565b80356001600160a01b038116811461096157600080fd5b919050565b60006020828403121561097857600080fd5b6109818261094a565b9392505050565b6000806040838503121561099b57600080fd5b6109a48361094a565b91506109b26020840161094a565b90509250929050565b600080604083850312156109ce57600080fd5b6109d78361094a565b946020939093013593505050565b6000602082840312156109f757600080fd5b8151801515811461098157600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015610a6d578181015183820152602001610a55565b50506000910152565b60008251610a88818460208701610a52565b9190910192915050565b6020815260008251806020840152610ab1816040850160208701610a52565b601f01601f1916919091016040019291505056fea264697066735822122040271407380f177433edc7b5b62c3693ecffb96ba32de68272826214376b2d5f64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a6146101025780638da5cb5b1461010a5780639085752e1461011b578063f2fde38b1461012e578063fb9321081461014157600080fd5b80630cb3d7de1461009857806342913b98146100ad578063485cc955146100dc5780635db526b8146100ef575b600080fd5b6100ab6100a6366004610966565b610154565b005b6066546100c0906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100ab6100ea366004610988565b6101a6565b6065546100c0906001600160a01b031681565b6100ab610318565b6033546001600160a01b03166100c0565b6100ab610129366004610966565b61032c565b6100ab61013c366004610966565b61037e565b6100ab61014f3660046109bb565b6103f7565b61015c61057d565b606680546001600160a01b0319166001600160a01b0383169081179091556040517fcaf262dbe223e6b3b567ee0679224dc31ef9f12f768063f367131de7b97604b890600090a250565b600054610100900460ff16158080156101c65750600054600160ff909116105b806101e05750303b1580156101e0575060005460ff166001145b6102485760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561026b576000805461ff0019166101001790555b6102736105d7565b606580546001600160a01b03199081166001600160a01b03868116918217909355606680549092169285169283179091556040517f3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc290600090a38015610313576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b61032061057d565b61032a6000610606565b565b61033461057d565b606580546001600160a01b0319166001600160a01b0383169081179091556040517f64275ebd7c54c5d745cd7bf4a8eb118b5865edcd08710b73e7ca7d89e881a2d890600090a250565b61038661057d565b6001600160a01b0381166103eb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b6103f481610606565b50565b6065546001600160a01b031633146104515760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f7420746865204d6f7270686f204d61726b657400604482015260640161023f565b6104666001600160a01b038316333084610658565b60665460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529083169063095ea7b3906044016020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd91906109e5565b5060665460405163b66503cf60e01b81526001600160a01b038481166004830152602482018490529091169063b66503cf90604401600060405180830381600087803b15801561052c57600080fd5b505af1158015610540573d6000803e3d6000fd5b50506040518381523392507fb649c98f58055c520df0dcb5709eff2e931217ff2fb1e21376130d31bbb1c0af915060200160405180910390a25050565b6033546001600160a01b0316331461032a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161023f565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161023f90610a07565b61032a6106b8565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526106b29085906106e8565b50505050565b600054610100900460ff166106df5760405162461bcd60e51b815260040161023f90610a07565b61032a33610606565b600061073d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107ba9092919063ffffffff16565b805190915015610313578080602001905181019061075b91906109e5565b6103135760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161023f565b60606107c984846000856107d1565b949350505050565b6060824710156108325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161023f565b600080866001600160a01b0316858760405161084e9190610a76565b60006040518083038185875af1925050503d806000811461088b576040519150601f19603f3d011682016040523d82523d6000602084013e610890565b606091505b50915091506108a1878383876108ac565b979650505050505050565b6060831561091b578251600003610914576001600160a01b0385163b6109145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161023f565b50816107c9565b6107c983838151156109305781518083602001fd5b8060405162461bcd60e51b815260040161023f9190610a92565b80356001600160a01b038116811461096157600080fd5b919050565b60006020828403121561097857600080fd5b6109818261094a565b9392505050565b6000806040838503121561099b57600080fd5b6109a48361094a565b91506109b26020840161094a565b90509250929050565b600080604083850312156109ce57600080fd5b6109d78361094a565b946020939093013593505050565b6000602082840312156109f757600080fd5b8151801515811461098157600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015610a6d578181015183820152602001610a55565b50506000910152565b60008251610a88818460208701610a52565b9190910192915050565b6020815260008251806020840152610ab1816040850160208701610a52565b601f01601f1916919091016040019291505056fea264697066735822122040271407380f177433edc7b5b62c3693ecffb96ba32de68272826214376b2d5f64736f6c63430008160033", + "devdoc": { + "details": "This contract handles the distribution of bribe tokens to the Morpho protocol.", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "distribute(address,uint256)": { + "params": { + "_amount": "Amount of tokens to distribute" + } + }, + "initialize(address,address)": { + "params": { + "_morphoBribes": "Address of the Morpho bribes contract", + "_morphoMarket": "Address of the Morpho market" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setMorphoBribes(address)": { + "params": { + "_morphoBribes": "New address of the Morpho bribes contract" + } + }, + "setMorphoMarket(address)": { + "params": { + "_morphoMarket": "New address of the Morpho market" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "MorphoBribeDistributor", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "distribute(address,uint256)": { + "notice": "Distributes bribe tokens to the Morpho bribes contract" + }, + "initialize(address,address)": { + "notice": "Initializes the MorphoBribeDistributor contract" + }, + "morphoBribes()": { + "notice": "Address of the Morpho bribes contract" + }, + "morphoMarket()": { + "notice": "Address of the Morpho market" + }, + "setMorphoBribes(address)": { + "notice": "Sets the address of the Morpho bribes contract" + }, + "setMorphoMarket(address)": { + "notice": "Sets the address of the Morpho market" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 412, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 415, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 2763, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 24650, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "morphoMarket", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 24653, + "contract": "contracts/ionic/MorphoBribeDistributor.sol:MorphoBribeDistributor", + "label": "morphoBribes", + "offset": 0, + "slot": "102", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Proxy.json b/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Proxy.json new file mode 100644 index 0000000000..f2fd06f948 --- /dev/null +++ b/packages/contracts/deployments/base/MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Proxy.json @@ -0,0 +1,275 @@ +{ + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "transactionIndex": 205, + "gasUsed": "817143", + "logsBloom": "0x000002000000000000000000000000005000000400000000208040000a0000000000090000000000000000000800000000000000000000000000000000000000000004000000000000000000000002000001000040000000000000000000000000000000020000000000000800000800000000800000008000000000000000400000000000000000000000000800000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000002000000000020000000000000000000040000040000000400000004000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26", + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "logs": [ + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000b98c673f7973a996fb9106b7d1d21e5b7b0a888a" + ], + "data": "0x", + "logIndex": 572, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 573, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc2", + "0x000000000000000000000000a2403211f91d4be497f54ce620ab8e1da770d808", + "0x00000000000000000000000084d0fb659b2ea9a11b3e53561bfb148638912618" + ], + "data": "0x", + "logIndex": 574, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 575, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + }, + { + "transactionIndex": 205, + "blockNumber": 25920992, + "transactionHash": "0xe379d3b4ee10c2baf9294ec7a57aa0b0c714ceec7d8c95550890125701160cc7", + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 576, + "blockHash": "0x944c60939acb906a146d95a746da276a87ef6f7b8f829955c5b2d571cf9b4e26" + } + ], + "blockNumber": 25920992, + "cumulativeGasUsed": "37175590", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB98c673F7973a996FB9106B7d1D21E5B7b0A888a", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x485cc955000000000000000000000000a2403211f91d4be497f54ce620ab8e1da770d80800000000000000000000000084d0fb659b2ea9a11b3e53561bfb148638912618" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0.json b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0.json new file mode 100644 index 0000000000..5352422d2f --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0.json @@ -0,0 +1,395 @@ +{ + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "transactionIndex": 102, + "gasUsed": "772237", + "logsBloom": "0x00000000000000010000000000000004400000000000000020800000000000000040000000000000000000000800000000000000000000010000400000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000120000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582", + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "logs": [ + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000001a22fa4ce003a3bc515d22f781d6ebc74d1f35c" + ], + "data": "0x", + "logIndex": 304, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + }, + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 305, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + }, + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 306, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + }, + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 307, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + } + ], + "blockNumber": 25919631, + "cumulativeGasUsed": "18482121", + "status": 1, + "byzantium": true + }, + "args": [ + "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Implementation.json new file mode 100644 index 0000000000..b3acfb2aef --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xe2758dde0a3fb783387a120a608f804e8f3668ec11f62d38239a1fd3b9f822d0", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c", + "transactionIndex": 94, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000008000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9a9303478a4e7485715a7f78dd15706ab62481d62ca197eb098e278053ba20ed", + "transactionHash": "0xe2758dde0a3fb783387a120a608f804e8f3668ec11f62d38239a1fd3b9f822d0", + "logs": [ + { + "transactionIndex": 94, + "blockNumber": 25919627, + "transactionHash": "0xe2758dde0a3fb783387a120a608f804e8f3668ec11f62d38239a1fd3b9f822d0", + "address": "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 270, + "blockHash": "0x9a9303478a4e7485715a7f78dd15706ab62481d62ca197eb098e278053ba20ed" + } + ], + "blockNumber": 25919627, + "cumulativeGasUsed": "18649703", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Proxy.json new file mode 100644 index 0000000000..293326d797 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "transactionIndex": 102, + "gasUsed": "772237", + "logsBloom": "0x00000000000000010000000000000004400000000000000020800000000000000040000000000000000000000800000000000000000000010000400000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000120000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582", + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "logs": [ + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000001a22fa4ce003a3bc515d22f781d6ebc74d1f35c" + ], + "data": "0x", + "logIndex": 304, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + }, + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 305, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + }, + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 306, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + }, + { + "transactionIndex": 102, + "blockNumber": 25919631, + "transactionHash": "0x58996b37f5394cea4e1315abb894c717aeb22c76ae2bcbecaeb2e620c5a3544f", + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 307, + "blockHash": "0x5b62caf27d4285c539ef26db8b4d2a37f8827dceefb372a9a9bb9ae68e91f582" + } + ], + "blockNumber": 25919631, + "cumulativeGasUsed": "18482121", + "status": 1, + "byzantium": true + }, + "args": [ + "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1.json b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1.json new file mode 100644 index 0000000000..1ba9c75259 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1.json @@ -0,0 +1,395 @@ +{ + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "transactionIndex": 147, + "gasUsed": "772249", + "logsBloom": "0x00000040000000000000000000000000400000000000000020800000000000000000020000000000000000040800000000000000000000000000000000000000000010000400000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000002000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4", + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "logs": [ + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000eecd18a73d60d672c53e90bb98a27fe20308b4df" + ], + "data": "0x", + "logIndex": 437, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + }, + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 438, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + }, + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 439, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + }, + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 440, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + } + ], + "blockNumber": 25919649, + "cumulativeGasUsed": "29198076", + "status": 1, + "byzantium": true + }, + "args": [ + "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Implementation.json new file mode 100644 index 0000000000..9f209e6a30 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x76d5e40e33b35957736b65b6b6e608e198f7b02cbda5f133321ab11b3d2b6a02", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF", + "transactionIndex": 105, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000008000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4dcfd3eeba3cd898cb4f7f24b28b4d81929bbc0adf9c632f698711a17330d3f3", + "transactionHash": "0x76d5e40e33b35957736b65b6b6e608e198f7b02cbda5f133321ab11b3d2b6a02", + "logs": [ + { + "transactionIndex": 105, + "blockNumber": 25919644, + "transactionHash": "0x76d5e40e33b35957736b65b6b6e608e198f7b02cbda5f133321ab11b3d2b6a02", + "address": "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 348, + "blockHash": "0x4dcfd3eeba3cd898cb4f7f24b28b4d81929bbc0adf9c632f698711a17330d3f3" + } + ], + "blockNumber": 25919644, + "cumulativeGasUsed": "21805886", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Proxy.json new file mode 100644 index 0000000000..75bb88bde6 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "transactionIndex": 147, + "gasUsed": "772249", + "logsBloom": "0x00000040000000000000000000000000400000000000000020800000000000000000020000000000000000040800000000000000000000000000000000000000000010000400000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000002000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4", + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "logs": [ + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000eecd18a73d60d672c53e90bb98a27fe20308b4df" + ], + "data": "0x", + "logIndex": 437, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + }, + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 438, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + }, + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 439, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + }, + { + "transactionIndex": 147, + "blockNumber": 25919649, + "transactionHash": "0x650b95211f057b2c7db5a6401221a52a6369f615454023dea0697e37088f267a", + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 440, + "blockHash": "0x91b96ea07c9c65d540c9fc7b130793ad88e5cfb55830665dc8e7e8b55b00e0e4" + } + ], + "blockNumber": 25919649, + "cumulativeGasUsed": "29198076", + "status": 1, + "byzantium": true + }, + "args": [ + "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0.json b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0.json new file mode 100644 index 0000000000..8ef0d292c8 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0.json @@ -0,0 +1,395 @@ +{ + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "transactionIndex": 71, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000100000000000000080400000000000000000000000000000000000000000000080000000000000800000000000000000000080000000000400000000000000000000000000000000000800000020000000000000000000040000000000000400000000000000000020000000000000000000000000000008000000000000002000000000000000000000", + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38", + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "logs": [ + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000024c24e2ef6e21eea711e317c4bfcc49484312ec8" + ], + "data": "0x", + "logIndex": 215, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + }, + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 216, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + }, + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 217, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + }, + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 218, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + } + ], + "blockNumber": 25919164, + "cumulativeGasUsed": "18425837", + "status": 1, + "byzantium": true + }, + "args": [ + "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Implementation.json new file mode 100644 index 0000000000..6f5f39516b --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x0505963182969f9388f5c203430c88aacf813ccb39eafb6ec723076b3a29bac4", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8", + "transactionIndex": 84, + "gasUsed": "597873", + "logsBloom": "0x00000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc8ebe17b1cc9c4c416ad09bb80afe6728e0b0a894cde0448ce109e21ae95c7c8", + "transactionHash": "0x0505963182969f9388f5c203430c88aacf813ccb39eafb6ec723076b3a29bac4", + "logs": [ + { + "transactionIndex": 84, + "blockNumber": 25775724, + "transactionHash": "0x0505963182969f9388f5c203430c88aacf813ccb39eafb6ec723076b3a29bac4", + "address": "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 267, + "blockHash": "0xc8ebe17b1cc9c4c416ad09bb80afe6728e0b0a894cde0448ce109e21ae95c7c8" + } + ], + "blockNumber": 25775724, + "cumulativeGasUsed": "17930069", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Proxy.json new file mode 100644 index 0000000000..e778719ed2 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "transactionIndex": 71, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000100000000000000080400000000000000000000000000000000000000000000080000000000000800000000000000000000080000000000400000000000000000000000000000000000800000020000000000000000000040000000000000400000000000000000020000000000000000000000000000008000000000000002000000000000000000000", + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38", + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "logs": [ + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000024c24e2ef6e21eea711e317c4bfcc49484312ec8" + ], + "data": "0x", + "logIndex": 215, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + }, + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 216, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + }, + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 217, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + }, + { + "transactionIndex": 71, + "blockNumber": 25919164, + "transactionHash": "0xf85b3bdd26bad577746de881680a67bdf299731c51f7480a5509f9713cded017", + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 218, + "blockHash": "0x48ced3b10c326ac04e2a8e00be191e488c8c8ac6fca082add67b7184b3febf38" + } + ], + "blockNumber": 25919164, + "cumulativeGasUsed": "18425837", + "status": 1, + "byzantium": true + }, + "args": [ + "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1.json b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1.json new file mode 100644 index 0000000000..3b9ad710ec --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1.json @@ -0,0 +1,395 @@ +{ + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x8944281718FD7f811b9E739a54A9340490344945", + "transactionIndex": 116, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000020420800000000000000000000000000000000000000800000000000000000000000001000000000000000000000200000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000004000000000000000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000080000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda", + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "logs": [ + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000060aa0b6a627923ae0fcf1a9f9d0b603b4c207b1f" + ], + "data": "0x", + "logIndex": 324, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + }, + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 325, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + }, + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 326, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + }, + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 327, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + } + ], + "blockNumber": 25775912, + "cumulativeGasUsed": "20277391", + "status": 1, + "byzantium": true + }, + "args": [ + "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Implementation.json new file mode 100644 index 0000000000..52595e33cc --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x5f076db1e85ef2c799f25017e51f495f4141d1d6175523b1631f283536625606", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f", + "transactionIndex": 151, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000002000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xace0139b7bd8ed498e719369408dfcbbd24ef7ca9b0976bb703b3353abbd474e", + "transactionHash": "0x5f076db1e85ef2c799f25017e51f495f4141d1d6175523b1631f283536625606", + "logs": [ + { + "transactionIndex": 151, + "blockNumber": 25775738, + "transactionHash": "0x5f076db1e85ef2c799f25017e51f495f4141d1d6175523b1631f283536625606", + "address": "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 403, + "blockHash": "0xace0139b7bd8ed498e719369408dfcbbd24ef7ca9b0976bb703b3353abbd474e" + } + ], + "blockNumber": 25775738, + "cumulativeGasUsed": "31582184", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Proxy.json new file mode 100644 index 0000000000..e8d7226975 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x8944281718FD7f811b9E739a54A9340490344945", + "transactionIndex": 116, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000020420800000000000000000000000000000000000000800000000000000000000000001000000000000000000000200000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000004000000000000000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000080000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda", + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "logs": [ + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000060aa0b6a627923ae0fcf1a9f9d0b603b4c207b1f" + ], + "data": "0x", + "logIndex": 324, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + }, + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 325, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + }, + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 326, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + }, + { + "transactionIndex": 116, + "blockNumber": 25775912, + "transactionHash": "0x705281dfb64d81e934a882c618d624c8a2a8c3cbfbd8b9bbb3834fcc40d76f04", + "address": "0x8944281718FD7f811b9E739a54A9340490344945", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 327, + "blockHash": "0x86545ed5a6601a1da89e09f981ca8cc788cb2eacaf4995306ebf6f8d9d1c3eda" + } + ], + "blockNumber": 25775912, + "cumulativeGasUsed": "20277391", + "status": 1, + "byzantium": true + }, + "args": [ + "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0.json b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0.json new file mode 100644 index 0000000000..e725fef26c --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0.json @@ -0,0 +1,395 @@ +{ + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "transactionIndex": 108, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000840000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000080000000000000080000000000000800000000000000000000000000000000c00000000000000080000000000000000000000000020000000000000000000040000000000000400000000000000000020002000000000000000000000000000000000000000000000000000000000000080", + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7", + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "logs": [ + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000000b3f497c3331fb05a4ca67d2b19fc965540c0592" + ], + "data": "0x", + "logIndex": 240, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + }, + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 241, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + }, + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 242, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + }, + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 243, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + } + ], + "blockNumber": 25919703, + "cumulativeGasUsed": "16499157", + "status": 1, + "byzantium": true + }, + "args": [ + "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Implementation.json new file mode 100644 index 0000000000..050011bf4b --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x20298f31413338ac6b422879d59a8c7aa0a54f38a3e603c7f369ff709d74eb1f", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592", + "transactionIndex": 80, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000100000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000", + "blockHash": "0xb22dc896dd9664e0c28b769257f60ce2ab04e3980ae0f8f7bac6b350eb604f50", + "transactionHash": "0x20298f31413338ac6b422879d59a8c7aa0a54f38a3e603c7f369ff709d74eb1f", + "logs": [ + { + "transactionIndex": 80, + "blockNumber": 25919699, + "transactionHash": "0x20298f31413338ac6b422879d59a8c7aa0a54f38a3e603c7f369ff709d74eb1f", + "address": "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 169, + "blockHash": "0xb22dc896dd9664e0c28b769257f60ce2ab04e3980ae0f8f7bac6b350eb604f50" + } + ], + "blockNumber": 25919699, + "cumulativeGasUsed": "19778422", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Proxy.json new file mode 100644 index 0000000000..45bf5b8604 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "transactionIndex": 108, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000840000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000000000400000000000000000000000000000080000000000000080000000000000800000000000000000000000000000000c00000000000000080000000000000000000000000020000000000000000000040000000000000400000000000000000020002000000000000000000000000000000000000000000000000000000000000080", + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7", + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "logs": [ + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000000b3f497c3331fb05a4ca67d2b19fc965540c0592" + ], + "data": "0x", + "logIndex": 240, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + }, + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 241, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + }, + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 242, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + }, + { + "transactionIndex": 108, + "blockNumber": 25919703, + "transactionHash": "0x62413c2917cfe94f2c309bfeec4fd9ae729563168ccb08b2d8351b03b57cca4a", + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 243, + "blockHash": "0x5ed96b9065cc5f6e37cef84c8b760b200d62a929191bec28e5af09ce1339f5c7" + } + ], + "blockNumber": 25919703, + "cumulativeGasUsed": "16499157", + "status": 1, + "byzantium": true + }, + "args": [ + "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1.json b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1.json new file mode 100644 index 0000000000..ac915547e7 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1.json @@ -0,0 +1,395 @@ +{ + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "transactionIndex": 138, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020c00000000000000000800000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000420000000000000800008800000000800000000000000000000000400000000000000100000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a", + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "logs": [ + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000004a224b4d23a275c8dd29cff2d831060d3d2c538c" + ], + "data": "0x", + "logIndex": 213, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + }, + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 214, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + }, + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 215, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + }, + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 216, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + } + ], + "blockNumber": 25919721, + "cumulativeGasUsed": "21103556", + "status": 1, + "byzantium": true + }, + "args": [ + "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Implementation.json new file mode 100644 index 0000000000..c3e4c8737b --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x70ca4cf59ddc3dc533746a6c332407e27b9b75763e702bf1ea3092f270bfc89d", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c", + "transactionIndex": 118, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2e15d1aab876bd7e60419f02a03529288a04c16e5700d599e0bc0dd4618dc26f", + "transactionHash": "0x70ca4cf59ddc3dc533746a6c332407e27b9b75763e702bf1ea3092f270bfc89d", + "logs": [ + { + "transactionIndex": 118, + "blockNumber": 25919717, + "transactionHash": "0x70ca4cf59ddc3dc533746a6c332407e27b9b75763e702bf1ea3092f270bfc89d", + "address": "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 346, + "blockHash": "0x2e15d1aab876bd7e60419f02a03529288a04c16e5700d599e0bc0dd4618dc26f" + } + ], + "blockNumber": 25919717, + "cumulativeGasUsed": "21798305", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Proxy.json new file mode 100644 index 0000000000..4893f903e9 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "transactionIndex": 138, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020c00000000000000000800000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000420000000000000800008800000000800000000000000000000000400000000000000100000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a", + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "logs": [ + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000004a224b4d23a275c8dd29cff2d831060d3d2c538c" + ], + "data": "0x", + "logIndex": 213, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + }, + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 214, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + }, + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 215, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + }, + { + "transactionIndex": 138, + "blockNumber": 25919721, + "transactionHash": "0x5f51a5fe6237ad397566eecf3237f7e0630c0a10bab40385b3a14c2c821dba65", + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 216, + "blockHash": "0x98cca6202de1bdc93f3d28971f62a7054b5d3f8730783509fd7eae21ba2cfd4a" + } + ], + "blockNumber": 25919721, + "cumulativeGasUsed": "21103556", + "status": 1, + "byzantium": true + }, + "args": [ + "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0.json b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0.json new file mode 100644 index 0000000000..9729565627 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0.json @@ -0,0 +1,395 @@ +{ + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "transactionIndex": 74, + "gasUsed": "772249", + "logsBloom": "0x000000000000000000000000000000004000000000000000208000000000000000000000000000000000000008000000000000000000000000000000000000001000000000000000000000000000020000010000000000000000000000000000000000000200000000000008000008000000008000000000000020000000004000000000000000000000000000000000000000000000800000000000008000000000000000008000000000000004000000000000000000000000000000000000000000200000000000000000000400000000000004000000000000000010a0000000000000000000000000000000000000000000000000000000000040000000", + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e", + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "logs": [ + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000f88598f2b0ea367f47d38bb08daf528f1910a86f" + ], + "data": "0x", + "logIndex": 213, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + }, + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 214, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + }, + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 215, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + }, + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 216, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + } + ], + "blockNumber": 25919667, + "cumulativeGasUsed": "19547928", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Implementation.json new file mode 100644 index 0000000000..07fa7c18d3 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x21d9ccec223e0f3598d592c884b4d301d1b8026311697449307f76ca78e742a5", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f", + "transactionIndex": 177, + "gasUsed": "597873", + "logsBloom": "0x00000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000", + "blockHash": "0x84c76f0a9a0873fdfc72555b33a6ee33a8bc514ff601a0cc99715639ae584866", + "transactionHash": "0x21d9ccec223e0f3598d592c884b4d301d1b8026311697449307f76ca78e742a5", + "logs": [ + { + "transactionIndex": 177, + "blockNumber": 25919662, + "transactionHash": "0x21d9ccec223e0f3598d592c884b4d301d1b8026311697449307f76ca78e742a5", + "address": "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 667, + "blockHash": "0x84c76f0a9a0873fdfc72555b33a6ee33a8bc514ff601a0cc99715639ae584866" + } + ], + "blockNumber": 25919662, + "cumulativeGasUsed": "42444345", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Proxy.json new file mode 100644 index 0000000000..375f8b63fe --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "transactionIndex": 74, + "gasUsed": "772249", + "logsBloom": "0x000000000000000000000000000000004000000000000000208000000000000000000000000000000000000008000000000000000000000000000000000000001000000000000000000000000000020000010000000000000000000000000000000000000200000000000008000008000000008000000000000020000000004000000000000000000000000000000000000000000000800000000000008000000000000000008000000000000004000000000000000000000000000000000000000000200000000000000000000400000000000004000000000000000010a0000000000000000000000000000000000000000000000000000000000040000000", + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e", + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "logs": [ + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000f88598f2b0ea367f47d38bb08daf528f1910a86f" + ], + "data": "0x", + "logIndex": 213, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + }, + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 214, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + }, + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 215, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + }, + { + "transactionIndex": 74, + "blockNumber": 25919667, + "transactionHash": "0x9b226e3e6f40f87c7dca983fbb6685c18c38c2088f7f04002276bbfe1d459bbb", + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 216, + "blockHash": "0xa6ac831911938d14ac9c80187927ca345c662a1432e113af1a59aab91800591e" + } + ], + "blockNumber": 25919667, + "cumulativeGasUsed": "19547928", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1.json b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1.json new file mode 100644 index 0000000000..f15fd74757 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1.json @@ -0,0 +1,395 @@ +{ + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "transactionIndex": 121, + "gasUsed": "772249", + "logsBloom": "0x00000000001000000000000100000000420000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000004000000000000003000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000008000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890", + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "logs": [ + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000f38131eb77fdf23ca78e4f736107e5cf8f2f0dd2" + ], + "data": "0x", + "logIndex": 360, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + }, + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 361, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + }, + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 362, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + }, + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 363, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + } + ], + "blockNumber": 25919685, + "cumulativeGasUsed": "22704693", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Implementation.json new file mode 100644 index 0000000000..5aad581781 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7eb075bb617bd06514d49add846c3ca71db686247552bc4b7b06c38f41e9178c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2", + "transactionIndex": 150, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xef4142f0c168e7c69eeaac4ad74f8884f83c904489cc1917bf18c00924ee4e21", + "transactionHash": "0x7eb075bb617bd06514d49add846c3ca71db686247552bc4b7b06c38f41e9178c", + "logs": [ + { + "transactionIndex": 150, + "blockNumber": 25919680, + "transactionHash": "0x7eb075bb617bd06514d49add846c3ca71db686247552bc4b7b06c38f41e9178c", + "address": "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 568, + "blockHash": "0xef4142f0c168e7c69eeaac4ad74f8884f83c904489cc1917bf18c00924ee4e21" + } + ], + "blockNumber": 25919680, + "cumulativeGasUsed": "31352181", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Proxy.json new file mode 100644 index 0000000000..4abfeb3547 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "transactionIndex": 121, + "gasUsed": "772249", + "logsBloom": "0x00000000001000000000000100000000420000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000004000000000000003000001000000000000000000000000000000000000020000000000000800000800000000800000000000000000008000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890", + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "logs": [ + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000f38131eb77fdf23ca78e4f736107e5cf8f2f0dd2" + ], + "data": "0x", + "logIndex": 360, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + }, + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 361, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + }, + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 362, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + }, + { + "transactionIndex": 121, + "blockNumber": 25919685, + "transactionHash": "0x4c515e2807b29fd68779a3464dbd4ac74108afd5c63a8aafba95a702da0887e6", + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 363, + "blockHash": "0x657e390591db64881839be51155096b57cecbb0c8dfe9cd554746c5e9ab64890" + } + ], + "blockNumber": 25919685, + "cumulativeGasUsed": "22704693", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0.json b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0.json new file mode 100644 index 0000000000..812c03dc73 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0.json @@ -0,0 +1,395 @@ +{ + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "transactionIndex": 116, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000008000000000000000000000000000000000000000002000001008000008000000000000000000000000000020000000000000800000800000000800000001000000000000000400000000000000000000000000000000020000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000800000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7", + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "logs": [ + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000041bd53ff41c7fb8e18bff1bd7ef224e1ad4bf152" + ], + "data": "0x", + "logIndex": 164, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + }, + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 165, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + }, + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 166, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + }, + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 167, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + } + ], + "blockNumber": 25919605, + "cumulativeGasUsed": "17734479", + "status": 1, + "byzantium": true + }, + "args": [ + "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Implementation.json new file mode 100644 index 0000000000..89916f8caa --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xe6c4df9ec38d966e22ac4f23bf9514a0d84e266633ab60ca3b3ada792c4313e5", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152", + "transactionIndex": 78, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000020000000000008000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000", + "blockHash": "0x0c4848d2057e8e58f86f8cca75ba88655bde31b40156acdb7897c201f260b282", + "transactionHash": "0xe6c4df9ec38d966e22ac4f23bf9514a0d84e266633ab60ca3b3ada792c4313e5", + "logs": [ + { + "transactionIndex": 78, + "blockNumber": 25775924, + "transactionHash": "0xe6c4df9ec38d966e22ac4f23bf9514a0d84e266633ab60ca3b3ada792c4313e5", + "address": "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 197, + "blockHash": "0x0c4848d2057e8e58f86f8cca75ba88655bde31b40156acdb7897c201f260b282" + } + ], + "blockNumber": 25775924, + "cumulativeGasUsed": "18282340", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Proxy.json new file mode 100644 index 0000000000..edffe8c3f4 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "transactionIndex": 116, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000008000000000000000000000000000000000000000002000001008000008000000000000000000000000000020000000000000800000800000000800000001000000000000000400000000000000000000000000000000020000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000800000020000000000000000000040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7", + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "logs": [ + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000041bd53ff41c7fb8e18bff1bd7ef224e1ad4bf152" + ], + "data": "0x", + "logIndex": 164, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + }, + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 165, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + }, + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 166, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + }, + { + "transactionIndex": 116, + "blockNumber": 25919605, + "transactionHash": "0x4871c6eb95c5e0bcb8de1379af80a708a6d5c10c1f7071849b672abd6705c4a0", + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 167, + "blockHash": "0xfbcc6d5ce77ab49832c923e826785dfae9d7d7c398d4a768653978902cffa7d7" + } + ], + "blockNumber": 25919605, + "cumulativeGasUsed": "17734479", + "status": 1, + "byzantium": true + }, + "args": [ + "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1.json b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1.json new file mode 100644 index 0000000000..487b92b5eb --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1.json @@ -0,0 +1,395 @@ +{ + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "transactionIndex": 146, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000020010000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000002000000000020000000000000000000040000000000000400000000000000001020000000000000000000000000000000000000000400000000000000010000000000", + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a", + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "logs": [ + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000001f6b5f4b7cf9f4dd84db5fc009b58f9c3f726986" + ], + "data": "0x", + "logIndex": 307, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + }, + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 308, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + }, + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 309, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + }, + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 310, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + } + ], + "blockNumber": 25919199, + "cumulativeGasUsed": "26264939", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [] + }, + "implementation": "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Implementation.json b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Implementation.json new file mode 100644 index 0000000000..e1284eeb35 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Implementation.json @@ -0,0 +1,299 @@ +{ + "address": "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x552ce7bf0f5c18eb36abfc82ed87e058750ff1a27bf2fe339cd399133f98fdd6", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986", + "transactionIndex": 110, + "gasUsed": "597873", + "logsBloom": "0x00000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000800000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x948e3757c4094523490ae3c55c78241ecf4c3a4bb71b77432d74b2cfcc419a2a", + "transactionHash": "0x552ce7bf0f5c18eb36abfc82ed87e058750ff1a27bf2fe339cd399133f98fdd6", + "logs": [ + { + "transactionIndex": 110, + "blockNumber": 25919194, + "transactionHash": "0x552ce7bf0f5c18eb36abfc82ed87e058750ff1a27bf2fe339cd399133f98fdd6", + "address": "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 348, + "blockHash": "0x948e3757c4094523490ae3c55c78241ecf4c3a4bb71b77432d74b2cfcc419a2a" + } + ], + "blockNumber": 25919194, + "cumulativeGasUsed": "26253258", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/RewardAccumulator.sol\":\"RewardAccumulator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"contracts/veION/RewardAccumulator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract RewardAccumulator is Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n function initialize() external initializer {\\r\\n __Ownable2Step_init();\\r\\n }\\r\\n\\r\\n function approve(address _token, address _spender) external onlyOwner {\\r\\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xf2704ca96515a326cb472848b10eaf72b339577c250cd864e3389e1e54a6926d\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61095e806100ed6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638129fc1c1161005b5780638129fc1c146100a75780638da5cb5b146100af578063e30c3978146100d8578063f2fde38b146100e957600080fd5b8063715018a61461008257806379ba50971461008c5780637e5465ba14610094575b600080fd5b61008a6100fc565b005b61008a610110565b61008a6100a23660046107b3565b61018f565b61008a6101b1565b6033546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b6065546001600160a01b03166100bc565b61008a6100f73660046107e6565b6102c1565b610104610332565b61010e600061038c565b565b60655433906001600160a01b031681146101835760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61018c8161038c565b50565b610197610332565b6101ad6001600160a01b038316826000196103a5565b5050565b600054610100900460ff16158080156101d15750600054600160ff909116105b806101eb5750303b1580156101eb575060005460ff166001145b61024e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161017a565b6000805460ff191660011790558015610271576000805461ff0019166101001790555b61027961047f565b801561018c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6102c9610332565b606580546001600160a01b0383166001600160a01b031990911681179091556102fa6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331461010e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017a565b606580546001600160a01b031916905561018c816104ae565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156103f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041a9190610808565b6104249190610821565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610479908590610500565b50505050565b600054610100900460ff166104a65760405162461bcd60e51b815260040161017a90610848565b61010e6105d7565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610555826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106079092919063ffffffff16565b8051909150156105d257808060200190518101906105739190610893565b6105d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161017a565b505050565b600054610100900460ff166105fe5760405162461bcd60e51b815260040161017a90610848565b61010e3361038c565b6060610616848460008561061e565b949350505050565b60608247101561067f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161017a565b600080866001600160a01b0316858760405161069b91906108d9565b60006040518083038185875af1925050503d80600081146106d8576040519150601f19603f3d011682016040523d82523d6000602084013e6106dd565b606091505b50915091506106ee878383876106f9565b979650505050505050565b60608315610768578251600003610761576001600160a01b0385163b6107615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017a565b5081610616565b610616838381511561077d5781518083602001fd5b8060405162461bcd60e51b815260040161017a91906108f5565b80356001600160a01b03811681146107ae57600080fd5b919050565b600080604083850312156107c657600080fd5b6107cf83610797565b91506107dd60208401610797565b90509250929050565b6000602082840312156107f857600080fd5b61080182610797565b9392505050565b60006020828403121561081a57600080fd5b5051919050565b8082018082111561084257634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156108a557600080fd5b8151801515811461080157600080fd5b60005b838110156108d05781810151838201526020016108b8565b50506000910152565b600082516108eb8184602087016108b5565b9190910192915050565b60208152600082518060208401526109148160408501602087016108b5565b601f01601f1916919091016040019291505056fea26469706673582212203c484d499202f15d640d2a80e1fcf1d594b1401e5e8396be1442cf507472502064736f6c63430008160033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/RewardAccumulator.sol:RewardAccumulator", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Proxy.json b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Proxy.json new file mode 100644 index 0000000000..429b078b73 --- /dev/null +++ b/packages/contracts/deployments/base/RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Proxy.json @@ -0,0 +1,261 @@ +{ + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "transactionIndex": 146, + "gasUsed": "772249", + "logsBloom": "0x00000000000000000000000000000000400000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000800000800000000800000000000000020010000400000000000000000000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000002000000000020000000000000000000040000000000000400000000000000001020000000000000000000000000000000000000000400000000000000010000000000", + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a", + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "logs": [ + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000001f6b5f4b7cf9f4dd84db5fc009b58f9c3f726986" + ], + "data": "0x", + "logIndex": 307, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + }, + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 308, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + }, + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 309, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + }, + { + "transactionIndex": 146, + "blockNumber": 25919199, + "transactionHash": "0x5dc622591d47c4bd0795447c5d844a31b4277e976c6d50665e25ae602d7b29a0", + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028df5636456049b891bf9d40fa46ef5ad20822c5", + "logIndex": 310, + "blockHash": "0xc2b11bec33d63aa0f9f867fb97c46335142b399274ea8a54b854ab70f7d5a06a" + } + ], + "blockNumber": 25919199, + "cumulativeGasUsed": "26264939", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986", + "0x28DF5636456049B891bF9D40fa46eF5ad20822C5", + "0x8129fc1c" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/002e98c545f339de22954bf88297bf45.json b/packages/contracts/deployments/base/solcInputs/002e98c545f339de22954bf88297bf45.json new file mode 100644 index 0000000000..c9edc7a38f --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/002e98c545f339de22954bf88297bf45.json @@ -0,0 +1,1038 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/interfaces/IERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20Upgradeable.sol\";\nimport \"../token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary ClonesUpgradeable {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(address implementation, bytes32 salt)\n internal\n view\n returns (address predicted)\n {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../interfaces/IERC4626Upgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\n *\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\n * contract and not the \"assets\" token which is an independent contract.\n *\n * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of\n * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\n *\n * _Available since v4.7._\n */\nabstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {\n using MathUpgradeable for uint256;\n\n IERC20Upgradeable private _asset;\n uint8 private _decimals;\n\n /**\n * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\n */\n function __ERC4626_init(IERC20Upgradeable asset_) internal onlyInitializing {\n __ERC4626_init_unchained(asset_);\n }\n\n function __ERC4626_init_unchained(IERC20Upgradeable asset_) internal onlyInitializing {\n (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\n _decimals = success ? assetDecimals : super.decimals();\n _asset = asset_;\n }\n\n /**\n * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\n */\n function _tryGetAssetDecimals(IERC20Upgradeable asset_) private returns (bool, uint8) {\n (bool success, bytes memory encodedDecimals) = address(asset_).call(\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector)\n );\n if (success && encodedDecimals.length >= 32) {\n uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\n if (returnedDecimals <= type(uint8).max) {\n return (true, uint8(returnedDecimals));\n }\n }\n return (false, 0);\n }\n\n /**\n * @dev Decimals are read from the underlying asset in the constructor and cached. If this fails (e.g., the asset\n * has not been created yet), the cached value is set to a default obtained by `super.decimals()` (which depends on\n * inheritance but is most likely 18). Override this function in order to set a guaranteed hardcoded value.\n * See {IERC20Metadata-decimals}.\n */\n function decimals() public view virtual override(IERC20MetadataUpgradeable, ERC20Upgradeable) returns (uint8) {\n return _decimals;\n }\n\n /** @dev See {IERC4626-asset}. */\n function asset() public view virtual override returns (address) {\n return address(_asset);\n }\n\n /** @dev See {IERC4626-totalAssets}. */\n function totalAssets() public view virtual override returns (uint256) {\n return _asset.balanceOf(address(this));\n }\n\n /** @dev See {IERC4626-convertToShares}. */\n function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-convertToAssets}. */\n function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-maxDeposit}. */\n function maxDeposit(address) public view virtual override returns (uint256) {\n return _isVaultCollateralized() ? type(uint256).max : 0;\n }\n\n /** @dev See {IERC4626-maxMint}. */\n function maxMint(address) public view virtual override returns (uint256) {\n return type(uint256).max;\n }\n\n /** @dev See {IERC4626-maxWithdraw}. */\n function maxWithdraw(address owner) public view virtual override returns (uint256) {\n return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-maxRedeem}. */\n function maxRedeem(address owner) public view virtual override returns (uint256) {\n return balanceOf(owner);\n }\n\n /** @dev See {IERC4626-previewDeposit}. */\n function previewDeposit(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-previewMint}. */\n function previewMint(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Up);\n }\n\n /** @dev See {IERC4626-previewWithdraw}. */\n function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Up);\n }\n\n /** @dev See {IERC4626-previewRedeem}. */\n function previewRedeem(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-deposit}. */\n function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {\n require(assets <= maxDeposit(receiver), \"ERC4626: deposit more than max\");\n\n uint256 shares = previewDeposit(assets);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4626-mint}. */\n function mint(uint256 shares, address receiver) public virtual override returns (uint256) {\n require(shares <= maxMint(receiver), \"ERC4626: mint more than max\");\n\n uint256 assets = previewMint(shares);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return assets;\n }\n\n /** @dev See {IERC4626-withdraw}. */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(assets <= maxWithdraw(owner), \"ERC4626: withdraw more than max\");\n\n uint256 shares = previewWithdraw(assets);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4626-redeem}. */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(shares <= maxRedeem(owner), \"ERC4626: redeem more than max\");\n\n uint256 assets = previewRedeem(shares);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) with support for rounding direction.\n *\n * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset\n * would represent an infinite amount of shares.\n */\n function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {\n uint256 supply = totalSupply();\n return\n (assets == 0 || supply == 0)\n ? _initialConvertToShares(assets, rounding)\n : assets.mulDiv(supply, totalAssets(), rounding);\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) to apply when the vault is empty.\n *\n * NOTE: Make sure to keep this function consistent with {_initialConvertToAssets} when overriding it.\n */\n function _initialConvertToShares(\n uint256 assets,\n MathUpgradeable.Rounding /*rounding*/\n ) internal view virtual returns (uint256 shares) {\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) with support for rounding direction.\n */\n function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {\n uint256 supply = totalSupply();\n return\n (supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) to apply when the vault is empty.\n *\n * NOTE: Make sure to keep this function consistent with {_initialConvertToShares} when overriding it.\n */\n function _initialConvertToAssets(\n uint256 shares,\n MathUpgradeable.Rounding /*rounding*/\n ) internal view virtual returns (uint256 assets) {\n return shares;\n }\n\n /**\n * @dev Deposit/mint common workflow.\n */\n function _deposit(\n address caller,\n address receiver,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the\n // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\n // assets are transferred and before the shares are minted, which is a valid state.\n // slither-disable-next-line reentrancy-no-eth\n SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);\n _mint(receiver, shares);\n\n emit Deposit(caller, receiver, assets, shares);\n }\n\n /**\n * @dev Withdraw/redeem common workflow.\n */\n function _withdraw(\n address caller,\n address receiver,\n address owner,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n if (caller != owner) {\n _spendAllowance(owner, caller, shares);\n }\n\n // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\n // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\n // shares are burned and after the assets are transferred, which is a valid state.\n _burn(owner, shares);\n SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);\n\n emit Withdraw(caller, receiver, owner, assets, shares);\n }\n\n function _isVaultCollateralized() private view returns (bool) {\n return totalAssets() > 0 || totalSupply() == 0;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\n * See {_beforeConsecutiveTokenTransfer}.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\n * See {_afterConsecutiveTokenTransfer}.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called before \"consecutive token transfers\" as defined in ERC2309 and implemented in\n * {ERC721Consecutive}.\n * Calling conditions are similar to {_beforeTokenTransfer}.\n */\n function _beforeConsecutiveTokenTransfer(\n address from,\n address to,\n uint256, /*first*/\n uint96 size\n ) internal virtual {\n if (from != address(0)) {\n _balances[from] -= size;\n }\n if (to != address(0)) {\n _balances[to] += size;\n }\n }\n\n /**\n * @dev Hook that is called after \"consecutive token transfers\" as defined in ERC2309 and implemented in\n * {ERC721Consecutive}.\n * Calling conditions are similar to {_afterTokenTransfer}.\n */\n function _afterConsecutiveTokenTransfer(\n address, /*from*/\n address, /*to*/\n uint256, /*first*/\n uint96 /*size*/\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2Upgradeable {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n */\n constructor(address beacon, bytes memory data) payable {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../../access/Ownable.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\n _implementation = newImplementation;\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/AbstractPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./PythStructs.sol\";\nimport \"./IPyth.sol\";\nimport \"./PythErrors.sol\";\n\nabstract contract AbstractPyth is IPyth {\n /// @notice Returns the price feed with given id.\n /// @dev Reverts if the price does not exist.\n /// @param id The Pyth Price Feed ID of which to fetch the PriceFeed.\n function queryPriceFeed(\n bytes32 id\n ) public view virtual returns (PythStructs.PriceFeed memory priceFeed);\n\n /// @notice Returns true if a price feed with the given id exists.\n /// @param id The Pyth Price Feed ID of which to check its existence.\n function priceFeedExists(\n bytes32 id\n ) public view virtual returns (bool exists);\n\n function getValidTimePeriod()\n public\n view\n virtual\n override\n returns (uint validTimePeriod);\n\n function getPrice(\n bytes32 id\n ) external view virtual override returns (PythStructs.Price memory price) {\n return getPriceNoOlderThan(id, getValidTimePeriod());\n }\n\n function getEmaPrice(\n bytes32 id\n ) external view virtual override returns (PythStructs.Price memory price) {\n return getEmaPriceNoOlderThan(id, getValidTimePeriod());\n }\n\n function getPriceUnsafe(\n bytes32 id\n ) public view virtual override returns (PythStructs.Price memory price) {\n PythStructs.PriceFeed memory priceFeed = queryPriceFeed(id);\n return priceFeed.price;\n }\n\n function getPriceNoOlderThan(\n bytes32 id,\n uint age\n ) public view virtual override returns (PythStructs.Price memory price) {\n price = getPriceUnsafe(id);\n\n if (diff(block.timestamp, price.publishTime) > age)\n revert PythErrors.StalePrice();\n\n return price;\n }\n\n function getEmaPriceUnsafe(\n bytes32 id\n ) public view virtual override returns (PythStructs.Price memory price) {\n PythStructs.PriceFeed memory priceFeed = queryPriceFeed(id);\n return priceFeed.emaPrice;\n }\n\n function getEmaPriceNoOlderThan(\n bytes32 id,\n uint age\n ) public view virtual override returns (PythStructs.Price memory price) {\n price = getEmaPriceUnsafe(id);\n\n if (diff(block.timestamp, price.publishTime) > age)\n revert PythErrors.StalePrice();\n\n return price;\n }\n\n function diff(uint x, uint y) internal pure returns (uint) {\n if (x > y) {\n return x - y;\n } else {\n return y - x;\n }\n }\n\n // Access modifier is overridden to public to be able to call it locally.\n function updatePriceFeeds(\n bytes[] calldata updateData\n ) public payable virtual override;\n\n function updatePriceFeedsIfNecessary(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64[] calldata publishTimes\n ) external payable virtual override {\n if (priceIds.length != publishTimes.length)\n revert PythErrors.InvalidArgument();\n\n for (uint i = 0; i < priceIds.length; i++) {\n if (\n !priceFeedExists(priceIds[i]) ||\n queryPriceFeed(priceIds[i]).price.publishTime < publishTimes[i]\n ) {\n updatePriceFeeds(updateData);\n return;\n }\n }\n\n revert PythErrors.NoFreshUpdate();\n }\n\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n )\n external\n payable\n virtual\n override\n returns (PythStructs.PriceFeed[] memory priceFeeds);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./PythStructs.sol\";\nimport \"./IPythEvents.sol\";\n\n/// @title Consume prices from the Pyth Network (https://pyth.network/).\n/// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely.\n/// @author Pyth Data Association\ninterface IPyth is IPythEvents {\n /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time\n function getValidTimePeriod() external view returns (uint validTimePeriod);\n\n /// @notice Returns the price and confidence interval.\n /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.\n /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPrice(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price and confidence interval.\n /// @dev Reverts if the EMA price is not available.\n /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPrice(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the price of a price feed without any sanity checks.\n /// @dev This function returns the most recent price update in this contract without any recency checks.\n /// This function is unsafe as the returned price update may be arbitrarily far in the past.\n ///\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\n /// sufficiently recent for their application. If you are considering using this function, it may be\n /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPriceUnsafe(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the price that is no older than `age` seconds of the current time.\n /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\n /// recently.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPriceNoOlderThan(\n bytes32 id,\n uint age\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.\n /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.\n /// However, if the price is not recent this function returns the latest available price.\n ///\n /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that\n /// the returned price is recent or useful for any particular application.\n ///\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\n /// sufficiently recent for their application. If you are considering using this function, it may be\n /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPriceUnsafe(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds\n /// of the current time.\n /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\n /// recently.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPriceNoOlderThan(\n bytes32 id,\n uint age\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Update price feeds with given update messages.\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n /// Prices will be updated if they are more recent than the current stored prices.\n /// The call will succeed even if the update is not the most recent.\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.\n /// @param updateData Array of price update data.\n function updatePriceFeeds(bytes[] calldata updateData) external payable;\n\n /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is\n /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the\n /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.\n ///\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n ///\n /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime\n /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have\n /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.\n /// Otherwise, it calls updatePriceFeeds method to update the prices.\n ///\n /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.\n /// @param updateData Array of price update data.\n /// @param priceIds Array of price ids.\n /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`\n function updatePriceFeedsIfNecessary(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64[] calldata publishTimes\n ) external payable;\n\n /// @notice Returns the required fee to update an array of price updates.\n /// @param updateData Array of price update data.\n /// @return feeAmount The required fee in Wei.\n function getUpdateFee(\n bytes[] calldata updateData\n ) external view returns (uint feeAmount);\n\n /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published\n /// within `minPublishTime` and `maxPublishTime`.\n ///\n /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;\n /// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain.\n ///\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n ///\n ///\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is\n /// no update for any of the given `priceIds` within the given time range.\n /// @param updateData Array of price update data.\n /// @param priceIds Array of price ids.\n /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.\n /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.\n /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPythEvents.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @title IPythEvents contains the events that Pyth contract emits.\n/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.\ninterface IPythEvents {\n /// @dev Emitted when the price feed with `id` has received a fresh update.\n /// @param id The Pyth Price Feed ID.\n /// @param publishTime Publish time of the given price update.\n /// @param price Price of the given price update.\n /// @param conf Confidence interval of the given price update.\n event PriceFeedUpdate(\n bytes32 indexed id,\n uint64 publishTime,\n int64 price,\n uint64 conf\n );\n\n /// @dev Emitted when a batch price update is processed successfully.\n /// @param chainId ID of the source chain that the batch price update comes from.\n /// @param sequenceNumber Sequence number of the batch price update.\n event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/MockPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./AbstractPyth.sol\";\nimport \"./PythStructs.sol\";\nimport \"./PythErrors.sol\";\n\ncontract MockPyth is AbstractPyth {\n mapping(bytes32 => PythStructs.PriceFeed) priceFeeds;\n uint64 sequenceNumber;\n\n uint singleUpdateFeeInWei;\n uint validTimePeriod;\n\n constructor(uint _validTimePeriod, uint _singleUpdateFeeInWei) {\n singleUpdateFeeInWei = _singleUpdateFeeInWei;\n validTimePeriod = _validTimePeriod;\n }\n\n function queryPriceFeed(\n bytes32 id\n ) public view override returns (PythStructs.PriceFeed memory priceFeed) {\n if (priceFeeds[id].id == 0) revert PythErrors.PriceFeedNotFound();\n return priceFeeds[id];\n }\n\n function priceFeedExists(bytes32 id) public view override returns (bool) {\n return (priceFeeds[id].id != 0);\n }\n\n function getValidTimePeriod() public view override returns (uint) {\n return validTimePeriod;\n }\n\n // Takes an array of encoded price feeds and stores them.\n // You can create this data either by calling createPriceFeedData or\n // by using web3.js or ethers abi utilities.\n function updatePriceFeeds(\n bytes[] calldata updateData\n ) public payable override {\n uint requiredFee = getUpdateFee(updateData);\n if (msg.value < requiredFee) revert PythErrors.InsufficientFee();\n\n // Chain ID is id of the source chain that the price update comes from. Since it is just a mock contract\n // We set it to 1.\n uint16 chainId = 1;\n\n for (uint i = 0; i < updateData.length; i++) {\n PythStructs.PriceFeed memory priceFeed = abi.decode(\n updateData[i],\n (PythStructs.PriceFeed)\n );\n\n uint lastPublishTime = priceFeeds[priceFeed.id].price.publishTime;\n\n if (lastPublishTime < priceFeed.price.publishTime) {\n // Price information is more recent than the existing price information.\n priceFeeds[priceFeed.id] = priceFeed;\n emit PriceFeedUpdate(\n priceFeed.id,\n uint64(lastPublishTime),\n priceFeed.price.price,\n priceFeed.price.conf\n );\n }\n }\n\n // In the real contract, the input of this function contains multiple batches that each contain multiple prices.\n // This event is emitted when a batch is processed. In this mock contract we consider there is only one batch of prices.\n // Each batch has (chainId, sequenceNumber) as it's unique identifier. Here chainId is set to 1 and an increasing sequence number is used.\n emit BatchPriceFeedUpdate(chainId, sequenceNumber);\n sequenceNumber += 1;\n }\n\n function getUpdateFee(\n bytes[] calldata updateData\n ) public view override returns (uint feeAmount) {\n return singleUpdateFeeInWei * updateData.length;\n }\n\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n ) external payable override returns (PythStructs.PriceFeed[] memory feeds) {\n uint requiredFee = getUpdateFee(updateData);\n if (msg.value < requiredFee) revert PythErrors.InsufficientFee();\n\n feeds = new PythStructs.PriceFeed[](priceIds.length);\n\n for (uint i = 0; i < priceIds.length; i++) {\n for (uint j = 0; j < updateData.length; j++) {\n feeds[i] = abi.decode(updateData[j], (PythStructs.PriceFeed));\n\n if (feeds[i].id == priceIds[i]) {\n uint publishTime = feeds[i].price.publishTime;\n if (\n minPublishTime <= publishTime &&\n publishTime <= maxPublishTime\n ) {\n break;\n } else {\n feeds[i].id = 0;\n }\n }\n }\n\n if (feeds[i].id != priceIds[i])\n revert PythErrors.PriceFeedNotFoundWithinRange();\n }\n }\n\n function createPriceFeedUpdateData(\n bytes32 id,\n int64 price,\n uint64 conf,\n int32 expo,\n int64 emaPrice,\n uint64 emaConf,\n uint64 publishTime\n ) public pure returns (bytes memory priceFeedData) {\n PythStructs.PriceFeed memory priceFeed;\n\n priceFeed.id = id;\n\n priceFeed.price.price = price;\n priceFeed.price.conf = conf;\n priceFeed.price.expo = expo;\n priceFeed.price.publishTime = publishTime;\n\n priceFeed.emaPrice.price = emaPrice;\n priceFeed.emaPrice.conf = emaConf;\n priceFeed.emaPrice.expo = expo;\n priceFeed.emaPrice.publishTime = publishTime;\n\n priceFeedData = abi.encode(priceFeed);\n }\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythErrors.sol": { + "content": "// SPDX-License-Identifier: Apache 2\n\npragma solidity ^0.8.0;\n\nlibrary PythErrors {\n // Function arguments are invalid (e.g., the arguments lengths mismatch)\n error InvalidArgument();\n // Update data is coming from an invalid data source.\n error InvalidUpdateDataSource();\n // Update data is invalid (e.g., deserialization error)\n error InvalidUpdateData();\n // Insufficient fee is paid to the method.\n error InsufficientFee();\n // There is no fresh update, whereas expected fresh updates.\n error NoFreshUpdate();\n // There is no price feed found within the given range or it does not exists.\n error PriceFeedNotFoundWithinRange();\n // Price feed not found or it is not pushed on-chain yet.\n error PriceFeedNotFound();\n // Requested price is stale.\n error StalePrice();\n // Given message is not a valid Wormhole VAA.\n error InvalidWormholeVaa();\n // Governance message is invalid (e.g., deserialization error).\n error InvalidGovernanceMessage();\n // Governance message is not for this contract.\n error InvalidGovernanceTarget();\n // Governance message is coming from an invalid data source.\n error InvalidGovernanceDataSource();\n // Governance message is old.\n error OldGovernanceMessage();\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythStructs.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\ncontract PythStructs {\n // A price with a degree of uncertainty, represented as a price +- a confidence interval.\n //\n // The confidence interval roughly corresponds to the standard error of a normal distribution.\n // Both the price and confidence are stored in a fixed-point numeric representation,\n // `x * (10^expo)`, where `expo` is the exponent.\n //\n // Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how\n // to how this price safely.\n struct Price {\n // Price\n int64 price;\n // Confidence interval around the price\n uint64 conf;\n // Price exponent\n int32 expo;\n // Unix timestamp describing when the price was published\n uint publishTime;\n }\n\n // PriceFeed represents a current aggregate price from pyth publisher feeds.\n struct PriceFeed {\n // The price ID.\n bytes32 id;\n // Latest available price\n Price price;\n // Latest available exponentially-weighted moving average price\n Price emaPrice;\n }\n}\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nlibrary PrudentiaLib {\n struct PrudentiaConfig {\n address controller; // Adrastia Prudentia controller address\n uint8 offset; // Offset for delayed rate activation\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\n }\n}\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Careful Math\n * @author Compound\n * @notice Derived from OpenZeppelin's SafeMath library\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\n */\ncontract CarefulMath {\n /**\n * @dev Possible error codes that we can return\n */\n enum MathError {\n NO_ERROR,\n DIVISION_BY_ZERO,\n INTEGER_OVERFLOW,\n INTEGER_UNDERFLOW\n }\n\n /**\n * @dev Multiplies two numbers, returns an error on overflow.\n */\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (a == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n uint256 c;\n unchecked {\n c = a * b;\n }\n\n if (c / a != b) {\n return (MathError.INTEGER_OVERFLOW, 0);\n } else {\n return (MathError.NO_ERROR, c);\n }\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b == 0) {\n return (MathError.DIVISION_BY_ZERO, 0);\n }\n\n return (MathError.NO_ERROR, a / b);\n }\n\n /**\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\n */\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b <= a) {\n return (MathError.NO_ERROR, a - b);\n } else {\n return (MathError.INTEGER_UNDERFLOW, 0);\n }\n }\n\n /**\n * @dev Adds two numbers, returns an error on overflow.\n */\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n uint256 c;\n unchecked {\n c = a + b;\n }\n\n if (c >= a) {\n return (MathError.NO_ERROR, c);\n } else {\n return (MathError.INTEGER_OVERFLOW, 0);\n }\n }\n\n /**\n * @dev add a and b and then subtract c\n */\n function addThenSubUInt(\n uint256 a,\n uint256 b,\n uint256 c\n ) internal pure returns (MathError, uint256) {\n (MathError err0, uint256 sum) = addUInt(a, b);\n\n if (err0 != MathError.NO_ERROR) {\n return (err0, 0);\n }\n\n return subUInt(sum, c);\n }\n}\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\n\n/**\n * @title Compound's CErc20Delegate Contract\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\n * @author Compound\n */\ncontract CErc20Delegate is CErc20 {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 3;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n */\n function _becomeImplementation(bytes memory) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 1;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20Delegate\";\n }\n}\n" + }, + "contracts/compound/CErc20Delegator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ComptrollerInterface.sol\";\nimport \"./InterestRateModel.sol\";\nimport \"../ionic/DiamondExtension.sol\";\nimport { CErc20DelegatorBase, CDelegateInterface } from \"./CTokenInterfaces.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\n\n/**\n * @title Compound's CErc20Delegator Contract\n * @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Compound\n */\ncontract CErc20Delegator is CErc20DelegatorBase, DiamondBase {\n /**\n * @notice Emitted when implementation is changed\n */\n event NewImplementation(address oldImplementation, address newImplementation);\n\n /**\n * @notice Initialize the new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param ionicAdmin_ The FeeDistributor contract address.\n * @param interestRateModel_ The address of the interest rate model\n * @param name_ ERC-20 name of this token\n * @param symbol_ ERC-20 symbol of this token\n */\n constructor(\n address underlying_,\n IonicComptroller comptroller_,\n address payable ionicAdmin_,\n InterestRateModel interestRateModel_,\n string memory name_,\n string memory symbol_,\n uint256 reserveFactorMantissa_,\n uint256 adminFeeMantissa_\n ) {\n require(msg.sender == ionicAdmin_, \"!admin\");\n uint8 decimals_ = EIP20Interface(underlying_).decimals();\n {\n ionicAdmin = ionicAdmin_;\n\n // Set initial exchange rate\n initialExchangeRateMantissa = 0.2e18;\n\n // Set the comptroller\n comptroller = comptroller_;\n\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\n accrualBlockNumber = block.number;\n borrowIndex = 1e18;\n\n // Set the interest rate model (depends on block number / borrow index)\n require(interestRateModel_.isInterestRateModel(), \"!notIrm\");\n interestRateModel = interestRateModel_;\n emit NewMarketInterestRateModel(InterestRateModel(address(0)), interestRateModel_);\n\n name = name_;\n symbol = symbol_;\n decimals = decimals_;\n\n // Set reserve factor\n // Check newReserveFactor ≤ maxReserveFactor\n require(\n reserveFactorMantissa_ + adminFeeMantissa + ionicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\n \"!rf:set\"\n );\n reserveFactorMantissa = reserveFactorMantissa_;\n emit NewReserveFactor(0, reserveFactorMantissa_);\n\n // Set admin fee\n // Sanitize adminFeeMantissa_\n if (adminFeeMantissa_ == type(uint256).max) adminFeeMantissa_ = adminFeeMantissa;\n // Get latest Ionic fee\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\n require(\n reserveFactorMantissa + adminFeeMantissa_ + newIonicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\n \"!adminFee:set\"\n );\n adminFeeMantissa = adminFeeMantissa_;\n emit NewAdminFee(0, adminFeeMantissa_);\n ionicFeeMantissa = newIonicFeeMantissa;\n emit NewIonicFee(0, newIonicFeeMantissa);\n\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\n _notEntered = true;\n }\n\n // Set underlying and sanity check it\n underlying = underlying_;\n EIP20Interface(underlying).totalSupply();\n }\n\n function implementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"delegateType()\"))));\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external override {\n // Check admin rights\n require(hasAdminRights(), \"!admin\");\n\n // Set implementation\n _setImplementationInternal(implementation_, becomeImplementationData);\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self or admin\");\n\n (bool success, bytes memory data) = address(this).staticcall(abi.encodeWithSignature(\"delegateType()\"));\n require(success, \"no delegate type\");\n\n uint8 currentDelegateType = abi.decode(data, (uint8));\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = IFeeDistributor(ionicAdmin)\n .latestCErc20Delegate(currentDelegateType);\n\n address currentDelegate = implementation();\n if (currentDelegate != latestCErc20Delegate) {\n _setImplementationInternal(latestCErc20Delegate, becomeImplementationData);\n } else {\n // only update the extensions without reinitializing with becomeImplementationData\n _updateExtensions(currentDelegate);\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(msg.sender == address(ionicAdmin), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n\n /**\n * @dev Internal function to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationInternal(address implementation_, bytes memory becomeImplementationData) internal {\n address delegateBefore = implementation();\n _updateExtensions(implementation_);\n\n _functionCall(\n address(this),\n abi.encodeWithSelector(CDelegateInterface._becomeImplementation.selector, becomeImplementationData),\n \"!become impl\"\n );\n\n emit NewImplementation(delegateBefore, implementation_);\n }\n\n function _updateExtensions(address newDelegate) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getCErc20DelegateExtensions(newDelegate);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CErc20PluginDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\nimport \"./IERC4626.sol\";\nimport \"../external/uniswap/IUniswapV2Pair.sol\";\n\n/**\n * @title Rari's CErc20Plugin's Contract\n * @notice CToken which outsources token logic to a plugin\n * @author Joey Santoro\n *\n * CErc20PluginDelegate deposits and withdraws from a plugin contract\n * It is also capable of delegating reward functionality to a PluginRewardsDistributor\n */\ncontract CErc20PluginDelegate is CErc20Delegate {\n event NewPluginImplementation(address oldImpl, address newImpl);\n\n /**\n * @notice Plugin address\n */\n IERC4626 public plugin;\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.plugin.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._updatePlugin.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Delegate interface to become the implementation\n * @param data The encoded arguments for becoming\n */\n function _becomeImplementation(bytes memory data) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _becomeImplementation\");\n\n address _plugin = abi.decode(data, (address));\n\n if (_plugin == address(0) && address(plugin) != address(0)) {\n // if no new plugin address is given, use the latest implementation\n _plugin = IFeeDistributor(ionicAdmin).latestPluginImplementation(address(plugin));\n }\n\n if (_plugin != address(0) && _plugin != address(plugin)) {\n _updatePlugin(_plugin);\n }\n }\n\n /**\n * @notice Update the plugin implementation to a whitelisted implementation\n * @param _plugin The address of the plugin implementation to use\n */\n function _updatePlugin(address _plugin) public {\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _updatePlugin\");\n\n address oldImplementation = address(plugin) != address(0) ? address(plugin) : _plugin;\n\n if (address(plugin) != address(0) && plugin.balanceOf(address(this)) != 0) {\n plugin.redeem(plugin.balanceOf(address(this)), address(this), address(this));\n }\n\n plugin = IERC4626(_plugin);\n\n EIP20Interface(underlying).approve(_plugin, type(uint256).max);\n\n uint256 amount = EIP20Interface(underlying).balanceOf(address(this));\n if (amount != 0) {\n deposit(amount);\n }\n\n emit NewPluginImplementation(oldImplementation, _plugin);\n }\n\n /*** CToken Overrides ***/\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of the plugin in terms of the underlying\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view override returns (uint256) {\n return plugin.previewRedeem(plugin.balanceOf(address(this)));\n }\n\n /**\n * @notice Transfer the underlying to the cToken and trigger a deposit\n * @param from Address to transfer funds from\n * @param amount Amount of underlying to transfer\n * @return The actual amount that is transferred\n */\n function doTransferIn(address from, uint256 amount) internal override returns (uint256) {\n // Perform the EIP-20 transfer in\n require(EIP20Interface(underlying).transferFrom(from, address(this), amount), \"send\");\n\n deposit(amount);\n return amount;\n }\n\n function deposit(uint256 amount) internal {\n plugin.deposit(amount, address(this));\n }\n\n /**\n * @notice Transfer the underlying from plugin to destination\n * @param to Address to transfer funds to\n * @param amount Amount of underlying to transfer\n */\n function doTransferOut(address to, uint256 amount) internal override {\n plugin.withdraw(amount, to, address(this));\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 2;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20PluginDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20PluginRewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20PluginDelegate.sol\";\n\ncontract CErc20PluginRewardsDelegate is CErc20PluginDelegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying && _token != address(plugin), \"!token\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 4;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20PluginRewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\n\ncontract CErc20RewardsDelegate is CErc20Delegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n \n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying, \"!underlying\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 3;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20RewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegateMorpho.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20RewardsDelegate.sol\";\n\ncontract CErc20RewardsDelegateMorpho is CErc20Delegate {\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 1;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\n * @param rewardToken The reward strategy for which the rewards are being claimed.\n * @param claimable The amount of tokens to claim and forward.\n * @param proof The proof required to validate the claim.\n * @dev Only callable by the governance.\n */\n function claim(address morphoURD, address rewardToken, uint256 claimable, bytes32[] memory proof) external isAuthorized {\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\n EIP20Interface(rewardToken).transfer(comptroller.admin(), claimedAmount);\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 5;\n }\n}\n\ninterface IMorphoClaim {\n function claim(\n address account,\n address reward,\n uint256 claimable,\n bytes32[] memory proof\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./Unitroller.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\n */\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when an admin supports a market\n event MarketListed(ICErc20 cToken);\n\n /// @notice Emitted when an account enters a market\n event MarketEntered(ICErc20 cToken, address account);\n\n /// @notice Emitted when an account exits a market\n event MarketExited(ICErc20 cToken, address account);\n\n /// @notice Emitted when close factor is changed by admin\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\n\n /// @notice Emitted when a collateral factor is changed by admin\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\n\n /// @notice Emitted when liquidation incentive is changed by admin\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\n\n /// @notice Emitted when price oracle is changed\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\n\n /// @notice Emitted when the whitelist enforcement is changed\n event WhitelistEnforcementChanged(bool enforce);\n\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\n event AddedRewardsDistributor(address rewardsDistributor);\n\n // closeFactorMantissa must be strictly greater than this value\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\n\n // closeFactorMantissa must not exceed this value\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\n\n // No collateralFactorMantissa may exceed this value\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\n\n // liquidationIncentiveMantissa must be no less than this value\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\n\n // liquidationIncentiveMantissa must be no greater than this value\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\n\n modifier isAuthorized() {\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\n _;\n }\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\n return ComptrollerBase.effectiveSupplyCaps(cToken);\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\n return ComptrollerBase.effectiveBorrowCaps(cToken);\n }\n\n /*** Assets You Are In ***/\n\n /**\n * @notice Returns the assets an account has entered\n * @param account The address of the account to pull assets for\n * @return A dynamic list with the assets the account has entered\n */\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\n ICErc20[] memory assetsIn = accountAssets[account];\n\n return assetsIn;\n }\n\n /**\n * @notice Returns whether the given account is entered in the given asset\n * @param account The address of the account to check\n * @param cToken The cToken to check\n * @return True if the account is in the asset, otherwise false.\n */\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\n return markets[address(cToken)].accountMembership[account];\n }\n\n /**\n * @notice Add assets to be included in account liquidity calculation\n * @param cTokens The list of addresses of the cToken markets to be enabled\n * @return Success indicator for whether each corresponding market was entered\n */\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\n uint256 len = cTokens.length;\n\n uint256[] memory results = new uint256[](len);\n for (uint256 i = 0; i < len; i++) {\n ICErc20 cToken = ICErc20(cTokens[i]);\n\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\n }\n\n return results;\n }\n\n /**\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\n * @param cToken The market to enter\n * @param borrower The address of the account to modify\n * @return Success indicator for whether the market was entered\n */\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\n Market storage marketToJoin = markets[address(cToken)];\n\n if (!marketToJoin.isListed) {\n // market is not listed, cannot join\n return Error.MARKET_NOT_LISTED;\n }\n\n if (marketToJoin.accountMembership[borrower] == true) {\n // already joined\n return Error.NO_ERROR;\n }\n\n // survived the gauntlet, add to list\n // NOTE: we store these somewhat redundantly as a significant optimization\n // this avoids having to iterate through the list for the most common use cases\n // that is, only when we need to perform liquidity checks\n // and not whenever we want to check if an account is in a particular market\n marketToJoin.accountMembership[borrower] = true;\n accountAssets[borrower].push(cToken);\n\n // Add to allBorrowers\n if (!borrowers[borrower]) {\n allBorrowers.push(borrower);\n borrowers[borrower] = true;\n borrowerIndexes[borrower] = allBorrowers.length - 1;\n }\n\n emit MarketEntered(cToken, borrower);\n\n return Error.NO_ERROR;\n }\n\n /**\n * @notice Removes asset from sender's account liquidity calculation\n * @dev Sender must not have an outstanding borrow balance in the asset,\n * or be providing necessary collateral for an outstanding borrow.\n * @param cTokenAddress The address of the asset to be removed\n * @return Whether or not the account successfully exited the market\n */\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\n // TODO\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\n\n ICErc20 cToken = ICErc20(cTokenAddress);\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\n\n /* Fail if the sender has a borrow balance */\n if (amountOwed != 0) {\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\n }\n\n /* Fail if the sender is not permitted to redeem all of their tokens */\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\n if (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\n }\n\n Market storage marketToExit = markets[cTokenAddress];\n\n /* Return true if the sender is not already ‘in’ the market */\n if (!marketToExit.accountMembership[msg.sender]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Set cToken account membership to false */\n delete marketToExit.accountMembership[msg.sender];\n\n /* Delete cToken from the account’s list of assets */\n // load into memory for faster iteration\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\n uint256 len = userAssetList.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n ICErc20[] storage storedList = accountAssets[msg.sender];\n storedList[assetIndex] = storedList[storedList.length - 1];\n storedList.pop();\n\n // If the user has exited all markets, remove them from the `allBorrowers` array\n if (storedList.length == 0) {\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\n allBorrowers.pop(); // Reduce length by 1\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\n }\n\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Policy Hooks ***/\n\n /**\n * @notice Checks if the account should be allowed to mint tokens in the given market\n * @param cTokenAddress The market to verify the mint against\n * @param minter The account which would get the minted tokens\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\n\n // Make sure market is listed\n if (!markets[cTokenAddress].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure minter is whitelisted\n if (enforceWhitelist && !whitelist[minter]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\n\n // Supply cap of 0 corresponds to unlimited supplying\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\n uint256 nonWhitelistedTotalSupply;\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\n\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cTokenAddress, minter);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to redeem tokens in the given market\n * @param cToken The market to verify the redeem against\n * @param redeemer The account which would redeem the tokens\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cToken, redeemer);\n\n return uint256(Error.NO_ERROR);\n }\n\n function redeemAllowedInternal(\n address cToken,\n address redeemer,\n uint256 redeemTokens\n ) internal view returns (uint256) {\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\n if (!markets[cToken].accountMembership[redeemer]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n redeemer,\n ICErc20(cToken),\n redeemTokens,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates mint and reverts on rejection. May emit logs.\n * @param cToken Asset being minted\n * @param minter The address minting the tokens\n * @param actualMintAmount The amount of the underlying asset being minted\n * @param mintTokens The number of tokens being minted\n */\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\n // Add minter to suppliers mapping\n suppliers[minter] = true;\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, minter);\n }\n\n /**\n * @notice Validates redeem and reverts on rejection. May emit logs.\n * @param cToken Asset being redeemed\n * @param redeemer The address redeeming the tokens\n * @param redeemAmount The amount of the underlying asset being redeemed\n * @param redeemTokens The number of tokens being redeemed\n */\n function redeemVerify(\n address cToken,\n address redeemer,\n uint256 redeemAmount,\n uint256 redeemTokens\n ) external override {\n require(markets[msg.sender].isListed, \"!market\");\n\n // Require tokens is zero or amount is also zero\n if (redeemTokens == 0 && redeemAmount > 0) {\n revert(\"!zero\");\n }\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, redeemer);\n }\n\n function getMaxRedeemOrBorrow(\n address account,\n ICErc20 cTokenModify,\n bool isBorrow\n ) external view override returns (uint256) {\n address cToken = address(cTokenModify);\n // Accrue interest\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\n\n // Get account liquidity\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n isBorrow ? cTokenModify : ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n require(err == Error.NO_ERROR, \"!liquidity\");\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\n\n // Get max borrow/redeem\n uint256 maxBorrowOrRedeemAmount;\n\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\n // Max redeem = balance of underlying if not used as collateral\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\n } else {\n // Avoid \"stack too deep\" error by separating this logic\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\n\n // Redeem only: max out at underlying balance\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\n }\n\n // Get max borrow or redeem considering cToken liquidity\n uint256 cTokenLiquidity = cTokenModify.getCash();\n\n // Return the minimum of the two maximums\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\n }\n\n /**\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\n */\n function _getMaxRedeemOrBorrow(\n uint256 liquidity,\n ICErc20 cTokenModify,\n bool isBorrow\n ) internal view returns (uint256) {\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\n\n // Get the normalized price of the asset\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\n require(conversionFactor > 0, \"!oracle\");\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n if (!isBorrow) {\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\n }\n\n // Get max borrow or redeem considering excess account liquidity\n return (liquidity * 1e18) / conversionFactor;\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which would borrow the asset\n * @param borrowAmount The amount of underlying the account would borrow\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\n\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n if (!markets[cToken].accountMembership[borrower]) {\n // only cTokens may call borrowAllowed if borrower not in market\n require(msg.sender == cToken, \"!ctoken\");\n\n // attempt to add borrower to the market\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n // it should be impossible to break the important invariant\n assert(markets[cToken].accountMembership[borrower]);\n }\n\n // Make sure oracle price is available\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\n return uint256(Error.PRICE_ERROR);\n }\n\n // Make sure borrower is whitelisted\n if (enforceWhitelist && !whitelist[borrower]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 borrowCap = effectiveBorrowCaps(cToken);\n\n // Borrow cap of 0 corresponds to unlimited borrowing\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\n uint256 nonWhitelistedTotalBorrows;\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n // Perform a hypothetical liquidity check to guard against shortfall\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\n if (err != uint256(Error.NO_ERROR)) {\n return err;\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which borrowed the asset\n */\n function borrowVerify(address cToken, address borrower) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken Asset whose underlying is being borrowed\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\n */\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\n // Check if min borrow exists\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\n\n if (minBorrowEth > 0) {\n // Get new underlying borrow balance of account for this cToken\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\n Exp({ mantissa: oraclePriceMantissa }),\n accountBorrowsNew\n );\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\n\n // Check against min borrow\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\n }\n\n // Return no error\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to repay a borrow in the given market\n * @param cToken The market to verify the repay against\n * @param payer The account which would repay the asset\n * @param borrower The account which would borrowed the asset\n * @param repayAmount The amount of the underlying asset the account would repay\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after borrow repayment\n * @param cToken The market to verify the repay against\n * @param payer The account which repayed the asset\n * @param borrower The account which borrowed the asset\n * @param repayAmount The amount of the underlying asset the account repayed\n */\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the liquidation should be allowed to occur\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param repayAmount The amount of underlying being repaid\n */\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure markets are listed\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Get borrowers' underlying borrow balance\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\n\n /* allow accounts to be liquidated if the market is deprecated */\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\n } else {\n /* The borrower must have shortfall in order to be liquidateable */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n borrower,\n ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n if (shortfall == 0) {\n return uint256(Error.INSUFFICIENT_SHORTFALL);\n }\n\n /* The liquidator may not repay more than what is allowed by the closeFactor */\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\n if (repayAmount > maxClose) {\n return uint256(Error.TOO_MUCH_REPAY);\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the seizing of assets should be allowed to occur\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!seizeGuardianPaused, \"!seize:paused\");\n\n // Make sure markets are listed\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure cToken Comptrollers are identical\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\n return uint256(Error.COMPTROLLER_MISMATCH);\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after seizing of assets\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override {\n // Keep the flywheel moving\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\n }\n\n /**\n * @notice Checks if the account should be allowed to transfer tokens in the given market\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function transferAllowed(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!transferGuardianPaused, \"!transfer:paused\");\n\n // Currently the only consideration is whether or not\n // the src is allowed to redeem this many tokens\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cToken, src, dst);\n\n return uint256(Error.NO_ERROR);\n }\n\n\n /**\n * @notice Validates that blacklisted balances are updated after transfering assets\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n */\n function transferVerify(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override {\n\n // Keep the flywheel moving\n flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Flywheel Hooks ***/\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving post-mint and post-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving post-borrow and post-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\n }\n\n /**\n * @notice Keeps the flywheel moving post-transfer and post-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Liquidity/Liquidation Calculations ***/\n\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountLiquidityLocalVars {\n ICErc20 asset;\n uint256 sumCollateral;\n uint256 sumBorrowPlusEffects;\n uint256 cTokenBalance;\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n uint256 oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n uint256 borrowCapForCollateral;\n uint256 borrowedAssetPrice;\n uint256 assetAsCollateralValueCap;\n }\n\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code (semi-opaque),\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(\n account,\n ICErc20(cTokenModify),\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code,\n hypothetical account collateral value,\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidityInternal(\n address account,\n ICErc20 cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) internal view returns (Error, uint256, uint256, uint256) {\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\n\n if (address(cTokenModify) != address(0)) {\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n }\n\n // For each asset the account is in\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\n vars.asset = accountAssets[account][i];\n\n {\n // Read the balances and exchange rate from the cToken\n uint256 oErr;\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\n account\n );\n if (oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\n }\n }\n {\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\n if (vars.oraclePriceMantissa == 0) {\n return (Error.PRICE_ERROR, 0, 0, 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n }\n {\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\n vars.asset,\n cTokenModify,\n redeemTokens > 0,\n account\n );\n\n // accumulate the collateral value to sumCollateral\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\n assetCollateralValue = vars.assetAsCollateralValueCap;\n vars.sumCollateral += assetCollateralValue;\n }\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n\n // Calculate effects of interacting with cTokenModify\n if (vars.asset == cTokenModify) {\n // redeem effect\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.tokensToDenom,\n redeemTokens,\n vars.sumBorrowPlusEffects\n );\n\n // borrow effect\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n borrowAmount,\n vars.sumBorrowPlusEffects\n );\n\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\n if (repayEffect >= vars.sumBorrowPlusEffects) {\n vars.sumBorrowPlusEffects = 0;\n } else {\n vars.sumBorrowPlusEffects -= repayEffect;\n }\n }\n }\n\n // These are safe, as the underflow condition is checked first\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\n } else {\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\n }\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\n * @param cTokenBorrowed The address of the borrowed cToken\n * @param cTokenCollateral The address of the collateral cToken\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view override returns (uint256, uint256) {\n /* Read oracle prices for borrowed and collateral markets */\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\n return (uint256(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\n uint256 seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\n\n /*\n * The liquidation penalty includes\n * - the liquidator incentive\n * - the protocol fees (Ionic admin fees)\n * - the market fee\n */\n Exp memory totalPenaltyMantissa = add_(\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\n Exp({ mantissa: feeSeizeShareMantissa })\n );\n\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n return (uint256(Error.NO_ERROR), seizeTokens);\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Add a RewardsDistributor contracts.\n * @dev Admin function to add a RewardsDistributor contract\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addRewardsDistributor(address distributor) external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n\n // Check marker method\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\n\n // Check for existing RewardsDistributor\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\n\n // Add RewardsDistributor to array\n rewardsDistributors.push(distributor);\n emit AddedRewardsDistributor(distributor);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist enforcement for the comptroller\n * @dev Admin function to set a new whitelist enforcement boolean\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\n }\n\n // Check if `enforceWhitelist` already equals `enforce`\n if (enforceWhitelist == enforce) {\n return uint256(Error.NO_ERROR);\n }\n\n // Set comptroller's `enforceWhitelist` to `enforce`\n enforceWhitelist = enforce;\n\n // Emit WhitelistEnforcementChanged(bool enforce);\n emit WhitelistEnforcementChanged(enforce);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist `statuses` for `suppliers`\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\n }\n\n // Set whitelist statuses for suppliers\n for (uint256 i = 0; i < suppliers.length; i++) {\n address supplier = suppliers[i];\n\n if (statuses[i]) {\n // If not already whitelisted, add to whitelist\n if (!whitelist[supplier]) {\n whitelist[supplier] = true;\n whitelistArray.push(supplier);\n whitelistIndexes[supplier] = whitelistArray.length - 1;\n }\n } else {\n // If whitelisted, remove from whitelist\n if (whitelist[supplier]) {\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\n whitelistArray.pop(); // Reduce length by 1\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\n }\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new price oracle for the comptroller\n * @dev Admin function to set a new price oracle\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\n }\n\n // Track the old oracle for the comptroller\n BasePriceOracle oldOracle = oracle;\n\n // Set comptroller's oracle to newOracle\n oracle = newOracle;\n\n // Emit NewPriceOracle(oldOracle, newOracle)\n emit NewPriceOracle(oldOracle, newOracle);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the closeFactor used when liquidating borrows\n * @dev Admin function to set closeFactor\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\n }\n\n // Check limits\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\n if (lessThanExp(highLimit, newCloseFactorExp)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n // Set pool close factor to new close factor, remember old value\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\n closeFactorMantissa = newCloseFactorMantissa;\n\n // Emit event\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the collateralFactor for a market\n * @dev Admin function to set per-market collateralFactor\n * @param cToken The market to set the factor on\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\n }\n\n // Verify market is listed\n Market storage market = markets[address(cToken)];\n if (!market.isListed) {\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\n }\n\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\n\n // Check collateral factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\n }\n\n // If collateral factor != 0, fail if price == 0\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\n }\n\n // Set market's collateral factor to new collateral factor, remember old value\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\n market.collateralFactorMantissa = newCollateralFactorMantissa;\n\n // Emit event with asset, old collateral factor, and new collateral factor\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets liquidationIncentive\n * @dev Admin function to set liquidationIncentive\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\n }\n\n // Check de-scaled min <= newLiquidationIncentive <= max\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n // Save current value for use in log\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\n\n // Set liquidation incentive to new incentive\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\n\n // Emit event with old incentive, new incentive\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Add the market to the markets mapping and set it as listed\n * @dev Admin function to set isListed and add support for the market\n * @param cToken The address of the market (token) to list\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Is market already listed?\n if (markets[address(cToken)].isListed) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // Check cToken.comptroller == this\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\n\n // Make sure market is not already listed\n address underlying = ICErc20(address(cToken)).underlying();\n\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // List market and emit event\n Market storage market = markets[address(cToken)];\n market.isListed = true;\n market.collateralFactorMantissa = 0;\n allMarkets.push(cToken);\n cTokensByUnderlying[underlying] = cToken;\n emit MarketListed(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _deployMarket(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\n bool oldIonicAdminHasRights = ionicAdminHasRights;\n ionicAdminHasRights = true;\n\n // Deploy via Ionic admin\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\n // Reset Ionic admin rights to the original value\n ionicAdminHasRights = oldIonicAdminHasRights;\n // Support market here in the Comptroller\n uint256 err = _supportMarket(cToken);\n\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\n\n // Set collateral factor\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\n }\n\n function _becomeImplementation() external {\n require(msg.sender == address(this), \"!self call\");\n\n if (!_notEnteredInitialized) {\n _notEntered = true;\n _notEnteredInitialized = true;\n }\n }\n\n /*** Helper Functions ***/\n\n /**\n * @notice Returns true if the given cToken market has been deprecated\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\n * @param cToken The market to check if deprecated\n */\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\n return\n markets[address(cToken)].collateralFactorMantissa == 0 &&\n borrowGuardianPaused[address(cToken)] == true &&\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\n }\n\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\n return ComptrollerExtensionInterface(address(this));\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 32;\n\n functionSelectors = new bytes4[](fnsCount);\n\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\n functionSelectors[--fnsCount] = this._deployMarket.selector;\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\n functionSelectors[--fnsCount] = this.checkMembership.selector;\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\n functionSelectors[--fnsCount] = this.exitMarket.selector;\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\n functionSelectors[--fnsCount] = this.mintVerify.selector;\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n /**\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _beforeNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\n require(_notEntered, \"!reentered\");\n _notEntered = false;\n }\n\n /**\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _afterNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n}\n" + }, + "contracts/compound/ComptrollerFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, SFSRegister } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract ComptrollerFirstExtension is\n DiamondExtension,\n ComptrollerBase,\n ComptrollerExtensionInterface,\n ComptrollerErrorReporter\n{\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when supply cap for a cToken is changed\n event NewSupplyCap(ICErc20 indexed cToken, uint256 newSupplyCap);\n\n /// @notice Emitted when borrow cap for a cToken is changed\n event NewBorrowCap(ICErc20 indexed cToken, uint256 newBorrowCap);\n\n /// @notice Emitted when borrow cap guardian is changed\n event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian);\n\n /// @notice Emitted when pause guardian is changed\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\n\n /// @notice Emitted when an action is paused globally\n event ActionPaused(string action, bool pauseState);\n\n /// @notice Emitted when an action is paused on a market\n event MarketActionPaused(ICErc20 cToken, string action, bool pauseState);\n\n /// @notice Emitted when an admin unsupports a market\n event MarketUnlisted(ICErc20 cToken);\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 33;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.addNonAccruingFlywheel.selector;\n functionSelectors[--fnsCount] = this._setMarketSupplyCaps.selector;\n functionSelectors[--fnsCount] = this._setMarketBorrowCaps.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateralWhitelist.selector;\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateralWhitelist.selector;\n functionSelectors[--fnsCount] = this._supplyCapWhitelist.selector;\n functionSelectors[--fnsCount] = this._borrowCapWhitelist.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapGuardian.selector;\n functionSelectors[--fnsCount] = this._setPauseGuardian.selector;\n functionSelectors[--fnsCount] = this._setMintPaused.selector;\n functionSelectors[--fnsCount] = this._setBorrowPaused.selector;\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\n functionSelectors[--fnsCount] = this._unsupportMarket.selector;\n functionSelectors[--fnsCount] = this.getAllMarkets.selector;\n functionSelectors[--fnsCount] = this.getAllBorrowers.selector;\n functionSelectors[--fnsCount] = this.getAllBorrowersCount.selector;\n functionSelectors[--fnsCount] = this.getPaginatedBorrowers.selector;\n functionSelectors[--fnsCount] = this.getWhitelist.selector;\n functionSelectors[--fnsCount] = this.getRewardsDistributors.selector;\n functionSelectors[--fnsCount] = this.isUserOfPool.selector;\n functionSelectors[--fnsCount] = this.getAccruingFlywheels.selector;\n functionSelectors[--fnsCount] = this._removeFlywheel.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateral.selector;\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateral.selector;\n functionSelectors[--fnsCount] = this.isBorrowCapForCollateralWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isBlacklistBorrowingAgainstCollateralWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isSupplyCapWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isBorrowCapWhitelisted.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedSuppliersSupply.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedBorrowersBorrows.selector;\n functionSelectors[--fnsCount] = this.getAssetAsCollateralValueCap.selector;\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /**\n * @notice Returns true if the accruing flyhwheel was found and replaced\n * @dev Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\n * @param flywheelAddress The address of the flywheel to add to the non-accruing\n */\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool) {\n require(hasAdminRights(), \"!admin\");\n require(flywheelAddress != address(0), \"!flywheel\");\n\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\n require(flywheelAddress != nonAccruingRewardsDistributors[i], \"!alreadyadded\");\n }\n\n // add it to the non-accruing\n nonAccruingRewardsDistributors.push(flywheelAddress);\n\n // remove it from the accruing\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\n if (flywheelAddress == rewardsDistributors[i]) {\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\n rewardsDistributors.pop();\n return true;\n }\n }\n\n return false;\n }\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256) {\n if (address(collateral) == address(cTokenModify) && !redeeming) {\n // the collateral asset counts as 0 liquidity when borrowed\n return 0;\n }\n\n uint256 assetAsCollateralValueCap = type(uint256).max;\n if (address(cTokenModify) != address(0)) {\n // if the borrowed asset is blacklisted against this collateral & account is not whitelisted\n if (\n borrowingAgainstCollateralBlacklist[address(cTokenModify)][address(collateral)] &&\n !borrowingAgainstCollateralBlacklistWhitelist[address(cTokenModify)][address(collateral)].contains(account)\n ) {\n assetAsCollateralValueCap = 0;\n } else {\n // for each user the value of this kind of collateral is capped regardless of the amount borrowed\n // denominated in the borrowed asset\n uint256 borrowCapForCollateral = borrowCapForCollateral[address(cTokenModify)][address(collateral)];\n // check if set to any value & account is not whitelisted\n if (\n borrowCapForCollateral != 0 &&\n !borrowCapForCollateralWhitelist[address(cTokenModify)][address(collateral)].contains(account)\n ) {\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n // this asset usage as collateral is capped at the native value of the borrow cap\n assetAsCollateralValueCap = (borrowCapForCollateral * borrowedAssetPrice) / 1e18;\n }\n }\n }\n\n uint256 supplyCap = effectiveSupplyCaps(address(collateral));\n\n // if there is any supply cap, don't allow donations to the market/plugin to go around it\n if (supplyCap > 0 && !supplyCapWhitelist[address(collateral)].contains(account)) {\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateral);\n uint256 supplyCapValue = (supplyCap * collateralAssetPrice) / 1e18;\n supplyCapValue = (supplyCapValue * markets[address(collateral)].collateralFactorMantissa) / 1e18;\n if (supplyCapValue < assetAsCollateralValueCap) assetAsCollateralValueCap = supplyCapValue;\n }\n\n return assetAsCollateralValueCap;\n }\n\n /**\n * @notice Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\n * @dev Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\n * @param cTokens The addresses of the markets (tokens) to change the supply caps for\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\n */\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n uint256 numMarkets = cTokens.length;\n uint256 numSupplyCaps = newSupplyCaps.length;\n\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \"!input\");\n\n for (uint256 i = 0; i < numMarkets; i++) {\n supplyCaps[address(cTokens[i])] = newSupplyCaps[i];\n emit NewSupplyCap(cTokens[i], newSupplyCaps[i]);\n }\n }\n\n /**\n * @notice Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\n * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\n * @param cTokens The addresses of the markets (tokens) to change the borrow caps for\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\n */\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n uint256 numMarkets = cTokens.length;\n uint256 numBorrowCaps = newBorrowCaps.length;\n\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \"!input\");\n\n for (uint256 i = 0; i < numMarkets; i++) {\n borrowCaps[address(cTokens[i])] = newBorrowCaps[i];\n emit NewBorrowCap(cTokens[i], newBorrowCaps[i]);\n }\n }\n\n /**\n * @notice Admin function to change the Borrow Cap Guardian\n * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian\n */\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external {\n require(msg.sender == admin, \"!admin\");\n\n // Save current value for inclusion in log\n address oldBorrowCapGuardian = borrowCapGuardian;\n\n // Store borrowCapGuardian with value newBorrowCapGuardian\n borrowCapGuardian = newBorrowCapGuardian;\n\n // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)\n emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);\n }\n\n /**\n * @notice Admin function to change the Pause Guardian\n * @param newPauseGuardian The address of the new Pause Guardian\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _setPauseGuardian(address newPauseGuardian) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK);\n }\n\n // Save current value for inclusion in log\n address oldPauseGuardian = pauseGuardian;\n\n // Store pauseGuardian with value newPauseGuardian\n pauseGuardian = newPauseGuardian;\n\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\n emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);\n\n return uint256(Error.NO_ERROR);\n }\n\n function _setMintPaused(ICErc20 cToken, bool state) public returns (bool) {\n require(markets[address(cToken)].isListed, \"!market\");\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n mintGuardianPaused[address(cToken)] = state;\n emit MarketActionPaused(cToken, \"Mint\", state);\n return state;\n }\n\n function _setBorrowPaused(ICErc20 cToken, bool state) public returns (bool) {\n require(markets[address(cToken)].isListed, \"!market\");\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n borrowGuardianPaused[address(cToken)] = state;\n emit MarketActionPaused(cToken, \"Borrow\", state);\n return state;\n }\n\n function _setTransferPaused(bool state) public returns (bool) {\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n transferGuardianPaused = state;\n emit ActionPaused(\"Transfer\", state);\n return state;\n }\n\n function _setSeizePaused(bool state) public returns (bool) {\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n seizeGuardianPaused = state;\n emit ActionPaused(\"Seize\", state);\n return state;\n }\n\n /**\n * @notice Removed a market from the markets mapping and sets it as unlisted\n * @dev Admin function unset isListed and collateralFactorMantissa and unadd support for the market\n * @param cToken The address of the market (token) to unlist\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _unsupportMarket(ICErc20 cToken) external returns (uint256) {\n // Check admin rights\n if (!hasAdminRights()) return fail(Error.UNAUTHORIZED, FailureInfo.UNSUPPORT_MARKET_OWNER_CHECK);\n\n // Check if market is already unlisted\n if (!markets[address(cToken)].isListed)\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNSUPPORT_MARKET_DOES_NOT_EXIST);\n\n // Check if market is in use\n if (cToken.totalSupply() > 0) return fail(Error.NONZERO_TOTAL_SUPPLY, FailureInfo.UNSUPPORT_MARKET_IN_USE);\n\n // Unlist market\n delete markets[address(cToken)];\n\n /* Delete cToken from allMarkets */\n // load into memory for faster iteration\n ICErc20[] memory _allMarkets = allMarkets;\n uint256 len = _allMarkets.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (_allMarkets[i] == cToken) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n allMarkets[assetIndex] = allMarkets[allMarkets.length - 1];\n allMarkets.pop();\n\n cTokensByUnderlying[ICErc20(address(cToken)).underlying()] = ICErc20(address(0));\n emit MarketUnlisted(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) public {\n require(hasAdminRights(), \"!admin\");\n borrowCapForCollateral[cTokenBorrow][cTokenCollateral] = borrowCap;\n }\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].add(account);\n else borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\n }\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) public view returns (bool) {\n return borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\n }\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n borrowingAgainstCollateralBlacklist[cTokenBorrow][cTokenCollateral] = blacklisted;\n }\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].add(account);\n else borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\n }\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) public view returns (bool) {\n return borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\n }\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) supplyCapWhitelist[cToken].add(account);\n else supplyCapWhitelist[cToken].remove(account);\n }\n\n function isSupplyCapWhitelisted(address cToken, address account) public view returns (bool) {\n return supplyCapWhitelist[cToken].contains(account);\n }\n\n function getWhitelistedSuppliersSupply(address cToken) public view returns (uint256 supplied) {\n address[] memory whitelistedSuppliers = supplyCapWhitelist[cToken].values();\n for (uint256 i = 0; i < whitelistedSuppliers.length; i++) {\n supplied += ICErc20(cToken).balanceOfUnderlying(whitelistedSuppliers[i]);\n }\n }\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowCapWhitelist[cToken].add(account);\n else borrowCapWhitelist[cToken].remove(account);\n }\n\n function isBorrowCapWhitelisted(address cToken, address account) public view returns (bool) {\n return borrowCapWhitelist[cToken].contains(account);\n }\n\n function getWhitelistedBorrowersBorrows(address cToken) public view returns (uint256 borrowed) {\n address[] memory whitelistedBorrowers = borrowCapWhitelist[cToken].values();\n for (uint256 i = 0; i < whitelistedBorrowers.length; i++) {\n borrowed += ICErc20(cToken).borrowBalanceCurrent(whitelistedBorrowers[i]);\n }\n }\n\n /**\n * @notice Return all of the markets\n * @dev The automatic getter may be used to access an individual market.\n * @return The list of market addresses\n */\n function getAllMarkets() public view returns (ICErc20[] memory) {\n return allMarkets;\n }\n\n /**\n * @notice Return all of the borrowers\n * @dev The automatic getter may be used to access an individual borrower.\n * @return The list of borrower account addresses\n */\n function getAllBorrowers() public view returns (address[] memory) {\n return allBorrowers;\n }\n\n function getAllBorrowersCount() public view returns (uint256) {\n return allBorrowers.length;\n }\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) public view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) {\n uint256 allBorrowersCount = allBorrowers.length;\n if (allBorrowersCount == 0) {\n return (0, new address[](0));\n }\n\n if (pageSize == 0) pageSize = 300;\n uint256 currentPageSize = pageSize;\n uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize;\n\n _totalPages = allBorrowersCount / pageSize;\n if (sizeOfPageFromRemainder > 0) {\n _totalPages++;\n if (page + 1 == _totalPages) {\n currentPageSize = sizeOfPageFromRemainder;\n }\n }\n\n if (page + 1 > _totalPages) {\n return (_totalPages, new address[](0));\n }\n\n uint256 offset = page * pageSize;\n _pageOfBorrowers = new address[](currentPageSize);\n for (uint256 i = 0; i < currentPageSize; i++) {\n _pageOfBorrowers[i] = allBorrowers[i + offset];\n }\n }\n\n /**\n * @notice Return all of the whitelist\n * @dev The automatic getter may be used to access an individual whitelist status.\n * @return The list of borrower account addresses\n */\n function getWhitelist() external view returns (address[] memory) {\n return whitelistArray;\n }\n\n /**\n * @notice Returns an array of all accruing and non-accruing flywheels\n */\n function getRewardsDistributors() external view returns (address[] memory) {\n address[] memory allFlywheels = new address[](rewardsDistributors.length + nonAccruingRewardsDistributors.length);\n\n uint8 i = 0;\n while (i < rewardsDistributors.length) {\n allFlywheels[i] = rewardsDistributors[i];\n i++;\n }\n uint8 j = 0;\n while (j < nonAccruingRewardsDistributors.length) {\n allFlywheels[i + j] = nonAccruingRewardsDistributors[j];\n j++;\n }\n\n return allFlywheels;\n }\n\n function getAccruingFlywheels() external view returns (address[] memory) {\n return rewardsDistributors;\n }\n\n /**\n * @dev Removes a flywheel from the accruing or non-accruing array\n * @param flywheelAddress The address of the flywheel to remove from the accruing or non-accruing array\n * @return true if the flywheel was found and removed\n */\n function _removeFlywheel(address flywheelAddress) external returns (bool) {\n require(hasAdminRights(), \"!admin\");\n require(flywheelAddress != address(0), \"!flywheel\");\n\n // remove it from the accruing\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\n if (flywheelAddress == rewardsDistributors[i]) {\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\n rewardsDistributors.pop();\n return true;\n }\n }\n\n // or remove it from the non-accruing\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\n if (flywheelAddress == nonAccruingRewardsDistributors[i]) {\n nonAccruingRewardsDistributors[i] = nonAccruingRewardsDistributors[nonAccruingRewardsDistributors.length - 1];\n nonAccruingRewardsDistributors.pop();\n return true;\n }\n }\n\n return false;\n }\n\n function isUserOfPool(address user) external view returns (bool) {\n for (uint256 i = 0; i < allMarkets.length; i++) {\n address marketAddress = address(allMarkets[i]);\n if (markets[marketAddress].accountMembership[user]) {\n return true;\n }\n }\n\n return false;\n }\n\n function registerInSFS() external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\n\n for (uint256 i = 0; i < allMarkets.length; i++) {\n allMarkets[i].registerInSFS();\n }\n\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\n }\n}\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\ninterface ComptrollerInterface {\n function isDeprecated(ICErc20 cToken) external view returns (bool);\n\n function _becomeImplementation() external;\n\n function _deployMarket(\n uint8 delegateType,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\n\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\n\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _addRewardsDistributor(address distributor) external returns (uint256);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) external view returns (uint256, uint256, uint256, uint256);\n\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\n\n /*** Assets You Are In ***/\n\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cToken) external returns (uint256);\n\n /*** Policy Hooks ***/\n\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\n\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\n\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\n\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\n\n function borrowVerify(address cToken, address borrower) external;\n\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\n\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external;\n\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n \n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external;\n\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\n \n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\n\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\n\n /*** Liquidity/Liquidation Calculations ***/\n\n function getAccountLiquidity(\n address account\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\n\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 repayAmount\n ) external view returns (uint256, uint256);\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n function _beforeNonReentrant() external;\n\n function _afterNonReentrant() external;\n\n /*** New supply and borrow cap view functions ***/\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\n}\n\ninterface ComptrollerStorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function pendingAdmin() external view returns (address);\n\n function oracle() external view returns (BasePriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function enforceWhitelist() external view returns (bool);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function suppliers(address account) external view returns (bool);\n\n function cTokensByUnderlying(address) external view returns (address);\n\n /**\n * Gets the supply cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\n * `effectiveSupplyCaps` to get the correct supply cap.\n * @param cToken The address of the cToken.\n * @return The supply cap in the units of the underlying asset.\n */\n function supplyCaps(address cToken) external view returns (uint256);\n\n /**\n * Gets the borrow cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\n * `effectiveBorrowCaps` to get the correct borrow cap.\n * @param cToken The address of the cToken.\n * @return The borrow cap in the units of the underlying asset.\n */\n function borrowCaps(address cToken) external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function accountAssets(address, uint256) external view returns (address);\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function rewardsDistributors(uint256) external view returns (address);\n}\n\ninterface SFSRegister {\n function register(address _recipient) external returns (uint256 tokenId);\n}\n\ninterface ComptrollerExtensionInterface {\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function getAllBorrowersCount() external view returns (uint256);\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAccruingFlywheels() external view returns (address[] memory);\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) external;\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _removeFlywheel(address flywheelAddress) external returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\n\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\n\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\n\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\n\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\n\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setTransferPaused(bool state) external returns (bool);\n\n function _setSeizePaused(bool state) external returns (bool);\n\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\n * @return The config.\n */\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\n * @return The config.\n */\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\n * @param newConfig The new config.\n */\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\n * @param newConfig The new config.\n */\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n}\n\ninterface UnitrollerInterface {\n function comptrollerImplementation() external view returns (address);\n\n function _upgrade() external;\n\n function _acceptAdmin() external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n\n function _toggleAdminRights(bool hasRights) external returns (uint256);\n}\n\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\n\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\n\ninterface IonicComptroller is\n ComptrollerInterface,\n ComptrollerExtensionInterface,\n UnitrollerInterface,\n ComptrollerStorageInterface\n{\n\n}\n\nabstract contract ComptrollerBase is ComptrollerV4Storage {\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n bool public constant isComptroller = true;\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\n\n // Check if we're using Adrastia Prudentia for the supply cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the supply cap from Adrastia Prudentia\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n supplyCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n supplyCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local supply cap\n\n // Get the supply cap from the local supply cap\n supplyCap = supplyCaps[cToken];\n }\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\n\n // Check if we're using Adrastia Prudentia for the borrow cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the borrow cap from Adrastia Prudentia\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n borrowCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n borrowCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local borrow cap\n borrowCap = borrowCaps[cToken];\n }\n }\n}\n" + }, + "contracts/compound/ComptrollerPrudentiaCapsExt.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerPrudentiaCapsExtInterface, ComptrollerBase } from \"./ComptrollerInterface.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\n/**\n * @title ComptrollerPrudentiaCapsExt\n * @author Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\n * @notice A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\n */\ncontract ComptrollerPrudentiaCapsExt is DiamondExtension, ComptrollerBase, ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Emitted when the Adrastia Prudentia supply cap config is changed.\n * @param oldConfig The old config.\n * @param newConfig The new config.\n */\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n /**\n * @notice Emitted when the Adrastia Prudentia borrow cap config is changed.\n * @param oldConfig The old config.\n * @param newConfig The new config.\n */\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n PrudentiaLib.PrudentiaConfig memory oldConfig = supplyCapConfig;\n supplyCapConfig = newConfig;\n\n emit NewSupplyCapConfig(oldConfig, newConfig);\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n PrudentiaLib.PrudentiaConfig memory oldConfig = borrowCapConfig;\n borrowCapConfig = newConfig;\n\n emit NewBorrowCapConfig(oldConfig, newConfig);\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\n return borrowCapConfig;\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\n return supplyCapConfig;\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 4;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this._setSupplyCapConfig.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapConfig.selector;\n functionSelectors[--fnsCount] = this.getBorrowCapConfig.selector;\n functionSelectors[--fnsCount] = this.getSupplyCapConfig.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IFeeDistributor.sol\";\nimport \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract UnitrollerAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n\n /**\n * @notice Administrator for this contract\n */\n address public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address public pendingAdmin;\n\n /**\n * @notice Whether or not the Ionic admin has admin rights\n */\n bool public ionicAdminHasRights = true;\n\n /**\n * @notice Whether or not the admin has admin rights\n */\n bool public adminHasRights = true;\n\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\n }\n}\n\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\n /**\n * @notice Oracle which gives the price of any given asset\n */\n BasePriceOracle public oracle;\n\n /**\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\n */\n uint256 public closeFactorMantissa;\n\n /**\n * @notice Multiplier representing the discount on collateral that a liquidator receives\n */\n uint256 public liquidationIncentiveMantissa;\n\n /*\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\n */\n uint256 internal maxAssets;\n\n /**\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\n */\n mapping(address => ICErc20[]) public accountAssets;\n}\n\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\n struct Market {\n // Whether or not this market is listed\n bool isListed;\n // Multiplier representing the most one can borrow against their collateral in this market.\n // For instance, 0.9 to allow borrowing 90% of collateral value.\n // Must be between 0 and 1, and stored as a mantissa.\n uint256 collateralFactorMantissa;\n // Per-market mapping of \"accounts in this asset\"\n mapping(address => bool) accountMembership;\n }\n\n /**\n * @notice Official mapping of cTokens -> Market metadata\n * @dev Used e.g. to determine if a market is supported\n */\n mapping(address => Market) public markets;\n\n /// @notice A list of all markets\n ICErc20[] public allMarkets;\n\n /**\n * @dev Maps borrowers to booleans indicating if they have entered any markets\n */\n mapping(address => bool) internal borrowers;\n\n /// @notice A list of all borrowers who have entered markets\n address[] public allBorrowers;\n\n // Indexes of borrower account addresses in the `allBorrowers` array\n mapping(address => uint256) internal borrowerIndexes;\n\n /**\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\n */\n mapping(address => bool) public suppliers;\n\n /// @notice All cTokens addresses mapped by their underlying token addresses\n mapping(address => ICErc20) public cTokensByUnderlying;\n\n /// @notice Whether or not the supplier whitelist is enforced\n bool public enforceWhitelist;\n\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\n mapping(address => bool) public whitelist;\n\n /// @notice An array of all whitelisted accounts\n address[] public whitelistArray;\n\n // Indexes of account addresses in the `whitelistArray` array\n mapping(address => uint256) internal whitelistIndexes;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n * Actions which allow users to remove their own assets cannot be paused.\n * Liquidation / seizing / transfer can only be paused globally, not by market.\n */\n address public pauseGuardian;\n bool public _mintGuardianPaused;\n bool public _borrowGuardianPaused;\n bool public transferGuardianPaused;\n bool public seizeGuardianPaused;\n mapping(address => bool) public mintGuardianPaused;\n mapping(address => bool) public borrowGuardianPaused;\n}\n\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\n address public borrowCapGuardian;\n\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\n mapping(address => uint256) public borrowCaps;\n\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\n mapping(address => uint256) public supplyCaps;\n\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\n address[] public rewardsDistributors;\n\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\n bool internal _notEntered;\n\n /// @dev Whether or not _notEntered has been initialized\n bool internal _notEnteredInitialized;\n\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\n address[] public nonAccruingRewardsDistributors;\n\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\n\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => mapping(address => EnumerableSet.AddressSet))\n internal borrowingAgainstCollateralBlacklistWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\n}\n\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\n /// @dev Adrastia Prudentia config for controlling borrow caps.\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\n\n /// @dev Adrastia Prudentia config for controlling supply caps.\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\n}\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\n/**\n * @title Compound's CErc20 Contract\n * @notice CTokens which wrap an EIP-20 underlying\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\n * @author Compound\n */\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n modifier isMinHFThresholdExceeded(address borrower) {\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\n _;\n } else {\n _;\n }\n }\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 13;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.mint.selector;\n functionSelectors[--fnsCount] = this.redeem.selector;\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\n functionSelectors[--fnsCount] = this.borrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\n functionSelectors[--fnsCount] = this.getCash.selector;\n functionSelectors[--fnsCount] = this.seize.selector;\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemInternal(redeemTokens);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemUnderlyingInternal(redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return borrowInternal(borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\n return err;\n }\n\n /**\n * @notice Get cash balance of this cToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view override returns (uint256) {\n return getCashInternal();\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another cToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\n }\n\n function selfTransferOut(address to, uint256 amount) external override {\n require(msg.sender == address(this), \"!self\");\n doTransferOut(to, amount);\n }\n\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\n require(msg.sender == address(this), \"!self\");\n return doTransferIn(from, amount);\n }\n\n /**\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\n }\n\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalIonicFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\n totalIonicFees = totalIonicFeesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(address(ionicAdmin), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces admin fees by transferring to admin\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalAdminFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n totalAdminFees = totalAdminFees - withdrawAmount;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view virtual returns (uint256) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\n \"TOKEN_TRANSFER_IN_FAILED\"\n );\n\n // Calculate the amount that was *actually* transferred\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address to, uint256 amount) internal virtual {\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\n \"TOKEN_TRANSFER_OUT_FAILED\"\n );\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n struct MintLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 mintTokens;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n uint256 actualMintAmount;\n }\n\n /**\n * @notice User supplies assets into the market and receives cTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\n /* Fail if mint not allowed */\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n // Check max supply\n // unused function\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n } */\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of cTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n // mintTokens is rounded down here - correct\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\n\n /*\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\n\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, 0, redeemAmount);\n }\n\n struct RedeemLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 redeemTokens;\n uint256 redeemAmount;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n }\n\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\n res = (x * 1e18) / y;\n if (x % y != 0) res += 1;\n }\n\n /**\n * @notice User redeems cTokens in exchange for the underlying asset\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemFresh(\n address redeemer,\n uint256 redeemTokensIn,\n uint256 redeemAmountIn\n ) internal returns (uint256) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\n\n RedeemLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n if (redeemTokensIn > 0) {\n // don't allow dust tokens/assets to be left after\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\n\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n } else {\n if (redeemAmountIn == type(uint256).max) {\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\n }\n\n // don't allow dust tokens/assets to be left after\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\n\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\n\n // don't allow dust tokens/assets to be left after\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashInternal() < vars.redeemAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the redeemer and the redeemAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(redeemer, vars.redeemAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\n\n /* We call the defense hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(msg.sender, borrowAmount);\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n }\n\n /**\n * @notice Users borrow assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\n /* Fail if borrow not allowed */\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\n }\n\n /* Fail gracefully if protocol has insufficient underlying cash */\n uint256 cashPrior = getCashInternal();\n\n if (cashPrior < borrowAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n uint256(vars.mathErr)\n );\n }\n\n // Check min borrow for this user for this asset\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the borrower and the borrowAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(borrower, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.borrowVerify(address(this), borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\n internal\n nonReentrant(false)\n returns (uint256, uint256)\n {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint256 repayAmount;\n uint256 borrowerIndex;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n uint256 actualRepayAmount;\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer the account paying off the borrow\n * @param borrower the account with the debt being payed off\n * @param repayAmount the amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(\n address payer,\n address borrower,\n uint256 repayAmount\n ) internal returns (uint256, uint256) {\n /* Fail if repayBorrow not allowed */\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == type(uint256).max) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\n\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n ICErc20(cTokenCollateral).accrueInterest();\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal returns (uint256, uint256) {\n /* Fail if liquidate not allowed */\n uint256 allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n cTokenCollateral,\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify cTokenCollateral market's block number equals current block number */\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == type(uint256).max) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n cTokenCollateral,\n actualRepayAmount\n );\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint256 seizeError;\n if (cTokenCollateral == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\n\n /* We call the defense hook */\n // unused function\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\n\n return (uint256(Error.NO_ERROR), actualRepayAmount);\n }\n\n struct SeizeInternalLocalVars {\n MathError mathErr;\n uint256 borrowerTokensNew;\n uint256 liquidatorTokensNew;\n uint256 liquidatorSeizeTokens;\n uint256 protocolSeizeTokens;\n uint256 protocolSeizeAmount;\n uint256 exchangeRateMantissa;\n uint256 totalReservesNew;\n uint256 totalIonicFeeNew;\n uint256 totalSupplyNew;\n uint256 feeSeizeTokens;\n uint256 feeSeizeAmount;\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) internal returns (uint256) {\n /* Fail if seize not allowed */\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n SeizeInternalLocalVars memory vars;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\n }\n\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n vars.protocolSeizeAmount = mul_ScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n vars.protocolSeizeTokens\n );\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\n\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\n\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n totalReserves = vars.totalReservesNew;\n totalSupply = vars.totalSupplyNew;\n totalIonicFees = vars.totalIonicFeeNew;\n\n accountTokens[borrower] = vars.borrowerTokensNew;\n accountTokens[liquidator] = vars.liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\n\n /* We call the defense hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n function asCTokenExtension() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CTokenFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { IFlashLoanReceiver } from \"../ionic/IFlashLoanReceiver.sol\";\nimport { CErc20FirstExtensionBase, CTokenFirstExtensionInterface, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { SFSRegister } from \"./ComptrollerInterface.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport { Multicall } from \"../utils/Multicall.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenFirstExtension is\n CTokenOracleProtected,\n CErc20FirstExtensionBase,\n TokenErrorReporter,\n Exponential,\n DiamondExtension,\n Multicall\n{\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 25;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.transfer.selector;\n functionSelectors[--fnsCount] = this.transferFrom.selector;\n functionSelectors[--fnsCount] = this.allowance.selector;\n functionSelectors[--fnsCount] = this.approve.selector;\n functionSelectors[--fnsCount] = this.balanceOf.selector;\n functionSelectors[--fnsCount] = this._setAdminFee.selector;\n functionSelectors[--fnsCount] = this._setInterestRateModel.selector;\n functionSelectors[--fnsCount] = this._setNameAndSymbol.selector;\n functionSelectors[--fnsCount] = this._setAddressesProvider.selector;\n functionSelectors[--fnsCount] = this._setReserveFactor.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlock.selector;\n functionSelectors[--fnsCount] = this.borrowRatePerBlock.selector;\n functionSelectors[--fnsCount] = this.exchangeRateCurrent.selector;\n functionSelectors[--fnsCount] = this.accrueInterest.selector;\n functionSelectors[--fnsCount] = this.totalBorrowsCurrent.selector;\n functionSelectors[--fnsCount] = this.balanceOfUnderlying.selector;\n functionSelectors[--fnsCount] = this.multicall.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterDeposit.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterWithdraw.selector;\n functionSelectors[--fnsCount] = this.borrowRatePerBlockAfterBorrow.selector;\n functionSelectors[--fnsCount] = this.getTotalUnderlyingSupplied.selector;\n functionSelectors[--fnsCount] = this.flash.selector;\n functionSelectors[--fnsCount] = this.getAccountSnapshot.selector;\n functionSelectors[--fnsCount] = this.borrowBalanceCurrent.selector;\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function getTotalUnderlyingSupplied() public view override returns (uint256) {\n // (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees))\n return asCToken().getCash() + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees);\n }\n\n /* ERC20 fns */\n /**\n * @notice Transfer `tokens` tokens from `src` to `dst` by `spender`\n * @dev Called by both `transfer` and `transferFrom` internally\n * @param spender The address of the account performing the transfer\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param tokens The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferTokens(address spender, address src, address dst, uint256 tokens) internal returns (uint256) {\n /* Fail if transfer not allowed */\n uint256 allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Do not allow self-transfers */\n if (src == dst) {\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n /* Get the allowance, infinite for the account owner */\n uint256 startingAllowance = 0;\n if (spender == src) {\n startingAllowance = type(uint256).max;\n } else {\n startingAllowance = transferAllowances[src][spender];\n }\n\n /* Do the calculations, checking for {under,over}flow */\n MathError mathErr;\n uint256 allowanceNew;\n uint256 srcTokensNew;\n uint256 dstTokensNew;\n\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n (mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\n }\n\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n accountTokens[src] = srcTokensNew;\n accountTokens[dst] = dstTokensNew;\n\n /* Eat some of the allowance (if necessary) */\n if (startingAllowance != type(uint256).max) {\n transferAllowances[src][spender] = allowanceNew;\n }\n\n /* We emit a Transfer event */\n emit Transfer(src, dst, tokens);\n\n /* We call the defense hook */\n comptroller.transferVerify(address(this), src, dst, tokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(\n address dst,\n uint256 amount\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n return transferTokens(msg.sender, src, dst, amount) == uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(\n address spender,\n uint256 amount\n ) public override isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n address src = msg.sender;\n transferAllowances[src][spender] = amount;\n emit Approval(src, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) public view override returns (uint256) {\n return transferAllowances[owner][spender];\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) public view override returns (uint256) {\n return accountTokens[owner];\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice updates the cToken ERC20 name and symbol\n * @dev Admin function to update the cToken ERC20 name and symbol\n * @param _name the new ERC20 token name to use\n * @param _symbol the new ERC20 token symbol to use\n */\n function _setNameAndSymbol(string calldata _name, string calldata _symbol) external {\n // Check caller is admin\n require(hasAdminRights(), \"!admin\");\n\n // Set ERC20 name and symbol\n name = _name;\n symbol = _symbol;\n }\n\n function _setAddressesProvider(address _ap) external {\n // Check caller is admin\n require(hasAdminRights(), \"!admin\");\n\n ap = AddressesProvider(_ap);\n }\n\n /**\n * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n * @dev Admin function to accrue interest and set a new reserve factor\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setReserveFactor(\n uint256 newReserveFactorMantissa\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);\n }\n\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\n }\n\n // Check newReserveFactor ≤ maxReserveFactor\n if (newReserveFactorMantissa + adminFeeMantissa + ionicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\n }\n\n uint256 oldReserveFactorMantissa = reserveFactorMantissa;\n reserveFactorMantissa = newReserveFactorMantissa;\n\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice accrues interest and sets a new admin fee for the protocol using _setAdminFeeFresh\n * @dev Admin function to accrue interest and set a new admin fee\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setAdminFee(\n uint256 newAdminFeeMantissa\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_ADMIN_FEE_FRESH_CHECK);\n }\n\n // Sanitize newAdminFeeMantissa\n if (newAdminFeeMantissa == type(uint256).max) newAdminFeeMantissa = adminFeeMantissa;\n\n // Get latest Ionic fee\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\n\n // Check reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa ≤ reserveFactorPlusFeesMaxMantissa\n if (reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_ADMIN_FEE_BOUNDS_CHECK);\n }\n\n // If setting admin fee\n if (adminFeeMantissa != newAdminFeeMantissa) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_ADMIN_FEE_ADMIN_CHECK);\n }\n\n // Set admin fee\n uint256 oldAdminFeeMantissa = adminFeeMantissa;\n adminFeeMantissa = newAdminFeeMantissa;\n\n // Emit event\n emit NewAdminFee(oldAdminFeeMantissa, newAdminFeeMantissa);\n }\n\n // If setting Ionic fee\n if (ionicFeeMantissa != newIonicFeeMantissa) {\n // Set Ionic fee\n uint256 oldIonicFeeMantissa = ionicFeeMantissa;\n ionicFeeMantissa = newIonicFeeMantissa;\n\n // Emit event\n emit NewIonicFee(oldIonicFeeMantissa, newIonicFeeMantissa);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice accrues interest and updates the interest rate model using _setInterestRateModelFresh\n * @dev Admin function to accrue interest and update the interest rate model\n * @param newInterestRateModel the new interest rate model to use\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setInterestRateModel(\n InterestRateModel newInterestRateModel\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_INTEREST_RATE_MODEL_OWNER_CHECK);\n }\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\n }\n\n require(newInterestRateModel.isInterestRateModel(), \"!notIrm\");\n\n InterestRateModel oldInterestRateModel = interestRateModel;\n interestRateModel = newInterestRateModel;\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this cToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() public view override returns (uint256) {\n return\n interestRateModel.getBorrowRate(\n asCToken().getCash(),\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees\n );\n }\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) public view returns (uint256) {\n uint256 cash = asCToken().getCash();\n require(cash >= borrowAmount, \"market cash not enough\");\n\n return\n interestRateModel.getBorrowRate(\n cash - borrowAmount,\n totalBorrows + borrowAmount,\n totalReserves + totalAdminFees + totalIonicFees\n );\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this cToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() public view override returns (uint256) {\n return\n interestRateModel.getSupplyRate(\n asCToken().getCash(),\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256) {\n return\n interestRateModel.getSupplyRate(\n asCToken().getCash() + mintAmount,\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256) {\n uint256 cash = asCToken().getCash();\n require(cash >= withdrawAmount, \"market cash not enough\");\n return\n interestRateModel.getSupplyRate(\n cash - withdrawAmount,\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public view override returns (uint256) {\n if (block.number == accrualBlockNumber) {\n return\n _exchangeRateHypothetical(\n totalSupply,\n initialExchangeRateMantissa,\n asCToken().getCash(),\n totalBorrows,\n totalReserves,\n totalAdminFees,\n totalIonicFees\n );\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n\n return\n _exchangeRateHypothetical(\n accrual.totalSupply,\n initialExchangeRateMantissa,\n cashPrior,\n accrual.totalBorrows,\n accrual.totalReserves,\n accrual.totalAdminFees,\n accrual.totalIonicFees\n );\n }\n }\n\n function _exchangeRateHypothetical(\n uint256 _totalSupply,\n uint256 _initialExchangeRateMantissa,\n uint256 _totalCash,\n uint256 _totalBorrows,\n uint256 _totalReserves,\n uint256 _totalAdminFees,\n uint256 _totalIonicFees\n ) internal pure returns (uint256) {\n if (_totalSupply == 0) {\n /*\n * If there are no tokens minted:\n * exchangeRate = initialExchangeRate\n */\n return _initialExchangeRateMantissa;\n } else {\n /*\n * Otherwise:\n * exchangeRate = (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees)) / totalSupply\n */\n uint256 cashPlusBorrowsMinusReserves;\n Exp memory exchangeRate;\n MathError mathErr;\n\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(\n _totalCash,\n _totalBorrows,\n _totalReserves + _totalAdminFees + _totalIonicFees\n );\n require(mathErr == MathError.NO_ERROR, \"!addThenSubUInt overflow check failed\");\n\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\n require(mathErr == MathError.NO_ERROR, \"!getExp overflow check failed\");\n\n return exchangeRate.mantissa;\n }\n }\n\n struct InterestAccrual {\n uint256 accrualBlockNumber;\n uint256 borrowIndex;\n uint256 totalSupply;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalIonicFees;\n uint256 totalAdminFees;\n uint256 interestAccumulated;\n }\n\n function _accrueInterestHypothetical(\n uint256 blockNumber,\n uint256 cashPrior\n ) internal view returns (InterestAccrual memory accrual) {\n uint256 totalFees = totalAdminFees + totalIonicFees;\n uint256 borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, totalBorrows, totalReserves + totalFees);\n if (borrowRateMantissa > borrowRateMaxMantissa) {\n if (cashPrior > totalFees) revert(\"!borrowRate\");\n else borrowRateMantissa = borrowRateMaxMantissa;\n }\n (MathError mathErr, uint256 blockDelta) = subUInt(blockNumber, accrualBlockNumber);\n require(mathErr == MathError.NO_ERROR, \"!blockDelta\");\n\n /*\n * Calculate the interest accumulated into borrows and reserves and the new index:\n * simpleInterestFactor = borrowRate * blockDelta\n * interestAccumulated = simpleInterestFactor * totalBorrows\n * totalBorrowsNew = interestAccumulated + totalBorrows\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\n * totalIonicFeesNew = interestAccumulated * ionicFee + totalIonicFees\n * totalAdminFeesNew = interestAccumulated * adminFee + totalAdminFees\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\n */\n\n accrual.accrualBlockNumber = blockNumber;\n accrual.totalSupply = totalSupply;\n Exp memory simpleInterestFactor = mul_(Exp({ mantissa: borrowRateMantissa }), blockDelta);\n accrual.interestAccumulated = mul_ScalarTruncate(simpleInterestFactor, totalBorrows);\n accrual.totalBorrows = accrual.interestAccumulated + totalBorrows;\n accrual.totalReserves = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: reserveFactorMantissa }),\n accrual.interestAccumulated,\n totalReserves\n );\n accrual.totalIonicFees = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: ionicFeeMantissa }),\n accrual.interestAccumulated,\n totalIonicFees\n );\n accrual.totalAdminFees = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: adminFeeMantissa }),\n accrual.interestAccumulated,\n totalAdminFees\n );\n accrual.borrowIndex = mul_ScalarTruncateAddUInt(simpleInterestFactor, borrowIndex, borrowIndex);\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() public override returns (uint256) {\n /* Remember the initial block number */\n uint256 currentBlockNumber = block.number;\n\n /* Short-circuit accumulating 0 interest */\n if (accrualBlockNumber == currentBlockNumber) {\n return uint256(Error.NO_ERROR);\n }\n\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(currentBlockNumber, cashPrior);\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n accrualBlockNumber = currentBlockNumber;\n borrowIndex = accrual.borrowIndex;\n totalBorrows = accrual.totalBorrows;\n totalReserves = accrual.totalReserves;\n totalIonicFees = accrual.totalIonicFees;\n totalAdminFees = accrual.totalAdminFees;\n emit AccrueInterest(cashPrior, accrual.interestAccumulated, borrowIndex, totalBorrows);\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external view override returns (uint256) {\n if (accrualBlockNumber == block.number) {\n return totalBorrows;\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n return accrual.totalBorrows;\n }\n }\n\n /**\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view override returns (uint256, uint256, uint256, uint256) {\n uint256 cTokenBalance = accountTokens[account];\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n\n borrowBalance = borrowBalanceCurrent(account);\n\n exchangeRateMantissa = exchangeRateCurrent();\n\n return (uint256(Error.NO_ERROR), cTokenBalance, borrowBalance, exchangeRateMantissa);\n }\n\n /**\n * @notice calculate the borrowIndex and the account's borrow balance using the fresh borrowIndex\n * @param account The address whose balance should be calculated after recalculating the borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) public view override returns (uint256) {\n uint256 _borrowIndex;\n if (accrualBlockNumber == block.number) {\n _borrowIndex = borrowIndex;\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n _borrowIndex = accrual.borrowIndex;\n }\n\n /* Note: we do not assert that the market is up to date */\n MathError mathErr;\n uint256 principalTimesIndex;\n uint256 result;\n\n /* Get borrowBalance and borrowIndex */\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\n\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\n */\n if (borrowSnapshot.principal == 0) {\n return 0;\n }\n\n /* Calculate new borrow balance using the interest index:\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\n */\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, _borrowIndex);\n require(mathErr == MathError.NO_ERROR, \"!mulUInt overflow check failed\");\n\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\n require(mathErr == MathError.NO_ERROR, \"!divUInt overflow check failed\");\n\n return result;\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external view override returns (uint256) {\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\n (MathError mErr, uint256 balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\n require(mErr == MathError.NO_ERROR, \"!balance\");\n return balance;\n }\n\n function flash(uint256 amount, bytes calldata data) public override isAuthorized onlyOracleApprovedAllowEOA {\n accrueInterest();\n\n totalBorrows += amount;\n asCToken().selfTransferOut(msg.sender, amount);\n\n IFlashLoanReceiver(msg.sender).receiveFlashLoan(underlying, amount, data);\n\n asCToken().selfTransferIn(msg.sender, amount);\n totalBorrows -= amount;\n\n emit Flash(msg.sender, amount);\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n function asCToken() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n function multicall(\n bytes[] calldata data\n ) public payable override(CTokenFirstExtensionInterface, Multicall) returns (bytes[] memory results) {\n return Multicall.multicall(data);\n }\n\n function registerInSFS() external returns (uint256) {\n require(hasAdminRights() || msg.sender == address(comptroller), \"!admin\");\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\n }\n}\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\n\nabstract contract CTokenAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n}\n\nabstract contract CErc20Storage is CTokenAdminStorage {\n /**\n * @dev Guard variable for re-entrancy checks\n */\n bool internal _notEntered;\n\n /**\n * @notice EIP-20 token name for this token\n */\n string public name;\n\n /**\n * @notice EIP-20 token symbol for this token\n */\n string public symbol;\n\n /**\n * @notice EIP-20 token decimals for this token\n */\n uint8 public decimals;\n\n /*\n * Maximum borrow rate that can ever be applied (.0005% / block)\n */\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\n\n /*\n * Maximum fraction of interest that can be set aside for reserves + fees\n */\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\n\n /**\n * @notice Contract which oversees inter-cToken operations\n */\n IonicComptroller public comptroller;\n\n /**\n * @notice Model which tells what the current interest rate should be\n */\n InterestRateModel public interestRateModel;\n\n /*\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\n */\n uint256 internal initialExchangeRateMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for admin fees\n */\n uint256 public adminFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for Ionic fees\n */\n uint256 public ionicFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for reserves\n */\n uint256 public reserveFactorMantissa;\n\n /**\n * @notice Block number that interest was last accrued at\n */\n uint256 public accrualBlockNumber;\n\n /**\n * @notice Accumulator of the total earned interest rate since the opening of the market\n */\n uint256 public borrowIndex;\n\n /**\n * @notice Total amount of outstanding borrows of the underlying in this market\n */\n uint256 public totalBorrows;\n\n /**\n * @notice Total amount of reserves of the underlying held in this market\n */\n uint256 public totalReserves;\n\n /**\n * @notice Total amount of admin fees of the underlying held in this market\n */\n uint256 public totalAdminFees;\n\n /**\n * @notice Total amount of Ionic fees of the underlying held in this market\n */\n uint256 public totalIonicFees;\n\n /**\n * @notice Total number of tokens in circulation\n */\n uint256 public totalSupply;\n\n /*\n * Official record of token balances for each account\n */\n mapping(address => uint256) internal accountTokens;\n\n /*\n * Approved token transfer amounts on behalf of others\n */\n mapping(address => mapping(address => uint256)) internal transferAllowances;\n\n /**\n * @notice Container for borrow balance information\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n */\n struct BorrowSnapshot {\n uint256 principal;\n uint256 interestIndex;\n }\n\n /*\n * Mapping of account addresses to outstanding borrow balances\n */\n mapping(address => BorrowSnapshot) internal accountBorrows;\n\n /*\n * Share of seized collateral that is added to reserves\n */\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\n\n /*\n * Share of seized collateral taken as fees\n */\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\n\n /**\n * @notice Underlying asset for this CToken\n */\n address public underlying;\n\n /**\n * @notice Addresses Provider\n */\n AddressesProvider public ap;\n}\n\nabstract contract CTokenBaseEvents {\n /* ERC20 */\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the admin fee is changed\n */\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\n\n /**\n * @notice Event emitted when the Ionic fee is changed\n */\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\n}\n\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\n event Flash(address receiver, uint256 amount);\n}\n\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral,\n uint256 seizeTokens\n );\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\n}\n\ninterface CTokenFirstExtensionInterface {\n /*** User Interface ***/\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n /*** Admin Functions ***/\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\n\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function exchangeRateCurrent() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function totalBorrowsCurrent() external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external view returns (uint256);\n\n function getTotalUnderlyingSupplied() external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external view returns (uint256);\n\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n\n function flash(uint256 amount, bytes calldata data) external;\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface CTokenSecondExtensionInterface {\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\n\n /*** Admin Functions ***/\n\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\n\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\n\n function selfTransferOut(address to, uint256 amount) external;\n\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\n}\n\ninterface CDelegatorInterface {\n function implementation() external view returns (address);\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external;\n}\n\ninterface CDelegateInterface {\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @dev Should revert if any issues arise which make it unfit for delegation\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes calldata data) external;\n\n function delegateType() external pure returns (uint8);\n\n function contractType() external pure returns (string memory);\n}\n\nabstract contract CErc20AdminBase is CErc20Storage {\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\n return\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\n }\n}\n\nabstract contract CErc20FirstExtensionBase is\n CErc20AdminBase,\n CTokenFirstExtensionEvents,\n CTokenFirstExtensionInterface\n{}\n\nabstract contract CTokenSecondExtensionBase is\n CErc20AdminBase,\n CTokenSecondExtensionEvents,\n CTokenSecondExtensionInterface,\n CDelegateInterface\n{}\n\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\n\ninterface CErc20StorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function comptroller() external view returns (IonicComptroller);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function accrualBlockNumber() external view returns (uint256);\n\n function underlying() external view returns (address);\n\n function borrowIndex() external view returns (uint256);\n\n function interestRateModel() external view returns (address);\n}\n\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\n function plugin() external view returns (address);\n}\n\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\n function approve(address, address) external;\n}\n\ninterface ICErc20 is\n CErc20StorageInterface,\n CTokenSecondExtensionInterface,\n CTokenFirstExtensionInterface,\n CDelegatorInterface,\n CDelegateInterface\n{}\n\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\n function _updatePlugin(address _plugin) external;\n}\n\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\n" + }, + "contracts/compound/CTokenMinter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\ncontract CTokenMinter is Initializable, OwnableUpgradeable {\n ICErc20 public collateralMarket;\n uint256 public startTime;\n uint256 public endTime;\n\n modifier onlyDuringMintWindow() {\n require(block.timestamp >= startTime && block.timestamp <= endTime, \"Minting not allowed at this time\");\n _;\n }\n\n function initialize(address _cTokenAddress, uint256 _startTime, uint256 _endTime) public initializer {\n require(_startTime < _endTime, \"Invalid time window\");\n __Ownable_init();\n collateralMarket = ICErc20(_cTokenAddress);\n startTime = _startTime;\n endTime = _endTime;\n }\n\n function mint(uint256 mintAmount) external onlyDuringMintWindow {\n // MINT LOGIC\n }\n\n function setMintWindow(uint256 _newStartTime, uint256 _newEndTime) external onlyOwner {\n require(_newStartTime < _newEndTime, \"Invalid time window\");\n startTime = _newStartTime;\n endTime = _newEndTime;\n }\n}\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenOracleProtected is CErc20Storage {\n error InteractionNotAllowed();\n error CallerIsNotEOA();\n\n modifier onlyOracleApproved() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyOracleApprovedAllowEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n if (tx.origin == msg.sender) {\n _;\n return;\n }\n\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyNotBlacklistedEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n if (msg.sender != tx.origin) {\n revert CallerIsNotEOA();\n }\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n _;\n }\n}\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title ERC 20 Token Standard Interface\n * https://eips.ethereum.org/EIPS/eip-20\n */\ninterface EIP20Interface {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n /**\n * @notice Get the total number of tokens in circulation\n * @return uint256 The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance uint256 The balance\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool success);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return success bool Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ncontract ComptrollerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n COMPTROLLER_MISMATCH,\n INSUFFICIENT_SHORTFALL,\n INSUFFICIENT_LIQUIDITY,\n INVALID_CLOSE_FACTOR,\n INVALID_COLLATERAL_FACTOR,\n INVALID_LIQUIDATION_INCENTIVE,\n MARKET_NOT_LISTED,\n MARKET_ALREADY_LISTED,\n MATH_ERROR,\n NONZERO_BORROW_BALANCE,\n PRICE_ERROR,\n REJECTION,\n SNAPSHOT_ERROR,\n TOO_MANY_ASSETS,\n TOO_MUCH_REPAY,\n SUPPLIER_NOT_WHITELISTED,\n BORROW_BELOW_MIN,\n SUPPLY_ABOVE_MAX,\n NONZERO_TOTAL_SUPPLY\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\n EXIT_MARKET_BALANCE_OWED,\n EXIT_MARKET_REJECTION,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\n SET_CLOSE_FACTOR_OWNER_CHECK,\n SET_CLOSE_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_NO_EXISTS,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_PRICE_ORACLE_OWNER_CHECK,\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\n SET_WHITELIST_STATUS_OWNER_CHECK,\n SUPPORT_MARKET_EXISTS,\n SUPPORT_MARKET_OWNER_CHECK,\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\n UNSUPPORT_MARKET_OWNER_CHECK,\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\n UNSUPPORT_MARKET_IN_USE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return uint256(err);\n }\n}\n\ncontract TokenErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n BAD_INPUT,\n COMPTROLLER_REJECTION,\n COMPTROLLER_CALCULATION_ERROR,\n INTEREST_RATE_MODEL_ERROR,\n INVALID_ACCOUNT_PAIR,\n INVALID_CLOSE_AMOUNT_REQUESTED,\n INVALID_COLLATERAL_FACTOR,\n MATH_ERROR,\n MARKET_NOT_FRESH,\n MARKET_NOT_LISTED,\n TOKEN_INSUFFICIENT_ALLOWANCE,\n TOKEN_INSUFFICIENT_BALANCE,\n TOKEN_INSUFFICIENT_CASH,\n TOKEN_TRANSFER_IN_FAILED,\n TOKEN_TRANSFER_OUT_FAILED,\n UTILIZATION_ABOVE_MAX\n }\n\n /*\n * Note: FailureInfo (but not Error) is kept in alphabetical order\n * This is because FailureInfo grows significantly faster, and\n * the order of Error has some meaning, while the order of FailureInfo\n * is entirely arbitrary.\n */\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n BORROW_ACCRUE_INTEREST_FAILED,\n BORROW_CASH_NOT_AVAILABLE,\n BORROW_FRESHNESS_CHECK,\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n BORROW_MARKET_NOT_LISTED,\n BORROW_COMPTROLLER_REJECTION,\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n LIQUIDATE_COMPTROLLER_REJECTION,\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n LIQUIDATE_FRESHNESS_CHECK,\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_ACCRUE_INTEREST_FAILED,\n MINT_COMPTROLLER_REJECTION,\n MINT_EXCHANGE_CALCULATION_FAILED,\n MINT_EXCHANGE_RATE_READ_FAILED,\n MINT_FRESHNESS_CHECK,\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n MINT_TRANSFER_IN_FAILED,\n MINT_TRANSFER_IN_NOT_POSSIBLE,\n NEW_UTILIZATION_RATE_ABOVE_MAX,\n REDEEM_ACCRUE_INTEREST_FAILED,\n REDEEM_COMPTROLLER_REJECTION,\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\n REDEEM_EXCHANGE_RATE_READ_FAILED,\n REDEEM_FRESHNESS_CHECK,\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\n WITHDRAW_IONIC_FEES_VALIDATION,\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\n WITHDRAW_ADMIN_FEES_VALIDATION,\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\n REDUCE_RESERVES_ADMIN_CHECK,\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\n REDUCE_RESERVES_FRESH_CHECK,\n REDUCE_RESERVES_VALIDATION,\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_COMPTROLLER_REJECTION,\n REPAY_BORROW_FRESHNESS_CHECK,\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COMPTROLLER_OWNER_CHECK,\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\n SET_ADMIN_FEE_ADMIN_CHECK,\n SET_ADMIN_FEE_FRESH_CHECK,\n SET_ADMIN_FEE_BOUNDS_CHECK,\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\n SET_IONIC_FEE_FRESH_CHECK,\n SET_IONIC_FEE_BOUNDS_CHECK,\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\n SET_RESERVE_FACTOR_ADMIN_CHECK,\n SET_RESERVE_FACTOR_FRESH_CHECK,\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\n TRANSFER_COMPTROLLER_REJECTION,\n TRANSFER_NOT_ALLOWED,\n TRANSFER_NOT_ENOUGH,\n TRANSFER_TOO_MUCH,\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\n ADD_RESERVES_FRESH_CHECK,\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\n }\n}\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CarefulMath.sol\";\nimport \"./ExponentialNoError.sol\";\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract Exponential is CarefulMath, ExponentialNoError {\n /**\n * @dev Creates an exponential from numerator and denominator values.\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\n * or if `denom` is zero.\n */\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\n }\n\n /**\n * @dev Adds two exponentials, returning a new exponential.\n */\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Subtracts two exponentials, returning a new exponential.\n */\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, returning a new Exp.\n */\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(product));\n }\n\n /**\n * @dev Divide an Exp by a scalar, returning a new Exp.\n */\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\n }\n\n /**\n * @dev Divide a scalar by an Exp, returning a new Exp.\n */\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\n /*\n We are doing this as:\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\n\n How it works:\n Exp = a / b;\n Scalar = s;\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\n */\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n return getExp(numerator, divisor.mantissa);\n }\n\n /**\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\n */\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(fraction));\n }\n\n /**\n * @dev Multiplies two exponentials, returning a new exponential.\n */\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n // We add half the scale before dividing so that we get rounding instead of truncation.\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\n assert(err2 == MathError.NO_ERROR);\n\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\n }\n\n /**\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\n */\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\n }\n\n /**\n * @dev Multiplies three exponentials, returning a new exponential.\n */\n function mulExp3(\n Exp memory a,\n Exp memory b,\n Exp memory c\n ) internal pure returns (MathError, Exp memory) {\n (MathError err, Exp memory ab) = mulExp(a, b);\n if (err != MathError.NO_ERROR) {\n return (err, ab);\n }\n return mulExp(ab, c);\n }\n\n /**\n * @dev Divides two exponentials, returning a new exponential.\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\n */\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n return getExp(a.mantissa, b.mantissa);\n }\n}\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract ExponentialNoError {\n uint256 constant expScale = 1e18;\n uint256 constant doubleScale = 1e36;\n uint256 constant halfExpScale = expScale / 2;\n uint256 constant mantissaOne = expScale;\n\n struct Exp {\n uint256 mantissa;\n }\n\n struct Double {\n uint256 mantissa;\n }\n\n /**\n * @dev Truncates the given exp to a whole number value.\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\n */\n function truncate(Exp memory exp) internal pure returns (uint256) {\n // Note: We are not using careful math here as we're performing a division that cannot fail\n return exp.mantissa / expScale;\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return truncate(product);\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mul_ScalarTruncateAddUInt(\n Exp memory a,\n uint256 scalar,\n uint256 addend\n ) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return add_(truncate(product), addend);\n }\n\n /**\n * @dev Checks if first Exp is less than second Exp.\n */\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa < right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp <= right Exp.\n */\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa <= right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp > right Exp.\n */\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa > right.mantissa;\n }\n\n /**\n * @dev returns true if Exp is exactly zero\n */\n function isZeroExp(Exp memory value) internal pure returns (bool) {\n return value.mantissa == 0;\n }\n\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\n require(n < 2**224, errorMessage);\n return uint224(n);\n }\n\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2**32, errorMessage);\n return uint32(n);\n }\n\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\n return add_(a, b, \"addition overflow\");\n }\n\n function add_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub_(a, b, \"subtraction underflow\");\n }\n\n function sub_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\n }\n\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / expScale;\n }\n\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\n }\n\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / doubleScale;\n }\n\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\n return mul_(a, b, \"multiplication overflow\");\n }\n\n function mul_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n if (a == 0 || b == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n return c;\n }\n\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\n }\n\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return div_(mul_(a, expScale), b.mantissa);\n }\n\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\n }\n\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\n return div_(mul_(a, doubleScale), b.mantissa);\n }\n\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\n return div_(a, b, \"divide by zero\");\n }\n\n function div_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\n }\n}\n" + }, + "contracts/compound/IERC4626.sol": { + "content": "pragma solidity >=0.8.0;\npragma experimental ABIEncoderV2;\n\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\n\ninterface IERC4626 is EIP20Interface {\n /*----------------------------------------------------------------\n Events\n ----------------------------------------------------------------*/\n\n event Deposit(address indexed from, address indexed to, uint256 value);\n\n event Withdraw(address indexed from, address indexed to, uint256 value);\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n /**\n @notice Deposit a specific amount of underlying tokens.\n @param underlyingAmount The amount of the underlying token to deposit.\n @param to The address to receive shares corresponding to the deposit\n @return shares The shares in the vault credited to `to`\n */\n function deposit(uint256 underlyingAmount, address to) external returns (uint256 shares);\n\n /**\n @notice Mint an exact amount of shares for a variable amount of underlying tokens.\n @param shareAmount The amount of vault shares to mint.\n @param to The address to receive shares corresponding to the mint.\n @return underlyingAmount The amount of the underlying tokens deposited from the mint call.\n */\n function mint(uint256 shareAmount, address to) external returns (uint256 underlyingAmount);\n\n /**\n @notice Withdraw a specific amount of underlying tokens.\n @param underlyingAmount The amount of the underlying token to withdraw.\n @param to The address to receive underlying corresponding to the withdrawal.\n @param from The address to burn shares from corresponding to the withdrawal.\n @return shares The shares in the vault burned from sender\n */\n function withdraw(\n uint256 underlyingAmount,\n address to,\n address from\n ) external returns (uint256 shares);\n\n /**\n @notice Redeem a specific amount of shares for underlying tokens.\n @param shareAmount The amount of shares to redeem.\n @param to The address to receive underlying corresponding to the redemption.\n @param from The address to burn shares from corresponding to the redemption.\n @return value The underlying amount transferred to `to`.\n */\n function redeem(\n uint256 shareAmount,\n address to,\n address from\n ) external returns (uint256 value);\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n /** \n @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n @return the address of the asset\n */\n function asset() external view returns (address);\n\n /** \n @notice Returns a user's Vault balance in underlying tokens.\n @param user The user to get the underlying balance of.\n @return balance The user's Vault balance in underlying tokens.\n */\n function balanceOfUnderlying(address user) external view returns (uint256 balance);\n\n /** \n @notice Calculates the total amount of underlying tokens the Vault manages.\n @return The total amount of underlying tokens the Vault manages.\n */\n function totalAssets() external view returns (uint256);\n\n /** \n @notice Returns the value in underlying terms of one vault token. \n */\n function exchangeRate() external view returns (uint256);\n\n /**\n @notice Returns the amount of vault tokens that would be obtained if depositing a given amount of underlying tokens in a `deposit` call.\n @param underlyingAmount the input amount of underlying tokens\n @return shareAmount the corresponding amount of shares out from a deposit call with `underlyingAmount` in\n */\n function previewDeposit(uint256 underlyingAmount) external view returns (uint256 shareAmount);\n\n /**\n @notice Returns the amount of underlying tokens that would be deposited if minting a given amount of shares in a `mint` call.\n @param shareAmount the amount of shares from a mint call.\n @return underlyingAmount the amount of underlying tokens corresponding to the mint call\n */\n function previewMint(uint256 shareAmount) external view returns (uint256 underlyingAmount);\n\n /**\n @notice Returns the amount of vault tokens that would be burned if withdrawing a given amount of underlying tokens in a `withdraw` call.\n @param underlyingAmount the input amount of underlying tokens\n @return shareAmount the corresponding amount of shares out from a withdraw call with `underlyingAmount` in\n */\n function previewWithdraw(uint256 underlyingAmount) external view returns (uint256 shareAmount);\n\n /**\n @notice Returns the amount of underlying tokens that would be obtained if redeeming a given amount of shares in a `redeem` call.\n @param shareAmount the amount of shares from a redeem call.\n @return underlyingAmount the amount of underlying tokens corresponding to the redeem call\n */\n function previewRedeem(uint256 shareAmount) external view returns (uint256 underlyingAmount);\n}\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../ionic/AuthoritiesRegistry.sol\";\n\ninterface IFeeDistributor {\n function minBorrowEth() external view returns (uint256);\n\n function maxUtilizationRate() external view returns (uint256);\n\n function interestFeeRate() external view returns (uint256);\n\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\n\n function latestCErc20Delegate(uint8 delegateType)\n external\n view\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\n\n function latestPluginImplementation(address oldImplementation) external view returns (address);\n\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\n\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address);\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\n\n fallback() external payable;\n\n receive() external payable;\n}\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's InterestRateModel Interface\n * @author Compound\n */\nabstract contract InterestRateModel {\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n bool public constant isInterestRateModel = true;\n\n /**\n * @notice Calculates the current borrow interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view virtual returns (uint256);\n\n /**\n * @notice Calculates the current supply interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @param reserveFactorMantissa The current reserve factor the market has\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual returns (uint256);\n}\n" + }, + "contracts/compound/JumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./InterestRateModel.sol\";\n\n/**\n * @title Compound's JumpRateModel Contract\n * @author Compound\n */\ncontract JumpRateModel is InterestRateModel {\n event NewInterestParams(\n uint256 baseRatePerBlock,\n uint256 multiplierPerBlock,\n uint256 jumpMultiplierPerBlock,\n uint256 kink\n );\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint256 public blocksPerYear;\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint256 public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint256 public baseRatePerBlock;\n\n /**\n * @notice The multiplierPerBlock after hitting a specified utilization point\n */\n uint256 public jumpMultiplierPerBlock;\n\n /**\n * @notice The utilization point at which the jump multiplier is applied\n */\n uint256 public kink;\n\n /**\n * @notice Construct an interest rate model\n * @param _blocksPerYear The approximate number of blocks per year\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\n * @param kink_ The utilization point at which the jump multiplier is applied\n */\n constructor(\n uint256 _blocksPerYear,\n uint256 baseRatePerYear,\n uint256 multiplierPerYear,\n uint256 jumpMultiplierPerYear,\n uint256 kink_\n ) {\n blocksPerYear = _blocksPerYear;\n baseRatePerBlock = baseRatePerYear / blocksPerYear;\n multiplierPerBlock = multiplierPerYear / blocksPerYear;\n jumpMultiplierPerBlock = jumpMultiplierPerYear / blocksPerYear;\n kink = kink_;\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return (borrows * 1e18) / (cash + borrows - reserves);\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n uint256 util = utilizationRate(cash, borrows, reserves);\n\n if (util <= kink) {\n return ((util * multiplierPerBlock) / 1e18) + baseRatePerBlock;\n } else {\n uint256 normalRate = ((kink * multiplierPerBlock) / 1e18) + baseRatePerBlock;\n uint256 excessUtil = util - kink;\n return ((excessUtil * jumpMultiplierPerBlock) / 1e18) + normalRate;\n }\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\n }\n}\n" + }, + "contracts/compound/PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\n\nabstract contract PriceOracle {\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\n bool public constant isPriceOracle = true;\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view virtual returns (uint256);\n}\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ErrorReporter.sol\";\nimport \"./ComptrollerStorage.sol\";\nimport \"./Comptroller.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\n\n/**\n * @title Unitroller\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\n * CTokens should reference this contract as their comptroller.\n */\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\n /**\n * @notice Event emitted when the admin rights are changed\n */\n event AdminRightsToggled(bool hasRights);\n\n /**\n * @notice Emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n constructor(address payable _ionicAdmin) {\n admin = msg.sender;\n ionicAdmin = _ionicAdmin;\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Toggles admin rights.\n * @param hasRights Boolean indicating if the admin is to have rights.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\n }\n\n // Check that rights have not already been set to the desired value\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\n\n adminHasRights = hasRights;\n emit AdminRightsToggled(hasRights);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @param newPendingAdmin New pending admin.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\n }\n\n address oldPendingAdmin = pendingAdmin;\n pendingAdmin = newPendingAdmin;\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n * @dev Admin function for pending admin to accept role and update admin\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint256) {\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n admin = pendingAdmin;\n pendingAdmin = address(0);\n\n emit NewAdmin(oldAdmin, admin);\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n function comptrollerImplementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n\n address currentImplementation = comptrollerImplementation();\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\n currentImplementation\n );\n\n _updateExtensions(latestComptrollerImplementation);\n\n if (currentImplementation != latestComptrollerImplementation) {\n // reinitialize\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function _updateExtensions(address currentComptroller) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(hasAdminRights(), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/EmissionsManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IonicFlywheelCore } from \"./ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { IEmissionsManager } from \"./IEmissionsManager.sol\";\nimport { IveION } from \"./veION/interfaces/IveION.sol\";\n\ninterface Oracle {\n function getUnderlyingPrice(address) external returns (uint256);\n}\n\ncontract EmissionsManager is IEmissionsManager, Ownable2StepUpgradeable {\n using SafeTransferLib for ERC20;\n\n address public protocolAddress;\n uint256 public collateralBp;\n PoolDirectory public fpd;\n ERC20 public rewardToken;\n address public veION;\n\n bytes public nonBlacklistableTargetBytecode;\n mapping(address => bool) public isBlacklisted;\n mapping(address => bool) public nonBlacklistable;\n\n uint256 public constant MAXIMUM_BASIS_POINTS = 10_000;\n uint256 public constant BLACKLISTER_SHARE = 80;\n uint256 public constant PROTOCOL_SHARE = 20;\n\n modifier onlyBlacklistableBytecode(address _addr) {\n bytes memory code = _addr.code;\n require(keccak256(code) != keccak256(nonBlacklistableTargetBytecode), \"Non-blacklistable bytecode\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize(\n PoolDirectory _fpd,\n address _protocolAddress,\n ERC20 _rewardToken,\n uint256 _collateralBp,\n bytes memory _nonBlacklistableTargetBytecode\n ) public initializer {\n if (address(_fpd) == address(0)) revert InvalidPoolDirectoryAaddress();\n if (_protocolAddress == address(0)) revert InvalidProtocolAddress();\n if (address(_rewardToken) == address(0)) revert InvalidRewardTokenAddress();\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert CollateralBasisPointsExceedMaximum();\n\n __Ownable2Step_init();\n protocolAddress = _protocolAddress;\n fpd = _fpd;\n rewardToken = _rewardToken;\n collateralBp = _collateralBp;\n nonBlacklistableTargetBytecode = _nonBlacklistableTargetBytecode;\n\n emit Initialized(_protocolAddress, address(_rewardToken), _collateralBp, _nonBlacklistableTargetBytecode);\n }\n\n function setVeIon(IveION _veIon) external onlyOwner {\n if (address(_veIon) == address(0)) revert InvalidVeIONAddress();\n veION = address(_veIon);\n emit VeIonSet(address(_veIon));\n }\n\n function setCollateralBp(uint256 _collateralBp) external onlyOwner {\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert MaximumLimitExceeded();\n collateralBp = _collateralBp;\n emit CollateralBpSet(_collateralBp);\n }\n\n function setNonBlacklistableAddress(address _user, bool _isNonBlacklistable) external onlyOwner {\n nonBlacklistable[_user] = _isNonBlacklistable;\n emit NonBlacklistableAddressSet(_user, _isNonBlacklistable);\n }\n\n function setNonBlacklistableTargetBytecode(bytes memory _newBytecode) external onlyOwner {\n nonBlacklistableTargetBytecode = _newBytecode;\n emit NonBlacklistableTargetBytecodeSet(_newBytecode);\n }\n\n function setProtocolAddress(address _newProtocolAddress) external onlyOwner {\n require(_newProtocolAddress != address(0), \"Invalid address\");\n protocolAddress = _newProtocolAddress;\n }\n\n function _getUserTotalCollateral(address _user) internal view returns (uint256) {\n uint256 totalColateralInETH = 0;\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n BasePriceOracle oracle = comptroller.oracle();\n ICErc20[] memory cTokens = comptroller.getAssetsIn(_user);\n uint256 cTokensLength = cTokens.length;\n for (uint256 j = 0; j < cTokensLength; j++) {\n uint256 supplyBalance = cTokens[j].balanceOfUnderlying(_user);\n uint256 collateralInETH = (supplyBalance * oracle.getUnderlyingPrice(cTokens[j])) / 1e18;\n totalColateralInETH += collateralInETH;\n }\n }\n return totalColateralInETH;\n }\n\n function getUserTotalCollateral(address _user) external view returns (uint256) {\n return _getUserTotalCollateral(_user);\n }\n\n function _checkCollateralRatio(address _user) internal view returns (bool) {\n uint256 userCollateralValue = _getUserTotalCollateral(_user);\n if (userCollateralValue == 0) return true;\n uint256 userLPValue = IveION(veION).getTotalEthValueOfTokens(_user);\n if ((userLPValue * MAXIMUM_BASIS_POINTS) / userCollateralValue >= collateralBp) {\n return true;\n } else return false;\n }\n\n function reportUser(address _user) external onlyBlacklistableBytecode(_user) {\n require(!nonBlacklistable[_user], \"Non-blacklistable user\");\n require(!isBlacklisted[_user], \"Already blacklisted\");\n require(!_checkCollateralRatio(_user), \"LP balance above threshold\");\n isBlacklisted[_user] = true;\n _blacklistUserAndClaimEmissions(_user);\n }\n\n function whitelistUser(address _user) external {\n require(isBlacklisted[_user], \"Already whitelisted\");\n require(_checkCollateralRatio(_user), \"LP balance below threshold\");\n isBlacklisted[_user] = false;\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory cTokens = comptroller.getAssetsIn(_user);\n uint256 cTokensLength = cTokens.length;\n for (uint256 j = 0; j < cTokensLength; j++) {\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n uint256 flywheelAddressesLength = flywheelAddresses.length;\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\n flywheel.whitelistUser(ERC20(address(cTokens[j])), _user);\n flywheel.accrue(ERC20(address(cTokens[j])), _user);\n }\n }\n }\n }\n }\n\n function isUserBlacklisted(address _user) external view returns (bool) {\n return isBlacklisted[_user];\n }\n\n function isUserBlacklistable(address _user) external view returns (bool) {\n if (nonBlacklistable[_user] || keccak256(_user.code) == keccak256(nonBlacklistableTargetBytecode)) {\n return false;\n }\n return !_checkCollateralRatio(_user) && !isBlacklisted[_user];\n }\n\n function _blacklistUserAndClaimEmissions(address user) internal {\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(address(this));\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ERC20[] memory markets;\n {\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\n uint256 cerc20sLength = cerc20s.length;\n markets = new ERC20[](cerc20sLength);\n for (uint256 j = 0; j < cerc20sLength; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n }\n\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n uint256 flywheelAddressesLength = flywheelAddresses.length;\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\n uint256 marketsLength = markets.length;\n for (uint256 m = 0; m < marketsLength; m++) {\n flywheel.accrue(markets[m], user);\n flywheel.updateBlacklistBalances(markets[m], user);\n }\n flywheel.takeRewardsFromUser(user, address(this));\n }\n }\n }\n\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(address(this));\n uint256 totalClaimed = balanceAfter - balanceBefore;\n if (totalClaimed > 0) {\n rewardToken.safeTransfer(msg.sender, (totalClaimed * BLACKLISTER_SHARE) / 100);\n rewardToken.safeTransfer(protocolAddress, (totalClaimed * PROTOCOL_SHARE) / 100);\n }\n }\n}\n" + }, + "contracts/external/aerodrome/IAerodromeRouter.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.10;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20_Router {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IWETH is IERC20_Router {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n\ninterface IRouter_Aerodrome {\n struct Route {\n address from;\n address to;\n bool stable;\n address factory;\n }\n\n error ETHTransferFailed();\n error Expired();\n error InsufficientAmount();\n error InsufficientAmountA();\n error InsufficientAmountB();\n error InsufficientAmountADesired();\n error InsufficientAmountBDesired();\n error InsufficientAmountAOptimal();\n error InsufficientLiquidity();\n error InsufficientOutputAmount();\n error InvalidAmountInForETHDeposit();\n error InvalidTokenInForETHDeposit();\n error InvalidPath();\n error InvalidRouteA();\n error InvalidRouteB();\n error OnlyWETH();\n error PoolDoesNotExist();\n error PoolFactoryDoesNotExist();\n error SameAddresses();\n error ZeroAddress();\n\n /// @notice Address of FactoryRegistry.sol\n function factoryRegistry() external view returns (address);\n\n /// @notice Address of Protocol PoolFactory.sol\n function defaultFactory() external view returns (address);\n\n /// @notice Address of Voter.sol\n function voter() external view returns (address);\n\n /// @notice Interface of WETH contract used for WETH => ETH wrapping/unwrapping\n function weth() external view returns (IWETH);\n\n /// @dev Represents Ether. Used by zapper to determine whether to return assets as ETH/WETH.\n function ETHER() external view returns (address);\n\n /// @dev Struct containing information necessary to zap in and out of pools\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable Stable or volatile pool\n /// @param factory factory of pool\n /// @param amountOutMinA Minimum amount expected from swap leg of zap via routesA\n /// @param amountOutMinB Minimum amount expected from swap leg of zap via routesB\n /// @param amountAMin Minimum amount of tokenA expected from liquidity leg of zap\n /// @param amountBMin Minimum amount of tokenB expected from liquidity leg of zap\n struct Zap {\n address tokenA;\n address tokenB;\n bool stable;\n address factory;\n uint256 amountOutMinA;\n uint256 amountOutMinB;\n uint256 amountAMin;\n uint256 amountBMin;\n }\n\n /// @notice Sort two tokens by which address value is less than the other\n /// @param tokenA Address of token to sort\n /// @param tokenB Address of token to sort\n /// @return token0 Lower address value between tokenA and tokenB\n /// @return token1 Higher address value between tokenA and tokenB\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\n\n /// @notice Calculate the address of a pool by its' factory.\n /// Used by all Router functions containing a `Route[]` or `_factory` argument.\n /// Reverts if _factory is not approved by the FactoryRegistry\n /// @dev Returns a randomly generated address for a nonexistent pool\n /// @param tokenA Address of token to query\n /// @param tokenB Address of token to query\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of factory which created the pool\n function poolFor(address tokenA, address tokenB, bool stable, address _factory) external view returns (address pool);\n\n /// @notice Fetch and sort the reserves for a pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @return reserveA Amount of reserves of the sorted token A\n /// @return reserveB Amount of reserves of the sorted token B\n function getReserves(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory\n ) external view returns (uint256 reserveA, uint256 reserveB);\n\n /// @notice Perform chained getAmountOut calculations on any number of pools\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\n\n // **** ADD LIQUIDITY ****\n\n /// @notice Quote the amount deposited into a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function quoteAddLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 amountADesired,\n uint256 amountBDesired\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Quote the amount of liquidity removed from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @param liquidity Amount of liquidity to remove\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function quoteRemoveLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 liquidity\n ) external view returns (uint256 amountA, uint256 amountB);\n\n /// @notice Add liquidity of two tokens to a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @param amountAMin Minimum amount of tokenA to deposit\n /// @param amountBMin Minimum amount of tokenB to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountTokenDesired Amount of token desired to deposit\n /// @param amountTokenMin Minimum amount of token to deposit\n /// @param amountETHMin Minimum amount of ETH to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to add liquidity\n /// @return amountToken Amount of token to actually deposit\n /// @return amountETH Amount of tokenETH to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidityETH(\n address token,\n bool stable,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n // **** REMOVE LIQUIDITY ****\n\n /// @notice Remove liquidity of two tokens from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountAMin Minimum amount of tokenA to receive\n /// @param amountBMin Minimum amount of tokenB to receive\n /// @param to Recipient of tokens received\n /// @param deadline Deadline to remove liquidity\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function removeLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountToken Amount of token received\n /// @return amountETH Amount of ETH received\n function removeLiquidityETH(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountETH Amount of ETH received\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n // **** SWAP ****\n\n /// @notice Swap one token for another\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap ETH for a token\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactETHForTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n /// @notice Swap a token for WETH (returned as ETH)\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap one token for another without slippage protection\n /// @return amounts Array of amounts to swap per route\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function UNSAFE_swapExactTokensForTokens(\n uint256[] memory amounts,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory);\n\n // **** SWAP (supporting fee-on-transfer tokens) ****\n\n /// @notice Swap one token for another supporting fee-on-transfer tokens\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external;\n\n /// @notice Swap ETH for a token supporting fee-on-transfer tokens\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable;\n\n /// @notice Swap a token for WETH (returned as ETH) supporting fee-on-transfer tokens\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external;\n\n /// @notice Zap a token A into a pool (B, C). (A can be equal to B or C).\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\n /// Slippage is required for the initial swap.\n /// Additional slippage may be required when adding liquidity as the\n /// price of the token may have changed.\n /// @param tokenIn Token you are zapping in from (i.e. input token).\n /// @param amountInA Amount of input token you wish to send down routesA\n /// @param amountInB Amount of input token you wish to send down routesB\n /// @param zapInPool Contains zap struct information. See Zap struct.\n /// @param routesA Route used to convert input token to tokenA\n /// @param routesB Route used to convert input token to tokenB\n /// @param to Address you wish to mint liquidity to.\n /// @param stake Auto-stake liquidity in corresponding gauge.\n /// @return liquidity Amount of LP tokens created from zapping in.\n function zapIn(\n address tokenIn,\n uint256 amountInA,\n uint256 amountInB,\n Zap calldata zapInPool,\n Route[] calldata routesA,\n Route[] calldata routesB,\n address to,\n bool stake\n ) external payable returns (uint256 liquidity);\n\n /// @notice Zap out a pool (B, C) into A.\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\n /// Slippage is required for the removal of liquidity.\n /// Additional slippage may be required on the swap as the\n /// price of the token may have changed.\n /// @param tokenOut Token you are zapping out to (i.e. output token).\n /// @param liquidity Amount of liquidity you wish to remove.\n /// @param zapOutPool Contains zap struct information. See Zap struct.\n /// @param routesA Route used to convert tokenA into output token.\n /// @param routesB Route used to convert tokenB into output token.\n function zapOut(\n address tokenOut,\n uint256 liquidity,\n Zap calldata zapOutPool,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external;\n\n /// @notice Used to generate params required for zapping in.\n /// Zap in => remove liquidity then swap.\n /// Apply slippage to expected swap values to account for changes in reserves in between.\n /// @dev Output token refers to the token you want to zap in from.\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable .\n /// @param _factory .\n /// @param amountInA Amount of input token you wish to send down routesA\n /// @param amountInB Amount of input token you wish to send down routesB\n /// @param routesA Route used to convert input token to tokenA\n /// @param routesB Route used to convert input token to tokenB\n /// @return amountOutMinA Minimum output expected from swapping input token to tokenA.\n /// @return amountOutMinB Minimum output expected from swapping input token to tokenB.\n /// @return amountAMin Minimum amount of tokenA expected from depositing liquidity.\n /// @return amountBMin Minimum amount of tokenB expected from depositing liquidity.\n function generateZapInParams(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 amountInA,\n uint256 amountInB,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\n\n /// @notice Used to generate params required for zapping out.\n /// Zap out => swap then add liquidity.\n /// Apply slippage to expected liquidity values to account for changes in reserves in between.\n /// @dev Output token refers to the token you want to zap out of.\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable .\n /// @param _factory .\n /// @param liquidity Amount of liquidity being zapped out of into a given output token.\n /// @param routesA Route used to convert tokenA into output token.\n /// @param routesB Route used to convert tokenB into output token.\n /// @return amountOutMinA Minimum output expected from swapping tokenA into output token.\n /// @return amountOutMinB Minimum output expected from swapping tokenB into output token.\n /// @return amountAMin Minimum amount of tokenA expected from withdrawing liquidity.\n /// @return amountBMin Minimum amount of tokenB expected from withdrawing liquidity.\n function generateZapOutParams(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 liquidity,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\n\n /// @notice Used by zapper to determine appropriate ratio of A to B to deposit liquidity. Assumes stable pool.\n /// @dev Returns stable liquidity ratio of B to (A + B).\n /// E.g. if ratio is 0.4, it means there is more of A than there is of B.\n /// Therefore you should deposit more of token A than B.\n /// @param tokenA tokenA of stable pool you are zapping into.\n /// @param tokenB tokenB of stable pool you are zapping into.\n /// @param factory Factory that created stable pool.\n /// @return ratio Ratio of token0 to token1 required to deposit into zap.\n function quoteStableLiquidityRatio(\n address tokenA,\n address tokenB,\n address factory\n ) external view returns (uint256 ratio);\n}\n" + }, + "contracts/external/aerodrome/IAerodromeSwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.10;\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via CL\ninterface ISwapRouter_Aerodrome {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n int24 tickSpacing;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n int24 tickSpacing;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/external/algebra/IAlgebraSwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IAlgebraPoolActions#swap\n/// @notice Any contract that calls IAlgebraPoolActions#swap must implement this interface\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\ninterface IAlgebraSwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a AlgebraPool deployed by the canonical AlgebraFactory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call\n function algebraSwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/algebra/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\nimport \"./IAlgebraSwapCallback.sol\";\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Algebra\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\n/// https://github.com/Uniswap/v3-periphery\ninterface IAlgebraSwapRouter is IAlgebraSwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 limitSqrtPrice;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 limitSqrtPrice;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @dev Unlike standard swaps, handles transferring from user before the actual swap.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingleSupportingFeeOnTransferTokens(ExactInputSingleParams calldata params)\n external\n returns (uint256 amountOut);\n}\n" + }, + "contracts/external/api3/IProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IProxy {\n function read() external view returns (int224 value, uint32 timestamp);\n\n function api3ServerV1() external view returns (address);\n}\n" + }, + "contracts/external/chainlink/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n // getRoundData and latestRoundData should both raise \"No data present\"\n // if they do not have data to report, instead of returning unset values\n // which could be misinterpreted as actual reported values.\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "contracts/external/compound/IComptroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./IPriceOracle.sol\";\nimport \"./ICToken.sol\";\nimport \"./IUnitroller.sol\";\nimport \"./IRewardsDistributor.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n */\ninterface IComptroller {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function oracle() external view returns (IPriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function getAssetsIn(address account) external view returns (ICToken[] memory);\n\n function checkMembership(address account, ICToken cToken) external view returns (bool);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n )\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n function getAccountLiquidity(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n function _setPriceOracle(IPriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICToken market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _become(IUnitroller unitroller) external;\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAllMarkets() external view returns (ICToken[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function suppliers(address account) external view returns (bool);\n\n function supplyCaps(address cToken) external view returns (uint256);\n\n function borrowCaps(address cToken) external view returns (uint256);\n\n function enforceWhitelist() external view returns (bool);\n\n function enterMarkets(address[] memory cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cTokenAddress) external returns (uint256);\n\n function autoImplementation() external view returns (bool);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _toggleAutoImplementations(bool enabled) external returns (uint256);\n\n function _deployMarket(\n bool isCEther,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getMaxRedeemOrBorrow(\n address account,\n ICToken cTokenModify,\n bool isBorrow\n ) external view returns (uint256);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function isDeprecated(ICToken cToken) external view returns (bool);\n\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n}\n" + }, + "contracts/external/compound/ICToken.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's CToken Contract\n * @notice Abstract base for CTokens\n * @author Compound\n */\ninterface ICToken {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function symbol() external view returns (string memory);\n\n function comptroller() external view returns (address);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function isCToken() external view returns (bool);\n\n function isCEther() external view returns (bool);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function borrowBalanceStored(address account) external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function exchangeRateCurrent() external returns (uint256);\n\n function exchangeRateStored() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n}\n" + }, + "contracts/external/compound/IPriceOracle.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./ICToken.sol\";\n\ninterface IPriceOracle {\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICToken cToken) external view returns (uint256);\n}\n" + }, + "contracts/external/compound/IRewardsDistributor.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./ICToken.sol\";\n\n/**\n * @title RewardsDistributor\n * @author Compound\n */\ninterface IRewardsDistributor {\n /// @dev The token to reward (i.e., COMP)\n function rewardToken() external view returns (address);\n\n /// @notice The portion of compRate that each market currently receives\n function compSupplySpeeds(address) external view returns (uint256);\n\n /// @notice The portion of compRate that each market currently receives\n function compBorrowSpeeds(address) external view returns (uint256);\n\n /// @notice The COMP accrued but not yet transferred to each user\n function compAccrued(address) external view returns (uint256);\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @dev Called by the Comptroller\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) external;\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @dev Called by the Comptroller\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\n\n /**\n * @notice Returns an array of all markets.\n */\n function getAllMarkets() external view returns (ICToken[] memory);\n}\n" + }, + "contracts/external/compound/IUnitroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\n/**\n * @title ComptrollerCore\n * @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.\n * CTokens should reference this contract as their comptroller.\n */\ninterface IUnitroller {\n function _setPendingImplementation(address newPendingImplementation) external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n}\n" + }, + "contracts/external/curve/ICurvePool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ICurvePool is IERC20Upgradeable {\n function get_virtual_price() external view returns (uint256);\n\n function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 min_amount) external;\n\n function calc_withdraw_one_coin(uint256 _burn_amount, int128 i) external view returns (uint256);\n\n function add_liquidity(uint256[2] calldata _amounts, uint256 _min_mint_amount) external returns (uint256);\n\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);\n\n function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256);\n\n function coins(uint256 index) external view returns (address);\n\n function lp_token() external view returns (address);\n}\n" + }, + "contracts/external/curve/ICurveV2Pool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICurvePool } from \"./ICurvePool.sol\";\n\ninterface ICurveV2Pool is ICurvePool {\n function price_oracle() external view returns (uint256);\n\n function lp_price() external view returns (uint256);\n\n function coins(uint256 arg0) external view returns (address);\n}\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\ninterface IHypernativeOracle {\n function register(address account, bool isStrictMode) external;\n function validateForbiddenAccountInteraction(address sender) external view;\n function validateForbiddenContextInteraction(address origin, address sender) external view;\n function validateBlacklistedAccountInteraction(address sender) external;\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelay {\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\n // This will return true if and only if it's being called while executing the auction winner(s) call.\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\n // @param permissionId The id that represents the action being gated\n // @return permissioned True if the permission is allowed, false otherwise\n function isPermissioned(\n address protocolFeeReceiver,\n bytes calldata permissionId\n ) external view returns (bool permissioned);\n}\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelayFeeReceiver {\n // Receive the proceeds of an auction.\n // @param permissionKey The permission key where the auction was conducted on.\n function receiveAuctionProceedings(\n bytes calldata permissionKey\n ) external payable;\n}\n" + }, + "contracts/external/redstone/IRedstoneOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IRedstoneOracle {\n function priceOf(address asset) external view returns (uint256);\n\n function priceOfETH() external view returns (uint256);\n\n function getDataFeedIdForAsset(address asset) external view returns (bytes32);\n\n function getDataFeedIds() external view returns (bytes32[] memory dataFeedIds);\n}\n" + }, + "contracts/external/uniswap/FullMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// From Uniswap3 Core\n\n// Updated to Solidity 0.8 by Midas Capital:\n// * Rewrite unary negation of denominator, which is a uint\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\n\npragma solidity ^0.8.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = denominator & (~denominator + 1);\n\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" + }, + "contracts/external/uniswap/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface ISwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n function exactInput(ExactInputParams calldata params) external returns (uint256 amountOut);\n\n function exactOutputSingle(ExactOutputSingleParams calldata params) external returns (uint256 amountIn);\n\n function exactOutput(ExactOutputParams calldata params) external returns (uint256 amountIn);\n\n function factory() external returns (address);\n\n function multicall(uint256 deadline, bytes[] calldata data) external payable returns (bytes[] memory);\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Callee.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Callee {\n function uniswapV2Call(\n address sender,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Pair.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (\n uint112 reserve0,\n uint112 reserve1,\n uint32 blockTimestampLast\n );\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Router01.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n )\n external\n returns (\n uint256 amountA,\n uint256 amountB,\n uint256 liquidity\n );\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function swapTokensForExactETH(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapETHForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) external pure returns (uint256 amountB);\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountIn);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Router02.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV2Router01.sol\";\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV3PoolActions.sol\";\n\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function fee() external view returns (uint24);\n\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n function liquidity() external view returns (uint128);\n\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\n\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 liquidityCumulative,\n bool initialized\n );\n\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolImmutables.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" + }, + "contracts/external/uniswap/IUniswapV3SwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IV3SwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport './IUniswapV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IV3SwapRouter is IUniswapV3SwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// that may remain in the router after the swap.\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// that may remain in the router after the swap.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IQuoter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.8.0 <0.9.0;\n\ninterface IQuoter {\n function estimateMaxSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) external view returns (uint256);\n\n function estimateMinSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) external view returns (uint256);\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\n/// @title Quoter Interface\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\ninterface IUniswapV3Quoter {\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee\n /// @param amountIn The amount of the first token to swap\n /// @return amountOut The amount of the last token that would be received\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\n\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountIn The desired input amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountOut The amount of `tokenOut` that would be received\n function quoteExactInputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountIn,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountOut);\n\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\n /// @param amountOut The amount of the last token to receive\n /// @return amountIn The amount of first token required to be paid\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\n\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountOut The desired output amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\n function quoteExactOutputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountOut,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountIn);\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/BitMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title BitMath\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\nlibrary BitMath {\n /// @notice Returns the index of the most significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\n /// @param x the value for which to compute the most significant bit, must be greater than 0\n /// @return r the index of the most significant bit\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n if (x >= 0x100000000000000000000000000000000) {\n x >>= 128;\n r += 128;\n }\n if (x >= 0x10000000000000000) {\n x >>= 64;\n r += 64;\n }\n if (x >= 0x100000000) {\n x >>= 32;\n r += 32;\n }\n if (x >= 0x10000) {\n x >>= 16;\n r += 16;\n }\n if (x >= 0x100) {\n x >>= 8;\n r += 8;\n }\n if (x >= 0x10) {\n x >>= 4;\n r += 4;\n }\n if (x >= 0x4) {\n x >>= 2;\n r += 2;\n }\n if (x >= 0x2) r += 1;\n }\n\n /// @notice Returns the index of the least significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\n /// @param x the value for which to compute the least significant bit, must be greater than 0\n /// @return r the index of the least significant bit\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n r = 255;\n if (x & type(uint128).max > 0) {\n r -= 128;\n } else {\n x >>= 128;\n }\n if (x & type(uint64).max > 0) {\n r -= 64;\n } else {\n x >>= 64;\n }\n if (x & type(uint32).max > 0) {\n r -= 32;\n } else {\n x >>= 32;\n }\n if (x & type(uint16).max > 0) {\n r -= 16;\n } else {\n x >>= 16;\n }\n if (x & type(uint8).max > 0) {\n r -= 8;\n } else {\n x >>= 8;\n }\n if (x & 0xf > 0) {\n r -= 4;\n } else {\n x >>= 4;\n }\n if (x & 0x3 > 0) {\n r -= 2;\n } else {\n x >>= 2;\n }\n if (x & 0x1 > 0) r -= 1;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/FixedPoint96.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000; // 2^96\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/LiquidityMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Math library for liquidity\nlibrary LiquidityMath {\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\n /// @param x The liquidity before change\n /// @param y The delta by which liquidity should be changed\n /// @return z The liquidity delta\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\n if (y < 0) {\n require((z = x - uint128(-y)) < x, \"LS\");\n } else {\n require((z = x + uint128(y)) >= x, \"LA\");\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/LowGasSafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.0;\n\n/// @title Optimized overflow and underflow safe math operations\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\nlibrary LowGasSafeMath {\n /// @notice Returns x + y, reverts if sum overflows uint256\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x);\n }\n\n /// @notice Returns x - y, reverts if underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x);\n }\n\n /// @notice Returns x * y, reverts if overflows\n /// @param x The multiplicand\n /// @param y The multiplier\n /// @return z The product of x and y\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(x == 0 || (z = x * y) / x == y);\n }\n\n /// @notice Returns x + y, reverts if overflows or underflows\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x + y) >= x == (y >= 0));\n }\n\n /// @notice Returns x - y, reverts if overflows or underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x - y) <= x == (y >= 0));\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SqrtPriceMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./LowGasSafeMath.sol\";\nimport \"./SafeCast.sol\";\n\nimport \"../../FullMath.sol\";\nimport \"./UnsafeMath.sol\";\nimport \"./FixedPoint96.sol\";\nimport \"./BitMath.sol\";\n\n/// @title Functions based on Q64.96 sqrt price and liquidity\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\nlibrary SqrtPriceMath {\n using LowGasSafeMath for uint256;\n using SafeCast for uint256;\n\n /// @notice Gets the next sqrt price given a delta of token0\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\n /// price less in order to not send too much output.\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token0 to add or remove from virtual reserves\n /// @param add Whether to add or remove the amount of token0\n /// @return The price after adding or removing amount, depending on add\n function getNextSqrtPriceFromAmount0RoundingUp(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\n if (amount == 0) return sqrtPX96;\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n\n bool overflow = false;\n if (numerator1 != 0 && sqrtPX96 != 0)\n overflow = uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(sqrtPX96)) >= 254;\n\n if (add) {\n uint256 product;\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\n uint256 denominator = numerator1 + product;\n if (denominator >= numerator1) {\n // always fits in 160 bits\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\n }\n }\n\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\n } else {\n uint256 product;\n // if the product overflows, we know the denominator underflows\n // in addition, we must check that the denominator does not underflow\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\n uint256 denominator = numerator1 - product;\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\n }\n }\n\n /// @notice Gets the next sqrt price given a delta of token1\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\n /// price less in order to not send too much output.\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token1 to add, or remove, from virtual reserves\n /// @param add Whether to add, or remove, the amount of token1\n /// @return The price after adding or removing `amount`\n function getNextSqrtPriceFromAmount1RoundingDown(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\n // in both cases, avoid a mulDiv for most inputs\n if (add) {\n uint256 quotient = (\n amount <= type(uint160).max\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\n );\n\n return uint256(sqrtPX96).add(quotient).toUint160();\n } else {\n uint256 quotient = (\n amount <= type(uint160).max\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\n );\n\n require(sqrtPX96 > quotient);\n // always fits 160 bits\n return uint160(sqrtPX96 - quotient);\n }\n }\n\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountIn How much of token0, or token1, is being swapped in\n /// @param zeroForOne Whether the amount in is token0 or token1\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\n function getNextSqrtPriceFromInput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountIn,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we don't pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\n }\n\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\n /// @param sqrtPX96 The starting price before accounting for the output amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountOut How much of token0, or token1, is being swapped out\n /// @param zeroForOne Whether the amount out is token0 or token1\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\n function getNextSqrtPriceFromOutput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountOut,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\n }\n\n /// @notice Gets the amount0 delta between two prices\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up or down\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\n require(sqrtRatioAX96 > 0);\n\n bool overflow = false;\n if (numerator1 != 0 && numerator2 != 0)\n overflow =\n uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(numerator2)) >= 254;\n\n if (overflow) {\n return\n roundUp\n ? FullMath.mulDivRoundingUp(\n FullMath.mulDivRoundingUp(uint256(liquidity), numerator2, sqrtRatioBX96),\n FixedPoint96.Q96,\n sqrtRatioAX96\n )\n : FullMath.mulDiv(\n FullMath.mulDiv(uint256(liquidity), numerator2, sqrtRatioBX96),\n FixedPoint96.Q96,\n sqrtRatioAX96\n );\n } else {\n return\n roundUp\n ? UnsafeMath.divRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), sqrtRatioAX96)\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\n }\n }\n\n /// @notice Gets the amount1 delta between two prices\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up, or down\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n roundUp\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n /// @notice Helper that gets signed token0 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount0) {\n return\n liquidity < 0\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n\n /// @notice Helper that gets signed token1 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount1) {\n return\n liquidity < 0\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SwapMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"../../FullMath.sol\";\nimport \"./SqrtPriceMath.sol\";\n\n/// @title Computes the result of a swap within ticks\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\nlibrary SwapMath {\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\n /// @param liquidity The usable liquidity\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\n /// @return feeAmount The amount of input that will be taken as a fee\n function computeSwapStep(\n uint160 sqrtRatioCurrentX96,\n uint160 sqrtRatioTargetX96,\n uint128 liquidity,\n int256 amountRemaining,\n uint24 feePips,\n bool zeroForOne\n )\n internal\n pure\n returns (\n uint160 sqrtRatioNextX96,\n uint256 amountIn,\n uint256 amountOut,\n uint256 feeAmount\n )\n {\n require(zeroForOne == sqrtRatioCurrentX96 >= sqrtRatioTargetX96, \"SPD\");\n bool exactIn = amountRemaining >= 0;\n\n if (exactIn) {\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\n amountIn = zeroForOne\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\n sqrtRatioCurrentX96,\n liquidity,\n amountRemainingLessFee,\n zeroForOne\n );\n } else {\n amountOut = zeroForOne\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\n\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\n sqrtRatioCurrentX96,\n liquidity,\n uint256(-amountRemaining),\n zeroForOne\n );\n }\n\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\n\n // get the input/output amounts\n if (zeroForOne) {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\n } else {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\n }\n\n // cap the output amount to not exceed the remaining output amount\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\n amountOut = uint256(-amountRemaining);\n }\n\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\n // we didn't reach the target, so take the remainder of the maximum input as fee\n feeAmount = uint256(amountRemaining) - amountIn;\n } else {\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/Tick.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./LowGasSafeMath.sol\";\nimport \"./SafeCast.sol\";\n\nimport \"../../TickMath.sol\";\nimport \"./LiquidityMath.sol\";\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\n\n/// Ithil to modify it, since it does not have access to storage arrays\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// Ithil: only use it with lower = self[tickLower] and upper = self[tickUpper]\n /// @param lower The info of the lower tick boundary of the position\n /// @param upper The info of the upper tick boundary of the position\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n Tick.Info memory lower,\n Tick.Info memory upper,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal pure returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// Ithil: always use with info = self[tick]\n /// @param info The info tick that will be updated\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n Tick.Info memory info,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal pure returns (bool flipped) {\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, \"LO\");\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param info The result of the mapping containing all tick information for initialized ticks\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n Tick.Info memory info,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal pure returns (int128 liquidityNet) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/TickBitmap.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./BitMath.sol\";\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n /// @dev simply divides @param tick by 256 with remainder: tick = wordPos * 256 + bitPos\n function position(int24 tick) internal pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(int8(tick % 256));\n }\n\n /// Written by Ithil\n function computeWordPos(\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal pure returns (int16 wordPos) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n (wordPos, ) = lte ? position(compressed) : position(compressed + 1);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param selfResult The result of the mapping in which to flip the tick (Ithil modified)\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n uint256 selfResult,\n int24 tick,\n int24 tickSpacing\n ) internal pure {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n selfResult ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param selfResult The result of the mapping in which to compute the next initialized tick (Ithil modified)\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n uint256 selfResult,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal pure returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = selfResult & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(uint24(bitPos) - uint24(BitMath.mostSignificantBit(masked)))) * tickSpacing\n : (compressed - int24(uint24(bitPos))) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = selfResult & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(uint24(BitMath.leastSignificantBit(masked) - bitPos))) * tickSpacing\n : (compressed + 1 + int24(uint24(type(uint8).max - bitPos))) * tickSpacing;\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/UnsafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Math functions that do not check inputs or outputs\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\nlibrary UnsafeMath {\n /// @notice Returns ceil(x / y)\n /// @dev division by 0 has unspecified behavior, and must be checked externally\n /// @param x The dividend\n /// @param y The divisor\n /// @return z The quotient, ceil(x / y)\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n z := add(div(x, y), gt(mod(x, y), 0))\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\npragma experimental ABIEncoderV2;\n\nimport \"../IUniswapV3Factory.sol\";\nimport \"./interfaces/IQuoter.sol\";\nimport \"./UniswapV3Quoter.sol\";\n\ncontract Quoter is IQuoter, UniswapV3Quoter {\n IUniswapV3Factory internal uniV3Factory; // TODO should it be immutable?\n\n constructor(address _uniV3Factory) {\n uniV3Factory = IUniswapV3Factory(_uniV3Factory);\n }\n\n // This should be equal to quoteExactInputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\n // todo: add price limit\n function estimateMaxSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) public view override returns (uint256) {\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\n\n return _estimateOutputSingle(_toToken, _fromToken, _amount, pool);\n }\n\n // This should be equal to quoteExactOutputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\n // todo: add price limit\n function estimateMinSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) public view override returns (uint256) {\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\n\n return _estimateInputSingle(_fromToken, _toToken, _amount, pool);\n }\n\n // todo: add price limit\n function _estimateOutputSingle(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n address _pool\n ) internal view returns (uint256 amountOut) {\n bool zeroForOne = _fromToken > _toToken;\n // todo: price limit?\n (int256 amount0, int256 amount1) = quoteSwap(\n _pool,\n int256(_amount),\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\n zeroForOne\n );\n if (zeroForOne) amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\n else amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\n }\n\n // todo: add price limit\n function _estimateInputSingle(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n address _pool\n ) internal view returns (uint256 amountOut) {\n bool zeroForOne = _fromToken < _toToken;\n // todo: price limit?\n (int256 amount0, int256 amount1) = quoteSwap(\n _pool,\n -int256(_amount),\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\n zeroForOne\n );\n if (zeroForOne) amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\n else amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\n }\n\n function doesPoolExist(address _token0, address _token1) external view returns (bool) {\n // try 0.05%\n address pool = uniV3Factory.getPool(_token0, _token1, 500);\n if (pool != address(0)) return true;\n\n // try 0.3%\n pool = uniV3Factory.getPool(_token0, _token1, 3000);\n if (pool != address(0)) return true;\n\n // try 1%\n pool = uniV3Factory.getPool(_token0, _token1, 10000);\n if (pool != address(0)) return true;\n else return false;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/UniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.6;\n\nimport \"./libraries/LowGasSafeMath.sol\";\nimport \"./libraries/SafeCast.sol\";\nimport \"./libraries/Tick.sol\";\nimport \"./libraries/TickBitmap.sol\";\n\nimport \"../FullMath.sol\";\nimport \"../TickMath.sol\";\nimport \"./libraries/LiquidityMath.sol\";\nimport \"./libraries/SqrtPriceMath.sol\";\nimport \"./libraries/SwapMath.sol\";\n\nimport \"./interfaces/IUniswapV3Quoter.sol\";\nimport \"../IUniswapV3Pool.sol\";\nimport \"../IUniswapV3PoolImmutables.sol\";\n\ncontract UniswapV3Quoter {\n using LowGasSafeMath for int256;\n using SafeCast for uint256;\n using Tick for mapping(int24 => Tick.Info);\n\n struct PoolState {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the tick spacing\n int24 tickSpacing;\n // the pool's fee\n uint24 fee;\n // the pool's liquidity\n uint128 liquidity;\n // whether the pool is locked\n bool unlocked;\n }\n\n // accumulated protocol fees in token0/token1 units\n struct ProtocolFees {\n uint128 token0;\n uint128 token1;\n }\n\n // the top level state of the swap, the results of which are recorded in storage at the end\n struct SwapState {\n // the amount remaining to be swapped in/out of the input/output asset\n int256 amountSpecifiedRemaining;\n // the amount already swapped out/in of the output/input asset\n int256 amountCalculated;\n // current sqrt(price)\n uint160 sqrtPriceX96;\n // the tick associated with the current price\n int24 tick;\n // the current liquidity in range\n uint128 liquidity;\n }\n\n struct StepComputations {\n // the price at the beginning of the step\n uint160 sqrtPriceStartX96;\n // the next tick to swap to from the current tick in the swap direction\n int24 tickNext;\n // whether tickNext is initialized or not\n bool initialized;\n // sqrt(price) for the next tick (1/0)\n uint160 sqrtPriceNextX96;\n // how much is being swapped in in this step\n uint256 amountIn;\n // how much is being swapped out\n uint256 amountOut;\n // how much fee is being paid in\n uint256 feeAmount;\n }\n\n struct InitialState {\n address poolAddress;\n PoolState poolState;\n uint256 feeGrowthGlobal0X128;\n uint256 feeGrowthGlobal1X128;\n }\n\n struct NextTickPassage {\n int24 tick;\n int24 tickSpacing;\n }\n\n function fetchState(address _pool) internal view returns (PoolState memory poolState) {\n IUniswapV3Pool pool = IUniswapV3Pool(_pool);\n (uint160 sqrtPriceX96, int24 tick, , , , , bool unlocked) = pool.slot0(); // external call\n uint128 liquidity = pool.liquidity(); // external call\n int24 tickSpacing = IUniswapV3PoolImmutables(_pool).tickSpacing(); // external call\n uint24 fee = IUniswapV3PoolImmutables(_pool).fee(); // external call\n poolState = PoolState(sqrtPriceX96, tick, tickSpacing, fee, liquidity, unlocked);\n }\n\n function setInitialState(\n PoolState memory initialPoolState,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne\n )\n internal\n pure\n returns (\n SwapState memory state,\n uint128 liquidity,\n uint160 sqrtPriceX96\n )\n {\n liquidity = initialPoolState.liquidity;\n\n sqrtPriceX96 = initialPoolState.sqrtPriceX96;\n\n require(\n zeroForOne\n ? sqrtPriceLimitX96 < initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\n : sqrtPriceLimitX96 > initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\n \"SPL\"\n );\n\n state = SwapState({\n amountSpecifiedRemaining: amountSpecified,\n amountCalculated: 0,\n sqrtPriceX96: initialPoolState.sqrtPriceX96,\n tick: initialPoolState.tick,\n liquidity: 0 // to be modified after initialization\n });\n }\n\n function getNextTickAndPrice(\n int24 tickSpacing,\n int24 currentTick,\n IUniswapV3Pool pool,\n bool zeroForOne\n )\n internal\n view\n returns (\n int24 tickNext,\n bool initialized,\n uint160 sqrtPriceNextX96\n )\n {\n int24 compressed = currentTick / tickSpacing;\n if (!zeroForOne) compressed++;\n if (currentTick < 0 && currentTick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n uint256 selfResult = pool.tickBitmap(int16(compressed >> 8)); // external call\n\n (tickNext, initialized) = TickBitmap.nextInitializedTickWithinOneWord(\n selfResult,\n currentTick,\n tickSpacing,\n zeroForOne\n );\n\n if (tickNext < TickMath.MIN_TICK) {\n tickNext = TickMath.MIN_TICK;\n } else if (tickNext > TickMath.MAX_TICK) {\n tickNext = TickMath.MAX_TICK;\n }\n sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(tickNext);\n }\n\n function processSwapWithinTick(\n IUniswapV3Pool pool,\n PoolState memory initialPoolState,\n SwapState memory state,\n uint160 firstSqrtPriceX96,\n uint128 firstLiquidity,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne,\n bool exactAmount\n )\n internal\n view\n returns (\n uint160 sqrtPriceNextX96,\n uint160 finalSqrtPriceX96,\n uint128 finalLiquidity\n )\n {\n StepComputations memory step;\n\n step.sqrtPriceStartX96 = firstSqrtPriceX96;\n\n (step.tickNext, step.initialized, sqrtPriceNextX96) = getNextTickAndPrice(\n initialPoolState.tickSpacing,\n state.tick,\n pool,\n zeroForOne\n );\n\n (finalSqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\n firstSqrtPriceX96,\n (zeroForOne ? sqrtPriceNextX96 < sqrtPriceLimitX96 : sqrtPriceNextX96 > sqrtPriceLimitX96)\n ? sqrtPriceLimitX96\n : sqrtPriceNextX96,\n firstLiquidity,\n state.amountSpecifiedRemaining,\n initialPoolState.fee,\n zeroForOne\n );\n\n if (exactAmount) {\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\n } else {\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\n }\n\n if (finalSqrtPriceX96 == sqrtPriceNextX96) {\n if (step.initialized) {\n (, int128 liquidityNet, , , , , , ) = pool.ticks(step.tickNext);\n if (zeroForOne) liquidityNet = -liquidityNet;\n finalLiquidity = LiquidityMath.addDelta(firstLiquidity, liquidityNet);\n }\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\n } else if (finalSqrtPriceX96 != step.sqrtPriceStartX96) {\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\n state.tick = TickMath.getTickAtSqrtRatio(finalSqrtPriceX96);\n }\n }\n\n function returnedAmount(\n SwapState memory state,\n int256 amountSpecified,\n bool zeroForOne\n ) internal pure returns (int256 amount0, int256 amount1) {\n if (amountSpecified > 0) {\n (amount0, amount1) = zeroForOne\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\n } else {\n (amount0, amount1) = zeroForOne\n ? (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining)\n : (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated);\n }\n }\n\n function quoteSwap(\n address poolAddress,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne\n ) internal view returns (int256 amount0, int256 amount1) {\n bool exactAmount = amountSpecified > 0;\n\n PoolState memory initialPoolState = fetchState(poolAddress);\n uint160 sqrtPriceNextX96;\n\n (SwapState memory state, uint128 liquidity, uint160 sqrtPriceX96) = setInitialState(\n initialPoolState,\n amountSpecified,\n sqrtPriceLimitX96,\n zeroForOne\n );\n\n while (state.amountSpecifiedRemaining != 0 && sqrtPriceX96 != sqrtPriceLimitX96)\n (sqrtPriceNextX96, sqrtPriceX96, liquidity) = processSwapWithinTick(\n IUniswapV3Pool(poolAddress),\n initialPoolState,\n state,\n sqrtPriceX96,\n liquidity,\n sqrtPriceLimitX96,\n zeroForOne,\n exactAmount\n );\n\n (amount0, amount1) = returnedAmount(state, amountSpecified, zeroForOne);\n }\n}\n" + }, + "contracts/external/uniswap/TickMath.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\n// From Uniswap3 Core\n\n// Updated to Solidity 0.8 by Midas Capital:\n// * Cast MAX_TICK to int256 before casting to uint\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\n\npragma solidity ^0.8.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n unchecked {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), \"T\");\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n unchecked {\n // second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, \"R\");\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n }\n}\n" + }, + "contracts/external/uniswap/UniswapV2Library.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV2Pair.sol\";\nimport \"./IUniswapV2Factory.sol\";\n\nlibrary UniswapV2Library {\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n require(tokenA != tokenB, \"UniswapV2Library: IDENTICAL_ADDRESSES\");\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), \"UniswapV2Library: ZERO_ADDRESS\");\n }\n\n function pairFor(\n address factory,\n address tokenA,\n address tokenB\n ) internal view returns (address pair) {\n return IUniswapV2Factory(factory).getPair(tokenA, tokenB);\n }\n\n // fetches and sorts the reserves for a pair\n function getReserves(\n address factory,\n address tokenA,\n address tokenB\n ) internal view returns (uint256 reserveA, uint256 reserveB) {\n (address token0, ) = sortTokens(tokenA, tokenB);\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n }\n\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) internal pure returns (uint256 amountB) {\n require(amountA > 0, \"UniswapV2Library: INSUFFICIENT_AMOUNT\");\n require(reserveA > 0 && reserveB > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n amountB = (amountA * reserveB) / reserveA;\n }\n\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut,\n uint8 flashSwapFee\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * (10000 - flashSwapFee);\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = reserveIn * 10000 + amountInWithFee;\n amountOut = numerator / denominator;\n }\n\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut,\n uint8 flashSwapFee\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * 10000;\n uint256 denominator = (reserveOut - amountOut) * (10000 - flashSwapFee);\n amountIn = numerator / denominator + 1;\n }\n\n // performs chained getAmountOut calculations on any number of pairs\n function getAmountsOut(\n address factory,\n uint256 amountIn,\n address[] memory path,\n uint8 flashSwapFee\n ) internal view returns (uint256[] memory amounts) {\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n amounts = new uint256[](path.length);\n amounts[0] = amountIn;\n for (uint256 i; i < path.length - 1; i++) {\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i], path[i + 1]);\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut, flashSwapFee);\n }\n }\n\n // performs chained getAmountIn calculations on any number of pairs\n function getAmountsIn(\n address factory,\n uint256 amountOut,\n address[] memory path,\n uint8 flashSwapFee\n ) internal view returns (uint256[] memory amounts) {\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n amounts = new uint256[](path.length);\n amounts[amounts.length - 1] = amountOut;\n for (uint256 i = path.length - 1; i > 0; i--) {\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i - 1], path[i]);\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut, flashSwapFee);\n }\n }\n}\n" + }, + "contracts/external/velodrome/IVelodromeRouter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IRouter_Velodrome {\n struct Route {\n address from;\n address to;\n bool stable;\n }\n\n error ETHTransferFailed();\n error Expired();\n error InsufficientAmount();\n error InsufficientAmountA();\n error InsufficientAmountB();\n error InsufficientAmountADesired();\n error InsufficientAmountBDesired();\n error InsufficientLiquidity();\n error InsufficientOutputAmount();\n error InvalidPath();\n error OnlyWETH();\n error SameAddresses();\n error ZeroAddress();\n\n /// @notice Address of Velodrome v2 pool factory\n function factory() external view returns (address);\n\n /// @notice Address of Velodrome v2 pool implementation\n function poolImplementation() external view returns (address);\n\n /// @notice Sort two tokens by which address value is less than the other\n /// @param tokenA Address of token to sort\n /// @param tokenB Address of token to sort\n /// @return token0 Lower address value between tokenA and tokenB\n /// @return token1 Higher address value between tokenA and tokenB\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\n\n /// @notice Calculate the address of a pool by its' factory.\n /// @dev Returns a randomly generated address for a nonexistent pool\n /// @param tokenA Address of token to query\n /// @param tokenB Address of token to query\n /// @param stable True if pool is stable, false if volatile\n function poolFor(address tokenA, address tokenB, bool stable) external view returns (address pool);\n\n /// @notice Fetch and sort the reserves for a pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @return reserveA Amount of reserves of the sorted token A\n /// @return reserveB Amount of reserves of the sorted token B\n function getReserves(\n address tokenA,\n address tokenB,\n bool stable\n ) external view returns (uint256 reserveA, uint256 reserveB);\n\n /// @notice Perform chained getAmountOut calculations on any number of pools\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\n\n // **** ADD LIQUIDITY ****\n\n /// @notice Quote the amount deposited into a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function quoteAddLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Quote the amount of liquidity removed from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function quoteRemoveLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity\n ) external view returns (uint256 amountA, uint256 amountB);\n\n /// @notice Add liquidity of two tokens to a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @param amountAMin Minimum amount of tokenA to deposit\n /// @param amountBMin Minimum amount of tokenB to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountTokenDesired Amount of token desired to deposit\n /// @param amountTokenMin Minimum amount of token to deposit\n /// @param amountETHMin Minimum amount of ETH to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to add liquidity\n /// @return amountToken Amount of token to actually deposit\n /// @return amountETH Amount of tokenETH to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidityETH(\n address token,\n bool stable,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n // **** REMOVE LIQUIDITY ****\n\n /// @notice Remove liquidity of two tokens from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountAMin Minimum amount of tokenA to receive\n /// @param amountBMin Minimum amount of tokenB to receive\n /// @param to Recipient of tokens received\n /// @param deadline Deadline to remove liquidity\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function removeLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountToken Amount of token received\n /// @return amountETH Amount of ETH received\n function removeLiquidityETH(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountETH Amount of ETH received\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n /// @notice Swap one token for another\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap ETH for a token\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactETHForTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n /// @notice Swap a token for WETH (returned as ETH)\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n" + }, + "contracts/FeeDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { CErc20Delegator } from \"./compound/CErc20Delegator.sol\";\nimport { CErc20PluginDelegate } from \"./compound/CErc20PluginDelegate.sol\";\nimport { SafeOwnableUpgradeable } from \"./ionic/SafeOwnableUpgradeable.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { DiamondExtension, DiamondBase } from \"./ionic/DiamondExtension.sol\";\nimport { AuthoritiesRegistry } from \"./ionic/AuthoritiesRegistry.sol\";\n\ncontract FeeDistributorStorage {\n struct CDelegateUpgradeData {\n address implementation;\n bytes becomeImplementationData;\n }\n\n /**\n * @notice Maps Unitroller (Comptroller proxy) addresses to the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n * @dev A value of 0 means unset whereas a negative value means 0.\n */\n mapping(address => int256) public customInterestFeeRates;\n\n /**\n * @dev Latest Comptroller implementation for each existing implementation.\n */\n mapping(address => address) internal _latestComptrollerImplementation;\n\n /**\n * @dev Latest CErc20Delegate implementation for each existing implementation.\n */\n mapping(uint8 => CDelegateUpgradeData) internal _latestCErc20Delegate;\n\n /**\n * @dev Latest Plugin implementation for each existing implementation.\n */\n mapping(address => address) internal _latestPluginImplementation;\n\n mapping(address => DiamondExtension[]) public comptrollerExtensions;\n\n mapping(address => DiamondExtension[]) public cErc20DelegateExtensions;\n\n AuthoritiesRegistry public authoritiesRegistry;\n\n /**\n * @dev used as salt for the creation of new markets\n */\n uint256 public marketsCounter;\n\n /**\n * @dev Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\n */\n uint256 public minBorrowEth;\n\n /**\n * @dev Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\n * No longer used as of `Rari-Capital/compound-protocol` version `fuse-v1.1.0`.\n */\n uint256 public maxUtilizationRate;\n\n /**\n * @notice The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n uint256 public defaultInterestFeeRate;\n}\n\n/**\n * @title FeeDistributor\n * @author David Lucid (https://github.com/davidlucid)\n * @notice FeeDistributor controls and receives protocol fees from Ionic pools and relays admin actions to Ionic pools.\n */\ncontract FeeDistributor is SafeOwnableUpgradeable, FeeDistributorStorage {\n using AddressUpgradeable for address;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @dev Initializer that sets initial values of state variables.\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function initialize(uint256 _defaultInterestFeeRate) public initializer {\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n __SafeOwnable_init(msg.sender);\n defaultInterestFeeRate = _defaultInterestFeeRate;\n maxUtilizationRate = type(uint256).max;\n }\n\n function reinitialize(AuthoritiesRegistry _ar) public onlyOwnerOrAdmin {\n authoritiesRegistry = _ar;\n }\n\n /**\n * @dev Sets the default proportion of Ionic pool interest taken as a protocol fee.\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function _setDefaultInterestFeeRate(uint256 _defaultInterestFeeRate) external onlyOwner {\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n defaultInterestFeeRate = _defaultInterestFeeRate;\n }\n\n /**\n * @dev Withdraws accrued fees on interest.\n * @param erc20Contract The ERC20 token address to withdraw. Set to the zero address to withdraw ETH.\n */\n function _withdrawAssets(address erc20Contract) external {\n if (erc20Contract == address(0)) {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No balance available to withdraw.\");\n (bool success, ) = owner().call{ value: balance }(\"\");\n require(success, \"Failed to transfer ETH balance to msg.sender.\");\n } else {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 balance = token.balanceOf(address(this));\n require(balance > 0, \"No token balance available to withdraw.\");\n token.safeTransfer(owner(), balance);\n }\n }\n\n /**\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\n * @param _minBorrowEth Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\n * @param _maxUtilizationRate Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\n */\n function _setPoolLimits(uint256 _minBorrowEth, uint256 _maxUtilizationRate) external onlyOwner {\n minBorrowEth = _minBorrowEth;\n maxUtilizationRate = _maxUtilizationRate;\n }\n\n function getMinBorrowEth(ICErc20 _ctoken) public view returns (uint256) {\n (, , uint256 borrowBalance, ) = _ctoken.getAccountSnapshot(_msgSender());\n if (borrowBalance == 0) return minBorrowEth;\n IonicComptroller comptroller = IonicComptroller(address(_ctoken.comptroller()));\n BasePriceOracle oracle = comptroller.oracle();\n uint256 underlyingPriceEth = oracle.price(ICErc20(address(_ctoken)).underlying());\n uint256 underlyingDecimals = _ctoken.decimals();\n uint256 borrowBalanceEth = (underlyingPriceEth * borrowBalance) / 10 ** underlyingDecimals;\n if (borrowBalanceEth > minBorrowEth) {\n return 0;\n }\n return minBorrowEth - borrowBalanceEth;\n }\n\n /**\n * @dev Receives native fees.\n */\n receive() external payable {}\n\n /**\n * @dev Sends data to a contract.\n * @param targets The contracts to which `data` will be sent.\n * @param data The data to be sent to each of `targets`.\n */\n function _callPool(address[] calldata targets, bytes[] calldata data) external onlyOwner {\n require(targets.length > 0 && targets.length == data.length, \"Array lengths must be equal and greater than 0.\");\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data[i]);\n }\n\n /**\n * @dev Sends data to a contract.\n * @param targets The contracts to which `data` will be sent.\n * @param data The data to be sent to each of `targets`.\n */\n function _callPool(address[] calldata targets, bytes calldata data) external onlyOwner {\n require(targets.length > 0, \"No target addresses specified.\");\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data);\n }\n\n /**\n * @dev Deploys a CToken for an underlying ERC20\n * @param constructorData Encoded construction data for `CToken initialize()`\n */\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address) {\n // Make sure comptroller == msg.sender\n (address underlying, address comptroller) = abi.decode(constructorData[0:64], (address, address));\n require(comptroller == msg.sender, \"Comptroller is not sender.\");\n\n // Deploy CErc20Delegator using msg.sender, underlying, and block.number as a salt\n bytes32 salt = keccak256(abi.encodePacked(msg.sender, underlying, ++marketsCounter));\n\n bytes memory cErc20DelegatorCreationCode = abi.encodePacked(type(CErc20Delegator).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(0, salt, cErc20DelegatorCreationCode);\n\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\n DiamondExtension delegateAsExtension = DiamondExtension(data.implementation);\n // register the first extension\n DiamondBase(proxy)._registerExtension(delegateAsExtension, DiamondExtension(address(0)));\n // derive and configure the other extensions\n DiamondExtension[] memory ctokenExts = cErc20DelegateExtensions[address(delegateAsExtension)];\n for (uint256 i = 0; i < ctokenExts.length; i++) {\n if (ctokenExts[i] == delegateAsExtension) continue;\n DiamondBase(proxy)._registerExtension(ctokenExts[i], DiamondExtension(address(0)));\n }\n CErc20PluginDelegate(address(proxy))._becomeImplementation(becomeImplData);\n\n return proxy;\n }\n\n /**\n * @dev Latest Comptroller implementation for each existing implementation.\n */\n function latestComptrollerImplementation(address oldImplementation) external view returns (address) {\n return\n _latestComptrollerImplementation[oldImplementation] != address(0)\n ? _latestComptrollerImplementation[oldImplementation]\n : oldImplementation;\n }\n\n /**\n * @dev Sets the latest `Comptroller` upgrade implementation address.\n * @param oldImplementation The old `Comptroller` implementation address to upgrade from.\n * @param newImplementation Latest `Comptroller` implementation address.\n */\n function _setLatestComptrollerImplementation(\n address oldImplementation,\n address newImplementation\n ) external onlyOwner {\n _latestComptrollerImplementation[oldImplementation] = newImplementation;\n }\n\n /**\n * @dev Latest CErc20Delegate implementation for each existing implementation.\n */\n function latestCErc20Delegate(uint8 delegateType) external view returns (address, bytes memory) {\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\n bytes memory emptyBytes;\n return\n data.implementation != address(0)\n ? (data.implementation, data.becomeImplementationData)\n : (address(0), emptyBytes);\n }\n\n /**\n * @dev Sets the latest `CErc20Delegate` upgrade implementation address and data.\n * @param delegateType The old `CErc20Delegate` implementation address to upgrade from.\n * @param newImplementation Latest `CErc20Delegate` implementation address.\n * @param becomeImplementationData Data passed to the new implementation via `becomeImplementation` after upgrade.\n */\n function _setLatestCErc20Delegate(\n uint8 delegateType,\n address newImplementation,\n bytes calldata becomeImplementationData\n ) external onlyOwner {\n _latestCErc20Delegate[delegateType] = CDelegateUpgradeData(newImplementation, becomeImplementationData);\n }\n\n /**\n * @dev Latest Plugin implementation for each existing implementation.\n */\n function latestPluginImplementation(address oldImplementation) external view returns (address) {\n return\n _latestPluginImplementation[oldImplementation] != address(0)\n ? _latestPluginImplementation[oldImplementation]\n : oldImplementation;\n }\n\n /**\n * @dev Sets the latest plugin upgrade implementation address.\n * @param oldImplementation The old plugin implementation address to upgrade from.\n * @param newImplementation Latest plugin implementation address.\n */\n function _setLatestPluginImplementation(address oldImplementation, address newImplementation) external onlyOwner {\n _latestPluginImplementation[oldImplementation] = newImplementation;\n }\n\n /**\n * @dev Upgrades a plugin of a CErc20PluginDelegate market to the latest implementation\n * @param cDelegator the proxy address\n * @return if the plugin was upgraded or not\n */\n function _upgradePluginToLatestImplementation(address cDelegator) external onlyOwner returns (bool) {\n CErc20PluginDelegate market = CErc20PluginDelegate(cDelegator);\n\n address oldPluginAddress = address(market.plugin());\n market._updatePlugin(_latestPluginImplementation[oldPluginAddress]);\n address newPluginAddress = address(market.plugin());\n\n return newPluginAddress != oldPluginAddress;\n }\n\n /**\n * @notice Returns the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function interestFeeRate() external view returns (uint256) {\n (bool success, bytes memory data) = msg.sender.staticcall(abi.encodeWithSignature(\"comptroller()\"));\n\n if (success && data.length == 32) {\n address comptroller = abi.decode(data, (address));\n int256 customRate = customInterestFeeRates[comptroller];\n if (customRate > 0) return uint256(customRate);\n if (customRate < 0) return 0;\n }\n\n return defaultInterestFeeRate;\n }\n\n /**\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\n * @param comptroller The Unitroller (Comptroller proxy) address.\n * @param rate The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function _setCustomInterestFeeRate(address comptroller, int256 rate) external onlyOwner {\n require(rate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n customInterestFeeRates[comptroller] = rate;\n }\n\n function getComptrollerExtensions(address comptroller) external view returns (DiamondExtension[] memory) {\n return comptrollerExtensions[comptroller];\n }\n\n function _setComptrollerExtensions(address comptroller, DiamondExtension[] calldata extensions) external onlyOwner {\n comptrollerExtensions[comptroller] = extensions;\n }\n\n function _registerComptrollerExtension(\n address payable pool,\n DiamondExtension extensionToAdd,\n DiamondExtension extensionToReplace\n ) external onlyOwner {\n DiamondBase(pool)._registerExtension(extensionToAdd, extensionToReplace);\n }\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (DiamondExtension[] memory) {\n return cErc20DelegateExtensions[cErc20Delegate];\n }\n\n function _setCErc20DelegateExtensions(\n address cErc20Delegate,\n DiamondExtension[] calldata extensions\n ) external onlyOwner {\n cErc20DelegateExtensions[cErc20Delegate] = extensions;\n }\n\n function autoUpgradePool(IonicComptroller pool) external onlyOwner {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n // auto upgrade the pool\n pool._upgrade();\n\n for (uint8 i = 0; i < markets.length; i++) {\n // upgrade the market\n markets[i]._upgrade();\n }\n }\n\n function canCall(address pool, address user, address target, bytes4 functionSig) external view returns (bool) {\n return authoritiesRegistry.canCall(pool, user, target, functionSig);\n }\n}\n" + }, + "contracts/GlobalPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\ninterface IPoolDirectory {\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n function getActivePools() external view returns (uint256, Pool[] memory);\n}\n\ncontract GlobalPauser is Ownable2Step {\n IPoolDirectory public poolDirectory;\n mapping(address => bool) public pauseGuardian;\n\n modifier onlyPauseGuardian() {\n require(pauseGuardian[msg.sender], \"!guardian\");\n _;\n }\n\n constructor(address _poolDirectory) Ownable2Step() {\n poolDirectory = IPoolDirectory(_poolDirectory);\n }\n\n function setPauseGuardian(address _pauseGuardian, bool _isPauseGuardian) external onlyOwner {\n pauseGuardian[_pauseGuardian] = _isPauseGuardian;\n }\n\n function pauseAll() external onlyPauseGuardian {\n (, IPoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n if (!isPaused) {\n IonicComptroller(pools[i].comptroller)._setBorrowPaused(markets[j], true);\n }\n\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n if (!isPaused) {\n IonicComptroller(pools[i].comptroller)._setMintPaused(markets[j], true);\n }\n }\n }\n }\n}\n" + }, + "contracts/IEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IEmissionsManager {\n error InvalidPoolDirectoryAaddress();\n error InvalidProtocolAddress();\n error InvalidRewardTokenAddress();\n error CollateralBasisPointsExceedMaximum();\n error InvalidVeIONAddress();\n error MaximumLimitExceeded();\n\n event Initialized(\n address indexed protocolAddress,\n address indexed rewardToken,\n uint256 collateralBp,\n bytes nonBlacklistableTargetBytecode\n );\n event VeIonSet(address indexed veIon);\n event CollateralBpSet(uint256 collateralBp);\n event NonBlacklistableAddressSet(address indexed user, bool isNonBlacklistable);\n event NonBlacklistableTargetBytecodeSet(bytes newBytecode);\n\n function isUserBlacklisted(address _user) external view returns (bool);\n function isUserBlacklistable(address _user) external view returns (bool);\n}\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\n\ninterface ILiquidator {\n /**\n * borrower The borrower's Ethereum address.\n * repayAmount The amount to repay to liquidate the unhealthy loan.\n * cErc20 The borrowed CErc20 contract to repay.\n * cTokenCollateral The cToken collateral contract to be liquidated.\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\n */\n struct LiquidateToTokensWithFlashSwapVars {\n address borrower;\n uint256 repayAmount;\n ICErc20 cErc20;\n ICErc20 cTokenCollateral;\n address flashSwapContract;\n uint256 minProfitAmount;\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] strategyData;\n IFundsConversionStrategy[] debtFundingStrategies;\n bytes[] debtFundingStrategiesData;\n }\n\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256);\n\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\n external\n returns (uint256);\n\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\n\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\n external;\n\n function setExpressRelay(address _expressRelay) external;\n\n function setPoolLens(address _poolLens) external;\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\n}\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title AddressesProvider\n * @notice The Addresses Provider serves as a central storage of system internal and external\n * contract addresses that change between deploys and across chains\n * @author Veliko Minkov \n */\ncontract AddressesProvider is SafeOwnableUpgradeable {\n mapping(string => address) private _addresses;\n mapping(address => Contract) public plugins;\n mapping(address => Contract) public flywheelRewards;\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\n JarvisPool[] public jarvisPoolsConfig;\n CurveSwapPool[] public curveSwapPoolsConfig;\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\n\n /// @dev Initializer to set the admin that can set and change contracts addresses\n function initialize(address owner) public initializer {\n __SafeOwnable_init(owner);\n }\n\n /**\n * @dev The contract address and a string that uniquely identifies the contract's interface\n */\n struct Contract {\n address addr;\n string contractInterface;\n }\n\n struct RedemptionStrategy {\n address addr;\n string contractInterface;\n address outputToken;\n }\n\n struct FundingStrategy {\n address addr;\n string contractInterface;\n address inputToken;\n }\n\n struct JarvisPool {\n address syntheticToken;\n address collateralToken;\n address liquidityPool;\n uint256 expirationTime;\n }\n\n struct CurveSwapPool {\n address poolAddress;\n address[] coins;\n }\n\n /**\n * @dev sets the address and contract interface ID of the flywheel for the reward token\n * @param rewardToken the reward token address\n * @param flywheelRewardsModule the flywheel rewards module address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFlywheelRewards(\n address rewardToken,\n address flywheelRewardsModule,\n string calldata contractInterface\n ) public onlyOwner {\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\n * @param asset the asset address\n * @param plugin the ERC4626 plugin address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setPlugin(\n address asset,\n address plugin,\n string calldata contractInterface\n ) public onlyOwner {\n plugins[asset] = Contract(plugin, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\n * @param asset the asset address\n * @param strategy redemption strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setRedemptionStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address outputToken\n ) public onlyOwner {\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\n }\n\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\n return redemptionStrategiesConfig[asset];\n }\n\n /**\n * @dev sets the address and contract interface ID of the funding strategy for the asset\n * @param asset the asset address\n * @param strategy funding strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFundingStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address inputToken\n ) public onlyOwner {\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\n }\n\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\n return fundingStrategiesConfig[asset];\n }\n\n /**\n * @dev configures the Jarvis pool of a Jarvis synthetic token\n * @param syntheticToken the synthetic token address\n * @param collateralToken the collateral token address\n * @param liquidityPool the liquidity pool address\n * @param expirationTime the operation expiration time\n */\n function setJarvisPool(\n address syntheticToken,\n address collateralToken,\n address liquidityPool,\n uint256 expirationTime\n ) public onlyOwner {\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\n }\n\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\n }\n\n /**\n * @dev Sets an address for an id replacing the address saved in the addresses map\n * @param id The id\n * @param newAddress The address to set\n */\n function setAddress(string calldata id, address newAddress) external onlyOwner {\n _addresses[id] = newAddress;\n }\n\n /**\n * @dev Returns an address by id\n * @return The address\n */\n function getAddress(string calldata id) public view returns (address) {\n return _addresses[id];\n }\n\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\n return curveSwapPoolsConfig;\n }\n\n function getJarvisPools() public view returns (JarvisPool[] memory) {\n return jarvisPoolsConfig;\n }\n\n function setBalancerPoolForTokens(\n address inputToken,\n address outputToken,\n address pool\n ) external onlyOwner {\n balancerPoolForTokens[inputToken][outputToken] = pool;\n }\n\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\n return balancerPoolForTokens[inputToken][outputToken];\n }\n}\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\n PoolRolesAuthority public poolAuthLogic;\n address public leveredPositionsFactory;\n bool public noAuthRequired;\n\n function initialize(address _leveredPositionsFactory) public initializer {\n __SafeOwnable_init(msg.sender);\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n }\n\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n // for Neon the auth is not required\n noAuthRequired = block.chainid == 245022934;\n }\n\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\n\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\n auth = PoolRolesAuthority(address(proxy));\n auth.initialize(address(this));\n poolsAuthorities[pool] = auth;\n\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\n // sets the registry owner as the auth owner\n reconfigureAuthority(pool);\n }\n\n function reconfigureAuthority(address poolAddress) public {\n IonicComptroller pool = IonicComptroller(poolAddress);\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\n\n if (msg.sender != poolAddress || address(auth) != address(0)) {\n require(address(auth) != address(0), \"no such authority\");\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\n\n auth.configureRegistryCapabilities();\n auth.configurePoolSupplierCapabilities(pool);\n auth.configurePoolBorrowerCapabilities(pool);\n // everyone can be a liquidator\n auth.configureOpenPoolLiquidatorCapabilities(pool);\n auth.configureLeveredPositionCapabilities(pool);\n\n if (auth.owner() != owner()) {\n auth.setOwner(owner());\n }\n }\n }\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool) {\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\n if (address(authorityForPool) == address(0)) {\n return noAuthRequired;\n } else {\n // allow only if an auth exists and it allows the action\n return authorityForPool.canCall(user, target, functionSig);\n }\n }\n\n function setUserRole(\n address pool,\n address user,\n uint8 role,\n bool enabled\n ) external {\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\n\n require(address(poolAuth) != address(0), \"auth does not exist\");\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\n\n poolAuth.setUserRole(user, role, enabled);\n }\n}\n" + }, + "contracts/ionic/CollateralSwap.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\nimport { IFlashLoanReceiver } from \"./IFlashLoanReceiver.sol\";\nimport { Exponential } from \"../compound/Exponential.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\ncontract CollateralSwap is Ownable2Step, Exponential, IFlashLoanReceiver {\n using SafeERC20 for IERC20;\n\n uint256 public feeBps;\n address public feeRecipient;\n IonicComptroller public comptroller;\n mapping(address => bool) public allowedSwapTargets;\n\n error SwapCollateralFailed();\n error TransferFailed(address market, address user, address target);\n error MintFailed(address market, uint256 errorCode);\n error RedeemFailed(address market, uint256 errorCode);\n error InvalidFlashloanCaller(address caller);\n error InvalidSwapTarget(address target);\n\n constructor(\n uint256 _feeBps,\n address _feeRecipient,\n address _comptroller,\n address[] memory _allowedSwapTargets\n ) Ownable2Step() {\n feeBps = _feeBps;\n feeRecipient = _feeRecipient;\n comptroller = IonicComptroller(_comptroller);\n for (uint256 i = 0; i < _allowedSwapTargets.length; i++) {\n allowedSwapTargets[_allowedSwapTargets[i]] = true;\n }\n }\n\n // ADMIN FUNCTIONS\n\n function setFeeBps(uint256 _feeBps) public onlyOwner {\n feeBps = _feeBps;\n }\n\n function setFeeRecipient(address _feeRecipient) public onlyOwner {\n feeRecipient = _feeRecipient;\n }\n\n function setAllowedSwapTarget(address _target, bool _allowed) public onlyOwner {\n allowedSwapTargets[_target] = _allowed;\n }\n\n function sweep(address token) public onlyOwner {\n IERC20(token).safeTransfer(owner(), IERC20(token).balanceOf(address(this)));\n }\n\n // PUBLIC FUNCTIONS\n\n function swapCollateral(\n uint256 amountUnderlying,\n ICErc20 oldCollateralMarket,\n ICErc20 newCollateralMarket,\n address swapTarget,\n bytes calldata swapData\n ) public {\n oldCollateralMarket.flash(\n amountUnderlying,\n abi.encode(msg.sender, oldCollateralMarket, newCollateralMarket, swapTarget, swapData)\n );\n }\n\n function receiveFlashLoan(address borrowedAsset, uint256 borrowedAmount, bytes calldata data) external {\n // make sure the caller is a valid market\n {\n ICErc20[] memory markets = comptroller.getAllMarkets();\n bool isAllowed = false;\n for (uint256 i = 0; i < markets.length; i++) {\n if (msg.sender == address(markets[i])) {\n isAllowed = true;\n break;\n }\n }\n if (!isAllowed) {\n revert InvalidFlashloanCaller(msg.sender);\n }\n }\n\n (\n address borrower,\n ICErc20 oldCollateralMarket,\n ICErc20 newCollateralMarket,\n address swapTarget,\n bytes memory swapData\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes));\n\n // swap the collateral\n {\n if (!allowedSwapTargets[swapTarget]) {\n revert InvalidSwapTarget(swapTarget);\n }\n IERC20(borrowedAsset).approve(swapTarget, borrowedAmount);\n (bool success, ) = swapTarget.call(swapData);\n if (!success) {\n revert SwapCollateralFailed();\n }\n }\n\n // mint the new collateral\n {\n IERC20 newCollateralAsset = IERC20(newCollateralMarket.underlying());\n uint256 outputAmount = newCollateralAsset.balanceOf(address(this));\n uint256 fee = (outputAmount * feeBps) / 10_000;\n outputAmount -= fee;\n if (fee > 0) {\n newCollateralAsset.safeTransfer(feeRecipient, fee);\n }\n newCollateralAsset.approve(address(newCollateralMarket), outputAmount);\n uint256 mintResult = newCollateralMarket.mint(outputAmount);\n if (mintResult != 0) {\n revert MintFailed(address(newCollateralMarket), mintResult);\n }\n }\n\n // transfer the new collateral to the borrower\n {\n uint256 cTokenBalance = IERC20(address(newCollateralMarket)).balanceOf(address(this));\n IERC20(address(newCollateralMarket)).safeTransfer(borrower, cTokenBalance);\n }\n\n // withdraw the old collateral\n {\n (MathError mErr, uint256 amountCTokensToSwap) = divScalarByExpTruncate(\n borrowedAmount,\n Exp({ mantissa: oldCollateralMarket.exchangeRateCurrent() })\n );\n require(mErr == MathError.NO_ERROR, \"exchange rate error\");\n bool transferStatus = oldCollateralMarket.transferFrom(borrower, address(this), amountCTokensToSwap + 1);\n if (!transferStatus) {\n revert TransferFailed(address(oldCollateralMarket), borrower, address(this));\n }\n uint256 redeemResult = oldCollateralMarket.redeemUnderlying(type(uint256).max);\n if (redeemResult != 0) {\n revert RedeemFailed(address(oldCollateralMarket), redeemResult);\n }\n IERC20(borrowedAsset).approve(address(oldCollateralMarket), borrowedAmount);\n }\n // flashloan gets paid back from redeemed collateral\n }\n}\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @notice a base contract for logic extensions that use the diamond pattern storage\n * to map the functions when looking up the extension contract to delegate to.\n */\nabstract contract DiamondExtension {\n /**\n * @return a list of all the function selectors that this logic extension exposes\n */\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\n}\n\n// When no function exists for function called\nerror FunctionNotFound(bytes4 _functionSelector);\n\n// When no extension exists for function called\nerror ExtensionNotFound(bytes4 _functionSelector);\n\n// When the function is already added\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\n\nabstract contract DiamondBase {\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\n\n function _listExtensions() public view returns (address[] memory) {\n return LibDiamond.listExtensions();\n }\n\n fallback() external {\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n\n/**\n * @notice a library to use in a contract, whose logic is extended with diamond extension\n */\nlibrary LibDiamond {\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\n\n struct Function {\n address extension;\n bytes4 selector;\n }\n\n struct LogicStorage {\n Function[] functions;\n address[] extensions;\n }\n\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\n return getExtensionForSelector(msgSig, diamondStorage());\n }\n\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n assembly {\n ds.slot := position\n }\n }\n\n function listExtensions() internal view returns (address[] memory) {\n return diamondStorage().extensions;\n }\n\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\n if (address(extensionToReplace) != address(0)) {\n removeExtension(extensionToReplace);\n }\n addExtension(extensionToAdd);\n }\n\n function removeExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n // remove all functions of the extension to replace\n removeExtensionFunctions(extension);\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n if (ds.extensions[i] == address(extension)) {\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\n ds.extensions.pop();\n }\n }\n }\n\n function addExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n require(ds.extensions[i] != address(extension), \"extension already added\");\n }\n addExtensionFunctions(extension);\n ds.extensions.push(address(extension));\n }\n\n function removeExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\n bytes4 selectorToRemove = fnsToRemove[i];\n // must never fail\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\n // swap with the last element in the selectorAtIndex array and remove the last element\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\n ds.functions.pop();\n }\n }\n\n function addExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n uint16 functionsCount = uint16(ds.functions.length);\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\n bytes4 selector = fnsToAdd[functionsIndex];\n address oldImplementation = getExtensionForSelector(selector, ds);\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\n ds.functions.push(Function(address(extension), selector));\n functionsCount++;\n }\n }\n\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\n uint256 fnsLen = ds.functions.length;\n for (uint256 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\n }\n\n return address(0);\n }\n\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\n uint16 fnsLen = uint16(ds.functions.length);\n for (uint16 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return i;\n }\n\n return type(uint16).max;\n }\n}\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ninterface IFlashLoanReceiver {\n function receiveFlashLoan(\n address borrowedAsset,\n uint256 borrowedAmount,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/ionic/levered/ILeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ILeveredPositionFactoryStorage {\n function feeDistributor() external view returns (IFeeDistributor);\n\n function liquidatorsRegistry() external view returns (ILiquidatorsRegistry);\n\n function blocksPerYear() external view returns (uint256);\n\n function owner() external view returns (address);\n}\n\ninterface ILeveredPositionFactoryBase {\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external;\n\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external;\n}\n\ninterface ILeveredPositionFactoryFirstExtension {\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\n\n function getMinBorrowNative() external view returns (uint256);\n\n function removeClosedPosition(address closedPosition) external returns (bool removed);\n\n function closeAndRemoveUserPosition(LeveredPosition position) external returns (bool);\n\n function getPositionsByAccount(address account) external view returns (address[] memory, bool[] memory);\n\n function getAccountsWithOpenPositions() external view returns (address[] memory);\n\n function getWhitelistedCollateralMarkets() external view returns (address[] memory);\n\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory);\n\n function getPositionsExtension(bytes4 msgSig) external view returns (address);\n\n function _setPositionsExtension(bytes4 msgSig, address extension) external;\n}\n\ninterface ILeveredPositionFactorySecondExtension {\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) external returns (LeveredPosition);\n\n function createAndFundPosition(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount\n ) external returns (LeveredPosition);\n\n function createAndFundPositionAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount,\n uint256 _leverageRatio\n ) external returns (LeveredPosition);\n}\n\ninterface ILeveredPositionFactoryExtension is\n ILeveredPositionFactoryFirstExtension,\n ILeveredPositionFactorySecondExtension\n{}\n\ninterface ILeveredPositionFactory is\n ILeveredPositionFactoryStorage,\n ILeveredPositionFactoryBase,\n ILeveredPositionFactoryExtension\n{}\n" + }, + "contracts/ionic/levered/LeveredPosition.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { IFlashLoanReceiver } from \"../IFlashLoanReceiver.sol\";\nimport { IonicFlywheel } from \"../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { LeveredPositionStorage } from \"./LeveredPositionStorage.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFlywheelLensRouter_LP {\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\n}\n\ncontract LeveredPosition is LeveredPositionStorage, IFlashLoanReceiver {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n error OnlyWhenClosed();\n error NotPositionOwner();\n error OnlyFactoryOwner();\n error AssetNotRescuable();\n error RepayFlashLoanFailed(address asset, uint256 currentBalance, uint256 repayAmount);\n\n error ConvertFundsFailed();\n error ExitFailed(uint256 errorCode);\n error RedeemFailed(uint256 errorCode);\n error SupplyCollateralFailed(uint256 errorCode);\n error BorrowStableFailed(uint256 errorCode);\n error RepayBorrowFailed(uint256 errorCode);\n error RedeemCollateralFailed(uint256 errorCode);\n error ExtNotFound(bytes4 _functionSelector);\n\n constructor(\n address _positionOwner,\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket\n ) LeveredPositionStorage(_positionOwner) {\n IonicComptroller collateralPool = _collateralMarket.comptroller();\n IonicComptroller stablePool = _stableMarket.comptroller();\n require(collateralPool == stablePool, \"markets pools differ\");\n pool = collateralPool;\n\n collateralMarket = _collateralMarket;\n collateralAsset = IERC20Upgradeable(_collateralMarket.underlying());\n stableMarket = _stableMarket;\n stableAsset = IERC20Upgradeable(_stableMarket.underlying());\n\n factory = ILeveredPositionFactory(msg.sender);\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n function fundPosition(IERC20Upgradeable fundingAsset, uint256 amount) public {\n fundingAsset.safeTransferFrom(msg.sender, address(this), amount);\n _supplyCollateral(fundingAsset);\n\n if (!pool.checkMembership(address(this), collateralMarket)) {\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(collateralMarket);\n pool.enterMarkets(cTokens);\n }\n }\n\n function closePosition() public returns (uint256) {\n return closePosition(msg.sender);\n }\n\n function closePosition(address withdrawTo) public returns (uint256 withdrawAmount) {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n _leverDown(1e18);\n\n // calling accrue and exit allows to redeem the full underlying balance\n collateralMarket.accrueInterest();\n uint256 errorCode = pool.exitMarket(address(collateralMarket));\n if (errorCode != 0) revert ExitFailed(errorCode);\n\n // redeem all cTokens should leave no dust\n errorCode = collateralMarket.redeem(collateralMarket.balanceOf(address(this)));\n if (errorCode != 0) revert RedeemFailed(errorCode);\n\n if (stableAsset.balanceOf(address(this)) > 0) {\n // convert all overborrowed leftovers/profits to the collateral asset\n convertAllTo(stableAsset, collateralAsset);\n }\n\n // withdraw the redeemed collateral\n withdrawAmount = collateralAsset.balanceOf(address(this));\n collateralAsset.safeTransfer(withdrawTo, withdrawAmount);\n }\n\n function adjustLeverageRatio(uint256 targetRatioMantissa) public returns (uint256) {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n // anything under 1x means removing the leverage\n if (targetRatioMantissa <= 1e18) _leverDown(1e18);\n\n if (getCurrentLeverageRatio() < targetRatioMantissa) _leverUp(targetRatioMantissa);\n else _leverDown(targetRatioMantissa);\n\n // return the de facto achieved ratio\n return getCurrentLeverageRatio();\n }\n\n function receiveFlashLoan(address assetAddress, uint256 borrowedAmount, bytes calldata data) external override {\n if (msg.sender == address(collateralMarket)) {\n // increasing the leverage ratio\n uint256 stableBorrowAmount = abi.decode(data, (uint256));\n _leverUpPostFL(stableBorrowAmount);\n uint256 positionCollateralBalance = collateralAsset.balanceOf(address(this));\n if (positionCollateralBalance < borrowedAmount)\n revert RepayFlashLoanFailed(address(collateralAsset), positionCollateralBalance, borrowedAmount);\n } else if (msg.sender == address(stableMarket)) {\n // decreasing the leverage ratio\n uint256 amountToRedeem = abi.decode(data, (uint256));\n _leverDownPostFL(borrowedAmount, amountToRedeem);\n uint256 positionStableBalance = stableAsset.balanceOf(address(this));\n if (positionStableBalance < borrowedAmount)\n revert RepayFlashLoanFailed(address(stableAsset), positionStableBalance, borrowedAmount);\n } else {\n revert(\"!fl not from either markets\");\n }\n\n // repay FL\n IERC20Upgradeable(assetAddress).approve(msg.sender, borrowedAmount);\n }\n\n function withdrawStableLeftovers(address withdrawTo) public returns (uint256) {\n if (msg.sender != positionOwner) revert NotPositionOwner();\n if (!isPositionClosed()) revert OnlyWhenClosed();\n\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\n stableAsset.safeTransfer(withdrawTo, stableLeftovers);\n return stableLeftovers;\n }\n\n function claimRewards() public {\n claimRewards(msg.sender);\n }\n\n function claimRewards(address withdrawTo) public {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n address[] memory flywheels = pool.getRewardsDistributors();\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\n fw.accrue(ERC20(address(collateralMarket)), address(this));\n fw.accrue(ERC20(address(stableMarket)), address(this));\n fw.claimRewards(address(this));\n ERC20 rewardToken = fw.rewardToken();\n uint256 rewardsAccrued = rewardToken.balanceOf(address(this));\n if (rewardsAccrued > 0) {\n rewardToken.transfer(withdrawTo, rewardsAccrued);\n }\n }\n }\n\n function rescueTokens(IERC20Upgradeable asset) external {\n if (msg.sender != factory.owner()) revert OnlyFactoryOwner();\n if (asset == stableAsset || asset == collateralAsset) revert AssetNotRescuable();\n\n asset.transfer(positionOwner, asset.balanceOf(address(this)));\n }\n\n function claimRewardsFromRouter(address _flr) external returns (address[] memory, uint256[] memory) {\n IFlywheelLensRouter_LP flr = IFlywheelLensRouter_LP(_flr);\n (address[] memory rewardTokens, uint256[] memory rewards) = flr.claimAllRewardTokens(address(this));\n for (uint256 i = 0; i < rewardTokens.length; i++) {\n IERC20Upgradeable(rewardTokens[i]).safeTransfer(positionOwner, rewards[i]);\n }\n return (rewardTokens, rewards);\n }\n\n fallback() external {\n address extension = factory.getPositionsExtension(msg.sig);\n if (extension == address(0)) revert ExtNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n function getAccruedRewards()\n external\n returns (\n /*view*/\n ERC20[] memory rewardTokens,\n uint256[] memory amounts\n )\n {\n address[] memory flywheels = pool.getRewardsDistributors();\n\n rewardTokens = new ERC20[](flywheels.length);\n amounts = new uint256[](flywheels.length);\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\n fw.accrue(ERC20(address(collateralMarket)), address(this));\n fw.accrue(ERC20(address(stableMarket)), address(this));\n rewardTokens[i] = fw.rewardToken();\n amounts[i] = fw.rewardsAccrued(address(this));\n }\n }\n\n function getCurrentLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n BasePriceOracle oracle = pool.oracle();\n\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\n\n uint256 debtValue = 0;\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n if (debtAmount > 0) {\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\n }\n\n // TODO check if positionValue > debtValue\n // s / ( s - b )\n return (positionValue * 1e18) / (positionValue - debtValue);\n }\n\n function getMinLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n BasePriceOracle oracle = pool.oracle();\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 minStableBorrowAmount = (factory.getMinBorrowNative() * 1e18) / borrowedAssetPrice;\n return _getLeverageRatioAfterBorrow(minStableBorrowAmount, positionSupplyAmount, 0);\n }\n\n function getMaxLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n uint256 maxBorrow = pool.getMaxRedeemOrBorrow(address(this), stableMarket, true);\n uint256 positionBorrowAmount = stableMarket.borrowBalanceCurrent(address(this));\n return _getLeverageRatioAfterBorrow(maxBorrow, positionSupplyAmount, positionBorrowAmount);\n }\n\n function _getLeverageRatioAfterBorrow(\n uint256 newBorrowsAmount,\n uint256 positionSupplyAmount,\n uint256 positionBorrowAmount\n ) internal view returns (uint256 r) {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n uint256 currentBorrowsValue = (positionBorrowAmount * stableAssetPrice) / 1e18;\n uint256 newBorrowsValue = (newBorrowsAmount * stableAssetPrice) / 1e18;\n uint256 positionValue = (positionSupplyAmount * collateralAssetPrice) / 1e18;\n\n // accounting for swaps slippage\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\n {\n // add 10 bps just to not go under the min borrow value\n assumedSlippage += 10;\n }\n uint256 topUpCollateralValue = (newBorrowsValue * 10000) / (10000 + assumedSlippage);\n\n int256 s = int256(positionValue);\n int256 b = int256(currentBorrowsValue);\n int256 x = int256(topUpCollateralValue);\n\n r = uint256(((s + x) * 1e18) / (s + x - b - int256(newBorrowsValue)));\n }\n\n function isPositionClosed() public view returns (bool) {\n return collateralMarket.balanceOfUnderlying(address(this)) == 0;\n }\n\n function getEquityAmount() external view returns (uint256 equityAmount) {\n BasePriceOracle oracle = pool.oracle();\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\n\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n uint256 debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\n\n uint256 equityValue = positionValue - debtValue;\n equityAmount = (equityValue * 1e18) / collateralAssetPrice;\n }\n\n function getSupplyAmountDelta(uint256 targetRatio) public view returns (uint256, uint256) {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n uint256 currentRatio = getCurrentLeverageRatio();\n bool up = targetRatio > currentRatio;\n return _getSupplyAmountDelta(up, targetRatio, collateralAssetPrice, stableAssetPrice);\n }\n\n function _getSupplyAmountDelta(\n bool up,\n uint256 targetRatio,\n uint256 collateralAssetPrice,\n uint256 borrowedAssetPrice\n ) internal view returns (uint256 supplyDelta, uint256 borrowsDelta) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n uint256 assumedSlippage;\n if (up) assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\n else assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\n uint256 slippageFactor = (1e18 * (10000 + assumedSlippage)) / 10000;\n\n uint256 supplyValueDeltaAbs;\n {\n // s = supply value before\n // b = borrow value before\n // r = target ratio after\n // c = borrow value coefficient to account for the slippage\n int256 s = int256((collateralAssetPrice * positionSupplyAmount) / 1e18);\n int256 b = int256((borrowedAssetPrice * debtAmount) / 1e18);\n int256 r = int256(targetRatio);\n int256 r1 = r - 1e18;\n int256 c = int256(slippageFactor);\n\n // some math magic here\n // https://www.wolframalpha.com/input?i2d=true&i=r%3D%5C%2840%29Divide%5B%5C%2840%29s%2Bx%5C%2841%29%2C%5C%2840%29s%2Bx-b-c*x%5C%2841%29%5D+%5C%2841%29+solve+for+x\n\n // x = supplyValueDelta\n int256 supplyValueDelta = (((r1 * s) - (b * r)) * 1e18) / ((c * r) - (1e18 * r1));\n supplyValueDeltaAbs = uint256((supplyValueDelta < 0) ? -supplyValueDelta : supplyValueDelta);\n }\n\n supplyDelta = (supplyValueDeltaAbs * 1e18) / collateralAssetPrice;\n borrowsDelta = (supplyValueDeltaAbs * 1e18) / borrowedAssetPrice;\n\n if (up) {\n // stables to borrow = c * x\n borrowsDelta = (borrowsDelta * slippageFactor) / 1e18;\n } else {\n // amount to redeem = c * x\n supplyDelta = (supplyDelta * slippageFactor) / 1e18;\n }\n }\n\n /*----------------------------------------------------------------\n Internal Functions\n ----------------------------------------------------------------*/\n\n function _supplyCollateral(IERC20Upgradeable fundingAsset) internal returns (uint256 amountToSupply) {\n // in case the funding is with a different asset\n if (address(collateralAsset) != address(fundingAsset)) {\n // swap for collateral asset\n convertAllTo(fundingAsset, collateralAsset);\n }\n\n // supply the collateral\n amountToSupply = collateralAsset.balanceOf(address(this));\n collateralAsset.approve(address(collateralMarket), amountToSupply);\n uint256 errorCode = collateralMarket.mint(amountToSupply);\n if (errorCode != 0) revert SupplyCollateralFailed(errorCode);\n }\n\n // @dev flash loan the needed amount, then borrow stables and swap them for the amount needed to repay the FL\n function _leverUp(uint256 targetRatio) internal {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n (uint256 flashLoanCollateralAmount, uint256 stableToBorrow) = _getSupplyAmountDelta(\n true,\n targetRatio,\n collateralAssetPrice,\n stableAssetPrice\n );\n\n collateralMarket.flash(flashLoanCollateralAmount, abi.encode(stableToBorrow));\n // the execution will first receive a callback to receiveFlashLoan()\n // then it continues from here\n\n // all stables are swapped for collateral to repay the FL\n uint256 collateralLeftovers = collateralAsset.balanceOf(address(this));\n if (collateralLeftovers > 0) {\n collateralAsset.approve(address(collateralMarket), collateralLeftovers);\n collateralMarket.mint(collateralLeftovers);\n }\n }\n\n // @dev supply the flash loaned collateral and then borrow stables with it\n function _leverUpPostFL(uint256 stableToBorrow) internal {\n // supply the flash loaned collateral\n _supplyCollateral(collateralAsset);\n\n // borrow stables that will be swapped to repay the FL\n uint256 errorCode = stableMarket.borrow(stableToBorrow);\n if (errorCode != 0) revert BorrowStableFailed(errorCode);\n\n // swap for the FL asset\n convertAllTo(stableAsset, collateralAsset);\n }\n\n // @dev redeems the supplied collateral by first repaying the debt with which it was levered\n function _leverDown(uint256 targetRatio) internal {\n uint256 amountToRedeem;\n uint256 borrowsToRepay;\n\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n if (targetRatio <= 1e18) {\n // if max levering down, then derive the amount to redeem from the debt to be repaid\n borrowsToRepay = stableMarket.borrowBalanceCurrent(address(this));\n uint256 borrowsToRepayValueScaled = borrowsToRepay * stableAssetPrice;\n // accounting for swaps slippage\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\n uint256 amountToRedeemValueScaled = (borrowsToRepayValueScaled * (10000 + assumedSlippage)) / 10000;\n amountToRedeem = amountToRedeemValueScaled / collateralAssetPrice;\n // round up when dividing in order to redeem enough (otherwise calcs could be exploited)\n if (amountToRedeemValueScaled % collateralAssetPrice > 0) amountToRedeem += 1;\n } else {\n // else derive the debt to be repaid from the amount to redeem\n (amountToRedeem, borrowsToRepay) = _getSupplyAmountDelta(\n false,\n targetRatio,\n collateralAssetPrice,\n stableAssetPrice\n );\n // the slippage is already accounted for in _getSupplyAmountDelta\n }\n\n if (borrowsToRepay > 0) {\n ICErc20(address(stableMarket)).flash(borrowsToRepay, abi.encode(amountToRedeem));\n // the execution will first receive a callback to receiveFlashLoan()\n // then it continues from here\n }\n\n // all the redeemed collateral is swapped for stables to repay the FL\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\n if (stableLeftovers > 0) {\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\n if (borrowBalance > 0) {\n // whatever is smaller\n uint256 amountToRepay = borrowBalance > stableLeftovers ? stableLeftovers : borrowBalance;\n stableAsset.approve(address(stableMarket), amountToRepay);\n stableMarket.repayBorrow(amountToRepay);\n }\n }\n }\n\n function _leverDownPostFL(uint256 _flashLoanedCollateral, uint256 _amountToRedeem) internal {\n // repay the borrows\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\n uint256 repayAmount = _flashLoanedCollateral < borrowBalance ? _flashLoanedCollateral : borrowBalance;\n stableAsset.approve(address(stableMarket), repayAmount);\n uint256 errorCode = stableMarket.repayBorrow(repayAmount);\n if (errorCode != 0) revert RepayBorrowFailed(errorCode);\n\n // redeem the corresponding amount needed to repay the FL\n errorCode = collateralMarket.redeemUnderlying(_amountToRedeem);\n if (errorCode != 0) revert RedeemCollateralFailed(errorCode);\n\n // swap for the FL asset\n convertAllTo(collateralAsset, stableAsset);\n }\n\n function convertAllTo(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) private returns (uint256 outputAmount) {\n uint256 inputAmount = inputToken.balanceOf(address(this));\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = factory\n .getRedemptionStrategies(inputToken, outputToken);\n\n if (redemptionStrategies.length == 0) revert ConvertFundsFailed();\n\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\n bytes memory strategyData = strategiesData[i];\n (outputToken, outputAmount) = convertCustomFunds(inputToken, inputAmount, redemptionStrategy, strategyData);\n inputAmount = outputAmount;\n inputToken = outputToken;\n }\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { DiamondBase, DiamondExtension, LibDiamond } from \"../../ionic/DiamondExtension.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactory is LeveredPositionFactoryStorage, DiamondBase {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /*----------------------------------------------------------------\n Constructor\n ----------------------------------------------------------------*/\n\n constructor(IFeeDistributor _feeDistributor, ILiquidatorsRegistry _registry, uint256 _blocksPerYear) {\n feeDistributor = _feeDistributor;\n liquidatorsRegistry = _registry;\n blocksPerYear = _blocksPerYear;\n }\n\n /*----------------------------------------------------------------\n Admin Functions\n ----------------------------------------------------------------*/\n\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external onlyOwner {\n require(_collateralMarket.comptroller() == _stableMarket.comptroller(), \"markets not of the same pool\");\n\n if (_whitelisted) {\n collateralMarkets.add(address(_collateralMarket));\n borrowableMarketsByCollateral[_collateralMarket].add(address(_stableMarket));\n } else {\n borrowableMarketsByCollateral[_collateralMarket].remove(address(_stableMarket));\n if (borrowableMarketsByCollateral[_collateralMarket].length() == 0)\n collateralMarkets.remove(address(_collateralMarket));\n }\n }\n\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external onlyOwner {\n liquidatorsRegistry = _liquidatorsRegistry;\n }\n\n function _registerExtension(\n DiamondExtension extensionToAdd,\n DiamondExtension extensionToReplace\n ) public override onlyOwner {\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryFirstExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { ILeveredPositionFactoryFirstExtension } from \"./ILeveredPositionFactory.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactoryFirstExtension is\n LeveredPositionFactoryStorage,\n DiamondExtension,\n ILeveredPositionFactoryFirstExtension\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n error PairNotWhitelisted();\n error NoSuchPosition();\n error PositionNotClosed();\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 10;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.removeClosedPosition.selector;\n functionSelectors[--fnsCount] = this.closeAndRemoveUserPosition.selector;\n functionSelectors[--fnsCount] = this.getMinBorrowNative.selector;\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.getBorrowableMarketsByCollateral.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedCollateralMarkets.selector;\n functionSelectors[--fnsCount] = this.getAccountsWithOpenPositions.selector;\n functionSelectors[--fnsCount] = this.getPositionsByAccount.selector;\n functionSelectors[--fnsCount] = this.getPositionsExtension.selector;\n functionSelectors[--fnsCount] = this._setPositionsExtension.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n // @return true if removed, otherwise false\n function removeClosedPosition(address closedPosition) external returns (bool) {\n return _removeClosedPosition(closedPosition, msg.sender);\n }\n\n function closeAndRemoveUserPosition(LeveredPosition position) external onlyOwner returns (bool) {\n address positionOwner = position.positionOwner();\n position.closePosition(positionOwner);\n return _removeClosedPosition(address(position), positionOwner);\n }\n\n function _removeClosedPosition(address closedPosition, address positionOwner) internal returns (bool removed) {\n EnumerableSet.AddressSet storage userPositions = positionsByAccount[positionOwner];\n if (!userPositions.contains(closedPosition)) revert NoSuchPosition();\n if (!LeveredPosition(closedPosition).isPositionClosed()) revert PositionNotClosed();\n\n removed = userPositions.remove(closedPosition);\n if (userPositions.length() == 0) accountsWithOpenPositions.remove(positionOwner);\n }\n\n function _setPositionsExtension(bytes4 msgSig, address extension) external onlyOwner {\n _positionsExtensions[msgSig] = extension;\n }\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n\n function getMinBorrowNative() external view returns (uint256) {\n return feeDistributor.minBorrowEth();\n }\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\n return liquidatorsRegistry.getRedemptionStrategies(inputToken, outputToken);\n }\n\n function getPositionsByAccount(\n address account\n ) external view returns (address[] memory positions, bool[] memory closed) {\n positions = positionsByAccount[account].values();\n closed = new bool[](positions.length);\n for (uint256 i = 0; i < positions.length; i++) {\n closed[i] = LeveredPosition(positions[i]).isPositionClosed();\n }\n }\n\n function getAccountsWithOpenPositions() external view returns (address[] memory) {\n return accountsWithOpenPositions.values();\n }\n\n function getWhitelistedCollateralMarkets() external view returns (address[] memory) {\n return collateralMarkets.values();\n }\n\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory) {\n return borrowableMarketsByCollateral[_collateralMarket].values();\n }\n\n function getPositionsExtension(bytes4 msgSig) external view returns (address) {\n return _positionsExtensions[msgSig];\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactorySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { ILeveredPositionFactorySecondExtension } from \"./ILeveredPositionFactory.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactorySecondExtension is\n LeveredPositionFactoryStorage,\n DiamondExtension,\n ILeveredPositionFactorySecondExtension\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n error PairNotWhitelisted();\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 3;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.createPosition.selector;\n functionSelectors[--fnsCount] = this.createAndFundPosition.selector;\n functionSelectors[--fnsCount] = this.createAndFundPositionAtRatio.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) public returns (LeveredPosition) {\n if (!borrowableMarketsByCollateral[_collateralMarket].contains(address(_stableMarket))) revert PairNotWhitelisted();\n\n LeveredPosition position = new LeveredPosition(msg.sender, _collateralMarket, _stableMarket);\n\n accountsWithOpenPositions.add(msg.sender);\n positionsByAccount[msg.sender].add(address(position));\n\n AuthoritiesRegistry authoritiesRegistry = feeDistributor.authoritiesRegistry();\n address poolAddress = address(_collateralMarket.comptroller());\n PoolRolesAuthority poolAuth = authoritiesRegistry.poolsAuthorities(poolAddress);\n if (address(poolAuth) != address(0)) {\n authoritiesRegistry.setUserRole(poolAddress, address(position), poolAuth.LEVERED_POSITION_ROLE(), true);\n }\n\n return position;\n }\n\n function createAndFundPosition(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount\n ) public returns (LeveredPosition) {\n LeveredPosition position = createPosition(_collateralMarket, _stableMarket);\n _fundingAsset.safeTransferFrom(msg.sender, address(this), _fundingAmount);\n _fundingAsset.approve(address(position), _fundingAmount);\n position.fundPosition(_fundingAsset, _fundingAmount);\n return position;\n }\n\n function createAndFundPositionAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount,\n uint256 _leverageRatio\n ) external returns (LeveredPosition) {\n LeveredPosition position = createAndFundPosition(_collateralMarket, _stableMarket, _fundingAsset, _fundingAmount);\n if (_leverageRatio > 1e18) {\n position.adjustLeverageRatio(_leverageRatio);\n }\n return position;\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nabstract contract LeveredPositionFactoryStorage is SafeOwnable {\n EnumerableSet.AddressSet internal accountsWithOpenPositions;\n mapping(address => EnumerableSet.AddressSet) internal positionsByAccount;\n EnumerableSet.AddressSet internal collateralMarkets;\n mapping(ICErc20 => EnumerableSet.AddressSet) internal borrowableMarketsByCollateral;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) private __unused;\n\n IFeeDistributor public feeDistributor;\n ILiquidatorsRegistry public liquidatorsRegistry;\n uint256 public blocksPerYear;\n\n mapping(bytes4 => address) internal _positionsExtensions;\n}\n" + }, + "contracts/ionic/levered/LeveredPositionsLens.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\ncontract LeveredPositionsLens is Initializable {\n ILeveredPositionFactory public factory;\n\n function initialize(ILeveredPositionFactory _factory) external initializer {\n factory = _factory;\n }\n\n function reinitialize(ILeveredPositionFactory _factory) external reinitializer(2) {\n factory = _factory;\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns lists of the market addresses, names and symbols of the underlying assets of those collateral markets that are whitelisted\n function getCollateralMarkets()\n external\n view\n returns (\n address[] memory markets,\n IonicComptroller[] memory poolOfMarket,\n address[] memory underlyings,\n uint256[] memory underlyingPrices,\n string[] memory names,\n string[] memory symbols,\n uint8[] memory decimals,\n uint256[] memory totalUnderlyingSupplied,\n uint256[] memory ratesPerBlock\n )\n {\n markets = factory.getWhitelistedCollateralMarkets();\n poolOfMarket = new IonicComptroller[](markets.length);\n underlyings = new address[](markets.length);\n underlyingPrices = new uint256[](markets.length);\n names = new string[](markets.length);\n symbols = new string[](markets.length);\n totalUnderlyingSupplied = new uint256[](markets.length);\n decimals = new uint8[](markets.length);\n ratesPerBlock = new uint256[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = ICErc20(markets[i]);\n poolOfMarket[i] = market.comptroller();\n underlyingPrices[i] = BasePriceOracle(poolOfMarket[i].oracle()).getUnderlyingPrice(market);\n underlyings[i] = market.underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyings[i]);\n names[i] = underlying.name();\n symbols[i] = underlying.symbol();\n decimals[i] = underlying.decimals();\n totalUnderlyingSupplied[i] = market.getTotalUnderlyingSupplied();\n ratesPerBlock[i] = market.supplyRatePerBlock();\n }\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns the Rate for the chosen borrowable at the specified leverage ratio and supply amount\n function getBorrowRateAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n uint256 _equityAmount,\n uint256 _targetLeverageRatio\n ) external view returns (uint256) {\n IonicComptroller pool = IonicComptroller(_stableMarket.comptroller());\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(_stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\n\n uint256 borrowAmount = ((_targetLeverageRatio - 1e18) * _equityAmount * collateralAssetPrice) /\n (stableAssetPrice * 1e18);\n return _stableMarket.borrowRatePerBlockAfterBorrow(borrowAmount) * factory.blocksPerYear();\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns lists of the market addresses, names, symbols and the current Rate for each Borrowable asset\n function getBorrowableMarketsAndRates(\n ICErc20 _collateralMarket\n )\n external\n view\n returns (\n address[] memory markets,\n address[] memory underlyings,\n uint256[] memory underlyingsPrices,\n string[] memory names,\n string[] memory symbols,\n uint256[] memory rates,\n uint8[] memory decimals\n )\n {\n markets = factory.getBorrowableMarketsByCollateral(_collateralMarket);\n underlyings = new address[](markets.length);\n names = new string[](markets.length);\n symbols = new string[](markets.length);\n rates = new uint256[](markets.length);\n decimals = new uint8[](markets.length);\n underlyingsPrices = new uint256[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = ICErc20(markets[i]);\n address underlyingAddress = market.underlying();\n underlyings[i] = underlyingAddress;\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyingAddress);\n names[i] = underlying.name();\n symbols[i] = underlying.symbol();\n rates[i] = market.borrowRatePerBlock();\n decimals[i] = underlying.decimals();\n underlyingsPrices[i] = market.comptroller().oracle().getUnderlyingPrice(market);\n }\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n function getNetAPY(\n uint256 _supplyAPY,\n uint256 _supplyAmount,\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n uint256 _targetLeverageRatio\n ) public view returns (int256 netAPY) {\n if (_supplyAmount == 0 || _targetLeverageRatio <= 1e18) return 0;\n\n IonicComptroller pool = IonicComptroller(_collateralMarket.comptroller());\n BasePriceOracle oracle = pool.oracle();\n // TODO the calcs can be implemented without using collateralAssetPrice\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\n\n // total collateral = base collateral + levered collateral\n uint256 totalCollateral = (_supplyAmount * _targetLeverageRatio) / 1e18;\n uint256 yieldFromTotalSupplyScaled = _supplyAPY * totalCollateral;\n int256 yieldValueScaled = int256((yieldFromTotalSupplyScaled * collateralAssetPrice) / 1e18);\n\n uint256 borrowedValueScaled = (totalCollateral - _supplyAmount) * collateralAssetPrice;\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\n int256 borrowInterestValueScaled = int256((_borrowRate * borrowedValueScaled) / 1e18);\n\n int256 netValueDiffScaled = yieldValueScaled - borrowInterestValueScaled;\n\n netAPY = ((netValueDiffScaled / int256(collateralAssetPrice)) * 1e18) / int256(_supplyAmount);\n }\n\n function getPositionsInfo(\n LeveredPosition[] calldata positions,\n uint256[] calldata supplyApys\n ) external view returns (PositionInfo[] memory infos) {\n infos = new PositionInfo[](positions.length);\n for (uint256 i = 0; i < positions.length; i++) {\n infos[i] = getPositionInfo(positions[i], supplyApys[i]);\n }\n }\n\n function getLeverageRatioAfterFunding(LeveredPosition pos, uint256 newFunding) public view returns (uint256) {\n uint256 equityAmount = pos.getEquityAmount();\n if (equityAmount == 0 && newFunding == 0) return 0;\n\n uint256 suppliedCollateralCurrent = pos.collateralMarket().balanceOfUnderlying(address(pos));\n return ((suppliedCollateralCurrent + newFunding) * 1e18) / (equityAmount + newFunding);\n }\n\n function getNetApyForPositionAfterFunding(\n LeveredPosition pos,\n uint256 supplyAPY,\n uint256 newFunding\n ) public view returns (int256) {\n return\n getNetAPY(\n supplyAPY,\n pos.getEquityAmount() + newFunding,\n pos.collateralMarket(),\n pos.stableMarket(),\n getLeverageRatioAfterFunding(pos, newFunding)\n );\n }\n\n function getNetApyForPosition(LeveredPosition pos, uint256 supplyAPY) public view returns (int256) {\n return getNetApyForPositionAfterFunding(pos, supplyAPY, 0);\n }\n\n struct PositionInfo {\n uint256 collateralAssetPrice;\n uint256 borrowedAssetPrice;\n uint256 positionSupplyAmount;\n uint256 positionValue;\n uint256 debtAmount;\n uint256 debtValue;\n uint256 equityAmount;\n uint256 equityValue;\n int256 currentApy;\n uint256 debtRatio;\n uint256 liquidationThreshold;\n uint256 safetyBuffer;\n }\n\n function getPositionInfo(LeveredPosition pos, uint256 supplyApy) public view returns (PositionInfo memory info) {\n ICErc20 collateralMarket = pos.collateralMarket();\n IonicComptroller pool = pos.pool();\n info.collateralAssetPrice = pool.oracle().getUnderlyingPrice(collateralMarket);\n {\n info.positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(pos));\n info.positionValue = (info.collateralAssetPrice * info.positionSupplyAmount) / 1e18;\n info.currentApy = getNetApyForPosition(pos, supplyApy);\n }\n\n {\n ICErc20 stableMarket = pos.stableMarket();\n info.borrowedAssetPrice = pool.oracle().getUnderlyingPrice(stableMarket);\n info.debtAmount = stableMarket.borrowBalanceCurrent(address(pos));\n info.debtValue = (info.borrowedAssetPrice * info.debtAmount) / 1e18;\n info.equityValue = info.positionValue - info.debtValue;\n info.debtRatio = info.positionValue == 0 ? 0 : (info.debtValue * 1e18) / info.positionValue;\n info.equityAmount = (info.equityValue * 1e18) / info.collateralAssetPrice;\n }\n\n {\n (, uint256 collateralFactor) = pool.markets(address(collateralMarket));\n info.liquidationThreshold = collateralFactor;\n info.safetyBuffer = collateralFactor - info.debtRatio;\n }\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract LeveredPositionStorage {\n address public immutable positionOwner;\n ILeveredPositionFactory public factory;\n\n ICErc20 public collateralMarket;\n ICErc20 public stableMarket;\n IonicComptroller public pool;\n\n IERC20Upgradeable public collateralAsset;\n IERC20Upgradeable public stableAsset;\n\n constructor(address _positionOwner) {\n positionOwner = _positionOwner;\n }\n}\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\n\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\n constructor() RolesAuthority(address(0), Authority(address(0))) {\n _disableInitializers();\n }\n\n function initialize(address _owner) public initializer {\n owner = _owner;\n authority = this;\n }\n\n // up to 256 roles\n uint8 public constant REGISTRY_ROLE = 0;\n uint8 public constant SUPPLIER_ROLE = 1;\n uint8 public constant BORROWER_ROLE = 2;\n uint8 public constant LIQUIDATOR_ROLE = 3;\n uint8 public constant LEVERED_POSITION_ROLE = 4;\n\n function configureRegistryCapabilities() external requiresAuth {\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\n true\n );\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\n }\n\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, true);\n }\n\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, false);\n }\n\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\n }\n }\n }\n\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\n }\n\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\n uint8 fnsCount = 6;\n selectors = new bytes4[](fnsCount);\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return selectors;\n }\n\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\n }\n }\n }\n\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, true);\n }\n\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, false);\n }\n\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\n }\n }\n\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n // borrowers have the SUPPLIER_ROLE capabilities by default\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n // TODO this leaves redeeming open for everyone\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\n\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n}\n" + }, + "contracts/ionic/SafeOwnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\nabstract contract SafeOwnable is Ownable2Step {\n function renounceOwnership() public override onlyOwner {\n revert(\"renounce ownership not allowed\");\n }\n}\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\n/**\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\n * that will shift the other.\n */\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\n /**\n * @notice Pending owner of this contract\n */\n address public pendingOwner;\n\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\n __Ownable_init();\n _transferOwnership(owner_);\n }\n\n struct AddressSlot {\n address value;\n }\n\n modifier onlyOwnerOrAdmin() {\n bool isOwner = owner() == _msgSender();\n if (!isOwner) {\n address admin = _getProxyAdmin();\n bool isAdmin = admin == _msgSender();\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\n }\n _;\n }\n\n /**\n * @notice Emitted when pendingOwner is changed\n */\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\n\n /**\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\n */\n event NewOwner(address oldOwner, address newOwner);\n\n /**\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @param newPendingOwner New pending owner.\n */\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\n // Save current value, if any, for inclusion in log\n address oldPendingOwner = pendingOwner;\n\n // Store pendingOwner with value newPendingOwner\n pendingOwner = newPendingOwner;\n\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\n }\n\n /**\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\n * @dev Owner function for pending owner to accept role and update owner\n */\n function _acceptOwner() public {\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\n require(msg.sender == pendingOwner, \"not the pending owner\");\n\n // Save current values for inclusion in log\n address oldOwner = owner();\n address oldPendingOwner = pendingOwner;\n\n // Store owner with value pendingOwner\n _transferOwnership(pendingOwner);\n\n // Clear the pending value\n pendingOwner = address(0);\n\n emit NewOwner(oldOwner, pendingOwner);\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\n }\n\n function renounceOwnership() public override onlyOwner {\n // do not remove this overriding fn\n revert(\"not used anymore\");\n }\n\n function transferOwnership(address newOwner) public override onlyOwner {\n emit NewPendingOwner(pendingOwner, newOwner);\n pendingOwner = newOwner;\n }\n\n function _getProxyAdmin() internal view returns (address admin) {\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n AddressSlot storage adminSlot;\n assembly {\n adminSlot.slot := _ADMIN_SLOT\n }\n admin = adminSlot.value;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\n/**\n @title Balance Booster Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\n \n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\n\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\n*/\ninterface IFlywheelBooster {\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256);\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ninterface IIonicFlywheel {\n function isRewardsDistributor() external returns (bool);\n\n function isFlywheel() external returns (bool);\n\n function flywheelPreSupplierAction(address market, address supplier) external;\n\n function flywheelPostSupplierAction(address market, address supplier) external;\n\n function flywheelPreBorrowerAction(address market, address borrower) external;\n\n function flywheelPostBorrowerAction(address market, address borrower) external;\n\n function flywheelPreTransferAction(address market, address src, address dst) external;\n\n function flywheelPostTransferAction(address market, address src, address dst) external;\n\n function compAccrued(address user) external view returns (uint256);\n\n function addMarketForRewards(ERC20 strategy) external;\n\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\n/**\n @title Balance Booster Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\n \n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\n\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\n*/\ninterface IIonicFlywheelBorrowBooster {\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256);\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport \"./IIonicFlywheel.sol\";\n\ncontract IonicFlywheel is IonicFlywheelCore, IIonicFlywheel {\n bool public constant isRewardsDistributor = true;\n bool public constant isFlywheel = true;\n\n function flywheelPreSupplierAction(address market, address supplier) external {\n accrue(ERC20(market), supplier);\n }\n\n function flywheelPostSupplierAction(address market, address supplier) external {\n _updateBlacklistBalances(ERC20(market), supplier);\n }\n\n function flywheelPreBorrowerAction(address market, address borrower) external {}\n\n function flywheelPostBorrowerAction(address market, address borrower) external {}\n\n function flywheelPreTransferAction(address market, address src, address dst) external {\n accrue(ERC20(market), src, dst);\n }\n\n function flywheelPostTransferAction(address market, address src, address dst) external {\n _updateBlacklistBalances(ERC20(market), src);\n _updateBlacklistBalances(ERC20(market), dst);\n }\n\n function compAccrued(address user) external view returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrow.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport \"./IIonicFlywheel.sol\";\n\ncontract IonicFlywheelBorrow is IonicFlywheelCore, IIonicFlywheel {\n bool public constant isRewardsDistributor = true;\n bool public constant isFlywheel = true;\n\n function flywheelPreSupplierAction(address market, address supplier) external {}\n\n function flywheelPostSupplierAction(address market, address supplier) external {}\n\n function flywheelPreBorrowerAction(address market, address borrower) external {\n accrue(ERC20(market), borrower);\n }\n\n function flywheelPostBorrowerAction(address market, address borrower) external {\n _updateBlacklistBalances(ERC20(market), borrower);\n }\n\n function flywheelPreTransferAction(address market, address src, address dst) external {}\n\n function flywheelPostTransferAction(address market, address src, address dst) external {}\n\n function compAccrued(address user) external view returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport \"./IIonicFlywheelBorrowBooster.sol\";\n\ncontract IonicFlywheelBorrowBooster is IIonicFlywheelBorrowBooster {\n string public constant BOOSTER_TYPE = \"FlywheelBorrowBooster\";\n\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256) {\n return strategy.totalBorrows();\n }\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256) {\n return strategy.borrowBalanceCurrent(user);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\nimport { SafeCastLib } from \"solmate/utils/SafeCastLib.sol\";\n\nimport { IFlywheelRewards } from \"./rewards/IFlywheelRewards.sol\";\nimport { IFlywheelBooster } from \"./IFlywheelBooster.sol\";\nimport { IEmissionsManager } from \"../../../IEmissionsManager.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\n\ncontract IonicFlywheelCore is Ownable2StepUpgradeable {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n /// @notice How much rewardsToken will be send to treasury\n uint256 public performanceFee;\n\n /// @notice Address that gets rewardsToken accrued by performanceFee\n address public feeRecipient;\n\n /// @notice The token to reward\n ERC20 public rewardToken;\n\n /// @notice append-only list of strategies added\n ERC20[] public allStrategies;\n\n /// @notice the rewards contract for managing streams\n IFlywheelRewards public flywheelRewards;\n\n /// @notice optional booster module for calculating virtual balances on strategies\n IFlywheelBooster public flywheelBooster;\n\n IEmissionsManager public emissionsManager;\n\n /// @notice The accrued but not yet transferred rewards for each user\n mapping(address => uint256) internal _rewardsAccrued;\n\n /// @notice The strategy index and last updated per strategy\n mapping(ERC20 => RewardsState) internal _strategyState;\n\n /// @notice user index per strategy\n mapping(ERC20 => mapping(address => uint224)) internal _userIndex;\n\n /// @notice user blacklisted supply per strategy\n mapping(ERC20 => mapping(address => uint256)) public userBlacklistedSupply;\n\n /// @notice blacklisted supply per strategy\n mapping(ERC20 => uint256) public blacklistedSupply;\n\n modifier onlyEmissionsManager() {\n require(address(emissionsManager) == msg.sender, \"!emissionsManager\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize(\n ERC20 _rewardToken,\n IFlywheelRewards _flywheelRewards,\n IFlywheelBooster _flywheelBooster,\n address _owner\n ) public initializer {\n __Ownable2Step_init();\n\n rewardToken = _rewardToken;\n flywheelRewards = _flywheelRewards;\n flywheelBooster = _flywheelBooster;\n\n performanceFee = 10e16; // 10%\n feeRecipient = _owner;\n }\n\n /*----------------------------------------------------------------\n ACCRUE/CLAIM LOGIC\n ----------------------------------------------------------------*/\n\n /** \n @notice Emitted when a user's rewards accrue to a given strategy.\n @param strategy the updated rewards strategy\n @param user the user of the rewards\n @param rewardsDelta how many new rewards accrued to the user\n @param rewardsIndex the market index for rewards per token accrued\n */\n event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);\n\n /** \n @notice Emitted when a user claims accrued rewards.\n @param user the user of the rewards\n @param amount the amount of rewards claimed\n */\n event ClaimRewards(address indexed user, uint256 amount);\n\n /** \n @notice accrue rewards for a single user on a strategy\n @param strategy the strategy to accrue a user's rewards on\n @param user the user to be accrued\n @return the cumulative amount of rewards accrued to user (including prior)\n */\n function accrue(ERC20 strategy, address user) public returns (uint256) {\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n\n if (state.index == 0) return 0;\n\n state = accrueStrategy(strategy, state);\n return accrueUser(strategy, user, state);\n }\n\n /** \n @notice accrue rewards for a two users on a strategy\n @param strategy the strategy to accrue a user's rewards on\n @param user the first user to be accrued\n @param user the second user to be accrued\n @return the cumulative amount of rewards accrued to the first user (including prior)\n @return the cumulative amount of rewards accrued to the second user (including prior)\n */\n function accrue(ERC20 strategy, address user, address secondUser) public returns (uint256, uint256) {\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n\n if (state.index == 0) return (0, 0);\n\n state = accrueStrategy(strategy, state);\n return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));\n }\n\n /** \n @notice claim rewards for a given user\n @param user the user claiming rewards\n @dev this function is public, and all rewards transfer to the user\n */\n function claimRewards(address user) external {\n require(!emissionsManager.isUserBlacklisted(user), \"blacklisted\");\n require(!emissionsManager.isUserBlacklistable(user), \"blacklistable\");\n uint256 accrued = rewardsAccrued(user);\n\n if (accrued != 0) {\n _rewardsAccrued[user] = 0;\n\n rewardToken.safeTransferFrom(address(flywheelRewards), user, accrued);\n\n emit ClaimRewards(user, accrued);\n }\n }\n\n /** \n @notice take rewards for a given user\n @param user the user claiming rewards\n @param receiver the address that receives the rewards\n @dev this function is public, and all rewards transfer to the receiver\n */\n function takeRewardsFromUser(address user, address receiver) external onlyEmissionsManager {\n uint256 accrued = rewardsAccrued(user);\n\n if (accrued != 0) {\n _rewardsAccrued[user] = 0;\n\n rewardToken.safeTransferFrom(address(flywheelRewards), receiver, accrued);\n\n emit ClaimRewards(user, accrued);\n }\n }\n\n /** \n @notice set user balances to zero\n @param strategy strategy to whitelist user for\n @param user the user to be whitelisted\n @dev this function is public, and all user and strategy blacklisted supplies are reset\n */\n function whitelistUser(ERC20 strategy, address user) external onlyEmissionsManager {\n blacklistedSupply[strategy] -= userBlacklistedSupply[strategy][user];\n userBlacklistedSupply[strategy][user] = 0;\n }\n\n /** \n @notice update user blacklisted balances\n @param strategy strategy to update blacklisted balances\n @param user the user to be blacklisted\n @dev this function is public\n */\n function updateBlacklistBalances(ERC20 strategy, address user) external onlyEmissionsManager {\n _updateBlacklistBalances(strategy, user);\n }\n\n /** \n @notice update user blacklisted balances\n @param strategy strategy to update blacklisted balances\n @param user the user to be blacklisted\n @dev this function is private\n */\n function _updateBlacklistBalances(ERC20 strategy, address user) internal {\n if (emissionsManager.isUserBlacklisted(user)) {\n uint256 _oldUserBlacklistedSupply = userBlacklistedSupply[strategy][user];\n uint256 supplierTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedBalanceOf(ERC20(strategy), user)\n : ERC20(strategy).balanceOf(user);\n\n if (supplierTokens >= _oldUserBlacklistedSupply) {\n blacklistedSupply[strategy] += supplierTokens - _oldUserBlacklistedSupply;\n userBlacklistedSupply[strategy][user] = supplierTokens;\n } else {\n blacklistedSupply[strategy] -= _oldUserBlacklistedSupply - supplierTokens;\n userBlacklistedSupply[strategy][user] = supplierTokens;\n }\n }\n }\n /*----------------------------------------------------------------\n ADMIN LOGIC\n ----------------------------------------------------------------*/\n\n /** \n @notice Emitted when a new strategy is added to flywheel by the admin\n @param newStrategy the new added strategy\n */\n event AddStrategy(address indexed newStrategy);\n\n /// @notice initialize a new strategy\n function setEmissionsManager(IEmissionsManager _emissionsManager) external onlyOwner {\n emissionsManager = _emissionsManager;\n }\n\n /// @notice initialize a new strategy\n function addStrategyForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function _addStrategyForRewards(ERC20 strategy) internal {\n (uint224 index, ) = strategyState(strategy);\n require(index == 0, \"strategy\");\n _strategyState[strategy] = RewardsState({\n index: (10 ** rewardToken.decimals()).safeCastTo224(),\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\n });\n\n allStrategies.push(strategy);\n emit AddStrategy(address(strategy));\n }\n\n function getAllStrategies() external view returns (ERC20[] memory) {\n return allStrategies;\n }\n\n /** \n @notice Emitted when the rewards module changes\n @param newFlywheelRewards the new rewards module\n */\n event FlywheelRewardsUpdate(address indexed newFlywheelRewards);\n\n /// @notice swap out the flywheel rewards contract\n function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external onlyOwner {\n if (address(flywheelRewards) != address(0)) {\n uint256 oldRewardBalance = rewardToken.balanceOf(address(flywheelRewards));\n if (oldRewardBalance > 0) {\n rewardToken.safeTransferFrom(address(flywheelRewards), address(newFlywheelRewards), oldRewardBalance);\n }\n }\n\n flywheelRewards = newFlywheelRewards;\n\n emit FlywheelRewardsUpdate(address(newFlywheelRewards));\n }\n\n /** \n @notice Emitted when the booster module changes\n @param newBooster the new booster module\n */\n event FlywheelBoosterUpdate(address indexed newBooster);\n\n /// @notice swap out the flywheel booster contract\n function setBooster(IFlywheelBooster newBooster) external onlyOwner {\n flywheelBooster = newBooster;\n\n emit FlywheelBoosterUpdate(address(newBooster));\n }\n\n event UpdatedFeeSettings(\n uint256 oldPerformanceFee,\n uint256 newPerformanceFee,\n address oldFeeRecipient,\n address newFeeRecipient\n );\n\n /**\n * @notice Update performanceFee and/or feeRecipient\n * @dev Claim rewards first from the previous feeRecipient before changing it\n */\n function updateFeeSettings(uint256 _performanceFee, address _feeRecipient) external onlyOwner {\n _updateFeeSettings(_performanceFee, _feeRecipient);\n }\n\n function _updateFeeSettings(uint256 _performanceFee, address _feeRecipient) internal {\n emit UpdatedFeeSettings(performanceFee, _performanceFee, feeRecipient, _feeRecipient);\n\n if (feeRecipient != _feeRecipient) {\n _rewardsAccrued[_feeRecipient] += rewardsAccrued(feeRecipient);\n _rewardsAccrued[feeRecipient] = 0;\n }\n performanceFee = _performanceFee;\n feeRecipient = _feeRecipient;\n }\n\n /*----------------------------------------------------------------\n INTERNAL ACCOUNTING LOGIC\n ----------------------------------------------------------------*/\n\n struct RewardsState {\n /// @notice The strategy's last updated index\n uint224 index;\n /// @notice The timestamp the index was last updated at\n uint32 lastUpdatedTimestamp;\n }\n\n /// @notice accumulate global rewards on a strategy\n function accrueStrategy(\n ERC20 strategy,\n RewardsState memory state\n ) private returns (RewardsState memory rewardsState) {\n // calculate accrued rewards through module\n uint256 strategyRewardsAccrued = flywheelRewards.getAccruedRewards(strategy, state.lastUpdatedTimestamp);\n\n rewardsState = state;\n\n if (strategyRewardsAccrued > 0) {\n // use the booster or token supply to calculate reward index denominator\n uint256 supplyTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedTotalSupply(strategy) - blacklistedSupply[strategy]\n : strategy.totalSupply() - blacklistedSupply[strategy];\n\n // 100% = 100e16\n uint256 accruedFees = (strategyRewardsAccrued * performanceFee) / uint224(100e16);\n\n _rewardsAccrued[feeRecipient] += accruedFees;\n strategyRewardsAccrued -= accruedFees;\n\n uint224 deltaIndex;\n\n if (supplyTokens != 0)\n deltaIndex = ((strategyRewardsAccrued * (10 ** strategy.decimals())) / supplyTokens).safeCastTo224();\n\n // accumulate rewards per token onto the index, multiplied by fixed-point factor\n rewardsState = RewardsState({\n index: state.index + deltaIndex,\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\n });\n _strategyState[strategy] = rewardsState;\n }\n }\n\n /// @notice accumulate rewards on a strategy for a specific user\n function accrueUser(ERC20 strategy, address user, RewardsState memory state) private returns (uint256) {\n // load indices\n uint224 strategyIndex = state.index;\n uint224 supplierIndex = userIndex(strategy, user);\n\n // sync user index to global\n _userIndex[strategy][user] = strategyIndex;\n\n // if user hasn't yet accrued rewards, grant them interest from the strategy beginning if they have a balance\n // zero balances will have no effect other than syncing to global index\n if (supplierIndex == 0) {\n supplierIndex = (10 ** rewardToken.decimals()).safeCastTo224();\n }\n\n uint224 deltaIndex = strategyIndex - supplierIndex;\n // use the booster or token balance to calculate reward balance multiplier\n uint256 supplierTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedBalanceOf(strategy, user) - userBlacklistedSupply[strategy][user]\n : strategy.balanceOf(user) - userBlacklistedSupply[strategy][user];\n\n // accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed\n uint256 supplierDelta = (deltaIndex * supplierTokens) / (10 ** strategy.decimals());\n uint256 supplierAccrued = rewardsAccrued(user) + supplierDelta;\n\n _rewardsAccrued[user] = supplierAccrued;\n\n emit AccrueRewards(strategy, user, supplierDelta, strategyIndex);\n\n return supplierAccrued;\n }\n\n function rewardsAccrued(address user) public virtual returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function userIndex(ERC20 strategy, address user) public virtual returns (uint224) {\n return _userIndex[strategy][user];\n }\n\n function strategyState(ERC20 strategy) public virtual returns (uint224 index, uint32 lastUpdatedTimestamp) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelLensRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport { IonicComptroller } from \"../../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { PoolDirectory } from \"../../../PoolDirectory.sol\";\n\ninterface IPriceOracle_IFLR {\n function getUnderlyingPrice(ERC20 cToken) external view returns (uint256);\n\n function price(address underlying) external view returns (uint256);\n}\n\ncontract IonicFlywheelLensRouter {\n PoolDirectory public fpd;\n\n constructor(PoolDirectory _fpd) {\n fpd = _fpd;\n }\n\n struct MarketRewardsInfo {\n /// @dev comptroller oracle price of market underlying\n uint256 underlyingPrice;\n ICErc20 market;\n RewardsInfo[] rewardsInfo;\n }\n\n struct RewardsInfo {\n /// @dev rewards in `rewardToken` paid per underlying staked token in `market` per second\n uint256 rewardSpeedPerSecondPerToken;\n /// @dev comptroller oracle price of reward token\n uint256 rewardTokenPrice;\n /// @dev APR scaled by 1e18. Calculated as rewardSpeedPerSecondPerToken * rewardTokenPrice * 365.25 days / underlyingPrice * 1e18 / market.exchangeRate\n uint256 formattedAPR;\n address flywheel;\n address rewardToken;\n }\n\n function getPoolMarketRewardsInfo(IonicComptroller comptroller) external returns (MarketRewardsInfo[] memory) {\n ICErc20[] memory markets = comptroller.getAllMarkets();\n return _getMarketRewardsInfo(markets, comptroller);\n }\n\n function getMarketRewardsInfo(ICErc20[] memory markets) external returns (MarketRewardsInfo[] memory) {\n IonicComptroller pool;\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 asMarket = ICErc20(address(markets[i]));\n if (address(pool) == address(0)) pool = asMarket.comptroller();\n else require(asMarket.comptroller() == pool);\n }\n return _getMarketRewardsInfo(markets, pool);\n }\n\n function _getMarketRewardsInfo(ICErc20[] memory markets, IonicComptroller comptroller)\n internal\n returns (MarketRewardsInfo[] memory)\n {\n if (address(comptroller) == address(0) || markets.length == 0) return new MarketRewardsInfo[](0);\n\n address[] memory flywheels = comptroller.getAccruingFlywheels();\n address[] memory rewardTokens = new address[](flywheels.length);\n uint256[] memory rewardTokenPrices = new uint256[](flywheels.length);\n uint256[] memory rewardTokenDecimals = new uint256[](flywheels.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n MarketRewardsInfo[] memory infoList = new MarketRewardsInfo[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n RewardsInfo[] memory rewardsInfo = new RewardsInfo[](flywheels.length);\n\n ICErc20 market = ICErc20(address(markets[i]));\n uint256 price = oracle.price(market.underlying()); // scaled to 1e18\n\n if (i == 0) {\n for (uint256 j = 0; j < flywheels.length; j++) {\n ERC20 rewardToken = IonicFlywheelCore(flywheels[j]).rewardToken();\n rewardTokens[j] = address(rewardToken);\n rewardTokenPrices[j] = oracle.price(address(rewardToken)); // scaled to 1e18\n rewardTokenDecimals[j] = uint256(rewardToken.decimals());\n }\n }\n\n for (uint256 j = 0; j < flywheels.length; j++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\n\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\n flywheel,\n market,\n rewardTokenDecimals[j]\n );\n uint256 apr = getApr(\n rewardSpeedPerSecondPerToken,\n rewardTokenPrices[j],\n price, \n market.exchangeRateCurrent(),\n address(flywheel.flywheelBooster()) != address(0)\n );\n\n rewardsInfo[j] = RewardsInfo({\n rewardSpeedPerSecondPerToken: rewardSpeedPerSecondPerToken, // scaled in 1e18\n rewardTokenPrice: rewardTokenPrices[j],\n formattedAPR: apr, // scaled in 1e18\n flywheel: address(flywheel),\n rewardToken: rewardTokens[j]\n });\n }\n\n infoList[i] = MarketRewardsInfo({ market: market, rewardsInfo: rewardsInfo, underlyingPrice: price });\n }\n\n return infoList;\n }\n\n function scaleIndexDiff(uint256 indexDiff, uint256 decimals) internal pure returns (uint256) {\n return decimals <= 18 ? uint256(indexDiff) * (10**(18 - decimals)) : uint256(indexDiff) / (10**(decimals - 18));\n }\n\n function getRewardSpeedPerSecondPerToken(\n IonicFlywheelCore flywheel,\n ICErc20 market,\n uint256 decimals\n ) internal returns (uint256 rewardSpeedPerSecondPerToken) {\n ERC20 strategy = ERC20(address(market));\n (uint224 indexBefore, uint32 lastUpdatedTimestampBefore) = flywheel.strategyState(strategy);\n flywheel.accrue(strategy, address(0));\n (uint224 indexAfter, uint32 lastUpdatedTimestampAfter) = flywheel.strategyState(strategy);\n if (lastUpdatedTimestampAfter > lastUpdatedTimestampBefore) {\n rewardSpeedPerSecondPerToken =\n scaleIndexDiff((indexAfter - indexBefore), decimals) /\n (lastUpdatedTimestampAfter - lastUpdatedTimestampBefore);\n }\n }\n\n function getApr(\n uint256 rewardSpeedPerSecondPerToken,\n uint256 rewardTokenPrice,\n uint256 underlyingPrice,\n uint256 exchangeRate,\n bool isBorrow\n ) internal pure returns (uint256) {\n if (rewardSpeedPerSecondPerToken == 0) return 0;\n uint256 nativeSpeedPerSecondPerCToken = rewardSpeedPerSecondPerToken * rewardTokenPrice; // scaled to 1e36\n uint256 nativeSpeedPerYearPerCToken = nativeSpeedPerSecondPerCToken * 365.25 days; // scaled to 1e36\n uint256 assetSpeedPerYearPerCToken = nativeSpeedPerYearPerCToken / underlyingPrice; // scaled to 1e18\n uint256 assetSpeedPerYearPerCTokenScaled = assetSpeedPerYearPerCToken * 1e18; // scaled to 1e36\n uint256 apr = assetSpeedPerYearPerCTokenScaled;\n if (!isBorrow) {\n // if not borrowing, use exchange rate to scale\n apr = assetSpeedPerYearPerCTokenScaled / exchangeRate; // scaled to 1e18\n } else {\n apr = assetSpeedPerYearPerCTokenScaled / 1e18; // scaled to 1e18\n }\n return apr;\n }\n\n function getRewardsAprForMarket(ICErc20 market) internal returns (int256 totalMarketRewardsApr) {\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n uint256 underlyingPrice = oracle.getUnderlyingPrice(market);\n\n address[] memory flywheels = comptroller.getAccruingFlywheels();\n for (uint256 j = 0; j < flywheels.length; j++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\n ERC20 rewardToken = flywheel.rewardToken();\n\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\n flywheel,\n market,\n uint256(rewardToken.decimals())\n );\n\n uint256 marketApr = getApr(\n rewardSpeedPerSecondPerToken,\n oracle.price(address(rewardToken)),\n underlyingPrice,\n market.exchangeRateCurrent(),\n address(flywheel.flywheelBooster()) != address(0)\n );\n\n totalMarketRewardsApr += int256(marketApr);\n }\n }\n\n function getUserNetValueDeltaForMarket(\n address user,\n ICErc20 market,\n int256 offchainApr,\n int256 blocksPerYear\n ) internal returns (int256) {\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n int256 netApr = getRewardsAprForMarket(market) +\n getUserInterestAprForMarket(user, market, blocksPerYear) +\n offchainApr;\n return (netApr * int256(market.balanceOfUnderlying(user)) * int256(oracle.getUnderlyingPrice(market))) / 1e36;\n }\n\n function getUserInterestAprForMarket(\n address user,\n ICErc20 market,\n int256 blocksPerYear\n ) internal returns (int256) {\n uint256 borrows = market.borrowBalanceCurrent(user);\n uint256 supplied = market.balanceOfUnderlying(user);\n uint256 supplyRatePerBlock = market.supplyRatePerBlock();\n uint256 borrowRatePerBlock = market.borrowRatePerBlock();\n\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n uint256 assetPrice = oracle.getUnderlyingPrice(market);\n uint256 collateralValue = (supplied * assetPrice) / 1e18;\n uint256 borrowsValue = (borrows * assetPrice) / 1e18;\n\n uint256 yieldValuePerBlock = collateralValue * supplyRatePerBlock;\n uint256 interestOwedValuePerBlock = borrowsValue * borrowRatePerBlock;\n\n if (collateralValue == 0) return 0;\n return ((int256(yieldValuePerBlock) - int256(interestOwedValuePerBlock)) * blocksPerYear) / int256(collateralValue);\n }\n\n struct AdjustedUserNetAprVars {\n int256 userNetAssetsValue;\n int256 userNetValueDelta;\n BasePriceOracle oracle;\n ICErc20[] markets;\n IonicComptroller pool;\n }\n\n function getAdjustedUserNetApr(\n address user,\n int256 blocksPerYear,\n address[] memory offchainRewardsAprMarkets,\n int256[] memory offchainRewardsAprs\n ) public returns (int256) {\n AdjustedUserNetAprVars memory vars;\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n vars.oracle = pool.oracle();\n vars.markets = pool.getAllMarkets();\n for (uint256 j = 0; j < vars.markets.length; j++) {\n int256 offchainRewardsApr = 0;\n for (uint256 k = 0; k < offchainRewardsAprMarkets.length; k++) {\n if (offchainRewardsAprMarkets[k] == address(vars.markets[j])) offchainRewardsApr = offchainRewardsAprs[k];\n }\n vars.userNetAssetsValue +=\n int256(vars.markets[j].balanceOfUnderlying(user) * vars.oracle.getUnderlyingPrice(vars.markets[j])) /\n 1e18;\n vars.userNetValueDelta += getUserNetValueDeltaForMarket(\n user,\n vars.markets[j],\n offchainRewardsApr,\n blocksPerYear\n );\n }\n }\n\n if (vars.userNetAssetsValue == 0) return 0;\n else return (vars.userNetValueDelta * 1e18) / vars.userNetAssetsValue;\n }\n\n function getUserNetApr(address user, int256 blocksPerYear) external returns (int256) {\n address[] memory emptyAddrArray = new address[](0);\n int256[] memory emptyIntArray = new int256[](0);\n return getAdjustedUserNetApr(user, blocksPerYear, emptyAddrArray, emptyIntArray);\n }\n\n function getAllRewardTokens() public view returns (address[] memory uniqueRewardTokens) {\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n uint256 rewardTokensCounter;\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address[] memory fws = pool.getRewardsDistributors();\n\n rewardTokensCounter += fws.length;\n }\n\n address[] memory rewardTokens = new address[](rewardTokensCounter);\n\n uint256 uniqueRewardTokensCounter = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address[] memory fws = pool.getRewardsDistributors();\n\n for (uint256 j = 0; j < fws.length; j++) {\n address rwToken = address(IonicFlywheelCore(fws[j]).rewardToken());\n if (rwToken == address(0)) break;\n\n bool added;\n for (uint256 k = 0; k < rewardTokens.length; k++) {\n if (rwToken == rewardTokens[k]) {\n added = true;\n break;\n }\n }\n if (!added) rewardTokens[uniqueRewardTokensCounter++] = rwToken;\n }\n }\n\n uniqueRewardTokens = new address[](uniqueRewardTokensCounter);\n for (uint256 i = 0; i < uniqueRewardTokensCounter; i++) {\n uniqueRewardTokens[i] = rewardTokens[i];\n }\n }\n\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory) {\n address[] memory rewardTokens = getAllRewardTokens();\n uint256[] memory rewardsClaimedForToken = new uint256[](rewardTokens.length);\n\n for (uint256 i = 0; i < rewardTokens.length; i++) {\n rewardsClaimedForToken[i] = claimRewardsOfRewardToken(user, rewardTokens[i]);\n }\n\n return (rewardTokens, rewardsClaimedForToken);\n }\n\n function claimRewardsOfRewardToken(address user, address rewardToken) public returns (uint256 rewardsClaimed) {\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(user);\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ERC20[] memory markets;\n {\n ICErc20[] memory cerc20s = pool.getAllMarkets();\n markets = new ERC20[](cerc20s.length);\n for (uint256 j = 0; j < cerc20s.length; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n }\n\n address[] memory flywheelAddresses = pool.getAccruingFlywheels();\n for (uint256 k = 0; k < flywheelAddresses.length; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == rewardToken) {\n for (uint256 m = 0; m < markets.length; m++) {\n flywheel.accrue(markets[m], user);\n }\n flywheel.claimRewards(user);\n }\n }\n }\n\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(user);\n return balanceAfter - balanceBefore;\n }\n\n function claimRewardsForMarket(\n address user,\n ERC20 market,\n IonicFlywheelCore[] calldata flywheels,\n bool[] calldata accrue\n )\n external\n returns (\n IonicFlywheelCore[] memory,\n address[] memory rewardTokens,\n uint256[] memory rewards\n )\n {\n uint256 size = flywheels.length;\n rewards = new uint256[](size);\n rewardTokens = new address[](size);\n\n for (uint256 i = 0; i < size; i++) {\n uint256 newRewards;\n if (accrue[i]) {\n newRewards = flywheels[i].accrue(market, user);\n } else {\n newRewards = flywheels[i].rewardsAccrued(user);\n }\n\n // Take the max, because rewards are cumulative.\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\n\n flywheels[i].claimRewards(user);\n rewardTokens[i] = address(flywheels[i].rewardToken());\n }\n\n return (flywheels, rewardTokens, rewards);\n }\n\n function claimRewardsForPool(address user, IonicComptroller comptroller)\n public\n returns (\n IonicFlywheelCore[] memory,\n address[] memory,\n uint256[] memory\n )\n {\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\n ERC20[] memory markets = new ERC20[](cerc20s.length);\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](flywheelAddresses.length);\n bool[] memory accrue = new bool[](flywheelAddresses.length);\n\n for (uint256 j = 0; j < flywheelAddresses.length; j++) {\n flywheels[j] = IonicFlywheelCore(flywheelAddresses[j]);\n accrue[j] = true;\n }\n\n for (uint256 j = 0; j < cerc20s.length; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n\n return claimRewardsForMarkets(user, markets, flywheels, accrue);\n }\n\n function claimRewardsForMarkets(\n address user,\n ERC20[] memory markets,\n IonicFlywheelCore[] memory flywheels,\n bool[] memory accrue\n )\n public\n returns (\n IonicFlywheelCore[] memory,\n address[] memory rewardTokens,\n uint256[] memory rewards\n )\n {\n rewards = new uint256[](flywheels.length);\n rewardTokens = new address[](flywheels.length);\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n for (uint256 j = 0; j < markets.length; j++) {\n ERC20 market = markets[j];\n\n uint256 newRewards;\n if (accrue[i]) {\n newRewards = flywheels[i].accrue(market, user);\n } else {\n newRewards = flywheels[i].rewardsAccrued(user);\n }\n\n // Take the max, because rewards are cumulative.\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\n }\n\n flywheels[i].claimRewards(user);\n rewardTokens[i] = address(flywheels[i].rewardToken());\n }\n\n return (flywheels, rewardTokens, rewards);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/LooplessFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"./IFlywheelBooster.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\ncontract LooplessFlywheelBooster is IFlywheelBooster {\n string public constant BOOSTER_TYPE = \"LooplessFlywheelBooster\";\n\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256) {\n return strategy.totalSupply();\n }\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256) {\n uint256 cTokensBalance = strategy.balanceOf(user);\n ICErc20 asMarket = ICErc20(address(strategy));\n uint256 cTokensBorrow = (asMarket.borrowBalanceCurrent(user) * 1e18) / asMarket.exchangeRateCurrent();\n return (cTokensBalance > cTokensBorrow) ? cTokensBalance - cTokensBorrow : 0;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {IFlywheelRewards} from \"./IFlywheelRewards.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/** \n @title Flywheel Reward Module\n @notice Determines how many rewards accrue to each strategy globally over a given time period.\n @dev approves the flywheel core for the reward token to allow balances to be managed by the module but claimed from core.\n*/\nabstract contract BaseFlywheelRewards is IFlywheelRewards {\n using SafeTransferLib for ERC20;\n\n /// @notice thrown when caller is not the flywheel\n error FlywheelError();\n\n /// @notice the reward token paid\n ERC20 public immutable override rewardToken;\n\n /// @notice the flywheel core contract\n IonicFlywheelCore public immutable override flywheel;\n\n constructor(IonicFlywheelCore _flywheel) {\n flywheel = _flywheel;\n ERC20 _rewardToken = _flywheel.rewardToken();\n rewardToken = _rewardToken;\n\n _rewardToken.safeApprove(address(_flywheel), type(uint256).max);\n }\n\n modifier onlyFlywheel() {\n if (msg.sender != address(flywheel)) revert FlywheelError();\n _;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\n\n/** \n @title Flywheel Dynamic Reward Stream\n @notice Determines rewards based on a dynamic reward stream.\n Rewards are transferred linearly over a \"rewards cycle\" to prevent gaming the reward distribution. \n The reward source can be arbitrary logic, but most common is to \"pass through\" rewards from some other source.\n The getNextCycleRewards() hook should also transfer the next cycle's rewards to this contract to ensure proper accounting.\n*/\nabstract contract FlywheelDynamicRewards is BaseFlywheelRewards {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n event NewRewardsCycle(uint32 indexed start, uint32 indexed end, uint192 reward);\n\n /// @notice the length of a rewards cycle\n uint32 public immutable rewardsCycleLength;\n\n struct RewardsCycle {\n uint32 start;\n uint32 end;\n uint192 reward;\n }\n\n mapping(ERC20 => RewardsCycle) public rewardsCycle;\n\n constructor(IonicFlywheelCore _flywheel, uint32 _rewardsCycleLength) BaseFlywheelRewards(_flywheel) {\n rewardsCycleLength = _rewardsCycleLength;\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param strategy the strategy to accrue rewards for\n @return amount the amount of tokens accrued and transferred\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\n external\n override\n onlyFlywheel\n returns (uint256 amount)\n {\n RewardsCycle memory cycle = rewardsCycle[strategy];\n\n uint32 timestamp = block.timestamp.safeCastTo32();\n\n uint32 latest = timestamp >= cycle.end ? cycle.end : timestamp;\n uint32 earliest = lastUpdatedTimestamp <= cycle.start ? cycle.start : lastUpdatedTimestamp;\n if (cycle.end != 0) {\n amount = (cycle.reward * (latest - earliest)) / (cycle.end - cycle.start);\n assert(amount <= cycle.reward); // should never happen because latest <= cycle.end and earliest >= cycle.start\n }\n // if cycle has ended, reset cycle and transfer all available\n if (timestamp >= cycle.end) {\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\n uint192 rewards = getNextCycleRewards(strategy);\n\n // reset for next cycle\n rewardsCycle[strategy] = RewardsCycle({start: timestamp, end: end, reward: rewards});\n\n emit NewRewardsCycle(timestamp, end, rewards);\n }\n }\n\n function getNextCycleRewards(ERC20 strategy) internal virtual returns (uint192);\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\nimport {ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/** \n @title Flywheel Static Reward Stream\n @notice Determines rewards per strategy based on a fixed reward rate per second\n*/\ncontract FlywheelStaticRewards is Auth, BaseFlywheelRewards {\n event RewardsInfoUpdate(ERC20 indexed strategy, uint224 rewardsPerSecond, uint32 rewardsEndTimestamp);\n\n struct RewardsInfo {\n /// @notice Rewards per second\n uint224 rewardsPerSecond;\n /// @notice The timestamp the rewards end at\n /// @dev use 0 to specify no end\n uint32 rewardsEndTimestamp;\n }\n\n /// @notice rewards info per strategy\n mapping(ERC20 => RewardsInfo) public rewardsInfo;\n\n constructor(\n IonicFlywheelCore _flywheel,\n address _owner,\n Authority _authority\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\n\n /**\n @notice set rewards per second and rewards end time for Fei Rewards\n @param strategy the strategy to accrue rewards for\n @param rewards the rewards info for the strategy\n */\n function setRewardsInfo(ERC20 strategy, RewardsInfo calldata rewards) external requiresAuth {\n rewardsInfo[strategy] = rewards;\n emit RewardsInfoUpdate(strategy, rewards.rewardsPerSecond, rewards.rewardsEndTimestamp);\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param strategy the strategy to accrue rewards for\n @param lastUpdatedTimestamp the last updated time for strategy\n @return amount the amount of tokens accrued and transferred\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\n external\n view\n override\n onlyFlywheel\n returns (uint256 amount)\n {\n RewardsInfo memory rewards = rewardsInfo[strategy];\n\n uint256 elapsed;\n if (rewards.rewardsEndTimestamp == 0 || rewards.rewardsEndTimestamp > block.timestamp) {\n elapsed = block.timestamp - lastUpdatedTimestamp;\n } else if (rewards.rewardsEndTimestamp > lastUpdatedTimestamp) {\n elapsed = rewards.rewardsEndTimestamp - lastUpdatedTimestamp;\n }\n\n amount = rewards.rewardsPerSecond * elapsed;\n }\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/IFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/**\n @title Rewards Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Rewards module is responsible for:\n * determining the ongoing reward amounts to entire strategies (core handles the logic for dividing among users)\n * actually holding rewards that are yet to be claimed\n\n The reward stream can follow arbitrary logic as long as the amount of rewards passed to flywheel core has been sent to this contract.\n\n Different module strategies include:\n * a static reward rate per second\n * a decaying reward rate\n * a dynamic just-in-time reward stream\n * liquid governance reward delegation (Curve Gauge style)\n\n SECURITY NOTE: The rewards strategy should be smooth and continuous, to prevent gaming the reward distribution by frontrunning.\n */\ninterface IFlywheelRewards {\n /**\n @notice calculate the rewards amount accrued to a strategy since the last update.\n @param strategy the strategy to accrue rewards for.\n @param lastUpdatedTimestamp the last time rewards were accrued for the strategy.\n @return rewards the amount of rewards accrued to the market\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);\n\n /// @notice return the flywheel core address\n function flywheel() external view returns (IonicFlywheelCore);\n\n /// @notice return the reward token associated with flywheel core.\n function rewardToken() external view returns (ERC20);\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { FlywheelDynamicRewards } from \"./FlywheelDynamicRewards.sol\";\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\n\ncontract IonicFlywheelDynamicRewards is FlywheelDynamicRewards {\n using SafeTransferLib for ERC20;\n\n address public owner;\n mapping(address => address) public rewardAccumulators;\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"You are not the owner\");\n _;\n }\n\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\n FlywheelDynamicRewards(_flywheel, _cycleLength)\n {\n owner = msg.sender;\n }\n\n function setRewardAccumulators(address[] memory _strategies, address[] memory _rewardAccumulators) external onlyOwner {\n uint256 _length = _strategies.length;\n require(_rewardAccumulators.length == _length, \"parameters\");\n for (uint256 i = 0; i < _length; i++) {\n rewardAccumulators[_strategies[i]] = _rewardAccumulators[i];\n }\n }\n\n function getNextCycleRewards(ERC20 strategy)\n internal\n override\n returns (uint192)\n {\n address rewardAccumulator = rewardAccumulators[address(strategy)];\n uint256 rewardAmount = rewardToken.balanceOf(rewardAccumulator);\n if (rewardAmount != 0) {\n rewardToken.safeTransferFrom(\n rewardAccumulator,\n address(this),\n rewardAmount\n );\n }\n return uint192(rewardAmount);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"./FlywheelDynamicRewards.sol\";\n\ninterface ICERC20 {\n function plugin() external returns (address);\n}\n\ninterface IPlugin_FDR {\n function claimRewards() external;\n}\n\n/** \n @title Ionic Flywheel Dynamic Reward Stream\n @notice Determines rewards based on reward cycle\n Each cycle, claims rewards on the plugin before getting the reward amount\n*/\ncontract IonicFlywheelDynamicRewardsPlugin is FlywheelDynamicRewards {\n using SafeTransferLib for ERC20;\n\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\n FlywheelDynamicRewards(_flywheel, _cycleLength)\n {}\n\n function getNextCycleRewards(ERC20 strategy)\n internal\n override\n returns (uint192)\n {\n IPlugin_FDR plugin = IPlugin_FDR(ICERC20(address(strategy)).plugin());\n try plugin.claimRewards() {} catch {}\n\n uint256 rewardAmount = rewardToken.balanceOf(address(strategy));\n if (rewardAmount != 0) {\n rewardToken.safeTransferFrom(\n address(strategy),\n address(this),\n rewardAmount\n );\n }\n return uint192(rewardAmount);\n }\n}" + }, + "contracts/ionic/strategies/IonicERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport { PausableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol\";\nimport { ERC4626Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nabstract contract IonicERC4626 is SafeOwnableUpgradeable, PausableUpgradeable, ERC4626Upgradeable {\n using FixedPointMathLib for uint256;\n using SafeERC20Upgradeable for ERC20Upgradeable;\n\n /* ========== STATE VARIABLES ========== */\n\n uint256 public vaultShareHWM;\n uint256 public performanceFee;\n address public feeRecipient;\n\n /* ========== EVENTS ========== */\n\n event UpdatedFeeSettings(\n uint256 oldPerformanceFee,\n uint256 newPerformanceFee,\n address oldFeeRecipient,\n address newFeeRecipient\n );\n\n /* ========== INITIALIZER ========== */\n\n function __IonicER4626_init(ERC20Upgradeable asset_) internal onlyInitializing {\n __SafeOwnable_init(msg.sender);\n __Pausable_init();\n __Context_init();\n __ERC20_init(\n string(abi.encodePacked(\"Ionic \", asset_.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", asset_.symbol()))\n );\n __ERC4626_init(asset_);\n\n vaultShareHWM = 10 ** asset_.decimals();\n feeRecipient = msg.sender;\n }\n\n function _asset() internal view returns (ERC20Upgradeable) {\n return ERC20Upgradeable(super.asset());\n }\n\n /* ========== DEPOSIT/WITHDRAW FUNCTIONS ========== */\n\n function deposit(uint256 assets, address receiver) public override whenNotPaused returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n _asset().safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public override whenNotPaused returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n _asset().safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\n }\n\n if (!paused()) {\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\n\n beforeWithdraw(assets, shares);\n\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\n }\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n _asset().safeTransfer(receiver, assets);\n }\n\n function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n if (!paused()) {\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\n\n beforeWithdraw(assets, shares);\n\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\n }\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n _asset().safeTransfer(receiver, assets);\n }\n\n /* ========== FEE FUNCTIONS ========== */\n\n /**\n * @notice Take the performance fee that has accrued since last fee harvest.\n * @dev Performance fee is based on a vault share high water mark value. If vault share value has increased above the\n * HWM in a fee period, issue fee shares to the vault equal to the performance fee.\n */\n function takePerformanceFee() external onlyOwner {\n require(feeRecipient != address(0), \"fee recipient not initialized\");\n\n uint256 currentAssets = totalAssets();\n uint256 shareValue = convertToAssets(10 ** _asset().decimals());\n\n require(shareValue > vaultShareHWM, \"shareValue !> vaultShareHWM\");\n // cache value\n uint256 supply = totalSupply();\n\n uint256 accruedPerformanceFee = (performanceFee * (shareValue - vaultShareHWM) * supply) / 1e36;\n _mint(feeRecipient, accruedPerformanceFee.mulDivDown(supply, (currentAssets - accruedPerformanceFee)));\n\n vaultShareHWM = convertToAssets(10 ** _asset().decimals());\n }\n\n /**\n * @notice Transfer accrued fees to rewards manager contract. Caller must be a registered keeper.\n * @dev We must make sure that feeRecipient is not address(0) before withdrawing fees\n */\n function withdrawAccruedFees() external onlyOwner {\n redeem(balanceOf(feeRecipient), feeRecipient, feeRecipient);\n }\n\n /**\n * @notice Update performanceFee and/or feeRecipient\n */\n function updateFeeSettings(uint256 newPerformanceFee, address newFeeRecipient) external onlyOwner {\n emit UpdatedFeeSettings(performanceFee, newPerformanceFee, feeRecipient, newFeeRecipient);\n\n performanceFee = newPerformanceFee;\n\n if (newFeeRecipient != feeRecipient) {\n if (feeRecipient != address(0)) {\n uint256 oldFees = balanceOf(feeRecipient);\n\n _burn(feeRecipient, oldFees);\n _approve(feeRecipient, owner(), 0);\n _mint(newFeeRecipient, oldFees);\n }\n\n _approve(newFeeRecipient, owner(), type(uint256).max);\n }\n\n feeRecipient = newFeeRecipient;\n }\n\n /* ========== EMERGENCY FUNCTIONS ========== */\n\n // Should withdraw all funds from the strategy and pause the contract\n function emergencyWithdrawAndPause() external virtual;\n\n function unpause() external virtual;\n\n function shutdown(address market) external onlyOwner whenPaused returns (uint256) {\n ERC20Upgradeable theAsset = _asset();\n uint256 endBalance = theAsset.balanceOf(address(this));\n theAsset.transfer(market, endBalance);\n return endBalance;\n }\n\n /* ========== INTERNAL HOOKS LOGIC ========== */\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual;\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual;\n}\n" + }, + "contracts/ionic/strategies/MockERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\n/**\n * @title Mock ERC4626 Contract\n * @notice ERC4626 wrapper for Tribe Token\n * @author carlomazzaferro\n *\n */\ncontract MockERC4626 is ERC4626 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /**\n @notice Creates a new Vault that accepts a specific underlying token.\n @param _asset The ERC20 compliant token the Vault should accept.\n */\n constructor(ERC20 _asset)\n ERC4626(\n _asset,\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", _asset.symbol()))\n )\n {}\n\n /* ========== VIEWS ========== */\n\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\n /// @return The total amount of underlying tokens the Vault holds.\n function totalAssets() public view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @notice Calculates the total amount of underlying tokens the user holds.\n /// @return The total amount of underlying tokens the user holds.\n function balanceOfUnderlying(address account) public view returns (uint256) {\n return convertToAssets(balanceOf[account]);\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function afterDeposit(uint256 amount, uint256) internal override {}\n\n function beforeWithdraw(uint256, uint256 shares) internal override {}\n}\n" + }, + "contracts/ionic/strategies/MockERC4626Dynamic.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { IonicFlywheelCore } from \"./flywheel/IonicFlywheelCore.sol\";\n\n/**\n * @title Mock ERC4626 Contract\n * @notice ERC4626 wrapper for Tribe Token\n * @author carlomazzaferro\n *\n */\ncontract MockERC4626Dynamic is ERC4626 {\n using FixedPointMathLib for uint256;\n\n /* ========== STATE VARIABLES ========== */\n IonicFlywheelCore public immutable flywheel;\n\n /* ========== INITIALIZER ========== */\n\n /**\n @notice Initializes the Vault.\n @param _asset The ERC20 compliant token the Vault should accept.\n @param _flywheel Flywheel to pull in rewardsToken\n */\n constructor(ERC20 _asset, IonicFlywheelCore _flywheel)\n ERC4626(\n _asset,\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", _asset.symbol()))\n )\n {\n flywheel = _flywheel;\n }\n\n /* ========== VIEWS ========== */\n\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\n /// @return The total amount of underlying tokens the Vault holds.\n function totalAssets() public view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @notice Calculates the total amount of underlying tokens the user holds.\n /// @return The total amount of underlying tokens the user holds.\n function balanceOfUnderlying(address account) public view returns (uint256) {\n return convertToAssets(balanceOf[account]);\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function afterDeposit(uint256 amount, uint256) internal override {}\n\n function beforeWithdraw(uint256, uint256 shares) internal override {}\n}\n" + }, + "contracts/IonicLiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./utils/IW_NATIVE.sol\";\n\nimport \"./external/uniswap/IUniswapV2Router02.sol\";\nimport \"./external/uniswap/IUniswapV2Pair.sol\";\nimport \"./external/uniswap/IUniswapV2Callee.sol\";\nimport \"./external/uniswap/UniswapV2Library.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicLiquidator\n * @author David Lucid (https://github.com/davidlucid)\n * @notice IonicLiquidator safely liquidates unhealthy borrowers (with flashloan support).\n * @dev Do not transfer NATIVE or tokens directly to this address. Only send NATIVE here when using a method, and only approve tokens for transfer to here when using a method. Direct NATIVE transfers will be rejected and direct token transfers will be lost.\n */\ncontract IonicLiquidator is OwnableUpgradeable, ILiquidator, IUniswapV2Callee, IExpressRelayFeeReceiver {\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n\n /**\n * @dev W_NATIVE contract address.\n */\n address public W_NATIVE_ADDRESS;\n\n /**\n * @dev UniswapV2Router02 contract object. (Is interchangable with any UniV2 forks)\n */\n IUniswapV2Router02 public UNISWAP_V2_ROUTER_02;\n\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n mapping(address => bool) public redemptionStrategiesWhitelist;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n /**\n * @dev Percentage of the flash swap fee, measured in basis points.\n */\n uint8 public flashSwapFee;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _uniswapV2router, uint8 _flashSwapFee) external initializer {\n __Ownable_init();\n require(_uniswapV2router != address(0), \"_uniswapV2router not defined.\");\n W_NATIVE_ADDRESS = _wtoken;\n UNISWAP_V2_ROUTER_02 = IUniswapV2Router02(_uniswapV2router);\n flashSwapFee = _flashSwapFee;\n }\n\n function _becomeImplementation(bytes calldata data) external {}\n\n /**\n * @dev Internal function to approve unlimited tokens of `erc20Contract` to `to`.\n */\n function safeApprove(IERC20Upgradeable token, address to, uint256 minAmount) private {\n uint256 allowance = token.allowance(address(this), to);\n\n if (allowance < minAmount) {\n if (allowance > 0) token.safeApprove(to, 0);\n token.safeApprove(to, type(uint256).max);\n }\n }\n\n /**\n * @dev Internal function to approve\n */\n function justApprove(IERC20Upgradeable token, address to, uint256 amount) private {\n token.approve(to, amount);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n justApprove(underlying, address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan, confirming that at least `minProfitAmount` in NATIVE profit is seized.\n * @param vars @see LiquidateToTokensWithFlashSwapVars.\n */\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV2Pair flashSwapPair = IUniswapV2Pair(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPair.token0() == address(fundingToken);\n flashSwapPair.swap(\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n address(this),\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n function uniswapV2Call(address, uint256, uint256, bytes calldata data) public override {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars);\n }\n\n /**\n * @dev Callback function for PCS flashloans.\n */\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uniswapV2Call(sender, amount0, amount1, data);\n }\n\n function moraswapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uniswapV2Call(sender, amount0, amount1, data);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(LiquidateToTokensWithFlashSwapVars memory vars) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n justApprove(IERC20Upgradeable(underlyingBorrow), address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData\n ) private returns (address) {\n // Calculate flashloan return amount\n uint256 flashSwapReturnAmount = (_flashSwapAmount * 10000) / (10000 - flashSwapFee);\n if ((_flashSwapAmount * 10000) % (10000 - flashSwapFee) > 0) flashSwapReturnAmount++; // Round up if division resulted in a remainder\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n IUniswapV2Pair pair = IUniswapV2Pair(msg.sender);\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pair.token0() || address(underlyingCollateral) == pair.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay amount for the borrow side\n collateralRequired = flashSwapReturnAmount;\n } else {\n // repay amount for the non-borrow side\n collateralRequired = UniswapV2Library.getAmountsIn(\n UNISWAP_V2_ROUTER_02.factory(),\n _flashSwapAmount, //flashSwapReturnAmount,\n array(address(underlyingCollateral), _flashSwapToken),\n flashSwapFee\n )[0];\n }\n\n // Repay flashloan\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n require(\n underlyingCollateral.transfer(msg.sender, collateralRequired),\n \"Failed to repay token flashloan on borrow side.\"\n );\n\n return address(underlyingCollateral);\n } else {\n // exchange the collateral to W_NATIVE to repay the borrow side\n uint256 wethRequired;\n if (_flashSwapToken == W_NATIVE_ADDRESS) {\n wethRequired = flashSwapReturnAmount;\n } else {\n // Get W_NATIVE required to repay flashloan\n wethRequired = UniswapV2Library.getAmountsIn(\n UNISWAP_V2_ROUTER_02.factory(),\n flashSwapReturnAmount,\n array(W_NATIVE_ADDRESS, _flashSwapToken),\n flashSwapFee\n )[0];\n }\n\n if (address(underlyingCollateral) != W_NATIVE_ADDRESS) {\n // Approve to Uniswap router\n justApprove(underlyingCollateral, address(UNISWAP_V2_ROUTER_02), underlyingCollateralSeized);\n\n // Swap collateral tokens for W_NATIVE to be repaid via Uniswap router\n UNISWAP_V2_ROUTER_02.swapTokensForExactTokens(\n wethRequired,\n underlyingCollateralSeized,\n array(address(underlyingCollateral), W_NATIVE_ADDRESS),\n address(this),\n block.timestamp\n );\n }\n\n // Repay flashloan\n require(\n wethRequired <= IERC20Upgradeable(W_NATIVE_ADDRESS).balanceOf(address(this)),\n \"Not enough W_NATIVE exchanged from seized collateral to repay flashloan.\"\n );\n require(\n IW_NATIVE(W_NATIVE_ADDRESS).transfer(msg.sender, wethRequired),\n \"Failed to repay Uniswap flashloan with W_NATIVE exchanged from seized collateral.\"\n );\n\n // Return the profited token (underlying collateral if same as exchangeProfitTo; otherwise, W_NATIVE)\n return address(underlyingCollateral);\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n\n /**\n * @dev Returns an array containing the parameters supplied.\n */\n function array(address a, address b) private pure returns (address[] memory) {\n address[] memory arr = new address[](2);\n arr[0] = a;\n arr[1] = b;\n return arr;\n }\n}\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicUniV3Liquidator\n * @author Veliko Minkov (https://github.com/vminkov)\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\n */\ncontract IonicUniV3Liquidator is\n OwnableUpgradeable,\n ILiquidator,\n IUniswapV3FlashCallback,\n IExpressRelayFeeReceiver,\n IFlashLoanReceiver\n{\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n\n address public W_NATIVE_ADDRESS;\n mapping(address => bool) public redemptionStrategiesWhitelist;\n IUniswapV3Quoter public quoter;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _quoter) external initializer {\n __Ownable_init();\n W_NATIVE_ADDRESS = _wtoken;\n quoter = IUniswapV3Quoter(_quoter);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n underlying.approve(address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\n flashSwapPool.flash(\n address(this),\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(\n LiquidateToTokensWithFlashSwapVars memory vars,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\n uint256 flashSwapReturnAmount = _flashSwapAmount;\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\n flashSwapReturnAmount += fee0;\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\n flashSwapReturnAmount += fee1;\n } else {\n revert(\"wrong pool or _flashSwapToken\");\n }\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay the borrowed asset directly\n collateralRequired = flashSwapReturnAmount;\n\n // Repay flashloan\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\n } else {\n // TODO swap within the same pool and then repay the FL to the pool\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\n\n {\n collateralRequired = quoter.quoteExactOutputSingle(\n zeroForOne ? pool.token0() : pool.token1(),\n zeroForOne ? pool.token1() : pool.token0(),\n pool.fee(),\n _flashSwapAmount,\n 0 // sqrtPriceLimitX96\n );\n }\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n\n // Repay flashloan\n pool.swap(\n address(pool),\n zeroForOne,\n int256(collateralRequired),\n 0, // sqrtPriceLimitX96\n \"\"\n );\n }\n\n return address(underlyingCollateral);\n } else {\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/liquidators/AerodromeCLLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { ISwapRouter_Aerodrome } from \"../external/aerodrome/IAerodromeSwapRouter.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\ncontract AerodromeCLLiquidator is IRedemptionStrategy {\n /**\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\n * @param inputToken Address of the token\n * @param inputAmount input amount\n * @param strategyData context specific data like input token, pool address and tx expiratio period\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (\n ,\n address _outputToken,\n ISwapRouter_Aerodrome swapRouter,\n address _unwrappedInput,\n address _unwrappedOutput,\n int24 _tickSpacing\n ) = abi.decode(strategyData, (address, address, ISwapRouter_Aerodrome, address, address, int24));\n if (_unwrappedOutput != address(0)) {\n outputToken = IERC20Upgradeable(_unwrappedOutput);\n } else {\n outputToken = IERC20Upgradeable(_outputToken);\n }\n\n if (_unwrappedInput != address(0)) {\n inputToken.approve(address(inputToken), inputAmount);\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n inputToken = IERC20Upgradeable(_unwrappedInput);\n }\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n outputAmount = swapRouter.exactInputSingle(\n ISwapRouter_Aerodrome.ExactInputSingleParams(\n address(inputToken),\n address(outputToken),\n _tickSpacing,\n address(this),\n block.timestamp,\n inputAmount,\n 0,\n 0\n )\n );\n\n if (_unwrappedOutput != address(0)) {\n IERC20Upgradeable(_unwrappedOutput).approve(address(_outputToken), outputAmount);\n IERC4626(_outputToken).deposit(outputAmount, address(this));\n outputAmount = IERC4626(_unwrappedOutput).balanceOf(address(this));\n outputToken = IERC20Upgradeable(_outputToken);\n }\n }\n\n function name() public pure virtual override returns (string memory) {\n return \"AerodromeCLLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/AerodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\n\n/**\n * @title AerodromeV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Aerodrome V2 router for use as a step in a liquidation.\n */\ncontract AerodromeV2Liquidator {\n function _swap(IRouter_Aerodrome router, uint256 inputAmount, IRouter_Aerodrome.Route[] memory swapPath) internal {\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"AerodromeV2Liquidator\";\n }\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IRouter_Aerodrome router, IRouter_Aerodrome.Route[] memory swapPath) = abi.decode(\n strategyData,\n (IRouter_Aerodrome, IRouter_Aerodrome.Route[])\n );\n require(\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\n \"Invalid AerodromeV2Liquidator swap path.\"\n );\n\n // Swap underlying tokens\n inputToken.approve(address(router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\n outputAmount = outputToken.balanceOf(address(this));\n }\n}\n" + }, + "contracts/liquidators/AlgebraSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"../external/algebra/ISwapRouter.sol\";\n\n/**\n * @title AlgebraSwapLiquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Algebra router for use as a step in a liquidation.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract AlgebraSwapLiquidator is IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (address _outputToken, IAlgebraSwapRouter swapRouter) = abi.decode(strategyData, (address, IAlgebraSwapRouter));\n outputToken = IERC20Upgradeable(_outputToken);\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n IAlgebraSwapRouter.ExactInputSingleParams memory params = IAlgebraSwapRouter.ExactInputSingleParams(\n address(inputToken),\n _outputToken,\n address(this),\n block.timestamp,\n inputAmount,\n 0, // amountOutMinimum\n 0 // limitSqrtPrice\n );\n\n outputAmount = swapRouter.exactInputSingle(params);\n }\n\n function name() public pure returns (string memory) {\n return \"AlgebraSwapLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/BaseUniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\n\nimport \"./IRedemptionStrategy.sol\";\n\nabstract contract BaseUniswapV2Liquidator is IRedemptionStrategy {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\n strategyData,\n (IUniswapV2Router02, address[])\n );\n require(swapPath.length >= 2 && swapPath[0] == address(inputToken), \"Invalid UniswapLiquidator swap path.\");\n\n // Swap underlying tokens\n inputToken.approve(address(uniswapV2Router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(uniswapV2Router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1]);\n outputAmount = outputToken.balanceOf(address(this));\n }\n\n function _swap(IUniswapV2Router02 uniswapV2Router, uint256 inputAmount, address[] memory swapPath) internal virtual;\n}\n" + }, + "contracts/liquidators/CurveSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport \"../external/curve/ICurvePool.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\nimport \"./IRedemptionStrategy.sol\";\n\nimport \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\n\n/**\n * @title CurveSwapLiquidator\n * @notice Swaps seized token collateral via Curve as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract CurveSwapLiquidator is IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable, uint256) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\n address outputTokenAddress,\n address _unwrappedInput,\n address _unwrappedOutput\n ) = abi.decode(strategyData, (CurveV2LpTokenPriceOracleNoRegistry, address, address, address));\n\n if (_unwrappedOutput != address(0)) {\n outputToken = IERC20Upgradeable(_unwrappedOutput);\n } else {\n outputToken = IERC20Upgradeable(outputTokenAddress);\n }\n\n if (_unwrappedInput != address(0)) {\n inputToken.approve(address(inputToken), inputAmount);\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n inputToken = IERC20Upgradeable(_unwrappedInput);\n }\n\n address inputTokenAddress = address(inputToken);\n\n ICurvePool curvePool;\n int128 i;\n int128 j;\n if (address(curveV2Oracle) != address(0)) {\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, address(outputToken));\n }\n require(address(curvePool) != address(0), \"!curve pool\");\n\n inputToken.approve(address(curvePool), inputAmount);\n outputAmount = curvePool.exchange(i, j, inputAmount, 0);\n\n if (_unwrappedOutput != address(0)) {\n IERC20Upgradeable(_unwrappedOutput).approve(address(outputTokenAddress), outputAmount);\n IERC4626(outputTokenAddress).deposit(outputAmount, address(this));\n outputToken = IERC20Upgradeable(outputTokenAddress);\n }\n\n outputAmount = outputToken.balanceOf(address(this));\n return (outputToken, outputAmount);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"CurveSwapLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/CurveSwapLiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CurveSwapLiquidator.sol\";\nimport \"./IFundsConversionStrategy.sol\";\n\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\ncontract CurveSwapLiquidatorFunder is CurveSwapLiquidator, IFundsConversionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable, uint256) {\n ICurvePool curvePool;\n int128 i;\n int128 j;\n {\n (\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle,\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\n address inputTokenAddress,\n address outputTokenAddress,\n\n ) = abi.decode(\n strategyData,\n (CurveLpTokenPriceOracleNoRegistry, CurveV2LpTokenPriceOracleNoRegistry, address, address, address)\n );\n\n if (address(curveV2Oracle) != address(0)) {\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\n }\n if (address(curvePool) == address(0)) {\n (curvePool, i, j) = curveV1Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\n }\n }\n require(address(curvePool) != address(0), \"!curve pool\");\n\n IERC20MetadataUpgradeable inputMetadataToken = IERC20MetadataUpgradeable(curvePool.coins(uint256(int256(i))));\n uint256 inputAmountGuesstimate = guesstimateInputAmount(curvePool, i, j, inputMetadataToken, outputAmount);\n uint256 inputAmount = binSearch(\n curvePool,\n i,\n j,\n (70 * inputAmountGuesstimate) / 100,\n (130 * inputAmountGuesstimate) / 100,\n outputAmount\n );\n\n return (inputMetadataToken, inputAmount);\n }\n\n function guesstimateInputAmount(\n ICurvePool curvePool,\n int128 i,\n int128 j,\n IERC20MetadataUpgradeable inputMetadataToken,\n uint256 outputAmount\n ) internal view returns (uint256) {\n uint256 oneInputToken = 10 ** inputMetadataToken.decimals();\n uint256 outputTokensForOneInputToken = curvePool.get_dy(i, j, oneInputToken);\n // inputAmount / outputAmount = oneInputToken / outputTokensForOneInputToken\n uint256 inputAmount = (outputAmount * oneInputToken) / outputTokensForOneInputToken;\n return inputAmount;\n }\n\n function binSearch(\n ICurvePool curvePool,\n int128 i,\n int128 j,\n uint256 low,\n uint256 high,\n uint256 value\n ) internal view returns (uint256) {\n if (low >= high) return low;\n\n uint256 mid = (low + high) / 2;\n uint256 outputAmount = curvePool.get_dy(i, j, mid);\n if (outputAmount == 0) revert(\"output amount 0\");\n // output can be up to 10% in excess\n if (outputAmount >= value && outputAmount <= (11 * value) / 10) return mid;\n else if (outputAmount > value) {\n return binSearch(curvePool, i, j, low, mid, value);\n } else {\n return binSearch(curvePool, i, j, mid, high, value);\n }\n }\n\n function name() public pure override(CurveSwapLiquidator, IRedemptionStrategy) returns (string memory) {\n return \"CurveSwapLiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/ERC4626Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\n\n/**\n * @title ERC4626Liquidator\n * @notice Redeems ERC4626 assets and optionally swaps them via Uniswap V2 router for use as a step in a liquidation.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract ERC4626Liquidator is IRedemptionStrategy {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IERC20Upgradeable _outputToken, uint24 fee, ISwapRouter swapRouter, address[] memory underlyingTokens, ) = abi\n .decode(strategyData, (IERC20Upgradeable, uint24, ISwapRouter, address[], Quoter));\n\n if (underlyingTokens.length == 1) {\n // If there is only one underlying token, we can just redeem it directly\n require(\n address(_outputToken) == underlyingTokens[0],\n \"ERC4626Liquidator: output token does not match underlying token\"\n );\n\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n outputAmount = IERC20Upgradeable(_outputToken).balanceOf(address(this));\n\n return (_outputToken, outputAmount);\n } else {\n // NOTE: for Sommelier, the underlying tokens can be fetched from the Sommelier contract\n // E.g. https://etherscan.io/address/0x6b7f87279982d919bbf85182ddeab179b366d8f2#readContract#F20\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n\n // for each token, we need to swap it for the output token\n for (uint256 i = 0; i < underlyingTokens.length; i++) {\n // do nothing if the token is the output token\n if (underlyingTokens[i] == address(_outputToken)) {\n continue;\n }\n if (IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)) == 0) {\n continue;\n }\n _swap(\n underlyingTokens[i],\n IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)),\n address(_outputToken),\n swapRouter,\n fee\n );\n }\n outputAmount = _outputToken.balanceOf(address(this));\n return (_outputToken, outputAmount);\n }\n }\n\n function _swap(\n address inputToken,\n uint256 inputAmount,\n address outputToken,\n ISwapRouter swapRouter,\n uint24 fee\n ) internal returns (uint256 outputAmount) {\n IERC20Upgradeable(inputToken).approve(address(swapRouter), inputAmount);\n\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams(\n address(inputToken),\n outputToken,\n fee,\n address(this),\n block.timestamp,\n inputAmount,\n 0,\n 0\n );\n outputAmount = swapRouter.exactInputSingle(params);\n }\n\n function name() public pure returns (string memory) {\n return \"ERC4626Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFundsConversionStrategy is IRedemptionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\n}\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @title IRedemptionStrategy\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function name() external view returns (string memory);\n}\n" + }, + "contracts/liquidators/KimUniV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./BaseUniswapV2Liquidator.sol\";\n\ncontract KimUniV2Liquidator is BaseUniswapV2Liquidator {\n function _swap(\n IUniswapV2Router02 uniswapV2Router,\n uint256 inputAmount,\n address[] memory swapPath\n ) internal override {\n uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n inputAmount,\n 0,\n swapPath,\n address(this),\n address(0), // referrer\n block.timestamp\n );\n }\n\n function name() public pure virtual returns (string memory) {\n return \"KimUniV2Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/registry/ILiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ILiquidatorsRegistryStorage {\n function redemptionStrategiesByName(string memory name) external view returns (IRedemptionStrategy);\n\n function redemptionStrategiesByTokens(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy);\n\n function defaultOutputToken(IERC20Upgradeable inputToken) external view returns (IERC20Upgradeable);\n\n function owner() external view returns (address);\n\n function uniswapV3Fees(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external view returns (uint24);\n\n function customUniV3Router(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (address);\n}\n\ninterface ILiquidatorsRegistryExtension {\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory);\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\n\n function getRedemptionStrategy(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy strategy, bytes memory strategyData);\n\n function getAllRedemptionStrategies() external view returns (address[] memory);\n\n function getSlippage(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (uint256 slippage);\n\n function swap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256);\n\n function amountOutAndSlippageOfSwap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256 outputAmount, uint256 slippage);\n}\n\ninterface ILiquidatorsRegistrySecondExtension {\n function getAllPairsStrategies()\n external\n view\n returns (\n IRedemptionStrategy[] memory strategies,\n IERC20Upgradeable[] memory inputTokens,\n IERC20Upgradeable[] memory outputTokens\n );\n\n function pairsStrategiesMatch(\n IRedemptionStrategy[] calldata configStrategies,\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens\n ) external view returns (bool);\n\n function uniswapPairsFeesMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n uint256[] calldata configFees\n ) external view returns (bool);\n\n function uniswapPairsRoutersMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n address[] calldata configRouters\n ) external view returns (bool);\n\n function _setRedemptionStrategy(\n IRedemptionStrategy strategy,\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external;\n\n function _setRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external;\n\n function _resetRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external;\n\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external;\n\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external;\n\n function _setUniswapV3Fees(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint24[] calldata fees\n ) external;\n\n function _setUniswapV3Routers(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n address[] calldata routers\n ) external;\n\n function _setSlippages(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint256[] calldata slippages\n ) external;\n\n function optimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IERC20Upgradeable[] memory);\n\n function _setOptimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken,\n IERC20Upgradeable[] calldata optimalPath\n ) external;\n\n function wrappedToUnwrapped4626(address wrapped) external view returns (address);\n\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external;\n\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24);\n\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external;\n\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool);\n\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external;\n}\n\ninterface ILiquidatorsRegistry is\n ILiquidatorsRegistryExtension,\n ILiquidatorsRegistrySecondExtension,\n ILiquidatorsRegistryStorage\n{}\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\nimport \"./LiquidatorsRegistryExtension.sol\";\n\ncontract LiquidatorsRegistry is LiquidatorsRegistryStorage, DiamondBase {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(AddressesProvider _ap) SafeOwnable() {\n ap = _ap;\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace)\n public\n override\n onlyOwner\n {\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n\n function asExtension() public view returns (LiquidatorsRegistryExtension) {\n return LiquidatorsRegistryExtension(address(this));\n }\n}\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistryExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"./ILiquidatorsRegistry.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\n\nimport \"../IRedemptionStrategy.sol\";\nimport \"../../ionic/DiamondExtension.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\n\nimport { IRouter_Aerodrome as IAerodromeV2Router } from \"../../external/aerodrome/IAerodromeRouter.sol\";\nimport { IRouter_Velodrome as IVelodromeV2Router } from \"../../external/velodrome/IVelodromeRouter.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract LiquidatorsRegistryExtension is LiquidatorsRegistryStorage, DiamondExtension, ILiquidatorsRegistryExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n error NoRedemptionPath();\n error OutputTokenMismatch();\n\n event SlippageUpdated(\n IERC20Upgradeable indexed from,\n IERC20Upgradeable indexed to,\n uint256 prevValue,\n uint256 newValue\n );\n\n // @notice maximum slippage in swaps, in bps\n uint256 public constant MAX_SLIPPAGE = 900; // 9%\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 7;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.getRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this.getInputTokensByOutputToken.selector;\n functionSelectors[--fnsCount] = this.swap.selector;\n functionSelectors[--fnsCount] = this.getAllRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.amountOutAndSlippageOfSwap.selector;\n functionSelectors[--fnsCount] = this.getSlippage.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function getSlippage(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (uint256 slippage) {\n slippage = conversionSlippage[inputToken][outputToken];\n // TODO slippage == 0 should be allowed\n if (slippage == 0) return MAX_SLIPPAGE;\n }\n\n function getAllRedemptionStrategies() public view returns (address[] memory) {\n return redemptionStrategies.values();\n }\n\n function amountOutAndSlippageOfSwap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256 outputAmount, uint256 slippage) {\n if (inputAmount == 0) return (0, 0);\n\n outputAmount = swap(inputToken, inputAmount, outputToken);\n if (outputAmount == 0) return (0, 0);\n\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n uint256 inputTokenPrice = mpo.price(address(inputToken));\n uint256 outputTokenPrice = mpo.price(address(outputToken));\n\n uint256 inputTokensValue = inputAmount * toScaledPrice(inputTokenPrice, inputToken);\n uint256 outputTokensValue = outputAmount * toScaledPrice(outputTokenPrice, outputToken);\n\n if (outputTokensValue < inputTokensValue) {\n slippage = ((inputTokensValue - outputTokensValue) * 10000) / inputTokensValue;\n }\n // min slippage should be non-zero\n // just in case of rounding errors\n slippage += 1;\n\n // cache the slippage\n uint256 prevValue = conversionSlippage[inputToken][outputToken];\n if (prevValue == 0 || block.timestamp - conversionSlippageUpdated[inputToken][outputToken] > 5000) {\n emit SlippageUpdated(inputToken, outputToken, prevValue, slippage);\n\n conversionSlippage[inputToken][outputToken] = slippage;\n conversionSlippageUpdated[inputToken][outputToken] = block.timestamp;\n }\n }\n\n /// @dev returns price scaled to 1e36 - decimals\n function toScaledPrice(uint256 unscaledPrice, IERC20Upgradeable token) internal view returns (uint256) {\n uint256 tokenDecimals = uint256(ERC20Upgradeable(address(token)).decimals());\n return\n tokenDecimals <= 18\n ? uint256(unscaledPrice) * (10 ** (18 - tokenDecimals))\n : uint256(unscaledPrice) / (10 ** (tokenDecimals - 18));\n }\n\n function swap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) public returns (uint256 outputAmount) {\n inputToken.safeTransferFrom(msg.sender, address(this), inputAmount);\n outputAmount = convertAllTo(inputToken, outputToken);\n outputToken.safeTransfer(msg.sender, outputAmount);\n }\n\n function convertAllTo(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) private returns (uint256) {\n uint256 inputAmount = inputToken.balanceOf(address(this));\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = getRedemptionStrategies(\n inputToken,\n outputToken\n );\n\n if (redemptionStrategies.length == 0) revert NoRedemptionPath();\n\n IERC20Upgradeable swapInputToken = inputToken;\n uint256 swapInputAmount = inputAmount;\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\n bytes memory strategyData = strategiesData[i];\n (IERC20Upgradeable swapOutputToken, uint256 swapOutputAmount) = convertCustomFunds(\n swapInputToken,\n swapInputAmount,\n redemptionStrategy,\n strategyData\n );\n swapInputAmount = swapOutputAmount;\n swapInputToken = swapOutputToken;\n }\n\n if (swapInputToken != outputToken) revert OutputTokenMismatch();\n return outputToken.balanceOf(address(this));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory) {\n return inputTokensByOutputToken[outputToken].values();\n }\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\n IERC20Upgradeable tokenToRedeem = inputToken;\n IERC20Upgradeable targetOutputToken = outputToken;\n IRedemptionStrategy[] memory strategiesTemp = new IRedemptionStrategy[](10);\n bytes[] memory strategiesDataTemp = new bytes[](10);\n IERC20Upgradeable[] memory tokenPath = new IERC20Upgradeable[](10);\n IERC20Upgradeable[] memory optimalPath = new IERC20Upgradeable[](0);\n uint256 optimalPathIterator = 0;\n\n uint256 k = 0;\n while (tokenToRedeem != targetOutputToken) {\n IERC20Upgradeable nextRedeemedToken;\n IRedemptionStrategy directStrategy = redemptionStrategiesByTokens[tokenToRedeem][targetOutputToken];\n if (address(directStrategy) != address(0)) {\n nextRedeemedToken = targetOutputToken;\n } else {\n // check if an optimal path is preconfigured\n if (optimalPath.length == 0 && _optimalSwapPath[tokenToRedeem][targetOutputToken].length != 0) {\n optimalPath = _optimalSwapPath[tokenToRedeem][targetOutputToken];\n }\n if (optimalPath.length != 0 && optimalPathIterator < optimalPath.length) {\n nextRedeemedToken = optimalPath[optimalPathIterator++];\n } else {\n // else if no optimal path is available, use the default\n nextRedeemedToken = defaultOutputToken[tokenToRedeem];\n }\n }\n\n // check if going in an endless loop\n for (uint256 i = 0; i < tokenPath.length; i++) {\n if (nextRedeemedToken == tokenPath[i]) break;\n }\n\n (IRedemptionStrategy strategy, bytes memory strategyData) = getRedemptionStrategy(\n tokenToRedeem,\n nextRedeemedToken\n );\n if (address(strategy) == address(0)) break;\n\n strategiesTemp[k] = strategy;\n strategiesDataTemp[k] = strategyData;\n tokenPath[k] = nextRedeemedToken;\n tokenToRedeem = nextRedeemedToken;\n\n k++;\n if (k == 10) break;\n }\n\n strategies = new IRedemptionStrategy[](k);\n strategiesData = new bytes[](k);\n\n for (uint8 i = 0; i < k; i++) {\n strategies[i] = strategiesTemp[i];\n strategiesData[i] = strategiesDataTemp[i];\n }\n }\n\n function getRedemptionStrategy(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public view returns (IRedemptionStrategy strategy, bytes memory strategyData) {\n strategy = redemptionStrategiesByTokens[inputToken][outputToken];\n\n if (isStrategy(strategy, \"UniswapV2LiquidatorFunder\") || isStrategy(strategy, \"KimUniV2Liquidator\")) {\n strategyData = uniswapV2LiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"UniswapV3LiquidatorFunder\")) {\n strategyData = uniswapV3LiquidatorFunderData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AlgebraSwapLiquidator\")) {\n strategyData = algebraSwapLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AerodromeV2Liquidator\")) {\n strategyData = aerodromeV2LiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AerodromeCLLiquidator\")) {\n strategyData = aerodromeCLLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"CurveSwapLiquidator\")) {\n strategyData = curveSwapLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"VelodromeV2Liquidator\")) {\n strategyData = velodromeV2LiquidatorData(inputToken, outputToken);\n } else {\n revert(\"no strategy data\");\n }\n }\n\n function isStrategy(IRedemptionStrategy strategy, string memory name) internal view returns (bool) {\n return address(strategy) != address(0) && address(strategy) == address(redemptionStrategiesByName[name]);\n }\n\n function pickPreferredToken(address[] memory tokens, address strategyOutputToken) internal view returns (address) {\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == strategyOutputToken) return strategyOutputToken;\n }\n address wnative = ap.getAddress(\"wtoken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wnative) return wnative;\n }\n address stableToken = ap.getAddress(\"stableToken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == stableToken) return stableToken;\n }\n address wbtc = ap.getAddress(\"wBTCToken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wbtc) return wbtc;\n }\n return tokens[0];\n }\n\n function getUniswapV3Router(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (address) {\n address customRouter = customUniV3Router[inputToken][outputToken];\n if (customRouter == address(0)) {\n customRouter = customUniV3Router[outputToken][inputToken];\n }\n\n if (customRouter != address(0)) {\n return customRouter;\n } else {\n // get asset specific router or default\n return ap.getAddress(\"UNISWAP_V3_ROUTER\");\n }\n }\n\n function getUniswapV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"IUniswapV2Router02\");\n }\n\n function getAerodromeV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"AERODROME_V2_ROUTER\");\n }\n\n function getAerodromeCLRouter(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"AERODROME_CL_ROUTER\");\n }\n\n function uniswapV3LiquidatorFunderData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n uint24 fee = uniswapV3Fees[inputToken][outputToken];\n if (fee == 0) fee = uniswapV3Fees[outputToken][inputToken];\n if (fee == 0) fee = 500;\n\n address router = getUniswapV3Router(inputToken, outputToken);\n strategyData = abi.encode(inputToken, outputToken, fee, router, ap.getAddress(\"Quoter\"));\n }\n\n function getWrappedToUnwrapped4626(IERC20Upgradeable inputToken) internal view returns (address) {\n return _wrappedToUnwrapped4626[address(inputToken)];\n }\n\n function getAeroCLTickSpacing(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (int24) {\n int24 tickSpacing = _aeroCLTickSpacings[address(inputToken)][address(outputToken)];\n if (tickSpacing == 0) {\n tickSpacing = 1;\n }\n return tickSpacing;\n }\n\n function aeroV2IsStable(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) internal view returns (bool) {\n return _aeroV2IsStable[address(inputToken)][address(outputToken)];\n }\n\n function uniswapV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IERC20Upgradeable[] memory swapPath = new IERC20Upgradeable[](2);\n swapPath[0] = inputToken;\n swapPath[1] = outputToken;\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\n }\n\n function aerodromeV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IAerodromeV2Router.Route[] memory swapPath = new IAerodromeV2Router.Route[](1);\n swapPath[0] = IAerodromeV2Router.Route({\n from: address(inputToken),\n to: address(outputToken),\n stable: aeroV2IsStable(inputToken, outputToken),\n factory: ap.getAddress(\"AERODROME_V2_FACTORY\")\n });\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\n }\n\n function aerodromeCLLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(\n inputToken,\n outputToken,\n getAerodromeCLRouter(inputToken),\n getWrappedToUnwrapped4626(inputToken),\n getWrappedToUnwrapped4626(outputToken),\n getAeroCLTickSpacing(inputToken, outputToken)\n );\n }\n\n function algebraSwapLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(outputToken, ap.getAddress(\"ALGEBRA_SWAP_ROUTER\"));\n }\n\n function curveSwapLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(\n ap.getAddress(\"CURVE_V2_ORACLE_NO_REGISTRY\"),\n outputToken,\n getWrappedToUnwrapped4626(inputToken),\n getWrappedToUnwrapped4626(outputToken)\n );\n }\n\n function velodromeV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IVelodromeV2Router.Route[] memory swapPath = new IVelodromeV2Router.Route[](1);\n swapPath[0] = IVelodromeV2Router.Route({\n from: address(inputToken),\n to: address(outputToken),\n stable: aeroV2IsStable(inputToken, outputToken)\n });\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\n }\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistrySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"./ILiquidatorsRegistry.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\n\nimport \"../../ionic/DiamondExtension.sol\";\n\ncontract LiquidatorsRegistrySecondExtension is\n LiquidatorsRegistryStorage,\n DiamondExtension,\n ILiquidatorsRegistrySecondExtension\n{\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 20;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getAllPairsStrategies.selector;\n functionSelectors[--fnsCount] = this.pairsStrategiesMatch.selector;\n functionSelectors[--fnsCount] = this.uniswapPairsFeesMatch.selector;\n functionSelectors[--fnsCount] = this.uniswapPairsRoutersMatch.selector;\n functionSelectors[--fnsCount] = this._setSlippages.selector;\n functionSelectors[--fnsCount] = this._setUniswapV3Fees.selector;\n functionSelectors[--fnsCount] = this._setUniswapV3Routers.selector;\n functionSelectors[--fnsCount] = this._setDefaultOutputToken.selector;\n functionSelectors[--fnsCount] = this._setRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this._setRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this._removeRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this._resetRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.optimalSwapPath.selector;\n functionSelectors[--fnsCount] = this._setOptimalSwapPath.selector;\n functionSelectors[--fnsCount] = this.wrappedToUnwrapped4626.selector;\n functionSelectors[--fnsCount] = this.aeroCLTickSpacings.selector;\n functionSelectors[--fnsCount] = this.aeroV2IsStable.selector;\n functionSelectors[--fnsCount] = this._setWrappedToUnwrapped4626.selector;\n functionSelectors[--fnsCount] = this._setAeroCLTickSpacings.selector;\n functionSelectors[--fnsCount] = this._setAeroV2IsStable.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function _setSlippages(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint256[] calldata slippages\n ) external onlyOwner {\n require(slippages.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < slippages.length; i++) {\n conversionSlippage[inputTokens[i]][outputTokens[i]] = slippages[i];\n }\n }\n\n function _setUniswapV3Fees(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint24[] calldata fees\n ) external onlyOwner {\n require(fees.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < fees.length; i++) {\n uniswapV3Fees[inputTokens[i]][outputTokens[i]] = fees[i];\n }\n }\n\n function _setUniswapV3Routers(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n address[] calldata routers\n ) external onlyOwner {\n require(routers.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < routers.length; i++) {\n customUniV3Router[inputTokens[i]][outputTokens[i]] = routers[i];\n }\n }\n\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external onlyOwner {\n defaultOutputToken[inputToken] = outputToken;\n }\n\n function _setRedemptionStrategy(\n IRedemptionStrategy strategy,\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public onlyOwner {\n string memory name = strategy.name();\n IRedemptionStrategy oldStrategy = redemptionStrategiesByName[name];\n\n redemptionStrategiesByTokens[inputToken][outputToken] = strategy;\n redemptionStrategiesByName[name] = strategy;\n\n redemptionStrategies.remove(address(oldStrategy));\n redemptionStrategies.add(address(strategy));\n\n if (defaultOutputToken[inputToken] == IERC20Upgradeable(address(0))) {\n defaultOutputToken[inputToken] = outputToken;\n }\n inputTokensByOutputToken[outputToken].add(address(inputToken));\n outputTokensSet.add(address(outputToken));\n }\n\n function _setRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external onlyOwner {\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n for (uint256 i = 0; i < strategies.length; i++) {\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\n }\n }\n\n function _resetRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external onlyOwner {\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n // empty the input/output token mappings/sets\n address[] memory _outputTokens = outputTokensSet.values();\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\n }\n outputTokensSet.remove(_outputTokens[i]);\n }\n\n // empty the strategies mappings/sets\n address[] memory _currentStrategies = redemptionStrategies.values();\n for (uint256 i = 0; i < _currentStrategies.length; i++) {\n IRedemptionStrategy _currentStrategy = IRedemptionStrategy(_currentStrategies[i]);\n string memory _name = _currentStrategy.name();\n redemptionStrategiesByName[_name] = IRedemptionStrategy(address(0));\n redemptionStrategies.remove(_currentStrategies[i]);\n }\n\n // write the new strategies and their tokens configs\n for (uint256 i = 0; i < strategies.length; i++) {\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\n }\n }\n\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external onlyOwner {\n // check all the input/output tokens if they match the strategy to remove\n address[] memory _outputTokens = outputTokensSet.values();\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n IRedemptionStrategy _currentStrategy = redemptionStrategiesByTokens[_inputToken][_outputToken];\n\n // only nullify the input/output tokens config if the strategy matches\n if (_currentStrategy == strategyToRemove) {\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\n if (defaultOutputToken[_inputToken] == _outputToken) {\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\n }\n }\n }\n if (inputTokensByOutputToken[_outputToken].length() == 0) {\n outputTokensSet.remove(address(_outputToken));\n }\n }\n\n redemptionStrategiesByName[strategyToRemove.name()] = IRedemptionStrategy(address(0));\n redemptionStrategies.remove(address(strategyToRemove));\n }\n\n function uniswapPairsFeesMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n uint256[] calldata configFees\n ) external view returns (bool) {\n // find a match for each config fee\n for (uint256 i = 0; i < configFees.length; i++) {\n if (uniswapV3Fees[configInputTokens[i]][configOutputTokens[i]] != configFees[i]) return false;\n }\n\n return true;\n }\n\n function uniswapPairsRoutersMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n address[] calldata configRouters\n ) external view returns (bool) {\n // find a match for each config router\n for (uint256 i = 0; i < configRouters.length; i++) {\n if (customUniV3Router[configInputTokens[i]][configOutputTokens[i]] != configRouters[i]) return false;\n }\n\n return true;\n }\n\n function pairsStrategiesMatch(\n IRedemptionStrategy[] calldata configStrategies,\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens\n ) external view returns (bool) {\n (\n IRedemptionStrategy[] memory onChainStrategies,\n IERC20Upgradeable[] memory onChainInputTokens,\n IERC20Upgradeable[] memory onChainOutputTokens\n ) = getAllPairsStrategies();\n // find a match for each config strategy\n for (uint256 i = 0; i < configStrategies.length; i++) {\n bool foundMatch = false;\n for (uint256 j = 0; j < onChainStrategies.length; j++) {\n if (\n onChainStrategies[j] == configStrategies[i] &&\n onChainInputTokens[j] == configInputTokens[i] &&\n onChainOutputTokens[j] == configOutputTokens[i]\n ) {\n foundMatch = true;\n break;\n }\n }\n if (!foundMatch) return false;\n }\n\n // find a match for each on-chain strategy\n for (uint256 i = 0; i < onChainStrategies.length; i++) {\n bool foundMatch = false;\n for (uint256 j = 0; j < configStrategies.length; j++) {\n if (\n onChainStrategies[i] == configStrategies[j] &&\n onChainInputTokens[i] == configInputTokens[j] &&\n onChainOutputTokens[i] == configOutputTokens[j]\n ) {\n foundMatch = true;\n break;\n }\n }\n if (!foundMatch) return false;\n }\n\n return true;\n }\n\n function getAllPairsStrategies()\n public\n view\n returns (\n IRedemptionStrategy[] memory strategies,\n IERC20Upgradeable[] memory inputTokens,\n IERC20Upgradeable[] memory outputTokens\n )\n {\n address[] memory _outputTokens = outputTokensSet.values();\n uint256 pairsCounter = 0;\n\n {\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n pairsCounter += _inputTokens.length;\n }\n\n strategies = new IRedemptionStrategy[](pairsCounter);\n inputTokens = new IERC20Upgradeable[](pairsCounter);\n outputTokens = new IERC20Upgradeable[](pairsCounter);\n }\n\n pairsCounter = 0;\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n strategies[pairsCounter] = redemptionStrategiesByTokens[_inputToken][_outputToken];\n inputTokens[pairsCounter] = _inputToken;\n outputTokens[pairsCounter] = _outputToken;\n pairsCounter++;\n }\n }\n }\n\n function optimalSwapPath(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken)\n external\n view\n returns (IERC20Upgradeable[] memory)\n {\n return _optimalSwapPath[inputToken][outputToken];\n }\n\n function _setOptimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken,\n IERC20Upgradeable[] calldata optimalPath\n ) external onlyOwner {\n _optimalSwapPath[inputToken][outputToken] = optimalPath;\n }\n\n function wrappedToUnwrapped4626(address wrapped) external view returns (address) {\n return _wrappedToUnwrapped4626[wrapped];\n }\n\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24) {\n return _aeroCLTickSpacings[inputToken][outputToken];\n }\n\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool) {\n return _aeroV2IsStable[inputToken][outputToken];\n }\n\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external onlyOwner {\n _wrappedToUnwrapped4626[wrapped] = unwrapped;\n }\n\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external onlyOwner {\n _aeroCLTickSpacings[inputToken][outputToken] = tickSpacing;\n }\n\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external onlyOwner {\n _aeroV2IsStable[inputToken][outputToken] = isStable;\n }\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../IRedemptionStrategy.sol\";\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nabstract contract LiquidatorsRegistryStorage is SafeOwnable {\n AddressesProvider public ap;\n\n EnumerableSet.AddressSet internal redemptionStrategies;\n mapping(string => IRedemptionStrategy) public redemptionStrategiesByName;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IRedemptionStrategy)) public redemptionStrategiesByTokens;\n mapping(IERC20Upgradeable => IERC20Upgradeable) public defaultOutputToken;\n mapping(IERC20Upgradeable => EnumerableSet.AddressSet) internal inputTokensByOutputToken;\n EnumerableSet.AddressSet internal outputTokensSet;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippage;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippageUpdated;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint24)) public uniswapV3Fees;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => address)) public customUniV3Router;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IERC20Upgradeable[])) internal _optimalSwapPath;\n mapping(address => address) internal _wrappedToUnwrapped4626;\n mapping(address => mapping(address => int24)) internal _aeroCLTickSpacings;\n mapping(address => mapping(address => bool)) internal _aeroV2IsStable;\n}" + }, + "contracts/liquidators/UniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./BaseUniswapV2Liquidator.sol\";\n\n/**\n * @title UniswapV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Uniswap V2 router for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapV2Liquidator is BaseUniswapV2Liquidator {\n function _swap(\n IUniswapV2Router02 uniswapV2Router,\n uint256 inputAmount,\n address[] memory swapPath\n ) internal override {\n uniswapV2Router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"UniswapV2Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV2LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { UniswapV2Liquidator } from \"./UniswapV2Liquidator.sol\";\nimport \"./IFundsConversionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\n\ncontract UniswapV2LiquidatorFunder is UniswapV2Liquidator, IFundsConversionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount) {\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\n strategyData,\n (IUniswapV2Router02, address[])\n );\n require(swapPath.length >= 2, \"Invalid UniswapLiquidator swap path.\");\n\n uint256[] memory amounts = uniswapV2Router.getAmountsIn(outputAmount, swapPath);\n\n inputAmount = amounts[0];\n inputToken = IERC20Upgradeable(swapPath[0]);\n }\n\n function name() public pure override(UniswapV2Liquidator, IRedemptionStrategy) returns (string memory) {\n return \"UniswapV2LiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { IV3SwapRouter } from \"../external/uniswap/IV3SwapRouter.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract UniswapV3Liquidator is IRedemptionStrategy {\n /**\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\n * @param inputToken Address of the token\n * @param inputAmount input amount\n * @param strategyData context specific data like input token, pool address and tx expiratio period\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (, address _outputToken, uint24 fee, IV3SwapRouter swapRouter, ) = abi.decode(\n strategyData,\n (address, address, uint24, IV3SwapRouter, address)\n );\n outputToken = IERC20Upgradeable(_outputToken);\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n outputAmount = swapRouter.exactInputSingle(\n IV3SwapRouter.ExactInputSingleParams(\n address(inputToken),\n _outputToken,\n fee,\n address(this),\n inputAmount,\n 0,\n 0\n )\n );\n }\n\n function name() public pure virtual override returns (string memory) {\n return \"UniswapV3Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV3LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { IFundsConversionStrategy } from \"./IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport \"./UniswapV3Liquidator.sol\";\n\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\n\ncontract UniswapV3LiquidatorFunder is UniswapV3Liquidator, IFundsConversionStrategy {\n using FixedPointMathLib for uint256;\n\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n /**\n * @dev Estimates the needed input amount of the input token for the conversion to return the desired output amount.\n * @param outputAmount the desired output amount\n * @param strategyData the input token\n */\n function estimateInputAmount(uint256 outputAmount, bytes memory strategyData)\n external\n view\n returns (IERC20Upgradeable inputToken, uint256 inputAmount)\n {\n (address _inputToken, address _outputToken, uint24 fee, , Quoter quoter) = abi.decode(\n strategyData,\n (address, address, uint24, IV3SwapRouter, Quoter)\n );\n\n inputAmount = quoter.estimateMinSwapUniswapV3(_inputToken, _outputToken, outputAmount, fee);\n inputToken = IERC20Upgradeable(_inputToken);\n }\n\n function name() public pure override(UniswapV3Liquidator, IRedemptionStrategy) returns (string memory) {\n return \"UniswapV3LiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/VelodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\n\n/**\n * @title VelodromeV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Velodrome V2 router for use as a step in a liquidation.\n */\ncontract VelodromeV2Liquidator {\n function _swap(IRouter_Velodrome router, uint256 inputAmount, IRouter_Velodrome.Route[] memory swapPath) internal {\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"VelodromeV2Liquidator\";\n }\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IRouter_Velodrome router, IRouter_Velodrome.Route[] memory swapPath) = abi.decode(\n strategyData,\n (IRouter_Velodrome, IRouter_Velodrome.Route[])\n );\n require(\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\n \"Invalid VelodromeV2Liquidator swap path.\"\n );\n\n // Swap underlying tokens\n inputToken.approve(address(router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\n outputAmount = outputToken.balanceOf(address(this));\n }\n}\n" + }, + "contracts/oracles/1337/MockPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title MockPriceOracle\n * @notice Returns mocked prices from a Chainlink-like oracle. Used for local dev only\n * @dev Implements `PriceOracle`.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract MockPriceOracle is BasePriceOracle {\n /**\n * @notice The maximum number of seconds elapsed since the round was last updated before the price is considered stale. If set to 0, no limit is enforced.\n */\n uint256 public maxSecondsBeforePriceIsStale;\n\n /**\n * @dev Constructor to set `maxSecondsBeforePriceIsStale` as well as all Chainlink price feeds.\n */\n constructor(uint256 _maxSecondsBeforePriceIsStale) {\n // Set maxSecondsBeforePriceIsStale\n maxSecondsBeforePriceIsStale = _maxSecondsBeforePriceIsStale;\n }\n\n /**\n * @dev Returns a boolean indicating if a price feed exists for the underlying asset.\n */\n\n function hasPriceFeed(address underlying) external pure returns (bool) {\n return true;\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n */\n\n function random() private view returns (uint256) {\n uint256 r = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 99;\n r = r + 1;\n return r;\n }\n\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) return 1e18;\n\n int256 tokenEthPrice = 1;\n uint256 r = random();\n\n return ((uint256(tokenEthPrice) * 1e18) / r) / 1e18;\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n return 1e18;\n }\n}\n" + }, + "contracts/oracles/1337/MockRevertPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title MockRevertPriceOracle\n * @notice Mocks a failing price oracle. Used for testing purposes only\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract MockRevertPriceOracle is BasePriceOracle {\n constructor() {}\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n revert(\"MockPriceOracle: price function is failing.\");\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n revert(\"MockPriceOracle: getUnderlyingPrice function is failing.\");\n }\n}\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../compound/CTokenInterfaces.sol\";\n\n/**\n * @title BasePriceOracle\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\n * @dev Implements the `PriceOracle` interface.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface BasePriceOracle {\n /**\n * @notice Get the price of an underlying asset.\n * @param underlying The underlying asset to get the price of.\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function price(address underlying) external view returns (uint256);\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\n}\n" + }, + "contracts/oracles/default/AerodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface BasePrices {\n function getManyRatesWithConnectors(\n uint8 src_len,\n address[] memory connectors\n ) external view returns (uint256[] memory rates);\n}\n\ncontract AerodromePriceOracle is BasePriceOracle {\n BasePrices immutable prices;\n address constant WETH = 0x4200000000000000000000000000000000000006;\n\n constructor(address _prices) {\n prices = BasePrices(_prices);\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n address[] memory connectors = new address[](2);\n connectors[0] = token;\n connectors[1] = WETH;\n return prices.getManyRatesWithConnectors(1, connectors)[0];\n }\n}\n" + }, + "contracts/oracles/default/API3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IProxy } from \"../../external/api3/IProxy.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title API3PriceOracle\n * @notice Returns prices from Api3.\n * @dev Implements `PriceOracle`.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract API3PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => IProxy) public proxies;\n\n /**\n * @notice Chainlink NATIVE/USD price feed contracts.\n */\n address public NATIVE_TOKEN_USD_PRICE_FEED;\n\n /**\n * @notice The USD Token of the chain\n */\n address public USD_TOKEN;\n\n /**\n * @dev Constructor to set wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\n __SafeOwnable_init(msg.sender);\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Constructor to set wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function reinitialize(address _usdToken, address nativeTokenUsd) public onlyOwnerOrAdmin {\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\n */\n function setPriceFeeds(address[] memory underlyings, address[] memory feeds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n proxies[underlying] = IProxy(feeds[i]);\n }\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n IProxy proxy = proxies[underlying];\n require(address(proxy) != address(0), \"No API3 price feed found for this underlying ERC20 token.\");\n\n uint256 nativeTokenUsdPrice;\n\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\n // get the USDX/USD price from the MPO\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\n } else {\n (int224 nativeTokenUsdPrice224, ) = IProxy(NATIVE_TOKEN_USD_PRICE_FEED).read();\n if (nativeTokenUsdPrice224 <= 0) {\n revert(\"API3PriceOracle: native token price <= 0\");\n }\n nativeTokenUsdPrice = uint256(uint224(nativeTokenUsdPrice224));\n }\n (int224 tokenUsdPrice, ) = proxy.read();\n\n if (tokenUsdPrice <= 0) {\n revert(\"API3PriceOracle: token price <= 0\");\n }\n\n return (uint256(uint224(tokenUsdPrice)) * 1e18) / nativeTokenUsdPrice;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ChainlinkPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title ChainlinkPriceOracleV2\n * @notice Returns prices from Chainlink.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract ChainlinkPriceOracleV2 is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => AggregatorV3Interface) public priceFeeds;\n\n /**\n * @notice Maps ERC20 token addresses to enums indicating the base currency of the feed.\n */\n mapping(address => FeedBaseCurrency) public feedBaseCurrencies;\n\n /**\n * @notice Enum indicating the base currency of a Chainlink price feed.\n * @dev ETH is interchangeable with the nativeToken of the current chain.\n */\n enum FeedBaseCurrency {\n ETH,\n USD\n }\n\n /**\n * @notice Chainlink NATIVE/USD price feed contracts.\n */\n address public NATIVE_TOKEN_USD_PRICE_FEED;\n\n /**\n * @notice The USD Token of the chain\n */\n address public USD_TOKEN;\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\n __SafeOwnable_init(msg.sender);\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\n * @param baseCurrency The currency in which `feeds` are based.\n */\n function setPriceFeeds(\n address[] memory underlyings,\n address[] memory feeds,\n FeedBaseCurrency baseCurrency\n ) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeeds[underlying] = AggregatorV3Interface(feeds[i]);\n feedBaseCurrencies[underlying] = baseCurrency;\n }\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/ETH price from Chainlink\n AggregatorV3Interface feed = priceFeeds[underlying];\n require(address(feed) != address(0), \"No Chainlink price feed found for this underlying ERC20 token.\");\n FeedBaseCurrency baseCurrency = feedBaseCurrencies[underlying];\n\n if (baseCurrency == FeedBaseCurrency.ETH) {\n (, int256 tokenEthPrice, , , ) = feed.latestRoundData();\n return tokenEthPrice >= 0 ? (uint256(tokenEthPrice) * 1e18) / (10 ** uint256(feed.decimals())) : 0;\n } else if (baseCurrency == FeedBaseCurrency.USD) {\n int256 nativeTokenUsdPrice;\n uint8 usdPriceDecimals;\n\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n nativeTokenUsdPrice = int256(1e36 / usdNativeTokenPrice); // 18 decimals\n usdPriceDecimals = 18;\n } else {\n (, nativeTokenUsdPrice, , , ) = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).latestRoundData();\n if (nativeTokenUsdPrice <= 0) return 0;\n usdPriceDecimals = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).decimals();\n }\n (, int256 tokenUsdPrice, , , ) = feed.latestRoundData();\n\n return\n tokenUsdPrice >= 0\n ? ((uint256(tokenUsdPrice) * 1e18 * (10 ** uint256(usdPriceDecimals))) / (10 ** uint256(feed.decimals()))) /\n uint256(nativeTokenUsdPrice)\n : 0;\n } else {\n revert(\"unknown base currency\");\n }\n }\n\n /**\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ConcentratedLiquidityBasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"../../external/uniswap/FullMath.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title ConcentratedLiquidityBasePriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice ConcentratedLiquidityBasePriceOracle is an abstract price oracle for concentrated liquidty (UniV3-like) pairs.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\nabstract contract ConcentratedLiquidityBasePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to asset configs.\n */\n mapping(address => AssetConfig) public poolFeeds;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool public canAdminOverwrite;\n\n struct AssetConfig {\n address poolAddress;\n uint256 twapWindow;\n address baseToken;\n }\n\n address public WTOKEN;\n address[] public SUPPORTED_BASE_TOKENS;\n\n function initialize(address _wtoken, address[] memory _supportedBaseTokens) public initializer {\n __SafeOwnable_init(msg.sender);\n WTOKEN = _wtoken;\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param assetConfig The asset configuration which includes pool address and twap window.\n */\n function setPoolFeeds(address[] memory underlyings, AssetConfig[] memory assetConfig) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == assetConfig.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/config\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set asset config for underlying\n require(\n assetConfig[i].baseToken == WTOKEN || _isBaseTokenSupported(assetConfig[i].baseToken),\n \"Base token must be supported\"\n );\n poolFeeds[underlying] = assetConfig[i];\n }\n }\n\n /**\n * @notice Get the token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for WTOKEN)\n * @return Price denominated in NATIVE (scaled by 1e18)\n */\n function price(address underlying) external view returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in NATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in NATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the price for a token from Uniswap v3\n */\n function _price(address token) internal view virtual returns (uint256);\n\n function getPriceX96FromSqrtPriceX96(\n address token0,\n address priceToken,\n uint160 sqrtPriceX96\n ) public pure returns (uint256 price_) {\n price_ = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, uint256(2 ** (96 * 2)) / 1e18);\n if (token0 != priceToken) price_ = 1e36 / price_;\n }\n\n function _isBaseTokenSupported(address token) internal view returns (bool) {\n for (uint256 i = 0; i < SUPPORTED_BASE_TOKENS.length; i++) {\n if (SUPPORTED_BASE_TOKENS[i] == token) {\n return true;\n }\n }\n return false;\n }\n\n function _setSupportedBaseTokens(address[] memory _supportedBaseTokens) external onlyOwner {\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\n }\n\n function getSupportedBaseTokens() external view returns (address[] memory) {\n return SUPPORTED_BASE_TOKENS;\n }\n\n function scalePrices(address baseToken, address token, uint256 tokenPrice) internal view returns (uint256) {\n uint256 baseTokenDecimals;\n uint256 tokenPriceScaled;\n\n if (baseToken == address(0) || baseToken == WTOKEN) {\n baseTokenDecimals = 18;\n } else {\n baseTokenDecimals = uint256(ERC20Upgradeable(baseToken).decimals());\n }\n\n uint256 baseNativePrice = BasePriceOracle(msg.sender).price(baseToken);\n\n // scale tokenPrice by 1e18\n uint256 tokenDecimals = uint256(ERC20Upgradeable(token).decimals());\n if (baseTokenDecimals > tokenDecimals) {\n tokenPriceScaled = tokenPrice / (10 ** (baseTokenDecimals - tokenDecimals));\n } else if (baseTokenDecimals < tokenDecimals) {\n tokenPriceScaled = tokenPrice * (10 ** (tokenDecimals - baseTokenDecimals));\n } else {\n tokenPriceScaled = tokenPrice;\n }\n return (tokenPriceScaled * baseNativePrice) / 1e18;\n }\n}\n" + }, + "contracts/oracles/default/CurveLpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\n\nimport \"../../external/curve/ICurvePool.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracleNoRegistry\n * @author David Lucid (https://github.com/davidlucid)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract CurveLpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @dev Maps Curve LP token addresses to underlying token addresses.\n */\n mapping(address => address[]) public underlyingTokens;\n\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolOf;\n\n address[] public lpTokens;\n\n /**\n * @dev Initializes an array of LP tokens and pools if desired.\n * @param _lpTokens Array of LP token addresses.\n * @param _pools Array of pool addresses.\n * @param _poolUnderlyings The underlying token addresses of a pool\n */\n function initialize(\n address[] memory _lpTokens,\n address[] memory _pools,\n address[][] memory _poolUnderlyings\n ) public initializer {\n require(\n _lpTokens.length == _pools.length && _lpTokens.length == _poolUnderlyings.length,\n \"No LP tokens supplied or array lengths not equal.\"\n );\n\n __SafeOwnable_init(msg.sender);\n for (uint256 i = 0; i < _lpTokens.length; i++) {\n poolOf[_lpTokens[i]] = _pools[i];\n underlyingTokens[_lpTokens[i]] = _poolUnderlyings[i];\n }\n }\n\n function getAllLPTokens() public view returns (address[] memory) {\n return lpTokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < lpTokens.length; i++) {\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), 0, 0);\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token/ETH price from Curve, with 18 decimals of precision.\n * Source: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/CurveOracle.sol\n * @param lpToken The LP token contract address for price retrieval.\n */\n function _price(address lpToken) internal view returns (uint256) {\n address pool = poolOf[lpToken];\n require(pool != address(0), \"LP token is not registered.\");\n address[] memory tokens = underlyingTokens[lpToken];\n uint256 minPx = type(uint256).max;\n uint256 n = tokens.length;\n\n for (uint256 i = 0; i < n; i++) {\n address ulToken = tokens[i];\n uint256 tokenPx = BasePriceOracle(msg.sender).price(ulToken);\n if (tokenPx < minPx) minPx = tokenPx;\n }\n\n require(minPx != type(uint256).max, \"No minimum underlying token price found.\");\n return (minPx * ICurvePool(pool).get_virtual_price()) / 1e18; // Use min underlying token prices\n }\n\n /**\n * @dev Register the pool given LP token address and set the pool info.\n * @param _lpToken LP token to find the corresponding pool.\n * @param _pool Pool address.\n * @param _underlyings Underlying addresses.\n */\n function registerPool(\n address _lpToken,\n address _pool,\n address[] memory _underlyings\n ) external onlyOwner {\n poolOf[_lpToken] = _pool;\n underlyingTokens[_lpToken] = _underlyings;\n\n bool skip = false;\n for (uint256 j = 0; j < lpTokens.length; j++) {\n if (lpTokens[j] == _lpToken) {\n skip = true;\n break;\n }\n }\n if (!skip) lpTokens.push(_lpToken);\n }\n\n /**\n * @dev getter for the underlying tokens\n * @param lpToken the LP token address.\n * @return _underlyings Underlying addresses.\n */\n function getUnderlyingTokens(address lpToken) public view returns (address[] memory) {\n return underlyingTokens[lpToken];\n }\n}\n" + }, + "contracts/oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\n\nimport \"../../external/curve/ICurveV2Pool.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\n */\ncontract CurveV2LpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\n address public usdToken;\n MasterPriceOracle public masterPriceOracle;\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolOf;\n\n address[] public lpTokens;\n\n /**\n * @dev Initializes an array of LP tokens and pools if desired.\n * @param _lpTokens Array of LP token addresses.\n * @param _pools Array of pool addresses.\n */\n function initialize(address[] memory _lpTokens, address[] memory _pools) public initializer {\n require(_lpTokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\n __SafeOwnable_init(msg.sender);\n\n for (uint256 i = 0; i < _pools.length; i++) {\n poolOf[_lpTokens[i]] = _pools[i];\n }\n }\n\n function getAllLPTokens() public view returns (address[] memory) {\n return lpTokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < lpTokens.length; i++) {\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), int128(0), int128(0));\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\n * @param lpToken The LP token contract address for price retrieval.\n */\n function _price(address lpToken) internal view returns (uint256) {\n address pool = poolOf[lpToken];\n require(address(pool) != address(0), \"LP token is not registered.\");\n\n address baseToken = ICurvePool(pool).coins(0);\n uint256 lpPrice = ICurveV2Pool(pool).lp_price();\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n return (lpPrice * baseTokenPrice) / 10**18;\n }\n\n /**\n * @dev Register the pool given LP token address and set the pool info.\n * @param _lpToken LP token to find the corresponding pool.\n * @param _pool Pool address.\n */\n function registerPool(address _lpToken, address _pool) external onlyOwner {\n address pool = poolOf[_lpToken];\n require(pool == address(0), \"This LP token is already registered.\");\n poolOf[_lpToken] = _pool;\n\n bool skip = false;\n for (uint256 j = 0; j < lpTokens.length; j++) {\n if (lpTokens[j] == _lpToken) {\n skip = true;\n break;\n }\n }\n if (!skip) lpTokens.push(_lpToken);\n }\n}\n" + }, + "contracts/oracles/default/CurveV2PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\n\nimport \"../../external/curve/ICurveV2Pool.sol\";\n\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\n */\ncontract CurveV2PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolFor;\n\n address[] public tokens;\n\n /**\n * @dev Initializes an array of tokens and pools if desired.\n * @param _tokens Array of token addresses.\n * @param _pools Array of pool addresses.\n */\n function initialize(address[] memory _tokens, address[] memory _pools) public initializer {\n require(_tokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\n __SafeOwnable_init(msg.sender);\n\n for (uint256 i = 0; i < _pools.length; i++) {\n try ICurvePool(_pools[i]).coins(2) returns (address) {\n revert(\"!only two token pools\");\n } catch {\n // ignore error\n }\n\n poolFor[_tokens[i]] = _pools[i];\n }\n }\n\n function getAllSupportedTokens() public view returns (address[] memory) {\n return tokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < tokens.length; i++) {\n ICurvePool pool = ICurvePool(poolFor[tokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), int128(0), int128(0));\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\n * @param token The LP token contract address for price retrieval.\n */\n function _price(address token) internal view returns (uint256) {\n address pool = poolFor[token];\n require(address(pool) != address(0), \"Token is not registered.\");\n\n address baseToken;\n // Returns always coin(1) / coin(0) [ e.g. USDC (1) / eUSDC (1) ]\n uint256 exchangeRate = ICurveV2Pool(pool).price_oracle();\n\n if (ICurvePool(pool).coins(0) == token) {\n baseToken = ICurvePool(pool).coins(1);\n // USDC / ETH\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n // USDC / ETH * eUSDC / USDC = eUSDC / ETH\n return (baseTokenPrice * 10**18) / exchangeRate;\n } else {\n // if coin(1) is eUSDC, exchangeRate is USDC / eUSDC\n baseToken = ICurvePool(pool).coins(0);\n // USDC / ETH\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n // (USDC / ETH) * (1 / (USDC / eUSDC)) = eUSDC / ETH\n return (baseTokenPrice * exchangeRate) / 10**18;\n }\n }\n\n /**\n * @dev Register the pool given token address and set the pool info.\n * @param _token token to find the corresponding pool.\n * @param _pool Pool address.\n */\n function registerPool(address _token, address _pool) external onlyOwner {\n try ICurvePool(_pool).coins(2) returns (address) {\n revert(\"!only two token pools\");\n } catch {\n // ignore error\n }\n\n address pool = poolFor[_token];\n require(pool == address(0), \"This LP token is already registered.\");\n poolFor[_token] = _pool;\n\n bool skip = false;\n for (uint256 j = 0; j < tokens.length; j++) {\n if (tokens[j] == _token) {\n skip = true;\n break;\n }\n }\n if (!skip) tokens.push(_token);\n }\n}\n" + }, + "contracts/oracles/default/DiaPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IPriceOracle } from \"../../external/compound/IPriceOracle.sol\";\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\n\ninterface DIAOracleV2 {\n function getValue(string memory key) external view returns (uint128, uint128);\n}\n\n/**\n * @title DiaPriceOracle\n * @notice Returns prices from DIA.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract DiaPriceOracle is BasePriceOracle {\n struct DiaOracle {\n DIAOracleV2 feed;\n string key;\n }\n\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => DiaOracle) public priceFeeds;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool public immutable CAN_ADMIN_OVERWRITE;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public immutable WTOKEN;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n DIAOracleV2 public immutable NATIVE_TOKEN_USD_PRICE_FEED;\n string public NATIVE_TOKEN_USD_KEY;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n MasterPriceOracle public immutable MASTER_PRICE_ORACLE;\n address public immutable USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n constructor(\n address _admin,\n bool canAdminOverwrite,\n address wtoken,\n DIAOracleV2 nativeTokenUsd,\n string memory nativeTokenUsdKey,\n MasterPriceOracle masterPriceOracle,\n address usdToken\n ) {\n admin = _admin;\n CAN_ADMIN_OVERWRITE = canAdminOverwrite;\n WTOKEN = wtoken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n NATIVE_TOKEN_USD_KEY = nativeTokenUsdKey;\n MASTER_PRICE_ORACLE = masterPriceOracle;\n USD_TOKEN = usdToken;\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The DIA price feed contract addresses for each of `underlyings`.\n * @param keys The keys for each of `underlyings`, in the format \"ETH/USD\" for example\n */\n function setPriceFeeds(\n address[] memory underlyings,\n DIAOracleV2[] memory feeds,\n string[] memory keys\n ) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length && underlyings.length == keys.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n\n // Check for existing oracle if !canAdminOverwrite\n if (!CAN_ADMIN_OVERWRITE)\n require(\n address(priceFeeds[underlying].feed) == address(0),\n \"Admin cannot overwrite existing assignments of price feeds to underlying tokens.\"\n );\n\n // Set feed and base currency\n priceFeeds[underlying] = DiaOracle({ feed: feeds[i], key: keys[i] });\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals!\n */\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for WTOKEN\n if (underlying == WTOKEN || underlying == address(0)) return 1e18;\n\n // Get token/Native price from Oracle\n DiaOracle memory feed = priceFeeds[underlying];\n require(address(feed.feed) != address(0), \"No oracle price feed found for this underlying ERC20 token.\");\n\n if (address(NATIVE_TOKEN_USD_PRICE_FEED) == address(0)) {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = MASTER_PRICE_ORACLE.price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\n } else {\n (uint128 nativeTokenUsdPrice, ) = NATIVE_TOKEN_USD_PRICE_FEED.getValue(NATIVE_TOKEN_USD_KEY);\n if (nativeTokenUsdPrice <= 0) return 0;\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ERC4626Oracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IERC4626 } from \"../../compound/IERC4626.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\ncontract ERC4626Oracle is SafeOwnableUpgradeable, BasePriceOracle {\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token/ETH price from Balancer, with 18 decimals of precision.\n */\n function _price(address underlying) internal view virtual returns (uint256) {\n IERC4626 vault = IERC4626(underlying);\n address asset = vault.asset();\n uint256 redeemAmount = vault.previewRedeem(10 ** vault.decimals());\n uint256 underlyingPrice = BasePriceOracle(msg.sender).price(asset);\n return (redeemAmount * underlyingPrice) / 10 ** ERC20Upgradeable(asset).decimals();\n }\n}\n" + }, + "contracts/oracles/default/FixedNativePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title FixedEthPriceOracle\n * @notice Returns fixed prices of 1 denominated in the chain's native token for all tokens (expected to be used under a `MasterPriceOracle`).\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract FixedNativePriceOracle is BasePriceOracle {\n /**\n * @dev Returns the price in native token of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return 1e18;\n }\n\n /**\n * @notice Returns the price in native token of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in native token of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n return 1e18;\n }\n}\n" + }, + "contracts/oracles/default/FixedTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title FixedTokenPriceOracle\n * @notice Returns token prices using the prices for another token.\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract FixedTokenPriceOracle is BasePriceOracle {\n /**\n * @dev The token to base prices on.\n */\n address public immutable baseToken;\n\n /**\n * @dev Sets the token to base prices on.\n */\n constructor(address _baseToken) {\n baseToken = _baseToken;\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return BasePriceOracle(msg.sender).price(baseToken);\n }\n}\n" + }, + "contracts/oracles/default/PreferredPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\nimport \"../MasterPriceOracle.sol\";\nimport \"../default/ChainlinkPriceOracleV2.sol\";\n\n/**\n * @title PreferredPriceOracle\n * @notice Returns prices from MasterPriceOracle, ChainlinkPriceOracleV2, or prices from a tertiary oracle (in order of preference).\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract PreferredPriceOracle is BasePriceOracle {\n /**\n * @dev The primary `MasterPriceOracle`.\n */\n MasterPriceOracle public masterOracle;\n\n /**\n * @dev The secondary `ChainlinkPriceOracleV2`.\n */\n ChainlinkPriceOracleV2 public chainlinkOracleV2;\n\n /**\n * @dev The tertiary `PriceOracle`.\n */\n BasePriceOracle public tertiaryOracle;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Constructor to set the primary `MasterPriceOracle`, the secondary `ChainlinkPriceOracleV2`, and the tertiary `PriceOracle`.\n */\n constructor(\n MasterPriceOracle _masterOracle,\n ChainlinkPriceOracleV2 _chainlinkOracleV2,\n BasePriceOracle _tertiaryOracle,\n address _wtoken\n ) {\n require(address(_masterOracle) != address(0), \"MasterPriceOracle not set.\");\n require(address(_chainlinkOracleV2) != address(0), \"ChainlinkPriceOracleV2 not set.\");\n require(address(_tertiaryOracle) != address(0), \"Tertiary price oracle not set.\");\n masterOracle = _masterOracle;\n chainlinkOracleV2 = _chainlinkOracleV2;\n tertiaryOracle = _tertiaryOracle;\n wtoken = _wtoken;\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Try to get MasterPriceOracle price\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.price(underlying);\n\n // Try to get ChainlinkPriceOracleV2 price\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0)) return chainlinkOracleV2.price(underlying);\n\n // Otherwise, get price from tertiary oracle\n return BasePriceOracle(address(tertiaryOracle)).price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = cToken.underlying();\n\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Try to get MasterPriceOracle price\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.getUnderlyingPrice(cToken);\n\n // Try to get ChainlinkPriceOracleV2 price\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0))\n return chainlinkOracleV2.getUnderlyingPrice(cToken);\n\n // Otherwise, get price from tertiary oracle\n return tertiaryOracle.getUnderlyingPrice(cToken);\n }\n}\n" + }, + "contracts/oracles/default/PythPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title PythPriceOracle\n * @notice Returns prices from Pyth.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract PythPriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to Pyth price IDs.\n */\n mapping(address => bytes32) public priceFeedIds;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n bytes32 public NATIVE_TOKEN_USD_FEED;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n\n IPyth public PYTH;\n\n function initialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public initializer {\n __SafeOwnable_init(msg.sender);\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n }\n\n function reinitialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public onlyOwnerOrAdmin {\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feedIds The Pyth Network feed IDs`.\n */\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feedIds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeedIds[underlying] = feedIds[i];\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/native price from Oracle\n bytes32 feed = priceFeedIds[underlying];\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\n\n if (NATIVE_TOKEN_USD_FEED == \"\") {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\n return\n tokenUsdPrice.price >= 0 ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\n } else {\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\n if (nativeTokenUsdPrice <= 0) return 0;\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/PythPriceOracleDmBTC.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title PythPriceOracle\n * @notice Returns prices from Pyth.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract PythPriceOracleDmBTC is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to Pyth price IDs.\n */\n mapping(address => bytes32) public priceFeedIds;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n bytes32 public NATIVE_TOKEN_USD_FEED;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n\n IPyth public PYTH;\n\n address public DMBTC;\n\n function initialize(\n address pythAddress,\n bytes32 nativeTokenUsdFeed,\n address usdToken,\n address dmBTC\n ) public initializer {\n __SafeOwnable_init(msg.sender);\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n DMBTC = dmBTC;\n }\n\n function reinitialize(\n address pythAddress,\n bytes32 nativeTokenUsdFeed,\n address usdToken,\n address dmBTC\n ) public onlyOwnerOrAdmin {\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n DMBTC = dmBTC;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feedIds The Pyth Network feed IDs`.\n */\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feedIds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeedIds[underlying] = feedIds[i];\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/native price from Oracle\n bytes32 feed = priceFeedIds[underlying];\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\n uint256 normalizedPrice;\n if (NATIVE_TOKEN_USD_FEED == \"\") {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\n normalizedPrice = tokenUsdPrice.price >= 0\n ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice)\n : 0;\n } else {\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\n if (nativeTokenUsdPrice <= 0) return 0;\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\n normalizedPrice = tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n if (underlying == DMBTC) {\n return normalizedPrice / 100000;\n }\n return normalizedPrice;\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracle is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWeETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracleWeETH is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // special case for wrsETH\n // if input is wrsETH, we need to get the price of rsETH\n if (underlying == 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A) {\n underlying = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n }\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWrsETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracleWrsETH is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // special case for wrsETH\n // if input is wrsETH, we need to get the price of rsETH\n if (underlying == 0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd) {\n underlying = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\n }\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/SimplePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\ncontract SimplePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n mapping(address => uint256) prices;\n event PricePosted(\n address asset,\n uint256 previousPriceMantissa,\n uint256 requestedPriceMantissa,\n uint256 newPriceMantissa\n );\n\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\n if (compareStrings(cToken.symbol(), \"cETH\")) {\n return 1e18;\n } else {\n address underlying = ICErc20(address(cToken)).underlying();\n uint256 oraclePrice = prices[underlying];\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n }\n\n function setUnderlyingPrice(ICErc20 cToken, uint256 underlyingPriceMantissa) public onlyOwner {\n address asset = ICErc20(address(cToken)).underlying();\n emit PricePosted(asset, prices[asset], underlyingPriceMantissa, underlyingPriceMantissa);\n prices[asset] = underlyingPriceMantissa;\n }\n\n function setDirectPrice(address asset, uint256 _price) public onlyOwner {\n emit PricePosted(asset, prices[asset], _price, _price);\n prices[asset] = _price;\n }\n\n function price(address underlying) external view returns (uint256) {\n return prices[address(underlying)];\n }\n\n // v1 price oracle interface for use as backing of proxy\n function assetPrices(address asset) external view returns (uint256) {\n return prices[asset];\n }\n\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n}\n" + }, + "contracts/oracles/default/UniswapLikeLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title UniswapLpTokenPriceOracle\n * @author David Lucid (https://github.com/davidlucid)\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\nabstract contract UniswapLikeLpTokenPriceOracle is BasePriceOracle {\n /**\n * @dev wtoken contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n constructor(address _wtoken) {\n wtoken = _wtoken;\n }\n\n function _price(address token) internal view virtual returns (uint256);\n\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @dev Fast square root function.\n * Implementation from: https://github.com/Uniswap/uniswap-lib/commit/99f3f28770640ba1bb1ff460ac7c5292fb8291a0\n * Original implementation: https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687\n */\n function sqrt(uint256 x) internal pure returns (uint256) {\n if (x == 0) return 0;\n uint256 xx = x;\n uint256 r = 1;\n\n if (xx >= 0x100000000000000000000000000000000) {\n xx >>= 128;\n r <<= 64;\n }\n if (xx >= 0x10000000000000000) {\n xx >>= 64;\n r <<= 32;\n }\n if (xx >= 0x100000000) {\n xx >>= 32;\n r <<= 16;\n }\n if (xx >= 0x10000) {\n xx >>= 16;\n r <<= 8;\n }\n if (xx >= 0x100) {\n xx >>= 8;\n r <<= 4;\n }\n if (xx >= 0x10) {\n xx >>= 4;\n r <<= 2;\n }\n if (xx >= 0x8) {\n r <<= 1;\n }\n\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return (r < r1 ? r : r1);\n }\n}\n" + }, + "contracts/oracles/default/UniswapLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { UniswapLikeLpTokenPriceOracle } from \"./UniswapLikeLpTokenPriceOracle.sol\";\n\n/**\n * @title UniswapLpTokenPriceOracle\n * @author David Lucid (https://github.com/davidlucid)\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract UniswapLpTokenPriceOracle is UniswapLikeLpTokenPriceOracle {\n /**\n * @dev Fetches the fair LP token/ETH price from Uniswap, with 18 decimals of precision.\n */\n constructor(address _wtoken) UniswapLikeLpTokenPriceOracle(_wtoken) {}\n\n function _price(address token) internal view virtual override returns (uint256) {\n IUniswapV2Pair pair = IUniswapV2Pair(token);\n uint256 totalSupply = pair.totalSupply();\n if (totalSupply == 0) return 0;\n (uint256 r0, uint256 r1, ) = pair.getReserves();\n\n r0 = r0 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token0()).decimals()));\n r1 = r1 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token1()).decimals()));\n\n address token0 = pair.token0();\n address token1 = pair.token1();\n\n // Get fair price of non-WETH token (underlying the pair) in terms of ETH\n uint256 token0FairPrice = token0 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token0);\n uint256 token1FairPrice = token1 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token1);\n\n // Implementation from https://github.com/AlphaFinanceLab/homora-v2/blob/e643392d582c81f6695136971cff4b685dcd2859/contracts/oracle/UniswapV2Oracle.sol#L18\n uint256 sqrtK = (sqrt(r0 * r1) * (2 ** 112)) / totalSupply;\n return (((sqrtK * 2 * sqrt(token0FairPrice)) / (2 ** 56)) * sqrt(token1FairPrice)) / (2 ** 56);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport \"./UniswapTwapPriceOracleV2Root.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2 is Initializable, BasePriceOracle {\n /**\n * @dev wtoken token contract address.\n */\n address public wtoken;\n\n /**\n * @dev UniswapTwapPriceOracleV2Root contract address.\n */\n UniswapTwapPriceOracleV2Root public rootOracle;\n\n /**\n * @dev UniswapV2Factory contract address.\n */\n address public uniswapV2Factory;\n\n /**\n * @dev The token on which to base TWAPs (its price must be available via `msg.sender`).\n */\n address public baseToken;\n\n /**\n * @dev Initalize that sets the UniswapTwapPriceOracleV2Root, UniswapV2Factory, and base token.\n * @param _rootOracle Sets `UniswapTwapPriceOracleV2Root`\n * @param _uniswapV2Factory Sets `UniswapV2Factory`\n * @param _baseToken The token on which to base TWAPs (its price must be available via `msg.sender`).\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address _rootOracle,\n address _uniswapV2Factory,\n address _baseToken,\n address _wtoken\n ) external initializer {\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\n require(_uniswapV2Factory != address(0), \"UniswapV2Factory not defined.\");\n rootOracle = UniswapTwapPriceOracleV2Root(_rootOracle);\n uniswapV2Factory = _uniswapV2Factory;\n wtoken = _wtoken;\n baseToken = _baseToken == address(0) ? address(wtoken) : _baseToken;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = cToken.underlying();\n\n // Get price, format, and return\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n return (_price(underlying) * 1e18) / baseUnit;\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n */\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Return root oracle ERC20/ETH TWAP\n uint256 twap = rootOracle.price(underlying, baseToken, uniswapV2Factory);\n return\n baseToken == address(wtoken)\n ? twap\n : (twap * BasePriceOracle(msg.sender).price(baseToken)) /\n (10 ** uint256(ERC20Upgradeable(baseToken).decimals()));\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Factory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol\";\n\nimport \"./UniswapTwapPriceOracleV2.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2Factory\n * @notice Deploys and catalogs UniswapTwapPriceOracleV2 contracts.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2Factory {\n /**\n * @dev WETH token contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev `UniswapTwapPriceOracleV2Root` contract address.\n */\n address public immutable rootOracle;\n\n /**\n * @dev Implementation address for the `UniswapV3TwapPriceOracleV2`.\n */\n address public immutable logic;\n\n /**\n * @notice Maps `UniswapV2Factory` contracts to base tokens to `UniswapTwapPriceOracleV2` contract addresses.\n */\n mapping(address => mapping(address => UniswapTwapPriceOracleV2)) public oracles;\n\n /**\n * @dev Constructor that sets the `UniswapTwapPriceOracleV2Root` and `UniswapTwapPriceOracleV2` implementation contract.\n */\n constructor(address _rootOracle, address _logic, address _wtoken) {\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\n require(_logic != address(0), \"UniswapTwapPriceOracleV2 implementation/logic contract not defined.\");\n rootOracle = _rootOracle;\n logic = _logic;\n wtoken = _wtoken;\n }\n\n /**\n * @notice Deploys a `UniswapTwapPriceOracleV2`.\n * @param uniswapV2Factory The `UniswapV2Factory` contract of the pairs for which this oracle will be used.\n * @param baseToken The base token of the pairs for which this oracle will be used.\n */\n function deploy(address uniswapV2Factory, address baseToken) external returns (address) {\n // Input validation\n if (baseToken == address(0)) baseToken = address(wtoken);\n\n // Return existing oracle if present\n address currentOracle = address(oracles[uniswapV2Factory][baseToken]);\n if (currentOracle != address(0)) return currentOracle;\n\n // Deploy oracle\n bytes32 salt = keccak256(abi.encodePacked(uniswapV2Factory, baseToken));\n address oracle = ClonesUpgradeable.cloneDeterministic(logic, salt);\n UniswapTwapPriceOracleV2(oracle).initialize(rootOracle, uniswapV2Factory, baseToken, wtoken);\n\n // Set oracle in state\n oracles[uniswapV2Factory][baseToken] = UniswapTwapPriceOracleV2(oracle);\n\n // Return oracle address\n return oracle;\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Resolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IResolver } from \"ops/interfaces/IResolver.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"./UniswapTwapPriceOracleV2Root.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract UniswapTwapPriceOracleV2Resolver is IResolver, Ownable {\n struct PairConfig {\n address pair;\n address baseToken;\n uint256 minPeriod;\n uint256 deviationThreshold;\n }\n\n // need to store as arrays for the UniswapTwapPriceOracleV2Root workable functions\n address[] pairs;\n address[] baseTokens;\n uint256[] minPeriods;\n uint256[] deviationThresholds;\n\n UniswapTwapPriceOracleV2Root public root;\n uint256 public lastUpdate;\n\n constructor(PairConfig[] memory _pairConfigs, UniswapTwapPriceOracleV2Root _root) {\n for (uint256 i = 0; i < _pairConfigs.length; i++) {\n pairs[i] = _pairConfigs[i].pair;\n baseTokens[i] = _pairConfigs[i].baseToken;\n minPeriods[i] = _pairConfigs[i].minPeriod;\n deviationThresholds[i] = _pairConfigs[i].deviationThreshold;\n }\n root = _root;\n }\n\n function getPairs() external view returns (PairConfig[] memory) {\n PairConfig[] memory pairConfigs = new PairConfig[](pairs.length);\n for (uint256 i = 0; i < pairs.length; i++) {\n PairConfig memory pairConfig = PairConfig({\n pair: pairs[i],\n baseToken: baseTokens[i],\n minPeriod: minPeriods[i],\n deviationThreshold: deviationThresholds[i]\n });\n pairConfigs[i] = pairConfig;\n }\n return pairConfigs;\n }\n\n function changeRoot(UniswapTwapPriceOracleV2Root _root) external onlyOwner {\n root = _root;\n }\n\n function removeFromPairs(uint256 index) external onlyOwner {\n if (index >= pairs.length) return;\n\n for (uint256 i = index; i < pairs.length - 1; i++) {\n pairs[i] = pairs[i + 1];\n baseTokens[i] = baseTokens[i + 1];\n minPeriods[i] = minPeriods[i + 1];\n deviationThresholds[i] = deviationThresholds[i + 1];\n }\n pairs.pop();\n baseTokens.pop();\n minPeriods.pop();\n deviationThresholds.pop();\n }\n\n function addPair(PairConfig calldata pair) external onlyOwner {\n pairs.push(pair.pair);\n baseTokens.push(pair.baseToken);\n minPeriods.push(pair.minPeriod);\n deviationThresholds.push(pair.deviationThreshold);\n }\n\n function getWorkablePairs() public view returns (address[] memory) {\n bool[] memory workable = root.workable(pairs, baseTokens, minPeriods, deviationThresholds);\n uint256 workableCount = 0;\n for (uint256 i = 0; i < workable.length; i += 1) {\n if (workable[i]) {\n workableCount += 1;\n }\n }\n\n address[] memory workablePairs = new address[](workableCount);\n uint256 j = 0;\n\n for (uint256 i = 0; i < workable.length; i++) {\n if (workable[i]) {\n workablePairs[j++] = pairs[i];\n }\n }\n return workablePairs;\n }\n\n function updatePairs(address[] calldata workablePairs) external {\n if (workablePairs.length == 0) return;\n root.update(workablePairs);\n }\n\n function checker() external view override returns (bool canExec, bytes memory execPayload) {\n address[] memory workablePairs = getWorkablePairs();\n if (workablePairs.length == 0) {\n return (false, bytes(\"No workable pairs\"));\n }\n\n canExec = true;\n execPayload = abi.encodeWithSelector(this.updatePairs.selector, workablePairs);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Root.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport \"../../external/uniswap/IUniswapV2Factory.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2Root\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2Root {\n /**\n * @dev wtoken token contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev Minimum TWAP interval.\n */\n uint256 public constant MIN_TWAP_TIME = 15 minutes;\n\n /**\n * @dev Constructor to set wtoken address\n */\n constructor(address _wtoken) {\n wtoken = _wtoken;\n }\n\n /**\n * @dev Return the TWAP value price0. Revert if TWAP time range is not within the threshold.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The pair to query for price0.\n */\n function price0TWAP(address pair) internal view returns (uint256) {\n uint256 length = observationCount[pair];\n require(length > 0, \"No length-1 TWAP observation.\");\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\n require(length > 1, \"No length-2 TWAP observation.\");\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\n }\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\n uint256 currPx0Cumu = currentPx0Cumu(pair);\n unchecked {\n return (currPx0Cumu - lastObservation.price0Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\n }\n }\n\n /**\n * @dev Return the TWAP value price1. Revert if TWAP time range is not within the threshold.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The pair to query for price1.\n */\n function price1TWAP(address pair) internal view returns (uint256) {\n uint256 length = observationCount[pair];\n require(length > 0, \"No length-1 TWAP observation.\");\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\n require(length > 1, \"No length-2 TWAP observation.\");\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\n }\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\n uint256 currPx1Cumu = currentPx1Cumu(pair);\n unchecked {\n return (currPx1Cumu - lastObservation.price1Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\n }\n }\n\n /**\n * @dev Return the current price0 cumulative value on Uniswap.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The uniswap pair to query for price0 cumulative value.\n */\n function currentPx0Cumu(address pair) internal view returns (uint256 px0Cumu) {\n uint32 currTime = uint32(block.timestamp);\n px0Cumu = IUniswapV2Pair(pair).price0CumulativeLast();\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n if (lastTime != block.timestamp) {\n unchecked {\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\n px0Cumu += uint256((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired\n }\n }\n }\n\n /**\n * @dev Return the current price1 cumulative value on Uniswap.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The uniswap pair to query for price1 cumulative value.\n */\n function currentPx1Cumu(address pair) internal view returns (uint256 px1Cumu) {\n uint32 currTime = uint32(block.timestamp);\n px1Cumu = IUniswapV2Pair(pair).price1CumulativeLast();\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n if (lastTime != currTime) {\n unchecked {\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\n px1Cumu += uint256((reserve0 << 112) / reserve1) * timeElapsed; // overflow is desired\n }\n }\n }\n\n /**\n * @dev Returns the price of `underlying` in terms of `baseToken` given `factory`.\n */\n function price(address underlying, address baseToken, address factory) external view returns (uint256) {\n // Return ERC20/ETH TWAP\n address pair = IUniswapV2Factory(factory).getPair(underlying, baseToken);\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n return (((underlying < baseToken ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\n }\n\n /**\n * @dev Struct for cumulative price observations.\n */\n struct Observation {\n uint32 timestamp;\n uint256 price0Cumulative;\n uint256 price1Cumulative;\n }\n\n /**\n * @dev Length after which observations roll over to index 0.\n */\n uint8 public constant OBSERVATION_BUFFER = 4;\n\n /**\n * @dev Total observation count for each pair.\n */\n mapping(address => uint256) public observationCount;\n\n /**\n * @dev Array of cumulative price observations for each pair.\n */\n mapping(address => Observation[OBSERVATION_BUFFER]) public observations;\n\n /// @notice Get pairs for token combinations.\n function pairsFor(\n address[] calldata tokenA,\n address[] calldata tokenB,\n address factory\n ) external view returns (address[] memory) {\n require(\n tokenA.length > 0 && tokenA.length == tokenB.length,\n \"Token array lengths must be equal and greater than 0.\"\n );\n address[] memory pairs = new address[](tokenA.length);\n for (uint256 i = 0; i < tokenA.length; i++) pairs[i] = IUniswapV2Factory(factory).getPair(tokenA[i], tokenB[i]);\n return pairs;\n }\n\n /// @notice Check which of multiple pairs are workable/updatable.\n function workable(\n address[] calldata pairs,\n address[] calldata baseTokens,\n uint256[] calldata minPeriods,\n uint256[] calldata deviationThresholds\n ) external view returns (bool[] memory) {\n require(\n pairs.length > 0 &&\n pairs.length == baseTokens.length &&\n pairs.length == minPeriods.length &&\n pairs.length == deviationThresholds.length,\n \"Array lengths must be equal and greater than 0.\"\n );\n bool[] memory answers = new bool[](pairs.length);\n for (uint256 i = 0; i < pairs.length; i++)\n answers[i] = _workable(pairs[i], baseTokens[i], minPeriods[i], deviationThresholds[i]);\n return answers;\n }\n\n /// @dev Internal function to check if a pair is workable (updateable AND reserves have changed AND deviation threshold is satisfied).\n function _workable(\n address pair,\n address baseToken,\n uint256 minPeriod,\n uint256 deviationThreshold\n ) internal view returns (bool) {\n // Workable if:\n // 1) We have no observations\n // 2) The elapsed time since the last observation is > minPeriod AND reserves have changed AND deviation threshold is satisfied\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n if (observationCount[pair] <= 0) return true;\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n return\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\n (minPeriod >= MIN_TWAP_TIME ? minPeriod : MIN_TWAP_TIME) &&\n lastTime != observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp &&\n _deviation(pair, baseToken) >= deviationThreshold;\n }\n\n /// @dev Internal function to check if a pair's spot price's deviation from its TWAP price as a ratio scaled by 1e18\n function _deviation(address pair, address baseToken) internal view returns (uint256) {\n // Get token base unit\n address token0 = IUniswapV2Pair(pair).token0();\n bool useToken0Price = token0 != baseToken;\n address underlying = useToken0Price ? token0 : IUniswapV2Pair(pair).token1();\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n\n // Get TWAP price\n uint256 twapPrice = (((useToken0Price ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\n\n // Get spot price\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();\n uint256 spotPrice = useToken0Price ? (reserve1 * baseUnit) / reserve0 : (reserve0 * baseUnit) / reserve1;\n\n // Get ratio and return deviation\n uint256 ratio = (spotPrice * 1e18) / twapPrice;\n return ratio >= 1e18 ? ratio - 1e18 : 1e18 - ratio;\n }\n\n /// @dev Internal function to check if a pair is updatable at all.\n function _updateable(address pair) internal view returns (bool) {\n // Updateable if:\n // 1) We have no observations\n // 2) The elapsed time since the last observation is > MIN_TWAP_TIME\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n return\n observationCount[pair] <= 0 ||\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\n MIN_TWAP_TIME;\n }\n\n /// @notice Update one pair.\n function update(address pair) external {\n require(_update(pair), \"Failed to update pair.\");\n }\n\n /// @notice Update multiple pairs at once.\n function update(address[] calldata pairs) external {\n bool worked = false;\n for (uint256 i = 0; i < pairs.length; i++) if (_update(pairs[i])) worked = true;\n require(worked, \"No pairs can be updated (yet).\");\n }\n\n /// @dev Internal function to update a single pair.\n function _update(address pair) internal returns (bool) {\n // Check if workable\n if (!_updateable(pair)) return false;\n\n // Get cumulative price(s)\n uint256 price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();\n uint256 price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();\n\n // Loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n observations[pair][observationCount[pair] % OBSERVATION_BUFFER] = Observation(\n lastTime,\n price0Cumulative,\n price1Cumulative\n );\n observationCount[pair]++;\n return true;\n }\n}\n" + }, + "contracts/oracles/default/UniswapV3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../BasePriceOracle.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { ConcentratedLiquidityBasePriceOracle } from \"./ConcentratedLiquidityBasePriceOracle.sol\";\n\nimport \"../../external/uniswap/TickMath.sol\";\nimport \"../../external/uniswap/FullMath.sol\";\nimport \"../../external/uniswap/IUniswapV3Pool.sol\";\n\n/**\n * @title UniswapV3PriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice UniswapV3PriceOracle is a price oracle for Uniswap V3 pairs.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract UniswapV3PriceOracle is ConcentratedLiquidityBasePriceOracle {\n /**\n * @dev Fetches the price for a token from Algebra pools.\n */\n\n function _price(address token) internal view override returns (uint256) {\n uint32[] memory secondsAgos = new uint32[](2);\n uint256 twapWindow = poolFeeds[token].twapWindow;\n address baseToken = poolFeeds[token].baseToken;\n\n secondsAgos[0] = uint32(twapWindow);\n secondsAgos[1] = 0;\n\n IUniswapV3Pool pool = IUniswapV3Pool(poolFeeds[token].poolAddress);\n (int56[] memory tickCumulatives, ) = pool.observe(secondsAgos);\n\n int24 tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int56(int256(twapWindow)));\n uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(tick);\n\n uint256 tokenPrice = getPriceX96FromSqrtPriceX96(pool.token0(), token, sqrtPriceX96);\n return scalePrices(baseToken, token, tokenPrice);\n }\n}\n" + }, + "contracts/oracles/default/VelodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface Prices {\n function getRateToEth(address srcToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\n}\n\ncontract VelodromePriceOracle is BasePriceOracle {\n Prices immutable prices;\n\n constructor(address _prices) {\n prices = Prices(_prices);\n }\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return prices.getRateToEth(token, false);\n }\n}\n" + }, + "contracts/oracles/default/VelodromePriceOracleFraxtal.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface Prices_Fraxtal {\n function getRate(address srcToken, address dstToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\n}\n\ncontract VelodromePriceOracleFraxtal is BasePriceOracle {\n Prices_Fraxtal immutable prices;\n\n constructor(address _prices) {\n prices = Prices_Fraxtal(_prices);\n }\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return prices.getRate(token, 0xFC00000000000000000000000000000000000006, false);\n }\n}\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\n\n/**\n * @title MasterPriceOracle\n * @notice Use a combination of price oracles.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public oracles;\n\n /**\n * @dev Default/fallback `PriceOracle`.\n */\n BasePriceOracle public defaultOracle;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool internal noAdminOverwrite;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public fallbackOracles;\n\n /**\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n function canAdminOverwrite() external view returns (bool) {\n return !noAdminOverwrite;\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Event emitted when the default oracle is changed.\n */\n event NewDefaultOracle(address oldOracle, address newOracle);\n\n /**\n * @dev Event emitted when an underlying token's oracle is changed.\n */\n event NewOracle(address underlying, address oldOracle, address newOracle);\n\n /**\n * @dev Initialize state variables.\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\n * @param _defaultOracle The default `PriceOracle` contract to use.\n * @param _admin The admin who can assign oracles to underlying tokens.\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address[] memory underlyings,\n BasePriceOracle[] memory _oracles,\n BasePriceOracle _defaultOracle,\n address _admin,\n bool _canAdminOverwrite,\n address _wtoken\n ) external initializer {\n // Input validation\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\n\n // Initialize state variables\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, address(0), address(newOracle));\n }\n\n defaultOracle = _defaultOracle;\n admin = _admin;\n noAdminOverwrite = !_canAdminOverwrite;\n wtoken = _wtoken;\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(oracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(fallbackOracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n fallbackOracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Changes the default price oracle\n */\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\n BasePriceOracle oldOracle = defaultOracle;\n defaultOracle = newOracle;\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = address(ICErc20(address(cToken)).underlying());\n\n if (underlying == wtoken) return 1e18;\n\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n\n /**\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) public view override returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == wtoken) return 1e18;\n\n // Get underlying price from assigned oracle\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n}\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./compound/Unitroller.sol\";\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\nimport \"./ionic/DiamondExtension.sol\";\n\n/**\n * @title PoolDirectory\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\n */\ncontract PoolDirectory is SafeOwnableUpgradeable {\n /**\n * @dev Initializes a deployer whitelist if desired.\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\n */\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\n __SafeOwnable_init(msg.sender);\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\n }\n\n /**\n * @dev Struct for a Ionic interest rate pool.\n */\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n /**\n * @dev Array of Ionic interest rate pools.\n */\n Pool[] public pools;\n\n /**\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\n */\n mapping(address => uint256[]) private _poolsByAccount;\n\n /**\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\n */\n mapping(address => bool) public poolExists;\n\n /**\n * @dev Emitted when a new Ionic pool is added to the directory.\n */\n event PoolRegistered(uint256 index, Pool pool);\n\n /**\n * @dev Booleans indicating if the deployer whitelist is enforced.\n */\n bool public enforceDeployerWhitelist;\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\n */\n mapping(address => bool) public deployerWhitelist;\n\n /**\n * @dev Controls if the deployer whitelist is to be enforced.\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\n */\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\n enforceDeployerWhitelist = enforce;\n }\n\n /**\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\n * @param deployers Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\n require(deployers.length > 0, \"No deployers supplied.\");\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\n }\n\n /**\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\n * @param name The name of the pool.\n * @param comptroller The pool's Comptroller proxy contract address.\n * @return The index of the registered Ionic pool.\n */\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\n require(bytes(name).length <= 100, \"No pool name supplied.\");\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n _poolsByAccount[msg.sender].push(pools.length - 1);\n poolExists[comptroller] = true;\n emit PoolRegistered(pools.length - 1, pool);\n return pools.length - 1;\n }\n\n function _deprecatePool(address comptroller) external onlyOwner {\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller == comptroller) {\n _deprecatePool(i);\n break;\n }\n }\n }\n\n function _deprecatePool(uint256 index) public onlyOwner {\n Pool storage ionicPool = pools[index];\n\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\n\n // swap with the last pool of the creator and delete\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\n for (uint256 i = 0; i < creatorPools.length; i++) {\n if (creatorPools[i] == index) {\n creatorPools[i] = creatorPools[creatorPools.length - 1];\n creatorPools.pop();\n break;\n }\n }\n\n // leave it to true to deny the re-registering of the same pool\n poolExists[ionicPool.comptroller] = true;\n\n // nullify the storage\n ionicPool.comptroller = address(0);\n ionicPool.creator = address(0);\n ionicPool.name = \"\";\n ionicPool.blockPosted = 0;\n ionicPool.timestampPosted = 0;\n }\n\n /**\n * @dev Deploys a new Ionic pool and adds to the directory.\n * @param name The name of the pool.\n * @param implementation The Comptroller implementation contract address.\n * @param constructorData Encoded construction data for `Unitroller constructor()`\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\n * @param closeFactor The pool's close factor (scaled by 1e18).\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\n * @param priceOracle The pool's PriceOracle contract address.\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\n */\n function deployPool(\n string memory name,\n address implementation,\n bytes calldata constructorData,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive,\n address priceOracle\n ) external returns (uint256, address) {\n // Input validation\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\n\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(\n 0,\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\n unitrollerCreationCode\n );\n\n // Setup the pool\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\n // Set up the extensions\n comptrollerProxy._upgrade();\n\n // Set pool parameters\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\n require(\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\n \"Failed to set pool liquidation incentive.\"\n );\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\n\n // Whitelist\n if (enforceWhitelist)\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\n\n // Make msg.sender the admin\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\n\n // Register the pool with this PoolDirectory\n return (_registerPool(name, proxy), proxy);\n }\n\n /**\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory activePools = new Pool[](count);\n uint256[] memory poolIds = new uint256[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n poolIds[index] = i;\n activePools[index] = pools[i];\n index++;\n }\n }\n\n return (poolIds, activePools);\n }\n\n /**\n * @notice Returns arrays of all Ionic pools' data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getAllPools() public view returns (Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory result = new Pool[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n result[index++] = pools[i];\n }\n }\n\n return result;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n indexes[index] = i;\n poolsOfUser[index] = activePools[i];\n index++;\n }\n\n return (indexes, poolsOfUser);\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\n */\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\n (, Pool[] memory activePools) = getActivePools();\n\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\n indexes[i] = _poolsByAccount[account][i];\n accountPools[i] = activePools[_poolsByAccount[account][i]];\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Modify existing Ionic pool name.\n */\n function setPoolName(uint256 index, string calldata name) external {\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\n require(\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\n \"!permission\"\n );\n pools[index].name = name;\n }\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\n */\n mapping(address => bool) public adminWhitelist;\n\n /**\n * @dev used as salt for the creation of new pools\n */\n uint256 public poolsCounter;\n\n /**\n * @dev Event emitted when the admin whitelist is updated.\n */\n event AdminWhitelistUpdated(address[] admins, bool status);\n\n /**\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\n * @param admins Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\n require(admins.length > 0, \"No admins supplied.\");\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\n emit AdminWhitelistUpdated(admins, status);\n }\n\n /**\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getVerifiedPoolsOfWhitelistedAccount(\n address account\n ) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n indexes[index] = i;\n accountWhitelistedPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, accountWhitelistedPools);\n }\n}\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\n\n/**\n * @title PoolLens\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLens is Initializable {\n error ComptrollerError(uint256 errCode);\n\n /**\n * @notice Initialize the `PoolDirectory` contract object.\n * @param _directory The PoolDirectory\n * @param _name Name for the nativeToken\n * @param _symbol Symbol for the nativeToken\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\n * @param _hardcodedNames Harcoded name for these tokens\n * @param _hardcodedSymbols Harcoded symbol for these tokens\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\n */\n function initialize(\n PoolDirectory _directory,\n string memory _name,\n string memory _symbol,\n address[] memory _hardcodedAddresses,\n string[] memory _hardcodedNames,\n string[] memory _hardcodedSymbols,\n string[] memory _uniswapLPTokenNames,\n string[] memory _uniswapLPTokenSymbols,\n string[] memory _uniswapLPTokenDisplayNames\n ) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n require(\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\n \"Hardcoded addresses lengths not equal.\"\n );\n require(\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\n \"Uniswap LP token names lengths not equal.\"\n );\n\n directory = _directory;\n name = _name;\n symbol = _symbol;\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\n }\n\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\n uniswapData.push(\n UniswapData({\n name: _uniswapLPTokenNames[i],\n symbol: _uniswapLPTokenSymbols[i],\n displayName: _uniswapLPTokenDisplayNames[i]\n })\n );\n }\n }\n\n string public name;\n string public symbol;\n\n struct TokenData {\n string name;\n string symbol;\n }\n mapping(address => TokenData) hardcoded;\n\n struct UniswapData {\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\n string symbol; // ie \"UNI-V2\" or \"SLP\"\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\n }\n UniswapData[] uniswapData;\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @dev Struct for Ionic pool summary data.\n */\n struct IonicPoolData {\n uint256 totalSupply;\n uint256 totalBorrow;\n address[] underlyingTokens;\n string[] underlyingSymbols;\n bool whitelistedAdmin;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsWithData()\n external\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\n {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsByVerificationWithData(\n bool whitelistedAdmin\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\n whitelistedAdmin\n );\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsOIonicrWithData(\n address user\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\n return (indexes, userPools, data, errored);\n }\n\n /**\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\n bool[] memory errored = new bool[](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\n uint256 _totalSupply,\n uint256 _totalBorrow,\n address[] memory _underlyingTokens,\n string[] memory _underlyingSymbols,\n bool _whitelistedAdmin\n ) {\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\n } catch {\n errored[i] = true;\n }\n }\n\n return (data, errored);\n }\n\n /**\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\n */\n function getPoolSummary(\n IonicComptroller comptroller\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\n uint256 totalBorrow = 0;\n uint256 totalSupply = 0;\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n address[] memory underlyingTokens = new address[](cTokens.length);\n string[] memory underlyingSymbols = new string[](cTokens.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n cToken.accrueInterest();\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\n uint256 assetTotalSupply = cToken.getCash() +\n assetTotalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\n\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\n }\n\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\n }\n\n /**\n * @dev Struct for a Ionic pool asset.\n */\n struct PoolAsset {\n address cToken;\n address underlyingToken;\n string underlyingName;\n string underlyingSymbol;\n uint256 underlyingDecimals;\n uint256 underlyingBalance;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 totalSupply;\n uint256 totalBorrow;\n uint256 supplyBalance;\n uint256 borrowBalance;\n uint256 liquidity;\n bool membership;\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\n address oracle;\n uint256 collateralFactor;\n uint256 reserveFactor;\n uint256 adminFee;\n uint256 ionicFee;\n bool borrowGuardianPaused;\n bool mintGuardianPaused;\n }\n\n /**\n * @notice Returns data on the specified assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\n * @param cTokens The cToken contract addresses of the assets to query.\n * @param user The user for which to get account data.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(\n IonicComptroller comptroller,\n ICErc20[] memory cTokens,\n address user\n ) internal returns (PoolAsset[] memory) {\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\n if (isListed) arrayLength++;\n }\n\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\n uint256 index = 0;\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n // Check if market is listed and get collateral factor\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\n if (!isListed) continue;\n\n // Start adding data to PoolAsset\n PoolAsset memory asset;\n ICErc20 cToken = cTokens[i];\n asset.cToken = address(cToken);\n\n cToken.accrueInterest();\n\n // Get underlying asset data\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\n asset.underlyingDecimals = underlying.decimals();\n asset.underlyingBalance = underlying.balanceOf(user);\n\n // Get cToken data\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\n asset.liquidity = cToken.getCash();\n asset.totalBorrow = cToken.totalBorrowsCurrent();\n asset.totalSupply =\n asset.liquidity +\n asset.totalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\n asset.membership = comptroller.checkMembership(user, cToken);\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\n\n // Get oracle for this cToken\n asset.oracle = address(oracle);\n\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\n asset.oracle = address(_oracle);\n } catch {}\n\n // More cToken data\n asset.collateralFactor = collateralFactorMantissa;\n asset.reserveFactor = cToken.reserveFactorMantissa();\n asset.adminFee = cToken.adminFeeMantissa();\n asset.ionicFee = cToken.ionicFeeMantissa();\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\n\n // Add to assets array and increment index\n detailedAssets[index] = asset;\n index++;\n }\n\n return (detailedAssets);\n }\n\n function getBorrowCapsPerCollateral(\n ICErc20 borrowedAsset,\n IonicComptroller comptroller\n )\n internal\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsAgainstCollateral,\n bool[] memory borrowingBlacklistedAgainstCollateral\n )\n {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n collateral = new address[](poolMarkets.length);\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\n\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n address collateralAddress = address(poolMarkets[i]);\n if (collateralAddress != address(borrowedAsset)) {\n collateral[i] = collateralAddress;\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\n address(borrowedAsset),\n collateralAddress\n );\n }\n }\n }\n\n /**\n * @notice Returns the `name` and `symbol` of `token`.\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\n * @param token An ERC20 token contract object.\n * @return The `name` and `symbol`.\n */\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\n // i.e. MKR is a DSToken and uses bytes32\n if (bytes(hardcoded[token].symbol).length != 0) {\n return (hardcoded[token].name, hardcoded[token].symbol);\n }\n\n // Get name and symbol from token contract\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\n string memory _name = tokenContract.name();\n string memory _symbol = tokenContract.symbol();\n\n return (_name, _symbol);\n }\n\n /**\n * @notice Returns the assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\n }\n\n /**\n * @dev Struct for a Ionic pool user.\n */\n struct IonicPoolUser {\n address account;\n uint256 totalBorrow;\n uint256 totalCollateral;\n uint256 health;\n }\n\n /**\n * @notice Returns arrays of PoolAsset for a specific user\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\n return assets;\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n }\n\n return (assets, supplyCapsPerAsset);\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsDataForPool(\n IonicComptroller comptroller\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\n }\n\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\n }\n\n /**\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n }\n\n /**\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsDataForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap,\n uint256 nonWhitelistedTotalBorrows\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n uint256 totalBorrows = asset.totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\n * Note that the whitelist does not have to be enforced.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getWhitelistedPoolsByAccount(\n address account\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) {\n indexes[index] = i;\n accountPools[index] = pools[i];\n index++;\n break;\n }\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getWhitelistedPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\n }\n\n function getHealthFactorHypothetical(\n IonicComptroller pool,\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\n account,\n cTokenModify,\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n\n if (err != 0) revert ComptrollerError(err);\n\n if (shortfall > 0) {\n // HF < 1.0\n return (collateralValue * 1e18) / (collateralValue + shortfall);\n } else {\n // HF >= 1.0\n if (collateralValue <= liquidity) return type(uint256).max;\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\n }\n }\n}\n" + }, + "contracts/PoolLensSecondary.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { IUniswapV2Pair } from \"./external/uniswap/IUniswapV2Pair.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\n\ninterface IRewardsDistributor_PLS {\n function rewardToken() external view returns (address);\n\n function compSupplySpeeds(address) external view returns (uint256);\n\n function compBorrowSpeeds(address) external view returns (uint256);\n\n function compAccrued(address) external view returns (uint256);\n\n function flywheelPreSupplierAction(address cToken, address supplier) external;\n\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n}\n\n/**\n * @title PoolLensSecondary\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLensSecondary returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLensSecondary is Initializable {\n /**\n * @notice Constructor to set the `PoolDirectory` contract object.\n */\n function initialize(PoolDirectory _directory) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n directory = _directory;\n }\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @notice Struct for ownership over a CToken.\n */\n struct CTokenOwnership {\n address cToken;\n address admin;\n bool adminHasRights;\n bool ionicAdminHasRights;\n }\n\n /**\n * @notice Returns the admin, admin rights, Ionic admin (constant), Ionic admin rights, and an array of cTokens with differing properties.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolOwnership(\n IonicComptroller comptroller\n ) external view returns (address, bool, bool, CTokenOwnership[] memory) {\n // Get pool ownership\n address comptrollerAdmin = comptroller.admin();\n bool comptrollerAdminHasRights = comptroller.adminHasRights();\n bool comptrollerIonicAdminHasRights = comptroller.ionicAdminHasRights();\n\n // Get cToken ownership\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n\n address cTokenAdmin;\n try cToken.admin() returns (address _cTokenAdmin) {\n cTokenAdmin = _cTokenAdmin;\n } catch {\n continue;\n }\n bool cTokenAdminHasRights = cToken.adminHasRights();\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\n\n // If outlier, push to array\n if (\n cTokenAdmin != comptrollerAdmin ||\n cTokenAdminHasRights != comptrollerAdminHasRights ||\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\n ) arrayLength++;\n }\n\n CTokenOwnership[] memory outliers = new CTokenOwnership[](arrayLength);\n uint256 arrayIndex = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n\n address cTokenAdmin;\n try cToken.admin() returns (address _cTokenAdmin) {\n cTokenAdmin = _cTokenAdmin;\n } catch {\n continue;\n }\n bool cTokenAdminHasRights = cToken.adminHasRights();\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\n\n // If outlier, push to array and increment array index\n if (\n cTokenAdmin != comptrollerAdmin ||\n cTokenAdminHasRights != comptrollerAdminHasRights ||\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\n ) {\n outliers[arrayIndex] = CTokenOwnership(\n address(cToken),\n cTokenAdmin,\n cTokenAdminHasRights,\n cTokenIonicAdminHasRights\n );\n arrayIndex++;\n }\n }\n\n return (comptrollerAdmin, comptrollerAdminHasRights, comptrollerIonicAdminHasRights, outliers);\n }\n\n /**\n * @notice Determine the maximum redeem amount of a cToken.\n * @param cTokenModify The market to hypothetically redeem in.\n * @param account The account to determine liquidity for.\n * @return Maximum redeem amount.\n */\n function getMaxRedeem(address account, ICErc20 cTokenModify) external returns (uint256) {\n return getMaxRedeemOrBorrow(account, cTokenModify, false);\n }\n\n /**\n * @notice Determine the maximum borrow amount of a cToken.\n * @param cTokenModify The market to hypothetically borrow in.\n * @param account The account to determine liquidity for.\n * @return Maximum borrow amount.\n */\n function getMaxBorrow(address account, ICErc20 cTokenModify) external returns (uint256) {\n return getMaxRedeemOrBorrow(account, cTokenModify, true);\n }\n\n /**\n * @dev Internal function to determine the maximum borrow/redeem amount of a cToken.\n * @param cTokenModify The market to hypothetically borrow/redeem in.\n * @param account The account to determine liquidity for.\n * @return Maximum borrow/redeem amount.\n */\n function getMaxRedeemOrBorrow(address account, ICErc20 cTokenModify, bool isBorrow) internal returns (uint256) {\n IonicComptroller comptroller = IonicComptroller(cTokenModify.comptroller());\n return comptroller.getMaxRedeemOrBorrow(account, cTokenModify, isBorrow);\n }\n\n /**\n * @notice Returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\n * @param comptroller The Ionic pool Comptroller to check.\n */\n function getRewardSpeedsByPool(\n IonicComptroller comptroller\n ) public view returns (ICErc20[] memory, address[] memory, address[] memory, uint256[][] memory, uint256[][] memory) {\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n address[] memory distributors;\n\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n distributors = _distributors;\n } catch {\n distributors = new address[](0);\n }\n\n address[] memory rewardTokens = new address[](distributors.length);\n uint256[][] memory supplySpeeds = new uint256[][](allMarkets.length);\n uint256[][] memory borrowSpeeds = new uint256[][](allMarkets.length);\n\n // Get reward tokens for each distributor\n for (uint256 i = 0; i < distributors.length; i++) {\n rewardTokens[i] = IRewardsDistributor_PLS(distributors[i]).rewardToken();\n }\n\n // Get reward speeds for each market for each distributor\n for (uint256 i = 0; i < allMarkets.length; i++) {\n address cToken = address(allMarkets[i]);\n supplySpeeds[i] = new uint256[](distributors.length);\n borrowSpeeds[i] = new uint256[](distributors.length);\n\n for (uint256 j = 0; j < distributors.length; j++) {\n IRewardsDistributor_PLS distributor = IRewardsDistributor_PLS(distributors[j]);\n supplySpeeds[i][j] = distributor.compSupplySpeeds(cToken);\n borrowSpeeds[i][j] = distributor.compBorrowSpeeds(cToken);\n }\n }\n\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\n }\n\n /**\n * @notice For each `Comptroller`, returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\n * @param comptrollers The Ionic pool Comptrollers to check.\n */\n function getRewardSpeedsByPools(\n IonicComptroller[] memory comptrollers\n )\n external\n view\n returns (ICErc20[][] memory, address[][] memory, address[][] memory, uint256[][][] memory, uint256[][][] memory)\n {\n ICErc20[][] memory allMarkets = new ICErc20[][](comptrollers.length);\n address[][] memory distributors = new address[][](comptrollers.length);\n address[][] memory rewardTokens = new address[][](comptrollers.length);\n uint256[][][] memory supplySpeeds = new uint256[][][](comptrollers.length);\n uint256[][][] memory borrowSpeeds = new uint256[][][](comptrollers.length);\n for (uint256 i = 0; i < comptrollers.length; i++)\n (allMarkets[i], distributors[i], rewardTokens[i], supplySpeeds[i], borrowSpeeds[i]) = getRewardSpeedsByPool(\n comptrollers[i]\n );\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\n }\n\n /**\n * @notice Returns unaccrued rewards by `holder` from `cToken` on `distributor`.\n * @param holder The address to check.\n * @param distributor The RewardsDistributor to check.\n * @param cToken The CToken to check.\n * @return Unaccrued (unclaimed) supply-side rewards and unaccrued (unclaimed) borrow-side rewards.\n */\n function getUnaccruedRewards(\n address holder,\n IRewardsDistributor_PLS distributor,\n ICErc20 cToken\n ) internal returns (uint256, uint256) {\n // Get unaccrued supply rewards\n uint256 compAccruedPrior = distributor.compAccrued(holder);\n distributor.flywheelPreSupplierAction(address(cToken), holder);\n uint256 supplyRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\n\n // Get unaccrued borrow rewards\n compAccruedPrior = distributor.compAccrued(holder);\n distributor.flywheelPreBorrowerAction(address(cToken), holder);\n uint256 borrowRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\n\n // Return both\n return (supplyRewardsUnaccrued, borrowRewardsUnaccrued);\n }\n\n /**\n * @notice Returns all unclaimed rewards accrued by the `holder` on `distributors`.\n * @param holder The address to check.\n * @param distributors The `RewardsDistributor` contracts to check.\n * @return For each of `distributors`: total quantity of unclaimed rewards, array of cTokens, array of unaccrued (unclaimed) supply-side and borrow-side rewards per cToken, and quantity of funds available in the distributor.\n */\n function getUnclaimedRewardsByDistributors(\n address holder,\n IRewardsDistributor_PLS[] memory distributors\n ) external returns (address[] memory, uint256[] memory, ICErc20[][] memory, uint256[2][][] memory, uint256[] memory) {\n address[] memory rewardTokens = new address[](distributors.length);\n uint256[] memory compUnclaimedTotal = new uint256[](distributors.length);\n ICErc20[][] memory allMarkets = new ICErc20[][](distributors.length);\n uint256[2][][] memory rewardsUnaccrued = new uint256[2][][](distributors.length);\n uint256[] memory distributorFunds = new uint256[](distributors.length);\n\n for (uint256 i = 0; i < distributors.length; i++) {\n IRewardsDistributor_PLS distributor = distributors[i];\n rewardTokens[i] = distributor.rewardToken();\n allMarkets[i] = distributor.getAllMarkets();\n rewardsUnaccrued[i] = new uint256[2][](allMarkets[i].length);\n for (uint256 j = 0; j < allMarkets[i].length; j++)\n (rewardsUnaccrued[i][j][0], rewardsUnaccrued[i][j][1]) = getUnaccruedRewards(\n holder,\n distributor,\n allMarkets[i][j]\n );\n compUnclaimedTotal[i] = distributor.compAccrued(holder);\n distributorFunds[i] = IERC20Upgradeable(rewardTokens[i]).balanceOf(address(distributor));\n }\n\n return (rewardTokens, compUnclaimedTotal, allMarkets, rewardsUnaccrued, distributorFunds);\n }\n\n /**\n * @notice Returns arrays of indexes, `Comptroller` proxy contracts, and `RewardsDistributor` contracts for Ionic pools supplied to by `account`.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getRewardsDistributorsBySupplier(\n address supplier\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\n // Get array length\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n try IonicComptroller(pools[i].comptroller).suppliers(supplier) returns (bool isSupplier) {\n if (isSupplier) arrayLength++;\n } catch {}\n }\n\n // Build array\n uint256[] memory indexes = new uint256[](arrayLength);\n IonicComptroller[] memory comptrollers = new IonicComptroller[](arrayLength);\n address[][] memory distributors = new address[][](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n try comptroller.suppliers(supplier) returns (bool isSupplier) {\n if (isSupplier) {\n indexes[index] = i;\n comptrollers[index] = comptroller;\n\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n distributors[index] = _distributors;\n } catch {}\n\n index++;\n }\n } catch {}\n }\n\n // Return distributors\n return (indexes, comptrollers, distributors);\n }\n\n /**\n * @notice The returned list of flywheels contains address(0) for flywheels for which the user has no rewards to claim\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getFlywheelsToClaim(\n address user\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n\n IonicComptroller[] memory comptrollers = new IonicComptroller[](pools.length);\n address[][] memory distributors = new address[][](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n comptrollers[i] = comptroller;\n distributors[i] = flywheelsWithRewardsForPoolUser(user, _distributors);\n } catch {}\n }\n\n return (poolIds, comptrollers, distributors);\n }\n\n function flywheelsWithRewardsForPoolUser(\n address user,\n address[] memory _distributors\n ) internal view returns (address[] memory) {\n address[] memory distributors = new address[](_distributors.length);\n for (uint256 j = 0; j < _distributors.length; j++) {\n if (IRewardsDistributor_PLS(_distributors[j]).compAccrued(user) > 0) {\n distributors[j] = _distributors[j];\n }\n }\n\n return distributors;\n }\n}\n" + }, + "contracts/test/abstracts/AbstractAssetTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { AbstractERC4626Test } from \"./AbstractERC4626Test.sol\";\nimport { ITestConfigStorage } from \"./ITestConfigStorage.sol\";\n\ncontract AbstractAssetTest is BaseTest {\n AbstractERC4626Test public test;\n ITestConfigStorage public testConfigStorage;\n\n function setUpTestContract(bytes calldata testConfig) public virtual {\n // test._setUp(MockERC20(address(IBeefyVault(testConfig.beefyVault).want())).symbol(), testConfig);\n }\n\n function runTest(function() external testFn) public {\n if (shouldRunForChain(block.chainid)) {\n for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\n this.setUpTestContract(testConfigStorage.getTestConfig(i));\n testFn();\n }\n }\n }\n\n function testInitializedValues() public virtual {\n // for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\n // this.setUpTestContract(testConfigs[i]);\n // test.testInitializedValues(asset.name(), asset.symbol());\n // }\n }\n\n function testPreviewDepositAndMintReturnTheSameValue() public {\n this.runTest(test.testPreviewDepositAndMintReturnTheSameValue);\n }\n\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\n this.runTest(test.testPreviewWithdrawAndRedeemReturnTheSameValue);\n }\n\n function testDeposit() public {\n this.runTest(test.testDeposit);\n }\n\n function testDepositWithIncreasedVaultValue() public virtual {\n this.runTest(test.testDepositWithIncreasedVaultValue);\n }\n\n function testDepositWithDecreasedVaultValue() public virtual {\n this.runTest(test.testDepositWithDecreasedVaultValue);\n }\n\n function testMultipleDeposit() public {\n this.runTest(test.testMultipleDeposit);\n }\n\n function testMint() public {\n this.runTest(test.testMint);\n }\n\n function testMultipleMint() public {\n this.runTest(test.testMultipleMint);\n }\n\n function testWithdraw() public {\n this.runTest(test.testWithdraw);\n }\n\n function testWithdrawWithIncreasedVaultValue() public virtual {\n this.runTest(test.testWithdrawWithIncreasedVaultValue);\n }\n\n function testWithdrawWithDecreasedVaultValue() public virtual {\n this.runTest(test.testWithdrawWithDecreasedVaultValue);\n }\n\n function testMultipleWithdraw() public {\n this.runTest(test.testMultipleWithdraw);\n }\n\n function testRedeem() public {\n this.runTest(test.testRedeem);\n }\n\n function testMultipleRedeem() public {\n this.runTest(test.testMultipleRedeem);\n }\n\n function testPauseContract() public {\n this.runTest(test.testPauseContract);\n }\n\n function testEmergencyWithdrawAndPause() public {\n this.runTest(test.testEmergencyWithdrawAndPause);\n }\n\n function testEmergencyWithdrawAndRedeem() public {\n this.runTest(test.testEmergencyWithdrawAndRedeem);\n }\n}\n" + }, + "contracts/test/abstracts/AbstractERC4626Test.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../helpers/WithPool.sol\";\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { IonicERC4626 } from \"../../ionic/strategies/IonicERC4626.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Authority } from \"solmate/auth/Auth.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\nabstract contract AbstractERC4626Test is WithPool {\n using FixedPointMathLib for uint256;\n\n IonicERC4626 plugin;\n\n string testPreFix;\n\n uint256 public depositAmount = 100e18;\n uint256 BPS_DENOMINATOR = 10_000;\n\n uint256 initialStrategyBalance;\n uint256 initialStrategySupply;\n\n constructor() {\n _forkAtBlock(uint128(block.chainid), block.number);\n }\n\n function _setUp(string memory _testPreFix, bytes calldata data) public virtual;\n\n function deposit(address _owner, uint256 amount) public {\n vm.startPrank(_owner);\n underlyingToken.approve(address(plugin), amount);\n plugin.deposit(amount, _owner);\n vm.stopPrank();\n }\n\n function sendUnderlyingToken(uint256 amount, address recipient) public {\n deal(address(underlyingToken), recipient, amount);\n }\n\n function increaseAssetsInVault() public virtual {}\n\n function decreaseAssetsInVault() public virtual {}\n\n function getDepositShares() public view virtual returns (uint256);\n\n function getStrategyBalance() public view virtual returns (uint256);\n\n function getExpectedDepositShares() public view virtual returns (uint256);\n\n function testInitializedValues(string memory assetName, string memory assetSymbol) public virtual {\n assertEq(\n plugin.name(),\n string(abi.encodePacked(\"Midas \", assetName, \" Vault\")),\n string(abi.encodePacked(\"!name \", testPreFix))\n );\n assertEq(\n plugin.symbol(),\n string(abi.encodePacked(\"mv\", assetSymbol)),\n string(abi.encodePacked(\"!symbol \", testPreFix))\n );\n assertEq(address(plugin.asset()), address(underlyingToken), string(abi.encodePacked(\"!asset \", testPreFix)));\n // assertEq(\n // address(BeefyERC4626(address(plugin)).beefyVault()),\n // address(beefyVault),\n // string(abi.encodePacked(\"!beefyVault \", testPreFix))\n // );\n }\n\n function testPreviewDepositAndMintReturnTheSameValue() public {\n uint256 returnedShares = plugin.previewDeposit(depositAmount);\n assertApproxEqAbs(\n plugin.previewMint(returnedShares),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!previewMint \", testPreFix))\n );\n }\n\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\n deposit(address(this), depositAmount);\n uint256 withdrawalAmount = 10e18;\n uint256 reqShares = plugin.previewWithdraw(withdrawalAmount);\n assertApproxEqAbs(\n plugin.previewRedeem(reqShares),\n withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!previewRedeem \", testPreFix))\n );\n }\n\n function testDeposit() public virtual {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShares \", testPreFix))\n );\n }\n\n function testDepositWithIncreasedVaultValue() public {\n // lpDepositor just mints the exact amount of depositShares as the user deposits in assets\n uint256 oldExpectedDepositShare = this.getExpectedDepositShares();\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n // Increase the share price\n increaseAssetsInVault();\n\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n\n sendUnderlyingToken(depositAmount, address(this));\n deposit(address(this), depositAmount);\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n oldExpected4626Shares + previewErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!previewShares == oldExpectedShares \", testPreFix))\n );\n\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(\n previewErc4626Shares,\n oldExpected4626Shares,\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\n );\n assertApproxEqAbs(\n previewErc4626Shares,\n expected4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!previewShares == expectedShares \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n oldExpectedDepositShare + expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\n );\n }\n\n function testDepositWithDecreasedVaultValue() public {\n // THIS TEST WILL ALWAYS FAIL\n // A transfer out of the lpStaker will always fail.\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\n /* =============== ACTUAL TEST =============== */\n /*\n uint256 oldExpecteDepositShares = depositAmount;\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\n deposit(address(this), depositAmount);\n // Decrease the share price\n decreaseAssetsInVault();\n uint256 expectedDepositShare = depositAmount;\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n sendUnderlyingToken(depositAmount, address(this));\n deposit(address(this), depositAmount);\n // Test that we minted the correct amount of token\n assertApproxEqAbs(plugin.balanceOf(address(this)), oldExpected4626Shares + previewErc4626Shares);\n // Test that we got less shares on the second mint after assets in the vault increased\n assertGt(previewErc4626Shares, oldExpected4626Shares, \"!new shares > old Shares\");\n assertApproxEqAbs(previewErc4626Shares, expected4626Shares, \"!previewShares == expectedShares\");\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(this.getDepositShares(), oldExpecteDepositShares + expectedDepositShare);\n */\n }\n\n function testMultipleDeposit() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount * 2,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n depositAmount * 2,\n plugin.totalAssets(),\n uint256(10),\n string(abi.encodePacked(\"Total Assets should be same as sum of deposited amounts \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n uint256(10),\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(1))),\n uint256(10),\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares address(this) \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares address(1) \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n expectedErc4626Shares * 2,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare * 2,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n\n // DotDot ERC4626 should not have underlyingToken after deposit\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testMint() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\n\n underlyingToken.approve(address(plugin), depositAmount);\n plugin.mint(mintAmount, address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n }\n\n function testMultipleMint() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\n\n underlyingToken.approve(address(plugin), depositAmount);\n plugin.mint(mintAmount, address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n vm.startPrank(address(1));\n underlyingToken.approve(address(plugin), depositAmount);\n sendUnderlyingToken(depositAmount, address(1));\n plugin.mint(mintAmount, address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n depositAmount + depositAmount,\n plugin.totalAssets(),\n uint256(10),\n string(abi.encodePacked(\"!2.totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(1))),\n uint256(10),\n string(abi.encodePacked(\"!2.balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount + mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare * 2,\n uint256(10),\n string(abi.encodePacked(\"!2.depositShare \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 2,\n uint256(2),\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n vm.stopPrank();\n }\n\n function testWithdraw() public virtual {\n uint256 depositShares = this.getExpectedDepositShares();\n\n uint256 withdrawalAmount = 10e18;\n\n deposit(address(this), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\n );\n assertTrue(underlyingToken.balanceOf(address(plugin)) <= 1, string(abi.encodePacked(\"!0 \", testPreFix)));\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\n );\n }\n\n function testWithdrawWithIncreasedVaultValue() public virtual {\n uint256 depositShareBal = this.getExpectedDepositShares();\n\n deposit(address(this), depositAmount);\n\n uint256 withdrawalAmount = 10e18;\n\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Increase the share price\n increaseAssetsInVault();\n\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded),\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(\n expectedErc4626SharesNeeded,\n oldExpectedErc4626SharesNeeded,\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShareBal - (oldExpectedDepositSharesNeeded + ExpectedDepositSharesNeeded),\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n }\n\n function testWithdrawWithDecreasedVaultValue() public {\n // THIS TEST WILL ALWAYS FAIL\n // A transfer out of the lpStaker will always fail.\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\n /* =============== ACTUAL TEST =============== */\n /*\n sendUnderlyingToken(depositAmount, address(this));\n uint256 depositShares = this.getExpectedDepositShares();\n deposit(address(this), depositAmount);\n uint256 withdrawalAmount = 10e18;\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n // Increase the share price\n decreaseAssetsInVault();\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded)\n );\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(expectedErc4626SharesNeeded, oldExpectedErc4626SharesNeeded, \"!new shares < old Shares\");\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShareBal - (oldExpectedDepositSharesNeeded + expectedDepositSharesNeeded)\n );\n */\n }\n\n function testMultipleWithdraw() public virtual {\n uint256 depositShares = this.getExpectedDepositShares() * 2;\n\n uint256 withdrawalAmount = 10e18;\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.user asset bal\", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n depositAmount * 2 - expectedErc4626SharesNeeded,\n plugin.totalSupply(),\n 10,\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 1,\n 1,\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n uint256 totalSupplyBefore = depositAmount * 2 - expectedErc4626SharesNeeded;\n depositShares = depositShares - ExpectedDepositSharesNeeded;\n assetBalBefore = underlyingToken.balanceOf(address(1));\n erc4626BalBefore = plugin.balanceOf(address(1));\n expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n vm.prank(address(1));\n plugin.withdraw(10e18, address(1), address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(1)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n totalSupplyBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 2,\n 2,\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testRedeem() public virtual {\n uint256 depositShares = this.getExpectedDepositShares();\n\n uint256 withdrawalAmount = 10e18;\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n\n deposit(address(this), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\n );\n }\n\n function testMultipleRedeem() public virtual {\n uint256 depositShares = this.getExpectedDepositShares() * 2;\n\n uint256 withdrawalAmount = 10e18;\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount * 2 - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\n );\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n uint256 totalSupplyBefore = depositAmount * 2 - redeemAmount;\n depositShares -= ExpectedDepositSharesNeeded;\n redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n assetBalBefore = underlyingToken.balanceOf(address(1));\n erc4626BalBefore = plugin.balanceOf(address(1));\n ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n vm.prank(address(1));\n plugin.withdraw(10e18, address(1), address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(1)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n totalSupplyBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\n );\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 2,\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testPauseContract() public {\n uint256 withdrawAmount = 1e18;\n\n deposit(address(this), depositAmount);\n\n vm.warp(block.timestamp + 10);\n\n plugin.emergencyWithdrawAndPause();\n\n underlyingToken.approve(address(plugin), depositAmount);\n vm.expectRevert(\"Pausable: paused\");\n plugin.deposit(depositAmount, address(this));\n\n vm.expectRevert(\"Pausable: paused\");\n plugin.mint(depositAmount, address(this));\n\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n plugin.withdraw(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount,\n uint256(10),\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\n );\n\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\n plugin.redeem(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - withdrawAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount + expectedAssets,\n uint256(10),\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\n );\n }\n\n function testEmergencyWithdrawAndPause() public virtual {\n deposit(address(this), depositAmount);\n\n uint256 expectedBal = plugin.previewRedeem(depositAmount);\n assertEq(underlyingToken.balanceOf(address(plugin)), 0, string(abi.encodePacked(\"!init 0 \", testPreFix)));\n\n plugin.emergencyWithdrawAndPause();\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n expectedBal,\n uint256(10),\n string(abi.encodePacked(\"!withdraws underlying \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalAssets(),\n expectedBal,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets == expectedBal \", testPreFix))\n );\n }\n\n function testEmergencyWithdrawAndRedeem() public {\n uint256 withdrawAmount = 1e18;\n\n deposit(address(this), depositAmount);\n\n vm.warp(block.timestamp + 10);\n\n plugin.emergencyWithdrawAndPause();\n\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n plugin.withdraw(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount,\n uint256(10),\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\n );\n\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\n plugin.redeem(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - withdrawAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount + expectedAssets,\n uint256(10),\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\n );\n }\n}\n" + }, + "contracts/test/abstracts/ITestConfigStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ITestConfigStorage {\n function getTestConfig(uint256 i) external view returns (bytes memory);\n\n function getTestConfigLength() external view returns (uint256);\n}\n" + }, + "contracts/test/AccountLiquidityTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract AccountLiquidityTest is UpgradesBaseTest {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLensSecondary lens2 = PoolLensSecondary(0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154);\n\n ICErc20 wethMarket;\n ICErc20 usdcMarket;\n ICErc20 usdtMarket;\n ICErc20 wbtcMarket;\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == MODE_MAINNET) {\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdcMarket = ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n wbtcMarket = ICErc20(0xd70254C3baD29504789714A7c69d60Ec1127375C);\n } else {\n ICErc20[] memory markets = pool.getAllMarkets();\n wethMarket = markets[0];\n usdcMarket = markets[1];\n }\n }\n\n function testModeAccountLiquidity() public debuggingOnly fork(MODE_MAINNET) {\n _testAccountLiquidity(0x0C387030a5D3AcDcde1A8DDaF26df31BbC1CE763);\n }\n\n function _testAccountLiquidity(address borrower) internal {\n (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(borrower);\n\n emit log(\"\");\n emit log_named_address(\"user\", borrower);\n emit log_named_uint(\"collateralValue\", collateralValue);\n if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n }\n\n function testUserMaxWithdraw() public debuggingOnly forkAtBlock(MODE_MAINNET, 5890823) {\n address user = 0xBf891E7eFCC98A8239385D3172bA10AD593c7886;\n\n Unitroller asUnitroller = Unitroller(payable(address(pool)));\n _upgradePoolWithExtension(asUnitroller);\n\n {\n _testAccountLiquidity(user);\n\n uint256 maxRedeem = lens2.getMaxRedeem(user, wethMarket);\n emit log_named_uint(\"maxRedeem\", maxRedeem);\n\n bool isMember = pool.checkMembership(user, wethMarket);\n emit log(isMember ? \"is member\" : \"NOT A MEMBER\");\n }\n //vm.rollFork(5891795);\n // redeemed before liquidation at 5890822\n\n // before withdraw call at block 5890821\n // user: 0xBf891E7eFCC98A8239385D3172bA10AD593c7886\n // collateralValue: 156238264982770748812\n // liquidity: 16428491404549045373\n // maxRedeem: 23469273435070064818\n // is member\n\n // user calls withdraw with max(uint256) at block 5890822\n // user: 0xBf891E7eFCC98A8239385D3172bA10AD593c7886\n // collateralValue: 139809773853485792955\n // SHORTFALL: 257892668904\n // maxRedeem: 0\n // is member\n\n // liquidated at 5890902\n // https://explorer.mode.network/tx/0x424fd0504e7afb00382c6dcd25a2efdefd96c005c2333112be450fc7bd98cc88\n }\n}\n" + }, + "contracts/test/AccrueInterestTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\n\nstruct AccrualDiff {\n uint256 borrowIndex;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalIonicFees;\n uint256 totalAdminFees;\n}\n\ncontract AccrueInterestTest is UpgradesBaseTest {\n // fork before the accrue interest refactoring\n function testAccrueInterest() public debuggingOnly forkAtBlock(BSC_MAINNET, 26032460) {\n address busdMarketAddress = 0xa7213deB44f570646Ea955771Cc7f39B58841363;\n address wbnbMarketAddress = 0x57a64a77f8E4cFbFDcd22D5551F52D675cc5A956;\n\n _testAccrueInterest(wbnbMarketAddress);\n }\n\n function _testAccrueInterest(address marketAddress) internal {\n //CErc20Delegate market = CErc20Delegate(marketAddress);\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(marketAddress);\n ICErc20 market = ICErc20(marketAddress);\n\n uint256 adminFeeMantissa = market.adminFeeMantissa();\n uint256 ionicFeeMantissa = market.ionicFeeMantissa();\n uint256 reserveFactorMantissa = market.reserveFactorMantissa();\n\n // test with the logic before the refactoring\n\n AccrualDiff memory diffBefore;\n // accrue at the latest block in order to have an equal/comparable accrual period\n marketAsExt.accrueInterest();\n {\n CTokenFirstExtension.InterestAccrual memory accrualDataBefore;\n CTokenFirstExtension.InterestAccrual memory accrualDataAfter;\n\n accrualDataBefore.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataBefore.borrowIndex = marketAsExt.borrowIndex();\n accrualDataBefore.totalBorrows = marketAsExt.totalBorrows();\n accrualDataBefore.totalReserves = marketAsExt.totalReserves();\n accrualDataBefore.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataBefore.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataBefore.totalSupply = marketAsExt.totalSupply();\n\n vm.roll(block.number + 1e6); // move 1M blocks forward\n marketAsExt.accrueInterest();\n\n accrualDataAfter.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataAfter.borrowIndex = marketAsExt.borrowIndex();\n accrualDataAfter.totalBorrows = marketAsExt.totalBorrows();\n accrualDataAfter.totalReserves = marketAsExt.totalReserves();\n accrualDataAfter.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataAfter.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataAfter.totalSupply = marketAsExt.totalSupply();\n\n assertEq(\n accrualDataBefore.accrualBlockNumber,\n accrualDataAfter.accrualBlockNumber - 1e6,\n \"!total supply old impl\"\n );\n assertLt(accrualDataBefore.borrowIndex, accrualDataAfter.borrowIndex, \"!borrow index old impl\");\n assertLt(accrualDataBefore.totalBorrows, accrualDataAfter.totalBorrows, \"!total borrows old impl\");\n if (reserveFactorMantissa > 0) {\n assertLt(accrualDataBefore.totalReserves, accrualDataAfter.totalReserves, \"!total reserves old impl\");\n }\n if (ionicFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalIonicFees, accrualDataAfter.totalIonicFees, \"!total ionic fees old impl\");\n }\n if (adminFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalAdminFees, accrualDataAfter.totalAdminFees, \"!total admin fees old impl\");\n }\n assertEq(accrualDataBefore.totalSupply, accrualDataAfter.totalSupply, \"!total supply old impl\");\n\n diffBefore.borrowIndex = accrualDataAfter.borrowIndex - accrualDataBefore.borrowIndex;\n diffBefore.totalBorrows = accrualDataAfter.totalBorrows - accrualDataBefore.totalBorrows;\n diffBefore.totalReserves = accrualDataAfter.totalReserves - accrualDataBefore.totalReserves;\n diffBefore.totalIonicFees = accrualDataAfter.totalIonicFees - accrualDataBefore.totalIonicFees;\n diffBefore.totalAdminFees = accrualDataAfter.totalAdminFees - accrualDataBefore.totalAdminFees;\n }\n\n // test with the logic after the refactoring\n vm.rollFork(26032460);\n afterForkSetUp();\n _upgradeMarketWithExtension(market);\n\n AccrualDiff memory diffAfter;\n // accrue at the latest block in order to have an equal/comparable accrual period\n marketAsExt.accrueInterest();\n {\n CTokenFirstExtension.InterestAccrual memory accrualDataBefore;\n CTokenFirstExtension.InterestAccrual memory accrualDataAfter;\n\n accrualDataBefore.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataBefore.borrowIndex = marketAsExt.borrowIndex();\n accrualDataBefore.totalBorrows = marketAsExt.totalBorrows();\n accrualDataBefore.totalReserves = marketAsExt.totalReserves();\n accrualDataBefore.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataBefore.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataBefore.totalSupply = marketAsExt.totalSupply();\n\n vm.roll(block.number + 1e6); // move 1M blocks forward\n marketAsExt.accrueInterest();\n\n accrualDataAfter.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataAfter.borrowIndex = marketAsExt.borrowIndex();\n accrualDataAfter.totalBorrows = marketAsExt.totalBorrows();\n accrualDataAfter.totalReserves = marketAsExt.totalReserves();\n accrualDataAfter.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataAfter.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataAfter.totalSupply = marketAsExt.totalSupply();\n\n assertEq(\n accrualDataBefore.accrualBlockNumber,\n accrualDataAfter.accrualBlockNumber - 1e6,\n \"!total supply old impl\"\n );\n assertLt(accrualDataBefore.borrowIndex, accrualDataAfter.borrowIndex, \"!borrow index new impl\");\n assertLt(accrualDataBefore.totalBorrows, accrualDataAfter.totalBorrows, \"!total borrows new impl\");\n if (reserveFactorMantissa > 0) {\n assertLt(accrualDataBefore.totalReserves, accrualDataAfter.totalReserves, \"!total reserves new impl\");\n }\n if (ionicFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalIonicFees, accrualDataAfter.totalIonicFees, \"!total ionic fees new impl\");\n }\n if (adminFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalAdminFees, accrualDataAfter.totalAdminFees, \"!total admin fees new impl\");\n }\n assertEq(accrualDataBefore.totalSupply, accrualDataAfter.totalSupply, \"!total supply new impl\");\n\n diffAfter.borrowIndex = accrualDataAfter.borrowIndex - accrualDataBefore.borrowIndex;\n diffAfter.totalBorrows = accrualDataAfter.totalBorrows - accrualDataBefore.totalBorrows;\n diffAfter.totalReserves = accrualDataAfter.totalReserves - accrualDataBefore.totalReserves;\n diffAfter.totalIonicFees = accrualDataAfter.totalIonicFees - accrualDataBefore.totalIonicFees;\n diffAfter.totalAdminFees = accrualDataAfter.totalAdminFees - accrualDataBefore.totalAdminFees;\n }\n\n assertEq(diffBefore.borrowIndex, diffAfter.borrowIndex, \"!borrowIndexDiff\");\n assertEq(diffBefore.totalBorrows, diffAfter.totalBorrows, \"!totalBorrowsDiff\");\n assertEq(diffBefore.totalReserves, diffAfter.totalReserves, \"!totalReservesDiff\");\n assertEq(diffBefore.totalIonicFees, diffAfter.totalIonicFees, \"!totalIonicFeesDiff\");\n assertEq(diffBefore.totalAdminFees, diffAfter.totalAdminFees, \"!totalAdminFeesDiff\");\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testMintGated() public fork(POLYGON_MAINNET) {\n address newMarket = 0x71A7037a42D0fB9F905a76B7D16846b2EACC59Aa;\n address assetWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n // approve spending\n vm.startPrank(assetWhale);\n IERC20Upgradeable(CErc20Delegate(newMarket).underlying()).approve(newMarket, 1e6);\n require(CErc20Delegate(newMarket).mint(1e6) == 0, \"!mint failed\");\n vm.stopPrank();\n }\n\n function testDeployCToken() public debuggingOnly fork(POLYGON_MAINNET) {\n CErc20Delegate cErc20Delegate = new CErc20Delegate();\n IonicComptroller pool = IonicComptroller(0x69617fE545804BcDfE853626B4C8EF23475Ac54B);\n emit log_named_address(\"admin\", pool.admin());\n pool.adminHasRights();\n vm.startPrank(0x9308dddeC9B5cCd8a2685A46E913C892FE31C826);\n pool._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(0xb5DFABd7fF7F83BAB83995E72A52B97ABb7bcf63),\n 0x69617fE545804BcDfE853626B4C8EF23475Ac54B,\n payable(address(0x62E27eA8d0389390039277CFfD83Ca18ce9B2D9c)),\n InterestRateModel(address(0xA433B7d3a8A87D8fd40dA68A424007Dd8a21Ce41)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(0),\n uint256(0)\n ),\n \"\",\n 0.72e18\n );\n vm.stopPrank();\n // _functionCall(0xC40119C7269A5FA813d878BF83d14E3462fC8Fde, hex\"8f93bfba\", \"raw liquidation failed\");\n }\n\n function testDeployNeonPool() public debuggingOnly fork(NEON_MAINNET) {\n PoolDirectory poolDirectory = PoolDirectory(0x297a15F615aCdf87580af1Fc497EE57424975Dae);\n FeeDistributor ionicAdmin = FeeDistributor(payable(0x62E27eA8d0389390039277CFfD83Ca18ce9B2D9c));\n Comptroller tempComptroller = new Comptroller();\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n vm.prank(ionicAdmin.owner());\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))), // FD\n false,\n 0.1e18,\n 1.1e18,\n 0xBAAb9986A7002ad67cb5a9C1761210C2Cdd98BFa // MPO\n );\n }\n}\n" + }, + "contracts/test/AnyLiquidationTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { IonicLiquidator, ILiquidator } from \"../IonicLiquidator.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport { ICurvePool } from \"../external/curve/ICurvePool.sol\";\nimport { IFundsConversionStrategy } from \"../liquidators/IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\nimport { IUniswapV2Pair } from \"../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../external/uniswap/IUniswapV2Factory.sol\";\n\ncontract AnyLiquidationTest is BaseTest {\n IonicLiquidator fsl;\n address uniswapRouter;\n mapping(address => address) assetSpecificRouters;\n\n IFundsConversionStrategy[] fundingStrategies;\n bytes[] fundingDatas;\n\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] redemptionDatas;\n\n IUniswapV2Pair mostLiquidPair1;\n IUniswapV2Pair mostLiquidPair2;\n\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\n\n function upgradeAp() internal {\n AddressesProvider newImpl = new AddressesProvider();\n newImpl.initialize(address(this));\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ap)));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uniswapRouter = ap.getAddress(\"IUniswapV2Router02\");\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\n\n if (block.chainid == BSC_MAINNET) {\n mostLiquidPair1 = IUniswapV2Pair(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16); // WBNB-BUSD\n mostLiquidPair2 = IUniswapV2Pair(0x61EB789d75A95CAa3fF50ed7E47b96c132fEc082); // WBNB-BTCB\n fsl = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n // fsl = new IonicLiquidator();\n // fsl.initialize(\n // ap.getAddress(\"wtoken\"),\n // uniswapRouter,\n // ap.getAddress(\"stableToken\"),\n // ap.getAddress(\"wBTCToken\"),\n // \"0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5\",\n // 25\n // );\n\n // TODO configure in the AP?\n address bnbx = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\n address apeSwapRouter = 0xcF0feBd3f17CEf5b47b0cD257aCf6025c5BFf3b7;\n assetSpecificRouters[bnbx] = apeSwapRouter;\n } else if (block.chainid == POLYGON_MAINNET) {\n mostLiquidPair1 = IUniswapV2Pair(0x6e7a5FAFcec6BB1e78bAE2A1F0B612012BF14827); // USDC/WMATIC\n mostLiquidPair2 = IUniswapV2Pair(0x369582d2010B6eD950B571F4101e3bB9b554876F); // SAND/WMATIC\n fsl = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n // fsl = new IonicLiquidator();\n // fsl.initialize(\n // ap.getAddress(\"wtoken\"),\n // uniswapRouter,\n // ap.getAddress(\"stableToken\"),\n // ap.getAddress(\"wBTCToken\"),\n // \"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f\",\n // 30\n // );\n }\n }\n\n function testSpecificRandom() public debuggingOnly {\n testPolygonAnyLiquidation(14341);\n // testPolygonAnyLiquidation(101);\n }\n\n function testBscAnyLiquidation(uint256 random) public fork(BSC_MAINNET) {\n vm.assume(random > 100 && random < type(uint64).max);\n doTestAnyLiquidation(random);\n }\n\n function testPolygonAnyLiquidation(uint256 random) public fork(POLYGON_MAINNET) {\n vm.assume(random > 100 && random < type(uint64).max);\n doTestAnyLiquidation(random);\n }\n\n struct LiquidationData {\n IRedemptionStrategy[] strategies;\n bytes[] redemptionDatas;\n ICErc20[] markets;\n address[] borrowers;\n IonicLiquidator liquidator;\n IFundsConversionStrategy[] fundingStrategies;\n bytes[] fundingDatas;\n ICErc20 debtMarket;\n ICErc20 collateralMarket;\n IonicComptroller comptroller;\n address borrower;\n uint256 repayAmount;\n address flashSwapFundingToken;\n IUniswapV2Pair flashSwapPair;\n }\n\n function getPoolAndBorrower(\n uint256 random,\n PoolDirectory.Pool[] memory pools\n ) internal view returns (IonicComptroller, address) {\n if (pools.length == 0) revert(\"no pools to pick from\");\n\n uint256 i = random % pools.length; // random pool\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n address bscBombPool = 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459;\n if (address(comptroller) == bscBombPool) {\n // we don't want to deal with the bomb liquidations\n return (IonicComptroller(address(0)), address(0));\n }\n\n address[] memory borrowers = comptroller.getAllBorrowers();\n\n if (borrowers.length == 0) {\n return (IonicComptroller(address(0)), address(0));\n } else {\n uint256 k = random % borrowers.length; // random borrower\n address borrower = borrowers[k];\n\n return (comptroller, borrower);\n }\n }\n\n function setUpDebtAndCollateralMarkets(\n uint256 random,\n LiquidationData memory vars\n ) internal returns (ICErc20 debtMarket, ICErc20 collateralMarket, uint256 borrowAmount) {\n // find a debt market in which the borrower has borrowed\n for (uint256 m = 0; m < vars.markets.length; m++) {\n uint256 marketIndexWithOffset = (random + m) % vars.markets.length;\n ICErc20 randomMarket = vars.markets[marketIndexWithOffset];\n borrowAmount = randomMarket.borrowBalanceCurrent(vars.borrower);\n if (borrowAmount > 0) {\n debtMarket = ICErc20(address(randomMarket));\n break;\n }\n }\n\n if (address(debtMarket) != address(0)) {\n emit log(\"debt market is\");\n emit log_address(address(debtMarket));\n\n uint256 shortfall = 0;\n // reduce the price of the collateral for each market where the borrower has supplied\n // until there is shortfall for which to be liquidated\n for (uint256 m = 0; m < vars.markets.length; m++) {\n uint256 marketIndexWithOffset = (random - m) % vars.markets.length;\n ICErc20 randomMarket = vars.markets[marketIndexWithOffset];\n uint256 borrowerCollateral = randomMarket.balanceOf(vars.borrower);\n if (borrowerCollateral > 0) {\n if (address(randomMarket) == address(debtMarket)) continue;\n\n // the collateral prices change\n BasePriceOracle mpo = vars.comptroller.oracle();\n uint256 priceCollateral = mpo.getUnderlyingPrice(randomMarket);\n vm.mockCall(\n address(mpo),\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, randomMarket),\n abi.encode(priceCollateral / 5)\n );\n\n uint256 collateralValue = borrowerCollateral * (priceCollateral / 5);\n uint256 borrowValue = borrowAmount * mpo.getUnderlyingPrice(debtMarket);\n\n if (collateralValue < borrowValue) {\n emit log(\"collateral position too small\");\n continue;\n }\n\n (, , , shortfall) = vars.comptroller.getAccountLiquidity(vars.borrower);\n if (shortfall == 0) {\n emit log(\"collateral still enough\");\n continue;\n } else {\n emit log(\"has shortfall\");\n collateralMarket = ICErc20(address(randomMarket));\n break;\n }\n }\n }\n if (shortfall == 0) {\n return (ICErc20(address(0)), ICErc20(address(0)), 0);\n }\n }\n }\n\n function doTestAnyLiquidation(uint256 random) internal {\n LiquidationData memory vars;\n vars.liquidator = fsl;\n\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(ap.getAddress(\"PoolDirectory\")).getActivePools();\n\n uint256 initRandom = random;\n while (true) {\n // get a random pool and a random borrower from it\n (vars.comptroller, vars.borrower) = getPoolAndBorrower(random, pools);\n\n if (address(vars.comptroller) != address(0) && vars.borrower != address(0)) {\n // find a market in which the borrower has debt and reduce his collateral price\n vars.markets = vars.comptroller.getAllMarkets();\n (vars.debtMarket, vars.collateralMarket, vars.repayAmount) = setUpDebtAndCollateralMarkets(random, vars);\n\n if (address(vars.debtMarket) != address(0) && address(vars.collateralMarket) != address(0)) {\n if (vars.debtMarket.underlying() != ap.getAddress(\"wtoken\")) {\n emit log(\"found testable markets at random number\");\n emit log_uint(random);\n break;\n }\n }\n }\n // fail gracefully when there are no positions to liquidate\n if (random - initRandom < 100) return;\n random++;\n }\n\n vars.repayAmount = vars.repayAmount / 100;\n liquidateSpecificPosition(vars);\n }\n\n function liquidateSpecificPosition(LiquidationData memory vars) internal {\n emit log(\"debt and collateral markets\");\n emit log_address(address(vars.debtMarket));\n emit log_address(address(vars.collateralMarket));\n\n // prepare the liquidation\n\n // add funding strategies\n {\n address debtTokenToFund = vars.debtMarket.underlying();\n uint256 i = 0;\n while (true) {\n emit log(\"funding token\");\n emit log_address(debtTokenToFund);\n if (i++ > 10) revert(\"endless loop bad\");\n\n AddressesProvider.FundingStrategy memory strategy = ap.getFundingStrategy(debtTokenToFund);\n if (strategy.addr == address(0)) break;\n\n debtTokenToFund = addFundingStrategy(\n vars,\n IFundsConversionStrategy(strategy.addr),\n debtTokenToFund,\n strategy.contractInterface,\n strategy.inputToken\n );\n }\n\n vars.flashSwapFundingToken = debtTokenToFund;\n if (vars.flashSwapFundingToken != ap.getAddress(\"wtoken\")) {\n IUniswapV2Router02 router = IUniswapV2Router02(uniswapRouter);\n address pairAddress = IUniswapV2Factory(router.factory()).getPair(\n vars.flashSwapFundingToken,\n ap.getAddress(\"wtoken\")\n );\n if (pairAddress != address(0)) {\n vars.flashSwapPair = IUniswapV2Pair(pairAddress);\n } else {\n revert(\"no pair for flash swap funding\");\n }\n } else {\n vars.flashSwapPair = IUniswapV2Pair(mostLiquidPair1);\n }\n\n vars.fundingStrategies = fundingStrategies;\n vars.fundingDatas = fundingDatas;\n }\n\n emit log(\"flash swap funding token is\");\n emit log_address(vars.flashSwapFundingToken);\n\n address exchangeCollateralTo = vars.flashSwapFundingToken;\n\n // add the redemption strategies\n if (exchangeCollateralTo != address(0)) {\n address collateralTokenToRedeem = vars.collateralMarket.underlying();\n while (collateralTokenToRedeem != exchangeCollateralTo) {\n // TODO\n AddressesProvider.RedemptionStrategy memory strategy = ap.getRedemptionStrategy(collateralTokenToRedeem);\n if (strategy.addr == address(0)) break;\n collateralTokenToRedeem = addRedemptionStrategy(\n vars,\n IRedemptionStrategy(strategy.addr),\n strategy.contractInterface,\n collateralTokenToRedeem,\n strategy.outputToken\n );\n }\n vars.redemptionDatas = redemptionDatas;\n vars.strategies = redemptionStrategies;\n }\n\n // liquidate\n vm.prank(ap.owner());\n try\n vars.liquidator.safeLiquidateToTokensWithFlashLoan(\n ILiquidator.LiquidateToTokensWithFlashSwapVars(\n vars.borrower,\n vars.repayAmount,\n ICErc20(address(vars.debtMarket)),\n ICErc20(address(vars.collateralMarket)),\n address(vars.flashSwapPair),\n 0,\n vars.strategies,\n vars.redemptionDatas,\n vars.fundingStrategies,\n vars.fundingDatas\n )\n )\n {\n // noop\n } catch Error(string memory reason) {\n if (compareStrings(reason, \"Number of tokens less than minimum limit\")) {\n emit log(\"jarvis pool failing, that's ok\");\n } else {\n revert(reason);\n }\n }\n }\n\n function getUniswapV2Router(address inputToken) internal view returns (address) {\n address router = assetSpecificRouters[inputToken];\n return router != address(0) ? router : uniswapRouter;\n }\n\n function toggleFlashSwapPair(LiquidationData memory vars) internal view {\n if (address(vars.flashSwapPair) == address(mostLiquidPair1)) {\n vars.flashSwapPair = mostLiquidPair2;\n } else {\n vars.flashSwapPair = mostLiquidPair1;\n }\n }\n\n function addRedemptionStrategy(\n LiquidationData memory vars,\n IRedemptionStrategy strategy,\n string memory strategyContract,\n address inputToken,\n address strategyOutputToken\n ) internal returns (address) {\n address outputToken;\n bytes memory strategyData;\n\n if (compareStrings(strategyContract, \"CurveLpTokenLiquidatorNoRegistry\")) {\n address[] memory underlyingTokens = curveV1Oracle.getUnderlyingTokens(inputToken);\n (address preferredOutputToken, uint8 outputTokenIndex) = pickPreferredToken(\n underlyingTokens,\n strategyOutputToken\n );\n emit log(\"preferred token\");\n emit log_address(preferredOutputToken);\n emit log_uint(outputTokenIndex);\n outputToken = preferredOutputToken;\n if (outputToken == address(0) || outputToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n outputToken = ap.getAddress(\"wtoken\");\n }\n\n strategyData = abi.encode(preferredOutputToken, ap.getAddress(\"wtoken\"), address(curveV1Oracle));\n } else if (compareStrings(strategyContract, \"SaddleLpTokenLiquidator\")) {\n address[] memory underlyingTokens = curveV1Oracle.getUnderlyingTokens(inputToken);\n (address preferredOutputToken, ) = pickPreferredToken(underlyingTokens, strategyOutputToken);\n outputToken = preferredOutputToken;\n if (outputToken == address(0) || outputToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n outputToken = ap.getAddress(\"wtoken\");\n }\n strategyData = abi.encode(preferredOutputToken, curveV1Oracle, ap.getAddress(\"wtoken\"));\n } else if (\n compareStrings(strategyContract, \"UniswapLpTokenLiquidator\") ||\n compareStrings(strategyContract, \"GelatoGUniLiquidator\")\n ) {\n IUniswapV2Pair pair = IUniswapV2Pair(inputToken);\n address[] memory swapToken0Path;\n address[] memory swapToken1Path;\n\n if (pair.token0() == strategyOutputToken) {\n swapToken0Path = new address[](0);\n swapToken1Path = new address[](2);\n\n swapToken1Path[0] = pair.token1();\n swapToken1Path[1] = pair.token0();\n outputToken = swapToken1Path[1];\n } else {\n swapToken0Path = new address[](2);\n swapToken1Path = new address[](0);\n\n swapToken0Path[0] = pair.token0();\n swapToken0Path[1] = pair.token1();\n outputToken = swapToken0Path[1];\n }\n\n strategyData = abi.encode(uniswapRouter, swapToken0Path, swapToken1Path);\n\n if (address(vars.flashSwapPair) == address(pair)) {\n emit log(\"toggling the flashswap pair\");\n emit log_address(address(pair));\n toggleFlashSwapPair(vars);\n }\n } else if (compareStrings(strategyContract, \"UniswapV2LiquidatorFunder\")) {\n outputToken = strategyOutputToken;\n\n address[] memory swapPath = new address[](2);\n swapPath[0] = inputToken;\n swapPath[1] = outputToken;\n\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\n } else if (compareStrings(strategyContract, \"JarvisLiquidatorFunder\")) {\n AddressesProvider.JarvisPool[] memory pools = ap.getJarvisPools();\n for (uint256 i = 0; i < pools.length; i++) {\n AddressesProvider.JarvisPool memory pool = pools[i];\n if (pool.syntheticToken == inputToken) {\n strategyData = abi.encode(pool.syntheticToken, pool.liquidityPool, pool.expirationTime);\n outputToken = pool.collateralToken;\n break;\n }\n }\n } else if (compareStrings(strategyContract, \"CurveSwapLiquidator\")) {\n outputToken = strategyOutputToken;\n strategyData = abi.encode(curveV1Oracle, curveV2Oracle, inputToken, outputToken, ap.getAddress(\"wtoken\"));\n } else if (compareStrings(strategyContract, \"BalancerLpTokenLiquidator\")) {\n outputToken = strategyOutputToken;\n strategyData = abi.encode(outputToken);\n } else if (compareStrings(strategyContract, \"XBombLiquidatorFunder\")) {\n outputToken = strategyOutputToken;\n address xbomb = inputToken;\n address bomb = outputToken;\n strategyData = abi.encode(inputToken, xbomb, bomb);\n } else if (compareStrings(strategyContract, \"AlgebraSwapLiquidator\")) {\n address ALGEBRA_SWAP_ROUTER = 0x327Dd3208f0bCF590A66110aCB6e5e6941A4EfA0;\n outputToken = strategyOutputToken;\n strategyData = abi.encode(outputToken, ALGEBRA_SWAP_ROUTER);\n } else {\n emit log(strategyContract);\n emit log_address(address(strategy));\n revert(\"unknown collateral\");\n }\n\n vm.prank(vars.liquidator.owner());\n vars.liquidator._whitelistRedemptionStrategy(strategy, true);\n redemptionStrategies.push(strategy);\n redemptionDatas.push(strategyData);\n\n assertEq(outputToken, strategyOutputToken, \"!expected output token\");\n return outputToken;\n }\n\n // function getCurvePoolUnderlyingTokens(address lpTokenAddress) internal view returns (address[] memory) {\n // ICurvePool curvePool = ICurvePool(lpTokenAddress);\n // uint8 i = 0;\n // while (true) {\n // try curvePool.coins(i) {\n // i++;\n // } catch {\n // break;\n // }\n // }\n // address[] memory tokens = new address[](i);\n // for (uint8 j = 0; j < i; j++) {\n // tokens[j] = curvePool.coins(j);\n // }\n // return tokens;\n // }\n\n function pickPreferredToken(\n address[] memory tokens,\n address strategyOutputToken\n ) internal view returns (address, uint8) {\n address wtoken = ap.getAddress(\"wtoken\");\n address stable = ap.getAddress(\"stableToken\");\n address wbtc = ap.getAddress(\"wBTCToken\");\n\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == strategyOutputToken) return (strategyOutputToken, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wtoken) return (wtoken, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == stable) return (stable, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wbtc) return (wbtc, i);\n }\n return (tokens[0], 0);\n }\n\n function addFundingStrategy(\n LiquidationData memory vars,\n IFundsConversionStrategy strategy,\n address debtToken,\n string memory strategyContract,\n address strategyInputToken\n ) internal returns (address) {\n address inputToken;\n bytes memory strategyData;\n\n if (compareStrings(strategyContract, \"JarvisLiquidatorFunder\")) {\n AddressesProvider.JarvisPool[] memory pools = ap.getJarvisPools();\n for (uint256 i = 0; i < pools.length; i++) {\n AddressesProvider.JarvisPool memory pool = pools[i];\n if (pool.syntheticToken == debtToken) {\n strategyData = abi.encode(pool.collateralToken, pool.liquidityPool, pool.expirationTime);\n inputToken = pool.collateralToken;\n break;\n }\n }\n\n // } else if (compareStrings(strategyContract, \"SomeOtherFunder\")) {\n // bytes memory strategyData = abi.encode(strategySpecificParams);\n // (IERC20Upgradeable inputToken, uint256 inputAmount) = IFundsConversionStrategy(addr).estimateInputAmount(10**(debtToken.decimals()), strategyData);\n // fundingStrategies.push(new SomeOtherFunder());\n // return inputToken;\n } else if (compareStrings(strategyContract, \"CurveSwapLiquidatorFunder\")) {\n inputToken = strategyInputToken;\n strategyData = abi.encode(curveV1Oracle, curveV2Oracle, inputToken, debtToken, ap.getAddress(\"wtoken\"));\n } else if (compareStrings(strategyContract, \"UniswapV3LiquidatorFunder\")) {\n inputToken = strategyInputToken;\n\n uint24 fee = 1000;\n address quoter = ap.getAddress(\"Quoter\");\n address swapRouter;\n {\n // TODO\n // polygon config // 0x1F98431c8aD98523631AE4a59f267346ea31F984\n address polygonSwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\n swapRouter = polygonSwapRouter;\n fee = 500;\n }\n\n strategyData = abi.encode(inputToken, debtToken, fee, swapRouter, quoter);\n } else {\n emit log(strategyContract);\n emit log_address(debtToken);\n revert(\"unknown debt token\");\n }\n\n fundingDatas.push(strategyData);\n\n vm.prank(vars.liquidator.owner());\n vars.liquidator._whitelistRedemptionStrategy(strategy, true);\n fundingStrategies.push(strategy);\n\n assertEq(strategyInputToken, inputToken, \"!expected input token\");\n return inputToken;\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testRawLiquidation() public debuggingOnly fork(MODE_MAINNET) {\n vm.prank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n _functionCall(\n 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A,\n hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000fda4ac09a12c10fae30e429f4d6b47c9a83c87e00000000000000000000000000000000000000000000000001797af2fe6e167700000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005ca3fd2c285c4138185ef1bda7573d415020f3c80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n \"raw liquidation failed\"\n );\n }\n}\n" + }, + "contracts/test/AuthoritiesRegistryTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport \"../ionic/AuthoritiesRegistry.sol\";\nimport \"./helpers/WithPool.sol\";\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\ncontract AuthoritiesRegistryTest is WithPool {\n AuthoritiesRegistry registry;\n\n function afterForkSetUp() internal override {\n registry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\n if (address(registry) == address(0)) {\n address proxyAdmin = address(999);\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), proxyAdmin, \"\");\n registry = AuthoritiesRegistry(address(proxy));\n registry.initialize(address(1023));\n }\n\n super.setUpWithPool(\n MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")),\n ERC20Upgradeable(ap.getAddress(\"wtoken\"))\n );\n\n setUpPool(\"auth-reg-test\", false, 0.1e18, 1.1e18);\n }\n\n function testRegistry() public fork(POLYGON_MAINNET) {\n PoolRolesAuthority auth;\n\n vm.prank(address(555));\n vm.expectRevert(\"Ownable: caller is not the owner\");\n auth = registry.createPoolAuthority(address(comptroller));\n\n vm.prank(registry.owner());\n auth = registry.createPoolAuthority(address(comptroller));\n\n assertEq(auth.owner(), registry.owner(), \"!same owner\");\n }\n\n function testAuthReconfigurePermissions() public fork(POLYGON_MAINNET) {\n vm.prank(registry.owner());\n PoolRolesAuthority auth = registry.createPoolAuthority(address(comptroller));\n\n vm.prank(address(8283));\n vm.expectRevert(\"not owner or pool\");\n registry.reconfigureAuthority(address(comptroller));\n\n vm.prank(registry.owner());\n registry.reconfigureAuthority(address(comptroller));\n }\n\n function upgradeRegistry() internal {\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(registry)));\n AuthoritiesRegistry newImpl = new AuthoritiesRegistry();\n vm.startPrank(dpa.owner());\n dpa.upgradeAndCall(\n proxy,\n address(newImpl),\n abi.encodeWithSelector(AuthoritiesRegistry.reinitialize.selector, registry.leveredPositionsFactory())\n );\n vm.stopPrank();\n }\n\n function upgradeAuth(PoolRolesAuthority auth) internal {\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(auth)));\n PoolRolesAuthority newImpl = new PoolRolesAuthority();\n vm.prank(dpa.owner());\n dpa.upgrade(proxy, address(newImpl));\n }\n\n function testAuthPermissions() public debuggingOnly fork(BSC_CHAPEL) {\n address pool = 0xa4bc2fCF2F9d87EB349f74f8729024F92A030330;\n registry = AuthoritiesRegistry(0xa5E190Fa38F325617381e835da8b2DB2D12cE5eb);\n //upgradeRegistry();\n\n PoolRolesAuthority auth = PoolRolesAuthority(0xFe5AfFFC8b55A2d139cb2ef76699C8B58c1EA299);\n //upgradeAuth(auth);\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(auth)));\n\n vm.prank(address(dpa));\n emit log_named_address(\"proxy.implementation\", proxy.implementation());\n\n emit log_named_address(\"registry.poolAuthLogic\", address(registry.poolAuthLogic()));\n //vm.prank(registry.owner());\n //registry.reconfigureAuthority(pool);\n\n bool isReg = auth.doesUserHaveRole(address(registry), auth.REGISTRY_ROLE());\n assertEq(isReg, true, \"!not registry role\");\n\n bool canCall = auth.canCall(address(registry), address(auth), RolesAuthority.setUserRole.selector);\n assertEq(canCall, true, \"!cannot call setUserRol\");\n }\n}\n" + }, + "contracts/test/caps/AdrastiaPrudentiaCapsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\nimport { ComptrollerPrudentiaCapsExt, DiamondExtension } from \"../../compound/ComptrollerPrudentiaCapsExt.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { ComptrollerV4Storage } from \"../../compound/ComptrollerStorage.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\nimport { PrudentiaLib } from \"../../adrastia/PrudentiaLib.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MockPriceOracle } from \"../../oracles/1337/MockPriceOracle.sol\";\n\nimport \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\nabstract contract HistoricalRates is IHistoricalRates {\n struct BufferMetadata {\n uint8 start;\n uint8 end;\n uint8 size;\n uint8 maxSize;\n bool pauseUpdates; // Note: this is left for extentions, but is not used in this contract.\n }\n\n /// @notice Event emitted when a rate buffer's capacity is increased past the initial capacity.\n /// @dev Buffer initialization does not emit an event.\n /// @param token The token for which the rate buffer's capacity was increased.\n /// @param oldCapacity The previous capacity of the rate buffer.\n /// @param newCapacity The new capacity of the rate buffer.\n event RatesCapacityIncreased(address indexed token, uint256 oldCapacity, uint256 newCapacity);\n\n /// @notice Event emitted when a rate buffer's capacity is initialized.\n /// @param token The token for which the rate buffer's capacity was initialized.\n /// @param capacity The capacity of the rate buffer.\n event RatesCapacityInitialized(address indexed token, uint256 capacity);\n\n /// @notice Event emitted when a new rate is pushed to the rate buffer.\n /// @param token The token for which the rate was pushed.\n /// @param target The target rate.\n /// @param current The current rate, which may be different from the target rate if the rate change is capped.\n /// @param timestamp The timestamp at which the rate was pushed.\n event RateUpdated(address indexed token, uint256 target, uint256 current, uint256 timestamp);\n\n /// @notice An error that is thrown if we try to initialize a rate buffer that has already been initialized.\n /// @param token The token for which we tried to initialize the rate buffer.\n error BufferAlreadyInitialized(address token);\n\n /// @notice An error that is thrown if we try to retrieve a rate at an invalid index.\n /// @param token The token for which we tried to retrieve the rate.\n /// @param index The index of the rate that we tried to retrieve.\n /// @param size The size of the rate buffer.\n error InvalidIndex(address token, uint256 index, uint256 size);\n\n /// @notice An error that is thrown if we try to decrease the capacity of a rate buffer.\n /// @param token The token for which we tried to decrease the capacity of the rate buffer.\n /// @param amount The capacity that we tried to decrease the rate buffer to.\n /// @param currentCapacity The current capacity of the rate buffer.\n error CapacityCannotBeDecreased(address token, uint256 amount, uint256 currentCapacity);\n\n /// @notice An error that is thrown if we try to increase the capacity of a rate buffer past the maximum capacity.\n /// @param token The token for which we tried to increase the capacity of the rate buffer.\n /// @param amount The capacity that we tried to increase the rate buffer to.\n /// @param maxCapacity The maximum capacity of the rate buffer.\n error CapacityTooLarge(address token, uint256 amount, uint256 maxCapacity);\n\n /// @notice An error that is thrown if we try to retrieve more rates than are available in the rate buffer.\n /// @param token The token for which we tried to retrieve the rates.\n /// @param size The size of the rate buffer.\n /// @param minSizeRequired The minimum size of the rate buffer that we require.\n error InsufficientData(address token, uint256 size, uint256 minSizeRequired);\n\n /// @notice The initial capacity of the rate buffer.\n uint8 internal immutable initialBufferCardinality;\n\n /// @notice Maps a token to its metadata.\n mapping(address => BufferMetadata) internal rateBufferMetadata;\n\n /// @notice Maps a token to a buffer of rates.\n mapping(address => RateLibrary.Rate[]) internal rateBuffers;\n\n /**\n * @notice Constructs the HistoricalRates contract with a specified initial buffer capacity.\n * @param initialBufferCardinality_ The initial capacity of the rate buffer.\n */\n constructor(uint8 initialBufferCardinality_) {\n initialBufferCardinality = initialBufferCardinality_;\n }\n\n /// @inheritdoc IHistoricalRates\n function getRateAt(address token, uint256 index) external view virtual override returns (RateLibrary.Rate memory) {\n BufferMetadata memory meta = rateBufferMetadata[token];\n\n if (index >= meta.size) {\n revert InvalidIndex(token, index, meta.size);\n }\n\n uint256 bufferIndex = meta.end < index ? meta.end + meta.size - index : meta.end - index;\n\n return rateBuffers[token][bufferIndex];\n }\n\n /// @inheritdoc IHistoricalRates\n function getRates(address token, uint256 amount) external view virtual override returns (RateLibrary.Rate[] memory) {\n return _getRates(token, amount, 0, 1);\n }\n\n /// @inheritdoc IHistoricalRates\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view virtual override returns (RateLibrary.Rate[] memory) {\n return _getRates(token, amount, offset, increment);\n }\n\n /// @inheritdoc IHistoricalRates\n function getRatesCount(address token) external view override returns (uint256) {\n return rateBufferMetadata[token].size;\n }\n\n /// @inheritdoc IHistoricalRates\n function getRatesCapacity(address token) external view virtual override returns (uint256) {\n uint256 maxSize = rateBufferMetadata[token].maxSize;\n if (maxSize == 0) return initialBufferCardinality;\n\n return maxSize;\n }\n\n /// @param amount The new capacity of rates for the token. Must be greater than the current capacity, but\n /// less than 256.\n /// @inheritdoc IHistoricalRates\n function setRatesCapacity(address token, uint256 amount) external virtual {\n _setRatesCapacity(token, amount);\n }\n\n /**\n * @dev Internal function to set the capacity of the rate buffer for a token.\n * @param token The token for which to set the new capacity.\n * @param amount The new capacity of rates for the token. Must be greater than the current capacity, but\n * less than 256.\n */\n function _setRatesCapacity(address token, uint256 amount) internal virtual {\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n if (amount < meta.maxSize) revert CapacityCannotBeDecreased(token, amount, meta.maxSize);\n if (amount > type(uint8).max) revert CapacityTooLarge(token, amount, type(uint8).max);\n\n RateLibrary.Rate[] storage rateBuffer = rateBuffers[token];\n\n // Add new slots to the buffer\n uint256 capacityToAdd = amount - meta.maxSize;\n for (uint256 i = 0; i < capacityToAdd; ++i) {\n // Push a dummy rate with non-zero values to put most of the gas cost on the caller\n rateBuffer.push(RateLibrary.Rate({ target: 1, current: 1, timestamp: 1 }));\n }\n\n if (meta.maxSize != amount) {\n emit RatesCapacityIncreased(token, meta.maxSize, amount);\n\n // Update the metadata\n meta.maxSize = uint8(amount);\n }\n }\n\n /**\n * @dev Internal function to get historical rates with specified amount, offset, and increment.\n * @param token The token for which to retrieve the rates.\n * @param amount The number of historical rates to retrieve.\n * @param offset The number of rates to skip before starting to collect the rates.\n * @param increment The step size between the rates to collect.\n * @return observations An array of Rate structs containing the retrieved historical rates.\n */\n function _getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) internal view virtual returns (RateLibrary.Rate[] memory) {\n if (amount == 0) return new RateLibrary.Rate[](0);\n\n BufferMetadata memory meta = rateBufferMetadata[token];\n if (meta.size <= (amount - 1) * increment + offset)\n revert InsufficientData(token, meta.size, (amount - 1) * increment + offset + 1);\n\n RateLibrary.Rate[] memory observations = new RateLibrary.Rate[](amount);\n\n uint256 count = 0;\n\n for (\n uint256 i = meta.end < offset ? meta.end + meta.size - offset : meta.end - offset;\n count < amount;\n i = (i < increment) ? (i + meta.size) - increment : i - increment\n ) {\n observations[count++] = rateBuffers[token][i];\n }\n\n return observations;\n }\n\n /**\n * @dev Internal function to initialize rate buffers for a token.\n * @param token The token for which to initialize the rate buffer.\n */\n function initializeBuffers(address token) internal virtual {\n if (rateBuffers[token].length != 0) {\n revert BufferAlreadyInitialized(token);\n }\n\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n // Initialize the buffers\n RateLibrary.Rate[] storage observationBuffer = rateBuffers[token];\n\n for (uint256 i = 0; i < initialBufferCardinality; ++i) {\n observationBuffer.push();\n }\n\n // Initialize the metadata\n meta.start = 0;\n meta.end = 0;\n meta.size = 0;\n meta.maxSize = initialBufferCardinality;\n meta.pauseUpdates = false;\n\n emit RatesCapacityInitialized(token, meta.maxSize);\n }\n\n /**\n * @dev Internal function to push a new rate data into the rate buffer and update metadata accordingly.\n * @param token The token for which to push the new rate data.\n * @param rate The Rate struct containing target rate, current rate, and timestamp data to be pushed.\n */\n function push(address token, RateLibrary.Rate memory rate) internal virtual {\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n if (meta.size == 0) {\n if (meta.maxSize == 0) {\n // Initialize the buffers\n initializeBuffers(token);\n }\n } else {\n meta.end = (meta.end + 1) % meta.maxSize;\n }\n\n rateBuffers[token][meta.end] = rate;\n\n emit RateUpdated(token, rate.target, rate.current, block.timestamp);\n\n if (meta.size < meta.maxSize && meta.end == meta.size) {\n // We are at the end of the array and we have not yet filled it\n meta.size++;\n } else {\n // start was just overwritten\n meta.start = (meta.start + 1) % meta.size;\n }\n }\n}\n\ncontract PrudentiaStub is HistoricalRates {\n constructor() HistoricalRates(2) {}\n\n function stubPush(address underlyingToken, uint64 rate) public {\n push(underlyingToken, RateLibrary.Rate({ target: rate, current: rate, timestamp: uint32(block.timestamp) }));\n }\n}\n\ncontract AdrastiaPrudentiaCapsTest is BaseTest {\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicComptroller comptroller;\n\n InterestRateModel interestModel;\n MockPriceOracle priceOracle;\n\n MockERC20 underlyingToken1;\n ICErc20 cToken1;\n\n MockERC20 underlyingToken2;\n ICErc20 cToken2;\n\n MockERC20 underlyingToken3;\n ICErc20 cToken3;\n\n CErc20Delegate cErc20Delegate;\n\n PrudentiaStub prudentia;\n\n function setUp() public {\n // Deploy admin contracts\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n\n // Deploy comptroller logic\n Comptroller comptrollerLogic = new Comptroller();\n\n // Deploy underlying tokens\n underlyingToken1 = new MockERC20(\"UnderlyingToken1\", \"UT1\", 18);\n underlyingToken1.mint(address(this), 1000000e18); // 1M tokens\n underlyingToken2 = new MockERC20(\"UnderlyingToken2\", \"UT2\", 18);\n underlyingToken2.mint(address(this), 1000000e18); // 1M tokens\n underlyingToken3 = new MockERC20(\"UnderlyingToken3\", \"UT3\", 6);\n underlyingToken3.mint(address(this), 1000000e6); // 1M tokens\n\n // Deploy cToken delegates\n cErc20Delegate = new CErc20Delegate();\n\n // Deploy price oracle\n priceOracle = new MockPriceOracle(10);\n\n // Deploy IRM\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n\n // Deploy comptroller\n address[] memory unitroller = new address[](1);\n unitroller[0] = address(comptrollerLogic);\n address[] memory addressZero = new address[](1);\n addressZero[0] = address(0);\n bool[] memory boolTrue = new bool[](1);\n boolTrue[0] = true;\n bool[] memory boolFalse = new bool[](1);\n boolFalse[0] = false;\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(comptrollerLogic));\n DiamondExtension[] memory extensions = new DiamondExtension[](3);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = new ComptrollerPrudentiaCapsExt();\n extensions[2] = comptrollerLogic;\n ionicAdmin._setComptrollerExtensions(address(comptrollerLogic), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\", // name\n address(comptrollerLogic), // implementation address\n abi.encode(payable(address(ionicAdmin))), // constructor args\n false, // whitelist enforcement\n 0.1e18, // close factor = 10%\n 1.1e18, // liquidation incentive = 110%\n address(priceOracle) // price oracle\n );\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n newAr.setUserRole(comptrollerAddress, address(ionicAdmin), poolAuth.SUPPLIER_ROLE(), true);\n\n // Setup CErc20Delegate whitelist\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](1);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n address[] memory oldCErc20Implementations = new address[](1);\n oldCErc20Implementations[0] = address(0);\n address[] memory newCErc20Implementations = new address[](1);\n newCErc20Implementations[0] = address(cErc20Delegate);\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n\n // Deploy cToken1\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken1), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 1\", // cToken name\n \"CT1\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Deploy cToken2\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken2), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 2\", // cToken name\n \"CT2\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Deploy cToken3\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken3), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 3\", // cToken name\n \"CT3\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Store the cToken addresses\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n assertEq(allMarkets.length, 3);\n cToken1 = allMarkets[0];\n cToken2 = allMarkets[1];\n cToken3 = allMarkets[2];\n\n // Deploy Prudentia\n prudentia = new PrudentiaStub();\n }\n\n function test_NativeCaps_UnrestrictedSupply() public {\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), 0); // No supply cap set (unrestricted)\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n }\n\n function test_NativeCaps_RestrictedSupply() public {\n uint256 cap = 9999e18; // supply cap of 9,999\n uint256 mintAmount = 10000e18; // mint of 10,000\n\n // Set a native supply cap for cToken1\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = cap;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cTokens[0])), supplyCaps[0]);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_NativeCaps_UnrestrictedBorrow() public {\n assertEq(comptroller.effectiveBorrowCaps(address(cToken1)), 0); // No borrow cap set (unrestricted)\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Borrow\n cToken2.borrow(1000e18); // Borrow 1,000 cToken2\n }\n\n function test_NativeCaps_RestrictedBorrow() public {\n uint256 cap = 999e18; // borrow cap of 999\n uint256 borrowAmount = 1000e18; // borrow of 1,000\n\n // Set a native borrow cap for cToken2\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = cap;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cTokens[0])), borrowCaps[0]);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0\n */\n\n function test_Prudentia_Supply_Unrestricted() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Supply cap\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_MissingRate_WithRateConfiguredForAnotherCToken() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken2\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted supply cap for cToken2\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken2)), 0); // Unrestricted\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_WithRateConfiguredForAnotherCToken() public {\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken1\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted borrow cap for cToken1\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken1)), 0); // Unrestricted\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and a decimal shift of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_DecShiftPos1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e19);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e19);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e19);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e19);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and a decimal shift of -1\n */\n\n function test_Prudentia_Supply_Unrestricted_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_DecShiftNeg1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e17);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e17);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e17);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e17);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and using a cToken with the underlying token having 6 decimals\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 0, using a cToken with the underlying token having 6 decimals,\n * and a decimalShift of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 0, using a cToken with the underlying token having 6 decimals,\n * and a decimalShift of -1\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_Offset1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // Unrestricted cap at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_Offset1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1 at index 1 (the offset)\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_Offset1() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_Offset1() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_Offset1() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_Offset1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_Offset1() public {\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2 at index 1 (the offset)\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_Offset1() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n Additional ComptrollerPrudentiaCapsExt tests\n */\n\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n function test_Prudentia_SupplyCapConfig() public {\n PrudentiaLib.PrudentiaConfig memory oldConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(0),\n offset: 0,\n decimalShift: 0\n });\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Setup expectation of the following event\n vm.expectEmit(false, false, false, true);\n emit NewSupplyCapConfig(oldConfig, newConfig);\n\n // Set supply cap config\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(newConfig);\n\n // Get the supply cap config\n PrudentiaLib.PrudentiaConfig memory current = ComptrollerPrudentiaCapsExt(address(comptroller))\n .getSupplyCapConfig();\n\n assertEq(newConfig.controller, current.controller, \"controller\");\n assertEq(newConfig.offset, current.offset, \"offset\");\n }\n\n function test_Prudentia_BorrowCapConfig() public {\n PrudentiaLib.PrudentiaConfig memory oldConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(0),\n offset: 0,\n decimalShift: 0\n });\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Setup expectation of the following event\n vm.expectEmit(false, false, false, true);\n emit NewBorrowCapConfig(oldConfig, newConfig);\n\n // Set borrow cap config\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(newConfig);\n\n // Get the borrow cap config\n PrudentiaLib.PrudentiaConfig memory current = ComptrollerPrudentiaCapsExt(address(comptroller))\n .getBorrowCapConfig();\n\n assertEq(newConfig.controller, current.controller, \"controller\");\n assertEq(newConfig.offset, current.offset, \"offset\");\n }\n\n function test_Prudentia_SetSupplyCapConfig_OnlyAdmin() public {\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Set supply cap config\n vm.prank(address(7));\n vm.expectRevert(\"!admin\");\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(newConfig);\n }\n\n function test_Prudentia_SetBorrowCapConfig_OnlyAdmin() public {\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Set supply cap config\n vm.prank(address(7));\n vm.expectRevert(\"!admin\");\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(newConfig);\n }\n}\n" + }, + "contracts/test/CollateralSwapTest.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CollateralSwap } from \"../ionic/CollateralSwap.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\n\ncontract CollateralSwapTest is UpgradesBaseTest {\n ICErc20 wethMarket = ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3);\n ICErc20 usdcMarket = ICErc20(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0);\n ICErc20 ezETHMarket = ICErc20(0x079f84161642D81aaFb67966123C9949F9284bf5);\n ICErc20 cbETHMarket = ICErc20(0x9c201024A62466F9157b2dAaDda9326207ADDd29);\n PoolLens lens = PoolLens(0x6ec80f9aCd960b568932696C0F0bE06FBfCd175a);\n CollateralSwap swap;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n _upgradeMarketWithExtension(wethMarket);\n _upgradeMarketWithExtension(ezETHMarket);\n _upgradeMarketWithExtension(cbETHMarket);\n _upgradeMarketWithExtension(usdcMarket);\n swap = new CollateralSwap(0, msg.sender, address(wethMarket.comptroller()), new address[](0));\n emit log_named_address(\"swap address: \", address(swap));\n }\n\n function test_collateralSwap_works_noBorrows() public debuggingOnly forkAtBlock(BASE_MAINNET, 20754244) {\n address ionwethWhale = 0x753E909D68921388b8fB4E471D155ff73c735ebC;\n address swapTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE;\n swap.setAllowedSwapTarget(swapTarget, true);\n uint256 healthFactor = lens.getHealthFactor(0x753E909D68921388b8fB4E471D155ff73c735ebC, wethMarket.comptroller());\n emit log_named_uint(\"health factor before: \", healthFactor);\n bytes memory swapData = abi.encodePacked(\n hex\"5fd9ae2ea41bd686f6e5326450d10ac2dc733b837ae20fb0aaf871e87b4a9227171918ab00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000a0cb889707d426a7a386870a03bc70d1b0697598000000000000000000000000000000000000000000000000000000001d42cce300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000005696f6e6963000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000a6d96e7f4d7b96cfe42185df61e64d255c12dff0000000000000000000000000a6d96e7f4d7b96cfe42185df61e64d255c12dff0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000000002d02dd2e34e182400000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000084eedd56e100000000000000000000000042000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000b85da6a0970f0000000000000000000000000000000000000000000000000001ccea209179a9000000000000000000000000d5ee82d18f63f0b82df91a6ae73b74cfda57144e000000000000000000000000000000000000000000000000000000000000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000000000000000000000002cda88b1c1c076b00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa490411a32000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a99000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a990000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae00000000000000000000000000000000000000000000000002cda88b1c1c076b000000000000000000000000000000000000000000000000000000001d42cce3000000000000000000000000000000000000000000000000000000001d68714c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab3000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000004d69971ccd4a636c403a3c1b00c85e99bb9b5606000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000002cda88b1c1c076b000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e4200000000000000000000000000000000000006000064b79dd08ea68a908a97220c76d19a6aa9cbde437600002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002449f865422000000000000000000000000b79dd08ea68a908a97220c76d19a6aa9cbde437600000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000000c1a09d5d0445047da3ab4994262b22404288a3b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002eb79dd08ea68a908a97220c76d19a6aa9cbde4376000001833589fcd6edb6e08f4c7c32d4f71b54bda029130000260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e85000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a0000000000000000000000000000000000000000000000000000000001d68714c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f865422000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n vm.startPrank(ionwethWhale);\n wethMarket.approve(address(swap), 1e18);\n swap.swapCollateral(1e18, wethMarket, usdcMarket, swapTarget, swapData);\n vm.stopPrank();\n healthFactor = lens.getHealthFactor(0x753E909D68921388b8fB4E471D155ff73c735ebC, wethMarket.comptroller());\n emit log_named_uint(\"health factor after: \", healthFactor);\n }\n\n function test_collateralSwap_worksWithBorrows() public debuggingOnly forkAtBlock(BASE_MAINNET, 20874971) {\n address ionezEthWhale = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address swapTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE;\n swap.setAllowedSwapTarget(swapTarget, true);\n bytes memory swapData = abi.encodePacked(\n hex\"4666fc80a7f78b3a1e00f74ab91e766714a7b7390c173e43f2f65d7c74bda18ff1e067dd00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000d6bbde9174b1cdaa358d2cf4d57d1a9f7178fbff000000000000000000000000000000000000000000000000003625685b773877000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000002416092f143378750bb29b79ed961ab195cceea50000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000000000000000000000000000000000000000000000000039afc19de8c3ba00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000aa490411a32000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a99000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000002416092f143378750bb29b79ed961ab195cceea50000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a990000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000039afc19de8c3ba000000000000000000000000000000000000000000000000003625685b77387700000000000000000000000000000000000000000000000000366b101e2d34e40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab3000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000004c98e9c2439c0d4621c62fee2fed6d042fa8c57000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000039afc19de8c3ba000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e2416092f143378750bb29b79ed961ab195cceea5000064420000000000000000000000000000000000000600000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002449f865422000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb000000000000000000000000257fcbae4ac6b26a02e4fc5e1a11e4174b5ce39500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e42000000000000000000000000000000000000060000642ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e850000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a000000000000000000000000000000000000000000000000000366b101e2d34e400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f8654220000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec2200000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f990000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n (uint256 error, uint256 balance, uint256 borrowBalance, uint256 exchangeRateMantissa) = ezETHMarket\n .getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"ezETH error: \", error);\n emit log_named_uint(\"ezETH balance: \", balance);\n emit log_named_uint(\"ezETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"ezETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n (error, balance, borrowBalance, exchangeRateMantissa) = cbETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"cbETH error: \", error);\n emit log_named_uint(\"cbETH balance: \", balance);\n emit log_named_uint(\"cbETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"cbETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n vm.startPrank(ionezEthWhale);\n ezETHMarket.approve(address(swap), type(uint256).max);\n uint256 healthFactor = lens.getHealthFactor(ionezEthWhale, ezETHMarket.comptroller());\n emit log_named_uint(\"health factor before: \", healthFactor);\n swap.swapCollateral(16237319785333690, ezETHMarket, cbETHMarket, swapTarget, swapData);\n healthFactor = lens.getHealthFactor(ionezEthWhale, ezETHMarket.comptroller());\n emit log_named_uint(\"health factor after: \", healthFactor);\n vm.stopPrank();\n\n (error, balance, borrowBalance, exchangeRateMantissa) = ezETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"ezETH error: \", error);\n emit log_named_uint(\"ezETH balance: \", balance);\n emit log_named_uint(\"ezETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"ezETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n (error, balance, borrowBalance, exchangeRateMantissa) = cbETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"cbETH error: \", error);\n emit log_named_uint(\"cbETH balance: \", balance);\n emit log_named_uint(\"cbETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"cbETH exchangeRateMantissa: \", exchangeRateMantissa);\n }\n}\n" + }, + "contracts/test/ComptrollerTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\n\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract ComptrollerTest is BaseTest {\n IonicComptroller internal comptroller;\n IonicFlywheel internal flywheel;\n address internal nonOwner = address(0x2222);\n\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n function setUp() public {\n {\n Unitroller proxy = new Unitroller(payable(address(this)));\n proxy._registerExtension(new Comptroller(), DiamondExtension(address(0)));\n comptroller = IonicComptroller(address(proxy));\n }\n {\n ERC20 rewardToken = new MockERC20(\"RewardToken\", \"RT\", 18);\n IonicFlywheel impl = new IonicFlywheel();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(dpa), \"\");\n flywheel = IonicFlywheel(address(proxy));\n flywheel.initialize(rewardToken, IFlywheelRewards(address(2)), IFlywheelBooster(address(3)), address(this));\n }\n }\n\n function test__setFlywheel() external {\n vm.prank(comptroller.admin());\n comptroller._addRewardsDistributor(address(flywheel));\n assertEq(comptroller.rewardsDistributors(0), address(flywheel));\n }\n\n function test__setFlywheelRevertsIfNonOwner() external {\n vm.startPrank(nonOwner);\n vm.expectRevert(\"!admin\");\n comptroller._addRewardsDistributor(address(flywheel));\n }\n\n function testBscInflationProtection() public debuggingOnly fork(BSC_MAINNET) {\n _testInflationProtection();\n }\n\n function testPolygonInflationProtection() public debuggingOnly fork(POLYGON_MAINNET) {\n _testInflationProtection();\n }\n\n function testModeInflationProtection() public debuggingOnly fork(MODE_MAINNET) {\n _testInflationProtection();\n }\n\n function _testInflationProtection() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n PoolDirectory.Pool[] memory pools = fpd.getAllPools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = pool.getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n uint256 totalSupply = market.totalSupply();\n if (totalSupply > 0) {\n if (totalSupply < 1000) {\n emit log_named_address(\"low ts market\", address(markets[j]));\n emit log_named_uint(\"ts\", totalSupply);\n } else {\n assertEq(\n pool.redeemAllowed(address(markets[j]), address(0), totalSupply - 980),\n uint256(ComptrollerErrorReporter.Error.REJECTION),\n \"low ts not rejected\"\n );\n }\n }\n }\n }\n }\n}\n" + }, + "contracts/test/config/BaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Vm.sol\";\nimport \"forge-std/Test.sol\";\nimport \"forge-std/console.sol\";\n\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\n\nabstract contract BaseTest is Test {\n uint128 constant ETHEREUM_MAINNET = 1;\n uint128 constant BSC_MAINNET = 56;\n uint128 constant POLYGON_MAINNET = 137;\n uint128 constant ARBITRUM_ONE = 42161;\n\n uint128 constant BSC_CHAPEL = 97;\n uint128 constant NEON_MAINNET = 245022934;\n uint128 constant LINEA_MAINNET = 59144;\n uint128 constant ZKEVM_MAINNET = 1101;\n uint128 constant MODE_MAINNET = 34443;\n uint128 constant BASE_MAINNET = 8453;\n\n // taken from ERC1967Upgrade\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n AddressesProvider public ap;\n ProxyAdmin public dpa;\n\n mapping(uint128 => uint256) private forkIds;\n\n constructor() {\n configureAddressesProvider(0);\n }\n\n uint256 constant CRITICAL = 100;\n uint256 constant NORMAL = 90;\n uint256 constant LOW = 80;\n\n modifier importance(uint256 testImportance) {\n uint256 runLevel = NORMAL;\n\n try vm.envUint(\"TEST_RUN_LEVEL\") returns (uint256 level) {\n runLevel = level;\n } catch {\n emit log(\"failed to get env param TEST_RUN_LEVEL\");\n }\n\n if (testImportance >= runLevel) {\n _;\n } else {\n emit log(\"not running the test\");\n }\n }\n\n modifier debuggingOnly() {\n try vm.envBool(\"LOCAL_FORGE_ENV\") returns (bool run) {\n if (run) _;\n } catch {\n emit log(\"skipping this test in the CI/CD - add LOCAL_FORGE_ENV=true to your .env file to run locally\");\n }\n }\n\n modifier fork(uint128 chainid) {\n if (shouldRunForChain(chainid)) {\n _forkAtBlock(chainid, 0);\n _;\n }\n }\n\n modifier forkAtBlock(uint128 chainid, uint256 blockNumber) {\n if (shouldRunForChain(chainid)) {\n _forkAtBlock(chainid, blockNumber);\n _;\n }\n }\n\n modifier whenForking() {\n try vm.activeFork() returns (uint256) {\n _;\n } catch {}\n }\n\n function shouldRunForChain(uint256 chainid) internal returns (bool) {\n bool run = true;\n try vm.envUint(\"TEST_RUN_CHAINID\") returns (uint256 envChainId) {\n run = envChainId == chainid;\n } catch {\n emit log(\"failed to get env param TEST_RUN_CHAINID\");\n }\n return run;\n }\n\n function _forkAtBlock(uint128 chainid, uint256 blockNumber) internal {\n if (block.chainid != chainid) {\n if (blockNumber != 0) {\n vm.selectFork(getArchiveForkId(chainid));\n vm.rollFork(blockNumber);\n } else {\n vm.selectFork(getForkId(chainid));\n }\n }\n configureAddressesProvider(chainid);\n afterForkSetUp();\n }\n\n function getForkId(uint128 chainid, bool archive) private returns (uint256) {\n return archive ? getForkId(chainid) : getArchiveForkId(chainid);\n }\n\n function getForkId(uint128 chainid) private returns (uint256) {\n if (forkIds[chainid] == 0) {\n if (chainid == BSC_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc\")) + 100;\n } else if (chainid == BSC_CHAPEL) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc_chapel\")) + 100;\n } else if (chainid == POLYGON_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"polygon\")) + 100;\n } else if (chainid == NEON_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"neon\")) + 100;\n } else if (chainid == ARBITRUM_ONE) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"arbitrum\")) + 100;\n } else if (chainid == ETHEREUM_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"ethereum\")) + 100;\n } else if (chainid == LINEA_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"linea\")) + 100;\n } else if (chainid == ZKEVM_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"zkevm\")) + 100;\n } else if (chainid == MODE_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"mode\")) + 100;\n } else if (chainid == BASE_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"base\")) + 100;\n }\n }\n\n return forkIds[chainid] - 100;\n }\n\n function getArchiveForkId(uint128 chainid) private returns (uint256) {\n // store the archive rpc urls in the forkIds mapping at an offset\n uint128 chainidWithOffset = chainid + type(uint64).max;\n if (forkIds[chainidWithOffset] == 0) {\n if (chainid == BSC_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_archive\")) + 100;\n } else if (chainid == BSC_CHAPEL) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_chapel_archive\")) + 100;\n } else if (chainid == POLYGON_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"polygon_archive\")) + 100;\n } else if (chainid == NEON_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"neon_archive\")) + 100;\n } else if (chainid == ARBITRUM_ONE) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"arbitrum_archive\")) + 100;\n } else if (chainid == ETHEREUM_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"ethereum_archive\")) + 100;\n } else if (chainid == LINEA_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"linea_archive\")) + 100;\n } else if (chainid == ZKEVM_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"zkevm_archive\")) + 100;\n } else if (chainid == MODE_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"mode_archive\")) + 100;\n } else if (chainid == BASE_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"base_archive\")) + 100;\n }\n }\n return forkIds[chainidWithOffset] - 100;\n }\n\n function afterForkSetUp() internal virtual {}\n\n function configureAddressesProvider(uint128 chainid) private {\n if (chainid == BSC_MAINNET) {\n ap = AddressesProvider(address(0));\n } else if (chainid == BSC_CHAPEL) {\n ap = AddressesProvider(0x3dc8CE9f581e49B9E5304CF580940ad341F64c3f);\n } else if (block.chainid == POLYGON_MAINNET) {\n ap = AddressesProvider(0xE31baC0B582AA248c0017F87F24087cEa7A55E26);\n } else if (chainid == NEON_MAINNET) {\n ap = AddressesProvider(0xF4C60F6ac6b3AF54044757a1a54D76EEe28244CE);\n } else if (chainid == ARBITRUM_ONE) {\n ap = AddressesProvider(0x3B12BA992259Fb3855C4E1D452a754dCa2E276fC);\n } else if (chainid == LINEA_MAINNET) {\n ap = AddressesProvider(0x914694DA0bED80e74ef1a28029f016119782C0f1);\n } else if (chainid == ZKEVM_MAINNET) {\n ap = AddressesProvider(0x27aA55A3D55959261e119d75256aadAB79aE897C);\n } else if (chainid == MODE_MAINNET) {\n ap = AddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n } else if (chainid == BASE_MAINNET) {\n ap = AddressesProvider(0xcD4D7c8e2bA627684a9B18F7fe88239341D3ba5c);\n } else {\n dpa = new ProxyAdmin();\n AddressesProvider logic = new AddressesProvider();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(logic),\n address(dpa),\n abi.encodeWithSelector(ap.initialize.selector, address(this))\n );\n ap = AddressesProvider(address(proxy));\n ap.setAddress(\"DefaultProxyAdmin\", address(dpa));\n }\n dpa = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n if (ap.owner() == address(0)) {\n ap.initialize(address(this));\n }\n if (ap.getAddress(\"deployer\") == address(0)) {\n vm.prank(ap.owner());\n ap.setAddress(\"deployer\", 0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n }\n }\n\n function diff(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a > b) {\n return a - b;\n } else {\n return b - a;\n }\n }\n\n function compareStrings(string memory a, string memory b) public pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n\n function asArray(address value) public pure returns (address[] memory) {\n address[] memory array = new address[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(address value0, address value1) public pure returns (address[] memory) {\n address[] memory array = new address[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(\n address value0,\n address value1,\n address value2\n ) public pure returns (address[] memory) {\n address[] memory array = new address[](3);\n array[0] = value0;\n array[1] = value1;\n array[2] = value2;\n return array;\n }\n\n function asArray(bool value) public pure returns (bool[] memory) {\n bool[] memory array = new bool[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(uint256 value0, uint256 value1) public pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(uint256 value) public pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(bytes memory value) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(bytes memory value0, bytes memory value1) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(\n bytes memory value0,\n bytes memory value1,\n bytes memory value2\n ) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](3);\n array[0] = value0;\n array[1] = value1;\n array[2] = value2;\n return array;\n }\n\n function sqrt(uint256 x) public pure returns (uint256) {\n if (x == 0) return 0;\n uint256 xx = x;\n uint256 r = 1;\n\n if (xx >= 0x100000000000000000000000000000000) {\n xx >>= 128;\n r <<= 64;\n }\n if (xx >= 0x10000000000000000) {\n xx >>= 64;\n r <<= 32;\n }\n if (xx >= 0x100000000) {\n xx >>= 32;\n r <<= 16;\n }\n if (xx >= 0x10000) {\n xx >>= 16;\n r <<= 8;\n }\n if (xx >= 0x100) {\n xx >>= 8;\n r <<= 4;\n }\n if (xx >= 0x10) {\n xx >>= 4;\n r <<= 2;\n }\n if (xx >= 0x8) {\n r <<= 1;\n }\n\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return (r < r1 ? r : r1);\n }\n}\n" + }, + "contracts/test/config/MarketsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./BaseTest.t.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\nimport { CErc20RewardsDelegate } from \"../../compound/CErc20RewardsDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\nimport { DiamondExtension } from \"../../ionic/DiamondExtension.sol\";\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract MarketsTest is BaseTest {\n FeeDistributor internal ffd;\n\n CErc20Delegate internal cErc20Delegate;\n CErc20PluginDelegate internal cErc20PluginDelegate;\n CErc20RewardsDelegate internal cErc20RewardsDelegate;\n CErc20PluginRewardsDelegate internal cErc20PluginRewardsDelegate;\n CTokenFirstExtension internal newCTokenExtension;\n\n address payable internal latestComptrollerImplementation;\n ComptrollerFirstExtension internal comptrollerExtension;\n\n function afterForkSetUp() internal virtual override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n upgradeFfd();\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20RewardsDelegate = new CErc20RewardsDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n newCTokenExtension = new CTokenFirstExtension();\n\n comptrollerExtension = new ComptrollerFirstExtension();\n Comptroller newComptrollerImplementation = new Comptroller();\n latestComptrollerImplementation = payable(address(newComptrollerImplementation));\n }\n\n function upgradeFfd() internal {\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffd)));\n bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n if (address(ffd.authoritiesRegistry()) == address(0)) {\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n vm.prank(ffd.owner());\n ffd.reinitialize(newAr);\n }\n }\n\n function _prepareCTokenUpgrade(ICErc20 market) internal returns (address) {\n address implBefore = market.implementation();\n //emit log(\"implementation before\");\n //emit log_address(implBefore);\n\n CErc20Delegate newImpl;\n if (market.delegateType() == 1) {\n newImpl = cErc20Delegate;\n } else if (market.delegateType() == 2) {\n newImpl = cErc20PluginDelegate;\n } else if (market.delegateType() == 3) {\n newImpl = cErc20RewardsDelegate;\n } else {\n newImpl = cErc20PluginRewardsDelegate;\n }\n\n // set the new ctoken delegate as the latest\n uint8 delegateType = market.delegateType();\n vm.prank(ffd.owner());\n ffd._setLatestCErc20Delegate(delegateType, address(newImpl), abi.encode(address(0)));\n\n // add the extension to the auto upgrade config\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = DiamondExtension(newImpl);\n cErc20DelegateExtensions[1] = newCTokenExtension;\n vm.prank(ffd.owner());\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\n\n return address(newImpl);\n }\n\n function _upgradeMarket(ICErc20 market) internal {\n address newDelegate = _prepareCTokenUpgrade(market);\n\n bytes memory becomeImplData = (address(newDelegate) == address(cErc20Delegate))\n ? bytes(\"\")\n : abi.encode(address(0));\n vm.prank(market.ionicAdmin());\n market._setImplementationSafe(newDelegate, becomeImplData);\n }\n\n function _prepareComptrollerUpgrade(address oldCompImpl) internal {\n vm.startPrank(ffd.owner());\n ffd._setLatestComptrollerImplementation(oldCompImpl, latestComptrollerImplementation);\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = comptrollerExtension;\n extensions[1] = Comptroller(latestComptrollerImplementation);\n ffd._setComptrollerExtensions(latestComptrollerImplementation, extensions);\n vm.stopPrank();\n }\n\n function _upgradeExistingPool(address poolAddress) internal {\n Unitroller asUnitroller = Unitroller(payable(poolAddress));\n // change the implementation to the new that can add extensions\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\n\n _prepareComptrollerUpgrade(oldComptrollerImplementation);\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/ContractsUpgradesTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ComptrollerFirstExtension, DiamondExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract ContractsUpgradesTest is BaseTest {\n function testPoolDirectoryUpgrade() public fork(BSC_MAINNET) {\n address contractToTest = ap.getAddress(\"PoolDirectory\"); // PoolDirectory proxy\n\n // before upgrade\n PoolDirectory fpdBefore = PoolDirectory(contractToTest);\n PoolDirectory.Pool[] memory poolsBefore = fpdBefore.getAllPools();\n address ownerBefore = fpdBefore.owner();\n emit log_address(ownerBefore);\n\n uint256 lenBefore = poolsBefore.length;\n emit log_uint(lenBefore);\n\n // upgrade\n {\n PoolDirectory newImpl = new PoolDirectory();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(contractToTest));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n // after upgrade\n PoolDirectory fpd = PoolDirectory(contractToTest);\n address ownerAfter = fpd.owner();\n emit log_address(ownerAfter);\n\n (, PoolDirectory.Pool[] memory poolsAfter) = fpd.getActivePools();\n uint256 lenAfter = poolsAfter.length;\n emit log_uint(poolsAfter.length);\n\n assertEq(lenBefore, lenAfter, \"pools count does not match\");\n assertEq(ownerBefore, ownerAfter, \"owner mismatch\");\n }\n\n function testFeeDistributorUpgrade() public fork(BSC_MAINNET) {\n // TODO use an already deployed market\n CErc20Delegate oldCercDelegate = new CErc20Delegate();\n\n // before upgrade\n FeeDistributor ffdProxy = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n uint256 marketsCounterBefore = ffdProxy.marketsCounter();\n address ownerBefore = ffdProxy.owner();\n\n (address latestCErc20DelegateBefore, ) = ffdProxy.latestCErc20Delegate(oldCercDelegate.delegateType());\n\n emit log_uint(marketsCounterBefore);\n emit log_address(ownerBefore);\n\n // upgrade\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffdProxy)));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n // after upgrade\n FeeDistributor ffd = FeeDistributor(payable(address(ffdProxy)));\n\n uint256 marketsCounterAfter = ffd.marketsCounter();\n address ownerAfter = ffd.owner();\n (address latestCErc20DelegateAfter, ) = ffd.latestCErc20Delegate(oldCercDelegate.delegateType());\n\n emit log_uint(marketsCounterAfter);\n emit log_address(ownerAfter);\n\n assertEq(latestCErc20DelegateBefore, latestCErc20DelegateAfter, \"latest delegates do not match\");\n assertEq(marketsCounterBefore, marketsCounterAfter, \"markets counter does not match\");\n\n assertEq(ownerBefore, ownerAfter, \"owner mismatch\");\n }\n\n function testMarketsLatestImplementationsChapel() public fork(BSC_CHAPEL) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsBsc() public fork(BSC_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsPolygon() public fork(POLYGON_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsArbitrum() public fork(ARBITRUM_ONE) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsEth() public fork(ETHEREUM_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function _testMarketsLatestImplementations() internal {\n FeeDistributor ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n if (address(fpd) != address(0)) {\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = pool.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n\n uint8 currentDelegateType = market.delegateType();\n (address upgradeToImpl, ) = ffd.latestCErc20Delegate(currentDelegateType);\n\n address currentImpl = market.implementation();\n if (currentImpl != upgradeToImpl) emit log_address(address(market));\n assertEq(currentImpl, upgradeToImpl, \"market needs to be upgraded\");\n\n DiamondBase asBase = DiamondBase(address(markets[j]));\n try asBase._listExtensions() returns (address[] memory extensions) {\n assertEq(extensions.length, 2, \"market is missing an extension\");\n } catch {\n emit log(\"market that is not yet upgraded to the extensions upgrade\");\n emit log_address(address(market));\n emit log(\"implementation\");\n emit log_address(currentImpl);\n emit log(\"pool\");\n emit log_address(pools[i].comptroller);\n emit log(\"\");\n }\n }\n }\n }\n }\n\n function testPauseGuardiansBsc() public debuggingOnly fork(BSC_MAINNET) {\n _testPauseGuardians();\n }\n\n // TODO redeploy to polygon to fix\n function testPauseGuardiansPolygon() public debuggingOnly fork(POLYGON_MAINNET) {\n _testPauseGuardians();\n }\n\n function _testPauseGuardians() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n address deployer = ap.getAddress(\"deployer\");\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address pauseGuardian = pool.pauseGuardian();\n if (pauseGuardian != address(0) && pauseGuardian != deployer) {\n emit log_named_address(\"pool\", address(pool));\n emit log_named_address(\"unknown pause guardian\", pauseGuardian);\n emit log(\"\");\n }\n }\n }\n}\n" + }, + "contracts/test/DeployMarkets.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Test.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { IonicFlywheelDynamicRewardsPlugin } from \"../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol\";\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ICErc20, ICErc20Plugin, ICErc20PluginRewards } from \"../compound/CTokenInterfaces.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AuthoritiesRegistry } from \"../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport { MockPriceOracle } from \"../oracles/1337/MockPriceOracle.sol\";\nimport { MockERC4626 } from \"../ionic/strategies/MockERC4626.sol\";\nimport { MockERC4626Dynamic } from \"../ionic/strategies/MockERC4626Dynamic.sol\";\n\ncontract DeployMarketsTest is Test {\n MockERC20 underlyingToken;\n MockERC20 rewardToken;\n\n JumpRateModel interestModel;\n IonicComptroller comptroller;\n\n CErc20Delegate cErc20Delegate;\n CErc20PluginDelegate cErc20PluginDelegate;\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\n\n MockERC4626 mockERC4626;\n MockERC4626Dynamic mockERC4626Dynamic;\n\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicFlywheelDynamicRewardsPlugin rewards;\n\n address[] markets;\n bool[] t;\n bool[] f;\n IonicFlywheelCore[] flywheelsToClaim;\n\n function setUpBaseContracts() public {\n underlyingToken = new MockERC20(\"UnderlyingToken\", \"UT\", 18);\n rewardToken = new MockERC20(\"RewardToken\", \"RT\", 18);\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n }\n\n function setUpExtensions() public {\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = cErc20Delegate;\n cErc20DelegateExtensions[1] = new CTokenFirstExtension();\n ionicAdmin._setCErc20DelegateExtensions(address(0), cErc20DelegateExtensions);\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n\n cErc20DelegateExtensions[0] = cErc20PluginDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\n\n cErc20DelegateExtensions[0] = cErc20PluginRewardsDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\n\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginDelegate.delegateType(),\n address(cErc20PluginDelegate),\n abi.encode(address(0))\n );\n\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginRewardsDelegate.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0))\n );\n }\n\n function setUpPool() public {\n underlyingToken.mint(address(this), 100e36);\n\n MockPriceOracle priceOracle = new MockPriceOracle(10);\n Comptroller tempComptroller = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))),\n false,\n 0.1e18,\n 1.1e18,\n address(priceOracle)\n );\n\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n newAr.setUserRole(comptrollerAddress, address(ionicAdmin), poolAuth.SUPPLIER_ROLE(), true);\n }\n\n function setUp() public {\n setUpBaseContracts();\n setUpPool();\n setUpExtensions();\n vm.roll(1);\n }\n\n function testDeployCErc20Delegate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n require(cToken.mint(10e18) == 0, \"mint failed\");\n assertEq(cToken.totalSupply(), 10e18 * 5);\n assertEq(underlyingToken.balanceOf(address(cToken)), 10e18);\n }\n\n function testDeployCErc20PluginDelegate() public {\n mockERC4626 = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(mockERC4626),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(mockERC4626), \"!plugin == erc4626\");\n\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n cToken.mint(10e18);\n assertEq(cToken.totalSupply(), 10e18 * 5);\n assertEq(mockERC4626.balanceOf(address(cToken)), 10e18);\n assertEq(underlyingToken.balanceOf(address(mockERC4626)), 10e18);\n }\n\n function testDeployCErc20PluginRewardsDelegate() public {\n IonicFlywheelCore impl = new IonicFlywheelCore();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n IonicFlywheelCore flywheel = IonicFlywheelCore(address(proxy));\n flywheel.initialize(underlyingToken, IFlywheelRewards(address(0)), IFlywheelBooster(address(0)), address(this));\n IonicFlywheelCore asFlywheelCore = IonicFlywheelCore(address(flywheel));\n rewards = new IonicFlywheelDynamicRewardsPlugin(asFlywheelCore, 1);\n flywheel.setFlywheelRewards(rewards);\n\n mockERC4626Dynamic = new MockERC4626Dynamic(ERC20(address(underlyingToken)), asFlywheelCore);\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginRewardsDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(address(mockERC4626Dynamic), address(flywheel), address(underlyingToken)),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20PluginRewards cToken = ICErc20PluginRewards(address(allMarkets[allMarkets.length - 1]));\n\n flywheel.addStrategyForRewards(ERC20(address(cToken)));\n\n assertEq(address(cToken.plugin()), address(mockERC4626Dynamic), \"!plugin == erc4626\");\n assertEq(underlyingToken.allowance(address(cToken), address(mockERC4626Dynamic)), type(uint256).max);\n assertEq(underlyingToken.allowance(address(cToken), address(flywheel)), 0);\n\n cToken.approve(address(rewardToken), address(flywheel));\n assertEq(rewardToken.allowance(address(cToken), address(flywheel)), type(uint256).max);\n\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n cToken.mint(10000000);\n assertEq(cToken.totalSupply(), 10000000 * 5);\n assertEq(mockERC4626Dynamic.balanceOf(address(cToken)), 10000000);\n assertEq(underlyingToken.balanceOf(address(mockERC4626Dynamic)), 10000000);\n }\n\n function testAutoImplementationCErc20Delegate() public {\n mockERC4626 = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(mockERC4626),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(mockERC4626), \"!plugin == erc4626\");\n\n address implBefore = cToken.implementation();\n // just testing to replace the plugin delegate with the plugin rewards delegate\n ionicAdmin._setLatestCErc20Delegate(\n cToken.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0)) // should trigger use of latest implementation\n );\n\n // run the upgrade\n vm.prank(ionicAdmin.owner());\n ionicAdmin.autoUpgradePool(comptroller);\n\n address implAfter = cToken.implementation();\n\n assertEq(implBefore, address(cErc20PluginDelegate), \"the old impl should be the plugin delegate\");\n assertEq(implAfter, address(cErc20PluginRewardsDelegate), \"the new impl should be the plugin rewards delegate\");\n }\n\n function testAutoImplementationPlugin() public {\n MockERC4626 pluginA = new MockERC4626(ERC20(address(underlyingToken)));\n MockERC4626 pluginB = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(pluginA),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(pluginA), \"!plugin == erc4626\");\n\n address pluginImplBefore = address(cToken.plugin());\n ionicAdmin._setLatestPluginImplementation(address(pluginA), address(pluginB));\n ionicAdmin._upgradePluginToLatestImplementation(address(cToken));\n address pluginImplAfter = address(cToken.plugin());\n\n assertEq(pluginImplBefore, address(pluginA), \"the old impl should be the A plugin\");\n assertEq(pluginImplAfter, address(pluginB), \"the new impl should be the B plugin\");\n }\n\n function testAutoImplementationCErc20PluginDelegate() public {\n MockERC4626 pluginA = new MockERC4626(ERC20(address(underlyingToken)));\n MockERC4626 pluginB = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(pluginA),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(pluginA), \"!plugin == erc4626\");\n\n address pluginImplBefore = address(cToken.plugin());\n address implBefore = cToken.implementation();\n uint8 delegateType = cToken.delegateType();\n\n // just testing to replace the plugin delegate with the plugin rewards delegate\n ionicAdmin._setLatestCErc20Delegate(\n delegateType,\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0)) // should trigger use of latest implementation\n );\n ionicAdmin._setLatestPluginImplementation(address(pluginA), address(pluginB));\n\n // run the upgrade\n vm.prank(ionicAdmin.owner());\n ionicAdmin.autoUpgradePool(comptroller);\n\n address pluginImplAfter = address(cToken.plugin());\n address implAfter = cToken.implementation();\n\n assertEq(pluginImplBefore, address(pluginA), \"the old impl should be the A plugin\");\n assertEq(pluginImplAfter, address(pluginB), \"the new impl should be the B plugin\");\n assertEq(implBefore, address(cErc20PluginDelegate), \"the old impl should be the plugin delegate\");\n assertEq(implAfter, address(cErc20PluginRewardsDelegate), \"the new impl should be the plugin rewards delegate\");\n }\n\n function testInflateExchangeRate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n // mint just 2 wei\n underlyingToken.approve(address(cToken), 1e36);\n cToken.mint(2);\n assertEq(cToken.totalSupply(), 10);\n assertEq(underlyingToken.balanceOf(address(cToken)), 2, \"!total supply 2\");\n\n uint256 exchRateBefore = cToken.exchangeRateCurrent();\n emit log_named_uint(\"exch rate\", exchRateBefore);\n assertEq(exchRateBefore, 2e17, \"!default exch rate\");\n\n // donate\n underlyingToken.transfer(address(cToken), 1e36);\n\n uint256 exchRateAfter = cToken.exchangeRateCurrent();\n emit log_named_uint(\"exch rate after\", exchRateAfter);\n assertGt(exchRateAfter, 1e30, \"!inflated exch rate\");\n\n // the market should own 1e36 + 2 underlying assets\n assertEq(underlyingToken.balanceOf(address(cToken)), 1e36 + 2, \"!total underlying\");\n\n // 50% + 1\n uint256 errCode = cToken.redeemUnderlying(0.5e36 + 2);\n assertEq(errCode, 0, \"!redeem underlying\");\n\n assertEq(cToken.totalSupply(), 0, \"!should have redeemed all ctokens for 50% + 1 of the underlying\");\n }\n\n function testSupplyCapInflatedExchangeRate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n // mint 1e18\n underlyingToken.approve(address(cToken), 1e18);\n cToken.mint(1e18);\n assertEq(cToken.totalSupply(), 5 * 1e18, \"!total supply 5\");\n assertEq(underlyingToken.balanceOf(address(cToken)), 1e18, \"!market underlying balance 1\");\n\n (, , uint256 liqBefore, uint256 sfBefore) = comptroller.getAccountLiquidity(address(this));\n\n uint256[] memory caps = new uint256[](1);\n caps[0] = 25e18;\n ICErc20[] memory marketArray = new ICErc20[](1);\n marketArray[0] = cToken;\n vm.prank(comptroller.admin());\n comptroller._setMarketSupplyCaps(marketArray, caps);\n\n // donate 100e18\n underlyingToken.transfer(address(cToken), 100e18);\n assertEq(underlyingToken.balanceOf(address(cToken)), 101e18, \"!market balance 101\");\n assertEq(cToken.balanceOfUnderlying(address(this)), 101e18, \"!user balance 101\");\n\n (, , uint256 liqAfter, uint256 sfAfter) = comptroller.getAccountLiquidity(address(this));\n emit log_named_uint(\"liqBefore\", liqBefore);\n emit log_named_uint(\"liqAfter\", liqAfter);\n\n assertEq(liqAfter / liqBefore, 25, \"liquidity should increase only 25x\");\n }\n}\n" + }, + "contracts/test/DevTesting.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport \"./config/BaseTest.t.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\nimport { RedstoneAdapterPriceOracle } from \"../oracles/default/RedstoneAdapterPriceOracle.sol\";\nimport { RedstoneAdapterPriceOracleWrsETH } from \"../oracles/default/RedstoneAdapterPriceOracleWrsETH.sol\";\nimport { RedstoneAdapterPriceOracleWeETH } from \"../oracles/default/RedstoneAdapterPriceOracleWeETH.sol\";\nimport { MasterPriceOracle, BasePriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { LeveredPositionsLens } from \"../ionic/levered/LeveredPositionsLens.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { ILeveredPositionFactory } from \"../ionic/levered/ILeveredPositionFactory.sol\";\nimport { LeveredPositionFactoryFirstExtension } from \"../ionic/levered/LeveredPositionFactoryFirstExtension.sol\";\nimport { LeveredPositionFactorySecondExtension } from \"../ionic/levered/LeveredPositionFactorySecondExtension.sol\";\nimport { LeveredPositionFactory } from \"../ionic/levered/LeveredPositionFactory.sol\";\nimport { LeveredPositionStorage } from \"../ionic/levered/LeveredPositionStorage.sol\";\nimport { LeveredPosition } from \"../ionic/levered/LeveredPosition.sol\";\nimport { IonicFlywheelLensRouter, IonicComptroller, ICErc20, ERC20, IPriceOracle_IFLR } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AlgebraSwapLiquidator } from \"../liquidators/AlgebraSwapLiquidator.sol\";\nimport { AerodromeV2Liquidator } from \"../liquidators/AerodromeV2Liquidator.sol\";\nimport { AerodromeCLLiquidator } from \"../liquidators/AerodromeCLLiquidator.sol\";\nimport { CurveSwapLiquidator } from \"../liquidators/CurveSwapLiquidator.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\nimport { VelodromeV2Liquidator } from \"../liquidators/VelodromeV2Liquidator.sol\";\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport \"forge-std/console.sol\";\n\nstruct HealthFactorVars {\n uint256 usdcSupplied;\n uint256 wethSupplied;\n uint256 ezEthSuppled;\n uint256 stoneSupplied;\n uint256 wbtcSupplied;\n uint256 weEthSupplied;\n uint256 merlinBTCSupplied;\n uint256 usdcBorrowed;\n uint256 wethBorrowed;\n uint256 ezEthBorrowed;\n uint256 stoneBorrowed;\n uint256 wbtcBorrowed;\n uint256 weEthBorrowed;\n uint256 merlinBTCBorrowed;\n ICErc20 testCToken;\n address testUnderlying;\n uint256 amountBorrow;\n}\n\ncontract DevTesting is BaseTest {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLensSecondary lens2 = PoolLensSecondary(0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154);\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n LeveredPositionsLens levPosLens;\n\n address deployer = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address multisig = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2;\n\n ICErc20 wethMarket;\n ICErc20 usdcMarket;\n ICErc20 usdtMarket;\n ICErc20 wbtcMarket;\n ICErc20 ezEthMarket;\n ICErc20 stoneMarket;\n ICErc20 weEthMarket;\n ICErc20 merlinBTCMarket;\n\n // mode mainnet assets\n address WETH = 0x4200000000000000000000000000000000000006;\n address USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address USDT = 0xf0F161fDA2712DB8b566946122a5af183995e2eD;\n address WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF;\n address UNI = 0x3e7eF8f50246f725885102E8238CBba33F276747;\n address SNX = 0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3;\n address LINK = 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb;\n address DAI = 0xE7798f023fC62146e8Aa1b36Da45fb70855a77Ea;\n address BAL = 0xD08a2917653d4E460893203471f0000826fb4034;\n address AAVE = 0x7c6b91D9Be155A6Db01f749217d76fF02A7227F2;\n address weETH = 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A;\n address merlinBTC = 0x59889b7021243dB5B1e065385F918316cD90D46c;\n IERC20Upgradeable wsuperOETH = IERC20Upgradeable(0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6);\n IERC20Upgradeable superOETH = IERC20Upgradeable(0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == MODE_MAINNET) {\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdcMarket = ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n wbtcMarket = ICErc20(0xd70254C3baD29504789714A7c69d60Ec1127375C);\n ezEthMarket = ICErc20(0x59e710215d45F584f44c0FEe83DA6d43D762D857);\n stoneMarket = ICErc20(0x959FA710CCBb22c7Ce1e59Da82A247e686629310);\n weEthMarket = ICErc20(0xA0D844742B4abbbc43d8931a6Edb00C56325aA18);\n merlinBTCMarket = ICErc20(0x19F245782b1258cf3e11Eda25784A378cC18c108);\n ICErc20[] memory markets = pool.getAllMarkets();\n wethMarket = markets[0];\n usdcMarket = markets[1];\n } else {}\n levPosLens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function testModePoolBorrowers() public debuggingOnly fork(MODE_MAINNET) {\n emit log_named_array(\"borrowers\", pool.getAllBorrowers());\n }\n\n function testModeLiquidationShortfall() public debuggingOnly fork(MODE_MAINNET) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(\n 0xa75F9C8246f7269279bE4c969e7Bc6Eb619cC204\n );\n\n emit log_named_uint(\"err\", err);\n emit log_named_uint(\"collateralValue\", collateralValue);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n }\n\n function testModeHealthFactor() public debuggingOnly fork(MODE_MAINNET) {\n address rahul = 0x5A9e792143bf2708b4765C144451dCa54f559a19;\n\n uint256 wethSupplied = wethMarket.balanceOfUnderlying(rahul);\n uint256 usdcSupplied = usdcMarket.balanceOfUnderlying(rahul);\n uint256 usdtSupplied = usdtMarket.balanceOfUnderlying(rahul);\n uint256 wbtcSupplied = wbtcMarket.balanceOfUnderlying(rahul);\n // emit log_named_uint(\"wethSupplied\", wethSupplied);\n emit log_named_uint(\"usdcSupplied\", usdcSupplied);\n emit log_named_uint(\"usdtSupplied\", usdtSupplied);\n emit log_named_uint(\"wbtcSupplied\", wbtcSupplied);\n emit log_named_uint(\"value of wethSupplied\", wethSupplied * pool.oracle().getUnderlyingPrice(wethMarket));\n emit log_named_uint(\"value of usdcSupplied\", usdcSupplied * pool.oracle().getUnderlyingPrice(usdcMarket));\n emit log_named_uint(\"value of usdtSupplied\", usdtSupplied * pool.oracle().getUnderlyingPrice(usdtMarket));\n emit log_named_uint(\"value of wbtcSupplied\", wbtcSupplied * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n PoolLens newImpl = new PoolLens();\n // TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(lens)));\n // vm.prank(dpa.owner());\n // proxy.upgradeTo(address(newImpl));\n\n uint256 hf = newImpl.getHealthFactor(rahul, pool);\n\n emit log_named_uint(\"hf\", hf);\n }\n\n function testQuickHF() public debuggingOnly forkAtBlock(MODE_MAINNET, 11831371) {\n address rahul = 0xf1bAeb439b8eF5043E069af0C8C8145963ebc3f8;\n\n uint256 hf = lens.getHealthFactor(rahul, pool);\n uint256 hf2 = lens.getHealthFactor(rahul, IonicComptroller(0x8Fb3D4a94D0aA5D6EDaAC3Ed82B59a27f56d923a));\n\n emit log_named_uint(\"hf\", hf);\n emit log_named_uint(\"hf2\", hf2);\n }\n\n function testQuickLiquidation() public debuggingOnly forkAtBlock(MODE_MAINNET, 12018198) {\n address user = 0xf1bAeb439b8eF5043E069af0C8C8145963ebc3f8;\n address whale = 0xaaEd68a3875F6BDbD44f70418dd16082870De8A0;\n address borrowedAsset = 0x80137510979822322193FC997d400D5A6C747bf7;\n uint256 repayAmount = 1968810267461862;\n address collateralToSeizeCToken = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address borrowedAssetCToken = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310;\n\n IonicUniV3Liquidator uniV3liquidator = IonicUniV3Liquidator(payable(0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A));\n\n emit log_named_address(\"univ3liq\", address(uniV3liquidator));\n emit log_named_address(\"express relay\", address(uniV3liquidator.expressRelay()));\n\n vm.mockCall(\n address(uniV3liquidator.expressRelay()),\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(uniV3liquidator),\n abi.encode(user)\n ),\n abi.encode(true)\n );\n\n vm.startPrank(whale);\n ERC20(borrowedAsset).approve(address(uniV3liquidator), type(uint256).max);\n uniV3liquidator.safeLiquidate(user, repayAmount, ICErc20(borrowedAssetCToken), ICErc20(collateralToSeizeCToken), 0);\n vm.stopPrank();\n }\n\n function testQuickAssets() public debuggingOnly forkAtBlock(MODE_MAINNET, 12314870) {\n address user = 0x5BDB1Fb5d0F841f4eb88D537bED0DD674fA88D7c;\n IonicComptroller comptroller = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n IonicComptroller comptroller2 = IonicComptroller(0x8Fb3D4a94D0aA5D6EDaAC3Ed82B59a27f56d923a);\n\n uint256 hf = lens.getHealthFactor(user, comptroller);\n uint256 hf2 = lens.getHealthFactor(user, comptroller2);\n\n PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser(comptroller, user);\n PoolLens.PoolAsset[] memory assets2 = lens.getPoolAssetsByUser(comptroller2, user);\n\n emit log(\"<---------------------------------MAIN MARKETS--------------------------------->\");\n emit log_named_uint(\"hf\", hf);\n for (uint i; i < assets.length; i++) {\n emit log(\"====================================================\");\n emit log_named_string(\"name\", assets[i].underlyingName);\n emit log_named_address(\"ctoken\", assets[i].cToken);\n emit log_named_address(\"underlying\", assets[i].underlyingToken);\n emit log_named_uint(\"supplyBalance\", assets[i].supplyBalance);\n emit log_named_uint(\"borrowBalance\", assets[i].borrowBalance);\n emit log_named_uint(\"underlyingPrice\", assets[i].underlyingPrice);\n emit log_named_uint(\"exchange rate\", assets[i].exchangeRate);\n }\n\n emit log(\"<---------------------------------NATIVE MARKETS--------------------------------->\");\n emit log_named_uint(\"hf\", hf2);\n for (uint i; i < assets2.length; i++) {\n emit log(\"====================================================\");\n emit log_named_string(\"name\", assets2[i].underlyingName);\n emit log_named_address(\"ctoken\", assets2[i].cToken);\n emit log_named_address(\"underlying\", assets2[i].underlyingToken);\n emit log_named_uint(\"supplyBalance\", assets2[i].supplyBalance);\n emit log_named_uint(\"borrowBalance\", assets2[i].borrowBalance);\n emit log_named_uint(\"underlyingPrice\", assets2[i].underlyingPrice);\n }\n }\n\n function testNetAprMode() public debuggingOnly forkAtBlock(MODE_MAINNET, 8479829) {\n address user = 0x30D5047e839f079bDE1Ab16b34668f57391DacB3;\n int256 blocks = 30 * 24 * 365 * 60;\n IonicFlywheelLensRouter lensRouter = new IonicFlywheelLensRouter(\n PoolDirectory(0x39C353Cf9041CcF467A04d0e78B63d961E81458a)\n );\n int256 apr = lensRouter.getUserNetApr(user, blocks);\n\n emit log_named_int(\"apr\", apr);\n }\n\n function testModeUsdcBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(usdcMarket);\n }\n\n function testHypotheticalPosition() public debuggingOnly forkAtBlock(MODE_MAINNET, 8028296) {\n HealthFactorVars memory vars;\n\n address wolfy = 0x7d922bf0975424b3371074f54cC784AF738Dac0D;\n address usdcWhale = 0x70FF197c32E922700d3ff2483D250c645979855d;\n address wbtcWhale = 0xBD8CCf3ebE4CC2D57962cdC2756B143ce0135a6B;\n address wethWhale = 0xD746A2a6048C5D3AFF5766a8c4A0C8cFD2311745;\n\n address whale = wbtcWhale;\n vars.testCToken = wethMarket;\n vars.testUnderlying = WETH;\n vars.amountBorrow = 1e18 / 2;\n\n address[] memory cTokens = new address[](1);\n\n vm.startPrank(usdcWhale);\n ERC20(USDC).transfer(wolfy, ERC20(USDC).balanceOf(usdcWhale));\n vm.stopPrank();\n\n vm.startPrank(wbtcWhale);\n ERC20(WBTC).transfer(wolfy, ERC20(WBTC).balanceOf(wbtcWhale));\n vm.stopPrank();\n\n vm.startPrank(wethWhale);\n ERC20(WETH).transfer(wolfy, ERC20(WETH).balanceOf(wethWhale));\n vm.stopPrank();\n\n // emit log_named_uint(\"USDC balance\", ERC20(USDC).balanceOf(wolfy));\n // emit log_named_uint(\"WBTC balance\", ERC20(WBTC).balanceOf(wolfy));\n // emit log_named_uint(\"WETH balance\", ERC20(WETH).balanceOf(wolfy));\n\n vm.startPrank(wolfy);\n\n ERC20(USDC).approve(address(usdcMarket), ERC20(USDC).balanceOf(wolfy));\n usdcMarket.mint(ERC20(USDC).balanceOf(wolfy));\n cTokens[0] = address(usdcMarket);\n pool.enterMarkets(cTokens);\n\n ERC20(WBTC).approve(address(wbtcMarket), ERC20(WBTC).balanceOf(wolfy));\n wbtcMarket.mint(ERC20(WBTC).balanceOf(wolfy));\n cTokens[0] = address(wbtcMarket);\n pool.enterMarkets(cTokens);\n\n ERC20(WETH).approve(address(wethMarket), ERC20(WETH).balanceOf(wolfy));\n wethMarket.mint(ERC20(WETH).balanceOf(wolfy));\n cTokens[0] = address(wethMarket);\n pool.enterMarkets(cTokens);\n\n wethMarket.borrow(1e18);\n\n vm.stopPrank();\n\n vars.usdcSupplied = usdcMarket.balanceOfUnderlying(wolfy);\n vars.wethSupplied = wethMarket.balanceOfUnderlying(wolfy);\n vars.ezEthSuppled = ezEthMarket.balanceOfUnderlying(wolfy);\n vars.stoneSupplied = stoneMarket.balanceOfUnderlying(wolfy);\n vars.wbtcSupplied = wbtcMarket.balanceOfUnderlying(wolfy);\n vars.weEthSupplied = weEthMarket.balanceOfUnderlying(wolfy);\n vars.merlinBTCSupplied = merlinBTCMarket.balanceOfUnderlying(wolfy);\n\n vars.usdcBorrowed = usdcMarket.borrowBalanceCurrent(wolfy);\n vars.wethBorrowed = wethMarket.borrowBalanceCurrent(wolfy);\n vars.ezEthBorrowed = ezEthMarket.borrowBalanceCurrent(wolfy);\n vars.stoneBorrowed = stoneMarket.borrowBalanceCurrent(wolfy);\n vars.wbtcBorrowed = wbtcMarket.borrowBalanceCurrent(wolfy);\n vars.weEthBorrowed = weEthMarket.borrowBalanceCurrent(wolfy);\n vars.merlinBTCBorrowed = merlinBTCMarket.borrowBalanceCurrent(wolfy);\n\n emit log_named_uint(\"usdcSupplied\", vars.usdcSupplied);\n emit log_named_uint(\"wethSupplied\", vars.wethSupplied);\n emit log_named_uint(\"ezEthSupplied\", vars.ezEthSuppled);\n emit log_named_uint(\"stoneSupplied\", vars.stoneSupplied);\n emit log_named_uint(\"wbtcSupplied\", vars.wbtcSupplied);\n emit log_named_uint(\"weEthSupplied\", vars.weEthSupplied);\n emit log_named_uint(\"merlinBTCSupplied\", vars.merlinBTCSupplied);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"usdcBorrowed\", vars.usdcBorrowed);\n emit log_named_uint(\"wethBorrowed\", vars.wethBorrowed);\n emit log_named_uint(\"ezEthBorrowed\", vars.ezEthBorrowed);\n emit log_named_uint(\"stoneBorrowed\", vars.stoneBorrowed);\n emit log_named_uint(\"wbtcBorrowed\", vars.wbtcBorrowed);\n emit log_named_uint(\"weEthBorrowed\", vars.weEthBorrowed);\n emit log_named_uint(\"merlinBTCBorrowed\", vars.merlinBTCBorrowed);\n\n // emit log_named_uint(\"value of usdcSupplied\", vars.usdcSupplied * pool.oracle().getUnderlyingPrice(usdcMarket));\n // emit log_named_uint(\"value of wethSupplied\", vars.wethSupplied * pool.oracle().getUnderlyingPrice(wethMarket));\n // emit log_named_uint(\"value of ezEthSupplied\", vars.ezEthSuppled * pool.oracle().getUnderlyingPrice(ezEthMarket));\n // emit log_named_uint(\"value of stoneSupplied\", vars.stoneSupplied * pool.oracle().getUnderlyingPrice(stoneMarket));\n // emit log_named_uint(\"value of wbtcSupplied\", vars.wbtcSupplied * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n // emit log_named_uint(\"value of usdcBorrowed\", vars.usdcBorrowed * pool.oracle().getUnderlyingPrice(usdcMarket));\n // emit log_named_uint(\"value of wethBorrowed\", vars.wethBorrowed * pool.oracle().getUnderlyingPrice(wethMarket));\n // emit log_named_uint(\"value of ezEthBorrowed\", vars.ezEthBorrowed * pool.oracle().getUnderlyingPrice(ezEthMarket));\n // emit log_named_uint(\"value of stoneBorrowed\", vars.stoneBorrowed * pool.oracle().getUnderlyingPrice(stoneMarket));\n // emit log_named_uint(\"value of wbtcBorrowed\", vars.wbtcBorrowed * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n vm.startPrank(whale);\n ERC20(vars.testUnderlying).transfer(wolfy, ERC20(vars.testUnderlying).balanceOf(whale));\n vm.stopPrank();\n\n uint256 hf = lens.getHealthFactor(wolfy, pool);\n uint256 hypothetical = lens.getHealthFactorHypothetical(\n pool,\n wolfy,\n address(vars.testCToken),\n 0,\n 0,\n vars.amountBorrow\n );\n\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(wolfy);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"Collateral Value Before\", collateralValue);\n emit log_named_uint(\"Liquidity Before\", liquidity);\n emit log_named_uint(\"hf before\", hf);\n emit log_named_uint(\"hypothetical hf\", hypothetical);\n\n vm.startPrank(wolfy);\n ERC20(vars.testUnderlying).approve(address(vars.testCToken), vars.amountBorrow);\n vars.testCToken.repayBorrow(vars.amountBorrow);\n vm.stopPrank();\n\n uint256 hfAfter = lens.getHealthFactor(wolfy, pool);\n (err, collateralValue, liquidity, shortfall) = pool.getAccountLiquidity(wolfy);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"Collateral Value After\", collateralValue);\n emit log_named_uint(\"Liquidity After\", liquidity);\n emit log_named_uint(\"hf after\", hfAfter);\n emit log_named_uint(\"user balance after\", ERC20(vars.testUnderlying).balanceOf(wolfy));\n emit log_named_uint(\"new borrow balance after repay\", vars.testCToken.borrowBalanceCurrent(wolfy));\n }\n\n function testModeUsdtBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(usdtMarket);\n }\n\n function testModeWethBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(wethMarket);\n wethMarket.accrueInterest();\n _testModeBorrowCaps(wethMarket);\n }\n\n function _testModeBorrowCaps(ICErc20 market) internal {\n uint256 borrowCapUsdc = pool.borrowCaps(address(market));\n uint256 totalBorrowsCurrent = market.totalBorrowsCurrent();\n\n uint256 wethBorrowAmount = 154753148031252;\n console.log(\"borrowCapUsdc %e\", borrowCapUsdc);\n console.log(\"totalBorrowsCurrent %e\", totalBorrowsCurrent);\n console.log(\"new totalBorrowsCurrent %e\", totalBorrowsCurrent + wethBorrowAmount);\n }\n\n function testMarketMember() public debuggingOnly fork(MODE_MAINNET) {\n address rahul = 0x5A9e792143bf2708b4765C144451dCa54f559a19;\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint256 i = 0; i < markets.length; i++) {\n if (pool.checkMembership(rahul, markets[i])) {\n emit log(\"is a member\");\n } else {\n emit log(\"NOT a member\");\n }\n }\n }\n\n function testGetCashError() public debuggingOnly fork(MODE_MAINNET) {\n ICErc20 market = ICErc20(0x49950319aBE7CE5c3A6C90698381b45989C99b46);\n market.getCash();\n }\n\n function testWrsEthBalanceOfError() public debuggingOnly fork(MODE_MAINNET) {\n address wrsEthMarketAddress = 0x49950319aBE7CE5c3A6C90698381b45989C99b46;\n ERC20 wrsEth = ERC20(0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd);\n wrsEth.balanceOf(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n }\n\n function testModeRepay() public debuggingOnly fork(MODE_MAINNET) {\n address user = 0x1A3C4E9B49e4fc595fB7e5f723159bA73a9426e7;\n ICErc20 market = usdcMarket;\n ERC20 asset = ERC20(market.underlying());\n\n uint256 borrowBalance = market.borrowBalanceCurrent(user);\n emit log_named_uint(\"borrowBalance\", borrowBalance);\n\n vm.startPrank(user);\n asset.approve(address(market), borrowBalance);\n uint256 err = market.repayBorrow(borrowBalance / 2);\n\n emit log_named_uint(\"error\", err);\n }\n\n function testAssetsPrices() public debuggingOnly fork(MODE_MAINNET) {\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n emit log_named_uint(\"WETH price\", mpo.price(WETH));\n emit log_named_uint(\"USDC price\", mpo.price(USDC));\n emit log_named_uint(\"USDT price\", mpo.price(USDT));\n emit log_named_uint(\"UNI price\", mpo.price(UNI));\n emit log_named_uint(\"SNX price\", mpo.price(SNX));\n emit log_named_uint(\"LINK price\", mpo.price(LINK));\n emit log_named_uint(\"DAI price\", mpo.price(DAI));\n emit log_named_uint(\"BAL price\", mpo.price(BAL));\n emit log_named_uint(\"AAVE price\", mpo.price(AAVE));\n emit log_named_uint(\"WBTC price\", mpo.price(WBTC));\n }\n\n function testDeployedMarkets() public debuggingOnly fork(MODE_MAINNET) {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint8 i = 0; i < markets.length; i++) {\n emit log_named_address(\"market\", address(markets[i]));\n emit log(markets[i].symbol());\n emit log(markets[i].name());\n }\n }\n\n function testDisableCollateralUsdc() public debuggingOnly fork(MODE_MAINNET) {\n address user = 0xF70CBE91fB1b1AfdeB3C45Fb8CDD2E1249b5b75E;\n address usdcMarketAddr = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n\n vm.startPrank(user);\n\n uint256 borrowed = ICErc20(usdcMarketAddr).borrowBalanceCurrent(user);\n\n emit log_named_uint(\"borrowed\", borrowed);\n\n pool.exitMarket(usdcMarketAddr);\n }\n\n function testBorrowRateAtRatio() public debuggingOnly fork(MODE_MAINNET) {\n uint256 rate = levPosLens.getBorrowRateAtRatio(wethMarket, ezEthMarket, 9988992945501686, 2e18);\n emit log_named_uint(\"borrow rate at ratio\", rate);\n }\n\n function testAssetAsCollateralCap() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ezEthWhale = 0x2344F131B07E6AFd943b0901C55898573F0d1561;\n\n vm.startPrank(multisig);\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_EZETH,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic Renzo Restaked ETH\",\n \"ionezETH\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 ezEthMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(ezEthMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(ezEthMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(ezEthWhale);\n ERC20(MODE_EZETH).approve(address(ezEthMarket), 1e36);\n errCode = ezEthMarket.mint(1e18);\n require(errCode == 0, \"should be unable to supply\");\n }\n\n function testNewStoneMarketCapped() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_STONE = 0x80137510979822322193FC997d400D5A6C747bf7;\n address stoneWhale = 0x76486cbED5216C82d26Ee60113E48E06C189541A;\n\n address redstoneOracleAddress = 0x63A1531a06F0Ac597a0DfA5A516a37073c3E1e0a;\n RedstoneAdapterPriceOracle oracle = RedstoneAdapterPriceOracle(redstoneOracleAddress);\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(mpo.admin());\n mpo.add(asArray(MODE_STONE), oracles);\n\n vm.startPrank(multisig);\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_STONE,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic StakeStone Ether\",\n \"ionSTONE\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 stoneMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(stoneMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(stoneMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(stoneWhale);\n ERC20(MODE_STONE).approve(address(stoneMarket), 1e36);\n vm.expectRevert(\"not authorized\");\n errCode = stoneMarket.mint(1e18);\n //require(errCode != 0, \"should be unable to supply\");\n }\n\n function testRegisterSFS() public debuggingOnly fork(MODE_MAINNET) {\n emit log_named_address(\"pool admin\", pool.admin());\n\n vm.startPrank(multisig);\n pool.registerInSFS();\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint8 i = 0; i < markets.length; i++) {\n markets[i].registerInSFS();\n }\n }\n\n function upgradePool() internal {\n ComptrollerFirstExtension newComptrollerExtension = new ComptrollerFirstExtension();\n\n Unitroller asUnitroller = Unitroller(payable(address(pool)));\n\n // upgrade to the new comptroller extension\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(newComptrollerExtension, DiamondExtension(asUnitroller._listExtensions()[1]));\n\n //asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function testModeBorrowRate() public fork(MODE_MAINNET) {\n //ICErc20[] memory markets = pool.getAllMarkets();\n\n IonicComptroller pool = ezEthMarket.comptroller();\n vm.prank(pool.admin());\n ezEthMarket._setInterestRateModel(JumpRateModel(0x413aD59b80b1632988d478115a466bdF9B26743a));\n\n JumpRateModel discRateModel = JumpRateModel(ezEthMarket.interestRateModel());\n\n uint256 borrows = 200e18;\n uint256 cash = 5000e18 - borrows;\n uint256 reserves = 1e18;\n uint256 rate = discRateModel.getBorrowRate(cash, borrows, reserves);\n\n emit log_named_uint(\"rate per year %e\", rate * discRateModel.blocksPerYear());\n }\n\n function testModeFetchBorrowers() public fork(MODE_MAINNET) {\n // address[] memory borrowers = pool.getAllBorrowers();\n // emit log_named_uint(\"borrowers.len\", borrowers.length);\n\n //upgradePool();\n\n (uint256 totalPages, address[] memory borrowersPage) = pool.getPaginatedBorrowers(1, 0);\n\n emit log_named_uint(\"total pages with 300 size (default)\", totalPages);\n\n (totalPages, borrowersPage) = pool.getPaginatedBorrowers(totalPages - 1, 50);\n emit log_named_array(\"last page of 300 borrowers\", borrowersPage);\n\n (totalPages, borrowersPage) = pool.getPaginatedBorrowers(1, 50);\n emit log_named_uint(\"total pages with 50 size\", totalPages);\n emit log_named_array(\"page of 50 borrowers\", borrowersPage);\n\n // for (uint256 i = 0; i < borrowers.length; i++) {\n // (\n // uint256 error,\n // uint256 collateralValue,\n // uint256 liquidity,\n // uint256 shortfall\n // ) = pool.getAccountLiquidity(borrowers[i]);\n //\n // emit log(\"\");\n // emit log_named_address(\"user\", borrowers[i]);\n // emit log_named_uint(\"collateralValue\", collateralValue);\n // if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n // if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n // }\n }\n\n function testModeAccountLiquidity() public debuggingOnly fork(MODE_MAINNET) {\n _testAccountLiquidity(0x0C387030a5D3AcDcde1A8DDaF26df31BbC1CE763);\n }\n\n function _testAccountLiquidity(address borrower) internal {\n (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(borrower);\n\n emit log(\"\");\n emit log_named_address(\"user\", borrower);\n emit log_named_uint(\"collateralValue\", collateralValue);\n if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n }\n\n function testModeDeployMarket() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_WEETH = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n address weEthWhale = 0x6e55a90772B92f17f87Be04F9562f3faafd0cc38;\n\n vm.startPrank(pool.admin());\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_WEETH,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic Wrapped eETH\",\n \"ionweETH\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 weEthMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(weEthMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(weEthMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(weEthWhale);\n ERC20(MODE_WEETH).approve(address(weEthMarket), 1e36);\n errCode = weEthMarket.mint(0.01e18);\n require(errCode == 0, \"should be unable to supply\");\n }\n\n function testModeWrsETH() public debuggingOnly forkAtBlock(MODE_MAINNET, 6635923) {\n address wrsEth = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\n RedstoneAdapterPriceOracleWrsETH oracle = new RedstoneAdapterPriceOracleWrsETH(\n 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256\n );\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(multisig);\n mpo.add(asArray(wrsEth), oracles);\n\n uint256 price = mpo.price(wrsEth);\n emit log_named_uint(\"price of wrsEth\", price);\n }\n\n function testModeWeETH() public debuggingOnly forkAtBlock(MODE_MAINNET, 6861468) {\n address weEth = 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A;\n RedstoneAdapterPriceOracleWeETH oracle = new RedstoneAdapterPriceOracleWeETH(\n 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256\n );\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(multisig);\n mpo.add(asArray(weEth), oracles);\n\n uint256 price = mpo.price(weEth);\n emit log_named_uint(\"price of weEth\", price);\n assertEq(price, 1036212437077011599);\n }\n\n function testPERLiquidation() public debuggingOnly forkAtBlock(MODE_MAINNET, 10255413) {\n vm.prank(0x5Cc070844E98F4ceC5f2fBE1592fB1ed73aB7b48);\n _functionCall(\n 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A,\n hex\"20b72325000000000000000000000000f28570694a6c9cd0494955966ae75af61abf5a0700000000000000000000000000000000000000000000000001bc1214ed792fbb0000000000000000000000004341620757bee7eb4553912fafc963e59c949147000000000000000000000000c53edeafb6d502daec5a7015d67936cea0cd0f520000000000000000000000000000000000000000000000000000000000000000\",\n \"error in call\"\n );\n }\n\n function testCtokenUpgrade() public debuggingOnly forkAtBlock(MODE_MAINNET, 10255413) {\n CErc20PluginRewardsDelegate newImpl = new CErc20PluginRewardsDelegate();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(wethMarket)));\n\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = PoolDirectory(\n 0x39C353Cf9041CcF467A04d0e78B63d961E81458a\n ).getActivePools();\n\n emit log_named_uint(\"First Pool ID\", poolIds[0]);\n emit log_named_uint(\"First Pool ID\", poolIds[1]);\n emit log_named_string(\"First Pool Address\", pools[0].name);\n emit log_named_string(\"First Pool Address\", pools[0].name);\n emit log_named_address(\"First Pool Address\", pools[0].creator);\n emit log_named_address(\"First Pool Address\", pools[1].creator);\n emit log_named_address(\"First Pool Address\", pools[0].comptroller);\n emit log_named_address(\"First Pool Address\", pools[1].comptroller);\n //bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\n //address admin = address(uint160(uint256(bytesAtSlot)));\n //vm.prank(admin);\n //proxy.upgradeTo(address(newImpl));\n\n //vm.prank(dpa.owner());\n //proxy.upgradeTo(address(newImpl));\n }\n\n function testAerodromeV2Liquidator() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n AerodromeV2Liquidator liquidator = new AerodromeV2Liquidator();\n IERC20Upgradeable hyUSD = IERC20Upgradeable(0xCc7FF230365bD730eE4B352cC2492CEdAC49383e);\n IERC20Upgradeable eUSD = IERC20Upgradeable(0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4);\n IERC20Upgradeable usdc = IERC20Upgradeable(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);\n address hyusdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address usdcWhale = 0xaac391f166f33CdaEfaa4AfA6616A3BEA66B694d;\n address eusdWhale = 0xEE8Bd6594E046d72D592ac0e278E3CA179b8f189;\n address aerodromeV2Router = 0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43;\n\n vm.startPrank(eusdWhale);\n eUSD.transfer(address(liquidator), 1000 ether);\n IRouter_Aerodrome.Route[] memory path = new IRouter_Aerodrome.Route[](1);\n path[0] = IRouter_Aerodrome.Route({\n from: address(eUSD),\n to: address(usdc),\n stable: true,\n factory: 0x420DD381b31aEf6683db6B902084cB0FFECe40Da\n });\n liquidator.redeem(eUSD, 1000 ether, abi.encode(aerodromeV2Router, path));\n emit log_named_uint(\"usdc received\", usdc.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidator() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n AerodromeCLLiquidator liquidator = new AerodromeCLLiquidator();\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address superOETHWhale = 0xF1010eE787Ee588766b441d7cC397b40DdFB17a3;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n vm.startPrank(superOETHWhale);\n superOETH.transfer(address(liquidator), 1 ether);\n liquidator.redeem(superOETH, 1 ether, abi.encode(address(superOETH), address(weth), int24(1), aerodromeCLRouter));\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidatorWrap() public debuggingOnly forkAtBlock(BASE_MAINNET, 20203998) {\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address wethWhale = 0x751b77C43643a63362Ab024d466fcC1d75354295;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n AerodromeCLLiquidator liquidator = AerodromeCLLiquidator(0xb50De36105F6053006306553AB54e77224818B9B);\n\n vm.startPrank(wethWhale);\n weth.transfer(address(liquidator), 1 ether);\n liquidator.redeem(\n weth,\n 1 ether,\n abi.encode(address(weth), address(wsuperOETH), aerodromeCLRouter, address(0), address(superOETH), 1)\n );\n emit log_named_uint(\"wsuperOETH received\", wsuperOETH.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidatorUnwrap() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address wsuperOethWhale = 0x0EEaCD4c475040463389d15EAd034d1291b008b1;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n AerodromeCLLiquidator liquidator = new AerodromeCLLiquidator();\n\n vm.startPrank(wsuperOethWhale);\n wsuperOETH.transfer(address(liquidator), 1 ether);\n liquidator.redeem(\n wsuperOETH,\n 1 ether,\n abi.encode(address(wsuperOETH), address(weth), aerodromeCLRouter, address(superOETH), address(0), 1)\n );\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testCurveSwapLiquidatorUSDCtowUSDM() public debuggingOnly forkAtBlock(BASE_MAINNET, 20237792) {\n address _pool = 0x63Eb7846642630456707C3efBb50A03c79B89D81;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address usdm = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\n address wUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812;\n address usdcWhale = 0x134575ff75F9882ca905EE1D78C9340C091d6056;\n CurveV2LpTokenPriceOracleNoRegistry oracle = new CurveV2LpTokenPriceOracleNoRegistry();\n CurveSwapLiquidator liquidator = new CurveSwapLiquidator();\n vm.prank(oracle.owner());\n oracle.registerPool(_pool, _pool);\n vm.prank(usdcWhale);\n IERC20Upgradeable(usdc).transfer(address(liquidator), 100e6);\n liquidator.redeem(IERC20Upgradeable(usdc), 100e6, abi.encode(oracle, wUSDM, address(0), usdm));\n emit log_named_uint(\"wUSDM received\", IERC20Upgradeable(wUSDM).balanceOf(address(liquidator)));\n }\n\n function testCurveSwapLiquidatorwUSDMtoUSDC() public debuggingOnly forkAtBlock(BASE_MAINNET, 20237792) {\n address _pool = 0x63Eb7846642630456707C3efBb50A03c79B89D81;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address usdm = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\n address wUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812;\n address wusdmWhale = 0x9b8b04B6f82cD5e1dae58cA3614d445F93DeFc5c;\n CurveV2LpTokenPriceOracleNoRegistry oracle = new CurveV2LpTokenPriceOracleNoRegistry();\n CurveSwapLiquidator liquidator = new CurveSwapLiquidator();\n vm.prank(oracle.owner());\n oracle.registerPool(_pool, _pool);\n\n vm.startPrank(wusdmWhale);\n IERC20Upgradeable(wUSDM).transfer(address(liquidator), 30 ether);\n liquidator.redeem(IERC20Upgradeable(wUSDM), 30 ether, abi.encode(oracle, usdc, usdm, address(0)));\n emit log_named_uint(\"usdc received\", IERC20Upgradeable(usdc).balanceOf(address(liquidator)));\n }\n\n function testKimLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 13579406) {\n address weth = 0x4200000000000000000000000000000000000006;\n address usdc = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address kimRouter = 0xAc48FcF1049668B285f3dC72483DF5Ae2162f7e8;\n address wethWhale = 0xe9b14a1Be94E70900EDdF1E22A4cB8c56aC9e10a;\n AlgebraSwapLiquidator liquidator = AlgebraSwapLiquidator(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\n vm.startPrank(wethWhale);\n IERC20Upgradeable(weth).transfer(address(liquidator), 2018770577362160);\n liquidator.redeem(IERC20Upgradeable(weth), 2018770577362160, abi.encode(usdc, kimRouter));\n emit log_named_uint(\"usdc received\", IERC20Upgradeable(usdc).balanceOf(address(liquidator)));\n }\n\n function testVelodromeV2Liquidator_mode_usdcToWeth() public debuggingOnly forkAtBlock(MODE_MAINNET, 13881743) {\n VelodromeV2Liquidator liquidator = new VelodromeV2Liquidator();\n IERC20Upgradeable usdc = IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f);\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address usdcWhale = 0xFd1D36995d76c0F75bbe4637C84C06E4A68bBB3a;\n\n address veloRouter = 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45;\n\n vm.startPrank(usdcWhale);\n usdc.transfer(address(liquidator), 1000 * 10e6);\n IRouter_Velodrome.Route[] memory path = new IRouter_Velodrome.Route[](1);\n path[0] = IRouter_Velodrome.Route({ from: address(usdc), to: address(weth), stable: false });\n liquidator.redeem(usdc, 1000 * 10e6, abi.encode(veloRouter, path));\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testVelodromeV2Liquidator_mode_wethToUSDC() public debuggingOnly forkAtBlock(MODE_MAINNET, 13881743) {\n VelodromeV2Liquidator liquidator = new VelodromeV2Liquidator();\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n IERC20Upgradeable usdc = IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f);\n address wethWhale = 0xe9b14a1Be94E70900EDdF1E22A4cB8c56aC9e10a;\n\n address veloRouter = 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45;\n\n vm.startPrank(wethWhale);\n weth.transfer(address(liquidator), 1 ether);\n IRouter_Velodrome.Route[] memory path = new IRouter_Velodrome.Route[](1);\n path[0] = IRouter_Velodrome.Route({ from: address(weth), to: address(usdc), stable: false });\n\n liquidator.redeem(weth, 1 ether, abi.encode(veloRouter, path));\n emit log_named_uint(\"usdc received\", usdc.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function test_claimRewardFromLeveredPosition() public debuggingOnly fork(BASE_MAINNET) {\n LeveredPosition position = LeveredPosition(\n 0x3a0eA2C577b0e0f2CAaEcC2b8fF8fF1850267ba2 // 20 days old\n );\n ILeveredPositionFactory factory = position.factory();\n\n vm.prank(address(factory));\n LeveredPosition dummy = new LeveredPosition(\n msg.sender,\n ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3),\n ICErc20(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0)\n );\n emit log_named_address(\"dummy\", address(dummy));\n\n vm.startPrank(factory.owner());\n DiamondBase(address(factory))._registerExtension(\n new LeveredPositionFactoryFirstExtension(),\n DiamondExtension(0x115455f15ef67e298F012F225B606D3c4Daa1d60)\n );\n factory._setPositionsExtension(LeveredPosition.claimRewardsFromRouter.selector, address(dummy));\n vm.stopPrank();\n\n {\n // mock the usdz call\n vm.mockCall(\n 0x04D5ddf5f3a8939889F11E97f8c4BB48317F1938,\n abi.encodeWithSelector(IERC20Upgradeable.balanceOf.selector),\n abi.encode(53307671999615298341926)\n );\n }\n\n vm.startPrank(0xC13110d04f22ed464Cb72A620fF8163585358Ff9);\n (address[] memory rewardTokens, uint256[] memory rewards) = position.claimRewardsFromRouter(\n 0xB1402333b12fc066C3D7F55d37944D5e281a3e8B\n );\n emit log_named_uint(\"reward tokens\", rewardTokens.length);\n emit log_named_uint(\"rewards\", rewards.length);\n vm.stopPrank();\n }\n\n function test_liquidateWithAggregator() public debuggingOnly forkAtBlock(MODE_MAINNET, 15435970) {\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(0x50F13EC4B68c9522260d3ccd4F19826679B3Ce5C));\n emit log_named_address(\"liquidator\", address(liquidator));\n address cErc20 = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18; // weEth\n address cTokenCollateral = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038; // usdc\n uint256 repayAmount = 843900759317990;\n address borrower = 0x1Bec4f239F1Ec11FD8DC7B31A8fea7A5bA5a9Aa4;\n address aggregatorTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE; // lifi\n // 0xd988097fb8612cc24eeC14542bC03424c656005f usdc\n // 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A weeth\n bytes memory aggregatorData = vm.parseBytes(\n \"0x4666fc800d27477c9a16fe2929353656c1222839791dbe26e815e7533f731ea9a6b919bb00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000050f13ec4b68c9522260d3ccd4f19826679b3ce5c0000000000000000000000000000000000000000000000000002ff85fb26dbe8000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000007e15eb462cdc67cf92af1f7102465a8f8c7848740000000000000000000000007e15eb462cdc67cf92af1f7102465a8f8c784874000000000000000000000000d988097fb8612cc24eec14542bc03424c656005f00000000000000000000000004c0599ae5a44757c0af6f9ec3b93da8976c150a000000000000000000000000000000000000000000000000000000000027891800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000f283bd37f90001d988097fb8612cc24eec14542bc03424c656005f000104c0599ae5a44757c0af6f9ec3b93da8976c150a0327891807030361590977620147ae00019b57dca972db5d8866c630554acdbdfe58b2659c000000011231deb6f5749ef6ce6943a275a1d3e7486f4eae59725ade04010205000601020203000205000100010400ff0000000000000000000000000053e85d00f2c6578a1205b842255ab9df9d05374425ba258e510faca5ab7ff941a1584bdd2174c94dd988097fb8612cc24eec14542bc03424c656005f4200000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000\"\n );\n\n emit log_named_uint(\n \"before collateral\",\n IERC20Upgradeable(ICErc20(cTokenCollateral).underlying()).balanceOf(address(this))\n );\n emit log_named_uint(\"before borrow\", IERC20Upgradeable(ICErc20(cErc20).underlying()).balanceOf(address(this)));\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidator.safeLiquidateWithAggregator(\n borrower,\n repayAmount,\n ICErc20(cErc20),\n ICErc20(cTokenCollateral),\n aggregatorTarget,\n aggregatorData\n );\n vm.stopPrank();\n\n emit log_named_uint(\n \"profit collateral\",\n IERC20Upgradeable(ICErc20(cTokenCollateral).underlying()).balanceOf(address(this))\n );\n emit log_named_uint(\"profit borrow\", IERC20Upgradeable(ICErc20(cErc20).underlying()).balanceOf(address(this)));\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testRawCall() public debuggingOnly forkAtBlock(BASE_MAINNET, 20569373) {\n address caller = 0xC13110d04f22ed464Cb72A620fF8163585358Ff9;\n address target = 0x180272dDf5767C771b3a8d37A2DC6cA507aaa1d9;\n\n ILeveredPositionFactory factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n ILiquidatorsRegistry registry = factory.liquidatorsRegistry();\n\n AerodromeCLLiquidator aerodomeClLiquidator = new AerodromeCLLiquidator();\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(WETH);\n IERC20Upgradeable outputToken = wsuperOETH;\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategy(aerodomeClLiquidator, inputToken, outputToken);\n registry._setRedemptionStrategy(aerodomeClLiquidator, outputToken, inputToken);\n vm.stopPrank();\n\n bytes memory data = hex\"c393d0e3\";\n vm.prank(caller);\n _functionCall(target, data, \"raw call failed\");\n\n uint256 superOETHBalance = superOETH.balanceOf(target);\n emit log_named_uint(\"balance of levered position\", superOETHBalance);\n }\n}\n" + }, + "contracts/test/EmissionsManager/EmissionsManagerTest.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"../config/BaseTest.t.sol\";\nimport \"../../EmissionsManager.sol\";\nimport \"../../PoolDirectory.sol\";\nimport \"./mocks/MockVeION.sol\";\nimport \"./mocks/MockPoolDirectory.sol\";\nimport \"./mocks/MockIonicComptroller.sol\";\nimport \"./mocks/MockOracle.sol\";\nimport \"./mocks/MockIonicFlywheelCore.sol\";\nimport \"./mocks/MockICErc20.sol\";\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../../veION/interfaces/IveION.sol\";\n\ncontract EmissionsManagerTest is BaseTest {\n MockPoolDirectory poolDirectory;\n MockIonicComptroller comptroller;\n MockICErc20 mockAsset;\n MockVeION mockVeION;\n MockOracle oracle;\n MockIonicFlywheelCore ionicFlywheelCore;\n\n EmissionsManager emissionsManager;\n MockERC20 rewardToken;\n\n address user = address(0x123);\n address reporter = address(0x124);\n address flywheelRewards = address(0x125);\n address protocolAddress = address(0x456);\n uint256 collateralBp = 250; // Example value\n bytes nonBlacklistableBytecode = hex\"deadbeef\";\n\n function setUp() public {\n mockAsset = new MockICErc20();\n mockAsset.setBalanceOfUnderlying(user, 1e18);\n\n oracle = new MockOracle();\n oracle.setUnderlyingPrice(ICErc20(address(mockAsset)), 100);\n\n // Deploy a mock ERC20 reward token\n //rewardToken = new MockERC20();\n rewardToken = new MockERC20(\"ION\", \"ION\", 18);\n\n // Deploy the IonicFlywheelCore mock\n ionicFlywheelCore = new MockIonicFlywheelCore();\n ionicFlywheelCore.setRewardToken(address(rewardToken));\n\n // Deploy the Comptroller mock\n comptroller = new MockIonicComptroller();\n comptroller.setAssetsIn(address(mockAsset));\n comptroller.setOracle(address(oracle));\n comptroller.setFlywheel(address(ionicFlywheelCore));\n\n // Deploy the PoolDirectory mock\n poolDirectory = new MockPoolDirectory();\n poolDirectory.setActivePools(address(comptroller));\n\n emissionsManager = EmissionsManager(\n address(\n new TransparentUpgradeableProxy(\n address(new EmissionsManager()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n emissionsManager.initialize.selector,\n PoolDirectory(address(poolDirectory)),\n protocolAddress,\n rewardToken,\n collateralBp,\n nonBlacklistableBytecode\n )\n )\n )\n );\n mockVeION = new MockVeION();\n mockVeION.setMockTotalEthValueOfTokens(user, 1);\n emissionsManager.setVeIon(IveION(address(mockVeION)));\n }\n\n function test_Initialize() public {\n assertEq(emissionsManager.protocolAddress(), protocolAddress, \"Protocol address mismatch\");\n\n assertEq(emissionsManager.collateralBp(), collateralBp, \"Collateral basis points mismatch\");\n\n assertEq(address(emissionsManager.rewardToken()), address(rewardToken), \"Reward token mismatch\");\n }\n\n function test_setVeIon_OwnerCanSetVeIonAddress() public {\n IveION veIONMock = IveION(address(new MockVeION()));\n\n emissionsManager.setVeIon(veIONMock);\n\n assertEq(address(emissionsManager.veION()), address(veIONMock), \"veION address mismatch\");\n }\n\n function test_setCollateralBp_OwnerCanSetCollateralBp() public {\n uint256 newCollateralBp = 2_500;\n\n emissionsManager.setCollateralBp(newCollateralBp);\n\n assertEq(emissionsManager.collateralBp(), newCollateralBp, \"Collateral basis points not updated\");\n }\n\n function test_setNonBlacklistableAddress_OwnerCanSetNonBlacklistableAddress() public {\n emissionsManager.setNonBlacklistableAddress(user, true);\n\n assertTrue(emissionsManager.nonBlacklistable(user), \"User should be non-blacklistable\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n assertFalse(emissionsManager.nonBlacklistable(user), \"User should be blacklistable\");\n }\n\n function test_setNonBlacklistableTargetBytecode_OwnerCanSetNonBlacklistableTargetBytecode() public {\n bytes memory bytecode = hex\"deadbeef\";\n\n emissionsManager.setNonBlacklistableTargetBytecode(bytecode);\n\n assertEq(emissionsManager.nonBlacklistableTargetBytecode(), bytecode, \"Non-blacklistable target bytecode mismatch\");\n }\n\n function test_reportUser_ReporterCanReportUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n emissionsManager.setNonBlacklistableAddress(user, false);\n assertEq(rewardToken.balanceOf(address(ionicFlywheelCore)), 0);\n\n ionicFlywheelCore.setFlywheelRewards(flywheelRewards);\n rewardToken.mint(flywheelRewards, 1e18);\n vm.prank(flywheelRewards);\n rewardToken.approve(address(ionicFlywheelCore), 1e18);\n\n assertEq(rewardToken.balanceOf(flywheelRewards), 1e18);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n assertEq(rewardToken.balanceOf(flywheelRewards), 0);\n assertEq(rewardToken.balanceOf(reporter), 8e17);\n assertEq(rewardToken.balanceOf(protocolAddress), 2e17);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n }\n\n function test_reportUser_ReporterCantReportUserWithLPBalanceAboveThreshold() public {\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n vm.prank(reporter);\n vm.expectRevert(\"LP balance above threshold\");\n emissionsManager.reportUser(user);\n }\n\n function test_reportUser_ReporterCantReportAlreadyBlacklistedUser() public {\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n vm.prank(reporter);\n vm.expectRevert(\"Already blacklisted\");\n emissionsManager.reportUser(user);\n }\n\n function test_reportUser_ReporterCantReportNonBlacklistableBytecode() public {\n emissionsManager.setNonBlacklistableTargetBytecode(address(mockAsset).code);\n\n vm.prank(reporter);\n vm.expectRevert(\"Non-blacklistable bytecode\");\n emissionsManager.reportUser(address(mockAsset));\n }\n\n function test_reportUser_ReporterCantReportNonBlacklistableUser() public {\n emissionsManager.setNonBlacklistableAddress(user, true);\n\n vm.prank(reporter);\n vm.expectRevert(\"Non-blacklistable user\");\n emissionsManager.reportUser(user);\n }\n\n function test_whitelistUser_ReporterCanWhitelistBlacklistedUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n emissionsManager.whitelistUser(user);\n\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should be whitelisted\");\n }\n\n function test_whitelistUser_ReporterCantWhitelistUserWithLpBalanceBelowThreshold() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n vm.expectRevert(\"LP balance below threshold\");\n emissionsManager.whitelistUser(user);\n }\n\n function test_whitelistUser_ReporterCantWhitelistAlreadyWhitelistedUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n emissionsManager.whitelistUser(user);\n\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should be whitelisted\");\n\n vm.expectRevert(\"Already whitelisted\");\n emissionsManager.whitelistUser(user);\n }\n}\n" + }, + "contracts/test/EmissionsManager/mocks/MockICErc20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ncontract MockICErc20 {\n mapping(address => uint256) public balances;\n\n\n function setBalanceOfUnderlying(address _user, uint256 _balance) public {\n balances[_user] = _balance;\n }\n function balanceOfUnderlying(address _user) public view returns (uint256) {\n return balances[_user];\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicComptroller.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { IonicFlywheelCore } from \"../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\ncontract MockIonicComptroller {\n address public oracle;\n address public asset;\n address public flywheel;\n\n // Allows setting mock eth values for testing purposes\n function setOracle(address _oracle) external {\n oracle = _oracle;\n }\n\n function setAssetsIn(address _asset) external {\n asset = _asset;\n }\n\n function setFlywheel(address _flywheel) external {\n flywheel = _flywheel;\n }\n function getAssetsIn(address _user) public view returns (ICErc20[] memory) {\n ICErc20[] memory assets = new ICErc20[](1); \n assets[0] = ICErc20(asset); \n return assets;\n }\n\n function getAllMarkets() public view returns (ICErc20[] memory) {\n ICErc20[] memory assets = new ICErc20[](1); \n assets[0] = ICErc20(asset); \n return assets;\n }\n\n function getAccruingFlywheels() public view returns (IonicFlywheelCore[] memory) {\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](1); \n flywheels[0] = IonicFlywheelCore(flywheel); \n return flywheels;\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\n\ncontract MockIonicFlywheelCore {\n using SafeTransferLib for ERC20;\n\n address public rewardToken;\n address public flywheelRewards;\n function setRewardToken(address _rewardToken) public {\n rewardToken = _rewardToken;\n }\n\n function setFlywheelRewards(address _flywheelRewards) public {\n flywheelRewards = _flywheelRewards;\n }\n\n function updateBlacklistBalances(ERC20 _market, address _user) external {}\n\n function accrue(ERC20 _market, address _user) public returns (uint256) {\n return 0;\n }\n\n function takeRewardsFromUser(address _user, address _receiver) external { \n uint256 balance = ERC20(rewardToken).balanceOf(address(flywheelRewards));\n ERC20(rewardToken).safeTransferFrom(address(flywheelRewards), _receiver, balance);\n }\n function whitelistUser(ERC20 strategy, address user) external {}\n\n}" + }, + "contracts/test/EmissionsManager/mocks/MockOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\ncontract MockOracle {\n mapping(ICErc20 => uint256) public prices;\n\n function setUnderlyingPrice(ICErc20 _tokenAddress, uint256 _price) public {\n prices[_tokenAddress] = _price;\n }\n function getUnderlyingPrice(ICErc20 _tokenAddress) public view returns (uint256) {\n return prices[_tokenAddress];\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockPoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nstruct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n}\n\ncontract MockPoolDirectory {\n\n Pool[] public pools;\n\n // Allows setting mock eth values for testing purposes\n function setActivePools(address comptroller) external {\n Pool memory pool = Pool(\"Test Pool\", msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n }\n\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory activeIds = new uint256[](1);\n Pool[] memory activePools = new Pool[](1);\n activePools[0] = pools[0];\n return (activeIds, activePools);\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockVeION.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ncontract MockVeION /* is */ {\n mapping(address => uint256) public ethValues;\n\n // Allows setting mock eth values for testing purposes\n function setMockTotalEthValueOfTokens(address _owner, uint256 _value) external {\n ethValues[_owner] = _value;\n }\n\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\n return ethValues[_owner];\n }\n}" + }, + "contracts/test/ExtensionsTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\n\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract MockComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getFirstMarketSymbol() public view returns (string memory) {\n return allMarkets[0].symbol();\n }\n\n function _setTransferPaused(bool) public returns (bool) {\n return false;\n }\n\n function _setSeizePaused(bool) public returns (bool) {\n return false;\n }\n\n // a dummy fn to test if the replacement of extension fns works\n function getSecondMarketSymbol() public view returns (string memory) {\n return allMarkets[1].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 4;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\n functionSelectors[--fnsCount] = this.getFirstMarketSymbol.selector;\n functionSelectors[--fnsCount] = this.getSecondMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract MockSecondComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getThirdMarketSymbol() public view returns (string memory) {\n return allMarkets[2].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 1;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getThirdMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract MockThirdComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getFourthMarketSymbol() public view returns (string memory) {\n return allMarkets[3].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 1;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getFourthMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract ExtensionsTest is MarketsTest {\n MockComptrollerExtension internal mockExtension;\n MockSecondComptrollerExtension internal second;\n MockThirdComptrollerExtension internal third;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n mockExtension = new MockComptrollerExtension();\n second = new MockSecondComptrollerExtension();\n third = new MockThirdComptrollerExtension();\n }\n\n function testExtensionReplace() public debuggingOnly fork(BSC_MAINNET) {\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\n _upgradeExistingPool(jFiatPoolAddress);\n\n // replace the first extension with the mock\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, mockExtension, comptrollerExtension);\n\n // assert that the replacement worked\n MockComptrollerExtension asMockExtension = MockComptrollerExtension(jFiatPoolAddress);\n emit log(asMockExtension.getSecondMarketSymbol());\n assertEq(asMockExtension.getSecondMarketSymbol(), \"fETH-1\", \"market symbol does not match\");\n\n // add a second mock extension\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, second, DiamondExtension(address(0)));\n\n // add again the third, removing the second\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, third, second);\n\n // assert that it worked\n DiamondBase asBase = DiamondBase(jFiatPoolAddress);\n address[] memory currentExtensions = asBase._listExtensions();\n assertEq(currentExtensions.length, 2, \"extensions count does not match\");\n assertEq(currentExtensions[0], address(mockExtension), \"!first\");\n assertEq(currentExtensions[1], address(third), \"!second\");\n }\n\n function testNewPoolExtensions() public fork(BSC_MAINNET) {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n _prepareComptrollerUpgrade(address(0));\n\n // deploy a pool that will have an extension registered automatically\n {\n (, address poolAddress) = fpd.deployPool(\n \"just-a-test2\",\n latestComptrollerImplementation,\n abi.encode(payable(address(ffd))),\n false,\n 0.1e18,\n 1.1e18,\n ap.getAddress(\"MasterPriceOracle\")\n );\n\n address[] memory initExtensionsAfter = DiamondBase(payable(poolAddress))._listExtensions();\n assertEq(initExtensionsAfter.length, 1, \"remove this if the ffd config is set up\");\n assertEq(initExtensionsAfter[0], address(comptrollerExtension), \"first extension is not the CFE\");\n }\n }\n\n function testMulticallMarket() public fork(BSC_MAINNET) {\n uint8 random = uint8(block.timestamp % 256);\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(pools[random % pools.length].comptroller);\n ICErc20[] memory markets = somePool.getAllMarkets();\n\n if (markets.length == 0) return;\n\n ICErc20 someMarket = markets[random % markets.length];\n\n emit log(\"pool\");\n emit log_address(address(somePool));\n emit log(\"market\");\n emit log_address(address(someMarket));\n\n vm.roll(block.number + 1);\n\n bytes memory blockNumberBeforeCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\n bytes memory accrueInterestCall = abi.encodeWithSelector(someMarket.accrueInterest.selector);\n bytes memory blockNumberAfterCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\n bytes[] memory results = someMarket.multicall(\n asArray(blockNumberBeforeCall, accrueInterestCall, blockNumberAfterCall)\n );\n uint256 blockNumberBefore = abi.decode(results[0], (uint256));\n uint256 blockNumberAfter = abi.decode(results[2], (uint256));\n\n assertGt(blockNumberAfter, blockNumberBefore, \"did not accrue?\");\n }\n\n function testBscExistingCTokenExtensionUpgrade() public fork(BSC_MAINNET) {\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\n }\n\n function testArbitrumExistingCTokenExtensionUpgrade() public fork(ARBITRUM_ONE) {\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\n }\n\n function _testAllPoolsAllMarketsCTokenExtensionUpgrade() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n _testPoolAllMarketsExtensionUpgrade(pools[i].comptroller);\n }\n }\n\n function _testPoolAllMarketsExtensionUpgrade(address poolAddress) internal {\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(poolAddress);\n\n ICErc20[] memory markets = somePool.getAllMarkets();\n\n if (markets.length == 0) return;\n\n for (uint256 j = 0; j < markets.length; j++) {\n ICErc20 someMarket = markets[j];\n CErc20Delegator asDelegator = CErc20Delegator(address(someMarket));\n\n emit log(\"pool\");\n emit log_address(address(somePool));\n emit log(\"market\");\n emit log_address(address(someMarket));\n\n try this._testExistingCTokenExtensionUpgrade(asDelegator) {} catch Error(string memory reason) {\n address plugin = address(CErc20PluginDelegate(address(asDelegator)).plugin());\n emit log(\"plugin\");\n emit log_address(plugin);\n\n address latestPlugin = ffd.latestPluginImplementation(plugin);\n emit log(\"latest plugin impl\");\n emit log_address(latestPlugin);\n\n revert(reason);\n }\n }\n }\n\n function _testExistingCTokenExtensionUpgrade(CErc20Delegator asDelegator) public {\n uint256 totalSupplyBefore = asDelegator.totalSupply();\n if (totalSupplyBefore == 0) return; // total supply should be non-zero\n\n // TODO\n _upgradeMarket(ICErc20(address(asDelegator)));\n\n // check if the extension was added\n address[] memory extensions = asDelegator._listExtensions();\n assertEq(extensions.length, 1, \"the first extension should be added\");\n assertEq(extensions[0], address(newCTokenExtension), \"the first extension should be the only extension\");\n\n // check if the storage is read from the same place\n uint256 totalSupplyAfter = asDelegator.totalSupply();\n assertGt(totalSupplyAfter, 0, \"total supply should be non-zero\");\n assertEq(totalSupplyAfter, totalSupplyBefore, \"total supply should be the same\");\n }\n\n function testBscComptrollerExtensions() public debuggingOnly fork(BSC_MAINNET) {\n _testComptrollersExtensions();\n }\n\n function testPolygonComptrollerExtensions() public debuggingOnly fork(POLYGON_MAINNET) {\n _testComptrollersExtensions();\n }\n\n function testChapelComptrollerExtensions() public debuggingOnly fork(BSC_CHAPEL) {\n _testComptrollersExtensions();\n }\n\n function testArbitrumComptrollerExtensions() public debuggingOnly fork(ARBITRUM_ONE) {\n _testComptrollersExtensions();\n }\n\n function _testComptrollersExtensions() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n address payable asPayable = payable(pools[i].comptroller);\n DiamondBase asBase = DiamondBase(asPayable);\n address[] memory extensions = asBase._listExtensions();\n assertEq(extensions.length, 1, \"each pool should have the first extension\");\n }\n }\n\n function testBulkAutoUpgrade() public debuggingOnly fork(POLYGON_MAINNET) {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n vm.prank(ffd.owner());\n ffd.autoUpgradePool(IonicComptroller(pools[i].comptroller));\n }\n }\n\n function testPolygonTotalUnderlyingSupplied() public debuggingOnly fork(POLYGON_MAINNET) {\n _testTotalUnderlyingSupplied();\n }\n\n function testBscTotalUnderlyingSupplied() public debuggingOnly fork(BSC_MAINNET) {\n _testTotalUnderlyingSupplied();\n }\n\n function _testTotalUnderlyingSupplied() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n // if (pools[i].comptroller == 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459) continue;\n // if (pools[i].comptroller == 0xD265ff7e5487E9DD556a4BB900ccA6D087Eb3AD2) continue;\n ComptrollerFirstExtension poolExt = ComptrollerFirstExtension(pools[i].comptroller);\n\n ICErc20[] memory markets = poolExt.getAllMarkets();\n for (uint8 k = 0; k < markets.length; k++) {\n CErc20Delegate market = CErc20Delegate(address(markets[k]));\n // emit log(market.contractType());\n // emit log_named_address(\"impl\", market.implementation());\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(address(markets[k]));\n marketAsExt.getTotalUnderlyingSupplied();\n }\n }\n }\n\n function testDelegateType() public debuggingOnly fork(POLYGON_MAINNET) {\n emit log(CErc20Delegate(0x587906620D627fe75C4d1288C6A584089780959c).contractType());\n }\n}\n" + }, + "contracts/test/GlobalPauser.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport \"./config/BaseTest.t.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { IComptroller } from \"../external/compound/IComptroller.sol\";\nimport { GlobalPauser } from \"../GlobalPauser.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport \"forge-std/console.sol\";\n\ncontract GlobalPauserTest is BaseTest {\n address public poolDirectory = 0x39C353Cf9041CcF467A04d0e78B63d961E81458a;\n address public pauseGuardian = 0xD9677b0eeafdCe6BF322d9774Bb65B1f42cF0404;\n address public multisig = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2;\n GlobalPauser public pauser; // = GlobalPauser(0xe646D8Be18e545244C5E79F121202f75FA3880c8);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n pauser = new GlobalPauser(poolDirectory);\n pauser.setPauseGuardian(pauseGuardian, true);\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(poolDirectory).getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n vm.prank(IonicComptroller(pools[i].comptroller).admin());\n IonicComptroller(pools[i].comptroller)._setPauseGuardian(address(pauser));\n }\n }\n\n function testPauseNotGuardian(address sender) public debuggingOnly forkAtBlock(MODE_MAINNET, 9269895) {\n vm.assume(sender != pauseGuardian);\n vm.expectRevert(bytes(\"!guardian\"));\n pauser.pauseAll();\n }\n\n function testPauseAll() public debuggingOnly forkAtBlock(MODE_MAINNET, 9269895) {\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(poolDirectory).getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n assertEq(isPaused, false);\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n assertEq(isPaused, false);\n }\n }\n vm.prank(pauseGuardian);\n pauser.pauseAll();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n assertEq(isPaused, true);\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n assertEq(isPaused, true);\n }\n }\n }\n}\n" + }, + "contracts/test/helpers/WithPool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.4.23;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\n\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../../compound/CErc20Delegator.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { PoolLens } from \"../../PoolLens.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract WithPool is BaseTest {\n ERC20Upgradeable public underlyingToken;\n CErc20Delegate cErc20Delegate;\n CErc20PluginDelegate cErc20PluginDelegate;\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\n\n IonicComptroller comptroller;\n Comptroller newComptroller;\n JumpRateModel interestModel;\n\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n MasterPriceOracle priceOracle;\n PoolLens poolLens;\n\n address[] markets;\n bool[] t;\n bool[] f;\n address[] newImplementation;\n address[] hardcodedAddresses;\n string[] hardcodedNames;\n\n function setUpWithPool(MasterPriceOracle _masterPriceOracle, ERC20Upgradeable _underlyingToken) public {\n priceOracle = _masterPriceOracle;\n underlyingToken = _underlyingToken;\n\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n if (address(ionicAdmin) != address(0)) {\n // upgrade\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ionicAdmin)));\n bytes32 bytesAtSlot = vm.load(\n address(proxy),\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\n );\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n } else {\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n }\n\n {\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setPendingOwner(address(this));\n ionicAdmin._acceptOwner();\n }\n setUpBaseContracts();\n setUpExtensions();\n }\n\n function setUpExtensions() internal {\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginDelegate.delegateType(),\n address(cErc20PluginDelegate),\n abi.encode(address(0))\n );\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginRewardsDelegate.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0))\n );\n\n cErc20DelegateExtensions[1] = cErc20Delegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n cErc20DelegateExtensions[1] = cErc20PluginDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\n cErc20DelegateExtensions[1] = cErc20PluginRewardsDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\n }\n\n function setUpBaseContracts() internal {\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n\n poolLens = new PoolLens();\n poolLens.initialize(\n poolDirectory,\n \"Pool\",\n \"lens\",\n hardcodedAddresses,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames\n );\n }\n\n function setUpPool(\n string memory name,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive\n ) public {\n Comptroller newComptrollerImplementation = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(newComptrollerImplementation));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = newComptrollerImplementation;\n ionicAdmin._setComptrollerExtensions(address(newComptrollerImplementation), extensions);\n\n (, address comptrollerAddress) = poolDirectory.deployPool(\n name,\n address(newComptrollerImplementation),\n abi.encode(payable(address(ionicAdmin))),\n enforceWhitelist,\n closeFactor,\n liquidationIncentive,\n address(priceOracle)\n );\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n }\n\n function upgradePool(address pool) internal {\n Comptroller newComptrollerImplementation = new Comptroller();\n\n Unitroller asUnitroller = Unitroller(payable(pool));\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(\n newComptrollerImplementation,\n DiamondExtension(asUnitroller.comptrollerImplementation())\n );\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function deployCErc20Delegate(\n address _underlyingToken,\n bytes memory name,\n bytes memory symbol,\n uint256 _collateralFactorMantissa\n ) public {\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n _underlyingToken,\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n name,\n symbol,\n uint256(1),\n uint256(0)\n ),\n \"\",\n _collateralFactorMantissa\n );\n }\n\n function deployCErc20PluginDelegate(address _erc4626, uint256 _collateralFactorMantissa) public {\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(_erc4626),\n _collateralFactorMantissa\n );\n }\n\n function deployCErc20PluginRewardsDelegate(address _mockERC4626Dynamic, uint256 _collateralFactorMantissa) public {\n comptroller._deployMarket(\n cErc20PluginRewardsDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(_mockERC4626Dynamic),\n _collateralFactorMantissa\n );\n }\n}\n" + }, + "contracts/test/LatestImplementationWhitelisted.t.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract LatestImplementationWhitelisted is BaseTest {\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n address[] poolsImplementationsSet;\n address[] marketsImplementationsSet;\n address[] pluginsSet;\n\n function testBscImplementations() public fork(BSC_MAINNET) {\n testPoolImplementations();\n testMarketImplementations();\n testPluginImplementations();\n }\n\n function testPolygonImplementations() public fork(POLYGON_MAINNET) {\n testPoolImplementations();\n testMarketImplementations();\n testPluginImplementations();\n }\n\n function afterForkSetUp() internal override {\n poolDirectory = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n }\n\n function testPoolImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n address implementation = comptroller.comptrollerImplementation();\n\n bool added = false;\n for (uint8 k = 0; k < poolsImplementationsSet.length; k++) {\n if (poolsImplementationsSet[k] == implementation) {\n added = true;\n }\n }\n\n if (!added) poolsImplementationsSet.push(implementation);\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < poolsImplementationsSet.length; k++) {\n emit log_address(poolsImplementationsSet[k]);\n\n address latestImpl = ionicAdmin.latestComptrollerImplementation(poolsImplementationsSet[k]);\n assertTrue(poolsImplementationsSet[k] == latestImpl, \"some pool is not upgraded the latest impl\");\n }\n }\n\n function testMarketImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n address implementation = market.implementation();\n\n bool added = false;\n for (uint8 k = 0; k < marketsImplementationsSet.length; k++) {\n if (marketsImplementationsSet[k] == implementation) {\n added = true;\n }\n }\n\n if (!added) marketsImplementationsSet.push(implementation);\n }\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < marketsImplementationsSet.length; k++) {\n emit log_address(marketsImplementationsSet[k]);\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = ionicAdmin.latestCErc20Delegate(\n CErc20Delegate(marketsImplementationsSet[k]).delegateType()\n );\n\n assertTrue(marketsImplementationsSet[k] == latestCErc20Delegate, \"some markets need to be upgraded\");\n }\n }\n\n function testPluginImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n CErc20PluginDelegate delegate = CErc20PluginDelegate(address(markets[j]));\n\n address plugin;\n try delegate.plugin() returns (IERC4626 _plugin) {\n plugin = address(_plugin);\n } catch {\n continue;\n }\n\n bool added = false;\n for (uint8 k = 0; k < pluginsSet.length; k++) {\n if (pluginsSet[k] == plugin) {\n added = true;\n }\n }\n\n if (!added) pluginsSet.push(plugin);\n }\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < pluginsSet.length; k++) {\n address latestPluginImpl = ionicAdmin.latestPluginImplementation(pluginsSet[k]);\n\n emit log_address(pluginsSet[k]);\n\n assertTrue(pluginsSet[k] == latestPluginImpl, \"some plugin is not upgraded to the latest impl\");\n }\n }\n}\n" + }, + "contracts/test/LeveredPositionTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest, BaseTest } from \"./config/MarketsTest.t.sol\";\nimport { DiamondBase, DiamondExtension } from \"../ionic/DiamondExtension.sol\";\n\nimport { LeveredPosition } from \"../ionic/levered/LeveredPosition.sol\";\nimport { LeveredPositionFactory, IFeeDistributor } from \"../ionic/levered/LeveredPositionFactory.sol\";\nimport { AlgebraSwapLiquidator } from \"../liquidators/AlgebraSwapLiquidator.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { AerodromeCLLiquidator } from \"../liquidators/AerodromeCLLiquidator.sol\";\nimport { AerodromeV2Liquidator } from \"../liquidators/AerodromeV2Liquidator.sol\";\n\nimport { LeveredPositionFactoryFirstExtension } from \"../ionic/levered/LeveredPositionFactoryFirstExtension.sol\";\nimport { LeveredPositionFactorySecondExtension } from \"../ionic/levered/LeveredPositionFactorySecondExtension.sol\";\nimport { ILeveredPositionFactory } from \"../ionic/levered/ILeveredPositionFactory.sol\";\nimport { LeveredPositionsLens } from \"../ionic/levered/LeveredPositionsLens.sol\";\nimport { LiquidatorsRegistry } from \"../liquidators/registry/LiquidatorsRegistry.sol\";\nimport { LiquidatorsRegistryExtension } from \"../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { SafeOwnable } from \"../ionic/SafeOwnable.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ncontract LeveredPositionLensTest is BaseTest {\n LeveredPositionsLens lens;\n ILeveredPositionFactory factory;\n\n function afterForkSetUp() internal override {\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n emit log_named_address(\"factory\", address(factory));\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n // lens = new LeveredPositionsLens();\n // lens.initialize(factory);\n }\n\n function testLPLens() public debuggingOnly fork(BSC_CHAPEL) {\n _testLPLens();\n }\n\n function _testLPLens() internal {\n address[] memory positions;\n bool[] memory closed;\n (positions, closed) = factory.getPositionsByAccount(0xb6c11605e971ab46B9BE4fDC48C9650A257075db);\n\n // address[] memory accounts = factory.getAccountsWithOpenPositions();\n // for (uint256 i = 0; i < accounts.length; i++) {\n // (positions, closed) = factory.getPositionsByAccount(accounts[i]);\n // if (positions.length > 0) break;\n // }\n\n uint256[] memory apys = new uint256[](positions.length);\n LeveredPosition[] memory pos = new LeveredPosition[](positions.length);\n for (uint256 j = 0; j < positions.length; j++) {\n apys[j] = 1e17;\n\n if (address(0) == positions[j]) revert(\"zero pos address\");\n pos[j] = LeveredPosition(positions[j]);\n }\n\n LeveredPositionsLens.PositionInfo[] memory infos = lens.getPositionsInfo(pos, apys);\n\n for (uint256 k = 0; k < infos.length; k++) {\n emit log_named_address(\"address\", address(pos[k]));\n emit log_named_uint(\"positionSupplyAmount\", infos[k].positionSupplyAmount);\n emit log_named_uint(\"positionValue\", infos[k].positionValue);\n emit log_named_uint(\"debtAmount\", infos[k].debtAmount);\n emit log_named_uint(\"debtValue\", infos[k].debtValue);\n emit log_named_uint(\"equityValue\", infos[k].equityValue);\n emit log_named_uint(\"equityAmount\", infos[k].equityAmount);\n emit log_named_int(\"currentApy\", infos[k].currentApy);\n emit log_named_uint(\"debtRatio\", infos[k].debtRatio);\n emit log_named_uint(\"liquidationThreshold\", infos[k].liquidationThreshold);\n emit log_named_uint(\"safetyBuffer\", infos[k].safetyBuffer);\n\n emit log(\"\");\n }\n }\n\n function testPrintLeveredPositions() public debuggingOnly fork(POLYGON_MAINNET) {\n address[] memory accounts = factory.getAccountsWithOpenPositions();\n\n emit log_named_array(\"accounts\", accounts);\n\n for (uint256 j = 0; j < accounts.length; j++) {\n address[] memory positions;\n bool[] memory closed;\n (positions, closed) = factory.getPositionsByAccount(accounts[j]);\n emit log_named_array(\"positions\", positions);\n //emit log_named_array(\"closed\", closed);\n }\n }\n\n function testScenarioLeverageFailed() public debuggingOnly forkAtBlock(MODE_MAINNET, 10672173) {\n address USER = 0x95Ce459B20586cf44ee6d295C4f28e1a134CF529;\n // IERC20Upgradeable(0x4200000000000000000000000000000000000006).approve(\n // address(factory),\n // 100000 ether\n // );\n vm.prank(ap.owner());\n ap.setAddress(\"IUniswapV2Router02\", 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45);\n vm.startPrank(USER);\n LeveredPosition position = factory.createAndFundPositionAtRatio(\n ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),\n IERC20Upgradeable(0x4200000000000000000000000000000000000006),\n 16754252276537996590,\n 3000000000000000000\n );\n emit log_named_address(\"position\", address(position));\n\n // vm.stopPrank();\n // ILiquidatorsRegistry registry = factory.liquidatorsRegistry();\n // vm.startPrank(registry.owner());\n // registry._setRedemptionStrategy(\n // new UniswapV3LiquidatorFunder(),\n // IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f),\n // IERC20Upgradeable(0x4200000000000000000000000000000000000006)\n // );\n // vm.stopPrank();\n // vm.startPrank(USER);\n\n vm.roll(10673509);\n position.adjustLeverageRatio(3000000000000000000);\n\n // vm.roll(10852409);\n // position.adjustLeverageRatio(3000000000000000000);\n\n // vm.roll(11268772);\n // position.adjustLeverageRatio(3000000000000000000);\n vm.stopPrank();\n }\n}\n\ncontract LeveredPositionFactoryTest is BaseTest {\n ILeveredPositionFactory factory;\n LeveredPositionsLens lens;\n\n function afterForkSetUp() internal override {\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function testChapelNetApy() public debuggingOnly fork(BSC_CHAPEL) {\n ICErc20 _stableMarket = ICErc20(address(1)); // DAI\n\n uint256 borrowRate = 5.2e16; // 5.2%\n vm.mockCall(\n address(_stableMarket),\n abi.encodeWithSelector(_stableMarket.borrowRatePerBlock.selector),\n abi.encode(borrowRate / factory.blocksPerYear())\n );\n\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\n emit log_named_uint(\"_borrowRate\", _borrowRate);\n\n int256 netApy = lens.getNetAPY(\n 2.7e16, // 2.7%\n 1e18, // supply amount\n ICErc20(address(0)), // BOMB\n _stableMarket,\n 2e18 // ratio\n );\n\n emit log_named_int(\"net apy\", netApy);\n\n // boosted APY = 2x 2.7% = 5.4 % of the equity\n // borrow APR = 5.2%\n // diff = 5.4 - 5.2 = 0.2%\n assertApproxEqRel(netApy, 0.2e16, 1e12, \"!net apy\");\n }\n}\n\nabstract contract LeveredPositionTest is MarketsTest {\n ICErc20 collateralMarket;\n ICErc20 stableMarket;\n ILeveredPositionFactory factory;\n ILiquidatorsRegistry registry;\n LeveredPosition position;\n LeveredPositionsLens lens;\n\n uint256 minLevRatio;\n uint256 maxLevRatio;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n registry = factory.liquidatorsRegistry();\n {\n // upgrade the registry\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n\n vm.startPrank(registry.owner());\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory oldExts = asBase._listExtensions();\n\n if (oldExts.length == 1) {\n asBase._registerExtension(newExt1, DiamondExtension(oldExts[0]));\n asBase._registerExtension(newExt2, DiamondExtension(address(0)));\n } else if (oldExts.length == 2) {\n asBase._registerExtension(newExt1, DiamondExtension(oldExts[0]));\n asBase._registerExtension(newExt2, DiamondExtension(oldExts[1]));\n }\n vm.stopPrank();\n }\n\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function upgradePoolAndMarkets() internal {\n _upgradeExistingPool(address(collateralMarket.comptroller()));\n _upgradeMarket(collateralMarket);\n _upgradeMarket(stableMarket);\n }\n\n function _unpauseMarkets(address collat, address stable) internal {\n ComptrollerFirstExtension asExtension = ComptrollerFirstExtension(address(ICErc20(stable).comptroller()));\n vm.startPrank(asExtension.admin());\n asExtension._setMintPaused(ICErc20(collat), false);\n asExtension._setMintPaused(ICErc20(stable), false);\n asExtension._setBorrowPaused(ICErc20(stable), false);\n vm.stopPrank();\n }\n\n function _configurePairAndLiquidator(address _collat, address _stable, IRedemptionStrategy _liquidator) internal {\n _configurePair(_collat, _stable);\n _configureTwoWayLiquidator(_collat, _stable, _liquidator);\n }\n\n function _configurePair(address _collat, address _stable) internal {\n collateralMarket = ICErc20(_collat);\n stableMarket = ICErc20(_stable);\n\n //upgradePoolAndMarkets();\n //_unpauseMarkets(_collat, _stable);\n vm.prank(factory.owner());\n factory._setPairWhitelisted(collateralMarket, stableMarket, true);\n }\n\n function _whitelistTestUser(address user) internal {\n address pool = address(collateralMarket.comptroller());\n PoolRolesAuthority pra = ffd.authoritiesRegistry().poolsAuthorities(pool);\n\n vm.startPrank(pra.owner());\n pra.setUserRole(user, pra.BORROWER_ROLE(), true);\n vm.stopPrank();\n }\n\n function _configureTwoWayLiquidator(\n address inputMarket,\n address outputMarket,\n IRedemptionStrategy strategy\n ) internal {\n IERC20Upgradeable inputToken = underlying(inputMarket);\n IERC20Upgradeable outputToken = underlying(outputMarket);\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategy(strategy, inputToken, outputToken);\n registry._setRedemptionStrategy(strategy, outputToken, inputToken);\n vm.stopPrank();\n }\n\n function underlying(address market) internal view returns (IERC20Upgradeable) {\n return IERC20Upgradeable(ICErc20(market).underlying());\n }\n\n struct Liquidator {\n IERC20Upgradeable inputToken;\n IERC20Upgradeable outputToken;\n IRedemptionStrategy strategy;\n }\n\n function _configureMultipleLiquidators(Liquidator[] memory liquidators) internal {\n IRedemptionStrategy[] memory strategies = new IRedemptionStrategy[](liquidators.length);\n IERC20Upgradeable[] memory inputTokens = new IERC20Upgradeable[](liquidators.length);\n IERC20Upgradeable[] memory outputTokens = new IERC20Upgradeable[](liquidators.length);\n for (uint256 i = 0; i < liquidators.length; i++) {\n strategies[i] = liquidators[i].strategy;\n inputTokens[i] = liquidators[i].inputToken;\n outputTokens[i] = liquidators[i].outputToken;\n }\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategies(strategies, inputTokens, outputTokens);\n vm.stopPrank();\n }\n\n function _fundMarketAndSelf(ICErc20 market, address whale) internal {\n IERC20Upgradeable token = IERC20Upgradeable(market.underlying());\n\n if (whale == address(0)) {\n whale = address(911);\n //vm.deal(address(token), whale, 100e18);\n }\n\n uint256 allTokens = token.balanceOf(whale);\n vm.prank(whale);\n token.transfer(address(this), allTokens / 20);\n\n if (market.getCash() < allTokens / 2) {\n _whitelistTestUser(whale);\n vm.startPrank(whale);\n token.approve(address(market), allTokens / 2);\n market.mint(allTokens / 2);\n vm.stopPrank();\n }\n }\n\n function _openLeveredPosition(\n address _positionOwner,\n uint256 _depositAmount\n ) internal returns (LeveredPosition _position, uint256 _maxRatio, uint256 _minRatio) {\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n collateralToken.transfer(_positionOwner, _depositAmount);\n\n vm.startPrank(_positionOwner);\n collateralToken.approve(address(factory), _depositAmount);\n _position = factory.createAndFundPosition(collateralMarket, stableMarket, collateralToken, _depositAmount);\n vm.stopPrank();\n\n _maxRatio = _position.getMaxLeverageRatio();\n emit log_named_uint(\"max ratio\", _maxRatio);\n _minRatio = _position.getMinLeverageRatio();\n emit log_named_uint(\"min ratio\", _minRatio);\n\n assertGt(_maxRatio, _minRatio, \"max ratio <= min ratio\");\n }\n\n function testOpenLeveredPosition() public virtual whenForking {\n assertApproxEqRel(position.getCurrentLeverageRatio(), 1e18, 4e16, \"initial leverage ratio should be 1.0 (1e18)\");\n }\n\n function testAnyLeverageRatio(uint64 ratioDiff) public debuggingOnly whenForking {\n // ratioDiff is between 0 and 2^64 ~= 18.446e18\n uint256 targetLeverageRatio = 1e18 + uint256(ratioDiff);\n emit log_named_uint(\"fuzz max ratio\", maxLevRatio);\n emit log_named_uint(\"fuzz min ratio\", minLevRatio);\n emit log_named_uint(\"target ratio\", targetLeverageRatio);\n vm.assume(targetLeverageRatio < maxLevRatio);\n vm.assume(minLevRatio < targetLeverageRatio);\n\n uint256 borrowedAssetPrice = stableMarket.comptroller().oracle().getUnderlyingPrice(stableMarket);\n (uint256 sd, uint256 bd) = position.getSupplyAmountDelta(targetLeverageRatio);\n emit log_named_uint(\"borrows delta val\", (bd * borrowedAssetPrice) / 1e18);\n emit log_named_uint(\"min borrow value\", ffd.getMinBorrowEth(stableMarket));\n\n uint256 equityAmount = position.getEquityAmount();\n emit log_named_uint(\"equity amount\", equityAmount);\n\n uint256 currentLeverageRatio = position.getCurrentLeverageRatio();\n emit log_named_uint(\"current ratio\", currentLeverageRatio);\n\n uint256 leverageRatioRealized = position.adjustLeverageRatio(targetLeverageRatio);\n emit log_named_uint(\"equity amount\", position.getEquityAmount());\n assertApproxEqRel(leverageRatioRealized, targetLeverageRatio, 4e16, \"target ratio not matching\");\n }\n\n function testMinMaxLeverageRatio() public whenForking {\n assertGt(maxLevRatio, minLevRatio, \"max ratio <= min ratio\");\n\n // attempting to adjust to minLevRatio - 0.01 should fail\n vm.expectRevert(abi.encodeWithSelector(LeveredPosition.BorrowStableFailed.selector, 0x3fa));\n position.adjustLeverageRatio((minLevRatio + 1e18) / 2);\n // just testing\n position.adjustLeverageRatio(maxLevRatio);\n // but adjusting to the minLevRatio + 0.01 should succeed\n position.adjustLeverageRatio(minLevRatio + 0.01e18);\n }\n\n function testMaxLeverageRatio() public whenForking {\n uint256 _equityAmount = position.getEquityAmount();\n uint256 rate = lens.getBorrowRateAtRatio(collateralMarket, stableMarket, _equityAmount, maxLevRatio);\n emit log_named_uint(\"borrow rate at max ratio\", rate);\n\n position.adjustLeverageRatio(maxLevRatio);\n assertApproxEqRel(position.getCurrentLeverageRatio(), maxLevRatio, 4e16, \"target max ratio not matching\");\n }\n\n function testRewardsAccruedClaimed() public whenForking {\n address[] memory flywheels = position.pool().getRewardsDistributors();\n if (flywheels.length > 0) {\n vm.warp(block.timestamp + 60 * 60 * 24);\n vm.roll(block.number + 10000);\n\n (ERC20[] memory rewardTokens, uint256[] memory amounts) = position.getAccruedRewards();\n\n ERC20 rewardToken;\n bool atLeastOneAccrued = false;\n for (uint256 i = 0; i < amounts.length; i++) {\n atLeastOneAccrued = amounts[i] > 0;\n if (atLeastOneAccrued) {\n rewardToken = rewardTokens[i];\n emit log_named_address(\"accrued from reward token\", address(rewardTokens[i]));\n break;\n }\n }\n\n assertEq(atLeastOneAccrued, true, \"!should have accrued at least one reward token\");\n\n if (atLeastOneAccrued) {\n uint256 rewardsBalanceBefore = rewardToken.balanceOf(address(this));\n position.claimRewards();\n uint256 rewardsBalanceAfter = rewardToken.balanceOf(address(this));\n assertGt(rewardsBalanceAfter - rewardsBalanceBefore, 0, \"should have claimed some rewards\");\n }\n } else {\n emit log(\"no flywheels/rewards for the pair pool\");\n }\n }\n\n function testLeverMaxDown() public whenForking {\n IERC20Upgradeable stableAsset = IERC20Upgradeable(stableMarket.underlying());\n IERC20Upgradeable collateralAsset = IERC20Upgradeable(collateralMarket.underlying());\n uint256 startingEquity = position.getEquityAmount();\n\n uint256 leverageRatioRealized = position.adjustLeverageRatio(maxLevRatio);\n assertApproxEqRel(leverageRatioRealized, maxLevRatio, 4e16, \"target ratio not matching\");\n\n // decrease the ratio in 10 equal steps\n uint256 ratioDiffStep = (maxLevRatio - 1e18) / 9;\n while (leverageRatioRealized > 1e18) {\n uint256 targetLeverDownRatio = leverageRatioRealized - ratioDiffStep;\n if (targetLeverDownRatio < minLevRatio) targetLeverDownRatio = 1e18;\n leverageRatioRealized = position.adjustLeverageRatio(targetLeverDownRatio);\n assertApproxEqRel(leverageRatioRealized, targetLeverDownRatio, 3e16, \"target lever down ratio not matching\");\n }\n\n uint256 withdrawAmount = position.closePosition();\n emit log_named_uint(\"withdraw amount\", withdrawAmount);\n assertApproxEqRel(startingEquity, withdrawAmount, 5e16, \"!withdraw amount\");\n\n assertEq(position.getEquityAmount(), 0, \"!nonzero equity amount\");\n assertEq(position.getCurrentLeverageRatio(), 0, \"!nonzero leverage ratio\");\n }\n}\n\ncontract WmaticMaticXLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 500e18;\n\n address wmaticMarket = 0xCb8D7c2690536d3444Da3d207f62A939483c8A93;\n address maticxMarket = 0x6ebdbEe1a509247B4A3ac3b73a43bd434C52C7c2;\n address wmaticWhale = 0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97;\n address maticxWhale = 0x72f0275444F2aF8dBf13F78D54A8D3aD7b6E68db;\n\n _configurePair(wmaticMarket, maticxMarket);\n _fundMarketAndSelf(ICErc20(wmaticMarket), wmaticWhale);\n _fundMarketAndSelf(ICErc20(maticxMarket), maticxWhale);\n\n // call amountOutAndSlippageOfSwap to cache the slippage\n {\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n IERC20Upgradeable stableToken = IERC20Upgradeable(stableMarket.underlying());\n\n vm.startPrank(wmaticWhale);\n collateralToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(collateralToken, 100e18, stableToken);\n vm.stopPrank();\n vm.startPrank(maticxWhale);\n stableToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(stableToken, 100e18, collateralToken);\n vm.stopPrank();\n\n emit log_named_uint(\"slippage coll->stable\", registry.getSlippage(collateralToken, stableToken));\n emit log_named_uint(\"slippage stable->coll\", registry.getSlippage(stableToken, collateralToken));\n }\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract StkBnbWBnbLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BSC_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 2e18;\n\n address stkBnbMarket = 0xAcfbf93d8fD1A9869bAb2328669dDba33296a421;\n address wbnbMarket = 0x3Af258d24EBdC03127ED6cEb8e58cA90835fbca5;\n address stkBnbWhale = 0x84b78452A97C5afDa1400943333F691448069A29; // algebra pool\n address wbnbWhale = 0x84b78452A97C5afDa1400943333F691448069A29; // algebra pool\n\n AlgebraSwapLiquidator liquidator = new AlgebraSwapLiquidator();\n _configurePairAndLiquidator(stkBnbMarket, wbnbMarket, liquidator);\n _fundMarketAndSelf(ICErc20(stkBnbMarket), stkBnbWhale);\n _fundMarketAndSelf(ICErc20(wbnbMarket), wbnbWhale);\n\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n collateralToken.transfer(address(this), depositAmount);\n collateralToken.approve(address(factory), depositAmount);\n position = factory.createAndFundPosition(collateralMarket, stableMarket, collateralToken, depositAmount);\n }\n}\n\ninterface TwoBrl {\n function minter() external view returns (address);\n\n function mint(address payable _to, uint256 _value) external returns (bool);\n}\n\ncontract Jbrl2BrlLeveredPositionTest is LeveredPositionTest {\n IonicComptroller pool;\n ComptrollerFirstExtension asExtension;\n\n function setUp() public fork(BSC_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1000e18;\n\n address twoBrlMarket = 0xf0a2852958aD041a9Fb35c312605482Ca3Ec17ba; // 2brl as collateral\n address jBrlMarket = 0x82A3103bc306293227B756f7554AfAeE82F8ab7a; // jbrl as borrowable\n address payable twoBrlWhale = payable(address(177)); // empty account\n address jBrlWhale = 0xA0695f78AF837F570bcc50f53e58Cda300798B65; // solidly pair BRZ-JBRL\n\n TwoBrl twoBrl = TwoBrl(ICErc20(twoBrlMarket).underlying());\n vm.prank(twoBrl.minter());\n twoBrl.mint(twoBrlWhale, depositAmount * 100);\n\n _configurePair(twoBrlMarket, jBrlMarket);\n _fundMarketAndSelf(ICErc20(twoBrlMarket), twoBrlWhale);\n _fundMarketAndSelf(ICErc20(jBrlMarket), jBrlWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract BombWbnbLeveredPositionTest is LeveredPositionTest {\n uint256 depositAmount = 100e18;\n address whale = 0xe7B7dF67C1fe053f1C6B965826d3bFF19603c482;\n address wbnbWhale = 0x57E30beb8054B248CE301FeabfD0c74677Fa40f0;\n uint256 ratioOnCreation = 1.0e18;\n uint256 minBorrowNative = 1e17;\n\n function setUp() public fork(BSC_CHAPEL) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n vm.mockCall(\n address(ffd),\n abi.encodeWithSelector(IFeeDistributor.minBorrowEth.selector),\n abi.encode(minBorrowNative)\n );\n\n address xMarket = 0x9B6E1039103812E0dcC1100a158e4a68014b2571; // BOMB\n address yMarket = 0x9dD00920f5B74A31177cbaB834AB0904703c31B1; // WBNB\n\n collateralMarket = ICErc20(xMarket);\n stableMarket = ICErc20(yMarket);\n\n //upgradePoolAndMarkets();\n\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n IERC20Upgradeable stableToken = IERC20Upgradeable(stableMarket.underlying());\n // call amountOutAndSlippageOfSwap to cache the slippage\n {\n vm.startPrank(whale);\n collateralToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(collateralToken, 1e18, stableToken);\n collateralToken.transfer(address(this), depositAmount);\n vm.stopPrank();\n\n vm.startPrank(wbnbWhale);\n stableToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(stableToken, 1e18, collateralToken);\n vm.stopPrank();\n }\n\n vm.prank(whale);\n collateralToken.transfer(address(this), depositAmount);\n\n collateralToken.approve(address(factory), depositAmount);\n position = factory.createAndFundPositionAtRatio(\n collateralMarket,\n stableMarket,\n collateralToken,\n depositAmount,\n ratioOnCreation\n );\n\n maxLevRatio = position.getMaxLeverageRatio();\n minLevRatio = position.getMinLeverageRatio();\n\n vm.label(address(position), \"Levered Position\");\n }\n}\n\ncontract PearlWUsdrWUsdrUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 0.000002e18;\n\n address lpTokenMarket = 0x06F61E22ef144f1cC4550D40ffbF681CB1C3aCAF;\n address wusdrMarket = 0x26EA46e975778662f98dAa0E7a12858dA9139262;\n address lpTokenWhale = 0x03Fa7A2628D63985bDFe07B95d4026663ED96065;\n address wUsdrWhale = 0x8711a1a52c34EDe8E61eF40496ab2618a8F6EA4B;\n\n _configurePair(lpTokenMarket, wusdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(wusdrMarket), wUsdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWUsdrUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 0.000002e18;\n\n address lpTokenMarket = 0x06F61E22ef144f1cC4550D40ffbF681CB1C3aCAF;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x03Fa7A2628D63985bDFe07B95d4026663ED96065;\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdcUsdcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 10e9;\n\n // LP token underlying 0xD17cb0f162f133e339C0BbFc18c36c357E681D6b\n address lpTokenMarket = 0x83DF24fE1B1eBF38048B91ffc4a8De0bAa88b891;\n address usdcMarket = 0x71A7037a42D0fB9F905a76B7D16846b2EACC59Aa;\n address lpTokenWhale = 0x97Bd59A8202F8263C2eC39cf6cF6B438D0B45876; // Thena Gauge\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrUsdcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 10e9;\n\n // LP token underlying 0xD17cb0f162f133e339C0BbFc18c36c357E681D6b\n address lpTokenMarket = 0x83DF24fE1B1eBF38048B91ffc4a8De0bAa88b891;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x97Bd59A8202F8263C2eC39cf6cF6B438D0B45876; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrDaiUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 2e18;\n\n // LP token underlying 0xBD02973b441Aa83c8EecEA158b98B5984bb1036E\n address lpTokenMarket = 0xBcE30B4D78cEb9a75A1Aa62156529c3592b3F08b;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x85Fa2331040933A02b154579fAbE6A6a5A765279; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrTngblUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.02e18;\n\n // LP token underlying 0x0Edc235693C20943780b76D79DD763236E94C751\n address lpTokenMarket = 0x2E870Aeee3D9d1eA29Ec93d2c0A99A4e0D5EB697;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0xdaeF32cA8D699015fcFB2884F6902fFCebE51c5b; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWbtcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.000000071325342755e18;\n\n // LP token underlying 0xb95E1C22dd965FafE926b2A793e9D6757b6613F4\n address lpTokenMarket = 0xffc8c8d747E52fAfbf973c64Bab10d38A6902c46;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x39976f6328ebA2a3C860b7DE5cF2c1bB41581FB8; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWethUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.004081e18;\n\n // LP token underlying 0x343D9a8D2Bc6A62390aEc764bb5b900C4B039127\n address lpTokenMarket = 0x343D9a8D2Bc6A62390aEc764bb5b900C4B039127;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x7D02A8b758791A03319102f81bF61E220F73e43D; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrMaticUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.05e18;\n\n // LP token underlying vAMM-WMATIC/USDR\n address lpTokenMarket = 0xfacEdA4f9731797102f040380aD5e234c92d1942;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0xdA0AfBeEEBef6dA2F060237D35cab759b99B13B6; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashAUsdcCashLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 300e18;\n\n // LP token underlying xCASH-USDC\n address lpTokenMarket = 0x1D2A7078a404ab970f951d5A6dbECD9e24838FB6;\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address lpTokenWhale = 0x35a499c15b4dDCf7e98628D415346B9795CCa80d;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n\n _configurePair(lpTokenMarket, cashMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroUsdcAUsdcCashLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 700e18;\n\n // LP token underlying xCASH-USDC\n address lpTokenMarket = 0x1D2A7078a404ab970f951d5A6dbECD9e24838FB6;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address lpTokenWhale = 0x35a499c15b4dDCf7e98628D415346B9795CCa80d;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroUsdcAUsdcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xUSDC-WETH05\n address lpTokenMarket = 0xC7cA03A0bE1dBAc350E5BfE5050fC5af6406490E;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashUsdcLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 300e18;\n\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(cashMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashAUsdcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xUSDC-WETH05\n address lpTokenMarket = 0xC7cA03A0bE1dBAc350E5BfE5050fC5af6406490E;\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n\n _configurePair(lpTokenMarket, cashMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroWethAWbtcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xWBTC-WETH05\n address lpTokenMarket = 0xCB1a06eff3459078c26516ae3a1dB44A61D2DbCA;\n address wethMarket = 0x2469B23354cb7cA50b798663Ec5812Bf28d15e9e;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\n\n _configurePair(lpTokenMarket, wethMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract DavosUsdcDusdLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 500e18;\n\n address dusdMarket = 0xE70d09dA78900A0429ee70b35200F70A30d7d2B9;\n address usdcMarket = 0x14787e50578d8c606C3d57bDbA53dD65Fd665449;\n address dusdWhale = 0xE69a1876bdACfa7A7a4F6D531BE2FDE843D2165C;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(dusdMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(dusdMarket), dusdWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWethUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e17;\n\n address wethMarket = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDCMarket = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n address wethWhale = 0x7380511493DD4c2f1dD75E9CCe5bD52C787D4B51;\n address USDCWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDCMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n _configurePair(wethMarket, USDCMarket);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n _fundMarketAndSelf(ICErc20(USDCMarket), USDCWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWethUSDTLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n address wethMarket = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDTMarket = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n address wethWhale = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDTWhale = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDTMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n\n _configurePair(wethMarket, USDTMarket);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n _fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWbtcUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e6;\n\n address wbtcMarket = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDCMarket = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n address wbtcWhale = 0x3f3429D28438Cc14133966820b8A9Ea61Cf1D4F0;\n address USDCWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDCMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n IERC20Upgradeable token = IERC20Upgradeable(ICErc20(wbtcMarket).underlying());\n\n _configurePair(wbtcMarket, USDCMarket);\n\n uint256 allTokens = token.balanceOf(wbtcWhale);\n\n vm.prank(wbtcWhale);\n token.transfer(address(this), allTokens);\n vm.stopPrank();\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWbtcUSDTLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e6;\n\n address wbtcMarket = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDTMarket = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n address wbtcWhale = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDTWhale = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDTMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n _configurePair(wbtcMarket, USDTMarket);\n _fundMarketAndSelf(ICErc20(wbtcMarket), wbtcWhale);\n _fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract HyUSDUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 20e18;\n\n address hyUsdMarket = 0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe;\n address usdcMarket = 0xa900A17a49Bc4D442bA7F72c39FA2108865671f0;\n address hyUsdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address usdcWhale = 0x70FF197c32E922700d3ff2483D250c645979855d;\n\n {\n IERC20Upgradeable x = IERC20Upgradeable(ICErc20(hyUsdMarket).underlying());\n IERC20Upgradeable y = IERC20Upgradeable(ICErc20(usdcMarket).underlying());\n IERC20Upgradeable[] memory xToYPath = new IERC20Upgradeable[](2);\n IERC20Upgradeable[] memory yToXPath = new IERC20Upgradeable[](2);\n\n IERC20Upgradeable eUSD = IERC20Upgradeable(0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4);\n xToYPath[0] = eUSD;\n yToXPath[0] = eUSD;\n xToYPath[1] = y;\n yToXPath[1] = x;\n\n vm.startPrank(registry.owner());\n registry._setOptimalSwapPath(IERC20Upgradeable(x), IERC20Upgradeable(y), xToYPath);\n registry._setOptimalSwapPath(IERC20Upgradeable(y), IERC20Upgradeable(x), yToXPath);\n vm.stopPrank();\n }\n\n // IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePair(hyUsdMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(hyUsdMarket), hyUsdWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract HyUSDeUSDLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 20e18;\n\n address hyUsdMarket = 0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe;\n address eUsdMarket = 0x9c2A4f9c5471fd36bE3BBd8437A33935107215A1;\n address hyUsdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address eUsdWhale = 0xa9E0588E82E9Ee1440f7e5375970a429D09646c1;\n AerodromeV2Liquidator aerodomeV2Liquidator = AerodromeV2Liquidator(0xD46b85409C43571145206B11D370A62AaeB22475);\n\n // IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePairAndLiquidator(hyUsdMarket, eUsdMarket, IRedemptionStrategy(address(aerodomeV2Liquidator)));\n _fundMarketAndSelf(ICErc20(hyUsdMarket), hyUsdWhale);\n _fundMarketAndSelf(ICErc20(eUsdMarket), eUsdWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract WSuperOETHWETHLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n address wsuperOeth = 0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6;\n address weth = 0x4200000000000000000000000000000000000006;\n\n uint256 depositAmount = 1e18;\n\n address wsuperOethMarket = 0xC462eb5587062e2f2391990b8609D2428d8Cf598;\n address wethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\n address wsuperOethWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address wethWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(wethMarket);\n\n uint256[] memory newSupplyCaps = new uint256[](1);\n newSupplyCaps[0] = 1e36;\n vm.prank(comptroller.admin());\n comptroller._setMarketSupplyCaps(cTokens, newSupplyCaps);\n\n AerodromeCLLiquidator aerodomeClLiquidator = new AerodromeCLLiquidator();\n vm.prank(registry.owner());\n registry._setWrappedToUnwrapped4626(address(wsuperOeth), address(0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3));\n // vm.prank(aerodomeClLiquidator.owner());\n // emit log_named_address(\"wsuperOeth\", address(wsuperOeth));\n // aerodomeClLiquidator.setWrappedToUnwrapped(\n // address(wsuperOeth),\n // 0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3\n // );\n _configurePairAndLiquidator(wsuperOethMarket, wethMarket, IRedemptionStrategy(address(aerodomeClLiquidator)));\n _fundMarketAndSelf(ICErc20(wsuperOethMarket), wsuperOethWhale);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\n/*\ncontract XYLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(X_CHAIN_ID) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n address xMarket = 0x...1;\n address yMarket = 0x...2;\n address xWhale = 0x...3;\n address yWhale = 0x...4;\n\n IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePairAndLiquidator(xMarket, yMarket, liquidator);\n _fundMarketAndSelf(ICErc20(xMarket), xWhale);\n _fundMarketAndSelf(ICErc20(yMarket), yWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n*/\n" + }, + "contracts/test/liquidators/CurveSwapLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\n\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract CurveSwapLiquidatorTest is BaseTest {\n CurveSwapLiquidatorFunder private csl;\n address private maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\n address private val3EPSAddress = 0x5b5bD8913D766D005859CE002533D4838B0Ebbb5;\n\n address private lpTokenMai3EPS = 0x80D00D2c8d920a9253c3D65BA901250a55011b37;\n address private poolAddress = 0x68354c6E8Bbd020F9dE81EAf57ea5424ba9ef322;\n\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\n\n function afterForkSetUp() internal override {\n csl = new CurveSwapLiquidatorFunder();\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\n\n if (address(curveV1Oracle) == address(0)) {\n address[][] memory _poolUnderlyings = new address[][](1);\n _poolUnderlyings[0] = asArray(maiAddress, val3EPSAddress);\n curveV1Oracle = new CurveLpTokenPriceOracleNoRegistry();\n curveV1Oracle.initialize(asArray(lpTokenMai3EPS), asArray(poolAddress), _poolUnderlyings);\n }\n }\n\n // Curve pools need to be configured in the CurveV1 or CurveV2 oracles\n // We have not deployed CurveV2 oracle yet\n function testSwapCurveV1UsdtUsdc() public debuggingOnly fork(ARBITRUM_ONE) {\n address usdtAddress = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;\n address usdcAddress = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\n address usdtWhale = 0xB38e8c17e38363aF6EbdCb3dAE12e0243582891D; // binance\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(usdtAddress);\n uint256 inputAmount = 150e6;\n\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, usdtAddress, usdcAddress, ap.getAddress(\"wtoken\"));\n\n vm.prank(usdtWhale);\n inputToken.transfer(address(csl), inputAmount);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\n\n assertEq(address(outputToken), usdcAddress, \"output token does not match\");\n assertApproxEqAbs(outputAmount, inputAmount, 1e5, \"output amount does not match\");\n }\n\n function testSwapCurveV2EspBnbxBnb() public fork(BSC_MAINNET) {\n address bnbxAddress = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\n address wbnb = ap.getAddress(\"wtoken\");\n address bnbxWhale = 0x4eE98B27eeF58844E460922eC9Da7C05D32F284A;\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(bnbxAddress);\n uint256 inputAmount = 3e18;\n\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, bnbxAddress, wbnb, wbnb);\n\n vm.prank(bnbxWhale);\n inputToken.transfer(address(csl), inputAmount);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\n\n assertEq(address(outputToken), wbnb, \"output token does not match\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"output amount does not match\");\n }\n\n function testRedeemMAI() public fork(BSC_MAINNET) {\n ICurvePool curvePool = ICurvePool(poolAddress);\n\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\n\n uint256 inputAmount = 1e10;\n\n uint256 maiForVal3EPS = curvePool.get_dy(0, 1, inputAmount);\n emit log_uint(maiForVal3EPS);\n\n dealMai(address(csl), inputAmount);\n\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\n (IERC20Upgradeable shouldBeVal3EPS, uint256 outputAmount) = csl.redeem(\n IERC20Upgradeable(maiAddress),\n inputAmount,\n data\n );\n assertEq(address(shouldBeVal3EPS), val3EPSAddress, \"output token does not match\");\n\n assertEq(maiForVal3EPS, outputAmount, \"output amount does not match\");\n }\n\n function testEstimateInputAmount() public fork(BSC_MAINNET) {\n ICurvePool curvePool = ICurvePool(poolAddress);\n\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\n\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\n\n (IERC20Upgradeable inputToken, uint256 inputAmount) = csl.estimateInputAmount(2e10, data);\n\n emit log(\"input\");\n emit log_uint(inputAmount);\n emit log_address(address(inputToken));\n uint256 shouldBeAround2e10 = curvePool.get_dy(1, 0, inputAmount);\n emit log(\"should be around 2e10\");\n emit log_uint(shouldBeAround2e10);\n assertTrue(shouldBeAround2e10 >= 20e9 && shouldBeAround2e10 <= 23e9, \"rough estimate didn't work\");\n }\n\n function dealMai(address to, uint256 amount) internal {\n address whale = 0xc412eCccaa35621cFCbAdA4ce203e3Ef78c4114a; // anyswap\n vm.prank(whale);\n IERC20Upgradeable(maiAddress).transfer(to, amount);\n }\n}\n" + }, + "contracts/test/liquidators/IonicLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\nimport { IonicLiquidator, ILiquidator } from \"../../IonicLiquidator.sol\";\nimport { IonicUniV3Liquidator } from \"../../IonicUniV3Liquidator.sol\";\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport \"../../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport { UpgradesBaseTest } from \"../UpgradesBaseTest.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { ProxyAdmin } from \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport { PoolLens } from \"../../PoolLens.sol\";\n\ncontract MockRedemptionStrategy is IRedemptionStrategy {\n function redeem(IERC20Upgradeable, uint256, bytes memory) external returns (IERC20Upgradeable, uint256) {\n return (IERC20Upgradeable(address(0)), 1);\n }\n\n function name() public pure returns (string memory) {\n return \"MockRedemptionStrategy\";\n }\n}\n\ncontract IonicLiquidatorTest is UpgradesBaseTest {\n ILiquidator liquidator;\n address uniswapRouter;\n address swapRouter;\n IUniswapV3Quoter quoter;\n address usdcWhale;\n address wethWhale;\n address poolAddress;\n address uniV3PooForFlash;\n uint256 usdcMarketIndex;\n uint256 wethMarketIndex;\n\n AuthoritiesRegistry authRegistry;\n ILiquidatorsRegistry liquidatorsRegistry;\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == BSC_MAINNET) {\n uniswapRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n } else if (block.chainid == POLYGON_MAINNET) {\n uniswapRouter = 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff;\n swapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n quoter = IUniswapV3Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD; // aave reserve\n wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\n poolAddress = 0x22A705DEC988410A959B8b17C8c23E33c121580b; // Retro stables pool\n uniV3PooForFlash = 0xA374094527e1673A86dE625aa59517c5dE346d32; // usdc-wmatic\n usdcMarketIndex = 3;\n wethMarketIndex = 5;\n } else if (block.chainid == MODE_MAINNET) {\n uniswapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\n // uniswapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\n // swapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\n swapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\n //quoter = IUniswapV3Quoter(0x7Fd569b2021850fbA53887dd07736010aCBFc787); // other sup quoter?\n quoter = IUniswapV3Quoter(0x5E6AEbab1AD525f5336Bd12E6847b851531F72ba); // sup quoter\n usdcWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79; // vault\n wethWhale = 0xF4C85269240C1D447309fA602A90ac23F1CB0Dc0;\n poolAddress = 0xFB3323E24743Caf4ADD0fDCCFB268565c0685556;\n //uniV3PooForFlash = 0x293f2B2c17f8cEa4db346D87Ef5712C9dd0491EF; // kim weth-usdc pool\n uniV3PooForFlash = 0x047CF4b081ee80d2928cb2ce3F3C4964e26eB0B9; // kim usdt-usdc pool\n // uniV3PooForFlash = 0xf2e9C024F1C0B7a2a4ea11243C2D86A7b38DD72f; // sup univ2 0x34a1E3Db82f669f8cF88135422AfD80e4f70701A\n usdcMarketIndex = 1;\n wethMarketIndex = 0;\n // weth 0x4200000000000000000000000000000000000006\n // usdc 0xd988097fb8612cc24eeC14542bC03424c656005f\n }\n\n // vm.prank(ap.owner());\n // ap.setAddress(\"IUniswapV2Router02\", uniswapRouter);\n vm.prank(ap.owner());\n ap.setAddress(\"UNISWAP_V3_ROUTER\", uniswapRouter);\n\n authRegistry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\n liquidatorsRegistry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\n liquidator = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(liquidatorsRegistry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function testBsc() public fork(BSC_MAINNET) {\n testUpgrade();\n }\n\n function testPolygon() public fork(POLYGON_MAINNET) {\n testUpgrade();\n }\n\n function testUpgrade() internal {\n // in case these slots start to get used, please redeploy the FSL\n // with a larger storage gap to protect the owner variable of OwnableUpgradeable\n // from being overwritten by the IonicLiquidator storage\n for (uint256 i = 40; i < 51; i++) {\n address atSloti = address(uint160(uint256(vm.load(address(liquidator), bytes32(i)))));\n assertEq(\n atSloti,\n address(0),\n \"replace the FSL proxy/storage contract with a new one before the owner variable is overwritten\"\n );\n }\n }\n\n function testSpecificLiquidation() public debuggingOnly fork(MODE_MAINNET) {\n address borrower = 0x5834a3AAFA83A53822B313994Bb554d8E8c215dF;\n address debtMarketAddr = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address collateralMarketAddr = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n liquidator = ILiquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars;\n vars.borrower = borrower;\n vars.cErc20 = ICErc20(debtMarketAddr);\n vars.cTokenCollateral = ICErc20(collateralMarketAddr);\n vars.repayAmount = 0x408c7a4d7c4092;\n vars.flashSwapContract = 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc;\n vars.minProfitAmount = 0;\n vars.redemptionStrategies = new IRedemptionStrategy[](1);\n vars.strategyData = new bytes[](1);\n vars.debtFundingStrategies = new IFundsConversionStrategy[](0);\n vars.debtFundingStrategiesData = new bytes[](0);\n\n vars.redemptionStrategies[0] = IFundsConversionStrategy(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\n vars.strategyData[\n 0\n ] = hex\"0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e8\";\n\n liquidator.safeLiquidateToTokensWithFlashLoan(vars);\n }\n\n function testWithdrawalLiquidator() public debuggingOnly fork(MODE_MAINNET) {\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.prank(0x4200000000000000000000000000000000000016);\n (bool success, ) = address(liquidatorV3).call{ value: 1 ether }(\"\");\n require(success, \"transfer of funds failed\");\n\n uint256 beforeBalance = liquidatorV3.owner().balance;\n\n vm.prank(liquidatorV3.owner());\n liquidatorV3.withdrawAll();\n\n emit log_named_uint(\"balance of liquidator\", liquidatorV3.owner().balance);\n\n assertEq(liquidatorV3.owner().balance, beforeBalance + 1 ether);\n assertEq(address(liquidatorV3).balance, 0);\n }\n\n function testLiquidateAfterUpgradeLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\n // upgrade IonicLiquidator\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidatorV3.setPoolLens(address(lens));\n liquidatorV3.setHealthFactorThreshold(1e18);\n vm.stopPrank();\n\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf before\", healthFactor);\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: 0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d,\n repayAmount: 1134537086250983,\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n minProfitAmount: 0,\n redemptionStrategies: new IRedemptionStrategy[](0),\n strategyData: new bytes[](0),\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n });\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf after\", healthFactorAfter);\n }\n\n function testLiquidateAfterUpgradeLiquidatorExpressRelay() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\n // upgrade IonicLiquidator\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n address expressRelay = makeAddr(\"expressRelay\");\n\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidatorV3.setPoolLens(address(lens));\n liquidatorV3.setHealthFactorThreshold(95e16);\n liquidatorV3.setExpressRelay(expressRelay);\n vm.stopPrank();\n\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf before\", healthFactor);\n\n address borrower = address(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: borrower,\n repayAmount: 1134537086250983,\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n minProfitAmount: 0,\n redemptionStrategies: new IRedemptionStrategy[](0),\n strategyData: new bytes[](0),\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n });\n\n vm.mockCall(\n expressRelay,\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(liquidatorV3),\n abi.encode(borrower)\n ),\n abi.encode(false)\n );\n vm.expectRevert(\"invalid liquidation\");\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n vm.mockCall(\n expressRelay,\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(liquidatorV3),\n abi.encode(borrower)\n ),\n abi.encode(true)\n );\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf after\", healthFactorAfter);\n }\n\n // TODO test with marginal shortfall for liquidation penalty errors\n function _testLiquidatorLiquidate(address contractForFlashSwap) internal {\n IonicComptroller pool = IonicComptroller(poolAddress);\n // _upgradePoolWithExtension(Unitroller(payable(poolAddress)));\n //upgradeRegistry();\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.prank(pool.admin());\n pool._setBorrowCapForCollateral(address(usdcMarket), address(wethMarket), 1e36);\n }\n\n {\n vm.prank(pool.admin());\n pool._borrowCapWhitelist(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038, address(this), true);\n }\n\n {\n vm.prank(wethWhale);\n weth.transfer(address(this), 0.1e18);\n\n weth.approve(address(wethMarket), 1e36);\n require(wethMarket.mint(0.1e18) == 0, \"mint weth failed\");\n pool.enterMarkets(asArray(address(usdcMarket), address(wethMarket)));\n }\n\n {\n vm.startPrank(usdcWhale);\n usdc.approve(address(usdcMarket), 2e36);\n require(usdcMarket.mint(70e6) == 0, \"mint usdc failed\");\n vm.stopPrank();\n }\n\n {\n require(usdcMarket.borrow(50e6) == 0, \"borrow usdc failed\");\n\n // the collateral prices change\n BasePriceOracle mpo = pool.oracle();\n uint256 priceCollateral = mpo.getUnderlyingPrice(wethMarket);\n vm.mockCall(\n address(mpo),\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, wethMarket),\n abi.encode(priceCollateral / 10)\n );\n }\n\n (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) = liquidatorsRegistry\n .getRedemptionStrategies(weth, usdc);\n\n uint256 seizedAmount = liquidator.safeLiquidateToTokensWithFlashLoan(\n ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: address(this),\n repayAmount: 10e6,\n cErc20: usdcMarket,\n cTokenCollateral: wethMarket,\n flashSwapContract: contractForFlashSwap,\n minProfitAmount: 6,\n redemptionStrategies: strategies,\n strategyData: strategiesData,\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n })\n );\n\n emit log_named_uint(\"seized amount\", seizedAmount);\n require(seizedAmount > 0, \"didn't seize any assets\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV3LiquidatorFunderTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { IonicLiquidator } from \"../../IonicLiquidator.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../../external/uniswap/IUniswapV2Factory.sol\";\nimport { IUniswapV3Factory } from \"../../external/uniswap/IUniswapV3Factory.sol\";\nimport { Quoter } from \"../../external/uniswap/quoter/Quoter.sol\";\nimport { IUniswapV3Pool } from \"../../external/uniswap/IUniswapV3Pool.sol\";\nimport { ISwapRouter } from \"../../external/uniswap/ISwapRouter.sol\";\nimport { IComptroller } from \"../../external/compound/IComptroller.sol\";\nimport { IUniswapV2Router02 } from \"../../external/uniswap/IUniswapV2Router02.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract UniswapV3LiquidatorFunderTest is BaseTest {\n UniswapV3LiquidatorFunder private uniswapv3Liquidator;\n\n IERC20Upgradeable parToken;\n IERC20Upgradeable usdcToken;\n address univ3SwapRouter;\n uint256 poolFee;\n Quoter quoter;\n MasterPriceOracle mpo;\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n if (block.chainid == POLYGON_MAINNET) {\n quoter = new Quoter(0x1F98431c8aD98523631AE4a59f267346ea31F984);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n parToken = IERC20Upgradeable(0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128); // PAR, 18 decimals\n usdcToken = IERC20Upgradeable(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174); // USDC, 6 decimals\n poolFee = 500;\n }\n uniswapv3Liquidator = new UniswapV3LiquidatorFunder();\n }\n\n function testUniV3ParUsdcRedeem() public fork(POLYGON_MAINNET) {\n uint256 parInputAmount = 10000e18;\n address parTokenWhale = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; // Balancer V2\n\n vm.prank(parTokenWhale);\n parToken.transfer(address(uniswapv3Liquidator), parInputAmount);\n\n bytes memory data = abi.encode(parToken, usdcToken, poolFee, ISwapRouter(univ3SwapRouter), quoter);\n (IERC20Upgradeable outputToken, uint256 outputAmount) = uniswapv3Liquidator.redeem(parToken, parInputAmount, data);\n\n uint256 inputValue = (parInputAmount * mpo.price(address(parToken))) / 1e18;\n uint256 outputValue = (outputAmount * mpo.price(address(usdcToken))) / 1e6;\n\n assertEq(address(outputToken), address(usdcToken), \"!out tok\");\n assertApproxEqRel(inputValue, outputValue, 1e16, \"!out amount\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV3LiquidatorTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IonicUniV3Liquidator, IUniswapV3Pool, ILiquidator } from \"../../IonicUniV3Liquidator.sol\";\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IUniswapV2Router02 } from \"../../external/uniswap/IUniswapV2Router02.sol\";\nimport { IUniswapV3Factory } from \"../../external/uniswap/IUniswapV3Factory.sol\";\nimport { UniswapV2LiquidatorFunder } from \"../../liquidators/UniswapV2LiquidatorFunder.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { KimUniV2Liquidator } from \"../../liquidators/KimUniV2Liquidator.sol\";\n\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport \"./IonicLiquidatorTest.sol\";\n\ncontract UniswapV3LiquidatorTest is IonicLiquidatorTest {\n function testPolygonUniV3LiquidatorLiquidate() public fork(POLYGON_MAINNET) {\n IonicUniV3Liquidator _liquidator = new IonicUniV3Liquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), address(quoter));\n liquidator = _liquidator;\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testModeUniV3LiquidatorLiquidate() public debuggingOnly fork(MODE_MAINNET) {\n IonicUniV3Liquidator _liquidator = new IonicUniV3Liquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), address(quoter));\n liquidator = _liquidator;\n\n IonicComptroller pool = IonicComptroller(poolAddress);\n {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.startPrank(liquidatorsRegistry.owner());\n IRedemptionStrategy strategy = new UniswapV3LiquidatorFunder();\n liquidatorsRegistry._setRedemptionStrategy(strategy, weth, usdc);\n vm.stopPrank();\n vm.prank(OwnableUpgradeable(address(liquidator)).owner());\n liquidator._whitelistRedemptionStrategy(strategy, true);\n }\n }\n\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testModeKimUniV2Liquidator() public fork(MODE_MAINNET) {\n IonicLiquidator _liquidator = new IonicLiquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), ap.getAddress(\"IUniswapV2Router02\"), 30);\n liquidator = _liquidator;\n liquidator.setPoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n liquidator.setHealthFactorThreshold(1e18);\n\n IonicComptroller pool = IonicComptroller(poolAddress);\n {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.startPrank(liquidatorsRegistry.owner());\n IRedemptionStrategy strategy = KimUniV2Liquidator(0x6aC17D406a820fa464fFdc0940FCa7E60b3b36B7);\n liquidatorsRegistry._setRedemptionStrategy(strategy, weth, usdc);\n vm.stopPrank();\n liquidator._whitelistRedemptionStrategy(strategy, true);\n }\n }\n\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testUniV3PoolForFee() public debuggingOnly fork(MODE_MAINNET) {\n address wethAddr = 0x4200000000000000000000000000000000000006;\n address usdcAddr = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcAddr);\n IERC20Upgradeable weth = IERC20Upgradeable(wethAddr);\n\n IUniswapV2Router02 kimRouter = IUniswapV2Router02(0x5D61c537393cf21893BE619E36fC94cd73C77DD3);\n address factoryAddress;\n //factory = kimRouter.factory();\n factoryAddress = 0xC33Ce0058004d44E7e1F366E5797A578fDF38584;\n IUniswapV3Factory factory = IUniswapV3Factory(factoryAddress);\n address pool;\n\n uint256 feeConfig = liquidatorsRegistry.uniswapV3Fees(usdc, weth);\n emit log_named_uint(\"feeConfig\", feeConfig);\n\n if (feeConfig == 0) {\n pool = factory.getPool(wethAddr, usdcAddr, uint24(feeConfig));\n emit log_named_address(\"Pool at fee 0\", pool);\n }\n\n pool = factory.getPool(wethAddr, usdcAddr, 500);\n emit log_named_address(\"Pool at fee 500\", pool);\n }\n}\n" + }, + "contracts/test/LiquidatorsRegistryTest.t.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { LiquidatorsRegistry } from \"../liquidators/registry/LiquidatorsRegistry.sol\";\nimport { LiquidatorsRegistryExtension } from \"../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport \"../ionic/DiamondExtension.sol\";\nimport { SafeOwnable } from \"../ionic/SafeOwnable.sol\";\n\ncontract LiquidatorsRegistryTest is BaseTest {\n ILiquidatorsRegistry registry;\n\n // all-chains\n IERC20Upgradeable stable;\n IERC20Upgradeable wtoken;\n MasterPriceOracle mpo;\n\n // chapel\n IERC20Upgradeable chapelBomb = IERC20Upgradeable(0xe45589fBad3A1FB90F5b2A8A3E8958a8BAB5f768);\n IERC20Upgradeable chapelTUsd = IERC20Upgradeable(0x4f1885D25eF219D3D4Fa064809D6D4985FAb9A0b);\n IERC20Upgradeable chapelTDai = IERC20Upgradeable(0x8870f7102F1DcB1c35b01af10f1baF1B00aD6805);\n\n // bsc\n IERC20Upgradeable wbnbBusdLpToken = IERC20Upgradeable(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16);\n IERC20Upgradeable usdcBusdCakeLpToken = IERC20Upgradeable(0x2354ef4DF11afacb85a5C7f98B624072ECcddbB1);\n IERC20Upgradeable ankrAnkrBnbGammaLpToken = IERC20Upgradeable(0x3f8f3caefF393B1994a9968E835Fd38eCba6C1be);\n\n // polygon\n IERC20Upgradeable usdr3CrvCurveLpToken = IERC20Upgradeable(0xa138341185a9D0429B0021A11FB717B225e13e1F);\n IERC20Upgradeable maticxBbaBalancerStableLpToken = IERC20Upgradeable(0xb20fC01D21A50d2C734C4a1262B4404d41fA7BF0);\n IERC20Upgradeable stMaticBbaBalancerStableLpToken = IERC20Upgradeable(0x216690738Aac4aa0C4770253CA26a28f0115c595);\n IERC20Upgradeable mimoParBalancerWeightedLpToken = IERC20Upgradeable(0x82d7f08026e21c7713CfAd1071df7C8271B17Eae);\n\n function afterForkSetUp() internal override {\n registry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\n stable = IERC20Upgradeable(ap.getAddress(\"stableToken\"));\n wtoken = IERC20Upgradeable(ap.getAddress(\"wtoken\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testResetStrategies() public debuggingOnly fork(BSC_CHAPEL) {\n upgradeRegistry();\n\n IRedemptionStrategy[] memory strategiesConfig = new IRedemptionStrategy[](3);\n IERC20Upgradeable[] memory inputTokensConfig = new IERC20Upgradeable[](3);\n IERC20Upgradeable[] memory outputTokensConfig = new IERC20Upgradeable[](3);\n {\n strategiesConfig[0] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[1] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[2] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n inputTokensConfig[0] = IERC20Upgradeable(chapelBomb);\n inputTokensConfig[1] = IERC20Upgradeable(chapelTUsd);\n inputTokensConfig[2] = IERC20Upgradeable(chapelTDai);\n outputTokensConfig[0] = IERC20Upgradeable(chapelTUsd);\n outputTokensConfig[1] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[2] = IERC20Upgradeable(chapelBomb);\n }\n\n bool matchingBefore = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingBefore, false, \"should not match prior\");\n\n vm.prank(ap.getAddress(\"deployer\"));\n registry._resetRedemptionStrategies(strategiesConfig, inputTokensConfig, outputTokensConfig);\n\n bool matchingAfter = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingAfter, true, \"should match after\");\n }\n\n function testResetDuplicatingStrategies() public debuggingOnly fork(BSC_CHAPEL) {\n upgradeRegistry();\n\n IRedemptionStrategy[] memory strategiesConfig = new IRedemptionStrategy[](4);\n IERC20Upgradeable[] memory inputTokensConfig = new IERC20Upgradeable[](4);\n IERC20Upgradeable[] memory outputTokensConfig = new IERC20Upgradeable[](4);\n {\n strategiesConfig[0] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[1] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[2] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[3] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n inputTokensConfig[0] = IERC20Upgradeable(chapelBomb);\n inputTokensConfig[1] = IERC20Upgradeable(chapelTUsd);\n inputTokensConfig[2] = IERC20Upgradeable(chapelTDai);\n inputTokensConfig[3] = IERC20Upgradeable(chapelTDai);\n outputTokensConfig[0] = IERC20Upgradeable(chapelTUsd);\n outputTokensConfig[1] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[2] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[3] = IERC20Upgradeable(chapelBomb);\n }\n\n bool matchingBefore = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingBefore, false, \"should not match prior\");\n\n vm.prank(ap.getAddress(\"deployer\"));\n registry._resetRedemptionStrategies(strategiesConfig, inputTokensConfig, outputTokensConfig);\n\n bool matchingAfter = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingAfter, true, \"should match after\");\n }\n\n function testRedemptionPathChapel() public debuggingOnly fork(BSC_CHAPEL) {\n emit log(\"bomb tusd\");\n emit log(registry.redemptionStrategiesByTokens(chapelBomb, chapelTDai).name());\n emit log(\"tusd bomb\");\n emit log(registry.redemptionStrategiesByTokens(chapelTDai, chapelBomb).name());\n\n (IRedemptionStrategy strategy, bytes memory strategyData) = registry.getRedemptionStrategy(chapelBomb, chapelTDai);\n }\n\n function testInputTokensChapel() public debuggingOnly fork(BSC_CHAPEL) {\n address[] memory inputTokens = registry.getInputTokensByOutputToken(chapelBomb);\n\n emit log_named_array(\"inputs\", inputTokens);\n }\n\n function testInputTokensBsc() public debuggingOnly fork(BSC_MAINNET) {\n address[] memory inputTokens = registry.getInputTokensByOutputToken(stable);\n\n emit log_named_array(\"inputs\", inputTokens);\n }\n\n function _swap(\n address whale,\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken,\n uint256 tolerance\n ) internal {\n vm.startPrank(whale);\n inputToken.approve(address(registry), inputAmount);\n (uint256 swappedAmountOut, uint256 slippage) = registry.amountOutAndSlippageOfSwap(\n inputToken,\n inputAmount,\n outputToken\n );\n vm.stopPrank();\n\n emit log_named_uint(\"received\", swappedAmountOut);\n assertLt(slippage, tolerance, \"slippage too high\");\n }\n\n function testSwappingUniLpBsc() public fork(BSC_MAINNET) {\n address lpTokenWhale = 0x14B2e8329b8e06BCD524eb114E23fAbD21910109;\n\n IERC20Upgradeable inputToken = usdcBusdCakeLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = stable;\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingGammaLpBsc() public fork(BSC_MAINNET) {\n address lpTokenWhale = 0xd44ad81474d075c3Bf0307830977A5804BfC0bc7; // thena gauge\n\n IERC20Upgradeable inputToken = ankrAnkrBnbGammaLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = wtoken;\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingBalancerStableLpPolygon() public fork(POLYGON_MAINNET) {\n // TODO: run deployment to fix the liquidation path and set the balancer liquidator data\n address lpTokenWhale = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; // balancer gauge\n\n // maticx-wmatic aave boosted\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = wtoken;\n\n _swap(lpTokenWhale, maticxBbaBalancerStableLpToken, inputAmount, outputToken, 1e16);\n\n // stmatic-wmatic aave boosted\n _swap(lpTokenWhale, stMaticBbaBalancerStableLpToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingBalancerWeightedLpPolygon() public fork(POLYGON_MAINNET) {\n address lpTokenWhale = 0xbB60ADbe38B4e6ab7fb0f9546C2C1b665B86af11; // mimo staker\n\n IERC20Upgradeable inputToken = mimoParBalancerWeightedLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = IERC20Upgradeable(0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128); // PAR\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n\n address tusdWhale = 0x161FbE0943Af4A39a50262026A81a243B635982d; // old XBombSwap\n address tdaiWhale = 0xd816eb4660615BBF080ddf425F28ea4AF30d04D5; // old XBombSwap\n address bombWhale = 0xd816eb4660615BBF080ddf425F28ea4AF30d04D5; // old XBombSwap\n\n function testSwappingBombTDaiChapel() public debuggingOnly fork(BSC_CHAPEL) {\n IERC20Upgradeable inputToken = chapelBomb;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = chapelTDai;\n\n _swap(bombWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n\n function testSwappingTUsdBombChapel() public debuggingOnly fork(BSC_CHAPEL) {\n IERC20Upgradeable inputToken = chapelTUsd;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = chapelBomb;\n\n _swap(tusdWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n}\n" + }, + "contracts/test/LiquidityMining.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Vm.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { FlywheelStaticRewards } from \"../ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol\";\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AuthoritiesRegistry } from \"../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\n\nimport { MockPriceOracle } from \"../oracles/1337/MockPriceOracle.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { IonicFlywheelLensRouter } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract LiquidityMiningTest is BaseTest {\n MockERC20 underlyingToken;\n MockERC20 rewardToken;\n\n JumpRateModel interestModel;\n IonicComptroller comptroller;\n CErc20Delegate cErc20Delegate;\n ICErc20 cErc20;\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicFlywheel flywheel;\n FlywheelStaticRewards rewards;\n IonicFlywheelLensRouter flywheelClaimer;\n\n address user = address(1337);\n\n uint8 baseDecimal;\n uint8 rewardDecimal;\n\n address[] markets;\n IonicFlywheelCore[] flywheelsToClaim;\n\n function setUpBaseContracts(uint8 _baseDecimal, uint8 _rewardDecimal) public {\n baseDecimal = _baseDecimal;\n rewardDecimal = _rewardDecimal;\n underlyingToken = new MockERC20(\"UnderlyingToken\", \"UT\", baseDecimal);\n rewardToken = new MockERC20(\"RewardToken\", \"RT\", rewardDecimal);\n interestModel = new JumpRateModel(2343665, 1 * 10**baseDecimal, 1 * 10**baseDecimal, 4 * 10**baseDecimal, 0.8e18);\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1 * 10**(baseDecimal - 2));\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n cErc20Delegate = new CErc20Delegate();\n // set the new delegate as the latest\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), abi.encode(address(0)));\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n cErc20DelegateExtensions[1] = cErc20Delegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n }\n\n function setUpPoolAndMarket() public {\n MockPriceOracle priceOracle = new MockPriceOracle(10);\n Comptroller tempComptroller = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))),\n false,\n 0.1e18,\n 1.1e18,\n address(priceOracle)\n );\n\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, user, poolAuth.BORROWER_ROLE(), true);\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"CUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n cErc20 = allMarkets[allMarkets.length - 1];\n }\n\n function setUpFlywheel() public {\n IonicFlywheel impl = new IonicFlywheel();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(dpa), \"\");\n flywheel = IonicFlywheel(address(proxy));\n flywheel.initialize(rewardToken, FlywheelStaticRewards(address(0)), IFlywheelBooster(address(0)), address(this));\n rewards = new FlywheelStaticRewards(IonicFlywheelCore(address(flywheel)), address(this), Authority(address(0)));\n flywheel.setFlywheelRewards(rewards);\n\n flywheelClaimer = new IonicFlywheelLensRouter(poolDirectory);\n\n flywheel.addStrategyForRewards(ERC20(address(cErc20)));\n\n // add flywheel as rewardsDistributor to call flywheelPreBorrowAction / flywheelPreSupplyAction\n require(comptroller._addRewardsDistributor(address(flywheel)) == 0);\n\n // seed rewards to flywheel\n rewardToken.mint(address(rewards), 100 * 10**rewardDecimal);\n\n // Start reward distribution at 1 token per second\n rewards.setRewardsInfo(\n ERC20(address(cErc20)),\n FlywheelStaticRewards.RewardsInfo({ rewardsPerSecond: uint224(1 * 10**rewardDecimal), rewardsEndTimestamp: 0 })\n );\n\n // preparation for a later call\n flywheelsToClaim.push(IonicFlywheelCore(address(flywheel)));\n }\n\n function _initialize(uint8 _baseDecimal, uint8 _rewardDecimal) internal {\n setUpBaseContracts(_baseDecimal, _rewardDecimal);\n setUpPoolAndMarket();\n setUpFlywheel();\n deposit(1 * 10**_baseDecimal);\n vm.warp(block.timestamp + 1);\n }\n\n function deposit(uint256 _amount) public {\n underlyingToken.mint(user, _amount);\n vm.startPrank(user);\n underlyingToken.approve(address(cErc20), _amount);\n comptroller.enterMarkets(markets);\n cErc20.mint(_amount);\n vm.stopPrank();\n }\n\n function _testIntegration() internal {\n uint256 percentFee = flywheel.performanceFee();\n uint224 percent100 = 100e16; //flywheel.ONE();\n\n // store expected rewards per token (1 token per second over total supply)\n uint256 rewardsPerTokenPlusFee = (1 * 10**rewardDecimal * 1 * 10**baseDecimal) / cErc20.totalSupply();\n uint256 rewardsPerTokenForFee = (rewardsPerTokenPlusFee * percentFee) / percent100;\n uint256 rewardsPerToken = rewardsPerTokenPlusFee - rewardsPerTokenForFee;\n\n // store expected user rewards (user balance times reward per second over 1 token)\n uint256 userRewards = (rewardsPerToken * cErc20.balanceOf(user)) / (1 * 10**baseDecimal);\n\n ERC20 asErc20 = ERC20(address(cErc20));\n // accrue rewards and check against expected\n assertEq(flywheel.accrue(asErc20, user), userRewards, \"!accrue amount\");\n\n // check market index\n (uint224 index, ) = flywheel.strategyState(asErc20);\n assertEq(index, 10**rewardDecimal + rewardsPerToken, \"!index\");\n\n // claim and check user balance\n flywheelClaimer.claimRewardsForMarket(user, asErc20, flywheelsToClaim, asArray(true));\n assertEq(rewardToken.balanceOf(user), userRewards, \"!user rewards\");\n\n // mint more tokens by user and rerun test\n deposit(1 * 10**baseDecimal);\n\n // for next test, advance 10 seconds instead of 1 (multiply expectations by 10)\n vm.warp(block.timestamp + 10);\n\n uint256 rewardsPerToken2PlusFee = (1 * 10**rewardDecimal * 1 * 10**baseDecimal) / cErc20.totalSupply();\n uint256 rewardsPerToken2ForFee = (rewardsPerToken2PlusFee * percentFee) / percent100;\n uint256 rewardsPerToken2 = rewardsPerToken2PlusFee - rewardsPerToken2ForFee;\n\n uint256 userRewards2 = (10 * (rewardsPerToken2 * cErc20.balanceOf(user))) / (1 * 10**baseDecimal);\n\n // accrue all unclaimed rewards and claim them\n flywheelClaimer.claimRewardsForMarket(user, asErc20, flywheelsToClaim, asArray(true));\n\n emit log_named_uint(\"userRewards\", userRewards);\n emit log_named_uint(\"userRewards2\", userRewards2);\n // user balance should accumulate from both rewards\n assertEq(rewardToken.balanceOf(user), userRewards + userRewards2, \"balance mismatch\");\n }\n\n function testIntegrationRewardStandard(uint8 i, uint8 j) public {\n vm.assume(i > 1);\n vm.assume(j > 1);\n vm.assume(i < 19);\n vm.assume(j < 19);\n\n _initialize(i, j);\n _testIntegration();\n }\n}\n" + }, + "contracts/test/MaxBorrowTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./helpers/WithPool.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract MockAsset is MockERC20 {\n constructor() MockERC20(\"test\", \"test\", 8) {}\n\n function deposit() external payable {}\n}\n\ncontract MaxBorrowTest is WithPool {\n address usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD;\n address daiWhale = 0x06959153B974D0D5fDfd87D561db6d8d4FA0bb0B;\n\n struct LiquidationData {\n address[] cTokens;\n ICErc20[] allMarkets;\n MockAsset usdc;\n MockAsset dai;\n }\n\n function afterForkSetUp() internal override {\n super.setUpWithPool(\n MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")),\n ERC20Upgradeable(ap.getAddress(\"wtoken\"))\n );\n\n if (block.chainid == POLYGON_MAINNET) {\n vm.prank(0x369582d2010B6eD950B571F4101e3bB9b554876F); // SAND/WMATIC\n MockERC20(address(underlyingToken)).transfer(address(this), 100e18);\n setUpPool(\"polygon-test\", false, 0.1e18, 1.1e18);\n } else if (block.chainid == BSC_MAINNET) {\n deal(address(underlyingToken), address(this), 100e18);\n setUpPool(\"bsc-test\", false, 0.1e18, 1.1e18);\n }\n }\n\n // TODO redeploy to polygon to fix\n function testMaxBorrow() public fork(POLYGON_MAINNET) {\n PoolLensSecondary poolLensSecondary = new PoolLensSecondary();\n poolLensSecondary.initialize(poolDirectory);\n\n LiquidationData memory vars;\n vm.roll(1);\n vars.usdc = MockAsset(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n vars.dai = MockAsset(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063);\n\n deployCErc20Delegate(address(vars.usdc), \"USDC\", \"usdc\", 0.9e18);\n deployCErc20Delegate(address(vars.dai), \"DAI\", \"dai\", 0.9e18);\n\n vars.allMarkets = comptroller.getAllMarkets();\n\n CErc20Delegate cToken = CErc20Delegate(address(vars.allMarkets[0]));\n\n CErc20Delegate cDaiToken = CErc20Delegate(address(vars.allMarkets[1]));\n\n vars.cTokens = new address[](1);\n\n address accountOne = address(1);\n PoolRolesAuthority pra = ionicAdmin.authoritiesRegistry().poolsAuthorities(address(comptroller));\n\n vm.startPrank(pra.owner());\n pra.setUserRole(accountOne, pra.BORROWER_ROLE(), true);\n vm.stopPrank();\n\n vm.prank(usdcWhale);\n MockERC20(address(vars.usdc)).transfer(accountOne, 10000e6);\n\n vm.prank(daiWhale);\n MockERC20(address(vars.dai)).transfer(accountOne, 10000e18);\n\n // Account One Supply\n {\n emit log(\"Account One Supply\");\n vm.startPrank(accountOne);\n vars.usdc.approve(address(cToken), 1e36);\n cToken.mint(1e6);\n vars.cTokens[0] = address(cToken);\n comptroller.enterMarkets(vars.cTokens);\n\n vars.dai.approve(address(cDaiToken), 1e36);\n cDaiToken.mint(1e18);\n vars.cTokens[0] = address(cDaiToken);\n comptroller.enterMarkets(vars.cTokens);\n\n vm.stopPrank();\n assertEq(cToken.totalSupply(), 1e6 * 5);\n assertEq(cDaiToken.totalSupply(), 1e18 * 5);\n\n uint256 maxBorrow = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n uint256 maxDaiBorrow = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cDaiToken)));\n assertApproxEqAbs((maxBorrow * 1e18) / 10**cToken.decimals(), maxDaiBorrow, uint256(1e16), \"!max borrow\");\n }\n\n // borrow cap for collateral test\n {\n vm.prank(comptroller.admin());\n comptroller._setBorrowCapForCollateral(address(cToken), address(cDaiToken), 0.5e6);\n }\n\n uint256 maxBorrowAfterBorrowCap = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n assertApproxEqAbs(maxBorrowAfterBorrowCap, 0.5e6, uint256(1e5), \"!max borrow\");\n\n // blacklist\n {\n vm.prank(comptroller.admin());\n comptroller._blacklistBorrowingAgainstCollateral(address(cToken), address(cDaiToken), true);\n }\n\n uint256 maxBorrowAfterBlacklist = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n assertEq(maxBorrowAfterBlacklist, 0, \"!blacklist\");\n }\n\n // TODO test with the latest block and contracts and/or without the FSL\n function testBorrowCapPerCollateral() public debuggingOnly forkAtBlock(BSC_MAINNET, 23761190) {\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\n\n address poolAddress = jFiatPoolAddress;\n Comptroller pool = Comptroller(poolAddress);\n\n ComptrollerFirstExtension asExtension = ComptrollerFirstExtension(poolAddress);\n address[] memory borrowers = asExtension.getAllBorrowers();\n address someBorrower = borrowers[1];\n\n ICErc20[] memory markets = asExtension.getAllMarkets();\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = markets[i];\n uint256 borrowed = market.borrowBalanceCurrent(someBorrower);\n if (borrowed > 0) {\n emit log(\"borrower has borrowed\");\n emit log_uint(borrowed);\n emit log(\"from market\");\n emit log_address(address(market));\n emit log_uint(i);\n emit log(\"\");\n }\n\n uint256 collateral = market.balanceOf(someBorrower);\n if (collateral > 0) {\n emit log(\"has collateral\");\n emit log_uint(collateral);\n emit log(\"in market\");\n emit log_address(address(market));\n emit log_uint(i);\n emit log(\"\");\n }\n }\n\n ICErc20 marketToBorrow = markets[0];\n ICErc20 cappedCollateralMarket = markets[6];\n uint256 borrowAmount = marketToBorrow.borrowBalanceCurrent(someBorrower);\n\n {\n (uint256 errBefore, , uint256 liquidityBefore, uint256 shortfallBefore) = pool.getHypotheticalAccountLiquidity(\n someBorrower,\n address(marketToBorrow),\n 0,\n borrowAmount,\n 0\n );\n emit log(\"errBefore\");\n emit log_uint(errBefore);\n emit log(\"liquidityBefore\");\n emit log_uint(liquidityBefore);\n emit log(\"shortfallBefore\");\n emit log_uint(shortfallBefore);\n\n assertGt(liquidityBefore, 0, \"expected positive liquidity\");\n }\n\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateral(address(marketToBorrow), address(cappedCollateralMarket), 1);\n emit log(\"\");\n\n (uint256 errAfter, , uint256 liquidityAfter, uint256 shortfallAfter) = pool.getHypotheticalAccountLiquidity(\n someBorrower,\n address(marketToBorrow),\n 0,\n borrowAmount,\n 0\n );\n emit log(\"errAfter\");\n emit log_uint(errAfter);\n emit log(\"liquidityAfter\");\n emit log_uint(liquidityAfter);\n emit log(\"shortfallAfter\");\n emit log_uint(shortfallAfter);\n\n assertGt(shortfallAfter, 0, \"expected some shortfall\");\n }\n}\n" + }, + "contracts/test/MinBorrowTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract MinBorrowTest is BaseTest {\n FeeDistributor ffd;\n\n function afterForkSetUp() internal override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n }\n\n function testMinBorrow() public fork(BSC_MAINNET) {\n IERC20Upgradeable usdc = IERC20Upgradeable(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20Upgradeable busd = IERC20Upgradeable(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n ICErc20 usdcMarket = ICErc20(0x16B8da195CdC7F380B333bf6cF2f0f33c1061755);\n ICErc20 busdMarket = ICErc20(0x3BCb7dbBe729B24bE6c660B3e8ADD1Cb352e371D);\n IonicComptroller comptroller = usdcMarket.comptroller();\n deal(address(usdc), address(this), 10000e18);\n deal(address(busd), address(1), 10000e18);\n\n usdc.approve(address(usdcMarket), 1e36);\n usdcMarket.mint(1000e18);\n\n vm.startPrank(address(1));\n busd.approve(address(busdMarket), 1e36);\n busdMarket.mint(1000e18);\n vm.stopPrank();\n\n // the 0 liquidity base min borrow amount\n uint256 baseMinBorrowEth = ffd.minBorrowEth();\n\n address[] memory cTokens = new address[](2);\n cTokens[0] = address(usdcMarket);\n cTokens[1] = address(busdMarket);\n comptroller.enterMarkets(cTokens);\n\n uint256 minBorrowEth = ffd.getMinBorrowEth(busdMarket);\n assertEq(minBorrowEth, baseMinBorrowEth, \"!minBorrowEth for default min borrow eth\");\n\n busdMarket.borrow(300e18);\n\n minBorrowEth = ffd.getMinBorrowEth(busdMarket);\n assertEq(minBorrowEth, 0, \"!minBorrowEth after borrowing less amount than min amount\");\n }\n}\n" + }, + "contracts/test/OracleProtectedTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\ncontract MockOraclePasses is IHypernativeOracle {\n function register(address account, bool isStrictMode) external pure {}\n\n function validateForbiddenAccountInteraction(address sender) external pure {}\n\n function validateForbiddenContextInteraction(address origin, address sender) external pure {}\n\n function validateBlacklistedAccountInteraction(address sender) external pure {}\n}\n\ncontract MockOracleFails is IHypernativeOracle {\n error InteractionNotAllowed();\n function register(address account, bool isStrictMode) external pure {}\n\n function validateForbiddenAccountInteraction(address sender) external pure {\n revert InteractionNotAllowed();\n }\n\n function validateForbiddenContextInteraction(address origin, address sender) external pure {\n revert InteractionNotAllowed(); \n }\n\n function validateBlacklistedAccountInteraction(address sender) external pure {\n revert InteractionNotAllowed();\n }\n}\n\ncontract OracleProtectedTest is UpgradesBaseTest {\n error InteractionNotAllowed();\n ICErc20 market = ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3);\n address admin = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n IHypernativeOracle oraclePasses;\n IHypernativeOracle oracleFails;\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n _upgradeMarketWithExtension(market);\n oraclePasses = new MockOraclePasses();\n oracleFails = new MockOracleFails();\n }\n\n function test_mint_failsForBlacklisted() public debuggingOnly forkAtBlock(BASE_MAINNET, 20538729) {\n CTokenFirstExtension asExt = CTokenFirstExtension(address(market)); \n // Set up the oracle\n vm.startPrank(admin);\n ap.setAddress(\"HYPERNATIVE_ORACLE\", address(oracleFails));\n vm.stopPrank();\n \n // Try to mint\n address user = address(0x1234);\n uint256 mintAmount = 1e18;\n deal(asExt.underlying(), user, mintAmount);\n \n vm.startPrank(user);\n ICErc20(asExt.underlying()).approve(address(asExt), mintAmount);\n \n vm.expectRevert(InteractionNotAllowed.selector);\n market.mint(mintAmount);\n vm.stopPrank();\n\n // Set up the oracle to pass\n vm.prank(admin);\n ap.setAddress(\"HYPERNATIVE_ORACLE\", address(oraclePasses));\n\n vm.startPrank(user);\n market.mint(mintAmount);\n vm.stopPrank();\n\n // check balances\n assertGt(market.balanceOf(user), 0);\n }\n}\n" + }, + "contracts/test/oracles/default/ChainlinkOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\n\ncontract ChainlinkOraclesTest is BaseTest {\n ChainlinkPriceOracleV2 oracle;\n\n address usdcPolygon = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;\n address usdtPolygon = 0xc2132D05D31c914a87C6611C10748AEb04B58e8F;\n address usdcFeedPolygon = 0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7;\n address usdtFeedPolygon = 0x0A6513e40db6EB1b165753AD52E80663aeA50545;\n\n address jBRLBsc = 0x316622977073BBC3dF32E7d2A9B3c77596a0a603;\n address jBRLFeedBsc = 0x5cb1Cb3eA5FB46de1CE1D0F3BaDB3212e8d8eF48;\n address usdcBsc = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n address usdtBsc = 0x55d398326f99059fF775485246999027B3197955;\n address usdtFeedBsc = 0xB97Ad0E74fa7d920791E90258A6E2085088b4320;\n address usdcFeedBsc = 0x51597f405303C4377E36123cBc172b13269EA163;\n ICErc20 usdcMarketBsc = ICErc20(0x8D5bE2768c335e88b71E4e913189AEE7104f01B4);\n ICErc20 usdtMarketBsc = ICErc20(0x1F73754c135d5B9fDE674806f43AeDfA2c7eaDb5);\n\n function afterForkSetUp() internal override {\n oracle = ChainlinkPriceOracleV2(ap.getAddress(\"ChainlinkPriceOracleV2\"));\n }\n\n function setUpOracleFeed(address testedTokenAddress, address aggregatorAddress) internal {\n address[] memory underlyings = new address[](1);\n underlyings[0] = testedTokenAddress;\n address[] memory aggregators = new address[](1);\n aggregators[0] = aggregatorAddress;\n\n vm.prank(oracle.owner());\n oracle.setPriceFeeds(underlyings, aggregators, ChainlinkPriceOracleV2.FeedBaseCurrency.USD);\n }\n\n function testJBRLPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(jBRLBsc, jBRLFeedBsc);\n assert(oracle.price(jBRLBsc) > 0);\n }\n\n function testBSCChainlinkUSDCPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdcBsc, usdcFeedBsc);\n uint256 price = oracle.price(usdcBsc);\n uint256 underlyingPrice = oracle.getUnderlyingPrice(usdcMarketBsc);\n assertEq(price, underlyingPrice);\n }\n\n function testBSCChainlinkUSDTPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdtBsc, usdtFeedBsc);\n uint256 price = oracle.price(usdtBsc);\n uint256 underlyingPrice = oracle.getUnderlyingPrice(usdtMarketBsc);\n assertEq(price, underlyingPrice);\n }\n\n function testUsdcUsdtDeviationBsc() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdtBsc, usdtFeedBsc);\n setUpOracleFeed(usdcBsc, usdcFeedBsc);\n\n uint256 usdtPrice = oracle.getUnderlyingPrice(usdtMarketBsc);\n uint256 usdcPrice = oracle.getUnderlyingPrice(usdcMarketBsc);\n\n assertApproxEqAbs(usdtPrice, usdcPrice, 1e16, \"usd prices differ too much\");\n }\n\n function testUsdcUsdtDeviationPolygon() public fork(POLYGON_MAINNET) {\n setUpOracleFeed(usdtPolygon, usdtFeedPolygon);\n setUpOracleFeed(usdcPolygon, usdcFeedPolygon);\n\n uint256 usdtPrice = oracle.price(usdtPolygon);\n uint256 usdcPrice = oracle.price(usdcPolygon);\n\n assertApproxEqAbs(usdtPrice, usdcPrice, 1e16, \"usd prices differ too much\");\n }\n}\n" + }, + "contracts/test/oracles/default/ERC4626OracleAndLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { ERC4626Oracle } from \"../../../oracles/default/ERC4626Oracle.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { IERC4626 } from \"../../../compound/IERC4626.sol\";\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\n\nimport { IUniswapV3Factory } from \"../../../external/uniswap/IUniswapV3Factory.sol\";\nimport { Quoter } from \"../../../external/uniswap/quoter/Quoter.sol\";\nimport { IUniswapV3Pool } from \"../../../external/uniswap/IUniswapV3Pool.sol\";\nimport { ISwapRouter } from \"../../../external/uniswap/ISwapRouter.sol\";\nimport { ERC4626Liquidator } from \"../../../liquidators/ERC4626Liquidator.sol\";\n\ncontract ERC4626OracleAndLiquidatorTest is BaseTest {\n // TODO: refactor this into oracle and liquidator tests once oracles are deployed\n // TODO: refactor oracle set up using the address provider\n\n MasterPriceOracle mpo;\n ChainlinkPriceOracleV2 chainlinkOracle;\n ERC4626Oracle erc4626Oracle;\n\n IERC20Upgradeable wethToken;\n IERC20Upgradeable wbtcToken;\n IERC20Upgradeable daiToken;\n IERC20Upgradeable usdcToken;\n IERC20Upgradeable usdtToken;\n\n address nativeUsdPriceFeed;\n address usdcEthPriceFeed;\n address wbtcEthPriceFeed;\n\n IERC4626 erc4626Vault;\n address[] underlyingTokens;\n ERC4626Liquidator liquidator;\n\n address usdcMarketAddress;\n address univ3SwapRouter;\n\n uint256 poolFee;\n\n Quoter quoter;\n\n address holder;\n\n function setUpErc4626Oracle() public {\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n erc4626Oracle = new ERC4626Oracle();\n vm.prank(erc4626Oracle.owner());\n erc4626Oracle.initialize();\n oracles[0] = erc4626Oracle;\n vm.prank(mpo.admin());\n mpo.add(asArray(address(erc4626Vault)), oracles);\n }\n\n function setUpBaseOracles() public {\n setUpMpoAndAddresses();\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\n chainlinkOracle = new ChainlinkPriceOracleV2();\n chainlinkOracle.initialize(address(usdcToken), nativeUsdPriceFeed);\n vm.prank(chainlinkOracle.owner());\n chainlinkOracle.setPriceFeeds(\n asArray(address(usdcToken), address(wbtcToken)),\n asArray(usdcEthPriceFeed, wbtcEthPriceFeed),\n ChainlinkPriceOracleV2.FeedBaseCurrency.ETH\n );\n oracles[0] = BasePriceOracle(address(chainlinkOracle));\n oracles[1] = BasePriceOracle(address(chainlinkOracle));\n\n vm.prank(mpo.admin());\n mpo.add(asArray(address(usdcToken), address(wbtcToken)), oracles);\n }\n\n function setUpMpoAndAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n usdcToken = IERC20Upgradeable(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n daiToken = IERC20Upgradeable(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n usdtToken = IERC20Upgradeable(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n wbtcToken = IERC20Upgradeable(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n wethToken = IERC20Upgradeable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n nativeUsdPriceFeed = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;\n usdcEthPriceFeed = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4;\n wbtcEthPriceFeed = 0xdeb288F737066589598e9214E782fa5A8eD689e8;\n\n address[] memory assets = new address[](0);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\n mpo = new MasterPriceOracle();\n mpo.initialize(assets, oracles, BasePriceOracle(address(0)), address(this), true, address(wethToken));\n }\n }\n\n function setupRealYieldStrategyUsdAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n underlyingTokens = asArray(address(usdcToken), address(daiToken), address(usdtToken)); // USDC, 6 decimals\n poolFee = 10;\n erc4626Vault = IERC4626(0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E); // USDC-DAI-USDT Real Yield\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n holder = 0x3541Fda19b09769A938EB2A5f5154b01aE5b0869;\n }\n liquidator = new ERC4626Liquidator();\n }\n\n function setupEthBtcStrategyAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n underlyingTokens = asArray(address(usdcToken), address(wbtcToken), address(wethToken));\n poolFee = 500;\n erc4626Vault = IERC4626(0x6b7f87279982d919Bbf85182DDeAB179B366D8f2); // ETH-BTC trend\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n holder = 0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3;\n }\n liquidator = new ERC4626Liquidator();\n }\n\n function testRealYieldErc4626PriceOracle() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupRealYieldStrategyUsdAddresses();\n setUpErc4626Oracle();\n\n uint256 priceRealYieldUsdc = mpo.price(address(erc4626Vault));\n uint256 priceUsdc = mpo.price(address(usdcToken));\n\n // Approximate only -- these should not match.\n assertApproxEqRel(priceRealYieldUsdc, priceUsdc, 3e16, \"!diff > 3%\");\n }\n\n function testRealYieldUsdErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupRealYieldStrategyUsdAddresses();\n setUpErc4626Oracle();\n executeTestRedemptionStrategy(usdcToken);\n }\n\n function testEthBtcMomementumErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupEthBtcStrategyAddresses();\n setUpErc4626Oracle();\n executeTestRedemptionStrategy(wethToken);\n }\n\n function executeTestRedemptionStrategy(IERC20Upgradeable _outputToken) internal {\n uint256 balance = erc4626Vault.balanceOf(holder);\n assertTrue(balance > 0);\n\n // impersonate the holder\n vm.prank(holder);\n\n // fund the liquidator so it can redeem the tokens\n erc4626Vault.transfer(address(liquidator), balance);\n\n bytes memory data = abi.encode(address(_outputToken), poolFee, univ3SwapRouter, underlyingTokens, quoter);\n\n // redeem the underlying reward token\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n IERC20Upgradeable(address(erc4626Vault)),\n balance,\n data\n );\n\n // ensure the output token is the expected token\n assertEq(address(outputToken), address(_outputToken));\n\n uint256 liquidatorBalance = _outputToken.balanceOf(address(liquidator));\n // get the redeemed value of the erc4626 token\n uint256 redeemValue = (mpo.price(address(erc4626Vault)) * balance) / 1e18;\n // get the redeemed value of the output token\n uint256 redeemOutputTokenValue = (mpo.price(address(_outputToken)) * liquidatorBalance) /\n 10 ** ERC20Upgradeable(address(_outputToken)).decimals();\n // ensure they are approximately equal\n assertApproxEqRel(redeemValue, redeemOutputTokenValue, 3e16, \"!diff > 3%\");\n\n uint256 maxVal = redeemValue > redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\n uint256 minVal = redeemValue < redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\n\n uint256 absoluteDifference = maxVal - minVal;\n uint256 percentageDifference = (absoluteDifference * 10000) / maxVal; // Multiplied by 10000 for 2 decimal places of precision\n\n // log the differences\n emit log_named_uint(\"redeemOutputTokenValue\", redeemOutputTokenValue);\n emit log_named_uint(\"redeemValue\", redeemValue);\n emit log_named_uint(\"base 1000 diff\", percentageDifference);\n }\n}\n" + }, + "contracts/test/oracles/default/MasterPriceOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { MockRevertPriceOracle } from \"../../../oracles/1337/MockRevertPriceOracle.sol\";\n\ncontract MasterPriceOracleTest is BaseTest {\n MasterPriceOracle mpo;\n SimplePriceOracle mainOracle;\n SimplePriceOracle fallbackOracle;\n MockRevertPriceOracle revertingOracle;\n ICErc20 mockCToken;\n address someAdminAccount = address(94949);\n address ezETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ionezETH = 0x59e710215d45F584f44c0FEe83DA6d43D762D857;\n\n function afterForkSetUp() internal override {\n MasterPriceOracle newMpo = new MasterPriceOracle();\n SimplePriceOracle defaultOracle = new SimplePriceOracle();\n\n address[] memory underlyings = new address[](0);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\n\n vm.prank(someAdminAccount);\n newMpo.initialize(underlyings, oracles, defaultOracle, someAdminAccount, true, address(0));\n\n mpo = newMpo;\n\n SimplePriceOracle impl = new SimplePriceOracle();\n vm.prank(address(someAdminAccount));\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(impl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n mainOracle = SimplePriceOracle(address(proxy));\n\n SimplePriceOracle fallbackImpl = new SimplePriceOracle();\n vm.prank(address(someAdminAccount));\n TransparentUpgradeableProxy fallbackProxy = new TransparentUpgradeableProxy(\n address(fallbackImpl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n fallbackOracle = SimplePriceOracle(address(fallbackProxy));\n\n vm.startPrank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 2000);\n fallbackOracle.setDirectPrice(ezETH, 2000);\n vm.stopPrank();\n\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(mainOracle);\n BasePriceOracle[] memory fallbackOraclesToAdd = new BasePriceOracle[](1);\n fallbackOraclesToAdd[0] = BasePriceOracle(fallbackOracle);\n\n vm.startPrank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n mpo.addFallbacks(tokens, fallbackOraclesToAdd);\n vm.stopPrank();\n\n revertingOracle = new MockRevertPriceOracle();\n }\n\n function testGetUnderlyingPrice() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenZero() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 0);\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenZeroAddressOracle() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(0x0000000000000000000000000000000000000000);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenOracleReverts() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(revertingOracle);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPrice() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenZero() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 0);\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenZeroAddressOracle() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(0x0000000000000000000000000000000000000000);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenOracleReverts() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(revertingOracle);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n}\n" + }, + "contracts/test/oracles/default/PythPriceOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PythPriceOracle } from \"../../../oracles/default/PythPriceOracle.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/MockPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\n\ncontract PythPriceOracleTest is BaseTest {\n PythPriceOracle oracle;\n IPyth pythOracle;\n MasterPriceOracle mpo;\n\n address stable;\n address wtoken;\n address wbtc;\n\n address neonPyth = 0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5;\n address lineaPyth = 0xA2aa501b19aff244D90cc15a4Cf739D2725B5729;\n address polygonPyth = 0xff1a0f4744e8582DF1aE09D5611b887B6a12925C;\n address zkevmPyth = 0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65;\n\n bytes32 ethUsdTokenPriceFeed = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;\n bytes32 btcUsdTokenPriceFeed = 0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43;\n bytes32 neonUsdTokenPriceFeed = 0xd82183dd487bef3208a227bb25d748930db58862c5121198e723ed0976eb92b7;\n bytes32 maticUsdTokenPriceFeed = 0x5de33a9112c2b700b8d30b8a3402c103578ccfa2765696471cc672bd5cf6ac52;\n bytes32 usdcUsdTokenPriceFeed = 0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a;\n\n function afterForkSetUp() internal override {\n stable = ap.getAddress(\"stableToken\");\n wtoken = ap.getAddress(\"wtoken\");\n wbtc = ap.getAddress(\"wBTCToken\");\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n oracle = new PythPriceOracle();\n\n // create an array of bytes to pass to the oracle\n bytes32[] memory feedIds = new bytes32[](2);\n feedIds[0] = usdcUsdTokenPriceFeed;\n feedIds[1] = btcUsdTokenPriceFeed;\n vm.startPrank(mpo.admin());\n\n if (block.chainid == NEON_MAINNET) {\n oracle.initialize(neonPyth, neonUsdTokenPriceFeed, stable);\n } else if (block.chainid == LINEA_MAINNET) {\n oracle.initialize(lineaPyth, ethUsdTokenPriceFeed, stable);\n } else if (block.chainid == POLYGON_MAINNET) {\n oracle.initialize(polygonPyth, maticUsdTokenPriceFeed, stable);\n } else if (block.chainid == ZKEVM_MAINNET) {\n oracle.initialize(zkevmPyth, ethUsdTokenPriceFeed, stable);\n } else {\n revert(\"Unsupported chain\");\n }\n oracle.setPriceFeeds(asArray(stable, wbtc), feedIds);\n vm.stopPrank();\n }\n\n function testPolygonTokenPrice() public debuggingOnly fork(POLYGON_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(polygonPyth).getPriceUnsafe(maticUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n\n function testLineaTokenPrice() public debuggingOnly fork(LINEA_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(lineaPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e17);\n }\n\n function testNeonTokenPrice() public debuggingOnly fork(NEON_MAINNET) {\n PythStructs.Price memory pythPriceNeon = IPyth(neonPyth).getPriceUnsafe(neonUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPriceNeon.price)));\n emit log_named_uint(\"updated\", pythPriceNeon.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n PythStructs.Price memory pythPrice = IPyth(neonPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n\n function testZkEvmTokenPrice() public fork(ZKEVM_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(zkevmPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n}\n" + }, + "contracts/test/oracles/default/SimplePriceOracleTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract SimplePriceOracleTest is BaseTest {\n SimplePriceOracle oracle;\n MasterPriceOracle mpo;\n address someAdminAccount = address(94949);\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n SimplePriceOracle impl = new SimplePriceOracle();\n\n vm.prank(someAdminAccount);\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(impl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n oracle = SimplePriceOracle(address(proxy));\n }\n\n function testSimplePO() public fork(BSC_MAINNET) {\n vm.expectRevert(\"Ownable: caller is not the owner\");\n oracle.setDirectPrice(address(1), 1);\n\n vm.prank(someAdminAccount);\n oracle.setDirectPrice(address(1), 1);\n }\n}\n" + }, + "contracts/test/oracles/default/TwapOraclesBaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { UniswapTwapPriceOracleV2Factory } from \"../../../oracles/default/UniswapTwapPriceOracleV2Factory.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"../../../oracles/default/UniswapTwapPriceOracleV2Root.sol\";\nimport { UniswapTwapPriceOracleV2 } from \"../../../oracles/default/UniswapTwapPriceOracleV2.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { IUniswapV2Pair } from \"../../../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\n\ncontract TwapOraclesBaseTest is BaseTest {\n IUniswapV2Factory uniswapV2Factory;\n UniswapTwapPriceOracleV2Factory twapPriceOracleFactory;\n MasterPriceOracle mpo;\n\n function afterForkSetUp() internal override {\n uniswapV2Factory = IUniswapV2Factory(ap.getAddress(\"IUniswapV2Factory\"));\n twapPriceOracleFactory = UniswapTwapPriceOracleV2Factory(ap.getAddress(\"UniswapTwapPriceOracleV2Factory\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n // BOMB\n function testBombTwapOraclePrice() public fork(BSC_MAINNET) {\n address baseToken = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c; // WBTC\n address testedAssetTokenAddress = 0x522348779DCb2911539e76A1042aA922F9C47Ee3; // BOMB\n\n assertTrue(getTokenTwapPrice(testedAssetTokenAddress, baseToken) > 0);\n }\n\n function getTokenTwapPrice(address tokenAddress, address baseTokenAddress) internal returns (uint256) {\n address testedPairAddress = uniswapV2Factory.getPair(tokenAddress, baseTokenAddress);\n\n // trigger a price update\n UniswapTwapPriceOracleV2Root twapOracleRoot = UniswapTwapPriceOracleV2Root(twapPriceOracleFactory.rootOracle());\n address[] memory pairs = new address[](1);\n pairs[0] = testedPairAddress;\n twapOracleRoot.update(pairs);\n\n // check if the base toke oracle is present in the master price oracle\n if (address(mpo.oracles(tokenAddress)) == address(0)) {\n // deploy or get the base token twap oracle\n address oracleAddress = twapPriceOracleFactory.deploy(address(uniswapV2Factory), baseTokenAddress);\n UniswapTwapPriceOracleV2 oracle = UniswapTwapPriceOracleV2(oracleAddress);\n // add the new twap oracle to the master oracle\n address[] memory underlyings = new address[](1);\n underlyings[0] = tokenAddress;\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n // impersonate the admin to add the oracle\n vm.prank(mpo.admin());\n mpo.add(underlyings, oracles);\n emit log(\"added the oracle\");\n } else {\n emit log(\"found the oracle\");\n }\n\n // return the price denominated in W_NATIVE\n return mpo.price(tokenAddress);\n }\n\n // function testChapelEthBusdOraclePrice() public {\n // address baseToken = 0x7ef95a0FEE0Dd31b22626fA2e10Ee6A223F8a684; // USDT\n // address testedAssetTokenAddress = 0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7; // BUSD\n // assertTrue(getTokenTwapPrice(testedAssetTokenAddress, baseToken) > 0);\n // }\n}\n" + }, + "contracts/test/oracles/default/UniswapTwapPriceOracleV2Resolver.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"../../../oracles/default/UniswapTwapPriceOracleV2Root.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\nimport { UniswapTwapPriceOracleV2Resolver } from \"../../../oracles/default/UniswapTwapPriceOracleV2Resolver.sol\";\nimport { IUniswapV2Pair } from \"../../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\n\ncontract UniswapTwapOracleV2ResolverTest is BaseTest {\n UniswapTwapPriceOracleV2Root twapPriceOracleRoot;\n UniswapTwapPriceOracleV2Resolver resolver;\n IUniswapV2Factory uniswapV2Factory;\n MasterPriceOracle mpo;\n\n struct Observation {\n uint32 timestamp;\n uint256 price0Cumulative;\n uint256 price1Cumulative;\n }\n\n function afterForkSetUp() internal override {\n uniswapV2Factory = IUniswapV2Factory(ap.getAddress(\"IUniswapV2Factory\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function getTokenTwapPrice(address tokenAddress) internal view returns (uint256) {\n // return the price denominated in W_NATIVE\n return mpo.price(tokenAddress);\n }\n}\n" + }, + "contracts/test/oracles/RedstoneAdapterOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { RedstoneAdapterPriceOracle } from \"../../oracles/default/RedstoneAdapterPriceOracle.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract RedstoneAdapterOracleTest is BaseTest {\n MasterPriceOracle public mpo;\n RedstoneAdapterPriceOracle public oracle;\n address public redstoneOracleAddress;\n address MODE_USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address MODE_WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF;\n address MODE_WEETH = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n\n function afterForkSetUp() internal override {\n if (block.chainid == MODE_MAINNET) {\n redstoneOracleAddress = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256;\n }\n\n oracle = new RedstoneAdapterPriceOracle(redstoneOracleAddress);\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function testPrintPricesMode() public fork(MODE_MAINNET) {\n emit log_named_uint(\"ezETH price (18 dec)\", oracle.price(MODE_EZETH));\n emit log_named_uint(\"WBTC price (8 dec)\", oracle.price(MODE_WBTC));\n emit log_named_uint(\"weETH price (18 dec)\", oracle.price(MODE_WEETH));\n }\n\n function testPrintMpoPricesMode() public fork(MODE_MAINNET) {\n emit log_named_uint(\"weETH price (18 dec)\", mpo.price(MODE_WEETH));\n }\n}\n" + }, + "contracts/test/OraclesDecimalsScalingTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\ncontract OraclesDecimalsScalingTest is BaseTest {\n MasterPriceOracle mpo;\n PoolDirectory poolDirectory;\n address stable;\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n poolDirectory = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n stable = ap.getAddress(\"stableToken\");\n }\n\n function testOracleDecimalsBsc() public fork(BSC_MAINNET) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsArbitrum() public fork(ARBITRUM_ONE) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsPolygon() public fork(POLYGON_MAINNET) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsNeon() public fork(NEON_MAINNET) {\n vm.mockCall(stable, abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector), abi.encode(6));\n // SOL\n vm.mockCall(\n 0x5f38248f339Bf4e84A2caf4e4c0552862dC9F82a,\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector),\n abi.encode(9)\n );\n testOraclesDecimals();\n }\n\n function testOraclesDecimals() internal {\n if (address(poolDirectory) != address(0)) {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n address underlying = markets[j].underlying();\n\n if (isSkipped(underlying)) {\n emit log(\"the oracle for this underlying cannot be tested\");\n emit log_address(underlying);\n continue;\n }\n\n uint256 oraclePrice = mpo.price(underlying);\n uint256 scaledPrice = mpo.getUnderlyingPrice(markets[j]);\n\n uint8 decimals = IERC20MetadataUpgradeable(underlying).decimals();\n uint256 expectedScaledPrice = decimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - decimals))\n : uint256(oraclePrice) / (10 ** (decimals - 18));\n\n assertEq(scaledPrice, expectedScaledPrice, \"the comptroller expects prices to be scaled by 1e(36-decimals)\");\n }\n }\n }\n }\n\n function isSkipped(address token) internal pure returns (bool) {\n return token == 0x5f38248f339Bf4e84A2caf4e4c0552862dC9F82a; // SOL on neon, failing for unknwon reasons, works in HH\n }\n}\n" + }, + "contracts/test/PermissionedLiquidationsMarketTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\n\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ILiquidator } from \"../ILiquidator.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../liquidators/IFundsConversionStrategy.sol\";\n\ncontract PermissionedLiquidationsMarketTest is MarketsTest {\n ICErc20 wethMarket;\n ICErc20 usdtMarket;\n\n ICErc20 wethNativeMarket;\n ICErc20 usdcNativeMarket;\n ICErc20 usdtNativeMarket;\n ICErc20 modeNativeMarket;\n\n IonicComptroller pool;\n PoolLens lens;\n address borrower;\n address liquidator;\n IonicUniV3Liquidator uniV3liquidator;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n\n wethNativeMarket = ICErc20(0xDb8eE6D1114021A94A045956BBeeCF35d13a30F2);\n usdcNativeMarket = ICErc20(0xc53edEafb6D502DAEC5A7015D67936CEa0cD0F52);\n usdtNativeMarket = ICErc20(0x3120B4907851cc9D780eef9aF88ae4d5360175Fd);\n modeNativeMarket = ICErc20(0x4341620757Bee7EB4553912FaFC963e59C949147);\n\n pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n borrower = 0xcE6cEFa163468F730206688665516952bcf83B74;\n liquidator = 0xE000008459b74a91e306a47C808061DFA372000E;\n uniV3liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n vm.prank(ap.owner());\n ap.setAddress(\"PoolLens\", address(lens));\n }\n\n function testLiquidateNoThreshold() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateThresholdActive() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n vm.expectRevert(\"Health factor not low enough for non-permissioned liquidations\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n vm.stopPrank();\n }\n\n function testLiquidateHealthFactorLowerThanThreshold() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n // fast forward until position unhealthy enough\n vm.roll(block.number + 10000000);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateFromPythShouldRevert() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n emit log_named_uint(\"hf\", lens.getHealthFactor(0x0Ff7F5043DD39186c2DF04F81cfa95672B8A3994, pool));\n\n address targetContract = 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A;\n bytes\n memory data = hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000ff7f5043dd39186c2df04f81cfa95672b8a39940000000000000000000000000000000000000000000000000002fb8c3841c79600000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d2000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n vm.startPrank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n vm.expectRevert(\"invalid liquidation\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateFromPyth() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n emit log_named_uint(\"hf\", lens.getHealthFactor(0x0Ff7F5043DD39186c2DF04F81cfa95672B8A3994, pool));\n\n address targetContract = 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A;\n bytes\n memory data = hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000ff7f5043dd39186c2df04f81cfa95672b8a39940000000000000000000000000000000000000000000000000002fb8c3841c79600000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d2000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n vm.mockCall(\n address(uniV3liquidator.expressRelay()),\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(uniV3liquidator),\n abi.encode(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6)\n ),\n abi.encode(false)\n );\n\n vm.startPrank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n vm.expectRevert(\"invalid liquidation\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testPostUpgradeLiquidate() public debuggingOnly fork(MODE_MAINNET) {\n address borrower = 0xE10B38bbe359656066b3c4648DfEa7018711c35f;\n PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser(pool, borrower);\n\n for (uint i; i < assets.length; i++) {\n emit log_named_string(\"Asset Named\", assets[i].underlyingName);\n emit log_named_uint(\"Supply Balance\", assets[i].supplyBalance);\n emit log_named_uint(\"Borrow Balance\", assets[i].borrowBalance);\n emit log_named_uint(\"Liquidity\", assets[i].liquidity);\n emit log(\"----------------------------------------------------\");\n }\n\n emit log_named_uint(\"HF\", lens.getHealthFactor(borrower, pool));\n\n // vm.startPrank(0x344d9C4f488bb5519D390304457D64034618145C);\n\n // ERC20(0xd988097fb8612cc24eeC14542bC03424c656005f).approve(address(uniV3liquidator), 4000);\n\n // // ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n // // borrower: borrower,\n // // repayAmount: 4000,\n // // cErc20: ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),\n // // cTokenCollateral: wethMarket,\n // // flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n // // minProfitAmount: 0,\n // // redemptionStrategies: new IRedemptionStrategy[](0),\n // // strategyData: new bytes[](0),\n // // debtFundingStrategies: new IFundsConversionStrategy[](0),\n // // debtFundingStrategiesData: new bytes[](0)\n // // });\n // // uniV3liquidator.safeLiquidateToTokensWithFlashLoan(vars);\n\n // uniV3liquidator.safeLiquidate(borrower, 4000, ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038), wethMarket, 0);\n\n // vm.stopPrank();\n\n // emit log_named_uint(\"HF\", lens.getHealthFactor(borrower, pool));\n }\n\n function testUpgradeNativeMarket() public debuggingOnly fork(MODE_MAINNET) {\n _upgradeMarket(wethNativeMarket);\n _upgradeMarket(usdcNativeMarket);\n _upgradeMarket(usdtNativeMarket);\n _upgradeMarket(modeNativeMarket);\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n }\n\n struct CErc20StorageStruct {\n address ionicAdmin;\n string name;\n string symbol;\n uint8 decimals;\n address comptroller;\n address interestRateModel;\n uint256 adminFeeMantissa;\n uint256 ionicFeeMantissa;\n uint256 reserveFactorMantissa;\n uint256 accrualBlockNumber;\n uint256 borrowIndex;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalAdminFees;\n uint256 totalIonicFees;\n uint256 totalSupply;\n uint256 protocolSeizeShareMantissa;\n uint256 feeSeizeShareMantissa;\n address underlying;\n address ap;\n uint256 cash;\n uint256 totalBorrowsCurrent;\n uint256 balanceOfUnderlying;\n uint256 borrowBalanceCurrent;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 exchangeRateCurrent;\n uint256 totalUnderlyingSupplied;\n uint256 allowance;\n uint256 balanceOf;\n }\n\n function testStorageLayoutSafe() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n // Capture storage layout before upgrade\n CErc20StorageStruct memory storageDataBefore;\n CErc20StorageStruct memory storageDataAfter;\n\n address owner = 0xbF86588d7e20502f1b250561da775343Dfdb3250; // Use a valid spender address as needed\n\n storageDataBefore.ionicAdmin = wethMarket.ionicAdmin();\n storageDataBefore.name = wethMarket.name();\n storageDataBefore.symbol = wethMarket.symbol();\n storageDataBefore.decimals = wethMarket.decimals();\n storageDataBefore.comptroller = address(wethMarket.comptroller());\n storageDataBefore.interestRateModel = address(wethMarket.interestRateModel());\n storageDataBefore.adminFeeMantissa = wethMarket.adminFeeMantissa();\n storageDataBefore.ionicFeeMantissa = wethMarket.ionicFeeMantissa();\n storageDataBefore.reserveFactorMantissa = wethMarket.reserveFactorMantissa();\n storageDataBefore.accrualBlockNumber = wethMarket.accrualBlockNumber();\n storageDataBefore.borrowIndex = wethMarket.borrowIndex();\n storageDataBefore.totalBorrows = wethMarket.totalBorrows();\n storageDataBefore.totalReserves = wethMarket.totalReserves();\n storageDataBefore.totalAdminFees = wethMarket.totalAdminFees();\n storageDataBefore.totalIonicFees = wethMarket.totalIonicFees();\n storageDataBefore.totalSupply = wethMarket.totalSupply();\n storageDataBefore.underlying = wethMarket.underlying();\n storageDataBefore.cash = wethMarket.getCash();\n storageDataBefore.totalBorrowsCurrent = wethMarket.totalBorrowsCurrent();\n storageDataBefore.balanceOfUnderlying = wethMarket.balanceOfUnderlying(owner);\n storageDataBefore.borrowBalanceCurrent = wethMarket.borrowBalanceCurrent(owner);\n storageDataBefore.supplyRatePerBlock = wethMarket.supplyRatePerBlock();\n storageDataBefore.borrowRatePerBlock = wethMarket.borrowRatePerBlock();\n storageDataBefore.exchangeRateCurrent = wethMarket.exchangeRateCurrent();\n storageDataBefore.totalUnderlyingSupplied = wethMarket.getTotalUnderlyingSupplied();\n storageDataBefore.balanceOf = wethMarket.balanceOf(owner);\n storageDataBefore.protocolSeizeShareMantissa = wethMarket.protocolSeizeShareMantissa();\n storageDataBefore.feeSeizeShareMantissa = wethMarket.feeSeizeShareMantissa();\n\n // Upgrade the market\n _upgradeMarket(wethMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n storageDataAfter.ionicAdmin = wethMarket.ionicAdmin();\n storageDataAfter.name = wethMarket.name();\n storageDataAfter.symbol = wethMarket.symbol();\n storageDataAfter.decimals = wethMarket.decimals();\n storageDataAfter.comptroller = address(wethMarket.comptroller());\n storageDataAfter.interestRateModel = address(wethMarket.interestRateModel());\n storageDataAfter.adminFeeMantissa = wethMarket.adminFeeMantissa();\n storageDataAfter.ionicFeeMantissa = wethMarket.ionicFeeMantissa();\n storageDataAfter.reserveFactorMantissa = wethMarket.reserveFactorMantissa();\n storageDataAfter.accrualBlockNumber = wethMarket.accrualBlockNumber();\n storageDataAfter.borrowIndex = wethMarket.borrowIndex();\n storageDataAfter.totalBorrows = wethMarket.totalBorrows();\n storageDataAfter.totalReserves = wethMarket.totalReserves();\n storageDataAfter.totalAdminFees = wethMarket.totalAdminFees();\n storageDataAfter.totalIonicFees = wethMarket.totalIonicFees();\n storageDataAfter.totalSupply = wethMarket.totalSupply();\n storageDataAfter.underlying = wethMarket.underlying();\n storageDataAfter.cash = wethMarket.getCash();\n storageDataAfter.totalBorrowsCurrent = wethMarket.totalBorrowsCurrent();\n storageDataAfter.balanceOfUnderlying = wethMarket.balanceOfUnderlying(owner);\n storageDataAfter.borrowBalanceCurrent = wethMarket.borrowBalanceCurrent(owner);\n storageDataAfter.supplyRatePerBlock = wethMarket.supplyRatePerBlock();\n storageDataAfter.borrowRatePerBlock = wethMarket.borrowRatePerBlock();\n storageDataAfter.exchangeRateCurrent = wethMarket.exchangeRateCurrent();\n storageDataAfter.totalUnderlyingSupplied = wethMarket.getTotalUnderlyingSupplied();\n storageDataAfter.balanceOf = wethMarket.balanceOf(owner);\n storageDataAfter.protocolSeizeShareMantissa = wethMarket.protocolSeizeShareMantissa();\n storageDataAfter.feeSeizeShareMantissa = wethMarket.feeSeizeShareMantissa();\n\n emit log_named_address(\"Storage ionicAdmin (before)\", storageDataBefore.ionicAdmin);\n emit log_named_address(\"Storage ionicAdmin (after)\", storageDataAfter.ionicAdmin);\n\n emit log_named_string(\"Storage name (before)\", storageDataBefore.name);\n emit log_named_string(\"Storage name (after)\", storageDataAfter.name);\n\n emit log_named_string(\"Storage symbol (before)\", storageDataBefore.symbol);\n emit log_named_string(\"Storage symbol (after)\", storageDataAfter.symbol);\n\n emit log_named_uint(\"Storage decimals (before)\", storageDataBefore.decimals);\n emit log_named_uint(\"Storage decimals (after)\", storageDataAfter.decimals);\n\n emit log_named_address(\"Storage comptroller (before)\", storageDataBefore.comptroller);\n emit log_named_address(\"Storage comptroller (after)\", storageDataAfter.comptroller);\n\n emit log_named_address(\"Storage interestRateModel (before)\", storageDataBefore.interestRateModel);\n emit log_named_address(\"Storage interestRateModel (after)\", storageDataAfter.interestRateModel);\n\n emit log_named_uint(\"Storage adminFeeMantissa (before)\", storageDataBefore.adminFeeMantissa);\n emit log_named_uint(\"Storage adminFeeMantissa (after)\", storageDataAfter.adminFeeMantissa);\n\n emit log_named_uint(\"Storage ionicFeeMantissa (before)\", storageDataBefore.ionicFeeMantissa);\n emit log_named_uint(\"Storage ionicFeeMantissa (after)\", storageDataAfter.ionicFeeMantissa);\n\n emit log_named_uint(\"Storage reserveFactorMantissa (before)\", storageDataBefore.reserveFactorMantissa);\n emit log_named_uint(\"Storage reserveFactorMantissa (after)\", storageDataAfter.reserveFactorMantissa);\n\n emit log_named_uint(\"Storage accrualBlockNumber (before)\", storageDataBefore.accrualBlockNumber);\n emit log_named_uint(\"Storage accrualBlockNumber (after)\", storageDataAfter.accrualBlockNumber);\n\n emit log_named_uint(\"Storage borrowIndex (before)\", storageDataBefore.borrowIndex);\n emit log_named_uint(\"Storage borrowIndex (after)\", storageDataAfter.borrowIndex);\n\n emit log_named_uint(\"Storage totalBorrows (before)\", storageDataBefore.totalBorrows);\n emit log_named_uint(\"Storage totalBorrows (after)\", storageDataAfter.totalBorrows);\n\n emit log_named_uint(\"Storage totalReserves (before)\", storageDataBefore.totalReserves);\n emit log_named_uint(\"Storage totalReserves (after)\", storageDataAfter.totalReserves);\n\n emit log_named_uint(\"Storage totalAdminFees (before)\", storageDataBefore.totalAdminFees);\n emit log_named_uint(\"Storage totalAdminFees (after)\", storageDataAfter.totalAdminFees);\n\n emit log_named_uint(\"Storage totalIonicFees (before)\", storageDataBefore.totalIonicFees);\n emit log_named_uint(\"Storage totalIonicFees (after)\", storageDataAfter.totalIonicFees);\n\n emit log_named_uint(\"Storage totalSupply (before)\", storageDataBefore.totalSupply);\n emit log_named_uint(\"Storage totalSupply (after)\", storageDataAfter.totalSupply);\n\n emit log_named_uint(\"Storage protocolSeizeShareMantissa (before)\", storageDataBefore.protocolSeizeShareMantissa);\n emit log_named_uint(\"Storage protocolSeizeShareMantissa (after)\", storageDataAfter.protocolSeizeShareMantissa);\n\n emit log_named_uint(\"Storage feeSeizeShareMantissa (before)\", storageDataBefore.feeSeizeShareMantissa);\n emit log_named_uint(\"Storage feeSeizeShareMantissa (after)\", storageDataAfter.feeSeizeShareMantissa);\n\n emit log_named_address(\"Storage underlying (before)\", storageDataBefore.underlying);\n emit log_named_address(\"Storage underlying (after)\", storageDataAfter.underlying);\n\n emit log_named_uint(\"Storage cash (before)\", storageDataBefore.cash);\n emit log_named_uint(\"Storage cash (after)\", storageDataAfter.cash);\n\n emit log_named_uint(\"Storage totalBorrowsCurrent (before)\", storageDataBefore.totalBorrowsCurrent);\n emit log_named_uint(\"Storage totalBorrowsCurrent (after)\", storageDataAfter.totalBorrowsCurrent);\n\n emit log_named_uint(\"Storage balanceOfUnderlying (before)\", storageDataBefore.balanceOfUnderlying);\n emit log_named_uint(\"Storage balanceOfUnderlying (after)\", storageDataAfter.balanceOfUnderlying);\n\n emit log_named_uint(\"Storage borrowBalanceCurrent (before)\", storageDataBefore.borrowBalanceCurrent);\n emit log_named_uint(\"Storage borrowBalanceCurrent (after)\", storageDataAfter.borrowBalanceCurrent);\n\n emit log_named_uint(\"Storage supplyRatePerBlock (before)\", storageDataBefore.supplyRatePerBlock);\n emit log_named_uint(\"Storage supplyRatePerBlock (after)\", storageDataAfter.supplyRatePerBlock);\n\n emit log_named_uint(\"Storage borrowRatePerBlock (before)\", storageDataBefore.borrowRatePerBlock);\n emit log_named_uint(\"Storage borrowRatePerBlock (after)\", storageDataAfter.borrowRatePerBlock);\n\n emit log_named_uint(\"Storage exchangeRateCurrent (before)\", storageDataBefore.exchangeRateCurrent);\n emit log_named_uint(\"Storage exchangeRateCurrent (after)\", storageDataAfter.exchangeRateCurrent);\n\n emit log_named_uint(\"Storage totalUnderlyingSupplied (before)\", storageDataBefore.totalUnderlyingSupplied);\n emit log_named_uint(\"Storage totalUnderlyingSupplied (after)\", storageDataAfter.totalUnderlyingSupplied);\n\n emit log_named_uint(\"Storage allowance (before)\", storageDataBefore.allowance);\n emit log_named_uint(\"Storage allowance (after)\", storageDataAfter.allowance);\n\n emit log_named_uint(\"Storage balanceOf (before)\", storageDataBefore.balanceOf);\n emit log_named_uint(\"Storage balanceOf (after)\", storageDataAfter.balanceOf);\n\n emit log_named_address(\"Storage ap (before)\", storageDataBefore.ap);\n emit log_named_address(\"Storage ap (after)\", storageDataAfter.ap);\n\n assertEq(storageDataBefore.ionicAdmin, storageDataAfter.ionicAdmin, \"Mismatch in ionicAdmin\");\n assertEq(storageDataBefore.name, storageDataAfter.name, \"Mismatch in name\");\n assertEq(storageDataBefore.symbol, storageDataAfter.symbol, \"Mismatch in symbol\");\n assertEq(storageDataBefore.decimals, storageDataAfter.decimals, \"Mismatch in decimals\");\n assertEq(storageDataBefore.comptroller, storageDataAfter.comptroller, \"Mismatch in comptroller\");\n assertEq(storageDataBefore.interestRateModel, storageDataAfter.interestRateModel, \"Mismatch in interestRateModel\");\n assertEq(storageDataBefore.adminFeeMantissa, storageDataAfter.adminFeeMantissa, \"Mismatch in adminFeeMantissa\");\n assertEq(storageDataBefore.ionicFeeMantissa, storageDataAfter.ionicFeeMantissa, \"Mismatch in ionicFeeMantissa\");\n assertEq(\n storageDataBefore.reserveFactorMantissa,\n storageDataAfter.reserveFactorMantissa,\n \"Mismatch in reserveFactorMantissa\"\n );\n assertEq(\n storageDataBefore.accrualBlockNumber,\n storageDataAfter.accrualBlockNumber,\n \"Mismatch in accrualBlockNumber\"\n );\n assertEq(storageDataBefore.borrowIndex, storageDataAfter.borrowIndex, \"Mismatch in borrowIndex\");\n assertEq(storageDataBefore.totalBorrows, storageDataAfter.totalBorrows, \"Mismatch in totalBorrows\");\n assertEq(storageDataBefore.totalReserves, storageDataAfter.totalReserves, \"Mismatch in totalReserves\");\n assertEq(storageDataBefore.totalAdminFees, storageDataAfter.totalAdminFees, \"Mismatch in totalAdminFees\");\n assertEq(storageDataBefore.totalIonicFees, storageDataAfter.totalIonicFees, \"Mismatch in totalIonicFees\");\n assertEq(storageDataBefore.totalSupply, storageDataAfter.totalSupply, \"Mismatch in totalSupply\");\n assertEq(storageDataBefore.underlying, storageDataAfter.underlying, \"Mismatch in underlying\");\n assertEq(storageDataBefore.cash, storageDataAfter.cash, \"Mismatch in cash\");\n assertEq(\n storageDataBefore.totalBorrowsCurrent,\n storageDataAfter.totalBorrowsCurrent,\n \"Mismatch in totalBorrowsCurrent\"\n );\n assertEq(\n storageDataBefore.balanceOfUnderlying,\n storageDataAfter.balanceOfUnderlying,\n \"Mismatch in balanceOfUnderlying\"\n );\n assertEq(\n storageDataBefore.borrowBalanceCurrent,\n storageDataAfter.borrowBalanceCurrent,\n \"Mismatch in borrowBalanceCurrent\"\n );\n assertEq(\n storageDataBefore.supplyRatePerBlock,\n storageDataAfter.supplyRatePerBlock,\n \"Mismatch in supplyRatePerBlock\"\n );\n assertEq(\n storageDataBefore.borrowRatePerBlock,\n storageDataAfter.borrowRatePerBlock,\n \"Mismatch in borrowRatePerBlock\"\n );\n assertEq(\n storageDataBefore.exchangeRateCurrent,\n storageDataAfter.exchangeRateCurrent,\n \"Mismatch in exchangeRateCurrent\"\n );\n assertEq(\n storageDataBefore.totalUnderlyingSupplied,\n storageDataAfter.totalUnderlyingSupplied,\n \"Mismatch in totalUnderlyingSupplied\"\n );\n assertEq(storageDataBefore.balanceOf, storageDataAfter.balanceOf, \"Mismatch in balanceOf\");\n assertEq(\n storageDataBefore.protocolSeizeShareMantissa,\n storageDataAfter.protocolSeizeShareMantissa,\n \"Mismatch in protocolSeizeShareMantissa\"\n );\n assertEq(\n storageDataBefore.feeSeizeShareMantissa,\n storageDataAfter.feeSeizeShareMantissa,\n \"Mismatch in feeSeizeShareMantissa\"\n );\n }\n\n function testCurrentMarkets() public debuggingOnly forkAtBlock(MODE_MAINNET, 10785800) {\n address[] memory ionAddresses = new address[](10);\n\n _upgradeMarket(wethMarket);\n\n ionAddresses[0] = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n ionAddresses[1] = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n ionAddresses[2] = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n ionAddresses[3] = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n ionAddresses[4] = 0x59e710215d45F584f44c0FEe83DA6d43D762D857;\n ionAddresses[5] = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310;\n ionAddresses[6] = 0x49950319aBE7CE5c3A6C90698381b45989C99b46;\n ionAddresses[7] = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18;\n ionAddresses[8] = 0x9a9072302B775FfBd3Db79a7766E75Cf82bcaC0A;\n ionAddresses[9] = 0x19F245782b1258cf3e11Eda25784A378cC18c108;\n\n address ap;\n for (uint i = 0; i < ionAddresses.length; i++) {\n // ap = address(CTokenFirstExtension(ionAddresses[i]).ap());\n ap = address(CTokenFirstExtension(address(wethMarket)).ap());\n emit log_named_address(\"ap\", ap);\n }\n }\n}\n" + }, + "contracts/test/PoolCapsAndBlacklistsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./config/MarketsTest.t.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract PoolCapsAndBlacklistsTest is MarketsTest {\n Comptroller pool;\n ComptrollerFirstExtension asExtension;\n address borrower = 0x28C0208b7144B511C73586Bb07dE2100495e92f3; // ANKR account\n address otherSupplier = 0x2924973E3366690eA7aE3FCdcb2b4e136Cf7f8Cc; // Supplier of ankrBNBAnkrMkt\n ICErc20 ankrBNBAnkrMkt = ICErc20(0x71693C84486B37096192c9942852f542543639Bf);\n ICErc20 ankrBNBMkt = ICErc20(0xb2b01D6f953A28ba6C8f9E22986f5bDDb7653aEa);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n // ankr pool\n pool = Comptroller(payable(0x1851e32F34565cb95754310b031C5a2Fc0a8a905));\n asExtension = ComptrollerFirstExtension(address(pool));\n _upgradeExistingPool(address(pool));\n\n _upgradeMarket(ankrBNBMkt);\n _upgradeMarket(ankrBNBAnkrMkt);\n\n // just some logging\n {\n uint256 borrowedAnkr = ankrBNBMkt.borrowBalanceCurrent(borrower);\n emit log_named_uint(\"ankrBnb borrow balance\", borrowedAnkr);\n uint256 collateralAnkr = ankrBNBAnkrMkt.balanceOf(borrower);\n emit log_named_uint(\"ankrBnb collateral balance of ankrBNB-ANKR\", collateralAnkr);\n\n uint256 borrowedOther = ankrBNBMkt.borrowBalanceCurrent(otherSupplier);\n emit log_named_uint(\"Other supplier borrower balance\", borrowedOther);\n uint256 collateralOther = ankrBNBAnkrMkt.balanceOf(otherSupplier);\n emit log_named_uint(\"Other supplier collateral balance of ankrBNB-ANKR\", collateralOther);\n\n emit log(\"\");\n emit log(\"Before collateral caps\");\n {\n (, , uint256 liq, uint256 sf) = pool.getAccountLiquidity(borrower);\n emit log_named_uint(\"Liq for account 1 before setting BC\", liq); // 1366119859198693075092\n emit log_named_uint(\"Shortfall for account 1 before setting BC\", sf); // 0\n emit log(\"\");\n (, , uint256 liq1, uint256 sf1) = pool.getAccountLiquidity(otherSupplier);\n emit log_named_uint(\"Liq for account 2 before setting BC\", liq1); // 24108891649595017\n emit log_named_uint(\"Shortfall for account 2 before setting BC\", sf1); // 0\n\n assertGt(liq, 0, \"expected positive liquidity\");\n assertGt(liq1, 0, \"expected positive liquidity\");\n emit log(\"\");\n }\n }\n }\n\n // TODO test with the latest block and contracts and/or without the FSL\n function testBorrowCapForCollateralWhitelist() public debuggingOnly forkAtBlock(BSC_MAINNET, 27827185) {\n emit log(\"\");\n emit log(\"Borrow Caps Set\");\n {\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateral(address(ankrBNBMkt), address(ankrBNBAnkrMkt), 1);\n (, , uint256 liqAfter, uint256 sfAfter) = pool.getAccountLiquidity(borrower);\n emit log_named_uint(\"Liq for account 1 after setting BC\", liqAfter);\n emit log_named_uint(\"Shortfall for account 1 after setting BC\", sfAfter);\n (, , uint256 liq1After, uint256 sf1After) = pool.getAccountLiquidity(otherSupplier);\n emit log(\"\");\n emit log_named_uint(\"Liq for account 2 after setting BC\", liq1After);\n emit log_named_uint(\"Shortfall for account 2 after setting BC\", sf1After);\n emit log(\"\");\n\n assertGt(sfAfter, 0, \"expected some shortfall for ankr\");\n assertEq(liq1After, 24108891649595017, \"expected liquidity for account 2 to decrease\");\n }\n\n {\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateralWhitelist(address(ankrBNBMkt), address(ankrBNBAnkrMkt), borrower, true);\n\n emit log(\"\");\n (, , uint256 liqAfterWl, uint256 sfAfterWl) = pool.getAccountLiquidity(borrower);\n (, , uint256 liq1AfterWl, uint256 sf1AfterWl) = pool.getAccountLiquidity(otherSupplier);\n assertEq(sfAfterWl, 0, \"expected shortfall to go back to 0\");\n assertEq(liqAfterWl, 1366119859198693075092, \"expected liq to go back to original\");\n\n // expect liq for second (not whitelisted) account to stay reduced\n assertEq(liq1AfterWl, 24108891649595017, \"expected liq to go back to prev value\");\n }\n }\n\n function testBlacklistBorrowingAgainstCollateralWhitelist() public debuggingOnly fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n vm.prank(pool.admin());\n asExtension._blacklistBorrowingAgainstCollateral(address(ankrBNBMkt), address(ankrBNBAnkrMkt), true);\n\n (, , uint256 liquidityAfterBlacklist, uint256 shortFallAfterBlacklist) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertGt(liquidityBefore - liquidityAfterBlacklist, 0, \"should have lower liquidity after bl\");\n\n vm.prank(pool.admin());\n asExtension._blacklistBorrowingAgainstCollateralWhitelist(\n address(ankrBNBMkt),\n address(ankrBNBAnkrMkt),\n borrower,\n true\n );\n\n (, , uint256 liquidityAfterWhitelist, uint256 shortFallWhitelist) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertEq(shortFallWhitelist, shortFallBefore, \"should have the same sf after wl\");\n assertEq(liquidityAfterWhitelist, liquidityBefore, \"should have the same liquidity after wl\");\n }\n\n function testSupplyCapWhitelist() public fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.startPrank(pool.admin());\n asExtension._setMarketSupplyCaps(markets, asArray(1, 1));\n asExtension._setMintPaused(ankrBNBMkt, false);\n asExtension._setMintPaused(ankrBNBAnkrMkt, false);\n vm.stopPrank();\n\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityBefore, liquidityAfterCap, \"should have the same liquidity after cap\");\n assertEq(shortFallBefore, shortFallAfterCap, \"should have the same shortfall after cap\");\n\n vm.expectRevert(\"!supply cap\");\n pool.mintAllowed(address(ankrBNBMkt), borrower, 2);\n\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(ankrBNBMkt), borrower, true);\n\n require(pool.mintAllowed(address(ankrBNBMkt), borrower, 2) == 0, \"mint not allowed after cap whitelist\");\n }\n\n function testBorrowCapWhitelist() public fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.prank(pool.admin());\n asExtension._setMarketBorrowCaps(markets, asArray(1, 1));\n\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityBefore, liquidityAfterCap, \"should have the same liquidity after cap\");\n assertEq(shortFallBefore, shortFallAfterCap, \"should have the same shortfall after cap\");\n\n vm.expectRevert(\"!borrow:cap\");\n pool.borrowAllowed(address(ankrBNBMkt), borrower, 2);\n\n vm.prank(pool.admin());\n asExtension._borrowCapWhitelist(address(ankrBNBMkt), borrower, true);\n\n require(pool.borrowAllowed(address(ankrBNBMkt), borrower, 2) == 0, \"borrow not allowed after cap whitelist\");\n }\n\n function testSupplyCapValue() public debuggingOnly forkAtBlock(BSC_MAINNET, 27827185) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.prank(pool.admin());\n asExtension._setMarketSupplyCaps(markets, asArray(1, 1));\n\n {\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityAfterCap, 0, \"should have no liquidity after\");\n assertGt(shortFallAfterCap, 0, \"should have positive shortfall after\");\n }\n\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(markets[0]), borrower, true);\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(markets[1]), borrower, true);\n\n {\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityAfterCap, liquidityBefore, \"liquidity after whitelist should match before\");\n assertEq(shortFallAfterCap, shortFallBefore, \"shortfall after whitelist should match before\");\n }\n }\n}\n" + }, + "contracts/test/PoolDirectoryTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract PoolDirectoryTest is BaseTest {\n PoolDirectory fpd;\n\n function afterForkSetUp() internal override {\n address fpdAddress = ap.getAddress(\"PoolDirectory\");\n fpd = PoolDirectory(fpdAddress);\n\n // upgrade to the current changes impl\n {\n PoolDirectory newImpl = new PoolDirectory();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(fpdAddress));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n }\n\n function testDeprecatePool() public fork(BSC_MAINNET) {\n _testDeprecatePool();\n }\n\n function _testDeprecatePool() internal {\n PoolDirectory.Pool[] memory allPools = fpd.getAllPools();\n\n PoolDirectory.Pool memory poolToDeprecate;\n\n // BOMB pool https://app.midascapital.xyz/56/pool/0\n uint256 index = 0;\n\n poolToDeprecate = allPools[index];\n\n vm.prank(fpd.owner());\n fpd._deprecatePool(index);\n\n (, PoolDirectory.Pool[] memory allPoolsAfter) = fpd.getActivePools();\n\n bool poolStillThere = false;\n for (uint256 i = 0; i < allPoolsAfter.length; i++) {\n if (allPoolsAfter[i].comptroller == poolToDeprecate.comptroller) {\n poolStillThere = true;\n break;\n }\n }\n\n assertTrue(!poolStillThere, \"deprecated pool is still there\");\n }\n}\n" + }, + "contracts/test/PoolLensTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./config/BaseTest.t.sol\";\n\nimport { PoolLens } from \"../PoolLens.sol\";\nimport \"../compound/ComptrollerInterface.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\n\ncontract PoolLensTest is BaseTest {\n function testPolygonFPL() public debuggingOnly fork(POLYGON_MAINNET) {\n PoolLens fpl = PoolLens(0xD7225110D8F419b0E8Ad0A536977965E62fB5769);\n fpl.getPoolAssetsWithData(IonicComptroller(0xB08A309eFBFFa41f36A06b2D0C9a4629749b17a2));\n }\n\n function testModeFPL() public debuggingOnly fork(MODE_MAINNET) {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLens fpl = PoolLens(0x611a68618412c2e15A36e3e59C0b979746d87AB8);\n PoolLens.PoolAsset[] memory datas = fpl.getPoolAssetsWithData(pool);\n\n emit log_named_uint(\"ionicFee\", datas[0].ionicFee);\n emit log_named_uint(\"adminFee\", datas[0].adminFee);\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 totalUnderlyingSupplied = markets[i].getTotalUnderlyingSupplied();\n uint256 totalBorrows = markets[i].totalBorrows();\n uint256 totalReserves = markets[i].totalReserves();\n uint256 cash = markets[i].getCash();\n\n emit log(\"\");\n emit log(markets[i].symbol());\n emit log_named_uint(\"totalUnderlyingSupplied\", totalUnderlyingSupplied);\n emit log_named_uint(\"totalBorrows\", totalBorrows);\n emit log_named_uint(\"totalReserves\", totalReserves);\n emit log_named_uint(\"cash\", cash);\n emit log_named_uint(\"reserves + fees\", cash + totalBorrows - totalUnderlyingSupplied);\n\n JumpRateModel irm = JumpRateModel(markets[i].interestRateModel());\n\n emit log_named_uint(\"blocksPerYear\", irm.blocksPerYear());\n\n emit log_named_uint(\n \"borrow rate per year\",\n irm.blocksPerYear() * irm.getBorrowRate(cash, totalBorrows, totalReserves)\n );\n emit log_named_uint(\n \"supply rate per year\",\n irm.blocksPerYear() * irm.getSupplyRate(cash, totalBorrows, totalReserves, 0.1e18)\n );\n }\n }\n\n function testWhitelistsFPL() public debuggingOnly fork(BSC_CHAPEL) {\n PoolLens fpl = PoolLens(0x604805B587C939042120D2e22398f299547A130c);\n fpl.getSupplyCapsDataForPool(IonicComptroller(0x307BEc9d1368A459E9168fa6296C1e69025ab30f));\n }\n}\n" + }, + "contracts/test/ProtocolAdminTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ProtocolAdminTest is BaseTest {\n address public expectedAdmin;\n\n function afterForkSetUp() internal virtual override {}\n\n function _checkIfAdmin(address addr, string memory contractName) internal {\n emit log(\"\");\n emit log(contractName);\n assertEq(addr, expectedAdmin, \"not the same admin address\");\n }\n\n function _checkSafeOwnableAdmin(string memory contractName) internal {\n SafeOwnableUpgradeable ownable = SafeOwnableUpgradeable(ap.getAddress(contractName));\n if (address(ownable) != address(0)) {\n _checkIfAdmin(ownable.owner(), contractName);\n }\n }\n\n function _checkOwnableAdmin(string memory contractName) internal {\n Ownable ownable = Ownable(ap.getAddress(contractName));\n if (address(ownable) != address(0)) {\n _checkIfAdmin(ownable.owner(), contractName);\n }\n }\n\n function testModeProtocolAdmin() public debuggingOnly fork(MODE_MAINNET) {\n expectedAdmin = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2; // gnosis safe multisig contract\n _testProtocolAdmin();\n }\n\n function _testProtocolAdmin() internal {\n //expectedAdmin = ap.owner();\n // safe ownable\n _checkSafeOwnableAdmin(\"FeeDistributor\");\n _checkSafeOwnableAdmin(\"PoolDirectory\");\n _checkSafeOwnableAdmin(\"OptimizedVaultsRegistry\");\n _checkSafeOwnableAdmin(\"AnkrCertificateTokenPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpLinearPoolPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpStablePoolPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpTokenPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpTokenPriceOracleNTokens\");\n _checkSafeOwnableAdmin(\"BalancerRateProviderOracle\");\n _checkSafeOwnableAdmin(\"BNBxPriceOracle\");\n _checkSafeOwnableAdmin(\"CurveLpTokenPriceOracleNoRegistry\");\n _checkSafeOwnableAdmin(\"CurveV2LpTokenPriceOracleNoRegistry\");\n _checkSafeOwnableAdmin(\"CurveV2PriceOracle\");\n _checkSafeOwnableAdmin(\"ERC4626Oracle\");\n _checkSafeOwnableAdmin(\"GammaPoolUniswapV3PriceOracle\");\n _checkSafeOwnableAdmin(\"GammaPoolAlgebraPriceOracle\");\n _checkSafeOwnableAdmin(\"PythPriceOracle\");\n _checkSafeOwnableAdmin(\"SimplePriceOracle\");\n _checkSafeOwnableAdmin(\"SolidlyPriceOracle\");\n _checkSafeOwnableAdmin(\"StkBNBPriceOracle\");\n _checkSafeOwnableAdmin(\"WSTEthPriceOracle\");\n _checkSafeOwnableAdmin(\"NativeUSDPriceOracle\");\n\n // ownable 2 step\n _checkSafeOwnableAdmin(\"LiquidatorsRegistry\");\n _checkSafeOwnableAdmin(\"LeveredPositionFactory\");\n _checkSafeOwnableAdmin(\"OptimizedAPRVault\");\n\n _checkOwnableAdmin(\"DefaultProxyAdmin\");\n _checkOwnableAdmin(\"DiaPriceOracle\");\n _checkOwnableAdmin(\"PoolDirectory\");\n\n assertEq(MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")).admin(), expectedAdmin, \"mpo admin incorrect\");\n\n // check all the pool admins and the flywheels owners\n PoolDirectory poolDir = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n PoolDirectory.Pool[] memory pools = poolDir.getAllPools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n assertEq(pool.admin(), expectedAdmin, \"pool admin does not match\");\n\n address[] memory flywheels = pool.getRewardsDistributors();\n for (uint256 j = 0; j < flywheels.length; j++) {\n assertEq(Ownable(flywheels[j]).owner(), expectedAdmin, \"flywheel owner not the admin\");\n }\n }\n }\n}\n" + }, + "contracts/test/UpgradesBaseTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20RewardsDelegate } from \"../compound/CErc20RewardsDelegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nabstract contract UpgradesBaseTest is BaseTest {\n FeeDistributor internal ffd;\n ComptrollerFirstExtension internal poolExt;\n CTokenFirstExtension internal marketExt;\n\n function afterForkSetUp() internal virtual override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n poolExt = new ComptrollerFirstExtension();\n marketExt = new CTokenFirstExtension();\n }\n\n function _upgradePoolWithExtension(Unitroller asUnitroller) internal {\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\n\n // instantiate the new implementation\n Comptroller newComptrollerImplementation = new Comptroller();\n vm.startPrank(ffd.owner());\n address comptrollerImplementationAddress = address(newComptrollerImplementation);\n ffd._setLatestComptrollerImplementation(address(0), comptrollerImplementationAddress);\n // add the extension to the auto upgrade config\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = poolExt;\n extensions[1] = newComptrollerImplementation;\n ffd._setComptrollerExtensions(comptrollerImplementationAddress, extensions);\n vm.stopPrank();\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(\n DiamondExtension(comptrollerImplementationAddress),\n DiamondExtension(asUnitroller.comptrollerImplementation())\n );\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function _upgradeMarketWithExtension(ICErc20 market) internal {\n // instantiate the new implementation\n CErc20Delegate newImpl;\n bytes memory becomeImplData = \"\";\n if (compareStrings(\"CErc20Delegate\", market.contractType())) {\n newImpl = new CErc20Delegate();\n } else if (compareStrings(\"CErc20PluginDelegate\", market.contractType())) {\n newImpl = new CErc20PluginDelegate();\n becomeImplData = abi.encode(address(0));\n } else if (compareStrings(\"CErc20RewardsDelegate\", market.contractType())) {\n newImpl = new CErc20RewardsDelegate();\n becomeImplData = abi.encode(address(0));\n } else {\n newImpl = new CErc20PluginRewardsDelegate();\n becomeImplData = abi.encode(address(0));\n }\n\n // set the new delegate as the latest\n vm.startPrank(ffd.owner());\n ffd._setLatestCErc20Delegate(newImpl.delegateType(), address(newImpl), abi.encode(address(0)));\n\n // add the extension to the auto upgrade config\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = marketExt;\n cErc20DelegateExtensions[1] = newImpl;\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\n vm.stopPrank();\n\n vm.stopPrank();\n // upgrade to the new delegate\n vm.prank(address(ffd));\n market._setImplementationSafe(address(newImpl), becomeImplData);\n }\n}\n" + }, + "contracts/test/veION/contracts/Bribes/BribeRewards.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"forge-std/Test.sol\";\nimport \"../../../../veION/BribeRewards.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../../config/BaseTest.t.sol\";\nimport \"../../../../veION/Voter.sol\";\nimport \"../../../../oracles/MasterPriceOracle.sol\";\nimport { SimplePriceOracle } from \"../../../../oracles/default/SimplePriceOracle.sol\";\nimport \"../../../../veION/libraries/IonicTimeLibrary.sol\";\n\ncontract BribeRewardsTest is BaseTest {\n MockERC20 bribeTokenA;\n MockERC20 bribeTokenB;\n MockERC20 bribeTokenC;\n BribeRewards bribeRewards;\n SimplePriceOracle simpleOracle;\n address ve = address(0x123);\n address voter = address(0x456);\n address rewardToken = 0x18470019bF0E94611f15852F7e93cf5D65BC34CA;\n address lpTokenA = address(0x5);\n address lpTokenB = address(0x6);\n uint256 tokenId = 1;\n uint256 amount = 1000 ether;\n address user = address(0x789);\n\n function setUp() public {\n bribeRewards = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), ve)\n )\n )\n );\n\n address[] memory mockLpTokens = new address[](2);\n mockLpTokens[0] = lpTokenA;\n mockLpTokens[1] = lpTokenB;\n vm.mockCall(address(voter), abi.encodeWithSelector(IVoter.getAllLpRewardTokens.selector), abi.encode(mockLpTokens));\n\n bribeTokenA = new MockERC20(\"Bribe Token A\", \"BTA\", 18);\n bribeTokenB = new MockERC20(\"Bribe Token B\", \"BTB\", 18);\n bribeTokenC = new MockERC20(\"Bribe Token C\", \"BTC\", 18);\n\n address[] memory bribeTokens = new address[](3);\n bribeTokens[0] = address(bribeTokenA);\n bribeTokens[1] = address(bribeTokenB);\n bribeTokens[2] = address(bribeTokenC);\n\n for (uint256 i = 0; i < bribeTokens.length; i++) {\n vm.mockCall(\n address(voter),\n abi.encodeWithSelector(IVoter.isWhitelistedToken.selector, bribeTokens[i]),\n abi.encode(true)\n );\n\n vm.mockCall(ve, abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenId), abi.encode(user));\n }\n }\n\n function test_deposit_VoterCanDeposit() public {\n vm.prank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n\n uint256 balance = bribeRewards.balanceOf(tokenId, lpTokenA);\n assertEq(balance, amount, \"Balance should be equal to deposited amount\");\n uint256 totalSupply = bribeRewards.totalSupply(lpTokenA);\n assertEq(totalSupply, amount, \"Total supply should be equal to deposited amount\");\n }\n\n function test_withdraw_VoterCanWithdraw() public {\n vm.prank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n\n vm.prank(address(voter));\n bribeRewards.withdraw(lpTokenA, amount, tokenId);\n\n uint256 balance = bribeRewards.balanceOf(tokenId, lpTokenA);\n assertEq(balance, 0, \"Balance should be zero after withdrawal\");\n }\n\n function test_getReward_VoterCanGetReward() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1_000_000 ether);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(bribeTokenA);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n bribeRewards.getReward(tokenId, tokens);\n vm.stopPrank();\n\n uint256 lastEarned = bribeRewards.lastEarn(tokens[0], tokenId);\n assertEq(lastEarned, block.timestamp, \"Last earned timestamp should be updated\");\n }\n\n function test_earned_EarnedShouldBeCorrect() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n bribeRewards.deposit(lpTokenB, amount, tokenId);\n vm.stopPrank();\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n vm.warp(block.timestamp + 1 weeks);\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n emit log_named_uint(\"Epoch Start\", IonicTimeLibrary.epochStart(block.timestamp));\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 2e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 8e18);\n vm.warp(block.timestamp + 1 weeks);\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n emit log_named_uint(\"Epoch Start\", IonicTimeLibrary.epochStart(block.timestamp));\n\n uint256 earnedAmount = bribeRewards.earned(address(bribeTokenA), tokenId);\n emit log(\"--------------------------------------END EARNED--------------------------------------\");\n emit log_named_uint(\"Earned amount\", earnedAmount);\n\n assertEq(earnedAmount, 2000 ether, \"Earned amount should be 2000 ether\");\n }\n\n function test_earned_MultipleBribeRewardsSandbox() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenB.mint(address(this), 1_000_000 ether);\n bribeTokenB.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenC.mint(address(this), 1_000_000 ether);\n bribeTokenC.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n vm.warp(block.timestamp + 3 days);\n bribeRewards.deposit(lpTokenB, amount, tokenId);\n vm.stopPrank();\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\n console.log(\"----------------------------------------------------------------\");\n emit log_named_uint(\"Epoch Start\", epochStart);\n\n uint256 priorBalanceIndexA = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n uint256 priorBalanceIndexB = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenB, block.timestamp);\n BribeRewards.Checkpoint memory checkpointA = bribeRewards.getCheckpoint(tokenId, lpTokenA, priorBalanceIndexA);\n BribeRewards.Checkpoint memory checkpointB = bribeRewards.getCheckpoint(tokenId, lpTokenB, priorBalanceIndexB);\n\n emit log_named_uint(\"Prior Balance Index for lpTokenA\", priorBalanceIndexA);\n emit log_named_uint(\"Prior Balance Index for lpTokenB\", priorBalanceIndexB);\n\n emit log_named_uint(\"Checkpoint lpTokenA Timestamp\", checkpointA.timestamp);\n emit log_named_uint(\"Checkpoint lpTokenA BalanceOf\", checkpointA.balanceOf);\n emit log_named_uint(\"Checkpoint lpTokenB Timestamp\", checkpointB.timestamp);\n emit log_named_uint(\"Checkpoint lpTokenB BalanceOf\", checkpointB.balanceOf);\n\n uint256 tokenRewardsEpochA = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenA), epochStart);\n uint256 tokenRewardsEpochB = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenB), epochStart);\n uint256 tokenRewardsEpochC = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenC), epochStart);\n\n emit log_named_uint(\"Token Rewards for bribeTokenA in current epoch\", tokenRewardsEpochA);\n emit log_named_uint(\"Token Rewards for bribeTokenB in current epoch\", tokenRewardsEpochB);\n emit log_named_uint(\"Token Rewards for bribeTokenC in current epoch\", tokenRewardsEpochC);\n\n uint256 historicalPriceA = bribeRewards.historicalPrices(lpTokenA, epochStart);\n uint256 historicalPriceB = bribeRewards.historicalPrices(lpTokenB, epochStart);\n\n emit log_named_uint(\"Historical Price for lpTokenA in current epoch\", historicalPriceA);\n emit log_named_uint(\"Historical Price for lpTokenB in current epoch\", historicalPriceB);\n console.log(\"----------------------------------------------------------------\");\n\n vm.warp(block.timestamp + 4 days - 2);\n\n // uint256 earnedA = bribeRewards.earned(address(bribeTokenA), tokenId);\n // uint256 earnedB = bribeRewards.earned(address(bribeTokenB), tokenId);\n // uint256 earnedC = bribeRewards.earned(address(bribeTokenC), tokenId);\n\n // emit log_named_uint(\"Earned rewards for bribeTokenA\", earnedA);\n // emit log_named_uint(\"Earned rewards for bribeTokenB\", earnedB);\n // emit log_named_uint(\"Earned rewards for bribeTokenC\", earnedC);\n\n // START OF NEW EPOCH\n vm.warp(block.timestamp + 1); //604800\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2e18);\n\n vm.warp(block.timestamp + 3 days);\n vm.warp(block.timestamp + 4 days - 1);\n vm.warp(block.timestamp + 1);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2e18);\n\n vm.warp(block.timestamp + 7 days);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.1e18);\n\n vm.warp(block.timestamp + 7 days);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.2e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.2e18);\n vm.warp(block.timestamp + 7 days);\n\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18);\n\n vm.warp(block.timestamp + 7 days);\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18);\n\n vm.startPrank(address(voter));\n bribeRewards.withdraw(lpTokenA, 1000 ether, tokenId);\n bribeRewards.withdraw(lpTokenB, 1000 ether, tokenId);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 7 days);\n\n for (uint256 i = 0; i < 5; i++) {\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18 + (i * 0.1e18));\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18 + (i * 0.1e18));\n\n vm.warp(block.timestamp + 7 days);\n }\n\n uint256 earnedA = bribeRewards.earned(address(bribeTokenA), tokenId);\n emit log_named_uint(\"Earned rewards for bribeTokenA\", earnedA);\n\n assertEq(earnedA, 5999999999999999999996, \"EarnedA assertion incorrect\");\n\n uint256 priorBalanceIndex = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n emit log_named_uint(\"Prior Balance Index for current timestamp and lpTokenA\", priorBalanceIndex);\n BribeRewards.Checkpoint memory checkpoint = bribeRewards.getCheckpoint(tokenId, lpTokenA, priorBalanceIndex);\n emit log_named_uint(\"Prior Balance Index for current timestamp and lpTokenA\", priorBalanceIndex);\n emit log_named_uint(\"Checkpoint Timestamp\", checkpoint.timestamp);\n emit log_named_uint(\"Checkpoint BalanceOf\", checkpoint.balanceOf);\n }\n\n function test_earned_PriorBalanceIndexShouldRemainConstantIfDepositInSameEpoch() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenB.mint(address(this), 1_000_000 ether);\n bribeTokenB.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenC.mint(address(this), 1_000_000 ether);\n bribeTokenC.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenA, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenA, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 10 weeks);\n\n uint256 priorBalanceIndexA = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n uint256 priorBalanceIndexB = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenB, block.timestamp);\n\n emit log_named_uint(\"Prior Balance Index for lpTokenA\", priorBalanceIndexA);\n emit log_named_uint(\"Prior Balance Index for lpTokenB\", priorBalanceIndexB);\n\n assertEq(priorBalanceIndexA, 0, \"Prior Balance Index for lpTokenA should be 0\");\n assertEq(priorBalanceIndexB, 0, \"Prior Balance Index for lpTokenB should be 0\");\n }\n\n function test_earned_MultipleDepositors() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks); // Advance time by one epoch (assuming 1 week per epoch)\n }\n\n uint256 totalSupplyA = bribeRewards.totalSupply(lpTokenA);\n uint256 totalSupplyB = bribeRewards.totalSupply(lpTokenB);\n emit log_named_uint(\"Total Supply for lpTokenA\", totalSupplyA / 1e18);\n emit log_named_uint(\"Total Supply for lpTokenB\", totalSupplyB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n vm.startPrank(user);\n\n uint256 balanceA = bribeRewards.balanceOf(i, lpTokenA);\n uint256 balanceB = bribeRewards.balanceOf(i, lpTokenB);\n\n emit log_named_uint(\"Token ID\", i);\n emit log_named_uint(string(abi.encodePacked(\"Balance of user for lpTokenA\")), balanceA / 1e18);\n emit log_named_uint(string(abi.encodePacked(\"Balance of user for lpTokenB\")), balanceB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n vm.stopPrank();\n }\n\n uint256 totalBribeTokenA = bribeTokenA.balanceOf(address(bribeRewards));\n uint256 totalBribeTokenB = bribeTokenB.balanceOf(address(bribeRewards));\n uint256 totalBribeTokenC = bribeTokenC.balanceOf(address(bribeRewards));\n\n emit log_named_uint(\"Total Bribe Token A in Contract\", totalBribeTokenA / 1e18);\n emit log_named_uint(\"Total Bribe Token B in Contract\", totalBribeTokenB / 1e18);\n emit log_named_uint(\"Total Bribe Token C in Contract\", totalBribeTokenC / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n address randomUser = address(0x1234);\n uint256 tokenIdToMock = tokenIds[0];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdToMock),\n abi.encode(randomUser)\n );\n\n address[] memory rewardTokens = new address[](3);\n rewardTokens[0] = address(bribeTokenA);\n rewardTokens[1] = address(bribeTokenB);\n rewardTokens[2] = address(bribeTokenC);\n\n vm.prank(voter);\n bribeRewards.getReward(tokenIdToMock, rewardTokens);\n\n uint256 balanceForTokenIdToMockA = bribeRewards.balanceOf(tokenIdToMock, lpTokenA);\n uint256 balanceForTokenIdToMockB = bribeRewards.balanceOf(tokenIdToMock, lpTokenB);\n\n emit log_named_uint(\"Balance for tokenIdToMock for lpTokenA\", balanceForTokenIdToMockA / 1e18);\n emit log_named_uint(\"Balance for tokenIdToMock for lpTokenB\", balanceForTokenIdToMockB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n uint256 userBribeTokenABalance = bribeTokenA.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token A Balance after Redemption\", userBribeTokenABalance / 1e18);\n\n uint256 expectedRewardA = (totalBribeTokenA * 5) / 100;\n uint256 actualRewardA = userBribeTokenABalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token A)\", expectedRewardA / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token A\", actualRewardA / 1e18);\n\n assertApproxEqAbs(actualRewardA, expectedRewardA, 50 ether, \"Bribe Token A reward does not match expected value\");\n\n uint256 userBribeTokenBBalance = bribeTokenB.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token B Balance after Redemption\", userBribeTokenBBalance / 1e18);\n\n uint256 expectedRewardB = (totalBribeTokenB * 5) / 100;\n uint256 actualRewardB = userBribeTokenBBalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token B)\", expectedRewardB / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token B\", actualRewardB / 1e18);\n\n assertApproxEqAbs(actualRewardB, expectedRewardB, 50 ether, \"Bribe Token B reward does not match expected value\");\n\n uint256 userBribeTokenCBalance = bribeTokenC.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token C Balance after Redemption\", userBribeTokenCBalance / 1e18);\n\n uint256 expectedRewardC = (totalBribeTokenC * 5) / 100;\n uint256 actualRewardC = userBribeTokenCBalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token C)\", expectedRewardC / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token C\", actualRewardC / 1e18);\n\n assertApproxEqAbs(actualRewardC, expectedRewardC, 50 ether, \"Bribe Token C reward does not match expected value\");\n }\n\n function test_earned_UserWithdraws() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks); //\n }\n\n uint256 tokenIdToWithdraw = tokenIds[0];\n for (uint256 j = 0; j < lpTokens.length; j++) {\n address selectedLpToken = lpTokens[j];\n uint256 balanceBeforeWithdraw = bribeRewards.balanceOf(tokenIdToWithdraw, selectedLpToken);\n\n vm.prank(address(voter));\n bribeRewards.withdraw(selectedLpToken, balanceBeforeWithdraw, tokenIdToWithdraw);\n }\n uint256 tokenIdNotWithdrawn = tokenIds[1];\n\n uint256 earnedForTokenIdNotWithdrawn = bribeRewards.earned(address(bribeTokenA), tokenIdNotWithdrawn);\n emit log_named_uint(\"Earned for Bribe Token A for Token ID not withdrawn\", earnedForTokenIdNotWithdrawn / 1e18);\n\n uint256 totalEarnedABefore = bribeRewards.earned(address(bribeTokenA), tokenIdToWithdraw);\n emit log_named_uint(\"Total Earned for Bribe Token A after Withdraw\", totalEarnedABefore / 1e18);\n\n for (uint256 epoch = 0; epoch < 30; epoch++) {\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 totalEarnedAAfter = bribeRewards.earned(address(bribeTokenA), tokenIdToWithdraw);\n emit log_named_uint(\"Total Earned for Bribe Token A after timeskip\", totalEarnedAAfter / 1e18);\n\n assertEq(\n totalEarnedABefore,\n totalEarnedAAfter,\n \"Total earned for Bribe Token A should be the same before and after.\"\n );\n\n uint256 earnedForNotWithdrawn = bribeRewards.earned(address(bribeTokenA), tokenIdNotWithdrawn);\n emit log_named_uint(\"Earned for Bribe Token A for Token ID that didn't withdraw\", earnedForNotWithdrawn / 1e18);\n\n assertGt(\n earnedForNotWithdrawn,\n totalEarnedAAfter,\n \"Token ID that did not withdraw should have more earned than the token ID that withdrew.\"\n );\n }\n\n function test_earned_RewardCalculationResetsAfterCollectingReward() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 tokenIdThatClaims = tokenIds[0];\n uint256 tokenIdThatDontClaim = tokenIds[1];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdThatClaims),\n abi.encode(address(this))\n );\n\n address[] memory bribeTokens = new address[](3);\n bribeTokens[0] = address(bribeTokenA);\n bribeTokens[1] = address(bribeTokenB);\n bribeTokens[2] = address(bribeTokenC);\n vm.prank(address(voter));\n bribeRewards.getReward(tokenIdThatClaims, bribeTokens);\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 earnedAfterClaim = bribeRewards.earned(address(bribeTokenA), tokenIdThatClaims);\n emit log_named_uint(\"Earned for Bribe Token A after claiming and 10 more epochs\", earnedAfterClaim / 1e18);\n\n uint256 earnedNeverClaimed = bribeRewards.earned(address(bribeTokenA), tokenIdThatDontClaim);\n emit log_named_uint(\"Earned for Bribe Token A for user who never claimed\", earnedNeverClaimed / 1e18);\n\n assertGt(\n earnedNeverClaimed,\n earnedAfterClaim,\n \"User who never claimed should have more earned than the user who claimed.\"\n );\n }\n\n function test_earned_ClaimOnlyOneToken() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n address[] memory tokensToClaim = new address[](1);\n tokensToClaim[0] = address(bribeTokenA);\n\n uint256 tokenIdToClaim = tokenIds[0];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdToClaim),\n abi.encode(address(this))\n );\n\n vm.prank(address(voter));\n bribeRewards.getReward(tokenIdToClaim, tokensToClaim);\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 earnedBribeA = bribeRewards.earned(address(bribeTokenA), tokenIdToClaim);\n uint256 earnedBribeB = bribeRewards.earned(address(bribeTokenB), tokenIdToClaim);\n uint256 earnedBribeC = bribeRewards.earned(address(bribeTokenC), tokenIdToClaim);\n\n emit log_named_uint(\"Earned for Bribe Token A\", earnedBribeA / 1e18);\n emit log_named_uint(\"Earned for Bribe Token B\", earnedBribeB / 1e18);\n emit log_named_uint(\"Earned for Bribe Token C\", earnedBribeC / 1e18);\n\n assertGt(earnedBribeB, earnedBribeA, \"Bribe Token B earned should be greater than Bribe Token A earned.\");\n assertGt(earnedBribeC, earnedBribeA, \"Bribe Token C earned should be greater than Bribe Token A earned.\");\n }\n\n function _performDeposits(\n address[] memory lpTokens,\n uint256[] memory tokenIds,\n uint256 minDepositAmount,\n uint256 maxDepositAmount\n ) internal {\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n for (uint256 j = 0; j < lpTokens.length; j++) {\n address selectedLpToken = lpTokens[j];\n uint256 randomAmount = minDepositAmount +\n (uint256(keccak256(abi.encodePacked(block.timestamp, i, j))) % (maxDepositAmount - minDepositAmount));\n vm.prank(address(voter));\n bribeRewards.deposit(selectedLpToken, randomAmount, tokenIds[i]);\n }\n }\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/ClaimBribes.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../../../../veION/Voter.sol\";\nimport \"../../../../veION/BribeRewards.sol\";\nimport \"./utils/VoterUtils.sol\";\n\ncontract ClaimBribesTest is VoterTest {\n BribeRewards realBribeEthSupply;\n BribeRewards realBribeEthBorrow;\n MockERC20 bribeTokenA;\n MockERC20 bribeTokenB;\n MockERC20 bribeTokenC;\n\n function setUp() public {\n _setUp();\n bribeTokenA = new MockERC20(\"Bribe Token A\", \"BTA\", 18);\n bribeTokenB = new MockERC20(\"Bribe Token B\", \"BTB\", 18);\n\n realBribeEthSupply = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), address(ve))\n )\n )\n );\n\n realBribeEthBorrow = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), address(ve))\n )\n )\n );\n\n address[] memory rewardAccumulatorsForBribes = new address[](2);\n address[] memory bribes = new address[](2);\n\n rewardAccumulatorsForBribes[0] = voter.marketToRewardAccumulators(ethMarket, IVoter.MarketSide.Supply);\n rewardAccumulatorsForBribes[1] = voter.marketToRewardAccumulators(ethMarket, IVoter.MarketSide.Borrow);\n bribes[0] = address(realBribeEthSupply);\n bribes[1] = address(realBribeEthBorrow);\n\n voter.whitelistToken(address(bribeTokenA), true);\n voter.whitelistToken(address(bribeTokenB), true);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n }\n\n function test_claimBribes() public {\n // Mint and approve bribe tokens\n bribeTokenA.mint(address(this), 1000 ether);\n bribeTokenA.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenB.mint(address(this), 1000 ether);\n bribeTokenB.approve(address(realBribeEthSupply), 1000 ether);\n\n // Notify reward amounts\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n // Deposit bribes\n address[] memory tokens = new address[](2);\n tokens[0] = address(bribeTokenA);\n tokens[1] = address(bribeTokenB);\n\n vm.startPrank(address(voter));\n realBribeEthSupply.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthSupply.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n vm.stopPrank();\n\n // Claim bribes\n address[] memory bribes = new address[](1);\n bribes[0] = address(realBribeEthSupply);\n address[][] memory rewardTokens = new address[][](1);\n rewardTokens[0] = tokens;\n\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(user);\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n\n // Check balances\n uint256 balanceA = bribeTokenA.balanceOf(user);\n uint256 balanceB = bribeTokenB.balanceOf(user);\n\n assertEq(balanceA, 1000 ether, \"User should have claimed 1000 ether of bribeTokenA\");\n assertEq(balanceB, 1000 ether, \"User should have claimed 1000 ether of bribeTokenB\");\n }\n\n function test_claimBribesMultipleBribes() public {\n // Mint and approve bribe tokens for both bribe contracts\n bribeTokenA.mint(address(this), 2000 ether);\n bribeTokenA.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenA.approve(address(realBribeEthBorrow), 1000 ether);\n\n bribeTokenB.mint(address(this), 2000 ether);\n bribeTokenB.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenB.approve(address(realBribeEthBorrow), 1000 ether);\n\n // Notify reward amounts for both bribe contracts\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthBorrow.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthBorrow.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n realBribeEthBorrow.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthBorrow.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n // Deposit bribes into both bribe contracts\n address[] memory tokens = new address[](2);\n tokens[0] = address(bribeTokenA);\n tokens[1] = address(bribeTokenB);\n\n vm.startPrank(address(voter));\n realBribeEthSupply.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthSupply.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n realBribeEthBorrow.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthBorrow.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n vm.stopPrank();\n\n // Claim bribes from both bribe contracts\n address[] memory bribes = new address[](2);\n bribes[0] = address(realBribeEthSupply);\n bribes[1] = address(realBribeEthBorrow);\n address[][] memory rewardTokens = new address[][](2);\n rewardTokens[0] = tokens;\n rewardTokens[1] = tokens;\n\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(user);\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n\n // Check balances\n uint256 balanceA = bribeTokenA.balanceOf(user);\n uint256 balanceB = bribeTokenB.balanceOf(user);\n\n assertEq(balanceA, 2000 ether, \"User should have claimed 2000 ether of bribeTokenA\");\n assertEq(balanceB, 2000 ether, \"User should have claimed 2000 ether of bribeTokenB\");\n }\n\n function test_claimBribes_RevertIfNotOwner() public {\n address notOwner = address(0xABC);\n\n address[] memory bribes = new address[](2);\n bribes[0] = address(0x123); // Dummy address for bribe contract\n bribes[1] = address(0x456); // Dummy address for another bribe contract\n\n address[][] memory rewardTokens = new address[][](2);\n rewardTokens[0] = new address[](2);\n rewardTokens[0][0] = address(0x789); // Dummy address for reward token A\n rewardTokens[0][1] = address(0xABC); // Dummy address for reward token B\n\n rewardTokens[1] = new address[](2);\n rewardTokens[1][0] = address(0xDEF); // Dummy address for reward token A\n rewardTokens[1][1] = address(0xFED); // Dummy address for reward token B\n\n vm.startPrank(notOwner);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n vm.stopPrank();\n }\n\n function test_claimBribes_RevertIfUnequalLengths() public {\n address[] memory bribes = new address[](2);\n bribes[0] = address(0x123); // Dummy address for bribe contract\n bribes[1] = address(0x456); // Dummy address for another bribe contract\n\n address[][] memory rewardTokens = new address[][](1); // Intentionally unequal length\n rewardTokens[0] = new address[](2);\n rewardTokens[0][0] = address(0x789); // Dummy address for reward token A\n rewardTokens[0][1] = address(0xABC); // Dummy address for reward token B\n\n vm.startPrank(user);\n vm.expectRevert(abi.encodeWithSignature(\"UnequalLengths()\"));\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/DistributeRewards.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\nimport { PoolDirectory } from \"../../../../PoolDirectory.sol\";\nimport { EmissionsManager } from \"../../../../EmissionsManager.sol\";\nimport { IonicFlywheelCore } from \"../../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicFlywheel } from \"../../../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicFlywheelBorrow } from \"../../../../ionic/strategies/flywheel/IonicFlywheelBorrow.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IFlywheelBooster } from \"../../../../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../../../../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { IIonicFlywheelBorrowBooster } from \"../../../../ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol\";\nimport { IonicFlywheelBorrowBooster } from \"../../../../ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol\";\nimport { IonicFlywheelDynamicRewards } from \"../../../../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol\";\nimport { Comptroller } from \"../../../../compound/Comptroller.sol\";\nimport { RewardAccumulator } from \"../../../../veION/RewardAccumulator.sol\";\nimport { CErc20RewardsDelegate } from \"../../../../compound/CErc20RewardsDelegate.sol\";\n\ncontract DistributeRewards is VoterTest {\n address owner = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address ion = 0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5;\n address weth = 0x4200000000000000000000000000000000000006;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address ionWhale = 0x7862Ba142511eEf11a5a8b179DB4F53AC115AB59;\n address baseWETHWhale = 0x0250f06fc76297Fe28D0981F0566F1c0445B3cFE;\n address baseUSDCWhale = 0x0B0A5886664376F59C351ba3f598C8A8B4D0A6f3;\n address baseIonWethWhale = 0xf018B923bEbdef7a8124371B322D7E29a08c3198;\n address[] markets;\n address[] uniqMarkets;\n IVoter.MarketSide[] sides;\n IVoter.MarketSide[] borrowSides;\n IVoter.MarketSide[] supplySides;\n uint256[] weights;\n uint256 rewardAmount = 1_000_000 * 1e18;\n uint256 ONE = 1e18;\n address[] rewardAccumulators;\n address[] supplyRewardAccumulators;\n address[] borrowRewardAccumulators;\n\n CErc20RewardsDelegate ionUsdcMarket = CErc20RewardsDelegate(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0);\n PoolDirectory poolDirectory = PoolDirectory(0xE1A3006be645a80F206311d9f18C866c204bA02f);\n IonicFlywheel flywheelSupply;\n IonicFlywheelBorrow flywheelBorrow;\n IonicFlywheelDynamicRewards flywheelRewardsBorrow;\n IonicFlywheelDynamicRewards flywheelRewardsSupply;\n EmissionsManager emissionsManager;\n address protocalAddress = address(0x123);\n bytes bytecode = hex\"deadbeef\";\n IIonicFlywheelBorrowBooster flywheelBooster;\n uint32 constant ONE_WEEK = 1 weeks;\n Comptroller comptroller = Comptroller(0x05c9C6417F246600f8f5f49fcA9Ee991bfF73D13);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n markets = new address[](4);\n sides = new IVoter.MarketSide[](4);\n weights = new uint256[](4);\n\n markets[0] = ethMarket;\n sides[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n markets[1] = ethMarket;\n sides[1] = IVoter.MarketSide.Borrow;\n weights[1] = 100;\n\n markets[2] = btcMarket;\n sides[2] = IVoter.MarketSide.Supply;\n weights[2] = 100;\n\n markets[3] = btcMarket;\n sides[3] = IVoter.MarketSide.Borrow;\n weights[3] = 100;\n\n UniswapLpTokenPriceOracle uniswapLpTokenPriceOracleIonWeth = new UniswapLpTokenPriceOracle(address(weth));\n UniswapLpTokenPriceOracle uniswapLpTokenPriceOracleWethAero = new UniswapLpTokenPriceOracle(address(weth));\n address[] memory underlyings = new address[](2);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\n\n underlyings[0] = address(ionWeth5050lPAero);\n oracles[0] = BasePriceOracle(address(uniswapLpTokenPriceOracleIonWeth));\n underlyings[1] = address(wethAero5050LPAero);\n oracles[1] = BasePriceOracle(address(uniswapLpTokenPriceOracleWethAero));\n\n vm.prank(mpo.admin());\n mpo.add(underlyings, oracles);\n\n vm.startPrank(owner);\n emissionsManager = EmissionsManager(\n address(\n new TransparentUpgradeableProxy(\n address(new EmissionsManager()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n EmissionsManager.initialize.selector,\n poolDirectory,\n protocalAddress,\n ERC20(ion),\n 2500,\n bytecode\n )\n )\n )\n );\n\n emissionsManager.setVeIon(IveION(ve));\n\n // Deploy borrow flywheels\n flywheelBooster = new IonicFlywheelBorrowBooster();\n\n flywheelBorrow = IonicFlywheelBorrow(\n address(\n new TransparentUpgradeableProxy(\n address(new IonicFlywheelBorrow()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n IonicFlywheelCore.initialize.selector,\n ERC20(ion),\n IFlywheelRewards(address(0)),\n IFlywheelBooster(address(flywheelBooster)),\n owner\n )\n )\n )\n );\n // Deploy supply flywheels\n flywheelSupply = IonicFlywheel(\n address(\n new TransparentUpgradeableProxy(\n address(new IonicFlywheel()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n IonicFlywheelCore.initialize.selector,\n ERC20(ion),\n IFlywheelRewards(address(0)),\n IFlywheelBooster(address(0)),\n owner\n )\n )\n )\n );\n\n flywheelRewardsBorrow = new IonicFlywheelDynamicRewards(IonicFlywheelCore(address(flywheelBorrow)), ONE_WEEK);\n flywheelBorrow.setFlywheelRewards(IFlywheelRewards(address(flywheelRewardsBorrow)));\n\n flywheelRewardsSupply = new IonicFlywheelDynamicRewards(IonicFlywheelCore(address(flywheelSupply)), ONE_WEEK);\n flywheelSupply.setFlywheelRewards(IFlywheelRewards(address(flywheelRewardsSupply)));\n\n flywheelSupply.setEmissionsManager(emissionsManager);\n flywheelBorrow.setEmissionsManager(emissionsManager);\n flywheelSupply.updateFeeSettings(0, protocalAddress);\n flywheelBorrow.updateFeeSettings(0, protocalAddress);\n\n uniqMarkets = new address[](2);\n uniqMarkets[0] = markets[0];\n uniqMarkets[1] = markets[2];\n\n supplyRewardAccumulators = new address[](2);\n borrowRewardAccumulators = new address[](2);\n\n for (uint256 i = 0; i < uniqMarkets.length; i++) {\n flywheelBorrow.addStrategyForRewards(ERC20(uniqMarkets[i]));\n flywheelSupply.addStrategyForRewards(ERC20(uniqMarkets[i]));\n supplyRewardAccumulators[i] = voter.marketToRewardAccumulators(uniqMarkets[i], IVoter.MarketSide.Supply);\n borrowRewardAccumulators[i] = voter.marketToRewardAccumulators(uniqMarkets[i], IVoter.MarketSide.Borrow);\n }\n\n flywheelRewardsBorrow.setRewardAccumulators(uniqMarkets, borrowRewardAccumulators);\n flywheelRewardsSupply.setRewardAccumulators(uniqMarkets, supplyRewardAccumulators);\n vm.stopPrank();\n\n vm.startPrank(address(0));\n for (uint256 i = 0; i < uniqMarkets.length; i++) {\n RewardAccumulator(supplyRewardAccumulators[i]).approve(ion, address(flywheelRewardsSupply));\n RewardAccumulator(borrowRewardAccumulators[i]).approve(ion, address(flywheelRewardsBorrow));\n }\n vm.stopPrank();\n\n vm.startPrank(comptroller.admin());\n comptroller._addRewardsDistributor(address(flywheelBorrow));\n comptroller._addRewardsDistributor(address(flywheelSupply));\n vm.stopPrank();\n }\n\n function test_distributeRewards_RewardsCanBeDistributed() public forkAtBlock(BASE_MAINNET, 23248915) {\n vm.prank(baseUser);\n voter.vote(baseTokenIdSingleLp, markets, sides, weights);\n uint256 ionPrice = mpo.price(ion);\n uint256 wethPrice = mpo.price(weth);\n\n uint256 ionWethLpPrice = mpo.price(ionWeth5050lPAero);\n\n console.log(\"ION Price:\", ionPrice);\n console.log(\"WETH Price:\", wethPrice);\n console.log(\"ION-WETH LP Price:\", ionWethLpPrice);\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n uint256 expectedBalance = rewardAmount / 4;\n assertEq(ionBalance, expectedBalance, \"Each reward accumulator should have a quarter of the tokens\");\n }\n }\n\n function test_distributeRewards_MultiLPAndVoters() public forkAtBlock(BASE_MAINNET, 23248915) {\n address[] memory voters = new address[](20);\n uint256[] memory tokenIds = new uint256[](20);\n uint256 totalWeight = 0;\n for (uint256 i = 0; i < voters.length; i++) {\n voters[i] = address(uint160(uint256(keccak256(abi.encodePacked(i, block.timestamp)))));\n\n uint256 ionWethAmount = 10 + (uint256(keccak256(abi.encodePacked(i, block.timestamp))) % 11);\n uint256 wethAeroAmount = 10 + (uint256(keccak256(abi.encodePacked(i, block.timestamp, uint256(1)))) % 11);\n\n tokenIds[i] = _lockMultiLpFork(voters[i], ionWethAmount * 1e18, wethAeroAmount * 1e18);\n\n uint256[] memory weights = new uint256[](4);\n for (uint256 j = 0; j < weights.length; j++) {\n weights[j] = 1 + (uint256(keccak256(abi.encodePacked(j, block.timestamp, i))) % 100);\n totalWeight += weights[j];\n }\n _vote(voters[i], tokenIds[i], weights);\n }\n\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 marketWeightIonWeth = voter.weights(markets[i], sides[i], address(ionWeth5050lPAero));\n uint256 marketWeightWethAero = voter.weights(markets[i], sides[i], address(wethAero5050LPAero));\n console.log(\"-----------------------------------------------------\");\n console.log(\"Market:\", markets[i]);\n console.log(\"Side:\", uint256(sides[i]));\n console.log(\"Market Weight ION-WETH:\", marketWeightIonWeth);\n console.log(\"Market Weight WETH-AERO:\", marketWeightWethAero);\n }\n console.log(\"-----------------------------------------------------\");\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n uint256[] memory expectedBalances = new uint256[](4);\n expectedBalances[0] = 276676147359650479260798;\n expectedBalances[1] = 223767532575522266411076;\n expectedBalances[2] = 245411929366342403014352;\n expectedBalances[3] = 254144390698484851313772;\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n assertEq(ionBalance, expectedBalances[i], \"Each reward accumulator should have roughly a quarter\");\n }\n\n // Log the price of ION-WETH LP using mpo.price\n uint256 ionWethPrice = mpo.price(address(ionWeth5050lPAero));\n console.log(\"Price of ION-WETH LP:\", ionWethPrice);\n\n // Log the price of WETH-AERO LP using mpo.price\n uint256 wethAeroPrice = mpo.price(address(wethAero5050LPAero));\n console.log(\"Price of WETH-AERO LP:\", wethAeroPrice);\n }\n\n function test_claimRewards_RewardsCanBeClaimed() public forkAtBlock(BASE_MAINNET, 21579411) {\n vm.prank(baseUser);\n voter.vote(baseTokenIdSingleLp, markets, sides, weights);\n uint256 ionPrice = mpo.price(ion);\n uint256 wethPrice = mpo.price(weth);\n\n uint256 ionWethLpPrice = mpo.price(ionWeth5050lPAero);\n\n console.log(\"ION Price:\", ionPrice);\n console.log(\"WETH Price:\", wethPrice);\n console.log(\"ION-WETH LP Price:\", ionWethLpPrice);\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n uint256 expectedBalance = rewardAmount / 4;\n assertEq(ionBalance, expectedBalance, \"Each reward accumulator should have a quarter of the tokens\");\n }\n\n _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n\n vm.prank(baseWETHWhale);\n IERC20(weth).transfer(address(baseUser), ONE);\n\n uint256 ionBalanceBefore = IERC20(ion).balanceOf(address(baseUser));\n\n vm.startPrank(baseUser);\n IERC20(weth).approve(ethMarket, ONE);\n address[] memory marketToEnter;\n marketToEnter = new address[](2);\n marketToEnter[0] = ethMarket;\n marketToEnter[1] = btcMarket;\n\n comptroller.enterMarkets(marketToEnter);\n CErc20RewardsDelegate(ethMarket).mint(1e15);\n\n vm.stopPrank();\n vm.warp(voter.epochNext(block.timestamp));\n\n vm.startPrank(baseUser);\n flywheelSupply.accrue(ERC20(ethMarket), address(baseUser));\n\n flywheelSupply.claimRewards(address(baseUser));\n uint256 ionBalanceAfter = IERC20(ion).balanceOf(address(baseUser));\n uint256 rewardClaimed = ionBalanceAfter - ionBalanceBefore;\n uint256 ionwethBalanceAfter = IERC20(ethMarket).balanceOf(address(baseUser));\n uint256 ionwethTotalBalanceAfter = IERC20(ethMarket).totalSupply();\n assertEq(\n ionwethTotalBalanceAfter / ionwethBalanceAfter,\n rewardAmount / 4 / rewardClaimed,\n \"User should get his fair share of rewards\"\n );\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/mocks/MockBribeRewards.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.10;\n\nimport \"../../../../../veION/interfaces/IBribeRewards.sol\";\n\ncontract MockBribeRewards is IBribeRewards {\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external override {\n emit Deposit(msg.sender, tokenId, amount);\n }\n\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external override {\n emit Withdraw(msg.sender, tokenId, amount);\n }\n\n function notifyRewardAmount(address token, uint256 amount) external override {\n emit RewardNotification(msg.sender, token, block.timestamp, amount);\n }\n\n function getReward(uint256 tokenId, address[] memory tokens) external override {\n for (uint256 i = 0; i < tokens.length; i++) {\n emit RewardsClaimed(msg.sender, tokens[i], 0); // Assuming 0 as a placeholder for reward amount\n }\n }\n\n function getPriorBalanceIndex(\n uint256 tokenId,\n address lpToken,\n uint256 timestamp\n ) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n\n function earned(address token, uint256 tokenId) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Poke.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Poke is VoterTest {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n\n function setUp() public {\n _setUp();\n\n marketVote = new address[](1);\n marketVoteSide = new IVoter.MarketSide[](1);\n weights = new uint256[](1);\n marketVote[0] = ethMarket;\n marketVoteSide[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n vm.startPrank(user);\n voter.vote(voterTokenIdMultiLp, marketVote, marketVoteSide, weights);\n voter.vote(voterTokenIdSingleLp, marketVote, marketVoteSide, weights);\n vm.stopPrank();\n }\n\n function test_poke_UserCanPoke() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(initialVoteDetails.votes[i], finalVoteDetails.votes[i], \"Votes should decrease with time\");\n }\n\n assertEq(\n initialVoteDetails.marketVotes.length,\n finalVoteDetails.marketVotes.length,\n \"Market votes length should remain the same\"\n );\n assertEq(\n initialVoteDetails.marketVoteSides.length,\n finalVoteDetails.marketVoteSides.length,\n \"Market vote sides length should remain the same\"\n );\n assertGt(initialVoteDetails.usedWeight, finalVoteDetails.usedWeight, \"Used weight should decrease with time\");\n\n for (uint256 i = 0; i < initialVoteDetails.marketVotes.length; i++) {\n assertEq(\n initialVoteDetails.marketVotes[i],\n finalVoteDetails.marketVotes[i],\n \"Market votes should remain the same\"\n );\n assertEq(\n uint256(initialVoteDetails.marketVoteSides[i]),\n uint256(finalVoteDetails.marketVoteSides[i]),\n \"Market vote sides should remain the same\"\n );\n }\n\n // Log initial votes and used weight\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n // Log final votes and used weight\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n // Repeat test for balancer vote details\n IVoter.VoteDetails memory initialBalancerVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory finalBalancerVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n for (uint256 i = 0; i < initialBalancerVoteDetails.votes.length; i++) {\n assertGt(\n initialBalancerVoteDetails.votes[i],\n finalBalancerVoteDetails.votes[i],\n \"Balancer votes should decrease with time\"\n );\n }\n\n assertEq(\n initialBalancerVoteDetails.marketVotes.length,\n finalBalancerVoteDetails.marketVotes.length,\n \"Balancer votes length should remain the same\"\n );\n assertEq(\n initialBalancerVoteDetails.marketVoteSides.length,\n finalBalancerVoteDetails.marketVoteSides.length,\n \"Balancer vote sides length should remain the same\"\n );\n assertGt(\n initialBalancerVoteDetails.usedWeight,\n finalBalancerVoteDetails.usedWeight,\n \"Balancer used weight should decrease with time\"\n );\n\n for (uint256 i = 0; i < initialBalancerVoteDetails.marketVotes.length; i++) {\n assertEq(\n initialBalancerVoteDetails.marketVotes[i],\n finalBalancerVoteDetails.marketVotes[i],\n \"Balancer votes should remain the same\"\n );\n assertEq(\n uint256(initialBalancerVoteDetails.marketVoteSides[i]),\n uint256(finalBalancerVoteDetails.marketVoteSides[i]),\n \"Balancer vote sides should remain the same\"\n );\n }\n\n // Log initial balancer votes and used weight\n for (uint256 i = 0; i < initialBalancerVoteDetails.votes.length; i++) {\n console.log(\"Initial Balancer Votes for market\", i, \":\", initialBalancerVoteDetails.votes[i]);\n }\n console.log(\"Initial Balancer Used Weight:\", initialBalancerVoteDetails.usedWeight);\n\n // Log final balancer votes and used weight\n for (uint256 i = 0; i < finalBalancerVoteDetails.votes.length; i++) {\n console.log(\"Final Balancer Votes for market\", i, \":\", finalBalancerVoteDetails.votes[i]);\n }\n console.log(\"Final Balancer Used Weight:\", finalBalancerVoteDetails.usedWeight);\n }\n\n function test_poke_UserCanPokeSingleAsset() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(initialVoteDetails.votes[i], finalVoteDetails.votes[i]);\n }\n }\n\n function test_poke_RevertIfDistributeWindow() public {\n vm.warp(voter.epochVoteStart(block.timestamp));\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.poke(voterTokenIdSingleLp);\n }\n\n function test_poke_UntilExpiry() public {\n vm.warp(block.timestamp + 365 * 86400);\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n assertEq(finalVoteDetails.votes[i], 0, \"Final votes should be zero for each market\");\n }\n assertEq(finalVoteDetails.usedWeight, 0, \"Final used weight should be zero\");\n }\n\n function test_poke_AfterIncreaseAmount() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 additionalAmount = 1000 * 1e18; // Example amount to mint\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), voterTokenIdSingleLp, additionalAmount, false);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterIncreaseUnlock() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 additionalDuration = 70 weeks;\n vm.startPrank(user);\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), voterTokenIdSingleLp, additionalDuration);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterLockPermanent() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterUnlockPermanent() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterDelegation() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdSingleLp, voterTokenIdMultiLp, address(modeVelodrome5050IonMode), 500 ether);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterBeingDelegatedTo() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegatedAmount = 500 ether;\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdMultiLp, voterTokenIdSingleLp, address(modeVelodrome5050IonMode), delegatedAmount);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertEq(\n finalVoteDetails.votes[i],\n (voterLockInfoSingleLp.tokenAmount + delegatedAmount) * 2,\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertEq(\n finalVoteDetails.usedWeight,\n (voterLockInfoSingleLp.tokenAmount + delegatedAmount) * 2,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterRemoveDelegator() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegatedAmount = 500 ether;\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdMultiLp, voterTokenIdSingleLp, address(modeVelodrome5050IonMode), delegatedAmount);\n uint256[] memory multiLpArray = new uint256[](1);\n multiLpArray[0] = voterTokenIdMultiLp;\n uint256[] memory delegatedAmountArray = new uint256[](1);\n delegatedAmountArray[0] = delegatedAmount;\n IveION(ve).removeDelegators(\n multiLpArray,\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode),\n delegatedAmountArray\n );\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertEq(\n finalVoteDetails.votes[i],\n (voterLockInfoSingleLp.tokenAmount) * 2,\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertEq(\n finalVoteDetails.usedWeight,\n (voterLockInfoSingleLp.tokenAmount) * 2,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterRemoveDelegatee() external {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegateAmount = 1000 ether;\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdSingleLp, voterTokenIdMultiLp, address(modeVelodrome5050IonMode), delegateAmount);\n uint256[] memory singleLpArray = new uint256[](1);\n singleLpArray[0] = voterTokenIdMultiLp;\n uint256[] memory amountArray = new uint256[](1);\n amountArray[0] = delegateAmount;\n IveION(ve).removeDelegatees(voterTokenIdSingleLp, singleLpArray, address(modeVelodrome5050IonMode), amountArray);\n vm.stopPrank();\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n // assertEq(finalVoteDetails.votes.length, 0, \"Final vote details array length should be zero \");\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n // assertEq(finalVoteDetails.usedWeight, 0, \"Final used weight should be greater than initial used weight\");\n }\n\n function test_poke_AfterTransfer() external {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 10 weeks);\n\n vm.startPrank(user);\n IveION(ve).transferFrom(user, address(0x2352), voterTokenIdSingleLp);\n voter.poke(voterTokenIdSingleLp);\n vm.stopPrank();\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(\n initialVoteDetails.votes[i],\n finalVoteDetails.votes[i],\n \"Initial votes should be greater than final votes\"\n );\n }\n assertGt(\n initialVoteDetails.usedWeight,\n finalVoteDetails.usedWeight,\n \"Initial used weight should be greater than final used weight\"\n );\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Reset.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Reset is VoterTest {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n\n function setUp() public {\n _setUp();\n\n marketVote = new address[](1);\n marketVoteSide = new IVoter.MarketSide[](1);\n weights = new uint256[](1);\n marketVote[0] = ethMarket;\n marketVoteSide[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n vm.startPrank(user);\n voter.vote(voterTokenIdMultiLp, marketVote, marketVoteSide, weights);\n voter.vote(voterTokenIdSingleLp, marketVote, marketVoteSide, weights);\n vm.stopPrank();\n }\n\n function test_reset_UserCanResetSingleLpToken() public {\n vm.warp(block.timestamp + 1 weeks);\n vm.prank(user);\n voter.reset(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory resetVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n assertEq(resetVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", resetVoteDetails.usedWeight);\n assertEq(resetVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n }\n\n function test_reset_UserCanResetMultiLpToken() public {\n vm.warp(block.timestamp + 1 weeks);\n vm.prank(user);\n voter.reset(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory veloVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n IVoter.VoteDetails memory balancerVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeBalancer8020IonEth)\n );\n\n assertEq(veloVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", veloVoteDetails.usedWeight);\n assertEq(veloVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n\n assertEq(balancerVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", balancerVoteDetails.usedWeight);\n assertEq(balancerVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n }\n\n function test_reset_RevertIfSameEpoch() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVotedOrDeposited()\"));\n voter.reset(voterTokenIdSingleLp);\n }\n\n function test_reset_RevertIfDistributeWindow() public {\n vm.warp(voter.epochNext(block.timestamp));\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.reset(voterTokenIdSingleLp);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Setters.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Setters is VoterTest {\n function setUp() public {\n _setUp();\n }\n\n function testSetLpTokens() public {\n address[] memory newLpTokens = new address[](2);\n newLpTokens[0] = address(0x123);\n newLpTokens[1] = address(0x456);\n\n voter.setLpTokens(newLpTokens);\n\n address[] memory lpTokens = voter.getAllLpRewardTokens();\n assertEq(lpTokens.length, newLpTokens.length, \"LP tokens length mismatch\");\n for (uint256 i = 0; i < lpTokens.length; i++) {\n assertEq(lpTokens[i], newLpTokens[i], \"LP token mismatch\");\n }\n }\n\n function testSetLpTokensRevertEmptyArray() public {\n // Test revert case: setting empty LP tokens array\n address[] memory emptyLpTokens = new address[](0);\n vm.expectRevert(\"LpTokens array cannot be empty\");\n voter.setLpTokens(emptyLpTokens);\n }\n\n function testSetMpo() public {\n address newMpo = address(0x789);\n voter.setMpo(newMpo);\n\n assertEq(address(voter.mpo()), newMpo, \"MPO address mismatch\");\n }\n\n function testSetMpoRevertZeroAddress() public {\n // Test revert case: setting MPO to zero address\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAddress()\"));\n voter.setMpo(address(0));\n }\n\n function testSetGovernor() public {\n address newGovernor = address(0xABC);\n voter.setGovernor(newGovernor);\n\n assertEq(voter.governor(), newGovernor, \"Governor address mismatch\");\n }\n\n function testSetGovernorRevertZeroAddress() public {\n // Test revert case: setting Governor to zero address\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAddress()\"));\n voter.setGovernor(address(0));\n }\n\n function testSetMaxVotingNum() public {\n uint256 newMaxVotingNum = 25;\n voter.setMaxVotingNum(newMaxVotingNum);\n\n assertEq(voter.maxVotingNum(), newMaxVotingNum, \"Max voting number mismatch\");\n }\n\n function testSetMaxVotingNumRevertTooLow() public {\n // Test revert case: setting MaxVotingNum below minimum\n vm.expectRevert(abi.encodeWithSignature(\"MaximumVotingNumberTooLow()\"));\n voter.setMaxVotingNum(5);\n }\n\n function testSetMaxVotingNumRevertSameValue() public {\n uint256 newMaxVotingNum = 25;\n voter.setMaxVotingNum(newMaxVotingNum);\n\n // Test revert case: setting MaxVotingNum to the same value\n vm.expectRevert(abi.encodeWithSignature(\"SameValue()\"));\n voter.setMaxVotingNum(newMaxVotingNum);\n }\n\n function testWhitelistToken() public {\n address token = address(0xFED);\n voter.whitelistToken(token, true);\n\n assertTrue(voter.isWhitelistedToken(token), \"Token should be whitelisted\");\n }\n\n function testWhitelistNFT() public {\n uint256 tokenId = 1;\n voter.whitelistNFT(tokenId, true);\n\n assertTrue(voter.isWhitelistedNFT(tokenId), \"NFT should be whitelisted\");\n }\n\n function testAddMarkets() public {\n IVoter.Market[] memory newMarkets = new IVoter.Market[](2);\n newMarkets[0] = IVoter.Market(address(0x123), IVoter.MarketSide.Supply);\n newMarkets[1] = IVoter.Market(address(0x456), IVoter.MarketSide.Borrow);\n\n voter.addMarkets(newMarkets);\n\n assertEq(voter.marketsLength(), 6, \"Markets length mismatch\");\n (address marketAddress, IVoter.MarketSide marketSide) = voter.markets(4);\n assertEq(marketAddress, address(0x123), \"First market address mismatch\");\n assertEq(uint256(marketSide), uint256(IVoter.MarketSide.Supply), \"First market side mismatch\");\n\n (marketAddress, marketSide) = voter.markets(5);\n assertEq(marketAddress, address(0x456), \"Second market address mismatch\");\n assertEq(uint256(marketSide), uint256(IVoter.MarketSide.Borrow), \"Second market side mismatch\");\n }\n\n function testAddMarketsRevertMarketExists() public {\n IVoter.Market[] memory newMarkets = new IVoter.Market[](2);\n newMarkets[0] = IVoter.Market(address(0x123), IVoter.MarketSide.Supply);\n newMarkets[1] = IVoter.Market(address(0x456), IVoter.MarketSide.Borrow);\n\n voter.addMarkets(newMarkets);\n\n // Test revert case: adding an existing market\n vm.expectRevert(abi.encodeWithSignature(\"MarketAlreadyExists()\"));\n voter.addMarkets(newMarkets);\n }\n\n function testSetMarketRewardAccumulators() public {\n address[] memory marketAddresses = new address[](2);\n marketAddresses[0] = address(0x123);\n marketAddresses[1] = address(0x456);\n\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](2);\n marketSides[0] = IVoter.MarketSide.Supply;\n marketSides[1] = IVoter.MarketSide.Borrow;\n\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n assertEq(\n voter.marketToRewardAccumulators(address(0x123), IVoter.MarketSide.Supply),\n address(0x789),\n \"First reward accumulator mismatch\"\n );\n assertEq(\n voter.marketToRewardAccumulators(address(0x456), IVoter.MarketSide.Borrow),\n address(0xABC),\n \"Second reward accumulator mismatch\"\n );\n }\n\n function testSetMarketRewardAccumulatorsRevertMismatchedLengths() public {\n address[] memory marketAddresses = new address[](2);\n marketAddresses[0] = address(0x123);\n marketAddresses[1] = address(0x456);\n\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](2);\n marketSides[0] = IVoter.MarketSide.Supply;\n marketSides[1] = IVoter.MarketSide.Borrow;\n\n address[] memory shortRewardAccumulators = new address[](1);\n shortRewardAccumulators[0] = address(0x789);\n\n // Test revert case: mismatched array lengths\n vm.expectRevert(abi.encodeWithSignature(\"MismatchedArrayLengths()\"));\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, shortRewardAccumulators);\n }\n\n function testSetBribes() public {\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n address[] memory bribes = new address[](2);\n bribes[0] = address(0xDEF);\n bribes[1] = address(0xFED);\n\n voter.setBribes(rewardAccumulators, bribes);\n\n assertEq(voter.rewardAccumulatorToBribe(address(0x789)), address(0xDEF), \"First bribe mismatch\");\n assertEq(voter.rewardAccumulatorToBribe(address(0xABC)), address(0xFED), \"Second bribe mismatch\");\n }\n\n function testSetBribesRevertMismatchedLengths() public {\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n address[] memory shortBribes = new address[](1);\n shortBribes[0] = address(0xDEF);\n\n // Test revert case: mismatched array lengths\n vm.expectRevert(abi.encodeWithSignature(\"MismatchedArrayLengths()\"));\n voter.setBribes(rewardAccumulators, shortBribes);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/utils/VoterUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"../../../Utils.sol\";\nimport \"../../../../../veION/Voter.sol\";\nimport \"../mocks/MockBribeRewards.sol\";\nimport { IVoter } from \"../../../../../veION/interfaces/IVoter.sol\";\nimport { RewardAccumulator } from \"../../../../../veION/RewardAccumulator.sol\";\n\ncontract VoterTest is veIONTest {\n Voter voter;\n LockInfo voterLockInfoSingleLp;\n LockInfoMultiple voterLockInfoMultiLp;\n uint256 voterTokenIdSingleLp;\n uint256 voterTokenIdMultiLp;\n address user;\n\n address ethMarket;\n address btcMarket;\n\n MockBribeRewards bribeEthSupply;\n MockBribeRewards bribeEthBorrow;\n MockBribeRewards bribeBtcSupply;\n MockBribeRewards bribeBtcBorrow;\n\n MasterPriceOracle mpo;\n\n function _setUp() internal virtual override {\n super._setUp();\n ethMarket = _generateRandomAddress(1);\n btcMarket = _generateRandomAddress(2);\n\n address[] memory _tokens = new address[](2);\n _tokens[0] = address(modeVelodrome5050IonMode);\n _tokens[1] = address(modeBalancer8020IonEth);\n\n MasterPriceOracle _mpo = new MasterPriceOracle();\n MockERC20 mockIon = new MockERC20(\"Mock ION\", \"mION\", 18);\n address _rewardToken = address(mockIon);\n address _ve = address(ve);\n\n voter = Voter(\n address(\n new TransparentUpgradeableProxy(\n address(new Voter()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, _mpo, _rewardToken, _ve)\n )\n )\n );\n\n IVoter.Market[] memory dummyMarkets = new IVoter.Market[](4);\n dummyMarkets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\n dummyMarkets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\n dummyMarkets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\n dummyMarkets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\n voter.addMarkets(dummyMarkets);\n\n address[] memory marketAddresses = new address[](4);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\n address[] memory rewardAccumulators = new address[](4);\n marketAddresses[0] = ethMarket;\n marketSides[0] = IVoter.MarketSide.Supply;\n marketAddresses[1] = ethMarket;\n marketSides[1] = IVoter.MarketSide.Borrow;\n marketAddresses[2] = btcMarket;\n marketSides[2] = IVoter.MarketSide.Supply;\n marketAddresses[3] = btcMarket;\n marketSides[3] = IVoter.MarketSide.Borrow;\n\n for (uint i = 0; i < 4; i++) {\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\n rewardAccumulators[i] = address(newRewardAccumulator);\n }\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n bribeEthSupply = new MockBribeRewards();\n bribeEthBorrow = new MockBribeRewards();\n bribeBtcSupply = new MockBribeRewards();\n bribeBtcBorrow = new MockBribeRewards();\n\n address[] memory rewardAccumulatorsForBribes = new address[](4);\n address[] memory bribes = new address[](4);\n\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\n bribes[0] = address(bribeEthSupply);\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\n bribes[1] = address(bribeEthBorrow);\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\n bribes[2] = address(bribeBtcSupply);\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\n bribes[3] = address(bribeBtcBorrow);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n\n voter.setMaxVotingNum(20);\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(modeVelodrome5050IonMode);\n lpTokens[1] = address(modeBalancer8020IonEth);\n\n voter.setLpTokens(lpTokens);\n user = address(0x9523);\n vm.warp(block.timestamp + 10 * 365 days);\n\n voterLockInfoSingleLp = _createLockInternal(user);\n voterLockInfoMultiLp = _createLockMultipleInternal(user);\n\n voterTokenIdSingleLp = voterLockInfoSingleLp.tokenId;\n voterTokenIdMultiLp = voterLockInfoMultiLp.tokenId;\n\n IveION(ve).setVoter(address(voter));\n }\n\n function afterForkSetUp() internal virtual override {\n _afterForkSetUpBase();\n\n ethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\n btcMarket = 0x1De166df671AE6DB4C4C98903df88E8007593748;\n\n address[] memory _tokens = new address[](1);\n _tokens[0] = address(0x0FAc819628a7F612AbAc1CaD939768058cc0170c);\n\n mpo = MasterPriceOracle(0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4);\n IERC20 ion = IERC20(0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5);\n\n voter = Voter(\n address(\n new TransparentUpgradeableProxy(\n address(new Voter()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, mpo, address(ion), address(ve))\n )\n )\n );\n\n IVoter.Market[] memory markets = new IVoter.Market[](4);\n markets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\n markets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\n markets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\n markets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\n voter.addMarkets(markets);\n\n address[] memory marketAddresses = new address[](4);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\n address[] memory rewardAccumulators = new address[](4);\n marketAddresses[0] = ethMarket;\n marketSides[0] = IVoter.MarketSide.Supply;\n marketAddresses[1] = ethMarket;\n marketSides[1] = IVoter.MarketSide.Borrow;\n marketAddresses[2] = btcMarket;\n marketSides[2] = IVoter.MarketSide.Supply;\n marketAddresses[3] = btcMarket;\n marketSides[3] = IVoter.MarketSide.Borrow;\n\n for (uint i = 0; i < 4; i++) {\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\n rewardAccumulators[i] = address(newRewardAccumulator);\n }\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n bribeEthSupply = new MockBribeRewards();\n bribeEthBorrow = new MockBribeRewards();\n bribeBtcSupply = new MockBribeRewards();\n bribeBtcBorrow = new MockBribeRewards();\n address[] memory rewardAccumulatorsForBribes = new address[](4);\n address[] memory bribes = new address[](4);\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\n bribes[0] = address(bribeEthSupply);\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\n bribes[1] = address(bribeEthBorrow);\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\n bribes[2] = address(bribeBtcSupply);\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\n bribes[3] = address(bribeBtcBorrow);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n\n voter.setMaxVotingNum(20);\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(ionWeth5050lPAero);\n lpTokens[1] = address(wethAero5050LPAero);\n voter.setLpTokens(lpTokens);\n\n IveION(ve).setVoter(address(voter));\n\n baseTokenIdSingleLp = _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n }\n\n function _vote(address _user, uint256 _tokenId, uint256[] memory weights) internal {\n address[] memory selectedMarkets = new address[](4);\n IVoter.MarketSide[] memory selectedSides = new IVoter.MarketSide[](4);\n uint256[] memory selectedWeights = new uint256[](4);\n\n selectedMarkets[0] = ethMarket;\n selectedSides[0] = IVoter.MarketSide.Supply;\n selectedWeights[0] = weights[0];\n\n selectedMarkets[1] = btcMarket;\n selectedSides[1] = IVoter.MarketSide.Supply;\n selectedWeights[1] = weights[1];\n\n selectedMarkets[2] = ethMarket;\n selectedSides[2] = IVoter.MarketSide.Borrow;\n selectedWeights[2] = weights[2];\n\n selectedMarkets[3] = btcMarket;\n selectedSides[3] = IVoter.MarketSide.Borrow;\n selectedWeights[3] = weights[3];\n\n vm.prank(_user);\n voter.vote(_tokenId, selectedMarkets, selectedSides, selectedWeights);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Vote.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Vote is VoterTest {\n function setUp() public {\n _setUp();\n }\n\n function test_vote_UserCanVoteSingleLP() public {\n address[] memory _marketVote = new address[](2);\n IVoter.MarketSide[] memory _marketVoteSide = new IVoter.MarketSide[](2);\n uint256[] memory _weights = new uint256[](2);\n\n _marketVote[0] = ethMarket;\n _marketVoteSide[0] = IVoter.MarketSide.Supply;\n _weights[0] = 100;\n\n _marketVote[1] = btcMarket;\n _marketVoteSide[1] = IVoter.MarketSide.Borrow;\n _weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdSingleLp, _marketVote, _marketVoteSide, _weights);\n\n (, uint256[] memory votingLPBalances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory voteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 effectiveVotingPower = (votingLPBalances[0] * boosts[0]) / 1e18;\n uint256 totalWeight = _weights[0] + _weights[1];\n\n for (uint256 i = 0; i < voteDetails.marketVotes.length; i++) {\n assertEq(voteDetails.marketVotes[i], _marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetails.marketVoteSides[i]),\n uint256(_marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetails.votes[i],\n (effectiveVotingPower * _weights[i]) / totalWeight,\n \"User's vote should be in accordance with weight\"\n );\n }\n\n assertApproxEqRel(voteDetails.usedWeight, effectiveVotingPower, 0.001e18, \"Used weight should be all voting power\");\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeVelodrome5050IonMode)),\n (effectiveVotingPower * _weights[0]) / totalWeight,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeVelodrome5050IonMode)),\n (effectiveVotingPower * _weights[1]) / totalWeight,\n \"Weight for BTC market should be 200\"\n );\n }\n\n struct VoteLocalVars {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n uint256[] votingLPBalances;\n uint256[] boosts;\n address[] marketVotesVelo;\n IVoter.MarketSide[] marketVoteSidesVelo;\n uint256[] votesVelo;\n uint256 usedWeightVelo;\n address[] marketVotesBalancer;\n IVoter.MarketSide[] marketVoteSidesBalancer;\n uint256[] votesBalancer;\n uint256 usedWeightBalancer;\n uint256 effectiveVotingPowerVelo;\n uint256 totalWeightVelo;\n uint256 effectiveVotingPowerBalancer;\n uint256 totalWeightBalancer;\n }\n\n function test_vote_UserCanVoteMultiLP() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n (, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory voteDetailsVelo = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n IVoter.VoteDetails memory voteDetailsBalancer = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n console.log(\"==================================Velo LP Vote Details==================================:\");\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n console.log(\"===================VOTE====================\");\n console.log(\"Market:\", voteDetailsVelo.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsVelo.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsVelo.votes[i]);\n }\n console.log(\"Used Weight Velo:\", voteDetailsVelo.usedWeight);\n console.log(\"-----------------------------------------------------------------------------------------\");\n\n console.log(\"==================================Balancer LP Vote Details==================================:\");\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n console.log(\"===================VOTE====================\");\n console.log(\"Market:\", voteDetailsBalancer.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsBalancer.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsBalancer.votes[i]);\n }\n console.log(\"Used Weight Balancer:\", voteDetailsBalancer.usedWeight);\n\n vars.effectiveVotingPowerVelo = (vars.votingLPBalances[0] * vars.boosts[0]) / 1e18;\n vars.totalWeightVelo = vars.weights[0] + vars.weights[1];\n\n vars.effectiveVotingPowerBalancer = (vars.votingLPBalances[1] * vars.boosts[1]) / 1e18;\n vars.totalWeightBalancer = vars.weights[0] + vars.weights[1];\n\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n assertEq(voteDetailsVelo.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsVelo.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(voteDetailsVelo.votes[i], (vars.effectiveVotingPowerVelo * vars.weights[i]) / vars.totalWeightVelo);\n }\n\n assertApproxEqRel(\n voteDetailsVelo.usedWeight,\n vars.effectiveVotingPowerVelo,\n 0.001e18,\n \"Used weight should be all voting power\"\n );\n\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n assertEq(voteDetailsBalancer.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsBalancer.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetailsBalancer.votes[i],\n (vars.effectiveVotingPowerBalancer * vars.weights[i]) / vars.totalWeightBalancer\n );\n }\n\n assertApproxEqRel(\n voteDetailsBalancer.usedWeight,\n vars.effectiveVotingPowerBalancer,\n 0.001e18,\n \"Used weight should be all voting power\"\n );\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeVelodrome5050IonMode)),\n (vars.effectiveVotingPowerVelo * vars.weights[0]) / vars.totalWeightVelo,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeVelodrome5050IonMode)),\n (vars.effectiveVotingPowerVelo * vars.weights[1]) / vars.totalWeightVelo,\n \"Weight for BTC market should be 200\"\n );\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeBalancer8020IonEth)),\n (vars.effectiveVotingPowerBalancer * vars.weights[0]) / vars.totalWeightBalancer,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeBalancer8020IonEth)),\n (vars.effectiveVotingPowerBalancer * vars.weights[1]) / vars.totalWeightBalancer,\n \"Weight for BTC market should be 200\"\n );\n }\n\n function test_vote_VoteResetsAfterVotingForSameMarketsAgain() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.warp(block.timestamp + 14 * 86400);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 400;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 400;\n\n vm.startPrank(user);\n voter.reset(voterTokenIdMultiLp);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n vm.stopPrank();\n\n (, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory voteDetailsVelo = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n IVoter.VoteDetails memory voteDetailsBalancer = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n vars.effectiveVotingPowerVelo = (vars.votingLPBalances[0] * vars.boosts[0]) / 1e18;\n vars.totalWeightVelo = vars.weights[0] + vars.weights[1];\n\n vars.effectiveVotingPowerBalancer = (vars.votingLPBalances[1] * vars.boosts[1]) / 1e18;\n vars.totalWeightBalancer = vars.weights[0] + vars.weights[1];\n\n // Display vote details for Velodrome\n console.log(\"Velodrome Market Votes:\");\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n console.log(\"Market:\", voteDetailsVelo.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsVelo.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsVelo.votes[i]);\n assertEq(voteDetailsVelo.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsVelo.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(voteDetailsVelo.votes[i], (vars.effectiveVotingPowerVelo * vars.weights[i]) / vars.totalWeightVelo);\n }\n console.log(\"Used Weight for Velodrome:\", voteDetailsVelo.usedWeight);\n\n console.log(\"--------------------------------------------------------------\");\n // Display vote details for Balancer\n console.log(\"Balancer Market Votes:\");\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n console.log(\"Market:\", voteDetailsBalancer.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsBalancer.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsBalancer.votes[i]);\n\n assertEq(voteDetailsBalancer.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsBalancer.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetailsBalancer.votes[i],\n (vars.effectiveVotingPowerBalancer * vars.weights[i]) / vars.totalWeightBalancer\n );\n }\n console.log(\"Used Weight for Balancer:\", voteDetailsBalancer.usedWeight);\n }\n\n function test_vote_VoteThenDelegateShouldPokeAccordingly() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n address user2 = address(0x23512);\n LockInfo memory lockInfo2 = _createLockInternal(user2);\n\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n vm.prank(user2);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInfo2.tokenId);\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.prank(user2);\n voter.vote(lockInfo2.tokenId, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n IVoter.VoteDetails memory voteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n IVoter.VoteDetails memory voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 1\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 2\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"============================================================================\");\n\n vm.prank(user);\n IveION(ve).delegate(voterTokenIdMultiLp, lockInfo2.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n\n voteDetails = voter.getVoteDetails(voterTokenIdMultiLp, address(modeVelodrome5050IonMode));\n voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 3\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 4\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n\n assertEq(voteDetails.votes[0], 333333333333333333333, \"First market votes should be lower\");\n assertEq(voteDetails.votes[1], 666666666666666666666, \"Second market votes should be lower\");\n\n assertEq(voteDetails2.votes[0], 1000000000000000000000, \"First market votes should be higher\");\n assertEq(voteDetails2.votes[1], 2000000000000000000000, \"Second market votes should be higher\");\n\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = lockInfo2.tokenId;\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = type(uint256).max;\n\n vm.prank(user);\n IveION(ve).removeDelegatees(voterTokenIdMultiLp, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n // voter.poke(lockInfo2.tokenId);\n\n voteDetails = voter.getVoteDetails(voterTokenIdMultiLp, address(modeVelodrome5050IonMode));\n voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInfo2.tokenId\n );\n for (uint256 i; i < assets.length; i++) {\n console.log(\"Assets\", assets[i]);\n console.log(\"Balances\", balances[i]);\n console.log(\"Boosts\", boosts[i]);\n }\n\n // (assets, balances, boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n // for (uint256 i; i < assets.length; i++) {\n // console.log(\"Assets\", assets[i]);\n // console.log(\"Balances\", balances[i]);\n // console.log(\"Boosts\", boosts[i]);\n // }\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 5\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 6\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n\n assertEq(voteDetails.votes[0], 666666666666666666666, \"First market votes should be lower\");\n assertEq(voteDetails.votes[1], 1333333333333333333333, \"Second market votes should be lower\");\n\n assertEq(voteDetails2.votes[0], 666666666666666666666, \"First market votes should be higher\");\n assertEq(voteDetails2.votes[1], 1333333333333333333333, \"Second market votes should be higher\");\n }\n\n function test_vote_RevertIfSameEpoch() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 400;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 400;\n\n vm.startPrank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVotedOrDeposited()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n vm.stopPrank();\n }\n\n function test_vote_RevertIfDistributionWindow() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n uint256 epochNext = voter.epochNext(block.timestamp);\n vm.warp(epochNext);\n console.log(\"Current Timestamp:\", block.timestamp);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.warp(block.timestamp + 3601);\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_NotOwner() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfUnequalLengths() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](1); // Intentionally unequal length\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n // vars.marketVoteSide[1] is missing to create unequal lengths\n vars.weights[1] = 200;\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"UnequalLengths()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfTooManyPools() public {\n VoteLocalVars memory vars;\n\n // Set maxVotingNum to 10 for this test\n voter.setMaxVotingNum(10);\n\n vars.marketVote = new address[](11);\n vars.marketVoteSide = new IVoter.MarketSide[](11);\n vars.weights = new uint256[](11);\n\n for (uint256 i = 0; i < 11; i++) {\n vars.marketVote[i] = ethMarket;\n vars.marketVoteSide[i] = IVoter.MarketSide.Supply;\n vars.weights[i] = 100;\n }\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"TooManyPools()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfNotWhitelistedNFT() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vm.warp(IonicTimeLibrary.epochStart(block.timestamp) + 1 weeks - 0.75 hours);\n\n // Assume voterTokenIdSingleLp is not whitelisted\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotWhitelistedNFT()\"));\n voter.vote(voterTokenIdSingleLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfNoRewardAccumulator() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n // Use a market that does not have a reward accumulator set\n address nonExistentMarket = address(0xDEADBEEF);\n vars.marketVote[0] = nonExistentMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"RewardAccumulatorDoesNotExist(address)\", nonExistentMarket));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfRewardAccumulatorNotAlive() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n voter.toggleRewardAccumulatorAlive(vars.marketVote[0], vars.marketVoteSide[0], false);\n address accumulator = voter.marketToRewardAccumulators(vars.marketVote[0], vars.marketVoteSide[0]);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"RewardAccumulatorNotAlive(address)\", accumulator));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfZeroWeight() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 0; // Set weight to zero to trigger the revert\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroWeight()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n}\n" + }, + "contracts/test/veION/harness/veIONHarness.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\nimport \"../../../veION/veION.sol\";\n\n// This harness contract can be used for testing purposes.\ncontract veIONHarness is veION {\n constructor(uint256 _minimumLockDuration) {\n s_minimumLockDuration = _minimumLockDuration;\n }\n\n function exposed_calculateBoost(uint256 _duration) external view returns (uint256) {\n return _calculateBoost(_duration);\n }\n}\n" + }, + "contracts/test/veION/Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../config/BaseTest.t.sol\";\nimport \"../../veION/veION.sol\";\nimport \"../../veION/veIONFirstExtension.sol\";\nimport \"../../veION/veIONSecondExtension.sol\";\nimport \"../../veION/interfaces/IveION.sol\";\n// import \"../../veION/interfaces/IveIONCore.sol\";\nimport \"../../veION/stake/IStakeStrategy.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\nimport \"../../veION/stake/IStakeStrategy.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingWallet.sol\";\nimport \"../../veION/stake/velo/IVeloIonModeStaking.sol\";\nimport \"./harness/veIONHarness.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\ncontract veIONTest is BaseTest {\n using Strings for uint256;\n using Strings for bool;\n using Strings for address;\n\n address ve;\n address veFirstExtension;\n address veSecondExtension;\n MockERC20 modeVelodrome5050IonMode;\n MockERC20 modeBalancer8020IonEth;\n MockERC20 baseAerodrome5050IonWstEth;\n MockERC20 baseBalancer8020IonEth;\n MockERC20 optimismVelodrome5050IonOp;\n MockERC20 optimismBalancer8020IonEth;\n IveIONStructsEnumsErrorsEvents.LpTokenType veloLpType;\n IveIONStructsEnumsErrorsEvents.LpTokenType balancerLpType;\n VeloAeroStakingWallet veloStakingWalletImplementation;\n veIONHarness harness;\n\n address ionMode5050LP;\n address ionWeth5050lPAero;\n address wethAero5050LPAero;\n address veloGauge;\n VeloAeroStakingStrategy veloIonModeStakingStrategy;\n VeloAeroStakingStrategy veloWethUsdcStakingStrategy;\n address stakingWalletInstance;\n uint256 stakingWalletInstanceBalance;\n\n address wethUSDC5050LP;\n address wethUSDCGauge;\n\n // Base Fork Vars\n address baseUser;\n uint256 baseTokenIdSingleLp;\n\n uint256 internal constant MINT_AMT = 1000 ether;\n uint256 internal constant WEEK = 1 weeks;\n uint256 internal constant MAXTIME = 2 * 365 * 86400;\n uint256 internal constant MINTIME = 180 * 86400;\n uint256 internal constant EARLY_WITHDRAW_FEE = 0.8e18;\n uint256 internal constant MINIMUM_LOCK_AMOUNT = 10e18;\n uint256 internal constant REAL_LP_LOCK_AMOUNT = 10e18;\n\n function _setUp() internal virtual {\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n modeVelodrome5050IonMode = new MockERC20(\"Mode_Velodrome_5050_ION_MODE\", \"MV5050\", 18);\n modeBalancer8020IonEth = new MockERC20(\"Mode_Balancer_8020_ION_ETH\", \"MB8020\", 18);\n\n harness = new veIONHarness(MINTIME);\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n\n whitelistedTokens[0] = address(modeVelodrome5050IonMode);\n whitelistedTokens[1] = address(modeBalancer8020IonEth);\n\n for (uint i = 0; i < 2; i++) {\n isWhitelistedTokens[i] = true;\n }\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n\n IveION(ve).setLpTokenType(\n address(modeVelodrome5050IonMode),\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE\n );\n IveION(ve).setLpTokenType(\n address(modeBalancer8020IonEth),\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH\n );\n\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\n\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(modeVelodrome5050IonMode), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(modeBalancer8020IonEth), MINIMUM_LOCK_AMOUNT);\n }\n\n function _afterForkSetUpMode() internal {\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n ionMode5050LP = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n wethUSDC5050LP = 0x283bA4E204DFcB6381BCBf2cb5d0e765A2B57bC2;\n wethUSDCGauge = 0x98d34C7b004688F35b67Aa30D4dF5E67113f6B3D;\n\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n veloWethUsdcStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n wethUSDC5050LP,\n wethUSDCGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n whitelistedTokens[0] = ionMode5050LP;\n isWhitelistedTokens[0] = true;\n whitelistedTokens[1] = wethUSDC5050LP;\n isWhitelistedTokens[1] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n IveION(ve).setLpTokenType(wethUSDC5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH);\n\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n IveION(ve).setStakeStrategy(balancerLpType, IStakeStrategy(veloWethUsdcStakingStrategy));\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(ionMode5050LP), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(wethUSDC5050LP), MINIMUM_LOCK_AMOUNT);\n }\n\n function _afterForkSetUpBase() internal {\n baseUser = address(0x987);\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n harness = new veIONHarness(MINTIME);\n\n ionWeth5050lPAero = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n wethAero5050LPAero = 0x7f670f78B17dEC44d5Ef68a48740b6f8849cc2e6;\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n whitelistedTokens[0] = ionWeth5050lPAero;\n isWhitelistedTokens[0] = true;\n whitelistedTokens[1] = wethAero5050LPAero;\n isWhitelistedTokens[1] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(\n ionWeth5050lPAero,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Aerodrome_5050_ION_wstETH\n );\n IveION(ve).setLpTokenType(\n wethAero5050LPAero,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Balancer_8020_ION_ETH\n );\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(ionWeth5050lPAero), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(wethAero5050LPAero), MINIMUM_LOCK_AMOUNT);\n }\n\n function _lockSingleLPFork(address _user, uint256 _amount) internal returns (uint256) {\n address whale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\n vm.prank(whale);\n IERC20(ionWeth5050lPAero).transfer(_user, _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(ionWeth5050lPAero);\n tokenAmounts[0] = _amount;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = false;\n\n vm.startPrank(_user);\n IERC20(ionWeth5050lPAero).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return tokenId;\n }\n\n function _lockMultiLpFork(address _user, uint256 _amountIonWeth, uint256 _amountWethAERO) internal returns (uint256) {\n address ionWethWhale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\n address wethAEROWhale = 0x96a24aB830D4ec8b1F6f04Ceac104F1A3b211a01;\n\n vm.prank(ionWethWhale);\n IERC20(ionWeth5050lPAero).transfer(_user, _amountIonWeth);\n vm.prank(wethAEROWhale);\n IERC20(wethAero5050LPAero).transfer(_user, _amountWethAERO);\n\n address[] memory tokenAddresses = new address[](2);\n uint256[] memory tokenAmounts = new uint256[](2);\n uint256[] memory durations = new uint256[](2);\n bool[] memory stakeUnderlying = new bool[](2);\n tokenAddresses[0] = address(ionWeth5050lPAero);\n tokenAmounts[0] = _amountIonWeth;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = false;\n tokenAddresses[1] = address(wethAero5050LPAero);\n tokenAmounts[1] = _amountWethAERO;\n durations[1] = 52 weeks;\n stakeUnderlying[1] = false;\n\n vm.startPrank(_user);\n IERC20(ionWeth5050lPAero).approve(address(ve), _amountIonWeth);\n IERC20(wethAero5050LPAero).approve(address(ve), _amountWethAERO);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return tokenId;\n }\n\n function _createLockInternal(address user) internal returns (LockInfo memory) {\n TestVars memory vars;\n vars.user = user;\n vars.amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\n\n vm.startPrank(vars.user);\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\n vm.stopPrank();\n\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vm.startPrank(vars.user);\n uint256 tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](1));\n vm.stopPrank();\n\n return LockInfo(tokenId, vars.tokenAddresses[0], vars.tokenAmounts[0], vars.durations[0]);\n }\n\n function _createLockMultipleInternal(address user) internal returns (LockInfoMultiple memory) {\n TestVars memory vars;\n vars.user = user;\n\n vars.amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\n modeBalancer8020IonEth.mint(vars.user, vars.amount);\n\n vm.startPrank(vars.user);\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\n modeBalancer8020IonEth.approve(address(ve), vars.amount);\n vm.stopPrank();\n\n vars.tokenAddresses = new address[](2);\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\n vars.tokenAddresses[1] = address(modeBalancer8020IonEth);\n\n vars.tokenAmounts = new uint256[](2);\n vars.tokenAmounts[0] = vars.amount;\n vars.tokenAmounts[1] = vars.amount;\n\n vars.durations = new uint256[](2);\n vars.durations[0] = 52 weeks;\n vars.durations[1] = 52 weeks;\n\n vm.startPrank(vars.user);\n vars.tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](2));\n vm.stopPrank();\n\n return LockInfoMultiple(vars.tokenId, vars.tokenAddresses, vars.tokenAmounts, vars.durations);\n }\n\n function _createLockInternalRealLP(address _user, bool _stakeUnderlying) internal returns (LockInfo memory) {\n uint256 amountStaked = REAL_LP_LOCK_AMOUNT;\n address whale = 0x8ff8b21a0736738b25597D32d8f7cf658f39f157;\n vm.prank(whale);\n IERC20(ionMode5050LP).transfer(_user, amountStaked);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(ionMode5050LP);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amountStaked;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n bool[] memory stakeUnderlying = new bool[](1);\n stakeUnderlying[0] = _stakeUnderlying;\n\n vm.startPrank(_user);\n IERC20(ionMode5050LP).approve(address(ve), amountStaked);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return LockInfo(tokenId, tokenAddresses[0], tokenAmounts[0], durations[0]);\n }\n\n function _generateRandomAddress(uint256 seed) internal pure returns (address) {\n return address(uint160(uint256(keccak256(abi.encodePacked(seed)))));\n }\n\n function _logTokens(uint256[] memory tokenIds, address[] memory lpTokens) internal view {\n for (uint256 i = 0; i < tokenIds.length; i++) {\n for (uint256 j = 0; j < lpTokens.length; j++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n tokenIds[i],\n IveION(ve).s_lpType(lpTokens[j])\n );\n uint256 tokenId = i + 1;\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Token: \", lock.tokenAddress.toHexString()))\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Amount: \", lock.amount.toString()))\n );\n console.log(\n string(\n abi.encodePacked(\n \"Token ID \",\n tokenId.toString(),\n \" Locked Delegate Amount: \",\n lock.delegateAmount.toString()\n )\n )\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Start: \", lock.start.toString()))\n );\n console.log(string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked End: \", lock.end.toString())));\n console.log(\n string(\n abi.encodePacked(\n \"Token ID \",\n tokenId.toString(),\n \" Locked IsPermanent: \",\n lock.isPermanent ? \"true\" : \"false\"\n )\n )\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Boost: \", lock.boost.toString()))\n );\n console.log(\"--------------------------------------------------\");\n }\n console.log(\"====================================================\");\n }\n }\n\n function _logCumulativeAssetValues(address[] memory users, address[] memory lpTokens) internal view {\n console.log(\"-----------------------------------------------------------------\");\n for (uint256 i = 0; i < users.length; i++) {\n address user = users[i];\n console.log(\"Cumulative Asset Values for User:\", user);\n for (uint256 j = 0; j < lpTokens.length; j++) {\n console.log(\"Token:\", lpTokens[j], \"Value:\", IveION(ve).s_userCumulativeAssetValues(user, lpTokens[j]));\n }\n console.log(\"====================================================\");\n }\n }\n\n function _logUnderlyingStake(address[] memory users) internal view {\n console.log(\"-----------------------------------------------------------------\");\n for (uint256 i = 0; i < users.length; i++) {\n address user = users[i];\n console.log(\"Underlying Stakes For:\", user);\n address stakingWalletInstanceIonMode = veloIonModeStakingStrategy.userStakingWallet(user);\n uint256 stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n\n address stakingWalletInstanceWethUsdc = veloWethUsdcStakingStrategy.userStakingWallet(user);\n uint256 stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n console.log(\"Staked Balance Ion-Mode:\", stakedBalanceIonMode);\n console.log(\"Staked Balance Weth-Usdc:\", stakedBalanceWethUsdc);\n console.log(\"====================================================\");\n }\n }\n}\n\nstruct TestVars {\n address user;\n address user2;\n uint256 amount;\n address[] tokenAddresses;\n uint256[] tokenAmounts;\n uint256[] durations;\n bool[] stakeUnderlying;\n uint256 tokenId;\n uint256 secondTokenId;\n uint256 expectedSupply;\n uint256 userEpoch;\n uint256 globalEpoch;\n address lockedBalance_tokenAddress;\n uint256 lockedBalance_amount;\n uint256 delegated_lockedBalance_amount;\n uint256 lockedBalance_start;\n uint256 lockedBalance_end;\n bool lockedBalance_isPermanent;\n uint256 lockedBalance_boost;\n uint256 userPoint_bias;\n uint256 userPoint_slope;\n uint256 userPoint_ts;\n uint256 userPoint_blk;\n uint256 userPoint_permanent;\n uint256 userPoint_permanentDelegate;\n int128 globalPoint_bias;\n int128 globalPoint_slope;\n uint256 globalPoint_ts;\n uint256 globalPoint_blk;\n uint256 globalPoint_permanentLockBalance;\n uint256[] ownerTokenIds;\n address[] assetsLocked;\n uint256 tokenId_test;\n address lockedBalance_tokenAddress_test;\n uint256 lockedBalance_amount_test;\n uint256 lockedBalance_duration_test;\n uint256 lockedBalance_end_test;\n}\n\nstruct LockInfo {\n uint256 tokenId;\n address tokenAddress;\n uint256 tokenAmount;\n uint256 duration;\n}\n\nstruct LockInfoMultiple {\n uint256 tokenId;\n address[] tokenAddresses;\n uint256[] tokenAmounts;\n uint256[] durations;\n}\n\nstruct AeroBoostVars {\n uint256 aeroVoterBoost;\n address aeroVotingAddress;\n address ionicPoolAddress;\n address veAEROAddress;\n address AERO;\n uint256 lockAmount;\n address aeroWhale;\n uint256 veAeroTokenId;\n address[] poolVote;\n uint256[] weights;\n}\n\ninterface IveAERO {\n /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration`\n /// @param _value Amount to deposit\n /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week)\n /// @return TokenId of created veNFT\n function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256);\n}\n\ninterface IAEROVoter {\n /// @notice Called by users to vote for pools. Votes distributed proportionally based on weights.\n /// Can only vote or deposit into a managed NFT once per epoch.\n /// Can only vote for gauges that have not been killed.\n /// @dev Weights are distributed proportional to the sum of the weights in the array.\n /// Throws if length of _poolVote and _weights do not match.\n /// @param _tokenId Id of veNFT you are voting with.\n /// @param _poolVote Array of pools you are voting for.\n /// @param _weights Weights of pools.\n function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external;\n\n /// @notice Returns the number of votes for a given veNFT token ID and pool address.\n /// @param _tokenId The ID of the veNFT.\n /// @param _pool The address of the pool.\n /// @return The number of votes for the given token ID and pool.\n function votes(uint256 _tokenId, address _pool) external view returns (uint256);\n}\n" + }, + "contracts/utils/IMulticall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\n/// @title Multicall interface\n/// @notice Enables calling multiple methods in a single call to the contract\ninterface IMulticall {\n /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed\n /// @dev The `msg.value` should not be trusted for any method callable from multicall.\n /// @param data The encoded function data for each of the calls to make to this contract\n /// @return results The results from each of the calls passed in via data\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n}\n" + }, + "contracts/utils/IW_NATIVE.sol": { + "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity >=0.8.0;\n\ninterface IW_NATIVE {\n function deposit() external payable;\n\n function withdraw(uint256 amount) external;\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/utils/Multicall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\nimport \"./IMulticall.sol\";\n\n/// @title Multicall\n/// @notice Enables calling multiple methods in a single call to the contract\nabstract contract Multicall is IMulticall {\n /// @inheritdoc IMulticall\n function multicall(bytes[] calldata data) public payable virtual override returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n\n if (!success) {\n // Next 5 lines from https://ethereum.stackexchange.com/a/83577\n if (result.length < 68) revert();\n assembly {\n result := add(result, 0x04)\n }\n revert(abi.decode(result, (string)));\n }\n\n results[i] = result;\n }\n }\n}\n" + }, + "contracts/veION/BribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\n\n/**\n * @title BribeRewards Contract\n * @notice This contract allows veION to benefit from bribes when voting for various markets\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Duration of the reward period in seconds\n uint256 public constant DURATION = 7 days;\n /// @notice Address of the voter contract\n address public voter;\n /// @notice Address of the veION contract\n address public ve;\n /// @notice List of reward tokens\n address[] public rewards;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Mapping to check if an address is a reward token\n mapping(address => bool) public isReward;\n /// @notice Total supply of LP tokens for each reward token\n mapping(address => uint256) public totalSupply;\n /// @notice Balance of LP tokens for each tokenId and reward token\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\n /// @notice Rewards per epoch for each reward token\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\n /// @notice Last earned timestamp for each reward token and tokenId\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\n /// @notice A record of balance checkpoints for each account, by index\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\n /// @notice The number of checkpoints for each account\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\n /// @notice A record of balance checkpoints for each token, by index\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\n /// @notice The number of supply checkpoints for each token\n mapping(address => uint256) public supplyNumCheckpoints;\n /// @notice Historical prices for each reward token and epoch\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\n\n /**\n * @notice Modifier to restrict access to only the voter contract\n * @dev Ensures that the caller is the voter contract\n */\n modifier onlyVoter() {\n require(msg.sender == voter, \"Caller is not the voter\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\n * @dev This function is called only once during contract deployment\n * @param _voter The address of the voter contract\n * @param _ve The address of the veION contract\n */\n function initialize(address _voter, address _ve) public initializer {\n __ReentrancyGuard_init();\n __Ownable2Step_init();\n voter = _voter;\n ve = _ve;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IBribeRewards\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\n address sender = msg.sender;\n\n totalSupply[lpToken] += amount;\n balanceOf[tokenId][lpToken] += amount;\n\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\n _writeSupplyCheckpoint(lpToken);\n\n emit Deposit(sender, tokenId, amount);\n }\n\n /// @inheritdoc IBribeRewards\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\n address sender = msg.sender;\n\n totalSupply[lpToken] -= amount;\n balanceOf[tokenId][lpToken] -= amount;\n\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\n _writeSupplyCheckpoint(lpToken);\n\n emit Withdraw(sender, tokenId, amount);\n }\n\n /**\n * @inheritdoc IBribeRewards\n * @notice This function can accept any token, regardless of its whitelisting status.\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\n */\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\n address sender = msg.sender;\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\n\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\n _getReward(_owner, tokenId, tokens);\n }\n\n /// @inheritdoc IBribeRewards\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\n address sender = msg.sender;\n\n if (!isReward[token]) {\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\n isReward[token] = true;\n rewards.push(token);\n }\n\n _notifyRewardAmount(sender, token, amount);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @dev used with all getReward implementations\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\n // check if token whitelisted\n uint256 _length = tokens.length;\n for (uint256 i = 0; i < _length; i++) {\n uint256 _reward = earned(tokens[i], tokenId);\n lastEarn[tokens[i]][tokenId] = block.timestamp;\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\n\n emit RewardsClaimed(recipient, tokens[i], _reward);\n }\n }\n\n /**\n * @notice Writes a new checkpoint for a token's balance\n * @param tokenId The ID of the veION token\n * @param lpToken The LP token address\n * @param balance The balance to record\n */\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\n uint256 _timestamp = block.timestamp;\n\n if (\n _nCheckPoints > 0 &&\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\n IonicTimeLibrary.epochStart(_timestamp)\n ) {\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\n } else {\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\n }\n }\n\n /// @notice Writes a new checkpoint for total supply\n /// @param lpToken The LP token address\n function _writeSupplyCheckpoint(address lpToken) internal {\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\n uint256 _timestamp = block.timestamp;\n\n if (\n _nCheckPoints > 0 &&\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\n IonicTimeLibrary.epochStart(_timestamp)\n ) {\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\n } else {\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\n }\n }\n\n /// @dev used within all notifyRewardAmount implementations\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\n if (amount == 0) revert AmountCannotBeZero();\n IERC20(token).safeTransferFrom(sender, address(this), amount);\n\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\n tokenRewardsPerEpoch[token][epochStart] += amount;\n\n emit RewardNotification(sender, token, epochStart, amount);\n }\n\n /**\n * @notice Calculates the ETH value of a token amount at a specific epoch\n * @param amount The amount of tokens\n * @param lpToken The LP token address\n * @param epochTimestamp The timestamp of the epoch\n * @return The ETH value of the tokens\n */\n function _getTokenEthValueAt(\n uint256 amount,\n address lpToken,\n uint256 epochTimestamp\n ) internal view returns (uint256) {\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\n return ethValue;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Pure/View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @notice Returns the total number of reward tokens\n /// @return The length of the rewards array\n function rewardsListLength() external view returns (uint256) {\n return rewards.length;\n }\n\n /// @inheritdoc IBribeRewards\n function earned(address token, uint256 tokenId) public view returns (uint256) {\n EarnedVars memory vars;\n vars.totalReward = 0;\n address[] memory lpTokens = getAllLpRewardTokens();\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 j = 0; j < lpTokensLength; j++) {\n address lpToken = lpTokens[j];\n\n if (numCheckpoints[tokenId][lpToken] == 0) {\n continue;\n }\n\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\n\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\n\n if (vars.numEpochs > 0) {\n for (uint256 i = 0; i < vars.numEpochs; i++) {\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\n cp0 = checkpoints[tokenId][lpToken][vars.index];\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\n\n vars.supplyValue = 0;\n for (uint256 k = 0; k < lpTokensLength; k++) {\n address currentLpToken = lpTokens[k];\n uint256 supplyAmount = Math.max(\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\n 1\n );\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\n }\n if (vars.supplyValue > 0) {\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\n }\n vars.currTs += DURATION;\n }\n }\n }\n\n return vars.totalReward;\n }\n\n /// @notice Gets all LP tokens that can receive rewards\n /// @return Array of LP token addresses\n function getAllLpRewardTokens() public view returns (address[] memory) {\n return IVoter(voter).getAllLpRewardTokens();\n }\n\n /**\n * @notice Sets historical prices for LP tokens at specific epochs\n * @param epochTimestamp The timestamp of the epoch\n * @param lpToken The LP token address\n * @param price The price to set\n */\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\n historicalPrices[lpToken][epochStart] = price;\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\n }\n\n /**\n * @notice Gets a specific checkpoint for a token\n * @param tokenId The ID of the veION token\n * @param lpToken The LP token address\n * @param index The index of the checkpoint to retrieve\n * @return The checkpoint data\n */\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\n return checkpoints[tokenId][lpToken][index];\n }\n\n /// @inheritdoc IBribeRewards\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\n return (nCheckpoints - 1);\n }\n\n // Next check implicit zero balance\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\n return 0;\n }\n\n uint256 lower = 0;\n uint256 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\n if (cp.timestamp == timestamp) {\n return center;\n } else if (cp.timestamp < timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n\n /// @inheritdoc IBribeRewards\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\n return (nCheckpoints - 1);\n }\n\n // Next check implicit zero balance\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\n return 0;\n }\n\n uint256 lower = 0;\n uint256 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\n if (cp.timestamp == timestamp) {\n return center;\n } else if (cp.timestamp < timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n}\n" + }, + "contracts/veION/interfaces/IBribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IBribeRewards {\n /// @notice A checkpoint for marking balance\n struct Checkpoint {\n uint256 timestamp;\n uint256 balanceOf;\n }\n\n /// @notice A checkpoint for marking supply\n struct SupplyCheckpoint {\n uint256 timestamp;\n uint256 supply;\n }\n\n struct EarnedVars {\n uint256 totalReward;\n uint256 reward;\n uint256 supplyValue;\n uint256 epochBalanceValue;\n uint256 currTs;\n uint256 index;\n uint256 numEpochs;\n uint256 overallBalance;\n uint256 overallSupply;\n uint256 historicalPrice;\n }\n\n error InvalidReward();\n error Unauthorized();\n error InvalidGauge();\n error InvalidEscrowToken();\n error SingleTokenExpected();\n error InvalidVotingEscrow();\n error TokenNotWhitelisted();\n error AmountCannotBeZero();\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\n\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\n\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\n /// @dev Can only be called internally by authorized entities.\n /// @param lpToken Address of the liquidity pool token\n /// @param amount Amount to be deposited for the veNFT\n /// @param tokenId Unique identifier of the veNFT\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\n\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\n /// @dev Can only be called internally by authorized entities.\n /// @param lpToken Address of the liquidity pool token\n /// @param amount Amount to be withdrawn for the veNFT\n /// @param tokenId Unique identifier of the veNFT\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\n\n /// @notice Claim the rewards earned by a veNFT holder\n /// @param tokenId Unique identifier of the veNFT\n /// @param tokens Array of tokens to claim rewards for\n function getReward(uint256 tokenId, address[] memory tokens) external;\n\n /// @notice Notify the contract about new rewards for stakers\n /// @param token Address of the reward token\n /// @param amount Amount of the reward token to be added\n function notifyRewardAmount(address token, uint256 amount) external;\n\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\n /// @dev Timestamp must be in the past or present.\n /// @param tokenId The veNFT token ID to check\n /// @param lpToken Address of the liquidity pool token\n /// @param timestamp The timestamp to get the balance at\n /// @return The balance index at the given timestamp\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\n\n /// @notice Get the prior supply index at a specific timestamp\n /// @dev Timestamp must be in the past or present.\n /// @param timestamp The timestamp to get the supply index at\n /// @return The supply index at the given timestamp\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\n\n /// @notice Calculate the rewards earned for a specific token and veNFT\n /// @param token Address of the reward token\n /// @param tokenId Unique identifier of the veNFT\n /// @return Amount of the reward token earned\n function earned(address token, uint256 tokenId) external view returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport \"./IveIONCore.sol\";\nimport \"./IveIONFirstExtension.sol\";\nimport \"./IveIONSecondExtension.sol\";\n\n/// @title IveION Interface\n/// @notice Interface for veION contract\ninterface IveION is IveIONStructsEnumsErrorsEvents, IveIONCore, IveIONFirstExtension, IveIONSecondExtension {\n // Constants\n function PRECISION() external view returns (uint256);\n\n // State Variables\n function s_tokenId() external view returns (uint256);\n function s_limitedBoost() external view returns (uint256);\n function s_limitedBoostActive() external view returns (bool);\n function s_veAERO() external view returns (address);\n function s_aeroVoting() external view returns (address);\n function s_ionicPool() external view returns (address);\n function s_voter() external view returns (address);\n function s_aeroVoterBoost() external view returns (uint256);\n function s_minimumLockDuration() external view returns (uint256);\n function s_maxEarlyWithdrawFee() external view returns (uint256);\n function ap() external view returns (address);\n function implementation() external view returns (address);\n\n // Mappings\n function s_minimumLockAmount(LpTokenType lpTokenType) external view returns (uint256);\n function s_whitelistedToken(address token) external view returns (bool);\n function s_lpType(address token) external view returns (LpTokenType);\n function s_canSplit(address user) external view returns (bool);\n function s_locked(uint256 tokenId, LpTokenType lpTokenType) external view returns (LockedBalance memory);\n function s_userPointEpoch(uint256 tokenId, LpTokenType lpTokenType) external view returns (uint256);\n function s_userPointHistory(\n uint256 tokenId,\n LpTokenType lpTokenType,\n uint256 epoch\n ) external view returns (UserPoint memory);\n function s_voted(uint256 tokenId) external view returns (bool);\n function s_supply(LpTokenType lpTokenType) external view returns (uint256);\n function s_permanentLockBalance(LpTokenType lpTokenType) external view returns (uint256);\n function s_stakeStrategy(LpTokenType lpTokenType) external view returns (address);\n function s_underlyingStake(uint256 tokenId, address token) external view returns (uint256);\n function s_protocolFees(LpTokenType lpTokenType) external view returns (uint256);\n function s_distributedFees(LpTokenType lpTokenType) external view returns (uint256);\n function s_delegations(\n uint256 delegatorTokenId,\n uint256 delegateeTokenId,\n LpTokenType lpTokenType\n ) external view returns (uint256);\n function s_userCumulativeAssetValues(address user, address token) external view returns (uint256);\n function s_delegatorsBlocked(uint256 tokenId, address token) external view returns (bool);\n\n // Openzeppelin functions\n function transferFrom(address from, address to, uint256 tokenId) external;\n function ownerOf(uint256 tokenId) external returns (address);\n function owner() external returns (address);\n function balanceOf(address owner) external returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveIONCore.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\n\n/// @title IveION Interface\n/// @notice Interface for veION contract\ninterface IveIONCore {\n /**\n * @notice Creates a new lock for multiple tokens and assigns it to a specified address\n * @param _tokenAddress Array of token addresses to lock\n * @param _tokenAmount Array of token amounts to lock\n * @param _duration Array of lock durations\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\n * @param _to Address to assign the lock to\n * @return The ID of the newly created veNFT\n */\n function createLockFor(\n address[] memory _tokenAddress,\n uint256[] memory _tokenAmount,\n uint256[] memory _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) external returns (uint256);\n\n /**\n * @notice Creates a new lock for multiple tokens\n * @param _tokenAddress Array of token addresses to lock\n * @param _tokenAmount Array of token amounts to lock\n * @param _duration Array of lock durations\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\n * @return The ID of the newly created veNFT\n */\n function createLock(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying\n ) external returns (uint256);\n\n /**\n * @notice Increases the amount of tokens locked for a specific veNFT\n * @param _tokenAddress Address of the token to increase lock amount for\n * @param _tokenId ID of the veNFT\n * @param _tokenAmount Amount of tokens to add to the lock\n * @param _stakeUnderlying Whether to stake the underlying tokens\n */\n function increaseAmount(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n bool _stakeUnderlying\n ) external;\n\n /**\n * @notice Locks additional asset type for an existing veNFT\n * @param _tokenAddress Address of the new token to lock\n * @param _tokenAmount Amount of tokens to lock\n * @param _tokenId ID of the veNFT\n * @param _duration Duration of the lock\n * @param _stakeUnderlying Whether to stake the underlying tokens\n */\n function lockAdditionalAsset(\n address _tokenAddress,\n uint256 _tokenAmount,\n uint256 _tokenId,\n uint256 _duration,\n bool _stakeUnderlying\n ) external;\n\n /**\n * @notice Increases the lock duration for a specific token in a veNFT\n * @param _tokenAddress Address of the token\n * @param _tokenId ID of the veNFT\n * @param _lockDuration New lock duration to extend to\n */\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external;\n\n /**\n * @notice Delegates voting power from one veNFT to another.\n * @param fromTokenId The ID of the veNFT from which voting power is delegated.\n * @param toTokenId The ID of the veNFT to which voting power is delegated.\n * @param lpToken The address of the LP token associated with the delegation.\n * @param amount The amount of voting power to delegate.\n */\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external;\n\n /**\n * @notice Removes delegatees from a specific veNFT\n * @param fromTokenId ID of the veNFT from which delegatees are removed\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegatee\n */\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) external;\n\n /**\n * @notice Removes delegators from a specific veNFT\n * @param fromTokenIds Array of veNFT IDs that are delegators to be removed\n * @param toTokenId ID of the veNFT from which delegators are removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegator\n */\n function removeDelegators(\n uint256[] memory fromTokenIds,\n uint256 toTokenId,\n address lpToken,\n uint256[] memory amounts\n ) external;\n\n /**\n * @notice Locks a token permanently.\n * @param _tokenAddress The address of the token to lock.\n * @param _tokenId The ID of the token to lock.\n */\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Unlocks a permanently locked token.\n * @param _tokenAddress The address of the token to unlock.\n * @param _tokenId The ID of the token to unlock.\n */\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Updates voting status for a veNFT\n * @param _tokenId ID of the veNFT\n * @param _voting Voting status\n */\n function voting(uint256 _tokenId, bool _voting) external;\n\n /**\n * @notice Sets the implementation addresses for the veION contract extensions.\n * @dev This function can only be called by authorized entities.\n * @param _veIONFirstExtension The address of the first extension contract.\n * @param _veIONSecondExtension The address of the second extension contract.\n */\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external;\n}\n\n/// @title IAeroVotingEscrow Interface\n/// @notice Interface for Aero Voting Escrow contract\ninterface IAeroVotingEscrow {\n /**\n * @notice Returns the balance of the specified owner.\n * @param _owner The address of the owner.\n * @return The balance of the owner.\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Retrieves the token ID at a specific index for a given owner.\n * @param _owner The address of the owner.\n * @param _index The index of the token ID in the owner's list.\n * @return The token ID at the specified index.\n */\n function ownerToNFTokenIdList(address _owner, uint256 _index) external view returns (uint256);\n}\n\n/// @title IAeroVoter Interface\n/// @notice Interface for Aero Voter contract\ninterface IAeroVoter {\n /**\n * @notice Returns the list of pools voted for by a specific token ID.\n * @param tokenId The ID of the token.\n * @return An array of addresses representing the pools voted for.\n */\n function poolVote(uint256 tokenId) external view returns (address[] memory);\n\n /**\n * @notice Retrieves the weight of a specific pool.\n * @param pool The address of the pool.\n * @return The weight of the pool.\n */\n function weights(address pool) external view returns (uint256);\n\n /**\n * @notice Returns the number of votes a specific token ID has for a given pool.\n * @param tokenId The ID of the token.\n * @param pool The address of the pool.\n * @return The number of votes for the pool.\n */\n function votes(uint256 tokenId, address pool) external view returns (uint256);\n}\n\ninterface IAddressesProvider {\n function getAddress(string calldata id) external view returns (address);\n}\n\ninterface IMasterPriceOracle {\n function price(address underlying) external view returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\n\n/// @title IveION Interface First Extensions\n/// @notice Interface for veION contract\ninterface IveIONFirstExtension is IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Withdraws tokens associated with a specific token ID.\n * @param _tokenAddress The address of the token to withdraw.\n * @param _tokenId The ID of the token to withdraw.\n */\n function withdraw(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Merges two token IDs into one.\n * @param _from The ID of the token to merge from.\n * @param _to The ID of the token to merge into.\n */\n function merge(uint256 _from, uint256 _to) external;\n\n /**\n * @notice Splits a token into two separate tokens.\n * @param _tokenAddress The address of the token to split.\n * @param _from The ID of the token to split.\n * @param _splitAmount The amount to split from the original token.\n * @return _tokenId1 The ID of the first resulting token.\n * @return _tokenId2 The ID of the second resulting token.\n */\n function split(\n address _tokenAddress,\n uint256 _from,\n uint256 _splitAmount\n ) external returns (uint256 _tokenId1, uint256 _tokenId2);\n\n /**\n * @notice Claims emissions for a specific token.\n * @param _tokenAddress The address of the token for which to claim emissions.\n */\n function claimEmissions(address _tokenAddress) external;\n\n /**\n * @notice Allows or blocks delegators for a specific token ID.\n * @param _tokenId The ID of the token.\n * @param _tokenAddress The address of the token.\n * @param _blocked Boolean indicating if delegators are blocked.\n */\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external;\n\n /**\n * @notice Retrieves the balance of a specific NFT.\n * @param _tokenId The ID of the NFT.\n * @return _assets An array of asset addresses.\n * @return _balances An array of balances for each asset.\n * @return _boosts An array of boost values for each asset.\n */\n function balanceOfNFT(\n uint256 _tokenId\n ) external view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts);\n\n /**\n * @notice Retrieves the total ETH value of tokens owned by a specific address.\n * @param _owner The address of the owner.\n * @return totalValue The total ETH value of the tokens.\n */\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue);\n}\n" + }, + "contracts/veION/interfaces/IveIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\n\n/// @title IveION Interface Second Extension\n/// @notice Interface for veION contract\ninterface IveIONSecondExtension is IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Whitelists or removes tokens from the whitelist.\n * @param _tokens An array of token addresses to be whitelisted or removed.\n * @param _isWhitelisted An array of booleans indicating the whitelist status for each token.\n */\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external;\n\n /**\n * @notice Withdraws protocol fees for a specific token to a recipient address.\n * @param _tokenAddress The address of the token for which protocol fees are to be withdrawn.\n * @param _recipient The address to which the protocol fees will be sent.\n */\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external;\n\n /**\n * @notice Withdraws distributed fees for a specific token to a recipient address.\n * @param _tokenAddress The address of the token for which distributed fees are to be withdrawn.\n * @param _recipient The address to which the distributed fees will be sent.\n */\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external;\n\n /**\n * @notice Toggles the ability to split tokens for a specific account.\n * @param _account The address of the account.\n * @param _isAllowed Boolean indicating if splitting is allowed.\n */\n function toggleSplit(address _account, bool _isAllowed) external;\n\n /**\n * @notice Toggles the limited boost feature.\n * @param _isBoosted Boolean indicating if the boost is active.\n */\n function toggleLimitedBoost(bool _isBoosted) external;\n\n /**\n * @notice Sets the amount for a limited time boost.\n * @param _boostAmount The amount of the boost.\n */\n function setLimitedTimeBoost(uint256 _boostAmount) external;\n\n /**\n * @notice Sets the address of the voter.\n * @param _voter The address of the voter.\n */\n function setVoter(address _voter) external;\n\n /**\n * @notice Sets the minimum lock amount for a specific token.\n * @param _tokenAddress The address of the token.\n * @param _minimumAmount The minimum amount to lock.\n */\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external;\n\n /**\n * @notice Sets the minimum lock duration.\n * @param _minimumLockDuration The minimum duration for locking.\n */\n function setMinimumLockDuration(uint256 _minimumLockDuration) external;\n\n /**\n * @notice Sets the address of the Ionic Pool.\n * @param _ionicPool The address of the Ionic Pool.\n */\n function setIonicPool(address _ionicPool) external;\n\n /**\n * @notice Sets the address of the Aero Voting contract.\n * @param _aeroVoting The address of the Aero Voting contract.\n */\n function setAeroVoting(address _aeroVoting) external;\n\n /**\n * @notice Sets the boost amount for Aero Voter.\n * @param _aeroVoterBoost The boost amount for Aero Voter.\n */\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external;\n\n /**\n * @notice Sets the maximum early withdrawal fee.\n * @param _maxEarlyWithdrawFee The maximum fee for early withdrawal.\n */\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external;\n\n /**\n * @notice Sets the LP token type for a specific token.\n * @param _token The address of the token.\n * @param _type The LP token type.\n */\n function setLpTokenType(address _token, LpTokenType _type) external;\n\n /**\n * @notice Sets the stake strategy for a specific LP token type.\n * @param _lpType The LP token type.\n * @param _strategy The stake strategy.\n */\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external;\n\n /**\n * @notice Sets the address of the veAERO contract.\n * @param _veAERO The address of the veAERO contract.\n */\n function setVeAERO(address _veAERO) external;\n\n /**\n * @notice Retrieves the lock information for a specific user.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return A LockedBalance struct containing lock details.\n */\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory);\n\n /**\n * @notice Retrieves the token IDs owned by a specific address.\n * @param _owner The address of the owner.\n * @return An array of token IDs owned by the address.\n */\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the assets locked for a specific token ID.\n * @param _tokenId The ID of the token.\n * @return An array of addresses representing the locked assets.\n */\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory);\n\n /**\n * @notice Retrieves the delegatees for a specific token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return An array of delegatee IDs.\n */\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the delegators for a specific token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return An array of delegator IDs.\n */\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the user point for a specific token ID, LP token type, and epoch.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @param _epoch The epoch number.\n * @return A UserPoint struct containing user point details.\n */\n function getUserPoint(uint256 _tokenId, LpTokenType _lpType, uint256 _epoch) external view returns (UserPoint memory);\n}\n" + }, + "contracts/veION/interfaces/IveIONStructsEnumsErrorsEvents.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Structure representing a locked balance\n * @param tokenAddress Address of the token\n * @param amount Amount of tokens locked\n * @param delegateAmount Amount of tokens delegated\n * @param start Start time of the lock\n * @param end End time of the lock\n * @param isPermanent Indicates if the lock is permanent\n * @param boost Boost value for the lock\n */\n struct LockedBalance {\n address tokenAddress;\n uint256 amount;\n uint256 delegateAmount;\n uint256 start;\n uint256 end;\n bool isPermanent;\n uint256 boost;\n }\n\n /**\n * @notice Structure representing a delegation\n * @param amount Amount of tokens delegated\n * @param delegatee ID of the delegatee\n */\n struct Delegation {\n uint256 amount;\n uint256 delegatee;\n }\n\n /**\n * @notice Structure representing a user point\n * @param bias Bias value\n * @param slope Slope value, representing -dweight / dt\n * @param ts Timestamp of the point\n * @param blk Block number of the point\n * @param permanent Permanent value\n * @param permanentDelegate Permanent delegate value\n */\n struct UserPoint {\n uint256 bias;\n uint256 slope;\n uint256 ts;\n uint256 blk;\n uint256 permanent;\n uint256 permanentDelegate;\n }\n\n /**\n * @notice Structure representing a global point\n * @param bias Bias value\n * @param slope Slope value, representing -dweight / dt\n * @param ts Timestamp of the point\n * @param blk Block number of the point\n * @param permanentLockBalance Permanent lock balance\n */\n struct GlobalPoint {\n int128 bias;\n int128 slope;\n uint256 ts;\n uint256 blk;\n uint256 permanentLockBalance;\n }\n\n /**\n * @notice Structure representing a checkpoint\n * @param fromTimestamp Timestamp from which the checkpoint is valid\n * @param owner Address of the owner\n * @param delegatedBalance Balance that has been delegated\n * @param delegatee ID of the delegatee\n */\n struct Checkpoint {\n uint256 fromTimestamp;\n address owner;\n uint256 delegatedBalance;\n uint256 delegatee;\n }\n\n /**\n * @notice Enum representing deposit types\n */\n enum DepositType {\n DEPOSIT_FOR_TYPE,\n CREATE_LOCK_TYPE,\n INCREASE_LOCK_AMOUNT,\n INCREASE_UNLOCK_TIME,\n LOCK_ADDITIONAL\n }\n\n /**\n * @notice Enum representing LP token types\n */\n enum LpTokenType {\n Mode_Velodrome_5050_ION_MODE,\n Mode_Balancer_8020_ION_ETH,\n Base_Aerodrome_5050_ION_wstETH,\n Base_Balancer_8020_ION_ETH,\n Optimism_Velodrome_5050_ION_OP,\n Optimism_Balancer_8020_ION_ETH\n }\n\n error LockDurationNotInFuture();\n error ZeroAmount();\n error LockDurationTooLong();\n error TokenNotWhitelisted();\n error NotOwner();\n error AlreadyVoted();\n error PermanentLock();\n error NoLockFound();\n error LockExpired();\n error SameNFT();\n error SplitNotAllowed();\n error AmountTooBig();\n error NotPermanentLock();\n error TokenHasDelegatees();\n error TokenHasDelegators();\n error NotVoter();\n error MinimumNotMet();\n error ArrayMismatch();\n error LockDurationTooShort();\n error DuplicateAsset();\n error SplitTooSmall();\n error NotEnoughRemainingAfterSplit();\n error NoDelegationBetweenTokens(uint256 _tokenId1, uint256 _tokenId2);\n error NoUnderlyingStake();\n error NotAcceptingDelegators();\n error BoostAmountMustBeGreaterThanZero();\n error InvalidAddress();\n error MinimumAmountMustBeGreaterThanZero();\n error MinimumLockDurationMustBeGreaterThanZero();\n error AeroBoostAmountMustBeGreaterThanZero();\n error MaxEarlyWithdrawFeeMustBeGreaterThanZero();\n error InvalidTokenAddress();\n error InvalidStrategyAddress();\n error InvalidVeAEROAddress();\n\n event Deposit(\n address indexed provider,\n uint256 indexed tokenId,\n DepositType indexed depositType,\n uint256 value,\n uint256 locktime,\n uint256 ts\n );\n event Withdraw(address indexed provider, uint256 indexed tokenId, uint256 value, uint256 ts);\n event Supply(uint256 prevSupply, uint256 supply);\n event Delegated(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\n event DelegationRemoved(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\n event ProtocolFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\n event DistributedFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\n event SplitToggle(address indexed account, bool isAllowed);\n event LimitedBoostToggled(bool isBoosted);\n event LimitedTimeBoostSet(uint256 boostAmount);\n event VoterSet(address indexed newVoter);\n event AeroVotingSet(address indexed newAeroVoting);\n event AeroVoterBoostSet(uint256 newAeroVoterBoost);\n event TokensWhitelisted(address[] token, bool[] isWhitelisted);\n event LpTokenTypeSet(address indexed token, LpTokenType lpTokenType);\n event VeAEROSet(address indexed veAERO);\n event StakeStrategySet(LpTokenType indexed lpTokenType, address indexed strategy);\n event MinimumLockAmountSet(address indexed tokenAddress, uint256 minimumAmount);\n event MinimumLockDurationSet(uint256 minimumDuration);\n event IonicPoolSet(address indexed newIonicPool);\n event SplitCompleted(\n uint256 indexed fromTokenId,\n uint256 indexed tokenId1,\n uint256 indexed tokenId2,\n uint256 splitAmount,\n address tokenAddress\n );\n event MergeCompleted(\n uint256 indexed fromTokenId,\n uint256 indexed toTokenId,\n address[] assetsLocked,\n uint256 lengthOfAssets\n );\n event EmissionsClaimed(address indexed claimant, address indexed tokenAddress);\n event MaxEarlyWithdrawFeeSet(uint256 maxEarlyWithdrawFee);\n event PermanentLockCreated(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\n event PermanentLockRemoved(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\n event Voted(uint256 _tokenId, bool _voting);\n event DelegatorsBlocked(uint256 indexed _tokenId, address indexed _lpToken, bool _blocked);\n event Initialized(address indexed addressesProvider);\n event ExtensionsSet(address indexed _firstExtension, address indexed _secondExtension);\n}\n" + }, + "contracts/veION/interfaces/IVoter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\n/**\n * @title IVoter\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\n */\ninterface IVoter {\n /// @notice Error thrown when a user has already voted or deposited.\n error AlreadyVotedOrDeposited();\n\n /// @notice Error thrown when an action is attempted outside the distribution window.\n error DistributeWindow();\n\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\n error RewardAccumulatorDoesNotExist(address _pool);\n\n /// @notice Error thrown when a reward accumulator is not alive.\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\n\n /// @notice Error thrown when a market already exists.\n error MarketAlreadyExists();\n\n /// @notice Error thrown when the maximum voting number is too low.\n error MaximumVotingNumberTooLow();\n\n /// @notice Error thrown when array lengths do not match.\n error MismatchedArrayLengths();\n\n /// @notice Error thrown when there are non-zero votes.\n error NonZeroVotes();\n\n /// @notice Error thrown when the caller is not the owner.\n error NotOwner();\n\n /// @notice Error thrown when an action is attempted outside the distribution window.\n error NotDistributeWindow();\n\n /// @notice Error thrown when the caller is not the governor.\n error NotGovernor();\n\n /// @notice Error thrown when an NFT is not whitelisted.\n error NotWhitelistedNFT();\n\n /// @notice Error thrown when the same value is provided.\n error SameValue();\n\n /// @notice Error thrown when there are too many pools.\n error TooManyPools();\n\n /// @notice Error thrown when array lengths are unequal.\n error UnequalLengths();\n\n /// @notice Error thrown when an address is zero.\n error ZeroAddress();\n\n /// @notice Error thrown when the tokens array is empty.\n error TokensArrayEmpty();\n\n /// @notice Error thrown when the weight is zero.\n error ZeroWeight();\n\n /**\n * @notice Struct to store vote details.\n * @param marketVotes Array of market addresses voted for.\n * @param marketVoteSides Array of market sides voted for.\n * @param votes Array of vote weights.\n * @param usedWeight Total weight used in voting.\n */\n struct VoteDetails {\n address[] marketVotes;\n MarketSide[] marketVoteSides;\n uint256[] votes;\n uint256 usedWeight;\n }\n\n /**\n * @notice Struct to store market information.\n * @param marketAddress Address of the market.\n * @param side Side of the market (Supply or Borrow).\n */\n struct Market {\n address marketAddress;\n MarketSide side;\n }\n\n /**\n * @notice Struct to store variables used in voting.\n * @param totalWeight Total weight available for voting.\n * @param usedWeight Weight used in voting.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param rewardAccumulator Address of the reward accumulator.\n * @param marketWeight Weight of the market.\n * @param bribes Address of the bribes.\n */\n struct VoteVars {\n uint256 totalWeight;\n uint256 usedWeight;\n address market;\n MarketSide marketSide;\n address rewardAccumulator;\n uint256 marketWeight;\n address bribes;\n }\n\n /**\n * @notice Struct to store local variables used in voting.\n * @param sender Address of the sender.\n * @param timestamp Timestamp of the vote.\n * @param votingLPs Array of voting LP addresses.\n * @param votingLPBalances Array of voting LP balances.\n * @param boosts Array of boosts.\n */\n struct VoteLocalVars {\n address sender;\n uint256 timestamp;\n address[] votingLPs;\n uint256[] votingLPBalances;\n uint256[] boosts;\n }\n\n /**\n * @notice Enum to represent the side of a market.\n */\n enum MarketSide {\n Supply,\n Borrow\n }\n\n /**\n * @notice Event emitted when a vote is cast.\n * @param voter Address of the voter.\n * @param pool Address of the pool.\n * @param tokenId ID of the token.\n * @param weight Weight of the vote.\n * @param totalWeight Total weight of the vote.\n * @param timestamp Timestamp of the vote.\n */\n event Voted(\n address indexed voter,\n address indexed pool,\n uint256 indexed tokenId,\n uint256 weight,\n uint256 totalWeight,\n uint256 timestamp\n );\n\n /**\n * @notice Event emitted when a vote is abstained.\n * @param voter Address of the voter.\n * @param pool Address of the pool.\n * @param tokenId ID of the token.\n * @param weight Weight of the vote.\n * @param totalWeight Total weight of the vote.\n * @param timestamp Timestamp of the vote.\n */\n event Abstained(\n address indexed voter,\n address indexed pool,\n uint256 indexed tokenId,\n uint256 weight,\n uint256 totalWeight,\n uint256 timestamp\n );\n\n /**\n * @notice Event emitted when a reward is notified.\n * @param sender Address of the sender.\n * @param reward Address of the reward.\n * @param amount Amount of the reward.\n */\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\n\n /**\n * @notice Event emitted when a token is whitelisted.\n * @param whitelister Address of the whitelister.\n * @param token Address of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\n\n /**\n * @notice Event emitted when an NFT is whitelisted.\n * @param whitelister Address of the whitelister.\n * @param tokenId ID of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\n\n event LpTokensSet(address[] indexed lpTokens);\n event MpoSet(address indexed mpo);\n event GovernorSet(address indexed governor);\n event MarketsAdded(Market[] markets);\n event MarketRewardAccumulatorsSet(\n address[] indexed markets,\n MarketSide[] indexed marketSides,\n address[] indexed rewardAccumulators\n );\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\n\n /**\n * @notice Get the weight of a market.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param lpToken Address of the LP token.\n * @return The weight of the market.\n */\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\n\n /**\n * @notice Get the votes for a token.\n * @param tokenId ID of the token.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param lpToken Address of the LP token.\n * @return The votes for the token.\n */\n function votes(\n uint256 tokenId,\n address market,\n MarketSide marketSide,\n address lpToken\n ) external view returns (uint256);\n\n /**\n * @notice Get the used weights for a token.\n * @param tokenId ID of the token.\n * @param lpToken Address of the LP token.\n * @return The used weights for the token.\n */\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\n\n /**\n * @notice Get the last voted timestamp for a token.\n * @param tokenId ID of the token.\n * @return The last voted timestamp for the token.\n */\n function lastVoted(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Check if a token is whitelisted.\n * @param token Address of the token.\n * @return True if the token is whitelisted, false otherwise.\n */\n function isWhitelistedToken(address token) external view returns (bool);\n\n /**\n * @notice Check if an NFT is whitelisted.\n * @param tokenId ID of the token.\n * @return True if the NFT is whitelisted, false otherwise.\n */\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\n\n /**\n * @notice Get the address of the ve contract.\n * @return The address of the ve contract.\n */\n function ve() external view returns (address);\n\n /**\n * @notice Get the address of the governor.\n * @return The address of the governor.\n */\n function governor() external view returns (address);\n\n /**\n * @notice Update voting balances in voting rewards contracts.\n * @param _tokenId ID of veNFT whose balance you wish to update.\n */\n function poke(uint256 _tokenId) external;\n\n /**\n * @notice Vote for pools. Votes distributed proportionally based on weights.\n * @dev Can only vote or deposit into a managed NFT once per epoch.\n * Can only vote for gauges that have not been killed.\n * Throws if length of _poolVote and _weights do not match.\n * @param _tokenId ID of veNFT you are voting with.\n * @param _poolVote Array of pools you are voting for.\n * @param _marketVoteSide Array of market vote sides you are voting for.\n * @param _weights Weights of pools.\n */\n function vote(\n uint256 _tokenId,\n address[] calldata _poolVote,\n MarketSide[] calldata _marketVoteSide,\n uint256[] calldata _weights\n ) external;\n\n /**\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\n * @dev Cannot reset in the same epoch that you voted in.\n * Can vote or deposit into a managed NFT again after reset.\n * @param _tokenId ID of veNFT that you are resetting.\n */\n function reset(uint256 _tokenId) external;\n\n /**\n * @notice Distributes rewards to eligible markets.\n */\n function distributeRewards() external;\n\n /**\n * @notice Claim bribes for a given NFT.\n * @dev Utility to help batch bribe claims.\n * @param _bribes Array of BribeVotingReward contracts to collect from.\n * @param _tokens Array of tokens that are used as bribes.\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\n */\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\n\n /**\n * @notice Whitelist (or unwhitelist) token for use in bribes.\n * @dev Throws if not called by governor.\n * @param _token Address of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n function whitelistToken(address _token, bool _bool) external;\n\n /**\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\n * @dev Throws if not called by governor.\n * Throws if already whitelisted.\n * @param _tokenId ID of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\n\n /**\n * @notice Set the LP tokens.\n * @param _lpTokens Array of LP token addresses.\n */\n function setLpTokens(address[] memory _lpTokens) external;\n\n /**\n * @notice Set the Master Price Oracle (MPO) address.\n * @param _mpo Address of the Master Price Oracle.\n */\n function setMpo(address _mpo) external;\n\n /**\n * @notice Set a new governor.\n * @param _governor Address of the new governor.\n */\n function setGovernor(address _governor) external;\n\n /**\n * @notice Add new markets.\n * @param _markets Array of Market structs to be added.\n */\n function addMarkets(Market[] calldata _markets) external;\n\n /**\n * @notice Set reward accumulators for markets.\n * @param _markets Array of market addresses.\n * @param _marketSides Array of market sides.\n * @param _rewardAccumulators Array of reward accumulator addresses.\n */\n function setMarketRewardAccumulators(\n address[] calldata _markets,\n MarketSide[] calldata _marketSides,\n address[] calldata _rewardAccumulators\n ) external;\n\n /**\n * @notice Set bribes for reward accumulators.\n * @param _rewardAccumulators Array of reward accumulator addresses.\n * @param _bribes Array of bribe addresses.\n */\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\n\n /**\n * @notice Set the maximum number of votes.\n * @param _maxVotingNum Maximum number of votes allowed.\n */\n function setMaxVotingNum(uint256 _maxVotingNum) external;\n\n /**\n * @notice Toggle the alive status of a reward accumulator.\n * @param _market Address of the market.\n * @param _marketSide Side of the market.\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\n */\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\n\n /**\n * @notice Get the start of the epoch for a given timestamp.\n * @param _timestamp The timestamp to calculate the epoch start for.\n * @return The start of the epoch.\n */\n function epochStart(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the next epoch for a given timestamp.\n * @param _timestamp The timestamp to calculate the next epoch for.\n * @return The next epoch.\n */\n function epochNext(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the start of the voting period for a given timestamp.\n * @param _timestamp The timestamp to calculate the voting start for.\n * @return The start of the voting period.\n */\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the end of the voting period for a given timestamp.\n * @param _timestamp The timestamp to calculate the voting end for.\n * @return The end of the voting period.\n */\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the number of markets.\n * @return The number of markets.\n */\n function marketsLength() external view returns (uint256);\n\n /**\n * @notice Get all LP reward tokens.\n * @return An array of addresses representing all LP reward tokens.\n */\n function getAllLpRewardTokens() external view returns (address[] memory);\n\n /**\n * @notice Get vote details for a specific token ID and LP asset.\n * @param _tokenId The ID of the token.\n * @param _lpAsset The address of the LP asset.\n * @return A struct containing vote details.\n */\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\n}\n" + }, + "contracts/veION/libraries/BalanceLogicLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../interfaces/IveIONStructsEnumsErrorsEvents.sol\";\n\nlibrary BalanceLogicLibrary {\n uint256 internal constant _WEEK = 1 weeks;\n\n /// @notice Calculates the voting power for a given NFT at a specific time.\n /// @dev This function is compatible with the ERC20 `balanceOf` interface for Aragon.\n /// It retrieves the last user point before a specified timestamp and computes the voting power at that time.\n /// @param s_userPointEpoch Mapping of user point epochs for all tokens.\n /// @param s_userPointHistory Mapping of user point history for all tokens.\n /// @param _lpType The type of LP token associated with the NFT.\n /// @param _tokenId The ID of the NFT for which to calculate voting power.\n /// @param _t The epoch time at which to calculate the voting power.\n /// @param _isPermanent A boolean indicating if the lock is permanent.\n /// @return The calculated voting power of the user at the specified time.\n function balanceOfNFTAt(\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\n storage s_userPointHistory,\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\n uint256 _tokenId,\n uint256 _t,\n bool _isPermanent\n ) internal view returns (uint256) {\n uint256 _epoch = getPastUserPointIndex(s_userPointEpoch, s_userPointHistory, _lpType, _tokenId, _t);\n // epoch 0 is an empty point\n if (_epoch == 0) return 0;\n IveIONStructsEnumsErrorsEvents.UserPoint memory lastPoint = s_userPointHistory[_tokenId][_lpType][_epoch];\n if (_isPermanent) {\n return lastPoint.permanent + lastPoint.permanentDelegate;\n } else {\n uint256 reduction = lastPoint.slope * (_t - lastPoint.ts);\n if (reduction > lastPoint.bias) {\n lastPoint.bias = 0;\n } else {\n lastPoint.bias -= reduction;\n }\n return lastPoint.bias;\n }\n }\n\n /// @notice Binary search to get the user point index for a token id at or prior to a given timestamp\n /// @dev If a user point does not exist prior to the timestamp, this will return 0.\n /// @param s_userPointEpoch State of all user point epochs\n /// @param s_userPointHistory State of all user point history\n /// @param _tokenId .\n /// @param _timestamp .\n /// @return User point index\n function getPastUserPointIndex(\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\n storage s_userPointHistory,\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\n uint256 _tokenId,\n uint256 _timestamp\n ) internal view returns (uint256) {\n uint256 _userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (_userEpoch == 0) return 0;\n // First check most recent balance\n if (s_userPointHistory[_tokenId][_lpType][_userEpoch].ts <= _timestamp) return (_userEpoch);\n // Next check implicit zero balance\n if (s_userPointHistory[_tokenId][_lpType][1].ts > _timestamp) return 0;\n uint256 lower = 0;\n uint256 upper = _userEpoch;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n IveIONStructsEnumsErrorsEvents.UserPoint storage userPoint = s_userPointHistory[_tokenId][_lpType][center];\n if (userPoint.ts == _timestamp) {\n return center;\n } else if (userPoint.ts < _timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n}\n" + }, + "contracts/veION/libraries/IonicTimeLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nlibrary IonicTimeLibrary {\n uint256 internal constant _WEEK = 7 days;\n\n /// @dev Returns start of epoch based on current timestamp\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK);\n }\n }\n\n /// @dev Returns start of next epoch / end of current epoch\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + _WEEK;\n }\n }\n\n /// @dev Returns start of voting window\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + 1 hours;\n }\n }\n\n /// @dev Returns end of voting window / beginning of unrestricted voting window\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\n }\n }\n}\n" + }, + "contracts/veION/RewardAccumulator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract RewardAccumulator is Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize() external initializer {\n __Ownable2Step_init();\n }\n\n function approve(address _token, address _spender) external onlyOwner {\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\n }\n}\n" + }, + "contracts/veION/stake/IStakeStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\n/**\n * @title IStakeStrategy\n * @notice Interface for the VeloIonModeStakingModeReward contract.\n */\ninterface IStakeStrategy {\n /// @notice Emitted when the contract is initialized\n event Initialized(\n address indexed escrow,\n address indexed stakingToken,\n address indexed stakingContract,\n address stakingWalletImplementation\n );\n\n /// @notice Emitted when tokens are staked\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\n\n /// @notice Emitted when rewards are claimed\n event Claimed(address indexed from, address indexed veloWallet);\n\n /// @notice Emitted when tokens are withdrawn\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\n\n /// @notice Emitted when staking wallet is transferred\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\n\n /// @notice Emitted when escrow is set\n event EscrowSet(address indexed newEscrow);\n\n /// @notice Emitted when staking token is set\n event StakingTokenSet(address indexed newStakingToken);\n\n /// @notice Emitted when staking contract is set\n event StakingContractSet(address indexed newStakingContract);\n\n /// @notice Emitted when upgradeable beacon is set\n event UpgradeableBeaconSet(address indexed newBeacon);\n\n /**\n * @notice Stakes a specified amount of tokens from a given address.\n * @param _from The address from which tokens will be staked.\n * @param _amount The amount of tokens to stake.\n * @param _data Additional data that might be needed for staking.\n */\n function stake(address _from, uint256 _amount, bytes memory _data) external;\n\n /**\n * @notice Claims rewards for a given address.\n * @param _from The address for which to claim rewards.\n */\n function claim(address _from) external;\n\n /**\n * @notice Withdraws a specified amount of tokens for a given address.\n * @param _owner The address from which tokens will be withdrawn.\n * @param _amount The amount of tokens to withdraw.\n */\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\n\n /**\n * @notice Returns the current reward rate for the staking strategy.\n * @return The reward rate as a uint256.\n */\n function rewardRate() external view returns (uint256);\n\n /**\n * @notice Returns the period finish time for the staking strategy.\n * @return The period finish time as a uint256.\n */\n function periodFinish() external view returns (uint256);\n\n /**\n * @notice Returns the balance of a specific address.\n * @param account The address to query the balance of.\n * @return The balance as a uint256.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Returns the total supply of staked tokens.\n * @return The total supply as a uint256.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Returns the address of the reward token for the staking strategy.\n * @return The address of the reward token.\n */\n function rewardToken() external view returns (address);\n\n /**\n * @notice Returns the address of the staking contract.\n * @return The address of the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @notice Returns the address of the staking token.\n * @return The address of the staking token.\n */\n function stakingToken() external view returns (address);\n\n /**\n * @notice Returns the staking wallet address for a specific user.\n * @param user The address of the user.\n * @return The address of the user's staking wallet.\n */\n function userStakingWallet(address user) external view returns (address);\n\n /**\n * @notice Transfers the staking wallet from one user to another.\n * @param from The current owner of the staking wallet.\n * @param to The new owner of the staking wallet.\n */\n function transferStakingWallet(address from, address to, uint256 _amount) external;\n\n /**\n * @notice Sets the escrow address.\n * @param _escrow The address of the new escrow.\n */\n function setEscrow(address _escrow) external;\n\n /**\n * @notice Sets the staking token address.\n * @param _stakingToken The address of the new staking token.\n */\n function setStakingToken(address _stakingToken) external;\n\n /**\n * @notice Sets the staking contract address.\n * @param _stakingContract The address of the new staking contract.\n */\n function setStakingContract(address _stakingContract) external;\n\n /**\n * @notice Sets the address of the beacon.\n * @param _beacon The address of the new beacon contract.\n */\n function setUpgradeableBeacon(address _beacon) external;\n}\n" + }, + "contracts/veION/stake/IStakeWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IStakeWallet {\n /// @notice Emitted when tokens are staked\n event Staked(uint256 amount);\n\n /// @notice Emitted when rewards are claimed\n event Claimed(address indexed from, uint256 rewardAmount);\n\n /// @notice Emitted when tokens are withdrawn\n event Withdrawn(address indexed withdrawTo, uint256 amount);\n\n /**\n * @notice Stakes a specified amount of tokens according to the strategy.\n * @param amount The amount of tokens to stake.\n * @param data Additional data required for the staking strategy.\n */\n function stake(address from, uint256 amount, bytes memory data) external;\n\n /**\n * @notice Claims rewards for the caller.\n */\n function claim(address from) external;\n\n /**\n * @notice Withdraws a specified amount of staked tokens.\n * @param withdrawTo The address to withdraw tokens to.\n * @param amount The amount of tokens to withdraw.\n */\n function withdraw(address withdrawTo, uint256 amount) external;\n}\n" + }, + "contracts/veION/stake/velo/IVeloIonModeStaking.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IVeloIonModeStaking {\n event Deposit(address indexed from, address indexed to, uint256 amount);\n event Withdraw(address indexed from, uint256 amount);\n event NotifyReward(address indexed from, uint256 amount);\n event ClaimFees(uint256 claimed0, uint256 claimed1);\n event ClaimRewards(address indexed from, uint256 amount);\n\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\n function stakingToken() external view returns (address);\n\n /// @notice Address of the token (VELO v2) rewarded to stakers\n function rewardToken() external view returns (address);\n\n /// @notice Address of the Converter contract linked to the gauge\n function feeConverter() external view returns (address);\n\n /// @notice Address of the staking rewards factory that created this gauge\n function factory() external view returns (address);\n\n /// @notice Timestamp end of current rewards period\n function periodFinish() external view returns (uint256);\n\n /// @notice Current reward rate of rewardToken to distribute per second\n function rewardRate() external view returns (uint256);\n\n /// @notice Most recent timestamp contract has updated state\n function lastUpdateTime() external view returns (uint256);\n\n /// @notice Most recent stored value of rewardPerToken\n function rewardPerTokenStored() external view returns (uint256);\n\n /// @notice Amount of stakingToken deposited for rewards\n function totalSupply() external view returns (uint256);\n\n /// @notice Get the amount of stakingToken deposited by an account\n function balanceOf(address) external view returns (uint256);\n\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\n function userRewardPerTokenPaid(address) external view returns (uint256);\n\n /// @notice Cached amount of rewardToken earned for an account\n function rewards(address) external view returns (uint256);\n\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\n function rewardRateByEpoch(uint256) external view returns (uint256);\n\n /// @notice Get the current reward rate per unit of stakingToken deposited\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\n\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\n function lastTimeRewardApplicable() external view returns (uint256 _time);\n\n /// @notice Returns accrued balance to date from last claim / first deposit.\n function earned(address _account) external view returns (uint256 _earned);\n\n /// @notice Total amount of rewardToken to distribute for the current rewards period\n function left() external view returns (uint256 _left);\n\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\n /// @return _claimed0 Amount of Fees claimed in token0\n /// @return _claimed1 Amount of Fees claimed in token1\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\n\n /// @notice Retrieve rewards for an address.\n /// @dev Throws if not called by same address or voter.\n /// @param _account .\n function getReward(address _account) external;\n\n /// @notice Deposit LP tokens into gauge for msg.sender\n /// @param _amount .\n function deposit(uint256 _amount) external;\n\n /// @notice Deposit LP tokens into gauge for any user\n /// @param _amount .\n /// @param _recipient Recipient to give balance to\n function deposit(uint256 _amount, address _recipient) external;\n\n /// @notice Withdraw LP tokens for user\n /// @param _amount .\n function withdraw(uint256 _amount) external;\n\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\n /// If not 18 decimals, rewardRate may have rounding issues.\n function notifyRewardMatch(uint256 amount) external;\n\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\n /// If not 18 decimals, rewardRate may have rounding issues.\n function notifyRewardAmount(uint256 amount) external;\n}\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../IStakeStrategy.sol\";\nimport \"./VeloAeroStakingWallet.sol\";\nimport \"./IVeloIonModeStaking.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\nimport { UpgradeableBeacon } from \"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\";\n\n/**\n * @title VeloAeroStakingStrategy\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract VeloAeroStakingStrategy is IStakeStrategy, Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Address of the escrow responsible for managing staking operations\n address public escrow;\n /// @notice Address of the token being staked\n address public stakingToken;\n /// @notice Address of the contract where staking operations are executed\n address public stakingContract;\n /// @notice Address of beacon contract that manages wallet proxies\n UpgradeableBeacon public veloAeroBeacon;\n /// @notice Mapping of user addresses to their respective staking wallet addresses\n mapping(address => address) public userStakingWallet;\n\n /// @dev Modifier to restrict function access to only the escrow address\n modifier onlyEscrow() {\n require(msg.sender == escrow, \"Not authorized: Only escrow can call this function\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the staking strategy contract with necessary parameters\n * @dev This function can only be called once due to the initializer modifier\n * @param _escrow The address of the escrow responsible for staking operations\n * @param _stakingToken The address of the token to be staked\n * @param _stakingContract The address of the contract handling staking\n * @param _stakingWalletImplementation The address of the staking wallet implementation\n */\n function initialize(\n address _escrow,\n address _stakingToken,\n address _stakingContract,\n address _stakingWalletImplementation\n ) public initializer {\n __Ownable2Step_init();\n escrow = _escrow;\n stakingToken = _stakingToken;\n stakingContract = _stakingContract;\n\n veloAeroBeacon = new UpgradeableBeacon(_stakingWalletImplementation);\n veloAeroBeacon.transferOwnership(msg.sender);\n\n emit Initialized(_escrow, _stakingToken, _stakingContract, _stakingWalletImplementation);\n }\n\n /// @inheritdoc IStakeStrategy\n function stake(address _from, uint256 _amount, bytes memory _data) external override onlyEscrow {\n IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), _amount);\n\n address veloWallet = userStakingWallet[_from];\n if (veloWallet == address(0)) {\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\n veloWallet = address(newWallet);\n VeloAeroStakingWallet(veloWallet).initialize(IStakeStrategy(address(this)));\n userStakingWallet[_from] = veloWallet;\n }\n\n IERC20(stakingToken).approve(veloWallet, _amount);\n VeloAeroStakingWallet(veloWallet).stake(_from, _amount, _data);\n emit Staked(_from, _amount, veloWallet);\n }\n\n /// @inheritdoc IStakeStrategy\n function claim(address _from) external onlyEscrow {\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_from]);\n veloWallet.claim(_from);\n emit Claimed(_from, address(veloWallet));\n }\n\n /// @inheritdoc IStakeStrategy\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external onlyEscrow {\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_owner]);\n veloWallet.withdraw(_withdrawTo, _amount);\n emit Withdrawn(_owner, _withdrawTo, _amount);\n }\n\n /// @inheritdoc IStakeStrategy\n function transferStakingWallet(address _from, address _to, uint256 _amount) external onlyEscrow {\n address fromWallet = userStakingWallet[_from];\n address toWallet = userStakingWallet[_to];\n\n if (toWallet == address(0)) {\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\n toWallet = address(newWallet);\n VeloAeroStakingWallet(toWallet).initialize(IStakeStrategy(address(this)));\n userStakingWallet[_to] = toWallet;\n }\n\n VeloAeroStakingWallet(fromWallet).withdraw(address(this), _amount);\n IERC20(stakingToken).approve(address(toWallet), _amount);\n VeloAeroStakingWallet(toWallet).stake(_to, _amount, \"\");\n emit StakingWalletTransferred(_from, _to, _amount);\n }\n\n /// @inheritdoc IStakeStrategy\n function rewardRate() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).rewardRate();\n }\n\n /// @inheritdoc IStakeStrategy\n function periodFinish() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).periodFinish();\n }\n\n /// @inheritdoc IStakeStrategy\n function balanceOf(address account) public view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).balanceOf(account);\n }\n\n /// @inheritdoc IStakeStrategy\n function totalSupply() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).totalSupply();\n }\n\n /// @inheritdoc IStakeStrategy\n function rewardToken() public view returns (address) {\n return IVeloIonModeStaking(stakingContract).rewardToken();\n }\n\n /// @inheritdoc IStakeStrategy\n function setEscrow(address _escrow) external onlyOwner {\n require(_escrow != address(0), \"Invalid address\");\n escrow = _escrow;\n emit EscrowSet(_escrow);\n }\n\n /// @inheritdoc IStakeStrategy\n function setStakingToken(address _stakingToken) external onlyOwner {\n require(_stakingToken != address(0), \"Invalid address\");\n stakingToken = _stakingToken;\n emit StakingTokenSet(_stakingToken);\n }\n\n /// @inheritdoc IStakeStrategy\n function setStakingContract(address _stakingContract) external onlyOwner {\n require(_stakingContract != address(0), \"Invalid address\");\n stakingContract = _stakingContract;\n emit StakingContractSet(_stakingContract);\n }\n\n /// @inheritdoc IStakeStrategy\n function setUpgradeableBeacon(address _beacon) external onlyOwner {\n require(_beacon != address(0), \"Invalid address\");\n veloAeroBeacon = UpgradeableBeacon(_beacon);\n emit UpgradeableBeaconSet(_beacon);\n }\n}\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IStakeWallet } from \"../IStakeWallet.sol\";\nimport { IStakeStrategy } from \"../IStakeStrategy.sol\";\nimport { IVeloIonModeStaking } from \"./IVeloIonModeStaking.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title VeloAeroStakingWallet\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\n * @author Jourdan Dunkley \n */\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n IStakeStrategy public stakeStrategy;\n\n /// @dev Modifier to restrict function access to only the stake strategy contract\n modifier onlyStakeStrategy() {\n require(msg.sender == address(stakeStrategy), \"Not authorized: Only stake strategy can call this function\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the contract with a staking strategy\n * @dev Can only be called once due to initializer modifier\n * @param _stakeStrategy The address of the staking strategy contract\n */\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\n stakeStrategy = _stakeStrategy;\n }\n\n /// @inheritdoc IStakeWallet\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\n stakingToken.approve(address(stakingContract), _amount);\n stakingContract.deposit(_amount);\n emit Staked(_amount);\n }\n\n /// @inheritdoc IStakeWallet\n function claim(address _from) external onlyStakeStrategy {\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingContract.getReward(address(this));\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\n emit Claimed(_from, rewardAmount);\n }\n\n /// @inheritdoc IStakeWallet\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingContract.withdraw(_amount);\n stakingToken.safeTransfer(_withdrawTo, _amount);\n emit Withdrawn(_withdrawTo, _amount);\n }\n}\n" + }, + "contracts/veION/veION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IveIONCore, IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veION is Ownable2StepUpgradeable, ERC721Upgradeable, ReentrancyGuardUpgradeable, veIONStorage, IveIONCore {\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the veION contract with the given AddressesProvider.\n * @dev This function is called only once during the contract deployment.\n * It initializes the Ownable, ERC721, and ReentrancyGuard modules.\n * @param _ap The AddressesProvider contract used for address management.\n */\n function initialize(IAddressesProvider _ap) public initializer {\n __Ownable2Step_init();\n __ERC721_init(\"veION\", \"veION\");\n __ReentrancyGuard_init();\n ap = _ap;\n emit Initialized(address(_ap));\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONCore\n function createLockFor(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) external override nonReentrant returns (uint256) {\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _to);\n }\n\n /// @inheritdoc IveIONCore\n function createLock(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying\n ) external override nonReentrant returns (uint256) {\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _msgSender());\n }\n\n /// @inheritdoc IveIONCore\n function increaseAmount(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n bool _stakeUnderlying\n ) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_tokenAmount == 0) revert ZeroAmount();\n if (oldLocked.amount == 0) revert NoLockFound();\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\n\n if (oldLocked.isPermanent) s_permanentLockBalance[_lpType] += _tokenAmount;\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n _tokenAmount,\n 0,\n _stakeUnderlying,\n oldLocked,\n DepositType.INCREASE_LOCK_AMOUNT,\n _lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function lockAdditionalAsset(\n address _tokenAddress,\n uint256 _tokenAmount,\n uint256 _tokenId,\n uint256 _duration,\n bool _stakeUnderlying\n ) external nonReentrant {\n LpTokenType lpType = s_lpType[_tokenAddress];\n LockedBalance storage lockedBalance = s_locked[_tokenId][lpType];\n uint256 unlockTime = ((block.timestamp + _duration) / _WEEK) * _WEEK;\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_tokenAmount == 0) revert ZeroAmount();\n if (s_voted[_tokenId]) revert AlreadyVoted();\n if (!s_assetsLocked[_tokenId].add(_tokenAddress)) revert DuplicateAsset();\n if (_tokenAmount < s_minimumLockAmount[lpType]) revert MinimumNotMet();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n if (_duration < s_minimumLockDuration) revert LockDurationTooShort();\n\n if (lockedBalance.isPermanent) s_permanentLockBalance[lpType] += _tokenAmount;\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n _tokenAmount,\n unlockTime,\n _stakeUnderlying,\n lockedBalance,\n DepositType.LOCK_ADDITIONAL,\n lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n uint256 unlockTime = ((block.timestamp + _lockDuration) / _WEEK) * _WEEK; // Locktime is rounded down to weeks\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (oldLocked.isPermanent) revert PermanentLock();\n if (oldLocked.end <= block.timestamp) revert LockExpired();\n if (oldLocked.amount <= 0) revert NoLockFound();\n if (unlockTime <= oldLocked.end) revert LockDurationNotInFuture();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n 0,\n unlockTime,\n false,\n oldLocked,\n DepositType.INCREASE_UNLOCK_TIME,\n _lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external nonReentrant {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender()) revert NotOwner();\n if (amount > fromLocked.amount) revert AmountTooBig();\n if (!fromLocked.isPermanent) revert NotPermanentLock();\n if (!toLocked.isPermanent) revert NotPermanentLock();\n if (s_delegatorsBlocked[toTokenId][lpToken]) revert NotAcceptingDelegators();\n\n fromLocked.amount -= amount;\n toLocked.delegateAmount += amount;\n\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].add(toTokenId);\n s_delegators[toTokenId][lpType].add(fromTokenId);\n }\n\n s_delegations[fromTokenId][toTokenId][lpType] += amount;\n\n s_locked[fromTokenId][lpType] = fromLocked;\n s_locked[toTokenId][lpType] = toLocked;\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit Delegated(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /**\n * @dev Internal function to remove a delegation between two veNFTs.\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\n * @param toTokenId ID of the veNFT to which delegation is being removed.\n * @param lpToken Address of the LP token associated with the delegation.\n * @param amount Amount of delegation to remove.\n */\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\n\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\n ? s_delegations[fromTokenId][toTokenId][lpType]\n : amount;\n\n toLocked.delegateAmount -= amount;\n fromLocked.amount += amount;\n\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\n s_delegators[toTokenId][lpType].remove(fromTokenId);\n }\n\n s_locked[toTokenId][lpType] = toLocked;\n s_locked[fromTokenId][lpType] = fromLocked;\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /// @inheritdoc IveIONCore\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) public nonReentrant {\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 toTokenIdsLength = toTokenIds.length;\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONCore\n function removeDelegators(\n uint256[] memory fromTokenIds,\n uint256 toTokenId,\n address lpToken,\n uint256[] memory amounts\n ) external nonReentrant {\n if (fromTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 fromTokenIdsLength = fromTokenIds.length;\n for (uint256 i = 0; i < fromTokenIdsLength; i++) {\n _removeDelegation(fromTokenIds[i], toTokenId, lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONCore\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_newLocked.isPermanent) revert PermanentLock();\n if (_newLocked.end <= block.timestamp) revert LockExpired();\n if (_newLocked.amount <= 0) revert NoLockFound();\n\n s_permanentLockBalance[_lpType] += _newLocked.amount;\n _newLocked.end = 0;\n _newLocked.isPermanent = true;\n _newLocked.boost = _calculateBoost(_MAXTIME);\n\n s_locked[_tokenId][_lpType] = _newLocked;\n _checkpoint(_tokenId, _newLocked, _lpType);\n\n emit PermanentLockCreated(_tokenAddress, _tokenId, _newLocked.amount);\n }\n\n /// @inheritdoc IveIONCore\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (!_newLocked.isPermanent) revert NotPermanentLock();\n if (s_delegatees[_tokenId][_lpType].length() != 0) revert TokenHasDelegatees();\n if (s_delegators[_tokenId][_lpType].length() != 0) revert TokenHasDelegators();\n\n s_permanentLockBalance[_lpType] -= _newLocked.amount;\n _newLocked.end = ((block.timestamp + _MAXTIME) / _WEEK) * _WEEK;\n _newLocked.isPermanent = false;\n\n s_locked[_tokenId][_lpType] = _newLocked;\n _checkpoint(_tokenId, _newLocked, _lpType);\n\n emit PermanentLockRemoved(_tokenAddress, _tokenId, _newLocked.amount);\n }\n\n /**\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\n * @param tokenId Token ID to burn.\n */\n function _burn(uint256 tokenId) internal override {\n super._burn(tokenId);\n }\n\n /**\n * @notice Hook that is called before any token transfer. This includes minting\n * and burning. It updates the ownership mappings and handles delegation and\n * staking logic when transferring tokens between addresses.\n *\n * @param from The address which previously owned the token.\n * @param to The address that will receive the token.\n * @param tokenId The ID of the token being transferred.\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\n\n if (from != address(0) && to != address(0)) {\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType _lpType = s_lpType[asset];\n\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\n uint256[] memory amounts = new uint256[](delegatees.length);\n uint256 delegateesLength = delegatees.length;\n for (uint256 j = 0; j < delegateesLength; j++) {\n amounts[j] = type(uint256).max;\n }\n\n if (delegateesLength != 0) {\n removeDelegatees(tokenId, delegatees, asset, amounts);\n }\n\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\n if (amountStaked != 0) {\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\n }\n\n LockedBalance memory lock = s_locked[tokenId][_lpType];\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\n s_userCumulativeAssetValues[to][asset] += lock.amount;\n }\n }\n }\n\n /// @inheritdoc IveIONCore\n function voting(uint256 _tokenId, bool _voting) external {\n if (_msgSender() != s_voter) revert NotVoter();\n s_voted[_tokenId] = _voting;\n emit Voted(_tokenId, _voting);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n struct DepositVars {\n uint256 supplyBefore;\n uint256 totalLockTime;\n LockedBalance newLocked;\n address from;\n }\n\n /**\n * @notice Deposits tokens for a specific veNFT, updating its locked balance and boost.\n * @dev This function handles the deposit logic for veNFTs, including updating the locked balance,\n * calculating the boost based on the lock duration, and transferring tokens.\n * @param _tokenAddress The address of the token to deposit.\n * @param _tokenId The ID of the veNFT to deposit tokens for.\n * @param _tokenAmount The amount of tokens to deposit.\n * @param _unlockTime The time at which the lock will expire.\n * @param _stakeUnderlying A boolean indicating whether to stake the underlying tokens.\n * @param _oldLocked The previous locked balance of the veNFT.\n * @param _depositType The type of deposit being made.\n * @param _lpType The LP token type associated with the deposit.\n * @param _to The address to which the veNFT is assigned.\n */\n function _depositFor(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n uint256 _unlockTime,\n bool _stakeUnderlying,\n LockedBalance memory _oldLocked,\n DepositType _depositType,\n LpTokenType _lpType,\n address _to\n ) internal {\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\n\n DepositVars memory vars;\n vars.supplyBefore = s_supply[_lpType];\n s_supply[_lpType] = vars.supplyBefore + _tokenAmount;\n\n (\n vars.newLocked.tokenAddress,\n vars.newLocked.amount,\n vars.newLocked.start,\n vars.newLocked.end,\n vars.newLocked.isPermanent,\n vars.newLocked.boost\n ) = (\n _oldLocked.tokenAddress,\n _oldLocked.amount,\n _oldLocked.start,\n _oldLocked.end,\n _oldLocked.isPermanent,\n _oldLocked.boost\n );\n\n vars.newLocked.tokenAddress = _tokenAddress;\n vars.newLocked.amount += _tokenAmount;\n if (_unlockTime != 0) {\n if (vars.newLocked.start == 0) vars.newLocked.start = block.timestamp;\n vars.newLocked.end = _unlockTime;\n vars.totalLockTime = vars.newLocked.end - vars.newLocked.start;\n vars.newLocked.boost = _calculateBoost(vars.totalLockTime);\n }\n s_locked[_tokenId][_lpType] = vars.newLocked;\n\n _checkpoint(_tokenId, vars.newLocked, _lpType);\n\n vars.from = _msgSender();\n if (_tokenAmount != 0) {\n s_userCumulativeAssetValues[ownerOf(_tokenId)][_tokenAddress] += _tokenAmount;\n IERC20(_tokenAddress).safeTransferFrom(vars.from, address(this), _tokenAmount);\n (IStakeStrategy _stakeStrategy, bytes memory _stakeData) = _getStakeStrategy(_lpType);\n if (address(_stakeStrategy) != address(0) && _stakeUnderlying) {\n _handleTokenStake(_to, _tokenId, _tokenAddress, _tokenAmount, _stakeStrategy, _stakeData);\n }\n }\n\n emit Deposit(_to, _tokenId, _depositType, _tokenAmount, vars.newLocked.end, block.timestamp);\n emit Supply(vars.supplyBefore, s_supply[_lpType]);\n }\n\n /**\n * @notice Handles the staking of tokens using a specified staking strategy.\n * @param _to The address to which the stake is attributed.\n * @param _tokenId The ID of the token being staked.\n * @param _tokenAddress The address of the token being staked.\n * @param _tokenAmount The amount of tokens to stake.\n * @param _stakeStrategy The staking strategy to use.\n * @param _stakeData Additional data required for staking.\n */\n function _handleTokenStake(\n address _to,\n uint256 _tokenId,\n address _tokenAddress,\n uint256 _tokenAmount,\n IStakeStrategy _stakeStrategy,\n bytes memory _stakeData\n ) internal {\n IERC20(_tokenAddress).approve(address(_stakeStrategy), _tokenAmount);\n _stakeStrategy.stake(_to, _tokenAmount, _stakeData);\n s_underlyingStake[_tokenId][_tokenAddress] += _tokenAmount;\n }\n\n /**\n * @notice Updates the user point history and epoch for a given token and LP token type.\n * @param _tokenId The ID of the token.\n * @param _newLocked The new locked balance information.\n * @param _lpType The LP token type.\n */\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\n UserPoint memory uNew;\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\n\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\n uNew.slope = _newLocked.amount / _MAXTIME;\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\n }\n\n uNew.ts = block.timestamp;\n uNew.blk = block.number;\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n } else {\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n }\n }\n\n /**\n * @notice Creates a lock for multiple tokens with specified durations and staking options.\n * @param _tokenAddress Array of token addresses to lock.\n * @param _tokenAmount Array of token amounts to lock.\n * @param _duration Array of durations for each lock.\n * @param _stakeUnderlying Array of booleans indicating whether to stake the underlying tokens.\n * @param _to The address to which the lock is attributed.\n * @return The ID of the newly created lock.\n */\n function _createLock(\n address[] memory _tokenAddress,\n uint256[] memory _tokenAmount,\n uint256[] memory _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) internal returns (uint256) {\n uint256 _tokenId = ++s_tokenId;\n uint256 _length = _tokenAddress.length;\n _safeMint(_to, _tokenId);\n\n if (\n _tokenAddress.length != _tokenAmount.length ||\n _tokenAmount.length != _duration.length ||\n _duration.length != _stakeUnderlying.length\n ) {\n revert ArrayMismatch();\n }\n\n for (uint256 i = 0; i < _length; i++) {\n LpTokenType _lpType = s_lpType[_tokenAddress[i]];\n uint256 unlockTime = ((block.timestamp + _duration[i]) / _WEEK) * _WEEK;\n\n if (!s_assetsLocked[_tokenId].add(_tokenAddress[i])) revert DuplicateAsset();\n if (_tokenAmount[i] == 0) revert ZeroAmount();\n if (_duration[i] < s_minimumLockDuration) revert LockDurationTooShort();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n if (_tokenAmount[i] < s_minimumLockAmount[_lpType]) revert MinimumNotMet();\n\n _depositFor(\n _tokenAddress[i],\n _tokenId,\n _tokenAmount[i],\n unlockTime,\n _stakeUnderlying[i],\n s_locked[_tokenId][_lpType],\n DepositType.CREATE_LOCK_TYPE,\n _lpType,\n _to\n );\n }\n return _tokenId;\n }\n\n /**\n * @notice Calculates the boost for a given lock duration.\n * @param _duration The duration of the lock.\n * @return The calculated boost value.\n */\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\n uint256 minDuration = s_minimumLockDuration;\n uint256 maxDuration = _MAXTIME;\n uint256 minBoost = 1e18;\n uint256 maxBoost = 2e18;\n\n if (_duration <= minDuration) {\n return minBoost;\n } else if (_duration >= maxDuration) {\n return maxBoost;\n } else {\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\n }\n }\n\n /**\n * @notice Retrieves the staking strategy and data for a given LP token type.\n * @param _lpType The LP token type.\n * @return _stakeStrategy The staking strategy for the LP token type.\n * @return _stakeData The staking data for the LP token type.\n */\n function _getStakeStrategy(\n LpTokenType _lpType\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\n return (strategy, \"\");\n }\n\n /// @inheritdoc IveIONCore\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external onlyOwner {\n require(_veIONFirstExtension != address(0), \"Invalid First Extension Address\");\n require(_veIONSecondExtension != address(0), \"Invalid Second Extension Address\");\n require(_veIONFirstExtension != _veIONSecondExtension, \"Submitted Identical Addresses\");\n veIONFirstExtension = _veIONFirstExtension;\n veIONSecondExtension = _veIONSecondExtension;\n emit ExtensionsSet(_veIONFirstExtension, _veIONSecondExtension);\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external {\n address impl = veIONFirstExtension;\n require(impl != address(0), \"Implementation not set\");\n\n assembly {\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\n\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/veION/veIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\nimport { IveIONFirstExtension } from \"./interfaces/IveIONFirstExtension.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract First Extensions\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veIONFirstExtension is\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ReentrancyGuardUpgradeable,\n veIONStorage,\n IveIONFirstExtension\n{\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONFirstExtension\n function withdraw(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n address sender = _msgSender();\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (s_voted[_tokenId]) revert AlreadyVoted();\n if (oldLocked.isPermanent) revert PermanentLock();\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\n if (oldLocked.amount == 0 || !s_assetsLocked[_tokenId].contains(_tokenAddress)) revert NoLockFound();\n\n uint256 value = oldLocked.amount;\n s_userCumulativeAssetValues[sender][_tokenAddress] -= value;\n uint256 fee = 0;\n\n if (block.timestamp < oldLocked.end) {\n uint256 daysLocked = ((oldLocked.end - oldLocked.start) * 1e18) / 1 days;\n uint256 daysLeft = ((oldLocked.end - block.timestamp) * 1e18) / 1 days;\n uint256 timeFactor = (daysLeft * 1e18) / daysLocked;\n uint256 veLPLocked = s_supply[_lpType];\n uint256 LPInCirculation = IERC20(_tokenAddress).totalSupply();\n uint256 ratioFactor = 1e18 - (veLPLocked * 1e18) / LPInCirculation;\n fee = (timeFactor * ratioFactor * oldLocked.boost) / 1e36;\n if (fee > s_maxEarlyWithdrawFee) fee = s_maxEarlyWithdrawFee;\n fee = (value * fee) / 1e18;\n value -= fee;\n\n uint256 feeToDistribute = (fee * 75) / 100;\n uint256 feeToProtocol = fee - feeToDistribute;\n s_protocolFees[_lpType] += feeToProtocol;\n s_distributedFees[_lpType] += feeToDistribute;\n }\n\n s_locked[_tokenId][_lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\n s_assetsLocked[_tokenId].remove(_tokenAddress);\n uint256 supplyBefore = s_supply[_lpType];\n\n uint256 amountStaked = s_underlyingStake[_tokenId][_tokenAddress];\n if (amountStaked != 0) {\n (IStakeStrategy _stakeStrategy, ) = _getStakeStrategy(_lpType);\n if (address(_stakeStrategy) != address(0)) {\n _handleTokenWithdrawStake(sender, address(this), _tokenId, _tokenAddress, amountStaked, _stakeStrategy);\n }\n }\n\n s_supply[_lpType] = supplyBefore - oldLocked.amount;\n _checkpoint(_tokenId, LockedBalance(address(0), 0, 0, 0, 0, false, 0), _lpType);\n\n // Check if all LP types for this token have zero balance\n bool shouldBurn = true;\n address[] memory lockedAssets = s_assetsLocked[_tokenId].values();\n uint256 lockedAssetsLength = lockedAssets.length;\n for (uint256 i = 0; i < lockedAssetsLength; i++) {\n LpTokenType assetLpType = s_lpType[lockedAssets[i]];\n if (s_locked[_tokenId][assetLpType].amount > 0) {\n shouldBurn = false;\n break;\n }\n }\n\n if (shouldBurn) _burn(_tokenId);\n\n IERC20(_tokenAddress).safeTransfer(sender, value);\n emit Withdraw(sender, _tokenId, value, block.timestamp);\n emit Supply(supplyBefore, supplyBefore - oldLocked.amount);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function merge(uint256 _from, uint256 _to) external nonReentrant {\n if (_from == _to) revert SameNFT();\n if (s_voted[_from] || s_voted[_to]) revert AlreadyVoted();\n if (ownerOf(_from) != _msgSender()) revert NotOwner();\n if (ownerOf(_to) != _msgSender()) revert NotOwner();\n\n address[] memory assetsLocked = s_assetsLocked[_from].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType lpType = s_lpType[asset];\n\n LockedBalance memory oldLockedTo = s_locked[_to][lpType];\n LockedBalance memory oldLockedFrom = s_locked[_from][lpType];\n\n if (oldLockedTo.end != 0 && oldLockedTo.end <= block.timestamp) revert LockExpired();\n if (oldLockedFrom.end != 0 && oldLockedFrom.end <= block.timestamp) revert LockExpired();\n if (oldLockedFrom.isPermanent) revert PermanentLock();\n if (oldLockedTo.isPermanent) revert PermanentLock();\n\n LockedBalance memory newLockedTo;\n\n newLockedTo.tokenAddress = asset;\n newLockedTo.amount = oldLockedTo.amount + oldLockedFrom.amount;\n newLockedTo.start = oldLockedTo.start < oldLockedFrom.start && oldLockedTo.start != 0\n ? oldLockedTo.start\n : oldLockedFrom.start;\n newLockedTo.end = oldLockedTo.end > oldLockedFrom.end ? oldLockedTo.end : oldLockedFrom.end;\n newLockedTo.boost = _calculateBoost(newLockedTo.end - newLockedTo.start);\n\n s_locked[_from][lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\n _checkpoint(_from, LockedBalance(address(0), 0, 0, 0, 0, false, 0), lpType);\n s_locked[_to][lpType] = newLockedTo;\n _checkpoint(_to, newLockedTo, lpType);\n\n s_assetsLocked[_from].remove(asset);\n if (!s_assetsLocked[_to].contains(asset)) {\n s_assetsLocked[_to].add(asset);\n }\n\n if (s_underlyingStake[_from][asset] != 0) {\n s_underlyingStake[_to][asset] += s_underlyingStake[_from][asset];\n s_underlyingStake[_from][asset] = 0;\n }\n }\n _burn(_from);\n emit MergeCompleted(_from, _to, assetsLocked, assetsLocked.length);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function split(\n address _tokenAddress,\n uint256 _from,\n uint256 _splitAmount\n ) external nonReentrant returns (uint256 _tokenId1, uint256 _tokenId2) {\n address ownerFrom = _ownerOf(_from);\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_from][_lpType];\n uint256 minimumLockAmount = s_minimumLockAmount[_lpType];\n\n if (s_voted[_from]) revert AlreadyVoted();\n if (!s_canSplit[ownerFrom] && !s_canSplit[address(0)]) revert SplitNotAllowed();\n if (ownerFrom != _msgSender()) revert NotOwner();\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\n if (_splitAmount >= oldLocked.amount) revert AmountTooBig();\n if (_splitAmount < minimumLockAmount) revert SplitTooSmall();\n if (oldLocked.amount - _splitAmount < minimumLockAmount) revert NotEnoughRemainingAfterSplit();\n\n LockedBalance memory oldLockedTemp = oldLocked;\n\n oldLocked.amount -= _splitAmount;\n s_locked[_from][_lpType] = oldLocked;\n _checkpoint(_from, oldLocked, _lpType);\n\n LockedBalance memory splitLocked = oldLockedTemp;\n splitLocked.amount = _splitAmount;\n _tokenId2 = _createSplitVE(ownerFrom, splitLocked, _lpType, _tokenAddress);\n _tokenId1 = _from;\n\n if (s_underlyingStake[_from][_tokenAddress] != 0) {\n s_underlyingStake[_from][_tokenAddress] -= _splitAmount;\n s_underlyingStake[_tokenId2][_tokenAddress] = _splitAmount;\n }\n\n emit SplitCompleted(_from, _tokenId1, _tokenId2, _splitAmount, _tokenAddress);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function claimEmissions(address _tokenAddress) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n if (_stakeStrategy.userStakingWallet(_msgSender()) == address(0)) revert NoUnderlyingStake();\n _stakeStrategy.claim(_msgSender());\n emit EmissionsClaimed(_msgSender(), _tokenAddress);\n }\n\n /**\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\n * @param tokenId Token ID to burn.\n */\n function _burn(uint256 tokenId) internal override {\n super._burn(tokenId);\n }\n\n /**\n * @notice Hook that is called before any token transfer. This includes minting\n * and burning. It updates the ownership mappings and handles delegation and\n * staking logic when transferring tokens between addresses.\n *\n * @param from The address which previously owned the token.\n * @param to The address that will receive the token.\n * @param tokenId The ID of the token being transferred.\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\n\n if (from != address(0) && to != address(0)) {\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType _lpType = s_lpType[asset];\n\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\n uint256[] memory amounts = new uint256[](delegatees.length);\n uint256 delegateesLength = delegatees.length;\n for (uint256 j = 0; j < delegateesLength; j++) {\n amounts[j] = type(uint256).max;\n }\n\n if (delegateesLength != 0) {\n removeDelegatees(tokenId, delegatees, asset, amounts);\n }\n\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\n if (amountStaked != 0) {\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\n }\n\n LockedBalance memory lock = s_locked[tokenId][_lpType];\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\n s_userCumulativeAssetValues[to][asset] += lock.amount;\n }\n }\n }\n\n /**\n * @dev Internal function to remove a delegation between two veNFTs.\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\n * @param toTokenId ID of the veNFT to which delegation is being removed.\n * @param lpToken Address of the LP token associated with the delegation.\n * @param amount Amount of delegation to remove.\n */\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\n\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\n ? s_delegations[fromTokenId][toTokenId][lpType]\n : amount;\n\n toLocked.delegateAmount -= amount;\n fromLocked.amount += amount;\n\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\n s_delegators[toTokenId][lpType].remove(fromTokenId);\n }\n\n s_locked[toTokenId][lpType] = toLocked;\n s_locked[fromTokenId][lpType] = fromLocked;\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /**\n * @notice Removes delegatees from a specific veNFT\n * @param fromTokenId ID of the veNFT from which delegatees are removed\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegatee\n */\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) public nonReentrant {\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 toTokenIdsLength = toTokenIds.length;\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONFirstExtension\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external nonReentrant {\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n s_delegatorsBlocked[_tokenId][_tokenAddress] = _blocked;\n emit DelegatorsBlocked(_tokenId, _tokenAddress, _blocked);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /**\n * @notice Handles the withdrawal of staked tokens using a specified staking strategy.\n * @param _owner The address of the owner of the stake.\n * @param _withdrawTo The address to which the withdrawn tokens are sent.\n * @param _tokenId The ID of the token being withdrawn.\n * @param _tokenAddress The address of the token being withdrawn.\n * @param _tokenAmount The amount of tokens to withdraw.\n * @param _stakeStrategy The staking strategy to use for withdrawal.\n */\n function _handleTokenWithdrawStake(\n address _owner,\n address _withdrawTo,\n uint256 _tokenId,\n address _tokenAddress,\n uint256 _tokenAmount,\n IStakeStrategy _stakeStrategy\n ) internal {\n _stakeStrategy.claim(_owner);\n _stakeStrategy.withdraw(_owner, _withdrawTo, _tokenAmount);\n s_underlyingStake[_tokenId][_tokenAddress] -= _tokenAmount;\n }\n\n /**\n * @notice Updates the user point history and epoch for a given token and LP token type.\n * @param _tokenId The ID of the token.\n * @param _newLocked The new locked balance information.\n * @param _lpType The LP token type.\n */\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\n UserPoint memory uNew;\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\n\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\n uNew.slope = _newLocked.amount / _MAXTIME;\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\n }\n\n uNew.ts = block.timestamp;\n uNew.blk = block.number;\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n } else {\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n }\n }\n\n /**\n * @notice Calculates the boost for a given lock duration.\n * @param _duration The duration of the lock.\n * @return The calculated boost value.\n */\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\n uint256 minDuration = s_minimumLockDuration;\n uint256 maxDuration = _MAXTIME;\n uint256 minBoost = 1e18;\n uint256 maxBoost = 2e18;\n\n if (_duration <= minDuration) {\n return minBoost;\n } else if (_duration >= maxDuration) {\n return maxBoost;\n } else {\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\n }\n }\n\n /**\n * @notice Creates a new split veNFT with specified locked balance and LP token type.\n * @param _to The address to which the new veNFT is attributed.\n * @param _newLocked The locked balance information for the new veNFT.\n * @param _lpType The LP token type.\n * @param _tokenAddress The address of the token being locked.\n * @return _tokenId The ID of the newly created veNFT.\n */\n function _createSplitVE(\n address _to,\n LockedBalance memory _newLocked,\n LpTokenType _lpType,\n address _tokenAddress\n ) private returns (uint256 _tokenId) {\n _tokenId = ++s_tokenId;\n _safeMint(_to, _tokenId);\n s_locked[_tokenId][_lpType] = _newLocked;\n s_assetsLocked[_tokenId].add(_tokenAddress);\n _checkpoint(_tokenId, _newLocked, _lpType);\n }\n\n /**\n * @notice Retrieves the staking strategy and data for a given LP token type.\n * @param _lpType The LP token type.\n * @return _stakeStrategy The staking strategy for the LP token type.\n * @return _stakeData The staking data for the LP token type.\n */\n function _getStakeStrategy(\n LpTokenType _lpType\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\n return (strategy, \"\");\n }\n\n /**\n * @notice Calculates the total boost for a given token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return The total boost value.\n */\n function _getTotalBoost(uint256 _tokenId, LpTokenType _lpType) internal view returns (uint256) {\n uint256 totalBoost = s_locked[_tokenId][_lpType].boost;\n if (s_limitedBoostActive) totalBoost += s_limitedBoost;\n if (s_veAERO == address(0)) return totalBoost;\n\n address _owner = ownerOf(_tokenId);\n IAeroVoter aeroVoter = IAeroVoter(s_aeroVoting);\n IAeroVotingEscrow veAERO = IAeroVotingEscrow(s_veAERO);\n uint256 _balance = veAERO.balanceOf(_owner);\n for (uint256 i = 0; i < _balance; i++) {\n uint256 veAeroTokenId = veAERO.ownerToNFTokenIdList(_owner, i);\n uint256 weightToVoteRatio = (aeroVoter.votes(veAeroTokenId, s_ionicPool) * 1e18) / aeroVoter.weights(s_ionicPool);\n totalBoost += (s_aeroVoterBoost * weightToVoteRatio) / 1e18;\n }\n\n return totalBoost;\n }\n\n /**\n * @notice Retrieves the ETH price of a given token.\n * @dev Uses the MasterPriceOracle to fetch the price.\n * @param _token The address of the token for which the ETH price is requested.\n * @return The ETH price of the specified token.\n */\n function _getEthPrice(address _token) internal view returns (uint256) {\n IMasterPriceOracle mpo = IMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n return mpo.price(_token);\n }\n\n // // ╔═══════════════════════════════════════════════════════════════════════════╗\n // // ║ View Functions ║\n // // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONFirstExtension\n function balanceOfNFT(\n uint256 _tokenId\n ) public view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts) {\n address[] memory assetsLocked = s_assetsLocked[_tokenId].values();\n\n _assets = new address[](assetsLocked.length);\n _balances = new uint256[](assetsLocked.length);\n _boosts = new uint256[](assetsLocked.length);\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType lpType = s_lpType[asset];\n LockedBalance memory lockedBalance = s_locked[_tokenId][lpType];\n _boosts[i] = _getTotalBoost(_tokenId, lpType);\n _assets[i] = asset;\n _balances[i] = BalanceLogicLibrary.balanceOfNFTAt(\n s_userPointEpoch,\n s_userPointHistory,\n lpType,\n _tokenId,\n block.timestamp,\n lockedBalance.isPermanent\n );\n }\n\n return (_assets, _balances, _boosts);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\n IVoter voter = IVoter(s_voter);\n address[] memory lpTokens = voter.getAllLpRewardTokens();\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 i = 0; i < lpTokensLength; i++) {\n uint256 ethValue = (s_userCumulativeAssetValues[_owner][lpTokens[i]] * _getEthPrice(lpTokens[i])) / PRECISION;\n totalValue += ethValue;\n }\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external {\n address impl = veIONSecondExtension;\n require(impl != address(0), \"Implementation not set\");\n\n assembly {\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\n\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/veION/veIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\nimport { IveIONSecondExtension } from \"./interfaces/IveIONSecondExtension.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract Second Extension\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veIONSecondExtension is\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ReentrancyGuardUpgradeable,\n veIONStorage,\n IveIONSecondExtension\n{\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /// @inheritdoc IveIONSecondExtension\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external onlyOwner {\n require(_tokens.length == _isWhitelisted.length, \"Unequal Arrays\");\n for (uint256 i; i < _tokens.length; i++) s_whitelistedToken[_tokens[i]] = _isWhitelisted[i];\n emit TokensWhitelisted(_tokens, _isWhitelisted);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external onlyOwner {\n LpTokenType lpType = s_lpType[_tokenAddress];\n uint256 protocolFees = s_protocolFees[lpType];\n require(protocolFees > 0, \"No protocol fees available\");\n s_protocolFees[lpType] = 0;\n IERC20(_tokenAddress).safeTransfer(_recipient, protocolFees);\n emit ProtocolFeesWithdrawn(_tokenAddress, _recipient, protocolFees);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external onlyOwner {\n LpTokenType lpType = s_lpType[_tokenAddress];\n uint256 distributedFees = s_distributedFees[lpType];\n require(distributedFees > 0, \"No distributed fees available\");\n s_distributedFees[lpType] = 0;\n IERC20(_tokenAddress).safeTransfer(_recipient, distributedFees);\n emit DistributedFeesWithdrawn(_tokenAddress, _recipient, distributedFees);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Setter Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONSecondExtension\n function toggleSplit(address _account, bool _isAllowed) external onlyOwner {\n s_canSplit[_account] = _isAllowed;\n emit SplitToggle(_account, _isAllowed);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function toggleLimitedBoost(bool _isBoosted) external onlyOwner {\n s_limitedBoostActive = _isBoosted;\n emit LimitedBoostToggled(_isBoosted);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setLimitedTimeBoost(uint256 _boostAmount) external onlyOwner {\n if (_boostAmount <= 0) revert BoostAmountMustBeGreaterThanZero();\n s_limitedBoost = _boostAmount;\n emit LimitedTimeBoostSet(_boostAmount);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setVoter(address _voter) external onlyOwner {\n if (address(_voter) == address(0)) revert InvalidAddress();\n s_voter = _voter;\n emit VoterSet(_voter);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external onlyOwner {\n if (_minimumAmount <= 0) revert MinimumAmountMustBeGreaterThanZero();\n LpTokenType lpType = s_lpType[_tokenAddress];\n s_minimumLockAmount[lpType] = _minimumAmount;\n emit MinimumLockAmountSet(_tokenAddress, _minimumAmount);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMinimumLockDuration(uint256 _minimumLockDuration) external onlyOwner {\n if (_minimumLockDuration <= 0) revert MinimumLockDurationMustBeGreaterThanZero();\n s_minimumLockDuration = _minimumLockDuration;\n emit MinimumLockDurationSet(_minimumLockDuration);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setIonicPool(address _ionicPool) external onlyOwner {\n if (address(_ionicPool) == address(0)) revert InvalidAddress();\n s_ionicPool = _ionicPool;\n emit IonicPoolSet(_ionicPool);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setAeroVoting(address _aeroVoting) external onlyOwner {\n if (address(_aeroVoting) == address(0)) revert InvalidAddress();\n s_aeroVoting = _aeroVoting;\n emit AeroVotingSet(_aeroVoting);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external onlyOwner {\n if (_aeroVoterBoost <= 0) revert AeroBoostAmountMustBeGreaterThanZero();\n s_aeroVoterBoost = _aeroVoterBoost;\n emit AeroVoterBoostSet(_aeroVoterBoost);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external onlyOwner {\n if (_maxEarlyWithdrawFee <= 0) revert MaxEarlyWithdrawFeeMustBeGreaterThanZero();\n s_maxEarlyWithdrawFee = _maxEarlyWithdrawFee;\n emit MaxEarlyWithdrawFeeSet(_maxEarlyWithdrawFee);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setLpTokenType(address _token, LpTokenType _type) external onlyOwner {\n if (_token == address(0)) revert InvalidTokenAddress();\n s_lpType[_token] = _type;\n emit LpTokenTypeSet(_token, _type);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external onlyOwner {\n if (address(_strategy) == address(0)) revert InvalidStrategyAddress();\n s_stakeStrategy[_lpType] = IStakeStrategy(_strategy);\n emit StakeStrategySet(_lpType, address(_strategy));\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setVeAERO(address _veAERO) external onlyOwner {\n if (_veAERO == address(0)) revert InvalidVeAEROAddress();\n s_veAERO = _veAERO;\n emit VeAEROSet(_veAERO);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONSecondExtension\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory) {\n return s_locked[_tokenId][_lpType];\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory) {\n return s_ownerToTokenIds[_owner].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory) {\n return s_assetsLocked[_tokenId].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\n return s_delegatees[_tokenId][_lpType].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\n return s_delegators[_tokenId][_lpType].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getUserPoint(\n uint256 _tokenId,\n LpTokenType _lpType,\n uint256 _epoch\n ) external view returns (UserPoint memory) {\n return s_userPointHistory[_tokenId][_lpType][_epoch];\n }\n}\n" + }, + "contracts/veION/veIONStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./interfaces/IveIONStructsEnumsErrorsEvents.sol\";\n\nabstract contract veIONStorage is IveIONStructsEnumsErrorsEvents {\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Constants ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Represents the duration of one week in seconds.\n uint256 internal constant _WEEK = 1 weeks;\n /// @notice Represents the maximum lock time in seconds (2 years).\n uint256 internal constant _MAXTIME = 2 * 365 * 86400;\n /// @notice Precision used for calculations, set to 1e18.\n uint256 public constant PRECISION = 1e18;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice The current token ID counter.\n uint256 public s_tokenId;\n /// @notice The amount of limited boost available.\n uint256 public s_limitedBoost;\n /// @notice Indicates whether the limited boost is active.\n bool public s_limitedBoostActive;\n /// @notice Address of the veAERO contract.\n address public s_veAERO;\n /// @notice Address of the AeroVoting contract.\n address public s_aeroVoting;\n /// @notice Address of the Ionic Pool.\n address public s_ionicPool;\n /// @notice Address of the voter contract.\n address public s_voter;\n /// @notice The boost amount for AeroVoter.\n uint256 public s_aeroVoterBoost;\n /// @notice The minimum duration for locking.\n uint256 public s_minimumLockDuration;\n /// @notice The maximum fee for early withdrawal.\n uint256 public s_maxEarlyWithdrawFee;\n /// @notice The AddressesProvider contract used for address management.\n IAddressesProvider public ap;\n /// @notice The address of the logic contract for the veION first extension.\n address public veIONFirstExtension;\n /// @notice The address of the logic contract for the veION second extension.\n address public veIONSecondExtension;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @dev Maps LP token types to their minimum lock amounts.\n mapping(LpTokenType => uint256) public s_minimumLockAmount;\n /// @dev Maps token addresses to their whitelist status.\n mapping(address => bool) public s_whitelistedToken;\n /// @dev Maps token addresses to their corresponding LP token types.\n mapping(address => LpTokenType) public s_lpType;\n /// @dev Maps user addresses to their ability to split.\n mapping(address => bool) public s_canSplit;\n /// @dev Maps token IDs and LP token types to their locked balances.\n mapping(uint256 => mapping(LpTokenType => LockedBalance)) public s_locked;\n /// @dev Maps token IDs and LP token types to user epochs.\n mapping(uint256 => mapping(LpTokenType => uint256)) public s_userPointEpoch;\n /// @dev Maps token IDs and LP token types to user point history.\n mapping(uint256 => mapping(LpTokenType => UserPoint[1000000000])) public s_userPointHistory;\n /// @dev Maps token IDs to sets of locked asset addresses.\n mapping(uint256 => EnumerableSet.AddressSet) internal s_assetsLocked;\n /// @dev Maps token IDs to their voting status.\n mapping(uint256 => bool) public s_voted;\n /// @dev Maps LP token types to their total supply.\n mapping(LpTokenType => uint256) public s_supply;\n /// @dev Maps LP token types to their permanent lock balances.\n mapping(LpTokenType => uint256) public s_permanentLockBalance;\n /// @dev Maps LP token types to their underlying stake strategies.\n mapping(LpTokenType => IStakeStrategy) public s_stakeStrategy;\n /// @dev Maps token IDs and LP token addresses to their underlying stake amounts.\n mapping(uint256 => mapping(address => uint256)) public s_underlyingStake;\n /// @dev Maps LP token types to their protocol fees.\n mapping(LpTokenType => uint256) public s_protocolFees;\n /// @dev Maps LP token types to their distributed fees.\n mapping(LpTokenType => uint256) public s_distributedFees;\n /// @dev Maps delegators, delegatees, and LP token types to delegation amounts.\n mapping(uint256 => mapping(uint256 => mapping(LpTokenType => uint256))) public s_delegations;\n /// @dev Maps token IDs and LP token types to sets of delegatees.\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegatees;\n /// @dev Maps token IDs and LP token types to sets of delegators.\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegators;\n /// @dev Maps owner addresses to sets of token IDs they own.\n mapping(address => EnumerableSet.UintSet) internal s_ownerToTokenIds;\n /// @dev Maps user addresses and token addresses to cumulative asset values.\n mapping(address => mapping(address => uint256)) public s_userCumulativeAssetValues;\n /// @dev Maps token Id and lp onto delegator permissioning.\n mapping(uint256 => mapping(address => bool)) public s_delegatorsBlocked;\n\n uint256[50] private __gap;\n}\n" + }, + "contracts/veION/Voter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\nimport { IveION } from \"./interfaces/IveION.sol\";\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title Voter Contract\n * @notice This contract allows veION holders to vote for various markets\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract Voter is IVoter, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n ///@notice The ve token that governs these contracts\n address public ve;\n ///@notice Base token of ve contract\n address internal rewardToken;\n ///@notice Standard OZ IGovernor using ve for vote weights\n address public governor;\n ///@notice Master Price Oracle instance\n MasterPriceOracle public mpo;\n ///@notice List of LP tokens\n address[] public lpTokens;\n ///@notice Total Voting Weights for each address\n mapping(address => uint256) public totalWeight;\n ///@notice Maximum number of markets one voter can vote for at once\n uint256 public maxVotingNum;\n ///@notice Minimum value for maxVotingNum\n uint256 internal constant MIN_MAXVOTINGNUM = 10;\n ///@notice All markets viable for incentives\n Market[] public markets;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n ///@notice Mapping from Reward Accumulator to Bribes Voting Reward\n mapping(address => address) public rewardAccumulatorToBribe;\n ///@notice Mapping from Market to Market Side to LP Asset to weights\n mapping(address => mapping(MarketSide => mapping(address => uint256))) public weights;\n ///@notice Mapping from NFT to Pool to LP Asset to Votes\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public votes;\n ///@notice Mapping from NFT to Pool to LP Asset to Base Weights\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public baseWeights;\n ///@notice Mapping from NFT to List of markets voted for by NFT\n mapping(uint256 => mapping(address => address[])) public marketVote;\n ///@notice Mapping from NFT to List of market vote sides voted for by NFT\n mapping(uint256 => mapping(address => MarketSide[])) public marketVoteSide;\n ///@notice Mapping from NFT to Total voting weight of NFT\n mapping(uint256 => mapping(address => uint256)) public usedWeights;\n ///@notice Mapping from NFT to Timestamp of last vote (ensures single vote per epoch)\n mapping(uint256 => uint256) public lastVoted;\n ///@notice Mapping from Token to Whitelisted status\n mapping(address => bool) public isWhitelistedToken;\n ///@notice Mapping from TokenId to Whitelisted status\n mapping(uint256 => bool) public isWhitelistedNFT;\n ///@notice Mapping from Reward Accumulator to Liveness status\n mapping(address => bool) public isAlive;\n ///@notice Mapping from Market to Market Side to Reward Accumulator\n mapping(address => mapping(MarketSide => address)) public marketToRewardAccumulators;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Modifiers ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /**\n * @notice Modifier to ensure that the function is called only in a new epoch since the last vote.\n * @dev Reverts if the current epoch start time is less than or equal to the last voted timestamp for the given token ID.\n * Also reverts if the current time is within the vote distribution window.\n * @param _tokenId The ID of the veNFT to check the last voted timestamp.\n */\n modifier onlyNewEpoch(uint256 _tokenId) {\n if (IonicTimeLibrary.epochStart(block.timestamp) <= lastVoted[_tokenId]) revert AlreadyVotedOrDeposited();\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\n _;\n }\n\n /**\n * @notice Modifier to ensure that the function is called only by the governance address.\n * @dev Reverts if the caller is not the current governor.\n */\n modifier onlyGovernance() {\n if (msg.sender != governor) revert NotGovernor();\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the Voter contract with the specified parameters.\n * @dev Requires initialization with at least one reward token.\n * @param _tokens An array of token addresses to be whitelisted.\n * @param _mpo The MasterPriceOracle contract address.\n * @param _rewardToken The address of the reward token.\n * @param _ve The address of the veION contract.\n * @custom:reverts TokensArrayEmpty if the _tokens array is empty.\n */\n function initialize(\n address[] calldata _tokens,\n MasterPriceOracle _mpo,\n address _rewardToken,\n address _ve\n ) external initializer {\n __Ownable2Step_init();\n __ReentrancyGuard_init();\n uint256 _length = _tokens.length;\n if (_length == 0) revert TokensArrayEmpty();\n for (uint256 i = 0; i < _length; i++) {\n _whitelistToken(_tokens[i], true);\n }\n mpo = _mpo;\n rewardToken = _rewardToken;\n ve = _ve;\n governor = msg.sender;\n\n emit Initialized(_tokens, address(_mpo), _rewardToken, _ve, governor);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function vote(\n uint256 _tokenId,\n address[] calldata _marketVote,\n MarketSide[] calldata _marketVoteSide,\n uint256[] calldata _weights\n ) external nonReentrant onlyNewEpoch(_tokenId) {\n VoteLocalVars memory vars;\n vars.sender = msg.sender;\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != vars.sender) revert NotOwner();\n if (\n _marketVote.length != _marketVoteSide.length ||\n _marketVoteSide.length != _weights.length ||\n _weights.length != _marketVote.length\n ) revert UnequalLengths();\n if (_marketVote.length > maxVotingNum) revert TooManyPools();\n vars.timestamp = block.timestamp;\n if ((vars.timestamp > IonicTimeLibrary.epochVoteEnd(vars.timestamp)) && !isWhitelistedNFT[_tokenId])\n revert NotWhitelistedNFT();\n uint256 totalVoteWeight = 0;\n\n for (uint256 i = 0; i < _marketVote.length; i++) {\n totalVoteWeight += _weights[i];\n }\n for (uint256 i = 0; i < lpTokens.length; i++) {\n _reset(_tokenId, lpTokens[i]);\n }\n\n lastVoted[_tokenId] = vars.timestamp;\n (vars.votingLPs, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(_tokenId);\n for (uint256 j = 0; j < vars.votingLPs.length; j++) {\n _vote(\n _tokenId,\n vars.votingLPs[j],\n (vars.votingLPBalances[j] * vars.boosts[j]) / 1e18,\n _marketVote,\n _marketVoteSide,\n _weights,\n totalVoteWeight\n );\n }\n }\n\n /// @inheritdoc IVoter\n function poke(uint256 _tokenId) external nonReentrant {\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\n (address[] memory _votingLPs, uint256[] memory _votingLPBalances, uint256[] memory _boosts) = IveION(ve)\n .balanceOfNFT(_tokenId);\n\n for (uint256 i = 0; i < _votingLPs.length; i++) {\n uint256 effectiveBalance = (_votingLPBalances[i] * _boosts[i]) / 1e18;\n _poke(_tokenId, lpTokens[i], effectiveBalance);\n }\n }\n\n /// @inheritdoc IVoter\n function reset(uint256 _tokenId) public nonReentrant onlyNewEpoch(_tokenId) {\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != msg.sender) revert NotOwner();\n for (uint256 i = 0; i < lpTokens.length; i++) {\n _reset(_tokenId, lpTokens[i]);\n }\n }\n\n /// @inheritdoc IVoter\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external nonReentrant {\n if (_bribes.length != _tokens.length) revert UnequalLengths();\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n uint256 _length = _bribes.length;\n for (uint256 i = 0; i < _length; i++) {\n IBribeRewards(_bribes[i]).getReward(_tokenId, _tokens[i]);\n }\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Admin External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function distributeRewards() external onlyGovernance {\n if (block.timestamp <= IonicTimeLibrary.epochVoteEnd(block.timestamp)) revert NotDistributeWindow();\n uint256 _reward = IERC20(rewardToken).balanceOf(address(this));\n uint256 _totalLPValueETH = _calculateTotalLPValue();\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 _marketWeightETH = _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\n if (_marketWeightETH > 0) {\n IERC20(rewardToken).safeTransfer(\n marketToRewardAccumulators[markets[i].marketAddress][markets[i].side],\n (_reward * _marketWeightETH) / _totalLPValueETH\n );\n }\n }\n }\n\n /// @inheritdoc IVoter\n function whitelistToken(address _token, bool _bool) external onlyGovernance {\n _whitelistToken(_token, _bool);\n }\n\n /// @inheritdoc IVoter\n function whitelistNFT(uint256 _tokenId, bool _bool) external onlyGovernance {\n address _sender = msg.sender;\n isWhitelistedNFT[_tokenId] = _bool;\n emit WhitelistNFT(_sender, _tokenId, _bool);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /**\n * @notice Internal function to handle voting logic for a given token ID and voting asset.\n * @param _tokenId The ID of the token used for voting.\n * @param _votingAsset The address of the asset being used for voting.\n * @param _votingAssetBalance The balance of the voting asset.\n * @param _marketVote An array of market addresses to vote for.\n * @param _marketVoteSide An array of market sides corresponding to the markets.\n * @param _weights An array of weights for each market.\n * @param totalVoteWeight The total weight of the vote.\n */\n function _vote(\n uint256 _tokenId,\n address _votingAsset,\n uint256 _votingAssetBalance,\n address[] memory _marketVote,\n MarketSide[] memory _marketVoteSide,\n uint256[] memory _weights,\n uint256 totalVoteWeight\n ) internal {\n VoteVars memory vars;\n uint256 marketVoteLength = _marketVote.length;\n for (uint256 i = 0; i < marketVoteLength; i++) {\n vars.market = _marketVote[i];\n vars.marketSide = _marketVoteSide[i];\n vars.rewardAccumulator = marketToRewardAccumulators[vars.market][vars.marketSide];\n vars.bribes = rewardAccumulatorToBribe[vars.rewardAccumulator];\n if (_weights[i] == 0) revert ZeroWeight();\n if (vars.rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(vars.market);\n if (!isAlive[vars.rewardAccumulator]) revert RewardAccumulatorNotAlive(vars.rewardAccumulator);\n\n vars.marketWeight = (_weights[i] * _votingAssetBalance) / totalVoteWeight;\n if (votes[_tokenId][vars.market][vars.marketSide][_votingAsset] != 0) revert NonZeroVotes();\n\n marketVote[_tokenId][_votingAsset].push(vars.market);\n marketVoteSide[_tokenId][_votingAsset].push(vars.marketSide);\n\n weights[vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\n votes[_tokenId][vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\n baseWeights[_tokenId][vars.market][vars.marketSide][_votingAsset] = _weights[i];\n IBribeRewards(vars.bribes).deposit(_votingAsset, uint256(vars.marketWeight), _tokenId);\n vars.usedWeight += vars.marketWeight;\n vars.totalWeight += vars.marketWeight;\n emit Voted(\n msg.sender,\n vars.market,\n _tokenId,\n vars.marketWeight,\n weights[vars.market][vars.marketSide][_votingAsset],\n block.timestamp\n );\n }\n IveION(ve).voting(_tokenId, true);\n totalWeight[_votingAsset] += uint256(vars.totalWeight);\n usedWeights[_tokenId][_votingAsset] = uint256(vars.usedWeight);\n }\n\n /**\n * @notice Internal function to update voting balances for a given token ID and voting asset.\n * @param _tokenId The ID of the token whose voting balance is being updated.\n * @param _votingAsset The address of the asset being used for voting.\n * @param _votingAssetBalance The balance of the voting asset.\n */\n function _poke(uint256 _tokenId, address _votingAsset, uint256 _votingAssetBalance) internal {\n address[] memory _marketVote = marketVote[_tokenId][_votingAsset];\n MarketSide[] memory _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\n uint256 _marketCnt = _marketVote.length;\n uint256[] memory _weights = new uint256[](_marketCnt);\n uint256 totalVoteWeight = 0;\n\n for (uint256 i = 0; i < _marketCnt; i++) {\n _weights[i] = baseWeights[_tokenId][_marketVote[i]][_marketVoteSide[i]][_votingAsset];\n }\n\n for (uint256 i = 0; i < _marketVote.length; i++) {\n totalVoteWeight += _weights[i];\n }\n\n _reset(_tokenId, _votingAsset);\n _vote(_tokenId, _votingAsset, _votingAssetBalance, _marketVote, _marketVoteSide, _weights, totalVoteWeight);\n }\n\n /**\n * @notice Internal function to reset voting state for a given token ID and voting asset.\n * @param _tokenId The ID of the token whose voting state is being reset.\n * @param _votingAsset The address of the asset being used for voting.\n */\n function _reset(uint256 _tokenId, address _votingAsset) internal {\n address[] storage _marketVote = marketVote[_tokenId][_votingAsset];\n MarketSide[] storage _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\n uint256 _marketVoteCnt = _marketVote.length;\n\n for (uint256 i = 0; i < _marketVoteCnt; i++) {\n address _market = _marketVote[i];\n MarketSide _marketSide = _marketVoteSide[i];\n\n uint256 _votes = votes[_tokenId][_market][_marketSide][_votingAsset];\n if (_votes != 0) {\n weights[_market][_marketSide][_votingAsset] -= _votes;\n delete votes[_tokenId][_market][_marketSide][_votingAsset];\n IBribeRewards(rewardAccumulatorToBribe[marketToRewardAccumulators[_market][_marketSide]]).withdraw(\n _votingAsset,\n uint256(_votes),\n _tokenId\n );\n totalWeight[_votingAsset] -= _votes;\n emit Abstained(\n msg.sender,\n _market,\n _tokenId,\n _votes,\n weights[_market][_marketSide][_votingAsset],\n block.timestamp\n );\n }\n }\n usedWeights[_tokenId][_votingAsset] = 0;\n delete marketVote[_tokenId][_votingAsset];\n delete marketVoteSide[_tokenId][_votingAsset];\n IveION(ve).voting(_tokenId, false);\n }\n\n /**\n * @notice Internal function to whitelist or unwhitelist a token for use in bribes.\n * @param _token The address of the token to be whitelisted or unwhitelisted.\n * @param _bool Boolean indicating whether to whitelist (true) or unwhitelist (false) the token.\n */\n function _whitelistToken(address _token, bool _bool) internal {\n isWhitelistedToken[_token] = _bool;\n emit WhitelistToken(msg.sender, _token, _bool);\n }\n\n /**\n * @notice Internal function to calculate the ETH value of a given amount of LP tokens.\n * @param amount The amount of LP tokens.\n * @param lpToken The address of the LP token.\n * @return The ETH value of the given amount of LP tokens.\n */\n function _getTokenEthValue(uint256 amount, address lpToken) internal view returns (uint256) {\n uint256 tokenPriceInEth = mpo.price(lpToken); // Fetch price of 1 lpToken in ETH\n uint256 ethValue = amount * tokenPriceInEth;\n return ethValue;\n }\n\n /**\n * @notice Internal function to calculate the total ETH value of all LP tokens in the markets.\n * @return _totalLPValueETH The total ETH value of all LP tokens.\n */\n function _calculateTotalLPValue() internal view returns (uint256 _totalLPValueETH) {\n uint256 marketLength = markets.length;\n for (uint256 i = 0; i < marketLength; i++)\n _totalLPValueETH += _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\n }\n\n /**\n * @notice Internal function to calculate the ETH value of LP tokens for a specific market.\n * @param _market The address of the market.\n * @param _marketSide The side of the market.\n * @return _marketLPValueETH The ETH value of LP tokens for the specified market.\n */\n function _calculateMarketLPValue(\n address _market,\n MarketSide _marketSide\n ) internal view returns (uint256 _marketLPValueETH) {\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 i = 0; i < lpTokensLength; i++) {\n uint256 _lpAmount = weights[_market][_marketSide][lpTokens[i]];\n uint256 tokenEthValue = _getTokenEthValue(_lpAmount, lpTokens[i]);\n _marketLPValueETH += tokenEthValue;\n }\n }\n\n /**\n * @notice Internal function to check if a market exists.\n * @param _marketAddress The address of the market.\n * @param _marketSide The side of the market.\n * @return True if the market exists, false otherwise.\n */\n function _marketExists(address _marketAddress, MarketSide _marketSide) internal view returns (bool) {\n uint256 marketLength = markets.length;\n for (uint256 j = 0; j < marketLength; j++) {\n if (markets[j].marketAddress == _marketAddress && markets[j].side == _marketSide) {\n return true;\n }\n }\n return false;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Setter Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function setLpTokens(address[] memory _lpTokens) external onlyOwner {\n require(_lpTokens.length != 0, \"LpTokens array cannot be empty\");\n lpTokens = _lpTokens;\n emit LpTokensSet(_lpTokens);\n }\n\n /// @inheritdoc IVoter\n function setMpo(address _mpo) external onlyOwner {\n if (_mpo == address(0)) revert ZeroAddress();\n mpo = MasterPriceOracle(_mpo);\n emit MpoSet(_mpo);\n }\n\n /// @inheritdoc IVoter\n function setGovernor(address _governor) public onlyOwner {\n if (_governor == address(0)) revert ZeroAddress();\n governor = _governor;\n emit GovernorSet(_governor);\n }\n\n /// @inheritdoc IVoter\n function addMarkets(Market[] calldata _markets) external onlyGovernance {\n for (uint256 i = 0; i < _markets.length; i++) {\n Market memory newMarket = _markets[i];\n if (_marketExists(newMarket.marketAddress, newMarket.side)) revert MarketAlreadyExists();\n markets.push(newMarket);\n }\n emit MarketsAdded(_markets);\n }\n\n /// @inheritdoc IVoter\n function setMarketRewardAccumulators(\n address[] calldata _markets,\n MarketSide[] calldata _marketSides,\n address[] calldata _rewardAccumulators\n ) external onlyGovernance {\n uint256 _length = _markets.length;\n if (_marketSides.length != _length) revert MismatchedArrayLengths();\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\n for (uint256 i = 0; i < _length; i++) {\n marketToRewardAccumulators[_markets[i]][_marketSides[i]] = _rewardAccumulators[i];\n isAlive[_rewardAccumulators[i]] = true;\n }\n emit MarketRewardAccumulatorsSet(_markets, _marketSides, _rewardAccumulators);\n }\n\n /// @inheritdoc IVoter\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external onlyGovernance {\n uint256 _length = _bribes.length;\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\n for (uint256 i = 0; i < _length; i++) {\n rewardAccumulatorToBribe[_rewardAccumulators[i]] = _bribes[i];\n }\n emit BribesSet(_rewardAccumulators, _bribes);\n }\n\n /// @inheritdoc IVoter\n function setMaxVotingNum(uint256 _maxVotingNum) external onlyGovernance {\n if (_maxVotingNum < MIN_MAXVOTINGNUM) revert MaximumVotingNumberTooLow();\n if (_maxVotingNum == maxVotingNum) revert SameValue();\n maxVotingNum = _maxVotingNum;\n emit MaxVotingNumSet(_maxVotingNum);\n }\n\n /// @inheritdoc IVoter\n function toggleRewardAccumulatorAlive(\n address _market,\n MarketSide _marketSide,\n bool _isAlive\n ) external onlyGovernance {\n address _rewardAccumulator = marketToRewardAccumulators[_market][_marketSide];\n if (_rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(_market);\n isAlive[_rewardAccumulator] = _isAlive;\n emit RewardAccumulatorAliveToggled(_market, _marketSide, _isAlive);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Pure/View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function epochStart(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochStart(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochNext(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochNext(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochVoteStart(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochVoteEnd(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function marketsLength() external view returns (uint256) {\n return markets.length;\n }\n\n /// @inheritdoc IVoter\n function getAllLpRewardTokens() external view returns (address[] memory) {\n return lpTokens;\n }\n\n /// @inheritdoc IVoter\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory) {\n uint256 length = marketVote[_tokenId][_lpAsset].length;\n address[] memory _marketVotes = new address[](length);\n MarketSide[] memory _marketVoteSides = new MarketSide[](length);\n uint256[] memory _votes = new uint256[](length);\n\n for (uint256 i = 0; i < length; i++) {\n _marketVotes[i] = marketVote[_tokenId][_lpAsset][i];\n _marketVoteSides[i] = marketVoteSide[_tokenId][_lpAsset][i];\n _votes[i] = votes[_tokenId][_marketVotes[i]][_marketVoteSides[i]][_lpAsset];\n }\n\n uint256 _usedWeight = usedWeights[_tokenId][_lpAsset];\n\n return\n VoteDetails({\n marketVotes: _marketVotes,\n marketVoteSides: _marketVoteSides,\n votes: _votes,\n usedWeight: _usedWeight\n });\n }\n}\n" + }, + "ds-test/test.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.5.0;\n\ncontract DSTest {\n event log (string);\n event logs (bytes);\n\n event log_address (address);\n event log_bytes32 (bytes32);\n event log_int (int);\n event log_uint (uint);\n event log_bytes (bytes);\n event log_string (string);\n\n event log_named_address (string key, address val);\n event log_named_bytes32 (string key, bytes32 val);\n event log_named_decimal_int (string key, int val, uint decimals);\n event log_named_decimal_uint (string key, uint val, uint decimals);\n event log_named_int (string key, int val);\n event log_named_uint (string key, uint val);\n event log_named_bytes (string key, bytes val);\n event log_named_string (string key, string val);\n\n bool public IS_TEST = true;\n bool private _failed;\n\n address constant HEVM_ADDRESS =\n address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));\n\n modifier mayRevert() { _; }\n modifier testopts(string memory) { _; }\n\n function failed() public returns (bool) {\n if (_failed) {\n return _failed;\n } else {\n bool globalFailed = false;\n if (hasHEVMContext()) {\n (, bytes memory retdata) = HEVM_ADDRESS.call(\n abi.encodePacked(\n bytes4(keccak256(\"load(address,bytes32)\")),\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"))\n )\n );\n globalFailed = abi.decode(retdata, (bool));\n }\n return globalFailed;\n }\n }\n\n function fail() internal virtual {\n if (hasHEVMContext()) {\n (bool status, ) = HEVM_ADDRESS.call(\n abi.encodePacked(\n bytes4(keccak256(\"store(address,bytes32,bytes32)\")),\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"), bytes32(uint256(0x01)))\n )\n );\n status; // Silence compiler warnings\n }\n _failed = true;\n }\n\n function hasHEVMContext() internal view returns (bool) {\n uint256 hevmCodeSize = 0;\n assembly {\n hevmCodeSize := extcodesize(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D)\n }\n return hevmCodeSize > 0;\n }\n\n modifier logs_gas() {\n uint startGas = gasleft();\n _;\n uint endGas = gasleft();\n emit log_named_uint(\"gas\", startGas - endGas);\n }\n\n function assertTrue(bool condition) internal {\n if (!condition) {\n emit log(\"Error: Assertion Failed\");\n fail();\n }\n }\n\n function assertTrue(bool condition, string memory err) internal {\n if (!condition) {\n emit log_named_string(\"Error\", err);\n assertTrue(condition);\n }\n }\n\n function assertEq(address a, address b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [address]\");\n emit log_named_address(\" Left\", a);\n emit log_named_address(\" Right\", b);\n fail();\n }\n }\n function assertEq(address a, address b, string memory err) internal {\n if (a != b) {\n emit log_named_string (\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(bytes32 a, bytes32 b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [bytes32]\");\n emit log_named_bytes32(\" Left\", a);\n emit log_named_bytes32(\" Right\", b);\n fail();\n }\n }\n function assertEq(bytes32 a, bytes32 b, string memory err) internal {\n if (a != b) {\n emit log_named_string (\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEq32(bytes32 a, bytes32 b) internal {\n assertEq(a, b);\n }\n function assertEq32(bytes32 a, bytes32 b, string memory err) internal {\n assertEq(a, b, err);\n }\n\n function assertEq(int a, int b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n fail();\n }\n }\n function assertEq(int a, int b, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEq(uint a, uint b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n fail();\n }\n }\n function assertEq(uint a, uint b, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEqDecimal(int a, int b, uint decimals) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n fail();\n }\n }\n function assertEqDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEqDecimal(a, b, decimals);\n }\n }\n function assertEqDecimal(uint a, uint b, uint decimals) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n fail();\n }\n }\n function assertEqDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEqDecimal(a, b, decimals);\n }\n }\n\n function assertGt(uint a, uint b) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertGt(uint a, uint b, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGt(a, b);\n }\n }\n function assertGt(int a, int b) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertGt(int a, int b, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGt(a, b);\n }\n }\n function assertGtDecimal(int a, int b, uint decimals) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGtDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGtDecimal(a, b, decimals);\n }\n }\n function assertGtDecimal(uint a, uint b, uint decimals) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGtDecimal(a, b, decimals);\n }\n }\n\n function assertGe(uint a, uint b) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertGe(uint a, uint b, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGe(a, b);\n }\n }\n function assertGe(int a, int b) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertGe(int a, int b, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGe(a, b);\n }\n }\n function assertGeDecimal(int a, int b, uint decimals) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGeDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGeDecimal(a, b, decimals);\n }\n }\n function assertGeDecimal(uint a, uint b, uint decimals) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGeDecimal(a, b, decimals);\n }\n }\n\n function assertLt(uint a, uint b) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertLt(uint a, uint b, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLt(a, b);\n }\n }\n function assertLt(int a, int b) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertLt(int a, int b, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLt(a, b);\n }\n }\n function assertLtDecimal(int a, int b, uint decimals) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLtDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLtDecimal(a, b, decimals);\n }\n }\n function assertLtDecimal(uint a, uint b, uint decimals) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLtDecimal(a, b, decimals);\n }\n }\n\n function assertLe(uint a, uint b) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertLe(uint a, uint b, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLe(a, b);\n }\n }\n function assertLe(int a, int b) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertLe(int a, int b, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLe(a, b);\n }\n }\n function assertLeDecimal(int a, int b, uint decimals) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLeDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLeDecimal(a, b, decimals);\n }\n }\n function assertLeDecimal(uint a, uint b, uint decimals) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLeDecimal(a, b, decimals);\n }\n }\n\n function assertEq(string memory a, string memory b) internal {\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n emit log(\"Error: a == b not satisfied [string]\");\n emit log_named_string(\" Left\", a);\n emit log_named_string(\" Right\", b);\n fail();\n }\n }\n function assertEq(string memory a, string memory b, string memory err) internal {\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function checkEq0(bytes memory a, bytes memory b) internal pure returns (bool ok) {\n ok = true;\n if (a.length == b.length) {\n for (uint i = 0; i < a.length; i++) {\n if (a[i] != b[i]) {\n ok = false;\n }\n }\n } else {\n ok = false;\n }\n }\n function assertEq0(bytes memory a, bytes memory b) internal {\n if (!checkEq0(a, b)) {\n emit log(\"Error: a == b not satisfied [bytes]\");\n emit log_named_bytes(\" Left\", a);\n emit log_named_bytes(\" Right\", b);\n fail();\n }\n }\n function assertEq0(bytes memory a, bytes memory b, string memory err) internal {\n if (!checkEq0(a, b)) {\n emit log_named_string(\"Error\", err);\n assertEq0(a, b);\n }\n }\n}\n" + }, + "forge-std/Base.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {StdStorage} from \"./StdStorage.sol\";\nimport {Vm, VmSafe} from \"./Vm.sol\";\n\nabstract contract CommonBase {\n // Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.\n address internal constant VM_ADDRESS = address(uint160(uint256(keccak256(\"hevm cheat code\"))));\n // console.sol and console2.sol work by executing a staticcall to this address.\n address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67;\n // Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38.\n address internal constant DEFAULT_SENDER = address(uint160(uint256(keccak256(\"foundry default caller\"))));\n // Address of the test contract, deployed by the DEFAULT_SENDER.\n address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f;\n // Deterministic deployment address of the Multicall3 contract.\n address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11;\n\n uint256 internal constant UINT256_MAX =\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n Vm internal constant vm = Vm(VM_ADDRESS);\n StdStorage internal stdstore;\n}\n\nabstract contract TestBase is CommonBase {}\n\nabstract contract ScriptBase is CommonBase {\n // Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\n address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\n\n VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS);\n}\n" + }, + "forge-std/console.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nlibrary console {\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n function _sendLogPayload(bytes memory payload) private view {\n uint256 payloadLength = payload.length;\n address consoleAddress = CONSOLE_ADDRESS;\n /// @solidity memory-safe-assembly\n assembly {\n let payloadStart := add(payload, 32)\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n }\n }\n\n function log() internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n }\n\n function logInt(int p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int)\", p0));\n }\n\n function logUint(uint p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n }\n\n function logString(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function logBool(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function logAddress(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function logBytes(bytes memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n }\n\n function logBytes1(bytes1 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n }\n\n function logBytes2(bytes2 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n }\n\n function logBytes3(bytes3 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n }\n\n function logBytes4(bytes4 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n }\n\n function logBytes5(bytes5 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n }\n\n function logBytes6(bytes6 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n }\n\n function logBytes7(bytes7 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n }\n\n function logBytes8(bytes8 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n }\n\n function logBytes9(bytes9 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n }\n\n function logBytes10(bytes10 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n }\n\n function logBytes11(bytes11 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n }\n\n function logBytes12(bytes12 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n }\n\n function logBytes13(bytes13 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n }\n\n function logBytes14(bytes14 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n }\n\n function logBytes15(bytes15 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n }\n\n function logBytes16(bytes16 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n }\n\n function logBytes17(bytes17 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n }\n\n function logBytes18(bytes18 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n }\n\n function logBytes19(bytes19 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n }\n\n function logBytes20(bytes20 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n }\n\n function logBytes21(bytes21 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n }\n\n function logBytes22(bytes22 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n }\n\n function logBytes23(bytes23 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n }\n\n function logBytes24(bytes24 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n }\n\n function logBytes25(bytes25 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n }\n\n function logBytes26(bytes26 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n }\n\n function logBytes27(bytes27 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n }\n\n function logBytes28(bytes28 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n }\n\n function logBytes29(bytes29 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n }\n\n function logBytes30(bytes30 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n }\n\n function logBytes31(bytes31 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n }\n\n function logBytes32(bytes32 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n }\n\n function log(uint p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n }\n\n function log(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function log(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function log(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function log(uint p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint)\", p0, p1));\n }\n\n function log(uint p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string)\", p0, p1));\n }\n\n function log(uint p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool)\", p0, p1));\n }\n\n function log(uint p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address)\", p0, p1));\n }\n\n function log(string memory p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint)\", p0, p1));\n }\n\n function log(string memory p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n }\n\n function log(string memory p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n }\n\n function log(string memory p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n }\n\n function log(bool p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint)\", p0, p1));\n }\n\n function log(bool p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n }\n\n function log(bool p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n }\n\n function log(bool p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n }\n\n function log(address p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint)\", p0, p1));\n }\n\n function log(address p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n }\n\n function log(address p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n }\n\n function log(address p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n }\n\n function log(uint p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n }\n\n}" + }, + "forge-std/console2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\n/// @dev The original console.sol uses `int` and `uint` for computing function selectors, but it should\n/// use `int256` and `uint256`. This modified version fixes that. This version is recommended\n/// over `console.sol` if you don't need compatibility with Hardhat as the logs will show up in\n/// forge stack traces. If you do need compatibility with Hardhat, you must use `console.sol`.\n/// Reference: https://github.com/NomicFoundation/hardhat/issues/2178\nlibrary console2 {\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n function _sendLogPayload(bytes memory payload) private view {\n uint256 payloadLength = payload.length;\n address consoleAddress = CONSOLE_ADDRESS;\n /// @solidity memory-safe-assembly\n assembly {\n let payloadStart := add(payload, 32)\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n }\n }\n\n function log() internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n }\n\n function logInt(int256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n }\n\n function logUint(uint256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n }\n\n function logString(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function logBool(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function logAddress(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function logBytes(bytes memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n }\n\n function logBytes1(bytes1 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n }\n\n function logBytes2(bytes2 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n }\n\n function logBytes3(bytes3 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n }\n\n function logBytes4(bytes4 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n }\n\n function logBytes5(bytes5 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n }\n\n function logBytes6(bytes6 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n }\n\n function logBytes7(bytes7 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n }\n\n function logBytes8(bytes8 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n }\n\n function logBytes9(bytes9 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n }\n\n function logBytes10(bytes10 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n }\n\n function logBytes11(bytes11 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n }\n\n function logBytes12(bytes12 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n }\n\n function logBytes13(bytes13 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n }\n\n function logBytes14(bytes14 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n }\n\n function logBytes15(bytes15 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n }\n\n function logBytes16(bytes16 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n }\n\n function logBytes17(bytes17 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n }\n\n function logBytes18(bytes18 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n }\n\n function logBytes19(bytes19 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n }\n\n function logBytes20(bytes20 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n }\n\n function logBytes21(bytes21 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n }\n\n function logBytes22(bytes22 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n }\n\n function logBytes23(bytes23 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n }\n\n function logBytes24(bytes24 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n }\n\n function logBytes25(bytes25 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n }\n\n function logBytes26(bytes26 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n }\n\n function logBytes27(bytes27 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n }\n\n function logBytes28(bytes28 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n }\n\n function logBytes29(bytes29 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n }\n\n function logBytes30(bytes30 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n }\n\n function logBytes31(bytes31 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n }\n\n function logBytes32(bytes32 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n }\n\n function log(uint256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n }\n\n function log(int256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n }\n\n function log(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function log(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function log(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function log(uint256 p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256)\", p0, p1));\n }\n\n function log(uint256 p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string)\", p0, p1));\n }\n\n function log(uint256 p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool)\", p0, p1));\n }\n\n function log(uint256 p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address)\", p0, p1));\n }\n\n function log(string memory p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n }\n\n function log(string memory p0, int256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,int256)\", p0, p1));\n }\n\n function log(string memory p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n }\n\n function log(string memory p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n }\n\n function log(string memory p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n }\n\n function log(bool p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256)\", p0, p1));\n }\n\n function log(bool p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n }\n\n function log(bool p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n }\n\n function log(bool p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n }\n\n function log(address p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256)\", p0, p1));\n }\n\n function log(address p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n }\n\n function log(address p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n }\n\n function log(address p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n }\n\n}" + }, + "forge-std/interfaces/IMulticall3.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\ninterface IMulticall3 {\n struct Call {\n address target;\n bytes callData;\n }\n\n struct Call3 {\n address target;\n bool allowFailure;\n bytes callData;\n }\n\n struct Call3Value {\n address target;\n bool allowFailure;\n uint256 value;\n bytes callData;\n }\n\n struct Result {\n bool success;\n bytes returnData;\n }\n\n function aggregate(Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes[] memory returnData);\n\n function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData);\n\n function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData);\n\n function blockAndAggregate(Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\n\n function getBasefee() external view returns (uint256 basefee);\n\n function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash);\n\n function getBlockNumber() external view returns (uint256 blockNumber);\n\n function getChainId() external view returns (uint256 chainid);\n\n function getCurrentBlockCoinbase() external view returns (address coinbase);\n\n function getCurrentBlockDifficulty() external view returns (uint256 difficulty);\n\n function getCurrentBlockGasLimit() external view returns (uint256 gaslimit);\n\n function getCurrentBlockTimestamp() external view returns (uint256 timestamp);\n\n function getEthBalance(address addr) external view returns (uint256 balance);\n\n function getLastBlockHash() external view returns (bytes32 blockHash);\n\n function tryAggregate(bool requireSuccess, Call[] calldata calls)\n external\n payable\n returns (Result[] memory returnData);\n\n function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\n}\n" + }, + "forge-std/StdAssertions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {DSTest} from \"ds-test/test.sol\";\nimport {stdMath} from \"./StdMath.sol\";\n\nabstract contract StdAssertions is DSTest {\n event log_array(uint256[] val);\n event log_array(int256[] val);\n event log_array(address[] val);\n event log_named_array(string key, uint256[] val);\n event log_named_array(string key, int256[] val);\n event log_named_array(string key, address[] val);\n\n function fail(string memory err) internal virtual {\n emit log_named_string(\"Error\", err);\n fail();\n }\n\n function assertFalse(bool data) internal virtual {\n assertTrue(!data);\n }\n\n function assertFalse(bool data, string memory err) internal virtual {\n assertTrue(!data, err);\n }\n\n function assertEq(bool a, bool b) internal virtual {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [bool]\");\n emit log_named_string(\" Left\", a ? \"true\" : \"false\");\n emit log_named_string(\" Right\", b ? \"true\" : \"false\");\n fail();\n }\n }\n\n function assertEq(bool a, bool b, string memory err) internal virtual {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(bytes memory a, bytes memory b) internal virtual {\n assertEq0(a, b);\n }\n\n function assertEq(bytes memory a, bytes memory b, string memory err) internal virtual {\n assertEq0(a, b, err);\n }\n\n function assertEq(uint256[] memory a, uint256[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [uint[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(int256[] memory a, int256[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [int[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(address[] memory a, address[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [address[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(uint256[] memory a, uint256[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(int256[] memory a, int256[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(address[] memory a, address[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n // Legacy helper\n function assertEqUint(uint256 a, uint256 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta, string memory err) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbs(a, b, maxDelta);\n }\n }\n\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\n fail();\n }\n }\n\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\n }\n }\n\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta, string memory err) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbs(a, b, maxDelta);\n }\n }\n\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\n fail();\n }\n }\n\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\n }\n }\n\n function assertApproxEqRel(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100%\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRel(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n string memory err\n ) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRel(a, b, maxPercentDelta);\n }\n }\n\n function assertApproxEqRelDecimal(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n uint256 decimals\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRelDecimal(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n uint256 decimals,\n string memory err\n ) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\n }\n }\n\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta, string memory err) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRel(a, b, maxPercentDelta);\n }\n }\n\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\n }\n }\n\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB) internal virtual {\n assertEqCall(target, callDataA, target, callDataB, true);\n }\n\n function assertEqCall(address targetA, bytes memory callDataA, address targetB, bytes memory callDataB)\n internal\n virtual\n {\n assertEqCall(targetA, callDataA, targetB, callDataB, true);\n }\n\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB, bool strictRevertData)\n internal\n virtual\n {\n assertEqCall(target, callDataA, target, callDataB, strictRevertData);\n }\n\n function assertEqCall(\n address targetA,\n bytes memory callDataA,\n address targetB,\n bytes memory callDataB,\n bool strictRevertData\n ) internal virtual {\n (bool successA, bytes memory returnDataA) = address(targetA).call(callDataA);\n (bool successB, bytes memory returnDataB) = address(targetB).call(callDataB);\n\n if (successA && successB) {\n assertEq(returnDataA, returnDataB, \"Call return data does not match\");\n }\n\n if (!successA && !successB && strictRevertData) {\n assertEq(returnDataA, returnDataB, \"Call revert data does not match\");\n }\n\n if (!successA && successB) {\n emit log(\"Error: Calls were not equal\");\n emit log_named_bytes(\" Left call revert data\", returnDataA);\n emit log_named_bytes(\" Right call return data\", returnDataB);\n fail();\n }\n\n if (successA && !successB) {\n emit log(\"Error: Calls were not equal\");\n emit log_named_bytes(\" Left call return data\", returnDataA);\n emit log_named_bytes(\" Right call revert data\", returnDataB);\n fail();\n }\n }\n}\n" + }, + "forge-std/StdChains.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {VmSafe} from \"./Vm.sol\";\n\n/**\n * StdChains provides information about EVM compatible chains that can be used in scripts/tests.\n * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are\n * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of\n * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the\n * alias used in this contract, which can be found as the first argument to the\n * `setChainWithDefaultRpcUrl` call in the `initialize` function.\n *\n * There are two main ways to use this contract:\n * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or\n * `setChain(string memory chainAlias, Chain memory chain)`\n * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`.\n *\n * The first time either of those are used, chains are initialized with the default set of RPC URLs.\n * This is done in `initialize`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in\n * `defaultRpcUrls`.\n *\n * The `setChain` function is straightforward, and it simply saves off the given chain data.\n *\n * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say\n * we want to retrieve `mainnet`'s RPC URL:\n * - If you haven't set any mainnet chain info with `setChain`, you haven't specified that\n * chain in `foundry.toml` and no env var is set, the default data and RPC URL will be returned.\n * - If you have set a mainnet RPC URL in `foundry.toml` it will return that, if valid (e.g. if\n * a URL is given or if an environment variable is given and that environment variable exists).\n * Otherwise, the default data is returned.\n * - If you specified data with `setChain` it will return that.\n *\n * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults.\n */\nabstract contract StdChains {\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n bool private initialized;\n\n struct ChainData {\n string name;\n uint256 chainId;\n string rpcUrl;\n }\n\n struct Chain {\n // The chain name.\n string name;\n // The chain's Chain ID.\n uint256 chainId;\n // The chain's alias. (i.e. what gets specified in `foundry.toml`).\n string chainAlias;\n // A default RPC endpoint for this chain.\n // NOTE: This default RPC URL is included for convenience to facilitate quick tests and\n // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy\n // usage as you will be throttled and this is a disservice to others who need this endpoint.\n string rpcUrl;\n }\n\n // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data.\n mapping(string => Chain) private chains;\n // Maps from the chain's alias to it's default RPC URL.\n mapping(string => string) private defaultRpcUrls;\n // Maps from a chain ID to it's alias.\n mapping(uint256 => string) private idToAlias;\n\n bool private fallbackToDefaultRpcUrls = true;\n\n // The RPC URL will be fetched from config or defaultRpcUrls if possible.\n function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) {\n require(bytes(chainAlias).length != 0, \"StdChains getChain(string): Chain alias cannot be the empty string.\");\n\n initialize();\n chain = chains[chainAlias];\n require(\n chain.chainId != 0,\n string(abi.encodePacked(\"StdChains getChain(string): Chain with alias \\\"\", chainAlias, \"\\\" not found.\"))\n );\n\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\n }\n\n function getChain(uint256 chainId) internal virtual returns (Chain memory chain) {\n require(chainId != 0, \"StdChains getChain(uint256): Chain ID cannot be 0.\");\n initialize();\n string memory chainAlias = idToAlias[chainId];\n\n chain = chains[chainAlias];\n\n require(\n chain.chainId != 0,\n string(abi.encodePacked(\"StdChains getChain(uint256): Chain with ID \", vm.toString(chainId), \" not found.\"))\n );\n\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\n }\n\n // set chain info, with priority to argument's rpcUrl field.\n function setChain(string memory chainAlias, ChainData memory chain) internal virtual {\n require(\n bytes(chainAlias).length != 0,\n \"StdChains setChain(string,ChainData): Chain alias cannot be the empty string.\"\n );\n\n require(chain.chainId != 0, \"StdChains setChain(string,ChainData): Chain ID cannot be 0.\");\n\n initialize();\n string memory foundAlias = idToAlias[chain.chainId];\n\n require(\n bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)),\n string(\n abi.encodePacked(\n \"StdChains setChain(string,ChainData): Chain ID \",\n vm.toString(chain.chainId),\n \" already used by \\\"\",\n foundAlias,\n \"\\\".\"\n )\n )\n );\n\n uint256 oldChainId = chains[chainAlias].chainId;\n delete idToAlias[oldChainId];\n\n chains[chainAlias] =\n Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl});\n idToAlias[chain.chainId] = chainAlias;\n }\n\n // set chain info, with priority to argument's rpcUrl field.\n function setChain(string memory chainAlias, Chain memory chain) internal virtual {\n setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl}));\n }\n\n function _toUpper(string memory str) private pure returns (string memory) {\n bytes memory strb = bytes(str);\n bytes memory copy = new bytes(strb.length);\n for (uint256 i = 0; i < strb.length; i++) {\n bytes1 b = strb[i];\n if (b >= 0x61 && b <= 0x7A) {\n copy[i] = bytes1(uint8(b) - 32);\n } else {\n copy[i] = b;\n }\n }\n return string(copy);\n }\n\n // lookup rpcUrl, in descending order of priority:\n // current -> config (foundry.toml) -> environment variable -> default\n function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) private returns (Chain memory) {\n if (bytes(chain.rpcUrl).length == 0) {\n try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) {\n chain.rpcUrl = configRpcUrl;\n } catch (bytes memory err) {\n string memory envName = string(abi.encodePacked(_toUpper(chainAlias), \"_RPC_URL\"));\n if (fallbackToDefaultRpcUrls) {\n chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]);\n } else {\n chain.rpcUrl = vm.envString(envName);\n }\n // distinguish 'not found' from 'cannot read'\n bytes memory notFoundError =\n abi.encodeWithSignature(\"CheatCodeError\", string(abi.encodePacked(\"invalid rpc url \", chainAlias)));\n if (keccak256(notFoundError) != keccak256(err) || bytes(chain.rpcUrl).length == 0) {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, err), mload(err))\n }\n }\n }\n }\n return chain;\n }\n\n function setFallbackToDefaultRpcUrls(bool useDefault) internal {\n fallbackToDefaultRpcUrls = useDefault;\n }\n\n function initialize() private {\n if (initialized) return;\n\n initialized = true;\n\n // If adding an RPC here, make sure to test the default RPC URL in `testRpcs`\n setChainWithDefaultRpcUrl(\"anvil\", ChainData(\"Anvil\", 31337, \"http://127.0.0.1:8545\"));\n setChainWithDefaultRpcUrl(\n \"mainnet\", ChainData(\"Mainnet\", 1, \"https://mainnet.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\n \"goerli\", ChainData(\"Goerli\", 5, \"https://goerli.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\n \"sepolia\", ChainData(\"Sepolia\", 11155111, \"https://sepolia.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\"optimism\", ChainData(\"Optimism\", 10, \"https://mainnet.optimism.io\"));\n setChainWithDefaultRpcUrl(\"optimism_goerli\", ChainData(\"Optimism Goerli\", 420, \"https://goerli.optimism.io\"));\n setChainWithDefaultRpcUrl(\"arbitrum_one\", ChainData(\"Arbitrum One\", 42161, \"https://arb1.arbitrum.io/rpc\"));\n setChainWithDefaultRpcUrl(\n \"arbitrum_one_goerli\", ChainData(\"Arbitrum One Goerli\", 421613, \"https://goerli-rollup.arbitrum.io/rpc\")\n );\n setChainWithDefaultRpcUrl(\"arbitrum_nova\", ChainData(\"Arbitrum Nova\", 42170, \"https://nova.arbitrum.io/rpc\"));\n setChainWithDefaultRpcUrl(\"polygon\", ChainData(\"Polygon\", 137, \"https://polygon-rpc.com\"));\n setChainWithDefaultRpcUrl(\n \"polygon_mumbai\", ChainData(\"Polygon Mumbai\", 80001, \"https://rpc-mumbai.maticvigil.com\")\n );\n setChainWithDefaultRpcUrl(\"avalanche\", ChainData(\"Avalanche\", 43114, \"https://api.avax.network/ext/bc/C/rpc\"));\n setChainWithDefaultRpcUrl(\n \"avalanche_fuji\", ChainData(\"Avalanche Fuji\", 43113, \"https://api.avax-test.network/ext/bc/C/rpc\")\n );\n setChainWithDefaultRpcUrl(\n \"bnb_smart_chain\", ChainData(\"BNB Smart Chain\", 56, \"https://bsc-dataseed1.binance.org\")\n );\n setChainWithDefaultRpcUrl(\n \"bnb_smart_chain_testnet\",\n ChainData(\"BNB Smart Chain Testnet\", 97, \"https://rpc.ankr.com/bsc_testnet_chapel\")\n );\n setChainWithDefaultRpcUrl(\"gnosis_chain\", ChainData(\"Gnosis Chain\", 100, \"https://rpc.gnosischain.com\"));\n }\n\n // set chain info, with priority to chainAlias' rpc url in foundry.toml\n function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private {\n string memory rpcUrl = chain.rpcUrl;\n defaultRpcUrls[chainAlias] = rpcUrl;\n chain.rpcUrl = \"\";\n setChain(chainAlias, chain);\n chain.rpcUrl = rpcUrl; // restore argument\n }\n}\n" + }, + "forge-std/StdCheats.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\nimport {Vm} from \"./Vm.sol\";\n\nabstract contract StdCheatsSafe {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n bool private gasMeteringOff;\n\n // Data structures to parse Transaction objects from the broadcast artifact\n // that conform to EIP1559. The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct RawTx1559 {\n string[] arguments;\n address contractAddress;\n string contractName;\n // json value name = function\n string functionSig;\n bytes32 hash;\n // json value name = tx\n RawTx1559Detail txDetail;\n // json value name = type\n string opcode;\n }\n\n struct RawTx1559Detail {\n AccessList[] accessList;\n bytes data;\n address from;\n bytes gas;\n bytes nonce;\n address to;\n bytes txType;\n bytes value;\n }\n\n struct Tx1559 {\n string[] arguments;\n address contractAddress;\n string contractName;\n string functionSig;\n bytes32 hash;\n Tx1559Detail txDetail;\n string opcode;\n }\n\n struct Tx1559Detail {\n AccessList[] accessList;\n bytes data;\n address from;\n uint256 gas;\n uint256 nonce;\n address to;\n uint256 txType;\n uint256 value;\n }\n\n // Data structures to parse Transaction objects from the broadcast artifact\n // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct TxLegacy {\n string[] arguments;\n address contractAddress;\n string contractName;\n string functionSig;\n string hash;\n string opcode;\n TxDetailLegacy transaction;\n }\n\n struct TxDetailLegacy {\n AccessList[] accessList;\n uint256 chainId;\n bytes data;\n address from;\n uint256 gas;\n uint256 gasPrice;\n bytes32 hash;\n uint256 nonce;\n bytes1 opcode;\n bytes32 r;\n bytes32 s;\n uint256 txType;\n address to;\n uint8 v;\n uint256 value;\n }\n\n struct AccessList {\n address accessAddress;\n bytes32[] storageKeys;\n }\n\n // Data structures to parse Receipt objects from the broadcast artifact.\n // The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct RawReceipt {\n bytes32 blockHash;\n bytes blockNumber;\n address contractAddress;\n bytes cumulativeGasUsed;\n bytes effectiveGasPrice;\n address from;\n bytes gasUsed;\n RawReceiptLog[] logs;\n bytes logsBloom;\n bytes status;\n address to;\n bytes32 transactionHash;\n bytes transactionIndex;\n }\n\n struct Receipt {\n bytes32 blockHash;\n uint256 blockNumber;\n address contractAddress;\n uint256 cumulativeGasUsed;\n uint256 effectiveGasPrice;\n address from;\n uint256 gasUsed;\n ReceiptLog[] logs;\n bytes logsBloom;\n uint256 status;\n address to;\n bytes32 transactionHash;\n uint256 transactionIndex;\n }\n\n // Data structures to parse the entire broadcast artifact, assuming the\n // transactions conform to EIP1559.\n\n struct EIP1559ScriptArtifact {\n string[] libraries;\n string path;\n string[] pending;\n Receipt[] receipts;\n uint256 timestamp;\n Tx1559[] transactions;\n TxReturn[] txReturns;\n }\n\n struct RawEIP1559ScriptArtifact {\n string[] libraries;\n string path;\n string[] pending;\n RawReceipt[] receipts;\n TxReturn[] txReturns;\n uint256 timestamp;\n RawTx1559[] transactions;\n }\n\n struct RawReceiptLog {\n // json value = address\n address logAddress;\n bytes32 blockHash;\n bytes blockNumber;\n bytes data;\n bytes logIndex;\n bool removed;\n bytes32[] topics;\n bytes32 transactionHash;\n bytes transactionIndex;\n bytes transactionLogIndex;\n }\n\n struct ReceiptLog {\n // json value = address\n address logAddress;\n bytes32 blockHash;\n uint256 blockNumber;\n bytes data;\n uint256 logIndex;\n bytes32[] topics;\n uint256 transactionIndex;\n uint256 transactionLogIndex;\n bool removed;\n }\n\n struct TxReturn {\n string internalType;\n string value;\n }\n\n function assumeNoPrecompiles(address addr) internal virtual {\n // Assembly required since `block.chainid` was introduced in 0.8.0.\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n assumeNoPrecompiles(addr, chainId);\n }\n\n function assumeNoPrecompiles(address addr, uint256 chainId) internal pure virtual {\n // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific\n // address), but the same rationale for excluding them applies so we include those too.\n\n // These should be present on all EVM-compatible chains.\n vm.assume(addr < address(0x1) || addr > address(0x9));\n\n // forgefmt: disable-start\n if (chainId == 10 || chainId == 420) {\n // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21\n vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800));\n } else if (chainId == 42161 || chainId == 421613) {\n // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains\n vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068));\n } else if (chainId == 43114 || chainId == 43113) {\n // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59\n vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff));\n vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF));\n vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff));\n }\n // forgefmt: disable-end\n }\n\n function readEIP1559ScriptArtifact(string memory path)\n internal\n view\n virtual\n returns (EIP1559ScriptArtifact memory)\n {\n string memory data = vm.readFile(path);\n bytes memory parsedData = vm.parseJson(data);\n RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact));\n EIP1559ScriptArtifact memory artifact;\n artifact.libraries = rawArtifact.libraries;\n artifact.path = rawArtifact.path;\n artifact.timestamp = rawArtifact.timestamp;\n artifact.pending = rawArtifact.pending;\n artifact.txReturns = rawArtifact.txReturns;\n artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts);\n artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions);\n return artifact;\n }\n\n function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) {\n Tx1559[] memory txs = new Tx1559[](rawTxs.length);\n for (uint256 i; i < rawTxs.length; i++) {\n txs[i] = rawToConvertedEIPTx1559(rawTxs[i]);\n }\n return txs;\n }\n\n function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) {\n Tx1559 memory transaction;\n transaction.arguments = rawTx.arguments;\n transaction.contractName = rawTx.contractName;\n transaction.functionSig = rawTx.functionSig;\n transaction.hash = rawTx.hash;\n transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail);\n transaction.opcode = rawTx.opcode;\n return transaction;\n }\n\n function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail)\n internal\n pure\n virtual\n returns (Tx1559Detail memory)\n {\n Tx1559Detail memory txDetail;\n txDetail.data = rawDetail.data;\n txDetail.from = rawDetail.from;\n txDetail.to = rawDetail.to;\n txDetail.nonce = _bytesToUint(rawDetail.nonce);\n txDetail.txType = _bytesToUint(rawDetail.txType);\n txDetail.value = _bytesToUint(rawDetail.value);\n txDetail.gas = _bytesToUint(rawDetail.gas);\n txDetail.accessList = rawDetail.accessList;\n return txDetail;\n }\n\n function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) {\n string memory deployData = vm.readFile(path);\n bytes memory parsedDeployData = vm.parseJson(deployData, \".transactions\");\n RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[]));\n return rawToConvertedEIPTx1559s(rawTxs);\n }\n\n function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) {\n string memory deployData = vm.readFile(path);\n string memory key = string(abi.encodePacked(\".transactions[\", vm.toString(index), \"]\"));\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\n RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559));\n return rawToConvertedEIPTx1559(rawTx);\n }\n\n // Analogous to readTransactions, but for receipts.\n function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) {\n string memory deployData = vm.readFile(path);\n bytes memory parsedDeployData = vm.parseJson(deployData, \".receipts\");\n RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[]));\n return rawToConvertedReceipts(rawReceipts);\n }\n\n function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) {\n string memory deployData = vm.readFile(path);\n string memory key = string(abi.encodePacked(\".receipts[\", vm.toString(index), \"]\"));\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\n RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt));\n return rawToConvertedReceipt(rawReceipt);\n }\n\n function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) {\n Receipt[] memory receipts = new Receipt[](rawReceipts.length);\n for (uint256 i; i < rawReceipts.length; i++) {\n receipts[i] = rawToConvertedReceipt(rawReceipts[i]);\n }\n return receipts;\n }\n\n function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) {\n Receipt memory receipt;\n receipt.blockHash = rawReceipt.blockHash;\n receipt.to = rawReceipt.to;\n receipt.from = rawReceipt.from;\n receipt.contractAddress = rawReceipt.contractAddress;\n receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice);\n receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed);\n receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed);\n receipt.status = _bytesToUint(rawReceipt.status);\n receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex);\n receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber);\n receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs);\n receipt.logsBloom = rawReceipt.logsBloom;\n receipt.transactionHash = rawReceipt.transactionHash;\n return receipt;\n }\n\n function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs)\n internal\n pure\n virtual\n returns (ReceiptLog[] memory)\n {\n ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length);\n for (uint256 i; i < rawLogs.length; i++) {\n logs[i].logAddress = rawLogs[i].logAddress;\n logs[i].blockHash = rawLogs[i].blockHash;\n logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber);\n logs[i].data = rawLogs[i].data;\n logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex);\n logs[i].topics = rawLogs[i].topics;\n logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex);\n logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex);\n logs[i].removed = rawLogs[i].removed;\n }\n return logs;\n }\n\n // Deploy a contract by fetching the contract bytecode from\n // the artifacts directory\n // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))`\n function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) {\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,bytes): Deployment failed.\");\n }\n\n function deployCode(string memory what) internal virtual returns (address addr) {\n bytes memory bytecode = vm.getCode(what);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string): Deployment failed.\");\n }\n\n /// @dev deploy contract with value on construction\n function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) {\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,bytes,uint256): Deployment failed.\");\n }\n\n function deployCode(string memory what, uint256 val) internal virtual returns (address addr) {\n bytes memory bytecode = vm.getCode(what);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,uint256): Deployment failed.\");\n }\n\n // creates a labeled address and the corresponding private key\n function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) {\n privateKey = uint256(keccak256(abi.encodePacked(name)));\n addr = vm.addr(privateKey);\n vm.label(addr, name);\n }\n\n // creates a labeled address\n function makeAddr(string memory name) internal virtual returns (address addr) {\n (addr,) = makeAddrAndKey(name);\n }\n\n function deriveRememberKey(string memory mnemonic, uint32 index)\n internal\n virtual\n returns (address who, uint256 privateKey)\n {\n privateKey = vm.deriveKey(mnemonic, index);\n who = vm.rememberKey(privateKey);\n }\n\n function _bytesToUint(bytes memory b) private pure returns (uint256) {\n require(b.length <= 32, \"StdCheats _bytesToUint(bytes): Bytes length exceeds 32.\");\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\n }\n\n function isFork() internal view virtual returns (bool status) {\n try vm.activeFork() {\n status = true;\n } catch (bytes memory) {}\n }\n\n modifier skipWhenForking() {\n if (!isFork()) {\n _;\n }\n }\n\n modifier skipWhenNotForking() {\n if (isFork()) {\n _;\n }\n }\n\n modifier noGasMetering() {\n vm.pauseGasMetering();\n // To prevent turning gas monitoring back on with nested functions that use this modifier,\n // we check if gasMetering started in the off position. If it did, we don't want to turn\n // it back on until we exit the top level function that used the modifier\n //\n // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well.\n // funcA will have `gasStartedOff` as false, funcB will have it as true,\n // so we only turn metering back on at the end of the funcA\n bool gasStartedOff = gasMeteringOff;\n gasMeteringOff = true;\n\n _;\n\n // if gas metering was on when this modifier was called, turn it back on at the end\n if (!gasStartedOff) {\n gasMeteringOff = false;\n vm.resumeGasMetering();\n }\n }\n\n // a cheat for fuzzing addresses that are payable only\n // see https://github.com/foundry-rs/foundry/issues/3631\n function assumePayable(address addr) internal virtual {\n (bool success,) = payable(addr).call{value: 0}(\"\");\n vm.assume(success);\n }\n}\n\n// Wrappers around cheatcodes to avoid footguns\nabstract contract StdCheats is StdCheatsSafe {\n using stdStorage for StdStorage;\n\n StdStorage private stdstore;\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n // Skip forward or rewind time by the specified number of seconds\n function skip(uint256 time) internal virtual {\n vm.warp(block.timestamp + time);\n }\n\n function rewind(uint256 time) internal virtual {\n vm.warp(block.timestamp - time);\n }\n\n // Setup a prank from an address that has some ether\n function hoax(address msgSender) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.prank(msgSender);\n }\n\n function hoax(address msgSender, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.prank(msgSender);\n }\n\n function hoax(address msgSender, address origin) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.prank(msgSender, origin);\n }\n\n function hoax(address msgSender, address origin, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.prank(msgSender, origin);\n }\n\n // Start perpetual prank from an address that has some ether\n function startHoax(address msgSender) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.startPrank(msgSender);\n }\n\n function startHoax(address msgSender, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.startPrank(msgSender);\n }\n\n // Start perpetual prank from an address that has some ether\n // tx.origin is set to the origin parameter\n function startHoax(address msgSender, address origin) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.startPrank(msgSender, origin);\n }\n\n function startHoax(address msgSender, address origin, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.startPrank(msgSender, origin);\n }\n\n function changePrank(address msgSender) internal virtual {\n vm.stopPrank();\n vm.startPrank(msgSender);\n }\n\n // The same as Vm's `deal`\n // Use the alternative signature for ERC20 tokens\n function deal(address to, uint256 give) internal virtual {\n vm.deal(to, give);\n }\n\n // Set the balance of an account for any ERC20 token\n // Use the alternative signature to update `totalSupply`\n function deal(address token, address to, uint256 give) internal virtual {\n deal(token, to, give, false);\n }\n\n // Set the balance of an account for any ERC1155 token\n // Use the alternative signature to update `totalSupply`\n function dealERC1155(address token, address to, uint256 id, uint256 give) internal virtual {\n dealERC1155(token, to, id, give, false);\n }\n\n function deal(address token, address to, uint256 give, bool adjust) internal virtual {\n // get current balance\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n uint256 prevBal = abi.decode(balData, (uint256));\n\n // update balance\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give);\n\n // update total supply\n if (adjust) {\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0x18160ddd));\n uint256 totSup = abi.decode(totSupData, (uint256));\n if (give < prevBal) {\n totSup -= (prevBal - give);\n } else {\n totSup += (give - prevBal);\n }\n stdstore.target(token).sig(0x18160ddd).checked_write(totSup);\n }\n }\n\n function dealERC1155(address token, address to, uint256 id, uint256 give, bool adjust) internal virtual {\n // get current balance\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x00fdd58e, to, id));\n uint256 prevBal = abi.decode(balData, (uint256));\n\n // update balance\n stdstore.target(token).sig(0x00fdd58e).with_key(to).with_key(id).checked_write(give);\n\n // update total supply\n if (adjust) {\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0xbd85b039, id));\n require(\n totSupData.length != 0,\n \"StdCheats deal(address,address,uint,uint,bool): target contract is not ERC1155Supply.\"\n );\n uint256 totSup = abi.decode(totSupData, (uint256));\n if (give < prevBal) {\n totSup -= (prevBal - give);\n } else {\n totSup += (give - prevBal);\n }\n stdstore.target(token).sig(0xbd85b039).with_key(id).checked_write(totSup);\n }\n }\n\n function dealERC721(address token, address to, uint256 id) internal virtual {\n // check if token id is already minted and the actual owner.\n (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id));\n require(successMinted, \"StdCheats deal(address,address,uint,bool): id not minted.\");\n\n // get owner current balance\n (, bytes memory fromBalData) = token.call(abi.encodeWithSelector(0x70a08231, abi.decode(ownerData, (address))));\n uint256 fromPrevBal = abi.decode(fromBalData, (uint256));\n\n // get new user current balance\n (, bytes memory toBalData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n uint256 toPrevBal = abi.decode(toBalData, (uint256));\n\n // update balances\n stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal);\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal);\n\n // update owner\n stdstore.target(token).sig(0x6352211e).with_key(id).checked_write(to);\n }\n}\n" + }, + "forge-std/StdError.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test\npragma solidity >=0.6.2 <0.9.0;\n\nlibrary stdError {\n bytes public constant assertionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x01);\n bytes public constant arithmeticError = abi.encodeWithSignature(\"Panic(uint256)\", 0x11);\n bytes public constant divisionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x12);\n bytes public constant enumConversionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x21);\n bytes public constant encodeStorageError = abi.encodeWithSignature(\"Panic(uint256)\", 0x22);\n bytes public constant popError = abi.encodeWithSignature(\"Panic(uint256)\", 0x31);\n bytes public constant indexOOBError = abi.encodeWithSignature(\"Panic(uint256)\", 0x32);\n bytes public constant memOverflowError = abi.encodeWithSignature(\"Panic(uint256)\", 0x41);\n bytes public constant zeroVarError = abi.encodeWithSignature(\"Panic(uint256)\", 0x51);\n}\n" + }, + "forge-std/StdInvariant.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\ncontract StdInvariant {\n struct FuzzSelector {\n address addr;\n bytes4[] selectors;\n }\n\n address[] private _excludedContracts;\n address[] private _excludedSenders;\n address[] private _targetedContracts;\n address[] private _targetedSenders;\n\n string[] private _excludedArtifacts;\n string[] private _targetedArtifacts;\n\n FuzzSelector[] private _targetedArtifactSelectors;\n FuzzSelector[] private _targetedSelectors;\n\n // Functions for users:\n // These are intended to be called in tests.\n\n function excludeContract(address newExcludedContract_) internal {\n _excludedContracts.push(newExcludedContract_);\n }\n\n function excludeSender(address newExcludedSender_) internal {\n _excludedSenders.push(newExcludedSender_);\n }\n\n function excludeArtifact(string memory newExcludedArtifact_) internal {\n _excludedArtifacts.push(newExcludedArtifact_);\n }\n\n function targetArtifact(string memory newTargetedArtifact_) internal {\n _targetedArtifacts.push(newTargetedArtifact_);\n }\n\n function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal {\n _targetedArtifactSelectors.push(newTargetedArtifactSelector_);\n }\n\n function targetContract(address newTargetedContract_) internal {\n _targetedContracts.push(newTargetedContract_);\n }\n\n function targetSelector(FuzzSelector memory newTargetedSelector_) internal {\n _targetedSelectors.push(newTargetedSelector_);\n }\n\n function targetSender(address newTargetedSender_) internal {\n _targetedSenders.push(newTargetedSender_);\n }\n\n // Functions for forge:\n // These are called by forge to run invariant tests and don't need to be called in tests.\n\n function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) {\n excludedArtifacts_ = _excludedArtifacts;\n }\n\n function excludeContracts() public view returns (address[] memory excludedContracts_) {\n excludedContracts_ = _excludedContracts;\n }\n\n function excludeSenders() public view returns (address[] memory excludedSenders_) {\n excludedSenders_ = _excludedSenders;\n }\n\n function targetArtifacts() public view returns (string[] memory targetedArtifacts_) {\n targetedArtifacts_ = _targetedArtifacts;\n }\n\n function targetArtifactSelectors() public view returns (FuzzSelector[] memory targetedArtifactSelectors_) {\n targetedArtifactSelectors_ = _targetedArtifactSelectors;\n }\n\n function targetContracts() public view returns (address[] memory targetedContracts_) {\n targetedContracts_ = _targetedContracts;\n }\n\n function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) {\n targetedSelectors_ = _targetedSelectors;\n }\n\n function targetSenders() public view returns (address[] memory targetedSenders_) {\n targetedSenders_ = _targetedSenders;\n }\n}\n" + }, + "forge-std/StdJson.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {VmSafe} from \"./Vm.sol\";\n\n// Helpers for parsing and writing JSON files\n// To parse:\n// ```\n// using stdJson for string;\n// string memory json = vm.readFile(\"some_peth\");\n// json.parseUint(\"\");\n// ```\n// To write:\n// ```\n// using stdJson for string;\n// string memory json = \"deploymentArtifact\";\n// Contract contract = new Contract();\n// json.serialize(\"contractAddress\", address(contract));\n// json = json.serialize(\"deploymentTimes\", uint(1));\n// // store the stringified JSON to the 'json' variable we have been using as a key\n// // as we won't need it any longer\n// string memory json2 = \"finalArtifact\";\n// string memory final = json2.serialize(\"depArtifact\", json);\n// final.write(\"\");\n// ```\n\nlibrary stdJson {\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) {\n return vm.parseJson(json, key);\n }\n\n function readUint(string memory json, string memory key) internal returns (uint256) {\n return vm.parseJsonUint(json, key);\n }\n\n function readUintArray(string memory json, string memory key) internal returns (uint256[] memory) {\n return vm.parseJsonUintArray(json, key);\n }\n\n function readInt(string memory json, string memory key) internal returns (int256) {\n return vm.parseJsonInt(json, key);\n }\n\n function readIntArray(string memory json, string memory key) internal returns (int256[] memory) {\n return vm.parseJsonIntArray(json, key);\n }\n\n function readBytes32(string memory json, string memory key) internal returns (bytes32) {\n return vm.parseJsonBytes32(json, key);\n }\n\n function readBytes32Array(string memory json, string memory key) internal returns (bytes32[] memory) {\n return vm.parseJsonBytes32Array(json, key);\n }\n\n function readString(string memory json, string memory key) internal returns (string memory) {\n return vm.parseJsonString(json, key);\n }\n\n function readStringArray(string memory json, string memory key) internal returns (string[] memory) {\n return vm.parseJsonStringArray(json, key);\n }\n\n function readAddress(string memory json, string memory key) internal returns (address) {\n return vm.parseJsonAddress(json, key);\n }\n\n function readAddressArray(string memory json, string memory key) internal returns (address[] memory) {\n return vm.parseJsonAddressArray(json, key);\n }\n\n function readBool(string memory json, string memory key) internal returns (bool) {\n return vm.parseJsonBool(json, key);\n }\n\n function readBoolArray(string memory json, string memory key) internal returns (bool[] memory) {\n return vm.parseJsonBoolArray(json, key);\n }\n\n function readBytes(string memory json, string memory key) internal returns (bytes memory) {\n return vm.parseJsonBytes(json, key);\n }\n\n function readBytesArray(string memory json, string memory key) internal returns (bytes[] memory) {\n return vm.parseJsonBytesArray(json, key);\n }\n\n function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) {\n return vm.serializeBool(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bool[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBool(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) {\n return vm.serializeUint(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, uint256[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeUint(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) {\n return vm.serializeInt(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, int256[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeInt(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) {\n return vm.serializeAddress(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, address[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeAddress(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) {\n return vm.serializeBytes32(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes32[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBytes32(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) {\n return vm.serializeBytes(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBytes(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, string memory value)\n internal\n returns (string memory)\n {\n return vm.serializeString(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, string[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeString(jsonKey, key, value);\n }\n\n function write(string memory jsonKey, string memory path) internal {\n vm.writeJson(jsonKey, path);\n }\n\n function write(string memory jsonKey, string memory path, string memory valueKey) internal {\n vm.writeJson(jsonKey, path, valueKey);\n }\n}\n" + }, + "forge-std/StdMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nlibrary stdMath {\n int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968;\n\n function abs(int256 a) internal pure returns (uint256) {\n // Required or it will fail when `a = type(int256).min`\n if (a == INT256_MIN) {\n return 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n }\n\n return uint256(a > 0 ? a : -a);\n }\n\n function delta(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : b - a;\n }\n\n function delta(int256 a, int256 b) internal pure returns (uint256) {\n // a and b are of the same sign\n // this works thanks to two's complement, the left-most bit is the sign bit\n if ((a ^ b) > -1) {\n return delta(abs(a), abs(b));\n }\n\n // a and b are of opposite signs\n return abs(a) + abs(b);\n }\n\n function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 absDelta = delta(a, b);\n\n return absDelta * 1e18 / b;\n }\n\n function percentDelta(int256 a, int256 b) internal pure returns (uint256) {\n uint256 absDelta = delta(a, b);\n uint256 absB = abs(b);\n\n return absDelta * 1e18 / absB;\n }\n}\n" + }, + "forge-std/StdStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {Vm} from \"./Vm.sol\";\n\nstruct StdStorage {\n mapping(address => mapping(bytes4 => mapping(bytes32 => uint256))) slots;\n mapping(address => mapping(bytes4 => mapping(bytes32 => bool))) finds;\n bytes32[] _keys;\n bytes4 _sig;\n uint256 _depth;\n address _target;\n bytes32 _set;\n}\n\nlibrary stdStorageSafe {\n event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot);\n event WARNING_UninitedSlot(address who, uint256 slot);\n\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function sigs(string memory sigStr) internal pure returns (bytes4) {\n return bytes4(keccak256(bytes(sigStr)));\n }\n\n /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against\n // slot complexity:\n // if flat, will be bytes32(uint256(uint));\n // if map, will be keccak256(abi.encode(key, uint(slot)));\n // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))));\n // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth);\n function find(StdStorage storage self) internal returns (uint256) {\n address who = self._target;\n bytes4 fsig = self._sig;\n uint256 field_depth = self._depth;\n bytes32[] memory ins = self._keys;\n\n // calldata to test against\n if (self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n }\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n vm.record();\n bytes32 fdat;\n {\n (, bytes memory rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n\n (bytes32[] memory reads,) = vm.accesses(address(who));\n if (reads.length == 1) {\n bytes32 curr = vm.load(who, reads[0]);\n if (curr == bytes32(0)) {\n emit WARNING_UninitedSlot(who, uint256(reads[0]));\n }\n if (fdat != curr) {\n require(\n false,\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\n );\n }\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[0]));\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[0]);\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n } else if (reads.length > 1) {\n for (uint256 i = 0; i < reads.length; i++) {\n bytes32 prev = vm.load(who, reads[i]);\n if (prev == bytes32(0)) {\n emit WARNING_UninitedSlot(who, uint256(reads[i]));\n }\n // store\n vm.store(who, reads[i], bytes32(hex\"1337\"));\n bool success;\n bytes memory rdat;\n {\n (success, rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n\n if (success && fdat == bytes32(hex\"1337\")) {\n // we found which of the slots is the actual one\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[i]));\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[i]);\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n vm.store(who, reads[i], prev);\n break;\n }\n vm.store(who, reads[i], prev);\n }\n } else {\n revert(\"stdStorage find(StdStorage): No storage use detected for target.\");\n }\n\n require(\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))],\n \"stdStorage find(StdStorage): Slot(s) not found.\"\n );\n\n delete self._target;\n delete self._sig;\n delete self._keys;\n delete self._depth;\n\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n }\n\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n self._target = _target;\n return self;\n }\n\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n self._sig = _sig;\n return self;\n }\n\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n self._sig = sigs(_sig);\n return self;\n }\n\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n self._keys.push(bytes32(uint256(uint160(who))));\n return self;\n }\n\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n self._keys.push(bytes32(amt));\n return self;\n }\n\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n self._keys.push(key);\n return self;\n }\n\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n self._depth = _depth;\n return self;\n }\n\n function read(StdStorage storage self) private returns (bytes memory) {\n address t = self._target;\n uint256 s = find(self);\n return abi.encode(vm.load(t, bytes32(s)));\n }\n\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n return abi.decode(read(self), (bytes32));\n }\n\n function read_bool(StdStorage storage self) internal returns (bool) {\n int256 v = read_int(self);\n if (v == 0) return false;\n if (v == 1) return true;\n revert(\"stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool.\");\n }\n\n function read_address(StdStorage storage self) internal returns (address) {\n return abi.decode(read(self), (address));\n }\n\n function read_uint(StdStorage storage self) internal returns (uint256) {\n return abi.decode(read(self), (uint256));\n }\n\n function read_int(StdStorage storage self) internal returns (int256) {\n return abi.decode(read(self), (int256));\n }\n\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\n bytes32 out;\n\n uint256 max = b.length > 32 ? 32 : b.length;\n for (uint256 i = 0; i < max; i++) {\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n }\n return out;\n }\n\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\n bytes memory result = new bytes(b.length * 32);\n for (uint256 i = 0; i < b.length; i++) {\n bytes32 k = b[i];\n /// @solidity memory-safe-assembly\n assembly {\n mstore(add(result, add(32, mul(32, i))), k)\n }\n }\n\n return result;\n }\n}\n\nlibrary stdStorage {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function sigs(string memory sigStr) internal pure returns (bytes4) {\n return stdStorageSafe.sigs(sigStr);\n }\n\n function find(StdStorage storage self) internal returns (uint256) {\n return stdStorageSafe.find(self);\n }\n\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n return stdStorageSafe.target(self, _target);\n }\n\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n return stdStorageSafe.sig(self, _sig);\n }\n\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n return stdStorageSafe.sig(self, _sig);\n }\n\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, who);\n }\n\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, amt);\n }\n\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, key);\n }\n\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n return stdStorageSafe.depth(self, _depth);\n }\n\n function checked_write(StdStorage storage self, address who) internal {\n checked_write(self, bytes32(uint256(uint160(who))));\n }\n\n function checked_write(StdStorage storage self, uint256 amt) internal {\n checked_write(self, bytes32(amt));\n }\n\n function checked_write(StdStorage storage self, bool write) internal {\n bytes32 t;\n /// @solidity memory-safe-assembly\n assembly {\n t := write\n }\n checked_write(self, t);\n }\n\n function checked_write(StdStorage storage self, bytes32 set) internal {\n address who = self._target;\n bytes4 fsig = self._sig;\n uint256 field_depth = self._depth;\n bytes32[] memory ins = self._keys;\n\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n if (!self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n find(self);\n }\n bytes32 slot = bytes32(self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]);\n\n bytes32 fdat;\n {\n (, bytes memory rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n bytes32 curr = vm.load(who, slot);\n\n if (fdat != curr) {\n require(\n false,\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\n );\n }\n vm.store(who, slot, set);\n delete self._target;\n delete self._sig;\n delete self._keys;\n delete self._depth;\n }\n\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n return stdStorageSafe.read_bytes32(self);\n }\n\n function read_bool(StdStorage storage self) internal returns (bool) {\n return stdStorageSafe.read_bool(self);\n }\n\n function read_address(StdStorage storage self) internal returns (address) {\n return stdStorageSafe.read_address(self);\n }\n\n function read_uint(StdStorage storage self) internal returns (uint256) {\n return stdStorageSafe.read_uint(self);\n }\n\n function read_int(StdStorage storage self) internal returns (int256) {\n return stdStorageSafe.read_int(self);\n }\n\n // Private function so needs to be copied over\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\n bytes32 out;\n\n uint256 max = b.length > 32 ? 32 : b.length;\n for (uint256 i = 0; i < max; i++) {\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n }\n return out;\n }\n\n // Private function so needs to be copied over\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\n bytes memory result = new bytes(b.length * 32);\n for (uint256 i = 0; i < b.length; i++) {\n bytes32 k = b[i];\n /// @solidity memory-safe-assembly\n assembly {\n mstore(add(result, add(32, mul(32, i))), k)\n }\n }\n\n return result;\n }\n}\n" + }, + "forge-std/StdStyle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nimport {Vm} from \"./Vm.sol\";\n\nlibrary StdStyle {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n string constant RED = \"\\u001b[91m\";\n string constant GREEN = \"\\u001b[92m\";\n string constant YELLOW = \"\\u001b[93m\";\n string constant BLUE = \"\\u001b[94m\";\n string constant MAGENTA = \"\\u001b[95m\";\n string constant CYAN = \"\\u001b[96m\";\n string constant BOLD = \"\\u001b[1m\";\n string constant DIM = \"\\u001b[2m\";\n string constant ITALIC = \"\\u001b[3m\";\n string constant UNDERLINE = \"\\u001b[4m\";\n string constant INVERSE = \"\\u001b[7m\";\n string constant RESET = \"\\u001b[0m\";\n\n function styleConcat(string memory style, string memory self) private pure returns (string memory) {\n return string(abi.encodePacked(style, self, RESET));\n }\n\n function red(string memory self) internal pure returns (string memory) {\n return styleConcat(RED, self);\n }\n\n function red(uint256 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(int256 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(address self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(bool self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function redBytes(bytes memory self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function redBytes32(bytes32 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function green(string memory self) internal pure returns (string memory) {\n return styleConcat(GREEN, self);\n }\n\n function green(uint256 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(int256 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(address self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(bool self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function greenBytes(bytes memory self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function greenBytes32(bytes32 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function yellow(string memory self) internal pure returns (string memory) {\n return styleConcat(YELLOW, self);\n }\n\n function yellow(uint256 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(int256 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(address self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(bool self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellowBytes(bytes memory self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellowBytes32(bytes32 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function blue(string memory self) internal pure returns (string memory) {\n return styleConcat(BLUE, self);\n }\n\n function blue(uint256 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(int256 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(address self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(bool self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blueBytes(bytes memory self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blueBytes32(bytes32 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function magenta(string memory self) internal pure returns (string memory) {\n return styleConcat(MAGENTA, self);\n }\n\n function magenta(uint256 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(int256 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(address self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(bool self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magentaBytes(bytes memory self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magentaBytes32(bytes32 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function cyan(string memory self) internal pure returns (string memory) {\n return styleConcat(CYAN, self);\n }\n\n function cyan(uint256 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(int256 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(address self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(bool self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyanBytes(bytes memory self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyanBytes32(bytes32 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function bold(string memory self) internal pure returns (string memory) {\n return styleConcat(BOLD, self);\n }\n\n function bold(uint256 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(int256 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(address self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(bool self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function boldBytes(bytes memory self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function boldBytes32(bytes32 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function dim(string memory self) internal pure returns (string memory) {\n return styleConcat(DIM, self);\n }\n\n function dim(uint256 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(int256 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(address self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(bool self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dimBytes(bytes memory self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dimBytes32(bytes32 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function italic(string memory self) internal pure returns (string memory) {\n return styleConcat(ITALIC, self);\n }\n\n function italic(uint256 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(int256 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(address self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(bool self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italicBytes(bytes memory self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italicBytes32(bytes32 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function underline(string memory self) internal pure returns (string memory) {\n return styleConcat(UNDERLINE, self);\n }\n\n function underline(uint256 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(int256 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(address self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(bool self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underlineBytes(bytes memory self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underlineBytes32(bytes32 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function inverse(string memory self) internal pure returns (string memory) {\n return styleConcat(INVERSE, self);\n }\n\n function inverse(uint256 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(int256 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(address self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(bool self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverseBytes(bytes memory self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverseBytes32(bytes32 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n}\n" + }, + "forge-std/StdUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {IMulticall3} from \"./interfaces/IMulticall3.sol\";\n// TODO Remove import.\nimport {VmSafe} from \"./Vm.sol\";\n\nabstract contract StdUtils {\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n //////////////////////////////////////////////////////////////////////////*/\n\n IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11);\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;\n uint256 private constant INT256_MIN_ABS =\n 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n uint256 private constant UINT256_MAX =\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\n address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\n\n /*//////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) {\n require(min <= max, \"StdUtils bound(uint256,uint256,uint256): Max is less than min.\");\n // If x is between min and max, return x directly. This is to ensure that dictionary values\n // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188\n if (x >= min && x <= max) return x;\n\n uint256 size = max - min + 1;\n\n // If the value is 0, 1, 2, 3, warp that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side.\n // This helps ensure coverage of the min/max values.\n if (x <= 3 && size > x) return min + x;\n if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x);\n\n // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive.\n if (x > max) {\n uint256 diff = x - max;\n uint256 rem = diff % size;\n if (rem == 0) return max;\n result = min + rem - 1;\n } else if (x < min) {\n uint256 diff = min - x;\n uint256 rem = diff % size;\n if (rem == 0) return min;\n result = max - rem + 1;\n }\n }\n\n function bound(uint256 x, uint256 min, uint256 max) internal view virtual returns (uint256 result) {\n result = _bound(x, min, max);\n console2_log(\"Bound Result\", result);\n }\n\n function bound(int256 x, int256 min, int256 max) internal view virtual returns (int256 result) {\n require(min <= max, \"StdUtils bound(int256,int256,int256): Max is less than min.\");\n\n // Shifting all int256 values to uint256 to use _bound function. The range of two types are:\n // int256 : -(2**255) ~ (2**255 - 1)\n // uint256: 0 ~ (2**256 - 1)\n // So, add 2**255, INT256_MIN_ABS to the integer values.\n //\n // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow.\n // So, use `~uint256(x) + 1` instead.\n uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS);\n uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS);\n uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS);\n\n uint256 y = _bound(_x, _min, _max);\n\n // To move it back to int256 value, subtract INT256_MIN_ABS at here.\n result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS);\n console2_log(\"Bound result\", vm.toString(result));\n }\n\n function bytesToUint(bytes memory b) internal pure virtual returns (uint256) {\n require(b.length <= 32, \"StdUtils bytesToUint(bytes): Bytes length exceeds 32.\");\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\n }\n\n /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce\n /// @notice adapted from Solmate implementation (https://github.com/Rari-Capital/solmate/blob/main/src/utils/LibRLP.sol)\n function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) {\n // forgefmt: disable-start\n // The integer zero is treated as an empty byte string, and as a result it only has a length prefix, 0x80, computed via 0x80 + 0.\n // A one byte integer uses its own value as its length prefix, there is no additional \"0x80 + length\" prefix that comes before it.\n if (nonce == 0x00) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, bytes1(0x80))));\n if (nonce <= 0x7f) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, uint8(nonce))));\n\n // Nonces greater than 1 byte all follow a consistent encoding scheme, where each value is preceded by a prefix of 0x80 + length.\n if (nonce <= 2**8 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd7), bytes1(0x94), deployer, bytes1(0x81), uint8(nonce))));\n if (nonce <= 2**16 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd8), bytes1(0x94), deployer, bytes1(0x82), uint16(nonce))));\n if (nonce <= 2**24 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd9), bytes1(0x94), deployer, bytes1(0x83), uint24(nonce))));\n // forgefmt: disable-end\n\n // More details about RLP encoding can be found here: https://eth.wiki/fundamentals/rlp\n // 0xda = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x84 ++ nonce)\n // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)\n // 0x84 = 0x80 + 0x04 (0x04 = the bytes length of the nonce, 4 bytes, in hex)\n // We assume nobody can have a nonce large enough to require more than 32 bytes.\n return addressFromLast20Bytes(\n keccak256(abi.encodePacked(bytes1(0xda), bytes1(0x94), deployer, bytes1(0x84), uint32(nonce)))\n );\n }\n\n function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer)\n internal\n pure\n virtual\n returns (address)\n {\n return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, initcodeHash)));\n }\n\n /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer\n function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) {\n return computeCreate2Address(salt, initCodeHash, CREATE2_FACTORY);\n }\n\n /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\n function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) {\n return hashInitCode(creationCode, \"\");\n }\n\n /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\n /// @param args the ABI-encoded arguments to the constructor of C\n function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(creationCode, args));\n }\n\n // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses.\n function getTokenBalances(address token, address[] memory addresses)\n internal\n virtual\n returns (uint256[] memory balances)\n {\n uint256 tokenCodeSize;\n assembly {\n tokenCodeSize := extcodesize(token)\n }\n require(tokenCodeSize > 0, \"StdUtils getTokenBalances(address,address[]): Token address is not a contract.\");\n\n // ABI encode the aggregate call to Multicall3.\n uint256 length = addresses.length;\n IMulticall3.Call[] memory calls = new IMulticall3.Call[](length);\n for (uint256 i = 0; i < length; ++i) {\n // 0x70a08231 = bytes4(\"balanceOf(address)\"))\n calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))});\n }\n\n // Make the aggregate call.\n (, bytes[] memory returnData) = multicall.aggregate(calls);\n\n // ABI decode the return data and return the balances.\n balances = new uint256[](length);\n for (uint256 i = 0; i < length; ++i) {\n balances[i] = abi.decode(returnData[i], (uint256));\n }\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n PRIVATE FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) {\n return address(uint160(uint256(bytesValue)));\n }\n\n // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere.\n\n function console2_log(string memory p0, uint256 p1) private view {\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n status;\n }\n\n function console2_log(string memory p0, string memory p1) private view {\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n status;\n }\n}\n" + }, + "forge-std/Test.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\n// 💬 ABOUT\n// Standard Library's default Test\n\n// 🧩 MODULES\nimport {console} from \"./console.sol\";\nimport {console2} from \"./console2.sol\";\nimport {StdAssertions} from \"./StdAssertions.sol\";\nimport {StdChains} from \"./StdChains.sol\";\nimport {StdCheats} from \"./StdCheats.sol\";\nimport {stdError} from \"./StdError.sol\";\nimport {StdInvariant} from \"./StdInvariant.sol\";\nimport {stdJson} from \"./StdJson.sol\";\nimport {stdMath} from \"./StdMath.sol\";\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\nimport {StdUtils} from \"./StdUtils.sol\";\nimport {Vm} from \"./Vm.sol\";\nimport {StdStyle} from \"./StdStyle.sol\";\n\n// 📦 BOILERPLATE\nimport {TestBase} from \"./Base.sol\";\nimport {DSTest} from \"ds-test/test.sol\";\n\n// ⭐️ TEST\nabstract contract Test is DSTest, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils, TestBase {\n// Note: IS_TEST() must return true.\n// Note: Must have failure system, https://github.com/dapphub/ds-test/blob/cd98eff28324bfac652e63a239a60632a761790b/src/test.sol#L39-L76.\n}\n" + }, + "forge-std/Vm.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\n// Cheatcodes are marked as view/pure/none using the following rules:\n// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,\n// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure (you are modifying some state be it the EVM, interpreter, filesystem, etc),\n// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,\n// 3. Otherwise you're `pure`.\n\ninterface VmSafe {\n struct Log {\n bytes32[] topics;\n bytes data;\n address emitter;\n }\n\n struct Rpc {\n string key;\n string url;\n }\n\n struct FsMetadata {\n bool isDir;\n bool isSymlink;\n uint256 length;\n bool readOnly;\n uint256 modified;\n uint256 accessed;\n uint256 created;\n }\n\n // Loads a storage slot from an address\n function load(address target, bytes32 slot) external view returns (bytes32 data);\n // Signs data\n function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);\n // Gets the address for a given private key\n function addr(uint256 privateKey) external pure returns (address keyAddr);\n // Gets the nonce of an account\n function getNonce(address account) external view returns (uint64 nonce);\n // Performs a foreign function call via the terminal\n function ffi(string[] calldata commandInput) external returns (bytes memory result);\n // Sets environment variables\n function setEnv(string calldata name, string calldata value) external;\n // Reads environment variables, (name) => (value)\n function envBool(string calldata name) external view returns (bool value);\n function envUint(string calldata name) external view returns (uint256 value);\n function envInt(string calldata name) external view returns (int256 value);\n function envAddress(string calldata name) external view returns (address value);\n function envBytes32(string calldata name) external view returns (bytes32 value);\n function envString(string calldata name) external view returns (string memory value);\n function envBytes(string calldata name) external view returns (bytes memory value);\n // Reads environment variables as arrays\n function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);\n function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);\n function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);\n function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);\n function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);\n function envString(string calldata name, string calldata delim) external view returns (string[] memory value);\n function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);\n // Read environment variables with default value\n function envOr(string calldata name, bool defaultValue) external returns (bool value);\n function envOr(string calldata name, uint256 defaultValue) external returns (uint256 value);\n function envOr(string calldata name, int256 defaultValue) external returns (int256 value);\n function envOr(string calldata name, address defaultValue) external returns (address value);\n function envOr(string calldata name, bytes32 defaultValue) external returns (bytes32 value);\n function envOr(string calldata name, string calldata defaultValue) external returns (string memory value);\n function envOr(string calldata name, bytes calldata defaultValue) external returns (bytes memory value);\n // Read environment variables as arrays with default value\n function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)\n external\n returns (bool[] memory value);\n function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)\n external\n returns (uint256[] memory value);\n function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)\n external\n returns (int256[] memory value);\n function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)\n external\n returns (address[] memory value);\n function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)\n external\n returns (bytes32[] memory value);\n function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)\n external\n returns (string[] memory value);\n function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)\n external\n returns (bytes[] memory value);\n // Records all storage reads and writes\n function record() external;\n // Gets all accessed reads and write slot from a recording session, for a given address\n function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);\n // Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file\n function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);\n // Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file\n function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);\n // Labels an address in call traces\n function label(address account, string calldata newLabel) external;\n // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain\n function broadcast() external;\n // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain\n function broadcast(address signer) external;\n // Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain\n function broadcast(uint256 privateKey) external;\n // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain\n function startBroadcast() external;\n // Has all subsequent calls (at this call depth only) create transactions with the address provided that can later be signed and sent onchain\n function startBroadcast(address signer) external;\n // Has all subsequent calls (at this call depth only) create transactions with the private key provided that can later be signed and sent onchain\n function startBroadcast(uint256 privateKey) external;\n // Stops collecting onchain transactions\n function stopBroadcast() external;\n // Reads the entire content of file to string\n function readFile(string calldata path) external view returns (string memory data);\n // Reads the entire content of file as binary. Path is relative to the project root.\n function readFileBinary(string calldata path) external view returns (bytes memory data);\n // Get the path of the current project root\n function projectRoot() external view returns (string memory path);\n // Get the metadata for a file/directory\n function fsMetadata(string calldata fileOrDir) external returns (FsMetadata memory metadata);\n // Reads next line of file to string\n function readLine(string calldata path) external view returns (string memory line);\n // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.\n function writeFile(string calldata path, string calldata data) external;\n // Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.\n // Path is relative to the project root.\n function writeFileBinary(string calldata path, bytes calldata data) external;\n // Writes line to file, creating a file if it does not exist.\n function writeLine(string calldata path, string calldata data) external;\n // Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.\n function closeFile(string calldata path) external;\n // Removes file. This cheatcode will revert in the following situations, but is not limited to just these cases:\n // - Path points to a directory.\n // - The file doesn't exist.\n // - The user lacks permissions to remove the file.\n function removeFile(string calldata path) external;\n // Convert values to a string\n function toString(address value) external pure returns (string memory stringifiedValue);\n function toString(bytes calldata value) external pure returns (string memory stringifiedValue);\n function toString(bytes32 value) external pure returns (string memory stringifiedValue);\n function toString(bool value) external pure returns (string memory stringifiedValue);\n function toString(uint256 value) external pure returns (string memory stringifiedValue);\n function toString(int256 value) external pure returns (string memory stringifiedValue);\n // Convert values from a string\n function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);\n function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);\n function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);\n function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);\n function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);\n function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);\n // Record all the transaction logs\n function recordLogs() external;\n // Gets all the recorded logs\n function getRecordedLogs() external returns (Log[] memory logs);\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path m/44'/60'/0'/0/{index}\n function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at {derivationPath}{index}\n function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)\n external\n pure\n returns (uint256 privateKey);\n // Adds a private key to the local forge wallet and returns the address\n function rememberKey(uint256 privateKey) external returns (address keyAddr);\n //\n // parseJson\n //\n // ----\n // In case the returned value is a JSON object, it's encoded as a ABI-encoded tuple. As JSON objects\n // don't have the notion of ordered, but tuples do, they JSON object is encoded with it's fields ordered in\n // ALPHABETICAL order. That means that in order to successfully decode the tuple, we need to define a tuple that\n // encodes the fields in the same order, which is alphabetical. In the case of Solidity structs, they are encoded\n // as tuples, with the attributes in the order in which they are defined.\n // For example: json = { 'a': 1, 'b': 0xa4tb......3xs}\n // a: uint256\n // b: address\n // To decode that json, we need to define a struct or a tuple as follows:\n // struct json = { uint256 a; address b; }\n // If we defined a json struct with the opposite order, meaning placing the address b first, it would try to\n // decode the tuple in that order, and thus fail.\n // ----\n // Given a string of JSON, return it as ABI-encoded\n function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);\n function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);\n\n // The following parseJson cheatcodes will do type coercion, for the type that they indicate.\n // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12'\n // and hex numbers '0xEF'.\n // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not\n // a JSON object.\n function parseJsonUint(string calldata, string calldata) external returns (uint256);\n function parseJsonUintArray(string calldata, string calldata) external returns (uint256[] memory);\n function parseJsonInt(string calldata, string calldata) external returns (int256);\n function parseJsonIntArray(string calldata, string calldata) external returns (int256[] memory);\n function parseJsonBool(string calldata, string calldata) external returns (bool);\n function parseJsonBoolArray(string calldata, string calldata) external returns (bool[] memory);\n function parseJsonAddress(string calldata, string calldata) external returns (address);\n function parseJsonAddressArray(string calldata, string calldata) external returns (address[] memory);\n function parseJsonString(string calldata, string calldata) external returns (string memory);\n function parseJsonStringArray(string calldata, string calldata) external returns (string[] memory);\n function parseJsonBytes(string calldata, string calldata) external returns (bytes memory);\n function parseJsonBytesArray(string calldata, string calldata) external returns (bytes[] memory);\n function parseJsonBytes32(string calldata, string calldata) external returns (bytes32);\n function parseJsonBytes32Array(string calldata, string calldata) external returns (bytes32[] memory);\n\n // Serialize a key and value to a JSON object stored in-memory that can be later written to a file\n // It returns the stringified version of the specific JSON file up to that moment.\n function serializeBool(string calldata objectKey, string calldata valueKey, bool value)\n external\n returns (string memory json);\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)\n external\n returns (string memory json);\n function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)\n external\n returns (string memory json);\n function serializeAddress(string calldata objectKey, string calldata valueKey, address value)\n external\n returns (string memory json);\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)\n external\n returns (string memory json);\n function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)\n external\n returns (string memory json);\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)\n external\n returns (string memory json);\n\n function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)\n external\n returns (string memory json);\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)\n external\n returns (string memory json);\n function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)\n external\n returns (string memory json);\n function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)\n external\n returns (string memory json);\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)\n external\n returns (string memory json);\n function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)\n external\n returns (string memory json);\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)\n external\n returns (string memory json);\n\n //\n // writeJson\n //\n // ----\n // Write a serialized JSON object to a file. If the file exists, it will be overwritten.\n // Let's assume we want to write the following JSON to a file:\n //\n // { \"boolean\": true, \"number\": 342, \"object\": { \"title\": \"finally json serialization\" } }\n //\n // ```\n // string memory json1 = \"some key\";\n // vm.serializeBool(json1, \"boolean\", true);\n // vm.serializeBool(json1, \"number\", uint256(342));\n // json2 = \"some other key\";\n // string memory output = vm.serializeString(json2, \"title\", \"finally json serialization\");\n // string memory finalJson = vm.serialize(json1, \"object\", output);\n // vm.writeJson(finalJson, \"./output/example.json\");\n // ```\n // The critical insight is that every invocation of serialization will return the stringified version of the JSON\n // up to that point. That means we can construct arbitrary JSON objects and then use the return stringified version\n // to serialize them as values to another JSON object.\n //\n // json1 and json2 are simply keys used by the backend to keep track of the objects. So vm.serializeJson(json1,..)\n // will find the object in-memory that is keyed by \"some key\".\n function writeJson(string calldata json, string calldata path) external;\n // Write a serialized JSON object to an **existing** JSON file, replacing a value with key = \n // This is useful to replace a specific value of a JSON file, without having to parse the entire thing\n function writeJson(string calldata json, string calldata path, string calldata valueKey) external;\n // Returns the RPC url for the given alias\n function rpcUrl(string calldata rpcAlias) external view returns (string memory json);\n // Returns all rpc urls and their aliases `[alias, url][]`\n function rpcUrls() external view returns (string[2][] memory urls);\n // Returns all rpc urls and their aliases as structs.\n function rpcUrlStructs() external view returns (Rpc[] memory urls);\n // If the condition is false, discard this run's fuzz inputs and generate new ones.\n function assume(bool condition) external pure;\n // Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.\n function pauseGasMetering() external;\n // Resumes gas metering (i.e. gas usage is counted again). Noop if already on.\n function resumeGasMetering() external;\n}\n\ninterface Vm is VmSafe {\n // Sets block.timestamp\n function warp(uint256 newTimestamp) external;\n // Sets block.height\n function roll(uint256 newHeight) external;\n // Sets block.basefee\n function fee(uint256 newBasefee) external;\n // Sets block.difficulty\n function difficulty(uint256 newDifficulty) external;\n // Sets block.chainid\n function chainId(uint256 newChainId) external;\n // Stores a value to an address' storage slot.\n function store(address target, bytes32 slot, bytes32 value) external;\n // Sets the nonce of an account; must be higher than the current nonce of the account\n function setNonce(address account, uint64 newNonce) external;\n // Sets the *next* call's msg.sender to be the input address\n function prank(address msgSender) external;\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called\n function startPrank(address msgSender) external;\n // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input\n function prank(address msgSender, address txOrigin) external;\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input\n function startPrank(address msgSender, address txOrigin) external;\n // Resets subsequent calls' msg.sender to be `address(this)`\n function stopPrank() external;\n // Sets an address' balance\n function deal(address account, uint256 newBalance) external;\n // Sets an address' code\n function etch(address target, bytes calldata newRuntimeBytecode) external;\n // Expects an error on next call\n function expectRevert(bytes calldata revertData) external;\n function expectRevert(bytes4 revertData) external;\n function expectRevert() external;\n // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).\n // Call this function, then emit an event, then call a function. Internally after the call, we check if\n // logs were emitted in the expected order with the expected topics and data (as specified by the booleans)\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)\n external;\n // Mocks a call to an address, returning specified data.\n // Calldata can either be strict or a partial match, e.g. if you only\n // pass a Solidity selector to the expected calldata, then the entire Solidity\n // function will be mocked.\n function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;\n // Mocks a call to an address with a specific msg.value, returning specified data.\n // Calldata match takes precedence over msg.value in case of ambiguity.\n function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;\n // Clears all mocked calls\n function clearMockedCalls() external;\n // Expects a call to an address with the specified calldata.\n // Calldata can either be a strict or a partial match\n function expectCall(address callee, bytes calldata data) external;\n // Expects a call to an address with the specified msg.value and calldata\n function expectCall(address callee, uint256 msgValue, bytes calldata data) external;\n // Expect a call to an address with the specified msg.value, gas, and calldata.\n function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;\n // Expect a call to an address with the specified msg.value and calldata, and a *minimum* amount of gas.\n function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;\n // Sets block.coinbase\n function coinbase(address newCoinbase) external;\n // Snapshot the current state of the evm.\n // Returns the id of the snapshot that was created.\n // To revert a snapshot use `revertTo`\n function snapshot() external returns (uint256 snapshotId);\n // Revert the state of the EVM to a previous snapshot\n // Takes the snapshot id to revert to.\n // This deletes the snapshot and all snapshots taken after the given snapshot id.\n function revertTo(uint256 snapshotId) external returns (bool success);\n // Creates a new fork with the given endpoint and block and returns the identifier of the fork\n function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\n // Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork\n function createFork(string calldata urlOrAlias) external returns (uint256 forkId);\n // Creates a new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before the transaction,\n // and returns the identifier of the fork\n function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n // Creates _and_ also selects a new fork with the given endpoint and block and returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\n // Creates _and_ also selects new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before\n // the transaction, returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n // Creates _and_ also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);\n // Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.\n function selectFork(uint256 forkId) external;\n /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.\n function activeFork() external view returns (uint256 forkId);\n // Updates the currently active fork to given block number\n // This is similar to `roll` but for the currently active fork\n function rollFork(uint256 blockNumber) external;\n // Updates the currently active fork to given transaction\n // this will `rollFork` with the number of the block the transaction was mined in and replays all transaction mined before it in the block\n function rollFork(bytes32 txHash) external;\n // Updates the given fork to given block number\n function rollFork(uint256 forkId, uint256 blockNumber) external;\n // Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block\n function rollFork(uint256 forkId, bytes32 txHash) external;\n // Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\n // Meaning, changes made to the state of this account will be kept when switching forks\n function makePersistent(address account) external;\n function makePersistent(address account0, address account1) external;\n function makePersistent(address account0, address account1, address account2) external;\n function makePersistent(address[] calldata accounts) external;\n // Revokes persistent status from the address, previously added via `makePersistent`\n function revokePersistent(address account) external;\n function revokePersistent(address[] calldata accounts) external;\n // Returns true if the account is marked as persistent\n function isPersistent(address account) external view returns (bool persistent);\n // In forking mode, explicitly grant the given address cheatcode access\n function allowCheatcodes(address account) external;\n // Fetches the given transaction from the active fork and executes it on the current state\n function transact(bytes32 txHash) external;\n // Fetches the given transaction from the given fork and executes it on the current state\n function transact(uint256 forkId, bytes32 txHash) external;\n}\n" + }, + "ops/interfaces/IResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\nabstract contract Auth {\n event OwnerUpdated(address indexed user, address indexed newOwner);\n\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n address public owner;\n\n Authority public authority;\n\n constructor(address _owner, Authority _authority) {\n owner = _owner;\n authority = _authority;\n\n emit OwnerUpdated(msg.sender, _owner);\n emit AuthorityUpdated(msg.sender, _authority);\n }\n\n modifier requiresAuth() virtual {\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\n\n _;\n }\n\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\n }\n\n function setAuthority(Authority newAuthority) public virtual {\n // We check if the caller is the owner first because we want to ensure they can\n // always swap out the authority even if it's reverting or using up a lot of gas.\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\n\n authority = newAuthority;\n\n emit AuthorityUpdated(msg.sender, newAuthority);\n }\n\n function setOwner(address newOwner) public virtual requiresAuth {\n owner = newOwner;\n\n emit OwnerUpdated(msg.sender, newOwner);\n }\n}\n\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\ninterface Authority {\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n}\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {Auth, Authority} from \"../Auth.sol\";\n\n/// @notice Role based Authority that supports up to 256 roles.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\ncontract RolesAuthority is Auth, Authority {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\n\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\n\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\n\n /*//////////////////////////////////////////////////////////////\n ROLE/USER STORAGE\n //////////////////////////////////////////////////////////////*/\n\n mapping(address => bytes32) public getUserRoles;\n\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\n\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\n\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\n }\n\n function doesRoleHaveCapability(\n uint8 role,\n address target,\n bytes4 functionSig\n ) public view virtual returns (bool) {\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\n }\n\n /*//////////////////////////////////////////////////////////////\n AUTHORIZATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) public view virtual override returns (bool) {\n return\n isCapabilityPublic[target][functionSig] ||\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\n }\n\n /*//////////////////////////////////////////////////////////////\n ROLE CAPABILITY CONFIGURATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setPublicCapability(\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n isCapabilityPublic[target][functionSig] = enabled;\n\n emit PublicCapabilityUpdated(target, functionSig, enabled);\n }\n\n function setRoleCapability(\n uint8 role,\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\n } else {\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\n }\n\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\n }\n\n /*//////////////////////////////////////////////////////////////\n USER ROLE ASSIGNMENT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setUserRole(\n address user,\n uint8 role,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getUserRoles[user] |= bytes32(1 << role);\n } else {\n getUserRoles[user] &= ~bytes32(1 << role);\n }\n\n emit UserRoleUpdated(user, role, enabled);\n }\n}\n" + }, + "solmate/mixins/ERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"../utils/SafeTransferLib.sol\";\nimport {FixedPointMathLib} from \"../utils/FixedPointMathLib.sol\";\n\n/// @notice Minimal ERC4626 tokenized Vault implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\nabstract contract ERC4626 is ERC20 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /*//////////////////////////////////////////////////////////////\n IMMUTABLES\n //////////////////////////////////////////////////////////////*/\n\n ERC20 public immutable asset;\n\n constructor(\n ERC20 _asset,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol, _asset.decimals()) {\n asset = _asset;\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function totalAssets() public view virtual returns (uint256);\n\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\n }\n\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\n }\n\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n return convertToShares(assets);\n }\n\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\n }\n\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\n }\n\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n return convertToAssets(shares);\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf[owner]);\n }\n\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf[owner];\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL HOOKS LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\n}\n" + }, + "solmate/test/utils/mocks/MockERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../../../tokens/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) ERC20(_name, _symbol, _decimals) {}\n\n function mint(address to, uint256 value) public virtual {\n _mint(to, value);\n }\n\n function burn(address from, uint256 value) public virtual {\n _burn(from, value);\n }\n}\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "solmate/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n // Mod x by y. Note this will return\n // 0 instead of reverting if y is zero.\n z := mod(x, y)\n }\n }\n\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n assembly {\n // Divide x by y. Note this will return\n // 0 instead of reverting if y is zero.\n r := div(x, y)\n }\n }\n\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n // Add 1 to x * y if x % y > 0. Note this will\n // return 0 instead of reverting if y is zero.\n z := add(gt(mod(x, y), 0), div(x, y))\n }\n }\n}\n" + }, + "solmate/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Safe unsigned integer casting library that reverts on overflow.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\nlibrary SafeCastLib {\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\n require(x < 1 << 248);\n\n y = uint248(x);\n }\n\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\n require(x < 1 << 224);\n\n y = uint224(x);\n }\n\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\n require(x < 1 << 192);\n\n y = uint192(x);\n }\n\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\n require(x < 1 << 160);\n\n y = uint160(x);\n }\n\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\n require(x < 1 << 128);\n\n y = uint128(x);\n }\n\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\n require(x < 1 << 96);\n\n y = uint96(x);\n }\n\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\n require(x < 1 << 64);\n\n y = uint64(x);\n }\n\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\n require(x < 1 << 32);\n\n y = uint32(x);\n }\n\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\n require(x < 1 << 24);\n\n y = uint24(x);\n }\n\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\n require(x < 1 << 16);\n\n y = uint16(x);\n }\n\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\n require(x < 1 << 8);\n\n y = uint8(x);\n }\n}\n" + }, + "solmate/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n /*//////////////////////////////////////////////////////////////\n ETH OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferETH(address to, uint256 amount) internal {\n bool success;\n\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n require(success, \"ETH_TRANSFER_FAILED\");\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferFrom(\n ERC20 token,\n address from,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FROM_FAILED\");\n }\n\n function safeTransfer(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FAILED\");\n }\n\n function safeApprove(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"APPROVE_FAILED\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/0366741513880e85aaa5abbf67624948.json b/packages/contracts/deployments/base/solcInputs/0366741513880e85aaa5abbf67624948.json new file mode 100644 index 0000000000..be82e98a3d --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/0366741513880e85aaa5abbf67624948.json @@ -0,0 +1,1128 @@ +{ + "language": "Solidity", + "sources": { + "@layerzerolabs/lz-evm-messagelib-v2/contracts/libs/ExecutorOptions.sol": { + "content": "// SPDX-License-Identifier: LZBL-1.2\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport \"@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol\";\r\n\r\nlibrary ExecutorOptions {\r\n using CalldataBytesLib for bytes;\r\n\r\n uint8 internal constant WORKER_ID = 1;\r\n\r\n uint8 internal constant OPTION_TYPE_LZRECEIVE = 1;\r\n uint8 internal constant OPTION_TYPE_NATIVE_DROP = 2;\r\n uint8 internal constant OPTION_TYPE_LZCOMPOSE = 3;\r\n uint8 internal constant OPTION_TYPE_ORDERED_EXECUTION = 4;\r\n uint8 internal constant OPTION_TYPE_LZREAD = 5;\r\n\r\n error Executor_InvalidLzReceiveOption();\r\n error Executor_InvalidNativeDropOption();\r\n error Executor_InvalidLzComposeOption();\r\n error Executor_InvalidLzReadOption();\r\n\r\n /// @dev decode the next executor option from the options starting from the specified cursor\r\n /// @param _options [executor_id][executor_option][executor_id][executor_option]...\r\n /// executor_option = [option_size][option_type][option]\r\n /// option_size = len(option_type) + len(option)\r\n /// executor_id: uint8, option_size: uint16, option_type: uint8, option: bytes\r\n /// @param _cursor the cursor to start decoding from\r\n /// @return optionType the type of the option\r\n /// @return option the option of the executor\r\n /// @return cursor the cursor to start decoding the next executor option\r\n function nextExecutorOption(\r\n bytes calldata _options,\r\n uint256 _cursor\r\n ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) {\r\n unchecked {\r\n // skip worker id\r\n cursor = _cursor + 1;\r\n\r\n // read option size\r\n uint16 size = _options.toU16(cursor);\r\n cursor += 2;\r\n\r\n // read option type\r\n optionType = _options.toU8(cursor);\r\n\r\n // startCursor and endCursor are used to slice the option from _options\r\n uint256 startCursor = cursor + 1; // skip option type\r\n uint256 endCursor = cursor + size;\r\n option = _options[startCursor:endCursor];\r\n cursor += size;\r\n }\r\n }\r\n\r\n function decodeLzReceiveOption(bytes calldata _option) internal pure returns (uint128 gas, uint128 value) {\r\n if (_option.length != 16 && _option.length != 32) revert Executor_InvalidLzReceiveOption();\r\n gas = _option.toU128(0);\r\n value = _option.length == 32 ? _option.toU128(16) : 0;\r\n }\r\n\r\n function decodeNativeDropOption(bytes calldata _option) internal pure returns (uint128 amount, bytes32 receiver) {\r\n if (_option.length != 48) revert Executor_InvalidNativeDropOption();\r\n amount = _option.toU128(0);\r\n receiver = _option.toB32(16);\r\n }\r\n\r\n function decodeLzComposeOption(\r\n bytes calldata _option\r\n ) internal pure returns (uint16 index, uint128 gas, uint128 value) {\r\n if (_option.length != 18 && _option.length != 34) revert Executor_InvalidLzComposeOption();\r\n index = _option.toU16(0);\r\n gas = _option.toU128(2);\r\n value = _option.length == 34 ? _option.toU128(18) : 0;\r\n }\r\n\r\n function decodeLzReadOption(\r\n bytes calldata _option\r\n ) internal pure returns (uint128 gas, uint32 calldataSize, uint128 value) {\r\n if (_option.length != 20 && _option.length != 36) revert Executor_InvalidLzReadOption();\r\n gas = _option.toU128(0);\r\n calldataSize = _option.toU32(16);\r\n value = _option.length == 36 ? _option.toU128(20) : 0;\r\n }\r\n\r\n function encodeLzReceiveOption(uint128 _gas, uint128 _value) internal pure returns (bytes memory) {\r\n return _value == 0 ? abi.encodePacked(_gas) : abi.encodePacked(_gas, _value);\r\n }\r\n\r\n function encodeNativeDropOption(uint128 _amount, bytes32 _receiver) internal pure returns (bytes memory) {\r\n return abi.encodePacked(_amount, _receiver);\r\n }\r\n\r\n function encodeLzComposeOption(uint16 _index, uint128 _gas, uint128 _value) internal pure returns (bytes memory) {\r\n return _value == 0 ? abi.encodePacked(_index, _gas) : abi.encodePacked(_index, _gas, _value);\r\n }\r\n\r\n function encodeLzReadOption(\r\n uint128 _gas,\r\n uint32 _calldataSize,\r\n uint128 _value\r\n ) internal pure returns (bytes memory) {\r\n return _value == 0 ? abi.encodePacked(_gas, _calldataSize) : abi.encodePacked(_gas, _calldataSize, _value);\r\n }\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol": { + "content": "// SPDX-License-Identifier: LZBL-1.2\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport { BytesLib } from \"solidity-bytes-utils/contracts/BytesLib.sol\";\r\n\r\nimport { BitMap256 } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol\";\r\nimport { CalldataBytesLib } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol\";\r\n\r\nlibrary DVNOptions {\r\n using CalldataBytesLib for bytes;\r\n using BytesLib for bytes;\r\n\r\n uint8 internal constant WORKER_ID = 2;\r\n uint8 internal constant OPTION_TYPE_PRECRIME = 1;\r\n\r\n error DVN_InvalidDVNIdx();\r\n error DVN_InvalidDVNOptions(uint256 cursor);\r\n\r\n /// @dev group dvn options by its idx\r\n /// @param _options [dvn_id][dvn_option][dvn_id][dvn_option]...\r\n /// dvn_option = [option_size][dvn_idx][option_type][option]\r\n /// option_size = len(dvn_idx) + len(option_type) + len(option)\r\n /// dvn_id: uint8, dvn_idx: uint8, option_size: uint16, option_type: uint8, option: bytes\r\n /// @return dvnOptions the grouped options, still share the same format of _options\r\n /// @return dvnIndices the dvn indices\r\n function groupDVNOptionsByIdx(\r\n bytes memory _options\r\n ) internal pure returns (bytes[] memory dvnOptions, uint8[] memory dvnIndices) {\r\n if (_options.length == 0) return (dvnOptions, dvnIndices);\r\n\r\n uint8 numDVNs = getNumDVNs(_options);\r\n\r\n // if there is only 1 dvn, we can just return the whole options\r\n if (numDVNs == 1) {\r\n dvnOptions = new bytes[](1);\r\n dvnOptions[0] = _options;\r\n\r\n dvnIndices = new uint8[](1);\r\n dvnIndices[0] = _options.toUint8(3); // dvn idx\r\n return (dvnOptions, dvnIndices);\r\n }\r\n\r\n // otherwise, we need to group the options by dvn_idx\r\n dvnIndices = new uint8[](numDVNs);\r\n dvnOptions = new bytes[](numDVNs);\r\n unchecked {\r\n uint256 cursor = 0;\r\n uint256 start = 0;\r\n uint8 lastDVNIdx = 255; // 255 is an invalid dvn_idx\r\n\r\n while (cursor < _options.length) {\r\n ++cursor; // skip worker_id\r\n\r\n // optionLength asserted in getNumDVNs (skip check)\r\n uint16 optionLength = _options.toUint16(cursor);\r\n cursor += 2;\r\n\r\n // dvnIdx asserted in getNumDVNs (skip check)\r\n uint8 dvnIdx = _options.toUint8(cursor);\r\n\r\n // dvnIdx must equal to the lastDVNIdx for the first option\r\n // so it is always skipped in the first option\r\n // this operation slices out options whenever the scan finds a different lastDVNIdx\r\n if (lastDVNIdx == 255) {\r\n lastDVNIdx = dvnIdx;\r\n } else if (dvnIdx != lastDVNIdx) {\r\n uint256 len = cursor - start - 3; // 3 is for worker_id and option_length\r\n bytes memory opt = _options.slice(start, len);\r\n _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, opt);\r\n\r\n // reset the start and lastDVNIdx\r\n start += len;\r\n lastDVNIdx = dvnIdx;\r\n }\r\n\r\n cursor += optionLength;\r\n }\r\n\r\n // skip check the cursor here because the cursor is asserted in getNumDVNs\r\n // if we have reached the end of the options, we need to process the last dvn\r\n uint256 size = cursor - start;\r\n bytes memory op = _options.slice(start, size);\r\n _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, op);\r\n\r\n // revert dvnIndices to start from 0\r\n for (uint8 i = 0; i < numDVNs; ++i) {\r\n --dvnIndices[i];\r\n }\r\n }\r\n }\r\n\r\n function _insertDVNOptions(\r\n bytes[] memory _dvnOptions,\r\n uint8[] memory _dvnIndices,\r\n uint8 _dvnIdx,\r\n bytes memory _newOptions\r\n ) internal pure {\r\n // dvnIdx starts from 0 but default value of dvnIndices is 0,\r\n // so we tell if the slot is empty by adding 1 to dvnIdx\r\n if (_dvnIdx == 255) revert DVN_InvalidDVNIdx();\r\n uint8 dvnIdxAdj = _dvnIdx + 1;\r\n\r\n for (uint256 j = 0; j < _dvnIndices.length; ++j) {\r\n uint8 index = _dvnIndices[j];\r\n if (dvnIdxAdj == index) {\r\n _dvnOptions[j] = abi.encodePacked(_dvnOptions[j], _newOptions);\r\n break;\r\n } else if (index == 0) {\r\n // empty slot, that means it is the first time we see this dvn\r\n _dvnIndices[j] = dvnIdxAdj;\r\n _dvnOptions[j] = _newOptions;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /// @dev get the number of unique dvns\r\n /// @param _options the format is the same as groupDVNOptionsByIdx\r\n function getNumDVNs(bytes memory _options) internal pure returns (uint8 numDVNs) {\r\n uint256 cursor = 0;\r\n BitMap256 bitmap;\r\n\r\n // find number of unique dvn_idx\r\n unchecked {\r\n while (cursor < _options.length) {\r\n ++cursor; // skip worker_id\r\n\r\n uint16 optionLength = _options.toUint16(cursor);\r\n cursor += 2;\r\n if (optionLength < 2) revert DVN_InvalidDVNOptions(cursor); // at least 1 byte for dvn_idx and 1 byte for option_type\r\n\r\n uint8 dvnIdx = _options.toUint8(cursor);\r\n\r\n // if dvnIdx is not set, increment numDVNs\r\n // max num of dvns is 255, 255 is an invalid dvn_idx\r\n // The order of the dvnIdx is not required to be sequential, as enforcing the order may weaken\r\n // the composability of the options. e.g. if we refrain from enforcing the order, an OApp that has\r\n // already enforced certain options can append additional options to the end of the enforced\r\n // ones without restrictions.\r\n if (dvnIdx == 255) revert DVN_InvalidDVNIdx();\r\n if (!bitmap.get(dvnIdx)) {\r\n ++numDVNs;\r\n bitmap = bitmap.set(dvnIdx);\r\n }\r\n\r\n cursor += optionLength;\r\n }\r\n }\r\n if (cursor != _options.length) revert DVN_InvalidDVNOptions(cursor);\r\n }\r\n\r\n /// @dev decode the next dvn option from _options starting from the specified cursor\r\n /// @param _options the format is the same as groupDVNOptionsByIdx\r\n /// @param _cursor the cursor to start decoding\r\n /// @return optionType the type of the option\r\n /// @return option the option\r\n /// @return cursor the cursor to start decoding the next option\r\n function nextDVNOption(\r\n bytes calldata _options,\r\n uint256 _cursor\r\n ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) {\r\n unchecked {\r\n // skip worker id\r\n cursor = _cursor + 1;\r\n\r\n // read option size\r\n uint16 size = _options.toU16(cursor);\r\n cursor += 2;\r\n\r\n // read option type\r\n optionType = _options.toU8(cursor + 1); // skip dvn_idx\r\n\r\n // startCursor and endCursor are used to slice the option from _options\r\n uint256 startCursor = cursor + 2; // skip option type and dvn_idx\r\n uint256 endCursor = cursor + size;\r\n option = _options[startCursor:endCursor];\r\n cursor += size;\r\n }\r\n }\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0;\r\n\r\nimport { IMessageLibManager } from \"./IMessageLibManager.sol\";\r\nimport { IMessagingComposer } from \"./IMessagingComposer.sol\";\r\nimport { IMessagingChannel } from \"./IMessagingChannel.sol\";\r\nimport { IMessagingContext } from \"./IMessagingContext.sol\";\r\n\r\nstruct MessagingParams {\r\n uint32 dstEid;\r\n bytes32 receiver;\r\n bytes message;\r\n bytes options;\r\n bool payInLzToken;\r\n}\r\n\r\nstruct MessagingReceipt {\r\n bytes32 guid;\r\n uint64 nonce;\r\n MessagingFee fee;\r\n}\r\n\r\nstruct MessagingFee {\r\n uint256 nativeFee;\r\n uint256 lzTokenFee;\r\n}\r\n\r\nstruct Origin {\r\n uint32 srcEid;\r\n bytes32 sender;\r\n uint64 nonce;\r\n}\r\n\r\ninterface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {\r\n event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);\r\n\r\n event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);\r\n\r\n event PacketDelivered(Origin origin, address receiver);\r\n\r\n event LzReceiveAlert(\r\n address indexed receiver,\r\n address indexed executor,\r\n Origin origin,\r\n bytes32 guid,\r\n uint256 gas,\r\n uint256 value,\r\n bytes message,\r\n bytes extraData,\r\n bytes reason\r\n );\r\n\r\n event LzTokenSet(address token);\r\n\r\n event DelegateSet(address sender, address delegate);\r\n\r\n function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);\r\n\r\n function send(\r\n MessagingParams calldata _params,\r\n address _refundAddress\r\n ) external payable returns (MessagingReceipt memory);\r\n\r\n function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;\r\n\r\n function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);\r\n\r\n function initializable(Origin calldata _origin, address _receiver) external view returns (bool);\r\n\r\n function lzReceive(\r\n Origin calldata _origin,\r\n address _receiver,\r\n bytes32 _guid,\r\n bytes calldata _message,\r\n bytes calldata _extraData\r\n ) external payable;\r\n\r\n // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order\r\n function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;\r\n\r\n function setLzToken(address _lzToken) external;\r\n\r\n function lzToken() external view returns (address);\r\n\r\n function nativeToken() external view returns (address);\r\n\r\n function setDelegate(address _delegate) external;\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0;\r\n\r\nimport { Origin } from \"./ILayerZeroEndpointV2.sol\";\r\n\r\ninterface ILayerZeroReceiver {\r\n function allowInitializePath(Origin calldata _origin) external view returns (bool);\r\n\r\n function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);\r\n\r\n function lzReceive(\r\n Origin calldata _origin,\r\n bytes32 _guid,\r\n bytes calldata _message,\r\n address _executor,\r\n bytes calldata _extraData\r\n ) external payable;\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0;\r\n\r\nstruct SetConfigParam {\r\n uint32 eid;\r\n uint32 configType;\r\n bytes config;\r\n}\r\n\r\ninterface IMessageLibManager {\r\n struct Timeout {\r\n address lib;\r\n uint256 expiry;\r\n }\r\n\r\n event LibraryRegistered(address newLib);\r\n event DefaultSendLibrarySet(uint32 eid, address newLib);\r\n event DefaultReceiveLibrarySet(uint32 eid, address newLib);\r\n event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);\r\n event SendLibrarySet(address sender, uint32 eid, address newLib);\r\n event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);\r\n event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);\r\n\r\n function registerLibrary(address _lib) external;\r\n\r\n function isRegisteredLibrary(address _lib) external view returns (bool);\r\n\r\n function getRegisteredLibraries() external view returns (address[] memory);\r\n\r\n function setDefaultSendLibrary(uint32 _eid, address _newLib) external;\r\n\r\n function defaultSendLibrary(uint32 _eid) external view returns (address);\r\n\r\n function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external;\r\n\r\n function defaultReceiveLibrary(uint32 _eid) external view returns (address);\r\n\r\n function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;\r\n\r\n function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);\r\n\r\n function isSupportedEid(uint32 _eid) external view returns (bool);\r\n\r\n function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);\r\n\r\n /// ------------------- OApp interfaces -------------------\r\n function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;\r\n\r\n function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);\r\n\r\n function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);\r\n\r\n function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;\r\n\r\n function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);\r\n\r\n function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external;\r\n\r\n function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);\r\n\r\n function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;\r\n\r\n function getConfig(\r\n address _oapp,\r\n address _lib,\r\n uint32 _eid,\r\n uint32 _configType\r\n ) external view returns (bytes memory config);\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingChannel.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0;\r\n\r\ninterface IMessagingChannel {\r\n event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);\r\n event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);\r\n event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);\r\n\r\n function eid() external view returns (uint32);\r\n\r\n // this is an emergency function if a message cannot be verified for some reasons\r\n // required to provide _nextNonce to avoid race condition\r\n function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;\r\n\r\n function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;\r\n\r\n function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;\r\n\r\n function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);\r\n\r\n function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);\r\n\r\n function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);\r\n\r\n function inboundPayloadHash(\r\n address _receiver,\r\n uint32 _srcEid,\r\n bytes32 _sender,\r\n uint64 _nonce\r\n ) external view returns (bytes32);\r\n\r\n function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingComposer.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0;\r\n\r\ninterface IMessagingComposer {\r\n event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);\r\n event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);\r\n event LzComposeAlert(\r\n address indexed from,\r\n address indexed to,\r\n address indexed executor,\r\n bytes32 guid,\r\n uint16 index,\r\n uint256 gas,\r\n uint256 value,\r\n bytes message,\r\n bytes extraData,\r\n bytes reason\r\n );\r\n\r\n function composeQueue(\r\n address _from,\r\n address _to,\r\n bytes32 _guid,\r\n uint16 _index\r\n ) external view returns (bytes32 messageHash);\r\n\r\n function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;\r\n\r\n function lzCompose(\r\n address _from,\r\n address _to,\r\n bytes32 _guid,\r\n uint16 _index,\r\n bytes calldata _message,\r\n bytes calldata _extraData\r\n ) external payable;\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingContext.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0;\r\n\r\ninterface IMessagingContext {\r\n function isSendingMessage() external view returns (bool);\r\n\r\n function getSendContext() external view returns (uint32 dstEid, address sender);\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol": { + "content": "// SPDX-License-Identifier: LZBL-1.2\r\n\r\npragma solidity ^0.8.20;\r\n\r\nlibrary CalldataBytesLib {\r\n function toU8(bytes calldata _bytes, uint256 _start) internal pure returns (uint8) {\r\n return uint8(_bytes[_start]);\r\n }\r\n\r\n function toU16(bytes calldata _bytes, uint256 _start) internal pure returns (uint16) {\r\n unchecked {\r\n uint256 end = _start + 2;\r\n return uint16(bytes2(_bytes[_start:end]));\r\n }\r\n }\r\n\r\n function toU32(bytes calldata _bytes, uint256 _start) internal pure returns (uint32) {\r\n unchecked {\r\n uint256 end = _start + 4;\r\n return uint32(bytes4(_bytes[_start:end]));\r\n }\r\n }\r\n\r\n function toU64(bytes calldata _bytes, uint256 _start) internal pure returns (uint64) {\r\n unchecked {\r\n uint256 end = _start + 8;\r\n return uint64(bytes8(_bytes[_start:end]));\r\n }\r\n }\r\n\r\n function toU128(bytes calldata _bytes, uint256 _start) internal pure returns (uint128) {\r\n unchecked {\r\n uint256 end = _start + 16;\r\n return uint128(bytes16(_bytes[_start:end]));\r\n }\r\n }\r\n\r\n function toU256(bytes calldata _bytes, uint256 _start) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 end = _start + 32;\r\n return uint256(bytes32(_bytes[_start:end]));\r\n }\r\n }\r\n\r\n function toAddr(bytes calldata _bytes, uint256 _start) internal pure returns (address) {\r\n unchecked {\r\n uint256 end = _start + 20;\r\n return address(bytes20(_bytes[_start:end]));\r\n }\r\n }\r\n\r\n function toB32(bytes calldata _bytes, uint256 _start) internal pure returns (bytes32) {\r\n unchecked {\r\n uint256 end = _start + 32;\r\n return bytes32(_bytes[_start:end]);\r\n }\r\n }\r\n}\r\n" + }, + "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\n// modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/BitMaps.sol\r\npragma solidity ^0.8.20;\r\n\r\ntype BitMap256 is uint256;\r\n\r\nusing BitMaps for BitMap256 global;\r\n\r\nlibrary BitMaps {\r\n /**\r\n * @dev Returns whether the bit at `index` is set.\r\n */\r\n function get(BitMap256 bitmap, uint8 index) internal pure returns (bool) {\r\n uint256 mask = 1 << index;\r\n return BitMap256.unwrap(bitmap) & mask != 0;\r\n }\r\n\r\n /**\r\n * @dev Sets the bit at `index`.\r\n */\r\n function set(BitMap256 bitmap, uint8 index) internal pure returns (BitMap256) {\r\n uint256 mask = 1 << index;\r\n return BitMap256.wrap(BitMap256.unwrap(bitmap) | mask);\r\n }\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppCore.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport { ILayerZeroEndpointV2 } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol\";\r\n\r\n/**\r\n * @title IOAppCore\r\n */\r\ninterface IOAppCore {\r\n // Custom error messages\r\n error OnlyPeer(uint32 eid, bytes32 sender);\r\n error NoPeer(uint32 eid);\r\n error InvalidEndpointCall();\r\n error InvalidDelegate();\r\n\r\n // Event emitted when a peer (OApp) is set for a corresponding endpoint\r\n event PeerSet(uint32 eid, bytes32 peer);\r\n\r\n /**\r\n * @notice Retrieves the OApp version information.\r\n * @return senderVersion The version of the OAppSender.sol contract.\r\n * @return receiverVersion The version of the OAppReceiver.sol contract.\r\n */\r\n function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);\r\n\r\n /**\r\n * @notice Retrieves the LayerZero endpoint associated with the OApp.\r\n * @return iEndpoint The LayerZero endpoint as an interface.\r\n */\r\n function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);\r\n\r\n /**\r\n * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.\r\n * @param _eid The endpoint ID.\r\n * @return peer The peer address (OApp instance) associated with the corresponding endpoint.\r\n */\r\n function peers(uint32 _eid) external view returns (bytes32 peer);\r\n\r\n /**\r\n * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\r\n * @param _eid The endpoint ID.\r\n * @param _peer The address of the peer to be associated with the corresponding endpoint.\r\n */\r\n function setPeer(uint32 _eid, bytes32 _peer) external;\r\n\r\n /**\r\n * @notice Sets the delegate address for the OApp Core.\r\n * @param _delegate The address of the delegate to be set.\r\n */\r\n function setDelegate(address _delegate) external;\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport { ILayerZeroReceiver, Origin } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol\";\r\n\r\ninterface IOAppReceiver is ILayerZeroReceiver {\r\n /**\r\n * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.\r\n * @param _origin The origin information containing the source endpoint and sender address.\r\n * - srcEid: The source chain endpoint ID.\r\n * - sender: The sender address on the src chain.\r\n * - nonce: The nonce of the message.\r\n * @param _message The lzReceive payload.\r\n * @param _sender The sender address.\r\n * @return isSender Is a valid sender.\r\n *\r\n * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.\r\n * @dev The default sender IS the OAppReceiver implementer.\r\n */\r\n function isComposeMsgSender(\r\n Origin calldata _origin,\r\n bytes calldata _message,\r\n address _sender\r\n ) external view returns (bool isSender);\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport { BytesLib } from \"solidity-bytes-utils/contracts/BytesLib.sol\";\r\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\r\n\r\nimport { ExecutorOptions } from \"@layerzerolabs/lz-evm-messagelib-v2/contracts/libs/ExecutorOptions.sol\";\r\nimport { DVNOptions } from \"@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol\";\r\n\r\n/**\r\n * @title OptionsBuilder\r\n * @dev Library for building and encoding various message options.\r\n */\r\nlibrary OptionsBuilder {\r\n using SafeCast for uint256;\r\n using BytesLib for bytes;\r\n\r\n // Constants for options types\r\n uint16 internal constant TYPE_1 = 1; // legacy options type 1\r\n uint16 internal constant TYPE_2 = 2; // legacy options type 2\r\n uint16 internal constant TYPE_3 = 3;\r\n\r\n // Custom error message\r\n error InvalidSize(uint256 max, uint256 actual);\r\n error InvalidOptionType(uint16 optionType);\r\n\r\n // Modifier to ensure only options of type 3 are used\r\n modifier onlyType3(bytes memory _options) {\r\n if (_options.toUint16(0) != TYPE_3) revert InvalidOptionType(_options.toUint16(0));\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Creates a new options container with type 3.\r\n * @return options The newly created options container.\r\n */\r\n function newOptions() internal pure returns (bytes memory) {\r\n return abi.encodePacked(TYPE_3);\r\n }\r\n\r\n /**\r\n * @dev Adds an executor LZ receive option to the existing options.\r\n * @param _options The existing options container.\r\n * @param _gas The gasLimit used on the lzReceive() function in the OApp.\r\n * @param _value The msg.value passed to the lzReceive() function in the OApp.\r\n * @return options The updated options container.\r\n *\r\n * @dev When multiples of this option are added, they are summed by the executor\r\n * eg. if (_gas: 200k, and _value: 1 ether) AND (_gas: 100k, _value: 0.5 ether) are sent in an option to the LayerZeroEndpoint,\r\n * that becomes (300k, 1.5 ether) when the message is executed on the remote lzReceive() function.\r\n */\r\n function addExecutorLzReceiveOption(\r\n bytes memory _options,\r\n uint128 _gas,\r\n uint128 _value\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n bytes memory option = ExecutorOptions.encodeLzReceiveOption(_gas, _value);\r\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZRECEIVE, option);\r\n }\r\n\r\n /**\r\n * @dev Adds an executor native drop option to the existing options.\r\n * @param _options The existing options container.\r\n * @param _amount The amount for the native value that is airdropped to the 'receiver'.\r\n * @param _receiver The receiver address for the native drop option.\r\n * @return options The updated options container.\r\n *\r\n * @dev When multiples of this option are added, they are summed by the executor on the remote chain.\r\n */\r\n function addExecutorNativeDropOption(\r\n bytes memory _options,\r\n uint128 _amount,\r\n bytes32 _receiver\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n bytes memory option = ExecutorOptions.encodeNativeDropOption(_amount, _receiver);\r\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_NATIVE_DROP, option);\r\n }\r\n\r\n // /**\r\n // * @dev Adds an executor native drop option to the existing options.\r\n // * @param _options The existing options container.\r\n // * @param _amount The amount for the native value that is airdropped to the 'receiver'.\r\n // * @param _receiver The receiver address for the native drop option.\r\n // * @return options The updated options container.\r\n // *\r\n // * @dev When multiples of this option are added, they are summed by the executor on the remote chain.\r\n // */\r\n function addExecutorLzReadOption(\r\n bytes memory _options,\r\n uint128 _gas,\r\n uint32 _size,\r\n uint128 _value\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n bytes memory option = ExecutorOptions.encodeLzReadOption(_gas, _size, _value);\r\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZREAD, option);\r\n }\r\n\r\n /**\r\n * @dev Adds an executor LZ compose option to the existing options.\r\n * @param _options The existing options container.\r\n * @param _index The index for the lzCompose() function call.\r\n * @param _gas The gasLimit for the lzCompose() function call.\r\n * @param _value The msg.value for the lzCompose() function call.\r\n * @return options The updated options container.\r\n *\r\n * @dev When multiples of this option are added, they are summed PER index by the executor on the remote chain.\r\n * @dev If the OApp sends N lzCompose calls on the remote, you must provide N incremented indexes starting with 0.\r\n * ie. When your remote OApp composes (N = 3) messages, you must set this option for index 0,1,2\r\n */\r\n function addExecutorLzComposeOption(\r\n bytes memory _options,\r\n uint16 _index,\r\n uint128 _gas,\r\n uint128 _value\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n bytes memory option = ExecutorOptions.encodeLzComposeOption(_index, _gas, _value);\r\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZCOMPOSE, option);\r\n }\r\n\r\n /**\r\n * @dev Adds an executor ordered execution option to the existing options.\r\n * @param _options The existing options container.\r\n * @return options The updated options container.\r\n */\r\n function addExecutorOrderedExecutionOption(\r\n bytes memory _options\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_ORDERED_EXECUTION, bytes(\"\"));\r\n }\r\n\r\n /**\r\n * @dev Adds a DVN pre-crime option to the existing options.\r\n * @param _options The existing options container.\r\n * @param _dvnIdx The DVN index for the pre-crime option.\r\n * @return options The updated options container.\r\n */\r\n function addDVNPreCrimeOption(\r\n bytes memory _options,\r\n uint8 _dvnIdx\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n return addDVNOption(_options, _dvnIdx, DVNOptions.OPTION_TYPE_PRECRIME, bytes(\"\"));\r\n }\r\n\r\n /**\r\n * @dev Adds an executor option to the existing options.\r\n * @param _options The existing options container.\r\n * @param _optionType The type of the executor option.\r\n * @param _option The encoded data for the executor option.\r\n * @return options The updated options container.\r\n */\r\n function addExecutorOption(\r\n bytes memory _options,\r\n uint8 _optionType,\r\n bytes memory _option\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n return\r\n abi.encodePacked(\r\n _options,\r\n ExecutorOptions.WORKER_ID,\r\n _option.length.toUint16() + 1, // +1 for optionType\r\n _optionType,\r\n _option\r\n );\r\n }\r\n\r\n /**\r\n * @dev Adds a DVN option to the existing options.\r\n * @param _options The existing options container.\r\n * @param _dvnIdx The DVN index for the DVN option.\r\n * @param _optionType The type of the DVN option.\r\n * @param _option The encoded data for the DVN option.\r\n * @return options The updated options container.\r\n */\r\n function addDVNOption(\r\n bytes memory _options,\r\n uint8 _dvnIdx,\r\n uint8 _optionType,\r\n bytes memory _option\r\n ) internal pure onlyType3(_options) returns (bytes memory) {\r\n return\r\n abi.encodePacked(\r\n _options,\r\n DVNOptions.WORKER_ID,\r\n _option.length.toUint16() + 2, // +2 for optionType and dvnIdx\r\n _dvnIdx,\r\n _optionType,\r\n _option\r\n );\r\n }\r\n\r\n /**\r\n * @dev Encodes legacy options of type 1.\r\n * @param _executionGas The gasLimit value passed to lzReceive().\r\n * @return legacyOptions The encoded legacy options.\r\n */\r\n function encodeLegacyOptionsType1(uint256 _executionGas) internal pure returns (bytes memory) {\r\n if (_executionGas > type(uint128).max) revert InvalidSize(type(uint128).max, _executionGas);\r\n return abi.encodePacked(TYPE_1, _executionGas);\r\n }\r\n\r\n /**\r\n * @dev Encodes legacy options of type 2.\r\n * @param _executionGas The gasLimit value passed to lzReceive().\r\n * @param _nativeForDst The amount of native air dropped to the receiver.\r\n * @param _receiver The _nativeForDst receiver address.\r\n * @return legacyOptions The encoded legacy options of type 2.\r\n */\r\n function encodeLegacyOptionsType2(\r\n uint256 _executionGas,\r\n uint256 _nativeForDst,\r\n bytes memory _receiver // @dev Use bytes instead of bytes32 in legacy type 2 for _receiver.\r\n ) internal pure returns (bytes memory) {\r\n if (_executionGas > type(uint128).max) revert InvalidSize(type(uint128).max, _executionGas);\r\n if (_nativeForDst > type(uint128).max) revert InvalidSize(type(uint128).max, _nativeForDst);\r\n if (_receiver.length > 32) revert InvalidSize(32, _receiver.length);\r\n return abi.encodePacked(TYPE_2, _executionGas, _nativeForDst, _receiver);\r\n }\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/OApp.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.20;\r\n\r\n// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers\r\n// solhint-disable-next-line no-unused-import\r\nimport { OAppSender, MessagingFee, MessagingReceipt } from \"./OAppSender.sol\";\r\n// @dev Import the 'Origin' so it's exposed to OApp implementers\r\n// solhint-disable-next-line no-unused-import\r\nimport { OAppReceiver, Origin } from \"./OAppReceiver.sol\";\r\nimport { OAppCore } from \"./OAppCore.sol\";\r\n\r\n/**\r\n * @title OApp\r\n * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.\r\n */\r\nabstract contract OApp is OAppSender, OAppReceiver {\r\n /**\r\n * @dev Constructor to initialize the OApp with the provided endpoint and owner.\r\n * @param _endpoint The address of the LOCAL LayerZero endpoint.\r\n * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\r\n */\r\n constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {}\r\n\r\n /**\r\n * @notice Retrieves the OApp version information.\r\n * @return senderVersion The version of the OAppSender.sol implementation.\r\n * @return receiverVersion The version of the OAppReceiver.sol implementation.\r\n */\r\n function oAppVersion()\r\n public\r\n pure\r\n virtual\r\n override(OAppSender, OAppReceiver)\r\n returns (uint64 senderVersion, uint64 receiverVersion)\r\n {\r\n return (SENDER_VERSION, RECEIVER_VERSION);\r\n }\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/OAppCore.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport { IOAppCore, ILayerZeroEndpointV2 } from \"./interfaces/IOAppCore.sol\";\r\n\r\n/**\r\n * @title OAppCore\r\n * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.\r\n */\r\nabstract contract OAppCore is IOAppCore, Ownable {\r\n // The LayerZero endpoint associated with the given OApp\r\n ILayerZeroEndpointV2 public immutable endpoint;\r\n\r\n // Mapping to store peers associated with corresponding endpoints\r\n mapping(uint32 eid => bytes32 peer) public peers;\r\n\r\n /**\r\n * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.\r\n * @param _endpoint The address of the LOCAL Layer Zero endpoint.\r\n * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\r\n *\r\n * @dev The delegate typically should be set as the owner of the contract.\r\n */\r\n constructor(address _endpoint, address _delegate) {\r\n endpoint = ILayerZeroEndpointV2(_endpoint);\r\n\r\n if (_delegate == address(0)) revert InvalidDelegate();\r\n endpoint.setDelegate(_delegate);\r\n }\r\n\r\n /**\r\n * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\r\n * @param _eid The endpoint ID.\r\n * @param _peer The address of the peer to be associated with the corresponding endpoint.\r\n *\r\n * @dev Only the owner/admin of the OApp can call this function.\r\n * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.\r\n * @dev Set this to bytes32(0) to remove the peer address.\r\n * @dev Peer is a bytes32 to accommodate non-evm chains.\r\n */\r\n function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {\r\n _setPeer(_eid, _peer);\r\n }\r\n\r\n /**\r\n * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\r\n * @param _eid The endpoint ID.\r\n * @param _peer The address of the peer to be associated with the corresponding endpoint.\r\n *\r\n * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.\r\n * @dev Set this to bytes32(0) to remove the peer address.\r\n * @dev Peer is a bytes32 to accommodate non-evm chains.\r\n */\r\n function _setPeer(uint32 _eid, bytes32 _peer) internal virtual {\r\n peers[_eid] = _peer;\r\n emit PeerSet(_eid, _peer);\r\n }\r\n\r\n /**\r\n * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.\r\n * ie. the peer is set to bytes32(0).\r\n * @param _eid The endpoint ID.\r\n * @return peer The address of the peer associated with the specified endpoint.\r\n */\r\n function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {\r\n bytes32 peer = peers[_eid];\r\n if (peer == bytes32(0)) revert NoPeer(_eid);\r\n return peer;\r\n }\r\n\r\n /**\r\n * @notice Sets the delegate address for the OApp.\r\n * @param _delegate The address of the delegate to be set.\r\n *\r\n * @dev Only the owner/admin of the OApp can call this function.\r\n * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.\r\n */\r\n function setDelegate(address _delegate) public onlyOwner {\r\n endpoint.setDelegate(_delegate);\r\n }\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/OAppReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport { IOAppReceiver, Origin } from \"./interfaces/IOAppReceiver.sol\";\r\nimport { OAppCore } from \"./OAppCore.sol\";\r\n\r\n/**\r\n * @title OAppReceiver\r\n * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.\r\n */\r\nabstract contract OAppReceiver is IOAppReceiver, OAppCore {\r\n // Custom error message for when the caller is not the registered endpoint/\r\n error OnlyEndpoint(address addr);\r\n\r\n // @dev The version of the OAppReceiver implementation.\r\n // @dev Version is bumped when changes are made to this contract.\r\n uint64 internal constant RECEIVER_VERSION = 2;\r\n\r\n /**\r\n * @notice Retrieves the OApp version information.\r\n * @return senderVersion The version of the OAppSender.sol contract.\r\n * @return receiverVersion The version of the OAppReceiver.sol contract.\r\n *\r\n * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.\r\n * ie. this is a RECEIVE only OApp.\r\n * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.\r\n */\r\n function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\r\n return (0, RECEIVER_VERSION);\r\n }\r\n\r\n /**\r\n * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.\r\n * @dev _origin The origin information containing the source endpoint and sender address.\r\n * - srcEid: The source chain endpoint ID.\r\n * - sender: The sender address on the src chain.\r\n * - nonce: The nonce of the message.\r\n * @dev _message The lzReceive payload.\r\n * @param _sender The sender address.\r\n * @return isSender Is a valid sender.\r\n *\r\n * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.\r\n * @dev The default sender IS the OAppReceiver implementer.\r\n */\r\n function isComposeMsgSender(\r\n Origin calldata /*_origin*/,\r\n bytes calldata /*_message*/,\r\n address _sender\r\n ) public view virtual returns (bool) {\r\n return _sender == address(this);\r\n }\r\n\r\n /**\r\n * @notice Checks if the path initialization is allowed based on the provided origin.\r\n * @param origin The origin information containing the source endpoint and sender address.\r\n * @return Whether the path has been initialized.\r\n *\r\n * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.\r\n * @dev This defaults to assuming if a peer has been set, its initialized.\r\n * Can be overridden by the OApp if there is other logic to determine this.\r\n */\r\n function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {\r\n return peers[origin.srcEid] == origin.sender;\r\n }\r\n\r\n /**\r\n * @notice Retrieves the next nonce for a given source endpoint and sender address.\r\n * @dev _srcEid The source endpoint ID.\r\n * @dev _sender The sender address.\r\n * @return nonce The next nonce.\r\n *\r\n * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.\r\n * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.\r\n * @dev This is also enforced by the OApp.\r\n * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.\r\n */\r\n function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {\r\n return 0;\r\n }\r\n\r\n /**\r\n * @dev Entry point for receiving messages or packets from the endpoint.\r\n * @param _origin The origin information containing the source endpoint and sender address.\r\n * - srcEid: The source chain endpoint ID.\r\n * - sender: The sender address on the src chain.\r\n * - nonce: The nonce of the message.\r\n * @param _guid The unique identifier for the received LayerZero message.\r\n * @param _message The payload of the received message.\r\n * @param _executor The address of the executor for the received message.\r\n * @param _extraData Additional arbitrary data provided by the corresponding executor.\r\n *\r\n * @dev Entry point for receiving msg/packet from the LayerZero endpoint.\r\n */\r\n function lzReceive(\r\n Origin calldata _origin,\r\n bytes32 _guid,\r\n bytes calldata _message,\r\n address _executor,\r\n bytes calldata _extraData\r\n ) public payable virtual {\r\n // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.\r\n if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);\r\n\r\n // Ensure that the sender matches the expected peer for the source endpoint.\r\n if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);\r\n\r\n // Call the internal OApp implementation of lzReceive.\r\n _lzReceive(_origin, _guid, _message, _executor, _extraData);\r\n }\r\n\r\n /**\r\n * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.\r\n */\r\n function _lzReceive(\r\n Origin calldata _origin,\r\n bytes32 _guid,\r\n bytes calldata _message,\r\n address _executor,\r\n bytes calldata _extraData\r\n ) internal virtual;\r\n}\r\n" + }, + "@layerzerolabs/oapp-evm/contracts/oapp/OAppSender.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.20;\r\n\r\nimport { SafeERC20, IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { MessagingParams, MessagingFee, MessagingReceipt } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol\";\r\nimport { OAppCore } from \"./OAppCore.sol\";\r\n\r\n/**\r\n * @title OAppSender\r\n * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.\r\n */\r\nabstract contract OAppSender is OAppCore {\r\n using SafeERC20 for IERC20;\r\n\r\n // Custom error messages\r\n error NotEnoughNative(uint256 msgValue);\r\n error LzTokenUnavailable();\r\n\r\n // @dev The version of the OAppSender implementation.\r\n // @dev Version is bumped when changes are made to this contract.\r\n uint64 internal constant SENDER_VERSION = 1;\r\n\r\n /**\r\n * @notice Retrieves the OApp version information.\r\n * @return senderVersion The version of the OAppSender.sol contract.\r\n * @return receiverVersion The version of the OAppReceiver.sol contract.\r\n *\r\n * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.\r\n * ie. this is a SEND only OApp.\r\n * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions\r\n */\r\n function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\r\n return (SENDER_VERSION, 0);\r\n }\r\n\r\n /**\r\n * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.\r\n * @param _dstEid The destination endpoint ID.\r\n * @param _message The message payload.\r\n * @param _options Additional options for the message.\r\n * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.\r\n * @return fee The calculated MessagingFee for the message.\r\n * - nativeFee: The native fee for the message.\r\n * - lzTokenFee: The LZ token fee for the message.\r\n */\r\n function _quote(\r\n uint32 _dstEid,\r\n bytes memory _message,\r\n bytes memory _options,\r\n bool _payInLzToken\r\n ) internal view virtual returns (MessagingFee memory fee) {\r\n return\r\n endpoint.quote(\r\n MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),\r\n address(this)\r\n );\r\n }\r\n\r\n /**\r\n * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.\r\n * @param _dstEid The destination endpoint ID.\r\n * @param _message The message payload.\r\n * @param _options Additional options for the message.\r\n * @param _fee The calculated LayerZero fee for the message.\r\n * - nativeFee: The native fee.\r\n * - lzTokenFee: The lzToken fee.\r\n * @param _refundAddress The address to receive any excess fee values sent to the endpoint.\r\n * @return receipt The receipt for the sent message.\r\n * - guid: The unique identifier for the sent message.\r\n * - nonce: The nonce of the sent message.\r\n * - fee: The LayerZero fee incurred for the message.\r\n */\r\n function _lzSend(\r\n uint32 _dstEid,\r\n bytes memory _message,\r\n bytes memory _options,\r\n MessagingFee memory _fee,\r\n address _refundAddress\r\n ) internal virtual returns (MessagingReceipt memory receipt) {\r\n // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.\r\n uint256 messageValue = _payNative(_fee.nativeFee);\r\n if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);\r\n\r\n return\r\n // solhint-disable-next-line check-send-result\r\n endpoint.send{ value: messageValue }(\r\n MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),\r\n _refundAddress\r\n );\r\n }\r\n\r\n /**\r\n * @dev Internal function to pay the native fee associated with the message.\r\n * @param _nativeFee The native fee to be paid.\r\n * @return nativeFee The amount of native currency paid.\r\n *\r\n * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,\r\n * this will need to be overridden because msg.value would contain multiple lzFees.\r\n * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.\r\n * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.\r\n * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.\r\n */\r\n function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {\r\n if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);\r\n return _nativeFee;\r\n }\r\n\r\n /**\r\n * @dev Internal function to pay the LZ token fee associated with the message.\r\n * @param _lzTokenFee The LZ token fee to be paid.\r\n *\r\n * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.\r\n * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().\r\n */\r\n function _payLzToken(uint256 _lzTokenFee) internal virtual {\r\n // @dev Cannot cache the token because it is not immutable in the endpoint.\r\n address lzToken = endpoint.lzToken();\r\n if (lzToken == address(0)) revert LzTokenUnavailable();\r\n\r\n // Pay LZ token fee by sending tokens to the endpoint.\r\n IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./OwnableUpgradeable.sol\";\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership} and {acceptOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available all functions\r\n * from parent (Ownable).\r\n */\r\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\r\n function __Ownable2Step_init() internal onlyInitializing {\r\n __Ownable_init_unchained();\r\n }\r\n\r\n function __Ownable2Step_init_unchained() internal onlyInitializing {\r\n }\r\n address private _pendingOwner;\r\n\r\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Returns the address of the pending owner.\r\n */\r\n function pendingOwner() public view virtual returns (address) {\r\n return _pendingOwner;\r\n }\r\n\r\n /**\r\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual override onlyOwner {\r\n _pendingOwner = newOwner;\r\n emit OwnershipTransferStarted(owner(), newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual override {\r\n delete _pendingOwner;\r\n super._transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev The new owner accepts the ownership transfer.\r\n */\r\n function acceptOwnership() external {\r\n address sender = _msgSender();\r\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\r\n _transferOwnership(sender);\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../utils/ContextUpgradeable.sol\";\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n function __Ownable_init() internal onlyInitializing {\r\n __Ownable_init_unchained();\r\n }\r\n\r\n function __Ownable_init_unchained() internal onlyInitializing {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n _checkOwner();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if the sender is not the owner.\r\n */\r\n function _checkOwner() internal view virtual {\r\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions anymore. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby removing any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/interfaces/IERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"../token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\r\n\r\n/**\r\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\r\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\r\n *\r\n * _Available since v4.7._\r\n */\r\ninterface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {\r\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\r\n\r\n event Withdraw(\r\n address indexed sender,\r\n address indexed receiver,\r\n address indexed owner,\r\n uint256 assets,\r\n uint256 shares\r\n );\r\n\r\n /**\r\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\r\n *\r\n * - MUST be an ERC-20 token contract.\r\n * - MUST NOT revert.\r\n */\r\n function asset() external view returns (address assetTokenAddress);\r\n\r\n /**\r\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\r\n *\r\n * - SHOULD include any compounding that occurs from yield.\r\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\r\n * - MUST NOT revert.\r\n */\r\n function totalAssets() external view returns (uint256 totalManagedAssets);\r\n\r\n /**\r\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\r\n * scenario where all the conditions are met.\r\n *\r\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\r\n * - MUST NOT show any variations depending on the caller.\r\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\r\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\r\n * from.\r\n */\r\n function convertToShares(uint256 assets) external view returns (uint256 shares);\r\n\r\n /**\r\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\r\n * scenario where all the conditions are met.\r\n *\r\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\r\n * - MUST NOT show any variations depending on the caller.\r\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\r\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\r\n * from.\r\n */\r\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\r\n\r\n /**\r\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\r\n * through a deposit call.\r\n *\r\n * - MUST return a limited value if receiver is subject to some deposit limit.\r\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\r\n * - MUST NOT revert.\r\n */\r\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\r\n * current on-chain conditions.\r\n *\r\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\r\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\r\n * in the same transaction.\r\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\r\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\r\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\r\n */\r\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\r\n\r\n /**\r\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\r\n *\r\n * - MUST emit the Deposit event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\r\n * deposit execution, and are accounted for during deposit.\r\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\r\n * approving enough underlying tokens to the Vault contract, etc).\r\n *\r\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\r\n */\r\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\r\n\r\n /**\r\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\r\n * - MUST return a limited value if receiver is subject to some mint limit.\r\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\r\n * - MUST NOT revert.\r\n */\r\n function maxMint(address receiver) external view returns (uint256 maxShares);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\r\n * current on-chain conditions.\r\n *\r\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\r\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\r\n * same transaction.\r\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\r\n * would be accepted, regardless if the user has enough tokens approved, etc.\r\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\r\n */\r\n function previewMint(uint256 shares) external view returns (uint256 assets);\r\n\r\n /**\r\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\r\n *\r\n * - MUST emit the Deposit event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\r\n * execution, and are accounted for during mint.\r\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\r\n * approving enough underlying tokens to the Vault contract, etc).\r\n *\r\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\r\n */\r\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\r\n\r\n /**\r\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\r\n * Vault, through a withdraw call.\r\n *\r\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\r\n * - MUST NOT revert.\r\n */\r\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\r\n * given current on-chain conditions.\r\n *\r\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\r\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\r\n * called\r\n * in the same transaction.\r\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\r\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\r\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\r\n */\r\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\r\n\r\n /**\r\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\r\n *\r\n * - MUST emit the Withdraw event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\r\n * withdraw execution, and are accounted for during withdraw.\r\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\r\n * not having enough shares, etc).\r\n *\r\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\r\n * Those methods should be performed separately.\r\n */\r\n function withdraw(\r\n uint256 assets,\r\n address receiver,\r\n address owner\r\n ) external returns (uint256 shares);\r\n\r\n /**\r\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\r\n * through a redeem call.\r\n *\r\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\r\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\r\n * - MUST NOT revert.\r\n */\r\n function maxRedeem(address owner) external view returns (uint256 maxShares);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\r\n * given current on-chain conditions.\r\n *\r\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\r\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\r\n * same transaction.\r\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\r\n * redemption would be accepted, regardless if the user has enough shares, etc.\r\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\r\n */\r\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\r\n\r\n /**\r\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\r\n *\r\n * - MUST emit the Withdraw event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\r\n * redeem execution, and are accounted for during redeem.\r\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\r\n * not having enough shares, etc).\r\n *\r\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\r\n * Those methods should be performed separately.\r\n */\r\n function redeem(\r\n uint256 shares,\r\n address receiver,\r\n address owner\r\n ) external returns (uint256 assets);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\r\n * deploying minimal proxy contracts, also known as \"clones\".\r\n *\r\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\r\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\r\n *\r\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\r\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\r\n * deterministic method.\r\n *\r\n * _Available since v3.4._\r\n */\r\nlibrary ClonesUpgradeable {\r\n /**\r\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\r\n *\r\n * This function uses the create opcode, which should never revert.\r\n */\r\n function clone(address implementation) internal returns (address instance) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\r\n // of the `implementation` address with the bytecode before the address.\r\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\r\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\r\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\r\n instance := create(0, 0x09, 0x37)\r\n }\r\n require(instance != address(0), \"ERC1167: create failed\");\r\n }\r\n\r\n /**\r\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\r\n *\r\n * This function uses the create2 opcode and a `salt` to deterministically deploy\r\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\r\n * the clones cannot be deployed twice at the same address.\r\n */\r\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\r\n // of the `implementation` address with the bytecode before the address.\r\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\r\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\r\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\r\n instance := create2(0, 0x09, 0x37, salt)\r\n }\r\n require(instance != address(0), \"ERC1167: create2 failed\");\r\n }\r\n\r\n /**\r\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\r\n */\r\n function predictDeterministicAddress(\r\n address implementation,\r\n bytes32 salt,\r\n address deployer\r\n ) internal pure returns (address predicted) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let ptr := mload(0x40)\r\n mstore(add(ptr, 0x38), deployer)\r\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\r\n mstore(add(ptr, 0x14), implementation)\r\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\r\n mstore(add(ptr, 0x58), salt)\r\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\r\n predicted := keccak256(add(ptr, 0x43), 0x55)\r\n }\r\n }\r\n\r\n /**\r\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\r\n */\r\n function predictDeterministicAddress(address implementation, bytes32 salt)\r\n internal\r\n view\r\n returns (address predicted)\r\n {\r\n return predictDeterministicAddress(implementation, salt, address(this));\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"../../utils/AddressUpgradeable.sol\";\r\n\r\n/**\r\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\r\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\r\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\r\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\r\n *\r\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\r\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\r\n * case an upgrade adds a module that needs to be initialized.\r\n *\r\n * For example:\r\n *\r\n * [.hljs-theme-light.nopadding]\r\n * ```\r\n * contract MyToken is ERC20Upgradeable {\r\n * function initialize() initializer public {\r\n * __ERC20_init(\"MyToken\", \"MTK\");\r\n * }\r\n * }\r\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\r\n * function initializeV2() reinitializer(2) public {\r\n * __ERC20Permit_init(\"MyToken\");\r\n * }\r\n * }\r\n * ```\r\n *\r\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\r\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\r\n *\r\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\r\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\r\n *\r\n * [CAUTION]\r\n * ====\r\n * Avoid leaving a contract uninitialized.\r\n *\r\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\r\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\r\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\r\n *\r\n * [.hljs-theme-light.nopadding]\r\n * ```\r\n * /// @custom:oz-upgrades-unsafe-allow constructor\r\n * constructor() {\r\n * _disableInitializers();\r\n * }\r\n * ```\r\n * ====\r\n */\r\nabstract contract Initializable {\r\n /**\r\n * @dev Indicates that the contract has been initialized.\r\n * @custom:oz-retyped-from bool\r\n */\r\n uint8 private _initialized;\r\n\r\n /**\r\n * @dev Indicates that the contract is in the process of being initialized.\r\n */\r\n bool private _initializing;\r\n\r\n /**\r\n * @dev Triggered when the contract has been initialized or reinitialized.\r\n */\r\n event Initialized(uint8 version);\r\n\r\n /**\r\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\r\n * `onlyInitializing` functions can be used to initialize parent contracts.\r\n *\r\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\r\n * constructor.\r\n *\r\n * Emits an {Initialized} event.\r\n */\r\n modifier initializer() {\r\n bool isTopLevelCall = !_initializing;\r\n require(\r\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\r\n \"Initializable: contract is already initialized\"\r\n );\r\n _initialized = 1;\r\n if (isTopLevelCall) {\r\n _initializing = true;\r\n }\r\n _;\r\n if (isTopLevelCall) {\r\n _initializing = false;\r\n emit Initialized(1);\r\n }\r\n }\r\n\r\n /**\r\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\r\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\r\n * used to initialize parent contracts.\r\n *\r\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\r\n * are added through upgrades and that require initialization.\r\n *\r\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\r\n * cannot be nested. If one is invoked in the context of another, execution will revert.\r\n *\r\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\r\n * a contract, executing them in the right order is up to the developer or operator.\r\n *\r\n * WARNING: setting the version to 255 will prevent any future reinitialization.\r\n *\r\n * Emits an {Initialized} event.\r\n */\r\n modifier reinitializer(uint8 version) {\r\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\r\n _initialized = version;\r\n _initializing = true;\r\n _;\r\n _initializing = false;\r\n emit Initialized(version);\r\n }\r\n\r\n /**\r\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\r\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\r\n */\r\n modifier onlyInitializing() {\r\n require(_initializing, \"Initializable: contract is not initializing\");\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\r\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\r\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\r\n * through proxies.\r\n *\r\n * Emits an {Initialized} event the first time it is successfully executed.\r\n */\r\n function _disableInitializers() internal virtual {\r\n require(!_initializing, \"Initializable: contract is initializing\");\r\n if (_initialized < type(uint8).max) {\r\n _initialized = type(uint8).max;\r\n emit Initialized(type(uint8).max);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function that returns the initialized version. Returns `_initialized`\r\n */\r\n function _getInitializedVersion() internal view returns (uint8) {\r\n return _initialized;\r\n }\r\n\r\n /**\r\n * @dev Internal function that returns the initialized version. Returns `_initializing`\r\n */\r\n function _isInitializing() internal view returns (bool) {\r\n return _initializing;\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../utils/ContextUpgradeable.sol\";\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module which allows children to implement an emergency stop\r\n * mechanism that can be triggered by an authorized account.\r\n *\r\n * This module is used through inheritance. It will make available the\r\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\r\n * the functions of your contract. Note that they will not be pausable by\r\n * simply including this module, only once the modifiers are put in place.\r\n */\r\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\r\n /**\r\n * @dev Emitted when the pause is triggered by `account`.\r\n */\r\n event Paused(address account);\r\n\r\n /**\r\n * @dev Emitted when the pause is lifted by `account`.\r\n */\r\n event Unpaused(address account);\r\n\r\n bool private _paused;\r\n\r\n /**\r\n * @dev Initializes the contract in unpaused state.\r\n */\r\n function __Pausable_init() internal onlyInitializing {\r\n __Pausable_init_unchained();\r\n }\r\n\r\n function __Pausable_init_unchained() internal onlyInitializing {\r\n _paused = false;\r\n }\r\n\r\n /**\r\n * @dev Modifier to make a function callable only when the contract is not paused.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must not be paused.\r\n */\r\n modifier whenNotPaused() {\r\n _requireNotPaused();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Modifier to make a function callable only when the contract is paused.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must be paused.\r\n */\r\n modifier whenPaused() {\r\n _requirePaused();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is paused, and false otherwise.\r\n */\r\n function paused() public view virtual returns (bool) {\r\n return _paused;\r\n }\r\n\r\n /**\r\n * @dev Throws if the contract is paused.\r\n */\r\n function _requireNotPaused() internal view virtual {\r\n require(!paused(), \"Pausable: paused\");\r\n }\r\n\r\n /**\r\n * @dev Throws if the contract is not paused.\r\n */\r\n function _requirePaused() internal view virtual {\r\n require(paused(), \"Pausable: not paused\");\r\n }\r\n\r\n /**\r\n * @dev Triggers stopped state.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must not be paused.\r\n */\r\n function _pause() internal virtual whenNotPaused {\r\n _paused = true;\r\n emit Paused(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Returns to normal state.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must be paused.\r\n */\r\n function _unpause() internal virtual whenPaused {\r\n _paused = false;\r\n emit Unpaused(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\r\n\r\npragma solidity ^0.8.0;\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module that helps prevent reentrant calls to a function.\r\n *\r\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\r\n * available, which can be applied to functions to make sure there are no nested\r\n * (reentrant) calls to them.\r\n *\r\n * Note that because there is a single `nonReentrant` guard, functions marked as\r\n * `nonReentrant` may not call one another. This can be worked around by making\r\n * those functions `private`, and then adding `external` `nonReentrant` entry\r\n * points to them.\r\n *\r\n * TIP: If you would like to learn more about reentrancy and alternative ways\r\n * to protect against it, check out our blog post\r\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\r\n */\r\nabstract contract ReentrancyGuardUpgradeable is Initializable {\r\n // Booleans are more expensive than uint256 or any type that takes up a full\r\n // word because each write operation emits an extra SLOAD to first read the\r\n // slot's contents, replace the bits taken up by the boolean, and then write\r\n // back. This is the compiler's defense against contract upgrades and\r\n // pointer aliasing, and it cannot be disabled.\r\n\r\n // The values being non-zero value makes deployment a bit more expensive,\r\n // but in exchange the refund on every call to nonReentrant will be lower in\r\n // amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to\r\n // increase the likelihood of the full refund coming into effect.\r\n uint256 private constant _NOT_ENTERED = 1;\r\n uint256 private constant _ENTERED = 2;\r\n\r\n uint256 private _status;\r\n\r\n function __ReentrancyGuard_init() internal onlyInitializing {\r\n __ReentrancyGuard_init_unchained();\r\n }\r\n\r\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\r\n _status = _NOT_ENTERED;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant`\r\n * function is not supported. It is possible to prevent this from happening\r\n * by making the `nonReentrant` function external, and making it call a\r\n * `private` function that does the actual work.\r\n */\r\n modifier nonReentrant() {\r\n _nonReentrantBefore();\r\n _;\r\n _nonReentrantAfter();\r\n }\r\n\r\n function _nonReentrantBefore() private {\r\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\r\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\r\n\r\n // Any calls to nonReentrant after this point will fail\r\n _status = _ENTERED;\r\n }\r\n\r\n function _nonReentrantAfter() private {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _status = _NOT_ENTERED;\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20Upgradeable.sol\";\r\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\r\nimport \"../../utils/ContextUpgradeable.sol\";\r\nimport \"../../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n * For a generic mechanism see {ERC20PresetMinterPauser}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\r\n * instead returning `false` on failure. This behavior is nonetheless\r\n * conventional and does not conflict with the expectations of ERC20\r\n * applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn't required by the specification.\r\n *\r\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See {IERC20-approve}.\r\n */\r\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\r\n mapping(address => uint256) private _balances;\r\n\r\n mapping(address => mapping(address => uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string private _name;\r\n string private _symbol;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}.\r\n *\r\n * The default value of {decimals} is 18. To select a different value for\r\n * {decimals} you should overload it.\r\n *\r\n * All two of these values are immutable: they can only be set once during\r\n * construction.\r\n */\r\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\r\n __ERC20_init_unchained(name_, symbol_);\r\n }\r\n\r\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\r\n * overridden;\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\r\n address owner = _msgSender();\r\n _transfer(owner, to, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\r\n * `transferFrom`. This is semantically equivalent to an infinite approval.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n address owner = _msgSender();\r\n _approve(owner, spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * NOTE: Does not update the allowance if the current allowance\r\n * is the maximum `uint256`.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` and `to` cannot be the zero address.\r\n * - `from` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``from``'s tokens of at least\r\n * `amount`.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n address spender = _msgSender();\r\n _spendAllowance(from, spender, amount);\r\n _transfer(from, to, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n address owner = _msgSender();\r\n _approve(owner, spender, allowance(owner, spender) + addedValue);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n address owner = _msgSender();\r\n uint256 currentAllowance = allowance(owner, spender);\r\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\r\n unchecked {\r\n _approve(owner, spender, currentAllowance - subtractedValue);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves `amount` of tokens from `from` to `to`.\r\n *\r\n * This internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `from` must have a balance of at least `amount`.\r\n */\r\n function _transfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {\r\n require(from != address(0), \"ERC20: transfer from the zero address\");\r\n require(to != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(from, to, amount);\r\n\r\n uint256 fromBalance = _balances[from];\r\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\r\n unchecked {\r\n _balances[from] = fromBalance - amount;\r\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\r\n // decrementing then incrementing.\r\n _balances[to] += amount;\r\n }\r\n\r\n emit Transfer(from, to, amount);\r\n\r\n _afterTokenTransfer(from, to, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply += amount;\r\n unchecked {\r\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\r\n _balances[account] += amount;\r\n }\r\n emit Transfer(address(0), account, amount);\r\n\r\n _afterTokenTransfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\r\n */\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n uint256 accountBalance = _balances[account];\r\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\r\n unchecked {\r\n _balances[account] = accountBalance - amount;\r\n // Overflow not possible: amount <= accountBalance <= totalSupply.\r\n _totalSupply -= amount;\r\n }\r\n\r\n emit Transfer(account, address(0), amount);\r\n\r\n _afterTokenTransfer(account, address(0), amount);\r\n }\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n */\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\r\n *\r\n * Does not update the allowance amount in case of infinite allowance.\r\n * Revert if not enough allowance is available.\r\n *\r\n * Might emit an {Approval} event.\r\n */\r\n function _spendAllowance(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n uint256 currentAllowance = allowance(owner, spender);\r\n if (currentAllowance != type(uint256).max) {\r\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\r\n unchecked {\r\n _approve(owner, spender, currentAllowance - amount);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * will be transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev Hook that is called after any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * has been transferred to `to`.\r\n * - when `from` is zero, `amount` tokens have been minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _afterTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[45] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n */\r\ninterface IERC20PermitUpgradeable {\r\n /**\r\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n * given ``owner``'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../ERC20Upgradeable.sol\";\r\nimport \"../utils/SafeERC20Upgradeable.sol\";\r\nimport \"../../../interfaces/IERC4626Upgradeable.sol\";\r\nimport \"../../../utils/math/MathUpgradeable.sol\";\r\nimport \"../../../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\r\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\r\n *\r\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\r\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\r\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\r\n * contract and not the \"assets\" token which is an independent contract.\r\n *\r\n * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of\r\n * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as\r\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\r\n *\r\n * _Available since v4.7._\r\n */\r\nabstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {\r\n using MathUpgradeable for uint256;\r\n\r\n IERC20Upgradeable private _asset;\r\n uint8 private _decimals;\r\n\r\n /**\r\n * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\r\n */\r\n function __ERC4626_init(IERC20Upgradeable asset_) internal onlyInitializing {\r\n __ERC4626_init_unchained(asset_);\r\n }\r\n\r\n function __ERC4626_init_unchained(IERC20Upgradeable asset_) internal onlyInitializing {\r\n (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\r\n _decimals = success ? assetDecimals : super.decimals();\r\n _asset = asset_;\r\n }\r\n\r\n /**\r\n * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\r\n */\r\n function _tryGetAssetDecimals(IERC20Upgradeable asset_) private returns (bool, uint8) {\r\n (bool success, bytes memory encodedDecimals) = address(asset_).call(\r\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector)\r\n );\r\n if (success && encodedDecimals.length >= 32) {\r\n uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\r\n if (returnedDecimals <= type(uint8).max) {\r\n return (true, uint8(returnedDecimals));\r\n }\r\n }\r\n return (false, 0);\r\n }\r\n\r\n /**\r\n * @dev Decimals are read from the underlying asset in the constructor and cached. If this fails (e.g., the asset\r\n * has not been created yet), the cached value is set to a default obtained by `super.decimals()` (which depends on\r\n * inheritance but is most likely 18). Override this function in order to set a guaranteed hardcoded value.\r\n * See {IERC20Metadata-decimals}.\r\n */\r\n function decimals() public view virtual override(IERC20MetadataUpgradeable, ERC20Upgradeable) returns (uint8) {\r\n return _decimals;\r\n }\r\n\r\n /** @dev See {IERC4626-asset}. */\r\n function asset() public view virtual override returns (address) {\r\n return address(_asset);\r\n }\r\n\r\n /** @dev See {IERC4626-totalAssets}. */\r\n function totalAssets() public view virtual override returns (uint256) {\r\n return _asset.balanceOf(address(this));\r\n }\r\n\r\n /** @dev See {IERC4626-convertToShares}. */\r\n function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {\r\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-convertToAssets}. */\r\n function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {\r\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-maxDeposit}. */\r\n function maxDeposit(address) public view virtual override returns (uint256) {\r\n return _isVaultCollateralized() ? type(uint256).max : 0;\r\n }\r\n\r\n /** @dev See {IERC4626-maxMint}. */\r\n function maxMint(address) public view virtual override returns (uint256) {\r\n return type(uint256).max;\r\n }\r\n\r\n /** @dev See {IERC4626-maxWithdraw}. */\r\n function maxWithdraw(address owner) public view virtual override returns (uint256) {\r\n return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-maxRedeem}. */\r\n function maxRedeem(address owner) public view virtual override returns (uint256) {\r\n return balanceOf(owner);\r\n }\r\n\r\n /** @dev See {IERC4626-previewDeposit}. */\r\n function previewDeposit(uint256 assets) public view virtual override returns (uint256) {\r\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-previewMint}. */\r\n function previewMint(uint256 shares) public view virtual override returns (uint256) {\r\n return _convertToAssets(shares, MathUpgradeable.Rounding.Up);\r\n }\r\n\r\n /** @dev See {IERC4626-previewWithdraw}. */\r\n function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {\r\n return _convertToShares(assets, MathUpgradeable.Rounding.Up);\r\n }\r\n\r\n /** @dev See {IERC4626-previewRedeem}. */\r\n function previewRedeem(uint256 shares) public view virtual override returns (uint256) {\r\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-deposit}. */\r\n function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {\r\n require(assets <= maxDeposit(receiver), \"ERC4626: deposit more than max\");\r\n\r\n uint256 shares = previewDeposit(assets);\r\n _deposit(_msgSender(), receiver, assets, shares);\r\n\r\n return shares;\r\n }\r\n\r\n /** @dev See {IERC4626-mint}. */\r\n function mint(uint256 shares, address receiver) public virtual override returns (uint256) {\r\n require(shares <= maxMint(receiver), \"ERC4626: mint more than max\");\r\n\r\n uint256 assets = previewMint(shares);\r\n _deposit(_msgSender(), receiver, assets, shares);\r\n\r\n return assets;\r\n }\r\n\r\n /** @dev See {IERC4626-withdraw}. */\r\n function withdraw(\r\n uint256 assets,\r\n address receiver,\r\n address owner\r\n ) public virtual override returns (uint256) {\r\n require(assets <= maxWithdraw(owner), \"ERC4626: withdraw more than max\");\r\n\r\n uint256 shares = previewWithdraw(assets);\r\n _withdraw(_msgSender(), receiver, owner, assets, shares);\r\n\r\n return shares;\r\n }\r\n\r\n /** @dev See {IERC4626-redeem}. */\r\n function redeem(\r\n uint256 shares,\r\n address receiver,\r\n address owner\r\n ) public virtual override returns (uint256) {\r\n require(shares <= maxRedeem(owner), \"ERC4626: redeem more than max\");\r\n\r\n uint256 assets = previewRedeem(shares);\r\n _withdraw(_msgSender(), receiver, owner, assets, shares);\r\n\r\n return assets;\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from assets to shares) with support for rounding direction.\r\n *\r\n * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset\r\n * would represent an infinite amount of shares.\r\n */\r\n function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {\r\n uint256 supply = totalSupply();\r\n return\r\n (assets == 0 || supply == 0)\r\n ? _initialConvertToShares(assets, rounding)\r\n : assets.mulDiv(supply, totalAssets(), rounding);\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from assets to shares) to apply when the vault is empty.\r\n *\r\n * NOTE: Make sure to keep this function consistent with {_initialConvertToAssets} when overriding it.\r\n */\r\n function _initialConvertToShares(\r\n uint256 assets,\r\n MathUpgradeable.Rounding /*rounding*/\r\n ) internal view virtual returns (uint256 shares) {\r\n return assets;\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from shares to assets) with support for rounding direction.\r\n */\r\n function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {\r\n uint256 supply = totalSupply();\r\n return\r\n (supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from shares to assets) to apply when the vault is empty.\r\n *\r\n * NOTE: Make sure to keep this function consistent with {_initialConvertToShares} when overriding it.\r\n */\r\n function _initialConvertToAssets(\r\n uint256 shares,\r\n MathUpgradeable.Rounding /*rounding*/\r\n ) internal view virtual returns (uint256 assets) {\r\n return shares;\r\n }\r\n\r\n /**\r\n * @dev Deposit/mint common workflow.\r\n */\r\n function _deposit(\r\n address caller,\r\n address receiver,\r\n uint256 assets,\r\n uint256 shares\r\n ) internal virtual {\r\n // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the\r\n // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\r\n // calls the vault, which is assumed not malicious.\r\n //\r\n // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\r\n // assets are transferred and before the shares are minted, which is a valid state.\r\n // slither-disable-next-line reentrancy-no-eth\r\n SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(caller, receiver, assets, shares);\r\n }\r\n\r\n /**\r\n * @dev Withdraw/redeem common workflow.\r\n */\r\n function _withdraw(\r\n address caller,\r\n address receiver,\r\n address owner,\r\n uint256 assets,\r\n uint256 shares\r\n ) internal virtual {\r\n if (caller != owner) {\r\n _spendAllowance(owner, caller, shares);\r\n }\r\n\r\n // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\r\n // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\r\n // calls the vault, which is assumed not malicious.\r\n //\r\n // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\r\n // shares are burned and after the assets are transferred, which is a valid state.\r\n _burn(owner, shares);\r\n SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);\r\n\r\n emit Withdraw(caller, receiver, owner, assets, shares);\r\n }\r\n\r\n function _isVaultCollateralized() private view returns (bool) {\r\n return totalAssets() > 0 || totalSupply() == 0;\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20Upgradeable.sol\";\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n *\r\n * _Available since v4.1._\r\n */\r\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the symbol of the token.\r\n */\r\n function symbol() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the decimals places of the token.\r\n */\r\n function decimals() external view returns (uint8);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20Upgradeable {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20Upgradeable.sol\";\r\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\r\nimport \"../../../utils/AddressUpgradeable.sol\";\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20Upgradeable {\r\n using AddressUpgradeable for address;\r\n\r\n function safeTransfer(\r\n IERC20Upgradeable token,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n function safeTransferFrom(\r\n IERC20Upgradeable token,\r\n address from,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(\r\n IERC20Upgradeable token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n \"SafeERC20: approve from non-zero to non-zero allowance\"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n function safeIncreaseAllowance(\r\n IERC20Upgradeable token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n uint256 newAllowance = token.allowance(address(this), spender) + value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n\r\n function safeDecreaseAllowance(\r\n IERC20Upgradeable token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\r\n uint256 newAllowance = oldAllowance - value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n }\r\n\r\n function safePermit(\r\n IERC20PermitUpgradeable token,\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) internal {\r\n uint256 nonceBefore = token.nonces(owner);\r\n token.permit(owner, spender, value, deadline, v, r, s);\r\n uint256 nonceAfter = token.nonces(owner);\r\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\r\n if (returndata.length > 0) {\r\n // Return data is optional\r\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC721Upgradeable.sol\";\r\nimport \"./IERC721ReceiverUpgradeable.sol\";\r\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\r\nimport \"../../utils/AddressUpgradeable.sol\";\r\nimport \"../../utils/ContextUpgradeable.sol\";\r\nimport \"../../utils/StringsUpgradeable.sol\";\r\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\r\nimport \"../../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\r\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\r\n * {ERC721Enumerable}.\r\n */\r\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\r\n using AddressUpgradeable for address;\r\n using StringsUpgradeable for uint256;\r\n\r\n // Token name\r\n string private _name;\r\n\r\n // Token symbol\r\n string private _symbol;\r\n\r\n // Mapping from token ID to owner address\r\n mapping(uint256 => address) private _owners;\r\n\r\n // Mapping owner address to token count\r\n mapping(address => uint256) private _balances;\r\n\r\n // Mapping from token ID to approved address\r\n mapping(uint256 => address) private _tokenApprovals;\r\n\r\n // Mapping from owner to operator approvals\r\n mapping(address => mapping(address => bool)) private _operatorApprovals;\r\n\r\n /**\r\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\r\n */\r\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\r\n __ERC721_init_unchained(name_, symbol_);\r\n }\r\n\r\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\r\n return\r\n interfaceId == type(IERC721Upgradeable).interfaceId ||\r\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\r\n super.supportsInterface(interfaceId);\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-balanceOf}.\r\n */\r\n function balanceOf(address owner) public view virtual override returns (uint256) {\r\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\r\n return _balances[owner];\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-ownerOf}.\r\n */\r\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\r\n address owner = _ownerOf(tokenId);\r\n require(owner != address(0), \"ERC721: invalid token ID\");\r\n return owner;\r\n }\r\n\r\n /**\r\n * @dev See {IERC721Metadata-name}.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev See {IERC721Metadata-symbol}.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev See {IERC721Metadata-tokenURI}.\r\n */\r\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\r\n _requireMinted(tokenId);\r\n\r\n string memory baseURI = _baseURI();\r\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\r\n }\r\n\r\n /**\r\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\r\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\r\n * by default, can be overridden in child contracts.\r\n */\r\n function _baseURI() internal view virtual returns (string memory) {\r\n return \"\";\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-approve}.\r\n */\r\n function approve(address to, uint256 tokenId) public virtual override {\r\n address owner = ERC721Upgradeable.ownerOf(tokenId);\r\n require(to != owner, \"ERC721: approval to current owner\");\r\n\r\n require(\r\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\r\n \"ERC721: approve caller is not token owner or approved for all\"\r\n );\r\n\r\n _approve(to, tokenId);\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-getApproved}.\r\n */\r\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\r\n _requireMinted(tokenId);\r\n\r\n return _tokenApprovals[tokenId];\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-setApprovalForAll}.\r\n */\r\n function setApprovalForAll(address operator, bool approved) public virtual override {\r\n _setApprovalForAll(_msgSender(), operator, approved);\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-isApprovedForAll}.\r\n */\r\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\r\n return _operatorApprovals[owner][operator];\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-transferFrom}.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) public virtual override {\r\n //solhint-disable-next-line max-line-length\r\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\r\n\r\n _transfer(from, to, tokenId);\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-safeTransferFrom}.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) public virtual override {\r\n safeTransferFrom(from, to, tokenId, \"\");\r\n }\r\n\r\n /**\r\n * @dev See {IERC721-safeTransferFrom}.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId,\r\n bytes memory data\r\n ) public virtual override {\r\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\r\n _safeTransfer(from, to, tokenId, data);\r\n }\r\n\r\n /**\r\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\r\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\r\n *\r\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\r\n *\r\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\r\n * implement alternative mechanisms to perform token transfer, such as signature-based.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must exist and be owned by `from`.\r\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function _safeTransfer(\r\n address from,\r\n address to,\r\n uint256 tokenId,\r\n bytes memory data\r\n ) internal virtual {\r\n _transfer(from, to, tokenId);\r\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\r\n }\r\n\r\n /**\r\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\r\n */\r\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\r\n return _owners[tokenId];\r\n }\r\n\r\n /**\r\n * @dev Returns whether `tokenId` exists.\r\n *\r\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\r\n *\r\n * Tokens start existing when they are minted (`_mint`),\r\n * and stop existing when they are burned (`_burn`).\r\n */\r\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\r\n return _ownerOf(tokenId) != address(0);\r\n }\r\n\r\n /**\r\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must exist.\r\n */\r\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\r\n address owner = ERC721Upgradeable.ownerOf(tokenId);\r\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\r\n }\r\n\r\n /**\r\n * @dev Safely mints `tokenId` and transfers it to `to`.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must not exist.\r\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function _safeMint(address to, uint256 tokenId) internal virtual {\r\n _safeMint(to, tokenId, \"\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\r\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\r\n */\r\n function _safeMint(\r\n address to,\r\n uint256 tokenId,\r\n bytes memory data\r\n ) internal virtual {\r\n _mint(to, tokenId);\r\n require(\r\n _checkOnERC721Received(address(0), to, tokenId, data),\r\n \"ERC721: transfer to non ERC721Receiver implementer\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Mints `tokenId` and transfers it to `to`.\r\n *\r\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must not exist.\r\n * - `to` cannot be the zero address.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function _mint(address to, uint256 tokenId) internal virtual {\r\n require(to != address(0), \"ERC721: mint to the zero address\");\r\n require(!_exists(tokenId), \"ERC721: token already minted\");\r\n\r\n _beforeTokenTransfer(address(0), to, tokenId);\r\n\r\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\r\n require(!_exists(tokenId), \"ERC721: token already minted\");\r\n\r\n unchecked {\r\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\r\n // Given that tokens are minted one by one, it is impossible in practice that\r\n // this ever happens. Might change if we allow batch minting.\r\n // The ERC fails to describe this case.\r\n _balances[to] += 1;\r\n }\r\n\r\n _owners[tokenId] = to;\r\n\r\n emit Transfer(address(0), to, tokenId);\r\n\r\n _afterTokenTransfer(address(0), to, tokenId);\r\n }\r\n\r\n /**\r\n * @dev Destroys `tokenId`.\r\n * The approval is cleared when the token is burned.\r\n * This is an internal function that does not check if the sender is authorized to operate on the token.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must exist.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function _burn(uint256 tokenId) internal virtual {\r\n address owner = ERC721Upgradeable.ownerOf(tokenId);\r\n\r\n _beforeTokenTransfer(owner, address(0), tokenId);\r\n\r\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\r\n owner = ERC721Upgradeable.ownerOf(tokenId);\r\n\r\n // Clear approvals\r\n delete _tokenApprovals[tokenId];\r\n\r\n unchecked {\r\n // Cannot overflow, as that would require more tokens to be burned/transferred\r\n // out than the owner initially received through minting and transferring in.\r\n _balances[owner] -= 1;\r\n }\r\n delete _owners[tokenId];\r\n\r\n emit Transfer(owner, address(0), tokenId);\r\n\r\n _afterTokenTransfer(owner, address(0), tokenId);\r\n }\r\n\r\n /**\r\n * @dev Transfers `tokenId` from `from` to `to`.\r\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must be owned by `from`.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function _transfer(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) internal virtual {\r\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\r\n require(to != address(0), \"ERC721: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(from, to, tokenId);\r\n\r\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\r\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\r\n\r\n // Clear approvals from the previous owner\r\n delete _tokenApprovals[tokenId];\r\n\r\n unchecked {\r\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\r\n // `from`'s balance is the number of token held, which is at least one before the current\r\n // transfer.\r\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\r\n // all 2**256 token ids to be minted, which in practice is impossible.\r\n _balances[from] -= 1;\r\n _balances[to] += 1;\r\n }\r\n _owners[tokenId] = to;\r\n\r\n emit Transfer(from, to, tokenId);\r\n\r\n _afterTokenTransfer(from, to, tokenId);\r\n }\r\n\r\n /**\r\n * @dev Approve `to` to operate on `tokenId`\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function _approve(address to, uint256 tokenId) internal virtual {\r\n _tokenApprovals[tokenId] = to;\r\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\r\n }\r\n\r\n /**\r\n * @dev Approve `operator` to operate on all of `owner` tokens\r\n *\r\n * Emits an {ApprovalForAll} event.\r\n */\r\n function _setApprovalForAll(\r\n address owner,\r\n address operator,\r\n bool approved\r\n ) internal virtual {\r\n require(owner != operator, \"ERC721: approve to caller\");\r\n _operatorApprovals[owner][operator] = approved;\r\n emit ApprovalForAll(owner, operator, approved);\r\n }\r\n\r\n /**\r\n * @dev Reverts if the `tokenId` has not been minted yet.\r\n */\r\n function _requireMinted(uint256 tokenId) internal view virtual {\r\n require(_exists(tokenId), \"ERC721: invalid token ID\");\r\n }\r\n\r\n /**\r\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\r\n * The call is not executed if the target address is not a contract.\r\n *\r\n * @param from address representing the previous owner of the given token ID\r\n * @param to target address that will receive the tokens\r\n * @param tokenId uint256 ID of the token to be transferred\r\n * @param data bytes optional data to send along with the call\r\n * @return bool whether the call correctly returned the expected magic value\r\n */\r\n function _checkOnERC721Received(\r\n address from,\r\n address to,\r\n uint256 tokenId,\r\n bytes memory data\r\n ) private returns (bool) {\r\n if (to.isContract()) {\r\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\r\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\r\n } catch (bytes memory reason) {\r\n if (reason.length == 0) {\r\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\r\n } else {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n revert(add(32, reason), mload(reason))\r\n }\r\n }\r\n }\r\n } else {\r\n return true;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\r\n * See {_beforeConsecutiveTokenTransfer}.\r\n *\r\n * Calling conditions:\r\n *\r\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\r\n * transferred to `to`.\r\n * - When `from` is zero, `tokenId` will be minted for `to`.\r\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\r\n * See {_afterConsecutiveTokenTransfer}.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _afterTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev Hook that is called before \"consecutive token transfers\" as defined in ERC2309 and implemented in\r\n * {ERC721Consecutive}.\r\n * Calling conditions are similar to {_beforeTokenTransfer}.\r\n */\r\n function _beforeConsecutiveTokenTransfer(\r\n address from,\r\n address to,\r\n uint256, /*first*/\r\n uint96 size\r\n ) internal virtual {\r\n if (from != address(0)) {\r\n _balances[from] -= size;\r\n }\r\n if (to != address(0)) {\r\n _balances[to] += size;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Hook that is called after \"consecutive token transfers\" as defined in ERC2309 and implemented in\r\n * {ERC721Consecutive}.\r\n * Calling conditions are similar to {_afterTokenTransfer}.\r\n */\r\n function _afterConsecutiveTokenTransfer(\r\n address, /*from*/\r\n address, /*to*/\r\n uint256, /*first*/\r\n uint96 /*size*/\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[44] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC721Upgradeable.sol\";\r\n\r\n/**\r\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\r\n * @dev See https://eips.ethereum.org/EIPS/eip-721\r\n */\r\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\r\n /**\r\n * @dev Returns the token collection name.\r\n */\r\n function name() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the token collection symbol.\r\n */\r\n function symbol() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\r\n */\r\n function tokenURI(uint256 tokenId) external view returns (string memory);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title ERC721 token receiver interface\r\n * @dev Interface for any contract that wants to support safeTransfers\r\n * from ERC721 asset contracts.\r\n */\r\ninterface IERC721ReceiverUpgradeable {\r\n /**\r\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\r\n * by `operator` from `from`, this function is called.\r\n *\r\n * It must return its Solidity selector to confirm the token transfer.\r\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\r\n *\r\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\r\n */\r\n function onERC721Received(\r\n address operator,\r\n address from,\r\n uint256 tokenId,\r\n bytes calldata data\r\n ) external returns (bytes4);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\r\n\r\n/**\r\n * @dev Required interface of an ERC721 compliant contract.\r\n */\r\ninterface IERC721Upgradeable is IERC165Upgradeable {\r\n /**\r\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\r\n\r\n /**\r\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\r\n */\r\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\r\n\r\n /**\r\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\r\n */\r\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\r\n\r\n /**\r\n * @dev Returns the number of tokens in ``owner``'s account.\r\n */\r\n function balanceOf(address owner) external view returns (uint256 balance);\r\n\r\n /**\r\n * @dev Returns the owner of the `tokenId` token.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must exist.\r\n */\r\n function ownerOf(uint256 tokenId) external view returns (address owner);\r\n\r\n /**\r\n * @dev Safely transfers `tokenId` token from `from` to `to`.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must exist and be owned by `from`.\r\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\r\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId,\r\n bytes calldata data\r\n ) external;\r\n\r\n /**\r\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\r\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must exist and be owned by `from`.\r\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\r\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) external;\r\n\r\n /**\r\n * @dev Transfers `tokenId` token from `from` to `to`.\r\n *\r\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\r\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\r\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must be owned by `from`.\r\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) external;\r\n\r\n /**\r\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\r\n * The approval is cleared when the token is transferred.\r\n *\r\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\r\n *\r\n * Requirements:\r\n *\r\n * - The caller must own the token or be an approved operator.\r\n * - `tokenId` must exist.\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address to, uint256 tokenId) external;\r\n\r\n /**\r\n * @dev Approve or remove `operator` as an operator for the caller.\r\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\r\n *\r\n * Requirements:\r\n *\r\n * - The `operator` cannot be the caller.\r\n *\r\n * Emits an {ApprovalForAll} event.\r\n */\r\n function setApprovalForAll(address operator, bool _approved) external;\r\n\r\n /**\r\n * @dev Returns the account approved for `tokenId` token.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must exist.\r\n */\r\n function getApproved(uint256 tokenId) external view returns (address operator);\r\n\r\n /**\r\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\r\n *\r\n * See {setApprovalForAll}\r\n */\r\n function isApprovedForAll(address owner, address operator) external view returns (bool);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary AddressUpgradeable {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length > 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance >= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity ^0.8.0;\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract ContextUpgradeable is Initializable {\r\n function __Context_init() internal onlyInitializing {\r\n }\r\n\r\n function __Context_init_unchained() internal onlyInitializing {\r\n }\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[50] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\r\n * `CREATE2` can be used to compute in advance the address where a smart\r\n * contract will be deployed, which allows for interesting new mechanisms known\r\n * as 'counterfactual interactions'.\r\n *\r\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\r\n * information.\r\n */\r\nlibrary Create2Upgradeable {\r\n /**\r\n * @dev Deploys a contract using `CREATE2`. The address where the contract\r\n * will be deployed can be known in advance via {computeAddress}.\r\n *\r\n * The bytecode for a contract can be obtained from Solidity with\r\n * `type(contractName).creationCode`.\r\n *\r\n * Requirements:\r\n *\r\n * - `bytecode` must not be empty.\r\n * - `salt` must have not been used for `bytecode` already.\r\n * - the factory must have a balance of at least `amount`.\r\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\r\n */\r\n function deploy(\r\n uint256 amount,\r\n bytes32 salt,\r\n bytes memory bytecode\r\n ) internal returns (address addr) {\r\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\r\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\r\n }\r\n require(addr != address(0), \"Create2: Failed on deploy\");\r\n }\r\n\r\n /**\r\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\r\n * `bytecodeHash` or `salt` will result in a new destination address.\r\n */\r\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\r\n return computeAddress(salt, bytecodeHash, address(this));\r\n }\r\n\r\n /**\r\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\r\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\r\n */\r\n function computeAddress(\r\n bytes32 salt,\r\n bytes32 bytecodeHash,\r\n address deployer\r\n ) internal pure returns (address addr) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let ptr := mload(0x40) // Get free memory pointer\r\n\r\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\r\n // |-------------------|---------------------------------------------------------------------------|\r\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\r\n // | salt | BBBBBBBBBBBBB...BB |\r\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\r\n // | 0xFF | FF |\r\n // |-------------------|---------------------------------------------------------------------------|\r\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\r\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\r\n\r\n mstore(add(ptr, 0x40), bytecodeHash)\r\n mstore(add(ptr, 0x20), salt)\r\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\r\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\r\n mstore8(start, 0xff)\r\n addr := keccak256(start, 85)\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC165Upgradeable.sol\";\r\nimport \"../../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC165} interface.\r\n *\r\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\r\n * for the additional interface id that will be supported. For example:\r\n *\r\n * ```solidity\r\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\r\n * }\r\n * ```\r\n *\r\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\r\n */\r\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\r\n function __ERC165_init() internal onlyInitializing {\r\n }\r\n\r\n function __ERC165_init_unchained() internal onlyInitializing {\r\n }\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n return interfaceId == type(IERC165Upgradeable).interfaceId;\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[50] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC165 standard, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\r\n *\r\n * Implementers can declare support of contract interfaces, which can then be\r\n * queried by others ({ERC165Checker}).\r\n *\r\n * For an implementation, see {ERC165}.\r\n */\r\ninterface IERC165Upgradeable {\r\n /**\r\n * @dev Returns true if this contract implements the interface defined by\r\n * `interfaceId`. See the corresponding\r\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\r\n * to learn more about how these ids are created.\r\n *\r\n * This function call must use less than 30 000 gas.\r\n */\r\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard math utilities missing in the Solidity language.\r\n */\r\nlibrary MathUpgradeable {\r\n enum Rounding {\r\n Down, // Toward negative infinity\r\n Up, // Toward infinity\r\n Zero // Toward zero\r\n }\r\n\r\n /**\r\n * @dev Returns the largest of two numbers.\r\n */\r\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a > b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two numbers.\r\n */\r\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a < b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two numbers. The result is rounded towards\r\n * zero.\r\n */\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow.\r\n return (a & b) + (a ^ b) / 2;\r\n }\r\n\r\n /**\r\n * @dev Returns the ceiling of the division of two numbers.\r\n *\r\n * This differs from standard division with `/` in that it rounds up instead\r\n * of rounding down.\r\n */\r\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b - 1) / b can overflow on addition, so we distribute.\r\n return a == 0 ? 0 : (a - 1) / b + 1;\r\n }\r\n\r\n /**\r\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\r\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\r\n * with further edits by Uniswap Labs also under MIT license.\r\n */\r\n function mulDiv(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 result) {\r\n unchecked {\r\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\r\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\r\n // variables such that product = prod1 * 2^256 + prod0.\r\n uint256 prod0; // Least significant 256 bits of the product\r\n uint256 prod1; // Most significant 256 bits of the product\r\n assembly {\r\n let mm := mulmod(x, y, not(0))\r\n prod0 := mul(x, y)\r\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\r\n }\r\n\r\n // Handle non-overflow cases, 256 by 256 division.\r\n if (prod1 == 0) {\r\n return prod0 / denominator;\r\n }\r\n\r\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\r\n require(denominator > prod1);\r\n\r\n ///////////////////////////////////////////////\r\n // 512 by 256 division.\r\n ///////////////////////////////////////////////\r\n\r\n // Make division exact by subtracting the remainder from [prod1 prod0].\r\n uint256 remainder;\r\n assembly {\r\n // Compute remainder using mulmod.\r\n remainder := mulmod(x, y, denominator)\r\n\r\n // Subtract 256 bit number from 512 bit number.\r\n prod1 := sub(prod1, gt(remainder, prod0))\r\n prod0 := sub(prod0, remainder)\r\n }\r\n\r\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\r\n // See https://cs.stackexchange.com/q/138556/92363.\r\n\r\n // Does not overflow because the denominator cannot be zero at this stage in the function.\r\n uint256 twos = denominator & (~denominator + 1);\r\n assembly {\r\n // Divide denominator by twos.\r\n denominator := div(denominator, twos)\r\n\r\n // Divide [prod1 prod0] by twos.\r\n prod0 := div(prod0, twos)\r\n\r\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\r\n twos := add(div(sub(0, twos), twos), 1)\r\n }\r\n\r\n // Shift in bits from prod1 into prod0.\r\n prod0 |= prod1 * twos;\r\n\r\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\r\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\r\n // four bits. That is, denominator * inv = 1 mod 2^4.\r\n uint256 inverse = (3 * denominator) ^ 2;\r\n\r\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\r\n // in modular arithmetic, doubling the correct bits in each step.\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\r\n\r\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\r\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\r\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\r\n // is no longer required.\r\n result = prod0 * inverse;\r\n return result;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\r\n */\r\n function mulDiv(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator,\r\n Rounding rounding\r\n ) internal pure returns (uint256) {\r\n uint256 result = mulDiv(x, y, denominator);\r\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\r\n result += 1;\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\r\n *\r\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\r\n */\r\n function sqrt(uint256 a) internal pure returns (uint256) {\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\r\n //\r\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\r\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\r\n //\r\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\r\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\r\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\r\n //\r\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\r\n uint256 result = 1 << (log2(a) >> 1);\r\n\r\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\r\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\r\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\r\n // into the expected uint128 result.\r\n unchecked {\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n return min(result, a / result);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates sqrt(a), following the selected rounding direction.\r\n */\r\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = sqrt(a);\r\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 128;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 64;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 32;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 16;\r\n }\r\n if (value >> 8 > 0) {\r\n value >>= 8;\r\n result += 8;\r\n }\r\n if (value >> 4 > 0) {\r\n value >>= 4;\r\n result += 4;\r\n }\r\n if (value >> 2 > 0) {\r\n value >>= 2;\r\n result += 2;\r\n }\r\n if (value >> 1 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log2(value);\r\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >= 10**64) {\r\n value /= 10**64;\r\n result += 64;\r\n }\r\n if (value >= 10**32) {\r\n value /= 10**32;\r\n result += 32;\r\n }\r\n if (value >= 10**16) {\r\n value /= 10**16;\r\n result += 16;\r\n }\r\n if (value >= 10**8) {\r\n value /= 10**8;\r\n result += 8;\r\n }\r\n if (value >= 10**4) {\r\n value /= 10**4;\r\n result += 4;\r\n }\r\n if (value >= 10**2) {\r\n value /= 10**2;\r\n result += 2;\r\n }\r\n if (value >= 10**1) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log10(value);\r\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 256, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n *\r\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\r\n */\r\n function log256(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 16;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 8;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 4;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 2;\r\n }\r\n if (value >> 8 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log256(value);\r\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./math/MathUpgradeable.sol\";\r\n\r\n/**\r\n * @dev String operations.\r\n */\r\nlibrary StringsUpgradeable {\r\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\r\n uint8 private constant _ADDRESS_LENGTH = 20;\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\r\n */\r\n function toString(uint256 value) internal pure returns (string memory) {\r\n unchecked {\r\n uint256 length = MathUpgradeable.log10(value) + 1;\r\n string memory buffer = new string(length);\r\n uint256 ptr;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n ptr := add(buffer, add(32, length))\r\n }\r\n while (true) {\r\n ptr--;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\r\n }\r\n value /= 10;\r\n if (value == 0) break;\r\n }\r\n return buffer;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(uint256 value) internal pure returns (string memory) {\r\n unchecked {\r\n return toHexString(value, MathUpgradeable.log256(value) + 1);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\r\n */\r\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\r\n bytes memory buffer = new bytes(2 * length + 2);\r\n buffer[0] = \"0\";\r\n buffer[1] = \"x\";\r\n for (uint256 i = 2 * length + 1; i > 1; --i) {\r\n buffer[i] = _SYMBOLS[value & 0xf];\r\n value >>= 4;\r\n }\r\n require(value == 0, \"Strings: hex length insufficient\");\r\n return string(buffer);\r\n }\r\n\r\n /**\r\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(address addr) internal pure returns (string memory) {\r\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../utils/Context.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n constructor() {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n _checkOwner();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if the sender is not the owner.\r\n */\r\n function _checkOwner() internal view virtual {\r\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions anymore. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby removing any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Ownable.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership} and {acceptOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available all functions\r\n * from parent (Ownable).\r\n */\r\nabstract contract Ownable2Step is Ownable {\r\n address private _pendingOwner;\r\n\r\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Returns the address of the pending owner.\r\n */\r\n function pendingOwner() public view virtual returns (address) {\r\n return _pendingOwner;\r\n }\r\n\r\n /**\r\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual override onlyOwner {\r\n _pendingOwner = newOwner;\r\n emit OwnershipTransferStarted(owner(), newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual override {\r\n delete _pendingOwner;\r\n super._transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev The new owner accepts the ownership transfer.\r\n */\r\n function acceptOwnership() external {\r\n address sender = _msgSender();\r\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\r\n _transferOwnership(sender);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\r\n * proxy whose upgrades are fully controlled by the current implementation.\r\n */\r\ninterface IERC1822Proxiable {\r\n /**\r\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\r\n * address.\r\n *\r\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\r\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\r\n * function revert if invoked through a proxy.\r\n */\r\n function proxiableUUID() external view returns (bytes32);\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IBeacon.sol\";\r\nimport \"../Proxy.sol\";\r\nimport \"../ERC1967/ERC1967Upgrade.sol\";\r\n\r\n/**\r\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\r\n *\r\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\r\n * conflict with the storage layout of the implementation behind the proxy.\r\n *\r\n * _Available since v3.4._\r\n */\r\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\r\n /**\r\n * @dev Initializes the proxy with `beacon`.\r\n *\r\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\r\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\r\n * constructor.\r\n *\r\n * Requirements:\r\n *\r\n * - `beacon` must be a contract with the interface {IBeacon}.\r\n */\r\n constructor(address beacon, bytes memory data) payable {\r\n _upgradeBeaconToAndCall(beacon, data, false);\r\n }\r\n\r\n /**\r\n * @dev Returns the current beacon address.\r\n */\r\n function _beacon() internal view virtual returns (address) {\r\n return _getBeacon();\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation address of the associated beacon.\r\n */\r\n function _implementation() internal view virtual override returns (address) {\r\n return IBeacon(_getBeacon()).implementation();\r\n }\r\n\r\n /**\r\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\r\n *\r\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\r\n *\r\n * Requirements:\r\n *\r\n * - `beacon` must be a contract.\r\n * - The implementation returned by `beacon` must be a contract.\r\n */\r\n function _setBeacon(address beacon, bytes memory data) internal virtual {\r\n _upgradeBeaconToAndCall(beacon, data, false);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\r\n */\r\ninterface IBeacon {\r\n /**\r\n * @dev Must return an address that can be used as a delegate call target.\r\n *\r\n * {BeaconProxy} will check that this address is a contract.\r\n */\r\n function implementation() external view returns (address);\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IBeacon.sol\";\r\nimport \"../../access/Ownable.sol\";\r\nimport \"../../utils/Address.sol\";\r\n\r\n/**\r\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\r\n * implementation contract, which is where they will delegate all function calls.\r\n *\r\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\r\n */\r\ncontract UpgradeableBeacon is IBeacon, Ownable {\r\n address private _implementation;\r\n\r\n /**\r\n * @dev Emitted when the implementation returned by the beacon is changed.\r\n */\r\n event Upgraded(address indexed implementation);\r\n\r\n /**\r\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\r\n * beacon.\r\n */\r\n constructor(address implementation_) {\r\n _setImplementation(implementation_);\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function implementation() public view virtual override returns (address) {\r\n return _implementation;\r\n }\r\n\r\n /**\r\n * @dev Upgrades the beacon to a new implementation.\r\n *\r\n * Emits an {Upgraded} event.\r\n *\r\n * Requirements:\r\n *\r\n * - msg.sender must be the owner of the contract.\r\n * - `newImplementation` must be a contract.\r\n */\r\n function upgradeTo(address newImplementation) public virtual onlyOwner {\r\n _setImplementation(newImplementation);\r\n emit Upgraded(newImplementation);\r\n }\r\n\r\n /**\r\n * @dev Sets the implementation contract address for this beacon\r\n *\r\n * Requirements:\r\n *\r\n * - `newImplementation` must be a contract.\r\n */\r\n function _setImplementation(address newImplementation) private {\r\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\r\n _implementation = newImplementation;\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../Proxy.sol\";\r\nimport \"./ERC1967Upgrade.sol\";\r\n\r\n/**\r\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\r\n * implementation address that can be changed. This address is stored in storage in the location specified by\r\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\r\n * implementation behind the proxy.\r\n */\r\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\r\n /**\r\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\r\n *\r\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\r\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\r\n */\r\n constructor(address _logic, bytes memory _data) payable {\r\n _upgradeToAndCall(_logic, _data, false);\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function _implementation() internal view virtual override returns (address impl) {\r\n return ERC1967Upgrade._getImplementation();\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"../beacon/IBeacon.sol\";\r\nimport \"../../interfaces/draft-IERC1822.sol\";\r\nimport \"../../utils/Address.sol\";\r\nimport \"../../utils/StorageSlot.sol\";\r\n\r\n/**\r\n * @dev This abstract contract provides getters and event emitting update functions for\r\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\r\n *\r\n * _Available since v4.1._\r\n *\r\n * @custom:oz-upgrades-unsafe-allow delegatecall\r\n */\r\nabstract contract ERC1967Upgrade {\r\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\r\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\r\n\r\n /**\r\n * @dev Storage slot with the address of the current implementation.\r\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\r\n * validated in the constructor.\r\n */\r\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r\n\r\n /**\r\n * @dev Emitted when the implementation is upgraded.\r\n */\r\n event Upgraded(address indexed implementation);\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function _getImplementation() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new address in the EIP1967 implementation slot.\r\n */\r\n function _setImplementation(address newImplementation) private {\r\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\r\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeTo(address newImplementation) internal {\r\n _setImplementation(newImplementation);\r\n emit Upgraded(newImplementation);\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade with additional setup call.\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeToAndCall(\r\n address newImplementation,\r\n bytes memory data,\r\n bool forceCall\r\n ) internal {\r\n _upgradeTo(newImplementation);\r\n if (data.length > 0 || forceCall) {\r\n Address.functionDelegateCall(newImplementation, data);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeToAndCallUUPS(\r\n address newImplementation,\r\n bytes memory data,\r\n bool forceCall\r\n ) internal {\r\n // Upgrades from old implementations will perform a rollback test. This test requires the new\r\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\r\n // this special case will break upgrade paths from old UUPS implementation to new ones.\r\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\r\n _setImplementation(newImplementation);\r\n } else {\r\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\r\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\r\n } catch {\r\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\r\n }\r\n _upgradeToAndCall(newImplementation, data, forceCall);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Storage slot with the admin of the contract.\r\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\r\n * validated in the constructor.\r\n */\r\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r\n\r\n /**\r\n * @dev Emitted when the admin account has changed.\r\n */\r\n event AdminChanged(address previousAdmin, address newAdmin);\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n */\r\n function _getAdmin() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new address in the EIP1967 admin slot.\r\n */\r\n function _setAdmin(address newAdmin) private {\r\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\r\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\r\n }\r\n\r\n /**\r\n * @dev Changes the admin of the proxy.\r\n *\r\n * Emits an {AdminChanged} event.\r\n */\r\n function _changeAdmin(address newAdmin) internal {\r\n emit AdminChanged(_getAdmin(), newAdmin);\r\n _setAdmin(newAdmin);\r\n }\r\n\r\n /**\r\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\r\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\r\n */\r\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\r\n\r\n /**\r\n * @dev Emitted when the beacon is upgraded.\r\n */\r\n event BeaconUpgraded(address indexed beacon);\r\n\r\n /**\r\n * @dev Returns the current beacon.\r\n */\r\n function _getBeacon() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new beacon in the EIP1967 beacon slot.\r\n */\r\n function _setBeacon(address newBeacon) private {\r\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\r\n require(\r\n Address.isContract(IBeacon(newBeacon).implementation()),\r\n \"ERC1967: beacon implementation is not a contract\"\r\n );\r\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\r\n }\r\n\r\n /**\r\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\r\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\r\n *\r\n * Emits a {BeaconUpgraded} event.\r\n */\r\n function _upgradeBeaconToAndCall(\r\n address newBeacon,\r\n bytes memory data,\r\n bool forceCall\r\n ) internal {\r\n _setBeacon(newBeacon);\r\n emit BeaconUpgraded(newBeacon);\r\n if (data.length > 0 || forceCall) {\r\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\r\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\r\n * be specified by overriding the virtual {_implementation} function.\r\n *\r\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\r\n * different contract through the {_delegate} function.\r\n *\r\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\r\n */\r\nabstract contract Proxy {\r\n /**\r\n * @dev Delegates the current call to `implementation`.\r\n *\r\n * This function does not return to its internal call site, it will return directly to the external caller.\r\n */\r\n function _delegate(address implementation) internal virtual {\r\n assembly {\r\n // Copy msg.data. We take full control of memory in this inline assembly\r\n // block because it will not return to Solidity code. We overwrite the\r\n // Solidity scratch pad at memory position 0.\r\n calldatacopy(0, 0, calldatasize())\r\n\r\n // Call the implementation.\r\n // out and outsize are 0 because we don't know the size yet.\r\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\r\n\r\n // Copy the returned data.\r\n returndatacopy(0, 0, returndatasize())\r\n\r\n switch result\r\n // delegatecall returns 0 on error.\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\r\n * and {_fallback} should delegate.\r\n */\r\n function _implementation() internal view virtual returns (address);\r\n\r\n /**\r\n * @dev Delegates the current call to the address returned by `_implementation()`.\r\n *\r\n * This function does not return to its internal call site, it will return directly to the external caller.\r\n */\r\n function _fallback() internal virtual {\r\n _beforeFallback();\r\n _delegate(_implementation());\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\r\n * function in the contract matches the call data.\r\n */\r\n fallback() external payable virtual {\r\n _fallback();\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\r\n * is empty.\r\n */\r\n receive() external payable virtual {\r\n _fallback();\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\r\n * call, or as part of the Solidity `fallback` or `receive` functions.\r\n *\r\n * If overridden should call `super._beforeFallback()`.\r\n */\r\n function _beforeFallback() internal virtual {}\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./TransparentUpgradeableProxy.sol\";\r\nimport \"../../access/Ownable.sol\";\r\n\r\n/**\r\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\r\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\r\n */\r\ncontract ProxyAdmin is Ownable {\r\n /**\r\n * @dev Returns the current implementation of `proxy`.\r\n *\r\n * Requirements:\r\n *\r\n * - This contract must be the admin of `proxy`.\r\n */\r\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\r\n // We need to manually run the static call since the getter cannot be flagged as view\r\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\r\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\r\n require(success);\r\n return abi.decode(returndata, (address));\r\n }\r\n\r\n /**\r\n * @dev Returns the current admin of `proxy`.\r\n *\r\n * Requirements:\r\n *\r\n * - This contract must be the admin of `proxy`.\r\n */\r\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\r\n // We need to manually run the static call since the getter cannot be flagged as view\r\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\r\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\r\n require(success);\r\n return abi.decode(returndata, (address));\r\n }\r\n\r\n /**\r\n * @dev Changes the admin of `proxy` to `newAdmin`.\r\n *\r\n * Requirements:\r\n *\r\n * - This contract must be the current admin of `proxy`.\r\n */\r\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\r\n proxy.changeAdmin(newAdmin);\r\n }\r\n\r\n /**\r\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\r\n *\r\n * Requirements:\r\n *\r\n * - This contract must be the admin of `proxy`.\r\n */\r\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\r\n proxy.upgradeTo(implementation);\r\n }\r\n\r\n /**\r\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\r\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\r\n *\r\n * Requirements:\r\n *\r\n * - This contract must be the admin of `proxy`.\r\n */\r\n function upgradeAndCall(\r\n TransparentUpgradeableProxy proxy,\r\n address implementation,\r\n bytes memory data\r\n ) public payable virtual onlyOwner {\r\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../ERC1967/ERC1967Proxy.sol\";\r\n\r\n/**\r\n * @dev This contract implements a proxy that is upgradeable by an admin.\r\n *\r\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\r\n * clashing], which can potentially be used in an attack, this contract uses the\r\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\r\n * things that go hand in hand:\r\n *\r\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\r\n * that call matches one of the admin functions exposed by the proxy itself.\r\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\r\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\r\n * \"admin cannot fallback to proxy target\".\r\n *\r\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\r\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\r\n * to sudden errors when trying to call a function from the proxy implementation.\r\n *\r\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\r\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\r\n */\r\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\r\n /**\r\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\r\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\r\n */\r\n constructor(\r\n address _logic,\r\n address admin_,\r\n bytes memory _data\r\n ) payable ERC1967Proxy(_logic, _data) {\r\n _changeAdmin(admin_);\r\n }\r\n\r\n /**\r\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\r\n */\r\n modifier ifAdmin() {\r\n if (msg.sender == _getAdmin()) {\r\n _;\r\n } else {\r\n _fallback();\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\r\n *\r\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\r\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\r\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\r\n */\r\n function admin() external ifAdmin returns (address admin_) {\r\n admin_ = _getAdmin();\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\r\n *\r\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\r\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\r\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\r\n */\r\n function implementation() external ifAdmin returns (address implementation_) {\r\n implementation_ = _implementation();\r\n }\r\n\r\n /**\r\n * @dev Changes the admin of the proxy.\r\n *\r\n * Emits an {AdminChanged} event.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\r\n */\r\n function changeAdmin(address newAdmin) external virtual ifAdmin {\r\n _changeAdmin(newAdmin);\r\n }\r\n\r\n /**\r\n * @dev Upgrade the implementation of the proxy.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\r\n */\r\n function upgradeTo(address newImplementation) external ifAdmin {\r\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\r\n }\r\n\r\n /**\r\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\r\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\r\n * proxied contract.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\r\n */\r\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\r\n _upgradeToAndCall(newImplementation, data, true);\r\n }\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n */\r\n function _admin() internal view virtual returns (address) {\r\n return _getAdmin();\r\n }\r\n\r\n /**\r\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\r\n */\r\n function _beforeFallback() internal virtual override {\r\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\r\n super._beforeFallback();\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n */\r\ninterface IERC20Permit {\r\n /**\r\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n * given ``owner``'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n}\r\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20.sol\";\r\nimport \"../extensions/draft-IERC20Permit.sol\";\r\nimport \"../../../utils/Address.sol\";\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20 {\r\n using Address for address;\r\n\r\n function safeTransfer(\r\n IERC20 token,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n function safeTransferFrom(\r\n IERC20 token,\r\n address from,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n \"SafeERC20: approve from non-zero to non-zero allowance\"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n function safeIncreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n uint256 newAllowance = token.allowance(address(this), spender) + value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n\r\n function safeDecreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\r\n uint256 newAllowance = oldAllowance - value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n }\r\n\r\n function safePermit(\r\n IERC20Permit token,\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) internal {\r\n uint256 nonceBefore = token.nonces(owner);\r\n token.permit(owner, spender, value, deadline, v, r, s);\r\n uint256 nonceAfter = token.nonces(owner);\r\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\r\n if (returndata.length > 0) {\r\n // Return data is optional\r\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length > 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance >= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard math utilities missing in the Solidity language.\r\n */\r\nlibrary Math {\r\n enum Rounding {\r\n Down, // Toward negative infinity\r\n Up, // Toward infinity\r\n Zero // Toward zero\r\n }\r\n\r\n /**\r\n * @dev Returns the largest of two numbers.\r\n */\r\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a > b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two numbers.\r\n */\r\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a < b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two numbers. The result is rounded towards\r\n * zero.\r\n */\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow.\r\n return (a & b) + (a ^ b) / 2;\r\n }\r\n\r\n /**\r\n * @dev Returns the ceiling of the division of two numbers.\r\n *\r\n * This differs from standard division with `/` in that it rounds up instead\r\n * of rounding down.\r\n */\r\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b - 1) / b can overflow on addition, so we distribute.\r\n return a == 0 ? 0 : (a - 1) / b + 1;\r\n }\r\n\r\n /**\r\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\r\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\r\n * with further edits by Uniswap Labs also under MIT license.\r\n */\r\n function mulDiv(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 result) {\r\n unchecked {\r\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\r\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\r\n // variables such that product = prod1 * 2^256 + prod0.\r\n uint256 prod0; // Least significant 256 bits of the product\r\n uint256 prod1; // Most significant 256 bits of the product\r\n assembly {\r\n let mm := mulmod(x, y, not(0))\r\n prod0 := mul(x, y)\r\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\r\n }\r\n\r\n // Handle non-overflow cases, 256 by 256 division.\r\n if (prod1 == 0) {\r\n return prod0 / denominator;\r\n }\r\n\r\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\r\n require(denominator > prod1);\r\n\r\n ///////////////////////////////////////////////\r\n // 512 by 256 division.\r\n ///////////////////////////////////////////////\r\n\r\n // Make division exact by subtracting the remainder from [prod1 prod0].\r\n uint256 remainder;\r\n assembly {\r\n // Compute remainder using mulmod.\r\n remainder := mulmod(x, y, denominator)\r\n\r\n // Subtract 256 bit number from 512 bit number.\r\n prod1 := sub(prod1, gt(remainder, prod0))\r\n prod0 := sub(prod0, remainder)\r\n }\r\n\r\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\r\n // See https://cs.stackexchange.com/q/138556/92363.\r\n\r\n // Does not overflow because the denominator cannot be zero at this stage in the function.\r\n uint256 twos = denominator & (~denominator + 1);\r\n assembly {\r\n // Divide denominator by twos.\r\n denominator := div(denominator, twos)\r\n\r\n // Divide [prod1 prod0] by twos.\r\n prod0 := div(prod0, twos)\r\n\r\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\r\n twos := add(div(sub(0, twos), twos), 1)\r\n }\r\n\r\n // Shift in bits from prod1 into prod0.\r\n prod0 |= prod1 * twos;\r\n\r\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\r\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\r\n // four bits. That is, denominator * inv = 1 mod 2^4.\r\n uint256 inverse = (3 * denominator) ^ 2;\r\n\r\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\r\n // in modular arithmetic, doubling the correct bits in each step.\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\r\n\r\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\r\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\r\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\r\n // is no longer required.\r\n result = prod0 * inverse;\r\n return result;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\r\n */\r\n function mulDiv(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator,\r\n Rounding rounding\r\n ) internal pure returns (uint256) {\r\n uint256 result = mulDiv(x, y, denominator);\r\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\r\n result += 1;\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\r\n *\r\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\r\n */\r\n function sqrt(uint256 a) internal pure returns (uint256) {\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\r\n //\r\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\r\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\r\n //\r\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\r\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\r\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\r\n //\r\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\r\n uint256 result = 1 << (log2(a) >> 1);\r\n\r\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\r\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\r\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\r\n // into the expected uint128 result.\r\n unchecked {\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n return min(result, a / result);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates sqrt(a), following the selected rounding direction.\r\n */\r\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = sqrt(a);\r\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 128;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 64;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 32;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 16;\r\n }\r\n if (value >> 8 > 0) {\r\n value >>= 8;\r\n result += 8;\r\n }\r\n if (value >> 4 > 0) {\r\n value >>= 4;\r\n result += 4;\r\n }\r\n if (value >> 2 > 0) {\r\n value >>= 2;\r\n result += 2;\r\n }\r\n if (value >> 1 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log2(value);\r\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >= 10**64) {\r\n value /= 10**64;\r\n result += 64;\r\n }\r\n if (value >= 10**32) {\r\n value /= 10**32;\r\n result += 32;\r\n }\r\n if (value >= 10**16) {\r\n value /= 10**16;\r\n result += 16;\r\n }\r\n if (value >= 10**8) {\r\n value /= 10**8;\r\n result += 8;\r\n }\r\n if (value >= 10**4) {\r\n value /= 10**4;\r\n result += 4;\r\n }\r\n if (value >= 10**2) {\r\n value /= 10**2;\r\n result += 2;\r\n }\r\n if (value >= 10**1) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log10(value);\r\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 256, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n *\r\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\r\n */\r\n function log256(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 16;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 8;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 4;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 2;\r\n }\r\n if (value >> 8 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log256(value);\r\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\r\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\r\n * checks.\r\n *\r\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\r\n * easily result in undesired exploitation or bugs, since developers usually\r\n * assume that overflows raise errors. `SafeCast` restores this intuition by\r\n * reverting the transaction when such an operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it's recommended to use it always.\r\n *\r\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\r\n * all math on `uint256` and `int256` and then downcasting.\r\n */\r\nlibrary SafeCast {\r\n /**\r\n * @dev Returns the downcasted uint248 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint248).\r\n *\r\n * Counterpart to Solidity's `uint248` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 248 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint248(uint256 value) internal pure returns (uint248) {\r\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\r\n return uint248(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint240 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint240).\r\n *\r\n * Counterpart to Solidity's `uint240` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 240 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint240(uint256 value) internal pure returns (uint240) {\r\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\r\n return uint240(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint232 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint232).\r\n *\r\n * Counterpart to Solidity's `uint232` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 232 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint232(uint256 value) internal pure returns (uint232) {\r\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\r\n return uint232(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint224 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint224).\r\n *\r\n * Counterpart to Solidity's `uint224` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 224 bits\r\n *\r\n * _Available since v4.2._\r\n */\r\n function toUint224(uint256 value) internal pure returns (uint224) {\r\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\r\n return uint224(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint216 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint216).\r\n *\r\n * Counterpart to Solidity's `uint216` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 216 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint216(uint256 value) internal pure returns (uint216) {\r\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\r\n return uint216(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint208 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint208).\r\n *\r\n * Counterpart to Solidity's `uint208` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 208 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint208(uint256 value) internal pure returns (uint208) {\r\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\r\n return uint208(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint200 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint200).\r\n *\r\n * Counterpart to Solidity's `uint200` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 200 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint200(uint256 value) internal pure returns (uint200) {\r\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\r\n return uint200(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint192 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint192).\r\n *\r\n * Counterpart to Solidity's `uint192` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 192 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint192(uint256 value) internal pure returns (uint192) {\r\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\r\n return uint192(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint184 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint184).\r\n *\r\n * Counterpart to Solidity's `uint184` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 184 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint184(uint256 value) internal pure returns (uint184) {\r\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\r\n return uint184(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint176 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint176).\r\n *\r\n * Counterpart to Solidity's `uint176` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 176 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint176(uint256 value) internal pure returns (uint176) {\r\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\r\n return uint176(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint168 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint168).\r\n *\r\n * Counterpart to Solidity's `uint168` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 168 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint168(uint256 value) internal pure returns (uint168) {\r\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\r\n return uint168(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint160 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint160).\r\n *\r\n * Counterpart to Solidity's `uint160` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 160 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint160(uint256 value) internal pure returns (uint160) {\r\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\r\n return uint160(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint152 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint152).\r\n *\r\n * Counterpart to Solidity's `uint152` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 152 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint152(uint256 value) internal pure returns (uint152) {\r\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\r\n return uint152(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint144 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint144).\r\n *\r\n * Counterpart to Solidity's `uint144` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 144 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint144(uint256 value) internal pure returns (uint144) {\r\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\r\n return uint144(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint136 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint136).\r\n *\r\n * Counterpart to Solidity's `uint136` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 136 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint136(uint256 value) internal pure returns (uint136) {\r\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\r\n return uint136(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint128 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint128).\r\n *\r\n * Counterpart to Solidity's `uint128` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 128 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint128(uint256 value) internal pure returns (uint128) {\r\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\r\n return uint128(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint120 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint120).\r\n *\r\n * Counterpart to Solidity's `uint120` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 120 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint120(uint256 value) internal pure returns (uint120) {\r\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\r\n return uint120(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint112 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint112).\r\n *\r\n * Counterpart to Solidity's `uint112` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 112 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint112(uint256 value) internal pure returns (uint112) {\r\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\r\n return uint112(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint104 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint104).\r\n *\r\n * Counterpart to Solidity's `uint104` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 104 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint104(uint256 value) internal pure returns (uint104) {\r\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\r\n return uint104(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint96 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint96).\r\n *\r\n * Counterpart to Solidity's `uint96` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 96 bits\r\n *\r\n * _Available since v4.2._\r\n */\r\n function toUint96(uint256 value) internal pure returns (uint96) {\r\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\r\n return uint96(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint88 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint88).\r\n *\r\n * Counterpart to Solidity's `uint88` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 88 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint88(uint256 value) internal pure returns (uint88) {\r\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\r\n return uint88(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint80 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint80).\r\n *\r\n * Counterpart to Solidity's `uint80` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 80 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint80(uint256 value) internal pure returns (uint80) {\r\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\r\n return uint80(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint72 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint72).\r\n *\r\n * Counterpart to Solidity's `uint72` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 72 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint72(uint256 value) internal pure returns (uint72) {\r\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\r\n return uint72(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint64 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint64).\r\n *\r\n * Counterpart to Solidity's `uint64` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 64 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint64(uint256 value) internal pure returns (uint64) {\r\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\r\n return uint64(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint56 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint56).\r\n *\r\n * Counterpart to Solidity's `uint56` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 56 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint56(uint256 value) internal pure returns (uint56) {\r\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\r\n return uint56(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint48 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint48).\r\n *\r\n * Counterpart to Solidity's `uint48` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 48 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint48(uint256 value) internal pure returns (uint48) {\r\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\r\n return uint48(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint40 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint40).\r\n *\r\n * Counterpart to Solidity's `uint40` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 40 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint40(uint256 value) internal pure returns (uint40) {\r\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\r\n return uint40(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint32 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint32).\r\n *\r\n * Counterpart to Solidity's `uint32` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 32 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint32(uint256 value) internal pure returns (uint32) {\r\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\r\n return uint32(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint24 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint24).\r\n *\r\n * Counterpart to Solidity's `uint24` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 24 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint24(uint256 value) internal pure returns (uint24) {\r\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\r\n return uint24(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint16 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint16).\r\n *\r\n * Counterpart to Solidity's `uint16` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 16 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint16(uint256 value) internal pure returns (uint16) {\r\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\r\n return uint16(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint8 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint8).\r\n *\r\n * Counterpart to Solidity's `uint8` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 8 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint8(uint256 value) internal pure returns (uint8) {\r\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\r\n return uint8(value);\r\n }\r\n\r\n /**\r\n * @dev Converts a signed int256 into an unsigned uint256.\r\n *\r\n * Requirements:\r\n *\r\n * - input must be greater than or equal to 0.\r\n *\r\n * _Available since v3.0._\r\n */\r\n function toUint256(int256 value) internal pure returns (uint256) {\r\n require(value >= 0, \"SafeCast: value must be positive\");\r\n return uint256(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int248 from int256, reverting on\r\n * overflow (when the input is less than smallest int248 or\r\n * greater than largest int248).\r\n *\r\n * Counterpart to Solidity's `int248` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 248 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\r\n downcasted = int248(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int240 from int256, reverting on\r\n * overflow (when the input is less than smallest int240 or\r\n * greater than largest int240).\r\n *\r\n * Counterpart to Solidity's `int240` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 240 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\r\n downcasted = int240(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int232 from int256, reverting on\r\n * overflow (when the input is less than smallest int232 or\r\n * greater than largest int232).\r\n *\r\n * Counterpart to Solidity's `int232` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 232 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\r\n downcasted = int232(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int224 from int256, reverting on\r\n * overflow (when the input is less than smallest int224 or\r\n * greater than largest int224).\r\n *\r\n * Counterpart to Solidity's `int224` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 224 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\r\n downcasted = int224(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int216 from int256, reverting on\r\n * overflow (when the input is less than smallest int216 or\r\n * greater than largest int216).\r\n *\r\n * Counterpart to Solidity's `int216` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 216 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\r\n downcasted = int216(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int208 from int256, reverting on\r\n * overflow (when the input is less than smallest int208 or\r\n * greater than largest int208).\r\n *\r\n * Counterpart to Solidity's `int208` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 208 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\r\n downcasted = int208(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int200 from int256, reverting on\r\n * overflow (when the input is less than smallest int200 or\r\n * greater than largest int200).\r\n *\r\n * Counterpart to Solidity's `int200` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 200 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\r\n downcasted = int200(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int192 from int256, reverting on\r\n * overflow (when the input is less than smallest int192 or\r\n * greater than largest int192).\r\n *\r\n * Counterpart to Solidity's `int192` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 192 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\r\n downcasted = int192(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int184 from int256, reverting on\r\n * overflow (when the input is less than smallest int184 or\r\n * greater than largest int184).\r\n *\r\n * Counterpart to Solidity's `int184` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 184 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\r\n downcasted = int184(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int176 from int256, reverting on\r\n * overflow (when the input is less than smallest int176 or\r\n * greater than largest int176).\r\n *\r\n * Counterpart to Solidity's `int176` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 176 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\r\n downcasted = int176(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int168 from int256, reverting on\r\n * overflow (when the input is less than smallest int168 or\r\n * greater than largest int168).\r\n *\r\n * Counterpart to Solidity's `int168` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 168 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\r\n downcasted = int168(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int160 from int256, reverting on\r\n * overflow (when the input is less than smallest int160 or\r\n * greater than largest int160).\r\n *\r\n * Counterpart to Solidity's `int160` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 160 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\r\n downcasted = int160(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int152 from int256, reverting on\r\n * overflow (when the input is less than smallest int152 or\r\n * greater than largest int152).\r\n *\r\n * Counterpart to Solidity's `int152` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 152 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\r\n downcasted = int152(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int144 from int256, reverting on\r\n * overflow (when the input is less than smallest int144 or\r\n * greater than largest int144).\r\n *\r\n * Counterpart to Solidity's `int144` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 144 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\r\n downcasted = int144(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int136 from int256, reverting on\r\n * overflow (when the input is less than smallest int136 or\r\n * greater than largest int136).\r\n *\r\n * Counterpart to Solidity's `int136` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 136 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\r\n downcasted = int136(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int128 from int256, reverting on\r\n * overflow (when the input is less than smallest int128 or\r\n * greater than largest int128).\r\n *\r\n * Counterpart to Solidity's `int128` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 128 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\r\n downcasted = int128(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int120 from int256, reverting on\r\n * overflow (when the input is less than smallest int120 or\r\n * greater than largest int120).\r\n *\r\n * Counterpart to Solidity's `int120` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 120 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\r\n downcasted = int120(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int112 from int256, reverting on\r\n * overflow (when the input is less than smallest int112 or\r\n * greater than largest int112).\r\n *\r\n * Counterpart to Solidity's `int112` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 112 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\r\n downcasted = int112(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int104 from int256, reverting on\r\n * overflow (when the input is less than smallest int104 or\r\n * greater than largest int104).\r\n *\r\n * Counterpart to Solidity's `int104` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 104 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\r\n downcasted = int104(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int96 from int256, reverting on\r\n * overflow (when the input is less than smallest int96 or\r\n * greater than largest int96).\r\n *\r\n * Counterpart to Solidity's `int96` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 96 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\r\n downcasted = int96(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int88 from int256, reverting on\r\n * overflow (when the input is less than smallest int88 or\r\n * greater than largest int88).\r\n *\r\n * Counterpart to Solidity's `int88` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 88 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\r\n downcasted = int88(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int80 from int256, reverting on\r\n * overflow (when the input is less than smallest int80 or\r\n * greater than largest int80).\r\n *\r\n * Counterpart to Solidity's `int80` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 80 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\r\n downcasted = int80(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int72 from int256, reverting on\r\n * overflow (when the input is less than smallest int72 or\r\n * greater than largest int72).\r\n *\r\n * Counterpart to Solidity's `int72` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 72 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\r\n downcasted = int72(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int64 from int256, reverting on\r\n * overflow (when the input is less than smallest int64 or\r\n * greater than largest int64).\r\n *\r\n * Counterpart to Solidity's `int64` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 64 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\r\n downcasted = int64(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int56 from int256, reverting on\r\n * overflow (when the input is less than smallest int56 or\r\n * greater than largest int56).\r\n *\r\n * Counterpart to Solidity's `int56` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 56 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\r\n downcasted = int56(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int48 from int256, reverting on\r\n * overflow (when the input is less than smallest int48 or\r\n * greater than largest int48).\r\n *\r\n * Counterpart to Solidity's `int48` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 48 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\r\n downcasted = int48(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int40 from int256, reverting on\r\n * overflow (when the input is less than smallest int40 or\r\n * greater than largest int40).\r\n *\r\n * Counterpart to Solidity's `int40` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 40 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\r\n downcasted = int40(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int32 from int256, reverting on\r\n * overflow (when the input is less than smallest int32 or\r\n * greater than largest int32).\r\n *\r\n * Counterpart to Solidity's `int32` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 32 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\r\n downcasted = int32(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int24 from int256, reverting on\r\n * overflow (when the input is less than smallest int24 or\r\n * greater than largest int24).\r\n *\r\n * Counterpart to Solidity's `int24` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 24 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\r\n downcasted = int24(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int16 from int256, reverting on\r\n * overflow (when the input is less than smallest int16 or\r\n * greater than largest int16).\r\n *\r\n * Counterpart to Solidity's `int16` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 16 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\r\n downcasted = int16(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int8 from int256, reverting on\r\n * overflow (when the input is less than smallest int8 or\r\n * greater than largest int8).\r\n *\r\n * Counterpart to Solidity's `int8` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 8 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\r\n downcasted = int8(value);\r\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\r\n }\r\n\r\n /**\r\n * @dev Converts an unsigned uint256 into a signed int256.\r\n *\r\n * Requirements:\r\n *\r\n * - input must be less than or equal to maxInt256.\r\n *\r\n * _Available since v3.0._\r\n */\r\n function toInt256(uint256 value) internal pure returns (int256) {\r\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\r\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\r\n return int256(value);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for reading and writing primitive types to specific storage slots.\r\n *\r\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\r\n * This library helps with reading and writing to such slots without the need for inline assembly.\r\n *\r\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\r\n *\r\n * Example usage to set ERC1967 implementation slot:\r\n * ```\r\n * contract ERC1967 {\r\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r\n *\r\n * function _getImplementation() internal view returns (address) {\r\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\r\n * }\r\n *\r\n * function _setImplementation(address newImplementation) internal {\r\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\r\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\r\n * }\r\n * }\r\n * ```\r\n *\r\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\r\n */\r\nlibrary StorageSlot {\r\n struct AddressSlot {\r\n address value;\r\n }\r\n\r\n struct BooleanSlot {\r\n bool value;\r\n }\r\n\r\n struct Bytes32Slot {\r\n bytes32 value;\r\n }\r\n\r\n struct Uint256Slot {\r\n uint256 value;\r\n }\r\n\r\n /**\r\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\r\n */\r\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\r\n */\r\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\r\n */\r\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\r\n */\r\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./math/Math.sol\";\r\n\r\n/**\r\n * @dev String operations.\r\n */\r\nlibrary Strings {\r\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\r\n uint8 private constant _ADDRESS_LENGTH = 20;\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\r\n */\r\n function toString(uint256 value) internal pure returns (string memory) {\r\n unchecked {\r\n uint256 length = Math.log10(value) + 1;\r\n string memory buffer = new string(length);\r\n uint256 ptr;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n ptr := add(buffer, add(32, length))\r\n }\r\n while (true) {\r\n ptr--;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\r\n }\r\n value /= 10;\r\n if (value == 0) break;\r\n }\r\n return buffer;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(uint256 value) internal pure returns (string memory) {\r\n unchecked {\r\n return toHexString(value, Math.log256(value) + 1);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\r\n */\r\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\r\n bytes memory buffer = new bytes(2 * length + 2);\r\n buffer[0] = \"0\";\r\n buffer[1] = \"x\";\r\n for (uint256 i = 2 * length + 1; i > 1; --i) {\r\n buffer[i] = _SYMBOLS[value & 0xf];\r\n value >>= 4;\r\n }\r\n require(value == 0, \"Strings: hex length insufficient\");\r\n return string(buffer);\r\n }\r\n\r\n /**\r\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(address addr) internal pure returns (string memory) {\r\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\r\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for managing\r\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\r\n * types.\r\n *\r\n * Sets have the following properties:\r\n *\r\n * - Elements are added, removed, and checked for existence in constant time\r\n * (O(1)).\r\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\r\n *\r\n * ```\r\n * contract Example {\r\n * // Add the library methods\r\n * using EnumerableSet for EnumerableSet.AddressSet;\r\n *\r\n * // Declare a set state variable\r\n * EnumerableSet.AddressSet private mySet;\r\n * }\r\n * ```\r\n *\r\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\r\n * and `uint256` (`UintSet`) are supported.\r\n *\r\n * [WARNING]\r\n * ====\r\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\r\n * unusable.\r\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\r\n *\r\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\r\n * array of EnumerableSet.\r\n * ====\r\n */\r\nlibrary EnumerableSet {\r\n // To implement this library for multiple types with as little code\r\n // repetition as possible, we write it in terms of a generic Set type with\r\n // bytes32 values.\r\n // The Set implementation uses private functions, and user-facing\r\n // implementations (such as AddressSet) are just wrappers around the\r\n // underlying Set.\r\n // This means that we can only create new EnumerableSets for types that fit\r\n // in bytes32.\r\n\r\n struct Set {\r\n // Storage of set values\r\n bytes32[] _values;\r\n // Position of the value in the `values` array, plus 1 because index 0\r\n // means a value is not in the set.\r\n mapping(bytes32 => uint256) _indexes;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function _add(Set storage set, bytes32 value) private returns (bool) {\r\n if (!_contains(set, value)) {\r\n set._values.push(value);\r\n // The value is stored at length-1, but we add 1 to all indexes\r\n // and use 0 as a sentinel value\r\n set._indexes[value] = set._values.length;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function _remove(Set storage set, bytes32 value) private returns (bool) {\r\n // We read and store the value's index to prevent multiple reads from the same storage slot\r\n uint256 valueIndex = set._indexes[value];\r\n\r\n if (valueIndex != 0) {\r\n // Equivalent to contains(set, value)\r\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\r\n // the array, and then remove the last element (sometimes called as 'swap and pop').\r\n // This modifies the order of the array, as noted in {at}.\r\n\r\n uint256 toDeleteIndex = valueIndex - 1;\r\n uint256 lastIndex = set._values.length - 1;\r\n\r\n if (lastIndex != toDeleteIndex) {\r\n bytes32 lastValue = set._values[lastIndex];\r\n\r\n // Move the last value to the index where the value to delete is\r\n set._values[toDeleteIndex] = lastValue;\r\n // Update the index for the moved value\r\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\r\n }\r\n\r\n // Delete the slot where the moved value was stored\r\n set._values.pop();\r\n\r\n // Delete the index for the deleted slot\r\n delete set._indexes[value];\r\n\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\r\n return set._indexes[value] != 0;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values on the set. O(1).\r\n */\r\n function _length(Set storage set) private view returns (uint256) {\r\n return set._values.length;\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\r\n return set._values[index];\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function _values(Set storage set) private view returns (bytes32[] memory) {\r\n return set._values;\r\n }\r\n\r\n // Bytes32Set\r\n\r\n struct Bytes32Set {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _add(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _remove(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\r\n return _contains(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(Bytes32Set storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\r\n return _at(set._inner, index);\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n bytes32[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // AddressSet\r\n\r\n struct AddressSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(AddressSet storage set, address value) internal returns (bool) {\r\n return _add(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(AddressSet storage set, address value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(AddressSet storage set, address value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(AddressSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\r\n return address(uint160(uint256(_at(set._inner, index))));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(AddressSet storage set) internal view returns (address[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n address[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // UintSet\r\n\r\n struct UintSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _add(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(UintSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\r\n return uint256(_at(set._inner, index));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(UintSet storage set) internal view returns (uint256[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n uint256[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./PythStructs.sol\";\r\nimport \"./IPythEvents.sol\";\r\n\r\n/// @title Consume prices from the Pyth Network (https://pyth.network/).\r\n/// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely.\r\n/// @author Pyth Data Association\r\ninterface IPyth is IPythEvents {\r\n /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time\r\n function getValidTimePeriod() external view returns (uint validTimePeriod);\r\n\r\n /// @notice Returns the price and confidence interval.\r\n /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.\r\n /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.\r\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\r\n function getPrice(\r\n bytes32 id\r\n ) external view returns (PythStructs.Price memory price);\r\n\r\n /// @notice Returns the exponentially-weighted moving average price and confidence interval.\r\n /// @dev Reverts if the EMA price is not available.\r\n /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.\r\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\r\n function getEmaPrice(\r\n bytes32 id\r\n ) external view returns (PythStructs.Price memory price);\r\n\r\n /// @notice Returns the price of a price feed without any sanity checks.\r\n /// @dev This function returns the most recent price update in this contract without any recency checks.\r\n /// This function is unsafe as the returned price update may be arbitrarily far in the past.\r\n ///\r\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\r\n /// sufficiently recent for their application. If you are considering using this function, it may be\r\n /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.\r\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\r\n function getPriceUnsafe(\r\n bytes32 id\r\n ) external view returns (PythStructs.Price memory price);\r\n\r\n /// @notice Returns the price that is no older than `age` seconds of the current time.\r\n /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in\r\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\r\n /// recently.\r\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\r\n function getPriceNoOlderThan(\r\n bytes32 id,\r\n uint age\r\n ) external view returns (PythStructs.Price memory price);\r\n\r\n /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.\r\n /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.\r\n /// However, if the price is not recent this function returns the latest available price.\r\n ///\r\n /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that\r\n /// the returned price is recent or useful for any particular application.\r\n ///\r\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\r\n /// sufficiently recent for their application. If you are considering using this function, it may be\r\n /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.\r\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\r\n function getEmaPriceUnsafe(\r\n bytes32 id\r\n ) external view returns (PythStructs.Price memory price);\r\n\r\n /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds\r\n /// of the current time.\r\n /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in\r\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\r\n /// recently.\r\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\r\n function getEmaPriceNoOlderThan(\r\n bytes32 id,\r\n uint age\r\n ) external view returns (PythStructs.Price memory price);\r\n\r\n /// @notice Update price feeds with given update messages.\r\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\r\n /// `getUpdateFee` with the length of the `updateData` array.\r\n /// Prices will be updated if they are more recent than the current stored prices.\r\n /// The call will succeed even if the update is not the most recent.\r\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.\r\n /// @param updateData Array of price update data.\r\n function updatePriceFeeds(bytes[] calldata updateData) external payable;\r\n\r\n /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is\r\n /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the\r\n /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.\r\n ///\r\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\r\n /// `getUpdateFee` with the length of the `updateData` array.\r\n ///\r\n /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime\r\n /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have\r\n /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.\r\n /// Otherwise, it calls updatePriceFeeds method to update the prices.\r\n ///\r\n /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.\r\n /// @param updateData Array of price update data.\r\n /// @param priceIds Array of price ids.\r\n /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`\r\n function updatePriceFeedsIfNecessary(\r\n bytes[] calldata updateData,\r\n bytes32[] calldata priceIds,\r\n uint64[] calldata publishTimes\r\n ) external payable;\r\n\r\n /// @notice Returns the required fee to update an array of price updates.\r\n /// @param updateData Array of price update data.\r\n /// @return feeAmount The required fee in Wei.\r\n function getUpdateFee(\r\n bytes[] calldata updateData\r\n ) external view returns (uint feeAmount);\r\n\r\n /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published\r\n /// within `minPublishTime` and `maxPublishTime`.\r\n ///\r\n /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;\r\n /// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain.\r\n ///\r\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\r\n /// `getUpdateFee` with the length of the `updateData` array.\r\n ///\r\n ///\r\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is\r\n /// no update for any of the given `priceIds` within the given time range.\r\n /// @param updateData Array of price update data.\r\n /// @param priceIds Array of price ids.\r\n /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.\r\n /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.\r\n /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).\r\n function parsePriceFeedUpdates(\r\n bytes[] calldata updateData,\r\n bytes32[] calldata priceIds,\r\n uint64 minPublishTime,\r\n uint64 maxPublishTime\r\n ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);\r\n}\r\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPythEvents.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\r\npragma solidity ^0.8.0;\r\n\r\n/// @title IPythEvents contains the events that Pyth contract emits.\r\n/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.\r\ninterface IPythEvents {\r\n /// @dev Emitted when the price feed with `id` has received a fresh update.\r\n /// @param id The Pyth Price Feed ID.\r\n /// @param publishTime Publish time of the given price update.\r\n /// @param price Price of the given price update.\r\n /// @param conf Confidence interval of the given price update.\r\n event PriceFeedUpdate(\r\n bytes32 indexed id,\r\n uint64 publishTime,\r\n int64 price,\r\n uint64 conf\r\n );\r\n\r\n /// @dev Emitted when a batch price update is processed successfully.\r\n /// @param chainId ID of the source chain that the batch price update comes from.\r\n /// @param sequenceNumber Sequence number of the batch price update.\r\n event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);\r\n}\r\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythStructs.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\r\npragma solidity ^0.8.0;\r\n\r\ncontract PythStructs {\r\n // A price with a degree of uncertainty, represented as a price +- a confidence interval.\r\n //\r\n // The confidence interval roughly corresponds to the standard error of a normal distribution.\r\n // Both the price and confidence are stored in a fixed-point numeric representation,\r\n // `x * (10^expo)`, where `expo` is the exponent.\r\n //\r\n // Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how\r\n // to how this price safely.\r\n struct Price {\r\n // Price\r\n int64 price;\r\n // Confidence interval around the price\r\n uint64 conf;\r\n // Price exponent\r\n int32 expo;\r\n // Unix timestamp describing when the price was published\r\n uint publishTime;\r\n }\r\n\r\n // PriceFeed represents a current aggregate price from pyth publisher feeds.\r\n struct PriceFeed {\r\n // The price ID.\r\n bytes32 id;\r\n // Latest available price\r\n Price price;\r\n // Latest available exponentially-weighted moving average price\r\n Price emaPrice;\r\n }\r\n}\r\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/IRateComputer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\n/**\n * @title IRateComputer\n * @notice An interface that defines a contract that computes rates.\n */\ninterface IRateComputer {\n /// @notice Computes the rate for a token.\n /// @param token The address of the token to compute the rate for.\n /// @return rate The rate for the token.\n function computeRate(address token) external view returns (uint64);\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nlibrary PrudentiaLib {\r\n struct PrudentiaConfig {\r\n address controller; // Adrastia Prudentia controller address\r\n uint8 offset; // Offset for delayed rate activation\r\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\r\n }\r\n}\r\n" + }, + "contracts/bridge/hyperlane/interfaces/hooks/IPostDispatchHook.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\r\npragma solidity >=0.8.0;\r\n\r\n/*@@@@@@@ @@@@@@@@@\r\n @@@@@@@@@ @@@@@@@@@\r\n @@@@@@@@@ @@@@@@@@@\r\n @@@@@@@@@ @@@@@@@@@\r\n @@@@@@@@@@@@@@@@@@@@@@@@@\r\n @@@@@ HYPERLANE @@@@@@@\r\n @@@@@@@@@@@@@@@@@@@@@@@@@\r\n @@@@@@@@@ @@@@@@@@@\r\n @@@@@@@@@ @@@@@@@@@\r\n @@@@@@@@@ @@@@@@@@@\r\n@@@@@@@@@ @@@@@@@@*/\r\n\r\ninterface IPostDispatchHook {\r\n enum Types {\r\n UNUSED,\r\n ROUTING,\r\n AGGREGATION,\r\n MERKLE_TREE,\r\n INTERCHAIN_GAS_PAYMASTER,\r\n FALLBACK_ROUTING,\r\n ID_AUTH_ISM,\r\n PAUSABLE,\r\n PROTOCOL_FEE,\r\n LAYER_ZERO_V1,\r\n RATE_LIMITED,\r\n ARB_L2_TO_L1,\r\n OP_L2_TO_L1\r\n }\r\n\r\n /**\r\n * @notice Returns an enum that represents the type of hook\r\n */\r\n function hookType() external view returns (uint8);\r\n\r\n /**\r\n * @notice Returns whether the hook supports metadata\r\n * @param metadata metadata\r\n * @return Whether the hook supports metadata\r\n */\r\n function supportsMetadata(\r\n bytes calldata metadata\r\n ) external view returns (bool);\r\n\r\n /**\r\n * @notice Post action after a message is dispatched via the Mailbox\r\n * @param metadata The metadata required for the hook\r\n * @param message The message passed from the Mailbox.dispatch() call\r\n */\r\n function postDispatch(\r\n bytes calldata metadata,\r\n bytes calldata message\r\n ) external payable;\r\n\r\n /**\r\n * @notice Compute the payment required by the postDispatch call\r\n * @param metadata The metadata required for the hook\r\n * @param message The message passed from the Mailbox.dispatch() call\r\n * @return Quoted payment for the postDispatch call\r\n */\r\n function quoteDispatch(\r\n bytes calldata metadata,\r\n bytes calldata message\r\n ) external view returns (uint256);\r\n}" + }, + "contracts/bridge/hyperlane/interfaces/IInterchainSecurityModule.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\r\npragma solidity >=0.6.11;\r\n\r\ninterface IInterchainSecurityModule {\r\n enum Types {\r\n UNUSED,\r\n ROUTING,\r\n AGGREGATION,\r\n LEGACY_MULTISIG,\r\n MERKLE_ROOT_MULTISIG,\r\n MESSAGE_ID_MULTISIG,\r\n NULL, // used with relayer carrying no metadata\r\n CCIP_READ,\r\n ARB_L2_TO_L1,\r\n WEIGHTED_MERKLE_ROOT_MULTISIG,\r\n WEIGHTED_MESSAGE_ID_MULTISIG,\r\n OP_L2_TO_L1\r\n }\r\n\r\n /**\r\n * @notice Returns an enum that represents the type of security model\r\n * encoded by this ISM.\r\n * @dev Relayers infer how to fetch and format metadata.\r\n */\r\n function moduleType() external view returns (uint8);\r\n\r\n /**\r\n * @notice Defines a security model responsible for verifying interchain\r\n * messages based on the provided metadata.\r\n * @param _metadata Off-chain metadata provided by a relayer, specific to\r\n * the security model encoded by the module (e.g. validator signatures)\r\n * @param _message Hyperlane encoded interchain message\r\n * @return True if the message was verified\r\n */\r\n function verify(\r\n bytes calldata _metadata,\r\n bytes calldata _message\r\n ) external returns (bool);\r\n}\r\n\r\ninterface ISpecifiesInterchainSecurityModule {\r\n function interchainSecurityModule()\r\n external\r\n view\r\n returns (IInterchainSecurityModule);\r\n}" + }, + "contracts/bridge/hyperlane/interfaces/IMailbox.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\r\npragma solidity >=0.8.0;\r\n\r\nimport {IInterchainSecurityModule} from \"./IInterchainSecurityModule.sol\";\r\nimport {IPostDispatchHook} from \"./hooks/IPostDispatchHook.sol\";\r\n\r\ninterface IMailbox {\r\n // ============ Events ============\r\n /**\r\n * @notice Emitted when a new message is dispatched via Hyperlane\r\n * @param sender The address that dispatched the message\r\n * @param destination The destination domain of the message\r\n * @param recipient The message recipient address on `destination`\r\n * @param message Raw bytes of message\r\n */\r\n event Dispatch(\r\n address indexed sender,\r\n uint32 indexed destination,\r\n bytes32 indexed recipient,\r\n bytes message\r\n );\r\n\r\n /**\r\n * @notice Emitted when a new message is dispatched via Hyperlane\r\n * @param messageId The unique message identifier\r\n */\r\n event DispatchId(bytes32 indexed messageId);\r\n\r\n /**\r\n * @notice Emitted when a Hyperlane message is processed\r\n * @param messageId The unique message identifier\r\n */\r\n event ProcessId(bytes32 indexed messageId);\r\n\r\n /**\r\n * @notice Emitted when a Hyperlane message is delivered\r\n * @param origin The origin domain of the message\r\n * @param sender The message sender address on `origin`\r\n * @param recipient The address that handled the message\r\n */\r\n event Process(\r\n uint32 indexed origin,\r\n bytes32 indexed sender,\r\n address indexed recipient\r\n );\r\n\r\n function localDomain() external view returns (uint32);\r\n\r\n function delivered(bytes32 messageId) external view returns (bool);\r\n\r\n function defaultIsm() external view returns (IInterchainSecurityModule);\r\n\r\n function defaultHook() external view returns (IPostDispatchHook);\r\n\r\n function requiredHook() external view returns (IPostDispatchHook);\r\n\r\n function latestDispatchedId() external view returns (bytes32);\r\n\r\n function dispatch(\r\n uint32 destinationDomain,\r\n bytes32 recipientAddress,\r\n bytes calldata messageBody\r\n ) external payable returns (bytes32 messageId);\r\n\r\n function quoteDispatch(\r\n uint32 destinationDomain,\r\n bytes32 recipientAddress,\r\n bytes calldata messageBody\r\n ) external view returns (uint256 fee);\r\n\r\n function dispatch(\r\n uint32 destinationDomain,\r\n bytes32 recipientAddress,\r\n bytes calldata body,\r\n bytes calldata defaultHookMetadata\r\n ) external payable returns (bytes32 messageId);\r\n\r\n function quoteDispatch(\r\n uint32 destinationDomain,\r\n bytes32 recipientAddress,\r\n bytes calldata messageBody,\r\n bytes calldata defaultHookMetadata\r\n ) external view returns (uint256 fee);\r\n\r\n function dispatch(\r\n uint32 destinationDomain,\r\n bytes32 recipientAddress,\r\n bytes calldata body,\r\n bytes calldata customHookMetadata,\r\n IPostDispatchHook customHook\r\n ) external payable returns (bytes32 messageId);\r\n\r\n function quoteDispatch(\r\n uint32 destinationDomain,\r\n bytes32 recipientAddress,\r\n bytes calldata messageBody,\r\n bytes calldata customHookMetadata,\r\n IPostDispatchHook customHook\r\n ) external view returns (uint256 fee);\r\n\r\n function process(\r\n bytes calldata metadata,\r\n bytes calldata message\r\n ) external payable;\r\n\r\n function recipientIsm(\r\n address recipient\r\n ) external view returns (IInterchainSecurityModule module);\r\n}" + }, + "contracts/bridge/interface/IXERC20.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.4 <0.9.0;\r\n\r\ninterface IXERC20 {\r\n /**\r\n * @notice Emits when a lockbox is set\r\n *\r\n * @param _lockbox The address of the lockbox\r\n */\r\n event LockboxSet(address _lockbox);\r\n\r\n /**\r\n * @notice Emits when a limit is set\r\n *\r\n * @param _mintingLimit The updated minting limit we are setting to the bridge\r\n * @param _burningLimit The updated burning limit we are setting to the bridge\r\n * @param _bridge The address of the bridge we are setting the limit too\r\n */\r\n event BridgeLimitsSet(uint256 _mintingLimit, uint256 _burningLimit, address indexed _bridge);\r\n\r\n /**\r\n * @notice Reverts when a user with too low of a limit tries to call mint/burn\r\n */\r\n error IXERC20_NotHighEnoughLimits();\r\n\r\n /**\r\n * @notice Reverts when caller is not the factory\r\n */\r\n error IXERC20_NotFactory();\r\n\r\n /**\r\n * @notice Reverts when limits are too high\r\n */\r\n error IXERC20_LimitsTooHigh();\r\n\r\n /**\r\n * @notice Contains the full minting and burning data for a particular bridge\r\n *\r\n * @param minterParams The minting parameters for the bridge\r\n * @param burnerParams The burning parameters for the bridge\r\n */\r\n struct Bridge {\r\n BridgeParameters minterParams;\r\n BridgeParameters burnerParams;\r\n }\r\n\r\n /**\r\n * @notice Contains the mint or burn parameters for a bridge\r\n *\r\n * @param timestamp The timestamp of the last mint/burn\r\n * @param ratePerSecond The rate per second of the bridge\r\n * @param maxLimit The max limit of the bridge\r\n * @param currentLimit The current limit of the bridge\r\n */\r\n struct BridgeParameters {\r\n uint256 timestamp;\r\n uint256 ratePerSecond;\r\n uint256 maxLimit;\r\n uint256 currentLimit;\r\n }\r\n\r\n /**\r\n * @notice Sets the lockbox address\r\n *\r\n * @param _lockbox The address of the lockbox\r\n */\r\n function setLockbox(address _lockbox) external;\r\n\r\n /**\r\n * @notice Updates the limits of any bridge\r\n * @dev Can only be called by the owner\r\n * @param _mintingLimit The updated minting limit we are setting to the bridge\r\n * @param _burningLimit The updated burning limit we are setting to the bridge\r\n * @param _bridge The address of the bridge we are setting the limits too\r\n */\r\n function setLimits(address _bridge, uint256 _mintingLimit, uint256 _burningLimit) external;\r\n\r\n /**\r\n * @notice Returns the max limit of a minter\r\n *\r\n * @param _minter The minter we are viewing the limits of\r\n * @return _limit The limit the minter has\r\n */\r\n function mintingMaxLimitOf(address _minter) external view returns (uint256 _limit);\r\n\r\n /**\r\n * @notice Returns the max limit of a bridge\r\n *\r\n * @param _bridge the bridge we are viewing the limits of\r\n * @return _limit The limit the bridge has\r\n */\r\n function burningMaxLimitOf(address _bridge) external view returns (uint256 _limit);\r\n\r\n /**\r\n * @notice Returns the current limit of a minter\r\n *\r\n * @param _minter The minter we are viewing the limits of\r\n * @return _limit The limit the minter has\r\n */\r\n function mintingCurrentLimitOf(address _minter) external view returns (uint256 _limit);\r\n\r\n /**\r\n * @notice Returns the current limit of a bridge\r\n *\r\n * @param _bridge the bridge we are viewing the limits of\r\n * @return _limit The limit the bridge has\r\n */\r\n function burningCurrentLimitOf(address _bridge) external view returns (uint256 _limit);\r\n\r\n /**\r\n * @notice Mints tokens for a user\r\n * @dev Can only be called by a minter\r\n * @param _user The address of the user who needs tokens minted\r\n * @param _amount The amount of tokens being minted\r\n */\r\n function mint(address _user, uint256 _amount) external;\r\n\r\n /**\r\n * @notice Burns tokens for a user\r\n * @dev Can only be called by a minter\r\n * @param _user The address of the user who needs tokens burned\r\n * @param _amount The amount of tokens being burned\r\n */\r\n function burn(address _user, uint256 _amount) external;\r\n}" + }, + "contracts/bridge/xERC20Hyperlane.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.22;\r\n\r\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IXERC20 } from \"./interface/IXERC20.sol\";\r\nimport { IMailbox } from \"./hyperlane/interfaces/IMailbox.sol\";\r\n\r\nlibrary TypeCasts {\r\n // alignment preserving cast\r\n function addressToBytes32(address _addr) internal pure returns (bytes32) {\r\n return bytes32(uint256(uint160(_addr)));\r\n }\r\n\r\n // alignment preserving cast\r\n function bytes32ToAddress(bytes32 _buf) internal pure returns (address) {\r\n return address(uint160(uint256(_buf)));\r\n }\r\n}\r\n\r\ncontract xERC20Hyperlane is Ownable {\r\n using TypeCasts for address;\r\n using TypeCasts for bytes32;\r\n\r\n uint256 public feeBps;\r\n mapping(address => mapping(uint32 => address)) public mappedTokens;\r\n mapping(uint32 => address) public mappedBridges;\r\n IMailbox immutable mailbox;\r\n\r\n event TokenMapped(address indexed _token, uint32 indexed _chainId, address indexed _dstToken);\r\n event BridgeMapped(uint32 indexed _chainId, address indexed _bridge);\r\n event FeeBpsSet(uint256 indexed _feeBps);\r\n event TokenSent(\r\n address indexed _token,\r\n uint256 _amount,\r\n address indexed _to,\r\n uint32 indexed _dstChainId,\r\n bytes32 _guid\r\n );\r\n event TokenReceived(\r\n address indexed _token,\r\n uint256 _amount,\r\n address indexed _to,\r\n uint32 indexed _srcChainId,\r\n bytes32 _guid\r\n );\r\n\r\n error TokenNotSet();\r\n error ChainIdNotSet();\r\n error DestinationBridgeNotSet(uint32 _chainId);\r\n error OriginNotAllowed(uint32 _chainId, address _sender);\r\n\r\n /**\r\n * @notice Only accept messages from an Hyperlane Mailbox contract\r\n */\r\n modifier onlyMailbox() {\r\n require(msg.sender == address(mailbox), \"MailboxClient: sender not mailbox\");\r\n _;\r\n }\r\n\r\n constructor(uint256 _feeBps, address _mailbox) Ownable() {\r\n mailbox = IMailbox(_mailbox);\r\n feeBps = _feeBps;\r\n }\r\n\r\n // ADMIN FUNCTIONS\r\n function setFeeBps(uint256 _feeBps) public onlyOwner {\r\n feeBps = _feeBps;\r\n emit FeeBpsSet(_feeBps);\r\n }\r\n\r\n function setMappedToken(uint32 _chainId, address _srcToken, address _dstToken) public onlyOwner {\r\n mappedTokens[_srcToken][_chainId] = _dstToken;\r\n emit TokenMapped(_srcToken, _chainId, _dstToken);\r\n }\r\n\r\n function setMappedBridge(uint32 _chainId, address _bridge) public onlyOwner {\r\n mappedBridges[_chainId] = _bridge;\r\n emit BridgeMapped(_chainId, _bridge);\r\n }\r\n\r\n function withdrawFee(address _token) public onlyOwner {\r\n uint256 _amount = IERC20(_token).balanceOf(address(this));\r\n IERC20(_token).transfer(msg.sender, _amount);\r\n }\r\n\r\n function withdrawFee(address _token, uint256 _amount) public onlyOwner {\r\n IERC20(_token).transfer(msg.sender, _amount);\r\n }\r\n\r\n function withdrawEth() public onlyOwner {\r\n uint256 _amount = address(this).balance;\r\n payable(msg.sender).transfer(_amount);\r\n }\r\n\r\n function withdrawEth(uint256 _amount) public onlyOwner {\r\n payable(msg.sender).transfer(_amount);\r\n }\r\n\r\n // PUBLIC FUNCTIONS\r\n function quote(uint32 _dstChainId, address _token, uint256 _amount, address _to) external view returns (uint256 fee) {\r\n return _quoteInternal(_dstChainId, _token, _amount, _to);\r\n }\r\n\r\n function send(address _token, uint256 _amount, address _to, uint32 _dstChainId) external payable {\r\n _send(_dstChainId, _token, _amount, _to);\r\n }\r\n\r\n // INTERNAL FUNCTIONS\r\n function _quoteInternal(\r\n uint32 _dstChainId,\r\n address _token,\r\n uint256 _amount,\r\n address _to\r\n ) internal view returns (uint256 fee) {\r\n address _bridge = mappedBridges[_dstChainId];\r\n if (_bridge == address(0)) {\r\n revert DestinationBridgeNotSet(_dstChainId);\r\n }\r\n uint256 _amountAfterFee = (_amount * (10000 - feeBps)) / 10000;\r\n bytes memory _payload = abi.encode(_to, _token, _amountAfterFee);\r\n fee = mailbox.quoteDispatch(_dstChainId, _bridge.addressToBytes32(), _payload);\r\n return fee;\r\n }\r\n\r\n function _send(uint32 _dstChainId, address _token, uint256 _amount, address _to) internal {\r\n address _bridge = mappedBridges[_dstChainId];\r\n if (_bridge == address(0)) {\r\n revert DestinationBridgeNotSet(_dstChainId);\r\n }\r\n // transfer tokens to this contract\r\n IERC20(_token).transferFrom(msg.sender, address(this), _amount);\r\n\r\n // take fee and burn the tokens\r\n uint256 _amountAfterFee = (_amount * (10000 - feeBps)) / 10000;\r\n IXERC20(_token).burn(address(this), _amountAfterFee);\r\n\r\n bytes memory _payload = abi.encode(_to, _token, _amountAfterFee);\r\n bytes32 _guid = mailbox.dispatch{ value: msg.value }(_dstChainId, _bridge.addressToBytes32(), _payload);\r\n emit TokenSent(_token, _amountAfterFee, _to, _dstChainId, _guid);\r\n }\r\n\r\n function handle(uint32 _origin, bytes32 _sender, bytes calldata _data) external payable virtual onlyMailbox {\r\n if (mappedBridges[_origin] != _sender.bytes32ToAddress()) {\r\n revert OriginNotAllowed(_origin, _sender.bytes32ToAddress());\r\n }\r\n // Decode the payload to get the message\r\n (address _to, address _srcToken, uint256 _amount) = abi.decode(_data, (address, address, uint256));\r\n\r\n // get the mapped token using the current chain id and received source token\r\n address _dstToken = mappedTokens[_srcToken][_origin];\r\n if (_dstToken == address(0)) {\r\n revert TokenNotSet();\r\n }\r\n\r\n // mint the tokens to the destination address\r\n IXERC20(_dstToken).mint(_to, _amount);\r\n emit TokenReceived(_dstToken, _amount, _to, _origin, bytes32(0));\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" + }, + "contracts/bridge/xERC20LayerZero.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.22;\r\n\r\nimport { OApp, Origin, MessagingFee, MessagingReceipt } from \"@layerzerolabs/oapp-evm/contracts/oapp/OApp.sol\";\r\nimport { OptionsBuilder } from \"@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol\";\r\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IXERC20 } from \"./interface/IXERC20.sol\";\r\n\r\ncontract xERC20LayerZero is Ownable, OApp {\r\n using OptionsBuilder for bytes;\r\n\r\n uint256 public feeBps;\r\n mapping(address => mapping(uint32 => address)) public mappedTokens;\r\n mapping(uint32 => uint32) public chainIdToEid;\r\n mapping(uint32 => uint32) public eidToChainId;\r\n\r\n event TokenMapped(address indexed _token, uint32 indexed _chainId, address indexed _dstToken);\r\n event ChainIdToEidSet(uint32 indexed _chainId, uint32 indexed _eid);\r\n event EidToChainIdSet(uint32 indexed _eid, uint32 indexed _chainId);\r\n event FeeBpsSet(uint256 indexed _feeBps);\r\n event TokenSent(\r\n address indexed _token,\r\n uint256 _amount,\r\n address indexed _to,\r\n uint32 indexed _dstChainId,\r\n bytes32 _guid\r\n );\r\n event TokenReceived(\r\n address indexed _token,\r\n uint256 _amount,\r\n address indexed _to,\r\n uint32 indexed _srcChainId,\r\n bytes32 _guid\r\n );\r\n\r\n error TokenNotSet();\r\n error ChainIdNotSet();\r\n error OriginNotMirrorAdapter();\r\n\r\n constructor(uint256 _feeBps, address _endpoint) OApp(_endpoint, msg.sender) Ownable() {\r\n feeBps = _feeBps;\r\n\r\n // known chain ids\r\n // Set initial chain ID to EID mappings\r\n setChainIdToEid(8453, 30184); // base\r\n setChainIdToEid(10, 30111); // optimism\r\n setChainIdToEid(252, 30255); // fraxtal\r\n setChainIdToEid(60808, 30279); // bob\r\n setChainIdToEid(34443, 30260); // mode\r\n\r\n // Set initial EID to chain ID mappings\r\n setEidToChainId(30184, 8453); // base\r\n setEidToChainId(30111, 10); // optimism\r\n setEidToChainId(30255, 252); // fraxtal\r\n setEidToChainId(30279, 60808); // bob\r\n setEidToChainId(30260, 34443); // mode\r\n }\r\n\r\n // ADMIN FUNCTIONS\r\n function setFeeBps(uint256 _feeBps) public onlyOwner {\r\n feeBps = _feeBps;\r\n emit FeeBpsSet(_feeBps);\r\n }\r\n\r\n function setMappedToken(uint32 _chainId, address _srcToken, address _dstToken) public onlyOwner {\r\n mappedTokens[_srcToken][_chainId] = _dstToken;\r\n emit TokenMapped(_srcToken, _chainId, _dstToken);\r\n }\r\n\r\n function setChainIdToEid(uint32 _chainId, uint32 _eid) public onlyOwner {\r\n chainIdToEid[_chainId] = _eid;\r\n emit ChainIdToEidSet(_chainId, _eid);\r\n }\r\n\r\n function setEidToChainId(uint32 _eid, uint32 _chainId) public onlyOwner {\r\n eidToChainId[_eid] = _chainId;\r\n emit EidToChainIdSet(_eid, _chainId);\r\n }\r\n\r\n function withdrawFee(address _token) public onlyOwner {\r\n uint256 _amount = IERC20(_token).balanceOf(address(this));\r\n IERC20(_token).transfer(msg.sender, _amount);\r\n }\r\n\r\n function withdrawFee(address _token, uint256 _amount) public onlyOwner {\r\n IERC20(_token).transfer(msg.sender, _amount);\r\n }\r\n\r\n function withdrawEth() public onlyOwner {\r\n uint256 _amount = address(this).balance;\r\n payable(msg.sender).transfer(_amount);\r\n }\r\n\r\n function withdrawEth(uint256 _amount) public onlyOwner {\r\n payable(msg.sender).transfer(_amount);\r\n }\r\n\r\n // PUBLIC FUNCTIONS\r\n function quote(\r\n uint32 _dstChainId,\r\n address _token,\r\n uint256 _amount,\r\n address _to\r\n ) external view returns (uint256 nativeFee, uint256 zroFee) {\r\n bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(50000, 0);\r\n return _quoteInternal(_dstChainId, _token, _amount, _to, options, false);\r\n }\r\n\r\n function quote(\r\n uint32 _dstChainId, // destination endpoint id\r\n address _token,\r\n uint256 _amount,\r\n address _to,\r\n bytes memory _options, // your message execution options\r\n bool _payInLzToken // boolean for which token to return fee in\r\n ) external view returns (uint256 nativeFee, uint256 zroFee) {\r\n return _quoteInternal(_dstChainId, _token, _amount, _to, _options, _payInLzToken);\r\n }\r\n\r\n function send(\r\n address _token,\r\n uint256 _amount,\r\n address _to,\r\n uint32 _dstChainId\r\n ) external payable {\r\n bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(50000, 0);\r\n _send(_dstChainId, _token, _amount, _to, options);\r\n }\r\n\r\n /**\r\n * @notice Sends tokens to a destination chain\r\n *\r\n * @param _token The token to send\r\n * @param _amount The amount of tokens to send\r\n * @param _to The address to send the tokens to\r\n * @param _dstChainId The destination chain id\r\n * @param _options The options to send the tokens with\r\n */\r\n function send(\r\n address _token,\r\n uint256 _amount,\r\n address _to,\r\n uint32 _dstChainId,\r\n bytes calldata _options\r\n ) external payable {\r\n _send(_dstChainId, _token, _amount, _to, _options);\r\n }\r\n\r\n // INTERNAL FUNCTIONS\r\n function _quoteInternal(\r\n uint32 _dstChainId,\r\n address _token,\r\n uint256 _amount,\r\n address _to,\r\n bytes memory _options,\r\n bool _payInLzToken\r\n ) internal view returns (uint256 nativeFee, uint256 zroFee) {\r\n uint32 _dstEid = chainIdToEid[_dstChainId];\r\n if (_dstEid == 0) {\r\n revert ChainIdNotSet();\r\n }\r\n uint256 _amountAfterFee = (_amount * (10000 - feeBps)) / 10000;\r\n bytes memory _payload = abi.encode(_to, _token, _amountAfterFee);\r\n MessagingFee memory fee = _quote(_dstEid, _payload, _options, _payInLzToken);\r\n return (fee.nativeFee, fee.lzTokenFee);\r\n }\r\n\r\n function _send(\r\n uint32 _dstChainId,\r\n address _token,\r\n uint256 _amount,\r\n address _to,\r\n bytes memory _options\r\n ) internal {\r\n uint32 _dstEid = chainIdToEid[_dstChainId];\r\n if (_dstEid == 0) {\r\n revert ChainIdNotSet();\r\n }\r\n\r\n // transfer tokens to this contract\r\n IERC20(_token).transferFrom(msg.sender, address(this), _amount);\r\n\r\n // take fee and burn the tokens\r\n uint256 _amountAfterFee = (_amount * (10000 - feeBps)) / 10000;\r\n IXERC20(_token).burn(address(this), _amountAfterFee);\r\n\r\n bytes memory _payload = abi.encode(_to, _token, _amountAfterFee);\r\n MessagingReceipt memory _receipt = _lzSend(\r\n _dstEid,\r\n _payload,\r\n _options,\r\n // Fee in native gas and ZRO token.\r\n MessagingFee(msg.value, 0),\r\n // Refund address in case of failed source message.\r\n payable(msg.sender)\r\n );\r\n emit TokenSent(_token, _amountAfterFee, _to, _dstChainId, _receipt.guid);\r\n }\r\n\r\n // LAYERZERO FUNCTIONS\r\n /**\r\n * @dev Called when data is received from the protocol. It overrides the equivalent function in the parent contract.\r\n * Protocol messages are defined as packets, comprised of the following parameters.\r\n * @param _origin A struct containing information about where the packet came from.\r\n * @param _guid A global unique identifier for tracking the packet.\r\n * @param payload Encoded message.\r\n */\r\n function _lzReceive(\r\n Origin calldata _origin,\r\n bytes32 _guid,\r\n bytes calldata payload,\r\n address, // Executor address as specified by the OApp.\r\n bytes calldata // Any extra data or options to trigger on receipt.\r\n ) internal override {\r\n // Decode the payload to get the message\r\n (address _to, address _srcToken, uint256 _amount) = abi.decode(payload, (address, address, uint256));\r\n\r\n uint32 _srcChainId = eidToChainId[_origin.srcEid];\r\n // get the mapped token using the current chain id and received source token\r\n address _dstToken = mappedTokens[_srcToken][_srcChainId];\r\n if (_dstToken == address(0)) {\r\n revert TokenNotSet();\r\n }\r\n\r\n // mint the tokens to the destination address\r\n IXERC20(_dstToken).mint(_to, _amount);\r\n emit TokenReceived(_dstToken, _amount, _to, _srcChainId, _guid);\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Careful Math\r\n * @author Compound\r\n * @notice Derived from OpenZeppelin's SafeMath library\r\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\r\n */\r\ncontract CarefulMath {\r\n /**\r\n * @dev Possible error codes that we can return\r\n */\r\n enum MathError {\r\n NO_ERROR,\r\n DIVISION_BY_ZERO,\r\n INTEGER_OVERFLOW,\r\n INTEGER_UNDERFLOW\r\n }\r\n\r\n /**\r\n * @dev Multiplies two numbers, returns an error on overflow.\r\n */\r\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n if (a == 0) {\r\n return (MathError.NO_ERROR, 0);\r\n }\r\n\r\n uint256 c;\r\n unchecked {\r\n c = a * b;\r\n }\r\n\r\n if (c / a != b) {\r\n return (MathError.INTEGER_OVERFLOW, 0);\r\n } else {\r\n return (MathError.NO_ERROR, c);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Integer division of two numbers, truncating the quotient.\r\n */\r\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n if (b == 0) {\r\n return (MathError.DIVISION_BY_ZERO, 0);\r\n }\r\n\r\n return (MathError.NO_ERROR, a / b);\r\n }\r\n\r\n /**\r\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\r\n */\r\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n if (b <= a) {\r\n return (MathError.NO_ERROR, a - b);\r\n } else {\r\n return (MathError.INTEGER_UNDERFLOW, 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Adds two numbers, returns an error on overflow.\r\n */\r\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n uint256 c;\r\n unchecked {\r\n c = a + b;\r\n }\r\n\r\n if (c >= a) {\r\n return (MathError.NO_ERROR, c);\r\n } else {\r\n return (MathError.INTEGER_OVERFLOW, 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev add a and b and then subtract c\r\n */\r\n function addThenSubUInt(\r\n uint256 a,\r\n uint256 b,\r\n uint256 c\r\n ) internal pure returns (MathError, uint256) {\r\n (MathError err0, uint256 sum) = addUInt(a, b);\r\n\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, 0);\r\n }\r\n\r\n return subUInt(sum, c);\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CToken.sol\";\r\n\r\n/**\r\n * @title Compound's CErc20Delegate Contract\r\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\r\n * @author Compound\r\n */\r\ncontract CErc20Delegate is CErc20 {\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 3;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /**\r\n * @notice Called by the delegator on a delegate to initialize it for duty\r\n */\r\n function _becomeImplementation(bytes memory) public virtual override {\r\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 1;\r\n }\r\n\r\n function contractType() external pure virtual override returns (string memory) {\r\n return \"CErc20Delegate\";\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20Delegator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./ComptrollerInterface.sol\";\r\nimport \"./InterestRateModel.sol\";\r\nimport \"../ionic/DiamondExtension.sol\";\r\nimport { CErc20DelegatorBase, CDelegateInterface } from \"./CTokenInterfaces.sol\";\r\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\r\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\r\n\r\n/**\r\n * @title Compound's CErc20Delegator Contract\r\n * @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation\r\n * @author Compound\r\n */\r\ncontract CErc20Delegator is CErc20DelegatorBase, DiamondBase {\r\n /**\r\n * @notice Emitted when implementation is changed\r\n */\r\n event NewImplementation(address oldImplementation, address newImplementation);\r\n\r\n /**\r\n * @notice Initialize the new money market\r\n * @param underlying_ The address of the underlying asset\r\n * @param comptroller_ The address of the Comptroller\r\n * @param ionicAdmin_ The FeeDistributor contract address.\r\n * @param interestRateModel_ The address of the interest rate model\r\n * @param name_ ERC-20 name of this token\r\n * @param symbol_ ERC-20 symbol of this token\r\n */\r\n constructor(\r\n address underlying_,\r\n IonicComptroller comptroller_,\r\n address payable ionicAdmin_,\r\n InterestRateModel interestRateModel_,\r\n string memory name_,\r\n string memory symbol_,\r\n uint256 reserveFactorMantissa_,\r\n uint256 adminFeeMantissa_\r\n ) {\r\n require(msg.sender == ionicAdmin_, \"!admin\");\r\n uint8 decimals_ = EIP20Interface(underlying_).decimals();\r\n {\r\n ionicAdmin = ionicAdmin_;\r\n\r\n // Set initial exchange rate\r\n initialExchangeRateMantissa = 0.2e18;\r\n\r\n // Set the comptroller\r\n comptroller = comptroller_;\r\n\r\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\r\n accrualBlockNumber = block.number;\r\n borrowIndex = 1e18;\r\n\r\n // Set the interest rate model (depends on block number / borrow index)\r\n require(interestRateModel_.isInterestRateModel(), \"!notIrm\");\r\n interestRateModel = interestRateModel_;\r\n emit NewMarketInterestRateModel(InterestRateModel(address(0)), interestRateModel_);\r\n\r\n name = name_;\r\n symbol = symbol_;\r\n decimals = decimals_;\r\n\r\n // Set reserve factor\r\n // Check newReserveFactor ≤ maxReserveFactor\r\n require(\r\n reserveFactorMantissa_ + adminFeeMantissa + ionicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\r\n \"!rf:set\"\r\n );\r\n reserveFactorMantissa = reserveFactorMantissa_;\r\n emit NewReserveFactor(0, reserveFactorMantissa_);\r\n\r\n // Set admin fee\r\n // Sanitize adminFeeMantissa_\r\n if (adminFeeMantissa_ == type(uint256).max) adminFeeMantissa_ = adminFeeMantissa;\r\n // Get latest Ionic fee\r\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\r\n require(\r\n reserveFactorMantissa + adminFeeMantissa_ + newIonicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\r\n \"!adminFee:set\"\r\n );\r\n adminFeeMantissa = adminFeeMantissa_;\r\n emit NewAdminFee(0, adminFeeMantissa_);\r\n ionicFeeMantissa = newIonicFeeMantissa;\r\n emit NewIonicFee(0, newIonicFeeMantissa);\r\n\r\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\r\n _notEntered = true;\r\n }\r\n\r\n // Set underlying and sanity check it\r\n underlying = underlying_;\r\n EIP20Interface(underlying).totalSupply();\r\n }\r\n\r\n function implementation() public view returns (address) {\r\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"delegateType()\"))));\r\n }\r\n\r\n /**\r\n * @notice Called by the admin to update the implementation of the delegator\r\n * @param implementation_ The address of the new implementation for delegation\r\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\r\n */\r\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external override {\r\n // Check admin rights\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n // Set implementation\r\n _setImplementationInternal(implementation_, becomeImplementationData);\r\n }\r\n\r\n /**\r\n * @dev upgrades the implementation if necessary\r\n */\r\n function _upgrade() external override {\r\n require(msg.sender == address(this) || hasAdminRights(), \"!self or admin\");\r\n\r\n (bool success, bytes memory data) = address(this).staticcall(abi.encodeWithSignature(\"delegateType()\"));\r\n require(success, \"no delegate type\");\r\n\r\n uint8 currentDelegateType = abi.decode(data, (uint8));\r\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = IFeeDistributor(ionicAdmin)\r\n .latestCErc20Delegate(currentDelegateType);\r\n\r\n address currentDelegate = implementation();\r\n if (currentDelegate != latestCErc20Delegate) {\r\n _setImplementationInternal(latestCErc20Delegate, becomeImplementationData);\r\n } else {\r\n // only update the extensions without reinitializing with becomeImplementationData\r\n _updateExtensions(currentDelegate);\r\n }\r\n }\r\n\r\n /**\r\n * @dev register a logic extension\r\n * @param extensionToAdd the extension whose functions are to be added\r\n * @param extensionToReplace the extension whose functions are to be removed/replaced\r\n */\r\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\r\n require(msg.sender == address(ionicAdmin), \"!unauthorized\");\r\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\r\n }\r\n\r\n /**\r\n * @dev Internal function to update the implementation of the delegator\r\n * @param implementation_ The address of the new implementation for delegation\r\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\r\n */\r\n function _setImplementationInternal(address implementation_, bytes memory becomeImplementationData) internal {\r\n address delegateBefore = implementation();\r\n _updateExtensions(implementation_);\r\n\r\n _functionCall(\r\n address(this),\r\n abi.encodeWithSelector(CDelegateInterface._becomeImplementation.selector, becomeImplementationData),\r\n \"!become impl\"\r\n );\r\n\r\n emit NewImplementation(delegateBefore, implementation_);\r\n }\r\n\r\n function _updateExtensions(address newDelegate) internal {\r\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getCErc20DelegateExtensions(newDelegate);\r\n address[] memory currentExtensions = LibDiamond.listExtensions();\r\n\r\n // removed the current (old) extensions\r\n for (uint256 i = 0; i < currentExtensions.length; i++) {\r\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\r\n }\r\n // add the new extensions\r\n for (uint256 i = 0; i < latestExtensions.length; i++) {\r\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\r\n }\r\n }\r\n\r\n function _functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.call(data);\r\n\r\n if (!success) {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n\r\n return returndata;\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20PluginDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CErc20Delegate.sol\";\r\nimport \"./EIP20Interface.sol\";\r\nimport \"./IERC4626.sol\";\r\nimport \"../external/uniswap/IUniswapV2Pair.sol\";\r\n\r\n/**\r\n * @title Rari's CErc20Plugin's Contract\r\n * @notice CToken which outsources token logic to a plugin\r\n * @author Joey Santoro\r\n *\r\n * CErc20PluginDelegate deposits and withdraws from a plugin contract\r\n * It is also capable of delegating reward functionality to a PluginRewardsDistributor\r\n */\r\ncontract CErc20PluginDelegate is CErc20Delegate {\r\n event NewPluginImplementation(address oldImpl, address newImpl);\r\n\r\n /**\r\n * @notice Plugin address\r\n */\r\n IERC4626 public plugin;\r\n\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 2;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.plugin.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._updatePlugin.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /**\r\n * @notice Delegate interface to become the implementation\r\n * @param data The encoded arguments for becoming\r\n */\r\n function _becomeImplementation(bytes memory data) public virtual override {\r\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _becomeImplementation\");\r\n\r\n address _plugin = abi.decode(data, (address));\r\n\r\n if (_plugin == address(0) && address(plugin) != address(0)) {\r\n // if no new plugin address is given, use the latest implementation\r\n _plugin = IFeeDistributor(ionicAdmin).latestPluginImplementation(address(plugin));\r\n }\r\n\r\n if (_plugin != address(0) && _plugin != address(plugin)) {\r\n _updatePlugin(_plugin);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Update the plugin implementation to a whitelisted implementation\r\n * @param _plugin The address of the plugin implementation to use\r\n */\r\n function _updatePlugin(address _plugin) public {\r\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _updatePlugin\");\r\n\r\n address oldImplementation = address(plugin) != address(0) ? address(plugin) : _plugin;\r\n\r\n if (address(plugin) != address(0) && plugin.balanceOf(address(this)) != 0) {\r\n plugin.redeem(plugin.balanceOf(address(this)), address(this), address(this));\r\n }\r\n\r\n plugin = IERC4626(_plugin);\r\n\r\n EIP20Interface(underlying).approve(_plugin, type(uint256).max);\r\n\r\n uint256 amount = EIP20Interface(underlying).balanceOf(address(this));\r\n if (amount != 0) {\r\n deposit(amount);\r\n }\r\n\r\n emit NewPluginImplementation(oldImplementation, _plugin);\r\n }\r\n\r\n /*** CToken Overrides ***/\r\n\r\n /*** Safe Token ***/\r\n\r\n /**\r\n * @notice Gets balance of the plugin in terms of the underlying\r\n * @return The quantity of underlying tokens owned by this contract\r\n */\r\n function getCashInternal() internal view override returns (uint256) {\r\n return plugin.previewRedeem(plugin.balanceOf(address(this)));\r\n }\r\n\r\n /**\r\n * @notice Transfer the underlying to the cToken and trigger a deposit\r\n * @param from Address to transfer funds from\r\n * @param amount Amount of underlying to transfer\r\n * @return The actual amount that is transferred\r\n */\r\n function doTransferIn(address from, uint256 amount) internal override returns (uint256) {\r\n // Perform the EIP-20 transfer in\r\n require(EIP20Interface(underlying).transferFrom(from, address(this), amount), \"send\");\r\n\r\n deposit(amount);\r\n return amount;\r\n }\r\n\r\n function deposit(uint256 amount) internal {\r\n plugin.deposit(amount, address(this));\r\n }\r\n\r\n /**\r\n * @notice Transfer the underlying from plugin to destination\r\n * @param to Address to transfer funds to\r\n * @param amount Amount of underlying to transfer\r\n */\r\n function doTransferOut(address to, uint256 amount) internal override {\r\n plugin.withdraw(amount, to, address(this));\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 2;\r\n }\r\n\r\n function contractType() external pure virtual override returns (string memory) {\r\n return \"CErc20PluginDelegate\";\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20PluginRewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CErc20PluginDelegate.sol\";\r\n\r\ncontract CErc20PluginRewardsDelegate is CErc20PluginDelegate {\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 2;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /// @notice A reward token claim function\r\n /// to be overridden for use cases where rewardToken needs to be pulled in\r\n function claim() external {}\r\n\r\n /// @notice token approval function\r\n function approve(address _token, address _spender) external {\r\n require(hasAdminRights(), \"!admin\");\r\n require(_token != underlying && _token != address(plugin), \"!token\");\r\n\r\n EIP20Interface(_token).approve(_spender, type(uint256).max);\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 4;\r\n }\r\n\r\n function contractType() external pure override returns (string memory) {\r\n return \"CErc20PluginRewardsDelegate\";\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CErc20Delegate.sol\";\r\nimport \"./EIP20Interface.sol\";\r\n\r\ncontract CErc20RewardsDelegate is CErc20Delegate {\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 2;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n \r\n /// @notice A reward token claim function\r\n /// to be overridden for use cases where rewardToken needs to be pulled in\r\n function claim() external {}\r\n\r\n /// @notice token approval function\r\n function approve(address _token, address _spender) external {\r\n require(hasAdminRights(), \"!admin\");\r\n require(_token != underlying, \"!underlying\");\r\n\r\n EIP20Interface(_token).approve(_spender, type(uint256).max);\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 3;\r\n }\r\n\r\n function contractType() external pure override returns (string memory) {\r\n return \"CErc20RewardsDelegate\";\r\n }\r\n}\r\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\r\nimport { Exponential } from \"./Exponential.sol\";\r\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\r\nimport { Unitroller } from \"./Unitroller.sol\";\r\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\r\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\r\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\n/**\r\n * @title Compound's Comptroller Contract\r\n * @author Compound\r\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\r\n */\r\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n /// @notice Emitted when an admin supports a market\r\n event MarketListed(ICErc20 cToken);\r\n\r\n /// @notice Emitted when an account enters a market\r\n event MarketEntered(ICErc20 cToken, address account);\r\n\r\n /// @notice Emitted when an account exits a market\r\n event MarketExited(ICErc20 cToken, address account);\r\n\r\n /// @notice Emitted when close factor is changed by admin\r\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\r\n\r\n /// @notice Emitted when a collateral factor is changed by admin\r\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\r\n\r\n /// @notice Emitted when liquidation incentive is changed by admin\r\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\r\n\r\n /// @notice Emitted when price oracle is changed\r\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\r\n\r\n /// @notice Emitted when the whitelist enforcement is changed\r\n event WhitelistEnforcementChanged(bool enforce);\r\n\r\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\r\n event AddedRewardsDistributor(address rewardsDistributor);\r\n\r\n // closeFactorMantissa must be strictly greater than this value\r\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\r\n\r\n // closeFactorMantissa must not exceed this value\r\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\r\n\r\n // No collateralFactorMantissa may exceed this value\r\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\r\n\r\n // liquidationIncentiveMantissa must be no less than this value\r\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\r\n\r\n // liquidationIncentiveMantissa must be no greater than this value\r\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\r\n\r\n modifier isAuthorized() {\r\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveSupplyCaps(\r\n address cToken\r\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\r\n return ComptrollerBase.effectiveSupplyCaps(cToken);\r\n }\r\n\r\n /**\r\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveBorrowCaps(\r\n address cToken\r\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\r\n return ComptrollerBase.effectiveBorrowCaps(cToken);\r\n }\r\n\r\n /*** Assets You Are In ***/\r\n\r\n /**\r\n * @notice Returns the assets an account has entered\r\n * @param account The address of the account to pull assets for\r\n * @return A dynamic list with the assets the account has entered\r\n */\r\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\r\n ICErc20[] memory assetsIn = accountAssets[account];\r\n\r\n return assetsIn;\r\n }\r\n\r\n /**\r\n * @notice Returns whether the given account is entered in the given asset\r\n * @param account The address of the account to check\r\n * @param cToken The cToken to check\r\n * @return True if the account is in the asset, otherwise false.\r\n */\r\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\r\n return markets[address(cToken)].accountMembership[account];\r\n }\r\n\r\n /**\r\n * @notice Add assets to be included in account liquidity calculation\r\n * @param cTokens The list of addresses of the cToken markets to be enabled\r\n * @return Success indicator for whether each corresponding market was entered\r\n */\r\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\r\n uint256 len = cTokens.length;\r\n\r\n uint256[] memory results = new uint256[](len);\r\n for (uint256 i = 0; i < len; i++) {\r\n ICErc20 cToken = ICErc20(cTokens[i]);\r\n\r\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\r\n * @param cToken The market to enter\r\n * @param borrower The address of the account to modify\r\n * @return Success indicator for whether the market was entered\r\n */\r\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\r\n Market storage marketToJoin = markets[address(cToken)];\r\n\r\n if (!marketToJoin.isListed) {\r\n // market is not listed, cannot join\r\n return Error.MARKET_NOT_LISTED;\r\n }\r\n\r\n if (marketToJoin.accountMembership[borrower] == true) {\r\n // already joined\r\n return Error.NO_ERROR;\r\n }\r\n\r\n // survived the gauntlet, add to list\r\n // NOTE: we store these somewhat redundantly as a significant optimization\r\n // this avoids having to iterate through the list for the most common use cases\r\n // that is, only when we need to perform liquidity checks\r\n // and not whenever we want to check if an account is in a particular market\r\n marketToJoin.accountMembership[borrower] = true;\r\n accountAssets[borrower].push(cToken);\r\n\r\n // Add to allBorrowers\r\n if (!borrowers[borrower]) {\r\n allBorrowers.push(borrower);\r\n borrowers[borrower] = true;\r\n borrowerIndexes[borrower] = allBorrowers.length - 1;\r\n }\r\n\r\n emit MarketEntered(cToken, borrower);\r\n\r\n return Error.NO_ERROR;\r\n }\r\n\r\n /**\r\n * @notice Removes asset from sender's account liquidity calculation\r\n * @dev Sender must not have an outstanding borrow balance in the asset,\r\n * or be providing necessary collateral for an outstanding borrow.\r\n * @param cTokenAddress The address of the asset to be removed\r\n * @return Whether or not the account successfully exited the market\r\n */\r\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\r\n // TODO\r\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\r\n\r\n ICErc20 cToken = ICErc20(cTokenAddress);\r\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\r\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\r\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\r\n\r\n /* Fail if the sender has a borrow balance */\r\n if (amountOwed != 0) {\r\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\r\n }\r\n\r\n /* Fail if the sender is not permitted to redeem all of their tokens */\r\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\r\n if (allowed != 0) {\r\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\r\n }\r\n\r\n Market storage marketToExit = markets[cTokenAddress];\r\n\r\n /* Return true if the sender is not already ‘in’ the market */\r\n if (!marketToExit.accountMembership[msg.sender]) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /* Set cToken account membership to false */\r\n delete marketToExit.accountMembership[msg.sender];\r\n\r\n /* Delete cToken from the account’s list of assets */\r\n // load into memory for faster iteration\r\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\r\n uint256 len = userAssetList.length;\r\n uint256 assetIndex = len;\r\n for (uint256 i = 0; i < len; i++) {\r\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\r\n assetIndex = i;\r\n break;\r\n }\r\n }\r\n\r\n // We *must* have found the asset in the list or our redundant data structure is broken\r\n assert(assetIndex < len);\r\n\r\n // copy last item in list to location of item to be removed, reduce length by 1\r\n ICErc20[] storage storedList = accountAssets[msg.sender];\r\n storedList[assetIndex] = storedList[storedList.length - 1];\r\n storedList.pop();\r\n\r\n // If the user has exited all markets, remove them from the `allBorrowers` array\r\n if (storedList.length == 0) {\r\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\r\n allBorrowers.pop(); // Reduce length by 1\r\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\r\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\r\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\r\n }\r\n\r\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /*** Policy Hooks ***/\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to mint tokens in the given market\r\n * @param cTokenAddress The market to verify the mint against\r\n * @param minter The account which would get the minted tokens\r\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\r\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\r\n\r\n // Make sure market is listed\r\n if (!markets[cTokenAddress].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Make sure minter is whitelisted\r\n if (enforceWhitelist && !whitelist[minter]) {\r\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\r\n }\r\n\r\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\r\n\r\n // Supply cap of 0 corresponds to unlimited supplying\r\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\r\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\r\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\r\n uint256 nonWhitelistedTotalSupply;\r\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\r\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\r\n\r\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreSupplierAction(cTokenAddress, minter);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to redeem tokens in the given market\r\n * @param cToken The market to verify the redeem against\r\n * @param redeemer The account which would redeem the tokens\r\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\r\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\r\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\r\n if (allowed != uint256(Error.NO_ERROR)) {\r\n return allowed;\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreSupplierAction(cToken, redeemer);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function redeemAllowedInternal(\r\n address cToken,\r\n address redeemer,\r\n uint256 redeemTokens\r\n ) internal view returns (uint256) {\r\n if (!markets[cToken].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\r\n if (!markets[cToken].accountMembership[redeemer]) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\r\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\r\n redeemer,\r\n ICErc20(cToken),\r\n redeemTokens,\r\n 0,\r\n 0\r\n );\r\n if (err != Error.NO_ERROR) {\r\n return uint256(err);\r\n }\r\n if (shortfall > 0) {\r\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates mint and reverts on rejection. May emit logs.\r\n * @param cToken Asset being minted\r\n * @param minter The address minting the tokens\r\n * @param actualMintAmount The amount of the underlying asset being minted\r\n * @param mintTokens The number of tokens being minted\r\n */\r\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\r\n // Add minter to suppliers mapping\r\n suppliers[minter] = true;\r\n\r\n // Keep the flywheel moving\r\n flywheelPostSupplierAction(cToken, minter);\r\n }\r\n\r\n /**\r\n * @notice Validates redeem and reverts on rejection. May emit logs.\r\n * @param cToken Asset being redeemed\r\n * @param redeemer The address redeeming the tokens\r\n * @param redeemAmount The amount of the underlying asset being redeemed\r\n * @param redeemTokens The number of tokens being redeemed\r\n */\r\n function redeemVerify(\r\n address cToken,\r\n address redeemer,\r\n uint256 redeemAmount,\r\n uint256 redeemTokens\r\n ) external override {\r\n require(markets[msg.sender].isListed, \"!market\");\r\n\r\n // Require tokens is zero or amount is also zero\r\n if (redeemTokens == 0 && redeemAmount > 0) {\r\n revert(\"!zero\");\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPostSupplierAction(cToken, redeemer);\r\n }\r\n\r\n function getMaxRedeemOrBorrow(\r\n address account,\r\n ICErc20 cTokenModify,\r\n bool isBorrow\r\n ) external view override returns (uint256) {\r\n address cToken = address(cTokenModify);\r\n // Accrue interest\r\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\r\n\r\n // Get account liquidity\r\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\r\n account,\r\n isBorrow ? cTokenModify : ICErc20(address(0)),\r\n 0,\r\n 0,\r\n 0\r\n );\r\n require(err == Error.NO_ERROR, \"!liquidity\");\r\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\r\n\r\n // Get max borrow/redeem\r\n uint256 maxBorrowOrRedeemAmount;\r\n\r\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\r\n // Max redeem = balance of underlying if not used as collateral\r\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\r\n } else {\r\n // Avoid \"stack too deep\" error by separating this logic\r\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\r\n\r\n // Redeem only: max out at underlying balance\r\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\r\n }\r\n\r\n // Get max borrow or redeem considering cToken liquidity\r\n uint256 cTokenLiquidity = cTokenModify.getCash();\r\n\r\n // Return the minimum of the two maximums\r\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\r\n }\r\n\r\n /**\r\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\r\n */\r\n function _getMaxRedeemOrBorrow(\r\n uint256 liquidity,\r\n ICErc20 cTokenModify,\r\n bool isBorrow\r\n ) internal view returns (uint256) {\r\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\r\n\r\n // Get the normalized price of the asset\r\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\r\n require(conversionFactor > 0, \"!oracle\");\r\n\r\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\r\n if (!isBorrow) {\r\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\r\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\r\n }\r\n\r\n // Get max borrow or redeem considering excess account liquidity\r\n return (liquidity * 1e18) / conversionFactor;\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\r\n * @param cToken The market to verify the borrow against\r\n * @param borrower The account which would borrow the asset\r\n * @param borrowAmount The amount of underlying the account would borrow\r\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\r\n\r\n // Make sure market is listed\r\n if (!markets[cToken].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n if (!markets[cToken].accountMembership[borrower]) {\r\n // only cTokens may call borrowAllowed if borrower not in market\r\n require(msg.sender == cToken, \"!ctoken\");\r\n\r\n // attempt to add borrower to the market\r\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\r\n if (err != Error.NO_ERROR) {\r\n return uint256(err);\r\n }\r\n\r\n // it should be impossible to break the important invariant\r\n assert(markets[cToken].accountMembership[borrower]);\r\n }\r\n\r\n // Make sure oracle price is available\r\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\r\n return uint256(Error.PRICE_ERROR);\r\n }\r\n\r\n // Make sure borrower is whitelisted\r\n if (enforceWhitelist && !whitelist[borrower]) {\r\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\r\n }\r\n\r\n uint256 borrowCap = effectiveBorrowCaps(cToken);\r\n\r\n // Borrow cap of 0 corresponds to unlimited borrowing\r\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\r\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\r\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\r\n uint256 nonWhitelistedTotalBorrows;\r\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\r\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\r\n\r\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreBorrowerAction(cToken, borrower);\r\n\r\n // Perform a hypothetical liquidity check to guard against shortfall\r\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\r\n if (err != uint256(Error.NO_ERROR)) {\r\n return err;\r\n }\r\n if (shortfall > 0) {\r\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates borrow the underlying asset of the given market\r\n * @param cToken The market to verify the borrow against\r\n * @param borrower The account which borrowed the asset\r\n */\r\n function borrowVerify(address cToken, address borrower) external override {\r\n // Keep the flywheel moving\r\n flywheelPostBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\r\n * @param cToken Asset whose underlying is being borrowed\r\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\r\n */\r\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\r\n // Check if min borrow exists\r\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\r\n\r\n if (minBorrowEth > 0) {\r\n // Get new underlying borrow balance of account for this cToken\r\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\r\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\r\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\r\n Exp({ mantissa: oraclePriceMantissa }),\r\n accountBorrowsNew\r\n );\r\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\r\n\r\n // Check against min borrow\r\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\r\n }\r\n\r\n // Return no error\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to repay a borrow in the given market\r\n * @param cToken The market to verify the repay against\r\n * @param payer The account which would repay the asset\r\n * @param borrower The account which would borrowed the asset\r\n * @param repayAmount The amount of the underlying asset the account would repay\r\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function repayBorrowAllowed(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external override returns (uint256) {\r\n // Make sure market is listed\r\n if (!markets[cToken].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreBorrowerAction(cToken, borrower);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates that blacklisted balances are updated after borrow repayment\r\n * @param cToken The market to verify the repay against\r\n * @param payer The account which repayed the asset\r\n * @param borrower The account which borrowed the asset\r\n * @param repayAmount The amount of the underlying asset the account repayed\r\n */\r\n function repayBorrowVerify(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external override {\r\n // Keep the flywheel moving\r\n flywheelPostBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Checks if the liquidation should be allowed to occur\r\n * @param cTokenBorrowed Asset which was borrowed by the borrower\r\n * @param cTokenCollateral Asset which was used as collateral and will be seized\r\n * @param liquidator The address repaying the borrow and seizing the collateral\r\n * @param borrower The address of the borrower\r\n * @param repayAmount The amount of underlying being repaid\r\n */\r\n function liquidateBorrowAllowed(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external override returns (uint256) {\r\n // Make sure markets are listed\r\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Get borrowers' underlying borrow balance\r\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\r\n\r\n /* allow accounts to be liquidated if the market is deprecated */\r\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\r\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\r\n } else {\r\n /* The borrower must have shortfall in order to be liquidateable */\r\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\r\n borrower,\r\n ICErc20(address(0)),\r\n 0,\r\n 0,\r\n 0\r\n );\r\n if (err != Error.NO_ERROR) {\r\n return uint256(err);\r\n }\r\n\r\n if (shortfall == 0) {\r\n return uint256(Error.INSUFFICIENT_SHORTFALL);\r\n }\r\n\r\n /* The liquidator may not repay more than what is allowed by the closeFactor */\r\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\r\n if (repayAmount > maxClose) {\r\n return uint256(Error.TOO_MUCH_REPAY);\r\n }\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Checks if the seizing of assets should be allowed to occur\r\n * @param cTokenCollateral Asset which was used as collateral and will be seized\r\n * @param cTokenBorrowed Asset which was borrowed by the borrower\r\n * @param liquidator The address repaying the borrow and seizing the collateral\r\n * @param borrower The address of the borrower\r\n * @param seizeTokens The number of collateral tokens to seize\r\n */\r\n function seizeAllowed(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!seizeGuardianPaused, \"!seize:paused\");\r\n\r\n // Make sure markets are listed\r\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Make sure cToken Comptrollers are identical\r\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\r\n return uint256(Error.COMPTROLLER_MISMATCH);\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates that blacklisted balances are updated after seizing of assets\r\n * @param cTokenCollateral Asset which was used as collateral and will be seized\r\n * @param cTokenBorrowed Asset which was borrowed by the borrower\r\n * @param liquidator The address repaying the borrow and seizing the collateral\r\n * @param borrower The address of the borrower\r\n * @param seizeTokens The number of collateral tokens to seize\r\n */\r\n function seizeVerify(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external override {\r\n // Keep the flywheel moving\r\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to transfer tokens in the given market\r\n * @param cToken The market to verify the transfer against\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n * @param transferTokens The number of cTokens to transfer\r\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function transferAllowed(\r\n address cToken,\r\n address src,\r\n address dst,\r\n uint256 transferTokens\r\n ) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!transferGuardianPaused, \"!transfer:paused\");\r\n\r\n // Currently the only consideration is whether or not\r\n // the src is allowed to redeem this many tokens\r\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\r\n if (allowed != uint256(Error.NO_ERROR)) {\r\n return allowed;\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreTransferAction(cToken, src, dst);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n\r\n /**\r\n * @notice Validates that blacklisted balances are updated after transfering assets\r\n * @param cToken The market to verify the transfer against\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n * @param transferTokens The number of cTokens to transfer\r\n */\r\n function transferVerify(\r\n address cToken,\r\n address src,\r\n address dst,\r\n uint256 transferTokens\r\n ) external override {\r\n\r\n // Keep the flywheel moving\r\n flywheelPostTransferAction(cToken, src, dst);\r\n }\r\n\r\n /*** Flywheel Hooks ***/\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\r\n * @param cToken The relevant market\r\n * @param supplier The minter/redeemer\r\n */\r\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving post-mint and post-redeem\r\n * @param cToken The relevant market\r\n * @param supplier The minter/redeemer\r\n */\r\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\r\n * @param cToken The relevant market\r\n * @param borrower The borrower\r\n */\r\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving post-borrow and post-repay\r\n * @param cToken The relevant market\r\n * @param borrower The borrower\r\n */\r\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\r\n * @param cToken The relevant market\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n */\r\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving post-transfer and post-seize\r\n * @param cToken The relevant market\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n */\r\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\r\n }\r\n\r\n /*** Liquidity/Liquidation Calculations ***/\r\n\r\n /**\r\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\r\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\r\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\r\n */\r\n struct AccountLiquidityLocalVars {\r\n ICErc20 asset;\r\n uint256 sumCollateral;\r\n uint256 sumBorrowPlusEffects;\r\n uint256 cTokenBalance;\r\n uint256 borrowBalance;\r\n uint256 exchangeRateMantissa;\r\n uint256 oraclePriceMantissa;\r\n Exp collateralFactor;\r\n Exp exchangeRate;\r\n Exp oraclePrice;\r\n Exp tokensToDenom;\r\n uint256 borrowCapForCollateral;\r\n uint256 borrowedAssetPrice;\r\n uint256 assetAsCollateralValueCap;\r\n }\r\n\r\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\r\n (\r\n Error err,\r\n uint256 collateralValue,\r\n uint256 liquidity,\r\n uint256 shortfall\r\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\r\n return (uint256(err), collateralValue, liquidity, shortfall);\r\n }\r\n\r\n /**\r\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\r\n * @param cTokenModify The market to hypothetically redeem/borrow in\r\n * @param account The account to determine liquidity for\r\n * @param redeemTokens The number of tokens to hypothetically redeem\r\n * @param borrowAmount The amount of underlying to hypothetically borrow\r\n * @return (possible error code (semi-opaque),\r\n hypothetical account liquidity in excess of collateral requirements,\r\n * hypothetical account shortfall below collateral requirements)\r\n */\r\n function getHypotheticalAccountLiquidity(\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) public view returns (uint256, uint256, uint256, uint256) {\r\n (\r\n Error err,\r\n uint256 collateralValue,\r\n uint256 liquidity,\r\n uint256 shortfall\r\n ) = getHypotheticalAccountLiquidityInternal(\r\n account,\r\n ICErc20(cTokenModify),\r\n redeemTokens,\r\n borrowAmount,\r\n repayAmount\r\n );\r\n return (uint256(err), collateralValue, liquidity, shortfall);\r\n }\r\n\r\n /**\r\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\r\n * @param cTokenModify The market to hypothetically redeem/borrow in\r\n * @param account The account to determine liquidity for\r\n * @param redeemTokens The number of tokens to hypothetically redeem\r\n * @param borrowAmount The amount of underlying to hypothetically borrow\r\n * @return (possible error code,\r\n hypothetical account collateral value,\r\n hypothetical account liquidity in excess of collateral requirements,\r\n * hypothetical account shortfall below collateral requirements)\r\n */\r\n function getHypotheticalAccountLiquidityInternal(\r\n address account,\r\n ICErc20 cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) internal view returns (Error, uint256, uint256, uint256) {\r\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\r\n\r\n if (address(cTokenModify) != address(0)) {\r\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\r\n }\r\n\r\n // For each asset the account is in\r\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\r\n vars.asset = accountAssets[account][i];\r\n\r\n {\r\n // Read the balances and exchange rate from the cToken\r\n uint256 oErr;\r\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\r\n account\r\n );\r\n if (oErr != 0) {\r\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\r\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\r\n }\r\n }\r\n {\r\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\r\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\r\n\r\n // Get the normalized price of the asset\r\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\r\n if (vars.oraclePriceMantissa == 0) {\r\n return (Error.PRICE_ERROR, 0, 0, 0);\r\n }\r\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\r\n\r\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\r\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\r\n }\r\n {\r\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\r\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\r\n vars.asset,\r\n cTokenModify,\r\n redeemTokens > 0,\r\n account\r\n );\r\n\r\n // accumulate the collateral value to sumCollateral\r\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\r\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\r\n assetCollateralValue = vars.assetAsCollateralValueCap;\r\n vars.sumCollateral += assetCollateralValue;\r\n }\r\n\r\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\r\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\r\n vars.oraclePrice,\r\n vars.borrowBalance,\r\n vars.sumBorrowPlusEffects\r\n );\r\n\r\n // Calculate effects of interacting with cTokenModify\r\n if (vars.asset == cTokenModify) {\r\n // redeem effect\r\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\r\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\r\n vars.tokensToDenom,\r\n redeemTokens,\r\n vars.sumBorrowPlusEffects\r\n );\r\n\r\n // borrow effect\r\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\r\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\r\n vars.oraclePrice,\r\n borrowAmount,\r\n vars.sumBorrowPlusEffects\r\n );\r\n\r\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\r\n if (repayEffect >= vars.sumBorrowPlusEffects) {\r\n vars.sumBorrowPlusEffects = 0;\r\n } else {\r\n vars.sumBorrowPlusEffects -= repayEffect;\r\n }\r\n }\r\n }\r\n\r\n // These are safe, as the underflow condition is checked first\r\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\r\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\r\n } else {\r\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\r\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\r\n * @param cTokenBorrowed The address of the borrowed cToken\r\n * @param cTokenCollateral The address of the collateral cToken\r\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\r\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\r\n */\r\n function liquidateCalculateSeizeTokens(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n uint256 actualRepayAmount\r\n ) external view override returns (uint256, uint256) {\r\n /* Read oracle prices for borrowed and collateral markets */\r\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\r\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\r\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\r\n return (uint256(Error.PRICE_ERROR), 0);\r\n }\r\n\r\n /*\r\n * Get the exchange rate and calculate the number of collateral tokens to seize:\r\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\r\n * seizeTokens = seizeAmount / exchangeRate\r\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\r\n */\r\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\r\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\r\n uint256 seizeTokens;\r\n Exp memory numerator;\r\n Exp memory denominator;\r\n Exp memory ratio;\r\n\r\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\r\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\r\n\r\n /*\r\n * The liquidation penalty includes\r\n * - the liquidator incentive\r\n * - the protocol fees (Ionic admin fees)\r\n * - the market fee\r\n */\r\n Exp memory totalPenaltyMantissa = add_(\r\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\r\n Exp({ mantissa: feeSeizeShareMantissa })\r\n );\r\n\r\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\r\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\r\n ratio = div_(numerator, denominator);\r\n\r\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\r\n return (uint256(Error.NO_ERROR), seizeTokens);\r\n }\r\n\r\n /*** Admin Functions ***/\r\n\r\n /**\r\n * @notice Add a RewardsDistributor contracts.\r\n * @dev Admin function to add a RewardsDistributor contract\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _addRewardsDistributor(address distributor) external returns (uint256) {\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n // Check marker method\r\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\r\n\r\n // Check for existing RewardsDistributor\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\r\n\r\n // Add RewardsDistributor to array\r\n rewardsDistributors.push(distributor);\r\n emit AddedRewardsDistributor(distributor);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the whitelist enforcement for the comptroller\r\n * @dev Admin function to set a new whitelist enforcement boolean\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\r\n }\r\n\r\n // Check if `enforceWhitelist` already equals `enforce`\r\n if (enforceWhitelist == enforce) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n // Set comptroller's `enforceWhitelist` to `enforce`\r\n enforceWhitelist = enforce;\r\n\r\n // Emit WhitelistEnforcementChanged(bool enforce);\r\n emit WhitelistEnforcementChanged(enforce);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the whitelist `statuses` for `suppliers`\r\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\r\n }\r\n\r\n // Set whitelist statuses for suppliers\r\n for (uint256 i = 0; i < suppliers.length; i++) {\r\n address supplier = suppliers[i];\r\n\r\n if (statuses[i]) {\r\n // If not already whitelisted, add to whitelist\r\n if (!whitelist[supplier]) {\r\n whitelist[supplier] = true;\r\n whitelistArray.push(supplier);\r\n whitelistIndexes[supplier] = whitelistArray.length - 1;\r\n }\r\n } else {\r\n // If whitelisted, remove from whitelist\r\n if (whitelist[supplier]) {\r\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\r\n whitelistArray.pop(); // Reduce length by 1\r\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\r\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\r\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\r\n }\r\n }\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets a new price oracle for the comptroller\r\n * @dev Admin function to set a new price oracle\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\r\n }\r\n\r\n // Track the old oracle for the comptroller\r\n BasePriceOracle oldOracle = oracle;\r\n\r\n // Set comptroller's oracle to newOracle\r\n oracle = newOracle;\r\n\r\n // Emit NewPriceOracle(oldOracle, newOracle)\r\n emit NewPriceOracle(oldOracle, newOracle);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the closeFactor used when liquidating borrows\r\n * @dev Admin function to set closeFactor\r\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\r\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\r\n */\r\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\r\n }\r\n\r\n // Check limits\r\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\r\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\r\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\r\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\r\n }\r\n\r\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\r\n if (lessThanExp(highLimit, newCloseFactorExp)) {\r\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\r\n }\r\n\r\n // Set pool close factor to new close factor, remember old value\r\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\r\n closeFactorMantissa = newCloseFactorMantissa;\r\n\r\n // Emit event\r\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the collateralFactor for a market\r\n * @dev Admin function to set per-market collateralFactor\r\n * @param cToken The market to set the factor on\r\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\r\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\r\n */\r\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\r\n }\r\n\r\n // Verify market is listed\r\n Market storage market = markets[address(cToken)];\r\n if (!market.isListed) {\r\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\r\n }\r\n\r\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\r\n\r\n // Check collateral factor <= 0.9\r\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\r\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\r\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\r\n }\r\n\r\n // If collateral factor != 0, fail if price == 0\r\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\r\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\r\n }\r\n\r\n // Set market's collateral factor to new collateral factor, remember old value\r\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\r\n market.collateralFactorMantissa = newCollateralFactorMantissa;\r\n\r\n // Emit event with asset, old collateral factor, and new collateral factor\r\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets liquidationIncentive\r\n * @dev Admin function to set liquidationIncentive\r\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\r\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\r\n */\r\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\r\n }\r\n\r\n // Check de-scaled min <= newLiquidationIncentive <= max\r\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\r\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\r\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\r\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\r\n }\r\n\r\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\r\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\r\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\r\n }\r\n\r\n // Save current value for use in log\r\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\r\n\r\n // Set liquidation incentive to new incentive\r\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\r\n\r\n // Emit event with old incentive, new incentive\r\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Add the market to the markets mapping and set it as listed\r\n * @dev Admin function to set isListed and add support for the market\r\n * @param cToken The address of the market (token) to list\r\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\r\n */\r\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\r\n }\r\n\r\n // Is market already listed?\r\n if (markets[address(cToken)].isListed) {\r\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\r\n }\r\n\r\n // Check cToken.comptroller == this\r\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\r\n\r\n // Make sure market is not already listed\r\n address underlying = ICErc20(address(cToken)).underlying();\r\n\r\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\r\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\r\n }\r\n\r\n // List market and emit event\r\n Market storage market = markets[address(cToken)];\r\n market.isListed = true;\r\n market.collateralFactorMantissa = 0;\r\n allMarkets.push(cToken);\r\n cTokensByUnderlying[underlying] = cToken;\r\n emit MarketListed(cToken);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\r\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\r\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\r\n */\r\n function _deployMarket(\r\n uint8 delegateType,\r\n bytes calldata constructorData,\r\n bytes calldata becomeImplData,\r\n uint256 collateralFactorMantissa\r\n ) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\r\n }\r\n\r\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\r\n bool oldIonicAdminHasRights = ionicAdminHasRights;\r\n ionicAdminHasRights = true;\r\n\r\n // Deploy via Ionic admin\r\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\r\n // Reset Ionic admin rights to the original value\r\n ionicAdminHasRights = oldIonicAdminHasRights;\r\n // Support market here in the Comptroller\r\n uint256 err = _supportMarket(cToken);\r\n\r\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\r\n\r\n // Set collateral factor\r\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\r\n }\r\n\r\n function _becomeImplementation() external {\r\n require(msg.sender == address(this), \"!self call\");\r\n\r\n if (!_notEnteredInitialized) {\r\n _notEntered = true;\r\n _notEnteredInitialized = true;\r\n }\r\n }\r\n\r\n /*** Helper Functions ***/\r\n\r\n /**\r\n * @notice Returns true if the given cToken market has been deprecated\r\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\r\n * @param cToken The market to check if deprecated\r\n */\r\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\r\n return\r\n markets[address(cToken)].collateralFactorMantissa == 0 &&\r\n borrowGuardianPaused[address(cToken)] == true &&\r\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\r\n }\r\n\r\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\r\n return ComptrollerExtensionInterface(address(this));\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 32;\r\n\r\n functionSelectors = new bytes4[](fnsCount);\r\n\r\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\r\n functionSelectors[--fnsCount] = this._deployMarket.selector;\r\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\r\n functionSelectors[--fnsCount] = this.checkMembership.selector;\r\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\r\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\r\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\r\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\r\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\r\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\r\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\r\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\r\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\r\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\r\n functionSelectors[--fnsCount] = this.exitMarket.selector;\r\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\r\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\r\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\r\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\r\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\r\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\r\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\r\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\r\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\r\n functionSelectors[--fnsCount] = this.mintVerify.selector;\r\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\r\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\r\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\r\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\r\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\r\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\r\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\r\n\r\n /**\r\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\r\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\r\n */\r\n function _beforeNonReentrant() external override {\r\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\r\n require(_notEntered, \"!reentered\");\r\n _notEntered = false;\r\n }\r\n\r\n /**\r\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\r\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\r\n */\r\n function _afterNonReentrant() external override {\r\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\r\n _notEntered = true; // get a gas-refund post-Istanbul\r\n }\r\n}\r\n" + }, + "contracts/compound/ComptrollerFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { ComptrollerExtensionInterface, ComptrollerBase, SFSRegister } from \"./ComptrollerInterface.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\ncontract ComptrollerFirstExtension is\r\n DiamondExtension,\r\n ComptrollerBase,\r\n ComptrollerExtensionInterface,\r\n ComptrollerErrorReporter\r\n{\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n /// @notice Emitted when supply cap for a cToken is changed\r\n event NewSupplyCap(ICErc20 indexed cToken, uint256 newSupplyCap);\r\n\r\n /// @notice Emitted when borrow cap for a cToken is changed\r\n event NewBorrowCap(ICErc20 indexed cToken, uint256 newBorrowCap);\r\n\r\n /// @notice Emitted when borrow cap guardian is changed\r\n event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian);\r\n\r\n /// @notice Emitted when pause guardian is changed\r\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\r\n\r\n /// @notice Emitted when an action is paused globally\r\n event ActionPaused(string action, bool pauseState);\r\n\r\n /// @notice Emitted when an action is paused on a market\r\n event MarketActionPaused(ICErc20 cToken, string action, bool pauseState);\r\n\r\n /// @notice Emitted when an admin unsupports a market\r\n event MarketUnlisted(ICErc20 cToken);\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 33;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.addNonAccruingFlywheel.selector;\r\n functionSelectors[--fnsCount] = this._setMarketSupplyCaps.selector;\r\n functionSelectors[--fnsCount] = this._setMarketBorrowCaps.selector;\r\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateralWhitelist.selector;\r\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateralWhitelist.selector;\r\n functionSelectors[--fnsCount] = this._supplyCapWhitelist.selector;\r\n functionSelectors[--fnsCount] = this._borrowCapWhitelist.selector;\r\n functionSelectors[--fnsCount] = this._setBorrowCapGuardian.selector;\r\n functionSelectors[--fnsCount] = this._setPauseGuardian.selector;\r\n functionSelectors[--fnsCount] = this._setMintPaused.selector;\r\n functionSelectors[--fnsCount] = this._setBorrowPaused.selector;\r\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\r\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\r\n functionSelectors[--fnsCount] = this._unsupportMarket.selector;\r\n functionSelectors[--fnsCount] = this.getAllMarkets.selector;\r\n functionSelectors[--fnsCount] = this.getAllBorrowers.selector;\r\n functionSelectors[--fnsCount] = this.getAllBorrowersCount.selector;\r\n functionSelectors[--fnsCount] = this.getPaginatedBorrowers.selector;\r\n functionSelectors[--fnsCount] = this.getWhitelist.selector;\r\n functionSelectors[--fnsCount] = this.getRewardsDistributors.selector;\r\n functionSelectors[--fnsCount] = this.isUserOfPool.selector;\r\n functionSelectors[--fnsCount] = this.getAccruingFlywheels.selector;\r\n functionSelectors[--fnsCount] = this._removeFlywheel.selector;\r\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateral.selector;\r\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateral.selector;\r\n functionSelectors[--fnsCount] = this.isBorrowCapForCollateralWhitelisted.selector;\r\n functionSelectors[--fnsCount] = this.isBlacklistBorrowingAgainstCollateralWhitelisted.selector;\r\n functionSelectors[--fnsCount] = this.isSupplyCapWhitelisted.selector;\r\n functionSelectors[--fnsCount] = this.isBorrowCapWhitelisted.selector;\r\n functionSelectors[--fnsCount] = this.getWhitelistedSuppliersSupply.selector;\r\n functionSelectors[--fnsCount] = this.getWhitelistedBorrowersBorrows.selector;\r\n functionSelectors[--fnsCount] = this.getAssetAsCollateralValueCap.selector;\r\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n /**\r\n * @notice Returns true if the accruing flyhwheel was found and replaced\r\n * @dev Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\r\n * @param flywheelAddress The address of the flywheel to add to the non-accruing\r\n */\r\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool) {\r\n require(hasAdminRights(), \"!admin\");\r\n require(flywheelAddress != address(0), \"!flywheel\");\r\n\r\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\r\n require(flywheelAddress != nonAccruingRewardsDistributors[i], \"!alreadyadded\");\r\n }\r\n\r\n // add it to the non-accruing\r\n nonAccruingRewardsDistributors.push(flywheelAddress);\r\n\r\n // remove it from the accruing\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\r\n if (flywheelAddress == rewardsDistributors[i]) {\r\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\r\n rewardsDistributors.pop();\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n function getAssetAsCollateralValueCap(\r\n ICErc20 collateral,\r\n ICErc20 cTokenModify,\r\n bool redeeming,\r\n address account\r\n ) external view returns (uint256) {\r\n if (address(collateral) == address(cTokenModify) && !redeeming) {\r\n // the collateral asset counts as 0 liquidity when borrowed\r\n return 0;\r\n }\r\n\r\n uint256 assetAsCollateralValueCap = type(uint256).max;\r\n if (address(cTokenModify) != address(0)) {\r\n // if the borrowed asset is blacklisted against this collateral & account is not whitelisted\r\n if (\r\n borrowingAgainstCollateralBlacklist[address(cTokenModify)][address(collateral)] &&\r\n !borrowingAgainstCollateralBlacklistWhitelist[address(cTokenModify)][address(collateral)].contains(account)\r\n ) {\r\n assetAsCollateralValueCap = 0;\r\n } else {\r\n // for each user the value of this kind of collateral is capped regardless of the amount borrowed\r\n // denominated in the borrowed asset\r\n uint256 borrowCapForCollateral = borrowCapForCollateral[address(cTokenModify)][address(collateral)];\r\n // check if set to any value & account is not whitelisted\r\n if (\r\n borrowCapForCollateral != 0 &&\r\n !borrowCapForCollateralWhitelist[address(cTokenModify)][address(collateral)].contains(account)\r\n ) {\r\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\r\n // this asset usage as collateral is capped at the native value of the borrow cap\r\n assetAsCollateralValueCap = (borrowCapForCollateral * borrowedAssetPrice) / 1e18;\r\n }\r\n }\r\n }\r\n\r\n uint256 supplyCap = effectiveSupplyCaps(address(collateral));\r\n\r\n // if there is any supply cap, don't allow donations to the market/plugin to go around it\r\n if (supplyCap > 0 && !supplyCapWhitelist[address(collateral)].contains(account)) {\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateral);\r\n uint256 supplyCapValue = (supplyCap * collateralAssetPrice) / 1e18;\r\n supplyCapValue = (supplyCapValue * markets[address(collateral)].collateralFactorMantissa) / 1e18;\r\n if (supplyCapValue < assetAsCollateralValueCap) assetAsCollateralValueCap = supplyCapValue;\r\n }\r\n\r\n return assetAsCollateralValueCap;\r\n }\r\n\r\n /**\r\n * @notice Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\r\n * @dev Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\r\n * @param cTokens The addresses of the markets (tokens) to change the supply caps for\r\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\r\n */\r\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external {\r\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\r\n\r\n uint256 numMarkets = cTokens.length;\r\n uint256 numSupplyCaps = newSupplyCaps.length;\r\n\r\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \"!input\");\r\n\r\n for (uint256 i = 0; i < numMarkets; i++) {\r\n supplyCaps[address(cTokens[i])] = newSupplyCaps[i];\r\n emit NewSupplyCap(cTokens[i], newSupplyCaps[i]);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\r\n * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\r\n * @param cTokens The addresses of the markets (tokens) to change the borrow caps for\r\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\r\n */\r\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external {\r\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\r\n\r\n uint256 numMarkets = cTokens.length;\r\n uint256 numBorrowCaps = newBorrowCaps.length;\r\n\r\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \"!input\");\r\n\r\n for (uint256 i = 0; i < numMarkets; i++) {\r\n borrowCaps[address(cTokens[i])] = newBorrowCaps[i];\r\n emit NewBorrowCap(cTokens[i], newBorrowCaps[i]);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Admin function to change the Borrow Cap Guardian\r\n * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian\r\n */\r\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external {\r\n require(msg.sender == admin, \"!admin\");\r\n\r\n // Save current value for inclusion in log\r\n address oldBorrowCapGuardian = borrowCapGuardian;\r\n\r\n // Store borrowCapGuardian with value newBorrowCapGuardian\r\n borrowCapGuardian = newBorrowCapGuardian;\r\n\r\n // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)\r\n emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);\r\n }\r\n\r\n /**\r\n * @notice Admin function to change the Pause Guardian\r\n * @param newPauseGuardian The address of the new Pause Guardian\r\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\r\n */\r\n function _setPauseGuardian(address newPauseGuardian) public returns (uint256) {\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK);\r\n }\r\n\r\n // Save current value for inclusion in log\r\n address oldPauseGuardian = pauseGuardian;\r\n\r\n // Store pauseGuardian with value newPauseGuardian\r\n pauseGuardian = newPauseGuardian;\r\n\r\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\r\n emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function _setMintPaused(ICErc20 cToken, bool state) public returns (bool) {\r\n require(markets[address(cToken)].isListed, \"!market\");\r\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\r\n require(hasAdminRights() || state == true, \"!admin\");\r\n\r\n mintGuardianPaused[address(cToken)] = state;\r\n emit MarketActionPaused(cToken, \"Mint\", state);\r\n return state;\r\n }\r\n\r\n function _setBorrowPaused(ICErc20 cToken, bool state) public returns (bool) {\r\n require(markets[address(cToken)].isListed, \"!market\");\r\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\r\n require(hasAdminRights() || state == true, \"!admin\");\r\n\r\n borrowGuardianPaused[address(cToken)] = state;\r\n emit MarketActionPaused(cToken, \"Borrow\", state);\r\n return state;\r\n }\r\n\r\n function _setTransferPaused(bool state) public returns (bool) {\r\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\r\n require(hasAdminRights() || state == true, \"!admin\");\r\n\r\n transferGuardianPaused = state;\r\n emit ActionPaused(\"Transfer\", state);\r\n return state;\r\n }\r\n\r\n function _setSeizePaused(bool state) public returns (bool) {\r\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\r\n require(hasAdminRights() || state == true, \"!admin\");\r\n\r\n seizeGuardianPaused = state;\r\n emit ActionPaused(\"Seize\", state);\r\n return state;\r\n }\r\n\r\n /**\r\n * @notice Removed a market from the markets mapping and sets it as unlisted\r\n * @dev Admin function unset isListed and collateralFactorMantissa and unadd support for the market\r\n * @param cToken The address of the market (token) to unlist\r\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\r\n */\r\n function _unsupportMarket(ICErc20 cToken) external returns (uint256) {\r\n // Check admin rights\r\n if (!hasAdminRights()) return fail(Error.UNAUTHORIZED, FailureInfo.UNSUPPORT_MARKET_OWNER_CHECK);\r\n\r\n // Check if market is already unlisted\r\n if (!markets[address(cToken)].isListed)\r\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNSUPPORT_MARKET_DOES_NOT_EXIST);\r\n\r\n // Check if market is in use\r\n if (cToken.totalSupply() > 0) return fail(Error.NONZERO_TOTAL_SUPPLY, FailureInfo.UNSUPPORT_MARKET_IN_USE);\r\n\r\n // Unlist market\r\n delete markets[address(cToken)];\r\n\r\n /* Delete cToken from allMarkets */\r\n // load into memory for faster iteration\r\n ICErc20[] memory _allMarkets = allMarkets;\r\n uint256 len = _allMarkets.length;\r\n uint256 assetIndex = len;\r\n for (uint256 i = 0; i < len; i++) {\r\n if (_allMarkets[i] == cToken) {\r\n assetIndex = i;\r\n break;\r\n }\r\n }\r\n\r\n // We *must* have found the asset in the list or our redundant data structure is broken\r\n assert(assetIndex < len);\r\n\r\n // copy last item in list to location of item to be removed, reduce length by 1\r\n allMarkets[assetIndex] = allMarkets[allMarkets.length - 1];\r\n allMarkets.pop();\r\n\r\n cTokensByUnderlying[ICErc20(address(cToken)).underlying()] = ICErc20(address(0));\r\n emit MarketUnlisted(cToken);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) public {\r\n require(hasAdminRights(), \"!admin\");\r\n borrowCapForCollateral[cTokenBorrow][cTokenCollateral] = borrowCap;\r\n }\r\n\r\n function _setBorrowCapForCollateralWhitelist(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account,\r\n bool whitelisted\r\n ) public {\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n if (whitelisted) borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].add(account);\r\n else borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\r\n }\r\n\r\n function isBorrowCapForCollateralWhitelisted(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account\r\n ) public view returns (bool) {\r\n return borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\r\n }\r\n\r\n function _blacklistBorrowingAgainstCollateral(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n bool blacklisted\r\n ) public {\r\n require(hasAdminRights(), \"!admin\");\r\n borrowingAgainstCollateralBlacklist[cTokenBorrow][cTokenCollateral] = blacklisted;\r\n }\r\n\r\n function _blacklistBorrowingAgainstCollateralWhitelist(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account,\r\n bool whitelisted\r\n ) public {\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n if (whitelisted) borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].add(account);\r\n else borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\r\n }\r\n\r\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account\r\n ) public view returns (bool) {\r\n return borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\r\n }\r\n\r\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) public {\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n if (whitelisted) supplyCapWhitelist[cToken].add(account);\r\n else supplyCapWhitelist[cToken].remove(account);\r\n }\r\n\r\n function isSupplyCapWhitelisted(address cToken, address account) public view returns (bool) {\r\n return supplyCapWhitelist[cToken].contains(account);\r\n }\r\n\r\n function getWhitelistedSuppliersSupply(address cToken) public view returns (uint256 supplied) {\r\n address[] memory whitelistedSuppliers = supplyCapWhitelist[cToken].values();\r\n for (uint256 i = 0; i < whitelistedSuppliers.length; i++) {\r\n supplied += ICErc20(cToken).balanceOfUnderlying(whitelistedSuppliers[i]);\r\n }\r\n }\r\n\r\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) public {\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n if (whitelisted) borrowCapWhitelist[cToken].add(account);\r\n else borrowCapWhitelist[cToken].remove(account);\r\n }\r\n\r\n function isBorrowCapWhitelisted(address cToken, address account) public view returns (bool) {\r\n return borrowCapWhitelist[cToken].contains(account);\r\n }\r\n\r\n function getWhitelistedBorrowersBorrows(address cToken) public view returns (uint256 borrowed) {\r\n address[] memory whitelistedBorrowers = borrowCapWhitelist[cToken].values();\r\n for (uint256 i = 0; i < whitelistedBorrowers.length; i++) {\r\n borrowed += ICErc20(cToken).borrowBalanceCurrent(whitelistedBorrowers[i]);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Return all of the markets\r\n * @dev The automatic getter may be used to access an individual market.\r\n * @return The list of market addresses\r\n */\r\n function getAllMarkets() public view returns (ICErc20[] memory) {\r\n return allMarkets;\r\n }\r\n\r\n /**\r\n * @notice Return all of the borrowers\r\n * @dev The automatic getter may be used to access an individual borrower.\r\n * @return The list of borrower account addresses\r\n */\r\n function getAllBorrowers() public view returns (address[] memory) {\r\n return allBorrowers;\r\n }\r\n\r\n function getAllBorrowersCount() public view returns (uint256) {\r\n return allBorrowers.length;\r\n }\r\n\r\n function getPaginatedBorrowers(\r\n uint256 page,\r\n uint256 pageSize\r\n ) public view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) {\r\n uint256 allBorrowersCount = allBorrowers.length;\r\n if (allBorrowersCount == 0) {\r\n return (0, new address[](0));\r\n }\r\n\r\n if (pageSize == 0) pageSize = 300;\r\n uint256 currentPageSize = pageSize;\r\n uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize;\r\n\r\n _totalPages = allBorrowersCount / pageSize;\r\n if (sizeOfPageFromRemainder > 0) {\r\n _totalPages++;\r\n if (page + 1 == _totalPages) {\r\n currentPageSize = sizeOfPageFromRemainder;\r\n }\r\n }\r\n\r\n if (page + 1 > _totalPages) {\r\n return (_totalPages, new address[](0));\r\n }\r\n\r\n uint256 offset = page * pageSize;\r\n _pageOfBorrowers = new address[](currentPageSize);\r\n for (uint256 i = 0; i < currentPageSize; i++) {\r\n _pageOfBorrowers[i] = allBorrowers[i + offset];\r\n }\r\n }\r\n\r\n /**\r\n * @notice Return all of the whitelist\r\n * @dev The automatic getter may be used to access an individual whitelist status.\r\n * @return The list of borrower account addresses\r\n */\r\n function getWhitelist() external view returns (address[] memory) {\r\n return whitelistArray;\r\n }\r\n\r\n /**\r\n * @notice Returns an array of all accruing and non-accruing flywheels\r\n */\r\n function getRewardsDistributors() external view returns (address[] memory) {\r\n address[] memory allFlywheels = new address[](rewardsDistributors.length + nonAccruingRewardsDistributors.length);\r\n\r\n uint8 i = 0;\r\n while (i < rewardsDistributors.length) {\r\n allFlywheels[i] = rewardsDistributors[i];\r\n i++;\r\n }\r\n uint8 j = 0;\r\n while (j < nonAccruingRewardsDistributors.length) {\r\n allFlywheels[i + j] = nonAccruingRewardsDistributors[j];\r\n j++;\r\n }\r\n\r\n return allFlywheels;\r\n }\r\n\r\n function getAccruingFlywheels() external view returns (address[] memory) {\r\n return rewardsDistributors;\r\n }\r\n\r\n /**\r\n * @dev Removes a flywheel from the accruing or non-accruing array\r\n * @param flywheelAddress The address of the flywheel to remove from the accruing or non-accruing array\r\n * @return true if the flywheel was found and removed\r\n */\r\n function _removeFlywheel(address flywheelAddress) external returns (bool) {\r\n require(hasAdminRights(), \"!admin\");\r\n require(flywheelAddress != address(0), \"!flywheel\");\r\n\r\n // remove it from the accruing\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\r\n if (flywheelAddress == rewardsDistributors[i]) {\r\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\r\n rewardsDistributors.pop();\r\n return true;\r\n }\r\n }\r\n\r\n // or remove it from the non-accruing\r\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\r\n if (flywheelAddress == nonAccruingRewardsDistributors[i]) {\r\n nonAccruingRewardsDistributors[i] = nonAccruingRewardsDistributors[nonAccruingRewardsDistributors.length - 1];\r\n nonAccruingRewardsDistributors.pop();\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n function isUserOfPool(address user) external view returns (bool) {\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n address marketAddress = address(allMarkets[i]);\r\n if (markets[marketAddress].accountMembership[user]) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n function registerInSFS() external returns (uint256) {\r\n require(hasAdminRights(), \"!admin\");\r\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\r\n\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n allMarkets[i].registerInSFS();\r\n }\r\n\r\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\r\n }\r\n}\r\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\r\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\r\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\r\n\r\ninterface ComptrollerInterface {\r\n function isDeprecated(ICErc20 cToken) external view returns (bool);\r\n\r\n function _becomeImplementation() external;\r\n\r\n function _deployMarket(\r\n uint8 delegateType,\r\n bytes memory constructorData,\r\n bytes calldata becomeImplData,\r\n uint256 collateralFactorMantissa\r\n ) external returns (uint256);\r\n\r\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\r\n\r\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\r\n\r\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\r\n\r\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\r\n\r\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\r\n\r\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\r\n\r\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\r\n\r\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\r\n\r\n function _addRewardsDistributor(address distributor) external returns (uint256);\r\n\r\n function getHypotheticalAccountLiquidity(\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) external view returns (uint256, uint256, uint256, uint256);\r\n\r\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\r\n\r\n /*** Assets You Are In ***/\r\n\r\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\r\n\r\n function exitMarket(address cToken) external returns (uint256);\r\n\r\n /*** Policy Hooks ***/\r\n\r\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\r\n\r\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\r\n\r\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\r\n\r\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\r\n\r\n function borrowVerify(address cToken, address borrower) external;\r\n\r\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\r\n\r\n function repayBorrowAllowed(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external returns (uint256);\r\n\r\n function repayBorrowVerify(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external;\r\n\r\n function liquidateBorrowAllowed(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external returns (uint256);\r\n\r\n function seizeAllowed(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external returns (uint256);\r\n \r\n function seizeVerify(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external;\r\n\r\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\r\n \r\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\r\n\r\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\r\n\r\n /*** Liquidity/Liquidation Calculations ***/\r\n\r\n function getAccountLiquidity(\r\n address account\r\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\r\n\r\n function liquidateCalculateSeizeTokens(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n uint256 repayAmount\r\n ) external view returns (uint256, uint256);\r\n\r\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\r\n\r\n function _beforeNonReentrant() external;\r\n\r\n function _afterNonReentrant() external;\r\n\r\n /*** New supply and borrow cap view functions ***/\r\n\r\n /**\r\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\r\n\r\n /**\r\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\r\n}\r\n\r\ninterface ComptrollerStorageInterface {\r\n function admin() external view returns (address);\r\n\r\n function adminHasRights() external view returns (bool);\r\n\r\n function ionicAdmin() external view returns (address);\r\n\r\n function ionicAdminHasRights() external view returns (bool);\r\n\r\n function pendingAdmin() external view returns (address);\r\n\r\n function oracle() external view returns (BasePriceOracle);\r\n\r\n function pauseGuardian() external view returns (address);\r\n\r\n function closeFactorMantissa() external view returns (uint256);\r\n\r\n function liquidationIncentiveMantissa() external view returns (uint256);\r\n\r\n function isUserOfPool(address user) external view returns (bool);\r\n\r\n function whitelist(address account) external view returns (bool);\r\n\r\n function enforceWhitelist() external view returns (bool);\r\n\r\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\r\n\r\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\r\n\r\n function suppliers(address account) external view returns (bool);\r\n\r\n function cTokensByUnderlying(address) external view returns (address);\r\n\r\n /**\r\n * Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\r\n * `effectiveSupplyCaps` to get the correct supply cap.\r\n * @param cToken The address of the cToken.\r\n * @return The supply cap in the units of the underlying asset.\r\n */\r\n function supplyCaps(address cToken) external view returns (uint256);\r\n\r\n /**\r\n * Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\r\n * `effectiveBorrowCaps` to get the correct borrow cap.\r\n * @param cToken The address of the cToken.\r\n * @return The borrow cap in the units of the underlying asset.\r\n */\r\n function borrowCaps(address cToken) external view returns (uint256);\r\n\r\n function markets(address cToken) external view returns (bool, uint256);\r\n\r\n function accountAssets(address, uint256) external view returns (address);\r\n\r\n function borrowGuardianPaused(address cToken) external view returns (bool);\r\n\r\n function mintGuardianPaused(address cToken) external view returns (bool);\r\n\r\n function rewardsDistributors(uint256) external view returns (address);\r\n}\r\n\r\ninterface SFSRegister {\r\n function register(address _recipient) external returns (uint256 tokenId);\r\n}\r\n\r\ninterface ComptrollerExtensionInterface {\r\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\r\n\r\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\r\n\r\n function getAllMarkets() external view returns (ICErc20[] memory);\r\n\r\n function getAllBorrowers() external view returns (address[] memory);\r\n\r\n function getAllBorrowersCount() external view returns (uint256);\r\n\r\n function getPaginatedBorrowers(\r\n uint256 page,\r\n uint256 pageSize\r\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\r\n\r\n function getRewardsDistributors() external view returns (address[] memory);\r\n\r\n function getAccruingFlywheels() external view returns (address[] memory);\r\n\r\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\r\n\r\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\r\n\r\n function _setBorrowCapForCollateralWhitelist(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account,\r\n bool whitelisted\r\n ) external;\r\n\r\n function isBorrowCapForCollateralWhitelisted(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account\r\n ) external view returns (bool);\r\n\r\n function _blacklistBorrowingAgainstCollateral(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n bool blacklisted\r\n ) external;\r\n\r\n function _blacklistBorrowingAgainstCollateralWhitelist(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account,\r\n bool whitelisted\r\n ) external;\r\n\r\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account\r\n ) external view returns (bool);\r\n\r\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\r\n\r\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\r\n\r\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\r\n\r\n function _removeFlywheel(address flywheelAddress) external returns (bool);\r\n\r\n function getWhitelist() external view returns (address[] memory);\r\n\r\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\r\n\r\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\r\n\r\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\r\n\r\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\r\n\r\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\r\n\r\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\r\n\r\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\r\n\r\n function _setTransferPaused(bool state) external returns (bool);\r\n\r\n function _setSeizePaused(bool state) external returns (bool);\r\n\r\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\r\n\r\n function getAssetAsCollateralValueCap(\r\n ICErc20 collateral,\r\n ICErc20 cTokenModify,\r\n bool redeeming,\r\n address account\r\n ) external view returns (uint256);\r\n\r\n function registerInSFS() external returns (uint256);\r\n}\r\n\r\ninterface ComptrollerPrudentiaCapsExtInterface {\r\n /**\r\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\r\n * @return The config.\r\n */\r\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\r\n\r\n /**\r\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\r\n * @return The config.\r\n */\r\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\r\n\r\n /**\r\n * @notice Sets the Adrastia Prudentia supply cap config.\r\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\r\n * @param newConfig The new config.\r\n */\r\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\r\n\r\n /**\r\n * @notice Sets the Adrastia Prudentia supply cap config.\r\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\r\n * @param newConfig The new config.\r\n */\r\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\r\n}\r\n\r\ninterface UnitrollerInterface {\r\n function comptrollerImplementation() external view returns (address);\r\n\r\n function _upgrade() external;\r\n\r\n function _acceptAdmin() external returns (uint256);\r\n\r\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\r\n\r\n function _toggleAdminRights(bool hasRights) external returns (uint256);\r\n}\r\n\r\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\r\n\r\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\r\n\r\ninterface IonicComptroller is\r\n ComptrollerInterface,\r\n ComptrollerExtensionInterface,\r\n UnitrollerInterface,\r\n ComptrollerStorageInterface\r\n{\r\n\r\n}\r\n\r\nabstract contract ComptrollerBase is ComptrollerV4Storage {\r\n /// @notice Indicator that this is a Comptroller contract (for inspection)\r\n bool public constant isComptroller = true;\r\n\r\n /**\r\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\r\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\r\n\r\n // Check if we're using Adrastia Prudentia for the supply cap\r\n if (capConfig.controller != address(0)) {\r\n // We have a controller, so we're using Adrastia Prudentia\r\n\r\n address underlyingToken = ICErc20(cToken).underlying();\r\n\r\n // Get the supply cap from Adrastia Prudentia\r\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\r\n\r\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\r\n // must scale the supply cap to get the correct amount\r\n\r\n int256 scaleByDecimals = 18;\r\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\r\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\r\n if (success && data.length == 32) {\r\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\r\n }\r\n\r\n scaleByDecimals += capConfig.decimalShift;\r\n\r\n if (scaleByDecimals >= 0) {\r\n // We're scaling up, so we need to multiply\r\n supplyCap *= 10 ** uint256(scaleByDecimals);\r\n } else {\r\n // We're scaling down, so we need to divide\r\n supplyCap /= 10 ** uint256(-scaleByDecimals);\r\n }\r\n } else {\r\n // We don't have a controller, so we're using the local supply cap\r\n\r\n // Get the supply cap from the local supply cap\r\n supplyCap = supplyCaps[cToken];\r\n }\r\n }\r\n\r\n /**\r\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\r\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\r\n\r\n // Check if we're using Adrastia Prudentia for the borrow cap\r\n if (capConfig.controller != address(0)) {\r\n // We have a controller, so we're using Adrastia Prudentia\r\n\r\n address underlyingToken = ICErc20(cToken).underlying();\r\n\r\n // Get the borrow cap from Adrastia Prudentia\r\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\r\n\r\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\r\n // must scale the supply cap to get the correct amount\r\n\r\n int256 scaleByDecimals = 18;\r\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\r\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\r\n if (success && data.length == 32) {\r\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\r\n }\r\n\r\n scaleByDecimals += capConfig.decimalShift;\r\n\r\n if (scaleByDecimals >= 0) {\r\n // We're scaling up, so we need to multiply\r\n borrowCap *= 10 ** uint256(scaleByDecimals);\r\n } else {\r\n // We're scaling down, so we need to divide\r\n borrowCap /= 10 ** uint256(-scaleByDecimals);\r\n }\r\n } else {\r\n // We don't have a controller, so we're using the local borrow cap\r\n borrowCap = borrowCaps[cToken];\r\n }\r\n }\r\n}\r\n" + }, + "contracts/compound/ComptrollerPrudentiaCapsExt.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { ComptrollerPrudentiaCapsExtInterface, ComptrollerBase } from \"./ComptrollerInterface.sol\";\r\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\r\n\r\n/**\r\n * @title ComptrollerPrudentiaCapsExt\r\n * @author Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\r\n * @notice A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\r\n */\r\ncontract ComptrollerPrudentiaCapsExt is DiamondExtension, ComptrollerBase, ComptrollerPrudentiaCapsExtInterface {\r\n /**\r\n * @notice Emitted when the Adrastia Prudentia supply cap config is changed.\r\n * @param oldConfig The old config.\r\n * @param newConfig The new config.\r\n */\r\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\r\n\r\n /**\r\n * @notice Emitted when the Adrastia Prudentia borrow cap config is changed.\r\n * @param oldConfig The old config.\r\n * @param newConfig The new config.\r\n */\r\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\r\n\r\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\r\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\r\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\r\n\r\n PrudentiaLib.PrudentiaConfig memory oldConfig = supplyCapConfig;\r\n supplyCapConfig = newConfig;\r\n\r\n emit NewSupplyCapConfig(oldConfig, newConfig);\r\n }\r\n\r\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\r\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\r\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\r\n\r\n PrudentiaLib.PrudentiaConfig memory oldConfig = borrowCapConfig;\r\n borrowCapConfig = newConfig;\r\n\r\n emit NewBorrowCapConfig(oldConfig, newConfig);\r\n }\r\n\r\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\r\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\r\n return borrowCapConfig;\r\n }\r\n\r\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\r\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\r\n return supplyCapConfig;\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 4;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this._setSupplyCapConfig.selector;\r\n functionSelectors[--fnsCount] = this._setBorrowCapConfig.selector;\r\n functionSelectors[--fnsCount] = this.getBorrowCapConfig.selector;\r\n functionSelectors[--fnsCount] = this.getSupplyCapConfig.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n}\r\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IFeeDistributor.sol\";\r\nimport \"../oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\ncontract UnitrollerAdminStorage {\r\n /*\r\n * Administrator for Ionic\r\n */\r\n address payable public ionicAdmin;\r\n\r\n /**\r\n * @notice Administrator for this contract\r\n */\r\n address public admin;\r\n\r\n /**\r\n * @notice Pending administrator for this contract\r\n */\r\n address public pendingAdmin;\r\n\r\n /**\r\n * @notice Whether or not the Ionic admin has admin rights\r\n */\r\n bool public ionicAdminHasRights = true;\r\n\r\n /**\r\n * @notice Whether or not the admin has admin rights\r\n */\r\n bool public adminHasRights = true;\r\n\r\n /**\r\n * @notice Returns a boolean indicating if the sender has admin rights\r\n */\r\n function hasAdminRights() internal view returns (bool) {\r\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\r\n }\r\n}\r\n\r\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\r\n /**\r\n * @notice Oracle which gives the price of any given asset\r\n */\r\n BasePriceOracle public oracle;\r\n\r\n /**\r\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\r\n */\r\n uint256 public closeFactorMantissa;\r\n\r\n /**\r\n * @notice Multiplier representing the discount on collateral that a liquidator receives\r\n */\r\n uint256 public liquidationIncentiveMantissa;\r\n\r\n /*\r\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\r\n */\r\n uint256 internal maxAssets;\r\n\r\n /**\r\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\r\n */\r\n mapping(address => ICErc20[]) public accountAssets;\r\n}\r\n\r\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\r\n struct Market {\r\n // Whether or not this market is listed\r\n bool isListed;\r\n // Multiplier representing the most one can borrow against their collateral in this market.\r\n // For instance, 0.9 to allow borrowing 90% of collateral value.\r\n // Must be between 0 and 1, and stored as a mantissa.\r\n uint256 collateralFactorMantissa;\r\n // Per-market mapping of \"accounts in this asset\"\r\n mapping(address => bool) accountMembership;\r\n }\r\n\r\n /**\r\n * @notice Official mapping of cTokens -> Market metadata\r\n * @dev Used e.g. to determine if a market is supported\r\n */\r\n mapping(address => Market) public markets;\r\n\r\n /// @notice A list of all markets\r\n ICErc20[] public allMarkets;\r\n\r\n /**\r\n * @dev Maps borrowers to booleans indicating if they have entered any markets\r\n */\r\n mapping(address => bool) internal borrowers;\r\n\r\n /// @notice A list of all borrowers who have entered markets\r\n address[] public allBorrowers;\r\n\r\n // Indexes of borrower account addresses in the `allBorrowers` array\r\n mapping(address => uint256) internal borrowerIndexes;\r\n\r\n /**\r\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\r\n */\r\n mapping(address => bool) public suppliers;\r\n\r\n /// @notice All cTokens addresses mapped by their underlying token addresses\r\n mapping(address => ICErc20) public cTokensByUnderlying;\r\n\r\n /// @notice Whether or not the supplier whitelist is enforced\r\n bool public enforceWhitelist;\r\n\r\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\r\n mapping(address => bool) public whitelist;\r\n\r\n /// @notice An array of all whitelisted accounts\r\n address[] public whitelistArray;\r\n\r\n // Indexes of account addresses in the `whitelistArray` array\r\n mapping(address => uint256) internal whitelistIndexes;\r\n\r\n /**\r\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\r\n * Actions which allow users to remove their own assets cannot be paused.\r\n * Liquidation / seizing / transfer can only be paused globally, not by market.\r\n */\r\n address public pauseGuardian;\r\n bool public _mintGuardianPaused;\r\n bool public _borrowGuardianPaused;\r\n bool public transferGuardianPaused;\r\n bool public seizeGuardianPaused;\r\n mapping(address => bool) public mintGuardianPaused;\r\n mapping(address => bool) public borrowGuardianPaused;\r\n}\r\n\r\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\r\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\r\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\r\n address public borrowCapGuardian;\r\n\r\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\r\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\r\n mapping(address => uint256) public borrowCaps;\r\n\r\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\r\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\r\n mapping(address => uint256) public supplyCaps;\r\n\r\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\r\n address[] public rewardsDistributors;\r\n\r\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\r\n bool internal _notEntered;\r\n\r\n /// @dev Whether or not _notEntered has been initialized\r\n bool internal _notEnteredInitialized;\r\n\r\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\r\n address[] public nonAccruingRewardsDistributors;\r\n\r\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\r\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\r\n\r\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\r\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\r\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\r\n mapping(address => mapping(address => EnumerableSet.AddressSet))\r\n internal borrowingAgainstCollateralBlacklistWhitelist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\r\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\r\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\r\n}\r\n\r\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\r\n /// @dev Adrastia Prudentia config for controlling borrow caps.\r\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\r\n\r\n /// @dev Adrastia Prudentia config for controlling supply caps.\r\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\r\n}\r\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\r\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\r\nimport { Exponential } from \"./Exponential.sol\";\r\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\r\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\r\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\r\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\r\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\r\n\r\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\r\nimport { PoolLens } from \"../PoolLens.sol\";\r\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\r\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\r\n\r\n/**\r\n * @title Compound's CErc20 Contract\r\n * @notice CTokens which wrap an EIP-20 underlying\r\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\r\n * @author Compound\r\n */\r\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\r\n modifier isAuthorized() {\r\n require(\r\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\r\n \"not authorized\"\r\n );\r\n _;\r\n }\r\n\r\n modifier isMinHFThresholdExceeded(address borrower) {\r\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\r\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n\r\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\r\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\r\n _;\r\n } else {\r\n _;\r\n }\r\n }\r\n\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 13;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.mint.selector;\r\n functionSelectors[--fnsCount] = this.redeem.selector;\r\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\r\n functionSelectors[--fnsCount] = this.borrow.selector;\r\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\r\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\r\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\r\n functionSelectors[--fnsCount] = this.getCash.selector;\r\n functionSelectors[--fnsCount] = this.seize.selector;\r\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\r\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\r\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\r\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n /*** User Interface ***/\r\n\r\n /**\r\n * @notice Sender supplies assets into the market and receives cTokens in exchange\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param mintAmount The amount of the underlying asset to supply\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n (uint256 err, ) = mintInternal(mintAmount);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for the underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemTokens The number of cTokens to redeem into underlying\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n return redeemInternal(redeemTokens);\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemAmount The amount of underlying to redeem\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n return redeemUnderlyingInternal(redeemAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender borrows assets from the protocol to their own address\r\n * @param borrowAmount The amount of the underlying asset to borrow\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n return borrowInternal(borrowAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender repays their own borrow\r\n * @param repayAmount The amount to repay\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n (uint256 err, ) = repayBorrowInternal(repayAmount);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice Sender repays a borrow belonging to borrower\r\n * @param borrower the account with the debt being payed off\r\n * @param repayAmount The amount to repay\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice The sender liquidates the borrowers collateral.\r\n * The collateral seized is transferred to the liquidator.\r\n * @param borrower The borrower of this cToken to be liquidated\r\n * @param repayAmount The amount of the underlying borrowed asset to repay\r\n * @param cTokenCollateral The market in which to seize collateral from the borrower\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function liquidateBorrow(\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\r\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice Get cash balance of this cToken in the underlying asset\r\n * @return The quantity of underlying asset owned by this contract\r\n */\r\n function getCash() external view override returns (uint256) {\r\n return getCashInternal();\r\n }\r\n\r\n /**\r\n * @notice Transfers collateral tokens (this market) to the liquidator.\r\n * @dev Will fail unless called by another cToken during the process of liquidation.\r\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\r\n * @param liquidator The account receiving seized collateral\r\n * @param borrower The account having collateral seized\r\n * @param seizeTokens The number of cTokens to seize\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function seize(\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\r\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\r\n }\r\n\r\n function selfTransferOut(address to, uint256 amount) external override {\r\n require(msg.sender == address(this), \"!self\");\r\n doTransferOut(to, amount);\r\n }\r\n\r\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\r\n require(msg.sender == address(this), \"!self\");\r\n return doTransferIn(from, amount);\r\n }\r\n\r\n /**\r\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\r\n * @param withdrawAmount Amount of fees to withdraw\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\r\n }\r\n\r\n if (getCashInternal() < withdrawAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\r\n }\r\n\r\n if (withdrawAmount > totalIonicFees) {\r\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\r\n totalIonicFees = totalIonicFeesNew;\r\n\r\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n doTransferOut(address(ionicAdmin), withdrawAmount);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Accrues interest and reduces admin fees by transferring to admin\r\n * @param withdrawAmount Amount of fees to withdraw\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\r\n }\r\n\r\n // Fail gracefully if protocol has insufficient underlying cash\r\n if (getCashInternal() < withdrawAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\r\n }\r\n\r\n if (withdrawAmount > totalAdminFees) {\r\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n totalAdminFees = totalAdminFees - withdrawAmount;\r\n\r\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /*** Safe Token ***/\r\n\r\n /**\r\n * @notice Gets balance of this contract in terms of the underlying\r\n * @dev This excludes the value of the current message, if any\r\n * @return The quantity of underlying tokens owned by this contract\r\n */\r\n function getCashInternal() internal view virtual returns (uint256) {\r\n return EIP20Interface(underlying).balanceOf(address(this));\r\n }\r\n\r\n /**\r\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\r\n * This will revert due to insufficient balance or insufficient allowance.\r\n * This function returns the actual amount received,\r\n * which may be less than `amount` if there is a fee attached to the transfer.\r\n *\r\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\r\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\r\n */\r\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\r\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\r\n _callOptionalReturn(\r\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\r\n \"TOKEN_TRANSFER_IN_FAILED\"\r\n );\r\n\r\n // Calculate the amount that was *actually* transferred\r\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\r\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\r\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\r\n }\r\n\r\n /**\r\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\r\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\r\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\r\n * it is >= amount, this should not revert in normal conditions.\r\n *\r\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\r\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\r\n */\r\n function doTransferOut(address to, uint256 amount) internal virtual {\r\n _callOptionalReturn(\r\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\r\n \"TOKEN_TRANSFER_OUT_FAILED\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n * @param errorMessage The revert string to return on failure.\r\n */\r\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\r\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\r\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\r\n }\r\n\r\n /**\r\n * @notice Sender supplies assets into the market and receives cTokens in exchange\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param mintAmount The amount of the underlying asset to supply\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\r\n */\r\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\r\n return mintFresh(msg.sender, mintAmount);\r\n }\r\n\r\n struct MintLocalVars {\r\n Error err;\r\n MathError mathErr;\r\n uint256 exchangeRateMantissa;\r\n uint256 mintTokens;\r\n uint256 totalSupplyNew;\r\n uint256 accountTokensNew;\r\n uint256 actualMintAmount;\r\n }\r\n\r\n /**\r\n * @notice User supplies assets into the market and receives cTokens in exchange\r\n * @dev Assumes interest has already been accrued up to the current block\r\n * @param minter The address of the account which is supplying the assets\r\n * @param mintAmount The amount of the underlying asset to supply\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\r\n */\r\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\r\n /* Fail if mint not allowed */\r\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n MintLocalVars memory vars;\r\n\r\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\r\n\r\n // Check max supply\r\n // unused function\r\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\r\n } */\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /*\r\n * We call `doTransferIn` for the minter and the mintAmount.\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\r\n * side-effects occurred. The function returns the amount actually transferred,\r\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\r\n * of cash.\r\n */\r\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\r\n\r\n /*\r\n * We get the current exchange rate and calculate the number of cTokens to be minted:\r\n * mintTokens = actualMintAmount / exchangeRate\r\n */\r\n\r\n // mintTokens is rounded down here - correct\r\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\r\n vars.actualMintAmount,\r\n Exp({ mantissa: vars.exchangeRateMantissa })\r\n );\r\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\r\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\r\n\r\n /*\r\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\r\n * totalSupplyNew = totalSupply + mintTokens\r\n * accountTokensNew = accountTokens[minter] + mintTokens\r\n */\r\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\r\n\r\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\r\n\r\n /* We write previously calculated values into storage */\r\n totalSupply = vars.totalSupplyNew;\r\n accountTokens[minter] = vars.accountTokensNew;\r\n\r\n /* We emit a Mint event, and a Transfer event */\r\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\r\n emit Transfer(address(this), minter, vars.mintTokens);\r\n\r\n /* We call the defense hook */\r\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\r\n\r\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for the underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemTokens The number of cTokens to redeem into underlying\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\r\n return redeemFresh(msg.sender, redeemTokens, 0);\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\r\n return redeemFresh(msg.sender, 0, redeemAmount);\r\n }\r\n\r\n struct RedeemLocalVars {\r\n Error err;\r\n MathError mathErr;\r\n uint256 exchangeRateMantissa;\r\n uint256 redeemTokens;\r\n uint256 redeemAmount;\r\n uint256 totalSupplyNew;\r\n uint256 accountTokensNew;\r\n }\r\n\r\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\r\n res = (x * 1e18) / y;\r\n if (x % y != 0) res += 1;\r\n }\r\n\r\n /**\r\n * @notice User redeems cTokens in exchange for the underlying asset\r\n * @dev Assumes interest has already been accrued up to the current block\r\n * @param redeemer The address of the account which is redeeming the tokens\r\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\r\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemFresh(\r\n address redeemer,\r\n uint256 redeemTokensIn,\r\n uint256 redeemAmountIn\r\n ) internal returns (uint256) {\r\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\r\n\r\n RedeemLocalVars memory vars;\r\n\r\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\r\n\r\n if (redeemTokensIn > 0) {\r\n // don't allow dust tokens/assets to be left after\r\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\r\n\r\n /*\r\n * We calculate the exchange rate and the amount of underlying to be redeemed:\r\n * redeemTokens = redeemTokensIn\r\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\r\n */\r\n vars.redeemTokens = redeemTokensIn;\r\n\r\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\r\n Exp({ mantissa: vars.exchangeRateMantissa }),\r\n redeemTokensIn\r\n );\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n } else {\r\n if (redeemAmountIn == type(uint256).max) {\r\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\r\n }\r\n\r\n // don't allow dust tokens/assets to be left after\r\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\r\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\r\n\r\n /*\r\n * We get the current exchange rate and calculate the amount to be redeemed:\r\n * redeemTokens = redeemAmountIn / exchangeRate\r\n * redeemAmount = redeemAmountIn\r\n */\r\n\r\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\r\n\r\n // don't allow dust tokens/assets to be left after\r\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\r\n\r\n vars.redeemAmount = redeemAmountIn;\r\n }\r\n\r\n /* Fail if redeem not allowed */\r\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\r\n }\r\n\r\n /*\r\n * We calculate the new total supply and redeemer balance, checking for underflow:\r\n * totalSupplyNew = totalSupply - redeemTokens\r\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\r\n */\r\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n /* Fail gracefully if protocol has insufficient cash */\r\n if (getCashInternal() < vars.redeemAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We write previously calculated values into storage */\r\n totalSupply = vars.totalSupplyNew;\r\n accountTokens[redeemer] = vars.accountTokensNew;\r\n\r\n /*\r\n * We invoke doTransferOut for the redeemer and the redeemAmount.\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * On success, the cToken has redeemAmount less of cash.\r\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n */\r\n doTransferOut(redeemer, vars.redeemAmount);\r\n\r\n /* We emit a Transfer event, and a Redeem event */\r\n emit Transfer(redeemer, address(this), vars.redeemTokens);\r\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\r\n\r\n /* We call the defense hook */\r\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sender borrows assets from the protocol to their own address\r\n * @param borrowAmount The amount of the underlying asset to borrow\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\r\n return borrowFresh(msg.sender, borrowAmount);\r\n }\r\n\r\n struct BorrowLocalVars {\r\n MathError mathErr;\r\n uint256 accountBorrows;\r\n uint256 accountBorrowsNew;\r\n uint256 totalBorrowsNew;\r\n }\r\n\r\n /**\r\n * @notice Users borrow assets from the protocol to their own address\r\n * @param borrowAmount The amount of the underlying asset to borrow\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\r\n /* Fail if borrow not allowed */\r\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\r\n }\r\n\r\n /* Fail gracefully if protocol has insufficient underlying cash */\r\n uint256 cashPrior = getCashInternal();\r\n\r\n if (cashPrior < borrowAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\r\n }\r\n\r\n BorrowLocalVars memory vars;\r\n\r\n /*\r\n * We calculate the new borrower and total borrow balances, failing on overflow:\r\n * accountBorrowsNew = accountBorrows + borrowAmount\r\n * totalBorrowsNew = totalBorrows + borrowAmount\r\n */\r\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\r\n\r\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(\r\n Error.MATH_ERROR,\r\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\r\n uint256(vars.mathErr)\r\n );\r\n }\r\n\r\n // Check min borrow for this user for this asset\r\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We write the previously calculated values into storage */\r\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\r\n accountBorrows[borrower].interestIndex = borrowIndex;\r\n totalBorrows = vars.totalBorrowsNew;\r\n\r\n /*\r\n * We invoke doTransferOut for the borrower and the borrowAmount.\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * On success, the cToken borrowAmount less of cash.\r\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n */\r\n doTransferOut(borrower, borrowAmount);\r\n\r\n /* We emit a Borrow event */\r\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\r\n\r\n /* We call the defense hook */\r\n comptroller.borrowVerify(address(this), borrower);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sender repays their own borrow\r\n * @param repayAmount The amount to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\r\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender repays a borrow belonging to borrower\r\n * @param borrower the account with the debt being payed off\r\n * @param repayAmount The amount to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\r\n internal\r\n nonReentrant(false)\r\n returns (uint256, uint256)\r\n {\r\n asCTokenExtension().accrueInterest();\r\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\r\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\r\n }\r\n\r\n struct RepayBorrowLocalVars {\r\n Error err;\r\n MathError mathErr;\r\n uint256 repayAmount;\r\n uint256 borrowerIndex;\r\n uint256 accountBorrows;\r\n uint256 accountBorrowsNew;\r\n uint256 totalBorrowsNew;\r\n uint256 actualRepayAmount;\r\n }\r\n\r\n /**\r\n * @notice Borrows are repaid by another user (possibly the borrower).\r\n * @param payer the account paying off the borrow\r\n * @param borrower the account with the debt being payed off\r\n * @param repayAmount the amount of undelrying tokens being returned\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function repayBorrowFresh(\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) internal returns (uint256, uint256) {\r\n /* Fail if repayBorrow not allowed */\r\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n RepayBorrowLocalVars memory vars;\r\n\r\n /* We remember the original borrowerIndex for verification purposes */\r\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\r\n\r\n /* We fetch the amount the borrower owes, with accumulated interest */\r\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\r\n\r\n /* If repayAmount == -1, repayAmount = accountBorrows */\r\n if (repayAmount == type(uint256).max) {\r\n vars.repayAmount = vars.accountBorrows;\r\n } else {\r\n vars.repayAmount = repayAmount;\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /*\r\n * We call doTransferIn for the payer and the repayAmount\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * On success, the cToken holds an additional repayAmount of cash.\r\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n * it returns the amount actually transferred, in case of a fee.\r\n */\r\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\r\n\r\n /*\r\n * We calculate the new borrower and total borrow balances, failing on underflow:\r\n * accountBorrowsNew = accountBorrows - actualRepayAmount\r\n * totalBorrowsNew = totalBorrows - actualRepayAmount\r\n */\r\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\r\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\r\n\r\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\r\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\r\n\r\n /* We write the previously calculated values into storage */\r\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\r\n accountBorrows[borrower].interestIndex = borrowIndex;\r\n totalBorrows = vars.totalBorrowsNew;\r\n\r\n /* We emit a RepayBorrow event */\r\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\r\n\r\n /* We call the defense hook */\r\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\r\n\r\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\r\n }\r\n\r\n /**\r\n * @notice The sender liquidates the borrowers collateral.\r\n * The collateral seized is transferred to the liquidator.\r\n * @param borrower The borrower of this cToken to be liquidated\r\n * @param cTokenCollateral The market in which to seize collateral from the borrower\r\n * @param repayAmount The amount of the underlying borrowed asset to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function liquidateBorrowInternal(\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) internal nonReentrant(false) returns (uint256, uint256) {\r\n asCTokenExtension().accrueInterest();\r\n ICErc20(cTokenCollateral).accrueInterest();\r\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\r\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\r\n }\r\n\r\n /**\r\n * @notice The liquidator liquidates the borrowers collateral.\r\n * The collateral seized is transferred to the liquidator.\r\n * @param borrower The borrower of this cToken to be liquidated\r\n * @param liquidator The address repaying the borrow and seizing collateral\r\n * @param cTokenCollateral The market in which to seize collateral from the borrower\r\n * @param repayAmount The amount of the underlying borrowed asset to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function liquidateBorrowFresh(\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) internal returns (uint256, uint256) {\r\n /* Fail if liquidate not allowed */\r\n uint256 allowed = comptroller.liquidateBorrowAllowed(\r\n address(this),\r\n cTokenCollateral,\r\n liquidator,\r\n borrower,\r\n repayAmount\r\n );\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n /* Verify cTokenCollateral market's block number equals current block number */\r\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n /* Fail if borrower = liquidator */\r\n if (borrower == liquidator) {\r\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\r\n }\r\n\r\n /* Fail if repayAmount = 0 */\r\n if (repayAmount == 0) {\r\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\r\n }\r\n\r\n /* Fail if repayAmount = -1 */\r\n if (repayAmount == type(uint256).max) {\r\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\r\n }\r\n\r\n /* Fail if repayBorrow fails */\r\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\r\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\r\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We calculate the number of collateral tokens that will be seized */\r\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\r\n address(this),\r\n cTokenCollateral,\r\n actualRepayAmount\r\n );\r\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\r\n\r\n /* Revert if borrower collateral token balance < seizeTokens */\r\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\r\n\r\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\r\n uint256 seizeError;\r\n if (cTokenCollateral == address(this)) {\r\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\r\n } else {\r\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\r\n }\r\n\r\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\r\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\r\n\r\n /* We emit a LiquidateBorrow event */\r\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\r\n\r\n /* We call the defense hook */\r\n // unused function\r\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\r\n\r\n return (uint256(Error.NO_ERROR), actualRepayAmount);\r\n }\r\n\r\n struct SeizeInternalLocalVars {\r\n MathError mathErr;\r\n uint256 borrowerTokensNew;\r\n uint256 liquidatorTokensNew;\r\n uint256 liquidatorSeizeTokens;\r\n uint256 protocolSeizeTokens;\r\n uint256 protocolSeizeAmount;\r\n uint256 exchangeRateMantissa;\r\n uint256 totalReservesNew;\r\n uint256 totalIonicFeeNew;\r\n uint256 totalSupplyNew;\r\n uint256 feeSeizeTokens;\r\n uint256 feeSeizeAmount;\r\n }\r\n\r\n /**\r\n * @notice Transfers collateral tokens (this market) to the liquidator.\r\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\r\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\r\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\r\n * @param liquidator The account receiving seized collateral\r\n * @param borrower The account having collateral seized\r\n * @param seizeTokens The number of cTokens to seize\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function seizeInternal(\r\n address seizerToken,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) internal returns (uint256) {\r\n /* Fail if seize not allowed */\r\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Fail if borrower = liquidator */\r\n if (borrower == liquidator) {\r\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\r\n }\r\n\r\n SeizeInternalLocalVars memory vars;\r\n\r\n /*\r\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\r\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\r\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\r\n */\r\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\r\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\r\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\r\n\r\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\r\n\r\n vars.protocolSeizeAmount = mul_ScalarTruncate(\r\n Exp({ mantissa: vars.exchangeRateMantissa }),\r\n vars.protocolSeizeTokens\r\n );\r\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\r\n\r\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\r\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\r\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\r\n\r\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We write the previously calculated values into storage */\r\n totalReserves = vars.totalReservesNew;\r\n totalSupply = vars.totalSupplyNew;\r\n totalIonicFees = vars.totalIonicFeeNew;\r\n\r\n accountTokens[borrower] = vars.borrowerTokensNew;\r\n accountTokens[liquidator] = vars.liquidatorTokensNew;\r\n\r\n /* Emit a Transfer event */\r\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\r\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\r\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\r\n\r\n /* We call the defense hook */\r\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function asCTokenExtension() internal view returns (ICErc20) {\r\n return ICErc20(address(this));\r\n }\r\n\r\n /*** Reentrancy Guard ***/\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n */\r\n modifier nonReentrant(bool localOnly) {\r\n _beforeNonReentrant(localOnly);\r\n _;\r\n _afterNonReentrant(localOnly);\r\n }\r\n\r\n /**\r\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\r\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\r\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\r\n */\r\n function _beforeNonReentrant(bool localOnly) private {\r\n require(_notEntered, \"re-entered\");\r\n if (!localOnly) comptroller._beforeNonReentrant();\r\n _notEntered = false;\r\n }\r\n\r\n /**\r\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\r\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\r\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\r\n */\r\n function _afterNonReentrant(bool localOnly) private {\r\n _notEntered = true; // get a gas-refund post-Istanbul\r\n if (!localOnly) comptroller._afterNonReentrant();\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n * @param errorMessage The revert string to return on failure.\r\n */\r\n function _functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.call(data);\r\n\r\n if (!success) {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n\r\n return returndata;\r\n }\r\n}\r\n" + }, + "contracts/compound/CTokenFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\r\nimport { IFlashLoanReceiver } from \"../ionic/IFlashLoanReceiver.sol\";\r\nimport { CErc20FirstExtensionBase, CTokenFirstExtensionInterface, ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { SFSRegister } from \"./ComptrollerInterface.sol\";\r\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\r\nimport { Exponential } from \"./Exponential.sol\";\r\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\r\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\r\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\r\n\r\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\nimport { Multicall } from \"../utils/Multicall.sol\";\r\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\r\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\r\n\r\ncontract CTokenFirstExtension is\r\n CTokenOracleProtected,\r\n CErc20FirstExtensionBase,\r\n TokenErrorReporter,\r\n Exponential,\r\n DiamondExtension,\r\n Multicall\r\n{\r\n modifier isAuthorized() {\r\n require(\r\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\r\n \"not authorized\"\r\n );\r\n _;\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 25;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.transfer.selector;\r\n functionSelectors[--fnsCount] = this.transferFrom.selector;\r\n functionSelectors[--fnsCount] = this.allowance.selector;\r\n functionSelectors[--fnsCount] = this.approve.selector;\r\n functionSelectors[--fnsCount] = this.balanceOf.selector;\r\n functionSelectors[--fnsCount] = this._setAdminFee.selector;\r\n functionSelectors[--fnsCount] = this._setInterestRateModel.selector;\r\n functionSelectors[--fnsCount] = this._setNameAndSymbol.selector;\r\n functionSelectors[--fnsCount] = this._setAddressesProvider.selector;\r\n functionSelectors[--fnsCount] = this._setReserveFactor.selector;\r\n functionSelectors[--fnsCount] = this.supplyRatePerBlock.selector;\r\n functionSelectors[--fnsCount] = this.borrowRatePerBlock.selector;\r\n functionSelectors[--fnsCount] = this.exchangeRateCurrent.selector;\r\n functionSelectors[--fnsCount] = this.accrueInterest.selector;\r\n functionSelectors[--fnsCount] = this.totalBorrowsCurrent.selector;\r\n functionSelectors[--fnsCount] = this.balanceOfUnderlying.selector;\r\n functionSelectors[--fnsCount] = this.multicall.selector;\r\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterDeposit.selector;\r\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterWithdraw.selector;\r\n functionSelectors[--fnsCount] = this.borrowRatePerBlockAfterBorrow.selector;\r\n functionSelectors[--fnsCount] = this.getTotalUnderlyingSupplied.selector;\r\n functionSelectors[--fnsCount] = this.flash.selector;\r\n functionSelectors[--fnsCount] = this.getAccountSnapshot.selector;\r\n functionSelectors[--fnsCount] = this.borrowBalanceCurrent.selector;\r\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n function getTotalUnderlyingSupplied() public view override returns (uint256) {\r\n // (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees))\r\n return asCToken().getCash() + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees);\r\n }\r\n\r\n /* ERC20 fns */\r\n /**\r\n * @notice Transfer `tokens` tokens from `src` to `dst` by `spender`\r\n * @dev Called by both `transfer` and `transferFrom` internally\r\n * @param spender The address of the account performing the transfer\r\n * @param src The address of the source account\r\n * @param dst The address of the destination account\r\n * @param tokens The number of tokens to transfer\r\n * @return Whether or not the transfer succeeded\r\n */\r\n function transferTokens(address spender, address src, address dst, uint256 tokens) internal returns (uint256) {\r\n /* Fail if transfer not allowed */\r\n uint256 allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Do not allow self-transfers */\r\n if (src == dst) {\r\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\r\n }\r\n\r\n /* Get the allowance, infinite for the account owner */\r\n uint256 startingAllowance = 0;\r\n if (spender == src) {\r\n startingAllowance = type(uint256).max;\r\n } else {\r\n startingAllowance = transferAllowances[src][spender];\r\n }\r\n\r\n /* Do the calculations, checking for {under,over}flow */\r\n MathError mathErr;\r\n uint256 allowanceNew;\r\n uint256 srcTokensNew;\r\n uint256 dstTokensNew;\r\n\r\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\r\n if (mathErr != MathError.NO_ERROR) {\r\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\r\n }\r\n\r\n (mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens);\r\n if (mathErr != MathError.NO_ERROR) {\r\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\r\n }\r\n\r\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\r\n if (mathErr != MathError.NO_ERROR) {\r\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n accountTokens[src] = srcTokensNew;\r\n accountTokens[dst] = dstTokensNew;\r\n\r\n /* Eat some of the allowance (if necessary) */\r\n if (startingAllowance != type(uint256).max) {\r\n transferAllowances[src][spender] = allowanceNew;\r\n }\r\n\r\n /* We emit a Transfer event */\r\n emit Transfer(src, dst, tokens);\r\n\r\n /* We call the defense hook */\r\n comptroller.transferVerify(address(this), src, dst, tokens);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n * @return Whether or not the transfer succeeded\r\n */\r\n function transfer(\r\n address dst,\r\n uint256 amount\r\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\r\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `src` to `dst`\r\n * @param src The address of the source account\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n * @return Whether or not the transfer succeeded\r\n */\r\n function transferFrom(\r\n address src,\r\n address dst,\r\n uint256 amount\r\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\r\n return transferTokens(msg.sender, src, dst, amount) == uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Approve `spender` to transfer up to `amount` from `src`\r\n * @dev This will overwrite the approval amount for `spender`\r\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\r\n * @param spender The address of the account which may transfer tokens\r\n * @param amount The number of tokens that are approved (-1 means infinite)\r\n * @return Whether or not the approval succeeded\r\n */\r\n function approve(\r\n address spender,\r\n uint256 amount\r\n ) public override isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\r\n address src = msg.sender;\r\n transferAllowances[src][spender] = amount;\r\n emit Approval(src, spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @notice Get the current allowance from `owner` for `spender`\r\n * @param owner The address of the account which owns the tokens to be spent\r\n * @param spender The address of the account which may transfer tokens\r\n * @return The number of tokens allowed to be spent (-1 means infinite)\r\n */\r\n function allowance(address owner, address spender) public view override returns (uint256) {\r\n return transferAllowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @notice Get the token balance of the `owner`\r\n * @param owner The address of the account to query\r\n * @return The number of tokens owned by `owner`\r\n */\r\n function balanceOf(address owner) public view override returns (uint256) {\r\n return accountTokens[owner];\r\n }\r\n\r\n /*** Admin Functions ***/\r\n\r\n /**\r\n * @notice updates the cToken ERC20 name and symbol\r\n * @dev Admin function to update the cToken ERC20 name and symbol\r\n * @param _name the new ERC20 token name to use\r\n * @param _symbol the new ERC20 token symbol to use\r\n */\r\n function _setNameAndSymbol(string calldata _name, string calldata _symbol) external {\r\n // Check caller is admin\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n // Set ERC20 name and symbol\r\n name = _name;\r\n symbol = _symbol;\r\n }\r\n\r\n function _setAddressesProvider(address _ap) external {\r\n // Check caller is admin\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n ap = AddressesProvider(_ap);\r\n }\r\n\r\n /**\r\n * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\r\n * @dev Admin function to accrue interest and set a new reserve factor\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setReserveFactor(\r\n uint256 newReserveFactorMantissa\r\n ) public override nonReentrant(false) returns (uint256) {\r\n accrueInterest();\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);\r\n }\r\n\r\n // Verify market's block number equals current block number\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\r\n }\r\n\r\n // Check newReserveFactor ≤ maxReserveFactor\r\n if (newReserveFactorMantissa + adminFeeMantissa + ionicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\r\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\r\n }\r\n\r\n uint256 oldReserveFactorMantissa = reserveFactorMantissa;\r\n reserveFactorMantissa = newReserveFactorMantissa;\r\n\r\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice accrues interest and sets a new admin fee for the protocol using _setAdminFeeFresh\r\n * @dev Admin function to accrue interest and set a new admin fee\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setAdminFee(\r\n uint256 newAdminFeeMantissa\r\n ) public override nonReentrant(false) returns (uint256) {\r\n accrueInterest();\r\n // Verify market's block number equals current block number\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_ADMIN_FEE_FRESH_CHECK);\r\n }\r\n\r\n // Sanitize newAdminFeeMantissa\r\n if (newAdminFeeMantissa == type(uint256).max) newAdminFeeMantissa = adminFeeMantissa;\r\n\r\n // Get latest Ionic fee\r\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\r\n\r\n // Check reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa ≤ reserveFactorPlusFeesMaxMantissa\r\n if (reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\r\n return fail(Error.BAD_INPUT, FailureInfo.SET_ADMIN_FEE_BOUNDS_CHECK);\r\n }\r\n\r\n // If setting admin fee\r\n if (adminFeeMantissa != newAdminFeeMantissa) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_ADMIN_FEE_ADMIN_CHECK);\r\n }\r\n\r\n // Set admin fee\r\n uint256 oldAdminFeeMantissa = adminFeeMantissa;\r\n adminFeeMantissa = newAdminFeeMantissa;\r\n\r\n // Emit event\r\n emit NewAdminFee(oldAdminFeeMantissa, newAdminFeeMantissa);\r\n }\r\n\r\n // If setting Ionic fee\r\n if (ionicFeeMantissa != newIonicFeeMantissa) {\r\n // Set Ionic fee\r\n uint256 oldIonicFeeMantissa = ionicFeeMantissa;\r\n ionicFeeMantissa = newIonicFeeMantissa;\r\n\r\n // Emit event\r\n emit NewIonicFee(oldIonicFeeMantissa, newIonicFeeMantissa);\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice accrues interest and updates the interest rate model using _setInterestRateModelFresh\r\n * @dev Admin function to accrue interest and update the interest rate model\r\n * @param newInterestRateModel the new interest rate model to use\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setInterestRateModel(\r\n InterestRateModel newInterestRateModel\r\n ) public override nonReentrant(false) returns (uint256) {\r\n accrueInterest();\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_INTEREST_RATE_MODEL_OWNER_CHECK);\r\n }\r\n\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\r\n }\r\n\r\n require(newInterestRateModel.isInterestRateModel(), \"!notIrm\");\r\n\r\n InterestRateModel oldInterestRateModel = interestRateModel;\r\n interestRateModel = newInterestRateModel;\r\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Returns the current per-block borrow interest rate for this cToken\r\n * @return The borrow interest rate per block, scaled by 1e18\r\n */\r\n function borrowRatePerBlock() public view override returns (uint256) {\r\n return\r\n interestRateModel.getBorrowRate(\r\n asCToken().getCash(),\r\n totalBorrows,\r\n totalReserves + totalAdminFees + totalIonicFees\r\n );\r\n }\r\n\r\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) public view returns (uint256) {\r\n uint256 cash = asCToken().getCash();\r\n require(cash >= borrowAmount, \"market cash not enough\");\r\n\r\n return\r\n interestRateModel.getBorrowRate(\r\n cash - borrowAmount,\r\n totalBorrows + borrowAmount,\r\n totalReserves + totalAdminFees + totalIonicFees\r\n );\r\n }\r\n\r\n /**\r\n * @notice Returns the current per-block supply interest rate for this cToken\r\n * @return The supply interest rate per block, scaled by 1e18\r\n */\r\n function supplyRatePerBlock() public view override returns (uint256) {\r\n return\r\n interestRateModel.getSupplyRate(\r\n asCToken().getCash(),\r\n totalBorrows,\r\n totalReserves + totalAdminFees + totalIonicFees,\r\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\r\n );\r\n }\r\n\r\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256) {\r\n return\r\n interestRateModel.getSupplyRate(\r\n asCToken().getCash() + mintAmount,\r\n totalBorrows,\r\n totalReserves + totalAdminFees + totalIonicFees,\r\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\r\n );\r\n }\r\n\r\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256) {\r\n uint256 cash = asCToken().getCash();\r\n require(cash >= withdrawAmount, \"market cash not enough\");\r\n return\r\n interestRateModel.getSupplyRate(\r\n cash - withdrawAmount,\r\n totalBorrows,\r\n totalReserves + totalAdminFees + totalIonicFees,\r\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\r\n );\r\n }\r\n\r\n /**\r\n * @notice Accrue interest then return the up-to-date exchange rate\r\n * @return Calculated exchange rate scaled by 1e18\r\n */\r\n function exchangeRateCurrent() public view override returns (uint256) {\r\n if (block.number == accrualBlockNumber) {\r\n return\r\n _exchangeRateHypothetical(\r\n totalSupply,\r\n initialExchangeRateMantissa,\r\n asCToken().getCash(),\r\n totalBorrows,\r\n totalReserves,\r\n totalAdminFees,\r\n totalIonicFees\r\n );\r\n } else {\r\n uint256 cashPrior = asCToken().getCash();\r\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\r\n\r\n return\r\n _exchangeRateHypothetical(\r\n accrual.totalSupply,\r\n initialExchangeRateMantissa,\r\n cashPrior,\r\n accrual.totalBorrows,\r\n accrual.totalReserves,\r\n accrual.totalAdminFees,\r\n accrual.totalIonicFees\r\n );\r\n }\r\n }\r\n\r\n function _exchangeRateHypothetical(\r\n uint256 _totalSupply,\r\n uint256 _initialExchangeRateMantissa,\r\n uint256 _totalCash,\r\n uint256 _totalBorrows,\r\n uint256 _totalReserves,\r\n uint256 _totalAdminFees,\r\n uint256 _totalIonicFees\r\n ) internal pure returns (uint256) {\r\n if (_totalSupply == 0) {\r\n /*\r\n * If there are no tokens minted:\r\n * exchangeRate = initialExchangeRate\r\n */\r\n return _initialExchangeRateMantissa;\r\n } else {\r\n /*\r\n * Otherwise:\r\n * exchangeRate = (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees)) / totalSupply\r\n */\r\n uint256 cashPlusBorrowsMinusReserves;\r\n Exp memory exchangeRate;\r\n MathError mathErr;\r\n\r\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(\r\n _totalCash,\r\n _totalBorrows,\r\n _totalReserves + _totalAdminFees + _totalIonicFees\r\n );\r\n require(mathErr == MathError.NO_ERROR, \"!addThenSubUInt overflow check failed\");\r\n\r\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\r\n require(mathErr == MathError.NO_ERROR, \"!getExp overflow check failed\");\r\n\r\n return exchangeRate.mantissa;\r\n }\r\n }\r\n\r\n struct InterestAccrual {\r\n uint256 accrualBlockNumber;\r\n uint256 borrowIndex;\r\n uint256 totalSupply;\r\n uint256 totalBorrows;\r\n uint256 totalReserves;\r\n uint256 totalIonicFees;\r\n uint256 totalAdminFees;\r\n uint256 interestAccumulated;\r\n }\r\n\r\n function _accrueInterestHypothetical(\r\n uint256 blockNumber,\r\n uint256 cashPrior\r\n ) internal view returns (InterestAccrual memory accrual) {\r\n uint256 totalFees = totalAdminFees + totalIonicFees;\r\n uint256 borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, totalBorrows, totalReserves + totalFees);\r\n if (borrowRateMantissa > borrowRateMaxMantissa) {\r\n if (cashPrior > totalFees) revert(\"!borrowRate\");\r\n else borrowRateMantissa = borrowRateMaxMantissa;\r\n }\r\n (MathError mathErr, uint256 blockDelta) = subUInt(blockNumber, accrualBlockNumber);\r\n require(mathErr == MathError.NO_ERROR, \"!blockDelta\");\r\n\r\n /*\r\n * Calculate the interest accumulated into borrows and reserves and the new index:\r\n * simpleInterestFactor = borrowRate * blockDelta\r\n * interestAccumulated = simpleInterestFactor * totalBorrows\r\n * totalBorrowsNew = interestAccumulated + totalBorrows\r\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\r\n * totalIonicFeesNew = interestAccumulated * ionicFee + totalIonicFees\r\n * totalAdminFeesNew = interestAccumulated * adminFee + totalAdminFees\r\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\r\n */\r\n\r\n accrual.accrualBlockNumber = blockNumber;\r\n accrual.totalSupply = totalSupply;\r\n Exp memory simpleInterestFactor = mul_(Exp({ mantissa: borrowRateMantissa }), blockDelta);\r\n accrual.interestAccumulated = mul_ScalarTruncate(simpleInterestFactor, totalBorrows);\r\n accrual.totalBorrows = accrual.interestAccumulated + totalBorrows;\r\n accrual.totalReserves = mul_ScalarTruncateAddUInt(\r\n Exp({ mantissa: reserveFactorMantissa }),\r\n accrual.interestAccumulated,\r\n totalReserves\r\n );\r\n accrual.totalIonicFees = mul_ScalarTruncateAddUInt(\r\n Exp({ mantissa: ionicFeeMantissa }),\r\n accrual.interestAccumulated,\r\n totalIonicFees\r\n );\r\n accrual.totalAdminFees = mul_ScalarTruncateAddUInt(\r\n Exp({ mantissa: adminFeeMantissa }),\r\n accrual.interestAccumulated,\r\n totalAdminFees\r\n );\r\n accrual.borrowIndex = mul_ScalarTruncateAddUInt(simpleInterestFactor, borrowIndex, borrowIndex);\r\n }\r\n\r\n /**\r\n * @notice Applies accrued interest to total borrows and reserves\r\n * @dev This calculates interest accrued from the last checkpointed block\r\n * up to the current block and writes new checkpoint to storage.\r\n */\r\n function accrueInterest() public override returns (uint256) {\r\n /* Remember the initial block number */\r\n uint256 currentBlockNumber = block.number;\r\n\r\n /* Short-circuit accumulating 0 interest */\r\n if (accrualBlockNumber == currentBlockNumber) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n uint256 cashPrior = asCToken().getCash();\r\n InterestAccrual memory accrual = _accrueInterestHypothetical(currentBlockNumber, cashPrior);\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n accrualBlockNumber = currentBlockNumber;\r\n borrowIndex = accrual.borrowIndex;\r\n totalBorrows = accrual.totalBorrows;\r\n totalReserves = accrual.totalReserves;\r\n totalIonicFees = accrual.totalIonicFees;\r\n totalAdminFees = accrual.totalAdminFees;\r\n emit AccrueInterest(cashPrior, accrual.interestAccumulated, borrowIndex, totalBorrows);\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Returns the current total borrows plus accrued interest\r\n * @return The total borrows with interest\r\n */\r\n function totalBorrowsCurrent() external view override returns (uint256) {\r\n if (accrualBlockNumber == block.number) {\r\n return totalBorrows;\r\n } else {\r\n uint256 cashPrior = asCToken().getCash();\r\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\r\n return accrual.totalBorrows;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\r\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\r\n * @param account Address of the account to snapshot\r\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\r\n */\r\n function getAccountSnapshot(address account) external view override returns (uint256, uint256, uint256, uint256) {\r\n uint256 cTokenBalance = accountTokens[account];\r\n uint256 borrowBalance;\r\n uint256 exchangeRateMantissa;\r\n\r\n borrowBalance = borrowBalanceCurrent(account);\r\n\r\n exchangeRateMantissa = exchangeRateCurrent();\r\n\r\n return (uint256(Error.NO_ERROR), cTokenBalance, borrowBalance, exchangeRateMantissa);\r\n }\r\n\r\n /**\r\n * @notice calculate the borrowIndex and the account's borrow balance using the fresh borrowIndex\r\n * @param account The address whose balance should be calculated after recalculating the borrowIndex\r\n * @return The calculated balance\r\n */\r\n function borrowBalanceCurrent(address account) public view override returns (uint256) {\r\n uint256 _borrowIndex;\r\n if (accrualBlockNumber == block.number) {\r\n _borrowIndex = borrowIndex;\r\n } else {\r\n uint256 cashPrior = asCToken().getCash();\r\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\r\n _borrowIndex = accrual.borrowIndex;\r\n }\r\n\r\n /* Note: we do not assert that the market is up to date */\r\n MathError mathErr;\r\n uint256 principalTimesIndex;\r\n uint256 result;\r\n\r\n /* Get borrowBalance and borrowIndex */\r\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\r\n\r\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\r\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\r\n */\r\n if (borrowSnapshot.principal == 0) {\r\n return 0;\r\n }\r\n\r\n /* Calculate new borrow balance using the interest index:\r\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\r\n */\r\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, _borrowIndex);\r\n require(mathErr == MathError.NO_ERROR, \"!mulUInt overflow check failed\");\r\n\r\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\r\n require(mathErr == MathError.NO_ERROR, \"!divUInt overflow check failed\");\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * @notice Get the underlying balance of the `owner`\r\n * @param owner The address of the account to query\r\n * @return The amount of underlying owned by `owner`\r\n */\r\n function balanceOfUnderlying(address owner) external view override returns (uint256) {\r\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\r\n (MathError mErr, uint256 balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\r\n require(mErr == MathError.NO_ERROR, \"!balance\");\r\n return balance;\r\n }\r\n\r\n function flash(uint256 amount, bytes calldata data) public override isAuthorized onlyOracleApprovedAllowEOA {\r\n accrueInterest();\r\n\r\n totalBorrows += amount;\r\n asCToken().selfTransferOut(msg.sender, amount);\r\n\r\n IFlashLoanReceiver(msg.sender).receiveFlashLoan(underlying, amount, data);\r\n\r\n asCToken().selfTransferIn(msg.sender, amount);\r\n totalBorrows -= amount;\r\n\r\n emit Flash(msg.sender, amount);\r\n }\r\n\r\n /*** Reentrancy Guard ***/\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n */\r\n modifier nonReentrant(bool localOnly) {\r\n _beforeNonReentrant(localOnly);\r\n _;\r\n _afterNonReentrant(localOnly);\r\n }\r\n\r\n /**\r\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\r\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\r\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\r\n */\r\n function _beforeNonReentrant(bool localOnly) private {\r\n require(_notEntered, \"re-entered\");\r\n if (!localOnly) comptroller._beforeNonReentrant();\r\n _notEntered = false;\r\n }\r\n\r\n /**\r\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\r\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\r\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\r\n */\r\n function _afterNonReentrant(bool localOnly) private {\r\n _notEntered = true; // get a gas-refund post-Istanbul\r\n if (!localOnly) comptroller._afterNonReentrant();\r\n }\r\n\r\n function asCToken() internal view returns (ICErc20) {\r\n return ICErc20(address(this));\r\n }\r\n\r\n function multicall(\r\n bytes[] calldata data\r\n ) public payable override(CTokenFirstExtensionInterface, Multicall) returns (bytes[] memory results) {\r\n return Multicall.multicall(data);\r\n }\r\n\r\n function registerInSFS() external returns (uint256) {\r\n require(hasAdminRights() || msg.sender == address(comptroller), \"!admin\");\r\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\r\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\r\n }\r\n}\r\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\r\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\r\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\r\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\r\n\r\nabstract contract CTokenAdminStorage {\r\n /*\r\n * Administrator for Ionic\r\n */\r\n address payable public ionicAdmin;\r\n}\r\n\r\nabstract contract CErc20Storage is CTokenAdminStorage {\r\n /**\r\n * @dev Guard variable for re-entrancy checks\r\n */\r\n bool internal _notEntered;\r\n\r\n /**\r\n * @notice EIP-20 token name for this token\r\n */\r\n string public name;\r\n\r\n /**\r\n * @notice EIP-20 token symbol for this token\r\n */\r\n string public symbol;\r\n\r\n /**\r\n * @notice EIP-20 token decimals for this token\r\n */\r\n uint8 public decimals;\r\n\r\n /*\r\n * Maximum borrow rate that can ever be applied (.0005% / block)\r\n */\r\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\r\n\r\n /*\r\n * Maximum fraction of interest that can be set aside for reserves + fees\r\n */\r\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\r\n\r\n /**\r\n * @notice Contract which oversees inter-cToken operations\r\n */\r\n IonicComptroller public comptroller;\r\n\r\n /**\r\n * @notice Model which tells what the current interest rate should be\r\n */\r\n InterestRateModel public interestRateModel;\r\n\r\n /*\r\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\r\n */\r\n uint256 internal initialExchangeRateMantissa;\r\n\r\n /**\r\n * @notice Fraction of interest currently set aside for admin fees\r\n */\r\n uint256 public adminFeeMantissa;\r\n\r\n /**\r\n * @notice Fraction of interest currently set aside for Ionic fees\r\n */\r\n uint256 public ionicFeeMantissa;\r\n\r\n /**\r\n * @notice Fraction of interest currently set aside for reserves\r\n */\r\n uint256 public reserveFactorMantissa;\r\n\r\n /**\r\n * @notice Block number that interest was last accrued at\r\n */\r\n uint256 public accrualBlockNumber;\r\n\r\n /**\r\n * @notice Accumulator of the total earned interest rate since the opening of the market\r\n */\r\n uint256 public borrowIndex;\r\n\r\n /**\r\n * @notice Total amount of outstanding borrows of the underlying in this market\r\n */\r\n uint256 public totalBorrows;\r\n\r\n /**\r\n * @notice Total amount of reserves of the underlying held in this market\r\n */\r\n uint256 public totalReserves;\r\n\r\n /**\r\n * @notice Total amount of admin fees of the underlying held in this market\r\n */\r\n uint256 public totalAdminFees;\r\n\r\n /**\r\n * @notice Total amount of Ionic fees of the underlying held in this market\r\n */\r\n uint256 public totalIonicFees;\r\n\r\n /**\r\n * @notice Total number of tokens in circulation\r\n */\r\n uint256 public totalSupply;\r\n\r\n /*\r\n * Official record of token balances for each account\r\n */\r\n mapping(address => uint256) internal accountTokens;\r\n\r\n /*\r\n * Approved token transfer amounts on behalf of others\r\n */\r\n mapping(address => mapping(address => uint256)) internal transferAllowances;\r\n\r\n /**\r\n * @notice Container for borrow balance information\r\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\r\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\r\n */\r\n struct BorrowSnapshot {\r\n uint256 principal;\r\n uint256 interestIndex;\r\n }\r\n\r\n /*\r\n * Mapping of account addresses to outstanding borrow balances\r\n */\r\n mapping(address => BorrowSnapshot) internal accountBorrows;\r\n\r\n /*\r\n * Share of seized collateral that is added to reserves\r\n */\r\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\r\n\r\n /*\r\n * Share of seized collateral taken as fees\r\n */\r\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\r\n\r\n /**\r\n * @notice Underlying asset for this CToken\r\n */\r\n address public underlying;\r\n\r\n /**\r\n * @notice Addresses Provider\r\n */\r\n AddressesProvider public ap;\r\n}\r\n\r\nabstract contract CTokenBaseEvents {\r\n /* ERC20 */\r\n\r\n /**\r\n * @notice EIP20 Transfer event\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n\r\n /*** Admin Events ***/\r\n\r\n /**\r\n * @notice Event emitted when interestRateModel is changed\r\n */\r\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\r\n\r\n /**\r\n * @notice Event emitted when the reserve factor is changed\r\n */\r\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\r\n\r\n /**\r\n * @notice Event emitted when the admin fee is changed\r\n */\r\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\r\n\r\n /**\r\n * @notice Event emitted when the Ionic fee is changed\r\n */\r\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\r\n\r\n /**\r\n * @notice EIP20 Approval event\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n\r\n /**\r\n * @notice Event emitted when interest is accrued\r\n */\r\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\r\n}\r\n\r\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\r\n event Flash(address receiver, uint256 amount);\r\n}\r\n\r\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\r\n /*** Market Events ***/\r\n\r\n /**\r\n * @notice Event emitted when tokens are minted\r\n */\r\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\r\n\r\n /**\r\n * @notice Event emitted when tokens are redeemed\r\n */\r\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\r\n\r\n /**\r\n * @notice Event emitted when underlying is borrowed\r\n */\r\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\r\n\r\n /**\r\n * @notice Event emitted when a borrow is repaid\r\n */\r\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\r\n\r\n /**\r\n * @notice Event emitted when a borrow is liquidated\r\n */\r\n event LiquidateBorrow(\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral,\r\n uint256 seizeTokens\r\n );\r\n\r\n /**\r\n * @notice Event emitted when the reserves are added\r\n */\r\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\r\n\r\n /**\r\n * @notice Event emitted when the reserves are reduced\r\n */\r\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\r\n}\r\n\r\ninterface CTokenFirstExtensionInterface {\r\n /*** User Interface ***/\r\n\r\n function transfer(address dst, uint256 amount) external returns (bool);\r\n\r\n function transferFrom(\r\n address src,\r\n address dst,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n function balanceOf(address owner) external view returns (uint256);\r\n\r\n /*** Admin Functions ***/\r\n\r\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\r\n\r\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\r\n\r\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\r\n\r\n function getAccountSnapshot(address account)\r\n external\r\n view\r\n returns (\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256\r\n );\r\n\r\n function borrowRatePerBlock() external view returns (uint256);\r\n\r\n function supplyRatePerBlock() external view returns (uint256);\r\n\r\n function exchangeRateCurrent() external view returns (uint256);\r\n\r\n function accrueInterest() external returns (uint256);\r\n\r\n function totalBorrowsCurrent() external view returns (uint256);\r\n\r\n function borrowBalanceCurrent(address account) external view returns (uint256);\r\n\r\n function getTotalUnderlyingSupplied() external view returns (uint256);\r\n\r\n function balanceOfUnderlying(address owner) external view returns (uint256);\r\n\r\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\r\n\r\n function flash(uint256 amount, bytes calldata data) external;\r\n\r\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\r\n\r\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\r\n\r\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\r\n\r\n function registerInSFS() external returns (uint256);\r\n}\r\n\r\ninterface CTokenSecondExtensionInterface {\r\n function mint(uint256 mintAmount) external returns (uint256);\r\n\r\n function redeem(uint256 redeemTokens) external returns (uint256);\r\n\r\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\r\n\r\n function borrow(uint256 borrowAmount) external returns (uint256);\r\n\r\n function repayBorrow(uint256 repayAmount) external returns (uint256);\r\n\r\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\r\n\r\n function liquidateBorrow(\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) external returns (uint256);\r\n\r\n function getCash() external view returns (uint256);\r\n\r\n function seize(\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external returns (uint256);\r\n\r\n /*** Admin Functions ***/\r\n\r\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\r\n\r\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\r\n\r\n function selfTransferOut(address to, uint256 amount) external;\r\n\r\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\r\n}\r\n\r\ninterface CDelegatorInterface {\r\n function implementation() external view returns (address);\r\n\r\n /**\r\n * @notice Called by the admin to update the implementation of the delegator\r\n * @param implementation_ The address of the new implementation for delegation\r\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\r\n */\r\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\r\n\r\n /**\r\n * @dev upgrades the implementation if necessary\r\n */\r\n function _upgrade() external;\r\n}\r\n\r\ninterface CDelegateInterface {\r\n /**\r\n * @notice Called by the delegator on a delegate to initialize it for duty\r\n * @dev Should revert if any issues arise which make it unfit for delegation\r\n * @param data The encoded bytes data for any initialization\r\n */\r\n function _becomeImplementation(bytes calldata data) external;\r\n\r\n function delegateType() external pure returns (uint8);\r\n\r\n function contractType() external pure returns (string memory);\r\n}\r\n\r\nabstract contract CErc20AdminBase is CErc20Storage {\r\n /**\r\n * @notice Returns a boolean indicating if the sender has admin rights\r\n */\r\n function hasAdminRights() internal view returns (bool) {\r\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\r\n return\r\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\r\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\r\n }\r\n}\r\n\r\nabstract contract CErc20FirstExtensionBase is\r\n CErc20AdminBase,\r\n CTokenFirstExtensionEvents,\r\n CTokenFirstExtensionInterface\r\n{}\r\n\r\nabstract contract CTokenSecondExtensionBase is\r\n CErc20AdminBase,\r\n CTokenSecondExtensionEvents,\r\n CTokenSecondExtensionInterface,\r\n CDelegateInterface\r\n{}\r\n\r\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\r\n\r\ninterface CErc20StorageInterface {\r\n function admin() external view returns (address);\r\n\r\n function adminHasRights() external view returns (bool);\r\n\r\n function ionicAdmin() external view returns (address);\r\n\r\n function ionicAdminHasRights() external view returns (bool);\r\n\r\n function comptroller() external view returns (IonicComptroller);\r\n\r\n function name() external view returns (string memory);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function decimals() external view returns (uint8);\r\n\r\n function totalSupply() external view returns (uint256);\r\n\r\n function adminFeeMantissa() external view returns (uint256);\r\n\r\n function ionicFeeMantissa() external view returns (uint256);\r\n\r\n function reserveFactorMantissa() external view returns (uint256);\r\n\r\n function protocolSeizeShareMantissa() external view returns (uint256);\r\n\r\n function feeSeizeShareMantissa() external view returns (uint256);\r\n\r\n function totalReserves() external view returns (uint256);\r\n\r\n function totalAdminFees() external view returns (uint256);\r\n\r\n function totalIonicFees() external view returns (uint256);\r\n\r\n function totalBorrows() external view returns (uint256);\r\n\r\n function accrualBlockNumber() external view returns (uint256);\r\n\r\n function underlying() external view returns (address);\r\n\r\n function borrowIndex() external view returns (uint256);\r\n\r\n function interestRateModel() external view returns (address);\r\n}\r\n\r\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\r\n function plugin() external view returns (address);\r\n}\r\n\r\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\r\n function approve(address, address) external;\r\n}\r\n\r\ninterface ICErc20 is\r\n CErc20StorageInterface,\r\n CTokenSecondExtensionInterface,\r\n CTokenFirstExtensionInterface,\r\n CDelegatorInterface,\r\n CDelegateInterface\r\n{}\r\n\r\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\r\n function _updatePlugin(address _plugin) external;\r\n}\r\n\r\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\r\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.22;\r\n\r\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\r\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\r\n\r\ncontract CTokenOracleProtected is CErc20Storage {\r\n error InteractionNotAllowed();\r\n error CallerIsNotEOA();\r\n\r\n modifier onlyOracleApproved() {\r\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\r\n\r\n if (oracleAddress == address(0)) {\r\n _;\r\n return;\r\n }\r\n\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\r\n _;\r\n }\r\n\r\n modifier onlyOracleApprovedAllowEOA() {\r\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\r\n\r\n if (oracleAddress == address(0)) {\r\n _;\r\n return;\r\n }\r\n\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n oracle.validateBlacklistedAccountInteraction(msg.sender);\r\n if (tx.origin == msg.sender) {\r\n _;\r\n return;\r\n }\r\n\r\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\r\n _;\r\n }\r\n\r\n modifier onlyNotBlacklistedEOA() {\r\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\r\n\r\n if (oracleAddress == address(0)) {\r\n _;\r\n return;\r\n }\r\n\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n if (msg.sender != tx.origin) {\r\n revert CallerIsNotEOA();\r\n }\r\n oracle.validateBlacklistedAccountInteraction(msg.sender);\r\n _;\r\n }\r\n}\r\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title ERC 20 Token Standard Interface\r\n * https://eips.ethereum.org/EIPS/eip-20\r\n */\r\ninterface EIP20Interface {\r\n function name() external view returns (string memory);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function decimals() external view returns (uint8);\r\n\r\n /**\r\n * @notice Get the total number of tokens in circulation\r\n * @return uint256 The supply of tokens\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @notice Gets the balance of the specified address\r\n * @param owner The address from which the balance will be retrieved\r\n * @return balance uint256 The balance\r\n */\r\n function balanceOf(address owner) external view returns (uint256 balance);\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n * @return success bool Whether or not the transfer succeeded\r\n */\r\n function transfer(address dst, uint256 amount) external returns (bool success);\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `src` to `dst`\r\n * @param src The address of the source account\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n * @return success bool Whether or not the transfer succeeded\r\n */\r\n function transferFrom(\r\n address src,\r\n address dst,\r\n uint256 amount\r\n ) external returns (bool success);\r\n\r\n /**\r\n * @notice Approve `spender` to transfer up to `amount` from `src`\r\n * @dev This will overwrite the approval amount for `spender`\r\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\r\n * @param spender The address of the account which may transfer tokens\r\n * @param amount The number of tokens that are approved (-1 means infinite)\r\n * @return success bool Whether or not the approval succeeded\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool success);\r\n\r\n /**\r\n * @notice Get the current allowance from `owner` for `spender`\r\n * @param owner The address of the account which owns the tokens to be spent\r\n * @param spender The address of the account which may transfer tokens\r\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256 remaining);\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n}\r\n" + }, + "contracts/compound/EIP20NonStandardInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title EIP20NonStandardInterface\r\n * @dev Version of ERC20 with no return values for `transfer` and `transferFrom`\r\n * See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\r\n */\r\ninterface EIP20NonStandardInterface {\r\n /**\r\n * @notice Get the total number of tokens in circulation\r\n * @return The supply of tokens\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @notice Gets the balance of the specified address\r\n * @param owner The address from which the balance will be retrieved\r\n * @return balance uint256 The balance\r\n */\r\n function balanceOf(address owner) external view returns (uint256 balance);\r\n\r\n ///\r\n /// !!!!!!!!!!!!!!\r\n /// !!! NOTICE !!! `transfer` does not return a value, in violation of the ERC-20 specification\r\n /// !!!!!!!!!!!!!!\r\n ///\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n */\r\n function transfer(address dst, uint256 amount) external;\r\n\r\n ///\r\n /// !!!!!!!!!!!!!!\r\n /// !!! NOTICE !!! `transferFrom` does not return a value, in violation of the ERC-20 specification\r\n /// !!!!!!!!!!!!!!\r\n ///\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `src` to `dst`\r\n * @param src The address of the source account\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n */\r\n function transferFrom(\r\n address src,\r\n address dst,\r\n uint256 amount\r\n ) external;\r\n\r\n /**\r\n * @notice Approve `spender` to transfer up to `amount` from `src`\r\n * @dev This will overwrite the approval amount for `spender`\r\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\r\n * @param spender The address of the account which may transfer tokens\r\n * @param amount The number of tokens that are approved\r\n * @return success bool Whether or not the approval succeeded\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool success);\r\n\r\n /**\r\n * @notice Get the current allowance from `owner` for `spender`\r\n * @param owner The address of the account which owns the tokens to be spent\r\n * @param spender The address of the account which may transfer tokens\r\n * @return remaining uint256 The number of tokens allowed to be spent\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256 remaining);\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n}\r\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\ncontract ComptrollerErrorReporter {\r\n enum Error {\r\n NO_ERROR,\r\n UNAUTHORIZED,\r\n COMPTROLLER_MISMATCH,\r\n INSUFFICIENT_SHORTFALL,\r\n INSUFFICIENT_LIQUIDITY,\r\n INVALID_CLOSE_FACTOR,\r\n INVALID_COLLATERAL_FACTOR,\r\n INVALID_LIQUIDATION_INCENTIVE,\r\n MARKET_NOT_LISTED,\r\n MARKET_ALREADY_LISTED,\r\n MATH_ERROR,\r\n NONZERO_BORROW_BALANCE,\r\n PRICE_ERROR,\r\n REJECTION,\r\n SNAPSHOT_ERROR,\r\n TOO_MANY_ASSETS,\r\n TOO_MUCH_REPAY,\r\n SUPPLIER_NOT_WHITELISTED,\r\n BORROW_BELOW_MIN,\r\n SUPPLY_ABOVE_MAX,\r\n NONZERO_TOTAL_SUPPLY\r\n }\r\n\r\n enum FailureInfo {\r\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\r\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\r\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\r\n EXIT_MARKET_BALANCE_OWED,\r\n EXIT_MARKET_REJECTION,\r\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\r\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\r\n SET_CLOSE_FACTOR_OWNER_CHECK,\r\n SET_CLOSE_FACTOR_VALIDATION,\r\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\r\n SET_COLLATERAL_FACTOR_NO_EXISTS,\r\n SET_COLLATERAL_FACTOR_VALIDATION,\r\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\r\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\r\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\r\n SET_PENDING_ADMIN_OWNER_CHECK,\r\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\r\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\r\n SET_PRICE_ORACLE_OWNER_CHECK,\r\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\r\n SET_WHITELIST_STATUS_OWNER_CHECK,\r\n SUPPORT_MARKET_EXISTS,\r\n SUPPORT_MARKET_OWNER_CHECK,\r\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\r\n UNSUPPORT_MARKET_OWNER_CHECK,\r\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\r\n UNSUPPORT_MARKET_IN_USE\r\n }\r\n\r\n /**\r\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\r\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\r\n **/\r\n event Failure(uint256 error, uint256 info, uint256 detail);\r\n\r\n /**\r\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\r\n */\r\n function fail(Error err, FailureInfo info) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), 0);\r\n\r\n return uint256(err);\r\n }\r\n\r\n /**\r\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\r\n */\r\n function failOpaque(\r\n Error err,\r\n FailureInfo info,\r\n uint256 opaqueError\r\n ) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), opaqueError);\r\n\r\n return uint256(err);\r\n }\r\n}\r\n\r\ncontract TokenErrorReporter {\r\n enum Error {\r\n NO_ERROR,\r\n UNAUTHORIZED,\r\n BAD_INPUT,\r\n COMPTROLLER_REJECTION,\r\n COMPTROLLER_CALCULATION_ERROR,\r\n INTEREST_RATE_MODEL_ERROR,\r\n INVALID_ACCOUNT_PAIR,\r\n INVALID_CLOSE_AMOUNT_REQUESTED,\r\n INVALID_COLLATERAL_FACTOR,\r\n MATH_ERROR,\r\n MARKET_NOT_FRESH,\r\n MARKET_NOT_LISTED,\r\n TOKEN_INSUFFICIENT_ALLOWANCE,\r\n TOKEN_INSUFFICIENT_BALANCE,\r\n TOKEN_INSUFFICIENT_CASH,\r\n TOKEN_TRANSFER_IN_FAILED,\r\n TOKEN_TRANSFER_OUT_FAILED,\r\n UTILIZATION_ABOVE_MAX\r\n }\r\n\r\n /*\r\n * Note: FailureInfo (but not Error) is kept in alphabetical order\r\n * This is because FailureInfo grows significantly faster, and\r\n * the order of Error has some meaning, while the order of FailureInfo\r\n * is entirely arbitrary.\r\n */\r\n enum FailureInfo {\r\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\r\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\r\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\r\n BORROW_ACCRUE_INTEREST_FAILED,\r\n BORROW_CASH_NOT_AVAILABLE,\r\n BORROW_FRESHNESS_CHECK,\r\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\r\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\r\n BORROW_MARKET_NOT_LISTED,\r\n BORROW_COMPTROLLER_REJECTION,\r\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\r\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\r\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\r\n LIQUIDATE_COMPTROLLER_REJECTION,\r\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\r\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\r\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\r\n LIQUIDATE_FRESHNESS_CHECK,\r\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\r\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\r\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\r\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\r\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\r\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\r\n LIQUIDATE_SEIZE_TOO_MUCH,\r\n MINT_ACCRUE_INTEREST_FAILED,\r\n MINT_COMPTROLLER_REJECTION,\r\n MINT_EXCHANGE_CALCULATION_FAILED,\r\n MINT_EXCHANGE_RATE_READ_FAILED,\r\n MINT_FRESHNESS_CHECK,\r\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\r\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\r\n MINT_TRANSFER_IN_FAILED,\r\n MINT_TRANSFER_IN_NOT_POSSIBLE,\r\n NEW_UTILIZATION_RATE_ABOVE_MAX,\r\n REDEEM_ACCRUE_INTEREST_FAILED,\r\n REDEEM_COMPTROLLER_REJECTION,\r\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\r\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\r\n REDEEM_EXCHANGE_RATE_READ_FAILED,\r\n REDEEM_FRESHNESS_CHECK,\r\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\r\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\r\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\r\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\r\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\r\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\r\n WITHDRAW_IONIC_FEES_VALIDATION,\r\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\r\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\r\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\r\n WITHDRAW_ADMIN_FEES_VALIDATION,\r\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\r\n REDUCE_RESERVES_ADMIN_CHECK,\r\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\r\n REDUCE_RESERVES_FRESH_CHECK,\r\n REDUCE_RESERVES_VALIDATION,\r\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\r\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\r\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\r\n REPAY_BORROW_COMPTROLLER_REJECTION,\r\n REPAY_BORROW_FRESHNESS_CHECK,\r\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\r\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\r\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\r\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\r\n SET_COLLATERAL_FACTOR_VALIDATION,\r\n SET_COMPTROLLER_OWNER_CHECK,\r\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\r\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\r\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\r\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\r\n SET_PENDING_ADMIN_OWNER_CHECK,\r\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\r\n SET_ADMIN_FEE_ADMIN_CHECK,\r\n SET_ADMIN_FEE_FRESH_CHECK,\r\n SET_ADMIN_FEE_BOUNDS_CHECK,\r\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\r\n SET_IONIC_FEE_FRESH_CHECK,\r\n SET_IONIC_FEE_BOUNDS_CHECK,\r\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\r\n SET_RESERVE_FACTOR_ADMIN_CHECK,\r\n SET_RESERVE_FACTOR_FRESH_CHECK,\r\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\r\n TRANSFER_COMPTROLLER_REJECTION,\r\n TRANSFER_NOT_ALLOWED,\r\n TRANSFER_NOT_ENOUGH,\r\n TRANSFER_TOO_MUCH,\r\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\r\n ADD_RESERVES_FRESH_CHECK,\r\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\r\n }\r\n\r\n /**\r\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\r\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\r\n **/\r\n event Failure(uint256 error, uint256 info, uint256 detail);\r\n\r\n /**\r\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\r\n */\r\n function fail(Error err, FailureInfo info) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), 0);\r\n\r\n return uint256(err);\r\n }\r\n\r\n /**\r\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\r\n */\r\n function failOpaque(\r\n Error err,\r\n FailureInfo info,\r\n uint256 opaqueError\r\n ) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), opaqueError);\r\n\r\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\r\n }\r\n}\r\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CarefulMath.sol\";\r\nimport \"./ExponentialNoError.sol\";\r\n\r\n/**\r\n * @title Exponential module for storing fixed-precision decimals\r\n * @author Compound\r\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\r\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\r\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\r\n * `Exp({mantissa: 5100000000000000000})`.\r\n */\r\ncontract Exponential is CarefulMath, ExponentialNoError {\r\n /**\r\n * @dev Creates an exponential from numerator and denominator values.\r\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\r\n * or if `denom` is zero.\r\n */\r\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\r\n if (err1 != MathError.NO_ERROR) {\r\n return (err1, Exp({ mantissa: 0 }));\r\n }\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\r\n }\r\n\r\n /**\r\n * @dev Adds two exponentials, returning a new exponential.\r\n */\r\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\r\n\r\n return (error, Exp({ mantissa: result }));\r\n }\r\n\r\n /**\r\n * @dev Subtracts two exponentials, returning a new exponential.\r\n */\r\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\r\n\r\n return (error, Exp({ mantissa: result }));\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, returning a new Exp.\r\n */\r\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\r\n */\r\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\r\n (MathError err, Exp memory product) = mulScalar(a, scalar);\r\n if (err != MathError.NO_ERROR) {\r\n return (err, 0);\r\n }\r\n\r\n return (MathError.NO_ERROR, truncate(product));\r\n }\r\n\r\n /**\r\n * @dev Divide an Exp by a scalar, returning a new Exp.\r\n */\r\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\r\n }\r\n\r\n /**\r\n * @dev Divide a scalar by an Exp, returning a new Exp.\r\n */\r\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\r\n /*\r\n We are doing this as:\r\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\r\n\r\n How it works:\r\n Exp = a / b;\r\n Scalar = s;\r\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\r\n */\r\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n return getExp(numerator, divisor.mantissa);\r\n }\r\n\r\n /**\r\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\r\n */\r\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\r\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\r\n if (err != MathError.NO_ERROR) {\r\n return (err, 0);\r\n }\r\n\r\n return (MathError.NO_ERROR, truncate(fraction));\r\n }\r\n\r\n /**\r\n * @dev Multiplies two exponentials, returning a new exponential.\r\n */\r\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n // We add half the scale before dividing so that we get rounding instead of truncation.\r\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\r\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\r\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\r\n if (err1 != MathError.NO_ERROR) {\r\n return (err1, Exp({ mantissa: 0 }));\r\n }\r\n\r\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\r\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\r\n assert(err2 == MathError.NO_ERROR);\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\r\n }\r\n\r\n /**\r\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\r\n */\r\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\r\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\r\n }\r\n\r\n /**\r\n * @dev Multiplies three exponentials, returning a new exponential.\r\n */\r\n function mulExp3(\r\n Exp memory a,\r\n Exp memory b,\r\n Exp memory c\r\n ) internal pure returns (MathError, Exp memory) {\r\n (MathError err, Exp memory ab) = mulExp(a, b);\r\n if (err != MathError.NO_ERROR) {\r\n return (err, ab);\r\n }\r\n return mulExp(ab, c);\r\n }\r\n\r\n /**\r\n * @dev Divides two exponentials, returning a new exponential.\r\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\r\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\r\n */\r\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n return getExp(a.mantissa, b.mantissa);\r\n }\r\n}\r\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Exponential module for storing fixed-precision decimals\r\n * @author Compound\r\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\r\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\r\n * `Exp({mantissa: 5100000000000000000})`.\r\n */\r\ncontract ExponentialNoError {\r\n uint256 constant expScale = 1e18;\r\n uint256 constant doubleScale = 1e36;\r\n uint256 constant halfExpScale = expScale / 2;\r\n uint256 constant mantissaOne = expScale;\r\n\r\n struct Exp {\r\n uint256 mantissa;\r\n }\r\n\r\n struct Double {\r\n uint256 mantissa;\r\n }\r\n\r\n /**\r\n * @dev Truncates the given exp to a whole number value.\r\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\r\n */\r\n function truncate(Exp memory exp) internal pure returns (uint256) {\r\n // Note: We are not using careful math here as we're performing a division that cannot fail\r\n return exp.mantissa / expScale;\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\r\n */\r\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\r\n Exp memory product = mul_(a, scalar);\r\n return truncate(product);\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\r\n */\r\n function mul_ScalarTruncateAddUInt(\r\n Exp memory a,\r\n uint256 scalar,\r\n uint256 addend\r\n ) internal pure returns (uint256) {\r\n Exp memory product = mul_(a, scalar);\r\n return add_(truncate(product), addend);\r\n }\r\n\r\n /**\r\n * @dev Checks if first Exp is less than second Exp.\r\n */\r\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\r\n return left.mantissa < right.mantissa;\r\n }\r\n\r\n /**\r\n * @dev Checks if left Exp <= right Exp.\r\n */\r\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\r\n return left.mantissa <= right.mantissa;\r\n }\r\n\r\n /**\r\n * @dev Checks if left Exp > right Exp.\r\n */\r\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\r\n return left.mantissa > right.mantissa;\r\n }\r\n\r\n /**\r\n * @dev returns true if Exp is exactly zero\r\n */\r\n function isZeroExp(Exp memory value) internal pure returns (bool) {\r\n return value.mantissa == 0;\r\n }\r\n\r\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\r\n require(n < 2**224, errorMessage);\r\n return uint224(n);\r\n }\r\n\r\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\r\n require(n < 2**32, errorMessage);\r\n return uint32(n);\r\n }\r\n\r\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return add_(a, b, \"addition overflow\");\r\n }\r\n\r\n function add_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c >= a, errorMessage);\r\n return c;\r\n }\r\n\r\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub_(a, b, \"subtraction underflow\");\r\n }\r\n\r\n function sub_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b <= a, errorMessage);\r\n return a - b;\r\n }\r\n\r\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\r\n }\r\n\r\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: mul_(a.mantissa, b) });\r\n }\r\n\r\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\r\n return mul_(a, b.mantissa) / expScale;\r\n }\r\n\r\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\r\n }\r\n\r\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\r\n return Double({ mantissa: mul_(a.mantissa, b) });\r\n }\r\n\r\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\r\n return mul_(a, b.mantissa) / doubleScale;\r\n }\r\n\r\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mul_(a, b, \"multiplication overflow\");\r\n }\r\n\r\n function mul_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n if (a == 0 || b == 0) {\r\n return 0;\r\n }\r\n uint256 c = a * b;\r\n require(c / a == b, errorMessage);\r\n return c;\r\n }\r\n\r\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\r\n }\r\n\r\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: div_(a.mantissa, b) });\r\n }\r\n\r\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\r\n return div_(mul_(a, expScale), b.mantissa);\r\n }\r\n\r\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\r\n }\r\n\r\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\r\n return Double({ mantissa: div_(a.mantissa, b) });\r\n }\r\n\r\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\r\n return div_(mul_(a, doubleScale), b.mantissa);\r\n }\r\n\r\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div_(a, b, \"divide by zero\");\r\n }\r\n\r\n function div_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b > 0, errorMessage);\r\n return a / b;\r\n }\r\n\r\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\r\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\r\n }\r\n}\r\n" + }, + "contracts/compound/IERC4626.sol": { + "content": "pragma solidity >=0.8.0;\r\npragma experimental ABIEncoderV2;\r\n\r\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\r\n\r\ninterface IERC4626 is EIP20Interface {\r\n /*----------------------------------------------------------------\r\n Events\r\n ----------------------------------------------------------------*/\r\n\r\n event Deposit(address indexed from, address indexed to, uint256 value);\r\n\r\n event Withdraw(address indexed from, address indexed to, uint256 value);\r\n\r\n /*----------------------------------------------------------------\r\n Mutable Functions\r\n ----------------------------------------------------------------*/\r\n\r\n /**\r\n @notice Deposit a specific amount of underlying tokens.\r\n @param underlyingAmount The amount of the underlying token to deposit.\r\n @param to The address to receive shares corresponding to the deposit\r\n @return shares The shares in the vault credited to `to`\r\n */\r\n function deposit(uint256 underlyingAmount, address to) external returns (uint256 shares);\r\n\r\n /**\r\n @notice Mint an exact amount of shares for a variable amount of underlying tokens.\r\n @param shareAmount The amount of vault shares to mint.\r\n @param to The address to receive shares corresponding to the mint.\r\n @return underlyingAmount The amount of the underlying tokens deposited from the mint call.\r\n */\r\n function mint(uint256 shareAmount, address to) external returns (uint256 underlyingAmount);\r\n\r\n /**\r\n @notice Withdraw a specific amount of underlying tokens.\r\n @param underlyingAmount The amount of the underlying token to withdraw.\r\n @param to The address to receive underlying corresponding to the withdrawal.\r\n @param from The address to burn shares from corresponding to the withdrawal.\r\n @return shares The shares in the vault burned from sender\r\n */\r\n function withdraw(\r\n uint256 underlyingAmount,\r\n address to,\r\n address from\r\n ) external returns (uint256 shares);\r\n\r\n /**\r\n @notice Redeem a specific amount of shares for underlying tokens.\r\n @param shareAmount The amount of shares to redeem.\r\n @param to The address to receive underlying corresponding to the redemption.\r\n @param from The address to burn shares from corresponding to the redemption.\r\n @return value The underlying amount transferred to `to`.\r\n */\r\n function redeem(\r\n uint256 shareAmount,\r\n address to,\r\n address from\r\n ) external returns (uint256 value);\r\n\r\n /*----------------------------------------------------------------\r\n View Functions\r\n ----------------------------------------------------------------*/\r\n /** \r\n @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\r\n @return the address of the asset\r\n */\r\n function asset() external view returns (address);\r\n\r\n /** \r\n @notice Returns a user's Vault balance in underlying tokens.\r\n @param user The user to get the underlying balance of.\r\n @return balance The user's Vault balance in underlying tokens.\r\n */\r\n function balanceOfUnderlying(address user) external view returns (uint256 balance);\r\n\r\n /** \r\n @notice Calculates the total amount of underlying tokens the Vault manages.\r\n @return The total amount of underlying tokens the Vault manages.\r\n */\r\n function totalAssets() external view returns (uint256);\r\n\r\n /** \r\n @notice Returns the value in underlying terms of one vault token. \r\n */\r\n function exchangeRate() external view returns (uint256);\r\n\r\n /**\r\n @notice Returns the amount of vault tokens that would be obtained if depositing a given amount of underlying tokens in a `deposit` call.\r\n @param underlyingAmount the input amount of underlying tokens\r\n @return shareAmount the corresponding amount of shares out from a deposit call with `underlyingAmount` in\r\n */\r\n function previewDeposit(uint256 underlyingAmount) external view returns (uint256 shareAmount);\r\n\r\n /**\r\n @notice Returns the amount of underlying tokens that would be deposited if minting a given amount of shares in a `mint` call.\r\n @param shareAmount the amount of shares from a mint call.\r\n @return underlyingAmount the amount of underlying tokens corresponding to the mint call\r\n */\r\n function previewMint(uint256 shareAmount) external view returns (uint256 underlyingAmount);\r\n\r\n /**\r\n @notice Returns the amount of vault tokens that would be burned if withdrawing a given amount of underlying tokens in a `withdraw` call.\r\n @param underlyingAmount the input amount of underlying tokens\r\n @return shareAmount the corresponding amount of shares out from a withdraw call with `underlyingAmount` in\r\n */\r\n function previewWithdraw(uint256 underlyingAmount) external view returns (uint256 shareAmount);\r\n\r\n /**\r\n @notice Returns the amount of underlying tokens that would be obtained if redeeming a given amount of shares in a `redeem` call.\r\n @param shareAmount the amount of shares from a redeem call.\r\n @return underlyingAmount the amount of underlying tokens corresponding to the redeem call\r\n */\r\n function previewRedeem(uint256 shareAmount) external view returns (uint256 underlyingAmount);\r\n}\r\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../ionic/AuthoritiesRegistry.sol\";\r\n\r\ninterface IFeeDistributor {\r\n function minBorrowEth() external view returns (uint256);\r\n\r\n function maxUtilizationRate() external view returns (uint256);\r\n\r\n function interestFeeRate() external view returns (uint256);\r\n\r\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\r\n\r\n function latestCErc20Delegate(uint8 delegateType)\r\n external\r\n view\r\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\r\n\r\n function latestPluginImplementation(address oldImplementation) external view returns (address);\r\n\r\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\r\n\r\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\r\n\r\n function deployCErc20(\r\n uint8 delegateType,\r\n bytes calldata constructorData,\r\n bytes calldata becomeImplData\r\n ) external returns (address);\r\n\r\n function canCall(\r\n address pool,\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) external view returns (bool);\r\n\r\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\r\n\r\n fallback() external payable;\r\n\r\n receive() external payable;\r\n}\r\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Compound's InterestRateModel Interface\r\n * @author Compound\r\n */\r\nabstract contract InterestRateModel {\r\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\r\n bool public constant isInterestRateModel = true;\r\n\r\n /**\r\n * @notice Calculates the current borrow interest rate per block\r\n * @param cash The total amount of cash the market has\r\n * @param borrows The total amount of borrows the market has outstanding\r\n * @param reserves The total amount of reserves the market has\r\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\r\n */\r\n function getBorrowRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public view virtual returns (uint256);\r\n\r\n /**\r\n * @notice Calculates the current supply interest rate per block\r\n * @param cash The total amount of cash the market has\r\n * @param borrows The total amount of borrows the market has outstanding\r\n * @param reserves The total amount of reserves the market has\r\n * @param reserveFactorMantissa The current reserve factor the market has\r\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\r\n */\r\n function getSupplyRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves,\r\n uint256 reserveFactorMantissa\r\n ) public view virtual returns (uint256);\r\n}\r\n" + }, + "contracts/compound/JumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./InterestRateModel.sol\";\r\n\r\n/**\r\n * @title Compound's JumpRateModel Contract\r\n * @author Compound\r\n */\r\ncontract JumpRateModel is InterestRateModel {\r\n event NewInterestParams(\r\n uint256 baseRatePerBlock,\r\n uint256 multiplierPerBlock,\r\n uint256 jumpMultiplierPerBlock,\r\n uint256 kink\r\n );\r\n\r\n /**\r\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\r\n */\r\n uint256 public blocksPerYear;\r\n\r\n /**\r\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\r\n */\r\n uint256 public multiplierPerBlock;\r\n\r\n /**\r\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\r\n */\r\n uint256 public baseRatePerBlock;\r\n\r\n /**\r\n * @notice The multiplierPerBlock after hitting a specified utilization point\r\n */\r\n uint256 public jumpMultiplierPerBlock;\r\n\r\n /**\r\n * @notice The utilization point at which the jump multiplier is applied\r\n */\r\n uint256 public kink;\r\n\r\n /**\r\n * @notice Construct an interest rate model\r\n * @param _blocksPerYear The approximate number of blocks per year\r\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\r\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\r\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\r\n * @param kink_ The utilization point at which the jump multiplier is applied\r\n */\r\n constructor(\r\n uint256 _blocksPerYear,\r\n uint256 baseRatePerYear,\r\n uint256 multiplierPerYear,\r\n uint256 jumpMultiplierPerYear,\r\n uint256 kink_\r\n ) {\r\n blocksPerYear = _blocksPerYear;\r\n baseRatePerBlock = baseRatePerYear / blocksPerYear;\r\n multiplierPerBlock = multiplierPerYear / blocksPerYear;\r\n jumpMultiplierPerBlock = jumpMultiplierPerYear / blocksPerYear;\r\n kink = kink_;\r\n\r\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\r\n }\r\n\r\n /**\r\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\r\n * @param cash The amount of cash in the market\r\n * @param borrows The amount of borrows in the market\r\n * @param reserves The amount of reserves in the market (currently unused)\r\n * @return The utilization rate as a mantissa between [0, 1e18]\r\n */\r\n function utilizationRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public pure returns (uint256) {\r\n // Utilization rate is 0 when there are no borrows\r\n if (borrows == 0) {\r\n return 0;\r\n }\r\n\r\n return (borrows * 1e18) / (cash + borrows - reserves);\r\n }\r\n\r\n /**\r\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\r\n * @param cash The amount of cash in the market\r\n * @param borrows The amount of borrows in the market\r\n * @param reserves The amount of reserves in the market\r\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\r\n */\r\n function getBorrowRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public view override returns (uint256) {\r\n uint256 util = utilizationRate(cash, borrows, reserves);\r\n\r\n if (util <= kink) {\r\n return ((util * multiplierPerBlock) / 1e18) + baseRatePerBlock;\r\n } else {\r\n uint256 normalRate = ((kink * multiplierPerBlock) / 1e18) + baseRatePerBlock;\r\n uint256 excessUtil = util - kink;\r\n return ((excessUtil * jumpMultiplierPerBlock) / 1e18) + normalRate;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates the current supply rate per block\r\n * @param cash The amount of cash in the market\r\n * @param borrows The amount of borrows in the market\r\n * @param reserves The amount of reserves in the market\r\n * @param reserveFactorMantissa The current reserve factor for the market\r\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\r\n */\r\n function getSupplyRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves,\r\n uint256 reserveFactorMantissa\r\n ) public view virtual override returns (uint256) {\r\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\r\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\r\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\r\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\r\n }\r\n}\r\n" + }, + "contracts/compound/PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\n\r\nabstract contract PriceOracle {\r\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\r\n bool public constant isPriceOracle = true;\r\n\r\n /**\r\n * @notice Get the underlying price of a cToken asset\r\n * @param cToken The cToken to get the underlying price of\r\n * @return The underlying asset price mantissa (scaled by 1e18).\r\n * Zero means the price is unavailable.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view virtual returns (uint256);\r\n}\r\n" + }, + "contracts/compound/SafeMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol\r\n// Subject to the MIT license.\r\n\r\n/**\r\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\r\n * checks.\r\n *\r\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\r\n * in bugs, because programmers usually assume that an overflow raises an\r\n * error, which is the standard behavior in high level programming languages.\r\n * `SafeMath` restores this intuition by reverting the transaction when an\r\n * operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it's recommended to use it always.\r\n */\r\nlibrary SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on overflow.\r\n *\r\n * Counterpart to Solidity's `+` operator.\r\n *\r\n * Requirements:\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c >= a, \"SafeMath: addition overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.\r\n *\r\n * Counterpart to Solidity's `+` operator.\r\n *\r\n * Requirements:\r\n * - Addition cannot overflow.\r\n */\r\n function add(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c >= a, errorMessage);\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity's `-` operator.\r\n *\r\n * Requirements:\r\n * - Subtraction cannot underflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub(a, b, \"SafeMath: subtraction underflow\");\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity's `-` operator.\r\n *\r\n * Requirements:\r\n * - Subtraction cannot underflow.\r\n */\r\n function sub(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b <= a, errorMessage);\r\n uint256 c = a - b;\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on overflow.\r\n *\r\n * Counterpart to Solidity's `*` operator.\r\n *\r\n * Requirements:\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\r\n // benefit is lost if 'b' is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n uint256 c = a * b;\r\n require(c / a == b, \"SafeMath: multiplication overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on overflow.\r\n *\r\n * Counterpart to Solidity's `*` operator.\r\n *\r\n * Requirements:\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\r\n // benefit is lost if 'b' is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n uint256 c = a * b;\r\n require(c / a == b, errorMessage);\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers.\r\n * Reverts on division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity's `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div(a, b, \"SafeMath: division by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers.\r\n * Reverts with custom message on division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity's `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n * - The divisor cannot be zero.\r\n */\r\n function div(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n // Solidity only automatically asserts when dividing by 0\r\n require(b > 0, errorMessage);\r\n uint256 c = a / b;\r\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts when dividing by zero.\r\n *\r\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mod(a, b, \"SafeMath: modulo by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts with custom message when dividing by zero.\r\n *\r\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b != 0, errorMessage);\r\n return a % b;\r\n }\r\n}\r\n" + }, + "contracts/compound/Timelock.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./SafeMath.sol\";\r\n\r\ncontract Timelock {\r\n using SafeMath for uint256;\r\n\r\n event NewAdmin(address indexed newAdmin);\r\n event NewPendingAdmin(address indexed newPendingAdmin);\r\n event NewDelay(uint256 indexed newDelay);\r\n event CancelTransaction(\r\n bytes32 indexed txHash,\r\n address indexed target,\r\n uint256 value,\r\n string signature,\r\n bytes data,\r\n uint256 eta\r\n );\r\n event ExecuteTransaction(\r\n bytes32 indexed txHash,\r\n address indexed target,\r\n uint256 value,\r\n string signature,\r\n bytes data,\r\n uint256 eta\r\n );\r\n event QueueTransaction(\r\n bytes32 indexed txHash,\r\n address indexed target,\r\n uint256 value,\r\n string signature,\r\n bytes data,\r\n uint256 eta\r\n );\r\n\r\n uint256 public constant GRACE_PERIOD = 14 days;\r\n uint256 public constant MINIMUM_DELAY = 2 days;\r\n uint256 public constant MAXIMUM_DELAY = 30 days;\r\n\r\n address public admin;\r\n address public pendingAdmin;\r\n uint256 public delay;\r\n\r\n mapping(bytes32 => bool) public queuedTransactions;\r\n\r\n constructor(address admin_, uint256 delay_) {\r\n require(delay_ >= MINIMUM_DELAY, \"Timelock::constructor: Delay must exceed minimum delay.\");\r\n require(delay_ <= MAXIMUM_DELAY, \"Timelock::setDelay: Delay must not exceed maximum delay.\");\r\n\r\n admin = admin_;\r\n delay = delay_;\r\n }\r\n\r\n receive() external payable {}\r\n\r\n function setDelay(uint256 delay_) public {\r\n require(msg.sender == address(this), \"Timelock::setDelay: Call must come from Timelock.\");\r\n require(delay_ >= MINIMUM_DELAY, \"Timelock::setDelay: Delay must exceed minimum delay.\");\r\n require(delay_ <= MAXIMUM_DELAY, \"Timelock::setDelay: Delay must not exceed maximum delay.\");\r\n delay = delay_;\r\n\r\n emit NewDelay(delay);\r\n }\r\n\r\n function acceptAdmin() public {\r\n require(msg.sender == pendingAdmin, \"Timelock::acceptAdmin: Call must come from pendingAdmin.\");\r\n admin = msg.sender;\r\n pendingAdmin = address(0);\r\n\r\n emit NewAdmin(admin);\r\n }\r\n\r\n function setPendingAdmin(address pendingAdmin_) public {\r\n require(msg.sender == address(this), \"Timelock::setPendingAdmin: Call must come from Timelock.\");\r\n pendingAdmin = pendingAdmin_;\r\n\r\n emit NewPendingAdmin(pendingAdmin);\r\n }\r\n\r\n function queueTransaction(\r\n address target,\r\n uint256 value,\r\n string memory signature,\r\n bytes memory data,\r\n uint256 eta\r\n ) public returns (bytes32) {\r\n require(msg.sender == admin, \"Timelock::queueTransaction: Call must come from admin.\");\r\n require(\r\n eta >= getBlockTimestamp().add(delay),\r\n \"Timelock::queueTransaction: Estimated execution block must satisfy delay.\"\r\n );\r\n\r\n bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));\r\n queuedTransactions[txHash] = true;\r\n\r\n emit QueueTransaction(txHash, target, value, signature, data, eta);\r\n return txHash;\r\n }\r\n\r\n function cancelTransaction(\r\n address target,\r\n uint256 value,\r\n string memory signature,\r\n bytes memory data,\r\n uint256 eta\r\n ) public {\r\n require(msg.sender == admin, \"Timelock::cancelTransaction: Call must come from admin.\");\r\n\r\n bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));\r\n queuedTransactions[txHash] = false;\r\n\r\n emit CancelTransaction(txHash, target, value, signature, data, eta);\r\n }\r\n\r\n function executeTransaction(\r\n address target,\r\n uint256 value,\r\n string memory signature,\r\n bytes memory data,\r\n uint256 eta\r\n ) public payable returns (bytes memory) {\r\n require(msg.sender == admin, \"Timelock::executeTransaction: Call must come from admin.\");\r\n\r\n bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));\r\n require(queuedTransactions[txHash], \"Timelock::executeTransaction: Transaction hasn't been queued.\");\r\n require(getBlockTimestamp() >= eta, \"Timelock::executeTransaction: Transaction hasn't surpassed time lock.\");\r\n require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), \"Timelock::executeTransaction: Transaction is stale.\");\r\n\r\n queuedTransactions[txHash] = false;\r\n\r\n bytes memory callData;\r\n\r\n if (bytes(signature).length == 0) {\r\n callData = data;\r\n } else {\r\n callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);\r\n }\r\n\r\n // solium-disable-next-line security/no-call-value\r\n (bool success, bytes memory returnData) = target.call{ value: value }(callData);\r\n require(success, \"Timelock::executeTransaction: Transaction execution reverted.\");\r\n\r\n emit ExecuteTransaction(txHash, target, value, signature, data, eta);\r\n\r\n return returnData;\r\n }\r\n\r\n function getBlockTimestamp() internal view returns (uint256) {\r\n // solium-disable-next-line security/no-block-members\r\n return block.timestamp;\r\n }\r\n}\r\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./ErrorReporter.sol\";\r\nimport \"./ComptrollerStorage.sol\";\r\nimport \"./Comptroller.sol\";\r\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\r\n\r\n/**\r\n * @title Unitroller\r\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\r\n * CTokens should reference this contract as their comptroller.\r\n */\r\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\r\n /**\r\n * @notice Event emitted when the admin rights are changed\r\n */\r\n event AdminRightsToggled(bool hasRights);\r\n\r\n /**\r\n * @notice Emitted when pendingAdmin is changed\r\n */\r\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\r\n\r\n /**\r\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\r\n */\r\n event NewAdmin(address oldAdmin, address newAdmin);\r\n\r\n constructor(address payable _ionicAdmin) {\r\n admin = msg.sender;\r\n ionicAdmin = _ionicAdmin;\r\n }\r\n\r\n /*** Admin Functions ***/\r\n\r\n /**\r\n * @notice Toggles admin rights.\r\n * @param hasRights Boolean indicating if the admin is to have rights.\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\r\n }\r\n\r\n // Check that rights have not already been set to the desired value\r\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\r\n\r\n adminHasRights = hasRights;\r\n emit AdminRightsToggled(hasRights);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\r\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\r\n * @param newPendingAdmin New pending admin.\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\r\n }\r\n\r\n address oldPendingAdmin = pendingAdmin;\r\n pendingAdmin = newPendingAdmin;\r\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\r\n * @dev Admin function for pending admin to accept role and update admin\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _acceptAdmin() public returns (uint256) {\r\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\r\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\r\n }\r\n\r\n // Save current values for inclusion in log\r\n address oldAdmin = admin;\r\n address oldPendingAdmin = pendingAdmin;\r\n\r\n admin = pendingAdmin;\r\n pendingAdmin = address(0);\r\n\r\n emit NewAdmin(oldAdmin, admin);\r\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function comptrollerImplementation() public view returns (address) {\r\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\r\n }\r\n\r\n /**\r\n * @dev upgrades the implementation if necessary\r\n */\r\n function _upgrade() external {\r\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\r\n\r\n address currentImplementation = comptrollerImplementation();\r\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\r\n currentImplementation\r\n );\r\n\r\n _updateExtensions(latestComptrollerImplementation);\r\n\r\n if (currentImplementation != latestComptrollerImplementation) {\r\n // reinitialize\r\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\r\n }\r\n }\r\n\r\n function _functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.call(data);\r\n\r\n if (!success) {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n\r\n return returndata;\r\n }\r\n\r\n function _updateExtensions(address currentComptroller) internal {\r\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\r\n address[] memory currentExtensions = LibDiamond.listExtensions();\r\n\r\n // removed the current (old) extensions\r\n for (uint256 i = 0; i < currentExtensions.length; i++) {\r\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\r\n }\r\n // add the new extensions\r\n for (uint256 i = 0; i < latestExtensions.length; i++) {\r\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\r\n }\r\n }\r\n\r\n /**\r\n * @dev register a logic extension\r\n * @param extensionToAdd the extension whose functions are to be added\r\n * @param extensionToReplace the extension whose functions are to be removed/replaced\r\n */\r\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\r\n require(hasAdminRights(), \"!unauthorized\");\r\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\r\n }\r\n}\r\n" + }, + "contracts/EmissionsManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { IonicFlywheelCore } from \"./ionic/strategies/flywheel/IonicFlywheelCore.sol\";\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\r\nimport { IEmissionsManager } from \"./IEmissionsManager.sol\";\r\nimport { IveION } from \"./veION/interfaces/IveION.sol\";\r\n\r\ninterface Oracle {\r\n function getUnderlyingPrice(address) external returns (uint256);\r\n}\r\n\r\ncontract EmissionsManager is IEmissionsManager, Ownable2StepUpgradeable {\r\n using SafeTransferLib for ERC20;\r\n\r\n address public protocolAddress;\r\n uint256 public collateralBp;\r\n PoolDirectory public fpd;\r\n ERC20 public rewardToken;\r\n address public veION;\r\n\r\n bytes public nonBlacklistableTargetBytecode;\r\n mapping(address => bool) public isBlacklisted;\r\n mapping(address => bool) public nonBlacklistable;\r\n\r\n uint256 public constant MAXIMUM_BASIS_POINTS = 10_000;\r\n uint256 public constant BLACKLISTER_SHARE = 80;\r\n uint256 public constant PROTOCOL_SHARE = 20;\r\n\r\n modifier onlyBlacklistableBytecode(address _addr) {\r\n bytes memory code = _addr.code;\r\n require(keccak256(code) != keccak256(nonBlacklistableTargetBytecode), \"Non-blacklistable bytecode\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n function initialize(\r\n PoolDirectory _fpd,\r\n address _protocolAddress,\r\n ERC20 _rewardToken,\r\n uint256 _collateralBp,\r\n bytes memory _nonBlacklistableTargetBytecode\r\n ) public initializer {\r\n if (address(_fpd) == address(0)) revert InvalidPoolDirectoryAaddress();\r\n if (_protocolAddress == address(0)) revert InvalidProtocolAddress();\r\n if (address(_rewardToken) == address(0)) revert InvalidRewardTokenAddress();\r\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert CollateralBasisPointsExceedMaximum();\r\n\r\n __Ownable2Step_init();\r\n protocolAddress = _protocolAddress;\r\n fpd = _fpd;\r\n rewardToken = _rewardToken;\r\n collateralBp = _collateralBp;\r\n nonBlacklistableTargetBytecode = _nonBlacklistableTargetBytecode;\r\n\r\n emit Initialized(_protocolAddress, address(_rewardToken), _collateralBp, _nonBlacklistableTargetBytecode);\r\n }\r\n\r\n function setVeIon(IveION _veIon) external onlyOwner {\r\n if (address(_veIon) == address(0)) revert InvalidVeIONAddress();\r\n veION = address(_veIon);\r\n emit VeIonSet(address(_veIon));\r\n }\r\n\r\n function setCollateralBp(uint256 _collateralBp) external onlyOwner {\r\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert MaximumLimitExceeded();\r\n collateralBp = _collateralBp;\r\n emit CollateralBpSet(_collateralBp);\r\n }\r\n\r\n function setNonBlacklistableAddress(address _user, bool _isNonBlacklistable) external onlyOwner {\r\n nonBlacklistable[_user] = _isNonBlacklistable;\r\n emit NonBlacklistableAddressSet(_user, _isNonBlacklistable);\r\n }\r\n\r\n function setNonBlacklistableTargetBytecode(bytes memory _newBytecode) external onlyOwner {\r\n nonBlacklistableTargetBytecode = _newBytecode;\r\n emit NonBlacklistableTargetBytecodeSet(_newBytecode);\r\n }\r\n\r\n function setProtocolAddress(address _newProtocolAddress) external onlyOwner {\r\n require(_newProtocolAddress != address(0), \"Invalid address\");\r\n protocolAddress = _newProtocolAddress;\r\n }\r\n\r\n function _getUserTotalCollateral(address _user) internal view returns (uint256) {\r\n uint256 totalColateralInETH = 0;\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n uint256 poolsLength = pools.length;\r\n for (uint256 i = 0; i < poolsLength; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n BasePriceOracle oracle = comptroller.oracle();\r\n ICErc20[] memory cTokens = comptroller.getAssetsIn(_user);\r\n uint256 cTokensLength = cTokens.length;\r\n for (uint256 j = 0; j < cTokensLength; j++) {\r\n uint256 supplyBalance = cTokens[j].balanceOfUnderlying(_user);\r\n uint256 collateralInETH = (supplyBalance * oracle.getUnderlyingPrice(cTokens[j])) / 1e18;\r\n totalColateralInETH += collateralInETH;\r\n }\r\n }\r\n return totalColateralInETH;\r\n }\r\n\r\n function getUserTotalCollateral(address _user) external view returns (uint256) {\r\n return _getUserTotalCollateral(_user);\r\n }\r\n\r\n function _checkCollateralRatio(address _user) internal view returns (bool) {\r\n uint256 userCollateralValue = _getUserTotalCollateral(_user);\r\n if (userCollateralValue == 0) return true;\r\n uint256 userLPValue = IveION(veION).getTotalEthValueOfTokens(_user);\r\n if ((userLPValue * MAXIMUM_BASIS_POINTS) / userCollateralValue >= collateralBp) {\r\n return true;\r\n } else return false;\r\n }\r\n\r\n function reportUser(address _user) external onlyBlacklistableBytecode(_user) {\r\n require(!nonBlacklistable[_user], \"Non-blacklistable user\");\r\n require(!isBlacklisted[_user], \"Already blacklisted\");\r\n require(!_checkCollateralRatio(_user), \"LP balance above threshold\");\r\n isBlacklisted[_user] = true;\r\n _blacklistUserAndClaimEmissions(_user);\r\n }\r\n\r\n function whitelistUser(address _user) external {\r\n require(isBlacklisted[_user], \"Already whitelisted\");\r\n require(_checkCollateralRatio(_user), \"LP balance below threshold\");\r\n isBlacklisted[_user] = false;\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n uint256 poolsLength = pools.length;\r\n for (uint256 i = 0; i < poolsLength; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n ICErc20[] memory cTokens = comptroller.getAssetsIn(_user);\r\n uint256 cTokensLength = cTokens.length;\r\n for (uint256 j = 0; j < cTokensLength; j++) {\r\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\r\n uint256 flywheelAddressesLength = flywheelAddresses.length;\r\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\r\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\r\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\r\n flywheel.whitelistUser(ERC20(address(cTokens[j])), _user);\r\n flywheel.accrue(ERC20(address(cTokens[j])), _user);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function isUserBlacklisted(address _user) external view returns (bool) {\r\n return isBlacklisted[_user];\r\n }\r\n\r\n function isUserBlacklistable(address _user) external view returns (bool) {\r\n if (nonBlacklistable[_user] || keccak256(_user.code) == keccak256(nonBlacklistableTargetBytecode)) {\r\n return false;\r\n }\r\n return !_checkCollateralRatio(_user) && !isBlacklisted[_user];\r\n }\r\n\r\n function _blacklistUserAndClaimEmissions(address user) internal {\r\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(address(this));\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n uint256 poolsLength = pools.length;\r\n for (uint256 i = 0; i < poolsLength; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n ERC20[] memory markets;\r\n {\r\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\r\n uint256 cerc20sLength = cerc20s.length;\r\n markets = new ERC20[](cerc20sLength);\r\n for (uint256 j = 0; j < cerc20sLength; j++) {\r\n markets[j] = ERC20(address(cerc20s[j]));\r\n }\r\n }\r\n\r\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\r\n uint256 flywheelAddressesLength = flywheelAddresses.length;\r\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\r\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\r\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\r\n uint256 marketsLength = markets.length;\r\n for (uint256 m = 0; m < marketsLength; m++) {\r\n flywheel.accrue(markets[m], user);\r\n flywheel.updateBlacklistBalances(markets[m], user);\r\n }\r\n flywheel.takeRewardsFromUser(user, address(this));\r\n }\r\n }\r\n }\r\n\r\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(address(this));\r\n uint256 totalClaimed = balanceAfter - balanceBefore;\r\n if (totalClaimed > 0) {\r\n rewardToken.safeTransfer(msg.sender, (totalClaimed * BLACKLISTER_SHARE) / 100);\r\n rewardToken.safeTransfer(protocolAddress, (totalClaimed * PROTOCOL_SHARE) / 100);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/aerodrome/IAerodromeRouter.sol": { + "content": "// SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.10;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20_Router {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\r\n}\r\n\r\ninterface IWETH is IERC20_Router {\r\n function deposit() external payable;\r\n\r\n function withdraw(uint256) external;\r\n}\r\n\r\ninterface IRouter_Aerodrome {\r\n struct Route {\r\n address from;\r\n address to;\r\n bool stable;\r\n address factory;\r\n }\r\n\r\n error ETHTransferFailed();\r\n error Expired();\r\n error InsufficientAmount();\r\n error InsufficientAmountA();\r\n error InsufficientAmountB();\r\n error InsufficientAmountADesired();\r\n error InsufficientAmountBDesired();\r\n error InsufficientAmountAOptimal();\r\n error InsufficientLiquidity();\r\n error InsufficientOutputAmount();\r\n error InvalidAmountInForETHDeposit();\r\n error InvalidTokenInForETHDeposit();\r\n error InvalidPath();\r\n error InvalidRouteA();\r\n error InvalidRouteB();\r\n error OnlyWETH();\r\n error PoolDoesNotExist();\r\n error PoolFactoryDoesNotExist();\r\n error SameAddresses();\r\n error ZeroAddress();\r\n\r\n /// @notice Address of FactoryRegistry.sol\r\n function factoryRegistry() external view returns (address);\r\n\r\n /// @notice Address of Protocol PoolFactory.sol\r\n function defaultFactory() external view returns (address);\r\n\r\n /// @notice Address of Voter.sol\r\n function voter() external view returns (address);\r\n\r\n /// @notice Interface of WETH contract used for WETH => ETH wrapping/unwrapping\r\n function weth() external view returns (IWETH);\r\n\r\n /// @dev Represents Ether. Used by zapper to determine whether to return assets as ETH/WETH.\r\n function ETHER() external view returns (address);\r\n\r\n /// @dev Struct containing information necessary to zap in and out of pools\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable Stable or volatile pool\r\n /// @param factory factory of pool\r\n /// @param amountOutMinA Minimum amount expected from swap leg of zap via routesA\r\n /// @param amountOutMinB Minimum amount expected from swap leg of zap via routesB\r\n /// @param amountAMin Minimum amount of tokenA expected from liquidity leg of zap\r\n /// @param amountBMin Minimum amount of tokenB expected from liquidity leg of zap\r\n struct Zap {\r\n address tokenA;\r\n address tokenB;\r\n bool stable;\r\n address factory;\r\n uint256 amountOutMinA;\r\n uint256 amountOutMinB;\r\n uint256 amountAMin;\r\n uint256 amountBMin;\r\n }\r\n\r\n /// @notice Sort two tokens by which address value is less than the other\r\n /// @param tokenA Address of token to sort\r\n /// @param tokenB Address of token to sort\r\n /// @return token0 Lower address value between tokenA and tokenB\r\n /// @return token1 Higher address value between tokenA and tokenB\r\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\r\n\r\n /// @notice Calculate the address of a pool by its' factory.\r\n /// Used by all Router functions containing a `Route[]` or `_factory` argument.\r\n /// Reverts if _factory is not approved by the FactoryRegistry\r\n /// @dev Returns a randomly generated address for a nonexistent pool\r\n /// @param tokenA Address of token to query\r\n /// @param tokenB Address of token to query\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param _factory Address of factory which created the pool\r\n function poolFor(address tokenA, address tokenB, bool stable, address _factory) external view returns (address pool);\r\n\r\n /// @notice Fetch and sort the reserves for a pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param _factory Address of PoolFactory for tokenA and tokenB\r\n /// @return reserveA Amount of reserves of the sorted token A\r\n /// @return reserveB Amount of reserves of the sorted token B\r\n function getReserves(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n address _factory\r\n ) external view returns (uint256 reserveA, uint256 reserveB);\r\n\r\n /// @notice Perform chained getAmountOut calculations on any number of pools\r\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\r\n\r\n // **** ADD LIQUIDITY ****\r\n\r\n /// @notice Quote the amount deposited into a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param _factory Address of PoolFactory for tokenA and tokenB\r\n /// @param amountADesired Amount of tokenA desired to deposit\r\n /// @param amountBDesired Amount of tokenB desired to deposit\r\n /// @return amountA Amount of tokenA to actually deposit\r\n /// @return amountB Amount of tokenB to actually deposit\r\n /// @return liquidity Amount of liquidity token returned from deposit\r\n function quoteAddLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n address _factory,\r\n uint256 amountADesired,\r\n uint256 amountBDesired\r\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\r\n\r\n /// @notice Quote the amount of liquidity removed from a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param _factory Address of PoolFactory for tokenA and tokenB\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @return amountA Amount of tokenA received\r\n /// @return amountB Amount of tokenB received\r\n function quoteRemoveLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n address _factory,\r\n uint256 liquidity\r\n ) external view returns (uint256 amountA, uint256 amountB);\r\n\r\n /// @notice Add liquidity of two tokens to a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param amountADesired Amount of tokenA desired to deposit\r\n /// @param amountBDesired Amount of tokenB desired to deposit\r\n /// @param amountAMin Minimum amount of tokenA to deposit\r\n /// @param amountBMin Minimum amount of tokenB to deposit\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to receive liquidity\r\n /// @return amountA Amount of tokenA to actually deposit\r\n /// @return amountB Amount of tokenB to actually deposit\r\n /// @return liquidity Amount of liquidity token returned from deposit\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n uint256 amountADesired,\r\n uint256 amountBDesired,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\r\n\r\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\r\n /// @param token .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param amountTokenDesired Amount of token desired to deposit\r\n /// @param amountTokenMin Minimum amount of token to deposit\r\n /// @param amountETHMin Minimum amount of ETH to deposit\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to add liquidity\r\n /// @return amountToken Amount of token to actually deposit\r\n /// @return amountETH Amount of tokenETH to actually deposit\r\n /// @return liquidity Amount of liquidity token returned from deposit\r\n function addLiquidityETH(\r\n address token,\r\n bool stable,\r\n uint256 amountTokenDesired,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\r\n\r\n // **** REMOVE LIQUIDITY ****\r\n\r\n /// @notice Remove liquidity of two tokens from a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @param amountAMin Minimum amount of tokenA to receive\r\n /// @param amountBMin Minimum amount of tokenB to receive\r\n /// @param to Recipient of tokens received\r\n /// @param deadline Deadline to remove liquidity\r\n /// @return amountA Amount of tokenA received\r\n /// @return amountB Amount of tokenB received\r\n function removeLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n uint256 liquidity,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountA, uint256 amountB);\r\n\r\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\r\n /// @param token .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @param amountTokenMin Minimum amount of token to receive\r\n /// @param amountETHMin Minimum amount of ETH to receive\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to receive liquidity\r\n /// @return amountToken Amount of token received\r\n /// @return amountETH Amount of ETH received\r\n function removeLiquidityETH(\r\n address token,\r\n bool stable,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountToken, uint256 amountETH);\r\n\r\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\r\n /// @param token .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @param amountTokenMin Minimum amount of token to receive\r\n /// @param amountETHMin Minimum amount of ETH to receive\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to receive liquidity\r\n /// @return amountETH Amount of ETH received\r\n function removeLiquidityETHSupportingFeeOnTransferTokens(\r\n address token,\r\n bool stable,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountETH);\r\n\r\n // **** SWAP ****\r\n\r\n /// @notice Swap one token for another\r\n /// @param amountIn Amount of token in\r\n /// @param amountOutMin Minimum amount of desired token received\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n /// @return amounts Array of amounts returned per route\r\n function swapExactTokensForTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n /// @notice Swap ETH for a token\r\n /// @param amountOutMin Minimum amount of desired token received\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n /// @return amounts Array of amounts returned per route\r\n function swapExactETHForTokens(\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external payable returns (uint256[] memory amounts);\r\n\r\n /// @notice Swap a token for WETH (returned as ETH)\r\n /// @param amountIn Amount of token in\r\n /// @param amountOutMin Minimum amount of desired ETH\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n /// @return amounts Array of amounts returned per route\r\n function swapExactTokensForETH(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n /// @notice Swap one token for another without slippage protection\r\n /// @return amounts Array of amounts to swap per route\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n function UNSAFE_swapExactTokensForTokens(\r\n uint256[] memory amounts,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory);\r\n\r\n // **** SWAP (supporting fee-on-transfer tokens) ****\r\n\r\n /// @notice Swap one token for another supporting fee-on-transfer tokens\r\n /// @param amountIn Amount of token in\r\n /// @param amountOutMin Minimum amount of desired token received\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n\r\n /// @notice Swap ETH for a token supporting fee-on-transfer tokens\r\n /// @param amountOutMin Minimum amount of desired token received\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external payable;\r\n\r\n /// @notice Swap a token for WETH (returned as ETH) supporting fee-on-transfer tokens\r\n /// @param amountIn Amount of token in\r\n /// @param amountOutMin Minimum amount of desired ETH\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n\r\n /// @notice Zap a token A into a pool (B, C). (A can be equal to B or C).\r\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\r\n /// Slippage is required for the initial swap.\r\n /// Additional slippage may be required when adding liquidity as the\r\n /// price of the token may have changed.\r\n /// @param tokenIn Token you are zapping in from (i.e. input token).\r\n /// @param amountInA Amount of input token you wish to send down routesA\r\n /// @param amountInB Amount of input token you wish to send down routesB\r\n /// @param zapInPool Contains zap struct information. See Zap struct.\r\n /// @param routesA Route used to convert input token to tokenA\r\n /// @param routesB Route used to convert input token to tokenB\r\n /// @param to Address you wish to mint liquidity to.\r\n /// @param stake Auto-stake liquidity in corresponding gauge.\r\n /// @return liquidity Amount of LP tokens created from zapping in.\r\n function zapIn(\r\n address tokenIn,\r\n uint256 amountInA,\r\n uint256 amountInB,\r\n Zap calldata zapInPool,\r\n Route[] calldata routesA,\r\n Route[] calldata routesB,\r\n address to,\r\n bool stake\r\n ) external payable returns (uint256 liquidity);\r\n\r\n /// @notice Zap out a pool (B, C) into A.\r\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\r\n /// Slippage is required for the removal of liquidity.\r\n /// Additional slippage may be required on the swap as the\r\n /// price of the token may have changed.\r\n /// @param tokenOut Token you are zapping out to (i.e. output token).\r\n /// @param liquidity Amount of liquidity you wish to remove.\r\n /// @param zapOutPool Contains zap struct information. See Zap struct.\r\n /// @param routesA Route used to convert tokenA into output token.\r\n /// @param routesB Route used to convert tokenB into output token.\r\n function zapOut(\r\n address tokenOut,\r\n uint256 liquidity,\r\n Zap calldata zapOutPool,\r\n Route[] calldata routesA,\r\n Route[] calldata routesB\r\n ) external;\r\n\r\n /// @notice Used to generate params required for zapping in.\r\n /// Zap in => remove liquidity then swap.\r\n /// Apply slippage to expected swap values to account for changes in reserves in between.\r\n /// @dev Output token refers to the token you want to zap in from.\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable .\r\n /// @param _factory .\r\n /// @param amountInA Amount of input token you wish to send down routesA\r\n /// @param amountInB Amount of input token you wish to send down routesB\r\n /// @param routesA Route used to convert input token to tokenA\r\n /// @param routesB Route used to convert input token to tokenB\r\n /// @return amountOutMinA Minimum output expected from swapping input token to tokenA.\r\n /// @return amountOutMinB Minimum output expected from swapping input token to tokenB.\r\n /// @return amountAMin Minimum amount of tokenA expected from depositing liquidity.\r\n /// @return amountBMin Minimum amount of tokenB expected from depositing liquidity.\r\n function generateZapInParams(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n address _factory,\r\n uint256 amountInA,\r\n uint256 amountInB,\r\n Route[] calldata routesA,\r\n Route[] calldata routesB\r\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\r\n\r\n /// @notice Used to generate params required for zapping out.\r\n /// Zap out => swap then add liquidity.\r\n /// Apply slippage to expected liquidity values to account for changes in reserves in between.\r\n /// @dev Output token refers to the token you want to zap out of.\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable .\r\n /// @param _factory .\r\n /// @param liquidity Amount of liquidity being zapped out of into a given output token.\r\n /// @param routesA Route used to convert tokenA into output token.\r\n /// @param routesB Route used to convert tokenB into output token.\r\n /// @return amountOutMinA Minimum output expected from swapping tokenA into output token.\r\n /// @return amountOutMinB Minimum output expected from swapping tokenB into output token.\r\n /// @return amountAMin Minimum amount of tokenA expected from withdrawing liquidity.\r\n /// @return amountBMin Minimum amount of tokenB expected from withdrawing liquidity.\r\n function generateZapOutParams(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n address _factory,\r\n uint256 liquidity,\r\n Route[] calldata routesA,\r\n Route[] calldata routesB\r\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\r\n\r\n /// @notice Used by zapper to determine appropriate ratio of A to B to deposit liquidity. Assumes stable pool.\r\n /// @dev Returns stable liquidity ratio of B to (A + B).\r\n /// E.g. if ratio is 0.4, it means there is more of A than there is of B.\r\n /// Therefore you should deposit more of token A than B.\r\n /// @param tokenA tokenA of stable pool you are zapping into.\r\n /// @param tokenB tokenB of stable pool you are zapping into.\r\n /// @param factory Factory that created stable pool.\r\n /// @return ratio Ratio of token0 to token1 required to deposit into zap.\r\n function quoteStableLiquidityRatio(\r\n address tokenA,\r\n address tokenB,\r\n address factory\r\n ) external view returns (uint256 ratio);\r\n}\r\n" + }, + "contracts/external/aerodrome/IAerodromeSwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity ^0.8.10;\r\n\r\n/// @title Router token swapping functionality\r\n/// @notice Functions for swapping tokens via CL\r\ninterface ISwapRouter_Aerodrome {\r\n struct ExactInputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n int24 tickSpacing;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n uint160 sqrtPriceLimitX96;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\r\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n struct ExactInputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n struct ExactOutputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n int24 tickSpacing;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n uint160 sqrtPriceLimitX96;\r\n }\r\n\r\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\r\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\r\n /// @return amountIn The amount of the input token\r\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\r\n\r\n struct ExactOutputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n }\r\n\r\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\r\n /// @return amountIn The amount of the input token\r\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\r\n}\r\n" + }, + "contracts/external/algebra/IAlgebraFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/**\r\n * @title The interface for the Algebra Factory\r\n * @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\r\n * https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\r\n */\r\ninterface IAlgebraFactory {\r\n /**\r\n * @notice Emitted when the owner of the factory is changed\r\n * @param newOwner The owner after the owner was changed\r\n */\r\n event Owner(address indexed newOwner);\r\n\r\n /**\r\n * @notice Emitted when the vault address is changed\r\n * @param newVaultAddress The vault address after the address was changed\r\n */\r\n event VaultAddress(address indexed newVaultAddress);\r\n\r\n /**\r\n * @notice Emitted when a pool is created\r\n * @param token0 The first token of the pool by address sort order\r\n * @param token1 The second token of the pool by address sort order\r\n * @param pool The address of the created pool\r\n */\r\n event Pool(address indexed token0, address indexed token1, address pool);\r\n\r\n /**\r\n * @notice Emitted when the farming address is changed\r\n * @param newFarmingAddress The farming address after the address was changed\r\n */\r\n event FarmingAddress(address indexed newFarmingAddress);\r\n\r\n event FeeConfiguration(\r\n uint16 alpha1,\r\n uint16 alpha2,\r\n uint32 beta1,\r\n uint32 beta2,\r\n uint16 gamma1,\r\n uint16 gamma2,\r\n uint32 volumeBeta,\r\n uint16 volumeGamma,\r\n uint16 baseFee\r\n );\r\n\r\n /**\r\n * @notice Returns the current owner of the factory\r\n * @dev Can be changed by the current owner via setOwner\r\n * @return The address of the factory owner\r\n */\r\n function owner() external view returns (address);\r\n\r\n /**\r\n * @notice Returns the current poolDeployerAddress\r\n * @return The address of the poolDeployer\r\n */\r\n function poolDeployer() external view returns (address);\r\n\r\n /**\r\n * @dev Is retrieved from the pools to restrict calling\r\n * certain functions not by a tokenomics contract\r\n * @return The tokenomics contract address\r\n */\r\n function farmingAddress() external view returns (address);\r\n\r\n function vaultAddress() external view returns (address);\r\n\r\n /**\r\n * @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\r\n * @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\r\n * @param tokenA The contract address of either token0 or token1\r\n * @param tokenB The contract address of the other token\r\n * @return pool The pool address\r\n */\r\n function poolByPair(address tokenA, address tokenB) external view returns (address pool);\r\n\r\n /**\r\n * @notice Creates a pool for the given two tokens and fee\r\n * @param tokenA One of the two tokens in the desired pool\r\n * @param tokenB The other of the two tokens in the desired pool\r\n * @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\r\n * from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\r\n * are invalid.\r\n * @return pool The address of the newly created pool\r\n */\r\n function createPool(address tokenA, address tokenB) external returns (address pool);\r\n\r\n /**\r\n * @notice Updates the owner of the factory\r\n * @dev Must be called by the current owner\r\n * @param _owner The new owner of the factory\r\n */\r\n function setOwner(address _owner) external;\r\n\r\n /**\r\n * @dev updates tokenomics address on the factory\r\n * @param _farmingAddress The new tokenomics contract address\r\n */\r\n function setFarmingAddress(address _farmingAddress) external;\r\n\r\n /**\r\n * @dev updates vault address on the factory\r\n * @param _vaultAddress The new vault contract address\r\n */\r\n function setVaultAddress(address _vaultAddress) external;\r\n\r\n /**\r\n * @notice Changes initial fee configuration for new pools\r\n * @dev changes coefficients for sigmoids: α / (1 + e^( (β-x) / γ))\r\n * alpha1 + alpha2 + baseFee (max possible fee) must be <= type(uint16).max\r\n * gammas must be > 0\r\n * @param alpha1 max value of the first sigmoid\r\n * @param alpha2 max value of the second sigmoid\r\n * @param beta1 shift along the x-axis for the first sigmoid\r\n * @param beta2 shift along the x-axis for the second sigmoid\r\n * @param gamma1 horizontal stretch factor for the first sigmoid\r\n * @param gamma2 horizontal stretch factor for the second sigmoid\r\n * @param volumeBeta shift along the x-axis for the outer volume-sigmoid\r\n * @param volumeGamma horizontal stretch factor the outer volume-sigmoid\r\n * @param baseFee minimum possible fee\r\n */\r\n function setBaseFeeConfiguration(\r\n uint16 alpha1,\r\n uint16 alpha2,\r\n uint32 beta1,\r\n uint32 beta2,\r\n uint16 gamma1,\r\n uint16 gamma2,\r\n uint32 volumeBeta,\r\n uint16 volumeGamma,\r\n uint16 baseFee\r\n ) external;\r\n}\r\n" + }, + "contracts/external/algebra/IAlgebraPool.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IAlgebraPoolState.sol\";\r\nimport \"./IAlgebraPoolActions.sol\";\r\n\r\n/// @title Pool state that can change\r\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\r\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\r\ninterface IAlgebraPool is IAlgebraPoolState, IAlgebraPoolActions {\r\n /**\r\n * @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\r\n * @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\r\n * the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\r\n * you must call it with secondsAgos = [3600, 0].\r\n * @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\r\n * log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\r\n * @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\r\n * @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\r\n * @return secondsPerLiquidityCumulatives Cumulative seconds per liquidity-in-range value as of each `secondsAgos`\r\n * from the current block timestamp\r\n * @return volatilityCumulatives Cumulative standard deviation as of each `secondsAgos`\r\n * @return volumePerAvgLiquiditys Cumulative swap volume per liquidity as of each `secondsAgos`\r\n */\r\n function getTimepoints(uint32[] calldata secondsAgos)\r\n external\r\n view\r\n returns (\r\n int56[] memory tickCumulatives,\r\n uint160[] memory secondsPerLiquidityCumulatives,\r\n uint112[] memory volatilityCumulatives,\r\n uint256[] memory volumePerAvgLiquiditys\r\n );\r\n\r\n function factory() external view returns (address);\r\n\r\n function token0() external view returns (address);\r\n\r\n function token1() external view returns (address);\r\n\r\n function tickSpacing() external view returns (int24);\r\n}\r\n" + }, + "contracts/external/algebra/IAlgebraPoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Permissionless pool actions\r\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\r\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\r\ninterface IAlgebraPoolActions {\r\n /**\r\n * @notice Sets the initial price for the pool\r\n * @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\r\n * @param price the initial sqrt price of the pool as a Q64.96\r\n */\r\n function initialize(uint160 price) external;\r\n\r\n /**\r\n * @notice Adds liquidity for the given recipient/bottomTick/topTick position\r\n * @dev The caller of this method receives a callback in the form of IAlgebraMintCallback# AlgebraMintCallback\r\n * in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\r\n * on bottomTick, topTick, the amount of liquidity, and the current price.\r\n * @param sender The address which will receive potential surplus of paid tokens\r\n * @param recipient The address for which the liquidity will be created\r\n * @param bottomTick The lower tick of the position in which to add liquidity\r\n * @param topTick The upper tick of the position in which to add liquidity\r\n * @param amount The desired amount of liquidity to mint\r\n * @param data Any data that should be passed through to the callback\r\n * @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\r\n * @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\r\n * @return liquidityActual The actual minted amount of liquidity\r\n */\r\n function mint(\r\n address sender,\r\n address recipient,\r\n int24 bottomTick,\r\n int24 topTick,\r\n uint128 amount,\r\n bytes calldata data\r\n )\r\n external\r\n returns (\r\n uint256 amount0,\r\n uint256 amount1,\r\n uint128 liquidityActual\r\n );\r\n\r\n /**\r\n * @notice Collects tokens owed to a position\r\n * @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\r\n * Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\r\n * amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\r\n * actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\r\n * @param recipient The address which should receive the fees collected\r\n * @param bottomTick The lower tick of the position for which to collect fees\r\n * @param topTick The upper tick of the position for which to collect fees\r\n * @param amount0Requested How much token0 should be withdrawn from the fees owed\r\n * @param amount1Requested How much token1 should be withdrawn from the fees owed\r\n * @return amount0 The amount of fees collected in token0\r\n * @return amount1 The amount of fees collected in token1\r\n */\r\n function collect(\r\n address recipient,\r\n int24 bottomTick,\r\n int24 topTick,\r\n uint128 amount0Requested,\r\n uint128 amount1Requested\r\n ) external returns (uint128 amount0, uint128 amount1);\r\n\r\n /**\r\n * @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\r\n * @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\r\n * @dev Fees must be collected separately via a call to #collect\r\n * @param bottomTick The lower tick of the position for which to burn liquidity\r\n * @param topTick The upper tick of the position for which to burn liquidity\r\n * @param amount How much liquidity to burn\r\n * @return amount0 The amount of token0 sent to the recipient\r\n * @return amount1 The amount of token1 sent to the recipient\r\n */\r\n function burn(\r\n int24 bottomTick,\r\n int24 topTick,\r\n uint128 amount\r\n ) external returns (uint256 amount0, uint256 amount1);\r\n\r\n /**\r\n * @notice Swap token0 for token1, or token1 for token0\r\n * @dev The caller of this method receives a callback in the form of IAlgebraSwapCallback# AlgebraSwapCallback\r\n * @param recipient The address to receive the output of the swap\r\n * @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0\r\n * @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\r\n * @param limitSqrtPrice The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\r\n * value after the swap. If one for zero, the price cannot be greater than this value after the swap\r\n * @param data Any data to be passed through to the callback. If using the Router it should contain\r\n * SwapRouter#SwapCallbackData\r\n * @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\r\n * @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\r\n */\r\n function swap(\r\n address recipient,\r\n bool zeroToOne,\r\n int256 amountSpecified,\r\n uint160 limitSqrtPrice,\r\n bytes calldata data\r\n ) external returns (int256 amount0, int256 amount1);\r\n\r\n /**\r\n * @notice Swap token0 for token1, or token1 for token0 (tokens that have fee on transfer)\r\n * @dev The caller of this method receives a callback in the form of I AlgebraSwapCallback# AlgebraSwapCallback\r\n * @param sender The address called this function (Comes from the Router)\r\n * @param recipient The address to receive the output of the swap\r\n * @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0\r\n * @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\r\n * @param limitSqrtPrice The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\r\n * value after the swap. If one for zero, the price cannot be greater than this value after the swap\r\n * @param data Any data to be passed through to the callback. If using the Router it should contain\r\n * SwapRouter#SwapCallbackData\r\n * @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\r\n * @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\r\n */\r\n function swapSupportingFeeOnInputTokens(\r\n address sender,\r\n address recipient,\r\n bool zeroToOne,\r\n int256 amountSpecified,\r\n uint160 limitSqrtPrice,\r\n bytes calldata data\r\n ) external returns (int256 amount0, int256 amount1);\r\n\r\n /**\r\n * @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\r\n * @dev The caller of this method receives a callback in the form of IAlgebraFlashCallback# AlgebraFlashCallback\r\n * @dev All excess tokens paid in the callback are distributed to liquidity providers as an additional fee. So this method can be used\r\n * to donate underlying tokens to currently in-range liquidity providers by calling with 0 amount{0,1} and sending\r\n * the donation amount(s) from the callback\r\n * @param recipient The address which will receive the token0 and token1 amounts\r\n * @param amount0 The amount of token0 to send\r\n * @param amount1 The amount of token1 to send\r\n * @param data Any data to be passed through to the callback\r\n */\r\n function flash(\r\n address recipient,\r\n uint256 amount0,\r\n uint256 amount1,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/external/algebra/IAlgebraPoolState.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Pool state that can change\r\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\r\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\r\ninterface IAlgebraPoolState {\r\n /**\r\n * @notice The globalState structure in the pool stores many values but requires only one slot\r\n * and is exposed as a single method to save gas when accessed externally.\r\n * @return price The current price of the pool as a sqrt(token1/token0) Q64.96 value;\r\n * Returns tick The current tick of the pool, i.e. according to the last tick transition that was run;\r\n * Returns This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick\r\n * boundary;\r\n * Returns fee The last pool fee value in hundredths of a bip, i.e. 1e-6;\r\n * Returns timepointIndex The index of the last written timepoint;\r\n * Returns communityFeeToken0 The community fee percentage of the swap fee in thousandths (1e-3) for token0;\r\n * Returns communityFeeToken1 The community fee percentage of the swap fee in thousandths (1e-3) for token1;\r\n * Returns unlocked Whether the pool is currently locked to reentrancy;\r\n */\r\n function globalState()\r\n external\r\n view\r\n returns (\r\n uint160 price,\r\n int24 tick,\r\n uint16 fee,\r\n uint16 timepointIndex,\r\n uint8 communityFeeToken0,\r\n uint8 communityFeeToken1,\r\n bool unlocked\r\n );\r\n\r\n /**\r\n * @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\r\n * @dev This value can overflow the uint256\r\n */\r\n function totalFeeGrowth0Token() external view returns (uint256);\r\n\r\n /**\r\n * @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\r\n * @dev This value can overflow the uint256\r\n */\r\n function totalFeeGrowth1Token() external view returns (uint256);\r\n\r\n /**\r\n * @notice The currently in range liquidity available to the pool\r\n * @dev This value has no relationship to the total liquidity across all ticks.\r\n * Returned value cannot exceed type(uint128).max\r\n */\r\n function liquidity() external view returns (uint128);\r\n\r\n /**\r\n * @notice Look up information about a specific tick in the pool\r\n * @dev This is a public structure, so the `return` natspec tags are omitted.\r\n * @param tick The tick to look up\r\n * @return liquidityTotal the total amount of position liquidity that uses the pool either as tick lower or\r\n * tick upper;\r\n * Returns liquidityDelta how much liquidity changes when the pool price crosses the tick;\r\n * Returns outerFeeGrowth0Token the fee growth on the other side of the tick from the current tick in token0;\r\n * Returns outerFeeGrowth1Token the fee growth on the other side of the tick from the current tick in token1;\r\n * Returns outerTickCumulative the cumulative tick value on the other side of the tick from the current tick;\r\n * Returns outerSecondsPerLiquidity the seconds spent per liquidity on the other side of the tick from the current tick;\r\n * Returns outerSecondsSpent the seconds spent on the other side of the tick from the current tick;\r\n * Returns initialized Set to true if the tick is initialized, i.e. liquidityTotal is greater than 0\r\n * otherwise equal to false. Outside values can only be used if the tick is initialized.\r\n * In addition, these values are only relative and must be used only in comparison to previous snapshots for\r\n * a specific position.\r\n */\r\n function ticks(int24 tick)\r\n external\r\n view\r\n returns (\r\n uint128 liquidityTotal,\r\n int128 liquidityDelta,\r\n uint256 outerFeeGrowth0Token,\r\n uint256 outerFeeGrowth1Token,\r\n int56 outerTickCumulative,\r\n uint160 outerSecondsPerLiquidity,\r\n uint32 outerSecondsSpent,\r\n bool initialized\r\n );\r\n\r\n /** @notice Returns 256 packed tick initialized boolean values. See TickTable for more information */\r\n function tickTable(int16 wordPosition) external view returns (uint256);\r\n\r\n /**\r\n * @notice Returns the information about a position by the position's key\r\n * @dev This is a public mapping of structures, so the `return` natspec tags are omitted.\r\n * @param key The position's key is a hash of a preimage composed by the owner, bottomTick and topTick\r\n * @return liquidityAmount The amount of liquidity in the position;\r\n * Returns lastLiquidityAddTimestamp Timestamp of last adding of liquidity;\r\n * Returns innerFeeGrowth0Token Fee growth of token0 inside the tick range as of the last mint/burn/poke;\r\n * Returns innerFeeGrowth1Token Fee growth of token1 inside the tick range as of the last mint/burn/poke;\r\n * Returns fees0 The computed amount of token0 owed to the position as of the last mint/burn/poke;\r\n * Returns fees1 The computed amount of token1 owed to the position as of the last mint/burn/poke\r\n */\r\n function positions(bytes32 key)\r\n external\r\n view\r\n returns (\r\n uint128 liquidityAmount,\r\n uint32 lastLiquidityAddTimestamp,\r\n uint256 innerFeeGrowth0Token,\r\n uint256 innerFeeGrowth1Token,\r\n uint128 fees0,\r\n uint128 fees1\r\n );\r\n\r\n /**\r\n * @notice Returns data about a specific timepoint index\r\n * @param index The element of the timepoints array to fetch\r\n * @dev You most likely want to use #getTimepoints() instead of this method to get an timepoint as of some amount of time\r\n * ago, rather than at a specific index in the array.\r\n * This is a public mapping of structures, so the `return` natspec tags are omitted.\r\n * @return initialized whether the timepoint has been initialized and the values are safe to use;\r\n * Returns blockTimestamp The timestamp of the timepoint;\r\n * Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the timepoint timestamp;\r\n * Returns secondsPerLiquidityCumulative the seconds per in range liquidity for the life of the pool as of the timepoint timestamp;\r\n * Returns volatilityCumulative Cumulative standard deviation for the life of the pool as of the timepoint timestamp;\r\n * Returns averageTick Time-weighted average tick;\r\n * Returns volumePerLiquidityCumulative Cumulative swap volume per liquidity for the life of the pool as of the timepoint timestamp;\r\n */\r\n function timepoints(uint256 index)\r\n external\r\n view\r\n returns (\r\n bool initialized,\r\n uint32 blockTimestamp,\r\n int56 tickCumulative,\r\n uint160 secondsPerLiquidityCumulative,\r\n uint88 volatilityCumulative,\r\n int24 averageTick,\r\n uint144 volumePerLiquidityCumulative\r\n );\r\n\r\n /**\r\n * @notice Returns the information about active incentive\r\n * @dev if there is no active incentive at the moment, virtualPool,endTimestamp,startTimestamp would be equal to 0\r\n * @return virtualPool The address of a virtual pool associated with the current active incentive\r\n */\r\n function activeIncentive() external view returns (address virtualPool);\r\n\r\n /**\r\n * @notice Returns the lock time for added liquidity\r\n */\r\n function liquidityCooldown() external view returns (uint32 cooldownInSeconds);\r\n}\r\n" + }, + "contracts/external/algebra/IAlgebraSwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Callback for IAlgebraPoolActions#swap\r\n/// @notice Any contract that calls IAlgebraPoolActions#swap must implement this interface\r\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\r\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\r\ninterface IAlgebraSwapCallback {\r\n /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap.\r\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\r\n /// The caller of this method must be checked to be a AlgebraPool deployed by the canonical AlgebraFactory.\r\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\r\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\r\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\r\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\r\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\r\n /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call\r\n function algebraSwapCallback(\r\n int256 amount0Delta,\r\n int256 amount1Delta,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/external/algebra/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.7.5;\r\n\r\nimport \"./IAlgebraSwapCallback.sol\";\r\n\r\n/// @title Router token swapping functionality\r\n/// @notice Functions for swapping tokens via Algebra\r\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\r\n/// https://github.com/Uniswap/v3-periphery\r\ninterface IAlgebraSwapRouter is IAlgebraSwapCallback {\r\n struct ExactInputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n uint160 limitSqrtPrice;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\r\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n struct ExactInputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n struct ExactOutputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n uint24 fee;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n uint160 limitSqrtPrice;\r\n }\r\n\r\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\r\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\r\n /// @return amountIn The amount of the input token\r\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\r\n\r\n struct ExactOutputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n }\r\n\r\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\r\n /// @return amountIn The amount of the input token\r\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\r\n /// @dev Unlike standard swaps, handles transferring from user before the actual swap.\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInputSingleSupportingFeeOnTransferTokens(ExactInputSingleParams calldata params)\r\n external\r\n returns (uint256 amountOut);\r\n}\r\n" + }, + "contracts/external/api3/IProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ninterface IProxy {\r\n function read() external view returns (int224 value, uint32 timestamp);\r\n\r\n function api3ServerV1() external view returns (address);\r\n}\r\n" + }, + "contracts/external/chainlink/AggregatorInterface.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ninterface AggregatorInterface {\r\n function latestAnswer() external view returns (int256);\r\n\r\n function latestTimestamp() external view returns (uint256);\r\n\r\n function latestRound() external view returns (uint256);\r\n\r\n function getAnswer(uint256 roundId) external view returns (int256);\r\n\r\n function getTimestamp(uint256 roundId) external view returns (uint256);\r\n\r\n event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);\r\n\r\n event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);\r\n}\r\n" + }, + "contracts/external/chainlink/AggregatorV2V3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./AggregatorInterface.sol\";\r\nimport \"./AggregatorV3Interface.sol\";\r\n\r\ninterface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}\r\n" + }, + "contracts/external/chainlink/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ninterface AggregatorV3Interface {\r\n function decimals() external view returns (uint8);\r\n\r\n function description() external view returns (string memory);\r\n\r\n function version() external view returns (uint256);\r\n\r\n // getRoundData and latestRoundData should both raise \"No data present\"\r\n // if they do not have data to report, instead of returning unset values\r\n // which could be misinterpreted as actual reported values.\r\n function getRoundData(uint80 _roundId)\r\n external\r\n view\r\n returns (\r\n uint80 roundId,\r\n int256 answer,\r\n uint256 startedAt,\r\n uint256 updatedAt,\r\n uint80 answeredInRound\r\n );\r\n\r\n function latestRoundData()\r\n external\r\n view\r\n returns (\r\n uint80 roundId,\r\n int256 answer,\r\n uint256 startedAt,\r\n uint256 updatedAt,\r\n uint80 answeredInRound\r\n );\r\n}\r\n" + }, + "contracts/external/chainlink/Denominations.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nlibrary Denominations {\r\n address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\r\n address public constant BTC = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB;\r\n\r\n // Fiat currencies follow https://en.wikipedia.org/wiki/ISO_4217\r\n address public constant USD = address(840);\r\n address public constant GBP = address(826);\r\n address public constant EUR = address(978);\r\n address public constant JPY = address(392);\r\n address public constant KRW = address(410);\r\n address public constant CNY = address(156);\r\n address public constant AUD = address(36);\r\n address public constant CAD = address(124);\r\n address public constant CHF = address(756);\r\n address public constant ARS = address(32);\r\n address public constant PHP = address(608);\r\n address public constant NZD = address(554);\r\n address public constant SGD = address(702);\r\n address public constant NGN = address(566);\r\n address public constant ZAR = address(710);\r\n address public constant RUB = address(643);\r\n address public constant INR = address(356);\r\n address public constant BRL = address(986);\r\n}\r\n" + }, + "contracts/external/chainlink/FeedRegistryInterface.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./AggregatorV2V3Interface.sol\";\r\n\r\ninterface FeedRegistryInterface {\r\n struct Phase {\r\n uint16 phaseId;\r\n uint80 startingAggregatorRoundId;\r\n uint80 endingAggregatorRoundId;\r\n }\r\n\r\n event FeedProposed(\r\n address indexed asset,\r\n address indexed denomination,\r\n address indexed proposedAggregator,\r\n address currentAggregator,\r\n address sender\r\n );\r\n event FeedConfirmed(\r\n address indexed asset,\r\n address indexed denomination,\r\n address indexed latestAggregator,\r\n address previousAggregator,\r\n uint16 nextPhaseId,\r\n address sender\r\n );\r\n\r\n // V3 AggregatorV3Interface\r\n\r\n function decimals(address base, address quote) external view returns (uint8);\r\n\r\n function description(address base, address quote) external view returns (string memory);\r\n\r\n function version(address base, address quote) external view returns (uint256);\r\n\r\n function latestRoundData(address base, address quote)\r\n external\r\n view\r\n returns (\r\n uint80 roundId,\r\n int256 answer,\r\n uint256 startedAt,\r\n uint256 updatedAt,\r\n uint80 answeredInRound\r\n );\r\n\r\n function getRoundData(\r\n address base,\r\n address quote,\r\n uint80 _roundId\r\n )\r\n external\r\n view\r\n returns (\r\n uint80 roundId,\r\n int256 answer,\r\n uint256 startedAt,\r\n uint256 updatedAt,\r\n uint80 answeredInRound\r\n );\r\n\r\n // V2 AggregatorInterface\r\n\r\n function latestAnswer(address base, address quote) external view returns (int256 answer);\r\n\r\n function latestTimestamp(address base, address quote) external view returns (uint256 timestamp);\r\n\r\n function latestRound(address base, address quote) external view returns (uint256 roundId);\r\n\r\n function getAnswer(\r\n address base,\r\n address quote,\r\n uint256 roundId\r\n ) external view returns (int256 answer);\r\n\r\n function getTimestamp(\r\n address base,\r\n address quote,\r\n uint256 roundId\r\n ) external view returns (uint256 timestamp);\r\n\r\n // Registry getters\r\n\r\n function getFeed(address base, address quote) external view returns (AggregatorV2V3Interface aggregator);\r\n\r\n function getPhaseFeed(\r\n address base,\r\n address quote,\r\n uint16 phaseId\r\n ) external view returns (AggregatorV2V3Interface aggregator);\r\n\r\n function isFeedEnabled(address aggregator) external view returns (bool);\r\n\r\n function getPhase(\r\n address base,\r\n address quote,\r\n uint16 phaseId\r\n ) external view returns (Phase memory phase);\r\n\r\n // Round helpers\r\n\r\n function getRoundFeed(\r\n address base,\r\n address quote,\r\n uint80 roundId\r\n ) external view returns (AggregatorV2V3Interface aggregator);\r\n\r\n function getPhaseRange(\r\n address base,\r\n address quote,\r\n uint16 phaseId\r\n ) external view returns (uint80 startingRoundId, uint80 endingRoundId);\r\n\r\n function getPreviousRoundId(\r\n address base,\r\n address quote,\r\n uint80 roundId\r\n ) external view returns (uint80 previousRoundId);\r\n\r\n function getNextRoundId(\r\n address base,\r\n address quote,\r\n uint80 roundId\r\n ) external view returns (uint80 nextRoundId);\r\n\r\n // Feed management\r\n\r\n function proposeFeed(\r\n address base,\r\n address quote,\r\n address aggregator\r\n ) external;\r\n\r\n function confirmFeed(\r\n address base,\r\n address quote,\r\n address aggregator\r\n ) external;\r\n\r\n // Proposed aggregator\r\n\r\n function getProposedFeed(address base, address quote)\r\n external\r\n view\r\n returns (AggregatorV2V3Interface proposedAggregator);\r\n\r\n function proposedGetRoundData(\r\n address base,\r\n address quote,\r\n uint80 roundId\r\n )\r\n external\r\n view\r\n returns (\r\n uint80 id,\r\n int256 answer,\r\n uint256 startedAt,\r\n uint256 updatedAt,\r\n uint80 answeredInRound\r\n );\r\n\r\n function proposedLatestRoundData(address base, address quote)\r\n external\r\n view\r\n returns (\r\n uint80 id,\r\n int256 answer,\r\n uint256 startedAt,\r\n uint256 updatedAt,\r\n uint80 answeredInRound\r\n );\r\n\r\n // Phases\r\n function getCurrentPhaseId(address base, address quote) external view returns (uint16 currentPhaseId);\r\n}\r\n" + }, + "contracts/external/compound/ICErc20.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./ICToken.sol\";\r\n\r\n/**\r\n * @title Compound's CErc20 Contract\r\n * @notice CTokens which wrap an EIP-20 underlying\r\n * @author Compound\r\n */\r\ninterface ICErc20Compound is ICToken {\r\n function underlying() external view returns (address);\r\n\r\n function liquidateBorrow(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICToken cTokenCollateral\r\n ) external returns (uint256);\r\n\r\n function getTotalUnderlyingSupplied() external view returns (uint256);\r\n}\r\n" + }, + "contracts/external/compound/IComptroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IPriceOracle.sol\";\r\nimport \"./ICToken.sol\";\r\nimport \"./IUnitroller.sol\";\r\nimport \"./IRewardsDistributor.sol\";\r\n\r\n/**\r\n * @title Compound's Comptroller Contract\r\n * @author Compound\r\n */\r\ninterface IComptroller {\r\n function admin() external view returns (address);\r\n\r\n function adminHasRights() external view returns (bool);\r\n\r\n function ionicAdminHasRights() external view returns (bool);\r\n\r\n function oracle() external view returns (IPriceOracle);\r\n\r\n function pauseGuardian() external view returns (address);\r\n\r\n function closeFactorMantissa() external view returns (uint256);\r\n\r\n function liquidationIncentiveMantissa() external view returns (uint256);\r\n\r\n function markets(address cToken) external view returns (bool, uint256);\r\n\r\n function getAssetsIn(address account) external view returns (ICToken[] memory);\r\n\r\n function checkMembership(address account, ICToken cToken) external view returns (bool);\r\n\r\n function getHypotheticalAccountLiquidity(\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n )\r\n external\r\n view\r\n returns (\r\n uint256,\r\n uint256,\r\n uint256\r\n );\r\n\r\n function getAccountLiquidity(address account)\r\n external\r\n view\r\n returns (\r\n uint256,\r\n uint256,\r\n uint256\r\n );\r\n\r\n function _setPriceOracle(IPriceOracle newOracle) external returns (uint256);\r\n\r\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\r\n\r\n function _setCollateralFactor(ICToken market, uint256 newCollateralFactorMantissa) external returns (uint256);\r\n\r\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\r\n\r\n function _become(IUnitroller unitroller) external;\r\n\r\n function borrowGuardianPaused(address cToken) external view returns (bool);\r\n\r\n function mintGuardianPaused(address cToken) external view returns (bool);\r\n\r\n function getRewardsDistributors() external view returns (address[] memory);\r\n\r\n function getAllMarkets() external view returns (ICToken[] memory);\r\n\r\n function getAllBorrowers() external view returns (address[] memory);\r\n\r\n function suppliers(address account) external view returns (bool);\r\n\r\n function supplyCaps(address cToken) external view returns (uint256);\r\n\r\n function borrowCaps(address cToken) external view returns (uint256);\r\n\r\n function enforceWhitelist() external view returns (bool);\r\n\r\n function enterMarkets(address[] memory cTokens) external returns (uint256[] memory);\r\n\r\n function exitMarket(address cTokenAddress) external returns (uint256);\r\n\r\n function autoImplementation() external view returns (bool);\r\n\r\n function isUserOfPool(address user) external view returns (bool);\r\n\r\n function whitelist(address account) external view returns (bool);\r\n\r\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\r\n\r\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\r\n\r\n function _toggleAutoImplementations(bool enabled) external returns (uint256);\r\n\r\n function _deployMarket(\r\n bool isCEther,\r\n bytes memory constructorData,\r\n bytes calldata becomeImplData,\r\n uint256 collateralFactorMantissa\r\n ) external returns (uint256);\r\n\r\n function getMaxRedeemOrBorrow(\r\n address account,\r\n ICToken cTokenModify,\r\n bool isBorrow\r\n ) external view returns (uint256);\r\n\r\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\r\n\r\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\r\n\r\n function isDeprecated(ICToken cToken) external view returns (bool);\r\n\r\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\r\n\r\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\r\n}\r\n" + }, + "contracts/external/compound/ICToken.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Compound's CToken Contract\r\n * @notice Abstract base for CTokens\r\n * @author Compound\r\n */\r\ninterface ICToken {\r\n function admin() external view returns (address);\r\n\r\n function adminHasRights() external view returns (bool);\r\n\r\n function ionicAdminHasRights() external view returns (bool);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function comptroller() external view returns (address);\r\n\r\n function adminFeeMantissa() external view returns (uint256);\r\n\r\n function ionicFeeMantissa() external view returns (uint256);\r\n\r\n function reserveFactorMantissa() external view returns (uint256);\r\n\r\n function totalReserves() external view returns (uint256);\r\n\r\n function totalAdminFees() external view returns (uint256);\r\n\r\n function totalIonicFees() external view returns (uint256);\r\n\r\n function isCToken() external view returns (bool);\r\n\r\n function isCEther() external view returns (bool);\r\n\r\n function balanceOf(address owner) external view returns (uint256);\r\n\r\n function balanceOfUnderlying(address owner) external returns (uint256);\r\n\r\n function borrowRatePerBlock() external view returns (uint256);\r\n\r\n function supplyRatePerBlock() external view returns (uint256);\r\n\r\n function totalBorrowsCurrent() external returns (uint256);\r\n\r\n function totalBorrows() external view returns (uint256);\r\n\r\n function totalSupply() external view returns (uint256);\r\n\r\n function borrowBalanceStored(address account) external view returns (uint256);\r\n\r\n function borrowBalanceCurrent(address account) external returns (uint256);\r\n\r\n function exchangeRateCurrent() external returns (uint256);\r\n\r\n function exchangeRateStored() external view returns (uint256);\r\n\r\n function accrueInterest() external returns (uint256);\r\n\r\n function getCash() external view returns (uint256);\r\n\r\n function mint(uint256 mintAmount) external returns (uint256);\r\n\r\n function redeem(uint256 redeemTokens) external returns (uint256);\r\n\r\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\r\n\r\n function borrow(uint256 borrowAmount) external returns (uint256);\r\n\r\n function repayBorrow(uint256 repayAmount) external returns (uint256);\r\n\r\n function protocolSeizeShareMantissa() external view returns (uint256);\r\n\r\n function feeSeizeShareMantissa() external view returns (uint256);\r\n\r\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\r\n\r\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\r\n}\r\n" + }, + "contracts/external/compound/IPriceOracle.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./ICToken.sol\";\r\n\r\ninterface IPriceOracle {\r\n /**\r\n * @notice Get the underlying price of a cToken asset\r\n * @param cToken The cToken to get the underlying price of\r\n * @return The underlying asset price mantissa (scaled by 1e18).\r\n * Zero means the price is unavailable.\r\n */\r\n function getUnderlyingPrice(ICToken cToken) external view returns (uint256);\r\n}\r\n" + }, + "contracts/external/compound/IRewardsDistributor.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./ICToken.sol\";\r\n\r\n/**\r\n * @title RewardsDistributor\r\n * @author Compound\r\n */\r\ninterface IRewardsDistributor {\r\n /// @dev The token to reward (i.e., COMP)\r\n function rewardToken() external view returns (address);\r\n\r\n /// @notice The portion of compRate that each market currently receives\r\n function compSupplySpeeds(address) external view returns (uint256);\r\n\r\n /// @notice The portion of compRate that each market currently receives\r\n function compBorrowSpeeds(address) external view returns (uint256);\r\n\r\n /// @notice The COMP accrued but not yet transferred to each user\r\n function compAccrued(address) external view returns (uint256);\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\r\n * @dev Called by the Comptroller\r\n * @param cToken The relevant market\r\n * @param supplier The minter/redeemer\r\n */\r\n function flywheelPreSupplierAction(address cToken, address supplier) external;\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\r\n * @dev Called by the Comptroller\r\n * @param cToken The relevant market\r\n * @param borrower The borrower\r\n */\r\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\r\n\r\n /**\r\n * @notice Returns an array of all markets.\r\n */\r\n function getAllMarkets() external view returns (ICToken[] memory);\r\n}\r\n" + }, + "contracts/external/compound/IUnitroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title ComptrollerCore\r\n * @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.\r\n * CTokens should reference this contract as their comptroller.\r\n */\r\ninterface IUnitroller {\r\n function _setPendingImplementation(address newPendingImplementation) external returns (uint256);\r\n\r\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\r\n}\r\n" + }, + "contracts/external/curve/ICurveLiquidityGaugeV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\ninterface ICurveLiquidityGaugeV2 {\r\n function lp_token() external view returns (address);\r\n\r\n function deposit(uint256 _value) external;\r\n\r\n function withdraw(uint256 _value) external;\r\n}\r\n" + }, + "contracts/external/curve/ICurvePool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface ICurvePool is IERC20Upgradeable {\r\n function get_virtual_price() external view returns (uint256);\r\n\r\n function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 min_amount) external;\r\n\r\n function calc_withdraw_one_coin(uint256 _burn_amount, int128 i) external view returns (uint256);\r\n\r\n function add_liquidity(uint256[2] calldata _amounts, uint256 _min_mint_amount) external returns (uint256);\r\n\r\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);\r\n\r\n function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256);\r\n\r\n function coins(uint256 index) external view returns (address);\r\n\r\n function lp_token() external view returns (address);\r\n}\r\n" + }, + "contracts/external/curve/ICurveRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\ninterface ICurveRegistry {\r\n function get_n_coins(address lp) external view returns (uint256);\r\n\r\n function get_coins(address pool) external view returns (address[8] memory);\r\n\r\n function get_pool_from_lp_token(address lp) external view returns (address);\r\n}\r\n" + }, + "contracts/external/curve/ICurveStableSwap.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface ICurveStableSwap is IERC20Upgradeable {\r\n function get_balances() external view returns (uint256[2] memory);\r\n\r\n function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 min_amount) external;\r\n}\r\n" + }, + "contracts/external/curve/ICurveV2Pool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICurvePool } from \"./ICurvePool.sol\";\r\n\r\ninterface ICurveV2Pool is ICurvePool {\r\n function price_oracle() external view returns (uint256);\r\n\r\n function lp_price() external view returns (uint256);\r\n\r\n function coins(uint256 arg0) external view returns (address);\r\n}\r\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.22;\r\n\r\ninterface IHypernativeOracle {\r\n function register(address account, bool isStrictMode) external;\r\n function validateForbiddenAccountInteraction(address sender) external view;\r\n function validateForbiddenContextInteraction(address origin, address sender) external view;\r\n function validateBlacklistedAccountInteraction(address sender) external;\r\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\r\npragma solidity ^0.8.0;\r\n\r\ninterface IExpressRelay {\r\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\r\n // This will return true if and only if it's being called while executing the auction winner(s) call.\r\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\r\n // @param permissionId The id that represents the action being gated\r\n // @return permissioned True if the permission is allowed, false otherwise\r\n function isPermissioned(\r\n address protocolFeeReceiver,\r\n bytes calldata permissionId\r\n ) external view returns (bool permissioned);\r\n}\r\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\r\npragma solidity ^0.8.0;\r\n\r\ninterface IExpressRelayFeeReceiver {\r\n // Receive the proceeds of an auction.\r\n // @param permissionKey The permission key where the auction was conducted on.\r\n function receiveAuctionProceedings(\r\n bytes calldata permissionKey\r\n ) external payable;\r\n}\r\n" + }, + "contracts/external/redstone/IRedstoneOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ninterface IRedstoneOracle {\r\n function priceOf(address asset) external view returns (uint256);\r\n\r\n function priceOfETH() external view returns (uint256);\r\n\r\n function getDataFeedIdForAsset(address asset) external view returns (bytes32);\r\n\r\n function getDataFeedIds() external view returns (bytes32[] memory dataFeedIds);\r\n}\r\n" + }, + "contracts/external/uniswap/FullMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\n// From Uniswap3 Core\r\n\r\n// Updated to Solidity 0.8 by Midas Capital:\r\n// * Rewrite unary negation of denominator, which is a uint\r\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/// @title Contains 512-bit math functions\r\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\r\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\r\nlibrary FullMath {\r\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\r\n /// @param a The multiplicand\r\n /// @param b The multiplier\r\n /// @param denominator The divisor\r\n /// @return result The 256-bit result\r\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\r\n function mulDiv(\r\n uint256 a,\r\n uint256 b,\r\n uint256 denominator\r\n ) internal pure returns (uint256 result) {\r\n unchecked {\r\n // 512-bit multiply [prod1 prod0] = a * b\r\n // Compute the product mod 2**256 and mod 2**256 - 1\r\n // then use the Chinese Remainder Theorem to reconstruct\r\n // the 512 bit result. The result is stored in two 256\r\n // variables such that product = prod1 * 2**256 + prod0\r\n uint256 prod0; // Least significant 256 bits of the product\r\n uint256 prod1; // Most significant 256 bits of the product\r\n assembly {\r\n let mm := mulmod(a, b, not(0))\r\n prod0 := mul(a, b)\r\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\r\n }\r\n\r\n // Handle non-overflow cases, 256 by 256 division\r\n if (prod1 == 0) {\r\n require(denominator > 0);\r\n assembly {\r\n result := div(prod0, denominator)\r\n }\r\n return result;\r\n }\r\n\r\n // Make sure the result is less than 2**256.\r\n // Also prevents denominator == 0\r\n require(denominator > prod1);\r\n\r\n ///////////////////////////////////////////////\r\n // 512 by 256 division.\r\n ///////////////////////////////////////////////\r\n\r\n // Make division exact by subtracting the remainder from [prod1 prod0]\r\n // Compute remainder using mulmod\r\n uint256 remainder;\r\n assembly {\r\n remainder := mulmod(a, b, denominator)\r\n }\r\n // Subtract 256 bit number from 512 bit number\r\n assembly {\r\n prod1 := sub(prod1, gt(remainder, prod0))\r\n prod0 := sub(prod0, remainder)\r\n }\r\n\r\n // Factor powers of two out of denominator\r\n // Compute largest power of two divisor of denominator.\r\n // Always >= 1.\r\n uint256 twos = denominator & (~denominator + 1);\r\n\r\n // Divide denominator by power of two\r\n assembly {\r\n denominator := div(denominator, twos)\r\n }\r\n\r\n // Divide [prod1 prod0] by the factors of two\r\n assembly {\r\n prod0 := div(prod0, twos)\r\n }\r\n // Shift in bits from prod1 into prod0. For this we need\r\n // to flip `twos` such that it is 2**256 / twos.\r\n // If twos is zero, then it becomes one\r\n assembly {\r\n twos := add(div(sub(0, twos), twos), 1)\r\n }\r\n prod0 |= prod1 * twos;\r\n\r\n // Invert denominator mod 2**256\r\n // Now that denominator is an odd number, it has an inverse\r\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\r\n // Compute the inverse by starting with a seed that is correct\r\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\r\n uint256 inv = (3 * denominator) ^ 2;\r\n // Now use Newton-Raphson iteration to improve the precision.\r\n // Thanks to Hensel's lifting lemma, this also works in modular\r\n // arithmetic, doubling the correct bits in each step.\r\n inv *= 2 - denominator * inv; // inverse mod 2**8\r\n inv *= 2 - denominator * inv; // inverse mod 2**16\r\n inv *= 2 - denominator * inv; // inverse mod 2**32\r\n inv *= 2 - denominator * inv; // inverse mod 2**64\r\n inv *= 2 - denominator * inv; // inverse mod 2**128\r\n inv *= 2 - denominator * inv; // inverse mod 2**256\r\n\r\n // Because the division is now exact we can divide by multiplying\r\n // with the modular inverse of denominator. This will give us the\r\n // correct result modulo 2**256. Since the precoditions guarantee\r\n // that the outcome is less than 2**256, this is the final result.\r\n // We don't need to compute the high bits of the result and prod1\r\n // is no longer required.\r\n result = prod0 * inv;\r\n return result;\r\n }\r\n }\r\n\r\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\r\n /// @param a The multiplicand\r\n /// @param b The multiplier\r\n /// @param denominator The divisor\r\n /// @return result The 256-bit result\r\n function mulDivRoundingUp(\r\n uint256 a,\r\n uint256 b,\r\n uint256 denominator\r\n ) internal pure returns (uint256 result) {\r\n unchecked {\r\n result = mulDiv(a, b, denominator);\r\n if (mulmod(a, b, denominator) > 0) {\r\n require(result < type(uint256).max);\r\n result++;\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.8.0;\r\n\r\n/// @title Router token swapping functionality\r\n/// @notice Functions for swapping tokens via Uniswap V3\r\ninterface ISwapRouter {\r\n struct ExactInputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n uint24 fee;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n uint160 sqrtPriceLimitX96;\r\n }\r\n\r\n struct ExactInputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n }\r\n\r\n struct ExactOutputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n uint24 fee;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n uint160 sqrtPriceLimitX96;\r\n }\r\n\r\n struct ExactOutputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 deadline;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\r\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n function exactInput(ExactInputParams calldata params) external returns (uint256 amountOut);\r\n\r\n function exactOutputSingle(ExactOutputSingleParams calldata params) external returns (uint256 amountIn);\r\n\r\n function exactOutput(ExactOutputParams calldata params) external returns (uint256 amountIn);\r\n\r\n function factory() external returns (address);\r\n\r\n function multicall(uint256 deadline, bytes[] calldata data) external payable returns (bytes[] memory);\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV1Exchange.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ninterface IUniswapV1Exchange {\r\n function tokenToEthSwapInput(\r\n uint256 tokens_sold,\r\n uint256 min_eth,\r\n uint256 deadline\r\n ) external returns (uint256);\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV1Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ninterface IUniswapV1Factory {\r\n function getExchange(address token) external view returns (address);\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV2Callee.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ninterface IUniswapV2Callee {\r\n function uniswapV2Call(\r\n address sender,\r\n uint256 amount0,\r\n uint256 amount1,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV2Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ninterface IUniswapV2Factory {\r\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\r\n\r\n function feeTo() external view returns (address);\r\n\r\n function feeToSetter() external view returns (address);\r\n\r\n function getPair(address tokenA, address tokenB) external view returns (address pair);\r\n\r\n function allPairs(uint256) external view returns (address pair);\r\n\r\n function allPairsLength() external view returns (uint256);\r\n\r\n function createPair(address tokenA, address tokenB) external returns (address pair);\r\n\r\n function setFeeTo(address) external;\r\n\r\n function setFeeToSetter(address) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV2Pair.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ninterface IUniswapV2Pair {\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n function name() external pure returns (string memory);\r\n\r\n function symbol() external pure returns (string memory);\r\n\r\n function decimals() external pure returns (uint8);\r\n\r\n function totalSupply() external view returns (uint256);\r\n\r\n function balanceOf(address owner) external view returns (uint256);\r\n\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n function approve(address spender, uint256 value) external returns (bool);\r\n\r\n function transfer(address to, uint256 value) external returns (bool);\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 value\r\n ) external returns (bool);\r\n\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n\r\n function PERMIT_TYPEHASH() external pure returns (bytes32);\r\n\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\r\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\r\n event Swap(\r\n address indexed sender,\r\n uint256 amount0In,\r\n uint256 amount1In,\r\n uint256 amount0Out,\r\n uint256 amount1Out,\r\n address indexed to\r\n );\r\n event Sync(uint112 reserve0, uint112 reserve1);\r\n\r\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\r\n\r\n function factory() external view returns (address);\r\n\r\n function token0() external view returns (address);\r\n\r\n function token1() external view returns (address);\r\n\r\n function getReserves()\r\n external\r\n view\r\n returns (\r\n uint112 reserve0,\r\n uint112 reserve1,\r\n uint32 blockTimestampLast\r\n );\r\n\r\n function price0CumulativeLast() external view returns (uint256);\r\n\r\n function price1CumulativeLast() external view returns (uint256);\r\n\r\n function kLast() external view returns (uint256);\r\n\r\n function mint(address to) external returns (uint256 liquidity);\r\n\r\n function burn(address to) external returns (uint256 amount0, uint256 amount1);\r\n\r\n function swap(\r\n uint256 amount0Out,\r\n uint256 amount1Out,\r\n address to,\r\n bytes calldata data\r\n ) external;\r\n\r\n function skim(address to) external;\r\n\r\n function sync() external;\r\n\r\n function initialize(address, address) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV2Router01.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ninterface IUniswapV2Router01 {\r\n function factory() external pure returns (address);\r\n\r\n function WETH() external pure returns (address);\r\n\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint256 amountADesired,\r\n uint256 amountBDesired,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n )\r\n external\r\n returns (\r\n uint256 amountA,\r\n uint256 amountB,\r\n uint256 liquidity\r\n );\r\n\r\n function addLiquidityETH(\r\n address token,\r\n uint256 amountTokenDesired,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n )\r\n external\r\n payable\r\n returns (\r\n uint256 amountToken,\r\n uint256 amountETH,\r\n uint256 liquidity\r\n );\r\n\r\n function removeLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint256 liquidity,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountA, uint256 amountB);\r\n\r\n function removeLiquidityETH(\r\n address token,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountToken, uint256 amountETH);\r\n\r\n function removeLiquidityWithPermit(\r\n address tokenA,\r\n address tokenB,\r\n uint256 liquidity,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline,\r\n bool approveMax,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external returns (uint256 amountA, uint256 amountB);\r\n\r\n function removeLiquidityETHWithPermit(\r\n address token,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline,\r\n bool approveMax,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external returns (uint256 amountToken, uint256 amountETH);\r\n\r\n function swapExactTokensForTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n function swapTokensForExactTokens(\r\n uint256 amountOut,\r\n uint256 amountInMax,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n function swapExactETHForTokens(\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external payable returns (uint256[] memory amounts);\r\n\r\n function swapTokensForExactETH(\r\n uint256 amountOut,\r\n uint256 amountInMax,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n function swapExactTokensForETH(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n function swapETHForExactTokens(\r\n uint256 amountOut,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external payable returns (uint256[] memory amounts);\r\n\r\n function quote(\r\n uint256 amountA,\r\n uint256 reserveA,\r\n uint256 reserveB\r\n ) external pure returns (uint256 amountB);\r\n\r\n function getAmountOut(\r\n uint256 amountIn,\r\n uint256 reserveIn,\r\n uint256 reserveOut\r\n ) external pure returns (uint256 amountOut);\r\n\r\n function getAmountIn(\r\n uint256 amountOut,\r\n uint256 reserveIn,\r\n uint256 reserveOut\r\n ) external pure returns (uint256 amountIn);\r\n\r\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\r\n\r\n function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV2Router02.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IUniswapV2Router01.sol\";\r\n\r\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\r\n function removeLiquidityETHSupportingFeeOnTransferTokens(\r\n address token,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountETH);\r\n\r\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\r\n address token,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline,\r\n bool approveMax,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external returns (uint256 amountETH);\r\n\r\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n\r\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n address referrer,\r\n uint256 deadline\r\n ) external;\r\n\r\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external payable;\r\n\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title The interface for the Uniswap V3 Factory\r\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\r\ninterface IUniswapV3Factory {\r\n /// @notice Emitted when the owner of the factory is changed\r\n /// @param oldOwner The owner before the owner was changed\r\n /// @param newOwner The owner after the owner was changed\r\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\r\n\r\n /// @notice Emitted when a pool is created\r\n /// @param token0 The first token of the pool by address sort order\r\n /// @param token1 The second token of the pool by address sort order\r\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\r\n /// @param tickSpacing The minimum number of ticks between initialized ticks\r\n /// @param pool The address of the created pool\r\n event PoolCreated(\r\n address indexed token0,\r\n address indexed token1,\r\n uint24 indexed fee,\r\n int24 tickSpacing,\r\n address pool\r\n );\r\n\r\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\r\n /// @param fee The enabled fee, denominated in hundredths of a bip\r\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\r\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\r\n\r\n /// @notice Returns the current owner of the factory\r\n /// @dev Can be changed by the current owner via setOwner\r\n /// @return The address of the factory owner\r\n function owner() external view returns (address);\r\n\r\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\r\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\r\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\r\n /// @return The tick spacing\r\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\r\n\r\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\r\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\r\n /// @param tokenA The contract address of either token0 or token1\r\n /// @param tokenB The contract address of the other token\r\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\r\n /// @return pool The pool address\r\n function getPool(\r\n address tokenA,\r\n address tokenB,\r\n uint24 fee\r\n ) external view returns (address pool);\r\n\r\n /// @notice Creates a pool for the given two tokens and fee\r\n /// @param tokenA One of the two tokens in the desired pool\r\n /// @param tokenB The other of the two tokens in the desired pool\r\n /// @param fee The desired fee for the pool\r\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\r\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\r\n /// are invalid.\r\n /// @return pool The address of the newly created pool\r\n function createPool(\r\n address tokenA,\r\n address tokenB,\r\n uint24 fee\r\n ) external returns (address pool);\r\n\r\n /// @notice Updates the owner of the factory\r\n /// @dev Must be called by the current owner\r\n /// @param _owner The new owner of the factory\r\n function setOwner(address _owner) external;\r\n\r\n /// @notice Enables a fee amount with the given tickSpacing\r\n /// @dev Fee amounts may never be removed once enabled\r\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\r\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\r\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Callback for IUniswapV3PoolActions#flash\r\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\r\ninterface IUniswapV3FlashCallback {\r\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\r\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\r\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\r\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\r\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\r\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\r\n function uniswapV3FlashCallback(\r\n uint256 fee0,\r\n uint256 fee1,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IUniswapV3PoolActions.sol\";\r\n\r\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\r\n function token0() external view returns (address);\r\n\r\n function token1() external view returns (address);\r\n\r\n function fee() external view returns (uint24);\r\n\r\n function slot0()\r\n external\r\n view\r\n returns (\r\n uint160 sqrtPriceX96,\r\n int24 tick,\r\n uint16 observationIndex,\r\n uint16 observationCardinality,\r\n uint16 observationCardinalityNext,\r\n uint8 feeProtocol,\r\n bool unlocked\r\n );\r\n\r\n function liquidity() external view returns (uint128);\r\n\r\n function observe(uint32[] calldata secondsAgos)\r\n external\r\n view\r\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\r\n\r\n function observations(uint256 index)\r\n external\r\n view\r\n returns (\r\n uint32 blockTimestamp,\r\n int56 tickCumulative,\r\n uint160 liquidityCumulative,\r\n bool initialized\r\n );\r\n\r\n function tickBitmap(int16 wordPosition) external view returns (uint256);\r\n\r\n function ticks(int24 tick)\r\n external\r\n view\r\n returns (\r\n uint128 liquidityGross,\r\n int128 liquidityNet,\r\n uint256 feeGrowthOutside0X128,\r\n uint256 feeGrowthOutside1X128,\r\n int56 tickCumulativeOutside,\r\n uint160 secondsPerLiquidityOutsideX128,\r\n uint32 secondsOutside,\r\n bool initialized\r\n );\r\n\r\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\r\n\r\n function positions(bytes32 key)\r\n external\r\n view\r\n returns (\r\n uint128 _liquidity,\r\n uint256 feeGrowthInside0LastX128,\r\n uint256 feeGrowthInside1LastX128,\r\n uint128 tokensOwed0,\r\n uint128 tokensOwed1\r\n );\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Permissionless pool actions\r\n/// @notice Contains pool methods that can be called by anyone\r\ninterface IUniswapV3PoolActions {\r\n /// @notice Sets the initial price for the pool\r\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\r\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\r\n function initialize(uint160 sqrtPriceX96) external;\r\n\r\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\r\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\r\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\r\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\r\n /// @param recipient The address for which the liquidity will be created\r\n /// @param tickLower The lower tick of the position in which to add liquidity\r\n /// @param tickUpper The upper tick of the position in which to add liquidity\r\n /// @param amount The amount of liquidity to mint\r\n /// @param data Any data that should be passed through to the callback\r\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\r\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\r\n function mint(\r\n address recipient,\r\n int24 tickLower,\r\n int24 tickUpper,\r\n uint128 amount,\r\n bytes calldata data\r\n ) external returns (uint256 amount0, uint256 amount1);\r\n\r\n /// @notice Collects tokens owed to a position\r\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\r\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\r\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\r\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\r\n /// @param recipient The address which should receive the fees collected\r\n /// @param tickLower The lower tick of the position for which to collect fees\r\n /// @param tickUpper The upper tick of the position for which to collect fees\r\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\r\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\r\n /// @return amount0 The amount of fees collected in token0\r\n /// @return amount1 The amount of fees collected in token1\r\n function collect(\r\n address recipient,\r\n int24 tickLower,\r\n int24 tickUpper,\r\n uint128 amount0Requested,\r\n uint128 amount1Requested\r\n ) external returns (uint128 amount0, uint128 amount1);\r\n\r\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\r\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\r\n /// @dev Fees must be collected separately via a call to #collect\r\n /// @param tickLower The lower tick of the position for which to burn liquidity\r\n /// @param tickUpper The upper tick of the position for which to burn liquidity\r\n /// @param amount How much liquidity to burn\r\n /// @return amount0 The amount of token0 sent to the recipient\r\n /// @return amount1 The amount of token1 sent to the recipient\r\n function burn(\r\n int24 tickLower,\r\n int24 tickUpper,\r\n uint128 amount\r\n ) external returns (uint256 amount0, uint256 amount1);\r\n\r\n /// @notice Swap token0 for token1, or token1 for token0\r\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\r\n /// @param recipient The address to receive the output of the swap\r\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\r\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\r\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\r\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\r\n /// @param data Any data to be passed through to the callback\r\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\r\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\r\n function swap(\r\n address recipient,\r\n bool zeroForOne,\r\n int256 amountSpecified,\r\n uint160 sqrtPriceLimitX96,\r\n bytes calldata data\r\n ) external returns (int256 amount0, int256 amount1);\r\n\r\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\r\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\r\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\r\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\r\n /// @param recipient The address which will receive the token0 and token1 amounts\r\n /// @param amount0 The amount of token0 to send\r\n /// @param amount1 The amount of token1 to send\r\n /// @param data Any data to be passed through to the callback\r\n function flash(\r\n address recipient,\r\n uint256 amount0,\r\n uint256 amount1,\r\n bytes calldata data\r\n ) external;\r\n\r\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\r\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\r\n /// the input observationCardinalityNext.\r\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\r\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3PoolImmutables.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Pool state that never changes\r\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\r\ninterface IUniswapV3PoolImmutables {\r\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\r\n /// @return The contract address\r\n function factory() external view returns (address);\r\n\r\n /// @notice The first of the two tokens of the pool, sorted by address\r\n /// @return The token contract address\r\n function token0() external view returns (address);\r\n\r\n /// @notice The second of the two tokens of the pool, sorted by address\r\n /// @return The token contract address\r\n function token1() external view returns (address);\r\n\r\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\r\n /// @return The fee\r\n function fee() external view returns (uint24);\r\n\r\n /// @notice The pool tick spacing\r\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\r\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\r\n /// This value is an int24 to avoid casting even though it is always positive.\r\n /// @return The tick spacing\r\n function tickSpacing() external view returns (int24);\r\n\r\n /// @notice The maximum amount of position liquidity that can use any tick in the range\r\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\r\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\r\n /// @return The max amount of liquidity per tick\r\n function maxLiquidityPerTick() external view returns (uint128);\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3SwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Callback for IUniswapV3PoolActions#swap\r\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\r\ninterface IUniswapV3SwapCallback {\r\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\r\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\r\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\r\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\r\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\r\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\r\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\r\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\r\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\r\n function uniswapV3SwapCallback(\r\n int256 amount0Delta,\r\n int256 amount1Delta,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IV3SwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.7.5;\r\npragma abicoder v2;\r\n\r\nimport './IUniswapV3SwapCallback.sol';\r\n\r\n/// @title Router token swapping functionality\r\n/// @notice Functions for swapping tokens via Uniswap V3\r\ninterface IV3SwapRouter is IUniswapV3SwapCallback {\r\n struct ExactInputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n uint24 fee;\r\n address recipient;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n uint160 sqrtPriceLimitX96;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\r\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\r\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\r\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n struct ExactInputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 amountIn;\r\n uint256 amountOutMinimum;\r\n }\r\n\r\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\r\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\r\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\r\n /// @return amountOut The amount of the received token\r\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\r\n\r\n struct ExactOutputSingleParams {\r\n address tokenIn;\r\n address tokenOut;\r\n uint24 fee;\r\n address recipient;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n uint160 sqrtPriceLimitX96;\r\n }\r\n\r\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\r\n /// that may remain in the router after the swap.\r\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\r\n /// @return amountIn The amount of the input token\r\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\r\n\r\n struct ExactOutputParams {\r\n bytes path;\r\n address recipient;\r\n uint256 amountOut;\r\n uint256 amountInMaximum;\r\n }\r\n\r\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\r\n /// that may remain in the router after the swap.\r\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\r\n /// @return amountIn The amount of the input token\r\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\r\n}\r\n" + }, + "contracts/external/uniswap/LiquidityAmounts.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity >=0.5.0;\r\n\r\nimport { FullMath } from \"./FullMath.sol\";\r\n\r\nlibrary FixedPoint96 {\r\n uint8 internal constant RESOLUTION = 96;\r\n uint256 internal constant Q96 = 0x1000000000000000000000000;\r\n}\r\n\r\n/// @title Liquidity amount functions\r\n/// @notice Provides functions for computing liquidity amounts from token amounts and prices\r\nlibrary LiquidityAmounts {\r\n function toUint128(uint256 x) private pure returns (uint128 y) {\r\n require((y = uint128(x)) == x);\r\n }\r\n\r\n /// @notice Computes the amount of liquidity received for a given amount of token0 and price range\r\n /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)).\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param amount0 The amount0 being sent in\r\n /// @return liquidity The amount of returned liquidity\r\n function getLiquidityForAmount0(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint256 amount0\r\n ) internal pure returns (uint128 liquidity) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\r\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\r\n }\r\n\r\n /// @notice Computes the amount of liquidity received for a given amount of token1 and price range\r\n /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param amount1 The amount1 being sent in\r\n /// @return liquidity The amount of returned liquidity\r\n function getLiquidityForAmount1(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint256 amount1\r\n ) internal pure returns (uint128 liquidity) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\r\n }\r\n\r\n /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current\r\n /// pool prices and the prices at the tick boundaries\r\n function getLiquidityForAmounts(\r\n uint160 sqrtRatioX96,\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint256 amount0,\r\n uint256 amount1\r\n ) internal pure returns (uint128 liquidity) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n\r\n if (sqrtRatioX96 <= sqrtRatioAX96) {\r\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\r\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\r\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\r\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\r\n\r\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\r\n } else {\r\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\r\n }\r\n }\r\n\r\n /// @notice Computes the amount of token0 for a given amount of liquidity and a price range\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param liquidity The liquidity being valued\r\n /// @return amount0 The amount0\r\n function getAmount0ForLiquidity(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint128 liquidity\r\n ) internal pure returns (uint256 amount0) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n\r\n return\r\n FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) /\r\n sqrtRatioAX96;\r\n }\r\n\r\n /// @notice Computes the amount of token1 for a given amount of liquidity and a price range\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param liquidity The liquidity being valued\r\n /// @return amount1 The amount1\r\n function getAmount1ForLiquidity(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint128 liquidity\r\n ) internal pure returns (uint256 amount1) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n\r\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\r\n }\r\n\r\n /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current\r\n /// pool prices and the prices at the tick boundaries\r\n function getAmountsForLiquidity(\r\n uint160 sqrtRatioX96,\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint128 liquidity\r\n ) internal pure returns (uint256 amount0, uint256 amount1) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n\r\n if (sqrtRatioX96 <= sqrtRatioAX96) {\r\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\r\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\r\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\r\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\r\n } else {\r\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/interfaces/IQuoter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\r\npragma solidity >=0.8.0 <0.9.0;\r\n\r\ninterface IQuoter {\r\n function estimateMaxSwapUniswapV3(\r\n address _fromToken,\r\n address _toToken,\r\n uint256 _amount,\r\n uint24 _poolFee\r\n ) external view returns (uint256);\r\n\r\n function estimateMinSwapUniswapV3(\r\n address _fromToken,\r\n address _toToken,\r\n uint256 _amount,\r\n uint24 _poolFee\r\n ) external view returns (uint256);\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.7.5;\r\npragma abicoder v2;\r\n\r\n/// @title Quoter Interface\r\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\r\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\r\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\r\ninterface IUniswapV3Quoter {\r\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\r\n /// @param path The path of the swap, i.e. each token pair and the pool fee\r\n /// @param amountIn The amount of the first token to swap\r\n /// @return amountOut The amount of the last token that would be received\r\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\r\n\r\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\r\n /// @param tokenIn The token being swapped in\r\n /// @param tokenOut The token being swapped out\r\n /// @param fee The fee of the token pool to consider for the pair\r\n /// @param amountIn The desired input amount\r\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\r\n /// @return amountOut The amount of `tokenOut` that would be received\r\n function quoteExactInputSingle(\r\n address tokenIn,\r\n address tokenOut,\r\n uint24 fee,\r\n uint256 amountIn,\r\n uint160 sqrtPriceLimitX96\r\n ) external returns (uint256 amountOut);\r\n\r\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\r\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\r\n /// @param amountOut The amount of the last token to receive\r\n /// @return amountIn The amount of first token required to be paid\r\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\r\n\r\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\r\n /// @param tokenIn The token being swapped in\r\n /// @param tokenOut The token being swapped out\r\n /// @param fee The fee of the token pool to consider for the pair\r\n /// @param amountOut The desired output amount\r\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\r\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\r\n function quoteExactOutputSingle(\r\n address tokenIn,\r\n address tokenOut,\r\n uint24 fee,\r\n uint256 amountOut,\r\n uint160 sqrtPriceLimitX96\r\n ) external returns (uint256 amountIn);\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/BitMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\n/// @title BitMath\r\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\r\nlibrary BitMath {\r\n /// @notice Returns the index of the most significant bit of the number,\r\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\r\n /// @dev The function satisfies the property:\r\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\r\n /// @param x the value for which to compute the most significant bit, must be greater than 0\r\n /// @return r the index of the most significant bit\r\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\r\n require(x > 0);\r\n\r\n if (x >= 0x100000000000000000000000000000000) {\r\n x >>= 128;\r\n r += 128;\r\n }\r\n if (x >= 0x10000000000000000) {\r\n x >>= 64;\r\n r += 64;\r\n }\r\n if (x >= 0x100000000) {\r\n x >>= 32;\r\n r += 32;\r\n }\r\n if (x >= 0x10000) {\r\n x >>= 16;\r\n r += 16;\r\n }\r\n if (x >= 0x100) {\r\n x >>= 8;\r\n r += 8;\r\n }\r\n if (x >= 0x10) {\r\n x >>= 4;\r\n r += 4;\r\n }\r\n if (x >= 0x4) {\r\n x >>= 2;\r\n r += 2;\r\n }\r\n if (x >= 0x2) r += 1;\r\n }\r\n\r\n /// @notice Returns the index of the least significant bit of the number,\r\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\r\n /// @dev The function satisfies the property:\r\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\r\n /// @param x the value for which to compute the least significant bit, must be greater than 0\r\n /// @return r the index of the least significant bit\r\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\r\n require(x > 0);\r\n\r\n r = 255;\r\n if (x & type(uint128).max > 0) {\r\n r -= 128;\r\n } else {\r\n x >>= 128;\r\n }\r\n if (x & type(uint64).max > 0) {\r\n r -= 64;\r\n } else {\r\n x >>= 64;\r\n }\r\n if (x & type(uint32).max > 0) {\r\n r -= 32;\r\n } else {\r\n x >>= 32;\r\n }\r\n if (x & type(uint16).max > 0) {\r\n r -= 16;\r\n } else {\r\n x >>= 16;\r\n }\r\n if (x & type(uint8).max > 0) {\r\n r -= 8;\r\n } else {\r\n x >>= 8;\r\n }\r\n if (x & 0xf > 0) {\r\n r -= 4;\r\n } else {\r\n x >>= 4;\r\n }\r\n if (x & 0x3 > 0) {\r\n r -= 2;\r\n } else {\r\n x >>= 2;\r\n }\r\n if (x & 0x1 > 0) r -= 1;\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/FixedPoint96.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.4.0;\r\n\r\n/// @title FixedPoint96\r\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\r\n/// @dev Used in SqrtPriceMath.sol\r\nlibrary FixedPoint96 {\r\n uint8 internal constant RESOLUTION = 96;\r\n uint256 internal constant Q96 = 0x1000000000000000000000000; // 2^96\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/LiquidityMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Math library for liquidity\r\nlibrary LiquidityMath {\r\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\r\n /// @param x The liquidity before change\r\n /// @param y The delta by which liquidity should be changed\r\n /// @return z The liquidity delta\r\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\r\n if (y < 0) {\r\n require((z = x - uint128(-y)) < x, \"LS\");\r\n } else {\r\n require((z = x + uint128(y)) >= x, \"LA\");\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/LowGasSafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.7.0;\r\n\r\n/// @title Optimized overflow and underflow safe math operations\r\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\r\nlibrary LowGasSafeMath {\r\n /// @notice Returns x + y, reverts if sum overflows uint256\r\n /// @param x The augend\r\n /// @param y The addend\r\n /// @return z The sum of x and y\r\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n require((z = x + y) >= x);\r\n }\r\n\r\n /// @notice Returns x - y, reverts if underflows\r\n /// @param x The minuend\r\n /// @param y The subtrahend\r\n /// @return z The difference of x and y\r\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n require((z = x - y) <= x);\r\n }\r\n\r\n /// @notice Returns x * y, reverts if overflows\r\n /// @param x The multiplicand\r\n /// @param y The multiplier\r\n /// @return z The product of x and y\r\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n require(x == 0 || (z = x * y) / x == y);\r\n }\r\n\r\n /// @notice Returns x + y, reverts if overflows or underflows\r\n /// @param x The augend\r\n /// @param y The addend\r\n /// @return z The sum of x and y\r\n function add(int256 x, int256 y) internal pure returns (int256 z) {\r\n require((z = x + y) >= x == (y >= 0));\r\n }\r\n\r\n /// @notice Returns x - y, reverts if overflows or underflows\r\n /// @param x The minuend\r\n /// @param y The subtrahend\r\n /// @return z The difference of x and y\r\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\r\n require((z = x - y) <= x == (y >= 0));\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Safe casting methods\r\n/// @notice Contains methods for safely casting between types\r\nlibrary SafeCast {\r\n /// @notice Cast a uint256 to a uint160, revert on overflow\r\n /// @param y The uint256 to be downcasted\r\n /// @return z The downcasted integer, now type uint160\r\n function toUint160(uint256 y) internal pure returns (uint160 z) {\r\n require((z = uint160(y)) == y);\r\n }\r\n\r\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\r\n /// @param y The int256 to be downcasted\r\n /// @return z The downcasted integer, now type int128\r\n function toInt128(int256 y) internal pure returns (int128 z) {\r\n require((z = int128(y)) == y);\r\n }\r\n\r\n /// @notice Cast a uint256 to a int256, revert on overflow\r\n /// @param y The uint256 to be casted\r\n /// @return z The casted integer, now type int256\r\n function toInt256(uint256 y) internal pure returns (int256 z) {\r\n require(y < 2**255);\r\n z = int256(y);\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/SqrtPriceMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\nimport \"./LowGasSafeMath.sol\";\r\nimport \"./SafeCast.sol\";\r\n\r\nimport \"../../FullMath.sol\";\r\nimport \"./UnsafeMath.sol\";\r\nimport \"./FixedPoint96.sol\";\r\nimport \"./BitMath.sol\";\r\n\r\n/// @title Functions based on Q64.96 sqrt price and liquidity\r\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\r\nlibrary SqrtPriceMath {\r\n using LowGasSafeMath for uint256;\r\n using SafeCast for uint256;\r\n\r\n /// @notice Gets the next sqrt price given a delta of token0\r\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\r\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\r\n /// price less in order to not send too much output.\r\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\r\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\r\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\r\n /// @param liquidity The amount of usable liquidity\r\n /// @param amount How much of token0 to add or remove from virtual reserves\r\n /// @param add Whether to add or remove the amount of token0\r\n /// @return The price after adding or removing amount, depending on add\r\n function getNextSqrtPriceFromAmount0RoundingUp(\r\n uint160 sqrtPX96,\r\n uint128 liquidity,\r\n uint256 amount,\r\n bool add\r\n ) internal pure returns (uint160) {\r\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\r\n if (amount == 0) return sqrtPX96;\r\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\r\n\r\n bool overflow = false;\r\n if (numerator1 != 0 && sqrtPX96 != 0)\r\n overflow = uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(sqrtPX96)) >= 254;\r\n\r\n if (add) {\r\n uint256 product;\r\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\r\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\r\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\r\n uint256 denominator = numerator1 + product;\r\n if (denominator >= numerator1) {\r\n // always fits in 160 bits\r\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\r\n }\r\n }\r\n\r\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\r\n } else {\r\n uint256 product;\r\n // if the product overflows, we know the denominator underflows\r\n // in addition, we must check that the denominator does not underflow\r\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\r\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\r\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\r\n uint256 denominator = numerator1 - product;\r\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\r\n }\r\n }\r\n\r\n /// @notice Gets the next sqrt price given a delta of token1\r\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\r\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\r\n /// price less in order to not send too much output.\r\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\r\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\r\n /// @param liquidity The amount of usable liquidity\r\n /// @param amount How much of token1 to add, or remove, from virtual reserves\r\n /// @param add Whether to add, or remove, the amount of token1\r\n /// @return The price after adding or removing `amount`\r\n function getNextSqrtPriceFromAmount1RoundingDown(\r\n uint160 sqrtPX96,\r\n uint128 liquidity,\r\n uint256 amount,\r\n bool add\r\n ) internal pure returns (uint160) {\r\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\r\n // in both cases, avoid a mulDiv for most inputs\r\n if (add) {\r\n uint256 quotient = (\r\n amount <= type(uint160).max\r\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\r\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\r\n );\r\n\r\n return uint256(sqrtPX96).add(quotient).toUint160();\r\n } else {\r\n uint256 quotient = (\r\n amount <= type(uint160).max\r\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\r\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\r\n );\r\n\r\n require(sqrtPX96 > quotient);\r\n // always fits 160 bits\r\n return uint160(sqrtPX96 - quotient);\r\n }\r\n }\r\n\r\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\r\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\r\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\r\n /// @param liquidity The amount of usable liquidity\r\n /// @param amountIn How much of token0, or token1, is being swapped in\r\n /// @param zeroForOne Whether the amount in is token0 or token1\r\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\r\n function getNextSqrtPriceFromInput(\r\n uint160 sqrtPX96,\r\n uint128 liquidity,\r\n uint256 amountIn,\r\n bool zeroForOne\r\n ) internal pure returns (uint160 sqrtQX96) {\r\n require(sqrtPX96 > 0);\r\n require(liquidity > 0);\r\n\r\n // round to make sure that we don't pass the target price\r\n return\r\n zeroForOne\r\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\r\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\r\n }\r\n\r\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\r\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\r\n /// @param sqrtPX96 The starting price before accounting for the output amount\r\n /// @param liquidity The amount of usable liquidity\r\n /// @param amountOut How much of token0, or token1, is being swapped out\r\n /// @param zeroForOne Whether the amount out is token0 or token1\r\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\r\n function getNextSqrtPriceFromOutput(\r\n uint160 sqrtPX96,\r\n uint128 liquidity,\r\n uint256 amountOut,\r\n bool zeroForOne\r\n ) internal pure returns (uint160 sqrtQX96) {\r\n require(sqrtPX96 > 0);\r\n require(liquidity > 0);\r\n\r\n // round to make sure that we pass the target price\r\n return\r\n zeroForOne\r\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\r\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\r\n }\r\n\r\n /// @notice Gets the amount0 delta between two prices\r\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\r\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param liquidity The amount of usable liquidity\r\n /// @param roundUp Whether to round the amount up or down\r\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\r\n function getAmount0Delta(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint128 liquidity,\r\n bool roundUp\r\n ) internal pure returns (uint256 amount0) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n\r\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\r\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\r\n require(sqrtRatioAX96 > 0);\r\n\r\n bool overflow = false;\r\n if (numerator1 != 0 && numerator2 != 0)\r\n overflow =\r\n uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(numerator2)) >= 254;\r\n\r\n if (overflow) {\r\n return\r\n roundUp\r\n ? FullMath.mulDivRoundingUp(\r\n FullMath.mulDivRoundingUp(uint256(liquidity), numerator2, sqrtRatioBX96),\r\n FixedPoint96.Q96,\r\n sqrtRatioAX96\r\n )\r\n : FullMath.mulDiv(\r\n FullMath.mulDiv(uint256(liquidity), numerator2, sqrtRatioBX96),\r\n FixedPoint96.Q96,\r\n sqrtRatioAX96\r\n );\r\n } else {\r\n return\r\n roundUp\r\n ? UnsafeMath.divRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), sqrtRatioAX96)\r\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\r\n }\r\n }\r\n\r\n /// @notice Gets the amount1 delta between two prices\r\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param liquidity The amount of usable liquidity\r\n /// @param roundUp Whether to round the amount up, or down\r\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\r\n function getAmount1Delta(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n uint128 liquidity,\r\n bool roundUp\r\n ) internal pure returns (uint256 amount1) {\r\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\r\n\r\n return\r\n roundUp\r\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\r\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\r\n }\r\n\r\n /// @notice Helper that gets signed token0 delta\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\r\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\r\n function getAmount0Delta(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n int128 liquidity\r\n ) internal pure returns (int256 amount0) {\r\n return\r\n liquidity < 0\r\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\r\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\r\n }\r\n\r\n /// @notice Helper that gets signed token1 delta\r\n /// @param sqrtRatioAX96 A sqrt price\r\n /// @param sqrtRatioBX96 Another sqrt price\r\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\r\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\r\n function getAmount1Delta(\r\n uint160 sqrtRatioAX96,\r\n uint160 sqrtRatioBX96,\r\n int128 liquidity\r\n ) internal pure returns (int256 amount1) {\r\n return\r\n liquidity < 0\r\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\r\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/SwapMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\nimport \"../../FullMath.sol\";\r\nimport \"./SqrtPriceMath.sol\";\r\n\r\n/// @title Computes the result of a swap within ticks\r\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\r\nlibrary SwapMath {\r\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\r\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\r\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\r\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\r\n /// @param liquidity The usable liquidity\r\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\r\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\r\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\r\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\r\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\r\n /// @return feeAmount The amount of input that will be taken as a fee\r\n function computeSwapStep(\r\n uint160 sqrtRatioCurrentX96,\r\n uint160 sqrtRatioTargetX96,\r\n uint128 liquidity,\r\n int256 amountRemaining,\r\n uint24 feePips,\r\n bool zeroForOne\r\n )\r\n internal\r\n pure\r\n returns (\r\n uint160 sqrtRatioNextX96,\r\n uint256 amountIn,\r\n uint256 amountOut,\r\n uint256 feeAmount\r\n )\r\n {\r\n require(zeroForOne == sqrtRatioCurrentX96 >= sqrtRatioTargetX96, \"SPD\");\r\n bool exactIn = amountRemaining >= 0;\r\n\r\n if (exactIn) {\r\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\r\n amountIn = zeroForOne\r\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\r\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\r\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\r\n else\r\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\r\n sqrtRatioCurrentX96,\r\n liquidity,\r\n amountRemainingLessFee,\r\n zeroForOne\r\n );\r\n } else {\r\n amountOut = zeroForOne\r\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\r\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\r\n\r\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\r\n else\r\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\r\n sqrtRatioCurrentX96,\r\n liquidity,\r\n uint256(-amountRemaining),\r\n zeroForOne\r\n );\r\n }\r\n\r\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\r\n\r\n // get the input/output amounts\r\n if (zeroForOne) {\r\n amountIn = max && exactIn\r\n ? amountIn\r\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\r\n amountOut = max && !exactIn\r\n ? amountOut\r\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\r\n } else {\r\n amountIn = max && exactIn\r\n ? amountIn\r\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\r\n amountOut = max && !exactIn\r\n ? amountOut\r\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\r\n }\r\n\r\n // cap the output amount to not exceed the remaining output amount\r\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\r\n amountOut = uint256(-amountRemaining);\r\n }\r\n\r\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\r\n // we didn't reach the target, so take the remainder of the maximum input as fee\r\n feeAmount = uint256(amountRemaining) - amountIn;\r\n } else {\r\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/Tick.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\nimport \"./LowGasSafeMath.sol\";\r\nimport \"./SafeCast.sol\";\r\n\r\nimport \"../../TickMath.sol\";\r\nimport \"./LiquidityMath.sol\";\r\n\r\n/// @title Tick\r\n/// @notice Contains functions for managing tick processes and relevant calculations\r\n\r\n/// Ithil to modify it, since it does not have access to storage arrays\r\nlibrary Tick {\r\n using LowGasSafeMath for int256;\r\n using SafeCast for int256;\r\n\r\n // info stored for each initialized individual tick\r\n struct Info {\r\n // the total position liquidity that references this tick\r\n uint128 liquidityGross;\r\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\r\n int128 liquidityNet;\r\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\r\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\r\n uint256 feeGrowthOutside0X128;\r\n uint256 feeGrowthOutside1X128;\r\n // the cumulative tick value on the other side of the tick\r\n int56 tickCumulativeOutside;\r\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\r\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\r\n uint160 secondsPerLiquidityOutsideX128;\r\n // the seconds spent on the other side of the tick (relative to the current tick)\r\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\r\n uint32 secondsOutside;\r\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\r\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\r\n bool initialized;\r\n }\r\n\r\n /// @notice Derives max liquidity per tick from given tick spacing\r\n /// @dev Executed within the pool constructor\r\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\r\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\r\n /// @return The max liquidity per tick\r\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\r\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\r\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\r\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\r\n return type(uint128).max / numTicks;\r\n }\r\n\r\n /// @notice Retrieves fee growth data\r\n /// Ithil: only use it with lower = self[tickLower] and upper = self[tickUpper]\r\n /// @param lower The info of the lower tick boundary of the position\r\n /// @param upper The info of the upper tick boundary of the position\r\n /// @param tickLower The lower tick boundary of the position\r\n /// @param tickUpper The upper tick boundary of the position\r\n /// @param tickCurrent The current tick\r\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\r\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\r\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\r\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\r\n function getFeeGrowthInside(\r\n Tick.Info memory lower,\r\n Tick.Info memory upper,\r\n int24 tickLower,\r\n int24 tickUpper,\r\n int24 tickCurrent,\r\n uint256 feeGrowthGlobal0X128,\r\n uint256 feeGrowthGlobal1X128\r\n ) internal pure returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\r\n // calculate fee growth below\r\n uint256 feeGrowthBelow0X128;\r\n uint256 feeGrowthBelow1X128;\r\n if (tickCurrent >= tickLower) {\r\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\r\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\r\n } else {\r\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\r\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\r\n }\r\n\r\n // calculate fee growth above\r\n uint256 feeGrowthAbove0X128;\r\n uint256 feeGrowthAbove1X128;\r\n if (tickCurrent < tickUpper) {\r\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\r\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\r\n } else {\r\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\r\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\r\n }\r\n\r\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\r\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\r\n }\r\n\r\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\r\n /// Ithil: always use with info = self[tick]\r\n /// @param info The info tick that will be updated\r\n /// @param tick The tick that will be updated\r\n /// @param tickCurrent The current tick\r\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\r\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\r\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\r\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\r\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\r\n /// @param time The current block timestamp cast to a uint32\r\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\r\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\r\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\r\n function update(\r\n Tick.Info memory info,\r\n int24 tick,\r\n int24 tickCurrent,\r\n int128 liquidityDelta,\r\n uint256 feeGrowthGlobal0X128,\r\n uint256 feeGrowthGlobal1X128,\r\n uint160 secondsPerLiquidityCumulativeX128,\r\n int56 tickCumulative,\r\n uint32 time,\r\n bool upper,\r\n uint128 maxLiquidity\r\n ) internal pure returns (bool flipped) {\r\n uint128 liquidityGrossBefore = info.liquidityGross;\r\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\r\n\r\n require(liquidityGrossAfter <= maxLiquidity, \"LO\");\r\n\r\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\r\n\r\n if (liquidityGrossBefore == 0) {\r\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\r\n if (tick <= tickCurrent) {\r\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\r\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\r\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\r\n info.tickCumulativeOutside = tickCumulative;\r\n info.secondsOutside = time;\r\n }\r\n info.initialized = true;\r\n }\r\n\r\n info.liquidityGross = liquidityGrossAfter;\r\n\r\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\r\n info.liquidityNet = upper\r\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\r\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\r\n }\r\n\r\n /// @notice Transitions to next tick as needed by price movement\r\n /// @param info The result of the mapping containing all tick information for initialized ticks\r\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\r\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\r\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\r\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\r\n /// @param time The current block.timestamp\r\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\r\n function cross(\r\n Tick.Info memory info,\r\n uint256 feeGrowthGlobal0X128,\r\n uint256 feeGrowthGlobal1X128,\r\n uint160 secondsPerLiquidityCumulativeX128,\r\n int56 tickCumulative,\r\n uint32 time\r\n ) internal pure returns (int128 liquidityNet) {\r\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\r\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\r\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\r\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\r\n info.secondsOutside = time - info.secondsOutside;\r\n liquidityNet = info.liquidityNet;\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/TickBitmap.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\nimport \"./BitMath.sol\";\r\n\r\n/// @title Packed tick initialized state library\r\n/// @notice Stores a packed mapping of tick index to its initialized state\r\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\r\nlibrary TickBitmap {\r\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\r\n /// @param tick The tick for which to compute the position\r\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\r\n /// @return bitPos The bit position in the word where the flag is stored\r\n /// @dev simply divides @param tick by 256 with remainder: tick = wordPos * 256 + bitPos\r\n function position(int24 tick) internal pure returns (int16 wordPos, uint8 bitPos) {\r\n wordPos = int16(tick >> 8);\r\n bitPos = uint8(int8(tick % 256));\r\n }\r\n\r\n /// Written by Ithil\r\n function computeWordPos(\r\n int24 tick,\r\n int24 tickSpacing,\r\n bool lte\r\n ) internal pure returns (int16 wordPos) {\r\n int24 compressed = tick / tickSpacing;\r\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\r\n\r\n (wordPos, ) = lte ? position(compressed) : position(compressed + 1);\r\n }\r\n\r\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\r\n /// @param selfResult The result of the mapping in which to flip the tick (Ithil modified)\r\n /// @param tick The tick to flip\r\n /// @param tickSpacing The spacing between usable ticks\r\n function flipTick(\r\n uint256 selfResult,\r\n int24 tick,\r\n int24 tickSpacing\r\n ) internal pure {\r\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\r\n (, uint8 bitPos) = position(tick / tickSpacing);\r\n uint256 mask = 1 << bitPos;\r\n selfResult ^= mask;\r\n }\r\n\r\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\r\n /// to the left (less than or equal to) or right (greater than) of the given tick\r\n /// @param selfResult The result of the mapping in which to compute the next initialized tick (Ithil modified)\r\n /// @param tick The starting tick\r\n /// @param tickSpacing The spacing between usable ticks\r\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\r\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\r\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\r\n function nextInitializedTickWithinOneWord(\r\n uint256 selfResult,\r\n int24 tick,\r\n int24 tickSpacing,\r\n bool lte\r\n ) internal pure returns (int24 next, bool initialized) {\r\n int24 compressed = tick / tickSpacing;\r\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\r\n\r\n if (lte) {\r\n (, uint8 bitPos) = position(compressed);\r\n // all the 1s at or to the right of the current bitPos\r\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\r\n uint256 masked = selfResult & mask;\r\n\r\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\r\n initialized = masked != 0;\r\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\r\n next = initialized\r\n ? (compressed - int24(uint24(bitPos) - uint24(BitMath.mostSignificantBit(masked)))) * tickSpacing\r\n : (compressed - int24(uint24(bitPos))) * tickSpacing;\r\n } else {\r\n // start from the word of the next tick, since the current tick state doesn't matter\r\n (, uint8 bitPos) = position(compressed + 1);\r\n // all the 1s at or to the left of the bitPos\r\n uint256 mask = ~((1 << bitPos) - 1);\r\n uint256 masked = selfResult & mask;\r\n\r\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\r\n initialized = masked != 0;\r\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\r\n next = initialized\r\n ? (compressed + 1 + int24(uint24(BitMath.leastSignificantBit(masked) - bitPos))) * tickSpacing\r\n : (compressed + 1 + int24(uint24(type(uint8).max - bitPos))) * tickSpacing;\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/libraries/UnsafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Math functions that do not check inputs or outputs\r\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\r\nlibrary UnsafeMath {\r\n /// @notice Returns ceil(x / y)\r\n /// @dev division by 0 has unspecified behavior, and must be checked externally\r\n /// @param x The dividend\r\n /// @param y The divisor\r\n /// @return z The quotient, ceil(x / y)\r\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n assembly {\r\n z := add(div(x, y), gt(mod(x, y), 0))\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0 <0.9.0;\r\npragma experimental ABIEncoderV2;\r\n\r\nimport \"../IUniswapV3Factory.sol\";\r\nimport \"./interfaces/IQuoter.sol\";\r\nimport \"./UniswapV3Quoter.sol\";\r\n\r\ncontract Quoter is IQuoter, UniswapV3Quoter {\r\n IUniswapV3Factory internal uniV3Factory; // TODO should it be immutable?\r\n\r\n constructor(address _uniV3Factory) {\r\n uniV3Factory = IUniswapV3Factory(_uniV3Factory);\r\n }\r\n\r\n // This should be equal to quoteExactInputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\r\n // todo: add price limit\r\n function estimateMaxSwapUniswapV3(\r\n address _fromToken,\r\n address _toToken,\r\n uint256 _amount,\r\n uint24 _poolFee\r\n ) public view override returns (uint256) {\r\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\r\n\r\n return _estimateOutputSingle(_toToken, _fromToken, _amount, pool);\r\n }\r\n\r\n // This should be equal to quoteExactOutputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\r\n // todo: add price limit\r\n function estimateMinSwapUniswapV3(\r\n address _fromToken,\r\n address _toToken,\r\n uint256 _amount,\r\n uint24 _poolFee\r\n ) public view override returns (uint256) {\r\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\r\n\r\n return _estimateInputSingle(_fromToken, _toToken, _amount, pool);\r\n }\r\n\r\n // todo: add price limit\r\n function _estimateOutputSingle(\r\n address _fromToken,\r\n address _toToken,\r\n uint256 _amount,\r\n address _pool\r\n ) internal view returns (uint256 amountOut) {\r\n bool zeroForOne = _fromToken > _toToken;\r\n // todo: price limit?\r\n (int256 amount0, int256 amount1) = quoteSwap(\r\n _pool,\r\n int256(_amount),\r\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\r\n zeroForOne\r\n );\r\n if (zeroForOne) amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\r\n else amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\r\n }\r\n\r\n // todo: add price limit\r\n function _estimateInputSingle(\r\n address _fromToken,\r\n address _toToken,\r\n uint256 _amount,\r\n address _pool\r\n ) internal view returns (uint256 amountOut) {\r\n bool zeroForOne = _fromToken < _toToken;\r\n // todo: price limit?\r\n (int256 amount0, int256 amount1) = quoteSwap(\r\n _pool,\r\n -int256(_amount),\r\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\r\n zeroForOne\r\n );\r\n if (zeroForOne) amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\r\n else amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\r\n }\r\n\r\n function doesPoolExist(address _token0, address _token1) external view returns (bool) {\r\n // try 0.05%\r\n address pool = uniV3Factory.getPool(_token0, _token1, 500);\r\n if (pool != address(0)) return true;\r\n\r\n // try 0.3%\r\n pool = uniV3Factory.getPool(_token0, _token1, 3000);\r\n if (pool != address(0)) return true;\r\n\r\n // try 1%\r\n pool = uniV3Factory.getPool(_token0, _token1, 10000);\r\n if (pool != address(0)) return true;\r\n else return false;\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/UniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.7.6;\r\n\r\nimport \"./libraries/LowGasSafeMath.sol\";\r\nimport \"./libraries/SafeCast.sol\";\r\nimport \"./libraries/Tick.sol\";\r\nimport \"./libraries/TickBitmap.sol\";\r\n\r\nimport \"../FullMath.sol\";\r\nimport \"../TickMath.sol\";\r\nimport \"./libraries/LiquidityMath.sol\";\r\nimport \"./libraries/SqrtPriceMath.sol\";\r\nimport \"./libraries/SwapMath.sol\";\r\n\r\nimport \"./interfaces/IUniswapV3Quoter.sol\";\r\nimport \"../IUniswapV3Pool.sol\";\r\nimport \"../IUniswapV3PoolImmutables.sol\";\r\n\r\ncontract UniswapV3Quoter {\r\n using LowGasSafeMath for int256;\r\n using SafeCast for uint256;\r\n using Tick for mapping(int24 => Tick.Info);\r\n\r\n struct PoolState {\r\n // the current price\r\n uint160 sqrtPriceX96;\r\n // the current tick\r\n int24 tick;\r\n // the tick spacing\r\n int24 tickSpacing;\r\n // the pool's fee\r\n uint24 fee;\r\n // the pool's liquidity\r\n uint128 liquidity;\r\n // whether the pool is locked\r\n bool unlocked;\r\n }\r\n\r\n // accumulated protocol fees in token0/token1 units\r\n struct ProtocolFees {\r\n uint128 token0;\r\n uint128 token1;\r\n }\r\n\r\n // the top level state of the swap, the results of which are recorded in storage at the end\r\n struct SwapState {\r\n // the amount remaining to be swapped in/out of the input/output asset\r\n int256 amountSpecifiedRemaining;\r\n // the amount already swapped out/in of the output/input asset\r\n int256 amountCalculated;\r\n // current sqrt(price)\r\n uint160 sqrtPriceX96;\r\n // the tick associated with the current price\r\n int24 tick;\r\n // the current liquidity in range\r\n uint128 liquidity;\r\n }\r\n\r\n struct StepComputations {\r\n // the price at the beginning of the step\r\n uint160 sqrtPriceStartX96;\r\n // the next tick to swap to from the current tick in the swap direction\r\n int24 tickNext;\r\n // whether tickNext is initialized or not\r\n bool initialized;\r\n // sqrt(price) for the next tick (1/0)\r\n uint160 sqrtPriceNextX96;\r\n // how much is being swapped in in this step\r\n uint256 amountIn;\r\n // how much is being swapped out\r\n uint256 amountOut;\r\n // how much fee is being paid in\r\n uint256 feeAmount;\r\n }\r\n\r\n struct InitialState {\r\n address poolAddress;\r\n PoolState poolState;\r\n uint256 feeGrowthGlobal0X128;\r\n uint256 feeGrowthGlobal1X128;\r\n }\r\n\r\n struct NextTickPassage {\r\n int24 tick;\r\n int24 tickSpacing;\r\n }\r\n\r\n function fetchState(address _pool) internal view returns (PoolState memory poolState) {\r\n IUniswapV3Pool pool = IUniswapV3Pool(_pool);\r\n (uint160 sqrtPriceX96, int24 tick, , , , , bool unlocked) = pool.slot0(); // external call\r\n uint128 liquidity = pool.liquidity(); // external call\r\n int24 tickSpacing = IUniswapV3PoolImmutables(_pool).tickSpacing(); // external call\r\n uint24 fee = IUniswapV3PoolImmutables(_pool).fee(); // external call\r\n poolState = PoolState(sqrtPriceX96, tick, tickSpacing, fee, liquidity, unlocked);\r\n }\r\n\r\n function setInitialState(\r\n PoolState memory initialPoolState,\r\n int256 amountSpecified,\r\n uint160 sqrtPriceLimitX96,\r\n bool zeroForOne\r\n )\r\n internal\r\n pure\r\n returns (\r\n SwapState memory state,\r\n uint128 liquidity,\r\n uint160 sqrtPriceX96\r\n )\r\n {\r\n liquidity = initialPoolState.liquidity;\r\n\r\n sqrtPriceX96 = initialPoolState.sqrtPriceX96;\r\n\r\n require(\r\n zeroForOne\r\n ? sqrtPriceLimitX96 < initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\r\n : sqrtPriceLimitX96 > initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\r\n \"SPL\"\r\n );\r\n\r\n state = SwapState({\r\n amountSpecifiedRemaining: amountSpecified,\r\n amountCalculated: 0,\r\n sqrtPriceX96: initialPoolState.sqrtPriceX96,\r\n tick: initialPoolState.tick,\r\n liquidity: 0 // to be modified after initialization\r\n });\r\n }\r\n\r\n function getNextTickAndPrice(\r\n int24 tickSpacing,\r\n int24 currentTick,\r\n IUniswapV3Pool pool,\r\n bool zeroForOne\r\n )\r\n internal\r\n view\r\n returns (\r\n int24 tickNext,\r\n bool initialized,\r\n uint160 sqrtPriceNextX96\r\n )\r\n {\r\n int24 compressed = currentTick / tickSpacing;\r\n if (!zeroForOne) compressed++;\r\n if (currentTick < 0 && currentTick % tickSpacing != 0) compressed--; // round towards negative infinity\r\n\r\n uint256 selfResult = pool.tickBitmap(int16(compressed >> 8)); // external call\r\n\r\n (tickNext, initialized) = TickBitmap.nextInitializedTickWithinOneWord(\r\n selfResult,\r\n currentTick,\r\n tickSpacing,\r\n zeroForOne\r\n );\r\n\r\n if (tickNext < TickMath.MIN_TICK) {\r\n tickNext = TickMath.MIN_TICK;\r\n } else if (tickNext > TickMath.MAX_TICK) {\r\n tickNext = TickMath.MAX_TICK;\r\n }\r\n sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(tickNext);\r\n }\r\n\r\n function processSwapWithinTick(\r\n IUniswapV3Pool pool,\r\n PoolState memory initialPoolState,\r\n SwapState memory state,\r\n uint160 firstSqrtPriceX96,\r\n uint128 firstLiquidity,\r\n uint160 sqrtPriceLimitX96,\r\n bool zeroForOne,\r\n bool exactAmount\r\n )\r\n internal\r\n view\r\n returns (\r\n uint160 sqrtPriceNextX96,\r\n uint160 finalSqrtPriceX96,\r\n uint128 finalLiquidity\r\n )\r\n {\r\n StepComputations memory step;\r\n\r\n step.sqrtPriceStartX96 = firstSqrtPriceX96;\r\n\r\n (step.tickNext, step.initialized, sqrtPriceNextX96) = getNextTickAndPrice(\r\n initialPoolState.tickSpacing,\r\n state.tick,\r\n pool,\r\n zeroForOne\r\n );\r\n\r\n (finalSqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\r\n firstSqrtPriceX96,\r\n (zeroForOne ? sqrtPriceNextX96 < sqrtPriceLimitX96 : sqrtPriceNextX96 > sqrtPriceLimitX96)\r\n ? sqrtPriceLimitX96\r\n : sqrtPriceNextX96,\r\n firstLiquidity,\r\n state.amountSpecifiedRemaining,\r\n initialPoolState.fee,\r\n zeroForOne\r\n );\r\n\r\n if (exactAmount) {\r\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\r\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\r\n } else {\r\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\r\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\r\n }\r\n\r\n if (finalSqrtPriceX96 == sqrtPriceNextX96) {\r\n if (step.initialized) {\r\n (, int128 liquidityNet, , , , , , ) = pool.ticks(step.tickNext);\r\n if (zeroForOne) liquidityNet = -liquidityNet;\r\n finalLiquidity = LiquidityMath.addDelta(firstLiquidity, liquidityNet);\r\n }\r\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\r\n } else if (finalSqrtPriceX96 != step.sqrtPriceStartX96) {\r\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\r\n state.tick = TickMath.getTickAtSqrtRatio(finalSqrtPriceX96);\r\n }\r\n }\r\n\r\n function returnedAmount(\r\n SwapState memory state,\r\n int256 amountSpecified,\r\n bool zeroForOne\r\n ) internal pure returns (int256 amount0, int256 amount1) {\r\n if (amountSpecified > 0) {\r\n (amount0, amount1) = zeroForOne\r\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\r\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\r\n } else {\r\n (amount0, amount1) = zeroForOne\r\n ? (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining)\r\n : (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated);\r\n }\r\n }\r\n\r\n function quoteSwap(\r\n address poolAddress,\r\n int256 amountSpecified,\r\n uint160 sqrtPriceLimitX96,\r\n bool zeroForOne\r\n ) internal view returns (int256 amount0, int256 amount1) {\r\n bool exactAmount = amountSpecified > 0;\r\n\r\n PoolState memory initialPoolState = fetchState(poolAddress);\r\n uint160 sqrtPriceNextX96;\r\n\r\n (SwapState memory state, uint128 liquidity, uint160 sqrtPriceX96) = setInitialState(\r\n initialPoolState,\r\n amountSpecified,\r\n sqrtPriceLimitX96,\r\n zeroForOne\r\n );\r\n\r\n while (state.amountSpecifiedRemaining != 0 && sqrtPriceX96 != sqrtPriceLimitX96)\r\n (sqrtPriceNextX96, sqrtPriceX96, liquidity) = processSwapWithinTick(\r\n IUniswapV3Pool(poolAddress),\r\n initialPoolState,\r\n state,\r\n sqrtPriceX96,\r\n liquidity,\r\n sqrtPriceLimitX96,\r\n zeroForOne,\r\n exactAmount\r\n );\r\n\r\n (amount0, amount1) = returnedAmount(state, amountSpecified, zeroForOne);\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/TickMath.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\n\r\n// From Uniswap3 Core\r\n\r\n// Updated to Solidity 0.8 by Midas Capital:\r\n// * Cast MAX_TICK to int256 before casting to uint\r\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/// @title Math library for computing sqrt prices from ticks and vice versa\r\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\r\n/// prices between 2**-128 and 2**128\r\nlibrary TickMath {\r\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\r\n int24 internal constant MIN_TICK = -887272;\r\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\r\n int24 internal constant MAX_TICK = -MIN_TICK;\r\n\r\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\r\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\r\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\r\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\r\n\r\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\r\n /// @dev Throws if |tick| > max tick\r\n /// @param tick The input tick for the above formula\r\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\r\n /// at the given tick\r\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\r\n unchecked {\r\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\r\n require(absTick <= uint256(int256(MAX_TICK)), \"T\");\r\n\r\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\r\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\r\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\r\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\r\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\r\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\r\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\r\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\r\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\r\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\r\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\r\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\r\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\r\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\r\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\r\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\r\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\r\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\r\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\r\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\r\n\r\n if (tick > 0) ratio = type(uint256).max / ratio;\r\n\r\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\r\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\r\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\r\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\r\n }\r\n }\r\n\r\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\r\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\r\n /// ever return.\r\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\r\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\r\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\r\n unchecked {\r\n // second inequality must be < because the price can never reach the price at the max tick\r\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, \"R\");\r\n uint256 ratio = uint256(sqrtPriceX96) << 32;\r\n\r\n uint256 r = ratio;\r\n uint256 msb = 0;\r\n\r\n assembly {\r\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := shl(5, gt(r, 0xFFFFFFFF))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := shl(4, gt(r, 0xFFFF))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := shl(3, gt(r, 0xFF))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := shl(2, gt(r, 0xF))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := shl(1, gt(r, 0x3))\r\n msb := or(msb, f)\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n let f := gt(r, 0x1)\r\n msb := or(msb, f)\r\n }\r\n\r\n if (msb >= 128) r = ratio >> (msb - 127);\r\n else r = ratio << (127 - msb);\r\n\r\n int256 log_2 = (int256(msb) - 128) << 64;\r\n\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(63, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(62, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(61, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(60, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(59, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(58, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(57, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(56, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(55, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(54, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(53, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(52, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(51, f))\r\n r := shr(f, r)\r\n }\r\n assembly {\r\n r := shr(127, mul(r, r))\r\n let f := shr(128, r)\r\n log_2 := or(log_2, shl(50, f))\r\n }\r\n\r\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\r\n\r\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\r\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\r\n\r\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/uniswap/UniswapV2Library.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IUniswapV2Pair.sol\";\r\nimport \"./IUniswapV2Factory.sol\";\r\n\r\nlibrary UniswapV2Library {\r\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\r\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\r\n require(tokenA != tokenB, \"UniswapV2Library: IDENTICAL_ADDRESSES\");\r\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\r\n require(token0 != address(0), \"UniswapV2Library: ZERO_ADDRESS\");\r\n }\r\n\r\n function pairFor(\r\n address factory,\r\n address tokenA,\r\n address tokenB\r\n ) internal view returns (address pair) {\r\n return IUniswapV2Factory(factory).getPair(tokenA, tokenB);\r\n }\r\n\r\n // fetches and sorts the reserves for a pair\r\n function getReserves(\r\n address factory,\r\n address tokenA,\r\n address tokenB\r\n ) internal view returns (uint256 reserveA, uint256 reserveB) {\r\n (address token0, ) = sortTokens(tokenA, tokenB);\r\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\r\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\r\n }\r\n\r\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\r\n function quote(\r\n uint256 amountA,\r\n uint256 reserveA,\r\n uint256 reserveB\r\n ) internal pure returns (uint256 amountB) {\r\n require(amountA > 0, \"UniswapV2Library: INSUFFICIENT_AMOUNT\");\r\n require(reserveA > 0 && reserveB > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\r\n amountB = (amountA * reserveB) / reserveA;\r\n }\r\n\r\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\r\n function getAmountOut(\r\n uint256 amountIn,\r\n uint256 reserveIn,\r\n uint256 reserveOut,\r\n uint8 flashSwapFee\r\n ) internal pure returns (uint256 amountOut) {\r\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\r\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\r\n uint256 amountInWithFee = amountIn * (10000 - flashSwapFee);\r\n uint256 numerator = amountInWithFee * reserveOut;\r\n uint256 denominator = reserveIn * 10000 + amountInWithFee;\r\n amountOut = numerator / denominator;\r\n }\r\n\r\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\r\n function getAmountIn(\r\n uint256 amountOut,\r\n uint256 reserveIn,\r\n uint256 reserveOut,\r\n uint8 flashSwapFee\r\n ) internal pure returns (uint256 amountIn) {\r\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\r\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\r\n uint256 numerator = reserveIn * amountOut * 10000;\r\n uint256 denominator = (reserveOut - amountOut) * (10000 - flashSwapFee);\r\n amountIn = numerator / denominator + 1;\r\n }\r\n\r\n // performs chained getAmountOut calculations on any number of pairs\r\n function getAmountsOut(\r\n address factory,\r\n uint256 amountIn,\r\n address[] memory path,\r\n uint8 flashSwapFee\r\n ) internal view returns (uint256[] memory amounts) {\r\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\r\n amounts = new uint256[](path.length);\r\n amounts[0] = amountIn;\r\n for (uint256 i; i < path.length - 1; i++) {\r\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i], path[i + 1]);\r\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut, flashSwapFee);\r\n }\r\n }\r\n\r\n // performs chained getAmountIn calculations on any number of pairs\r\n function getAmountsIn(\r\n address factory,\r\n uint256 amountOut,\r\n address[] memory path,\r\n uint8 flashSwapFee\r\n ) internal view returns (uint256[] memory amounts) {\r\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\r\n amounts = new uint256[](path.length);\r\n amounts[amounts.length - 1] = amountOut;\r\n for (uint256 i = path.length - 1; i > 0; i--) {\r\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i - 1], path[i]);\r\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut, flashSwapFee);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/external/velodrome/IVelodromeRouter.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ninterface IRouter_Velodrome {\r\n struct Route {\r\n address from;\r\n address to;\r\n bool stable;\r\n }\r\n\r\n error ETHTransferFailed();\r\n error Expired();\r\n error InsufficientAmount();\r\n error InsufficientAmountA();\r\n error InsufficientAmountB();\r\n error InsufficientAmountADesired();\r\n error InsufficientAmountBDesired();\r\n error InsufficientLiquidity();\r\n error InsufficientOutputAmount();\r\n error InvalidPath();\r\n error OnlyWETH();\r\n error SameAddresses();\r\n error ZeroAddress();\r\n\r\n /// @notice Address of Velodrome v2 pool factory\r\n function factory() external view returns (address);\r\n\r\n /// @notice Address of Velodrome v2 pool implementation\r\n function poolImplementation() external view returns (address);\r\n\r\n /// @notice Sort two tokens by which address value is less than the other\r\n /// @param tokenA Address of token to sort\r\n /// @param tokenB Address of token to sort\r\n /// @return token0 Lower address value between tokenA and tokenB\r\n /// @return token1 Higher address value between tokenA and tokenB\r\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\r\n\r\n /// @notice Calculate the address of a pool by its' factory.\r\n /// @dev Returns a randomly generated address for a nonexistent pool\r\n /// @param tokenA Address of token to query\r\n /// @param tokenB Address of token to query\r\n /// @param stable True if pool is stable, false if volatile\r\n function poolFor(address tokenA, address tokenB, bool stable) external view returns (address pool);\r\n\r\n /// @notice Fetch and sort the reserves for a pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @return reserveA Amount of reserves of the sorted token A\r\n /// @return reserveB Amount of reserves of the sorted token B\r\n function getReserves(\r\n address tokenA,\r\n address tokenB,\r\n bool stable\r\n ) external view returns (uint256 reserveA, uint256 reserveB);\r\n\r\n /// @notice Perform chained getAmountOut calculations on any number of pools\r\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\r\n\r\n // **** ADD LIQUIDITY ****\r\n\r\n /// @notice Quote the amount deposited into a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param amountADesired Amount of tokenA desired to deposit\r\n /// @param amountBDesired Amount of tokenB desired to deposit\r\n /// @return amountA Amount of tokenA to actually deposit\r\n /// @return amountB Amount of tokenB to actually deposit\r\n /// @return liquidity Amount of liquidity token returned from deposit\r\n function quoteAddLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n uint256 amountADesired,\r\n uint256 amountBDesired\r\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\r\n\r\n /// @notice Quote the amount of liquidity removed from a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @return amountA Amount of tokenA received\r\n /// @return amountB Amount of tokenB received\r\n function quoteRemoveLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n uint256 liquidity\r\n ) external view returns (uint256 amountA, uint256 amountB);\r\n\r\n /// @notice Add liquidity of two tokens to a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param amountADesired Amount of tokenA desired to deposit\r\n /// @param amountBDesired Amount of tokenB desired to deposit\r\n /// @param amountAMin Minimum amount of tokenA to deposit\r\n /// @param amountBMin Minimum amount of tokenB to deposit\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to receive liquidity\r\n /// @return amountA Amount of tokenA to actually deposit\r\n /// @return amountB Amount of tokenB to actually deposit\r\n /// @return liquidity Amount of liquidity token returned from deposit\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n uint256 amountADesired,\r\n uint256 amountBDesired,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\r\n\r\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\r\n /// @param token .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param amountTokenDesired Amount of token desired to deposit\r\n /// @param amountTokenMin Minimum amount of token to deposit\r\n /// @param amountETHMin Minimum amount of ETH to deposit\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to add liquidity\r\n /// @return amountToken Amount of token to actually deposit\r\n /// @return amountETH Amount of tokenETH to actually deposit\r\n /// @return liquidity Amount of liquidity token returned from deposit\r\n function addLiquidityETH(\r\n address token,\r\n bool stable,\r\n uint256 amountTokenDesired,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\r\n\r\n // **** REMOVE LIQUIDITY ****\r\n\r\n /// @notice Remove liquidity of two tokens from a Pool\r\n /// @param tokenA .\r\n /// @param tokenB .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @param amountAMin Minimum amount of tokenA to receive\r\n /// @param amountBMin Minimum amount of tokenB to receive\r\n /// @param to Recipient of tokens received\r\n /// @param deadline Deadline to remove liquidity\r\n /// @return amountA Amount of tokenA received\r\n /// @return amountB Amount of tokenB received\r\n function removeLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n bool stable,\r\n uint256 liquidity,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountA, uint256 amountB);\r\n\r\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\r\n /// @param token .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @param amountTokenMin Minimum amount of token to receive\r\n /// @param amountETHMin Minimum amount of ETH to receive\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to receive liquidity\r\n /// @return amountToken Amount of token received\r\n /// @return amountETH Amount of ETH received\r\n function removeLiquidityETH(\r\n address token,\r\n bool stable,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountToken, uint256 amountETH);\r\n\r\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\r\n /// @param token .\r\n /// @param stable True if pool is stable, false if volatile\r\n /// @param liquidity Amount of liquidity to remove\r\n /// @param amountTokenMin Minimum amount of token to receive\r\n /// @param amountETHMin Minimum amount of ETH to receive\r\n /// @param to Recipient of liquidity token\r\n /// @param deadline Deadline to receive liquidity\r\n /// @return amountETH Amount of ETH received\r\n function removeLiquidityETHSupportingFeeOnTransferTokens(\r\n address token,\r\n bool stable,\r\n uint256 liquidity,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountETH);\r\n\r\n /// @notice Swap one token for another\r\n /// @param amountIn Amount of token in\r\n /// @param amountOutMin Minimum amount of desired token received\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n /// @return amounts Array of amounts returned per route\r\n function swapExactTokensForTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n\r\n /// @notice Swap ETH for a token\r\n /// @param amountOutMin Minimum amount of desired token received\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n /// @return amounts Array of amounts returned per route\r\n function swapExactETHForTokens(\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external payable returns (uint256[] memory amounts);\r\n\r\n /// @notice Swap a token for WETH (returned as ETH)\r\n /// @param amountIn Amount of token in\r\n /// @param amountOutMin Minimum amount of desired ETH\r\n /// @param routes Array of trade routes used in the swap\r\n /// @param to Recipient of the tokens received\r\n /// @param deadline Deadline to receive tokens\r\n /// @return amounts Array of amounts returned per route\r\n function swapExactTokensForETH(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n Route[] calldata routes,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256[] memory amounts);\r\n}\r\n" + }, + "contracts/FeeDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\nimport { CErc20Delegator } from \"./compound/CErc20Delegator.sol\";\r\nimport { CErc20PluginDelegate } from \"./compound/CErc20PluginDelegate.sol\";\r\nimport { SafeOwnableUpgradeable } from \"./ionic/SafeOwnableUpgradeable.sol\";\r\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\r\nimport { DiamondExtension, DiamondBase } from \"./ionic/DiamondExtension.sol\";\r\nimport { AuthoritiesRegistry } from \"./ionic/AuthoritiesRegistry.sol\";\r\n\r\ncontract FeeDistributorStorage {\r\n struct CDelegateUpgradeData {\r\n address implementation;\r\n bytes becomeImplementationData;\r\n }\r\n\r\n /**\r\n * @notice Maps Unitroller (Comptroller proxy) addresses to the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\r\n * @dev A value of 0 means unset whereas a negative value means 0.\r\n */\r\n mapping(address => int256) public customInterestFeeRates;\r\n\r\n /**\r\n * @dev Latest Comptroller implementation for each existing implementation.\r\n */\r\n mapping(address => address) internal _latestComptrollerImplementation;\r\n\r\n /**\r\n * @dev Latest CErc20Delegate implementation for each existing implementation.\r\n */\r\n mapping(uint8 => CDelegateUpgradeData) internal _latestCErc20Delegate;\r\n\r\n /**\r\n * @dev Latest Plugin implementation for each existing implementation.\r\n */\r\n mapping(address => address) internal _latestPluginImplementation;\r\n\r\n mapping(address => DiamondExtension[]) public comptrollerExtensions;\r\n\r\n mapping(address => DiamondExtension[]) public cErc20DelegateExtensions;\r\n\r\n AuthoritiesRegistry public authoritiesRegistry;\r\n\r\n /**\r\n * @dev used as salt for the creation of new markets\r\n */\r\n uint256 public marketsCounter;\r\n\r\n /**\r\n * @dev Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\r\n */\r\n uint256 public minBorrowEth;\r\n\r\n /**\r\n * @dev Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\r\n * No longer used as of `Rari-Capital/compound-protocol` version `fuse-v1.1.0`.\r\n */\r\n uint256 public maxUtilizationRate;\r\n\r\n /**\r\n * @notice The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\r\n */\r\n uint256 public defaultInterestFeeRate;\r\n}\r\n\r\n/**\r\n * @title FeeDistributor\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice FeeDistributor controls and receives protocol fees from Ionic pools and relays admin actions to Ionic pools.\r\n */\r\ncontract FeeDistributor is SafeOwnableUpgradeable, FeeDistributorStorage {\r\n using AddressUpgradeable for address;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /**\r\n * @dev Initializer that sets initial values of state variables.\r\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\r\n */\r\n function initialize(uint256 _defaultInterestFeeRate) public initializer {\r\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\r\n __SafeOwnable_init(msg.sender);\r\n defaultInterestFeeRate = _defaultInterestFeeRate;\r\n maxUtilizationRate = type(uint256).max;\r\n }\r\n\r\n function reinitialize(AuthoritiesRegistry _ar) public onlyOwnerOrAdmin {\r\n authoritiesRegistry = _ar;\r\n }\r\n\r\n /**\r\n * @dev Sets the default proportion of Ionic pool interest taken as a protocol fee.\r\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\r\n */\r\n function _setDefaultInterestFeeRate(uint256 _defaultInterestFeeRate) external onlyOwner {\r\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\r\n defaultInterestFeeRate = _defaultInterestFeeRate;\r\n }\r\n\r\n /**\r\n * @dev Withdraws accrued fees on interest.\r\n * @param erc20Contract The ERC20 token address to withdraw. Set to the zero address to withdraw ETH.\r\n */\r\n function _withdrawAssets(address erc20Contract) external {\r\n if (erc20Contract == address(0)) {\r\n uint256 balance = address(this).balance;\r\n require(balance > 0, \"No balance available to withdraw.\");\r\n (bool success, ) = owner().call{ value: balance }(\"\");\r\n require(success, \"Failed to transfer ETH balance to msg.sender.\");\r\n } else {\r\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\r\n uint256 balance = token.balanceOf(address(this));\r\n require(balance > 0, \"No token balance available to withdraw.\");\r\n token.safeTransfer(owner(), balance);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\r\n * @param _minBorrowEth Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\r\n * @param _maxUtilizationRate Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\r\n */\r\n function _setPoolLimits(uint256 _minBorrowEth, uint256 _maxUtilizationRate) external onlyOwner {\r\n minBorrowEth = _minBorrowEth;\r\n maxUtilizationRate = _maxUtilizationRate;\r\n }\r\n\r\n function getMinBorrowEth(ICErc20 _ctoken) public view returns (uint256) {\r\n (, , uint256 borrowBalance, ) = _ctoken.getAccountSnapshot(_msgSender());\r\n if (borrowBalance == 0) return minBorrowEth;\r\n IonicComptroller comptroller = IonicComptroller(address(_ctoken.comptroller()));\r\n BasePriceOracle oracle = comptroller.oracle();\r\n uint256 underlyingPriceEth = oracle.price(ICErc20(address(_ctoken)).underlying());\r\n uint256 underlyingDecimals = _ctoken.decimals();\r\n uint256 borrowBalanceEth = (underlyingPriceEth * borrowBalance) / 10 ** underlyingDecimals;\r\n if (borrowBalanceEth > minBorrowEth) {\r\n return 0;\r\n }\r\n return minBorrowEth - borrowBalanceEth;\r\n }\r\n\r\n /**\r\n * @dev Receives native fees.\r\n */\r\n receive() external payable {}\r\n\r\n /**\r\n * @dev Sends data to a contract.\r\n * @param targets The contracts to which `data` will be sent.\r\n * @param data The data to be sent to each of `targets`.\r\n */\r\n function _callPool(address[] calldata targets, bytes[] calldata data) external onlyOwner {\r\n require(targets.length > 0 && targets.length == data.length, \"Array lengths must be equal and greater than 0.\");\r\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data[i]);\r\n }\r\n\r\n /**\r\n * @dev Sends data to a contract.\r\n * @param targets The contracts to which `data` will be sent.\r\n * @param data The data to be sent to each of `targets`.\r\n */\r\n function _callPool(address[] calldata targets, bytes calldata data) external onlyOwner {\r\n require(targets.length > 0, \"No target addresses specified.\");\r\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data);\r\n }\r\n\r\n /**\r\n * @dev Deploys a CToken for an underlying ERC20\r\n * @param constructorData Encoded construction data for `CToken initialize()`\r\n */\r\n function deployCErc20(\r\n uint8 delegateType,\r\n bytes calldata constructorData,\r\n bytes calldata becomeImplData\r\n ) external returns (address) {\r\n // Make sure comptroller == msg.sender\r\n (address underlying, address comptroller) = abi.decode(constructorData[0:64], (address, address));\r\n require(comptroller == msg.sender, \"Comptroller is not sender.\");\r\n\r\n // Deploy CErc20Delegator using msg.sender, underlying, and block.number as a salt\r\n bytes32 salt = keccak256(abi.encodePacked(msg.sender, underlying, ++marketsCounter));\r\n\r\n bytes memory cErc20DelegatorCreationCode = abi.encodePacked(type(CErc20Delegator).creationCode, constructorData);\r\n address proxy = Create2Upgradeable.deploy(0, salt, cErc20DelegatorCreationCode);\r\n\r\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\r\n DiamondExtension delegateAsExtension = DiamondExtension(data.implementation);\r\n // register the first extension\r\n DiamondBase(proxy)._registerExtension(delegateAsExtension, DiamondExtension(address(0)));\r\n // derive and configure the other extensions\r\n DiamondExtension[] memory ctokenExts = cErc20DelegateExtensions[address(delegateAsExtension)];\r\n for (uint256 i = 0; i < ctokenExts.length; i++) {\r\n if (ctokenExts[i] == delegateAsExtension) continue;\r\n DiamondBase(proxy)._registerExtension(ctokenExts[i], DiamondExtension(address(0)));\r\n }\r\n CErc20PluginDelegate(address(proxy))._becomeImplementation(becomeImplData);\r\n\r\n return proxy;\r\n }\r\n\r\n /**\r\n * @dev Latest Comptroller implementation for each existing implementation.\r\n */\r\n function latestComptrollerImplementation(address oldImplementation) external view returns (address) {\r\n return\r\n _latestComptrollerImplementation[oldImplementation] != address(0)\r\n ? _latestComptrollerImplementation[oldImplementation]\r\n : oldImplementation;\r\n }\r\n\r\n /**\r\n * @dev Sets the latest `Comptroller` upgrade implementation address.\r\n * @param oldImplementation The old `Comptroller` implementation address to upgrade from.\r\n * @param newImplementation Latest `Comptroller` implementation address.\r\n */\r\n function _setLatestComptrollerImplementation(\r\n address oldImplementation,\r\n address newImplementation\r\n ) external onlyOwner {\r\n _latestComptrollerImplementation[oldImplementation] = newImplementation;\r\n }\r\n\r\n /**\r\n * @dev Latest CErc20Delegate implementation for each existing implementation.\r\n */\r\n function latestCErc20Delegate(uint8 delegateType) external view returns (address, bytes memory) {\r\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\r\n bytes memory emptyBytes;\r\n return\r\n data.implementation != address(0)\r\n ? (data.implementation, data.becomeImplementationData)\r\n : (address(0), emptyBytes);\r\n }\r\n\r\n /**\r\n * @dev Sets the latest `CErc20Delegate` upgrade implementation address and data.\r\n * @param delegateType The old `CErc20Delegate` implementation address to upgrade from.\r\n * @param newImplementation Latest `CErc20Delegate` implementation address.\r\n * @param becomeImplementationData Data passed to the new implementation via `becomeImplementation` after upgrade.\r\n */\r\n function _setLatestCErc20Delegate(\r\n uint8 delegateType,\r\n address newImplementation,\r\n bytes calldata becomeImplementationData\r\n ) external onlyOwner {\r\n _latestCErc20Delegate[delegateType] = CDelegateUpgradeData(newImplementation, becomeImplementationData);\r\n }\r\n\r\n /**\r\n * @dev Latest Plugin implementation for each existing implementation.\r\n */\r\n function latestPluginImplementation(address oldImplementation) external view returns (address) {\r\n return\r\n _latestPluginImplementation[oldImplementation] != address(0)\r\n ? _latestPluginImplementation[oldImplementation]\r\n : oldImplementation;\r\n }\r\n\r\n /**\r\n * @dev Sets the latest plugin upgrade implementation address.\r\n * @param oldImplementation The old plugin implementation address to upgrade from.\r\n * @param newImplementation Latest plugin implementation address.\r\n */\r\n function _setLatestPluginImplementation(address oldImplementation, address newImplementation) external onlyOwner {\r\n _latestPluginImplementation[oldImplementation] = newImplementation;\r\n }\r\n\r\n /**\r\n * @dev Upgrades a plugin of a CErc20PluginDelegate market to the latest implementation\r\n * @param cDelegator the proxy address\r\n * @return if the plugin was upgraded or not\r\n */\r\n function _upgradePluginToLatestImplementation(address cDelegator) external onlyOwner returns (bool) {\r\n CErc20PluginDelegate market = CErc20PluginDelegate(cDelegator);\r\n\r\n address oldPluginAddress = address(market.plugin());\r\n market._updatePlugin(_latestPluginImplementation[oldPluginAddress]);\r\n address newPluginAddress = address(market.plugin());\r\n\r\n return newPluginAddress != oldPluginAddress;\r\n }\r\n\r\n /**\r\n * @notice Returns the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\r\n */\r\n function interestFeeRate() external view returns (uint256) {\r\n (bool success, bytes memory data) = msg.sender.staticcall(abi.encodeWithSignature(\"comptroller()\"));\r\n\r\n if (success && data.length == 32) {\r\n address comptroller = abi.decode(data, (address));\r\n int256 customRate = customInterestFeeRates[comptroller];\r\n if (customRate > 0) return uint256(customRate);\r\n if (customRate < 0) return 0;\r\n }\r\n\r\n return defaultInterestFeeRate;\r\n }\r\n\r\n /**\r\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\r\n * @param comptroller The Unitroller (Comptroller proxy) address.\r\n * @param rate The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\r\n */\r\n function _setCustomInterestFeeRate(address comptroller, int256 rate) external onlyOwner {\r\n require(rate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\r\n customInterestFeeRates[comptroller] = rate;\r\n }\r\n\r\n function getComptrollerExtensions(address comptroller) external view returns (DiamondExtension[] memory) {\r\n return comptrollerExtensions[comptroller];\r\n }\r\n\r\n function _setComptrollerExtensions(address comptroller, DiamondExtension[] calldata extensions) external onlyOwner {\r\n comptrollerExtensions[comptroller] = extensions;\r\n }\r\n\r\n function _registerComptrollerExtension(\r\n address payable pool,\r\n DiamondExtension extensionToAdd,\r\n DiamondExtension extensionToReplace\r\n ) external onlyOwner {\r\n DiamondBase(pool)._registerExtension(extensionToAdd, extensionToReplace);\r\n }\r\n\r\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (DiamondExtension[] memory) {\r\n return cErc20DelegateExtensions[cErc20Delegate];\r\n }\r\n\r\n function _setCErc20DelegateExtensions(\r\n address cErc20Delegate,\r\n DiamondExtension[] calldata extensions\r\n ) external onlyOwner {\r\n cErc20DelegateExtensions[cErc20Delegate] = extensions;\r\n }\r\n\r\n function autoUpgradePool(IonicComptroller pool) external onlyOwner {\r\n ICErc20[] memory markets = pool.getAllMarkets();\r\n\r\n // auto upgrade the pool\r\n pool._upgrade();\r\n\r\n for (uint8 i = 0; i < markets.length; i++) {\r\n // upgrade the market\r\n markets[i]._upgrade();\r\n }\r\n }\r\n\r\n function canCall(address pool, address user, address target, bytes4 functionSig) external view returns (bool) {\r\n return authoritiesRegistry.canCall(pool, user, target, functionSig);\r\n }\r\n}\r\n" + }, + "contracts/GlobalPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\r\n\r\ninterface IPoolDirectory {\r\n struct Pool {\r\n string name;\r\n address creator;\r\n address comptroller;\r\n uint256 blockPosted;\r\n uint256 timestampPosted;\r\n }\r\n\r\n function getActivePools() external view returns (uint256, Pool[] memory);\r\n}\r\n\r\ncontract GlobalPauser is Ownable2Step {\r\n IPoolDirectory public poolDirectory;\r\n mapping(address => bool) public pauseGuardian;\r\n\r\n modifier onlyPauseGuardian() {\r\n require(pauseGuardian[msg.sender], \"!guardian\");\r\n _;\r\n }\r\n\r\n constructor(address _poolDirectory) Ownable2Step() {\r\n poolDirectory = IPoolDirectory(_poolDirectory);\r\n }\r\n\r\n function setPauseGuardian(address _pauseGuardian, bool _isPauseGuardian) external onlyOwner {\r\n pauseGuardian[_pauseGuardian] = _isPauseGuardian;\r\n }\r\n\r\n function pauseAll() external onlyPauseGuardian {\r\n (, IPoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\r\n for (uint256 j = 0; j < markets.length; j++) {\r\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\r\n if (!isPaused) {\r\n IonicComptroller(pools[i].comptroller)._setBorrowPaused(markets[j], true);\r\n }\r\n\r\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\r\n if (!isPaused) {\r\n IonicComptroller(pools[i].comptroller)._setMintPaused(markets[j], true);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/IEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ninterface IEmissionsManager {\r\n error InvalidPoolDirectoryAaddress();\r\n error InvalidProtocolAddress();\r\n error InvalidRewardTokenAddress();\r\n error CollateralBasisPointsExceedMaximum();\r\n error InvalidVeIONAddress();\r\n error MaximumLimitExceeded();\r\n\r\n event Initialized(\r\n address indexed protocolAddress,\r\n address indexed rewardToken,\r\n uint256 collateralBp,\r\n bytes nonBlacklistableTargetBytecode\r\n );\r\n event VeIonSet(address indexed veIon);\r\n event CollateralBpSet(uint256 collateralBp);\r\n event NonBlacklistableAddressSet(address indexed user, bool isNonBlacklistable);\r\n event NonBlacklistableTargetBytecodeSet(bytes newBytecode);\r\n\r\n function isUserBlacklisted(address _user) external view returns (bool);\r\n function isUserBlacklistable(address _user) external view returns (bool);\r\n}\r\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\nimport \"./liquidators/IRedemptionStrategy.sol\";\r\nimport \"./liquidators/IFundsConversionStrategy.sol\";\r\n\r\ninterface ILiquidator {\r\n /**\r\n * borrower The borrower's Ethereum address.\r\n * repayAmount The amount to repay to liquidate the unhealthy loan.\r\n * cErc20 The borrowed CErc20 contract to repay.\r\n * cTokenCollateral The cToken collateral contract to be liquidated.\r\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\r\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\r\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\r\n */\r\n struct LiquidateToTokensWithFlashSwapVars {\r\n address borrower;\r\n uint256 repayAmount;\r\n ICErc20 cErc20;\r\n ICErc20 cTokenCollateral;\r\n address flashSwapContract;\r\n uint256 minProfitAmount;\r\n IRedemptionStrategy[] redemptionStrategies;\r\n bytes[] strategyData;\r\n IFundsConversionStrategy[] debtFundingStrategies;\r\n bytes[] debtFundingStrategiesData;\r\n }\r\n\r\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\r\n\r\n function safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external returns (uint256);\r\n\r\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\r\n external\r\n returns (uint256);\r\n\r\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\r\n\r\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\r\n external;\r\n\r\n function setExpressRelay(address _expressRelay) external;\r\n\r\n function setPoolLens(address _poolLens) external;\r\n\r\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\r\n}\r\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title AddressesProvider\r\n * @notice The Addresses Provider serves as a central storage of system internal and external\r\n * contract addresses that change between deploys and across chains\r\n * @author Veliko Minkov \r\n */\r\ncontract AddressesProvider is SafeOwnableUpgradeable {\r\n mapping(string => address) private _addresses;\r\n mapping(address => Contract) public plugins;\r\n mapping(address => Contract) public flywheelRewards;\r\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\r\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\r\n JarvisPool[] public jarvisPoolsConfig;\r\n CurveSwapPool[] public curveSwapPoolsConfig;\r\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\r\n\r\n /// @dev Initializer to set the admin that can set and change contracts addresses\r\n function initialize(address owner) public initializer {\r\n __SafeOwnable_init(owner);\r\n }\r\n\r\n /**\r\n * @dev The contract address and a string that uniquely identifies the contract's interface\r\n */\r\n struct Contract {\r\n address addr;\r\n string contractInterface;\r\n }\r\n\r\n struct RedemptionStrategy {\r\n address addr;\r\n string contractInterface;\r\n address outputToken;\r\n }\r\n\r\n struct FundingStrategy {\r\n address addr;\r\n string contractInterface;\r\n address inputToken;\r\n }\r\n\r\n struct JarvisPool {\r\n address syntheticToken;\r\n address collateralToken;\r\n address liquidityPool;\r\n uint256 expirationTime;\r\n }\r\n\r\n struct CurveSwapPool {\r\n address poolAddress;\r\n address[] coins;\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the flywheel for the reward token\r\n * @param rewardToken the reward token address\r\n * @param flywheelRewardsModule the flywheel rewards module address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setFlywheelRewards(\r\n address rewardToken,\r\n address flywheelRewardsModule,\r\n string calldata contractInterface\r\n ) public onlyOwner {\r\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\r\n * @param asset the asset address\r\n * @param plugin the ERC4626 plugin address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setPlugin(\r\n address asset,\r\n address plugin,\r\n string calldata contractInterface\r\n ) public onlyOwner {\r\n plugins[asset] = Contract(plugin, contractInterface);\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\r\n * @param asset the asset address\r\n * @param strategy redemption strategy address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setRedemptionStrategy(\r\n address asset,\r\n address strategy,\r\n string calldata contractInterface,\r\n address outputToken\r\n ) public onlyOwner {\r\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\r\n }\r\n\r\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\r\n return redemptionStrategiesConfig[asset];\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the funding strategy for the asset\r\n * @param asset the asset address\r\n * @param strategy funding strategy address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setFundingStrategy(\r\n address asset,\r\n address strategy,\r\n string calldata contractInterface,\r\n address inputToken\r\n ) public onlyOwner {\r\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\r\n }\r\n\r\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\r\n return fundingStrategiesConfig[asset];\r\n }\r\n\r\n /**\r\n * @dev configures the Jarvis pool of a Jarvis synthetic token\r\n * @param syntheticToken the synthetic token address\r\n * @param collateralToken the collateral token address\r\n * @param liquidityPool the liquidity pool address\r\n * @param expirationTime the operation expiration time\r\n */\r\n function setJarvisPool(\r\n address syntheticToken,\r\n address collateralToken,\r\n address liquidityPool,\r\n uint256 expirationTime\r\n ) public onlyOwner {\r\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\r\n }\r\n\r\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\r\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\r\n }\r\n\r\n /**\r\n * @dev Sets an address for an id replacing the address saved in the addresses map\r\n * @param id The id\r\n * @param newAddress The address to set\r\n */\r\n function setAddress(string calldata id, address newAddress) external onlyOwner {\r\n _addresses[id] = newAddress;\r\n }\r\n\r\n /**\r\n * @dev Returns an address by id\r\n * @return The address\r\n */\r\n function getAddress(string calldata id) public view returns (address) {\r\n return _addresses[id];\r\n }\r\n\r\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\r\n return curveSwapPoolsConfig;\r\n }\r\n\r\n function getJarvisPools() public view returns (JarvisPool[] memory) {\r\n return jarvisPoolsConfig;\r\n }\r\n\r\n function setBalancerPoolForTokens(\r\n address inputToken,\r\n address outputToken,\r\n address pool\r\n ) external onlyOwner {\r\n balancerPoolForTokens[inputToken][outputToken] = pool;\r\n }\r\n\r\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\r\n return balancerPoolForTokens[inputToken][outputToken];\r\n }\r\n}\r\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\r\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\r\n\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\r\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\r\n PoolRolesAuthority public poolAuthLogic;\r\n address public leveredPositionsFactory;\r\n bool public noAuthRequired;\r\n\r\n function initialize(address _leveredPositionsFactory) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n leveredPositionsFactory = _leveredPositionsFactory;\r\n poolAuthLogic = new PoolRolesAuthority();\r\n }\r\n\r\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\r\n leveredPositionsFactory = _leveredPositionsFactory;\r\n poolAuthLogic = new PoolRolesAuthority();\r\n // for Neon the auth is not required\r\n noAuthRequired = block.chainid == 245022934;\r\n }\r\n\r\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\r\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\r\n\r\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\r\n auth = PoolRolesAuthority(address(proxy));\r\n auth.initialize(address(this));\r\n poolsAuthorities[pool] = auth;\r\n\r\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\r\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\r\n // sets the registry owner as the auth owner\r\n reconfigureAuthority(pool);\r\n }\r\n\r\n function reconfigureAuthority(address poolAddress) public {\r\n IonicComptroller pool = IonicComptroller(poolAddress);\r\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\r\n\r\n if (msg.sender != poolAddress || address(auth) != address(0)) {\r\n require(address(auth) != address(0), \"no such authority\");\r\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\r\n\r\n auth.configureRegistryCapabilities();\r\n auth.configurePoolSupplierCapabilities(pool);\r\n auth.configurePoolBorrowerCapabilities(pool);\r\n // everyone can be a liquidator\r\n auth.configureOpenPoolLiquidatorCapabilities(pool);\r\n auth.configureLeveredPositionCapabilities(pool);\r\n\r\n if (auth.owner() != owner()) {\r\n auth.setOwner(owner());\r\n }\r\n }\r\n }\r\n\r\n function canCall(\r\n address pool,\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) external view returns (bool) {\r\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\r\n if (address(authorityForPool) == address(0)) {\r\n return noAuthRequired;\r\n } else {\r\n // allow only if an auth exists and it allows the action\r\n return authorityForPool.canCall(user, target, functionSig);\r\n }\r\n }\r\n\r\n function setUserRole(\r\n address pool,\r\n address user,\r\n uint8 role,\r\n bool enabled\r\n ) external {\r\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\r\n\r\n require(address(poolAuth) != address(0), \"auth does not exist\");\r\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\r\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\r\n\r\n poolAuth.setUserRole(user, role, enabled);\r\n }\r\n}\r\n" + }, + "contracts/ionic/CollateralSwap.sol": { + "content": "// SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.22;\r\n\r\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\r\n\r\nimport { IFlashLoanReceiver } from \"./IFlashLoanReceiver.sol\";\r\nimport { Exponential } from \"../compound/Exponential.sol\";\r\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\r\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\r\n\r\ncontract CollateralSwap is Ownable2Step, Exponential, IFlashLoanReceiver {\r\n using SafeERC20 for IERC20;\r\n\r\n uint256 public feeBps;\r\n address public feeRecipient;\r\n IonicComptroller public comptroller;\r\n mapping(address => bool) public allowedSwapTargets;\r\n\r\n error SwapCollateralFailed();\r\n error TransferFailed(address market, address user, address target);\r\n error MintFailed(address market, uint256 errorCode);\r\n error RedeemFailed(address market, uint256 errorCode);\r\n error InvalidFlashloanCaller(address caller);\r\n error InvalidSwapTarget(address target);\r\n\r\n constructor(\r\n uint256 _feeBps,\r\n address _feeRecipient,\r\n address _comptroller,\r\n address[] memory _allowedSwapTargets\r\n ) Ownable2Step() {\r\n feeBps = _feeBps;\r\n feeRecipient = _feeRecipient;\r\n comptroller = IonicComptroller(_comptroller);\r\n for (uint256 i = 0; i < _allowedSwapTargets.length; i++) {\r\n allowedSwapTargets[_allowedSwapTargets[i]] = true;\r\n }\r\n }\r\n\r\n // ADMIN FUNCTIONS\r\n\r\n function setFeeBps(uint256 _feeBps) public onlyOwner {\r\n feeBps = _feeBps;\r\n }\r\n\r\n function setFeeRecipient(address _feeRecipient) public onlyOwner {\r\n feeRecipient = _feeRecipient;\r\n }\r\n\r\n function setAllowedSwapTarget(address _target, bool _allowed) public onlyOwner {\r\n allowedSwapTargets[_target] = _allowed;\r\n }\r\n\r\n function sweep(address token) public onlyOwner {\r\n IERC20(token).safeTransfer(owner(), IERC20(token).balanceOf(address(this)));\r\n }\r\n\r\n // PUBLIC FUNCTIONS\r\n\r\n function swapCollateral(\r\n uint256 amountUnderlying,\r\n ICErc20 oldCollateralMarket,\r\n ICErc20 newCollateralMarket,\r\n address swapTarget,\r\n bytes calldata swapData\r\n ) public {\r\n oldCollateralMarket.flash(\r\n amountUnderlying,\r\n abi.encode(msg.sender, oldCollateralMarket, newCollateralMarket, swapTarget, swapData)\r\n );\r\n }\r\n\r\n function receiveFlashLoan(address borrowedAsset, uint256 borrowedAmount, bytes calldata data) external {\r\n // make sure the caller is a valid market\r\n {\r\n ICErc20[] memory markets = comptroller.getAllMarkets();\r\n bool isAllowed = false;\r\n for (uint256 i = 0; i < markets.length; i++) {\r\n if (msg.sender == address(markets[i])) {\r\n isAllowed = true;\r\n break;\r\n }\r\n }\r\n if (!isAllowed) {\r\n revert InvalidFlashloanCaller(msg.sender);\r\n }\r\n }\r\n\r\n (\r\n address borrower,\r\n ICErc20 oldCollateralMarket,\r\n ICErc20 newCollateralMarket,\r\n address swapTarget,\r\n bytes memory swapData\r\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes));\r\n\r\n // swap the collateral\r\n {\r\n if (!allowedSwapTargets[swapTarget]) {\r\n revert InvalidSwapTarget(swapTarget);\r\n }\r\n IERC20(borrowedAsset).approve(swapTarget, borrowedAmount);\r\n (bool success, ) = swapTarget.call(swapData);\r\n if (!success) {\r\n revert SwapCollateralFailed();\r\n }\r\n }\r\n\r\n // mint the new collateral\r\n {\r\n IERC20 newCollateralAsset = IERC20(newCollateralMarket.underlying());\r\n uint256 outputAmount = newCollateralAsset.balanceOf(address(this));\r\n uint256 fee = (outputAmount * feeBps) / 10_000;\r\n outputAmount -= fee;\r\n if (fee > 0) {\r\n newCollateralAsset.safeTransfer(feeRecipient, fee);\r\n }\r\n newCollateralAsset.approve(address(newCollateralMarket), outputAmount);\r\n uint256 mintResult = newCollateralMarket.mint(outputAmount);\r\n if (mintResult != 0) {\r\n revert MintFailed(address(newCollateralMarket), mintResult);\r\n }\r\n }\r\n\r\n // transfer the new collateral to the borrower\r\n {\r\n uint256 cTokenBalance = IERC20(address(newCollateralMarket)).balanceOf(address(this));\r\n IERC20(address(newCollateralMarket)).safeTransfer(borrower, cTokenBalance);\r\n }\r\n\r\n // withdraw the old collateral\r\n {\r\n (MathError mErr, uint256 amountCTokensToSwap) = divScalarByExpTruncate(\r\n borrowedAmount,\r\n Exp({ mantissa: oldCollateralMarket.exchangeRateCurrent() })\r\n );\r\n require(mErr == MathError.NO_ERROR, \"exchange rate error\");\r\n bool transferStatus = oldCollateralMarket.transferFrom(borrower, address(this), amountCTokensToSwap + 1);\r\n if (!transferStatus) {\r\n revert TransferFailed(address(oldCollateralMarket), borrower, address(this));\r\n }\r\n uint256 redeemResult = oldCollateralMarket.redeemUnderlying(type(uint256).max);\r\n if (redeemResult != 0) {\r\n revert RedeemFailed(address(oldCollateralMarket), redeemResult);\r\n }\r\n IERC20(borrowedAsset).approve(address(oldCollateralMarket), borrowedAmount);\r\n }\r\n // flashloan gets paid back from redeemed collateral\r\n }\r\n}\r\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @notice a base contract for logic extensions that use the diamond pattern storage\r\n * to map the functions when looking up the extension contract to delegate to.\r\n */\r\nabstract contract DiamondExtension {\r\n /**\r\n * @return a list of all the function selectors that this logic extension exposes\r\n */\r\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\r\n}\r\n\r\n// When no function exists for function called\r\nerror FunctionNotFound(bytes4 _functionSelector);\r\n\r\n// When no extension exists for function called\r\nerror ExtensionNotFound(bytes4 _functionSelector);\r\n\r\n// When the function is already added\r\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\r\n\r\nabstract contract DiamondBase {\r\n /**\r\n * @dev register a logic extension\r\n * @param extensionToAdd the extension whose functions are to be added\r\n * @param extensionToReplace the extension whose functions are to be removed/replaced\r\n */\r\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\r\n\r\n function _listExtensions() public view returns (address[] memory) {\r\n return LibDiamond.listExtensions();\r\n }\r\n\r\n fallback() external {\r\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\r\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\r\n // Execute external function from extension using delegatecall and return any value.\r\n assembly {\r\n // copy function selector and any arguments\r\n calldatacopy(0, 0, calldatasize())\r\n // execute function call using the extension\r\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\r\n // get any return value\r\n returndatacopy(0, 0, returndatasize())\r\n // return any return value or error back to the caller\r\n switch result\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @notice a library to use in a contract, whose logic is extended with diamond extension\r\n */\r\nlibrary LibDiamond {\r\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\r\n\r\n struct Function {\r\n address extension;\r\n bytes4 selector;\r\n }\r\n\r\n struct LogicStorage {\r\n Function[] functions;\r\n address[] extensions;\r\n }\r\n\r\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\r\n return getExtensionForSelector(msgSig, diamondStorage());\r\n }\r\n\r\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\r\n bytes32 position = DIAMOND_STORAGE_POSITION;\r\n assembly {\r\n ds.slot := position\r\n }\r\n }\r\n\r\n function listExtensions() internal view returns (address[] memory) {\r\n return diamondStorage().extensions;\r\n }\r\n\r\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\r\n if (address(extensionToReplace) != address(0)) {\r\n removeExtension(extensionToReplace);\r\n }\r\n addExtension(extensionToAdd);\r\n }\r\n\r\n function removeExtension(DiamondExtension extension) internal {\r\n LogicStorage storage ds = diamondStorage();\r\n // remove all functions of the extension to replace\r\n removeExtensionFunctions(extension);\r\n for (uint8 i = 0; i < ds.extensions.length; i++) {\r\n if (ds.extensions[i] == address(extension)) {\r\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\r\n ds.extensions.pop();\r\n }\r\n }\r\n }\r\n\r\n function addExtension(DiamondExtension extension) internal {\r\n LogicStorage storage ds = diamondStorage();\r\n for (uint8 i = 0; i < ds.extensions.length; i++) {\r\n require(ds.extensions[i] != address(extension), \"extension already added\");\r\n }\r\n addExtensionFunctions(extension);\r\n ds.extensions.push(address(extension));\r\n }\r\n\r\n function removeExtensionFunctions(DiamondExtension extension) internal {\r\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\r\n LogicStorage storage ds = diamondStorage();\r\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\r\n bytes4 selectorToRemove = fnsToRemove[i];\r\n // must never fail\r\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\r\n // swap with the last element in the selectorAtIndex array and remove the last element\r\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\r\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\r\n ds.functions.pop();\r\n }\r\n }\r\n\r\n function addExtensionFunctions(DiamondExtension extension) internal {\r\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\r\n LogicStorage storage ds = diamondStorage();\r\n uint16 functionsCount = uint16(ds.functions.length);\r\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\r\n bytes4 selector = fnsToAdd[functionsIndex];\r\n address oldImplementation = getExtensionForSelector(selector, ds);\r\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\r\n ds.functions.push(Function(address(extension), selector));\r\n functionsCount++;\r\n }\r\n }\r\n\r\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\r\n uint256 fnsLen = ds.functions.length;\r\n for (uint256 i = 0; i < fnsLen; i++) {\r\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\r\n }\r\n\r\n return address(0);\r\n }\r\n\r\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\r\n uint16 fnsLen = uint16(ds.functions.length);\r\n for (uint16 i = 0; i < fnsLen; i++) {\r\n if (ds.functions[i].selector == selector) return i;\r\n }\r\n\r\n return type(uint16).max;\r\n }\r\n}\r\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\ninterface IFlashLoanReceiver {\r\n function receiveFlashLoan(\r\n address borrowedAsset,\r\n uint256 borrowedAmount,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/ionic/irms/AdjustableJumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../../compound/InterestRateModel.sol\";\r\nimport \"../../compound/SafeMath.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\n\r\n/**\r\n * @title Compound's JumpRateModel Contract\r\n * @author Compound\r\n */\r\n\r\nstruct InterestRateModelParams {\r\n uint256 blocksPerYear; // The approximate number of blocks per year\r\n uint256 baseRatePerYear; // The approximate target base APR, as a mantissa (scaled by 1e18)\r\n uint256 multiplierPerYear; // The rate of increase in interest rate wrt utilization (scaled by 1e18)\r\n uint256 jumpMultiplierPerYear; // The multiplierPerBlock after hitting a specified utilization point\r\n uint256 kink; // The utilization point at which the jump multiplier is applied\r\n}\r\n\r\ncontract AdjustableJumpRateModel is Ownable, InterestRateModel {\r\n using SafeMath for uint256;\r\n\r\n event NewInterestParams(\r\n uint256 baseRatePerBlock,\r\n uint256 multiplierPerBlock,\r\n uint256 jumpMultiplierPerBlock,\r\n uint256 kink\r\n );\r\n\r\n /**\r\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\r\n */\r\n uint256 public blocksPerYear;\r\n\r\n /**\r\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\r\n */\r\n uint256 public multiplierPerBlock;\r\n\r\n /**\r\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\r\n */\r\n uint256 public baseRatePerBlock;\r\n\r\n /**\r\n * @notice The multiplierPerBlock after hitting a specified utilization point\r\n */\r\n uint256 public jumpMultiplierPerBlock;\r\n\r\n /**\r\n * @notice The utilization point at which the jump multiplier is applied\r\n */\r\n uint256 public kink;\r\n\r\n /**\r\n * @notice Initialise an interest rate model\r\n */\r\n\r\n constructor(InterestRateModelParams memory params) {\r\n blocksPerYear = params.blocksPerYear;\r\n baseRatePerBlock = params.baseRatePerYear.div(blocksPerYear);\r\n multiplierPerBlock = params.multiplierPerYear.div(blocksPerYear);\r\n jumpMultiplierPerBlock = params.jumpMultiplierPerYear.div(blocksPerYear);\r\n kink = params.kink;\r\n\r\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\r\n }\r\n\r\n /**\r\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\r\n * @param cash The amount of cash in the market\r\n * @param borrows The amount of borrows in the market\r\n * @param reserves The amount of reserves in the market (currently unused)\r\n * @return The utilization rate as a mantissa between [0, 1e18]\r\n */\r\n function utilizationRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public pure returns (uint256) {\r\n // Utilization rate is 0 when there are no borrows\r\n if (borrows == 0) {\r\n return 0;\r\n }\r\n\r\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\r\n }\r\n\r\n function _setIrmParameters(InterestRateModelParams memory params) public onlyOwner {\r\n blocksPerYear = params.blocksPerYear;\r\n baseRatePerBlock = params.baseRatePerYear.div(blocksPerYear);\r\n multiplierPerBlock = params.multiplierPerYear.div(blocksPerYear);\r\n jumpMultiplierPerBlock = params.jumpMultiplierPerYear.div(blocksPerYear);\r\n kink = params.kink;\r\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\r\n }\r\n\r\n /**\r\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\r\n * @param cash The amount of cash in the market\r\n * @param borrows The amount of borrows in the market\r\n * @param reserves The amount of reserves in the market\r\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\r\n */\r\n function getBorrowRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public view override returns (uint256) {\r\n uint256 util = utilizationRate(cash, borrows, reserves);\r\n\r\n if (util <= kink) {\r\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\r\n } else {\r\n uint256 normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\r\n uint256 excessUtil = util.sub(kink);\r\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates the current supply rate per block\r\n * @param cash The amount of cash in the market\r\n * @param borrows The amount of borrows in the market\r\n * @param reserves The amount of reserves in the market\r\n * @param reserveFactorMantissa The current reserve factor for the market\r\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\r\n */\r\n function getSupplyRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves,\r\n uint256 reserveFactorMantissa\r\n ) public view virtual override returns (uint256) {\r\n uint256 oneMinusReserveFactor = uint256(1e18).sub(reserveFactorMantissa);\r\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\r\n uint256 rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\r\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\r\n }\r\n}\r\n" + }, + "contracts/ionic/irms/PrudentiaInterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\r\n\r\nimport { IRateComputer } from \"adrastia-periphery/rates/IRateComputer.sol\";\r\n\r\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\r\n\r\n/**\r\n * @title Adrastia Prudentia Interest Rate Model\r\n * @author TRILEZ SOFTWARE INC.\r\n */\r\ncontract PrudentiaInterestRateModel is InterestRateModel {\r\n using Math for uint256;\r\n\r\n /**\r\n * @notice The address of the underlying token for which the interest rate model calculates rates.\r\n */\r\n address public immutable underlyingToken;\r\n\r\n /**\r\n * @notice The address of the Adrastia Prudentia interest rate controller.\r\n */\r\n IRateComputer public immutable rateController;\r\n\r\n /**\r\n * @notice The approximate number of blocks per year that is assumed by the interest rate model.\r\n */\r\n uint256 public immutable blocksPerYear;\r\n\r\n /**\r\n * @notice Construct a new interest rate model that reads from an Adrastia Prudentia interest rate controller.\r\n *\r\n * @param blocksPerYear_ The approximate number of blocks per year that is assumed by the interest rate model.\r\n * @param underlyingToken_ The address of the underlying token for which the interest rate model calculates rates.\r\n * @param rateController_ The address of the Adrastia Prudentia interest rate controller.\r\n */\r\n constructor(\r\n uint256 blocksPerYear_,\r\n address underlyingToken_,\r\n IRateComputer rateController_\r\n ) {\r\n if (underlyingToken_ == address(0)) {\r\n revert(\"PrudentiaInterestRateModel: underlyingToken is the zero address\");\r\n }\r\n if (address(rateController_) == address(0)) {\r\n revert(\"PrudentiaInterestRateModel: rateController is the zero address\");\r\n }\r\n\r\n blocksPerYear = blocksPerYear_;\r\n underlyingToken = underlyingToken_;\r\n rateController = rateController_;\r\n }\r\n\r\n /**\r\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`.\r\n *\r\n * @param cash The amount of cash in the market.\r\n * @param borrows The amount of borrows in the market.\r\n * @param reserves The amount of reserves in the market.\r\n *\r\n * @return The utilization rate as a mantissa between [0, 1e18].\r\n */\r\n function utilizationRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public pure returns (uint256) {\r\n uint256 total = cash + borrows - reserves;\r\n if (total == 0) {\r\n // Utilization rate is zero when nothing is available (prevents division by zero)\r\n return 0;\r\n }\r\n\r\n return (borrows * 1e18) / total;\r\n }\r\n\r\n /**\r\n * @notice Calculates the current borrow rate per block by reading the current rate from the Adrastia Prudentia\r\n * interest rate controller.\r\n *\r\n * @param cash Not used.\r\n * @param borrows Not used.\r\n * @param reserves Not used.\r\n *\r\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18).\r\n */\r\n function getBorrowRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public view override returns (uint256) {\r\n // Silence unused variable warnings\r\n cash;\r\n borrows;\r\n reserves;\r\n\r\n uint256 annualRate = rateController.computeRate(underlyingToken);\r\n\r\n return annualRate.ceilDiv(blocksPerYear); // Convert the annual rate to a per-block rate, rounding up\r\n }\r\n\r\n /**\r\n * @notice Calculates the current supply rate per block.\r\n *\r\n * @param cash The amount of cash in the market.\r\n * @param borrows The amount of borrows in the market.\r\n * @param reserves The amount of reserves in the market.\r\n * @param reserveFactorMantissa The current reserve factor for the market.\r\n *\r\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18).\r\n */\r\n function getSupplyRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves,\r\n uint256 reserveFactorMantissa\r\n ) public view virtual override returns (uint256) {\r\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\r\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\r\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\r\n\r\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\r\n }\r\n}\r\n" + }, + "contracts/ionic/levered/ILeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\r\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\r\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface ILeveredPositionFactoryStorage {\r\n function feeDistributor() external view returns (IFeeDistributor);\r\n\r\n function liquidatorsRegistry() external view returns (ILiquidatorsRegistry);\r\n\r\n function blocksPerYear() external view returns (uint256);\r\n\r\n function owner() external view returns (address);\r\n}\r\n\r\ninterface ILeveredPositionFactoryBase {\r\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external;\r\n\r\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external;\r\n}\r\n\r\ninterface ILeveredPositionFactoryFirstExtension {\r\n function getRedemptionStrategies(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\r\n\r\n function getMinBorrowNative() external view returns (uint256);\r\n\r\n function removeClosedPosition(address closedPosition) external returns (bool removed);\r\n\r\n function closeAndRemoveUserPosition(LeveredPosition position) external returns (bool);\r\n\r\n function getPositionsByAccount(address account) external view returns (address[] memory, bool[] memory);\r\n\r\n function getAccountsWithOpenPositions() external view returns (address[] memory);\r\n\r\n function getWhitelistedCollateralMarkets() external view returns (address[] memory);\r\n\r\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory);\r\n\r\n function getPositionsExtension(bytes4 msgSig) external view returns (address);\r\n\r\n function _setPositionsExtension(bytes4 msgSig, address extension) external;\r\n}\r\n\r\ninterface ILeveredPositionFactorySecondExtension {\r\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) external returns (LeveredPosition);\r\n\r\n function createAndFundPosition(\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket,\r\n IERC20Upgradeable _fundingAsset,\r\n uint256 _fundingAmount\r\n ) external returns (LeveredPosition);\r\n\r\n function createAndFundPositionAtRatio(\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket,\r\n IERC20Upgradeable _fundingAsset,\r\n uint256 _fundingAmount,\r\n uint256 _leverageRatio\r\n ) external returns (LeveredPosition);\r\n}\r\n\r\ninterface ILeveredPositionFactoryExtension is\r\n ILeveredPositionFactoryFirstExtension,\r\n ILeveredPositionFactorySecondExtension\r\n{}\r\n\r\ninterface ILeveredPositionFactory is\r\n ILeveredPositionFactoryStorage,\r\n ILeveredPositionFactoryBase,\r\n ILeveredPositionFactoryExtension\r\n{}\r\n" + }, + "contracts/ionic/levered/LeveredPosition.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\r\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\r\nimport { IFlashLoanReceiver } from \"../IFlashLoanReceiver.sol\";\r\nimport { IonicFlywheel } from \"../../ionic/strategies/flywheel/IonicFlywheel.sol\";\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { LeveredPositionStorage } from \"./LeveredPositionStorage.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface IFlywheelLensRouter_LP {\r\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\r\n}\r\n\r\ncontract LeveredPosition is LeveredPositionStorage, IFlashLoanReceiver {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n error OnlyWhenClosed();\r\n error NotPositionOwner();\r\n error OnlyFactoryOwner();\r\n error AssetNotRescuable();\r\n error RepayFlashLoanFailed(address asset, uint256 currentBalance, uint256 repayAmount);\r\n\r\n error ConvertFundsFailed();\r\n error ExitFailed(uint256 errorCode);\r\n error RedeemFailed(uint256 errorCode);\r\n error SupplyCollateralFailed(uint256 errorCode);\r\n error BorrowStableFailed(uint256 errorCode);\r\n error RepayBorrowFailed(uint256 errorCode);\r\n error RedeemCollateralFailed(uint256 errorCode);\r\n error ExtNotFound(bytes4 _functionSelector);\r\n\r\n constructor(\r\n address _positionOwner,\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket\r\n ) LeveredPositionStorage(_positionOwner) {\r\n IonicComptroller collateralPool = _collateralMarket.comptroller();\r\n IonicComptroller stablePool = _stableMarket.comptroller();\r\n require(collateralPool == stablePool, \"markets pools differ\");\r\n pool = collateralPool;\r\n\r\n collateralMarket = _collateralMarket;\r\n collateralAsset = IERC20Upgradeable(_collateralMarket.underlying());\r\n stableMarket = _stableMarket;\r\n stableAsset = IERC20Upgradeable(_stableMarket.underlying());\r\n\r\n factory = ILeveredPositionFactory(msg.sender);\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n Mutable Functions\r\n ----------------------------------------------------------------*/\r\n\r\n function fundPosition(IERC20Upgradeable fundingAsset, uint256 amount) public {\r\n fundingAsset.safeTransferFrom(msg.sender, address(this), amount);\r\n _supplyCollateral(fundingAsset);\r\n\r\n if (!pool.checkMembership(address(this), collateralMarket)) {\r\n address[] memory cTokens = new address[](1);\r\n cTokens[0] = address(collateralMarket);\r\n pool.enterMarkets(cTokens);\r\n }\r\n }\r\n\r\n function closePosition() public returns (uint256) {\r\n return closePosition(msg.sender);\r\n }\r\n\r\n function closePosition(address withdrawTo) public returns (uint256 withdrawAmount) {\r\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\r\n\r\n _leverDown(1e18);\r\n\r\n // calling accrue and exit allows to redeem the full underlying balance\r\n collateralMarket.accrueInterest();\r\n uint256 errorCode = pool.exitMarket(address(collateralMarket));\r\n if (errorCode != 0) revert ExitFailed(errorCode);\r\n\r\n // redeem all cTokens should leave no dust\r\n errorCode = collateralMarket.redeem(collateralMarket.balanceOf(address(this)));\r\n if (errorCode != 0) revert RedeemFailed(errorCode);\r\n\r\n if (stableAsset.balanceOf(address(this)) > 0) {\r\n // convert all overborrowed leftovers/profits to the collateral asset\r\n convertAllTo(stableAsset, collateralAsset);\r\n }\r\n\r\n // withdraw the redeemed collateral\r\n withdrawAmount = collateralAsset.balanceOf(address(this));\r\n collateralAsset.safeTransfer(withdrawTo, withdrawAmount);\r\n }\r\n\r\n function adjustLeverageRatio(uint256 targetRatioMantissa) public returns (uint256) {\r\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\r\n\r\n // anything under 1x means removing the leverage\r\n if (targetRatioMantissa <= 1e18) _leverDown(1e18);\r\n\r\n if (getCurrentLeverageRatio() < targetRatioMantissa) _leverUp(targetRatioMantissa);\r\n else _leverDown(targetRatioMantissa);\r\n\r\n // return the de facto achieved ratio\r\n return getCurrentLeverageRatio();\r\n }\r\n\r\n function receiveFlashLoan(address assetAddress, uint256 borrowedAmount, bytes calldata data) external override {\r\n if (msg.sender == address(collateralMarket)) {\r\n // increasing the leverage ratio\r\n uint256 stableBorrowAmount = abi.decode(data, (uint256));\r\n _leverUpPostFL(stableBorrowAmount);\r\n uint256 positionCollateralBalance = collateralAsset.balanceOf(address(this));\r\n if (positionCollateralBalance < borrowedAmount)\r\n revert RepayFlashLoanFailed(address(collateralAsset), positionCollateralBalance, borrowedAmount);\r\n } else if (msg.sender == address(stableMarket)) {\r\n // decreasing the leverage ratio\r\n uint256 amountToRedeem = abi.decode(data, (uint256));\r\n _leverDownPostFL(borrowedAmount, amountToRedeem);\r\n uint256 positionStableBalance = stableAsset.balanceOf(address(this));\r\n if (positionStableBalance < borrowedAmount)\r\n revert RepayFlashLoanFailed(address(stableAsset), positionStableBalance, borrowedAmount);\r\n } else {\r\n revert(\"!fl not from either markets\");\r\n }\r\n\r\n // repay FL\r\n IERC20Upgradeable(assetAddress).approve(msg.sender, borrowedAmount);\r\n }\r\n\r\n function withdrawStableLeftovers(address withdrawTo) public returns (uint256) {\r\n if (msg.sender != positionOwner) revert NotPositionOwner();\r\n if (!isPositionClosed()) revert OnlyWhenClosed();\r\n\r\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\r\n stableAsset.safeTransfer(withdrawTo, stableLeftovers);\r\n return stableLeftovers;\r\n }\r\n\r\n function claimRewards() public {\r\n claimRewards(msg.sender);\r\n }\r\n\r\n function claimRewards(address withdrawTo) public {\r\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\r\n\r\n address[] memory flywheels = pool.getRewardsDistributors();\r\n\r\n for (uint256 i = 0; i < flywheels.length; i++) {\r\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\r\n fw.accrue(ERC20(address(collateralMarket)), address(this));\r\n fw.accrue(ERC20(address(stableMarket)), address(this));\r\n fw.claimRewards(address(this));\r\n ERC20 rewardToken = fw.rewardToken();\r\n uint256 rewardsAccrued = rewardToken.balanceOf(address(this));\r\n if (rewardsAccrued > 0) {\r\n rewardToken.transfer(withdrawTo, rewardsAccrued);\r\n }\r\n }\r\n }\r\n\r\n function rescueTokens(IERC20Upgradeable asset) external {\r\n if (msg.sender != factory.owner()) revert OnlyFactoryOwner();\r\n if (asset == stableAsset || asset == collateralAsset) revert AssetNotRescuable();\r\n\r\n asset.transfer(positionOwner, asset.balanceOf(address(this)));\r\n }\r\n\r\n function claimRewardsFromRouter(address _flr) external returns (address[] memory, uint256[] memory) {\r\n IFlywheelLensRouter_LP flr = IFlywheelLensRouter_LP(_flr);\r\n (address[] memory rewardTokens, uint256[] memory rewards) = flr.claimAllRewardTokens(address(this));\r\n for (uint256 i = 0; i < rewardTokens.length; i++) {\r\n IERC20Upgradeable(rewardTokens[i]).safeTransfer(positionOwner, rewards[i]);\r\n }\r\n return (rewardTokens, rewards);\r\n }\r\n\r\n fallback() external {\r\n address extension = factory.getPositionsExtension(msg.sig);\r\n if (extension == address(0)) revert ExtNotFound(msg.sig);\r\n // Execute external function from extension using delegatecall and return any value.\r\n assembly {\r\n // copy function selector and any arguments\r\n calldatacopy(0, 0, calldatasize())\r\n // execute function call using the extension\r\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\r\n // get any return value\r\n returndatacopy(0, 0, returndatasize())\r\n // return any return value or error back to the caller\r\n switch result\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n View Functions\r\n ----------------------------------------------------------------*/\r\n\r\n /// @notice this is a lens fn, it is not intended to be used on-chain\r\n function getAccruedRewards()\r\n external\r\n returns (\r\n /*view*/\r\n ERC20[] memory rewardTokens,\r\n uint256[] memory amounts\r\n )\r\n {\r\n address[] memory flywheels = pool.getRewardsDistributors();\r\n\r\n rewardTokens = new ERC20[](flywheels.length);\r\n amounts = new uint256[](flywheels.length);\r\n\r\n for (uint256 i = 0; i < flywheels.length; i++) {\r\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\r\n fw.accrue(ERC20(address(collateralMarket)), address(this));\r\n fw.accrue(ERC20(address(stableMarket)), address(this));\r\n rewardTokens[i] = fw.rewardToken();\r\n amounts[i] = fw.rewardsAccrued(address(this));\r\n }\r\n }\r\n\r\n function getCurrentLeverageRatio() public view returns (uint256) {\r\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\r\n if (positionSupplyAmount == 0) return 0;\r\n\r\n BasePriceOracle oracle = pool.oracle();\r\n\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\r\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\r\n\r\n uint256 debtValue = 0;\r\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\r\n if (debtAmount > 0) {\r\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\r\n }\r\n\r\n // TODO check if positionValue > debtValue\r\n // s / ( s - b )\r\n return (positionValue * 1e18) / (positionValue - debtValue);\r\n }\r\n\r\n function getMinLeverageRatio() public view returns (uint256) {\r\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\r\n if (positionSupplyAmount == 0) return 0;\r\n\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n uint256 minStableBorrowAmount = (factory.getMinBorrowNative() * 1e18) / borrowedAssetPrice;\r\n return _getLeverageRatioAfterBorrow(minStableBorrowAmount, positionSupplyAmount, 0);\r\n }\r\n\r\n function getMaxLeverageRatio() public view returns (uint256) {\r\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\r\n if (positionSupplyAmount == 0) return 0;\r\n\r\n uint256 maxBorrow = pool.getMaxRedeemOrBorrow(address(this), stableMarket, true);\r\n uint256 positionBorrowAmount = stableMarket.borrowBalanceCurrent(address(this));\r\n return _getLeverageRatioAfterBorrow(maxBorrow, positionSupplyAmount, positionBorrowAmount);\r\n }\r\n\r\n function _getLeverageRatioAfterBorrow(\r\n uint256 newBorrowsAmount,\r\n uint256 positionSupplyAmount,\r\n uint256 positionBorrowAmount\r\n ) internal view returns (uint256 r) {\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\r\n\r\n uint256 currentBorrowsValue = (positionBorrowAmount * stableAssetPrice) / 1e18;\r\n uint256 newBorrowsValue = (newBorrowsAmount * stableAssetPrice) / 1e18;\r\n uint256 positionValue = (positionSupplyAmount * collateralAssetPrice) / 1e18;\r\n\r\n // accounting for swaps slippage\r\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\r\n {\r\n // add 10 bps just to not go under the min borrow value\r\n assumedSlippage += 10;\r\n }\r\n uint256 topUpCollateralValue = (newBorrowsValue * 10000) / (10000 + assumedSlippage);\r\n\r\n int256 s = int256(positionValue);\r\n int256 b = int256(currentBorrowsValue);\r\n int256 x = int256(topUpCollateralValue);\r\n\r\n r = uint256(((s + x) * 1e18) / (s + x - b - int256(newBorrowsValue)));\r\n }\r\n\r\n function isPositionClosed() public view returns (bool) {\r\n return collateralMarket.balanceOfUnderlying(address(this)) == 0;\r\n }\r\n\r\n function getEquityAmount() external view returns (uint256 equityAmount) {\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\r\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\r\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\r\n\r\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\r\n uint256 debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\r\n\r\n uint256 equityValue = positionValue - debtValue;\r\n equityAmount = (equityValue * 1e18) / collateralAssetPrice;\r\n }\r\n\r\n function getSupplyAmountDelta(uint256 targetRatio) public view returns (uint256, uint256) {\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\r\n\r\n uint256 currentRatio = getCurrentLeverageRatio();\r\n bool up = targetRatio > currentRatio;\r\n return _getSupplyAmountDelta(up, targetRatio, collateralAssetPrice, stableAssetPrice);\r\n }\r\n\r\n function _getSupplyAmountDelta(\r\n bool up,\r\n uint256 targetRatio,\r\n uint256 collateralAssetPrice,\r\n uint256 borrowedAssetPrice\r\n ) internal view returns (uint256 supplyDelta, uint256 borrowsDelta) {\r\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\r\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\r\n uint256 assumedSlippage;\r\n if (up) assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\r\n else assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\r\n uint256 slippageFactor = (1e18 * (10000 + assumedSlippage)) / 10000;\r\n\r\n uint256 supplyValueDeltaAbs;\r\n {\r\n // s = supply value before\r\n // b = borrow value before\r\n // r = target ratio after\r\n // c = borrow value coefficient to account for the slippage\r\n int256 s = int256((collateralAssetPrice * positionSupplyAmount) / 1e18);\r\n int256 b = int256((borrowedAssetPrice * debtAmount) / 1e18);\r\n int256 r = int256(targetRatio);\r\n int256 r1 = r - 1e18;\r\n int256 c = int256(slippageFactor);\r\n\r\n // some math magic here\r\n // https://www.wolframalpha.com/input?i2d=true&i=r%3D%5C%2840%29Divide%5B%5C%2840%29s%2Bx%5C%2841%29%2C%5C%2840%29s%2Bx-b-c*x%5C%2841%29%5D+%5C%2841%29+solve+for+x\r\n\r\n // x = supplyValueDelta\r\n int256 supplyValueDelta = (((r1 * s) - (b * r)) * 1e18) / ((c * r) - (1e18 * r1));\r\n supplyValueDeltaAbs = uint256((supplyValueDelta < 0) ? -supplyValueDelta : supplyValueDelta);\r\n }\r\n\r\n supplyDelta = (supplyValueDeltaAbs * 1e18) / collateralAssetPrice;\r\n borrowsDelta = (supplyValueDeltaAbs * 1e18) / borrowedAssetPrice;\r\n\r\n if (up) {\r\n // stables to borrow = c * x\r\n borrowsDelta = (borrowsDelta * slippageFactor) / 1e18;\r\n } else {\r\n // amount to redeem = c * x\r\n supplyDelta = (supplyDelta * slippageFactor) / 1e18;\r\n }\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n Internal Functions\r\n ----------------------------------------------------------------*/\r\n\r\n function _supplyCollateral(IERC20Upgradeable fundingAsset) internal returns (uint256 amountToSupply) {\r\n // in case the funding is with a different asset\r\n if (address(collateralAsset) != address(fundingAsset)) {\r\n // swap for collateral asset\r\n convertAllTo(fundingAsset, collateralAsset);\r\n }\r\n\r\n // supply the collateral\r\n amountToSupply = collateralAsset.balanceOf(address(this));\r\n collateralAsset.approve(address(collateralMarket), amountToSupply);\r\n uint256 errorCode = collateralMarket.mint(amountToSupply);\r\n if (errorCode != 0) revert SupplyCollateralFailed(errorCode);\r\n }\r\n\r\n // @dev flash loan the needed amount, then borrow stables and swap them for the amount needed to repay the FL\r\n function _leverUp(uint256 targetRatio) internal {\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\r\n\r\n (uint256 flashLoanCollateralAmount, uint256 stableToBorrow) = _getSupplyAmountDelta(\r\n true,\r\n targetRatio,\r\n collateralAssetPrice,\r\n stableAssetPrice\r\n );\r\n\r\n collateralMarket.flash(flashLoanCollateralAmount, abi.encode(stableToBorrow));\r\n // the execution will first receive a callback to receiveFlashLoan()\r\n // then it continues from here\r\n\r\n // all stables are swapped for collateral to repay the FL\r\n uint256 collateralLeftovers = collateralAsset.balanceOf(address(this));\r\n if (collateralLeftovers > 0) {\r\n collateralAsset.approve(address(collateralMarket), collateralLeftovers);\r\n collateralMarket.mint(collateralLeftovers);\r\n }\r\n }\r\n\r\n // @dev supply the flash loaned collateral and then borrow stables with it\r\n function _leverUpPostFL(uint256 stableToBorrow) internal {\r\n // supply the flash loaned collateral\r\n _supplyCollateral(collateralAsset);\r\n\r\n // borrow stables that will be swapped to repay the FL\r\n uint256 errorCode = stableMarket.borrow(stableToBorrow);\r\n if (errorCode != 0) revert BorrowStableFailed(errorCode);\r\n\r\n // swap for the FL asset\r\n convertAllTo(stableAsset, collateralAsset);\r\n }\r\n\r\n // @dev redeems the supplied collateral by first repaying the debt with which it was levered\r\n function _leverDown(uint256 targetRatio) internal {\r\n uint256 amountToRedeem;\r\n uint256 borrowsToRepay;\r\n\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\r\n\r\n if (targetRatio <= 1e18) {\r\n // if max levering down, then derive the amount to redeem from the debt to be repaid\r\n borrowsToRepay = stableMarket.borrowBalanceCurrent(address(this));\r\n uint256 borrowsToRepayValueScaled = borrowsToRepay * stableAssetPrice;\r\n // accounting for swaps slippage\r\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\r\n uint256 amountToRedeemValueScaled = (borrowsToRepayValueScaled * (10000 + assumedSlippage)) / 10000;\r\n amountToRedeem = amountToRedeemValueScaled / collateralAssetPrice;\r\n // round up when dividing in order to redeem enough (otherwise calcs could be exploited)\r\n if (amountToRedeemValueScaled % collateralAssetPrice > 0) amountToRedeem += 1;\r\n } else {\r\n // else derive the debt to be repaid from the amount to redeem\r\n (amountToRedeem, borrowsToRepay) = _getSupplyAmountDelta(\r\n false,\r\n targetRatio,\r\n collateralAssetPrice,\r\n stableAssetPrice\r\n );\r\n // the slippage is already accounted for in _getSupplyAmountDelta\r\n }\r\n\r\n if (borrowsToRepay > 0) {\r\n ICErc20(address(stableMarket)).flash(borrowsToRepay, abi.encode(amountToRedeem));\r\n // the execution will first receive a callback to receiveFlashLoan()\r\n // then it continues from here\r\n }\r\n\r\n // all the redeemed collateral is swapped for stables to repay the FL\r\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\r\n if (stableLeftovers > 0) {\r\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\r\n if (borrowBalance > 0) {\r\n // whatever is smaller\r\n uint256 amountToRepay = borrowBalance > stableLeftovers ? stableLeftovers : borrowBalance;\r\n stableAsset.approve(address(stableMarket), amountToRepay);\r\n stableMarket.repayBorrow(amountToRepay);\r\n }\r\n }\r\n }\r\n\r\n function _leverDownPostFL(uint256 _flashLoanedCollateral, uint256 _amountToRedeem) internal {\r\n // repay the borrows\r\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\r\n uint256 repayAmount = _flashLoanedCollateral < borrowBalance ? _flashLoanedCollateral : borrowBalance;\r\n stableAsset.approve(address(stableMarket), repayAmount);\r\n uint256 errorCode = stableMarket.repayBorrow(repayAmount);\r\n if (errorCode != 0) revert RepayBorrowFailed(errorCode);\r\n\r\n // redeem the corresponding amount needed to repay the FL\r\n errorCode = collateralMarket.redeemUnderlying(_amountToRedeem);\r\n if (errorCode != 0) revert RedeemCollateralFailed(errorCode);\r\n\r\n // swap for the FL asset\r\n convertAllTo(collateralAsset, stableAsset);\r\n }\r\n\r\n function convertAllTo(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) private returns (uint256 outputAmount) {\r\n uint256 inputAmount = inputToken.balanceOf(address(this));\r\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = factory\r\n .getRedemptionStrategies(inputToken, outputToken);\r\n\r\n if (redemptionStrategies.length == 0) revert ConvertFundsFailed();\r\n\r\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\r\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\r\n bytes memory strategyData = strategiesData[i];\r\n (outputToken, outputAmount) = convertCustomFunds(inputToken, inputAmount, redemptionStrategy, strategyData);\r\n inputAmount = outputAmount;\r\n inputToken = outputToken;\r\n }\r\n }\r\n\r\n function convertCustomFunds(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IRedemptionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\r\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n function _verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n if (returndata.length > 0) {\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/levered/LeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\r\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\r\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\r\nimport { DiamondBase, DiamondExtension, LibDiamond } from \"../../ionic/DiamondExtension.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\ncontract LeveredPositionFactory is LeveredPositionFactoryStorage, DiamondBase {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n /*----------------------------------------------------------------\r\n Constructor\r\n ----------------------------------------------------------------*/\r\n\r\n constructor(IFeeDistributor _feeDistributor, ILiquidatorsRegistry _registry, uint256 _blocksPerYear) {\r\n feeDistributor = _feeDistributor;\r\n liquidatorsRegistry = _registry;\r\n blocksPerYear = _blocksPerYear;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n Admin Functions\r\n ----------------------------------------------------------------*/\r\n\r\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external onlyOwner {\r\n require(_collateralMarket.comptroller() == _stableMarket.comptroller(), \"markets not of the same pool\");\r\n\r\n if (_whitelisted) {\r\n collateralMarkets.add(address(_collateralMarket));\r\n borrowableMarketsByCollateral[_collateralMarket].add(address(_stableMarket));\r\n } else {\r\n borrowableMarketsByCollateral[_collateralMarket].remove(address(_stableMarket));\r\n if (borrowableMarketsByCollateral[_collateralMarket].length() == 0)\r\n collateralMarkets.remove(address(_collateralMarket));\r\n }\r\n }\r\n\r\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external onlyOwner {\r\n liquidatorsRegistry = _liquidatorsRegistry;\r\n }\r\n\r\n function _registerExtension(\r\n DiamondExtension extensionToAdd,\r\n DiamondExtension extensionToReplace\r\n ) public override onlyOwner {\r\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\r\n }\r\n}\r\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryFirstExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport \"../../ionic/DiamondExtension.sol\";\r\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\r\nimport { ILeveredPositionFactoryFirstExtension } from \"./ILeveredPositionFactory.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\r\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\r\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\r\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\r\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\ncontract LeveredPositionFactoryFirstExtension is\r\n LeveredPositionFactoryStorage,\r\n DiamondExtension,\r\n ILeveredPositionFactoryFirstExtension\r\n{\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n error PairNotWhitelisted();\r\n error NoSuchPosition();\r\n error PositionNotClosed();\r\n\r\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\r\n uint8 fnsCount = 10;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.removeClosedPosition.selector;\r\n functionSelectors[--fnsCount] = this.closeAndRemoveUserPosition.selector;\r\n functionSelectors[--fnsCount] = this.getMinBorrowNative.selector;\r\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\r\n functionSelectors[--fnsCount] = this.getBorrowableMarketsByCollateral.selector;\r\n functionSelectors[--fnsCount] = this.getWhitelistedCollateralMarkets.selector;\r\n functionSelectors[--fnsCount] = this.getAccountsWithOpenPositions.selector;\r\n functionSelectors[--fnsCount] = this.getPositionsByAccount.selector;\r\n functionSelectors[--fnsCount] = this.getPositionsExtension.selector;\r\n functionSelectors[--fnsCount] = this._setPositionsExtension.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n Mutable Functions\r\n ----------------------------------------------------------------*/\r\n\r\n // @return true if removed, otherwise false\r\n function removeClosedPosition(address closedPosition) external returns (bool) {\r\n return _removeClosedPosition(closedPosition, msg.sender);\r\n }\r\n\r\n function closeAndRemoveUserPosition(LeveredPosition position) external onlyOwner returns (bool) {\r\n address positionOwner = position.positionOwner();\r\n position.closePosition(positionOwner);\r\n return _removeClosedPosition(address(position), positionOwner);\r\n }\r\n\r\n function _removeClosedPosition(address closedPosition, address positionOwner) internal returns (bool removed) {\r\n EnumerableSet.AddressSet storage userPositions = positionsByAccount[positionOwner];\r\n if (!userPositions.contains(closedPosition)) revert NoSuchPosition();\r\n if (!LeveredPosition(closedPosition).isPositionClosed()) revert PositionNotClosed();\r\n\r\n removed = userPositions.remove(closedPosition);\r\n if (userPositions.length() == 0) accountsWithOpenPositions.remove(positionOwner);\r\n }\r\n\r\n function _setPositionsExtension(bytes4 msgSig, address extension) external onlyOwner {\r\n _positionsExtensions[msgSig] = extension;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n View Functions\r\n ----------------------------------------------------------------*/\r\n\r\n function getMinBorrowNative() external view returns (uint256) {\r\n return feeDistributor.minBorrowEth();\r\n }\r\n\r\n function getRedemptionStrategies(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\r\n return liquidatorsRegistry.getRedemptionStrategies(inputToken, outputToken);\r\n }\r\n\r\n function getPositionsByAccount(\r\n address account\r\n ) external view returns (address[] memory positions, bool[] memory closed) {\r\n positions = positionsByAccount[account].values();\r\n closed = new bool[](positions.length);\r\n for (uint256 i = 0; i < positions.length; i++) {\r\n closed[i] = LeveredPosition(positions[i]).isPositionClosed();\r\n }\r\n }\r\n\r\n function getAccountsWithOpenPositions() external view returns (address[] memory) {\r\n return accountsWithOpenPositions.values();\r\n }\r\n\r\n function getWhitelistedCollateralMarkets() external view returns (address[] memory) {\r\n return collateralMarkets.values();\r\n }\r\n\r\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory) {\r\n return borrowableMarketsByCollateral[_collateralMarket].values();\r\n }\r\n\r\n function getPositionsExtension(bytes4 msgSig) external view returns (address) {\r\n return _positionsExtensions[msgSig];\r\n }\r\n}\r\n" + }, + "contracts/ionic/levered/LeveredPositionFactorySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport \"../../ionic/DiamondExtension.sol\";\r\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\r\nimport { ILeveredPositionFactorySecondExtension } from \"./ILeveredPositionFactory.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\r\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\r\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\r\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\r\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\ncontract LeveredPositionFactorySecondExtension is\r\n LeveredPositionFactoryStorage,\r\n DiamondExtension,\r\n ILeveredPositionFactorySecondExtension\r\n{\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n error PairNotWhitelisted();\r\n\r\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\r\n uint8 fnsCount = 3;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.createPosition.selector;\r\n functionSelectors[--fnsCount] = this.createAndFundPosition.selector;\r\n functionSelectors[--fnsCount] = this.createAndFundPositionAtRatio.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n Mutable Functions\r\n ----------------------------------------------------------------*/\r\n\r\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) public returns (LeveredPosition) {\r\n if (!borrowableMarketsByCollateral[_collateralMarket].contains(address(_stableMarket))) revert PairNotWhitelisted();\r\n\r\n LeveredPosition position = new LeveredPosition(msg.sender, _collateralMarket, _stableMarket);\r\n\r\n accountsWithOpenPositions.add(msg.sender);\r\n positionsByAccount[msg.sender].add(address(position));\r\n\r\n AuthoritiesRegistry authoritiesRegistry = feeDistributor.authoritiesRegistry();\r\n address poolAddress = address(_collateralMarket.comptroller());\r\n PoolRolesAuthority poolAuth = authoritiesRegistry.poolsAuthorities(poolAddress);\r\n if (address(poolAuth) != address(0)) {\r\n authoritiesRegistry.setUserRole(poolAddress, address(position), poolAuth.LEVERED_POSITION_ROLE(), true);\r\n }\r\n\r\n return position;\r\n }\r\n\r\n function createAndFundPosition(\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket,\r\n IERC20Upgradeable _fundingAsset,\r\n uint256 _fundingAmount\r\n ) public returns (LeveredPosition) {\r\n LeveredPosition position = createPosition(_collateralMarket, _stableMarket);\r\n _fundingAsset.safeTransferFrom(msg.sender, address(this), _fundingAmount);\r\n _fundingAsset.approve(address(position), _fundingAmount);\r\n position.fundPosition(_fundingAsset, _fundingAmount);\r\n return position;\r\n }\r\n\r\n function createAndFundPositionAtRatio(\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket,\r\n IERC20Upgradeable _fundingAsset,\r\n uint256 _fundingAmount,\r\n uint256 _leverageRatio\r\n ) external returns (LeveredPosition) {\r\n LeveredPosition position = createAndFundPosition(_collateralMarket, _stableMarket, _fundingAsset, _fundingAmount);\r\n if (_leverageRatio > 1e18) {\r\n position.adjustLeverageRatio(_leverageRatio);\r\n }\r\n return position;\r\n }\r\n}\r\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\r\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\r\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\nabstract contract LeveredPositionFactoryStorage is SafeOwnable {\r\n EnumerableSet.AddressSet internal accountsWithOpenPositions;\r\n mapping(address => EnumerableSet.AddressSet) internal positionsByAccount;\r\n EnumerableSet.AddressSet internal collateralMarkets;\r\n mapping(ICErc20 => EnumerableSet.AddressSet) internal borrowableMarketsByCollateral;\r\n\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) private __unused;\r\n\r\n IFeeDistributor public feeDistributor;\r\n ILiquidatorsRegistry public liquidatorsRegistry;\r\n uint256 public blocksPerYear;\r\n\r\n mapping(bytes4 => address) internal _positionsExtensions;\r\n}\r\n" + }, + "contracts/ionic/levered/LeveredPositionsLens.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\r\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\r\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\ncontract LeveredPositionsLens is Initializable {\r\n ILeveredPositionFactory public factory;\r\n\r\n function initialize(ILeveredPositionFactory _factory) external initializer {\r\n factory = _factory;\r\n }\r\n\r\n function reinitialize(ILeveredPositionFactory _factory) external reinitializer(2) {\r\n factory = _factory;\r\n }\r\n\r\n /// @notice this is a lens fn, it is not intended to be used on-chain\r\n /// @dev returns lists of the market addresses, names and symbols of the underlying assets of those collateral markets that are whitelisted\r\n function getCollateralMarkets()\r\n external\r\n view\r\n returns (\r\n address[] memory markets,\r\n IonicComptroller[] memory poolOfMarket,\r\n address[] memory underlyings,\r\n uint256[] memory underlyingPrices,\r\n string[] memory names,\r\n string[] memory symbols,\r\n uint8[] memory decimals,\r\n uint256[] memory totalUnderlyingSupplied,\r\n uint256[] memory ratesPerBlock\r\n )\r\n {\r\n markets = factory.getWhitelistedCollateralMarkets();\r\n poolOfMarket = new IonicComptroller[](markets.length);\r\n underlyings = new address[](markets.length);\r\n underlyingPrices = new uint256[](markets.length);\r\n names = new string[](markets.length);\r\n symbols = new string[](markets.length);\r\n totalUnderlyingSupplied = new uint256[](markets.length);\r\n decimals = new uint8[](markets.length);\r\n ratesPerBlock = new uint256[](markets.length);\r\n for (uint256 i = 0; i < markets.length; i++) {\r\n ICErc20 market = ICErc20(markets[i]);\r\n poolOfMarket[i] = market.comptroller();\r\n underlyingPrices[i] = BasePriceOracle(poolOfMarket[i].oracle()).getUnderlyingPrice(market);\r\n underlyings[i] = market.underlying();\r\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyings[i]);\r\n names[i] = underlying.name();\r\n symbols[i] = underlying.symbol();\r\n decimals[i] = underlying.decimals();\r\n totalUnderlyingSupplied[i] = market.getTotalUnderlyingSupplied();\r\n ratesPerBlock[i] = market.supplyRatePerBlock();\r\n }\r\n }\r\n\r\n /// @notice this is a lens fn, it is not intended to be used on-chain\r\n /// @dev returns the Rate for the chosen borrowable at the specified leverage ratio and supply amount\r\n function getBorrowRateAtRatio(\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket,\r\n uint256 _equityAmount,\r\n uint256 _targetLeverageRatio\r\n ) external view returns (uint256) {\r\n IonicComptroller pool = IonicComptroller(_stableMarket.comptroller());\r\n BasePriceOracle oracle = pool.oracle();\r\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(_stableMarket);\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\r\n\r\n uint256 borrowAmount = ((_targetLeverageRatio - 1e18) * _equityAmount * collateralAssetPrice) /\r\n (stableAssetPrice * 1e18);\r\n return _stableMarket.borrowRatePerBlockAfterBorrow(borrowAmount) * factory.blocksPerYear();\r\n }\r\n\r\n /// @notice this is a lens fn, it is not intended to be used on-chain\r\n /// @dev returns lists of the market addresses, names, symbols and the current Rate for each Borrowable asset\r\n function getBorrowableMarketsAndRates(\r\n ICErc20 _collateralMarket\r\n )\r\n external\r\n view\r\n returns (\r\n address[] memory markets,\r\n address[] memory underlyings,\r\n uint256[] memory underlyingsPrices,\r\n string[] memory names,\r\n string[] memory symbols,\r\n uint256[] memory rates,\r\n uint8[] memory decimals\r\n )\r\n {\r\n markets = factory.getBorrowableMarketsByCollateral(_collateralMarket);\r\n underlyings = new address[](markets.length);\r\n names = new string[](markets.length);\r\n symbols = new string[](markets.length);\r\n rates = new uint256[](markets.length);\r\n decimals = new uint8[](markets.length);\r\n underlyingsPrices = new uint256[](markets.length);\r\n for (uint256 i = 0; i < markets.length; i++) {\r\n ICErc20 market = ICErc20(markets[i]);\r\n address underlyingAddress = market.underlying();\r\n underlyings[i] = underlyingAddress;\r\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyingAddress);\r\n names[i] = underlying.name();\r\n symbols[i] = underlying.symbol();\r\n rates[i] = market.borrowRatePerBlock();\r\n decimals[i] = underlying.decimals();\r\n underlyingsPrices[i] = market.comptroller().oracle().getUnderlyingPrice(market);\r\n }\r\n }\r\n\r\n /// @notice this is a lens fn, it is not intended to be used on-chain\r\n function getNetAPY(\r\n uint256 _supplyAPY,\r\n uint256 _supplyAmount,\r\n ICErc20 _collateralMarket,\r\n ICErc20 _stableMarket,\r\n uint256 _targetLeverageRatio\r\n ) public view returns (int256 netAPY) {\r\n if (_supplyAmount == 0 || _targetLeverageRatio <= 1e18) return 0;\r\n\r\n IonicComptroller pool = IonicComptroller(_collateralMarket.comptroller());\r\n BasePriceOracle oracle = pool.oracle();\r\n // TODO the calcs can be implemented without using collateralAssetPrice\r\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\r\n\r\n // total collateral = base collateral + levered collateral\r\n uint256 totalCollateral = (_supplyAmount * _targetLeverageRatio) / 1e18;\r\n uint256 yieldFromTotalSupplyScaled = _supplyAPY * totalCollateral;\r\n int256 yieldValueScaled = int256((yieldFromTotalSupplyScaled * collateralAssetPrice) / 1e18);\r\n\r\n uint256 borrowedValueScaled = (totalCollateral - _supplyAmount) * collateralAssetPrice;\r\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\r\n int256 borrowInterestValueScaled = int256((_borrowRate * borrowedValueScaled) / 1e18);\r\n\r\n int256 netValueDiffScaled = yieldValueScaled - borrowInterestValueScaled;\r\n\r\n netAPY = ((netValueDiffScaled / int256(collateralAssetPrice)) * 1e18) / int256(_supplyAmount);\r\n }\r\n\r\n function getPositionsInfo(\r\n LeveredPosition[] calldata positions,\r\n uint256[] calldata supplyApys\r\n ) external view returns (PositionInfo[] memory infos) {\r\n infos = new PositionInfo[](positions.length);\r\n for (uint256 i = 0; i < positions.length; i++) {\r\n infos[i] = getPositionInfo(positions[i], supplyApys[i]);\r\n }\r\n }\r\n\r\n function getLeverageRatioAfterFunding(LeveredPosition pos, uint256 newFunding) public view returns (uint256) {\r\n uint256 equityAmount = pos.getEquityAmount();\r\n if (equityAmount == 0 && newFunding == 0) return 0;\r\n\r\n uint256 suppliedCollateralCurrent = pos.collateralMarket().balanceOfUnderlying(address(pos));\r\n return ((suppliedCollateralCurrent + newFunding) * 1e18) / (equityAmount + newFunding);\r\n }\r\n\r\n function getNetApyForPositionAfterFunding(\r\n LeveredPosition pos,\r\n uint256 supplyAPY,\r\n uint256 newFunding\r\n ) public view returns (int256) {\r\n return\r\n getNetAPY(\r\n supplyAPY,\r\n pos.getEquityAmount() + newFunding,\r\n pos.collateralMarket(),\r\n pos.stableMarket(),\r\n getLeverageRatioAfterFunding(pos, newFunding)\r\n );\r\n }\r\n\r\n function getNetApyForPosition(LeveredPosition pos, uint256 supplyAPY) public view returns (int256) {\r\n return getNetApyForPositionAfterFunding(pos, supplyAPY, 0);\r\n }\r\n\r\n struct PositionInfo {\r\n uint256 collateralAssetPrice;\r\n uint256 borrowedAssetPrice;\r\n uint256 positionSupplyAmount;\r\n uint256 positionValue;\r\n uint256 debtAmount;\r\n uint256 debtValue;\r\n uint256 equityAmount;\r\n uint256 equityValue;\r\n int256 currentApy;\r\n uint256 debtRatio;\r\n uint256 liquidationThreshold;\r\n uint256 safetyBuffer;\r\n }\r\n\r\n function getPositionInfo(LeveredPosition pos, uint256 supplyApy) public view returns (PositionInfo memory info) {\r\n ICErc20 collateralMarket = pos.collateralMarket();\r\n IonicComptroller pool = pos.pool();\r\n info.collateralAssetPrice = pool.oracle().getUnderlyingPrice(collateralMarket);\r\n {\r\n info.positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(pos));\r\n info.positionValue = (info.collateralAssetPrice * info.positionSupplyAmount) / 1e18;\r\n info.currentApy = getNetApyForPosition(pos, supplyApy);\r\n }\r\n\r\n {\r\n ICErc20 stableMarket = pos.stableMarket();\r\n info.borrowedAssetPrice = pool.oracle().getUnderlyingPrice(stableMarket);\r\n info.debtAmount = stableMarket.borrowBalanceCurrent(address(pos));\r\n info.debtValue = (info.borrowedAssetPrice * info.debtAmount) / 1e18;\r\n info.equityValue = info.positionValue - info.debtValue;\r\n info.debtRatio = info.positionValue == 0 ? 0 : (info.debtValue * 1e18) / info.positionValue;\r\n info.equityAmount = (info.equityValue * 1e18) / info.collateralAssetPrice;\r\n }\r\n\r\n {\r\n (, uint256 collateralFactor) = pool.markets(address(collateralMarket));\r\n info.liquidationThreshold = collateralFactor;\r\n info.safetyBuffer = collateralFactor - info.debtRatio;\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/levered/LeveredPositionStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\r\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ncontract LeveredPositionStorage {\r\n address public immutable positionOwner;\r\n ILeveredPositionFactory public factory;\r\n\r\n ICErc20 public collateralMarket;\r\n ICErc20 public stableMarket;\r\n IonicComptroller public pool;\r\n\r\n IERC20Upgradeable public collateralAsset;\r\n IERC20Upgradeable public stableAsset;\r\n\r\n constructor(address _positionOwner) {\r\n positionOwner = _positionOwner;\r\n }\r\n}\r\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\r\n\r\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\n\r\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\r\n constructor() RolesAuthority(address(0), Authority(address(0))) {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(address _owner) public initializer {\r\n owner = _owner;\r\n authority = this;\r\n }\r\n\r\n // up to 256 roles\r\n uint8 public constant REGISTRY_ROLE = 0;\r\n uint8 public constant SUPPLIER_ROLE = 1;\r\n uint8 public constant BORROWER_ROLE = 2;\r\n uint8 public constant LIQUIDATOR_ROLE = 3;\r\n uint8 public constant LEVERED_POSITION_ROLE = 4;\r\n\r\n function configureRegistryCapabilities() external requiresAuth {\r\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\r\n }\r\n\r\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolSupplierCapabilities(pool, true);\r\n }\r\n\r\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolSupplierCapabilities(pool, false);\r\n }\r\n\r\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\r\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\r\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n bytes4[] memory selectors = getSupplierMarketSelectors();\r\n for (uint256 j = 0; j < selectors.length; j++) {\r\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\r\n }\r\n }\r\n }\r\n\r\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\r\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\r\n }\r\n\r\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\r\n uint8 fnsCount = 6;\r\n selectors = new bytes4[](fnsCount);\r\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\r\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\r\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\r\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\r\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\r\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return selectors;\r\n }\r\n\r\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\r\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\r\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n bytes4[] memory selectors = getSupplierMarketSelectors();\r\n for (uint256 j = 0; j < selectors.length; j++) {\r\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\r\n }\r\n }\r\n }\r\n\r\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolBorrowerCapabilities(pool, true);\r\n }\r\n\r\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolBorrowerCapabilities(pool, false);\r\n }\r\n\r\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\r\n }\r\n }\r\n\r\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\r\n // borrowers have the SUPPLIER_ROLE capabilities by default\r\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\r\n }\r\n }\r\n\r\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\r\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\r\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\r\n }\r\n }\r\n\r\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\r\n // TODO this leaves redeeming open for everyone\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\r\n }\r\n }\r\n\r\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\r\n\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/RewardsClaimer.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity ^0.8.10;\r\n\r\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\ncontract RewardsClaimer is Initializable {\r\n using SafeERC20Upgradeable for ERC20Upgradeable;\r\n\r\n event RewardDestinationUpdate(address indexed newDestination);\r\n\r\n event ClaimRewards(address indexed rewardToken, uint256 amount);\r\n\r\n /// @notice the address to send rewards\r\n address public rewardDestination;\r\n\r\n /// @notice the array of reward tokens to send to\r\n ERC20Upgradeable[] public rewardTokens;\r\n\r\n function __RewardsClaimer_init(\r\n address _rewardDestination,\r\n ERC20Upgradeable[] memory _rewardTokens\r\n ) internal onlyInitializing {\r\n rewardDestination = _rewardDestination;\r\n rewardTokens = _rewardTokens;\r\n }\r\n\r\n /// @notice claim all token rewards\r\n function claimRewards() public {\r\n beforeClaim(); // hook to accrue/pull in rewards, if needed\r\n\r\n uint256 len = rewardTokens.length;\r\n // send all tokens to destination\r\n for (uint256 i = 0; i < len; i++) {\r\n ERC20Upgradeable token = rewardTokens[i];\r\n uint256 amount = token.balanceOf(address(this));\r\n\r\n token.safeTransfer(rewardDestination, amount);\r\n\r\n emit ClaimRewards(address(token), amount);\r\n }\r\n }\r\n\r\n /// @notice set the address of the new reward destination\r\n /// @param newDestination the new reward destination\r\n function setRewardDestination(address newDestination) external {\r\n require(msg.sender == rewardDestination, \"UNAUTHORIZED\");\r\n rewardDestination = newDestination;\r\n emit RewardDestinationUpdate(newDestination);\r\n }\r\n\r\n /// @notice hook to accrue/pull in rewards, if needed\r\n function beforeClaim() internal virtual {}\r\n}\r\n" + }, + "contracts/ionic/SafeOwnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable2Step.sol\";\r\n\r\nabstract contract SafeOwnable is Ownable2Step {\r\n function renounceOwnership() public override onlyOwner {\r\n revert(\"renounce ownership not allowed\");\r\n }\r\n}\r\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\r\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\r\n * that will shift the other.\r\n */\r\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\r\n /**\r\n * @notice Pending owner of this contract\r\n */\r\n address public pendingOwner;\r\n\r\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\r\n __Ownable_init();\r\n _transferOwnership(owner_);\r\n }\r\n\r\n struct AddressSlot {\r\n address value;\r\n }\r\n\r\n modifier onlyOwnerOrAdmin() {\r\n bool isOwner = owner() == _msgSender();\r\n if (!isOwner) {\r\n address admin = _getProxyAdmin();\r\n bool isAdmin = admin == _msgSender();\r\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\r\n }\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Emitted when pendingOwner is changed\r\n */\r\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\r\n\r\n /**\r\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\r\n */\r\n event NewOwner(address oldOwner, address newOwner);\r\n\r\n /**\r\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\r\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\r\n * @param newPendingOwner New pending owner.\r\n */\r\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\r\n // Save current value, if any, for inclusion in log\r\n address oldPendingOwner = pendingOwner;\r\n\r\n // Store pendingOwner with value newPendingOwner\r\n pendingOwner = newPendingOwner;\r\n\r\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\r\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\r\n }\r\n\r\n /**\r\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\r\n * @dev Owner function for pending owner to accept role and update owner\r\n */\r\n function _acceptOwner() public {\r\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\r\n require(msg.sender == pendingOwner, \"not the pending owner\");\r\n\r\n // Save current values for inclusion in log\r\n address oldOwner = owner();\r\n address oldPendingOwner = pendingOwner;\r\n\r\n // Store owner with value pendingOwner\r\n _transferOwnership(pendingOwner);\r\n\r\n // Clear the pending value\r\n pendingOwner = address(0);\r\n\r\n emit NewOwner(oldOwner, pendingOwner);\r\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\r\n }\r\n\r\n function renounceOwnership() public override onlyOwner {\r\n // do not remove this overriding fn\r\n revert(\"not used anymore\");\r\n }\r\n\r\n function transferOwnership(address newOwner) public override onlyOwner {\r\n emit NewPendingOwner(pendingOwner, newOwner);\r\n pendingOwner = newOwner;\r\n }\r\n\r\n function _getProxyAdmin() internal view returns (address admin) {\r\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r\n AddressSlot storage adminSlot;\r\n assembly {\r\n adminSlot.slot := _ADMIN_SLOT\r\n }\r\n admin = adminSlot.value;\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/FlywheelCore.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\r\nimport {SafeTransferLib} from \"solmate/utils/SafeTransferLib.sol\";\r\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\r\n\r\nimport {IFlywheelRewards} from \"./rewards/IFlywheelRewards.sol\";\r\nimport {IFlywheelBooster} from \"./IFlywheelBooster.sol\";\r\n\r\n/**\r\n @title Flywheel Core Incentives Manager\r\n @notice Flywheel is a general framework for managing token incentives.\r\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\r\n\r\n The Core contract maintains three important pieces of state:\r\n * the rewards index which determines how many rewards are owed per token per strategy. User indexes track how far behind the strategy they are to lazily calculate all catch-up rewards.\r\n * the accrued (unclaimed) rewards per user.\r\n * references to the booster and rewards module described below.\r\n\r\n Core does not manage any tokens directly. The rewards module maintains token balances, and approves core to pull transfer them to users when they claim.\r\n\r\n SECURITY NOTE: For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook. \r\n Accrue should be called any time tokens are transferred, minted, or burned.\r\n */\r\ncontract FlywheelCore is Auth {\r\n using SafeTransferLib for ERC20;\r\n using SafeCastLib for uint256;\r\n\r\n /// @notice The token to reward\r\n ERC20 public immutable rewardToken;\r\n\r\n /// @notice append-only list of strategies added\r\n ERC20[] public allStrategies;\r\n\r\n /// @notice the rewards contract for managing streams\r\n IFlywheelRewards public flywheelRewards;\r\n\r\n /// @notice optional booster module for calculating virtual balances on strategies\r\n IFlywheelBooster public flywheelBooster;\r\n\r\n constructor(\r\n ERC20 _rewardToken,\r\n IFlywheelRewards _flywheelRewards,\r\n IFlywheelBooster _flywheelBooster,\r\n address _owner,\r\n Authority _authority\r\n ) Auth(_owner, _authority) {\r\n rewardToken = _rewardToken;\r\n flywheelRewards = _flywheelRewards;\r\n flywheelBooster = _flywheelBooster;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ACCRUE/CLAIM LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /** \r\n @notice Emitted when a user's rewards accrue to a given strategy.\r\n @param strategy the updated rewards strategy\r\n @param user the user of the rewards\r\n @param rewardsDelta how many new rewards accrued to the user\r\n @param rewardsIndex the market index for rewards per token accrued\r\n */\r\n event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);\r\n\r\n /** \r\n @notice Emitted when a user claims accrued rewards.\r\n @param user the user of the rewards\r\n @param amount the amount of rewards claimed\r\n */\r\n event ClaimRewards(address indexed user, uint256 amount);\r\n\r\n /// @notice The accrued but not yet transferred rewards for each user\r\n mapping(address => uint256) public rewardsAccrued;\r\n\r\n /** \r\n @notice accrue rewards for a single user on a strategy\r\n @param strategy the strategy to accrue a user's rewards on\r\n @param user the user to be accrued\r\n @return the cumulative amount of rewards accrued to user (including prior)\r\n */\r\n function accrue(ERC20 strategy, address user) public returns (uint256) {\r\n RewardsState memory state = strategyState[strategy];\r\n\r\n if (state.index == 0) return 0;\r\n\r\n state = accrueStrategy(strategy, state);\r\n return accrueUser(strategy, user, state);\r\n }\r\n\r\n /** \r\n @notice accrue rewards for a two users on a strategy\r\n @param strategy the strategy to accrue a user's rewards on\r\n @param user the first user to be accrued\r\n @param user the second user to be accrued\r\n @return the cumulative amount of rewards accrued to the first user (including prior)\r\n @return the cumulative amount of rewards accrued to the second user (including prior)\r\n */\r\n function accrue(\r\n ERC20 strategy,\r\n address user,\r\n address secondUser\r\n ) public returns (uint256, uint256) {\r\n RewardsState memory state = strategyState[strategy];\r\n\r\n if (state.index == 0) return (0, 0);\r\n\r\n state = accrueStrategy(strategy, state);\r\n return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));\r\n }\r\n\r\n /** \r\n @notice claim rewards for a given user\r\n @param user the user claiming rewards\r\n @dev this function is public, and all rewards transfer to the user\r\n */\r\n function claimRewards(address user) external {\r\n uint256 accrued = rewardsAccrued[user];\r\n\r\n if (accrued != 0) {\r\n rewardsAccrued[user] = 0;\r\n\r\n rewardToken.safeTransferFrom(address(flywheelRewards), user, accrued);\r\n\r\n emit ClaimRewards(user, accrued);\r\n }\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ADMIN LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /** \r\n @notice Emitted when a new strategy is added to flywheel by the admin\r\n @param newStrategy the new added strategy\r\n */\r\n event AddStrategy(address indexed newStrategy);\r\n\r\n /// @notice initialize a new strategy\r\n function addStrategyForRewards(ERC20 strategy) external requiresAuth {\r\n _addStrategyForRewards(strategy);\r\n }\r\n\r\n function _addStrategyForRewards(ERC20 strategy) internal {\r\n require(strategyState[strategy].index == 0, \"strategy\");\r\n strategyState[strategy] = RewardsState({index: ONE, lastUpdatedTimestamp: block.timestamp.safeCastTo32()});\r\n\r\n allStrategies.push(strategy);\r\n emit AddStrategy(address(strategy));\r\n }\r\n\r\n function getAllStrategies() external view returns (ERC20[] memory) {\r\n return allStrategies;\r\n }\r\n\r\n /** \r\n @notice Emitted when the rewards module changes\r\n @param newFlywheelRewards the new rewards module\r\n */\r\n event FlywheelRewardsUpdate(address indexed newFlywheelRewards);\r\n\r\n /// @notice swap out the flywheel rewards contract\r\n function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external requiresAuth {\r\n uint256 oldRewardBalance = rewardToken.balanceOf(address(flywheelRewards));\r\n if (oldRewardBalance > 0) {\r\n rewardToken.safeTransferFrom(address(flywheelRewards), address(newFlywheelRewards), oldRewardBalance);\r\n }\r\n\r\n flywheelRewards = newFlywheelRewards;\r\n\r\n emit FlywheelRewardsUpdate(address(newFlywheelRewards));\r\n }\r\n\r\n /** \r\n @notice Emitted when the booster module changes\r\n @param newBooster the new booster module\r\n */\r\n event FlywheelBoosterUpdate(address indexed newBooster);\r\n\r\n /// @notice swap out the flywheel booster contract\r\n function setBooster(IFlywheelBooster newBooster) external requiresAuth {\r\n flywheelBooster = newBooster;\r\n\r\n emit FlywheelBoosterUpdate(address(newBooster));\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n INTERNAL ACCOUNTING LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n struct RewardsState {\r\n /// @notice The strategy's last updated index\r\n uint224 index;\r\n /// @notice The timestamp the index was last updated at\r\n uint32 lastUpdatedTimestamp;\r\n }\r\n\r\n /// @notice the fixed point factor of flywheel\r\n uint224 public constant ONE = 1e18;\r\n\r\n /// @notice The strategy index and last updated per strategy\r\n mapping(ERC20 => RewardsState) public strategyState;\r\n\r\n /// @notice user index per strategy\r\n mapping(ERC20 => mapping(address => uint224)) public userIndex;\r\n\r\n /// @notice accumulate global rewards on a strategy\r\n function accrueStrategy(ERC20 strategy, RewardsState memory state)\r\n private\r\n returns (RewardsState memory rewardsState)\r\n {\r\n // calculate accrued rewards through module\r\n uint256 strategyRewardsAccrued = flywheelRewards.getAccruedRewards(strategy, state.lastUpdatedTimestamp);\r\n\r\n rewardsState = state;\r\n if (strategyRewardsAccrued > 0) {\r\n // use the booster or token supply to calculate reward index denominator\r\n uint256 supplyTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedTotalSupply(strategy)\r\n : strategy.totalSupply();\r\n\r\n uint224 deltaIndex;\r\n\r\n if (supplyTokens != 0) deltaIndex = ((strategyRewardsAccrued * ONE) / supplyTokens).safeCastTo224();\r\n\r\n // accumulate rewards per token onto the index, multiplied by fixed-point factor\r\n rewardsState = RewardsState({\r\n index: state.index + deltaIndex,\r\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\r\n });\r\n strategyState[strategy] = rewardsState;\r\n }\r\n }\r\n\r\n /// @notice accumulate rewards on a strategy for a specific user\r\n function accrueUser(\r\n ERC20 strategy,\r\n address user,\r\n RewardsState memory state\r\n ) private returns (uint256) {\r\n // load indices\r\n uint224 strategyIndex = state.index;\r\n uint224 supplierIndex = userIndex[strategy][user];\r\n\r\n // sync user index to global\r\n userIndex[strategy][user] = strategyIndex;\r\n\r\n // if user hasn't yet accrued rewards, grant them interest from the strategy beginning if they have a balance\r\n // zero balances will have no effect other than syncing to global index\r\n if (supplierIndex == 0) {\r\n supplierIndex = ONE;\r\n }\r\n\r\n uint224 deltaIndex = strategyIndex - supplierIndex;\r\n // use the booster or token balance to calculate reward balance multiplier\r\n uint256 supplierTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedBalanceOf(strategy, user)\r\n : strategy.balanceOf(user);\r\n\r\n // accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed\r\n uint256 supplierDelta = (supplierTokens * deltaIndex) / ONE;\r\n uint256 supplierAccrued = rewardsAccrued[user] + supplierDelta;\r\n\r\n rewardsAccrued[user] = supplierAccrued;\r\n\r\n emit AccrueRewards(strategy, user, supplierDelta, strategyIndex);\r\n\r\n return supplierAccrued;\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\n\r\n/**\r\n @title Balance Booster Module for Flywheel\r\n @notice Flywheel is a general framework for managing token incentives.\r\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\r\n\r\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \r\n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\r\n \r\n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\r\n\r\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\r\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\r\n*/\r\ninterface IFlywheelBooster {\r\n /**\r\n @notice calculate the boosted supply of a strategy.\r\n @param strategy the strategy to calculate boosted supply of\r\n @return the boosted supply\r\n */\r\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256);\r\n\r\n /**\r\n @notice calculate the boosted balance of a user in a given strategy.\r\n @param strategy the strategy to calculate boosted balance of\r\n @param user the user to calculate boosted balance of\r\n @return the boosted balance\r\n */\r\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256);\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\n\r\ninterface IIonicFlywheel {\r\n function isRewardsDistributor() external returns (bool);\r\n\r\n function isFlywheel() external returns (bool);\r\n\r\n function flywheelPreSupplierAction(address market, address supplier) external;\r\n\r\n function flywheelPostSupplierAction(address market, address supplier) external;\r\n\r\n function flywheelPreBorrowerAction(address market, address borrower) external;\r\n\r\n function flywheelPostBorrowerAction(address market, address borrower) external;\r\n\r\n function flywheelPreTransferAction(address market, address src, address dst) external;\r\n\r\n function flywheelPostTransferAction(address market, address src, address dst) external;\r\n\r\n function compAccrued(address user) external view returns (uint256);\r\n\r\n function addMarketForRewards(ERC20 strategy) external;\r\n\r\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\r\n\r\n/**\r\n @title Balance Booster Module for Flywheel\r\n @notice Flywheel is a general framework for managing token incentives.\r\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\r\n\r\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \r\n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\r\n \r\n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\r\n\r\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\r\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\r\n*/\r\ninterface IIonicFlywheelBorrowBooster {\r\n /**\r\n @notice calculate the boosted supply of a strategy.\r\n @param strategy the strategy to calculate boosted supply of\r\n @return the boosted supply\r\n */\r\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256);\r\n\r\n /**\r\n @notice calculate the boosted balance of a user in a given strategy.\r\n @param strategy the strategy to calculate boosted balance of\r\n @param user the user to calculate boosted balance of\r\n @return the boosted balance\r\n */\r\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256);\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\r\nimport \"./IIonicFlywheel.sol\";\r\n\r\ncontract IonicFlywheel is IonicFlywheelCore, IIonicFlywheel {\r\n bool public constant isRewardsDistributor = true;\r\n bool public constant isFlywheel = true;\r\n\r\n function flywheelPreSupplierAction(address market, address supplier) external {\r\n accrue(ERC20(market), supplier);\r\n }\r\n\r\n function flywheelPostSupplierAction(address market, address supplier) external {\r\n _updateBlacklistBalances(ERC20(market), supplier);\r\n }\r\n\r\n function flywheelPreBorrowerAction(address market, address borrower) external {}\r\n\r\n function flywheelPostBorrowerAction(address market, address borrower) external {}\r\n\r\n function flywheelPreTransferAction(address market, address src, address dst) external {\r\n accrue(ERC20(market), src, dst);\r\n }\r\n\r\n function flywheelPostTransferAction(address market, address src, address dst) external {\r\n _updateBlacklistBalances(ERC20(market), src);\r\n _updateBlacklistBalances(ERC20(market), dst);\r\n }\r\n\r\n function compAccrued(address user) external view returns (uint256) {\r\n return _rewardsAccrued[user];\r\n }\r\n\r\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\r\n _addStrategyForRewards(strategy);\r\n }\r\n\r\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\r\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrow.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\r\nimport \"./IIonicFlywheel.sol\";\r\n\r\ncontract IonicFlywheelBorrow is IonicFlywheelCore, IIonicFlywheel {\r\n bool public constant isRewardsDistributor = true;\r\n bool public constant isFlywheel = true;\r\n\r\n function flywheelPreSupplierAction(address market, address supplier) external {}\r\n\r\n function flywheelPostSupplierAction(address market, address supplier) external {}\r\n\r\n function flywheelPreBorrowerAction(address market, address borrower) external {\r\n accrue(ERC20(market), borrower);\r\n }\r\n\r\n function flywheelPostBorrowerAction(address market, address borrower) external {\r\n _updateBlacklistBalances(ERC20(market), borrower);\r\n }\r\n\r\n function flywheelPreTransferAction(address market, address src, address dst) external {}\r\n\r\n function flywheelPostTransferAction(address market, address src, address dst) external {}\r\n\r\n function compAccrued(address user) external view returns (uint256) {\r\n return _rewardsAccrued[user];\r\n }\r\n\r\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\r\n _addStrategyForRewards(strategy);\r\n }\r\n\r\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\r\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\r\nimport \"./IIonicFlywheelBorrowBooster.sol\";\r\n\r\ncontract IonicFlywheelBorrowBooster is IIonicFlywheelBorrowBooster {\r\n string public constant BOOSTER_TYPE = \"FlywheelBorrowBooster\";\r\n\r\n /**\r\n @notice calculate the boosted supply of a strategy.\r\n @param strategy the strategy to calculate boosted supply of\r\n @return the boosted supply\r\n */\r\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256) {\r\n return strategy.totalBorrows();\r\n }\r\n\r\n /**\r\n @notice calculate the boosted balance of a user in a given strategy.\r\n @param strategy the strategy to calculate boosted balance of\r\n @param user the user to calculate boosted balance of\r\n @return the boosted balance\r\n */\r\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256) {\r\n return strategy.borrowBalanceCurrent(user);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\r\nimport { SafeCastLib } from \"solmate/utils/SafeCastLib.sol\";\r\n\r\nimport { IFlywheelRewards } from \"./rewards/IFlywheelRewards.sol\";\r\nimport { IFlywheelBooster } from \"./IFlywheelBooster.sol\";\r\nimport { IEmissionsManager } from \"../../../IEmissionsManager.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\n\r\ncontract IonicFlywheelCore is Ownable2StepUpgradeable {\r\n using SafeTransferLib for ERC20;\r\n using SafeCastLib for uint256;\r\n\r\n /// @notice How much rewardsToken will be send to treasury\r\n uint256 public performanceFee;\r\n\r\n /// @notice Address that gets rewardsToken accrued by performanceFee\r\n address public feeRecipient;\r\n\r\n /// @notice The token to reward\r\n ERC20 public rewardToken;\r\n\r\n /// @notice append-only list of strategies added\r\n ERC20[] public allStrategies;\r\n\r\n /// @notice the rewards contract for managing streams\r\n IFlywheelRewards public flywheelRewards;\r\n\r\n /// @notice optional booster module for calculating virtual balances on strategies\r\n IFlywheelBooster public flywheelBooster;\r\n\r\n IEmissionsManager public emissionsManager;\r\n\r\n /// @notice The accrued but not yet transferred rewards for each user\r\n mapping(address => uint256) internal _rewardsAccrued;\r\n\r\n /// @notice The strategy index and last updated per strategy\r\n mapping(ERC20 => RewardsState) internal _strategyState;\r\n\r\n /// @notice user index per strategy\r\n mapping(ERC20 => mapping(address => uint224)) internal _userIndex;\r\n\r\n /// @notice user blacklisted supply per strategy\r\n mapping(ERC20 => mapping(address => uint256)) public userBlacklistedSupply;\r\n\r\n /// @notice blacklisted supply per strategy\r\n mapping(ERC20 => uint256) public blacklistedSupply;\r\n\r\n modifier onlyEmissionsManager() {\r\n require(address(emissionsManager) == msg.sender, \"!emissionsManager\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n function initialize(\r\n ERC20 _rewardToken,\r\n IFlywheelRewards _flywheelRewards,\r\n IFlywheelBooster _flywheelBooster,\r\n address _owner\r\n ) public initializer {\r\n __Ownable2Step_init();\r\n\r\n rewardToken = _rewardToken;\r\n flywheelRewards = _flywheelRewards;\r\n flywheelBooster = _flywheelBooster;\r\n\r\n performanceFee = 10e16; // 10%\r\n feeRecipient = _owner;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n ACCRUE/CLAIM LOGIC\r\n ----------------------------------------------------------------*/\r\n\r\n /** \r\n @notice Emitted when a user's rewards accrue to a given strategy.\r\n @param strategy the updated rewards strategy\r\n @param user the user of the rewards\r\n @param rewardsDelta how many new rewards accrued to the user\r\n @param rewardsIndex the market index for rewards per token accrued\r\n */\r\n event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);\r\n\r\n /** \r\n @notice Emitted when a user claims accrued rewards.\r\n @param user the user of the rewards\r\n @param amount the amount of rewards claimed\r\n */\r\n event ClaimRewards(address indexed user, uint256 amount);\r\n\r\n /** \r\n @notice accrue rewards for a single user on a strategy\r\n @param strategy the strategy to accrue a user's rewards on\r\n @param user the user to be accrued\r\n @return the cumulative amount of rewards accrued to user (including prior)\r\n */\r\n function accrue(ERC20 strategy, address user) public returns (uint256) {\r\n (uint224 index, uint32 ts) = strategyState(strategy);\r\n RewardsState memory state = RewardsState(index, ts);\r\n\r\n if (state.index == 0) return 0;\r\n\r\n state = accrueStrategy(strategy, state);\r\n return accrueUser(strategy, user, state);\r\n }\r\n\r\n /** \r\n @notice accrue rewards for a two users on a strategy\r\n @param strategy the strategy to accrue a user's rewards on\r\n @param user the first user to be accrued\r\n @param user the second user to be accrued\r\n @return the cumulative amount of rewards accrued to the first user (including prior)\r\n @return the cumulative amount of rewards accrued to the second user (including prior)\r\n */\r\n function accrue(ERC20 strategy, address user, address secondUser) public returns (uint256, uint256) {\r\n (uint224 index, uint32 ts) = strategyState(strategy);\r\n RewardsState memory state = RewardsState(index, ts);\r\n\r\n if (state.index == 0) return (0, 0);\r\n\r\n state = accrueStrategy(strategy, state);\r\n return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));\r\n }\r\n\r\n /** \r\n @notice claim rewards for a given user\r\n @param user the user claiming rewards\r\n @dev this function is public, and all rewards transfer to the user\r\n */\r\n function claimRewards(address user) external {\r\n require(!emissionsManager.isUserBlacklisted(user), \"blacklisted\");\r\n require(!emissionsManager.isUserBlacklistable(user), \"blacklistable\");\r\n uint256 accrued = rewardsAccrued(user);\r\n\r\n if (accrued != 0) {\r\n _rewardsAccrued[user] = 0;\r\n\r\n rewardToken.safeTransferFrom(address(flywheelRewards), user, accrued);\r\n\r\n emit ClaimRewards(user, accrued);\r\n }\r\n }\r\n\r\n /** \r\n @notice take rewards for a given user\r\n @param user the user claiming rewards\r\n @param receiver the address that receives the rewards\r\n @dev this function is public, and all rewards transfer to the receiver\r\n */\r\n function takeRewardsFromUser(address user, address receiver) external onlyEmissionsManager {\r\n uint256 accrued = rewardsAccrued(user);\r\n\r\n if (accrued != 0) {\r\n _rewardsAccrued[user] = 0;\r\n\r\n rewardToken.safeTransferFrom(address(flywheelRewards), receiver, accrued);\r\n\r\n emit ClaimRewards(user, accrued);\r\n }\r\n }\r\n\r\n /** \r\n @notice set user balances to zero\r\n @param strategy strategy to whitelist user for\r\n @param user the user to be whitelisted\r\n @dev this function is public, and all user and strategy blacklisted supplies are reset\r\n */\r\n function whitelistUser(ERC20 strategy, address user) external onlyEmissionsManager {\r\n blacklistedSupply[strategy] -= userBlacklistedSupply[strategy][user];\r\n userBlacklistedSupply[strategy][user] = 0;\r\n }\r\n\r\n /** \r\n @notice update user blacklisted balances\r\n @param strategy strategy to update blacklisted balances\r\n @param user the user to be blacklisted\r\n @dev this function is public\r\n */\r\n function updateBlacklistBalances(ERC20 strategy, address user) external onlyEmissionsManager {\r\n _updateBlacklistBalances(strategy, user);\r\n }\r\n\r\n /** \r\n @notice update user blacklisted balances\r\n @param strategy strategy to update blacklisted balances\r\n @param user the user to be blacklisted\r\n @dev this function is private\r\n */\r\n function _updateBlacklistBalances(ERC20 strategy, address user) internal {\r\n if (emissionsManager.isUserBlacklisted(user)) {\r\n uint256 _oldUserBlacklistedSupply = userBlacklistedSupply[strategy][user];\r\n uint256 supplierTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedBalanceOf(ERC20(strategy), user)\r\n : ERC20(strategy).balanceOf(user);\r\n\r\n if (supplierTokens >= _oldUserBlacklistedSupply) {\r\n blacklistedSupply[strategy] += supplierTokens - _oldUserBlacklistedSupply;\r\n userBlacklistedSupply[strategy][user] = supplierTokens;\r\n } else {\r\n blacklistedSupply[strategy] -= _oldUserBlacklistedSupply - supplierTokens;\r\n userBlacklistedSupply[strategy][user] = supplierTokens;\r\n }\r\n }\r\n }\r\n /*----------------------------------------------------------------\r\n ADMIN LOGIC\r\n ----------------------------------------------------------------*/\r\n\r\n /** \r\n @notice Emitted when a new strategy is added to flywheel by the admin\r\n @param newStrategy the new added strategy\r\n */\r\n event AddStrategy(address indexed newStrategy);\r\n\r\n /// @notice initialize a new strategy\r\n function setEmissionsManager(IEmissionsManager _emissionsManager) external onlyOwner {\r\n emissionsManager = _emissionsManager;\r\n }\r\n\r\n /// @notice initialize a new strategy\r\n function addStrategyForRewards(ERC20 strategy) external onlyOwner {\r\n _addStrategyForRewards(strategy);\r\n }\r\n\r\n function _addStrategyForRewards(ERC20 strategy) internal {\r\n (uint224 index, ) = strategyState(strategy);\r\n require(index == 0, \"strategy\");\r\n _strategyState[strategy] = RewardsState({\r\n index: (10 ** rewardToken.decimals()).safeCastTo224(),\r\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\r\n });\r\n\r\n allStrategies.push(strategy);\r\n emit AddStrategy(address(strategy));\r\n }\r\n\r\n function getAllStrategies() external view returns (ERC20[] memory) {\r\n return allStrategies;\r\n }\r\n\r\n /** \r\n @notice Emitted when the rewards module changes\r\n @param newFlywheelRewards the new rewards module\r\n */\r\n event FlywheelRewardsUpdate(address indexed newFlywheelRewards);\r\n\r\n /// @notice swap out the flywheel rewards contract\r\n function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external onlyOwner {\r\n if (address(flywheelRewards) != address(0)) {\r\n uint256 oldRewardBalance = rewardToken.balanceOf(address(flywheelRewards));\r\n if (oldRewardBalance > 0) {\r\n rewardToken.safeTransferFrom(address(flywheelRewards), address(newFlywheelRewards), oldRewardBalance);\r\n }\r\n }\r\n\r\n flywheelRewards = newFlywheelRewards;\r\n\r\n emit FlywheelRewardsUpdate(address(newFlywheelRewards));\r\n }\r\n\r\n /** \r\n @notice Emitted when the booster module changes\r\n @param newBooster the new booster module\r\n */\r\n event FlywheelBoosterUpdate(address indexed newBooster);\r\n\r\n /// @notice swap out the flywheel booster contract\r\n function setBooster(IFlywheelBooster newBooster) external onlyOwner {\r\n flywheelBooster = newBooster;\r\n\r\n emit FlywheelBoosterUpdate(address(newBooster));\r\n }\r\n\r\n event UpdatedFeeSettings(\r\n uint256 oldPerformanceFee,\r\n uint256 newPerformanceFee,\r\n address oldFeeRecipient,\r\n address newFeeRecipient\r\n );\r\n\r\n /**\r\n * @notice Update performanceFee and/or feeRecipient\r\n * @dev Claim rewards first from the previous feeRecipient before changing it\r\n */\r\n function updateFeeSettings(uint256 _performanceFee, address _feeRecipient) external onlyOwner {\r\n _updateFeeSettings(_performanceFee, _feeRecipient);\r\n }\r\n\r\n function _updateFeeSettings(uint256 _performanceFee, address _feeRecipient) internal {\r\n emit UpdatedFeeSettings(performanceFee, _performanceFee, feeRecipient, _feeRecipient);\r\n\r\n if (feeRecipient != _feeRecipient) {\r\n _rewardsAccrued[_feeRecipient] += rewardsAccrued(feeRecipient);\r\n _rewardsAccrued[feeRecipient] = 0;\r\n }\r\n performanceFee = _performanceFee;\r\n feeRecipient = _feeRecipient;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n INTERNAL ACCOUNTING LOGIC\r\n ----------------------------------------------------------------*/\r\n\r\n struct RewardsState {\r\n /// @notice The strategy's last updated index\r\n uint224 index;\r\n /// @notice The timestamp the index was last updated at\r\n uint32 lastUpdatedTimestamp;\r\n }\r\n\r\n /// @notice accumulate global rewards on a strategy\r\n function accrueStrategy(\r\n ERC20 strategy,\r\n RewardsState memory state\r\n ) private returns (RewardsState memory rewardsState) {\r\n // calculate accrued rewards through module\r\n uint256 strategyRewardsAccrued = flywheelRewards.getAccruedRewards(strategy, state.lastUpdatedTimestamp);\r\n\r\n rewardsState = state;\r\n\r\n if (strategyRewardsAccrued > 0) {\r\n // use the booster or token supply to calculate reward index denominator\r\n uint256 supplyTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedTotalSupply(strategy) - blacklistedSupply[strategy]\r\n : strategy.totalSupply() - blacklistedSupply[strategy];\r\n\r\n // 100% = 100e16\r\n uint256 accruedFees = (strategyRewardsAccrued * performanceFee) / uint224(100e16);\r\n\r\n _rewardsAccrued[feeRecipient] += accruedFees;\r\n strategyRewardsAccrued -= accruedFees;\r\n\r\n uint224 deltaIndex;\r\n\r\n if (supplyTokens != 0)\r\n deltaIndex = ((strategyRewardsAccrued * (10 ** strategy.decimals())) / supplyTokens).safeCastTo224();\r\n\r\n // accumulate rewards per token onto the index, multiplied by fixed-point factor\r\n rewardsState = RewardsState({\r\n index: state.index + deltaIndex,\r\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\r\n });\r\n _strategyState[strategy] = rewardsState;\r\n }\r\n }\r\n\r\n /// @notice accumulate rewards on a strategy for a specific user\r\n function accrueUser(ERC20 strategy, address user, RewardsState memory state) private returns (uint256) {\r\n // load indices\r\n uint224 strategyIndex = state.index;\r\n uint224 supplierIndex = userIndex(strategy, user);\r\n\r\n // sync user index to global\r\n _userIndex[strategy][user] = strategyIndex;\r\n\r\n // if user hasn't yet accrued rewards, grant them interest from the strategy beginning if they have a balance\r\n // zero balances will have no effect other than syncing to global index\r\n if (supplierIndex == 0) {\r\n supplierIndex = (10 ** rewardToken.decimals()).safeCastTo224();\r\n }\r\n\r\n uint224 deltaIndex = strategyIndex - supplierIndex;\r\n // use the booster or token balance to calculate reward balance multiplier\r\n uint256 supplierTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedBalanceOf(strategy, user) - userBlacklistedSupply[strategy][user]\r\n : strategy.balanceOf(user) - userBlacklistedSupply[strategy][user];\r\n\r\n // accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed\r\n uint256 supplierDelta = (deltaIndex * supplierTokens) / (10 ** strategy.decimals());\r\n uint256 supplierAccrued = rewardsAccrued(user) + supplierDelta;\r\n\r\n _rewardsAccrued[user] = supplierAccrued;\r\n\r\n emit AccrueRewards(strategy, user, supplierDelta, strategyIndex);\r\n\r\n return supplierAccrued;\r\n }\r\n\r\n function rewardsAccrued(address user) public virtual returns (uint256) {\r\n return _rewardsAccrued[user];\r\n }\r\n\r\n function userIndex(ERC20 strategy, address user) public virtual returns (uint224) {\r\n return _userIndex[strategy][user];\r\n }\r\n\r\n function strategyState(ERC20 strategy) public virtual returns (uint224 index, uint32 lastUpdatedTimestamp) {\r\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelLensRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\n\r\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\r\nimport { IonicComptroller } from \"../../../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\r\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\r\nimport { PoolDirectory } from \"../../../PoolDirectory.sol\";\r\n\r\ninterface IPriceOracle_IFLR {\r\n function getUnderlyingPrice(ERC20 cToken) external view returns (uint256);\r\n\r\n function price(address underlying) external view returns (uint256);\r\n}\r\n\r\ncontract IonicFlywheelLensRouter {\r\n PoolDirectory public fpd;\r\n\r\n constructor(PoolDirectory _fpd) {\r\n fpd = _fpd;\r\n }\r\n\r\n struct MarketRewardsInfo {\r\n /// @dev comptroller oracle price of market underlying\r\n uint256 underlyingPrice;\r\n ICErc20 market;\r\n RewardsInfo[] rewardsInfo;\r\n }\r\n\r\n struct RewardsInfo {\r\n /// @dev rewards in `rewardToken` paid per underlying staked token in `market` per second\r\n uint256 rewardSpeedPerSecondPerToken;\r\n /// @dev comptroller oracle price of reward token\r\n uint256 rewardTokenPrice;\r\n /// @dev APR scaled by 1e18. Calculated as rewardSpeedPerSecondPerToken * rewardTokenPrice * 365.25 days / underlyingPrice * 1e18 / market.exchangeRate\r\n uint256 formattedAPR;\r\n address flywheel;\r\n address rewardToken;\r\n }\r\n\r\n function getPoolMarketRewardsInfo(IonicComptroller comptroller) external returns (MarketRewardsInfo[] memory) {\r\n ICErc20[] memory markets = comptroller.getAllMarkets();\r\n return _getMarketRewardsInfo(markets, comptroller);\r\n }\r\n\r\n function getMarketRewardsInfo(ICErc20[] memory markets) external returns (MarketRewardsInfo[] memory) {\r\n IonicComptroller pool;\r\n for (uint256 i = 0; i < markets.length; i++) {\r\n ICErc20 asMarket = ICErc20(address(markets[i]));\r\n if (address(pool) == address(0)) pool = asMarket.comptroller();\r\n else require(asMarket.comptroller() == pool);\r\n }\r\n return _getMarketRewardsInfo(markets, pool);\r\n }\r\n\r\n function _getMarketRewardsInfo(ICErc20[] memory markets, IonicComptroller comptroller)\r\n internal\r\n returns (MarketRewardsInfo[] memory)\r\n {\r\n if (address(comptroller) == address(0) || markets.length == 0) return new MarketRewardsInfo[](0);\r\n\r\n address[] memory flywheels = comptroller.getAccruingFlywheels();\r\n address[] memory rewardTokens = new address[](flywheels.length);\r\n uint256[] memory rewardTokenPrices = new uint256[](flywheels.length);\r\n uint256[] memory rewardTokenDecimals = new uint256[](flywheels.length);\r\n BasePriceOracle oracle = comptroller.oracle();\r\n\r\n MarketRewardsInfo[] memory infoList = new MarketRewardsInfo[](markets.length);\r\n for (uint256 i = 0; i < markets.length; i++) {\r\n RewardsInfo[] memory rewardsInfo = new RewardsInfo[](flywheels.length);\r\n\r\n ICErc20 market = ICErc20(address(markets[i]));\r\n uint256 price = oracle.price(market.underlying()); // scaled to 1e18\r\n\r\n if (i == 0) {\r\n for (uint256 j = 0; j < flywheels.length; j++) {\r\n ERC20 rewardToken = IonicFlywheelCore(flywheels[j]).rewardToken();\r\n rewardTokens[j] = address(rewardToken);\r\n rewardTokenPrices[j] = oracle.price(address(rewardToken)); // scaled to 1e18\r\n rewardTokenDecimals[j] = uint256(rewardToken.decimals());\r\n }\r\n }\r\n\r\n for (uint256 j = 0; j < flywheels.length; j++) {\r\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\r\n\r\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\r\n flywheel,\r\n market,\r\n rewardTokenDecimals[j]\r\n );\r\n uint256 apr = getApr(\r\n rewardSpeedPerSecondPerToken,\r\n rewardTokenPrices[j],\r\n price, \r\n market.exchangeRateCurrent(),\r\n address(flywheel.flywheelBooster()) != address(0)\r\n );\r\n\r\n rewardsInfo[j] = RewardsInfo({\r\n rewardSpeedPerSecondPerToken: rewardSpeedPerSecondPerToken, // scaled in 1e18\r\n rewardTokenPrice: rewardTokenPrices[j],\r\n formattedAPR: apr, // scaled in 1e18\r\n flywheel: address(flywheel),\r\n rewardToken: rewardTokens[j]\r\n });\r\n }\r\n\r\n infoList[i] = MarketRewardsInfo({ market: market, rewardsInfo: rewardsInfo, underlyingPrice: price });\r\n }\r\n\r\n return infoList;\r\n }\r\n\r\n function scaleIndexDiff(uint256 indexDiff, uint256 decimals) internal pure returns (uint256) {\r\n return decimals <= 18 ? uint256(indexDiff) * (10**(18 - decimals)) : uint256(indexDiff) / (10**(decimals - 18));\r\n }\r\n\r\n function getRewardSpeedPerSecondPerToken(\r\n IonicFlywheelCore flywheel,\r\n ICErc20 market,\r\n uint256 decimals\r\n ) internal returns (uint256 rewardSpeedPerSecondPerToken) {\r\n ERC20 strategy = ERC20(address(market));\r\n (uint224 indexBefore, uint32 lastUpdatedTimestampBefore) = flywheel.strategyState(strategy);\r\n flywheel.accrue(strategy, address(0));\r\n (uint224 indexAfter, uint32 lastUpdatedTimestampAfter) = flywheel.strategyState(strategy);\r\n if (lastUpdatedTimestampAfter > lastUpdatedTimestampBefore) {\r\n rewardSpeedPerSecondPerToken =\r\n scaleIndexDiff((indexAfter - indexBefore), decimals) /\r\n (lastUpdatedTimestampAfter - lastUpdatedTimestampBefore);\r\n }\r\n }\r\n\r\n function getApr(\r\n uint256 rewardSpeedPerSecondPerToken,\r\n uint256 rewardTokenPrice,\r\n uint256 underlyingPrice,\r\n uint256 exchangeRate,\r\n bool isBorrow\r\n ) internal pure returns (uint256) {\r\n if (rewardSpeedPerSecondPerToken == 0) return 0;\r\n uint256 nativeSpeedPerSecondPerCToken = rewardSpeedPerSecondPerToken * rewardTokenPrice; // scaled to 1e36\r\n uint256 nativeSpeedPerYearPerCToken = nativeSpeedPerSecondPerCToken * 365.25 days; // scaled to 1e36\r\n uint256 assetSpeedPerYearPerCToken = nativeSpeedPerYearPerCToken / underlyingPrice; // scaled to 1e18\r\n uint256 assetSpeedPerYearPerCTokenScaled = assetSpeedPerYearPerCToken * 1e18; // scaled to 1e36\r\n uint256 apr = assetSpeedPerYearPerCTokenScaled;\r\n if (!isBorrow) {\r\n // if not borrowing, use exchange rate to scale\r\n apr = assetSpeedPerYearPerCTokenScaled / exchangeRate; // scaled to 1e18\r\n } else {\r\n apr = assetSpeedPerYearPerCTokenScaled / 1e18; // scaled to 1e18\r\n }\r\n return apr;\r\n }\r\n\r\n function getRewardsAprForMarket(ICErc20 market) internal returns (int256 totalMarketRewardsApr) {\r\n IonicComptroller comptroller = market.comptroller();\r\n BasePriceOracle oracle = comptroller.oracle();\r\n uint256 underlyingPrice = oracle.getUnderlyingPrice(market);\r\n\r\n address[] memory flywheels = comptroller.getAccruingFlywheels();\r\n for (uint256 j = 0; j < flywheels.length; j++) {\r\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\r\n ERC20 rewardToken = flywheel.rewardToken();\r\n\r\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\r\n flywheel,\r\n market,\r\n uint256(rewardToken.decimals())\r\n );\r\n\r\n uint256 marketApr = getApr(\r\n rewardSpeedPerSecondPerToken,\r\n oracle.price(address(rewardToken)),\r\n underlyingPrice,\r\n market.exchangeRateCurrent(),\r\n address(flywheel.flywheelBooster()) != address(0)\r\n );\r\n\r\n totalMarketRewardsApr += int256(marketApr);\r\n }\r\n }\r\n\r\n function getUserNetValueDeltaForMarket(\r\n address user,\r\n ICErc20 market,\r\n int256 offchainApr,\r\n int256 blocksPerYear\r\n ) internal returns (int256) {\r\n IonicComptroller comptroller = market.comptroller();\r\n BasePriceOracle oracle = comptroller.oracle();\r\n int256 netApr = getRewardsAprForMarket(market) +\r\n getUserInterestAprForMarket(user, market, blocksPerYear) +\r\n offchainApr;\r\n return (netApr * int256(market.balanceOfUnderlying(user)) * int256(oracle.getUnderlyingPrice(market))) / 1e36;\r\n }\r\n\r\n function getUserInterestAprForMarket(\r\n address user,\r\n ICErc20 market,\r\n int256 blocksPerYear\r\n ) internal returns (int256) {\r\n uint256 borrows = market.borrowBalanceCurrent(user);\r\n uint256 supplied = market.balanceOfUnderlying(user);\r\n uint256 supplyRatePerBlock = market.supplyRatePerBlock();\r\n uint256 borrowRatePerBlock = market.borrowRatePerBlock();\r\n\r\n IonicComptroller comptroller = market.comptroller();\r\n BasePriceOracle oracle = comptroller.oracle();\r\n uint256 assetPrice = oracle.getUnderlyingPrice(market);\r\n uint256 collateralValue = (supplied * assetPrice) / 1e18;\r\n uint256 borrowsValue = (borrows * assetPrice) / 1e18;\r\n\r\n uint256 yieldValuePerBlock = collateralValue * supplyRatePerBlock;\r\n uint256 interestOwedValuePerBlock = borrowsValue * borrowRatePerBlock;\r\n\r\n if (collateralValue == 0) return 0;\r\n return ((int256(yieldValuePerBlock) - int256(interestOwedValuePerBlock)) * blocksPerYear) / int256(collateralValue);\r\n }\r\n\r\n struct AdjustedUserNetAprVars {\r\n int256 userNetAssetsValue;\r\n int256 userNetValueDelta;\r\n BasePriceOracle oracle;\r\n ICErc20[] markets;\r\n IonicComptroller pool;\r\n }\r\n\r\n function getAdjustedUserNetApr(\r\n address user,\r\n int256 blocksPerYear,\r\n address[] memory offchainRewardsAprMarkets,\r\n int256[] memory offchainRewardsAprs\r\n ) public returns (int256) {\r\n AdjustedUserNetAprVars memory vars;\r\n\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\r\n vars.oracle = pool.oracle();\r\n vars.markets = pool.getAllMarkets();\r\n for (uint256 j = 0; j < vars.markets.length; j++) {\r\n int256 offchainRewardsApr = 0;\r\n for (uint256 k = 0; k < offchainRewardsAprMarkets.length; k++) {\r\n if (offchainRewardsAprMarkets[k] == address(vars.markets[j])) offchainRewardsApr = offchainRewardsAprs[k];\r\n }\r\n vars.userNetAssetsValue +=\r\n int256(vars.markets[j].balanceOfUnderlying(user) * vars.oracle.getUnderlyingPrice(vars.markets[j])) /\r\n 1e18;\r\n vars.userNetValueDelta += getUserNetValueDeltaForMarket(\r\n user,\r\n vars.markets[j],\r\n offchainRewardsApr,\r\n blocksPerYear\r\n );\r\n }\r\n }\r\n\r\n if (vars.userNetAssetsValue == 0) return 0;\r\n else return (vars.userNetValueDelta * 1e18) / vars.userNetAssetsValue;\r\n }\r\n\r\n function getUserNetApr(address user, int256 blocksPerYear) external returns (int256) {\r\n address[] memory emptyAddrArray = new address[](0);\r\n int256[] memory emptyIntArray = new int256[](0);\r\n return getAdjustedUserNetApr(user, blocksPerYear, emptyAddrArray, emptyIntArray);\r\n }\r\n\r\n function getAllRewardTokens() public view returns (address[] memory uniqueRewardTokens) {\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n\r\n uint256 rewardTokensCounter;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\r\n address[] memory fws = pool.getRewardsDistributors();\r\n\r\n rewardTokensCounter += fws.length;\r\n }\r\n\r\n address[] memory rewardTokens = new address[](rewardTokensCounter);\r\n\r\n uint256 uniqueRewardTokensCounter = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\r\n address[] memory fws = pool.getRewardsDistributors();\r\n\r\n for (uint256 j = 0; j < fws.length; j++) {\r\n address rwToken = address(IonicFlywheelCore(fws[j]).rewardToken());\r\n if (rwToken == address(0)) break;\r\n\r\n bool added;\r\n for (uint256 k = 0; k < rewardTokens.length; k++) {\r\n if (rwToken == rewardTokens[k]) {\r\n added = true;\r\n break;\r\n }\r\n }\r\n if (!added) rewardTokens[uniqueRewardTokensCounter++] = rwToken;\r\n }\r\n }\r\n\r\n uniqueRewardTokens = new address[](uniqueRewardTokensCounter);\r\n for (uint256 i = 0; i < uniqueRewardTokensCounter; i++) {\r\n uniqueRewardTokens[i] = rewardTokens[i];\r\n }\r\n }\r\n\r\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory) {\r\n address[] memory rewardTokens = getAllRewardTokens();\r\n uint256[] memory rewardsClaimedForToken = new uint256[](rewardTokens.length);\r\n\r\n for (uint256 i = 0; i < rewardTokens.length; i++) {\r\n rewardsClaimedForToken[i] = claimRewardsOfRewardToken(user, rewardTokens[i]);\r\n }\r\n\r\n return (rewardTokens, rewardsClaimedForToken);\r\n }\r\n\r\n function claimRewardsOfRewardToken(address user, address rewardToken) public returns (uint256 rewardsClaimed) {\r\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(user);\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\r\n ERC20[] memory markets;\r\n {\r\n ICErc20[] memory cerc20s = pool.getAllMarkets();\r\n markets = new ERC20[](cerc20s.length);\r\n for (uint256 j = 0; j < cerc20s.length; j++) {\r\n markets[j] = ERC20(address(cerc20s[j]));\r\n }\r\n }\r\n\r\n address[] memory flywheelAddresses = pool.getAccruingFlywheels();\r\n for (uint256 k = 0; k < flywheelAddresses.length; k++) {\r\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\r\n if (address(flywheel.rewardToken()) == rewardToken) {\r\n for (uint256 m = 0; m < markets.length; m++) {\r\n flywheel.accrue(markets[m], user);\r\n }\r\n flywheel.claimRewards(user);\r\n }\r\n }\r\n }\r\n\r\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(user);\r\n return balanceAfter - balanceBefore;\r\n }\r\n\r\n function claimRewardsForMarket(\r\n address user,\r\n ERC20 market,\r\n IonicFlywheelCore[] calldata flywheels,\r\n bool[] calldata accrue\r\n )\r\n external\r\n returns (\r\n IonicFlywheelCore[] memory,\r\n address[] memory rewardTokens,\r\n uint256[] memory rewards\r\n )\r\n {\r\n uint256 size = flywheels.length;\r\n rewards = new uint256[](size);\r\n rewardTokens = new address[](size);\r\n\r\n for (uint256 i = 0; i < size; i++) {\r\n uint256 newRewards;\r\n if (accrue[i]) {\r\n newRewards = flywheels[i].accrue(market, user);\r\n } else {\r\n newRewards = flywheels[i].rewardsAccrued(user);\r\n }\r\n\r\n // Take the max, because rewards are cumulative.\r\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\r\n\r\n flywheels[i].claimRewards(user);\r\n rewardTokens[i] = address(flywheels[i].rewardToken());\r\n }\r\n\r\n return (flywheels, rewardTokens, rewards);\r\n }\r\n\r\n function claimRewardsForPool(address user, IonicComptroller comptroller)\r\n public\r\n returns (\r\n IonicFlywheelCore[] memory,\r\n address[] memory,\r\n uint256[] memory\r\n )\r\n {\r\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\r\n ERC20[] memory markets = new ERC20[](cerc20s.length);\r\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\r\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](flywheelAddresses.length);\r\n bool[] memory accrue = new bool[](flywheelAddresses.length);\r\n\r\n for (uint256 j = 0; j < flywheelAddresses.length; j++) {\r\n flywheels[j] = IonicFlywheelCore(flywheelAddresses[j]);\r\n accrue[j] = true;\r\n }\r\n\r\n for (uint256 j = 0; j < cerc20s.length; j++) {\r\n markets[j] = ERC20(address(cerc20s[j]));\r\n }\r\n\r\n return claimRewardsForMarkets(user, markets, flywheels, accrue);\r\n }\r\n\r\n function claimRewardsForMarkets(\r\n address user,\r\n ERC20[] memory markets,\r\n IonicFlywheelCore[] memory flywheels,\r\n bool[] memory accrue\r\n )\r\n public\r\n returns (\r\n IonicFlywheelCore[] memory,\r\n address[] memory rewardTokens,\r\n uint256[] memory rewards\r\n )\r\n {\r\n rewards = new uint256[](flywheels.length);\r\n rewardTokens = new address[](flywheels.length);\r\n\r\n for (uint256 i = 0; i < flywheels.length; i++) {\r\n for (uint256 j = 0; j < markets.length; j++) {\r\n ERC20 market = markets[j];\r\n\r\n uint256 newRewards;\r\n if (accrue[i]) {\r\n newRewards = flywheels[i].accrue(market, user);\r\n } else {\r\n newRewards = flywheels[i].rewardsAccrued(user);\r\n }\r\n\r\n // Take the max, because rewards are cumulative.\r\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\r\n }\r\n\r\n flywheels[i].claimRewards(user);\r\n rewardTokens[i] = address(flywheels[i].rewardToken());\r\n }\r\n\r\n return (flywheels, rewardTokens, rewards);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicReplacingFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport \"./IonicFlywheel.sol\";\r\n\r\nimport { IFlywheelRewards } from \"./rewards/IFlywheelRewards.sol\";\r\nimport { IFlywheelBooster } from \"./IFlywheelBooster.sol\";\r\n\r\ncontract IonicReplacingFlywheel is IonicFlywheel {\r\n IonicFlywheelCore public flywheelToReplace;\r\n mapping(address => bool) private rewardsTransferred;\r\n\r\n function reinitialize(IonicFlywheelCore _flywheelToReplace) public onlyOwner {\r\n flywheelToReplace = _flywheelToReplace;\r\n }\r\n\r\n function rewardsAccrued(address user) public override returns (uint256) {\r\n if (address(flywheelToReplace) != address(0)) {\r\n if (_rewardsAccrued[user] == 0 && !rewardsTransferred[user]) {\r\n uint256 oldStateRewardsAccrued = flywheelToReplace.rewardsAccrued(user);\r\n if (oldStateRewardsAccrued != 0) {\r\n rewardsTransferred[user] = true;\r\n _rewardsAccrued[user] = oldStateRewardsAccrued;\r\n }\r\n }\r\n }\r\n return _rewardsAccrued[user];\r\n }\r\n\r\n function strategyState(ERC20 strategy) public override returns (uint224, uint32) {\r\n if (address(flywheelToReplace) != address(0)) {\r\n RewardsState memory newStateStrategyState = _strategyState[strategy];\r\n if (newStateStrategyState.index == 0) {\r\n (uint224 index, uint32 ts) = flywheelToReplace.strategyState(strategy);\r\n if (index != 0) {\r\n _strategyState[strategy] = RewardsState(index, ts);\r\n }\r\n }\r\n }\r\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\r\n }\r\n\r\n function userIndex(ERC20 strategy, address user) public override returns (uint224) {\r\n if (address(flywheelToReplace) != address(0)) {\r\n if (_userIndex[strategy][user] == 0) {\r\n uint224 oldStateUserIndex = flywheelToReplace.userIndex(strategy, user);\r\n if (oldStateUserIndex != 0) {\r\n _userIndex[strategy][user] = oldStateUserIndex;\r\n }\r\n }\r\n }\r\n return _userIndex[strategy][user];\r\n }\r\n\r\n function addInitializedStrategy(ERC20 strategy) public onlyOwner {\r\n (uint224 index, ) = strategyState(strategy);\r\n if (index > 0) {\r\n ERC20[] memory strategies = this.getAllStrategies();\r\n for (uint8 i = 0; i < strategies.length; i++) {\r\n require(address(strategy) != address(strategies[i]), \"!added\");\r\n }\r\n\r\n allStrategies.push(strategy);\r\n emit AddStrategy(address(strategy));\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/LooplessFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport \"./IFlywheelBooster.sol\";\r\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\r\n\r\ncontract LooplessFlywheelBooster is IFlywheelBooster {\r\n string public constant BOOSTER_TYPE = \"LooplessFlywheelBooster\";\r\n\r\n /**\r\n @notice calculate the boosted supply of a strategy.\r\n @param strategy the strategy to calculate boosted supply of\r\n @return the boosted supply\r\n */\r\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256) {\r\n return strategy.totalSupply();\r\n }\r\n\r\n /**\r\n @notice calculate the boosted balance of a user in a given strategy.\r\n @param strategy the strategy to calculate boosted balance of\r\n @param user the user to calculate boosted balance of\r\n @return the boosted balance\r\n */\r\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256) {\r\n uint256 cTokensBalance = strategy.balanceOf(user);\r\n ICErc20 asMarket = ICErc20(address(strategy));\r\n uint256 cTokensBorrow = (asMarket.borrowBalanceCurrent(user) * 1e18) / asMarket.exchangeRateCurrent();\r\n return (cTokensBalance > cTokensBorrow) ? cTokensBalance - cTokensBorrow : 0;\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\r\nimport {IFlywheelRewards} from \"./IFlywheelRewards.sol\";\r\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\r\n\r\n/** \r\n @title Flywheel Reward Module\r\n @notice Determines how many rewards accrue to each strategy globally over a given time period.\r\n @dev approves the flywheel core for the reward token to allow balances to be managed by the module but claimed from core.\r\n*/\r\nabstract contract BaseFlywheelRewards is IFlywheelRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n /// @notice thrown when caller is not the flywheel\r\n error FlywheelError();\r\n\r\n /// @notice the reward token paid\r\n ERC20 public immutable override rewardToken;\r\n\r\n /// @notice the flywheel core contract\r\n IonicFlywheelCore public immutable override flywheel;\r\n\r\n constructor(IonicFlywheelCore _flywheel) {\r\n flywheel = _flywheel;\r\n ERC20 _rewardToken = _flywheel.rewardToken();\r\n rewardToken = _rewardToken;\r\n\r\n _rewardToken.safeApprove(address(_flywheel), type(uint256).max);\r\n }\r\n\r\n modifier onlyFlywheel() {\r\n if (msg.sender != address(flywheel)) revert FlywheelError();\r\n _;\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\r\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\r\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\r\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\r\n\r\n/** \r\n @title Flywheel Dynamic Reward Stream\r\n @notice Determines rewards based on a dynamic reward stream.\r\n Rewards are transferred linearly over a \"rewards cycle\" to prevent gaming the reward distribution. \r\n The reward source can be arbitrary logic, but most common is to \"pass through\" rewards from some other source.\r\n The getNextCycleRewards() hook should also transfer the next cycle's rewards to this contract to ensure proper accounting.\r\n*/\r\nabstract contract FlywheelDynamicRewards is BaseFlywheelRewards {\r\n using SafeTransferLib for ERC20;\r\n using SafeCastLib for uint256;\r\n\r\n event NewRewardsCycle(uint32 indexed start, uint32 indexed end, uint192 reward);\r\n\r\n /// @notice the length of a rewards cycle\r\n uint32 public immutable rewardsCycleLength;\r\n\r\n struct RewardsCycle {\r\n uint32 start;\r\n uint32 end;\r\n uint192 reward;\r\n }\r\n\r\n mapping(ERC20 => RewardsCycle) public rewardsCycle;\r\n\r\n constructor(IonicFlywheelCore _flywheel, uint32 _rewardsCycleLength) BaseFlywheelRewards(_flywheel) {\r\n rewardsCycleLength = _rewardsCycleLength;\r\n }\r\n\r\n /**\r\n @notice calculate and transfer accrued rewards to flywheel core\r\n @param strategy the strategy to accrue rewards for\r\n @return amount the amount of tokens accrued and transferred\r\n */\r\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\r\n external\r\n override\r\n onlyFlywheel\r\n returns (uint256 amount)\r\n {\r\n RewardsCycle memory cycle = rewardsCycle[strategy];\r\n\r\n uint32 timestamp = block.timestamp.safeCastTo32();\r\n\r\n uint32 latest = timestamp >= cycle.end ? cycle.end : timestamp;\r\n uint32 earliest = lastUpdatedTimestamp <= cycle.start ? cycle.start : lastUpdatedTimestamp;\r\n if (cycle.end != 0) {\r\n amount = (cycle.reward * (latest - earliest)) / (cycle.end - cycle.start);\r\n assert(amount <= cycle.reward); // should never happen because latest <= cycle.end and earliest >= cycle.start\r\n }\r\n // if cycle has ended, reset cycle and transfer all available\r\n if (timestamp >= cycle.end) {\r\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\r\n uint192 rewards = getNextCycleRewards(strategy);\r\n\r\n // reset for next cycle\r\n rewardsCycle[strategy] = RewardsCycle({start: timestamp, end: end, reward: rewards});\r\n\r\n emit NewRewardsCycle(timestamp, end, rewards);\r\n }\r\n }\r\n\r\n function getNextCycleRewards(ERC20 strategy) internal virtual returns (uint192);\r\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\r\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\r\nimport {ERC20} from \"solmate/utils/SafeTransferLib.sol\";\r\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\r\n\r\n/** \r\n @title Flywheel Static Reward Stream\r\n @notice Determines rewards per strategy based on a fixed reward rate per second\r\n*/\r\ncontract FlywheelStaticRewards is Auth, BaseFlywheelRewards {\r\n event RewardsInfoUpdate(ERC20 indexed strategy, uint224 rewardsPerSecond, uint32 rewardsEndTimestamp);\r\n\r\n struct RewardsInfo {\r\n /// @notice Rewards per second\r\n uint224 rewardsPerSecond;\r\n /// @notice The timestamp the rewards end at\r\n /// @dev use 0 to specify no end\r\n uint32 rewardsEndTimestamp;\r\n }\r\n\r\n /// @notice rewards info per strategy\r\n mapping(ERC20 => RewardsInfo) public rewardsInfo;\r\n\r\n constructor(\r\n IonicFlywheelCore _flywheel,\r\n address _owner,\r\n Authority _authority\r\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\r\n\r\n /**\r\n @notice set rewards per second and rewards end time for Fei Rewards\r\n @param strategy the strategy to accrue rewards for\r\n @param rewards the rewards info for the strategy\r\n */\r\n function setRewardsInfo(ERC20 strategy, RewardsInfo calldata rewards) external requiresAuth {\r\n rewardsInfo[strategy] = rewards;\r\n emit RewardsInfoUpdate(strategy, rewards.rewardsPerSecond, rewards.rewardsEndTimestamp);\r\n }\r\n\r\n /**\r\n @notice calculate and transfer accrued rewards to flywheel core\r\n @param strategy the strategy to accrue rewards for\r\n @param lastUpdatedTimestamp the last updated time for strategy\r\n @return amount the amount of tokens accrued and transferred\r\n */\r\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\r\n external\r\n view\r\n override\r\n onlyFlywheel\r\n returns (uint256 amount)\r\n {\r\n RewardsInfo memory rewards = rewardsInfo[strategy];\r\n\r\n uint256 elapsed;\r\n if (rewards.rewardsEndTimestamp == 0 || rewards.rewardsEndTimestamp > block.timestamp) {\r\n elapsed = block.timestamp - lastUpdatedTimestamp;\r\n } else if (rewards.rewardsEndTimestamp > lastUpdatedTimestamp) {\r\n elapsed = rewards.rewardsEndTimestamp - lastUpdatedTimestamp;\r\n }\r\n\r\n amount = rewards.rewardsPerSecond * elapsed;\r\n }\r\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/IFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\r\n\r\n/**\r\n @title Rewards Module for Flywheel\r\n @notice Flywheel is a general framework for managing token incentives.\r\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\r\n\r\n The Rewards module is responsible for:\r\n * determining the ongoing reward amounts to entire strategies (core handles the logic for dividing among users)\r\n * actually holding rewards that are yet to be claimed\r\n\r\n The reward stream can follow arbitrary logic as long as the amount of rewards passed to flywheel core has been sent to this contract.\r\n\r\n Different module strategies include:\r\n * a static reward rate per second\r\n * a decaying reward rate\r\n * a dynamic just-in-time reward stream\r\n * liquid governance reward delegation (Curve Gauge style)\r\n\r\n SECURITY NOTE: The rewards strategy should be smooth and continuous, to prevent gaming the reward distribution by frontrunning.\r\n */\r\ninterface IFlywheelRewards {\r\n /**\r\n @notice calculate the rewards amount accrued to a strategy since the last update.\r\n @param strategy the strategy to accrue rewards for.\r\n @param lastUpdatedTimestamp the last time rewards were accrued for the strategy.\r\n @return rewards the amount of rewards accrued to the market\r\n */\r\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);\r\n\r\n /// @notice return the flywheel core address\r\n function flywheel() external view returns (IonicFlywheelCore);\r\n\r\n /// @notice return the reward token associated with flywheel core.\r\n function rewardToken() external view returns (ERC20);\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { FlywheelDynamicRewards } from \"./FlywheelDynamicRewards.sol\";\r\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\r\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\ncontract IonicFlywheelDynamicRewards is FlywheelDynamicRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n address public owner;\r\n mapping(address => address) public rewardAccumulators;\r\n\r\n modifier onlyOwner() {\r\n require(msg.sender == owner, \"You are not the owner\");\r\n _;\r\n }\r\n\r\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\r\n FlywheelDynamicRewards(_flywheel, _cycleLength)\r\n {\r\n owner = msg.sender;\r\n }\r\n\r\n function setRewardAccumulators(address[] memory _strategies, address[] memory _rewardAccumulators) external onlyOwner {\r\n uint256 _length = _strategies.length;\r\n require(_rewardAccumulators.length == _length, \"parameters\");\r\n for (uint256 i = 0; i < _length; i++) {\r\n rewardAccumulators[_strategies[i]] = _rewardAccumulators[i];\r\n }\r\n }\r\n\r\n function getNextCycleRewards(ERC20 strategy)\r\n internal\r\n override\r\n returns (uint192)\r\n {\r\n address rewardAccumulator = rewardAccumulators[address(strategy)];\r\n uint256 rewardAmount = rewardToken.balanceOf(rewardAccumulator);\r\n if (rewardAmount != 0) {\r\n rewardToken.safeTransferFrom(\r\n rewardAccumulator,\r\n address(this),\r\n rewardAmount\r\n );\r\n }\r\n return uint192(rewardAmount);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport \"./FlywheelDynamicRewards.sol\";\r\n\r\ninterface ICERC20 {\r\n function plugin() external returns (address);\r\n}\r\n\r\ninterface IPlugin_FDR {\r\n function claimRewards() external;\r\n}\r\n\r\n/** \r\n @title Ionic Flywheel Dynamic Reward Stream\r\n @notice Determines rewards based on reward cycle\r\n Each cycle, claims rewards on the plugin before getting the reward amount\r\n*/\r\ncontract IonicFlywheelDynamicRewardsPlugin is FlywheelDynamicRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\r\n FlywheelDynamicRewards(_flywheel, _cycleLength)\r\n {}\r\n\r\n function getNextCycleRewards(ERC20 strategy)\r\n internal\r\n override\r\n returns (uint192)\r\n {\r\n IPlugin_FDR plugin = IPlugin_FDR(ICERC20(address(strategy)).plugin());\r\n try plugin.claimRewards() {} catch {}\r\n\r\n uint256 rewardAmount = rewardToken.balanceOf(address(strategy));\r\n if (rewardAmount != 0) {\r\n rewardToken.safeTransferFrom(\r\n address(strategy),\r\n address(this),\r\n rewardAmount\r\n );\r\n }\r\n return uint192(rewardAmount);\r\n }\r\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/ReplacingFlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { FlywheelDynamicRewards } from \"./FlywheelDynamicRewards.sol\";\r\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\r\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\r\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\ninterface ICERC20_RFDR {\r\n function plugin() external returns (address);\r\n}\r\n\r\ninterface IPlugin_RFDR {\r\n function claimRewards() external;\r\n}\r\n\r\ncontract ReplacingFlywheelDynamicRewards is FlywheelDynamicRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n IonicFlywheelCore public replacedFlywheel;\r\n\r\n constructor(\r\n IonicFlywheelCore _replacedFlywheel,\r\n IonicFlywheelCore _flywheel,\r\n uint32 _cycleLength\r\n ) FlywheelDynamicRewards(_flywheel, _cycleLength) {\r\n replacedFlywheel = _replacedFlywheel;\r\n // rewardToken.safeApprove(address(_replacedFlywheel), type(uint256).max);\r\n }\r\n\r\n function getNextCycleRewards(ERC20 strategy) internal override returns (uint192) {\r\n if (msg.sender == address(replacedFlywheel)) {\r\n return 0;\r\n } else {\r\n // make it work for both pulled (claimed) and pushed (transferred some other way) rewards\r\n try ICERC20_RFDR(address(strategy)).plugin() returns (address plugin) {\r\n try IPlugin_RFDR(plugin).claimRewards() {} catch {}\r\n } catch {}\r\n\r\n uint256 rewardAmount = rewardToken.balanceOf(address(strategy));\r\n if (rewardAmount != 0) {\r\n rewardToken.safeTransferFrom(address(strategy), address(this), rewardAmount);\r\n }\r\n return uint192(rewardAmount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/ReplacingFlywheelStaticRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { FlywheelStaticRewards } from \"./FlywheelStaticRewards.sol\";\r\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\r\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\r\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\ncontract ReplacingFlywheelStaticRewards is FlywheelStaticRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n IonicFlywheelCore public replacedFlywheel;\r\n\r\n constructor(\r\n IonicFlywheelCore _replacedFlywheel,\r\n IonicFlywheelCore _flywheel,\r\n address _owner,\r\n Authority _authority\r\n ) FlywheelStaticRewards(_flywheel, _owner, _authority) {\r\n ERC20 _rewardToken = _flywheel.rewardToken();\r\n _rewardToken.safeApprove(address(_replacedFlywheel), type(uint256).max);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/WithdrawableFlywheelStaticRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { FlywheelStaticRewards } from \"./FlywheelStaticRewards.sol\";\r\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\r\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\r\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\ncontract WithdrawableFlywheelStaticRewards is FlywheelStaticRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n constructor(\r\n IonicFlywheelCore _flywheel,\r\n address _owner,\r\n Authority _authority\r\n ) FlywheelStaticRewards(_flywheel, _owner, _authority) {}\r\n\r\n function withdraw(uint256 amount) external {\r\n require(msg.sender == flywheel.owner());\r\n rewardToken.safeTransfer(address(flywheel.owner()), amount);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/IonicERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\r\n\r\nimport { PausableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol\";\r\nimport { ERC4626Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\nabstract contract IonicERC4626 is SafeOwnableUpgradeable, PausableUpgradeable, ERC4626Upgradeable {\r\n using FixedPointMathLib for uint256;\r\n using SafeERC20Upgradeable for ERC20Upgradeable;\r\n\r\n /* ========== STATE VARIABLES ========== */\r\n\r\n uint256 public vaultShareHWM;\r\n uint256 public performanceFee;\r\n address public feeRecipient;\r\n\r\n /* ========== EVENTS ========== */\r\n\r\n event UpdatedFeeSettings(\r\n uint256 oldPerformanceFee,\r\n uint256 newPerformanceFee,\r\n address oldFeeRecipient,\r\n address newFeeRecipient\r\n );\r\n\r\n event UpdatedRewardsRecipient(address oldRewardsRecipient, address newRewardsRecipient);\r\n\r\n /* ========== INITIALIZER ========== */\r\n\r\n function __IonicER4626_init(ERC20Upgradeable asset_) internal onlyInitializing {\r\n __SafeOwnable_init(msg.sender);\r\n __Pausable_init();\r\n __Context_init();\r\n __ERC20_init(\r\n string(abi.encodePacked(\"Ionic \", asset_.name(), \" Vault\")),\r\n string(abi.encodePacked(\"iv\", asset_.symbol()))\r\n );\r\n __ERC4626_init(asset_);\r\n\r\n vaultShareHWM = 10 ** asset_.decimals();\r\n feeRecipient = msg.sender;\r\n }\r\n\r\n function _asset() internal view returns (ERC20Upgradeable) {\r\n return ERC20Upgradeable(super.asset());\r\n }\r\n\r\n /* ========== DEPOSIT/WITHDRAW FUNCTIONS ========== */\r\n\r\n function deposit(uint256 assets, address receiver) public override whenNotPaused returns (uint256 shares) {\r\n // Check for rounding error since we round down in previewDeposit.\r\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\r\n\r\n // Need to transfer before minting or ERC777s could reenter.\r\n _asset().safeTransferFrom(msg.sender, address(this), assets);\r\n\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(msg.sender, receiver, assets, shares);\r\n\r\n afterDeposit(assets, shares);\r\n }\r\n\r\n function mint(uint256 shares, address receiver) public override whenNotPaused returns (uint256 assets) {\r\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\r\n\r\n // Need to transfer before minting or ERC777s could reenter.\r\n _asset().safeTransferFrom(msg.sender, address(this), assets);\r\n\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(msg.sender, receiver, assets, shares);\r\n\r\n afterDeposit(assets, shares);\r\n }\r\n\r\n function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {\r\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\r\n\r\n if (msg.sender != owner) {\r\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\r\n }\r\n\r\n if (!paused()) {\r\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\r\n\r\n beforeWithdraw(assets, shares);\r\n\r\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\r\n }\r\n\r\n _burn(owner, shares);\r\n\r\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\r\n\r\n _asset().safeTransfer(receiver, assets);\r\n }\r\n\r\n function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {\r\n if (msg.sender != owner) {\r\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\r\n }\r\n\r\n // Check for rounding error since we round down in previewRedeem.\r\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\r\n\r\n if (!paused()) {\r\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\r\n\r\n beforeWithdraw(assets, shares);\r\n\r\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\r\n }\r\n\r\n _burn(owner, shares);\r\n\r\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\r\n\r\n _asset().safeTransfer(receiver, assets);\r\n }\r\n\r\n /* ========== FEE FUNCTIONS ========== */\r\n\r\n /**\r\n * @notice Take the performance fee that has accrued since last fee harvest.\r\n * @dev Performance fee is based on a vault share high water mark value. If vault share value has increased above the\r\n * HWM in a fee period, issue fee shares to the vault equal to the performance fee.\r\n */\r\n function takePerformanceFee() external onlyOwner {\r\n require(feeRecipient != address(0), \"fee recipient not initialized\");\r\n\r\n uint256 currentAssets = totalAssets();\r\n uint256 shareValue = convertToAssets(10 ** _asset().decimals());\r\n\r\n require(shareValue > vaultShareHWM, \"shareValue !> vaultShareHWM\");\r\n // cache value\r\n uint256 supply = totalSupply();\r\n\r\n uint256 accruedPerformanceFee = (performanceFee * (shareValue - vaultShareHWM) * supply) / 1e36;\r\n _mint(feeRecipient, accruedPerformanceFee.mulDivDown(supply, (currentAssets - accruedPerformanceFee)));\r\n\r\n vaultShareHWM = convertToAssets(10 ** _asset().decimals());\r\n }\r\n\r\n /**\r\n * @notice Transfer accrued fees to rewards manager contract. Caller must be a registered keeper.\r\n * @dev We must make sure that feeRecipient is not address(0) before withdrawing fees\r\n */\r\n function withdrawAccruedFees() external onlyOwner {\r\n redeem(balanceOf(feeRecipient), feeRecipient, feeRecipient);\r\n }\r\n\r\n /**\r\n * @notice Update performanceFee and/or feeRecipient\r\n */\r\n function updateFeeSettings(uint256 newPerformanceFee, address newFeeRecipient) external onlyOwner {\r\n emit UpdatedFeeSettings(performanceFee, newPerformanceFee, feeRecipient, newFeeRecipient);\r\n\r\n performanceFee = newPerformanceFee;\r\n\r\n if (newFeeRecipient != feeRecipient) {\r\n if (feeRecipient != address(0)) {\r\n uint256 oldFees = balanceOf(feeRecipient);\r\n\r\n _burn(feeRecipient, oldFees);\r\n _approve(feeRecipient, owner(), 0);\r\n _mint(newFeeRecipient, oldFees);\r\n }\r\n\r\n _approve(newFeeRecipient, owner(), type(uint256).max);\r\n }\r\n\r\n feeRecipient = newFeeRecipient;\r\n }\r\n\r\n /* ========== EMERGENCY FUNCTIONS ========== */\r\n\r\n // Should withdraw all funds from the strategy and pause the contract\r\n function emergencyWithdrawAndPause() external virtual;\r\n\r\n function unpause() external virtual;\r\n\r\n function shutdown(address market) external onlyOwner whenPaused returns (uint256) {\r\n ERC20Upgradeable theAsset = _asset();\r\n uint256 endBalance = theAsset.balanceOf(address(this));\r\n theAsset.transfer(market, endBalance);\r\n return endBalance;\r\n }\r\n\r\n /* ========== INTERNAL HOOKS LOGIC ========== */\r\n\r\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual;\r\n\r\n function afterDeposit(uint256 assets, uint256 shares) internal virtual;\r\n}\r\n" + }, + "contracts/ionic/strategies/IonicMarketERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.22;\r\nimport { IonicERC4626, ERC20Upgradeable } from \"./IonicERC4626.sol\";\r\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { ComptrollerErrorReporter } from \"../../compound/ErrorReporter.sol\";\r\n\r\ninterface IonicFlywheelLensRouter_4626 {\r\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\r\n}\r\n\r\ncontract IonicMarketERC4626 is IonicERC4626 {\r\n using SafeERC20Upgradeable for ERC20Upgradeable;\r\n\r\n error IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error);\r\n\r\n // STATE VARIABLES\r\n address public rewardsRecipient;\r\n IonicFlywheelLensRouter_4626 public flywheelLensRouter;\r\n ICErc20 public cToken;\r\n\r\n function initialize(\r\n ERC20Upgradeable asset_,\r\n ICErc20 cToken_,\r\n address flywheelLensRouter_,\r\n address rewardsRecipient_\r\n ) public initializer {\r\n __IonicER4626_init(asset_);\r\n cToken = cToken_;\r\n rewardsRecipient = rewardsRecipient_;\r\n flywheelLensRouter = IonicFlywheelLensRouter_4626(flywheelLensRouter_);\r\n }\r\n\r\n /* ========== VIEW FUNCTIONS ========== */\r\n function totalAssets() public view virtual override returns (uint256) {\r\n return cToken.balanceOfUnderlying(address(this));\r\n }\r\n\r\n /// @notice maximum amount of underlying tokens that can be deposited into the underlying protocol\r\n function maxDeposit(address) public view override returns (uint256) {\r\n if (cToken.comptroller().mintGuardianPaused(address(cToken))) {\r\n return 0;\r\n }\r\n\r\n uint256 supplyCap = cToken.comptroller().supplyCaps(address(cToken));\r\n if (supplyCap != 0) {\r\n uint256 currentExchangeRate = cToken.exchangeRateCurrent();\r\n uint256 _totalSupply = cToken.totalSupply();\r\n uint256 totalSupplies = (_totalSupply * currentExchangeRate) / 1e18; /// exchange rate is scaled up by 1e18, so needs to be divided off to get accurate total supply\r\n\r\n // uint256 totalCash = MToken(address(mToken)).getCash();\r\n // uint256 totalBorrows = MToken(address(mToken)).totalBorrows();\r\n // uint256 totalReserves = MToken(address(mToken)).totalReserves();\r\n\r\n // // (Pseudocode) totalSupplies = totalCash + totalBorrows - totalReserves\r\n // uint256 totalSupplies = (totalCash + totalBorrows) - totalReserves;\r\n\r\n // supply cap is 3\r\n // total supplies is 1\r\n /// no room for additional supplies\r\n\r\n // supply cap is 3\r\n // total supplies is 0\r\n /// room for 1 additional supplies\r\n\r\n // supply cap is 4\r\n // total supplies is 1\r\n /// room for 1 additional supplies\r\n\r\n /// total supplies could exceed supply cap as interest accrues, need to handle this edge case\r\n /// going to subtract 2 from supply cap to account for rounding errors\r\n if (totalSupplies + 2 >= supplyCap) {\r\n return 0;\r\n }\r\n\r\n return supplyCap - totalSupplies - 2;\r\n }\r\n\r\n return type(uint256).max;\r\n }\r\n\r\n /// @notice Returns the maximum amount of tokens that can be supplied\r\n /// no way for this function to ever revert unless comptroller or mToken is broken\r\n /// @dev accrue interest must be called before this function is called, otherwise\r\n /// an outdated value will be fetched, and the returned value will be incorrect\r\n /// (greater than actual amount available to be minted will be returned)\r\n function maxMint(address) public view override returns (uint256) {\r\n uint256 mintAmount = maxDeposit(address(0));\r\n\r\n return mintAmount == type(uint256).max ? mintAmount : convertToShares(mintAmount);\r\n }\r\n\r\n /// @notice maximum amount of underlying tokens that can be withdrawn\r\n /// @param owner The address that owns the shares\r\n function maxWithdraw(address owner) public view override returns (uint256) {\r\n uint256 cash = cToken.getCash();\r\n uint256 assetsBalance = convertToAssets(balanceOf(owner));\r\n return cash < assetsBalance ? cash : assetsBalance;\r\n }\r\n\r\n /// @notice maximum amount of shares that can be withdrawn\r\n /// @param owner The address that owns the shares\r\n function maxRedeem(address owner) public view override returns (uint256) {\r\n uint256 cash = cToken.getCash();\r\n uint256 cashInShares = convertToShares(cash);\r\n uint256 shareBalance = balanceOf(owner);\r\n return cashInShares < shareBalance ? cashInShares : shareBalance;\r\n }\r\n\r\n /* ========== REWARDS FUNCTIONS ========== */\r\n\r\n function updateRewardsRecipient(address newRewardsRecipient) external onlyOwner {\r\n emit UpdatedRewardsRecipient(rewardsRecipient, newRewardsRecipient);\r\n rewardsRecipient = newRewardsRecipient;\r\n }\r\n\r\n function claimRewards() external {\r\n (address[] memory tokens, uint256[] memory amounts) = flywheelLensRouter.claimAllRewardTokens(address(this));\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n _asset().safeTransfer(rewardsRecipient, amounts[i]);\r\n }\r\n }\r\n\r\n /* ========== EMERGENCY FUNCTIONS ========== */\r\n\r\n // Should withdraw all funds from the strategy and pause the contract\r\n function emergencyWithdrawAndPause() external override onlyOwner {\r\n _pause();\r\n }\r\n\r\n function unpause() external override onlyOwner {\r\n _unpause();\r\n }\r\n\r\n /* ========== INTERNAL HOOKS LOGIC ========== */\r\n\r\n function beforeWithdraw(uint256 assets, uint256 /*shares*/) internal override {\r\n /// -----------------------------------------------------------------------\r\n /// Withdraw assets from Ionic\r\n /// -----------------------------------------------------------------------\r\n\r\n uint256 errorCode = cToken.redeemUnderlying(assets);\r\n if (errorCode != uint256(ComptrollerErrorReporter.Error.NO_ERROR)) {\r\n revert IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error(errorCode));\r\n }\r\n }\r\n\r\n function afterDeposit(uint256 assets, uint256 /*shares*/) internal override {\r\n /// -----------------------------------------------------------------------\r\n /// Deposit assets into Ionic\r\n /// -----------------------------------------------------------------------\r\n\r\n // approve to cToken\r\n _asset().safeApprove(address(cToken), assets);\r\n\r\n // deposit into cToken\r\n uint256 errorCode = cToken.mint(assets);\r\n if (errorCode != uint256(ComptrollerErrorReporter.Error.NO_ERROR)) {\r\n revert IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error(errorCode));\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/MockERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\r\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\r\n\r\n/**\r\n * @title Mock ERC4626 Contract\r\n * @notice ERC4626 wrapper for Tribe Token\r\n * @author carlomazzaferro\r\n *\r\n */\r\ncontract MockERC4626 is ERC4626 {\r\n using SafeTransferLib for ERC20;\r\n using FixedPointMathLib for uint256;\r\n\r\n /**\r\n @notice Creates a new Vault that accepts a specific underlying token.\r\n @param _asset The ERC20 compliant token the Vault should accept.\r\n */\r\n constructor(ERC20 _asset)\r\n ERC4626(\r\n _asset,\r\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\r\n string(abi.encodePacked(\"mv\", _asset.symbol()))\r\n )\r\n {}\r\n\r\n /* ========== VIEWS ========== */\r\n\r\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\r\n /// @return The total amount of underlying tokens the Vault holds.\r\n function totalAssets() public view override returns (uint256) {\r\n return asset.balanceOf(address(this));\r\n }\r\n\r\n /// @notice Calculates the total amount of underlying tokens the user holds.\r\n /// @return The total amount of underlying tokens the user holds.\r\n function balanceOfUnderlying(address account) public view returns (uint256) {\r\n return convertToAssets(balanceOf[account]);\r\n }\r\n\r\n /* ========== INTERNAL FUNCTIONS ========== */\r\n\r\n function afterDeposit(uint256 amount, uint256) internal override {}\r\n\r\n function beforeWithdraw(uint256, uint256 shares) internal override {}\r\n}\r\n" + }, + "contracts/ionic/strategies/MockERC4626Dynamic.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\n\r\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\r\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\r\nimport { IonicFlywheelCore } from \"./flywheel/IonicFlywheelCore.sol\";\r\n\r\n/**\r\n * @title Mock ERC4626 Contract\r\n * @notice ERC4626 wrapper for Tribe Token\r\n * @author carlomazzaferro\r\n *\r\n */\r\ncontract MockERC4626Dynamic is ERC4626 {\r\n using FixedPointMathLib for uint256;\r\n\r\n /* ========== STATE VARIABLES ========== */\r\n IonicFlywheelCore public immutable flywheel;\r\n\r\n /* ========== INITIALIZER ========== */\r\n\r\n /**\r\n @notice Initializes the Vault.\r\n @param _asset The ERC20 compliant token the Vault should accept.\r\n @param _flywheel Flywheel to pull in rewardsToken\r\n */\r\n constructor(ERC20 _asset, IonicFlywheelCore _flywheel)\r\n ERC4626(\r\n _asset,\r\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\r\n string(abi.encodePacked(\"mv\", _asset.symbol()))\r\n )\r\n {\r\n flywheel = _flywheel;\r\n }\r\n\r\n /* ========== VIEWS ========== */\r\n\r\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\r\n /// @return The total amount of underlying tokens the Vault holds.\r\n function totalAssets() public view override returns (uint256) {\r\n return asset.balanceOf(address(this));\r\n }\r\n\r\n /// @notice Calculates the total amount of underlying tokens the user holds.\r\n /// @return The total amount of underlying tokens the user holds.\r\n function balanceOfUnderlying(address account) public view returns (uint256) {\r\n return convertToAssets(balanceOf[account]);\r\n }\r\n\r\n /* ========== INTERNAL FUNCTIONS ========== */\r\n\r\n function afterDeposit(uint256 amount, uint256) internal override {}\r\n\r\n function beforeWithdraw(uint256, uint256 shares) internal override {}\r\n}\r\n" + }, + "contracts/IonicLiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport \"./liquidators/IRedemptionStrategy.sol\";\r\nimport \"./liquidators/IFundsConversionStrategy.sol\";\r\nimport \"./ILiquidator.sol\";\r\n\r\nimport \"./utils/IW_NATIVE.sol\";\r\n\r\nimport \"./external/uniswap/IUniswapV2Router02.sol\";\r\nimport \"./external/uniswap/IUniswapV2Pair.sol\";\r\nimport \"./external/uniswap/IUniswapV2Callee.sol\";\r\nimport \"./external/uniswap/UniswapV2Library.sol\";\r\nimport \"./external/pyth/IExpressRelay.sol\";\r\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\r\n\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\n\r\nimport \"./PoolLens.sol\";\r\n\r\n/**\r\n * @title IonicLiquidator\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice IonicLiquidator safely liquidates unhealthy borrowers (with flashloan support).\r\n * @dev Do not transfer NATIVE or tokens directly to this address. Only send NATIVE here when using a method, and only approve tokens for transfer to here when using a method. Direct NATIVE transfers will be rejected and direct token transfers will be lost.\r\n */\r\ncontract IonicLiquidator is OwnableUpgradeable, ILiquidator, IUniswapV2Callee, IExpressRelayFeeReceiver {\r\n using AddressUpgradeable for address payable;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\r\n\r\n /**\r\n * @dev W_NATIVE contract address.\r\n */\r\n address public W_NATIVE_ADDRESS;\r\n\r\n /**\r\n * @dev UniswapV2Router02 contract object. (Is interchangable with any UniV2 forks)\r\n */\r\n IUniswapV2Router02 public UNISWAP_V2_ROUTER_02;\r\n\r\n /**\r\n * @dev Cached liquidator profit exchange source.\r\n * ERC20 token address or the zero address for NATIVE.\r\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\r\n */\r\n address private _liquidatorProfitExchangeSource;\r\n\r\n mapping(address => bool) public redemptionStrategiesWhitelist;\r\n\r\n /**\r\n * @dev Cached flash swap amount.\r\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\r\n */\r\n uint256 private _flashSwapAmount;\r\n\r\n /**\r\n * @dev Cached flash swap token.\r\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\r\n */\r\n address private _flashSwapToken;\r\n /**\r\n * @dev Percentage of the flash swap fee, measured in basis points.\r\n */\r\n uint8 public flashSwapFee;\r\n\r\n /**\r\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\r\n */\r\n IExpressRelay public expressRelay;\r\n /**\r\n * @dev Pool Lens.\r\n */\r\n PoolLens public lens;\r\n /**\r\n * @dev Health Factor below which PER permissioning is bypassed.\r\n */\r\n uint256 public healthFactorThreshold;\r\n\r\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\r\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\r\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\r\n _;\r\n }\r\n\r\n function initialize(address _wtoken, address _uniswapV2router, uint8 _flashSwapFee) external initializer {\r\n __Ownable_init();\r\n require(_uniswapV2router != address(0), \"_uniswapV2router not defined.\");\r\n W_NATIVE_ADDRESS = _wtoken;\r\n UNISWAP_V2_ROUTER_02 = IUniswapV2Router02(_uniswapV2router);\r\n flashSwapFee = _flashSwapFee;\r\n }\r\n\r\n function _becomeImplementation(bytes calldata data) external {}\r\n\r\n /**\r\n * @dev Internal function to approve unlimited tokens of `erc20Contract` to `to`.\r\n */\r\n function safeApprove(IERC20Upgradeable token, address to, uint256 minAmount) private {\r\n uint256 allowance = token.allowance(address(this), to);\r\n\r\n if (allowance < minAmount) {\r\n if (allowance > 0) token.safeApprove(to, 0);\r\n token.safeApprove(to, type(uint256).max);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function to approve\r\n */\r\n function justApprove(IERC20Upgradeable token, address to, uint256 amount) private {\r\n token.approve(to, amount);\r\n }\r\n\r\n /**\r\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\r\n * @param borrower The borrower's Ethereum address.\r\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\r\n * @param cErc20 The borrowed cErc20 to repay.\r\n * @param cTokenCollateral The cToken collateral to be liquidated.\r\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\r\n */\r\n function _safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) internal returns (uint256) {\r\n // Transfer tokens in, approve to cErc20, and liquidate borrow\r\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\r\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\r\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\r\n justApprove(underlying, address(cErc20), repayAmount);\r\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\r\n\r\n // Redeem seized cTokens for underlying asset\r\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n\r\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\r\n }\r\n\r\n function safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\r\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\r\n }\r\n\r\n function safeLiquidatePyth(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external returns (uint256) {\r\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\r\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\r\n }\r\n\r\n /**\r\n * @dev Transfers seized funds to the sender.\r\n * @param erc20Contract The address of the token to transfer.\r\n * @param minOutputAmount The minimum amount to transfer.\r\n */\r\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\r\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\r\n uint256 seizedOutputAmount = token.balanceOf(address(this));\r\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\r\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\r\n\r\n return seizedOutputAmount;\r\n }\r\n\r\n function safeLiquidateWithAggregator(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n address aggregatorTarget,\r\n bytes memory aggregatorData\r\n ) external {\r\n // Transfer tokens in, approve to cErc20, and liquidate borrow\r\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\r\n cErc20.flash(\r\n repayAmount,\r\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\r\n );\r\n }\r\n\r\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\r\n (\r\n address borrower,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n address aggregatorTarget,\r\n bytes memory aggregatorData,\r\n address liquidator\r\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\r\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\r\n underlyingBorrow.approve(address(cErc20), amount);\r\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\r\n\r\n // Redeem seized cTokens for underlying asset\r\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\r\n {\r\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\r\n\r\n // Call the aggregator\r\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\r\n (bool success, ) = aggregatorTarget.call(aggregatorData);\r\n require(success, \"Aggregator call failed\");\r\n }\r\n\r\n // receive profits\r\n {\r\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\r\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\r\n uint256 profitBorrow = receivedAmount - amount;\r\n if (profitBorrow > 0) {\r\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\r\n }\r\n\r\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\r\n if (profitCollateral > 0) {\r\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\r\n }\r\n }\r\n\r\n // pay back flashloan\r\n underlyingBorrow.approve(address(cErc20), amount);\r\n }\r\n\r\n /**\r\n * @notice Safely liquidate an unhealthy loan, confirming that at least `minProfitAmount` in NATIVE profit is seized.\r\n * @param vars @see LiquidateToTokensWithFlashSwapVars.\r\n */\r\n function safeLiquidateToTokensWithFlashLoan(\r\n LiquidateToTokensWithFlashSwapVars calldata vars\r\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\r\n // Input validation\r\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\r\n\r\n // we want to calculate the needed flashSwapAmount on-chain to\r\n // avoid errors due to changing market conditions\r\n // between the time of calculating and including the tx in a block\r\n uint256 fundingAmount = vars.repayAmount;\r\n IERC20Upgradeable fundingToken;\r\n if (vars.debtFundingStrategies.length > 0) {\r\n require(\r\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\r\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\r\n );\r\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\r\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\r\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\r\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\r\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\r\n }\r\n } else {\r\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\r\n }\r\n\r\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\r\n _flashSwapAmount = fundingAmount;\r\n _flashSwapToken = address(fundingToken);\r\n\r\n IUniswapV2Pair flashSwapPair = IUniswapV2Pair(vars.flashSwapContract);\r\n bool token0IsFlashSwapFundingToken = flashSwapPair.token0() == address(fundingToken);\r\n flashSwapPair.swap(\r\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\r\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\r\n address(this),\r\n msg.data\r\n );\r\n\r\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\r\n }\r\n\r\n /**\r\n * @dev Receives NATIVE from liquidations and flashloans.\r\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\r\n */\r\n receive() external payable {\r\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\r\n }\r\n\r\n /**\r\n * @notice receiveAuctionProceedings function - receives native token from the express relay\r\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\r\n */\r\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\r\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\r\n }\r\n\r\n function withdrawAll() external onlyOwner {\r\n uint256 balance = address(this).balance;\r\n require(balance > 0, \"No Ether left to withdraw\");\r\n\r\n // Transfer all Ether to the owner\r\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\r\n require(sent, \"Failed to send Ether\");\r\n }\r\n\r\n /**\r\n * @dev Callback function for Uniswap flashloans.\r\n */\r\n function uniswapV2Call(address, uint256, uint256, bytes calldata data) public override {\r\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\r\n // Decode params\r\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\r\n\r\n // Post token flashloan\r\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\r\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars);\r\n }\r\n\r\n /**\r\n * @dev Callback function for PCS flashloans.\r\n */\r\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\r\n uniswapV2Call(sender, amount0, amount1, data);\r\n }\r\n\r\n function moraswapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\r\n uniswapV2Call(sender, amount0, amount1, data);\r\n }\r\n\r\n /**\r\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\r\n */\r\n function postFlashLoanTokens(LiquidateToTokensWithFlashSwapVars memory vars) private returns (address) {\r\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\r\n uint256 debtRepaymentAmount = _flashSwapAmount;\r\n\r\n if (vars.debtFundingStrategies.length > 0) {\r\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\r\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\r\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\r\n debtRepaymentToken,\r\n debtRepaymentAmount,\r\n vars.debtFundingStrategies[i - 1],\r\n vars.debtFundingStrategiesData[i - 1]\r\n );\r\n }\r\n }\r\n\r\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\r\n {\r\n address underlyingBorrow = vars.cErc20.underlying();\r\n require(\r\n address(debtRepaymentToken) == underlyingBorrow,\r\n \"the debt repayment funds should be converted to the underlying debt token\"\r\n );\r\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\r\n // Approve repayAmount to cErc20\r\n justApprove(IERC20Upgradeable(underlyingBorrow), address(vars.cErc20), vars.repayAmount);\r\n\r\n // Liquidate borrow\r\n require(\r\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\r\n \"Liquidation failed.\"\r\n );\r\n\r\n // Redeem seized cTokens for underlying asset\r\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n }\r\n\r\n // Repay flashloan\r\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData);\r\n }\r\n\r\n /**\r\n * @dev Repays token flashloans.\r\n */\r\n function repayTokenFlashLoan(\r\n ICErc20 cTokenCollateral,\r\n IRedemptionStrategy[] memory redemptionStrategies,\r\n bytes[] memory strategyData\r\n ) private returns (address) {\r\n // Calculate flashloan return amount\r\n uint256 flashSwapReturnAmount = (_flashSwapAmount * 10000) / (10000 - flashSwapFee);\r\n if ((_flashSwapAmount * 10000) % (10000 - flashSwapFee) > 0) flashSwapReturnAmount++; // Round up if division resulted in a remainder\r\n\r\n // Swap cTokenCollateral for cErc20 via Uniswap\r\n // Check underlying collateral seized\r\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\r\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\r\n\r\n // Redeem custom collateral if liquidation strategy is set\r\n if (redemptionStrategies.length > 0) {\r\n require(\r\n redemptionStrategies.length == strategyData.length,\r\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\r\n );\r\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\r\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\r\n underlyingCollateral,\r\n underlyingCollateralSeized,\r\n redemptionStrategies[i],\r\n strategyData[i]\r\n );\r\n }\r\n\r\n IUniswapV2Pair pair = IUniswapV2Pair(msg.sender);\r\n\r\n // Check if we can repay directly one of the sides with collateral\r\n if (address(underlyingCollateral) == pair.token0() || address(underlyingCollateral) == pair.token1()) {\r\n // Repay flashloan directly with collateral\r\n uint256 collateralRequired;\r\n if (address(underlyingCollateral) == _flashSwapToken) {\r\n // repay amount for the borrow side\r\n collateralRequired = flashSwapReturnAmount;\r\n } else {\r\n // repay amount for the non-borrow side\r\n collateralRequired = UniswapV2Library.getAmountsIn(\r\n UNISWAP_V2_ROUTER_02.factory(),\r\n _flashSwapAmount, //flashSwapReturnAmount,\r\n array(address(underlyingCollateral), _flashSwapToken),\r\n flashSwapFee\r\n )[0];\r\n }\r\n\r\n // Repay flashloan\r\n require(\r\n collateralRequired <= underlyingCollateralSeized,\r\n \"Token flashloan return amount greater than seized collateral.\"\r\n );\r\n require(\r\n underlyingCollateral.transfer(msg.sender, collateralRequired),\r\n \"Failed to repay token flashloan on borrow side.\"\r\n );\r\n\r\n return address(underlyingCollateral);\r\n } else {\r\n // exchange the collateral to W_NATIVE to repay the borrow side\r\n uint256 wethRequired;\r\n if (_flashSwapToken == W_NATIVE_ADDRESS) {\r\n wethRequired = flashSwapReturnAmount;\r\n } else {\r\n // Get W_NATIVE required to repay flashloan\r\n wethRequired = UniswapV2Library.getAmountsIn(\r\n UNISWAP_V2_ROUTER_02.factory(),\r\n flashSwapReturnAmount,\r\n array(W_NATIVE_ADDRESS, _flashSwapToken),\r\n flashSwapFee\r\n )[0];\r\n }\r\n\r\n if (address(underlyingCollateral) != W_NATIVE_ADDRESS) {\r\n // Approve to Uniswap router\r\n justApprove(underlyingCollateral, address(UNISWAP_V2_ROUTER_02), underlyingCollateralSeized);\r\n\r\n // Swap collateral tokens for W_NATIVE to be repaid via Uniswap router\r\n UNISWAP_V2_ROUTER_02.swapTokensForExactTokens(\r\n wethRequired,\r\n underlyingCollateralSeized,\r\n array(address(underlyingCollateral), W_NATIVE_ADDRESS),\r\n address(this),\r\n block.timestamp\r\n );\r\n }\r\n\r\n // Repay flashloan\r\n require(\r\n wethRequired <= IERC20Upgradeable(W_NATIVE_ADDRESS).balanceOf(address(this)),\r\n \"Not enough W_NATIVE exchanged from seized collateral to repay flashloan.\"\r\n );\r\n require(\r\n IW_NATIVE(W_NATIVE_ADDRESS).transfer(msg.sender, wethRequired),\r\n \"Failed to repay Uniswap flashloan with W_NATIVE exchanged from seized collateral.\"\r\n );\r\n\r\n // Return the profited token (underlying collateral if same as exchangeProfitTo; otherwise, W_NATIVE)\r\n return address(underlyingCollateral);\r\n }\r\n }\r\n\r\n /**\r\n * @dev for security reasons only whitelisted redemption strategies may be used.\r\n * Each whitelisted redemption strategy has to be checked to not be able to\r\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\r\n */\r\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\r\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\r\n }\r\n\r\n /**\r\n * @dev for security reasons only whitelisted redemption strategies may be used.\r\n * Each whitelisted redemption strategy has to be checked to not be able to\r\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\r\n */\r\n function _whitelistRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n bool[] calldata whitelisted\r\n ) external onlyOwner {\r\n require(\r\n strategies.length > 0 && strategies.length == whitelisted.length,\r\n \"list of strategies empty or whitelist does not match its length\"\r\n );\r\n\r\n for (uint256 i = 0; i < strategies.length; i++) {\r\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\r\n }\r\n }\r\n\r\n function setExpressRelay(address _expressRelay) external onlyOwner {\r\n expressRelay = IExpressRelay(_expressRelay);\r\n }\r\n\r\n function setPoolLens(address _poolLens) external onlyOwner {\r\n lens = PoolLens(_poolLens);\r\n }\r\n\r\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\r\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\r\n healthFactorThreshold = _healthFactorThreshold;\r\n }\r\n\r\n /**\r\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\r\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\r\n */\r\n function redeemCustomCollateral(\r\n IERC20Upgradeable underlyingCollateral,\r\n uint256 underlyingCollateralSeized,\r\n IRedemptionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\r\n\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n function convertCustomFunds(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IFundsConversionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\r\n\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\r\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\r\n */\r\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\r\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\r\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\r\n */\r\n function _verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an array containing the parameters supplied.\r\n */\r\n function array(address a, address b) private pure returns (address[] memory) {\r\n address[] memory arr = new address[](2);\r\n arr[0] = a;\r\n arr[1] = b;\r\n return arr;\r\n }\r\n}\r\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport \"./liquidators/IRedemptionStrategy.sol\";\r\nimport \"./liquidators/IFundsConversionStrategy.sol\";\r\nimport \"./ILiquidator.sol\";\r\n\r\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\r\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\r\nimport \"./external/pyth/IExpressRelay.sol\";\r\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\r\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\r\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\r\n\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\n\r\nimport \"./PoolLens.sol\";\r\n\r\n/**\r\n * @title IonicUniV3Liquidator\r\n * @author Veliko Minkov (https://github.com/vminkov)\r\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\r\n */\r\ncontract IonicUniV3Liquidator is\r\n OwnableUpgradeable,\r\n ILiquidator,\r\n IUniswapV3FlashCallback,\r\n IExpressRelayFeeReceiver,\r\n IFlashLoanReceiver\r\n{\r\n using AddressUpgradeable for address payable;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\r\n /**\r\n * @dev Cached liquidator profit exchange source.\r\n * ERC20 token address or the zero address for NATIVE.\r\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\r\n */\r\n address private _liquidatorProfitExchangeSource;\r\n\r\n /**\r\n * @dev Cached flash swap amount.\r\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\r\n */\r\n uint256 private _flashSwapAmount;\r\n\r\n /**\r\n * @dev Cached flash swap token.\r\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\r\n */\r\n address private _flashSwapToken;\r\n\r\n address public W_NATIVE_ADDRESS;\r\n mapping(address => bool) public redemptionStrategiesWhitelist;\r\n IUniswapV3Quoter public quoter;\r\n\r\n /**\r\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\r\n */\r\n IExpressRelay public expressRelay;\r\n /**\r\n * @dev Pool Lens.\r\n */\r\n PoolLens public lens;\r\n /**\r\n * @dev Health Factor below which PER permissioning is bypassed.\r\n */\r\n uint256 public healthFactorThreshold;\r\n\r\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\r\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\r\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\r\n _;\r\n }\r\n\r\n function initialize(address _wtoken, address _quoter) external initializer {\r\n __Ownable_init();\r\n W_NATIVE_ADDRESS = _wtoken;\r\n quoter = IUniswapV3Quoter(_quoter);\r\n }\r\n\r\n /**\r\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\r\n * @param borrower The borrower's Ethereum address.\r\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\r\n * @param cErc20 The borrowed cErc20 to repay.\r\n * @param cTokenCollateral The cToken collateral to be liquidated.\r\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\r\n */\r\n function _safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) internal returns (uint256) {\r\n // Transfer tokens in, approve to cErc20, and liquidate borrow\r\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\r\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\r\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\r\n underlying.approve(address(cErc20), repayAmount);\r\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\r\n\r\n // Redeem seized cTokens for underlying asset\r\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n\r\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\r\n }\r\n\r\n function safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\r\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\r\n }\r\n\r\n function safeLiquidatePyth(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external returns (uint256) {\r\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\r\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\r\n }\r\n\r\n function safeLiquidateWithAggregator(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n address aggregatorTarget,\r\n bytes memory aggregatorData\r\n ) external {\r\n // Transfer tokens in, approve to cErc20, and liquidate borrow\r\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\r\n cErc20.flash(\r\n repayAmount,\r\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\r\n );\r\n }\r\n\r\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\r\n (\r\n address borrower,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n address aggregatorTarget,\r\n bytes memory aggregatorData,\r\n address liquidator\r\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\r\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\r\n underlyingBorrow.approve(address(cErc20), amount);\r\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\r\n\r\n // Redeem seized cTokens for underlying asset\r\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\r\n {\r\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\r\n\r\n // Call the aggregator\r\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\r\n (bool success, ) = aggregatorTarget.call(aggregatorData);\r\n require(success, \"Aggregator call failed\");\r\n }\r\n\r\n // receive profits\r\n {\r\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\r\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\r\n uint256 profitBorrow = receivedAmount - amount;\r\n if (profitBorrow > 0) {\r\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\r\n }\r\n\r\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\r\n if (profitCollateral > 0) {\r\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\r\n }\r\n }\r\n\r\n // pay back flashloan\r\n underlyingBorrow.approve(address(cErc20), amount);\r\n }\r\n\r\n /**\r\n * @dev Transfers seized funds to the sender.\r\n * @param erc20Contract The address of the token to transfer.\r\n * @param minOutputAmount The minimum amount to transfer.\r\n */\r\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\r\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\r\n uint256 seizedOutputAmount = token.balanceOf(address(this));\r\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\r\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\r\n\r\n return seizedOutputAmount;\r\n }\r\n\r\n function safeLiquidateToTokensWithFlashLoan(\r\n LiquidateToTokensWithFlashSwapVars calldata vars\r\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\r\n // Input validation\r\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\r\n\r\n // we want to calculate the needed flashSwapAmount on-chain to\r\n // avoid errors due to changing market conditions\r\n // between the time of calculating and including the tx in a block\r\n uint256 fundingAmount = vars.repayAmount;\r\n IERC20Upgradeable fundingToken;\r\n if (vars.debtFundingStrategies.length > 0) {\r\n require(\r\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\r\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\r\n );\r\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\r\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\r\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\r\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\r\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\r\n }\r\n } else {\r\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\r\n }\r\n\r\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\r\n _flashSwapAmount = fundingAmount;\r\n _flashSwapToken = address(fundingToken);\r\n\r\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\r\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\r\n flashSwapPool.flash(\r\n address(this),\r\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\r\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\r\n msg.data\r\n );\r\n\r\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\r\n }\r\n\r\n /**\r\n * @dev Receives NATIVE from liquidations and flashloans.\r\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\r\n */\r\n receive() external payable {\r\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\r\n }\r\n\r\n /**\r\n * @notice receiveAuctionProceedings function - receives native token from the express relay\r\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\r\n */\r\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\r\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\r\n }\r\n\r\n function withdrawAll() external onlyOwner {\r\n uint256 balance = address(this).balance;\r\n require(balance > 0, \"No Ether left to withdraw\");\r\n\r\n // Transfer all Ether to the owner\r\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\r\n require(sent, \"Failed to send Ether\");\r\n }\r\n\r\n /**\r\n * @dev Callback function for Uniswap flashloans.\r\n */\r\n\r\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\r\n uniswapV3FlashCallback(fee0, fee1, data);\r\n }\r\n\r\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\r\n uniswapV3FlashCallback(fee0, fee1, data);\r\n }\r\n\r\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\r\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\r\n // Decode params\r\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\r\n\r\n // Post token flashloan\r\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\r\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\r\n }\r\n\r\n /**\r\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\r\n */\r\n function postFlashLoanTokens(\r\n LiquidateToTokensWithFlashSwapVars memory vars,\r\n uint256 fee0,\r\n uint256 fee1\r\n ) private returns (address) {\r\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\r\n uint256 debtRepaymentAmount = _flashSwapAmount;\r\n\r\n if (vars.debtFundingStrategies.length > 0) {\r\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\r\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\r\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\r\n debtRepaymentToken,\r\n debtRepaymentAmount,\r\n vars.debtFundingStrategies[i - 1],\r\n vars.debtFundingStrategiesData[i - 1]\r\n );\r\n }\r\n }\r\n\r\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\r\n {\r\n address underlyingBorrow = vars.cErc20.underlying();\r\n require(\r\n address(debtRepaymentToken) == underlyingBorrow,\r\n \"the debt repayment funds should be converted to the underlying debt token\"\r\n );\r\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\r\n // Approve repayAmount to cErc20\r\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\r\n\r\n // Liquidate borrow\r\n require(\r\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\r\n \"Liquidation failed.\"\r\n );\r\n\r\n // Redeem seized cTokens for underlying asset\r\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n }\r\n\r\n // Repay flashloan\r\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\r\n }\r\n\r\n /**\r\n * @dev Repays token flashloans.\r\n */\r\n function repayTokenFlashLoan(\r\n ICErc20 cTokenCollateral,\r\n IRedemptionStrategy[] memory redemptionStrategies,\r\n bytes[] memory strategyData,\r\n uint256 fee0,\r\n uint256 fee1\r\n ) private returns (address) {\r\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\r\n uint256 flashSwapReturnAmount = _flashSwapAmount;\r\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\r\n flashSwapReturnAmount += fee0;\r\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\r\n flashSwapReturnAmount += fee1;\r\n } else {\r\n revert(\"wrong pool or _flashSwapToken\");\r\n }\r\n\r\n // Swap cTokenCollateral for cErc20 via Uniswap\r\n // Check underlying collateral seized\r\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\r\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\r\n\r\n // Redeem custom collateral if liquidation strategy is set\r\n if (redemptionStrategies.length > 0) {\r\n require(\r\n redemptionStrategies.length == strategyData.length,\r\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\r\n );\r\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\r\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\r\n underlyingCollateral,\r\n underlyingCollateralSeized,\r\n redemptionStrategies[i],\r\n strategyData[i]\r\n );\r\n }\r\n\r\n // Check if we can repay directly one of the sides with collateral\r\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\r\n // Repay flashloan directly with collateral\r\n uint256 collateralRequired;\r\n if (address(underlyingCollateral) == _flashSwapToken) {\r\n // repay the borrowed asset directly\r\n collateralRequired = flashSwapReturnAmount;\r\n\r\n // Repay flashloan\r\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\r\n } else {\r\n // TODO swap within the same pool and then repay the FL to the pool\r\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\r\n\r\n {\r\n collateralRequired = quoter.quoteExactOutputSingle(\r\n zeroForOne ? pool.token0() : pool.token1(),\r\n zeroForOne ? pool.token1() : pool.token0(),\r\n pool.fee(),\r\n _flashSwapAmount,\r\n 0 // sqrtPriceLimitX96\r\n );\r\n }\r\n require(\r\n collateralRequired <= underlyingCollateralSeized,\r\n \"Token flashloan return amount greater than seized collateral.\"\r\n );\r\n\r\n // Repay flashloan\r\n pool.swap(\r\n address(pool),\r\n zeroForOne,\r\n int256(collateralRequired),\r\n 0, // sqrtPriceLimitX96\r\n \"\"\r\n );\r\n }\r\n\r\n return address(underlyingCollateral);\r\n } else {\r\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\r\n }\r\n }\r\n\r\n /**\r\n * @dev for security reasons only whitelisted redemption strategies may be used.\r\n * Each whitelisted redemption strategy has to be checked to not be able to\r\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\r\n */\r\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\r\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\r\n }\r\n\r\n /**\r\n * @dev for security reasons only whitelisted redemption strategies may be used.\r\n * Each whitelisted redemption strategy has to be checked to not be able to\r\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\r\n */\r\n function _whitelistRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n bool[] calldata whitelisted\r\n ) external onlyOwner {\r\n require(\r\n strategies.length > 0 && strategies.length == whitelisted.length,\r\n \"list of strategies empty or whitelist does not match its length\"\r\n );\r\n\r\n for (uint256 i = 0; i < strategies.length; i++) {\r\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\r\n }\r\n }\r\n\r\n function setExpressRelay(address _expressRelay) external onlyOwner {\r\n expressRelay = IExpressRelay(_expressRelay);\r\n }\r\n\r\n function setPoolLens(address _poolLens) external onlyOwner {\r\n lens = PoolLens(_poolLens);\r\n }\r\n\r\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\r\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\r\n healthFactorThreshold = _healthFactorThreshold;\r\n }\r\n\r\n /**\r\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\r\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\r\n */\r\n function redeemCustomCollateral(\r\n IERC20Upgradeable underlyingCollateral,\r\n uint256 underlyingCollateralSeized,\r\n IRedemptionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\r\n\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n function convertCustomFunds(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IFundsConversionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\r\n\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\r\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\r\n */\r\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\r\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\r\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\r\n */\r\n function _verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/liquidators/AerodromeCLLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\r\nimport { ISwapRouter_Aerodrome } from \"../external/aerodrome/IAerodromeSwapRouter.sol\";\r\n\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\r\n\r\ncontract AerodromeCLLiquidator is IRedemptionStrategy {\r\n /**\r\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\r\n * @param inputToken Address of the token\r\n * @param inputAmount input amount\r\n * @param strategyData context specific data like input token, pool address and tx expiratio period\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n (\r\n ,\r\n address _outputToken,\r\n ISwapRouter_Aerodrome swapRouter,\r\n address _unwrappedInput,\r\n address _unwrappedOutput,\r\n int24 _tickSpacing\r\n ) = abi.decode(strategyData, (address, address, ISwapRouter_Aerodrome, address, address, int24));\r\n if (_unwrappedOutput != address(0)) {\r\n outputToken = IERC20Upgradeable(_unwrappedOutput);\r\n } else {\r\n outputToken = IERC20Upgradeable(_outputToken);\r\n }\r\n\r\n if (_unwrappedInput != address(0)) {\r\n inputToken.approve(address(inputToken), inputAmount);\r\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\r\n inputToken = IERC20Upgradeable(_unwrappedInput);\r\n }\r\n\r\n inputToken.approve(address(swapRouter), inputAmount);\r\n\r\n outputAmount = swapRouter.exactInputSingle(\r\n ISwapRouter_Aerodrome.ExactInputSingleParams(\r\n address(inputToken),\r\n address(outputToken),\r\n _tickSpacing,\r\n address(this),\r\n block.timestamp,\r\n inputAmount,\r\n 0,\r\n 0\r\n )\r\n );\r\n\r\n if (_unwrappedOutput != address(0)) {\r\n IERC20Upgradeable(_unwrappedOutput).approve(address(_outputToken), outputAmount);\r\n IERC4626(_outputToken).deposit(outputAmount, address(this));\r\n outputAmount = IERC4626(_unwrappedOutput).balanceOf(address(this));\r\n outputToken = IERC20Upgradeable(_outputToken);\r\n }\r\n }\r\n\r\n function name() public pure virtual override returns (string memory) {\r\n return \"AerodromeCLLiquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/AerodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\r\n\r\n/**\r\n * @title AerodromeV2Liquidator\r\n * @notice Exchanges seized token collateral for underlying tokens via a Aerodrome V2 router for use as a step in a liquidation.\r\n */\r\ncontract AerodromeV2Liquidator {\r\n function _swap(IRouter_Aerodrome router, uint256 inputAmount, IRouter_Aerodrome.Route[] memory swapPath) internal {\r\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\r\n }\r\n\r\n function name() public pure virtual returns (string memory) {\r\n return \"AerodromeV2Liquidator\";\r\n }\r\n\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Get Uniswap router and path\r\n (IRouter_Aerodrome router, IRouter_Aerodrome.Route[] memory swapPath) = abi.decode(\r\n strategyData,\r\n (IRouter_Aerodrome, IRouter_Aerodrome.Route[])\r\n );\r\n require(\r\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\r\n \"Invalid AerodromeV2Liquidator swap path.\"\r\n );\r\n\r\n // Swap underlying tokens\r\n inputToken.approve(address(router), inputAmount);\r\n\r\n // call the relevant fn depending on the uni v2 fork specifics\r\n _swap(router, inputAmount, swapPath);\r\n\r\n // Get new collateral\r\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\r\n outputAmount = outputToken.balanceOf(address(this));\r\n }\r\n}\r\n" + }, + "contracts/liquidators/AlgebraSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\nimport \"../external/algebra/ISwapRouter.sol\";\r\n\r\n/**\r\n * @title AlgebraSwapLiquidator\r\n * @notice Exchanges seized token collateral for underlying tokens via a Algebra router for use as a step in a liquidation.\r\n * @author Veliko Minkov (https://github.com/vminkov)\r\n */\r\ncontract AlgebraSwapLiquidator is IRedemptionStrategy {\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n (address _outputToken, IAlgebraSwapRouter swapRouter) = abi.decode(strategyData, (address, IAlgebraSwapRouter));\r\n outputToken = IERC20Upgradeable(_outputToken);\r\n\r\n inputToken.approve(address(swapRouter), inputAmount);\r\n\r\n IAlgebraSwapRouter.ExactInputSingleParams memory params = IAlgebraSwapRouter.ExactInputSingleParams(\r\n address(inputToken),\r\n _outputToken,\r\n address(this),\r\n block.timestamp,\r\n inputAmount,\r\n 0, // amountOutMinimum\r\n 0 // limitSqrtPrice\r\n );\r\n\r\n outputAmount = swapRouter.exactInputSingle(params);\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return \"AlgebraSwapLiquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/BaseUniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\n\r\nabstract contract BaseUniswapV2Liquidator is IRedemptionStrategy {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Get Uniswap router and path\r\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\r\n strategyData,\r\n (IUniswapV2Router02, address[])\r\n );\r\n require(swapPath.length >= 2 && swapPath[0] == address(inputToken), \"Invalid UniswapLiquidator swap path.\");\r\n\r\n // Swap underlying tokens\r\n inputToken.approve(address(uniswapV2Router), inputAmount);\r\n\r\n // call the relevant fn depending on the uni v2 fork specifics\r\n _swap(uniswapV2Router, inputAmount, swapPath);\r\n\r\n // Get new collateral\r\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1]);\r\n outputAmount = outputToken.balanceOf(address(this));\r\n }\r\n\r\n function _swap(IUniswapV2Router02 uniswapV2Router, uint256 inputAmount, address[] memory swapPath) internal virtual;\r\n}\r\n" + }, + "contracts/liquidators/CErc20Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nimport \"../external/compound/ICErc20.sol\";\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\n\r\n/**\r\n * @title CErc20Liquidator\r\n * @notice Redeems seized Compound/Cream/Ionic CErc20 cTokens for underlying tokens for use as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract CErc20Liquidator is IRedemptionStrategy {\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Redeem cErc20 for underlying ERC20 token (and store output as new collateral)\r\n ICErc20Compound cErc20 = ICErc20Compound(address(inputToken));\r\n uint256 redeemResult = cErc20.redeem(inputAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cErc20: error code not equal to 0\");\r\n outputToken = IERC20Upgradeable(cErc20.underlying());\r\n outputAmount = outputToken.balanceOf(address(this));\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return \"CErc20Liquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/CurveSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nimport \"../external/curve/ICurvePool.sol\";\r\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\n\r\nimport \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\r\nimport \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\r\n\r\n/**\r\n * @title CurveSwapLiquidator\r\n * @notice Swaps seized token collateral via Curve as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract CurveSwapLiquidator is IRedemptionStrategy {\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable, uint256) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n (\r\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\r\n address outputTokenAddress,\r\n address _unwrappedInput,\r\n address _unwrappedOutput\r\n ) = abi.decode(strategyData, (CurveV2LpTokenPriceOracleNoRegistry, address, address, address));\r\n\r\n if (_unwrappedOutput != address(0)) {\r\n outputToken = IERC20Upgradeable(_unwrappedOutput);\r\n } else {\r\n outputToken = IERC20Upgradeable(outputTokenAddress);\r\n }\r\n\r\n if (_unwrappedInput != address(0)) {\r\n inputToken.approve(address(inputToken), inputAmount);\r\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\r\n inputToken = IERC20Upgradeable(_unwrappedInput);\r\n }\r\n\r\n address inputTokenAddress = address(inputToken);\r\n\r\n ICurvePool curvePool;\r\n int128 i;\r\n int128 j;\r\n if (address(curveV2Oracle) != address(0)) {\r\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, address(outputToken));\r\n }\r\n require(address(curvePool) != address(0), \"!curve pool\");\r\n\r\n inputToken.approve(address(curvePool), inputAmount);\r\n outputAmount = curvePool.exchange(i, j, inputAmount, 0);\r\n\r\n if (_unwrappedOutput != address(0)) {\r\n IERC20Upgradeable(_unwrappedOutput).approve(address(outputTokenAddress), outputAmount);\r\n IERC4626(outputTokenAddress).deposit(outputAmount, address(this));\r\n outputToken = IERC20Upgradeable(outputTokenAddress);\r\n }\r\n\r\n outputAmount = outputToken.balanceOf(address(this));\r\n return (outputToken, outputAmount);\r\n }\r\n\r\n function name() public pure virtual returns (string memory) {\r\n return \"CurveSwapLiquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/CurveSwapLiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CurveSwapLiquidator.sol\";\r\nimport \"./IFundsConversionStrategy.sol\";\r\n\r\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\r\n\r\ncontract CurveSwapLiquidatorFunder is CurveSwapLiquidator, IFundsConversionStrategy {\r\n function convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function estimateInputAmount(\r\n uint256 outputAmount,\r\n bytes memory strategyData\r\n ) external view returns (IERC20Upgradeable, uint256) {\r\n ICurvePool curvePool;\r\n int128 i;\r\n int128 j;\r\n {\r\n (\r\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle,\r\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\r\n address inputTokenAddress,\r\n address outputTokenAddress,\r\n\r\n ) = abi.decode(\r\n strategyData,\r\n (CurveLpTokenPriceOracleNoRegistry, CurveV2LpTokenPriceOracleNoRegistry, address, address, address)\r\n );\r\n\r\n if (address(curveV2Oracle) != address(0)) {\r\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\r\n }\r\n if (address(curvePool) == address(0)) {\r\n (curvePool, i, j) = curveV1Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\r\n }\r\n }\r\n require(address(curvePool) != address(0), \"!curve pool\");\r\n\r\n IERC20MetadataUpgradeable inputMetadataToken = IERC20MetadataUpgradeable(curvePool.coins(uint256(int256(i))));\r\n uint256 inputAmountGuesstimate = guesstimateInputAmount(curvePool, i, j, inputMetadataToken, outputAmount);\r\n uint256 inputAmount = binSearch(\r\n curvePool,\r\n i,\r\n j,\r\n (70 * inputAmountGuesstimate) / 100,\r\n (130 * inputAmountGuesstimate) / 100,\r\n outputAmount\r\n );\r\n\r\n return (inputMetadataToken, inputAmount);\r\n }\r\n\r\n function guesstimateInputAmount(\r\n ICurvePool curvePool,\r\n int128 i,\r\n int128 j,\r\n IERC20MetadataUpgradeable inputMetadataToken,\r\n uint256 outputAmount\r\n ) internal view returns (uint256) {\r\n uint256 oneInputToken = 10 ** inputMetadataToken.decimals();\r\n uint256 outputTokensForOneInputToken = curvePool.get_dy(i, j, oneInputToken);\r\n // inputAmount / outputAmount = oneInputToken / outputTokensForOneInputToken\r\n uint256 inputAmount = (outputAmount * oneInputToken) / outputTokensForOneInputToken;\r\n return inputAmount;\r\n }\r\n\r\n function binSearch(\r\n ICurvePool curvePool,\r\n int128 i,\r\n int128 j,\r\n uint256 low,\r\n uint256 high,\r\n uint256 value\r\n ) internal view returns (uint256) {\r\n if (low >= high) return low;\r\n\r\n uint256 mid = (low + high) / 2;\r\n uint256 outputAmount = curvePool.get_dy(i, j, mid);\r\n if (outputAmount == 0) revert(\"output amount 0\");\r\n // output can be up to 10% in excess\r\n if (outputAmount >= value && outputAmount <= (11 * value) / 10) return mid;\r\n else if (outputAmount > value) {\r\n return binSearch(curvePool, i, j, low, mid, value);\r\n } else {\r\n return binSearch(curvePool, i, j, mid, high, value);\r\n }\r\n }\r\n\r\n function name() public pure override(CurveSwapLiquidator, IRedemptionStrategy) returns (string memory) {\r\n return \"CurveSwapLiquidatorFunder\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/CustomLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nimport \"../utils/IW_NATIVE.sol\";\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\n\r\n/**\r\n * @title CustomLiquidator\r\n * @notice Redeems seized collateral tokens for the specified output token by calling the specified contract for use as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract CustomLiquidator is IRedemptionStrategy {\r\n using AddressUpgradeable for address;\r\n\r\n /**\r\n * @dev W_NATIVE contract object.\r\n */\r\n IW_NATIVE private constant W_NATIVE = IW_NATIVE(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\r\n\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Call arbitrary contract\r\n address target;\r\n bytes memory data;\r\n (target, data, outputToken) = abi.decode(strategyData, (address, bytes, IERC20Upgradeable));\r\n target.functionCall(data);\r\n outputAmount = address(outputToken) == address(0) ? address(this).balance : outputToken.balanceOf(address(this));\r\n\r\n // Convert to W_NATIVE if ETH because `IonicLiquidator.repayTokenFlashLoan` only supports tokens (not ETH) as output from redemptions (reverts on line 24 because `underlyingCollateral` is the zero address)\r\n if (address(outputToken) == address(0)) {\r\n W_NATIVE.deposit{ value: outputAmount }();\r\n return (IERC20Upgradeable(address(W_NATIVE)), outputAmount);\r\n }\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return \"CustomLiquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/ERC4626Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\r\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\r\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\r\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\r\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\r\n\r\n/**\r\n * @title ERC4626Liquidator\r\n * @notice Redeems ERC4626 assets and optionally swaps them via Uniswap V2 router for use as a step in a liquidation.\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n */\r\ncontract ERC4626Liquidator is IRedemptionStrategy {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Get Uniswap router and path\r\n (IERC20Upgradeable _outputToken, uint24 fee, ISwapRouter swapRouter, address[] memory underlyingTokens, ) = abi\r\n .decode(strategyData, (IERC20Upgradeable, uint24, ISwapRouter, address[], Quoter));\r\n\r\n if (underlyingTokens.length == 1) {\r\n // If there is only one underlying token, we can just redeem it directly\r\n require(\r\n address(_outputToken) == underlyingTokens[0],\r\n \"ERC4626Liquidator: output token does not match underlying token\"\r\n );\r\n\r\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\r\n outputAmount = IERC20Upgradeable(_outputToken).balanceOf(address(this));\r\n\r\n return (_outputToken, outputAmount);\r\n } else {\r\n // NOTE: for Sommelier, the underlying tokens can be fetched from the Sommelier contract\r\n // E.g. https://etherscan.io/address/0x6b7f87279982d919bbf85182ddeab179b366d8f2#readContract#F20\r\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\r\n\r\n // for each token, we need to swap it for the output token\r\n for (uint256 i = 0; i < underlyingTokens.length; i++) {\r\n // do nothing if the token is the output token\r\n if (underlyingTokens[i] == address(_outputToken)) {\r\n continue;\r\n }\r\n if (IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)) == 0) {\r\n continue;\r\n }\r\n _swap(\r\n underlyingTokens[i],\r\n IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)),\r\n address(_outputToken),\r\n swapRouter,\r\n fee\r\n );\r\n }\r\n outputAmount = _outputToken.balanceOf(address(this));\r\n return (_outputToken, outputAmount);\r\n }\r\n }\r\n\r\n function _swap(\r\n address inputToken,\r\n uint256 inputAmount,\r\n address outputToken,\r\n ISwapRouter swapRouter,\r\n uint24 fee\r\n ) internal returns (uint256 outputAmount) {\r\n IERC20Upgradeable(inputToken).approve(address(swapRouter), inputAmount);\r\n\r\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams(\r\n address(inputToken),\r\n outputToken,\r\n fee,\r\n address(this),\r\n block.timestamp,\r\n inputAmount,\r\n 0,\r\n 0\r\n );\r\n outputAmount = swapRouter.exactInputSingle(params);\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return \"ERC4626Liquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface IFundsConversionStrategy is IRedemptionStrategy {\r\n function convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\r\n\r\n function estimateInputAmount(\r\n uint256 outputAmount,\r\n bytes memory strategyData\r\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\r\n}\r\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\n/**\r\n * @title IRedemptionStrategy\r\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ninterface IRedemptionStrategy {\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\r\n\r\n function name() external view returns (string memory);\r\n}\r\n" + }, + "contracts/liquidators/KimUniV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./BaseUniswapV2Liquidator.sol\";\r\n\r\ncontract KimUniV2Liquidator is BaseUniswapV2Liquidator {\r\n function _swap(\r\n IUniswapV2Router02 uniswapV2Router,\r\n uint256 inputAmount,\r\n address[] memory swapPath\r\n ) internal override {\r\n uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n inputAmount,\r\n 0,\r\n swapPath,\r\n address(this),\r\n address(0), // referrer\r\n block.timestamp\r\n );\r\n }\r\n\r\n function name() public pure virtual returns (string memory) {\r\n return \"KimUniV2Liquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/registry/ILiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface ILiquidatorsRegistryStorage {\r\n function redemptionStrategiesByName(string memory name) external view returns (IRedemptionStrategy);\r\n\r\n function redemptionStrategiesByTokens(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (IRedemptionStrategy);\r\n\r\n function defaultOutputToken(IERC20Upgradeable inputToken) external view returns (IERC20Upgradeable);\r\n\r\n function owner() external view returns (address);\r\n\r\n function uniswapV3Fees(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external view returns (uint24);\r\n\r\n function customUniV3Router(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (address);\r\n}\r\n\r\ninterface ILiquidatorsRegistryExtension {\r\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory);\r\n\r\n function getRedemptionStrategies(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\r\n\r\n function getRedemptionStrategy(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (IRedemptionStrategy strategy, bytes memory strategyData);\r\n\r\n function getAllRedemptionStrategies() external view returns (address[] memory);\r\n\r\n function getSlippage(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (uint256 slippage);\r\n\r\n function swap(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IERC20Upgradeable outputToken\r\n ) external returns (uint256);\r\n\r\n function amountOutAndSlippageOfSwap(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IERC20Upgradeable outputToken\r\n ) external returns (uint256 outputAmount, uint256 slippage);\r\n}\r\n\r\ninterface ILiquidatorsRegistrySecondExtension {\r\n function getAllPairsStrategies()\r\n external\r\n view\r\n returns (\r\n IRedemptionStrategy[] memory strategies,\r\n IERC20Upgradeable[] memory inputTokens,\r\n IERC20Upgradeable[] memory outputTokens\r\n );\r\n\r\n function pairsStrategiesMatch(\r\n IRedemptionStrategy[] calldata configStrategies,\r\n IERC20Upgradeable[] calldata configInputTokens,\r\n IERC20Upgradeable[] calldata configOutputTokens\r\n ) external view returns (bool);\r\n\r\n function uniswapPairsFeesMatch(\r\n IERC20Upgradeable[] calldata configInputTokens,\r\n IERC20Upgradeable[] calldata configOutputTokens,\r\n uint256[] calldata configFees\r\n ) external view returns (bool);\r\n\r\n function uniswapPairsRoutersMatch(\r\n IERC20Upgradeable[] calldata configInputTokens,\r\n IERC20Upgradeable[] calldata configOutputTokens,\r\n address[] calldata configRouters\r\n ) external view returns (bool);\r\n\r\n function _setRedemptionStrategy(\r\n IRedemptionStrategy strategy,\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external;\r\n\r\n function _setRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens\r\n ) external;\r\n\r\n function _resetRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens\r\n ) external;\r\n\r\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external;\r\n\r\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external;\r\n\r\n function _setUniswapV3Fees(\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens,\r\n uint24[] calldata fees\r\n ) external;\r\n\r\n function _setUniswapV3Routers(\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens,\r\n address[] calldata routers\r\n ) external;\r\n\r\n function _setSlippages(\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens,\r\n uint256[] calldata slippages\r\n ) external;\r\n\r\n function optimalSwapPath(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (IERC20Upgradeable[] memory);\r\n\r\n function _setOptimalSwapPath(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken,\r\n IERC20Upgradeable[] calldata optimalPath\r\n ) external;\r\n\r\n function wrappedToUnwrapped4626(address wrapped) external view returns (address);\r\n\r\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external;\r\n\r\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24);\r\n\r\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external;\r\n\r\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool);\r\n\r\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external;\r\n}\r\n\r\ninterface ILiquidatorsRegistry is\r\n ILiquidatorsRegistryExtension,\r\n ILiquidatorsRegistrySecondExtension,\r\n ILiquidatorsRegistryStorage\r\n{}\r\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport \"../../ionic/DiamondExtension.sol\";\r\nimport \"./LiquidatorsRegistryStorage.sol\";\r\nimport \"./LiquidatorsRegistryExtension.sol\";\r\n\r\ncontract LiquidatorsRegistry is LiquidatorsRegistryStorage, DiamondBase {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n constructor(AddressesProvider _ap) SafeOwnable() {\r\n ap = _ap;\r\n }\r\n\r\n /**\r\n * @dev register a logic extension\r\n * @param extensionToAdd the extension whose functions are to be added\r\n * @param extensionToReplace the extension whose functions are to be removed/replaced\r\n */\r\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace)\r\n public\r\n override\r\n onlyOwner\r\n {\r\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\r\n }\r\n\r\n function asExtension() public view returns (LiquidatorsRegistryExtension) {\r\n return LiquidatorsRegistryExtension(address(this));\r\n }\r\n}\r\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistryExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport \"./ILiquidatorsRegistry.sol\";\r\nimport \"./LiquidatorsRegistryStorage.sol\";\r\n\r\nimport \"../IRedemptionStrategy.sol\";\r\nimport \"../../ionic/DiamondExtension.sol\";\r\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\r\n\r\nimport { IRouter_Aerodrome as IAerodromeV2Router } from \"../../external/aerodrome/IAerodromeRouter.sol\";\r\nimport { IRouter_Velodrome as IVelodromeV2Router } from \"../../external/velodrome/IVelodromeRouter.sol\";\r\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\ncontract LiquidatorsRegistryExtension is LiquidatorsRegistryStorage, DiamondExtension, ILiquidatorsRegistryExtension {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n error NoRedemptionPath();\r\n error OutputTokenMismatch();\r\n\r\n event SlippageUpdated(\r\n IERC20Upgradeable indexed from,\r\n IERC20Upgradeable indexed to,\r\n uint256 prevValue,\r\n uint256 newValue\r\n );\r\n\r\n // @notice maximum slippage in swaps, in bps\r\n uint256 public constant MAX_SLIPPAGE = 900; // 9%\r\n\r\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\r\n uint8 fnsCount = 7;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\r\n functionSelectors[--fnsCount] = this.getRedemptionStrategy.selector;\r\n functionSelectors[--fnsCount] = this.getInputTokensByOutputToken.selector;\r\n functionSelectors[--fnsCount] = this.swap.selector;\r\n functionSelectors[--fnsCount] = this.getAllRedemptionStrategies.selector;\r\n functionSelectors[--fnsCount] = this.amountOutAndSlippageOfSwap.selector;\r\n functionSelectors[--fnsCount] = this.getSlippage.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n function getSlippage(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) external view returns (uint256 slippage) {\r\n slippage = conversionSlippage[inputToken][outputToken];\r\n // TODO slippage == 0 should be allowed\r\n if (slippage == 0) return MAX_SLIPPAGE;\r\n }\r\n\r\n function getAllRedemptionStrategies() public view returns (address[] memory) {\r\n return redemptionStrategies.values();\r\n }\r\n\r\n function amountOutAndSlippageOfSwap(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IERC20Upgradeable outputToken\r\n ) external returns (uint256 outputAmount, uint256 slippage) {\r\n if (inputAmount == 0) return (0, 0);\r\n\r\n outputAmount = swap(inputToken, inputAmount, outputToken);\r\n if (outputAmount == 0) return (0, 0);\r\n\r\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\r\n uint256 inputTokenPrice = mpo.price(address(inputToken));\r\n uint256 outputTokenPrice = mpo.price(address(outputToken));\r\n\r\n uint256 inputTokensValue = inputAmount * toScaledPrice(inputTokenPrice, inputToken);\r\n uint256 outputTokensValue = outputAmount * toScaledPrice(outputTokenPrice, outputToken);\r\n\r\n if (outputTokensValue < inputTokensValue) {\r\n slippage = ((inputTokensValue - outputTokensValue) * 10000) / inputTokensValue;\r\n }\r\n // min slippage should be non-zero\r\n // just in case of rounding errors\r\n slippage += 1;\r\n\r\n // cache the slippage\r\n uint256 prevValue = conversionSlippage[inputToken][outputToken];\r\n if (prevValue == 0 || block.timestamp - conversionSlippageUpdated[inputToken][outputToken] > 5000) {\r\n emit SlippageUpdated(inputToken, outputToken, prevValue, slippage);\r\n\r\n conversionSlippage[inputToken][outputToken] = slippage;\r\n conversionSlippageUpdated[inputToken][outputToken] = block.timestamp;\r\n }\r\n }\r\n\r\n /// @dev returns price scaled to 1e36 - decimals\r\n function toScaledPrice(uint256 unscaledPrice, IERC20Upgradeable token) internal view returns (uint256) {\r\n uint256 tokenDecimals = uint256(ERC20Upgradeable(address(token)).decimals());\r\n return\r\n tokenDecimals <= 18\r\n ? uint256(unscaledPrice) * (10 ** (18 - tokenDecimals))\r\n : uint256(unscaledPrice) / (10 ** (tokenDecimals - 18));\r\n }\r\n\r\n function swap(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IERC20Upgradeable outputToken\r\n ) public returns (uint256 outputAmount) {\r\n inputToken.safeTransferFrom(msg.sender, address(this), inputAmount);\r\n outputAmount = convertAllTo(inputToken, outputToken);\r\n outputToken.safeTransfer(msg.sender, outputAmount);\r\n }\r\n\r\n function convertAllTo(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) private returns (uint256) {\r\n uint256 inputAmount = inputToken.balanceOf(address(this));\r\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = getRedemptionStrategies(\r\n inputToken,\r\n outputToken\r\n );\r\n\r\n if (redemptionStrategies.length == 0) revert NoRedemptionPath();\r\n\r\n IERC20Upgradeable swapInputToken = inputToken;\r\n uint256 swapInputAmount = inputAmount;\r\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\r\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\r\n bytes memory strategyData = strategiesData[i];\r\n (IERC20Upgradeable swapOutputToken, uint256 swapOutputAmount) = convertCustomFunds(\r\n swapInputToken,\r\n swapInputAmount,\r\n redemptionStrategy,\r\n strategyData\r\n );\r\n swapInputAmount = swapOutputAmount;\r\n swapInputToken = swapOutputToken;\r\n }\r\n\r\n if (swapInputToken != outputToken) revert OutputTokenMismatch();\r\n return outputToken.balanceOf(address(this));\r\n }\r\n\r\n function convertCustomFunds(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IRedemptionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\r\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n function _verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n if (returndata.length > 0) {\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n\r\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory) {\r\n return inputTokensByOutputToken[outputToken].values();\r\n }\r\n\r\n function getRedemptionStrategies(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) public view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\r\n IERC20Upgradeable tokenToRedeem = inputToken;\r\n IERC20Upgradeable targetOutputToken = outputToken;\r\n IRedemptionStrategy[] memory strategiesTemp = new IRedemptionStrategy[](10);\r\n bytes[] memory strategiesDataTemp = new bytes[](10);\r\n IERC20Upgradeable[] memory tokenPath = new IERC20Upgradeable[](10);\r\n IERC20Upgradeable[] memory optimalPath = new IERC20Upgradeable[](0);\r\n uint256 optimalPathIterator = 0;\r\n\r\n uint256 k = 0;\r\n while (tokenToRedeem != targetOutputToken) {\r\n IERC20Upgradeable nextRedeemedToken;\r\n IRedemptionStrategy directStrategy = redemptionStrategiesByTokens[tokenToRedeem][targetOutputToken];\r\n if (address(directStrategy) != address(0)) {\r\n nextRedeemedToken = targetOutputToken;\r\n } else {\r\n // check if an optimal path is preconfigured\r\n if (optimalPath.length == 0 && _optimalSwapPath[tokenToRedeem][targetOutputToken].length != 0) {\r\n optimalPath = _optimalSwapPath[tokenToRedeem][targetOutputToken];\r\n }\r\n if (optimalPath.length != 0 && optimalPathIterator < optimalPath.length) {\r\n nextRedeemedToken = optimalPath[optimalPathIterator++];\r\n } else {\r\n // else if no optimal path is available, use the default\r\n nextRedeemedToken = defaultOutputToken[tokenToRedeem];\r\n }\r\n }\r\n\r\n // check if going in an endless loop\r\n for (uint256 i = 0; i < tokenPath.length; i++) {\r\n if (nextRedeemedToken == tokenPath[i]) break;\r\n }\r\n\r\n (IRedemptionStrategy strategy, bytes memory strategyData) = getRedemptionStrategy(\r\n tokenToRedeem,\r\n nextRedeemedToken\r\n );\r\n if (address(strategy) == address(0)) break;\r\n\r\n strategiesTemp[k] = strategy;\r\n strategiesDataTemp[k] = strategyData;\r\n tokenPath[k] = nextRedeemedToken;\r\n tokenToRedeem = nextRedeemedToken;\r\n\r\n k++;\r\n if (k == 10) break;\r\n }\r\n\r\n strategies = new IRedemptionStrategy[](k);\r\n strategiesData = new bytes[](k);\r\n\r\n for (uint8 i = 0; i < k; i++) {\r\n strategies[i] = strategiesTemp[i];\r\n strategiesData[i] = strategiesDataTemp[i];\r\n }\r\n }\r\n\r\n function getRedemptionStrategy(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) public view returns (IRedemptionStrategy strategy, bytes memory strategyData) {\r\n strategy = redemptionStrategiesByTokens[inputToken][outputToken];\r\n\r\n if (isStrategy(strategy, \"UniswapV2LiquidatorFunder\") || isStrategy(strategy, \"KimUniV2Liquidator\")) {\r\n strategyData = uniswapV2LiquidatorData(inputToken, outputToken);\r\n } else if (isStrategy(strategy, \"UniswapV3LiquidatorFunder\")) {\r\n strategyData = uniswapV3LiquidatorFunderData(inputToken, outputToken);\r\n } else if (isStrategy(strategy, \"AlgebraSwapLiquidator\")) {\r\n strategyData = algebraSwapLiquidatorData(inputToken, outputToken);\r\n } else if (isStrategy(strategy, \"AerodromeV2Liquidator\")) {\r\n strategyData = aerodromeV2LiquidatorData(inputToken, outputToken);\r\n } else if (isStrategy(strategy, \"AerodromeCLLiquidator\")) {\r\n strategyData = aerodromeCLLiquidatorData(inputToken, outputToken);\r\n } else if (isStrategy(strategy, \"CurveSwapLiquidator\")) {\r\n strategyData = curveSwapLiquidatorData(inputToken, outputToken);\r\n } else if (isStrategy(strategy, \"VelodromeV2Liquidator\")) {\r\n strategyData = velodromeV2LiquidatorData(inputToken, outputToken);\r\n } else {\r\n revert(\"no strategy data\");\r\n }\r\n }\r\n\r\n function isStrategy(IRedemptionStrategy strategy, string memory name) internal view returns (bool) {\r\n return address(strategy) != address(0) && address(strategy) == address(redemptionStrategiesByName[name]);\r\n }\r\n\r\n function pickPreferredToken(address[] memory tokens, address strategyOutputToken) internal view returns (address) {\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n if (tokens[i] == strategyOutputToken) return strategyOutputToken;\r\n }\r\n address wnative = ap.getAddress(\"wtoken\");\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n if (tokens[i] == wnative) return wnative;\r\n }\r\n address stableToken = ap.getAddress(\"stableToken\");\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n if (tokens[i] == stableToken) return stableToken;\r\n }\r\n address wbtc = ap.getAddress(\"wBTCToken\");\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n if (tokens[i] == wbtc) return wbtc;\r\n }\r\n return tokens[0];\r\n }\r\n\r\n function getUniswapV3Router(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (address) {\r\n address customRouter = customUniV3Router[inputToken][outputToken];\r\n if (customRouter == address(0)) {\r\n customRouter = customUniV3Router[outputToken][inputToken];\r\n }\r\n\r\n if (customRouter != address(0)) {\r\n return customRouter;\r\n } else {\r\n // get asset specific router or default\r\n return ap.getAddress(\"UNISWAP_V3_ROUTER\");\r\n }\r\n }\r\n\r\n function getUniswapV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\r\n // get asset specific router or default\r\n return ap.getAddress(\"IUniswapV2Router02\");\r\n }\r\n\r\n function getAerodromeV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\r\n // get asset specific router or default\r\n return ap.getAddress(\"AERODROME_V2_ROUTER\");\r\n }\r\n\r\n function getAerodromeCLRouter(IERC20Upgradeable inputToken) internal view returns (address) {\r\n // get asset specific router or default\r\n return ap.getAddress(\"AERODROME_CL_ROUTER\");\r\n }\r\n\r\n function uniswapV3LiquidatorFunderData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n uint24 fee = uniswapV3Fees[inputToken][outputToken];\r\n if (fee == 0) fee = uniswapV3Fees[outputToken][inputToken];\r\n if (fee == 0) fee = 500;\r\n\r\n address router = getUniswapV3Router(inputToken, outputToken);\r\n strategyData = abi.encode(inputToken, outputToken, fee, router, ap.getAddress(\"Quoter\"));\r\n }\r\n\r\n function getWrappedToUnwrapped4626(IERC20Upgradeable inputToken) internal view returns (address) {\r\n return _wrappedToUnwrapped4626[address(inputToken)];\r\n }\r\n\r\n function getAeroCLTickSpacing(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (int24) {\r\n int24 tickSpacing = _aeroCLTickSpacings[address(inputToken)][address(outputToken)];\r\n if (tickSpacing == 0) {\r\n tickSpacing = 1;\r\n }\r\n return tickSpacing;\r\n }\r\n\r\n function aeroV2IsStable(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) internal view returns (bool) {\r\n return _aeroV2IsStable[address(inputToken)][address(outputToken)];\r\n }\r\n\r\n function uniswapV2LiquidatorData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n IERC20Upgradeable[] memory swapPath = new IERC20Upgradeable[](2);\r\n swapPath[0] = inputToken;\r\n swapPath[1] = outputToken;\r\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\r\n }\r\n\r\n function aerodromeV2LiquidatorData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n IAerodromeV2Router.Route[] memory swapPath = new IAerodromeV2Router.Route[](1);\r\n swapPath[0] = IAerodromeV2Router.Route({\r\n from: address(inputToken),\r\n to: address(outputToken),\r\n stable: aeroV2IsStable(inputToken, outputToken),\r\n factory: ap.getAddress(\"AERODROME_V2_FACTORY\")\r\n });\r\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\r\n }\r\n\r\n function aerodromeCLLiquidatorData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n strategyData = abi.encode(\r\n inputToken,\r\n outputToken,\r\n getAerodromeCLRouter(inputToken),\r\n getWrappedToUnwrapped4626(inputToken),\r\n getWrappedToUnwrapped4626(outputToken),\r\n getAeroCLTickSpacing(inputToken, outputToken)\r\n );\r\n }\r\n\r\n function algebraSwapLiquidatorData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n strategyData = abi.encode(outputToken, ap.getAddress(\"ALGEBRA_SWAP_ROUTER\"));\r\n }\r\n\r\n function curveSwapLiquidatorData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n strategyData = abi.encode(\r\n ap.getAddress(\"CURVE_V2_ORACLE_NO_REGISTRY\"),\r\n outputToken,\r\n getWrappedToUnwrapped4626(inputToken),\r\n getWrappedToUnwrapped4626(outputToken)\r\n );\r\n }\r\n\r\n function velodromeV2LiquidatorData(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) internal view returns (bytes memory strategyData) {\r\n IVelodromeV2Router.Route[] memory swapPath = new IVelodromeV2Router.Route[](1);\r\n swapPath[0] = IVelodromeV2Router.Route({\r\n from: address(inputToken),\r\n to: address(outputToken),\r\n stable: aeroV2IsStable(inputToken, outputToken)\r\n });\r\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\r\n }\r\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistrySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport \"./ILiquidatorsRegistry.sol\";\r\nimport \"./LiquidatorsRegistryStorage.sol\";\r\n\r\nimport \"../../ionic/DiamondExtension.sol\";\r\n\r\ncontract LiquidatorsRegistrySecondExtension is\r\n LiquidatorsRegistryStorage,\r\n DiamondExtension,\r\n ILiquidatorsRegistrySecondExtension\r\n{\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\r\n uint8 fnsCount = 20;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.getAllPairsStrategies.selector;\r\n functionSelectors[--fnsCount] = this.pairsStrategiesMatch.selector;\r\n functionSelectors[--fnsCount] = this.uniswapPairsFeesMatch.selector;\r\n functionSelectors[--fnsCount] = this.uniswapPairsRoutersMatch.selector;\r\n functionSelectors[--fnsCount] = this._setSlippages.selector;\r\n functionSelectors[--fnsCount] = this._setUniswapV3Fees.selector;\r\n functionSelectors[--fnsCount] = this._setUniswapV3Routers.selector;\r\n functionSelectors[--fnsCount] = this._setDefaultOutputToken.selector;\r\n functionSelectors[--fnsCount] = this._setRedemptionStrategy.selector;\r\n functionSelectors[--fnsCount] = this._setRedemptionStrategies.selector;\r\n functionSelectors[--fnsCount] = this._removeRedemptionStrategy.selector;\r\n functionSelectors[--fnsCount] = this._resetRedemptionStrategies.selector;\r\n functionSelectors[--fnsCount] = this.optimalSwapPath.selector;\r\n functionSelectors[--fnsCount] = this._setOptimalSwapPath.selector;\r\n functionSelectors[--fnsCount] = this.wrappedToUnwrapped4626.selector;\r\n functionSelectors[--fnsCount] = this.aeroCLTickSpacings.selector;\r\n functionSelectors[--fnsCount] = this.aeroV2IsStable.selector;\r\n functionSelectors[--fnsCount] = this._setWrappedToUnwrapped4626.selector;\r\n functionSelectors[--fnsCount] = this._setAeroCLTickSpacings.selector;\r\n functionSelectors[--fnsCount] = this._setAeroV2IsStable.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n function _setSlippages(\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens,\r\n uint256[] calldata slippages\r\n ) external onlyOwner {\r\n require(slippages.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\r\n\r\n for (uint256 i = 0; i < slippages.length; i++) {\r\n conversionSlippage[inputTokens[i]][outputTokens[i]] = slippages[i];\r\n }\r\n }\r\n\r\n function _setUniswapV3Fees(\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens,\r\n uint24[] calldata fees\r\n ) external onlyOwner {\r\n require(fees.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\r\n\r\n for (uint256 i = 0; i < fees.length; i++) {\r\n uniswapV3Fees[inputTokens[i]][outputTokens[i]] = fees[i];\r\n }\r\n }\r\n\r\n function _setUniswapV3Routers(\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens,\r\n address[] calldata routers\r\n ) external onlyOwner {\r\n require(routers.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\r\n\r\n for (uint256 i = 0; i < routers.length; i++) {\r\n customUniV3Router[inputTokens[i]][outputTokens[i]] = routers[i];\r\n }\r\n }\r\n\r\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external onlyOwner {\r\n defaultOutputToken[inputToken] = outputToken;\r\n }\r\n\r\n function _setRedemptionStrategy(\r\n IRedemptionStrategy strategy,\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken\r\n ) public onlyOwner {\r\n string memory name = strategy.name();\r\n IRedemptionStrategy oldStrategy = redemptionStrategiesByName[name];\r\n\r\n redemptionStrategiesByTokens[inputToken][outputToken] = strategy;\r\n redemptionStrategiesByName[name] = strategy;\r\n\r\n redemptionStrategies.remove(address(oldStrategy));\r\n redemptionStrategies.add(address(strategy));\r\n\r\n if (defaultOutputToken[inputToken] == IERC20Upgradeable(address(0))) {\r\n defaultOutputToken[inputToken] = outputToken;\r\n }\r\n inputTokensByOutputToken[outputToken].add(address(inputToken));\r\n outputTokensSet.add(address(outputToken));\r\n }\r\n\r\n function _setRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens\r\n ) external onlyOwner {\r\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\r\n for (uint256 i = 0; i < strategies.length; i++) {\r\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\r\n }\r\n }\r\n\r\n function _resetRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n IERC20Upgradeable[] calldata inputTokens,\r\n IERC20Upgradeable[] calldata outputTokens\r\n ) external onlyOwner {\r\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\r\n\r\n // empty the input/output token mappings/sets\r\n address[] memory _outputTokens = outputTokensSet.values();\r\n for (uint256 i = 0; i < _outputTokens.length; i++) {\r\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\r\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\r\n for (uint256 j = 0; j < _inputTokens.length; j++) {\r\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\r\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\r\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\r\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\r\n }\r\n outputTokensSet.remove(_outputTokens[i]);\r\n }\r\n\r\n // empty the strategies mappings/sets\r\n address[] memory _currentStrategies = redemptionStrategies.values();\r\n for (uint256 i = 0; i < _currentStrategies.length; i++) {\r\n IRedemptionStrategy _currentStrategy = IRedemptionStrategy(_currentStrategies[i]);\r\n string memory _name = _currentStrategy.name();\r\n redemptionStrategiesByName[_name] = IRedemptionStrategy(address(0));\r\n redemptionStrategies.remove(_currentStrategies[i]);\r\n }\r\n\r\n // write the new strategies and their tokens configs\r\n for (uint256 i = 0; i < strategies.length; i++) {\r\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\r\n }\r\n }\r\n\r\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external onlyOwner {\r\n // check all the input/output tokens if they match the strategy to remove\r\n address[] memory _outputTokens = outputTokensSet.values();\r\n for (uint256 i = 0; i < _outputTokens.length; i++) {\r\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\r\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\r\n for (uint256 j = 0; j < _inputTokens.length; j++) {\r\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\r\n IRedemptionStrategy _currentStrategy = redemptionStrategiesByTokens[_inputToken][_outputToken];\r\n\r\n // only nullify the input/output tokens config if the strategy matches\r\n if (_currentStrategy == strategyToRemove) {\r\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\r\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\r\n if (defaultOutputToken[_inputToken] == _outputToken) {\r\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\r\n }\r\n }\r\n }\r\n if (inputTokensByOutputToken[_outputToken].length() == 0) {\r\n outputTokensSet.remove(address(_outputToken));\r\n }\r\n }\r\n\r\n redemptionStrategiesByName[strategyToRemove.name()] = IRedemptionStrategy(address(0));\r\n redemptionStrategies.remove(address(strategyToRemove));\r\n }\r\n\r\n function uniswapPairsFeesMatch(\r\n IERC20Upgradeable[] calldata configInputTokens,\r\n IERC20Upgradeable[] calldata configOutputTokens,\r\n uint256[] calldata configFees\r\n ) external view returns (bool) {\r\n // find a match for each config fee\r\n for (uint256 i = 0; i < configFees.length; i++) {\r\n if (uniswapV3Fees[configInputTokens[i]][configOutputTokens[i]] != configFees[i]) return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function uniswapPairsRoutersMatch(\r\n IERC20Upgradeable[] calldata configInputTokens,\r\n IERC20Upgradeable[] calldata configOutputTokens,\r\n address[] calldata configRouters\r\n ) external view returns (bool) {\r\n // find a match for each config router\r\n for (uint256 i = 0; i < configRouters.length; i++) {\r\n if (customUniV3Router[configInputTokens[i]][configOutputTokens[i]] != configRouters[i]) return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function pairsStrategiesMatch(\r\n IRedemptionStrategy[] calldata configStrategies,\r\n IERC20Upgradeable[] calldata configInputTokens,\r\n IERC20Upgradeable[] calldata configOutputTokens\r\n ) external view returns (bool) {\r\n (\r\n IRedemptionStrategy[] memory onChainStrategies,\r\n IERC20Upgradeable[] memory onChainInputTokens,\r\n IERC20Upgradeable[] memory onChainOutputTokens\r\n ) = getAllPairsStrategies();\r\n // find a match for each config strategy\r\n for (uint256 i = 0; i < configStrategies.length; i++) {\r\n bool foundMatch = false;\r\n for (uint256 j = 0; j < onChainStrategies.length; j++) {\r\n if (\r\n onChainStrategies[j] == configStrategies[i] &&\r\n onChainInputTokens[j] == configInputTokens[i] &&\r\n onChainOutputTokens[j] == configOutputTokens[i]\r\n ) {\r\n foundMatch = true;\r\n break;\r\n }\r\n }\r\n if (!foundMatch) return false;\r\n }\r\n\r\n // find a match for each on-chain strategy\r\n for (uint256 i = 0; i < onChainStrategies.length; i++) {\r\n bool foundMatch = false;\r\n for (uint256 j = 0; j < configStrategies.length; j++) {\r\n if (\r\n onChainStrategies[i] == configStrategies[j] &&\r\n onChainInputTokens[i] == configInputTokens[j] &&\r\n onChainOutputTokens[i] == configOutputTokens[j]\r\n ) {\r\n foundMatch = true;\r\n break;\r\n }\r\n }\r\n if (!foundMatch) return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function getAllPairsStrategies()\r\n public\r\n view\r\n returns (\r\n IRedemptionStrategy[] memory strategies,\r\n IERC20Upgradeable[] memory inputTokens,\r\n IERC20Upgradeable[] memory outputTokens\r\n )\r\n {\r\n address[] memory _outputTokens = outputTokensSet.values();\r\n uint256 pairsCounter = 0;\r\n\r\n {\r\n for (uint256 i = 0; i < _outputTokens.length; i++) {\r\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\r\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\r\n pairsCounter += _inputTokens.length;\r\n }\r\n\r\n strategies = new IRedemptionStrategy[](pairsCounter);\r\n inputTokens = new IERC20Upgradeable[](pairsCounter);\r\n outputTokens = new IERC20Upgradeable[](pairsCounter);\r\n }\r\n\r\n pairsCounter = 0;\r\n for (uint256 i = 0; i < _outputTokens.length; i++) {\r\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\r\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\r\n for (uint256 j = 0; j < _inputTokens.length; j++) {\r\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\r\n strategies[pairsCounter] = redemptionStrategiesByTokens[_inputToken][_outputToken];\r\n inputTokens[pairsCounter] = _inputToken;\r\n outputTokens[pairsCounter] = _outputToken;\r\n pairsCounter++;\r\n }\r\n }\r\n }\r\n\r\n function optimalSwapPath(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken)\r\n external\r\n view\r\n returns (IERC20Upgradeable[] memory)\r\n {\r\n return _optimalSwapPath[inputToken][outputToken];\r\n }\r\n\r\n function _setOptimalSwapPath(\r\n IERC20Upgradeable inputToken,\r\n IERC20Upgradeable outputToken,\r\n IERC20Upgradeable[] calldata optimalPath\r\n ) external onlyOwner {\r\n _optimalSwapPath[inputToken][outputToken] = optimalPath;\r\n }\r\n\r\n function wrappedToUnwrapped4626(address wrapped) external view returns (address) {\r\n return _wrappedToUnwrapped4626[wrapped];\r\n }\r\n\r\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24) {\r\n return _aeroCLTickSpacings[inputToken][outputToken];\r\n }\r\n\r\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool) {\r\n return _aeroV2IsStable[inputToken][outputToken];\r\n }\r\n\r\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external onlyOwner {\r\n _wrappedToUnwrapped4626[wrapped] = unwrapped;\r\n }\r\n\r\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external onlyOwner {\r\n _aeroCLTickSpacings[inputToken][outputToken] = tickSpacing;\r\n }\r\n\r\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external onlyOwner {\r\n _aeroV2IsStable[inputToken][outputToken] = isStable;\r\n }\r\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.10;\r\n\r\nimport \"../IRedemptionStrategy.sol\";\r\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\r\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\nabstract contract LiquidatorsRegistryStorage is SafeOwnable {\r\n AddressesProvider public ap;\r\n\r\n EnumerableSet.AddressSet internal redemptionStrategies;\r\n mapping(string => IRedemptionStrategy) public redemptionStrategiesByName;\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IRedemptionStrategy)) public redemptionStrategiesByTokens;\r\n mapping(IERC20Upgradeable => IERC20Upgradeable) public defaultOutputToken;\r\n mapping(IERC20Upgradeable => EnumerableSet.AddressSet) internal inputTokensByOutputToken;\r\n EnumerableSet.AddressSet internal outputTokensSet;\r\n\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippage;\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippageUpdated;\r\n\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint24)) public uniswapV3Fees;\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => address)) public customUniV3Router;\r\n\r\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IERC20Upgradeable[])) internal _optimalSwapPath;\r\n mapping(address => address) internal _wrappedToUnwrapped4626;\r\n mapping(address => mapping(address => int24)) internal _aeroCLTickSpacings;\r\n mapping(address => mapping(address => bool)) internal _aeroV2IsStable;\r\n}" + }, + "contracts/liquidators/UniswapV1Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport \"../external/uniswap/IUniswapV1Exchange.sol\";\r\nimport \"../external/uniswap/IUniswapV1Factory.sol\";\r\n\r\nimport \"../utils/IW_NATIVE.sol\";\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\n\r\n/**\r\n * @title UniswapV1Liquidator\r\n * @notice Exchanges seized token collateral for underlying tokens via a Uniswap V1 pool for use as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract UniswapV1Liquidator is IRedemptionStrategy {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /**\r\n * @dev The V1 Uniswap factory contract.\r\n */\r\n IUniswapV1Factory private constant UNISWAP_V1_FACTORY = IUniswapV1Factory(0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95);\r\n\r\n /**\r\n * @dev W_NATIVE contract object.\r\n */\r\n IW_NATIVE private constant W_NATIVE = IW_NATIVE(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\r\n\r\n /**\r\n * @dev Internal function to approve unlimited tokens of `erc20Contract` to `to`.\r\n */\r\n function safeApprove(IERC20Upgradeable token, address to, uint256 minAmount) private {\r\n uint256 allowance = token.allowance(address(this), to);\r\n\r\n if (allowance < minAmount) {\r\n if (allowance > 0) token.safeApprove(to, 0);\r\n token.safeApprove(to, type(uint256).max);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Get Uniswap exchange\r\n IUniswapV1Exchange uniswapV1Exchange = IUniswapV1Exchange(UNISWAP_V1_FACTORY.getExchange(address(inputToken)));\r\n\r\n // Swap underlying tokens\r\n safeApprove(inputToken, address(uniswapV1Exchange), inputAmount);\r\n uniswapV1Exchange.tokenToEthSwapInput(inputAmount, 1, block.timestamp);\r\n\r\n // Get new collateral\r\n outputAmount = address(this).balance;\r\n W_NATIVE.deposit{ value: outputAmount }();\r\n return (IERC20Upgradeable(address(W_NATIVE)), outputAmount);\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return \"UniswapV1Liquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/UniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./BaseUniswapV2Liquidator.sol\";\r\n\r\n/**\r\n * @title UniswapV2Liquidator\r\n * @notice Exchanges seized token collateral for underlying tokens via a Uniswap V2 router for use as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract UniswapV2Liquidator is BaseUniswapV2Liquidator {\r\n function _swap(\r\n IUniswapV2Router02 uniswapV2Router,\r\n uint256 inputAmount,\r\n address[] memory swapPath\r\n ) internal override {\r\n uniswapV2Router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\r\n }\r\n\r\n function name() public pure virtual returns (string memory) {\r\n return \"UniswapV2Liquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/UniswapV2LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { UniswapV2Liquidator } from \"./UniswapV2Liquidator.sol\";\r\nimport \"./IFundsConversionStrategy.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\r\n\r\ncontract UniswapV2LiquidatorFunder is UniswapV2Liquidator, IFundsConversionStrategy {\r\n function convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function estimateInputAmount(\r\n uint256 outputAmount,\r\n bytes memory strategyData\r\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount) {\r\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\r\n strategyData,\r\n (IUniswapV2Router02, address[])\r\n );\r\n require(swapPath.length >= 2, \"Invalid UniswapLiquidator swap path.\");\r\n\r\n uint256[] memory amounts = uniswapV2Router.getAmountsIn(outputAmount, swapPath);\r\n\r\n inputAmount = amounts[0];\r\n inputToken = IERC20Upgradeable(swapPath[0]);\r\n }\r\n\r\n function name() public pure override(UniswapV2Liquidator, IRedemptionStrategy) returns (string memory) {\r\n return \"UniswapV2LiquidatorFunder\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/UniswapV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\r\nimport { IV3SwapRouter } from \"../external/uniswap/IV3SwapRouter.sol\";\r\n\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ncontract UniswapV3Liquidator is IRedemptionStrategy {\r\n /**\r\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\r\n * @param inputToken Address of the token\r\n * @param inputAmount input amount\r\n * @param strategyData context specific data like input token, pool address and tx expiratio period\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n (, address _outputToken, uint24 fee, IV3SwapRouter swapRouter, ) = abi.decode(\r\n strategyData,\r\n (address, address, uint24, IV3SwapRouter, address)\r\n );\r\n outputToken = IERC20Upgradeable(_outputToken);\r\n\r\n inputToken.approve(address(swapRouter), inputAmount);\r\n\r\n outputAmount = swapRouter.exactInputSingle(\r\n IV3SwapRouter.ExactInputSingleParams(\r\n address(inputToken),\r\n _outputToken,\r\n fee,\r\n address(this),\r\n inputAmount,\r\n 0,\r\n 0\r\n )\r\n );\r\n }\r\n\r\n function name() public pure virtual override returns (string memory) {\r\n return \"UniswapV3Liquidator\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/UniswapV3LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\r\nimport { IFundsConversionStrategy } from \"./IFundsConversionStrategy.sol\";\r\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\r\nimport \"./UniswapV3Liquidator.sol\";\r\n\r\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\r\n\r\ncontract UniswapV3LiquidatorFunder is UniswapV3Liquidator, IFundsConversionStrategy {\r\n using FixedPointMathLib for uint256;\r\n\r\n function convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n /**\r\n * @dev Estimates the needed input amount of the input token for the conversion to return the desired output amount.\r\n * @param outputAmount the desired output amount\r\n * @param strategyData the input token\r\n */\r\n function estimateInputAmount(uint256 outputAmount, bytes memory strategyData)\r\n external\r\n view\r\n returns (IERC20Upgradeable inputToken, uint256 inputAmount)\r\n {\r\n (address _inputToken, address _outputToken, uint24 fee, , Quoter quoter) = abi.decode(\r\n strategyData,\r\n (address, address, uint24, IV3SwapRouter, Quoter)\r\n );\r\n\r\n inputAmount = quoter.estimateMinSwapUniswapV3(_inputToken, _outputToken, outputAmount, fee);\r\n inputToken = IERC20Upgradeable(_inputToken);\r\n }\r\n\r\n function name() public pure override(UniswapV3Liquidator, IRedemptionStrategy) returns (string memory) {\r\n return \"UniswapV3LiquidatorFunder\";\r\n }\r\n}\r\n" + }, + "contracts/liquidators/VelodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\r\n\r\n/**\r\n * @title VelodromeV2Liquidator\r\n * @notice Exchanges seized token collateral for underlying tokens via a Velodrome V2 router for use as a step in a liquidation.\r\n */\r\ncontract VelodromeV2Liquidator {\r\n function _swap(IRouter_Velodrome router, uint256 inputAmount, IRouter_Velodrome.Route[] memory swapPath) internal {\r\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\r\n }\r\n\r\n function name() public pure virtual returns (string memory) {\r\n return \"VelodromeV2Liquidator\";\r\n }\r\n\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n return _convert(inputToken, inputAmount, strategyData);\r\n }\r\n\r\n function _convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\r\n // Get Uniswap router and path\r\n (IRouter_Velodrome router, IRouter_Velodrome.Route[] memory swapPath) = abi.decode(\r\n strategyData,\r\n (IRouter_Velodrome, IRouter_Velodrome.Route[])\r\n );\r\n require(\r\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\r\n \"Invalid VelodromeV2Liquidator swap path.\"\r\n );\r\n\r\n // Swap underlying tokens\r\n inputToken.approve(address(router), inputAmount);\r\n\r\n // call the relevant fn depending on the uni v2 fork specifics\r\n _swap(router, inputAmount, swapPath);\r\n\r\n // Get new collateral\r\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\r\n outputAmount = outputToken.balanceOf(address(this));\r\n }\r\n}\r\n" + }, + "contracts/oracles/1337/MockPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title MockPriceOracle\r\n * @notice Returns mocked prices from a Chainlink-like oracle. Used for local dev only\r\n * @dev Implements `PriceOracle`.\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n */\r\ncontract MockPriceOracle is BasePriceOracle {\r\n /**\r\n * @notice The maximum number of seconds elapsed since the round was last updated before the price is considered stale. If set to 0, no limit is enforced.\r\n */\r\n uint256 public maxSecondsBeforePriceIsStale;\r\n\r\n /**\r\n * @dev Constructor to set `maxSecondsBeforePriceIsStale` as well as all Chainlink price feeds.\r\n */\r\n constructor(uint256 _maxSecondsBeforePriceIsStale) {\r\n // Set maxSecondsBeforePriceIsStale\r\n maxSecondsBeforePriceIsStale = _maxSecondsBeforePriceIsStale;\r\n }\r\n\r\n /**\r\n * @dev Returns a boolean indicating if a price feed exists for the underlying asset.\r\n */\r\n\r\n function hasPriceFeed(address underlying) external pure returns (bool) {\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Internal function returning the price in ETH of `underlying`.\r\n */\r\n\r\n function random() private view returns (uint256) {\r\n uint256 r = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 99;\r\n r = r + 1;\r\n return r;\r\n }\r\n\r\n function _price(address underlying) internal view returns (uint256) {\r\n // Return 1e18 for WETH\r\n if (underlying == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) return 1e18;\r\n\r\n int256 tokenEthPrice = 1;\r\n uint256 r = random();\r\n\r\n return ((uint256(tokenEthPrice) * 1e18) / r) / 1e18;\r\n }\r\n\r\n /**\r\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n return 1e18;\r\n }\r\n}\r\n" + }, + "contracts/oracles/1337/MockRevertPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title MockRevertPriceOracle\r\n * @notice Mocks a failing price oracle. Used for testing purposes only\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract MockRevertPriceOracle is BasePriceOracle {\r\n constructor() {}\r\n\r\n /**\r\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n revert(\"MockPriceOracle: price function is failing.\");\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n revert(\"MockPriceOracle: getUnderlyingPrice function is failing.\");\r\n }\r\n}\r\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../compound/CTokenInterfaces.sol\";\r\n\r\n/**\r\n * @title BasePriceOracle\r\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\r\n * @dev Implements the `PriceOracle` interface.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ninterface BasePriceOracle {\r\n /**\r\n * @notice Get the price of an underlying asset.\r\n * @param underlying The underlying asset to get the price of.\r\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\r\n * Zero means the price is unavailable.\r\n */\r\n function price(address underlying) external view returns (uint256);\r\n\r\n /**\r\n * @notice Get the underlying price of a cToken asset\r\n * @param cToken The cToken to get the underlying price of\r\n * @return The underlying asset price mantissa (scaled by 1e18).\r\n * Zero means the price is unavailable.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\r\n}\r\n" + }, + "contracts/oracles/default/AerodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ninterface BasePrices {\r\n function getManyRatesWithConnectors(\r\n uint8 src_len,\r\n address[] memory connectors\r\n ) external view returns (uint256[] memory rates);\r\n}\r\n\r\ncontract AerodromePriceOracle is BasePriceOracle {\r\n BasePrices immutable prices;\r\n address constant WETH = 0x4200000000000000000000000000000000000006;\r\n\r\n constructor(address _prices) {\r\n prices = BasePrices(_prices);\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n * @param underlying The underlying token address for which to get the price.\r\n * @return Price denominated in ETH (scaled by 1e18)\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying));\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n */\r\n function _price(address token) internal view returns (uint256) {\r\n address[] memory connectors = new address[](2);\r\n connectors[0] = token;\r\n connectors[1] = WETH;\r\n return prices.getManyRatesWithConnectors(1, connectors)[0];\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/API3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { IProxy } from \"../../external/api3/IProxy.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title API3PriceOracle\r\n * @notice Returns prices from Api3.\r\n * @dev Implements `PriceOracle`.\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n */\r\ncontract API3PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\r\n /**\r\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\r\n */\r\n mapping(address => IProxy) public proxies;\r\n\r\n /**\r\n * @notice Chainlink NATIVE/USD price feed contracts.\r\n */\r\n address public NATIVE_TOKEN_USD_PRICE_FEED;\r\n\r\n /**\r\n * @notice The USD Token of the chain\r\n */\r\n address public USD_TOKEN;\r\n\r\n /**\r\n * @dev Constructor to set wtoken address and native token USD price feed address\r\n * @param _usdToken The Wrapped native asset address\r\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\r\n */\r\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n USD_TOKEN = _usdToken;\r\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\r\n }\r\n\r\n /**\r\n * @dev Constructor to set wtoken address and native token USD price feed address\r\n * @param _usdToken The Wrapped native asset address\r\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\r\n */\r\n function reinitialize(address _usdToken, address nativeTokenUsd) public onlyOwnerOrAdmin {\r\n USD_TOKEN = _usdToken;\r\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\r\n }\r\n\r\n /**\r\n * @dev Admin-only function to set price feeds.\r\n * @param underlyings Underlying token addresses for which to set price feeds.\r\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\r\n */\r\n function setPriceFeeds(address[] memory underlyings, address[] memory feeds) external onlyOwner {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == feeds.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // For each token/feed\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n // Set feed and base currency\r\n proxies[underlying] = IProxy(feeds[i]);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Internal function returning the price in of `underlying`.\r\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n IProxy proxy = proxies[underlying];\r\n require(address(proxy) != address(0), \"No API3 price feed found for this underlying ERC20 token.\");\r\n\r\n uint256 nativeTokenUsdPrice;\r\n\r\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\r\n // get the USDX/USD price from the MPO\r\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\r\n nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\r\n } else {\r\n (int224 nativeTokenUsdPrice224, ) = IProxy(NATIVE_TOKEN_USD_PRICE_FEED).read();\r\n if (nativeTokenUsdPrice224 <= 0) {\r\n revert(\"API3PriceOracle: native token price <= 0\");\r\n }\r\n nativeTokenUsdPrice = uint256(uint224(nativeTokenUsdPrice224));\r\n }\r\n (int224 tokenUsdPrice, ) = proxy.read();\r\n\r\n if (tokenUsdPrice <= 0) {\r\n revert(\"API3PriceOracle: token price <= 0\");\r\n }\r\n\r\n return (uint256(uint224(tokenUsdPrice)) * 1e18) / nativeTokenUsdPrice;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\r\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/ChainlinkPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title ChainlinkPriceOracleV2\r\n * @notice Returns prices from Chainlink.\r\n * @dev Implements `PriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract ChainlinkPriceOracleV2 is SafeOwnableUpgradeable, BasePriceOracle {\r\n /**\r\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\r\n */\r\n mapping(address => AggregatorV3Interface) public priceFeeds;\r\n\r\n /**\r\n * @notice Maps ERC20 token addresses to enums indicating the base currency of the feed.\r\n */\r\n mapping(address => FeedBaseCurrency) public feedBaseCurrencies;\r\n\r\n /**\r\n * @notice Enum indicating the base currency of a Chainlink price feed.\r\n * @dev ETH is interchangeable with the nativeToken of the current chain.\r\n */\r\n enum FeedBaseCurrency {\r\n ETH,\r\n USD\r\n }\r\n\r\n /**\r\n * @notice Chainlink NATIVE/USD price feed contracts.\r\n */\r\n address public NATIVE_TOKEN_USD_PRICE_FEED;\r\n\r\n /**\r\n * @notice The USD Token of the chain\r\n */\r\n address public USD_TOKEN;\r\n\r\n /**\r\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\r\n * @param _usdToken The Wrapped native asset address\r\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\r\n */\r\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n USD_TOKEN = _usdToken;\r\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\r\n }\r\n\r\n /**\r\n * @dev Admin-only function to set price feeds.\r\n * @param underlyings Underlying token addresses for which to set price feeds.\r\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\r\n * @param baseCurrency The currency in which `feeds` are based.\r\n */\r\n function setPriceFeeds(\r\n address[] memory underlyings,\r\n address[] memory feeds,\r\n FeedBaseCurrency baseCurrency\r\n ) external onlyOwner {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == feeds.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // For each token/feed\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n // Set feed and base currency\r\n priceFeeds[underlying] = AggregatorV3Interface(feeds[i]);\r\n feedBaseCurrencies[underlying] = baseCurrency;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Internal function returning the price in of `underlying`.\r\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // Get token/ETH price from Chainlink\r\n AggregatorV3Interface feed = priceFeeds[underlying];\r\n require(address(feed) != address(0), \"No Chainlink price feed found for this underlying ERC20 token.\");\r\n FeedBaseCurrency baseCurrency = feedBaseCurrencies[underlying];\r\n\r\n if (baseCurrency == FeedBaseCurrency.ETH) {\r\n (, int256 tokenEthPrice, , , ) = feed.latestRoundData();\r\n return tokenEthPrice >= 0 ? (uint256(tokenEthPrice) * 1e18) / (10 ** uint256(feed.decimals())) : 0;\r\n } else if (baseCurrency == FeedBaseCurrency.USD) {\r\n int256 nativeTokenUsdPrice;\r\n uint8 usdPriceDecimals;\r\n\r\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\r\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\r\n nativeTokenUsdPrice = int256(1e36 / usdNativeTokenPrice); // 18 decimals\r\n usdPriceDecimals = 18;\r\n } else {\r\n (, nativeTokenUsdPrice, , , ) = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).latestRoundData();\r\n if (nativeTokenUsdPrice <= 0) return 0;\r\n usdPriceDecimals = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).decimals();\r\n }\r\n (, int256 tokenUsdPrice, , , ) = feed.latestRoundData();\r\n\r\n return\r\n tokenUsdPrice >= 0\r\n ? ((uint256(tokenUsdPrice) * 1e18 * (10 ** uint256(usdPriceDecimals))) / (10 ** uint256(feed.decimals()))) /\r\n uint256(nativeTokenUsdPrice)\r\n : 0;\r\n } else {\r\n revert(\"unknown base currency\");\r\n }\r\n }\r\n\r\n /**\r\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\r\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/ConcentratedLiquidityBasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\n\r\nimport \"../../external/uniswap/FullMath.sol\";\r\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title ConcentratedLiquidityBasePriceOracle\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n * @notice ConcentratedLiquidityBasePriceOracle is an abstract price oracle for concentrated liquidty (UniV3-like) pairs.\r\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\r\n */\r\nabstract contract ConcentratedLiquidityBasePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\r\n /**\r\n * @notice Maps ERC20 token addresses to asset configs.\r\n */\r\n mapping(address => AssetConfig) public poolFeeds;\r\n\r\n /**\r\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n */\r\n bool public canAdminOverwrite;\r\n\r\n struct AssetConfig {\r\n address poolAddress;\r\n uint256 twapWindow;\r\n address baseToken;\r\n }\r\n\r\n address public WTOKEN;\r\n address[] public SUPPORTED_BASE_TOKENS;\r\n\r\n function initialize(address _wtoken, address[] memory _supportedBaseTokens) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n WTOKEN = _wtoken;\r\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\r\n }\r\n\r\n /**\r\n * @dev Admin-only function to set price feeds.\r\n * @param underlyings Underlying token addresses for which to set price feeds.\r\n * @param assetConfig The asset configuration which includes pool address and twap window.\r\n */\r\n function setPoolFeeds(address[] memory underlyings, AssetConfig[] memory assetConfig) external onlyOwner {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == assetConfig.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // For each token/config\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n // Set asset config for underlying\r\n require(\r\n assetConfig[i].baseToken == WTOKEN || _isBaseTokenSupported(assetConfig[i].baseToken),\r\n \"Base token must be supported\"\r\n );\r\n poolFeeds[underlying] = assetConfig[i];\r\n }\r\n }\r\n\r\n /**\r\n * @notice Get the token price price for an underlying token address.\r\n * @param underlying The underlying token address for which to get the price (set to zero address for WTOKEN)\r\n * @return Price denominated in NATIVE (scaled by 1e18)\r\n */\r\n function price(address underlying) external view returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in NATIVE of the token underlying `cToken`.\r\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in NATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10 ** uint256(EIP20Interface(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Fetches the price for a token from Uniswap v3\r\n */\r\n function _price(address token) internal view virtual returns (uint256);\r\n\r\n function getPriceX96FromSqrtPriceX96(\r\n address token0,\r\n address priceToken,\r\n uint160 sqrtPriceX96\r\n ) public pure returns (uint256 price_) {\r\n price_ = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, uint256(2 ** (96 * 2)) / 1e18);\r\n if (token0 != priceToken) price_ = 1e36 / price_;\r\n }\r\n\r\n function _isBaseTokenSupported(address token) internal view returns (bool) {\r\n for (uint256 i = 0; i < SUPPORTED_BASE_TOKENS.length; i++) {\r\n if (SUPPORTED_BASE_TOKENS[i] == token) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n function _setSupportedBaseTokens(address[] memory _supportedBaseTokens) external onlyOwner {\r\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\r\n }\r\n\r\n function getSupportedBaseTokens() external view returns (address[] memory) {\r\n return SUPPORTED_BASE_TOKENS;\r\n }\r\n\r\n function scalePrices(address baseToken, address token, uint256 tokenPrice) internal view returns (uint256) {\r\n uint256 baseTokenDecimals;\r\n uint256 tokenPriceScaled;\r\n\r\n if (baseToken == address(0) || baseToken == WTOKEN) {\r\n baseTokenDecimals = 18;\r\n } else {\r\n baseTokenDecimals = uint256(ERC20Upgradeable(baseToken).decimals());\r\n }\r\n\r\n uint256 baseNativePrice = BasePriceOracle(msg.sender).price(baseToken);\r\n\r\n // scale tokenPrice by 1e18\r\n uint256 tokenDecimals = uint256(ERC20Upgradeable(token).decimals());\r\n if (baseTokenDecimals > tokenDecimals) {\r\n tokenPriceScaled = tokenPrice / (10 ** (baseTokenDecimals - tokenDecimals));\r\n } else if (baseTokenDecimals < tokenDecimals) {\r\n tokenPriceScaled = tokenPrice * (10 ** (tokenDecimals - baseTokenDecimals));\r\n } else {\r\n tokenPriceScaled = tokenPrice;\r\n }\r\n return (tokenPriceScaled * baseNativePrice) / 1e18;\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/CurveLpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\r\n\r\nimport \"../../external/curve/ICurvePool.sol\";\r\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title CurveLpTokenPriceOracleNoRegistry\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve LP tokens (using the sender as a root oracle).\r\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\r\n */\r\ncontract CurveLpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\r\n /**\r\n * @dev Maps Curve LP token addresses to underlying token addresses.\r\n */\r\n mapping(address => address[]) public underlyingTokens;\r\n\r\n /**\r\n * @dev Maps Curve LP token addresses to pool addresses.\r\n */\r\n mapping(address => address) public poolOf;\r\n\r\n address[] public lpTokens;\r\n\r\n /**\r\n * @dev Initializes an array of LP tokens and pools if desired.\r\n * @param _lpTokens Array of LP token addresses.\r\n * @param _pools Array of pool addresses.\r\n * @param _poolUnderlyings The underlying token addresses of a pool\r\n */\r\n function initialize(\r\n address[] memory _lpTokens,\r\n address[] memory _pools,\r\n address[][] memory _poolUnderlyings\r\n ) public initializer {\r\n require(\r\n _lpTokens.length == _pools.length && _lpTokens.length == _poolUnderlyings.length,\r\n \"No LP tokens supplied or array lengths not equal.\"\r\n );\r\n\r\n __SafeOwnable_init(msg.sender);\r\n for (uint256 i = 0; i < _lpTokens.length; i++) {\r\n poolOf[_lpTokens[i]] = _pools[i];\r\n underlyingTokens[_lpTokens[i]] = _poolUnderlyings[i];\r\n }\r\n }\r\n\r\n function getAllLPTokens() public view returns (address[] memory) {\r\n return lpTokens;\r\n }\r\n\r\n function getPoolForSwap(address inputToken, address outputToken)\r\n public\r\n view\r\n returns (\r\n ICurvePool,\r\n int128,\r\n int128\r\n )\r\n {\r\n for (uint256 i = 0; i < lpTokens.length; i++) {\r\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\r\n int128 inputIndex = -1;\r\n int128 outputIndex = -1;\r\n int128 j = 0;\r\n while (true) {\r\n try pool.coins(uint256(uint128(j))) returns (address coin) {\r\n if (coin == inputToken) inputIndex = j;\r\n else if (coin == outputToken) outputIndex = j;\r\n j++;\r\n } catch {\r\n break;\r\n }\r\n\r\n if (outputIndex > -1 && inputIndex > -1) {\r\n return (pool, inputIndex, outputIndex);\r\n }\r\n }\r\n }\r\n\r\n return (ICurvePool(address(0)), 0, 0);\r\n }\r\n\r\n /**\r\n * @notice Get the LP token price price for an underlying token address.\r\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\r\n * @return Price denominated in ETH (scaled by 1e18).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Fetches the fair LP token/ETH price from Curve, with 18 decimals of precision.\r\n * Source: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/CurveOracle.sol\r\n * @param lpToken The LP token contract address for price retrieval.\r\n */\r\n function _price(address lpToken) internal view returns (uint256) {\r\n address pool = poolOf[lpToken];\r\n require(pool != address(0), \"LP token is not registered.\");\r\n address[] memory tokens = underlyingTokens[lpToken];\r\n uint256 minPx = type(uint256).max;\r\n uint256 n = tokens.length;\r\n\r\n for (uint256 i = 0; i < n; i++) {\r\n address ulToken = tokens[i];\r\n uint256 tokenPx = BasePriceOracle(msg.sender).price(ulToken);\r\n if (tokenPx < minPx) minPx = tokenPx;\r\n }\r\n\r\n require(minPx != type(uint256).max, \"No minimum underlying token price found.\");\r\n return (minPx * ICurvePool(pool).get_virtual_price()) / 1e18; // Use min underlying token prices\r\n }\r\n\r\n /**\r\n * @dev Register the pool given LP token address and set the pool info.\r\n * @param _lpToken LP token to find the corresponding pool.\r\n * @param _pool Pool address.\r\n * @param _underlyings Underlying addresses.\r\n */\r\n function registerPool(\r\n address _lpToken,\r\n address _pool,\r\n address[] memory _underlyings\r\n ) external onlyOwner {\r\n poolOf[_lpToken] = _pool;\r\n underlyingTokens[_lpToken] = _underlyings;\r\n\r\n bool skip = false;\r\n for (uint256 j = 0; j < lpTokens.length; j++) {\r\n if (lpTokens[j] == _lpToken) {\r\n skip = true;\r\n break;\r\n }\r\n }\r\n if (!skip) lpTokens.push(_lpToken);\r\n }\r\n\r\n /**\r\n * @dev getter for the underlying tokens\r\n * @param lpToken the LP token address.\r\n * @return _underlyings Underlying addresses.\r\n */\r\n function getUnderlyingTokens(address lpToken) public view returns (address[] memory) {\r\n return underlyingTokens[lpToken];\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\r\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\r\n\r\nimport \"../../external/curve/ICurveV2Pool.sol\";\r\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title CurveLpTokenPriceOracle\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\r\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\r\n */\r\ncontract CurveV2LpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\r\n address public usdToken;\r\n MasterPriceOracle public masterPriceOracle;\r\n /**\r\n * @dev Maps Curve LP token addresses to pool addresses.\r\n */\r\n mapping(address => address) public poolOf;\r\n\r\n address[] public lpTokens;\r\n\r\n /**\r\n * @dev Initializes an array of LP tokens and pools if desired.\r\n * @param _lpTokens Array of LP token addresses.\r\n * @param _pools Array of pool addresses.\r\n */\r\n function initialize(address[] memory _lpTokens, address[] memory _pools) public initializer {\r\n require(_lpTokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\r\n __SafeOwnable_init(msg.sender);\r\n\r\n for (uint256 i = 0; i < _pools.length; i++) {\r\n poolOf[_lpTokens[i]] = _pools[i];\r\n }\r\n }\r\n\r\n function getAllLPTokens() public view returns (address[] memory) {\r\n return lpTokens;\r\n }\r\n\r\n function getPoolForSwap(address inputToken, address outputToken)\r\n public\r\n view\r\n returns (\r\n ICurvePool,\r\n int128,\r\n int128\r\n )\r\n {\r\n for (uint256 i = 0; i < lpTokens.length; i++) {\r\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\r\n int128 inputIndex = -1;\r\n int128 outputIndex = -1;\r\n int128 j = 0;\r\n while (true) {\r\n try pool.coins(uint256(uint128(j))) returns (address coin) {\r\n if (coin == inputToken) inputIndex = j;\r\n else if (coin == outputToken) outputIndex = j;\r\n j++;\r\n } catch {\r\n break;\r\n }\r\n\r\n if (outputIndex > -1 && inputIndex > -1) {\r\n return (pool, inputIndex, outputIndex);\r\n }\r\n }\r\n }\r\n\r\n return (ICurvePool(address(0)), int128(0), int128(0));\r\n }\r\n\r\n /**\r\n * @notice Get the LP token price price for an underlying token address.\r\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\r\n * @return Price denominated in ETH (scaled by 1e18).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\r\n * @param lpToken The LP token contract address for price retrieval.\r\n */\r\n function _price(address lpToken) internal view returns (uint256) {\r\n address pool = poolOf[lpToken];\r\n require(address(pool) != address(0), \"LP token is not registered.\");\r\n\r\n address baseToken = ICurvePool(pool).coins(0);\r\n uint256 lpPrice = ICurveV2Pool(pool).lp_price();\r\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\r\n return (lpPrice * baseTokenPrice) / 10**18;\r\n }\r\n\r\n /**\r\n * @dev Register the pool given LP token address and set the pool info.\r\n * @param _lpToken LP token to find the corresponding pool.\r\n * @param _pool Pool address.\r\n */\r\n function registerPool(address _lpToken, address _pool) external onlyOwner {\r\n address pool = poolOf[_lpToken];\r\n require(pool == address(0), \"This LP token is already registered.\");\r\n poolOf[_lpToken] = _pool;\r\n\r\n bool skip = false;\r\n for (uint256 j = 0; j < lpTokens.length; j++) {\r\n if (lpTokens[j] == _lpToken) {\r\n skip = true;\r\n break;\r\n }\r\n }\r\n if (!skip) lpTokens.push(_lpToken);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/CurveV2PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\r\n\r\nimport \"../../external/curve/ICurveV2Pool.sol\";\r\n\r\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title CurveLpTokenPriceOracle\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\r\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\r\n */\r\ncontract CurveV2PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\r\n /**\r\n * @dev Maps Curve LP token addresses to pool addresses.\r\n */\r\n mapping(address => address) public poolFor;\r\n\r\n address[] public tokens;\r\n\r\n /**\r\n * @dev Initializes an array of tokens and pools if desired.\r\n * @param _tokens Array of token addresses.\r\n * @param _pools Array of pool addresses.\r\n */\r\n function initialize(address[] memory _tokens, address[] memory _pools) public initializer {\r\n require(_tokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\r\n __SafeOwnable_init(msg.sender);\r\n\r\n for (uint256 i = 0; i < _pools.length; i++) {\r\n try ICurvePool(_pools[i]).coins(2) returns (address) {\r\n revert(\"!only two token pools\");\r\n } catch {\r\n // ignore error\r\n }\r\n\r\n poolFor[_tokens[i]] = _pools[i];\r\n }\r\n }\r\n\r\n function getAllSupportedTokens() public view returns (address[] memory) {\r\n return tokens;\r\n }\r\n\r\n function getPoolForSwap(address inputToken, address outputToken)\r\n public\r\n view\r\n returns (\r\n ICurvePool,\r\n int128,\r\n int128\r\n )\r\n {\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n ICurvePool pool = ICurvePool(poolFor[tokens[i]]);\r\n int128 inputIndex = -1;\r\n int128 outputIndex = -1;\r\n int128 j = 0;\r\n while (true) {\r\n try pool.coins(uint256(uint128(j))) returns (address coin) {\r\n if (coin == inputToken) inputIndex = j;\r\n else if (coin == outputToken) outputIndex = j;\r\n j++;\r\n } catch {\r\n break;\r\n }\r\n\r\n if (outputIndex > -1 && inputIndex > -1) {\r\n return (pool, inputIndex, outputIndex);\r\n }\r\n }\r\n }\r\n\r\n return (ICurvePool(address(0)), int128(0), int128(0));\r\n }\r\n\r\n /**\r\n * @notice Get the LP token price price for an underlying token address.\r\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\r\n * @return Price denominated in ETH (scaled by 1e18).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\r\n * @param token The LP token contract address for price retrieval.\r\n */\r\n function _price(address token) internal view returns (uint256) {\r\n address pool = poolFor[token];\r\n require(address(pool) != address(0), \"Token is not registered.\");\r\n\r\n address baseToken;\r\n // Returns always coin(1) / coin(0) [ e.g. USDC (1) / eUSDC (1) ]\r\n uint256 exchangeRate = ICurveV2Pool(pool).price_oracle();\r\n\r\n if (ICurvePool(pool).coins(0) == token) {\r\n baseToken = ICurvePool(pool).coins(1);\r\n // USDC / ETH\r\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\r\n // USDC / ETH * eUSDC / USDC = eUSDC / ETH\r\n return (baseTokenPrice * 10**18) / exchangeRate;\r\n } else {\r\n // if coin(1) is eUSDC, exchangeRate is USDC / eUSDC\r\n baseToken = ICurvePool(pool).coins(0);\r\n // USDC / ETH\r\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\r\n // (USDC / ETH) * (1 / (USDC / eUSDC)) = eUSDC / ETH\r\n return (baseTokenPrice * exchangeRate) / 10**18;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Register the pool given token address and set the pool info.\r\n * @param _token token to find the corresponding pool.\r\n * @param _pool Pool address.\r\n */\r\n function registerPool(address _token, address _pool) external onlyOwner {\r\n try ICurvePool(_pool).coins(2) returns (address) {\r\n revert(\"!only two token pools\");\r\n } catch {\r\n // ignore error\r\n }\r\n\r\n address pool = poolFor[_token];\r\n require(pool == address(0), \"This LP token is already registered.\");\r\n poolFor[_token] = _pool;\r\n\r\n bool skip = false;\r\n for (uint256 j = 0; j < tokens.length; j++) {\r\n if (tokens[j] == _token) {\r\n skip = true;\r\n break;\r\n }\r\n }\r\n if (!skip) tokens.push(_token);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/DiaPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { IPriceOracle } from \"../../external/compound/IPriceOracle.sol\";\r\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\r\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\r\n\r\ninterface DIAOracleV2 {\r\n function getValue(string memory key) external view returns (uint128, uint128);\r\n}\r\n\r\n/**\r\n * @title DiaPriceOracle\r\n * @notice Returns prices from DIA.\r\n * @dev Implements `PriceOracle`.\r\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\r\n */\r\ncontract DiaPriceOracle is BasePriceOracle {\r\n struct DiaOracle {\r\n DIAOracleV2 feed;\r\n string key;\r\n }\r\n\r\n /**\r\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\r\n */\r\n mapping(address => DiaOracle) public priceFeeds;\r\n\r\n /**\r\n * @dev The administrator of this `MasterPriceOracle`.\r\n */\r\n address public admin;\r\n\r\n /**\r\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n */\r\n bool public immutable CAN_ADMIN_OVERWRITE;\r\n\r\n /**\r\n * @dev The Wrapped native asset address.\r\n */\r\n address public immutable WTOKEN;\r\n\r\n /**\r\n * @notice DIA NATIVE/USD price feed contracts.\r\n */\r\n DIAOracleV2 public immutable NATIVE_TOKEN_USD_PRICE_FEED;\r\n string public NATIVE_TOKEN_USD_KEY;\r\n\r\n /**\r\n * @notice MasterPriceOracle for backup for USD price.\r\n */\r\n MasterPriceOracle public immutable MASTER_PRICE_ORACLE;\r\n address public immutable USD_TOKEN; // token to use as USD price (i.e. USDC)\r\n\r\n /**\r\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\r\n */\r\n constructor(\r\n address _admin,\r\n bool canAdminOverwrite,\r\n address wtoken,\r\n DIAOracleV2 nativeTokenUsd,\r\n string memory nativeTokenUsdKey,\r\n MasterPriceOracle masterPriceOracle,\r\n address usdToken\r\n ) {\r\n admin = _admin;\r\n CAN_ADMIN_OVERWRITE = canAdminOverwrite;\r\n WTOKEN = wtoken;\r\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\r\n NATIVE_TOKEN_USD_KEY = nativeTokenUsdKey;\r\n MASTER_PRICE_ORACLE = masterPriceOracle;\r\n USD_TOKEN = usdToken;\r\n }\r\n\r\n /**\r\n * @dev Changes the admin and emits an event.\r\n */\r\n function changeAdmin(address newAdmin) external onlyAdmin {\r\n address oldAdmin = admin;\r\n admin = newAdmin;\r\n emit NewAdmin(oldAdmin, newAdmin);\r\n }\r\n\r\n /**\r\n * @dev Event emitted when `admin` is changed.\r\n */\r\n event NewAdmin(address oldAdmin, address newAdmin);\r\n\r\n /**\r\n * @dev Modifier that checks if `msg.sender == admin`.\r\n */\r\n modifier onlyAdmin() {\r\n require(msg.sender == admin, \"Sender is not the admin.\");\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Admin-only function to set price feeds.\r\n * @param underlyings Underlying token addresses for which to set price feeds.\r\n * @param feeds The DIA price feed contract addresses for each of `underlyings`.\r\n * @param keys The keys for each of `underlyings`, in the format \"ETH/USD\" for example\r\n */\r\n function setPriceFeeds(\r\n address[] memory underlyings,\r\n DIAOracleV2[] memory feeds,\r\n string[] memory keys\r\n ) external onlyAdmin {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == feeds.length && underlyings.length == keys.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // For each token/feed\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n\r\n // Check for existing oracle if !canAdminOverwrite\r\n if (!CAN_ADMIN_OVERWRITE)\r\n require(\r\n address(priceFeeds[underlying].feed) == address(0),\r\n \"Admin cannot overwrite existing assignments of price feeds to underlying tokens.\"\r\n );\r\n\r\n // Set feed and base currency\r\n priceFeeds[underlying] = DiaOracle({ feed: feeds[i], key: keys[i] });\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function returning the price in ETH of `underlying`.\r\n * Assumes price feeds are 8 decimals!\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // Return 1e18 for WTOKEN\r\n if (underlying == WTOKEN || underlying == address(0)) return 1e18;\r\n\r\n // Get token/Native price from Oracle\r\n DiaOracle memory feed = priceFeeds[underlying];\r\n require(address(feed.feed) != address(0), \"No oracle price feed found for this underlying ERC20 token.\");\r\n\r\n if (address(NATIVE_TOKEN_USD_PRICE_FEED) == address(0)) {\r\n // Get price from MasterPriceOracle\r\n uint256 usdNativeTokenPrice = MASTER_PRICE_ORACLE.price(USD_TOKEN);\r\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\r\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\r\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\r\n } else {\r\n (uint128 nativeTokenUsdPrice, ) = NATIVE_TOKEN_USD_PRICE_FEED.getValue(NATIVE_TOKEN_USD_KEY);\r\n if (nativeTokenUsdPrice <= 0) return 0;\r\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\r\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n // Get price\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n // Format and return price\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/ERC4626Oracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { IERC4626 } from \"../../compound/IERC4626.sol\";\r\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\ncontract ERC4626Oracle is SafeOwnableUpgradeable, BasePriceOracle {\r\n function initialize() public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n }\r\n\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Fetches the fair LP token/ETH price from Balancer, with 18 decimals of precision.\r\n */\r\n function _price(address underlying) internal view virtual returns (uint256) {\r\n IERC4626 vault = IERC4626(underlying);\r\n address asset = vault.asset();\r\n uint256 redeemAmount = vault.previewRedeem(10 ** vault.decimals());\r\n uint256 underlyingPrice = BasePriceOracle(msg.sender).price(asset);\r\n return (redeemAmount * underlyingPrice) / 10 ** ERC20Upgradeable(asset).decimals();\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/FixedNativePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title FixedEthPriceOracle\r\n * @notice Returns fixed prices of 1 denominated in the chain's native token for all tokens (expected to be used under a `MasterPriceOracle`).\r\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract FixedNativePriceOracle is BasePriceOracle {\r\n /**\r\n * @dev Returns the price in native token of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return 1e18;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in native token of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in native token of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n return 1e18;\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/FixedTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title FixedTokenPriceOracle\r\n * @notice Returns token prices using the prices for another token.\r\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract FixedTokenPriceOracle is BasePriceOracle {\r\n /**\r\n * @dev The token to base prices on.\r\n */\r\n address public immutable baseToken;\r\n\r\n /**\r\n * @dev Sets the token to base prices on.\r\n */\r\n constructor(address _baseToken) {\r\n baseToken = _baseToken;\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n * @param underlying The underlying token address for which to get the price.\r\n * @return Price denominated in ETH (scaled by 1e18)\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n */\r\n function _price(address token) internal view returns (uint256) {\r\n return BasePriceOracle(msg.sender).price(baseToken);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/PreferredPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../BasePriceOracle.sol\";\r\nimport \"../MasterPriceOracle.sol\";\r\nimport \"../default/ChainlinkPriceOracleV2.sol\";\r\n\r\n/**\r\n * @title PreferredPriceOracle\r\n * @notice Returns prices from MasterPriceOracle, ChainlinkPriceOracleV2, or prices from a tertiary oracle (in order of preference).\r\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract PreferredPriceOracle is BasePriceOracle {\r\n /**\r\n * @dev The primary `MasterPriceOracle`.\r\n */\r\n MasterPriceOracle public masterOracle;\r\n\r\n /**\r\n * @dev The secondary `ChainlinkPriceOracleV2`.\r\n */\r\n ChainlinkPriceOracleV2 public chainlinkOracleV2;\r\n\r\n /**\r\n * @dev The tertiary `PriceOracle`.\r\n */\r\n BasePriceOracle public tertiaryOracle;\r\n\r\n /**\r\n * @dev The Wrapped native asset address.\r\n */\r\n address public wtoken;\r\n\r\n /**\r\n * @dev Constructor to set the primary `MasterPriceOracle`, the secondary `ChainlinkPriceOracleV2`, and the tertiary `PriceOracle`.\r\n */\r\n constructor(\r\n MasterPriceOracle _masterOracle,\r\n ChainlinkPriceOracleV2 _chainlinkOracleV2,\r\n BasePriceOracle _tertiaryOracle,\r\n address _wtoken\r\n ) {\r\n require(address(_masterOracle) != address(0), \"MasterPriceOracle not set.\");\r\n require(address(_chainlinkOracleV2) != address(0), \"ChainlinkPriceOracleV2 not set.\");\r\n require(address(_tertiaryOracle) != address(0), \"Tertiary price oracle not set.\");\r\n masterOracle = _masterOracle;\r\n chainlinkOracleV2 = _chainlinkOracleV2;\r\n tertiaryOracle = _tertiaryOracle;\r\n wtoken = _wtoken;\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n * @param underlying The underlying token address for which to get the price.\r\n * @return Price denominated in ETH (scaled by 1e18)\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n // Return 1e18 for wtoken\r\n if (underlying == wtoken) return 1e18;\r\n\r\n // Try to get MasterPriceOracle price\r\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.price(underlying);\r\n\r\n // Try to get ChainlinkPriceOracleV2 price\r\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0)) return chainlinkOracleV2.price(underlying);\r\n\r\n // Otherwise, get price from tertiary oracle\r\n return BasePriceOracle(address(tertiaryOracle)).price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying ERC20 token address\r\n address underlying = cToken.underlying();\r\n\r\n // Return 1e18 for wtoken\r\n if (underlying == wtoken) return 1e18;\r\n\r\n // Try to get MasterPriceOracle price\r\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.getUnderlyingPrice(cToken);\r\n\r\n // Try to get ChainlinkPriceOracleV2 price\r\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0))\r\n return chainlinkOracleV2.getUnderlyingPrice(cToken);\r\n\r\n // Otherwise, get price from tertiary oracle\r\n return tertiaryOracle.getUnderlyingPrice(cToken);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/PythPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\r\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\r\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\r\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title PythPriceOracle\r\n * @notice Returns prices from Pyth.\r\n * @dev Implements `PriceOracle`.\r\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\r\n */\r\ncontract PythPriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\r\n /**\r\n * @notice Maps ERC20 token addresses to Pyth price IDs.\r\n */\r\n mapping(address => bytes32) public priceFeedIds;\r\n\r\n /**\r\n * @notice DIA NATIVE/USD price feed contracts.\r\n */\r\n bytes32 public NATIVE_TOKEN_USD_FEED;\r\n\r\n /**\r\n * @notice MasterPriceOracle for backup for USD price.\r\n */\r\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\r\n\r\n /**\r\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\r\n */\r\n\r\n IPyth public PYTH;\r\n\r\n function initialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\r\n USD_TOKEN = usdToken;\r\n PYTH = IPyth(pythAddress);\r\n }\r\n\r\n function reinitialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public onlyOwnerOrAdmin {\r\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\r\n USD_TOKEN = usdToken;\r\n PYTH = IPyth(pythAddress);\r\n }\r\n\r\n /**\r\n * @dev Admin-only function to set price feeds.\r\n * @param underlyings Underlying token addresses for which to set price feeds.\r\n * @param feedIds The Pyth Network feed IDs`.\r\n */\r\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == feedIds.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // For each token/feed\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n // Set feed and base currency\r\n priceFeedIds[underlying] = feedIds[i];\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function returning the price in ETH of `underlying`.\r\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // Get token/native price from Oracle\r\n bytes32 feed = priceFeedIds[underlying];\r\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\r\n\r\n if (NATIVE_TOKEN_USD_FEED == \"\") {\r\n // Get price from MasterPriceOracle\r\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\r\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\r\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\r\n return\r\n tokenUsdPrice.price >= 0 ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\r\n } else {\r\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\r\n if (nativeTokenUsdPrice <= 0) return 0;\r\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\r\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n // Get price\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n // Format and return price\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/PythPriceOracleDmBTC.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\r\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\r\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\r\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title PythPriceOracle\r\n * @notice Returns prices from Pyth.\r\n * @dev Implements `PriceOracle`.\r\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\r\n */\r\ncontract PythPriceOracleDmBTC is BasePriceOracle, SafeOwnableUpgradeable {\r\n /**\r\n * @notice Maps ERC20 token addresses to Pyth price IDs.\r\n */\r\n mapping(address => bytes32) public priceFeedIds;\r\n\r\n /**\r\n * @notice DIA NATIVE/USD price feed contracts.\r\n */\r\n bytes32 public NATIVE_TOKEN_USD_FEED;\r\n\r\n /**\r\n * @notice MasterPriceOracle for backup for USD price.\r\n */\r\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\r\n\r\n /**\r\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\r\n */\r\n\r\n IPyth public PYTH;\r\n\r\n address public DMBTC;\r\n\r\n function initialize(\r\n address pythAddress,\r\n bytes32 nativeTokenUsdFeed,\r\n address usdToken,\r\n address dmBTC\r\n ) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\r\n USD_TOKEN = usdToken;\r\n PYTH = IPyth(pythAddress);\r\n DMBTC = dmBTC;\r\n }\r\n\r\n function reinitialize(\r\n address pythAddress,\r\n bytes32 nativeTokenUsdFeed,\r\n address usdToken,\r\n address dmBTC\r\n ) public onlyOwnerOrAdmin {\r\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\r\n USD_TOKEN = usdToken;\r\n PYTH = IPyth(pythAddress);\r\n DMBTC = dmBTC;\r\n }\r\n\r\n /**\r\n * @dev Admin-only function to set price feeds.\r\n * @param underlyings Underlying token addresses for which to set price feeds.\r\n * @param feedIds The Pyth Network feed IDs`.\r\n */\r\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == feedIds.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // For each token/feed\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n // Set feed and base currency\r\n priceFeedIds[underlying] = feedIds[i];\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function returning the price in ETH of `underlying`.\r\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // Get token/native price from Oracle\r\n bytes32 feed = priceFeedIds[underlying];\r\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\r\n uint256 normalizedPrice;\r\n if (NATIVE_TOKEN_USD_FEED == \"\") {\r\n // Get price from MasterPriceOracle\r\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\r\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\r\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\r\n normalizedPrice = tokenUsdPrice.price >= 0\r\n ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice)\r\n : 0;\r\n } else {\r\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\r\n if (nativeTokenUsdPrice <= 0) return 0;\r\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\r\n normalizedPrice = tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\r\n }\r\n if (underlying == DMBTC) {\r\n return normalizedPrice / 100000;\r\n }\r\n return normalizedPrice;\r\n }\r\n\r\n /**\r\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n // Get price\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n // Format and return price\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/RecursivePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../../external/compound/IPriceOracle.sol\";\r\nimport \"../../external/compound/ICToken.sol\";\r\nimport \"../../external/compound/ICErc20.sol\";\r\nimport \"../../external/compound/IComptroller.sol\";\r\n\r\n/**\r\n * @title RecursivePriceOracle\r\n * @notice Returns prices from other cTokens (from Ionic).\r\n * @dev Implements `PriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract RecursivePriceOracle is IPriceOracle {\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICToken cToken) external view override returns (uint256) {\r\n // Get cToken's underlying cToken\r\n ICToken underlying = ICToken(ICErc20Compound(address(cToken)).underlying());\r\n\r\n // Get Comptroller\r\n IComptroller comptroller = IComptroller(underlying.comptroller());\r\n\r\n // If cETH, return cETH/ETH exchange rate\r\n if (underlying.isCEther()) {\r\n return underlying.exchangeRateStored();\r\n }\r\n\r\n // Ionic cTokens: cToken/token price * token/ETH price = cToken/ETH price\r\n return (underlying.exchangeRateStored() * comptroller.oracle().getUnderlyingPrice(underlying)) / 1e18;\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/redstone/IRedstoneOracle.sol\";\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title RedstoneAdapterPriceOracle\r\n * @notice Returns prices from Redstone.\r\n * @dev Implements `BasePriceOracle`.\r\n * @author Veliko Minkov (https://github.com/vminkov)\r\n */\r\ncontract RedstoneAdapterPriceOracle is BasePriceOracle {\r\n /**\r\n * @notice The Redstone oracle contract\r\n */\r\n IRedstoneOracle public REDSTONE_ORACLE;\r\n\r\n /**\r\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\r\n * @param redstoneOracle The Redstone oracle contract address\r\n */\r\n constructor(address redstoneOracle) {\r\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\r\n }\r\n\r\n /**\r\n * @notice Internal function returning the price in of `underlying`.\r\n * @dev will return a price denominated in the native token\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\r\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\r\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in of `underlying` either in the\r\n * native token (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\r\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWeETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/redstone/IRedstoneOracle.sol\";\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title RedstoneAdapterPriceOracle\r\n * @notice Returns prices from Redstone.\r\n * @dev Implements `BasePriceOracle`.\r\n * @author Veliko Minkov (https://github.com/vminkov)\r\n */\r\ncontract RedstoneAdapterPriceOracleWeETH is BasePriceOracle {\r\n /**\r\n * @notice The Redstone oracle contract\r\n */\r\n IRedstoneOracle public REDSTONE_ORACLE;\r\n\r\n /**\r\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\r\n * @param redstoneOracle The Redstone oracle contract address\r\n */\r\n constructor(address redstoneOracle) {\r\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\r\n }\r\n\r\n /**\r\n * @notice Internal function returning the price in of `underlying`.\r\n * @dev will return a price denominated in the native token\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // special case for wrsETH\r\n // if input is wrsETH, we need to get the price of rsETH\r\n if (underlying == 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A) {\r\n underlying = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\r\n }\r\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\r\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\r\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in of `underlying` either in the\r\n * native token (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\r\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWrsETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/redstone/IRedstoneOracle.sol\";\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title RedstoneAdapterPriceOracle\r\n * @notice Returns prices from Redstone.\r\n * @dev Implements `BasePriceOracle`.\r\n * @author Veliko Minkov (https://github.com/vminkov)\r\n */\r\ncontract RedstoneAdapterPriceOracleWrsETH is BasePriceOracle {\r\n /**\r\n * @notice The Redstone oracle contract\r\n */\r\n IRedstoneOracle public REDSTONE_ORACLE;\r\n\r\n /**\r\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\r\n * @param redstoneOracle The Redstone oracle contract address\r\n */\r\n constructor(address redstoneOracle) {\r\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\r\n }\r\n\r\n /**\r\n * @notice Internal function returning the price in of `underlying`.\r\n * @dev will return a price denominated in the native token\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // special case for wrsETH\r\n // if input is wrsETH, we need to get the price of rsETH\r\n if (underlying == 0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd) {\r\n underlying = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\r\n }\r\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\r\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\r\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in of `underlying` either in the\r\n * native token (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\r\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying token address\r\n address underlying = cToken.underlying();\r\n\r\n uint256 oraclePrice = _price(underlying);\r\n\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/SimplePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../BasePriceOracle.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\ncontract SimplePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\r\n mapping(address => uint256) prices;\r\n event PricePosted(\r\n address asset,\r\n uint256 previousPriceMantissa,\r\n uint256 requestedPriceMantissa,\r\n uint256 newPriceMantissa\r\n );\r\n\r\n function initialize() public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n }\r\n\r\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\r\n if (compareStrings(cToken.symbol(), \"cETH\")) {\r\n return 1e18;\r\n } else {\r\n address underlying = ICErc20(address(cToken)).underlying();\r\n uint256 oraclePrice = prices[underlying];\r\n\r\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\r\n return\r\n underlyingDecimals <= 18\r\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\r\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\r\n }\r\n }\r\n\r\n function setUnderlyingPrice(ICErc20 cToken, uint256 underlyingPriceMantissa) public onlyOwner {\r\n address asset = ICErc20(address(cToken)).underlying();\r\n emit PricePosted(asset, prices[asset], underlyingPriceMantissa, underlyingPriceMantissa);\r\n prices[asset] = underlyingPriceMantissa;\r\n }\r\n\r\n function setDirectPrice(address asset, uint256 _price) public onlyOwner {\r\n emit PricePosted(asset, prices[asset], _price, _price);\r\n prices[asset] = _price;\r\n }\r\n\r\n function price(address underlying) external view returns (uint256) {\r\n return prices[address(underlying)];\r\n }\r\n\r\n // v1 price oracle interface for use as backing of proxy\r\n function assetPrices(address asset) external view returns (uint256) {\r\n return prices[asset];\r\n }\r\n\r\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\r\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapLikeLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title UniswapLpTokenPriceOracle\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\r\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\r\n */\r\nabstract contract UniswapLikeLpTokenPriceOracle is BasePriceOracle {\r\n /**\r\n * @dev wtoken contract address.\r\n */\r\n address public immutable wtoken;\r\n\r\n /**\r\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\r\n */\r\n constructor(address _wtoken) {\r\n wtoken = _wtoken;\r\n }\r\n\r\n function _price(address token) internal view virtual returns (uint256);\r\n\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Fast square root function.\r\n * Implementation from: https://github.com/Uniswap/uniswap-lib/commit/99f3f28770640ba1bb1ff460ac7c5292fb8291a0\r\n * Original implementation: https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687\r\n */\r\n function sqrt(uint256 x) internal pure returns (uint256) {\r\n if (x == 0) return 0;\r\n uint256 xx = x;\r\n uint256 r = 1;\r\n\r\n if (xx >= 0x100000000000000000000000000000000) {\r\n xx >>= 128;\r\n r <<= 64;\r\n }\r\n if (xx >= 0x10000000000000000) {\r\n xx >>= 64;\r\n r <<= 32;\r\n }\r\n if (xx >= 0x100000000) {\r\n xx >>= 32;\r\n r <<= 16;\r\n }\r\n if (xx >= 0x10000) {\r\n xx >>= 16;\r\n r <<= 8;\r\n }\r\n if (xx >= 0x100) {\r\n xx >>= 8;\r\n r <<= 4;\r\n }\r\n if (xx >= 0x10) {\r\n xx >>= 4;\r\n r <<= 2;\r\n }\r\n if (xx >= 0x8) {\r\n r <<= 1;\r\n }\r\n\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1; // Seven iterations should be enough\r\n uint256 r1 = x / r;\r\n return (r < r1 ? r : r1);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\nimport { UniswapLikeLpTokenPriceOracle } from \"./UniswapLikeLpTokenPriceOracle.sol\";\r\n\r\n/**\r\n * @title UniswapLpTokenPriceOracle\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\r\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\r\n */\r\ncontract UniswapLpTokenPriceOracle is UniswapLikeLpTokenPriceOracle {\r\n /**\r\n * @dev Fetches the fair LP token/ETH price from Uniswap, with 18 decimals of precision.\r\n */\r\n constructor(address _wtoken) UniswapLikeLpTokenPriceOracle(_wtoken) {}\r\n\r\n function _price(address token) internal view virtual override returns (uint256) {\r\n IUniswapV2Pair pair = IUniswapV2Pair(token);\r\n uint256 totalSupply = pair.totalSupply();\r\n if (totalSupply == 0) return 0;\r\n (uint256 r0, uint256 r1, ) = pair.getReserves();\r\n\r\n r0 = r0 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token0()).decimals()));\r\n r1 = r1 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token1()).decimals()));\r\n\r\n address token0 = pair.token0();\r\n address token1 = pair.token1();\r\n\r\n // Get fair price of non-WETH token (underlying the pair) in terms of ETH\r\n uint256 token0FairPrice = token0 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token0);\r\n uint256 token1FairPrice = token1 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token1);\r\n\r\n // Implementation from https://github.com/AlphaFinanceLab/homora-v2/blob/e643392d582c81f6695136971cff4b685dcd2859/contracts/oracle/UniswapV2Oracle.sol#L18\r\n uint256 sqrtK = (sqrt(r0 * r1) * (2 ** 112)) / totalSupply;\r\n return (((sqrtK * 2 * sqrt(token0FairPrice)) / (2 ** 56)) * sqrt(token1FairPrice)) / (2 ** 56);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../BasePriceOracle.sol\";\r\nimport \"./UniswapTwapPriceOracleV2Root.sol\";\r\n\r\n/**\r\n * @title UniswapTwapPriceOracleV2\r\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\r\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract UniswapTwapPriceOracleV2 is Initializable, BasePriceOracle {\r\n /**\r\n * @dev wtoken token contract address.\r\n */\r\n address public wtoken;\r\n\r\n /**\r\n * @dev UniswapTwapPriceOracleV2Root contract address.\r\n */\r\n UniswapTwapPriceOracleV2Root public rootOracle;\r\n\r\n /**\r\n * @dev UniswapV2Factory contract address.\r\n */\r\n address public uniswapV2Factory;\r\n\r\n /**\r\n * @dev The token on which to base TWAPs (its price must be available via `msg.sender`).\r\n */\r\n address public baseToken;\r\n\r\n /**\r\n * @dev Initalize that sets the UniswapTwapPriceOracleV2Root, UniswapV2Factory, and base token.\r\n * @param _rootOracle Sets `UniswapTwapPriceOracleV2Root`\r\n * @param _uniswapV2Factory Sets `UniswapV2Factory`\r\n * @param _baseToken The token on which to base TWAPs (its price must be available via `msg.sender`).\r\n * @param _wtoken The Wrapped native asset address\r\n */\r\n function initialize(\r\n address _rootOracle,\r\n address _uniswapV2Factory,\r\n address _baseToken,\r\n address _wtoken\r\n ) external initializer {\r\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\r\n require(_uniswapV2Factory != address(0), \"UniswapV2Factory not defined.\");\r\n rootOracle = UniswapTwapPriceOracleV2Root(_rootOracle);\r\n uniswapV2Factory = _uniswapV2Factory;\r\n wtoken = _wtoken;\r\n baseToken = _baseToken == address(0) ? address(wtoken) : _baseToken;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying ERC20 token address\r\n address underlying = cToken.underlying();\r\n\r\n // Get price, format, and return\r\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\r\n return (_price(underlying) * 1e18) / baseUnit;\r\n }\r\n\r\n /**\r\n * @dev Internal function returning the price in ETH of `underlying`.\r\n */\r\n function _price(address underlying) internal view returns (uint256) {\r\n // Return 1e18 for wtoken\r\n if (underlying == wtoken) return 1e18;\r\n\r\n // Return root oracle ERC20/ETH TWAP\r\n uint256 twap = rootOracle.price(underlying, baseToken, uniswapV2Factory);\r\n return\r\n baseToken == address(wtoken)\r\n ? twap\r\n : (twap * BasePriceOracle(msg.sender).price(baseToken)) /\r\n (10 ** uint256(ERC20Upgradeable(baseToken).decimals()));\r\n }\r\n\r\n /**\r\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Factory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol\";\r\n\r\nimport \"./UniswapTwapPriceOracleV2.sol\";\r\n\r\n/**\r\n * @title UniswapTwapPriceOracleV2Factory\r\n * @notice Deploys and catalogs UniswapTwapPriceOracleV2 contracts.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract UniswapTwapPriceOracleV2Factory {\r\n /**\r\n * @dev WETH token contract address.\r\n */\r\n address public immutable wtoken;\r\n\r\n /**\r\n * @dev `UniswapTwapPriceOracleV2Root` contract address.\r\n */\r\n address public immutable rootOracle;\r\n\r\n /**\r\n * @dev Implementation address for the `UniswapV3TwapPriceOracleV2`.\r\n */\r\n address public immutable logic;\r\n\r\n /**\r\n * @notice Maps `UniswapV2Factory` contracts to base tokens to `UniswapTwapPriceOracleV2` contract addresses.\r\n */\r\n mapping(address => mapping(address => UniswapTwapPriceOracleV2)) public oracles;\r\n\r\n /**\r\n * @dev Constructor that sets the `UniswapTwapPriceOracleV2Root` and `UniswapTwapPriceOracleV2` implementation contract.\r\n */\r\n constructor(address _rootOracle, address _logic, address _wtoken) {\r\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\r\n require(_logic != address(0), \"UniswapTwapPriceOracleV2 implementation/logic contract not defined.\");\r\n rootOracle = _rootOracle;\r\n logic = _logic;\r\n wtoken = _wtoken;\r\n }\r\n\r\n /**\r\n * @notice Deploys a `UniswapTwapPriceOracleV2`.\r\n * @param uniswapV2Factory The `UniswapV2Factory` contract of the pairs for which this oracle will be used.\r\n * @param baseToken The base token of the pairs for which this oracle will be used.\r\n */\r\n function deploy(address uniswapV2Factory, address baseToken) external returns (address) {\r\n // Input validation\r\n if (baseToken == address(0)) baseToken = address(wtoken);\r\n\r\n // Return existing oracle if present\r\n address currentOracle = address(oracles[uniswapV2Factory][baseToken]);\r\n if (currentOracle != address(0)) return currentOracle;\r\n\r\n // Deploy oracle\r\n bytes32 salt = keccak256(abi.encodePacked(uniswapV2Factory, baseToken));\r\n address oracle = ClonesUpgradeable.cloneDeterministic(logic, salt);\r\n UniswapTwapPriceOracleV2(oracle).initialize(rootOracle, uniswapV2Factory, baseToken, wtoken);\r\n\r\n // Set oracle in state\r\n oracles[uniswapV2Factory][baseToken] = UniswapTwapPriceOracleV2(oracle);\r\n\r\n // Return oracle address\r\n return oracle;\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Resolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IResolver } from \"ops/interfaces/IResolver.sol\";\r\nimport { UniswapTwapPriceOracleV2Root } from \"./UniswapTwapPriceOracleV2Root.sol\";\r\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\r\n\r\ncontract UniswapTwapPriceOracleV2Resolver is IResolver, Ownable {\r\n struct PairConfig {\r\n address pair;\r\n address baseToken;\r\n uint256 minPeriod;\r\n uint256 deviationThreshold;\r\n }\r\n\r\n // need to store as arrays for the UniswapTwapPriceOracleV2Root workable functions\r\n address[] pairs;\r\n address[] baseTokens;\r\n uint256[] minPeriods;\r\n uint256[] deviationThresholds;\r\n\r\n UniswapTwapPriceOracleV2Root public root;\r\n uint256 public lastUpdate;\r\n\r\n constructor(PairConfig[] memory _pairConfigs, UniswapTwapPriceOracleV2Root _root) {\r\n for (uint256 i = 0; i < _pairConfigs.length; i++) {\r\n pairs[i] = _pairConfigs[i].pair;\r\n baseTokens[i] = _pairConfigs[i].baseToken;\r\n minPeriods[i] = _pairConfigs[i].minPeriod;\r\n deviationThresholds[i] = _pairConfigs[i].deviationThreshold;\r\n }\r\n root = _root;\r\n }\r\n\r\n function getPairs() external view returns (PairConfig[] memory) {\r\n PairConfig[] memory pairConfigs = new PairConfig[](pairs.length);\r\n for (uint256 i = 0; i < pairs.length; i++) {\r\n PairConfig memory pairConfig = PairConfig({\r\n pair: pairs[i],\r\n baseToken: baseTokens[i],\r\n minPeriod: minPeriods[i],\r\n deviationThreshold: deviationThresholds[i]\r\n });\r\n pairConfigs[i] = pairConfig;\r\n }\r\n return pairConfigs;\r\n }\r\n\r\n function changeRoot(UniswapTwapPriceOracleV2Root _root) external onlyOwner {\r\n root = _root;\r\n }\r\n\r\n function removeFromPairs(uint256 index) external onlyOwner {\r\n if (index >= pairs.length) return;\r\n\r\n for (uint256 i = index; i < pairs.length - 1; i++) {\r\n pairs[i] = pairs[i + 1];\r\n baseTokens[i] = baseTokens[i + 1];\r\n minPeriods[i] = minPeriods[i + 1];\r\n deviationThresholds[i] = deviationThresholds[i + 1];\r\n }\r\n pairs.pop();\r\n baseTokens.pop();\r\n minPeriods.pop();\r\n deviationThresholds.pop();\r\n }\r\n\r\n function addPair(PairConfig calldata pair) external onlyOwner {\r\n pairs.push(pair.pair);\r\n baseTokens.push(pair.baseToken);\r\n minPeriods.push(pair.minPeriod);\r\n deviationThresholds.push(pair.deviationThreshold);\r\n }\r\n\r\n function getWorkablePairs() public view returns (address[] memory) {\r\n bool[] memory workable = root.workable(pairs, baseTokens, minPeriods, deviationThresholds);\r\n uint256 workableCount = 0;\r\n for (uint256 i = 0; i < workable.length; i += 1) {\r\n if (workable[i]) {\r\n workableCount += 1;\r\n }\r\n }\r\n\r\n address[] memory workablePairs = new address[](workableCount);\r\n uint256 j = 0;\r\n\r\n for (uint256 i = 0; i < workable.length; i++) {\r\n if (workable[i]) {\r\n workablePairs[j++] = pairs[i];\r\n }\r\n }\r\n return workablePairs;\r\n }\r\n\r\n function updatePairs(address[] calldata workablePairs) external {\r\n if (workablePairs.length == 0) return;\r\n root.update(workablePairs);\r\n }\r\n\r\n function checker() external view override returns (bool canExec, bytes memory execPayload) {\r\n address[] memory workablePairs = getWorkablePairs();\r\n if (workablePairs.length == 0) {\r\n return (false, bytes(\"No workable pairs\"));\r\n }\r\n\r\n canExec = true;\r\n execPayload = abi.encodeWithSelector(this.updatePairs.selector, workablePairs);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Root.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\r\nimport \"../../external/uniswap/IUniswapV2Factory.sol\";\r\n\r\n/**\r\n * @title UniswapTwapPriceOracleV2Root\r\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract UniswapTwapPriceOracleV2Root {\r\n /**\r\n * @dev wtoken token contract address.\r\n */\r\n address public immutable wtoken;\r\n\r\n /**\r\n * @dev Minimum TWAP interval.\r\n */\r\n uint256 public constant MIN_TWAP_TIME = 15 minutes;\r\n\r\n /**\r\n * @dev Constructor to set wtoken address\r\n */\r\n constructor(address _wtoken) {\r\n wtoken = _wtoken;\r\n }\r\n\r\n /**\r\n * @dev Return the TWAP value price0. Revert if TWAP time range is not within the threshold.\r\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\r\n * @param pair The pair to query for price0.\r\n */\r\n function price0TWAP(address pair) internal view returns (uint256) {\r\n uint256 length = observationCount[pair];\r\n require(length > 0, \"No length-1 TWAP observation.\");\r\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\r\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\r\n require(length > 1, \"No length-2 TWAP observation.\");\r\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\r\n }\r\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\r\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\r\n uint256 currPx0Cumu = currentPx0Cumu(pair);\r\n unchecked {\r\n return (currPx0Cumu - lastObservation.price0Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the TWAP value price1. Revert if TWAP time range is not within the threshold.\r\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\r\n * @param pair The pair to query for price1.\r\n */\r\n function price1TWAP(address pair) internal view returns (uint256) {\r\n uint256 length = observationCount[pair];\r\n require(length > 0, \"No length-1 TWAP observation.\");\r\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\r\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\r\n require(length > 1, \"No length-2 TWAP observation.\");\r\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\r\n }\r\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\r\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\r\n uint256 currPx1Cumu = currentPx1Cumu(pair);\r\n unchecked {\r\n return (currPx1Cumu - lastObservation.price1Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the current price0 cumulative value on Uniswap.\r\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\r\n * @param pair The uniswap pair to query for price0 cumulative value.\r\n */\r\n function currentPx0Cumu(address pair) internal view returns (uint256 px0Cumu) {\r\n uint32 currTime = uint32(block.timestamp);\r\n px0Cumu = IUniswapV2Pair(pair).price0CumulativeLast();\r\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\r\n if (lastTime != block.timestamp) {\r\n unchecked {\r\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\r\n px0Cumu += uint256((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the current price1 cumulative value on Uniswap.\r\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\r\n * @param pair The uniswap pair to query for price1 cumulative value.\r\n */\r\n function currentPx1Cumu(address pair) internal view returns (uint256 px1Cumu) {\r\n uint32 currTime = uint32(block.timestamp);\r\n px1Cumu = IUniswapV2Pair(pair).price1CumulativeLast();\r\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\r\n if (lastTime != currTime) {\r\n unchecked {\r\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\r\n px1Cumu += uint256((reserve0 << 112) / reserve1) * timeElapsed; // overflow is desired\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the price of `underlying` in terms of `baseToken` given `factory`.\r\n */\r\n function price(address underlying, address baseToken, address factory) external view returns (uint256) {\r\n // Return ERC20/ETH TWAP\r\n address pair = IUniswapV2Factory(factory).getPair(underlying, baseToken);\r\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\r\n return (((underlying < baseToken ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\r\n }\r\n\r\n /**\r\n * @dev Struct for cumulative price observations.\r\n */\r\n struct Observation {\r\n uint32 timestamp;\r\n uint256 price0Cumulative;\r\n uint256 price1Cumulative;\r\n }\r\n\r\n /**\r\n * @dev Length after which observations roll over to index 0.\r\n */\r\n uint8 public constant OBSERVATION_BUFFER = 4;\r\n\r\n /**\r\n * @dev Total observation count for each pair.\r\n */\r\n mapping(address => uint256) public observationCount;\r\n\r\n /**\r\n * @dev Array of cumulative price observations for each pair.\r\n */\r\n mapping(address => Observation[OBSERVATION_BUFFER]) public observations;\r\n\r\n /// @notice Get pairs for token combinations.\r\n function pairsFor(\r\n address[] calldata tokenA,\r\n address[] calldata tokenB,\r\n address factory\r\n ) external view returns (address[] memory) {\r\n require(\r\n tokenA.length > 0 && tokenA.length == tokenB.length,\r\n \"Token array lengths must be equal and greater than 0.\"\r\n );\r\n address[] memory pairs = new address[](tokenA.length);\r\n for (uint256 i = 0; i < tokenA.length; i++) pairs[i] = IUniswapV2Factory(factory).getPair(tokenA[i], tokenB[i]);\r\n return pairs;\r\n }\r\n\r\n /// @notice Check which of multiple pairs are workable/updatable.\r\n function workable(\r\n address[] calldata pairs,\r\n address[] calldata baseTokens,\r\n uint256[] calldata minPeriods,\r\n uint256[] calldata deviationThresholds\r\n ) external view returns (bool[] memory) {\r\n require(\r\n pairs.length > 0 &&\r\n pairs.length == baseTokens.length &&\r\n pairs.length == minPeriods.length &&\r\n pairs.length == deviationThresholds.length,\r\n \"Array lengths must be equal and greater than 0.\"\r\n );\r\n bool[] memory answers = new bool[](pairs.length);\r\n for (uint256 i = 0; i < pairs.length; i++)\r\n answers[i] = _workable(pairs[i], baseTokens[i], minPeriods[i], deviationThresholds[i]);\r\n return answers;\r\n }\r\n\r\n /// @dev Internal function to check if a pair is workable (updateable AND reserves have changed AND deviation threshold is satisfied).\r\n function _workable(\r\n address pair,\r\n address baseToken,\r\n uint256 minPeriod,\r\n uint256 deviationThreshold\r\n ) internal view returns (bool) {\r\n // Workable if:\r\n // 1) We have no observations\r\n // 2) The elapsed time since the last observation is > minPeriod AND reserves have changed AND deviation threshold is satisfied\r\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\r\n if (observationCount[pair] <= 0) return true;\r\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\r\n return\r\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\r\n (minPeriod >= MIN_TWAP_TIME ? minPeriod : MIN_TWAP_TIME) &&\r\n lastTime != observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp &&\r\n _deviation(pair, baseToken) >= deviationThreshold;\r\n }\r\n\r\n /// @dev Internal function to check if a pair's spot price's deviation from its TWAP price as a ratio scaled by 1e18\r\n function _deviation(address pair, address baseToken) internal view returns (uint256) {\r\n // Get token base unit\r\n address token0 = IUniswapV2Pair(pair).token0();\r\n bool useToken0Price = token0 != baseToken;\r\n address underlying = useToken0Price ? token0 : IUniswapV2Pair(pair).token1();\r\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\r\n\r\n // Get TWAP price\r\n uint256 twapPrice = (((useToken0Price ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\r\n\r\n // Get spot price\r\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();\r\n uint256 spotPrice = useToken0Price ? (reserve1 * baseUnit) / reserve0 : (reserve0 * baseUnit) / reserve1;\r\n\r\n // Get ratio and return deviation\r\n uint256 ratio = (spotPrice * 1e18) / twapPrice;\r\n return ratio >= 1e18 ? ratio - 1e18 : 1e18 - ratio;\r\n }\r\n\r\n /// @dev Internal function to check if a pair is updatable at all.\r\n function _updateable(address pair) internal view returns (bool) {\r\n // Updateable if:\r\n // 1) We have no observations\r\n // 2) The elapsed time since the last observation is > MIN_TWAP_TIME\r\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\r\n return\r\n observationCount[pair] <= 0 ||\r\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\r\n MIN_TWAP_TIME;\r\n }\r\n\r\n /// @notice Update one pair.\r\n function update(address pair) external {\r\n require(_update(pair), \"Failed to update pair.\");\r\n }\r\n\r\n /// @notice Update multiple pairs at once.\r\n function update(address[] calldata pairs) external {\r\n bool worked = false;\r\n for (uint256 i = 0; i < pairs.length; i++) if (_update(pairs[i])) worked = true;\r\n require(worked, \"No pairs can be updated (yet).\");\r\n }\r\n\r\n /// @dev Internal function to update a single pair.\r\n function _update(address pair) internal returns (bool) {\r\n // Check if workable\r\n if (!_updateable(pair)) return false;\r\n\r\n // Get cumulative price(s)\r\n uint256 price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();\r\n uint256 price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();\r\n\r\n // Loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\r\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\r\n observations[pair][observationCount[pair] % OBSERVATION_BUFFER] = Observation(\r\n lastTime,\r\n price0Cumulative,\r\n price1Cumulative\r\n );\r\n observationCount[pair]++;\r\n return true;\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/UniswapV3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { BasePriceOracle } from \"../BasePriceOracle.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport { ConcentratedLiquidityBasePriceOracle } from \"./ConcentratedLiquidityBasePriceOracle.sol\";\r\n\r\nimport \"../../external/uniswap/TickMath.sol\";\r\nimport \"../../external/uniswap/FullMath.sol\";\r\nimport \"../../external/uniswap/IUniswapV3Pool.sol\";\r\n\r\n/**\r\n * @title UniswapV3PriceOracle\r\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\r\n * @notice UniswapV3PriceOracle is a price oracle for Uniswap V3 pairs.\r\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\r\n */\r\ncontract UniswapV3PriceOracle is ConcentratedLiquidityBasePriceOracle {\r\n /**\r\n * @dev Fetches the price for a token from Algebra pools.\r\n */\r\n\r\n function _price(address token) internal view override returns (uint256) {\r\n uint32[] memory secondsAgos = new uint32[](2);\r\n uint256 twapWindow = poolFeeds[token].twapWindow;\r\n address baseToken = poolFeeds[token].baseToken;\r\n\r\n secondsAgos[0] = uint32(twapWindow);\r\n secondsAgos[1] = 0;\r\n\r\n IUniswapV3Pool pool = IUniswapV3Pool(poolFeeds[token].poolAddress);\r\n (int56[] memory tickCumulatives, ) = pool.observe(secondsAgos);\r\n\r\n int24 tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int56(int256(twapWindow)));\r\n uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(tick);\r\n\r\n uint256 tokenPrice = getPriceX96FromSqrtPriceX96(pool.token0(), token, sqrtPriceX96);\r\n return scalePrices(baseToken, token, tokenPrice);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/VelodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ninterface Prices {\r\n function getRateToEth(address srcToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\r\n}\r\n\r\ncontract VelodromePriceOracle is BasePriceOracle {\r\n Prices immutable prices;\r\n\r\n constructor(address _prices) {\r\n prices = Prices(_prices);\r\n }\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n * @param underlying The underlying token address for which to get the price.\r\n * @return Price denominated in ETH (scaled by 1e18)\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying));\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n */\r\n function _price(address token) internal view returns (uint256) {\r\n return prices.getRateToEth(token, false);\r\n }\r\n}\r\n" + }, + "contracts/oracles/default/VelodromePriceOracleFraxtal.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../BasePriceOracle.sol\";\r\n\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ninterface Prices_Fraxtal {\r\n function getRate(address srcToken, address dstToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\r\n}\r\n\r\ncontract VelodromePriceOracleFraxtal is BasePriceOracle {\r\n Prices_Fraxtal immutable prices;\r\n\r\n constructor(address _prices) {\r\n prices = Prices_Fraxtal(_prices);\r\n }\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n * @param underlying The underlying token address for which to get the price.\r\n * @return Price denominated in ETH (scaled by 1e18)\r\n */\r\n function price(address underlying) external view override returns (uint256) {\r\n return _price(underlying);\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n address underlying = cToken.underlying();\r\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\r\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\r\n return (_price(underlying));\r\n }\r\n\r\n /**\r\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\r\n */\r\n function _price(address token) internal view returns (uint256) {\r\n return prices.getRate(token, 0xFC00000000000000000000000000000000000006, false);\r\n }\r\n}\r\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\n\r\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\r\n\r\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title MasterPriceOracle\r\n * @notice Use a combination of price oracles.\r\n * @dev Implements `PriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\r\n /**\r\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\r\n */\r\n mapping(address => BasePriceOracle) public oracles;\r\n\r\n /**\r\n * @dev Default/fallback `PriceOracle`.\r\n */\r\n BasePriceOracle public defaultOracle;\r\n\r\n /**\r\n * @dev The administrator of this `MasterPriceOracle`.\r\n */\r\n address public admin;\r\n\r\n /**\r\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n */\r\n bool internal noAdminOverwrite;\r\n\r\n /**\r\n * @dev The Wrapped native asset address.\r\n */\r\n address public wtoken;\r\n\r\n /**\r\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\r\n */\r\n mapping(address => BasePriceOracle) public fallbackOracles;\r\n\r\n /**\r\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n */\r\n function canAdminOverwrite() external view returns (bool) {\r\n return !noAdminOverwrite;\r\n }\r\n\r\n /**\r\n * @dev Event emitted when `admin` is changed.\r\n */\r\n event NewAdmin(address oldAdmin, address newAdmin);\r\n\r\n /**\r\n * @dev Event emitted when the default oracle is changed.\r\n */\r\n event NewDefaultOracle(address oldOracle, address newOracle);\r\n\r\n /**\r\n * @dev Event emitted when an underlying token's oracle is changed.\r\n */\r\n event NewOracle(address underlying, address oldOracle, address newOracle);\r\n\r\n /**\r\n * @dev Initialize state variables.\r\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\r\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\r\n * @param _defaultOracle The default `PriceOracle` contract to use.\r\n * @param _admin The admin who can assign oracles to underlying tokens.\r\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n * @param _wtoken The Wrapped native asset address\r\n */\r\n function initialize(\r\n address[] memory underlyings,\r\n BasePriceOracle[] memory _oracles,\r\n BasePriceOracle _defaultOracle,\r\n address _admin,\r\n bool _canAdminOverwrite,\r\n address _wtoken\r\n ) external initializer {\r\n // Input validation\r\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\r\n\r\n // Initialize state variables\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n BasePriceOracle newOracle = _oracles[i];\r\n oracles[underlying] = newOracle;\r\n emit NewOracle(underlying, address(0), address(newOracle));\r\n }\r\n\r\n defaultOracle = _defaultOracle;\r\n admin = _admin;\r\n noAdminOverwrite = !_canAdminOverwrite;\r\n wtoken = _wtoken;\r\n }\r\n\r\n /**\r\n * @dev Sets `_oracles` for `underlyings`.\r\n */\r\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == _oracles.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // Assign oracles to underlying tokens\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n address oldOracle = address(oracles[underlying]);\r\n if (noAdminOverwrite)\r\n require(\r\n oldOracle == address(0),\r\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\r\n );\r\n BasePriceOracle newOracle = _oracles[i];\r\n oracles[underlying] = newOracle;\r\n emit NewOracle(underlying, oldOracle, address(newOracle));\r\n }\r\n }\r\n\r\n /**\r\n * @dev Sets `_oracles` for `underlyings`.\r\n */\r\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == _oracles.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // Assign oracles to underlying tokens\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n address oldOracle = address(fallbackOracles[underlying]);\r\n if (noAdminOverwrite)\r\n require(\r\n oldOracle == address(0),\r\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\r\n );\r\n BasePriceOracle newOracle = _oracles[i];\r\n fallbackOracles[underlying] = newOracle;\r\n emit NewOracle(underlying, oldOracle, address(newOracle));\r\n }\r\n }\r\n\r\n /**\r\n * @dev Changes the default price oracle\r\n */\r\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\r\n BasePriceOracle oldOracle = defaultOracle;\r\n defaultOracle = newOracle;\r\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\r\n }\r\n\r\n /**\r\n * @dev Changes the admin and emits an event.\r\n */\r\n function changeAdmin(address newAdmin) external onlyAdmin {\r\n address oldAdmin = admin;\r\n admin = newAdmin;\r\n emit NewAdmin(oldAdmin, newAdmin);\r\n }\r\n\r\n /**\r\n * @dev Modifier that checks if `msg.sender == admin`.\r\n */\r\n modifier onlyAdmin() {\r\n require(msg.sender == admin, \"Sender is not the admin.\");\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying ERC20 token address\r\n address underlying = address(ICErc20(address(cToken)).underlying());\r\n\r\n if (underlying == wtoken) return 1e18;\r\n\r\n BasePriceOracle oracle = oracles[underlying];\r\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\r\n\r\n if (address(oracle) != address(0)) {\r\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\r\n if (underlyingPrice == 0) {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\r\n } else {\r\n return underlyingPrice;\r\n }\r\n } catch {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\r\n }\r\n } else {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\r\n }\r\n revert(\"Price oracle not found for this underlying token address.\");\r\n }\r\n\r\n /**\r\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) public view override returns (uint256) {\r\n // Return 1e18 for WETH\r\n if (underlying == wtoken) return 1e18;\r\n\r\n // Get underlying price from assigned oracle\r\n BasePriceOracle oracle = oracles[underlying];\r\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\r\n\r\n if (address(oracle) != address(0)) {\r\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\r\n if (underlyingPrice == 0) {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\r\n } else {\r\n return underlyingPrice;\r\n }\r\n } catch {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\r\n }\r\n } else {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\r\n }\r\n revert(\"Price oracle not found for this underlying token address.\");\r\n }\r\n}\r\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\r\nimport { Unitroller } from \"./compound/Unitroller.sol\";\r\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\r\nimport \"./ionic/DiamondExtension.sol\";\r\n\r\n/**\r\n * @title PoolDirectory\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\r\n */\r\ncontract PoolDirectory is SafeOwnableUpgradeable {\r\n /**\r\n * @dev Initializes a deployer whitelist if desired.\r\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\r\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\r\n */\r\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\r\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\r\n }\r\n\r\n /**\r\n * @dev Struct for a Ionic interest rate pool.\r\n */\r\n struct Pool {\r\n string name;\r\n address creator;\r\n address comptroller;\r\n uint256 blockPosted;\r\n uint256 timestampPosted;\r\n }\r\n\r\n /**\r\n * @dev Array of Ionic interest rate pools.\r\n */\r\n Pool[] public pools;\r\n\r\n /**\r\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\r\n */\r\n mapping(address => uint256[]) private _poolsByAccount;\r\n\r\n /**\r\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\r\n */\r\n mapping(address => bool) public poolExists;\r\n\r\n /**\r\n * @dev Emitted when a new Ionic pool is added to the directory.\r\n */\r\n event PoolRegistered(uint256 index, Pool pool);\r\n\r\n /**\r\n * @dev Booleans indicating if the deployer whitelist is enforced.\r\n */\r\n bool public enforceDeployerWhitelist;\r\n\r\n /**\r\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\r\n */\r\n mapping(address => bool) public deployerWhitelist;\r\n\r\n /**\r\n * @dev Controls if the deployer whitelist is to be enforced.\r\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\r\n */\r\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\r\n enforceDeployerWhitelist = enforce;\r\n }\r\n\r\n /**\r\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\r\n * @param deployers Array of Ethereum accounts to be whitelisted.\r\n * @param status Whether to add or remove the accounts.\r\n */\r\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\r\n require(deployers.length > 0, \"No deployers supplied.\");\r\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\r\n }\r\n\r\n /**\r\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\r\n * @param name The name of the pool.\r\n * @param comptroller The pool's Comptroller proxy contract address.\r\n * @return The index of the registered Ionic pool.\r\n */\r\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\r\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\r\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\r\n require(bytes(name).length <= 100, \"No pool name supplied.\");\r\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\r\n pools.push(pool);\r\n _poolsByAccount[msg.sender].push(pools.length - 1);\r\n poolExists[comptroller] = true;\r\n emit PoolRegistered(pools.length - 1, pool);\r\n return pools.length - 1;\r\n }\r\n\r\n function _deprecatePool(address comptroller) external onlyOwner {\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller == comptroller) {\r\n _deprecatePool(i);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n function _deprecatePool(uint256 index) public onlyOwner {\r\n Pool storage ionicPool = pools[index];\r\n\r\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\r\n\r\n // swap with the last pool of the creator and delete\r\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\r\n for (uint256 i = 0; i < creatorPools.length; i++) {\r\n if (creatorPools[i] == index) {\r\n creatorPools[i] = creatorPools[creatorPools.length - 1];\r\n creatorPools.pop();\r\n break;\r\n }\r\n }\r\n\r\n // leave it to true to deny the re-registering of the same pool\r\n poolExists[ionicPool.comptroller] = true;\r\n\r\n // nullify the storage\r\n ionicPool.comptroller = address(0);\r\n ionicPool.creator = address(0);\r\n ionicPool.name = \"\";\r\n ionicPool.blockPosted = 0;\r\n ionicPool.timestampPosted = 0;\r\n }\r\n\r\n /**\r\n * @dev Deploys a new Ionic pool and adds to the directory.\r\n * @param name The name of the pool.\r\n * @param implementation The Comptroller implementation contract address.\r\n * @param constructorData Encoded construction data for `Unitroller constructor()`\r\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\r\n * @param closeFactor The pool's close factor (scaled by 1e18).\r\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\r\n * @param priceOracle The pool's PriceOracle contract address.\r\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\r\n */\r\n function deployPool(\r\n string memory name,\r\n address implementation,\r\n bytes calldata constructorData,\r\n bool enforceWhitelist,\r\n uint256 closeFactor,\r\n uint256 liquidationIncentive,\r\n address priceOracle\r\n ) external returns (uint256, address) {\r\n // Input validation\r\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\r\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\r\n\r\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\r\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\r\n address proxy = Create2Upgradeable.deploy(\r\n 0,\r\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\r\n unitrollerCreationCode\r\n );\r\n\r\n // Setup the pool\r\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\r\n // Set up the extensions\r\n comptrollerProxy._upgrade();\r\n\r\n // Set pool parameters\r\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\r\n require(\r\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\r\n \"Failed to set pool liquidation incentive.\"\r\n );\r\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\r\n\r\n // Whitelist\r\n if (enforceWhitelist)\r\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\r\n\r\n // Make msg.sender the admin\r\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\r\n\r\n // Register the pool with this PoolDirectory\r\n return (_registerPool(name, proxy), proxy);\r\n }\r\n\r\n /**\r\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\r\n uint256 count = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) count++;\r\n }\r\n\r\n Pool[] memory activePools = new Pool[](count);\r\n uint256[] memory poolIds = new uint256[](count);\r\n\r\n uint256 index = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) {\r\n poolIds[index] = i;\r\n activePools[index] = pools[i];\r\n index++;\r\n }\r\n }\r\n\r\n return (poolIds, activePools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all Ionic pools' data.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getAllPools() public view returns (Pool[] memory) {\r\n uint256 count = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) count++;\r\n }\r\n\r\n Pool[] memory result = new Pool[](count);\r\n\r\n uint256 index = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) {\r\n result[index++] = pools[i];\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all public Ionic pool indexes and data.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (enforceWhitelist) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory publicPools = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (enforceWhitelist) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n publicPools[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, publicPools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all public Ionic pool indexes and data.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\r\n if (!isUsing) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\r\n if (!isUsing) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n poolsOfUser[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, poolsOfUser);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\r\n */\r\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\r\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\r\n (, Pool[] memory activePools) = getActivePools();\r\n\r\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\r\n indexes[i] = _poolsByAccount[account][i];\r\n accountPools[i] = activePools[_poolsByAccount[account][i]];\r\n }\r\n\r\n return (indexes, accountPools);\r\n }\r\n\r\n /**\r\n * @notice Modify existing Ionic pool name.\r\n */\r\n function setPoolName(uint256 index, string calldata name) external {\r\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\r\n require(\r\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\r\n \"!permission\"\r\n );\r\n pools[index].name = name;\r\n }\r\n\r\n /**\r\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\r\n */\r\n mapping(address => bool) public adminWhitelist;\r\n\r\n /**\r\n * @dev used as salt for the creation of new pools\r\n */\r\n uint256 public poolsCounter;\r\n\r\n /**\r\n * @dev Event emitted when the admin whitelist is updated.\r\n */\r\n event AdminWhitelistUpdated(address[] admins, bool status);\r\n\r\n /**\r\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\r\n * @param admins Array of Ethereum accounts to be whitelisted.\r\n * @param status Whether to add or remove the accounts.\r\n */\r\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\r\n require(admins.length > 0, \"No admins supplied.\");\r\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\r\n emit AdminWhitelistUpdated(admins, status);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n\r\n try comptroller.admin() returns (address admin) {\r\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory publicPools = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n\r\n try comptroller.admin() returns (address admin) {\r\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n publicPools[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, publicPools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\r\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getVerifiedPoolsOfWhitelistedAccount(\r\n address account\r\n ) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n\r\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n accountWhitelistedPools[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, accountWhitelistedPools);\r\n }\r\n}\r\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\n\r\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\r\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\r\n\r\n/**\r\n * @title PoolLens\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\r\n */\r\ncontract PoolLens is Initializable {\r\n error ComptrollerError(uint256 errCode);\r\n\r\n /**\r\n * @notice Initialize the `PoolDirectory` contract object.\r\n * @param _directory The PoolDirectory\r\n * @param _name Name for the nativeToken\r\n * @param _symbol Symbol for the nativeToken\r\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\r\n * @param _hardcodedNames Harcoded name for these tokens\r\n * @param _hardcodedSymbols Harcoded symbol for these tokens\r\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\r\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\r\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\r\n */\r\n function initialize(\r\n PoolDirectory _directory,\r\n string memory _name,\r\n string memory _symbol,\r\n address[] memory _hardcodedAddresses,\r\n string[] memory _hardcodedNames,\r\n string[] memory _hardcodedSymbols,\r\n string[] memory _uniswapLPTokenNames,\r\n string[] memory _uniswapLPTokenSymbols,\r\n string[] memory _uniswapLPTokenDisplayNames\r\n ) public initializer {\r\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\r\n require(\r\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\r\n \"Hardcoded addresses lengths not equal.\"\r\n );\r\n require(\r\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\r\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\r\n \"Uniswap LP token names lengths not equal.\"\r\n );\r\n\r\n directory = _directory;\r\n name = _name;\r\n symbol = _symbol;\r\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\r\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\r\n }\r\n\r\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\r\n uniswapData.push(\r\n UniswapData({\r\n name: _uniswapLPTokenNames[i],\r\n symbol: _uniswapLPTokenSymbols[i],\r\n displayName: _uniswapLPTokenDisplayNames[i]\r\n })\r\n );\r\n }\r\n }\r\n\r\n string public name;\r\n string public symbol;\r\n\r\n struct TokenData {\r\n string name;\r\n string symbol;\r\n }\r\n mapping(address => TokenData) hardcoded;\r\n\r\n struct UniswapData {\r\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\r\n string symbol; // ie \"UNI-V2\" or \"SLP\"\r\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\r\n }\r\n UniswapData[] uniswapData;\r\n\r\n /**\r\n * @notice `PoolDirectory` contract object.\r\n */\r\n PoolDirectory public directory;\r\n\r\n /**\r\n * @dev Struct for Ionic pool summary data.\r\n */\r\n struct IonicPoolData {\r\n uint256 totalSupply;\r\n uint256 totalBorrow;\r\n address[] underlyingTokens;\r\n string[] underlyingSymbols;\r\n bool whitelistedAdmin;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPublicPoolsWithData()\r\n external\r\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\r\n {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\r\n return (indexes, publicPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPublicPoolsByVerificationWithData(\r\n bool whitelistedAdmin\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\r\n whitelistedAdmin\r\n );\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\r\n return (indexes, publicPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolsByAccountWithData(\r\n address account\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\r\n return (indexes, accountPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolsOIonicrWithData(\r\n address user\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\r\n return (indexes, userPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\r\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\r\n bool[] memory errored = new bool[](pools.length);\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\r\n uint256 _totalSupply,\r\n uint256 _totalBorrow,\r\n address[] memory _underlyingTokens,\r\n string[] memory _underlyingSymbols,\r\n bool _whitelistedAdmin\r\n ) {\r\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\r\n } catch {\r\n errored[i] = true;\r\n }\r\n }\r\n\r\n return (data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\r\n */\r\n function getPoolSummary(\r\n IonicComptroller comptroller\r\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\r\n uint256 totalBorrow = 0;\r\n uint256 totalSupply = 0;\r\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\r\n address[] memory underlyingTokens = new address[](cTokens.length);\r\n string[] memory underlyingSymbols = new string[](cTokens.length);\r\n BasePriceOracle oracle = comptroller.oracle();\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n ICErc20 cToken = cTokens[i];\r\n (bool isListed, ) = comptroller.markets(address(cToken));\r\n if (!isListed) continue;\r\n cToken.accrueInterest();\r\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\r\n uint256 assetTotalSupply = cToken.getCash() +\r\n assetTotalBorrow -\r\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\r\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\r\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\r\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\r\n\r\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\r\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\r\n }\r\n\r\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\r\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\r\n }\r\n\r\n /**\r\n * @dev Struct for a Ionic pool asset.\r\n */\r\n struct PoolAsset {\r\n address cToken;\r\n address underlyingToken;\r\n string underlyingName;\r\n string underlyingSymbol;\r\n uint256 underlyingDecimals;\r\n uint256 underlyingBalance;\r\n uint256 supplyRatePerBlock;\r\n uint256 borrowRatePerBlock;\r\n uint256 totalSupply;\r\n uint256 totalBorrow;\r\n uint256 supplyBalance;\r\n uint256 borrowBalance;\r\n uint256 liquidity;\r\n bool membership;\r\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\r\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\r\n address oracle;\r\n uint256 collateralFactor;\r\n uint256 reserveFactor;\r\n uint256 adminFee;\r\n uint256 ionicFee;\r\n bool borrowGuardianPaused;\r\n bool mintGuardianPaused;\r\n }\r\n\r\n /**\r\n * @notice Returns data on the specified assets of the specified Ionic pool.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\r\n * @param cTokens The cToken contract addresses of the assets to query.\r\n * @param user The user for which to get account data.\r\n * @return An array of Ionic pool assets.\r\n */\r\n function getPoolAssetsWithData(\r\n IonicComptroller comptroller,\r\n ICErc20[] memory cTokens,\r\n address user\r\n ) internal returns (PoolAsset[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\r\n if (isListed) arrayLength++;\r\n }\r\n\r\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\r\n uint256 index = 0;\r\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n // Check if market is listed and get collateral factor\r\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\r\n if (!isListed) continue;\r\n\r\n // Start adding data to PoolAsset\r\n PoolAsset memory asset;\r\n ICErc20 cToken = cTokens[i];\r\n asset.cToken = address(cToken);\r\n\r\n cToken.accrueInterest();\r\n\r\n // Get underlying asset data\r\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\r\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\r\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\r\n asset.underlyingDecimals = underlying.decimals();\r\n asset.underlyingBalance = underlying.balanceOf(user);\r\n\r\n // Get cToken data\r\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\r\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\r\n asset.liquidity = cToken.getCash();\r\n asset.totalBorrow = cToken.totalBorrowsCurrent();\r\n asset.totalSupply =\r\n asset.liquidity +\r\n asset.totalBorrow -\r\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\r\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\r\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\r\n asset.membership = comptroller.checkMembership(user, cToken);\r\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\r\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\r\n\r\n // Get oracle for this cToken\r\n asset.oracle = address(oracle);\r\n\r\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\r\n asset.oracle = address(_oracle);\r\n } catch {}\r\n\r\n // More cToken data\r\n asset.collateralFactor = collateralFactorMantissa;\r\n asset.reserveFactor = cToken.reserveFactorMantissa();\r\n asset.adminFee = cToken.adminFeeMantissa();\r\n asset.ionicFee = cToken.ionicFeeMantissa();\r\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\r\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\r\n\r\n // Add to assets array and increment index\r\n detailedAssets[index] = asset;\r\n index++;\r\n }\r\n\r\n return (detailedAssets);\r\n }\r\n\r\n function getBorrowCapsPerCollateral(\r\n ICErc20 borrowedAsset,\r\n IonicComptroller comptroller\r\n )\r\n internal\r\n view\r\n returns (\r\n address[] memory collateral,\r\n uint256[] memory borrowCapsAgainstCollateral,\r\n bool[] memory borrowingBlacklistedAgainstCollateral\r\n )\r\n {\r\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\r\n\r\n collateral = new address[](poolMarkets.length);\r\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\r\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\r\n\r\n for (uint256 i = 0; i < poolMarkets.length; i++) {\r\n address collateralAddress = address(poolMarkets[i]);\r\n if (collateralAddress != address(borrowedAsset)) {\r\n collateral[i] = collateralAddress;\r\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\r\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\r\n address(borrowedAsset),\r\n collateralAddress\r\n );\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @notice Returns the `name` and `symbol` of `token`.\r\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\r\n * @param token An ERC20 token contract object.\r\n * @return The `name` and `symbol`.\r\n */\r\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\r\n // i.e. MKR is a DSToken and uses bytes32\r\n if (bytes(hardcoded[token].symbol).length != 0) {\r\n return (hardcoded[token].name, hardcoded[token].symbol);\r\n }\r\n\r\n // Get name and symbol from token contract\r\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\r\n string memory _name = tokenContract.name();\r\n string memory _symbol = tokenContract.symbol();\r\n\r\n return (_name, _symbol);\r\n }\r\n\r\n /**\r\n * @notice Returns the assets of the specified Ionic pool.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\r\n * @return An array of Ionic pool assets.\r\n */\r\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\r\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\r\n }\r\n\r\n /**\r\n * @dev Struct for a Ionic pool user.\r\n */\r\n struct IonicPoolUser {\r\n address account;\r\n uint256 totalBorrow;\r\n uint256 totalCollateral;\r\n uint256 health;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of PoolAsset for a specific user\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\r\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\r\n return assets;\r\n }\r\n\r\n /**\r\n * @notice returns the total supply cap for each asset in the pool\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\r\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\r\n\r\n address[] memory assets = new address[](poolMarkets.length);\r\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\r\n for (uint256 i = 0; i < poolMarkets.length; i++) {\r\n assets[i] = address(poolMarkets[i]);\r\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\r\n }\r\n\r\n return (assets, supplyCapsPerAsset);\r\n }\r\n\r\n /**\r\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getSupplyCapsDataForPool(\r\n IonicComptroller comptroller\r\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\r\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\r\n\r\n address[] memory assets = new address[](poolMarkets.length);\r\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\r\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\r\n for (uint256 i = 0; i < poolMarkets.length; i++) {\r\n assets[i] = address(poolMarkets[i]);\r\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\r\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\r\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\r\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\r\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\r\n }\r\n\r\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\r\n }\r\n\r\n /**\r\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getBorrowCapsForAsset(\r\n ICErc20 asset\r\n )\r\n public\r\n view\r\n returns (\r\n address[] memory collateral,\r\n uint256[] memory borrowCapsPerCollateral,\r\n bool[] memory collateralBlacklisted,\r\n uint256 totalBorrowCap\r\n )\r\n {\r\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\r\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\r\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\r\n }\r\n\r\n /**\r\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getBorrowCapsDataForAsset(\r\n ICErc20 asset\r\n )\r\n public\r\n view\r\n returns (\r\n address[] memory collateral,\r\n uint256[] memory borrowCapsPerCollateral,\r\n bool[] memory collateralBlacklisted,\r\n uint256 totalBorrowCap,\r\n uint256 nonWhitelistedTotalBorrows\r\n )\r\n {\r\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\r\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\r\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\r\n uint256 totalBorrows = asset.totalBorrowsCurrent();\r\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\r\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\r\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\r\n * Note that the whitelist does not have to be enforced.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getWhitelistedPoolsByAccount(\r\n address account\r\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\r\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\r\n uint256 arrayLength = 0;\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n\r\n if (comptroller.whitelist(account)) arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n\r\n if (comptroller.whitelist(account)) {\r\n indexes[index] = i;\r\n accountPools[index] = pools[i];\r\n index++;\r\n break;\r\n }\r\n }\r\n\r\n return (indexes, accountPools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getWhitelistedPoolsByAccountWithData(\r\n address account\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\r\n return (indexes, accountPools, data, errored);\r\n }\r\n\r\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\r\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\r\n }\r\n\r\n function getHealthFactorHypothetical(\r\n IonicComptroller pool,\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) public view returns (uint256) {\r\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\r\n account,\r\n cTokenModify,\r\n redeemTokens,\r\n borrowAmount,\r\n repayAmount\r\n );\r\n\r\n if (err != 0) revert ComptrollerError(err);\r\n\r\n if (shortfall > 0) {\r\n // HF < 1.0\r\n return (collateralValue * 1e18) / (collateralValue + shortfall);\r\n } else {\r\n // HF >= 1.0\r\n if (collateralValue <= liquidity) return type(uint256).max;\r\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/PoolLensSecondary.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\nimport { IUniswapV2Pair } from \"./external/uniswap/IUniswapV2Pair.sol\";\r\n\r\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\r\n\r\ninterface IRewardsDistributor_PLS {\r\n function rewardToken() external view returns (address);\r\n\r\n function compSupplySpeeds(address) external view returns (uint256);\r\n\r\n function compBorrowSpeeds(address) external view returns (uint256);\r\n\r\n function compAccrued(address) external view returns (uint256);\r\n\r\n function flywheelPreSupplierAction(address cToken, address supplier) external;\r\n\r\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\r\n\r\n function getAllMarkets() external view returns (ICErc20[] memory);\r\n}\r\n\r\n/**\r\n * @title PoolLensSecondary\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice PoolLensSecondary returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\r\n */\r\ncontract PoolLensSecondary is Initializable {\r\n /**\r\n * @notice Constructor to set the `PoolDirectory` contract object.\r\n */\r\n function initialize(PoolDirectory _directory) public initializer {\r\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\r\n directory = _directory;\r\n }\r\n\r\n /**\r\n * @notice `PoolDirectory` contract object.\r\n */\r\n PoolDirectory public directory;\r\n\r\n /**\r\n * @notice Struct for ownership over a CToken.\r\n */\r\n struct CTokenOwnership {\r\n address cToken;\r\n address admin;\r\n bool adminHasRights;\r\n bool ionicAdminHasRights;\r\n }\r\n\r\n /**\r\n * @notice Returns the admin, admin rights, Ionic admin (constant), Ionic admin rights, and an array of cTokens with differing properties.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolOwnership(\r\n IonicComptroller comptroller\r\n ) external view returns (address, bool, bool, CTokenOwnership[] memory) {\r\n // Get pool ownership\r\n address comptrollerAdmin = comptroller.admin();\r\n bool comptrollerAdminHasRights = comptroller.adminHasRights();\r\n bool comptrollerIonicAdminHasRights = comptroller.ionicAdminHasRights();\r\n\r\n // Get cToken ownership\r\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\r\n uint256 arrayLength = 0;\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n ICErc20 cToken = cTokens[i];\r\n (bool isListed, ) = comptroller.markets(address(cToken));\r\n if (!isListed) continue;\r\n\r\n address cTokenAdmin;\r\n try cToken.admin() returns (address _cTokenAdmin) {\r\n cTokenAdmin = _cTokenAdmin;\r\n } catch {\r\n continue;\r\n }\r\n bool cTokenAdminHasRights = cToken.adminHasRights();\r\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\r\n\r\n // If outlier, push to array\r\n if (\r\n cTokenAdmin != comptrollerAdmin ||\r\n cTokenAdminHasRights != comptrollerAdminHasRights ||\r\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\r\n ) arrayLength++;\r\n }\r\n\r\n CTokenOwnership[] memory outliers = new CTokenOwnership[](arrayLength);\r\n uint256 arrayIndex = 0;\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n ICErc20 cToken = cTokens[i];\r\n (bool isListed, ) = comptroller.markets(address(cToken));\r\n if (!isListed) continue;\r\n\r\n address cTokenAdmin;\r\n try cToken.admin() returns (address _cTokenAdmin) {\r\n cTokenAdmin = _cTokenAdmin;\r\n } catch {\r\n continue;\r\n }\r\n bool cTokenAdminHasRights = cToken.adminHasRights();\r\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\r\n\r\n // If outlier, push to array and increment array index\r\n if (\r\n cTokenAdmin != comptrollerAdmin ||\r\n cTokenAdminHasRights != comptrollerAdminHasRights ||\r\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\r\n ) {\r\n outliers[arrayIndex] = CTokenOwnership(\r\n address(cToken),\r\n cTokenAdmin,\r\n cTokenAdminHasRights,\r\n cTokenIonicAdminHasRights\r\n );\r\n arrayIndex++;\r\n }\r\n }\r\n\r\n return (comptrollerAdmin, comptrollerAdminHasRights, comptrollerIonicAdminHasRights, outliers);\r\n }\r\n\r\n /**\r\n * @notice Determine the maximum redeem amount of a cToken.\r\n * @param cTokenModify The market to hypothetically redeem in.\r\n * @param account The account to determine liquidity for.\r\n * @return Maximum redeem amount.\r\n */\r\n function getMaxRedeem(address account, ICErc20 cTokenModify) external returns (uint256) {\r\n return getMaxRedeemOrBorrow(account, cTokenModify, false);\r\n }\r\n\r\n /**\r\n * @notice Determine the maximum borrow amount of a cToken.\r\n * @param cTokenModify The market to hypothetically borrow in.\r\n * @param account The account to determine liquidity for.\r\n * @return Maximum borrow amount.\r\n */\r\n function getMaxBorrow(address account, ICErc20 cTokenModify) external returns (uint256) {\r\n return getMaxRedeemOrBorrow(account, cTokenModify, true);\r\n }\r\n\r\n /**\r\n * @dev Internal function to determine the maximum borrow/redeem amount of a cToken.\r\n * @param cTokenModify The market to hypothetically borrow/redeem in.\r\n * @param account The account to determine liquidity for.\r\n * @return Maximum borrow/redeem amount.\r\n */\r\n function getMaxRedeemOrBorrow(address account, ICErc20 cTokenModify, bool isBorrow) internal returns (uint256) {\r\n IonicComptroller comptroller = IonicComptroller(cTokenModify.comptroller());\r\n return comptroller.getMaxRedeemOrBorrow(account, cTokenModify, isBorrow);\r\n }\r\n\r\n /**\r\n * @notice Returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\r\n * @param comptroller The Ionic pool Comptroller to check.\r\n */\r\n function getRewardSpeedsByPool(\r\n IonicComptroller comptroller\r\n ) public view returns (ICErc20[] memory, address[] memory, address[] memory, uint256[][] memory, uint256[][] memory) {\r\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\r\n address[] memory distributors;\r\n\r\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\r\n distributors = _distributors;\r\n } catch {\r\n distributors = new address[](0);\r\n }\r\n\r\n address[] memory rewardTokens = new address[](distributors.length);\r\n uint256[][] memory supplySpeeds = new uint256[][](allMarkets.length);\r\n uint256[][] memory borrowSpeeds = new uint256[][](allMarkets.length);\r\n\r\n // Get reward tokens for each distributor\r\n for (uint256 i = 0; i < distributors.length; i++) {\r\n rewardTokens[i] = IRewardsDistributor_PLS(distributors[i]).rewardToken();\r\n }\r\n\r\n // Get reward speeds for each market for each distributor\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n address cToken = address(allMarkets[i]);\r\n supplySpeeds[i] = new uint256[](distributors.length);\r\n borrowSpeeds[i] = new uint256[](distributors.length);\r\n\r\n for (uint256 j = 0; j < distributors.length; j++) {\r\n IRewardsDistributor_PLS distributor = IRewardsDistributor_PLS(distributors[j]);\r\n supplySpeeds[i][j] = distributor.compSupplySpeeds(cToken);\r\n borrowSpeeds[i][j] = distributor.compBorrowSpeeds(cToken);\r\n }\r\n }\r\n\r\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\r\n }\r\n\r\n /**\r\n * @notice For each `Comptroller`, returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\r\n * @param comptrollers The Ionic pool Comptrollers to check.\r\n */\r\n function getRewardSpeedsByPools(\r\n IonicComptroller[] memory comptrollers\r\n )\r\n external\r\n view\r\n returns (ICErc20[][] memory, address[][] memory, address[][] memory, uint256[][][] memory, uint256[][][] memory)\r\n {\r\n ICErc20[][] memory allMarkets = new ICErc20[][](comptrollers.length);\r\n address[][] memory distributors = new address[][](comptrollers.length);\r\n address[][] memory rewardTokens = new address[][](comptrollers.length);\r\n uint256[][][] memory supplySpeeds = new uint256[][][](comptrollers.length);\r\n uint256[][][] memory borrowSpeeds = new uint256[][][](comptrollers.length);\r\n for (uint256 i = 0; i < comptrollers.length; i++)\r\n (allMarkets[i], distributors[i], rewardTokens[i], supplySpeeds[i], borrowSpeeds[i]) = getRewardSpeedsByPool(\r\n comptrollers[i]\r\n );\r\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\r\n }\r\n\r\n /**\r\n * @notice Returns unaccrued rewards by `holder` from `cToken` on `distributor`.\r\n * @param holder The address to check.\r\n * @param distributor The RewardsDistributor to check.\r\n * @param cToken The CToken to check.\r\n * @return Unaccrued (unclaimed) supply-side rewards and unaccrued (unclaimed) borrow-side rewards.\r\n */\r\n function getUnaccruedRewards(\r\n address holder,\r\n IRewardsDistributor_PLS distributor,\r\n ICErc20 cToken\r\n ) internal returns (uint256, uint256) {\r\n // Get unaccrued supply rewards\r\n uint256 compAccruedPrior = distributor.compAccrued(holder);\r\n distributor.flywheelPreSupplierAction(address(cToken), holder);\r\n uint256 supplyRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\r\n\r\n // Get unaccrued borrow rewards\r\n compAccruedPrior = distributor.compAccrued(holder);\r\n distributor.flywheelPreBorrowerAction(address(cToken), holder);\r\n uint256 borrowRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\r\n\r\n // Return both\r\n return (supplyRewardsUnaccrued, borrowRewardsUnaccrued);\r\n }\r\n\r\n /**\r\n * @notice Returns all unclaimed rewards accrued by the `holder` on `distributors`.\r\n * @param holder The address to check.\r\n * @param distributors The `RewardsDistributor` contracts to check.\r\n * @return For each of `distributors`: total quantity of unclaimed rewards, array of cTokens, array of unaccrued (unclaimed) supply-side and borrow-side rewards per cToken, and quantity of funds available in the distributor.\r\n */\r\n function getUnclaimedRewardsByDistributors(\r\n address holder,\r\n IRewardsDistributor_PLS[] memory distributors\r\n ) external returns (address[] memory, uint256[] memory, ICErc20[][] memory, uint256[2][][] memory, uint256[] memory) {\r\n address[] memory rewardTokens = new address[](distributors.length);\r\n uint256[] memory compUnclaimedTotal = new uint256[](distributors.length);\r\n ICErc20[][] memory allMarkets = new ICErc20[][](distributors.length);\r\n uint256[2][][] memory rewardsUnaccrued = new uint256[2][][](distributors.length);\r\n uint256[] memory distributorFunds = new uint256[](distributors.length);\r\n\r\n for (uint256 i = 0; i < distributors.length; i++) {\r\n IRewardsDistributor_PLS distributor = distributors[i];\r\n rewardTokens[i] = distributor.rewardToken();\r\n allMarkets[i] = distributor.getAllMarkets();\r\n rewardsUnaccrued[i] = new uint256[2][](allMarkets[i].length);\r\n for (uint256 j = 0; j < allMarkets[i].length; j++)\r\n (rewardsUnaccrued[i][j][0], rewardsUnaccrued[i][j][1]) = getUnaccruedRewards(\r\n holder,\r\n distributor,\r\n allMarkets[i][j]\r\n );\r\n compUnclaimedTotal[i] = distributor.compAccrued(holder);\r\n distributorFunds[i] = IERC20Upgradeable(rewardTokens[i]).balanceOf(address(distributor));\r\n }\r\n\r\n return (rewardTokens, compUnclaimedTotal, allMarkets, rewardsUnaccrued, distributorFunds);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of indexes, `Comptroller` proxy contracts, and `RewardsDistributor` contracts for Ionic pools supplied to by `account`.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getRewardsDistributorsBySupplier(\r\n address supplier\r\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\r\n // Get array length\r\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\r\n uint256 arrayLength = 0;\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n try IonicComptroller(pools[i].comptroller).suppliers(supplier) returns (bool isSupplier) {\r\n if (isSupplier) arrayLength++;\r\n } catch {}\r\n }\r\n\r\n // Build array\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n IonicComptroller[] memory comptrollers = new IonicComptroller[](arrayLength);\r\n address[][] memory distributors = new address[][](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n\r\n try comptroller.suppliers(supplier) returns (bool isSupplier) {\r\n if (isSupplier) {\r\n indexes[index] = i;\r\n comptrollers[index] = comptroller;\r\n\r\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\r\n distributors[index] = _distributors;\r\n } catch {}\r\n\r\n index++;\r\n }\r\n } catch {}\r\n }\r\n\r\n // Return distributors\r\n return (indexes, comptrollers, distributors);\r\n }\r\n\r\n /**\r\n * @notice The returned list of flywheels contains address(0) for flywheels for which the user has no rewards to claim\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getFlywheelsToClaim(\r\n address user\r\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\r\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\r\n\r\n IonicComptroller[] memory comptrollers = new IonicComptroller[](pools.length);\r\n address[][] memory distributors = new address[][](pools.length);\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\r\n comptrollers[i] = comptroller;\r\n distributors[i] = flywheelsWithRewardsForPoolUser(user, _distributors);\r\n } catch {}\r\n }\r\n\r\n return (poolIds, comptrollers, distributors);\r\n }\r\n\r\n function flywheelsWithRewardsForPoolUser(\r\n address user,\r\n address[] memory _distributors\r\n ) internal view returns (address[] memory) {\r\n address[] memory distributors = new address[](_distributors.length);\r\n for (uint256 j = 0; j < _distributors.length; j++) {\r\n if (IRewardsDistributor_PLS(_distributors[j]).compAccrued(user) > 0) {\r\n distributors[j] = _distributors[j];\r\n }\r\n }\r\n\r\n return distributors;\r\n }\r\n}\r\n" + }, + "contracts/security/OracleRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.22;\r\n\r\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\r\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\r\n\r\ncontract OracleRegistry is Ownable2Step {\r\n bytes32 private constant HYPERNATIVE_ORACLE_STORAGE_SLOT =\r\n bytes32(uint256(keccak256(\"eip1967.hypernative.oracle\")) - 1);\r\n bytes32 private constant HYPERNATIVE_MODE_STORAGE_SLOT =\r\n bytes32(uint256(keccak256(\"eip1967.hypernative.is_strict_mode\")) - 1);\r\n\r\n event OracleAdminChanged(address indexed previousAdmin, address indexed newAdmin);\r\n event OracleAddressChanged(address indexed previousOracle, address indexed newOracle);\r\n\r\n constructor() Ownable2Step() {}\r\n\r\n function oracleRegister(address _account) public {\r\n address oracleAddress = hypernativeOracle();\r\n bool isStrictMode = hypernativeOracleIsStrictMode();\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n oracle.register(_account, isStrictMode);\r\n }\r\n\r\n function setOracle(address _oracle) public onlyOwner {\r\n _setOracle(_oracle);\r\n }\r\n\r\n function setIsStrictMode(bool _mode) public onlyOwner {\r\n _setIsStrictMode(_mode);\r\n }\r\n\r\n function hypernativeOracleIsStrictMode() public view returns (bool) {\r\n return _getValueBySlot(HYPERNATIVE_MODE_STORAGE_SLOT) == 1;\r\n }\r\n\r\n function hypernativeOracle() public view returns (address) {\r\n return _getAddressBySlot(HYPERNATIVE_ORACLE_STORAGE_SLOT);\r\n }\r\n\r\n /**\r\n * @dev Admin only function, sets new oracle admin. set to address(0) to revoke oracle\r\n */\r\n function _setOracle(address _oracle) internal {\r\n address oldOracle = hypernativeOracle();\r\n _setAddressBySlot(HYPERNATIVE_ORACLE_STORAGE_SLOT, _oracle);\r\n emit OracleAddressChanged(oldOracle, _oracle);\r\n }\r\n\r\n function _setIsStrictMode(bool _mode) internal {\r\n _setValueBySlot(HYPERNATIVE_MODE_STORAGE_SLOT, _mode ? 1 : 0);\r\n }\r\n\r\n function _setAddressBySlot(bytes32 slot, address newAddress) internal {\r\n assembly {\r\n sstore(slot, newAddress)\r\n }\r\n }\r\n\r\n function _setValueBySlot(bytes32 _slot, uint256 _value) internal {\r\n assembly {\r\n sstore(_slot, _value)\r\n }\r\n }\r\n\r\n function _getAddressBySlot(bytes32 slot) internal view returns (address addr) {\r\n assembly {\r\n addr := sload(slot)\r\n }\r\n }\r\n\r\n function _getValueBySlot(bytes32 _slot) internal view returns (uint256 _value) {\r\n assembly {\r\n _value := sload(_slot)\r\n }\r\n }\r\n}\r\n" + }, + "contracts/test/abstracts/AbstractAssetTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\r\n\r\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\r\nimport { AbstractERC4626Test } from \"./AbstractERC4626Test.sol\";\r\nimport { ITestConfigStorage } from \"./ITestConfigStorage.sol\";\r\n\r\ncontract AbstractAssetTest is BaseTest {\r\n AbstractERC4626Test public test;\r\n ITestConfigStorage public testConfigStorage;\r\n\r\n function setUpTestContract(bytes calldata testConfig) public virtual {\r\n // test._setUp(MockERC20(address(IBeefyVault(testConfig.beefyVault).want())).symbol(), testConfig);\r\n }\r\n\r\n function runTest(function() external testFn) public {\r\n if (shouldRunForChain(block.chainid)) {\r\n for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\r\n this.setUpTestContract(testConfigStorage.getTestConfig(i));\r\n testFn();\r\n }\r\n }\r\n }\r\n\r\n function testInitializedValues() public virtual {\r\n // for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\r\n // this.setUpTestContract(testConfigs[i]);\r\n // test.testInitializedValues(asset.name(), asset.symbol());\r\n // }\r\n }\r\n\r\n function testPreviewDepositAndMintReturnTheSameValue() public {\r\n this.runTest(test.testPreviewDepositAndMintReturnTheSameValue);\r\n }\r\n\r\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\r\n this.runTest(test.testPreviewWithdrawAndRedeemReturnTheSameValue);\r\n }\r\n\r\n function testDeposit() public {\r\n this.runTest(test.testDeposit);\r\n }\r\n\r\n function testDepositWithIncreasedVaultValue() public virtual {\r\n this.runTest(test.testDepositWithIncreasedVaultValue);\r\n }\r\n\r\n function testDepositWithDecreasedVaultValue() public virtual {\r\n this.runTest(test.testDepositWithDecreasedVaultValue);\r\n }\r\n\r\n function testMultipleDeposit() public {\r\n this.runTest(test.testMultipleDeposit);\r\n }\r\n\r\n function testMint() public {\r\n this.runTest(test.testMint);\r\n }\r\n\r\n function testMultipleMint() public {\r\n this.runTest(test.testMultipleMint);\r\n }\r\n\r\n function testWithdraw() public {\r\n this.runTest(test.testWithdraw);\r\n }\r\n\r\n function testWithdrawWithIncreasedVaultValue() public virtual {\r\n this.runTest(test.testWithdrawWithIncreasedVaultValue);\r\n }\r\n\r\n function testWithdrawWithDecreasedVaultValue() public virtual {\r\n this.runTest(test.testWithdrawWithDecreasedVaultValue);\r\n }\r\n\r\n function testMultipleWithdraw() public {\r\n this.runTest(test.testMultipleWithdraw);\r\n }\r\n\r\n function testRedeem() public {\r\n this.runTest(test.testRedeem);\r\n }\r\n\r\n function testMultipleRedeem() public {\r\n this.runTest(test.testMultipleRedeem);\r\n }\r\n\r\n function testPauseContract() public {\r\n this.runTest(test.testPauseContract);\r\n }\r\n\r\n function testEmergencyWithdrawAndPause() public {\r\n this.runTest(test.testEmergencyWithdrawAndPause);\r\n }\r\n\r\n function testEmergencyWithdrawAndRedeem() public {\r\n this.runTest(test.testEmergencyWithdrawAndRedeem);\r\n }\r\n}\r\n" + }, + "contracts/test/abstracts/AbstractERC4626Test.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../helpers/WithPool.sol\";\r\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\r\n\r\nimport { IonicERC4626 } from \"../../ionic/strategies/IonicERC4626.sol\";\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { Authority } from \"solmate/auth/Auth.sol\";\r\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\r\n\r\nabstract contract AbstractERC4626Test is WithPool {\r\n using FixedPointMathLib for uint256;\r\n\r\n IonicERC4626 plugin;\r\n\r\n string testPreFix;\r\n\r\n uint256 public depositAmount = 100e18;\r\n uint256 BPS_DENOMINATOR = 10_000;\r\n\r\n uint256 initialStrategyBalance;\r\n uint256 initialStrategySupply;\r\n\r\n constructor() {\r\n _forkAtBlock(uint128(block.chainid), block.number);\r\n }\r\n\r\n function _setUp(string memory _testPreFix, bytes calldata data) public virtual;\r\n\r\n function deposit(address _owner, uint256 amount) public {\r\n vm.startPrank(_owner);\r\n underlyingToken.approve(address(plugin), amount);\r\n plugin.deposit(amount, _owner);\r\n vm.stopPrank();\r\n }\r\n\r\n function sendUnderlyingToken(uint256 amount, address recipient) public {\r\n deal(address(underlyingToken), recipient, amount);\r\n }\r\n\r\n function increaseAssetsInVault() public virtual {}\r\n\r\n function decreaseAssetsInVault() public virtual {}\r\n\r\n function getDepositShares() public view virtual returns (uint256);\r\n\r\n function getStrategyBalance() public view virtual returns (uint256);\r\n\r\n function getExpectedDepositShares() public view virtual returns (uint256);\r\n\r\n function testInitializedValues(string memory assetName, string memory assetSymbol) public virtual {\r\n assertEq(\r\n plugin.name(),\r\n string(abi.encodePacked(\"Midas \", assetName, \" Vault\")),\r\n string(abi.encodePacked(\"!name \", testPreFix))\r\n );\r\n assertEq(\r\n plugin.symbol(),\r\n string(abi.encodePacked(\"mv\", assetSymbol)),\r\n string(abi.encodePacked(\"!symbol \", testPreFix))\r\n );\r\n assertEq(address(plugin.asset()), address(underlyingToken), string(abi.encodePacked(\"!asset \", testPreFix)));\r\n // assertEq(\r\n // address(BeefyERC4626(address(plugin)).beefyVault()),\r\n // address(beefyVault),\r\n // string(abi.encodePacked(\"!beefyVault \", testPreFix))\r\n // );\r\n }\r\n\r\n function testPreviewDepositAndMintReturnTheSameValue() public {\r\n uint256 returnedShares = plugin.previewDeposit(depositAmount);\r\n assertApproxEqAbs(\r\n plugin.previewMint(returnedShares),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!previewMint \", testPreFix))\r\n );\r\n }\r\n\r\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\r\n deposit(address(this), depositAmount);\r\n uint256 withdrawalAmount = 10e18;\r\n uint256 reqShares = plugin.previewWithdraw(withdrawalAmount);\r\n assertApproxEqAbs(\r\n plugin.previewRedeem(reqShares),\r\n withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!previewRedeem \", testPreFix))\r\n );\r\n }\r\n\r\n function testDeposit() public virtual {\r\n uint256 expectedDepositShare = this.getExpectedDepositShares();\r\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n this.getStrategyBalance(),\r\n initialStrategyBalance + depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!transfer \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n assertApproxEqAbs(\r\n plugin.totalAssets(),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.convertToAssets(plugin.balanceOf(address(this))),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\r\n );\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n expectedErc4626Shares,\r\n uint256(10),\r\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n expectedErc4626Shares,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n expectedDepositShare,\r\n uint256(10),\r\n string(abi.encodePacked(\"!depositShares \", testPreFix))\r\n );\r\n }\r\n\r\n function testDepositWithIncreasedVaultValue() public {\r\n // lpDepositor just mints the exact amount of depositShares as the user deposits in assets\r\n uint256 oldExpectedDepositShare = this.getExpectedDepositShares();\r\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n // Increase the share price\r\n increaseAssetsInVault();\r\n\r\n uint256 expectedDepositShare = this.getExpectedDepositShares();\r\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\r\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\r\n\r\n sendUnderlyingToken(depositAmount, address(this));\r\n deposit(address(this), depositAmount);\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n oldExpected4626Shares + previewErc4626Shares,\r\n uint256(10),\r\n string(abi.encodePacked(\"!previewShares == oldExpectedShares \", testPreFix))\r\n );\r\n\r\n // Test that we got less shares on the second mint after assets in the vault increased\r\n assertLe(\r\n previewErc4626Shares,\r\n oldExpected4626Shares,\r\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n previewErc4626Shares,\r\n expected4626Shares,\r\n uint256(10),\r\n string(abi.encodePacked(\"!previewShares == expectedShares \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n oldExpectedDepositShare + expectedDepositShare,\r\n uint256(10),\r\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\r\n );\r\n }\r\n\r\n function testDepositWithDecreasedVaultValue() public {\r\n // THIS TEST WILL ALWAYS FAIL\r\n // A transfer out of the lpStaker will always fail.\r\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\r\n /* =============== ACTUAL TEST =============== */\r\n /*\r\n uint256 oldExpecteDepositShares = depositAmount;\r\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\r\n deposit(address(this), depositAmount);\r\n // Decrease the share price\r\n decreaseAssetsInVault();\r\n uint256 expectedDepositShare = depositAmount;\r\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\r\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\r\n sendUnderlyingToken(depositAmount, address(this));\r\n deposit(address(this), depositAmount);\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(plugin.balanceOf(address(this)), oldExpected4626Shares + previewErc4626Shares);\r\n // Test that we got less shares on the second mint after assets in the vault increased\r\n assertGt(previewErc4626Shares, oldExpected4626Shares, \"!new shares > old Shares\");\r\n assertApproxEqAbs(previewErc4626Shares, expected4626Shares, \"!previewShares == expectedShares\");\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(this.getDepositShares(), oldExpecteDepositShares + expectedDepositShare);\r\n */\r\n }\r\n\r\n function testMultipleDeposit() public {\r\n uint256 expectedDepositShare = this.getExpectedDepositShares();\r\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n sendUnderlyingToken(depositAmount, address(1));\r\n deposit(address(1), depositAmount);\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n this.getStrategyBalance(),\r\n initialStrategyBalance + depositAmount * 2,\r\n uint256(10),\r\n string(abi.encodePacked(\"!transfer \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n assertApproxEqAbs(\r\n depositAmount * 2,\r\n plugin.totalAssets(),\r\n uint256(10),\r\n string(abi.encodePacked(\"Total Assets should be same as sum of deposited amounts \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n depositAmount,\r\n plugin.convertToAssets(plugin.balanceOf(address(this))),\r\n uint256(10),\r\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n depositAmount,\r\n plugin.convertToAssets(plugin.balanceOf(address(1))),\r\n uint256(10),\r\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\r\n );\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n expectedErc4626Shares,\r\n uint256(10),\r\n string(abi.encodePacked(\"!expectedShares address(this) \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(1)),\r\n expectedErc4626Shares,\r\n uint256(10),\r\n string(abi.encodePacked(\"!expectedShares address(1) \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n expectedErc4626Shares * 2,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n expectedDepositShare * 2,\r\n uint256(10),\r\n string(abi.encodePacked(\"!depositShare \", testPreFix))\r\n );\r\n\r\n // DotDot ERC4626 should not have underlyingToken after deposit\r\n assertTrue(\r\n underlyingToken.balanceOf(address(plugin)) <= 1,\r\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n }\r\n\r\n function testMint() public {\r\n uint256 expectedDepositShare = this.getExpectedDepositShares();\r\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\r\n\r\n underlyingToken.approve(address(plugin), depositAmount);\r\n plugin.mint(mintAmount, address(this));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n this.getStrategyBalance(),\r\n initialStrategyBalance + depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!transfer \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n assertApproxEqAbs(\r\n plugin.totalAssets(),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.convertToAssets(plugin.balanceOf(address(this))),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\r\n );\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n mintAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!mint \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n mintAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n expectedDepositShare,\r\n uint256(10),\r\n string(abi.encodePacked(\"!depositShare \", testPreFix))\r\n );\r\n }\r\n\r\n function testMultipleMint() public {\r\n uint256 expectedDepositShare = this.getExpectedDepositShares();\r\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\r\n\r\n underlyingToken.approve(address(plugin), depositAmount);\r\n plugin.mint(mintAmount, address(this));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n this.getStrategyBalance(),\r\n initialStrategyBalance + depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!transfer \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n assertApproxEqAbs(\r\n plugin.totalAssets(),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.convertToAssets(plugin.balanceOf(address(this))),\r\n depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\r\n );\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n mintAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!mint \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n mintAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n expectedDepositShare,\r\n uint256(10),\r\n string(abi.encodePacked(\"!depositShare \", testPreFix))\r\n );\r\n\r\n assertTrue(\r\n underlyingToken.balanceOf(address(plugin)) <= 1,\r\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n\r\n vm.startPrank(address(1));\r\n underlyingToken.approve(address(plugin), depositAmount);\r\n sendUnderlyingToken(depositAmount, address(1));\r\n plugin.mint(mintAmount, address(1));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n this.getStrategyBalance(),\r\n initialStrategyBalance + depositAmount + depositAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.transfer \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n assertApproxEqAbs(\r\n depositAmount + depositAmount,\r\n plugin.totalAssets(),\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.totalAssets \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n depositAmount,\r\n plugin.convertToAssets(plugin.balanceOf(address(1))),\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.balOfUnderlying \", testPreFix))\r\n );\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(1)),\r\n mintAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.mint \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n mintAmount + mintAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n expectedDepositShare * 2,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.depositShare \", testPreFix))\r\n );\r\n\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(plugin)),\r\n 2,\r\n uint256(2),\r\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n vm.stopPrank();\r\n }\r\n\r\n function testWithdraw() public virtual {\r\n uint256 depositShares = this.getExpectedDepositShares();\r\n\r\n uint256 withdrawalAmount = 10e18;\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\r\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\r\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\r\n this.getDepositShares(),\r\n plugin.totalSupply()\r\n );\r\n\r\n plugin.withdraw(withdrawalAmount, address(this), address(this));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n assetBalBefore + withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\r\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\r\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n depositAmount - expectedErc4626SharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that we burned the right amount of shares\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n erc4626BalBefore - expectedErc4626SharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\r\n );\r\n assertTrue(underlyingToken.balanceOf(address(plugin)) <= 1, string(abi.encodePacked(\"!0 \", testPreFix)));\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShares - ExpectedDepositSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\r\n );\r\n }\r\n\r\n function testWithdrawWithIncreasedVaultValue() public virtual {\r\n uint256 depositShareBal = this.getExpectedDepositShares();\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n uint256 withdrawalAmount = 10e18;\r\n\r\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\r\n this.getDepositShares(),\r\n plugin.totalSupply()\r\n );\r\n\r\n plugin.withdraw(withdrawalAmount, address(this), address(this));\r\n\r\n // Increase the share price\r\n increaseAssetsInVault();\r\n\r\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\r\n this.getDepositShares(),\r\n plugin.totalSupply()\r\n );\r\n\r\n plugin.withdraw(withdrawalAmount, address(this), address(this));\r\n\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded),\r\n uint256(10),\r\n string(abi.encodePacked(\"!mint \", testPreFix))\r\n );\r\n\r\n // Test that we got less shares on the second mint after assets in the vault increased\r\n assertLe(\r\n expectedErc4626SharesNeeded,\r\n oldExpectedErc4626SharesNeeded,\r\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShareBal - (oldExpectedDepositSharesNeeded + ExpectedDepositSharesNeeded),\r\n uint256(10),\r\n string(abi.encodePacked(\"!depositShare \", testPreFix))\r\n );\r\n }\r\n\r\n function testWithdrawWithDecreasedVaultValue() public {\r\n // THIS TEST WILL ALWAYS FAIL\r\n // A transfer out of the lpStaker will always fail.\r\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\r\n /* =============== ACTUAL TEST =============== */\r\n /*\r\n sendUnderlyingToken(depositAmount, address(this));\r\n uint256 depositShares = this.getExpectedDepositShares();\r\n deposit(address(this), depositAmount);\r\n uint256 withdrawalAmount = 10e18;\r\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\r\n this.getDepositShares(),\r\n plugin.totalSupply()\r\n );\r\n plugin.withdraw(withdrawalAmount, address(this), address(this));\r\n // Increase the share price\r\n decreaseAssetsInVault();\r\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\r\n this.getDepositShares(),\r\n plugin.totalSupply()\r\n );\r\n plugin.withdraw(withdrawalAmount, address(this), address(this));\r\n // Test that we minted the correct amount of token\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded)\r\n );\r\n // Test that we got less shares on the second mint after assets in the vault increased\r\n assertLe(expectedErc4626SharesNeeded, oldExpectedErc4626SharesNeeded, \"!new shares < old Shares\");\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShareBal - (oldExpectedDepositSharesNeeded + expectedDepositSharesNeeded)\r\n );\r\n */\r\n }\r\n\r\n function testMultipleWithdraw() public virtual {\r\n uint256 depositShares = this.getExpectedDepositShares() * 2;\r\n\r\n uint256 withdrawalAmount = 10e18;\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n sendUnderlyingToken(depositAmount, address(1));\r\n deposit(address(1), depositAmount);\r\n\r\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\r\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\r\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\r\n this.getDepositShares(),\r\n plugin.totalSupply()\r\n );\r\n\r\n plugin.withdraw(10e18, address(this), address(this));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n assetBalBefore + withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.user asset bal\", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\r\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\r\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\r\n assertApproxEqAbs(\r\n depositAmount * 2 - expectedErc4626SharesNeeded,\r\n plugin.totalSupply(),\r\n 10,\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that we burned the right amount of shares\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n erc4626BalBefore - expectedErc4626SharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShares - ExpectedDepositSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\r\n );\r\n\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(plugin)),\r\n 1,\r\n 1,\r\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n\r\n uint256 totalSupplyBefore = depositAmount * 2 - expectedErc4626SharesNeeded;\r\n depositShares = depositShares - ExpectedDepositSharesNeeded;\r\n assetBalBefore = underlyingToken.balanceOf(address(1));\r\n erc4626BalBefore = plugin.balanceOf(address(1));\r\n expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\r\n ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(this.getDepositShares(), plugin.totalSupply());\r\n\r\n vm.prank(address(1));\r\n plugin.withdraw(10e18, address(1), address(1));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(1)),\r\n assetBalBefore + withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\r\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\r\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n totalSupplyBefore - expectedErc4626SharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that we burned the right amount of shares\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(1)),\r\n erc4626BalBefore - expectedErc4626SharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShares - ExpectedDepositSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\r\n );\r\n\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(plugin)),\r\n 2,\r\n 2,\r\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n }\r\n\r\n function testRedeem() public virtual {\r\n uint256 depositShares = this.getExpectedDepositShares();\r\n\r\n uint256 withdrawalAmount = 10e18;\r\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\r\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\r\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\r\n\r\n plugin.withdraw(10e18, address(this), address(this));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n assetBalBefore + withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\r\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\r\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n depositAmount - redeemAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that we burned the right amount of shares\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n erc4626BalBefore - redeemAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShares - ExpectedDepositSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\r\n );\r\n }\r\n\r\n function testMultipleRedeem() public virtual {\r\n uint256 depositShares = this.getExpectedDepositShares() * 2;\r\n\r\n uint256 withdrawalAmount = 10e18;\r\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n sendUnderlyingToken(depositAmount, address(1));\r\n deposit(address(1), depositAmount);\r\n\r\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\r\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\r\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\r\n\r\n plugin.withdraw(10e18, address(this), address(this));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n assetBalBefore + withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.user asset bal \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\r\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\r\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n depositAmount * 2 - redeemAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that we burned the right amount of shares\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n erc4626BalBefore - redeemAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShares - ExpectedDepositSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\r\n );\r\n assertTrue(\r\n underlyingToken.balanceOf(address(plugin)) <= 1,\r\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n\r\n uint256 totalSupplyBefore = depositAmount * 2 - redeemAmount;\r\n depositShares -= ExpectedDepositSharesNeeded;\r\n redeemAmount = plugin.previewWithdraw(withdrawalAmount);\r\n assetBalBefore = underlyingToken.balanceOf(address(1));\r\n erc4626BalBefore = plugin.balanceOf(address(1));\r\n ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\r\n vm.prank(address(1));\r\n plugin.withdraw(10e18, address(1), address(1));\r\n\r\n // Test that the actual transfers worked\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(1)),\r\n assetBalBefore + withdrawalAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\r\n );\r\n\r\n // Test that the balance view calls work\r\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\r\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\r\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\r\n assertApproxEqAbs(\r\n plugin.totalSupply(),\r\n totalSupplyBefore - redeemAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\r\n );\r\n\r\n // Test that we burned the right amount of shares\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(1)),\r\n erc4626BalBefore - redeemAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\r\n );\r\n\r\n // Test that the ERC4626 holds the expected amount of dotDot shares\r\n assertApproxEqAbs(\r\n this.getDepositShares(),\r\n depositShares - ExpectedDepositSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\r\n );\r\n assertTrue(\r\n underlyingToken.balanceOf(address(plugin)) <= 2,\r\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\r\n );\r\n }\r\n\r\n function testPauseContract() public {\r\n uint256 withdrawAmount = 1e18;\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n vm.warp(block.timestamp + 10);\r\n\r\n plugin.emergencyWithdrawAndPause();\r\n\r\n underlyingToken.approve(address(plugin), depositAmount);\r\n vm.expectRevert(\"Pausable: paused\");\r\n plugin.deposit(depositAmount, address(this));\r\n\r\n vm.expectRevert(\"Pausable: paused\");\r\n plugin.mint(depositAmount, address(this));\r\n\r\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\r\n plugin.withdraw(withdrawAmount, address(this), address(this));\r\n\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n depositAmount - expectedSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n withdrawAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\r\n );\r\n\r\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\r\n plugin.redeem(withdrawAmount, address(this), address(this));\r\n\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n depositAmount - withdrawAmount - expectedSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n withdrawAmount + expectedAssets,\r\n uint256(10),\r\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\r\n );\r\n }\r\n\r\n function testEmergencyWithdrawAndPause() public virtual {\r\n deposit(address(this), depositAmount);\r\n\r\n uint256 expectedBal = plugin.previewRedeem(depositAmount);\r\n assertEq(underlyingToken.balanceOf(address(plugin)), 0, string(abi.encodePacked(\"!init 0 \", testPreFix)));\r\n\r\n plugin.emergencyWithdrawAndPause();\r\n\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(plugin)),\r\n expectedBal,\r\n uint256(10),\r\n string(abi.encodePacked(\"!withdraws underlying \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n plugin.totalAssets(),\r\n expectedBal,\r\n uint256(10),\r\n string(abi.encodePacked(\"!totalAssets == expectedBal \", testPreFix))\r\n );\r\n }\r\n\r\n function testEmergencyWithdrawAndRedeem() public {\r\n uint256 withdrawAmount = 1e18;\r\n\r\n deposit(address(this), depositAmount);\r\n\r\n vm.warp(block.timestamp + 10);\r\n\r\n plugin.emergencyWithdrawAndPause();\r\n\r\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\r\n plugin.withdraw(withdrawAmount, address(this), address(this));\r\n\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n depositAmount - expectedSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n withdrawAmount,\r\n uint256(10),\r\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\r\n );\r\n\r\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\r\n plugin.redeem(withdrawAmount, address(this), address(this));\r\n\r\n assertApproxEqAbs(\r\n plugin.balanceOf(address(this)),\r\n depositAmount - withdrawAmount - expectedSharesNeeded,\r\n uint256(10),\r\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\r\n );\r\n assertApproxEqAbs(\r\n underlyingToken.balanceOf(address(this)),\r\n withdrawAmount + expectedAssets,\r\n uint256(10),\r\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\r\n );\r\n }\r\n}\r\n" + }, + "contracts/test/abstracts/ITestConfigStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\ninterface ITestConfigStorage {\r\n function getTestConfig(uint256 i) external view returns (bytes memory);\r\n\r\n function getTestConfigLength() external view returns (uint256);\r\n}\r\n" + }, + "contracts/test/config/BaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"forge-std/Vm.sol\";\r\nimport \"forge-std/Test.sol\";\r\nimport \"forge-std/console.sol\";\r\n\r\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\r\n\r\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\r\n\r\nabstract contract BaseTest is Test {\r\n uint128 constant ETHEREUM_MAINNET = 1;\r\n uint128 constant BSC_MAINNET = 56;\r\n uint128 constant POLYGON_MAINNET = 137;\r\n uint128 constant ARBITRUM_ONE = 42161;\r\n\r\n uint128 constant BSC_CHAPEL = 97;\r\n uint128 constant NEON_MAINNET = 245022934;\r\n uint128 constant LINEA_MAINNET = 59144;\r\n uint128 constant ZKEVM_MAINNET = 1101;\r\n uint128 constant MODE_MAINNET = 34443;\r\n uint128 constant BASE_MAINNET = 8453;\r\n\r\n // taken from ERC1967Upgrade\r\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r\n\r\n AddressesProvider public ap;\r\n ProxyAdmin public dpa;\r\n\r\n mapping(uint128 => uint256) private forkIds;\r\n\r\n constructor() {\r\n configureAddressesProvider(0);\r\n }\r\n\r\n uint256 constant CRITICAL = 100;\r\n uint256 constant NORMAL = 90;\r\n uint256 constant LOW = 80;\r\n\r\n modifier importance(uint256 testImportance) {\r\n uint256 runLevel = NORMAL;\r\n\r\n try vm.envUint(\"TEST_RUN_LEVEL\") returns (uint256 level) {\r\n runLevel = level;\r\n } catch {\r\n emit log(\"failed to get env param TEST_RUN_LEVEL\");\r\n }\r\n\r\n if (testImportance >= runLevel) {\r\n _;\r\n } else {\r\n emit log(\"not running the test\");\r\n }\r\n }\r\n\r\n modifier debuggingOnly() {\r\n try vm.envBool(\"LOCAL_FORGE_ENV\") returns (bool run) {\r\n if (run) _;\r\n } catch {\r\n emit log(\"skipping this test in the CI/CD - add LOCAL_FORGE_ENV=true to your .env file to run locally\");\r\n }\r\n }\r\n\r\n modifier fork(uint128 chainid) {\r\n if (shouldRunForChain(chainid)) {\r\n _forkAtBlock(chainid, 0);\r\n _;\r\n }\r\n }\r\n\r\n modifier forkAtBlock(uint128 chainid, uint256 blockNumber) {\r\n if (shouldRunForChain(chainid)) {\r\n _forkAtBlock(chainid, blockNumber);\r\n _;\r\n }\r\n }\r\n\r\n modifier whenForking() {\r\n try vm.activeFork() returns (uint256) {\r\n _;\r\n } catch {}\r\n }\r\n\r\n function shouldRunForChain(uint256 chainid) internal returns (bool) {\r\n bool run = true;\r\n try vm.envUint(\"TEST_RUN_CHAINID\") returns (uint256 envChainId) {\r\n run = envChainId == chainid;\r\n } catch {\r\n emit log(\"failed to get env param TEST_RUN_CHAINID\");\r\n }\r\n return run;\r\n }\r\n\r\n function _forkAtBlock(uint128 chainid, uint256 blockNumber) internal {\r\n if (block.chainid != chainid) {\r\n if (blockNumber != 0) {\r\n vm.selectFork(getArchiveForkId(chainid));\r\n vm.rollFork(blockNumber);\r\n } else {\r\n vm.selectFork(getForkId(chainid));\r\n }\r\n }\r\n configureAddressesProvider(chainid);\r\n afterForkSetUp();\r\n }\r\n\r\n function getForkId(uint128 chainid, bool archive) private returns (uint256) {\r\n return archive ? getForkId(chainid) : getArchiveForkId(chainid);\r\n }\r\n\r\n function getForkId(uint128 chainid) private returns (uint256) {\r\n if (forkIds[chainid] == 0) {\r\n if (chainid == BSC_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc\")) + 100;\r\n } else if (chainid == BSC_CHAPEL) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc_chapel\")) + 100;\r\n } else if (chainid == POLYGON_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"polygon\")) + 100;\r\n } else if (chainid == NEON_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"neon\")) + 100;\r\n } else if (chainid == ARBITRUM_ONE) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"arbitrum\")) + 100;\r\n } else if (chainid == ETHEREUM_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"ethereum\")) + 100;\r\n } else if (chainid == LINEA_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"linea\")) + 100;\r\n } else if (chainid == ZKEVM_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"zkevm\")) + 100;\r\n } else if (chainid == MODE_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"mode\")) + 100;\r\n } else if (chainid == BASE_MAINNET) {\r\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"base\")) + 100;\r\n }\r\n }\r\n\r\n return forkIds[chainid] - 100;\r\n }\r\n\r\n function getArchiveForkId(uint128 chainid) private returns (uint256) {\r\n // store the archive rpc urls in the forkIds mapping at an offset\r\n uint128 chainidWithOffset = chainid + type(uint64).max;\r\n if (forkIds[chainidWithOffset] == 0) {\r\n if (chainid == BSC_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_archive\")) + 100;\r\n } else if (chainid == BSC_CHAPEL) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_chapel_archive\")) + 100;\r\n } else if (chainid == POLYGON_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"polygon_archive\")) + 100;\r\n } else if (chainid == NEON_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"neon_archive\")) + 100;\r\n } else if (chainid == ARBITRUM_ONE) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"arbitrum_archive\")) + 100;\r\n } else if (chainid == ETHEREUM_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"ethereum_archive\")) + 100;\r\n } else if (chainid == LINEA_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"linea_archive\")) + 100;\r\n } else if (chainid == ZKEVM_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"zkevm_archive\")) + 100;\r\n } else if (chainid == MODE_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"mode_archive\")) + 100;\r\n } else if (chainid == BASE_MAINNET) {\r\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"base_archive\")) + 100;\r\n }\r\n }\r\n return forkIds[chainidWithOffset] - 100;\r\n }\r\n\r\n function afterForkSetUp() internal virtual {}\r\n\r\n function configureAddressesProvider(uint128 chainid) private {\r\n if (chainid == BSC_MAINNET) {\r\n ap = AddressesProvider(address(0));\r\n } else if (chainid == BSC_CHAPEL) {\r\n ap = AddressesProvider(0x3dc8CE9f581e49B9E5304CF580940ad341F64c3f);\r\n } else if (block.chainid == POLYGON_MAINNET) {\r\n ap = AddressesProvider(0xE31baC0B582AA248c0017F87F24087cEa7A55E26);\r\n } else if (chainid == NEON_MAINNET) {\r\n ap = AddressesProvider(0xF4C60F6ac6b3AF54044757a1a54D76EEe28244CE);\r\n } else if (chainid == ARBITRUM_ONE) {\r\n ap = AddressesProvider(0x3B12BA992259Fb3855C4E1D452a754dCa2E276fC);\r\n } else if (chainid == LINEA_MAINNET) {\r\n ap = AddressesProvider(0x914694DA0bED80e74ef1a28029f016119782C0f1);\r\n } else if (chainid == ZKEVM_MAINNET) {\r\n ap = AddressesProvider(0x27aA55A3D55959261e119d75256aadAB79aE897C);\r\n } else if (chainid == MODE_MAINNET) {\r\n ap = AddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\r\n } else if (chainid == BASE_MAINNET) {\r\n ap = AddressesProvider(0xcD4D7c8e2bA627684a9B18F7fe88239341D3ba5c);\r\n } else {\r\n dpa = new ProxyAdmin();\r\n AddressesProvider logic = new AddressesProvider();\r\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\r\n address(logic),\r\n address(dpa),\r\n abi.encodeWithSelector(ap.initialize.selector, address(this))\r\n );\r\n ap = AddressesProvider(address(proxy));\r\n ap.setAddress(\"DefaultProxyAdmin\", address(dpa));\r\n }\r\n dpa = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\r\n if (ap.owner() == address(0)) {\r\n ap.initialize(address(this));\r\n }\r\n if (ap.getAddress(\"deployer\") == address(0)) {\r\n vm.prank(ap.owner());\r\n ap.setAddress(\"deployer\", 0x1155b614971f16758C92c4890eD338C9e3ede6b7);\r\n }\r\n }\r\n\r\n function diff(uint256 a, uint256 b) internal pure returns (uint256) {\r\n if (a > b) {\r\n return a - b;\r\n } else {\r\n return b - a;\r\n }\r\n }\r\n\r\n function compareStrings(string memory a, string memory b) public pure returns (bool) {\r\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\r\n }\r\n\r\n function asArray(address value) public pure returns (address[] memory) {\r\n address[] memory array = new address[](1);\r\n array[0] = value;\r\n return array;\r\n }\r\n\r\n function asArray(address value0, address value1) public pure returns (address[] memory) {\r\n address[] memory array = new address[](2);\r\n array[0] = value0;\r\n array[1] = value1;\r\n return array;\r\n }\r\n\r\n function asArray(\r\n address value0,\r\n address value1,\r\n address value2\r\n ) public pure returns (address[] memory) {\r\n address[] memory array = new address[](3);\r\n array[0] = value0;\r\n array[1] = value1;\r\n array[2] = value2;\r\n return array;\r\n }\r\n\r\n function asArray(bool value) public pure returns (bool[] memory) {\r\n bool[] memory array = new bool[](1);\r\n array[0] = value;\r\n return array;\r\n }\r\n\r\n function asArray(uint256 value0, uint256 value1) public pure returns (uint256[] memory) {\r\n uint256[] memory array = new uint256[](2);\r\n array[0] = value0;\r\n array[1] = value1;\r\n return array;\r\n }\r\n\r\n function asArray(uint256 value) public pure returns (uint256[] memory) {\r\n uint256[] memory array = new uint256[](1);\r\n array[0] = value;\r\n return array;\r\n }\r\n\r\n function asArray(bytes memory value) public pure returns (bytes[] memory) {\r\n bytes[] memory array = new bytes[](1);\r\n array[0] = value;\r\n return array;\r\n }\r\n\r\n function asArray(bytes memory value0, bytes memory value1) public pure returns (bytes[] memory) {\r\n bytes[] memory array = new bytes[](2);\r\n array[0] = value0;\r\n array[1] = value1;\r\n return array;\r\n }\r\n\r\n function asArray(\r\n bytes memory value0,\r\n bytes memory value1,\r\n bytes memory value2\r\n ) public pure returns (bytes[] memory) {\r\n bytes[] memory array = new bytes[](3);\r\n array[0] = value0;\r\n array[1] = value1;\r\n array[2] = value2;\r\n return array;\r\n }\r\n\r\n function sqrt(uint256 x) public pure returns (uint256) {\r\n if (x == 0) return 0;\r\n uint256 xx = x;\r\n uint256 r = 1;\r\n\r\n if (xx >= 0x100000000000000000000000000000000) {\r\n xx >>= 128;\r\n r <<= 64;\r\n }\r\n if (xx >= 0x10000000000000000) {\r\n xx >>= 64;\r\n r <<= 32;\r\n }\r\n if (xx >= 0x100000000) {\r\n xx >>= 32;\r\n r <<= 16;\r\n }\r\n if (xx >= 0x10000) {\r\n xx >>= 16;\r\n r <<= 8;\r\n }\r\n if (xx >= 0x100) {\r\n xx >>= 8;\r\n r <<= 4;\r\n }\r\n if (xx >= 0x10) {\r\n xx >>= 4;\r\n r <<= 2;\r\n }\r\n if (xx >= 0x8) {\r\n r <<= 1;\r\n }\r\n\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1;\r\n r = (r + x / r) >> 1; // Seven iterations should be enough\r\n uint256 r1 = x / r;\r\n return (r < r1 ? r : r1);\r\n }\r\n}\r\n" + }, + "contracts/test/config/MarketsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { BaseTest } from \"./BaseTest.t.sol\";\r\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\r\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\r\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\r\nimport { CErc20RewardsDelegate } from \"../../compound/CErc20RewardsDelegate.sol\";\r\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\r\nimport { DiamondExtension } from \"../../ionic/DiamondExtension.sol\";\r\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\r\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\r\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\r\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\r\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\n\r\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\ncontract MarketsTest is BaseTest {\r\n FeeDistributor internal ffd;\r\n\r\n CErc20Delegate internal cErc20Delegate;\r\n CErc20PluginDelegate internal cErc20PluginDelegate;\r\n CErc20RewardsDelegate internal cErc20RewardsDelegate;\r\n CErc20PluginRewardsDelegate internal cErc20PluginRewardsDelegate;\r\n CTokenFirstExtension internal newCTokenExtension;\r\n\r\n address payable internal latestComptrollerImplementation;\r\n ComptrollerFirstExtension internal comptrollerExtension;\r\n\r\n function afterForkSetUp() internal virtual override {\r\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\r\n upgradeFfd();\r\n cErc20Delegate = new CErc20Delegate();\r\n cErc20PluginDelegate = new CErc20PluginDelegate();\r\n cErc20RewardsDelegate = new CErc20RewardsDelegate();\r\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\r\n newCTokenExtension = new CTokenFirstExtension();\r\n\r\n comptrollerExtension = new ComptrollerFirstExtension();\r\n Comptroller newComptrollerImplementation = new Comptroller();\r\n latestComptrollerImplementation = payable(address(newComptrollerImplementation));\r\n }\r\n\r\n function upgradeFfd() internal {\r\n {\r\n FeeDistributor newImpl = new FeeDistributor();\r\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffd)));\r\n bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\r\n address admin = address(uint160(uint256(bytesAtSlot)));\r\n vm.prank(admin);\r\n proxy.upgradeTo(address(newImpl));\r\n }\r\n\r\n if (address(ffd.authoritiesRegistry()) == address(0)) {\r\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\r\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\r\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\r\n newAr.initialize(address(321));\r\n vm.prank(ffd.owner());\r\n ffd.reinitialize(newAr);\r\n }\r\n }\r\n\r\n function _prepareCTokenUpgrade(ICErc20 market) internal returns (address) {\r\n address implBefore = market.implementation();\r\n //emit log(\"implementation before\");\r\n //emit log_address(implBefore);\r\n\r\n CErc20Delegate newImpl;\r\n if (market.delegateType() == 1) {\r\n newImpl = cErc20Delegate;\r\n } else if (market.delegateType() == 2) {\r\n newImpl = cErc20PluginDelegate;\r\n } else if (market.delegateType() == 3) {\r\n newImpl = cErc20RewardsDelegate;\r\n } else {\r\n newImpl = cErc20PluginRewardsDelegate;\r\n }\r\n\r\n // set the new ctoken delegate as the latest\r\n uint8 delegateType = market.delegateType();\r\n vm.prank(ffd.owner());\r\n ffd._setLatestCErc20Delegate(delegateType, address(newImpl), abi.encode(address(0)));\r\n\r\n // add the extension to the auto upgrade config\r\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\r\n cErc20DelegateExtensions[0] = DiamondExtension(newImpl);\r\n cErc20DelegateExtensions[1] = newCTokenExtension;\r\n vm.prank(ffd.owner());\r\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\r\n\r\n return address(newImpl);\r\n }\r\n\r\n function _upgradeMarket(ICErc20 market) internal {\r\n address newDelegate = _prepareCTokenUpgrade(market);\r\n\r\n bytes memory becomeImplData = (address(newDelegate) == address(cErc20Delegate))\r\n ? bytes(\"\")\r\n : abi.encode(address(0));\r\n vm.prank(market.ionicAdmin());\r\n market._setImplementationSafe(newDelegate, becomeImplData);\r\n }\r\n\r\n function _prepareComptrollerUpgrade(address oldCompImpl) internal {\r\n vm.startPrank(ffd.owner());\r\n ffd._setLatestComptrollerImplementation(oldCompImpl, latestComptrollerImplementation);\r\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\r\n extensions[0] = comptrollerExtension;\r\n extensions[1] = Comptroller(latestComptrollerImplementation);\r\n ffd._setComptrollerExtensions(latestComptrollerImplementation, extensions);\r\n vm.stopPrank();\r\n }\r\n\r\n function _upgradeExistingPool(address poolAddress) internal {\r\n Unitroller asUnitroller = Unitroller(payable(poolAddress));\r\n // change the implementation to the new that can add extensions\r\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\r\n\r\n _prepareComptrollerUpgrade(oldComptrollerImplementation);\r\n\r\n // upgrade to the new comptroller\r\n vm.startPrank(asUnitroller.admin());\r\n asUnitroller._upgrade();\r\n vm.stopPrank();\r\n }\r\n}\r\n" + }, + "contracts/test/EmissionsManager/mocks/MockICErc20.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ncontract MockICErc20 {\r\n mapping(address => uint256) public balances;\r\n\r\n\r\n function setBalanceOfUnderlying(address _user, uint256 _balance) public {\r\n balances[_user] = _balance;\r\n }\r\n function balanceOfUnderlying(address _user) public view returns (uint256) {\r\n return balances[_user];\r\n }\r\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicComptroller.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\r\nimport { IonicFlywheelCore } from \"../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\r\n\r\ncontract MockIonicComptroller {\r\n address public oracle;\r\n address public asset;\r\n address public flywheel;\r\n\r\n // Allows setting mock eth values for testing purposes\r\n function setOracle(address _oracle) external {\r\n oracle = _oracle;\r\n }\r\n\r\n function setAssetsIn(address _asset) external {\r\n asset = _asset;\r\n }\r\n\r\n function setFlywheel(address _flywheel) external {\r\n flywheel = _flywheel;\r\n }\r\n function getAssetsIn(address _user) public view returns (ICErc20[] memory) {\r\n ICErc20[] memory assets = new ICErc20[](1); \r\n assets[0] = ICErc20(asset); \r\n return assets;\r\n }\r\n\r\n function getAllMarkets() public view returns (ICErc20[] memory) {\r\n ICErc20[] memory assets = new ICErc20[](1); \r\n assets[0] = ICErc20(asset); \r\n return assets;\r\n }\r\n\r\n function getAccruingFlywheels() public view returns (IonicFlywheelCore[] memory) {\r\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](1); \r\n flywheels[0] = IonicFlywheelCore(flywheel); \r\n return flywheels;\r\n }\r\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\n\r\ncontract MockIonicFlywheelCore {\r\n using SafeTransferLib for ERC20;\r\n\r\n address public rewardToken;\r\n address public flywheelRewards;\r\n function setRewardToken(address _rewardToken) public {\r\n rewardToken = _rewardToken;\r\n }\r\n\r\n function setFlywheelRewards(address _flywheelRewards) public {\r\n flywheelRewards = _flywheelRewards;\r\n }\r\n\r\n function updateBlacklistBalances(ERC20 _market, address _user) external {}\r\n\r\n function accrue(ERC20 _market, address _user) public returns (uint256) {\r\n return 0;\r\n }\r\n\r\n function takeRewardsFromUser(address _user, address _receiver) external { \r\n uint256 balance = ERC20(rewardToken).balanceOf(address(flywheelRewards));\r\n ERC20(rewardToken).safeTransferFrom(address(flywheelRewards), _receiver, balance);\r\n }\r\n function whitelistUser(ERC20 strategy, address user) external {}\r\n\r\n}" + }, + "contracts/test/EmissionsManager/mocks/MockOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\r\n\r\ncontract MockOracle {\r\n mapping(ICErc20 => uint256) public prices;\r\n\r\n function setUnderlyingPrice(ICErc20 _tokenAddress, uint256 _price) public {\r\n prices[_tokenAddress] = _price;\r\n }\r\n function getUnderlyingPrice(ICErc20 _tokenAddress) public view returns (uint256) {\r\n return prices[_tokenAddress];\r\n }\r\n}" + }, + "contracts/test/EmissionsManager/mocks/MockPoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nstruct Pool {\r\n string name;\r\n address creator;\r\n address comptroller;\r\n uint256 blockPosted;\r\n uint256 timestampPosted;\r\n}\r\n\r\ncontract MockPoolDirectory {\r\n\r\n Pool[] public pools;\r\n\r\n // Allows setting mock eth values for testing purposes\r\n function setActivePools(address comptroller) external {\r\n Pool memory pool = Pool(\"Test Pool\", msg.sender, comptroller, block.number, block.timestamp);\r\n pools.push(pool);\r\n }\r\n\r\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\r\n uint256[] memory activeIds = new uint256[](1);\r\n Pool[] memory activePools = new Pool[](1);\r\n activePools[0] = pools[0];\r\n return (activeIds, activePools);\r\n }\r\n}" + }, + "contracts/test/EmissionsManager/mocks/MockVeION.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ncontract MockVeION /* is */ {\r\n mapping(address => uint256) public ethValues;\r\n\r\n // Allows setting mock eth values for testing purposes\r\n function setMockTotalEthValueOfTokens(address _owner, uint256 _value) external {\r\n ethValues[_owner] = _value;\r\n }\r\n\r\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\r\n return ethValues[_owner];\r\n }\r\n}" + }, + "contracts/test/ExtensionsTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\r\n\r\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\r\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\r\nimport { Comptroller } from \"../compound/Comptroller.sol\";\r\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\r\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\r\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\r\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\r\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\r\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\r\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\r\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\r\n\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\ncontract MockComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\r\n function getFirstMarketSymbol() public view returns (string memory) {\r\n return allMarkets[0].symbol();\r\n }\r\n\r\n function _setTransferPaused(bool) public returns (bool) {\r\n return false;\r\n }\r\n\r\n function _setSeizePaused(bool) public returns (bool) {\r\n return false;\r\n }\r\n\r\n // a dummy fn to test if the replacement of extension fns works\r\n function getSecondMarketSymbol() public view returns (string memory) {\r\n return allMarkets[1].symbol();\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 4;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\r\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\r\n functionSelectors[--fnsCount] = this.getFirstMarketSymbol.selector;\r\n functionSelectors[--fnsCount] = this.getSecondMarketSymbol.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n}\r\n\r\ncontract MockSecondComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\r\n function getThirdMarketSymbol() public view returns (string memory) {\r\n return allMarkets[2].symbol();\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 1;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.getThirdMarketSymbol.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n}\r\n\r\ncontract MockThirdComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\r\n function getFourthMarketSymbol() public view returns (string memory) {\r\n return allMarkets[3].symbol();\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 1;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.getFourthMarketSymbol.selector;\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n}\r\n\r\ncontract ExtensionsTest is MarketsTest {\r\n MockComptrollerExtension internal mockExtension;\r\n MockSecondComptrollerExtension internal second;\r\n MockThirdComptrollerExtension internal third;\r\n\r\n function afterForkSetUp() internal virtual override {\r\n super.afterForkSetUp();\r\n mockExtension = new MockComptrollerExtension();\r\n second = new MockSecondComptrollerExtension();\r\n third = new MockThirdComptrollerExtension();\r\n }\r\n\r\n function testExtensionReplace() public debuggingOnly fork(BSC_MAINNET) {\r\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\r\n _upgradeExistingPool(jFiatPoolAddress);\r\n\r\n // replace the first extension with the mock\r\n vm.prank(ffd.owner());\r\n ffd._registerComptrollerExtension(jFiatPoolAddress, mockExtension, comptrollerExtension);\r\n\r\n // assert that the replacement worked\r\n MockComptrollerExtension asMockExtension = MockComptrollerExtension(jFiatPoolAddress);\r\n emit log(asMockExtension.getSecondMarketSymbol());\r\n assertEq(asMockExtension.getSecondMarketSymbol(), \"fETH-1\", \"market symbol does not match\");\r\n\r\n // add a second mock extension\r\n vm.prank(ffd.owner());\r\n ffd._registerComptrollerExtension(jFiatPoolAddress, second, DiamondExtension(address(0)));\r\n\r\n // add again the third, removing the second\r\n vm.prank(ffd.owner());\r\n ffd._registerComptrollerExtension(jFiatPoolAddress, third, second);\r\n\r\n // assert that it worked\r\n DiamondBase asBase = DiamondBase(jFiatPoolAddress);\r\n address[] memory currentExtensions = asBase._listExtensions();\r\n assertEq(currentExtensions.length, 2, \"extensions count does not match\");\r\n assertEq(currentExtensions[0], address(mockExtension), \"!first\");\r\n assertEq(currentExtensions[1], address(third), \"!second\");\r\n }\r\n\r\n function testNewPoolExtensions() public fork(BSC_MAINNET) {\r\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\r\n\r\n _prepareComptrollerUpgrade(address(0));\r\n\r\n // deploy a pool that will have an extension registered automatically\r\n {\r\n (, address poolAddress) = fpd.deployPool(\r\n \"just-a-test2\",\r\n latestComptrollerImplementation,\r\n abi.encode(payable(address(ffd))),\r\n false,\r\n 0.1e18,\r\n 1.1e18,\r\n ap.getAddress(\"MasterPriceOracle\")\r\n );\r\n\r\n address[] memory initExtensionsAfter = DiamondBase(payable(poolAddress))._listExtensions();\r\n assertEq(initExtensionsAfter.length, 1, \"remove this if the ffd config is set up\");\r\n assertEq(initExtensionsAfter[0], address(comptrollerExtension), \"first extension is not the CFE\");\r\n }\r\n }\r\n\r\n function testMulticallMarket() public fork(BSC_MAINNET) {\r\n uint8 random = uint8(block.timestamp % 256);\r\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\r\n\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n\r\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(pools[random % pools.length].comptroller);\r\n ICErc20[] memory markets = somePool.getAllMarkets();\r\n\r\n if (markets.length == 0) return;\r\n\r\n ICErc20 someMarket = markets[random % markets.length];\r\n\r\n emit log(\"pool\");\r\n emit log_address(address(somePool));\r\n emit log(\"market\");\r\n emit log_address(address(someMarket));\r\n\r\n vm.roll(block.number + 1);\r\n\r\n bytes memory blockNumberBeforeCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\r\n bytes memory accrueInterestCall = abi.encodeWithSelector(someMarket.accrueInterest.selector);\r\n bytes memory blockNumberAfterCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\r\n bytes[] memory results = someMarket.multicall(\r\n asArray(blockNumberBeforeCall, accrueInterestCall, blockNumberAfterCall)\r\n );\r\n uint256 blockNumberBefore = abi.decode(results[0], (uint256));\r\n uint256 blockNumberAfter = abi.decode(results[2], (uint256));\r\n\r\n assertGt(blockNumberAfter, blockNumberBefore, \"did not accrue?\");\r\n }\r\n\r\n function testBscExistingCTokenExtensionUpgrade() public fork(BSC_MAINNET) {\r\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\r\n }\r\n\r\n function testArbitrumExistingCTokenExtensionUpgrade() public fork(ARBITRUM_ONE) {\r\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\r\n }\r\n\r\n function _testAllPoolsAllMarketsCTokenExtensionUpgrade() internal {\r\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n _testPoolAllMarketsExtensionUpgrade(pools[i].comptroller);\r\n }\r\n }\r\n\r\n function _testPoolAllMarketsExtensionUpgrade(address poolAddress) internal {\r\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(poolAddress);\r\n\r\n ICErc20[] memory markets = somePool.getAllMarkets();\r\n\r\n if (markets.length == 0) return;\r\n\r\n for (uint256 j = 0; j < markets.length; j++) {\r\n ICErc20 someMarket = markets[j];\r\n CErc20Delegator asDelegator = CErc20Delegator(address(someMarket));\r\n\r\n emit log(\"pool\");\r\n emit log_address(address(somePool));\r\n emit log(\"market\");\r\n emit log_address(address(someMarket));\r\n\r\n try this._testExistingCTokenExtensionUpgrade(asDelegator) {} catch Error(string memory reason) {\r\n address plugin = address(CErc20PluginDelegate(address(asDelegator)).plugin());\r\n emit log(\"plugin\");\r\n emit log_address(plugin);\r\n\r\n address latestPlugin = ffd.latestPluginImplementation(plugin);\r\n emit log(\"latest plugin impl\");\r\n emit log_address(latestPlugin);\r\n\r\n revert(reason);\r\n }\r\n }\r\n }\r\n\r\n function _testExistingCTokenExtensionUpgrade(CErc20Delegator asDelegator) public {\r\n uint256 totalSupplyBefore = asDelegator.totalSupply();\r\n if (totalSupplyBefore == 0) return; // total supply should be non-zero\r\n\r\n // TODO\r\n _upgradeMarket(ICErc20(address(asDelegator)));\r\n\r\n // check if the extension was added\r\n address[] memory extensions = asDelegator._listExtensions();\r\n assertEq(extensions.length, 1, \"the first extension should be added\");\r\n assertEq(extensions[0], address(newCTokenExtension), \"the first extension should be the only extension\");\r\n\r\n // check if the storage is read from the same place\r\n uint256 totalSupplyAfter = asDelegator.totalSupply();\r\n assertGt(totalSupplyAfter, 0, \"total supply should be non-zero\");\r\n assertEq(totalSupplyAfter, totalSupplyBefore, \"total supply should be the same\");\r\n }\r\n\r\n function testBscComptrollerExtensions() public debuggingOnly fork(BSC_MAINNET) {\r\n _testComptrollersExtensions();\r\n }\r\n\r\n function testPolygonComptrollerExtensions() public debuggingOnly fork(POLYGON_MAINNET) {\r\n _testComptrollersExtensions();\r\n }\r\n\r\n function testChapelComptrollerExtensions() public debuggingOnly fork(BSC_CHAPEL) {\r\n _testComptrollersExtensions();\r\n }\r\n\r\n function testArbitrumComptrollerExtensions() public debuggingOnly fork(ARBITRUM_ONE) {\r\n _testComptrollersExtensions();\r\n }\r\n\r\n function _testComptrollersExtensions() internal {\r\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\r\n\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n\r\n for (uint8 i = 0; i < pools.length; i++) {\r\n address payable asPayable = payable(pools[i].comptroller);\r\n DiamondBase asBase = DiamondBase(asPayable);\r\n address[] memory extensions = asBase._listExtensions();\r\n assertEq(extensions.length, 1, \"each pool should have the first extension\");\r\n }\r\n }\r\n\r\n function testBulkAutoUpgrade() public debuggingOnly fork(POLYGON_MAINNET) {\r\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\r\n\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n\r\n for (uint8 i = 0; i < pools.length; i++) {\r\n vm.prank(ffd.owner());\r\n ffd.autoUpgradePool(IonicComptroller(pools[i].comptroller));\r\n }\r\n }\r\n\r\n function testPolygonTotalUnderlyingSupplied() public debuggingOnly fork(POLYGON_MAINNET) {\r\n _testTotalUnderlyingSupplied();\r\n }\r\n\r\n function testBscTotalUnderlyingSupplied() public debuggingOnly fork(BSC_MAINNET) {\r\n _testTotalUnderlyingSupplied();\r\n }\r\n\r\n function _testTotalUnderlyingSupplied() internal {\r\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\r\n\r\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\r\n\r\n for (uint8 i = 0; i < pools.length; i++) {\r\n // if (pools[i].comptroller == 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459) continue;\r\n // if (pools[i].comptroller == 0xD265ff7e5487E9DD556a4BB900ccA6D087Eb3AD2) continue;\r\n ComptrollerFirstExtension poolExt = ComptrollerFirstExtension(pools[i].comptroller);\r\n\r\n ICErc20[] memory markets = poolExt.getAllMarkets();\r\n for (uint8 k = 0; k < markets.length; k++) {\r\n CErc20Delegate market = CErc20Delegate(address(markets[k]));\r\n // emit log(market.contractType());\r\n // emit log_named_address(\"impl\", market.implementation());\r\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(address(markets[k]));\r\n marketAsExt.getTotalUnderlyingSupplied();\r\n }\r\n }\r\n }\r\n\r\n function testDelegateType() public debuggingOnly fork(POLYGON_MAINNET) {\r\n emit log(CErc20Delegate(0x587906620D627fe75C4d1288C6A584089780959c).contractType());\r\n }\r\n}\r\n" + }, + "contracts/test/helpers/WithPool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.4.23;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\r\n\r\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\r\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\r\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\r\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\r\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\r\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\r\nimport { CErc20Delegator } from \"../../compound/CErc20Delegator.sol\";\r\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\r\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\r\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\r\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\r\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\r\nimport { PoolLens } from \"../../PoolLens.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\nimport { CTokenFirstExtension, DiamondExtension } from \"../../compound/CTokenFirstExtension.sol\";\r\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\r\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\r\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\r\n\r\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\r\n\r\ncontract WithPool is BaseTest {\r\n ERC20Upgradeable public underlyingToken;\r\n CErc20Delegate cErc20Delegate;\r\n CErc20PluginDelegate cErc20PluginDelegate;\r\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\r\n\r\n IonicComptroller comptroller;\r\n Comptroller newComptroller;\r\n JumpRateModel interestModel;\r\n\r\n FeeDistributor ionicAdmin;\r\n PoolDirectory poolDirectory;\r\n MasterPriceOracle priceOracle;\r\n PoolLens poolLens;\r\n\r\n address[] markets;\r\n bool[] t;\r\n bool[] f;\r\n address[] newImplementation;\r\n address[] hardcodedAddresses;\r\n string[] hardcodedNames;\r\n\r\n function setUpWithPool(MasterPriceOracle _masterPriceOracle, ERC20Upgradeable _underlyingToken) public {\r\n priceOracle = _masterPriceOracle;\r\n underlyingToken = _underlyingToken;\r\n\r\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\r\n if (address(ionicAdmin) != address(0)) {\r\n // upgrade\r\n {\r\n FeeDistributor newImpl = new FeeDistributor();\r\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ionicAdmin)));\r\n bytes32 bytesAtSlot = vm.load(\r\n address(proxy),\r\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\r\n );\r\n address admin = address(uint160(uint256(bytesAtSlot)));\r\n vm.prank(admin);\r\n proxy.upgradeTo(address(newImpl));\r\n }\r\n } else {\r\n ionicAdmin = new FeeDistributor();\r\n ionicAdmin.initialize(1e16);\r\n }\r\n\r\n {\r\n vm.prank(ionicAdmin.owner());\r\n ionicAdmin._setPendingOwner(address(this));\r\n ionicAdmin._acceptOwner();\r\n }\r\n setUpBaseContracts();\r\n setUpExtensions();\r\n }\r\n\r\n function setUpExtensions() internal {\r\n cErc20Delegate = new CErc20Delegate();\r\n cErc20PluginDelegate = new CErc20PluginDelegate();\r\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\r\n\r\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\r\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\r\n\r\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\r\n ionicAdmin._setLatestCErc20Delegate(\r\n cErc20PluginDelegate.delegateType(),\r\n address(cErc20PluginDelegate),\r\n abi.encode(address(0))\r\n );\r\n ionicAdmin._setLatestCErc20Delegate(\r\n cErc20PluginRewardsDelegate.delegateType(),\r\n address(cErc20PluginRewardsDelegate),\r\n abi.encode(address(0))\r\n );\r\n\r\n cErc20DelegateExtensions[1] = cErc20Delegate;\r\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\r\n cErc20DelegateExtensions[1] = cErc20PluginDelegate;\r\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\r\n cErc20DelegateExtensions[1] = cErc20PluginRewardsDelegate;\r\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\r\n }\r\n\r\n function setUpBaseContracts() internal {\r\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\r\n poolDirectory = new PoolDirectory();\r\n poolDirectory.initialize(false, new address[](0));\r\n\r\n poolLens = new PoolLens();\r\n poolLens.initialize(\r\n poolDirectory,\r\n \"Pool\",\r\n \"lens\",\r\n hardcodedAddresses,\r\n hardcodedNames,\r\n hardcodedNames,\r\n hardcodedNames,\r\n hardcodedNames,\r\n hardcodedNames\r\n );\r\n }\r\n\r\n function setUpPool(\r\n string memory name,\r\n bool enforceWhitelist,\r\n uint256 closeFactor,\r\n uint256 liquidationIncentive\r\n ) public {\r\n Comptroller newComptrollerImplementation = new Comptroller();\r\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(newComptrollerImplementation));\r\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\r\n extensions[0] = new ComptrollerFirstExtension();\r\n extensions[1] = newComptrollerImplementation;\r\n ionicAdmin._setComptrollerExtensions(address(newComptrollerImplementation), extensions);\r\n\r\n (, address comptrollerAddress) = poolDirectory.deployPool(\r\n name,\r\n address(newComptrollerImplementation),\r\n abi.encode(payable(address(ionicAdmin))),\r\n enforceWhitelist,\r\n closeFactor,\r\n liquidationIncentive,\r\n address(priceOracle)\r\n );\r\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\r\n comptroller = IonicComptroller(comptrollerAddress);\r\n\r\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\r\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\r\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\r\n newAr.initialize(address(321));\r\n ionicAdmin.reinitialize(newAr);\r\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\r\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\r\n }\r\n\r\n function upgradePool(address pool) internal {\r\n Comptroller newComptrollerImplementation = new Comptroller();\r\n\r\n Unitroller asUnitroller = Unitroller(payable(pool));\r\n\r\n // upgrade to the new comptroller\r\n vm.startPrank(asUnitroller.admin());\r\n asUnitroller._registerExtension(\r\n newComptrollerImplementation,\r\n DiamondExtension(asUnitroller.comptrollerImplementation())\r\n );\r\n asUnitroller._upgrade();\r\n vm.stopPrank();\r\n }\r\n\r\n function deployCErc20Delegate(\r\n address _underlyingToken,\r\n bytes memory name,\r\n bytes memory symbol,\r\n uint256 _collateralFactorMantissa\r\n ) public {\r\n comptroller._deployMarket(\r\n cErc20Delegate.delegateType(),\r\n abi.encode(\r\n _underlyingToken,\r\n comptroller,\r\n payable(address(ionicAdmin)),\r\n InterestRateModel(address(interestModel)),\r\n name,\r\n symbol,\r\n uint256(1),\r\n uint256(0)\r\n ),\r\n \"\",\r\n _collateralFactorMantissa\r\n );\r\n }\r\n\r\n function deployCErc20PluginDelegate(address _erc4626, uint256 _collateralFactorMantissa) public {\r\n comptroller._deployMarket(\r\n cErc20PluginDelegate.delegateType(),\r\n abi.encode(\r\n address(underlyingToken),\r\n comptroller,\r\n payable(address(ionicAdmin)),\r\n InterestRateModel(address(interestModel)),\r\n \"cUnderlyingToken\",\r\n \"CUT\",\r\n uint256(1),\r\n uint256(0)\r\n ),\r\n abi.encode(_erc4626),\r\n _collateralFactorMantissa\r\n );\r\n }\r\n\r\n function deployCErc20PluginRewardsDelegate(address _mockERC4626Dynamic, uint256 _collateralFactorMantissa) public {\r\n comptroller._deployMarket(\r\n cErc20PluginRewardsDelegate.delegateType(),\r\n abi.encode(\r\n address(underlyingToken),\r\n comptroller,\r\n payable(address(ionicAdmin)),\r\n InterestRateModel(address(interestModel)),\r\n \"cUnderlyingToken\",\r\n \"CUT\",\r\n uint256(1),\r\n uint256(0)\r\n ),\r\n abi.encode(_mockERC4626Dynamic),\r\n _collateralFactorMantissa\r\n );\r\n }\r\n}\r\n" + }, + "contracts/test/IonicFlywheel/interfaces/Errors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\n/**\r\n @title Shared Errors\r\n*/\r\ninterface Errors {\r\n /// @notice thrown when attempting to approve an EOA that must be a contract\r\n error NonContractError();\r\n}" + }, + "contracts/test/IonicFlywheel/lib/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for managing\r\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\r\n * types.\r\n *\r\n * Sets have the following properties:\r\n *\r\n * - Elements are added, removed, and checked for existence in constant time\r\n * (O(1)).\r\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\r\n *\r\n * ```\r\n * contract Example {\r\n * // Add the library methods\r\n * using EnumerableSet for EnumerableSet.AddressSet;\r\n *\r\n * // Declare a set state variable\r\n * EnumerableSet.AddressSet private mySet;\r\n * }\r\n * ```\r\n *\r\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\r\n * and `uint256` (`UintSet`) are supported.\r\n */\r\nlibrary EnumerableSet {\r\n // To implement this library for multiple types with as little code\r\n // repetition as possible, we write it in terms of a generic Set type with\r\n // bytes32 values.\r\n // The Set implementation uses private functions, and user-facing\r\n // implementations (such as AddressSet) are just wrappers around the\r\n // underlying Set.\r\n // This means that we can only create new EnumerableSets for types that fit\r\n // in bytes32.\r\n\r\n struct Set {\r\n // Storage of set values\r\n bytes32[] _values;\r\n // Position of the value in the `values` array, plus 1 because index 0\r\n // means a value is not in the set.\r\n mapping(bytes32 => uint256) _indexes;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function _add(Set storage set, bytes32 value) private returns (bool) {\r\n if (!_contains(set, value)) {\r\n set._values.push(value);\r\n // The value is stored at length-1, but we add 1 to all indexes\r\n // and use 0 as a sentinel value\r\n set._indexes[value] = set._values.length;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function _remove(Set storage set, bytes32 value) private returns (bool) {\r\n // We read and store the value's index to prevent multiple reads from the same storage slot\r\n uint256 valueIndex = set._indexes[value];\r\n\r\n if (valueIndex != 0) {\r\n // Equivalent to contains(set, value)\r\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\r\n // the array, and then remove the last element (sometimes called as 'swap and pop').\r\n // This modifies the order of the array, as noted in {at}.\r\n\r\n uint256 toDeleteIndex = valueIndex - 1;\r\n uint256 lastIndex = set._values.length - 1;\r\n\r\n if (lastIndex != toDeleteIndex) {\r\n bytes32 lastvalue = set._values[lastIndex];\r\n\r\n // Move the last value to the index where the value to delete is\r\n set._values[toDeleteIndex] = lastvalue;\r\n // Update the index for the moved value\r\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\r\n }\r\n\r\n // Delete the slot where the moved value was stored\r\n set._values.pop();\r\n\r\n // Delete the index for the deleted slot\r\n delete set._indexes[value];\r\n\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\r\n return set._indexes[value] != 0;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values on the set. O(1).\r\n */\r\n function _length(Set storage set) private view returns (uint256) {\r\n return set._values.length;\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\r\n return set._values[index];\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function _values(Set storage set) private view returns (bytes32[] memory) {\r\n return set._values;\r\n }\r\n\r\n // Bytes32Set\r\n\r\n struct Bytes32Set {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _add(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _remove(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\r\n return _contains(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(Bytes32Set storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\r\n return _at(set._inner, index);\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\r\n return _values(set._inner);\r\n }\r\n\r\n // AddressSet\r\n\r\n struct AddressSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(AddressSet storage set, address value) internal returns (bool) {\r\n return _add(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(AddressSet storage set, address value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(AddressSet storage set, address value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(AddressSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\r\n return address(uint160(uint256(_at(set._inner, index))));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(AddressSet storage set) internal view returns (address[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n address[] memory result;\r\n\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // UintSet\r\n\r\n struct UintSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _add(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values on the set. O(1).\r\n */\r\n function length(UintSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\r\n return uint256(_at(set._inner, index));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(UintSet storage set) internal view returns (uint256[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n uint256[] memory result;\r\n\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n}" + }, + "contracts/test/IonicFlywheel/mocks/ERC20MultiVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// Voting logic inspired by OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"solmate/auth/Auth.sol\";\r\nimport \"solmate/tokens/ERC20.sol\";\r\nimport \"solmate/utils/SafeCastLib.sol\";\r\nimport \"../lib/EnumerableSet.sol\";\r\nimport \"../interfaces/Errors.sol\";\r\n\r\n/**\r\n @title ERC20 Multi-Delegation Voting contract\r\n @notice an ERC20 extension which allows delegations to multiple delegatees up to a user's balance on a given block.\r\n */\r\nabstract contract ERC20MultiVotes_Mock is ERC20, Auth {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeCastLib for *;\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n VOTE CALCULATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice thrown when trying to read from an invalid block.\r\n error BlockError();\r\n\r\n struct Checkpoint {\r\n uint32 fromBlock;\r\n uint224 votes;\r\n }\r\n\r\n /// @notice votes checkpoint list per user.\r\n mapping(address => Checkpoint[]) private _checkpoints;\r\n\r\n /// @notice Get the `pos`-th checkpoint for `account`.\r\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\r\n return _checkpoints[account][pos];\r\n }\r\n\r\n /// @notice Get number of checkpoints for `account`.\r\n function numCheckpoints(address account) public view virtual returns (uint32) {\r\n return _checkpoints[account].length.safeCastTo32();\r\n }\r\n\r\n /**\r\n * @notice Gets the amount of unallocated votes for `account`.\r\n * @param account the address to get free votes of.\r\n * @return the amount of unallocated votes.\r\n */\r\n function freeVotes(address account) public view virtual returns (uint256) {\r\n return balanceOf[account] - userDelegatedVotes[account];\r\n }\r\n\r\n /**\r\n * @notice Gets the current votes balance for `account`.\r\n * @param account the address to get votes of.\r\n * @return the amount of votes.\r\n */\r\n function getVotes(address account) public view virtual returns (uint256) {\r\n uint256 pos = _checkpoints[account].length;\r\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\r\n }\r\n\r\n /**\r\n * @notice Retrieve the number of votes for `account` at the end of `blockNumber`.\r\n * @param account the address to get votes of.\r\n * @param blockNumber the block to calculate votes for.\r\n * @return the amount of votes.\r\n */\r\n function getPastVotes(address account, uint256 blockNumber) public view virtual returns (uint256) {\r\n if (blockNumber >= block.number) revert BlockError();\r\n return _checkpointsLookup(_checkpoints[account], blockNumber);\r\n }\r\n\r\n /// @dev Lookup a value in a list of (sorted) checkpoints.\r\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\r\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\r\n uint256 high = ckpts.length;\r\n uint256 low = 0;\r\n while (low < high) {\r\n uint256 mid = average(low, high);\r\n if (ckpts[mid].fromBlock > blockNumber) {\r\n high = mid;\r\n } else {\r\n low = mid + 1;\r\n }\r\n }\r\n\r\n return high == 0 ? 0 : ckpts[high - 1].votes;\r\n }\r\n\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow.\r\n return (a & b) + (a ^ b) / 2;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ADMIN OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice emitted when updating the maximum amount of delegates per user\r\n event MaxDelegatesUpdate(uint256 oldMaxDelegates, uint256 newMaxDelegates);\r\n\r\n /// @notice emitted when updating the canContractExceedMaxDelegates flag for an account\r\n event CanContractExceedMaxDelegatesUpdate(address indexed account, bool canContractExceedMaxDelegates);\r\n\r\n /// @notice the maximum amount of delegates for a user at a given time\r\n uint256 public maxDelegates;\r\n\r\n /// @notice an approve list for contracts to go above the max delegate limit.\r\n mapping(address => bool) public canContractExceedMaxDelegates;\r\n\r\n /// @notice set the new max delegates per user. Requires auth by `authority`.\r\n function setMaxDelegates(uint256 newMax) external requiresAuth {\r\n uint256 oldMax = maxDelegates;\r\n maxDelegates = newMax;\r\n\r\n emit MaxDelegatesUpdate(oldMax, newMax);\r\n }\r\n\r\n /// @notice set the canContractExceedMaxDelegates flag for an account.\r\n function setContractExceedMaxDelegates(address account, bool canExceedMax) external requiresAuth {\r\n if (canExceedMax && account.code.length == 0) revert Errors.NonContractError(); // can only approve contracts\r\n\r\n canContractExceedMaxDelegates[account] = canExceedMax;\r\n\r\n emit CanContractExceedMaxDelegatesUpdate(account, canExceedMax);\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n DELEGATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @dev Emitted when a `delegator` delegates `amount` votes to `delegate`.\r\n event Delegation(address indexed delegator, address indexed delegate, uint256 amount);\r\n\r\n /// @dev Emitted when a `delegator` undelegates `amount` votes from `delegate`.\r\n event Undelegation(address indexed delegator, address indexed delegate, uint256 amount);\r\n\r\n /// @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.\r\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\r\n\r\n /// @notice An event thats emitted when an account changes its delegate\r\n /// @dev this is used for backward compatibility with OZ interfaces for ERC20Votes and ERC20VotesComp.\r\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\r\n\r\n /// @dev thrown when attempting to delegate more votes than an address has free, or exceeding the max delegates\r\n error DelegationError();\r\n\r\n /// @notice mapping from a delegator and delegatee to the delegated amount.\r\n mapping(address => mapping(address => uint256)) private _delegatesVotesCount;\r\n\r\n /// @notice mapping from a delegator to the total number of delegated votes.\r\n mapping(address => uint256) public userDelegatedVotes;\r\n\r\n /// @notice list of delegates per user.\r\n mapping(address => EnumerableSet.AddressSet) private _delegates;\r\n\r\n /**\r\n * @notice Get the amount of votes currently delegated by `delegator` to `delegatee`.\r\n * @param delegator the account which is delegating votes to `delegatee`.\r\n * @param delegatee the account receiving votes from `delegator`.\r\n * @return the total amount of votes delegated to `delegatee` by `delegator`\r\n */\r\n function delegatesVotesCount(address delegator, address delegatee) public view virtual returns (uint256) {\r\n return _delegatesVotesCount[delegator][delegatee];\r\n }\r\n\r\n /**\r\n * @notice Get the list of delegates from `delegator`.\r\n * @param delegator the account which is delegating votes to delegates.\r\n * @return the list of delegated accounts.\r\n */\r\n function delegates(address delegator) public view returns (address[] memory) {\r\n return _delegates[delegator].values();\r\n }\r\n\r\n /**\r\n * @notice Get the number of delegates from `delegator`.\r\n * @param delegator the account which is delegating votes to delegates.\r\n * @return the number of delegated accounts.\r\n */\r\n function delegateCount(address delegator) public view returns (uint256) {\r\n return _delegates[delegator].length();\r\n }\r\n\r\n /**\r\n * @notice Delegate `amount` votes from the sender to `delegatee`.\r\n * @param delegatee the receivier of votes.\r\n * @param amount the amount of votes received.\r\n * @dev requires \"freeVotes(msg.sender) > amount\" and will not exceed max delegates\r\n */\r\n function incrementDelegation(address delegatee, uint256 amount) public virtual {\r\n _incrementDelegation(msg.sender, delegatee, amount);\r\n }\r\n\r\n /**\r\n * @notice Undelegate `amount` votes from the sender from `delegatee`.\r\n * @param delegatee the receivier of undelegation.\r\n * @param amount the amount of votes taken away.\r\n */\r\n function undelegate(address delegatee, uint256 amount) public virtual {\r\n _undelegate(msg.sender, delegatee, amount);\r\n }\r\n\r\n /**\r\n * @notice Delegate all votes `newDelegatee`. First undelegates from an existing delegate. If `newDelegatee` is zero, only undelegates.\r\n * @param newDelegatee the receiver of votes.\r\n * @dev undefined for `delegateCount(msg.sender) > 1`\r\n * NOTE This is meant for backward compatibility with the `ERC20Votes` and `ERC20VotesComp` interfaces from OpenZeppelin.\r\n */\r\n function delegate(address newDelegatee) external virtual {\r\n _delegate(msg.sender, newDelegatee);\r\n }\r\n\r\n function _delegate(address delegator, address newDelegatee) internal virtual {\r\n uint256 count = delegateCount(delegator);\r\n\r\n // undefined behavior for delegateCount > 1\r\n if (count > 1) revert DelegationError();\r\n\r\n address oldDelegatee;\r\n // if already delegated, undelegate first\r\n if (count == 1) {\r\n oldDelegatee = _delegates[delegator].at(0);\r\n _undelegate(delegator, oldDelegatee, _delegatesVotesCount[delegator][oldDelegatee]);\r\n }\r\n\r\n // redelegate only if newDelegatee is not empty\r\n if (newDelegatee != address(0)) {\r\n _incrementDelegation(delegator, newDelegatee, freeVotes(delegator));\r\n }\r\n emit DelegateChanged(delegator, oldDelegatee, newDelegatee);\r\n }\r\n\r\n function _incrementDelegation(\r\n address delegator,\r\n address delegatee,\r\n uint256 amount\r\n ) internal virtual {\r\n // Require freeVotes exceed the delegation size\r\n uint256 free = freeVotes(delegator);\r\n if (delegatee == address(0) || free < amount) revert DelegationError();\r\n\r\n bool newDelegate = _delegates[delegator].add(delegatee); // idempotent add\r\n if (newDelegate && delegateCount(delegator) > maxDelegates && !canContractExceedMaxDelegates[delegator]) {\r\n // if new delegate and exceeds max and not approved to exceed, revert\r\n revert DelegationError();\r\n }\r\n\r\n _delegatesVotesCount[delegator][delegatee] += amount;\r\n userDelegatedVotes[delegator] += amount;\r\n\r\n emit Delegation(delegator, delegatee, amount);\r\n _writeCheckpoint(delegatee, _add, amount);\r\n }\r\n\r\n function _undelegate(\r\n address delegator,\r\n address delegatee,\r\n uint256 amount\r\n ) internal virtual {\r\n uint256 newDelegates = _delegatesVotesCount[delegator][delegatee] - amount;\r\n\r\n if (newDelegates == 0) {\r\n require(_delegates[delegator].remove(delegatee));\r\n }\r\n\r\n _delegatesVotesCount[delegator][delegatee] = newDelegates;\r\n userDelegatedVotes[delegator] -= amount;\r\n\r\n emit Undelegation(delegator, delegatee, amount);\r\n _writeCheckpoint(delegatee, _subtract, amount);\r\n }\r\n\r\n function _writeCheckpoint(\r\n address delegatee,\r\n function(uint256, uint256) view returns (uint256) op,\r\n uint256 delta\r\n ) private {\r\n Checkpoint[] storage ckpts = _checkpoints[delegatee];\r\n\r\n uint256 pos = ckpts.length;\r\n uint256 oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\r\n uint256 newWeight = op(oldWeight, delta);\r\n\r\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\r\n ckpts[pos - 1].votes = newWeight.safeCastTo224();\r\n } else {\r\n ckpts.push(Checkpoint({fromBlock: block.number.safeCastTo32(), votes: newWeight.safeCastTo224()}));\r\n }\r\n emit DelegateVotesChanged(delegatee, oldWeight, newWeight);\r\n }\r\n\r\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\r\n return a + b;\r\n }\r\n\r\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\r\n return a - b;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ERC20 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// NOTE: any \"removal\" of tokens from a user requires freeVotes(user) < amount.\r\n /// _decrementVotesUntilFree is called as a greedy algorithm to free up votes.\r\n /// It may be more gas efficient to free weight before burning or transferring tokens.\r\n\r\n function _burn(address from, uint256 amount) internal virtual override {\r\n _decrementVotesUntilFree(from, amount);\r\n super._burn(from, amount);\r\n }\r\n\r\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\r\n _decrementVotesUntilFree(msg.sender, amount);\r\n return super.transfer(to, amount);\r\n }\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _decrementVotesUntilFree(from, amount);\r\n return super.transferFrom(from, to, amount);\r\n }\r\n\r\n /// a greedy algorithm for freeing votes before a token burn/transfer\r\n /// frees up entire delegates, so likely will free more than `votes`\r\n function _decrementVotesUntilFree(address user, uint256 votes) internal {\r\n uint256 userFreeVotes = freeVotes(user);\r\n\r\n // early return if already free\r\n if (userFreeVotes >= votes) return;\r\n\r\n // cache total for batch updates\r\n uint256 totalFreed;\r\n\r\n // Loop through all delegates\r\n address[] memory delegateList = _delegates[user].values();\r\n\r\n // Free delegates until through entire list or under votes amount\r\n uint256 size = delegateList.length;\r\n for (uint256 i = 0; i < size && (userFreeVotes + totalFreed) < votes; i++) {\r\n address delegatee = delegateList[i];\r\n uint256 delegateVotes = _delegatesVotesCount[user][delegatee];\r\n if (delegateVotes != 0) {\r\n totalFreed += delegateVotes;\r\n\r\n require(_delegates[user].remove(delegatee)); // Remove from set. Should never fail.\r\n\r\n _delegatesVotesCount[user][delegatee] = 0;\r\n\r\n _writeCheckpoint(delegatee, _subtract, delegateVotes);\r\n emit Undelegation(user, delegatee, delegateVotes);\r\n }\r\n }\r\n\r\n userDelegatedVotes[user] -= totalFreed;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n EIP-712 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n bytes32 public constant DELEGATION_TYPEHASH =\r\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\r\n\r\n function delegateBySig(\r\n address delegatee,\r\n uint256 nonce,\r\n uint256 expiry,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) public {\r\n require(block.timestamp <= expiry, \"ERC20MultiVotes: signature expired\");\r\n address signer = ecrecover(\r\n keccak256(\r\n abi.encodePacked(\r\n \"\\x19\\x01\",\r\n DOMAIN_SEPARATOR(),\r\n keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry))\r\n )\r\n ),\r\n v,\r\n r,\r\n s\r\n );\r\n require(nonce == nonces[signer]++, \"ERC20MultiVotes: invalid nonce\");\r\n require(signer != address(0));\r\n _delegate(signer, delegatee);\r\n }\r\n}" + }, + "contracts/test/IonicFlywheel/mocks/MockBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\n\r\ncontract MockBooster {\r\n uint256 public totalBoost;\r\n\r\n mapping(address => uint256) public boosts;\r\n\r\n function setBoost(address user, uint256 boost) public {\r\n totalBoost -= boosts[user];\r\n boosts[user] = boost;\r\n totalBoost += boost;\r\n }\r\n\r\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256) {\r\n return strategy.totalSupply() + totalBoost;\r\n }\r\n\r\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256) {\r\n return strategy.balanceOf(user) + boosts[user];\r\n }\r\n}\r\n" + }, + "contracts/test/IonicFlywheel/mocks/MockEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\r\n\r\n\r\ncontract MockEmissionsManager {\r\n using SafeTransferLib for ERC20;\r\n\r\n mapping (address => bool) blacklisted;\r\n address public rewardToken;\r\n address public flywheelRewards;\r\n function setRewardToken(address _rewardToken) public {\r\n rewardToken = _rewardToken;\r\n }\r\n\r\n function setFlywheelRewards(address _flywheelRewards) public {\r\n flywheelRewards = _flywheelRewards;\r\n }\r\n\r\n function updateBlacklistBalances(ERC20 _market, address _user) external {}\r\n\r\n function accrue(ERC20 _market, address _user) public returns (uint256) {\r\n return 0;\r\n }\r\n\r\n function takeRewardsFromUser(address _user, address _receiver) external { \r\n uint256 balance = ERC20(rewardToken).balanceOf(address(flywheelRewards));\r\n ERC20(rewardToken).safeTransferFrom(address(flywheelRewards), _receiver, balance);\r\n }\r\n function whitelistUser(ERC20 strategy, address user) external {}\r\n\r\n function isUserBlacklisted(address _user) external view returns (bool) {\r\n return blacklisted[_user];\r\n }\r\n\r\n function blacklistUser(address _user) external {\r\n blacklisted[_user] = true;\r\n }\r\n\r\n function isUserBlacklistable(address _user) external view returns (bool) {\r\n return false;\r\n }\r\n \r\n\r\n}" + }, + "contracts/test/IonicFlywheel/mocks/MockERC20Gauges.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {ERC20Gauges, ERC20, Auth, Authority} from \"../token/ERC20Gauges.sol\";\r\n\r\ncontract MockERC20Gauges is ERC20Gauges {\r\n constructor(\r\n address _owner,\r\n uint32 _cycleLength,\r\n uint32 _freezeWindow\r\n ) ERC20(\"Token\", \"TKN\", 18) Auth(_owner, Authority(address(0))) ERC20Gauges(_cycleLength, _freezeWindow) {}\r\n\r\n function mint(address to, uint256 value) public virtual {\r\n _mint(to, value);\r\n }\r\n\r\n function burn(address from, uint256 value) public virtual {\r\n _burn(from, value);\r\n }\r\n}\r\n" + }, + "contracts/test/IonicFlywheel/mocks/MockERC20MultiVotes.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {ERC20MultiVotes, ERC20, Auth, Authority} from \"../token/ERC20MultiVotes.sol\";\r\n\r\ncontract MockERC20MultiVotes is ERC20MultiVotes {\r\n constructor(address _owner) ERC20(\"Token\", \"TKN\", 18) Auth(_owner, Authority(address(0))) {}\r\n\r\n function mint(address to, uint256 value) public virtual {\r\n _mint(to, value);\r\n }\r\n\r\n function burn(address from, uint256 value) public virtual {\r\n _burn(from, value);\r\n }\r\n}\r\n" + }, + "contracts/test/IonicFlywheel/mocks/MockRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport \"../../../ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol\";\r\n\r\ncontract MockRewards is BaseFlywheelRewards {\r\n /// @notice rewards amount per strategy\r\n mapping(ERC20 => uint256) public rewardsAmount;\r\n\r\n constructor(IonicFlywheelCore _flywheel) BaseFlywheelRewards(_flywheel) {}\r\n\r\n function setRewardsAmount(ERC20 strategy, uint256 amount) external {\r\n rewardsAmount[strategy] = amount;\r\n }\r\n\r\n function getAccruedRewards(ERC20 strategy, uint32) external view override onlyFlywheel returns (uint256 amount) {\r\n return rewardsAmount[strategy];\r\n }\r\n}\r\n" + }, + "contracts/test/IonicFlywheel/mocks/MockRewardsStream.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\n\r\ncontract MockRewardsStream {\r\n ERC20 public rewardToken;\r\n uint256 rewardAmount;\r\n\r\n constructor(ERC20 token, uint256 amount) {\r\n rewardAmount = amount;\r\n rewardToken = token;\r\n }\r\n\r\n function setRewardAmount(uint256 newAmount) external {\r\n rewardAmount = newAmount;\r\n }\r\n\r\n function getRewards() external returns (uint256 amount) {\r\n amount = rewardAmount;\r\n rewardToken.transfer(msg.sender, amount);\r\n }\r\n}\r\n" + }, + "contracts/test/IonicFlywheel/token/ERC20Gauges.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"solmate/auth/Auth.sol\";\r\nimport \"solmate/tokens/ERC20.sol\";\r\nimport \"solmate/utils/SafeCastLib.sol\";\r\nimport \"../lib/EnumerableSet.sol\";\r\n\r\ninterface Errors_ERC20Gauges {\r\n /// @notice thrown when attempting to approve an EOA that must be a contract\r\n error NonContractError();\r\n}\r\n\r\n/** \r\n @title An ERC20 with an embedded \"Gauge\" style vote with liquid weights\r\n @author Tribe DAO\r\n @notice This contract is meant to be used to support gauge style votes with weights associated with resource allocation.\r\n Holders can allocate weight in any proportion to supported gauges.\r\n A \"gauge\" is represented by an address which would receive the resources periodically or continuously.\r\n\r\n For example, gauges can be used to direct token emissions, similar to Curve or Tokemak.\r\n Alternatively, gauges can be used to direct another quantity such as relative access to a line of credit.\r\n\r\n The contract's Authority manages the gauge set and cap.\r\n \"Live\" gauges are in the set. \r\n Users can only add weight to live gauges but can remove weight from live or deprecated gauges.\r\n Gauges can be deprecated and reinstated, and will maintain any non-removed weight from before.\r\n\r\n @dev SECURITY NOTES: `maxGauges` is a critical variable to protect against gas DOS attacks upon token transfer. \r\n This must be low enough to allow complicated transactions to fit in a block.\r\n \r\n Weight state is preserved on the gauge and user level even when a gauge is removed, in case it is re-added. \r\n This maintains state efficiently, and global accounting is managed only on the `_totalWeight`\r\n*/\r\nabstract contract ERC20Gauges is ERC20, Auth {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeCastLib for *;\r\n\r\n constructor(uint32 _gaugeCycleLength, uint32 _incrementFreezeWindow) {\r\n if (_incrementFreezeWindow >= _gaugeCycleLength) revert IncrementFreezeError();\r\n gaugeCycleLength = _gaugeCycleLength;\r\n incrementFreezeWindow = _incrementFreezeWindow;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n GAUGE STATE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice the length of a gauge cycle\r\n uint32 public immutable gaugeCycleLength;\r\n\r\n /// @notice the period at the end of a cycle where votes cannot increment\r\n uint32 public immutable incrementFreezeWindow;\r\n\r\n struct Weight {\r\n uint112 storedWeight;\r\n uint112 currentWeight;\r\n uint32 currentCycle;\r\n }\r\n\r\n /// @notice a mapping from users to gauges to a user's allocated weight to that gauge\r\n mapping(address => mapping(address => uint112)) public getUserGaugeWeight;\r\n\r\n /// @notice a mapping from a user to their total allocated weight across all gauges\r\n /// @dev NOTE this may contain weights for deprecated gauges\r\n mapping(address => uint112) public getUserWeight;\r\n\r\n /// @notice a mapping from a gauge to the total weight allocated to it\r\n /// @dev NOTE this may contain weights for deprecated gauges\r\n mapping(address => Weight) internal _getGaugeWeight;\r\n\r\n /// @notice the total global allocated weight ONLY of live gauges\r\n Weight internal _totalWeight;\r\n\r\n mapping(address => EnumerableSet.AddressSet) internal _userGauges;\r\n\r\n EnumerableSet.AddressSet internal _gauges;\r\n\r\n // Store deprecated gauges in case a user needs to free dead weight\r\n EnumerableSet.AddressSet internal _deprecatedGauges;\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n VIEW HELPERS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice return the end of the current cycle. This is the next unix timestamp which evenly divides `gaugeCycleLength`\r\n function getGaugeCycleEnd() public view returns (uint32) {\r\n return _getGaugeCycleEnd();\r\n }\r\n\r\n /// @notice see `getGaugeCycleEnd()`\r\n function _getGaugeCycleEnd() internal view returns (uint32) {\r\n uint32 nowPlusOneCycle = block.timestamp.safeCastTo32() + gaugeCycleLength;\r\n unchecked {\r\n return (nowPlusOneCycle / gaugeCycleLength) * gaugeCycleLength; // cannot divide by zero and always <= nowPlusOneCycle so no overflow\r\n }\r\n }\r\n\r\n /// @notice returns the current weight of a given gauge\r\n function getGaugeWeight(address gauge) public view returns (uint112) {\r\n return _getGaugeWeight[gauge].currentWeight;\r\n }\r\n\r\n /// @notice returns the stored weight of a given gauge. This is the snapshotted weight as-of the end of the last cycle.\r\n function getStoredGaugeWeight(address gauge) public view returns (uint112) {\r\n if (_deprecatedGauges.contains(gauge)) return 0;\r\n return _getStoredWeight(_getGaugeWeight[gauge], _getGaugeCycleEnd());\r\n }\r\n\r\n /// @notice see `getStoredGaugeWeight()`\r\n function _getStoredWeight(Weight storage gaugeWeight, uint32 currentCycle) internal view returns (uint112) {\r\n return gaugeWeight.currentCycle < currentCycle ? gaugeWeight.currentWeight : gaugeWeight.storedWeight;\r\n }\r\n\r\n /// @notice returns the current total allocated weight\r\n function totalWeight() external view returns (uint112) {\r\n return _totalWeight.currentWeight;\r\n }\r\n\r\n /// @notice returns the stored total allocated weight\r\n function storedTotalWeight() external view returns (uint112) {\r\n return _getStoredWeight(_totalWeight, _getGaugeCycleEnd());\r\n }\r\n\r\n /// @notice returns the set of live gauges\r\n function gauges() external view returns (address[] memory) {\r\n return _gauges.values();\r\n }\r\n\r\n /** \r\n @notice returns a paginated subset of live gauges\r\n @param offset the index of the first gauge element to read\r\n @param num the number of gauges to return\r\n */\r\n function gauges(uint256 offset, uint256 num) external view returns (address[] memory values) {\r\n values = new address[](num);\r\n for (uint256 i = 0; i < num; ) {\r\n unchecked {\r\n values[i] = _gauges.at(offset + i); // will revert if out of bounds\r\n i++;\r\n }\r\n }\r\n }\r\n\r\n /// @notice returns true if `gauge` is not in deprecated gauges\r\n function isGauge(address gauge) external view returns (bool) {\r\n return _gauges.contains(gauge) && !_deprecatedGauges.contains(gauge);\r\n }\r\n\r\n /// @notice returns the number of live gauges\r\n function numGauges() external view returns (uint256) {\r\n return _gauges.length();\r\n }\r\n\r\n /// @notice returns the set of previously live but now deprecated gauges\r\n function deprecatedGauges() external view returns (address[] memory) {\r\n return _deprecatedGauges.values();\r\n }\r\n\r\n /// @notice returns the number of live gauges\r\n function numDeprecatedGauges() external view returns (uint256) {\r\n return _deprecatedGauges.length();\r\n }\r\n\r\n /// @notice returns the set of gauges the user has allocated to, may be live or deprecated.\r\n function userGauges(address user) external view returns (address[] memory) {\r\n return _userGauges[user].values();\r\n }\r\n\r\n /// @notice returns true if `gauge` is in user gauges\r\n function isUserGauge(address user, address gauge) external view returns (bool) {\r\n return _userGauges[user].contains(gauge);\r\n }\r\n\r\n /** \r\n @notice returns a paginated subset of gauges the user has allocated to, may be live or deprecated.\r\n @param user the user to return gauges from.\r\n @param offset the index of the first gauge element to read.\r\n @param num the number of gauges to return.\r\n */\r\n function userGauges(\r\n address user,\r\n uint256 offset,\r\n uint256 num\r\n ) external view returns (address[] memory values) {\r\n values = new address[](num);\r\n for (uint256 i = 0; i < num; ) {\r\n unchecked {\r\n values[i] = _userGauges[user].at(offset + i); // will revert if out of bounds\r\n i++;\r\n }\r\n }\r\n }\r\n\r\n /// @notice returns the number of user gauges\r\n function numUserGauges(address user) external view returns (uint256) {\r\n return _userGauges[user].length();\r\n }\r\n\r\n /// @notice helper function exposing the amount of weight available to allocate for a user\r\n function userUnusedWeight(address user) external view returns (uint256) {\r\n return balanceOf[user] - getUserWeight[user];\r\n }\r\n\r\n /** \r\n @notice helper function for calculating the proportion of a `quantity` allocated to a gauge\r\n @param gauge the gauge to calculate allocation of\r\n @param quantity a representation of a resource to be shared among all gauges\r\n @return the proportion of `quantity` allocated to `gauge`. Returns 0 if gauge is not live, even if it has weight.\r\n */\r\n function calculateGaugeAllocation(address gauge, uint256 quantity) external view returns (uint256) {\r\n if (_deprecatedGauges.contains(gauge)) return 0;\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n uint112 total = _getStoredWeight(_totalWeight, currentCycle);\r\n uint112 weight = _getStoredWeight(_getGaugeWeight[gauge], currentCycle);\r\n return (quantity * weight) / total;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n USER GAUGE OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice thrown when trying to increment/decrement a mismatched number of gauges and weights.\r\n error SizeMismatchError();\r\n\r\n /// @notice thrown when trying to increment over the max allowed gauges.\r\n error MaxGaugeError();\r\n\r\n /// @notice thrown when incrementing over a users free weight.\r\n error OverWeightError();\r\n\r\n /// @notice thrown when incremending during the freeze window.\r\n error IncrementFreezeError();\r\n\r\n /// @notice emitted when incrementing a gauge\r\n event IncrementGaugeWeight(address indexed user, address indexed gauge, uint256 weight, uint32 cycleEnd);\r\n\r\n /// @notice emitted when decrementing a gauge\r\n event DecrementGaugeWeight(address indexed user, address indexed gauge, uint256 weight, uint32 cycleEnd);\r\n\r\n /** \r\n @notice increment a gauge with some weight for the caller\r\n @param gauge the gauge to increment\r\n @param weight the amount of weight to increment on gauge\r\n @return newUserWeight the new user weight\r\n */\r\n function incrementGauge(address gauge, uint112 weight) external returns (uint112 newUserWeight) {\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n _incrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\r\n return _incrementUserAndGlobalWeights(msg.sender, weight, currentCycle);\r\n }\r\n\r\n function _incrementGaugeWeight(\r\n address user,\r\n address gauge,\r\n uint112 weight,\r\n uint32 cycle\r\n ) internal {\r\n if (_deprecatedGauges.contains(gauge)) revert InvalidGaugeError();\r\n unchecked {\r\n if (cycle - block.timestamp <= incrementFreezeWindow) revert IncrementFreezeError();\r\n }\r\n\r\n bool added = _userGauges[user].add(gauge); // idempotent add\r\n if (added && _userGauges[user].length() > maxGauges && !canContractExceedMaxGauges[user])\r\n revert MaxGaugeError();\r\n\r\n getUserGaugeWeight[user][gauge] += weight;\r\n\r\n _writeGaugeWeight(_getGaugeWeight[gauge], _add, weight, cycle);\r\n\r\n emit IncrementGaugeWeight(user, gauge, weight, cycle);\r\n }\r\n\r\n function _incrementUserAndGlobalWeights(\r\n address user,\r\n uint112 weight,\r\n uint32 cycle\r\n ) internal returns (uint112 newUserWeight) {\r\n newUserWeight = getUserWeight[user] + weight;\r\n // Ensure under weight\r\n if (newUserWeight > balanceOf[user]) revert OverWeightError();\r\n\r\n // Update gauge state\r\n getUserWeight[user] = newUserWeight;\r\n\r\n _writeGaugeWeight(_totalWeight, _add, weight, cycle);\r\n }\r\n\r\n /** \r\n @notice increment a list of gauges with some weights for the caller\r\n @param gaugeList the gauges to increment\r\n @param weights the weights to increment by\r\n @return newUserWeight the new user weight\r\n */\r\n function incrementGauges(address[] calldata gaugeList, uint112[] calldata weights)\r\n external\r\n returns (uint256 newUserWeight)\r\n {\r\n uint256 size = gaugeList.length;\r\n if (weights.length != size) revert SizeMismatchError();\r\n\r\n // store total in summary for batch update on user/global state\r\n uint112 weightsSum;\r\n\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n // Update gauge specific state\r\n for (uint256 i = 0; i < size; ) {\r\n address gauge = gaugeList[i];\r\n uint112 weight = weights[i];\r\n weightsSum += weight;\r\n\r\n _incrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\r\n unchecked {\r\n i++;\r\n }\r\n }\r\n return _incrementUserAndGlobalWeights(msg.sender, weightsSum, currentCycle);\r\n }\r\n\r\n /** \r\n @notice decrement a gauge with some weight for the caller\r\n @param gauge the gauge to decrement\r\n @param weight the amount of weight to decrement on gauge\r\n @return newUserWeight the new user weight\r\n */\r\n function decrementGauge(address gauge, uint112 weight) external returns (uint112 newUserWeight) {\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n // All operations will revert on underflow, protecting against bad inputs\r\n _decrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\r\n return _decrementUserAndGlobalWeights(msg.sender, weight, currentCycle);\r\n }\r\n\r\n function _decrementGaugeWeight(\r\n address user,\r\n address gauge,\r\n uint112 weight,\r\n uint32 cycle\r\n ) internal {\r\n uint112 oldWeight = getUserGaugeWeight[user][gauge];\r\n\r\n getUserGaugeWeight[user][gauge] = oldWeight - weight;\r\n if (oldWeight == weight) {\r\n // If removing all weight, remove gauge from user list.\r\n require(_userGauges[user].remove(gauge));\r\n }\r\n\r\n _writeGaugeWeight(_getGaugeWeight[gauge], _subtract, weight, cycle);\r\n\r\n emit DecrementGaugeWeight(user, gauge, weight, cycle);\r\n }\r\n\r\n function _decrementUserAndGlobalWeights(\r\n address user,\r\n uint112 weight,\r\n uint32 cycle\r\n ) internal returns (uint112 newUserWeight) {\r\n newUserWeight = getUserWeight[user] - weight;\r\n\r\n getUserWeight[user] = newUserWeight;\r\n _writeGaugeWeight(_totalWeight, _subtract, weight, cycle);\r\n }\r\n\r\n /** \r\n @notice decrement a list of gauges with some weights for the caller\r\n @param gaugeList the gauges to decrement\r\n @param weights the list of weights to decrement on the gauges\r\n @return newUserWeight the new user weight\r\n */\r\n function decrementGauges(address[] calldata gaugeList, uint112[] calldata weights)\r\n external\r\n returns (uint112 newUserWeight)\r\n {\r\n uint256 size = gaugeList.length;\r\n if (weights.length != size) revert SizeMismatchError();\r\n\r\n // store total in summary for batch update on user/global state\r\n uint112 weightsSum;\r\n\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n // Update gauge specific state\r\n // All operations will revert on underflow, protecting against bad inputs\r\n for (uint256 i = 0; i < size; ) {\r\n address gauge = gaugeList[i];\r\n uint112 weight = weights[i];\r\n weightsSum += weight;\r\n\r\n _decrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\r\n unchecked {\r\n i++;\r\n }\r\n }\r\n return _decrementUserAndGlobalWeights(msg.sender, weightsSum, currentCycle);\r\n }\r\n\r\n /**\r\n @dev this function is the key to the entire contract.\r\n The storage weight it operates on is either a global or gauge-specific weight.\r\n The operation applied is either addition for incrementing gauges or subtraction for decrementing a gauge.\r\n */\r\n function _writeGaugeWeight(\r\n Weight storage weight,\r\n function(uint112, uint112) view returns (uint112) op,\r\n uint112 delta,\r\n uint32 cycle\r\n ) private {\r\n uint112 currentWeight = weight.currentWeight;\r\n // If the last cycle of the weight is before the current cycle, use the current weight as the stored.\r\n uint112 stored = weight.currentCycle < cycle ? currentWeight : weight.storedWeight;\r\n uint112 newWeight = op(currentWeight, delta);\r\n\r\n weight.storedWeight = stored;\r\n weight.currentWeight = newWeight;\r\n weight.currentCycle = cycle;\r\n }\r\n\r\n function _add(uint112 a, uint112 b) private pure returns (uint112) {\r\n return a + b;\r\n }\r\n\r\n function _subtract(uint112 a, uint112 b) private pure returns (uint112) {\r\n return a - b;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ADMIN GAUGE OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice thrown when trying to increment or remove a non-live gauge, or add a live gauge.\r\n error InvalidGaugeError();\r\n\r\n /// @notice emitted when adding a new gauge to the live set.\r\n event AddGauge(address indexed gauge);\r\n\r\n /// @notice emitted when removing a gauge from the live set.\r\n event RemoveGauge(address indexed gauge);\r\n\r\n /// @notice emitted when updating the max number of gauges a user can delegate to.\r\n event MaxGaugesUpdate(uint256 oldMaxGauges, uint256 newMaxGauges);\r\n\r\n /// @notice emitted when changing a contract's approval to go over the max gauges.\r\n event CanContractExceedMaxGaugesUpdate(address indexed account, bool canContractExceedMaxGauges);\r\n\r\n /// @notice the default maximum amount of gauges a user can allocate to.\r\n /// @dev if this number is ever lowered, or a contract has an override, then existing addresses MAY have more gauges allocated to. Use `numUserGauges` to check this.\r\n uint256 public maxGauges;\r\n\r\n /// @notice an approve list for contracts to go above the max gauge limit.\r\n mapping(address => bool) public canContractExceedMaxGauges;\r\n\r\n /// @notice add a new gauge. Requires auth by `authority`.\r\n function addGauge(address gauge) external requiresAuth returns (uint112) {\r\n return _addGauge(gauge);\r\n }\r\n\r\n function _addGauge(address gauge) internal returns (uint112 weight) {\r\n bool newAdd = _gauges.add(gauge);\r\n bool previouslyDeprecated = _deprecatedGauges.remove(gauge);\r\n // add and fail loud if zero address or already present and not deprecated\r\n if (gauge == address(0) || !(newAdd || previouslyDeprecated)) revert InvalidGaugeError();\r\n\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n // Check if some previous weight exists and re-add to total. Gauge and user weights are preserved.\r\n weight = _getGaugeWeight[gauge].currentWeight;\r\n if (weight > 0) {\r\n _writeGaugeWeight(_totalWeight, _add, weight, currentCycle);\r\n }\r\n\r\n emit AddGauge(gauge);\r\n }\r\n\r\n /// @notice remove a new gauge. Requires auth by `authority`.\r\n function removeGauge(address gauge) external requiresAuth {\r\n _removeGauge(gauge);\r\n }\r\n\r\n function _removeGauge(address gauge) internal {\r\n // add to deprecated and fail loud if not present\r\n if (!_deprecatedGauges.add(gauge)) revert InvalidGaugeError();\r\n\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n // Remove weight from total but keep the gauge and user weights in storage in case gauge is re-added.\r\n uint112 weight = _getGaugeWeight[gauge].currentWeight;\r\n if (weight > 0) {\r\n _writeGaugeWeight(_totalWeight, _subtract, weight, currentCycle);\r\n }\r\n\r\n emit RemoveGauge(gauge);\r\n }\r\n\r\n /// @notice replace a gauge. Requires auth by `authority`.\r\n function replaceGauge(address oldGauge, address newGauge) external requiresAuth {\r\n _removeGauge(oldGauge);\r\n _addGauge(newGauge);\r\n }\r\n\r\n /// @notice set the new max gauges. Requires auth by `authority`.\r\n /// @dev if this is set to a lower number than the current max, users MAY have more gauges active than the max. Use `numUserGauges` to check this.\r\n function setMaxGauges(uint256 newMax) external requiresAuth {\r\n uint256 oldMax = maxGauges;\r\n maxGauges = newMax;\r\n\r\n emit MaxGaugesUpdate(oldMax, newMax);\r\n }\r\n\r\n /// @notice set the canContractExceedMaxGauges flag for an account.\r\n function setContractExceedMaxGauges(address account, bool canExceedMax) external requiresAuth {\r\n if (canExceedMax && account.code.length == 0) revert Errors_ERC20Gauges.NonContractError(); // can only approve contracts\r\n\r\n canContractExceedMaxGauges[account] = canExceedMax;\r\n\r\n emit CanContractExceedMaxGaugesUpdate(account, canExceedMax);\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ERC20 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// NOTE: any \"removal\" of tokens from a user requires userUnusedWeight < amount.\r\n /// _decrementWeightUntilFree is called as a greedy algorithm to free up weight.\r\n /// It may be more gas efficient to free weight before burning or transferring tokens.\r\n\r\n function _burn(address from, uint256 amount) internal virtual override {\r\n _decrementWeightUntilFree(from, amount);\r\n super._burn(from, amount);\r\n }\r\n\r\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\r\n _decrementWeightUntilFree(msg.sender, amount);\r\n return super.transfer(to, amount);\r\n }\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _decrementWeightUntilFree(from, amount);\r\n return super.transferFrom(from, to, amount);\r\n }\r\n\r\n /// a greedy algorithm for freeing weight before a token burn/transfer\r\n /// frees up entire gauges, so likely will free more than `weight`\r\n function _decrementWeightUntilFree(address user, uint256 weight) internal {\r\n uint256 userFreeWeight = balanceOf[user] - getUserWeight[user];\r\n\r\n // early return if already free\r\n if (userFreeWeight >= weight) return;\r\n\r\n uint32 currentCycle = _getGaugeCycleEnd();\r\n\r\n // cache totals for batch updates\r\n uint112 userFreed;\r\n uint112 totalFreed;\r\n\r\n // Loop through all user gauges, live and deprecated\r\n address[] memory gaugeList = _userGauges[user].values();\r\n\r\n // Free gauges until through entire list or under weight\r\n uint256 size = gaugeList.length;\r\n for (uint256 i = 0; i < size && (userFreeWeight + totalFreed) < weight; ) {\r\n address gauge = gaugeList[i];\r\n uint112 userGaugeWeight = getUserGaugeWeight[user][gauge];\r\n if (userGaugeWeight != 0) {\r\n // If the gauge is live (not deprecated), include its weight in the total to remove\r\n if (!_deprecatedGauges.contains(gauge)) {\r\n totalFreed += userGaugeWeight;\r\n }\r\n userFreed += userGaugeWeight;\r\n _decrementGaugeWeight(user, gauge, userGaugeWeight, currentCycle);\r\n\r\n unchecked {\r\n i++;\r\n }\r\n }\r\n }\r\n\r\n getUserWeight[user] -= userFreed;\r\n _writeGaugeWeight(_totalWeight, _subtract, totalFreed, currentCycle);\r\n }\r\n}" + }, + "contracts/test/IonicFlywheel/token/ERC20MultiVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// Voting logic inspired by OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"solmate/auth/Auth.sol\";\r\nimport \"solmate/tokens/ERC20.sol\";\r\nimport \"solmate/utils/SafeCastLib.sol\";\r\nimport \"../lib/EnumerableSet.sol\";\r\nimport \"../interfaces/Errors.sol\";\r\n\r\n/**\r\n @title ERC20 Multi-Delegation Voting contract\r\n @notice an ERC20 extension which allows delegations to multiple delegatees up to a user's balance on a given block.\r\n */\r\nabstract contract ERC20MultiVotes is ERC20, Auth {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeCastLib for *;\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n VOTE CALCULATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice thrown when trying to read from an invalid block.\r\n error BlockError();\r\n\r\n struct Checkpoint {\r\n uint32 fromBlock;\r\n uint224 votes;\r\n }\r\n\r\n /// @notice votes checkpoint list per user.\r\n mapping(address => Checkpoint[]) private _checkpoints;\r\n\r\n /// @notice Get the `pos`-th checkpoint for `account`.\r\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\r\n return _checkpoints[account][pos];\r\n }\r\n\r\n /// @notice Get number of checkpoints for `account`.\r\n function numCheckpoints(address account) public view virtual returns (uint32) {\r\n return _checkpoints[account].length.safeCastTo32();\r\n }\r\n\r\n /**\r\n * @notice Gets the amount of unallocated votes for `account`.\r\n * @param account the address to get free votes of.\r\n * @return the amount of unallocated votes.\r\n */\r\n function freeVotes(address account) public view virtual returns (uint256) {\r\n return balanceOf[account] - userDelegatedVotes[account];\r\n }\r\n\r\n /**\r\n * @notice Gets the current votes balance for `account`.\r\n * @param account the address to get votes of.\r\n * @return the amount of votes.\r\n */\r\n function getVotes(address account) public view virtual returns (uint256) {\r\n uint256 pos = _checkpoints[account].length;\r\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\r\n }\r\n\r\n /**\r\n * @notice Retrieve the number of votes for `account` at the end of `blockNumber`.\r\n * @param account the address to get votes of.\r\n * @param blockNumber the block to calculate votes for.\r\n * @return the amount of votes.\r\n */\r\n function getPastVotes(address account, uint256 blockNumber) public view virtual returns (uint256) {\r\n if (blockNumber >= block.number) revert BlockError();\r\n return _checkpointsLookup(_checkpoints[account], blockNumber);\r\n }\r\n\r\n /// @dev Lookup a value in a list of (sorted) checkpoints.\r\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\r\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\r\n uint256 high = ckpts.length;\r\n uint256 low = 0;\r\n while (low < high) {\r\n uint256 mid = average(low, high);\r\n if (ckpts[mid].fromBlock > blockNumber) {\r\n high = mid;\r\n } else {\r\n low = mid + 1;\r\n }\r\n }\r\n\r\n return high == 0 ? 0 : ckpts[high - 1].votes;\r\n }\r\n\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow.\r\n return (a & b) + (a ^ b) / 2;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ADMIN OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @notice emitted when updating the maximum amount of delegates per user\r\n event MaxDelegatesUpdate(uint256 oldMaxDelegates, uint256 newMaxDelegates);\r\n\r\n /// @notice emitted when updating the canContractExceedMaxDelegates flag for an account\r\n event CanContractExceedMaxDelegatesUpdate(address indexed account, bool canContractExceedMaxDelegates);\r\n\r\n /// @notice the maximum amount of delegates for a user at a given time\r\n uint256 public maxDelegates;\r\n\r\n /// @notice an approve list for contracts to go above the max delegate limit.\r\n mapping(address => bool) public canContractExceedMaxDelegates;\r\n\r\n /// @notice set the new max delegates per user. Requires auth by `authority`.\r\n function setMaxDelegates(uint256 newMax) external requiresAuth {\r\n uint256 oldMax = maxDelegates;\r\n maxDelegates = newMax;\r\n\r\n emit MaxDelegatesUpdate(oldMax, newMax);\r\n }\r\n\r\n /// @notice set the canContractExceedMaxDelegates flag for an account.\r\n function setContractExceedMaxDelegates(address account, bool canExceedMax) external requiresAuth {\r\n if (canExceedMax && account.code.length == 0) revert Errors.NonContractError(); // can only approve contracts\r\n\r\n canContractExceedMaxDelegates[account] = canExceedMax;\r\n\r\n emit CanContractExceedMaxDelegatesUpdate(account, canExceedMax);\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n DELEGATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// @dev Emitted when a `delegator` delegates `amount` votes to `delegate`.\r\n event Delegation(address indexed delegator, address indexed delegate, uint256 amount);\r\n\r\n /// @dev Emitted when a `delegator` undelegates `amount` votes from `delegate`.\r\n event Undelegation(address indexed delegator, address indexed delegate, uint256 amount);\r\n\r\n /// @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.\r\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\r\n\r\n /// @notice An event thats emitted when an account changes its delegate\r\n /// @dev this is used for backward compatibility with OZ interfaces for ERC20Votes and ERC20VotesComp.\r\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\r\n\r\n /// @dev thrown when attempting to delegate more votes than an address has free, or exceeding the max delegates\r\n error DelegationError();\r\n\r\n /// @notice mapping from a delegator and delegatee to the delegated amount.\r\n mapping(address => mapping(address => uint256)) private _delegatesVotesCount;\r\n\r\n /// @notice mapping from a delegator to the total number of delegated votes.\r\n mapping(address => uint256) public userDelegatedVotes;\r\n\r\n /// @notice list of delegates per user.\r\n mapping(address => EnumerableSet.AddressSet) private _delegates;\r\n\r\n /**\r\n * @notice Get the amount of votes currently delegated by `delegator` to `delegatee`.\r\n * @param delegator the account which is delegating votes to `delegatee`.\r\n * @param delegatee the account receiving votes from `delegator`.\r\n * @return the total amount of votes delegated to `delegatee` by `delegator`\r\n */\r\n function delegatesVotesCount(address delegator, address delegatee) public view virtual returns (uint256) {\r\n return _delegatesVotesCount[delegator][delegatee];\r\n }\r\n\r\n /**\r\n * @notice Get the list of delegates from `delegator`.\r\n * @param delegator the account which is delegating votes to delegates.\r\n * @return the list of delegated accounts.\r\n */\r\n function delegates(address delegator) public view returns (address[] memory) {\r\n return _delegates[delegator].values();\r\n }\r\n\r\n /**\r\n * @notice Get the number of delegates from `delegator`.\r\n * @param delegator the account which is delegating votes to delegates.\r\n * @return the number of delegated accounts.\r\n */\r\n function delegateCount(address delegator) public view returns (uint256) {\r\n return _delegates[delegator].length();\r\n }\r\n\r\n /**\r\n * @notice Delegate `amount` votes from the sender to `delegatee`.\r\n * @param delegatee the receivier of votes.\r\n * @param amount the amount of votes received.\r\n * @dev requires \"freeVotes(msg.sender) > amount\" and will not exceed max delegates\r\n */\r\n function incrementDelegation(address delegatee, uint256 amount) public virtual {\r\n _incrementDelegation(msg.sender, delegatee, amount);\r\n }\r\n\r\n /**\r\n * @notice Undelegate `amount` votes from the sender from `delegatee`.\r\n * @param delegatee the receivier of undelegation.\r\n * @param amount the amount of votes taken away.\r\n */\r\n function undelegate(address delegatee, uint256 amount) public virtual {\r\n _undelegate(msg.sender, delegatee, amount);\r\n }\r\n\r\n /**\r\n * @notice Delegate all votes `newDelegatee`. First undelegates from an existing delegate. If `newDelegatee` is zero, only undelegates.\r\n * @param newDelegatee the receiver of votes.\r\n * @dev undefined for `delegateCount(msg.sender) > 1`\r\n * NOTE This is meant for backward compatibility with the `ERC20Votes` and `ERC20VotesComp` interfaces from OpenZeppelin.\r\n */\r\n function delegate(address newDelegatee) external virtual {\r\n _delegate(msg.sender, newDelegatee);\r\n }\r\n\r\n function _delegate(address delegator, address newDelegatee) internal virtual {\r\n uint256 count = delegateCount(delegator);\r\n\r\n // undefined behavior for delegateCount > 1\r\n if (count > 1) revert DelegationError();\r\n\r\n address oldDelegatee;\r\n // if already delegated, undelegate first\r\n if (count == 1) {\r\n oldDelegatee = _delegates[delegator].at(0);\r\n _undelegate(delegator, oldDelegatee, _delegatesVotesCount[delegator][oldDelegatee]);\r\n }\r\n\r\n // redelegate only if newDelegatee is not empty\r\n if (newDelegatee != address(0)) {\r\n _incrementDelegation(delegator, newDelegatee, freeVotes(delegator));\r\n }\r\n emit DelegateChanged(delegator, oldDelegatee, newDelegatee);\r\n }\r\n\r\n function _incrementDelegation(\r\n address delegator,\r\n address delegatee,\r\n uint256 amount\r\n ) internal virtual {\r\n // Require freeVotes exceed the delegation size\r\n uint256 free = freeVotes(delegator);\r\n if (delegatee == address(0) || free < amount) revert DelegationError();\r\n\r\n bool newDelegate = _delegates[delegator].add(delegatee); // idempotent add\r\n if (newDelegate && delegateCount(delegator) > maxDelegates && !canContractExceedMaxDelegates[delegator]) {\r\n // if new delegate and exceeds max and not approved to exceed, revert\r\n revert DelegationError();\r\n }\r\n\r\n _delegatesVotesCount[delegator][delegatee] += amount;\r\n userDelegatedVotes[delegator] += amount;\r\n\r\n emit Delegation(delegator, delegatee, amount);\r\n _writeCheckpoint(delegatee, _add, amount);\r\n }\r\n\r\n function _undelegate(\r\n address delegator,\r\n address delegatee,\r\n uint256 amount\r\n ) internal virtual {\r\n uint256 newDelegates = _delegatesVotesCount[delegator][delegatee] - amount;\r\n\r\n if (newDelegates == 0) {\r\n require(_delegates[delegator].remove(delegatee));\r\n }\r\n\r\n _delegatesVotesCount[delegator][delegatee] = newDelegates;\r\n userDelegatedVotes[delegator] -= amount;\r\n\r\n emit Undelegation(delegator, delegatee, amount);\r\n _writeCheckpoint(delegatee, _subtract, amount);\r\n }\r\n\r\n function _writeCheckpoint(\r\n address delegatee,\r\n function(uint256, uint256) view returns (uint256) op,\r\n uint256 delta\r\n ) private {\r\n Checkpoint[] storage ckpts = _checkpoints[delegatee];\r\n\r\n uint256 pos = ckpts.length;\r\n uint256 oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\r\n uint256 newWeight = op(oldWeight, delta);\r\n\r\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\r\n ckpts[pos - 1].votes = newWeight.safeCastTo224();\r\n } else {\r\n ckpts.push(Checkpoint({fromBlock: block.number.safeCastTo32(), votes: newWeight.safeCastTo224()}));\r\n }\r\n emit DelegateVotesChanged(delegatee, oldWeight, newWeight);\r\n }\r\n\r\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\r\n return a + b;\r\n }\r\n\r\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\r\n return a - b;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n ERC20 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n /// NOTE: any \"removal\" of tokens from a user requires freeVotes(user) < amount.\r\n /// _decrementVotesUntilFree is called as a greedy algorithm to free up votes.\r\n /// It may be more gas efficient to free weight before burning or transferring tokens.\r\n\r\n function _burn(address from, uint256 amount) internal virtual override {\r\n _decrementVotesUntilFree(from, amount);\r\n super._burn(from, amount);\r\n }\r\n\r\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\r\n _decrementVotesUntilFree(msg.sender, amount);\r\n return super.transfer(to, amount);\r\n }\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _decrementVotesUntilFree(from, amount);\r\n return super.transferFrom(from, to, amount);\r\n }\r\n\r\n /// a greedy algorithm for freeing votes before a token burn/transfer\r\n /// frees up entire delegates, so likely will free more than `votes`\r\n function _decrementVotesUntilFree(address user, uint256 votes) internal {\r\n uint256 userFreeVotes = freeVotes(user);\r\n\r\n // early return if already free\r\n if (userFreeVotes >= votes) return;\r\n\r\n // cache total for batch updates\r\n uint256 totalFreed;\r\n\r\n // Loop through all delegates\r\n address[] memory delegateList = _delegates[user].values();\r\n\r\n // Free delegates until through entire list or under votes amount\r\n uint256 size = delegateList.length;\r\n for (uint256 i = 0; i < size && (userFreeVotes + totalFreed) < votes; i++) {\r\n address delegatee = delegateList[i];\r\n uint256 delegateVotes = _delegatesVotesCount[user][delegatee];\r\n if (delegateVotes != 0) {\r\n totalFreed += delegateVotes;\r\n\r\n require(_delegates[user].remove(delegatee)); // Remove from set. Should never fail.\r\n\r\n _delegatesVotesCount[user][delegatee] = 0;\r\n\r\n _writeCheckpoint(delegatee, _subtract, delegateVotes);\r\n emit Undelegation(user, delegatee, delegateVotes);\r\n }\r\n }\r\n\r\n userDelegatedVotes[user] -= totalFreed;\r\n }\r\n\r\n /*///////////////////////////////////////////////////////////////\r\n EIP-712 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n bytes32 public constant DELEGATION_TYPEHASH =\r\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\r\n\r\n function delegateBySig(\r\n address delegatee,\r\n uint256 nonce,\r\n uint256 expiry,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) public {\r\n require(block.timestamp <= expiry, \"ERC20MultiVotes: signature expired\");\r\n address signer = ecrecover(\r\n keccak256(\r\n abi.encodePacked(\r\n \"\\x19\\x01\",\r\n DOMAIN_SEPARATOR(),\r\n keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry))\r\n )\r\n ),\r\n v,\r\n r,\r\n s\r\n );\r\n require(nonce == nonces[signer]++, \"ERC20MultiVotes: invalid nonce\");\r\n require(signer != address(0));\r\n _delegate(signer, delegatee);\r\n }\r\n}" + }, + "contracts/test/IonicFlywheel/token/FlywheelGaugeRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\r\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\r\n\r\nimport \"../../../ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol\";\r\nimport {ERC20Gauges} from \"../token/ERC20Gauges.sol\";\r\n\r\n/// @notice a contract which streams reward tokens to the FlywheelRewards module\r\ninterface IRewardsStream {\r\n /// @notice read and transfer reward token chunk to FlywheelRewards module\r\n function getRewards() external returns (uint256);\r\n}\r\n\r\n/**\r\n @title Flywheel Gauge Reward Stream\r\n @notice Distributes rewards from a stream based on gauge weights\r\n\r\n The contract assumes an arbitrary stream of rewards `S` of rewardToken. It chunks the rewards into cycles of length `l`.\r\n\r\n The allocation function for each cycle A(g, S) proportions the stream to each gauge such that SUM(A(g, S)) over all gauges <= S.\r\n NOTE it should be approximately S, but may be less due to truncation.\r\n\r\n Rewards are accumulated every time a new rewards cycle begins, and all prior rewards are cached in the previous cycle.\r\n When the Flywheel Core requests accrued rewards for a specific gauge:\r\n 1. All prior rewards before this cycle are distributed\r\n 2. Rewards for the current cycle are distributed proportionally to the remaining time in the cycle.\r\n If `e` is the cycle end, `t` is the min of e and current timestamp, and `p` is the prior updated time:\r\n For `A` accrued rewards over the cycle, distribute `min(A * (t-p)/(e-p), A)`.\r\n*/\r\ncontract FlywheelGaugeRewards is Auth, BaseFlywheelRewards {\r\n using SafeTransferLib for ERC20;\r\n using SafeCastLib for uint256;\r\n\r\n /// @notice thrown when trying to queue a new cycle during an old one.\r\n error CycleError();\r\n\r\n /// @notice thrown when trying to queue with 0 gauges\r\n error EmptyGaugesError();\r\n\r\n /// @notice emitted when a cycle has completely queued and started\r\n event CycleStart(uint32 indexed cycleStart, uint256 rewardAmount);\r\n\r\n /// @notice emitted when a single gauge is queued. May be emitted before the cycle starts if the queue is done via pagination.\r\n event QueueRewards(address indexed gauge, uint32 indexed cycleStart, uint256 rewardAmount);\r\n\r\n /// @notice the start of the current cycle\r\n uint32 public gaugeCycle;\r\n\r\n /// @notice the length of a rewards cycle\r\n uint32 public immutable gaugeCycleLength;\r\n\r\n /// @notice the start of the next cycle being partially queued\r\n uint32 internal nextCycle;\r\n\r\n // rewards that made it into a partial queue but didn't get completed\r\n uint112 internal nextCycleQueuedRewards;\r\n\r\n // the offset during pagination of the queue\r\n uint32 internal paginationOffset;\r\n\r\n /// @notice rewards queued from prior and current cycles\r\n struct QueuedRewards {\r\n uint112 priorCycleRewards;\r\n uint112 cycleRewards;\r\n uint32 storedCycle;\r\n }\r\n\r\n /// @notice mapping from gauges to queued rewards\r\n mapping(ERC20 => QueuedRewards) public gaugeQueuedRewards;\r\n\r\n /// @notice the gauge token for determining gauge allocations of the rewards stream\r\n ERC20Gauges public immutable gaugeToken;\r\n\r\n /// @notice contract to pull reward tokens from\r\n IRewardsStream public rewardsStream;\r\n\r\n constructor(\r\n IonicFlywheelCore _flywheel,\r\n address _owner,\r\n Authority _authority,\r\n ERC20Gauges _gaugeToken,\r\n IRewardsStream _rewardsStream\r\n ) BaseFlywheelRewards(_flywheel) Auth(_owner, _authority) {\r\n gaugeCycleLength = _gaugeToken.gaugeCycleLength();\r\n\r\n // seed initial gaugeCycle\r\n gaugeCycle = (block.timestamp.safeCastTo32() / gaugeCycleLength) * gaugeCycleLength;\r\n\r\n gaugeToken = _gaugeToken;\r\n\r\n rewardsStream = _rewardsStream;\r\n }\r\n\r\n /**\r\n @notice Iterates over all live gauges and queues up the rewards for the cycle\r\n @return totalQueuedForCycle the max amount of rewards to be distributed over the cycle\r\n */\r\n function queueRewardsForCycle() external requiresAuth returns (uint256 totalQueuedForCycle) {\r\n // next cycle is always the next even divisor of the cycle length above current block timestamp.\r\n uint32 currentCycle = (block.timestamp.safeCastTo32() / gaugeCycleLength) * gaugeCycleLength;\r\n uint32 lastCycle = gaugeCycle;\r\n\r\n // ensure new cycle has begun\r\n if (currentCycle <= lastCycle) revert CycleError();\r\n\r\n gaugeCycle = currentCycle;\r\n\r\n // queue the rewards stream and sanity check the tokens were received\r\n uint256 balanceBefore = rewardToken.balanceOf(address(this));\r\n totalQueuedForCycle = rewardsStream.getRewards();\r\n require(rewardToken.balanceOf(address(this)) - balanceBefore >= totalQueuedForCycle);\r\n\r\n // include uncompleted cycle\r\n totalQueuedForCycle += nextCycleQueuedRewards;\r\n\r\n // iterate over all gauges and update the rewards allocations\r\n address[] memory gauges = gaugeToken.gauges();\r\n\r\n _queueRewards(gauges, currentCycle, lastCycle, totalQueuedForCycle);\r\n\r\n nextCycleQueuedRewards = 0;\r\n paginationOffset = 0;\r\n\r\n emit CycleStart(currentCycle, totalQueuedForCycle);\r\n }\r\n\r\n /**\r\n @notice Iterates over all live gauges and queues up the rewards for the cycle\r\n */\r\n function queueRewardsForCyclePaginated(uint256 numRewards) external requiresAuth {\r\n // next cycle is always the next even divisor of the cycle length above current block timestamp.\r\n uint32 currentCycle = (block.timestamp.safeCastTo32() / gaugeCycleLength) * gaugeCycleLength;\r\n uint32 lastCycle = gaugeCycle;\r\n\r\n // ensure new cycle has begun\r\n if (currentCycle <= lastCycle) revert CycleError();\r\n\r\n if (currentCycle > nextCycle) {\r\n nextCycle = currentCycle;\r\n paginationOffset = 0;\r\n }\r\n\r\n uint32 offset = paginationOffset;\r\n\r\n // important to only calculate the reward amount once to prevent each page from having a different reward amount\r\n if (offset == 0) {\r\n // queue the rewards stream and sanity check the tokens were received\r\n uint256 balanceBefore = rewardToken.balanceOf(address(this));\r\n uint256 newRewards = rewardsStream.getRewards();\r\n require(rewardToken.balanceOf(address(this)) - balanceBefore >= newRewards);\r\n require(newRewards <= type(uint112).max); // safe cast\r\n nextCycleQueuedRewards += uint112(newRewards); // in case a previous incomplete cycle had rewards, add on\r\n }\r\n\r\n uint112 queued = nextCycleQueuedRewards;\r\n\r\n uint256 remaining = gaugeToken.numGauges() - offset;\r\n\r\n // Important to do non-strict inequality to include the case where the numRewards is just enough to complete the cycle\r\n if (remaining <= numRewards) {\r\n numRewards = remaining;\r\n gaugeCycle = currentCycle;\r\n nextCycleQueuedRewards = 0;\r\n paginationOffset = 0;\r\n emit CycleStart(currentCycle, queued);\r\n } else {\r\n paginationOffset = offset + numRewards.safeCastTo32();\r\n }\r\n\r\n // iterate over all gauges and update the rewards allocations\r\n address[] memory gauges = gaugeToken.gauges(offset, numRewards);\r\n\r\n _queueRewards(gauges, currentCycle, lastCycle, queued);\r\n }\r\n\r\n function _queueRewards(\r\n address[] memory gauges,\r\n uint32 currentCycle,\r\n uint32 lastCycle,\r\n uint256 totalQueuedForCycle\r\n ) internal {\r\n uint256 size = gauges.length;\r\n\r\n if (size == 0) revert EmptyGaugesError();\r\n\r\n for (uint256 i = 0; i < size; i++) {\r\n ERC20 gauge = ERC20(gauges[i]);\r\n\r\n QueuedRewards memory queuedRewards = gaugeQueuedRewards[gauge];\r\n\r\n // Cycle queue already started\r\n require(queuedRewards.storedCycle < currentCycle);\r\n assert(queuedRewards.storedCycle == 0 || queuedRewards.storedCycle >= lastCycle);\r\n\r\n uint112 completedRewards = queuedRewards.storedCycle == lastCycle ? queuedRewards.cycleRewards : 0;\r\n uint256 nextRewards = gaugeToken.calculateGaugeAllocation(address(gauge), totalQueuedForCycle);\r\n require(nextRewards <= type(uint112).max); // safe cast\r\n\r\n gaugeQueuedRewards[gauge] = QueuedRewards({\r\n priorCycleRewards: queuedRewards.priorCycleRewards + completedRewards,\r\n cycleRewards: uint112(nextRewards),\r\n storedCycle: currentCycle\r\n });\r\n\r\n emit QueueRewards(address(gauge), currentCycle, nextRewards);\r\n }\r\n }\r\n\r\n /**\r\n @notice calculate and transfer accrued rewards to flywheel core\r\n @param gauge the gauge to accrue rewards for\r\n @param lastUpdatedTimestamp the last updated time for gauge\r\n @return accruedRewards the amount of reward tokens accrued.\r\n */\r\n function getAccruedRewards(ERC20 gauge, uint32 lastUpdatedTimestamp)\r\n external\r\n override\r\n onlyFlywheel\r\n returns (uint256 accruedRewards)\r\n {\r\n QueuedRewards memory queuedRewards = gaugeQueuedRewards[gauge];\r\n\r\n uint32 cycle = gaugeCycle;\r\n bool incompleteCycle = queuedRewards.storedCycle > cycle;\r\n\r\n // no rewards\r\n if (queuedRewards.priorCycleRewards == 0 && (queuedRewards.cycleRewards == 0 || incompleteCycle)) {\r\n return 0;\r\n }\r\n\r\n // if stored cycle != 0 it must be >= the last queued cycle\r\n assert(queuedRewards.storedCycle >= cycle);\r\n\r\n uint32 cycleEnd = cycle + gaugeCycleLength;\r\n\r\n // always accrue prior rewards\r\n accruedRewards = queuedRewards.priorCycleRewards;\r\n uint112 cycleRewardsNext = queuedRewards.cycleRewards;\r\n\r\n if (incompleteCycle) {\r\n // If current cycle queue incomplete, do nothing to current cycle rewards or accrued\r\n } else if (block.timestamp >= cycleEnd) {\r\n // If cycle ended, accrue all rewards\r\n accruedRewards += cycleRewardsNext;\r\n cycleRewardsNext = 0;\r\n } else {\r\n uint32 beginning = lastUpdatedTimestamp > cycle ? lastUpdatedTimestamp : cycle;\r\n\r\n // otherwise, return proportion of remaining rewards in cycle\r\n uint32 elapsed = block.timestamp.safeCastTo32() - beginning;\r\n uint32 remaining = cycleEnd - beginning;\r\n\r\n // Casted up to avoid intermediate overflow\r\n // cannot end in an overflow of uint112 because elapsed <= remaining and cycleRewards <= uint112.max\r\n uint256 currentAccrued = (uint256(queuedRewards.cycleRewards) * elapsed) / remaining;\r\n\r\n // add proportion of current cycle to accrued rewards\r\n accruedRewards += currentAccrued;\r\n cycleRewardsNext -= uint112(currentAccrued);\r\n }\r\n\r\n gaugeQueuedRewards[gauge] = QueuedRewards({\r\n priorCycleRewards: 0,\r\n cycleRewards: cycleRewardsNext,\r\n storedCycle: queuedRewards.storedCycle\r\n });\r\n }\r\n\r\n /// @notice set the rewards stream contract\r\n function setRewardsStream(IRewardsStream newRewardsStream) external requiresAuth {\r\n rewardsStream = newRewardsStream;\r\n }\r\n}" + }, + "contracts/test/irm/InterestRateModelTest.sol": { + "content": "// // SPDX-License-Identifier: UNLICENSED\r\n// pragma solidity >=0.8.0;\r\n\r\n// import { BaseTest } from \"../config/BaseTest.t.sol\";\r\n\r\n// import { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\r\n\r\n// contract InterestRateModelTest is BaseTest {\r\n// AnkrFTMInterestRateModel ankrCertificateInterestRateModelFTM;\r\n// AnkrBNBInterestRateModel ankrCertificateInterestRateModelBNB;\r\n\r\n// JumpRateModel jumpRateModel;\r\n// JumpRateModel mimoRateModel;\r\n\r\n// address ANKR_BNB_RATE_PROVIDER = 0xCb0006B31e6b403fEeEC257A8ABeE0817bEd7eBa;\r\n// address ANKR_BNB_BOND = 0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827;\r\n// address ANKR_FTM_RATE_PROVIDER = 0xB42bF10ab9Df82f9a47B86dd76EEE4bA848d0Fa2;\r\n\r\n// uint8 day = 3;\r\n\r\n// function afterForkSetUp() internal override {\r\n// if (block.chainid == BSC_MAINNET) {\r\n// ankrCertificateInterestRateModelBNB = new AnkrBNBInterestRateModel(\r\n// 10512000,\r\n// 0.5e16,\r\n// 3e18,\r\n// 0.85e18,\r\n// day,\r\n// ANKR_BNB_RATE_PROVIDER,\r\n// ANKR_BNB_BOND\r\n// );\r\n// jumpRateModel = new JumpRateModel(10512000, 0.2e17, 0.18e18, 4e18, 0.8e18);\r\n// } else if (block.chainid == POLYGON_MAINNET) {\r\n// mimoRateModel = new JumpRateModel(13665600, 2e18, 0.4e17, 4e18, 0.8e18);\r\n// jumpRateModel = new JumpRateModel(13665600, 0.2e17, 0.18e18, 2e18, 0.8e18);\r\n// }\r\n// }\r\n\r\n// function testBscIrm() public fork(BSC_MAINNET) {\r\n// testJumpRateBorrowRate();\r\n// testJumpRateSupplyRate();\r\n// testAnkrBNBBorrowModelRate();\r\n// testAnkrBNBSupplyModelRate();\r\n// }\r\n\r\n// function testPolygonIrm() public fork(POLYGON_MAINNET) {\r\n// testJumpRateBorrowRatePolygon();\r\n// }\r\n\r\n// function _convertToPerYearBsc(uint256 value) internal pure returns (uint256) {\r\n// return value * 10512000;\r\n// }\r\n\r\n// function _convertToPerYearPolygon(uint256 value) internal pure returns (uint256) {\r\n// return value * 13665600;\r\n// }\r\n\r\n// function _convertToPerYearFtm(uint256 value) internal pure returns (uint256) {\r\n// return value * 21024000;\r\n// }\r\n\r\n// function testJumpRateBorrowRatePolygon() internal {\r\n// uint256 borrowRate = mimoRateModel.getBorrowRate(0, 0, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// borrowRate = mimoRateModel.getBorrowRate(1e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// borrowRate = mimoRateModel.getBorrowRate(2e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// borrowRate = mimoRateModel.getBorrowRate(3e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// borrowRate = mimoRateModel.getBorrowRate(4e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// borrowRate = mimoRateModel.getBorrowRate(5e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// borrowRate = mimoRateModel.getBorrowRate(6e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearPolygon(borrowRate), 0);\r\n// assertLe(_convertToPerYearPolygon(borrowRate), 100e18);\r\n// }\r\n\r\n// function testJumpRateBorrowRate() internal {\r\n// uint256 borrowRate = jumpRateModel.getBorrowRate(0, 0, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// borrowRate = jumpRateModel.getBorrowRate(1e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// borrowRate = jumpRateModel.getBorrowRate(2e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// borrowRate = jumpRateModel.getBorrowRate(3e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// borrowRate = jumpRateModel.getBorrowRate(4e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// borrowRate = jumpRateModel.getBorrowRate(5e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// borrowRate = jumpRateModel.getBorrowRate(6e18, 10e18, 5e18);\r\n// assertGe(_convertToPerYearBsc(borrowRate), 0);\r\n// assertLe(_convertToPerYearBsc(borrowRate), 100e18);\r\n// }\r\n\r\n// function testJumpRateSupplyRate() internal {\r\n// uint256 supplyRate = jumpRateModel.getSupplyRate(0, 10e18, 5e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// jumpRateModel.getSupplyRate(10e18, 10e18, 5e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// jumpRateModel.getSupplyRate(20e18, 10e18, 20e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// jumpRateModel.getSupplyRate(30e18, 10e18, 30e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// jumpRateModel.getSupplyRate(40e18, 10e18, 10e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// jumpRateModel.getSupplyRate(50e18, 10e18, 40e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// jumpRateModel.getSupplyRate(60e18, 10e18, 60e18, 0.2e18);\r\n// assertGe(_convertToPerYearBsc(supplyRate), 0);\r\n// assertLe(_convertToPerYearBsc(supplyRate), 100e18);\r\n// }\r\n\r\n// function testAnkrFTMBorrowModelRate() internal {\r\n// vm.mockCall(\r\n// address(ANKR_FTM_RATE_PROVIDER),\r\n// abi.encodeWithSelector(IAnkrFTMRateProvider.averagePercentageRate.selector),\r\n// abi.encode(5e18)\r\n// );\r\n// // utilization 1 -> borrow rate: 0.084%\r\n// uint256 borrowRate = ankrCertificateInterestRateModelFTM.getBorrowRate(800e18, 8e18, 8e18);\r\n// uint256 util = ankrCertificateInterestRateModelFTM.utilizationRate(800e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e17);\r\n// assertApproxEqRel(_convertToPerYearFtm(borrowRate) * 100, 0.084e18, 1e16, \"!borrow rate for utilization 1\");\r\n\r\n// // utilization 10 -> borrow rate: 0.61%\r\n// borrowRate = ankrCertificateInterestRateModelFTM.getBorrowRate(80e18, 8e18, 8e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(80e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(borrowRate) * 100, 0.61e18, 1e16, \"!borrow rate for utilization 10\");\r\n\r\n// // utilization 20 -> borrow rate: 1.2%\r\n// borrowRate = ankrCertificateInterestRateModelFTM.getBorrowRate(40e18, 8e18, 8e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(40e18, 8e18, 8e18);\r\n// assertEq(util, 0.2e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(borrowRate) * 100, 1.2e18, 1e16, \"!borrow rate for utilization 20\");\r\n\r\n// // utilization 80 -> borrow rate: 4.7%\r\n// borrowRate = ankrCertificateInterestRateModelFTM.getBorrowRate(3e18, 8e18, 1e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(3e18, 8e18, 1e18);\r\n// assertEq(util, 0.8e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(borrowRate) * 100, 4.7e18, 1e16, \"!borrow rate for utilization 80\");\r\n\r\n// // utilization 90 -> borrow rate: 20.3%\r\n// borrowRate = ankrCertificateInterestRateModelFTM.getBorrowRate(8e18, 7.2e18, 7.2e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(8e18, 7.2e18, 7.2e18);\r\n// assertEq(util, 0.9e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(borrowRate) * 100, 20.3e18, 1e16, \"!borrow rate for utilization 90\");\r\n// }\r\n\r\n// function testAnkrBNBBorrowModelRate() internal {\r\n// vm.mockCall(\r\n// address(ANKR_BNB_RATE_PROVIDER),\r\n// abi.encodeWithSelector(IAnkrBNBRateProvider.averagePercentageRate.selector),\r\n// abi.encode(2.5e18)\r\n// );\r\n\r\n// // utilization 1 -> borrow rate: 0.04%\r\n// uint256 borrowRate = ankrCertificateInterestRateModelBNB.getBorrowRate(800e18, 8e18, 8e18);\r\n// uint256 util = ankrCertificateInterestRateModelBNB.utilizationRate(800e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e17);\r\n// assertApproxEqRel(_convertToPerYearBsc(borrowRate) * 100, 0.04e18, 1e17, \"!borrow rate for utilization 1\");\r\n\r\n// // utilization 10 -> borrow rate: 0.3%\r\n// borrowRate = ankrCertificateInterestRateModelBNB.getBorrowRate(80e18, 8e18, 8e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(80e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(borrowRate) * 100, 0.3e18, 1e17, \"!borrow rate for utilization 10\");\r\n\r\n// // utilization 20 -> borrow rate: 0.6%\r\n// borrowRate = ankrCertificateInterestRateModelBNB.getBorrowRate(40e18, 8e18, 8e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(40e18, 8e18, 8e18);\r\n// assertEq(util, 0.2e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(borrowRate) * 100, 0.6e18, 1e17, \"!borrow rate for utilization 20\");\r\n\r\n// // utilization 80 -> borrow rate: 2.36%\r\n// borrowRate = ankrCertificateInterestRateModelBNB.getBorrowRate(3e18, 8e18, 1e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(3e18, 8e18, 1e18);\r\n// assertEq(util, 0.8e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(borrowRate) * 100, 2.36e18, 1e17, \"!borrow rate for utilization 80\");\r\n\r\n// // utilization 90 -> borrow rate: 17%\r\n// borrowRate = ankrCertificateInterestRateModelBNB.getBorrowRate(8e18, 7.2e18, 7.2e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(8e18, 7.2e18, 7.2e18);\r\n// assertEq(util, 0.9e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(borrowRate) * 100, 17e18, 1e17, \"!borrow rate for utilization 90\");\r\n// }\r\n\r\n// function testAnkrFTMSupplyModelRate() internal {\r\n// vm.mockCall(\r\n// address(ANKR_FTM_RATE_PROVIDER),\r\n// abi.encodeWithSelector(IAnkrFTMRateProvider.averagePercentageRate.selector),\r\n// abi.encode(5e18)\r\n// );\r\n\r\n// // utilization 1 -> supply rate: 0.00075%\r\n// uint256 supplyRate = ankrCertificateInterestRateModelFTM.getSupplyRate(800e18, 8e18, 8e18, 0.1e18);\r\n// uint256 util = ankrCertificateInterestRateModelFTM.utilizationRate(800e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e17);\r\n// assertApproxEqRel(_convertToPerYearFtm(supplyRate) * 100, 0.00075e18, 1e16, \"!supply rate for utilization 1\");\r\n\r\n// // utilization 10 -> supply rate: 0.0055%\r\n// supplyRate = ankrCertificateInterestRateModelFTM.getSupplyRate(80e18, 8e18, 8e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(80e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(supplyRate) * 100, 0.055e18, 1e16, \"!supply rate for utilization 10\");\r\n\r\n// // utilization 20 -> supply rate: 0.022%\r\n// supplyRate = ankrCertificateInterestRateModelFTM.getSupplyRate(40e18, 8e18, 8e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(40e18, 8e18, 8e18);\r\n// assertEq(util, 0.2e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(supplyRate) * 100, 0.216e18, 1e16, \"!supply rate for utilization 20\");\r\n\r\n// // utilization 80 -> supply rate: 3.4%\r\n// supplyRate = ankrCertificateInterestRateModelFTM.getSupplyRate(3e18, 8e18, 1e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(3e18, 8e18, 1e18);\r\n// assertEq(util, 0.8e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(supplyRate) * 100, 3.4e18, 1e16, \"!supply rate for utilization 80\");\r\n\r\n// // utilization 90 -> supply rate: 16.5%\r\n// supplyRate = ankrCertificateInterestRateModelFTM.getSupplyRate(8e18, 7.2e18, 7.2e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelFTM.utilizationRate(8e18, 7.2e18, 7.2e18);\r\n// assertEq(util, 0.9e18);\r\n// assertApproxEqRel(_convertToPerYearFtm(supplyRate) * 100, 16.5e18, 1e16, \"!supply rate for utilization 90\");\r\n// }\r\n\r\n// function testAnkrBNBSupplyModelRate() internal {\r\n// vm.mockCall(\r\n// address(ANKR_BNB_RATE_PROVIDER),\r\n// abi.encodeWithSelector(IAnkrBNBRateProvider.averagePercentageRate.selector),\r\n// abi.encode(2.5e18)\r\n// );\r\n\r\n// // utilization 1 -> supply rate: 0.00037%\r\n// uint256 supplyRate = ankrCertificateInterestRateModelBNB.getSupplyRate(800e18, 8e18, 8e18, 0.1e18);\r\n// uint256 util = ankrCertificateInterestRateModelBNB.utilizationRate(800e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e17);\r\n// assertApproxEqRel(_convertToPerYearBsc(supplyRate) * 100, 0.00037e18, 1e17, \"!supply rate for utilization 1\");\r\n\r\n// // utilization 10 -> supply rate: 0.027%\r\n// supplyRate = ankrCertificateInterestRateModelBNB.getSupplyRate(80e18, 8e18, 8e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(80e18, 8e18, 8e18);\r\n// assertEq(util, 0.1e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(supplyRate) * 100, 0.027e18, 1e17, \"!supply rate for utilization 10\");\r\n\r\n// // utilization 20 -> supply rate: 0.1%\r\n// supplyRate = ankrCertificateInterestRateModelBNB.getSupplyRate(40e18, 8e18, 8e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(40e18, 8e18, 8e18);\r\n// assertEq(util, 0.2e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(supplyRate) * 100, 0.1e18, 1e17, \"!supply rate for utilization 20\");\r\n\r\n// // utilization 80 -> supply rate: 1.7%\r\n// supplyRate = ankrCertificateInterestRateModelBNB.getSupplyRate(3e18, 8e18, 1e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(3e18, 8e18, 1e18);\r\n// assertEq(util, 0.8e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(supplyRate) * 100, 1.7e18, 1e17, \"!supply rate for utilization 80\");\r\n\r\n// // utilization 90 -> supply rate: 14.3%\r\n// supplyRate = ankrCertificateInterestRateModelBNB.getSupplyRate(8e18, 7.2e18, 7.2e18, 0.1e18);\r\n// util = ankrCertificateInterestRateModelBNB.utilizationRate(8e18, 7.2e18, 7.2e18);\r\n// assertEq(util, 0.9e18);\r\n// assertApproxEqRel(_convertToPerYearBsc(supplyRate) * 100, 14.3e18, 1e17, \"!supply rate for utilization 90\");\r\n// }\r\n// }\r\n" + }, + "contracts/test/liquidators/CurveSwapLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\r\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\r\n\r\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\r\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\r\n\r\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\r\n\r\ncontract CurveSwapLiquidatorTest is BaseTest {\r\n CurveSwapLiquidatorFunder private csl;\r\n address private maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\r\n address private val3EPSAddress = 0x5b5bD8913D766D005859CE002533D4838B0Ebbb5;\r\n\r\n address private lpTokenMai3EPS = 0x80D00D2c8d920a9253c3D65BA901250a55011b37;\r\n address private poolAddress = 0x68354c6E8Bbd020F9dE81EAf57ea5424ba9ef322;\r\n\r\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\r\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\r\n\r\n function afterForkSetUp() internal override {\r\n csl = new CurveSwapLiquidatorFunder();\r\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\r\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\r\n\r\n if (address(curveV1Oracle) == address(0)) {\r\n address[][] memory _poolUnderlyings = new address[][](1);\r\n _poolUnderlyings[0] = asArray(maiAddress, val3EPSAddress);\r\n curveV1Oracle = new CurveLpTokenPriceOracleNoRegistry();\r\n curveV1Oracle.initialize(asArray(lpTokenMai3EPS), asArray(poolAddress), _poolUnderlyings);\r\n }\r\n }\r\n\r\n // Curve pools need to be configured in the CurveV1 or CurveV2 oracles\r\n // We have not deployed CurveV2 oracle yet\r\n function testSwapCurveV1UsdtUsdc() public debuggingOnly fork(ARBITRUM_ONE) {\r\n address usdtAddress = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;\r\n address usdcAddress = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\r\n address usdtWhale = 0xB38e8c17e38363aF6EbdCb3dAE12e0243582891D; // binance\r\n\r\n IERC20Upgradeable inputToken = IERC20Upgradeable(usdtAddress);\r\n uint256 inputAmount = 150e6;\r\n\r\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, usdtAddress, usdcAddress, ap.getAddress(\"wtoken\"));\r\n\r\n vm.prank(usdtWhale);\r\n inputToken.transfer(address(csl), inputAmount);\r\n\r\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\r\n\r\n assertEq(address(outputToken), usdcAddress, \"output token does not match\");\r\n assertApproxEqAbs(outputAmount, inputAmount, 1e5, \"output amount does not match\");\r\n }\r\n\r\n function testSwapCurveV2EspBnbxBnb() public fork(BSC_MAINNET) {\r\n address bnbxAddress = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\r\n address wbnb = ap.getAddress(\"wtoken\");\r\n address bnbxWhale = 0x4eE98B27eeF58844E460922eC9Da7C05D32F284A;\r\n\r\n IERC20Upgradeable inputToken = IERC20Upgradeable(bnbxAddress);\r\n uint256 inputAmount = 3e18;\r\n\r\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, bnbxAddress, wbnb, wbnb);\r\n\r\n vm.prank(bnbxWhale);\r\n inputToken.transfer(address(csl), inputAmount);\r\n\r\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\r\n\r\n assertEq(address(outputToken), wbnb, \"output token does not match\");\r\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"output amount does not match\");\r\n }\r\n\r\n function testRedeemMAI() public fork(BSC_MAINNET) {\r\n ICurvePool curvePool = ICurvePool(poolAddress);\r\n\r\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\r\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\r\n\r\n uint256 inputAmount = 1e10;\r\n\r\n uint256 maiForVal3EPS = curvePool.get_dy(0, 1, inputAmount);\r\n emit log_uint(maiForVal3EPS);\r\n\r\n dealMai(address(csl), inputAmount);\r\n\r\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\r\n (IERC20Upgradeable shouldBeVal3EPS, uint256 outputAmount) = csl.redeem(\r\n IERC20Upgradeable(maiAddress),\r\n inputAmount,\r\n data\r\n );\r\n assertEq(address(shouldBeVal3EPS), val3EPSAddress, \"output token does not match\");\r\n\r\n assertEq(maiForVal3EPS, outputAmount, \"output amount does not match\");\r\n }\r\n\r\n function testEstimateInputAmount() public fork(BSC_MAINNET) {\r\n ICurvePool curvePool = ICurvePool(poolAddress);\r\n\r\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\r\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\r\n\r\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\r\n\r\n (IERC20Upgradeable inputToken, uint256 inputAmount) = csl.estimateInputAmount(2e10, data);\r\n\r\n emit log(\"input\");\r\n emit log_uint(inputAmount);\r\n emit log_address(address(inputToken));\r\n uint256 shouldBeAround2e10 = curvePool.get_dy(1, 0, inputAmount);\r\n emit log(\"should be around 2e10\");\r\n emit log_uint(shouldBeAround2e10);\r\n assertTrue(shouldBeAround2e10 >= 20e9 && shouldBeAround2e10 <= 23e9, \"rough estimate didn't work\");\r\n }\r\n\r\n function dealMai(address to, uint256 amount) internal {\r\n address whale = 0xc412eCccaa35621cFCbAdA4ce203e3Ef78c4114a; // anyswap\r\n vm.prank(whale);\r\n IERC20Upgradeable(maiAddress).transfer(to, amount);\r\n }\r\n}\r\n" + }, + "contracts/test/liquidators/IonicLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\n\r\nimport { IonicLiquidator, ILiquidator } from \"../../IonicLiquidator.sol\";\r\nimport { IonicUniV3Liquidator } from \"../../IonicUniV3Liquidator.sol\";\r\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\r\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\r\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\r\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\r\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\r\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\r\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\r\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\r\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\r\nimport { LiquidatorsRegistrySecondExtension } from \"../../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\r\nimport \"../../liquidators/registry/LiquidatorsRegistryExtension.sol\";\r\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\r\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\r\n\r\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\r\nimport { UpgradesBaseTest } from \"../UpgradesBaseTest.sol\";\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\nimport { ProxyAdmin } from \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\r\nimport { PoolLens } from \"../../PoolLens.sol\";\r\n\r\ncontract MockRedemptionStrategy is IRedemptionStrategy {\r\n function redeem(IERC20Upgradeable, uint256, bytes memory) external returns (IERC20Upgradeable, uint256) {\r\n return (IERC20Upgradeable(address(0)), 1);\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return \"MockRedemptionStrategy\";\r\n }\r\n}\r\n\r\ncontract IonicLiquidatorTest is UpgradesBaseTest {\r\n ILiquidator liquidator;\r\n address uniswapRouter;\r\n address swapRouter;\r\n IUniswapV3Quoter quoter;\r\n address usdcWhale;\r\n address wethWhale;\r\n address poolAddress;\r\n address uniV3PooForFlash;\r\n uint256 usdcMarketIndex;\r\n uint256 wethMarketIndex;\r\n\r\n AuthoritiesRegistry authRegistry;\r\n ILiquidatorsRegistry liquidatorsRegistry;\r\n\r\n function afterForkSetUp() internal override {\r\n super.afterForkSetUp();\r\n\r\n if (block.chainid == BSC_MAINNET) {\r\n uniswapRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\r\n } else if (block.chainid == POLYGON_MAINNET) {\r\n uniswapRouter = 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff;\r\n swapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\r\n quoter = IUniswapV3Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\r\n usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD; // aave reserve\r\n wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\r\n poolAddress = 0x22A705DEC988410A959B8b17C8c23E33c121580b; // Retro stables pool\r\n uniV3PooForFlash = 0xA374094527e1673A86dE625aa59517c5dE346d32; // usdc-wmatic\r\n usdcMarketIndex = 3;\r\n wethMarketIndex = 5;\r\n } else if (block.chainid == MODE_MAINNET) {\r\n uniswapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\r\n // uniswapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\r\n // swapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\r\n swapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\r\n //quoter = IUniswapV3Quoter(0x7Fd569b2021850fbA53887dd07736010aCBFc787); // other sup quoter?\r\n quoter = IUniswapV3Quoter(0x5E6AEbab1AD525f5336Bd12E6847b851531F72ba); // sup quoter\r\n usdcWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79; // vault\r\n wethWhale = 0xF4C85269240C1D447309fA602A90ac23F1CB0Dc0;\r\n poolAddress = 0xFB3323E24743Caf4ADD0fDCCFB268565c0685556;\r\n //uniV3PooForFlash = 0x293f2B2c17f8cEa4db346D87Ef5712C9dd0491EF; // kim weth-usdc pool\r\n uniV3PooForFlash = 0x047CF4b081ee80d2928cb2ce3F3C4964e26eB0B9; // kim usdt-usdc pool\r\n // uniV3PooForFlash = 0xf2e9C024F1C0B7a2a4ea11243C2D86A7b38DD72f; // sup univ2 0x34a1E3Db82f669f8cF88135422AfD80e4f70701A\r\n usdcMarketIndex = 1;\r\n wethMarketIndex = 0;\r\n // weth 0x4200000000000000000000000000000000000006\r\n // usdc 0xd988097fb8612cc24eeC14542bC03424c656005f\r\n }\r\n\r\n // vm.prank(ap.owner());\r\n // ap.setAddress(\"IUniswapV2Router02\", uniswapRouter);\r\n vm.prank(ap.owner());\r\n ap.setAddress(\"UNISWAP_V3_ROUTER\", uniswapRouter);\r\n\r\n authRegistry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\r\n liquidatorsRegistry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\r\n liquidator = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\r\n }\r\n\r\n function upgradeRegistry() internal {\r\n DiamondBase asBase = DiamondBase(address(liquidatorsRegistry));\r\n address[] memory exts = asBase._listExtensions();\r\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\r\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\r\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\r\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\r\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\r\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\r\n }\r\n\r\n function testBsc() public fork(BSC_MAINNET) {\r\n testUpgrade();\r\n }\r\n\r\n function testPolygon() public fork(POLYGON_MAINNET) {\r\n testUpgrade();\r\n }\r\n\r\n function testUpgrade() internal {\r\n // in case these slots start to get used, please redeploy the FSL\r\n // with a larger storage gap to protect the owner variable of OwnableUpgradeable\r\n // from being overwritten by the IonicLiquidator storage\r\n for (uint256 i = 40; i < 51; i++) {\r\n address atSloti = address(uint160(uint256(vm.load(address(liquidator), bytes32(i)))));\r\n assertEq(\r\n atSloti,\r\n address(0),\r\n \"replace the FSL proxy/storage contract with a new one before the owner variable is overwritten\"\r\n );\r\n }\r\n }\r\n\r\n function testSpecificLiquidation() public debuggingOnly fork(MODE_MAINNET) {\r\n address borrower = 0x5834a3AAFA83A53822B313994Bb554d8E8c215dF;\r\n address debtMarketAddr = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\r\n address collateralMarketAddr = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\r\n\r\n liquidator = ILiquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n\r\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars;\r\n vars.borrower = borrower;\r\n vars.cErc20 = ICErc20(debtMarketAddr);\r\n vars.cTokenCollateral = ICErc20(collateralMarketAddr);\r\n vars.repayAmount = 0x408c7a4d7c4092;\r\n vars.flashSwapContract = 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc;\r\n vars.minProfitAmount = 0;\r\n vars.redemptionStrategies = new IRedemptionStrategy[](1);\r\n vars.strategyData = new bytes[](1);\r\n vars.debtFundingStrategies = new IFundsConversionStrategy[](0);\r\n vars.debtFundingStrategiesData = new bytes[](0);\r\n\r\n vars.redemptionStrategies[0] = IFundsConversionStrategy(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\r\n vars.strategyData[\r\n 0\r\n ] = hex\"0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e8\";\r\n\r\n liquidator.safeLiquidateToTokensWithFlashLoan(vars);\r\n }\r\n\r\n function testWithdrawalLiquidator() public debuggingOnly fork(MODE_MAINNET) {\r\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\r\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\r\n\r\n vm.startPrank(proxyAdmin.owner());\r\n proxyAdmin.upgrade(proxyV3, address(implV3));\r\n vm.stopPrank();\r\n\r\n vm.prank(0x4200000000000000000000000000000000000016);\r\n (bool success, ) = address(liquidatorV3).call{ value: 1 ether }(\"\");\r\n require(success, \"transfer of funds failed\");\r\n\r\n uint256 beforeBalance = liquidatorV3.owner().balance;\r\n\r\n vm.prank(liquidatorV3.owner());\r\n liquidatorV3.withdrawAll();\r\n\r\n emit log_named_uint(\"balance of liquidator\", liquidatorV3.owner().balance);\r\n\r\n assertEq(liquidatorV3.owner().balance, beforeBalance + 1 ether);\r\n assertEq(address(liquidatorV3).balance, 0);\r\n }\r\n\r\n function testLiquidateAfterUpgradeLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\r\n // upgrade IonicLiquidator\r\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\r\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\r\n\r\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\r\n\r\n vm.startPrank(proxyAdmin.owner());\r\n proxyAdmin.upgrade(proxyV3, address(implV3));\r\n vm.stopPrank();\r\n\r\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\r\n liquidatorV3.setPoolLens(address(lens));\r\n liquidatorV3.setHealthFactorThreshold(1e18);\r\n vm.stopPrank();\r\n\r\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\r\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\r\n emit log_named_uint(\"liquidity\", liquidity);\r\n emit log_named_uint(\"shortfall\", shortfall);\r\n\r\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\r\n emit log_named_uint(\"hf before\", healthFactor);\r\n\r\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\r\n borrower: 0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d,\r\n repayAmount: 1134537086250983,\r\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\r\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\r\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\r\n minProfitAmount: 0,\r\n redemptionStrategies: new IRedemptionStrategy[](0),\r\n strategyData: new bytes[](0),\r\n debtFundingStrategies: new IFundsConversionStrategy[](0),\r\n debtFundingStrategiesData: new bytes[](0)\r\n });\r\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\r\n\r\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\r\n emit log_named_uint(\"hf after\", healthFactorAfter);\r\n }\r\n\r\n function testLiquidateAfterUpgradeLiquidatorExpressRelay() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\r\n // upgrade IonicLiquidator\r\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\r\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\r\n address expressRelay = makeAddr(\"expressRelay\");\r\n\r\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\r\n\r\n vm.startPrank(proxyAdmin.owner());\r\n proxyAdmin.upgrade(proxyV3, address(implV3));\r\n vm.stopPrank();\r\n\r\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\r\n liquidatorV3.setPoolLens(address(lens));\r\n liquidatorV3.setHealthFactorThreshold(95e16);\r\n liquidatorV3.setExpressRelay(expressRelay);\r\n vm.stopPrank();\r\n\r\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\r\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\r\n emit log_named_uint(\"liquidity\", liquidity);\r\n emit log_named_uint(\"shortfall\", shortfall);\r\n\r\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\r\n emit log_named_uint(\"hf before\", healthFactor);\r\n\r\n address borrower = address(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\r\n\r\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\r\n borrower: borrower,\r\n repayAmount: 1134537086250983,\r\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\r\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\r\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\r\n minProfitAmount: 0,\r\n redemptionStrategies: new IRedemptionStrategy[](0),\r\n strategyData: new bytes[](0),\r\n debtFundingStrategies: new IFundsConversionStrategy[](0),\r\n debtFundingStrategiesData: new bytes[](0)\r\n });\r\n\r\n vm.mockCall(\r\n expressRelay,\r\n abi.encodeWithSelector(\r\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\r\n address(liquidatorV3),\r\n abi.encode(borrower)\r\n ),\r\n abi.encode(false)\r\n );\r\n vm.expectRevert(\"invalid liquidation\");\r\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\r\n\r\n vm.mockCall(\r\n expressRelay,\r\n abi.encodeWithSelector(\r\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\r\n address(liquidatorV3),\r\n abi.encode(borrower)\r\n ),\r\n abi.encode(true)\r\n );\r\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\r\n\r\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\r\n emit log_named_uint(\"hf after\", healthFactorAfter);\r\n }\r\n\r\n // TODO test with marginal shortfall for liquidation penalty errors\r\n function _testLiquidatorLiquidate(address contractForFlashSwap) internal {\r\n IonicComptroller pool = IonicComptroller(poolAddress);\r\n // _upgradePoolWithExtension(Unitroller(payable(poolAddress)));\r\n //upgradeRegistry();\r\n\r\n ICErc20[] memory markets = pool.getAllMarkets();\r\n\r\n ICErc20 usdcMarket = markets[usdcMarketIndex];\r\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\r\n ICErc20 wethMarket = markets[wethMarketIndex];\r\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\r\n {\r\n emit log_named_address(\"usdc market\", address(usdcMarket));\r\n emit log_named_address(\"weth market\", address(wethMarket));\r\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\r\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\r\n vm.prank(pool.admin());\r\n pool._setBorrowCapForCollateral(address(usdcMarket), address(wethMarket), 1e36);\r\n }\r\n\r\n {\r\n vm.prank(pool.admin());\r\n pool._borrowCapWhitelist(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038, address(this), true);\r\n }\r\n\r\n {\r\n vm.prank(wethWhale);\r\n weth.transfer(address(this), 0.1e18);\r\n\r\n weth.approve(address(wethMarket), 1e36);\r\n require(wethMarket.mint(0.1e18) == 0, \"mint weth failed\");\r\n pool.enterMarkets(asArray(address(usdcMarket), address(wethMarket)));\r\n }\r\n\r\n {\r\n vm.startPrank(usdcWhale);\r\n usdc.approve(address(usdcMarket), 2e36);\r\n require(usdcMarket.mint(70e6) == 0, \"mint usdc failed\");\r\n vm.stopPrank();\r\n }\r\n\r\n {\r\n require(usdcMarket.borrow(50e6) == 0, \"borrow usdc failed\");\r\n\r\n // the collateral prices change\r\n BasePriceOracle mpo = pool.oracle();\r\n uint256 priceCollateral = mpo.getUnderlyingPrice(wethMarket);\r\n vm.mockCall(\r\n address(mpo),\r\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, wethMarket),\r\n abi.encode(priceCollateral / 10)\r\n );\r\n }\r\n\r\n (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) = liquidatorsRegistry\r\n .getRedemptionStrategies(weth, usdc);\r\n\r\n uint256 seizedAmount = liquidator.safeLiquidateToTokensWithFlashLoan(\r\n ILiquidator.LiquidateToTokensWithFlashSwapVars({\r\n borrower: address(this),\r\n repayAmount: 10e6,\r\n cErc20: usdcMarket,\r\n cTokenCollateral: wethMarket,\r\n flashSwapContract: contractForFlashSwap,\r\n minProfitAmount: 6,\r\n redemptionStrategies: strategies,\r\n strategyData: strategiesData,\r\n debtFundingStrategies: new IFundsConversionStrategy[](0),\r\n debtFundingStrategiesData: new bytes[](0)\r\n })\r\n );\r\n\r\n emit log_named_uint(\"seized amount\", seizedAmount);\r\n require(seizedAmount > 0, \"didn't seize any assets\");\r\n }\r\n}\r\n" + }, + "contracts/test/liquidators/UniswapV2LiquidatorFunderTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\r\nimport { UniswapV2LiquidatorFunder } from \"../../liquidators/UniswapV2LiquidatorFunder.sol\";\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ncontract UniswapV2LiquidatorFunderTest is BaseTest {\r\n address maiAddress;\r\n address usdcAddress;\r\n UniswapV2LiquidatorFunder uv2lf;\r\n address uniswapV2Router;\r\n\r\n function afterForkSetUp() internal override {\r\n uv2lf = new UniswapV2LiquidatorFunder();\r\n uniswapV2Router = ap.getAddress(\"IUniswapV2Router02\");\r\n usdcAddress = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\r\n maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\r\n }\r\n\r\n function testConvertUsdcMai() public fork(BSC_MAINNET) {\r\n address[] memory swapPath = new address[](2);\r\n swapPath[0] = maiAddress;\r\n swapPath[1] = usdcAddress;\r\n bytes memory strategyData = abi.encode(uniswapV2Router, swapPath);\r\n\r\n uint256 outputUsdcExpected = 1e10;\r\n (IERC20Upgradeable inputToken, uint256 inputMaiRequired) = uv2lf.estimateInputAmount(\r\n outputUsdcExpected,\r\n strategyData\r\n );\r\n\r\n assertApproxEqAbs(inputMaiRequired, outputUsdcExpected, 1e9);\r\n assertEq(address(inputToken), maiAddress, \"!mai address\");\r\n }\r\n}\r\n" + }, + "contracts/test/oracles/default/ERC4626OracleAndLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\r\nimport { ERC4626Oracle } from \"../../../oracles/default/ERC4626Oracle.sol\";\r\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\r\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\r\nimport { IERC4626 } from \"../../../compound/IERC4626.sol\";\r\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\r\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\r\n\r\nimport { IUniswapV3Factory } from \"../../../external/uniswap/IUniswapV3Factory.sol\";\r\nimport { Quoter } from \"../../../external/uniswap/quoter/Quoter.sol\";\r\nimport { IUniswapV3Pool } from \"../../../external/uniswap/IUniswapV3Pool.sol\";\r\nimport { ISwapRouter } from \"../../../external/uniswap/ISwapRouter.sol\";\r\nimport { ERC4626Liquidator } from \"../../../liquidators/ERC4626Liquidator.sol\";\r\n\r\ncontract ERC4626OracleAndLiquidatorTest is BaseTest {\r\n // TODO: refactor this into oracle and liquidator tests once oracles are deployed\r\n // TODO: refactor oracle set up using the address provider\r\n\r\n MasterPriceOracle mpo;\r\n ChainlinkPriceOracleV2 chainlinkOracle;\r\n ERC4626Oracle erc4626Oracle;\r\n\r\n IERC20Upgradeable wethToken;\r\n IERC20Upgradeable wbtcToken;\r\n IERC20Upgradeable daiToken;\r\n IERC20Upgradeable usdcToken;\r\n IERC20Upgradeable usdtToken;\r\n\r\n address nativeUsdPriceFeed;\r\n address usdcEthPriceFeed;\r\n address wbtcEthPriceFeed;\r\n\r\n IERC4626 erc4626Vault;\r\n address[] underlyingTokens;\r\n ERC4626Liquidator liquidator;\r\n\r\n address usdcMarketAddress;\r\n address univ3SwapRouter;\r\n\r\n uint256 poolFee;\r\n\r\n Quoter quoter;\r\n\r\n address holder;\r\n\r\n function setUpErc4626Oracle() public {\r\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\r\n erc4626Oracle = new ERC4626Oracle();\r\n vm.prank(erc4626Oracle.owner());\r\n erc4626Oracle.initialize();\r\n oracles[0] = erc4626Oracle;\r\n vm.prank(mpo.admin());\r\n mpo.add(asArray(address(erc4626Vault)), oracles);\r\n }\r\n\r\n function setUpBaseOracles() public {\r\n setUpMpoAndAddresses();\r\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\r\n chainlinkOracle = new ChainlinkPriceOracleV2();\r\n chainlinkOracle.initialize(address(usdcToken), nativeUsdPriceFeed);\r\n vm.prank(chainlinkOracle.owner());\r\n chainlinkOracle.setPriceFeeds(\r\n asArray(address(usdcToken), address(wbtcToken)),\r\n asArray(usdcEthPriceFeed, wbtcEthPriceFeed),\r\n ChainlinkPriceOracleV2.FeedBaseCurrency.ETH\r\n );\r\n oracles[0] = BasePriceOracle(address(chainlinkOracle));\r\n oracles[1] = BasePriceOracle(address(chainlinkOracle));\r\n\r\n vm.prank(mpo.admin());\r\n mpo.add(asArray(address(usdcToken), address(wbtcToken)), oracles);\r\n }\r\n\r\n function setUpMpoAndAddresses() public {\r\n if (block.chainid == ETHEREUM_MAINNET) {\r\n usdcToken = IERC20Upgradeable(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\r\n daiToken = IERC20Upgradeable(0x6B175474E89094C44Da98b954EedeAC495271d0F);\r\n usdtToken = IERC20Upgradeable(0xdAC17F958D2ee523a2206206994597C13D831ec7);\r\n wbtcToken = IERC20Upgradeable(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\r\n wethToken = IERC20Upgradeable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\r\n\r\n nativeUsdPriceFeed = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;\r\n usdcEthPriceFeed = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4;\r\n wbtcEthPriceFeed = 0xdeb288F737066589598e9214E782fa5A8eD689e8;\r\n\r\n address[] memory assets = new address[](0);\r\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\r\n mpo = new MasterPriceOracle();\r\n mpo.initialize(assets, oracles, BasePriceOracle(address(0)), address(this), true, address(wethToken));\r\n }\r\n }\r\n\r\n function setupRealYieldStrategyUsdAddresses() public {\r\n if (block.chainid == ETHEREUM_MAINNET) {\r\n underlyingTokens = asArray(address(usdcToken), address(daiToken), address(usdtToken)); // USDC, 6 decimals\r\n poolFee = 10;\r\n erc4626Vault = IERC4626(0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E); // USDC-DAI-USDT Real Yield\r\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\r\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\r\n holder = 0x3541Fda19b09769A938EB2A5f5154b01aE5b0869;\r\n }\r\n liquidator = new ERC4626Liquidator();\r\n }\r\n\r\n function setupEthBtcStrategyAddresses() public {\r\n if (block.chainid == ETHEREUM_MAINNET) {\r\n underlyingTokens = asArray(address(usdcToken), address(wbtcToken), address(wethToken));\r\n poolFee = 500;\r\n erc4626Vault = IERC4626(0x6b7f87279982d919Bbf85182DDeAB179B366D8f2); // ETH-BTC trend\r\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\r\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\r\n holder = 0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3;\r\n }\r\n liquidator = new ERC4626Liquidator();\r\n }\r\n\r\n function testRealYieldErc4626PriceOracle() public fork(ETHEREUM_MAINNET) {\r\n setUpBaseOracles();\r\n setupRealYieldStrategyUsdAddresses();\r\n setUpErc4626Oracle();\r\n\r\n uint256 priceRealYieldUsdc = mpo.price(address(erc4626Vault));\r\n uint256 priceUsdc = mpo.price(address(usdcToken));\r\n\r\n // Approximate only -- these should not match.\r\n assertApproxEqRel(priceRealYieldUsdc, priceUsdc, 3e16, \"!diff > 3%\");\r\n }\r\n\r\n function testRealYieldUsdErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\r\n setUpBaseOracles();\r\n setupRealYieldStrategyUsdAddresses();\r\n setUpErc4626Oracle();\r\n executeTestRedemptionStrategy(usdcToken);\r\n }\r\n\r\n function testEthBtcMomementumErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\r\n setUpBaseOracles();\r\n setupEthBtcStrategyAddresses();\r\n setUpErc4626Oracle();\r\n executeTestRedemptionStrategy(wethToken);\r\n }\r\n\r\n function executeTestRedemptionStrategy(IERC20Upgradeable _outputToken) internal {\r\n uint256 balance = erc4626Vault.balanceOf(holder);\r\n assertTrue(balance > 0);\r\n\r\n // impersonate the holder\r\n vm.prank(holder);\r\n\r\n // fund the liquidator so it can redeem the tokens\r\n erc4626Vault.transfer(address(liquidator), balance);\r\n\r\n bytes memory data = abi.encode(address(_outputToken), poolFee, univ3SwapRouter, underlyingTokens, quoter);\r\n\r\n // redeem the underlying reward token\r\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\r\n IERC20Upgradeable(address(erc4626Vault)),\r\n balance,\r\n data\r\n );\r\n\r\n // ensure the output token is the expected token\r\n assertEq(address(outputToken), address(_outputToken));\r\n\r\n uint256 liquidatorBalance = _outputToken.balanceOf(address(liquidator));\r\n // get the redeemed value of the erc4626 token\r\n uint256 redeemValue = (mpo.price(address(erc4626Vault)) * balance) / 1e18;\r\n // get the redeemed value of the output token\r\n uint256 redeemOutputTokenValue = (mpo.price(address(_outputToken)) * liquidatorBalance) /\r\n 10 ** ERC20Upgradeable(address(_outputToken)).decimals();\r\n // ensure they are approximately equal\r\n assertApproxEqRel(redeemValue, redeemOutputTokenValue, 3e16, \"!diff > 3%\");\r\n\r\n uint256 maxVal = redeemValue > redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\r\n uint256 minVal = redeemValue < redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\r\n\r\n uint256 absoluteDifference = maxVal - minVal;\r\n uint256 percentageDifference = (absoluteDifference * 10000) / maxVal; // Multiplied by 10000 for 2 decimal places of precision\r\n\r\n // log the differences\r\n emit log_named_uint(\"redeemOutputTokenValue\", redeemOutputTokenValue);\r\n emit log_named_uint(\"redeemValue\", redeemValue);\r\n emit log_named_uint(\"base 1000 diff\", percentageDifference);\r\n }\r\n}\r\n" + }, + "contracts/test/oracles/default/SimplePriceOracleTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\r\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\r\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\ncontract SimplePriceOracleTest is BaseTest {\r\n SimplePriceOracle oracle;\r\n MasterPriceOracle mpo;\r\n address someAdminAccount = address(94949);\r\n\r\n function afterForkSetUp() internal override {\r\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\r\n SimplePriceOracle impl = new SimplePriceOracle();\r\n\r\n vm.prank(someAdminAccount);\r\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\r\n address(impl),\r\n address(dpa),\r\n abi.encodePacked(impl.initialize.selector)\r\n );\r\n oracle = SimplePriceOracle(address(proxy));\r\n }\r\n\r\n function testSimplePO() public fork(BSC_MAINNET) {\r\n vm.expectRevert(\"Ownable: caller is not the owner\");\r\n oracle.setDirectPrice(address(1), 1);\r\n\r\n vm.prank(someAdminAccount);\r\n oracle.setDirectPrice(address(1), 1);\r\n }\r\n}\r\n" + }, + "contracts/test/PoolDirectoryTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\r\n\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\r\n\r\ncontract PoolDirectoryTest is BaseTest {\r\n PoolDirectory fpd;\r\n\r\n function afterForkSetUp() internal override {\r\n address fpdAddress = ap.getAddress(\"PoolDirectory\");\r\n fpd = PoolDirectory(fpdAddress);\r\n\r\n // upgrade to the current changes impl\r\n {\r\n PoolDirectory newImpl = new PoolDirectory();\r\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(fpdAddress));\r\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\r\n address admin = address(uint160(uint256(bytesAtSlot)));\r\n vm.prank(admin);\r\n proxy.upgradeTo(address(newImpl));\r\n }\r\n }\r\n\r\n function testDeprecatePool() public fork(BSC_MAINNET) {\r\n _testDeprecatePool();\r\n }\r\n\r\n function _testDeprecatePool() internal {\r\n PoolDirectory.Pool[] memory allPools = fpd.getAllPools();\r\n\r\n PoolDirectory.Pool memory poolToDeprecate;\r\n\r\n // BOMB pool https://app.midascapital.xyz/56/pool/0\r\n uint256 index = 0;\r\n\r\n poolToDeprecate = allPools[index];\r\n\r\n vm.prank(fpd.owner());\r\n fpd._deprecatePool(index);\r\n\r\n (, PoolDirectory.Pool[] memory allPoolsAfter) = fpd.getActivePools();\r\n\r\n bool poolStillThere = false;\r\n for (uint256 i = 0; i < allPoolsAfter.length; i++) {\r\n if (allPoolsAfter[i].comptroller == poolToDeprecate.comptroller) {\r\n poolStillThere = true;\r\n break;\r\n }\r\n }\r\n\r\n assertTrue(!poolStillThere, \"deprecated pool is still there\");\r\n }\r\n}\r\n" + }, + "contracts/test/UpgradesBaseTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\r\nimport { Comptroller } from \"../compound/Comptroller.sol\";\r\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\r\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\r\nimport { Unitroller } from \"../compound/Unitroller.sol\";\r\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\r\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\r\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\r\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\r\nimport { CErc20RewardsDelegate } from \"../compound/CErc20RewardsDelegate.sol\";\r\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\r\n\r\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\r\n\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\nabstract contract UpgradesBaseTest is BaseTest {\r\n FeeDistributor internal ffd;\r\n ComptrollerFirstExtension internal poolExt;\r\n CTokenFirstExtension internal marketExt;\r\n\r\n function afterForkSetUp() internal virtual override {\r\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\r\n poolExt = new ComptrollerFirstExtension();\r\n marketExt = new CTokenFirstExtension();\r\n }\r\n\r\n function _upgradePoolWithExtension(Unitroller asUnitroller) internal {\r\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\r\n\r\n // instantiate the new implementation\r\n Comptroller newComptrollerImplementation = new Comptroller();\r\n vm.startPrank(ffd.owner());\r\n address comptrollerImplementationAddress = address(newComptrollerImplementation);\r\n ffd._setLatestComptrollerImplementation(address(0), comptrollerImplementationAddress);\r\n // add the extension to the auto upgrade config\r\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\r\n extensions[0] = poolExt;\r\n extensions[1] = newComptrollerImplementation;\r\n ffd._setComptrollerExtensions(comptrollerImplementationAddress, extensions);\r\n vm.stopPrank();\r\n\r\n // upgrade to the new comptroller\r\n vm.startPrank(asUnitroller.admin());\r\n asUnitroller._registerExtension(\r\n DiamondExtension(comptrollerImplementationAddress),\r\n DiamondExtension(asUnitroller.comptrollerImplementation())\r\n );\r\n asUnitroller._upgrade();\r\n vm.stopPrank();\r\n }\r\n\r\n function _upgradeMarketWithExtension(ICErc20 market) internal {\r\n // instantiate the new implementation\r\n CErc20Delegate newImpl;\r\n bytes memory becomeImplData = \"\";\r\n if (compareStrings(\"CErc20Delegate\", market.contractType())) {\r\n newImpl = new CErc20Delegate();\r\n } else if (compareStrings(\"CErc20PluginDelegate\", market.contractType())) {\r\n newImpl = new CErc20PluginDelegate();\r\n becomeImplData = abi.encode(address(0));\r\n } else if (compareStrings(\"CErc20RewardsDelegate\", market.contractType())) {\r\n newImpl = new CErc20RewardsDelegate();\r\n becomeImplData = abi.encode(address(0));\r\n } else {\r\n newImpl = new CErc20PluginRewardsDelegate();\r\n becomeImplData = abi.encode(address(0));\r\n }\r\n\r\n // set the new delegate as the latest\r\n vm.startPrank(ffd.owner());\r\n ffd._setLatestCErc20Delegate(newImpl.delegateType(), address(newImpl), abi.encode(address(0)));\r\n\r\n // add the extension to the auto upgrade config\r\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\r\n cErc20DelegateExtensions[0] = marketExt;\r\n cErc20DelegateExtensions[1] = newImpl;\r\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\r\n vm.stopPrank();\r\n\r\n vm.stopPrank();\r\n // upgrade to the new delegate\r\n vm.prank(address(ffd));\r\n market._setImplementationSafe(address(newImpl), becomeImplData);\r\n }\r\n}\r\n" + }, + "contracts/test/veION/contracts/Voter/mocks/MockBribeRewards.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.10;\r\n\r\nimport \"../../../../../veION/interfaces/IBribeRewards.sol\";\r\n\r\ncontract MockBribeRewards is IBribeRewards {\r\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external override {\r\n emit Deposit(msg.sender, tokenId, amount);\r\n }\r\n\r\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external override {\r\n emit Withdraw(msg.sender, tokenId, amount);\r\n }\r\n\r\n function notifyRewardAmount(address token, uint256 amount) external override {\r\n emit RewardNotification(msg.sender, token, block.timestamp, amount);\r\n }\r\n\r\n function getReward(uint256 tokenId, address[] memory tokens) external override {\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n emit RewardsClaimed(msg.sender, tokens[i], 0); // Assuming 0 as a placeholder for reward amount\r\n }\r\n }\r\n\r\n function getPriorBalanceIndex(\r\n uint256 tokenId,\r\n address lpToken,\r\n uint256 timestamp\r\n ) external view override returns (uint256) {\r\n return 0; // Placeholder return value\r\n }\r\n\r\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view override returns (uint256) {\r\n return 0; // Placeholder return value\r\n }\r\n\r\n function earned(address token, uint256 tokenId) external view override returns (uint256) {\r\n return 0; // Placeholder return value\r\n }\r\n}\r\n" + }, + "contracts/test/veION/contracts/Voter/utils/VoterUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../../../Utils.sol\";\r\nimport \"../../../../../veION/Voter.sol\";\r\nimport \"../mocks/MockBribeRewards.sol\";\r\nimport { IVoter } from \"../../../../../veION/interfaces/IVoter.sol\";\r\nimport { RewardAccumulator } from \"../../../../../veION/RewardAccumulator.sol\";\r\n\r\ncontract VoterTest is veIONTest {\r\n Voter voter;\r\n LockInfo voterLockInfoSingleLp;\r\n LockInfoMultiple voterLockInfoMultiLp;\r\n uint256 voterTokenIdSingleLp;\r\n uint256 voterTokenIdMultiLp;\r\n address user;\r\n\r\n address ethMarket;\r\n address btcMarket;\r\n\r\n MockBribeRewards bribeEthSupply;\r\n MockBribeRewards bribeEthBorrow;\r\n MockBribeRewards bribeBtcSupply;\r\n MockBribeRewards bribeBtcBorrow;\r\n\r\n MasterPriceOracle mpo;\r\n\r\n function _setUp() internal virtual override {\r\n super._setUp();\r\n ethMarket = _generateRandomAddress(1);\r\n btcMarket = _generateRandomAddress(2);\r\n\r\n address[] memory _tokens = new address[](2);\r\n _tokens[0] = address(modeVelodrome5050IonMode);\r\n _tokens[1] = address(modeBalancer8020IonEth);\r\n\r\n MasterPriceOracle _mpo = new MasterPriceOracle();\r\n MockERC20 mockIon = new MockERC20(\"Mock ION\", \"mION\", 18);\r\n address _rewardToken = address(mockIon);\r\n address _ve = address(ve);\r\n\r\n voter = Voter(\r\n address(\r\n new TransparentUpgradeableProxy(\r\n address(new Voter()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, _mpo, _rewardToken, _ve)\r\n )\r\n )\r\n );\r\n\r\n IVoter.Market[] memory dummyMarkets = new IVoter.Market[](4);\r\n dummyMarkets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\r\n dummyMarkets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\r\n dummyMarkets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\r\n dummyMarkets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\r\n voter.addMarkets(dummyMarkets);\r\n\r\n address[] memory marketAddresses = new address[](4);\r\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\r\n address[] memory rewardAccumulators = new address[](4);\r\n marketAddresses[0] = ethMarket;\r\n marketSides[0] = IVoter.MarketSide.Supply;\r\n marketAddresses[1] = ethMarket;\r\n marketSides[1] = IVoter.MarketSide.Borrow;\r\n marketAddresses[2] = btcMarket;\r\n marketSides[2] = IVoter.MarketSide.Supply;\r\n marketAddresses[3] = btcMarket;\r\n marketSides[3] = IVoter.MarketSide.Borrow;\r\n\r\n for (uint i = 0; i < 4; i++) {\r\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\r\n rewardAccumulators[i] = address(newRewardAccumulator);\r\n }\r\n\r\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\r\n\r\n bribeEthSupply = new MockBribeRewards();\r\n bribeEthBorrow = new MockBribeRewards();\r\n bribeBtcSupply = new MockBribeRewards();\r\n bribeBtcBorrow = new MockBribeRewards();\r\n\r\n address[] memory rewardAccumulatorsForBribes = new address[](4);\r\n address[] memory bribes = new address[](4);\r\n\r\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\r\n bribes[0] = address(bribeEthSupply);\r\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\r\n bribes[1] = address(bribeEthBorrow);\r\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\r\n bribes[2] = address(bribeBtcSupply);\r\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\r\n bribes[3] = address(bribeBtcBorrow);\r\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\r\n\r\n voter.setMaxVotingNum(20);\r\n address[] memory lpTokens = new address[](2);\r\n lpTokens[0] = address(modeVelodrome5050IonMode);\r\n lpTokens[1] = address(modeBalancer8020IonEth);\r\n\r\n voter.setLpTokens(lpTokens);\r\n user = address(0x9523);\r\n vm.warp(block.timestamp + 10 * 365 days);\r\n\r\n voterLockInfoSingleLp = _createLockInternal(user);\r\n voterLockInfoMultiLp = _createLockMultipleInternal(user);\r\n\r\n voterTokenIdSingleLp = voterLockInfoSingleLp.tokenId;\r\n voterTokenIdMultiLp = voterLockInfoMultiLp.tokenId;\r\n\r\n IveION(ve).setVoter(address(voter));\r\n }\r\n\r\n function afterForkSetUp() internal virtual override {\r\n _afterForkSetUpBase();\r\n\r\n ethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\r\n btcMarket = 0x1De166df671AE6DB4C4C98903df88E8007593748;\r\n\r\n address[] memory _tokens = new address[](1);\r\n _tokens[0] = address(0x0FAc819628a7F612AbAc1CaD939768058cc0170c);\r\n\r\n mpo = MasterPriceOracle(0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4);\r\n IERC20 ion = IERC20(0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5);\r\n\r\n voter = Voter(\r\n address(\r\n new TransparentUpgradeableProxy(\r\n address(new Voter()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, mpo, address(ion), address(ve))\r\n )\r\n )\r\n );\r\n\r\n IVoter.Market[] memory markets = new IVoter.Market[](4);\r\n markets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\r\n markets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\r\n markets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\r\n markets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\r\n voter.addMarkets(markets);\r\n\r\n address[] memory marketAddresses = new address[](4);\r\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\r\n address[] memory rewardAccumulators = new address[](4);\r\n marketAddresses[0] = ethMarket;\r\n marketSides[0] = IVoter.MarketSide.Supply;\r\n marketAddresses[1] = ethMarket;\r\n marketSides[1] = IVoter.MarketSide.Borrow;\r\n marketAddresses[2] = btcMarket;\r\n marketSides[2] = IVoter.MarketSide.Supply;\r\n marketAddresses[3] = btcMarket;\r\n marketSides[3] = IVoter.MarketSide.Borrow;\r\n\r\n for (uint i = 0; i < 4; i++) {\r\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\r\n rewardAccumulators[i] = address(newRewardAccumulator);\r\n }\r\n\r\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\r\n\r\n bribeEthSupply = new MockBribeRewards();\r\n bribeEthBorrow = new MockBribeRewards();\r\n bribeBtcSupply = new MockBribeRewards();\r\n bribeBtcBorrow = new MockBribeRewards();\r\n address[] memory rewardAccumulatorsForBribes = new address[](4);\r\n address[] memory bribes = new address[](4);\r\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\r\n bribes[0] = address(bribeEthSupply);\r\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\r\n bribes[1] = address(bribeEthBorrow);\r\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\r\n bribes[2] = address(bribeBtcSupply);\r\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\r\n bribes[3] = address(bribeBtcBorrow);\r\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\r\n\r\n voter.setMaxVotingNum(20);\r\n\r\n address[] memory lpTokens = new address[](2);\r\n lpTokens[0] = address(ionWeth5050lPAero);\r\n lpTokens[1] = address(wethAero5050LPAero);\r\n voter.setLpTokens(lpTokens);\r\n\r\n IveION(ve).setVoter(address(voter));\r\n\r\n baseTokenIdSingleLp = _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\r\n }\r\n\r\n function _vote(address _user, uint256 _tokenId, uint256[] memory weights) internal {\r\n address[] memory selectedMarkets = new address[](4);\r\n IVoter.MarketSide[] memory selectedSides = new IVoter.MarketSide[](4);\r\n uint256[] memory selectedWeights = new uint256[](4);\r\n\r\n selectedMarkets[0] = ethMarket;\r\n selectedSides[0] = IVoter.MarketSide.Supply;\r\n selectedWeights[0] = weights[0];\r\n\r\n selectedMarkets[1] = btcMarket;\r\n selectedSides[1] = IVoter.MarketSide.Supply;\r\n selectedWeights[1] = weights[1];\r\n\r\n selectedMarkets[2] = ethMarket;\r\n selectedSides[2] = IVoter.MarketSide.Borrow;\r\n selectedWeights[2] = weights[2];\r\n\r\n selectedMarkets[3] = btcMarket;\r\n selectedSides[3] = IVoter.MarketSide.Borrow;\r\n selectedWeights[3] = weights[3];\r\n\r\n vm.prank(_user);\r\n voter.vote(_tokenId, selectedMarkets, selectedSides, selectedWeights);\r\n }\r\n}\r\n" + }, + "contracts/test/veION/harness/veIONHarness.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\nimport \"../../../veION/veION.sol\";\r\n\r\n// This harness contract can be used for testing purposes.\r\ncontract veIONHarness is veION {\r\n constructor(uint256 _minimumLockDuration) {\r\n s_minimumLockDuration = _minimumLockDuration;\r\n }\r\n\r\n function exposed_calculateBoost(uint256 _duration) external view returns (uint256) {\r\n return _calculateBoost(_duration);\r\n }\r\n}\r\n" + }, + "contracts/test/veION/Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\r\nimport \"../config/BaseTest.t.sol\";\r\nimport \"../../veION/veION.sol\";\r\nimport \"../../veION/veIONFirstExtension.sol\";\r\nimport \"../../veION/veIONSecondExtension.sol\";\r\nimport \"../../veION/interfaces/IveION.sol\";\r\n// import \"../../veION/interfaces/IveIONCore.sol\";\r\nimport \"../../veION/stake/IStakeStrategy.sol\";\r\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\r\nimport \"../../veION/stake/IStakeStrategy.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\r\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\r\nimport \"../../veION/stake/velo/VeloAeroStakingWallet.sol\";\r\nimport \"../../veION/stake/velo/IVeloIonModeStaking.sol\";\r\nimport \"./harness/veIONHarness.sol\";\r\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\r\n\r\ncontract veIONTest is BaseTest {\r\n using Strings for uint256;\r\n using Strings for bool;\r\n using Strings for address;\r\n\r\n address ve;\r\n address veFirstExtension;\r\n address veSecondExtension;\r\n MockERC20 modeVelodrome5050IonMode;\r\n MockERC20 modeBalancer8020IonEth;\r\n MockERC20 baseAerodrome5050IonWstEth;\r\n MockERC20 baseBalancer8020IonEth;\r\n MockERC20 optimismVelodrome5050IonOp;\r\n MockERC20 optimismBalancer8020IonEth;\r\n IveIONStructsEnumsErrorsEvents.LpTokenType veloLpType;\r\n IveIONStructsEnumsErrorsEvents.LpTokenType balancerLpType;\r\n VeloAeroStakingWallet veloStakingWalletImplementation;\r\n veIONHarness harness;\r\n\r\n address ionMode5050LP;\r\n address ionWeth5050lPAero;\r\n address wethAero5050LPAero;\r\n address veloGauge;\r\n VeloAeroStakingStrategy veloIonModeStakingStrategy;\r\n VeloAeroStakingStrategy veloWethUsdcStakingStrategy;\r\n address stakingWalletInstance;\r\n uint256 stakingWalletInstanceBalance;\r\n\r\n address wethUSDC5050LP;\r\n address wethUSDCGauge;\r\n\r\n // Base Fork Vars\r\n address baseUser;\r\n uint256 baseTokenIdSingleLp;\r\n\r\n uint256 internal constant MINT_AMT = 1000 ether;\r\n uint256 internal constant WEEK = 1 weeks;\r\n uint256 internal constant MAXTIME = 2 * 365 * 86400;\r\n uint256 internal constant MINTIME = 180 * 86400;\r\n uint256 internal constant EARLY_WITHDRAW_FEE = 0.8e18;\r\n uint256 internal constant MINIMUM_LOCK_AMOUNT = 10e18;\r\n uint256 internal constant REAL_LP_LOCK_AMOUNT = 10e18;\r\n\r\n function _setUp() internal virtual {\r\n ve = address(\r\n new TransparentUpgradeableProxy(\r\n address(new veION()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\r\n )\r\n );\r\n\r\n veFirstExtension = address(new veIONFirstExtension());\r\n veSecondExtension = address(new veIONSecondExtension());\r\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\r\n\r\n modeVelodrome5050IonMode = new MockERC20(\"Mode_Velodrome_5050_ION_MODE\", \"MV5050\", 18);\r\n modeBalancer8020IonEth = new MockERC20(\"Mode_Balancer_8020_ION_ETH\", \"MB8020\", 18);\r\n\r\n harness = new veIONHarness(MINTIME);\r\n\r\n address[] memory whitelistedTokens = new address[](2);\r\n bool[] memory isWhitelistedTokens = new bool[](2);\r\n\r\n whitelistedTokens[0] = address(modeVelodrome5050IonMode);\r\n whitelistedTokens[1] = address(modeBalancer8020IonEth);\r\n\r\n for (uint i = 0; i < 2; i++) {\r\n isWhitelistedTokens[i] = true;\r\n }\r\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\r\n\r\n IveION(ve).setLpTokenType(\r\n address(modeVelodrome5050IonMode),\r\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE\r\n );\r\n IveION(ve).setLpTokenType(\r\n address(modeBalancer8020IonEth),\r\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH\r\n );\r\n\r\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\r\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\r\n\r\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\r\n\r\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\r\n IveION(ve).setMinimumLockDuration(MINTIME);\r\n IveION(ve).setMinimumLockAmount(address(modeVelodrome5050IonMode), MINIMUM_LOCK_AMOUNT);\r\n IveION(ve).setMinimumLockAmount(address(modeBalancer8020IonEth), MINIMUM_LOCK_AMOUNT);\r\n }\r\n\r\n function _afterForkSetUpMode() internal {\r\n ve = address(\r\n new TransparentUpgradeableProxy(\r\n address(new veION()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\r\n )\r\n );\r\n\r\n veFirstExtension = address(new veIONFirstExtension());\r\n veSecondExtension = address(new veIONSecondExtension());\r\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\r\n\r\n ionMode5050LP = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\r\n veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\r\n\r\n wethUSDC5050LP = 0x283bA4E204DFcB6381BCBf2cb5d0e765A2B57bC2;\r\n wethUSDCGauge = 0x98d34C7b004688F35b67Aa30D4dF5E67113f6B3D;\r\n\r\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\r\n\r\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\r\n address(\r\n new TransparentUpgradeableProxy(\r\n address(new VeloAeroStakingStrategy()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(\r\n VeloAeroStakingStrategy.initialize.selector,\r\n address(ve),\r\n ionMode5050LP,\r\n veloGauge,\r\n address(veloStakingWalletImplementation)\r\n )\r\n )\r\n )\r\n );\r\n\r\n veloWethUsdcStakingStrategy = VeloAeroStakingStrategy(\r\n address(\r\n new TransparentUpgradeableProxy(\r\n address(new VeloAeroStakingStrategy()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(\r\n VeloAeroStakingStrategy.initialize.selector,\r\n address(ve),\r\n wethUSDC5050LP,\r\n wethUSDCGauge,\r\n address(veloStakingWalletImplementation)\r\n )\r\n )\r\n )\r\n );\r\n\r\n address[] memory whitelistedTokens = new address[](2);\r\n bool[] memory isWhitelistedTokens = new bool[](2);\r\n whitelistedTokens[0] = ionMode5050LP;\r\n isWhitelistedTokens[0] = true;\r\n whitelistedTokens[1] = wethUSDC5050LP;\r\n isWhitelistedTokens[1] = true;\r\n\r\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\r\n IveION(ve).setLpTokenType(ionMode5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\r\n IveION(ve).setLpTokenType(wethUSDC5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH);\r\n\r\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\r\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\r\n\r\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\r\n IveION(ve).setStakeStrategy(balancerLpType, IStakeStrategy(veloWethUsdcStakingStrategy));\r\n\r\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\r\n IveION(ve).setMinimumLockDuration(MINTIME);\r\n IveION(ve).setMinimumLockAmount(address(ionMode5050LP), MINIMUM_LOCK_AMOUNT);\r\n IveION(ve).setMinimumLockAmount(address(wethUSDC5050LP), MINIMUM_LOCK_AMOUNT);\r\n }\r\n\r\n function _afterForkSetUpBase() internal {\r\n baseUser = address(0x987);\r\n ve = address(\r\n new TransparentUpgradeableProxy(\r\n address(new veION()),\r\n address(new ProxyAdmin()),\r\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\r\n )\r\n );\r\n\r\n veFirstExtension = address(new veIONFirstExtension());\r\n veSecondExtension = address(new veIONSecondExtension());\r\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\r\n\r\n harness = new veIONHarness(MINTIME);\r\n\r\n ionWeth5050lPAero = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\r\n wethAero5050LPAero = 0x7f670f78B17dEC44d5Ef68a48740b6f8849cc2e6;\r\n\r\n address[] memory whitelistedTokens = new address[](2);\r\n bool[] memory isWhitelistedTokens = new bool[](2);\r\n whitelistedTokens[0] = ionWeth5050lPAero;\r\n isWhitelistedTokens[0] = true;\r\n whitelistedTokens[1] = wethAero5050LPAero;\r\n isWhitelistedTokens[1] = true;\r\n\r\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\r\n IveION(ve).setLpTokenType(\r\n ionWeth5050lPAero,\r\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Aerodrome_5050_ION_wstETH\r\n );\r\n IveION(ve).setLpTokenType(\r\n wethAero5050LPAero,\r\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Balancer_8020_ION_ETH\r\n );\r\n\r\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\r\n IveION(ve).setMinimumLockDuration(MINTIME);\r\n IveION(ve).setMinimumLockAmount(address(ionWeth5050lPAero), MINIMUM_LOCK_AMOUNT);\r\n IveION(ve).setMinimumLockAmount(address(wethAero5050LPAero), MINIMUM_LOCK_AMOUNT);\r\n }\r\n\r\n function _lockSingleLPFork(address _user, uint256 _amount) internal returns (uint256) {\r\n address whale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\r\n vm.prank(whale);\r\n IERC20(ionWeth5050lPAero).transfer(_user, _amount);\r\n\r\n address[] memory tokenAddresses = new address[](1);\r\n uint256[] memory tokenAmounts = new uint256[](1);\r\n uint256[] memory durations = new uint256[](1);\r\n bool[] memory stakeUnderlying = new bool[](1);\r\n tokenAddresses[0] = address(ionWeth5050lPAero);\r\n tokenAmounts[0] = _amount;\r\n durations[0] = 52 weeks;\r\n stakeUnderlying[0] = false;\r\n\r\n vm.startPrank(_user);\r\n IERC20(ionWeth5050lPAero).approve(address(ve), _amount);\r\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\r\n vm.stopPrank();\r\n\r\n return tokenId;\r\n }\r\n\r\n function _lockMultiLpFork(address _user, uint256 _amountIonWeth, uint256 _amountWethAERO) internal returns (uint256) {\r\n address ionWethWhale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\r\n address wethAEROWhale = 0x96a24aB830D4ec8b1F6f04Ceac104F1A3b211a01;\r\n\r\n vm.prank(ionWethWhale);\r\n IERC20(ionWeth5050lPAero).transfer(_user, _amountIonWeth);\r\n vm.prank(wethAEROWhale);\r\n IERC20(wethAero5050LPAero).transfer(_user, _amountWethAERO);\r\n\r\n address[] memory tokenAddresses = new address[](2);\r\n uint256[] memory tokenAmounts = new uint256[](2);\r\n uint256[] memory durations = new uint256[](2);\r\n bool[] memory stakeUnderlying = new bool[](2);\r\n tokenAddresses[0] = address(ionWeth5050lPAero);\r\n tokenAmounts[0] = _amountIonWeth;\r\n durations[0] = 52 weeks;\r\n stakeUnderlying[0] = false;\r\n tokenAddresses[1] = address(wethAero5050LPAero);\r\n tokenAmounts[1] = _amountWethAERO;\r\n durations[1] = 52 weeks;\r\n stakeUnderlying[1] = false;\r\n\r\n vm.startPrank(_user);\r\n IERC20(ionWeth5050lPAero).approve(address(ve), _amountIonWeth);\r\n IERC20(wethAero5050LPAero).approve(address(ve), _amountWethAERO);\r\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\r\n vm.stopPrank();\r\n\r\n return tokenId;\r\n }\r\n\r\n function _createLockInternal(address user) internal returns (LockInfo memory) {\r\n TestVars memory vars;\r\n vars.user = user;\r\n vars.amount = MINT_AMT;\r\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\r\n\r\n vm.startPrank(vars.user);\r\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\r\n vm.stopPrank();\r\n\r\n vars.tokenAddresses = new address[](1);\r\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\r\n\r\n vars.tokenAmounts = new uint256[](1);\r\n vars.tokenAmounts[0] = vars.amount;\r\n\r\n vars.durations = new uint256[](1);\r\n vars.durations[0] = 52 weeks;\r\n\r\n vm.startPrank(vars.user);\r\n uint256 tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](1));\r\n vm.stopPrank();\r\n\r\n return LockInfo(tokenId, vars.tokenAddresses[0], vars.tokenAmounts[0], vars.durations[0]);\r\n }\r\n\r\n function _createLockMultipleInternal(address user) internal returns (LockInfoMultiple memory) {\r\n TestVars memory vars;\r\n vars.user = user;\r\n\r\n vars.amount = MINT_AMT;\r\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\r\n modeBalancer8020IonEth.mint(vars.user, vars.amount);\r\n\r\n vm.startPrank(vars.user);\r\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\r\n modeBalancer8020IonEth.approve(address(ve), vars.amount);\r\n vm.stopPrank();\r\n\r\n vars.tokenAddresses = new address[](2);\r\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\r\n vars.tokenAddresses[1] = address(modeBalancer8020IonEth);\r\n\r\n vars.tokenAmounts = new uint256[](2);\r\n vars.tokenAmounts[0] = vars.amount;\r\n vars.tokenAmounts[1] = vars.amount;\r\n\r\n vars.durations = new uint256[](2);\r\n vars.durations[0] = 52 weeks;\r\n vars.durations[1] = 52 weeks;\r\n\r\n vm.startPrank(vars.user);\r\n vars.tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](2));\r\n vm.stopPrank();\r\n\r\n return LockInfoMultiple(vars.tokenId, vars.tokenAddresses, vars.tokenAmounts, vars.durations);\r\n }\r\n\r\n function _createLockInternalRealLP(address _user, bool _stakeUnderlying) internal returns (LockInfo memory) {\r\n uint256 amountStaked = REAL_LP_LOCK_AMOUNT;\r\n address whale = 0x8ff8b21a0736738b25597D32d8f7cf658f39f157;\r\n vm.prank(whale);\r\n IERC20(ionMode5050LP).transfer(_user, amountStaked);\r\n\r\n address[] memory tokenAddresses = new address[](1);\r\n tokenAddresses[0] = address(ionMode5050LP);\r\n\r\n uint256[] memory tokenAmounts = new uint256[](1);\r\n tokenAmounts[0] = amountStaked;\r\n\r\n uint256[] memory durations = new uint256[](1);\r\n durations[0] = 52 weeks;\r\n\r\n bool[] memory stakeUnderlying = new bool[](1);\r\n stakeUnderlying[0] = _stakeUnderlying;\r\n\r\n vm.startPrank(_user);\r\n IERC20(ionMode5050LP).approve(address(ve), amountStaked);\r\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\r\n vm.stopPrank();\r\n\r\n return LockInfo(tokenId, tokenAddresses[0], tokenAmounts[0], durations[0]);\r\n }\r\n\r\n function _generateRandomAddress(uint256 seed) internal pure returns (address) {\r\n return address(uint160(uint256(keccak256(abi.encodePacked(seed)))));\r\n }\r\n\r\n function _logTokens(uint256[] memory tokenIds, address[] memory lpTokens) internal view {\r\n for (uint256 i = 0; i < tokenIds.length; i++) {\r\n for (uint256 j = 0; j < lpTokens.length; j++) {\r\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\r\n tokenIds[i],\r\n IveION(ve).s_lpType(lpTokens[j])\r\n );\r\n uint256 tokenId = i + 1;\r\n console.log(\r\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Token: \", lock.tokenAddress.toHexString()))\r\n );\r\n console.log(\r\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Amount: \", lock.amount.toString()))\r\n );\r\n console.log(\r\n string(\r\n abi.encodePacked(\r\n \"Token ID \",\r\n tokenId.toString(),\r\n \" Locked Delegate Amount: \",\r\n lock.delegateAmount.toString()\r\n )\r\n )\r\n );\r\n console.log(\r\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Start: \", lock.start.toString()))\r\n );\r\n console.log(string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked End: \", lock.end.toString())));\r\n console.log(\r\n string(\r\n abi.encodePacked(\r\n \"Token ID \",\r\n tokenId.toString(),\r\n \" Locked IsPermanent: \",\r\n lock.isPermanent ? \"true\" : \"false\"\r\n )\r\n )\r\n );\r\n console.log(\r\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Boost: \", lock.boost.toString()))\r\n );\r\n console.log(\"--------------------------------------------------\");\r\n }\r\n console.log(\"====================================================\");\r\n }\r\n }\r\n\r\n function _logCumulativeAssetValues(address[] memory users, address[] memory lpTokens) internal view {\r\n console.log(\"-----------------------------------------------------------------\");\r\n for (uint256 i = 0; i < users.length; i++) {\r\n address user = users[i];\r\n console.log(\"Cumulative Asset Values for User:\", user);\r\n for (uint256 j = 0; j < lpTokens.length; j++) {\r\n console.log(\"Token:\", lpTokens[j], \"Value:\", IveION(ve).s_userCumulativeAssetValues(user, lpTokens[j]));\r\n }\r\n console.log(\"====================================================\");\r\n }\r\n }\r\n\r\n function _logUnderlyingStake(address[] memory users) internal view {\r\n console.log(\"-----------------------------------------------------------------\");\r\n for (uint256 i = 0; i < users.length; i++) {\r\n address user = users[i];\r\n console.log(\"Underlying Stakes For:\", user);\r\n address stakingWalletInstanceIonMode = veloIonModeStakingStrategy.userStakingWallet(user);\r\n uint256 stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\r\n\r\n address stakingWalletInstanceWethUsdc = veloWethUsdcStakingStrategy.userStakingWallet(user);\r\n uint256 stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\r\n\r\n console.log(\"Staked Balance Ion-Mode:\", stakedBalanceIonMode);\r\n console.log(\"Staked Balance Weth-Usdc:\", stakedBalanceWethUsdc);\r\n console.log(\"====================================================\");\r\n }\r\n }\r\n}\r\n\r\nstruct TestVars {\r\n address user;\r\n address user2;\r\n uint256 amount;\r\n address[] tokenAddresses;\r\n uint256[] tokenAmounts;\r\n uint256[] durations;\r\n bool[] stakeUnderlying;\r\n uint256 tokenId;\r\n uint256 secondTokenId;\r\n uint256 expectedSupply;\r\n uint256 userEpoch;\r\n uint256 globalEpoch;\r\n address lockedBalance_tokenAddress;\r\n uint256 lockedBalance_amount;\r\n uint256 delegated_lockedBalance_amount;\r\n uint256 lockedBalance_start;\r\n uint256 lockedBalance_end;\r\n bool lockedBalance_isPermanent;\r\n uint256 lockedBalance_boost;\r\n uint256 userPoint_bias;\r\n uint256 userPoint_slope;\r\n uint256 userPoint_ts;\r\n uint256 userPoint_blk;\r\n uint256 userPoint_permanent;\r\n uint256 userPoint_permanentDelegate;\r\n int128 globalPoint_bias;\r\n int128 globalPoint_slope;\r\n uint256 globalPoint_ts;\r\n uint256 globalPoint_blk;\r\n uint256 globalPoint_permanentLockBalance;\r\n uint256[] ownerTokenIds;\r\n address[] assetsLocked;\r\n uint256 tokenId_test;\r\n address lockedBalance_tokenAddress_test;\r\n uint256 lockedBalance_amount_test;\r\n uint256 lockedBalance_duration_test;\r\n uint256 lockedBalance_end_test;\r\n}\r\n\r\nstruct LockInfo {\r\n uint256 tokenId;\r\n address tokenAddress;\r\n uint256 tokenAmount;\r\n uint256 duration;\r\n}\r\n\r\nstruct LockInfoMultiple {\r\n uint256 tokenId;\r\n address[] tokenAddresses;\r\n uint256[] tokenAmounts;\r\n uint256[] durations;\r\n}\r\n\r\nstruct AeroBoostVars {\r\n uint256 aeroVoterBoost;\r\n address aeroVotingAddress;\r\n address ionicPoolAddress;\r\n address veAEROAddress;\r\n address AERO;\r\n uint256 lockAmount;\r\n address aeroWhale;\r\n uint256 veAeroTokenId;\r\n address[] poolVote;\r\n uint256[] weights;\r\n}\r\n\r\ninterface IveAERO {\r\n /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration`\r\n /// @param _value Amount to deposit\r\n /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week)\r\n /// @return TokenId of created veNFT\r\n function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256);\r\n}\r\n\r\ninterface IAEROVoter {\r\n /// @notice Called by users to vote for pools. Votes distributed proportionally based on weights.\r\n /// Can only vote or deposit into a managed NFT once per epoch.\r\n /// Can only vote for gauges that have not been killed.\r\n /// @dev Weights are distributed proportional to the sum of the weights in the array.\r\n /// Throws if length of _poolVote and _weights do not match.\r\n /// @param _tokenId Id of veNFT you are voting with.\r\n /// @param _poolVote Array of pools you are voting for.\r\n /// @param _weights Weights of pools.\r\n function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external;\r\n\r\n /// @notice Returns the number of votes for a given veNFT token ID and pool address.\r\n /// @param _tokenId The ID of the veNFT.\r\n /// @param _pool The address of the pool.\r\n /// @return The number of votes for the given token ID and pool.\r\n function votes(uint256 _tokenId, address _pool) external view returns (uint256);\r\n}\r\n" + }, + "contracts/utils/IMulticall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.8.0;\r\n\r\n/// @title Multicall interface\r\n/// @notice Enables calling multiple methods in a single call to the contract\r\ninterface IMulticall {\r\n /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed\r\n /// @dev The `msg.value` should not be trusted for any method callable from multicall.\r\n /// @param data The encoded function data for each of the calls to make to this contract\r\n /// @return results The results from each of the calls passed in via data\r\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\r\n}\r\n" + }, + "contracts/utils/IW_NATIVE.sol": { + "content": "// SPDX-License-Identifier: agpl-3.0\r\npragma solidity >=0.8.0;\r\n\r\ninterface IW_NATIVE {\r\n function deposit() external payable;\r\n\r\n function withdraw(uint256 amount) external;\r\n\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n function balanceOf(address) external view returns (uint256);\r\n}\r\n" + }, + "contracts/utils/Multicall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IMulticall.sol\";\r\n\r\n/// @title Multicall\r\n/// @notice Enables calling multiple methods in a single call to the contract\r\nabstract contract Multicall is IMulticall {\r\n /// @inheritdoc IMulticall\r\n function multicall(bytes[] calldata data) public payable virtual override returns (bytes[] memory results) {\r\n results = new bytes[](data.length);\r\n for (uint256 i = 0; i < data.length; i++) {\r\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\r\n\r\n if (!success) {\r\n // Next 5 lines from https://ethereum.stackexchange.com/a/83577\r\n if (result.length < 68) revert();\r\n assembly {\r\n result := add(result, 0x04)\r\n }\r\n revert(abi.decode(result, (string)));\r\n }\r\n\r\n results[i] = result;\r\n }\r\n }\r\n}\r\n" + }, + "contracts/utils/TOUCHToken.sol": { + "content": "pragma solidity ^0.8.0;\r\n\r\n// SPDX-License-Identifier: UNLICENSED\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\n\r\ncontract TOUCHToken is ERC20 {\r\n constructor(uint256 initialSupply, address tokenOwner) ERC20(\"Midas TOUCH Token\", \"TOUCH\", 18) {\r\n _mint(tokenOwner, initialSupply);\r\n }\r\n}\r\n" + }, + "contracts/utils/TRIBEToken.sol": { + "content": "pragma solidity ^0.8.0;\r\n\r\n// SPDX-License-Identifier: UNLICENSED\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\n\r\ncontract TRIBEToken is ERC20 {\r\n constructor(uint256 initialSupply, address tokenOwner) ERC20(\"TRIBE Governance Token\", \"TRIBE\", 18) {\r\n _mint(tokenOwner, initialSupply);\r\n }\r\n}\r\n" + }, + "contracts/veION/BribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\r\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\r\nimport { IVoter } from \"./interfaces/IVoter.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\r\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\r\n\r\n/**\r\n * @title BribeRewards Contract\r\n * @notice This contract allows veION to benefit from bribes when voting for various markets\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\r\n using SafeERC20 for IERC20;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ State Variables ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n /// @notice Duration of the reward period in seconds\r\n uint256 public constant DURATION = 7 days;\r\n /// @notice Address of the voter contract\r\n address public voter;\r\n /// @notice Address of the veION contract\r\n address public ve;\r\n /// @notice List of reward tokens\r\n address[] public rewards;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Mappings ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n /// @notice Mapping to check if an address is a reward token\r\n mapping(address => bool) public isReward;\r\n /// @notice Total supply of LP tokens for each reward token\r\n mapping(address => uint256) public totalSupply;\r\n /// @notice Balance of LP tokens for each tokenId and reward token\r\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\r\n /// @notice Rewards per epoch for each reward token\r\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\r\n /// @notice Last earned timestamp for each reward token and tokenId\r\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\r\n /// @notice A record of balance checkpoints for each account, by index\r\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\r\n /// @notice The number of checkpoints for each account\r\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\r\n /// @notice A record of balance checkpoints for each token, by index\r\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\r\n /// @notice The number of supply checkpoints for each token\r\n mapping(address => uint256) public supplyNumCheckpoints;\r\n /// @notice Historical prices for each reward token and epoch\r\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\r\n\r\n /**\r\n * @notice Modifier to restrict access to only the voter contract\r\n * @dev Ensures that the caller is the voter contract\r\n */\r\n modifier onlyVoter() {\r\n require(msg.sender == voter, \"Caller is not the voter\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n /**\r\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\r\n * @dev This function is called only once during contract deployment\r\n * @param _voter The address of the voter contract\r\n * @param _ve The address of the veION contract\r\n */\r\n function initialize(address _voter, address _ve) public initializer {\r\n __ReentrancyGuard_init();\r\n __Ownable2Step_init();\r\n voter = _voter;\r\n ve = _ve;\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ External Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IBribeRewards\r\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\r\n address sender = msg.sender;\r\n\r\n totalSupply[lpToken] += amount;\r\n balanceOf[tokenId][lpToken] += amount;\r\n\r\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\r\n _writeSupplyCheckpoint(lpToken);\r\n\r\n emit Deposit(sender, tokenId, amount);\r\n }\r\n\r\n /// @inheritdoc IBribeRewards\r\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\r\n address sender = msg.sender;\r\n\r\n totalSupply[lpToken] -= amount;\r\n balanceOf[tokenId][lpToken] -= amount;\r\n\r\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\r\n _writeSupplyCheckpoint(lpToken);\r\n\r\n emit Withdraw(sender, tokenId, amount);\r\n }\r\n\r\n /**\r\n * @inheritdoc IBribeRewards\r\n * @notice This function can accept any token, regardless of its whitelisting status.\r\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\r\n */\r\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\r\n address sender = msg.sender;\r\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\r\n\r\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\r\n _getReward(_owner, tokenId, tokens);\r\n }\r\n\r\n /// @inheritdoc IBribeRewards\r\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\r\n address sender = msg.sender;\r\n\r\n if (!isReward[token]) {\r\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\r\n isReward[token] = true;\r\n rewards.push(token);\r\n }\r\n\r\n _notifyRewardAmount(sender, token, amount);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Internal Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @dev used with all getReward implementations\r\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\r\n // check if token whitelisted\r\n uint256 _length = tokens.length;\r\n for (uint256 i = 0; i < _length; i++) {\r\n uint256 _reward = earned(tokens[i], tokenId);\r\n lastEarn[tokens[i]][tokenId] = block.timestamp;\r\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\r\n\r\n emit RewardsClaimed(recipient, tokens[i], _reward);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Writes a new checkpoint for a token's balance\r\n * @param tokenId The ID of the veION token\r\n * @param lpToken The LP token address\r\n * @param balance The balance to record\r\n */\r\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\r\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\r\n uint256 _timestamp = block.timestamp;\r\n\r\n if (\r\n _nCheckPoints > 0 &&\r\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\r\n IonicTimeLibrary.epochStart(_timestamp)\r\n ) {\r\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\r\n } else {\r\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\r\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\r\n }\r\n }\r\n\r\n /// @notice Writes a new checkpoint for total supply\r\n /// @param lpToken The LP token address\r\n function _writeSupplyCheckpoint(address lpToken) internal {\r\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\r\n uint256 _timestamp = block.timestamp;\r\n\r\n if (\r\n _nCheckPoints > 0 &&\r\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\r\n IonicTimeLibrary.epochStart(_timestamp)\r\n ) {\r\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\r\n } else {\r\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\r\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\r\n }\r\n }\r\n\r\n /// @dev used within all notifyRewardAmount implementations\r\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\r\n if (amount == 0) revert AmountCannotBeZero();\r\n IERC20(token).safeTransferFrom(sender, address(this), amount);\r\n\r\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\r\n tokenRewardsPerEpoch[token][epochStart] += amount;\r\n\r\n emit RewardNotification(sender, token, epochStart, amount);\r\n }\r\n\r\n /**\r\n * @notice Calculates the ETH value of a token amount at a specific epoch\r\n * @param amount The amount of tokens\r\n * @param lpToken The LP token address\r\n * @param epochTimestamp The timestamp of the epoch\r\n * @return The ETH value of the tokens\r\n */\r\n function _getTokenEthValueAt(\r\n uint256 amount,\r\n address lpToken,\r\n uint256 epochTimestamp\r\n ) internal view returns (uint256) {\r\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\r\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\r\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\r\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\r\n return ethValue;\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Pure/View Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @notice Returns the total number of reward tokens\r\n /// @return The length of the rewards array\r\n function rewardsListLength() external view returns (uint256) {\r\n return rewards.length;\r\n }\r\n\r\n /// @inheritdoc IBribeRewards\r\n function earned(address token, uint256 tokenId) public view returns (uint256) {\r\n EarnedVars memory vars;\r\n vars.totalReward = 0;\r\n address[] memory lpTokens = getAllLpRewardTokens();\r\n uint256 lpTokensLength = lpTokens.length;\r\n for (uint256 j = 0; j < lpTokensLength; j++) {\r\n address lpToken = lpTokens[j];\r\n\r\n if (numCheckpoints[tokenId][lpToken] == 0) {\r\n continue;\r\n }\r\n\r\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\r\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\r\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\r\n\r\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\r\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\r\n\r\n if (vars.numEpochs > 0) {\r\n for (uint256 i = 0; i < vars.numEpochs; i++) {\r\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\r\n cp0 = checkpoints[tokenId][lpToken][vars.index];\r\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\r\n\r\n vars.supplyValue = 0;\r\n for (uint256 k = 0; k < lpTokensLength; k++) {\r\n address currentLpToken = lpTokens[k];\r\n uint256 supplyAmount = Math.max(\r\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\r\n 1\r\n );\r\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\r\n }\r\n if (vars.supplyValue > 0) {\r\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\r\n }\r\n vars.currTs += DURATION;\r\n }\r\n }\r\n }\r\n\r\n return vars.totalReward;\r\n }\r\n\r\n /// @notice Gets all LP tokens that can receive rewards\r\n /// @return Array of LP token addresses\r\n function getAllLpRewardTokens() public view returns (address[] memory) {\r\n return IVoter(voter).getAllLpRewardTokens();\r\n }\r\n\r\n /**\r\n * @notice Sets historical prices for LP tokens at specific epochs\r\n * @param epochTimestamp The timestamp of the epoch\r\n * @param lpToken The LP token address\r\n * @param price The price to set\r\n */\r\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\r\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\r\n historicalPrices[lpToken][epochStart] = price;\r\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\r\n }\r\n\r\n /**\r\n * @notice Gets a specific checkpoint for a token\r\n * @param tokenId The ID of the veION token\r\n * @param lpToken The LP token address\r\n * @param index The index of the checkpoint to retrieve\r\n * @return The checkpoint data\r\n */\r\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\r\n return checkpoints[tokenId][lpToken][index];\r\n }\r\n\r\n /// @inheritdoc IBribeRewards\r\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\r\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\r\n if (nCheckpoints == 0) {\r\n return 0;\r\n }\r\n\r\n // First check most recent balance\r\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\r\n return (nCheckpoints - 1);\r\n }\r\n\r\n // Next check implicit zero balance\r\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\r\n return 0;\r\n }\r\n\r\n uint256 lower = 0;\r\n uint256 upper = nCheckpoints - 1;\r\n while (upper > lower) {\r\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\r\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\r\n if (cp.timestamp == timestamp) {\r\n return center;\r\n } else if (cp.timestamp < timestamp) {\r\n lower = center;\r\n } else {\r\n upper = center - 1;\r\n }\r\n }\r\n return lower;\r\n }\r\n\r\n /// @inheritdoc IBribeRewards\r\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\r\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\r\n if (nCheckpoints == 0) {\r\n return 0;\r\n }\r\n\r\n // First check most recent balance\r\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\r\n return (nCheckpoints - 1);\r\n }\r\n\r\n // Next check implicit zero balance\r\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\r\n return 0;\r\n }\r\n\r\n uint256 lower = 0;\r\n uint256 upper = nCheckpoints - 1;\r\n while (upper > lower) {\r\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\r\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\r\n if (cp.timestamp == timestamp) {\r\n return center;\r\n } else if (cp.timestamp < timestamp) {\r\n lower = center;\r\n } else {\r\n upper = center - 1;\r\n }\r\n }\r\n return lower;\r\n }\r\n}\r\n" + }, + "contracts/veION/interfaces/IBribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\ninterface IBribeRewards {\r\n /// @notice A checkpoint for marking balance\r\n struct Checkpoint {\r\n uint256 timestamp;\r\n uint256 balanceOf;\r\n }\r\n\r\n /// @notice A checkpoint for marking supply\r\n struct SupplyCheckpoint {\r\n uint256 timestamp;\r\n uint256 supply;\r\n }\r\n\r\n struct EarnedVars {\r\n uint256 totalReward;\r\n uint256 reward;\r\n uint256 supplyValue;\r\n uint256 epochBalanceValue;\r\n uint256 currTs;\r\n uint256 index;\r\n uint256 numEpochs;\r\n uint256 overallBalance;\r\n uint256 overallSupply;\r\n uint256 historicalPrice;\r\n }\r\n\r\n error InvalidReward();\r\n error Unauthorized();\r\n error InvalidGauge();\r\n error InvalidEscrowToken();\r\n error SingleTokenExpected();\r\n error InvalidVotingEscrow();\r\n error TokenNotWhitelisted();\r\n error AmountCannotBeZero();\r\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\r\n\r\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\r\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\r\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\r\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\r\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\r\n\r\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\r\n /// @dev Can only be called internally by authorized entities.\r\n /// @param lpToken Address of the liquidity pool token\r\n /// @param amount Amount to be deposited for the veNFT\r\n /// @param tokenId Unique identifier of the veNFT\r\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\r\n\r\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\r\n /// @dev Can only be called internally by authorized entities.\r\n /// @param lpToken Address of the liquidity pool token\r\n /// @param amount Amount to be withdrawn for the veNFT\r\n /// @param tokenId Unique identifier of the veNFT\r\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\r\n\r\n /// @notice Claim the rewards earned by a veNFT holder\r\n /// @param tokenId Unique identifier of the veNFT\r\n /// @param tokens Array of tokens to claim rewards for\r\n function getReward(uint256 tokenId, address[] memory tokens) external;\r\n\r\n /// @notice Notify the contract about new rewards for stakers\r\n /// @param token Address of the reward token\r\n /// @param amount Amount of the reward token to be added\r\n function notifyRewardAmount(address token, uint256 amount) external;\r\n\r\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\r\n /// @dev Timestamp must be in the past or present.\r\n /// @param tokenId The veNFT token ID to check\r\n /// @param lpToken Address of the liquidity pool token\r\n /// @param timestamp The timestamp to get the balance at\r\n /// @return The balance index at the given timestamp\r\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\r\n\r\n /// @notice Get the prior supply index at a specific timestamp\r\n /// @dev Timestamp must be in the past or present.\r\n /// @param timestamp The timestamp to get the supply index at\r\n /// @return The supply index at the given timestamp\r\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\r\n\r\n /// @notice Calculate the rewards earned for a specific token and veNFT\r\n /// @param token Address of the reward token\r\n /// @param tokenId Unique identifier of the veNFT\r\n /// @return Amount of the reward token earned\r\n function earned(address token, uint256 tokenId) external view returns (uint256);\r\n}\r\n" + }, + "contracts/veION/interfaces/IveION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport \"../stake/IStakeStrategy.sol\";\r\nimport \"./IveIONCore.sol\";\r\nimport \"./IveIONFirstExtension.sol\";\r\nimport \"./IveIONSecondExtension.sol\";\r\n\r\n/// @title IveION Interface\r\n/// @notice Interface for veION contract\r\ninterface IveION is IveIONStructsEnumsErrorsEvents, IveIONCore, IveIONFirstExtension, IveIONSecondExtension {\r\n // Constants\r\n function PRECISION() external view returns (uint256);\r\n\r\n // State Variables\r\n function s_tokenId() external view returns (uint256);\r\n function s_limitedBoost() external view returns (uint256);\r\n function s_limitedBoostActive() external view returns (bool);\r\n function s_veAERO() external view returns (address);\r\n function s_aeroVoting() external view returns (address);\r\n function s_ionicPool() external view returns (address);\r\n function s_voter() external view returns (address);\r\n function s_aeroVoterBoost() external view returns (uint256);\r\n function s_minimumLockDuration() external view returns (uint256);\r\n function s_maxEarlyWithdrawFee() external view returns (uint256);\r\n function ap() external view returns (address);\r\n function implementation() external view returns (address);\r\n\r\n // Mappings\r\n function s_minimumLockAmount(LpTokenType lpTokenType) external view returns (uint256);\r\n function s_whitelistedToken(address token) external view returns (bool);\r\n function s_lpType(address token) external view returns (LpTokenType);\r\n function s_canSplit(address user) external view returns (bool);\r\n function s_locked(uint256 tokenId, LpTokenType lpTokenType) external view returns (LockedBalance memory);\r\n function s_userPointEpoch(uint256 tokenId, LpTokenType lpTokenType) external view returns (uint256);\r\n function s_userPointHistory(\r\n uint256 tokenId,\r\n LpTokenType lpTokenType,\r\n uint256 epoch\r\n ) external view returns (UserPoint memory);\r\n function s_voted(uint256 tokenId) external view returns (bool);\r\n function s_supply(LpTokenType lpTokenType) external view returns (uint256);\r\n function s_permanentLockBalance(LpTokenType lpTokenType) external view returns (uint256);\r\n function s_stakeStrategy(LpTokenType lpTokenType) external view returns (address);\r\n function s_underlyingStake(uint256 tokenId, address token) external view returns (uint256);\r\n function s_protocolFees(LpTokenType lpTokenType) external view returns (uint256);\r\n function s_distributedFees(LpTokenType lpTokenType) external view returns (uint256);\r\n function s_delegations(\r\n uint256 delegatorTokenId,\r\n uint256 delegateeTokenId,\r\n LpTokenType lpTokenType\r\n ) external view returns (uint256);\r\n function s_userCumulativeAssetValues(address user, address token) external view returns (uint256);\r\n function s_delegatorsBlocked(uint256 tokenId, address token) external view returns (bool);\r\n\r\n // Openzeppelin functions\r\n function transferFrom(address from, address to, uint256 tokenId) external;\r\n function ownerOf(uint256 tokenId) external returns (address);\r\n function owner() external returns (address);\r\n function balanceOf(address owner) external returns (uint256);\r\n}\r\n" + }, + "contracts/veION/interfaces/IveIONCore.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport \"../stake/IStakeStrategy.sol\";\r\n\r\n/// @title IveION Interface\r\n/// @notice Interface for veION contract\r\ninterface IveIONCore {\r\n /**\r\n * @notice Creates a new lock for multiple tokens and assigns it to a specified address\r\n * @param _tokenAddress Array of token addresses to lock\r\n * @param _tokenAmount Array of token amounts to lock\r\n * @param _duration Array of lock durations\r\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\r\n * @param _to Address to assign the lock to\r\n * @return The ID of the newly created veNFT\r\n */\r\n function createLockFor(\r\n address[] memory _tokenAddress,\r\n uint256[] memory _tokenAmount,\r\n uint256[] memory _duration,\r\n bool[] memory _stakeUnderlying,\r\n address _to\r\n ) external returns (uint256);\r\n\r\n /**\r\n * @notice Creates a new lock for multiple tokens\r\n * @param _tokenAddress Array of token addresses to lock\r\n * @param _tokenAmount Array of token amounts to lock\r\n * @param _duration Array of lock durations\r\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\r\n * @return The ID of the newly created veNFT\r\n */\r\n function createLock(\r\n address[] calldata _tokenAddress,\r\n uint256[] calldata _tokenAmount,\r\n uint256[] calldata _duration,\r\n bool[] memory _stakeUnderlying\r\n ) external returns (uint256);\r\n\r\n /**\r\n * @notice Increases the amount of tokens locked for a specific veNFT\r\n * @param _tokenAddress Address of the token to increase lock amount for\r\n * @param _tokenId ID of the veNFT\r\n * @param _tokenAmount Amount of tokens to add to the lock\r\n * @param _stakeUnderlying Whether to stake the underlying tokens\r\n */\r\n function increaseAmount(\r\n address _tokenAddress,\r\n uint256 _tokenId,\r\n uint256 _tokenAmount,\r\n bool _stakeUnderlying\r\n ) external;\r\n\r\n /**\r\n * @notice Locks additional asset type for an existing veNFT\r\n * @param _tokenAddress Address of the new token to lock\r\n * @param _tokenAmount Amount of tokens to lock\r\n * @param _tokenId ID of the veNFT\r\n * @param _duration Duration of the lock\r\n * @param _stakeUnderlying Whether to stake the underlying tokens\r\n */\r\n function lockAdditionalAsset(\r\n address _tokenAddress,\r\n uint256 _tokenAmount,\r\n uint256 _tokenId,\r\n uint256 _duration,\r\n bool _stakeUnderlying\r\n ) external;\r\n\r\n /**\r\n * @notice Increases the lock duration for a specific token in a veNFT\r\n * @param _tokenAddress Address of the token\r\n * @param _tokenId ID of the veNFT\r\n * @param _lockDuration New lock duration to extend to\r\n */\r\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external;\r\n\r\n /**\r\n * @notice Delegates voting power from one veNFT to another.\r\n * @param fromTokenId The ID of the veNFT from which voting power is delegated.\r\n * @param toTokenId The ID of the veNFT to which voting power is delegated.\r\n * @param lpToken The address of the LP token associated with the delegation.\r\n * @param amount The amount of voting power to delegate.\r\n */\r\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external;\r\n\r\n /**\r\n * @notice Removes delegatees from a specific veNFT\r\n * @param fromTokenId ID of the veNFT from which delegatees are removed\r\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\r\n * @param lpToken Address of the LP token associated with the delegation\r\n * @param amounts Array of amounts of voting power to remove from each delegatee\r\n */\r\n function removeDelegatees(\r\n uint256 fromTokenId,\r\n uint256[] memory toTokenIds,\r\n address lpToken,\r\n uint256[] memory amounts\r\n ) external;\r\n\r\n /**\r\n * @notice Removes delegators from a specific veNFT\r\n * @param fromTokenIds Array of veNFT IDs that are delegators to be removed\r\n * @param toTokenId ID of the veNFT from which delegators are removed\r\n * @param lpToken Address of the LP token associated with the delegation\r\n * @param amounts Array of amounts of voting power to remove from each delegator\r\n */\r\n function removeDelegators(\r\n uint256[] memory fromTokenIds,\r\n uint256 toTokenId,\r\n address lpToken,\r\n uint256[] memory amounts\r\n ) external;\r\n\r\n /**\r\n * @notice Locks a token permanently.\r\n * @param _tokenAddress The address of the token to lock.\r\n * @param _tokenId The ID of the token to lock.\r\n */\r\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external;\r\n\r\n /**\r\n * @notice Unlocks a permanently locked token.\r\n * @param _tokenAddress The address of the token to unlock.\r\n * @param _tokenId The ID of the token to unlock.\r\n */\r\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external;\r\n\r\n /**\r\n * @notice Updates voting status for a veNFT\r\n * @param _tokenId ID of the veNFT\r\n * @param _voting Voting status\r\n */\r\n function voting(uint256 _tokenId, bool _voting) external;\r\n\r\n /**\r\n * @notice Sets the implementation addresses for the veION contract extensions.\r\n * @dev This function can only be called by authorized entities.\r\n * @param _veIONFirstExtension The address of the first extension contract.\r\n * @param _veIONSecondExtension The address of the second extension contract.\r\n */\r\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external;\r\n}\r\n\r\n/// @title IAeroVotingEscrow Interface\r\n/// @notice Interface for Aero Voting Escrow contract\r\ninterface IAeroVotingEscrow {\r\n /**\r\n * @notice Returns the balance of the specified owner.\r\n * @param _owner The address of the owner.\r\n * @return The balance of the owner.\r\n */\r\n function balanceOf(address _owner) external view returns (uint256);\r\n\r\n /**\r\n * @notice Retrieves the token ID at a specific index for a given owner.\r\n * @param _owner The address of the owner.\r\n * @param _index The index of the token ID in the owner's list.\r\n * @return The token ID at the specified index.\r\n */\r\n function ownerToNFTokenIdList(address _owner, uint256 _index) external view returns (uint256);\r\n}\r\n\r\n/// @title IAeroVoter Interface\r\n/// @notice Interface for Aero Voter contract\r\ninterface IAeroVoter {\r\n /**\r\n * @notice Returns the list of pools voted for by a specific token ID.\r\n * @param tokenId The ID of the token.\r\n * @return An array of addresses representing the pools voted for.\r\n */\r\n function poolVote(uint256 tokenId) external view returns (address[] memory);\r\n\r\n /**\r\n * @notice Retrieves the weight of a specific pool.\r\n * @param pool The address of the pool.\r\n * @return The weight of the pool.\r\n */\r\n function weights(address pool) external view returns (uint256);\r\n\r\n /**\r\n * @notice Returns the number of votes a specific token ID has for a given pool.\r\n * @param tokenId The ID of the token.\r\n * @param pool The address of the pool.\r\n * @return The number of votes for the pool.\r\n */\r\n function votes(uint256 tokenId, address pool) external view returns (uint256);\r\n}\r\n\r\ninterface IAddressesProvider {\r\n function getAddress(string calldata id) external view returns (address);\r\n}\r\n\r\ninterface IMasterPriceOracle {\r\n function price(address underlying) external view returns (uint256);\r\n}\r\n" + }, + "contracts/veION/interfaces/IveIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport \"../stake/IStakeStrategy.sol\";\r\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\r\n\r\n/// @title IveION Interface First Extensions\r\n/// @notice Interface for veION contract\r\ninterface IveIONFirstExtension is IveIONStructsEnumsErrorsEvents {\r\n /**\r\n * @notice Withdraws tokens associated with a specific token ID.\r\n * @param _tokenAddress The address of the token to withdraw.\r\n * @param _tokenId The ID of the token to withdraw.\r\n */\r\n function withdraw(address _tokenAddress, uint256 _tokenId) external;\r\n\r\n /**\r\n * @notice Merges two token IDs into one.\r\n * @param _from The ID of the token to merge from.\r\n * @param _to The ID of the token to merge into.\r\n */\r\n function merge(uint256 _from, uint256 _to) external;\r\n\r\n /**\r\n * @notice Splits a token into two separate tokens.\r\n * @param _tokenAddress The address of the token to split.\r\n * @param _from The ID of the token to split.\r\n * @param _splitAmount The amount to split from the original token.\r\n * @return _tokenId1 The ID of the first resulting token.\r\n * @return _tokenId2 The ID of the second resulting token.\r\n */\r\n function split(\r\n address _tokenAddress,\r\n uint256 _from,\r\n uint256 _splitAmount\r\n ) external returns (uint256 _tokenId1, uint256 _tokenId2);\r\n\r\n /**\r\n * @notice Claims emissions for a specific token.\r\n * @param _tokenAddress The address of the token for which to claim emissions.\r\n */\r\n function claimEmissions(address _tokenAddress) external;\r\n\r\n /**\r\n * @notice Allows or blocks delegators for a specific token ID.\r\n * @param _tokenId The ID of the token.\r\n * @param _tokenAddress The address of the token.\r\n * @param _blocked Boolean indicating if delegators are blocked.\r\n */\r\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external;\r\n\r\n /**\r\n * @notice Retrieves the balance of a specific NFT.\r\n * @param _tokenId The ID of the NFT.\r\n * @return _assets An array of asset addresses.\r\n * @return _balances An array of balances for each asset.\r\n * @return _boosts An array of boost values for each asset.\r\n */\r\n function balanceOfNFT(\r\n uint256 _tokenId\r\n ) external view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts);\r\n\r\n /**\r\n * @notice Retrieves the total ETH value of tokens owned by a specific address.\r\n * @param _owner The address of the owner.\r\n * @return totalValue The total ETH value of the tokens.\r\n */\r\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue);\r\n}\r\n" + }, + "contracts/veION/interfaces/IveIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport \"../stake/IStakeStrategy.sol\";\r\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\r\n\r\n/// @title IveION Interface Second Extension\r\n/// @notice Interface for veION contract\r\ninterface IveIONSecondExtension is IveIONStructsEnumsErrorsEvents {\r\n /**\r\n * @notice Whitelists or removes tokens from the whitelist.\r\n * @param _tokens An array of token addresses to be whitelisted or removed.\r\n * @param _isWhitelisted An array of booleans indicating the whitelist status for each token.\r\n */\r\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external;\r\n\r\n /**\r\n * @notice Withdraws protocol fees for a specific token to a recipient address.\r\n * @param _tokenAddress The address of the token for which protocol fees are to be withdrawn.\r\n * @param _recipient The address to which the protocol fees will be sent.\r\n */\r\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external;\r\n\r\n /**\r\n * @notice Withdraws distributed fees for a specific token to a recipient address.\r\n * @param _tokenAddress The address of the token for which distributed fees are to be withdrawn.\r\n * @param _recipient The address to which the distributed fees will be sent.\r\n */\r\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external;\r\n\r\n /**\r\n * @notice Toggles the ability to split tokens for a specific account.\r\n * @param _account The address of the account.\r\n * @param _isAllowed Boolean indicating if splitting is allowed.\r\n */\r\n function toggleSplit(address _account, bool _isAllowed) external;\r\n\r\n /**\r\n * @notice Toggles the limited boost feature.\r\n * @param _isBoosted Boolean indicating if the boost is active.\r\n */\r\n function toggleLimitedBoost(bool _isBoosted) external;\r\n\r\n /**\r\n * @notice Sets the amount for a limited time boost.\r\n * @param _boostAmount The amount of the boost.\r\n */\r\n function setLimitedTimeBoost(uint256 _boostAmount) external;\r\n\r\n /**\r\n * @notice Sets the address of the voter.\r\n * @param _voter The address of the voter.\r\n */\r\n function setVoter(address _voter) external;\r\n\r\n /**\r\n * @notice Sets the minimum lock amount for a specific token.\r\n * @param _tokenAddress The address of the token.\r\n * @param _minimumAmount The minimum amount to lock.\r\n */\r\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external;\r\n\r\n /**\r\n * @notice Sets the minimum lock duration.\r\n * @param _minimumLockDuration The minimum duration for locking.\r\n */\r\n function setMinimumLockDuration(uint256 _minimumLockDuration) external;\r\n\r\n /**\r\n * @notice Sets the address of the Ionic Pool.\r\n * @param _ionicPool The address of the Ionic Pool.\r\n */\r\n function setIonicPool(address _ionicPool) external;\r\n\r\n /**\r\n * @notice Sets the address of the Aero Voting contract.\r\n * @param _aeroVoting The address of the Aero Voting contract.\r\n */\r\n function setAeroVoting(address _aeroVoting) external;\r\n\r\n /**\r\n * @notice Sets the boost amount for Aero Voter.\r\n * @param _aeroVoterBoost The boost amount for Aero Voter.\r\n */\r\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external;\r\n\r\n /**\r\n * @notice Sets the maximum early withdrawal fee.\r\n * @param _maxEarlyWithdrawFee The maximum fee for early withdrawal.\r\n */\r\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external;\r\n\r\n /**\r\n * @notice Sets the LP token type for a specific token.\r\n * @param _token The address of the token.\r\n * @param _type The LP token type.\r\n */\r\n function setLpTokenType(address _token, LpTokenType _type) external;\r\n\r\n /**\r\n * @notice Sets the stake strategy for a specific LP token type.\r\n * @param _lpType The LP token type.\r\n * @param _strategy The stake strategy.\r\n */\r\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external;\r\n\r\n /**\r\n * @notice Sets the address of the veAERO contract.\r\n * @param _veAERO The address of the veAERO contract.\r\n */\r\n function setVeAERO(address _veAERO) external;\r\n\r\n /**\r\n * @notice Retrieves the lock information for a specific user.\r\n * @param _tokenId The ID of the token.\r\n * @param _lpType The LP token type.\r\n * @return A LockedBalance struct containing lock details.\r\n */\r\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory);\r\n\r\n /**\r\n * @notice Retrieves the token IDs owned by a specific address.\r\n * @param _owner The address of the owner.\r\n * @return An array of token IDs owned by the address.\r\n */\r\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory);\r\n\r\n /**\r\n * @notice Retrieves the assets locked for a specific token ID.\r\n * @param _tokenId The ID of the token.\r\n * @return An array of addresses representing the locked assets.\r\n */\r\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory);\r\n\r\n /**\r\n * @notice Retrieves the delegatees for a specific token ID and LP token type.\r\n * @param _tokenId The ID of the token.\r\n * @param _lpType The LP token type.\r\n * @return An array of delegatee IDs.\r\n */\r\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\r\n\r\n /**\r\n * @notice Retrieves the delegators for a specific token ID and LP token type.\r\n * @param _tokenId The ID of the token.\r\n * @param _lpType The LP token type.\r\n * @return An array of delegator IDs.\r\n */\r\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\r\n\r\n /**\r\n * @notice Retrieves the user point for a specific token ID, LP token type, and epoch.\r\n * @param _tokenId The ID of the token.\r\n * @param _lpType The LP token type.\r\n * @param _epoch The epoch number.\r\n * @return A UserPoint struct containing user point details.\r\n */\r\n function getUserPoint(uint256 _tokenId, LpTokenType _lpType, uint256 _epoch) external view returns (UserPoint memory);\r\n}\r\n" + }, + "contracts/veION/interfaces/IveIONStructsEnumsErrorsEvents.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\ninterface IveIONStructsEnumsErrorsEvents {\r\n /**\r\n * @notice Structure representing a locked balance\r\n * @param tokenAddress Address of the token\r\n * @param amount Amount of tokens locked\r\n * @param delegateAmount Amount of tokens delegated\r\n * @param start Start time of the lock\r\n * @param end End time of the lock\r\n * @param isPermanent Indicates if the lock is permanent\r\n * @param boost Boost value for the lock\r\n */\r\n struct LockedBalance {\r\n address tokenAddress;\r\n uint256 amount;\r\n uint256 delegateAmount;\r\n uint256 start;\r\n uint256 end;\r\n bool isPermanent;\r\n uint256 boost;\r\n }\r\n\r\n /**\r\n * @notice Structure representing a delegation\r\n * @param amount Amount of tokens delegated\r\n * @param delegatee ID of the delegatee\r\n */\r\n struct Delegation {\r\n uint256 amount;\r\n uint256 delegatee;\r\n }\r\n\r\n /**\r\n * @notice Structure representing a user point\r\n * @param bias Bias value\r\n * @param slope Slope value, representing -dweight / dt\r\n * @param ts Timestamp of the point\r\n * @param blk Block number of the point\r\n * @param permanent Permanent value\r\n * @param permanentDelegate Permanent delegate value\r\n */\r\n struct UserPoint {\r\n uint256 bias;\r\n uint256 slope;\r\n uint256 ts;\r\n uint256 blk;\r\n uint256 permanent;\r\n uint256 permanentDelegate;\r\n }\r\n\r\n /**\r\n * @notice Structure representing a global point\r\n * @param bias Bias value\r\n * @param slope Slope value, representing -dweight / dt\r\n * @param ts Timestamp of the point\r\n * @param blk Block number of the point\r\n * @param permanentLockBalance Permanent lock balance\r\n */\r\n struct GlobalPoint {\r\n int128 bias;\r\n int128 slope;\r\n uint256 ts;\r\n uint256 blk;\r\n uint256 permanentLockBalance;\r\n }\r\n\r\n /**\r\n * @notice Structure representing a checkpoint\r\n * @param fromTimestamp Timestamp from which the checkpoint is valid\r\n * @param owner Address of the owner\r\n * @param delegatedBalance Balance that has been delegated\r\n * @param delegatee ID of the delegatee\r\n */\r\n struct Checkpoint {\r\n uint256 fromTimestamp;\r\n address owner;\r\n uint256 delegatedBalance;\r\n uint256 delegatee;\r\n }\r\n\r\n /**\r\n * @notice Enum representing deposit types\r\n */\r\n enum DepositType {\r\n DEPOSIT_FOR_TYPE,\r\n CREATE_LOCK_TYPE,\r\n INCREASE_LOCK_AMOUNT,\r\n INCREASE_UNLOCK_TIME,\r\n LOCK_ADDITIONAL\r\n }\r\n\r\n /**\r\n * @notice Enum representing LP token types\r\n */\r\n enum LpTokenType {\r\n Mode_Velodrome_5050_ION_MODE,\r\n Mode_Balancer_8020_ION_ETH,\r\n Base_Aerodrome_5050_ION_wstETH,\r\n Base_Balancer_8020_ION_ETH,\r\n Optimism_Velodrome_5050_ION_OP,\r\n Optimism_Balancer_8020_ION_ETH\r\n }\r\n\r\n error LockDurationNotInFuture();\r\n error ZeroAmount();\r\n error LockDurationTooLong();\r\n error TokenNotWhitelisted();\r\n error NotOwner();\r\n error AlreadyVoted();\r\n error PermanentLock();\r\n error NoLockFound();\r\n error LockExpired();\r\n error SameNFT();\r\n error SplitNotAllowed();\r\n error AmountTooBig();\r\n error NotPermanentLock();\r\n error TokenHasDelegatees();\r\n error TokenHasDelegators();\r\n error NotVoter();\r\n error MinimumNotMet();\r\n error ArrayMismatch();\r\n error LockDurationTooShort();\r\n error DuplicateAsset();\r\n error SplitTooSmall();\r\n error NotEnoughRemainingAfterSplit();\r\n error NoDelegationBetweenTokens(uint256 _tokenId1, uint256 _tokenId2);\r\n error NoUnderlyingStake();\r\n error NotAcceptingDelegators();\r\n error BoostAmountMustBeGreaterThanZero();\r\n error InvalidAddress();\r\n error MinimumAmountMustBeGreaterThanZero();\r\n error MinimumLockDurationMustBeGreaterThanZero();\r\n error AeroBoostAmountMustBeGreaterThanZero();\r\n error MaxEarlyWithdrawFeeMustBeGreaterThanZero();\r\n error InvalidTokenAddress();\r\n error InvalidStrategyAddress();\r\n error InvalidVeAEROAddress();\r\n\r\n event Deposit(\r\n address indexed provider,\r\n uint256 indexed tokenId,\r\n DepositType indexed depositType,\r\n uint256 value,\r\n uint256 locktime,\r\n uint256 ts\r\n );\r\n event Withdraw(address indexed provider, uint256 indexed tokenId, uint256 value, uint256 ts);\r\n event Supply(uint256 prevSupply, uint256 supply);\r\n event Delegated(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\r\n event DelegationRemoved(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\r\n event ProtocolFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\r\n event DistributedFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\r\n event SplitToggle(address indexed account, bool isAllowed);\r\n event LimitedBoostToggled(bool isBoosted);\r\n event LimitedTimeBoostSet(uint256 boostAmount);\r\n event VoterSet(address indexed newVoter);\r\n event AeroVotingSet(address indexed newAeroVoting);\r\n event AeroVoterBoostSet(uint256 newAeroVoterBoost);\r\n event TokensWhitelisted(address[] token, bool[] isWhitelisted);\r\n event LpTokenTypeSet(address indexed token, LpTokenType lpTokenType);\r\n event VeAEROSet(address indexed veAERO);\r\n event StakeStrategySet(LpTokenType indexed lpTokenType, address indexed strategy);\r\n event MinimumLockAmountSet(address indexed tokenAddress, uint256 minimumAmount);\r\n event MinimumLockDurationSet(uint256 minimumDuration);\r\n event IonicPoolSet(address indexed newIonicPool);\r\n event SplitCompleted(\r\n uint256 indexed fromTokenId,\r\n uint256 indexed tokenId1,\r\n uint256 indexed tokenId2,\r\n uint256 splitAmount,\r\n address tokenAddress\r\n );\r\n event MergeCompleted(\r\n uint256 indexed fromTokenId,\r\n uint256 indexed toTokenId,\r\n address[] assetsLocked,\r\n uint256 lengthOfAssets\r\n );\r\n event EmissionsClaimed(address indexed claimant, address indexed tokenAddress);\r\n event MaxEarlyWithdrawFeeSet(uint256 maxEarlyWithdrawFee);\r\n event PermanentLockCreated(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\r\n event PermanentLockRemoved(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\r\n event Voted(uint256 _tokenId, bool _voting);\r\n event DelegatorsBlocked(uint256 indexed _tokenId, address indexed _lpToken, bool _blocked);\r\n event Initialized(address indexed addressesProvider);\r\n event ExtensionsSet(address indexed _firstExtension, address indexed _secondExtension);\r\n}\r\n" + }, + "contracts/veION/interfaces/IVoter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\n/**\r\n * @title IVoter\r\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\r\n */\r\ninterface IVoter {\r\n /// @notice Error thrown when a user has already voted or deposited.\r\n error AlreadyVotedOrDeposited();\r\n\r\n /// @notice Error thrown when an action is attempted outside the distribution window.\r\n error DistributeWindow();\r\n\r\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\r\n error RewardAccumulatorDoesNotExist(address _pool);\r\n\r\n /// @notice Error thrown when a reward accumulator is not alive.\r\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\r\n\r\n /// @notice Error thrown when a market already exists.\r\n error MarketAlreadyExists();\r\n\r\n /// @notice Error thrown when the maximum voting number is too low.\r\n error MaximumVotingNumberTooLow();\r\n\r\n /// @notice Error thrown when array lengths do not match.\r\n error MismatchedArrayLengths();\r\n\r\n /// @notice Error thrown when there are non-zero votes.\r\n error NonZeroVotes();\r\n\r\n /// @notice Error thrown when the caller is not the owner.\r\n error NotOwner();\r\n\r\n /// @notice Error thrown when an action is attempted outside the distribution window.\r\n error NotDistributeWindow();\r\n\r\n /// @notice Error thrown when the caller is not the governor.\r\n error NotGovernor();\r\n\r\n /// @notice Error thrown when an NFT is not whitelisted.\r\n error NotWhitelistedNFT();\r\n\r\n /// @notice Error thrown when the same value is provided.\r\n error SameValue();\r\n\r\n /// @notice Error thrown when there are too many pools.\r\n error TooManyPools();\r\n\r\n /// @notice Error thrown when array lengths are unequal.\r\n error UnequalLengths();\r\n\r\n /// @notice Error thrown when an address is zero.\r\n error ZeroAddress();\r\n\r\n /// @notice Error thrown when the tokens array is empty.\r\n error TokensArrayEmpty();\r\n\r\n /// @notice Error thrown when the weight is zero.\r\n error ZeroWeight();\r\n\r\n /**\r\n * @notice Struct to store vote details.\r\n * @param marketVotes Array of market addresses voted for.\r\n * @param marketVoteSides Array of market sides voted for.\r\n * @param votes Array of vote weights.\r\n * @param usedWeight Total weight used in voting.\r\n */\r\n struct VoteDetails {\r\n address[] marketVotes;\r\n MarketSide[] marketVoteSides;\r\n uint256[] votes;\r\n uint256 usedWeight;\r\n }\r\n\r\n /**\r\n * @notice Struct to store market information.\r\n * @param marketAddress Address of the market.\r\n * @param side Side of the market (Supply or Borrow).\r\n */\r\n struct Market {\r\n address marketAddress;\r\n MarketSide side;\r\n }\r\n\r\n /**\r\n * @notice Struct to store variables used in voting.\r\n * @param totalWeight Total weight available for voting.\r\n * @param usedWeight Weight used in voting.\r\n * @param market Address of the market.\r\n * @param marketSide Side of the market.\r\n * @param rewardAccumulator Address of the reward accumulator.\r\n * @param marketWeight Weight of the market.\r\n * @param bribes Address of the bribes.\r\n */\r\n struct VoteVars {\r\n uint256 totalWeight;\r\n uint256 usedWeight;\r\n address market;\r\n MarketSide marketSide;\r\n address rewardAccumulator;\r\n uint256 marketWeight;\r\n address bribes;\r\n }\r\n\r\n /**\r\n * @notice Struct to store local variables used in voting.\r\n * @param sender Address of the sender.\r\n * @param timestamp Timestamp of the vote.\r\n * @param votingLPs Array of voting LP addresses.\r\n * @param votingLPBalances Array of voting LP balances.\r\n * @param boosts Array of boosts.\r\n */\r\n struct VoteLocalVars {\r\n address sender;\r\n uint256 timestamp;\r\n address[] votingLPs;\r\n uint256[] votingLPBalances;\r\n uint256[] boosts;\r\n }\r\n\r\n /**\r\n * @notice Enum to represent the side of a market.\r\n */\r\n enum MarketSide {\r\n Supply,\r\n Borrow\r\n }\r\n\r\n /**\r\n * @notice Event emitted when a vote is cast.\r\n * @param voter Address of the voter.\r\n * @param pool Address of the pool.\r\n * @param tokenId ID of the token.\r\n * @param weight Weight of the vote.\r\n * @param totalWeight Total weight of the vote.\r\n * @param timestamp Timestamp of the vote.\r\n */\r\n event Voted(\r\n address indexed voter,\r\n address indexed pool,\r\n uint256 indexed tokenId,\r\n uint256 weight,\r\n uint256 totalWeight,\r\n uint256 timestamp\r\n );\r\n\r\n /**\r\n * @notice Event emitted when a vote is abstained.\r\n * @param voter Address of the voter.\r\n * @param pool Address of the pool.\r\n * @param tokenId ID of the token.\r\n * @param weight Weight of the vote.\r\n * @param totalWeight Total weight of the vote.\r\n * @param timestamp Timestamp of the vote.\r\n */\r\n event Abstained(\r\n address indexed voter,\r\n address indexed pool,\r\n uint256 indexed tokenId,\r\n uint256 weight,\r\n uint256 totalWeight,\r\n uint256 timestamp\r\n );\r\n\r\n /**\r\n * @notice Event emitted when a reward is notified.\r\n * @param sender Address of the sender.\r\n * @param reward Address of the reward.\r\n * @param amount Amount of the reward.\r\n */\r\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\r\n\r\n /**\r\n * @notice Event emitted when a token is whitelisted.\r\n * @param whitelister Address of the whitelister.\r\n * @param token Address of the token.\r\n * @param _bool Boolean indicating whitelist status.\r\n */\r\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\r\n\r\n /**\r\n * @notice Event emitted when an NFT is whitelisted.\r\n * @param whitelister Address of the whitelister.\r\n * @param tokenId ID of the token.\r\n * @param _bool Boolean indicating whitelist status.\r\n */\r\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\r\n\r\n event LpTokensSet(address[] indexed lpTokens);\r\n event MpoSet(address indexed mpo);\r\n event GovernorSet(address indexed governor);\r\n event MarketsAdded(Market[] markets);\r\n event MarketRewardAccumulatorsSet(\r\n address[] indexed markets,\r\n MarketSide[] indexed marketSides,\r\n address[] indexed rewardAccumulators\r\n );\r\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\r\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\r\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\r\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\r\n\r\n /**\r\n * @notice Get the weight of a market.\r\n * @param market Address of the market.\r\n * @param marketSide Side of the market.\r\n * @param lpToken Address of the LP token.\r\n * @return The weight of the market.\r\n */\r\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\r\n\r\n /**\r\n * @notice Get the votes for a token.\r\n * @param tokenId ID of the token.\r\n * @param market Address of the market.\r\n * @param marketSide Side of the market.\r\n * @param lpToken Address of the LP token.\r\n * @return The votes for the token.\r\n */\r\n function votes(\r\n uint256 tokenId,\r\n address market,\r\n MarketSide marketSide,\r\n address lpToken\r\n ) external view returns (uint256);\r\n\r\n /**\r\n * @notice Get the used weights for a token.\r\n * @param tokenId ID of the token.\r\n * @param lpToken Address of the LP token.\r\n * @return The used weights for the token.\r\n */\r\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\r\n\r\n /**\r\n * @notice Get the last voted timestamp for a token.\r\n * @param tokenId ID of the token.\r\n * @return The last voted timestamp for the token.\r\n */\r\n function lastVoted(uint256 tokenId) external view returns (uint256);\r\n\r\n /**\r\n * @notice Check if a token is whitelisted.\r\n * @param token Address of the token.\r\n * @return True if the token is whitelisted, false otherwise.\r\n */\r\n function isWhitelistedToken(address token) external view returns (bool);\r\n\r\n /**\r\n * @notice Check if an NFT is whitelisted.\r\n * @param tokenId ID of the token.\r\n * @return True if the NFT is whitelisted, false otherwise.\r\n */\r\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\r\n\r\n /**\r\n * @notice Get the address of the ve contract.\r\n * @return The address of the ve contract.\r\n */\r\n function ve() external view returns (address);\r\n\r\n /**\r\n * @notice Get the address of the governor.\r\n * @return The address of the governor.\r\n */\r\n function governor() external view returns (address);\r\n\r\n /**\r\n * @notice Update voting balances in voting rewards contracts.\r\n * @param _tokenId ID of veNFT whose balance you wish to update.\r\n */\r\n function poke(uint256 _tokenId) external;\r\n\r\n /**\r\n * @notice Vote for pools. Votes distributed proportionally based on weights.\r\n * @dev Can only vote or deposit into a managed NFT once per epoch.\r\n * Can only vote for gauges that have not been killed.\r\n * Throws if length of _poolVote and _weights do not match.\r\n * @param _tokenId ID of veNFT you are voting with.\r\n * @param _poolVote Array of pools you are voting for.\r\n * @param _marketVoteSide Array of market vote sides you are voting for.\r\n * @param _weights Weights of pools.\r\n */\r\n function vote(\r\n uint256 _tokenId,\r\n address[] calldata _poolVote,\r\n MarketSide[] calldata _marketVoteSide,\r\n uint256[] calldata _weights\r\n ) external;\r\n\r\n /**\r\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\r\n * @dev Cannot reset in the same epoch that you voted in.\r\n * Can vote or deposit into a managed NFT again after reset.\r\n * @param _tokenId ID of veNFT that you are resetting.\r\n */\r\n function reset(uint256 _tokenId) external;\r\n\r\n /**\r\n * @notice Distributes rewards to eligible markets.\r\n */\r\n function distributeRewards() external;\r\n\r\n /**\r\n * @notice Claim bribes for a given NFT.\r\n * @dev Utility to help batch bribe claims.\r\n * @param _bribes Array of BribeVotingReward contracts to collect from.\r\n * @param _tokens Array of tokens that are used as bribes.\r\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\r\n */\r\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\r\n\r\n /**\r\n * @notice Whitelist (or unwhitelist) token for use in bribes.\r\n * @dev Throws if not called by governor.\r\n * @param _token Address of the token.\r\n * @param _bool Boolean indicating whitelist status.\r\n */\r\n function whitelistToken(address _token, bool _bool) external;\r\n\r\n /**\r\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\r\n * @dev Throws if not called by governor.\r\n * Throws if already whitelisted.\r\n * @param _tokenId ID of the token.\r\n * @param _bool Boolean indicating whitelist status.\r\n */\r\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\r\n\r\n /**\r\n * @notice Set the LP tokens.\r\n * @param _lpTokens Array of LP token addresses.\r\n */\r\n function setLpTokens(address[] memory _lpTokens) external;\r\n\r\n /**\r\n * @notice Set the Master Price Oracle (MPO) address.\r\n * @param _mpo Address of the Master Price Oracle.\r\n */\r\n function setMpo(address _mpo) external;\r\n\r\n /**\r\n * @notice Set a new governor.\r\n * @param _governor Address of the new governor.\r\n */\r\n function setGovernor(address _governor) external;\r\n\r\n /**\r\n * @notice Add new markets.\r\n * @param _markets Array of Market structs to be added.\r\n */\r\n function addMarkets(Market[] calldata _markets) external;\r\n\r\n /**\r\n * @notice Set reward accumulators for markets.\r\n * @param _markets Array of market addresses.\r\n * @param _marketSides Array of market sides.\r\n * @param _rewardAccumulators Array of reward accumulator addresses.\r\n */\r\n function setMarketRewardAccumulators(\r\n address[] calldata _markets,\r\n MarketSide[] calldata _marketSides,\r\n address[] calldata _rewardAccumulators\r\n ) external;\r\n\r\n /**\r\n * @notice Set bribes for reward accumulators.\r\n * @param _rewardAccumulators Array of reward accumulator addresses.\r\n * @param _bribes Array of bribe addresses.\r\n */\r\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\r\n\r\n /**\r\n * @notice Set the maximum number of votes.\r\n * @param _maxVotingNum Maximum number of votes allowed.\r\n */\r\n function setMaxVotingNum(uint256 _maxVotingNum) external;\r\n\r\n /**\r\n * @notice Toggle the alive status of a reward accumulator.\r\n * @param _market Address of the market.\r\n * @param _marketSide Side of the market.\r\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\r\n */\r\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\r\n\r\n /**\r\n * @notice Get the start of the epoch for a given timestamp.\r\n * @param _timestamp The timestamp to calculate the epoch start for.\r\n * @return The start of the epoch.\r\n */\r\n function epochStart(uint256 _timestamp) external pure returns (uint256);\r\n\r\n /**\r\n * @notice Get the next epoch for a given timestamp.\r\n * @param _timestamp The timestamp to calculate the next epoch for.\r\n * @return The next epoch.\r\n */\r\n function epochNext(uint256 _timestamp) external pure returns (uint256);\r\n\r\n /**\r\n * @notice Get the start of the voting period for a given timestamp.\r\n * @param _timestamp The timestamp to calculate the voting start for.\r\n * @return The start of the voting period.\r\n */\r\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\r\n\r\n /**\r\n * @notice Get the end of the voting period for a given timestamp.\r\n * @param _timestamp The timestamp to calculate the voting end for.\r\n * @return The end of the voting period.\r\n */\r\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\r\n\r\n /**\r\n * @notice Get the number of markets.\r\n * @return The number of markets.\r\n */\r\n function marketsLength() external view returns (uint256);\r\n\r\n /**\r\n * @notice Get all LP reward tokens.\r\n * @return An array of addresses representing all LP reward tokens.\r\n */\r\n function getAllLpRewardTokens() external view returns (address[] memory);\r\n\r\n /**\r\n * @notice Get vote details for a specific token ID and LP asset.\r\n * @param _tokenId The ID of the token.\r\n * @param _lpAsset The address of the LP asset.\r\n * @return A struct containing vote details.\r\n */\r\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\r\n}\r\n" + }, + "contracts/veION/libraries/BalanceLogicLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport \"../interfaces/IveIONStructsEnumsErrorsEvents.sol\";\r\n\r\nlibrary BalanceLogicLibrary {\r\n uint256 internal constant _WEEK = 1 weeks;\r\n\r\n /// @notice Calculates the voting power for a given NFT at a specific time.\r\n /// @dev This function is compatible with the ERC20 `balanceOf` interface for Aragon.\r\n /// It retrieves the last user point before a specified timestamp and computes the voting power at that time.\r\n /// @param s_userPointEpoch Mapping of user point epochs for all tokens.\r\n /// @param s_userPointHistory Mapping of user point history for all tokens.\r\n /// @param _lpType The type of LP token associated with the NFT.\r\n /// @param _tokenId The ID of the NFT for which to calculate voting power.\r\n /// @param _t The epoch time at which to calculate the voting power.\r\n /// @param _isPermanent A boolean indicating if the lock is permanent.\r\n /// @return The calculated voting power of the user at the specified time.\r\n function balanceOfNFTAt(\r\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\r\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\r\n storage s_userPointHistory,\r\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\r\n uint256 _tokenId,\r\n uint256 _t,\r\n bool _isPermanent\r\n ) internal view returns (uint256) {\r\n uint256 _epoch = getPastUserPointIndex(s_userPointEpoch, s_userPointHistory, _lpType, _tokenId, _t);\r\n // epoch 0 is an empty point\r\n if (_epoch == 0) return 0;\r\n IveIONStructsEnumsErrorsEvents.UserPoint memory lastPoint = s_userPointHistory[_tokenId][_lpType][_epoch];\r\n if (_isPermanent) {\r\n return lastPoint.permanent + lastPoint.permanentDelegate;\r\n } else {\r\n uint256 reduction = lastPoint.slope * (_t - lastPoint.ts);\r\n if (reduction > lastPoint.bias) {\r\n lastPoint.bias = 0;\r\n } else {\r\n lastPoint.bias -= reduction;\r\n }\r\n return lastPoint.bias;\r\n }\r\n }\r\n\r\n /// @notice Binary search to get the user point index for a token id at or prior to a given timestamp\r\n /// @dev If a user point does not exist prior to the timestamp, this will return 0.\r\n /// @param s_userPointEpoch State of all user point epochs\r\n /// @param s_userPointHistory State of all user point history\r\n /// @param _tokenId .\r\n /// @param _timestamp .\r\n /// @return User point index\r\n function getPastUserPointIndex(\r\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\r\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\r\n storage s_userPointHistory,\r\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\r\n uint256 _tokenId,\r\n uint256 _timestamp\r\n ) internal view returns (uint256) {\r\n uint256 _userEpoch = s_userPointEpoch[_tokenId][_lpType];\r\n if (_userEpoch == 0) return 0;\r\n // First check most recent balance\r\n if (s_userPointHistory[_tokenId][_lpType][_userEpoch].ts <= _timestamp) return (_userEpoch);\r\n // Next check implicit zero balance\r\n if (s_userPointHistory[_tokenId][_lpType][1].ts > _timestamp) return 0;\r\n uint256 lower = 0;\r\n uint256 upper = _userEpoch;\r\n while (upper > lower) {\r\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\r\n IveIONStructsEnumsErrorsEvents.UserPoint storage userPoint = s_userPointHistory[_tokenId][_lpType][center];\r\n if (userPoint.ts == _timestamp) {\r\n return center;\r\n } else if (userPoint.ts < _timestamp) {\r\n lower = center;\r\n } else {\r\n upper = center - 1;\r\n }\r\n }\r\n return lower;\r\n }\r\n}\r\n" + }, + "contracts/veION/libraries/IonicTimeLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nlibrary IonicTimeLibrary {\r\n uint256 internal constant _WEEK = 7 days;\r\n\r\n /// @dev Returns start of epoch based on current timestamp\r\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\r\n unchecked {\r\n return timestamp - (timestamp % _WEEK);\r\n }\r\n }\r\n\r\n /// @dev Returns start of next epoch / end of current epoch\r\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\r\n unchecked {\r\n return timestamp - (timestamp % _WEEK) + _WEEK;\r\n }\r\n }\r\n\r\n /// @dev Returns start of voting window\r\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\r\n unchecked {\r\n return timestamp - (timestamp % _WEEK) + 1 hours;\r\n }\r\n }\r\n\r\n /// @dev Returns end of voting window / beginning of unrestricted voting window\r\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\r\n unchecked {\r\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\r\n }\r\n }\r\n}\r\n" + }, + "contracts/veION/RewardAccumulator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ncontract RewardAccumulator is Ownable2StepUpgradeable {\r\n using SafeERC20 for IERC20;\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n function initialize() external initializer {\r\n __Ownable2Step_init();\r\n }\r\n\r\n function approve(address _token, address _spender) external onlyOwner {\r\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\r\n }\r\n}\r\n" + }, + "contracts/veION/stake/IStakeStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\n/**\r\n * @title IStakeStrategy\r\n * @notice Interface for the VeloIonModeStakingModeReward contract.\r\n */\r\ninterface IStakeStrategy {\r\n /// @notice Emitted when the contract is initialized\r\n event Initialized(\r\n address indexed escrow,\r\n address indexed stakingToken,\r\n address indexed stakingContract,\r\n address stakingWalletImplementation\r\n );\r\n\r\n /// @notice Emitted when tokens are staked\r\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\r\n\r\n /// @notice Emitted when rewards are claimed\r\n event Claimed(address indexed from, address indexed veloWallet);\r\n\r\n /// @notice Emitted when tokens are withdrawn\r\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\r\n\r\n /// @notice Emitted when staking wallet is transferred\r\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\r\n\r\n /// @notice Emitted when escrow is set\r\n event EscrowSet(address indexed newEscrow);\r\n\r\n /// @notice Emitted when staking token is set\r\n event StakingTokenSet(address indexed newStakingToken);\r\n\r\n /// @notice Emitted when staking contract is set\r\n event StakingContractSet(address indexed newStakingContract);\r\n\r\n /// @notice Emitted when upgradeable beacon is set\r\n event UpgradeableBeaconSet(address indexed newBeacon);\r\n\r\n /**\r\n * @notice Stakes a specified amount of tokens from a given address.\r\n * @param _from The address from which tokens will be staked.\r\n * @param _amount The amount of tokens to stake.\r\n * @param _data Additional data that might be needed for staking.\r\n */\r\n function stake(address _from, uint256 _amount, bytes memory _data) external;\r\n\r\n /**\r\n * @notice Claims rewards for a given address.\r\n * @param _from The address for which to claim rewards.\r\n */\r\n function claim(address _from) external;\r\n\r\n /**\r\n * @notice Withdraws a specified amount of tokens for a given address.\r\n * @param _owner The address from which tokens will be withdrawn.\r\n * @param _amount The amount of tokens to withdraw.\r\n */\r\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\r\n\r\n /**\r\n * @notice Returns the current reward rate for the staking strategy.\r\n * @return The reward rate as a uint256.\r\n */\r\n function rewardRate() external view returns (uint256);\r\n\r\n /**\r\n * @notice Returns the period finish time for the staking strategy.\r\n * @return The period finish time as a uint256.\r\n */\r\n function periodFinish() external view returns (uint256);\r\n\r\n /**\r\n * @notice Returns the balance of a specific address.\r\n * @param account The address to query the balance of.\r\n * @return The balance as a uint256.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @notice Returns the total supply of staked tokens.\r\n * @return The total supply as a uint256.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @notice Returns the address of the reward token for the staking strategy.\r\n * @return The address of the reward token.\r\n */\r\n function rewardToken() external view returns (address);\r\n\r\n /**\r\n * @notice Returns the address of the staking contract.\r\n * @return The address of the staking contract.\r\n */\r\n function stakingContract() external view returns (address);\r\n\r\n /**\r\n * @notice Returns the address of the staking token.\r\n * @return The address of the staking token.\r\n */\r\n function stakingToken() external view returns (address);\r\n\r\n /**\r\n * @notice Returns the staking wallet address for a specific user.\r\n * @param user The address of the user.\r\n * @return The address of the user's staking wallet.\r\n */\r\n function userStakingWallet(address user) external view returns (address);\r\n\r\n /**\r\n * @notice Transfers the staking wallet from one user to another.\r\n * @param from The current owner of the staking wallet.\r\n * @param to The new owner of the staking wallet.\r\n */\r\n function transferStakingWallet(address from, address to, uint256 _amount) external;\r\n\r\n /**\r\n * @notice Sets the escrow address.\r\n * @param _escrow The address of the new escrow.\r\n */\r\n function setEscrow(address _escrow) external;\r\n\r\n /**\r\n * @notice Sets the staking token address.\r\n * @param _stakingToken The address of the new staking token.\r\n */\r\n function setStakingToken(address _stakingToken) external;\r\n\r\n /**\r\n * @notice Sets the staking contract address.\r\n * @param _stakingContract The address of the new staking contract.\r\n */\r\n function setStakingContract(address _stakingContract) external;\r\n\r\n /**\r\n * @notice Sets the address of the beacon.\r\n * @param _beacon The address of the new beacon contract.\r\n */\r\n function setUpgradeableBeacon(address _beacon) external;\r\n}\r\n" + }, + "contracts/veION/stake/IStakeWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\ninterface IStakeWallet {\r\n /// @notice Emitted when tokens are staked\r\n event Staked(uint256 amount);\r\n\r\n /// @notice Emitted when rewards are claimed\r\n event Claimed(address indexed from, uint256 rewardAmount);\r\n\r\n /// @notice Emitted when tokens are withdrawn\r\n event Withdrawn(address indexed withdrawTo, uint256 amount);\r\n\r\n /**\r\n * @notice Stakes a specified amount of tokens according to the strategy.\r\n * @param amount The amount of tokens to stake.\r\n * @param data Additional data required for the staking strategy.\r\n */\r\n function stake(address from, uint256 amount, bytes memory data) external;\r\n\r\n /**\r\n * @notice Claims rewards for the caller.\r\n */\r\n function claim(address from) external;\r\n\r\n /**\r\n * @notice Withdraws a specified amount of staked tokens.\r\n * @param withdrawTo The address to withdraw tokens to.\r\n * @param amount The amount of tokens to withdraw.\r\n */\r\n function withdraw(address withdrawTo, uint256 amount) external;\r\n}\r\n" + }, + "contracts/veION/stake/velo/IVeloIonModeStaking.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\ninterface IVeloIonModeStaking {\r\n event Deposit(address indexed from, address indexed to, uint256 amount);\r\n event Withdraw(address indexed from, uint256 amount);\r\n event NotifyReward(address indexed from, uint256 amount);\r\n event ClaimFees(uint256 claimed0, uint256 claimed1);\r\n event ClaimRewards(address indexed from, uint256 amount);\r\n\r\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\r\n function stakingToken() external view returns (address);\r\n\r\n /// @notice Address of the token (VELO v2) rewarded to stakers\r\n function rewardToken() external view returns (address);\r\n\r\n /// @notice Address of the Converter contract linked to the gauge\r\n function feeConverter() external view returns (address);\r\n\r\n /// @notice Address of the staking rewards factory that created this gauge\r\n function factory() external view returns (address);\r\n\r\n /// @notice Timestamp end of current rewards period\r\n function periodFinish() external view returns (uint256);\r\n\r\n /// @notice Current reward rate of rewardToken to distribute per second\r\n function rewardRate() external view returns (uint256);\r\n\r\n /// @notice Most recent timestamp contract has updated state\r\n function lastUpdateTime() external view returns (uint256);\r\n\r\n /// @notice Most recent stored value of rewardPerToken\r\n function rewardPerTokenStored() external view returns (uint256);\r\n\r\n /// @notice Amount of stakingToken deposited for rewards\r\n function totalSupply() external view returns (uint256);\r\n\r\n /// @notice Get the amount of stakingToken deposited by an account\r\n function balanceOf(address) external view returns (uint256);\r\n\r\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\r\n function userRewardPerTokenPaid(address) external view returns (uint256);\r\n\r\n /// @notice Cached amount of rewardToken earned for an account\r\n function rewards(address) external view returns (uint256);\r\n\r\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\r\n function rewardRateByEpoch(uint256) external view returns (uint256);\r\n\r\n /// @notice Get the current reward rate per unit of stakingToken deposited\r\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\r\n\r\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\r\n function lastTimeRewardApplicable() external view returns (uint256 _time);\r\n\r\n /// @notice Returns accrued balance to date from last claim / first deposit.\r\n function earned(address _account) external view returns (uint256 _earned);\r\n\r\n /// @notice Total amount of rewardToken to distribute for the current rewards period\r\n function left() external view returns (uint256 _left);\r\n\r\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\r\n /// @return _claimed0 Amount of Fees claimed in token0\r\n /// @return _claimed1 Amount of Fees claimed in token1\r\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\r\n\r\n /// @notice Retrieve rewards for an address.\r\n /// @dev Throws if not called by same address or voter.\r\n /// @param _account .\r\n function getReward(address _account) external;\r\n\r\n /// @notice Deposit LP tokens into gauge for msg.sender\r\n /// @param _amount .\r\n function deposit(uint256 _amount) external;\r\n\r\n /// @notice Deposit LP tokens into gauge for any user\r\n /// @param _amount .\r\n /// @param _recipient Recipient to give balance to\r\n function deposit(uint256 _amount, address _recipient) external;\r\n\r\n /// @notice Withdraw LP tokens for user\r\n /// @param _amount .\r\n function withdraw(uint256 _amount) external;\r\n\r\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\r\n /// If not 18 decimals, rewardRate may have rounding issues.\r\n function notifyRewardMatch(uint256 amount) external;\r\n\r\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\r\n /// If not 18 decimals, rewardRate may have rounding issues.\r\n function notifyRewardAmount(uint256 amount) external;\r\n}\r\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport \"../IStakeStrategy.sol\";\r\nimport \"./VeloAeroStakingWallet.sol\";\r\nimport \"./IVeloIonModeStaking.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\r\nimport { UpgradeableBeacon } from \"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\";\r\n\r\n/**\r\n * @title VeloAeroStakingStrategy\r\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract VeloAeroStakingStrategy is IStakeStrategy, Ownable2StepUpgradeable {\r\n using SafeERC20 for IERC20;\r\n\r\n /// @notice Address of the escrow responsible for managing staking operations\r\n address public escrow;\r\n /// @notice Address of the token being staked\r\n address public stakingToken;\r\n /// @notice Address of the contract where staking operations are executed\r\n address public stakingContract;\r\n /// @notice Address of beacon contract that manages wallet proxies\r\n UpgradeableBeacon public veloAeroBeacon;\r\n /// @notice Mapping of user addresses to their respective staking wallet addresses\r\n mapping(address => address) public userStakingWallet;\r\n\r\n /// @dev Modifier to restrict function access to only the escrow address\r\n modifier onlyEscrow() {\r\n require(msg.sender == escrow, \"Not authorized: Only escrow can call this function\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n /**\r\n * @notice Initializes the staking strategy contract with necessary parameters\r\n * @dev This function can only be called once due to the initializer modifier\r\n * @param _escrow The address of the escrow responsible for staking operations\r\n * @param _stakingToken The address of the token to be staked\r\n * @param _stakingContract The address of the contract handling staking\r\n * @param _stakingWalletImplementation The address of the staking wallet implementation\r\n */\r\n function initialize(\r\n address _escrow,\r\n address _stakingToken,\r\n address _stakingContract,\r\n address _stakingWalletImplementation\r\n ) public initializer {\r\n __Ownable2Step_init();\r\n escrow = _escrow;\r\n stakingToken = _stakingToken;\r\n stakingContract = _stakingContract;\r\n\r\n veloAeroBeacon = new UpgradeableBeacon(_stakingWalletImplementation);\r\n veloAeroBeacon.transferOwnership(msg.sender);\r\n\r\n emit Initialized(_escrow, _stakingToken, _stakingContract, _stakingWalletImplementation);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function stake(address _from, uint256 _amount, bytes memory _data) external override onlyEscrow {\r\n IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), _amount);\r\n\r\n address veloWallet = userStakingWallet[_from];\r\n if (veloWallet == address(0)) {\r\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\r\n veloWallet = address(newWallet);\r\n VeloAeroStakingWallet(veloWallet).initialize(IStakeStrategy(address(this)));\r\n userStakingWallet[_from] = veloWallet;\r\n }\r\n\r\n IERC20(stakingToken).approve(veloWallet, _amount);\r\n VeloAeroStakingWallet(veloWallet).stake(_from, _amount, _data);\r\n emit Staked(_from, _amount, veloWallet);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function claim(address _from) external onlyEscrow {\r\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_from]);\r\n veloWallet.claim(_from);\r\n emit Claimed(_from, address(veloWallet));\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external onlyEscrow {\r\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_owner]);\r\n veloWallet.withdraw(_withdrawTo, _amount);\r\n emit Withdrawn(_owner, _withdrawTo, _amount);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function transferStakingWallet(address _from, address _to, uint256 _amount) external onlyEscrow {\r\n address fromWallet = userStakingWallet[_from];\r\n address toWallet = userStakingWallet[_to];\r\n\r\n if (toWallet == address(0)) {\r\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\r\n toWallet = address(newWallet);\r\n VeloAeroStakingWallet(toWallet).initialize(IStakeStrategy(address(this)));\r\n userStakingWallet[_to] = toWallet;\r\n }\r\n\r\n VeloAeroStakingWallet(fromWallet).withdraw(address(this), _amount);\r\n IERC20(stakingToken).approve(address(toWallet), _amount);\r\n VeloAeroStakingWallet(toWallet).stake(_to, _amount, \"\");\r\n emit StakingWalletTransferred(_from, _to, _amount);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function rewardRate() external view override returns (uint256) {\r\n return IVeloIonModeStaking(stakingContract).rewardRate();\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function periodFinish() external view override returns (uint256) {\r\n return IVeloIonModeStaking(stakingContract).periodFinish();\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function balanceOf(address account) public view override returns (uint256) {\r\n return IVeloIonModeStaking(stakingContract).balanceOf(account);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function totalSupply() external view override returns (uint256) {\r\n return IVeloIonModeStaking(stakingContract).totalSupply();\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function rewardToken() public view returns (address) {\r\n return IVeloIonModeStaking(stakingContract).rewardToken();\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function setEscrow(address _escrow) external onlyOwner {\r\n require(_escrow != address(0), \"Invalid address\");\r\n escrow = _escrow;\r\n emit EscrowSet(_escrow);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function setStakingToken(address _stakingToken) external onlyOwner {\r\n require(_stakingToken != address(0), \"Invalid address\");\r\n stakingToken = _stakingToken;\r\n emit StakingTokenSet(_stakingToken);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function setStakingContract(address _stakingContract) external onlyOwner {\r\n require(_stakingContract != address(0), \"Invalid address\");\r\n stakingContract = _stakingContract;\r\n emit StakingContractSet(_stakingContract);\r\n }\r\n\r\n /// @inheritdoc IStakeStrategy\r\n function setUpgradeableBeacon(address _beacon) external onlyOwner {\r\n require(_beacon != address(0), \"Invalid address\");\r\n veloAeroBeacon = UpgradeableBeacon(_beacon);\r\n emit UpgradeableBeaconSet(_beacon);\r\n }\r\n}\r\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { IStakeWallet } from \"../IStakeWallet.sol\";\r\nimport { IStakeStrategy } from \"../IStakeStrategy.sol\";\r\nimport { IVeloIonModeStaking } from \"./IVeloIonModeStaking.sol\";\r\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @title VeloAeroStakingWallet\r\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\r\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\r\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\r\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\r\n * @author Jourdan Dunkley \r\n */\r\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n IStakeStrategy public stakeStrategy;\r\n\r\n /// @dev Modifier to restrict function access to only the stake strategy contract\r\n modifier onlyStakeStrategy() {\r\n require(msg.sender == address(stakeStrategy), \"Not authorized: Only stake strategy can call this function\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n /**\r\n * @notice Initializes the contract with a staking strategy\r\n * @dev Can only be called once due to initializer modifier\r\n * @param _stakeStrategy The address of the staking strategy contract\r\n */\r\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\r\n stakeStrategy = _stakeStrategy;\r\n }\r\n\r\n /// @inheritdoc IStakeWallet\r\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\r\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\r\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\r\n\r\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\r\n stakingToken.approve(address(stakingContract), _amount);\r\n stakingContract.deposit(_amount);\r\n emit Staked(_amount);\r\n }\r\n\r\n /// @inheritdoc IStakeWallet\r\n function claim(address _from) external onlyStakeStrategy {\r\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\r\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\r\n\r\n stakingContract.getReward(address(this));\r\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\r\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\r\n emit Claimed(_from, rewardAmount);\r\n }\r\n\r\n /// @inheritdoc IStakeWallet\r\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\r\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\r\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\r\n\r\n stakingContract.withdraw(_amount);\r\n stakingToken.safeTransfer(_withdrawTo, _amount);\r\n emit Withdrawn(_withdrawTo, _amount);\r\n }\r\n}\r\n" + }, + "contracts/veION/veION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { IveIONCore, IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IVoter } from \"./interfaces/IVoter.sol\";\r\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\r\nimport { veIONStorage } from \"./veIONStorage.sol\";\r\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\r\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\r\n\r\n/**\r\n * @title veION Contract\r\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract veION is Ownable2StepUpgradeable, ERC721Upgradeable, ReentrancyGuardUpgradeable, veIONStorage, IveIONCore {\r\n using EnumerableSet for EnumerableSet.UintSet;\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeERC20 for IERC20;\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n /**\r\n * @notice Initializes the veION contract with the given AddressesProvider.\r\n * @dev This function is called only once during the contract deployment.\r\n * It initializes the Ownable, ERC721, and ReentrancyGuard modules.\r\n * @param _ap The AddressesProvider contract used for address management.\r\n */\r\n function initialize(IAddressesProvider _ap) public initializer {\r\n __Ownable2Step_init();\r\n __ERC721_init(\"veION\", \"veION\");\r\n __ReentrancyGuard_init();\r\n ap = _ap;\r\n emit Initialized(address(_ap));\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ External Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IveIONCore\r\n function createLockFor(\r\n address[] calldata _tokenAddress,\r\n uint256[] calldata _tokenAmount,\r\n uint256[] calldata _duration,\r\n bool[] memory _stakeUnderlying,\r\n address _to\r\n ) external override nonReentrant returns (uint256) {\r\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _to);\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function createLock(\r\n address[] calldata _tokenAddress,\r\n uint256[] calldata _tokenAmount,\r\n uint256[] calldata _duration,\r\n bool[] memory _stakeUnderlying\r\n ) external override nonReentrant returns (uint256) {\r\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _msgSender());\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function increaseAmount(\r\n address _tokenAddress,\r\n uint256 _tokenId,\r\n uint256 _tokenAmount,\r\n bool _stakeUnderlying\r\n ) external nonReentrant {\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\r\n\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n if (_tokenAmount == 0) revert ZeroAmount();\r\n if (oldLocked.amount == 0) revert NoLockFound();\r\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\r\n\r\n if (oldLocked.isPermanent) s_permanentLockBalance[_lpType] += _tokenAmount;\r\n\r\n _depositFor(\r\n _tokenAddress,\r\n _tokenId,\r\n _tokenAmount,\r\n 0,\r\n _stakeUnderlying,\r\n oldLocked,\r\n DepositType.INCREASE_LOCK_AMOUNT,\r\n _lpType,\r\n _msgSender()\r\n );\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function lockAdditionalAsset(\r\n address _tokenAddress,\r\n uint256 _tokenAmount,\r\n uint256 _tokenId,\r\n uint256 _duration,\r\n bool _stakeUnderlying\r\n ) external nonReentrant {\r\n LpTokenType lpType = s_lpType[_tokenAddress];\r\n LockedBalance storage lockedBalance = s_locked[_tokenId][lpType];\r\n uint256 unlockTime = ((block.timestamp + _duration) / _WEEK) * _WEEK;\r\n\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n if (_tokenAmount == 0) revert ZeroAmount();\r\n if (s_voted[_tokenId]) revert AlreadyVoted();\r\n if (!s_assetsLocked[_tokenId].add(_tokenAddress)) revert DuplicateAsset();\r\n if (_tokenAmount < s_minimumLockAmount[lpType]) revert MinimumNotMet();\r\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\r\n if (_duration < s_minimumLockDuration) revert LockDurationTooShort();\r\n\r\n if (lockedBalance.isPermanent) s_permanentLockBalance[lpType] += _tokenAmount;\r\n\r\n _depositFor(\r\n _tokenAddress,\r\n _tokenId,\r\n _tokenAmount,\r\n unlockTime,\r\n _stakeUnderlying,\r\n lockedBalance,\r\n DepositType.LOCK_ADDITIONAL,\r\n lpType,\r\n _msgSender()\r\n );\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external nonReentrant {\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\r\n uint256 unlockTime = ((block.timestamp + _lockDuration) / _WEEK) * _WEEK; // Locktime is rounded down to weeks\r\n\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n if (oldLocked.isPermanent) revert PermanentLock();\r\n if (oldLocked.end <= block.timestamp) revert LockExpired();\r\n if (oldLocked.amount <= 0) revert NoLockFound();\r\n if (unlockTime <= oldLocked.end) revert LockDurationNotInFuture();\r\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\r\n\r\n _depositFor(\r\n _tokenAddress,\r\n _tokenId,\r\n 0,\r\n unlockTime,\r\n false,\r\n oldLocked,\r\n DepositType.INCREASE_UNLOCK_TIME,\r\n _lpType,\r\n _msgSender()\r\n );\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external nonReentrant {\r\n LpTokenType lpType = s_lpType[lpToken];\r\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\r\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\r\n\r\n if (ownerOf(fromTokenId) != _msgSender()) revert NotOwner();\r\n if (amount > fromLocked.amount) revert AmountTooBig();\r\n if (!fromLocked.isPermanent) revert NotPermanentLock();\r\n if (!toLocked.isPermanent) revert NotPermanentLock();\r\n if (s_delegatorsBlocked[toTokenId][lpToken]) revert NotAcceptingDelegators();\r\n\r\n fromLocked.amount -= amount;\r\n toLocked.delegateAmount += amount;\r\n\r\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\r\n s_delegatees[fromTokenId][lpType].add(toTokenId);\r\n s_delegators[toTokenId][lpType].add(fromTokenId);\r\n }\r\n\r\n s_delegations[fromTokenId][toTokenId][lpType] += amount;\r\n\r\n s_locked[fromTokenId][lpType] = fromLocked;\r\n s_locked[toTokenId][lpType] = toLocked;\r\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\r\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\r\n\r\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\r\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\r\n\r\n emit Delegated(fromTokenId, toTokenId, lpToken, amount);\r\n }\r\n\r\n /**\r\n * @dev Internal function to remove a delegation between two veNFTs.\r\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\r\n * @param toTokenId ID of the veNFT to which delegation is being removed.\r\n * @param lpToken Address of the LP token associated with the delegation.\r\n * @param amount Amount of delegation to remove.\r\n */\r\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\r\n LpTokenType lpType = s_lpType[lpToken];\r\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\r\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\r\n\r\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\r\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\r\n\r\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\r\n ? s_delegations[fromTokenId][toTokenId][lpType]\r\n : amount;\r\n\r\n toLocked.delegateAmount -= amount;\r\n fromLocked.amount += amount;\r\n\r\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\r\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\r\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\r\n s_delegators[toTokenId][lpType].remove(fromTokenId);\r\n }\r\n\r\n s_locked[toTokenId][lpType] = toLocked;\r\n s_locked[fromTokenId][lpType] = fromLocked;\r\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\r\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\r\n\r\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\r\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\r\n\r\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function removeDelegatees(\r\n uint256 fromTokenId,\r\n uint256[] memory toTokenIds,\r\n address lpToken,\r\n uint256[] memory amounts\r\n ) public nonReentrant {\r\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\r\n uint256 toTokenIdsLength = toTokenIds.length;\r\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\r\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\r\n }\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function removeDelegators(\r\n uint256[] memory fromTokenIds,\r\n uint256 toTokenId,\r\n address lpToken,\r\n uint256[] memory amounts\r\n ) external nonReentrant {\r\n if (fromTokenIds.length != amounts.length) revert ArrayMismatch();\r\n uint256 fromTokenIdsLength = fromTokenIds.length;\r\n for (uint256 i = 0; i < fromTokenIdsLength; i++) {\r\n _removeDelegation(fromTokenIds[i], toTokenId, lpToken, amounts[i]);\r\n }\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n if (_newLocked.isPermanent) revert PermanentLock();\r\n if (_newLocked.end <= block.timestamp) revert LockExpired();\r\n if (_newLocked.amount <= 0) revert NoLockFound();\r\n\r\n s_permanentLockBalance[_lpType] += _newLocked.amount;\r\n _newLocked.end = 0;\r\n _newLocked.isPermanent = true;\r\n _newLocked.boost = _calculateBoost(_MAXTIME);\r\n\r\n s_locked[_tokenId][_lpType] = _newLocked;\r\n _checkpoint(_tokenId, _newLocked, _lpType);\r\n\r\n emit PermanentLockCreated(_tokenAddress, _tokenId, _newLocked.amount);\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n if (!_newLocked.isPermanent) revert NotPermanentLock();\r\n if (s_delegatees[_tokenId][_lpType].length() != 0) revert TokenHasDelegatees();\r\n if (s_delegators[_tokenId][_lpType].length() != 0) revert TokenHasDelegators();\r\n\r\n s_permanentLockBalance[_lpType] -= _newLocked.amount;\r\n _newLocked.end = ((block.timestamp + _MAXTIME) / _WEEK) * _WEEK;\r\n _newLocked.isPermanent = false;\r\n\r\n s_locked[_tokenId][_lpType] = _newLocked;\r\n _checkpoint(_tokenId, _newLocked, _lpType);\r\n\r\n emit PermanentLockRemoved(_tokenAddress, _tokenId, _newLocked.amount);\r\n }\r\n\r\n /**\r\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\r\n * @param tokenId Token ID to burn.\r\n */\r\n function _burn(uint256 tokenId) internal override {\r\n super._burn(tokenId);\r\n }\r\n\r\n /**\r\n * @notice Hook that is called before any token transfer. This includes minting\r\n * and burning. It updates the ownership mappings and handles delegation and\r\n * staking logic when transferring tokens between addresses.\r\n *\r\n * @param from The address which previously owned the token.\r\n * @param to The address that will receive the token.\r\n * @param tokenId The ID of the token being transferred.\r\n */\r\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\r\n super._beforeTokenTransfer(from, to, tokenId);\r\n\r\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\r\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\r\n\r\n if (from != address(0) && to != address(0)) {\r\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\r\n uint256 assetsLockedLength = assetsLocked.length;\r\n for (uint256 i = 0; i < assetsLockedLength; i++) {\r\n address asset = assetsLocked[i];\r\n LpTokenType _lpType = s_lpType[asset];\r\n\r\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\r\n uint256[] memory amounts = new uint256[](delegatees.length);\r\n uint256 delegateesLength = delegatees.length;\r\n for (uint256 j = 0; j < delegateesLength; j++) {\r\n amounts[j] = type(uint256).max;\r\n }\r\n\r\n if (delegateesLength != 0) {\r\n removeDelegatees(tokenId, delegatees, asset, amounts);\r\n }\r\n\r\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\r\n if (amountStaked != 0) {\r\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\r\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\r\n }\r\n\r\n LockedBalance memory lock = s_locked[tokenId][_lpType];\r\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\r\n s_userCumulativeAssetValues[to][asset] += lock.amount;\r\n }\r\n }\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function voting(uint256 _tokenId, bool _voting) external {\r\n if (_msgSender() != s_voter) revert NotVoter();\r\n s_voted[_tokenId] = _voting;\r\n emit Voted(_tokenId, _voting);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Internal Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n struct DepositVars {\r\n uint256 supplyBefore;\r\n uint256 totalLockTime;\r\n LockedBalance newLocked;\r\n address from;\r\n }\r\n\r\n /**\r\n * @notice Deposits tokens for a specific veNFT, updating its locked balance and boost.\r\n * @dev This function handles the deposit logic for veNFTs, including updating the locked balance,\r\n * calculating the boost based on the lock duration, and transferring tokens.\r\n * @param _tokenAddress The address of the token to deposit.\r\n * @param _tokenId The ID of the veNFT to deposit tokens for.\r\n * @param _tokenAmount The amount of tokens to deposit.\r\n * @param _unlockTime The time at which the lock will expire.\r\n * @param _stakeUnderlying A boolean indicating whether to stake the underlying tokens.\r\n * @param _oldLocked The previous locked balance of the veNFT.\r\n * @param _depositType The type of deposit being made.\r\n * @param _lpType The LP token type associated with the deposit.\r\n * @param _to The address to which the veNFT is assigned.\r\n */\r\n function _depositFor(\r\n address _tokenAddress,\r\n uint256 _tokenId,\r\n uint256 _tokenAmount,\r\n uint256 _unlockTime,\r\n bool _stakeUnderlying,\r\n LockedBalance memory _oldLocked,\r\n DepositType _depositType,\r\n LpTokenType _lpType,\r\n address _to\r\n ) internal {\r\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\r\n\r\n DepositVars memory vars;\r\n vars.supplyBefore = s_supply[_lpType];\r\n s_supply[_lpType] = vars.supplyBefore + _tokenAmount;\r\n\r\n (\r\n vars.newLocked.tokenAddress,\r\n vars.newLocked.amount,\r\n vars.newLocked.start,\r\n vars.newLocked.end,\r\n vars.newLocked.isPermanent,\r\n vars.newLocked.boost\r\n ) = (\r\n _oldLocked.tokenAddress,\r\n _oldLocked.amount,\r\n _oldLocked.start,\r\n _oldLocked.end,\r\n _oldLocked.isPermanent,\r\n _oldLocked.boost\r\n );\r\n\r\n vars.newLocked.tokenAddress = _tokenAddress;\r\n vars.newLocked.amount += _tokenAmount;\r\n if (_unlockTime != 0) {\r\n if (vars.newLocked.start == 0) vars.newLocked.start = block.timestamp;\r\n vars.newLocked.end = _unlockTime;\r\n vars.totalLockTime = vars.newLocked.end - vars.newLocked.start;\r\n vars.newLocked.boost = _calculateBoost(vars.totalLockTime);\r\n }\r\n s_locked[_tokenId][_lpType] = vars.newLocked;\r\n\r\n _checkpoint(_tokenId, vars.newLocked, _lpType);\r\n\r\n vars.from = _msgSender();\r\n if (_tokenAmount != 0) {\r\n s_userCumulativeAssetValues[ownerOf(_tokenId)][_tokenAddress] += _tokenAmount;\r\n IERC20(_tokenAddress).safeTransferFrom(vars.from, address(this), _tokenAmount);\r\n (IStakeStrategy _stakeStrategy, bytes memory _stakeData) = _getStakeStrategy(_lpType);\r\n if (address(_stakeStrategy) != address(0) && _stakeUnderlying) {\r\n _handleTokenStake(_to, _tokenId, _tokenAddress, _tokenAmount, _stakeStrategy, _stakeData);\r\n }\r\n }\r\n\r\n emit Deposit(_to, _tokenId, _depositType, _tokenAmount, vars.newLocked.end, block.timestamp);\r\n emit Supply(vars.supplyBefore, s_supply[_lpType]);\r\n }\r\n\r\n /**\r\n * @notice Handles the staking of tokens using a specified staking strategy.\r\n * @param _to The address to which the stake is attributed.\r\n * @param _tokenId The ID of the token being staked.\r\n * @param _tokenAddress The address of the token being staked.\r\n * @param _tokenAmount The amount of tokens to stake.\r\n * @param _stakeStrategy The staking strategy to use.\r\n * @param _stakeData Additional data required for staking.\r\n */\r\n function _handleTokenStake(\r\n address _to,\r\n uint256 _tokenId,\r\n address _tokenAddress,\r\n uint256 _tokenAmount,\r\n IStakeStrategy _stakeStrategy,\r\n bytes memory _stakeData\r\n ) internal {\r\n IERC20(_tokenAddress).approve(address(_stakeStrategy), _tokenAmount);\r\n _stakeStrategy.stake(_to, _tokenAmount, _stakeData);\r\n s_underlyingStake[_tokenId][_tokenAddress] += _tokenAmount;\r\n }\r\n\r\n /**\r\n * @notice Updates the user point history and epoch for a given token and LP token type.\r\n * @param _tokenId The ID of the token.\r\n * @param _newLocked The new locked balance information.\r\n * @param _lpType The LP token type.\r\n */\r\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\r\n UserPoint memory uNew;\r\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\r\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\r\n\r\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\r\n uNew.slope = _newLocked.amount / _MAXTIME;\r\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\r\n }\r\n\r\n uNew.ts = block.timestamp;\r\n uNew.blk = block.number;\r\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\r\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\r\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\r\n } else {\r\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\r\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Creates a lock for multiple tokens with specified durations and staking options.\r\n * @param _tokenAddress Array of token addresses to lock.\r\n * @param _tokenAmount Array of token amounts to lock.\r\n * @param _duration Array of durations for each lock.\r\n * @param _stakeUnderlying Array of booleans indicating whether to stake the underlying tokens.\r\n * @param _to The address to which the lock is attributed.\r\n * @return The ID of the newly created lock.\r\n */\r\n function _createLock(\r\n address[] memory _tokenAddress,\r\n uint256[] memory _tokenAmount,\r\n uint256[] memory _duration,\r\n bool[] memory _stakeUnderlying,\r\n address _to\r\n ) internal returns (uint256) {\r\n uint256 _tokenId = ++s_tokenId;\r\n uint256 _length = _tokenAddress.length;\r\n _safeMint(_to, _tokenId);\r\n\r\n if (\r\n _tokenAddress.length != _tokenAmount.length ||\r\n _tokenAmount.length != _duration.length ||\r\n _duration.length != _stakeUnderlying.length\r\n ) {\r\n revert ArrayMismatch();\r\n }\r\n\r\n for (uint256 i = 0; i < _length; i++) {\r\n LpTokenType _lpType = s_lpType[_tokenAddress[i]];\r\n uint256 unlockTime = ((block.timestamp + _duration[i]) / _WEEK) * _WEEK;\r\n\r\n if (!s_assetsLocked[_tokenId].add(_tokenAddress[i])) revert DuplicateAsset();\r\n if (_tokenAmount[i] == 0) revert ZeroAmount();\r\n if (_duration[i] < s_minimumLockDuration) revert LockDurationTooShort();\r\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\r\n if (_tokenAmount[i] < s_minimumLockAmount[_lpType]) revert MinimumNotMet();\r\n\r\n _depositFor(\r\n _tokenAddress[i],\r\n _tokenId,\r\n _tokenAmount[i],\r\n unlockTime,\r\n _stakeUnderlying[i],\r\n s_locked[_tokenId][_lpType],\r\n DepositType.CREATE_LOCK_TYPE,\r\n _lpType,\r\n _to\r\n );\r\n }\r\n return _tokenId;\r\n }\r\n\r\n /**\r\n * @notice Calculates the boost for a given lock duration.\r\n * @param _duration The duration of the lock.\r\n * @return The calculated boost value.\r\n */\r\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\r\n uint256 minDuration = s_minimumLockDuration;\r\n uint256 maxDuration = _MAXTIME;\r\n uint256 minBoost = 1e18;\r\n uint256 maxBoost = 2e18;\r\n\r\n if (_duration <= minDuration) {\r\n return minBoost;\r\n } else if (_duration >= maxDuration) {\r\n return maxBoost;\r\n } else {\r\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Retrieves the staking strategy and data for a given LP token type.\r\n * @param _lpType The LP token type.\r\n * @return _stakeStrategy The staking strategy for the LP token type.\r\n * @return _stakeData The staking data for the LP token type.\r\n */\r\n function _getStakeStrategy(\r\n LpTokenType _lpType\r\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\r\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\r\n return (strategy, \"\");\r\n }\r\n\r\n /// @inheritdoc IveIONCore\r\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external onlyOwner {\r\n require(_veIONFirstExtension != address(0), \"Invalid First Extension Address\");\r\n require(_veIONSecondExtension != address(0), \"Invalid Second Extension Address\");\r\n require(_veIONFirstExtension != _veIONSecondExtension, \"Submitted Identical Addresses\");\r\n veIONFirstExtension = _veIONFirstExtension;\r\n veIONSecondExtension = _veIONSecondExtension;\r\n emit ExtensionsSet(_veIONFirstExtension, _veIONSecondExtension);\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\r\n * function in the contract matches the call data.\r\n */\r\n fallback() external {\r\n address impl = veIONFirstExtension;\r\n require(impl != address(0), \"Implementation not set\");\r\n\r\n assembly {\r\n calldatacopy(0, 0, calldatasize())\r\n\r\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\r\n\r\n returndatacopy(0, 0, returndatasize())\r\n switch result\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/veION/veIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IVoter } from \"./interfaces/IVoter.sol\";\r\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\r\nimport { veIONStorage } from \"./veIONStorage.sol\";\r\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\r\nimport { IveIONFirstExtension } from \"./interfaces/IveIONFirstExtension.sol\";\r\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\r\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\r\n\r\n/**\r\n * @title veION Contract First Extensions\r\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract veIONFirstExtension is\r\n Ownable2StepUpgradeable,\r\n ERC721Upgradeable,\r\n ReentrancyGuardUpgradeable,\r\n veIONStorage,\r\n IveIONFirstExtension\r\n{\r\n using EnumerableSet for EnumerableSet.UintSet;\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeERC20 for IERC20;\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ External Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function withdraw(address _tokenAddress, uint256 _tokenId) external nonReentrant {\r\n address sender = _msgSender();\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\r\n\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n if (s_voted[_tokenId]) revert AlreadyVoted();\r\n if (oldLocked.isPermanent) revert PermanentLock();\r\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\r\n if (oldLocked.amount == 0 || !s_assetsLocked[_tokenId].contains(_tokenAddress)) revert NoLockFound();\r\n\r\n uint256 value = oldLocked.amount;\r\n s_userCumulativeAssetValues[sender][_tokenAddress] -= value;\r\n uint256 fee = 0;\r\n\r\n if (block.timestamp < oldLocked.end) {\r\n uint256 daysLocked = ((oldLocked.end - oldLocked.start) * 1e18) / 1 days;\r\n uint256 daysLeft = ((oldLocked.end - block.timestamp) * 1e18) / 1 days;\r\n uint256 timeFactor = (daysLeft * 1e18) / daysLocked;\r\n uint256 veLPLocked = s_supply[_lpType];\r\n uint256 LPInCirculation = IERC20(_tokenAddress).totalSupply();\r\n uint256 ratioFactor = 1e18 - (veLPLocked * 1e18) / LPInCirculation;\r\n fee = (timeFactor * ratioFactor * oldLocked.boost) / 1e36;\r\n if (fee > s_maxEarlyWithdrawFee) fee = s_maxEarlyWithdrawFee;\r\n fee = (value * fee) / 1e18;\r\n value -= fee;\r\n\r\n uint256 feeToDistribute = (fee * 75) / 100;\r\n uint256 feeToProtocol = fee - feeToDistribute;\r\n s_protocolFees[_lpType] += feeToProtocol;\r\n s_distributedFees[_lpType] += feeToDistribute;\r\n }\r\n\r\n s_locked[_tokenId][_lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\r\n s_assetsLocked[_tokenId].remove(_tokenAddress);\r\n uint256 supplyBefore = s_supply[_lpType];\r\n\r\n uint256 amountStaked = s_underlyingStake[_tokenId][_tokenAddress];\r\n if (amountStaked != 0) {\r\n (IStakeStrategy _stakeStrategy, ) = _getStakeStrategy(_lpType);\r\n if (address(_stakeStrategy) != address(0)) {\r\n _handleTokenWithdrawStake(sender, address(this), _tokenId, _tokenAddress, amountStaked, _stakeStrategy);\r\n }\r\n }\r\n\r\n s_supply[_lpType] = supplyBefore - oldLocked.amount;\r\n _checkpoint(_tokenId, LockedBalance(address(0), 0, 0, 0, 0, false, 0), _lpType);\r\n\r\n // Check if all LP types for this token have zero balance\r\n bool shouldBurn = true;\r\n address[] memory lockedAssets = s_assetsLocked[_tokenId].values();\r\n uint256 lockedAssetsLength = lockedAssets.length;\r\n for (uint256 i = 0; i < lockedAssetsLength; i++) {\r\n LpTokenType assetLpType = s_lpType[lockedAssets[i]];\r\n if (s_locked[_tokenId][assetLpType].amount > 0) {\r\n shouldBurn = false;\r\n break;\r\n }\r\n }\r\n\r\n if (shouldBurn) _burn(_tokenId);\r\n\r\n IERC20(_tokenAddress).safeTransfer(sender, value);\r\n emit Withdraw(sender, _tokenId, value, block.timestamp);\r\n emit Supply(supplyBefore, supplyBefore - oldLocked.amount);\r\n }\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function merge(uint256 _from, uint256 _to) external nonReentrant {\r\n if (_from == _to) revert SameNFT();\r\n if (s_voted[_from] || s_voted[_to]) revert AlreadyVoted();\r\n if (ownerOf(_from) != _msgSender()) revert NotOwner();\r\n if (ownerOf(_to) != _msgSender()) revert NotOwner();\r\n\r\n address[] memory assetsLocked = s_assetsLocked[_from].values();\r\n uint256 assetsLockedLength = assetsLocked.length;\r\n for (uint256 i = 0; i < assetsLockedLength; i++) {\r\n address asset = assetsLocked[i];\r\n LpTokenType lpType = s_lpType[asset];\r\n\r\n LockedBalance memory oldLockedTo = s_locked[_to][lpType];\r\n LockedBalance memory oldLockedFrom = s_locked[_from][lpType];\r\n\r\n if (oldLockedTo.end != 0 && oldLockedTo.end <= block.timestamp) revert LockExpired();\r\n if (oldLockedFrom.end != 0 && oldLockedFrom.end <= block.timestamp) revert LockExpired();\r\n if (oldLockedFrom.isPermanent) revert PermanentLock();\r\n if (oldLockedTo.isPermanent) revert PermanentLock();\r\n\r\n LockedBalance memory newLockedTo;\r\n\r\n newLockedTo.tokenAddress = asset;\r\n newLockedTo.amount = oldLockedTo.amount + oldLockedFrom.amount;\r\n newLockedTo.start = oldLockedTo.start < oldLockedFrom.start && oldLockedTo.start != 0\r\n ? oldLockedTo.start\r\n : oldLockedFrom.start;\r\n newLockedTo.end = oldLockedTo.end > oldLockedFrom.end ? oldLockedTo.end : oldLockedFrom.end;\r\n newLockedTo.boost = _calculateBoost(newLockedTo.end - newLockedTo.start);\r\n\r\n s_locked[_from][lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\r\n _checkpoint(_from, LockedBalance(address(0), 0, 0, 0, 0, false, 0), lpType);\r\n s_locked[_to][lpType] = newLockedTo;\r\n _checkpoint(_to, newLockedTo, lpType);\r\n\r\n s_assetsLocked[_from].remove(asset);\r\n if (!s_assetsLocked[_to].contains(asset)) {\r\n s_assetsLocked[_to].add(asset);\r\n }\r\n\r\n if (s_underlyingStake[_from][asset] != 0) {\r\n s_underlyingStake[_to][asset] += s_underlyingStake[_from][asset];\r\n s_underlyingStake[_from][asset] = 0;\r\n }\r\n }\r\n _burn(_from);\r\n emit MergeCompleted(_from, _to, assetsLocked, assetsLocked.length);\r\n }\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function split(\r\n address _tokenAddress,\r\n uint256 _from,\r\n uint256 _splitAmount\r\n ) external nonReentrant returns (uint256 _tokenId1, uint256 _tokenId2) {\r\n address ownerFrom = _ownerOf(_from);\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n LockedBalance memory oldLocked = s_locked[_from][_lpType];\r\n uint256 minimumLockAmount = s_minimumLockAmount[_lpType];\r\n\r\n if (s_voted[_from]) revert AlreadyVoted();\r\n if (!s_canSplit[ownerFrom] && !s_canSplit[address(0)]) revert SplitNotAllowed();\r\n if (ownerFrom != _msgSender()) revert NotOwner();\r\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\r\n if (_splitAmount >= oldLocked.amount) revert AmountTooBig();\r\n if (_splitAmount < minimumLockAmount) revert SplitTooSmall();\r\n if (oldLocked.amount - _splitAmount < minimumLockAmount) revert NotEnoughRemainingAfterSplit();\r\n\r\n LockedBalance memory oldLockedTemp = oldLocked;\r\n\r\n oldLocked.amount -= _splitAmount;\r\n s_locked[_from][_lpType] = oldLocked;\r\n _checkpoint(_from, oldLocked, _lpType);\r\n\r\n LockedBalance memory splitLocked = oldLockedTemp;\r\n splitLocked.amount = _splitAmount;\r\n _tokenId2 = _createSplitVE(ownerFrom, splitLocked, _lpType, _tokenAddress);\r\n _tokenId1 = _from;\r\n\r\n if (s_underlyingStake[_from][_tokenAddress] != 0) {\r\n s_underlyingStake[_from][_tokenAddress] -= _splitAmount;\r\n s_underlyingStake[_tokenId2][_tokenAddress] = _splitAmount;\r\n }\r\n\r\n emit SplitCompleted(_from, _tokenId1, _tokenId2, _splitAmount, _tokenAddress);\r\n }\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function claimEmissions(address _tokenAddress) external nonReentrant {\r\n LpTokenType _lpType = s_lpType[_tokenAddress];\r\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\r\n if (_stakeStrategy.userStakingWallet(_msgSender()) == address(0)) revert NoUnderlyingStake();\r\n _stakeStrategy.claim(_msgSender());\r\n emit EmissionsClaimed(_msgSender(), _tokenAddress);\r\n }\r\n\r\n /**\r\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\r\n * @param tokenId Token ID to burn.\r\n */\r\n function _burn(uint256 tokenId) internal override {\r\n super._burn(tokenId);\r\n }\r\n\r\n /**\r\n * @notice Hook that is called before any token transfer. This includes minting\r\n * and burning. It updates the ownership mappings and handles delegation and\r\n * staking logic when transferring tokens between addresses.\r\n *\r\n * @param from The address which previously owned the token.\r\n * @param to The address that will receive the token.\r\n * @param tokenId The ID of the token being transferred.\r\n */\r\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\r\n super._beforeTokenTransfer(from, to, tokenId);\r\n\r\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\r\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\r\n\r\n if (from != address(0) && to != address(0)) {\r\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\r\n uint256 assetsLockedLength = assetsLocked.length;\r\n for (uint256 i = 0; i < assetsLockedLength; i++) {\r\n address asset = assetsLocked[i];\r\n LpTokenType _lpType = s_lpType[asset];\r\n\r\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\r\n uint256[] memory amounts = new uint256[](delegatees.length);\r\n uint256 delegateesLength = delegatees.length;\r\n for (uint256 j = 0; j < delegateesLength; j++) {\r\n amounts[j] = type(uint256).max;\r\n }\r\n\r\n if (delegateesLength != 0) {\r\n removeDelegatees(tokenId, delegatees, asset, amounts);\r\n }\r\n\r\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\r\n if (amountStaked != 0) {\r\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\r\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\r\n }\r\n\r\n LockedBalance memory lock = s_locked[tokenId][_lpType];\r\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\r\n s_userCumulativeAssetValues[to][asset] += lock.amount;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function to remove a delegation between two veNFTs.\r\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\r\n * @param toTokenId ID of the veNFT to which delegation is being removed.\r\n * @param lpToken Address of the LP token associated with the delegation.\r\n * @param amount Amount of delegation to remove.\r\n */\r\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\r\n LpTokenType lpType = s_lpType[lpToken];\r\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\r\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\r\n\r\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\r\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\r\n\r\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\r\n ? s_delegations[fromTokenId][toTokenId][lpType]\r\n : amount;\r\n\r\n toLocked.delegateAmount -= amount;\r\n fromLocked.amount += amount;\r\n\r\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\r\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\r\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\r\n s_delegators[toTokenId][lpType].remove(fromTokenId);\r\n }\r\n\r\n s_locked[toTokenId][lpType] = toLocked;\r\n s_locked[fromTokenId][lpType] = fromLocked;\r\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\r\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\r\n\r\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\r\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\r\n\r\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\r\n }\r\n\r\n /**\r\n * @notice Removes delegatees from a specific veNFT\r\n * @param fromTokenId ID of the veNFT from which delegatees are removed\r\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\r\n * @param lpToken Address of the LP token associated with the delegation\r\n * @param amounts Array of amounts of voting power to remove from each delegatee\r\n */\r\n function removeDelegatees(\r\n uint256 fromTokenId,\r\n uint256[] memory toTokenIds,\r\n address lpToken,\r\n uint256[] memory amounts\r\n ) public nonReentrant {\r\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\r\n uint256 toTokenIdsLength = toTokenIds.length;\r\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\r\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\r\n }\r\n }\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external nonReentrant {\r\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n s_delegatorsBlocked[_tokenId][_tokenAddress] = _blocked;\r\n emit DelegatorsBlocked(_tokenId, _tokenAddress, _blocked);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Internal Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /**\r\n * @notice Handles the withdrawal of staked tokens using a specified staking strategy.\r\n * @param _owner The address of the owner of the stake.\r\n * @param _withdrawTo The address to which the withdrawn tokens are sent.\r\n * @param _tokenId The ID of the token being withdrawn.\r\n * @param _tokenAddress The address of the token being withdrawn.\r\n * @param _tokenAmount The amount of tokens to withdraw.\r\n * @param _stakeStrategy The staking strategy to use for withdrawal.\r\n */\r\n function _handleTokenWithdrawStake(\r\n address _owner,\r\n address _withdrawTo,\r\n uint256 _tokenId,\r\n address _tokenAddress,\r\n uint256 _tokenAmount,\r\n IStakeStrategy _stakeStrategy\r\n ) internal {\r\n _stakeStrategy.claim(_owner);\r\n _stakeStrategy.withdraw(_owner, _withdrawTo, _tokenAmount);\r\n s_underlyingStake[_tokenId][_tokenAddress] -= _tokenAmount;\r\n }\r\n\r\n /**\r\n * @notice Updates the user point history and epoch for a given token and LP token type.\r\n * @param _tokenId The ID of the token.\r\n * @param _newLocked The new locked balance information.\r\n * @param _lpType The LP token type.\r\n */\r\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\r\n UserPoint memory uNew;\r\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\r\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\r\n\r\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\r\n uNew.slope = _newLocked.amount / _MAXTIME;\r\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\r\n }\r\n\r\n uNew.ts = block.timestamp;\r\n uNew.blk = block.number;\r\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\r\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\r\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\r\n } else {\r\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\r\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates the boost for a given lock duration.\r\n * @param _duration The duration of the lock.\r\n * @return The calculated boost value.\r\n */\r\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\r\n uint256 minDuration = s_minimumLockDuration;\r\n uint256 maxDuration = _MAXTIME;\r\n uint256 minBoost = 1e18;\r\n uint256 maxBoost = 2e18;\r\n\r\n if (_duration <= minDuration) {\r\n return minBoost;\r\n } else if (_duration >= maxDuration) {\r\n return maxBoost;\r\n } else {\r\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Creates a new split veNFT with specified locked balance and LP token type.\r\n * @param _to The address to which the new veNFT is attributed.\r\n * @param _newLocked The locked balance information for the new veNFT.\r\n * @param _lpType The LP token type.\r\n * @param _tokenAddress The address of the token being locked.\r\n * @return _tokenId The ID of the newly created veNFT.\r\n */\r\n function _createSplitVE(\r\n address _to,\r\n LockedBalance memory _newLocked,\r\n LpTokenType _lpType,\r\n address _tokenAddress\r\n ) private returns (uint256 _tokenId) {\r\n _tokenId = ++s_tokenId;\r\n _safeMint(_to, _tokenId);\r\n s_locked[_tokenId][_lpType] = _newLocked;\r\n s_assetsLocked[_tokenId].add(_tokenAddress);\r\n _checkpoint(_tokenId, _newLocked, _lpType);\r\n }\r\n\r\n /**\r\n * @notice Retrieves the staking strategy and data for a given LP token type.\r\n * @param _lpType The LP token type.\r\n * @return _stakeStrategy The staking strategy for the LP token type.\r\n * @return _stakeData The staking data for the LP token type.\r\n */\r\n function _getStakeStrategy(\r\n LpTokenType _lpType\r\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\r\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\r\n return (strategy, \"\");\r\n }\r\n\r\n /**\r\n * @notice Calculates the total boost for a given token ID and LP token type.\r\n * @param _tokenId The ID of the token.\r\n * @param _lpType The LP token type.\r\n * @return The total boost value.\r\n */\r\n function _getTotalBoost(uint256 _tokenId, LpTokenType _lpType) internal view returns (uint256) {\r\n uint256 totalBoost = s_locked[_tokenId][_lpType].boost;\r\n if (s_limitedBoostActive) totalBoost += s_limitedBoost;\r\n if (s_veAERO == address(0)) return totalBoost;\r\n\r\n address _owner = ownerOf(_tokenId);\r\n IAeroVoter aeroVoter = IAeroVoter(s_aeroVoting);\r\n IAeroVotingEscrow veAERO = IAeroVotingEscrow(s_veAERO);\r\n uint256 _balance = veAERO.balanceOf(_owner);\r\n for (uint256 i = 0; i < _balance; i++) {\r\n uint256 veAeroTokenId = veAERO.ownerToNFTokenIdList(_owner, i);\r\n uint256 weightToVoteRatio = (aeroVoter.votes(veAeroTokenId, s_ionicPool) * 1e18) / aeroVoter.weights(s_ionicPool);\r\n totalBoost += (s_aeroVoterBoost * weightToVoteRatio) / 1e18;\r\n }\r\n\r\n return totalBoost;\r\n }\r\n\r\n /**\r\n * @notice Retrieves the ETH price of a given token.\r\n * @dev Uses the MasterPriceOracle to fetch the price.\r\n * @param _token The address of the token for which the ETH price is requested.\r\n * @return The ETH price of the specified token.\r\n */\r\n function _getEthPrice(address _token) internal view returns (uint256) {\r\n IMasterPriceOracle mpo = IMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\r\n return mpo.price(_token);\r\n }\r\n\r\n // // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // // ║ View Functions ║\r\n // // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function balanceOfNFT(\r\n uint256 _tokenId\r\n ) public view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts) {\r\n address[] memory assetsLocked = s_assetsLocked[_tokenId].values();\r\n\r\n _assets = new address[](assetsLocked.length);\r\n _balances = new uint256[](assetsLocked.length);\r\n _boosts = new uint256[](assetsLocked.length);\r\n uint256 assetsLockedLength = assetsLocked.length;\r\n for (uint256 i = 0; i < assetsLockedLength; i++) {\r\n address asset = assetsLocked[i];\r\n LpTokenType lpType = s_lpType[asset];\r\n LockedBalance memory lockedBalance = s_locked[_tokenId][lpType];\r\n _boosts[i] = _getTotalBoost(_tokenId, lpType);\r\n _assets[i] = asset;\r\n _balances[i] = BalanceLogicLibrary.balanceOfNFTAt(\r\n s_userPointEpoch,\r\n s_userPointHistory,\r\n lpType,\r\n _tokenId,\r\n block.timestamp,\r\n lockedBalance.isPermanent\r\n );\r\n }\r\n\r\n return (_assets, _balances, _boosts);\r\n }\r\n\r\n /// @inheritdoc IveIONFirstExtension\r\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\r\n IVoter voter = IVoter(s_voter);\r\n address[] memory lpTokens = voter.getAllLpRewardTokens();\r\n uint256 lpTokensLength = lpTokens.length;\r\n for (uint256 i = 0; i < lpTokensLength; i++) {\r\n uint256 ethValue = (s_userCumulativeAssetValues[_owner][lpTokens[i]] * _getEthPrice(lpTokens[i])) / PRECISION;\r\n totalValue += ethValue;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\r\n * function in the contract matches the call data.\r\n */\r\n fallback() external {\r\n address impl = veIONSecondExtension;\r\n require(impl != address(0), \"Implementation not set\");\r\n\r\n assembly {\r\n calldatacopy(0, 0, calldatasize())\r\n\r\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\r\n\r\n returndatacopy(0, 0, returndatasize())\r\n switch result\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/veION/veIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IVoter } from \"./interfaces/IVoter.sol\";\r\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\r\nimport { veIONStorage } from \"./veIONStorage.sol\";\r\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\r\nimport { IveIONSecondExtension } from \"./interfaces/IveIONSecondExtension.sol\";\r\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\r\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\r\n\r\n/**\r\n * @title veION Contract Second Extension\r\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract veIONSecondExtension is\r\n Ownable2StepUpgradeable,\r\n ERC721Upgradeable,\r\n ReentrancyGuardUpgradeable,\r\n veIONStorage,\r\n IveIONSecondExtension\r\n{\r\n using EnumerableSet for EnumerableSet.UintSet;\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n using SafeERC20 for IERC20;\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external onlyOwner {\r\n require(_tokens.length == _isWhitelisted.length, \"Unequal Arrays\");\r\n for (uint256 i; i < _tokens.length; i++) s_whitelistedToken[_tokens[i]] = _isWhitelisted[i];\r\n emit TokensWhitelisted(_tokens, _isWhitelisted);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external onlyOwner {\r\n LpTokenType lpType = s_lpType[_tokenAddress];\r\n uint256 protocolFees = s_protocolFees[lpType];\r\n require(protocolFees > 0, \"No protocol fees available\");\r\n s_protocolFees[lpType] = 0;\r\n IERC20(_tokenAddress).safeTransfer(_recipient, protocolFees);\r\n emit ProtocolFeesWithdrawn(_tokenAddress, _recipient, protocolFees);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external onlyOwner {\r\n LpTokenType lpType = s_lpType[_tokenAddress];\r\n uint256 distributedFees = s_distributedFees[lpType];\r\n require(distributedFees > 0, \"No distributed fees available\");\r\n s_distributedFees[lpType] = 0;\r\n IERC20(_tokenAddress).safeTransfer(_recipient, distributedFees);\r\n emit DistributedFeesWithdrawn(_tokenAddress, _recipient, distributedFees);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Setter Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function toggleSplit(address _account, bool _isAllowed) external onlyOwner {\r\n s_canSplit[_account] = _isAllowed;\r\n emit SplitToggle(_account, _isAllowed);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function toggleLimitedBoost(bool _isBoosted) external onlyOwner {\r\n s_limitedBoostActive = _isBoosted;\r\n emit LimitedBoostToggled(_isBoosted);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setLimitedTimeBoost(uint256 _boostAmount) external onlyOwner {\r\n if (_boostAmount <= 0) revert BoostAmountMustBeGreaterThanZero();\r\n s_limitedBoost = _boostAmount;\r\n emit LimitedTimeBoostSet(_boostAmount);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setVoter(address _voter) external onlyOwner {\r\n if (address(_voter) == address(0)) revert InvalidAddress();\r\n s_voter = _voter;\r\n emit VoterSet(_voter);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external onlyOwner {\r\n if (_minimumAmount <= 0) revert MinimumAmountMustBeGreaterThanZero();\r\n LpTokenType lpType = s_lpType[_tokenAddress];\r\n s_minimumLockAmount[lpType] = _minimumAmount;\r\n emit MinimumLockAmountSet(_tokenAddress, _minimumAmount);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setMinimumLockDuration(uint256 _minimumLockDuration) external onlyOwner {\r\n if (_minimumLockDuration <= 0) revert MinimumLockDurationMustBeGreaterThanZero();\r\n s_minimumLockDuration = _minimumLockDuration;\r\n emit MinimumLockDurationSet(_minimumLockDuration);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setIonicPool(address _ionicPool) external onlyOwner {\r\n if (address(_ionicPool) == address(0)) revert InvalidAddress();\r\n s_ionicPool = _ionicPool;\r\n emit IonicPoolSet(_ionicPool);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setAeroVoting(address _aeroVoting) external onlyOwner {\r\n if (address(_aeroVoting) == address(0)) revert InvalidAddress();\r\n s_aeroVoting = _aeroVoting;\r\n emit AeroVotingSet(_aeroVoting);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external onlyOwner {\r\n if (_aeroVoterBoost <= 0) revert AeroBoostAmountMustBeGreaterThanZero();\r\n s_aeroVoterBoost = _aeroVoterBoost;\r\n emit AeroVoterBoostSet(_aeroVoterBoost);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external onlyOwner {\r\n if (_maxEarlyWithdrawFee <= 0) revert MaxEarlyWithdrawFeeMustBeGreaterThanZero();\r\n s_maxEarlyWithdrawFee = _maxEarlyWithdrawFee;\r\n emit MaxEarlyWithdrawFeeSet(_maxEarlyWithdrawFee);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setLpTokenType(address _token, LpTokenType _type) external onlyOwner {\r\n if (_token == address(0)) revert InvalidTokenAddress();\r\n s_lpType[_token] = _type;\r\n emit LpTokenTypeSet(_token, _type);\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external onlyOwner {\r\n if (address(_strategy) == address(0)) revert InvalidStrategyAddress();\r\n s_stakeStrategy[_lpType] = IStakeStrategy(_strategy);\r\n emit StakeStrategySet(_lpType, address(_strategy));\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function setVeAERO(address _veAERO) external onlyOwner {\r\n if (_veAERO == address(0)) revert InvalidVeAEROAddress();\r\n s_veAERO = _veAERO;\r\n emit VeAEROSet(_veAERO);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ View Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory) {\r\n return s_locked[_tokenId][_lpType];\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory) {\r\n return s_ownerToTokenIds[_owner].values();\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory) {\r\n return s_assetsLocked[_tokenId].values();\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\r\n return s_delegatees[_tokenId][_lpType].values();\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\r\n return s_delegators[_tokenId][_lpType].values();\r\n }\r\n\r\n /// @inheritdoc IveIONSecondExtension\r\n function getUserPoint(\r\n uint256 _tokenId,\r\n LpTokenType _lpType,\r\n uint256 _epoch\r\n ) external view returns (UserPoint memory) {\r\n return s_userPointHistory[_tokenId][_lpType][_epoch];\r\n }\r\n}\r\n" + }, + "contracts/veION/veIONStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\r\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\r\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\nimport { IveIONStructsEnumsErrorsEvents } from \"./interfaces/IveIONStructsEnumsErrorsEvents.sol\";\r\n\r\nabstract contract veIONStorage is IveIONStructsEnumsErrorsEvents {\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Constants ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n /// @notice Represents the duration of one week in seconds.\r\n uint256 internal constant _WEEK = 1 weeks;\r\n /// @notice Represents the maximum lock time in seconds (2 years).\r\n uint256 internal constant _MAXTIME = 2 * 365 * 86400;\r\n /// @notice Precision used for calculations, set to 1e18.\r\n uint256 public constant PRECISION = 1e18;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ State Variables ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n /// @notice The current token ID counter.\r\n uint256 public s_tokenId;\r\n /// @notice The amount of limited boost available.\r\n uint256 public s_limitedBoost;\r\n /// @notice Indicates whether the limited boost is active.\r\n bool public s_limitedBoostActive;\r\n /// @notice Address of the veAERO contract.\r\n address public s_veAERO;\r\n /// @notice Address of the AeroVoting contract.\r\n address public s_aeroVoting;\r\n /// @notice Address of the Ionic Pool.\r\n address public s_ionicPool;\r\n /// @notice Address of the voter contract.\r\n address public s_voter;\r\n /// @notice The boost amount for AeroVoter.\r\n uint256 public s_aeroVoterBoost;\r\n /// @notice The minimum duration for locking.\r\n uint256 public s_minimumLockDuration;\r\n /// @notice The maximum fee for early withdrawal.\r\n uint256 public s_maxEarlyWithdrawFee;\r\n /// @notice The AddressesProvider contract used for address management.\r\n IAddressesProvider public ap;\r\n /// @notice The address of the logic contract for the veION first extension.\r\n address public veIONFirstExtension;\r\n /// @notice The address of the logic contract for the veION second extension.\r\n address public veIONSecondExtension;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Mappings ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n /// @dev Maps LP token types to their minimum lock amounts.\r\n mapping(LpTokenType => uint256) public s_minimumLockAmount;\r\n /// @dev Maps token addresses to their whitelist status.\r\n mapping(address => bool) public s_whitelistedToken;\r\n /// @dev Maps token addresses to their corresponding LP token types.\r\n mapping(address => LpTokenType) public s_lpType;\r\n /// @dev Maps user addresses to their ability to split.\r\n mapping(address => bool) public s_canSplit;\r\n /// @dev Maps token IDs and LP token types to their locked balances.\r\n mapping(uint256 => mapping(LpTokenType => LockedBalance)) public s_locked;\r\n /// @dev Maps token IDs and LP token types to user epochs.\r\n mapping(uint256 => mapping(LpTokenType => uint256)) public s_userPointEpoch;\r\n /// @dev Maps token IDs and LP token types to user point history.\r\n mapping(uint256 => mapping(LpTokenType => UserPoint[1000000000])) public s_userPointHistory;\r\n /// @dev Maps token IDs to sets of locked asset addresses.\r\n mapping(uint256 => EnumerableSet.AddressSet) internal s_assetsLocked;\r\n /// @dev Maps token IDs to their voting status.\r\n mapping(uint256 => bool) public s_voted;\r\n /// @dev Maps LP token types to their total supply.\r\n mapping(LpTokenType => uint256) public s_supply;\r\n /// @dev Maps LP token types to their permanent lock balances.\r\n mapping(LpTokenType => uint256) public s_permanentLockBalance;\r\n /// @dev Maps LP token types to their underlying stake strategies.\r\n mapping(LpTokenType => IStakeStrategy) public s_stakeStrategy;\r\n /// @dev Maps token IDs and LP token addresses to their underlying stake amounts.\r\n mapping(uint256 => mapping(address => uint256)) public s_underlyingStake;\r\n /// @dev Maps LP token types to their protocol fees.\r\n mapping(LpTokenType => uint256) public s_protocolFees;\r\n /// @dev Maps LP token types to their distributed fees.\r\n mapping(LpTokenType => uint256) public s_distributedFees;\r\n /// @dev Maps delegators, delegatees, and LP token types to delegation amounts.\r\n mapping(uint256 => mapping(uint256 => mapping(LpTokenType => uint256))) public s_delegations;\r\n /// @dev Maps token IDs and LP token types to sets of delegatees.\r\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegatees;\r\n /// @dev Maps token IDs and LP token types to sets of delegators.\r\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegators;\r\n /// @dev Maps owner addresses to sets of token IDs they own.\r\n mapping(address => EnumerableSet.UintSet) internal s_ownerToTokenIds;\r\n /// @dev Maps user addresses and token addresses to cumulative asset values.\r\n mapping(address => mapping(address => uint256)) public s_userCumulativeAssetValues;\r\n /// @dev Maps token Id and lp onto delegator permissioning.\r\n mapping(uint256 => mapping(address => bool)) public s_delegatorsBlocked;\r\n\r\n uint256[50] private __gap;\r\n}\r\n" + }, + "contracts/veION/Voter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\r\nimport { IVoter } from \"./interfaces/IVoter.sol\";\r\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\r\nimport { IveION } from \"./interfaces/IveION.sol\";\r\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\r\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\r\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\r\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\r\n\r\n/**\r\n * @title Voter Contract\r\n * @notice This contract allows veION holders to vote for various markets\r\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\r\n */\r\ncontract Voter is IVoter, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {\r\n using SafeERC20 for IERC20;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ State Variables ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n ///@notice The ve token that governs these contracts\r\n address public ve;\r\n ///@notice Base token of ve contract\r\n address internal rewardToken;\r\n ///@notice Standard OZ IGovernor using ve for vote weights\r\n address public governor;\r\n ///@notice Master Price Oracle instance\r\n MasterPriceOracle public mpo;\r\n ///@notice List of LP tokens\r\n address[] public lpTokens;\r\n ///@notice Total Voting Weights for each address\r\n mapping(address => uint256) public totalWeight;\r\n ///@notice Maximum number of markets one voter can vote for at once\r\n uint256 public maxVotingNum;\r\n ///@notice Minimum value for maxVotingNum\r\n uint256 internal constant MIN_MAXVOTINGNUM = 10;\r\n ///@notice All markets viable for incentives\r\n Market[] public markets;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Mappings ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n ///@notice Mapping from Reward Accumulator to Bribes Voting Reward\r\n mapping(address => address) public rewardAccumulatorToBribe;\r\n ///@notice Mapping from Market to Market Side to LP Asset to weights\r\n mapping(address => mapping(MarketSide => mapping(address => uint256))) public weights;\r\n ///@notice Mapping from NFT to Pool to LP Asset to Votes\r\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public votes;\r\n ///@notice Mapping from NFT to Pool to LP Asset to Base Weights\r\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public baseWeights;\r\n ///@notice Mapping from NFT to List of markets voted for by NFT\r\n mapping(uint256 => mapping(address => address[])) public marketVote;\r\n ///@notice Mapping from NFT to List of market vote sides voted for by NFT\r\n mapping(uint256 => mapping(address => MarketSide[])) public marketVoteSide;\r\n ///@notice Mapping from NFT to Total voting weight of NFT\r\n mapping(uint256 => mapping(address => uint256)) public usedWeights;\r\n ///@notice Mapping from NFT to Timestamp of last vote (ensures single vote per epoch)\r\n mapping(uint256 => uint256) public lastVoted;\r\n ///@notice Mapping from Token to Whitelisted status\r\n mapping(address => bool) public isWhitelistedToken;\r\n ///@notice Mapping from TokenId to Whitelisted status\r\n mapping(uint256 => bool) public isWhitelistedNFT;\r\n ///@notice Mapping from Reward Accumulator to Liveness status\r\n mapping(address => bool) public isAlive;\r\n ///@notice Mapping from Market to Market Side to Reward Accumulator\r\n mapping(address => mapping(MarketSide => address)) public marketToRewardAccumulators;\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Modifiers ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n /**\r\n * @notice Modifier to ensure that the function is called only in a new epoch since the last vote.\r\n * @dev Reverts if the current epoch start time is less than or equal to the last voted timestamp for the given token ID.\r\n * Also reverts if the current time is within the vote distribution window.\r\n * @param _tokenId The ID of the veNFT to check the last voted timestamp.\r\n */\r\n modifier onlyNewEpoch(uint256 _tokenId) {\r\n if (IonicTimeLibrary.epochStart(block.timestamp) <= lastVoted[_tokenId]) revert AlreadyVotedOrDeposited();\r\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Modifier to ensure that the function is called only by the governance address.\r\n * @dev Reverts if the caller is not the current governor.\r\n */\r\n modifier onlyGovernance() {\r\n if (msg.sender != governor) revert NotGovernor();\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n /**\r\n * @notice Initializes the Voter contract with the specified parameters.\r\n * @dev Requires initialization with at least one reward token.\r\n * @param _tokens An array of token addresses to be whitelisted.\r\n * @param _mpo The MasterPriceOracle contract address.\r\n * @param _rewardToken The address of the reward token.\r\n * @param _ve The address of the veION contract.\r\n * @custom:reverts TokensArrayEmpty if the _tokens array is empty.\r\n */\r\n function initialize(\r\n address[] calldata _tokens,\r\n MasterPriceOracle _mpo,\r\n address _rewardToken,\r\n address _ve\r\n ) external initializer {\r\n __Ownable2Step_init();\r\n __ReentrancyGuard_init();\r\n uint256 _length = _tokens.length;\r\n if (_length == 0) revert TokensArrayEmpty();\r\n for (uint256 i = 0; i < _length; i++) {\r\n _whitelistToken(_tokens[i], true);\r\n }\r\n mpo = _mpo;\r\n rewardToken = _rewardToken;\r\n ve = _ve;\r\n governor = msg.sender;\r\n\r\n emit Initialized(_tokens, address(_mpo), _rewardToken, _ve, governor);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ External Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IVoter\r\n function vote(\r\n uint256 _tokenId,\r\n address[] calldata _marketVote,\r\n MarketSide[] calldata _marketVoteSide,\r\n uint256[] calldata _weights\r\n ) external nonReentrant onlyNewEpoch(_tokenId) {\r\n VoteLocalVars memory vars;\r\n vars.sender = msg.sender;\r\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != vars.sender) revert NotOwner();\r\n if (\r\n _marketVote.length != _marketVoteSide.length ||\r\n _marketVoteSide.length != _weights.length ||\r\n _weights.length != _marketVote.length\r\n ) revert UnequalLengths();\r\n if (_marketVote.length > maxVotingNum) revert TooManyPools();\r\n vars.timestamp = block.timestamp;\r\n if ((vars.timestamp > IonicTimeLibrary.epochVoteEnd(vars.timestamp)) && !isWhitelistedNFT[_tokenId])\r\n revert NotWhitelistedNFT();\r\n uint256 totalVoteWeight = 0;\r\n\r\n for (uint256 i = 0; i < _marketVote.length; i++) {\r\n totalVoteWeight += _weights[i];\r\n }\r\n for (uint256 i = 0; i < lpTokens.length; i++) {\r\n _reset(_tokenId, lpTokens[i]);\r\n }\r\n\r\n lastVoted[_tokenId] = vars.timestamp;\r\n (vars.votingLPs, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(_tokenId);\r\n for (uint256 j = 0; j < vars.votingLPs.length; j++) {\r\n _vote(\r\n _tokenId,\r\n vars.votingLPs[j],\r\n (vars.votingLPBalances[j] * vars.boosts[j]) / 1e18,\r\n _marketVote,\r\n _marketVoteSide,\r\n _weights,\r\n totalVoteWeight\r\n );\r\n }\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function poke(uint256 _tokenId) external nonReentrant {\r\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\r\n (address[] memory _votingLPs, uint256[] memory _votingLPBalances, uint256[] memory _boosts) = IveION(ve)\r\n .balanceOfNFT(_tokenId);\r\n\r\n for (uint256 i = 0; i < _votingLPs.length; i++) {\r\n uint256 effectiveBalance = (_votingLPBalances[i] * _boosts[i]) / 1e18;\r\n _poke(_tokenId, lpTokens[i], effectiveBalance);\r\n }\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function reset(uint256 _tokenId) public nonReentrant onlyNewEpoch(_tokenId) {\r\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != msg.sender) revert NotOwner();\r\n for (uint256 i = 0; i < lpTokens.length; i++) {\r\n _reset(_tokenId, lpTokens[i]);\r\n }\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external nonReentrant {\r\n if (_bribes.length != _tokens.length) revert UnequalLengths();\r\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != _msgSender()) revert NotOwner();\r\n uint256 _length = _bribes.length;\r\n for (uint256 i = 0; i < _length; i++) {\r\n IBribeRewards(_bribes[i]).getReward(_tokenId, _tokens[i]);\r\n }\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Admin External Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IVoter\r\n function distributeRewards() external onlyGovernance {\r\n if (block.timestamp <= IonicTimeLibrary.epochVoteEnd(block.timestamp)) revert NotDistributeWindow();\r\n uint256 _reward = IERC20(rewardToken).balanceOf(address(this));\r\n uint256 _totalLPValueETH = _calculateTotalLPValue();\r\n for (uint256 i = 0; i < markets.length; i++) {\r\n uint256 _marketWeightETH = _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\r\n if (_marketWeightETH > 0) {\r\n IERC20(rewardToken).safeTransfer(\r\n marketToRewardAccumulators[markets[i].marketAddress][markets[i].side],\r\n (_reward * _marketWeightETH) / _totalLPValueETH\r\n );\r\n }\r\n }\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function whitelistToken(address _token, bool _bool) external onlyGovernance {\r\n _whitelistToken(_token, _bool);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function whitelistNFT(uint256 _tokenId, bool _bool) external onlyGovernance {\r\n address _sender = msg.sender;\r\n isWhitelistedNFT[_tokenId] = _bool;\r\n emit WhitelistNFT(_sender, _tokenId, _bool);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Internal Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /**\r\n * @notice Internal function to handle voting logic for a given token ID and voting asset.\r\n * @param _tokenId The ID of the token used for voting.\r\n * @param _votingAsset The address of the asset being used for voting.\r\n * @param _votingAssetBalance The balance of the voting asset.\r\n * @param _marketVote An array of market addresses to vote for.\r\n * @param _marketVoteSide An array of market sides corresponding to the markets.\r\n * @param _weights An array of weights for each market.\r\n * @param totalVoteWeight The total weight of the vote.\r\n */\r\n function _vote(\r\n uint256 _tokenId,\r\n address _votingAsset,\r\n uint256 _votingAssetBalance,\r\n address[] memory _marketVote,\r\n MarketSide[] memory _marketVoteSide,\r\n uint256[] memory _weights,\r\n uint256 totalVoteWeight\r\n ) internal {\r\n VoteVars memory vars;\r\n uint256 marketVoteLength = _marketVote.length;\r\n for (uint256 i = 0; i < marketVoteLength; i++) {\r\n vars.market = _marketVote[i];\r\n vars.marketSide = _marketVoteSide[i];\r\n vars.rewardAccumulator = marketToRewardAccumulators[vars.market][vars.marketSide];\r\n vars.bribes = rewardAccumulatorToBribe[vars.rewardAccumulator];\r\n if (_weights[i] == 0) revert ZeroWeight();\r\n if (vars.rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(vars.market);\r\n if (!isAlive[vars.rewardAccumulator]) revert RewardAccumulatorNotAlive(vars.rewardAccumulator);\r\n\r\n vars.marketWeight = (_weights[i] * _votingAssetBalance) / totalVoteWeight;\r\n if (votes[_tokenId][vars.market][vars.marketSide][_votingAsset] != 0) revert NonZeroVotes();\r\n\r\n marketVote[_tokenId][_votingAsset].push(vars.market);\r\n marketVoteSide[_tokenId][_votingAsset].push(vars.marketSide);\r\n\r\n weights[vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\r\n votes[_tokenId][vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\r\n baseWeights[_tokenId][vars.market][vars.marketSide][_votingAsset] = _weights[i];\r\n IBribeRewards(vars.bribes).deposit(_votingAsset, uint256(vars.marketWeight), _tokenId);\r\n vars.usedWeight += vars.marketWeight;\r\n vars.totalWeight += vars.marketWeight;\r\n emit Voted(\r\n msg.sender,\r\n vars.market,\r\n _tokenId,\r\n vars.marketWeight,\r\n weights[vars.market][vars.marketSide][_votingAsset],\r\n block.timestamp\r\n );\r\n }\r\n IveION(ve).voting(_tokenId, true);\r\n totalWeight[_votingAsset] += uint256(vars.totalWeight);\r\n usedWeights[_tokenId][_votingAsset] = uint256(vars.usedWeight);\r\n }\r\n\r\n /**\r\n * @notice Internal function to update voting balances for a given token ID and voting asset.\r\n * @param _tokenId The ID of the token whose voting balance is being updated.\r\n * @param _votingAsset The address of the asset being used for voting.\r\n * @param _votingAssetBalance The balance of the voting asset.\r\n */\r\n function _poke(uint256 _tokenId, address _votingAsset, uint256 _votingAssetBalance) internal {\r\n address[] memory _marketVote = marketVote[_tokenId][_votingAsset];\r\n MarketSide[] memory _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\r\n uint256 _marketCnt = _marketVote.length;\r\n uint256[] memory _weights = new uint256[](_marketCnt);\r\n uint256 totalVoteWeight = 0;\r\n\r\n for (uint256 i = 0; i < _marketCnt; i++) {\r\n _weights[i] = baseWeights[_tokenId][_marketVote[i]][_marketVoteSide[i]][_votingAsset];\r\n }\r\n\r\n for (uint256 i = 0; i < _marketVote.length; i++) {\r\n totalVoteWeight += _weights[i];\r\n }\r\n\r\n _reset(_tokenId, _votingAsset);\r\n _vote(_tokenId, _votingAsset, _votingAssetBalance, _marketVote, _marketVoteSide, _weights, totalVoteWeight);\r\n }\r\n\r\n /**\r\n * @notice Internal function to reset voting state for a given token ID and voting asset.\r\n * @param _tokenId The ID of the token whose voting state is being reset.\r\n * @param _votingAsset The address of the asset being used for voting.\r\n */\r\n function _reset(uint256 _tokenId, address _votingAsset) internal {\r\n address[] storage _marketVote = marketVote[_tokenId][_votingAsset];\r\n MarketSide[] storage _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\r\n uint256 _marketVoteCnt = _marketVote.length;\r\n\r\n for (uint256 i = 0; i < _marketVoteCnt; i++) {\r\n address _market = _marketVote[i];\r\n MarketSide _marketSide = _marketVoteSide[i];\r\n\r\n uint256 _votes = votes[_tokenId][_market][_marketSide][_votingAsset];\r\n if (_votes != 0) {\r\n weights[_market][_marketSide][_votingAsset] -= _votes;\r\n delete votes[_tokenId][_market][_marketSide][_votingAsset];\r\n IBribeRewards(rewardAccumulatorToBribe[marketToRewardAccumulators[_market][_marketSide]]).withdraw(\r\n _votingAsset,\r\n uint256(_votes),\r\n _tokenId\r\n );\r\n totalWeight[_votingAsset] -= _votes;\r\n emit Abstained(\r\n msg.sender,\r\n _market,\r\n _tokenId,\r\n _votes,\r\n weights[_market][_marketSide][_votingAsset],\r\n block.timestamp\r\n );\r\n }\r\n }\r\n usedWeights[_tokenId][_votingAsset] = 0;\r\n delete marketVote[_tokenId][_votingAsset];\r\n delete marketVoteSide[_tokenId][_votingAsset];\r\n IveION(ve).voting(_tokenId, false);\r\n }\r\n\r\n /**\r\n * @notice Internal function to whitelist or unwhitelist a token for use in bribes.\r\n * @param _token The address of the token to be whitelisted or unwhitelisted.\r\n * @param _bool Boolean indicating whether to whitelist (true) or unwhitelist (false) the token.\r\n */\r\n function _whitelistToken(address _token, bool _bool) internal {\r\n isWhitelistedToken[_token] = _bool;\r\n emit WhitelistToken(msg.sender, _token, _bool);\r\n }\r\n\r\n /**\r\n * @notice Internal function to calculate the ETH value of a given amount of LP tokens.\r\n * @param amount The amount of LP tokens.\r\n * @param lpToken The address of the LP token.\r\n * @return The ETH value of the given amount of LP tokens.\r\n */\r\n function _getTokenEthValue(uint256 amount, address lpToken) internal view returns (uint256) {\r\n uint256 tokenPriceInEth = mpo.price(lpToken); // Fetch price of 1 lpToken in ETH\r\n uint256 ethValue = amount * tokenPriceInEth;\r\n return ethValue;\r\n }\r\n\r\n /**\r\n * @notice Internal function to calculate the total ETH value of all LP tokens in the markets.\r\n * @return _totalLPValueETH The total ETH value of all LP tokens.\r\n */\r\n function _calculateTotalLPValue() internal view returns (uint256 _totalLPValueETH) {\r\n uint256 marketLength = markets.length;\r\n for (uint256 i = 0; i < marketLength; i++)\r\n _totalLPValueETH += _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\r\n }\r\n\r\n /**\r\n * @notice Internal function to calculate the ETH value of LP tokens for a specific market.\r\n * @param _market The address of the market.\r\n * @param _marketSide The side of the market.\r\n * @return _marketLPValueETH The ETH value of LP tokens for the specified market.\r\n */\r\n function _calculateMarketLPValue(\r\n address _market,\r\n MarketSide _marketSide\r\n ) internal view returns (uint256 _marketLPValueETH) {\r\n uint256 lpTokensLength = lpTokens.length;\r\n for (uint256 i = 0; i < lpTokensLength; i++) {\r\n uint256 _lpAmount = weights[_market][_marketSide][lpTokens[i]];\r\n uint256 tokenEthValue = _getTokenEthValue(_lpAmount, lpTokens[i]);\r\n _marketLPValueETH += tokenEthValue;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Internal function to check if a market exists.\r\n * @param _marketAddress The address of the market.\r\n * @param _marketSide The side of the market.\r\n * @return True if the market exists, false otherwise.\r\n */\r\n function _marketExists(address _marketAddress, MarketSide _marketSide) internal view returns (bool) {\r\n uint256 marketLength = markets.length;\r\n for (uint256 j = 0; j < marketLength; j++) {\r\n if (markets[j].marketAddress == _marketAddress && markets[j].side == _marketSide) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Setter Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IVoter\r\n function setLpTokens(address[] memory _lpTokens) external onlyOwner {\r\n require(_lpTokens.length != 0, \"LpTokens array cannot be empty\");\r\n lpTokens = _lpTokens;\r\n emit LpTokensSet(_lpTokens);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function setMpo(address _mpo) external onlyOwner {\r\n if (_mpo == address(0)) revert ZeroAddress();\r\n mpo = MasterPriceOracle(_mpo);\r\n emit MpoSet(_mpo);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function setGovernor(address _governor) public onlyOwner {\r\n if (_governor == address(0)) revert ZeroAddress();\r\n governor = _governor;\r\n emit GovernorSet(_governor);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function addMarkets(Market[] calldata _markets) external onlyGovernance {\r\n for (uint256 i = 0; i < _markets.length; i++) {\r\n Market memory newMarket = _markets[i];\r\n if (_marketExists(newMarket.marketAddress, newMarket.side)) revert MarketAlreadyExists();\r\n markets.push(newMarket);\r\n }\r\n emit MarketsAdded(_markets);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function setMarketRewardAccumulators(\r\n address[] calldata _markets,\r\n MarketSide[] calldata _marketSides,\r\n address[] calldata _rewardAccumulators\r\n ) external onlyGovernance {\r\n uint256 _length = _markets.length;\r\n if (_marketSides.length != _length) revert MismatchedArrayLengths();\r\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\r\n for (uint256 i = 0; i < _length; i++) {\r\n marketToRewardAccumulators[_markets[i]][_marketSides[i]] = _rewardAccumulators[i];\r\n isAlive[_rewardAccumulators[i]] = true;\r\n }\r\n emit MarketRewardAccumulatorsSet(_markets, _marketSides, _rewardAccumulators);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external onlyGovernance {\r\n uint256 _length = _bribes.length;\r\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\r\n for (uint256 i = 0; i < _length; i++) {\r\n rewardAccumulatorToBribe[_rewardAccumulators[i]] = _bribes[i];\r\n }\r\n emit BribesSet(_rewardAccumulators, _bribes);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function setMaxVotingNum(uint256 _maxVotingNum) external onlyGovernance {\r\n if (_maxVotingNum < MIN_MAXVOTINGNUM) revert MaximumVotingNumberTooLow();\r\n if (_maxVotingNum == maxVotingNum) revert SameValue();\r\n maxVotingNum = _maxVotingNum;\r\n emit MaxVotingNumSet(_maxVotingNum);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function toggleRewardAccumulatorAlive(\r\n address _market,\r\n MarketSide _marketSide,\r\n bool _isAlive\r\n ) external onlyGovernance {\r\n address _rewardAccumulator = marketToRewardAccumulators[_market][_marketSide];\r\n if (_rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(_market);\r\n isAlive[_rewardAccumulator] = _isAlive;\r\n emit RewardAccumulatorAliveToggled(_market, _marketSide, _isAlive);\r\n }\r\n\r\n // ╔═══════════════════════════════════════════════════════════════════════════╗\r\n // ║ Pure/View Functions ║\r\n // ╚═══════════════════════════════════════════════════════════════════════════╝\r\n\r\n /// @inheritdoc IVoter\r\n function epochStart(uint256 _timestamp) external pure returns (uint256) {\r\n return IonicTimeLibrary.epochStart(_timestamp);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function epochNext(uint256 _timestamp) external pure returns (uint256) {\r\n return IonicTimeLibrary.epochNext(_timestamp);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256) {\r\n return IonicTimeLibrary.epochVoteStart(_timestamp);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256) {\r\n return IonicTimeLibrary.epochVoteEnd(_timestamp);\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function marketsLength() external view returns (uint256) {\r\n return markets.length;\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function getAllLpRewardTokens() external view returns (address[] memory) {\r\n return lpTokens;\r\n }\r\n\r\n /// @inheritdoc IVoter\r\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory) {\r\n uint256 length = marketVote[_tokenId][_lpAsset].length;\r\n address[] memory _marketVotes = new address[](length);\r\n MarketSide[] memory _marketVoteSides = new MarketSide[](length);\r\n uint256[] memory _votes = new uint256[](length);\r\n\r\n for (uint256 i = 0; i < length; i++) {\r\n _marketVotes[i] = marketVote[_tokenId][_lpAsset][i];\r\n _marketVoteSides[i] = marketVoteSide[_tokenId][_lpAsset][i];\r\n _votes[i] = votes[_tokenId][_marketVotes[i]][_marketVoteSides[i]][_lpAsset];\r\n }\r\n\r\n uint256 _usedWeight = usedWeights[_tokenId][_lpAsset];\r\n\r\n return\r\n VoteDetails({\r\n marketVotes: _marketVotes,\r\n marketVoteSides: _marketVoteSides,\r\n votes: _votes,\r\n usedWeight: _usedWeight\r\n });\r\n }\r\n}\r\n" + }, + "ds-test/test.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\r\n\r\n// This program is free software: you can redistribute it and/or modify\r\n// it under the terms of the GNU General Public License as published by\r\n// the Free Software Foundation, either version 3 of the License, or\r\n// (at your option) any later version.\r\n\r\n// This program is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n// GNU General Public License for more details.\r\n\r\n// You should have received a copy of the GNU General Public License\r\n// along with this program. If not, see .\r\n\r\npragma solidity >=0.5.0;\r\n\r\ncontract DSTest {\r\n event log (string);\r\n event logs (bytes);\r\n\r\n event log_address (address);\r\n event log_bytes32 (bytes32);\r\n event log_int (int);\r\n event log_uint (uint);\r\n event log_bytes (bytes);\r\n event log_string (string);\r\n\r\n event log_named_address (string key, address val);\r\n event log_named_bytes32 (string key, bytes32 val);\r\n event log_named_decimal_int (string key, int val, uint decimals);\r\n event log_named_decimal_uint (string key, uint val, uint decimals);\r\n event log_named_int (string key, int val);\r\n event log_named_uint (string key, uint val);\r\n event log_named_bytes (string key, bytes val);\r\n event log_named_string (string key, string val);\r\n\r\n bool public IS_TEST = true;\r\n bool private _failed;\r\n\r\n address constant HEVM_ADDRESS =\r\n address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));\r\n\r\n modifier mayRevert() { _; }\r\n modifier testopts(string memory) { _; }\r\n\r\n function failed() public returns (bool) {\r\n if (_failed) {\r\n return _failed;\r\n } else {\r\n bool globalFailed = false;\r\n if (hasHEVMContext()) {\r\n (, bytes memory retdata) = HEVM_ADDRESS.call(\r\n abi.encodePacked(\r\n bytes4(keccak256(\"load(address,bytes32)\")),\r\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"))\r\n )\r\n );\r\n globalFailed = abi.decode(retdata, (bool));\r\n }\r\n return globalFailed;\r\n }\r\n }\r\n\r\n function fail() internal virtual {\r\n if (hasHEVMContext()) {\r\n (bool status, ) = HEVM_ADDRESS.call(\r\n abi.encodePacked(\r\n bytes4(keccak256(\"store(address,bytes32,bytes32)\")),\r\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"), bytes32(uint256(0x01)))\r\n )\r\n );\r\n status; // Silence compiler warnings\r\n }\r\n _failed = true;\r\n }\r\n\r\n function hasHEVMContext() internal view returns (bool) {\r\n uint256 hevmCodeSize = 0;\r\n assembly {\r\n hevmCodeSize := extcodesize(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D)\r\n }\r\n return hevmCodeSize > 0;\r\n }\r\n\r\n modifier logs_gas() {\r\n uint startGas = gasleft();\r\n _;\r\n uint endGas = gasleft();\r\n emit log_named_uint(\"gas\", startGas - endGas);\r\n }\r\n\r\n function assertTrue(bool condition) internal {\r\n if (!condition) {\r\n emit log(\"Error: Assertion Failed\");\r\n fail();\r\n }\r\n }\r\n\r\n function assertTrue(bool condition, string memory err) internal {\r\n if (!condition) {\r\n emit log_named_string(\"Error\", err);\r\n assertTrue(condition);\r\n }\r\n }\r\n\r\n function assertEq(address a, address b) internal {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [address]\");\r\n emit log_named_address(\" Left\", a);\r\n emit log_named_address(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n function assertEq(address a, address b, string memory err) internal {\r\n if (a != b) {\r\n emit log_named_string (\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n\r\n function assertEq(bytes32 a, bytes32 b) internal {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [bytes32]\");\r\n emit log_named_bytes32(\" Left\", a);\r\n emit log_named_bytes32(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n function assertEq(bytes32 a, bytes32 b, string memory err) internal {\r\n if (a != b) {\r\n emit log_named_string (\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n function assertEq32(bytes32 a, bytes32 b) internal {\r\n assertEq(a, b);\r\n }\r\n function assertEq32(bytes32 a, bytes32 b, string memory err) internal {\r\n assertEq(a, b, err);\r\n }\r\n\r\n function assertEq(int a, int b) internal {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [int]\");\r\n emit log_named_int(\" Left\", a);\r\n emit log_named_int(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n function assertEq(int a, int b, string memory err) internal {\r\n if (a != b) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n function assertEq(uint a, uint b) internal {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [uint]\");\r\n emit log_named_uint(\" Left\", a);\r\n emit log_named_uint(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n function assertEq(uint a, uint b, string memory err) internal {\r\n if (a != b) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n function assertEqDecimal(int a, int b, uint decimals) internal {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [decimal int]\");\r\n emit log_named_decimal_int(\" Left\", a, decimals);\r\n emit log_named_decimal_int(\" Right\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertEqDecimal(int a, int b, uint decimals, string memory err) internal {\r\n if (a != b) {\r\n emit log_named_string(\"Error\", err);\r\n assertEqDecimal(a, b, decimals);\r\n }\r\n }\r\n function assertEqDecimal(uint a, uint b, uint decimals) internal {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [decimal uint]\");\r\n emit log_named_decimal_uint(\" Left\", a, decimals);\r\n emit log_named_decimal_uint(\" Right\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertEqDecimal(uint a, uint b, uint decimals, string memory err) internal {\r\n if (a != b) {\r\n emit log_named_string(\"Error\", err);\r\n assertEqDecimal(a, b, decimals);\r\n }\r\n }\r\n\r\n function assertGt(uint a, uint b) internal {\r\n if (a <= b) {\r\n emit log(\"Error: a > b not satisfied [uint]\");\r\n emit log_named_uint(\" Value a\", a);\r\n emit log_named_uint(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertGt(uint a, uint b, string memory err) internal {\r\n if (a <= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGt(a, b);\r\n }\r\n }\r\n function assertGt(int a, int b) internal {\r\n if (a <= b) {\r\n emit log(\"Error: a > b not satisfied [int]\");\r\n emit log_named_int(\" Value a\", a);\r\n emit log_named_int(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertGt(int a, int b, string memory err) internal {\r\n if (a <= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGt(a, b);\r\n }\r\n }\r\n function assertGtDecimal(int a, int b, uint decimals) internal {\r\n if (a <= b) {\r\n emit log(\"Error: a > b not satisfied [decimal int]\");\r\n emit log_named_decimal_int(\" Value a\", a, decimals);\r\n emit log_named_decimal_int(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertGtDecimal(int a, int b, uint decimals, string memory err) internal {\r\n if (a <= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGtDecimal(a, b, decimals);\r\n }\r\n }\r\n function assertGtDecimal(uint a, uint b, uint decimals) internal {\r\n if (a <= b) {\r\n emit log(\"Error: a > b not satisfied [decimal uint]\");\r\n emit log_named_decimal_uint(\" Value a\", a, decimals);\r\n emit log_named_decimal_uint(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertGtDecimal(uint a, uint b, uint decimals, string memory err) internal {\r\n if (a <= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGtDecimal(a, b, decimals);\r\n }\r\n }\r\n\r\n function assertGe(uint a, uint b) internal {\r\n if (a < b) {\r\n emit log(\"Error: a >= b not satisfied [uint]\");\r\n emit log_named_uint(\" Value a\", a);\r\n emit log_named_uint(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertGe(uint a, uint b, string memory err) internal {\r\n if (a < b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGe(a, b);\r\n }\r\n }\r\n function assertGe(int a, int b) internal {\r\n if (a < b) {\r\n emit log(\"Error: a >= b not satisfied [int]\");\r\n emit log_named_int(\" Value a\", a);\r\n emit log_named_int(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertGe(int a, int b, string memory err) internal {\r\n if (a < b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGe(a, b);\r\n }\r\n }\r\n function assertGeDecimal(int a, int b, uint decimals) internal {\r\n if (a < b) {\r\n emit log(\"Error: a >= b not satisfied [decimal int]\");\r\n emit log_named_decimal_int(\" Value a\", a, decimals);\r\n emit log_named_decimal_int(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertGeDecimal(int a, int b, uint decimals, string memory err) internal {\r\n if (a < b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGeDecimal(a, b, decimals);\r\n }\r\n }\r\n function assertGeDecimal(uint a, uint b, uint decimals) internal {\r\n if (a < b) {\r\n emit log(\"Error: a >= b not satisfied [decimal uint]\");\r\n emit log_named_decimal_uint(\" Value a\", a, decimals);\r\n emit log_named_decimal_uint(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertGeDecimal(uint a, uint b, uint decimals, string memory err) internal {\r\n if (a < b) {\r\n emit log_named_string(\"Error\", err);\r\n assertGeDecimal(a, b, decimals);\r\n }\r\n }\r\n\r\n function assertLt(uint a, uint b) internal {\r\n if (a >= b) {\r\n emit log(\"Error: a < b not satisfied [uint]\");\r\n emit log_named_uint(\" Value a\", a);\r\n emit log_named_uint(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertLt(uint a, uint b, string memory err) internal {\r\n if (a >= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLt(a, b);\r\n }\r\n }\r\n function assertLt(int a, int b) internal {\r\n if (a >= b) {\r\n emit log(\"Error: a < b not satisfied [int]\");\r\n emit log_named_int(\" Value a\", a);\r\n emit log_named_int(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertLt(int a, int b, string memory err) internal {\r\n if (a >= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLt(a, b);\r\n }\r\n }\r\n function assertLtDecimal(int a, int b, uint decimals) internal {\r\n if (a >= b) {\r\n emit log(\"Error: a < b not satisfied [decimal int]\");\r\n emit log_named_decimal_int(\" Value a\", a, decimals);\r\n emit log_named_decimal_int(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertLtDecimal(int a, int b, uint decimals, string memory err) internal {\r\n if (a >= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLtDecimal(a, b, decimals);\r\n }\r\n }\r\n function assertLtDecimal(uint a, uint b, uint decimals) internal {\r\n if (a >= b) {\r\n emit log(\"Error: a < b not satisfied [decimal uint]\");\r\n emit log_named_decimal_uint(\" Value a\", a, decimals);\r\n emit log_named_decimal_uint(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertLtDecimal(uint a, uint b, uint decimals, string memory err) internal {\r\n if (a >= b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLtDecimal(a, b, decimals);\r\n }\r\n }\r\n\r\n function assertLe(uint a, uint b) internal {\r\n if (a > b) {\r\n emit log(\"Error: a <= b not satisfied [uint]\");\r\n emit log_named_uint(\" Value a\", a);\r\n emit log_named_uint(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertLe(uint a, uint b, string memory err) internal {\r\n if (a > b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLe(a, b);\r\n }\r\n }\r\n function assertLe(int a, int b) internal {\r\n if (a > b) {\r\n emit log(\"Error: a <= b not satisfied [int]\");\r\n emit log_named_int(\" Value a\", a);\r\n emit log_named_int(\" Value b\", b);\r\n fail();\r\n }\r\n }\r\n function assertLe(int a, int b, string memory err) internal {\r\n if (a > b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLe(a, b);\r\n }\r\n }\r\n function assertLeDecimal(int a, int b, uint decimals) internal {\r\n if (a > b) {\r\n emit log(\"Error: a <= b not satisfied [decimal int]\");\r\n emit log_named_decimal_int(\" Value a\", a, decimals);\r\n emit log_named_decimal_int(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertLeDecimal(int a, int b, uint decimals, string memory err) internal {\r\n if (a > b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLeDecimal(a, b, decimals);\r\n }\r\n }\r\n function assertLeDecimal(uint a, uint b, uint decimals) internal {\r\n if (a > b) {\r\n emit log(\"Error: a <= b not satisfied [decimal uint]\");\r\n emit log_named_decimal_uint(\" Value a\", a, decimals);\r\n emit log_named_decimal_uint(\" Value b\", b, decimals);\r\n fail();\r\n }\r\n }\r\n function assertLeDecimal(uint a, uint b, uint decimals, string memory err) internal {\r\n if (a > b) {\r\n emit log_named_string(\"Error\", err);\r\n assertLeDecimal(a, b, decimals);\r\n }\r\n }\r\n\r\n function assertEq(string memory a, string memory b) internal {\r\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\r\n emit log(\"Error: a == b not satisfied [string]\");\r\n emit log_named_string(\" Left\", a);\r\n emit log_named_string(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n function assertEq(string memory a, string memory b, string memory err) internal {\r\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n\r\n function checkEq0(bytes memory a, bytes memory b) internal pure returns (bool ok) {\r\n ok = true;\r\n if (a.length == b.length) {\r\n for (uint i = 0; i < a.length; i++) {\r\n if (a[i] != b[i]) {\r\n ok = false;\r\n }\r\n }\r\n } else {\r\n ok = false;\r\n }\r\n }\r\n function assertEq0(bytes memory a, bytes memory b) internal {\r\n if (!checkEq0(a, b)) {\r\n emit log(\"Error: a == b not satisfied [bytes]\");\r\n emit log_named_bytes(\" Left\", a);\r\n emit log_named_bytes(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n function assertEq0(bytes memory a, bytes memory b, string memory err) internal {\r\n if (!checkEq0(a, b)) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq0(a, b);\r\n }\r\n }\r\n}\r\n" + }, + "forge-std/Base.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\nimport {StdStorage} from \"./StdStorage.sol\";\r\nimport {Vm, VmSafe} from \"./Vm.sol\";\r\n\r\nabstract contract CommonBase {\r\n // Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.\r\n address internal constant VM_ADDRESS = address(uint160(uint256(keccak256(\"hevm cheat code\"))));\r\n // console.sol and console2.sol work by executing a staticcall to this address.\r\n address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67;\r\n // Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38.\r\n address internal constant DEFAULT_SENDER = address(uint160(uint256(keccak256(\"foundry default caller\"))));\r\n // Address of the test contract, deployed by the DEFAULT_SENDER.\r\n address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f;\r\n // Deterministic deployment address of the Multicall3 contract.\r\n address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11;\r\n\r\n uint256 internal constant UINT256_MAX =\r\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\r\n\r\n Vm internal constant vm = Vm(VM_ADDRESS);\r\n StdStorage internal stdstore;\r\n}\r\n\r\nabstract contract TestBase is CommonBase {}\r\n\r\nabstract contract ScriptBase is CommonBase {\r\n // Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\r\n address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\r\n\r\n VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS);\r\n}\r\n" + }, + "forge-std/console.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.4.22 <0.9.0;\r\n\r\nlibrary console {\r\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\r\n\r\n function _sendLogPayload(bytes memory payload) private view {\r\n uint256 payloadLength = payload.length;\r\n address consoleAddress = CONSOLE_ADDRESS;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let payloadStart := add(payload, 32)\r\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\r\n }\r\n }\r\n\r\n function log() internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\r\n }\r\n\r\n function logInt(int p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(int)\", p0));\r\n }\r\n\r\n function logUint(uint p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\r\n }\r\n\r\n function logString(string memory p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\r\n }\r\n\r\n function logBool(bool p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\r\n }\r\n\r\n function logAddress(address p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\r\n }\r\n\r\n function logBytes(bytes memory p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\r\n }\r\n\r\n function logBytes1(bytes1 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\r\n }\r\n\r\n function logBytes2(bytes2 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\r\n }\r\n\r\n function logBytes3(bytes3 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\r\n }\r\n\r\n function logBytes4(bytes4 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\r\n }\r\n\r\n function logBytes5(bytes5 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\r\n }\r\n\r\n function logBytes6(bytes6 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\r\n }\r\n\r\n function logBytes7(bytes7 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\r\n }\r\n\r\n function logBytes8(bytes8 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\r\n }\r\n\r\n function logBytes9(bytes9 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\r\n }\r\n\r\n function logBytes10(bytes10 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\r\n }\r\n\r\n function logBytes11(bytes11 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\r\n }\r\n\r\n function logBytes12(bytes12 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\r\n }\r\n\r\n function logBytes13(bytes13 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\r\n }\r\n\r\n function logBytes14(bytes14 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\r\n }\r\n\r\n function logBytes15(bytes15 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\r\n }\r\n\r\n function logBytes16(bytes16 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\r\n }\r\n\r\n function logBytes17(bytes17 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\r\n }\r\n\r\n function logBytes18(bytes18 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\r\n }\r\n\r\n function logBytes19(bytes19 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\r\n }\r\n\r\n function logBytes20(bytes20 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\r\n }\r\n\r\n function logBytes21(bytes21 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\r\n }\r\n\r\n function logBytes22(bytes22 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\r\n }\r\n\r\n function logBytes23(bytes23 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\r\n }\r\n\r\n function logBytes24(bytes24 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\r\n }\r\n\r\n function logBytes25(bytes25 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\r\n }\r\n\r\n function logBytes26(bytes26 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\r\n }\r\n\r\n function logBytes27(bytes27 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\r\n }\r\n\r\n function logBytes28(bytes28 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\r\n }\r\n\r\n function logBytes29(bytes29 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\r\n }\r\n\r\n function logBytes30(bytes30 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\r\n }\r\n\r\n function logBytes31(bytes31 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\r\n }\r\n\r\n function logBytes32(bytes32 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\r\n }\r\n\r\n function log(uint p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\r\n }\r\n\r\n function log(string memory p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\r\n }\r\n\r\n function log(bool p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\r\n }\r\n\r\n function log(address p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\r\n }\r\n\r\n function log(uint p0, uint p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint)\", p0, p1));\r\n }\r\n\r\n function log(uint p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string)\", p0, p1));\r\n }\r\n\r\n function log(uint p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool)\", p0, p1));\r\n }\r\n\r\n function log(uint p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, uint p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, uint p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\r\n }\r\n\r\n function log(address p0, uint p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint)\", p0, p1));\r\n }\r\n\r\n function log(address p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\r\n }\r\n\r\n function log(address p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\r\n }\r\n\r\n function log(address p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\r\n }\r\n\r\n function log(uint p0, uint p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, uint p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, uint p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, uint p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, string memory p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, bool p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, address p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, uint p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint p0, uint p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, uint p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, uint p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n}" + }, + "forge-std/console2.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.4.22 <0.9.0;\r\n\r\n/// @dev The original console.sol uses `int` and `uint` for computing function selectors, but it should\r\n/// use `int256` and `uint256`. This modified version fixes that. This version is recommended\r\n/// over `console.sol` if you don't need compatibility with Hardhat as the logs will show up in\r\n/// forge stack traces. If you do need compatibility with Hardhat, you must use `console.sol`.\r\n/// Reference: https://github.com/NomicFoundation/hardhat/issues/2178\r\nlibrary console2 {\r\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\r\n\r\n function _sendLogPayload(bytes memory payload) private view {\r\n uint256 payloadLength = payload.length;\r\n address consoleAddress = CONSOLE_ADDRESS;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let payloadStart := add(payload, 32)\r\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\r\n }\r\n }\r\n\r\n function log() internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\r\n }\r\n\r\n function logInt(int256 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\r\n }\r\n\r\n function logUint(uint256 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\r\n }\r\n\r\n function logString(string memory p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\r\n }\r\n\r\n function logBool(bool p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\r\n }\r\n\r\n function logAddress(address p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\r\n }\r\n\r\n function logBytes(bytes memory p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\r\n }\r\n\r\n function logBytes1(bytes1 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\r\n }\r\n\r\n function logBytes2(bytes2 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\r\n }\r\n\r\n function logBytes3(bytes3 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\r\n }\r\n\r\n function logBytes4(bytes4 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\r\n }\r\n\r\n function logBytes5(bytes5 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\r\n }\r\n\r\n function logBytes6(bytes6 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\r\n }\r\n\r\n function logBytes7(bytes7 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\r\n }\r\n\r\n function logBytes8(bytes8 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\r\n }\r\n\r\n function logBytes9(bytes9 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\r\n }\r\n\r\n function logBytes10(bytes10 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\r\n }\r\n\r\n function logBytes11(bytes11 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\r\n }\r\n\r\n function logBytes12(bytes12 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\r\n }\r\n\r\n function logBytes13(bytes13 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\r\n }\r\n\r\n function logBytes14(bytes14 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\r\n }\r\n\r\n function logBytes15(bytes15 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\r\n }\r\n\r\n function logBytes16(bytes16 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\r\n }\r\n\r\n function logBytes17(bytes17 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\r\n }\r\n\r\n function logBytes18(bytes18 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\r\n }\r\n\r\n function logBytes19(bytes19 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\r\n }\r\n\r\n function logBytes20(bytes20 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\r\n }\r\n\r\n function logBytes21(bytes21 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\r\n }\r\n\r\n function logBytes22(bytes22 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\r\n }\r\n\r\n function logBytes23(bytes23 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\r\n }\r\n\r\n function logBytes24(bytes24 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\r\n }\r\n\r\n function logBytes25(bytes25 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\r\n }\r\n\r\n function logBytes26(bytes26 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\r\n }\r\n\r\n function logBytes27(bytes27 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\r\n }\r\n\r\n function logBytes28(bytes28 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\r\n }\r\n\r\n function logBytes29(bytes29 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\r\n }\r\n\r\n function logBytes30(bytes30 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\r\n }\r\n\r\n function logBytes31(bytes31 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\r\n }\r\n\r\n function logBytes32(bytes32 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\r\n }\r\n\r\n function log(uint256 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\r\n }\r\n\r\n function log(int256 p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\r\n }\r\n\r\n function log(string memory p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\r\n }\r\n\r\n function log(bool p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\r\n }\r\n\r\n function log(address p0) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256)\", p0, p1));\r\n }\r\n\r\n function log(uint256 p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string)\", p0, p1));\r\n }\r\n\r\n function log(uint256 p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool)\", p0, p1));\r\n }\r\n\r\n function log(uint256 p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, uint256 p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, int256 p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,int256)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\r\n }\r\n\r\n function log(string memory p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, uint256 p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\r\n }\r\n\r\n function log(bool p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\r\n }\r\n\r\n function log(address p0, uint256 p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256)\", p0, p1));\r\n }\r\n\r\n function log(address p0, string memory p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\r\n }\r\n\r\n function log(address p0, bool p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\r\n }\r\n\r\n function log(address p0, address p1) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, bool p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, address p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint256 p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint256 p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint256 p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, uint256 p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(bool p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint256 p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint256 p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint256 p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, uint256 p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, bool p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, uint256 p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, bool p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\r\n }\r\n\r\n function log(address p0, address p1, address p2) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, uint256 p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(uint256 p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, uint256 p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(string memory p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, uint256 p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(bool p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, uint256 p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, string memory p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, bool p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint256 p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint256 p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint256 p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, uint256 p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, string memory p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, bool p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, uint256 p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint256)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, string memory p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, bool p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\r\n }\r\n\r\n function log(address p0, address p1, address p2, address p3) internal view {\r\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\r\n }\r\n\r\n}" + }, + "forge-std/interfaces/IMulticall3.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\ninterface IMulticall3 {\r\n struct Call {\r\n address target;\r\n bytes callData;\r\n }\r\n\r\n struct Call3 {\r\n address target;\r\n bool allowFailure;\r\n bytes callData;\r\n }\r\n\r\n struct Call3Value {\r\n address target;\r\n bool allowFailure;\r\n uint256 value;\r\n bytes callData;\r\n }\r\n\r\n struct Result {\r\n bool success;\r\n bytes returnData;\r\n }\r\n\r\n function aggregate(Call[] calldata calls)\r\n external\r\n payable\r\n returns (uint256 blockNumber, bytes[] memory returnData);\r\n\r\n function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData);\r\n\r\n function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData);\r\n\r\n function blockAndAggregate(Call[] calldata calls)\r\n external\r\n payable\r\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\r\n\r\n function getBasefee() external view returns (uint256 basefee);\r\n\r\n function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash);\r\n\r\n function getBlockNumber() external view returns (uint256 blockNumber);\r\n\r\n function getChainId() external view returns (uint256 chainid);\r\n\r\n function getCurrentBlockCoinbase() external view returns (address coinbase);\r\n\r\n function getCurrentBlockDifficulty() external view returns (uint256 difficulty);\r\n\r\n function getCurrentBlockGasLimit() external view returns (uint256 gaslimit);\r\n\r\n function getCurrentBlockTimestamp() external view returns (uint256 timestamp);\r\n\r\n function getEthBalance(address addr) external view returns (uint256 balance);\r\n\r\n function getLastBlockHash() external view returns (bytes32 blockHash);\r\n\r\n function tryAggregate(bool requireSuccess, Call[] calldata calls)\r\n external\r\n payable\r\n returns (Result[] memory returnData);\r\n\r\n function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)\r\n external\r\n payable\r\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\r\n}\r\n" + }, + "forge-std/StdAssertions.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\nimport {DSTest} from \"ds-test/test.sol\";\r\nimport {stdMath} from \"./StdMath.sol\";\r\n\r\nabstract contract StdAssertions is DSTest {\r\n event log_array(uint256[] val);\r\n event log_array(int256[] val);\r\n event log_array(address[] val);\r\n event log_named_array(string key, uint256[] val);\r\n event log_named_array(string key, int256[] val);\r\n event log_named_array(string key, address[] val);\r\n\r\n function fail(string memory err) internal virtual {\r\n emit log_named_string(\"Error\", err);\r\n fail();\r\n }\r\n\r\n function assertFalse(bool data) internal virtual {\r\n assertTrue(!data);\r\n }\r\n\r\n function assertFalse(bool data, string memory err) internal virtual {\r\n assertTrue(!data, err);\r\n }\r\n\r\n function assertEq(bool a, bool b) internal virtual {\r\n if (a != b) {\r\n emit log(\"Error: a == b not satisfied [bool]\");\r\n emit log_named_string(\" Left\", a ? \"true\" : \"false\");\r\n emit log_named_string(\" Right\", b ? \"true\" : \"false\");\r\n fail();\r\n }\r\n }\r\n\r\n function assertEq(bool a, bool b, string memory err) internal virtual {\r\n if (a != b) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n\r\n function assertEq(bytes memory a, bytes memory b) internal virtual {\r\n assertEq0(a, b);\r\n }\r\n\r\n function assertEq(bytes memory a, bytes memory b, string memory err) internal virtual {\r\n assertEq0(a, b, err);\r\n }\r\n\r\n function assertEq(uint256[] memory a, uint256[] memory b) internal virtual {\r\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\r\n emit log(\"Error: a == b not satisfied [uint[]]\");\r\n emit log_named_array(\" Left\", a);\r\n emit log_named_array(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n\r\n function assertEq(int256[] memory a, int256[] memory b) internal virtual {\r\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\r\n emit log(\"Error: a == b not satisfied [int[]]\");\r\n emit log_named_array(\" Left\", a);\r\n emit log_named_array(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n\r\n function assertEq(address[] memory a, address[] memory b) internal virtual {\r\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\r\n emit log(\"Error: a == b not satisfied [address[]]\");\r\n emit log_named_array(\" Left\", a);\r\n emit log_named_array(\" Right\", b);\r\n fail();\r\n }\r\n }\r\n\r\n function assertEq(uint256[] memory a, uint256[] memory b, string memory err) internal virtual {\r\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n\r\n function assertEq(int256[] memory a, int256[] memory b, string memory err) internal virtual {\r\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n\r\n function assertEq(address[] memory a, address[] memory b, string memory err) internal virtual {\r\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\r\n emit log_named_string(\"Error\", err);\r\n assertEq(a, b);\r\n }\r\n }\r\n\r\n // Legacy helper\r\n function assertEqUint(uint256 a, uint256 b) internal virtual {\r\n assertEq(uint256(a), uint256(b));\r\n }\r\n\r\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta) internal virtual {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log(\"Error: a ~= b not satisfied [uint]\");\r\n emit log_named_uint(\" Left\", a);\r\n emit log_named_uint(\" Right\", b);\r\n emit log_named_uint(\" Max Delta\", maxDelta);\r\n emit log_named_uint(\" Delta\", delta);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta, string memory err) internal virtual {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqAbs(a, b, maxDelta);\r\n }\r\n }\r\n\r\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals) internal virtual {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log(\"Error: a ~= b not satisfied [uint]\");\r\n emit log_named_decimal_uint(\" Left\", a, decimals);\r\n emit log_named_decimal_uint(\" Right\", b, decimals);\r\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\r\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals, string memory err)\r\n internal\r\n virtual\r\n {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\r\n }\r\n }\r\n\r\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta) internal virtual {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log(\"Error: a ~= b not satisfied [int]\");\r\n emit log_named_int(\" Left\", a);\r\n emit log_named_int(\" Right\", b);\r\n emit log_named_uint(\" Max Delta\", maxDelta);\r\n emit log_named_uint(\" Delta\", delta);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta, string memory err) internal virtual {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqAbs(a, b, maxDelta);\r\n }\r\n }\r\n\r\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals) internal virtual {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log(\"Error: a ~= b not satisfied [int]\");\r\n emit log_named_decimal_int(\" Left\", a, decimals);\r\n emit log_named_decimal_int(\" Right\", b, decimals);\r\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\r\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals, string memory err)\r\n internal\r\n virtual\r\n {\r\n uint256 delta = stdMath.delta(a, b);\r\n\r\n if (delta > maxDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\r\n }\r\n }\r\n\r\n function assertApproxEqRel(\r\n uint256 a,\r\n uint256 b,\r\n uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100%\r\n ) internal virtual {\r\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log(\"Error: a ~= b not satisfied [uint]\");\r\n emit log_named_uint(\" Left\", a);\r\n emit log_named_uint(\" Right\", b);\r\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\r\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqRel(\r\n uint256 a,\r\n uint256 b,\r\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\r\n string memory err\r\n ) internal virtual {\r\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqRel(a, b, maxPercentDelta);\r\n }\r\n }\r\n\r\n function assertApproxEqRelDecimal(\r\n uint256 a,\r\n uint256 b,\r\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\r\n uint256 decimals\r\n ) internal virtual {\r\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log(\"Error: a ~= b not satisfied [uint]\");\r\n emit log_named_decimal_uint(\" Left\", a, decimals);\r\n emit log_named_decimal_uint(\" Right\", b, decimals);\r\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\r\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqRelDecimal(\r\n uint256 a,\r\n uint256 b,\r\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\r\n uint256 decimals,\r\n string memory err\r\n ) internal virtual {\r\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\r\n }\r\n }\r\n\r\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta) internal virtual {\r\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log(\"Error: a ~= b not satisfied [int]\");\r\n emit log_named_int(\" Left\", a);\r\n emit log_named_int(\" Right\", b);\r\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\r\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta, string memory err) internal virtual {\r\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqRel(a, b, maxPercentDelta);\r\n }\r\n }\r\n\r\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals) internal virtual {\r\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log(\"Error: a ~= b not satisfied [int]\");\r\n emit log_named_decimal_int(\" Left\", a, decimals);\r\n emit log_named_decimal_int(\" Right\", b, decimals);\r\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\r\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\r\n fail();\r\n }\r\n }\r\n\r\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals, string memory err)\r\n internal\r\n virtual\r\n {\r\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\r\n\r\n uint256 percentDelta = stdMath.percentDelta(a, b);\r\n\r\n if (percentDelta > maxPercentDelta) {\r\n emit log_named_string(\"Error\", err);\r\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\r\n }\r\n }\r\n\r\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB) internal virtual {\r\n assertEqCall(target, callDataA, target, callDataB, true);\r\n }\r\n\r\n function assertEqCall(address targetA, bytes memory callDataA, address targetB, bytes memory callDataB)\r\n internal\r\n virtual\r\n {\r\n assertEqCall(targetA, callDataA, targetB, callDataB, true);\r\n }\r\n\r\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB, bool strictRevertData)\r\n internal\r\n virtual\r\n {\r\n assertEqCall(target, callDataA, target, callDataB, strictRevertData);\r\n }\r\n\r\n function assertEqCall(\r\n address targetA,\r\n bytes memory callDataA,\r\n address targetB,\r\n bytes memory callDataB,\r\n bool strictRevertData\r\n ) internal virtual {\r\n (bool successA, bytes memory returnDataA) = address(targetA).call(callDataA);\r\n (bool successB, bytes memory returnDataB) = address(targetB).call(callDataB);\r\n\r\n if (successA && successB) {\r\n assertEq(returnDataA, returnDataB, \"Call return data does not match\");\r\n }\r\n\r\n if (!successA && !successB && strictRevertData) {\r\n assertEq(returnDataA, returnDataB, \"Call revert data does not match\");\r\n }\r\n\r\n if (!successA && successB) {\r\n emit log(\"Error: Calls were not equal\");\r\n emit log_named_bytes(\" Left call revert data\", returnDataA);\r\n emit log_named_bytes(\" Right call return data\", returnDataB);\r\n fail();\r\n }\r\n\r\n if (successA && !successB) {\r\n emit log(\"Error: Calls were not equal\");\r\n emit log_named_bytes(\" Left call return data\", returnDataA);\r\n emit log_named_bytes(\" Right call revert data\", returnDataB);\r\n fail();\r\n }\r\n }\r\n}\r\n" + }, + "forge-std/StdChains.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\nimport {VmSafe} from \"./Vm.sol\";\r\n\r\n/**\r\n * StdChains provides information about EVM compatible chains that can be used in scripts/tests.\r\n * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are\r\n * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of\r\n * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the\r\n * alias used in this contract, which can be found as the first argument to the\r\n * `setChainWithDefaultRpcUrl` call in the `initialize` function.\r\n *\r\n * There are two main ways to use this contract:\r\n * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or\r\n * `setChain(string memory chainAlias, Chain memory chain)`\r\n * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`.\r\n *\r\n * The first time either of those are used, chains are initialized with the default set of RPC URLs.\r\n * This is done in `initialize`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in\r\n * `defaultRpcUrls`.\r\n *\r\n * The `setChain` function is straightforward, and it simply saves off the given chain data.\r\n *\r\n * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say\r\n * we want to retrieve `mainnet`'s RPC URL:\r\n * - If you haven't set any mainnet chain info with `setChain`, you haven't specified that\r\n * chain in `foundry.toml` and no env var is set, the default data and RPC URL will be returned.\r\n * - If you have set a mainnet RPC URL in `foundry.toml` it will return that, if valid (e.g. if\r\n * a URL is given or if an environment variable is given and that environment variable exists).\r\n * Otherwise, the default data is returned.\r\n * - If you specified data with `setChain` it will return that.\r\n *\r\n * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults.\r\n */\r\nabstract contract StdChains {\r\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n bool private initialized;\r\n\r\n struct ChainData {\r\n string name;\r\n uint256 chainId;\r\n string rpcUrl;\r\n }\r\n\r\n struct Chain {\r\n // The chain name.\r\n string name;\r\n // The chain's Chain ID.\r\n uint256 chainId;\r\n // The chain's alias. (i.e. what gets specified in `foundry.toml`).\r\n string chainAlias;\r\n // A default RPC endpoint for this chain.\r\n // NOTE: This default RPC URL is included for convenience to facilitate quick tests and\r\n // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy\r\n // usage as you will be throttled and this is a disservice to others who need this endpoint.\r\n string rpcUrl;\r\n }\r\n\r\n // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data.\r\n mapping(string => Chain) private chains;\r\n // Maps from the chain's alias to it's default RPC URL.\r\n mapping(string => string) private defaultRpcUrls;\r\n // Maps from a chain ID to it's alias.\r\n mapping(uint256 => string) private idToAlias;\r\n\r\n bool private fallbackToDefaultRpcUrls = true;\r\n\r\n // The RPC URL will be fetched from config or defaultRpcUrls if possible.\r\n function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) {\r\n require(bytes(chainAlias).length != 0, \"StdChains getChain(string): Chain alias cannot be the empty string.\");\r\n\r\n initialize();\r\n chain = chains[chainAlias];\r\n require(\r\n chain.chainId != 0,\r\n string(abi.encodePacked(\"StdChains getChain(string): Chain with alias \\\"\", chainAlias, \"\\\" not found.\"))\r\n );\r\n\r\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\r\n }\r\n\r\n function getChain(uint256 chainId) internal virtual returns (Chain memory chain) {\r\n require(chainId != 0, \"StdChains getChain(uint256): Chain ID cannot be 0.\");\r\n initialize();\r\n string memory chainAlias = idToAlias[chainId];\r\n\r\n chain = chains[chainAlias];\r\n\r\n require(\r\n chain.chainId != 0,\r\n string(abi.encodePacked(\"StdChains getChain(uint256): Chain with ID \", vm.toString(chainId), \" not found.\"))\r\n );\r\n\r\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\r\n }\r\n\r\n // set chain info, with priority to argument's rpcUrl field.\r\n function setChain(string memory chainAlias, ChainData memory chain) internal virtual {\r\n require(\r\n bytes(chainAlias).length != 0,\r\n \"StdChains setChain(string,ChainData): Chain alias cannot be the empty string.\"\r\n );\r\n\r\n require(chain.chainId != 0, \"StdChains setChain(string,ChainData): Chain ID cannot be 0.\");\r\n\r\n initialize();\r\n string memory foundAlias = idToAlias[chain.chainId];\r\n\r\n require(\r\n bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)),\r\n string(\r\n abi.encodePacked(\r\n \"StdChains setChain(string,ChainData): Chain ID \",\r\n vm.toString(chain.chainId),\r\n \" already used by \\\"\",\r\n foundAlias,\r\n \"\\\".\"\r\n )\r\n )\r\n );\r\n\r\n uint256 oldChainId = chains[chainAlias].chainId;\r\n delete idToAlias[oldChainId];\r\n\r\n chains[chainAlias] =\r\n Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl});\r\n idToAlias[chain.chainId] = chainAlias;\r\n }\r\n\r\n // set chain info, with priority to argument's rpcUrl field.\r\n function setChain(string memory chainAlias, Chain memory chain) internal virtual {\r\n setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl}));\r\n }\r\n\r\n function _toUpper(string memory str) private pure returns (string memory) {\r\n bytes memory strb = bytes(str);\r\n bytes memory copy = new bytes(strb.length);\r\n for (uint256 i = 0; i < strb.length; i++) {\r\n bytes1 b = strb[i];\r\n if (b >= 0x61 && b <= 0x7A) {\r\n copy[i] = bytes1(uint8(b) - 32);\r\n } else {\r\n copy[i] = b;\r\n }\r\n }\r\n return string(copy);\r\n }\r\n\r\n // lookup rpcUrl, in descending order of priority:\r\n // current -> config (foundry.toml) -> environment variable -> default\r\n function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) private returns (Chain memory) {\r\n if (bytes(chain.rpcUrl).length == 0) {\r\n try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) {\r\n chain.rpcUrl = configRpcUrl;\r\n } catch (bytes memory err) {\r\n string memory envName = string(abi.encodePacked(_toUpper(chainAlias), \"_RPC_URL\"));\r\n if (fallbackToDefaultRpcUrls) {\r\n chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]);\r\n } else {\r\n chain.rpcUrl = vm.envString(envName);\r\n }\r\n // distinguish 'not found' from 'cannot read'\r\n bytes memory notFoundError =\r\n abi.encodeWithSignature(\"CheatCodeError\", string(abi.encodePacked(\"invalid rpc url \", chainAlias)));\r\n if (keccak256(notFoundError) != keccak256(err) || bytes(chain.rpcUrl).length == 0) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n revert(add(32, err), mload(err))\r\n }\r\n }\r\n }\r\n }\r\n return chain;\r\n }\r\n\r\n function setFallbackToDefaultRpcUrls(bool useDefault) internal {\r\n fallbackToDefaultRpcUrls = useDefault;\r\n }\r\n\r\n function initialize() private {\r\n if (initialized) return;\r\n\r\n initialized = true;\r\n\r\n // If adding an RPC here, make sure to test the default RPC URL in `testRpcs`\r\n setChainWithDefaultRpcUrl(\"anvil\", ChainData(\"Anvil\", 31337, \"http://127.0.0.1:8545\"));\r\n setChainWithDefaultRpcUrl(\r\n \"mainnet\", ChainData(\"Mainnet\", 1, \"https://mainnet.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\r\n );\r\n setChainWithDefaultRpcUrl(\r\n \"goerli\", ChainData(\"Goerli\", 5, \"https://goerli.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\r\n );\r\n setChainWithDefaultRpcUrl(\r\n \"sepolia\", ChainData(\"Sepolia\", 11155111, \"https://sepolia.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\r\n );\r\n setChainWithDefaultRpcUrl(\"optimism\", ChainData(\"Optimism\", 10, \"https://mainnet.optimism.io\"));\r\n setChainWithDefaultRpcUrl(\"optimism_goerli\", ChainData(\"Optimism Goerli\", 420, \"https://goerli.optimism.io\"));\r\n setChainWithDefaultRpcUrl(\"arbitrum_one\", ChainData(\"Arbitrum One\", 42161, \"https://arb1.arbitrum.io/rpc\"));\r\n setChainWithDefaultRpcUrl(\r\n \"arbitrum_one_goerli\", ChainData(\"Arbitrum One Goerli\", 421613, \"https://goerli-rollup.arbitrum.io/rpc\")\r\n );\r\n setChainWithDefaultRpcUrl(\"arbitrum_nova\", ChainData(\"Arbitrum Nova\", 42170, \"https://nova.arbitrum.io/rpc\"));\r\n setChainWithDefaultRpcUrl(\"polygon\", ChainData(\"Polygon\", 137, \"https://polygon-rpc.com\"));\r\n setChainWithDefaultRpcUrl(\r\n \"polygon_mumbai\", ChainData(\"Polygon Mumbai\", 80001, \"https://rpc-mumbai.maticvigil.com\")\r\n );\r\n setChainWithDefaultRpcUrl(\"avalanche\", ChainData(\"Avalanche\", 43114, \"https://api.avax.network/ext/bc/C/rpc\"));\r\n setChainWithDefaultRpcUrl(\r\n \"avalanche_fuji\", ChainData(\"Avalanche Fuji\", 43113, \"https://api.avax-test.network/ext/bc/C/rpc\")\r\n );\r\n setChainWithDefaultRpcUrl(\r\n \"bnb_smart_chain\", ChainData(\"BNB Smart Chain\", 56, \"https://bsc-dataseed1.binance.org\")\r\n );\r\n setChainWithDefaultRpcUrl(\r\n \"bnb_smart_chain_testnet\",\r\n ChainData(\"BNB Smart Chain Testnet\", 97, \"https://rpc.ankr.com/bsc_testnet_chapel\")\r\n );\r\n setChainWithDefaultRpcUrl(\"gnosis_chain\", ChainData(\"Gnosis Chain\", 100, \"https://rpc.gnosischain.com\"));\r\n }\r\n\r\n // set chain info, with priority to chainAlias' rpc url in foundry.toml\r\n function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private {\r\n string memory rpcUrl = chain.rpcUrl;\r\n defaultRpcUrls[chainAlias] = rpcUrl;\r\n chain.rpcUrl = \"\";\r\n setChain(chainAlias, chain);\r\n chain.rpcUrl = rpcUrl; // restore argument\r\n }\r\n}\r\n" + }, + "forge-std/StdCheats.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\r\nimport {Vm} from \"./Vm.sol\";\r\n\r\nabstract contract StdCheatsSafe {\r\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n bool private gasMeteringOff;\r\n\r\n // Data structures to parse Transaction objects from the broadcast artifact\r\n // that conform to EIP1559. The Raw structs is what is parsed from the JSON\r\n // and then converted to the one that is used by the user for better UX.\r\n\r\n struct RawTx1559 {\r\n string[] arguments;\r\n address contractAddress;\r\n string contractName;\r\n // json value name = function\r\n string functionSig;\r\n bytes32 hash;\r\n // json value name = tx\r\n RawTx1559Detail txDetail;\r\n // json value name = type\r\n string opcode;\r\n }\r\n\r\n struct RawTx1559Detail {\r\n AccessList[] accessList;\r\n bytes data;\r\n address from;\r\n bytes gas;\r\n bytes nonce;\r\n address to;\r\n bytes txType;\r\n bytes value;\r\n }\r\n\r\n struct Tx1559 {\r\n string[] arguments;\r\n address contractAddress;\r\n string contractName;\r\n string functionSig;\r\n bytes32 hash;\r\n Tx1559Detail txDetail;\r\n string opcode;\r\n }\r\n\r\n struct Tx1559Detail {\r\n AccessList[] accessList;\r\n bytes data;\r\n address from;\r\n uint256 gas;\r\n uint256 nonce;\r\n address to;\r\n uint256 txType;\r\n uint256 value;\r\n }\r\n\r\n // Data structures to parse Transaction objects from the broadcast artifact\r\n // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON\r\n // and then converted to the one that is used by the user for better UX.\r\n\r\n struct TxLegacy {\r\n string[] arguments;\r\n address contractAddress;\r\n string contractName;\r\n string functionSig;\r\n string hash;\r\n string opcode;\r\n TxDetailLegacy transaction;\r\n }\r\n\r\n struct TxDetailLegacy {\r\n AccessList[] accessList;\r\n uint256 chainId;\r\n bytes data;\r\n address from;\r\n uint256 gas;\r\n uint256 gasPrice;\r\n bytes32 hash;\r\n uint256 nonce;\r\n bytes1 opcode;\r\n bytes32 r;\r\n bytes32 s;\r\n uint256 txType;\r\n address to;\r\n uint8 v;\r\n uint256 value;\r\n }\r\n\r\n struct AccessList {\r\n address accessAddress;\r\n bytes32[] storageKeys;\r\n }\r\n\r\n // Data structures to parse Receipt objects from the broadcast artifact.\r\n // The Raw structs is what is parsed from the JSON\r\n // and then converted to the one that is used by the user for better UX.\r\n\r\n struct RawReceipt {\r\n bytes32 blockHash;\r\n bytes blockNumber;\r\n address contractAddress;\r\n bytes cumulativeGasUsed;\r\n bytes effectiveGasPrice;\r\n address from;\r\n bytes gasUsed;\r\n RawReceiptLog[] logs;\r\n bytes logsBloom;\r\n bytes status;\r\n address to;\r\n bytes32 transactionHash;\r\n bytes transactionIndex;\r\n }\r\n\r\n struct Receipt {\r\n bytes32 blockHash;\r\n uint256 blockNumber;\r\n address contractAddress;\r\n uint256 cumulativeGasUsed;\r\n uint256 effectiveGasPrice;\r\n address from;\r\n uint256 gasUsed;\r\n ReceiptLog[] logs;\r\n bytes logsBloom;\r\n uint256 status;\r\n address to;\r\n bytes32 transactionHash;\r\n uint256 transactionIndex;\r\n }\r\n\r\n // Data structures to parse the entire broadcast artifact, assuming the\r\n // transactions conform to EIP1559.\r\n\r\n struct EIP1559ScriptArtifact {\r\n string[] libraries;\r\n string path;\r\n string[] pending;\r\n Receipt[] receipts;\r\n uint256 timestamp;\r\n Tx1559[] transactions;\r\n TxReturn[] txReturns;\r\n }\r\n\r\n struct RawEIP1559ScriptArtifact {\r\n string[] libraries;\r\n string path;\r\n string[] pending;\r\n RawReceipt[] receipts;\r\n TxReturn[] txReturns;\r\n uint256 timestamp;\r\n RawTx1559[] transactions;\r\n }\r\n\r\n struct RawReceiptLog {\r\n // json value = address\r\n address logAddress;\r\n bytes32 blockHash;\r\n bytes blockNumber;\r\n bytes data;\r\n bytes logIndex;\r\n bool removed;\r\n bytes32[] topics;\r\n bytes32 transactionHash;\r\n bytes transactionIndex;\r\n bytes transactionLogIndex;\r\n }\r\n\r\n struct ReceiptLog {\r\n // json value = address\r\n address logAddress;\r\n bytes32 blockHash;\r\n uint256 blockNumber;\r\n bytes data;\r\n uint256 logIndex;\r\n bytes32[] topics;\r\n uint256 transactionIndex;\r\n uint256 transactionLogIndex;\r\n bool removed;\r\n }\r\n\r\n struct TxReturn {\r\n string internalType;\r\n string value;\r\n }\r\n\r\n function assumeNoPrecompiles(address addr) internal virtual {\r\n // Assembly required since `block.chainid` was introduced in 0.8.0.\r\n uint256 chainId;\r\n assembly {\r\n chainId := chainid()\r\n }\r\n assumeNoPrecompiles(addr, chainId);\r\n }\r\n\r\n function assumeNoPrecompiles(address addr, uint256 chainId) internal pure virtual {\r\n // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific\r\n // address), but the same rationale for excluding them applies so we include those too.\r\n\r\n // These should be present on all EVM-compatible chains.\r\n vm.assume(addr < address(0x1) || addr > address(0x9));\r\n\r\n // forgefmt: disable-start\r\n if (chainId == 10 || chainId == 420) {\r\n // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21\r\n vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800));\r\n } else if (chainId == 42161 || chainId == 421613) {\r\n // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains\r\n vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068));\r\n } else if (chainId == 43114 || chainId == 43113) {\r\n // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59\r\n vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff));\r\n vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF));\r\n vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff));\r\n }\r\n // forgefmt: disable-end\r\n }\r\n\r\n function readEIP1559ScriptArtifact(string memory path)\r\n internal\r\n view\r\n virtual\r\n returns (EIP1559ScriptArtifact memory)\r\n {\r\n string memory data = vm.readFile(path);\r\n bytes memory parsedData = vm.parseJson(data);\r\n RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact));\r\n EIP1559ScriptArtifact memory artifact;\r\n artifact.libraries = rawArtifact.libraries;\r\n artifact.path = rawArtifact.path;\r\n artifact.timestamp = rawArtifact.timestamp;\r\n artifact.pending = rawArtifact.pending;\r\n artifact.txReturns = rawArtifact.txReturns;\r\n artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts);\r\n artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions);\r\n return artifact;\r\n }\r\n\r\n function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) {\r\n Tx1559[] memory txs = new Tx1559[](rawTxs.length);\r\n for (uint256 i; i < rawTxs.length; i++) {\r\n txs[i] = rawToConvertedEIPTx1559(rawTxs[i]);\r\n }\r\n return txs;\r\n }\r\n\r\n function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) {\r\n Tx1559 memory transaction;\r\n transaction.arguments = rawTx.arguments;\r\n transaction.contractName = rawTx.contractName;\r\n transaction.functionSig = rawTx.functionSig;\r\n transaction.hash = rawTx.hash;\r\n transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail);\r\n transaction.opcode = rawTx.opcode;\r\n return transaction;\r\n }\r\n\r\n function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail)\r\n internal\r\n pure\r\n virtual\r\n returns (Tx1559Detail memory)\r\n {\r\n Tx1559Detail memory txDetail;\r\n txDetail.data = rawDetail.data;\r\n txDetail.from = rawDetail.from;\r\n txDetail.to = rawDetail.to;\r\n txDetail.nonce = _bytesToUint(rawDetail.nonce);\r\n txDetail.txType = _bytesToUint(rawDetail.txType);\r\n txDetail.value = _bytesToUint(rawDetail.value);\r\n txDetail.gas = _bytesToUint(rawDetail.gas);\r\n txDetail.accessList = rawDetail.accessList;\r\n return txDetail;\r\n }\r\n\r\n function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) {\r\n string memory deployData = vm.readFile(path);\r\n bytes memory parsedDeployData = vm.parseJson(deployData, \".transactions\");\r\n RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[]));\r\n return rawToConvertedEIPTx1559s(rawTxs);\r\n }\r\n\r\n function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) {\r\n string memory deployData = vm.readFile(path);\r\n string memory key = string(abi.encodePacked(\".transactions[\", vm.toString(index), \"]\"));\r\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\r\n RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559));\r\n return rawToConvertedEIPTx1559(rawTx);\r\n }\r\n\r\n // Analogous to readTransactions, but for receipts.\r\n function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) {\r\n string memory deployData = vm.readFile(path);\r\n bytes memory parsedDeployData = vm.parseJson(deployData, \".receipts\");\r\n RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[]));\r\n return rawToConvertedReceipts(rawReceipts);\r\n }\r\n\r\n function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) {\r\n string memory deployData = vm.readFile(path);\r\n string memory key = string(abi.encodePacked(\".receipts[\", vm.toString(index), \"]\"));\r\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\r\n RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt));\r\n return rawToConvertedReceipt(rawReceipt);\r\n }\r\n\r\n function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) {\r\n Receipt[] memory receipts = new Receipt[](rawReceipts.length);\r\n for (uint256 i; i < rawReceipts.length; i++) {\r\n receipts[i] = rawToConvertedReceipt(rawReceipts[i]);\r\n }\r\n return receipts;\r\n }\r\n\r\n function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) {\r\n Receipt memory receipt;\r\n receipt.blockHash = rawReceipt.blockHash;\r\n receipt.to = rawReceipt.to;\r\n receipt.from = rawReceipt.from;\r\n receipt.contractAddress = rawReceipt.contractAddress;\r\n receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice);\r\n receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed);\r\n receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed);\r\n receipt.status = _bytesToUint(rawReceipt.status);\r\n receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex);\r\n receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber);\r\n receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs);\r\n receipt.logsBloom = rawReceipt.logsBloom;\r\n receipt.transactionHash = rawReceipt.transactionHash;\r\n return receipt;\r\n }\r\n\r\n function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs)\r\n internal\r\n pure\r\n virtual\r\n returns (ReceiptLog[] memory)\r\n {\r\n ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length);\r\n for (uint256 i; i < rawLogs.length; i++) {\r\n logs[i].logAddress = rawLogs[i].logAddress;\r\n logs[i].blockHash = rawLogs[i].blockHash;\r\n logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber);\r\n logs[i].data = rawLogs[i].data;\r\n logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex);\r\n logs[i].topics = rawLogs[i].topics;\r\n logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex);\r\n logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex);\r\n logs[i].removed = rawLogs[i].removed;\r\n }\r\n return logs;\r\n }\r\n\r\n // Deploy a contract by fetching the contract bytecode from\r\n // the artifacts directory\r\n // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))`\r\n function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) {\r\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\r\n }\r\n\r\n require(addr != address(0), \"StdCheats deployCode(string,bytes): Deployment failed.\");\r\n }\r\n\r\n function deployCode(string memory what) internal virtual returns (address addr) {\r\n bytes memory bytecode = vm.getCode(what);\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\r\n }\r\n\r\n require(addr != address(0), \"StdCheats deployCode(string): Deployment failed.\");\r\n }\r\n\r\n /// @dev deploy contract with value on construction\r\n function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) {\r\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\r\n }\r\n\r\n require(addr != address(0), \"StdCheats deployCode(string,bytes,uint256): Deployment failed.\");\r\n }\r\n\r\n function deployCode(string memory what, uint256 val) internal virtual returns (address addr) {\r\n bytes memory bytecode = vm.getCode(what);\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\r\n }\r\n\r\n require(addr != address(0), \"StdCheats deployCode(string,uint256): Deployment failed.\");\r\n }\r\n\r\n // creates a labeled address and the corresponding private key\r\n function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) {\r\n privateKey = uint256(keccak256(abi.encodePacked(name)));\r\n addr = vm.addr(privateKey);\r\n vm.label(addr, name);\r\n }\r\n\r\n // creates a labeled address\r\n function makeAddr(string memory name) internal virtual returns (address addr) {\r\n (addr,) = makeAddrAndKey(name);\r\n }\r\n\r\n function deriveRememberKey(string memory mnemonic, uint32 index)\r\n internal\r\n virtual\r\n returns (address who, uint256 privateKey)\r\n {\r\n privateKey = vm.deriveKey(mnemonic, index);\r\n who = vm.rememberKey(privateKey);\r\n }\r\n\r\n function _bytesToUint(bytes memory b) private pure returns (uint256) {\r\n require(b.length <= 32, \"StdCheats _bytesToUint(bytes): Bytes length exceeds 32.\");\r\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\r\n }\r\n\r\n function isFork() internal view virtual returns (bool status) {\r\n try vm.activeFork() {\r\n status = true;\r\n } catch (bytes memory) {}\r\n }\r\n\r\n modifier skipWhenForking() {\r\n if (!isFork()) {\r\n _;\r\n }\r\n }\r\n\r\n modifier skipWhenNotForking() {\r\n if (isFork()) {\r\n _;\r\n }\r\n }\r\n\r\n modifier noGasMetering() {\r\n vm.pauseGasMetering();\r\n // To prevent turning gas monitoring back on with nested functions that use this modifier,\r\n // we check if gasMetering started in the off position. If it did, we don't want to turn\r\n // it back on until we exit the top level function that used the modifier\r\n //\r\n // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well.\r\n // funcA will have `gasStartedOff` as false, funcB will have it as true,\r\n // so we only turn metering back on at the end of the funcA\r\n bool gasStartedOff = gasMeteringOff;\r\n gasMeteringOff = true;\r\n\r\n _;\r\n\r\n // if gas metering was on when this modifier was called, turn it back on at the end\r\n if (!gasStartedOff) {\r\n gasMeteringOff = false;\r\n vm.resumeGasMetering();\r\n }\r\n }\r\n\r\n // a cheat for fuzzing addresses that are payable only\r\n // see https://github.com/foundry-rs/foundry/issues/3631\r\n function assumePayable(address addr) internal virtual {\r\n (bool success,) = payable(addr).call{value: 0}(\"\");\r\n vm.assume(success);\r\n }\r\n}\r\n\r\n// Wrappers around cheatcodes to avoid footguns\r\nabstract contract StdCheats is StdCheatsSafe {\r\n using stdStorage for StdStorage;\r\n\r\n StdStorage private stdstore;\r\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n // Skip forward or rewind time by the specified number of seconds\r\n function skip(uint256 time) internal virtual {\r\n vm.warp(block.timestamp + time);\r\n }\r\n\r\n function rewind(uint256 time) internal virtual {\r\n vm.warp(block.timestamp - time);\r\n }\r\n\r\n // Setup a prank from an address that has some ether\r\n function hoax(address msgSender) internal virtual {\r\n vm.deal(msgSender, 1 << 128);\r\n vm.prank(msgSender);\r\n }\r\n\r\n function hoax(address msgSender, uint256 give) internal virtual {\r\n vm.deal(msgSender, give);\r\n vm.prank(msgSender);\r\n }\r\n\r\n function hoax(address msgSender, address origin) internal virtual {\r\n vm.deal(msgSender, 1 << 128);\r\n vm.prank(msgSender, origin);\r\n }\r\n\r\n function hoax(address msgSender, address origin, uint256 give) internal virtual {\r\n vm.deal(msgSender, give);\r\n vm.prank(msgSender, origin);\r\n }\r\n\r\n // Start perpetual prank from an address that has some ether\r\n function startHoax(address msgSender) internal virtual {\r\n vm.deal(msgSender, 1 << 128);\r\n vm.startPrank(msgSender);\r\n }\r\n\r\n function startHoax(address msgSender, uint256 give) internal virtual {\r\n vm.deal(msgSender, give);\r\n vm.startPrank(msgSender);\r\n }\r\n\r\n // Start perpetual prank from an address that has some ether\r\n // tx.origin is set to the origin parameter\r\n function startHoax(address msgSender, address origin) internal virtual {\r\n vm.deal(msgSender, 1 << 128);\r\n vm.startPrank(msgSender, origin);\r\n }\r\n\r\n function startHoax(address msgSender, address origin, uint256 give) internal virtual {\r\n vm.deal(msgSender, give);\r\n vm.startPrank(msgSender, origin);\r\n }\r\n\r\n function changePrank(address msgSender) internal virtual {\r\n vm.stopPrank();\r\n vm.startPrank(msgSender);\r\n }\r\n\r\n // The same as Vm's `deal`\r\n // Use the alternative signature for ERC20 tokens\r\n function deal(address to, uint256 give) internal virtual {\r\n vm.deal(to, give);\r\n }\r\n\r\n // Set the balance of an account for any ERC20 token\r\n // Use the alternative signature to update `totalSupply`\r\n function deal(address token, address to, uint256 give) internal virtual {\r\n deal(token, to, give, false);\r\n }\r\n\r\n // Set the balance of an account for any ERC1155 token\r\n // Use the alternative signature to update `totalSupply`\r\n function dealERC1155(address token, address to, uint256 id, uint256 give) internal virtual {\r\n dealERC1155(token, to, id, give, false);\r\n }\r\n\r\n function deal(address token, address to, uint256 give, bool adjust) internal virtual {\r\n // get current balance\r\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x70a08231, to));\r\n uint256 prevBal = abi.decode(balData, (uint256));\r\n\r\n // update balance\r\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give);\r\n\r\n // update total supply\r\n if (adjust) {\r\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0x18160ddd));\r\n uint256 totSup = abi.decode(totSupData, (uint256));\r\n if (give < prevBal) {\r\n totSup -= (prevBal - give);\r\n } else {\r\n totSup += (give - prevBal);\r\n }\r\n stdstore.target(token).sig(0x18160ddd).checked_write(totSup);\r\n }\r\n }\r\n\r\n function dealERC1155(address token, address to, uint256 id, uint256 give, bool adjust) internal virtual {\r\n // get current balance\r\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x00fdd58e, to, id));\r\n uint256 prevBal = abi.decode(balData, (uint256));\r\n\r\n // update balance\r\n stdstore.target(token).sig(0x00fdd58e).with_key(to).with_key(id).checked_write(give);\r\n\r\n // update total supply\r\n if (adjust) {\r\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0xbd85b039, id));\r\n require(\r\n totSupData.length != 0,\r\n \"StdCheats deal(address,address,uint,uint,bool): target contract is not ERC1155Supply.\"\r\n );\r\n uint256 totSup = abi.decode(totSupData, (uint256));\r\n if (give < prevBal) {\r\n totSup -= (prevBal - give);\r\n } else {\r\n totSup += (give - prevBal);\r\n }\r\n stdstore.target(token).sig(0xbd85b039).with_key(id).checked_write(totSup);\r\n }\r\n }\r\n\r\n function dealERC721(address token, address to, uint256 id) internal virtual {\r\n // check if token id is already minted and the actual owner.\r\n (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id));\r\n require(successMinted, \"StdCheats deal(address,address,uint,bool): id not minted.\");\r\n\r\n // get owner current balance\r\n (, bytes memory fromBalData) = token.call(abi.encodeWithSelector(0x70a08231, abi.decode(ownerData, (address))));\r\n uint256 fromPrevBal = abi.decode(fromBalData, (uint256));\r\n\r\n // get new user current balance\r\n (, bytes memory toBalData) = token.call(abi.encodeWithSelector(0x70a08231, to));\r\n uint256 toPrevBal = abi.decode(toBalData, (uint256));\r\n\r\n // update balances\r\n stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal);\r\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal);\r\n\r\n // update owner\r\n stdstore.target(token).sig(0x6352211e).with_key(id).checked_write(to);\r\n }\r\n}\r\n" + }, + "forge-std/StdError.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\nlibrary stdError {\r\n bytes public constant assertionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x01);\r\n bytes public constant arithmeticError = abi.encodeWithSignature(\"Panic(uint256)\", 0x11);\r\n bytes public constant divisionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x12);\r\n bytes public constant enumConversionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x21);\r\n bytes public constant encodeStorageError = abi.encodeWithSignature(\"Panic(uint256)\", 0x22);\r\n bytes public constant popError = abi.encodeWithSignature(\"Panic(uint256)\", 0x31);\r\n bytes public constant indexOOBError = abi.encodeWithSignature(\"Panic(uint256)\", 0x32);\r\n bytes public constant memOverflowError = abi.encodeWithSignature(\"Panic(uint256)\", 0x41);\r\n bytes public constant zeroVarError = abi.encodeWithSignature(\"Panic(uint256)\", 0x51);\r\n}\r\n" + }, + "forge-std/StdInvariant.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\ncontract StdInvariant {\r\n struct FuzzSelector {\r\n address addr;\r\n bytes4[] selectors;\r\n }\r\n\r\n address[] private _excludedContracts;\r\n address[] private _excludedSenders;\r\n address[] private _targetedContracts;\r\n address[] private _targetedSenders;\r\n\r\n string[] private _excludedArtifacts;\r\n string[] private _targetedArtifacts;\r\n\r\n FuzzSelector[] private _targetedArtifactSelectors;\r\n FuzzSelector[] private _targetedSelectors;\r\n\r\n // Functions for users:\r\n // These are intended to be called in tests.\r\n\r\n function excludeContract(address newExcludedContract_) internal {\r\n _excludedContracts.push(newExcludedContract_);\r\n }\r\n\r\n function excludeSender(address newExcludedSender_) internal {\r\n _excludedSenders.push(newExcludedSender_);\r\n }\r\n\r\n function excludeArtifact(string memory newExcludedArtifact_) internal {\r\n _excludedArtifacts.push(newExcludedArtifact_);\r\n }\r\n\r\n function targetArtifact(string memory newTargetedArtifact_) internal {\r\n _targetedArtifacts.push(newTargetedArtifact_);\r\n }\r\n\r\n function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal {\r\n _targetedArtifactSelectors.push(newTargetedArtifactSelector_);\r\n }\r\n\r\n function targetContract(address newTargetedContract_) internal {\r\n _targetedContracts.push(newTargetedContract_);\r\n }\r\n\r\n function targetSelector(FuzzSelector memory newTargetedSelector_) internal {\r\n _targetedSelectors.push(newTargetedSelector_);\r\n }\r\n\r\n function targetSender(address newTargetedSender_) internal {\r\n _targetedSenders.push(newTargetedSender_);\r\n }\r\n\r\n // Functions for forge:\r\n // These are called by forge to run invariant tests and don't need to be called in tests.\r\n\r\n function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) {\r\n excludedArtifacts_ = _excludedArtifacts;\r\n }\r\n\r\n function excludeContracts() public view returns (address[] memory excludedContracts_) {\r\n excludedContracts_ = _excludedContracts;\r\n }\r\n\r\n function excludeSenders() public view returns (address[] memory excludedSenders_) {\r\n excludedSenders_ = _excludedSenders;\r\n }\r\n\r\n function targetArtifacts() public view returns (string[] memory targetedArtifacts_) {\r\n targetedArtifacts_ = _targetedArtifacts;\r\n }\r\n\r\n function targetArtifactSelectors() public view returns (FuzzSelector[] memory targetedArtifactSelectors_) {\r\n targetedArtifactSelectors_ = _targetedArtifactSelectors;\r\n }\r\n\r\n function targetContracts() public view returns (address[] memory targetedContracts_) {\r\n targetedContracts_ = _targetedContracts;\r\n }\r\n\r\n function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) {\r\n targetedSelectors_ = _targetedSelectors;\r\n }\r\n\r\n function targetSenders() public view returns (address[] memory targetedSenders_) {\r\n targetedSenders_ = _targetedSenders;\r\n }\r\n}\r\n" + }, + "forge-std/StdJson.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.0 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\nimport {VmSafe} from \"./Vm.sol\";\r\n\r\n// Helpers for parsing and writing JSON files\r\n// To parse:\r\n// ```\r\n// using stdJson for string;\r\n// string memory json = vm.readFile(\"some_peth\");\r\n// json.parseUint(\"\");\r\n// ```\r\n// To write:\r\n// ```\r\n// using stdJson for string;\r\n// string memory json = \"deploymentArtifact\";\r\n// Contract contract = new Contract();\r\n// json.serialize(\"contractAddress\", address(contract));\r\n// json = json.serialize(\"deploymentTimes\", uint(1));\r\n// // store the stringified JSON to the 'json' variable we have been using as a key\r\n// // as we won't need it any longer\r\n// string memory json2 = \"finalArtifact\";\r\n// string memory final = json2.serialize(\"depArtifact\", json);\r\n// final.write(\"\");\r\n// ```\r\n\r\nlibrary stdJson {\r\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) {\r\n return vm.parseJson(json, key);\r\n }\r\n\r\n function readUint(string memory json, string memory key) internal returns (uint256) {\r\n return vm.parseJsonUint(json, key);\r\n }\r\n\r\n function readUintArray(string memory json, string memory key) internal returns (uint256[] memory) {\r\n return vm.parseJsonUintArray(json, key);\r\n }\r\n\r\n function readInt(string memory json, string memory key) internal returns (int256) {\r\n return vm.parseJsonInt(json, key);\r\n }\r\n\r\n function readIntArray(string memory json, string memory key) internal returns (int256[] memory) {\r\n return vm.parseJsonIntArray(json, key);\r\n }\r\n\r\n function readBytes32(string memory json, string memory key) internal returns (bytes32) {\r\n return vm.parseJsonBytes32(json, key);\r\n }\r\n\r\n function readBytes32Array(string memory json, string memory key) internal returns (bytes32[] memory) {\r\n return vm.parseJsonBytes32Array(json, key);\r\n }\r\n\r\n function readString(string memory json, string memory key) internal returns (string memory) {\r\n return vm.parseJsonString(json, key);\r\n }\r\n\r\n function readStringArray(string memory json, string memory key) internal returns (string[] memory) {\r\n return vm.parseJsonStringArray(json, key);\r\n }\r\n\r\n function readAddress(string memory json, string memory key) internal returns (address) {\r\n return vm.parseJsonAddress(json, key);\r\n }\r\n\r\n function readAddressArray(string memory json, string memory key) internal returns (address[] memory) {\r\n return vm.parseJsonAddressArray(json, key);\r\n }\r\n\r\n function readBool(string memory json, string memory key) internal returns (bool) {\r\n return vm.parseJsonBool(json, key);\r\n }\r\n\r\n function readBoolArray(string memory json, string memory key) internal returns (bool[] memory) {\r\n return vm.parseJsonBoolArray(json, key);\r\n }\r\n\r\n function readBytes(string memory json, string memory key) internal returns (bytes memory) {\r\n return vm.parseJsonBytes(json, key);\r\n }\r\n\r\n function readBytesArray(string memory json, string memory key) internal returns (bytes[] memory) {\r\n return vm.parseJsonBytesArray(json, key);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) {\r\n return vm.serializeBool(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, bool[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeBool(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) {\r\n return vm.serializeUint(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, uint256[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeUint(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) {\r\n return vm.serializeInt(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, int256[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeInt(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) {\r\n return vm.serializeAddress(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, address[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeAddress(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) {\r\n return vm.serializeBytes32(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, bytes32[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeBytes32(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) {\r\n return vm.serializeBytes(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, bytes[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeBytes(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, string memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeString(jsonKey, key, value);\r\n }\r\n\r\n function serialize(string memory jsonKey, string memory key, string[] memory value)\r\n internal\r\n returns (string memory)\r\n {\r\n return vm.serializeString(jsonKey, key, value);\r\n }\r\n\r\n function write(string memory jsonKey, string memory path) internal {\r\n vm.writeJson(jsonKey, path);\r\n }\r\n\r\n function write(string memory jsonKey, string memory path, string memory valueKey) internal {\r\n vm.writeJson(jsonKey, path, valueKey);\r\n }\r\n}\r\n" + }, + "forge-std/StdMath.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\nlibrary stdMath {\r\n int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968;\r\n\r\n function abs(int256 a) internal pure returns (uint256) {\r\n // Required or it will fail when `a = type(int256).min`\r\n if (a == INT256_MIN) {\r\n return 57896044618658097711785492504343953926634992332820282019728792003956564819968;\r\n }\r\n\r\n return uint256(a > 0 ? a : -a);\r\n }\r\n\r\n function delta(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a > b ? a - b : b - a;\r\n }\r\n\r\n function delta(int256 a, int256 b) internal pure returns (uint256) {\r\n // a and b are of the same sign\r\n // this works thanks to two's complement, the left-most bit is the sign bit\r\n if ((a ^ b) > -1) {\r\n return delta(abs(a), abs(b));\r\n }\r\n\r\n // a and b are of opposite signs\r\n return abs(a) + abs(b);\r\n }\r\n\r\n function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 absDelta = delta(a, b);\r\n\r\n return absDelta * 1e18 / b;\r\n }\r\n\r\n function percentDelta(int256 a, int256 b) internal pure returns (uint256) {\r\n uint256 absDelta = delta(a, b);\r\n uint256 absB = abs(b);\r\n\r\n return absDelta * 1e18 / absB;\r\n }\r\n}\r\n" + }, + "forge-std/StdStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\nimport {Vm} from \"./Vm.sol\";\r\n\r\nstruct StdStorage {\r\n mapping(address => mapping(bytes4 => mapping(bytes32 => uint256))) slots;\r\n mapping(address => mapping(bytes4 => mapping(bytes32 => bool))) finds;\r\n bytes32[] _keys;\r\n bytes4 _sig;\r\n uint256 _depth;\r\n address _target;\r\n bytes32 _set;\r\n}\r\n\r\nlibrary stdStorageSafe {\r\n event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot);\r\n event WARNING_UninitedSlot(address who, uint256 slot);\r\n\r\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n function sigs(string memory sigStr) internal pure returns (bytes4) {\r\n return bytes4(keccak256(bytes(sigStr)));\r\n }\r\n\r\n /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against\r\n // slot complexity:\r\n // if flat, will be bytes32(uint256(uint));\r\n // if map, will be keccak256(abi.encode(key, uint(slot)));\r\n // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))));\r\n // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth);\r\n function find(StdStorage storage self) internal returns (uint256) {\r\n address who = self._target;\r\n bytes4 fsig = self._sig;\r\n uint256 field_depth = self._depth;\r\n bytes32[] memory ins = self._keys;\r\n\r\n // calldata to test against\r\n if (self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\r\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\r\n }\r\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\r\n vm.record();\r\n bytes32 fdat;\r\n {\r\n (, bytes memory rdat) = who.staticcall(cald);\r\n fdat = bytesToBytes32(rdat, 32 * field_depth);\r\n }\r\n\r\n (bytes32[] memory reads,) = vm.accesses(address(who));\r\n if (reads.length == 1) {\r\n bytes32 curr = vm.load(who, reads[0]);\r\n if (curr == bytes32(0)) {\r\n emit WARNING_UninitedSlot(who, uint256(reads[0]));\r\n }\r\n if (fdat != curr) {\r\n require(\r\n false,\r\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\r\n );\r\n }\r\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[0]));\r\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[0]);\r\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\r\n } else if (reads.length > 1) {\r\n for (uint256 i = 0; i < reads.length; i++) {\r\n bytes32 prev = vm.load(who, reads[i]);\r\n if (prev == bytes32(0)) {\r\n emit WARNING_UninitedSlot(who, uint256(reads[i]));\r\n }\r\n // store\r\n vm.store(who, reads[i], bytes32(hex\"1337\"));\r\n bool success;\r\n bytes memory rdat;\r\n {\r\n (success, rdat) = who.staticcall(cald);\r\n fdat = bytesToBytes32(rdat, 32 * field_depth);\r\n }\r\n\r\n if (success && fdat == bytes32(hex\"1337\")) {\r\n // we found which of the slots is the actual one\r\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[i]));\r\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[i]);\r\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\r\n vm.store(who, reads[i], prev);\r\n break;\r\n }\r\n vm.store(who, reads[i], prev);\r\n }\r\n } else {\r\n revert(\"stdStorage find(StdStorage): No storage use detected for target.\");\r\n }\r\n\r\n require(\r\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))],\r\n \"stdStorage find(StdStorage): Slot(s) not found.\"\r\n );\r\n\r\n delete self._target;\r\n delete self._sig;\r\n delete self._keys;\r\n delete self._depth;\r\n\r\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\r\n }\r\n\r\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\r\n self._target = _target;\r\n return self;\r\n }\r\n\r\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\r\n self._sig = _sig;\r\n return self;\r\n }\r\n\r\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\r\n self._sig = sigs(_sig);\r\n return self;\r\n }\r\n\r\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\r\n self._keys.push(bytes32(uint256(uint160(who))));\r\n return self;\r\n }\r\n\r\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\r\n self._keys.push(bytes32(amt));\r\n return self;\r\n }\r\n\r\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\r\n self._keys.push(key);\r\n return self;\r\n }\r\n\r\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\r\n self._depth = _depth;\r\n return self;\r\n }\r\n\r\n function read(StdStorage storage self) private returns (bytes memory) {\r\n address t = self._target;\r\n uint256 s = find(self);\r\n return abi.encode(vm.load(t, bytes32(s)));\r\n }\r\n\r\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\r\n return abi.decode(read(self), (bytes32));\r\n }\r\n\r\n function read_bool(StdStorage storage self) internal returns (bool) {\r\n int256 v = read_int(self);\r\n if (v == 0) return false;\r\n if (v == 1) return true;\r\n revert(\"stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool.\");\r\n }\r\n\r\n function read_address(StdStorage storage self) internal returns (address) {\r\n return abi.decode(read(self), (address));\r\n }\r\n\r\n function read_uint(StdStorage storage self) internal returns (uint256) {\r\n return abi.decode(read(self), (uint256));\r\n }\r\n\r\n function read_int(StdStorage storage self) internal returns (int256) {\r\n return abi.decode(read(self), (int256));\r\n }\r\n\r\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\r\n bytes32 out;\r\n\r\n uint256 max = b.length > 32 ? 32 : b.length;\r\n for (uint256 i = 0; i < max; i++) {\r\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\r\n }\r\n return out;\r\n }\r\n\r\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\r\n bytes memory result = new bytes(b.length * 32);\r\n for (uint256 i = 0; i < b.length; i++) {\r\n bytes32 k = b[i];\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n mstore(add(result, add(32, mul(32, i))), k)\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nlibrary stdStorage {\r\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n function sigs(string memory sigStr) internal pure returns (bytes4) {\r\n return stdStorageSafe.sigs(sigStr);\r\n }\r\n\r\n function find(StdStorage storage self) internal returns (uint256) {\r\n return stdStorageSafe.find(self);\r\n }\r\n\r\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\r\n return stdStorageSafe.target(self, _target);\r\n }\r\n\r\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\r\n return stdStorageSafe.sig(self, _sig);\r\n }\r\n\r\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\r\n return stdStorageSafe.sig(self, _sig);\r\n }\r\n\r\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\r\n return stdStorageSafe.with_key(self, who);\r\n }\r\n\r\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\r\n return stdStorageSafe.with_key(self, amt);\r\n }\r\n\r\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\r\n return stdStorageSafe.with_key(self, key);\r\n }\r\n\r\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\r\n return stdStorageSafe.depth(self, _depth);\r\n }\r\n\r\n function checked_write(StdStorage storage self, address who) internal {\r\n checked_write(self, bytes32(uint256(uint160(who))));\r\n }\r\n\r\n function checked_write(StdStorage storage self, uint256 amt) internal {\r\n checked_write(self, bytes32(amt));\r\n }\r\n\r\n function checked_write(StdStorage storage self, bool write) internal {\r\n bytes32 t;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n t := write\r\n }\r\n checked_write(self, t);\r\n }\r\n\r\n function checked_write(StdStorage storage self, bytes32 set) internal {\r\n address who = self._target;\r\n bytes4 fsig = self._sig;\r\n uint256 field_depth = self._depth;\r\n bytes32[] memory ins = self._keys;\r\n\r\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\r\n if (!self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\r\n find(self);\r\n }\r\n bytes32 slot = bytes32(self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]);\r\n\r\n bytes32 fdat;\r\n {\r\n (, bytes memory rdat) = who.staticcall(cald);\r\n fdat = bytesToBytes32(rdat, 32 * field_depth);\r\n }\r\n bytes32 curr = vm.load(who, slot);\r\n\r\n if (fdat != curr) {\r\n require(\r\n false,\r\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\r\n );\r\n }\r\n vm.store(who, slot, set);\r\n delete self._target;\r\n delete self._sig;\r\n delete self._keys;\r\n delete self._depth;\r\n }\r\n\r\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\r\n return stdStorageSafe.read_bytes32(self);\r\n }\r\n\r\n function read_bool(StdStorage storage self) internal returns (bool) {\r\n return stdStorageSafe.read_bool(self);\r\n }\r\n\r\n function read_address(StdStorage storage self) internal returns (address) {\r\n return stdStorageSafe.read_address(self);\r\n }\r\n\r\n function read_uint(StdStorage storage self) internal returns (uint256) {\r\n return stdStorageSafe.read_uint(self);\r\n }\r\n\r\n function read_int(StdStorage storage self) internal returns (int256) {\r\n return stdStorageSafe.read_int(self);\r\n }\r\n\r\n // Private function so needs to be copied over\r\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\r\n bytes32 out;\r\n\r\n uint256 max = b.length > 32 ? 32 : b.length;\r\n for (uint256 i = 0; i < max; i++) {\r\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\r\n }\r\n return out;\r\n }\r\n\r\n // Private function so needs to be copied over\r\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\r\n bytes memory result = new bytes(b.length * 32);\r\n for (uint256 i = 0; i < b.length; i++) {\r\n bytes32 k = b[i];\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n mstore(add(result, add(32, mul(32, i))), k)\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n" + }, + "forge-std/StdStyle.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.4.22 <0.9.0;\r\n\r\nimport {Vm} from \"./Vm.sol\";\r\n\r\nlibrary StdStyle {\r\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n\r\n string constant RED = \"\\u001b[91m\";\r\n string constant GREEN = \"\\u001b[92m\";\r\n string constant YELLOW = \"\\u001b[93m\";\r\n string constant BLUE = \"\\u001b[94m\";\r\n string constant MAGENTA = \"\\u001b[95m\";\r\n string constant CYAN = \"\\u001b[96m\";\r\n string constant BOLD = \"\\u001b[1m\";\r\n string constant DIM = \"\\u001b[2m\";\r\n string constant ITALIC = \"\\u001b[3m\";\r\n string constant UNDERLINE = \"\\u001b[4m\";\r\n string constant INVERSE = \"\\u001b[7m\";\r\n string constant RESET = \"\\u001b[0m\";\r\n\r\n function styleConcat(string memory style, string memory self) private pure returns (string memory) {\r\n return string(abi.encodePacked(style, self, RESET));\r\n }\r\n\r\n function red(string memory self) internal pure returns (string memory) {\r\n return styleConcat(RED, self);\r\n }\r\n\r\n function red(uint256 self) internal pure returns (string memory) {\r\n return red(vm.toString(self));\r\n }\r\n\r\n function red(int256 self) internal pure returns (string memory) {\r\n return red(vm.toString(self));\r\n }\r\n\r\n function red(address self) internal pure returns (string memory) {\r\n return red(vm.toString(self));\r\n }\r\n\r\n function red(bool self) internal pure returns (string memory) {\r\n return red(vm.toString(self));\r\n }\r\n\r\n function redBytes(bytes memory self) internal pure returns (string memory) {\r\n return red(vm.toString(self));\r\n }\r\n\r\n function redBytes32(bytes32 self) internal pure returns (string memory) {\r\n return red(vm.toString(self));\r\n }\r\n\r\n function green(string memory self) internal pure returns (string memory) {\r\n return styleConcat(GREEN, self);\r\n }\r\n\r\n function green(uint256 self) internal pure returns (string memory) {\r\n return green(vm.toString(self));\r\n }\r\n\r\n function green(int256 self) internal pure returns (string memory) {\r\n return green(vm.toString(self));\r\n }\r\n\r\n function green(address self) internal pure returns (string memory) {\r\n return green(vm.toString(self));\r\n }\r\n\r\n function green(bool self) internal pure returns (string memory) {\r\n return green(vm.toString(self));\r\n }\r\n\r\n function greenBytes(bytes memory self) internal pure returns (string memory) {\r\n return green(vm.toString(self));\r\n }\r\n\r\n function greenBytes32(bytes32 self) internal pure returns (string memory) {\r\n return green(vm.toString(self));\r\n }\r\n\r\n function yellow(string memory self) internal pure returns (string memory) {\r\n return styleConcat(YELLOW, self);\r\n }\r\n\r\n function yellow(uint256 self) internal pure returns (string memory) {\r\n return yellow(vm.toString(self));\r\n }\r\n\r\n function yellow(int256 self) internal pure returns (string memory) {\r\n return yellow(vm.toString(self));\r\n }\r\n\r\n function yellow(address self) internal pure returns (string memory) {\r\n return yellow(vm.toString(self));\r\n }\r\n\r\n function yellow(bool self) internal pure returns (string memory) {\r\n return yellow(vm.toString(self));\r\n }\r\n\r\n function yellowBytes(bytes memory self) internal pure returns (string memory) {\r\n return yellow(vm.toString(self));\r\n }\r\n\r\n function yellowBytes32(bytes32 self) internal pure returns (string memory) {\r\n return yellow(vm.toString(self));\r\n }\r\n\r\n function blue(string memory self) internal pure returns (string memory) {\r\n return styleConcat(BLUE, self);\r\n }\r\n\r\n function blue(uint256 self) internal pure returns (string memory) {\r\n return blue(vm.toString(self));\r\n }\r\n\r\n function blue(int256 self) internal pure returns (string memory) {\r\n return blue(vm.toString(self));\r\n }\r\n\r\n function blue(address self) internal pure returns (string memory) {\r\n return blue(vm.toString(self));\r\n }\r\n\r\n function blue(bool self) internal pure returns (string memory) {\r\n return blue(vm.toString(self));\r\n }\r\n\r\n function blueBytes(bytes memory self) internal pure returns (string memory) {\r\n return blue(vm.toString(self));\r\n }\r\n\r\n function blueBytes32(bytes32 self) internal pure returns (string memory) {\r\n return blue(vm.toString(self));\r\n }\r\n\r\n function magenta(string memory self) internal pure returns (string memory) {\r\n return styleConcat(MAGENTA, self);\r\n }\r\n\r\n function magenta(uint256 self) internal pure returns (string memory) {\r\n return magenta(vm.toString(self));\r\n }\r\n\r\n function magenta(int256 self) internal pure returns (string memory) {\r\n return magenta(vm.toString(self));\r\n }\r\n\r\n function magenta(address self) internal pure returns (string memory) {\r\n return magenta(vm.toString(self));\r\n }\r\n\r\n function magenta(bool self) internal pure returns (string memory) {\r\n return magenta(vm.toString(self));\r\n }\r\n\r\n function magentaBytes(bytes memory self) internal pure returns (string memory) {\r\n return magenta(vm.toString(self));\r\n }\r\n\r\n function magentaBytes32(bytes32 self) internal pure returns (string memory) {\r\n return magenta(vm.toString(self));\r\n }\r\n\r\n function cyan(string memory self) internal pure returns (string memory) {\r\n return styleConcat(CYAN, self);\r\n }\r\n\r\n function cyan(uint256 self) internal pure returns (string memory) {\r\n return cyan(vm.toString(self));\r\n }\r\n\r\n function cyan(int256 self) internal pure returns (string memory) {\r\n return cyan(vm.toString(self));\r\n }\r\n\r\n function cyan(address self) internal pure returns (string memory) {\r\n return cyan(vm.toString(self));\r\n }\r\n\r\n function cyan(bool self) internal pure returns (string memory) {\r\n return cyan(vm.toString(self));\r\n }\r\n\r\n function cyanBytes(bytes memory self) internal pure returns (string memory) {\r\n return cyan(vm.toString(self));\r\n }\r\n\r\n function cyanBytes32(bytes32 self) internal pure returns (string memory) {\r\n return cyan(vm.toString(self));\r\n }\r\n\r\n function bold(string memory self) internal pure returns (string memory) {\r\n return styleConcat(BOLD, self);\r\n }\r\n\r\n function bold(uint256 self) internal pure returns (string memory) {\r\n return bold(vm.toString(self));\r\n }\r\n\r\n function bold(int256 self) internal pure returns (string memory) {\r\n return bold(vm.toString(self));\r\n }\r\n\r\n function bold(address self) internal pure returns (string memory) {\r\n return bold(vm.toString(self));\r\n }\r\n\r\n function bold(bool self) internal pure returns (string memory) {\r\n return bold(vm.toString(self));\r\n }\r\n\r\n function boldBytes(bytes memory self) internal pure returns (string memory) {\r\n return bold(vm.toString(self));\r\n }\r\n\r\n function boldBytes32(bytes32 self) internal pure returns (string memory) {\r\n return bold(vm.toString(self));\r\n }\r\n\r\n function dim(string memory self) internal pure returns (string memory) {\r\n return styleConcat(DIM, self);\r\n }\r\n\r\n function dim(uint256 self) internal pure returns (string memory) {\r\n return dim(vm.toString(self));\r\n }\r\n\r\n function dim(int256 self) internal pure returns (string memory) {\r\n return dim(vm.toString(self));\r\n }\r\n\r\n function dim(address self) internal pure returns (string memory) {\r\n return dim(vm.toString(self));\r\n }\r\n\r\n function dim(bool self) internal pure returns (string memory) {\r\n return dim(vm.toString(self));\r\n }\r\n\r\n function dimBytes(bytes memory self) internal pure returns (string memory) {\r\n return dim(vm.toString(self));\r\n }\r\n\r\n function dimBytes32(bytes32 self) internal pure returns (string memory) {\r\n return dim(vm.toString(self));\r\n }\r\n\r\n function italic(string memory self) internal pure returns (string memory) {\r\n return styleConcat(ITALIC, self);\r\n }\r\n\r\n function italic(uint256 self) internal pure returns (string memory) {\r\n return italic(vm.toString(self));\r\n }\r\n\r\n function italic(int256 self) internal pure returns (string memory) {\r\n return italic(vm.toString(self));\r\n }\r\n\r\n function italic(address self) internal pure returns (string memory) {\r\n return italic(vm.toString(self));\r\n }\r\n\r\n function italic(bool self) internal pure returns (string memory) {\r\n return italic(vm.toString(self));\r\n }\r\n\r\n function italicBytes(bytes memory self) internal pure returns (string memory) {\r\n return italic(vm.toString(self));\r\n }\r\n\r\n function italicBytes32(bytes32 self) internal pure returns (string memory) {\r\n return italic(vm.toString(self));\r\n }\r\n\r\n function underline(string memory self) internal pure returns (string memory) {\r\n return styleConcat(UNDERLINE, self);\r\n }\r\n\r\n function underline(uint256 self) internal pure returns (string memory) {\r\n return underline(vm.toString(self));\r\n }\r\n\r\n function underline(int256 self) internal pure returns (string memory) {\r\n return underline(vm.toString(self));\r\n }\r\n\r\n function underline(address self) internal pure returns (string memory) {\r\n return underline(vm.toString(self));\r\n }\r\n\r\n function underline(bool self) internal pure returns (string memory) {\r\n return underline(vm.toString(self));\r\n }\r\n\r\n function underlineBytes(bytes memory self) internal pure returns (string memory) {\r\n return underline(vm.toString(self));\r\n }\r\n\r\n function underlineBytes32(bytes32 self) internal pure returns (string memory) {\r\n return underline(vm.toString(self));\r\n }\r\n\r\n function inverse(string memory self) internal pure returns (string memory) {\r\n return styleConcat(INVERSE, self);\r\n }\r\n\r\n function inverse(uint256 self) internal pure returns (string memory) {\r\n return inverse(vm.toString(self));\r\n }\r\n\r\n function inverse(int256 self) internal pure returns (string memory) {\r\n return inverse(vm.toString(self));\r\n }\r\n\r\n function inverse(address self) internal pure returns (string memory) {\r\n return inverse(vm.toString(self));\r\n }\r\n\r\n function inverse(bool self) internal pure returns (string memory) {\r\n return inverse(vm.toString(self));\r\n }\r\n\r\n function inverseBytes(bytes memory self) internal pure returns (string memory) {\r\n return inverse(vm.toString(self));\r\n }\r\n\r\n function inverseBytes32(bytes32 self) internal pure returns (string memory) {\r\n return inverse(vm.toString(self));\r\n }\r\n}\r\n" + }, + "forge-std/StdUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\nimport {IMulticall3} from \"./interfaces/IMulticall3.sol\";\r\n// TODO Remove import.\r\nimport {VmSafe} from \"./Vm.sol\";\r\n\r\nabstract contract StdUtils {\r\n /*//////////////////////////////////////////////////////////////////////////\r\n CONSTANTS\r\n //////////////////////////////////////////////////////////////////////////*/\r\n\r\n IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11);\r\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\r\n address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;\r\n uint256 private constant INT256_MIN_ABS =\r\n 57896044618658097711785492504343953926634992332820282019728792003956564819968;\r\n uint256 private constant UINT256_MAX =\r\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\r\n\r\n // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\r\n address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\r\n\r\n /*//////////////////////////////////////////////////////////////////////////\r\n INTERNAL FUNCTIONS\r\n //////////////////////////////////////////////////////////////////////////*/\r\n\r\n function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) {\r\n require(min <= max, \"StdUtils bound(uint256,uint256,uint256): Max is less than min.\");\r\n // If x is between min and max, return x directly. This is to ensure that dictionary values\r\n // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188\r\n if (x >= min && x <= max) return x;\r\n\r\n uint256 size = max - min + 1;\r\n\r\n // If the value is 0, 1, 2, 3, warp that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side.\r\n // This helps ensure coverage of the min/max values.\r\n if (x <= 3 && size > x) return min + x;\r\n if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x);\r\n\r\n // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive.\r\n if (x > max) {\r\n uint256 diff = x - max;\r\n uint256 rem = diff % size;\r\n if (rem == 0) return max;\r\n result = min + rem - 1;\r\n } else if (x < min) {\r\n uint256 diff = min - x;\r\n uint256 rem = diff % size;\r\n if (rem == 0) return min;\r\n result = max - rem + 1;\r\n }\r\n }\r\n\r\n function bound(uint256 x, uint256 min, uint256 max) internal view virtual returns (uint256 result) {\r\n result = _bound(x, min, max);\r\n console2_log(\"Bound Result\", result);\r\n }\r\n\r\n function bound(int256 x, int256 min, int256 max) internal view virtual returns (int256 result) {\r\n require(min <= max, \"StdUtils bound(int256,int256,int256): Max is less than min.\");\r\n\r\n // Shifting all int256 values to uint256 to use _bound function. The range of two types are:\r\n // int256 : -(2**255) ~ (2**255 - 1)\r\n // uint256: 0 ~ (2**256 - 1)\r\n // So, add 2**255, INT256_MIN_ABS to the integer values.\r\n //\r\n // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow.\r\n // So, use `~uint256(x) + 1` instead.\r\n uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS);\r\n uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS);\r\n uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS);\r\n\r\n uint256 y = _bound(_x, _min, _max);\r\n\r\n // To move it back to int256 value, subtract INT256_MIN_ABS at here.\r\n result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS);\r\n console2_log(\"Bound result\", vm.toString(result));\r\n }\r\n\r\n function bytesToUint(bytes memory b) internal pure virtual returns (uint256) {\r\n require(b.length <= 32, \"StdUtils bytesToUint(bytes): Bytes length exceeds 32.\");\r\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\r\n }\r\n\r\n /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce\r\n /// @notice adapted from Solmate implementation (https://github.com/Rari-Capital/solmate/blob/main/src/utils/LibRLP.sol)\r\n function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) {\r\n // forgefmt: disable-start\r\n // The integer zero is treated as an empty byte string, and as a result it only has a length prefix, 0x80, computed via 0x80 + 0.\r\n // A one byte integer uses its own value as its length prefix, there is no additional \"0x80 + length\" prefix that comes before it.\r\n if (nonce == 0x00) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, bytes1(0x80))));\r\n if (nonce <= 0x7f) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, uint8(nonce))));\r\n\r\n // Nonces greater than 1 byte all follow a consistent encoding scheme, where each value is preceded by a prefix of 0x80 + length.\r\n if (nonce <= 2**8 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd7), bytes1(0x94), deployer, bytes1(0x81), uint8(nonce))));\r\n if (nonce <= 2**16 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd8), bytes1(0x94), deployer, bytes1(0x82), uint16(nonce))));\r\n if (nonce <= 2**24 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd9), bytes1(0x94), deployer, bytes1(0x83), uint24(nonce))));\r\n // forgefmt: disable-end\r\n\r\n // More details about RLP encoding can be found here: https://eth.wiki/fundamentals/rlp\r\n // 0xda = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x84 ++ nonce)\r\n // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)\r\n // 0x84 = 0x80 + 0x04 (0x04 = the bytes length of the nonce, 4 bytes, in hex)\r\n // We assume nobody can have a nonce large enough to require more than 32 bytes.\r\n return addressFromLast20Bytes(\r\n keccak256(abi.encodePacked(bytes1(0xda), bytes1(0x94), deployer, bytes1(0x84), uint32(nonce)))\r\n );\r\n }\r\n\r\n function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer)\r\n internal\r\n pure\r\n virtual\r\n returns (address)\r\n {\r\n return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, initcodeHash)));\r\n }\r\n\r\n /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer\r\n function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) {\r\n return computeCreate2Address(salt, initCodeHash, CREATE2_FACTORY);\r\n }\r\n\r\n /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments\r\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\r\n function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) {\r\n return hashInitCode(creationCode, \"\");\r\n }\r\n\r\n /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2\r\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\r\n /// @param args the ABI-encoded arguments to the constructor of C\r\n function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) {\r\n return keccak256(abi.encodePacked(creationCode, args));\r\n }\r\n\r\n // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses.\r\n function getTokenBalances(address token, address[] memory addresses)\r\n internal\r\n virtual\r\n returns (uint256[] memory balances)\r\n {\r\n uint256 tokenCodeSize;\r\n assembly {\r\n tokenCodeSize := extcodesize(token)\r\n }\r\n require(tokenCodeSize > 0, \"StdUtils getTokenBalances(address,address[]): Token address is not a contract.\");\r\n\r\n // ABI encode the aggregate call to Multicall3.\r\n uint256 length = addresses.length;\r\n IMulticall3.Call[] memory calls = new IMulticall3.Call[](length);\r\n for (uint256 i = 0; i < length; ++i) {\r\n // 0x70a08231 = bytes4(\"balanceOf(address)\"))\r\n calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))});\r\n }\r\n\r\n // Make the aggregate call.\r\n (, bytes[] memory returnData) = multicall.aggregate(calls);\r\n\r\n // ABI decode the return data and return the balances.\r\n balances = new uint256[](length);\r\n for (uint256 i = 0; i < length; ++i) {\r\n balances[i] = abi.decode(returnData[i], (uint256));\r\n }\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////////////////\r\n PRIVATE FUNCTIONS\r\n //////////////////////////////////////////////////////////////////////////*/\r\n\r\n function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) {\r\n return address(uint160(uint256(bytesValue)));\r\n }\r\n\r\n // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere.\r\n\r\n function console2_log(string memory p0, uint256 p1) private view {\r\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\r\n status;\r\n }\r\n\r\n function console2_log(string memory p0, string memory p1) private view {\r\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\r\n status;\r\n }\r\n}\r\n" + }, + "forge-std/Test.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\n// 💬 ABOUT\r\n// Standard Library's default Test\r\n\r\n// 🧩 MODULES\r\nimport {console} from \"./console.sol\";\r\nimport {console2} from \"./console2.sol\";\r\nimport {StdAssertions} from \"./StdAssertions.sol\";\r\nimport {StdChains} from \"./StdChains.sol\";\r\nimport {StdCheats} from \"./StdCheats.sol\";\r\nimport {stdError} from \"./StdError.sol\";\r\nimport {StdInvariant} from \"./StdInvariant.sol\";\r\nimport {stdJson} from \"./StdJson.sol\";\r\nimport {stdMath} from \"./StdMath.sol\";\r\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\r\nimport {StdUtils} from \"./StdUtils.sol\";\r\nimport {Vm} from \"./Vm.sol\";\r\nimport {StdStyle} from \"./StdStyle.sol\";\r\n\r\n// 📦 BOILERPLATE\r\nimport {TestBase} from \"./Base.sol\";\r\nimport {DSTest} from \"ds-test/test.sol\";\r\n\r\n// ⭐️ TEST\r\nabstract contract Test is DSTest, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils, TestBase {\r\n// Note: IS_TEST() must return true.\r\n// Note: Must have failure system, https://github.com/dapphub/ds-test/blob/cd98eff28324bfac652e63a239a60632a761790b/src/test.sol#L39-L76.\r\n}\r\n" + }, + "forge-std/Vm.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.6.2 <0.9.0;\r\n\r\npragma experimental ABIEncoderV2;\r\n\r\n// Cheatcodes are marked as view/pure/none using the following rules:\r\n// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,\r\n// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure (you are modifying some state be it the EVM, interpreter, filesystem, etc),\r\n// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,\r\n// 3. Otherwise you're `pure`.\r\n\r\ninterface VmSafe {\r\n struct Log {\r\n bytes32[] topics;\r\n bytes data;\r\n address emitter;\r\n }\r\n\r\n struct Rpc {\r\n string key;\r\n string url;\r\n }\r\n\r\n struct FsMetadata {\r\n bool isDir;\r\n bool isSymlink;\r\n uint256 length;\r\n bool readOnly;\r\n uint256 modified;\r\n uint256 accessed;\r\n uint256 created;\r\n }\r\n\r\n // Loads a storage slot from an address\r\n function load(address target, bytes32 slot) external view returns (bytes32 data);\r\n // Signs data\r\n function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);\r\n // Gets the address for a given private key\r\n function addr(uint256 privateKey) external pure returns (address keyAddr);\r\n // Gets the nonce of an account\r\n function getNonce(address account) external view returns (uint64 nonce);\r\n // Performs a foreign function call via the terminal\r\n function ffi(string[] calldata commandInput) external returns (bytes memory result);\r\n // Sets environment variables\r\n function setEnv(string calldata name, string calldata value) external;\r\n // Reads environment variables, (name) => (value)\r\n function envBool(string calldata name) external view returns (bool value);\r\n function envUint(string calldata name) external view returns (uint256 value);\r\n function envInt(string calldata name) external view returns (int256 value);\r\n function envAddress(string calldata name) external view returns (address value);\r\n function envBytes32(string calldata name) external view returns (bytes32 value);\r\n function envString(string calldata name) external view returns (string memory value);\r\n function envBytes(string calldata name) external view returns (bytes memory value);\r\n // Reads environment variables as arrays\r\n function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);\r\n function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);\r\n function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);\r\n function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);\r\n function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);\r\n function envString(string calldata name, string calldata delim) external view returns (string[] memory value);\r\n function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);\r\n // Read environment variables with default value\r\n function envOr(string calldata name, bool defaultValue) external returns (bool value);\r\n function envOr(string calldata name, uint256 defaultValue) external returns (uint256 value);\r\n function envOr(string calldata name, int256 defaultValue) external returns (int256 value);\r\n function envOr(string calldata name, address defaultValue) external returns (address value);\r\n function envOr(string calldata name, bytes32 defaultValue) external returns (bytes32 value);\r\n function envOr(string calldata name, string calldata defaultValue) external returns (string memory value);\r\n function envOr(string calldata name, bytes calldata defaultValue) external returns (bytes memory value);\r\n // Read environment variables as arrays with default value\r\n function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)\r\n external\r\n returns (bool[] memory value);\r\n function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)\r\n external\r\n returns (uint256[] memory value);\r\n function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)\r\n external\r\n returns (int256[] memory value);\r\n function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)\r\n external\r\n returns (address[] memory value);\r\n function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)\r\n external\r\n returns (bytes32[] memory value);\r\n function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)\r\n external\r\n returns (string[] memory value);\r\n function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)\r\n external\r\n returns (bytes[] memory value);\r\n // Records all storage reads and writes\r\n function record() external;\r\n // Gets all accessed reads and write slot from a recording session, for a given address\r\n function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);\r\n // Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file\r\n function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);\r\n // Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file\r\n function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);\r\n // Labels an address in call traces\r\n function label(address account, string calldata newLabel) external;\r\n // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain\r\n function broadcast() external;\r\n // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain\r\n function broadcast(address signer) external;\r\n // Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain\r\n function broadcast(uint256 privateKey) external;\r\n // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain\r\n function startBroadcast() external;\r\n // Has all subsequent calls (at this call depth only) create transactions with the address provided that can later be signed and sent onchain\r\n function startBroadcast(address signer) external;\r\n // Has all subsequent calls (at this call depth only) create transactions with the private key provided that can later be signed and sent onchain\r\n function startBroadcast(uint256 privateKey) external;\r\n // Stops collecting onchain transactions\r\n function stopBroadcast() external;\r\n // Reads the entire content of file to string\r\n function readFile(string calldata path) external view returns (string memory data);\r\n // Reads the entire content of file as binary. Path is relative to the project root.\r\n function readFileBinary(string calldata path) external view returns (bytes memory data);\r\n // Get the path of the current project root\r\n function projectRoot() external view returns (string memory path);\r\n // Get the metadata for a file/directory\r\n function fsMetadata(string calldata fileOrDir) external returns (FsMetadata memory metadata);\r\n // Reads next line of file to string\r\n function readLine(string calldata path) external view returns (string memory line);\r\n // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.\r\n function writeFile(string calldata path, string calldata data) external;\r\n // Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.\r\n // Path is relative to the project root.\r\n function writeFileBinary(string calldata path, bytes calldata data) external;\r\n // Writes line to file, creating a file if it does not exist.\r\n function writeLine(string calldata path, string calldata data) external;\r\n // Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.\r\n function closeFile(string calldata path) external;\r\n // Removes file. This cheatcode will revert in the following situations, but is not limited to just these cases:\r\n // - Path points to a directory.\r\n // - The file doesn't exist.\r\n // - The user lacks permissions to remove the file.\r\n function removeFile(string calldata path) external;\r\n // Convert values to a string\r\n function toString(address value) external pure returns (string memory stringifiedValue);\r\n function toString(bytes calldata value) external pure returns (string memory stringifiedValue);\r\n function toString(bytes32 value) external pure returns (string memory stringifiedValue);\r\n function toString(bool value) external pure returns (string memory stringifiedValue);\r\n function toString(uint256 value) external pure returns (string memory stringifiedValue);\r\n function toString(int256 value) external pure returns (string memory stringifiedValue);\r\n // Convert values from a string\r\n function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);\r\n function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);\r\n function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);\r\n function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);\r\n function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);\r\n function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);\r\n // Record all the transaction logs\r\n function recordLogs() external;\r\n // Gets all the recorded logs\r\n function getRecordedLogs() external returns (Log[] memory logs);\r\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path m/44'/60'/0'/0/{index}\r\n function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);\r\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at {derivationPath}{index}\r\n function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)\r\n external\r\n pure\r\n returns (uint256 privateKey);\r\n // Adds a private key to the local forge wallet and returns the address\r\n function rememberKey(uint256 privateKey) external returns (address keyAddr);\r\n //\r\n // parseJson\r\n //\r\n // ----\r\n // In case the returned value is a JSON object, it's encoded as a ABI-encoded tuple. As JSON objects\r\n // don't have the notion of ordered, but tuples do, they JSON object is encoded with it's fields ordered in\r\n // ALPHABETICAL order. That means that in order to successfully decode the tuple, we need to define a tuple that\r\n // encodes the fields in the same order, which is alphabetical. In the case of Solidity structs, they are encoded\r\n // as tuples, with the attributes in the order in which they are defined.\r\n // For example: json = { 'a': 1, 'b': 0xa4tb......3xs}\r\n // a: uint256\r\n // b: address\r\n // To decode that json, we need to define a struct or a tuple as follows:\r\n // struct json = { uint256 a; address b; }\r\n // If we defined a json struct with the opposite order, meaning placing the address b first, it would try to\r\n // decode the tuple in that order, and thus fail.\r\n // ----\r\n // Given a string of JSON, return it as ABI-encoded\r\n function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);\r\n function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);\r\n\r\n // The following parseJson cheatcodes will do type coercion, for the type that they indicate.\r\n // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12'\r\n // and hex numbers '0xEF'.\r\n // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not\r\n // a JSON object.\r\n function parseJsonUint(string calldata, string calldata) external returns (uint256);\r\n function parseJsonUintArray(string calldata, string calldata) external returns (uint256[] memory);\r\n function parseJsonInt(string calldata, string calldata) external returns (int256);\r\n function parseJsonIntArray(string calldata, string calldata) external returns (int256[] memory);\r\n function parseJsonBool(string calldata, string calldata) external returns (bool);\r\n function parseJsonBoolArray(string calldata, string calldata) external returns (bool[] memory);\r\n function parseJsonAddress(string calldata, string calldata) external returns (address);\r\n function parseJsonAddressArray(string calldata, string calldata) external returns (address[] memory);\r\n function parseJsonString(string calldata, string calldata) external returns (string memory);\r\n function parseJsonStringArray(string calldata, string calldata) external returns (string[] memory);\r\n function parseJsonBytes(string calldata, string calldata) external returns (bytes memory);\r\n function parseJsonBytesArray(string calldata, string calldata) external returns (bytes[] memory);\r\n function parseJsonBytes32(string calldata, string calldata) external returns (bytes32);\r\n function parseJsonBytes32Array(string calldata, string calldata) external returns (bytes32[] memory);\r\n\r\n // Serialize a key and value to a JSON object stored in-memory that can be later written to a file\r\n // It returns the stringified version of the specific JSON file up to that moment.\r\n function serializeBool(string calldata objectKey, string calldata valueKey, bool value)\r\n external\r\n returns (string memory json);\r\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)\r\n external\r\n returns (string memory json);\r\n function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)\r\n external\r\n returns (string memory json);\r\n function serializeAddress(string calldata objectKey, string calldata valueKey, address value)\r\n external\r\n returns (string memory json);\r\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)\r\n external\r\n returns (string memory json);\r\n function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)\r\n external\r\n returns (string memory json);\r\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)\r\n external\r\n returns (string memory json);\r\n\r\n function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)\r\n external\r\n returns (string memory json);\r\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)\r\n external\r\n returns (string memory json);\r\n function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)\r\n external\r\n returns (string memory json);\r\n function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)\r\n external\r\n returns (string memory json);\r\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)\r\n external\r\n returns (string memory json);\r\n function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)\r\n external\r\n returns (string memory json);\r\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)\r\n external\r\n returns (string memory json);\r\n\r\n //\r\n // writeJson\r\n //\r\n // ----\r\n // Write a serialized JSON object to a file. If the file exists, it will be overwritten.\r\n // Let's assume we want to write the following JSON to a file:\r\n //\r\n // { \"boolean\": true, \"number\": 342, \"object\": { \"title\": \"finally json serialization\" } }\r\n //\r\n // ```\r\n // string memory json1 = \"some key\";\r\n // vm.serializeBool(json1, \"boolean\", true);\r\n // vm.serializeBool(json1, \"number\", uint256(342));\r\n // json2 = \"some other key\";\r\n // string memory output = vm.serializeString(json2, \"title\", \"finally json serialization\");\r\n // string memory finalJson = vm.serialize(json1, \"object\", output);\r\n // vm.writeJson(finalJson, \"./output/example.json\");\r\n // ```\r\n // The critical insight is that every invocation of serialization will return the stringified version of the JSON\r\n // up to that point. That means we can construct arbitrary JSON objects and then use the return stringified version\r\n // to serialize them as values to another JSON object.\r\n //\r\n // json1 and json2 are simply keys used by the backend to keep track of the objects. So vm.serializeJson(json1,..)\r\n // will find the object in-memory that is keyed by \"some key\".\r\n function writeJson(string calldata json, string calldata path) external;\r\n // Write a serialized JSON object to an **existing** JSON file, replacing a value with key = \r\n // This is useful to replace a specific value of a JSON file, without having to parse the entire thing\r\n function writeJson(string calldata json, string calldata path, string calldata valueKey) external;\r\n // Returns the RPC url for the given alias\r\n function rpcUrl(string calldata rpcAlias) external view returns (string memory json);\r\n // Returns all rpc urls and their aliases `[alias, url][]`\r\n function rpcUrls() external view returns (string[2][] memory urls);\r\n // Returns all rpc urls and their aliases as structs.\r\n function rpcUrlStructs() external view returns (Rpc[] memory urls);\r\n // If the condition is false, discard this run's fuzz inputs and generate new ones.\r\n function assume(bool condition) external pure;\r\n // Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.\r\n function pauseGasMetering() external;\r\n // Resumes gas metering (i.e. gas usage is counted again). Noop if already on.\r\n function resumeGasMetering() external;\r\n}\r\n\r\ninterface Vm is VmSafe {\r\n // Sets block.timestamp\r\n function warp(uint256 newTimestamp) external;\r\n // Sets block.height\r\n function roll(uint256 newHeight) external;\r\n // Sets block.basefee\r\n function fee(uint256 newBasefee) external;\r\n // Sets block.difficulty\r\n function difficulty(uint256 newDifficulty) external;\r\n // Sets block.chainid\r\n function chainId(uint256 newChainId) external;\r\n // Stores a value to an address' storage slot.\r\n function store(address target, bytes32 slot, bytes32 value) external;\r\n // Sets the nonce of an account; must be higher than the current nonce of the account\r\n function setNonce(address account, uint64 newNonce) external;\r\n // Sets the *next* call's msg.sender to be the input address\r\n function prank(address msgSender) external;\r\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called\r\n function startPrank(address msgSender) external;\r\n // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input\r\n function prank(address msgSender, address txOrigin) external;\r\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input\r\n function startPrank(address msgSender, address txOrigin) external;\r\n // Resets subsequent calls' msg.sender to be `address(this)`\r\n function stopPrank() external;\r\n // Sets an address' balance\r\n function deal(address account, uint256 newBalance) external;\r\n // Sets an address' code\r\n function etch(address target, bytes calldata newRuntimeBytecode) external;\r\n // Expects an error on next call\r\n function expectRevert(bytes calldata revertData) external;\r\n function expectRevert(bytes4 revertData) external;\r\n function expectRevert() external;\r\n // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).\r\n // Call this function, then emit an event, then call a function. Internally after the call, we check if\r\n // logs were emitted in the expected order with the expected topics and data (as specified by the booleans)\r\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;\r\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)\r\n external;\r\n // Mocks a call to an address, returning specified data.\r\n // Calldata can either be strict or a partial match, e.g. if you only\r\n // pass a Solidity selector to the expected calldata, then the entire Solidity\r\n // function will be mocked.\r\n function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;\r\n // Mocks a call to an address with a specific msg.value, returning specified data.\r\n // Calldata match takes precedence over msg.value in case of ambiguity.\r\n function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;\r\n // Clears all mocked calls\r\n function clearMockedCalls() external;\r\n // Expects a call to an address with the specified calldata.\r\n // Calldata can either be a strict or a partial match\r\n function expectCall(address callee, bytes calldata data) external;\r\n // Expects a call to an address with the specified msg.value and calldata\r\n function expectCall(address callee, uint256 msgValue, bytes calldata data) external;\r\n // Expect a call to an address with the specified msg.value, gas, and calldata.\r\n function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;\r\n // Expect a call to an address with the specified msg.value and calldata, and a *minimum* amount of gas.\r\n function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;\r\n // Sets block.coinbase\r\n function coinbase(address newCoinbase) external;\r\n // Snapshot the current state of the evm.\r\n // Returns the id of the snapshot that was created.\r\n // To revert a snapshot use `revertTo`\r\n function snapshot() external returns (uint256 snapshotId);\r\n // Revert the state of the EVM to a previous snapshot\r\n // Takes the snapshot id to revert to.\r\n // This deletes the snapshot and all snapshots taken after the given snapshot id.\r\n function revertTo(uint256 snapshotId) external returns (bool success);\r\n // Creates a new fork with the given endpoint and block and returns the identifier of the fork\r\n function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\r\n // Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork\r\n function createFork(string calldata urlOrAlias) external returns (uint256 forkId);\r\n // Creates a new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before the transaction,\r\n // and returns the identifier of the fork\r\n function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\r\n // Creates _and_ also selects a new fork with the given endpoint and block and returns the identifier of the fork\r\n function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\r\n // Creates _and_ also selects new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before\r\n // the transaction, returns the identifier of the fork\r\n function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\r\n // Creates _and_ also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork\r\n function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);\r\n // Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.\r\n function selectFork(uint256 forkId) external;\r\n /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.\r\n function activeFork() external view returns (uint256 forkId);\r\n // Updates the currently active fork to given block number\r\n // This is similar to `roll` but for the currently active fork\r\n function rollFork(uint256 blockNumber) external;\r\n // Updates the currently active fork to given transaction\r\n // this will `rollFork` with the number of the block the transaction was mined in and replays all transaction mined before it in the block\r\n function rollFork(bytes32 txHash) external;\r\n // Updates the given fork to given block number\r\n function rollFork(uint256 forkId, uint256 blockNumber) external;\r\n // Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block\r\n function rollFork(uint256 forkId, bytes32 txHash) external;\r\n // Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\r\n // Meaning, changes made to the state of this account will be kept when switching forks\r\n function makePersistent(address account) external;\r\n function makePersistent(address account0, address account1) external;\r\n function makePersistent(address account0, address account1, address account2) external;\r\n function makePersistent(address[] calldata accounts) external;\r\n // Revokes persistent status from the address, previously added via `makePersistent`\r\n function revokePersistent(address account) external;\r\n function revokePersistent(address[] calldata accounts) external;\r\n // Returns true if the account is marked as persistent\r\n function isPersistent(address account) external view returns (bool persistent);\r\n // In forking mode, explicitly grant the given address cheatcode access\r\n function allowCheatcodes(address account) external;\r\n // Fetches the given transaction from the active fork and executes it on the current state\r\n function transact(bytes32 txHash) external;\r\n // Fetches the given transaction from the given fork and executes it on the current state\r\n function transact(uint256 forkId, bytes32 txHash) external;\r\n}\r\n" + }, + "ops/interfaces/IResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ninterface IResolver {\r\n function checker()\r\n external\r\n view\r\n returns (bool canExec, bytes memory execPayload);\r\n}\r\n" + }, + "solidity-bytes-utils/contracts/BytesLib.sol": { + "content": "// SPDX-License-Identifier: Unlicense\r\n/*\r\n * @title Solidity Bytes Arrays Utils\r\n * @author Gonçalo Sá \r\n *\r\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\r\n * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\r\n */\r\npragma solidity >=0.8.0 <0.9.0;\r\n\r\n\r\nlibrary BytesLib {\r\n function concat(\r\n bytes memory _preBytes,\r\n bytes memory _postBytes\r\n )\r\n internal\r\n pure\r\n returns (bytes memory)\r\n {\r\n bytes memory tempBytes;\r\n\r\n assembly {\r\n // Get a location of some free memory and store it in tempBytes as\r\n // Solidity does for memory variables.\r\n tempBytes := mload(0x40)\r\n\r\n // Store the length of the first bytes array at the beginning of\r\n // the memory for tempBytes.\r\n let length := mload(_preBytes)\r\n mstore(tempBytes, length)\r\n\r\n // Maintain a memory counter for the current write location in the\r\n // temp bytes array by adding the 32 bytes for the array length to\r\n // the starting location.\r\n let mc := add(tempBytes, 0x20)\r\n // Stop copying when the memory counter reaches the length of the\r\n // first bytes array.\r\n let end := add(mc, length)\r\n\r\n for {\r\n // Initialize a copy counter to the start of the _preBytes data,\r\n // 32 bytes into its memory.\r\n let cc := add(_preBytes, 0x20)\r\n } lt(mc, end) {\r\n // Increase both counters by 32 bytes each iteration.\r\n mc := add(mc, 0x20)\r\n cc := add(cc, 0x20)\r\n } {\r\n // Write the _preBytes data into the tempBytes memory 32 bytes\r\n // at a time.\r\n mstore(mc, mload(cc))\r\n }\r\n\r\n // Add the length of _postBytes to the current length of tempBytes\r\n // and store it as the new length in the first 32 bytes of the\r\n // tempBytes memory.\r\n length := mload(_postBytes)\r\n mstore(tempBytes, add(length, mload(tempBytes)))\r\n\r\n // Move the memory counter back from a multiple of 0x20 to the\r\n // actual end of the _preBytes data.\r\n mc := end\r\n // Stop copying when the memory counter reaches the new combined\r\n // length of the arrays.\r\n end := add(mc, length)\r\n\r\n for {\r\n let cc := add(_postBytes, 0x20)\r\n } lt(mc, end) {\r\n mc := add(mc, 0x20)\r\n cc := add(cc, 0x20)\r\n } {\r\n mstore(mc, mload(cc))\r\n }\r\n\r\n // Update the free-memory pointer by padding our last write location\r\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\r\n // next 32 byte block, then round down to the nearest multiple of\r\n // 32. If the sum of the length of the two arrays is zero then add\r\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\r\n mstore(0x40, and(\r\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\r\n not(31) // Round down to the nearest 32 bytes.\r\n ))\r\n }\r\n\r\n return tempBytes;\r\n }\r\n\r\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\r\n assembly {\r\n // Read the first 32 bytes of _preBytes storage, which is the length\r\n // of the array. (We don't need to use the offset into the slot\r\n // because arrays use the entire slot.)\r\n let fslot := sload(_preBytes.slot)\r\n // Arrays of 31 bytes or less have an even value in their slot,\r\n // while longer arrays have an odd value. The actual length is\r\n // the slot divided by two for odd values, and the lowest order\r\n // byte divided by two for even values.\r\n // If the slot is even, bitwise and the slot with 255 and divide by\r\n // two to get the length. If the slot is odd, bitwise and the slot\r\n // with -1 and divide by two.\r\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\r\n let mlength := mload(_postBytes)\r\n let newlength := add(slength, mlength)\r\n // slength can contain both the length and contents of the array\r\n // if length < 32 bytes so let's prepare for that\r\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\r\n switch add(lt(slength, 32), lt(newlength, 32))\r\n case 2 {\r\n // Since the new array still fits in the slot, we just need to\r\n // update the contents of the slot.\r\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\r\n sstore(\r\n _preBytes.slot,\r\n // all the modifications to the slot are inside this\r\n // next block\r\n add(\r\n // we can just add to the slot contents because the\r\n // bytes we want to change are the LSBs\r\n fslot,\r\n add(\r\n mul(\r\n div(\r\n // load the bytes from memory\r\n mload(add(_postBytes, 0x20)),\r\n // zero all bytes to the right\r\n exp(0x100, sub(32, mlength))\r\n ),\r\n // and now shift left the number of bytes to\r\n // leave space for the length in the slot\r\n exp(0x100, sub(32, newlength))\r\n ),\r\n // increase length by the double of the memory\r\n // bytes length\r\n mul(mlength, 2)\r\n )\r\n )\r\n )\r\n }\r\n case 1 {\r\n // The stored value fits in the slot, but the combined value\r\n // will exceed it.\r\n // get the keccak hash to get the contents of the array\r\n mstore(0x0, _preBytes.slot)\r\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\r\n\r\n // save new length\r\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\r\n\r\n // The contents of the _postBytes array start 32 bytes into\r\n // the structure. Our first read should obtain the `submod`\r\n // bytes that can fit into the unused space in the last word\r\n // of the stored array. To get this, we read 32 bytes starting\r\n // from `submod`, so the data we read overlaps with the array\r\n // contents by `submod` bytes. Masking the lowest-order\r\n // `submod` bytes allows us to add that value directly to the\r\n // stored value.\r\n\r\n let submod := sub(32, slength)\r\n let mc := add(_postBytes, submod)\r\n let end := add(_postBytes, mlength)\r\n let mask := sub(exp(0x100, submod), 1)\r\n\r\n sstore(\r\n sc,\r\n add(\r\n and(\r\n fslot,\r\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00\r\n ),\r\n and(mload(mc), mask)\r\n )\r\n )\r\n\r\n for {\r\n mc := add(mc, 0x20)\r\n sc := add(sc, 1)\r\n } lt(mc, end) {\r\n sc := add(sc, 1)\r\n mc := add(mc, 0x20)\r\n } {\r\n sstore(sc, mload(mc))\r\n }\r\n\r\n mask := exp(0x100, sub(mc, end))\r\n\r\n sstore(sc, mul(div(mload(mc), mask), mask))\r\n }\r\n default {\r\n // get the keccak hash to get the contents of the array\r\n mstore(0x0, _preBytes.slot)\r\n // Start copying to the last used word of the stored array.\r\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\r\n\r\n // save new length\r\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\r\n\r\n // Copy over the first `submod` bytes of the new data as in\r\n // case 1 above.\r\n let slengthmod := mod(slength, 32)\r\n let mlengthmod := mod(mlength, 32)\r\n let submod := sub(32, slengthmod)\r\n let mc := add(_postBytes, submod)\r\n let end := add(_postBytes, mlength)\r\n let mask := sub(exp(0x100, submod), 1)\r\n\r\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\r\n\r\n for {\r\n sc := add(sc, 1)\r\n mc := add(mc, 0x20)\r\n } lt(mc, end) {\r\n sc := add(sc, 1)\r\n mc := add(mc, 0x20)\r\n } {\r\n sstore(sc, mload(mc))\r\n }\r\n\r\n mask := exp(0x100, sub(mc, end))\r\n\r\n sstore(sc, mul(div(mload(mc), mask), mask))\r\n }\r\n }\r\n }\r\n\r\n function slice(\r\n bytes memory _bytes,\r\n uint256 _start,\r\n uint256 _length\r\n )\r\n internal\r\n pure\r\n returns (bytes memory)\r\n {\r\n require(_length + 31 >= _length, \"slice_overflow\");\r\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\r\n\r\n bytes memory tempBytes;\r\n\r\n assembly {\r\n switch iszero(_length)\r\n case 0 {\r\n // Get a location of some free memory and store it in tempBytes as\r\n // Solidity does for memory variables.\r\n tempBytes := mload(0x40)\r\n\r\n // The first word of the slice result is potentially a partial\r\n // word read from the original array. To read it, we calculate\r\n // the length of that partial word and start copying that many\r\n // bytes into the array. The first word we copy will start with\r\n // data we don't care about, but the last `lengthmod` bytes will\r\n // land at the beginning of the contents of the new array. When\r\n // we're done copying, we overwrite the full first word with\r\n // the actual length of the slice.\r\n let lengthmod := and(_length, 31)\r\n\r\n // The multiplication in the next line is necessary\r\n // because when slicing multiples of 32 bytes (lengthmod == 0)\r\n // the following copy loop was copying the origin's length\r\n // and then ending prematurely not copying everything it should.\r\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\r\n let end := add(mc, _length)\r\n\r\n for {\r\n // The multiplication in the next line has the same exact purpose\r\n // as the one above.\r\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\r\n } lt(mc, end) {\r\n mc := add(mc, 0x20)\r\n cc := add(cc, 0x20)\r\n } {\r\n mstore(mc, mload(cc))\r\n }\r\n\r\n mstore(tempBytes, _length)\r\n\r\n //update free-memory pointer\r\n //allocating the array padded to 32 bytes like the compiler does now\r\n mstore(0x40, and(add(mc, 31), not(31)))\r\n }\r\n //if we want a zero-length slice let's just return a zero-length array\r\n default {\r\n tempBytes := mload(0x40)\r\n //zero out the 32 bytes slice we are about to return\r\n //we need to do it because Solidity does not garbage collect\r\n mstore(tempBytes, 0)\r\n\r\n mstore(0x40, add(tempBytes, 0x20))\r\n }\r\n }\r\n\r\n return tempBytes;\r\n }\r\n\r\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\r\n require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\r\n address tempAddress;\r\n\r\n assembly {\r\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\r\n }\r\n\r\n return tempAddress;\r\n }\r\n\r\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\r\n require(_bytes.length >= _start + 1 , \"toUint8_outOfBounds\");\r\n uint8 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0x1), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {\r\n require(_bytes.length >= _start + 2, \"toUint16_outOfBounds\");\r\n uint16 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0x2), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {\r\n require(_bytes.length >= _start + 4, \"toUint32_outOfBounds\");\r\n uint32 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0x4), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {\r\n require(_bytes.length >= _start + 8, \"toUint64_outOfBounds\");\r\n uint64 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0x8), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {\r\n require(_bytes.length >= _start + 12, \"toUint96_outOfBounds\");\r\n uint96 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0xc), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {\r\n require(_bytes.length >= _start + 16, \"toUint128_outOfBounds\");\r\n uint128 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0x10), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {\r\n require(_bytes.length >= _start + 32, \"toUint256_outOfBounds\");\r\n uint256 tempUint;\r\n\r\n assembly {\r\n tempUint := mload(add(add(_bytes, 0x20), _start))\r\n }\r\n\r\n return tempUint;\r\n }\r\n\r\n function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {\r\n require(_bytes.length >= _start + 32, \"toBytes32_outOfBounds\");\r\n bytes32 tempBytes32;\r\n\r\n assembly {\r\n tempBytes32 := mload(add(add(_bytes, 0x20), _start))\r\n }\r\n\r\n return tempBytes32;\r\n }\r\n\r\n function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\r\n bool success = true;\r\n\r\n assembly {\r\n let length := mload(_preBytes)\r\n\r\n // if lengths don't match the arrays are not equal\r\n switch eq(length, mload(_postBytes))\r\n case 1 {\r\n // cb is a circuit breaker in the for loop since there's\r\n // no said feature for inline assembly loops\r\n // cb = 1 - don't breaker\r\n // cb = 0 - break\r\n let cb := 1\r\n\r\n let mc := add(_preBytes, 0x20)\r\n let end := add(mc, length)\r\n\r\n for {\r\n let cc := add(_postBytes, 0x20)\r\n // the next line is the loop condition:\r\n // while(uint256(mc < end) + cb == 2)\r\n } eq(add(lt(mc, end), cb), 2) {\r\n mc := add(mc, 0x20)\r\n cc := add(cc, 0x20)\r\n } {\r\n // if any of these checks fails then arrays are not equal\r\n if iszero(eq(mload(mc), mload(cc))) {\r\n // unsuccess:\r\n success := 0\r\n cb := 0\r\n }\r\n }\r\n }\r\n default {\r\n // unsuccess:\r\n success := 0\r\n }\r\n }\r\n\r\n return success;\r\n }\r\n\r\n function equalStorage(\r\n bytes storage _preBytes,\r\n bytes memory _postBytes\r\n )\r\n internal\r\n view\r\n returns (bool)\r\n {\r\n bool success = true;\r\n\r\n assembly {\r\n // we know _preBytes_offset is 0\r\n let fslot := sload(_preBytes.slot)\r\n // Decode the length of the stored array like in concatStorage().\r\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\r\n let mlength := mload(_postBytes)\r\n\r\n // if lengths don't match the arrays are not equal\r\n switch eq(slength, mlength)\r\n case 1 {\r\n // slength can contain both the length and contents of the array\r\n // if length < 32 bytes so let's prepare for that\r\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\r\n if iszero(iszero(slength)) {\r\n switch lt(slength, 32)\r\n case 1 {\r\n // blank the last byte which is the length\r\n fslot := mul(div(fslot, 0x100), 0x100)\r\n\r\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\r\n // unsuccess:\r\n success := 0\r\n }\r\n }\r\n default {\r\n // cb is a circuit breaker in the for loop since there's\r\n // no said feature for inline assembly loops\r\n // cb = 1 - don't breaker\r\n // cb = 0 - break\r\n let cb := 1\r\n\r\n // get the keccak hash to get the contents of the array\r\n mstore(0x0, _preBytes.slot)\r\n let sc := keccak256(0x0, 0x20)\r\n\r\n let mc := add(_postBytes, 0x20)\r\n let end := add(mc, mlength)\r\n\r\n // the next line is the loop condition:\r\n // while(uint256(mc < end) + cb == 2)\r\n for {} eq(add(lt(mc, end), cb), 2) {\r\n sc := add(sc, 1)\r\n mc := add(mc, 0x20)\r\n } {\r\n if iszero(eq(sload(sc), mload(mc))) {\r\n // unsuccess:\r\n success := 0\r\n cb := 0\r\n }\r\n }\r\n }\r\n }\r\n }\r\n default {\r\n // unsuccess:\r\n success := 0\r\n }\r\n }\r\n\r\n return success;\r\n }\r\n}\r\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\r\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\r\nabstract contract Auth {\r\n event OwnerUpdated(address indexed user, address indexed newOwner);\r\n\r\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\r\n\r\n address public owner;\r\n\r\n Authority public authority;\r\n\r\n constructor(address _owner, Authority _authority) {\r\n owner = _owner;\r\n authority = _authority;\r\n\r\n emit OwnerUpdated(msg.sender, _owner);\r\n emit AuthorityUpdated(msg.sender, _authority);\r\n }\r\n\r\n modifier requiresAuth() virtual {\r\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\r\n\r\n _;\r\n }\r\n\r\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\r\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\r\n\r\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\r\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\r\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\r\n }\r\n\r\n function setAuthority(Authority newAuthority) public virtual {\r\n // We check if the caller is the owner first because we want to ensure they can\r\n // always swap out the authority even if it's reverting or using up a lot of gas.\r\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\r\n\r\n authority = newAuthority;\r\n\r\n emit AuthorityUpdated(msg.sender, newAuthority);\r\n }\r\n\r\n function setOwner(address newOwner) public virtual requiresAuth {\r\n owner = newOwner;\r\n\r\n emit OwnerUpdated(msg.sender, newOwner);\r\n }\r\n}\r\n\r\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\r\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\r\ninterface Authority {\r\n function canCall(\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) external view returns (bool);\r\n}\r\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {Auth, Authority} from \"../Auth.sol\";\r\n\r\n/// @notice Role based Authority that supports up to 256 roles.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\r\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\r\ncontract RolesAuthority is Auth, Authority {\r\n /*//////////////////////////////////////////////////////////////\r\n EVENTS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\r\n\r\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\r\n\r\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n CONSTRUCTOR\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ROLE/USER STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n mapping(address => bytes32) public getUserRoles;\r\n\r\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\r\n\r\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\r\n\r\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\r\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\r\n }\r\n\r\n function doesRoleHaveCapability(\r\n uint8 role,\r\n address target,\r\n bytes4 functionSig\r\n ) public view virtual returns (bool) {\r\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n AUTHORIZATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function canCall(\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) public view virtual override returns (bool) {\r\n return\r\n isCapabilityPublic[target][functionSig] ||\r\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ROLE CAPABILITY CONFIGURATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function setPublicCapability(\r\n address target,\r\n bytes4 functionSig,\r\n bool enabled\r\n ) public virtual requiresAuth {\r\n isCapabilityPublic[target][functionSig] = enabled;\r\n\r\n emit PublicCapabilityUpdated(target, functionSig, enabled);\r\n }\r\n\r\n function setRoleCapability(\r\n uint8 role,\r\n address target,\r\n bytes4 functionSig,\r\n bool enabled\r\n ) public virtual requiresAuth {\r\n if (enabled) {\r\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\r\n } else {\r\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\r\n }\r\n\r\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n USER ROLE ASSIGNMENT LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function setUserRole(\r\n address user,\r\n uint8 role,\r\n bool enabled\r\n ) public virtual requiresAuth {\r\n if (enabled) {\r\n getUserRoles[user] |= bytes32(1 << role);\r\n } else {\r\n getUserRoles[user] &= ~bytes32(1 << role);\r\n }\r\n\r\n emit UserRoleUpdated(user, role, enabled);\r\n }\r\n}\r\n" + }, + "solmate/mixins/ERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {ERC20} from \"../tokens/ERC20.sol\";\r\nimport {SafeTransferLib} from \"../utils/SafeTransferLib.sol\";\r\nimport {FixedPointMathLib} from \"../utils/FixedPointMathLib.sol\";\r\n\r\n/// @notice Minimal ERC4626 tokenized Vault implementation.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\r\nabstract contract ERC4626 is ERC20 {\r\n using SafeTransferLib for ERC20;\r\n using FixedPointMathLib for uint256;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n EVENTS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\r\n\r\n event Withdraw(\r\n address indexed caller,\r\n address indexed receiver,\r\n address indexed owner,\r\n uint256 assets,\r\n uint256 shares\r\n );\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n IMMUTABLES\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n ERC20 public immutable asset;\r\n\r\n constructor(\r\n ERC20 _asset,\r\n string memory _name,\r\n string memory _symbol\r\n ) ERC20(_name, _symbol, _asset.decimals()) {\r\n asset = _asset;\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n DEPOSIT/WITHDRAWAL LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\r\n // Check for rounding error since we round down in previewDeposit.\r\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\r\n\r\n // Need to transfer before minting or ERC777s could reenter.\r\n asset.safeTransferFrom(msg.sender, address(this), assets);\r\n\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(msg.sender, receiver, assets, shares);\r\n\r\n afterDeposit(assets, shares);\r\n }\r\n\r\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\r\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\r\n\r\n // Need to transfer before minting or ERC777s could reenter.\r\n asset.safeTransferFrom(msg.sender, address(this), assets);\r\n\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(msg.sender, receiver, assets, shares);\r\n\r\n afterDeposit(assets, shares);\r\n }\r\n\r\n function withdraw(\r\n uint256 assets,\r\n address receiver,\r\n address owner\r\n ) public virtual returns (uint256 shares) {\r\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\r\n\r\n if (msg.sender != owner) {\r\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\r\n }\r\n\r\n beforeWithdraw(assets, shares);\r\n\r\n _burn(owner, shares);\r\n\r\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\r\n\r\n asset.safeTransfer(receiver, assets);\r\n }\r\n\r\n function redeem(\r\n uint256 shares,\r\n address receiver,\r\n address owner\r\n ) public virtual returns (uint256 assets) {\r\n if (msg.sender != owner) {\r\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\r\n }\r\n\r\n // Check for rounding error since we round down in previewRedeem.\r\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\r\n\r\n beforeWithdraw(assets, shares);\r\n\r\n _burn(owner, shares);\r\n\r\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\r\n\r\n asset.safeTransfer(receiver, assets);\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ACCOUNTING LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function totalAssets() public view virtual returns (uint256);\r\n\r\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\r\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\r\n\r\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\r\n }\r\n\r\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\r\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\r\n\r\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\r\n }\r\n\r\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\r\n return convertToShares(assets);\r\n }\r\n\r\n function previewMint(uint256 shares) public view virtual returns (uint256) {\r\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\r\n\r\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\r\n }\r\n\r\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\r\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\r\n\r\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\r\n }\r\n\r\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\r\n return convertToAssets(shares);\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function maxDeposit(address) public view virtual returns (uint256) {\r\n return type(uint256).max;\r\n }\r\n\r\n function maxMint(address) public view virtual returns (uint256) {\r\n return type(uint256).max;\r\n }\r\n\r\n function maxWithdraw(address owner) public view virtual returns (uint256) {\r\n return convertToAssets(balanceOf[owner]);\r\n }\r\n\r\n function maxRedeem(address owner) public view virtual returns (uint256) {\r\n return balanceOf[owner];\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n INTERNAL HOOKS LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\r\n\r\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\r\n}\r\n" + }, + "solmate/test/utils/mocks/MockERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {ERC20} from \"../../../tokens/ERC20.sol\";\r\n\r\ncontract MockERC20 is ERC20 {\r\n constructor(\r\n string memory _name,\r\n string memory _symbol,\r\n uint8 _decimals\r\n ) ERC20(_name, _symbol, _decimals) {}\r\n\r\n function mint(address to, uint256 value) public virtual {\r\n _mint(to, value);\r\n }\r\n\r\n function burn(address from, uint256 value) public virtual {\r\n _burn(from, value);\r\n }\r\n}\r\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\r\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\r\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\r\nabstract contract ERC20 {\r\n /*//////////////////////////////////////////////////////////////\r\n EVENTS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n METADATA STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n string public name;\r\n\r\n string public symbol;\r\n\r\n uint8 public immutable decimals;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ERC20 STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n uint256 public totalSupply;\r\n\r\n mapping(address => uint256) public balanceOf;\r\n\r\n mapping(address => mapping(address => uint256)) public allowance;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n EIP-2612 STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n uint256 internal immutable INITIAL_CHAIN_ID;\r\n\r\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\r\n\r\n mapping(address => uint256) public nonces;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n CONSTRUCTOR\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n constructor(\r\n string memory _name,\r\n string memory _symbol,\r\n uint8 _decimals\r\n ) {\r\n name = _name;\r\n symbol = _symbol;\r\n decimals = _decimals;\r\n\r\n INITIAL_CHAIN_ID = block.chainid;\r\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ERC20 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function approve(address spender, uint256 amount) public virtual returns (bool) {\r\n allowance[msg.sender][spender] = amount;\r\n\r\n emit Approval(msg.sender, spender, amount);\r\n\r\n return true;\r\n }\r\n\r\n function transfer(address to, uint256 amount) public virtual returns (bool) {\r\n balanceOf[msg.sender] -= amount;\r\n\r\n // Cannot overflow because the sum of all user\r\n // balances can't exceed the max uint256 value.\r\n unchecked {\r\n balanceOf[to] += amount;\r\n }\r\n\r\n emit Transfer(msg.sender, to, amount);\r\n\r\n return true;\r\n }\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual returns (bool) {\r\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\r\n\r\n balanceOf[from] -= amount;\r\n\r\n // Cannot overflow because the sum of all user\r\n // balances can't exceed the max uint256 value.\r\n unchecked {\r\n balanceOf[to] += amount;\r\n }\r\n\r\n emit Transfer(from, to, amount);\r\n\r\n return true;\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n EIP-2612 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) public virtual {\r\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\r\n\r\n // Unchecked because the only math done is incrementing\r\n // the owner's nonce which cannot realistically overflow.\r\n unchecked {\r\n address recoveredAddress = ecrecover(\r\n keccak256(\r\n abi.encodePacked(\r\n \"\\x19\\x01\",\r\n DOMAIN_SEPARATOR(),\r\n keccak256(\r\n abi.encode(\r\n keccak256(\r\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\r\n ),\r\n owner,\r\n spender,\r\n value,\r\n nonces[owner]++,\r\n deadline\r\n )\r\n )\r\n )\r\n ),\r\n v,\r\n r,\r\n s\r\n );\r\n\r\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\r\n\r\n allowance[recoveredAddress][spender] = value;\r\n }\r\n\r\n emit Approval(owner, spender, value);\r\n }\r\n\r\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\r\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\r\n }\r\n\r\n function computeDomainSeparator() internal view virtual returns (bytes32) {\r\n return\r\n keccak256(\r\n abi.encode(\r\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\r\n keccak256(bytes(name)),\r\n keccak256(\"1\"),\r\n block.chainid,\r\n address(this)\r\n )\r\n );\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n INTERNAL MINT/BURN LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function _mint(address to, uint256 amount) internal virtual {\r\n totalSupply += amount;\r\n\r\n // Cannot overflow because the sum of all user\r\n // balances can't exceed the max uint256 value.\r\n unchecked {\r\n balanceOf[to] += amount;\r\n }\r\n\r\n emit Transfer(address(0), to, amount);\r\n }\r\n\r\n function _burn(address from, uint256 amount) internal virtual {\r\n balanceOf[from] -= amount;\r\n\r\n // Cannot underflow because a user's balance\r\n // will never be larger than the total supply.\r\n unchecked {\r\n totalSupply -= amount;\r\n }\r\n\r\n emit Transfer(from, address(0), amount);\r\n }\r\n}\r\n" + }, + "solmate/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Arithmetic library with operations for fixed-point numbers.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\r\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\r\nlibrary FixedPointMathLib {\r\n /*//////////////////////////////////////////////////////////////\r\n SIMPLIFIED FIXED POINT OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\r\n\r\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\r\n }\r\n\r\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\r\n }\r\n\r\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\r\n }\r\n\r\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n LOW LEVEL FIXED POINT OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function mulDivDown(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 z) {\r\n assembly {\r\n // Store x * y in z for now.\r\n z := mul(x, y)\r\n\r\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\r\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\r\n revert(0, 0)\r\n }\r\n\r\n // Divide z by the denominator.\r\n z := div(z, denominator)\r\n }\r\n }\r\n\r\n function mulDivUp(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 z) {\r\n assembly {\r\n // Store x * y in z for now.\r\n z := mul(x, y)\r\n\r\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\r\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\r\n revert(0, 0)\r\n }\r\n\r\n // First, divide z - 1 by the denominator and add 1.\r\n // We allow z - 1 to underflow if z is 0, because we multiply the\r\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\r\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\r\n }\r\n }\r\n\r\n function rpow(\r\n uint256 x,\r\n uint256 n,\r\n uint256 scalar\r\n ) internal pure returns (uint256 z) {\r\n assembly {\r\n switch x\r\n case 0 {\r\n switch n\r\n case 0 {\r\n // 0 ** 0 = 1\r\n z := scalar\r\n }\r\n default {\r\n // 0 ** n = 0\r\n z := 0\r\n }\r\n }\r\n default {\r\n switch mod(n, 2)\r\n case 0 {\r\n // If n is even, store scalar in z for now.\r\n z := scalar\r\n }\r\n default {\r\n // If n is odd, store x in z for now.\r\n z := x\r\n }\r\n\r\n // Shifting right by 1 is like dividing by 2.\r\n let half := shr(1, scalar)\r\n\r\n for {\r\n // Shift n right by 1 before looping to halve it.\r\n n := shr(1, n)\r\n } n {\r\n // Shift n right by 1 each iteration to halve it.\r\n n := shr(1, n)\r\n } {\r\n // Revert immediately if x ** 2 would overflow.\r\n // Equivalent to iszero(eq(div(xx, x), x)) here.\r\n if shr(128, x) {\r\n revert(0, 0)\r\n }\r\n\r\n // Store x squared.\r\n let xx := mul(x, x)\r\n\r\n // Round to the nearest number.\r\n let xxRound := add(xx, half)\r\n\r\n // Revert if xx + half overflowed.\r\n if lt(xxRound, xx) {\r\n revert(0, 0)\r\n }\r\n\r\n // Set x to scaled xxRound.\r\n x := div(xxRound, scalar)\r\n\r\n // If n is even:\r\n if mod(n, 2) {\r\n // Compute z * x.\r\n let zx := mul(z, x)\r\n\r\n // If z * x overflowed:\r\n if iszero(eq(div(zx, x), z)) {\r\n // Revert if x is non-zero.\r\n if iszero(iszero(x)) {\r\n revert(0, 0)\r\n }\r\n }\r\n\r\n // Round to the nearest number.\r\n let zxRound := add(zx, half)\r\n\r\n // Revert if zx + half overflowed.\r\n if lt(zxRound, zx) {\r\n revert(0, 0)\r\n }\r\n\r\n // Return properly scaled zxRound.\r\n z := div(zxRound, scalar)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n GENERAL NUMBER UTILITIES\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function sqrt(uint256 x) internal pure returns (uint256 z) {\r\n assembly {\r\n let y := x // We start y at x, which will help us make our initial estimate.\r\n\r\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\r\n\r\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\r\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\r\n\r\n // We check y >= 2^(k + 8) but shift right by k bits\r\n // each branch to ensure that if x >= 256, then y >= 256.\r\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\r\n y := shr(128, y)\r\n z := shl(64, z)\r\n }\r\n if iszero(lt(y, 0x1000000000000000000)) {\r\n y := shr(64, y)\r\n z := shl(32, z)\r\n }\r\n if iszero(lt(y, 0x10000000000)) {\r\n y := shr(32, y)\r\n z := shl(16, z)\r\n }\r\n if iszero(lt(y, 0x1000000)) {\r\n y := shr(16, y)\r\n z := shl(8, z)\r\n }\r\n\r\n // Goal was to get z*z*y within a small factor of x. More iterations could\r\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\r\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\r\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\r\n\r\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\r\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\r\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\r\n\r\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\r\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\r\n\r\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\r\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\r\n\r\n // There is no overflow risk here since y < 2^136 after the first branch above.\r\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\r\n\r\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n\r\n // If x+1 is a perfect square, the Babylonian method cycles between\r\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\r\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\r\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\r\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\r\n z := sub(z, lt(div(x, z), z))\r\n }\r\n }\r\n\r\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n assembly {\r\n // Mod x by y. Note this will return\r\n // 0 instead of reverting if y is zero.\r\n z := mod(x, y)\r\n }\r\n }\r\n\r\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\r\n assembly {\r\n // Divide x by y. Note this will return\r\n // 0 instead of reverting if y is zero.\r\n r := div(x, y)\r\n }\r\n }\r\n\r\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n assembly {\r\n // Add 1 to x * y if x % y > 0. Note this will\r\n // return 0 instead of reverting if y is zero.\r\n z := add(gt(mod(x, y), 0), div(x, y))\r\n }\r\n }\r\n}\r\n" + }, + "solmate/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Safe unsigned integer casting library that reverts on overflow.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\r\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\r\nlibrary SafeCastLib {\r\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\r\n require(x < 1 << 248);\r\n\r\n y = uint248(x);\r\n }\r\n\r\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\r\n require(x < 1 << 224);\r\n\r\n y = uint224(x);\r\n }\r\n\r\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\r\n require(x < 1 << 192);\r\n\r\n y = uint192(x);\r\n }\r\n\r\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\r\n require(x < 1 << 160);\r\n\r\n y = uint160(x);\r\n }\r\n\r\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\r\n require(x < 1 << 128);\r\n\r\n y = uint128(x);\r\n }\r\n\r\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\r\n require(x < 1 << 96);\r\n\r\n y = uint96(x);\r\n }\r\n\r\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\r\n require(x < 1 << 64);\r\n\r\n y = uint64(x);\r\n }\r\n\r\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\r\n require(x < 1 << 32);\r\n\r\n y = uint32(x);\r\n }\r\n\r\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\r\n require(x < 1 << 24);\r\n\r\n y = uint24(x);\r\n }\r\n\r\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\r\n require(x < 1 << 16);\r\n\r\n y = uint16(x);\r\n }\r\n\r\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\r\n require(x < 1 << 8);\r\n\r\n y = uint8(x);\r\n }\r\n}\r\n" + }, + "solmate/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {ERC20} from \"../tokens/ERC20.sol\";\r\n\r\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\r\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\r\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\r\nlibrary SafeTransferLib {\r\n /*//////////////////////////////////////////////////////////////\r\n ETH OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function safeTransferETH(address to, uint256 amount) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Transfer the ETH and store if it succeeded or not.\r\n success := call(gas(), to, amount, 0, 0, 0, 0)\r\n }\r\n\r\n require(success, \"ETH_TRANSFER_FAILED\");\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ERC20 OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function safeTransferFrom(\r\n ERC20 token,\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Get a pointer to some free memory.\r\n let freeMemoryPointer := mload(0x40)\r\n\r\n // Write the abi-encoded calldata into memory, beginning with the function selector.\r\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\r\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\r\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\r\n\r\n success := and(\r\n // Set success to whether the call reverted, if not we check it either\r\n // returned exactly 1 (can't just be non-zero data), or had no return data.\r\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\r\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\r\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\r\n // Counterintuitively, this call must be positioned second to the or() call in the\r\n // surrounding and() call or else returndatasize() will be zero during the computation.\r\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\r\n )\r\n }\r\n\r\n require(success, \"TRANSFER_FROM_FAILED\");\r\n }\r\n\r\n function safeTransfer(\r\n ERC20 token,\r\n address to,\r\n uint256 amount\r\n ) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Get a pointer to some free memory.\r\n let freeMemoryPointer := mload(0x40)\r\n\r\n // Write the abi-encoded calldata into memory, beginning with the function selector.\r\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\r\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\r\n\r\n success := and(\r\n // Set success to whether the call reverted, if not we check it either\r\n // returned exactly 1 (can't just be non-zero data), or had no return data.\r\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\r\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\r\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\r\n // Counterintuitively, this call must be positioned second to the or() call in the\r\n // surrounding and() call or else returndatasize() will be zero during the computation.\r\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\r\n )\r\n }\r\n\r\n require(success, \"TRANSFER_FAILED\");\r\n }\r\n\r\n function safeApprove(\r\n ERC20 token,\r\n address to,\r\n uint256 amount\r\n ) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Get a pointer to some free memory.\r\n let freeMemoryPointer := mload(0x40)\r\n\r\n // Write the abi-encoded calldata into memory, beginning with the function selector.\r\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\r\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\r\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\r\n\r\n success := and(\r\n // Set success to whether the call reverted, if not we check it either\r\n // returned exactly 1 (can't just be non-zero data), or had no return data.\r\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\r\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\r\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\r\n // Counterintuitively, this call must be positioned second to the or() call in the\r\n // surrounding and() call or else returndatasize() will be zero during the computation.\r\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\r\n )\r\n }\r\n\r\n require(success, \"APPROVE_FAILED\");\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/155a974487a071ac66212c60b7c58879.json b/packages/contracts/deployments/base/solcInputs/155a974487a071ac66212c60b7c58879.json new file mode 100644 index 0000000000..c2c01103b5 --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/155a974487a071ac66212c60b7c58879.json @@ -0,0 +1,225 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2Upgradeable {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nlibrary PrudentiaLib {\n struct PrudentiaConfig {\n address controller; // Adrastia Prudentia controller address\n uint8 offset; // Offset for delayed rate activation\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\n }\n}\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Careful Math\n * @author Compound\n * @notice Derived from OpenZeppelin's SafeMath library\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\n */\ncontract CarefulMath {\n /**\n * @dev Possible error codes that we can return\n */\n enum MathError {\n NO_ERROR,\n DIVISION_BY_ZERO,\n INTEGER_OVERFLOW,\n INTEGER_UNDERFLOW\n }\n\n /**\n * @dev Multiplies two numbers, returns an error on overflow.\n */\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (a == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n uint256 c;\n unchecked {\n c = a * b;\n }\n\n if (c / a != b) {\n return (MathError.INTEGER_OVERFLOW, 0);\n } else {\n return (MathError.NO_ERROR, c);\n }\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b == 0) {\n return (MathError.DIVISION_BY_ZERO, 0);\n }\n\n return (MathError.NO_ERROR, a / b);\n }\n\n /**\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\n */\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b <= a) {\n return (MathError.NO_ERROR, a - b);\n } else {\n return (MathError.INTEGER_UNDERFLOW, 0);\n }\n }\n\n /**\n * @dev Adds two numbers, returns an error on overflow.\n */\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n uint256 c;\n unchecked {\n c = a + b;\n }\n\n if (c >= a) {\n return (MathError.NO_ERROR, c);\n } else {\n return (MathError.INTEGER_OVERFLOW, 0);\n }\n }\n\n /**\n * @dev add a and b and then subtract c\n */\n function addThenSubUInt(\n uint256 a,\n uint256 b,\n uint256 c\n ) internal pure returns (MathError, uint256) {\n (MathError err0, uint256 sum) = addUInt(a, b);\n\n if (err0 != MathError.NO_ERROR) {\n return (err0, 0);\n }\n\n return subUInt(sum, c);\n }\n}\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\n\n/**\n * @title Compound's CErc20Delegate Contract\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\n * @author Compound\n */\ncontract CErc20Delegate is CErc20 {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 3;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n */\n function _becomeImplementation(bytes memory) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 1;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20Delegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\n\ncontract CErc20RewardsDelegate is CErc20Delegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n \n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying, \"!underlying\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 3;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20RewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegateMorpho.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20RewardsDelegate.sol\";\n\ncontract CErc20RewardsDelegateMorpho is CErc20Delegate {\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 1;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\n * @param rewardToken The reward strategy for which the rewards are being claimed.\n * @param claimable The amount of tokens to claim and forward.\n * @param proof The proof required to validate the claim.\n * @dev Only callable by the governance.\n */\n function claim(address rewardToken, uint256 claimable, bytes32[] memory proof) external {\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\n EIP20Interface(rewardToken).transfer(comptroller.admin(), claimedAmount);\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\n }\n}\n\ninterface IMorphoClaim {\n function claim(\n address account,\n address reward,\n uint256 claimable,\n bytes32[] memory proof\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./Unitroller.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\n */\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when an admin supports a market\n event MarketListed(ICErc20 cToken);\n\n /// @notice Emitted when an account enters a market\n event MarketEntered(ICErc20 cToken, address account);\n\n /// @notice Emitted when an account exits a market\n event MarketExited(ICErc20 cToken, address account);\n\n /// @notice Emitted when close factor is changed by admin\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\n\n /// @notice Emitted when a collateral factor is changed by admin\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\n\n /// @notice Emitted when liquidation incentive is changed by admin\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\n\n /// @notice Emitted when price oracle is changed\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\n\n /// @notice Emitted when the whitelist enforcement is changed\n event WhitelistEnforcementChanged(bool enforce);\n\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\n event AddedRewardsDistributor(address rewardsDistributor);\n\n // closeFactorMantissa must be strictly greater than this value\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\n\n // closeFactorMantissa must not exceed this value\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\n\n // No collateralFactorMantissa may exceed this value\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\n\n // liquidationIncentiveMantissa must be no less than this value\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\n\n // liquidationIncentiveMantissa must be no greater than this value\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\n\n modifier isAuthorized() {\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\n _;\n }\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\n return ComptrollerBase.effectiveSupplyCaps(cToken);\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\n return ComptrollerBase.effectiveBorrowCaps(cToken);\n }\n\n /*** Assets You Are In ***/\n\n /**\n * @notice Returns the assets an account has entered\n * @param account The address of the account to pull assets for\n * @return A dynamic list with the assets the account has entered\n */\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\n ICErc20[] memory assetsIn = accountAssets[account];\n\n return assetsIn;\n }\n\n /**\n * @notice Returns whether the given account is entered in the given asset\n * @param account The address of the account to check\n * @param cToken The cToken to check\n * @return True if the account is in the asset, otherwise false.\n */\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\n return markets[address(cToken)].accountMembership[account];\n }\n\n /**\n * @notice Add assets to be included in account liquidity calculation\n * @param cTokens The list of addresses of the cToken markets to be enabled\n * @return Success indicator for whether each corresponding market was entered\n */\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\n uint256 len = cTokens.length;\n\n uint256[] memory results = new uint256[](len);\n for (uint256 i = 0; i < len; i++) {\n ICErc20 cToken = ICErc20(cTokens[i]);\n\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\n }\n\n return results;\n }\n\n /**\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\n * @param cToken The market to enter\n * @param borrower The address of the account to modify\n * @return Success indicator for whether the market was entered\n */\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\n Market storage marketToJoin = markets[address(cToken)];\n\n if (!marketToJoin.isListed) {\n // market is not listed, cannot join\n return Error.MARKET_NOT_LISTED;\n }\n\n if (marketToJoin.accountMembership[borrower] == true) {\n // already joined\n return Error.NO_ERROR;\n }\n\n // survived the gauntlet, add to list\n // NOTE: we store these somewhat redundantly as a significant optimization\n // this avoids having to iterate through the list for the most common use cases\n // that is, only when we need to perform liquidity checks\n // and not whenever we want to check if an account is in a particular market\n marketToJoin.accountMembership[borrower] = true;\n accountAssets[borrower].push(cToken);\n\n // Add to allBorrowers\n if (!borrowers[borrower]) {\n allBorrowers.push(borrower);\n borrowers[borrower] = true;\n borrowerIndexes[borrower] = allBorrowers.length - 1;\n }\n\n emit MarketEntered(cToken, borrower);\n\n return Error.NO_ERROR;\n }\n\n /**\n * @notice Removes asset from sender's account liquidity calculation\n * @dev Sender must not have an outstanding borrow balance in the asset,\n * or be providing necessary collateral for an outstanding borrow.\n * @param cTokenAddress The address of the asset to be removed\n * @return Whether or not the account successfully exited the market\n */\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\n // TODO\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\n\n ICErc20 cToken = ICErc20(cTokenAddress);\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\n\n /* Fail if the sender has a borrow balance */\n if (amountOwed != 0) {\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\n }\n\n /* Fail if the sender is not permitted to redeem all of their tokens */\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\n if (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\n }\n\n Market storage marketToExit = markets[cTokenAddress];\n\n /* Return true if the sender is not already ‘in’ the market */\n if (!marketToExit.accountMembership[msg.sender]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Set cToken account membership to false */\n delete marketToExit.accountMembership[msg.sender];\n\n /* Delete cToken from the account’s list of assets */\n // load into memory for faster iteration\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\n uint256 len = userAssetList.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n ICErc20[] storage storedList = accountAssets[msg.sender];\n storedList[assetIndex] = storedList[storedList.length - 1];\n storedList.pop();\n\n // If the user has exited all markets, remove them from the `allBorrowers` array\n if (storedList.length == 0) {\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\n allBorrowers.pop(); // Reduce length by 1\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\n }\n\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Policy Hooks ***/\n\n /**\n * @notice Checks if the account should be allowed to mint tokens in the given market\n * @param cTokenAddress The market to verify the mint against\n * @param minter The account which would get the minted tokens\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\n\n // Make sure market is listed\n if (!markets[cTokenAddress].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure minter is whitelisted\n if (enforceWhitelist && !whitelist[minter]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\n\n // Supply cap of 0 corresponds to unlimited supplying\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\n uint256 nonWhitelistedTotalSupply;\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\n\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cTokenAddress, minter);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to redeem tokens in the given market\n * @param cToken The market to verify the redeem against\n * @param redeemer The account which would redeem the tokens\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cToken, redeemer);\n\n return uint256(Error.NO_ERROR);\n }\n\n function redeemAllowedInternal(\n address cToken,\n address redeemer,\n uint256 redeemTokens\n ) internal view returns (uint256) {\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\n if (!markets[cToken].accountMembership[redeemer]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n redeemer,\n ICErc20(cToken),\n redeemTokens,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates mint and reverts on rejection. May emit logs.\n * @param cToken Asset being minted\n * @param minter The address minting the tokens\n * @param actualMintAmount The amount of the underlying asset being minted\n * @param mintTokens The number of tokens being minted\n */\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\n // Add minter to suppliers mapping\n suppliers[minter] = true;\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, minter);\n }\n\n /**\n * @notice Validates redeem and reverts on rejection. May emit logs.\n * @param cToken Asset being redeemed\n * @param redeemer The address redeeming the tokens\n * @param redeemAmount The amount of the underlying asset being redeemed\n * @param redeemTokens The number of tokens being redeemed\n */\n function redeemVerify(\n address cToken,\n address redeemer,\n uint256 redeemAmount,\n uint256 redeemTokens\n ) external override {\n require(markets[msg.sender].isListed, \"!market\");\n\n // Require tokens is zero or amount is also zero\n if (redeemTokens == 0 && redeemAmount > 0) {\n revert(\"!zero\");\n }\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, redeemer);\n }\n\n function getMaxRedeemOrBorrow(\n address account,\n ICErc20 cTokenModify,\n bool isBorrow\n ) external view override returns (uint256) {\n address cToken = address(cTokenModify);\n // Accrue interest\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\n\n // Get account liquidity\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n isBorrow ? cTokenModify : ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n require(err == Error.NO_ERROR, \"!liquidity\");\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\n\n // Get max borrow/redeem\n uint256 maxBorrowOrRedeemAmount;\n\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\n // Max redeem = balance of underlying if not used as collateral\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\n } else {\n // Avoid \"stack too deep\" error by separating this logic\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\n\n // Redeem only: max out at underlying balance\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\n }\n\n // Get max borrow or redeem considering cToken liquidity\n uint256 cTokenLiquidity = cTokenModify.getCash();\n\n // Return the minimum of the two maximums\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\n }\n\n /**\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\n */\n function _getMaxRedeemOrBorrow(\n uint256 liquidity,\n ICErc20 cTokenModify,\n bool isBorrow\n ) internal view returns (uint256) {\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\n\n // Get the normalized price of the asset\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\n require(conversionFactor > 0, \"!oracle\");\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n if (!isBorrow) {\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\n }\n\n // Get max borrow or redeem considering excess account liquidity\n return (liquidity * 1e18) / conversionFactor;\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which would borrow the asset\n * @param borrowAmount The amount of underlying the account would borrow\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\n\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n if (!markets[cToken].accountMembership[borrower]) {\n // only cTokens may call borrowAllowed if borrower not in market\n require(msg.sender == cToken, \"!ctoken\");\n\n // attempt to add borrower to the market\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n // it should be impossible to break the important invariant\n assert(markets[cToken].accountMembership[borrower]);\n }\n\n // Make sure oracle price is available\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\n return uint256(Error.PRICE_ERROR);\n }\n\n // Make sure borrower is whitelisted\n if (enforceWhitelist && !whitelist[borrower]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 borrowCap = effectiveBorrowCaps(cToken);\n\n // Borrow cap of 0 corresponds to unlimited borrowing\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\n uint256 nonWhitelistedTotalBorrows;\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n // Perform a hypothetical liquidity check to guard against shortfall\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\n if (err != uint256(Error.NO_ERROR)) {\n return err;\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which borrowed the asset\n */\n function borrowVerify(address cToken, address borrower) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken Asset whose underlying is being borrowed\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\n */\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\n // Check if min borrow exists\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\n\n if (minBorrowEth > 0) {\n // Get new underlying borrow balance of account for this cToken\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\n Exp({ mantissa: oraclePriceMantissa }),\n accountBorrowsNew\n );\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\n\n // Check against min borrow\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\n }\n\n // Return no error\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to repay a borrow in the given market\n * @param cToken The market to verify the repay against\n * @param payer The account which would repay the asset\n * @param borrower The account which would borrowed the asset\n * @param repayAmount The amount of the underlying asset the account would repay\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after borrow repayment\n * @param cToken The market to verify the repay against\n * @param payer The account which repayed the asset\n * @param borrower The account which borrowed the asset\n * @param repayAmount The amount of the underlying asset the account repayed\n */\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the liquidation should be allowed to occur\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param repayAmount The amount of underlying being repaid\n */\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure markets are listed\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Get borrowers' underlying borrow balance\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\n\n /* allow accounts to be liquidated if the market is deprecated */\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\n } else {\n /* The borrower must have shortfall in order to be liquidateable */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n borrower,\n ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n if (shortfall == 0) {\n return uint256(Error.INSUFFICIENT_SHORTFALL);\n }\n\n /* The liquidator may not repay more than what is allowed by the closeFactor */\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\n if (repayAmount > maxClose) {\n return uint256(Error.TOO_MUCH_REPAY);\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the seizing of assets should be allowed to occur\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!seizeGuardianPaused, \"!seize:paused\");\n\n // Make sure markets are listed\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure cToken Comptrollers are identical\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\n return uint256(Error.COMPTROLLER_MISMATCH);\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after seizing of assets\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override {\n // Keep the flywheel moving\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\n }\n\n /**\n * @notice Checks if the account should be allowed to transfer tokens in the given market\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function transferAllowed(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!transferGuardianPaused, \"!transfer:paused\");\n\n // Currently the only consideration is whether or not\n // the src is allowed to redeem this many tokens\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cToken, src, dst);\n\n return uint256(Error.NO_ERROR);\n }\n\n\n /**\n * @notice Validates that blacklisted balances are updated after transfering assets\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n */\n function transferVerify(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override {\n\n // Keep the flywheel moving\n flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Flywheel Hooks ***/\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving post-mint and post-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving post-borrow and post-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\n }\n\n /**\n * @notice Keeps the flywheel moving post-transfer and post-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Liquidity/Liquidation Calculations ***/\n\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountLiquidityLocalVars {\n ICErc20 asset;\n uint256 sumCollateral;\n uint256 sumBorrowPlusEffects;\n uint256 cTokenBalance;\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n uint256 oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n uint256 borrowCapForCollateral;\n uint256 borrowedAssetPrice;\n uint256 assetAsCollateralValueCap;\n }\n\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code (semi-opaque),\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(\n account,\n ICErc20(cTokenModify),\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code,\n hypothetical account collateral value,\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidityInternal(\n address account,\n ICErc20 cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) internal view returns (Error, uint256, uint256, uint256) {\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\n\n if (address(cTokenModify) != address(0)) {\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n }\n\n // For each asset the account is in\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\n vars.asset = accountAssets[account][i];\n\n {\n // Read the balances and exchange rate from the cToken\n uint256 oErr;\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\n account\n );\n if (oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\n }\n }\n {\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\n if (vars.oraclePriceMantissa == 0) {\n return (Error.PRICE_ERROR, 0, 0, 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n }\n {\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\n vars.asset,\n cTokenModify,\n redeemTokens > 0,\n account\n );\n\n // accumulate the collateral value to sumCollateral\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\n assetCollateralValue = vars.assetAsCollateralValueCap;\n vars.sumCollateral += assetCollateralValue;\n }\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n\n // Calculate effects of interacting with cTokenModify\n if (vars.asset == cTokenModify) {\n // redeem effect\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.tokensToDenom,\n redeemTokens,\n vars.sumBorrowPlusEffects\n );\n\n // borrow effect\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n borrowAmount,\n vars.sumBorrowPlusEffects\n );\n\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\n if (repayEffect >= vars.sumBorrowPlusEffects) {\n vars.sumBorrowPlusEffects = 0;\n } else {\n vars.sumBorrowPlusEffects -= repayEffect;\n }\n }\n }\n\n // These are safe, as the underflow condition is checked first\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\n } else {\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\n }\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\n * @param cTokenBorrowed The address of the borrowed cToken\n * @param cTokenCollateral The address of the collateral cToken\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view override returns (uint256, uint256) {\n /* Read oracle prices for borrowed and collateral markets */\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\n return (uint256(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\n uint256 seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\n\n /*\n * The liquidation penalty includes\n * - the liquidator incentive\n * - the protocol fees (Ionic admin fees)\n * - the market fee\n */\n Exp memory totalPenaltyMantissa = add_(\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\n Exp({ mantissa: feeSeizeShareMantissa })\n );\n\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n return (uint256(Error.NO_ERROR), seizeTokens);\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Add a RewardsDistributor contracts.\n * @dev Admin function to add a RewardsDistributor contract\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addRewardsDistributor(address distributor) external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n\n // Check marker method\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\n\n // Check for existing RewardsDistributor\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\n\n // Add RewardsDistributor to array\n rewardsDistributors.push(distributor);\n emit AddedRewardsDistributor(distributor);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist enforcement for the comptroller\n * @dev Admin function to set a new whitelist enforcement boolean\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\n }\n\n // Check if `enforceWhitelist` already equals `enforce`\n if (enforceWhitelist == enforce) {\n return uint256(Error.NO_ERROR);\n }\n\n // Set comptroller's `enforceWhitelist` to `enforce`\n enforceWhitelist = enforce;\n\n // Emit WhitelistEnforcementChanged(bool enforce);\n emit WhitelistEnforcementChanged(enforce);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist `statuses` for `suppliers`\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\n }\n\n // Set whitelist statuses for suppliers\n for (uint256 i = 0; i < suppliers.length; i++) {\n address supplier = suppliers[i];\n\n if (statuses[i]) {\n // If not already whitelisted, add to whitelist\n if (!whitelist[supplier]) {\n whitelist[supplier] = true;\n whitelistArray.push(supplier);\n whitelistIndexes[supplier] = whitelistArray.length - 1;\n }\n } else {\n // If whitelisted, remove from whitelist\n if (whitelist[supplier]) {\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\n whitelistArray.pop(); // Reduce length by 1\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\n }\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new price oracle for the comptroller\n * @dev Admin function to set a new price oracle\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\n }\n\n // Track the old oracle for the comptroller\n BasePriceOracle oldOracle = oracle;\n\n // Set comptroller's oracle to newOracle\n oracle = newOracle;\n\n // Emit NewPriceOracle(oldOracle, newOracle)\n emit NewPriceOracle(oldOracle, newOracle);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the closeFactor used when liquidating borrows\n * @dev Admin function to set closeFactor\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\n }\n\n // Check limits\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\n if (lessThanExp(highLimit, newCloseFactorExp)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n // Set pool close factor to new close factor, remember old value\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\n closeFactorMantissa = newCloseFactorMantissa;\n\n // Emit event\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the collateralFactor for a market\n * @dev Admin function to set per-market collateralFactor\n * @param cToken The market to set the factor on\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\n }\n\n // Verify market is listed\n Market storage market = markets[address(cToken)];\n if (!market.isListed) {\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\n }\n\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\n\n // Check collateral factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\n }\n\n // If collateral factor != 0, fail if price == 0\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\n }\n\n // Set market's collateral factor to new collateral factor, remember old value\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\n market.collateralFactorMantissa = newCollateralFactorMantissa;\n\n // Emit event with asset, old collateral factor, and new collateral factor\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets liquidationIncentive\n * @dev Admin function to set liquidationIncentive\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\n }\n\n // Check de-scaled min <= newLiquidationIncentive <= max\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n // Save current value for use in log\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\n\n // Set liquidation incentive to new incentive\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\n\n // Emit event with old incentive, new incentive\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Add the market to the markets mapping and set it as listed\n * @dev Admin function to set isListed and add support for the market\n * @param cToken The address of the market (token) to list\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Is market already listed?\n if (markets[address(cToken)].isListed) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // Check cToken.comptroller == this\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\n\n // Make sure market is not already listed\n address underlying = ICErc20(address(cToken)).underlying();\n\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // List market and emit event\n Market storage market = markets[address(cToken)];\n market.isListed = true;\n market.collateralFactorMantissa = 0;\n allMarkets.push(cToken);\n cTokensByUnderlying[underlying] = cToken;\n emit MarketListed(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _deployMarket(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\n bool oldIonicAdminHasRights = ionicAdminHasRights;\n ionicAdminHasRights = true;\n\n // Deploy via Ionic admin\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\n // Reset Ionic admin rights to the original value\n ionicAdminHasRights = oldIonicAdminHasRights;\n // Support market here in the Comptroller\n uint256 err = _supportMarket(cToken);\n\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\n\n // Set collateral factor\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\n }\n\n function _becomeImplementation() external {\n require(msg.sender == address(this), \"!self call\");\n\n if (!_notEnteredInitialized) {\n _notEntered = true;\n _notEnteredInitialized = true;\n }\n }\n\n /*** Helper Functions ***/\n\n /**\n * @notice Returns true if the given cToken market has been deprecated\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\n * @param cToken The market to check if deprecated\n */\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\n return\n markets[address(cToken)].collateralFactorMantissa == 0 &&\n borrowGuardianPaused[address(cToken)] == true &&\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\n }\n\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\n return ComptrollerExtensionInterface(address(this));\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 32;\n\n functionSelectors = new bytes4[](fnsCount);\n\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\n functionSelectors[--fnsCount] = this._deployMarket.selector;\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\n functionSelectors[--fnsCount] = this.checkMembership.selector;\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\n functionSelectors[--fnsCount] = this.exitMarket.selector;\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\n functionSelectors[--fnsCount] = this.mintVerify.selector;\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n /**\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _beforeNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\n require(_notEntered, \"!reentered\");\n _notEntered = false;\n }\n\n /**\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _afterNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n}\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\ninterface ComptrollerInterface {\n function isDeprecated(ICErc20 cToken) external view returns (bool);\n\n function _becomeImplementation() external;\n\n function _deployMarket(\n uint8 delegateType,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\n\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\n\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _addRewardsDistributor(address distributor) external returns (uint256);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) external view returns (uint256, uint256, uint256, uint256);\n\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\n\n /*** Assets You Are In ***/\n\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cToken) external returns (uint256);\n\n /*** Policy Hooks ***/\n\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\n\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\n\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\n\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\n\n function borrowVerify(address cToken, address borrower) external;\n\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\n\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external;\n\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n \n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external;\n\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\n \n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\n\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\n\n /*** Liquidity/Liquidation Calculations ***/\n\n function getAccountLiquidity(\n address account\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\n\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 repayAmount\n ) external view returns (uint256, uint256);\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n function _beforeNonReentrant() external;\n\n function _afterNonReentrant() external;\n\n /*** New supply and borrow cap view functions ***/\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\n}\n\ninterface ComptrollerStorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function pendingAdmin() external view returns (address);\n\n function oracle() external view returns (BasePriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function enforceWhitelist() external view returns (bool);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function suppliers(address account) external view returns (bool);\n\n function cTokensByUnderlying(address) external view returns (address);\n\n /**\n * Gets the supply cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\n * `effectiveSupplyCaps` to get the correct supply cap.\n * @param cToken The address of the cToken.\n * @return The supply cap in the units of the underlying asset.\n */\n function supplyCaps(address cToken) external view returns (uint256);\n\n /**\n * Gets the borrow cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\n * `effectiveBorrowCaps` to get the correct borrow cap.\n * @param cToken The address of the cToken.\n * @return The borrow cap in the units of the underlying asset.\n */\n function borrowCaps(address cToken) external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function accountAssets(address, uint256) external view returns (address);\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function rewardsDistributors(uint256) external view returns (address);\n}\n\ninterface SFSRegister {\n function register(address _recipient) external returns (uint256 tokenId);\n}\n\ninterface ComptrollerExtensionInterface {\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function getAllBorrowersCount() external view returns (uint256);\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAccruingFlywheels() external view returns (address[] memory);\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) external;\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _removeFlywheel(address flywheelAddress) external returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\n\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\n\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\n\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\n\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\n\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setTransferPaused(bool state) external returns (bool);\n\n function _setSeizePaused(bool state) external returns (bool);\n\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\n * @return The config.\n */\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\n * @return The config.\n */\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\n * @param newConfig The new config.\n */\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\n * @param newConfig The new config.\n */\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n}\n\ninterface UnitrollerInterface {\n function comptrollerImplementation() external view returns (address);\n\n function _upgrade() external;\n\n function _acceptAdmin() external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n\n function _toggleAdminRights(bool hasRights) external returns (uint256);\n}\n\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\n\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\n\ninterface IonicComptroller is\n ComptrollerInterface,\n ComptrollerExtensionInterface,\n UnitrollerInterface,\n ComptrollerStorageInterface\n{\n\n}\n\nabstract contract ComptrollerBase is ComptrollerV4Storage {\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n bool public constant isComptroller = true;\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\n\n // Check if we're using Adrastia Prudentia for the supply cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the supply cap from Adrastia Prudentia\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n supplyCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n supplyCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local supply cap\n\n // Get the supply cap from the local supply cap\n supplyCap = supplyCaps[cToken];\n }\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\n\n // Check if we're using Adrastia Prudentia for the borrow cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the borrow cap from Adrastia Prudentia\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n borrowCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n borrowCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local borrow cap\n borrowCap = borrowCaps[cToken];\n }\n }\n}\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IFeeDistributor.sol\";\nimport \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract UnitrollerAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n\n /**\n * @notice Administrator for this contract\n */\n address public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address public pendingAdmin;\n\n /**\n * @notice Whether or not the Ionic admin has admin rights\n */\n bool public ionicAdminHasRights = true;\n\n /**\n * @notice Whether or not the admin has admin rights\n */\n bool public adminHasRights = true;\n\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\n }\n}\n\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\n /**\n * @notice Oracle which gives the price of any given asset\n */\n BasePriceOracle public oracle;\n\n /**\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\n */\n uint256 public closeFactorMantissa;\n\n /**\n * @notice Multiplier representing the discount on collateral that a liquidator receives\n */\n uint256 public liquidationIncentiveMantissa;\n\n /*\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\n */\n uint256 internal maxAssets;\n\n /**\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\n */\n mapping(address => ICErc20[]) public accountAssets;\n}\n\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\n struct Market {\n // Whether or not this market is listed\n bool isListed;\n // Multiplier representing the most one can borrow against their collateral in this market.\n // For instance, 0.9 to allow borrowing 90% of collateral value.\n // Must be between 0 and 1, and stored as a mantissa.\n uint256 collateralFactorMantissa;\n // Per-market mapping of \"accounts in this asset\"\n mapping(address => bool) accountMembership;\n }\n\n /**\n * @notice Official mapping of cTokens -> Market metadata\n * @dev Used e.g. to determine if a market is supported\n */\n mapping(address => Market) public markets;\n\n /// @notice A list of all markets\n ICErc20[] public allMarkets;\n\n /**\n * @dev Maps borrowers to booleans indicating if they have entered any markets\n */\n mapping(address => bool) internal borrowers;\n\n /// @notice A list of all borrowers who have entered markets\n address[] public allBorrowers;\n\n // Indexes of borrower account addresses in the `allBorrowers` array\n mapping(address => uint256) internal borrowerIndexes;\n\n /**\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\n */\n mapping(address => bool) public suppliers;\n\n /// @notice All cTokens addresses mapped by their underlying token addresses\n mapping(address => ICErc20) public cTokensByUnderlying;\n\n /// @notice Whether or not the supplier whitelist is enforced\n bool public enforceWhitelist;\n\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\n mapping(address => bool) public whitelist;\n\n /// @notice An array of all whitelisted accounts\n address[] public whitelistArray;\n\n // Indexes of account addresses in the `whitelistArray` array\n mapping(address => uint256) internal whitelistIndexes;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n * Actions which allow users to remove their own assets cannot be paused.\n * Liquidation / seizing / transfer can only be paused globally, not by market.\n */\n address public pauseGuardian;\n bool public _mintGuardianPaused;\n bool public _borrowGuardianPaused;\n bool public transferGuardianPaused;\n bool public seizeGuardianPaused;\n mapping(address => bool) public mintGuardianPaused;\n mapping(address => bool) public borrowGuardianPaused;\n}\n\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\n address public borrowCapGuardian;\n\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\n mapping(address => uint256) public borrowCaps;\n\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\n mapping(address => uint256) public supplyCaps;\n\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\n address[] public rewardsDistributors;\n\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\n bool internal _notEntered;\n\n /// @dev Whether or not _notEntered has been initialized\n bool internal _notEnteredInitialized;\n\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\n address[] public nonAccruingRewardsDistributors;\n\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\n\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => mapping(address => EnumerableSet.AddressSet))\n internal borrowingAgainstCollateralBlacklistWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\n}\n\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\n /// @dev Adrastia Prudentia config for controlling borrow caps.\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\n\n /// @dev Adrastia Prudentia config for controlling supply caps.\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\n}\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\n/**\n * @title Compound's CErc20 Contract\n * @notice CTokens which wrap an EIP-20 underlying\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\n * @author Compound\n */\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n modifier isMinHFThresholdExceeded(address borrower) {\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\n _;\n } else {\n _;\n }\n }\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 13;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.mint.selector;\n functionSelectors[--fnsCount] = this.redeem.selector;\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\n functionSelectors[--fnsCount] = this.borrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\n functionSelectors[--fnsCount] = this.getCash.selector;\n functionSelectors[--fnsCount] = this.seize.selector;\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemInternal(redeemTokens);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemUnderlyingInternal(redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return borrowInternal(borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\n return err;\n }\n\n /**\n * @notice Get cash balance of this cToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view override returns (uint256) {\n return getCashInternal();\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another cToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\n }\n\n function selfTransferOut(address to, uint256 amount) external override {\n require(msg.sender == address(this), \"!self\");\n doTransferOut(to, amount);\n }\n\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\n require(msg.sender == address(this), \"!self\");\n return doTransferIn(from, amount);\n }\n\n /**\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\n }\n\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalIonicFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\n totalIonicFees = totalIonicFeesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(address(ionicAdmin), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces admin fees by transferring to admin\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalAdminFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n totalAdminFees = totalAdminFees - withdrawAmount;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view virtual returns (uint256) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\n \"TOKEN_TRANSFER_IN_FAILED\"\n );\n\n // Calculate the amount that was *actually* transferred\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address to, uint256 amount) internal virtual {\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\n \"TOKEN_TRANSFER_OUT_FAILED\"\n );\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n struct MintLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 mintTokens;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n uint256 actualMintAmount;\n }\n\n /**\n * @notice User supplies assets into the market and receives cTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\n /* Fail if mint not allowed */\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n // Check max supply\n // unused function\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n } */\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of cTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n // mintTokens is rounded down here - correct\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\n\n /*\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\n\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, 0, redeemAmount);\n }\n\n struct RedeemLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 redeemTokens;\n uint256 redeemAmount;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n }\n\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\n res = (x * 1e18) / y;\n if (x % y != 0) res += 1;\n }\n\n /**\n * @notice User redeems cTokens in exchange for the underlying asset\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemFresh(\n address redeemer,\n uint256 redeemTokensIn,\n uint256 redeemAmountIn\n ) internal returns (uint256) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\n\n RedeemLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n if (redeemTokensIn > 0) {\n // don't allow dust tokens/assets to be left after\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\n\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n } else {\n if (redeemAmountIn == type(uint256).max) {\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\n }\n\n // don't allow dust tokens/assets to be left after\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\n\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\n\n // don't allow dust tokens/assets to be left after\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashInternal() < vars.redeemAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the redeemer and the redeemAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(redeemer, vars.redeemAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\n\n /* We call the defense hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(msg.sender, borrowAmount);\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n }\n\n /**\n * @notice Users borrow assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\n /* Fail if borrow not allowed */\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\n }\n\n /* Fail gracefully if protocol has insufficient underlying cash */\n uint256 cashPrior = getCashInternal();\n\n if (cashPrior < borrowAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n uint256(vars.mathErr)\n );\n }\n\n // Check min borrow for this user for this asset\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the borrower and the borrowAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(borrower, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.borrowVerify(address(this), borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\n internal\n nonReentrant(false)\n returns (uint256, uint256)\n {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint256 repayAmount;\n uint256 borrowerIndex;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n uint256 actualRepayAmount;\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer the account paying off the borrow\n * @param borrower the account with the debt being payed off\n * @param repayAmount the amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(\n address payer,\n address borrower,\n uint256 repayAmount\n ) internal returns (uint256, uint256) {\n /* Fail if repayBorrow not allowed */\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == type(uint256).max) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\n\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n ICErc20(cTokenCollateral).accrueInterest();\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal returns (uint256, uint256) {\n /* Fail if liquidate not allowed */\n uint256 allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n cTokenCollateral,\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify cTokenCollateral market's block number equals current block number */\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == type(uint256).max) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n cTokenCollateral,\n actualRepayAmount\n );\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint256 seizeError;\n if (cTokenCollateral == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\n\n /* We call the defense hook */\n // unused function\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\n\n return (uint256(Error.NO_ERROR), actualRepayAmount);\n }\n\n struct SeizeInternalLocalVars {\n MathError mathErr;\n uint256 borrowerTokensNew;\n uint256 liquidatorTokensNew;\n uint256 liquidatorSeizeTokens;\n uint256 protocolSeizeTokens;\n uint256 protocolSeizeAmount;\n uint256 exchangeRateMantissa;\n uint256 totalReservesNew;\n uint256 totalIonicFeeNew;\n uint256 totalSupplyNew;\n uint256 feeSeizeTokens;\n uint256 feeSeizeAmount;\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) internal returns (uint256) {\n /* Fail if seize not allowed */\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n SeizeInternalLocalVars memory vars;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\n }\n\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n vars.protocolSeizeAmount = mul_ScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n vars.protocolSeizeTokens\n );\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\n\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\n\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n totalReserves = vars.totalReservesNew;\n totalSupply = vars.totalSupplyNew;\n totalIonicFees = vars.totalIonicFeeNew;\n\n accountTokens[borrower] = vars.borrowerTokensNew;\n accountTokens[liquidator] = vars.liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\n\n /* We call the defense hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n function asCTokenExtension() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\n\nabstract contract CTokenAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n}\n\nabstract contract CErc20Storage is CTokenAdminStorage {\n /**\n * @dev Guard variable for re-entrancy checks\n */\n bool internal _notEntered;\n\n /**\n * @notice EIP-20 token name for this token\n */\n string public name;\n\n /**\n * @notice EIP-20 token symbol for this token\n */\n string public symbol;\n\n /**\n * @notice EIP-20 token decimals for this token\n */\n uint8 public decimals;\n\n /*\n * Maximum borrow rate that can ever be applied (.0005% / block)\n */\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\n\n /*\n * Maximum fraction of interest that can be set aside for reserves + fees\n */\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\n\n /**\n * @notice Contract which oversees inter-cToken operations\n */\n IonicComptroller public comptroller;\n\n /**\n * @notice Model which tells what the current interest rate should be\n */\n InterestRateModel public interestRateModel;\n\n /*\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\n */\n uint256 internal initialExchangeRateMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for admin fees\n */\n uint256 public adminFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for Ionic fees\n */\n uint256 public ionicFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for reserves\n */\n uint256 public reserveFactorMantissa;\n\n /**\n * @notice Block number that interest was last accrued at\n */\n uint256 public accrualBlockNumber;\n\n /**\n * @notice Accumulator of the total earned interest rate since the opening of the market\n */\n uint256 public borrowIndex;\n\n /**\n * @notice Total amount of outstanding borrows of the underlying in this market\n */\n uint256 public totalBorrows;\n\n /**\n * @notice Total amount of reserves of the underlying held in this market\n */\n uint256 public totalReserves;\n\n /**\n * @notice Total amount of admin fees of the underlying held in this market\n */\n uint256 public totalAdminFees;\n\n /**\n * @notice Total amount of Ionic fees of the underlying held in this market\n */\n uint256 public totalIonicFees;\n\n /**\n * @notice Total number of tokens in circulation\n */\n uint256 public totalSupply;\n\n /*\n * Official record of token balances for each account\n */\n mapping(address => uint256) internal accountTokens;\n\n /*\n * Approved token transfer amounts on behalf of others\n */\n mapping(address => mapping(address => uint256)) internal transferAllowances;\n\n /**\n * @notice Container for borrow balance information\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n */\n struct BorrowSnapshot {\n uint256 principal;\n uint256 interestIndex;\n }\n\n /*\n * Mapping of account addresses to outstanding borrow balances\n */\n mapping(address => BorrowSnapshot) internal accountBorrows;\n\n /*\n * Share of seized collateral that is added to reserves\n */\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\n\n /*\n * Share of seized collateral taken as fees\n */\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\n\n /**\n * @notice Underlying asset for this CToken\n */\n address public underlying;\n\n /**\n * @notice Addresses Provider\n */\n AddressesProvider public ap;\n\n /**\n * @notice Morpho Universal Rewards Distributor\n */\n address public morphoURD;\n\n /**\n * @notice Permissioned cTokenMinter\n */\n address public cTokenMinter;\n}\n\nabstract contract CTokenBaseEvents {\n /* ERC20 */\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the admin fee is changed\n */\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\n\n /**\n * @notice Event emitted when the Ionic fee is changed\n */\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\n}\n\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\n event Flash(address receiver, uint256 amount);\n}\n\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral,\n uint256 seizeTokens\n );\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\n}\n\ninterface CTokenFirstExtensionInterface {\n /*** User Interface ***/\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n /*** Admin Functions ***/\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\n\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function exchangeRateCurrent() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function totalBorrowsCurrent() external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external view returns (uint256);\n\n function getTotalUnderlyingSupplied() external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external view returns (uint256);\n\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n\n function flash(uint256 amount, bytes calldata data) external;\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface CTokenSecondExtensionInterface {\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\n\n /*** Admin Functions ***/\n\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\n\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\n\n function selfTransferOut(address to, uint256 amount) external;\n\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\n}\n\ninterface CDelegatorInterface {\n function implementation() external view returns (address);\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external;\n}\n\ninterface CDelegateInterface {\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @dev Should revert if any issues arise which make it unfit for delegation\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes calldata data) external;\n\n function delegateType() external pure returns (uint8);\n\n function contractType() external pure returns (string memory);\n}\n\nabstract contract CErc20AdminBase is CErc20Storage {\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\n return\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\n }\n}\n\nabstract contract CErc20FirstExtensionBase is\n CErc20AdminBase,\n CTokenFirstExtensionEvents,\n CTokenFirstExtensionInterface\n{}\n\nabstract contract CTokenSecondExtensionBase is\n CErc20AdminBase,\n CTokenSecondExtensionEvents,\n CTokenSecondExtensionInterface,\n CDelegateInterface\n{}\n\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\n\ninterface CErc20StorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function comptroller() external view returns (IonicComptroller);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function accrualBlockNumber() external view returns (uint256);\n\n function underlying() external view returns (address);\n\n function borrowIndex() external view returns (uint256);\n\n function interestRateModel() external view returns (address);\n}\n\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\n function plugin() external view returns (address);\n}\n\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\n function approve(address, address) external;\n}\n\ninterface ICErc20 is\n CErc20StorageInterface,\n CTokenSecondExtensionInterface,\n CTokenFirstExtensionInterface,\n CDelegatorInterface,\n CDelegateInterface\n{}\n\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\n function _updatePlugin(address _plugin) external;\n}\n\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenOracleProtected is CErc20Storage {\n error InteractionNotAllowed();\n error CallerIsNotEOA();\n\n modifier onlyOracleApproved() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyOracleApprovedAllowEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n if (tx.origin == msg.sender) {\n _;\n return;\n }\n\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyNotBlacklistedEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n if (msg.sender != tx.origin) {\n revert CallerIsNotEOA();\n }\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n _;\n }\n}\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title ERC 20 Token Standard Interface\n * https://eips.ethereum.org/EIPS/eip-20\n */\ninterface EIP20Interface {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n /**\n * @notice Get the total number of tokens in circulation\n * @return uint256 The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance uint256 The balance\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool success);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return success bool Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ncontract ComptrollerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n COMPTROLLER_MISMATCH,\n INSUFFICIENT_SHORTFALL,\n INSUFFICIENT_LIQUIDITY,\n INVALID_CLOSE_FACTOR,\n INVALID_COLLATERAL_FACTOR,\n INVALID_LIQUIDATION_INCENTIVE,\n MARKET_NOT_LISTED,\n MARKET_ALREADY_LISTED,\n MATH_ERROR,\n NONZERO_BORROW_BALANCE,\n PRICE_ERROR,\n REJECTION,\n SNAPSHOT_ERROR,\n TOO_MANY_ASSETS,\n TOO_MUCH_REPAY,\n SUPPLIER_NOT_WHITELISTED,\n BORROW_BELOW_MIN,\n SUPPLY_ABOVE_MAX,\n NONZERO_TOTAL_SUPPLY\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\n EXIT_MARKET_BALANCE_OWED,\n EXIT_MARKET_REJECTION,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\n SET_CLOSE_FACTOR_OWNER_CHECK,\n SET_CLOSE_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_NO_EXISTS,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_PRICE_ORACLE_OWNER_CHECK,\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\n SET_WHITELIST_STATUS_OWNER_CHECK,\n SUPPORT_MARKET_EXISTS,\n SUPPORT_MARKET_OWNER_CHECK,\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\n UNSUPPORT_MARKET_OWNER_CHECK,\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\n UNSUPPORT_MARKET_IN_USE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return uint256(err);\n }\n}\n\ncontract TokenErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n BAD_INPUT,\n COMPTROLLER_REJECTION,\n COMPTROLLER_CALCULATION_ERROR,\n INTEREST_RATE_MODEL_ERROR,\n INVALID_ACCOUNT_PAIR,\n INVALID_CLOSE_AMOUNT_REQUESTED,\n INVALID_COLLATERAL_FACTOR,\n MATH_ERROR,\n MARKET_NOT_FRESH,\n MARKET_NOT_LISTED,\n TOKEN_INSUFFICIENT_ALLOWANCE,\n TOKEN_INSUFFICIENT_BALANCE,\n TOKEN_INSUFFICIENT_CASH,\n TOKEN_TRANSFER_IN_FAILED,\n TOKEN_TRANSFER_OUT_FAILED,\n UTILIZATION_ABOVE_MAX\n }\n\n /*\n * Note: FailureInfo (but not Error) is kept in alphabetical order\n * This is because FailureInfo grows significantly faster, and\n * the order of Error has some meaning, while the order of FailureInfo\n * is entirely arbitrary.\n */\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n BORROW_ACCRUE_INTEREST_FAILED,\n BORROW_CASH_NOT_AVAILABLE,\n BORROW_FRESHNESS_CHECK,\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n BORROW_MARKET_NOT_LISTED,\n BORROW_COMPTROLLER_REJECTION,\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n LIQUIDATE_COMPTROLLER_REJECTION,\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n LIQUIDATE_FRESHNESS_CHECK,\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_ACCRUE_INTEREST_FAILED,\n MINT_COMPTROLLER_REJECTION,\n MINT_EXCHANGE_CALCULATION_FAILED,\n MINT_EXCHANGE_RATE_READ_FAILED,\n MINT_FRESHNESS_CHECK,\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n MINT_TRANSFER_IN_FAILED,\n MINT_TRANSFER_IN_NOT_POSSIBLE,\n NEW_UTILIZATION_RATE_ABOVE_MAX,\n REDEEM_ACCRUE_INTEREST_FAILED,\n REDEEM_COMPTROLLER_REJECTION,\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\n REDEEM_EXCHANGE_RATE_READ_FAILED,\n REDEEM_FRESHNESS_CHECK,\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\n WITHDRAW_IONIC_FEES_VALIDATION,\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\n WITHDRAW_ADMIN_FEES_VALIDATION,\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\n REDUCE_RESERVES_ADMIN_CHECK,\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\n REDUCE_RESERVES_FRESH_CHECK,\n REDUCE_RESERVES_VALIDATION,\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_COMPTROLLER_REJECTION,\n REPAY_BORROW_FRESHNESS_CHECK,\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COMPTROLLER_OWNER_CHECK,\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\n SET_ADMIN_FEE_ADMIN_CHECK,\n SET_ADMIN_FEE_FRESH_CHECK,\n SET_ADMIN_FEE_BOUNDS_CHECK,\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\n SET_IONIC_FEE_FRESH_CHECK,\n SET_IONIC_FEE_BOUNDS_CHECK,\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\n SET_RESERVE_FACTOR_ADMIN_CHECK,\n SET_RESERVE_FACTOR_FRESH_CHECK,\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\n TRANSFER_COMPTROLLER_REJECTION,\n TRANSFER_NOT_ALLOWED,\n TRANSFER_NOT_ENOUGH,\n TRANSFER_TOO_MUCH,\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\n ADD_RESERVES_FRESH_CHECK,\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\n }\n}\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CarefulMath.sol\";\nimport \"./ExponentialNoError.sol\";\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract Exponential is CarefulMath, ExponentialNoError {\n /**\n * @dev Creates an exponential from numerator and denominator values.\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\n * or if `denom` is zero.\n */\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\n }\n\n /**\n * @dev Adds two exponentials, returning a new exponential.\n */\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Subtracts two exponentials, returning a new exponential.\n */\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, returning a new Exp.\n */\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(product));\n }\n\n /**\n * @dev Divide an Exp by a scalar, returning a new Exp.\n */\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\n }\n\n /**\n * @dev Divide a scalar by an Exp, returning a new Exp.\n */\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\n /*\n We are doing this as:\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\n\n How it works:\n Exp = a / b;\n Scalar = s;\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\n */\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n return getExp(numerator, divisor.mantissa);\n }\n\n /**\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\n */\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(fraction));\n }\n\n /**\n * @dev Multiplies two exponentials, returning a new exponential.\n */\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n // We add half the scale before dividing so that we get rounding instead of truncation.\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\n assert(err2 == MathError.NO_ERROR);\n\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\n }\n\n /**\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\n */\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\n }\n\n /**\n * @dev Multiplies three exponentials, returning a new exponential.\n */\n function mulExp3(\n Exp memory a,\n Exp memory b,\n Exp memory c\n ) internal pure returns (MathError, Exp memory) {\n (MathError err, Exp memory ab) = mulExp(a, b);\n if (err != MathError.NO_ERROR) {\n return (err, ab);\n }\n return mulExp(ab, c);\n }\n\n /**\n * @dev Divides two exponentials, returning a new exponential.\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\n */\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n return getExp(a.mantissa, b.mantissa);\n }\n}\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract ExponentialNoError {\n uint256 constant expScale = 1e18;\n uint256 constant doubleScale = 1e36;\n uint256 constant halfExpScale = expScale / 2;\n uint256 constant mantissaOne = expScale;\n\n struct Exp {\n uint256 mantissa;\n }\n\n struct Double {\n uint256 mantissa;\n }\n\n /**\n * @dev Truncates the given exp to a whole number value.\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\n */\n function truncate(Exp memory exp) internal pure returns (uint256) {\n // Note: We are not using careful math here as we're performing a division that cannot fail\n return exp.mantissa / expScale;\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return truncate(product);\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mul_ScalarTruncateAddUInt(\n Exp memory a,\n uint256 scalar,\n uint256 addend\n ) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return add_(truncate(product), addend);\n }\n\n /**\n * @dev Checks if first Exp is less than second Exp.\n */\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa < right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp <= right Exp.\n */\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa <= right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp > right Exp.\n */\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa > right.mantissa;\n }\n\n /**\n * @dev returns true if Exp is exactly zero\n */\n function isZeroExp(Exp memory value) internal pure returns (bool) {\n return value.mantissa == 0;\n }\n\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\n require(n < 2**224, errorMessage);\n return uint224(n);\n }\n\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2**32, errorMessage);\n return uint32(n);\n }\n\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\n return add_(a, b, \"addition overflow\");\n }\n\n function add_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub_(a, b, \"subtraction underflow\");\n }\n\n function sub_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\n }\n\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / expScale;\n }\n\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\n }\n\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / doubleScale;\n }\n\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\n return mul_(a, b, \"multiplication overflow\");\n }\n\n function mul_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n if (a == 0 || b == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n return c;\n }\n\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\n }\n\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return div_(mul_(a, expScale), b.mantissa);\n }\n\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\n }\n\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\n return div_(mul_(a, doubleScale), b.mantissa);\n }\n\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\n return div_(a, b, \"divide by zero\");\n }\n\n function div_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\n }\n}\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../ionic/AuthoritiesRegistry.sol\";\n\ninterface IFeeDistributor {\n function minBorrowEth() external view returns (uint256);\n\n function maxUtilizationRate() external view returns (uint256);\n\n function interestFeeRate() external view returns (uint256);\n\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\n\n function latestCErc20Delegate(uint8 delegateType)\n external\n view\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\n\n function latestPluginImplementation(address oldImplementation) external view returns (address);\n\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\n\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address);\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\n\n fallback() external payable;\n\n receive() external payable;\n}\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's InterestRateModel Interface\n * @author Compound\n */\nabstract contract InterestRateModel {\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n bool public constant isInterestRateModel = true;\n\n /**\n * @notice Calculates the current borrow interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view virtual returns (uint256);\n\n /**\n * @notice Calculates the current supply interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @param reserveFactorMantissa The current reserve factor the market has\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual returns (uint256);\n}\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ErrorReporter.sol\";\nimport \"./ComptrollerStorage.sol\";\nimport \"./Comptroller.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\n\n/**\n * @title Unitroller\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\n * CTokens should reference this contract as their comptroller.\n */\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\n /**\n * @notice Event emitted when the admin rights are changed\n */\n event AdminRightsToggled(bool hasRights);\n\n /**\n * @notice Emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n constructor(address payable _ionicAdmin) {\n admin = msg.sender;\n ionicAdmin = _ionicAdmin;\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Toggles admin rights.\n * @param hasRights Boolean indicating if the admin is to have rights.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\n }\n\n // Check that rights have not already been set to the desired value\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\n\n adminHasRights = hasRights;\n emit AdminRightsToggled(hasRights);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @param newPendingAdmin New pending admin.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\n }\n\n address oldPendingAdmin = pendingAdmin;\n pendingAdmin = newPendingAdmin;\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n * @dev Admin function for pending admin to accept role and update admin\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint256) {\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n admin = pendingAdmin;\n pendingAdmin = address(0);\n\n emit NewAdmin(oldAdmin, admin);\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n function comptrollerImplementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n\n address currentImplementation = comptrollerImplementation();\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\n currentImplementation\n );\n\n _updateExtensions(latestComptrollerImplementation);\n\n if (currentImplementation != latestComptrollerImplementation) {\n // reinitialize\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function _updateExtensions(address currentComptroller) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(hasAdminRights(), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\ninterface IHypernativeOracle {\n function register(address account, bool isStrictMode) external;\n function validateForbiddenAccountInteraction(address sender) external view;\n function validateForbiddenContextInteraction(address origin, address sender) external view;\n function validateBlacklistedAccountInteraction(address sender) external;\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelay {\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\n // This will return true if and only if it's being called while executing the auction winner(s) call.\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\n // @param permissionId The id that represents the action being gated\n // @return permissioned True if the permission is allowed, false otherwise\n function isPermissioned(\n address protocolFeeReceiver,\n bytes calldata permissionId\n ) external view returns (bool permissioned);\n}\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelayFeeReceiver {\n // Receive the proceeds of an auction.\n // @param permissionKey The permission key where the auction was conducted on.\n function receiveAuctionProceedings(\n bytes calldata permissionKey\n ) external payable;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV3PoolActions.sol\";\n\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function fee() external view returns (uint24);\n\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n function liquidity() external view returns (uint128);\n\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\n\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 liquidityCumulative,\n bool initialized\n );\n\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\n/// @title Quoter Interface\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\ninterface IUniswapV3Quoter {\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee\n /// @param amountIn The amount of the first token to swap\n /// @return amountOut The amount of the last token that would be received\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\n\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountIn The desired input amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountOut The amount of `tokenOut` that would be received\n function quoteExactInputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountIn,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountOut);\n\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\n /// @param amountOut The amount of the last token to receive\n /// @return amountIn The amount of first token required to be paid\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\n\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountOut The desired output amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\n function quoteExactOutputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountOut,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountIn);\n}\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\n\ninterface ILiquidator {\n /**\n * borrower The borrower's Ethereum address.\n * repayAmount The amount to repay to liquidate the unhealthy loan.\n * cErc20 The borrowed CErc20 contract to repay.\n * cTokenCollateral The cToken collateral contract to be liquidated.\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\n */\n struct LiquidateToTokensWithFlashSwapVars {\n address borrower;\n uint256 repayAmount;\n ICErc20 cErc20;\n ICErc20 cTokenCollateral;\n address flashSwapContract;\n uint256 minProfitAmount;\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] strategyData;\n IFundsConversionStrategy[] debtFundingStrategies;\n bytes[] debtFundingStrategiesData;\n }\n\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256);\n\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\n external\n returns (uint256);\n\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\n\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\n external;\n\n function setExpressRelay(address _expressRelay) external;\n\n function setPoolLens(address _poolLens) external;\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\n}\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title AddressesProvider\n * @notice The Addresses Provider serves as a central storage of system internal and external\n * contract addresses that change between deploys and across chains\n * @author Veliko Minkov \n */\ncontract AddressesProvider is SafeOwnableUpgradeable {\n mapping(string => address) private _addresses;\n mapping(address => Contract) public plugins;\n mapping(address => Contract) public flywheelRewards;\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\n JarvisPool[] public jarvisPoolsConfig;\n CurveSwapPool[] public curveSwapPoolsConfig;\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\n\n /// @dev Initializer to set the admin that can set and change contracts addresses\n function initialize(address owner) public initializer {\n __SafeOwnable_init(owner);\n }\n\n /**\n * @dev The contract address and a string that uniquely identifies the contract's interface\n */\n struct Contract {\n address addr;\n string contractInterface;\n }\n\n struct RedemptionStrategy {\n address addr;\n string contractInterface;\n address outputToken;\n }\n\n struct FundingStrategy {\n address addr;\n string contractInterface;\n address inputToken;\n }\n\n struct JarvisPool {\n address syntheticToken;\n address collateralToken;\n address liquidityPool;\n uint256 expirationTime;\n }\n\n struct CurveSwapPool {\n address poolAddress;\n address[] coins;\n }\n\n /**\n * @dev sets the address and contract interface ID of the flywheel for the reward token\n * @param rewardToken the reward token address\n * @param flywheelRewardsModule the flywheel rewards module address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFlywheelRewards(\n address rewardToken,\n address flywheelRewardsModule,\n string calldata contractInterface\n ) public onlyOwner {\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\n * @param asset the asset address\n * @param plugin the ERC4626 plugin address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setPlugin(\n address asset,\n address plugin,\n string calldata contractInterface\n ) public onlyOwner {\n plugins[asset] = Contract(plugin, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\n * @param asset the asset address\n * @param strategy redemption strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setRedemptionStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address outputToken\n ) public onlyOwner {\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\n }\n\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\n return redemptionStrategiesConfig[asset];\n }\n\n /**\n * @dev sets the address and contract interface ID of the funding strategy for the asset\n * @param asset the asset address\n * @param strategy funding strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFundingStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address inputToken\n ) public onlyOwner {\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\n }\n\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\n return fundingStrategiesConfig[asset];\n }\n\n /**\n * @dev configures the Jarvis pool of a Jarvis synthetic token\n * @param syntheticToken the synthetic token address\n * @param collateralToken the collateral token address\n * @param liquidityPool the liquidity pool address\n * @param expirationTime the operation expiration time\n */\n function setJarvisPool(\n address syntheticToken,\n address collateralToken,\n address liquidityPool,\n uint256 expirationTime\n ) public onlyOwner {\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\n }\n\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\n }\n\n /**\n * @dev Sets an address for an id replacing the address saved in the addresses map\n * @param id The id\n * @param newAddress The address to set\n */\n function setAddress(string calldata id, address newAddress) external onlyOwner {\n _addresses[id] = newAddress;\n }\n\n /**\n * @dev Returns an address by id\n * @return The address\n */\n function getAddress(string calldata id) public view returns (address) {\n return _addresses[id];\n }\n\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\n return curveSwapPoolsConfig;\n }\n\n function getJarvisPools() public view returns (JarvisPool[] memory) {\n return jarvisPoolsConfig;\n }\n\n function setBalancerPoolForTokens(\n address inputToken,\n address outputToken,\n address pool\n ) external onlyOwner {\n balancerPoolForTokens[inputToken][outputToken] = pool;\n }\n\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\n return balancerPoolForTokens[inputToken][outputToken];\n }\n}\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\n PoolRolesAuthority public poolAuthLogic;\n address public leveredPositionsFactory;\n bool public noAuthRequired;\n\n function initialize(address _leveredPositionsFactory) public initializer {\n __SafeOwnable_init(msg.sender);\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n }\n\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n // for Neon the auth is not required\n noAuthRequired = block.chainid == 245022934;\n }\n\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\n\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\n auth = PoolRolesAuthority(address(proxy));\n auth.initialize(address(this));\n poolsAuthorities[pool] = auth;\n\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\n // sets the registry owner as the auth owner\n reconfigureAuthority(pool);\n }\n\n function reconfigureAuthority(address poolAddress) public {\n IonicComptroller pool = IonicComptroller(poolAddress);\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\n\n if (msg.sender != poolAddress || address(auth) != address(0)) {\n require(address(auth) != address(0), \"no such authority\");\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\n\n auth.configureRegistryCapabilities();\n auth.configurePoolSupplierCapabilities(pool);\n auth.configurePoolBorrowerCapabilities(pool);\n // everyone can be a liquidator\n auth.configureOpenPoolLiquidatorCapabilities(pool);\n auth.configureLeveredPositionCapabilities(pool);\n\n if (auth.owner() != owner()) {\n auth.setOwner(owner());\n }\n }\n }\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool) {\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\n if (address(authorityForPool) == address(0)) {\n return noAuthRequired;\n } else {\n // allow only if an auth exists and it allows the action\n return authorityForPool.canCall(user, target, functionSig);\n }\n }\n\n function setUserRole(\n address pool,\n address user,\n uint8 role,\n bool enabled\n ) external {\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\n\n require(address(poolAuth) != address(0), \"auth does not exist\");\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\n\n poolAuth.setUserRole(user, role, enabled);\n }\n}\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @notice a base contract for logic extensions that use the diamond pattern storage\n * to map the functions when looking up the extension contract to delegate to.\n */\nabstract contract DiamondExtension {\n /**\n * @return a list of all the function selectors that this logic extension exposes\n */\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\n}\n\n// When no function exists for function called\nerror FunctionNotFound(bytes4 _functionSelector);\n\n// When no extension exists for function called\nerror ExtensionNotFound(bytes4 _functionSelector);\n\n// When the function is already added\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\n\nabstract contract DiamondBase {\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\n\n function _listExtensions() public view returns (address[] memory) {\n return LibDiamond.listExtensions();\n }\n\n fallback() external {\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n\n/**\n * @notice a library to use in a contract, whose logic is extended with diamond extension\n */\nlibrary LibDiamond {\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\n\n struct Function {\n address extension;\n bytes4 selector;\n }\n\n struct LogicStorage {\n Function[] functions;\n address[] extensions;\n }\n\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\n return getExtensionForSelector(msgSig, diamondStorage());\n }\n\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n assembly {\n ds.slot := position\n }\n }\n\n function listExtensions() internal view returns (address[] memory) {\n return diamondStorage().extensions;\n }\n\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\n if (address(extensionToReplace) != address(0)) {\n removeExtension(extensionToReplace);\n }\n addExtension(extensionToAdd);\n }\n\n function removeExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n // remove all functions of the extension to replace\n removeExtensionFunctions(extension);\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n if (ds.extensions[i] == address(extension)) {\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\n ds.extensions.pop();\n }\n }\n }\n\n function addExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n require(ds.extensions[i] != address(extension), \"extension already added\");\n }\n addExtensionFunctions(extension);\n ds.extensions.push(address(extension));\n }\n\n function removeExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\n bytes4 selectorToRemove = fnsToRemove[i];\n // must never fail\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\n // swap with the last element in the selectorAtIndex array and remove the last element\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\n ds.functions.pop();\n }\n }\n\n function addExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n uint16 functionsCount = uint16(ds.functions.length);\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\n bytes4 selector = fnsToAdd[functionsIndex];\n address oldImplementation = getExtensionForSelector(selector, ds);\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\n ds.functions.push(Function(address(extension), selector));\n functionsCount++;\n }\n }\n\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\n uint256 fnsLen = ds.functions.length;\n for (uint256 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\n }\n\n return address(0);\n }\n\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\n uint16 fnsLen = uint16(ds.functions.length);\n for (uint16 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return i;\n }\n\n return type(uint16).max;\n }\n}\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ninterface IFlashLoanReceiver {\n function receiveFlashLoan(\n address borrowedAsset,\n uint256 borrowedAmount,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\n\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\n constructor() RolesAuthority(address(0), Authority(address(0))) {\n _disableInitializers();\n }\n\n function initialize(address _owner) public initializer {\n owner = _owner;\n authority = this;\n }\n\n // up to 256 roles\n uint8 public constant REGISTRY_ROLE = 0;\n uint8 public constant SUPPLIER_ROLE = 1;\n uint8 public constant BORROWER_ROLE = 2;\n uint8 public constant LIQUIDATOR_ROLE = 3;\n uint8 public constant LEVERED_POSITION_ROLE = 4;\n\n function configureRegistryCapabilities() external requiresAuth {\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\n true\n );\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\n }\n\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, true);\n }\n\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, false);\n }\n\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\n }\n }\n }\n\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\n }\n\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\n uint8 fnsCount = 6;\n selectors = new bytes4[](fnsCount);\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return selectors;\n }\n\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\n }\n }\n }\n\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, true);\n }\n\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, false);\n }\n\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\n }\n }\n\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n // borrowers have the SUPPLIER_ROLE capabilities by default\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n // TODO this leaves redeeming open for everyone\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\n\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n}\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\n/**\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\n * that will shift the other.\n */\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\n /**\n * @notice Pending owner of this contract\n */\n address public pendingOwner;\n\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\n __Ownable_init();\n _transferOwnership(owner_);\n }\n\n struct AddressSlot {\n address value;\n }\n\n modifier onlyOwnerOrAdmin() {\n bool isOwner = owner() == _msgSender();\n if (!isOwner) {\n address admin = _getProxyAdmin();\n bool isAdmin = admin == _msgSender();\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\n }\n _;\n }\n\n /**\n * @notice Emitted when pendingOwner is changed\n */\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\n\n /**\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\n */\n event NewOwner(address oldOwner, address newOwner);\n\n /**\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @param newPendingOwner New pending owner.\n */\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\n // Save current value, if any, for inclusion in log\n address oldPendingOwner = pendingOwner;\n\n // Store pendingOwner with value newPendingOwner\n pendingOwner = newPendingOwner;\n\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\n }\n\n /**\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\n * @dev Owner function for pending owner to accept role and update owner\n */\n function _acceptOwner() public {\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\n require(msg.sender == pendingOwner, \"not the pending owner\");\n\n // Save current values for inclusion in log\n address oldOwner = owner();\n address oldPendingOwner = pendingOwner;\n\n // Store owner with value pendingOwner\n _transferOwnership(pendingOwner);\n\n // Clear the pending value\n pendingOwner = address(0);\n\n emit NewOwner(oldOwner, pendingOwner);\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\n }\n\n function renounceOwnership() public override onlyOwner {\n // do not remove this overriding fn\n revert(\"not used anymore\");\n }\n\n function transferOwnership(address newOwner) public override onlyOwner {\n emit NewPendingOwner(pendingOwner, newOwner);\n pendingOwner = newOwner;\n }\n\n function _getProxyAdmin() internal view returns (address admin) {\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n AddressSlot storage adminSlot;\n assembly {\n adminSlot.slot := _ADMIN_SLOT\n }\n admin = adminSlot.value;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ninterface IIonicFlywheel {\n function isRewardsDistributor() external returns (bool);\n\n function isFlywheel() external returns (bool);\n\n function flywheelPreSupplierAction(address market, address supplier) external;\n\n function flywheelPostSupplierAction(address market, address supplier) external;\n\n function flywheelPreBorrowerAction(address market, address borrower) external;\n\n function flywheelPostBorrowerAction(address market, address borrower) external;\n\n function flywheelPreTransferAction(address market, address src, address dst) external;\n\n function flywheelPostTransferAction(address market, address src, address dst) external;\n\n function compAccrued(address user) external view returns (uint256);\n\n function addMarketForRewards(ERC20 strategy) external;\n\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\n}\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicUniV3Liquidator\n * @author Veliko Minkov (https://github.com/vminkov)\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\n */\ncontract IonicUniV3Liquidator is\n OwnableUpgradeable,\n ILiquidator,\n IUniswapV3FlashCallback,\n IExpressRelayFeeReceiver,\n IFlashLoanReceiver\n{\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n\n address public W_NATIVE_ADDRESS;\n mapping(address => bool) public redemptionStrategiesWhitelist;\n IUniswapV3Quoter public quoter;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _quoter) external initializer {\n __Ownable_init();\n W_NATIVE_ADDRESS = _wtoken;\n quoter = IUniswapV3Quoter(_quoter);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n underlying.approve(address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\n flashSwapPool.flash(\n address(this),\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(\n LiquidateToTokensWithFlashSwapVars memory vars,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\n uint256 flashSwapReturnAmount = _flashSwapAmount;\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\n flashSwapReturnAmount += fee0;\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\n flashSwapReturnAmount += fee1;\n } else {\n revert(\"wrong pool or _flashSwapToken\");\n }\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay the borrowed asset directly\n collateralRequired = flashSwapReturnAmount;\n\n // Repay flashloan\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\n } else {\n // TODO swap within the same pool and then repay the FL to the pool\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\n\n {\n collateralRequired = quoter.quoteExactOutputSingle(\n zeroForOne ? pool.token0() : pool.token1(),\n zeroForOne ? pool.token1() : pool.token0(),\n pool.fee(),\n _flashSwapAmount,\n 0 // sqrtPriceLimitX96\n );\n }\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n\n // Repay flashloan\n pool.swap(\n address(pool),\n zeroForOne,\n int256(collateralRequired),\n 0, // sqrtPriceLimitX96\n \"\"\n );\n }\n\n return address(underlyingCollateral);\n } else {\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFundsConversionStrategy is IRedemptionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\n}\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @title IRedemptionStrategy\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function name() external view returns (string memory);\n}\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../compound/CTokenInterfaces.sol\";\n\n/**\n * @title BasePriceOracle\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\n * @dev Implements the `PriceOracle` interface.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface BasePriceOracle {\n /**\n * @notice Get the price of an underlying asset.\n * @param underlying The underlying asset to get the price of.\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function price(address underlying) external view returns (uint256);\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\n}\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\n\n/**\n * @title MasterPriceOracle\n * @notice Use a combination of price oracles.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public oracles;\n\n /**\n * @dev Default/fallback `PriceOracle`.\n */\n BasePriceOracle public defaultOracle;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool internal noAdminOverwrite;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public fallbackOracles;\n\n /**\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n function canAdminOverwrite() external view returns (bool) {\n return !noAdminOverwrite;\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Event emitted when the default oracle is changed.\n */\n event NewDefaultOracle(address oldOracle, address newOracle);\n\n /**\n * @dev Event emitted when an underlying token's oracle is changed.\n */\n event NewOracle(address underlying, address oldOracle, address newOracle);\n\n /**\n * @dev Initialize state variables.\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\n * @param _defaultOracle The default `PriceOracle` contract to use.\n * @param _admin The admin who can assign oracles to underlying tokens.\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address[] memory underlyings,\n BasePriceOracle[] memory _oracles,\n BasePriceOracle _defaultOracle,\n address _admin,\n bool _canAdminOverwrite,\n address _wtoken\n ) external initializer {\n // Input validation\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\n\n // Initialize state variables\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, address(0), address(newOracle));\n }\n\n defaultOracle = _defaultOracle;\n admin = _admin;\n noAdminOverwrite = !_canAdminOverwrite;\n wtoken = _wtoken;\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(oracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(fallbackOracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n fallbackOracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Changes the default price oracle\n */\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\n BasePriceOracle oldOracle = defaultOracle;\n defaultOracle = newOracle;\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = address(ICErc20(address(cToken)).underlying());\n\n if (underlying == wtoken) return 1e18;\n\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n\n /**\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) public view override returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == wtoken) return 1e18;\n\n // Get underlying price from assigned oracle\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n}\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./compound/Unitroller.sol\";\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\nimport \"./ionic/DiamondExtension.sol\";\n\n/**\n * @title PoolDirectory\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\n */\ncontract PoolDirectory is SafeOwnableUpgradeable {\n /**\n * @dev Initializes a deployer whitelist if desired.\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\n */\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\n __SafeOwnable_init(msg.sender);\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\n }\n\n /**\n * @dev Struct for a Ionic interest rate pool.\n */\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n /**\n * @dev Array of Ionic interest rate pools.\n */\n Pool[] public pools;\n\n /**\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\n */\n mapping(address => uint256[]) private _poolsByAccount;\n\n /**\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\n */\n mapping(address => bool) public poolExists;\n\n /**\n * @dev Emitted when a new Ionic pool is added to the directory.\n */\n event PoolRegistered(uint256 index, Pool pool);\n\n /**\n * @dev Booleans indicating if the deployer whitelist is enforced.\n */\n bool public enforceDeployerWhitelist;\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\n */\n mapping(address => bool) public deployerWhitelist;\n\n /**\n * @dev Controls if the deployer whitelist is to be enforced.\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\n */\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\n enforceDeployerWhitelist = enforce;\n }\n\n /**\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\n * @param deployers Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\n require(deployers.length > 0, \"No deployers supplied.\");\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\n }\n\n /**\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\n * @param name The name of the pool.\n * @param comptroller The pool's Comptroller proxy contract address.\n * @return The index of the registered Ionic pool.\n */\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\n require(bytes(name).length <= 100, \"No pool name supplied.\");\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n _poolsByAccount[msg.sender].push(pools.length - 1);\n poolExists[comptroller] = true;\n emit PoolRegistered(pools.length - 1, pool);\n return pools.length - 1;\n }\n\n function _deprecatePool(address comptroller) external onlyOwner {\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller == comptroller) {\n _deprecatePool(i);\n break;\n }\n }\n }\n\n function _deprecatePool(uint256 index) public onlyOwner {\n Pool storage ionicPool = pools[index];\n\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\n\n // swap with the last pool of the creator and delete\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\n for (uint256 i = 0; i < creatorPools.length; i++) {\n if (creatorPools[i] == index) {\n creatorPools[i] = creatorPools[creatorPools.length - 1];\n creatorPools.pop();\n break;\n }\n }\n\n // leave it to true to deny the re-registering of the same pool\n poolExists[ionicPool.comptroller] = true;\n\n // nullify the storage\n ionicPool.comptroller = address(0);\n ionicPool.creator = address(0);\n ionicPool.name = \"\";\n ionicPool.blockPosted = 0;\n ionicPool.timestampPosted = 0;\n }\n\n /**\n * @dev Deploys a new Ionic pool and adds to the directory.\n * @param name The name of the pool.\n * @param implementation The Comptroller implementation contract address.\n * @param constructorData Encoded construction data for `Unitroller constructor()`\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\n * @param closeFactor The pool's close factor (scaled by 1e18).\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\n * @param priceOracle The pool's PriceOracle contract address.\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\n */\n function deployPool(\n string memory name,\n address implementation,\n bytes calldata constructorData,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive,\n address priceOracle\n ) external returns (uint256, address) {\n // Input validation\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\n\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(\n 0,\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\n unitrollerCreationCode\n );\n\n // Setup the pool\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\n // Set up the extensions\n comptrollerProxy._upgrade();\n\n // Set pool parameters\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\n require(\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\n \"Failed to set pool liquidation incentive.\"\n );\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\n\n // Whitelist\n if (enforceWhitelist)\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\n\n // Make msg.sender the admin\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\n\n // Register the pool with this PoolDirectory\n return (_registerPool(name, proxy), proxy);\n }\n\n /**\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory activePools = new Pool[](count);\n uint256[] memory poolIds = new uint256[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n poolIds[index] = i;\n activePools[index] = pools[i];\n index++;\n }\n }\n\n return (poolIds, activePools);\n }\n\n /**\n * @notice Returns arrays of all Ionic pools' data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getAllPools() public view returns (Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory result = new Pool[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n result[index++] = pools[i];\n }\n }\n\n return result;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n indexes[index] = i;\n poolsOfUser[index] = activePools[i];\n index++;\n }\n\n return (indexes, poolsOfUser);\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\n */\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\n (, Pool[] memory activePools) = getActivePools();\n\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\n indexes[i] = _poolsByAccount[account][i];\n accountPools[i] = activePools[_poolsByAccount[account][i]];\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Modify existing Ionic pool name.\n */\n function setPoolName(uint256 index, string calldata name) external {\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\n require(\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\n \"!permission\"\n );\n pools[index].name = name;\n }\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\n */\n mapping(address => bool) public adminWhitelist;\n\n /**\n * @dev used as salt for the creation of new pools\n */\n uint256 public poolsCounter;\n\n /**\n * @dev Event emitted when the admin whitelist is updated.\n */\n event AdminWhitelistUpdated(address[] admins, bool status);\n\n /**\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\n * @param admins Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\n require(admins.length > 0, \"No admins supplied.\");\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\n emit AdminWhitelistUpdated(admins, status);\n }\n\n /**\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getVerifiedPoolsOfWhitelistedAccount(\n address account\n ) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n indexes[index] = i;\n accountWhitelistedPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, accountWhitelistedPools);\n }\n}\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\n\n/**\n * @title PoolLens\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLens is Initializable {\n error ComptrollerError(uint256 errCode);\n\n /**\n * @notice Initialize the `PoolDirectory` contract object.\n * @param _directory The PoolDirectory\n * @param _name Name for the nativeToken\n * @param _symbol Symbol for the nativeToken\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\n * @param _hardcodedNames Harcoded name for these tokens\n * @param _hardcodedSymbols Harcoded symbol for these tokens\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\n */\n function initialize(\n PoolDirectory _directory,\n string memory _name,\n string memory _symbol,\n address[] memory _hardcodedAddresses,\n string[] memory _hardcodedNames,\n string[] memory _hardcodedSymbols,\n string[] memory _uniswapLPTokenNames,\n string[] memory _uniswapLPTokenSymbols,\n string[] memory _uniswapLPTokenDisplayNames\n ) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n require(\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\n \"Hardcoded addresses lengths not equal.\"\n );\n require(\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\n \"Uniswap LP token names lengths not equal.\"\n );\n\n directory = _directory;\n name = _name;\n symbol = _symbol;\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\n }\n\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\n uniswapData.push(\n UniswapData({\n name: _uniswapLPTokenNames[i],\n symbol: _uniswapLPTokenSymbols[i],\n displayName: _uniswapLPTokenDisplayNames[i]\n })\n );\n }\n }\n\n string public name;\n string public symbol;\n\n struct TokenData {\n string name;\n string symbol;\n }\n mapping(address => TokenData) hardcoded;\n\n struct UniswapData {\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\n string symbol; // ie \"UNI-V2\" or \"SLP\"\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\n }\n UniswapData[] uniswapData;\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @dev Struct for Ionic pool summary data.\n */\n struct IonicPoolData {\n uint256 totalSupply;\n uint256 totalBorrow;\n address[] underlyingTokens;\n string[] underlyingSymbols;\n bool whitelistedAdmin;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsWithData()\n external\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\n {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsByVerificationWithData(\n bool whitelistedAdmin\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\n whitelistedAdmin\n );\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsOIonicrWithData(\n address user\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\n return (indexes, userPools, data, errored);\n }\n\n /**\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\n bool[] memory errored = new bool[](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\n uint256 _totalSupply,\n uint256 _totalBorrow,\n address[] memory _underlyingTokens,\n string[] memory _underlyingSymbols,\n bool _whitelistedAdmin\n ) {\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\n } catch {\n errored[i] = true;\n }\n }\n\n return (data, errored);\n }\n\n /**\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\n */\n function getPoolSummary(\n IonicComptroller comptroller\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\n uint256 totalBorrow = 0;\n uint256 totalSupply = 0;\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n address[] memory underlyingTokens = new address[](cTokens.length);\n string[] memory underlyingSymbols = new string[](cTokens.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n cToken.accrueInterest();\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\n uint256 assetTotalSupply = cToken.getCash() +\n assetTotalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\n\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\n }\n\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\n }\n\n /**\n * @dev Struct for a Ionic pool asset.\n */\n struct PoolAsset {\n address cToken;\n address underlyingToken;\n string underlyingName;\n string underlyingSymbol;\n uint256 underlyingDecimals;\n uint256 underlyingBalance;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 totalSupply;\n uint256 totalBorrow;\n uint256 supplyBalance;\n uint256 borrowBalance;\n uint256 liquidity;\n bool membership;\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\n address oracle;\n uint256 collateralFactor;\n uint256 reserveFactor;\n uint256 adminFee;\n uint256 ionicFee;\n bool borrowGuardianPaused;\n bool mintGuardianPaused;\n }\n\n /**\n * @notice Returns data on the specified assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\n * @param cTokens The cToken contract addresses of the assets to query.\n * @param user The user for which to get account data.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(\n IonicComptroller comptroller,\n ICErc20[] memory cTokens,\n address user\n ) internal returns (PoolAsset[] memory) {\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\n if (isListed) arrayLength++;\n }\n\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\n uint256 index = 0;\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n // Check if market is listed and get collateral factor\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\n if (!isListed) continue;\n\n // Start adding data to PoolAsset\n PoolAsset memory asset;\n ICErc20 cToken = cTokens[i];\n asset.cToken = address(cToken);\n\n cToken.accrueInterest();\n\n // Get underlying asset data\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\n asset.underlyingDecimals = underlying.decimals();\n asset.underlyingBalance = underlying.balanceOf(user);\n\n // Get cToken data\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\n asset.liquidity = cToken.getCash();\n asset.totalBorrow = cToken.totalBorrowsCurrent();\n asset.totalSupply =\n asset.liquidity +\n asset.totalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\n asset.membership = comptroller.checkMembership(user, cToken);\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\n\n // Get oracle for this cToken\n asset.oracle = address(oracle);\n\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\n asset.oracle = address(_oracle);\n } catch {}\n\n // More cToken data\n asset.collateralFactor = collateralFactorMantissa;\n asset.reserveFactor = cToken.reserveFactorMantissa();\n asset.adminFee = cToken.adminFeeMantissa();\n asset.ionicFee = cToken.ionicFeeMantissa();\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\n\n // Add to assets array and increment index\n detailedAssets[index] = asset;\n index++;\n }\n\n return (detailedAssets);\n }\n\n function getBorrowCapsPerCollateral(\n ICErc20 borrowedAsset,\n IonicComptroller comptroller\n )\n internal\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsAgainstCollateral,\n bool[] memory borrowingBlacklistedAgainstCollateral\n )\n {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n collateral = new address[](poolMarkets.length);\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\n\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n address collateralAddress = address(poolMarkets[i]);\n if (collateralAddress != address(borrowedAsset)) {\n collateral[i] = collateralAddress;\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\n address(borrowedAsset),\n collateralAddress\n );\n }\n }\n }\n\n /**\n * @notice Returns the `name` and `symbol` of `token`.\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\n * @param token An ERC20 token contract object.\n * @return The `name` and `symbol`.\n */\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\n // i.e. MKR is a DSToken and uses bytes32\n if (bytes(hardcoded[token].symbol).length != 0) {\n return (hardcoded[token].name, hardcoded[token].symbol);\n }\n\n // Get name and symbol from token contract\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\n string memory _name = tokenContract.name();\n string memory _symbol = tokenContract.symbol();\n\n return (_name, _symbol);\n }\n\n /**\n * @notice Returns the assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\n }\n\n /**\n * @dev Struct for a Ionic pool user.\n */\n struct IonicPoolUser {\n address account;\n uint256 totalBorrow;\n uint256 totalCollateral;\n uint256 health;\n }\n\n /**\n * @notice Returns arrays of PoolAsset for a specific user\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\n return assets;\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n }\n\n return (assets, supplyCapsPerAsset);\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsDataForPool(\n IonicComptroller comptroller\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\n }\n\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\n }\n\n /**\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n }\n\n /**\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsDataForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap,\n uint256 nonWhitelistedTotalBorrows\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n uint256 totalBorrows = asset.totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\n * Note that the whitelist does not have to be enforced.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getWhitelistedPoolsByAccount(\n address account\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) {\n indexes[index] = i;\n accountPools[index] = pools[i];\n index++;\n break;\n }\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getWhitelistedPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\n }\n\n function getHealthFactorHypothetical(\n IonicComptroller pool,\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\n account,\n cTokenModify,\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n\n if (err != 0) revert ComptrollerError(err);\n\n if (shortfall > 0) {\n // HF < 1.0\n return (collateralValue * 1e18) / (collateralValue + shortfall);\n } else {\n // HF >= 1.0\n if (collateralValue <= liquidity) return type(uint256).max;\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\n }\n }\n}\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\nabstract contract Auth {\n event OwnerUpdated(address indexed user, address indexed newOwner);\n\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n address public owner;\n\n Authority public authority;\n\n constructor(address _owner, Authority _authority) {\n owner = _owner;\n authority = _authority;\n\n emit OwnerUpdated(msg.sender, _owner);\n emit AuthorityUpdated(msg.sender, _authority);\n }\n\n modifier requiresAuth() virtual {\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\n\n _;\n }\n\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\n }\n\n function setAuthority(Authority newAuthority) public virtual {\n // We check if the caller is the owner first because we want to ensure they can\n // always swap out the authority even if it's reverting or using up a lot of gas.\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\n\n authority = newAuthority;\n\n emit AuthorityUpdated(msg.sender, newAuthority);\n }\n\n function setOwner(address newOwner) public virtual requiresAuth {\n owner = newOwner;\n\n emit OwnerUpdated(msg.sender, newOwner);\n }\n}\n\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\ninterface Authority {\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n}\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {Auth, Authority} from \"../Auth.sol\";\n\n/// @notice Role based Authority that supports up to 256 roles.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\ncontract RolesAuthority is Auth, Authority {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\n\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\n\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\n\n /*//////////////////////////////////////////////////////////////\n ROLE/USER STORAGE\n //////////////////////////////////////////////////////////////*/\n\n mapping(address => bytes32) public getUserRoles;\n\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\n\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\n\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\n }\n\n function doesRoleHaveCapability(\n uint8 role,\n address target,\n bytes4 functionSig\n ) public view virtual returns (bool) {\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\n }\n\n /*//////////////////////////////////////////////////////////////\n AUTHORIZATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) public view virtual override returns (bool) {\n return\n isCapabilityPublic[target][functionSig] ||\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\n }\n\n /*//////////////////////////////////////////////////////////////\n ROLE CAPABILITY CONFIGURATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setPublicCapability(\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n isCapabilityPublic[target][functionSig] = enabled;\n\n emit PublicCapabilityUpdated(target, functionSig, enabled);\n }\n\n function setRoleCapability(\n uint8 role,\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\n } else {\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\n }\n\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\n }\n\n /*//////////////////////////////////////////////////////////////\n USER ROLE ASSIGNMENT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setUserRole(\n address user,\n uint8 role,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getUserRoles[user] |= bytes32(1 << role);\n } else {\n getUserRoles[user] &= ~bytes32(1 << role);\n }\n\n emit UserRoleUpdated(user, role, enabled);\n }\n}\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/3752b3fd53a657b5aeb6810659ae8aee.json b/packages/contracts/deployments/base/solcInputs/3752b3fd53a657b5aeb6810659ae8aee.json new file mode 100644 index 0000000000..414d608c26 --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/3752b3fd53a657b5aeb6810659ae8aee.json @@ -0,0 +1,1182 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/interfaces/IERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20Upgradeable.sol\";\nimport \"../token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary ClonesUpgradeable {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(address implementation, bytes32 salt)\n internal\n view\n returns (address predicted)\n {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../interfaces/IERC4626Upgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\n *\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\n * contract and not the \"assets\" token which is an independent contract.\n *\n * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of\n * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\n *\n * _Available since v4.7._\n */\nabstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {\n using MathUpgradeable for uint256;\n\n IERC20Upgradeable private _asset;\n uint8 private _decimals;\n\n /**\n * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\n */\n function __ERC4626_init(IERC20Upgradeable asset_) internal onlyInitializing {\n __ERC4626_init_unchained(asset_);\n }\n\n function __ERC4626_init_unchained(IERC20Upgradeable asset_) internal onlyInitializing {\n (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\n _decimals = success ? assetDecimals : super.decimals();\n _asset = asset_;\n }\n\n /**\n * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\n */\n function _tryGetAssetDecimals(IERC20Upgradeable asset_) private returns (bool, uint8) {\n (bool success, bytes memory encodedDecimals) = address(asset_).call(\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector)\n );\n if (success && encodedDecimals.length >= 32) {\n uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\n if (returnedDecimals <= type(uint8).max) {\n return (true, uint8(returnedDecimals));\n }\n }\n return (false, 0);\n }\n\n /**\n * @dev Decimals are read from the underlying asset in the constructor and cached. If this fails (e.g., the asset\n * has not been created yet), the cached value is set to a default obtained by `super.decimals()` (which depends on\n * inheritance but is most likely 18). Override this function in order to set a guaranteed hardcoded value.\n * See {IERC20Metadata-decimals}.\n */\n function decimals() public view virtual override(IERC20MetadataUpgradeable, ERC20Upgradeable) returns (uint8) {\n return _decimals;\n }\n\n /** @dev See {IERC4626-asset}. */\n function asset() public view virtual override returns (address) {\n return address(_asset);\n }\n\n /** @dev See {IERC4626-totalAssets}. */\n function totalAssets() public view virtual override returns (uint256) {\n return _asset.balanceOf(address(this));\n }\n\n /** @dev See {IERC4626-convertToShares}. */\n function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-convertToAssets}. */\n function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-maxDeposit}. */\n function maxDeposit(address) public view virtual override returns (uint256) {\n return _isVaultCollateralized() ? type(uint256).max : 0;\n }\n\n /** @dev See {IERC4626-maxMint}. */\n function maxMint(address) public view virtual override returns (uint256) {\n return type(uint256).max;\n }\n\n /** @dev See {IERC4626-maxWithdraw}. */\n function maxWithdraw(address owner) public view virtual override returns (uint256) {\n return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-maxRedeem}. */\n function maxRedeem(address owner) public view virtual override returns (uint256) {\n return balanceOf(owner);\n }\n\n /** @dev See {IERC4626-previewDeposit}. */\n function previewDeposit(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-previewMint}. */\n function previewMint(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Up);\n }\n\n /** @dev See {IERC4626-previewWithdraw}. */\n function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Up);\n }\n\n /** @dev See {IERC4626-previewRedeem}. */\n function previewRedeem(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-deposit}. */\n function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {\n require(assets <= maxDeposit(receiver), \"ERC4626: deposit more than max\");\n\n uint256 shares = previewDeposit(assets);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4626-mint}. */\n function mint(uint256 shares, address receiver) public virtual override returns (uint256) {\n require(shares <= maxMint(receiver), \"ERC4626: mint more than max\");\n\n uint256 assets = previewMint(shares);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return assets;\n }\n\n /** @dev See {IERC4626-withdraw}. */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(assets <= maxWithdraw(owner), \"ERC4626: withdraw more than max\");\n\n uint256 shares = previewWithdraw(assets);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4626-redeem}. */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(shares <= maxRedeem(owner), \"ERC4626: redeem more than max\");\n\n uint256 assets = previewRedeem(shares);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) with support for rounding direction.\n *\n * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset\n * would represent an infinite amount of shares.\n */\n function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {\n uint256 supply = totalSupply();\n return\n (assets == 0 || supply == 0)\n ? _initialConvertToShares(assets, rounding)\n : assets.mulDiv(supply, totalAssets(), rounding);\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) to apply when the vault is empty.\n *\n * NOTE: Make sure to keep this function consistent with {_initialConvertToAssets} when overriding it.\n */\n function _initialConvertToShares(\n uint256 assets,\n MathUpgradeable.Rounding /*rounding*/\n ) internal view virtual returns (uint256 shares) {\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) with support for rounding direction.\n */\n function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {\n uint256 supply = totalSupply();\n return\n (supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) to apply when the vault is empty.\n *\n * NOTE: Make sure to keep this function consistent with {_initialConvertToShares} when overriding it.\n */\n function _initialConvertToAssets(\n uint256 shares,\n MathUpgradeable.Rounding /*rounding*/\n ) internal view virtual returns (uint256 assets) {\n return shares;\n }\n\n /**\n * @dev Deposit/mint common workflow.\n */\n function _deposit(\n address caller,\n address receiver,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the\n // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\n // assets are transferred and before the shares are minted, which is a valid state.\n // slither-disable-next-line reentrancy-no-eth\n SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);\n _mint(receiver, shares);\n\n emit Deposit(caller, receiver, assets, shares);\n }\n\n /**\n * @dev Withdraw/redeem common workflow.\n */\n function _withdraw(\n address caller,\n address receiver,\n address owner,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n if (caller != owner) {\n _spendAllowance(owner, caller, shares);\n }\n\n // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\n // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\n // shares are burned and after the assets are transferred, which is a valid state.\n _burn(owner, shares);\n SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);\n\n emit Withdraw(caller, receiver, owner, assets, shares);\n }\n\n function _isVaultCollateralized() private view returns (bool) {\n return totalAssets() > 0 || totalSupply() == 0;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\n * See {_beforeConsecutiveTokenTransfer}.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\n * See {_afterConsecutiveTokenTransfer}.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called before \"consecutive token transfers\" as defined in ERC2309 and implemented in\n * {ERC721Consecutive}.\n * Calling conditions are similar to {_beforeTokenTransfer}.\n */\n function _beforeConsecutiveTokenTransfer(\n address from,\n address to,\n uint256, /*first*/\n uint96 size\n ) internal virtual {\n if (from != address(0)) {\n _balances[from] -= size;\n }\n if (to != address(0)) {\n _balances[to] += size;\n }\n }\n\n /**\n * @dev Hook that is called after \"consecutive token transfers\" as defined in ERC2309 and implemented in\n * {ERC721Consecutive}.\n * Calling conditions are similar to {_afterTokenTransfer}.\n */\n function _afterConsecutiveTokenTransfer(\n address, /*from*/\n address, /*to*/\n uint256, /*first*/\n uint96 /*size*/\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2Upgradeable {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n */\n constructor(address beacon, bytes memory data) payable {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../../access/Ownable.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\n _implementation = newImplementation;\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/AbstractPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./PythStructs.sol\";\nimport \"./IPyth.sol\";\nimport \"./PythErrors.sol\";\n\nabstract contract AbstractPyth is IPyth {\n /// @notice Returns the price feed with given id.\n /// @dev Reverts if the price does not exist.\n /// @param id The Pyth Price Feed ID of which to fetch the PriceFeed.\n function queryPriceFeed(\n bytes32 id\n ) public view virtual returns (PythStructs.PriceFeed memory priceFeed);\n\n /// @notice Returns true if a price feed with the given id exists.\n /// @param id The Pyth Price Feed ID of which to check its existence.\n function priceFeedExists(\n bytes32 id\n ) public view virtual returns (bool exists);\n\n function getValidTimePeriod()\n public\n view\n virtual\n override\n returns (uint validTimePeriod);\n\n function getPrice(\n bytes32 id\n ) external view virtual override returns (PythStructs.Price memory price) {\n return getPriceNoOlderThan(id, getValidTimePeriod());\n }\n\n function getEmaPrice(\n bytes32 id\n ) external view virtual override returns (PythStructs.Price memory price) {\n return getEmaPriceNoOlderThan(id, getValidTimePeriod());\n }\n\n function getPriceUnsafe(\n bytes32 id\n ) public view virtual override returns (PythStructs.Price memory price) {\n PythStructs.PriceFeed memory priceFeed = queryPriceFeed(id);\n return priceFeed.price;\n }\n\n function getPriceNoOlderThan(\n bytes32 id,\n uint age\n ) public view virtual override returns (PythStructs.Price memory price) {\n price = getPriceUnsafe(id);\n\n if (diff(block.timestamp, price.publishTime) > age)\n revert PythErrors.StalePrice();\n\n return price;\n }\n\n function getEmaPriceUnsafe(\n bytes32 id\n ) public view virtual override returns (PythStructs.Price memory price) {\n PythStructs.PriceFeed memory priceFeed = queryPriceFeed(id);\n return priceFeed.emaPrice;\n }\n\n function getEmaPriceNoOlderThan(\n bytes32 id,\n uint age\n ) public view virtual override returns (PythStructs.Price memory price) {\n price = getEmaPriceUnsafe(id);\n\n if (diff(block.timestamp, price.publishTime) > age)\n revert PythErrors.StalePrice();\n\n return price;\n }\n\n function diff(uint x, uint y) internal pure returns (uint) {\n if (x > y) {\n return x - y;\n } else {\n return y - x;\n }\n }\n\n // Access modifier is overridden to public to be able to call it locally.\n function updatePriceFeeds(\n bytes[] calldata updateData\n ) public payable virtual override;\n\n function updatePriceFeedsIfNecessary(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64[] calldata publishTimes\n ) external payable virtual override {\n if (priceIds.length != publishTimes.length)\n revert PythErrors.InvalidArgument();\n\n for (uint i = 0; i < priceIds.length; i++) {\n if (\n !priceFeedExists(priceIds[i]) ||\n queryPriceFeed(priceIds[i]).price.publishTime < publishTimes[i]\n ) {\n updatePriceFeeds(updateData);\n return;\n }\n }\n\n revert PythErrors.NoFreshUpdate();\n }\n\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n )\n external\n payable\n virtual\n override\n returns (PythStructs.PriceFeed[] memory priceFeeds);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./PythStructs.sol\";\nimport \"./IPythEvents.sol\";\n\n/// @title Consume prices from the Pyth Network (https://pyth.network/).\n/// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely.\n/// @author Pyth Data Association\ninterface IPyth is IPythEvents {\n /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time\n function getValidTimePeriod() external view returns (uint validTimePeriod);\n\n /// @notice Returns the price and confidence interval.\n /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.\n /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPrice(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price and confidence interval.\n /// @dev Reverts if the EMA price is not available.\n /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPrice(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the price of a price feed without any sanity checks.\n /// @dev This function returns the most recent price update in this contract without any recency checks.\n /// This function is unsafe as the returned price update may be arbitrarily far in the past.\n ///\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\n /// sufficiently recent for their application. If you are considering using this function, it may be\n /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPriceUnsafe(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the price that is no older than `age` seconds of the current time.\n /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\n /// recently.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPriceNoOlderThan(\n bytes32 id,\n uint age\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.\n /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.\n /// However, if the price is not recent this function returns the latest available price.\n ///\n /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that\n /// the returned price is recent or useful for any particular application.\n ///\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\n /// sufficiently recent for their application. If you are considering using this function, it may be\n /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPriceUnsafe(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds\n /// of the current time.\n /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\n /// recently.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPriceNoOlderThan(\n bytes32 id,\n uint age\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Update price feeds with given update messages.\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n /// Prices will be updated if they are more recent than the current stored prices.\n /// The call will succeed even if the update is not the most recent.\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.\n /// @param updateData Array of price update data.\n function updatePriceFeeds(bytes[] calldata updateData) external payable;\n\n /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is\n /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the\n /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.\n ///\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n ///\n /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime\n /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have\n /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.\n /// Otherwise, it calls updatePriceFeeds method to update the prices.\n ///\n /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.\n /// @param updateData Array of price update data.\n /// @param priceIds Array of price ids.\n /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`\n function updatePriceFeedsIfNecessary(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64[] calldata publishTimes\n ) external payable;\n\n /// @notice Returns the required fee to update an array of price updates.\n /// @param updateData Array of price update data.\n /// @return feeAmount The required fee in Wei.\n function getUpdateFee(\n bytes[] calldata updateData\n ) external view returns (uint feeAmount);\n\n /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published\n /// within `minPublishTime` and `maxPublishTime`.\n ///\n /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;\n /// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain.\n ///\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n ///\n ///\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is\n /// no update for any of the given `priceIds` within the given time range.\n /// @param updateData Array of price update data.\n /// @param priceIds Array of price ids.\n /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.\n /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.\n /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPythEvents.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @title IPythEvents contains the events that Pyth contract emits.\n/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.\ninterface IPythEvents {\n /// @dev Emitted when the price feed with `id` has received a fresh update.\n /// @param id The Pyth Price Feed ID.\n /// @param publishTime Publish time of the given price update.\n /// @param price Price of the given price update.\n /// @param conf Confidence interval of the given price update.\n event PriceFeedUpdate(\n bytes32 indexed id,\n uint64 publishTime,\n int64 price,\n uint64 conf\n );\n\n /// @dev Emitted when a batch price update is processed successfully.\n /// @param chainId ID of the source chain that the batch price update comes from.\n /// @param sequenceNumber Sequence number of the batch price update.\n event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/MockPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./AbstractPyth.sol\";\nimport \"./PythStructs.sol\";\nimport \"./PythErrors.sol\";\n\ncontract MockPyth is AbstractPyth {\n mapping(bytes32 => PythStructs.PriceFeed) priceFeeds;\n uint64 sequenceNumber;\n\n uint singleUpdateFeeInWei;\n uint validTimePeriod;\n\n constructor(uint _validTimePeriod, uint _singleUpdateFeeInWei) {\n singleUpdateFeeInWei = _singleUpdateFeeInWei;\n validTimePeriod = _validTimePeriod;\n }\n\n function queryPriceFeed(\n bytes32 id\n ) public view override returns (PythStructs.PriceFeed memory priceFeed) {\n if (priceFeeds[id].id == 0) revert PythErrors.PriceFeedNotFound();\n return priceFeeds[id];\n }\n\n function priceFeedExists(bytes32 id) public view override returns (bool) {\n return (priceFeeds[id].id != 0);\n }\n\n function getValidTimePeriod() public view override returns (uint) {\n return validTimePeriod;\n }\n\n // Takes an array of encoded price feeds and stores them.\n // You can create this data either by calling createPriceFeedData or\n // by using web3.js or ethers abi utilities.\n function updatePriceFeeds(\n bytes[] calldata updateData\n ) public payable override {\n uint requiredFee = getUpdateFee(updateData);\n if (msg.value < requiredFee) revert PythErrors.InsufficientFee();\n\n // Chain ID is id of the source chain that the price update comes from. Since it is just a mock contract\n // We set it to 1.\n uint16 chainId = 1;\n\n for (uint i = 0; i < updateData.length; i++) {\n PythStructs.PriceFeed memory priceFeed = abi.decode(\n updateData[i],\n (PythStructs.PriceFeed)\n );\n\n uint lastPublishTime = priceFeeds[priceFeed.id].price.publishTime;\n\n if (lastPublishTime < priceFeed.price.publishTime) {\n // Price information is more recent than the existing price information.\n priceFeeds[priceFeed.id] = priceFeed;\n emit PriceFeedUpdate(\n priceFeed.id,\n uint64(lastPublishTime),\n priceFeed.price.price,\n priceFeed.price.conf\n );\n }\n }\n\n // In the real contract, the input of this function contains multiple batches that each contain multiple prices.\n // This event is emitted when a batch is processed. In this mock contract we consider there is only one batch of prices.\n // Each batch has (chainId, sequenceNumber) as it's unique identifier. Here chainId is set to 1 and an increasing sequence number is used.\n emit BatchPriceFeedUpdate(chainId, sequenceNumber);\n sequenceNumber += 1;\n }\n\n function getUpdateFee(\n bytes[] calldata updateData\n ) public view override returns (uint feeAmount) {\n return singleUpdateFeeInWei * updateData.length;\n }\n\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n ) external payable override returns (PythStructs.PriceFeed[] memory feeds) {\n uint requiredFee = getUpdateFee(updateData);\n if (msg.value < requiredFee) revert PythErrors.InsufficientFee();\n\n feeds = new PythStructs.PriceFeed[](priceIds.length);\n\n for (uint i = 0; i < priceIds.length; i++) {\n for (uint j = 0; j < updateData.length; j++) {\n feeds[i] = abi.decode(updateData[j], (PythStructs.PriceFeed));\n\n if (feeds[i].id == priceIds[i]) {\n uint publishTime = feeds[i].price.publishTime;\n if (\n minPublishTime <= publishTime &&\n publishTime <= maxPublishTime\n ) {\n break;\n } else {\n feeds[i].id = 0;\n }\n }\n }\n\n if (feeds[i].id != priceIds[i])\n revert PythErrors.PriceFeedNotFoundWithinRange();\n }\n }\n\n function createPriceFeedUpdateData(\n bytes32 id,\n int64 price,\n uint64 conf,\n int32 expo,\n int64 emaPrice,\n uint64 emaConf,\n uint64 publishTime\n ) public pure returns (bytes memory priceFeedData) {\n PythStructs.PriceFeed memory priceFeed;\n\n priceFeed.id = id;\n\n priceFeed.price.price = price;\n priceFeed.price.conf = conf;\n priceFeed.price.expo = expo;\n priceFeed.price.publishTime = publishTime;\n\n priceFeed.emaPrice.price = emaPrice;\n priceFeed.emaPrice.conf = emaConf;\n priceFeed.emaPrice.expo = expo;\n priceFeed.emaPrice.publishTime = publishTime;\n\n priceFeedData = abi.encode(priceFeed);\n }\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythErrors.sol": { + "content": "// SPDX-License-Identifier: Apache 2\n\npragma solidity ^0.8.0;\n\nlibrary PythErrors {\n // Function arguments are invalid (e.g., the arguments lengths mismatch)\n error InvalidArgument();\n // Update data is coming from an invalid data source.\n error InvalidUpdateDataSource();\n // Update data is invalid (e.g., deserialization error)\n error InvalidUpdateData();\n // Insufficient fee is paid to the method.\n error InsufficientFee();\n // There is no fresh update, whereas expected fresh updates.\n error NoFreshUpdate();\n // There is no price feed found within the given range or it does not exists.\n error PriceFeedNotFoundWithinRange();\n // Price feed not found or it is not pushed on-chain yet.\n error PriceFeedNotFound();\n // Requested price is stale.\n error StalePrice();\n // Given message is not a valid Wormhole VAA.\n error InvalidWormholeVaa();\n // Governance message is invalid (e.g., deserialization error).\n error InvalidGovernanceMessage();\n // Governance message is not for this contract.\n error InvalidGovernanceTarget();\n // Governance message is coming from an invalid data source.\n error InvalidGovernanceDataSource();\n // Governance message is old.\n error OldGovernanceMessage();\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythStructs.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\ncontract PythStructs {\n // A price with a degree of uncertainty, represented as a price +- a confidence interval.\n //\n // The confidence interval roughly corresponds to the standard error of a normal distribution.\n // Both the price and confidence are stored in a fixed-point numeric representation,\n // `x * (10^expo)`, where `expo` is the exponent.\n //\n // Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how\n // to how this price safely.\n struct Price {\n // Price\n int64 price;\n // Confidence interval around the price\n uint64 conf;\n // Price exponent\n int32 expo;\n // Unix timestamp describing when the price was published\n uint publishTime;\n }\n\n // PriceFeed represents a current aggregate price from pyth publisher feeds.\n struct PriceFeed {\n // The price ID.\n bytes32 id;\n // Latest available price\n Price price;\n // Latest available exponentially-weighted moving average price\n Price emaPrice;\n }\n}\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/IRateComputer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\n/**\n * @title IRateComputer\n * @notice An interface that defines a contract that computes rates.\n */\ninterface IRateComputer {\n /// @notice Computes the rate for a token.\n /// @param token The address of the token to compute the rate for.\n /// @return rate The rate for the token.\n function computeRate(address token) external view returns (uint64);\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nlibrary PrudentiaLib {\n struct PrudentiaConfig {\n address controller; // Adrastia Prudentia controller address\n uint8 offset; // Offset for delayed rate activation\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\n }\n}\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Careful Math\n * @author Compound\n * @notice Derived from OpenZeppelin's SafeMath library\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\n */\ncontract CarefulMath {\n /**\n * @dev Possible error codes that we can return\n */\n enum MathError {\n NO_ERROR,\n DIVISION_BY_ZERO,\n INTEGER_OVERFLOW,\n INTEGER_UNDERFLOW\n }\n\n /**\n * @dev Multiplies two numbers, returns an error on overflow.\n */\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (a == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n uint256 c;\n unchecked {\n c = a * b;\n }\n\n if (c / a != b) {\n return (MathError.INTEGER_OVERFLOW, 0);\n } else {\n return (MathError.NO_ERROR, c);\n }\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b == 0) {\n return (MathError.DIVISION_BY_ZERO, 0);\n }\n\n return (MathError.NO_ERROR, a / b);\n }\n\n /**\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\n */\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b <= a) {\n return (MathError.NO_ERROR, a - b);\n } else {\n return (MathError.INTEGER_UNDERFLOW, 0);\n }\n }\n\n /**\n * @dev Adds two numbers, returns an error on overflow.\n */\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n uint256 c;\n unchecked {\n c = a + b;\n }\n\n if (c >= a) {\n return (MathError.NO_ERROR, c);\n } else {\n return (MathError.INTEGER_OVERFLOW, 0);\n }\n }\n\n /**\n * @dev add a and b and then subtract c\n */\n function addThenSubUInt(\n uint256 a,\n uint256 b,\n uint256 c\n ) internal pure returns (MathError, uint256) {\n (MathError err0, uint256 sum) = addUInt(a, b);\n\n if (err0 != MathError.NO_ERROR) {\n return (err0, 0);\n }\n\n return subUInt(sum, c);\n }\n}\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\n\n/**\n * @title Compound's CErc20Delegate Contract\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\n * @author Compound\n */\ncontract CErc20Delegate is CErc20 {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 3;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n */\n function _becomeImplementation(bytes memory) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 1;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20Delegate\";\n }\n}\n" + }, + "contracts/compound/CErc20Delegator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ComptrollerInterface.sol\";\nimport \"./InterestRateModel.sol\";\nimport \"../ionic/DiamondExtension.sol\";\nimport { CErc20DelegatorBase, CDelegateInterface } from \"./CTokenInterfaces.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\n\n/**\n * @title Compound's CErc20Delegator Contract\n * @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Compound\n */\ncontract CErc20Delegator is CErc20DelegatorBase, DiamondBase {\n /**\n * @notice Emitted when implementation is changed\n */\n event NewImplementation(address oldImplementation, address newImplementation);\n\n /**\n * @notice Initialize the new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param ionicAdmin_ The FeeDistributor contract address.\n * @param interestRateModel_ The address of the interest rate model\n * @param name_ ERC-20 name of this token\n * @param symbol_ ERC-20 symbol of this token\n */\n constructor(\n address underlying_,\n IonicComptroller comptroller_,\n address payable ionicAdmin_,\n InterestRateModel interestRateModel_,\n string memory name_,\n string memory symbol_,\n uint256 reserveFactorMantissa_,\n uint256 adminFeeMantissa_\n ) {\n require(msg.sender == ionicAdmin_, \"!admin\");\n uint8 decimals_ = EIP20Interface(underlying_).decimals();\n {\n ionicAdmin = ionicAdmin_;\n\n // Set initial exchange rate\n initialExchangeRateMantissa = 0.2e18;\n\n // Set the comptroller\n comptroller = comptroller_;\n\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\n accrualBlockNumber = block.number;\n borrowIndex = 1e18;\n\n // Set the interest rate model (depends on block number / borrow index)\n require(interestRateModel_.isInterestRateModel(), \"!notIrm\");\n interestRateModel = interestRateModel_;\n emit NewMarketInterestRateModel(InterestRateModel(address(0)), interestRateModel_);\n\n name = name_;\n symbol = symbol_;\n decimals = decimals_;\n\n // Set reserve factor\n // Check newReserveFactor ≤ maxReserveFactor\n require(\n reserveFactorMantissa_ + adminFeeMantissa + ionicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\n \"!rf:set\"\n );\n reserveFactorMantissa = reserveFactorMantissa_;\n emit NewReserveFactor(0, reserveFactorMantissa_);\n\n // Set admin fee\n // Sanitize adminFeeMantissa_\n if (adminFeeMantissa_ == type(uint256).max) adminFeeMantissa_ = adminFeeMantissa;\n // Get latest Ionic fee\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\n require(\n reserveFactorMantissa + adminFeeMantissa_ + newIonicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\n \"!adminFee:set\"\n );\n adminFeeMantissa = adminFeeMantissa_;\n emit NewAdminFee(0, adminFeeMantissa_);\n ionicFeeMantissa = newIonicFeeMantissa;\n emit NewIonicFee(0, newIonicFeeMantissa);\n\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\n _notEntered = true;\n }\n\n // Set underlying and sanity check it\n underlying = underlying_;\n EIP20Interface(underlying).totalSupply();\n }\n\n function implementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"delegateType()\"))));\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external override {\n // Check admin rights\n require(hasAdminRights(), \"!admin\");\n\n // Set implementation\n _setImplementationInternal(implementation_, becomeImplementationData);\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self or admin\");\n\n (bool success, bytes memory data) = address(this).staticcall(abi.encodeWithSignature(\"delegateType()\"));\n require(success, \"no delegate type\");\n\n uint8 currentDelegateType = abi.decode(data, (uint8));\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = IFeeDistributor(ionicAdmin)\n .latestCErc20Delegate(currentDelegateType);\n\n address currentDelegate = implementation();\n if (currentDelegate != latestCErc20Delegate) {\n _setImplementationInternal(latestCErc20Delegate, becomeImplementationData);\n } else {\n // only update the extensions without reinitializing with becomeImplementationData\n _updateExtensions(currentDelegate);\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(msg.sender == address(ionicAdmin), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n\n /**\n * @dev Internal function to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationInternal(address implementation_, bytes memory becomeImplementationData) internal {\n address delegateBefore = implementation();\n _updateExtensions(implementation_);\n\n _functionCall(\n address(this),\n abi.encodeWithSelector(CDelegateInterface._becomeImplementation.selector, becomeImplementationData),\n \"!become impl\"\n );\n\n emit NewImplementation(delegateBefore, implementation_);\n }\n\n function _updateExtensions(address newDelegate) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getCErc20DelegateExtensions(newDelegate);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CErc20PluginDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\nimport \"./IERC4626.sol\";\nimport \"../external/uniswap/IUniswapV2Pair.sol\";\n\n/**\n * @title Rari's CErc20Plugin's Contract\n * @notice CToken which outsources token logic to a plugin\n * @author Joey Santoro\n *\n * CErc20PluginDelegate deposits and withdraws from a plugin contract\n * It is also capable of delegating reward functionality to a PluginRewardsDistributor\n */\ncontract CErc20PluginDelegate is CErc20Delegate {\n event NewPluginImplementation(address oldImpl, address newImpl);\n\n /**\n * @notice Plugin address\n */\n IERC4626 public plugin;\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.plugin.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._updatePlugin.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Delegate interface to become the implementation\n * @param data The encoded arguments for becoming\n */\n function _becomeImplementation(bytes memory data) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _becomeImplementation\");\n\n address _plugin = abi.decode(data, (address));\n\n if (_plugin == address(0) && address(plugin) != address(0)) {\n // if no new plugin address is given, use the latest implementation\n _plugin = IFeeDistributor(ionicAdmin).latestPluginImplementation(address(plugin));\n }\n\n if (_plugin != address(0) && _plugin != address(plugin)) {\n _updatePlugin(_plugin);\n }\n }\n\n /**\n * @notice Update the plugin implementation to a whitelisted implementation\n * @param _plugin The address of the plugin implementation to use\n */\n function _updatePlugin(address _plugin) public {\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _updatePlugin\");\n\n address oldImplementation = address(plugin) != address(0) ? address(plugin) : _plugin;\n\n if (address(plugin) != address(0) && plugin.balanceOf(address(this)) != 0) {\n plugin.redeem(plugin.balanceOf(address(this)), address(this), address(this));\n }\n\n plugin = IERC4626(_plugin);\n\n EIP20Interface(underlying).approve(_plugin, type(uint256).max);\n\n uint256 amount = EIP20Interface(underlying).balanceOf(address(this));\n if (amount != 0) {\n deposit(amount);\n }\n\n emit NewPluginImplementation(oldImplementation, _plugin);\n }\n\n /*** CToken Overrides ***/\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of the plugin in terms of the underlying\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view override returns (uint256) {\n return plugin.previewRedeem(plugin.balanceOf(address(this)));\n }\n\n /**\n * @notice Transfer the underlying to the cToken and trigger a deposit\n * @param from Address to transfer funds from\n * @param amount Amount of underlying to transfer\n * @return The actual amount that is transferred\n */\n function doTransferIn(address from, uint256 amount) internal override returns (uint256) {\n // Perform the EIP-20 transfer in\n require(EIP20Interface(underlying).transferFrom(from, address(this), amount), \"send\");\n\n deposit(amount);\n return amount;\n }\n\n function deposit(uint256 amount) internal {\n plugin.deposit(amount, address(this));\n }\n\n /**\n * @notice Transfer the underlying from plugin to destination\n * @param to Address to transfer funds to\n * @param amount Amount of underlying to transfer\n */\n function doTransferOut(address to, uint256 amount) internal override {\n plugin.withdraw(amount, to, address(this));\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 2;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20PluginDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20PluginRewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20PluginDelegate.sol\";\n\ncontract CErc20PluginRewardsDelegate is CErc20PluginDelegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying && _token != address(plugin), \"!token\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 4;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20PluginRewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\n\ncontract CErc20RewardsDelegate is CErc20Delegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n \n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying, \"!underlying\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 3;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20RewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegateMorpho.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20RewardsDelegate.sol\";\n\ncontract CErc20RewardsDelegateMorpho is CErc20RewardsDelegate {\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\n\n /**\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\n * @param rewardToken The reward strategy for which the rewards are being claimed.\n * @param claimable The amount of tokens to claim and forward.\n * @param proof The proof required to validate the claim.\n * @dev Only callable by the governance.\n */\n function claim(address rewardToken, uint256 claimable, bytes32[] memory proof) external {\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\n EIP20Interface(rewardToken).transfer(comptroller.admin(), claimedAmount);\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\n }\n}\n\ninterface IMorphoClaim {\n function claim(\n address account,\n address reward,\n uint256 claimable,\n bytes32[] memory proof\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./Unitroller.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\n */\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when an admin supports a market\n event MarketListed(ICErc20 cToken);\n\n /// @notice Emitted when an account enters a market\n event MarketEntered(ICErc20 cToken, address account);\n\n /// @notice Emitted when an account exits a market\n event MarketExited(ICErc20 cToken, address account);\n\n /// @notice Emitted when close factor is changed by admin\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\n\n /// @notice Emitted when a collateral factor is changed by admin\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\n\n /// @notice Emitted when liquidation incentive is changed by admin\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\n\n /// @notice Emitted when price oracle is changed\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\n\n /// @notice Emitted when the whitelist enforcement is changed\n event WhitelistEnforcementChanged(bool enforce);\n\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\n event AddedRewardsDistributor(address rewardsDistributor);\n\n // closeFactorMantissa must be strictly greater than this value\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\n\n // closeFactorMantissa must not exceed this value\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\n\n // No collateralFactorMantissa may exceed this value\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\n\n // liquidationIncentiveMantissa must be no less than this value\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\n\n // liquidationIncentiveMantissa must be no greater than this value\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\n\n modifier isAuthorized() {\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\n _;\n }\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\n return ComptrollerBase.effectiveSupplyCaps(cToken);\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\n return ComptrollerBase.effectiveBorrowCaps(cToken);\n }\n\n /*** Assets You Are In ***/\n\n /**\n * @notice Returns the assets an account has entered\n * @param account The address of the account to pull assets for\n * @return A dynamic list with the assets the account has entered\n */\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\n ICErc20[] memory assetsIn = accountAssets[account];\n\n return assetsIn;\n }\n\n /**\n * @notice Returns whether the given account is entered in the given asset\n * @param account The address of the account to check\n * @param cToken The cToken to check\n * @return True if the account is in the asset, otherwise false.\n */\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\n return markets[address(cToken)].accountMembership[account];\n }\n\n /**\n * @notice Add assets to be included in account liquidity calculation\n * @param cTokens The list of addresses of the cToken markets to be enabled\n * @return Success indicator for whether each corresponding market was entered\n */\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\n uint256 len = cTokens.length;\n\n uint256[] memory results = new uint256[](len);\n for (uint256 i = 0; i < len; i++) {\n ICErc20 cToken = ICErc20(cTokens[i]);\n\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\n }\n\n return results;\n }\n\n /**\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\n * @param cToken The market to enter\n * @param borrower The address of the account to modify\n * @return Success indicator for whether the market was entered\n */\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\n Market storage marketToJoin = markets[address(cToken)];\n\n if (!marketToJoin.isListed) {\n // market is not listed, cannot join\n return Error.MARKET_NOT_LISTED;\n }\n\n if (marketToJoin.accountMembership[borrower] == true) {\n // already joined\n return Error.NO_ERROR;\n }\n\n // survived the gauntlet, add to list\n // NOTE: we store these somewhat redundantly as a significant optimization\n // this avoids having to iterate through the list for the most common use cases\n // that is, only when we need to perform liquidity checks\n // and not whenever we want to check if an account is in a particular market\n marketToJoin.accountMembership[borrower] = true;\n accountAssets[borrower].push(cToken);\n\n // Add to allBorrowers\n if (!borrowers[borrower]) {\n allBorrowers.push(borrower);\n borrowers[borrower] = true;\n borrowerIndexes[borrower] = allBorrowers.length - 1;\n }\n\n emit MarketEntered(cToken, borrower);\n\n return Error.NO_ERROR;\n }\n\n /**\n * @notice Removes asset from sender's account liquidity calculation\n * @dev Sender must not have an outstanding borrow balance in the asset,\n * or be providing necessary collateral for an outstanding borrow.\n * @param cTokenAddress The address of the asset to be removed\n * @return Whether or not the account successfully exited the market\n */\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\n // TODO\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\n\n ICErc20 cToken = ICErc20(cTokenAddress);\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\n\n /* Fail if the sender has a borrow balance */\n if (amountOwed != 0) {\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\n }\n\n /* Fail if the sender is not permitted to redeem all of their tokens */\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\n if (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\n }\n\n Market storage marketToExit = markets[cTokenAddress];\n\n /* Return true if the sender is not already ‘in’ the market */\n if (!marketToExit.accountMembership[msg.sender]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Set cToken account membership to false */\n delete marketToExit.accountMembership[msg.sender];\n\n /* Delete cToken from the account’s list of assets */\n // load into memory for faster iteration\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\n uint256 len = userAssetList.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n ICErc20[] storage storedList = accountAssets[msg.sender];\n storedList[assetIndex] = storedList[storedList.length - 1];\n storedList.pop();\n\n // If the user has exited all markets, remove them from the `allBorrowers` array\n if (storedList.length == 0) {\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\n allBorrowers.pop(); // Reduce length by 1\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\n }\n\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Policy Hooks ***/\n\n /**\n * @notice Checks if the account should be allowed to mint tokens in the given market\n * @param cTokenAddress The market to verify the mint against\n * @param minter The account which would get the minted tokens\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\n\n // Make sure market is listed\n if (!markets[cTokenAddress].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure minter is whitelisted\n if (enforceWhitelist && !whitelist[minter]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\n\n // Supply cap of 0 corresponds to unlimited supplying\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\n uint256 nonWhitelistedTotalSupply;\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\n\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cTokenAddress, minter);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to redeem tokens in the given market\n * @param cToken The market to verify the redeem against\n * @param redeemer The account which would redeem the tokens\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cToken, redeemer);\n\n return uint256(Error.NO_ERROR);\n }\n\n function redeemAllowedInternal(\n address cToken,\n address redeemer,\n uint256 redeemTokens\n ) internal view returns (uint256) {\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\n if (!markets[cToken].accountMembership[redeemer]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n redeemer,\n ICErc20(cToken),\n redeemTokens,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates mint and reverts on rejection. May emit logs.\n * @param cToken Asset being minted\n * @param minter The address minting the tokens\n * @param actualMintAmount The amount of the underlying asset being minted\n * @param mintTokens The number of tokens being minted\n */\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\n // Add minter to suppliers mapping\n suppliers[minter] = true;\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, minter);\n }\n\n /**\n * @notice Validates redeem and reverts on rejection. May emit logs.\n * @param cToken Asset being redeemed\n * @param redeemer The address redeeming the tokens\n * @param redeemAmount The amount of the underlying asset being redeemed\n * @param redeemTokens The number of tokens being redeemed\n */\n function redeemVerify(\n address cToken,\n address redeemer,\n uint256 redeemAmount,\n uint256 redeemTokens\n ) external override {\n require(markets[msg.sender].isListed, \"!market\");\n\n // Require tokens is zero or amount is also zero\n if (redeemTokens == 0 && redeemAmount > 0) {\n revert(\"!zero\");\n }\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, redeemer);\n }\n\n function getMaxRedeemOrBorrow(\n address account,\n ICErc20 cTokenModify,\n bool isBorrow\n ) external view override returns (uint256) {\n address cToken = address(cTokenModify);\n // Accrue interest\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\n\n // Get account liquidity\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n isBorrow ? cTokenModify : ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n require(err == Error.NO_ERROR, \"!liquidity\");\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\n\n // Get max borrow/redeem\n uint256 maxBorrowOrRedeemAmount;\n\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\n // Max redeem = balance of underlying if not used as collateral\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\n } else {\n // Avoid \"stack too deep\" error by separating this logic\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\n\n // Redeem only: max out at underlying balance\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\n }\n\n // Get max borrow or redeem considering cToken liquidity\n uint256 cTokenLiquidity = cTokenModify.getCash();\n\n // Return the minimum of the two maximums\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\n }\n\n /**\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\n */\n function _getMaxRedeemOrBorrow(\n uint256 liquidity,\n ICErc20 cTokenModify,\n bool isBorrow\n ) internal view returns (uint256) {\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\n\n // Get the normalized price of the asset\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\n require(conversionFactor > 0, \"!oracle\");\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n if (!isBorrow) {\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\n }\n\n // Get max borrow or redeem considering excess account liquidity\n return (liquidity * 1e18) / conversionFactor;\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which would borrow the asset\n * @param borrowAmount The amount of underlying the account would borrow\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\n\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n if (!markets[cToken].accountMembership[borrower]) {\n // only cTokens may call borrowAllowed if borrower not in market\n require(msg.sender == cToken, \"!ctoken\");\n\n // attempt to add borrower to the market\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n // it should be impossible to break the important invariant\n assert(markets[cToken].accountMembership[borrower]);\n }\n\n // Make sure oracle price is available\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\n return uint256(Error.PRICE_ERROR);\n }\n\n // Make sure borrower is whitelisted\n if (enforceWhitelist && !whitelist[borrower]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 borrowCap = effectiveBorrowCaps(cToken);\n\n // Borrow cap of 0 corresponds to unlimited borrowing\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\n uint256 nonWhitelistedTotalBorrows;\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n // Perform a hypothetical liquidity check to guard against shortfall\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\n if (err != uint256(Error.NO_ERROR)) {\n return err;\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which borrowed the asset\n */\n function borrowVerify(address cToken, address borrower) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken Asset whose underlying is being borrowed\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\n */\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\n // Check if min borrow exists\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\n\n if (minBorrowEth > 0) {\n // Get new underlying borrow balance of account for this cToken\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\n Exp({ mantissa: oraclePriceMantissa }),\n accountBorrowsNew\n );\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\n\n // Check against min borrow\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\n }\n\n // Return no error\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to repay a borrow in the given market\n * @param cToken The market to verify the repay against\n * @param payer The account which would repay the asset\n * @param borrower The account which would borrowed the asset\n * @param repayAmount The amount of the underlying asset the account would repay\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after borrow repayment\n * @param cToken The market to verify the repay against\n * @param payer The account which repayed the asset\n * @param borrower The account which borrowed the asset\n * @param repayAmount The amount of the underlying asset the account repayed\n */\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the liquidation should be allowed to occur\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param repayAmount The amount of underlying being repaid\n */\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure markets are listed\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Get borrowers' underlying borrow balance\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\n\n /* allow accounts to be liquidated if the market is deprecated */\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\n } else {\n /* The borrower must have shortfall in order to be liquidateable */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n borrower,\n ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n if (shortfall == 0) {\n return uint256(Error.INSUFFICIENT_SHORTFALL);\n }\n\n /* The liquidator may not repay more than what is allowed by the closeFactor */\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\n if (repayAmount > maxClose) {\n return uint256(Error.TOO_MUCH_REPAY);\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the seizing of assets should be allowed to occur\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!seizeGuardianPaused, \"!seize:paused\");\n\n // Make sure markets are listed\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure cToken Comptrollers are identical\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\n return uint256(Error.COMPTROLLER_MISMATCH);\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after seizing of assets\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override {\n // Keep the flywheel moving\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\n }\n\n /**\n * @notice Checks if the account should be allowed to transfer tokens in the given market\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function transferAllowed(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!transferGuardianPaused, \"!transfer:paused\");\n\n // Currently the only consideration is whether or not\n // the src is allowed to redeem this many tokens\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cToken, src, dst);\n\n return uint256(Error.NO_ERROR);\n }\n\n\n /**\n * @notice Validates that blacklisted balances are updated after transfering assets\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n */\n function transferVerify(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override {\n\n // Keep the flywheel moving\n flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Flywheel Hooks ***/\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving post-mint and post-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving post-borrow and post-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\n }\n\n /**\n * @notice Keeps the flywheel moving post-transfer and post-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Liquidity/Liquidation Calculations ***/\n\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountLiquidityLocalVars {\n ICErc20 asset;\n uint256 sumCollateral;\n uint256 sumBorrowPlusEffects;\n uint256 cTokenBalance;\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n uint256 oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n uint256 borrowCapForCollateral;\n uint256 borrowedAssetPrice;\n uint256 assetAsCollateralValueCap;\n }\n\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code (semi-opaque),\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(\n account,\n ICErc20(cTokenModify),\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code,\n hypothetical account collateral value,\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidityInternal(\n address account,\n ICErc20 cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) internal view returns (Error, uint256, uint256, uint256) {\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\n\n if (address(cTokenModify) != address(0)) {\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n }\n\n // For each asset the account is in\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\n vars.asset = accountAssets[account][i];\n\n {\n // Read the balances and exchange rate from the cToken\n uint256 oErr;\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\n account\n );\n if (oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\n }\n }\n {\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\n if (vars.oraclePriceMantissa == 0) {\n return (Error.PRICE_ERROR, 0, 0, 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n }\n {\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\n vars.asset,\n cTokenModify,\n redeemTokens > 0,\n account\n );\n\n // accumulate the collateral value to sumCollateral\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\n assetCollateralValue = vars.assetAsCollateralValueCap;\n vars.sumCollateral += assetCollateralValue;\n }\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n\n // Calculate effects of interacting with cTokenModify\n if (vars.asset == cTokenModify) {\n // redeem effect\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.tokensToDenom,\n redeemTokens,\n vars.sumBorrowPlusEffects\n );\n\n // borrow effect\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n borrowAmount,\n vars.sumBorrowPlusEffects\n );\n\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\n if (repayEffect >= vars.sumBorrowPlusEffects) {\n vars.sumBorrowPlusEffects = 0;\n } else {\n vars.sumBorrowPlusEffects -= repayEffect;\n }\n }\n }\n\n // These are safe, as the underflow condition is checked first\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\n } else {\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\n }\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\n * @param cTokenBorrowed The address of the borrowed cToken\n * @param cTokenCollateral The address of the collateral cToken\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view override returns (uint256, uint256) {\n /* Read oracle prices for borrowed and collateral markets */\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\n return (uint256(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\n uint256 seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\n\n /*\n * The liquidation penalty includes\n * - the liquidator incentive\n * - the protocol fees (Ionic admin fees)\n * - the market fee\n */\n Exp memory totalPenaltyMantissa = add_(\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\n Exp({ mantissa: feeSeizeShareMantissa })\n );\n\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n return (uint256(Error.NO_ERROR), seizeTokens);\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Add a RewardsDistributor contracts.\n * @dev Admin function to add a RewardsDistributor contract\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addRewardsDistributor(address distributor) external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n\n // Check marker method\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\n\n // Check for existing RewardsDistributor\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\n\n // Add RewardsDistributor to array\n rewardsDistributors.push(distributor);\n emit AddedRewardsDistributor(distributor);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist enforcement for the comptroller\n * @dev Admin function to set a new whitelist enforcement boolean\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\n }\n\n // Check if `enforceWhitelist` already equals `enforce`\n if (enforceWhitelist == enforce) {\n return uint256(Error.NO_ERROR);\n }\n\n // Set comptroller's `enforceWhitelist` to `enforce`\n enforceWhitelist = enforce;\n\n // Emit WhitelistEnforcementChanged(bool enforce);\n emit WhitelistEnforcementChanged(enforce);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist `statuses` for `suppliers`\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\n }\n\n // Set whitelist statuses for suppliers\n for (uint256 i = 0; i < suppliers.length; i++) {\n address supplier = suppliers[i];\n\n if (statuses[i]) {\n // If not already whitelisted, add to whitelist\n if (!whitelist[supplier]) {\n whitelist[supplier] = true;\n whitelistArray.push(supplier);\n whitelistIndexes[supplier] = whitelistArray.length - 1;\n }\n } else {\n // If whitelisted, remove from whitelist\n if (whitelist[supplier]) {\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\n whitelistArray.pop(); // Reduce length by 1\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\n }\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new price oracle for the comptroller\n * @dev Admin function to set a new price oracle\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\n }\n\n // Track the old oracle for the comptroller\n BasePriceOracle oldOracle = oracle;\n\n // Set comptroller's oracle to newOracle\n oracle = newOracle;\n\n // Emit NewPriceOracle(oldOracle, newOracle)\n emit NewPriceOracle(oldOracle, newOracle);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the closeFactor used when liquidating borrows\n * @dev Admin function to set closeFactor\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\n }\n\n // Check limits\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\n if (lessThanExp(highLimit, newCloseFactorExp)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n // Set pool close factor to new close factor, remember old value\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\n closeFactorMantissa = newCloseFactorMantissa;\n\n // Emit event\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the collateralFactor for a market\n * @dev Admin function to set per-market collateralFactor\n * @param cToken The market to set the factor on\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\n }\n\n // Verify market is listed\n Market storage market = markets[address(cToken)];\n if (!market.isListed) {\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\n }\n\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\n\n // Check collateral factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\n }\n\n // If collateral factor != 0, fail if price == 0\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\n }\n\n // Set market's collateral factor to new collateral factor, remember old value\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\n market.collateralFactorMantissa = newCollateralFactorMantissa;\n\n // Emit event with asset, old collateral factor, and new collateral factor\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets liquidationIncentive\n * @dev Admin function to set liquidationIncentive\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\n }\n\n // Check de-scaled min <= newLiquidationIncentive <= max\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n // Save current value for use in log\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\n\n // Set liquidation incentive to new incentive\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\n\n // Emit event with old incentive, new incentive\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Add the market to the markets mapping and set it as listed\n * @dev Admin function to set isListed and add support for the market\n * @param cToken The address of the market (token) to list\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Is market already listed?\n if (markets[address(cToken)].isListed) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // Check cToken.comptroller == this\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\n\n // Make sure market is not already listed\n address underlying = ICErc20(address(cToken)).underlying();\n\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // List market and emit event\n Market storage market = markets[address(cToken)];\n market.isListed = true;\n market.collateralFactorMantissa = 0;\n allMarkets.push(cToken);\n cTokensByUnderlying[underlying] = cToken;\n emit MarketListed(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _deployMarket(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\n bool oldIonicAdminHasRights = ionicAdminHasRights;\n ionicAdminHasRights = true;\n\n // Deploy via Ionic admin\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\n // Reset Ionic admin rights to the original value\n ionicAdminHasRights = oldIonicAdminHasRights;\n // Support market here in the Comptroller\n uint256 err = _supportMarket(cToken);\n\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\n\n // Set collateral factor\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\n }\n\n function _becomeImplementation() external {\n require(msg.sender == address(this), \"!self call\");\n\n if (!_notEnteredInitialized) {\n _notEntered = true;\n _notEnteredInitialized = true;\n }\n }\n\n /*** Helper Functions ***/\n\n /**\n * @notice Returns true if the given cToken market has been deprecated\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\n * @param cToken The market to check if deprecated\n */\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\n return\n markets[address(cToken)].collateralFactorMantissa == 0 &&\n borrowGuardianPaused[address(cToken)] == true &&\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\n }\n\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\n return ComptrollerExtensionInterface(address(this));\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 32;\n\n functionSelectors = new bytes4[](fnsCount);\n\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\n functionSelectors[--fnsCount] = this._deployMarket.selector;\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\n functionSelectors[--fnsCount] = this.checkMembership.selector;\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\n functionSelectors[--fnsCount] = this.exitMarket.selector;\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\n functionSelectors[--fnsCount] = this.mintVerify.selector;\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n /**\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _beforeNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\n require(_notEntered, \"!reentered\");\n _notEntered = false;\n }\n\n /**\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _afterNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n}\n" + }, + "contracts/compound/ComptrollerFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, SFSRegister } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract ComptrollerFirstExtension is\n DiamondExtension,\n ComptrollerBase,\n ComptrollerExtensionInterface,\n ComptrollerErrorReporter\n{\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when supply cap for a cToken is changed\n event NewSupplyCap(ICErc20 indexed cToken, uint256 newSupplyCap);\n\n /// @notice Emitted when borrow cap for a cToken is changed\n event NewBorrowCap(ICErc20 indexed cToken, uint256 newBorrowCap);\n\n /// @notice Emitted when borrow cap guardian is changed\n event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian);\n\n /// @notice Emitted when pause guardian is changed\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\n\n /// @notice Emitted when an action is paused globally\n event ActionPaused(string action, bool pauseState);\n\n /// @notice Emitted when an action is paused on a market\n event MarketActionPaused(ICErc20 cToken, string action, bool pauseState);\n\n /// @notice Emitted when an admin unsupports a market\n event MarketUnlisted(ICErc20 cToken);\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 33;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.addNonAccruingFlywheel.selector;\n functionSelectors[--fnsCount] = this._setMarketSupplyCaps.selector;\n functionSelectors[--fnsCount] = this._setMarketBorrowCaps.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateralWhitelist.selector;\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateralWhitelist.selector;\n functionSelectors[--fnsCount] = this._supplyCapWhitelist.selector;\n functionSelectors[--fnsCount] = this._borrowCapWhitelist.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapGuardian.selector;\n functionSelectors[--fnsCount] = this._setPauseGuardian.selector;\n functionSelectors[--fnsCount] = this._setMintPaused.selector;\n functionSelectors[--fnsCount] = this._setBorrowPaused.selector;\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\n functionSelectors[--fnsCount] = this._unsupportMarket.selector;\n functionSelectors[--fnsCount] = this.getAllMarkets.selector;\n functionSelectors[--fnsCount] = this.getAllBorrowers.selector;\n functionSelectors[--fnsCount] = this.getAllBorrowersCount.selector;\n functionSelectors[--fnsCount] = this.getPaginatedBorrowers.selector;\n functionSelectors[--fnsCount] = this.getWhitelist.selector;\n functionSelectors[--fnsCount] = this.getRewardsDistributors.selector;\n functionSelectors[--fnsCount] = this.isUserOfPool.selector;\n functionSelectors[--fnsCount] = this.getAccruingFlywheels.selector;\n functionSelectors[--fnsCount] = this._removeFlywheel.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateral.selector;\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateral.selector;\n functionSelectors[--fnsCount] = this.isBorrowCapForCollateralWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isBlacklistBorrowingAgainstCollateralWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isSupplyCapWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isBorrowCapWhitelisted.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedSuppliersSupply.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedBorrowersBorrows.selector;\n functionSelectors[--fnsCount] = this.getAssetAsCollateralValueCap.selector;\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /**\n * @notice Returns true if the accruing flyhwheel was found and replaced\n * @dev Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\n * @param flywheelAddress The address of the flywheel to add to the non-accruing\n */\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool) {\n require(hasAdminRights(), \"!admin\");\n require(flywheelAddress != address(0), \"!flywheel\");\n\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\n require(flywheelAddress != nonAccruingRewardsDistributors[i], \"!alreadyadded\");\n }\n\n // add it to the non-accruing\n nonAccruingRewardsDistributors.push(flywheelAddress);\n\n // remove it from the accruing\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\n if (flywheelAddress == rewardsDistributors[i]) {\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\n rewardsDistributors.pop();\n return true;\n }\n }\n\n return false;\n }\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256) {\n if (address(collateral) == address(cTokenModify) && !redeeming) {\n // the collateral asset counts as 0 liquidity when borrowed\n return 0;\n }\n\n uint256 assetAsCollateralValueCap = type(uint256).max;\n if (address(cTokenModify) != address(0)) {\n // if the borrowed asset is blacklisted against this collateral & account is not whitelisted\n if (\n borrowingAgainstCollateralBlacklist[address(cTokenModify)][address(collateral)] &&\n !borrowingAgainstCollateralBlacklistWhitelist[address(cTokenModify)][address(collateral)].contains(account)\n ) {\n assetAsCollateralValueCap = 0;\n } else {\n // for each user the value of this kind of collateral is capped regardless of the amount borrowed\n // denominated in the borrowed asset\n uint256 borrowCapForCollateral = borrowCapForCollateral[address(cTokenModify)][address(collateral)];\n // check if set to any value & account is not whitelisted\n if (\n borrowCapForCollateral != 0 &&\n !borrowCapForCollateralWhitelist[address(cTokenModify)][address(collateral)].contains(account)\n ) {\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n // this asset usage as collateral is capped at the native value of the borrow cap\n assetAsCollateralValueCap = (borrowCapForCollateral * borrowedAssetPrice) / 1e18;\n }\n }\n }\n\n uint256 supplyCap = effectiveSupplyCaps(address(collateral));\n\n // if there is any supply cap, don't allow donations to the market/plugin to go around it\n if (supplyCap > 0 && !supplyCapWhitelist[address(collateral)].contains(account)) {\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateral);\n uint256 supplyCapValue = (supplyCap * collateralAssetPrice) / 1e18;\n supplyCapValue = (supplyCapValue * markets[address(collateral)].collateralFactorMantissa) / 1e18;\n if (supplyCapValue < assetAsCollateralValueCap) assetAsCollateralValueCap = supplyCapValue;\n }\n\n return assetAsCollateralValueCap;\n }\n\n /**\n * @notice Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\n * @dev Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\n * @param cTokens The addresses of the markets (tokens) to change the supply caps for\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\n */\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n uint256 numMarkets = cTokens.length;\n uint256 numSupplyCaps = newSupplyCaps.length;\n\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \"!input\");\n\n for (uint256 i = 0; i < numMarkets; i++) {\n supplyCaps[address(cTokens[i])] = newSupplyCaps[i];\n emit NewSupplyCap(cTokens[i], newSupplyCaps[i]);\n }\n }\n\n /**\n * @notice Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\n * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\n * @param cTokens The addresses of the markets (tokens) to change the borrow caps for\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\n */\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n uint256 numMarkets = cTokens.length;\n uint256 numBorrowCaps = newBorrowCaps.length;\n\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \"!input\");\n\n for (uint256 i = 0; i < numMarkets; i++) {\n borrowCaps[address(cTokens[i])] = newBorrowCaps[i];\n emit NewBorrowCap(cTokens[i], newBorrowCaps[i]);\n }\n }\n\n /**\n * @notice Admin function to change the Borrow Cap Guardian\n * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian\n */\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external {\n require(msg.sender == admin, \"!admin\");\n\n // Save current value for inclusion in log\n address oldBorrowCapGuardian = borrowCapGuardian;\n\n // Store borrowCapGuardian with value newBorrowCapGuardian\n borrowCapGuardian = newBorrowCapGuardian;\n\n // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)\n emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);\n }\n\n /**\n * @notice Admin function to change the Pause Guardian\n * @param newPauseGuardian The address of the new Pause Guardian\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _setPauseGuardian(address newPauseGuardian) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK);\n }\n\n // Save current value for inclusion in log\n address oldPauseGuardian = pauseGuardian;\n\n // Store pauseGuardian with value newPauseGuardian\n pauseGuardian = newPauseGuardian;\n\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\n emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);\n\n return uint256(Error.NO_ERROR);\n }\n\n function _setMintPaused(ICErc20 cToken, bool state) public returns (bool) {\n require(markets[address(cToken)].isListed, \"!market\");\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n mintGuardianPaused[address(cToken)] = state;\n emit MarketActionPaused(cToken, \"Mint\", state);\n return state;\n }\n\n function _setBorrowPaused(ICErc20 cToken, bool state) public returns (bool) {\n require(markets[address(cToken)].isListed, \"!market\");\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n borrowGuardianPaused[address(cToken)] = state;\n emit MarketActionPaused(cToken, \"Borrow\", state);\n return state;\n }\n\n function _setTransferPaused(bool state) public returns (bool) {\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n transferGuardianPaused = state;\n emit ActionPaused(\"Transfer\", state);\n return state;\n }\n\n function _setSeizePaused(bool state) public returns (bool) {\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n seizeGuardianPaused = state;\n emit ActionPaused(\"Seize\", state);\n return state;\n }\n\n /**\n * @notice Removed a market from the markets mapping and sets it as unlisted\n * @dev Admin function unset isListed and collateralFactorMantissa and unadd support for the market\n * @param cToken The address of the market (token) to unlist\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _unsupportMarket(ICErc20 cToken) external returns (uint256) {\n // Check admin rights\n if (!hasAdminRights()) return fail(Error.UNAUTHORIZED, FailureInfo.UNSUPPORT_MARKET_OWNER_CHECK);\n\n // Check if market is already unlisted\n if (!markets[address(cToken)].isListed)\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNSUPPORT_MARKET_DOES_NOT_EXIST);\n\n // Check if market is in use\n if (cToken.totalSupply() > 0) return fail(Error.NONZERO_TOTAL_SUPPLY, FailureInfo.UNSUPPORT_MARKET_IN_USE);\n\n // Unlist market\n delete markets[address(cToken)];\n\n /* Delete cToken from allMarkets */\n // load into memory for faster iteration\n ICErc20[] memory _allMarkets = allMarkets;\n uint256 len = _allMarkets.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (_allMarkets[i] == cToken) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n allMarkets[assetIndex] = allMarkets[allMarkets.length - 1];\n allMarkets.pop();\n\n cTokensByUnderlying[ICErc20(address(cToken)).underlying()] = ICErc20(address(0));\n emit MarketUnlisted(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) public {\n require(hasAdminRights(), \"!admin\");\n borrowCapForCollateral[cTokenBorrow][cTokenCollateral] = borrowCap;\n }\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].add(account);\n else borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\n }\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) public view returns (bool) {\n return borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\n }\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n borrowingAgainstCollateralBlacklist[cTokenBorrow][cTokenCollateral] = blacklisted;\n }\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].add(account);\n else borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\n }\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) public view returns (bool) {\n return borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\n }\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) supplyCapWhitelist[cToken].add(account);\n else supplyCapWhitelist[cToken].remove(account);\n }\n\n function isSupplyCapWhitelisted(address cToken, address account) public view returns (bool) {\n return supplyCapWhitelist[cToken].contains(account);\n }\n\n function getWhitelistedSuppliersSupply(address cToken) public view returns (uint256 supplied) {\n address[] memory whitelistedSuppliers = supplyCapWhitelist[cToken].values();\n for (uint256 i = 0; i < whitelistedSuppliers.length; i++) {\n supplied += ICErc20(cToken).balanceOfUnderlying(whitelistedSuppliers[i]);\n }\n }\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowCapWhitelist[cToken].add(account);\n else borrowCapWhitelist[cToken].remove(account);\n }\n\n function isBorrowCapWhitelisted(address cToken, address account) public view returns (bool) {\n return borrowCapWhitelist[cToken].contains(account);\n }\n\n function getWhitelistedBorrowersBorrows(address cToken) public view returns (uint256 borrowed) {\n address[] memory whitelistedBorrowers = borrowCapWhitelist[cToken].values();\n for (uint256 i = 0; i < whitelistedBorrowers.length; i++) {\n borrowed += ICErc20(cToken).borrowBalanceCurrent(whitelistedBorrowers[i]);\n }\n }\n\n /**\n * @notice Return all of the markets\n * @dev The automatic getter may be used to access an individual market.\n * @return The list of market addresses\n */\n function getAllMarkets() public view returns (ICErc20[] memory) {\n return allMarkets;\n }\n\n /**\n * @notice Return all of the borrowers\n * @dev The automatic getter may be used to access an individual borrower.\n * @return The list of borrower account addresses\n */\n function getAllBorrowers() public view returns (address[] memory) {\n return allBorrowers;\n }\n\n function getAllBorrowersCount() public view returns (uint256) {\n return allBorrowers.length;\n }\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) public view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) {\n uint256 allBorrowersCount = allBorrowers.length;\n if (allBorrowersCount == 0) {\n return (0, new address[](0));\n }\n\n if (pageSize == 0) pageSize = 300;\n uint256 currentPageSize = pageSize;\n uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize;\n\n _totalPages = allBorrowersCount / pageSize;\n if (sizeOfPageFromRemainder > 0) {\n _totalPages++;\n if (page + 1 == _totalPages) {\n currentPageSize = sizeOfPageFromRemainder;\n }\n }\n\n if (page + 1 > _totalPages) {\n return (_totalPages, new address[](0));\n }\n\n uint256 offset = page * pageSize;\n _pageOfBorrowers = new address[](currentPageSize);\n for (uint256 i = 0; i < currentPageSize; i++) {\n _pageOfBorrowers[i] = allBorrowers[i + offset];\n }\n }\n\n /**\n * @notice Return all of the whitelist\n * @dev The automatic getter may be used to access an individual whitelist status.\n * @return The list of borrower account addresses\n */\n function getWhitelist() external view returns (address[] memory) {\n return whitelistArray;\n }\n\n /**\n * @notice Returns an array of all accruing and non-accruing flywheels\n */\n function getRewardsDistributors() external view returns (address[] memory) {\n address[] memory allFlywheels = new address[](rewardsDistributors.length + nonAccruingRewardsDistributors.length);\n\n uint8 i = 0;\n while (i < rewardsDistributors.length) {\n allFlywheels[i] = rewardsDistributors[i];\n i++;\n }\n uint8 j = 0;\n while (j < nonAccruingRewardsDistributors.length) {\n allFlywheels[i + j] = nonAccruingRewardsDistributors[j];\n j++;\n }\n\n return allFlywheels;\n }\n\n function getAccruingFlywheels() external view returns (address[] memory) {\n return rewardsDistributors;\n }\n\n /**\n * @dev Removes a flywheel from the accruing or non-accruing array\n * @param flywheelAddress The address of the flywheel to remove from the accruing or non-accruing array\n * @return true if the flywheel was found and removed\n */\n function _removeFlywheel(address flywheelAddress) external returns (bool) {\n require(hasAdminRights(), \"!admin\");\n require(flywheelAddress != address(0), \"!flywheel\");\n\n // remove it from the accruing\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\n if (flywheelAddress == rewardsDistributors[i]) {\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\n rewardsDistributors.pop();\n return true;\n }\n }\n\n // or remove it from the non-accruing\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\n if (flywheelAddress == nonAccruingRewardsDistributors[i]) {\n nonAccruingRewardsDistributors[i] = nonAccruingRewardsDistributors[nonAccruingRewardsDistributors.length - 1];\n nonAccruingRewardsDistributors.pop();\n return true;\n }\n }\n\n return false;\n }\n\n function isUserOfPool(address user) external view returns (bool) {\n for (uint256 i = 0; i < allMarkets.length; i++) {\n address marketAddress = address(allMarkets[i]);\n if (markets[marketAddress].accountMembership[user]) {\n return true;\n }\n }\n\n return false;\n }\n\n function registerInSFS() external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\n\n for (uint256 i = 0; i < allMarkets.length; i++) {\n allMarkets[i].registerInSFS();\n }\n\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\n }\n}\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\ninterface ComptrollerInterface {\n function isDeprecated(ICErc20 cToken) external view returns (bool);\n\n function _becomeImplementation() external;\n\n function _deployMarket(\n uint8 delegateType,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\n\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\n\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _addRewardsDistributor(address distributor) external returns (uint256);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) external view returns (uint256, uint256, uint256, uint256);\n\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\n\n /*** Assets You Are In ***/\n\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cToken) external returns (uint256);\n\n /*** Policy Hooks ***/\n\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\n\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\n\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\n\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\n\n function borrowVerify(address cToken, address borrower) external;\n\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\n\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external;\n\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n \n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external;\n\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\n \n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\n\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\n\n /*** Liquidity/Liquidation Calculations ***/\n\n function getAccountLiquidity(\n address account\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\n\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 repayAmount\n ) external view returns (uint256, uint256);\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n function _beforeNonReentrant() external;\n\n function _afterNonReentrant() external;\n\n /*** New supply and borrow cap view functions ***/\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\n}\n\ninterface ComptrollerStorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function pendingAdmin() external view returns (address);\n\n function oracle() external view returns (BasePriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function enforceWhitelist() external view returns (bool);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function suppliers(address account) external view returns (bool);\n\n function cTokensByUnderlying(address) external view returns (address);\n\n /**\n * Gets the supply cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\n * `effectiveSupplyCaps` to get the correct supply cap.\n * @param cToken The address of the cToken.\n * @return The supply cap in the units of the underlying asset.\n */\n function supplyCaps(address cToken) external view returns (uint256);\n\n /**\n * Gets the borrow cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\n * `effectiveBorrowCaps` to get the correct borrow cap.\n * @param cToken The address of the cToken.\n * @return The borrow cap in the units of the underlying asset.\n */\n function borrowCaps(address cToken) external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function accountAssets(address, uint256) external view returns (address);\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function rewardsDistributors(uint256) external view returns (address);\n}\n\ninterface SFSRegister {\n function register(address _recipient) external returns (uint256 tokenId);\n}\n\ninterface ComptrollerExtensionInterface {\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function getAllBorrowersCount() external view returns (uint256);\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAccruingFlywheels() external view returns (address[] memory);\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) external;\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _removeFlywheel(address flywheelAddress) external returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\n\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\n\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\n\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\n\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\n\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setTransferPaused(bool state) external returns (bool);\n\n function _setSeizePaused(bool state) external returns (bool);\n\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\n * @return The config.\n */\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\n * @return The config.\n */\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\n * @param newConfig The new config.\n */\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\n * @param newConfig The new config.\n */\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n}\n\ninterface UnitrollerInterface {\n function comptrollerImplementation() external view returns (address);\n\n function _upgrade() external;\n\n function _acceptAdmin() external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n\n function _toggleAdminRights(bool hasRights) external returns (uint256);\n}\n\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\n\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\n\ninterface IonicComptroller is\n ComptrollerInterface,\n ComptrollerExtensionInterface,\n UnitrollerInterface,\n ComptrollerStorageInterface\n{\n\n}\n\nabstract contract ComptrollerBase is ComptrollerV4Storage {\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n bool public constant isComptroller = true;\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\n\n // Check if we're using Adrastia Prudentia for the supply cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the supply cap from Adrastia Prudentia\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n supplyCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n supplyCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local supply cap\n\n // Get the supply cap from the local supply cap\n supplyCap = supplyCaps[cToken];\n }\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\n\n // Check if we're using Adrastia Prudentia for the borrow cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the borrow cap from Adrastia Prudentia\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n borrowCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n borrowCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local borrow cap\n borrowCap = borrowCaps[cToken];\n }\n }\n}\n" + }, + "contracts/compound/ComptrollerPrudentiaCapsExt.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerPrudentiaCapsExtInterface, ComptrollerBase } from \"./ComptrollerInterface.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\n/**\n * @title ComptrollerPrudentiaCapsExt\n * @author Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\n * @notice A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\n */\ncontract ComptrollerPrudentiaCapsExt is DiamondExtension, ComptrollerBase, ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Emitted when the Adrastia Prudentia supply cap config is changed.\n * @param oldConfig The old config.\n * @param newConfig The new config.\n */\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n /**\n * @notice Emitted when the Adrastia Prudentia borrow cap config is changed.\n * @param oldConfig The old config.\n * @param newConfig The new config.\n */\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n PrudentiaLib.PrudentiaConfig memory oldConfig = supplyCapConfig;\n supplyCapConfig = newConfig;\n\n emit NewSupplyCapConfig(oldConfig, newConfig);\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n PrudentiaLib.PrudentiaConfig memory oldConfig = borrowCapConfig;\n borrowCapConfig = newConfig;\n\n emit NewBorrowCapConfig(oldConfig, newConfig);\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\n return borrowCapConfig;\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\n return supplyCapConfig;\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 4;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this._setSupplyCapConfig.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapConfig.selector;\n functionSelectors[--fnsCount] = this.getBorrowCapConfig.selector;\n functionSelectors[--fnsCount] = this.getSupplyCapConfig.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IFeeDistributor.sol\";\nimport \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract UnitrollerAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n\n /**\n * @notice Administrator for this contract\n */\n address public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address public pendingAdmin;\n\n /**\n * @notice Whether or not the Ionic admin has admin rights\n */\n bool public ionicAdminHasRights = true;\n\n /**\n * @notice Whether or not the admin has admin rights\n */\n bool public adminHasRights = true;\n\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\n }\n}\n\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\n /**\n * @notice Oracle which gives the price of any given asset\n */\n BasePriceOracle public oracle;\n\n /**\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\n */\n uint256 public closeFactorMantissa;\n\n /**\n * @notice Multiplier representing the discount on collateral that a liquidator receives\n */\n uint256 public liquidationIncentiveMantissa;\n\n /*\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\n */\n uint256 internal maxAssets;\n\n /**\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\n */\n mapping(address => ICErc20[]) public accountAssets;\n}\n\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\n struct Market {\n // Whether or not this market is listed\n bool isListed;\n // Multiplier representing the most one can borrow against their collateral in this market.\n // For instance, 0.9 to allow borrowing 90% of collateral value.\n // Must be between 0 and 1, and stored as a mantissa.\n uint256 collateralFactorMantissa;\n // Per-market mapping of \"accounts in this asset\"\n mapping(address => bool) accountMembership;\n }\n\n /**\n * @notice Official mapping of cTokens -> Market metadata\n * @dev Used e.g. to determine if a market is supported\n */\n mapping(address => Market) public markets;\n\n /// @notice A list of all markets\n ICErc20[] public allMarkets;\n\n /**\n * @dev Maps borrowers to booleans indicating if they have entered any markets\n */\n mapping(address => bool) internal borrowers;\n\n /// @notice A list of all borrowers who have entered markets\n address[] public allBorrowers;\n\n // Indexes of borrower account addresses in the `allBorrowers` array\n mapping(address => uint256) internal borrowerIndexes;\n\n /**\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\n */\n mapping(address => bool) public suppliers;\n\n /// @notice All cTokens addresses mapped by their underlying token addresses\n mapping(address => ICErc20) public cTokensByUnderlying;\n\n /// @notice Whether or not the supplier whitelist is enforced\n bool public enforceWhitelist;\n\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\n mapping(address => bool) public whitelist;\n\n /// @notice An array of all whitelisted accounts\n address[] public whitelistArray;\n\n // Indexes of account addresses in the `whitelistArray` array\n mapping(address => uint256) internal whitelistIndexes;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n * Actions which allow users to remove their own assets cannot be paused.\n * Liquidation / seizing / transfer can only be paused globally, not by market.\n */\n address public pauseGuardian;\n bool public _mintGuardianPaused;\n bool public _borrowGuardianPaused;\n bool public transferGuardianPaused;\n bool public seizeGuardianPaused;\n mapping(address => bool) public mintGuardianPaused;\n mapping(address => bool) public borrowGuardianPaused;\n}\n\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\n address public borrowCapGuardian;\n\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\n mapping(address => uint256) public borrowCaps;\n\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\n mapping(address => uint256) public supplyCaps;\n\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\n address[] public rewardsDistributors;\n\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\n bool internal _notEntered;\n\n /// @dev Whether or not _notEntered has been initialized\n bool internal _notEnteredInitialized;\n\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\n address[] public nonAccruingRewardsDistributors;\n\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\n\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => mapping(address => EnumerableSet.AddressSet))\n internal borrowingAgainstCollateralBlacklistWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\n}\n\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\n /// @dev Adrastia Prudentia config for controlling borrow caps.\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\n\n /// @dev Adrastia Prudentia config for controlling supply caps.\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\n}\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\n/**\n * @title Compound's CErc20 Contract\n * @notice CTokens which wrap an EIP-20 underlying\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\n * @author Compound\n */\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n modifier isMinHFThresholdExceeded(address borrower) {\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\n _;\n } else {\n _;\n }\n }\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 13;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.mint.selector;\n functionSelectors[--fnsCount] = this.redeem.selector;\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\n functionSelectors[--fnsCount] = this.borrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\n functionSelectors[--fnsCount] = this.getCash.selector;\n functionSelectors[--fnsCount] = this.seize.selector;\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemInternal(redeemTokens);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemUnderlyingInternal(redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return borrowInternal(borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\n return err;\n }\n\n /**\n * @notice Get cash balance of this cToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view override returns (uint256) {\n return getCashInternal();\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another cToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\n }\n\n function selfTransferOut(address to, uint256 amount) external override {\n require(msg.sender == address(this), \"!self\");\n doTransferOut(to, amount);\n }\n\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\n require(msg.sender == address(this), \"!self\");\n return doTransferIn(from, amount);\n }\n\n /**\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\n }\n\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalIonicFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\n totalIonicFees = totalIonicFeesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(address(ionicAdmin), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces admin fees by transferring to admin\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalAdminFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n totalAdminFees = totalAdminFees - withdrawAmount;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view virtual returns (uint256) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\n \"TOKEN_TRANSFER_IN_FAILED\"\n );\n\n // Calculate the amount that was *actually* transferred\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address to, uint256 amount) internal virtual {\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\n \"TOKEN_TRANSFER_OUT_FAILED\"\n );\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n struct MintLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 mintTokens;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n uint256 actualMintAmount;\n }\n\n /**\n * @notice User supplies assets into the market and receives cTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\n /* Fail if mint not allowed */\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n // Check max supply\n // unused function\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n } */\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of cTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n // mintTokens is rounded down here - correct\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\n\n /*\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\n\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, 0, redeemAmount);\n }\n\n struct RedeemLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 redeemTokens;\n uint256 redeemAmount;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n }\n\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\n res = (x * 1e18) / y;\n if (x % y != 0) res += 1;\n }\n\n /**\n * @notice User redeems cTokens in exchange for the underlying asset\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemFresh(\n address redeemer,\n uint256 redeemTokensIn,\n uint256 redeemAmountIn\n ) internal returns (uint256) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\n\n RedeemLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n if (redeemTokensIn > 0) {\n // don't allow dust tokens/assets to be left after\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\n\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n } else {\n if (redeemAmountIn == type(uint256).max) {\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\n }\n\n // don't allow dust tokens/assets to be left after\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\n\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\n\n // don't allow dust tokens/assets to be left after\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashInternal() < vars.redeemAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the redeemer and the redeemAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(redeemer, vars.redeemAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\n\n /* We call the defense hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(msg.sender, borrowAmount);\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n }\n\n /**\n * @notice Users borrow assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\n /* Fail if borrow not allowed */\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\n }\n\n /* Fail gracefully if protocol has insufficient underlying cash */\n uint256 cashPrior = getCashInternal();\n\n if (cashPrior < borrowAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n uint256(vars.mathErr)\n );\n }\n\n // Check min borrow for this user for this asset\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the borrower and the borrowAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(borrower, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.borrowVerify(address(this), borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\n internal\n nonReentrant(false)\n returns (uint256, uint256)\n {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint256 repayAmount;\n uint256 borrowerIndex;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n uint256 actualRepayAmount;\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer the account paying off the borrow\n * @param borrower the account with the debt being payed off\n * @param repayAmount the amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(\n address payer,\n address borrower,\n uint256 repayAmount\n ) internal returns (uint256, uint256) {\n /* Fail if repayBorrow not allowed */\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == type(uint256).max) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\n\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n ICErc20(cTokenCollateral).accrueInterest();\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal returns (uint256, uint256) {\n /* Fail if liquidate not allowed */\n uint256 allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n cTokenCollateral,\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify cTokenCollateral market's block number equals current block number */\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == type(uint256).max) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n cTokenCollateral,\n actualRepayAmount\n );\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint256 seizeError;\n if (cTokenCollateral == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\n\n /* We call the defense hook */\n // unused function\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\n\n return (uint256(Error.NO_ERROR), actualRepayAmount);\n }\n\n struct SeizeInternalLocalVars {\n MathError mathErr;\n uint256 borrowerTokensNew;\n uint256 liquidatorTokensNew;\n uint256 liquidatorSeizeTokens;\n uint256 protocolSeizeTokens;\n uint256 protocolSeizeAmount;\n uint256 exchangeRateMantissa;\n uint256 totalReservesNew;\n uint256 totalIonicFeeNew;\n uint256 totalSupplyNew;\n uint256 feeSeizeTokens;\n uint256 feeSeizeAmount;\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) internal returns (uint256) {\n /* Fail if seize not allowed */\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n SeizeInternalLocalVars memory vars;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\n }\n\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n vars.protocolSeizeAmount = mul_ScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n vars.protocolSeizeTokens\n );\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\n\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\n\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n totalReserves = vars.totalReservesNew;\n totalSupply = vars.totalSupplyNew;\n totalIonicFees = vars.totalIonicFeeNew;\n\n accountTokens[borrower] = vars.borrowerTokensNew;\n accountTokens[liquidator] = vars.liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\n\n /* We call the defense hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n function asCTokenExtension() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CTokenFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { IFlashLoanReceiver } from \"../ionic/IFlashLoanReceiver.sol\";\nimport { CErc20FirstExtensionBase, CTokenFirstExtensionInterface, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { SFSRegister } from \"./ComptrollerInterface.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport { Multicall } from \"../utils/Multicall.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenFirstExtension is\n CTokenOracleProtected,\n CErc20FirstExtensionBase,\n TokenErrorReporter,\n Exponential,\n DiamondExtension,\n Multicall\n{\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 25;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.transfer.selector;\n functionSelectors[--fnsCount] = this.transferFrom.selector;\n functionSelectors[--fnsCount] = this.allowance.selector;\n functionSelectors[--fnsCount] = this.approve.selector;\n functionSelectors[--fnsCount] = this.balanceOf.selector;\n functionSelectors[--fnsCount] = this._setAdminFee.selector;\n functionSelectors[--fnsCount] = this._setInterestRateModel.selector;\n functionSelectors[--fnsCount] = this._setNameAndSymbol.selector;\n functionSelectors[--fnsCount] = this._setAddressesProvider.selector;\n functionSelectors[--fnsCount] = this._setReserveFactor.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlock.selector;\n functionSelectors[--fnsCount] = this.borrowRatePerBlock.selector;\n functionSelectors[--fnsCount] = this.exchangeRateCurrent.selector;\n functionSelectors[--fnsCount] = this.accrueInterest.selector;\n functionSelectors[--fnsCount] = this.totalBorrowsCurrent.selector;\n functionSelectors[--fnsCount] = this.balanceOfUnderlying.selector;\n functionSelectors[--fnsCount] = this.multicall.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterDeposit.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterWithdraw.selector;\n functionSelectors[--fnsCount] = this.borrowRatePerBlockAfterBorrow.selector;\n functionSelectors[--fnsCount] = this.getTotalUnderlyingSupplied.selector;\n functionSelectors[--fnsCount] = this.flash.selector;\n functionSelectors[--fnsCount] = this.getAccountSnapshot.selector;\n functionSelectors[--fnsCount] = this.borrowBalanceCurrent.selector;\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function getTotalUnderlyingSupplied() public view override returns (uint256) {\n // (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees))\n return asCToken().getCash() + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees);\n }\n\n /* ERC20 fns */\n /**\n * @notice Transfer `tokens` tokens from `src` to `dst` by `spender`\n * @dev Called by both `transfer` and `transferFrom` internally\n * @param spender The address of the account performing the transfer\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param tokens The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferTokens(address spender, address src, address dst, uint256 tokens) internal returns (uint256) {\n /* Fail if transfer not allowed */\n uint256 allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Do not allow self-transfers */\n if (src == dst) {\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n /* Get the allowance, infinite for the account owner */\n uint256 startingAllowance = 0;\n if (spender == src) {\n startingAllowance = type(uint256).max;\n } else {\n startingAllowance = transferAllowances[src][spender];\n }\n\n /* Do the calculations, checking for {under,over}flow */\n MathError mathErr;\n uint256 allowanceNew;\n uint256 srcTokensNew;\n uint256 dstTokensNew;\n\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n (mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\n }\n\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n accountTokens[src] = srcTokensNew;\n accountTokens[dst] = dstTokensNew;\n\n /* Eat some of the allowance (if necessary) */\n if (startingAllowance != type(uint256).max) {\n transferAllowances[src][spender] = allowanceNew;\n }\n\n /* We emit a Transfer event */\n emit Transfer(src, dst, tokens);\n\n /* We call the defense hook */\n comptroller.transferVerify(address(this), src, dst, tokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(\n address dst,\n uint256 amount\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n return transferTokens(msg.sender, src, dst, amount) == uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(\n address spender,\n uint256 amount\n ) public override isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n address src = msg.sender;\n transferAllowances[src][spender] = amount;\n emit Approval(src, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) public view override returns (uint256) {\n return transferAllowances[owner][spender];\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) public view override returns (uint256) {\n return accountTokens[owner];\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice updates the cToken ERC20 name and symbol\n * @dev Admin function to update the cToken ERC20 name and symbol\n * @param _name the new ERC20 token name to use\n * @param _symbol the new ERC20 token symbol to use\n */\n function _setNameAndSymbol(string calldata _name, string calldata _symbol) external {\n // Check caller is admin\n require(hasAdminRights(), \"!admin\");\n\n // Set ERC20 name and symbol\n name = _name;\n symbol = _symbol;\n }\n\n function _setAddressesProvider(address _ap) external {\n // Check caller is admin\n require(hasAdminRights(), \"!admin\");\n\n ap = AddressesProvider(_ap);\n }\n\n /**\n * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n * @dev Admin function to accrue interest and set a new reserve factor\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setReserveFactor(\n uint256 newReserveFactorMantissa\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);\n }\n\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\n }\n\n // Check newReserveFactor ≤ maxReserveFactor\n if (newReserveFactorMantissa + adminFeeMantissa + ionicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\n }\n\n uint256 oldReserveFactorMantissa = reserveFactorMantissa;\n reserveFactorMantissa = newReserveFactorMantissa;\n\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice accrues interest and sets a new admin fee for the protocol using _setAdminFeeFresh\n * @dev Admin function to accrue interest and set a new admin fee\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setAdminFee(\n uint256 newAdminFeeMantissa\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_ADMIN_FEE_FRESH_CHECK);\n }\n\n // Sanitize newAdminFeeMantissa\n if (newAdminFeeMantissa == type(uint256).max) newAdminFeeMantissa = adminFeeMantissa;\n\n // Get latest Ionic fee\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\n\n // Check reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa ≤ reserveFactorPlusFeesMaxMantissa\n if (reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_ADMIN_FEE_BOUNDS_CHECK);\n }\n\n // If setting admin fee\n if (adminFeeMantissa != newAdminFeeMantissa) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_ADMIN_FEE_ADMIN_CHECK);\n }\n\n // Set admin fee\n uint256 oldAdminFeeMantissa = adminFeeMantissa;\n adminFeeMantissa = newAdminFeeMantissa;\n\n // Emit event\n emit NewAdminFee(oldAdminFeeMantissa, newAdminFeeMantissa);\n }\n\n // If setting Ionic fee\n if (ionicFeeMantissa != newIonicFeeMantissa) {\n // Set Ionic fee\n uint256 oldIonicFeeMantissa = ionicFeeMantissa;\n ionicFeeMantissa = newIonicFeeMantissa;\n\n // Emit event\n emit NewIonicFee(oldIonicFeeMantissa, newIonicFeeMantissa);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice accrues interest and updates the interest rate model using _setInterestRateModelFresh\n * @dev Admin function to accrue interest and update the interest rate model\n * @param newInterestRateModel the new interest rate model to use\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setInterestRateModel(\n InterestRateModel newInterestRateModel\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_INTEREST_RATE_MODEL_OWNER_CHECK);\n }\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\n }\n\n require(newInterestRateModel.isInterestRateModel(), \"!notIrm\");\n\n InterestRateModel oldInterestRateModel = interestRateModel;\n interestRateModel = newInterestRateModel;\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this cToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() public view override returns (uint256) {\n return\n interestRateModel.getBorrowRate(\n asCToken().getCash(),\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees\n );\n }\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) public view returns (uint256) {\n uint256 cash = asCToken().getCash();\n require(cash >= borrowAmount, \"market cash not enough\");\n\n return\n interestRateModel.getBorrowRate(\n cash - borrowAmount,\n totalBorrows + borrowAmount,\n totalReserves + totalAdminFees + totalIonicFees\n );\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this cToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() public view override returns (uint256) {\n return\n interestRateModel.getSupplyRate(\n asCToken().getCash(),\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256) {\n return\n interestRateModel.getSupplyRate(\n asCToken().getCash() + mintAmount,\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256) {\n uint256 cash = asCToken().getCash();\n require(cash >= withdrawAmount, \"market cash not enough\");\n return\n interestRateModel.getSupplyRate(\n cash - withdrawAmount,\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public view override returns (uint256) {\n if (block.number == accrualBlockNumber) {\n return\n _exchangeRateHypothetical(\n totalSupply,\n initialExchangeRateMantissa,\n asCToken().getCash(),\n totalBorrows,\n totalReserves,\n totalAdminFees,\n totalIonicFees\n );\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n\n return\n _exchangeRateHypothetical(\n accrual.totalSupply,\n initialExchangeRateMantissa,\n cashPrior,\n accrual.totalBorrows,\n accrual.totalReserves,\n accrual.totalAdminFees,\n accrual.totalIonicFees\n );\n }\n }\n\n function _exchangeRateHypothetical(\n uint256 _totalSupply,\n uint256 _initialExchangeRateMantissa,\n uint256 _totalCash,\n uint256 _totalBorrows,\n uint256 _totalReserves,\n uint256 _totalAdminFees,\n uint256 _totalIonicFees\n ) internal pure returns (uint256) {\n if (_totalSupply == 0) {\n /*\n * If there are no tokens minted:\n * exchangeRate = initialExchangeRate\n */\n return _initialExchangeRateMantissa;\n } else {\n /*\n * Otherwise:\n * exchangeRate = (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees)) / totalSupply\n */\n uint256 cashPlusBorrowsMinusReserves;\n Exp memory exchangeRate;\n MathError mathErr;\n\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(\n _totalCash,\n _totalBorrows,\n _totalReserves + _totalAdminFees + _totalIonicFees\n );\n require(mathErr == MathError.NO_ERROR, \"!addThenSubUInt overflow check failed\");\n\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\n require(mathErr == MathError.NO_ERROR, \"!getExp overflow check failed\");\n\n return exchangeRate.mantissa;\n }\n }\n\n struct InterestAccrual {\n uint256 accrualBlockNumber;\n uint256 borrowIndex;\n uint256 totalSupply;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalIonicFees;\n uint256 totalAdminFees;\n uint256 interestAccumulated;\n }\n\n function _accrueInterestHypothetical(\n uint256 blockNumber,\n uint256 cashPrior\n ) internal view returns (InterestAccrual memory accrual) {\n uint256 totalFees = totalAdminFees + totalIonicFees;\n uint256 borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, totalBorrows, totalReserves + totalFees);\n if (borrowRateMantissa > borrowRateMaxMantissa) {\n if (cashPrior > totalFees) revert(\"!borrowRate\");\n else borrowRateMantissa = borrowRateMaxMantissa;\n }\n (MathError mathErr, uint256 blockDelta) = subUInt(blockNumber, accrualBlockNumber);\n require(mathErr == MathError.NO_ERROR, \"!blockDelta\");\n\n /*\n * Calculate the interest accumulated into borrows and reserves and the new index:\n * simpleInterestFactor = borrowRate * blockDelta\n * interestAccumulated = simpleInterestFactor * totalBorrows\n * totalBorrowsNew = interestAccumulated + totalBorrows\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\n * totalIonicFeesNew = interestAccumulated * ionicFee + totalIonicFees\n * totalAdminFeesNew = interestAccumulated * adminFee + totalAdminFees\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\n */\n\n accrual.accrualBlockNumber = blockNumber;\n accrual.totalSupply = totalSupply;\n Exp memory simpleInterestFactor = mul_(Exp({ mantissa: borrowRateMantissa }), blockDelta);\n accrual.interestAccumulated = mul_ScalarTruncate(simpleInterestFactor, totalBorrows);\n accrual.totalBorrows = accrual.interestAccumulated + totalBorrows;\n accrual.totalReserves = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: reserveFactorMantissa }),\n accrual.interestAccumulated,\n totalReserves\n );\n accrual.totalIonicFees = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: ionicFeeMantissa }),\n accrual.interestAccumulated,\n totalIonicFees\n );\n accrual.totalAdminFees = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: adminFeeMantissa }),\n accrual.interestAccumulated,\n totalAdminFees\n );\n accrual.borrowIndex = mul_ScalarTruncateAddUInt(simpleInterestFactor, borrowIndex, borrowIndex);\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() public override returns (uint256) {\n /* Remember the initial block number */\n uint256 currentBlockNumber = block.number;\n\n /* Short-circuit accumulating 0 interest */\n if (accrualBlockNumber == currentBlockNumber) {\n return uint256(Error.NO_ERROR);\n }\n\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(currentBlockNumber, cashPrior);\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n accrualBlockNumber = currentBlockNumber;\n borrowIndex = accrual.borrowIndex;\n totalBorrows = accrual.totalBorrows;\n totalReserves = accrual.totalReserves;\n totalIonicFees = accrual.totalIonicFees;\n totalAdminFees = accrual.totalAdminFees;\n emit AccrueInterest(cashPrior, accrual.interestAccumulated, borrowIndex, totalBorrows);\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external view override returns (uint256) {\n if (accrualBlockNumber == block.number) {\n return totalBorrows;\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n return accrual.totalBorrows;\n }\n }\n\n /**\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view override returns (uint256, uint256, uint256, uint256) {\n uint256 cTokenBalance = accountTokens[account];\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n\n borrowBalance = borrowBalanceCurrent(account);\n\n exchangeRateMantissa = exchangeRateCurrent();\n\n return (uint256(Error.NO_ERROR), cTokenBalance, borrowBalance, exchangeRateMantissa);\n }\n\n /**\n * @notice calculate the borrowIndex and the account's borrow balance using the fresh borrowIndex\n * @param account The address whose balance should be calculated after recalculating the borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) public view override returns (uint256) {\n uint256 _borrowIndex;\n if (accrualBlockNumber == block.number) {\n _borrowIndex = borrowIndex;\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n _borrowIndex = accrual.borrowIndex;\n }\n\n /* Note: we do not assert that the market is up to date */\n MathError mathErr;\n uint256 principalTimesIndex;\n uint256 result;\n\n /* Get borrowBalance and borrowIndex */\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\n\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\n */\n if (borrowSnapshot.principal == 0) {\n return 0;\n }\n\n /* Calculate new borrow balance using the interest index:\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\n */\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, _borrowIndex);\n require(mathErr == MathError.NO_ERROR, \"!mulUInt overflow check failed\");\n\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\n require(mathErr == MathError.NO_ERROR, \"!divUInt overflow check failed\");\n\n return result;\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external view override returns (uint256) {\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\n (MathError mErr, uint256 balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\n require(mErr == MathError.NO_ERROR, \"!balance\");\n return balance;\n }\n\n function flash(uint256 amount, bytes calldata data) public override isAuthorized onlyOracleApprovedAllowEOA {\n accrueInterest();\n\n totalBorrows += amount;\n asCToken().selfTransferOut(msg.sender, amount);\n\n IFlashLoanReceiver(msg.sender).receiveFlashLoan(underlying, amount, data);\n\n asCToken().selfTransferIn(msg.sender, amount);\n totalBorrows -= amount;\n\n emit Flash(msg.sender, amount);\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n function asCToken() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n function multicall(\n bytes[] calldata data\n ) public payable override(CTokenFirstExtensionInterface, Multicall) returns (bytes[] memory results) {\n return Multicall.multicall(data);\n }\n\n function registerInSFS() external returns (uint256) {\n require(hasAdminRights() || msg.sender == address(comptroller), \"!admin\");\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\n }\n}\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\n\nabstract contract CTokenAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n}\n\nabstract contract CErc20Storage is CTokenAdminStorage {\n /**\n * @dev Guard variable for re-entrancy checks\n */\n bool internal _notEntered;\n\n /**\n * @notice EIP-20 token name for this token\n */\n string public name;\n\n /**\n * @notice EIP-20 token symbol for this token\n */\n string public symbol;\n\n /**\n * @notice EIP-20 token decimals for this token\n */\n uint8 public decimals;\n\n /*\n * Maximum borrow rate that can ever be applied (.0005% / block)\n */\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\n\n /*\n * Maximum fraction of interest that can be set aside for reserves + fees\n */\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\n\n /**\n * @notice Contract which oversees inter-cToken operations\n */\n IonicComptroller public comptroller;\n\n /**\n * @notice Model which tells what the current interest rate should be\n */\n InterestRateModel public interestRateModel;\n\n /*\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\n */\n uint256 internal initialExchangeRateMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for admin fees\n */\n uint256 public adminFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for Ionic fees\n */\n uint256 public ionicFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for reserves\n */\n uint256 public reserveFactorMantissa;\n\n /**\n * @notice Block number that interest was last accrued at\n */\n uint256 public accrualBlockNumber;\n\n /**\n * @notice Accumulator of the total earned interest rate since the opening of the market\n */\n uint256 public borrowIndex;\n\n /**\n * @notice Total amount of outstanding borrows of the underlying in this market\n */\n uint256 public totalBorrows;\n\n /**\n * @notice Total amount of reserves of the underlying held in this market\n */\n uint256 public totalReserves;\n\n /**\n * @notice Total amount of admin fees of the underlying held in this market\n */\n uint256 public totalAdminFees;\n\n /**\n * @notice Total amount of Ionic fees of the underlying held in this market\n */\n uint256 public totalIonicFees;\n\n /**\n * @notice Total number of tokens in circulation\n */\n uint256 public totalSupply;\n\n /*\n * Official record of token balances for each account\n */\n mapping(address => uint256) internal accountTokens;\n\n /*\n * Approved token transfer amounts on behalf of others\n */\n mapping(address => mapping(address => uint256)) internal transferAllowances;\n\n /**\n * @notice Container for borrow balance information\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n */\n struct BorrowSnapshot {\n uint256 principal;\n uint256 interestIndex;\n }\n\n /*\n * Mapping of account addresses to outstanding borrow balances\n */\n mapping(address => BorrowSnapshot) internal accountBorrows;\n\n /*\n * Share of seized collateral that is added to reserves\n */\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\n\n /*\n * Share of seized collateral taken as fees\n */\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\n\n /**\n * @notice Underlying asset for this CToken\n */\n address public underlying;\n\n /**\n * @notice Addresses Provider\n */\n AddressesProvider public ap;\n\n /**\n * @notice Morpho Universal Rewards Distributor\n */\n address public morphoURD;\n\n /**\n * @notice Permissioned cTokenMinter\n */\n address public cTokenMinter;\n}\n\nabstract contract CTokenBaseEvents {\n /* ERC20 */\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the admin fee is changed\n */\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\n\n /**\n * @notice Event emitted when the Ionic fee is changed\n */\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\n}\n\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\n event Flash(address receiver, uint256 amount);\n}\n\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral,\n uint256 seizeTokens\n );\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\n}\n\ninterface CTokenFirstExtensionInterface {\n /*** User Interface ***/\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n /*** Admin Functions ***/\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\n\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function exchangeRateCurrent() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function totalBorrowsCurrent() external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external view returns (uint256);\n\n function getTotalUnderlyingSupplied() external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external view returns (uint256);\n\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n\n function flash(uint256 amount, bytes calldata data) external;\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface CTokenSecondExtensionInterface {\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\n\n /*** Admin Functions ***/\n\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\n\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\n\n function selfTransferOut(address to, uint256 amount) external;\n\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\n}\n\ninterface CDelegatorInterface {\n function implementation() external view returns (address);\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external;\n}\n\ninterface CDelegateInterface {\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @dev Should revert if any issues arise which make it unfit for delegation\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes calldata data) external;\n\n function delegateType() external pure returns (uint8);\n\n function contractType() external pure returns (string memory);\n}\n\nabstract contract CErc20AdminBase is CErc20Storage {\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\n return\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\n }\n}\n\nabstract contract CErc20FirstExtensionBase is\n CErc20AdminBase,\n CTokenFirstExtensionEvents,\n CTokenFirstExtensionInterface\n{}\n\nabstract contract CTokenSecondExtensionBase is\n CErc20AdminBase,\n CTokenSecondExtensionEvents,\n CTokenSecondExtensionInterface,\n CDelegateInterface\n{}\n\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\n\ninterface CErc20StorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function comptroller() external view returns (IonicComptroller);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function accrualBlockNumber() external view returns (uint256);\n\n function underlying() external view returns (address);\n\n function borrowIndex() external view returns (uint256);\n\n function interestRateModel() external view returns (address);\n}\n\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\n function plugin() external view returns (address);\n}\n\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\n function approve(address, address) external;\n}\n\ninterface ICErc20 is\n CErc20StorageInterface,\n CTokenSecondExtensionInterface,\n CTokenFirstExtensionInterface,\n CDelegatorInterface,\n CDelegateInterface\n{}\n\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\n function _updatePlugin(address _plugin) external;\n}\n\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\n" + }, + "contracts/compound/CTokenMinter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\ncontract CTokenMinter is Initializable, OwnableUpgradeable {\n ICErc20 public collateralMarket;\n uint256 public startTime;\n uint256 public endTime;\n\n modifier onlyDuringMintWindow() {\n require(block.timestamp >= startTime && block.timestamp <= endTime, \"Minting not allowed at this time\");\n _;\n }\n\n function initialize(address _cTokenAddress, uint256 _startTime, uint256 _endTime) public initializer {\n require(_startTime < _endTime, \"Invalid time window\");\n __Ownable_init();\n collateralMarket = ICErc20(_cTokenAddress);\n startTime = _startTime;\n endTime = _endTime;\n }\n\n function mint(uint256 mintAmount) external onlyDuringMintWindow {\n // MINT LOGIC\n }\n\n function setMintWindow(uint256 _newStartTime, uint256 _newEndTime) external onlyOwner {\n require(_newStartTime < _newEndTime, \"Invalid time window\");\n startTime = _newStartTime;\n endTime = _newEndTime;\n }\n}\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenOracleProtected is CErc20Storage {\n error InteractionNotAllowed();\n error CallerIsNotEOA();\n\n modifier onlyOracleApproved() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyOracleApprovedAllowEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n if (tx.origin == msg.sender) {\n _;\n return;\n }\n\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyNotBlacklistedEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n if (msg.sender != tx.origin) {\n revert CallerIsNotEOA();\n }\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n _;\n }\n}\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title ERC 20 Token Standard Interface\n * https://eips.ethereum.org/EIPS/eip-20\n */\ninterface EIP20Interface {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n /**\n * @notice Get the total number of tokens in circulation\n * @return uint256 The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance uint256 The balance\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool success);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return success bool Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ncontract ComptrollerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n COMPTROLLER_MISMATCH,\n INSUFFICIENT_SHORTFALL,\n INSUFFICIENT_LIQUIDITY,\n INVALID_CLOSE_FACTOR,\n INVALID_COLLATERAL_FACTOR,\n INVALID_LIQUIDATION_INCENTIVE,\n MARKET_NOT_LISTED,\n MARKET_ALREADY_LISTED,\n MATH_ERROR,\n NONZERO_BORROW_BALANCE,\n PRICE_ERROR,\n REJECTION,\n SNAPSHOT_ERROR,\n TOO_MANY_ASSETS,\n TOO_MUCH_REPAY,\n SUPPLIER_NOT_WHITELISTED,\n BORROW_BELOW_MIN,\n SUPPLY_ABOVE_MAX,\n NONZERO_TOTAL_SUPPLY\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\n EXIT_MARKET_BALANCE_OWED,\n EXIT_MARKET_REJECTION,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\n SET_CLOSE_FACTOR_OWNER_CHECK,\n SET_CLOSE_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_NO_EXISTS,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_PRICE_ORACLE_OWNER_CHECK,\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\n SET_WHITELIST_STATUS_OWNER_CHECK,\n SUPPORT_MARKET_EXISTS,\n SUPPORT_MARKET_OWNER_CHECK,\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\n UNSUPPORT_MARKET_OWNER_CHECK,\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\n UNSUPPORT_MARKET_IN_USE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return uint256(err);\n }\n}\n\ncontract TokenErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n BAD_INPUT,\n COMPTROLLER_REJECTION,\n COMPTROLLER_CALCULATION_ERROR,\n INTEREST_RATE_MODEL_ERROR,\n INVALID_ACCOUNT_PAIR,\n INVALID_CLOSE_AMOUNT_REQUESTED,\n INVALID_COLLATERAL_FACTOR,\n MATH_ERROR,\n MARKET_NOT_FRESH,\n MARKET_NOT_LISTED,\n TOKEN_INSUFFICIENT_ALLOWANCE,\n TOKEN_INSUFFICIENT_BALANCE,\n TOKEN_INSUFFICIENT_CASH,\n TOKEN_TRANSFER_IN_FAILED,\n TOKEN_TRANSFER_OUT_FAILED,\n UTILIZATION_ABOVE_MAX\n }\n\n /*\n * Note: FailureInfo (but not Error) is kept in alphabetical order\n * This is because FailureInfo grows significantly faster, and\n * the order of Error has some meaning, while the order of FailureInfo\n * is entirely arbitrary.\n */\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n BORROW_ACCRUE_INTEREST_FAILED,\n BORROW_CASH_NOT_AVAILABLE,\n BORROW_FRESHNESS_CHECK,\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n BORROW_MARKET_NOT_LISTED,\n BORROW_COMPTROLLER_REJECTION,\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n LIQUIDATE_COMPTROLLER_REJECTION,\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n LIQUIDATE_FRESHNESS_CHECK,\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_ACCRUE_INTEREST_FAILED,\n MINT_COMPTROLLER_REJECTION,\n MINT_EXCHANGE_CALCULATION_FAILED,\n MINT_EXCHANGE_RATE_READ_FAILED,\n MINT_FRESHNESS_CHECK,\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n MINT_TRANSFER_IN_FAILED,\n MINT_TRANSFER_IN_NOT_POSSIBLE,\n NEW_UTILIZATION_RATE_ABOVE_MAX,\n REDEEM_ACCRUE_INTEREST_FAILED,\n REDEEM_COMPTROLLER_REJECTION,\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\n REDEEM_EXCHANGE_RATE_READ_FAILED,\n REDEEM_FRESHNESS_CHECK,\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\n WITHDRAW_IONIC_FEES_VALIDATION,\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\n WITHDRAW_ADMIN_FEES_VALIDATION,\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\n REDUCE_RESERVES_ADMIN_CHECK,\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\n REDUCE_RESERVES_FRESH_CHECK,\n REDUCE_RESERVES_VALIDATION,\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_COMPTROLLER_REJECTION,\n REPAY_BORROW_FRESHNESS_CHECK,\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COMPTROLLER_OWNER_CHECK,\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\n SET_ADMIN_FEE_ADMIN_CHECK,\n SET_ADMIN_FEE_FRESH_CHECK,\n SET_ADMIN_FEE_BOUNDS_CHECK,\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\n SET_IONIC_FEE_FRESH_CHECK,\n SET_IONIC_FEE_BOUNDS_CHECK,\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\n SET_RESERVE_FACTOR_ADMIN_CHECK,\n SET_RESERVE_FACTOR_FRESH_CHECK,\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\n TRANSFER_COMPTROLLER_REJECTION,\n TRANSFER_NOT_ALLOWED,\n TRANSFER_NOT_ENOUGH,\n TRANSFER_TOO_MUCH,\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\n ADD_RESERVES_FRESH_CHECK,\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\n }\n}\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CarefulMath.sol\";\nimport \"./ExponentialNoError.sol\";\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract Exponential is CarefulMath, ExponentialNoError {\n /**\n * @dev Creates an exponential from numerator and denominator values.\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\n * or if `denom` is zero.\n */\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\n }\n\n /**\n * @dev Adds two exponentials, returning a new exponential.\n */\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Subtracts two exponentials, returning a new exponential.\n */\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, returning a new Exp.\n */\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(product));\n }\n\n /**\n * @dev Divide an Exp by a scalar, returning a new Exp.\n */\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\n }\n\n /**\n * @dev Divide a scalar by an Exp, returning a new Exp.\n */\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\n /*\n We are doing this as:\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\n\n How it works:\n Exp = a / b;\n Scalar = s;\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\n */\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n return getExp(numerator, divisor.mantissa);\n }\n\n /**\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\n */\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(fraction));\n }\n\n /**\n * @dev Multiplies two exponentials, returning a new exponential.\n */\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n // We add half the scale before dividing so that we get rounding instead of truncation.\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\n assert(err2 == MathError.NO_ERROR);\n\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\n }\n\n /**\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\n */\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\n }\n\n /**\n * @dev Multiplies three exponentials, returning a new exponential.\n */\n function mulExp3(\n Exp memory a,\n Exp memory b,\n Exp memory c\n ) internal pure returns (MathError, Exp memory) {\n (MathError err, Exp memory ab) = mulExp(a, b);\n if (err != MathError.NO_ERROR) {\n return (err, ab);\n }\n return mulExp(ab, c);\n }\n\n /**\n * @dev Divides two exponentials, returning a new exponential.\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\n */\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n return getExp(a.mantissa, b.mantissa);\n }\n}\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract ExponentialNoError {\n uint256 constant expScale = 1e18;\n uint256 constant doubleScale = 1e36;\n uint256 constant halfExpScale = expScale / 2;\n uint256 constant mantissaOne = expScale;\n\n struct Exp {\n uint256 mantissa;\n }\n\n struct Double {\n uint256 mantissa;\n }\n\n /**\n * @dev Truncates the given exp to a whole number value.\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\n */\n function truncate(Exp memory exp) internal pure returns (uint256) {\n // Note: We are not using careful math here as we're performing a division that cannot fail\n return exp.mantissa / expScale;\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return truncate(product);\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mul_ScalarTruncateAddUInt(\n Exp memory a,\n uint256 scalar,\n uint256 addend\n ) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return add_(truncate(product), addend);\n }\n\n /**\n * @dev Checks if first Exp is less than second Exp.\n */\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa < right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp <= right Exp.\n */\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa <= right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp > right Exp.\n */\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa > right.mantissa;\n }\n\n /**\n * @dev returns true if Exp is exactly zero\n */\n function isZeroExp(Exp memory value) internal pure returns (bool) {\n return value.mantissa == 0;\n }\n\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\n require(n < 2**224, errorMessage);\n return uint224(n);\n }\n\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2**32, errorMessage);\n return uint32(n);\n }\n\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\n return add_(a, b, \"addition overflow\");\n }\n\n function add_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub_(a, b, \"subtraction underflow\");\n }\n\n function sub_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\n }\n\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / expScale;\n }\n\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\n }\n\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / doubleScale;\n }\n\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\n return mul_(a, b, \"multiplication overflow\");\n }\n\n function mul_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n if (a == 0 || b == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n return c;\n }\n\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\n }\n\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return div_(mul_(a, expScale), b.mantissa);\n }\n\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\n }\n\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\n return div_(mul_(a, doubleScale), b.mantissa);\n }\n\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\n return div_(a, b, \"divide by zero\");\n }\n\n function div_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\n }\n}\n" + }, + "contracts/compound/IERC4626.sol": { + "content": "pragma solidity >=0.8.0;\npragma experimental ABIEncoderV2;\n\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\n\ninterface IERC4626 is EIP20Interface {\n /*----------------------------------------------------------------\n Events\n ----------------------------------------------------------------*/\n\n event Deposit(address indexed from, address indexed to, uint256 value);\n\n event Withdraw(address indexed from, address indexed to, uint256 value);\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n /**\n @notice Deposit a specific amount of underlying tokens.\n @param underlyingAmount The amount of the underlying token to deposit.\n @param to The address to receive shares corresponding to the deposit\n @return shares The shares in the vault credited to `to`\n */\n function deposit(uint256 underlyingAmount, address to) external returns (uint256 shares);\n\n /**\n @notice Mint an exact amount of shares for a variable amount of underlying tokens.\n @param shareAmount The amount of vault shares to mint.\n @param to The address to receive shares corresponding to the mint.\n @return underlyingAmount The amount of the underlying tokens deposited from the mint call.\n */\n function mint(uint256 shareAmount, address to) external returns (uint256 underlyingAmount);\n\n /**\n @notice Withdraw a specific amount of underlying tokens.\n @param underlyingAmount The amount of the underlying token to withdraw.\n @param to The address to receive underlying corresponding to the withdrawal.\n @param from The address to burn shares from corresponding to the withdrawal.\n @return shares The shares in the vault burned from sender\n */\n function withdraw(\n uint256 underlyingAmount,\n address to,\n address from\n ) external returns (uint256 shares);\n\n /**\n @notice Redeem a specific amount of shares for underlying tokens.\n @param shareAmount The amount of shares to redeem.\n @param to The address to receive underlying corresponding to the redemption.\n @param from The address to burn shares from corresponding to the redemption.\n @return value The underlying amount transferred to `to`.\n */\n function redeem(\n uint256 shareAmount,\n address to,\n address from\n ) external returns (uint256 value);\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n /** \n @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n @return the address of the asset\n */\n function asset() external view returns (address);\n\n /** \n @notice Returns a user's Vault balance in underlying tokens.\n @param user The user to get the underlying balance of.\n @return balance The user's Vault balance in underlying tokens.\n */\n function balanceOfUnderlying(address user) external view returns (uint256 balance);\n\n /** \n @notice Calculates the total amount of underlying tokens the Vault manages.\n @return The total amount of underlying tokens the Vault manages.\n */\n function totalAssets() external view returns (uint256);\n\n /** \n @notice Returns the value in underlying terms of one vault token. \n */\n function exchangeRate() external view returns (uint256);\n\n /**\n @notice Returns the amount of vault tokens that would be obtained if depositing a given amount of underlying tokens in a `deposit` call.\n @param underlyingAmount the input amount of underlying tokens\n @return shareAmount the corresponding amount of shares out from a deposit call with `underlyingAmount` in\n */\n function previewDeposit(uint256 underlyingAmount) external view returns (uint256 shareAmount);\n\n /**\n @notice Returns the amount of underlying tokens that would be deposited if minting a given amount of shares in a `mint` call.\n @param shareAmount the amount of shares from a mint call.\n @return underlyingAmount the amount of underlying tokens corresponding to the mint call\n */\n function previewMint(uint256 shareAmount) external view returns (uint256 underlyingAmount);\n\n /**\n @notice Returns the amount of vault tokens that would be burned if withdrawing a given amount of underlying tokens in a `withdraw` call.\n @param underlyingAmount the input amount of underlying tokens\n @return shareAmount the corresponding amount of shares out from a withdraw call with `underlyingAmount` in\n */\n function previewWithdraw(uint256 underlyingAmount) external view returns (uint256 shareAmount);\n\n /**\n @notice Returns the amount of underlying tokens that would be obtained if redeeming a given amount of shares in a `redeem` call.\n @param shareAmount the amount of shares from a redeem call.\n @return underlyingAmount the amount of underlying tokens corresponding to the redeem call\n */\n function previewRedeem(uint256 shareAmount) external view returns (uint256 underlyingAmount);\n}\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../ionic/AuthoritiesRegistry.sol\";\n\ninterface IFeeDistributor {\n function minBorrowEth() external view returns (uint256);\n\n function maxUtilizationRate() external view returns (uint256);\n\n function interestFeeRate() external view returns (uint256);\n\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\n\n function latestCErc20Delegate(uint8 delegateType)\n external\n view\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\n\n function latestPluginImplementation(address oldImplementation) external view returns (address);\n\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\n\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address);\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\n\n fallback() external payable;\n\n receive() external payable;\n}\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's InterestRateModel Interface\n * @author Compound\n */\nabstract contract InterestRateModel {\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n bool public constant isInterestRateModel = true;\n\n /**\n * @notice Calculates the current borrow interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view virtual returns (uint256);\n\n /**\n * @notice Calculates the current supply interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @param reserveFactorMantissa The current reserve factor the market has\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual returns (uint256);\n}\n" + }, + "contracts/compound/JumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./InterestRateModel.sol\";\n\n/**\n * @title Compound's JumpRateModel Contract\n * @author Compound\n */\ncontract JumpRateModel is InterestRateModel {\n event NewInterestParams(\n uint256 baseRatePerBlock,\n uint256 multiplierPerBlock,\n uint256 jumpMultiplierPerBlock,\n uint256 kink\n );\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint256 public blocksPerYear;\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint256 public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint256 public baseRatePerBlock;\n\n /**\n * @notice The multiplierPerBlock after hitting a specified utilization point\n */\n uint256 public jumpMultiplierPerBlock;\n\n /**\n * @notice The utilization point at which the jump multiplier is applied\n */\n uint256 public kink;\n\n /**\n * @notice Construct an interest rate model\n * @param _blocksPerYear The approximate number of blocks per year\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\n * @param kink_ The utilization point at which the jump multiplier is applied\n */\n constructor(\n uint256 _blocksPerYear,\n uint256 baseRatePerYear,\n uint256 multiplierPerYear,\n uint256 jumpMultiplierPerYear,\n uint256 kink_\n ) {\n blocksPerYear = _blocksPerYear;\n baseRatePerBlock = baseRatePerYear / blocksPerYear;\n multiplierPerBlock = multiplierPerYear / blocksPerYear;\n jumpMultiplierPerBlock = jumpMultiplierPerYear / blocksPerYear;\n kink = kink_;\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return (borrows * 1e18) / (cash + borrows - reserves);\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n uint256 util = utilizationRate(cash, borrows, reserves);\n\n if (util <= kink) {\n return ((util * multiplierPerBlock) / 1e18) + baseRatePerBlock;\n } else {\n uint256 normalRate = ((kink * multiplierPerBlock) / 1e18) + baseRatePerBlock;\n uint256 excessUtil = util - kink;\n return ((excessUtil * jumpMultiplierPerBlock) / 1e18) + normalRate;\n }\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\n }\n}\n" + }, + "contracts/compound/PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\n\nabstract contract PriceOracle {\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\n bool public constant isPriceOracle = true;\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view virtual returns (uint256);\n}\n" + }, + "contracts/compound/SafeMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol\n// Subject to the MIT license.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot underflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction underflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot underflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers.\n * Reverts on division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers.\n * Reverts with custom message on division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ErrorReporter.sol\";\nimport \"./ComptrollerStorage.sol\";\nimport \"./Comptroller.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\n\n/**\n * @title Unitroller\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\n * CTokens should reference this contract as their comptroller.\n */\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\n /**\n * @notice Event emitted when the admin rights are changed\n */\n event AdminRightsToggled(bool hasRights);\n\n /**\n * @notice Emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n constructor(address payable _ionicAdmin) {\n admin = msg.sender;\n ionicAdmin = _ionicAdmin;\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Toggles admin rights.\n * @param hasRights Boolean indicating if the admin is to have rights.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\n }\n\n // Check that rights have not already been set to the desired value\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\n\n adminHasRights = hasRights;\n emit AdminRightsToggled(hasRights);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @param newPendingAdmin New pending admin.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\n }\n\n address oldPendingAdmin = pendingAdmin;\n pendingAdmin = newPendingAdmin;\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n * @dev Admin function for pending admin to accept role and update admin\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint256) {\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n admin = pendingAdmin;\n pendingAdmin = address(0);\n\n emit NewAdmin(oldAdmin, admin);\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n function comptrollerImplementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n\n address currentImplementation = comptrollerImplementation();\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\n currentImplementation\n );\n\n _updateExtensions(latestComptrollerImplementation);\n\n if (currentImplementation != latestComptrollerImplementation) {\n // reinitialize\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function _updateExtensions(address currentComptroller) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(hasAdminRights(), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/EmissionsManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IonicFlywheelCore } from \"./ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { IEmissionsManager } from \"./IEmissionsManager.sol\";\nimport { IveION } from \"./veION/interfaces/IveION.sol\";\n\ninterface Oracle {\n function getUnderlyingPrice(address) external returns (uint256);\n}\n\ncontract EmissionsManager is IEmissionsManager, Ownable2StepUpgradeable {\n using SafeTransferLib for ERC20;\n\n address public protocolAddress;\n uint256 public collateralBp;\n PoolDirectory public fpd;\n ERC20 public rewardToken;\n address public veION;\n\n bytes public nonBlacklistableTargetBytecode;\n mapping(address => bool) public isBlacklisted;\n mapping(address => bool) public nonBlacklistable;\n\n uint256 public constant MAXIMUM_BASIS_POINTS = 10_000;\n uint256 public constant BLACKLISTER_SHARE = 80;\n uint256 public constant PROTOCOL_SHARE = 20;\n\n modifier onlyBlacklistableBytecode(address _addr) {\n bytes memory code = _addr.code;\n require(keccak256(code) != keccak256(nonBlacklistableTargetBytecode), \"Non-blacklistable bytecode\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize(\n PoolDirectory _fpd,\n address _protocolAddress,\n ERC20 _rewardToken,\n uint256 _collateralBp,\n bytes memory _nonBlacklistableTargetBytecode\n ) public initializer {\n if (address(_fpd) == address(0)) revert InvalidPoolDirectoryAaddress();\n if (_protocolAddress == address(0)) revert InvalidProtocolAddress();\n if (address(_rewardToken) == address(0)) revert InvalidRewardTokenAddress();\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert CollateralBasisPointsExceedMaximum();\n\n __Ownable2Step_init();\n protocolAddress = _protocolAddress;\n fpd = _fpd;\n rewardToken = _rewardToken;\n collateralBp = _collateralBp;\n nonBlacklistableTargetBytecode = _nonBlacklistableTargetBytecode;\n\n emit Initialized(_protocolAddress, address(_rewardToken), _collateralBp, _nonBlacklistableTargetBytecode);\n }\n\n function setVeIon(IveION _veIon) external onlyOwner {\n if (address(_veIon) == address(0)) revert InvalidVeIONAddress();\n veION = address(_veIon);\n emit VeIonSet(address(_veIon));\n }\n\n function setCollateralBp(uint256 _collateralBp) external onlyOwner {\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert MaximumLimitExceeded();\n collateralBp = _collateralBp;\n emit CollateralBpSet(_collateralBp);\n }\n\n function setNonBlacklistableAddress(address _user, bool _isNonBlacklistable) external onlyOwner {\n nonBlacklistable[_user] = _isNonBlacklistable;\n emit NonBlacklistableAddressSet(_user, _isNonBlacklistable);\n }\n\n function setNonBlacklistableTargetBytecode(bytes memory _newBytecode) external onlyOwner {\n nonBlacklistableTargetBytecode = _newBytecode;\n emit NonBlacklistableTargetBytecodeSet(_newBytecode);\n }\n\n function setProtocolAddress(address _newProtocolAddress) external onlyOwner {\n require(_newProtocolAddress != address(0), \"Invalid address\");\n protocolAddress = _newProtocolAddress;\n }\n\n function _getUserTotalCollateral(address _user) internal view returns (uint256) {\n uint256 totalColateralInETH = 0;\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n BasePriceOracle oracle = comptroller.oracle();\n ICErc20[] memory cTokens = comptroller.getAssetsIn(_user);\n uint256 cTokensLength = cTokens.length;\n for (uint256 j = 0; j < cTokensLength; j++) {\n uint256 supplyBalance = cTokens[j].balanceOfUnderlying(_user);\n uint256 collateralInETH = (supplyBalance * oracle.getUnderlyingPrice(cTokens[j])) / 1e18;\n totalColateralInETH += collateralInETH;\n }\n }\n return totalColateralInETH;\n }\n\n function getUserTotalCollateral(address _user) external view returns (uint256) {\n return _getUserTotalCollateral(_user);\n }\n\n function _checkCollateralRatio(address _user) internal view returns (bool) {\n uint256 userCollateralValue = _getUserTotalCollateral(_user);\n if (userCollateralValue == 0) return true;\n uint256 userLPValue = IveION(veION).getTotalEthValueOfTokens(_user);\n if ((userLPValue * MAXIMUM_BASIS_POINTS) / userCollateralValue >= collateralBp) {\n return true;\n } else return false;\n }\n\n function reportUser(address _user) external onlyBlacklistableBytecode(_user) {\n require(!nonBlacklistable[_user], \"Non-blacklistable user\");\n require(!isBlacklisted[_user], \"Already blacklisted\");\n require(!_checkCollateralRatio(_user), \"LP balance above threshold\");\n isBlacklisted[_user] = true;\n _blacklistUserAndClaimEmissions(_user);\n }\n\n function whitelistUser(address _user) external {\n require(isBlacklisted[_user], \"Already whitelisted\");\n require(_checkCollateralRatio(_user), \"LP balance below threshold\");\n isBlacklisted[_user] = false;\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory cTokens = comptroller.getAssetsIn(_user);\n uint256 cTokensLength = cTokens.length;\n for (uint256 j = 0; j < cTokensLength; j++) {\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n uint256 flywheelAddressesLength = flywheelAddresses.length;\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\n flywheel.whitelistUser(ERC20(address(cTokens[j])), _user);\n flywheel.accrue(ERC20(address(cTokens[j])), _user);\n }\n }\n }\n }\n }\n\n function isUserBlacklisted(address _user) external view returns (bool) {\n return isBlacklisted[_user];\n }\n\n function isUserBlacklistable(address _user) external view returns (bool) {\n if (nonBlacklistable[_user] || keccak256(_user.code) == keccak256(nonBlacklistableTargetBytecode)) {\n return false;\n }\n return !_checkCollateralRatio(_user) && !isBlacklisted[_user];\n }\n\n function _blacklistUserAndClaimEmissions(address user) internal {\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(address(this));\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ERC20[] memory markets;\n {\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\n uint256 cerc20sLength = cerc20s.length;\n markets = new ERC20[](cerc20sLength);\n for (uint256 j = 0; j < cerc20sLength; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n }\n\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n uint256 flywheelAddressesLength = flywheelAddresses.length;\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\n uint256 marketsLength = markets.length;\n for (uint256 m = 0; m < marketsLength; m++) {\n flywheel.accrue(markets[m], user);\n flywheel.updateBlacklistBalances(markets[m], user);\n }\n flywheel.takeRewardsFromUser(user, address(this));\n }\n }\n }\n\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(address(this));\n uint256 totalClaimed = balanceAfter - balanceBefore;\n if (totalClaimed > 0) {\n rewardToken.safeTransfer(msg.sender, (totalClaimed * BLACKLISTER_SHARE) / 100);\n rewardToken.safeTransfer(protocolAddress, (totalClaimed * PROTOCOL_SHARE) / 100);\n }\n }\n}\n" + }, + "contracts/external/aerodrome/IAerodromeRouter.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.10;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20_Router {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IWETH is IERC20_Router {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n\ninterface IRouter_Aerodrome {\n struct Route {\n address from;\n address to;\n bool stable;\n address factory;\n }\n\n error ETHTransferFailed();\n error Expired();\n error InsufficientAmount();\n error InsufficientAmountA();\n error InsufficientAmountB();\n error InsufficientAmountADesired();\n error InsufficientAmountBDesired();\n error InsufficientAmountAOptimal();\n error InsufficientLiquidity();\n error InsufficientOutputAmount();\n error InvalidAmountInForETHDeposit();\n error InvalidTokenInForETHDeposit();\n error InvalidPath();\n error InvalidRouteA();\n error InvalidRouteB();\n error OnlyWETH();\n error PoolDoesNotExist();\n error PoolFactoryDoesNotExist();\n error SameAddresses();\n error ZeroAddress();\n\n /// @notice Address of FactoryRegistry.sol\n function factoryRegistry() external view returns (address);\n\n /// @notice Address of Protocol PoolFactory.sol\n function defaultFactory() external view returns (address);\n\n /// @notice Address of Voter.sol\n function voter() external view returns (address);\n\n /// @notice Interface of WETH contract used for WETH => ETH wrapping/unwrapping\n function weth() external view returns (IWETH);\n\n /// @dev Represents Ether. Used by zapper to determine whether to return assets as ETH/WETH.\n function ETHER() external view returns (address);\n\n /// @dev Struct containing information necessary to zap in and out of pools\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable Stable or volatile pool\n /// @param factory factory of pool\n /// @param amountOutMinA Minimum amount expected from swap leg of zap via routesA\n /// @param amountOutMinB Minimum amount expected from swap leg of zap via routesB\n /// @param amountAMin Minimum amount of tokenA expected from liquidity leg of zap\n /// @param amountBMin Minimum amount of tokenB expected from liquidity leg of zap\n struct Zap {\n address tokenA;\n address tokenB;\n bool stable;\n address factory;\n uint256 amountOutMinA;\n uint256 amountOutMinB;\n uint256 amountAMin;\n uint256 amountBMin;\n }\n\n /// @notice Sort two tokens by which address value is less than the other\n /// @param tokenA Address of token to sort\n /// @param tokenB Address of token to sort\n /// @return token0 Lower address value between tokenA and tokenB\n /// @return token1 Higher address value between tokenA and tokenB\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\n\n /// @notice Calculate the address of a pool by its' factory.\n /// Used by all Router functions containing a `Route[]` or `_factory` argument.\n /// Reverts if _factory is not approved by the FactoryRegistry\n /// @dev Returns a randomly generated address for a nonexistent pool\n /// @param tokenA Address of token to query\n /// @param tokenB Address of token to query\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of factory which created the pool\n function poolFor(address tokenA, address tokenB, bool stable, address _factory) external view returns (address pool);\n\n /// @notice Fetch and sort the reserves for a pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @return reserveA Amount of reserves of the sorted token A\n /// @return reserveB Amount of reserves of the sorted token B\n function getReserves(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory\n ) external view returns (uint256 reserveA, uint256 reserveB);\n\n /// @notice Perform chained getAmountOut calculations on any number of pools\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\n\n // **** ADD LIQUIDITY ****\n\n /// @notice Quote the amount deposited into a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function quoteAddLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 amountADesired,\n uint256 amountBDesired\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Quote the amount of liquidity removed from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @param liquidity Amount of liquidity to remove\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function quoteRemoveLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 liquidity\n ) external view returns (uint256 amountA, uint256 amountB);\n\n /// @notice Add liquidity of two tokens to a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @param amountAMin Minimum amount of tokenA to deposit\n /// @param amountBMin Minimum amount of tokenB to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountTokenDesired Amount of token desired to deposit\n /// @param amountTokenMin Minimum amount of token to deposit\n /// @param amountETHMin Minimum amount of ETH to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to add liquidity\n /// @return amountToken Amount of token to actually deposit\n /// @return amountETH Amount of tokenETH to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidityETH(\n address token,\n bool stable,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n // **** REMOVE LIQUIDITY ****\n\n /// @notice Remove liquidity of two tokens from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountAMin Minimum amount of tokenA to receive\n /// @param amountBMin Minimum amount of tokenB to receive\n /// @param to Recipient of tokens received\n /// @param deadline Deadline to remove liquidity\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function removeLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountToken Amount of token received\n /// @return amountETH Amount of ETH received\n function removeLiquidityETH(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountETH Amount of ETH received\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n // **** SWAP ****\n\n /// @notice Swap one token for another\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap ETH for a token\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactETHForTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n /// @notice Swap a token for WETH (returned as ETH)\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap one token for another without slippage protection\n /// @return amounts Array of amounts to swap per route\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function UNSAFE_swapExactTokensForTokens(\n uint256[] memory amounts,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory);\n\n // **** SWAP (supporting fee-on-transfer tokens) ****\n\n /// @notice Swap one token for another supporting fee-on-transfer tokens\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external;\n\n /// @notice Swap ETH for a token supporting fee-on-transfer tokens\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable;\n\n /// @notice Swap a token for WETH (returned as ETH) supporting fee-on-transfer tokens\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external;\n\n /// @notice Zap a token A into a pool (B, C). (A can be equal to B or C).\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\n /// Slippage is required for the initial swap.\n /// Additional slippage may be required when adding liquidity as the\n /// price of the token may have changed.\n /// @param tokenIn Token you are zapping in from (i.e. input token).\n /// @param amountInA Amount of input token you wish to send down routesA\n /// @param amountInB Amount of input token you wish to send down routesB\n /// @param zapInPool Contains zap struct information. See Zap struct.\n /// @param routesA Route used to convert input token to tokenA\n /// @param routesB Route used to convert input token to tokenB\n /// @param to Address you wish to mint liquidity to.\n /// @param stake Auto-stake liquidity in corresponding gauge.\n /// @return liquidity Amount of LP tokens created from zapping in.\n function zapIn(\n address tokenIn,\n uint256 amountInA,\n uint256 amountInB,\n Zap calldata zapInPool,\n Route[] calldata routesA,\n Route[] calldata routesB,\n address to,\n bool stake\n ) external payable returns (uint256 liquidity);\n\n /// @notice Zap out a pool (B, C) into A.\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\n /// Slippage is required for the removal of liquidity.\n /// Additional slippage may be required on the swap as the\n /// price of the token may have changed.\n /// @param tokenOut Token you are zapping out to (i.e. output token).\n /// @param liquidity Amount of liquidity you wish to remove.\n /// @param zapOutPool Contains zap struct information. See Zap struct.\n /// @param routesA Route used to convert tokenA into output token.\n /// @param routesB Route used to convert tokenB into output token.\n function zapOut(\n address tokenOut,\n uint256 liquidity,\n Zap calldata zapOutPool,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external;\n\n /// @notice Used to generate params required for zapping in.\n /// Zap in => remove liquidity then swap.\n /// Apply slippage to expected swap values to account for changes in reserves in between.\n /// @dev Output token refers to the token you want to zap in from.\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable .\n /// @param _factory .\n /// @param amountInA Amount of input token you wish to send down routesA\n /// @param amountInB Amount of input token you wish to send down routesB\n /// @param routesA Route used to convert input token to tokenA\n /// @param routesB Route used to convert input token to tokenB\n /// @return amountOutMinA Minimum output expected from swapping input token to tokenA.\n /// @return amountOutMinB Minimum output expected from swapping input token to tokenB.\n /// @return amountAMin Minimum amount of tokenA expected from depositing liquidity.\n /// @return amountBMin Minimum amount of tokenB expected from depositing liquidity.\n function generateZapInParams(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 amountInA,\n uint256 amountInB,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\n\n /// @notice Used to generate params required for zapping out.\n /// Zap out => swap then add liquidity.\n /// Apply slippage to expected liquidity values to account for changes in reserves in between.\n /// @dev Output token refers to the token you want to zap out of.\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable .\n /// @param _factory .\n /// @param liquidity Amount of liquidity being zapped out of into a given output token.\n /// @param routesA Route used to convert tokenA into output token.\n /// @param routesB Route used to convert tokenB into output token.\n /// @return amountOutMinA Minimum output expected from swapping tokenA into output token.\n /// @return amountOutMinB Minimum output expected from swapping tokenB into output token.\n /// @return amountAMin Minimum amount of tokenA expected from withdrawing liquidity.\n /// @return amountBMin Minimum amount of tokenB expected from withdrawing liquidity.\n function generateZapOutParams(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 liquidity,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\n\n /// @notice Used by zapper to determine appropriate ratio of A to B to deposit liquidity. Assumes stable pool.\n /// @dev Returns stable liquidity ratio of B to (A + B).\n /// E.g. if ratio is 0.4, it means there is more of A than there is of B.\n /// Therefore you should deposit more of token A than B.\n /// @param tokenA tokenA of stable pool you are zapping into.\n /// @param tokenB tokenB of stable pool you are zapping into.\n /// @param factory Factory that created stable pool.\n /// @return ratio Ratio of token0 to token1 required to deposit into zap.\n function quoteStableLiquidityRatio(\n address tokenA,\n address tokenB,\n address factory\n ) external view returns (uint256 ratio);\n}\n" + }, + "contracts/external/aerodrome/IAerodromeSwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.10;\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via CL\ninterface ISwapRouter_Aerodrome {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n int24 tickSpacing;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n int24 tickSpacing;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/external/algebra/IAlgebraSwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IAlgebraPoolActions#swap\n/// @notice Any contract that calls IAlgebraPoolActions#swap must implement this interface\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\ninterface IAlgebraSwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a AlgebraPool deployed by the canonical AlgebraFactory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call\n function algebraSwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/algebra/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\nimport \"./IAlgebraSwapCallback.sol\";\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Algebra\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\n/// https://github.com/Uniswap/v3-periphery\ninterface IAlgebraSwapRouter is IAlgebraSwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 limitSqrtPrice;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 limitSqrtPrice;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @dev Unlike standard swaps, handles transferring from user before the actual swap.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingleSupportingFeeOnTransferTokens(ExactInputSingleParams calldata params)\n external\n returns (uint256 amountOut);\n}\n" + }, + "contracts/external/api3/IProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IProxy {\n function read() external view returns (int224 value, uint32 timestamp);\n\n function api3ServerV1() external view returns (address);\n}\n" + }, + "contracts/external/chainlink/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n // getRoundData and latestRoundData should both raise \"No data present\"\n // if they do not have data to report, instead of returning unset values\n // which could be misinterpreted as actual reported values.\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "contracts/external/compound/IComptroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./IPriceOracle.sol\";\nimport \"./ICToken.sol\";\nimport \"./IUnitroller.sol\";\nimport \"./IRewardsDistributor.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n */\ninterface IComptroller {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function oracle() external view returns (IPriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function getAssetsIn(address account) external view returns (ICToken[] memory);\n\n function checkMembership(address account, ICToken cToken) external view returns (bool);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n )\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n function getAccountLiquidity(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n function _setPriceOracle(IPriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICToken market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _become(IUnitroller unitroller) external;\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAllMarkets() external view returns (ICToken[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function suppliers(address account) external view returns (bool);\n\n function supplyCaps(address cToken) external view returns (uint256);\n\n function borrowCaps(address cToken) external view returns (uint256);\n\n function enforceWhitelist() external view returns (bool);\n\n function enterMarkets(address[] memory cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cTokenAddress) external returns (uint256);\n\n function autoImplementation() external view returns (bool);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _toggleAutoImplementations(bool enabled) external returns (uint256);\n\n function _deployMarket(\n bool isCEther,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getMaxRedeemOrBorrow(\n address account,\n ICToken cTokenModify,\n bool isBorrow\n ) external view returns (uint256);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function isDeprecated(ICToken cToken) external view returns (bool);\n\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n}\n" + }, + "contracts/external/compound/ICToken.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's CToken Contract\n * @notice Abstract base for CTokens\n * @author Compound\n */\ninterface ICToken {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function symbol() external view returns (string memory);\n\n function comptroller() external view returns (address);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function isCToken() external view returns (bool);\n\n function isCEther() external view returns (bool);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function borrowBalanceStored(address account) external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function exchangeRateCurrent() external returns (uint256);\n\n function exchangeRateStored() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n}\n" + }, + "contracts/external/compound/IPriceOracle.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./ICToken.sol\";\n\ninterface IPriceOracle {\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICToken cToken) external view returns (uint256);\n}\n" + }, + "contracts/external/compound/IRewardsDistributor.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./ICToken.sol\";\n\n/**\n * @title RewardsDistributor\n * @author Compound\n */\ninterface IRewardsDistributor {\n /// @dev The token to reward (i.e., COMP)\n function rewardToken() external view returns (address);\n\n /// @notice The portion of compRate that each market currently receives\n function compSupplySpeeds(address) external view returns (uint256);\n\n /// @notice The portion of compRate that each market currently receives\n function compBorrowSpeeds(address) external view returns (uint256);\n\n /// @notice The COMP accrued but not yet transferred to each user\n function compAccrued(address) external view returns (uint256);\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @dev Called by the Comptroller\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) external;\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @dev Called by the Comptroller\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\n\n /**\n * @notice Returns an array of all markets.\n */\n function getAllMarkets() external view returns (ICToken[] memory);\n}\n" + }, + "contracts/external/compound/IUnitroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\n/**\n * @title ComptrollerCore\n * @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.\n * CTokens should reference this contract as their comptroller.\n */\ninterface IUnitroller {\n function _setPendingImplementation(address newPendingImplementation) external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n}\n" + }, + "contracts/external/curve/ICurvePool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ICurvePool is IERC20Upgradeable {\n function get_virtual_price() external view returns (uint256);\n\n function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 min_amount) external;\n\n function calc_withdraw_one_coin(uint256 _burn_amount, int128 i) external view returns (uint256);\n\n function add_liquidity(uint256[2] calldata _amounts, uint256 _min_mint_amount) external returns (uint256);\n\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);\n\n function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256);\n\n function coins(uint256 index) external view returns (address);\n\n function lp_token() external view returns (address);\n}\n" + }, + "contracts/external/curve/ICurveV2Pool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICurvePool } from \"./ICurvePool.sol\";\n\ninterface ICurveV2Pool is ICurvePool {\n function price_oracle() external view returns (uint256);\n\n function lp_price() external view returns (uint256);\n\n function coins(uint256 arg0) external view returns (address);\n}\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\ninterface IHypernativeOracle {\n function register(address account, bool isStrictMode) external;\n function validateForbiddenAccountInteraction(address sender) external view;\n function validateForbiddenContextInteraction(address origin, address sender) external view;\n function validateBlacklistedAccountInteraction(address sender) external;\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelay {\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\n // This will return true if and only if it's being called while executing the auction winner(s) call.\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\n // @param permissionId The id that represents the action being gated\n // @return permissioned True if the permission is allowed, false otherwise\n function isPermissioned(\n address protocolFeeReceiver,\n bytes calldata permissionId\n ) external view returns (bool permissioned);\n}\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelayFeeReceiver {\n // Receive the proceeds of an auction.\n // @param permissionKey The permission key where the auction was conducted on.\n function receiveAuctionProceedings(\n bytes calldata permissionKey\n ) external payable;\n}\n" + }, + "contracts/external/redstone/IRedstoneOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IRedstoneOracle {\n function priceOf(address asset) external view returns (uint256);\n\n function priceOfETH() external view returns (uint256);\n\n function getDataFeedIdForAsset(address asset) external view returns (bytes32);\n\n function getDataFeedIds() external view returns (bytes32[] memory dataFeedIds);\n}\n" + }, + "contracts/external/uniswap/FullMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// From Uniswap3 Core\n\n// Updated to Solidity 0.8 by Midas Capital:\n// * Rewrite unary negation of denominator, which is a uint\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\n\npragma solidity ^0.8.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = denominator & (~denominator + 1);\n\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" + }, + "contracts/external/uniswap/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface ISwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n function exactInput(ExactInputParams calldata params) external returns (uint256 amountOut);\n\n function exactOutputSingle(ExactOutputSingleParams calldata params) external returns (uint256 amountIn);\n\n function exactOutput(ExactOutputParams calldata params) external returns (uint256 amountIn);\n\n function factory() external returns (address);\n\n function multicall(uint256 deadline, bytes[] calldata data) external payable returns (bytes[] memory);\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Callee.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Callee {\n function uniswapV2Call(\n address sender,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Pair.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (\n uint112 reserve0,\n uint112 reserve1,\n uint32 blockTimestampLast\n );\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Router01.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n )\n external\n returns (\n uint256 amountA,\n uint256 amountB,\n uint256 liquidity\n );\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function swapTokensForExactETH(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapETHForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) external pure returns (uint256 amountB);\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountIn);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Router02.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV2Router01.sol\";\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV3PoolActions.sol\";\n\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function fee() external view returns (uint24);\n\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n function liquidity() external view returns (uint128);\n\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\n\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 liquidityCumulative,\n bool initialized\n );\n\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolImmutables.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" + }, + "contracts/external/uniswap/IUniswapV3SwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IV3SwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport './IUniswapV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IV3SwapRouter is IUniswapV3SwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// that may remain in the router after the swap.\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// that may remain in the router after the swap.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IQuoter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.8.0 <0.9.0;\n\ninterface IQuoter {\n function estimateMaxSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) external view returns (uint256);\n\n function estimateMinSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) external view returns (uint256);\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\n/// @title Quoter Interface\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\ninterface IUniswapV3Quoter {\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee\n /// @param amountIn The amount of the first token to swap\n /// @return amountOut The amount of the last token that would be received\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\n\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountIn The desired input amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountOut The amount of `tokenOut` that would be received\n function quoteExactInputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountIn,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountOut);\n\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\n /// @param amountOut The amount of the last token to receive\n /// @return amountIn The amount of first token required to be paid\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\n\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountOut The desired output amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\n function quoteExactOutputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountOut,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountIn);\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/BitMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title BitMath\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\nlibrary BitMath {\n /// @notice Returns the index of the most significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\n /// @param x the value for which to compute the most significant bit, must be greater than 0\n /// @return r the index of the most significant bit\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n if (x >= 0x100000000000000000000000000000000) {\n x >>= 128;\n r += 128;\n }\n if (x >= 0x10000000000000000) {\n x >>= 64;\n r += 64;\n }\n if (x >= 0x100000000) {\n x >>= 32;\n r += 32;\n }\n if (x >= 0x10000) {\n x >>= 16;\n r += 16;\n }\n if (x >= 0x100) {\n x >>= 8;\n r += 8;\n }\n if (x >= 0x10) {\n x >>= 4;\n r += 4;\n }\n if (x >= 0x4) {\n x >>= 2;\n r += 2;\n }\n if (x >= 0x2) r += 1;\n }\n\n /// @notice Returns the index of the least significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\n /// @param x the value for which to compute the least significant bit, must be greater than 0\n /// @return r the index of the least significant bit\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n r = 255;\n if (x & type(uint128).max > 0) {\n r -= 128;\n } else {\n x >>= 128;\n }\n if (x & type(uint64).max > 0) {\n r -= 64;\n } else {\n x >>= 64;\n }\n if (x & type(uint32).max > 0) {\n r -= 32;\n } else {\n x >>= 32;\n }\n if (x & type(uint16).max > 0) {\n r -= 16;\n } else {\n x >>= 16;\n }\n if (x & type(uint8).max > 0) {\n r -= 8;\n } else {\n x >>= 8;\n }\n if (x & 0xf > 0) {\n r -= 4;\n } else {\n x >>= 4;\n }\n if (x & 0x3 > 0) {\n r -= 2;\n } else {\n x >>= 2;\n }\n if (x & 0x1 > 0) r -= 1;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/FixedPoint96.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000; // 2^96\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/LiquidityMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Math library for liquidity\nlibrary LiquidityMath {\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\n /// @param x The liquidity before change\n /// @param y The delta by which liquidity should be changed\n /// @return z The liquidity delta\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\n if (y < 0) {\n require((z = x - uint128(-y)) < x, \"LS\");\n } else {\n require((z = x + uint128(y)) >= x, \"LA\");\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/LowGasSafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.0;\n\n/// @title Optimized overflow and underflow safe math operations\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\nlibrary LowGasSafeMath {\n /// @notice Returns x + y, reverts if sum overflows uint256\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x);\n }\n\n /// @notice Returns x - y, reverts if underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x);\n }\n\n /// @notice Returns x * y, reverts if overflows\n /// @param x The multiplicand\n /// @param y The multiplier\n /// @return z The product of x and y\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(x == 0 || (z = x * y) / x == y);\n }\n\n /// @notice Returns x + y, reverts if overflows or underflows\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x + y) >= x == (y >= 0));\n }\n\n /// @notice Returns x - y, reverts if overflows or underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x - y) <= x == (y >= 0));\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SqrtPriceMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./LowGasSafeMath.sol\";\nimport \"./SafeCast.sol\";\n\nimport \"../../FullMath.sol\";\nimport \"./UnsafeMath.sol\";\nimport \"./FixedPoint96.sol\";\nimport \"./BitMath.sol\";\n\n/// @title Functions based on Q64.96 sqrt price and liquidity\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\nlibrary SqrtPriceMath {\n using LowGasSafeMath for uint256;\n using SafeCast for uint256;\n\n /// @notice Gets the next sqrt price given a delta of token0\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\n /// price less in order to not send too much output.\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token0 to add or remove from virtual reserves\n /// @param add Whether to add or remove the amount of token0\n /// @return The price after adding or removing amount, depending on add\n function getNextSqrtPriceFromAmount0RoundingUp(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\n if (amount == 0) return sqrtPX96;\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n\n bool overflow = false;\n if (numerator1 != 0 && sqrtPX96 != 0)\n overflow = uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(sqrtPX96)) >= 254;\n\n if (add) {\n uint256 product;\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\n uint256 denominator = numerator1 + product;\n if (denominator >= numerator1) {\n // always fits in 160 bits\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\n }\n }\n\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\n } else {\n uint256 product;\n // if the product overflows, we know the denominator underflows\n // in addition, we must check that the denominator does not underflow\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\n uint256 denominator = numerator1 - product;\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\n }\n }\n\n /// @notice Gets the next sqrt price given a delta of token1\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\n /// price less in order to not send too much output.\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token1 to add, or remove, from virtual reserves\n /// @param add Whether to add, or remove, the amount of token1\n /// @return The price after adding or removing `amount`\n function getNextSqrtPriceFromAmount1RoundingDown(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\n // in both cases, avoid a mulDiv for most inputs\n if (add) {\n uint256 quotient = (\n amount <= type(uint160).max\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\n );\n\n return uint256(sqrtPX96).add(quotient).toUint160();\n } else {\n uint256 quotient = (\n amount <= type(uint160).max\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\n );\n\n require(sqrtPX96 > quotient);\n // always fits 160 bits\n return uint160(sqrtPX96 - quotient);\n }\n }\n\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountIn How much of token0, or token1, is being swapped in\n /// @param zeroForOne Whether the amount in is token0 or token1\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\n function getNextSqrtPriceFromInput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountIn,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we don't pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\n }\n\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\n /// @param sqrtPX96 The starting price before accounting for the output amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountOut How much of token0, or token1, is being swapped out\n /// @param zeroForOne Whether the amount out is token0 or token1\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\n function getNextSqrtPriceFromOutput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountOut,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\n }\n\n /// @notice Gets the amount0 delta between two prices\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up or down\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\n require(sqrtRatioAX96 > 0);\n\n bool overflow = false;\n if (numerator1 != 0 && numerator2 != 0)\n overflow =\n uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(numerator2)) >= 254;\n\n if (overflow) {\n return\n roundUp\n ? FullMath.mulDivRoundingUp(\n FullMath.mulDivRoundingUp(uint256(liquidity), numerator2, sqrtRatioBX96),\n FixedPoint96.Q96,\n sqrtRatioAX96\n )\n : FullMath.mulDiv(\n FullMath.mulDiv(uint256(liquidity), numerator2, sqrtRatioBX96),\n FixedPoint96.Q96,\n sqrtRatioAX96\n );\n } else {\n return\n roundUp\n ? UnsafeMath.divRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), sqrtRatioAX96)\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\n }\n }\n\n /// @notice Gets the amount1 delta between two prices\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up, or down\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n roundUp\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n /// @notice Helper that gets signed token0 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount0) {\n return\n liquidity < 0\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n\n /// @notice Helper that gets signed token1 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount1) {\n return\n liquidity < 0\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SwapMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"../../FullMath.sol\";\nimport \"./SqrtPriceMath.sol\";\n\n/// @title Computes the result of a swap within ticks\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\nlibrary SwapMath {\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\n /// @param liquidity The usable liquidity\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\n /// @return feeAmount The amount of input that will be taken as a fee\n function computeSwapStep(\n uint160 sqrtRatioCurrentX96,\n uint160 sqrtRatioTargetX96,\n uint128 liquidity,\n int256 amountRemaining,\n uint24 feePips,\n bool zeroForOne\n )\n internal\n pure\n returns (\n uint160 sqrtRatioNextX96,\n uint256 amountIn,\n uint256 amountOut,\n uint256 feeAmount\n )\n {\n require(zeroForOne == sqrtRatioCurrentX96 >= sqrtRatioTargetX96, \"SPD\");\n bool exactIn = amountRemaining >= 0;\n\n if (exactIn) {\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\n amountIn = zeroForOne\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\n sqrtRatioCurrentX96,\n liquidity,\n amountRemainingLessFee,\n zeroForOne\n );\n } else {\n amountOut = zeroForOne\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\n\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\n sqrtRatioCurrentX96,\n liquidity,\n uint256(-amountRemaining),\n zeroForOne\n );\n }\n\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\n\n // get the input/output amounts\n if (zeroForOne) {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\n } else {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\n }\n\n // cap the output amount to not exceed the remaining output amount\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\n amountOut = uint256(-amountRemaining);\n }\n\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\n // we didn't reach the target, so take the remainder of the maximum input as fee\n feeAmount = uint256(amountRemaining) - amountIn;\n } else {\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/Tick.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./LowGasSafeMath.sol\";\nimport \"./SafeCast.sol\";\n\nimport \"../../TickMath.sol\";\nimport \"./LiquidityMath.sol\";\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\n\n/// Ithil to modify it, since it does not have access to storage arrays\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// Ithil: only use it with lower = self[tickLower] and upper = self[tickUpper]\n /// @param lower The info of the lower tick boundary of the position\n /// @param upper The info of the upper tick boundary of the position\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n Tick.Info memory lower,\n Tick.Info memory upper,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal pure returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// Ithil: always use with info = self[tick]\n /// @param info The info tick that will be updated\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n Tick.Info memory info,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal pure returns (bool flipped) {\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, \"LO\");\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param info The result of the mapping containing all tick information for initialized ticks\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n Tick.Info memory info,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal pure returns (int128 liquidityNet) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/TickBitmap.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./BitMath.sol\";\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n /// @dev simply divides @param tick by 256 with remainder: tick = wordPos * 256 + bitPos\n function position(int24 tick) internal pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(int8(tick % 256));\n }\n\n /// Written by Ithil\n function computeWordPos(\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal pure returns (int16 wordPos) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n (wordPos, ) = lte ? position(compressed) : position(compressed + 1);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param selfResult The result of the mapping in which to flip the tick (Ithil modified)\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n uint256 selfResult,\n int24 tick,\n int24 tickSpacing\n ) internal pure {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n selfResult ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param selfResult The result of the mapping in which to compute the next initialized tick (Ithil modified)\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n uint256 selfResult,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal pure returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = selfResult & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(uint24(bitPos) - uint24(BitMath.mostSignificantBit(masked)))) * tickSpacing\n : (compressed - int24(uint24(bitPos))) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = selfResult & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(uint24(BitMath.leastSignificantBit(masked) - bitPos))) * tickSpacing\n : (compressed + 1 + int24(uint24(type(uint8).max - bitPos))) * tickSpacing;\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/UnsafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Math functions that do not check inputs or outputs\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\nlibrary UnsafeMath {\n /// @notice Returns ceil(x / y)\n /// @dev division by 0 has unspecified behavior, and must be checked externally\n /// @param x The dividend\n /// @param y The divisor\n /// @return z The quotient, ceil(x / y)\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n z := add(div(x, y), gt(mod(x, y), 0))\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\npragma experimental ABIEncoderV2;\n\nimport \"../IUniswapV3Factory.sol\";\nimport \"./interfaces/IQuoter.sol\";\nimport \"./UniswapV3Quoter.sol\";\n\ncontract Quoter is IQuoter, UniswapV3Quoter {\n IUniswapV3Factory internal uniV3Factory; // TODO should it be immutable?\n\n constructor(address _uniV3Factory) {\n uniV3Factory = IUniswapV3Factory(_uniV3Factory);\n }\n\n // This should be equal to quoteExactInputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\n // todo: add price limit\n function estimateMaxSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) public view override returns (uint256) {\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\n\n return _estimateOutputSingle(_toToken, _fromToken, _amount, pool);\n }\n\n // This should be equal to quoteExactOutputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\n // todo: add price limit\n function estimateMinSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) public view override returns (uint256) {\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\n\n return _estimateInputSingle(_fromToken, _toToken, _amount, pool);\n }\n\n // todo: add price limit\n function _estimateOutputSingle(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n address _pool\n ) internal view returns (uint256 amountOut) {\n bool zeroForOne = _fromToken > _toToken;\n // todo: price limit?\n (int256 amount0, int256 amount1) = quoteSwap(\n _pool,\n int256(_amount),\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\n zeroForOne\n );\n if (zeroForOne) amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\n else amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\n }\n\n // todo: add price limit\n function _estimateInputSingle(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n address _pool\n ) internal view returns (uint256 amountOut) {\n bool zeroForOne = _fromToken < _toToken;\n // todo: price limit?\n (int256 amount0, int256 amount1) = quoteSwap(\n _pool,\n -int256(_amount),\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\n zeroForOne\n );\n if (zeroForOne) amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\n else amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\n }\n\n function doesPoolExist(address _token0, address _token1) external view returns (bool) {\n // try 0.05%\n address pool = uniV3Factory.getPool(_token0, _token1, 500);\n if (pool != address(0)) return true;\n\n // try 0.3%\n pool = uniV3Factory.getPool(_token0, _token1, 3000);\n if (pool != address(0)) return true;\n\n // try 1%\n pool = uniV3Factory.getPool(_token0, _token1, 10000);\n if (pool != address(0)) return true;\n else return false;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/UniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.6;\n\nimport \"./libraries/LowGasSafeMath.sol\";\nimport \"./libraries/SafeCast.sol\";\nimport \"./libraries/Tick.sol\";\nimport \"./libraries/TickBitmap.sol\";\n\nimport \"../FullMath.sol\";\nimport \"../TickMath.sol\";\nimport \"./libraries/LiquidityMath.sol\";\nimport \"./libraries/SqrtPriceMath.sol\";\nimport \"./libraries/SwapMath.sol\";\n\nimport \"./interfaces/IUniswapV3Quoter.sol\";\nimport \"../IUniswapV3Pool.sol\";\nimport \"../IUniswapV3PoolImmutables.sol\";\n\ncontract UniswapV3Quoter {\n using LowGasSafeMath for int256;\n using SafeCast for uint256;\n using Tick for mapping(int24 => Tick.Info);\n\n struct PoolState {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the tick spacing\n int24 tickSpacing;\n // the pool's fee\n uint24 fee;\n // the pool's liquidity\n uint128 liquidity;\n // whether the pool is locked\n bool unlocked;\n }\n\n // accumulated protocol fees in token0/token1 units\n struct ProtocolFees {\n uint128 token0;\n uint128 token1;\n }\n\n // the top level state of the swap, the results of which are recorded in storage at the end\n struct SwapState {\n // the amount remaining to be swapped in/out of the input/output asset\n int256 amountSpecifiedRemaining;\n // the amount already swapped out/in of the output/input asset\n int256 amountCalculated;\n // current sqrt(price)\n uint160 sqrtPriceX96;\n // the tick associated with the current price\n int24 tick;\n // the current liquidity in range\n uint128 liquidity;\n }\n\n struct StepComputations {\n // the price at the beginning of the step\n uint160 sqrtPriceStartX96;\n // the next tick to swap to from the current tick in the swap direction\n int24 tickNext;\n // whether tickNext is initialized or not\n bool initialized;\n // sqrt(price) for the next tick (1/0)\n uint160 sqrtPriceNextX96;\n // how much is being swapped in in this step\n uint256 amountIn;\n // how much is being swapped out\n uint256 amountOut;\n // how much fee is being paid in\n uint256 feeAmount;\n }\n\n struct InitialState {\n address poolAddress;\n PoolState poolState;\n uint256 feeGrowthGlobal0X128;\n uint256 feeGrowthGlobal1X128;\n }\n\n struct NextTickPassage {\n int24 tick;\n int24 tickSpacing;\n }\n\n function fetchState(address _pool) internal view returns (PoolState memory poolState) {\n IUniswapV3Pool pool = IUniswapV3Pool(_pool);\n (uint160 sqrtPriceX96, int24 tick, , , , , bool unlocked) = pool.slot0(); // external call\n uint128 liquidity = pool.liquidity(); // external call\n int24 tickSpacing = IUniswapV3PoolImmutables(_pool).tickSpacing(); // external call\n uint24 fee = IUniswapV3PoolImmutables(_pool).fee(); // external call\n poolState = PoolState(sqrtPriceX96, tick, tickSpacing, fee, liquidity, unlocked);\n }\n\n function setInitialState(\n PoolState memory initialPoolState,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne\n )\n internal\n pure\n returns (\n SwapState memory state,\n uint128 liquidity,\n uint160 sqrtPriceX96\n )\n {\n liquidity = initialPoolState.liquidity;\n\n sqrtPriceX96 = initialPoolState.sqrtPriceX96;\n\n require(\n zeroForOne\n ? sqrtPriceLimitX96 < initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\n : sqrtPriceLimitX96 > initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\n \"SPL\"\n );\n\n state = SwapState({\n amountSpecifiedRemaining: amountSpecified,\n amountCalculated: 0,\n sqrtPriceX96: initialPoolState.sqrtPriceX96,\n tick: initialPoolState.tick,\n liquidity: 0 // to be modified after initialization\n });\n }\n\n function getNextTickAndPrice(\n int24 tickSpacing,\n int24 currentTick,\n IUniswapV3Pool pool,\n bool zeroForOne\n )\n internal\n view\n returns (\n int24 tickNext,\n bool initialized,\n uint160 sqrtPriceNextX96\n )\n {\n int24 compressed = currentTick / tickSpacing;\n if (!zeroForOne) compressed++;\n if (currentTick < 0 && currentTick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n uint256 selfResult = pool.tickBitmap(int16(compressed >> 8)); // external call\n\n (tickNext, initialized) = TickBitmap.nextInitializedTickWithinOneWord(\n selfResult,\n currentTick,\n tickSpacing,\n zeroForOne\n );\n\n if (tickNext < TickMath.MIN_TICK) {\n tickNext = TickMath.MIN_TICK;\n } else if (tickNext > TickMath.MAX_TICK) {\n tickNext = TickMath.MAX_TICK;\n }\n sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(tickNext);\n }\n\n function processSwapWithinTick(\n IUniswapV3Pool pool,\n PoolState memory initialPoolState,\n SwapState memory state,\n uint160 firstSqrtPriceX96,\n uint128 firstLiquidity,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne,\n bool exactAmount\n )\n internal\n view\n returns (\n uint160 sqrtPriceNextX96,\n uint160 finalSqrtPriceX96,\n uint128 finalLiquidity\n )\n {\n StepComputations memory step;\n\n step.sqrtPriceStartX96 = firstSqrtPriceX96;\n\n (step.tickNext, step.initialized, sqrtPriceNextX96) = getNextTickAndPrice(\n initialPoolState.tickSpacing,\n state.tick,\n pool,\n zeroForOne\n );\n\n (finalSqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\n firstSqrtPriceX96,\n (zeroForOne ? sqrtPriceNextX96 < sqrtPriceLimitX96 : sqrtPriceNextX96 > sqrtPriceLimitX96)\n ? sqrtPriceLimitX96\n : sqrtPriceNextX96,\n firstLiquidity,\n state.amountSpecifiedRemaining,\n initialPoolState.fee,\n zeroForOne\n );\n\n if (exactAmount) {\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\n } else {\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\n }\n\n if (finalSqrtPriceX96 == sqrtPriceNextX96) {\n if (step.initialized) {\n (, int128 liquidityNet, , , , , , ) = pool.ticks(step.tickNext);\n if (zeroForOne) liquidityNet = -liquidityNet;\n finalLiquidity = LiquidityMath.addDelta(firstLiquidity, liquidityNet);\n }\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\n } else if (finalSqrtPriceX96 != step.sqrtPriceStartX96) {\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\n state.tick = TickMath.getTickAtSqrtRatio(finalSqrtPriceX96);\n }\n }\n\n function returnedAmount(\n SwapState memory state,\n int256 amountSpecified,\n bool zeroForOne\n ) internal pure returns (int256 amount0, int256 amount1) {\n if (amountSpecified > 0) {\n (amount0, amount1) = zeroForOne\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\n } else {\n (amount0, amount1) = zeroForOne\n ? (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining)\n : (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated);\n }\n }\n\n function quoteSwap(\n address poolAddress,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne\n ) internal view returns (int256 amount0, int256 amount1) {\n bool exactAmount = amountSpecified > 0;\n\n PoolState memory initialPoolState = fetchState(poolAddress);\n uint160 sqrtPriceNextX96;\n\n (SwapState memory state, uint128 liquidity, uint160 sqrtPriceX96) = setInitialState(\n initialPoolState,\n amountSpecified,\n sqrtPriceLimitX96,\n zeroForOne\n );\n\n while (state.amountSpecifiedRemaining != 0 && sqrtPriceX96 != sqrtPriceLimitX96)\n (sqrtPriceNextX96, sqrtPriceX96, liquidity) = processSwapWithinTick(\n IUniswapV3Pool(poolAddress),\n initialPoolState,\n state,\n sqrtPriceX96,\n liquidity,\n sqrtPriceLimitX96,\n zeroForOne,\n exactAmount\n );\n\n (amount0, amount1) = returnedAmount(state, amountSpecified, zeroForOne);\n }\n}\n" + }, + "contracts/external/uniswap/TickMath.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\n// From Uniswap3 Core\n\n// Updated to Solidity 0.8 by Midas Capital:\n// * Cast MAX_TICK to int256 before casting to uint\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\n\npragma solidity ^0.8.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n unchecked {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), \"T\");\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n unchecked {\n // second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, \"R\");\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n }\n}\n" + }, + "contracts/external/uniswap/UniswapV2Library.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV2Pair.sol\";\nimport \"./IUniswapV2Factory.sol\";\n\nlibrary UniswapV2Library {\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n require(tokenA != tokenB, \"UniswapV2Library: IDENTICAL_ADDRESSES\");\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), \"UniswapV2Library: ZERO_ADDRESS\");\n }\n\n function pairFor(\n address factory,\n address tokenA,\n address tokenB\n ) internal view returns (address pair) {\n return IUniswapV2Factory(factory).getPair(tokenA, tokenB);\n }\n\n // fetches and sorts the reserves for a pair\n function getReserves(\n address factory,\n address tokenA,\n address tokenB\n ) internal view returns (uint256 reserveA, uint256 reserveB) {\n (address token0, ) = sortTokens(tokenA, tokenB);\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n }\n\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) internal pure returns (uint256 amountB) {\n require(amountA > 0, \"UniswapV2Library: INSUFFICIENT_AMOUNT\");\n require(reserveA > 0 && reserveB > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n amountB = (amountA * reserveB) / reserveA;\n }\n\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut,\n uint8 flashSwapFee\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * (10000 - flashSwapFee);\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = reserveIn * 10000 + amountInWithFee;\n amountOut = numerator / denominator;\n }\n\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut,\n uint8 flashSwapFee\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * 10000;\n uint256 denominator = (reserveOut - amountOut) * (10000 - flashSwapFee);\n amountIn = numerator / denominator + 1;\n }\n\n // performs chained getAmountOut calculations on any number of pairs\n function getAmountsOut(\n address factory,\n uint256 amountIn,\n address[] memory path,\n uint8 flashSwapFee\n ) internal view returns (uint256[] memory amounts) {\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n amounts = new uint256[](path.length);\n amounts[0] = amountIn;\n for (uint256 i; i < path.length - 1; i++) {\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i], path[i + 1]);\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut, flashSwapFee);\n }\n }\n\n // performs chained getAmountIn calculations on any number of pairs\n function getAmountsIn(\n address factory,\n uint256 amountOut,\n address[] memory path,\n uint8 flashSwapFee\n ) internal view returns (uint256[] memory amounts) {\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n amounts = new uint256[](path.length);\n amounts[amounts.length - 1] = amountOut;\n for (uint256 i = path.length - 1; i > 0; i--) {\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i - 1], path[i]);\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut, flashSwapFee);\n }\n }\n}\n" + }, + "contracts/external/velodrome/IVelodromeRouter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IRouter_Velodrome {\n struct Route {\n address from;\n address to;\n bool stable;\n }\n\n error ETHTransferFailed();\n error Expired();\n error InsufficientAmount();\n error InsufficientAmountA();\n error InsufficientAmountB();\n error InsufficientAmountADesired();\n error InsufficientAmountBDesired();\n error InsufficientLiquidity();\n error InsufficientOutputAmount();\n error InvalidPath();\n error OnlyWETH();\n error SameAddresses();\n error ZeroAddress();\n\n /// @notice Address of Velodrome v2 pool factory\n function factory() external view returns (address);\n\n /// @notice Address of Velodrome v2 pool implementation\n function poolImplementation() external view returns (address);\n\n /// @notice Sort two tokens by which address value is less than the other\n /// @param tokenA Address of token to sort\n /// @param tokenB Address of token to sort\n /// @return token0 Lower address value between tokenA and tokenB\n /// @return token1 Higher address value between tokenA and tokenB\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\n\n /// @notice Calculate the address of a pool by its' factory.\n /// @dev Returns a randomly generated address for a nonexistent pool\n /// @param tokenA Address of token to query\n /// @param tokenB Address of token to query\n /// @param stable True if pool is stable, false if volatile\n function poolFor(address tokenA, address tokenB, bool stable) external view returns (address pool);\n\n /// @notice Fetch and sort the reserves for a pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @return reserveA Amount of reserves of the sorted token A\n /// @return reserveB Amount of reserves of the sorted token B\n function getReserves(\n address tokenA,\n address tokenB,\n bool stable\n ) external view returns (uint256 reserveA, uint256 reserveB);\n\n /// @notice Perform chained getAmountOut calculations on any number of pools\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\n\n // **** ADD LIQUIDITY ****\n\n /// @notice Quote the amount deposited into a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function quoteAddLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Quote the amount of liquidity removed from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function quoteRemoveLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity\n ) external view returns (uint256 amountA, uint256 amountB);\n\n /// @notice Add liquidity of two tokens to a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @param amountAMin Minimum amount of tokenA to deposit\n /// @param amountBMin Minimum amount of tokenB to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountTokenDesired Amount of token desired to deposit\n /// @param amountTokenMin Minimum amount of token to deposit\n /// @param amountETHMin Minimum amount of ETH to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to add liquidity\n /// @return amountToken Amount of token to actually deposit\n /// @return amountETH Amount of tokenETH to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidityETH(\n address token,\n bool stable,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n // **** REMOVE LIQUIDITY ****\n\n /// @notice Remove liquidity of two tokens from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountAMin Minimum amount of tokenA to receive\n /// @param amountBMin Minimum amount of tokenB to receive\n /// @param to Recipient of tokens received\n /// @param deadline Deadline to remove liquidity\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function removeLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountToken Amount of token received\n /// @return amountETH Amount of ETH received\n function removeLiquidityETH(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountETH Amount of ETH received\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n /// @notice Swap one token for another\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap ETH for a token\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactETHForTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n /// @notice Swap a token for WETH (returned as ETH)\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n" + }, + "contracts/FeeDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { CErc20Delegator } from \"./compound/CErc20Delegator.sol\";\nimport { CErc20PluginDelegate } from \"./compound/CErc20PluginDelegate.sol\";\nimport { SafeOwnableUpgradeable } from \"./ionic/SafeOwnableUpgradeable.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { DiamondExtension, DiamondBase } from \"./ionic/DiamondExtension.sol\";\nimport { AuthoritiesRegistry } from \"./ionic/AuthoritiesRegistry.sol\";\n\ncontract FeeDistributorStorage {\n struct CDelegateUpgradeData {\n address implementation;\n bytes becomeImplementationData;\n }\n\n /**\n * @notice Maps Unitroller (Comptroller proxy) addresses to the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n * @dev A value of 0 means unset whereas a negative value means 0.\n */\n mapping(address => int256) public customInterestFeeRates;\n\n /**\n * @dev Latest Comptroller implementation for each existing implementation.\n */\n mapping(address => address) internal _latestComptrollerImplementation;\n\n /**\n * @dev Latest CErc20Delegate implementation for each existing implementation.\n */\n mapping(uint8 => CDelegateUpgradeData) internal _latestCErc20Delegate;\n\n /**\n * @dev Latest Plugin implementation for each existing implementation.\n */\n mapping(address => address) internal _latestPluginImplementation;\n\n mapping(address => DiamondExtension[]) public comptrollerExtensions;\n\n mapping(address => DiamondExtension[]) public cErc20DelegateExtensions;\n\n AuthoritiesRegistry public authoritiesRegistry;\n\n /**\n * @dev used as salt for the creation of new markets\n */\n uint256 public marketsCounter;\n\n /**\n * @dev Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\n */\n uint256 public minBorrowEth;\n\n /**\n * @dev Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\n * No longer used as of `Rari-Capital/compound-protocol` version `fuse-v1.1.0`.\n */\n uint256 public maxUtilizationRate;\n\n /**\n * @notice The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n uint256 public defaultInterestFeeRate;\n}\n\n/**\n * @title FeeDistributor\n * @author David Lucid (https://github.com/davidlucid)\n * @notice FeeDistributor controls and receives protocol fees from Ionic pools and relays admin actions to Ionic pools.\n */\ncontract FeeDistributor is SafeOwnableUpgradeable, FeeDistributorStorage {\n using AddressUpgradeable for address;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @dev Initializer that sets initial values of state variables.\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function initialize(uint256 _defaultInterestFeeRate) public initializer {\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n __SafeOwnable_init(msg.sender);\n defaultInterestFeeRate = _defaultInterestFeeRate;\n maxUtilizationRate = type(uint256).max;\n }\n\n function reinitialize(AuthoritiesRegistry _ar) public onlyOwnerOrAdmin {\n authoritiesRegistry = _ar;\n }\n\n /**\n * @dev Sets the default proportion of Ionic pool interest taken as a protocol fee.\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function _setDefaultInterestFeeRate(uint256 _defaultInterestFeeRate) external onlyOwner {\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n defaultInterestFeeRate = _defaultInterestFeeRate;\n }\n\n /**\n * @dev Withdraws accrued fees on interest.\n * @param erc20Contract The ERC20 token address to withdraw. Set to the zero address to withdraw ETH.\n */\n function _withdrawAssets(address erc20Contract) external {\n if (erc20Contract == address(0)) {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No balance available to withdraw.\");\n (bool success, ) = owner().call{ value: balance }(\"\");\n require(success, \"Failed to transfer ETH balance to msg.sender.\");\n } else {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 balance = token.balanceOf(address(this));\n require(balance > 0, \"No token balance available to withdraw.\");\n token.safeTransfer(owner(), balance);\n }\n }\n\n /**\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\n * @param _minBorrowEth Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\n * @param _maxUtilizationRate Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\n */\n function _setPoolLimits(uint256 _minBorrowEth, uint256 _maxUtilizationRate) external onlyOwner {\n minBorrowEth = _minBorrowEth;\n maxUtilizationRate = _maxUtilizationRate;\n }\n\n function getMinBorrowEth(ICErc20 _ctoken) public view returns (uint256) {\n (, , uint256 borrowBalance, ) = _ctoken.getAccountSnapshot(_msgSender());\n if (borrowBalance == 0) return minBorrowEth;\n IonicComptroller comptroller = IonicComptroller(address(_ctoken.comptroller()));\n BasePriceOracle oracle = comptroller.oracle();\n uint256 underlyingPriceEth = oracle.price(ICErc20(address(_ctoken)).underlying());\n uint256 underlyingDecimals = _ctoken.decimals();\n uint256 borrowBalanceEth = (underlyingPriceEth * borrowBalance) / 10 ** underlyingDecimals;\n if (borrowBalanceEth > minBorrowEth) {\n return 0;\n }\n return minBorrowEth - borrowBalanceEth;\n }\n\n /**\n * @dev Receives native fees.\n */\n receive() external payable {}\n\n /**\n * @dev Sends data to a contract.\n * @param targets The contracts to which `data` will be sent.\n * @param data The data to be sent to each of `targets`.\n */\n function _callPool(address[] calldata targets, bytes[] calldata data) external onlyOwner {\n require(targets.length > 0 && targets.length == data.length, \"Array lengths must be equal and greater than 0.\");\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data[i]);\n }\n\n /**\n * @dev Sends data to a contract.\n * @param targets The contracts to which `data` will be sent.\n * @param data The data to be sent to each of `targets`.\n */\n function _callPool(address[] calldata targets, bytes calldata data) external onlyOwner {\n require(targets.length > 0, \"No target addresses specified.\");\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data);\n }\n\n /**\n * @dev Deploys a CToken for an underlying ERC20\n * @param constructorData Encoded construction data for `CToken initialize()`\n */\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address) {\n // Make sure comptroller == msg.sender\n (address underlying, address comptroller) = abi.decode(constructorData[0:64], (address, address));\n require(comptroller == msg.sender, \"Comptroller is not sender.\");\n\n // Deploy CErc20Delegator using msg.sender, underlying, and block.number as a salt\n bytes32 salt = keccak256(abi.encodePacked(msg.sender, underlying, ++marketsCounter));\n\n bytes memory cErc20DelegatorCreationCode = abi.encodePacked(type(CErc20Delegator).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(0, salt, cErc20DelegatorCreationCode);\n\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\n DiamondExtension delegateAsExtension = DiamondExtension(data.implementation);\n // register the first extension\n DiamondBase(proxy)._registerExtension(delegateAsExtension, DiamondExtension(address(0)));\n // derive and configure the other extensions\n DiamondExtension[] memory ctokenExts = cErc20DelegateExtensions[address(delegateAsExtension)];\n for (uint256 i = 0; i < ctokenExts.length; i++) {\n if (ctokenExts[i] == delegateAsExtension) continue;\n DiamondBase(proxy)._registerExtension(ctokenExts[i], DiamondExtension(address(0)));\n }\n CErc20PluginDelegate(address(proxy))._becomeImplementation(becomeImplData);\n\n return proxy;\n }\n\n /**\n * @dev Latest Comptroller implementation for each existing implementation.\n */\n function latestComptrollerImplementation(address oldImplementation) external view returns (address) {\n return\n _latestComptrollerImplementation[oldImplementation] != address(0)\n ? _latestComptrollerImplementation[oldImplementation]\n : oldImplementation;\n }\n\n /**\n * @dev Sets the latest `Comptroller` upgrade implementation address.\n * @param oldImplementation The old `Comptroller` implementation address to upgrade from.\n * @param newImplementation Latest `Comptroller` implementation address.\n */\n function _setLatestComptrollerImplementation(\n address oldImplementation,\n address newImplementation\n ) external onlyOwner {\n _latestComptrollerImplementation[oldImplementation] = newImplementation;\n }\n\n /**\n * @dev Latest CErc20Delegate implementation for each existing implementation.\n */\n function latestCErc20Delegate(uint8 delegateType) external view returns (address, bytes memory) {\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\n bytes memory emptyBytes;\n return\n data.implementation != address(0)\n ? (data.implementation, data.becomeImplementationData)\n : (address(0), emptyBytes);\n }\n\n /**\n * @dev Sets the latest `CErc20Delegate` upgrade implementation address and data.\n * @param delegateType The old `CErc20Delegate` implementation address to upgrade from.\n * @param newImplementation Latest `CErc20Delegate` implementation address.\n * @param becomeImplementationData Data passed to the new implementation via `becomeImplementation` after upgrade.\n */\n function _setLatestCErc20Delegate(\n uint8 delegateType,\n address newImplementation,\n bytes calldata becomeImplementationData\n ) external onlyOwner {\n _latestCErc20Delegate[delegateType] = CDelegateUpgradeData(newImplementation, becomeImplementationData);\n }\n\n /**\n * @dev Latest Plugin implementation for each existing implementation.\n */\n function latestPluginImplementation(address oldImplementation) external view returns (address) {\n return\n _latestPluginImplementation[oldImplementation] != address(0)\n ? _latestPluginImplementation[oldImplementation]\n : oldImplementation;\n }\n\n /**\n * @dev Sets the latest plugin upgrade implementation address.\n * @param oldImplementation The old plugin implementation address to upgrade from.\n * @param newImplementation Latest plugin implementation address.\n */\n function _setLatestPluginImplementation(address oldImplementation, address newImplementation) external onlyOwner {\n _latestPluginImplementation[oldImplementation] = newImplementation;\n }\n\n /**\n * @dev Upgrades a plugin of a CErc20PluginDelegate market to the latest implementation\n * @param cDelegator the proxy address\n * @return if the plugin was upgraded or not\n */\n function _upgradePluginToLatestImplementation(address cDelegator) external onlyOwner returns (bool) {\n CErc20PluginDelegate market = CErc20PluginDelegate(cDelegator);\n\n address oldPluginAddress = address(market.plugin());\n market._updatePlugin(_latestPluginImplementation[oldPluginAddress]);\n address newPluginAddress = address(market.plugin());\n\n return newPluginAddress != oldPluginAddress;\n }\n\n /**\n * @notice Returns the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function interestFeeRate() external view returns (uint256) {\n (bool success, bytes memory data) = msg.sender.staticcall(abi.encodeWithSignature(\"comptroller()\"));\n\n if (success && data.length == 32) {\n address comptroller = abi.decode(data, (address));\n int256 customRate = customInterestFeeRates[comptroller];\n if (customRate > 0) return uint256(customRate);\n if (customRate < 0) return 0;\n }\n\n return defaultInterestFeeRate;\n }\n\n /**\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\n * @param comptroller The Unitroller (Comptroller proxy) address.\n * @param rate The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function _setCustomInterestFeeRate(address comptroller, int256 rate) external onlyOwner {\n require(rate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n customInterestFeeRates[comptroller] = rate;\n }\n\n function getComptrollerExtensions(address comptroller) external view returns (DiamondExtension[] memory) {\n return comptrollerExtensions[comptroller];\n }\n\n function _setComptrollerExtensions(address comptroller, DiamondExtension[] calldata extensions) external onlyOwner {\n comptrollerExtensions[comptroller] = extensions;\n }\n\n function _registerComptrollerExtension(\n address payable pool,\n DiamondExtension extensionToAdd,\n DiamondExtension extensionToReplace\n ) external onlyOwner {\n DiamondBase(pool)._registerExtension(extensionToAdd, extensionToReplace);\n }\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (DiamondExtension[] memory) {\n return cErc20DelegateExtensions[cErc20Delegate];\n }\n\n function _setCErc20DelegateExtensions(\n address cErc20Delegate,\n DiamondExtension[] calldata extensions\n ) external onlyOwner {\n cErc20DelegateExtensions[cErc20Delegate] = extensions;\n }\n\n function autoUpgradePool(IonicComptroller pool) external onlyOwner {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n // auto upgrade the pool\n pool._upgrade();\n\n for (uint8 i = 0; i < markets.length; i++) {\n // upgrade the market\n markets[i]._upgrade();\n }\n }\n\n function canCall(address pool, address user, address target, bytes4 functionSig) external view returns (bool) {\n return authoritiesRegistry.canCall(pool, user, target, functionSig);\n }\n}\n" + }, + "contracts/GlobalPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\ninterface IPoolDirectory {\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n function getActivePools() external view returns (uint256, Pool[] memory);\n}\n\ncontract GlobalPauser is Ownable2Step {\n IPoolDirectory public poolDirectory;\n mapping(address => bool) public pauseGuardian;\n\n modifier onlyPauseGuardian() {\n require(pauseGuardian[msg.sender], \"!guardian\");\n _;\n }\n\n constructor(address _poolDirectory) Ownable2Step() {\n poolDirectory = IPoolDirectory(_poolDirectory);\n }\n\n function setPauseGuardian(address _pauseGuardian, bool _isPauseGuardian) external onlyOwner {\n pauseGuardian[_pauseGuardian] = _isPauseGuardian;\n }\n\n function pauseAll() external onlyPauseGuardian {\n (, IPoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n if (!isPaused) {\n IonicComptroller(pools[i].comptroller)._setBorrowPaused(markets[j], true);\n }\n\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n if (!isPaused) {\n IonicComptroller(pools[i].comptroller)._setMintPaused(markets[j], true);\n }\n }\n }\n }\n}\n" + }, + "contracts/IEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IEmissionsManager {\n error InvalidPoolDirectoryAaddress();\n error InvalidProtocolAddress();\n error InvalidRewardTokenAddress();\n error CollateralBasisPointsExceedMaximum();\n error InvalidVeIONAddress();\n error MaximumLimitExceeded();\n\n event Initialized(\n address indexed protocolAddress,\n address indexed rewardToken,\n uint256 collateralBp,\n bytes nonBlacklistableTargetBytecode\n );\n event VeIonSet(address indexed veIon);\n event CollateralBpSet(uint256 collateralBp);\n event NonBlacklistableAddressSet(address indexed user, bool isNonBlacklistable);\n event NonBlacklistableTargetBytecodeSet(bytes newBytecode);\n\n function isUserBlacklisted(address _user) external view returns (bool);\n function isUserBlacklistable(address _user) external view returns (bool);\n}\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\n\ninterface ILiquidator {\n /**\n * borrower The borrower's Ethereum address.\n * repayAmount The amount to repay to liquidate the unhealthy loan.\n * cErc20 The borrowed CErc20 contract to repay.\n * cTokenCollateral The cToken collateral contract to be liquidated.\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\n */\n struct LiquidateToTokensWithFlashSwapVars {\n address borrower;\n uint256 repayAmount;\n ICErc20 cErc20;\n ICErc20 cTokenCollateral;\n address flashSwapContract;\n uint256 minProfitAmount;\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] strategyData;\n IFundsConversionStrategy[] debtFundingStrategies;\n bytes[] debtFundingStrategiesData;\n }\n\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256);\n\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\n external\n returns (uint256);\n\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\n\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\n external;\n\n function setExpressRelay(address _expressRelay) external;\n\n function setPoolLens(address _poolLens) external;\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\n}\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title AddressesProvider\n * @notice The Addresses Provider serves as a central storage of system internal and external\n * contract addresses that change between deploys and across chains\n * @author Veliko Minkov \n */\ncontract AddressesProvider is SafeOwnableUpgradeable {\n mapping(string => address) private _addresses;\n mapping(address => Contract) public plugins;\n mapping(address => Contract) public flywheelRewards;\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\n JarvisPool[] public jarvisPoolsConfig;\n CurveSwapPool[] public curveSwapPoolsConfig;\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\n\n /// @dev Initializer to set the admin that can set and change contracts addresses\n function initialize(address owner) public initializer {\n __SafeOwnable_init(owner);\n }\n\n /**\n * @dev The contract address and a string that uniquely identifies the contract's interface\n */\n struct Contract {\n address addr;\n string contractInterface;\n }\n\n struct RedemptionStrategy {\n address addr;\n string contractInterface;\n address outputToken;\n }\n\n struct FundingStrategy {\n address addr;\n string contractInterface;\n address inputToken;\n }\n\n struct JarvisPool {\n address syntheticToken;\n address collateralToken;\n address liquidityPool;\n uint256 expirationTime;\n }\n\n struct CurveSwapPool {\n address poolAddress;\n address[] coins;\n }\n\n /**\n * @dev sets the address and contract interface ID of the flywheel for the reward token\n * @param rewardToken the reward token address\n * @param flywheelRewardsModule the flywheel rewards module address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFlywheelRewards(\n address rewardToken,\n address flywheelRewardsModule,\n string calldata contractInterface\n ) public onlyOwner {\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\n * @param asset the asset address\n * @param plugin the ERC4626 plugin address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setPlugin(\n address asset,\n address plugin,\n string calldata contractInterface\n ) public onlyOwner {\n plugins[asset] = Contract(plugin, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\n * @param asset the asset address\n * @param strategy redemption strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setRedemptionStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address outputToken\n ) public onlyOwner {\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\n }\n\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\n return redemptionStrategiesConfig[asset];\n }\n\n /**\n * @dev sets the address and contract interface ID of the funding strategy for the asset\n * @param asset the asset address\n * @param strategy funding strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFundingStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address inputToken\n ) public onlyOwner {\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\n }\n\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\n return fundingStrategiesConfig[asset];\n }\n\n /**\n * @dev configures the Jarvis pool of a Jarvis synthetic token\n * @param syntheticToken the synthetic token address\n * @param collateralToken the collateral token address\n * @param liquidityPool the liquidity pool address\n * @param expirationTime the operation expiration time\n */\n function setJarvisPool(\n address syntheticToken,\n address collateralToken,\n address liquidityPool,\n uint256 expirationTime\n ) public onlyOwner {\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\n }\n\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\n }\n\n /**\n * @dev Sets an address for an id replacing the address saved in the addresses map\n * @param id The id\n * @param newAddress The address to set\n */\n function setAddress(string calldata id, address newAddress) external onlyOwner {\n _addresses[id] = newAddress;\n }\n\n /**\n * @dev Returns an address by id\n * @return The address\n */\n function getAddress(string calldata id) public view returns (address) {\n return _addresses[id];\n }\n\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\n return curveSwapPoolsConfig;\n }\n\n function getJarvisPools() public view returns (JarvisPool[] memory) {\n return jarvisPoolsConfig;\n }\n\n function setBalancerPoolForTokens(\n address inputToken,\n address outputToken,\n address pool\n ) external onlyOwner {\n balancerPoolForTokens[inputToken][outputToken] = pool;\n }\n\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\n return balancerPoolForTokens[inputToken][outputToken];\n }\n}\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\n PoolRolesAuthority public poolAuthLogic;\n address public leveredPositionsFactory;\n bool public noAuthRequired;\n\n function initialize(address _leveredPositionsFactory) public initializer {\n __SafeOwnable_init(msg.sender);\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n }\n\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n // for Neon the auth is not required\n noAuthRequired = block.chainid == 245022934;\n }\n\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\n\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\n auth = PoolRolesAuthority(address(proxy));\n auth.initialize(address(this));\n poolsAuthorities[pool] = auth;\n\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\n // sets the registry owner as the auth owner\n reconfigureAuthority(pool);\n }\n\n function reconfigureAuthority(address poolAddress) public {\n IonicComptroller pool = IonicComptroller(poolAddress);\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\n\n if (msg.sender != poolAddress || address(auth) != address(0)) {\n require(address(auth) != address(0), \"no such authority\");\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\n\n auth.configureRegistryCapabilities();\n auth.configurePoolSupplierCapabilities(pool);\n auth.configurePoolBorrowerCapabilities(pool);\n // everyone can be a liquidator\n auth.configureOpenPoolLiquidatorCapabilities(pool);\n auth.configureLeveredPositionCapabilities(pool);\n\n if (auth.owner() != owner()) {\n auth.setOwner(owner());\n }\n }\n }\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool) {\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\n if (address(authorityForPool) == address(0)) {\n return noAuthRequired;\n } else {\n // allow only if an auth exists and it allows the action\n return authorityForPool.canCall(user, target, functionSig);\n }\n }\n\n function setUserRole(\n address pool,\n address user,\n uint8 role,\n bool enabled\n ) external {\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\n\n require(address(poolAuth) != address(0), \"auth does not exist\");\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\n\n poolAuth.setUserRole(user, role, enabled);\n }\n}\n" + }, + "contracts/ionic/CollateralSwap.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\nimport { IFlashLoanReceiver } from \"./IFlashLoanReceiver.sol\";\nimport { Exponential } from \"../compound/Exponential.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\ncontract CollateralSwap is Ownable2Step, Exponential, IFlashLoanReceiver {\n using SafeERC20 for IERC20;\n\n uint256 public feeBps;\n address public feeRecipient;\n IonicComptroller public comptroller;\n mapping(address => bool) public allowedSwapTargets;\n\n error SwapCollateralFailed();\n error TransferFailed(address market, address user, address target);\n error MintFailed(address market, uint256 errorCode);\n error RedeemFailed(address market, uint256 errorCode);\n error InvalidFlashloanCaller(address caller);\n error InvalidSwapTarget(address target);\n\n constructor(\n uint256 _feeBps,\n address _feeRecipient,\n address _comptroller,\n address[] memory _allowedSwapTargets\n ) Ownable2Step() {\n feeBps = _feeBps;\n feeRecipient = _feeRecipient;\n comptroller = IonicComptroller(_comptroller);\n for (uint256 i = 0; i < _allowedSwapTargets.length; i++) {\n allowedSwapTargets[_allowedSwapTargets[i]] = true;\n }\n }\n\n // ADMIN FUNCTIONS\n\n function setFeeBps(uint256 _feeBps) public onlyOwner {\n feeBps = _feeBps;\n }\n\n function setFeeRecipient(address _feeRecipient) public onlyOwner {\n feeRecipient = _feeRecipient;\n }\n\n function setAllowedSwapTarget(address _target, bool _allowed) public onlyOwner {\n allowedSwapTargets[_target] = _allowed;\n }\n\n function sweep(address token) public onlyOwner {\n IERC20(token).safeTransfer(owner(), IERC20(token).balanceOf(address(this)));\n }\n\n // PUBLIC FUNCTIONS\n\n function swapCollateral(\n uint256 amountUnderlying,\n ICErc20 oldCollateralMarket,\n ICErc20 newCollateralMarket,\n address swapTarget,\n bytes calldata swapData\n ) public {\n oldCollateralMarket.flash(\n amountUnderlying,\n abi.encode(msg.sender, oldCollateralMarket, newCollateralMarket, swapTarget, swapData)\n );\n }\n\n function receiveFlashLoan(address borrowedAsset, uint256 borrowedAmount, bytes calldata data) external {\n // make sure the caller is a valid market\n {\n ICErc20[] memory markets = comptroller.getAllMarkets();\n bool isAllowed = false;\n for (uint256 i = 0; i < markets.length; i++) {\n if (msg.sender == address(markets[i])) {\n isAllowed = true;\n break;\n }\n }\n if (!isAllowed) {\n revert InvalidFlashloanCaller(msg.sender);\n }\n }\n\n (\n address borrower,\n ICErc20 oldCollateralMarket,\n ICErc20 newCollateralMarket,\n address swapTarget,\n bytes memory swapData\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes));\n\n // swap the collateral\n {\n if (!allowedSwapTargets[swapTarget]) {\n revert InvalidSwapTarget(swapTarget);\n }\n IERC20(borrowedAsset).approve(swapTarget, borrowedAmount);\n (bool success, ) = swapTarget.call(swapData);\n if (!success) {\n revert SwapCollateralFailed();\n }\n }\n\n // mint the new collateral\n {\n IERC20 newCollateralAsset = IERC20(newCollateralMarket.underlying());\n uint256 outputAmount = newCollateralAsset.balanceOf(address(this));\n uint256 fee = (outputAmount * feeBps) / 10_000;\n outputAmount -= fee;\n if (fee > 0) {\n newCollateralAsset.safeTransfer(feeRecipient, fee);\n }\n newCollateralAsset.approve(address(newCollateralMarket), outputAmount);\n uint256 mintResult = newCollateralMarket.mint(outputAmount);\n if (mintResult != 0) {\n revert MintFailed(address(newCollateralMarket), mintResult);\n }\n }\n\n // transfer the new collateral to the borrower\n {\n uint256 cTokenBalance = IERC20(address(newCollateralMarket)).balanceOf(address(this));\n IERC20(address(newCollateralMarket)).safeTransfer(borrower, cTokenBalance);\n }\n\n // withdraw the old collateral\n {\n (MathError mErr, uint256 amountCTokensToSwap) = divScalarByExpTruncate(\n borrowedAmount,\n Exp({ mantissa: oldCollateralMarket.exchangeRateCurrent() })\n );\n require(mErr == MathError.NO_ERROR, \"exchange rate error\");\n bool transferStatus = oldCollateralMarket.transferFrom(borrower, address(this), amountCTokensToSwap + 1);\n if (!transferStatus) {\n revert TransferFailed(address(oldCollateralMarket), borrower, address(this));\n }\n uint256 redeemResult = oldCollateralMarket.redeemUnderlying(type(uint256).max);\n if (redeemResult != 0) {\n revert RedeemFailed(address(oldCollateralMarket), redeemResult);\n }\n IERC20(borrowedAsset).approve(address(oldCollateralMarket), borrowedAmount);\n }\n // flashloan gets paid back from redeemed collateral\n }\n}\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @notice a base contract for logic extensions that use the diamond pattern storage\n * to map the functions when looking up the extension contract to delegate to.\n */\nabstract contract DiamondExtension {\n /**\n * @return a list of all the function selectors that this logic extension exposes\n */\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\n}\n\n// When no function exists for function called\nerror FunctionNotFound(bytes4 _functionSelector);\n\n// When no extension exists for function called\nerror ExtensionNotFound(bytes4 _functionSelector);\n\n// When the function is already added\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\n\nabstract contract DiamondBase {\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\n\n function _listExtensions() public view returns (address[] memory) {\n return LibDiamond.listExtensions();\n }\n\n fallback() external {\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n\n/**\n * @notice a library to use in a contract, whose logic is extended with diamond extension\n */\nlibrary LibDiamond {\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\n\n struct Function {\n address extension;\n bytes4 selector;\n }\n\n struct LogicStorage {\n Function[] functions;\n address[] extensions;\n }\n\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\n return getExtensionForSelector(msgSig, diamondStorage());\n }\n\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n assembly {\n ds.slot := position\n }\n }\n\n function listExtensions() internal view returns (address[] memory) {\n return diamondStorage().extensions;\n }\n\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\n if (address(extensionToReplace) != address(0)) {\n removeExtension(extensionToReplace);\n }\n addExtension(extensionToAdd);\n }\n\n function removeExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n // remove all functions of the extension to replace\n removeExtensionFunctions(extension);\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n if (ds.extensions[i] == address(extension)) {\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\n ds.extensions.pop();\n }\n }\n }\n\n function addExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n require(ds.extensions[i] != address(extension), \"extension already added\");\n }\n addExtensionFunctions(extension);\n ds.extensions.push(address(extension));\n }\n\n function removeExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\n bytes4 selectorToRemove = fnsToRemove[i];\n // must never fail\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\n // swap with the last element in the selectorAtIndex array and remove the last element\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\n ds.functions.pop();\n }\n }\n\n function addExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n uint16 functionsCount = uint16(ds.functions.length);\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\n bytes4 selector = fnsToAdd[functionsIndex];\n address oldImplementation = getExtensionForSelector(selector, ds);\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\n ds.functions.push(Function(address(extension), selector));\n functionsCount++;\n }\n }\n\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\n uint256 fnsLen = ds.functions.length;\n for (uint256 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\n }\n\n return address(0);\n }\n\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\n uint16 fnsLen = uint16(ds.functions.length);\n for (uint16 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return i;\n }\n\n return type(uint16).max;\n }\n}\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ninterface IFlashLoanReceiver {\n function receiveFlashLoan(\n address borrowedAsset,\n uint256 borrowedAmount,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/ionic/irms/AdjustableJumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../../compound/InterestRateModel.sol\";\nimport \"../../compound/SafeMath.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title Compound's JumpRateModel Contract\n * @author Compound\n */\n\nstruct InterestRateModelParams {\n uint256 blocksPerYear; // The approximate number of blocks per year\n uint256 baseRatePerYear; // The approximate target base APR, as a mantissa (scaled by 1e18)\n uint256 multiplierPerYear; // The rate of increase in interest rate wrt utilization (scaled by 1e18)\n uint256 jumpMultiplierPerYear; // The multiplierPerBlock after hitting a specified utilization point\n uint256 kink; // The utilization point at which the jump multiplier is applied\n}\n\ncontract AdjustableJumpRateModel is Ownable, InterestRateModel {\n using SafeMath for uint256;\n\n event NewInterestParams(\n uint256 baseRatePerBlock,\n uint256 multiplierPerBlock,\n uint256 jumpMultiplierPerBlock,\n uint256 kink\n );\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint256 public blocksPerYear;\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint256 public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint256 public baseRatePerBlock;\n\n /**\n * @notice The multiplierPerBlock after hitting a specified utilization point\n */\n uint256 public jumpMultiplierPerBlock;\n\n /**\n * @notice The utilization point at which the jump multiplier is applied\n */\n uint256 public kink;\n\n /**\n * @notice Initialise an interest rate model\n */\n\n constructor(InterestRateModelParams memory params) {\n blocksPerYear = params.blocksPerYear;\n baseRatePerBlock = params.baseRatePerYear.div(blocksPerYear);\n multiplierPerBlock = params.multiplierPerYear.div(blocksPerYear);\n jumpMultiplierPerBlock = params.jumpMultiplierPerYear.div(blocksPerYear);\n kink = params.kink;\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\n }\n\n function _setIrmParameters(InterestRateModelParams memory params) public onlyOwner {\n blocksPerYear = params.blocksPerYear;\n baseRatePerBlock = params.baseRatePerYear.div(blocksPerYear);\n multiplierPerBlock = params.multiplierPerYear.div(blocksPerYear);\n jumpMultiplierPerBlock = params.jumpMultiplierPerYear.div(blocksPerYear);\n kink = params.kink;\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n uint256 util = utilizationRate(cash, borrows, reserves);\n\n if (util <= kink) {\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n } else {\n uint256 normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n uint256 excessUtil = util.sub(kink);\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\n }\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = uint256(1e18).sub(reserveFactorMantissa);\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\n }\n}\n" + }, + "contracts/ionic/irms/PrudentiaInterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\n\nimport { IRateComputer } from \"adrastia-periphery/rates/IRateComputer.sol\";\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\n/**\n * @title Adrastia Prudentia Interest Rate Model\n * @author TRILEZ SOFTWARE INC.\n */\ncontract PrudentiaInterestRateModel is InterestRateModel {\n using Math for uint256;\n\n /**\n * @notice The address of the underlying token for which the interest rate model calculates rates.\n */\n address public immutable underlyingToken;\n\n /**\n * @notice The address of the Adrastia Prudentia interest rate controller.\n */\n IRateComputer public immutable rateController;\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model.\n */\n uint256 public immutable blocksPerYear;\n\n /**\n * @notice Construct a new interest rate model that reads from an Adrastia Prudentia interest rate controller.\n *\n * @param blocksPerYear_ The approximate number of blocks per year that is assumed by the interest rate model.\n * @param underlyingToken_ The address of the underlying token for which the interest rate model calculates rates.\n * @param rateController_ The address of the Adrastia Prudentia interest rate controller.\n */\n constructor(\n uint256 blocksPerYear_,\n address underlyingToken_,\n IRateComputer rateController_\n ) {\n if (underlyingToken_ == address(0)) {\n revert(\"PrudentiaInterestRateModel: underlyingToken is the zero address\");\n }\n if (address(rateController_) == address(0)) {\n revert(\"PrudentiaInterestRateModel: rateController is the zero address\");\n }\n\n blocksPerYear = blocksPerYear_;\n underlyingToken = underlyingToken_;\n rateController = rateController_;\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`.\n *\n * @param cash The amount of cash in the market.\n * @param borrows The amount of borrows in the market.\n * @param reserves The amount of reserves in the market.\n *\n * @return The utilization rate as a mantissa between [0, 1e18].\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n uint256 total = cash + borrows - reserves;\n if (total == 0) {\n // Utilization rate is zero when nothing is available (prevents division by zero)\n return 0;\n }\n\n return (borrows * 1e18) / total;\n }\n\n /**\n * @notice Calculates the current borrow rate per block by reading the current rate from the Adrastia Prudentia\n * interest rate controller.\n *\n * @param cash Not used.\n * @param borrows Not used.\n * @param reserves Not used.\n *\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18).\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n // Silence unused variable warnings\n cash;\n borrows;\n reserves;\n\n uint256 annualRate = rateController.computeRate(underlyingToken);\n\n return annualRate.ceilDiv(blocksPerYear); // Convert the annual rate to a per-block rate, rounding up\n }\n\n /**\n * @notice Calculates the current supply rate per block.\n *\n * @param cash The amount of cash in the market.\n * @param borrows The amount of borrows in the market.\n * @param reserves The amount of reserves in the market.\n * @param reserveFactorMantissa The current reserve factor for the market.\n *\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18).\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\n\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\n }\n}\n" + }, + "contracts/ionic/levered/ILeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ILeveredPositionFactoryStorage {\n function feeDistributor() external view returns (IFeeDistributor);\n\n function liquidatorsRegistry() external view returns (ILiquidatorsRegistry);\n\n function blocksPerYear() external view returns (uint256);\n\n function owner() external view returns (address);\n}\n\ninterface ILeveredPositionFactoryBase {\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external;\n\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external;\n}\n\ninterface ILeveredPositionFactoryFirstExtension {\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\n\n function getMinBorrowNative() external view returns (uint256);\n\n function removeClosedPosition(address closedPosition) external returns (bool removed);\n\n function closeAndRemoveUserPosition(LeveredPosition position) external returns (bool);\n\n function getPositionsByAccount(address account) external view returns (address[] memory, bool[] memory);\n\n function getAccountsWithOpenPositions() external view returns (address[] memory);\n\n function getWhitelistedCollateralMarkets() external view returns (address[] memory);\n\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory);\n\n function getPositionsExtension(bytes4 msgSig) external view returns (address);\n\n function _setPositionsExtension(bytes4 msgSig, address extension) external;\n}\n\ninterface ILeveredPositionFactorySecondExtension {\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) external returns (LeveredPosition);\n\n function createAndFundPosition(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount\n ) external returns (LeveredPosition);\n\n function createAndFundPositionAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount,\n uint256 _leverageRatio\n ) external returns (LeveredPosition);\n}\n\ninterface ILeveredPositionFactoryExtension is\n ILeveredPositionFactoryFirstExtension,\n ILeveredPositionFactorySecondExtension\n{}\n\ninterface ILeveredPositionFactory is\n ILeveredPositionFactoryStorage,\n ILeveredPositionFactoryBase,\n ILeveredPositionFactoryExtension\n{}\n" + }, + "contracts/ionic/levered/LeveredPosition.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { IFlashLoanReceiver } from \"../IFlashLoanReceiver.sol\";\nimport { IonicFlywheel } from \"../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { LeveredPositionStorage } from \"./LeveredPositionStorage.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFlywheelLensRouter_LP {\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\n}\n\ncontract LeveredPosition is LeveredPositionStorage, IFlashLoanReceiver {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n error OnlyWhenClosed();\n error NotPositionOwner();\n error OnlyFactoryOwner();\n error AssetNotRescuable();\n error RepayFlashLoanFailed(address asset, uint256 currentBalance, uint256 repayAmount);\n\n error ConvertFundsFailed();\n error ExitFailed(uint256 errorCode);\n error RedeemFailed(uint256 errorCode);\n error SupplyCollateralFailed(uint256 errorCode);\n error BorrowStableFailed(uint256 errorCode);\n error RepayBorrowFailed(uint256 errorCode);\n error RedeemCollateralFailed(uint256 errorCode);\n error ExtNotFound(bytes4 _functionSelector);\n\n constructor(\n address _positionOwner,\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket\n ) LeveredPositionStorage(_positionOwner) {\n IonicComptroller collateralPool = _collateralMarket.comptroller();\n IonicComptroller stablePool = _stableMarket.comptroller();\n require(collateralPool == stablePool, \"markets pools differ\");\n pool = collateralPool;\n\n collateralMarket = _collateralMarket;\n collateralAsset = IERC20Upgradeable(_collateralMarket.underlying());\n stableMarket = _stableMarket;\n stableAsset = IERC20Upgradeable(_stableMarket.underlying());\n\n factory = ILeveredPositionFactory(msg.sender);\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n function fundPosition(IERC20Upgradeable fundingAsset, uint256 amount) public {\n fundingAsset.safeTransferFrom(msg.sender, address(this), amount);\n _supplyCollateral(fundingAsset);\n\n if (!pool.checkMembership(address(this), collateralMarket)) {\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(collateralMarket);\n pool.enterMarkets(cTokens);\n }\n }\n\n function closePosition() public returns (uint256) {\n return closePosition(msg.sender);\n }\n\n function closePosition(address withdrawTo) public returns (uint256 withdrawAmount) {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n _leverDown(1e18);\n\n // calling accrue and exit allows to redeem the full underlying balance\n collateralMarket.accrueInterest();\n uint256 errorCode = pool.exitMarket(address(collateralMarket));\n if (errorCode != 0) revert ExitFailed(errorCode);\n\n // redeem all cTokens should leave no dust\n errorCode = collateralMarket.redeem(collateralMarket.balanceOf(address(this)));\n if (errorCode != 0) revert RedeemFailed(errorCode);\n\n if (stableAsset.balanceOf(address(this)) > 0) {\n // convert all overborrowed leftovers/profits to the collateral asset\n convertAllTo(stableAsset, collateralAsset);\n }\n\n // withdraw the redeemed collateral\n withdrawAmount = collateralAsset.balanceOf(address(this));\n collateralAsset.safeTransfer(withdrawTo, withdrawAmount);\n }\n\n function adjustLeverageRatio(uint256 targetRatioMantissa) public returns (uint256) {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n // anything under 1x means removing the leverage\n if (targetRatioMantissa <= 1e18) _leverDown(1e18);\n\n if (getCurrentLeverageRatio() < targetRatioMantissa) _leverUp(targetRatioMantissa);\n else _leverDown(targetRatioMantissa);\n\n // return the de facto achieved ratio\n return getCurrentLeverageRatio();\n }\n\n function receiveFlashLoan(address assetAddress, uint256 borrowedAmount, bytes calldata data) external override {\n if (msg.sender == address(collateralMarket)) {\n // increasing the leverage ratio\n uint256 stableBorrowAmount = abi.decode(data, (uint256));\n _leverUpPostFL(stableBorrowAmount);\n uint256 positionCollateralBalance = collateralAsset.balanceOf(address(this));\n if (positionCollateralBalance < borrowedAmount)\n revert RepayFlashLoanFailed(address(collateralAsset), positionCollateralBalance, borrowedAmount);\n } else if (msg.sender == address(stableMarket)) {\n // decreasing the leverage ratio\n uint256 amountToRedeem = abi.decode(data, (uint256));\n _leverDownPostFL(borrowedAmount, amountToRedeem);\n uint256 positionStableBalance = stableAsset.balanceOf(address(this));\n if (positionStableBalance < borrowedAmount)\n revert RepayFlashLoanFailed(address(stableAsset), positionStableBalance, borrowedAmount);\n } else {\n revert(\"!fl not from either markets\");\n }\n\n // repay FL\n IERC20Upgradeable(assetAddress).approve(msg.sender, borrowedAmount);\n }\n\n function withdrawStableLeftovers(address withdrawTo) public returns (uint256) {\n if (msg.sender != positionOwner) revert NotPositionOwner();\n if (!isPositionClosed()) revert OnlyWhenClosed();\n\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\n stableAsset.safeTransfer(withdrawTo, stableLeftovers);\n return stableLeftovers;\n }\n\n function claimRewards() public {\n claimRewards(msg.sender);\n }\n\n function claimRewards(address withdrawTo) public {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n address[] memory flywheels = pool.getRewardsDistributors();\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\n fw.accrue(ERC20(address(collateralMarket)), address(this));\n fw.accrue(ERC20(address(stableMarket)), address(this));\n fw.claimRewards(address(this));\n ERC20 rewardToken = fw.rewardToken();\n uint256 rewardsAccrued = rewardToken.balanceOf(address(this));\n if (rewardsAccrued > 0) {\n rewardToken.transfer(withdrawTo, rewardsAccrued);\n }\n }\n }\n\n function rescueTokens(IERC20Upgradeable asset) external {\n if (msg.sender != factory.owner()) revert OnlyFactoryOwner();\n if (asset == stableAsset || asset == collateralAsset) revert AssetNotRescuable();\n\n asset.transfer(positionOwner, asset.balanceOf(address(this)));\n }\n\n function claimRewardsFromRouter(address _flr) external returns (address[] memory, uint256[] memory) {\n IFlywheelLensRouter_LP flr = IFlywheelLensRouter_LP(_flr);\n (address[] memory rewardTokens, uint256[] memory rewards) = flr.claimAllRewardTokens(address(this));\n for (uint256 i = 0; i < rewardTokens.length; i++) {\n IERC20Upgradeable(rewardTokens[i]).safeTransfer(positionOwner, rewards[i]);\n }\n return (rewardTokens, rewards);\n }\n\n fallback() external {\n address extension = factory.getPositionsExtension(msg.sig);\n if (extension == address(0)) revert ExtNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n function getAccruedRewards()\n external\n returns (\n /*view*/\n ERC20[] memory rewardTokens,\n uint256[] memory amounts\n )\n {\n address[] memory flywheels = pool.getRewardsDistributors();\n\n rewardTokens = new ERC20[](flywheels.length);\n amounts = new uint256[](flywheels.length);\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\n fw.accrue(ERC20(address(collateralMarket)), address(this));\n fw.accrue(ERC20(address(stableMarket)), address(this));\n rewardTokens[i] = fw.rewardToken();\n amounts[i] = fw.rewardsAccrued(address(this));\n }\n }\n\n function getCurrentLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n BasePriceOracle oracle = pool.oracle();\n\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\n\n uint256 debtValue = 0;\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n if (debtAmount > 0) {\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\n }\n\n // TODO check if positionValue > debtValue\n // s / ( s - b )\n return (positionValue * 1e18) / (positionValue - debtValue);\n }\n\n function getMinLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n BasePriceOracle oracle = pool.oracle();\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 minStableBorrowAmount = (factory.getMinBorrowNative() * 1e18) / borrowedAssetPrice;\n return _getLeverageRatioAfterBorrow(minStableBorrowAmount, positionSupplyAmount, 0);\n }\n\n function getMaxLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n uint256 maxBorrow = pool.getMaxRedeemOrBorrow(address(this), stableMarket, true);\n uint256 positionBorrowAmount = stableMarket.borrowBalanceCurrent(address(this));\n return _getLeverageRatioAfterBorrow(maxBorrow, positionSupplyAmount, positionBorrowAmount);\n }\n\n function _getLeverageRatioAfterBorrow(\n uint256 newBorrowsAmount,\n uint256 positionSupplyAmount,\n uint256 positionBorrowAmount\n ) internal view returns (uint256 r) {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n uint256 currentBorrowsValue = (positionBorrowAmount * stableAssetPrice) / 1e18;\n uint256 newBorrowsValue = (newBorrowsAmount * stableAssetPrice) / 1e18;\n uint256 positionValue = (positionSupplyAmount * collateralAssetPrice) / 1e18;\n\n // accounting for swaps slippage\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\n {\n // add 10 bps just to not go under the min borrow value\n assumedSlippage += 10;\n }\n uint256 topUpCollateralValue = (newBorrowsValue * 10000) / (10000 + assumedSlippage);\n\n int256 s = int256(positionValue);\n int256 b = int256(currentBorrowsValue);\n int256 x = int256(topUpCollateralValue);\n\n r = uint256(((s + x) * 1e18) / (s + x - b - int256(newBorrowsValue)));\n }\n\n function isPositionClosed() public view returns (bool) {\n return collateralMarket.balanceOfUnderlying(address(this)) == 0;\n }\n\n function getEquityAmount() external view returns (uint256 equityAmount) {\n BasePriceOracle oracle = pool.oracle();\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\n\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n uint256 debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\n\n uint256 equityValue = positionValue - debtValue;\n equityAmount = (equityValue * 1e18) / collateralAssetPrice;\n }\n\n function getSupplyAmountDelta(uint256 targetRatio) public view returns (uint256, uint256) {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n uint256 currentRatio = getCurrentLeverageRatio();\n bool up = targetRatio > currentRatio;\n return _getSupplyAmountDelta(up, targetRatio, collateralAssetPrice, stableAssetPrice);\n }\n\n function _getSupplyAmountDelta(\n bool up,\n uint256 targetRatio,\n uint256 collateralAssetPrice,\n uint256 borrowedAssetPrice\n ) internal view returns (uint256 supplyDelta, uint256 borrowsDelta) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n uint256 assumedSlippage;\n if (up) assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\n else assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\n uint256 slippageFactor = (1e18 * (10000 + assumedSlippage)) / 10000;\n\n uint256 supplyValueDeltaAbs;\n {\n // s = supply value before\n // b = borrow value before\n // r = target ratio after\n // c = borrow value coefficient to account for the slippage\n int256 s = int256((collateralAssetPrice * positionSupplyAmount) / 1e18);\n int256 b = int256((borrowedAssetPrice * debtAmount) / 1e18);\n int256 r = int256(targetRatio);\n int256 r1 = r - 1e18;\n int256 c = int256(slippageFactor);\n\n // some math magic here\n // https://www.wolframalpha.com/input?i2d=true&i=r%3D%5C%2840%29Divide%5B%5C%2840%29s%2Bx%5C%2841%29%2C%5C%2840%29s%2Bx-b-c*x%5C%2841%29%5D+%5C%2841%29+solve+for+x\n\n // x = supplyValueDelta\n int256 supplyValueDelta = (((r1 * s) - (b * r)) * 1e18) / ((c * r) - (1e18 * r1));\n supplyValueDeltaAbs = uint256((supplyValueDelta < 0) ? -supplyValueDelta : supplyValueDelta);\n }\n\n supplyDelta = (supplyValueDeltaAbs * 1e18) / collateralAssetPrice;\n borrowsDelta = (supplyValueDeltaAbs * 1e18) / borrowedAssetPrice;\n\n if (up) {\n // stables to borrow = c * x\n borrowsDelta = (borrowsDelta * slippageFactor) / 1e18;\n } else {\n // amount to redeem = c * x\n supplyDelta = (supplyDelta * slippageFactor) / 1e18;\n }\n }\n\n /*----------------------------------------------------------------\n Internal Functions\n ----------------------------------------------------------------*/\n\n function _supplyCollateral(IERC20Upgradeable fundingAsset) internal returns (uint256 amountToSupply) {\n // in case the funding is with a different asset\n if (address(collateralAsset) != address(fundingAsset)) {\n // swap for collateral asset\n convertAllTo(fundingAsset, collateralAsset);\n }\n\n // supply the collateral\n amountToSupply = collateralAsset.balanceOf(address(this));\n collateralAsset.approve(address(collateralMarket), amountToSupply);\n uint256 errorCode = collateralMarket.mint(amountToSupply);\n if (errorCode != 0) revert SupplyCollateralFailed(errorCode);\n }\n\n // @dev flash loan the needed amount, then borrow stables and swap them for the amount needed to repay the FL\n function _leverUp(uint256 targetRatio) internal {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n (uint256 flashLoanCollateralAmount, uint256 stableToBorrow) = _getSupplyAmountDelta(\n true,\n targetRatio,\n collateralAssetPrice,\n stableAssetPrice\n );\n\n collateralMarket.flash(flashLoanCollateralAmount, abi.encode(stableToBorrow));\n // the execution will first receive a callback to receiveFlashLoan()\n // then it continues from here\n\n // all stables are swapped for collateral to repay the FL\n uint256 collateralLeftovers = collateralAsset.balanceOf(address(this));\n if (collateralLeftovers > 0) {\n collateralAsset.approve(address(collateralMarket), collateralLeftovers);\n collateralMarket.mint(collateralLeftovers);\n }\n }\n\n // @dev supply the flash loaned collateral and then borrow stables with it\n function _leverUpPostFL(uint256 stableToBorrow) internal {\n // supply the flash loaned collateral\n _supplyCollateral(collateralAsset);\n\n // borrow stables that will be swapped to repay the FL\n uint256 errorCode = stableMarket.borrow(stableToBorrow);\n if (errorCode != 0) revert BorrowStableFailed(errorCode);\n\n // swap for the FL asset\n convertAllTo(stableAsset, collateralAsset);\n }\n\n // @dev redeems the supplied collateral by first repaying the debt with which it was levered\n function _leverDown(uint256 targetRatio) internal {\n uint256 amountToRedeem;\n uint256 borrowsToRepay;\n\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n if (targetRatio <= 1e18) {\n // if max levering down, then derive the amount to redeem from the debt to be repaid\n borrowsToRepay = stableMarket.borrowBalanceCurrent(address(this));\n uint256 borrowsToRepayValueScaled = borrowsToRepay * stableAssetPrice;\n // accounting for swaps slippage\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\n uint256 amountToRedeemValueScaled = (borrowsToRepayValueScaled * (10000 + assumedSlippage)) / 10000;\n amountToRedeem = amountToRedeemValueScaled / collateralAssetPrice;\n // round up when dividing in order to redeem enough (otherwise calcs could be exploited)\n if (amountToRedeemValueScaled % collateralAssetPrice > 0) amountToRedeem += 1;\n } else {\n // else derive the debt to be repaid from the amount to redeem\n (amountToRedeem, borrowsToRepay) = _getSupplyAmountDelta(\n false,\n targetRatio,\n collateralAssetPrice,\n stableAssetPrice\n );\n // the slippage is already accounted for in _getSupplyAmountDelta\n }\n\n if (borrowsToRepay > 0) {\n ICErc20(address(stableMarket)).flash(borrowsToRepay, abi.encode(amountToRedeem));\n // the execution will first receive a callback to receiveFlashLoan()\n // then it continues from here\n }\n\n // all the redeemed collateral is swapped for stables to repay the FL\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\n if (stableLeftovers > 0) {\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\n if (borrowBalance > 0) {\n // whatever is smaller\n uint256 amountToRepay = borrowBalance > stableLeftovers ? stableLeftovers : borrowBalance;\n stableAsset.approve(address(stableMarket), amountToRepay);\n stableMarket.repayBorrow(amountToRepay);\n }\n }\n }\n\n function _leverDownPostFL(uint256 _flashLoanedCollateral, uint256 _amountToRedeem) internal {\n // repay the borrows\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\n uint256 repayAmount = _flashLoanedCollateral < borrowBalance ? _flashLoanedCollateral : borrowBalance;\n stableAsset.approve(address(stableMarket), repayAmount);\n uint256 errorCode = stableMarket.repayBorrow(repayAmount);\n if (errorCode != 0) revert RepayBorrowFailed(errorCode);\n\n // redeem the corresponding amount needed to repay the FL\n errorCode = collateralMarket.redeemUnderlying(_amountToRedeem);\n if (errorCode != 0) revert RedeemCollateralFailed(errorCode);\n\n // swap for the FL asset\n convertAllTo(collateralAsset, stableAsset);\n }\n\n function convertAllTo(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) private returns (uint256 outputAmount) {\n uint256 inputAmount = inputToken.balanceOf(address(this));\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = factory\n .getRedemptionStrategies(inputToken, outputToken);\n\n if (redemptionStrategies.length == 0) revert ConvertFundsFailed();\n\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\n bytes memory strategyData = strategiesData[i];\n (outputToken, outputAmount) = convertCustomFunds(inputToken, inputAmount, redemptionStrategy, strategyData);\n inputAmount = outputAmount;\n inputToken = outputToken;\n }\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { DiamondBase, DiamondExtension, LibDiamond } from \"../../ionic/DiamondExtension.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactory is LeveredPositionFactoryStorage, DiamondBase {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /*----------------------------------------------------------------\n Constructor\n ----------------------------------------------------------------*/\n\n constructor(IFeeDistributor _feeDistributor, ILiquidatorsRegistry _registry, uint256 _blocksPerYear) {\n feeDistributor = _feeDistributor;\n liquidatorsRegistry = _registry;\n blocksPerYear = _blocksPerYear;\n }\n\n /*----------------------------------------------------------------\n Admin Functions\n ----------------------------------------------------------------*/\n\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external onlyOwner {\n require(_collateralMarket.comptroller() == _stableMarket.comptroller(), \"markets not of the same pool\");\n\n if (_whitelisted) {\n collateralMarkets.add(address(_collateralMarket));\n borrowableMarketsByCollateral[_collateralMarket].add(address(_stableMarket));\n } else {\n borrowableMarketsByCollateral[_collateralMarket].remove(address(_stableMarket));\n if (borrowableMarketsByCollateral[_collateralMarket].length() == 0)\n collateralMarkets.remove(address(_collateralMarket));\n }\n }\n\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external onlyOwner {\n liquidatorsRegistry = _liquidatorsRegistry;\n }\n\n function _registerExtension(\n DiamondExtension extensionToAdd,\n DiamondExtension extensionToReplace\n ) public override onlyOwner {\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryFirstExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { ILeveredPositionFactoryFirstExtension } from \"./ILeveredPositionFactory.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactoryFirstExtension is\n LeveredPositionFactoryStorage,\n DiamondExtension,\n ILeveredPositionFactoryFirstExtension\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n error PairNotWhitelisted();\n error NoSuchPosition();\n error PositionNotClosed();\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 10;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.removeClosedPosition.selector;\n functionSelectors[--fnsCount] = this.closeAndRemoveUserPosition.selector;\n functionSelectors[--fnsCount] = this.getMinBorrowNative.selector;\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.getBorrowableMarketsByCollateral.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedCollateralMarkets.selector;\n functionSelectors[--fnsCount] = this.getAccountsWithOpenPositions.selector;\n functionSelectors[--fnsCount] = this.getPositionsByAccount.selector;\n functionSelectors[--fnsCount] = this.getPositionsExtension.selector;\n functionSelectors[--fnsCount] = this._setPositionsExtension.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n // @return true if removed, otherwise false\n function removeClosedPosition(address closedPosition) external returns (bool) {\n return _removeClosedPosition(closedPosition, msg.sender);\n }\n\n function closeAndRemoveUserPosition(LeveredPosition position) external onlyOwner returns (bool) {\n address positionOwner = position.positionOwner();\n position.closePosition(positionOwner);\n return _removeClosedPosition(address(position), positionOwner);\n }\n\n function _removeClosedPosition(address closedPosition, address positionOwner) internal returns (bool removed) {\n EnumerableSet.AddressSet storage userPositions = positionsByAccount[positionOwner];\n if (!userPositions.contains(closedPosition)) revert NoSuchPosition();\n if (!LeveredPosition(closedPosition).isPositionClosed()) revert PositionNotClosed();\n\n removed = userPositions.remove(closedPosition);\n if (userPositions.length() == 0) accountsWithOpenPositions.remove(positionOwner);\n }\n\n function _setPositionsExtension(bytes4 msgSig, address extension) external onlyOwner {\n _positionsExtensions[msgSig] = extension;\n }\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n\n function getMinBorrowNative() external view returns (uint256) {\n return feeDistributor.minBorrowEth();\n }\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\n return liquidatorsRegistry.getRedemptionStrategies(inputToken, outputToken);\n }\n\n function getPositionsByAccount(\n address account\n ) external view returns (address[] memory positions, bool[] memory closed) {\n positions = positionsByAccount[account].values();\n closed = new bool[](positions.length);\n for (uint256 i = 0; i < positions.length; i++) {\n closed[i] = LeveredPosition(positions[i]).isPositionClosed();\n }\n }\n\n function getAccountsWithOpenPositions() external view returns (address[] memory) {\n return accountsWithOpenPositions.values();\n }\n\n function getWhitelistedCollateralMarkets() external view returns (address[] memory) {\n return collateralMarkets.values();\n }\n\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory) {\n return borrowableMarketsByCollateral[_collateralMarket].values();\n }\n\n function getPositionsExtension(bytes4 msgSig) external view returns (address) {\n return _positionsExtensions[msgSig];\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactorySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { ILeveredPositionFactorySecondExtension } from \"./ILeveredPositionFactory.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactorySecondExtension is\n LeveredPositionFactoryStorage,\n DiamondExtension,\n ILeveredPositionFactorySecondExtension\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n error PairNotWhitelisted();\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 3;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.createPosition.selector;\n functionSelectors[--fnsCount] = this.createAndFundPosition.selector;\n functionSelectors[--fnsCount] = this.createAndFundPositionAtRatio.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) public returns (LeveredPosition) {\n if (!borrowableMarketsByCollateral[_collateralMarket].contains(address(_stableMarket))) revert PairNotWhitelisted();\n\n LeveredPosition position = new LeveredPosition(msg.sender, _collateralMarket, _stableMarket);\n\n accountsWithOpenPositions.add(msg.sender);\n positionsByAccount[msg.sender].add(address(position));\n\n AuthoritiesRegistry authoritiesRegistry = feeDistributor.authoritiesRegistry();\n address poolAddress = address(_collateralMarket.comptroller());\n PoolRolesAuthority poolAuth = authoritiesRegistry.poolsAuthorities(poolAddress);\n if (address(poolAuth) != address(0)) {\n authoritiesRegistry.setUserRole(poolAddress, address(position), poolAuth.LEVERED_POSITION_ROLE(), true);\n }\n\n return position;\n }\n\n function createAndFundPosition(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount\n ) public returns (LeveredPosition) {\n LeveredPosition position = createPosition(_collateralMarket, _stableMarket);\n _fundingAsset.safeTransferFrom(msg.sender, address(this), _fundingAmount);\n _fundingAsset.approve(address(position), _fundingAmount);\n position.fundPosition(_fundingAsset, _fundingAmount);\n return position;\n }\n\n function createAndFundPositionAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount,\n uint256 _leverageRatio\n ) external returns (LeveredPosition) {\n LeveredPosition position = createAndFundPosition(_collateralMarket, _stableMarket, _fundingAsset, _fundingAmount);\n if (_leverageRatio > 1e18) {\n position.adjustLeverageRatio(_leverageRatio);\n }\n return position;\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nabstract contract LeveredPositionFactoryStorage is SafeOwnable {\n EnumerableSet.AddressSet internal accountsWithOpenPositions;\n mapping(address => EnumerableSet.AddressSet) internal positionsByAccount;\n EnumerableSet.AddressSet internal collateralMarkets;\n mapping(ICErc20 => EnumerableSet.AddressSet) internal borrowableMarketsByCollateral;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) private __unused;\n\n IFeeDistributor public feeDistributor;\n ILiquidatorsRegistry public liquidatorsRegistry;\n uint256 public blocksPerYear;\n\n mapping(bytes4 => address) internal _positionsExtensions;\n}\n" + }, + "contracts/ionic/levered/LeveredPositionsLens.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\ncontract LeveredPositionsLens is Initializable {\n ILeveredPositionFactory public factory;\n\n function initialize(ILeveredPositionFactory _factory) external initializer {\n factory = _factory;\n }\n\n function reinitialize(ILeveredPositionFactory _factory) external reinitializer(2) {\n factory = _factory;\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns lists of the market addresses, names and symbols of the underlying assets of those collateral markets that are whitelisted\n function getCollateralMarkets()\n external\n view\n returns (\n address[] memory markets,\n IonicComptroller[] memory poolOfMarket,\n address[] memory underlyings,\n uint256[] memory underlyingPrices,\n string[] memory names,\n string[] memory symbols,\n uint8[] memory decimals,\n uint256[] memory totalUnderlyingSupplied,\n uint256[] memory ratesPerBlock\n )\n {\n markets = factory.getWhitelistedCollateralMarkets();\n poolOfMarket = new IonicComptroller[](markets.length);\n underlyings = new address[](markets.length);\n underlyingPrices = new uint256[](markets.length);\n names = new string[](markets.length);\n symbols = new string[](markets.length);\n totalUnderlyingSupplied = new uint256[](markets.length);\n decimals = new uint8[](markets.length);\n ratesPerBlock = new uint256[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = ICErc20(markets[i]);\n poolOfMarket[i] = market.comptroller();\n underlyingPrices[i] = BasePriceOracle(poolOfMarket[i].oracle()).getUnderlyingPrice(market);\n underlyings[i] = market.underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyings[i]);\n names[i] = underlying.name();\n symbols[i] = underlying.symbol();\n decimals[i] = underlying.decimals();\n totalUnderlyingSupplied[i] = market.getTotalUnderlyingSupplied();\n ratesPerBlock[i] = market.supplyRatePerBlock();\n }\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns the Rate for the chosen borrowable at the specified leverage ratio and supply amount\n function getBorrowRateAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n uint256 _equityAmount,\n uint256 _targetLeverageRatio\n ) external view returns (uint256) {\n IonicComptroller pool = IonicComptroller(_stableMarket.comptroller());\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(_stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\n\n uint256 borrowAmount = ((_targetLeverageRatio - 1e18) * _equityAmount * collateralAssetPrice) /\n (stableAssetPrice * 1e18);\n return _stableMarket.borrowRatePerBlockAfterBorrow(borrowAmount) * factory.blocksPerYear();\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns lists of the market addresses, names, symbols and the current Rate for each Borrowable asset\n function getBorrowableMarketsAndRates(\n ICErc20 _collateralMarket\n )\n external\n view\n returns (\n address[] memory markets,\n address[] memory underlyings,\n uint256[] memory underlyingsPrices,\n string[] memory names,\n string[] memory symbols,\n uint256[] memory rates,\n uint8[] memory decimals\n )\n {\n markets = factory.getBorrowableMarketsByCollateral(_collateralMarket);\n underlyings = new address[](markets.length);\n names = new string[](markets.length);\n symbols = new string[](markets.length);\n rates = new uint256[](markets.length);\n decimals = new uint8[](markets.length);\n underlyingsPrices = new uint256[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = ICErc20(markets[i]);\n address underlyingAddress = market.underlying();\n underlyings[i] = underlyingAddress;\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyingAddress);\n names[i] = underlying.name();\n symbols[i] = underlying.symbol();\n rates[i] = market.borrowRatePerBlock();\n decimals[i] = underlying.decimals();\n underlyingsPrices[i] = market.comptroller().oracle().getUnderlyingPrice(market);\n }\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n function getNetAPY(\n uint256 _supplyAPY,\n uint256 _supplyAmount,\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n uint256 _targetLeverageRatio\n ) public view returns (int256 netAPY) {\n if (_supplyAmount == 0 || _targetLeverageRatio <= 1e18) return 0;\n\n IonicComptroller pool = IonicComptroller(_collateralMarket.comptroller());\n BasePriceOracle oracle = pool.oracle();\n // TODO the calcs can be implemented without using collateralAssetPrice\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\n\n // total collateral = base collateral + levered collateral\n uint256 totalCollateral = (_supplyAmount * _targetLeverageRatio) / 1e18;\n uint256 yieldFromTotalSupplyScaled = _supplyAPY * totalCollateral;\n int256 yieldValueScaled = int256((yieldFromTotalSupplyScaled * collateralAssetPrice) / 1e18);\n\n uint256 borrowedValueScaled = (totalCollateral - _supplyAmount) * collateralAssetPrice;\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\n int256 borrowInterestValueScaled = int256((_borrowRate * borrowedValueScaled) / 1e18);\n\n int256 netValueDiffScaled = yieldValueScaled - borrowInterestValueScaled;\n\n netAPY = ((netValueDiffScaled / int256(collateralAssetPrice)) * 1e18) / int256(_supplyAmount);\n }\n\n function getPositionsInfo(\n LeveredPosition[] calldata positions,\n uint256[] calldata supplyApys\n ) external view returns (PositionInfo[] memory infos) {\n infos = new PositionInfo[](positions.length);\n for (uint256 i = 0; i < positions.length; i++) {\n infos[i] = getPositionInfo(positions[i], supplyApys[i]);\n }\n }\n\n function getLeverageRatioAfterFunding(LeveredPosition pos, uint256 newFunding) public view returns (uint256) {\n uint256 equityAmount = pos.getEquityAmount();\n if (equityAmount == 0 && newFunding == 0) return 0;\n\n uint256 suppliedCollateralCurrent = pos.collateralMarket().balanceOfUnderlying(address(pos));\n return ((suppliedCollateralCurrent + newFunding) * 1e18) / (equityAmount + newFunding);\n }\n\n function getNetApyForPositionAfterFunding(\n LeveredPosition pos,\n uint256 supplyAPY,\n uint256 newFunding\n ) public view returns (int256) {\n return\n getNetAPY(\n supplyAPY,\n pos.getEquityAmount() + newFunding,\n pos.collateralMarket(),\n pos.stableMarket(),\n getLeverageRatioAfterFunding(pos, newFunding)\n );\n }\n\n function getNetApyForPosition(LeveredPosition pos, uint256 supplyAPY) public view returns (int256) {\n return getNetApyForPositionAfterFunding(pos, supplyAPY, 0);\n }\n\n struct PositionInfo {\n uint256 collateralAssetPrice;\n uint256 borrowedAssetPrice;\n uint256 positionSupplyAmount;\n uint256 positionValue;\n uint256 debtAmount;\n uint256 debtValue;\n uint256 equityAmount;\n uint256 equityValue;\n int256 currentApy;\n uint256 debtRatio;\n uint256 liquidationThreshold;\n uint256 safetyBuffer;\n }\n\n function getPositionInfo(LeveredPosition pos, uint256 supplyApy) public view returns (PositionInfo memory info) {\n ICErc20 collateralMarket = pos.collateralMarket();\n IonicComptroller pool = pos.pool();\n info.collateralAssetPrice = pool.oracle().getUnderlyingPrice(collateralMarket);\n {\n info.positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(pos));\n info.positionValue = (info.collateralAssetPrice * info.positionSupplyAmount) / 1e18;\n info.currentApy = getNetApyForPosition(pos, supplyApy);\n }\n\n {\n ICErc20 stableMarket = pos.stableMarket();\n info.borrowedAssetPrice = pool.oracle().getUnderlyingPrice(stableMarket);\n info.debtAmount = stableMarket.borrowBalanceCurrent(address(pos));\n info.debtValue = (info.borrowedAssetPrice * info.debtAmount) / 1e18;\n info.equityValue = info.positionValue - info.debtValue;\n info.debtRatio = info.positionValue == 0 ? 0 : (info.debtValue * 1e18) / info.positionValue;\n info.equityAmount = (info.equityValue * 1e18) / info.collateralAssetPrice;\n }\n\n {\n (, uint256 collateralFactor) = pool.markets(address(collateralMarket));\n info.liquidationThreshold = collateralFactor;\n info.safetyBuffer = collateralFactor - info.debtRatio;\n }\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract LeveredPositionStorage {\n address public immutable positionOwner;\n ILeveredPositionFactory public factory;\n\n ICErc20 public collateralMarket;\n ICErc20 public stableMarket;\n IonicComptroller public pool;\n\n IERC20Upgradeable public collateralAsset;\n IERC20Upgradeable public stableAsset;\n\n constructor(address _positionOwner) {\n positionOwner = _positionOwner;\n }\n}\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\n\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\n constructor() RolesAuthority(address(0), Authority(address(0))) {\n _disableInitializers();\n }\n\n function initialize(address _owner) public initializer {\n owner = _owner;\n authority = this;\n }\n\n // up to 256 roles\n uint8 public constant REGISTRY_ROLE = 0;\n uint8 public constant SUPPLIER_ROLE = 1;\n uint8 public constant BORROWER_ROLE = 2;\n uint8 public constant LIQUIDATOR_ROLE = 3;\n uint8 public constant LEVERED_POSITION_ROLE = 4;\n\n function configureRegistryCapabilities() external requiresAuth {\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\n true\n );\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\n }\n\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, true);\n }\n\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, false);\n }\n\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\n }\n }\n }\n\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\n }\n\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\n uint8 fnsCount = 6;\n selectors = new bytes4[](fnsCount);\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return selectors;\n }\n\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\n }\n }\n }\n\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, true);\n }\n\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, false);\n }\n\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\n }\n }\n\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n // borrowers have the SUPPLIER_ROLE capabilities by default\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n // TODO this leaves redeeming open for everyone\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\n\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n}\n" + }, + "contracts/ionic/SafeOwnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\nabstract contract SafeOwnable is Ownable2Step {\n function renounceOwnership() public override onlyOwner {\n revert(\"renounce ownership not allowed\");\n }\n}\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\n/**\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\n * that will shift the other.\n */\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\n /**\n * @notice Pending owner of this contract\n */\n address public pendingOwner;\n\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\n __Ownable_init();\n _transferOwnership(owner_);\n }\n\n struct AddressSlot {\n address value;\n }\n\n modifier onlyOwnerOrAdmin() {\n bool isOwner = owner() == _msgSender();\n if (!isOwner) {\n address admin = _getProxyAdmin();\n bool isAdmin = admin == _msgSender();\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\n }\n _;\n }\n\n /**\n * @notice Emitted when pendingOwner is changed\n */\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\n\n /**\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\n */\n event NewOwner(address oldOwner, address newOwner);\n\n /**\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @param newPendingOwner New pending owner.\n */\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\n // Save current value, if any, for inclusion in log\n address oldPendingOwner = pendingOwner;\n\n // Store pendingOwner with value newPendingOwner\n pendingOwner = newPendingOwner;\n\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\n }\n\n /**\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\n * @dev Owner function for pending owner to accept role and update owner\n */\n function _acceptOwner() public {\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\n require(msg.sender == pendingOwner, \"not the pending owner\");\n\n // Save current values for inclusion in log\n address oldOwner = owner();\n address oldPendingOwner = pendingOwner;\n\n // Store owner with value pendingOwner\n _transferOwnership(pendingOwner);\n\n // Clear the pending value\n pendingOwner = address(0);\n\n emit NewOwner(oldOwner, pendingOwner);\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\n }\n\n function renounceOwnership() public override onlyOwner {\n // do not remove this overriding fn\n revert(\"not used anymore\");\n }\n\n function transferOwnership(address newOwner) public override onlyOwner {\n emit NewPendingOwner(pendingOwner, newOwner);\n pendingOwner = newOwner;\n }\n\n function _getProxyAdmin() internal view returns (address admin) {\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n AddressSlot storage adminSlot;\n assembly {\n adminSlot.slot := _ADMIN_SLOT\n }\n admin = adminSlot.value;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\n/**\n @title Balance Booster Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\n \n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\n\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\n*/\ninterface IFlywheelBooster {\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256);\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ninterface IIonicFlywheel {\n function isRewardsDistributor() external returns (bool);\n\n function isFlywheel() external returns (bool);\n\n function flywheelPreSupplierAction(address market, address supplier) external;\n\n function flywheelPostSupplierAction(address market, address supplier) external;\n\n function flywheelPreBorrowerAction(address market, address borrower) external;\n\n function flywheelPostBorrowerAction(address market, address borrower) external;\n\n function flywheelPreTransferAction(address market, address src, address dst) external;\n\n function flywheelPostTransferAction(address market, address src, address dst) external;\n\n function compAccrued(address user) external view returns (uint256);\n\n function addMarketForRewards(ERC20 strategy) external;\n\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\n/**\n @title Balance Booster Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\n \n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\n\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\n*/\ninterface IIonicFlywheelBorrowBooster {\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256);\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport \"./IIonicFlywheel.sol\";\n\ncontract IonicFlywheel is IonicFlywheelCore, IIonicFlywheel {\n bool public constant isRewardsDistributor = true;\n bool public constant isFlywheel = true;\n\n function flywheelPreSupplierAction(address market, address supplier) external {\n accrue(ERC20(market), supplier);\n }\n\n function flywheelPostSupplierAction(address market, address supplier) external {\n _updateBlacklistBalances(ERC20(market), supplier);\n }\n\n function flywheelPreBorrowerAction(address market, address borrower) external {}\n\n function flywheelPostBorrowerAction(address market, address borrower) external {}\n\n function flywheelPreTransferAction(address market, address src, address dst) external {\n accrue(ERC20(market), src, dst);\n }\n\n function flywheelPostTransferAction(address market, address src, address dst) external {\n _updateBlacklistBalances(ERC20(market), src);\n _updateBlacklistBalances(ERC20(market), dst);\n }\n\n function compAccrued(address user) external view returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrow.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport \"./IIonicFlywheel.sol\";\n\ncontract IonicFlywheelBorrow is IonicFlywheelCore, IIonicFlywheel {\n bool public constant isRewardsDistributor = true;\n bool public constant isFlywheel = true;\n\n function flywheelPreSupplierAction(address market, address supplier) external {}\n\n function flywheelPostSupplierAction(address market, address supplier) external {}\n\n function flywheelPreBorrowerAction(address market, address borrower) external {\n accrue(ERC20(market), borrower);\n }\n\n function flywheelPostBorrowerAction(address market, address borrower) external {\n _updateBlacklistBalances(ERC20(market), borrower);\n }\n\n function flywheelPreTransferAction(address market, address src, address dst) external {}\n\n function flywheelPostTransferAction(address market, address src, address dst) external {}\n\n function compAccrued(address user) external view returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport \"./IIonicFlywheelBorrowBooster.sol\";\n\ncontract IonicFlywheelBorrowBooster is IIonicFlywheelBorrowBooster {\n string public constant BOOSTER_TYPE = \"FlywheelBorrowBooster\";\n\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256) {\n return strategy.totalBorrows();\n }\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256) {\n return strategy.borrowBalanceCurrent(user);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\nimport { SafeCastLib } from \"solmate/utils/SafeCastLib.sol\";\n\nimport { IFlywheelRewards } from \"./rewards/IFlywheelRewards.sol\";\nimport { IFlywheelBooster } from \"./IFlywheelBooster.sol\";\nimport { IEmissionsManager } from \"../../../IEmissionsManager.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\n\ncontract IonicFlywheelCore is Ownable2StepUpgradeable {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n /// @notice How much rewardsToken will be send to treasury\n uint256 public performanceFee;\n\n /// @notice Address that gets rewardsToken accrued by performanceFee\n address public feeRecipient;\n\n /// @notice The token to reward\n ERC20 public rewardToken;\n\n /// @notice append-only list of strategies added\n ERC20[] public allStrategies;\n\n /// @notice the rewards contract for managing streams\n IFlywheelRewards public flywheelRewards;\n\n /// @notice optional booster module for calculating virtual balances on strategies\n IFlywheelBooster public flywheelBooster;\n\n IEmissionsManager public emissionsManager;\n\n /// @notice The accrued but not yet transferred rewards for each user\n mapping(address => uint256) internal _rewardsAccrued;\n\n /// @notice The strategy index and last updated per strategy\n mapping(ERC20 => RewardsState) internal _strategyState;\n\n /// @notice user index per strategy\n mapping(ERC20 => mapping(address => uint224)) internal _userIndex;\n\n /// @notice user blacklisted supply per strategy\n mapping(ERC20 => mapping(address => uint256)) public userBlacklistedSupply;\n\n /// @notice blacklisted supply per strategy\n mapping(ERC20 => uint256) public blacklistedSupply;\n\n modifier onlyEmissionsManager() {\n require(address(emissionsManager) == msg.sender, \"!emissionsManager\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize(\n ERC20 _rewardToken,\n IFlywheelRewards _flywheelRewards,\n IFlywheelBooster _flywheelBooster,\n address _owner\n ) public initializer {\n __Ownable2Step_init();\n\n rewardToken = _rewardToken;\n flywheelRewards = _flywheelRewards;\n flywheelBooster = _flywheelBooster;\n\n performanceFee = 10e16; // 10%\n feeRecipient = _owner;\n }\n\n /*----------------------------------------------------------------\n ACCRUE/CLAIM LOGIC\n ----------------------------------------------------------------*/\n\n /** \n @notice Emitted when a user's rewards accrue to a given strategy.\n @param strategy the updated rewards strategy\n @param user the user of the rewards\n @param rewardsDelta how many new rewards accrued to the user\n @param rewardsIndex the market index for rewards per token accrued\n */\n event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);\n\n /** \n @notice Emitted when a user claims accrued rewards.\n @param user the user of the rewards\n @param amount the amount of rewards claimed\n */\n event ClaimRewards(address indexed user, uint256 amount);\n\n /** \n @notice accrue rewards for a single user on a strategy\n @param strategy the strategy to accrue a user's rewards on\n @param user the user to be accrued\n @return the cumulative amount of rewards accrued to user (including prior)\n */\n function accrue(ERC20 strategy, address user) public returns (uint256) {\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n\n if (state.index == 0) return 0;\n\n state = accrueStrategy(strategy, state);\n return accrueUser(strategy, user, state);\n }\n\n /** \n @notice accrue rewards for a two users on a strategy\n @param strategy the strategy to accrue a user's rewards on\n @param user the first user to be accrued\n @param user the second user to be accrued\n @return the cumulative amount of rewards accrued to the first user (including prior)\n @return the cumulative amount of rewards accrued to the second user (including prior)\n */\n function accrue(ERC20 strategy, address user, address secondUser) public returns (uint256, uint256) {\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n\n if (state.index == 0) return (0, 0);\n\n state = accrueStrategy(strategy, state);\n return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));\n }\n\n /** \n @notice claim rewards for a given user\n @param user the user claiming rewards\n @dev this function is public, and all rewards transfer to the user\n */\n function claimRewards(address user) external {\n require(!emissionsManager.isUserBlacklisted(user), \"blacklisted\");\n require(!emissionsManager.isUserBlacklistable(user), \"blacklistable\");\n uint256 accrued = rewardsAccrued(user);\n\n if (accrued != 0) {\n _rewardsAccrued[user] = 0;\n\n rewardToken.safeTransferFrom(address(flywheelRewards), user, accrued);\n\n emit ClaimRewards(user, accrued);\n }\n }\n\n /** \n @notice take rewards for a given user\n @param user the user claiming rewards\n @param receiver the address that receives the rewards\n @dev this function is public, and all rewards transfer to the receiver\n */\n function takeRewardsFromUser(address user, address receiver) external onlyEmissionsManager {\n uint256 accrued = rewardsAccrued(user);\n\n if (accrued != 0) {\n _rewardsAccrued[user] = 0;\n\n rewardToken.safeTransferFrom(address(flywheelRewards), receiver, accrued);\n\n emit ClaimRewards(user, accrued);\n }\n }\n\n /** \n @notice set user balances to zero\n @param strategy strategy to whitelist user for\n @param user the user to be whitelisted\n @dev this function is public, and all user and strategy blacklisted supplies are reset\n */\n function whitelistUser(ERC20 strategy, address user) external onlyEmissionsManager {\n blacklistedSupply[strategy] -= userBlacklistedSupply[strategy][user];\n userBlacklistedSupply[strategy][user] = 0;\n }\n\n /** \n @notice update user blacklisted balances\n @param strategy strategy to update blacklisted balances\n @param user the user to be blacklisted\n @dev this function is public\n */\n function updateBlacklistBalances(ERC20 strategy, address user) external onlyEmissionsManager {\n _updateBlacklistBalances(strategy, user);\n }\n\n /** \n @notice update user blacklisted balances\n @param strategy strategy to update blacklisted balances\n @param user the user to be blacklisted\n @dev this function is private\n */\n function _updateBlacklistBalances(ERC20 strategy, address user) internal {\n if (emissionsManager.isUserBlacklisted(user)) {\n uint256 _oldUserBlacklistedSupply = userBlacklistedSupply[strategy][user];\n uint256 supplierTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedBalanceOf(ERC20(strategy), user)\n : ERC20(strategy).balanceOf(user);\n\n if (supplierTokens >= _oldUserBlacklistedSupply) {\n blacklistedSupply[strategy] += supplierTokens - _oldUserBlacklistedSupply;\n userBlacklistedSupply[strategy][user] = supplierTokens;\n } else {\n blacklistedSupply[strategy] -= _oldUserBlacklistedSupply - supplierTokens;\n userBlacklistedSupply[strategy][user] = supplierTokens;\n }\n }\n }\n /*----------------------------------------------------------------\n ADMIN LOGIC\n ----------------------------------------------------------------*/\n\n /** \n @notice Emitted when a new strategy is added to flywheel by the admin\n @param newStrategy the new added strategy\n */\n event AddStrategy(address indexed newStrategy);\n\n /// @notice initialize a new strategy\n function setEmissionsManager(IEmissionsManager _emissionsManager) external onlyOwner {\n emissionsManager = _emissionsManager;\n }\n\n /// @notice initialize a new strategy\n function addStrategyForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function _addStrategyForRewards(ERC20 strategy) internal {\n (uint224 index, ) = strategyState(strategy);\n require(index == 0, \"strategy\");\n _strategyState[strategy] = RewardsState({\n index: (10 ** rewardToken.decimals()).safeCastTo224(),\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\n });\n\n allStrategies.push(strategy);\n emit AddStrategy(address(strategy));\n }\n\n function getAllStrategies() external view returns (ERC20[] memory) {\n return allStrategies;\n }\n\n /** \n @notice Emitted when the rewards module changes\n @param newFlywheelRewards the new rewards module\n */\n event FlywheelRewardsUpdate(address indexed newFlywheelRewards);\n\n /// @notice swap out the flywheel rewards contract\n function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external onlyOwner {\n if (address(flywheelRewards) != address(0)) {\n uint256 oldRewardBalance = rewardToken.balanceOf(address(flywheelRewards));\n if (oldRewardBalance > 0) {\n rewardToken.safeTransferFrom(address(flywheelRewards), address(newFlywheelRewards), oldRewardBalance);\n }\n }\n\n flywheelRewards = newFlywheelRewards;\n\n emit FlywheelRewardsUpdate(address(newFlywheelRewards));\n }\n\n /** \n @notice Emitted when the booster module changes\n @param newBooster the new booster module\n */\n event FlywheelBoosterUpdate(address indexed newBooster);\n\n /// @notice swap out the flywheel booster contract\n function setBooster(IFlywheelBooster newBooster) external onlyOwner {\n flywheelBooster = newBooster;\n\n emit FlywheelBoosterUpdate(address(newBooster));\n }\n\n event UpdatedFeeSettings(\n uint256 oldPerformanceFee,\n uint256 newPerformanceFee,\n address oldFeeRecipient,\n address newFeeRecipient\n );\n\n /**\n * @notice Update performanceFee and/or feeRecipient\n * @dev Claim rewards first from the previous feeRecipient before changing it\n */\n function updateFeeSettings(uint256 _performanceFee, address _feeRecipient) external onlyOwner {\n _updateFeeSettings(_performanceFee, _feeRecipient);\n }\n\n function _updateFeeSettings(uint256 _performanceFee, address _feeRecipient) internal {\n emit UpdatedFeeSettings(performanceFee, _performanceFee, feeRecipient, _feeRecipient);\n\n if (feeRecipient != _feeRecipient) {\n _rewardsAccrued[_feeRecipient] += rewardsAccrued(feeRecipient);\n _rewardsAccrued[feeRecipient] = 0;\n }\n performanceFee = _performanceFee;\n feeRecipient = _feeRecipient;\n }\n\n /*----------------------------------------------------------------\n INTERNAL ACCOUNTING LOGIC\n ----------------------------------------------------------------*/\n\n struct RewardsState {\n /// @notice The strategy's last updated index\n uint224 index;\n /// @notice The timestamp the index was last updated at\n uint32 lastUpdatedTimestamp;\n }\n\n /// @notice accumulate global rewards on a strategy\n function accrueStrategy(\n ERC20 strategy,\n RewardsState memory state\n ) private returns (RewardsState memory rewardsState) {\n // calculate accrued rewards through module\n uint256 strategyRewardsAccrued = flywheelRewards.getAccruedRewards(strategy, state.lastUpdatedTimestamp);\n\n rewardsState = state;\n\n if (strategyRewardsAccrued > 0) {\n // use the booster or token supply to calculate reward index denominator\n uint256 supplyTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedTotalSupply(strategy) - blacklistedSupply[strategy]\n : strategy.totalSupply() - blacklistedSupply[strategy];\n\n // 100% = 100e16\n uint256 accruedFees = (strategyRewardsAccrued * performanceFee) / uint224(100e16);\n\n _rewardsAccrued[feeRecipient] += accruedFees;\n strategyRewardsAccrued -= accruedFees;\n\n uint224 deltaIndex;\n\n if (supplyTokens != 0)\n deltaIndex = ((strategyRewardsAccrued * (10 ** strategy.decimals())) / supplyTokens).safeCastTo224();\n\n // accumulate rewards per token onto the index, multiplied by fixed-point factor\n rewardsState = RewardsState({\n index: state.index + deltaIndex,\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\n });\n _strategyState[strategy] = rewardsState;\n }\n }\n\n /// @notice accumulate rewards on a strategy for a specific user\n function accrueUser(ERC20 strategy, address user, RewardsState memory state) private returns (uint256) {\n // load indices\n uint224 strategyIndex = state.index;\n uint224 supplierIndex = userIndex(strategy, user);\n\n // sync user index to global\n _userIndex[strategy][user] = strategyIndex;\n\n // if user hasn't yet accrued rewards, grant them interest from the strategy beginning if they have a balance\n // zero balances will have no effect other than syncing to global index\n if (supplierIndex == 0) {\n supplierIndex = (10 ** rewardToken.decimals()).safeCastTo224();\n }\n\n uint224 deltaIndex = strategyIndex - supplierIndex;\n // use the booster or token balance to calculate reward balance multiplier\n uint256 supplierTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedBalanceOf(strategy, user) - userBlacklistedSupply[strategy][user]\n : strategy.balanceOf(user) - userBlacklistedSupply[strategy][user];\n\n // accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed\n uint256 supplierDelta = (deltaIndex * supplierTokens) / (10 ** strategy.decimals());\n uint256 supplierAccrued = rewardsAccrued(user) + supplierDelta;\n\n _rewardsAccrued[user] = supplierAccrued;\n\n emit AccrueRewards(strategy, user, supplierDelta, strategyIndex);\n\n return supplierAccrued;\n }\n\n function rewardsAccrued(address user) public virtual returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function userIndex(ERC20 strategy, address user) public virtual returns (uint224) {\n return _userIndex[strategy][user];\n }\n\n function strategyState(ERC20 strategy) public virtual returns (uint224 index, uint32 lastUpdatedTimestamp) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelLensRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport { IonicComptroller } from \"../../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { PoolDirectory } from \"../../../PoolDirectory.sol\";\n\ninterface IPriceOracle_IFLR {\n function getUnderlyingPrice(ERC20 cToken) external view returns (uint256);\n\n function price(address underlying) external view returns (uint256);\n}\n\ncontract IonicFlywheelLensRouter {\n PoolDirectory public fpd;\n\n constructor(PoolDirectory _fpd) {\n fpd = _fpd;\n }\n\n struct MarketRewardsInfo {\n /// @dev comptroller oracle price of market underlying\n uint256 underlyingPrice;\n ICErc20 market;\n RewardsInfo[] rewardsInfo;\n }\n\n struct RewardsInfo {\n /// @dev rewards in `rewardToken` paid per underlying staked token in `market` per second\n uint256 rewardSpeedPerSecondPerToken;\n /// @dev comptroller oracle price of reward token\n uint256 rewardTokenPrice;\n /// @dev APR scaled by 1e18. Calculated as rewardSpeedPerSecondPerToken * rewardTokenPrice * 365.25 days / underlyingPrice * 1e18 / market.exchangeRate\n uint256 formattedAPR;\n address flywheel;\n address rewardToken;\n }\n\n function getPoolMarketRewardsInfo(IonicComptroller comptroller) external returns (MarketRewardsInfo[] memory) {\n ICErc20[] memory markets = comptroller.getAllMarkets();\n return _getMarketRewardsInfo(markets, comptroller);\n }\n\n function getMarketRewardsInfo(ICErc20[] memory markets) external returns (MarketRewardsInfo[] memory) {\n IonicComptroller pool;\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 asMarket = ICErc20(address(markets[i]));\n if (address(pool) == address(0)) pool = asMarket.comptroller();\n else require(asMarket.comptroller() == pool);\n }\n return _getMarketRewardsInfo(markets, pool);\n }\n\n function _getMarketRewardsInfo(ICErc20[] memory markets, IonicComptroller comptroller)\n internal\n returns (MarketRewardsInfo[] memory)\n {\n if (address(comptroller) == address(0) || markets.length == 0) return new MarketRewardsInfo[](0);\n\n address[] memory flywheels = comptroller.getAccruingFlywheels();\n address[] memory rewardTokens = new address[](flywheels.length);\n uint256[] memory rewardTokenPrices = new uint256[](flywheels.length);\n uint256[] memory rewardTokenDecimals = new uint256[](flywheels.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n MarketRewardsInfo[] memory infoList = new MarketRewardsInfo[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n RewardsInfo[] memory rewardsInfo = new RewardsInfo[](flywheels.length);\n\n ICErc20 market = ICErc20(address(markets[i]));\n uint256 price = oracle.price(market.underlying()); // scaled to 1e18\n\n if (i == 0) {\n for (uint256 j = 0; j < flywheels.length; j++) {\n ERC20 rewardToken = IonicFlywheelCore(flywheels[j]).rewardToken();\n rewardTokens[j] = address(rewardToken);\n rewardTokenPrices[j] = oracle.price(address(rewardToken)); // scaled to 1e18\n rewardTokenDecimals[j] = uint256(rewardToken.decimals());\n }\n }\n\n for (uint256 j = 0; j < flywheels.length; j++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\n\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\n flywheel,\n market,\n rewardTokenDecimals[j]\n );\n uint256 apr = getApr(\n rewardSpeedPerSecondPerToken,\n rewardTokenPrices[j],\n price, \n market.exchangeRateCurrent(),\n address(flywheel.flywheelBooster()) != address(0)\n );\n\n rewardsInfo[j] = RewardsInfo({\n rewardSpeedPerSecondPerToken: rewardSpeedPerSecondPerToken, // scaled in 1e18\n rewardTokenPrice: rewardTokenPrices[j],\n formattedAPR: apr, // scaled in 1e18\n flywheel: address(flywheel),\n rewardToken: rewardTokens[j]\n });\n }\n\n infoList[i] = MarketRewardsInfo({ market: market, rewardsInfo: rewardsInfo, underlyingPrice: price });\n }\n\n return infoList;\n }\n\n function scaleIndexDiff(uint256 indexDiff, uint256 decimals) internal pure returns (uint256) {\n return decimals <= 18 ? uint256(indexDiff) * (10**(18 - decimals)) : uint256(indexDiff) / (10**(decimals - 18));\n }\n\n function getRewardSpeedPerSecondPerToken(\n IonicFlywheelCore flywheel,\n ICErc20 market,\n uint256 decimals\n ) internal returns (uint256 rewardSpeedPerSecondPerToken) {\n ERC20 strategy = ERC20(address(market));\n (uint224 indexBefore, uint32 lastUpdatedTimestampBefore) = flywheel.strategyState(strategy);\n flywheel.accrue(strategy, address(0));\n (uint224 indexAfter, uint32 lastUpdatedTimestampAfter) = flywheel.strategyState(strategy);\n if (lastUpdatedTimestampAfter > lastUpdatedTimestampBefore) {\n rewardSpeedPerSecondPerToken =\n scaleIndexDiff((indexAfter - indexBefore), decimals) /\n (lastUpdatedTimestampAfter - lastUpdatedTimestampBefore);\n }\n }\n\n function getApr(\n uint256 rewardSpeedPerSecondPerToken,\n uint256 rewardTokenPrice,\n uint256 underlyingPrice,\n uint256 exchangeRate,\n bool isBorrow\n ) internal pure returns (uint256) {\n if (rewardSpeedPerSecondPerToken == 0) return 0;\n uint256 nativeSpeedPerSecondPerCToken = rewardSpeedPerSecondPerToken * rewardTokenPrice; // scaled to 1e36\n uint256 nativeSpeedPerYearPerCToken = nativeSpeedPerSecondPerCToken * 365.25 days; // scaled to 1e36\n uint256 assetSpeedPerYearPerCToken = nativeSpeedPerYearPerCToken / underlyingPrice; // scaled to 1e18\n uint256 assetSpeedPerYearPerCTokenScaled = assetSpeedPerYearPerCToken * 1e18; // scaled to 1e36\n uint256 apr = assetSpeedPerYearPerCTokenScaled;\n if (!isBorrow) {\n // if not borrowing, use exchange rate to scale\n apr = assetSpeedPerYearPerCTokenScaled / exchangeRate; // scaled to 1e18\n } else {\n apr = assetSpeedPerYearPerCTokenScaled / 1e18; // scaled to 1e18\n }\n return apr;\n }\n\n function getRewardsAprForMarket(ICErc20 market) internal returns (int256 totalMarketRewardsApr) {\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n uint256 underlyingPrice = oracle.getUnderlyingPrice(market);\n\n address[] memory flywheels = comptroller.getAccruingFlywheels();\n for (uint256 j = 0; j < flywheels.length; j++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\n ERC20 rewardToken = flywheel.rewardToken();\n\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\n flywheel,\n market,\n uint256(rewardToken.decimals())\n );\n\n uint256 marketApr = getApr(\n rewardSpeedPerSecondPerToken,\n oracle.price(address(rewardToken)),\n underlyingPrice,\n market.exchangeRateCurrent(),\n address(flywheel.flywheelBooster()) != address(0)\n );\n\n totalMarketRewardsApr += int256(marketApr);\n }\n }\n\n function getUserNetValueDeltaForMarket(\n address user,\n ICErc20 market,\n int256 offchainApr,\n int256 blocksPerYear\n ) internal returns (int256) {\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n int256 netApr = getRewardsAprForMarket(market) +\n getUserInterestAprForMarket(user, market, blocksPerYear) +\n offchainApr;\n return (netApr * int256(market.balanceOfUnderlying(user)) * int256(oracle.getUnderlyingPrice(market))) / 1e36;\n }\n\n function getUserInterestAprForMarket(\n address user,\n ICErc20 market,\n int256 blocksPerYear\n ) internal returns (int256) {\n uint256 borrows = market.borrowBalanceCurrent(user);\n uint256 supplied = market.balanceOfUnderlying(user);\n uint256 supplyRatePerBlock = market.supplyRatePerBlock();\n uint256 borrowRatePerBlock = market.borrowRatePerBlock();\n\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n uint256 assetPrice = oracle.getUnderlyingPrice(market);\n uint256 collateralValue = (supplied * assetPrice) / 1e18;\n uint256 borrowsValue = (borrows * assetPrice) / 1e18;\n\n uint256 yieldValuePerBlock = collateralValue * supplyRatePerBlock;\n uint256 interestOwedValuePerBlock = borrowsValue * borrowRatePerBlock;\n\n if (collateralValue == 0) return 0;\n return ((int256(yieldValuePerBlock) - int256(interestOwedValuePerBlock)) * blocksPerYear) / int256(collateralValue);\n }\n\n struct AdjustedUserNetAprVars {\n int256 userNetAssetsValue;\n int256 userNetValueDelta;\n BasePriceOracle oracle;\n ICErc20[] markets;\n IonicComptroller pool;\n }\n\n function getAdjustedUserNetApr(\n address user,\n int256 blocksPerYear,\n address[] memory offchainRewardsAprMarkets,\n int256[] memory offchainRewardsAprs\n ) public returns (int256) {\n AdjustedUserNetAprVars memory vars;\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n vars.oracle = pool.oracle();\n vars.markets = pool.getAllMarkets();\n for (uint256 j = 0; j < vars.markets.length; j++) {\n int256 offchainRewardsApr = 0;\n for (uint256 k = 0; k < offchainRewardsAprMarkets.length; k++) {\n if (offchainRewardsAprMarkets[k] == address(vars.markets[j])) offchainRewardsApr = offchainRewardsAprs[k];\n }\n vars.userNetAssetsValue +=\n int256(vars.markets[j].balanceOfUnderlying(user) * vars.oracle.getUnderlyingPrice(vars.markets[j])) /\n 1e18;\n vars.userNetValueDelta += getUserNetValueDeltaForMarket(\n user,\n vars.markets[j],\n offchainRewardsApr,\n blocksPerYear\n );\n }\n }\n\n if (vars.userNetAssetsValue == 0) return 0;\n else return (vars.userNetValueDelta * 1e18) / vars.userNetAssetsValue;\n }\n\n function getUserNetApr(address user, int256 blocksPerYear) external returns (int256) {\n address[] memory emptyAddrArray = new address[](0);\n int256[] memory emptyIntArray = new int256[](0);\n return getAdjustedUserNetApr(user, blocksPerYear, emptyAddrArray, emptyIntArray);\n }\n\n function getAllRewardTokens() public view returns (address[] memory uniqueRewardTokens) {\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n uint256 rewardTokensCounter;\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address[] memory fws = pool.getRewardsDistributors();\n\n rewardTokensCounter += fws.length;\n }\n\n address[] memory rewardTokens = new address[](rewardTokensCounter);\n\n uint256 uniqueRewardTokensCounter = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address[] memory fws = pool.getRewardsDistributors();\n\n for (uint256 j = 0; j < fws.length; j++) {\n address rwToken = address(IonicFlywheelCore(fws[j]).rewardToken());\n if (rwToken == address(0)) break;\n\n bool added;\n for (uint256 k = 0; k < rewardTokens.length; k++) {\n if (rwToken == rewardTokens[k]) {\n added = true;\n break;\n }\n }\n if (!added) rewardTokens[uniqueRewardTokensCounter++] = rwToken;\n }\n }\n\n uniqueRewardTokens = new address[](uniqueRewardTokensCounter);\n for (uint256 i = 0; i < uniqueRewardTokensCounter; i++) {\n uniqueRewardTokens[i] = rewardTokens[i];\n }\n }\n\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory) {\n address[] memory rewardTokens = getAllRewardTokens();\n uint256[] memory rewardsClaimedForToken = new uint256[](rewardTokens.length);\n\n for (uint256 i = 0; i < rewardTokens.length; i++) {\n rewardsClaimedForToken[i] = claimRewardsOfRewardToken(user, rewardTokens[i]);\n }\n\n return (rewardTokens, rewardsClaimedForToken);\n }\n\n function claimRewardsOfRewardToken(address user, address rewardToken) public returns (uint256 rewardsClaimed) {\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(user);\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ERC20[] memory markets;\n {\n ICErc20[] memory cerc20s = pool.getAllMarkets();\n markets = new ERC20[](cerc20s.length);\n for (uint256 j = 0; j < cerc20s.length; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n }\n\n address[] memory flywheelAddresses = pool.getAccruingFlywheels();\n for (uint256 k = 0; k < flywheelAddresses.length; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == rewardToken) {\n for (uint256 m = 0; m < markets.length; m++) {\n flywheel.accrue(markets[m], user);\n }\n flywheel.claimRewards(user);\n }\n }\n }\n\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(user);\n return balanceAfter - balanceBefore;\n }\n\n function claimRewardsForMarket(\n address user,\n ERC20 market,\n IonicFlywheelCore[] calldata flywheels,\n bool[] calldata accrue\n )\n external\n returns (\n IonicFlywheelCore[] memory,\n address[] memory rewardTokens,\n uint256[] memory rewards\n )\n {\n uint256 size = flywheels.length;\n rewards = new uint256[](size);\n rewardTokens = new address[](size);\n\n for (uint256 i = 0; i < size; i++) {\n uint256 newRewards;\n if (accrue[i]) {\n newRewards = flywheels[i].accrue(market, user);\n } else {\n newRewards = flywheels[i].rewardsAccrued(user);\n }\n\n // Take the max, because rewards are cumulative.\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\n\n flywheels[i].claimRewards(user);\n rewardTokens[i] = address(flywheels[i].rewardToken());\n }\n\n return (flywheels, rewardTokens, rewards);\n }\n\n function claimRewardsForPool(address user, IonicComptroller comptroller)\n public\n returns (\n IonicFlywheelCore[] memory,\n address[] memory,\n uint256[] memory\n )\n {\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\n ERC20[] memory markets = new ERC20[](cerc20s.length);\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](flywheelAddresses.length);\n bool[] memory accrue = new bool[](flywheelAddresses.length);\n\n for (uint256 j = 0; j < flywheelAddresses.length; j++) {\n flywheels[j] = IonicFlywheelCore(flywheelAddresses[j]);\n accrue[j] = true;\n }\n\n for (uint256 j = 0; j < cerc20s.length; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n\n return claimRewardsForMarkets(user, markets, flywheels, accrue);\n }\n\n function claimRewardsForMarkets(\n address user,\n ERC20[] memory markets,\n IonicFlywheelCore[] memory flywheels,\n bool[] memory accrue\n )\n public\n returns (\n IonicFlywheelCore[] memory,\n address[] memory rewardTokens,\n uint256[] memory rewards\n )\n {\n rewards = new uint256[](flywheels.length);\n rewardTokens = new address[](flywheels.length);\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n for (uint256 j = 0; j < markets.length; j++) {\n ERC20 market = markets[j];\n\n uint256 newRewards;\n if (accrue[i]) {\n newRewards = flywheels[i].accrue(market, user);\n } else {\n newRewards = flywheels[i].rewardsAccrued(user);\n }\n\n // Take the max, because rewards are cumulative.\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\n }\n\n flywheels[i].claimRewards(user);\n rewardTokens[i] = address(flywheels[i].rewardToken());\n }\n\n return (flywheels, rewardTokens, rewards);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/LooplessFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"./IFlywheelBooster.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\ncontract LooplessFlywheelBooster is IFlywheelBooster {\n string public constant BOOSTER_TYPE = \"LooplessFlywheelBooster\";\n\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256) {\n return strategy.totalSupply();\n }\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256) {\n uint256 cTokensBalance = strategy.balanceOf(user);\n ICErc20 asMarket = ICErc20(address(strategy));\n uint256 cTokensBorrow = (asMarket.borrowBalanceCurrent(user) * 1e18) / asMarket.exchangeRateCurrent();\n return (cTokensBalance > cTokensBorrow) ? cTokensBalance - cTokensBorrow : 0;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {IFlywheelRewards} from \"./IFlywheelRewards.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/** \n @title Flywheel Reward Module\n @notice Determines how many rewards accrue to each strategy globally over a given time period.\n @dev approves the flywheel core for the reward token to allow balances to be managed by the module but claimed from core.\n*/\nabstract contract BaseFlywheelRewards is IFlywheelRewards {\n using SafeTransferLib for ERC20;\n\n /// @notice thrown when caller is not the flywheel\n error FlywheelError();\n\n /// @notice the reward token paid\n ERC20 public immutable override rewardToken;\n\n /// @notice the flywheel core contract\n IonicFlywheelCore public immutable override flywheel;\n\n constructor(IonicFlywheelCore _flywheel) {\n flywheel = _flywheel;\n ERC20 _rewardToken = _flywheel.rewardToken();\n rewardToken = _rewardToken;\n\n _rewardToken.safeApprove(address(_flywheel), type(uint256).max);\n }\n\n modifier onlyFlywheel() {\n if (msg.sender != address(flywheel)) revert FlywheelError();\n _;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\n\n/** \n @title Flywheel Dynamic Reward Stream\n @notice Determines rewards based on a dynamic reward stream.\n Rewards are transferred linearly over a \"rewards cycle\" to prevent gaming the reward distribution. \n The reward source can be arbitrary logic, but most common is to \"pass through\" rewards from some other source.\n The getNextCycleRewards() hook should also transfer the next cycle's rewards to this contract to ensure proper accounting.\n*/\nabstract contract FlywheelDynamicRewards is BaseFlywheelRewards {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n event NewRewardsCycle(uint32 indexed start, uint32 indexed end, uint192 reward);\n\n /// @notice the length of a rewards cycle\n uint32 public immutable rewardsCycleLength;\n\n struct RewardsCycle {\n uint32 start;\n uint32 end;\n uint192 reward;\n }\n\n mapping(ERC20 => RewardsCycle) public rewardsCycle;\n\n constructor(IonicFlywheelCore _flywheel, uint32 _rewardsCycleLength) BaseFlywheelRewards(_flywheel) {\n rewardsCycleLength = _rewardsCycleLength;\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param strategy the strategy to accrue rewards for\n @return amount the amount of tokens accrued and transferred\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\n external\n override\n onlyFlywheel\n returns (uint256 amount)\n {\n RewardsCycle memory cycle = rewardsCycle[strategy];\n\n uint32 timestamp = block.timestamp.safeCastTo32();\n\n uint32 latest = timestamp >= cycle.end ? cycle.end : timestamp;\n uint32 earliest = lastUpdatedTimestamp <= cycle.start ? cycle.start : lastUpdatedTimestamp;\n if (cycle.end != 0) {\n amount = (cycle.reward * (latest - earliest)) / (cycle.end - cycle.start);\n assert(amount <= cycle.reward); // should never happen because latest <= cycle.end and earliest >= cycle.start\n }\n // if cycle has ended, reset cycle and transfer all available\n if (timestamp >= cycle.end) {\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\n uint192 rewards = getNextCycleRewards(strategy);\n\n // reset for next cycle\n rewardsCycle[strategy] = RewardsCycle({start: timestamp, end: end, reward: rewards});\n\n emit NewRewardsCycle(timestamp, end, rewards);\n }\n }\n\n function getNextCycleRewards(ERC20 strategy) internal virtual returns (uint192);\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelInstantRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { BaseFlywheelRewards } from \"./BaseFlywheelRewards.sol\";\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\n\n/**\n * @title FlywheelInstantRewards\n * @author Jourdan DUnkley (https://github.com/jourdanDunkley)\n * @notice This contract handles the instant reward distribution for strategies.\n * It allows setting and transferring rewards for specific strategies.\n */\ncontract FlywheelInstantRewards is Auth, BaseFlywheelRewards {\n using SafeTransferLib for ERC20;\n\n event RewardsSet(ERC20 indexed strategy, uint256 amount);\n\n /// @notice Mapping to store the reward amount for each strategy.\n mapping(ERC20 => uint256) rewardAmount;\n /// @notice Mapping to track if a strategy has new rewards to be distributed.\n mapping(ERC20 => bool) rewardsNew;\n\n /**\n * @notice Constructor to initialize the FlywheelInstantRewards contract.\n * @param _flywheel The flywheel core contract.\n * @param _owner The owner of the contract.\n * @param _authority The authority contract for authentication.\n */\n constructor(\n IonicFlywheelCore _flywheel,\n address _owner,\n Authority _authority\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\n\n /**\n * @notice Set the reward amount for a specific strategy.\n * @param _amount The amount of rewards to be set for the strategy.\n * @param _strategy The strategy for which the rewards are being set.\n * @dev Requires authentication to execute.\n */\n function setRewards(ERC20 _strategy, uint256 _amount) external requiresAuth {\n rewardAmount[_strategy] = _amount;\n rewardsNew[_strategy] = true;\n rewardToken.safeTransferFrom(msg.sender, address(this), _amount);\n emit RewardsSet(_strategy, _amount);\n }\n\n /**\n * @notice Calculate and transfer accrued rewards to the flywheel core.\n * @param strategy The strategy to accrue rewards for.\n * @return amount The amount of tokens accrued and transferred.\n * @dev This function can only be called by the flywheel core.\n */\n function getAccruedRewards(\n ERC20 strategy,\n uint32 /* lastUpdatedTimestamp */\n ) external override onlyFlywheel returns (uint256 amount) {\n if (rewardsNew[strategy]) {\n amount = rewardAmount[strategy];\n rewardsNew[strategy] = false;\n } else {\n amount = 0;\n }\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\nimport {ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/** \n @title Flywheel Static Reward Stream\n @notice Determines rewards per strategy based on a fixed reward rate per second\n*/\ncontract FlywheelStaticRewards is Auth, BaseFlywheelRewards {\n event RewardsInfoUpdate(ERC20 indexed strategy, uint224 rewardsPerSecond, uint32 rewardsEndTimestamp);\n\n struct RewardsInfo {\n /// @notice Rewards per second\n uint224 rewardsPerSecond;\n /// @notice The timestamp the rewards end at\n /// @dev use 0 to specify no end\n uint32 rewardsEndTimestamp;\n }\n\n /// @notice rewards info per strategy\n mapping(ERC20 => RewardsInfo) public rewardsInfo;\n\n constructor(\n IonicFlywheelCore _flywheel,\n address _owner,\n Authority _authority\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\n\n /**\n @notice set rewards per second and rewards end time for Fei Rewards\n @param strategy the strategy to accrue rewards for\n @param rewards the rewards info for the strategy\n */\n function setRewardsInfo(ERC20 strategy, RewardsInfo calldata rewards) external requiresAuth {\n rewardsInfo[strategy] = rewards;\n emit RewardsInfoUpdate(strategy, rewards.rewardsPerSecond, rewards.rewardsEndTimestamp);\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param strategy the strategy to accrue rewards for\n @param lastUpdatedTimestamp the last updated time for strategy\n @return amount the amount of tokens accrued and transferred\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\n external\n view\n override\n onlyFlywheel\n returns (uint256 amount)\n {\n RewardsInfo memory rewards = rewardsInfo[strategy];\n\n uint256 elapsed;\n if (rewards.rewardsEndTimestamp == 0 || rewards.rewardsEndTimestamp > block.timestamp) {\n elapsed = block.timestamp - lastUpdatedTimestamp;\n } else if (rewards.rewardsEndTimestamp > lastUpdatedTimestamp) {\n elapsed = rewards.rewardsEndTimestamp - lastUpdatedTimestamp;\n }\n\n amount = rewards.rewardsPerSecond * elapsed;\n }\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/IFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/**\n @title Rewards Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Rewards module is responsible for:\n * determining the ongoing reward amounts to entire strategies (core handles the logic for dividing among users)\n * actually holding rewards that are yet to be claimed\n\n The reward stream can follow arbitrary logic as long as the amount of rewards passed to flywheel core has been sent to this contract.\n\n Different module strategies include:\n * a static reward rate per second\n * a decaying reward rate\n * a dynamic just-in-time reward stream\n * liquid governance reward delegation (Curve Gauge style)\n\n SECURITY NOTE: The rewards strategy should be smooth and continuous, to prevent gaming the reward distribution by frontrunning.\n */\ninterface IFlywheelRewards {\n /**\n @notice calculate the rewards amount accrued to a strategy since the last update.\n @param strategy the strategy to accrue rewards for.\n @param lastUpdatedTimestamp the last time rewards were accrued for the strategy.\n @return rewards the amount of rewards accrued to the market\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);\n\n /// @notice return the flywheel core address\n function flywheel() external view returns (IonicFlywheelCore);\n\n /// @notice return the reward token associated with flywheel core.\n function rewardToken() external view returns (ERC20);\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { FlywheelDynamicRewards } from \"./FlywheelDynamicRewards.sol\";\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\n\ncontract IonicFlywheelDynamicRewards is FlywheelDynamicRewards {\n using SafeTransferLib for ERC20;\n\n address public owner;\n mapping(address => address) public rewardAccumulators;\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"You are not the owner\");\n _;\n }\n\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\n FlywheelDynamicRewards(_flywheel, _cycleLength)\n {\n owner = msg.sender;\n }\n\n function setRewardAccumulators(address[] memory _strategies, address[] memory _rewardAccumulators) external onlyOwner {\n uint256 _length = _strategies.length;\n require(_rewardAccumulators.length == _length, \"parameters\");\n for (uint256 i = 0; i < _length; i++) {\n rewardAccumulators[_strategies[i]] = _rewardAccumulators[i];\n }\n }\n\n function getNextCycleRewards(ERC20 strategy)\n internal\n override\n returns (uint192)\n {\n address rewardAccumulator = rewardAccumulators[address(strategy)];\n uint256 rewardAmount = rewardToken.balanceOf(rewardAccumulator);\n if (rewardAmount != 0) {\n rewardToken.safeTransferFrom(\n rewardAccumulator,\n address(this),\n rewardAmount\n );\n }\n return uint192(rewardAmount);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"./FlywheelDynamicRewards.sol\";\n\ninterface ICERC20 {\n function plugin() external returns (address);\n}\n\ninterface IPlugin_FDR {\n function claimRewards() external;\n}\n\n/** \n @title Ionic Flywheel Dynamic Reward Stream\n @notice Determines rewards based on reward cycle\n Each cycle, claims rewards on the plugin before getting the reward amount\n*/\ncontract IonicFlywheelDynamicRewardsPlugin is FlywheelDynamicRewards {\n using SafeTransferLib for ERC20;\n\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\n FlywheelDynamicRewards(_flywheel, _cycleLength)\n {}\n\n function getNextCycleRewards(ERC20 strategy)\n internal\n override\n returns (uint192)\n {\n IPlugin_FDR plugin = IPlugin_FDR(ICERC20(address(strategy)).plugin());\n try plugin.claimRewards() {} catch {}\n\n uint256 rewardAmount = rewardToken.balanceOf(address(strategy));\n if (rewardAmount != 0) {\n rewardToken.safeTransferFrom(\n address(strategy),\n address(this),\n rewardAmount\n );\n }\n return uint192(rewardAmount);\n }\n}" + }, + "contracts/ionic/strategies/IonicERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport { PausableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol\";\nimport { ERC4626Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nabstract contract IonicERC4626 is SafeOwnableUpgradeable, PausableUpgradeable, ERC4626Upgradeable {\n using FixedPointMathLib for uint256;\n using SafeERC20Upgradeable for ERC20Upgradeable;\n\n /* ========== STATE VARIABLES ========== */\n\n uint256 public vaultShareHWM;\n uint256 public performanceFee;\n address public feeRecipient;\n\n /* ========== EVENTS ========== */\n\n event UpdatedFeeSettings(\n uint256 oldPerformanceFee,\n uint256 newPerformanceFee,\n address oldFeeRecipient,\n address newFeeRecipient\n );\n\n /* ========== INITIALIZER ========== */\n\n function __IonicER4626_init(ERC20Upgradeable asset_) internal onlyInitializing {\n __SafeOwnable_init(msg.sender);\n __Pausable_init();\n __Context_init();\n __ERC20_init(\n string(abi.encodePacked(\"Ionic \", asset_.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", asset_.symbol()))\n );\n __ERC4626_init(asset_);\n\n vaultShareHWM = 10 ** asset_.decimals();\n feeRecipient = msg.sender;\n }\n\n function _asset() internal view returns (ERC20Upgradeable) {\n return ERC20Upgradeable(super.asset());\n }\n\n /* ========== DEPOSIT/WITHDRAW FUNCTIONS ========== */\n\n function deposit(uint256 assets, address receiver) public override whenNotPaused returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n _asset().safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public override whenNotPaused returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n _asset().safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\n }\n\n if (!paused()) {\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\n\n beforeWithdraw(assets, shares);\n\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\n }\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n _asset().safeTransfer(receiver, assets);\n }\n\n function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n if (!paused()) {\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\n\n beforeWithdraw(assets, shares);\n\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\n }\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n _asset().safeTransfer(receiver, assets);\n }\n\n /* ========== FEE FUNCTIONS ========== */\n\n /**\n * @notice Take the performance fee that has accrued since last fee harvest.\n * @dev Performance fee is based on a vault share high water mark value. If vault share value has increased above the\n * HWM in a fee period, issue fee shares to the vault equal to the performance fee.\n */\n function takePerformanceFee() external onlyOwner {\n require(feeRecipient != address(0), \"fee recipient not initialized\");\n\n uint256 currentAssets = totalAssets();\n uint256 shareValue = convertToAssets(10 ** _asset().decimals());\n\n require(shareValue > vaultShareHWM, \"shareValue !> vaultShareHWM\");\n // cache value\n uint256 supply = totalSupply();\n\n uint256 accruedPerformanceFee = (performanceFee * (shareValue - vaultShareHWM) * supply) / 1e36;\n _mint(feeRecipient, accruedPerformanceFee.mulDivDown(supply, (currentAssets - accruedPerformanceFee)));\n\n vaultShareHWM = convertToAssets(10 ** _asset().decimals());\n }\n\n /**\n * @notice Transfer accrued fees to rewards manager contract. Caller must be a registered keeper.\n * @dev We must make sure that feeRecipient is not address(0) before withdrawing fees\n */\n function withdrawAccruedFees() external onlyOwner {\n redeem(balanceOf(feeRecipient), feeRecipient, feeRecipient);\n }\n\n /**\n * @notice Update performanceFee and/or feeRecipient\n */\n function updateFeeSettings(uint256 newPerformanceFee, address newFeeRecipient) external onlyOwner {\n emit UpdatedFeeSettings(performanceFee, newPerformanceFee, feeRecipient, newFeeRecipient);\n\n performanceFee = newPerformanceFee;\n\n if (newFeeRecipient != feeRecipient) {\n if (feeRecipient != address(0)) {\n uint256 oldFees = balanceOf(feeRecipient);\n\n _burn(feeRecipient, oldFees);\n _approve(feeRecipient, owner(), 0);\n _mint(newFeeRecipient, oldFees);\n }\n\n _approve(newFeeRecipient, owner(), type(uint256).max);\n }\n\n feeRecipient = newFeeRecipient;\n }\n\n /* ========== EMERGENCY FUNCTIONS ========== */\n\n // Should withdraw all funds from the strategy and pause the contract\n function emergencyWithdrawAndPause() external virtual;\n\n function unpause() external virtual;\n\n function shutdown(address market) external onlyOwner whenPaused returns (uint256) {\n ERC20Upgradeable theAsset = _asset();\n uint256 endBalance = theAsset.balanceOf(address(this));\n theAsset.transfer(market, endBalance);\n return endBalance;\n }\n\n /* ========== INTERNAL HOOKS LOGIC ========== */\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual;\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual;\n}\n" + }, + "contracts/ionic/strategies/MockERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\n/**\n * @title Mock ERC4626 Contract\n * @notice ERC4626 wrapper for Tribe Token\n * @author carlomazzaferro\n *\n */\ncontract MockERC4626 is ERC4626 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /**\n @notice Creates a new Vault that accepts a specific underlying token.\n @param _asset The ERC20 compliant token the Vault should accept.\n */\n constructor(ERC20 _asset)\n ERC4626(\n _asset,\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", _asset.symbol()))\n )\n {}\n\n /* ========== VIEWS ========== */\n\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\n /// @return The total amount of underlying tokens the Vault holds.\n function totalAssets() public view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @notice Calculates the total amount of underlying tokens the user holds.\n /// @return The total amount of underlying tokens the user holds.\n function balanceOfUnderlying(address account) public view returns (uint256) {\n return convertToAssets(balanceOf[account]);\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function afterDeposit(uint256 amount, uint256) internal override {}\n\n function beforeWithdraw(uint256, uint256 shares) internal override {}\n}\n" + }, + "contracts/ionic/strategies/MockERC4626Dynamic.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { IonicFlywheelCore } from \"./flywheel/IonicFlywheelCore.sol\";\n\n/**\n * @title Mock ERC4626 Contract\n * @notice ERC4626 wrapper for Tribe Token\n * @author carlomazzaferro\n *\n */\ncontract MockERC4626Dynamic is ERC4626 {\n using FixedPointMathLib for uint256;\n\n /* ========== STATE VARIABLES ========== */\n IonicFlywheelCore public immutable flywheel;\n\n /* ========== INITIALIZER ========== */\n\n /**\n @notice Initializes the Vault.\n @param _asset The ERC20 compliant token the Vault should accept.\n @param _flywheel Flywheel to pull in rewardsToken\n */\n constructor(ERC20 _asset, IonicFlywheelCore _flywheel)\n ERC4626(\n _asset,\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", _asset.symbol()))\n )\n {\n flywheel = _flywheel;\n }\n\n /* ========== VIEWS ========== */\n\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\n /// @return The total amount of underlying tokens the Vault holds.\n function totalAssets() public view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @notice Calculates the total amount of underlying tokens the user holds.\n /// @return The total amount of underlying tokens the user holds.\n function balanceOfUnderlying(address account) public view returns (uint256) {\n return convertToAssets(balanceOf[account]);\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function afterDeposit(uint256 amount, uint256) internal override {}\n\n function beforeWithdraw(uint256, uint256 shares) internal override {}\n}\n" + }, + "contracts/IonicLiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./utils/IW_NATIVE.sol\";\n\nimport \"./external/uniswap/IUniswapV2Router02.sol\";\nimport \"./external/uniswap/IUniswapV2Pair.sol\";\nimport \"./external/uniswap/IUniswapV2Callee.sol\";\nimport \"./external/uniswap/UniswapV2Library.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicLiquidator\n * @author David Lucid (https://github.com/davidlucid)\n * @notice IonicLiquidator safely liquidates unhealthy borrowers (with flashloan support).\n * @dev Do not transfer NATIVE or tokens directly to this address. Only send NATIVE here when using a method, and only approve tokens for transfer to here when using a method. Direct NATIVE transfers will be rejected and direct token transfers will be lost.\n */\ncontract IonicLiquidator is OwnableUpgradeable, ILiquidator, IUniswapV2Callee, IExpressRelayFeeReceiver {\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n\n /**\n * @dev W_NATIVE contract address.\n */\n address public W_NATIVE_ADDRESS;\n\n /**\n * @dev UniswapV2Router02 contract object. (Is interchangable with any UniV2 forks)\n */\n IUniswapV2Router02 public UNISWAP_V2_ROUTER_02;\n\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n mapping(address => bool) public redemptionStrategiesWhitelist;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n /**\n * @dev Percentage of the flash swap fee, measured in basis points.\n */\n uint8 public flashSwapFee;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _uniswapV2router, uint8 _flashSwapFee) external initializer {\n __Ownable_init();\n require(_uniswapV2router != address(0), \"_uniswapV2router not defined.\");\n W_NATIVE_ADDRESS = _wtoken;\n UNISWAP_V2_ROUTER_02 = IUniswapV2Router02(_uniswapV2router);\n flashSwapFee = _flashSwapFee;\n }\n\n function _becomeImplementation(bytes calldata data) external {}\n\n /**\n * @dev Internal function to approve unlimited tokens of `erc20Contract` to `to`.\n */\n function safeApprove(IERC20Upgradeable token, address to, uint256 minAmount) private {\n uint256 allowance = token.allowance(address(this), to);\n\n if (allowance < minAmount) {\n if (allowance > 0) token.safeApprove(to, 0);\n token.safeApprove(to, type(uint256).max);\n }\n }\n\n /**\n * @dev Internal function to approve\n */\n function justApprove(IERC20Upgradeable token, address to, uint256 amount) private {\n token.approve(to, amount);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n justApprove(underlying, address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan, confirming that at least `minProfitAmount` in NATIVE profit is seized.\n * @param vars @see LiquidateToTokensWithFlashSwapVars.\n */\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV2Pair flashSwapPair = IUniswapV2Pair(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPair.token0() == address(fundingToken);\n flashSwapPair.swap(\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n address(this),\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n function uniswapV2Call(address, uint256, uint256, bytes calldata data) public override {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars);\n }\n\n /**\n * @dev Callback function for PCS flashloans.\n */\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uniswapV2Call(sender, amount0, amount1, data);\n }\n\n function moraswapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uniswapV2Call(sender, amount0, amount1, data);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(LiquidateToTokensWithFlashSwapVars memory vars) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n justApprove(IERC20Upgradeable(underlyingBorrow), address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData\n ) private returns (address) {\n // Calculate flashloan return amount\n uint256 flashSwapReturnAmount = (_flashSwapAmount * 10000) / (10000 - flashSwapFee);\n if ((_flashSwapAmount * 10000) % (10000 - flashSwapFee) > 0) flashSwapReturnAmount++; // Round up if division resulted in a remainder\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n IUniswapV2Pair pair = IUniswapV2Pair(msg.sender);\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pair.token0() || address(underlyingCollateral) == pair.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay amount for the borrow side\n collateralRequired = flashSwapReturnAmount;\n } else {\n // repay amount for the non-borrow side\n collateralRequired = UniswapV2Library.getAmountsIn(\n UNISWAP_V2_ROUTER_02.factory(),\n _flashSwapAmount, //flashSwapReturnAmount,\n array(address(underlyingCollateral), _flashSwapToken),\n flashSwapFee\n )[0];\n }\n\n // Repay flashloan\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n require(\n underlyingCollateral.transfer(msg.sender, collateralRequired),\n \"Failed to repay token flashloan on borrow side.\"\n );\n\n return address(underlyingCollateral);\n } else {\n // exchange the collateral to W_NATIVE to repay the borrow side\n uint256 wethRequired;\n if (_flashSwapToken == W_NATIVE_ADDRESS) {\n wethRequired = flashSwapReturnAmount;\n } else {\n // Get W_NATIVE required to repay flashloan\n wethRequired = UniswapV2Library.getAmountsIn(\n UNISWAP_V2_ROUTER_02.factory(),\n flashSwapReturnAmount,\n array(W_NATIVE_ADDRESS, _flashSwapToken),\n flashSwapFee\n )[0];\n }\n\n if (address(underlyingCollateral) != W_NATIVE_ADDRESS) {\n // Approve to Uniswap router\n justApprove(underlyingCollateral, address(UNISWAP_V2_ROUTER_02), underlyingCollateralSeized);\n\n // Swap collateral tokens for W_NATIVE to be repaid via Uniswap router\n UNISWAP_V2_ROUTER_02.swapTokensForExactTokens(\n wethRequired,\n underlyingCollateralSeized,\n array(address(underlyingCollateral), W_NATIVE_ADDRESS),\n address(this),\n block.timestamp\n );\n }\n\n // Repay flashloan\n require(\n wethRequired <= IERC20Upgradeable(W_NATIVE_ADDRESS).balanceOf(address(this)),\n \"Not enough W_NATIVE exchanged from seized collateral to repay flashloan.\"\n );\n require(\n IW_NATIVE(W_NATIVE_ADDRESS).transfer(msg.sender, wethRequired),\n \"Failed to repay Uniswap flashloan with W_NATIVE exchanged from seized collateral.\"\n );\n\n // Return the profited token (underlying collateral if same as exchangeProfitTo; otherwise, W_NATIVE)\n return address(underlyingCollateral);\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n\n /**\n * @dev Returns an array containing the parameters supplied.\n */\n function array(address a, address b) private pure returns (address[] memory) {\n address[] memory arr = new address[](2);\n arr[0] = a;\n arr[1] = b;\n return arr;\n }\n}\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicUniV3Liquidator\n * @author Veliko Minkov (https://github.com/vminkov)\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\n */\ncontract IonicUniV3Liquidator is\n OwnableUpgradeable,\n ILiquidator,\n IUniswapV3FlashCallback,\n IExpressRelayFeeReceiver,\n IFlashLoanReceiver\n{\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n\n address public W_NATIVE_ADDRESS;\n mapping(address => bool) public redemptionStrategiesWhitelist;\n IUniswapV3Quoter public quoter;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _quoter) external initializer {\n __Ownable_init();\n W_NATIVE_ADDRESS = _wtoken;\n quoter = IUniswapV3Quoter(_quoter);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n underlying.approve(address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\n flashSwapPool.flash(\n address(this),\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(\n LiquidateToTokensWithFlashSwapVars memory vars,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\n uint256 flashSwapReturnAmount = _flashSwapAmount;\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\n flashSwapReturnAmount += fee0;\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\n flashSwapReturnAmount += fee1;\n } else {\n revert(\"wrong pool or _flashSwapToken\");\n }\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay the borrowed asset directly\n collateralRequired = flashSwapReturnAmount;\n\n // Repay flashloan\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\n } else {\n // TODO swap within the same pool and then repay the FL to the pool\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\n\n {\n collateralRequired = quoter.quoteExactOutputSingle(\n zeroForOne ? pool.token0() : pool.token1(),\n zeroForOne ? pool.token1() : pool.token0(),\n pool.fee(),\n _flashSwapAmount,\n 0 // sqrtPriceLimitX96\n );\n }\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n\n // Repay flashloan\n pool.swap(\n address(pool),\n zeroForOne,\n int256(collateralRequired),\n 0, // sqrtPriceLimitX96\n \"\"\n );\n }\n\n return address(underlyingCollateral);\n } else {\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/liquidators/AerodromeCLLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { ISwapRouter_Aerodrome } from \"../external/aerodrome/IAerodromeSwapRouter.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\ncontract AerodromeCLLiquidator is IRedemptionStrategy {\n /**\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\n * @param inputToken Address of the token\n * @param inputAmount input amount\n * @param strategyData context specific data like input token, pool address and tx expiratio period\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (\n ,\n address _outputToken,\n ISwapRouter_Aerodrome swapRouter,\n address _unwrappedInput,\n address _unwrappedOutput,\n int24 _tickSpacing\n ) = abi.decode(strategyData, (address, address, ISwapRouter_Aerodrome, address, address, int24));\n if (_unwrappedOutput != address(0)) {\n outputToken = IERC20Upgradeable(_unwrappedOutput);\n } else {\n outputToken = IERC20Upgradeable(_outputToken);\n }\n\n if (_unwrappedInput != address(0)) {\n inputToken.approve(address(inputToken), inputAmount);\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n inputToken = IERC20Upgradeable(_unwrappedInput);\n }\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n outputAmount = swapRouter.exactInputSingle(\n ISwapRouter_Aerodrome.ExactInputSingleParams(\n address(inputToken),\n address(outputToken),\n _tickSpacing,\n address(this),\n block.timestamp,\n inputAmount,\n 0,\n 0\n )\n );\n\n if (_unwrappedOutput != address(0)) {\n IERC20Upgradeable(_unwrappedOutput).approve(address(_outputToken), outputAmount);\n IERC4626(_outputToken).deposit(outputAmount, address(this));\n outputAmount = IERC4626(_unwrappedOutput).balanceOf(address(this));\n outputToken = IERC20Upgradeable(_outputToken);\n }\n }\n\n function name() public pure virtual override returns (string memory) {\n return \"AerodromeCLLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/AerodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\n\n/**\n * @title AerodromeV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Aerodrome V2 router for use as a step in a liquidation.\n */\ncontract AerodromeV2Liquidator {\n function _swap(IRouter_Aerodrome router, uint256 inputAmount, IRouter_Aerodrome.Route[] memory swapPath) internal {\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"AerodromeV2Liquidator\";\n }\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IRouter_Aerodrome router, IRouter_Aerodrome.Route[] memory swapPath) = abi.decode(\n strategyData,\n (IRouter_Aerodrome, IRouter_Aerodrome.Route[])\n );\n require(\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\n \"Invalid AerodromeV2Liquidator swap path.\"\n );\n\n // Swap underlying tokens\n inputToken.approve(address(router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\n outputAmount = outputToken.balanceOf(address(this));\n }\n}\n" + }, + "contracts/liquidators/AlgebraSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"../external/algebra/ISwapRouter.sol\";\n\n/**\n * @title AlgebraSwapLiquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Algebra router for use as a step in a liquidation.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract AlgebraSwapLiquidator is IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (address _outputToken, IAlgebraSwapRouter swapRouter) = abi.decode(strategyData, (address, IAlgebraSwapRouter));\n outputToken = IERC20Upgradeable(_outputToken);\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n IAlgebraSwapRouter.ExactInputSingleParams memory params = IAlgebraSwapRouter.ExactInputSingleParams(\n address(inputToken),\n _outputToken,\n address(this),\n block.timestamp,\n inputAmount,\n 0, // amountOutMinimum\n 0 // limitSqrtPrice\n );\n\n outputAmount = swapRouter.exactInputSingle(params);\n }\n\n function name() public pure returns (string memory) {\n return \"AlgebraSwapLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/BaseUniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\n\nimport \"./IRedemptionStrategy.sol\";\n\nabstract contract BaseUniswapV2Liquidator is IRedemptionStrategy {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\n strategyData,\n (IUniswapV2Router02, address[])\n );\n require(swapPath.length >= 2 && swapPath[0] == address(inputToken), \"Invalid UniswapLiquidator swap path.\");\n\n // Swap underlying tokens\n inputToken.approve(address(uniswapV2Router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(uniswapV2Router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1]);\n outputAmount = outputToken.balanceOf(address(this));\n }\n\n function _swap(IUniswapV2Router02 uniswapV2Router, uint256 inputAmount, address[] memory swapPath) internal virtual;\n}\n" + }, + "contracts/liquidators/CurveSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport \"../external/curve/ICurvePool.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\nimport \"./IRedemptionStrategy.sol\";\n\nimport \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\n\n/**\n * @title CurveSwapLiquidator\n * @notice Swaps seized token collateral via Curve as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract CurveSwapLiquidator is IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable, uint256) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\n address outputTokenAddress,\n address _unwrappedInput,\n address _unwrappedOutput\n ) = abi.decode(strategyData, (CurveV2LpTokenPriceOracleNoRegistry, address, address, address));\n\n if (_unwrappedOutput != address(0)) {\n outputToken = IERC20Upgradeable(_unwrappedOutput);\n } else {\n outputToken = IERC20Upgradeable(outputTokenAddress);\n }\n\n if (_unwrappedInput != address(0)) {\n inputToken.approve(address(inputToken), inputAmount);\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n inputToken = IERC20Upgradeable(_unwrappedInput);\n }\n\n address inputTokenAddress = address(inputToken);\n\n ICurvePool curvePool;\n int128 i;\n int128 j;\n if (address(curveV2Oracle) != address(0)) {\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, address(outputToken));\n }\n require(address(curvePool) != address(0), \"!curve pool\");\n\n inputToken.approve(address(curvePool), inputAmount);\n outputAmount = curvePool.exchange(i, j, inputAmount, 0);\n\n if (_unwrappedOutput != address(0)) {\n IERC20Upgradeable(_unwrappedOutput).approve(address(outputTokenAddress), outputAmount);\n IERC4626(outputTokenAddress).deposit(outputAmount, address(this));\n outputToken = IERC20Upgradeable(outputTokenAddress);\n }\n\n outputAmount = outputToken.balanceOf(address(this));\n return (outputToken, outputAmount);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"CurveSwapLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/CurveSwapLiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CurveSwapLiquidator.sol\";\nimport \"./IFundsConversionStrategy.sol\";\n\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\ncontract CurveSwapLiquidatorFunder is CurveSwapLiquidator, IFundsConversionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable, uint256) {\n ICurvePool curvePool;\n int128 i;\n int128 j;\n {\n (\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle,\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\n address inputTokenAddress,\n address outputTokenAddress,\n\n ) = abi.decode(\n strategyData,\n (CurveLpTokenPriceOracleNoRegistry, CurveV2LpTokenPriceOracleNoRegistry, address, address, address)\n );\n\n if (address(curveV2Oracle) != address(0)) {\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\n }\n if (address(curvePool) == address(0)) {\n (curvePool, i, j) = curveV1Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\n }\n }\n require(address(curvePool) != address(0), \"!curve pool\");\n\n IERC20MetadataUpgradeable inputMetadataToken = IERC20MetadataUpgradeable(curvePool.coins(uint256(int256(i))));\n uint256 inputAmountGuesstimate = guesstimateInputAmount(curvePool, i, j, inputMetadataToken, outputAmount);\n uint256 inputAmount = binSearch(\n curvePool,\n i,\n j,\n (70 * inputAmountGuesstimate) / 100,\n (130 * inputAmountGuesstimate) / 100,\n outputAmount\n );\n\n return (inputMetadataToken, inputAmount);\n }\n\n function guesstimateInputAmount(\n ICurvePool curvePool,\n int128 i,\n int128 j,\n IERC20MetadataUpgradeable inputMetadataToken,\n uint256 outputAmount\n ) internal view returns (uint256) {\n uint256 oneInputToken = 10 ** inputMetadataToken.decimals();\n uint256 outputTokensForOneInputToken = curvePool.get_dy(i, j, oneInputToken);\n // inputAmount / outputAmount = oneInputToken / outputTokensForOneInputToken\n uint256 inputAmount = (outputAmount * oneInputToken) / outputTokensForOneInputToken;\n return inputAmount;\n }\n\n function binSearch(\n ICurvePool curvePool,\n int128 i,\n int128 j,\n uint256 low,\n uint256 high,\n uint256 value\n ) internal view returns (uint256) {\n if (low >= high) return low;\n\n uint256 mid = (low + high) / 2;\n uint256 outputAmount = curvePool.get_dy(i, j, mid);\n if (outputAmount == 0) revert(\"output amount 0\");\n // output can be up to 10% in excess\n if (outputAmount >= value && outputAmount <= (11 * value) / 10) return mid;\n else if (outputAmount > value) {\n return binSearch(curvePool, i, j, low, mid, value);\n } else {\n return binSearch(curvePool, i, j, mid, high, value);\n }\n }\n\n function name() public pure override(CurveSwapLiquidator, IRedemptionStrategy) returns (string memory) {\n return \"CurveSwapLiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/ERC4626Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\n\n/**\n * @title ERC4626Liquidator\n * @notice Redeems ERC4626 assets and optionally swaps them via Uniswap V2 router for use as a step in a liquidation.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract ERC4626Liquidator is IRedemptionStrategy {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IERC20Upgradeable _outputToken, uint24 fee, ISwapRouter swapRouter, address[] memory underlyingTokens, ) = abi\n .decode(strategyData, (IERC20Upgradeable, uint24, ISwapRouter, address[], Quoter));\n\n if (underlyingTokens.length == 1) {\n // If there is only one underlying token, we can just redeem it directly\n require(\n address(_outputToken) == underlyingTokens[0],\n \"ERC4626Liquidator: output token does not match underlying token\"\n );\n\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n outputAmount = IERC20Upgradeable(_outputToken).balanceOf(address(this));\n\n return (_outputToken, outputAmount);\n } else {\n // NOTE: for Sommelier, the underlying tokens can be fetched from the Sommelier contract\n // E.g. https://etherscan.io/address/0x6b7f87279982d919bbf85182ddeab179b366d8f2#readContract#F20\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n\n // for each token, we need to swap it for the output token\n for (uint256 i = 0; i < underlyingTokens.length; i++) {\n // do nothing if the token is the output token\n if (underlyingTokens[i] == address(_outputToken)) {\n continue;\n }\n if (IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)) == 0) {\n continue;\n }\n _swap(\n underlyingTokens[i],\n IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)),\n address(_outputToken),\n swapRouter,\n fee\n );\n }\n outputAmount = _outputToken.balanceOf(address(this));\n return (_outputToken, outputAmount);\n }\n }\n\n function _swap(\n address inputToken,\n uint256 inputAmount,\n address outputToken,\n ISwapRouter swapRouter,\n uint24 fee\n ) internal returns (uint256 outputAmount) {\n IERC20Upgradeable(inputToken).approve(address(swapRouter), inputAmount);\n\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams(\n address(inputToken),\n outputToken,\n fee,\n address(this),\n block.timestamp,\n inputAmount,\n 0,\n 0\n );\n outputAmount = swapRouter.exactInputSingle(params);\n }\n\n function name() public pure returns (string memory) {\n return \"ERC4626Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFundsConversionStrategy is IRedemptionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\n}\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @title IRedemptionStrategy\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function name() external view returns (string memory);\n}\n" + }, + "contracts/liquidators/KimUniV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./BaseUniswapV2Liquidator.sol\";\n\ncontract KimUniV2Liquidator is BaseUniswapV2Liquidator {\n function _swap(\n IUniswapV2Router02 uniswapV2Router,\n uint256 inputAmount,\n address[] memory swapPath\n ) internal override {\n uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n inputAmount,\n 0,\n swapPath,\n address(this),\n address(0), // referrer\n block.timestamp\n );\n }\n\n function name() public pure virtual returns (string memory) {\n return \"KimUniV2Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/registry/ILiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ILiquidatorsRegistryStorage {\n function redemptionStrategiesByName(string memory name) external view returns (IRedemptionStrategy);\n\n function redemptionStrategiesByTokens(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy);\n\n function defaultOutputToken(IERC20Upgradeable inputToken) external view returns (IERC20Upgradeable);\n\n function owner() external view returns (address);\n\n function uniswapV3Fees(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external view returns (uint24);\n\n function customUniV3Router(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (address);\n}\n\ninterface ILiquidatorsRegistryExtension {\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory);\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\n\n function getRedemptionStrategy(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy strategy, bytes memory strategyData);\n\n function getAllRedemptionStrategies() external view returns (address[] memory);\n\n function getSlippage(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (uint256 slippage);\n\n function swap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256);\n\n function amountOutAndSlippageOfSwap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256 outputAmount, uint256 slippage);\n}\n\ninterface ILiquidatorsRegistrySecondExtension {\n function getAllPairsStrategies()\n external\n view\n returns (\n IRedemptionStrategy[] memory strategies,\n IERC20Upgradeable[] memory inputTokens,\n IERC20Upgradeable[] memory outputTokens\n );\n\n function pairsStrategiesMatch(\n IRedemptionStrategy[] calldata configStrategies,\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens\n ) external view returns (bool);\n\n function uniswapPairsFeesMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n uint256[] calldata configFees\n ) external view returns (bool);\n\n function uniswapPairsRoutersMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n address[] calldata configRouters\n ) external view returns (bool);\n\n function _setRedemptionStrategy(\n IRedemptionStrategy strategy,\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external;\n\n function _setRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external;\n\n function _resetRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external;\n\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external;\n\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external;\n\n function _setUniswapV3Fees(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint24[] calldata fees\n ) external;\n\n function _setUniswapV3Routers(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n address[] calldata routers\n ) external;\n\n function _setSlippages(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint256[] calldata slippages\n ) external;\n\n function optimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IERC20Upgradeable[] memory);\n\n function _setOptimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken,\n IERC20Upgradeable[] calldata optimalPath\n ) external;\n\n function wrappedToUnwrapped4626(address wrapped) external view returns (address);\n\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external;\n\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24);\n\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external;\n\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool);\n\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external;\n}\n\ninterface ILiquidatorsRegistry is\n ILiquidatorsRegistryExtension,\n ILiquidatorsRegistrySecondExtension,\n ILiquidatorsRegistryStorage\n{}\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\nimport \"./LiquidatorsRegistryExtension.sol\";\n\ncontract LiquidatorsRegistry is LiquidatorsRegistryStorage, DiamondBase {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(AddressesProvider _ap) SafeOwnable() {\n ap = _ap;\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace)\n public\n override\n onlyOwner\n {\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n\n function asExtension() public view returns (LiquidatorsRegistryExtension) {\n return LiquidatorsRegistryExtension(address(this));\n }\n}\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistryExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"./ILiquidatorsRegistry.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\n\nimport \"../IRedemptionStrategy.sol\";\nimport \"../../ionic/DiamondExtension.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\n\nimport { IRouter_Aerodrome as IAerodromeV2Router } from \"../../external/aerodrome/IAerodromeRouter.sol\";\nimport { IRouter_Velodrome as IVelodromeV2Router } from \"../../external/velodrome/IVelodromeRouter.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract LiquidatorsRegistryExtension is LiquidatorsRegistryStorage, DiamondExtension, ILiquidatorsRegistryExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n error NoRedemptionPath();\n error OutputTokenMismatch();\n\n event SlippageUpdated(\n IERC20Upgradeable indexed from,\n IERC20Upgradeable indexed to,\n uint256 prevValue,\n uint256 newValue\n );\n\n // @notice maximum slippage in swaps, in bps\n uint256 public constant MAX_SLIPPAGE = 900; // 9%\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 7;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.getRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this.getInputTokensByOutputToken.selector;\n functionSelectors[--fnsCount] = this.swap.selector;\n functionSelectors[--fnsCount] = this.getAllRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.amountOutAndSlippageOfSwap.selector;\n functionSelectors[--fnsCount] = this.getSlippage.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function getSlippage(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (uint256 slippage) {\n slippage = conversionSlippage[inputToken][outputToken];\n // TODO slippage == 0 should be allowed\n if (slippage == 0) return MAX_SLIPPAGE;\n }\n\n function getAllRedemptionStrategies() public view returns (address[] memory) {\n return redemptionStrategies.values();\n }\n\n function amountOutAndSlippageOfSwap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256 outputAmount, uint256 slippage) {\n if (inputAmount == 0) return (0, 0);\n\n outputAmount = swap(inputToken, inputAmount, outputToken);\n if (outputAmount == 0) return (0, 0);\n\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n uint256 inputTokenPrice = mpo.price(address(inputToken));\n uint256 outputTokenPrice = mpo.price(address(outputToken));\n\n uint256 inputTokensValue = inputAmount * toScaledPrice(inputTokenPrice, inputToken);\n uint256 outputTokensValue = outputAmount * toScaledPrice(outputTokenPrice, outputToken);\n\n if (outputTokensValue < inputTokensValue) {\n slippage = ((inputTokensValue - outputTokensValue) * 10000) / inputTokensValue;\n }\n // min slippage should be non-zero\n // just in case of rounding errors\n slippage += 1;\n\n // cache the slippage\n uint256 prevValue = conversionSlippage[inputToken][outputToken];\n if (prevValue == 0 || block.timestamp - conversionSlippageUpdated[inputToken][outputToken] > 5000) {\n emit SlippageUpdated(inputToken, outputToken, prevValue, slippage);\n\n conversionSlippage[inputToken][outputToken] = slippage;\n conversionSlippageUpdated[inputToken][outputToken] = block.timestamp;\n }\n }\n\n /// @dev returns price scaled to 1e36 - decimals\n function toScaledPrice(uint256 unscaledPrice, IERC20Upgradeable token) internal view returns (uint256) {\n uint256 tokenDecimals = uint256(ERC20Upgradeable(address(token)).decimals());\n return\n tokenDecimals <= 18\n ? uint256(unscaledPrice) * (10 ** (18 - tokenDecimals))\n : uint256(unscaledPrice) / (10 ** (tokenDecimals - 18));\n }\n\n function swap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) public returns (uint256 outputAmount) {\n inputToken.safeTransferFrom(msg.sender, address(this), inputAmount);\n outputAmount = convertAllTo(inputToken, outputToken);\n outputToken.safeTransfer(msg.sender, outputAmount);\n }\n\n function convertAllTo(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) private returns (uint256) {\n uint256 inputAmount = inputToken.balanceOf(address(this));\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = getRedemptionStrategies(\n inputToken,\n outputToken\n );\n\n if (redemptionStrategies.length == 0) revert NoRedemptionPath();\n\n IERC20Upgradeable swapInputToken = inputToken;\n uint256 swapInputAmount = inputAmount;\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\n bytes memory strategyData = strategiesData[i];\n (IERC20Upgradeable swapOutputToken, uint256 swapOutputAmount) = convertCustomFunds(\n swapInputToken,\n swapInputAmount,\n redemptionStrategy,\n strategyData\n );\n swapInputAmount = swapOutputAmount;\n swapInputToken = swapOutputToken;\n }\n\n if (swapInputToken != outputToken) revert OutputTokenMismatch();\n return outputToken.balanceOf(address(this));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory) {\n return inputTokensByOutputToken[outputToken].values();\n }\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\n IERC20Upgradeable tokenToRedeem = inputToken;\n IERC20Upgradeable targetOutputToken = outputToken;\n IRedemptionStrategy[] memory strategiesTemp = new IRedemptionStrategy[](10);\n bytes[] memory strategiesDataTemp = new bytes[](10);\n IERC20Upgradeable[] memory tokenPath = new IERC20Upgradeable[](10);\n IERC20Upgradeable[] memory optimalPath = new IERC20Upgradeable[](0);\n uint256 optimalPathIterator = 0;\n\n uint256 k = 0;\n while (tokenToRedeem != targetOutputToken) {\n IERC20Upgradeable nextRedeemedToken;\n IRedemptionStrategy directStrategy = redemptionStrategiesByTokens[tokenToRedeem][targetOutputToken];\n if (address(directStrategy) != address(0)) {\n nextRedeemedToken = targetOutputToken;\n } else {\n // check if an optimal path is preconfigured\n if (optimalPath.length == 0 && _optimalSwapPath[tokenToRedeem][targetOutputToken].length != 0) {\n optimalPath = _optimalSwapPath[tokenToRedeem][targetOutputToken];\n }\n if (optimalPath.length != 0 && optimalPathIterator < optimalPath.length) {\n nextRedeemedToken = optimalPath[optimalPathIterator++];\n } else {\n // else if no optimal path is available, use the default\n nextRedeemedToken = defaultOutputToken[tokenToRedeem];\n }\n }\n\n // check if going in an endless loop\n for (uint256 i = 0; i < tokenPath.length; i++) {\n if (nextRedeemedToken == tokenPath[i]) break;\n }\n\n (IRedemptionStrategy strategy, bytes memory strategyData) = getRedemptionStrategy(\n tokenToRedeem,\n nextRedeemedToken\n );\n if (address(strategy) == address(0)) break;\n\n strategiesTemp[k] = strategy;\n strategiesDataTemp[k] = strategyData;\n tokenPath[k] = nextRedeemedToken;\n tokenToRedeem = nextRedeemedToken;\n\n k++;\n if (k == 10) break;\n }\n\n strategies = new IRedemptionStrategy[](k);\n strategiesData = new bytes[](k);\n\n for (uint8 i = 0; i < k; i++) {\n strategies[i] = strategiesTemp[i];\n strategiesData[i] = strategiesDataTemp[i];\n }\n }\n\n function getRedemptionStrategy(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public view returns (IRedemptionStrategy strategy, bytes memory strategyData) {\n strategy = redemptionStrategiesByTokens[inputToken][outputToken];\n\n if (isStrategy(strategy, \"UniswapV2LiquidatorFunder\") || isStrategy(strategy, \"KimUniV2Liquidator\")) {\n strategyData = uniswapV2LiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"UniswapV3LiquidatorFunder\")) {\n strategyData = uniswapV3LiquidatorFunderData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AlgebraSwapLiquidator\")) {\n strategyData = algebraSwapLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AerodromeV2Liquidator\")) {\n strategyData = aerodromeV2LiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AerodromeCLLiquidator\")) {\n strategyData = aerodromeCLLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"CurveSwapLiquidator\")) {\n strategyData = curveSwapLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"VelodromeV2Liquidator\")) {\n strategyData = velodromeV2LiquidatorData(inputToken, outputToken);\n } else {\n revert(\"no strategy data\");\n }\n }\n\n function isStrategy(IRedemptionStrategy strategy, string memory name) internal view returns (bool) {\n return address(strategy) != address(0) && address(strategy) == address(redemptionStrategiesByName[name]);\n }\n\n function pickPreferredToken(address[] memory tokens, address strategyOutputToken) internal view returns (address) {\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == strategyOutputToken) return strategyOutputToken;\n }\n address wnative = ap.getAddress(\"wtoken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wnative) return wnative;\n }\n address stableToken = ap.getAddress(\"stableToken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == stableToken) return stableToken;\n }\n address wbtc = ap.getAddress(\"wBTCToken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wbtc) return wbtc;\n }\n return tokens[0];\n }\n\n function getUniswapV3Router(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (address) {\n address customRouter = customUniV3Router[inputToken][outputToken];\n if (customRouter == address(0)) {\n customRouter = customUniV3Router[outputToken][inputToken];\n }\n\n if (customRouter != address(0)) {\n return customRouter;\n } else {\n // get asset specific router or default\n return ap.getAddress(\"UNISWAP_V3_ROUTER\");\n }\n }\n\n function getUniswapV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"IUniswapV2Router02\");\n }\n\n function getAerodromeV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"AERODROME_V2_ROUTER\");\n }\n\n function getAerodromeCLRouter(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"AERODROME_CL_ROUTER\");\n }\n\n function uniswapV3LiquidatorFunderData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n uint24 fee = uniswapV3Fees[inputToken][outputToken];\n if (fee == 0) fee = uniswapV3Fees[outputToken][inputToken];\n if (fee == 0) fee = 500;\n\n address router = getUniswapV3Router(inputToken, outputToken);\n strategyData = abi.encode(inputToken, outputToken, fee, router, ap.getAddress(\"Quoter\"));\n }\n\n function getWrappedToUnwrapped4626(IERC20Upgradeable inputToken) internal view returns (address) {\n return _wrappedToUnwrapped4626[address(inputToken)];\n }\n\n function getAeroCLTickSpacing(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (int24) {\n int24 tickSpacing = _aeroCLTickSpacings[address(inputToken)][address(outputToken)];\n if (tickSpacing == 0) {\n tickSpacing = 1;\n }\n return tickSpacing;\n }\n\n function aeroV2IsStable(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) internal view returns (bool) {\n return _aeroV2IsStable[address(inputToken)][address(outputToken)];\n }\n\n function uniswapV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IERC20Upgradeable[] memory swapPath = new IERC20Upgradeable[](2);\n swapPath[0] = inputToken;\n swapPath[1] = outputToken;\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\n }\n\n function aerodromeV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IAerodromeV2Router.Route[] memory swapPath = new IAerodromeV2Router.Route[](1);\n swapPath[0] = IAerodromeV2Router.Route({\n from: address(inputToken),\n to: address(outputToken),\n stable: aeroV2IsStable(inputToken, outputToken),\n factory: ap.getAddress(\"AERODROME_V2_FACTORY\")\n });\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\n }\n\n function aerodromeCLLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(\n inputToken,\n outputToken,\n getAerodromeCLRouter(inputToken),\n getWrappedToUnwrapped4626(inputToken),\n getWrappedToUnwrapped4626(outputToken),\n getAeroCLTickSpacing(inputToken, outputToken)\n );\n }\n\n function algebraSwapLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(outputToken, ap.getAddress(\"ALGEBRA_SWAP_ROUTER\"));\n }\n\n function curveSwapLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(\n ap.getAddress(\"CURVE_V2_ORACLE_NO_REGISTRY\"),\n outputToken,\n getWrappedToUnwrapped4626(inputToken),\n getWrappedToUnwrapped4626(outputToken)\n );\n }\n\n function velodromeV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IVelodromeV2Router.Route[] memory swapPath = new IVelodromeV2Router.Route[](1);\n swapPath[0] = IVelodromeV2Router.Route({\n from: address(inputToken),\n to: address(outputToken),\n stable: aeroV2IsStable(inputToken, outputToken)\n });\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\n }\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistrySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"./ILiquidatorsRegistry.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\n\nimport \"../../ionic/DiamondExtension.sol\";\n\ncontract LiquidatorsRegistrySecondExtension is\n LiquidatorsRegistryStorage,\n DiamondExtension,\n ILiquidatorsRegistrySecondExtension\n{\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 20;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getAllPairsStrategies.selector;\n functionSelectors[--fnsCount] = this.pairsStrategiesMatch.selector;\n functionSelectors[--fnsCount] = this.uniswapPairsFeesMatch.selector;\n functionSelectors[--fnsCount] = this.uniswapPairsRoutersMatch.selector;\n functionSelectors[--fnsCount] = this._setSlippages.selector;\n functionSelectors[--fnsCount] = this._setUniswapV3Fees.selector;\n functionSelectors[--fnsCount] = this._setUniswapV3Routers.selector;\n functionSelectors[--fnsCount] = this._setDefaultOutputToken.selector;\n functionSelectors[--fnsCount] = this._setRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this._setRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this._removeRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this._resetRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.optimalSwapPath.selector;\n functionSelectors[--fnsCount] = this._setOptimalSwapPath.selector;\n functionSelectors[--fnsCount] = this.wrappedToUnwrapped4626.selector;\n functionSelectors[--fnsCount] = this.aeroCLTickSpacings.selector;\n functionSelectors[--fnsCount] = this.aeroV2IsStable.selector;\n functionSelectors[--fnsCount] = this._setWrappedToUnwrapped4626.selector;\n functionSelectors[--fnsCount] = this._setAeroCLTickSpacings.selector;\n functionSelectors[--fnsCount] = this._setAeroV2IsStable.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function _setSlippages(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint256[] calldata slippages\n ) external onlyOwner {\n require(slippages.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < slippages.length; i++) {\n conversionSlippage[inputTokens[i]][outputTokens[i]] = slippages[i];\n }\n }\n\n function _setUniswapV3Fees(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint24[] calldata fees\n ) external onlyOwner {\n require(fees.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < fees.length; i++) {\n uniswapV3Fees[inputTokens[i]][outputTokens[i]] = fees[i];\n }\n }\n\n function _setUniswapV3Routers(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n address[] calldata routers\n ) external onlyOwner {\n require(routers.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < routers.length; i++) {\n customUniV3Router[inputTokens[i]][outputTokens[i]] = routers[i];\n }\n }\n\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external onlyOwner {\n defaultOutputToken[inputToken] = outputToken;\n }\n\n function _setRedemptionStrategy(\n IRedemptionStrategy strategy,\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public onlyOwner {\n string memory name = strategy.name();\n IRedemptionStrategy oldStrategy = redemptionStrategiesByName[name];\n\n redemptionStrategiesByTokens[inputToken][outputToken] = strategy;\n redemptionStrategiesByName[name] = strategy;\n\n redemptionStrategies.remove(address(oldStrategy));\n redemptionStrategies.add(address(strategy));\n\n if (defaultOutputToken[inputToken] == IERC20Upgradeable(address(0))) {\n defaultOutputToken[inputToken] = outputToken;\n }\n inputTokensByOutputToken[outputToken].add(address(inputToken));\n outputTokensSet.add(address(outputToken));\n }\n\n function _setRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external onlyOwner {\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n for (uint256 i = 0; i < strategies.length; i++) {\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\n }\n }\n\n function _resetRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external onlyOwner {\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n // empty the input/output token mappings/sets\n address[] memory _outputTokens = outputTokensSet.values();\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\n }\n outputTokensSet.remove(_outputTokens[i]);\n }\n\n // empty the strategies mappings/sets\n address[] memory _currentStrategies = redemptionStrategies.values();\n for (uint256 i = 0; i < _currentStrategies.length; i++) {\n IRedemptionStrategy _currentStrategy = IRedemptionStrategy(_currentStrategies[i]);\n string memory _name = _currentStrategy.name();\n redemptionStrategiesByName[_name] = IRedemptionStrategy(address(0));\n redemptionStrategies.remove(_currentStrategies[i]);\n }\n\n // write the new strategies and their tokens configs\n for (uint256 i = 0; i < strategies.length; i++) {\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\n }\n }\n\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external onlyOwner {\n // check all the input/output tokens if they match the strategy to remove\n address[] memory _outputTokens = outputTokensSet.values();\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n IRedemptionStrategy _currentStrategy = redemptionStrategiesByTokens[_inputToken][_outputToken];\n\n // only nullify the input/output tokens config if the strategy matches\n if (_currentStrategy == strategyToRemove) {\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\n if (defaultOutputToken[_inputToken] == _outputToken) {\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\n }\n }\n }\n if (inputTokensByOutputToken[_outputToken].length() == 0) {\n outputTokensSet.remove(address(_outputToken));\n }\n }\n\n redemptionStrategiesByName[strategyToRemove.name()] = IRedemptionStrategy(address(0));\n redemptionStrategies.remove(address(strategyToRemove));\n }\n\n function uniswapPairsFeesMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n uint256[] calldata configFees\n ) external view returns (bool) {\n // find a match for each config fee\n for (uint256 i = 0; i < configFees.length; i++) {\n if (uniswapV3Fees[configInputTokens[i]][configOutputTokens[i]] != configFees[i]) return false;\n }\n\n return true;\n }\n\n function uniswapPairsRoutersMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n address[] calldata configRouters\n ) external view returns (bool) {\n // find a match for each config router\n for (uint256 i = 0; i < configRouters.length; i++) {\n if (customUniV3Router[configInputTokens[i]][configOutputTokens[i]] != configRouters[i]) return false;\n }\n\n return true;\n }\n\n function pairsStrategiesMatch(\n IRedemptionStrategy[] calldata configStrategies,\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens\n ) external view returns (bool) {\n (\n IRedemptionStrategy[] memory onChainStrategies,\n IERC20Upgradeable[] memory onChainInputTokens,\n IERC20Upgradeable[] memory onChainOutputTokens\n ) = getAllPairsStrategies();\n // find a match for each config strategy\n for (uint256 i = 0; i < configStrategies.length; i++) {\n bool foundMatch = false;\n for (uint256 j = 0; j < onChainStrategies.length; j++) {\n if (\n onChainStrategies[j] == configStrategies[i] &&\n onChainInputTokens[j] == configInputTokens[i] &&\n onChainOutputTokens[j] == configOutputTokens[i]\n ) {\n foundMatch = true;\n break;\n }\n }\n if (!foundMatch) return false;\n }\n\n // find a match for each on-chain strategy\n for (uint256 i = 0; i < onChainStrategies.length; i++) {\n bool foundMatch = false;\n for (uint256 j = 0; j < configStrategies.length; j++) {\n if (\n onChainStrategies[i] == configStrategies[j] &&\n onChainInputTokens[i] == configInputTokens[j] &&\n onChainOutputTokens[i] == configOutputTokens[j]\n ) {\n foundMatch = true;\n break;\n }\n }\n if (!foundMatch) return false;\n }\n\n return true;\n }\n\n function getAllPairsStrategies()\n public\n view\n returns (\n IRedemptionStrategy[] memory strategies,\n IERC20Upgradeable[] memory inputTokens,\n IERC20Upgradeable[] memory outputTokens\n )\n {\n address[] memory _outputTokens = outputTokensSet.values();\n uint256 pairsCounter = 0;\n\n {\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n pairsCounter += _inputTokens.length;\n }\n\n strategies = new IRedemptionStrategy[](pairsCounter);\n inputTokens = new IERC20Upgradeable[](pairsCounter);\n outputTokens = new IERC20Upgradeable[](pairsCounter);\n }\n\n pairsCounter = 0;\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n strategies[pairsCounter] = redemptionStrategiesByTokens[_inputToken][_outputToken];\n inputTokens[pairsCounter] = _inputToken;\n outputTokens[pairsCounter] = _outputToken;\n pairsCounter++;\n }\n }\n }\n\n function optimalSwapPath(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken)\n external\n view\n returns (IERC20Upgradeable[] memory)\n {\n return _optimalSwapPath[inputToken][outputToken];\n }\n\n function _setOptimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken,\n IERC20Upgradeable[] calldata optimalPath\n ) external onlyOwner {\n _optimalSwapPath[inputToken][outputToken] = optimalPath;\n }\n\n function wrappedToUnwrapped4626(address wrapped) external view returns (address) {\n return _wrappedToUnwrapped4626[wrapped];\n }\n\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24) {\n return _aeroCLTickSpacings[inputToken][outputToken];\n }\n\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool) {\n return _aeroV2IsStable[inputToken][outputToken];\n }\n\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external onlyOwner {\n _wrappedToUnwrapped4626[wrapped] = unwrapped;\n }\n\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external onlyOwner {\n _aeroCLTickSpacings[inputToken][outputToken] = tickSpacing;\n }\n\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external onlyOwner {\n _aeroV2IsStable[inputToken][outputToken] = isStable;\n }\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../IRedemptionStrategy.sol\";\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nabstract contract LiquidatorsRegistryStorage is SafeOwnable {\n AddressesProvider public ap;\n\n EnumerableSet.AddressSet internal redemptionStrategies;\n mapping(string => IRedemptionStrategy) public redemptionStrategiesByName;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IRedemptionStrategy)) public redemptionStrategiesByTokens;\n mapping(IERC20Upgradeable => IERC20Upgradeable) public defaultOutputToken;\n mapping(IERC20Upgradeable => EnumerableSet.AddressSet) internal inputTokensByOutputToken;\n EnumerableSet.AddressSet internal outputTokensSet;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippage;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippageUpdated;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint24)) public uniswapV3Fees;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => address)) public customUniV3Router;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IERC20Upgradeable[])) internal _optimalSwapPath;\n mapping(address => address) internal _wrappedToUnwrapped4626;\n mapping(address => mapping(address => int24)) internal _aeroCLTickSpacings;\n mapping(address => mapping(address => bool)) internal _aeroV2IsStable;\n}" + }, + "contracts/liquidators/UniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./BaseUniswapV2Liquidator.sol\";\n\n/**\n * @title UniswapV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Uniswap V2 router for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapV2Liquidator is BaseUniswapV2Liquidator {\n function _swap(\n IUniswapV2Router02 uniswapV2Router,\n uint256 inputAmount,\n address[] memory swapPath\n ) internal override {\n uniswapV2Router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"UniswapV2Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV2LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { UniswapV2Liquidator } from \"./UniswapV2Liquidator.sol\";\nimport \"./IFundsConversionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\n\ncontract UniswapV2LiquidatorFunder is UniswapV2Liquidator, IFundsConversionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount) {\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\n strategyData,\n (IUniswapV2Router02, address[])\n );\n require(swapPath.length >= 2, \"Invalid UniswapLiquidator swap path.\");\n\n uint256[] memory amounts = uniswapV2Router.getAmountsIn(outputAmount, swapPath);\n\n inputAmount = amounts[0];\n inputToken = IERC20Upgradeable(swapPath[0]);\n }\n\n function name() public pure override(UniswapV2Liquidator, IRedemptionStrategy) returns (string memory) {\n return \"UniswapV2LiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { IV3SwapRouter } from \"../external/uniswap/IV3SwapRouter.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract UniswapV3Liquidator is IRedemptionStrategy {\n /**\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\n * @param inputToken Address of the token\n * @param inputAmount input amount\n * @param strategyData context specific data like input token, pool address and tx expiratio period\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (, address _outputToken, uint24 fee, IV3SwapRouter swapRouter, ) = abi.decode(\n strategyData,\n (address, address, uint24, IV3SwapRouter, address)\n );\n outputToken = IERC20Upgradeable(_outputToken);\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n outputAmount = swapRouter.exactInputSingle(\n IV3SwapRouter.ExactInputSingleParams(\n address(inputToken),\n _outputToken,\n fee,\n address(this),\n inputAmount,\n 0,\n 0\n )\n );\n }\n\n function name() public pure virtual override returns (string memory) {\n return \"UniswapV3Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV3LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { IFundsConversionStrategy } from \"./IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport \"./UniswapV3Liquidator.sol\";\n\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\n\ncontract UniswapV3LiquidatorFunder is UniswapV3Liquidator, IFundsConversionStrategy {\n using FixedPointMathLib for uint256;\n\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n /**\n * @dev Estimates the needed input amount of the input token for the conversion to return the desired output amount.\n * @param outputAmount the desired output amount\n * @param strategyData the input token\n */\n function estimateInputAmount(uint256 outputAmount, bytes memory strategyData)\n external\n view\n returns (IERC20Upgradeable inputToken, uint256 inputAmount)\n {\n (address _inputToken, address _outputToken, uint24 fee, , Quoter quoter) = abi.decode(\n strategyData,\n (address, address, uint24, IV3SwapRouter, Quoter)\n );\n\n inputAmount = quoter.estimateMinSwapUniswapV3(_inputToken, _outputToken, outputAmount, fee);\n inputToken = IERC20Upgradeable(_inputToken);\n }\n\n function name() public pure override(UniswapV3Liquidator, IRedemptionStrategy) returns (string memory) {\n return \"UniswapV3LiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/VelodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\n\n/**\n * @title VelodromeV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Velodrome V2 router for use as a step in a liquidation.\n */\ncontract VelodromeV2Liquidator {\n function _swap(IRouter_Velodrome router, uint256 inputAmount, IRouter_Velodrome.Route[] memory swapPath) internal {\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"VelodromeV2Liquidator\";\n }\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IRouter_Velodrome router, IRouter_Velodrome.Route[] memory swapPath) = abi.decode(\n strategyData,\n (IRouter_Velodrome, IRouter_Velodrome.Route[])\n );\n require(\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\n \"Invalid VelodromeV2Liquidator swap path.\"\n );\n\n // Swap underlying tokens\n inputToken.approve(address(router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\n outputAmount = outputToken.balanceOf(address(this));\n }\n}\n" + }, + "contracts/oracles/1337/MockPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title MockPriceOracle\n * @notice Returns mocked prices from a Chainlink-like oracle. Used for local dev only\n * @dev Implements `PriceOracle`.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract MockPriceOracle is BasePriceOracle {\n /**\n * @notice The maximum number of seconds elapsed since the round was last updated before the price is considered stale. If set to 0, no limit is enforced.\n */\n uint256 public maxSecondsBeforePriceIsStale;\n\n /**\n * @dev Constructor to set `maxSecondsBeforePriceIsStale` as well as all Chainlink price feeds.\n */\n constructor(uint256 _maxSecondsBeforePriceIsStale) {\n // Set maxSecondsBeforePriceIsStale\n maxSecondsBeforePriceIsStale = _maxSecondsBeforePriceIsStale;\n }\n\n /**\n * @dev Returns a boolean indicating if a price feed exists for the underlying asset.\n */\n\n function hasPriceFeed(address underlying) external pure returns (bool) {\n return true;\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n */\n\n function random() private view returns (uint256) {\n uint256 r = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 99;\n r = r + 1;\n return r;\n }\n\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) return 1e18;\n\n int256 tokenEthPrice = 1;\n uint256 r = random();\n\n return ((uint256(tokenEthPrice) * 1e18) / r) / 1e18;\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n return 1e18;\n }\n}\n" + }, + "contracts/oracles/1337/MockRevertPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title MockRevertPriceOracle\n * @notice Mocks a failing price oracle. Used for testing purposes only\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract MockRevertPriceOracle is BasePriceOracle {\n constructor() {}\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n revert(\"MockPriceOracle: price function is failing.\");\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n revert(\"MockPriceOracle: getUnderlyingPrice function is failing.\");\n }\n}\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../compound/CTokenInterfaces.sol\";\n\n/**\n * @title BasePriceOracle\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\n * @dev Implements the `PriceOracle` interface.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface BasePriceOracle {\n /**\n * @notice Get the price of an underlying asset.\n * @param underlying The underlying asset to get the price of.\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function price(address underlying) external view returns (uint256);\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\n}\n" + }, + "contracts/oracles/default/AerodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface BasePrices {\n function getManyRatesWithConnectors(\n uint8 src_len,\n address[] memory connectors\n ) external view returns (uint256[] memory rates);\n}\n\ncontract AerodromePriceOracle is BasePriceOracle {\n BasePrices immutable prices;\n address constant WETH = 0x4200000000000000000000000000000000000006;\n\n constructor(address _prices) {\n prices = BasePrices(_prices);\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n address[] memory connectors = new address[](2);\n connectors[0] = token;\n connectors[1] = WETH;\n return prices.getManyRatesWithConnectors(1, connectors)[0];\n }\n}\n" + }, + "contracts/oracles/default/API3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IProxy } from \"../../external/api3/IProxy.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title API3PriceOracle\n * @notice Returns prices from Api3.\n * @dev Implements `PriceOracle`.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract API3PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => IProxy) public proxies;\n\n /**\n * @notice Chainlink NATIVE/USD price feed contracts.\n */\n address public NATIVE_TOKEN_USD_PRICE_FEED;\n\n /**\n * @notice The USD Token of the chain\n */\n address public USD_TOKEN;\n\n /**\n * @dev Constructor to set wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\n __SafeOwnable_init(msg.sender);\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Constructor to set wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function reinitialize(address _usdToken, address nativeTokenUsd) public onlyOwnerOrAdmin {\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\n */\n function setPriceFeeds(address[] memory underlyings, address[] memory feeds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n proxies[underlying] = IProxy(feeds[i]);\n }\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n IProxy proxy = proxies[underlying];\n require(address(proxy) != address(0), \"No API3 price feed found for this underlying ERC20 token.\");\n\n uint256 nativeTokenUsdPrice;\n\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\n // get the USDX/USD price from the MPO\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\n } else {\n (int224 nativeTokenUsdPrice224, ) = IProxy(NATIVE_TOKEN_USD_PRICE_FEED).read();\n if (nativeTokenUsdPrice224 <= 0) {\n revert(\"API3PriceOracle: native token price <= 0\");\n }\n nativeTokenUsdPrice = uint256(uint224(nativeTokenUsdPrice224));\n }\n (int224 tokenUsdPrice, ) = proxy.read();\n\n if (tokenUsdPrice <= 0) {\n revert(\"API3PriceOracle: token price <= 0\");\n }\n\n return (uint256(uint224(tokenUsdPrice)) * 1e18) / nativeTokenUsdPrice;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ChainlinkPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title ChainlinkPriceOracleV2\n * @notice Returns prices from Chainlink.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract ChainlinkPriceOracleV2 is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => AggregatorV3Interface) public priceFeeds;\n\n /**\n * @notice Maps ERC20 token addresses to enums indicating the base currency of the feed.\n */\n mapping(address => FeedBaseCurrency) public feedBaseCurrencies;\n\n /**\n * @notice Enum indicating the base currency of a Chainlink price feed.\n * @dev ETH is interchangeable with the nativeToken of the current chain.\n */\n enum FeedBaseCurrency {\n ETH,\n USD\n }\n\n /**\n * @notice Chainlink NATIVE/USD price feed contracts.\n */\n address public NATIVE_TOKEN_USD_PRICE_FEED;\n\n /**\n * @notice The USD Token of the chain\n */\n address public USD_TOKEN;\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\n __SafeOwnable_init(msg.sender);\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\n * @param baseCurrency The currency in which `feeds` are based.\n */\n function setPriceFeeds(\n address[] memory underlyings,\n address[] memory feeds,\n FeedBaseCurrency baseCurrency\n ) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeeds[underlying] = AggregatorV3Interface(feeds[i]);\n feedBaseCurrencies[underlying] = baseCurrency;\n }\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/ETH price from Chainlink\n AggregatorV3Interface feed = priceFeeds[underlying];\n require(address(feed) != address(0), \"No Chainlink price feed found for this underlying ERC20 token.\");\n FeedBaseCurrency baseCurrency = feedBaseCurrencies[underlying];\n\n if (baseCurrency == FeedBaseCurrency.ETH) {\n (, int256 tokenEthPrice, , , ) = feed.latestRoundData();\n return tokenEthPrice >= 0 ? (uint256(tokenEthPrice) * 1e18) / (10 ** uint256(feed.decimals())) : 0;\n } else if (baseCurrency == FeedBaseCurrency.USD) {\n int256 nativeTokenUsdPrice;\n uint8 usdPriceDecimals;\n\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n nativeTokenUsdPrice = int256(1e36 / usdNativeTokenPrice); // 18 decimals\n usdPriceDecimals = 18;\n } else {\n (, nativeTokenUsdPrice, , , ) = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).latestRoundData();\n if (nativeTokenUsdPrice <= 0) return 0;\n usdPriceDecimals = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).decimals();\n }\n (, int256 tokenUsdPrice, , , ) = feed.latestRoundData();\n\n return\n tokenUsdPrice >= 0\n ? ((uint256(tokenUsdPrice) * 1e18 * (10 ** uint256(usdPriceDecimals))) / (10 ** uint256(feed.decimals()))) /\n uint256(nativeTokenUsdPrice)\n : 0;\n } else {\n revert(\"unknown base currency\");\n }\n }\n\n /**\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ConcentratedLiquidityBasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"../../external/uniswap/FullMath.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title ConcentratedLiquidityBasePriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice ConcentratedLiquidityBasePriceOracle is an abstract price oracle for concentrated liquidty (UniV3-like) pairs.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\nabstract contract ConcentratedLiquidityBasePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to asset configs.\n */\n mapping(address => AssetConfig) public poolFeeds;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool public canAdminOverwrite;\n\n struct AssetConfig {\n address poolAddress;\n uint256 twapWindow;\n address baseToken;\n }\n\n address public WTOKEN;\n address[] public SUPPORTED_BASE_TOKENS;\n\n function initialize(address _wtoken, address[] memory _supportedBaseTokens) public initializer {\n __SafeOwnable_init(msg.sender);\n WTOKEN = _wtoken;\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param assetConfig The asset configuration which includes pool address and twap window.\n */\n function setPoolFeeds(address[] memory underlyings, AssetConfig[] memory assetConfig) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == assetConfig.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/config\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set asset config for underlying\n require(\n assetConfig[i].baseToken == WTOKEN || _isBaseTokenSupported(assetConfig[i].baseToken),\n \"Base token must be supported\"\n );\n poolFeeds[underlying] = assetConfig[i];\n }\n }\n\n /**\n * @notice Get the token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for WTOKEN)\n * @return Price denominated in NATIVE (scaled by 1e18)\n */\n function price(address underlying) external view returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in NATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in NATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the price for a token from Uniswap v3\n */\n function _price(address token) internal view virtual returns (uint256);\n\n function getPriceX96FromSqrtPriceX96(\n address token0,\n address priceToken,\n uint160 sqrtPriceX96\n ) public pure returns (uint256 price_) {\n price_ = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, uint256(2 ** (96 * 2)) / 1e18);\n if (token0 != priceToken) price_ = 1e36 / price_;\n }\n\n function _isBaseTokenSupported(address token) internal view returns (bool) {\n for (uint256 i = 0; i < SUPPORTED_BASE_TOKENS.length; i++) {\n if (SUPPORTED_BASE_TOKENS[i] == token) {\n return true;\n }\n }\n return false;\n }\n\n function _setSupportedBaseTokens(address[] memory _supportedBaseTokens) external onlyOwner {\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\n }\n\n function getSupportedBaseTokens() external view returns (address[] memory) {\n return SUPPORTED_BASE_TOKENS;\n }\n\n function scalePrices(address baseToken, address token, uint256 tokenPrice) internal view returns (uint256) {\n uint256 baseTokenDecimals;\n uint256 tokenPriceScaled;\n\n if (baseToken == address(0) || baseToken == WTOKEN) {\n baseTokenDecimals = 18;\n } else {\n baseTokenDecimals = uint256(ERC20Upgradeable(baseToken).decimals());\n }\n\n uint256 baseNativePrice = BasePriceOracle(msg.sender).price(baseToken);\n\n // scale tokenPrice by 1e18\n uint256 tokenDecimals = uint256(ERC20Upgradeable(token).decimals());\n if (baseTokenDecimals > tokenDecimals) {\n tokenPriceScaled = tokenPrice / (10 ** (baseTokenDecimals - tokenDecimals));\n } else if (baseTokenDecimals < tokenDecimals) {\n tokenPriceScaled = tokenPrice * (10 ** (tokenDecimals - baseTokenDecimals));\n } else {\n tokenPriceScaled = tokenPrice;\n }\n return (tokenPriceScaled * baseNativePrice) / 1e18;\n }\n}\n" + }, + "contracts/oracles/default/CurveLpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\n\nimport \"../../external/curve/ICurvePool.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracleNoRegistry\n * @author David Lucid (https://github.com/davidlucid)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract CurveLpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @dev Maps Curve LP token addresses to underlying token addresses.\n */\n mapping(address => address[]) public underlyingTokens;\n\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolOf;\n\n address[] public lpTokens;\n\n /**\n * @dev Initializes an array of LP tokens and pools if desired.\n * @param _lpTokens Array of LP token addresses.\n * @param _pools Array of pool addresses.\n * @param _poolUnderlyings The underlying token addresses of a pool\n */\n function initialize(\n address[] memory _lpTokens,\n address[] memory _pools,\n address[][] memory _poolUnderlyings\n ) public initializer {\n require(\n _lpTokens.length == _pools.length && _lpTokens.length == _poolUnderlyings.length,\n \"No LP tokens supplied or array lengths not equal.\"\n );\n\n __SafeOwnable_init(msg.sender);\n for (uint256 i = 0; i < _lpTokens.length; i++) {\n poolOf[_lpTokens[i]] = _pools[i];\n underlyingTokens[_lpTokens[i]] = _poolUnderlyings[i];\n }\n }\n\n function getAllLPTokens() public view returns (address[] memory) {\n return lpTokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < lpTokens.length; i++) {\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), 0, 0);\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token/ETH price from Curve, with 18 decimals of precision.\n * Source: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/CurveOracle.sol\n * @param lpToken The LP token contract address for price retrieval.\n */\n function _price(address lpToken) internal view returns (uint256) {\n address pool = poolOf[lpToken];\n require(pool != address(0), \"LP token is not registered.\");\n address[] memory tokens = underlyingTokens[lpToken];\n uint256 minPx = type(uint256).max;\n uint256 n = tokens.length;\n\n for (uint256 i = 0; i < n; i++) {\n address ulToken = tokens[i];\n uint256 tokenPx = BasePriceOracle(msg.sender).price(ulToken);\n if (tokenPx < minPx) minPx = tokenPx;\n }\n\n require(minPx != type(uint256).max, \"No minimum underlying token price found.\");\n return (minPx * ICurvePool(pool).get_virtual_price()) / 1e18; // Use min underlying token prices\n }\n\n /**\n * @dev Register the pool given LP token address and set the pool info.\n * @param _lpToken LP token to find the corresponding pool.\n * @param _pool Pool address.\n * @param _underlyings Underlying addresses.\n */\n function registerPool(\n address _lpToken,\n address _pool,\n address[] memory _underlyings\n ) external onlyOwner {\n poolOf[_lpToken] = _pool;\n underlyingTokens[_lpToken] = _underlyings;\n\n bool skip = false;\n for (uint256 j = 0; j < lpTokens.length; j++) {\n if (lpTokens[j] == _lpToken) {\n skip = true;\n break;\n }\n }\n if (!skip) lpTokens.push(_lpToken);\n }\n\n /**\n * @dev getter for the underlying tokens\n * @param lpToken the LP token address.\n * @return _underlyings Underlying addresses.\n */\n function getUnderlyingTokens(address lpToken) public view returns (address[] memory) {\n return underlyingTokens[lpToken];\n }\n}\n" + }, + "contracts/oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\n\nimport \"../../external/curve/ICurveV2Pool.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\n */\ncontract CurveV2LpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\n address public usdToken;\n MasterPriceOracle public masterPriceOracle;\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolOf;\n\n address[] public lpTokens;\n\n /**\n * @dev Initializes an array of LP tokens and pools if desired.\n * @param _lpTokens Array of LP token addresses.\n * @param _pools Array of pool addresses.\n */\n function initialize(address[] memory _lpTokens, address[] memory _pools) public initializer {\n require(_lpTokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\n __SafeOwnable_init(msg.sender);\n\n for (uint256 i = 0; i < _pools.length; i++) {\n poolOf[_lpTokens[i]] = _pools[i];\n }\n }\n\n function getAllLPTokens() public view returns (address[] memory) {\n return lpTokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < lpTokens.length; i++) {\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), int128(0), int128(0));\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\n * @param lpToken The LP token contract address for price retrieval.\n */\n function _price(address lpToken) internal view returns (uint256) {\n address pool = poolOf[lpToken];\n require(address(pool) != address(0), \"LP token is not registered.\");\n\n address baseToken = ICurvePool(pool).coins(0);\n uint256 lpPrice = ICurveV2Pool(pool).lp_price();\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n return (lpPrice * baseTokenPrice) / 10**18;\n }\n\n /**\n * @dev Register the pool given LP token address and set the pool info.\n * @param _lpToken LP token to find the corresponding pool.\n * @param _pool Pool address.\n */\n function registerPool(address _lpToken, address _pool) external onlyOwner {\n address pool = poolOf[_lpToken];\n require(pool == address(0), \"This LP token is already registered.\");\n poolOf[_lpToken] = _pool;\n\n bool skip = false;\n for (uint256 j = 0; j < lpTokens.length; j++) {\n if (lpTokens[j] == _lpToken) {\n skip = true;\n break;\n }\n }\n if (!skip) lpTokens.push(_lpToken);\n }\n}\n" + }, + "contracts/oracles/default/CurveV2PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\n\nimport \"../../external/curve/ICurveV2Pool.sol\";\n\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\n */\ncontract CurveV2PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolFor;\n\n address[] public tokens;\n\n /**\n * @dev Initializes an array of tokens and pools if desired.\n * @param _tokens Array of token addresses.\n * @param _pools Array of pool addresses.\n */\n function initialize(address[] memory _tokens, address[] memory _pools) public initializer {\n require(_tokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\n __SafeOwnable_init(msg.sender);\n\n for (uint256 i = 0; i < _pools.length; i++) {\n try ICurvePool(_pools[i]).coins(2) returns (address) {\n revert(\"!only two token pools\");\n } catch {\n // ignore error\n }\n\n poolFor[_tokens[i]] = _pools[i];\n }\n }\n\n function getAllSupportedTokens() public view returns (address[] memory) {\n return tokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < tokens.length; i++) {\n ICurvePool pool = ICurvePool(poolFor[tokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), int128(0), int128(0));\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\n * @param token The LP token contract address for price retrieval.\n */\n function _price(address token) internal view returns (uint256) {\n address pool = poolFor[token];\n require(address(pool) != address(0), \"Token is not registered.\");\n\n address baseToken;\n // Returns always coin(1) / coin(0) [ e.g. USDC (1) / eUSDC (1) ]\n uint256 exchangeRate = ICurveV2Pool(pool).price_oracle();\n\n if (ICurvePool(pool).coins(0) == token) {\n baseToken = ICurvePool(pool).coins(1);\n // USDC / ETH\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n // USDC / ETH * eUSDC / USDC = eUSDC / ETH\n return (baseTokenPrice * 10**18) / exchangeRate;\n } else {\n // if coin(1) is eUSDC, exchangeRate is USDC / eUSDC\n baseToken = ICurvePool(pool).coins(0);\n // USDC / ETH\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n // (USDC / ETH) * (1 / (USDC / eUSDC)) = eUSDC / ETH\n return (baseTokenPrice * exchangeRate) / 10**18;\n }\n }\n\n /**\n * @dev Register the pool given token address and set the pool info.\n * @param _token token to find the corresponding pool.\n * @param _pool Pool address.\n */\n function registerPool(address _token, address _pool) external onlyOwner {\n try ICurvePool(_pool).coins(2) returns (address) {\n revert(\"!only two token pools\");\n } catch {\n // ignore error\n }\n\n address pool = poolFor[_token];\n require(pool == address(0), \"This LP token is already registered.\");\n poolFor[_token] = _pool;\n\n bool skip = false;\n for (uint256 j = 0; j < tokens.length; j++) {\n if (tokens[j] == _token) {\n skip = true;\n break;\n }\n }\n if (!skip) tokens.push(_token);\n }\n}\n" + }, + "contracts/oracles/default/DiaPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IPriceOracle } from \"../../external/compound/IPriceOracle.sol\";\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\n\ninterface DIAOracleV2 {\n function getValue(string memory key) external view returns (uint128, uint128);\n}\n\n/**\n * @title DiaPriceOracle\n * @notice Returns prices from DIA.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract DiaPriceOracle is BasePriceOracle {\n struct DiaOracle {\n DIAOracleV2 feed;\n string key;\n }\n\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => DiaOracle) public priceFeeds;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool public immutable CAN_ADMIN_OVERWRITE;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public immutable WTOKEN;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n DIAOracleV2 public immutable NATIVE_TOKEN_USD_PRICE_FEED;\n string public NATIVE_TOKEN_USD_KEY;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n MasterPriceOracle public immutable MASTER_PRICE_ORACLE;\n address public immutable USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n constructor(\n address _admin,\n bool canAdminOverwrite,\n address wtoken,\n DIAOracleV2 nativeTokenUsd,\n string memory nativeTokenUsdKey,\n MasterPriceOracle masterPriceOracle,\n address usdToken\n ) {\n admin = _admin;\n CAN_ADMIN_OVERWRITE = canAdminOverwrite;\n WTOKEN = wtoken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n NATIVE_TOKEN_USD_KEY = nativeTokenUsdKey;\n MASTER_PRICE_ORACLE = masterPriceOracle;\n USD_TOKEN = usdToken;\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The DIA price feed contract addresses for each of `underlyings`.\n * @param keys The keys for each of `underlyings`, in the format \"ETH/USD\" for example\n */\n function setPriceFeeds(\n address[] memory underlyings,\n DIAOracleV2[] memory feeds,\n string[] memory keys\n ) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length && underlyings.length == keys.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n\n // Check for existing oracle if !canAdminOverwrite\n if (!CAN_ADMIN_OVERWRITE)\n require(\n address(priceFeeds[underlying].feed) == address(0),\n \"Admin cannot overwrite existing assignments of price feeds to underlying tokens.\"\n );\n\n // Set feed and base currency\n priceFeeds[underlying] = DiaOracle({ feed: feeds[i], key: keys[i] });\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals!\n */\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for WTOKEN\n if (underlying == WTOKEN || underlying == address(0)) return 1e18;\n\n // Get token/Native price from Oracle\n DiaOracle memory feed = priceFeeds[underlying];\n require(address(feed.feed) != address(0), \"No oracle price feed found for this underlying ERC20 token.\");\n\n if (address(NATIVE_TOKEN_USD_PRICE_FEED) == address(0)) {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = MASTER_PRICE_ORACLE.price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\n } else {\n (uint128 nativeTokenUsdPrice, ) = NATIVE_TOKEN_USD_PRICE_FEED.getValue(NATIVE_TOKEN_USD_KEY);\n if (nativeTokenUsdPrice <= 0) return 0;\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ERC4626Oracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IERC4626 } from \"../../compound/IERC4626.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\ncontract ERC4626Oracle is SafeOwnableUpgradeable, BasePriceOracle {\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token/ETH price from Balancer, with 18 decimals of precision.\n */\n function _price(address underlying) internal view virtual returns (uint256) {\n IERC4626 vault = IERC4626(underlying);\n address asset = vault.asset();\n uint256 redeemAmount = vault.previewRedeem(10 ** vault.decimals());\n uint256 underlyingPrice = BasePriceOracle(msg.sender).price(asset);\n return (redeemAmount * underlyingPrice) / 10 ** ERC20Upgradeable(asset).decimals();\n }\n}\n" + }, + "contracts/oracles/default/FixedNativePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title FixedEthPriceOracle\n * @notice Returns fixed prices of 1 denominated in the chain's native token for all tokens (expected to be used under a `MasterPriceOracle`).\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract FixedNativePriceOracle is BasePriceOracle {\n /**\n * @dev Returns the price in native token of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return 1e18;\n }\n\n /**\n * @notice Returns the price in native token of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in native token of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n return 1e18;\n }\n}\n" + }, + "contracts/oracles/default/FixedTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title FixedTokenPriceOracle\n * @notice Returns token prices using the prices for another token.\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract FixedTokenPriceOracle is BasePriceOracle {\n /**\n * @dev The token to base prices on.\n */\n address public immutable baseToken;\n\n /**\n * @dev Sets the token to base prices on.\n */\n constructor(address _baseToken) {\n baseToken = _baseToken;\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return BasePriceOracle(msg.sender).price(baseToken);\n }\n}\n" + }, + "contracts/oracles/default/PreferredPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\nimport \"../MasterPriceOracle.sol\";\nimport \"../default/ChainlinkPriceOracleV2.sol\";\n\n/**\n * @title PreferredPriceOracle\n * @notice Returns prices from MasterPriceOracle, ChainlinkPriceOracleV2, or prices from a tertiary oracle (in order of preference).\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract PreferredPriceOracle is BasePriceOracle {\n /**\n * @dev The primary `MasterPriceOracle`.\n */\n MasterPriceOracle public masterOracle;\n\n /**\n * @dev The secondary `ChainlinkPriceOracleV2`.\n */\n ChainlinkPriceOracleV2 public chainlinkOracleV2;\n\n /**\n * @dev The tertiary `PriceOracle`.\n */\n BasePriceOracle public tertiaryOracle;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Constructor to set the primary `MasterPriceOracle`, the secondary `ChainlinkPriceOracleV2`, and the tertiary `PriceOracle`.\n */\n constructor(\n MasterPriceOracle _masterOracle,\n ChainlinkPriceOracleV2 _chainlinkOracleV2,\n BasePriceOracle _tertiaryOracle,\n address _wtoken\n ) {\n require(address(_masterOracle) != address(0), \"MasterPriceOracle not set.\");\n require(address(_chainlinkOracleV2) != address(0), \"ChainlinkPriceOracleV2 not set.\");\n require(address(_tertiaryOracle) != address(0), \"Tertiary price oracle not set.\");\n masterOracle = _masterOracle;\n chainlinkOracleV2 = _chainlinkOracleV2;\n tertiaryOracle = _tertiaryOracle;\n wtoken = _wtoken;\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Try to get MasterPriceOracle price\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.price(underlying);\n\n // Try to get ChainlinkPriceOracleV2 price\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0)) return chainlinkOracleV2.price(underlying);\n\n // Otherwise, get price from tertiary oracle\n return BasePriceOracle(address(tertiaryOracle)).price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = cToken.underlying();\n\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Try to get MasterPriceOracle price\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.getUnderlyingPrice(cToken);\n\n // Try to get ChainlinkPriceOracleV2 price\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0))\n return chainlinkOracleV2.getUnderlyingPrice(cToken);\n\n // Otherwise, get price from tertiary oracle\n return tertiaryOracle.getUnderlyingPrice(cToken);\n }\n}\n" + }, + "contracts/oracles/default/PythPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title PythPriceOracle\n * @notice Returns prices from Pyth.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract PythPriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to Pyth price IDs.\n */\n mapping(address => bytes32) public priceFeedIds;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n bytes32 public NATIVE_TOKEN_USD_FEED;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n\n IPyth public PYTH;\n\n function initialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public initializer {\n __SafeOwnable_init(msg.sender);\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n }\n\n function reinitialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public onlyOwnerOrAdmin {\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feedIds The Pyth Network feed IDs`.\n */\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feedIds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeedIds[underlying] = feedIds[i];\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/native price from Oracle\n bytes32 feed = priceFeedIds[underlying];\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\n\n if (NATIVE_TOKEN_USD_FEED == \"\") {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\n return\n tokenUsdPrice.price >= 0 ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\n } else {\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\n if (nativeTokenUsdPrice <= 0) return 0;\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/PythPriceOracleDmBTC.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title PythPriceOracle\n * @notice Returns prices from Pyth.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract PythPriceOracleDmBTC is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to Pyth price IDs.\n */\n mapping(address => bytes32) public priceFeedIds;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n bytes32 public NATIVE_TOKEN_USD_FEED;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n\n IPyth public PYTH;\n\n address public DMBTC;\n\n function initialize(\n address pythAddress,\n bytes32 nativeTokenUsdFeed,\n address usdToken,\n address dmBTC\n ) public initializer {\n __SafeOwnable_init(msg.sender);\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n DMBTC = dmBTC;\n }\n\n function reinitialize(\n address pythAddress,\n bytes32 nativeTokenUsdFeed,\n address usdToken,\n address dmBTC\n ) public onlyOwnerOrAdmin {\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n DMBTC = dmBTC;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feedIds The Pyth Network feed IDs`.\n */\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feedIds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeedIds[underlying] = feedIds[i];\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/native price from Oracle\n bytes32 feed = priceFeedIds[underlying];\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\n uint256 normalizedPrice;\n if (NATIVE_TOKEN_USD_FEED == \"\") {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\n normalizedPrice = tokenUsdPrice.price >= 0\n ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice)\n : 0;\n } else {\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\n if (nativeTokenUsdPrice <= 0) return 0;\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\n normalizedPrice = tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n if (underlying == DMBTC) {\n return normalizedPrice / 100000;\n }\n return normalizedPrice;\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracle is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWeETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracleWeETH is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // special case for wrsETH\n // if input is wrsETH, we need to get the price of rsETH\n if (underlying == 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A) {\n underlying = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n }\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWrsETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracleWrsETH is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // special case for wrsETH\n // if input is wrsETH, we need to get the price of rsETH\n if (underlying == 0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd) {\n underlying = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\n }\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/SimplePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\ncontract SimplePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n mapping(address => uint256) prices;\n event PricePosted(\n address asset,\n uint256 previousPriceMantissa,\n uint256 requestedPriceMantissa,\n uint256 newPriceMantissa\n );\n\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\n if (compareStrings(cToken.symbol(), \"cETH\")) {\n return 1e18;\n } else {\n address underlying = ICErc20(address(cToken)).underlying();\n uint256 oraclePrice = prices[underlying];\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n }\n\n function setUnderlyingPrice(ICErc20 cToken, uint256 underlyingPriceMantissa) public onlyOwner {\n address asset = ICErc20(address(cToken)).underlying();\n emit PricePosted(asset, prices[asset], underlyingPriceMantissa, underlyingPriceMantissa);\n prices[asset] = underlyingPriceMantissa;\n }\n\n function setDirectPrice(address asset, uint256 _price) public onlyOwner {\n emit PricePosted(asset, prices[asset], _price, _price);\n prices[asset] = _price;\n }\n\n function price(address underlying) external view returns (uint256) {\n return prices[address(underlying)];\n }\n\n // v1 price oracle interface for use as backing of proxy\n function assetPrices(address asset) external view returns (uint256) {\n return prices[asset];\n }\n\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n}\n" + }, + "contracts/oracles/default/UniswapLikeLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title UniswapLpTokenPriceOracle\n * @author David Lucid (https://github.com/davidlucid)\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\nabstract contract UniswapLikeLpTokenPriceOracle is BasePriceOracle {\n /**\n * @dev wtoken contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n constructor(address _wtoken) {\n wtoken = _wtoken;\n }\n\n function _price(address token) internal view virtual returns (uint256);\n\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @dev Fast square root function.\n * Implementation from: https://github.com/Uniswap/uniswap-lib/commit/99f3f28770640ba1bb1ff460ac7c5292fb8291a0\n * Original implementation: https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687\n */\n function sqrt(uint256 x) internal pure returns (uint256) {\n if (x == 0) return 0;\n uint256 xx = x;\n uint256 r = 1;\n\n if (xx >= 0x100000000000000000000000000000000) {\n xx >>= 128;\n r <<= 64;\n }\n if (xx >= 0x10000000000000000) {\n xx >>= 64;\n r <<= 32;\n }\n if (xx >= 0x100000000) {\n xx >>= 32;\n r <<= 16;\n }\n if (xx >= 0x10000) {\n xx >>= 16;\n r <<= 8;\n }\n if (xx >= 0x100) {\n xx >>= 8;\n r <<= 4;\n }\n if (xx >= 0x10) {\n xx >>= 4;\n r <<= 2;\n }\n if (xx >= 0x8) {\n r <<= 1;\n }\n\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return (r < r1 ? r : r1);\n }\n}\n" + }, + "contracts/oracles/default/UniswapLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { UniswapLikeLpTokenPriceOracle } from \"./UniswapLikeLpTokenPriceOracle.sol\";\n\n/**\n * @title UniswapLpTokenPriceOracle\n * @author David Lucid (https://github.com/davidlucid)\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract UniswapLpTokenPriceOracle is UniswapLikeLpTokenPriceOracle {\n /**\n * @dev Fetches the fair LP token/ETH price from Uniswap, with 18 decimals of precision.\n */\n constructor(address _wtoken) UniswapLikeLpTokenPriceOracle(_wtoken) {}\n\n function _price(address token) internal view virtual override returns (uint256) {\n IUniswapV2Pair pair = IUniswapV2Pair(token);\n uint256 totalSupply = pair.totalSupply();\n if (totalSupply == 0) return 0;\n (uint256 r0, uint256 r1, ) = pair.getReserves();\n\n r0 = r0 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token0()).decimals()));\n r1 = r1 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token1()).decimals()));\n\n address token0 = pair.token0();\n address token1 = pair.token1();\n\n // Get fair price of non-WETH token (underlying the pair) in terms of ETH\n uint256 token0FairPrice = token0 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token0);\n uint256 token1FairPrice = token1 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token1);\n\n // Implementation from https://github.com/AlphaFinanceLab/homora-v2/blob/e643392d582c81f6695136971cff4b685dcd2859/contracts/oracle/UniswapV2Oracle.sol#L18\n uint256 sqrtK = (sqrt(r0 * r1) * (2 ** 112)) / totalSupply;\n return (((sqrtK * 2 * sqrt(token0FairPrice)) / (2 ** 56)) * sqrt(token1FairPrice)) / (2 ** 56);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport \"./UniswapTwapPriceOracleV2Root.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2 is Initializable, BasePriceOracle {\n /**\n * @dev wtoken token contract address.\n */\n address public wtoken;\n\n /**\n * @dev UniswapTwapPriceOracleV2Root contract address.\n */\n UniswapTwapPriceOracleV2Root public rootOracle;\n\n /**\n * @dev UniswapV2Factory contract address.\n */\n address public uniswapV2Factory;\n\n /**\n * @dev The token on which to base TWAPs (its price must be available via `msg.sender`).\n */\n address public baseToken;\n\n /**\n * @dev Initalize that sets the UniswapTwapPriceOracleV2Root, UniswapV2Factory, and base token.\n * @param _rootOracle Sets `UniswapTwapPriceOracleV2Root`\n * @param _uniswapV2Factory Sets `UniswapV2Factory`\n * @param _baseToken The token on which to base TWAPs (its price must be available via `msg.sender`).\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address _rootOracle,\n address _uniswapV2Factory,\n address _baseToken,\n address _wtoken\n ) external initializer {\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\n require(_uniswapV2Factory != address(0), \"UniswapV2Factory not defined.\");\n rootOracle = UniswapTwapPriceOracleV2Root(_rootOracle);\n uniswapV2Factory = _uniswapV2Factory;\n wtoken = _wtoken;\n baseToken = _baseToken == address(0) ? address(wtoken) : _baseToken;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = cToken.underlying();\n\n // Get price, format, and return\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n return (_price(underlying) * 1e18) / baseUnit;\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n */\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Return root oracle ERC20/ETH TWAP\n uint256 twap = rootOracle.price(underlying, baseToken, uniswapV2Factory);\n return\n baseToken == address(wtoken)\n ? twap\n : (twap * BasePriceOracle(msg.sender).price(baseToken)) /\n (10 ** uint256(ERC20Upgradeable(baseToken).decimals()));\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Factory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol\";\n\nimport \"./UniswapTwapPriceOracleV2.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2Factory\n * @notice Deploys and catalogs UniswapTwapPriceOracleV2 contracts.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2Factory {\n /**\n * @dev WETH token contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev `UniswapTwapPriceOracleV2Root` contract address.\n */\n address public immutable rootOracle;\n\n /**\n * @dev Implementation address for the `UniswapV3TwapPriceOracleV2`.\n */\n address public immutable logic;\n\n /**\n * @notice Maps `UniswapV2Factory` contracts to base tokens to `UniswapTwapPriceOracleV2` contract addresses.\n */\n mapping(address => mapping(address => UniswapTwapPriceOracleV2)) public oracles;\n\n /**\n * @dev Constructor that sets the `UniswapTwapPriceOracleV2Root` and `UniswapTwapPriceOracleV2` implementation contract.\n */\n constructor(address _rootOracle, address _logic, address _wtoken) {\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\n require(_logic != address(0), \"UniswapTwapPriceOracleV2 implementation/logic contract not defined.\");\n rootOracle = _rootOracle;\n logic = _logic;\n wtoken = _wtoken;\n }\n\n /**\n * @notice Deploys a `UniswapTwapPriceOracleV2`.\n * @param uniswapV2Factory The `UniswapV2Factory` contract of the pairs for which this oracle will be used.\n * @param baseToken The base token of the pairs for which this oracle will be used.\n */\n function deploy(address uniswapV2Factory, address baseToken) external returns (address) {\n // Input validation\n if (baseToken == address(0)) baseToken = address(wtoken);\n\n // Return existing oracle if present\n address currentOracle = address(oracles[uniswapV2Factory][baseToken]);\n if (currentOracle != address(0)) return currentOracle;\n\n // Deploy oracle\n bytes32 salt = keccak256(abi.encodePacked(uniswapV2Factory, baseToken));\n address oracle = ClonesUpgradeable.cloneDeterministic(logic, salt);\n UniswapTwapPriceOracleV2(oracle).initialize(rootOracle, uniswapV2Factory, baseToken, wtoken);\n\n // Set oracle in state\n oracles[uniswapV2Factory][baseToken] = UniswapTwapPriceOracleV2(oracle);\n\n // Return oracle address\n return oracle;\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Resolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IResolver } from \"ops/interfaces/IResolver.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"./UniswapTwapPriceOracleV2Root.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract UniswapTwapPriceOracleV2Resolver is IResolver, Ownable {\n struct PairConfig {\n address pair;\n address baseToken;\n uint256 minPeriod;\n uint256 deviationThreshold;\n }\n\n // need to store as arrays for the UniswapTwapPriceOracleV2Root workable functions\n address[] pairs;\n address[] baseTokens;\n uint256[] minPeriods;\n uint256[] deviationThresholds;\n\n UniswapTwapPriceOracleV2Root public root;\n uint256 public lastUpdate;\n\n constructor(PairConfig[] memory _pairConfigs, UniswapTwapPriceOracleV2Root _root) {\n for (uint256 i = 0; i < _pairConfigs.length; i++) {\n pairs[i] = _pairConfigs[i].pair;\n baseTokens[i] = _pairConfigs[i].baseToken;\n minPeriods[i] = _pairConfigs[i].minPeriod;\n deviationThresholds[i] = _pairConfigs[i].deviationThreshold;\n }\n root = _root;\n }\n\n function getPairs() external view returns (PairConfig[] memory) {\n PairConfig[] memory pairConfigs = new PairConfig[](pairs.length);\n for (uint256 i = 0; i < pairs.length; i++) {\n PairConfig memory pairConfig = PairConfig({\n pair: pairs[i],\n baseToken: baseTokens[i],\n minPeriod: minPeriods[i],\n deviationThreshold: deviationThresholds[i]\n });\n pairConfigs[i] = pairConfig;\n }\n return pairConfigs;\n }\n\n function changeRoot(UniswapTwapPriceOracleV2Root _root) external onlyOwner {\n root = _root;\n }\n\n function removeFromPairs(uint256 index) external onlyOwner {\n if (index >= pairs.length) return;\n\n for (uint256 i = index; i < pairs.length - 1; i++) {\n pairs[i] = pairs[i + 1];\n baseTokens[i] = baseTokens[i + 1];\n minPeriods[i] = minPeriods[i + 1];\n deviationThresholds[i] = deviationThresholds[i + 1];\n }\n pairs.pop();\n baseTokens.pop();\n minPeriods.pop();\n deviationThresholds.pop();\n }\n\n function addPair(PairConfig calldata pair) external onlyOwner {\n pairs.push(pair.pair);\n baseTokens.push(pair.baseToken);\n minPeriods.push(pair.minPeriod);\n deviationThresholds.push(pair.deviationThreshold);\n }\n\n function getWorkablePairs() public view returns (address[] memory) {\n bool[] memory workable = root.workable(pairs, baseTokens, minPeriods, deviationThresholds);\n uint256 workableCount = 0;\n for (uint256 i = 0; i < workable.length; i += 1) {\n if (workable[i]) {\n workableCount += 1;\n }\n }\n\n address[] memory workablePairs = new address[](workableCount);\n uint256 j = 0;\n\n for (uint256 i = 0; i < workable.length; i++) {\n if (workable[i]) {\n workablePairs[j++] = pairs[i];\n }\n }\n return workablePairs;\n }\n\n function updatePairs(address[] calldata workablePairs) external {\n if (workablePairs.length == 0) return;\n root.update(workablePairs);\n }\n\n function checker() external view override returns (bool canExec, bytes memory execPayload) {\n address[] memory workablePairs = getWorkablePairs();\n if (workablePairs.length == 0) {\n return (false, bytes(\"No workable pairs\"));\n }\n\n canExec = true;\n execPayload = abi.encodeWithSelector(this.updatePairs.selector, workablePairs);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Root.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport \"../../external/uniswap/IUniswapV2Factory.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2Root\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2Root {\n /**\n * @dev wtoken token contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev Minimum TWAP interval.\n */\n uint256 public constant MIN_TWAP_TIME = 15 minutes;\n\n /**\n * @dev Constructor to set wtoken address\n */\n constructor(address _wtoken) {\n wtoken = _wtoken;\n }\n\n /**\n * @dev Return the TWAP value price0. Revert if TWAP time range is not within the threshold.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The pair to query for price0.\n */\n function price0TWAP(address pair) internal view returns (uint256) {\n uint256 length = observationCount[pair];\n require(length > 0, \"No length-1 TWAP observation.\");\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\n require(length > 1, \"No length-2 TWAP observation.\");\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\n }\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\n uint256 currPx0Cumu = currentPx0Cumu(pair);\n unchecked {\n return (currPx0Cumu - lastObservation.price0Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\n }\n }\n\n /**\n * @dev Return the TWAP value price1. Revert if TWAP time range is not within the threshold.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The pair to query for price1.\n */\n function price1TWAP(address pair) internal view returns (uint256) {\n uint256 length = observationCount[pair];\n require(length > 0, \"No length-1 TWAP observation.\");\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\n require(length > 1, \"No length-2 TWAP observation.\");\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\n }\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\n uint256 currPx1Cumu = currentPx1Cumu(pair);\n unchecked {\n return (currPx1Cumu - lastObservation.price1Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\n }\n }\n\n /**\n * @dev Return the current price0 cumulative value on Uniswap.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The uniswap pair to query for price0 cumulative value.\n */\n function currentPx0Cumu(address pair) internal view returns (uint256 px0Cumu) {\n uint32 currTime = uint32(block.timestamp);\n px0Cumu = IUniswapV2Pair(pair).price0CumulativeLast();\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n if (lastTime != block.timestamp) {\n unchecked {\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\n px0Cumu += uint256((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired\n }\n }\n }\n\n /**\n * @dev Return the current price1 cumulative value on Uniswap.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The uniswap pair to query for price1 cumulative value.\n */\n function currentPx1Cumu(address pair) internal view returns (uint256 px1Cumu) {\n uint32 currTime = uint32(block.timestamp);\n px1Cumu = IUniswapV2Pair(pair).price1CumulativeLast();\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n if (lastTime != currTime) {\n unchecked {\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\n px1Cumu += uint256((reserve0 << 112) / reserve1) * timeElapsed; // overflow is desired\n }\n }\n }\n\n /**\n * @dev Returns the price of `underlying` in terms of `baseToken` given `factory`.\n */\n function price(address underlying, address baseToken, address factory) external view returns (uint256) {\n // Return ERC20/ETH TWAP\n address pair = IUniswapV2Factory(factory).getPair(underlying, baseToken);\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n return (((underlying < baseToken ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\n }\n\n /**\n * @dev Struct for cumulative price observations.\n */\n struct Observation {\n uint32 timestamp;\n uint256 price0Cumulative;\n uint256 price1Cumulative;\n }\n\n /**\n * @dev Length after which observations roll over to index 0.\n */\n uint8 public constant OBSERVATION_BUFFER = 4;\n\n /**\n * @dev Total observation count for each pair.\n */\n mapping(address => uint256) public observationCount;\n\n /**\n * @dev Array of cumulative price observations for each pair.\n */\n mapping(address => Observation[OBSERVATION_BUFFER]) public observations;\n\n /// @notice Get pairs for token combinations.\n function pairsFor(\n address[] calldata tokenA,\n address[] calldata tokenB,\n address factory\n ) external view returns (address[] memory) {\n require(\n tokenA.length > 0 && tokenA.length == tokenB.length,\n \"Token array lengths must be equal and greater than 0.\"\n );\n address[] memory pairs = new address[](tokenA.length);\n for (uint256 i = 0; i < tokenA.length; i++) pairs[i] = IUniswapV2Factory(factory).getPair(tokenA[i], tokenB[i]);\n return pairs;\n }\n\n /// @notice Check which of multiple pairs are workable/updatable.\n function workable(\n address[] calldata pairs,\n address[] calldata baseTokens,\n uint256[] calldata minPeriods,\n uint256[] calldata deviationThresholds\n ) external view returns (bool[] memory) {\n require(\n pairs.length > 0 &&\n pairs.length == baseTokens.length &&\n pairs.length == minPeriods.length &&\n pairs.length == deviationThresholds.length,\n \"Array lengths must be equal and greater than 0.\"\n );\n bool[] memory answers = new bool[](pairs.length);\n for (uint256 i = 0; i < pairs.length; i++)\n answers[i] = _workable(pairs[i], baseTokens[i], minPeriods[i], deviationThresholds[i]);\n return answers;\n }\n\n /// @dev Internal function to check if a pair is workable (updateable AND reserves have changed AND deviation threshold is satisfied).\n function _workable(\n address pair,\n address baseToken,\n uint256 minPeriod,\n uint256 deviationThreshold\n ) internal view returns (bool) {\n // Workable if:\n // 1) We have no observations\n // 2) The elapsed time since the last observation is > minPeriod AND reserves have changed AND deviation threshold is satisfied\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n if (observationCount[pair] <= 0) return true;\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n return\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\n (minPeriod >= MIN_TWAP_TIME ? minPeriod : MIN_TWAP_TIME) &&\n lastTime != observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp &&\n _deviation(pair, baseToken) >= deviationThreshold;\n }\n\n /// @dev Internal function to check if a pair's spot price's deviation from its TWAP price as a ratio scaled by 1e18\n function _deviation(address pair, address baseToken) internal view returns (uint256) {\n // Get token base unit\n address token0 = IUniswapV2Pair(pair).token0();\n bool useToken0Price = token0 != baseToken;\n address underlying = useToken0Price ? token0 : IUniswapV2Pair(pair).token1();\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n\n // Get TWAP price\n uint256 twapPrice = (((useToken0Price ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\n\n // Get spot price\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();\n uint256 spotPrice = useToken0Price ? (reserve1 * baseUnit) / reserve0 : (reserve0 * baseUnit) / reserve1;\n\n // Get ratio and return deviation\n uint256 ratio = (spotPrice * 1e18) / twapPrice;\n return ratio >= 1e18 ? ratio - 1e18 : 1e18 - ratio;\n }\n\n /// @dev Internal function to check if a pair is updatable at all.\n function _updateable(address pair) internal view returns (bool) {\n // Updateable if:\n // 1) We have no observations\n // 2) The elapsed time since the last observation is > MIN_TWAP_TIME\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n return\n observationCount[pair] <= 0 ||\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\n MIN_TWAP_TIME;\n }\n\n /// @notice Update one pair.\n function update(address pair) external {\n require(_update(pair), \"Failed to update pair.\");\n }\n\n /// @notice Update multiple pairs at once.\n function update(address[] calldata pairs) external {\n bool worked = false;\n for (uint256 i = 0; i < pairs.length; i++) if (_update(pairs[i])) worked = true;\n require(worked, \"No pairs can be updated (yet).\");\n }\n\n /// @dev Internal function to update a single pair.\n function _update(address pair) internal returns (bool) {\n // Check if workable\n if (!_updateable(pair)) return false;\n\n // Get cumulative price(s)\n uint256 price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();\n uint256 price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();\n\n // Loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n observations[pair][observationCount[pair] % OBSERVATION_BUFFER] = Observation(\n lastTime,\n price0Cumulative,\n price1Cumulative\n );\n observationCount[pair]++;\n return true;\n }\n}\n" + }, + "contracts/oracles/default/UniswapV3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../BasePriceOracle.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { ConcentratedLiquidityBasePriceOracle } from \"./ConcentratedLiquidityBasePriceOracle.sol\";\n\nimport \"../../external/uniswap/TickMath.sol\";\nimport \"../../external/uniswap/FullMath.sol\";\nimport \"../../external/uniswap/IUniswapV3Pool.sol\";\n\n/**\n * @title UniswapV3PriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice UniswapV3PriceOracle is a price oracle for Uniswap V3 pairs.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract UniswapV3PriceOracle is ConcentratedLiquidityBasePriceOracle {\n /**\n * @dev Fetches the price for a token from Algebra pools.\n */\n\n function _price(address token) internal view override returns (uint256) {\n uint32[] memory secondsAgos = new uint32[](2);\n uint256 twapWindow = poolFeeds[token].twapWindow;\n address baseToken = poolFeeds[token].baseToken;\n\n secondsAgos[0] = uint32(twapWindow);\n secondsAgos[1] = 0;\n\n IUniswapV3Pool pool = IUniswapV3Pool(poolFeeds[token].poolAddress);\n (int56[] memory tickCumulatives, ) = pool.observe(secondsAgos);\n\n int24 tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int56(int256(twapWindow)));\n uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(tick);\n\n uint256 tokenPrice = getPriceX96FromSqrtPriceX96(pool.token0(), token, sqrtPriceX96);\n return scalePrices(baseToken, token, tokenPrice);\n }\n}\n" + }, + "contracts/oracles/default/VelodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface Prices {\n function getRateToEth(address srcToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\n}\n\ncontract VelodromePriceOracle is BasePriceOracle {\n Prices immutable prices;\n\n constructor(address _prices) {\n prices = Prices(_prices);\n }\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return prices.getRateToEth(token, false);\n }\n}\n" + }, + "contracts/oracles/default/VelodromePriceOracleFraxtal.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface Prices_Fraxtal {\n function getRate(address srcToken, address dstToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\n}\n\ncontract VelodromePriceOracleFraxtal is BasePriceOracle {\n Prices_Fraxtal immutable prices;\n\n constructor(address _prices) {\n prices = Prices_Fraxtal(_prices);\n }\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return prices.getRate(token, 0xFC00000000000000000000000000000000000006, false);\n }\n}\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\n\n/**\n * @title MasterPriceOracle\n * @notice Use a combination of price oracles.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public oracles;\n\n /**\n * @dev Default/fallback `PriceOracle`.\n */\n BasePriceOracle public defaultOracle;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool internal noAdminOverwrite;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public fallbackOracles;\n\n /**\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n function canAdminOverwrite() external view returns (bool) {\n return !noAdminOverwrite;\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Event emitted when the default oracle is changed.\n */\n event NewDefaultOracle(address oldOracle, address newOracle);\n\n /**\n * @dev Event emitted when an underlying token's oracle is changed.\n */\n event NewOracle(address underlying, address oldOracle, address newOracle);\n\n /**\n * @dev Initialize state variables.\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\n * @param _defaultOracle The default `PriceOracle` contract to use.\n * @param _admin The admin who can assign oracles to underlying tokens.\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address[] memory underlyings,\n BasePriceOracle[] memory _oracles,\n BasePriceOracle _defaultOracle,\n address _admin,\n bool _canAdminOverwrite,\n address _wtoken\n ) external initializer {\n // Input validation\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\n\n // Initialize state variables\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, address(0), address(newOracle));\n }\n\n defaultOracle = _defaultOracle;\n admin = _admin;\n noAdminOverwrite = !_canAdminOverwrite;\n wtoken = _wtoken;\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(oracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(fallbackOracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n fallbackOracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Changes the default price oracle\n */\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\n BasePriceOracle oldOracle = defaultOracle;\n defaultOracle = newOracle;\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = address(ICErc20(address(cToken)).underlying());\n\n if (underlying == wtoken) return 1e18;\n\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n\n /**\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) public view override returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == wtoken) return 1e18;\n\n // Get underlying price from assigned oracle\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n}\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./compound/Unitroller.sol\";\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\nimport \"./ionic/DiamondExtension.sol\";\n\n/**\n * @title PoolDirectory\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\n */\ncontract PoolDirectory is SafeOwnableUpgradeable {\n /**\n * @dev Initializes a deployer whitelist if desired.\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\n */\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\n __SafeOwnable_init(msg.sender);\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\n }\n\n /**\n * @dev Struct for a Ionic interest rate pool.\n */\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n /**\n * @dev Array of Ionic interest rate pools.\n */\n Pool[] public pools;\n\n /**\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\n */\n mapping(address => uint256[]) private _poolsByAccount;\n\n /**\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\n */\n mapping(address => bool) public poolExists;\n\n /**\n * @dev Emitted when a new Ionic pool is added to the directory.\n */\n event PoolRegistered(uint256 index, Pool pool);\n\n /**\n * @dev Booleans indicating if the deployer whitelist is enforced.\n */\n bool public enforceDeployerWhitelist;\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\n */\n mapping(address => bool) public deployerWhitelist;\n\n /**\n * @dev Controls if the deployer whitelist is to be enforced.\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\n */\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\n enforceDeployerWhitelist = enforce;\n }\n\n /**\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\n * @param deployers Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\n require(deployers.length > 0, \"No deployers supplied.\");\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\n }\n\n /**\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\n * @param name The name of the pool.\n * @param comptroller The pool's Comptroller proxy contract address.\n * @return The index of the registered Ionic pool.\n */\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\n require(bytes(name).length <= 100, \"No pool name supplied.\");\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n _poolsByAccount[msg.sender].push(pools.length - 1);\n poolExists[comptroller] = true;\n emit PoolRegistered(pools.length - 1, pool);\n return pools.length - 1;\n }\n\n function _deprecatePool(address comptroller) external onlyOwner {\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller == comptroller) {\n _deprecatePool(i);\n break;\n }\n }\n }\n\n function _deprecatePool(uint256 index) public onlyOwner {\n Pool storage ionicPool = pools[index];\n\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\n\n // swap with the last pool of the creator and delete\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\n for (uint256 i = 0; i < creatorPools.length; i++) {\n if (creatorPools[i] == index) {\n creatorPools[i] = creatorPools[creatorPools.length - 1];\n creatorPools.pop();\n break;\n }\n }\n\n // leave it to true to deny the re-registering of the same pool\n poolExists[ionicPool.comptroller] = true;\n\n // nullify the storage\n ionicPool.comptroller = address(0);\n ionicPool.creator = address(0);\n ionicPool.name = \"\";\n ionicPool.blockPosted = 0;\n ionicPool.timestampPosted = 0;\n }\n\n /**\n * @dev Deploys a new Ionic pool and adds to the directory.\n * @param name The name of the pool.\n * @param implementation The Comptroller implementation contract address.\n * @param constructorData Encoded construction data for `Unitroller constructor()`\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\n * @param closeFactor The pool's close factor (scaled by 1e18).\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\n * @param priceOracle The pool's PriceOracle contract address.\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\n */\n function deployPool(\n string memory name,\n address implementation,\n bytes calldata constructorData,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive,\n address priceOracle\n ) external returns (uint256, address) {\n // Input validation\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\n\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(\n 0,\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\n unitrollerCreationCode\n );\n\n // Setup the pool\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\n // Set up the extensions\n comptrollerProxy._upgrade();\n\n // Set pool parameters\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\n require(\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\n \"Failed to set pool liquidation incentive.\"\n );\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\n\n // Whitelist\n if (enforceWhitelist)\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\n\n // Make msg.sender the admin\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\n\n // Register the pool with this PoolDirectory\n return (_registerPool(name, proxy), proxy);\n }\n\n /**\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory activePools = new Pool[](count);\n uint256[] memory poolIds = new uint256[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n poolIds[index] = i;\n activePools[index] = pools[i];\n index++;\n }\n }\n\n return (poolIds, activePools);\n }\n\n /**\n * @notice Returns arrays of all Ionic pools' data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getAllPools() public view returns (Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory result = new Pool[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n result[index++] = pools[i];\n }\n }\n\n return result;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n indexes[index] = i;\n poolsOfUser[index] = activePools[i];\n index++;\n }\n\n return (indexes, poolsOfUser);\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\n */\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\n (, Pool[] memory activePools) = getActivePools();\n\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\n indexes[i] = _poolsByAccount[account][i];\n accountPools[i] = activePools[_poolsByAccount[account][i]];\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Modify existing Ionic pool name.\n */\n function setPoolName(uint256 index, string calldata name) external {\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\n require(\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\n \"!permission\"\n );\n pools[index].name = name;\n }\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\n */\n mapping(address => bool) public adminWhitelist;\n\n /**\n * @dev used as salt for the creation of new pools\n */\n uint256 public poolsCounter;\n\n /**\n * @dev Event emitted when the admin whitelist is updated.\n */\n event AdminWhitelistUpdated(address[] admins, bool status);\n\n /**\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\n * @param admins Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\n require(admins.length > 0, \"No admins supplied.\");\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\n emit AdminWhitelistUpdated(admins, status);\n }\n\n /**\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getVerifiedPoolsOfWhitelistedAccount(\n address account\n ) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n indexes[index] = i;\n accountWhitelistedPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, accountWhitelistedPools);\n }\n}\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\n\n/**\n * @title PoolLens\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLens is Initializable {\n error ComptrollerError(uint256 errCode);\n\n /**\n * @notice Initialize the `PoolDirectory` contract object.\n * @param _directory The PoolDirectory\n * @param _name Name for the nativeToken\n * @param _symbol Symbol for the nativeToken\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\n * @param _hardcodedNames Harcoded name for these tokens\n * @param _hardcodedSymbols Harcoded symbol for these tokens\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\n */\n function initialize(\n PoolDirectory _directory,\n string memory _name,\n string memory _symbol,\n address[] memory _hardcodedAddresses,\n string[] memory _hardcodedNames,\n string[] memory _hardcodedSymbols,\n string[] memory _uniswapLPTokenNames,\n string[] memory _uniswapLPTokenSymbols,\n string[] memory _uniswapLPTokenDisplayNames\n ) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n require(\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\n \"Hardcoded addresses lengths not equal.\"\n );\n require(\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\n \"Uniswap LP token names lengths not equal.\"\n );\n\n directory = _directory;\n name = _name;\n symbol = _symbol;\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\n }\n\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\n uniswapData.push(\n UniswapData({\n name: _uniswapLPTokenNames[i],\n symbol: _uniswapLPTokenSymbols[i],\n displayName: _uniswapLPTokenDisplayNames[i]\n })\n );\n }\n }\n\n string public name;\n string public symbol;\n\n struct TokenData {\n string name;\n string symbol;\n }\n mapping(address => TokenData) hardcoded;\n\n struct UniswapData {\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\n string symbol; // ie \"UNI-V2\" or \"SLP\"\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\n }\n UniswapData[] uniswapData;\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @dev Struct for Ionic pool summary data.\n */\n struct IonicPoolData {\n uint256 totalSupply;\n uint256 totalBorrow;\n address[] underlyingTokens;\n string[] underlyingSymbols;\n bool whitelistedAdmin;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsWithData()\n external\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\n {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsByVerificationWithData(\n bool whitelistedAdmin\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\n whitelistedAdmin\n );\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsOIonicrWithData(\n address user\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\n return (indexes, userPools, data, errored);\n }\n\n /**\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\n bool[] memory errored = new bool[](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\n uint256 _totalSupply,\n uint256 _totalBorrow,\n address[] memory _underlyingTokens,\n string[] memory _underlyingSymbols,\n bool _whitelistedAdmin\n ) {\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\n } catch {\n errored[i] = true;\n }\n }\n\n return (data, errored);\n }\n\n /**\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\n */\n function getPoolSummary(\n IonicComptroller comptroller\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\n uint256 totalBorrow = 0;\n uint256 totalSupply = 0;\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n address[] memory underlyingTokens = new address[](cTokens.length);\n string[] memory underlyingSymbols = new string[](cTokens.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n cToken.accrueInterest();\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\n uint256 assetTotalSupply = cToken.getCash() +\n assetTotalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\n\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\n }\n\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\n }\n\n /**\n * @dev Struct for a Ionic pool asset.\n */\n struct PoolAsset {\n address cToken;\n address underlyingToken;\n string underlyingName;\n string underlyingSymbol;\n uint256 underlyingDecimals;\n uint256 underlyingBalance;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 totalSupply;\n uint256 totalBorrow;\n uint256 supplyBalance;\n uint256 borrowBalance;\n uint256 liquidity;\n bool membership;\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\n address oracle;\n uint256 collateralFactor;\n uint256 reserveFactor;\n uint256 adminFee;\n uint256 ionicFee;\n bool borrowGuardianPaused;\n bool mintGuardianPaused;\n }\n\n /**\n * @notice Returns data on the specified assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\n * @param cTokens The cToken contract addresses of the assets to query.\n * @param user The user for which to get account data.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(\n IonicComptroller comptroller,\n ICErc20[] memory cTokens,\n address user\n ) internal returns (PoolAsset[] memory) {\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\n if (isListed) arrayLength++;\n }\n\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\n uint256 index = 0;\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n // Check if market is listed and get collateral factor\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\n if (!isListed) continue;\n\n // Start adding data to PoolAsset\n PoolAsset memory asset;\n ICErc20 cToken = cTokens[i];\n asset.cToken = address(cToken);\n\n cToken.accrueInterest();\n\n // Get underlying asset data\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\n asset.underlyingDecimals = underlying.decimals();\n asset.underlyingBalance = underlying.balanceOf(user);\n\n // Get cToken data\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\n asset.liquidity = cToken.getCash();\n asset.totalBorrow = cToken.totalBorrowsCurrent();\n asset.totalSupply =\n asset.liquidity +\n asset.totalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\n asset.membership = comptroller.checkMembership(user, cToken);\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\n\n // Get oracle for this cToken\n asset.oracle = address(oracle);\n\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\n asset.oracle = address(_oracle);\n } catch {}\n\n // More cToken data\n asset.collateralFactor = collateralFactorMantissa;\n asset.reserveFactor = cToken.reserveFactorMantissa();\n asset.adminFee = cToken.adminFeeMantissa();\n asset.ionicFee = cToken.ionicFeeMantissa();\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\n\n // Add to assets array and increment index\n detailedAssets[index] = asset;\n index++;\n }\n\n return (detailedAssets);\n }\n\n function getBorrowCapsPerCollateral(\n ICErc20 borrowedAsset,\n IonicComptroller comptroller\n )\n internal\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsAgainstCollateral,\n bool[] memory borrowingBlacklistedAgainstCollateral\n )\n {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n collateral = new address[](poolMarkets.length);\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\n\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n address collateralAddress = address(poolMarkets[i]);\n if (collateralAddress != address(borrowedAsset)) {\n collateral[i] = collateralAddress;\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\n address(borrowedAsset),\n collateralAddress\n );\n }\n }\n }\n\n /**\n * @notice Returns the `name` and `symbol` of `token`.\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\n * @param token An ERC20 token contract object.\n * @return The `name` and `symbol`.\n */\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\n // i.e. MKR is a DSToken and uses bytes32\n if (bytes(hardcoded[token].symbol).length != 0) {\n return (hardcoded[token].name, hardcoded[token].symbol);\n }\n\n // Get name and symbol from token contract\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\n string memory _name = tokenContract.name();\n string memory _symbol = tokenContract.symbol();\n\n return (_name, _symbol);\n }\n\n /**\n * @notice Returns the assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\n }\n\n /**\n * @dev Struct for a Ionic pool user.\n */\n struct IonicPoolUser {\n address account;\n uint256 totalBorrow;\n uint256 totalCollateral;\n uint256 health;\n }\n\n /**\n * @notice Returns arrays of PoolAsset for a specific user\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\n return assets;\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n }\n\n return (assets, supplyCapsPerAsset);\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsDataForPool(\n IonicComptroller comptroller\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\n }\n\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\n }\n\n /**\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n }\n\n /**\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsDataForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap,\n uint256 nonWhitelistedTotalBorrows\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n uint256 totalBorrows = asset.totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\n * Note that the whitelist does not have to be enforced.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getWhitelistedPoolsByAccount(\n address account\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) {\n indexes[index] = i;\n accountPools[index] = pools[i];\n index++;\n break;\n }\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getWhitelistedPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\n }\n\n function getHealthFactorHypothetical(\n IonicComptroller pool,\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\n account,\n cTokenModify,\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n\n if (err != 0) revert ComptrollerError(err);\n\n if (shortfall > 0) {\n // HF < 1.0\n return (collateralValue * 1e18) / (collateralValue + shortfall);\n } else {\n // HF >= 1.0\n if (collateralValue <= liquidity) return type(uint256).max;\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\n }\n }\n}\n" + }, + "contracts/PoolLensSecondary.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { IUniswapV2Pair } from \"./external/uniswap/IUniswapV2Pair.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\n\ninterface IRewardsDistributor_PLS {\n function rewardToken() external view returns (address);\n\n function compSupplySpeeds(address) external view returns (uint256);\n\n function compBorrowSpeeds(address) external view returns (uint256);\n\n function compAccrued(address) external view returns (uint256);\n\n function flywheelPreSupplierAction(address cToken, address supplier) external;\n\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n}\n\n/**\n * @title PoolLensSecondary\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLensSecondary returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLensSecondary is Initializable {\n /**\n * @notice Constructor to set the `PoolDirectory` contract object.\n */\n function initialize(PoolDirectory _directory) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n directory = _directory;\n }\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @notice Struct for ownership over a CToken.\n */\n struct CTokenOwnership {\n address cToken;\n address admin;\n bool adminHasRights;\n bool ionicAdminHasRights;\n }\n\n /**\n * @notice Returns the admin, admin rights, Ionic admin (constant), Ionic admin rights, and an array of cTokens with differing properties.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolOwnership(\n IonicComptroller comptroller\n ) external view returns (address, bool, bool, CTokenOwnership[] memory) {\n // Get pool ownership\n address comptrollerAdmin = comptroller.admin();\n bool comptrollerAdminHasRights = comptroller.adminHasRights();\n bool comptrollerIonicAdminHasRights = comptroller.ionicAdminHasRights();\n\n // Get cToken ownership\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n\n address cTokenAdmin;\n try cToken.admin() returns (address _cTokenAdmin) {\n cTokenAdmin = _cTokenAdmin;\n } catch {\n continue;\n }\n bool cTokenAdminHasRights = cToken.adminHasRights();\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\n\n // If outlier, push to array\n if (\n cTokenAdmin != comptrollerAdmin ||\n cTokenAdminHasRights != comptrollerAdminHasRights ||\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\n ) arrayLength++;\n }\n\n CTokenOwnership[] memory outliers = new CTokenOwnership[](arrayLength);\n uint256 arrayIndex = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n\n address cTokenAdmin;\n try cToken.admin() returns (address _cTokenAdmin) {\n cTokenAdmin = _cTokenAdmin;\n } catch {\n continue;\n }\n bool cTokenAdminHasRights = cToken.adminHasRights();\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\n\n // If outlier, push to array and increment array index\n if (\n cTokenAdmin != comptrollerAdmin ||\n cTokenAdminHasRights != comptrollerAdminHasRights ||\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\n ) {\n outliers[arrayIndex] = CTokenOwnership(\n address(cToken),\n cTokenAdmin,\n cTokenAdminHasRights,\n cTokenIonicAdminHasRights\n );\n arrayIndex++;\n }\n }\n\n return (comptrollerAdmin, comptrollerAdminHasRights, comptrollerIonicAdminHasRights, outliers);\n }\n\n /**\n * @notice Determine the maximum redeem amount of a cToken.\n * @param cTokenModify The market to hypothetically redeem in.\n * @param account The account to determine liquidity for.\n * @return Maximum redeem amount.\n */\n function getMaxRedeem(address account, ICErc20 cTokenModify) external returns (uint256) {\n return getMaxRedeemOrBorrow(account, cTokenModify, false);\n }\n\n /**\n * @notice Determine the maximum borrow amount of a cToken.\n * @param cTokenModify The market to hypothetically borrow in.\n * @param account The account to determine liquidity for.\n * @return Maximum borrow amount.\n */\n function getMaxBorrow(address account, ICErc20 cTokenModify) external returns (uint256) {\n return getMaxRedeemOrBorrow(account, cTokenModify, true);\n }\n\n /**\n * @dev Internal function to determine the maximum borrow/redeem amount of a cToken.\n * @param cTokenModify The market to hypothetically borrow/redeem in.\n * @param account The account to determine liquidity for.\n * @return Maximum borrow/redeem amount.\n */\n function getMaxRedeemOrBorrow(address account, ICErc20 cTokenModify, bool isBorrow) internal returns (uint256) {\n IonicComptroller comptroller = IonicComptroller(cTokenModify.comptroller());\n return comptroller.getMaxRedeemOrBorrow(account, cTokenModify, isBorrow);\n }\n\n /**\n * @notice Returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\n * @param comptroller The Ionic pool Comptroller to check.\n */\n function getRewardSpeedsByPool(\n IonicComptroller comptroller\n ) public view returns (ICErc20[] memory, address[] memory, address[] memory, uint256[][] memory, uint256[][] memory) {\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n address[] memory distributors;\n\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n distributors = _distributors;\n } catch {\n distributors = new address[](0);\n }\n\n address[] memory rewardTokens = new address[](distributors.length);\n uint256[][] memory supplySpeeds = new uint256[][](allMarkets.length);\n uint256[][] memory borrowSpeeds = new uint256[][](allMarkets.length);\n\n // Get reward tokens for each distributor\n for (uint256 i = 0; i < distributors.length; i++) {\n rewardTokens[i] = IRewardsDistributor_PLS(distributors[i]).rewardToken();\n }\n\n // Get reward speeds for each market for each distributor\n for (uint256 i = 0; i < allMarkets.length; i++) {\n address cToken = address(allMarkets[i]);\n supplySpeeds[i] = new uint256[](distributors.length);\n borrowSpeeds[i] = new uint256[](distributors.length);\n\n for (uint256 j = 0; j < distributors.length; j++) {\n IRewardsDistributor_PLS distributor = IRewardsDistributor_PLS(distributors[j]);\n supplySpeeds[i][j] = distributor.compSupplySpeeds(cToken);\n borrowSpeeds[i][j] = distributor.compBorrowSpeeds(cToken);\n }\n }\n\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\n }\n\n /**\n * @notice For each `Comptroller`, returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\n * @param comptrollers The Ionic pool Comptrollers to check.\n */\n function getRewardSpeedsByPools(\n IonicComptroller[] memory comptrollers\n )\n external\n view\n returns (ICErc20[][] memory, address[][] memory, address[][] memory, uint256[][][] memory, uint256[][][] memory)\n {\n ICErc20[][] memory allMarkets = new ICErc20[][](comptrollers.length);\n address[][] memory distributors = new address[][](comptrollers.length);\n address[][] memory rewardTokens = new address[][](comptrollers.length);\n uint256[][][] memory supplySpeeds = new uint256[][][](comptrollers.length);\n uint256[][][] memory borrowSpeeds = new uint256[][][](comptrollers.length);\n for (uint256 i = 0; i < comptrollers.length; i++)\n (allMarkets[i], distributors[i], rewardTokens[i], supplySpeeds[i], borrowSpeeds[i]) = getRewardSpeedsByPool(\n comptrollers[i]\n );\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\n }\n\n /**\n * @notice Returns unaccrued rewards by `holder` from `cToken` on `distributor`.\n * @param holder The address to check.\n * @param distributor The RewardsDistributor to check.\n * @param cToken The CToken to check.\n * @return Unaccrued (unclaimed) supply-side rewards and unaccrued (unclaimed) borrow-side rewards.\n */\n function getUnaccruedRewards(\n address holder,\n IRewardsDistributor_PLS distributor,\n ICErc20 cToken\n ) internal returns (uint256, uint256) {\n // Get unaccrued supply rewards\n uint256 compAccruedPrior = distributor.compAccrued(holder);\n distributor.flywheelPreSupplierAction(address(cToken), holder);\n uint256 supplyRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\n\n // Get unaccrued borrow rewards\n compAccruedPrior = distributor.compAccrued(holder);\n distributor.flywheelPreBorrowerAction(address(cToken), holder);\n uint256 borrowRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\n\n // Return both\n return (supplyRewardsUnaccrued, borrowRewardsUnaccrued);\n }\n\n /**\n * @notice Returns all unclaimed rewards accrued by the `holder` on `distributors`.\n * @param holder The address to check.\n * @param distributors The `RewardsDistributor` contracts to check.\n * @return For each of `distributors`: total quantity of unclaimed rewards, array of cTokens, array of unaccrued (unclaimed) supply-side and borrow-side rewards per cToken, and quantity of funds available in the distributor.\n */\n function getUnclaimedRewardsByDistributors(\n address holder,\n IRewardsDistributor_PLS[] memory distributors\n ) external returns (address[] memory, uint256[] memory, ICErc20[][] memory, uint256[2][][] memory, uint256[] memory) {\n address[] memory rewardTokens = new address[](distributors.length);\n uint256[] memory compUnclaimedTotal = new uint256[](distributors.length);\n ICErc20[][] memory allMarkets = new ICErc20[][](distributors.length);\n uint256[2][][] memory rewardsUnaccrued = new uint256[2][][](distributors.length);\n uint256[] memory distributorFunds = new uint256[](distributors.length);\n\n for (uint256 i = 0; i < distributors.length; i++) {\n IRewardsDistributor_PLS distributor = distributors[i];\n rewardTokens[i] = distributor.rewardToken();\n allMarkets[i] = distributor.getAllMarkets();\n rewardsUnaccrued[i] = new uint256[2][](allMarkets[i].length);\n for (uint256 j = 0; j < allMarkets[i].length; j++)\n (rewardsUnaccrued[i][j][0], rewardsUnaccrued[i][j][1]) = getUnaccruedRewards(\n holder,\n distributor,\n allMarkets[i][j]\n );\n compUnclaimedTotal[i] = distributor.compAccrued(holder);\n distributorFunds[i] = IERC20Upgradeable(rewardTokens[i]).balanceOf(address(distributor));\n }\n\n return (rewardTokens, compUnclaimedTotal, allMarkets, rewardsUnaccrued, distributorFunds);\n }\n\n /**\n * @notice Returns arrays of indexes, `Comptroller` proxy contracts, and `RewardsDistributor` contracts for Ionic pools supplied to by `account`.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getRewardsDistributorsBySupplier(\n address supplier\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\n // Get array length\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n try IonicComptroller(pools[i].comptroller).suppliers(supplier) returns (bool isSupplier) {\n if (isSupplier) arrayLength++;\n } catch {}\n }\n\n // Build array\n uint256[] memory indexes = new uint256[](arrayLength);\n IonicComptroller[] memory comptrollers = new IonicComptroller[](arrayLength);\n address[][] memory distributors = new address[][](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n try comptroller.suppliers(supplier) returns (bool isSupplier) {\n if (isSupplier) {\n indexes[index] = i;\n comptrollers[index] = comptroller;\n\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n distributors[index] = _distributors;\n } catch {}\n\n index++;\n }\n } catch {}\n }\n\n // Return distributors\n return (indexes, comptrollers, distributors);\n }\n\n /**\n * @notice The returned list of flywheels contains address(0) for flywheels for which the user has no rewards to claim\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getFlywheelsToClaim(\n address user\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n\n IonicComptroller[] memory comptrollers = new IonicComptroller[](pools.length);\n address[][] memory distributors = new address[][](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n comptrollers[i] = comptroller;\n distributors[i] = flywheelsWithRewardsForPoolUser(user, _distributors);\n } catch {}\n }\n\n return (poolIds, comptrollers, distributors);\n }\n\n function flywheelsWithRewardsForPoolUser(\n address user,\n address[] memory _distributors\n ) internal view returns (address[] memory) {\n address[] memory distributors = new address[](_distributors.length);\n for (uint256 j = 0; j < _distributors.length; j++) {\n if (IRewardsDistributor_PLS(_distributors[j]).compAccrued(user) > 0) {\n distributors[j] = _distributors[j];\n }\n }\n\n return distributors;\n }\n}\n" + }, + "contracts/test/abstracts/AbstractAssetTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { AbstractERC4626Test } from \"./AbstractERC4626Test.sol\";\nimport { ITestConfigStorage } from \"./ITestConfigStorage.sol\";\n\ncontract AbstractAssetTest is BaseTest {\n AbstractERC4626Test public test;\n ITestConfigStorage public testConfigStorage;\n\n function setUpTestContract(bytes calldata testConfig) public virtual {\n // test._setUp(MockERC20(address(IBeefyVault(testConfig.beefyVault).want())).symbol(), testConfig);\n }\n\n function runTest(function() external testFn) public {\n if (shouldRunForChain(block.chainid)) {\n for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\n this.setUpTestContract(testConfigStorage.getTestConfig(i));\n testFn();\n }\n }\n }\n\n function testInitializedValues() public virtual {\n // for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\n // this.setUpTestContract(testConfigs[i]);\n // test.testInitializedValues(asset.name(), asset.symbol());\n // }\n }\n\n function testPreviewDepositAndMintReturnTheSameValue() public {\n this.runTest(test.testPreviewDepositAndMintReturnTheSameValue);\n }\n\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\n this.runTest(test.testPreviewWithdrawAndRedeemReturnTheSameValue);\n }\n\n function testDeposit() public {\n this.runTest(test.testDeposit);\n }\n\n function testDepositWithIncreasedVaultValue() public virtual {\n this.runTest(test.testDepositWithIncreasedVaultValue);\n }\n\n function testDepositWithDecreasedVaultValue() public virtual {\n this.runTest(test.testDepositWithDecreasedVaultValue);\n }\n\n function testMultipleDeposit() public {\n this.runTest(test.testMultipleDeposit);\n }\n\n function testMint() public {\n this.runTest(test.testMint);\n }\n\n function testMultipleMint() public {\n this.runTest(test.testMultipleMint);\n }\n\n function testWithdraw() public {\n this.runTest(test.testWithdraw);\n }\n\n function testWithdrawWithIncreasedVaultValue() public virtual {\n this.runTest(test.testWithdrawWithIncreasedVaultValue);\n }\n\n function testWithdrawWithDecreasedVaultValue() public virtual {\n this.runTest(test.testWithdrawWithDecreasedVaultValue);\n }\n\n function testMultipleWithdraw() public {\n this.runTest(test.testMultipleWithdraw);\n }\n\n function testRedeem() public {\n this.runTest(test.testRedeem);\n }\n\n function testMultipleRedeem() public {\n this.runTest(test.testMultipleRedeem);\n }\n\n function testPauseContract() public {\n this.runTest(test.testPauseContract);\n }\n\n function testEmergencyWithdrawAndPause() public {\n this.runTest(test.testEmergencyWithdrawAndPause);\n }\n\n function testEmergencyWithdrawAndRedeem() public {\n this.runTest(test.testEmergencyWithdrawAndRedeem);\n }\n}\n" + }, + "contracts/test/abstracts/AbstractERC4626Test.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../helpers/WithPool.sol\";\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { IonicERC4626 } from \"../../ionic/strategies/IonicERC4626.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Authority } from \"solmate/auth/Auth.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\nabstract contract AbstractERC4626Test is WithPool {\n using FixedPointMathLib for uint256;\n\n IonicERC4626 plugin;\n\n string testPreFix;\n\n uint256 public depositAmount = 100e18;\n uint256 BPS_DENOMINATOR = 10_000;\n\n uint256 initialStrategyBalance;\n uint256 initialStrategySupply;\n\n constructor() {\n _forkAtBlock(uint128(block.chainid), block.number);\n }\n\n function _setUp(string memory _testPreFix, bytes calldata data) public virtual;\n\n function deposit(address _owner, uint256 amount) public {\n vm.startPrank(_owner);\n underlyingToken.approve(address(plugin), amount);\n plugin.deposit(amount, _owner);\n vm.stopPrank();\n }\n\n function sendUnderlyingToken(uint256 amount, address recipient) public {\n deal(address(underlyingToken), recipient, amount);\n }\n\n function increaseAssetsInVault() public virtual {}\n\n function decreaseAssetsInVault() public virtual {}\n\n function getDepositShares() public view virtual returns (uint256);\n\n function getStrategyBalance() public view virtual returns (uint256);\n\n function getExpectedDepositShares() public view virtual returns (uint256);\n\n function testInitializedValues(string memory assetName, string memory assetSymbol) public virtual {\n assertEq(\n plugin.name(),\n string(abi.encodePacked(\"Midas \", assetName, \" Vault\")),\n string(abi.encodePacked(\"!name \", testPreFix))\n );\n assertEq(\n plugin.symbol(),\n string(abi.encodePacked(\"mv\", assetSymbol)),\n string(abi.encodePacked(\"!symbol \", testPreFix))\n );\n assertEq(address(plugin.asset()), address(underlyingToken), string(abi.encodePacked(\"!asset \", testPreFix)));\n // assertEq(\n // address(BeefyERC4626(address(plugin)).beefyVault()),\n // address(beefyVault),\n // string(abi.encodePacked(\"!beefyVault \", testPreFix))\n // );\n }\n\n function testPreviewDepositAndMintReturnTheSameValue() public {\n uint256 returnedShares = plugin.previewDeposit(depositAmount);\n assertApproxEqAbs(\n plugin.previewMint(returnedShares),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!previewMint \", testPreFix))\n );\n }\n\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\n deposit(address(this), depositAmount);\n uint256 withdrawalAmount = 10e18;\n uint256 reqShares = plugin.previewWithdraw(withdrawalAmount);\n assertApproxEqAbs(\n plugin.previewRedeem(reqShares),\n withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!previewRedeem \", testPreFix))\n );\n }\n\n function testDeposit() public virtual {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShares \", testPreFix))\n );\n }\n\n function testDepositWithIncreasedVaultValue() public {\n // lpDepositor just mints the exact amount of depositShares as the user deposits in assets\n uint256 oldExpectedDepositShare = this.getExpectedDepositShares();\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n // Increase the share price\n increaseAssetsInVault();\n\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n\n sendUnderlyingToken(depositAmount, address(this));\n deposit(address(this), depositAmount);\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n oldExpected4626Shares + previewErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!previewShares == oldExpectedShares \", testPreFix))\n );\n\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(\n previewErc4626Shares,\n oldExpected4626Shares,\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\n );\n assertApproxEqAbs(\n previewErc4626Shares,\n expected4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!previewShares == expectedShares \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n oldExpectedDepositShare + expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\n );\n }\n\n function testDepositWithDecreasedVaultValue() public {\n // THIS TEST WILL ALWAYS FAIL\n // A transfer out of the lpStaker will always fail.\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\n /* =============== ACTUAL TEST =============== */\n /*\n uint256 oldExpecteDepositShares = depositAmount;\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\n deposit(address(this), depositAmount);\n // Decrease the share price\n decreaseAssetsInVault();\n uint256 expectedDepositShare = depositAmount;\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n sendUnderlyingToken(depositAmount, address(this));\n deposit(address(this), depositAmount);\n // Test that we minted the correct amount of token\n assertApproxEqAbs(plugin.balanceOf(address(this)), oldExpected4626Shares + previewErc4626Shares);\n // Test that we got less shares on the second mint after assets in the vault increased\n assertGt(previewErc4626Shares, oldExpected4626Shares, \"!new shares > old Shares\");\n assertApproxEqAbs(previewErc4626Shares, expected4626Shares, \"!previewShares == expectedShares\");\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(this.getDepositShares(), oldExpecteDepositShares + expectedDepositShare);\n */\n }\n\n function testMultipleDeposit() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount * 2,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n depositAmount * 2,\n plugin.totalAssets(),\n uint256(10),\n string(abi.encodePacked(\"Total Assets should be same as sum of deposited amounts \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n uint256(10),\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(1))),\n uint256(10),\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares address(this) \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares address(1) \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n expectedErc4626Shares * 2,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare * 2,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n\n // DotDot ERC4626 should not have underlyingToken after deposit\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testMint() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\n\n underlyingToken.approve(address(plugin), depositAmount);\n plugin.mint(mintAmount, address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n }\n\n function testMultipleMint() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\n\n underlyingToken.approve(address(plugin), depositAmount);\n plugin.mint(mintAmount, address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n vm.startPrank(address(1));\n underlyingToken.approve(address(plugin), depositAmount);\n sendUnderlyingToken(depositAmount, address(1));\n plugin.mint(mintAmount, address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n depositAmount + depositAmount,\n plugin.totalAssets(),\n uint256(10),\n string(abi.encodePacked(\"!2.totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(1))),\n uint256(10),\n string(abi.encodePacked(\"!2.balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount + mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare * 2,\n uint256(10),\n string(abi.encodePacked(\"!2.depositShare \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 2,\n uint256(2),\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n vm.stopPrank();\n }\n\n function testWithdraw() public virtual {\n uint256 depositShares = this.getExpectedDepositShares();\n\n uint256 withdrawalAmount = 10e18;\n\n deposit(address(this), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\n );\n assertTrue(underlyingToken.balanceOf(address(plugin)) <= 1, string(abi.encodePacked(\"!0 \", testPreFix)));\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\n );\n }\n\n function testWithdrawWithIncreasedVaultValue() public virtual {\n uint256 depositShareBal = this.getExpectedDepositShares();\n\n deposit(address(this), depositAmount);\n\n uint256 withdrawalAmount = 10e18;\n\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Increase the share price\n increaseAssetsInVault();\n\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded),\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(\n expectedErc4626SharesNeeded,\n oldExpectedErc4626SharesNeeded,\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShareBal - (oldExpectedDepositSharesNeeded + ExpectedDepositSharesNeeded),\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n }\n\n function testWithdrawWithDecreasedVaultValue() public {\n // THIS TEST WILL ALWAYS FAIL\n // A transfer out of the lpStaker will always fail.\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\n /* =============== ACTUAL TEST =============== */\n /*\n sendUnderlyingToken(depositAmount, address(this));\n uint256 depositShares = this.getExpectedDepositShares();\n deposit(address(this), depositAmount);\n uint256 withdrawalAmount = 10e18;\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n // Increase the share price\n decreaseAssetsInVault();\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded)\n );\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(expectedErc4626SharesNeeded, oldExpectedErc4626SharesNeeded, \"!new shares < old Shares\");\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShareBal - (oldExpectedDepositSharesNeeded + expectedDepositSharesNeeded)\n );\n */\n }\n\n function testMultipleWithdraw() public virtual {\n uint256 depositShares = this.getExpectedDepositShares() * 2;\n\n uint256 withdrawalAmount = 10e18;\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.user asset bal\", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n depositAmount * 2 - expectedErc4626SharesNeeded,\n plugin.totalSupply(),\n 10,\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 1,\n 1,\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n uint256 totalSupplyBefore = depositAmount * 2 - expectedErc4626SharesNeeded;\n depositShares = depositShares - ExpectedDepositSharesNeeded;\n assetBalBefore = underlyingToken.balanceOf(address(1));\n erc4626BalBefore = plugin.balanceOf(address(1));\n expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n vm.prank(address(1));\n plugin.withdraw(10e18, address(1), address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(1)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n totalSupplyBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 2,\n 2,\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testRedeem() public virtual {\n uint256 depositShares = this.getExpectedDepositShares();\n\n uint256 withdrawalAmount = 10e18;\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n\n deposit(address(this), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\n );\n }\n\n function testMultipleRedeem() public virtual {\n uint256 depositShares = this.getExpectedDepositShares() * 2;\n\n uint256 withdrawalAmount = 10e18;\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount * 2 - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\n );\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n uint256 totalSupplyBefore = depositAmount * 2 - redeemAmount;\n depositShares -= ExpectedDepositSharesNeeded;\n redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n assetBalBefore = underlyingToken.balanceOf(address(1));\n erc4626BalBefore = plugin.balanceOf(address(1));\n ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n vm.prank(address(1));\n plugin.withdraw(10e18, address(1), address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(1)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n totalSupplyBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\n );\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 2,\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testPauseContract() public {\n uint256 withdrawAmount = 1e18;\n\n deposit(address(this), depositAmount);\n\n vm.warp(block.timestamp + 10);\n\n plugin.emergencyWithdrawAndPause();\n\n underlyingToken.approve(address(plugin), depositAmount);\n vm.expectRevert(\"Pausable: paused\");\n plugin.deposit(depositAmount, address(this));\n\n vm.expectRevert(\"Pausable: paused\");\n plugin.mint(depositAmount, address(this));\n\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n plugin.withdraw(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount,\n uint256(10),\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\n );\n\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\n plugin.redeem(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - withdrawAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount + expectedAssets,\n uint256(10),\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\n );\n }\n\n function testEmergencyWithdrawAndPause() public virtual {\n deposit(address(this), depositAmount);\n\n uint256 expectedBal = plugin.previewRedeem(depositAmount);\n assertEq(underlyingToken.balanceOf(address(plugin)), 0, string(abi.encodePacked(\"!init 0 \", testPreFix)));\n\n plugin.emergencyWithdrawAndPause();\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n expectedBal,\n uint256(10),\n string(abi.encodePacked(\"!withdraws underlying \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalAssets(),\n expectedBal,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets == expectedBal \", testPreFix))\n );\n }\n\n function testEmergencyWithdrawAndRedeem() public {\n uint256 withdrawAmount = 1e18;\n\n deposit(address(this), depositAmount);\n\n vm.warp(block.timestamp + 10);\n\n plugin.emergencyWithdrawAndPause();\n\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n plugin.withdraw(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount,\n uint256(10),\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\n );\n\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\n plugin.redeem(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - withdrawAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount + expectedAssets,\n uint256(10),\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\n );\n }\n}\n" + }, + "contracts/test/abstracts/ITestConfigStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ITestConfigStorage {\n function getTestConfig(uint256 i) external view returns (bytes memory);\n\n function getTestConfigLength() external view returns (uint256);\n}\n" + }, + "contracts/test/AccountLiquidityTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract AccountLiquidityTest is UpgradesBaseTest {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLensSecondary lens2 = PoolLensSecondary(0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154);\n\n ICErc20 wethMarket;\n ICErc20 usdcMarket;\n ICErc20 usdtMarket;\n ICErc20 wbtcMarket;\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == MODE_MAINNET) {\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdcMarket = ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n wbtcMarket = ICErc20(0xd70254C3baD29504789714A7c69d60Ec1127375C);\n } else {\n ICErc20[] memory markets = pool.getAllMarkets();\n wethMarket = markets[0];\n usdcMarket = markets[1];\n }\n }\n\n function testModeAccountLiquidity() public debuggingOnly fork(MODE_MAINNET) {\n _testAccountLiquidity(0x0C387030a5D3AcDcde1A8DDaF26df31BbC1CE763);\n }\n\n function _testAccountLiquidity(address borrower) internal {\n (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(borrower);\n\n emit log(\"\");\n emit log_named_address(\"user\", borrower);\n emit log_named_uint(\"collateralValue\", collateralValue);\n if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n }\n\n function testUserMaxWithdraw() public debuggingOnly forkAtBlock(MODE_MAINNET, 5890823) {\n address user = 0xBf891E7eFCC98A8239385D3172bA10AD593c7886;\n\n Unitroller asUnitroller = Unitroller(payable(address(pool)));\n _upgradePoolWithExtension(asUnitroller);\n\n {\n _testAccountLiquidity(user);\n\n uint256 maxRedeem = lens2.getMaxRedeem(user, wethMarket);\n emit log_named_uint(\"maxRedeem\", maxRedeem);\n\n bool isMember = pool.checkMembership(user, wethMarket);\n emit log(isMember ? \"is member\" : \"NOT A MEMBER\");\n }\n //vm.rollFork(5891795);\n // redeemed before liquidation at 5890822\n\n // before withdraw call at block 5890821\n // user: 0xBf891E7eFCC98A8239385D3172bA10AD593c7886\n // collateralValue: 156238264982770748812\n // liquidity: 16428491404549045373\n // maxRedeem: 23469273435070064818\n // is member\n\n // user calls withdraw with max(uint256) at block 5890822\n // user: 0xBf891E7eFCC98A8239385D3172bA10AD593c7886\n // collateralValue: 139809773853485792955\n // SHORTFALL: 257892668904\n // maxRedeem: 0\n // is member\n\n // liquidated at 5890902\n // https://explorer.mode.network/tx/0x424fd0504e7afb00382c6dcd25a2efdefd96c005c2333112be450fc7bd98cc88\n }\n}\n" + }, + "contracts/test/AccrueInterestTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\n\nstruct AccrualDiff {\n uint256 borrowIndex;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalIonicFees;\n uint256 totalAdminFees;\n}\n\ncontract AccrueInterestTest is UpgradesBaseTest {\n // fork before the accrue interest refactoring\n function testAccrueInterest() public debuggingOnly forkAtBlock(BSC_MAINNET, 26032460) {\n address busdMarketAddress = 0xa7213deB44f570646Ea955771Cc7f39B58841363;\n address wbnbMarketAddress = 0x57a64a77f8E4cFbFDcd22D5551F52D675cc5A956;\n\n _testAccrueInterest(wbnbMarketAddress);\n }\n\n function _testAccrueInterest(address marketAddress) internal {\n //CErc20Delegate market = CErc20Delegate(marketAddress);\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(marketAddress);\n ICErc20 market = ICErc20(marketAddress);\n\n uint256 adminFeeMantissa = market.adminFeeMantissa();\n uint256 ionicFeeMantissa = market.ionicFeeMantissa();\n uint256 reserveFactorMantissa = market.reserveFactorMantissa();\n\n // test with the logic before the refactoring\n\n AccrualDiff memory diffBefore;\n // accrue at the latest block in order to have an equal/comparable accrual period\n marketAsExt.accrueInterest();\n {\n CTokenFirstExtension.InterestAccrual memory accrualDataBefore;\n CTokenFirstExtension.InterestAccrual memory accrualDataAfter;\n\n accrualDataBefore.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataBefore.borrowIndex = marketAsExt.borrowIndex();\n accrualDataBefore.totalBorrows = marketAsExt.totalBorrows();\n accrualDataBefore.totalReserves = marketAsExt.totalReserves();\n accrualDataBefore.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataBefore.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataBefore.totalSupply = marketAsExt.totalSupply();\n\n vm.roll(block.number + 1e6); // move 1M blocks forward\n marketAsExt.accrueInterest();\n\n accrualDataAfter.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataAfter.borrowIndex = marketAsExt.borrowIndex();\n accrualDataAfter.totalBorrows = marketAsExt.totalBorrows();\n accrualDataAfter.totalReserves = marketAsExt.totalReserves();\n accrualDataAfter.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataAfter.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataAfter.totalSupply = marketAsExt.totalSupply();\n\n assertEq(\n accrualDataBefore.accrualBlockNumber,\n accrualDataAfter.accrualBlockNumber - 1e6,\n \"!total supply old impl\"\n );\n assertLt(accrualDataBefore.borrowIndex, accrualDataAfter.borrowIndex, \"!borrow index old impl\");\n assertLt(accrualDataBefore.totalBorrows, accrualDataAfter.totalBorrows, \"!total borrows old impl\");\n if (reserveFactorMantissa > 0) {\n assertLt(accrualDataBefore.totalReserves, accrualDataAfter.totalReserves, \"!total reserves old impl\");\n }\n if (ionicFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalIonicFees, accrualDataAfter.totalIonicFees, \"!total ionic fees old impl\");\n }\n if (adminFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalAdminFees, accrualDataAfter.totalAdminFees, \"!total admin fees old impl\");\n }\n assertEq(accrualDataBefore.totalSupply, accrualDataAfter.totalSupply, \"!total supply old impl\");\n\n diffBefore.borrowIndex = accrualDataAfter.borrowIndex - accrualDataBefore.borrowIndex;\n diffBefore.totalBorrows = accrualDataAfter.totalBorrows - accrualDataBefore.totalBorrows;\n diffBefore.totalReserves = accrualDataAfter.totalReserves - accrualDataBefore.totalReserves;\n diffBefore.totalIonicFees = accrualDataAfter.totalIonicFees - accrualDataBefore.totalIonicFees;\n diffBefore.totalAdminFees = accrualDataAfter.totalAdminFees - accrualDataBefore.totalAdminFees;\n }\n\n // test with the logic after the refactoring\n vm.rollFork(26032460);\n afterForkSetUp();\n _upgradeMarketWithExtension(market);\n\n AccrualDiff memory diffAfter;\n // accrue at the latest block in order to have an equal/comparable accrual period\n marketAsExt.accrueInterest();\n {\n CTokenFirstExtension.InterestAccrual memory accrualDataBefore;\n CTokenFirstExtension.InterestAccrual memory accrualDataAfter;\n\n accrualDataBefore.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataBefore.borrowIndex = marketAsExt.borrowIndex();\n accrualDataBefore.totalBorrows = marketAsExt.totalBorrows();\n accrualDataBefore.totalReserves = marketAsExt.totalReserves();\n accrualDataBefore.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataBefore.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataBefore.totalSupply = marketAsExt.totalSupply();\n\n vm.roll(block.number + 1e6); // move 1M blocks forward\n marketAsExt.accrueInterest();\n\n accrualDataAfter.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataAfter.borrowIndex = marketAsExt.borrowIndex();\n accrualDataAfter.totalBorrows = marketAsExt.totalBorrows();\n accrualDataAfter.totalReserves = marketAsExt.totalReserves();\n accrualDataAfter.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataAfter.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataAfter.totalSupply = marketAsExt.totalSupply();\n\n assertEq(\n accrualDataBefore.accrualBlockNumber,\n accrualDataAfter.accrualBlockNumber - 1e6,\n \"!total supply old impl\"\n );\n assertLt(accrualDataBefore.borrowIndex, accrualDataAfter.borrowIndex, \"!borrow index new impl\");\n assertLt(accrualDataBefore.totalBorrows, accrualDataAfter.totalBorrows, \"!total borrows new impl\");\n if (reserveFactorMantissa > 0) {\n assertLt(accrualDataBefore.totalReserves, accrualDataAfter.totalReserves, \"!total reserves new impl\");\n }\n if (ionicFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalIonicFees, accrualDataAfter.totalIonicFees, \"!total ionic fees new impl\");\n }\n if (adminFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalAdminFees, accrualDataAfter.totalAdminFees, \"!total admin fees new impl\");\n }\n assertEq(accrualDataBefore.totalSupply, accrualDataAfter.totalSupply, \"!total supply new impl\");\n\n diffAfter.borrowIndex = accrualDataAfter.borrowIndex - accrualDataBefore.borrowIndex;\n diffAfter.totalBorrows = accrualDataAfter.totalBorrows - accrualDataBefore.totalBorrows;\n diffAfter.totalReserves = accrualDataAfter.totalReserves - accrualDataBefore.totalReserves;\n diffAfter.totalIonicFees = accrualDataAfter.totalIonicFees - accrualDataBefore.totalIonicFees;\n diffAfter.totalAdminFees = accrualDataAfter.totalAdminFees - accrualDataBefore.totalAdminFees;\n }\n\n assertEq(diffBefore.borrowIndex, diffAfter.borrowIndex, \"!borrowIndexDiff\");\n assertEq(diffBefore.totalBorrows, diffAfter.totalBorrows, \"!totalBorrowsDiff\");\n assertEq(diffBefore.totalReserves, diffAfter.totalReserves, \"!totalReservesDiff\");\n assertEq(diffBefore.totalIonicFees, diffAfter.totalIonicFees, \"!totalIonicFeesDiff\");\n assertEq(diffBefore.totalAdminFees, diffAfter.totalAdminFees, \"!totalAdminFeesDiff\");\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testMintGated() public fork(POLYGON_MAINNET) {\n address newMarket = 0x71A7037a42D0fB9F905a76B7D16846b2EACC59Aa;\n address assetWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n // approve spending\n vm.startPrank(assetWhale);\n IERC20Upgradeable(CErc20Delegate(newMarket).underlying()).approve(newMarket, 1e6);\n require(CErc20Delegate(newMarket).mint(1e6) == 0, \"!mint failed\");\n vm.stopPrank();\n }\n\n function testDeployCToken() public debuggingOnly fork(POLYGON_MAINNET) {\n CErc20Delegate cErc20Delegate = new CErc20Delegate();\n IonicComptroller pool = IonicComptroller(0x69617fE545804BcDfE853626B4C8EF23475Ac54B);\n emit log_named_address(\"admin\", pool.admin());\n pool.adminHasRights();\n vm.startPrank(0x9308dddeC9B5cCd8a2685A46E913C892FE31C826);\n pool._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(0xb5DFABd7fF7F83BAB83995E72A52B97ABb7bcf63),\n 0x69617fE545804BcDfE853626B4C8EF23475Ac54B,\n payable(address(0x62E27eA8d0389390039277CFfD83Ca18ce9B2D9c)),\n InterestRateModel(address(0xA433B7d3a8A87D8fd40dA68A424007Dd8a21Ce41)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(0),\n uint256(0)\n ),\n \"\",\n 0.72e18\n );\n vm.stopPrank();\n // _functionCall(0xC40119C7269A5FA813d878BF83d14E3462fC8Fde, hex\"8f93bfba\", \"raw liquidation failed\");\n }\n\n function testDeployNeonPool() public debuggingOnly fork(NEON_MAINNET) {\n PoolDirectory poolDirectory = PoolDirectory(0x297a15F615aCdf87580af1Fc497EE57424975Dae);\n FeeDistributor ionicAdmin = FeeDistributor(payable(0x62E27eA8d0389390039277CFfD83Ca18ce9B2D9c));\n Comptroller tempComptroller = new Comptroller();\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n vm.prank(ionicAdmin.owner());\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))), // FD\n false,\n 0.1e18,\n 1.1e18,\n 0xBAAb9986A7002ad67cb5a9C1761210C2Cdd98BFa // MPO\n );\n }\n}\n" + }, + "contracts/test/AnyLiquidationTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { IonicLiquidator, ILiquidator } from \"../IonicLiquidator.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport { ICurvePool } from \"../external/curve/ICurvePool.sol\";\nimport { IFundsConversionStrategy } from \"../liquidators/IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\nimport { IUniswapV2Pair } from \"../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../external/uniswap/IUniswapV2Factory.sol\";\n\ncontract AnyLiquidationTest is BaseTest {\n IonicLiquidator fsl;\n address uniswapRouter;\n mapping(address => address) assetSpecificRouters;\n\n IFundsConversionStrategy[] fundingStrategies;\n bytes[] fundingDatas;\n\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] redemptionDatas;\n\n IUniswapV2Pair mostLiquidPair1;\n IUniswapV2Pair mostLiquidPair2;\n\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\n\n function upgradeAp() internal {\n AddressesProvider newImpl = new AddressesProvider();\n newImpl.initialize(address(this));\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ap)));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uniswapRouter = ap.getAddress(\"IUniswapV2Router02\");\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\n\n if (block.chainid == BSC_MAINNET) {\n mostLiquidPair1 = IUniswapV2Pair(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16); // WBNB-BUSD\n mostLiquidPair2 = IUniswapV2Pair(0x61EB789d75A95CAa3fF50ed7E47b96c132fEc082); // WBNB-BTCB\n fsl = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n // fsl = new IonicLiquidator();\n // fsl.initialize(\n // ap.getAddress(\"wtoken\"),\n // uniswapRouter,\n // ap.getAddress(\"stableToken\"),\n // ap.getAddress(\"wBTCToken\"),\n // \"0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5\",\n // 25\n // );\n\n // TODO configure in the AP?\n address bnbx = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\n address apeSwapRouter = 0xcF0feBd3f17CEf5b47b0cD257aCf6025c5BFf3b7;\n assetSpecificRouters[bnbx] = apeSwapRouter;\n } else if (block.chainid == POLYGON_MAINNET) {\n mostLiquidPair1 = IUniswapV2Pair(0x6e7a5FAFcec6BB1e78bAE2A1F0B612012BF14827); // USDC/WMATIC\n mostLiquidPair2 = IUniswapV2Pair(0x369582d2010B6eD950B571F4101e3bB9b554876F); // SAND/WMATIC\n fsl = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n // fsl = new IonicLiquidator();\n // fsl.initialize(\n // ap.getAddress(\"wtoken\"),\n // uniswapRouter,\n // ap.getAddress(\"stableToken\"),\n // ap.getAddress(\"wBTCToken\"),\n // \"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f\",\n // 30\n // );\n }\n }\n\n function testSpecificRandom() public debuggingOnly {\n testPolygonAnyLiquidation(14341);\n // testPolygonAnyLiquidation(101);\n }\n\n function testBscAnyLiquidation(uint256 random) public fork(BSC_MAINNET) {\n vm.assume(random > 100 && random < type(uint64).max);\n doTestAnyLiquidation(random);\n }\n\n function testPolygonAnyLiquidation(uint256 random) public fork(POLYGON_MAINNET) {\n vm.assume(random > 100 && random < type(uint64).max);\n doTestAnyLiquidation(random);\n }\n\n struct LiquidationData {\n IRedemptionStrategy[] strategies;\n bytes[] redemptionDatas;\n ICErc20[] markets;\n address[] borrowers;\n IonicLiquidator liquidator;\n IFundsConversionStrategy[] fundingStrategies;\n bytes[] fundingDatas;\n ICErc20 debtMarket;\n ICErc20 collateralMarket;\n IonicComptroller comptroller;\n address borrower;\n uint256 repayAmount;\n address flashSwapFundingToken;\n IUniswapV2Pair flashSwapPair;\n }\n\n function getPoolAndBorrower(\n uint256 random,\n PoolDirectory.Pool[] memory pools\n ) internal view returns (IonicComptroller, address) {\n if (pools.length == 0) revert(\"no pools to pick from\");\n\n uint256 i = random % pools.length; // random pool\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n address bscBombPool = 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459;\n if (address(comptroller) == bscBombPool) {\n // we don't want to deal with the bomb liquidations\n return (IonicComptroller(address(0)), address(0));\n }\n\n address[] memory borrowers = comptroller.getAllBorrowers();\n\n if (borrowers.length == 0) {\n return (IonicComptroller(address(0)), address(0));\n } else {\n uint256 k = random % borrowers.length; // random borrower\n address borrower = borrowers[k];\n\n return (comptroller, borrower);\n }\n }\n\n function setUpDebtAndCollateralMarkets(\n uint256 random,\n LiquidationData memory vars\n ) internal returns (ICErc20 debtMarket, ICErc20 collateralMarket, uint256 borrowAmount) {\n // find a debt market in which the borrower has borrowed\n for (uint256 m = 0; m < vars.markets.length; m++) {\n uint256 marketIndexWithOffset = (random + m) % vars.markets.length;\n ICErc20 randomMarket = vars.markets[marketIndexWithOffset];\n borrowAmount = randomMarket.borrowBalanceCurrent(vars.borrower);\n if (borrowAmount > 0) {\n debtMarket = ICErc20(address(randomMarket));\n break;\n }\n }\n\n if (address(debtMarket) != address(0)) {\n emit log(\"debt market is\");\n emit log_address(address(debtMarket));\n\n uint256 shortfall = 0;\n // reduce the price of the collateral for each market where the borrower has supplied\n // until there is shortfall for which to be liquidated\n for (uint256 m = 0; m < vars.markets.length; m++) {\n uint256 marketIndexWithOffset = (random - m) % vars.markets.length;\n ICErc20 randomMarket = vars.markets[marketIndexWithOffset];\n uint256 borrowerCollateral = randomMarket.balanceOf(vars.borrower);\n if (borrowerCollateral > 0) {\n if (address(randomMarket) == address(debtMarket)) continue;\n\n // the collateral prices change\n BasePriceOracle mpo = vars.comptroller.oracle();\n uint256 priceCollateral = mpo.getUnderlyingPrice(randomMarket);\n vm.mockCall(\n address(mpo),\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, randomMarket),\n abi.encode(priceCollateral / 5)\n );\n\n uint256 collateralValue = borrowerCollateral * (priceCollateral / 5);\n uint256 borrowValue = borrowAmount * mpo.getUnderlyingPrice(debtMarket);\n\n if (collateralValue < borrowValue) {\n emit log(\"collateral position too small\");\n continue;\n }\n\n (, , , shortfall) = vars.comptroller.getAccountLiquidity(vars.borrower);\n if (shortfall == 0) {\n emit log(\"collateral still enough\");\n continue;\n } else {\n emit log(\"has shortfall\");\n collateralMarket = ICErc20(address(randomMarket));\n break;\n }\n }\n }\n if (shortfall == 0) {\n return (ICErc20(address(0)), ICErc20(address(0)), 0);\n }\n }\n }\n\n function doTestAnyLiquidation(uint256 random) internal {\n LiquidationData memory vars;\n vars.liquidator = fsl;\n\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(ap.getAddress(\"PoolDirectory\")).getActivePools();\n\n uint256 initRandom = random;\n while (true) {\n // get a random pool and a random borrower from it\n (vars.comptroller, vars.borrower) = getPoolAndBorrower(random, pools);\n\n if (address(vars.comptroller) != address(0) && vars.borrower != address(0)) {\n // find a market in which the borrower has debt and reduce his collateral price\n vars.markets = vars.comptroller.getAllMarkets();\n (vars.debtMarket, vars.collateralMarket, vars.repayAmount) = setUpDebtAndCollateralMarkets(random, vars);\n\n if (address(vars.debtMarket) != address(0) && address(vars.collateralMarket) != address(0)) {\n if (vars.debtMarket.underlying() != ap.getAddress(\"wtoken\")) {\n emit log(\"found testable markets at random number\");\n emit log_uint(random);\n break;\n }\n }\n }\n // fail gracefully when there are no positions to liquidate\n if (random - initRandom < 100) return;\n random++;\n }\n\n vars.repayAmount = vars.repayAmount / 100;\n liquidateSpecificPosition(vars);\n }\n\n function liquidateSpecificPosition(LiquidationData memory vars) internal {\n emit log(\"debt and collateral markets\");\n emit log_address(address(vars.debtMarket));\n emit log_address(address(vars.collateralMarket));\n\n // prepare the liquidation\n\n // add funding strategies\n {\n address debtTokenToFund = vars.debtMarket.underlying();\n uint256 i = 0;\n while (true) {\n emit log(\"funding token\");\n emit log_address(debtTokenToFund);\n if (i++ > 10) revert(\"endless loop bad\");\n\n AddressesProvider.FundingStrategy memory strategy = ap.getFundingStrategy(debtTokenToFund);\n if (strategy.addr == address(0)) break;\n\n debtTokenToFund = addFundingStrategy(\n vars,\n IFundsConversionStrategy(strategy.addr),\n debtTokenToFund,\n strategy.contractInterface,\n strategy.inputToken\n );\n }\n\n vars.flashSwapFundingToken = debtTokenToFund;\n if (vars.flashSwapFundingToken != ap.getAddress(\"wtoken\")) {\n IUniswapV2Router02 router = IUniswapV2Router02(uniswapRouter);\n address pairAddress = IUniswapV2Factory(router.factory()).getPair(\n vars.flashSwapFundingToken,\n ap.getAddress(\"wtoken\")\n );\n if (pairAddress != address(0)) {\n vars.flashSwapPair = IUniswapV2Pair(pairAddress);\n } else {\n revert(\"no pair for flash swap funding\");\n }\n } else {\n vars.flashSwapPair = IUniswapV2Pair(mostLiquidPair1);\n }\n\n vars.fundingStrategies = fundingStrategies;\n vars.fundingDatas = fundingDatas;\n }\n\n emit log(\"flash swap funding token is\");\n emit log_address(vars.flashSwapFundingToken);\n\n address exchangeCollateralTo = vars.flashSwapFundingToken;\n\n // add the redemption strategies\n if (exchangeCollateralTo != address(0)) {\n address collateralTokenToRedeem = vars.collateralMarket.underlying();\n while (collateralTokenToRedeem != exchangeCollateralTo) {\n // TODO\n AddressesProvider.RedemptionStrategy memory strategy = ap.getRedemptionStrategy(collateralTokenToRedeem);\n if (strategy.addr == address(0)) break;\n collateralTokenToRedeem = addRedemptionStrategy(\n vars,\n IRedemptionStrategy(strategy.addr),\n strategy.contractInterface,\n collateralTokenToRedeem,\n strategy.outputToken\n );\n }\n vars.redemptionDatas = redemptionDatas;\n vars.strategies = redemptionStrategies;\n }\n\n // liquidate\n vm.prank(ap.owner());\n try\n vars.liquidator.safeLiquidateToTokensWithFlashLoan(\n ILiquidator.LiquidateToTokensWithFlashSwapVars(\n vars.borrower,\n vars.repayAmount,\n ICErc20(address(vars.debtMarket)),\n ICErc20(address(vars.collateralMarket)),\n address(vars.flashSwapPair),\n 0,\n vars.strategies,\n vars.redemptionDatas,\n vars.fundingStrategies,\n vars.fundingDatas\n )\n )\n {\n // noop\n } catch Error(string memory reason) {\n if (compareStrings(reason, \"Number of tokens less than minimum limit\")) {\n emit log(\"jarvis pool failing, that's ok\");\n } else {\n revert(reason);\n }\n }\n }\n\n function getUniswapV2Router(address inputToken) internal view returns (address) {\n address router = assetSpecificRouters[inputToken];\n return router != address(0) ? router : uniswapRouter;\n }\n\n function toggleFlashSwapPair(LiquidationData memory vars) internal view {\n if (address(vars.flashSwapPair) == address(mostLiquidPair1)) {\n vars.flashSwapPair = mostLiquidPair2;\n } else {\n vars.flashSwapPair = mostLiquidPair1;\n }\n }\n\n function addRedemptionStrategy(\n LiquidationData memory vars,\n IRedemptionStrategy strategy,\n string memory strategyContract,\n address inputToken,\n address strategyOutputToken\n ) internal returns (address) {\n address outputToken;\n bytes memory strategyData;\n\n if (compareStrings(strategyContract, \"CurveLpTokenLiquidatorNoRegistry\")) {\n address[] memory underlyingTokens = curveV1Oracle.getUnderlyingTokens(inputToken);\n (address preferredOutputToken, uint8 outputTokenIndex) = pickPreferredToken(\n underlyingTokens,\n strategyOutputToken\n );\n emit log(\"preferred token\");\n emit log_address(preferredOutputToken);\n emit log_uint(outputTokenIndex);\n outputToken = preferredOutputToken;\n if (outputToken == address(0) || outputToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n outputToken = ap.getAddress(\"wtoken\");\n }\n\n strategyData = abi.encode(preferredOutputToken, ap.getAddress(\"wtoken\"), address(curveV1Oracle));\n } else if (compareStrings(strategyContract, \"SaddleLpTokenLiquidator\")) {\n address[] memory underlyingTokens = curveV1Oracle.getUnderlyingTokens(inputToken);\n (address preferredOutputToken, ) = pickPreferredToken(underlyingTokens, strategyOutputToken);\n outputToken = preferredOutputToken;\n if (outputToken == address(0) || outputToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n outputToken = ap.getAddress(\"wtoken\");\n }\n strategyData = abi.encode(preferredOutputToken, curveV1Oracle, ap.getAddress(\"wtoken\"));\n } else if (\n compareStrings(strategyContract, \"UniswapLpTokenLiquidator\") ||\n compareStrings(strategyContract, \"GelatoGUniLiquidator\")\n ) {\n IUniswapV2Pair pair = IUniswapV2Pair(inputToken);\n address[] memory swapToken0Path;\n address[] memory swapToken1Path;\n\n if (pair.token0() == strategyOutputToken) {\n swapToken0Path = new address[](0);\n swapToken1Path = new address[](2);\n\n swapToken1Path[0] = pair.token1();\n swapToken1Path[1] = pair.token0();\n outputToken = swapToken1Path[1];\n } else {\n swapToken0Path = new address[](2);\n swapToken1Path = new address[](0);\n\n swapToken0Path[0] = pair.token0();\n swapToken0Path[1] = pair.token1();\n outputToken = swapToken0Path[1];\n }\n\n strategyData = abi.encode(uniswapRouter, swapToken0Path, swapToken1Path);\n\n if (address(vars.flashSwapPair) == address(pair)) {\n emit log(\"toggling the flashswap pair\");\n emit log_address(address(pair));\n toggleFlashSwapPair(vars);\n }\n } else if (compareStrings(strategyContract, \"UniswapV2LiquidatorFunder\")) {\n outputToken = strategyOutputToken;\n\n address[] memory swapPath = new address[](2);\n swapPath[0] = inputToken;\n swapPath[1] = outputToken;\n\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\n } else if (compareStrings(strategyContract, \"JarvisLiquidatorFunder\")) {\n AddressesProvider.JarvisPool[] memory pools = ap.getJarvisPools();\n for (uint256 i = 0; i < pools.length; i++) {\n AddressesProvider.JarvisPool memory pool = pools[i];\n if (pool.syntheticToken == inputToken) {\n strategyData = abi.encode(pool.syntheticToken, pool.liquidityPool, pool.expirationTime);\n outputToken = pool.collateralToken;\n break;\n }\n }\n } else if (compareStrings(strategyContract, \"CurveSwapLiquidator\")) {\n outputToken = strategyOutputToken;\n strategyData = abi.encode(curveV1Oracle, curveV2Oracle, inputToken, outputToken, ap.getAddress(\"wtoken\"));\n } else if (compareStrings(strategyContract, \"BalancerLpTokenLiquidator\")) {\n outputToken = strategyOutputToken;\n strategyData = abi.encode(outputToken);\n } else if (compareStrings(strategyContract, \"XBombLiquidatorFunder\")) {\n outputToken = strategyOutputToken;\n address xbomb = inputToken;\n address bomb = outputToken;\n strategyData = abi.encode(inputToken, xbomb, bomb);\n } else if (compareStrings(strategyContract, \"AlgebraSwapLiquidator\")) {\n address ALGEBRA_SWAP_ROUTER = 0x327Dd3208f0bCF590A66110aCB6e5e6941A4EfA0;\n outputToken = strategyOutputToken;\n strategyData = abi.encode(outputToken, ALGEBRA_SWAP_ROUTER);\n } else {\n emit log(strategyContract);\n emit log_address(address(strategy));\n revert(\"unknown collateral\");\n }\n\n vm.prank(vars.liquidator.owner());\n vars.liquidator._whitelistRedemptionStrategy(strategy, true);\n redemptionStrategies.push(strategy);\n redemptionDatas.push(strategyData);\n\n assertEq(outputToken, strategyOutputToken, \"!expected output token\");\n return outputToken;\n }\n\n // function getCurvePoolUnderlyingTokens(address lpTokenAddress) internal view returns (address[] memory) {\n // ICurvePool curvePool = ICurvePool(lpTokenAddress);\n // uint8 i = 0;\n // while (true) {\n // try curvePool.coins(i) {\n // i++;\n // } catch {\n // break;\n // }\n // }\n // address[] memory tokens = new address[](i);\n // for (uint8 j = 0; j < i; j++) {\n // tokens[j] = curvePool.coins(j);\n // }\n // return tokens;\n // }\n\n function pickPreferredToken(\n address[] memory tokens,\n address strategyOutputToken\n ) internal view returns (address, uint8) {\n address wtoken = ap.getAddress(\"wtoken\");\n address stable = ap.getAddress(\"stableToken\");\n address wbtc = ap.getAddress(\"wBTCToken\");\n\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == strategyOutputToken) return (strategyOutputToken, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wtoken) return (wtoken, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == stable) return (stable, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wbtc) return (wbtc, i);\n }\n return (tokens[0], 0);\n }\n\n function addFundingStrategy(\n LiquidationData memory vars,\n IFundsConversionStrategy strategy,\n address debtToken,\n string memory strategyContract,\n address strategyInputToken\n ) internal returns (address) {\n address inputToken;\n bytes memory strategyData;\n\n if (compareStrings(strategyContract, \"JarvisLiquidatorFunder\")) {\n AddressesProvider.JarvisPool[] memory pools = ap.getJarvisPools();\n for (uint256 i = 0; i < pools.length; i++) {\n AddressesProvider.JarvisPool memory pool = pools[i];\n if (pool.syntheticToken == debtToken) {\n strategyData = abi.encode(pool.collateralToken, pool.liquidityPool, pool.expirationTime);\n inputToken = pool.collateralToken;\n break;\n }\n }\n\n // } else if (compareStrings(strategyContract, \"SomeOtherFunder\")) {\n // bytes memory strategyData = abi.encode(strategySpecificParams);\n // (IERC20Upgradeable inputToken, uint256 inputAmount) = IFundsConversionStrategy(addr).estimateInputAmount(10**(debtToken.decimals()), strategyData);\n // fundingStrategies.push(new SomeOtherFunder());\n // return inputToken;\n } else if (compareStrings(strategyContract, \"CurveSwapLiquidatorFunder\")) {\n inputToken = strategyInputToken;\n strategyData = abi.encode(curveV1Oracle, curveV2Oracle, inputToken, debtToken, ap.getAddress(\"wtoken\"));\n } else if (compareStrings(strategyContract, \"UniswapV3LiquidatorFunder\")) {\n inputToken = strategyInputToken;\n\n uint24 fee = 1000;\n address quoter = ap.getAddress(\"Quoter\");\n address swapRouter;\n {\n // TODO\n // polygon config // 0x1F98431c8aD98523631AE4a59f267346ea31F984\n address polygonSwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\n swapRouter = polygonSwapRouter;\n fee = 500;\n }\n\n strategyData = abi.encode(inputToken, debtToken, fee, swapRouter, quoter);\n } else {\n emit log(strategyContract);\n emit log_address(debtToken);\n revert(\"unknown debt token\");\n }\n\n fundingDatas.push(strategyData);\n\n vm.prank(vars.liquidator.owner());\n vars.liquidator._whitelistRedemptionStrategy(strategy, true);\n fundingStrategies.push(strategy);\n\n assertEq(strategyInputToken, inputToken, \"!expected input token\");\n return inputToken;\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testRawLiquidation() public debuggingOnly fork(MODE_MAINNET) {\n vm.prank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n _functionCall(\n 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A,\n hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000fda4ac09a12c10fae30e429f4d6b47c9a83c87e00000000000000000000000000000000000000000000000001797af2fe6e167700000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005ca3fd2c285c4138185ef1bda7573d415020f3c80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n \"raw liquidation failed\"\n );\n }\n}\n" + }, + "contracts/test/AuthoritiesRegistryTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport \"../ionic/AuthoritiesRegistry.sol\";\nimport \"./helpers/WithPool.sol\";\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\ncontract AuthoritiesRegistryTest is WithPool {\n AuthoritiesRegistry registry;\n\n function afterForkSetUp() internal override {\n registry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\n if (address(registry) == address(0)) {\n address proxyAdmin = address(999);\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), proxyAdmin, \"\");\n registry = AuthoritiesRegistry(address(proxy));\n registry.initialize(address(1023));\n }\n\n super.setUpWithPool(\n MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")),\n ERC20Upgradeable(ap.getAddress(\"wtoken\"))\n );\n\n setUpPool(\"auth-reg-test\", false, 0.1e18, 1.1e18);\n }\n\n function testRegistry() public fork(POLYGON_MAINNET) {\n PoolRolesAuthority auth;\n\n vm.prank(address(555));\n vm.expectRevert(\"Ownable: caller is not the owner\");\n auth = registry.createPoolAuthority(address(comptroller));\n\n vm.prank(registry.owner());\n auth = registry.createPoolAuthority(address(comptroller));\n\n assertEq(auth.owner(), registry.owner(), \"!same owner\");\n }\n\n function testAuthReconfigurePermissions() public fork(POLYGON_MAINNET) {\n vm.prank(registry.owner());\n PoolRolesAuthority auth = registry.createPoolAuthority(address(comptroller));\n\n vm.prank(address(8283));\n vm.expectRevert(\"not owner or pool\");\n registry.reconfigureAuthority(address(comptroller));\n\n vm.prank(registry.owner());\n registry.reconfigureAuthority(address(comptroller));\n }\n\n function upgradeRegistry() internal {\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(registry)));\n AuthoritiesRegistry newImpl = new AuthoritiesRegistry();\n vm.startPrank(dpa.owner());\n dpa.upgradeAndCall(\n proxy,\n address(newImpl),\n abi.encodeWithSelector(AuthoritiesRegistry.reinitialize.selector, registry.leveredPositionsFactory())\n );\n vm.stopPrank();\n }\n\n function upgradeAuth(PoolRolesAuthority auth) internal {\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(auth)));\n PoolRolesAuthority newImpl = new PoolRolesAuthority();\n vm.prank(dpa.owner());\n dpa.upgrade(proxy, address(newImpl));\n }\n\n function testAuthPermissions() public debuggingOnly fork(BSC_CHAPEL) {\n address pool = 0xa4bc2fCF2F9d87EB349f74f8729024F92A030330;\n registry = AuthoritiesRegistry(0xa5E190Fa38F325617381e835da8b2DB2D12cE5eb);\n //upgradeRegistry();\n\n PoolRolesAuthority auth = PoolRolesAuthority(0xFe5AfFFC8b55A2d139cb2ef76699C8B58c1EA299);\n //upgradeAuth(auth);\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(auth)));\n\n vm.prank(address(dpa));\n emit log_named_address(\"proxy.implementation\", proxy.implementation());\n\n emit log_named_address(\"registry.poolAuthLogic\", address(registry.poolAuthLogic()));\n //vm.prank(registry.owner());\n //registry.reconfigureAuthority(pool);\n\n bool isReg = auth.doesUserHaveRole(address(registry), auth.REGISTRY_ROLE());\n assertEq(isReg, true, \"!not registry role\");\n\n bool canCall = auth.canCall(address(registry), address(auth), RolesAuthority.setUserRole.selector);\n assertEq(canCall, true, \"!cannot call setUserRol\");\n }\n}\n" + }, + "contracts/test/caps/AdrastiaPrudentiaCapsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\nimport { ComptrollerPrudentiaCapsExt, DiamondExtension } from \"../../compound/ComptrollerPrudentiaCapsExt.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { ComptrollerV4Storage } from \"../../compound/ComptrollerStorage.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\nimport { PrudentiaLib } from \"../../adrastia/PrudentiaLib.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MockPriceOracle } from \"../../oracles/1337/MockPriceOracle.sol\";\n\nimport \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\nabstract contract HistoricalRates is IHistoricalRates {\n struct BufferMetadata {\n uint8 start;\n uint8 end;\n uint8 size;\n uint8 maxSize;\n bool pauseUpdates; // Note: this is left for extentions, but is not used in this contract.\n }\n\n /// @notice Event emitted when a rate buffer's capacity is increased past the initial capacity.\n /// @dev Buffer initialization does not emit an event.\n /// @param token The token for which the rate buffer's capacity was increased.\n /// @param oldCapacity The previous capacity of the rate buffer.\n /// @param newCapacity The new capacity of the rate buffer.\n event RatesCapacityIncreased(address indexed token, uint256 oldCapacity, uint256 newCapacity);\n\n /// @notice Event emitted when a rate buffer's capacity is initialized.\n /// @param token The token for which the rate buffer's capacity was initialized.\n /// @param capacity The capacity of the rate buffer.\n event RatesCapacityInitialized(address indexed token, uint256 capacity);\n\n /// @notice Event emitted when a new rate is pushed to the rate buffer.\n /// @param token The token for which the rate was pushed.\n /// @param target The target rate.\n /// @param current The current rate, which may be different from the target rate if the rate change is capped.\n /// @param timestamp The timestamp at which the rate was pushed.\n event RateUpdated(address indexed token, uint256 target, uint256 current, uint256 timestamp);\n\n /// @notice An error that is thrown if we try to initialize a rate buffer that has already been initialized.\n /// @param token The token for which we tried to initialize the rate buffer.\n error BufferAlreadyInitialized(address token);\n\n /// @notice An error that is thrown if we try to retrieve a rate at an invalid index.\n /// @param token The token for which we tried to retrieve the rate.\n /// @param index The index of the rate that we tried to retrieve.\n /// @param size The size of the rate buffer.\n error InvalidIndex(address token, uint256 index, uint256 size);\n\n /// @notice An error that is thrown if we try to decrease the capacity of a rate buffer.\n /// @param token The token for which we tried to decrease the capacity of the rate buffer.\n /// @param amount The capacity that we tried to decrease the rate buffer to.\n /// @param currentCapacity The current capacity of the rate buffer.\n error CapacityCannotBeDecreased(address token, uint256 amount, uint256 currentCapacity);\n\n /// @notice An error that is thrown if we try to increase the capacity of a rate buffer past the maximum capacity.\n /// @param token The token for which we tried to increase the capacity of the rate buffer.\n /// @param amount The capacity that we tried to increase the rate buffer to.\n /// @param maxCapacity The maximum capacity of the rate buffer.\n error CapacityTooLarge(address token, uint256 amount, uint256 maxCapacity);\n\n /// @notice An error that is thrown if we try to retrieve more rates than are available in the rate buffer.\n /// @param token The token for which we tried to retrieve the rates.\n /// @param size The size of the rate buffer.\n /// @param minSizeRequired The minimum size of the rate buffer that we require.\n error InsufficientData(address token, uint256 size, uint256 minSizeRequired);\n\n /// @notice The initial capacity of the rate buffer.\n uint8 internal immutable initialBufferCardinality;\n\n /// @notice Maps a token to its metadata.\n mapping(address => BufferMetadata) internal rateBufferMetadata;\n\n /// @notice Maps a token to a buffer of rates.\n mapping(address => RateLibrary.Rate[]) internal rateBuffers;\n\n /**\n * @notice Constructs the HistoricalRates contract with a specified initial buffer capacity.\n * @param initialBufferCardinality_ The initial capacity of the rate buffer.\n */\n constructor(uint8 initialBufferCardinality_) {\n initialBufferCardinality = initialBufferCardinality_;\n }\n\n /// @inheritdoc IHistoricalRates\n function getRateAt(address token, uint256 index) external view virtual override returns (RateLibrary.Rate memory) {\n BufferMetadata memory meta = rateBufferMetadata[token];\n\n if (index >= meta.size) {\n revert InvalidIndex(token, index, meta.size);\n }\n\n uint256 bufferIndex = meta.end < index ? meta.end + meta.size - index : meta.end - index;\n\n return rateBuffers[token][bufferIndex];\n }\n\n /// @inheritdoc IHistoricalRates\n function getRates(address token, uint256 amount) external view virtual override returns (RateLibrary.Rate[] memory) {\n return _getRates(token, amount, 0, 1);\n }\n\n /// @inheritdoc IHistoricalRates\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view virtual override returns (RateLibrary.Rate[] memory) {\n return _getRates(token, amount, offset, increment);\n }\n\n /// @inheritdoc IHistoricalRates\n function getRatesCount(address token) external view override returns (uint256) {\n return rateBufferMetadata[token].size;\n }\n\n /// @inheritdoc IHistoricalRates\n function getRatesCapacity(address token) external view virtual override returns (uint256) {\n uint256 maxSize = rateBufferMetadata[token].maxSize;\n if (maxSize == 0) return initialBufferCardinality;\n\n return maxSize;\n }\n\n /// @param amount The new capacity of rates for the token. Must be greater than the current capacity, but\n /// less than 256.\n /// @inheritdoc IHistoricalRates\n function setRatesCapacity(address token, uint256 amount) external virtual {\n _setRatesCapacity(token, amount);\n }\n\n /**\n * @dev Internal function to set the capacity of the rate buffer for a token.\n * @param token The token for which to set the new capacity.\n * @param amount The new capacity of rates for the token. Must be greater than the current capacity, but\n * less than 256.\n */\n function _setRatesCapacity(address token, uint256 amount) internal virtual {\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n if (amount < meta.maxSize) revert CapacityCannotBeDecreased(token, amount, meta.maxSize);\n if (amount > type(uint8).max) revert CapacityTooLarge(token, amount, type(uint8).max);\n\n RateLibrary.Rate[] storage rateBuffer = rateBuffers[token];\n\n // Add new slots to the buffer\n uint256 capacityToAdd = amount - meta.maxSize;\n for (uint256 i = 0; i < capacityToAdd; ++i) {\n // Push a dummy rate with non-zero values to put most of the gas cost on the caller\n rateBuffer.push(RateLibrary.Rate({ target: 1, current: 1, timestamp: 1 }));\n }\n\n if (meta.maxSize != amount) {\n emit RatesCapacityIncreased(token, meta.maxSize, amount);\n\n // Update the metadata\n meta.maxSize = uint8(amount);\n }\n }\n\n /**\n * @dev Internal function to get historical rates with specified amount, offset, and increment.\n * @param token The token for which to retrieve the rates.\n * @param amount The number of historical rates to retrieve.\n * @param offset The number of rates to skip before starting to collect the rates.\n * @param increment The step size between the rates to collect.\n * @return observations An array of Rate structs containing the retrieved historical rates.\n */\n function _getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) internal view virtual returns (RateLibrary.Rate[] memory) {\n if (amount == 0) return new RateLibrary.Rate[](0);\n\n BufferMetadata memory meta = rateBufferMetadata[token];\n if (meta.size <= (amount - 1) * increment + offset)\n revert InsufficientData(token, meta.size, (amount - 1) * increment + offset + 1);\n\n RateLibrary.Rate[] memory observations = new RateLibrary.Rate[](amount);\n\n uint256 count = 0;\n\n for (\n uint256 i = meta.end < offset ? meta.end + meta.size - offset : meta.end - offset;\n count < amount;\n i = (i < increment) ? (i + meta.size) - increment : i - increment\n ) {\n observations[count++] = rateBuffers[token][i];\n }\n\n return observations;\n }\n\n /**\n * @dev Internal function to initialize rate buffers for a token.\n * @param token The token for which to initialize the rate buffer.\n */\n function initializeBuffers(address token) internal virtual {\n if (rateBuffers[token].length != 0) {\n revert BufferAlreadyInitialized(token);\n }\n\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n // Initialize the buffers\n RateLibrary.Rate[] storage observationBuffer = rateBuffers[token];\n\n for (uint256 i = 0; i < initialBufferCardinality; ++i) {\n observationBuffer.push();\n }\n\n // Initialize the metadata\n meta.start = 0;\n meta.end = 0;\n meta.size = 0;\n meta.maxSize = initialBufferCardinality;\n meta.pauseUpdates = false;\n\n emit RatesCapacityInitialized(token, meta.maxSize);\n }\n\n /**\n * @dev Internal function to push a new rate data into the rate buffer and update metadata accordingly.\n * @param token The token for which to push the new rate data.\n * @param rate The Rate struct containing target rate, current rate, and timestamp data to be pushed.\n */\n function push(address token, RateLibrary.Rate memory rate) internal virtual {\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n if (meta.size == 0) {\n if (meta.maxSize == 0) {\n // Initialize the buffers\n initializeBuffers(token);\n }\n } else {\n meta.end = (meta.end + 1) % meta.maxSize;\n }\n\n rateBuffers[token][meta.end] = rate;\n\n emit RateUpdated(token, rate.target, rate.current, block.timestamp);\n\n if (meta.size < meta.maxSize && meta.end == meta.size) {\n // We are at the end of the array and we have not yet filled it\n meta.size++;\n } else {\n // start was just overwritten\n meta.start = (meta.start + 1) % meta.size;\n }\n }\n}\n\ncontract PrudentiaStub is HistoricalRates {\n constructor() HistoricalRates(2) {}\n\n function stubPush(address underlyingToken, uint64 rate) public {\n push(underlyingToken, RateLibrary.Rate({ target: rate, current: rate, timestamp: uint32(block.timestamp) }));\n }\n}\n\ncontract AdrastiaPrudentiaCapsTest is BaseTest {\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicComptroller comptroller;\n\n InterestRateModel interestModel;\n MockPriceOracle priceOracle;\n\n MockERC20 underlyingToken1;\n ICErc20 cToken1;\n\n MockERC20 underlyingToken2;\n ICErc20 cToken2;\n\n MockERC20 underlyingToken3;\n ICErc20 cToken3;\n\n CErc20Delegate cErc20Delegate;\n\n PrudentiaStub prudentia;\n\n function setUp() public {\n // Deploy admin contracts\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n\n // Deploy comptroller logic\n Comptroller comptrollerLogic = new Comptroller();\n\n // Deploy underlying tokens\n underlyingToken1 = new MockERC20(\"UnderlyingToken1\", \"UT1\", 18);\n underlyingToken1.mint(address(this), 1000000e18); // 1M tokens\n underlyingToken2 = new MockERC20(\"UnderlyingToken2\", \"UT2\", 18);\n underlyingToken2.mint(address(this), 1000000e18); // 1M tokens\n underlyingToken3 = new MockERC20(\"UnderlyingToken3\", \"UT3\", 6);\n underlyingToken3.mint(address(this), 1000000e6); // 1M tokens\n\n // Deploy cToken delegates\n cErc20Delegate = new CErc20Delegate();\n\n // Deploy price oracle\n priceOracle = new MockPriceOracle(10);\n\n // Deploy IRM\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n\n // Deploy comptroller\n address[] memory unitroller = new address[](1);\n unitroller[0] = address(comptrollerLogic);\n address[] memory addressZero = new address[](1);\n addressZero[0] = address(0);\n bool[] memory boolTrue = new bool[](1);\n boolTrue[0] = true;\n bool[] memory boolFalse = new bool[](1);\n boolFalse[0] = false;\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(comptrollerLogic));\n DiamondExtension[] memory extensions = new DiamondExtension[](3);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = new ComptrollerPrudentiaCapsExt();\n extensions[2] = comptrollerLogic;\n ionicAdmin._setComptrollerExtensions(address(comptrollerLogic), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\", // name\n address(comptrollerLogic), // implementation address\n abi.encode(payable(address(ionicAdmin))), // constructor args\n false, // whitelist enforcement\n 0.1e18, // close factor = 10%\n 1.1e18, // liquidation incentive = 110%\n address(priceOracle) // price oracle\n );\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n newAr.setUserRole(comptrollerAddress, address(ionicAdmin), poolAuth.SUPPLIER_ROLE(), true);\n\n // Setup CErc20Delegate whitelist\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](1);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n address[] memory oldCErc20Implementations = new address[](1);\n oldCErc20Implementations[0] = address(0);\n address[] memory newCErc20Implementations = new address[](1);\n newCErc20Implementations[0] = address(cErc20Delegate);\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n\n // Deploy cToken1\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken1), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 1\", // cToken name\n \"CT1\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Deploy cToken2\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken2), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 2\", // cToken name\n \"CT2\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Deploy cToken3\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken3), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 3\", // cToken name\n \"CT3\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Store the cToken addresses\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n assertEq(allMarkets.length, 3);\n cToken1 = allMarkets[0];\n cToken2 = allMarkets[1];\n cToken3 = allMarkets[2];\n\n // Deploy Prudentia\n prudentia = new PrudentiaStub();\n }\n\n function test_NativeCaps_UnrestrictedSupply() public {\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), 0); // No supply cap set (unrestricted)\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n }\n\n function test_NativeCaps_RestrictedSupply() public {\n uint256 cap = 9999e18; // supply cap of 9,999\n uint256 mintAmount = 10000e18; // mint of 10,000\n\n // Set a native supply cap for cToken1\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = cap;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cTokens[0])), supplyCaps[0]);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_NativeCaps_UnrestrictedBorrow() public {\n assertEq(comptroller.effectiveBorrowCaps(address(cToken1)), 0); // No borrow cap set (unrestricted)\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Borrow\n cToken2.borrow(1000e18); // Borrow 1,000 cToken2\n }\n\n function test_NativeCaps_RestrictedBorrow() public {\n uint256 cap = 999e18; // borrow cap of 999\n uint256 borrowAmount = 1000e18; // borrow of 1,000\n\n // Set a native borrow cap for cToken2\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = cap;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cTokens[0])), borrowCaps[0]);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0\n */\n\n function test_Prudentia_Supply_Unrestricted() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Supply cap\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_MissingRate_WithRateConfiguredForAnotherCToken() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken2\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted supply cap for cToken2\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken2)), 0); // Unrestricted\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_WithRateConfiguredForAnotherCToken() public {\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken1\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted borrow cap for cToken1\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken1)), 0); // Unrestricted\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and a decimal shift of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_DecShiftPos1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e19);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e19);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e19);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e19);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and a decimal shift of -1\n */\n\n function test_Prudentia_Supply_Unrestricted_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_DecShiftNeg1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e17);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e17);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e17);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e17);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and using a cToken with the underlying token having 6 decimals\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 0, using a cToken with the underlying token having 6 decimals,\n * and a decimalShift of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 0, using a cToken with the underlying token having 6 decimals,\n * and a decimalShift of -1\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_Offset1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // Unrestricted cap at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_Offset1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1 at index 1 (the offset)\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_Offset1() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_Offset1() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_Offset1() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_Offset1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_Offset1() public {\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2 at index 1 (the offset)\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_Offset1() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n Additional ComptrollerPrudentiaCapsExt tests\n */\n\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n function test_Prudentia_SupplyCapConfig() public {\n PrudentiaLib.PrudentiaConfig memory oldConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(0),\n offset: 0,\n decimalShift: 0\n });\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Setup expectation of the following event\n vm.expectEmit(false, false, false, true);\n emit NewSupplyCapConfig(oldConfig, newConfig);\n\n // Set supply cap config\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(newConfig);\n\n // Get the supply cap config\n PrudentiaLib.PrudentiaConfig memory current = ComptrollerPrudentiaCapsExt(address(comptroller))\n .getSupplyCapConfig();\n\n assertEq(newConfig.controller, current.controller, \"controller\");\n assertEq(newConfig.offset, current.offset, \"offset\");\n }\n\n function test_Prudentia_BorrowCapConfig() public {\n PrudentiaLib.PrudentiaConfig memory oldConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(0),\n offset: 0,\n decimalShift: 0\n });\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Setup expectation of the following event\n vm.expectEmit(false, false, false, true);\n emit NewBorrowCapConfig(oldConfig, newConfig);\n\n // Set borrow cap config\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(newConfig);\n\n // Get the borrow cap config\n PrudentiaLib.PrudentiaConfig memory current = ComptrollerPrudentiaCapsExt(address(comptroller))\n .getBorrowCapConfig();\n\n assertEq(newConfig.controller, current.controller, \"controller\");\n assertEq(newConfig.offset, current.offset, \"offset\");\n }\n\n function test_Prudentia_SetSupplyCapConfig_OnlyAdmin() public {\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Set supply cap config\n vm.prank(address(7));\n vm.expectRevert(\"!admin\");\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(newConfig);\n }\n\n function test_Prudentia_SetBorrowCapConfig_OnlyAdmin() public {\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Set supply cap config\n vm.prank(address(7));\n vm.expectRevert(\"!admin\");\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(newConfig);\n }\n}\n" + }, + "contracts/test/CollateralSwapTest.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CollateralSwap } from \"../ionic/CollateralSwap.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\n\ncontract CollateralSwapTest is UpgradesBaseTest {\n ICErc20 wethMarket = ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3);\n ICErc20 usdcMarket = ICErc20(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0);\n ICErc20 ezETHMarket = ICErc20(0x079f84161642D81aaFb67966123C9949F9284bf5);\n ICErc20 cbETHMarket = ICErc20(0x9c201024A62466F9157b2dAaDda9326207ADDd29);\n PoolLens lens = PoolLens(0x6ec80f9aCd960b568932696C0F0bE06FBfCd175a);\n CollateralSwap swap;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n _upgradeMarketWithExtension(wethMarket);\n _upgradeMarketWithExtension(ezETHMarket);\n _upgradeMarketWithExtension(cbETHMarket);\n _upgradeMarketWithExtension(usdcMarket);\n swap = new CollateralSwap(0, msg.sender, address(wethMarket.comptroller()), new address[](0));\n emit log_named_address(\"swap address: \", address(swap));\n }\n\n function test_collateralSwap_works_noBorrows() public debuggingOnly forkAtBlock(BASE_MAINNET, 20754244) {\n address ionwethWhale = 0x753E909D68921388b8fB4E471D155ff73c735ebC;\n address swapTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE;\n swap.setAllowedSwapTarget(swapTarget, true);\n uint256 healthFactor = lens.getHealthFactor(0x753E909D68921388b8fB4E471D155ff73c735ebC, wethMarket.comptroller());\n emit log_named_uint(\"health factor before: \", healthFactor);\n bytes memory swapData = abi.encodePacked(\n hex\"5fd9ae2ea41bd686f6e5326450d10ac2dc733b837ae20fb0aaf871e87b4a9227171918ab00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000a0cb889707d426a7a386870a03bc70d1b0697598000000000000000000000000000000000000000000000000000000001d42cce300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000005696f6e6963000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000a6d96e7f4d7b96cfe42185df61e64d255c12dff0000000000000000000000000a6d96e7f4d7b96cfe42185df61e64d255c12dff0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000000002d02dd2e34e182400000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000084eedd56e100000000000000000000000042000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000b85da6a0970f0000000000000000000000000000000000000000000000000001ccea209179a9000000000000000000000000d5ee82d18f63f0b82df91a6ae73b74cfda57144e000000000000000000000000000000000000000000000000000000000000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000000000000000000000002cda88b1c1c076b00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa490411a32000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a99000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a990000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae00000000000000000000000000000000000000000000000002cda88b1c1c076b000000000000000000000000000000000000000000000000000000001d42cce3000000000000000000000000000000000000000000000000000000001d68714c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab3000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000004d69971ccd4a636c403a3c1b00c85e99bb9b5606000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000002cda88b1c1c076b000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e4200000000000000000000000000000000000006000064b79dd08ea68a908a97220c76d19a6aa9cbde437600002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002449f865422000000000000000000000000b79dd08ea68a908a97220c76d19a6aa9cbde437600000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000000c1a09d5d0445047da3ab4994262b22404288a3b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002eb79dd08ea68a908a97220c76d19a6aa9cbde4376000001833589fcd6edb6e08f4c7c32d4f71b54bda029130000260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e85000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a0000000000000000000000000000000000000000000000000000000001d68714c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f865422000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n vm.startPrank(ionwethWhale);\n wethMarket.approve(address(swap), 1e18);\n swap.swapCollateral(1e18, wethMarket, usdcMarket, swapTarget, swapData);\n vm.stopPrank();\n healthFactor = lens.getHealthFactor(0x753E909D68921388b8fB4E471D155ff73c735ebC, wethMarket.comptroller());\n emit log_named_uint(\"health factor after: \", healthFactor);\n }\n\n function test_collateralSwap_worksWithBorrows() public debuggingOnly forkAtBlock(BASE_MAINNET, 20874971) {\n address ionezEthWhale = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address swapTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE;\n swap.setAllowedSwapTarget(swapTarget, true);\n bytes memory swapData = abi.encodePacked(\n hex\"4666fc80a7f78b3a1e00f74ab91e766714a7b7390c173e43f2f65d7c74bda18ff1e067dd00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000d6bbde9174b1cdaa358d2cf4d57d1a9f7178fbff000000000000000000000000000000000000000000000000003625685b773877000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000002416092f143378750bb29b79ed961ab195cceea50000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000000000000000000000000000000000000000000000000039afc19de8c3ba00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000aa490411a32000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a99000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000002416092f143378750bb29b79ed961ab195cceea50000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a990000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000039afc19de8c3ba000000000000000000000000000000000000000000000000003625685b77387700000000000000000000000000000000000000000000000000366b101e2d34e40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab3000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000004c98e9c2439c0d4621c62fee2fed6d042fa8c57000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000039afc19de8c3ba000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e2416092f143378750bb29b79ed961ab195cceea5000064420000000000000000000000000000000000000600000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002449f865422000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb000000000000000000000000257fcbae4ac6b26a02e4fc5e1a11e4174b5ce39500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e42000000000000000000000000000000000000060000642ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e850000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a000000000000000000000000000000000000000000000000000366b101e2d34e400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f8654220000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec2200000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f990000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n (uint256 error, uint256 balance, uint256 borrowBalance, uint256 exchangeRateMantissa) = ezETHMarket\n .getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"ezETH error: \", error);\n emit log_named_uint(\"ezETH balance: \", balance);\n emit log_named_uint(\"ezETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"ezETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n (error, balance, borrowBalance, exchangeRateMantissa) = cbETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"cbETH error: \", error);\n emit log_named_uint(\"cbETH balance: \", balance);\n emit log_named_uint(\"cbETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"cbETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n vm.startPrank(ionezEthWhale);\n ezETHMarket.approve(address(swap), type(uint256).max);\n uint256 healthFactor = lens.getHealthFactor(ionezEthWhale, ezETHMarket.comptroller());\n emit log_named_uint(\"health factor before: \", healthFactor);\n swap.swapCollateral(16237319785333690, ezETHMarket, cbETHMarket, swapTarget, swapData);\n healthFactor = lens.getHealthFactor(ionezEthWhale, ezETHMarket.comptroller());\n emit log_named_uint(\"health factor after: \", healthFactor);\n vm.stopPrank();\n\n (error, balance, borrowBalance, exchangeRateMantissa) = ezETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"ezETH error: \", error);\n emit log_named_uint(\"ezETH balance: \", balance);\n emit log_named_uint(\"ezETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"ezETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n (error, balance, borrowBalance, exchangeRateMantissa) = cbETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"cbETH error: \", error);\n emit log_named_uint(\"cbETH balance: \", balance);\n emit log_named_uint(\"cbETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"cbETH exchangeRateMantissa: \", exchangeRateMantissa);\n }\n}\n" + }, + "contracts/test/ComptrollerTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\n\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract ComptrollerTest is BaseTest {\n IonicComptroller internal comptroller;\n IonicFlywheel internal flywheel;\n address internal nonOwner = address(0x2222);\n\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n function setUp() public {\n {\n Unitroller proxy = new Unitroller(payable(address(this)));\n proxy._registerExtension(new Comptroller(), DiamondExtension(address(0)));\n comptroller = IonicComptroller(address(proxy));\n }\n {\n ERC20 rewardToken = new MockERC20(\"RewardToken\", \"RT\", 18);\n IonicFlywheel impl = new IonicFlywheel();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(dpa), \"\");\n flywheel = IonicFlywheel(address(proxy));\n flywheel.initialize(rewardToken, IFlywheelRewards(address(2)), IFlywheelBooster(address(3)), address(this));\n }\n }\n\n function test__setFlywheel() external {\n vm.prank(comptroller.admin());\n comptroller._addRewardsDistributor(address(flywheel));\n assertEq(comptroller.rewardsDistributors(0), address(flywheel));\n }\n\n function test__setFlywheelRevertsIfNonOwner() external {\n vm.startPrank(nonOwner);\n vm.expectRevert(\"!admin\");\n comptroller._addRewardsDistributor(address(flywheel));\n }\n\n function testBscInflationProtection() public debuggingOnly fork(BSC_MAINNET) {\n _testInflationProtection();\n }\n\n function testPolygonInflationProtection() public debuggingOnly fork(POLYGON_MAINNET) {\n _testInflationProtection();\n }\n\n function testModeInflationProtection() public debuggingOnly fork(MODE_MAINNET) {\n _testInflationProtection();\n }\n\n function _testInflationProtection() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n PoolDirectory.Pool[] memory pools = fpd.getAllPools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = pool.getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n uint256 totalSupply = market.totalSupply();\n if (totalSupply > 0) {\n if (totalSupply < 1000) {\n emit log_named_address(\"low ts market\", address(markets[j]));\n emit log_named_uint(\"ts\", totalSupply);\n } else {\n assertEq(\n pool.redeemAllowed(address(markets[j]), address(0), totalSupply - 980),\n uint256(ComptrollerErrorReporter.Error.REJECTION),\n \"low ts not rejected\"\n );\n }\n }\n }\n }\n }\n}\n" + }, + "contracts/test/config/BaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Vm.sol\";\nimport \"forge-std/Test.sol\";\nimport \"forge-std/console.sol\";\n\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\n\nabstract contract BaseTest is Test {\n uint128 constant ETHEREUM_MAINNET = 1;\n uint128 constant BSC_MAINNET = 56;\n uint128 constant POLYGON_MAINNET = 137;\n uint128 constant ARBITRUM_ONE = 42161;\n\n uint128 constant BSC_CHAPEL = 97;\n uint128 constant NEON_MAINNET = 245022934;\n uint128 constant LINEA_MAINNET = 59144;\n uint128 constant ZKEVM_MAINNET = 1101;\n uint128 constant MODE_MAINNET = 34443;\n uint128 constant BASE_MAINNET = 8453;\n\n // taken from ERC1967Upgrade\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n AddressesProvider public ap;\n ProxyAdmin public dpa;\n\n mapping(uint128 => uint256) private forkIds;\n\n constructor() {\n configureAddressesProvider(0);\n }\n\n uint256 constant CRITICAL = 100;\n uint256 constant NORMAL = 90;\n uint256 constant LOW = 80;\n\n modifier importance(uint256 testImportance) {\n uint256 runLevel = NORMAL;\n\n try vm.envUint(\"TEST_RUN_LEVEL\") returns (uint256 level) {\n runLevel = level;\n } catch {\n emit log(\"failed to get env param TEST_RUN_LEVEL\");\n }\n\n if (testImportance >= runLevel) {\n _;\n } else {\n emit log(\"not running the test\");\n }\n }\n\n modifier debuggingOnly() {\n try vm.envBool(\"LOCAL_FORGE_ENV\") returns (bool run) {\n if (run) _;\n } catch {\n emit log(\"skipping this test in the CI/CD - add LOCAL_FORGE_ENV=true to your .env file to run locally\");\n }\n }\n\n modifier fork(uint128 chainid) {\n if (shouldRunForChain(chainid)) {\n _forkAtBlock(chainid, 0);\n _;\n }\n }\n\n modifier forkAtBlock(uint128 chainid, uint256 blockNumber) {\n if (shouldRunForChain(chainid)) {\n _forkAtBlock(chainid, blockNumber);\n _;\n }\n }\n\n modifier whenForking() {\n try vm.activeFork() returns (uint256) {\n _;\n } catch {}\n }\n\n function shouldRunForChain(uint256 chainid) internal returns (bool) {\n bool run = true;\n try vm.envUint(\"TEST_RUN_CHAINID\") returns (uint256 envChainId) {\n run = envChainId == chainid;\n } catch {\n emit log(\"failed to get env param TEST_RUN_CHAINID\");\n }\n return run;\n }\n\n function _forkAtBlock(uint128 chainid, uint256 blockNumber) internal {\n if (block.chainid != chainid) {\n if (blockNumber != 0) {\n vm.selectFork(getArchiveForkId(chainid));\n vm.rollFork(blockNumber);\n } else {\n vm.selectFork(getForkId(chainid));\n }\n }\n configureAddressesProvider(chainid);\n afterForkSetUp();\n }\n\n function getForkId(uint128 chainid, bool archive) private returns (uint256) {\n return archive ? getForkId(chainid) : getArchiveForkId(chainid);\n }\n\n function getForkId(uint128 chainid) private returns (uint256) {\n if (forkIds[chainid] == 0) {\n if (chainid == BSC_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc\")) + 100;\n } else if (chainid == BSC_CHAPEL) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc_chapel\")) + 100;\n } else if (chainid == POLYGON_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"polygon\")) + 100;\n } else if (chainid == NEON_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"neon\")) + 100;\n } else if (chainid == ARBITRUM_ONE) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"arbitrum\")) + 100;\n } else if (chainid == ETHEREUM_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"ethereum\")) + 100;\n } else if (chainid == LINEA_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"linea\")) + 100;\n } else if (chainid == ZKEVM_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"zkevm\")) + 100;\n } else if (chainid == MODE_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"mode\")) + 100;\n } else if (chainid == BASE_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"base\")) + 100;\n }\n }\n\n return forkIds[chainid] - 100;\n }\n\n function getArchiveForkId(uint128 chainid) private returns (uint256) {\n // store the archive rpc urls in the forkIds mapping at an offset\n uint128 chainidWithOffset = chainid + type(uint64).max;\n if (forkIds[chainidWithOffset] == 0) {\n if (chainid == BSC_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_archive\")) + 100;\n } else if (chainid == BSC_CHAPEL) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_chapel_archive\")) + 100;\n } else if (chainid == POLYGON_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"polygon_archive\")) + 100;\n } else if (chainid == NEON_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"neon_archive\")) + 100;\n } else if (chainid == ARBITRUM_ONE) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"arbitrum_archive\")) + 100;\n } else if (chainid == ETHEREUM_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"ethereum_archive\")) + 100;\n } else if (chainid == LINEA_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"linea_archive\")) + 100;\n } else if (chainid == ZKEVM_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"zkevm_archive\")) + 100;\n } else if (chainid == MODE_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"mode_archive\")) + 100;\n } else if (chainid == BASE_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"base_archive\")) + 100;\n }\n }\n return forkIds[chainidWithOffset] - 100;\n }\n\n function afterForkSetUp() internal virtual {}\n\n function configureAddressesProvider(uint128 chainid) private {\n if (chainid == BSC_MAINNET) {\n ap = AddressesProvider(address(0));\n } else if (chainid == BSC_CHAPEL) {\n ap = AddressesProvider(0x3dc8CE9f581e49B9E5304CF580940ad341F64c3f);\n } else if (block.chainid == POLYGON_MAINNET) {\n ap = AddressesProvider(0xE31baC0B582AA248c0017F87F24087cEa7A55E26);\n } else if (chainid == NEON_MAINNET) {\n ap = AddressesProvider(0xF4C60F6ac6b3AF54044757a1a54D76EEe28244CE);\n } else if (chainid == ARBITRUM_ONE) {\n ap = AddressesProvider(0x3B12BA992259Fb3855C4E1D452a754dCa2E276fC);\n } else if (chainid == LINEA_MAINNET) {\n ap = AddressesProvider(0x914694DA0bED80e74ef1a28029f016119782C0f1);\n } else if (chainid == ZKEVM_MAINNET) {\n ap = AddressesProvider(0x27aA55A3D55959261e119d75256aadAB79aE897C);\n } else if (chainid == MODE_MAINNET) {\n ap = AddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n } else if (chainid == BASE_MAINNET) {\n ap = AddressesProvider(0xcD4D7c8e2bA627684a9B18F7fe88239341D3ba5c);\n } else {\n dpa = new ProxyAdmin();\n AddressesProvider logic = new AddressesProvider();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(logic),\n address(dpa),\n abi.encodeWithSelector(ap.initialize.selector, address(this))\n );\n ap = AddressesProvider(address(proxy));\n ap.setAddress(\"DefaultProxyAdmin\", address(dpa));\n }\n dpa = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n if (ap.owner() == address(0)) {\n ap.initialize(address(this));\n }\n if (ap.getAddress(\"deployer\") == address(0)) {\n vm.prank(ap.owner());\n ap.setAddress(\"deployer\", 0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n }\n }\n\n function diff(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a > b) {\n return a - b;\n } else {\n return b - a;\n }\n }\n\n function compareStrings(string memory a, string memory b) public pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n\n function asArray(address value) public pure returns (address[] memory) {\n address[] memory array = new address[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(address value0, address value1) public pure returns (address[] memory) {\n address[] memory array = new address[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(\n address value0,\n address value1,\n address value2\n ) public pure returns (address[] memory) {\n address[] memory array = new address[](3);\n array[0] = value0;\n array[1] = value1;\n array[2] = value2;\n return array;\n }\n\n function asArray(bool value) public pure returns (bool[] memory) {\n bool[] memory array = new bool[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(uint256 value0, uint256 value1) public pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(uint256 value) public pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(bytes memory value) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(bytes memory value0, bytes memory value1) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(\n bytes memory value0,\n bytes memory value1,\n bytes memory value2\n ) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](3);\n array[0] = value0;\n array[1] = value1;\n array[2] = value2;\n return array;\n }\n\n function sqrt(uint256 x) public pure returns (uint256) {\n if (x == 0) return 0;\n uint256 xx = x;\n uint256 r = 1;\n\n if (xx >= 0x100000000000000000000000000000000) {\n xx >>= 128;\n r <<= 64;\n }\n if (xx >= 0x10000000000000000) {\n xx >>= 64;\n r <<= 32;\n }\n if (xx >= 0x100000000) {\n xx >>= 32;\n r <<= 16;\n }\n if (xx >= 0x10000) {\n xx >>= 16;\n r <<= 8;\n }\n if (xx >= 0x100) {\n xx >>= 8;\n r <<= 4;\n }\n if (xx >= 0x10) {\n xx >>= 4;\n r <<= 2;\n }\n if (xx >= 0x8) {\n r <<= 1;\n }\n\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return (r < r1 ? r : r1);\n }\n}\n" + }, + "contracts/test/config/MarketsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./BaseTest.t.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\nimport { CErc20RewardsDelegate } from \"../../compound/CErc20RewardsDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\nimport { DiamondExtension } from \"../../ionic/DiamondExtension.sol\";\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract MarketsTest is BaseTest {\n FeeDistributor internal ffd;\n\n CErc20Delegate internal cErc20Delegate;\n CErc20PluginDelegate internal cErc20PluginDelegate;\n CErc20RewardsDelegate internal cErc20RewardsDelegate;\n CErc20PluginRewardsDelegate internal cErc20PluginRewardsDelegate;\n CTokenFirstExtension internal newCTokenExtension;\n\n address payable internal latestComptrollerImplementation;\n ComptrollerFirstExtension internal comptrollerExtension;\n\n function afterForkSetUp() internal virtual override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n upgradeFfd();\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20RewardsDelegate = new CErc20RewardsDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n newCTokenExtension = new CTokenFirstExtension();\n\n comptrollerExtension = new ComptrollerFirstExtension();\n Comptroller newComptrollerImplementation = new Comptroller();\n latestComptrollerImplementation = payable(address(newComptrollerImplementation));\n }\n\n function upgradeFfd() internal {\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffd)));\n bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n if (address(ffd.authoritiesRegistry()) == address(0)) {\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n vm.prank(ffd.owner());\n ffd.reinitialize(newAr);\n }\n }\n\n function _prepareCTokenUpgrade(ICErc20 market) internal returns (address) {\n address implBefore = market.implementation();\n //emit log(\"implementation before\");\n //emit log_address(implBefore);\n\n CErc20Delegate newImpl;\n if (market.delegateType() == 1) {\n newImpl = cErc20Delegate;\n } else if (market.delegateType() == 2) {\n newImpl = cErc20PluginDelegate;\n } else if (market.delegateType() == 3) {\n newImpl = cErc20RewardsDelegate;\n } else {\n newImpl = cErc20PluginRewardsDelegate;\n }\n\n // set the new ctoken delegate as the latest\n uint8 delegateType = market.delegateType();\n vm.prank(ffd.owner());\n ffd._setLatestCErc20Delegate(delegateType, address(newImpl), abi.encode(address(0)));\n\n // add the extension to the auto upgrade config\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = DiamondExtension(newImpl);\n cErc20DelegateExtensions[1] = newCTokenExtension;\n vm.prank(ffd.owner());\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\n\n return address(newImpl);\n }\n\n function _upgradeMarket(ICErc20 market) internal {\n address newDelegate = _prepareCTokenUpgrade(market);\n\n bytes memory becomeImplData = (address(newDelegate) == address(cErc20Delegate))\n ? bytes(\"\")\n : abi.encode(address(0));\n vm.prank(market.ionicAdmin());\n market._setImplementationSafe(newDelegate, becomeImplData);\n }\n\n function _prepareComptrollerUpgrade(address oldCompImpl) internal {\n vm.startPrank(ffd.owner());\n ffd._setLatestComptrollerImplementation(oldCompImpl, latestComptrollerImplementation);\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = comptrollerExtension;\n extensions[1] = Comptroller(latestComptrollerImplementation);\n ffd._setComptrollerExtensions(latestComptrollerImplementation, extensions);\n vm.stopPrank();\n }\n\n function _upgradeExistingPool(address poolAddress) internal {\n Unitroller asUnitroller = Unitroller(payable(poolAddress));\n // change the implementation to the new that can add extensions\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\n\n _prepareComptrollerUpgrade(oldComptrollerImplementation);\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/ContractsUpgradesTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ComptrollerFirstExtension, DiamondExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract ContractsUpgradesTest is BaseTest {\n function testPoolDirectoryUpgrade() public fork(BSC_MAINNET) {\n address contractToTest = ap.getAddress(\"PoolDirectory\"); // PoolDirectory proxy\n\n // before upgrade\n PoolDirectory fpdBefore = PoolDirectory(contractToTest);\n PoolDirectory.Pool[] memory poolsBefore = fpdBefore.getAllPools();\n address ownerBefore = fpdBefore.owner();\n emit log_address(ownerBefore);\n\n uint256 lenBefore = poolsBefore.length;\n emit log_uint(lenBefore);\n\n // upgrade\n {\n PoolDirectory newImpl = new PoolDirectory();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(contractToTest));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n // after upgrade\n PoolDirectory fpd = PoolDirectory(contractToTest);\n address ownerAfter = fpd.owner();\n emit log_address(ownerAfter);\n\n (, PoolDirectory.Pool[] memory poolsAfter) = fpd.getActivePools();\n uint256 lenAfter = poolsAfter.length;\n emit log_uint(poolsAfter.length);\n\n assertEq(lenBefore, lenAfter, \"pools count does not match\");\n assertEq(ownerBefore, ownerAfter, \"owner mismatch\");\n }\n\n function testFeeDistributorUpgrade() public fork(BSC_MAINNET) {\n // TODO use an already deployed market\n CErc20Delegate oldCercDelegate = new CErc20Delegate();\n\n // before upgrade\n FeeDistributor ffdProxy = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n uint256 marketsCounterBefore = ffdProxy.marketsCounter();\n address ownerBefore = ffdProxy.owner();\n\n (address latestCErc20DelegateBefore, ) = ffdProxy.latestCErc20Delegate(oldCercDelegate.delegateType());\n\n emit log_uint(marketsCounterBefore);\n emit log_address(ownerBefore);\n\n // upgrade\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffdProxy)));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n // after upgrade\n FeeDistributor ffd = FeeDistributor(payable(address(ffdProxy)));\n\n uint256 marketsCounterAfter = ffd.marketsCounter();\n address ownerAfter = ffd.owner();\n (address latestCErc20DelegateAfter, ) = ffd.latestCErc20Delegate(oldCercDelegate.delegateType());\n\n emit log_uint(marketsCounterAfter);\n emit log_address(ownerAfter);\n\n assertEq(latestCErc20DelegateBefore, latestCErc20DelegateAfter, \"latest delegates do not match\");\n assertEq(marketsCounterBefore, marketsCounterAfter, \"markets counter does not match\");\n\n assertEq(ownerBefore, ownerAfter, \"owner mismatch\");\n }\n\n function testMarketsLatestImplementationsChapel() public fork(BSC_CHAPEL) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsBsc() public fork(BSC_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsPolygon() public fork(POLYGON_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsArbitrum() public fork(ARBITRUM_ONE) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsEth() public fork(ETHEREUM_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function _testMarketsLatestImplementations() internal {\n FeeDistributor ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n if (address(fpd) != address(0)) {\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = pool.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n\n uint8 currentDelegateType = market.delegateType();\n (address upgradeToImpl, ) = ffd.latestCErc20Delegate(currentDelegateType);\n\n address currentImpl = market.implementation();\n if (currentImpl != upgradeToImpl) emit log_address(address(market));\n assertEq(currentImpl, upgradeToImpl, \"market needs to be upgraded\");\n\n DiamondBase asBase = DiamondBase(address(markets[j]));\n try asBase._listExtensions() returns (address[] memory extensions) {\n assertEq(extensions.length, 2, \"market is missing an extension\");\n } catch {\n emit log(\"market that is not yet upgraded to the extensions upgrade\");\n emit log_address(address(market));\n emit log(\"implementation\");\n emit log_address(currentImpl);\n emit log(\"pool\");\n emit log_address(pools[i].comptroller);\n emit log(\"\");\n }\n }\n }\n }\n }\n\n function testPauseGuardiansBsc() public debuggingOnly fork(BSC_MAINNET) {\n _testPauseGuardians();\n }\n\n // TODO redeploy to polygon to fix\n function testPauseGuardiansPolygon() public debuggingOnly fork(POLYGON_MAINNET) {\n _testPauseGuardians();\n }\n\n function _testPauseGuardians() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n address deployer = ap.getAddress(\"deployer\");\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address pauseGuardian = pool.pauseGuardian();\n if (pauseGuardian != address(0) && pauseGuardian != deployer) {\n emit log_named_address(\"pool\", address(pool));\n emit log_named_address(\"unknown pause guardian\", pauseGuardian);\n emit log(\"\");\n }\n }\n }\n}\n" + }, + "contracts/test/DeployMarkets.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Test.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { IonicFlywheelDynamicRewardsPlugin } from \"../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol\";\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ICErc20, ICErc20Plugin, ICErc20PluginRewards } from \"../compound/CTokenInterfaces.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AuthoritiesRegistry } from \"../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport { MockPriceOracle } from \"../oracles/1337/MockPriceOracle.sol\";\nimport { MockERC4626 } from \"../ionic/strategies/MockERC4626.sol\";\nimport { MockERC4626Dynamic } from \"../ionic/strategies/MockERC4626Dynamic.sol\";\n\ncontract DeployMarketsTest is Test {\n MockERC20 underlyingToken;\n MockERC20 rewardToken;\n\n JumpRateModel interestModel;\n IonicComptroller comptroller;\n\n CErc20Delegate cErc20Delegate;\n CErc20PluginDelegate cErc20PluginDelegate;\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\n\n MockERC4626 mockERC4626;\n MockERC4626Dynamic mockERC4626Dynamic;\n\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicFlywheelDynamicRewardsPlugin rewards;\n\n address[] markets;\n bool[] t;\n bool[] f;\n IonicFlywheelCore[] flywheelsToClaim;\n\n function setUpBaseContracts() public {\n underlyingToken = new MockERC20(\"UnderlyingToken\", \"UT\", 18);\n rewardToken = new MockERC20(\"RewardToken\", \"RT\", 18);\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n }\n\n function setUpExtensions() public {\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = cErc20Delegate;\n cErc20DelegateExtensions[1] = new CTokenFirstExtension();\n ionicAdmin._setCErc20DelegateExtensions(address(0), cErc20DelegateExtensions);\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n\n cErc20DelegateExtensions[0] = cErc20PluginDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\n\n cErc20DelegateExtensions[0] = cErc20PluginRewardsDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\n\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginDelegate.delegateType(),\n address(cErc20PluginDelegate),\n abi.encode(address(0))\n );\n\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginRewardsDelegate.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0))\n );\n }\n\n function setUpPool() public {\n underlyingToken.mint(address(this), 100e36);\n\n MockPriceOracle priceOracle = new MockPriceOracle(10);\n Comptroller tempComptroller = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))),\n false,\n 0.1e18,\n 1.1e18,\n address(priceOracle)\n );\n\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n newAr.setUserRole(comptrollerAddress, address(ionicAdmin), poolAuth.SUPPLIER_ROLE(), true);\n }\n\n function setUp() public {\n setUpBaseContracts();\n setUpPool();\n setUpExtensions();\n vm.roll(1);\n }\n\n function testDeployCErc20Delegate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n require(cToken.mint(10e18) == 0, \"mint failed\");\n assertEq(cToken.totalSupply(), 10e18 * 5);\n assertEq(underlyingToken.balanceOf(address(cToken)), 10e18);\n }\n\n function testDeployCErc20PluginDelegate() public {\n mockERC4626 = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(mockERC4626),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(mockERC4626), \"!plugin == erc4626\");\n\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n cToken.mint(10e18);\n assertEq(cToken.totalSupply(), 10e18 * 5);\n assertEq(mockERC4626.balanceOf(address(cToken)), 10e18);\n assertEq(underlyingToken.balanceOf(address(mockERC4626)), 10e18);\n }\n\n function testDeployCErc20PluginRewardsDelegate() public {\n IonicFlywheelCore impl = new IonicFlywheelCore();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n IonicFlywheelCore flywheel = IonicFlywheelCore(address(proxy));\n flywheel.initialize(underlyingToken, IFlywheelRewards(address(0)), IFlywheelBooster(address(0)), address(this));\n IonicFlywheelCore asFlywheelCore = IonicFlywheelCore(address(flywheel));\n rewards = new IonicFlywheelDynamicRewardsPlugin(asFlywheelCore, 1);\n flywheel.setFlywheelRewards(rewards);\n\n mockERC4626Dynamic = new MockERC4626Dynamic(ERC20(address(underlyingToken)), asFlywheelCore);\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginRewardsDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(address(mockERC4626Dynamic), address(flywheel), address(underlyingToken)),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20PluginRewards cToken = ICErc20PluginRewards(address(allMarkets[allMarkets.length - 1]));\n\n flywheel.addStrategyForRewards(ERC20(address(cToken)));\n\n assertEq(address(cToken.plugin()), address(mockERC4626Dynamic), \"!plugin == erc4626\");\n assertEq(underlyingToken.allowance(address(cToken), address(mockERC4626Dynamic)), type(uint256).max);\n assertEq(underlyingToken.allowance(address(cToken), address(flywheel)), 0);\n\n cToken.approve(address(rewardToken), address(flywheel));\n assertEq(rewardToken.allowance(address(cToken), address(flywheel)), type(uint256).max);\n\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n cToken.mint(10000000);\n assertEq(cToken.totalSupply(), 10000000 * 5);\n assertEq(mockERC4626Dynamic.balanceOf(address(cToken)), 10000000);\n assertEq(underlyingToken.balanceOf(address(mockERC4626Dynamic)), 10000000);\n }\n\n function testAutoImplementationCErc20Delegate() public {\n mockERC4626 = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(mockERC4626),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(mockERC4626), \"!plugin == erc4626\");\n\n address implBefore = cToken.implementation();\n // just testing to replace the plugin delegate with the plugin rewards delegate\n ionicAdmin._setLatestCErc20Delegate(\n cToken.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0)) // should trigger use of latest implementation\n );\n\n // run the upgrade\n vm.prank(ionicAdmin.owner());\n ionicAdmin.autoUpgradePool(comptroller);\n\n address implAfter = cToken.implementation();\n\n assertEq(implBefore, address(cErc20PluginDelegate), \"the old impl should be the plugin delegate\");\n assertEq(implAfter, address(cErc20PluginRewardsDelegate), \"the new impl should be the plugin rewards delegate\");\n }\n\n function testAutoImplementationPlugin() public {\n MockERC4626 pluginA = new MockERC4626(ERC20(address(underlyingToken)));\n MockERC4626 pluginB = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(pluginA),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(pluginA), \"!plugin == erc4626\");\n\n address pluginImplBefore = address(cToken.plugin());\n ionicAdmin._setLatestPluginImplementation(address(pluginA), address(pluginB));\n ionicAdmin._upgradePluginToLatestImplementation(address(cToken));\n address pluginImplAfter = address(cToken.plugin());\n\n assertEq(pluginImplBefore, address(pluginA), \"the old impl should be the A plugin\");\n assertEq(pluginImplAfter, address(pluginB), \"the new impl should be the B plugin\");\n }\n\n function testAutoImplementationCErc20PluginDelegate() public {\n MockERC4626 pluginA = new MockERC4626(ERC20(address(underlyingToken)));\n MockERC4626 pluginB = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(pluginA),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(pluginA), \"!plugin == erc4626\");\n\n address pluginImplBefore = address(cToken.plugin());\n address implBefore = cToken.implementation();\n uint8 delegateType = cToken.delegateType();\n\n // just testing to replace the plugin delegate with the plugin rewards delegate\n ionicAdmin._setLatestCErc20Delegate(\n delegateType,\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0)) // should trigger use of latest implementation\n );\n ionicAdmin._setLatestPluginImplementation(address(pluginA), address(pluginB));\n\n // run the upgrade\n vm.prank(ionicAdmin.owner());\n ionicAdmin.autoUpgradePool(comptroller);\n\n address pluginImplAfter = address(cToken.plugin());\n address implAfter = cToken.implementation();\n\n assertEq(pluginImplBefore, address(pluginA), \"the old impl should be the A plugin\");\n assertEq(pluginImplAfter, address(pluginB), \"the new impl should be the B plugin\");\n assertEq(implBefore, address(cErc20PluginDelegate), \"the old impl should be the plugin delegate\");\n assertEq(implAfter, address(cErc20PluginRewardsDelegate), \"the new impl should be the plugin rewards delegate\");\n }\n\n function testInflateExchangeRate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n // mint just 2 wei\n underlyingToken.approve(address(cToken), 1e36);\n cToken.mint(2);\n assertEq(cToken.totalSupply(), 10);\n assertEq(underlyingToken.balanceOf(address(cToken)), 2, \"!total supply 2\");\n\n uint256 exchRateBefore = cToken.exchangeRateCurrent();\n emit log_named_uint(\"exch rate\", exchRateBefore);\n assertEq(exchRateBefore, 2e17, \"!default exch rate\");\n\n // donate\n underlyingToken.transfer(address(cToken), 1e36);\n\n uint256 exchRateAfter = cToken.exchangeRateCurrent();\n emit log_named_uint(\"exch rate after\", exchRateAfter);\n assertGt(exchRateAfter, 1e30, \"!inflated exch rate\");\n\n // the market should own 1e36 + 2 underlying assets\n assertEq(underlyingToken.balanceOf(address(cToken)), 1e36 + 2, \"!total underlying\");\n\n // 50% + 1\n uint256 errCode = cToken.redeemUnderlying(0.5e36 + 2);\n assertEq(errCode, 0, \"!redeem underlying\");\n\n assertEq(cToken.totalSupply(), 0, \"!should have redeemed all ctokens for 50% + 1 of the underlying\");\n }\n\n function testSupplyCapInflatedExchangeRate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n // mint 1e18\n underlyingToken.approve(address(cToken), 1e18);\n cToken.mint(1e18);\n assertEq(cToken.totalSupply(), 5 * 1e18, \"!total supply 5\");\n assertEq(underlyingToken.balanceOf(address(cToken)), 1e18, \"!market underlying balance 1\");\n\n (, , uint256 liqBefore, uint256 sfBefore) = comptroller.getAccountLiquidity(address(this));\n\n uint256[] memory caps = new uint256[](1);\n caps[0] = 25e18;\n ICErc20[] memory marketArray = new ICErc20[](1);\n marketArray[0] = cToken;\n vm.prank(comptroller.admin());\n comptroller._setMarketSupplyCaps(marketArray, caps);\n\n // donate 100e18\n underlyingToken.transfer(address(cToken), 100e18);\n assertEq(underlyingToken.balanceOf(address(cToken)), 101e18, \"!market balance 101\");\n assertEq(cToken.balanceOfUnderlying(address(this)), 101e18, \"!user balance 101\");\n\n (, , uint256 liqAfter, uint256 sfAfter) = comptroller.getAccountLiquidity(address(this));\n emit log_named_uint(\"liqBefore\", liqBefore);\n emit log_named_uint(\"liqAfter\", liqAfter);\n\n assertEq(liqAfter / liqBefore, 25, \"liquidity should increase only 25x\");\n }\n}\n" + }, + "contracts/test/DevTesting.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport \"./config/BaseTest.t.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\nimport { RedstoneAdapterPriceOracle } from \"../oracles/default/RedstoneAdapterPriceOracle.sol\";\nimport { RedstoneAdapterPriceOracleWrsETH } from \"../oracles/default/RedstoneAdapterPriceOracleWrsETH.sol\";\nimport { RedstoneAdapterPriceOracleWeETH } from \"../oracles/default/RedstoneAdapterPriceOracleWeETH.sol\";\nimport { MasterPriceOracle, BasePriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { LeveredPositionsLens } from \"../ionic/levered/LeveredPositionsLens.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { ILeveredPositionFactory } from \"../ionic/levered/ILeveredPositionFactory.sol\";\nimport { LeveredPositionFactoryFirstExtension } from \"../ionic/levered/LeveredPositionFactoryFirstExtension.sol\";\nimport { LeveredPositionFactorySecondExtension } from \"../ionic/levered/LeveredPositionFactorySecondExtension.sol\";\nimport { LeveredPositionFactory } from \"../ionic/levered/LeveredPositionFactory.sol\";\nimport { LeveredPositionStorage } from \"../ionic/levered/LeveredPositionStorage.sol\";\nimport { LeveredPosition } from \"../ionic/levered/LeveredPosition.sol\";\nimport { IonicFlywheelLensRouter, IonicComptroller, ICErc20, ERC20, IPriceOracle_IFLR } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AlgebraSwapLiquidator } from \"../liquidators/AlgebraSwapLiquidator.sol\";\nimport { AerodromeV2Liquidator } from \"../liquidators/AerodromeV2Liquidator.sol\";\nimport { AerodromeCLLiquidator } from \"../liquidators/AerodromeCLLiquidator.sol\";\nimport { CurveSwapLiquidator } from \"../liquidators/CurveSwapLiquidator.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\nimport { VelodromeV2Liquidator } from \"../liquidators/VelodromeV2Liquidator.sol\";\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport \"forge-std/console.sol\";\n\nstruct HealthFactorVars {\n uint256 usdcSupplied;\n uint256 wethSupplied;\n uint256 ezEthSuppled;\n uint256 stoneSupplied;\n uint256 wbtcSupplied;\n uint256 weEthSupplied;\n uint256 merlinBTCSupplied;\n uint256 usdcBorrowed;\n uint256 wethBorrowed;\n uint256 ezEthBorrowed;\n uint256 stoneBorrowed;\n uint256 wbtcBorrowed;\n uint256 weEthBorrowed;\n uint256 merlinBTCBorrowed;\n ICErc20 testCToken;\n address testUnderlying;\n uint256 amountBorrow;\n}\n\ncontract DevTesting is BaseTest {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLensSecondary lens2 = PoolLensSecondary(0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154);\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n LeveredPositionsLens levPosLens;\n\n address deployer = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address multisig = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2;\n\n ICErc20 wethMarket;\n ICErc20 usdcMarket;\n ICErc20 usdtMarket;\n ICErc20 wbtcMarket;\n ICErc20 ezEthMarket;\n ICErc20 stoneMarket;\n ICErc20 weEthMarket;\n ICErc20 merlinBTCMarket;\n\n // mode mainnet assets\n address WETH = 0x4200000000000000000000000000000000000006;\n address USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address USDT = 0xf0F161fDA2712DB8b566946122a5af183995e2eD;\n address WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF;\n address UNI = 0x3e7eF8f50246f725885102E8238CBba33F276747;\n address SNX = 0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3;\n address LINK = 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb;\n address DAI = 0xE7798f023fC62146e8Aa1b36Da45fb70855a77Ea;\n address BAL = 0xD08a2917653d4E460893203471f0000826fb4034;\n address AAVE = 0x7c6b91D9Be155A6Db01f749217d76fF02A7227F2;\n address weETH = 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A;\n address merlinBTC = 0x59889b7021243dB5B1e065385F918316cD90D46c;\n IERC20Upgradeable wsuperOETH = IERC20Upgradeable(0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6);\n IERC20Upgradeable superOETH = IERC20Upgradeable(0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == MODE_MAINNET) {\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdcMarket = ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n wbtcMarket = ICErc20(0xd70254C3baD29504789714A7c69d60Ec1127375C);\n ezEthMarket = ICErc20(0x59e710215d45F584f44c0FEe83DA6d43D762D857);\n stoneMarket = ICErc20(0x959FA710CCBb22c7Ce1e59Da82A247e686629310);\n weEthMarket = ICErc20(0xA0D844742B4abbbc43d8931a6Edb00C56325aA18);\n merlinBTCMarket = ICErc20(0x19F245782b1258cf3e11Eda25784A378cC18c108);\n ICErc20[] memory markets = pool.getAllMarkets();\n wethMarket = markets[0];\n usdcMarket = markets[1];\n } else {}\n levPosLens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function testModePoolBorrowers() public debuggingOnly fork(MODE_MAINNET) {\n emit log_named_array(\"borrowers\", pool.getAllBorrowers());\n }\n\n function testModeLiquidationShortfall() public debuggingOnly fork(MODE_MAINNET) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(\n 0xa75F9C8246f7269279bE4c969e7Bc6Eb619cC204\n );\n\n emit log_named_uint(\"err\", err);\n emit log_named_uint(\"collateralValue\", collateralValue);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n }\n\n function testModeHealthFactor() public debuggingOnly fork(MODE_MAINNET) {\n address rahul = 0x5A9e792143bf2708b4765C144451dCa54f559a19;\n\n uint256 wethSupplied = wethMarket.balanceOfUnderlying(rahul);\n uint256 usdcSupplied = usdcMarket.balanceOfUnderlying(rahul);\n uint256 usdtSupplied = usdtMarket.balanceOfUnderlying(rahul);\n uint256 wbtcSupplied = wbtcMarket.balanceOfUnderlying(rahul);\n // emit log_named_uint(\"wethSupplied\", wethSupplied);\n emit log_named_uint(\"usdcSupplied\", usdcSupplied);\n emit log_named_uint(\"usdtSupplied\", usdtSupplied);\n emit log_named_uint(\"wbtcSupplied\", wbtcSupplied);\n emit log_named_uint(\"value of wethSupplied\", wethSupplied * pool.oracle().getUnderlyingPrice(wethMarket));\n emit log_named_uint(\"value of usdcSupplied\", usdcSupplied * pool.oracle().getUnderlyingPrice(usdcMarket));\n emit log_named_uint(\"value of usdtSupplied\", usdtSupplied * pool.oracle().getUnderlyingPrice(usdtMarket));\n emit log_named_uint(\"value of wbtcSupplied\", wbtcSupplied * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n PoolLens newImpl = new PoolLens();\n // TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(lens)));\n // vm.prank(dpa.owner());\n // proxy.upgradeTo(address(newImpl));\n\n uint256 hf = newImpl.getHealthFactor(rahul, pool);\n\n emit log_named_uint(\"hf\", hf);\n }\n\n function testQuickHF() public debuggingOnly forkAtBlock(MODE_MAINNET, 11831371) {\n address rahul = 0xf1bAeb439b8eF5043E069af0C8C8145963ebc3f8;\n\n uint256 hf = lens.getHealthFactor(rahul, pool);\n uint256 hf2 = lens.getHealthFactor(rahul, IonicComptroller(0x8Fb3D4a94D0aA5D6EDaAC3Ed82B59a27f56d923a));\n\n emit log_named_uint(\"hf\", hf);\n emit log_named_uint(\"hf2\", hf2);\n }\n\n function testQuickLiquidation() public debuggingOnly forkAtBlock(MODE_MAINNET, 12018198) {\n address user = 0xf1bAeb439b8eF5043E069af0C8C8145963ebc3f8;\n address whale = 0xaaEd68a3875F6BDbD44f70418dd16082870De8A0;\n address borrowedAsset = 0x80137510979822322193FC997d400D5A6C747bf7;\n uint256 repayAmount = 1968810267461862;\n address collateralToSeizeCToken = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address borrowedAssetCToken = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310;\n\n IonicUniV3Liquidator uniV3liquidator = IonicUniV3Liquidator(payable(0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A));\n\n emit log_named_address(\"univ3liq\", address(uniV3liquidator));\n emit log_named_address(\"express relay\", address(uniV3liquidator.expressRelay()));\n\n vm.mockCall(\n address(uniV3liquidator.expressRelay()),\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(uniV3liquidator),\n abi.encode(user)\n ),\n abi.encode(true)\n );\n\n vm.startPrank(whale);\n ERC20(borrowedAsset).approve(address(uniV3liquidator), type(uint256).max);\n uniV3liquidator.safeLiquidate(user, repayAmount, ICErc20(borrowedAssetCToken), ICErc20(collateralToSeizeCToken), 0);\n vm.stopPrank();\n }\n\n function testQuickAssets() public debuggingOnly forkAtBlock(MODE_MAINNET, 12314870) {\n address user = 0x5BDB1Fb5d0F841f4eb88D537bED0DD674fA88D7c;\n IonicComptroller comptroller = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n IonicComptroller comptroller2 = IonicComptroller(0x8Fb3D4a94D0aA5D6EDaAC3Ed82B59a27f56d923a);\n\n uint256 hf = lens.getHealthFactor(user, comptroller);\n uint256 hf2 = lens.getHealthFactor(user, comptroller2);\n\n PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser(comptroller, user);\n PoolLens.PoolAsset[] memory assets2 = lens.getPoolAssetsByUser(comptroller2, user);\n\n emit log(\"<---------------------------------MAIN MARKETS--------------------------------->\");\n emit log_named_uint(\"hf\", hf);\n for (uint i; i < assets.length; i++) {\n emit log(\"====================================================\");\n emit log_named_string(\"name\", assets[i].underlyingName);\n emit log_named_address(\"ctoken\", assets[i].cToken);\n emit log_named_address(\"underlying\", assets[i].underlyingToken);\n emit log_named_uint(\"supplyBalance\", assets[i].supplyBalance);\n emit log_named_uint(\"borrowBalance\", assets[i].borrowBalance);\n emit log_named_uint(\"underlyingPrice\", assets[i].underlyingPrice);\n emit log_named_uint(\"exchange rate\", assets[i].exchangeRate);\n }\n\n emit log(\"<---------------------------------NATIVE MARKETS--------------------------------->\");\n emit log_named_uint(\"hf\", hf2);\n for (uint i; i < assets2.length; i++) {\n emit log(\"====================================================\");\n emit log_named_string(\"name\", assets2[i].underlyingName);\n emit log_named_address(\"ctoken\", assets2[i].cToken);\n emit log_named_address(\"underlying\", assets2[i].underlyingToken);\n emit log_named_uint(\"supplyBalance\", assets2[i].supplyBalance);\n emit log_named_uint(\"borrowBalance\", assets2[i].borrowBalance);\n emit log_named_uint(\"underlyingPrice\", assets2[i].underlyingPrice);\n }\n }\n\n function testNetAprMode() public debuggingOnly forkAtBlock(MODE_MAINNET, 8479829) {\n address user = 0x30D5047e839f079bDE1Ab16b34668f57391DacB3;\n int256 blocks = 30 * 24 * 365 * 60;\n IonicFlywheelLensRouter lensRouter = new IonicFlywheelLensRouter(\n PoolDirectory(0x39C353Cf9041CcF467A04d0e78B63d961E81458a)\n );\n int256 apr = lensRouter.getUserNetApr(user, blocks);\n\n emit log_named_int(\"apr\", apr);\n }\n\n function testModeUsdcBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(usdcMarket);\n }\n\n function testHypotheticalPosition() public debuggingOnly forkAtBlock(MODE_MAINNET, 8028296) {\n HealthFactorVars memory vars;\n\n address wolfy = 0x7d922bf0975424b3371074f54cC784AF738Dac0D;\n address usdcWhale = 0x70FF197c32E922700d3ff2483D250c645979855d;\n address wbtcWhale = 0xBD8CCf3ebE4CC2D57962cdC2756B143ce0135a6B;\n address wethWhale = 0xD746A2a6048C5D3AFF5766a8c4A0C8cFD2311745;\n\n address whale = wbtcWhale;\n vars.testCToken = wethMarket;\n vars.testUnderlying = WETH;\n vars.amountBorrow = 1e18 / 2;\n\n address[] memory cTokens = new address[](1);\n\n vm.startPrank(usdcWhale);\n ERC20(USDC).transfer(wolfy, ERC20(USDC).balanceOf(usdcWhale));\n vm.stopPrank();\n\n vm.startPrank(wbtcWhale);\n ERC20(WBTC).transfer(wolfy, ERC20(WBTC).balanceOf(wbtcWhale));\n vm.stopPrank();\n\n vm.startPrank(wethWhale);\n ERC20(WETH).transfer(wolfy, ERC20(WETH).balanceOf(wethWhale));\n vm.stopPrank();\n\n // emit log_named_uint(\"USDC balance\", ERC20(USDC).balanceOf(wolfy));\n // emit log_named_uint(\"WBTC balance\", ERC20(WBTC).balanceOf(wolfy));\n // emit log_named_uint(\"WETH balance\", ERC20(WETH).balanceOf(wolfy));\n\n vm.startPrank(wolfy);\n\n ERC20(USDC).approve(address(usdcMarket), ERC20(USDC).balanceOf(wolfy));\n usdcMarket.mint(ERC20(USDC).balanceOf(wolfy));\n cTokens[0] = address(usdcMarket);\n pool.enterMarkets(cTokens);\n\n ERC20(WBTC).approve(address(wbtcMarket), ERC20(WBTC).balanceOf(wolfy));\n wbtcMarket.mint(ERC20(WBTC).balanceOf(wolfy));\n cTokens[0] = address(wbtcMarket);\n pool.enterMarkets(cTokens);\n\n ERC20(WETH).approve(address(wethMarket), ERC20(WETH).balanceOf(wolfy));\n wethMarket.mint(ERC20(WETH).balanceOf(wolfy));\n cTokens[0] = address(wethMarket);\n pool.enterMarkets(cTokens);\n\n wethMarket.borrow(1e18);\n\n vm.stopPrank();\n\n vars.usdcSupplied = usdcMarket.balanceOfUnderlying(wolfy);\n vars.wethSupplied = wethMarket.balanceOfUnderlying(wolfy);\n vars.ezEthSuppled = ezEthMarket.balanceOfUnderlying(wolfy);\n vars.stoneSupplied = stoneMarket.balanceOfUnderlying(wolfy);\n vars.wbtcSupplied = wbtcMarket.balanceOfUnderlying(wolfy);\n vars.weEthSupplied = weEthMarket.balanceOfUnderlying(wolfy);\n vars.merlinBTCSupplied = merlinBTCMarket.balanceOfUnderlying(wolfy);\n\n vars.usdcBorrowed = usdcMarket.borrowBalanceCurrent(wolfy);\n vars.wethBorrowed = wethMarket.borrowBalanceCurrent(wolfy);\n vars.ezEthBorrowed = ezEthMarket.borrowBalanceCurrent(wolfy);\n vars.stoneBorrowed = stoneMarket.borrowBalanceCurrent(wolfy);\n vars.wbtcBorrowed = wbtcMarket.borrowBalanceCurrent(wolfy);\n vars.weEthBorrowed = weEthMarket.borrowBalanceCurrent(wolfy);\n vars.merlinBTCBorrowed = merlinBTCMarket.borrowBalanceCurrent(wolfy);\n\n emit log_named_uint(\"usdcSupplied\", vars.usdcSupplied);\n emit log_named_uint(\"wethSupplied\", vars.wethSupplied);\n emit log_named_uint(\"ezEthSupplied\", vars.ezEthSuppled);\n emit log_named_uint(\"stoneSupplied\", vars.stoneSupplied);\n emit log_named_uint(\"wbtcSupplied\", vars.wbtcSupplied);\n emit log_named_uint(\"weEthSupplied\", vars.weEthSupplied);\n emit log_named_uint(\"merlinBTCSupplied\", vars.merlinBTCSupplied);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"usdcBorrowed\", vars.usdcBorrowed);\n emit log_named_uint(\"wethBorrowed\", vars.wethBorrowed);\n emit log_named_uint(\"ezEthBorrowed\", vars.ezEthBorrowed);\n emit log_named_uint(\"stoneBorrowed\", vars.stoneBorrowed);\n emit log_named_uint(\"wbtcBorrowed\", vars.wbtcBorrowed);\n emit log_named_uint(\"weEthBorrowed\", vars.weEthBorrowed);\n emit log_named_uint(\"merlinBTCBorrowed\", vars.merlinBTCBorrowed);\n\n // emit log_named_uint(\"value of usdcSupplied\", vars.usdcSupplied * pool.oracle().getUnderlyingPrice(usdcMarket));\n // emit log_named_uint(\"value of wethSupplied\", vars.wethSupplied * pool.oracle().getUnderlyingPrice(wethMarket));\n // emit log_named_uint(\"value of ezEthSupplied\", vars.ezEthSuppled * pool.oracle().getUnderlyingPrice(ezEthMarket));\n // emit log_named_uint(\"value of stoneSupplied\", vars.stoneSupplied * pool.oracle().getUnderlyingPrice(stoneMarket));\n // emit log_named_uint(\"value of wbtcSupplied\", vars.wbtcSupplied * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n // emit log_named_uint(\"value of usdcBorrowed\", vars.usdcBorrowed * pool.oracle().getUnderlyingPrice(usdcMarket));\n // emit log_named_uint(\"value of wethBorrowed\", vars.wethBorrowed * pool.oracle().getUnderlyingPrice(wethMarket));\n // emit log_named_uint(\"value of ezEthBorrowed\", vars.ezEthBorrowed * pool.oracle().getUnderlyingPrice(ezEthMarket));\n // emit log_named_uint(\"value of stoneBorrowed\", vars.stoneBorrowed * pool.oracle().getUnderlyingPrice(stoneMarket));\n // emit log_named_uint(\"value of wbtcBorrowed\", vars.wbtcBorrowed * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n vm.startPrank(whale);\n ERC20(vars.testUnderlying).transfer(wolfy, ERC20(vars.testUnderlying).balanceOf(whale));\n vm.stopPrank();\n\n uint256 hf = lens.getHealthFactor(wolfy, pool);\n uint256 hypothetical = lens.getHealthFactorHypothetical(\n pool,\n wolfy,\n address(vars.testCToken),\n 0,\n 0,\n vars.amountBorrow\n );\n\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(wolfy);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"Collateral Value Before\", collateralValue);\n emit log_named_uint(\"Liquidity Before\", liquidity);\n emit log_named_uint(\"hf before\", hf);\n emit log_named_uint(\"hypothetical hf\", hypothetical);\n\n vm.startPrank(wolfy);\n ERC20(vars.testUnderlying).approve(address(vars.testCToken), vars.amountBorrow);\n vars.testCToken.repayBorrow(vars.amountBorrow);\n vm.stopPrank();\n\n uint256 hfAfter = lens.getHealthFactor(wolfy, pool);\n (err, collateralValue, liquidity, shortfall) = pool.getAccountLiquidity(wolfy);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"Collateral Value After\", collateralValue);\n emit log_named_uint(\"Liquidity After\", liquidity);\n emit log_named_uint(\"hf after\", hfAfter);\n emit log_named_uint(\"user balance after\", ERC20(vars.testUnderlying).balanceOf(wolfy));\n emit log_named_uint(\"new borrow balance after repay\", vars.testCToken.borrowBalanceCurrent(wolfy));\n }\n\n function testModeUsdtBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(usdtMarket);\n }\n\n function testModeWethBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(wethMarket);\n wethMarket.accrueInterest();\n _testModeBorrowCaps(wethMarket);\n }\n\n function _testModeBorrowCaps(ICErc20 market) internal {\n uint256 borrowCapUsdc = pool.borrowCaps(address(market));\n uint256 totalBorrowsCurrent = market.totalBorrowsCurrent();\n\n uint256 wethBorrowAmount = 154753148031252;\n console.log(\"borrowCapUsdc %e\", borrowCapUsdc);\n console.log(\"totalBorrowsCurrent %e\", totalBorrowsCurrent);\n console.log(\"new totalBorrowsCurrent %e\", totalBorrowsCurrent + wethBorrowAmount);\n }\n\n function testMarketMember() public debuggingOnly fork(MODE_MAINNET) {\n address rahul = 0x5A9e792143bf2708b4765C144451dCa54f559a19;\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint256 i = 0; i < markets.length; i++) {\n if (pool.checkMembership(rahul, markets[i])) {\n emit log(\"is a member\");\n } else {\n emit log(\"NOT a member\");\n }\n }\n }\n\n function testGetCashError() public debuggingOnly fork(MODE_MAINNET) {\n ICErc20 market = ICErc20(0x49950319aBE7CE5c3A6C90698381b45989C99b46);\n market.getCash();\n }\n\n function testWrsEthBalanceOfError() public debuggingOnly fork(MODE_MAINNET) {\n address wrsEthMarketAddress = 0x49950319aBE7CE5c3A6C90698381b45989C99b46;\n ERC20 wrsEth = ERC20(0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd);\n wrsEth.balanceOf(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n }\n\n function testModeRepay() public debuggingOnly fork(MODE_MAINNET) {\n address user = 0x1A3C4E9B49e4fc595fB7e5f723159bA73a9426e7;\n ICErc20 market = usdcMarket;\n ERC20 asset = ERC20(market.underlying());\n\n uint256 borrowBalance = market.borrowBalanceCurrent(user);\n emit log_named_uint(\"borrowBalance\", borrowBalance);\n\n vm.startPrank(user);\n asset.approve(address(market), borrowBalance);\n uint256 err = market.repayBorrow(borrowBalance / 2);\n\n emit log_named_uint(\"error\", err);\n }\n\n function testAssetsPrices() public debuggingOnly fork(MODE_MAINNET) {\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n emit log_named_uint(\"WETH price\", mpo.price(WETH));\n emit log_named_uint(\"USDC price\", mpo.price(USDC));\n emit log_named_uint(\"USDT price\", mpo.price(USDT));\n emit log_named_uint(\"UNI price\", mpo.price(UNI));\n emit log_named_uint(\"SNX price\", mpo.price(SNX));\n emit log_named_uint(\"LINK price\", mpo.price(LINK));\n emit log_named_uint(\"DAI price\", mpo.price(DAI));\n emit log_named_uint(\"BAL price\", mpo.price(BAL));\n emit log_named_uint(\"AAVE price\", mpo.price(AAVE));\n emit log_named_uint(\"WBTC price\", mpo.price(WBTC));\n }\n\n function testDeployedMarkets() public debuggingOnly fork(MODE_MAINNET) {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint8 i = 0; i < markets.length; i++) {\n emit log_named_address(\"market\", address(markets[i]));\n emit log(markets[i].symbol());\n emit log(markets[i].name());\n }\n }\n\n function testDisableCollateralUsdc() public debuggingOnly fork(MODE_MAINNET) {\n address user = 0xF70CBE91fB1b1AfdeB3C45Fb8CDD2E1249b5b75E;\n address usdcMarketAddr = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n\n vm.startPrank(user);\n\n uint256 borrowed = ICErc20(usdcMarketAddr).borrowBalanceCurrent(user);\n\n emit log_named_uint(\"borrowed\", borrowed);\n\n pool.exitMarket(usdcMarketAddr);\n }\n\n function testBorrowRateAtRatio() public debuggingOnly fork(MODE_MAINNET) {\n uint256 rate = levPosLens.getBorrowRateAtRatio(wethMarket, ezEthMarket, 9988992945501686, 2e18);\n emit log_named_uint(\"borrow rate at ratio\", rate);\n }\n\n function testAssetAsCollateralCap() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ezEthWhale = 0x2344F131B07E6AFd943b0901C55898573F0d1561;\n\n vm.startPrank(multisig);\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_EZETH,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic Renzo Restaked ETH\",\n \"ionezETH\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 ezEthMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(ezEthMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(ezEthMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(ezEthWhale);\n ERC20(MODE_EZETH).approve(address(ezEthMarket), 1e36);\n errCode = ezEthMarket.mint(1e18);\n require(errCode == 0, \"should be unable to supply\");\n }\n\n function testNewStoneMarketCapped() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_STONE = 0x80137510979822322193FC997d400D5A6C747bf7;\n address stoneWhale = 0x76486cbED5216C82d26Ee60113E48E06C189541A;\n\n address redstoneOracleAddress = 0x63A1531a06F0Ac597a0DfA5A516a37073c3E1e0a;\n RedstoneAdapterPriceOracle oracle = RedstoneAdapterPriceOracle(redstoneOracleAddress);\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(mpo.admin());\n mpo.add(asArray(MODE_STONE), oracles);\n\n vm.startPrank(multisig);\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_STONE,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic StakeStone Ether\",\n \"ionSTONE\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 stoneMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(stoneMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(stoneMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(stoneWhale);\n ERC20(MODE_STONE).approve(address(stoneMarket), 1e36);\n vm.expectRevert(\"not authorized\");\n errCode = stoneMarket.mint(1e18);\n //require(errCode != 0, \"should be unable to supply\");\n }\n\n function testRegisterSFS() public debuggingOnly fork(MODE_MAINNET) {\n emit log_named_address(\"pool admin\", pool.admin());\n\n vm.startPrank(multisig);\n pool.registerInSFS();\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint8 i = 0; i < markets.length; i++) {\n markets[i].registerInSFS();\n }\n }\n\n function upgradePool() internal {\n ComptrollerFirstExtension newComptrollerExtension = new ComptrollerFirstExtension();\n\n Unitroller asUnitroller = Unitroller(payable(address(pool)));\n\n // upgrade to the new comptroller extension\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(newComptrollerExtension, DiamondExtension(asUnitroller._listExtensions()[1]));\n\n //asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function testModeBorrowRate() public fork(MODE_MAINNET) {\n //ICErc20[] memory markets = pool.getAllMarkets();\n\n IonicComptroller pool = ezEthMarket.comptroller();\n vm.prank(pool.admin());\n ezEthMarket._setInterestRateModel(JumpRateModel(0x413aD59b80b1632988d478115a466bdF9B26743a));\n\n JumpRateModel discRateModel = JumpRateModel(ezEthMarket.interestRateModel());\n\n uint256 borrows = 200e18;\n uint256 cash = 5000e18 - borrows;\n uint256 reserves = 1e18;\n uint256 rate = discRateModel.getBorrowRate(cash, borrows, reserves);\n\n emit log_named_uint(\"rate per year %e\", rate * discRateModel.blocksPerYear());\n }\n\n function testModeFetchBorrowers() public fork(MODE_MAINNET) {\n // address[] memory borrowers = pool.getAllBorrowers();\n // emit log_named_uint(\"borrowers.len\", borrowers.length);\n\n //upgradePool();\n\n (uint256 totalPages, address[] memory borrowersPage) = pool.getPaginatedBorrowers(1, 0);\n\n emit log_named_uint(\"total pages with 300 size (default)\", totalPages);\n\n (totalPages, borrowersPage) = pool.getPaginatedBorrowers(totalPages - 1, 50);\n emit log_named_array(\"last page of 300 borrowers\", borrowersPage);\n\n (totalPages, borrowersPage) = pool.getPaginatedBorrowers(1, 50);\n emit log_named_uint(\"total pages with 50 size\", totalPages);\n emit log_named_array(\"page of 50 borrowers\", borrowersPage);\n\n // for (uint256 i = 0; i < borrowers.length; i++) {\n // (\n // uint256 error,\n // uint256 collateralValue,\n // uint256 liquidity,\n // uint256 shortfall\n // ) = pool.getAccountLiquidity(borrowers[i]);\n //\n // emit log(\"\");\n // emit log_named_address(\"user\", borrowers[i]);\n // emit log_named_uint(\"collateralValue\", collateralValue);\n // if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n // if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n // }\n }\n\n function testModeAccountLiquidity() public debuggingOnly fork(MODE_MAINNET) {\n _testAccountLiquidity(0x0C387030a5D3AcDcde1A8DDaF26df31BbC1CE763);\n }\n\n function _testAccountLiquidity(address borrower) internal {\n (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(borrower);\n\n emit log(\"\");\n emit log_named_address(\"user\", borrower);\n emit log_named_uint(\"collateralValue\", collateralValue);\n if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n }\n\n function testModeDeployMarket() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_WEETH = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n address weEthWhale = 0x6e55a90772B92f17f87Be04F9562f3faafd0cc38;\n\n vm.startPrank(pool.admin());\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_WEETH,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic Wrapped eETH\",\n \"ionweETH\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 weEthMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(weEthMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(weEthMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(weEthWhale);\n ERC20(MODE_WEETH).approve(address(weEthMarket), 1e36);\n errCode = weEthMarket.mint(0.01e18);\n require(errCode == 0, \"should be unable to supply\");\n }\n\n function testModeWrsETH() public debuggingOnly forkAtBlock(MODE_MAINNET, 6635923) {\n address wrsEth = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\n RedstoneAdapterPriceOracleWrsETH oracle = new RedstoneAdapterPriceOracleWrsETH(\n 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256\n );\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(multisig);\n mpo.add(asArray(wrsEth), oracles);\n\n uint256 price = mpo.price(wrsEth);\n emit log_named_uint(\"price of wrsEth\", price);\n }\n\n function testModeWeETH() public debuggingOnly forkAtBlock(MODE_MAINNET, 6861468) {\n address weEth = 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A;\n RedstoneAdapterPriceOracleWeETH oracle = new RedstoneAdapterPriceOracleWeETH(\n 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256\n );\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(multisig);\n mpo.add(asArray(weEth), oracles);\n\n uint256 price = mpo.price(weEth);\n emit log_named_uint(\"price of weEth\", price);\n assertEq(price, 1036212437077011599);\n }\n\n function testPERLiquidation() public debuggingOnly forkAtBlock(MODE_MAINNET, 10255413) {\n vm.prank(0x5Cc070844E98F4ceC5f2fBE1592fB1ed73aB7b48);\n _functionCall(\n 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A,\n hex\"20b72325000000000000000000000000f28570694a6c9cd0494955966ae75af61abf5a0700000000000000000000000000000000000000000000000001bc1214ed792fbb0000000000000000000000004341620757bee7eb4553912fafc963e59c949147000000000000000000000000c53edeafb6d502daec5a7015d67936cea0cd0f520000000000000000000000000000000000000000000000000000000000000000\",\n \"error in call\"\n );\n }\n\n function testCtokenUpgrade() public debuggingOnly forkAtBlock(MODE_MAINNET, 10255413) {\n CErc20PluginRewardsDelegate newImpl = new CErc20PluginRewardsDelegate();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(wethMarket)));\n\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = PoolDirectory(\n 0x39C353Cf9041CcF467A04d0e78B63d961E81458a\n ).getActivePools();\n\n emit log_named_uint(\"First Pool ID\", poolIds[0]);\n emit log_named_uint(\"First Pool ID\", poolIds[1]);\n emit log_named_string(\"First Pool Address\", pools[0].name);\n emit log_named_string(\"First Pool Address\", pools[0].name);\n emit log_named_address(\"First Pool Address\", pools[0].creator);\n emit log_named_address(\"First Pool Address\", pools[1].creator);\n emit log_named_address(\"First Pool Address\", pools[0].comptroller);\n emit log_named_address(\"First Pool Address\", pools[1].comptroller);\n //bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\n //address admin = address(uint160(uint256(bytesAtSlot)));\n //vm.prank(admin);\n //proxy.upgradeTo(address(newImpl));\n\n //vm.prank(dpa.owner());\n //proxy.upgradeTo(address(newImpl));\n }\n\n function testAerodromeV2Liquidator() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n AerodromeV2Liquidator liquidator = new AerodromeV2Liquidator();\n IERC20Upgradeable hyUSD = IERC20Upgradeable(0xCc7FF230365bD730eE4B352cC2492CEdAC49383e);\n IERC20Upgradeable eUSD = IERC20Upgradeable(0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4);\n IERC20Upgradeable usdc = IERC20Upgradeable(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);\n address hyusdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address usdcWhale = 0xaac391f166f33CdaEfaa4AfA6616A3BEA66B694d;\n address eusdWhale = 0xEE8Bd6594E046d72D592ac0e278E3CA179b8f189;\n address aerodromeV2Router = 0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43;\n\n vm.startPrank(eusdWhale);\n eUSD.transfer(address(liquidator), 1000 ether);\n IRouter_Aerodrome.Route[] memory path = new IRouter_Aerodrome.Route[](1);\n path[0] = IRouter_Aerodrome.Route({\n from: address(eUSD),\n to: address(usdc),\n stable: true,\n factory: 0x420DD381b31aEf6683db6B902084cB0FFECe40Da\n });\n liquidator.redeem(eUSD, 1000 ether, abi.encode(aerodromeV2Router, path));\n emit log_named_uint(\"usdc received\", usdc.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidator() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n AerodromeCLLiquidator liquidator = new AerodromeCLLiquidator();\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address superOETHWhale = 0xF1010eE787Ee588766b441d7cC397b40DdFB17a3;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n vm.startPrank(superOETHWhale);\n superOETH.transfer(address(liquidator), 1 ether);\n liquidator.redeem(superOETH, 1 ether, abi.encode(address(superOETH), address(weth), int24(1), aerodromeCLRouter));\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidatorWrap() public debuggingOnly forkAtBlock(BASE_MAINNET, 20203998) {\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address wethWhale = 0x751b77C43643a63362Ab024d466fcC1d75354295;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n AerodromeCLLiquidator liquidator = AerodromeCLLiquidator(0xb50De36105F6053006306553AB54e77224818B9B);\n\n vm.startPrank(wethWhale);\n weth.transfer(address(liquidator), 1 ether);\n liquidator.redeem(\n weth,\n 1 ether,\n abi.encode(address(weth), address(wsuperOETH), aerodromeCLRouter, address(0), address(superOETH), 1)\n );\n emit log_named_uint(\"wsuperOETH received\", wsuperOETH.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidatorUnwrap() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address wsuperOethWhale = 0x0EEaCD4c475040463389d15EAd034d1291b008b1;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n AerodromeCLLiquidator liquidator = new AerodromeCLLiquidator();\n\n vm.startPrank(wsuperOethWhale);\n wsuperOETH.transfer(address(liquidator), 1 ether);\n liquidator.redeem(\n wsuperOETH,\n 1 ether,\n abi.encode(address(wsuperOETH), address(weth), aerodromeCLRouter, address(superOETH), address(0), 1)\n );\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testCurveSwapLiquidatorUSDCtowUSDM() public debuggingOnly forkAtBlock(BASE_MAINNET, 20237792) {\n address _pool = 0x63Eb7846642630456707C3efBb50A03c79B89D81;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address usdm = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\n address wUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812;\n address usdcWhale = 0x134575ff75F9882ca905EE1D78C9340C091d6056;\n CurveV2LpTokenPriceOracleNoRegistry oracle = new CurveV2LpTokenPriceOracleNoRegistry();\n CurveSwapLiquidator liquidator = new CurveSwapLiquidator();\n vm.prank(oracle.owner());\n oracle.registerPool(_pool, _pool);\n vm.prank(usdcWhale);\n IERC20Upgradeable(usdc).transfer(address(liquidator), 100e6);\n liquidator.redeem(IERC20Upgradeable(usdc), 100e6, abi.encode(oracle, wUSDM, address(0), usdm));\n emit log_named_uint(\"wUSDM received\", IERC20Upgradeable(wUSDM).balanceOf(address(liquidator)));\n }\n\n function testCurveSwapLiquidatorwUSDMtoUSDC() public debuggingOnly forkAtBlock(BASE_MAINNET, 20237792) {\n address _pool = 0x63Eb7846642630456707C3efBb50A03c79B89D81;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address usdm = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\n address wUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812;\n address wusdmWhale = 0x9b8b04B6f82cD5e1dae58cA3614d445F93DeFc5c;\n CurveV2LpTokenPriceOracleNoRegistry oracle = new CurveV2LpTokenPriceOracleNoRegistry();\n CurveSwapLiquidator liquidator = new CurveSwapLiquidator();\n vm.prank(oracle.owner());\n oracle.registerPool(_pool, _pool);\n\n vm.startPrank(wusdmWhale);\n IERC20Upgradeable(wUSDM).transfer(address(liquidator), 30 ether);\n liquidator.redeem(IERC20Upgradeable(wUSDM), 30 ether, abi.encode(oracle, usdc, usdm, address(0)));\n emit log_named_uint(\"usdc received\", IERC20Upgradeable(usdc).balanceOf(address(liquidator)));\n }\n\n function testKimLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 13579406) {\n address weth = 0x4200000000000000000000000000000000000006;\n address usdc = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address kimRouter = 0xAc48FcF1049668B285f3dC72483DF5Ae2162f7e8;\n address wethWhale = 0xe9b14a1Be94E70900EDdF1E22A4cB8c56aC9e10a;\n AlgebraSwapLiquidator liquidator = AlgebraSwapLiquidator(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\n vm.startPrank(wethWhale);\n IERC20Upgradeable(weth).transfer(address(liquidator), 2018770577362160);\n liquidator.redeem(IERC20Upgradeable(weth), 2018770577362160, abi.encode(usdc, kimRouter));\n emit log_named_uint(\"usdc received\", IERC20Upgradeable(usdc).balanceOf(address(liquidator)));\n }\n\n function testVelodromeV2Liquidator_mode_usdcToWeth() public debuggingOnly forkAtBlock(MODE_MAINNET, 13881743) {\n VelodromeV2Liquidator liquidator = new VelodromeV2Liquidator();\n IERC20Upgradeable usdc = IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f);\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address usdcWhale = 0xFd1D36995d76c0F75bbe4637C84C06E4A68bBB3a;\n\n address veloRouter = 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45;\n\n vm.startPrank(usdcWhale);\n usdc.transfer(address(liquidator), 1000 * 10e6);\n IRouter_Velodrome.Route[] memory path = new IRouter_Velodrome.Route[](1);\n path[0] = IRouter_Velodrome.Route({ from: address(usdc), to: address(weth), stable: false });\n liquidator.redeem(usdc, 1000 * 10e6, abi.encode(veloRouter, path));\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testVelodromeV2Liquidator_mode_wethToUSDC() public debuggingOnly forkAtBlock(MODE_MAINNET, 13881743) {\n VelodromeV2Liquidator liquidator = new VelodromeV2Liquidator();\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n IERC20Upgradeable usdc = IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f);\n address wethWhale = 0xe9b14a1Be94E70900EDdF1E22A4cB8c56aC9e10a;\n\n address veloRouter = 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45;\n\n vm.startPrank(wethWhale);\n weth.transfer(address(liquidator), 1 ether);\n IRouter_Velodrome.Route[] memory path = new IRouter_Velodrome.Route[](1);\n path[0] = IRouter_Velodrome.Route({ from: address(weth), to: address(usdc), stable: false });\n\n liquidator.redeem(weth, 1 ether, abi.encode(veloRouter, path));\n emit log_named_uint(\"usdc received\", usdc.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function test_claimRewardFromLeveredPosition() public debuggingOnly fork(BASE_MAINNET) {\n LeveredPosition position = LeveredPosition(\n 0x3a0eA2C577b0e0f2CAaEcC2b8fF8fF1850267ba2 // 20 days old\n );\n ILeveredPositionFactory factory = position.factory();\n\n vm.prank(address(factory));\n LeveredPosition dummy = new LeveredPosition(\n msg.sender,\n ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3),\n ICErc20(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0)\n );\n emit log_named_address(\"dummy\", address(dummy));\n\n vm.startPrank(factory.owner());\n DiamondBase(address(factory))._registerExtension(\n new LeveredPositionFactoryFirstExtension(),\n DiamondExtension(0x115455f15ef67e298F012F225B606D3c4Daa1d60)\n );\n factory._setPositionsExtension(LeveredPosition.claimRewardsFromRouter.selector, address(dummy));\n vm.stopPrank();\n\n {\n // mock the usdz call\n vm.mockCall(\n 0x04D5ddf5f3a8939889F11E97f8c4BB48317F1938,\n abi.encodeWithSelector(IERC20Upgradeable.balanceOf.selector),\n abi.encode(53307671999615298341926)\n );\n }\n\n vm.startPrank(0xC13110d04f22ed464Cb72A620fF8163585358Ff9);\n (address[] memory rewardTokens, uint256[] memory rewards) = position.claimRewardsFromRouter(\n 0xB1402333b12fc066C3D7F55d37944D5e281a3e8B\n );\n emit log_named_uint(\"reward tokens\", rewardTokens.length);\n emit log_named_uint(\"rewards\", rewards.length);\n vm.stopPrank();\n }\n\n function test_liquidateWithAggregator() public debuggingOnly forkAtBlock(MODE_MAINNET, 15435970) {\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(0x50F13EC4B68c9522260d3ccd4F19826679B3Ce5C));\n emit log_named_address(\"liquidator\", address(liquidator));\n address cErc20 = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18; // weEth\n address cTokenCollateral = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038; // usdc\n uint256 repayAmount = 843900759317990;\n address borrower = 0x1Bec4f239F1Ec11FD8DC7B31A8fea7A5bA5a9Aa4;\n address aggregatorTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE; // lifi\n // 0xd988097fb8612cc24eeC14542bC03424c656005f usdc\n // 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A weeth\n bytes memory aggregatorData = vm.parseBytes(\n \"0x4666fc800d27477c9a16fe2929353656c1222839791dbe26e815e7533f731ea9a6b919bb00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000050f13ec4b68c9522260d3ccd4f19826679b3ce5c0000000000000000000000000000000000000000000000000002ff85fb26dbe8000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000007e15eb462cdc67cf92af1f7102465a8f8c7848740000000000000000000000007e15eb462cdc67cf92af1f7102465a8f8c784874000000000000000000000000d988097fb8612cc24eec14542bc03424c656005f00000000000000000000000004c0599ae5a44757c0af6f9ec3b93da8976c150a000000000000000000000000000000000000000000000000000000000027891800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000f283bd37f90001d988097fb8612cc24eec14542bc03424c656005f000104c0599ae5a44757c0af6f9ec3b93da8976c150a0327891807030361590977620147ae00019b57dca972db5d8866c630554acdbdfe58b2659c000000011231deb6f5749ef6ce6943a275a1d3e7486f4eae59725ade04010205000601020203000205000100010400ff0000000000000000000000000053e85d00f2c6578a1205b842255ab9df9d05374425ba258e510faca5ab7ff941a1584bdd2174c94dd988097fb8612cc24eec14542bc03424c656005f4200000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000\"\n );\n\n emit log_named_uint(\n \"before collateral\",\n IERC20Upgradeable(ICErc20(cTokenCollateral).underlying()).balanceOf(address(this))\n );\n emit log_named_uint(\"before borrow\", IERC20Upgradeable(ICErc20(cErc20).underlying()).balanceOf(address(this)));\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidator.safeLiquidateWithAggregator(\n borrower,\n repayAmount,\n ICErc20(cErc20),\n ICErc20(cTokenCollateral),\n aggregatorTarget,\n aggregatorData\n );\n vm.stopPrank();\n\n emit log_named_uint(\n \"profit collateral\",\n IERC20Upgradeable(ICErc20(cTokenCollateral).underlying()).balanceOf(address(this))\n );\n emit log_named_uint(\"profit borrow\", IERC20Upgradeable(ICErc20(cErc20).underlying()).balanceOf(address(this)));\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testRawCall() public debuggingOnly forkAtBlock(BASE_MAINNET, 20569373) {\n address caller = 0xC13110d04f22ed464Cb72A620fF8163585358Ff9;\n address target = 0x180272dDf5767C771b3a8d37A2DC6cA507aaa1d9;\n\n ILeveredPositionFactory factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n ILiquidatorsRegistry registry = factory.liquidatorsRegistry();\n\n AerodromeCLLiquidator aerodomeClLiquidator = new AerodromeCLLiquidator();\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(WETH);\n IERC20Upgradeable outputToken = wsuperOETH;\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategy(aerodomeClLiquidator, inputToken, outputToken);\n registry._setRedemptionStrategy(aerodomeClLiquidator, outputToken, inputToken);\n vm.stopPrank();\n\n bytes memory data = hex\"c393d0e3\";\n vm.prank(caller);\n _functionCall(target, data, \"raw call failed\");\n\n uint256 superOETHBalance = superOETH.balanceOf(target);\n emit log_named_uint(\"balance of levered position\", superOETHBalance);\n }\n}\n" + }, + "contracts/test/EmissionsManager/EmissionsManagerTest.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"../config/BaseTest.t.sol\";\nimport \"../../EmissionsManager.sol\";\nimport \"../../PoolDirectory.sol\";\nimport \"./mocks/MockVeION.sol\";\nimport \"./mocks/MockPoolDirectory.sol\";\nimport \"./mocks/MockIonicComptroller.sol\";\nimport \"./mocks/MockOracle.sol\";\nimport \"./mocks/MockIonicFlywheelCore.sol\";\nimport \"./mocks/MockICErc20.sol\";\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../../veION/interfaces/IveION.sol\";\n\ncontract EmissionsManagerTest is BaseTest {\n MockPoolDirectory poolDirectory;\n MockIonicComptroller comptroller;\n MockICErc20 mockAsset;\n MockVeION mockVeION;\n MockOracle oracle;\n MockIonicFlywheelCore ionicFlywheelCore;\n\n EmissionsManager emissionsManager;\n MockERC20 rewardToken;\n\n address user = address(0x123);\n address reporter = address(0x124);\n address flywheelRewards = address(0x125);\n address protocolAddress = address(0x456);\n uint256 collateralBp = 250; // Example value\n bytes nonBlacklistableBytecode = hex\"deadbeef\";\n\n function setUp() public {\n mockAsset = new MockICErc20();\n mockAsset.setBalanceOfUnderlying(user, 1e18);\n\n oracle = new MockOracle();\n oracle.setUnderlyingPrice(ICErc20(address(mockAsset)), 100);\n\n // Deploy a mock ERC20 reward token\n //rewardToken = new MockERC20();\n rewardToken = new MockERC20(\"ION\", \"ION\", 18);\n\n // Deploy the IonicFlywheelCore mock\n ionicFlywheelCore = new MockIonicFlywheelCore();\n ionicFlywheelCore.setRewardToken(address(rewardToken));\n\n // Deploy the Comptroller mock\n comptroller = new MockIonicComptroller();\n comptroller.setAssetsIn(address(mockAsset));\n comptroller.setOracle(address(oracle));\n comptroller.setFlywheel(address(ionicFlywheelCore));\n\n // Deploy the PoolDirectory mock\n poolDirectory = new MockPoolDirectory();\n poolDirectory.setActivePools(address(comptroller));\n\n emissionsManager = EmissionsManager(\n address(\n new TransparentUpgradeableProxy(\n address(new EmissionsManager()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n emissionsManager.initialize.selector,\n PoolDirectory(address(poolDirectory)),\n protocolAddress,\n rewardToken,\n collateralBp,\n nonBlacklistableBytecode\n )\n )\n )\n );\n mockVeION = new MockVeION();\n mockVeION.setMockTotalEthValueOfTokens(user, 1);\n emissionsManager.setVeIon(IveION(address(mockVeION)));\n }\n\n function test_Initialize() public {\n assertEq(emissionsManager.protocolAddress(), protocolAddress, \"Protocol address mismatch\");\n\n assertEq(emissionsManager.collateralBp(), collateralBp, \"Collateral basis points mismatch\");\n\n assertEq(address(emissionsManager.rewardToken()), address(rewardToken), \"Reward token mismatch\");\n }\n\n function test_setVeIon_OwnerCanSetVeIonAddress() public {\n IveION veIONMock = IveION(address(new MockVeION()));\n\n emissionsManager.setVeIon(veIONMock);\n\n assertEq(address(emissionsManager.veION()), address(veIONMock), \"veION address mismatch\");\n }\n\n function test_setCollateralBp_OwnerCanSetCollateralBp() public {\n uint256 newCollateralBp = 2_500;\n\n emissionsManager.setCollateralBp(newCollateralBp);\n\n assertEq(emissionsManager.collateralBp(), newCollateralBp, \"Collateral basis points not updated\");\n }\n\n function test_setNonBlacklistableAddress_OwnerCanSetNonBlacklistableAddress() public {\n emissionsManager.setNonBlacklistableAddress(user, true);\n\n assertTrue(emissionsManager.nonBlacklistable(user), \"User should be non-blacklistable\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n assertFalse(emissionsManager.nonBlacklistable(user), \"User should be blacklistable\");\n }\n\n function test_setNonBlacklistableTargetBytecode_OwnerCanSetNonBlacklistableTargetBytecode() public {\n bytes memory bytecode = hex\"deadbeef\";\n\n emissionsManager.setNonBlacklistableTargetBytecode(bytecode);\n\n assertEq(emissionsManager.nonBlacklistableTargetBytecode(), bytecode, \"Non-blacklistable target bytecode mismatch\");\n }\n\n function test_reportUser_ReporterCanReportUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n emissionsManager.setNonBlacklistableAddress(user, false);\n assertEq(rewardToken.balanceOf(address(ionicFlywheelCore)), 0);\n\n ionicFlywheelCore.setFlywheelRewards(flywheelRewards);\n rewardToken.mint(flywheelRewards, 1e18);\n vm.prank(flywheelRewards);\n rewardToken.approve(address(ionicFlywheelCore), 1e18);\n\n assertEq(rewardToken.balanceOf(flywheelRewards), 1e18);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n assertEq(rewardToken.balanceOf(flywheelRewards), 0);\n assertEq(rewardToken.balanceOf(reporter), 8e17);\n assertEq(rewardToken.balanceOf(protocolAddress), 2e17);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n }\n\n function test_reportUser_ReporterCantReportUserWithLPBalanceAboveThreshold() public {\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n vm.prank(reporter);\n vm.expectRevert(\"LP balance above threshold\");\n emissionsManager.reportUser(user);\n }\n\n function test_reportUser_ReporterCantReportAlreadyBlacklistedUser() public {\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n vm.prank(reporter);\n vm.expectRevert(\"Already blacklisted\");\n emissionsManager.reportUser(user);\n }\n\n function test_reportUser_ReporterCantReportNonBlacklistableBytecode() public {\n emissionsManager.setNonBlacklistableTargetBytecode(address(mockAsset).code);\n\n vm.prank(reporter);\n vm.expectRevert(\"Non-blacklistable bytecode\");\n emissionsManager.reportUser(address(mockAsset));\n }\n\n function test_reportUser_ReporterCantReportNonBlacklistableUser() public {\n emissionsManager.setNonBlacklistableAddress(user, true);\n\n vm.prank(reporter);\n vm.expectRevert(\"Non-blacklistable user\");\n emissionsManager.reportUser(user);\n }\n\n function test_whitelistUser_ReporterCanWhitelistBlacklistedUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n emissionsManager.whitelistUser(user);\n\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should be whitelisted\");\n }\n\n function test_whitelistUser_ReporterCantWhitelistUserWithLpBalanceBelowThreshold() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n vm.expectRevert(\"LP balance below threshold\");\n emissionsManager.whitelistUser(user);\n }\n\n function test_whitelistUser_ReporterCantWhitelistAlreadyWhitelistedUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n emissionsManager.whitelistUser(user);\n\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should be whitelisted\");\n\n vm.expectRevert(\"Already whitelisted\");\n emissionsManager.whitelistUser(user);\n }\n}\n" + }, + "contracts/test/EmissionsManager/mocks/MockICErc20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ncontract MockICErc20 {\n mapping(address => uint256) public balances;\n\n\n function setBalanceOfUnderlying(address _user, uint256 _balance) public {\n balances[_user] = _balance;\n }\n function balanceOfUnderlying(address _user) public view returns (uint256) {\n return balances[_user];\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicComptroller.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { IonicFlywheelCore } from \"../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\ncontract MockIonicComptroller {\n address public oracle;\n address public asset;\n address public flywheel;\n\n // Allows setting mock eth values for testing purposes\n function setOracle(address _oracle) external {\n oracle = _oracle;\n }\n\n function setAssetsIn(address _asset) external {\n asset = _asset;\n }\n\n function setFlywheel(address _flywheel) external {\n flywheel = _flywheel;\n }\n function getAssetsIn(address _user) public view returns (ICErc20[] memory) {\n ICErc20[] memory assets = new ICErc20[](1); \n assets[0] = ICErc20(asset); \n return assets;\n }\n\n function getAllMarkets() public view returns (ICErc20[] memory) {\n ICErc20[] memory assets = new ICErc20[](1); \n assets[0] = ICErc20(asset); \n return assets;\n }\n\n function getAccruingFlywheels() public view returns (IonicFlywheelCore[] memory) {\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](1); \n flywheels[0] = IonicFlywheelCore(flywheel); \n return flywheels;\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\n\ncontract MockIonicFlywheelCore {\n using SafeTransferLib for ERC20;\n\n address public rewardToken;\n address public flywheelRewards;\n function setRewardToken(address _rewardToken) public {\n rewardToken = _rewardToken;\n }\n\n function setFlywheelRewards(address _flywheelRewards) public {\n flywheelRewards = _flywheelRewards;\n }\n\n function updateBlacklistBalances(ERC20 _market, address _user) external {}\n\n function accrue(ERC20 _market, address _user) public returns (uint256) {\n return 0;\n }\n\n function takeRewardsFromUser(address _user, address _receiver) external { \n uint256 balance = ERC20(rewardToken).balanceOf(address(flywheelRewards));\n ERC20(rewardToken).safeTransferFrom(address(flywheelRewards), _receiver, balance);\n }\n function whitelistUser(ERC20 strategy, address user) external {}\n\n}" + }, + "contracts/test/EmissionsManager/mocks/MockOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\ncontract MockOracle {\n mapping(ICErc20 => uint256) public prices;\n\n function setUnderlyingPrice(ICErc20 _tokenAddress, uint256 _price) public {\n prices[_tokenAddress] = _price;\n }\n function getUnderlyingPrice(ICErc20 _tokenAddress) public view returns (uint256) {\n return prices[_tokenAddress];\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockPoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nstruct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n}\n\ncontract MockPoolDirectory {\n\n Pool[] public pools;\n\n // Allows setting mock eth values for testing purposes\n function setActivePools(address comptroller) external {\n Pool memory pool = Pool(\"Test Pool\", msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n }\n\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory activeIds = new uint256[](1);\n Pool[] memory activePools = new Pool[](1);\n activePools[0] = pools[0];\n return (activeIds, activePools);\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockVeION.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ncontract MockVeION /* is */ {\n mapping(address => uint256) public ethValues;\n\n // Allows setting mock eth values for testing purposes\n function setMockTotalEthValueOfTokens(address _owner, uint256 _value) external {\n ethValues[_owner] = _value;\n }\n\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\n return ethValues[_owner];\n }\n}" + }, + "contracts/test/ExtensionsTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\n\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract MockComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getFirstMarketSymbol() public view returns (string memory) {\n return allMarkets[0].symbol();\n }\n\n function _setTransferPaused(bool) public returns (bool) {\n return false;\n }\n\n function _setSeizePaused(bool) public returns (bool) {\n return false;\n }\n\n // a dummy fn to test if the replacement of extension fns works\n function getSecondMarketSymbol() public view returns (string memory) {\n return allMarkets[1].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 4;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\n functionSelectors[--fnsCount] = this.getFirstMarketSymbol.selector;\n functionSelectors[--fnsCount] = this.getSecondMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract MockSecondComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getThirdMarketSymbol() public view returns (string memory) {\n return allMarkets[2].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 1;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getThirdMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract MockThirdComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getFourthMarketSymbol() public view returns (string memory) {\n return allMarkets[3].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 1;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getFourthMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract ExtensionsTest is MarketsTest {\n MockComptrollerExtension internal mockExtension;\n MockSecondComptrollerExtension internal second;\n MockThirdComptrollerExtension internal third;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n mockExtension = new MockComptrollerExtension();\n second = new MockSecondComptrollerExtension();\n third = new MockThirdComptrollerExtension();\n }\n\n function testExtensionReplace() public debuggingOnly fork(BSC_MAINNET) {\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\n _upgradeExistingPool(jFiatPoolAddress);\n\n // replace the first extension with the mock\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, mockExtension, comptrollerExtension);\n\n // assert that the replacement worked\n MockComptrollerExtension asMockExtension = MockComptrollerExtension(jFiatPoolAddress);\n emit log(asMockExtension.getSecondMarketSymbol());\n assertEq(asMockExtension.getSecondMarketSymbol(), \"fETH-1\", \"market symbol does not match\");\n\n // add a second mock extension\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, second, DiamondExtension(address(0)));\n\n // add again the third, removing the second\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, third, second);\n\n // assert that it worked\n DiamondBase asBase = DiamondBase(jFiatPoolAddress);\n address[] memory currentExtensions = asBase._listExtensions();\n assertEq(currentExtensions.length, 2, \"extensions count does not match\");\n assertEq(currentExtensions[0], address(mockExtension), \"!first\");\n assertEq(currentExtensions[1], address(third), \"!second\");\n }\n\n function testNewPoolExtensions() public fork(BSC_MAINNET) {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n _prepareComptrollerUpgrade(address(0));\n\n // deploy a pool that will have an extension registered automatically\n {\n (, address poolAddress) = fpd.deployPool(\n \"just-a-test2\",\n latestComptrollerImplementation,\n abi.encode(payable(address(ffd))),\n false,\n 0.1e18,\n 1.1e18,\n ap.getAddress(\"MasterPriceOracle\")\n );\n\n address[] memory initExtensionsAfter = DiamondBase(payable(poolAddress))._listExtensions();\n assertEq(initExtensionsAfter.length, 1, \"remove this if the ffd config is set up\");\n assertEq(initExtensionsAfter[0], address(comptrollerExtension), \"first extension is not the CFE\");\n }\n }\n\n function testMulticallMarket() public fork(BSC_MAINNET) {\n uint8 random = uint8(block.timestamp % 256);\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(pools[random % pools.length].comptroller);\n ICErc20[] memory markets = somePool.getAllMarkets();\n\n if (markets.length == 0) return;\n\n ICErc20 someMarket = markets[random % markets.length];\n\n emit log(\"pool\");\n emit log_address(address(somePool));\n emit log(\"market\");\n emit log_address(address(someMarket));\n\n vm.roll(block.number + 1);\n\n bytes memory blockNumberBeforeCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\n bytes memory accrueInterestCall = abi.encodeWithSelector(someMarket.accrueInterest.selector);\n bytes memory blockNumberAfterCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\n bytes[] memory results = someMarket.multicall(\n asArray(blockNumberBeforeCall, accrueInterestCall, blockNumberAfterCall)\n );\n uint256 blockNumberBefore = abi.decode(results[0], (uint256));\n uint256 blockNumberAfter = abi.decode(results[2], (uint256));\n\n assertGt(blockNumberAfter, blockNumberBefore, \"did not accrue?\");\n }\n\n function testBscExistingCTokenExtensionUpgrade() public fork(BSC_MAINNET) {\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\n }\n\n function testArbitrumExistingCTokenExtensionUpgrade() public fork(ARBITRUM_ONE) {\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\n }\n\n function _testAllPoolsAllMarketsCTokenExtensionUpgrade() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n _testPoolAllMarketsExtensionUpgrade(pools[i].comptroller);\n }\n }\n\n function _testPoolAllMarketsExtensionUpgrade(address poolAddress) internal {\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(poolAddress);\n\n ICErc20[] memory markets = somePool.getAllMarkets();\n\n if (markets.length == 0) return;\n\n for (uint256 j = 0; j < markets.length; j++) {\n ICErc20 someMarket = markets[j];\n CErc20Delegator asDelegator = CErc20Delegator(address(someMarket));\n\n emit log(\"pool\");\n emit log_address(address(somePool));\n emit log(\"market\");\n emit log_address(address(someMarket));\n\n try this._testExistingCTokenExtensionUpgrade(asDelegator) {} catch Error(string memory reason) {\n address plugin = address(CErc20PluginDelegate(address(asDelegator)).plugin());\n emit log(\"plugin\");\n emit log_address(plugin);\n\n address latestPlugin = ffd.latestPluginImplementation(plugin);\n emit log(\"latest plugin impl\");\n emit log_address(latestPlugin);\n\n revert(reason);\n }\n }\n }\n\n function _testExistingCTokenExtensionUpgrade(CErc20Delegator asDelegator) public {\n uint256 totalSupplyBefore = asDelegator.totalSupply();\n if (totalSupplyBefore == 0) return; // total supply should be non-zero\n\n // TODO\n _upgradeMarket(ICErc20(address(asDelegator)));\n\n // check if the extension was added\n address[] memory extensions = asDelegator._listExtensions();\n assertEq(extensions.length, 1, \"the first extension should be added\");\n assertEq(extensions[0], address(newCTokenExtension), \"the first extension should be the only extension\");\n\n // check if the storage is read from the same place\n uint256 totalSupplyAfter = asDelegator.totalSupply();\n assertGt(totalSupplyAfter, 0, \"total supply should be non-zero\");\n assertEq(totalSupplyAfter, totalSupplyBefore, \"total supply should be the same\");\n }\n\n function testBscComptrollerExtensions() public debuggingOnly fork(BSC_MAINNET) {\n _testComptrollersExtensions();\n }\n\n function testPolygonComptrollerExtensions() public debuggingOnly fork(POLYGON_MAINNET) {\n _testComptrollersExtensions();\n }\n\n function testChapelComptrollerExtensions() public debuggingOnly fork(BSC_CHAPEL) {\n _testComptrollersExtensions();\n }\n\n function testArbitrumComptrollerExtensions() public debuggingOnly fork(ARBITRUM_ONE) {\n _testComptrollersExtensions();\n }\n\n function _testComptrollersExtensions() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n address payable asPayable = payable(pools[i].comptroller);\n DiamondBase asBase = DiamondBase(asPayable);\n address[] memory extensions = asBase._listExtensions();\n assertEq(extensions.length, 1, \"each pool should have the first extension\");\n }\n }\n\n function testBulkAutoUpgrade() public debuggingOnly fork(POLYGON_MAINNET) {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n vm.prank(ffd.owner());\n ffd.autoUpgradePool(IonicComptroller(pools[i].comptroller));\n }\n }\n\n function testPolygonTotalUnderlyingSupplied() public debuggingOnly fork(POLYGON_MAINNET) {\n _testTotalUnderlyingSupplied();\n }\n\n function testBscTotalUnderlyingSupplied() public debuggingOnly fork(BSC_MAINNET) {\n _testTotalUnderlyingSupplied();\n }\n\n function _testTotalUnderlyingSupplied() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n // if (pools[i].comptroller == 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459) continue;\n // if (pools[i].comptroller == 0xD265ff7e5487E9DD556a4BB900ccA6D087Eb3AD2) continue;\n ComptrollerFirstExtension poolExt = ComptrollerFirstExtension(pools[i].comptroller);\n\n ICErc20[] memory markets = poolExt.getAllMarkets();\n for (uint8 k = 0; k < markets.length; k++) {\n CErc20Delegate market = CErc20Delegate(address(markets[k]));\n // emit log(market.contractType());\n // emit log_named_address(\"impl\", market.implementation());\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(address(markets[k]));\n marketAsExt.getTotalUnderlyingSupplied();\n }\n }\n }\n\n function testDelegateType() public debuggingOnly fork(POLYGON_MAINNET) {\n emit log(CErc20Delegate(0x587906620D627fe75C4d1288C6A584089780959c).contractType());\n }\n}\n" + }, + "contracts/test/GlobalPauser.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport \"./config/BaseTest.t.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { IComptroller } from \"../external/compound/IComptroller.sol\";\nimport { GlobalPauser } from \"../GlobalPauser.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport \"forge-std/console.sol\";\n\ncontract GlobalPauserTest is BaseTest {\n address public poolDirectory = 0x39C353Cf9041CcF467A04d0e78B63d961E81458a;\n address public pauseGuardian = 0xD9677b0eeafdCe6BF322d9774Bb65B1f42cF0404;\n address public multisig = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2;\n GlobalPauser public pauser; // = GlobalPauser(0xe646D8Be18e545244C5E79F121202f75FA3880c8);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n pauser = new GlobalPauser(poolDirectory);\n pauser.setPauseGuardian(pauseGuardian, true);\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(poolDirectory).getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n vm.prank(IonicComptroller(pools[i].comptroller).admin());\n IonicComptroller(pools[i].comptroller)._setPauseGuardian(address(pauser));\n }\n }\n\n function testPauseNotGuardian(address sender) public debuggingOnly forkAtBlock(MODE_MAINNET, 9269895) {\n vm.assume(sender != pauseGuardian);\n vm.expectRevert(bytes(\"!guardian\"));\n pauser.pauseAll();\n }\n\n function testPauseAll() public debuggingOnly forkAtBlock(MODE_MAINNET, 9269895) {\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(poolDirectory).getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n assertEq(isPaused, false);\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n assertEq(isPaused, false);\n }\n }\n vm.prank(pauseGuardian);\n pauser.pauseAll();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n assertEq(isPaused, true);\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n assertEq(isPaused, true);\n }\n }\n }\n}\n" + }, + "contracts/test/helpers/WithPool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.4.23;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\n\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../../compound/CErc20Delegator.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { PoolLens } from \"../../PoolLens.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract WithPool is BaseTest {\n ERC20Upgradeable public underlyingToken;\n CErc20Delegate cErc20Delegate;\n CErc20PluginDelegate cErc20PluginDelegate;\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\n\n IonicComptroller comptroller;\n Comptroller newComptroller;\n JumpRateModel interestModel;\n\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n MasterPriceOracle priceOracle;\n PoolLens poolLens;\n\n address[] markets;\n bool[] t;\n bool[] f;\n address[] newImplementation;\n address[] hardcodedAddresses;\n string[] hardcodedNames;\n\n function setUpWithPool(MasterPriceOracle _masterPriceOracle, ERC20Upgradeable _underlyingToken) public {\n priceOracle = _masterPriceOracle;\n underlyingToken = _underlyingToken;\n\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n if (address(ionicAdmin) != address(0)) {\n // upgrade\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ionicAdmin)));\n bytes32 bytesAtSlot = vm.load(\n address(proxy),\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\n );\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n } else {\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n }\n\n {\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setPendingOwner(address(this));\n ionicAdmin._acceptOwner();\n }\n setUpBaseContracts();\n setUpExtensions();\n }\n\n function setUpExtensions() internal {\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginDelegate.delegateType(),\n address(cErc20PluginDelegate),\n abi.encode(address(0))\n );\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginRewardsDelegate.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0))\n );\n\n cErc20DelegateExtensions[1] = cErc20Delegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n cErc20DelegateExtensions[1] = cErc20PluginDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\n cErc20DelegateExtensions[1] = cErc20PluginRewardsDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\n }\n\n function setUpBaseContracts() internal {\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n\n poolLens = new PoolLens();\n poolLens.initialize(\n poolDirectory,\n \"Pool\",\n \"lens\",\n hardcodedAddresses,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames\n );\n }\n\n function setUpPool(\n string memory name,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive\n ) public {\n Comptroller newComptrollerImplementation = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(newComptrollerImplementation));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = newComptrollerImplementation;\n ionicAdmin._setComptrollerExtensions(address(newComptrollerImplementation), extensions);\n\n (, address comptrollerAddress) = poolDirectory.deployPool(\n name,\n address(newComptrollerImplementation),\n abi.encode(payable(address(ionicAdmin))),\n enforceWhitelist,\n closeFactor,\n liquidationIncentive,\n address(priceOracle)\n );\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n }\n\n function upgradePool(address pool) internal {\n Comptroller newComptrollerImplementation = new Comptroller();\n\n Unitroller asUnitroller = Unitroller(payable(pool));\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(\n newComptrollerImplementation,\n DiamondExtension(asUnitroller.comptrollerImplementation())\n );\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function deployCErc20Delegate(\n address _underlyingToken,\n bytes memory name,\n bytes memory symbol,\n uint256 _collateralFactorMantissa\n ) public {\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n _underlyingToken,\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n name,\n symbol,\n uint256(1),\n uint256(0)\n ),\n \"\",\n _collateralFactorMantissa\n );\n }\n\n function deployCErc20PluginDelegate(address _erc4626, uint256 _collateralFactorMantissa) public {\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(_erc4626),\n _collateralFactorMantissa\n );\n }\n\n function deployCErc20PluginRewardsDelegate(address _mockERC4626Dynamic, uint256 _collateralFactorMantissa) public {\n comptroller._deployMarket(\n cErc20PluginRewardsDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(_mockERC4626Dynamic),\n _collateralFactorMantissa\n );\n }\n}\n" + }, + "contracts/test/IonicFlywheel/interfaces/Errors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\n/**\n @title Shared Errors\n*/\ninterface Errors {\n /// @notice thrown when attempting to approve an EOA that must be a contract\n error NonContractError();\n}" + }, + "contracts/test/IonicFlywheel/IonicFlywheel.t.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MockBooster } from \"./mocks/MockBooster.sol\";\nimport { MockRewards } from \"./mocks/MockRewards.sol\";\nimport { Authority } from \"solmate/auth/Auth.sol\";\nimport { MockEmissionsManager } from \"./mocks/MockEmissionsManager.sol\";\nimport { IEmissionsManager } from \"../../IEmissionsManager.sol\";\nimport \"../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport \"../../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport \"../../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\n\nimport \"forge-std/console.sol\";\n\ncontract IonicFlywheelTest is Test {\n IonicFlywheel flywheel;\n MockRewards rewards;\n MockBooster booster;\n\n MockERC20 strategy;\n MockERC20 rewardToken;\n MockEmissionsManager emissionsManager;\n\n address constant user = address(0xDEAD);\n address constant user2 = address(0xBEEF);\n uint224 public constant ONE = 1e18;\n\n function setUp() public {\n rewardToken = new MockERC20(\"Reward Token\", \"RWD\", 18);\n\n strategy = new MockERC20(\"Strategy Token\", \"STRAT\", 18);\n\n booster = new MockBooster();\n\n flywheel = new IonicFlywheel();\n flywheel.initialize(\n rewardToken,\n MockRewards(address(0)),\n IFlywheelBooster(address(0)),\n address(this)\n );\n \n flywheel.updateFeeSettings(0, address(this));\n\n rewards = new MockRewards(flywheel);\n\n emissionsManager = new MockEmissionsManager();\n flywheel.setEmissionsManager(IEmissionsManager(address(emissionsManager)));\n\n flywheel.setFlywheelRewards(rewards);\n }\n\n function test_addStrategyForRewards_StrategyCanBeAdded(ERC20 strat) public {\n flywheel.addStrategyForRewards(strat);\n (uint224 index, uint32 timestamp) = flywheel.strategyState(strat);\n assertEq(index, ONE);\n assertEq(timestamp, block.timestamp);\n }\n\n function test_addStrategyForRewards_Unauthorized() public {\n vm.prank(address(1));\n vm.expectRevert(bytes(\"Ownable: caller is not the owner\"));\n flywheel.addStrategyForRewards(strategy);\n }\n\n function test_setFlywheelRewards_FlywheelRewardsCanBeAdded(uint256 mintAmount) public {\n rewardToken.mint(address(rewards), mintAmount);\n\n flywheel.setFlywheelRewards(IFlywheelRewards(address(1)));\n assertEq(address(flywheel.flywheelRewards()), address(1));\n\n // assert rewards transferred\n assertEq(rewardToken.balanceOf(address(1)), mintAmount);\n assertEq(rewardToken.balanceOf(address(rewards)), 0);\n }\n\n function test_setFlywheelRewards_Unauthorized() public {\n vm.prank(address(1));\n vm.expectRevert(bytes(\"Ownable: caller is not the owner\"));\n flywheel.setFlywheelRewards(IFlywheelRewards(address(1)));\n }\n\n function test_setBooster_FlywheelBoosterCanBeAdded(IFlywheelBooster booster) public {\n flywheel.setBooster(booster);\n assertEq(address(flywheel.flywheelBooster()), address(booster));\n }\n\n function test_setBooster_Unauthorized() public {\n vm.prank(address(1));\n vm.expectRevert(bytes(\"Ownable: caller is not the owner\"));\n flywheel.setBooster(IFlywheelBooster(address(1)));\n }\n\n function test_accrue_UserCanBeAccrued(\n uint128 userBalance1,\n uint128 userBalance2,\n uint128 rewardAmount\n ) public {\n vm.assume(userBalance1 != 0 && userBalance2 != 0 && rewardAmount != 0 && userBalance1 < 1e25 && userBalance2 < 1e25);\n strategy.mint(user, userBalance1);\n strategy.mint(user2, userBalance2);\n\n rewardToken.mint(address(rewards), rewardAmount);\n rewards.setRewardsAmount(strategy, rewardAmount);\n\n flywheel.addStrategyForRewards(strategy);\n\n uint256 accrued = flywheel.accrue(strategy, user);\n (uint224 index, ) = flywheel.strategyState(strategy);\n\n uint256 diff = (rewardAmount * ONE) / (uint256(userBalance1) + userBalance2);\n\n assertEq(index, ONE + diff);\n assertEq(flywheel.userIndex(strategy, user), index);\n assertEq(flywheel.rewardsAccrued(user), (diff * userBalance1) / ONE);\n assertEq(accrued, (diff * userBalance1) / ONE);\n assertEq(flywheel.rewardsAccrued(user2), 0 ether);\n\n assertEq(rewardToken.balanceOf(address(rewards)), rewardAmount);\n\n }\n\n function test_accrue_TwoUsersCanBeAccrued(\n uint128 userBalance1,\n uint128 userBalance2,\n uint128 rewardAmount\n ) public {\n vm.assume(userBalance1 != 0 && userBalance2 != 0 && rewardAmount != 0);\n\n strategy.mint(user, userBalance1);\n strategy.mint(user2, userBalance2);\n\n rewardToken.mint(address(rewards), rewardAmount);\n rewards.setRewardsAmount(strategy, rewardAmount);\n\n flywheel.addStrategyForRewards(strategy);\n\n (uint256 accrued1, uint256 accrued2) = flywheel.accrue(strategy, user, user2);\n\n (uint224 index, ) = flywheel.strategyState(strategy);\n\n uint256 diff = (rewardAmount * ONE) / (uint256(userBalance1) + userBalance2);\n\n assertEq(index, ONE + diff);\n assertEq(flywheel.userIndex(strategy, user), index);\n assertEq(flywheel.userIndex(strategy, user2), index);\n assertEq(flywheel.rewardsAccrued(user), (diff * userBalance1) / ONE);\n assertEq(flywheel.rewardsAccrued(user2), (diff * userBalance2) / ONE);\n assertEq(accrued1, (diff * userBalance1) / ONE);\n assertEq(accrued2, (diff * userBalance2) / ONE);\n assertEq(rewardToken.balanceOf(address(rewards)), rewardAmount);\n\n }\n\n function test_accrue_AccrueBeforeAddStrategy(uint128 mintAmount, uint128 rewardAmount) public {\n strategy.mint(user, mintAmount);\n\n rewardToken.mint(address(rewards), rewardAmount);\n rewards.setRewardsAmount(strategy, rewardAmount);\n\n assertEq(flywheel.accrue(strategy, user), 0);\n }\n\n function test_accrue_AccrueTwoUsersBeforeAddStrategy() public {\n strategy.mint(user, 1 ether);\n strategy.mint(user2, 3 ether);\n\n rewardToken.mint(address(rewards), 10 ether);\n rewards.setRewardsAmount(strategy, 10 ether);\n\n (uint256 accrued1, uint256 accrued2) = flywheel.accrue(strategy, user, user2);\n\n assertEq(accrued1, 0);\n assertEq(accrued2, 0);\n }\n\n function test_accrue_AccrueTwoUsersSeparately() public {\n strategy.mint(user, 1 ether);\n strategy.mint(user2, 3 ether);\n\n rewardToken.mint(address(rewards), 10 ether);\n rewards.setRewardsAmount(strategy, 10 ether);\n\n flywheel.addStrategyForRewards(strategy);\n\n uint256 accrued = flywheel.accrue(strategy, user);\n\n rewards.setRewardsAmount(strategy, 0);\n\n uint256 accrued2 = flywheel.accrue(strategy, user2);\n\n (uint224 index, ) = flywheel.strategyState(strategy);\n\n assertEq(index, ONE + 2.5 ether);\n assertEq(flywheel.userIndex(strategy, user), index);\n assertEq(flywheel.rewardsAccrued(user), 2.5 ether);\n assertEq(flywheel.rewardsAccrued(user2), 7.5 ether);\n assertEq(accrued, 2.5 ether);\n assertEq(accrued2, 7.5 ether);\n\n assertEq(rewardToken.balanceOf(address(rewards)), 10 ether);\n }\n\n function test_accrue_AccrueSecondUserLater() public {\n strategy.mint(user, 1 ether);\n\n rewardToken.mint(address(rewards), 10 ether);\n rewards.setRewardsAmount(strategy, 10 ether);\n\n flywheel.addStrategyForRewards(strategy);\n\n (uint256 accrued, uint256 accrued2) = flywheel.accrue(strategy, user, user2);\n\n (uint224 index, ) = flywheel.strategyState(strategy);\n\n assertEq(index, ONE + 10 ether);\n assertEq(flywheel.userIndex(strategy, user), index);\n assertEq(flywheel.rewardsAccrued(user), 10 ether);\n assertEq(flywheel.rewardsAccrued(user2), 0);\n assertEq(accrued, 10 ether);\n assertEq(accrued2, 0);\n\n assertEq(rewardToken.balanceOf(address(rewards)), 10 ether);\n\n strategy.mint(user2, 3 ether);\n\n rewardToken.mint(address(rewards), 4 ether);\n rewards.setRewardsAmount(strategy, 4 ether);\n\n (accrued, accrued2) = flywheel.accrue(strategy, user, user2);\n\n (index, ) = flywheel.strategyState(strategy);\n\n assertEq(index, ONE + 11 ether);\n assertEq(flywheel.userIndex(strategy, user), index);\n assertEq(flywheel.rewardsAccrued(user), 11 ether);\n assertEq(flywheel.rewardsAccrued(user2), 3 ether);\n assertEq(accrued, 11 ether);\n assertEq(accrued2, 3 ether);\n\n assertEq(rewardToken.balanceOf(address(rewards)), 14 ether);\n }\n\n function test_claimRewards_UserCanClaim(\n uint128 userBalance1,\n uint128 userBalance2,\n uint128 rewardAmount\n ) public {\n vm.assume(userBalance1 != 0 && userBalance2 != 0 && rewardAmount != 0);\n\n test_accrue_UserCanBeAccrued(userBalance1, userBalance2, rewardAmount);\n flywheel.claimRewards(user);\n\n uint256 diff = (rewardAmount * ONE) / (uint256(userBalance1) + userBalance2);\n uint256 accrued = (diff * userBalance1) / ONE;\n\n assertEq(rewardToken.balanceOf(address(rewards)), rewardAmount - accrued);\n assertEq(rewardToken.balanceOf(user), accrued);\n assertEq(flywheel.rewardsAccrued(user), 0);\n\n flywheel.claimRewards(user);\n }\n\n function test_rewardsAccrued_BoostedRewardsAccrued(\n uint128 userBalance1,\n uint128 userBalance2,\n uint128 rewardAmount,\n uint128 boost\n ) public {\n vm.assume(userBalance1 != 0 && userBalance2 != 0 && rewardAmount != 0);\n\n booster.setBoost(user, boost);\n\n flywheel.setBooster(IFlywheelBooster(address(booster)));\n\n strategy.mint(user, userBalance1);\n strategy.mint(user2, userBalance2);\n\n rewardToken.mint(address(rewards), rewardAmount);\n rewards.setRewardsAmount(strategy, rewardAmount);\n\n flywheel.addStrategyForRewards(strategy);\n\n uint256 accrued = flywheel.accrue(strategy, user);\n\n (uint224 index, ) = flywheel.strategyState(strategy);\n\n uint256 diff = (rewardAmount * ONE) / (uint256(userBalance1) + userBalance2 + boost);\n uint256 user1Boosted = uint256(userBalance1) + boost;\n\n assertEq(index, ONE + diff);\n assertEq(flywheel.userIndex(strategy, user), index);\n assertEq(flywheel.rewardsAccrued(user), (diff * user1Boosted) / ONE);\n assertEq(accrued, (diff * user1Boosted) / ONE);\n\n assertEq(rewardToken.balanceOf(address(rewards)), rewardAmount);\n\n }\n\n function test_updateFeeSettings_UpdateFeeSettings(uint256 fee, address feeRecipient) public {\n vm.assume(flywheel.feeRecipient() != feeRecipient);\n \n flywheel.updateFeeSettings(fee, feeRecipient);\n assertEq(flywheel.performanceFee(), fee);\n assertEq(flywheel.feeRecipient(), feeRecipient);\n }\n\n function test_updateFeeSettings_Unauthorized(uint256 fee, address feeRecipient, address caller) public {\n vm.assume(flywheel.feeRecipient() != feeRecipient && caller != flywheel.owner());\n \n vm.prank(caller);\n vm.expectRevert(bytes(\"Ownable: caller is not the owner\"));\n flywheel.updateFeeSettings(fee, feeRecipient);\n }\n\n function test_takeRewardsFromUser_RewardsCanBeTakenFromUser(\n address user1,\n uint256 userBalance1,\n uint256 rewardAmount,\n address receiver\n ) public {\n vm.assume(userBalance1 != 0 && rewardAmount != 0 && rewardAmount < 1e27 && userBalance1 < 1e27);\n strategy.mint(user1, userBalance1);\n\n rewardToken.mint(address(rewards), rewardAmount);\n rewards.setRewardsAmount(strategy, rewardAmount);\n\n flywheel.addStrategyForRewards(strategy);\n\n flywheel.accrue(strategy, user1);\n uint256 accrued = flywheel.rewardsAccrued(user1);\n emissionsManager.blacklistUser(user1);\n vm.prank(address(emissionsManager));\n flywheel.takeRewardsFromUser(user1, receiver);\n\n assertEq(rewardToken.balanceOf(address(rewards)), rewardAmount - accrued);\n assertEq(rewardToken.balanceOf(receiver), accrued);\n assertEq(flywheel.rewardsAccrued(user1), 0);\n }\n\n function test_takeRewardsFromUser_test_addStrategyForRewards_Unauthorized(\n address user1,\n uint256 userBalance1,\n uint256 rewardAmount,\n address receiver\n ) public {\n vm.assume(userBalance1 != 0 && rewardAmount != 0 && rewardAmount < 1e25 && userBalance1 < 1e25);\n strategy.mint(user1, userBalance1);\n\n rewardToken.mint(address(rewards), rewardAmount);\n rewards.setRewardsAmount(strategy, rewardAmount);\n\n flywheel.addStrategyForRewards(strategy);\n\n uint256 accrued = flywheel.accrue(strategy, user1);\n\n emissionsManager.blacklistUser(user1);\n vm.expectRevert(bytes(\"!emissionsManager\"));\n flywheel.takeRewardsFromUser(user1, receiver);\n }\n\n function test_setEmissionsManager_SetNewEmissionsManager(address newEmissionsManager) public {\n \n flywheel.setEmissionsManager(IEmissionsManager(newEmissionsManager));\n assertEq(address(flywheel.emissionsManager()), newEmissionsManager);\n }\n\n function test_setEmissionsManager_Unauthorized(address newEmissionsManager, address caller) public {\n vm.assume(caller != flywheel.owner());\n \n vm.prank(caller);\n vm.expectRevert(bytes(\"Ownable: caller is not the owner\"));\n flywheel.setEmissionsManager(IEmissionsManager(newEmissionsManager));\n }\n\n function test_whitelistUser_UserCanBeWhitelisted(address user1) public {\n vm.prank(address(emissionsManager));\n flywheel.whitelistUser(strategy, user1);\n assertEq(flywheel.blacklistedSupply(strategy), 0);\n assertEq(flywheel.userBlacklistedSupply(strategy, user1), 0);\n }\n\n function test_whitelistUser_Unauthorized(address user1, address caller) public {\n vm.assume(caller != address(emissionsManager));\n\n vm.prank(caller);\n vm.expectRevert(bytes(\"!emissionsManager\"));\n flywheel.whitelistUser(strategy, user1);\n }\n\n function test_updateBlacklistBalances_UserCanBeWhitelisted(address user1, uint256 userBalance1) public {\n vm.assume(userBalance1 < 1e25);\n\n emissionsManager.blacklistUser(user1);\n strategy.mint(user1, userBalance1);\n\n vm.prank(address(emissionsManager));\n flywheel.updateBlacklistBalances(strategy, user1);\n assertEq(flywheel.blacklistedSupply(strategy), userBalance1);\n assertEq(flywheel.userBlacklistedSupply(strategy, user1), userBalance1);\n }\n\n function test_updateBlacklistBalances_Unauthorized(address user1, address caller) public {\n emissionsManager.blacklistUser(user1);\n\n vm.assume(caller != address(emissionsManager));\n \n vm.prank(caller);\n vm.expectRevert(bytes(\"!emissionsManager\"));\n flywheel.updateBlacklistBalances(strategy, user1);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/lib/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}" + }, + "contracts/test/IonicFlywheel/mocks/MockBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\ncontract MockBooster {\n uint256 public totalBoost;\n\n mapping(address => uint256) public boosts;\n\n function setBoost(address user, uint256 boost) public {\n totalBoost -= boosts[user];\n boosts[user] = boost;\n totalBoost += boost;\n }\n\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256) {\n return strategy.totalSupply() + totalBoost;\n }\n\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256) {\n return strategy.balanceOf(user) + boosts[user];\n }\n}\n" + }, + "contracts/test/IonicFlywheel/mocks/MockEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\n\ncontract MockEmissionsManager {\n using SafeTransferLib for ERC20;\n\n mapping (address => bool) blacklisted;\n address public rewardToken;\n address public flywheelRewards;\n function setRewardToken(address _rewardToken) public {\n rewardToken = _rewardToken;\n }\n\n function setFlywheelRewards(address _flywheelRewards) public {\n flywheelRewards = _flywheelRewards;\n }\n\n function updateBlacklistBalances(ERC20 _market, address _user) external {}\n\n function accrue(ERC20 _market, address _user) public returns (uint256) {\n return 0;\n }\n\n function takeRewardsFromUser(address _user, address _receiver) external { \n uint256 balance = ERC20(rewardToken).balanceOf(address(flywheelRewards));\n ERC20(rewardToken).safeTransferFrom(address(flywheelRewards), _receiver, balance);\n }\n function whitelistUser(ERC20 strategy, address user) external {}\n\n function isUserBlacklisted(address _user) external view returns (bool) {\n return blacklisted[_user];\n }\n\n function blacklistUser(address _user) external {\n blacklisted[_user] = true;\n }\n\n function isUserBlacklistable(address _user) external view returns (bool) {\n return false;\n }\n \n\n}" + }, + "contracts/test/IonicFlywheel/mocks/MockERC20Gauges.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20Gauges, ERC20, Auth, Authority} from \"../token/ERC20Gauges.sol\";\n\ncontract MockERC20Gauges is ERC20Gauges {\n constructor(\n address _owner,\n uint32 _cycleLength,\n uint32 _freezeWindow\n ) ERC20(\"Token\", \"TKN\", 18) Auth(_owner, Authority(address(0))) ERC20Gauges(_cycleLength, _freezeWindow) {}\n\n function mint(address to, uint256 value) public virtual {\n _mint(to, value);\n }\n\n function burn(address from, uint256 value) public virtual {\n _burn(from, value);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/mocks/MockERC20MultiVotes.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20MultiVotes, ERC20, Auth, Authority} from \"../token/ERC20MultiVotes.sol\";\n\ncontract MockERC20MultiVotes is ERC20MultiVotes {\n constructor(address _owner) ERC20(\"Token\", \"TKN\", 18) Auth(_owner, Authority(address(0))) {}\n\n function mint(address to, uint256 value) public virtual {\n _mint(to, value);\n }\n\n function burn(address from, uint256 value) public virtual {\n _burn(from, value);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/mocks/MockRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"../../../ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol\";\n\ncontract MockRewards is BaseFlywheelRewards {\n /// @notice rewards amount per strategy\n mapping(ERC20 => uint256) public rewardsAmount;\n\n constructor(IonicFlywheelCore _flywheel) BaseFlywheelRewards(_flywheel) {}\n\n function setRewardsAmount(ERC20 strategy, uint256 amount) external {\n rewardsAmount[strategy] = amount;\n }\n\n function getAccruedRewards(ERC20 strategy, uint32) external view override onlyFlywheel returns (uint256 amount) {\n return rewardsAmount[strategy];\n }\n}\n" + }, + "contracts/test/IonicFlywheel/mocks/MockRewardsStream.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\ncontract MockRewardsStream {\n ERC20 public rewardToken;\n uint256 rewardAmount;\n\n constructor(ERC20 token, uint256 amount) {\n rewardAmount = amount;\n rewardToken = token;\n }\n\n function setRewardAmount(uint256 newAmount) external {\n rewardAmount = newAmount;\n }\n\n function getRewards() external returns (uint256 amount) {\n amount = rewardAmount;\n rewardToken.transfer(msg.sender, amount);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/rewards/FlywheelGaugeRewardsTest.t.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPlus.sol\";\nimport {MockERC20} from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport {MockERC20Gauges} from \"../mocks/MockERC20Gauges.sol\";\nimport {MockRewardsStream} from \"../mocks/MockRewardsStream.sol\";\n\nimport \"../token/FlywheelGaugeRewards.sol\";\n\ncontract FlywheelGaugeRewardsTest is DSTestPlus {\n FlywheelGaugeRewards rewards;\n\n MockERC20 public rewardToken;\n\n MockERC20Gauges gaugeToken;\n\n MockRewardsStream rewardsStream;\n\n address gauge1 = address(0xDEAD);\n address gauge2 = address(0xBEEF);\n address gauge3 = address(0xFEED);\n address gauge4 = address(0xCAFE);\n\n function setUp() public {\n hevm.warp(1000); // skip to cycle 1\n\n rewardToken = new MockERC20(\"test token\", \"TKN\", 18);\n\n rewardsStream = new MockRewardsStream(rewardToken, 100e18);\n rewardToken.mint(address(rewardsStream), 100e25);\n\n gaugeToken = new MockERC20Gauges(address(this), 1000, 100);\n gaugeToken.setMaxGauges(10);\n gaugeToken.mint(address(this), 100e18);\n\n rewards = new FlywheelGaugeRewards(\n IonicFlywheelCore(address(this)),\n address(this),\n Authority(address(0)),\n gaugeToken,\n IRewardsStream(address(rewardsStream))\n );\n }\n\n function testGetRewardsUninitialized() public {\n require(rewards.getAccruedRewards(ERC20(gauge1), 0) == 0);\n }\n\n function testQueueWithoutGaugesBeforeCycle() public {\n hevm.expectRevert(abi.encodeWithSignature(\"CycleError()\"));\n rewards.queueRewardsForCycle();\n }\n\n function testQueueWithoutGaugesNoGauges() public {\n hevm.warp(block.timestamp + 1000);\n hevm.expectRevert(abi.encodeWithSignature(\"EmptyGaugesError()\"));\n rewards.queueRewardsForCycle();\n }\n\n function testQueue() public {\n gaugeToken.addGauge(gauge1);\n gaugeToken.addGauge(gauge2);\n gaugeToken.incrementGauge(gauge1, 1e18);\n gaugeToken.incrementGauge(gauge2, 3e18);\n\n hevm.warp(block.timestamp + 1000);\n\n rewards.queueRewardsForCycle();\n\n (uint112 prior1, uint112 stored1, uint32 cycle1) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior1 == 0);\n require(stored1 == 25e18);\n require(cycle1 == 2000);\n\n (uint112 prior2, uint112 stored2, uint32 cycle2) = rewards.gaugeQueuedRewards(ERC20(gauge2));\n require(prior2 == 0);\n require(stored2 == 75e18);\n require(cycle2 == 2000);\n\n require(rewards.gaugeCycle() == 2000);\n }\n\n function testQueueSkipCycle() public {\n gaugeToken.addGauge(gauge1);\n gaugeToken.incrementGauge(gauge1, 1e18);\n\n hevm.warp(block.timestamp + 2000);\n\n rewards.queueRewardsForCycle();\n\n (uint112 prior, uint112 stored, uint32 cycle) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior == 0);\n require(stored == 100e18);\n require(cycle == 3000);\n\n require(rewards.gaugeCycle() == 3000);\n }\n\n function testQueueTwoCycles() public {\n testQueue();\n gaugeToken.decrementGauge(gauge2, 2e18);\n\n hevm.warp(block.timestamp + 1000);\n\n rewards.queueRewardsForCycle();\n\n (uint112 prior1, uint112 stored1, uint32 cycle1) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior1 == 25e18);\n require(stored1 == 50e18);\n require(cycle1 == 3000);\n\n (uint112 prior2, uint112 stored2, uint32 cycle2) = rewards.gaugeQueuedRewards(ERC20(gauge2));\n require(prior2 == 75e18);\n require(stored2 == 50e18);\n require(cycle2 == 3000);\n\n require(rewards.gaugeCycle() == 3000);\n }\n\n function testGetRewards() public {\n testQueue();\n\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp)) == 0);\n (, uint112 stored, ) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(stored == 25e18);\n\n // accrue 20% of 25\n hevm.warp(block.timestamp + 200);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 200) == 5e18);\n (, stored, ) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(stored == 20e18);\n\n // accrue 60% of 25\n hevm.warp(block.timestamp + 600);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 600) == 15e18);\n (, stored, ) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(stored == 5e18);\n\n // accrue last 20% only after exceeding cycle end\n hevm.warp(block.timestamp + 600);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 600) == 5e18);\n (, stored, ) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(stored == 0);\n }\n\n function testGetPriorRewards() public {\n testQueueTwoCycles();\n\n // accrue 25 + 20% of 50\n hevm.warp(block.timestamp + 200);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 200) == 35e18);\n (uint112 prior, uint112 stored, ) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior == 0);\n require(stored == 40e18);\n }\n\n /*///////////////////////////////////////////////////////////////\n FULL PAGINATION TESTS\n //////////////////////////////////////////////////////////////*/\n\n // The following tests all queue using a single pagination loop. They are intended to test the equivalence between the pagination operation and queueing when the numGauges is small enough to do all at once.\n\n function testQueueFullPagination() public {\n gaugeToken.addGauge(gauge1);\n gaugeToken.addGauge(gauge2);\n gaugeToken.incrementGauge(gauge1, 1e18);\n gaugeToken.incrementGauge(gauge2, 3e18);\n\n hevm.warp(block.timestamp + 1000);\n\n rewards.queueRewardsForCyclePaginated(5);\n\n (uint112 prior1, uint112 stored1, uint32 cycle1) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior1 == 0);\n require(stored1 == 25e18);\n require(cycle1 == 2000);\n\n (uint112 prior2, uint112 stored2, uint32 cycle2) = rewards.gaugeQueuedRewards(ERC20(gauge2));\n require(prior2 == 0);\n require(stored2 == 75e18);\n require(cycle2 == 2000);\n\n require(rewards.gaugeCycle() == 2000);\n }\n\n function testQueueSkipCycleFullPagination() public {\n gaugeToken.addGauge(gauge1);\n gaugeToken.incrementGauge(gauge1, 1e18);\n\n hevm.warp(block.timestamp + 2000);\n\n rewards.queueRewardsForCyclePaginated(5);\n\n (uint112 prior, uint112 stored, uint32 cycle) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior == 0);\n require(stored == 100e18);\n require(cycle == 3000);\n\n require(rewards.gaugeCycle() == 3000);\n }\n\n function testQueueTwoCyclesFullPagination() public {\n testQueueFullPagination();\n gaugeToken.decrementGauge(gauge2, 2e18);\n\n hevm.warp(block.timestamp + 1000);\n\n rewards.queueRewardsForCyclePaginated(5);\n\n (uint112 prior1, uint112 stored1, uint32 cycle1) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior1 == 25e18);\n require(stored1 == 50e18);\n require(cycle1 == 3000);\n\n (uint112 prior2, uint112 stored2, uint32 cycle2) = rewards.gaugeQueuedRewards(ERC20(gauge2));\n require(prior2 == 75e18);\n require(stored2 == 50e18);\n require(cycle2 == 3000);\n\n require(rewards.gaugeCycle() == 3000);\n }\n\n /*///////////////////////////////////////////////////////////////\n PARTIAL PAGINATION TESTS\n //////////////////////////////////////////////////////////////*/\n\n function testPagination() public {\n gaugeToken.addGauge(gauge1);\n gaugeToken.incrementGauge(gauge1, 1e18);\n\n gaugeToken.addGauge(gauge2);\n gaugeToken.incrementGauge(gauge2, 2e18);\n\n gaugeToken.addGauge(gauge3);\n gaugeToken.incrementGauge(gauge3, 3e18);\n\n gaugeToken.addGauge(gauge4);\n gaugeToken.incrementGauge(gauge4, 4e18);\n\n hevm.warp(block.timestamp + 1000);\n\n require(rewards.gaugeCycle() == 1000);\n\n rewards.queueRewardsForCyclePaginated(2);\n\n // pagination not complete, cycle not complete\n require(rewards.gaugeCycle() == 1000);\n\n (uint112 prior1, uint112 stored1, uint32 cycle1) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior1 == 0);\n require(stored1 == 10e18);\n require(cycle1 == 2000);\n\n (uint112 prior2, uint112 stored2, uint32 cycle2) = rewards.gaugeQueuedRewards(ERC20(gauge2));\n require(prior2 == 0);\n require(stored2 == 20e18);\n require(cycle2 == 2000);\n\n (uint112 prior3, uint112 stored3, uint32 cycle3) = rewards.gaugeQueuedRewards(ERC20(gauge3));\n require(prior3 == 0);\n require(stored3 == 0);\n require(cycle3 == 0);\n\n (uint112 prior4, uint112 stored4, uint32 cycle4) = rewards.gaugeQueuedRewards(ERC20(gauge4));\n require(prior4 == 0);\n require(stored4 == 0);\n require(cycle4 == 0);\n\n rewards.queueRewardsForCyclePaginated(2);\n\n require(rewards.gaugeCycle() == 2000);\n\n (prior1, stored1, cycle1) = rewards.gaugeQueuedRewards(ERC20(gauge1));\n require(prior1 == 0);\n require(stored1 == 10e18);\n require(cycle1 == 2000);\n\n (prior2, stored2, cycle2) = rewards.gaugeQueuedRewards(ERC20(gauge2));\n require(prior2 == 0);\n require(stored2 == 20e18);\n require(cycle2 == 2000);\n\n (prior3, stored3, cycle3) = rewards.gaugeQueuedRewards(ERC20(gauge3));\n require(prior3 == 0);\n require(stored3 == 30e18);\n require(cycle3 == 2000);\n\n (prior4, stored4, cycle4) = rewards.gaugeQueuedRewards(ERC20(gauge4));\n require(prior4 == 0);\n require(stored4 == 40e18);\n require(cycle4 == 2000);\n }\n\n function testIncompletePagination() public {\n testQueue();\n\n gaugeToken.addGauge(gauge3);\n gaugeToken.incrementGauge(gauge3, 2e18);\n\n gaugeToken.addGauge(gauge4);\n gaugeToken.incrementGauge(gauge4, 4e18);\n\n hevm.warp(block.timestamp + 1000);\n\n require(rewards.gaugeCycle() == 2000);\n\n rewards.queueRewardsForCyclePaginated(2);\n\n // pagination not complete, cycle not complete\n require(rewards.gaugeCycle() == 2000);\n\n hevm.warp(block.timestamp + 500);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 500) == 25e18); // only previous round\n require(rewards.getAccruedRewards(ERC20(gauge2), uint32(block.timestamp) - 500) == 75e18); // only previous round\n require(rewards.getAccruedRewards(ERC20(gauge3), uint32(block.timestamp) - 500) == 0); // nothing because no previous round\n require(rewards.getAccruedRewards(ERC20(gauge4), uint32(block.timestamp) - 500) == 0); // nothing because no previous round\n\n hevm.warp(block.timestamp + 500);\n\n // should reset the pagination process without queueing the last one\n rewards.queueRewardsForCyclePaginated(2);\n\n // pagination still not complete, cycle not complete\n require(rewards.gaugeCycle() == 2000);\n\n hevm.warp(block.timestamp + 500);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 500) == 0); // nothing because no previous round\n require(rewards.getAccruedRewards(ERC20(gauge2), uint32(block.timestamp) - 500) == 0); // nothing because no previous round\n require(rewards.getAccruedRewards(ERC20(gauge3), uint32(block.timestamp) - 500) == 0); // nothing because no previous round\n require(rewards.getAccruedRewards(ERC20(gauge4), uint32(block.timestamp) - 500) == 0); // nothing because no previous round\n\n // should reset the pagination process without queueing the last one\n rewards.queueRewardsForCyclePaginated(2);\n\n // pagination complete, cycle complete\n require(rewards.gaugeCycle() == 4000);\n\n hevm.warp(block.timestamp + 500);\n require(rewards.getAccruedRewards(ERC20(gauge1), uint32(block.timestamp) - 500) == 20e18); // 10% of 2 rounds\n require(rewards.getAccruedRewards(ERC20(gauge2), uint32(block.timestamp) - 500) == 60e18); // 30% of 2 rounds\n require(rewards.getAccruedRewards(ERC20(gauge3), uint32(block.timestamp) - 500) == 40e18); // 20% of 2 rounds\n require(rewards.getAccruedRewards(ERC20(gauge4), uint32(block.timestamp) - 500) == 80e18); // 40% of 2 rounds\n }\n}\n" + }, + "contracts/test/IonicFlywheel/rewards/FlywheelStaticRewardsTest.t.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPlus.sol\";\nimport {MockERC20} from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport {IonicFlywheelCore} from \"../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport {FlywheelStaticRewards, Authority} from \"../../../ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol\";\n\ncontract FlywheelStaticRewardsTest is DSTestPlus {\n FlywheelStaticRewards rewards;\n\n MockERC20 strategy;\n MockERC20 public rewardToken;\n\n function setUp() public {\n rewardToken = new MockERC20(\"test token\", \"TKN\", 18);\n\n strategy = new MockERC20(\"test strategy\", \"TKN\", 18);\n\n rewards = new FlywheelStaticRewards(IonicFlywheelCore(address(this)), address(this), Authority(address(0)));\n }\n\n function testSetRewardsInfo() public {\n (uint224 rewardsPerSecond, uint32 rewardsEndTimestamp) = rewards.rewardsInfo(strategy);\n require(rewardsPerSecond == 0);\n require(rewardsEndTimestamp == 0);\n\n uint32 newEnd = uint32(block.timestamp) + 100;\n rewards.setRewardsInfo(\n strategy,\n FlywheelStaticRewards.RewardsInfo({rewardsPerSecond: 1 ether, rewardsEndTimestamp: newEnd})\n );\n\n (rewardsPerSecond, rewardsEndTimestamp) = rewards.rewardsInfo(strategy);\n\n require(rewardsPerSecond == 1 ether);\n require(rewardsEndTimestamp == newEnd);\n }\n\n function testGetAccruedRewards() public {\n hevm.warp(1000);\n testSetRewardsInfo();\n\n rewardToken.mint(address(rewards), 100 ether);\n\n require(rewards.getAccruedRewards(strategy, uint32(block.timestamp - 10)) == 10 ether);\n require(rewardToken.balanceOf(address(rewards)) == 100 ether);\n }\n\n function testGetAccruedRewardsAfterEnd() public {\n hevm.warp(1000);\n testSetRewardsInfo();\n hevm.warp(2000);\n\n rewardToken.mint(address(rewards), 100 ether);\n\n require(rewards.getAccruedRewards(strategy, uint32(block.timestamp - 1000)) == 100 ether);\n require(rewardToken.balanceOf(address(rewards)) == 100 ether);\n }\n\n function testGetAccruedRewardsCappedAfterEnd() public {\n hevm.warp(1000);\n testSetRewardsInfo();\n hevm.warp(2000);\n\n rewardToken.mint(address(rewards), 20 ether);\n\n require(rewards.getAccruedRewards(strategy, uint32(block.timestamp - 1000)) == 100 ether);\n require(rewardToken.balanceOf(address(rewards)) == 20 ether);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/token/ERC20Gauges.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"solmate/auth/Auth.sol\";\nimport \"solmate/tokens/ERC20.sol\";\nimport \"solmate/utils/SafeCastLib.sol\";\nimport \"../lib/EnumerableSet.sol\";\n\ninterface Errors_ERC20Gauges {\n /// @notice thrown when attempting to approve an EOA that must be a contract\n error NonContractError();\n}\n\n/** \n @title An ERC20 with an embedded \"Gauge\" style vote with liquid weights\n @author Tribe DAO\n @notice This contract is meant to be used to support gauge style votes with weights associated with resource allocation.\n Holders can allocate weight in any proportion to supported gauges.\n A \"gauge\" is represented by an address which would receive the resources periodically or continuously.\n\n For example, gauges can be used to direct token emissions, similar to Curve or Tokemak.\n Alternatively, gauges can be used to direct another quantity such as relative access to a line of credit.\n\n The contract's Authority manages the gauge set and cap.\n \"Live\" gauges are in the set. \n Users can only add weight to live gauges but can remove weight from live or deprecated gauges.\n Gauges can be deprecated and reinstated, and will maintain any non-removed weight from before.\n\n @dev SECURITY NOTES: `maxGauges` is a critical variable to protect against gas DOS attacks upon token transfer. \n This must be low enough to allow complicated transactions to fit in a block.\n \n Weight state is preserved on the gauge and user level even when a gauge is removed, in case it is re-added. \n This maintains state efficiently, and global accounting is managed only on the `_totalWeight`\n*/\nabstract contract ERC20Gauges is ERC20, Auth {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeCastLib for *;\n\n constructor(uint32 _gaugeCycleLength, uint32 _incrementFreezeWindow) {\n if (_incrementFreezeWindow >= _gaugeCycleLength) revert IncrementFreezeError();\n gaugeCycleLength = _gaugeCycleLength;\n incrementFreezeWindow = _incrementFreezeWindow;\n }\n\n /*///////////////////////////////////////////////////////////////\n GAUGE STATE\n //////////////////////////////////////////////////////////////*/\n\n /// @notice the length of a gauge cycle\n uint32 public immutable gaugeCycleLength;\n\n /// @notice the period at the end of a cycle where votes cannot increment\n uint32 public immutable incrementFreezeWindow;\n\n struct Weight {\n uint112 storedWeight;\n uint112 currentWeight;\n uint32 currentCycle;\n }\n\n /// @notice a mapping from users to gauges to a user's allocated weight to that gauge\n mapping(address => mapping(address => uint112)) public getUserGaugeWeight;\n\n /// @notice a mapping from a user to their total allocated weight across all gauges\n /// @dev NOTE this may contain weights for deprecated gauges\n mapping(address => uint112) public getUserWeight;\n\n /// @notice a mapping from a gauge to the total weight allocated to it\n /// @dev NOTE this may contain weights for deprecated gauges\n mapping(address => Weight) internal _getGaugeWeight;\n\n /// @notice the total global allocated weight ONLY of live gauges\n Weight internal _totalWeight;\n\n mapping(address => EnumerableSet.AddressSet) internal _userGauges;\n\n EnumerableSet.AddressSet internal _gauges;\n\n // Store deprecated gauges in case a user needs to free dead weight\n EnumerableSet.AddressSet internal _deprecatedGauges;\n\n /*///////////////////////////////////////////////////////////////\n VIEW HELPERS\n //////////////////////////////////////////////////////////////*/\n\n /// @notice return the end of the current cycle. This is the next unix timestamp which evenly divides `gaugeCycleLength`\n function getGaugeCycleEnd() public view returns (uint32) {\n return _getGaugeCycleEnd();\n }\n\n /// @notice see `getGaugeCycleEnd()`\n function _getGaugeCycleEnd() internal view returns (uint32) {\n uint32 nowPlusOneCycle = block.timestamp.safeCastTo32() + gaugeCycleLength;\n unchecked {\n return (nowPlusOneCycle / gaugeCycleLength) * gaugeCycleLength; // cannot divide by zero and always <= nowPlusOneCycle so no overflow\n }\n }\n\n /// @notice returns the current weight of a given gauge\n function getGaugeWeight(address gauge) public view returns (uint112) {\n return _getGaugeWeight[gauge].currentWeight;\n }\n\n /// @notice returns the stored weight of a given gauge. This is the snapshotted weight as-of the end of the last cycle.\n function getStoredGaugeWeight(address gauge) public view returns (uint112) {\n if (_deprecatedGauges.contains(gauge)) return 0;\n return _getStoredWeight(_getGaugeWeight[gauge], _getGaugeCycleEnd());\n }\n\n /// @notice see `getStoredGaugeWeight()`\n function _getStoredWeight(Weight storage gaugeWeight, uint32 currentCycle) internal view returns (uint112) {\n return gaugeWeight.currentCycle < currentCycle ? gaugeWeight.currentWeight : gaugeWeight.storedWeight;\n }\n\n /// @notice returns the current total allocated weight\n function totalWeight() external view returns (uint112) {\n return _totalWeight.currentWeight;\n }\n\n /// @notice returns the stored total allocated weight\n function storedTotalWeight() external view returns (uint112) {\n return _getStoredWeight(_totalWeight, _getGaugeCycleEnd());\n }\n\n /// @notice returns the set of live gauges\n function gauges() external view returns (address[] memory) {\n return _gauges.values();\n }\n\n /** \n @notice returns a paginated subset of live gauges\n @param offset the index of the first gauge element to read\n @param num the number of gauges to return\n */\n function gauges(uint256 offset, uint256 num) external view returns (address[] memory values) {\n values = new address[](num);\n for (uint256 i = 0; i < num; ) {\n unchecked {\n values[i] = _gauges.at(offset + i); // will revert if out of bounds\n i++;\n }\n }\n }\n\n /// @notice returns true if `gauge` is not in deprecated gauges\n function isGauge(address gauge) external view returns (bool) {\n return _gauges.contains(gauge) && !_deprecatedGauges.contains(gauge);\n }\n\n /// @notice returns the number of live gauges\n function numGauges() external view returns (uint256) {\n return _gauges.length();\n }\n\n /// @notice returns the set of previously live but now deprecated gauges\n function deprecatedGauges() external view returns (address[] memory) {\n return _deprecatedGauges.values();\n }\n\n /// @notice returns the number of live gauges\n function numDeprecatedGauges() external view returns (uint256) {\n return _deprecatedGauges.length();\n }\n\n /// @notice returns the set of gauges the user has allocated to, may be live or deprecated.\n function userGauges(address user) external view returns (address[] memory) {\n return _userGauges[user].values();\n }\n\n /// @notice returns true if `gauge` is in user gauges\n function isUserGauge(address user, address gauge) external view returns (bool) {\n return _userGauges[user].contains(gauge);\n }\n\n /** \n @notice returns a paginated subset of gauges the user has allocated to, may be live or deprecated.\n @param user the user to return gauges from.\n @param offset the index of the first gauge element to read.\n @param num the number of gauges to return.\n */\n function userGauges(\n address user,\n uint256 offset,\n uint256 num\n ) external view returns (address[] memory values) {\n values = new address[](num);\n for (uint256 i = 0; i < num; ) {\n unchecked {\n values[i] = _userGauges[user].at(offset + i); // will revert if out of bounds\n i++;\n }\n }\n }\n\n /// @notice returns the number of user gauges\n function numUserGauges(address user) external view returns (uint256) {\n return _userGauges[user].length();\n }\n\n /// @notice helper function exposing the amount of weight available to allocate for a user\n function userUnusedWeight(address user) external view returns (uint256) {\n return balanceOf[user] - getUserWeight[user];\n }\n\n /** \n @notice helper function for calculating the proportion of a `quantity` allocated to a gauge\n @param gauge the gauge to calculate allocation of\n @param quantity a representation of a resource to be shared among all gauges\n @return the proportion of `quantity` allocated to `gauge`. Returns 0 if gauge is not live, even if it has weight.\n */\n function calculateGaugeAllocation(address gauge, uint256 quantity) external view returns (uint256) {\n if (_deprecatedGauges.contains(gauge)) return 0;\n uint32 currentCycle = _getGaugeCycleEnd();\n\n uint112 total = _getStoredWeight(_totalWeight, currentCycle);\n uint112 weight = _getStoredWeight(_getGaugeWeight[gauge], currentCycle);\n return (quantity * weight) / total;\n }\n\n /*///////////////////////////////////////////////////////////////\n USER GAUGE OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @notice thrown when trying to increment/decrement a mismatched number of gauges and weights.\n error SizeMismatchError();\n\n /// @notice thrown when trying to increment over the max allowed gauges.\n error MaxGaugeError();\n\n /// @notice thrown when incrementing over a users free weight.\n error OverWeightError();\n\n /// @notice thrown when incremending during the freeze window.\n error IncrementFreezeError();\n\n /// @notice emitted when incrementing a gauge\n event IncrementGaugeWeight(address indexed user, address indexed gauge, uint256 weight, uint32 cycleEnd);\n\n /// @notice emitted when decrementing a gauge\n event DecrementGaugeWeight(address indexed user, address indexed gauge, uint256 weight, uint32 cycleEnd);\n\n /** \n @notice increment a gauge with some weight for the caller\n @param gauge the gauge to increment\n @param weight the amount of weight to increment on gauge\n @return newUserWeight the new user weight\n */\n function incrementGauge(address gauge, uint112 weight) external returns (uint112 newUserWeight) {\n uint32 currentCycle = _getGaugeCycleEnd();\n _incrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\n return _incrementUserAndGlobalWeights(msg.sender, weight, currentCycle);\n }\n\n function _incrementGaugeWeight(\n address user,\n address gauge,\n uint112 weight,\n uint32 cycle\n ) internal {\n if (_deprecatedGauges.contains(gauge)) revert InvalidGaugeError();\n unchecked {\n if (cycle - block.timestamp <= incrementFreezeWindow) revert IncrementFreezeError();\n }\n\n bool added = _userGauges[user].add(gauge); // idempotent add\n if (added && _userGauges[user].length() > maxGauges && !canContractExceedMaxGauges[user])\n revert MaxGaugeError();\n\n getUserGaugeWeight[user][gauge] += weight;\n\n _writeGaugeWeight(_getGaugeWeight[gauge], _add, weight, cycle);\n\n emit IncrementGaugeWeight(user, gauge, weight, cycle);\n }\n\n function _incrementUserAndGlobalWeights(\n address user,\n uint112 weight,\n uint32 cycle\n ) internal returns (uint112 newUserWeight) {\n newUserWeight = getUserWeight[user] + weight;\n // Ensure under weight\n if (newUserWeight > balanceOf[user]) revert OverWeightError();\n\n // Update gauge state\n getUserWeight[user] = newUserWeight;\n\n _writeGaugeWeight(_totalWeight, _add, weight, cycle);\n }\n\n /** \n @notice increment a list of gauges with some weights for the caller\n @param gaugeList the gauges to increment\n @param weights the weights to increment by\n @return newUserWeight the new user weight\n */\n function incrementGauges(address[] calldata gaugeList, uint112[] calldata weights)\n external\n returns (uint256 newUserWeight)\n {\n uint256 size = gaugeList.length;\n if (weights.length != size) revert SizeMismatchError();\n\n // store total in summary for batch update on user/global state\n uint112 weightsSum;\n\n uint32 currentCycle = _getGaugeCycleEnd();\n\n // Update gauge specific state\n for (uint256 i = 0; i < size; ) {\n address gauge = gaugeList[i];\n uint112 weight = weights[i];\n weightsSum += weight;\n\n _incrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\n unchecked {\n i++;\n }\n }\n return _incrementUserAndGlobalWeights(msg.sender, weightsSum, currentCycle);\n }\n\n /** \n @notice decrement a gauge with some weight for the caller\n @param gauge the gauge to decrement\n @param weight the amount of weight to decrement on gauge\n @return newUserWeight the new user weight\n */\n function decrementGauge(address gauge, uint112 weight) external returns (uint112 newUserWeight) {\n uint32 currentCycle = _getGaugeCycleEnd();\n\n // All operations will revert on underflow, protecting against bad inputs\n _decrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\n return _decrementUserAndGlobalWeights(msg.sender, weight, currentCycle);\n }\n\n function _decrementGaugeWeight(\n address user,\n address gauge,\n uint112 weight,\n uint32 cycle\n ) internal {\n uint112 oldWeight = getUserGaugeWeight[user][gauge];\n\n getUserGaugeWeight[user][gauge] = oldWeight - weight;\n if (oldWeight == weight) {\n // If removing all weight, remove gauge from user list.\n require(_userGauges[user].remove(gauge));\n }\n\n _writeGaugeWeight(_getGaugeWeight[gauge], _subtract, weight, cycle);\n\n emit DecrementGaugeWeight(user, gauge, weight, cycle);\n }\n\n function _decrementUserAndGlobalWeights(\n address user,\n uint112 weight,\n uint32 cycle\n ) internal returns (uint112 newUserWeight) {\n newUserWeight = getUserWeight[user] - weight;\n\n getUserWeight[user] = newUserWeight;\n _writeGaugeWeight(_totalWeight, _subtract, weight, cycle);\n }\n\n /** \n @notice decrement a list of gauges with some weights for the caller\n @param gaugeList the gauges to decrement\n @param weights the list of weights to decrement on the gauges\n @return newUserWeight the new user weight\n */\n function decrementGauges(address[] calldata gaugeList, uint112[] calldata weights)\n external\n returns (uint112 newUserWeight)\n {\n uint256 size = gaugeList.length;\n if (weights.length != size) revert SizeMismatchError();\n\n // store total in summary for batch update on user/global state\n uint112 weightsSum;\n\n uint32 currentCycle = _getGaugeCycleEnd();\n\n // Update gauge specific state\n // All operations will revert on underflow, protecting against bad inputs\n for (uint256 i = 0; i < size; ) {\n address gauge = gaugeList[i];\n uint112 weight = weights[i];\n weightsSum += weight;\n\n _decrementGaugeWeight(msg.sender, gauge, weight, currentCycle);\n unchecked {\n i++;\n }\n }\n return _decrementUserAndGlobalWeights(msg.sender, weightsSum, currentCycle);\n }\n\n /**\n @dev this function is the key to the entire contract.\n The storage weight it operates on is either a global or gauge-specific weight.\n The operation applied is either addition for incrementing gauges or subtraction for decrementing a gauge.\n */\n function _writeGaugeWeight(\n Weight storage weight,\n function(uint112, uint112) view returns (uint112) op,\n uint112 delta,\n uint32 cycle\n ) private {\n uint112 currentWeight = weight.currentWeight;\n // If the last cycle of the weight is before the current cycle, use the current weight as the stored.\n uint112 stored = weight.currentCycle < cycle ? currentWeight : weight.storedWeight;\n uint112 newWeight = op(currentWeight, delta);\n\n weight.storedWeight = stored;\n weight.currentWeight = newWeight;\n weight.currentCycle = cycle;\n }\n\n function _add(uint112 a, uint112 b) private pure returns (uint112) {\n return a + b;\n }\n\n function _subtract(uint112 a, uint112 b) private pure returns (uint112) {\n return a - b;\n }\n\n /*///////////////////////////////////////////////////////////////\n ADMIN GAUGE OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @notice thrown when trying to increment or remove a non-live gauge, or add a live gauge.\n error InvalidGaugeError();\n\n /// @notice emitted when adding a new gauge to the live set.\n event AddGauge(address indexed gauge);\n\n /// @notice emitted when removing a gauge from the live set.\n event RemoveGauge(address indexed gauge);\n\n /// @notice emitted when updating the max number of gauges a user can delegate to.\n event MaxGaugesUpdate(uint256 oldMaxGauges, uint256 newMaxGauges);\n\n /// @notice emitted when changing a contract's approval to go over the max gauges.\n event CanContractExceedMaxGaugesUpdate(address indexed account, bool canContractExceedMaxGauges);\n\n /// @notice the default maximum amount of gauges a user can allocate to.\n /// @dev if this number is ever lowered, or a contract has an override, then existing addresses MAY have more gauges allocated to. Use `numUserGauges` to check this.\n uint256 public maxGauges;\n\n /// @notice an approve list for contracts to go above the max gauge limit.\n mapping(address => bool) public canContractExceedMaxGauges;\n\n /// @notice add a new gauge. Requires auth by `authority`.\n function addGauge(address gauge) external requiresAuth returns (uint112) {\n return _addGauge(gauge);\n }\n\n function _addGauge(address gauge) internal returns (uint112 weight) {\n bool newAdd = _gauges.add(gauge);\n bool previouslyDeprecated = _deprecatedGauges.remove(gauge);\n // add and fail loud if zero address or already present and not deprecated\n if (gauge == address(0) || !(newAdd || previouslyDeprecated)) revert InvalidGaugeError();\n\n uint32 currentCycle = _getGaugeCycleEnd();\n\n // Check if some previous weight exists and re-add to total. Gauge and user weights are preserved.\n weight = _getGaugeWeight[gauge].currentWeight;\n if (weight > 0) {\n _writeGaugeWeight(_totalWeight, _add, weight, currentCycle);\n }\n\n emit AddGauge(gauge);\n }\n\n /// @notice remove a new gauge. Requires auth by `authority`.\n function removeGauge(address gauge) external requiresAuth {\n _removeGauge(gauge);\n }\n\n function _removeGauge(address gauge) internal {\n // add to deprecated and fail loud if not present\n if (!_deprecatedGauges.add(gauge)) revert InvalidGaugeError();\n\n uint32 currentCycle = _getGaugeCycleEnd();\n\n // Remove weight from total but keep the gauge and user weights in storage in case gauge is re-added.\n uint112 weight = _getGaugeWeight[gauge].currentWeight;\n if (weight > 0) {\n _writeGaugeWeight(_totalWeight, _subtract, weight, currentCycle);\n }\n\n emit RemoveGauge(gauge);\n }\n\n /// @notice replace a gauge. Requires auth by `authority`.\n function replaceGauge(address oldGauge, address newGauge) external requiresAuth {\n _removeGauge(oldGauge);\n _addGauge(newGauge);\n }\n\n /// @notice set the new max gauges. Requires auth by `authority`.\n /// @dev if this is set to a lower number than the current max, users MAY have more gauges active than the max. Use `numUserGauges` to check this.\n function setMaxGauges(uint256 newMax) external requiresAuth {\n uint256 oldMax = maxGauges;\n maxGauges = newMax;\n\n emit MaxGaugesUpdate(oldMax, newMax);\n }\n\n /// @notice set the canContractExceedMaxGauges flag for an account.\n function setContractExceedMaxGauges(address account, bool canExceedMax) external requiresAuth {\n if (canExceedMax && account.code.length == 0) revert Errors_ERC20Gauges.NonContractError(); // can only approve contracts\n\n canContractExceedMaxGauges[account] = canExceedMax;\n\n emit CanContractExceedMaxGaugesUpdate(account, canExceedMax);\n }\n\n /*///////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n /// NOTE: any \"removal\" of tokens from a user requires userUnusedWeight < amount.\n /// _decrementWeightUntilFree is called as a greedy algorithm to free up weight.\n /// It may be more gas efficient to free weight before burning or transferring tokens.\n\n function _burn(address from, uint256 amount) internal virtual override {\n _decrementWeightUntilFree(from, amount);\n super._burn(from, amount);\n }\n\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n _decrementWeightUntilFree(msg.sender, amount);\n return super.transfer(to, amount);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n _decrementWeightUntilFree(from, amount);\n return super.transferFrom(from, to, amount);\n }\n\n /// a greedy algorithm for freeing weight before a token burn/transfer\n /// frees up entire gauges, so likely will free more than `weight`\n function _decrementWeightUntilFree(address user, uint256 weight) internal {\n uint256 userFreeWeight = balanceOf[user] - getUserWeight[user];\n\n // early return if already free\n if (userFreeWeight >= weight) return;\n\n uint32 currentCycle = _getGaugeCycleEnd();\n\n // cache totals for batch updates\n uint112 userFreed;\n uint112 totalFreed;\n\n // Loop through all user gauges, live and deprecated\n address[] memory gaugeList = _userGauges[user].values();\n\n // Free gauges until through entire list or under weight\n uint256 size = gaugeList.length;\n for (uint256 i = 0; i < size && (userFreeWeight + totalFreed) < weight; ) {\n address gauge = gaugeList[i];\n uint112 userGaugeWeight = getUserGaugeWeight[user][gauge];\n if (userGaugeWeight != 0) {\n // If the gauge is live (not deprecated), include its weight in the total to remove\n if (!_deprecatedGauges.contains(gauge)) {\n totalFreed += userGaugeWeight;\n }\n userFreed += userGaugeWeight;\n _decrementGaugeWeight(user, gauge, userGaugeWeight, currentCycle);\n\n unchecked {\n i++;\n }\n }\n }\n\n getUserWeight[user] -= userFreed;\n _writeGaugeWeight(_totalWeight, _subtract, totalFreed, currentCycle);\n }\n}" + }, + "contracts/test/IonicFlywheel/token/ERC20GaugesTest.t.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPlus.sol\";\nimport {MockERC20Gauges} from \"../mocks/MockERC20Gauges.sol\";\n\ncontract ERC20GaugesTest is DSTestPlus {\n MockERC20Gauges token;\n address constant gauge1 = address(0xDEAD);\n address constant gauge2 = address(0xBEEF);\n\n function setUp() public {\n token = new MockERC20Gauges(address(this), 3600, 600); // 1 hour cycles, 10 minute freeze\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST ADMIN GAUGE OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function testSetMaxGauges(uint256 max) public {\n token.setMaxGauges(max);\n require(token.maxGauges() == max);\n }\n\n function testSetMaxGaugesNonOwner(uint256 max) public {\n hevm.prank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.setMaxGauges(max);\n }\n\n function testCanContractExceedMax() public {\n token.setContractExceedMaxGauges(address(this), true);\n require(token.canContractExceedMaxGauges(address(this)));\n }\n\n function testCanContractExceedMaxNonOwner() public {\n hevm.prank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.setContractExceedMaxGauges(address(this), true);\n }\n\n function testCanContractExceedMaxNonContract() public {\n hevm.expectRevert(abi.encodeWithSignature(\"NonContractError()\"));\n token.setContractExceedMaxGauges(address(1), true);\n }\n\n function testAddGauge(address[8] memory gauges) public {\n token.setMaxGauges(8);\n\n uint256 uniqueGauges;\n for (uint256 i = 0; i < 8; i++) {\n if (token.isGauge(gauges[i]) || gauges[i] == address(0)) {\n hevm.expectRevert(abi.encodeWithSignature(\"InvalidGaugeError()\"));\n token.addGauge(gauges[i]);\n } else {\n token.addGauge(gauges[i]);\n require(token.numGauges() == uniqueGauges + 1);\n require(token.gauges()[uniqueGauges] == gauges[i]);\n uniqueGauges++;\n }\n }\n }\n\n function testAddPreviouslyDeprecated(uint112 amount) public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n\n token.mint(address(this), amount);\n token.incrementGauge(gauge1, amount);\n\n token.removeGauge(gauge1);\n token.addGauge(gauge1);\n\n require(token.numGauges() == 1);\n require(token.totalWeight() == amount);\n require(token.getGaugeWeight(gauge1) == amount);\n require(token.getUserGaugeWeight(address(this), gauge1) == amount);\n require(token.deprecatedGauges().length == 0);\n }\n\n function testAddGaugeTwice() public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n hevm.expectRevert(abi.encodeWithSignature(\"InvalidGaugeError()\"));\n token.addGauge(gauge1);\n }\n\n function testAddGaugeNonOwner() public {\n token.setMaxGauges(1);\n hevm.prank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.addGauge(gauge1);\n }\n\n function testRemoveGauge() public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.removeGauge(gauge1);\n require(token.numGauges() == 1);\n require(token.numDeprecatedGauges() == 1);\n require(token.deprecatedGauges()[0] == gauge1);\n }\n\n function testRemoveGaugeTwice() public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.removeGauge(gauge1);\n hevm.expectRevert(abi.encodeWithSignature(\"InvalidGaugeError()\"));\n token.removeGauge(gauge1);\n }\n\n function testRemoveGaugeNonOwner() public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n hevm.startPrank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.removeGauge(gauge1);\n }\n\n function testRemoveGaugeWithWeight(uint112 amount) public {\n token.mint(address(this), amount);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.incrementGauge(gauge1, amount);\n\n token.removeGauge(gauge1);\n require(token.numGauges() == 1);\n require(token.numDeprecatedGauges() == 1);\n require(token.totalWeight() == 0);\n require(token.getGaugeWeight(gauge1) == amount);\n require(token.getUserGaugeWeight(address(this), gauge1) == amount);\n }\n\n function testReplaceGauge() public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.replaceGauge(gauge1, gauge2);\n require(token.numGauges() == 2);\n require(token.numDeprecatedGauges() == 1);\n require(token.gauges()[0] == gauge1);\n require(token.gauges()[1] == gauge2);\n require(token.deprecatedGauges()[0] == gauge1);\n }\n\n function testReplaceGaugeNonOwner() public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n hevm.startPrank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.replaceGauge(gauge1, gauge2);\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST USER GAUGE OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function testCalculateGaugeAllocation() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 1e18) == 1e18);\n require(token.incrementGauge(gauge2, 1e18) == 2e18);\n\n hevm.warp(3600); // warp 1 hour to store changes\n require(token.calculateGaugeAllocation(gauge1, 100e18) == 50e18);\n require(token.calculateGaugeAllocation(gauge2, 100e18) == 50e18);\n\n require(token.incrementGauge(gauge2, 2e18) == 4e18);\n\n // ensure updates don't propagate until stored\n require(token.calculateGaugeAllocation(gauge1, 100e18) == 50e18);\n require(token.calculateGaugeAllocation(gauge2, 100e18) == 50e18);\n\n hevm.warp(7200); // warp another hour to store changes again\n require(token.calculateGaugeAllocation(gauge1, 100e18) == 25e18);\n require(token.calculateGaugeAllocation(gauge2, 100e18) == 75e18);\n }\n\n function testIncrement(\n address[8] memory from,\n address[8] memory gauges,\n uint112[8] memory amounts\n ) public {\n token.setMaxGauges(8);\n unchecked {\n uint112 sum;\n for (uint256 i = 0; i < 8; i++) {\n hevm.assume(sum + amounts[i] >= sum && !token.isGauge(gauges[i]) && gauges[i] != address(0));\n sum += amounts[i];\n\n token.mint(from[i], amounts[i]);\n\n uint112 userWeightBefore = token.getUserWeight(from[i]);\n uint112 userGaugeWeightBefore = token.getUserGaugeWeight(from[i], gauges[i]);\n uint112 gaugeWeightBefore = token.getGaugeWeight(gauges[i]);\n\n token.addGauge(gauges[i]);\n hevm.prank(from[i]);\n token.incrementGauge(gauges[i], amounts[i]);\n\n require(token.getUserWeight(from[i]) == userWeightBefore + amounts[i]);\n require(token.totalWeight() == sum);\n require(token.getUserGaugeWeight(from[i], gauges[i]) == userGaugeWeightBefore + amounts[i]);\n require(token.getGaugeWeight(gauges[i]) == gaugeWeightBefore + amounts[i]);\n }\n }\n }\n\n function testIncrementDuringFreeze(uint112 amount, uint128 cycleOffset) public {\n hevm.assume(amount != 0);\n\n token.mint(address(this), amount);\n token.setMaxGauges(1);\n token.addGauge(gauge1);\n\n // any timestamp in freeze window is unable to increment\n hevm.warp(token.getGaugeCycleEnd() - (cycleOffset % token.incrementFreezeWindow()) - 1);\n\n hevm.expectRevert(abi.encodeWithSignature(\"IncrementFreezeError()\"));\n token.incrementGauge(gauge1, amount);\n }\n\n /// @notice test incrementing over user max\n function testIncrementOverMax() public {\n token.mint(address(this), 2e18);\n\n token.setMaxGauges(1);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n token.incrementGauge(gauge1, 1e18);\n hevm.expectRevert(abi.encodeWithSignature(\"MaxGaugeError()\"));\n token.incrementGauge(gauge2, 1e18);\n }\n\n /// @notice test incrementing at user max\n function testIncrementAtMax() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(1);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n token.incrementGauge(gauge1, 1e18);\n token.incrementGauge(gauge1, 1e18);\n\n require(token.getUserGaugeWeight(address(this), gauge1) == 2e18);\n require(token.getUserWeight(address(this)) == 2e18);\n require(token.getGaugeWeight(gauge1) == 2e18);\n require(token.totalWeight() == 2e18);\n }\n\n /// @notice test incrementing over user max\n function testIncrementOverMaxApproved(\n address[8] memory gauges,\n uint112[8] memory amounts,\n uint8 max\n ) public {\n token.setMaxGauges(max % 8);\n token.setContractExceedMaxGauges(address(this), true);\n\n unchecked {\n uint112 sum;\n for (uint256 i = 0; i < 8; i++) {\n hevm.assume(sum + amounts[i] >= sum && !token.isGauge(gauges[i]) && gauges[i] != address(0));\n sum += amounts[i];\n\n token.mint(address(this), amounts[i]);\n\n uint112 userGaugeWeightBefore = token.getUserGaugeWeight(address(this), gauges[i]);\n uint112 gaugeWeightBefore = token.getGaugeWeight(gauges[i]);\n\n token.addGauge(gauges[i]);\n token.incrementGauge(gauges[i], amounts[i]);\n\n require(token.getUserWeight(address(this)) == sum);\n require(token.totalWeight() == sum);\n require(token.getUserGaugeWeight(address(this), gauges[i]) == userGaugeWeightBefore + amounts[i]);\n require(token.getGaugeWeight(gauges[i]) == gaugeWeightBefore + amounts[i]);\n }\n }\n }\n\n /// @notice test incrementing and make sure weights are stored\n function testIncrementWithStorage() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n // gauge1,user1 +1\n require(token.incrementGauge(gauge1, 1e18) == 1e18);\n require(token.getUserGaugeWeight(address(this), gauge1) == 1e18);\n require(token.getUserWeight(address(this)) == 1e18);\n require(token.getGaugeWeight(gauge1) == 1e18);\n require(token.totalWeight() == 1e18);\n\n require(token.getStoredGaugeWeight(gauge1) == 0);\n require(token.storedTotalWeight() == 0);\n\n hevm.warp(block.timestamp + 3600); // warp one cycle\n\n require(token.getStoredGaugeWeight(gauge1) == 1e18);\n require(token.storedTotalWeight() == 1e18);\n\n // gauge2,user1 +2\n require(token.incrementGauge(gauge2, 2e18) == 3e18);\n require(token.getUserGaugeWeight(address(this), gauge2) == 2e18);\n require(token.getUserWeight(address(this)) == 3e18);\n require(token.getGaugeWeight(gauge2) == 2e18);\n require(token.totalWeight() == 3e18);\n\n require(token.getStoredGaugeWeight(gauge2) == 0);\n require(token.storedTotalWeight() == 1e18);\n\n hevm.warp(block.timestamp + 1800); // warp half cycle\n\n require(token.getStoredGaugeWeight(gauge2) == 0);\n require(token.storedTotalWeight() == 1e18);\n\n // gauge1,user1 +4\n require(token.incrementGauge(gauge1, 4e18) == 7e18);\n require(token.getUserGaugeWeight(address(this), gauge1) == 5e18);\n require(token.getUserWeight(address(this)) == 7e18);\n require(token.getGaugeWeight(gauge1) == 5e18);\n require(token.totalWeight() == 7e18);\n\n hevm.warp(block.timestamp + 1800); // warp half cycle\n\n require(token.getStoredGaugeWeight(gauge1) == 5e18);\n require(token.getStoredGaugeWeight(gauge2) == 2e18);\n require(token.storedTotalWeight() == 7e18);\n\n hevm.warp(block.timestamp + 3600); // warp full cycle\n\n require(token.getStoredGaugeWeight(gauge1) == 5e18);\n require(token.getStoredGaugeWeight(gauge2) == 2e18);\n require(token.storedTotalWeight() == 7e18);\n }\n\n function testIncrementOnDeprecated(uint112 amount) public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.removeGauge(gauge1);\n hevm.expectRevert(abi.encodeWithSignature(\"InvalidGaugeError()\"));\n token.incrementGauge(gauge1, amount);\n }\n\n function testIncrementOverWeight(uint112 amount) public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n hevm.assume(amount != type(uint112).max);\n token.mint(address(this), amount);\n\n require(token.incrementGauge(gauge1, amount) == amount);\n hevm.expectRevert(abi.encodeWithSignature(\"OverWeightError()\"));\n token.incrementGauge(gauge2, 1);\n }\n\n /// @notice test incrementing multiple gauges with different weights after already incrementing once\n function testIncrementGauges() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n token.incrementGauge(gauge1, 1e18);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](2);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 2e18;\n weights[1] = 4e18;\n\n require(token.incrementGauges(gaugeList, weights) == 7e18);\n\n require(token.getUserGaugeWeight(address(this), gauge2) == 2e18);\n require(token.getGaugeWeight(gauge2) == 2e18);\n require(token.getUserGaugeWeight(address(this), gauge1) == 5e18);\n require(token.getUserWeight(address(this)) == 7e18);\n require(token.getGaugeWeight(gauge1) == 5e18);\n require(token.totalWeight() == 7e18);\n }\n\n function testIncrementGaugesDeprecated() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n token.removeGauge(gauge2);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](2);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 2e18;\n weights[1] = 4e18;\n hevm.expectRevert(abi.encodeWithSignature(\"InvalidGaugeError()\"));\n token.incrementGauges(gaugeList, weights);\n }\n\n function testIncrementGaugesOver() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](2);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 50e18;\n weights[1] = 51e18;\n hevm.expectRevert(abi.encodeWithSignature(\"OverWeightError()\"));\n token.incrementGauges(gaugeList, weights);\n }\n\n function testIncrementGaugesSizeMismatch() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n token.removeGauge(gauge2);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](3);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 1e18;\n weights[1] = 2e18;\n hevm.expectRevert(abi.encodeWithSignature(\"SizeMismatchError()\"));\n token.incrementGauges(gaugeList, weights);\n }\n\n /// @notice test decrement twice, 2 tokens each after incrementing by 4.\n function testDecrement() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 4e18) == 4e18);\n\n require(token.decrementGauge(gauge1, 2e18) == 2e18);\n require(token.getUserGaugeWeight(address(this), gauge1) == 2e18);\n require(token.getUserWeight(address(this)) == 2e18);\n require(token.getGaugeWeight(gauge1) == 2e18);\n require(token.totalWeight() == 2e18);\n\n require(token.decrementGauge(gauge1, 2e18) == 0);\n require(token.getUserGaugeWeight(address(this), gauge1) == 0);\n require(token.getUserWeight(address(this)) == 0);\n require(token.getGaugeWeight(gauge1) == 0);\n require(token.totalWeight() == 0);\n }\n\n /// @notice test decrement all removes user gauge.\n function testDecrementAllRemovesGauge() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 4e18) == 4e18);\n\n require(token.numUserGauges(address(this)) == 1);\n require(token.userGauges(address(this))[0] == gauge1);\n\n require(token.decrementGauge(gauge1, 4e18) == 0);\n\n require(token.numUserGauges(address(this)) == 0);\n }\n\n /// @notice test decrement twice, 2 tokens each after incrementing by 4.\n function testDecrementWithStorage() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 4e18) == 4e18);\n\n require(token.decrementGauge(gauge1, 2e18) == 2e18);\n require(token.getUserGaugeWeight(address(this), gauge1) == 2e18);\n require(token.getUserWeight(address(this)) == 2e18);\n require(token.getGaugeWeight(gauge1) == 2e18);\n require(token.totalWeight() == 2e18);\n\n require(token.getStoredGaugeWeight(gauge1) == 0);\n require(token.storedTotalWeight() == 0);\n\n hevm.warp(block.timestamp + 3600); // warp full cycle\n\n require(token.getStoredGaugeWeight(gauge1) == 2e18);\n require(token.storedTotalWeight() == 2e18);\n\n require(token.decrementGauge(gauge1, 2e18) == 0);\n require(token.getUserGaugeWeight(address(this), gauge1) == 0);\n require(token.getUserWeight(address(this)) == 0);\n require(token.getGaugeWeight(gauge1) == 0);\n require(token.totalWeight() == 0);\n\n require(token.getStoredGaugeWeight(gauge1) == 2e18);\n require(token.storedTotalWeight() == 2e18);\n\n hevm.warp(block.timestamp + 3600); // warp full cycle\n\n require(token.getStoredGaugeWeight(gauge1) == 0);\n require(token.storedTotalWeight() == 0);\n }\n\n function testDecrementOverWeight(uint112 amount) public {\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n token.mint(address(this), amount);\n\n hevm.assume(amount != type(uint112).max);\n\n require(token.incrementGauge(gauge1, amount) == amount);\n hevm.expectRevert(abi.encodeWithSignature(\"Panic(uint256)\", 17));\n token.decrementGauge(gauge1, amount + 1);\n }\n\n function testDecrementGauges() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n token.incrementGauge(gauge1, 1e18);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](2);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 2e18;\n weights[1] = 4e18;\n\n require(token.incrementGauges(gaugeList, weights) == 7e18);\n\n weights[1] = 2e18;\n require(token.decrementGauges(gaugeList, weights) == 3e18);\n\n require(token.getUserGaugeWeight(address(this), gauge2) == 0);\n require(token.getGaugeWeight(gauge2) == 0);\n require(token.getUserGaugeWeight(address(this), gauge1) == 3e18);\n require(token.getUserWeight(address(this)) == 3e18);\n require(token.getGaugeWeight(gauge1) == 3e18);\n require(token.totalWeight() == 3e18);\n }\n\n function testDecrementGaugesOver() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](2);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 5e18;\n weights[1] = 5e18;\n\n require(token.incrementGauges(gaugeList, weights) == 10e18);\n\n weights[1] = 10e18;\n hevm.expectRevert(abi.encodeWithSignature(\"Panic(uint256)\", 17));\n token.decrementGauges(gaugeList, weights);\n }\n\n function testDecrementGaugesSizeMismatch() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n address[] memory gaugeList = new address[](2);\n uint112[] memory weights = new uint112[](2);\n gaugeList[0] = gauge2;\n gaugeList[1] = gauge1;\n weights[0] = 1e18;\n weights[1] = 2e18;\n\n require(token.incrementGauges(gaugeList, weights) == 3e18);\n hevm.expectRevert(abi.encodeWithSignature(\"SizeMismatchError()\"));\n token.decrementGauges(gaugeList, new uint112[](0));\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function testDecrementUntilFreeWhenFree() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 10e18) == 10e18);\n require(token.incrementGauge(gauge2, 20e18) == 30e18);\n require(token.userUnusedWeight(address(this)) == 70e18);\n\n token.burn(address(this), 50e18);\n require(token.userUnusedWeight(address(this)) == 20e18);\n\n require(token.getUserGaugeWeight(address(this), gauge1) == 10e18);\n require(token.getUserWeight(address(this)) == 30e18);\n require(token.getGaugeWeight(gauge1) == 10e18);\n require(token.getUserGaugeWeight(address(this), gauge2) == 20e18);\n require(token.getGaugeWeight(gauge2) == 20e18);\n require(token.totalWeight() == 30e18);\n }\n\n function testDecrementUntilFreeSingle() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 10e18) == 10e18);\n require(token.incrementGauge(gauge2, 20e18) == 30e18);\n require(token.userUnusedWeight(address(this)) == 70e18);\n\n token.transfer(address(1), 80e18);\n require(token.userUnusedWeight(address(this)) == 0);\n\n require(token.getUserGaugeWeight(address(this), gauge1) == 0);\n require(token.getUserWeight(address(this)) == 20e18);\n require(token.getGaugeWeight(gauge1) == 0);\n require(token.getUserGaugeWeight(address(this), gauge2) == 20e18);\n require(token.getGaugeWeight(gauge2) == 20e18);\n require(token.totalWeight() == 20e18);\n }\n\n function testDecrementUntilFreeDouble() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 10e18) == 10e18);\n require(token.incrementGauge(gauge2, 20e18) == 30e18);\n require(token.userUnusedWeight(address(this)) == 70e18);\n\n token.approve(address(1), 100e18);\n hevm.prank(address(1));\n token.transferFrom(address(this), address(1), 90e18);\n\n require(token.userUnusedWeight(address(this)) == 10e18);\n\n require(token.getUserGaugeWeight(address(this), gauge1) == 0);\n require(token.getUserWeight(address(this)) == 0);\n require(token.getGaugeWeight(gauge1) == 0);\n require(token.getUserGaugeWeight(address(this), gauge2) == 0);\n require(token.getGaugeWeight(gauge2) == 0);\n require(token.totalWeight() == 0);\n }\n\n function testDecrementUntilFreeDeprecated() public {\n token.mint(address(this), 100e18);\n\n token.setMaxGauges(2);\n token.addGauge(gauge1);\n token.addGauge(gauge2);\n\n require(token.incrementGauge(gauge1, 10e18) == 10e18);\n require(token.incrementGauge(gauge2, 20e18) == 30e18);\n require(token.userUnusedWeight(address(this)) == 70e18);\n\n require(token.totalWeight() == 30e18);\n token.removeGauge(gauge1);\n require(token.totalWeight() == 20e18);\n\n token.burn(address(this), 100e18);\n\n require(token.userUnusedWeight(address(this)) == 0);\n\n require(token.getUserGaugeWeight(address(this), gauge1) == 0);\n require(token.getUserWeight(address(this)) == 0);\n require(token.getGaugeWeight(gauge1) == 0);\n require(token.getUserGaugeWeight(address(this), gauge2) == 0);\n require(token.getGaugeWeight(gauge2) == 0);\n require(token.totalWeight() == 0);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/token/ERC20MultiVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Voting logic inspired by OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"solmate/auth/Auth.sol\";\nimport \"solmate/tokens/ERC20.sol\";\nimport \"solmate/utils/SafeCastLib.sol\";\nimport \"../lib/EnumerableSet.sol\";\nimport \"../interfaces/Errors.sol\";\n\n/**\n @title ERC20 Multi-Delegation Voting contract\n @notice an ERC20 extension which allows delegations to multiple delegatees up to a user's balance on a given block.\n */\nabstract contract ERC20MultiVotes is ERC20, Auth {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeCastLib for *;\n\n /*///////////////////////////////////////////////////////////////\n VOTE CALCULATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n /// @notice thrown when trying to read from an invalid block.\n error BlockError();\n\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n /// @notice votes checkpoint list per user.\n mapping(address => Checkpoint[]) private _checkpoints;\n\n /// @notice Get the `pos`-th checkpoint for `account`.\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /// @notice Get number of checkpoints for `account`.\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return _checkpoints[account].length.safeCastTo32();\n }\n\n /**\n * @notice Gets the amount of unallocated votes for `account`.\n * @param account the address to get free votes of.\n * @return the amount of unallocated votes.\n */\n function freeVotes(address account) public view virtual returns (uint256) {\n return balanceOf[account] - userDelegatedVotes[account];\n }\n\n /**\n * @notice Gets the current votes balance for `account`.\n * @param account the address to get votes of.\n * @return the amount of votes.\n */\n function getVotes(address account) public view virtual returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @notice Retrieve the number of votes for `account` at the end of `blockNumber`.\n * @param account the address to get votes of.\n * @param blockNumber the block to calculate votes for.\n * @return the amount of votes.\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual returns (uint256) {\n if (blockNumber >= block.number) revert BlockError();\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /// @dev Lookup a value in a list of (sorted) checkpoints.\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /*///////////////////////////////////////////////////////////////\n ADMIN OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @notice emitted when updating the maximum amount of delegates per user\n event MaxDelegatesUpdate(uint256 oldMaxDelegates, uint256 newMaxDelegates);\n\n /// @notice emitted when updating the canContractExceedMaxDelegates flag for an account\n event CanContractExceedMaxDelegatesUpdate(address indexed account, bool canContractExceedMaxDelegates);\n\n /// @notice the maximum amount of delegates for a user at a given time\n uint256 public maxDelegates;\n\n /// @notice an approve list for contracts to go above the max delegate limit.\n mapping(address => bool) public canContractExceedMaxDelegates;\n\n /// @notice set the new max delegates per user. Requires auth by `authority`.\n function setMaxDelegates(uint256 newMax) external requiresAuth {\n uint256 oldMax = maxDelegates;\n maxDelegates = newMax;\n\n emit MaxDelegatesUpdate(oldMax, newMax);\n }\n\n /// @notice set the canContractExceedMaxDelegates flag for an account.\n function setContractExceedMaxDelegates(address account, bool canExceedMax) external requiresAuth {\n if (canExceedMax && account.code.length == 0) revert Errors.NonContractError(); // can only approve contracts\n\n canContractExceedMaxDelegates[account] = canExceedMax;\n\n emit CanContractExceedMaxDelegatesUpdate(account, canExceedMax);\n }\n\n /*///////////////////////////////////////////////////////////////\n DELEGATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Emitted when a `delegator` delegates `amount` votes to `delegate`.\n event Delegation(address indexed delegator, address indexed delegate, uint256 amount);\n\n /// @dev Emitted when a `delegator` undelegates `amount` votes from `delegate`.\n event Undelegation(address indexed delegator, address indexed delegate, uint256 amount);\n\n /// @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /// @notice An event thats emitted when an account changes its delegate\n /// @dev this is used for backward compatibility with OZ interfaces for ERC20Votes and ERC20VotesComp.\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /// @dev thrown when attempting to delegate more votes than an address has free, or exceeding the max delegates\n error DelegationError();\n\n /// @notice mapping from a delegator and delegatee to the delegated amount.\n mapping(address => mapping(address => uint256)) private _delegatesVotesCount;\n\n /// @notice mapping from a delegator to the total number of delegated votes.\n mapping(address => uint256) public userDelegatedVotes;\n\n /// @notice list of delegates per user.\n mapping(address => EnumerableSet.AddressSet) private _delegates;\n\n /**\n * @notice Get the amount of votes currently delegated by `delegator` to `delegatee`.\n * @param delegator the account which is delegating votes to `delegatee`.\n * @param delegatee the account receiving votes from `delegator`.\n * @return the total amount of votes delegated to `delegatee` by `delegator`\n */\n function delegatesVotesCount(address delegator, address delegatee) public view virtual returns (uint256) {\n return _delegatesVotesCount[delegator][delegatee];\n }\n\n /**\n * @notice Get the list of delegates from `delegator`.\n * @param delegator the account which is delegating votes to delegates.\n * @return the list of delegated accounts.\n */\n function delegates(address delegator) public view returns (address[] memory) {\n return _delegates[delegator].values();\n }\n\n /**\n * @notice Get the number of delegates from `delegator`.\n * @param delegator the account which is delegating votes to delegates.\n * @return the number of delegated accounts.\n */\n function delegateCount(address delegator) public view returns (uint256) {\n return _delegates[delegator].length();\n }\n\n /**\n * @notice Delegate `amount` votes from the sender to `delegatee`.\n * @param delegatee the receivier of votes.\n * @param amount the amount of votes received.\n * @dev requires \"freeVotes(msg.sender) > amount\" and will not exceed max delegates\n */\n function incrementDelegation(address delegatee, uint256 amount) public virtual {\n _incrementDelegation(msg.sender, delegatee, amount);\n }\n\n /**\n * @notice Undelegate `amount` votes from the sender from `delegatee`.\n * @param delegatee the receivier of undelegation.\n * @param amount the amount of votes taken away.\n */\n function undelegate(address delegatee, uint256 amount) public virtual {\n _undelegate(msg.sender, delegatee, amount);\n }\n\n /**\n * @notice Delegate all votes `newDelegatee`. First undelegates from an existing delegate. If `newDelegatee` is zero, only undelegates.\n * @param newDelegatee the receiver of votes.\n * @dev undefined for `delegateCount(msg.sender) > 1`\n * NOTE This is meant for backward compatibility with the `ERC20Votes` and `ERC20VotesComp` interfaces from OpenZeppelin.\n */\n function delegate(address newDelegatee) external virtual {\n _delegate(msg.sender, newDelegatee);\n }\n\n function _delegate(address delegator, address newDelegatee) internal virtual {\n uint256 count = delegateCount(delegator);\n\n // undefined behavior for delegateCount > 1\n if (count > 1) revert DelegationError();\n\n address oldDelegatee;\n // if already delegated, undelegate first\n if (count == 1) {\n oldDelegatee = _delegates[delegator].at(0);\n _undelegate(delegator, oldDelegatee, _delegatesVotesCount[delegator][oldDelegatee]);\n }\n\n // redelegate only if newDelegatee is not empty\n if (newDelegatee != address(0)) {\n _incrementDelegation(delegator, newDelegatee, freeVotes(delegator));\n }\n emit DelegateChanged(delegator, oldDelegatee, newDelegatee);\n }\n\n function _incrementDelegation(\n address delegator,\n address delegatee,\n uint256 amount\n ) internal virtual {\n // Require freeVotes exceed the delegation size\n uint256 free = freeVotes(delegator);\n if (delegatee == address(0) || free < amount) revert DelegationError();\n\n bool newDelegate = _delegates[delegator].add(delegatee); // idempotent add\n if (newDelegate && delegateCount(delegator) > maxDelegates && !canContractExceedMaxDelegates[delegator]) {\n // if new delegate and exceeds max and not approved to exceed, revert\n revert DelegationError();\n }\n\n _delegatesVotesCount[delegator][delegatee] += amount;\n userDelegatedVotes[delegator] += amount;\n\n emit Delegation(delegator, delegatee, amount);\n _writeCheckpoint(delegatee, _add, amount);\n }\n\n function _undelegate(\n address delegator,\n address delegatee,\n uint256 amount\n ) internal virtual {\n uint256 newDelegates = _delegatesVotesCount[delegator][delegatee] - amount;\n\n if (newDelegates == 0) {\n require(_delegates[delegator].remove(delegatee));\n }\n\n _delegatesVotesCount[delegator][delegatee] = newDelegates;\n userDelegatedVotes[delegator] -= amount;\n\n emit Undelegation(delegator, delegatee, amount);\n _writeCheckpoint(delegatee, _subtract, amount);\n }\n\n function _writeCheckpoint(\n address delegatee,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private {\n Checkpoint[] storage ckpts = _checkpoints[delegatee];\n\n uint256 pos = ckpts.length;\n uint256 oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n uint256 newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = newWeight.safeCastTo224();\n } else {\n ckpts.push(Checkpoint({fromBlock: block.number.safeCastTo32(), votes: newWeight.safeCastTo224()}));\n }\n emit DelegateVotesChanged(delegatee, oldWeight, newWeight);\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /*///////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n /// NOTE: any \"removal\" of tokens from a user requires freeVotes(user) < amount.\n /// _decrementVotesUntilFree is called as a greedy algorithm to free up votes.\n /// It may be more gas efficient to free weight before burning or transferring tokens.\n\n function _burn(address from, uint256 amount) internal virtual override {\n _decrementVotesUntilFree(from, amount);\n super._burn(from, amount);\n }\n\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n _decrementVotesUntilFree(msg.sender, amount);\n return super.transfer(to, amount);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n _decrementVotesUntilFree(from, amount);\n return super.transferFrom(from, to, amount);\n }\n\n /// a greedy algorithm for freeing votes before a token burn/transfer\n /// frees up entire delegates, so likely will free more than `votes`\n function _decrementVotesUntilFree(address user, uint256 votes) internal {\n uint256 userFreeVotes = freeVotes(user);\n\n // early return if already free\n if (userFreeVotes >= votes) return;\n\n // cache total for batch updates\n uint256 totalFreed;\n\n // Loop through all delegates\n address[] memory delegateList = _delegates[user].values();\n\n // Free delegates until through entire list or under votes amount\n uint256 size = delegateList.length;\n for (uint256 i = 0; i < size && (userFreeVotes + totalFreed) < votes; i++) {\n address delegatee = delegateList[i];\n uint256 delegateVotes = _delegatesVotesCount[user][delegatee];\n if (delegateVotes != 0) {\n totalFreed += delegateVotes;\n\n require(_delegates[user].remove(delegatee)); // Remove from set. Should never fail.\n\n _delegatesVotesCount[user][delegatee] = 0;\n\n _writeCheckpoint(delegatee, _subtract, delegateVotes);\n emit Undelegation(user, delegatee, delegateVotes);\n }\n }\n\n userDelegatedVotes[user] -= totalFreed;\n }\n\n /*///////////////////////////////////////////////////////////////\n EIP-712 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n bytes32 public constant DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n require(block.timestamp <= expiry, \"ERC20MultiVotes: signature expired\");\n address signer = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry))\n )\n ),\n v,\n r,\n s\n );\n require(nonce == nonces[signer]++, \"ERC20MultiVotes: invalid nonce\");\n require(signer != address(0));\n _delegate(signer, delegatee);\n }\n}" + }, + "contracts/test/IonicFlywheel/token/ERC20MultiVotes.t.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPlus.sol\";\nimport {MockERC20MultiVotes, ERC20MultiVotes} from \"../mocks/MockERC20MultiVotes.sol\";\n\ncontract ERC20MultiVotesTest is DSTestPlus {\n MockERC20MultiVotes token;\n address constant delegate1 = address(0xDEAD);\n address constant delegate2 = address(0xBEEF);\n\n function setUp() public {\n token = new MockERC20MultiVotes(address(this));\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST ADMIN OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function testSetMaxDelegates(uint256 max) public {\n token.setMaxDelegates(max);\n require(token.maxDelegates() == max);\n }\n\n function testSetMaxDelegatesNonOwnerFails() public {\n hevm.prank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.setMaxDelegates(7);\n }\n\n function testCanContractExceedMax() public {\n token.setContractExceedMaxDelegates(address(this), true);\n require(token.canContractExceedMaxDelegates(address(this)));\n }\n\n function testCanContractExceedMaxNonOwnerFails() public {\n hevm.prank(address(1));\n hevm.expectRevert(bytes(\"UNAUTHORIZED\"));\n token.setContractExceedMaxDelegates(address(this), true);\n }\n\n function testCanContractExceedMaxNonContractFails() public {\n hevm.expectRevert(abi.encodeWithSignature(\"NonContractError()\"));\n token.setContractExceedMaxDelegates(address(1), true);\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST USER DELEGATION OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @notice test delegating different delegatees 8 times by multiple users and amounts\n function testDelegate(\n address[8] memory from,\n address[8] memory delegates,\n uint224[8] memory amounts\n ) public {\n token.setMaxDelegates(8);\n\n unchecked {\n uint224 sum;\n for (uint256 i = 0; i < 8; i++) {\n hevm.assume(sum + amounts[i] >= sum && from[i] != address(0) && delegates[i] != address(0));\n sum += amounts[i];\n\n token.mint(from[i], amounts[i]);\n\n uint256 userDelegatedBefore = token.userDelegatedVotes(from[i]);\n uint256 delegateVotesBefore = token.delegatesVotesCount(from[i], delegates[i]);\n uint256 votesBefore = token.getVotes(delegates[i]);\n\n hevm.prank(from[i]);\n token.incrementDelegation(delegates[i], amounts[i]);\n require(token.delegatesVotesCount(from[i], delegates[i]) == delegateVotesBefore + amounts[i]);\n require(token.userDelegatedVotes(from[i]) == userDelegatedBefore + amounts[i]);\n require(token.getVotes(delegates[i]) == votesBefore + amounts[i]);\n }\n }\n }\n\n function testDelegateToAddressZeroFails() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n hevm.expectRevert(abi.encodeWithSignature(\"DelegationError()\"));\n token.incrementDelegation(address(0), 50e18);\n }\n\n function testDelegateOverVotesFails() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 50e18);\n hevm.expectRevert(abi.encodeWithSignature(\"DelegationError()\"));\n token.incrementDelegation(delegate2, 51e18);\n }\n\n function testDelegateOverMaxDelegatesFails() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 50e18);\n token.incrementDelegation(delegate2, 1e18);\n hevm.expectRevert(abi.encodeWithSignature(\"DelegationError()\"));\n token.incrementDelegation(address(this), 1e18);\n }\n\n function testDelegateOverMaxDelegatesApproved() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.setContractExceedMaxDelegates(address(this), true);\n token.incrementDelegation(delegate1, 50e18);\n token.incrementDelegation(delegate2, 1e18);\n token.incrementDelegation(address(this), 1e18);\n\n require(token.delegateCount(address(this)) == 3);\n require(token.delegateCount(address(this)) > token.maxDelegates());\n require(token.userDelegatedVotes(address(this)) == 52e18);\n }\n\n /// @notice test undelegate twice, 2 tokens each after delegating by 4.\n function testUndelegate() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 4e18);\n\n token.undelegate(delegate1, 2e18);\n require(token.delegatesVotesCount(address(this), delegate1) == 2e18);\n require(token.userDelegatedVotes(address(this)) == 2e18);\n require(token.getVotes(delegate1) == 2e18);\n require(token.freeVotes(address(this)) == 98e18);\n\n token.undelegate(delegate1, 2e18);\n require(token.delegatesVotesCount(address(this), delegate1) == 0);\n require(token.userDelegatedVotes(address(this)) == 0);\n require(token.getVotes(delegate1) == 0);\n require(token.freeVotes(address(this)) == 100e18);\n }\n\n function testDecrementOverWeightFails() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 50e18);\n hevm.expectRevert(abi.encodeWithSignature(\"Panic(uint256)\", 17));\n token.undelegate(delegate1, 51e18);\n }\n\n function testBackwardCompatibleDelegate(\n address oldDelegatee,\n uint112 beforeDelegateAmount,\n address newDelegatee,\n uint112 mintAmount\n ) public {\n hevm.assume(mintAmount >= beforeDelegateAmount);\n token.mint(address(this), mintAmount);\n token.setMaxDelegates(2);\n\n if (oldDelegatee == address(0)) {\n hevm.expectRevert(abi.encodeWithSignature(\"DelegationError()\"));\n }\n\n token.incrementDelegation(oldDelegatee, beforeDelegateAmount);\n\n token.delegate(newDelegatee);\n\n uint256 expected = newDelegatee == address(0) ? 0 : mintAmount;\n uint256 expectedFree = newDelegatee == address(0) ? mintAmount : 0;\n\n require(oldDelegatee == newDelegatee || token.delegatesVotesCount(address(this), oldDelegatee) == 0);\n require(token.delegatesVotesCount(address(this), newDelegatee) == expected);\n require(token.userDelegatedVotes(address(this)) == expected);\n require(token.getVotes(newDelegatee) == expected);\n require(token.freeVotes(address(this)) == expectedFree);\n }\n\n function testBackwardCompatibleDelegateBySig(\n uint128 delegatorPk,\n address oldDelegatee,\n uint112 beforeDelegateAmount,\n address newDelegatee,\n uint112 mintAmount\n ) public {\n hevm.assume(delegatorPk != 0);\n address owner = hevm.addr(delegatorPk);\n\n hevm.assume(mintAmount >= beforeDelegateAmount);\n token.mint(owner, mintAmount);\n token.setMaxDelegates(2);\n\n if (oldDelegatee == address(0)) {\n hevm.expectRevert(abi.encodeWithSignature(\"DelegationError()\"));\n }\n\n hevm.prank(owner);\n token.incrementDelegation(oldDelegatee, beforeDelegateAmount);\n\n (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n delegatorPk,\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n token.DOMAIN_SEPARATOR(),\n keccak256(abi.encode(token.DELEGATION_TYPEHASH(), newDelegatee, 0, block.timestamp))\n )\n )\n );\n\n uint256 expected = newDelegatee == address(0) ? 0 : mintAmount;\n uint256 expectedFree = newDelegatee == address(0) ? mintAmount : 0;\n\n token.delegateBySig(newDelegatee, 0, block.timestamp, v, r, s);\n require(oldDelegatee == newDelegatee || token.delegatesVotesCount(owner, oldDelegatee) == 0);\n require(token.delegatesVotesCount(owner, newDelegatee) == expected);\n require(token.userDelegatedVotes(owner) == expected);\n require(token.getVotes(newDelegatee) == expected);\n require(token.freeVotes(owner) == expectedFree);\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST PAST VOTES\n //////////////////////////////////////////////////////////////*/\n\n function testPastVotes() public {\n hevm.roll(0);\n\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 4e18);\n\n uint256 block1 = block.number;\n require(token.numCheckpoints(delegate1) == 1);\n ERC20MultiVotes.Checkpoint memory checkpoint1 = token.checkpoints(delegate1, 0);\n require(checkpoint1.fromBlock == block1);\n require(checkpoint1.votes == 4e18);\n\n // Same block increase voting power\n token.incrementDelegation(delegate1, 4e18);\n\n require(token.numCheckpoints(delegate1) == 1);\n checkpoint1 = token.checkpoints(delegate1, 0);\n require(checkpoint1.fromBlock == block1);\n require(checkpoint1.votes == 8e18);\n\n hevm.roll(1);\n uint256 block2 = block.number;\n require(block2 == block1 + 1);\n\n // Next block decrease voting power\n token.undelegate(delegate1, 2e18);\n\n require(token.numCheckpoints(delegate1) == 2); // new checkpint\n\n // checkpoint 1 stays same\n checkpoint1 = token.checkpoints(delegate1, 0);\n require(checkpoint1.fromBlock == block1);\n require(checkpoint1.votes == 8e18);\n\n // new checkpoint 2\n ERC20MultiVotes.Checkpoint memory checkpoint2 = token.checkpoints(delegate1, 1);\n require(checkpoint2.fromBlock == block2);\n require(checkpoint2.votes == 6e18);\n\n hevm.roll(10);\n uint256 block3 = block.number;\n require(block3 == block2 + 9);\n\n // 10 blocks later increase voting power\n token.incrementDelegation(delegate1, 4e18);\n\n require(token.numCheckpoints(delegate1) == 3); // new checkpint\n\n // checkpoint 1 stays same\n checkpoint1 = token.checkpoints(delegate1, 0);\n require(checkpoint1.fromBlock == block1);\n require(checkpoint1.votes == 8e18);\n\n // checkpoint 2 stays same\n checkpoint2 = token.checkpoints(delegate1, 1);\n require(checkpoint2.fromBlock == block2);\n require(checkpoint2.votes == 6e18);\n\n // new checkpoint 3\n ERC20MultiVotes.Checkpoint memory checkpoint3 = token.checkpoints(delegate1, 2);\n require(checkpoint3.fromBlock == block3);\n require(checkpoint3.votes == 10e18);\n\n // finally, test getPastVotes between checkpoints\n require(token.getPastVotes(delegate1, block1) == 8e18);\n require(token.getPastVotes(delegate1, block2) == 6e18);\n require(token.getPastVotes(delegate1, block2 + 4) == 6e18);\n require(token.getPastVotes(delegate1, block3 - 1) == 6e18);\n\n hevm.expectRevert(abi.encodeWithSignature(\"BlockError()\"));\n token.getPastVotes(delegate1, block3); // revert same block\n\n hevm.roll(11);\n require(token.getPastVotes(delegate1, block3) == 10e18);\n }\n\n /*///////////////////////////////////////////////////////////////\n TEST ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function testDecrementUntilFreeWhenFree() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 10e18);\n token.incrementDelegation(delegate2, 20e18);\n require(token.freeVotes(address(this)) == 70e18);\n\n token.burn(address(this), 50e18);\n require(token.freeVotes(address(this)) == 20e18);\n\n require(token.delegatesVotesCount(address(this), delegate1) == 10e18);\n require(token.userDelegatedVotes(address(this)) == 30e18);\n require(token.getVotes(delegate1) == 10e18);\n require(token.delegatesVotesCount(address(this), delegate2) == 20e18);\n require(token.getVotes(delegate2) == 20e18);\n }\n\n function testDecrementUntilFreeSingle() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 10e18);\n token.incrementDelegation(delegate2, 20e18);\n require(token.freeVotes(address(this)) == 70e18);\n\n token.transfer(address(1), 80e18);\n require(token.freeVotes(address(this)) == 0);\n\n require(token.delegatesVotesCount(address(this), delegate1) == 0);\n require(token.userDelegatedVotes(address(this)) == 20e18);\n require(token.getVotes(delegate1) == 0);\n require(token.delegatesVotesCount(address(this), delegate2) == 20e18);\n require(token.getVotes(delegate2) == 20e18);\n }\n\n function testDecrementUntilFreeDouble() public {\n token.mint(address(this), 100e18);\n token.setMaxDelegates(2);\n\n token.incrementDelegation(delegate1, 10e18);\n token.incrementDelegation(delegate2, 20e18);\n require(token.freeVotes(address(this)) == 70e18);\n\n token.approve(address(1), 100e18);\n hevm.prank(address(1));\n token.transferFrom(address(this), address(1), 90e18);\n\n require(token.freeVotes(address(this)) == 10e18);\n\n require(token.delegatesVotesCount(address(this), delegate1) == 0);\n require(token.userDelegatedVotes(address(this)) == 0);\n require(token.getVotes(delegate1) == 0);\n require(token.delegatesVotesCount(address(this), delegate2) == 0);\n require(token.getVotes(delegate2) == 0);\n }\n}\n" + }, + "contracts/test/IonicFlywheel/token/FlywheelGaugeRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\n\nimport \"../../../ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol\";\nimport {ERC20Gauges} from \"../token/ERC20Gauges.sol\";\n\n/// @notice a contract which streams reward tokens to the FlywheelRewards module\ninterface IRewardsStream {\n /// @notice read and transfer reward token chunk to FlywheelRewards module\n function getRewards() external returns (uint256);\n}\n\n/**\n @title Flywheel Gauge Reward Stream\n @notice Distributes rewards from a stream based on gauge weights\n\n The contract assumes an arbitrary stream of rewards `S` of rewardToken. It chunks the rewards into cycles of length `l`.\n\n The allocation function for each cycle A(g, S) proportions the stream to each gauge such that SUM(A(g, S)) over all gauges <= S.\n NOTE it should be approximately S, but may be less due to truncation.\n\n Rewards are accumulated every time a new rewards cycle begins, and all prior rewards are cached in the previous cycle.\n When the Flywheel Core requests accrued rewards for a specific gauge:\n 1. All prior rewards before this cycle are distributed\n 2. Rewards for the current cycle are distributed proportionally to the remaining time in the cycle.\n If `e` is the cycle end, `t` is the min of e and current timestamp, and `p` is the prior updated time:\n For `A` accrued rewards over the cycle, distribute `min(A * (t-p)/(e-p), A)`.\n*/\ncontract FlywheelGaugeRewards is Auth, BaseFlywheelRewards {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n /// @notice thrown when trying to queue a new cycle during an old one.\n error CycleError();\n\n /// @notice thrown when trying to queue with 0 gauges\n error EmptyGaugesError();\n\n /// @notice emitted when a cycle has completely queued and started\n event CycleStart(uint32 indexed cycleStart, uint256 rewardAmount);\n\n /// @notice emitted when a single gauge is queued. May be emitted before the cycle starts if the queue is done via pagination.\n event QueueRewards(address indexed gauge, uint32 indexed cycleStart, uint256 rewardAmount);\n\n /// @notice the start of the current cycle\n uint32 public gaugeCycle;\n\n /// @notice the length of a rewards cycle\n uint32 public immutable gaugeCycleLength;\n\n /// @notice the start of the next cycle being partially queued\n uint32 internal nextCycle;\n\n // rewards that made it into a partial queue but didn't get completed\n uint112 internal nextCycleQueuedRewards;\n\n // the offset during pagination of the queue\n uint32 internal paginationOffset;\n\n /// @notice rewards queued from prior and current cycles\n struct QueuedRewards {\n uint112 priorCycleRewards;\n uint112 cycleRewards;\n uint32 storedCycle;\n }\n\n /// @notice mapping from gauges to queued rewards\n mapping(ERC20 => QueuedRewards) public gaugeQueuedRewards;\n\n /// @notice the gauge token for determining gauge allocations of the rewards stream\n ERC20Gauges public immutable gaugeToken;\n\n /// @notice contract to pull reward tokens from\n IRewardsStream public rewardsStream;\n\n constructor(\n IonicFlywheelCore _flywheel,\n address _owner,\n Authority _authority,\n ERC20Gauges _gaugeToken,\n IRewardsStream _rewardsStream\n ) BaseFlywheelRewards(_flywheel) Auth(_owner, _authority) {\n gaugeCycleLength = _gaugeToken.gaugeCycleLength();\n\n // seed initial gaugeCycle\n gaugeCycle = (block.timestamp.safeCastTo32() / gaugeCycleLength) * gaugeCycleLength;\n\n gaugeToken = _gaugeToken;\n\n rewardsStream = _rewardsStream;\n }\n\n /**\n @notice Iterates over all live gauges and queues up the rewards for the cycle\n @return totalQueuedForCycle the max amount of rewards to be distributed over the cycle\n */\n function queueRewardsForCycle() external requiresAuth returns (uint256 totalQueuedForCycle) {\n // next cycle is always the next even divisor of the cycle length above current block timestamp.\n uint32 currentCycle = (block.timestamp.safeCastTo32() / gaugeCycleLength) * gaugeCycleLength;\n uint32 lastCycle = gaugeCycle;\n\n // ensure new cycle has begun\n if (currentCycle <= lastCycle) revert CycleError();\n\n gaugeCycle = currentCycle;\n\n // queue the rewards stream and sanity check the tokens were received\n uint256 balanceBefore = rewardToken.balanceOf(address(this));\n totalQueuedForCycle = rewardsStream.getRewards();\n require(rewardToken.balanceOf(address(this)) - balanceBefore >= totalQueuedForCycle);\n\n // include uncompleted cycle\n totalQueuedForCycle += nextCycleQueuedRewards;\n\n // iterate over all gauges and update the rewards allocations\n address[] memory gauges = gaugeToken.gauges();\n\n _queueRewards(gauges, currentCycle, lastCycle, totalQueuedForCycle);\n\n nextCycleQueuedRewards = 0;\n paginationOffset = 0;\n\n emit CycleStart(currentCycle, totalQueuedForCycle);\n }\n\n /**\n @notice Iterates over all live gauges and queues up the rewards for the cycle\n */\n function queueRewardsForCyclePaginated(uint256 numRewards) external requiresAuth {\n // next cycle is always the next even divisor of the cycle length above current block timestamp.\n uint32 currentCycle = (block.timestamp.safeCastTo32() / gaugeCycleLength) * gaugeCycleLength;\n uint32 lastCycle = gaugeCycle;\n\n // ensure new cycle has begun\n if (currentCycle <= lastCycle) revert CycleError();\n\n if (currentCycle > nextCycle) {\n nextCycle = currentCycle;\n paginationOffset = 0;\n }\n\n uint32 offset = paginationOffset;\n\n // important to only calculate the reward amount once to prevent each page from having a different reward amount\n if (offset == 0) {\n // queue the rewards stream and sanity check the tokens were received\n uint256 balanceBefore = rewardToken.balanceOf(address(this));\n uint256 newRewards = rewardsStream.getRewards();\n require(rewardToken.balanceOf(address(this)) - balanceBefore >= newRewards);\n require(newRewards <= type(uint112).max); // safe cast\n nextCycleQueuedRewards += uint112(newRewards); // in case a previous incomplete cycle had rewards, add on\n }\n\n uint112 queued = nextCycleQueuedRewards;\n\n uint256 remaining = gaugeToken.numGauges() - offset;\n\n // Important to do non-strict inequality to include the case where the numRewards is just enough to complete the cycle\n if (remaining <= numRewards) {\n numRewards = remaining;\n gaugeCycle = currentCycle;\n nextCycleQueuedRewards = 0;\n paginationOffset = 0;\n emit CycleStart(currentCycle, queued);\n } else {\n paginationOffset = offset + numRewards.safeCastTo32();\n }\n\n // iterate over all gauges and update the rewards allocations\n address[] memory gauges = gaugeToken.gauges(offset, numRewards);\n\n _queueRewards(gauges, currentCycle, lastCycle, queued);\n }\n\n function _queueRewards(\n address[] memory gauges,\n uint32 currentCycle,\n uint32 lastCycle,\n uint256 totalQueuedForCycle\n ) internal {\n uint256 size = gauges.length;\n\n if (size == 0) revert EmptyGaugesError();\n\n for (uint256 i = 0; i < size; i++) {\n ERC20 gauge = ERC20(gauges[i]);\n\n QueuedRewards memory queuedRewards = gaugeQueuedRewards[gauge];\n\n // Cycle queue already started\n require(queuedRewards.storedCycle < currentCycle);\n assert(queuedRewards.storedCycle == 0 || queuedRewards.storedCycle >= lastCycle);\n\n uint112 completedRewards = queuedRewards.storedCycle == lastCycle ? queuedRewards.cycleRewards : 0;\n uint256 nextRewards = gaugeToken.calculateGaugeAllocation(address(gauge), totalQueuedForCycle);\n require(nextRewards <= type(uint112).max); // safe cast\n\n gaugeQueuedRewards[gauge] = QueuedRewards({\n priorCycleRewards: queuedRewards.priorCycleRewards + completedRewards,\n cycleRewards: uint112(nextRewards),\n storedCycle: currentCycle\n });\n\n emit QueueRewards(address(gauge), currentCycle, nextRewards);\n }\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param gauge the gauge to accrue rewards for\n @param lastUpdatedTimestamp the last updated time for gauge\n @return accruedRewards the amount of reward tokens accrued.\n */\n function getAccruedRewards(ERC20 gauge, uint32 lastUpdatedTimestamp)\n external\n override\n onlyFlywheel\n returns (uint256 accruedRewards)\n {\n QueuedRewards memory queuedRewards = gaugeQueuedRewards[gauge];\n\n uint32 cycle = gaugeCycle;\n bool incompleteCycle = queuedRewards.storedCycle > cycle;\n\n // no rewards\n if (queuedRewards.priorCycleRewards == 0 && (queuedRewards.cycleRewards == 0 || incompleteCycle)) {\n return 0;\n }\n\n // if stored cycle != 0 it must be >= the last queued cycle\n assert(queuedRewards.storedCycle >= cycle);\n\n uint32 cycleEnd = cycle + gaugeCycleLength;\n\n // always accrue prior rewards\n accruedRewards = queuedRewards.priorCycleRewards;\n uint112 cycleRewardsNext = queuedRewards.cycleRewards;\n\n if (incompleteCycle) {\n // If current cycle queue incomplete, do nothing to current cycle rewards or accrued\n } else if (block.timestamp >= cycleEnd) {\n // If cycle ended, accrue all rewards\n accruedRewards += cycleRewardsNext;\n cycleRewardsNext = 0;\n } else {\n uint32 beginning = lastUpdatedTimestamp > cycle ? lastUpdatedTimestamp : cycle;\n\n // otherwise, return proportion of remaining rewards in cycle\n uint32 elapsed = block.timestamp.safeCastTo32() - beginning;\n uint32 remaining = cycleEnd - beginning;\n\n // Casted up to avoid intermediate overflow\n // cannot end in an overflow of uint112 because elapsed <= remaining and cycleRewards <= uint112.max\n uint256 currentAccrued = (uint256(queuedRewards.cycleRewards) * elapsed) / remaining;\n\n // add proportion of current cycle to accrued rewards\n accruedRewards += currentAccrued;\n cycleRewardsNext -= uint112(currentAccrued);\n }\n\n gaugeQueuedRewards[gauge] = QueuedRewards({\n priorCycleRewards: 0,\n cycleRewards: cycleRewardsNext,\n storedCycle: queuedRewards.storedCycle\n });\n }\n\n /// @notice set the rewards stream contract\n function setRewardsStream(IRewardsStream newRewardsStream) external requiresAuth {\n rewardsStream = newRewardsStream;\n }\n}" + }, + "contracts/test/irm/AdjustableJumpRateModelTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { AdjustableJumpRateModel, InterestRateModelParams } from \"../../ionic/irms/AdjustableJumpRateModel.sol\";\n\ncontract InterestRateModelTest is BaseTest {\n AdjustableJumpRateModel adjustableJumpRateModel;\n InterestRateModelParams params;\n InterestRateModelParams newParams;\n\n function setUp() public {\n params = InterestRateModelParams({\n blocksPerYear: 10512000,\n baseRatePerYear: 0.5e16,\n multiplierPerYear: 0.18e18,\n jumpMultiplierPerYear: 4e18,\n kink: 0.8e18\n });\n adjustableJumpRateModel = new AdjustableJumpRateModel(params);\n }\n\n function testUpdateJrmParams() public {\n assertEq(adjustableJumpRateModel.blocksPerYear(), params.blocksPerYear);\n assertEq(adjustableJumpRateModel.baseRatePerBlock(), params.baseRatePerYear / params.blocksPerYear);\n\n newParams = InterestRateModelParams({\n blocksPerYear: 512000,\n baseRatePerYear: 0.7e16,\n multiplierPerYear: 0.18e18,\n jumpMultiplierPerYear: 4e18,\n kink: 0.8e18\n });\n\n adjustableJumpRateModel._setIrmParameters(newParams);\n vm.roll(1);\n\n assertEq(adjustableJumpRateModel.blocksPerYear(), newParams.blocksPerYear);\n assertEq(adjustableJumpRateModel.baseRatePerBlock(), newParams.baseRatePerYear / newParams.blocksPerYear);\n }\n}\n" + }, + "contracts/test/irm/PrudentiaIrmTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport { IRateComputer } from \"adrastia-periphery/rates/IRateComputer.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { PrudentiaInterestRateModel } from \"../../ionic/irms/PrudentiaInterestRateModel.sol\";\n\ncontract MockRateComputer is IRateComputer {\n mapping(address => uint64) public rates;\n\n function computeRate(address token) external view override returns (uint64) {\n return rates[token];\n }\n\n function setRate(address token, uint64 rate) public {\n rates[token] = rate;\n }\n}\n\ncontract PrudentiaIrmTest is BaseTest {\n using Math for uint64;\n\n MockRateComputer rateComputer;\n address token;\n PrudentiaInterestRateModel irm;\n uint256 blocksPerYear;\n\n function setUp() public {\n rateComputer = new MockRateComputer();\n token = address(0x1);\n blocksPerYear = 10512000;\n irm = new PrudentiaInterestRateModel(blocksPerYear, token, rateComputer);\n }\n\n function test_utilizationRate_zeroTotal() public {\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 0);\n }\n\n function test_utilizationRate_zero() public {\n uint256 cash = 100;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 0);\n }\n\n function test_utilizationRate_50() public {\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 5e17);\n }\n\n function test_utilizationRate_100() public {\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 1e18);\n }\n\n function test_getBorrowRate_100_a() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_100_b() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_50() public {\n uint64 rate = 5e17;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_1() public {\n uint64 rate = 1e16;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_0() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_1mantissa() public {\n uint64 rate = 1;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), 1); // Rounds up to 1. We don't want to return 0.\n }\n\n function test_getSupplyRate_100_100util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getSupplyRate_100_50util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), rate.ceilDiv(blocksPerYear) / 2);\n }\n\n function test_getSupplyRate_100_1util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 99;\n uint256 borrows = 1;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), rate.ceilDiv(blocksPerYear) / 100);\n }\n\n function test_getSupplyRate_100_0util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 0;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_0util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_100util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_50util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 50;\n uint256 borrows = 50;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_1util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 99;\n uint256 borrows = 1;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_100_50util_10rf() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 1e17;\n\n assertEq(\n irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa),\n (uint256(rate.ceilDiv(blocksPerYear) / 2) * (1e18 - reserveFactorMantissa)) / 1e18\n );\n }\n\n function test_getSupplyRate_100_50util_10rf_10reserves() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 10;\n cash += reserves;\n uint256 reserveFactorMantissa = 1e17;\n\n assertEq(\n irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa),\n (uint256(rate.ceilDiv(blocksPerYear) / 2) * (1e18 - reserveFactorMantissa)) / 1e18\n );\n }\n}\n" + }, + "contracts/test/LatestImplementationWhitelisted.t.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract LatestImplementationWhitelisted is BaseTest {\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n address[] poolsImplementationsSet;\n address[] marketsImplementationsSet;\n address[] pluginsSet;\n\n function testBscImplementations() public fork(BSC_MAINNET) {\n testPoolImplementations();\n testMarketImplementations();\n testPluginImplementations();\n }\n\n function testPolygonImplementations() public fork(POLYGON_MAINNET) {\n testPoolImplementations();\n testMarketImplementations();\n testPluginImplementations();\n }\n\n function afterForkSetUp() internal override {\n poolDirectory = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n }\n\n function testPoolImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n address implementation = comptroller.comptrollerImplementation();\n\n bool added = false;\n for (uint8 k = 0; k < poolsImplementationsSet.length; k++) {\n if (poolsImplementationsSet[k] == implementation) {\n added = true;\n }\n }\n\n if (!added) poolsImplementationsSet.push(implementation);\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < poolsImplementationsSet.length; k++) {\n emit log_address(poolsImplementationsSet[k]);\n\n address latestImpl = ionicAdmin.latestComptrollerImplementation(poolsImplementationsSet[k]);\n assertTrue(poolsImplementationsSet[k] == latestImpl, \"some pool is not upgraded the latest impl\");\n }\n }\n\n function testMarketImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n address implementation = market.implementation();\n\n bool added = false;\n for (uint8 k = 0; k < marketsImplementationsSet.length; k++) {\n if (marketsImplementationsSet[k] == implementation) {\n added = true;\n }\n }\n\n if (!added) marketsImplementationsSet.push(implementation);\n }\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < marketsImplementationsSet.length; k++) {\n emit log_address(marketsImplementationsSet[k]);\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = ionicAdmin.latestCErc20Delegate(\n CErc20Delegate(marketsImplementationsSet[k]).delegateType()\n );\n\n assertTrue(marketsImplementationsSet[k] == latestCErc20Delegate, \"some markets need to be upgraded\");\n }\n }\n\n function testPluginImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n CErc20PluginDelegate delegate = CErc20PluginDelegate(address(markets[j]));\n\n address plugin;\n try delegate.plugin() returns (IERC4626 _plugin) {\n plugin = address(_plugin);\n } catch {\n continue;\n }\n\n bool added = false;\n for (uint8 k = 0; k < pluginsSet.length; k++) {\n if (pluginsSet[k] == plugin) {\n added = true;\n }\n }\n\n if (!added) pluginsSet.push(plugin);\n }\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < pluginsSet.length; k++) {\n address latestPluginImpl = ionicAdmin.latestPluginImplementation(pluginsSet[k]);\n\n emit log_address(pluginsSet[k]);\n\n assertTrue(pluginsSet[k] == latestPluginImpl, \"some plugin is not upgraded to the latest impl\");\n }\n }\n}\n" + }, + "contracts/test/LeveredPositionTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest, BaseTest } from \"./config/MarketsTest.t.sol\";\nimport { DiamondBase, DiamondExtension } from \"../ionic/DiamondExtension.sol\";\n\nimport { LeveredPosition } from \"../ionic/levered/LeveredPosition.sol\";\nimport { LeveredPositionFactory, IFeeDistributor } from \"../ionic/levered/LeveredPositionFactory.sol\";\nimport { AlgebraSwapLiquidator } from \"../liquidators/AlgebraSwapLiquidator.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { AerodromeCLLiquidator } from \"../liquidators/AerodromeCLLiquidator.sol\";\nimport { AerodromeV2Liquidator } from \"../liquidators/AerodromeV2Liquidator.sol\";\n\nimport { LeveredPositionFactoryFirstExtension } from \"../ionic/levered/LeveredPositionFactoryFirstExtension.sol\";\nimport { LeveredPositionFactorySecondExtension } from \"../ionic/levered/LeveredPositionFactorySecondExtension.sol\";\nimport { ILeveredPositionFactory } from \"../ionic/levered/ILeveredPositionFactory.sol\";\nimport { LeveredPositionsLens } from \"../ionic/levered/LeveredPositionsLens.sol\";\nimport { LiquidatorsRegistry } from \"../liquidators/registry/LiquidatorsRegistry.sol\";\nimport { LiquidatorsRegistryExtension } from \"../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { SafeOwnable } from \"../ionic/SafeOwnable.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ncontract LeveredPositionLensTest is BaseTest {\n LeveredPositionsLens lens;\n ILeveredPositionFactory factory;\n\n function afterForkSetUp() internal override {\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n emit log_named_address(\"factory\", address(factory));\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n // lens = new LeveredPositionsLens();\n // lens.initialize(factory);\n }\n\n function testLPLens() public debuggingOnly fork(BSC_CHAPEL) {\n _testLPLens();\n }\n\n function _testLPLens() internal {\n address[] memory positions;\n bool[] memory closed;\n (positions, closed) = factory.getPositionsByAccount(0xb6c11605e971ab46B9BE4fDC48C9650A257075db);\n\n // address[] memory accounts = factory.getAccountsWithOpenPositions();\n // for (uint256 i = 0; i < accounts.length; i++) {\n // (positions, closed) = factory.getPositionsByAccount(accounts[i]);\n // if (positions.length > 0) break;\n // }\n\n uint256[] memory apys = new uint256[](positions.length);\n LeveredPosition[] memory pos = new LeveredPosition[](positions.length);\n for (uint256 j = 0; j < positions.length; j++) {\n apys[j] = 1e17;\n\n if (address(0) == positions[j]) revert(\"zero pos address\");\n pos[j] = LeveredPosition(positions[j]);\n }\n\n LeveredPositionsLens.PositionInfo[] memory infos = lens.getPositionsInfo(pos, apys);\n\n for (uint256 k = 0; k < infos.length; k++) {\n emit log_named_address(\"address\", address(pos[k]));\n emit log_named_uint(\"positionSupplyAmount\", infos[k].positionSupplyAmount);\n emit log_named_uint(\"positionValue\", infos[k].positionValue);\n emit log_named_uint(\"debtAmount\", infos[k].debtAmount);\n emit log_named_uint(\"debtValue\", infos[k].debtValue);\n emit log_named_uint(\"equityValue\", infos[k].equityValue);\n emit log_named_uint(\"equityAmount\", infos[k].equityAmount);\n emit log_named_int(\"currentApy\", infos[k].currentApy);\n emit log_named_uint(\"debtRatio\", infos[k].debtRatio);\n emit log_named_uint(\"liquidationThreshold\", infos[k].liquidationThreshold);\n emit log_named_uint(\"safetyBuffer\", infos[k].safetyBuffer);\n\n emit log(\"\");\n }\n }\n\n function testPrintLeveredPositions() public debuggingOnly fork(POLYGON_MAINNET) {\n address[] memory accounts = factory.getAccountsWithOpenPositions();\n\n emit log_named_array(\"accounts\", accounts);\n\n for (uint256 j = 0; j < accounts.length; j++) {\n address[] memory positions;\n bool[] memory closed;\n (positions, closed) = factory.getPositionsByAccount(accounts[j]);\n emit log_named_array(\"positions\", positions);\n //emit log_named_array(\"closed\", closed);\n }\n }\n\n function testScenarioLeverageFailed() public debuggingOnly forkAtBlock(MODE_MAINNET, 10672173) {\n address USER = 0x95Ce459B20586cf44ee6d295C4f28e1a134CF529;\n // IERC20Upgradeable(0x4200000000000000000000000000000000000006).approve(\n // address(factory),\n // 100000 ether\n // );\n vm.prank(ap.owner());\n ap.setAddress(\"IUniswapV2Router02\", 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45);\n vm.startPrank(USER);\n LeveredPosition position = factory.createAndFundPositionAtRatio(\n ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),\n IERC20Upgradeable(0x4200000000000000000000000000000000000006),\n 16754252276537996590,\n 3000000000000000000\n );\n emit log_named_address(\"position\", address(position));\n\n // vm.stopPrank();\n // ILiquidatorsRegistry registry = factory.liquidatorsRegistry();\n // vm.startPrank(registry.owner());\n // registry._setRedemptionStrategy(\n // new UniswapV3LiquidatorFunder(),\n // IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f),\n // IERC20Upgradeable(0x4200000000000000000000000000000000000006)\n // );\n // vm.stopPrank();\n // vm.startPrank(USER);\n\n vm.roll(10673509);\n position.adjustLeverageRatio(3000000000000000000);\n\n // vm.roll(10852409);\n // position.adjustLeverageRatio(3000000000000000000);\n\n // vm.roll(11268772);\n // position.adjustLeverageRatio(3000000000000000000);\n vm.stopPrank();\n }\n}\n\ncontract LeveredPositionFactoryTest is BaseTest {\n ILeveredPositionFactory factory;\n LeveredPositionsLens lens;\n\n function afterForkSetUp() internal override {\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function testChapelNetApy() public debuggingOnly fork(BSC_CHAPEL) {\n ICErc20 _stableMarket = ICErc20(address(1)); // DAI\n\n uint256 borrowRate = 5.2e16; // 5.2%\n vm.mockCall(\n address(_stableMarket),\n abi.encodeWithSelector(_stableMarket.borrowRatePerBlock.selector),\n abi.encode(borrowRate / factory.blocksPerYear())\n );\n\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\n emit log_named_uint(\"_borrowRate\", _borrowRate);\n\n int256 netApy = lens.getNetAPY(\n 2.7e16, // 2.7%\n 1e18, // supply amount\n ICErc20(address(0)), // BOMB\n _stableMarket,\n 2e18 // ratio\n );\n\n emit log_named_int(\"net apy\", netApy);\n\n // boosted APY = 2x 2.7% = 5.4 % of the equity\n // borrow APR = 5.2%\n // diff = 5.4 - 5.2 = 0.2%\n assertApproxEqRel(netApy, 0.2e16, 1e12, \"!net apy\");\n }\n}\n\nabstract contract LeveredPositionTest is MarketsTest {\n ICErc20 collateralMarket;\n ICErc20 stableMarket;\n ILeveredPositionFactory factory;\n ILiquidatorsRegistry registry;\n LeveredPosition position;\n LeveredPositionsLens lens;\n\n uint256 minLevRatio;\n uint256 maxLevRatio;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n registry = factory.liquidatorsRegistry();\n {\n // upgrade the registry\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n\n vm.startPrank(registry.owner());\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory oldExts = asBase._listExtensions();\n\n if (oldExts.length == 1) {\n asBase._registerExtension(newExt1, DiamondExtension(oldExts[0]));\n asBase._registerExtension(newExt2, DiamondExtension(address(0)));\n } else if (oldExts.length == 2) {\n asBase._registerExtension(newExt1, DiamondExtension(oldExts[0]));\n asBase._registerExtension(newExt2, DiamondExtension(oldExts[1]));\n }\n vm.stopPrank();\n }\n\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function upgradePoolAndMarkets() internal {\n _upgradeExistingPool(address(collateralMarket.comptroller()));\n _upgradeMarket(collateralMarket);\n _upgradeMarket(stableMarket);\n }\n\n function _unpauseMarkets(address collat, address stable) internal {\n ComptrollerFirstExtension asExtension = ComptrollerFirstExtension(address(ICErc20(stable).comptroller()));\n vm.startPrank(asExtension.admin());\n asExtension._setMintPaused(ICErc20(collat), false);\n asExtension._setMintPaused(ICErc20(stable), false);\n asExtension._setBorrowPaused(ICErc20(stable), false);\n vm.stopPrank();\n }\n\n function _configurePairAndLiquidator(address _collat, address _stable, IRedemptionStrategy _liquidator) internal {\n _configurePair(_collat, _stable);\n _configureTwoWayLiquidator(_collat, _stable, _liquidator);\n }\n\n function _configurePair(address _collat, address _stable) internal {\n collateralMarket = ICErc20(_collat);\n stableMarket = ICErc20(_stable);\n\n //upgradePoolAndMarkets();\n //_unpauseMarkets(_collat, _stable);\n vm.prank(factory.owner());\n factory._setPairWhitelisted(collateralMarket, stableMarket, true);\n }\n\n function _whitelistTestUser(address user) internal {\n address pool = address(collateralMarket.comptroller());\n PoolRolesAuthority pra = ffd.authoritiesRegistry().poolsAuthorities(pool);\n\n vm.startPrank(pra.owner());\n pra.setUserRole(user, pra.BORROWER_ROLE(), true);\n vm.stopPrank();\n }\n\n function _configureTwoWayLiquidator(\n address inputMarket,\n address outputMarket,\n IRedemptionStrategy strategy\n ) internal {\n IERC20Upgradeable inputToken = underlying(inputMarket);\n IERC20Upgradeable outputToken = underlying(outputMarket);\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategy(strategy, inputToken, outputToken);\n registry._setRedemptionStrategy(strategy, outputToken, inputToken);\n vm.stopPrank();\n }\n\n function underlying(address market) internal view returns (IERC20Upgradeable) {\n return IERC20Upgradeable(ICErc20(market).underlying());\n }\n\n struct Liquidator {\n IERC20Upgradeable inputToken;\n IERC20Upgradeable outputToken;\n IRedemptionStrategy strategy;\n }\n\n function _configureMultipleLiquidators(Liquidator[] memory liquidators) internal {\n IRedemptionStrategy[] memory strategies = new IRedemptionStrategy[](liquidators.length);\n IERC20Upgradeable[] memory inputTokens = new IERC20Upgradeable[](liquidators.length);\n IERC20Upgradeable[] memory outputTokens = new IERC20Upgradeable[](liquidators.length);\n for (uint256 i = 0; i < liquidators.length; i++) {\n strategies[i] = liquidators[i].strategy;\n inputTokens[i] = liquidators[i].inputToken;\n outputTokens[i] = liquidators[i].outputToken;\n }\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategies(strategies, inputTokens, outputTokens);\n vm.stopPrank();\n }\n\n function _fundMarketAndSelf(ICErc20 market, address whale) internal {\n IERC20Upgradeable token = IERC20Upgradeable(market.underlying());\n\n if (whale == address(0)) {\n whale = address(911);\n //vm.deal(address(token), whale, 100e18);\n }\n\n uint256 allTokens = token.balanceOf(whale);\n vm.prank(whale);\n token.transfer(address(this), allTokens / 20);\n\n if (market.getCash() < allTokens / 2) {\n _whitelistTestUser(whale);\n vm.startPrank(whale);\n token.approve(address(market), allTokens / 2);\n market.mint(allTokens / 2);\n vm.stopPrank();\n }\n }\n\n function _openLeveredPosition(\n address _positionOwner,\n uint256 _depositAmount\n ) internal returns (LeveredPosition _position, uint256 _maxRatio, uint256 _minRatio) {\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n collateralToken.transfer(_positionOwner, _depositAmount);\n\n vm.startPrank(_positionOwner);\n collateralToken.approve(address(factory), _depositAmount);\n _position = factory.createAndFundPosition(collateralMarket, stableMarket, collateralToken, _depositAmount);\n vm.stopPrank();\n\n _maxRatio = _position.getMaxLeverageRatio();\n emit log_named_uint(\"max ratio\", _maxRatio);\n _minRatio = _position.getMinLeverageRatio();\n emit log_named_uint(\"min ratio\", _minRatio);\n\n assertGt(_maxRatio, _minRatio, \"max ratio <= min ratio\");\n }\n\n function testOpenLeveredPosition() public virtual whenForking {\n assertApproxEqRel(position.getCurrentLeverageRatio(), 1e18, 4e16, \"initial leverage ratio should be 1.0 (1e18)\");\n }\n\n function testAnyLeverageRatio(uint64 ratioDiff) public debuggingOnly whenForking {\n // ratioDiff is between 0 and 2^64 ~= 18.446e18\n uint256 targetLeverageRatio = 1e18 + uint256(ratioDiff);\n emit log_named_uint(\"fuzz max ratio\", maxLevRatio);\n emit log_named_uint(\"fuzz min ratio\", minLevRatio);\n emit log_named_uint(\"target ratio\", targetLeverageRatio);\n vm.assume(targetLeverageRatio < maxLevRatio);\n vm.assume(minLevRatio < targetLeverageRatio);\n\n uint256 borrowedAssetPrice = stableMarket.comptroller().oracle().getUnderlyingPrice(stableMarket);\n (uint256 sd, uint256 bd) = position.getSupplyAmountDelta(targetLeverageRatio);\n emit log_named_uint(\"borrows delta val\", (bd * borrowedAssetPrice) / 1e18);\n emit log_named_uint(\"min borrow value\", ffd.getMinBorrowEth(stableMarket));\n\n uint256 equityAmount = position.getEquityAmount();\n emit log_named_uint(\"equity amount\", equityAmount);\n\n uint256 currentLeverageRatio = position.getCurrentLeverageRatio();\n emit log_named_uint(\"current ratio\", currentLeverageRatio);\n\n uint256 leverageRatioRealized = position.adjustLeverageRatio(targetLeverageRatio);\n emit log_named_uint(\"equity amount\", position.getEquityAmount());\n assertApproxEqRel(leverageRatioRealized, targetLeverageRatio, 4e16, \"target ratio not matching\");\n }\n\n function testMinMaxLeverageRatio() public whenForking {\n assertGt(maxLevRatio, minLevRatio, \"max ratio <= min ratio\");\n\n // attempting to adjust to minLevRatio - 0.01 should fail\n vm.expectRevert(abi.encodeWithSelector(LeveredPosition.BorrowStableFailed.selector, 0x3fa));\n position.adjustLeverageRatio((minLevRatio + 1e18) / 2);\n // just testing\n position.adjustLeverageRatio(maxLevRatio);\n // but adjusting to the minLevRatio + 0.01 should succeed\n position.adjustLeverageRatio(minLevRatio + 0.01e18);\n }\n\n function testMaxLeverageRatio() public whenForking {\n uint256 _equityAmount = position.getEquityAmount();\n uint256 rate = lens.getBorrowRateAtRatio(collateralMarket, stableMarket, _equityAmount, maxLevRatio);\n emit log_named_uint(\"borrow rate at max ratio\", rate);\n\n position.adjustLeverageRatio(maxLevRatio);\n assertApproxEqRel(position.getCurrentLeverageRatio(), maxLevRatio, 4e16, \"target max ratio not matching\");\n }\n\n function testRewardsAccruedClaimed() public whenForking {\n address[] memory flywheels = position.pool().getRewardsDistributors();\n if (flywheels.length > 0) {\n vm.warp(block.timestamp + 60 * 60 * 24);\n vm.roll(block.number + 10000);\n\n (ERC20[] memory rewardTokens, uint256[] memory amounts) = position.getAccruedRewards();\n\n ERC20 rewardToken;\n bool atLeastOneAccrued = false;\n for (uint256 i = 0; i < amounts.length; i++) {\n atLeastOneAccrued = amounts[i] > 0;\n if (atLeastOneAccrued) {\n rewardToken = rewardTokens[i];\n emit log_named_address(\"accrued from reward token\", address(rewardTokens[i]));\n break;\n }\n }\n\n assertEq(atLeastOneAccrued, true, \"!should have accrued at least one reward token\");\n\n if (atLeastOneAccrued) {\n uint256 rewardsBalanceBefore = rewardToken.balanceOf(address(this));\n position.claimRewards();\n uint256 rewardsBalanceAfter = rewardToken.balanceOf(address(this));\n assertGt(rewardsBalanceAfter - rewardsBalanceBefore, 0, \"should have claimed some rewards\");\n }\n } else {\n emit log(\"no flywheels/rewards for the pair pool\");\n }\n }\n\n function testLeverMaxDown() public whenForking {\n IERC20Upgradeable stableAsset = IERC20Upgradeable(stableMarket.underlying());\n IERC20Upgradeable collateralAsset = IERC20Upgradeable(collateralMarket.underlying());\n uint256 startingEquity = position.getEquityAmount();\n\n uint256 leverageRatioRealized = position.adjustLeverageRatio(maxLevRatio);\n assertApproxEqRel(leverageRatioRealized, maxLevRatio, 4e16, \"target ratio not matching\");\n\n // decrease the ratio in 10 equal steps\n uint256 ratioDiffStep = (maxLevRatio - 1e18) / 9;\n while (leverageRatioRealized > 1e18) {\n uint256 targetLeverDownRatio = leverageRatioRealized - ratioDiffStep;\n if (targetLeverDownRatio < minLevRatio) targetLeverDownRatio = 1e18;\n leverageRatioRealized = position.adjustLeverageRatio(targetLeverDownRatio);\n assertApproxEqRel(leverageRatioRealized, targetLeverDownRatio, 3e16, \"target lever down ratio not matching\");\n }\n\n uint256 withdrawAmount = position.closePosition();\n emit log_named_uint(\"withdraw amount\", withdrawAmount);\n assertApproxEqRel(startingEquity, withdrawAmount, 5e16, \"!withdraw amount\");\n\n assertEq(position.getEquityAmount(), 0, \"!nonzero equity amount\");\n assertEq(position.getCurrentLeverageRatio(), 0, \"!nonzero leverage ratio\");\n }\n}\n\ncontract WmaticMaticXLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 500e18;\n\n address wmaticMarket = 0xCb8D7c2690536d3444Da3d207f62A939483c8A93;\n address maticxMarket = 0x6ebdbEe1a509247B4A3ac3b73a43bd434C52C7c2;\n address wmaticWhale = 0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97;\n address maticxWhale = 0x72f0275444F2aF8dBf13F78D54A8D3aD7b6E68db;\n\n _configurePair(wmaticMarket, maticxMarket);\n _fundMarketAndSelf(ICErc20(wmaticMarket), wmaticWhale);\n _fundMarketAndSelf(ICErc20(maticxMarket), maticxWhale);\n\n // call amountOutAndSlippageOfSwap to cache the slippage\n {\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n IERC20Upgradeable stableToken = IERC20Upgradeable(stableMarket.underlying());\n\n vm.startPrank(wmaticWhale);\n collateralToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(collateralToken, 100e18, stableToken);\n vm.stopPrank();\n vm.startPrank(maticxWhale);\n stableToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(stableToken, 100e18, collateralToken);\n vm.stopPrank();\n\n emit log_named_uint(\"slippage coll->stable\", registry.getSlippage(collateralToken, stableToken));\n emit log_named_uint(\"slippage stable->coll\", registry.getSlippage(stableToken, collateralToken));\n }\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract StkBnbWBnbLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BSC_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 2e18;\n\n address stkBnbMarket = 0xAcfbf93d8fD1A9869bAb2328669dDba33296a421;\n address wbnbMarket = 0x3Af258d24EBdC03127ED6cEb8e58cA90835fbca5;\n address stkBnbWhale = 0x84b78452A97C5afDa1400943333F691448069A29; // algebra pool\n address wbnbWhale = 0x84b78452A97C5afDa1400943333F691448069A29; // algebra pool\n\n AlgebraSwapLiquidator liquidator = new AlgebraSwapLiquidator();\n _configurePairAndLiquidator(stkBnbMarket, wbnbMarket, liquidator);\n _fundMarketAndSelf(ICErc20(stkBnbMarket), stkBnbWhale);\n _fundMarketAndSelf(ICErc20(wbnbMarket), wbnbWhale);\n\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n collateralToken.transfer(address(this), depositAmount);\n collateralToken.approve(address(factory), depositAmount);\n position = factory.createAndFundPosition(collateralMarket, stableMarket, collateralToken, depositAmount);\n }\n}\n\ninterface TwoBrl {\n function minter() external view returns (address);\n\n function mint(address payable _to, uint256 _value) external returns (bool);\n}\n\ncontract Jbrl2BrlLeveredPositionTest is LeveredPositionTest {\n IonicComptroller pool;\n ComptrollerFirstExtension asExtension;\n\n function setUp() public fork(BSC_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1000e18;\n\n address twoBrlMarket = 0xf0a2852958aD041a9Fb35c312605482Ca3Ec17ba; // 2brl as collateral\n address jBrlMarket = 0x82A3103bc306293227B756f7554AfAeE82F8ab7a; // jbrl as borrowable\n address payable twoBrlWhale = payable(address(177)); // empty account\n address jBrlWhale = 0xA0695f78AF837F570bcc50f53e58Cda300798B65; // solidly pair BRZ-JBRL\n\n TwoBrl twoBrl = TwoBrl(ICErc20(twoBrlMarket).underlying());\n vm.prank(twoBrl.minter());\n twoBrl.mint(twoBrlWhale, depositAmount * 100);\n\n _configurePair(twoBrlMarket, jBrlMarket);\n _fundMarketAndSelf(ICErc20(twoBrlMarket), twoBrlWhale);\n _fundMarketAndSelf(ICErc20(jBrlMarket), jBrlWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract BombWbnbLeveredPositionTest is LeveredPositionTest {\n uint256 depositAmount = 100e18;\n address whale = 0xe7B7dF67C1fe053f1C6B965826d3bFF19603c482;\n address wbnbWhale = 0x57E30beb8054B248CE301FeabfD0c74677Fa40f0;\n uint256 ratioOnCreation = 1.0e18;\n uint256 minBorrowNative = 1e17;\n\n function setUp() public fork(BSC_CHAPEL) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n vm.mockCall(\n address(ffd),\n abi.encodeWithSelector(IFeeDistributor.minBorrowEth.selector),\n abi.encode(minBorrowNative)\n );\n\n address xMarket = 0x9B6E1039103812E0dcC1100a158e4a68014b2571; // BOMB\n address yMarket = 0x9dD00920f5B74A31177cbaB834AB0904703c31B1; // WBNB\n\n collateralMarket = ICErc20(xMarket);\n stableMarket = ICErc20(yMarket);\n\n //upgradePoolAndMarkets();\n\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n IERC20Upgradeable stableToken = IERC20Upgradeable(stableMarket.underlying());\n // call amountOutAndSlippageOfSwap to cache the slippage\n {\n vm.startPrank(whale);\n collateralToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(collateralToken, 1e18, stableToken);\n collateralToken.transfer(address(this), depositAmount);\n vm.stopPrank();\n\n vm.startPrank(wbnbWhale);\n stableToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(stableToken, 1e18, collateralToken);\n vm.stopPrank();\n }\n\n vm.prank(whale);\n collateralToken.transfer(address(this), depositAmount);\n\n collateralToken.approve(address(factory), depositAmount);\n position = factory.createAndFundPositionAtRatio(\n collateralMarket,\n stableMarket,\n collateralToken,\n depositAmount,\n ratioOnCreation\n );\n\n maxLevRatio = position.getMaxLeverageRatio();\n minLevRatio = position.getMinLeverageRatio();\n\n vm.label(address(position), \"Levered Position\");\n }\n}\n\ncontract PearlWUsdrWUsdrUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 0.000002e18;\n\n address lpTokenMarket = 0x06F61E22ef144f1cC4550D40ffbF681CB1C3aCAF;\n address wusdrMarket = 0x26EA46e975778662f98dAa0E7a12858dA9139262;\n address lpTokenWhale = 0x03Fa7A2628D63985bDFe07B95d4026663ED96065;\n address wUsdrWhale = 0x8711a1a52c34EDe8E61eF40496ab2618a8F6EA4B;\n\n _configurePair(lpTokenMarket, wusdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(wusdrMarket), wUsdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWUsdrUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 0.000002e18;\n\n address lpTokenMarket = 0x06F61E22ef144f1cC4550D40ffbF681CB1C3aCAF;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x03Fa7A2628D63985bDFe07B95d4026663ED96065;\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdcUsdcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 10e9;\n\n // LP token underlying 0xD17cb0f162f133e339C0BbFc18c36c357E681D6b\n address lpTokenMarket = 0x83DF24fE1B1eBF38048B91ffc4a8De0bAa88b891;\n address usdcMarket = 0x71A7037a42D0fB9F905a76B7D16846b2EACC59Aa;\n address lpTokenWhale = 0x97Bd59A8202F8263C2eC39cf6cF6B438D0B45876; // Thena Gauge\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrUsdcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 10e9;\n\n // LP token underlying 0xD17cb0f162f133e339C0BbFc18c36c357E681D6b\n address lpTokenMarket = 0x83DF24fE1B1eBF38048B91ffc4a8De0bAa88b891;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x97Bd59A8202F8263C2eC39cf6cF6B438D0B45876; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrDaiUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 2e18;\n\n // LP token underlying 0xBD02973b441Aa83c8EecEA158b98B5984bb1036E\n address lpTokenMarket = 0xBcE30B4D78cEb9a75A1Aa62156529c3592b3F08b;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x85Fa2331040933A02b154579fAbE6A6a5A765279; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrTngblUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.02e18;\n\n // LP token underlying 0x0Edc235693C20943780b76D79DD763236E94C751\n address lpTokenMarket = 0x2E870Aeee3D9d1eA29Ec93d2c0A99A4e0D5EB697;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0xdaeF32cA8D699015fcFB2884F6902fFCebE51c5b; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWbtcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.000000071325342755e18;\n\n // LP token underlying 0xb95E1C22dd965FafE926b2A793e9D6757b6613F4\n address lpTokenMarket = 0xffc8c8d747E52fAfbf973c64Bab10d38A6902c46;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x39976f6328ebA2a3C860b7DE5cF2c1bB41581FB8; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWethUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.004081e18;\n\n // LP token underlying 0x343D9a8D2Bc6A62390aEc764bb5b900C4B039127\n address lpTokenMarket = 0x343D9a8D2Bc6A62390aEc764bb5b900C4B039127;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x7D02A8b758791A03319102f81bF61E220F73e43D; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrMaticUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.05e18;\n\n // LP token underlying vAMM-WMATIC/USDR\n address lpTokenMarket = 0xfacEdA4f9731797102f040380aD5e234c92d1942;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0xdA0AfBeEEBef6dA2F060237D35cab759b99B13B6; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashAUsdcCashLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 300e18;\n\n // LP token underlying xCASH-USDC\n address lpTokenMarket = 0x1D2A7078a404ab970f951d5A6dbECD9e24838FB6;\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address lpTokenWhale = 0x35a499c15b4dDCf7e98628D415346B9795CCa80d;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n\n _configurePair(lpTokenMarket, cashMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroUsdcAUsdcCashLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 700e18;\n\n // LP token underlying xCASH-USDC\n address lpTokenMarket = 0x1D2A7078a404ab970f951d5A6dbECD9e24838FB6;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address lpTokenWhale = 0x35a499c15b4dDCf7e98628D415346B9795CCa80d;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroUsdcAUsdcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xUSDC-WETH05\n address lpTokenMarket = 0xC7cA03A0bE1dBAc350E5BfE5050fC5af6406490E;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashUsdcLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 300e18;\n\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(cashMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashAUsdcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xUSDC-WETH05\n address lpTokenMarket = 0xC7cA03A0bE1dBAc350E5BfE5050fC5af6406490E;\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n\n _configurePair(lpTokenMarket, cashMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroWethAWbtcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xWBTC-WETH05\n address lpTokenMarket = 0xCB1a06eff3459078c26516ae3a1dB44A61D2DbCA;\n address wethMarket = 0x2469B23354cb7cA50b798663Ec5812Bf28d15e9e;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\n\n _configurePair(lpTokenMarket, wethMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract DavosUsdcDusdLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 500e18;\n\n address dusdMarket = 0xE70d09dA78900A0429ee70b35200F70A30d7d2B9;\n address usdcMarket = 0x14787e50578d8c606C3d57bDbA53dD65Fd665449;\n address dusdWhale = 0xE69a1876bdACfa7A7a4F6D531BE2FDE843D2165C;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(dusdMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(dusdMarket), dusdWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWethUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e17;\n\n address wethMarket = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDCMarket = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n address wethWhale = 0x7380511493DD4c2f1dD75E9CCe5bD52C787D4B51;\n address USDCWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDCMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n _configurePair(wethMarket, USDCMarket);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n _fundMarketAndSelf(ICErc20(USDCMarket), USDCWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWethUSDTLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n address wethMarket = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDTMarket = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n address wethWhale = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDTWhale = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDTMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n\n _configurePair(wethMarket, USDTMarket);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n _fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWbtcUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e6;\n\n address wbtcMarket = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDCMarket = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n address wbtcWhale = 0x3f3429D28438Cc14133966820b8A9Ea61Cf1D4F0;\n address USDCWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDCMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n IERC20Upgradeable token = IERC20Upgradeable(ICErc20(wbtcMarket).underlying());\n\n _configurePair(wbtcMarket, USDCMarket);\n\n uint256 allTokens = token.balanceOf(wbtcWhale);\n\n vm.prank(wbtcWhale);\n token.transfer(address(this), allTokens);\n vm.stopPrank();\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWbtcUSDTLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e6;\n\n address wbtcMarket = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDTMarket = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n address wbtcWhale = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDTWhale = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDTMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n _configurePair(wbtcMarket, USDTMarket);\n _fundMarketAndSelf(ICErc20(wbtcMarket), wbtcWhale);\n _fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract HyUSDUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 20e18;\n\n address hyUsdMarket = 0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe;\n address usdcMarket = 0xa900A17a49Bc4D442bA7F72c39FA2108865671f0;\n address hyUsdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address usdcWhale = 0x70FF197c32E922700d3ff2483D250c645979855d;\n\n {\n IERC20Upgradeable x = IERC20Upgradeable(ICErc20(hyUsdMarket).underlying());\n IERC20Upgradeable y = IERC20Upgradeable(ICErc20(usdcMarket).underlying());\n IERC20Upgradeable[] memory xToYPath = new IERC20Upgradeable[](2);\n IERC20Upgradeable[] memory yToXPath = new IERC20Upgradeable[](2);\n\n IERC20Upgradeable eUSD = IERC20Upgradeable(0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4);\n xToYPath[0] = eUSD;\n yToXPath[0] = eUSD;\n xToYPath[1] = y;\n yToXPath[1] = x;\n\n vm.startPrank(registry.owner());\n registry._setOptimalSwapPath(IERC20Upgradeable(x), IERC20Upgradeable(y), xToYPath);\n registry._setOptimalSwapPath(IERC20Upgradeable(y), IERC20Upgradeable(x), yToXPath);\n vm.stopPrank();\n }\n\n // IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePair(hyUsdMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(hyUsdMarket), hyUsdWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract HyUSDeUSDLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 20e18;\n\n address hyUsdMarket = 0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe;\n address eUsdMarket = 0x9c2A4f9c5471fd36bE3BBd8437A33935107215A1;\n address hyUsdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address eUsdWhale = 0xa9E0588E82E9Ee1440f7e5375970a429D09646c1;\n AerodromeV2Liquidator aerodomeV2Liquidator = AerodromeV2Liquidator(0xD46b85409C43571145206B11D370A62AaeB22475);\n\n // IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePairAndLiquidator(hyUsdMarket, eUsdMarket, IRedemptionStrategy(address(aerodomeV2Liquidator)));\n _fundMarketAndSelf(ICErc20(hyUsdMarket), hyUsdWhale);\n _fundMarketAndSelf(ICErc20(eUsdMarket), eUsdWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract WSuperOETHWETHLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n address wsuperOeth = 0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6;\n address weth = 0x4200000000000000000000000000000000000006;\n\n uint256 depositAmount = 1e18;\n\n address wsuperOethMarket = 0xC462eb5587062e2f2391990b8609D2428d8Cf598;\n address wethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\n address wsuperOethWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address wethWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(wethMarket);\n\n uint256[] memory newSupplyCaps = new uint256[](1);\n newSupplyCaps[0] = 1e36;\n vm.prank(comptroller.admin());\n comptroller._setMarketSupplyCaps(cTokens, newSupplyCaps);\n\n AerodromeCLLiquidator aerodomeClLiquidator = new AerodromeCLLiquidator();\n vm.prank(registry.owner());\n registry._setWrappedToUnwrapped4626(address(wsuperOeth), address(0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3));\n // vm.prank(aerodomeClLiquidator.owner());\n // emit log_named_address(\"wsuperOeth\", address(wsuperOeth));\n // aerodomeClLiquidator.setWrappedToUnwrapped(\n // address(wsuperOeth),\n // 0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3\n // );\n _configurePairAndLiquidator(wsuperOethMarket, wethMarket, IRedemptionStrategy(address(aerodomeClLiquidator)));\n _fundMarketAndSelf(ICErc20(wsuperOethMarket), wsuperOethWhale);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\n/*\ncontract XYLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(X_CHAIN_ID) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n address xMarket = 0x...1;\n address yMarket = 0x...2;\n address xWhale = 0x...3;\n address yWhale = 0x...4;\n\n IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePairAndLiquidator(xMarket, yMarket, liquidator);\n _fundMarketAndSelf(ICErc20(xMarket), xWhale);\n _fundMarketAndSelf(ICErc20(yMarket), yWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n*/\n" + }, + "contracts/test/liquidators/AlgebraSwapLiquidatorTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport \"../../liquidators/AlgebraSwapLiquidator.sol\";\n\ncontract AlgebraSwapLiquidatorTest is BaseTest {\n AlgebraSwapLiquidator public liquidator;\n address algebraSwapRouter = 0x327Dd3208f0bCF590A66110aCB6e5e6941A4EfA0;\n address ankrBnbAddress = 0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827;\n address wbnbAddress = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n uint256 inputAmount = 1e18;\n\n function afterForkSetUp() internal override {\n liquidator = new AlgebraSwapLiquidator();\n }\n\n function testAlgebraAnkrBnbWbnb() public fork(BSC_MAINNET) {\n address ankrBnbWhale = 0x366B523317Cc95B1a4D30b33f8637882825C5E23;\n\n IERC20Upgradeable ankr = IERC20Upgradeable(ankrBnbAddress);\n vm.prank(ankrBnbWhale);\n ankr.transfer(address(liquidator), 1e18);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n ankr,\n inputAmount,\n abi.encode(wbnbAddress, algebraSwapRouter)\n );\n\n assertEq(address(outputToken), wbnbAddress, \"!wbnb output\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"!wbnb amount\");\n }\n\n function testAlgebraWbnbAnkrBnb() public fork(BSC_MAINNET) {\n address wbnbWhale = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\n\n IERC20Upgradeable wbnb = IERC20Upgradeable(wbnbAddress);\n vm.prank(wbnbWhale);\n wbnb.transfer(address(liquidator), 1e18);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n wbnb,\n inputAmount,\n abi.encode(ankrBnbAddress, algebraSwapRouter)\n );\n\n assertEq(address(outputToken), ankrBnbAddress, \"!ankrbnb output\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"!ankrbnb amount\");\n }\n\n function testModeKimV4RedemptionStrategy() public fork(MODE_MAINNET) {\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ezEthWhale = 0x2344F131B07E6AFd943b0901C55898573F0d1561;\n address kimV4Router = 0xAc48FcF1049668B285f3dC72483DF5Ae2162f7e8;\n address modeWETH = ap.getAddress(\"wtoken\");\n\n IERC20Upgradeable ezETH = IERC20Upgradeable(MODE_EZETH);\n vm.prank(ezEthWhale);\n ezETH.transfer(address(liquidator), 1e18);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n ezETH,\n inputAmount,\n abi.encode(modeWETH, kimV4Router)\n );\n\n assertEq(address(outputToken), modeWETH, \"!WETH output token\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"!weth amount\");\n }\n}\n" + }, + "contracts/test/liquidators/CurveSwapLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\n\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract CurveSwapLiquidatorTest is BaseTest {\n CurveSwapLiquidatorFunder private csl;\n address private maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\n address private val3EPSAddress = 0x5b5bD8913D766D005859CE002533D4838B0Ebbb5;\n\n address private lpTokenMai3EPS = 0x80D00D2c8d920a9253c3D65BA901250a55011b37;\n address private poolAddress = 0x68354c6E8Bbd020F9dE81EAf57ea5424ba9ef322;\n\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\n\n function afterForkSetUp() internal override {\n csl = new CurveSwapLiquidatorFunder();\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\n\n if (address(curveV1Oracle) == address(0)) {\n address[][] memory _poolUnderlyings = new address[][](1);\n _poolUnderlyings[0] = asArray(maiAddress, val3EPSAddress);\n curveV1Oracle = new CurveLpTokenPriceOracleNoRegistry();\n curveV1Oracle.initialize(asArray(lpTokenMai3EPS), asArray(poolAddress), _poolUnderlyings);\n }\n }\n\n // Curve pools need to be configured in the CurveV1 or CurveV2 oracles\n // We have not deployed CurveV2 oracle yet\n function testSwapCurveV1UsdtUsdc() public debuggingOnly fork(ARBITRUM_ONE) {\n address usdtAddress = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;\n address usdcAddress = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\n address usdtWhale = 0xB38e8c17e38363aF6EbdCb3dAE12e0243582891D; // binance\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(usdtAddress);\n uint256 inputAmount = 150e6;\n\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, usdtAddress, usdcAddress, ap.getAddress(\"wtoken\"));\n\n vm.prank(usdtWhale);\n inputToken.transfer(address(csl), inputAmount);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\n\n assertEq(address(outputToken), usdcAddress, \"output token does not match\");\n assertApproxEqAbs(outputAmount, inputAmount, 1e5, \"output amount does not match\");\n }\n\n function testSwapCurveV2EspBnbxBnb() public fork(BSC_MAINNET) {\n address bnbxAddress = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\n address wbnb = ap.getAddress(\"wtoken\");\n address bnbxWhale = 0x4eE98B27eeF58844E460922eC9Da7C05D32F284A;\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(bnbxAddress);\n uint256 inputAmount = 3e18;\n\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, bnbxAddress, wbnb, wbnb);\n\n vm.prank(bnbxWhale);\n inputToken.transfer(address(csl), inputAmount);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\n\n assertEq(address(outputToken), wbnb, \"output token does not match\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"output amount does not match\");\n }\n\n function testRedeemMAI() public fork(BSC_MAINNET) {\n ICurvePool curvePool = ICurvePool(poolAddress);\n\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\n\n uint256 inputAmount = 1e10;\n\n uint256 maiForVal3EPS = curvePool.get_dy(0, 1, inputAmount);\n emit log_uint(maiForVal3EPS);\n\n dealMai(address(csl), inputAmount);\n\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\n (IERC20Upgradeable shouldBeVal3EPS, uint256 outputAmount) = csl.redeem(\n IERC20Upgradeable(maiAddress),\n inputAmount,\n data\n );\n assertEq(address(shouldBeVal3EPS), val3EPSAddress, \"output token does not match\");\n\n assertEq(maiForVal3EPS, outputAmount, \"output amount does not match\");\n }\n\n function testEstimateInputAmount() public fork(BSC_MAINNET) {\n ICurvePool curvePool = ICurvePool(poolAddress);\n\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\n\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\n\n (IERC20Upgradeable inputToken, uint256 inputAmount) = csl.estimateInputAmount(2e10, data);\n\n emit log(\"input\");\n emit log_uint(inputAmount);\n emit log_address(address(inputToken));\n uint256 shouldBeAround2e10 = curvePool.get_dy(1, 0, inputAmount);\n emit log(\"should be around 2e10\");\n emit log_uint(shouldBeAround2e10);\n assertTrue(shouldBeAround2e10 >= 20e9 && shouldBeAround2e10 <= 23e9, \"rough estimate didn't work\");\n }\n\n function dealMai(address to, uint256 amount) internal {\n address whale = 0xc412eCccaa35621cFCbAdA4ce203e3Ef78c4114a; // anyswap\n vm.prank(whale);\n IERC20Upgradeable(maiAddress).transfer(to, amount);\n }\n}\n" + }, + "contracts/test/liquidators/IonicLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\nimport { IonicLiquidator, ILiquidator } from \"../../IonicLiquidator.sol\";\nimport { IonicUniV3Liquidator } from \"../../IonicUniV3Liquidator.sol\";\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport \"../../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport { UpgradesBaseTest } from \"../UpgradesBaseTest.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { ProxyAdmin } from \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport { PoolLens } from \"../../PoolLens.sol\";\n\ncontract MockRedemptionStrategy is IRedemptionStrategy {\n function redeem(IERC20Upgradeable, uint256, bytes memory) external returns (IERC20Upgradeable, uint256) {\n return (IERC20Upgradeable(address(0)), 1);\n }\n\n function name() public pure returns (string memory) {\n return \"MockRedemptionStrategy\";\n }\n}\n\ncontract IonicLiquidatorTest is UpgradesBaseTest {\n ILiquidator liquidator;\n address uniswapRouter;\n address swapRouter;\n IUniswapV3Quoter quoter;\n address usdcWhale;\n address wethWhale;\n address poolAddress;\n address uniV3PooForFlash;\n uint256 usdcMarketIndex;\n uint256 wethMarketIndex;\n\n AuthoritiesRegistry authRegistry;\n ILiquidatorsRegistry liquidatorsRegistry;\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == BSC_MAINNET) {\n uniswapRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n } else if (block.chainid == POLYGON_MAINNET) {\n uniswapRouter = 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff;\n swapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n quoter = IUniswapV3Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD; // aave reserve\n wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\n poolAddress = 0x22A705DEC988410A959B8b17C8c23E33c121580b; // Retro stables pool\n uniV3PooForFlash = 0xA374094527e1673A86dE625aa59517c5dE346d32; // usdc-wmatic\n usdcMarketIndex = 3;\n wethMarketIndex = 5;\n } else if (block.chainid == MODE_MAINNET) {\n uniswapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\n // uniswapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\n // swapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\n swapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\n //quoter = IUniswapV3Quoter(0x7Fd569b2021850fbA53887dd07736010aCBFc787); // other sup quoter?\n quoter = IUniswapV3Quoter(0x5E6AEbab1AD525f5336Bd12E6847b851531F72ba); // sup quoter\n usdcWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79; // vault\n wethWhale = 0xF4C85269240C1D447309fA602A90ac23F1CB0Dc0;\n poolAddress = 0xFB3323E24743Caf4ADD0fDCCFB268565c0685556;\n //uniV3PooForFlash = 0x293f2B2c17f8cEa4db346D87Ef5712C9dd0491EF; // kim weth-usdc pool\n uniV3PooForFlash = 0x047CF4b081ee80d2928cb2ce3F3C4964e26eB0B9; // kim usdt-usdc pool\n // uniV3PooForFlash = 0xf2e9C024F1C0B7a2a4ea11243C2D86A7b38DD72f; // sup univ2 0x34a1E3Db82f669f8cF88135422AfD80e4f70701A\n usdcMarketIndex = 1;\n wethMarketIndex = 0;\n // weth 0x4200000000000000000000000000000000000006\n // usdc 0xd988097fb8612cc24eeC14542bC03424c656005f\n }\n\n // vm.prank(ap.owner());\n // ap.setAddress(\"IUniswapV2Router02\", uniswapRouter);\n vm.prank(ap.owner());\n ap.setAddress(\"UNISWAP_V3_ROUTER\", uniswapRouter);\n\n authRegistry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\n liquidatorsRegistry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\n liquidator = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(liquidatorsRegistry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function testBsc() public fork(BSC_MAINNET) {\n testUpgrade();\n }\n\n function testPolygon() public fork(POLYGON_MAINNET) {\n testUpgrade();\n }\n\n function testUpgrade() internal {\n // in case these slots start to get used, please redeploy the FSL\n // with a larger storage gap to protect the owner variable of OwnableUpgradeable\n // from being overwritten by the IonicLiquidator storage\n for (uint256 i = 40; i < 51; i++) {\n address atSloti = address(uint160(uint256(vm.load(address(liquidator), bytes32(i)))));\n assertEq(\n atSloti,\n address(0),\n \"replace the FSL proxy/storage contract with a new one before the owner variable is overwritten\"\n );\n }\n }\n\n function testSpecificLiquidation() public debuggingOnly fork(MODE_MAINNET) {\n address borrower = 0x5834a3AAFA83A53822B313994Bb554d8E8c215dF;\n address debtMarketAddr = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address collateralMarketAddr = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n liquidator = ILiquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars;\n vars.borrower = borrower;\n vars.cErc20 = ICErc20(debtMarketAddr);\n vars.cTokenCollateral = ICErc20(collateralMarketAddr);\n vars.repayAmount = 0x408c7a4d7c4092;\n vars.flashSwapContract = 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc;\n vars.minProfitAmount = 0;\n vars.redemptionStrategies = new IRedemptionStrategy[](1);\n vars.strategyData = new bytes[](1);\n vars.debtFundingStrategies = new IFundsConversionStrategy[](0);\n vars.debtFundingStrategiesData = new bytes[](0);\n\n vars.redemptionStrategies[0] = IFundsConversionStrategy(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\n vars.strategyData[\n 0\n ] = hex\"0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e8\";\n\n liquidator.safeLiquidateToTokensWithFlashLoan(vars);\n }\n\n function testWithdrawalLiquidator() public debuggingOnly fork(MODE_MAINNET) {\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.prank(0x4200000000000000000000000000000000000016);\n (bool success, ) = address(liquidatorV3).call{ value: 1 ether }(\"\");\n require(success, \"transfer of funds failed\");\n\n uint256 beforeBalance = liquidatorV3.owner().balance;\n\n vm.prank(liquidatorV3.owner());\n liquidatorV3.withdrawAll();\n\n emit log_named_uint(\"balance of liquidator\", liquidatorV3.owner().balance);\n\n assertEq(liquidatorV3.owner().balance, beforeBalance + 1 ether);\n assertEq(address(liquidatorV3).balance, 0);\n }\n\n function testLiquidateAfterUpgradeLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\n // upgrade IonicLiquidator\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidatorV3.setPoolLens(address(lens));\n liquidatorV3.setHealthFactorThreshold(1e18);\n vm.stopPrank();\n\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf before\", healthFactor);\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: 0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d,\n repayAmount: 1134537086250983,\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n minProfitAmount: 0,\n redemptionStrategies: new IRedemptionStrategy[](0),\n strategyData: new bytes[](0),\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n });\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf after\", healthFactorAfter);\n }\n\n function testLiquidateAfterUpgradeLiquidatorExpressRelay() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\n // upgrade IonicLiquidator\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n address expressRelay = makeAddr(\"expressRelay\");\n\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidatorV3.setPoolLens(address(lens));\n liquidatorV3.setHealthFactorThreshold(95e16);\n liquidatorV3.setExpressRelay(expressRelay);\n vm.stopPrank();\n\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf before\", healthFactor);\n\n address borrower = address(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: borrower,\n repayAmount: 1134537086250983,\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n minProfitAmount: 0,\n redemptionStrategies: new IRedemptionStrategy[](0),\n strategyData: new bytes[](0),\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n });\n\n vm.mockCall(\n expressRelay,\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(liquidatorV3),\n abi.encode(borrower)\n ),\n abi.encode(false)\n );\n vm.expectRevert(\"invalid liquidation\");\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n vm.mockCall(\n expressRelay,\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(liquidatorV3),\n abi.encode(borrower)\n ),\n abi.encode(true)\n );\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf after\", healthFactorAfter);\n }\n\n // TODO test with marginal shortfall for liquidation penalty errors\n function _testLiquidatorLiquidate(address contractForFlashSwap) internal {\n IonicComptroller pool = IonicComptroller(poolAddress);\n // _upgradePoolWithExtension(Unitroller(payable(poolAddress)));\n //upgradeRegistry();\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.prank(pool.admin());\n pool._setBorrowCapForCollateral(address(usdcMarket), address(wethMarket), 1e36);\n }\n\n {\n vm.prank(pool.admin());\n pool._borrowCapWhitelist(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038, address(this), true);\n }\n\n {\n vm.prank(wethWhale);\n weth.transfer(address(this), 0.1e18);\n\n weth.approve(address(wethMarket), 1e36);\n require(wethMarket.mint(0.1e18) == 0, \"mint weth failed\");\n pool.enterMarkets(asArray(address(usdcMarket), address(wethMarket)));\n }\n\n {\n vm.startPrank(usdcWhale);\n usdc.approve(address(usdcMarket), 2e36);\n require(usdcMarket.mint(70e6) == 0, \"mint usdc failed\");\n vm.stopPrank();\n }\n\n {\n require(usdcMarket.borrow(50e6) == 0, \"borrow usdc failed\");\n\n // the collateral prices change\n BasePriceOracle mpo = pool.oracle();\n uint256 priceCollateral = mpo.getUnderlyingPrice(wethMarket);\n vm.mockCall(\n address(mpo),\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, wethMarket),\n abi.encode(priceCollateral / 10)\n );\n }\n\n (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) = liquidatorsRegistry\n .getRedemptionStrategies(weth, usdc);\n\n uint256 seizedAmount = liquidator.safeLiquidateToTokensWithFlashLoan(\n ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: address(this),\n repayAmount: 10e6,\n cErc20: usdcMarket,\n cTokenCollateral: wethMarket,\n flashSwapContract: contractForFlashSwap,\n minProfitAmount: 6,\n redemptionStrategies: strategies,\n strategyData: strategiesData,\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n })\n );\n\n emit log_named_uint(\"seized amount\", seizedAmount);\n require(seizedAmount > 0, \"didn't seize any assets\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV2LiquidatorFunderTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport { UniswapV2LiquidatorFunder } from \"../../liquidators/UniswapV2LiquidatorFunder.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract UniswapV2LiquidatorFunderTest is BaseTest {\n address maiAddress;\n address usdcAddress;\n UniswapV2LiquidatorFunder uv2lf;\n address uniswapV2Router;\n\n function afterForkSetUp() internal override {\n uv2lf = new UniswapV2LiquidatorFunder();\n uniswapV2Router = ap.getAddress(\"IUniswapV2Router02\");\n usdcAddress = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\n }\n\n function testConvertUsdcMai() public fork(BSC_MAINNET) {\n address[] memory swapPath = new address[](2);\n swapPath[0] = maiAddress;\n swapPath[1] = usdcAddress;\n bytes memory strategyData = abi.encode(uniswapV2Router, swapPath);\n\n uint256 outputUsdcExpected = 1e10;\n (IERC20Upgradeable inputToken, uint256 inputMaiRequired) = uv2lf.estimateInputAmount(\n outputUsdcExpected,\n strategyData\n );\n\n assertApproxEqAbs(inputMaiRequired, outputUsdcExpected, 1e9);\n assertEq(address(inputToken), maiAddress, \"!mai address\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV3LiquidatorFunderTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { IonicLiquidator } from \"../../IonicLiquidator.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../../external/uniswap/IUniswapV2Factory.sol\";\nimport { IUniswapV3Factory } from \"../../external/uniswap/IUniswapV3Factory.sol\";\nimport { Quoter } from \"../../external/uniswap/quoter/Quoter.sol\";\nimport { IUniswapV3Pool } from \"../../external/uniswap/IUniswapV3Pool.sol\";\nimport { ISwapRouter } from \"../../external/uniswap/ISwapRouter.sol\";\nimport { IComptroller } from \"../../external/compound/IComptroller.sol\";\nimport { IUniswapV2Router02 } from \"../../external/uniswap/IUniswapV2Router02.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract UniswapV3LiquidatorFunderTest is BaseTest {\n UniswapV3LiquidatorFunder private uniswapv3Liquidator;\n\n IERC20Upgradeable parToken;\n IERC20Upgradeable usdcToken;\n address univ3SwapRouter;\n uint256 poolFee;\n Quoter quoter;\n MasterPriceOracle mpo;\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n if (block.chainid == POLYGON_MAINNET) {\n quoter = new Quoter(0x1F98431c8aD98523631AE4a59f267346ea31F984);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n parToken = IERC20Upgradeable(0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128); // PAR, 18 decimals\n usdcToken = IERC20Upgradeable(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174); // USDC, 6 decimals\n poolFee = 500;\n }\n uniswapv3Liquidator = new UniswapV3LiquidatorFunder();\n }\n\n function testUniV3ParUsdcRedeem() public fork(POLYGON_MAINNET) {\n uint256 parInputAmount = 10000e18;\n address parTokenWhale = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; // Balancer V2\n\n vm.prank(parTokenWhale);\n parToken.transfer(address(uniswapv3Liquidator), parInputAmount);\n\n bytes memory data = abi.encode(parToken, usdcToken, poolFee, ISwapRouter(univ3SwapRouter), quoter);\n (IERC20Upgradeable outputToken, uint256 outputAmount) = uniswapv3Liquidator.redeem(parToken, parInputAmount, data);\n\n uint256 inputValue = (parInputAmount * mpo.price(address(parToken))) / 1e18;\n uint256 outputValue = (outputAmount * mpo.price(address(usdcToken))) / 1e6;\n\n assertEq(address(outputToken), address(usdcToken), \"!out tok\");\n assertApproxEqRel(inputValue, outputValue, 1e16, \"!out amount\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV3LiquidatorTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IonicUniV3Liquidator, IUniswapV3Pool, ILiquidator } from \"../../IonicUniV3Liquidator.sol\";\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IUniswapV2Router02 } from \"../../external/uniswap/IUniswapV2Router02.sol\";\nimport { IUniswapV3Factory } from \"../../external/uniswap/IUniswapV3Factory.sol\";\nimport { UniswapV2LiquidatorFunder } from \"../../liquidators/UniswapV2LiquidatorFunder.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { KimUniV2Liquidator } from \"../../liquidators/KimUniV2Liquidator.sol\";\n\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport \"./IonicLiquidatorTest.sol\";\n\ncontract UniswapV3LiquidatorTest is IonicLiquidatorTest {\n function testPolygonUniV3LiquidatorLiquidate() public fork(POLYGON_MAINNET) {\n IonicUniV3Liquidator _liquidator = new IonicUniV3Liquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), address(quoter));\n liquidator = _liquidator;\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testModeUniV3LiquidatorLiquidate() public debuggingOnly fork(MODE_MAINNET) {\n IonicUniV3Liquidator _liquidator = new IonicUniV3Liquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), address(quoter));\n liquidator = _liquidator;\n\n IonicComptroller pool = IonicComptroller(poolAddress);\n {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.startPrank(liquidatorsRegistry.owner());\n IRedemptionStrategy strategy = new UniswapV3LiquidatorFunder();\n liquidatorsRegistry._setRedemptionStrategy(strategy, weth, usdc);\n vm.stopPrank();\n vm.prank(OwnableUpgradeable(address(liquidator)).owner());\n liquidator._whitelistRedemptionStrategy(strategy, true);\n }\n }\n\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testModeKimUniV2Liquidator() public fork(MODE_MAINNET) {\n IonicLiquidator _liquidator = new IonicLiquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), ap.getAddress(\"IUniswapV2Router02\"), 30);\n liquidator = _liquidator;\n liquidator.setPoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n liquidator.setHealthFactorThreshold(1e18);\n\n IonicComptroller pool = IonicComptroller(poolAddress);\n {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.startPrank(liquidatorsRegistry.owner());\n IRedemptionStrategy strategy = KimUniV2Liquidator(0x6aC17D406a820fa464fFdc0940FCa7E60b3b36B7);\n liquidatorsRegistry._setRedemptionStrategy(strategy, weth, usdc);\n vm.stopPrank();\n liquidator._whitelistRedemptionStrategy(strategy, true);\n }\n }\n\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testUniV3PoolForFee() public debuggingOnly fork(MODE_MAINNET) {\n address wethAddr = 0x4200000000000000000000000000000000000006;\n address usdcAddr = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcAddr);\n IERC20Upgradeable weth = IERC20Upgradeable(wethAddr);\n\n IUniswapV2Router02 kimRouter = IUniswapV2Router02(0x5D61c537393cf21893BE619E36fC94cd73C77DD3);\n address factoryAddress;\n //factory = kimRouter.factory();\n factoryAddress = 0xC33Ce0058004d44E7e1F366E5797A578fDF38584;\n IUniswapV3Factory factory = IUniswapV3Factory(factoryAddress);\n address pool;\n\n uint256 feeConfig = liquidatorsRegistry.uniswapV3Fees(usdc, weth);\n emit log_named_uint(\"feeConfig\", feeConfig);\n\n if (feeConfig == 0) {\n pool = factory.getPool(wethAddr, usdcAddr, uint24(feeConfig));\n emit log_named_address(\"Pool at fee 0\", pool);\n }\n\n pool = factory.getPool(wethAddr, usdcAddr, 500);\n emit log_named_address(\"Pool at fee 500\", pool);\n }\n}\n" + }, + "contracts/test/LiquidatorsRegistryTest.t.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { LiquidatorsRegistry } from \"../liquidators/registry/LiquidatorsRegistry.sol\";\nimport { LiquidatorsRegistryExtension } from \"../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport \"../ionic/DiamondExtension.sol\";\nimport { SafeOwnable } from \"../ionic/SafeOwnable.sol\";\n\ncontract LiquidatorsRegistryTest is BaseTest {\n ILiquidatorsRegistry registry;\n\n // all-chains\n IERC20Upgradeable stable;\n IERC20Upgradeable wtoken;\n MasterPriceOracle mpo;\n\n // chapel\n IERC20Upgradeable chapelBomb = IERC20Upgradeable(0xe45589fBad3A1FB90F5b2A8A3E8958a8BAB5f768);\n IERC20Upgradeable chapelTUsd = IERC20Upgradeable(0x4f1885D25eF219D3D4Fa064809D6D4985FAb9A0b);\n IERC20Upgradeable chapelTDai = IERC20Upgradeable(0x8870f7102F1DcB1c35b01af10f1baF1B00aD6805);\n\n // bsc\n IERC20Upgradeable wbnbBusdLpToken = IERC20Upgradeable(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16);\n IERC20Upgradeable usdcBusdCakeLpToken = IERC20Upgradeable(0x2354ef4DF11afacb85a5C7f98B624072ECcddbB1);\n IERC20Upgradeable ankrAnkrBnbGammaLpToken = IERC20Upgradeable(0x3f8f3caefF393B1994a9968E835Fd38eCba6C1be);\n\n // polygon\n IERC20Upgradeable usdr3CrvCurveLpToken = IERC20Upgradeable(0xa138341185a9D0429B0021A11FB717B225e13e1F);\n IERC20Upgradeable maticxBbaBalancerStableLpToken = IERC20Upgradeable(0xb20fC01D21A50d2C734C4a1262B4404d41fA7BF0);\n IERC20Upgradeable stMaticBbaBalancerStableLpToken = IERC20Upgradeable(0x216690738Aac4aa0C4770253CA26a28f0115c595);\n IERC20Upgradeable mimoParBalancerWeightedLpToken = IERC20Upgradeable(0x82d7f08026e21c7713CfAd1071df7C8271B17Eae);\n\n function afterForkSetUp() internal override {\n registry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\n stable = IERC20Upgradeable(ap.getAddress(\"stableToken\"));\n wtoken = IERC20Upgradeable(ap.getAddress(\"wtoken\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testResetStrategies() public debuggingOnly fork(BSC_CHAPEL) {\n upgradeRegistry();\n\n IRedemptionStrategy[] memory strategiesConfig = new IRedemptionStrategy[](3);\n IERC20Upgradeable[] memory inputTokensConfig = new IERC20Upgradeable[](3);\n IERC20Upgradeable[] memory outputTokensConfig = new IERC20Upgradeable[](3);\n {\n strategiesConfig[0] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[1] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[2] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n inputTokensConfig[0] = IERC20Upgradeable(chapelBomb);\n inputTokensConfig[1] = IERC20Upgradeable(chapelTUsd);\n inputTokensConfig[2] = IERC20Upgradeable(chapelTDai);\n outputTokensConfig[0] = IERC20Upgradeable(chapelTUsd);\n outputTokensConfig[1] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[2] = IERC20Upgradeable(chapelBomb);\n }\n\n bool matchingBefore = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingBefore, false, \"should not match prior\");\n\n vm.prank(ap.getAddress(\"deployer\"));\n registry._resetRedemptionStrategies(strategiesConfig, inputTokensConfig, outputTokensConfig);\n\n bool matchingAfter = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingAfter, true, \"should match after\");\n }\n\n function testResetDuplicatingStrategies() public debuggingOnly fork(BSC_CHAPEL) {\n upgradeRegistry();\n\n IRedemptionStrategy[] memory strategiesConfig = new IRedemptionStrategy[](4);\n IERC20Upgradeable[] memory inputTokensConfig = new IERC20Upgradeable[](4);\n IERC20Upgradeable[] memory outputTokensConfig = new IERC20Upgradeable[](4);\n {\n strategiesConfig[0] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[1] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[2] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[3] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n inputTokensConfig[0] = IERC20Upgradeable(chapelBomb);\n inputTokensConfig[1] = IERC20Upgradeable(chapelTUsd);\n inputTokensConfig[2] = IERC20Upgradeable(chapelTDai);\n inputTokensConfig[3] = IERC20Upgradeable(chapelTDai);\n outputTokensConfig[0] = IERC20Upgradeable(chapelTUsd);\n outputTokensConfig[1] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[2] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[3] = IERC20Upgradeable(chapelBomb);\n }\n\n bool matchingBefore = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingBefore, false, \"should not match prior\");\n\n vm.prank(ap.getAddress(\"deployer\"));\n registry._resetRedemptionStrategies(strategiesConfig, inputTokensConfig, outputTokensConfig);\n\n bool matchingAfter = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingAfter, true, \"should match after\");\n }\n\n function testRedemptionPathChapel() public debuggingOnly fork(BSC_CHAPEL) {\n emit log(\"bomb tusd\");\n emit log(registry.redemptionStrategiesByTokens(chapelBomb, chapelTDai).name());\n emit log(\"tusd bomb\");\n emit log(registry.redemptionStrategiesByTokens(chapelTDai, chapelBomb).name());\n\n (IRedemptionStrategy strategy, bytes memory strategyData) = registry.getRedemptionStrategy(chapelBomb, chapelTDai);\n }\n\n function testInputTokensChapel() public debuggingOnly fork(BSC_CHAPEL) {\n address[] memory inputTokens = registry.getInputTokensByOutputToken(chapelBomb);\n\n emit log_named_array(\"inputs\", inputTokens);\n }\n\n function testInputTokensBsc() public debuggingOnly fork(BSC_MAINNET) {\n address[] memory inputTokens = registry.getInputTokensByOutputToken(stable);\n\n emit log_named_array(\"inputs\", inputTokens);\n }\n\n function _swap(\n address whale,\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken,\n uint256 tolerance\n ) internal {\n vm.startPrank(whale);\n inputToken.approve(address(registry), inputAmount);\n (uint256 swappedAmountOut, uint256 slippage) = registry.amountOutAndSlippageOfSwap(\n inputToken,\n inputAmount,\n outputToken\n );\n vm.stopPrank();\n\n emit log_named_uint(\"received\", swappedAmountOut);\n assertLt(slippage, tolerance, \"slippage too high\");\n }\n\n function testSwappingUniLpBsc() public fork(BSC_MAINNET) {\n address lpTokenWhale = 0x14B2e8329b8e06BCD524eb114E23fAbD21910109;\n\n IERC20Upgradeable inputToken = usdcBusdCakeLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = stable;\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingGammaLpBsc() public fork(BSC_MAINNET) {\n address lpTokenWhale = 0xd44ad81474d075c3Bf0307830977A5804BfC0bc7; // thena gauge\n\n IERC20Upgradeable inputToken = ankrAnkrBnbGammaLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = wtoken;\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingBalancerStableLpPolygon() public fork(POLYGON_MAINNET) {\n // TODO: run deployment to fix the liquidation path and set the balancer liquidator data\n address lpTokenWhale = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; // balancer gauge\n\n // maticx-wmatic aave boosted\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = wtoken;\n\n _swap(lpTokenWhale, maticxBbaBalancerStableLpToken, inputAmount, outputToken, 1e16);\n\n // stmatic-wmatic aave boosted\n _swap(lpTokenWhale, stMaticBbaBalancerStableLpToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingBalancerWeightedLpPolygon() public fork(POLYGON_MAINNET) {\n address lpTokenWhale = 0xbB60ADbe38B4e6ab7fb0f9546C2C1b665B86af11; // mimo staker\n\n IERC20Upgradeable inputToken = mimoParBalancerWeightedLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = IERC20Upgradeable(0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128); // PAR\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n\n address tusdWhale = 0x161FbE0943Af4A39a50262026A81a243B635982d; // old XBombSwap\n address tdaiWhale = 0xd816eb4660615BBF080ddf425F28ea4AF30d04D5; // old XBombSwap\n address bombWhale = 0xd816eb4660615BBF080ddf425F28ea4AF30d04D5; // old XBombSwap\n\n function testSwappingBombTDaiChapel() public debuggingOnly fork(BSC_CHAPEL) {\n IERC20Upgradeable inputToken = chapelBomb;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = chapelTDai;\n\n _swap(bombWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n\n function testSwappingTUsdBombChapel() public debuggingOnly fork(BSC_CHAPEL) {\n IERC20Upgradeable inputToken = chapelTUsd;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = chapelBomb;\n\n _swap(tusdWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n}\n" + }, + "contracts/test/LiquidityMining.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Vm.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { FlywheelStaticRewards } from \"../ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol\";\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AuthoritiesRegistry } from \"../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\n\nimport { MockPriceOracle } from \"../oracles/1337/MockPriceOracle.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { IonicFlywheelLensRouter } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract LiquidityMiningTest is BaseTest {\n MockERC20 underlyingToken;\n MockERC20 rewardToken;\n\n JumpRateModel interestModel;\n IonicComptroller comptroller;\n CErc20Delegate cErc20Delegate;\n ICErc20 cErc20;\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicFlywheel flywheel;\n FlywheelStaticRewards rewards;\n IonicFlywheelLensRouter flywheelClaimer;\n\n address user = address(1337);\n\n uint8 baseDecimal;\n uint8 rewardDecimal;\n\n address[] markets;\n IonicFlywheelCore[] flywheelsToClaim;\n\n function setUpBaseContracts(uint8 _baseDecimal, uint8 _rewardDecimal) public {\n baseDecimal = _baseDecimal;\n rewardDecimal = _rewardDecimal;\n underlyingToken = new MockERC20(\"UnderlyingToken\", \"UT\", baseDecimal);\n rewardToken = new MockERC20(\"RewardToken\", \"RT\", rewardDecimal);\n interestModel = new JumpRateModel(2343665, 1 * 10**baseDecimal, 1 * 10**baseDecimal, 4 * 10**baseDecimal, 0.8e18);\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1 * 10**(baseDecimal - 2));\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n cErc20Delegate = new CErc20Delegate();\n // set the new delegate as the latest\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), abi.encode(address(0)));\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n cErc20DelegateExtensions[1] = cErc20Delegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n }\n\n function setUpPoolAndMarket() public {\n MockPriceOracle priceOracle = new MockPriceOracle(10);\n Comptroller tempComptroller = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))),\n false,\n 0.1e18,\n 1.1e18,\n address(priceOracle)\n );\n\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, user, poolAuth.BORROWER_ROLE(), true);\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"CUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n cErc20 = allMarkets[allMarkets.length - 1];\n }\n\n function setUpFlywheel() public {\n IonicFlywheel impl = new IonicFlywheel();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(dpa), \"\");\n flywheel = IonicFlywheel(address(proxy));\n flywheel.initialize(rewardToken, FlywheelStaticRewards(address(0)), IFlywheelBooster(address(0)), address(this));\n rewards = new FlywheelStaticRewards(IonicFlywheelCore(address(flywheel)), address(this), Authority(address(0)));\n flywheel.setFlywheelRewards(rewards);\n\n flywheelClaimer = new IonicFlywheelLensRouter(poolDirectory);\n\n flywheel.addStrategyForRewards(ERC20(address(cErc20)));\n\n // add flywheel as rewardsDistributor to call flywheelPreBorrowAction / flywheelPreSupplyAction\n require(comptroller._addRewardsDistributor(address(flywheel)) == 0);\n\n // seed rewards to flywheel\n rewardToken.mint(address(rewards), 100 * 10**rewardDecimal);\n\n // Start reward distribution at 1 token per second\n rewards.setRewardsInfo(\n ERC20(address(cErc20)),\n FlywheelStaticRewards.RewardsInfo({ rewardsPerSecond: uint224(1 * 10**rewardDecimal), rewardsEndTimestamp: 0 })\n );\n\n // preparation for a later call\n flywheelsToClaim.push(IonicFlywheelCore(address(flywheel)));\n }\n\n function _initialize(uint8 _baseDecimal, uint8 _rewardDecimal) internal {\n setUpBaseContracts(_baseDecimal, _rewardDecimal);\n setUpPoolAndMarket();\n setUpFlywheel();\n deposit(1 * 10**_baseDecimal);\n vm.warp(block.timestamp + 1);\n }\n\n function deposit(uint256 _amount) public {\n underlyingToken.mint(user, _amount);\n vm.startPrank(user);\n underlyingToken.approve(address(cErc20), _amount);\n comptroller.enterMarkets(markets);\n cErc20.mint(_amount);\n vm.stopPrank();\n }\n\n function _testIntegration() internal {\n uint256 percentFee = flywheel.performanceFee();\n uint224 percent100 = 100e16; //flywheel.ONE();\n\n // store expected rewards per token (1 token per second over total supply)\n uint256 rewardsPerTokenPlusFee = (1 * 10**rewardDecimal * 1 * 10**baseDecimal) / cErc20.totalSupply();\n uint256 rewardsPerTokenForFee = (rewardsPerTokenPlusFee * percentFee) / percent100;\n uint256 rewardsPerToken = rewardsPerTokenPlusFee - rewardsPerTokenForFee;\n\n // store expected user rewards (user balance times reward per second over 1 token)\n uint256 userRewards = (rewardsPerToken * cErc20.balanceOf(user)) / (1 * 10**baseDecimal);\n\n ERC20 asErc20 = ERC20(address(cErc20));\n // accrue rewards and check against expected\n assertEq(flywheel.accrue(asErc20, user), userRewards, \"!accrue amount\");\n\n // check market index\n (uint224 index, ) = flywheel.strategyState(asErc20);\n assertEq(index, 10**rewardDecimal + rewardsPerToken, \"!index\");\n\n // claim and check user balance\n flywheelClaimer.claimRewardsForMarket(user, asErc20, flywheelsToClaim, asArray(true));\n assertEq(rewardToken.balanceOf(user), userRewards, \"!user rewards\");\n\n // mint more tokens by user and rerun test\n deposit(1 * 10**baseDecimal);\n\n // for next test, advance 10 seconds instead of 1 (multiply expectations by 10)\n vm.warp(block.timestamp + 10);\n\n uint256 rewardsPerToken2PlusFee = (1 * 10**rewardDecimal * 1 * 10**baseDecimal) / cErc20.totalSupply();\n uint256 rewardsPerToken2ForFee = (rewardsPerToken2PlusFee * percentFee) / percent100;\n uint256 rewardsPerToken2 = rewardsPerToken2PlusFee - rewardsPerToken2ForFee;\n\n uint256 userRewards2 = (10 * (rewardsPerToken2 * cErc20.balanceOf(user))) / (1 * 10**baseDecimal);\n\n // accrue all unclaimed rewards and claim them\n flywheelClaimer.claimRewardsForMarket(user, asErc20, flywheelsToClaim, asArray(true));\n\n emit log_named_uint(\"userRewards\", userRewards);\n emit log_named_uint(\"userRewards2\", userRewards2);\n // user balance should accumulate from both rewards\n assertEq(rewardToken.balanceOf(user), userRewards + userRewards2, \"balance mismatch\");\n }\n\n function testIntegrationRewardStandard(uint8 i, uint8 j) public {\n vm.assume(i > 1);\n vm.assume(j > 1);\n vm.assume(i < 19);\n vm.assume(j < 19);\n\n _initialize(i, j);\n _testIntegration();\n }\n}\n" + }, + "contracts/test/MaxBorrowTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./helpers/WithPool.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract MockAsset is MockERC20 {\n constructor() MockERC20(\"test\", \"test\", 8) {}\n\n function deposit() external payable {}\n}\n\ncontract MaxBorrowTest is WithPool {\n address usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD;\n address daiWhale = 0x06959153B974D0D5fDfd87D561db6d8d4FA0bb0B;\n\n struct LiquidationData {\n address[] cTokens;\n ICErc20[] allMarkets;\n MockAsset usdc;\n MockAsset dai;\n }\n\n function afterForkSetUp() internal override {\n super.setUpWithPool(\n MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")),\n ERC20Upgradeable(ap.getAddress(\"wtoken\"))\n );\n\n if (block.chainid == POLYGON_MAINNET) {\n vm.prank(0x369582d2010B6eD950B571F4101e3bB9b554876F); // SAND/WMATIC\n MockERC20(address(underlyingToken)).transfer(address(this), 100e18);\n setUpPool(\"polygon-test\", false, 0.1e18, 1.1e18);\n } else if (block.chainid == BSC_MAINNET) {\n deal(address(underlyingToken), address(this), 100e18);\n setUpPool(\"bsc-test\", false, 0.1e18, 1.1e18);\n }\n }\n\n // TODO redeploy to polygon to fix\n function testMaxBorrow() public fork(POLYGON_MAINNET) {\n PoolLensSecondary poolLensSecondary = new PoolLensSecondary();\n poolLensSecondary.initialize(poolDirectory);\n\n LiquidationData memory vars;\n vm.roll(1);\n vars.usdc = MockAsset(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n vars.dai = MockAsset(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063);\n\n deployCErc20Delegate(address(vars.usdc), \"USDC\", \"usdc\", 0.9e18);\n deployCErc20Delegate(address(vars.dai), \"DAI\", \"dai\", 0.9e18);\n\n vars.allMarkets = comptroller.getAllMarkets();\n\n CErc20Delegate cToken = CErc20Delegate(address(vars.allMarkets[0]));\n\n CErc20Delegate cDaiToken = CErc20Delegate(address(vars.allMarkets[1]));\n\n vars.cTokens = new address[](1);\n\n address accountOne = address(1);\n PoolRolesAuthority pra = ionicAdmin.authoritiesRegistry().poolsAuthorities(address(comptroller));\n\n vm.startPrank(pra.owner());\n pra.setUserRole(accountOne, pra.BORROWER_ROLE(), true);\n vm.stopPrank();\n\n vm.prank(usdcWhale);\n MockERC20(address(vars.usdc)).transfer(accountOne, 10000e6);\n\n vm.prank(daiWhale);\n MockERC20(address(vars.dai)).transfer(accountOne, 10000e18);\n\n // Account One Supply\n {\n emit log(\"Account One Supply\");\n vm.startPrank(accountOne);\n vars.usdc.approve(address(cToken), 1e36);\n cToken.mint(1e6);\n vars.cTokens[0] = address(cToken);\n comptroller.enterMarkets(vars.cTokens);\n\n vars.dai.approve(address(cDaiToken), 1e36);\n cDaiToken.mint(1e18);\n vars.cTokens[0] = address(cDaiToken);\n comptroller.enterMarkets(vars.cTokens);\n\n vm.stopPrank();\n assertEq(cToken.totalSupply(), 1e6 * 5);\n assertEq(cDaiToken.totalSupply(), 1e18 * 5);\n\n uint256 maxBorrow = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n uint256 maxDaiBorrow = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cDaiToken)));\n assertApproxEqAbs((maxBorrow * 1e18) / 10**cToken.decimals(), maxDaiBorrow, uint256(1e16), \"!max borrow\");\n }\n\n // borrow cap for collateral test\n {\n vm.prank(comptroller.admin());\n comptroller._setBorrowCapForCollateral(address(cToken), address(cDaiToken), 0.5e6);\n }\n\n uint256 maxBorrowAfterBorrowCap = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n assertApproxEqAbs(maxBorrowAfterBorrowCap, 0.5e6, uint256(1e5), \"!max borrow\");\n\n // blacklist\n {\n vm.prank(comptroller.admin());\n comptroller._blacklistBorrowingAgainstCollateral(address(cToken), address(cDaiToken), true);\n }\n\n uint256 maxBorrowAfterBlacklist = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n assertEq(maxBorrowAfterBlacklist, 0, \"!blacklist\");\n }\n\n // TODO test with the latest block and contracts and/or without the FSL\n function testBorrowCapPerCollateral() public debuggingOnly forkAtBlock(BSC_MAINNET, 23761190) {\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\n\n address poolAddress = jFiatPoolAddress;\n Comptroller pool = Comptroller(poolAddress);\n\n ComptrollerFirstExtension asExtension = ComptrollerFirstExtension(poolAddress);\n address[] memory borrowers = asExtension.getAllBorrowers();\n address someBorrower = borrowers[1];\n\n ICErc20[] memory markets = asExtension.getAllMarkets();\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = markets[i];\n uint256 borrowed = market.borrowBalanceCurrent(someBorrower);\n if (borrowed > 0) {\n emit log(\"borrower has borrowed\");\n emit log_uint(borrowed);\n emit log(\"from market\");\n emit log_address(address(market));\n emit log_uint(i);\n emit log(\"\");\n }\n\n uint256 collateral = market.balanceOf(someBorrower);\n if (collateral > 0) {\n emit log(\"has collateral\");\n emit log_uint(collateral);\n emit log(\"in market\");\n emit log_address(address(market));\n emit log_uint(i);\n emit log(\"\");\n }\n }\n\n ICErc20 marketToBorrow = markets[0];\n ICErc20 cappedCollateralMarket = markets[6];\n uint256 borrowAmount = marketToBorrow.borrowBalanceCurrent(someBorrower);\n\n {\n (uint256 errBefore, , uint256 liquidityBefore, uint256 shortfallBefore) = pool.getHypotheticalAccountLiquidity(\n someBorrower,\n address(marketToBorrow),\n 0,\n borrowAmount,\n 0\n );\n emit log(\"errBefore\");\n emit log_uint(errBefore);\n emit log(\"liquidityBefore\");\n emit log_uint(liquidityBefore);\n emit log(\"shortfallBefore\");\n emit log_uint(shortfallBefore);\n\n assertGt(liquidityBefore, 0, \"expected positive liquidity\");\n }\n\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateral(address(marketToBorrow), address(cappedCollateralMarket), 1);\n emit log(\"\");\n\n (uint256 errAfter, , uint256 liquidityAfter, uint256 shortfallAfter) = pool.getHypotheticalAccountLiquidity(\n someBorrower,\n address(marketToBorrow),\n 0,\n borrowAmount,\n 0\n );\n emit log(\"errAfter\");\n emit log_uint(errAfter);\n emit log(\"liquidityAfter\");\n emit log_uint(liquidityAfter);\n emit log(\"shortfallAfter\");\n emit log_uint(shortfallAfter);\n\n assertGt(shortfallAfter, 0, \"expected some shortfall\");\n }\n}\n" + }, + "contracts/test/MinBorrowTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract MinBorrowTest is BaseTest {\n FeeDistributor ffd;\n\n function afterForkSetUp() internal override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n }\n\n function testMinBorrow() public fork(BSC_MAINNET) {\n IERC20Upgradeable usdc = IERC20Upgradeable(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20Upgradeable busd = IERC20Upgradeable(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n ICErc20 usdcMarket = ICErc20(0x16B8da195CdC7F380B333bf6cF2f0f33c1061755);\n ICErc20 busdMarket = ICErc20(0x3BCb7dbBe729B24bE6c660B3e8ADD1Cb352e371D);\n IonicComptroller comptroller = usdcMarket.comptroller();\n deal(address(usdc), address(this), 10000e18);\n deal(address(busd), address(1), 10000e18);\n\n usdc.approve(address(usdcMarket), 1e36);\n usdcMarket.mint(1000e18);\n\n vm.startPrank(address(1));\n busd.approve(address(busdMarket), 1e36);\n busdMarket.mint(1000e18);\n vm.stopPrank();\n\n // the 0 liquidity base min borrow amount\n uint256 baseMinBorrowEth = ffd.minBorrowEth();\n\n address[] memory cTokens = new address[](2);\n cTokens[0] = address(usdcMarket);\n cTokens[1] = address(busdMarket);\n comptroller.enterMarkets(cTokens);\n\n uint256 minBorrowEth = ffd.getMinBorrowEth(busdMarket);\n assertEq(minBorrowEth, baseMinBorrowEth, \"!minBorrowEth for default min borrow eth\");\n\n busdMarket.borrow(300e18);\n\n minBorrowEth = ffd.getMinBorrowEth(busdMarket);\n assertEq(minBorrowEth, 0, \"!minBorrowEth after borrowing less amount than min amount\");\n }\n}\n" + }, + "contracts/test/OracleProtectedTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\ncontract MockOraclePasses is IHypernativeOracle {\n function register(address account, bool isStrictMode) external pure {}\n\n function validateForbiddenAccountInteraction(address sender) external pure {}\n\n function validateForbiddenContextInteraction(address origin, address sender) external pure {}\n\n function validateBlacklistedAccountInteraction(address sender) external pure {}\n}\n\ncontract MockOracleFails is IHypernativeOracle {\n error InteractionNotAllowed();\n function register(address account, bool isStrictMode) external pure {}\n\n function validateForbiddenAccountInteraction(address sender) external pure {\n revert InteractionNotAllowed();\n }\n\n function validateForbiddenContextInteraction(address origin, address sender) external pure {\n revert InteractionNotAllowed(); \n }\n\n function validateBlacklistedAccountInteraction(address sender) external pure {\n revert InteractionNotAllowed();\n }\n}\n\ncontract OracleProtectedTest is UpgradesBaseTest {\n error InteractionNotAllowed();\n ICErc20 market = ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3);\n address admin = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n IHypernativeOracle oraclePasses;\n IHypernativeOracle oracleFails;\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n _upgradeMarketWithExtension(market);\n oraclePasses = new MockOraclePasses();\n oracleFails = new MockOracleFails();\n }\n\n function test_mint_failsForBlacklisted() public debuggingOnly forkAtBlock(BASE_MAINNET, 20538729) {\n CTokenFirstExtension asExt = CTokenFirstExtension(address(market)); \n // Set up the oracle\n vm.startPrank(admin);\n ap.setAddress(\"HYPERNATIVE_ORACLE\", address(oracleFails));\n vm.stopPrank();\n \n // Try to mint\n address user = address(0x1234);\n uint256 mintAmount = 1e18;\n deal(asExt.underlying(), user, mintAmount);\n \n vm.startPrank(user);\n ICErc20(asExt.underlying()).approve(address(asExt), mintAmount);\n \n vm.expectRevert(InteractionNotAllowed.selector);\n market.mint(mintAmount);\n vm.stopPrank();\n\n // Set up the oracle to pass\n vm.prank(admin);\n ap.setAddress(\"HYPERNATIVE_ORACLE\", address(oraclePasses));\n\n vm.startPrank(user);\n market.mint(mintAmount);\n vm.stopPrank();\n\n // check balances\n assertGt(market.balanceOf(user), 0);\n }\n}\n" + }, + "contracts/test/oracles/default/ChainlinkOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\n\ncontract ChainlinkOraclesTest is BaseTest {\n ChainlinkPriceOracleV2 oracle;\n\n address usdcPolygon = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;\n address usdtPolygon = 0xc2132D05D31c914a87C6611C10748AEb04B58e8F;\n address usdcFeedPolygon = 0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7;\n address usdtFeedPolygon = 0x0A6513e40db6EB1b165753AD52E80663aeA50545;\n\n address jBRLBsc = 0x316622977073BBC3dF32E7d2A9B3c77596a0a603;\n address jBRLFeedBsc = 0x5cb1Cb3eA5FB46de1CE1D0F3BaDB3212e8d8eF48;\n address usdcBsc = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n address usdtBsc = 0x55d398326f99059fF775485246999027B3197955;\n address usdtFeedBsc = 0xB97Ad0E74fa7d920791E90258A6E2085088b4320;\n address usdcFeedBsc = 0x51597f405303C4377E36123cBc172b13269EA163;\n ICErc20 usdcMarketBsc = ICErc20(0x8D5bE2768c335e88b71E4e913189AEE7104f01B4);\n ICErc20 usdtMarketBsc = ICErc20(0x1F73754c135d5B9fDE674806f43AeDfA2c7eaDb5);\n\n function afterForkSetUp() internal override {\n oracle = ChainlinkPriceOracleV2(ap.getAddress(\"ChainlinkPriceOracleV2\"));\n }\n\n function setUpOracleFeed(address testedTokenAddress, address aggregatorAddress) internal {\n address[] memory underlyings = new address[](1);\n underlyings[0] = testedTokenAddress;\n address[] memory aggregators = new address[](1);\n aggregators[0] = aggregatorAddress;\n\n vm.prank(oracle.owner());\n oracle.setPriceFeeds(underlyings, aggregators, ChainlinkPriceOracleV2.FeedBaseCurrency.USD);\n }\n\n function testJBRLPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(jBRLBsc, jBRLFeedBsc);\n assert(oracle.price(jBRLBsc) > 0);\n }\n\n function testBSCChainlinkUSDCPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdcBsc, usdcFeedBsc);\n uint256 price = oracle.price(usdcBsc);\n uint256 underlyingPrice = oracle.getUnderlyingPrice(usdcMarketBsc);\n assertEq(price, underlyingPrice);\n }\n\n function testBSCChainlinkUSDTPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdtBsc, usdtFeedBsc);\n uint256 price = oracle.price(usdtBsc);\n uint256 underlyingPrice = oracle.getUnderlyingPrice(usdtMarketBsc);\n assertEq(price, underlyingPrice);\n }\n\n function testUsdcUsdtDeviationBsc() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdtBsc, usdtFeedBsc);\n setUpOracleFeed(usdcBsc, usdcFeedBsc);\n\n uint256 usdtPrice = oracle.getUnderlyingPrice(usdtMarketBsc);\n uint256 usdcPrice = oracle.getUnderlyingPrice(usdcMarketBsc);\n\n assertApproxEqAbs(usdtPrice, usdcPrice, 1e16, \"usd prices differ too much\");\n }\n\n function testUsdcUsdtDeviationPolygon() public fork(POLYGON_MAINNET) {\n setUpOracleFeed(usdtPolygon, usdtFeedPolygon);\n setUpOracleFeed(usdcPolygon, usdcFeedPolygon);\n\n uint256 usdtPrice = oracle.price(usdtPolygon);\n uint256 usdcPrice = oracle.price(usdcPolygon);\n\n assertApproxEqAbs(usdtPrice, usdcPrice, 1e16, \"usd prices differ too much\");\n }\n}\n" + }, + "contracts/test/oracles/default/ERC4626OracleAndLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { ERC4626Oracle } from \"../../../oracles/default/ERC4626Oracle.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { IERC4626 } from \"../../../compound/IERC4626.sol\";\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\n\nimport { IUniswapV3Factory } from \"../../../external/uniswap/IUniswapV3Factory.sol\";\nimport { Quoter } from \"../../../external/uniswap/quoter/Quoter.sol\";\nimport { IUniswapV3Pool } from \"../../../external/uniswap/IUniswapV3Pool.sol\";\nimport { ISwapRouter } from \"../../../external/uniswap/ISwapRouter.sol\";\nimport { ERC4626Liquidator } from \"../../../liquidators/ERC4626Liquidator.sol\";\n\ncontract ERC4626OracleAndLiquidatorTest is BaseTest {\n // TODO: refactor this into oracle and liquidator tests once oracles are deployed\n // TODO: refactor oracle set up using the address provider\n\n MasterPriceOracle mpo;\n ChainlinkPriceOracleV2 chainlinkOracle;\n ERC4626Oracle erc4626Oracle;\n\n IERC20Upgradeable wethToken;\n IERC20Upgradeable wbtcToken;\n IERC20Upgradeable daiToken;\n IERC20Upgradeable usdcToken;\n IERC20Upgradeable usdtToken;\n\n address nativeUsdPriceFeed;\n address usdcEthPriceFeed;\n address wbtcEthPriceFeed;\n\n IERC4626 erc4626Vault;\n address[] underlyingTokens;\n ERC4626Liquidator liquidator;\n\n address usdcMarketAddress;\n address univ3SwapRouter;\n\n uint256 poolFee;\n\n Quoter quoter;\n\n address holder;\n\n function setUpErc4626Oracle() public {\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n erc4626Oracle = new ERC4626Oracle();\n vm.prank(erc4626Oracle.owner());\n erc4626Oracle.initialize();\n oracles[0] = erc4626Oracle;\n vm.prank(mpo.admin());\n mpo.add(asArray(address(erc4626Vault)), oracles);\n }\n\n function setUpBaseOracles() public {\n setUpMpoAndAddresses();\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\n chainlinkOracle = new ChainlinkPriceOracleV2();\n chainlinkOracle.initialize(address(usdcToken), nativeUsdPriceFeed);\n vm.prank(chainlinkOracle.owner());\n chainlinkOracle.setPriceFeeds(\n asArray(address(usdcToken), address(wbtcToken)),\n asArray(usdcEthPriceFeed, wbtcEthPriceFeed),\n ChainlinkPriceOracleV2.FeedBaseCurrency.ETH\n );\n oracles[0] = BasePriceOracle(address(chainlinkOracle));\n oracles[1] = BasePriceOracle(address(chainlinkOracle));\n\n vm.prank(mpo.admin());\n mpo.add(asArray(address(usdcToken), address(wbtcToken)), oracles);\n }\n\n function setUpMpoAndAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n usdcToken = IERC20Upgradeable(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n daiToken = IERC20Upgradeable(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n usdtToken = IERC20Upgradeable(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n wbtcToken = IERC20Upgradeable(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n wethToken = IERC20Upgradeable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n nativeUsdPriceFeed = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;\n usdcEthPriceFeed = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4;\n wbtcEthPriceFeed = 0xdeb288F737066589598e9214E782fa5A8eD689e8;\n\n address[] memory assets = new address[](0);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\n mpo = new MasterPriceOracle();\n mpo.initialize(assets, oracles, BasePriceOracle(address(0)), address(this), true, address(wethToken));\n }\n }\n\n function setupRealYieldStrategyUsdAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n underlyingTokens = asArray(address(usdcToken), address(daiToken), address(usdtToken)); // USDC, 6 decimals\n poolFee = 10;\n erc4626Vault = IERC4626(0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E); // USDC-DAI-USDT Real Yield\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n holder = 0x3541Fda19b09769A938EB2A5f5154b01aE5b0869;\n }\n liquidator = new ERC4626Liquidator();\n }\n\n function setupEthBtcStrategyAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n underlyingTokens = asArray(address(usdcToken), address(wbtcToken), address(wethToken));\n poolFee = 500;\n erc4626Vault = IERC4626(0x6b7f87279982d919Bbf85182DDeAB179B366D8f2); // ETH-BTC trend\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n holder = 0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3;\n }\n liquidator = new ERC4626Liquidator();\n }\n\n function testRealYieldErc4626PriceOracle() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupRealYieldStrategyUsdAddresses();\n setUpErc4626Oracle();\n\n uint256 priceRealYieldUsdc = mpo.price(address(erc4626Vault));\n uint256 priceUsdc = mpo.price(address(usdcToken));\n\n // Approximate only -- these should not match.\n assertApproxEqRel(priceRealYieldUsdc, priceUsdc, 3e16, \"!diff > 3%\");\n }\n\n function testRealYieldUsdErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupRealYieldStrategyUsdAddresses();\n setUpErc4626Oracle();\n executeTestRedemptionStrategy(usdcToken);\n }\n\n function testEthBtcMomementumErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupEthBtcStrategyAddresses();\n setUpErc4626Oracle();\n executeTestRedemptionStrategy(wethToken);\n }\n\n function executeTestRedemptionStrategy(IERC20Upgradeable _outputToken) internal {\n uint256 balance = erc4626Vault.balanceOf(holder);\n assertTrue(balance > 0);\n\n // impersonate the holder\n vm.prank(holder);\n\n // fund the liquidator so it can redeem the tokens\n erc4626Vault.transfer(address(liquidator), balance);\n\n bytes memory data = abi.encode(address(_outputToken), poolFee, univ3SwapRouter, underlyingTokens, quoter);\n\n // redeem the underlying reward token\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n IERC20Upgradeable(address(erc4626Vault)),\n balance,\n data\n );\n\n // ensure the output token is the expected token\n assertEq(address(outputToken), address(_outputToken));\n\n uint256 liquidatorBalance = _outputToken.balanceOf(address(liquidator));\n // get the redeemed value of the erc4626 token\n uint256 redeemValue = (mpo.price(address(erc4626Vault)) * balance) / 1e18;\n // get the redeemed value of the output token\n uint256 redeemOutputTokenValue = (mpo.price(address(_outputToken)) * liquidatorBalance) /\n 10 ** ERC20Upgradeable(address(_outputToken)).decimals();\n // ensure they are approximately equal\n assertApproxEqRel(redeemValue, redeemOutputTokenValue, 3e16, \"!diff > 3%\");\n\n uint256 maxVal = redeemValue > redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\n uint256 minVal = redeemValue < redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\n\n uint256 absoluteDifference = maxVal - minVal;\n uint256 percentageDifference = (absoluteDifference * 10000) / maxVal; // Multiplied by 10000 for 2 decimal places of precision\n\n // log the differences\n emit log_named_uint(\"redeemOutputTokenValue\", redeemOutputTokenValue);\n emit log_named_uint(\"redeemValue\", redeemValue);\n emit log_named_uint(\"base 1000 diff\", percentageDifference);\n }\n}\n" + }, + "contracts/test/oracles/default/MasterPriceOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { MockRevertPriceOracle } from \"../../../oracles/1337/MockRevertPriceOracle.sol\";\n\ncontract MasterPriceOracleTest is BaseTest {\n MasterPriceOracle mpo;\n SimplePriceOracle mainOracle;\n SimplePriceOracle fallbackOracle;\n MockRevertPriceOracle revertingOracle;\n ICErc20 mockCToken;\n address someAdminAccount = address(94949);\n address ezETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ionezETH = 0x59e710215d45F584f44c0FEe83DA6d43D762D857;\n\n function afterForkSetUp() internal override {\n MasterPriceOracle newMpo = new MasterPriceOracle();\n SimplePriceOracle defaultOracle = new SimplePriceOracle();\n\n address[] memory underlyings = new address[](0);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\n\n vm.prank(someAdminAccount);\n newMpo.initialize(underlyings, oracles, defaultOracle, someAdminAccount, true, address(0));\n\n mpo = newMpo;\n\n SimplePriceOracle impl = new SimplePriceOracle();\n vm.prank(address(someAdminAccount));\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(impl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n mainOracle = SimplePriceOracle(address(proxy));\n\n SimplePriceOracle fallbackImpl = new SimplePriceOracle();\n vm.prank(address(someAdminAccount));\n TransparentUpgradeableProxy fallbackProxy = new TransparentUpgradeableProxy(\n address(fallbackImpl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n fallbackOracle = SimplePriceOracle(address(fallbackProxy));\n\n vm.startPrank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 2000);\n fallbackOracle.setDirectPrice(ezETH, 2000);\n vm.stopPrank();\n\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(mainOracle);\n BasePriceOracle[] memory fallbackOraclesToAdd = new BasePriceOracle[](1);\n fallbackOraclesToAdd[0] = BasePriceOracle(fallbackOracle);\n\n vm.startPrank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n mpo.addFallbacks(tokens, fallbackOraclesToAdd);\n vm.stopPrank();\n\n revertingOracle = new MockRevertPriceOracle();\n }\n\n function testGetUnderlyingPrice() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenZero() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 0);\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenZeroAddressOracle() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(0x0000000000000000000000000000000000000000);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenOracleReverts() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(revertingOracle);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPrice() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenZero() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 0);\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenZeroAddressOracle() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(0x0000000000000000000000000000000000000000);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenOracleReverts() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(revertingOracle);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n}\n" + }, + "contracts/test/oracles/default/PythPriceOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PythPriceOracle } from \"../../../oracles/default/PythPriceOracle.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/MockPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\n\ncontract PythPriceOracleTest is BaseTest {\n PythPriceOracle oracle;\n IPyth pythOracle;\n MasterPriceOracle mpo;\n\n address stable;\n address wtoken;\n address wbtc;\n\n address neonPyth = 0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5;\n address lineaPyth = 0xA2aa501b19aff244D90cc15a4Cf739D2725B5729;\n address polygonPyth = 0xff1a0f4744e8582DF1aE09D5611b887B6a12925C;\n address zkevmPyth = 0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65;\n\n bytes32 ethUsdTokenPriceFeed = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;\n bytes32 btcUsdTokenPriceFeed = 0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43;\n bytes32 neonUsdTokenPriceFeed = 0xd82183dd487bef3208a227bb25d748930db58862c5121198e723ed0976eb92b7;\n bytes32 maticUsdTokenPriceFeed = 0x5de33a9112c2b700b8d30b8a3402c103578ccfa2765696471cc672bd5cf6ac52;\n bytes32 usdcUsdTokenPriceFeed = 0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a;\n\n function afterForkSetUp() internal override {\n stable = ap.getAddress(\"stableToken\");\n wtoken = ap.getAddress(\"wtoken\");\n wbtc = ap.getAddress(\"wBTCToken\");\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n oracle = new PythPriceOracle();\n\n // create an array of bytes to pass to the oracle\n bytes32[] memory feedIds = new bytes32[](2);\n feedIds[0] = usdcUsdTokenPriceFeed;\n feedIds[1] = btcUsdTokenPriceFeed;\n vm.startPrank(mpo.admin());\n\n if (block.chainid == NEON_MAINNET) {\n oracle.initialize(neonPyth, neonUsdTokenPriceFeed, stable);\n } else if (block.chainid == LINEA_MAINNET) {\n oracle.initialize(lineaPyth, ethUsdTokenPriceFeed, stable);\n } else if (block.chainid == POLYGON_MAINNET) {\n oracle.initialize(polygonPyth, maticUsdTokenPriceFeed, stable);\n } else if (block.chainid == ZKEVM_MAINNET) {\n oracle.initialize(zkevmPyth, ethUsdTokenPriceFeed, stable);\n } else {\n revert(\"Unsupported chain\");\n }\n oracle.setPriceFeeds(asArray(stable, wbtc), feedIds);\n vm.stopPrank();\n }\n\n function testPolygonTokenPrice() public debuggingOnly fork(POLYGON_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(polygonPyth).getPriceUnsafe(maticUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n\n function testLineaTokenPrice() public debuggingOnly fork(LINEA_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(lineaPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e17);\n }\n\n function testNeonTokenPrice() public debuggingOnly fork(NEON_MAINNET) {\n PythStructs.Price memory pythPriceNeon = IPyth(neonPyth).getPriceUnsafe(neonUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPriceNeon.price)));\n emit log_named_uint(\"updated\", pythPriceNeon.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n PythStructs.Price memory pythPrice = IPyth(neonPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n\n function testZkEvmTokenPrice() public fork(ZKEVM_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(zkevmPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n}\n" + }, + "contracts/test/oracles/default/SimplePriceOracleTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract SimplePriceOracleTest is BaseTest {\n SimplePriceOracle oracle;\n MasterPriceOracle mpo;\n address someAdminAccount = address(94949);\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n SimplePriceOracle impl = new SimplePriceOracle();\n\n vm.prank(someAdminAccount);\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(impl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n oracle = SimplePriceOracle(address(proxy));\n }\n\n function testSimplePO() public fork(BSC_MAINNET) {\n vm.expectRevert(\"Ownable: caller is not the owner\");\n oracle.setDirectPrice(address(1), 1);\n\n vm.prank(someAdminAccount);\n oracle.setDirectPrice(address(1), 1);\n }\n}\n" + }, + "contracts/test/oracles/default/TwapOraclesBaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { UniswapTwapPriceOracleV2Factory } from \"../../../oracles/default/UniswapTwapPriceOracleV2Factory.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"../../../oracles/default/UniswapTwapPriceOracleV2Root.sol\";\nimport { UniswapTwapPriceOracleV2 } from \"../../../oracles/default/UniswapTwapPriceOracleV2.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { IUniswapV2Pair } from \"../../../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\n\ncontract TwapOraclesBaseTest is BaseTest {\n IUniswapV2Factory uniswapV2Factory;\n UniswapTwapPriceOracleV2Factory twapPriceOracleFactory;\n MasterPriceOracle mpo;\n\n function afterForkSetUp() internal override {\n uniswapV2Factory = IUniswapV2Factory(ap.getAddress(\"IUniswapV2Factory\"));\n twapPriceOracleFactory = UniswapTwapPriceOracleV2Factory(ap.getAddress(\"UniswapTwapPriceOracleV2Factory\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n // BOMB\n function testBombTwapOraclePrice() public fork(BSC_MAINNET) {\n address baseToken = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c; // WBTC\n address testedAssetTokenAddress = 0x522348779DCb2911539e76A1042aA922F9C47Ee3; // BOMB\n\n assertTrue(getTokenTwapPrice(testedAssetTokenAddress, baseToken) > 0);\n }\n\n function getTokenTwapPrice(address tokenAddress, address baseTokenAddress) internal returns (uint256) {\n address testedPairAddress = uniswapV2Factory.getPair(tokenAddress, baseTokenAddress);\n\n // trigger a price update\n UniswapTwapPriceOracleV2Root twapOracleRoot = UniswapTwapPriceOracleV2Root(twapPriceOracleFactory.rootOracle());\n address[] memory pairs = new address[](1);\n pairs[0] = testedPairAddress;\n twapOracleRoot.update(pairs);\n\n // check if the base toke oracle is present in the master price oracle\n if (address(mpo.oracles(tokenAddress)) == address(0)) {\n // deploy or get the base token twap oracle\n address oracleAddress = twapPriceOracleFactory.deploy(address(uniswapV2Factory), baseTokenAddress);\n UniswapTwapPriceOracleV2 oracle = UniswapTwapPriceOracleV2(oracleAddress);\n // add the new twap oracle to the master oracle\n address[] memory underlyings = new address[](1);\n underlyings[0] = tokenAddress;\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n // impersonate the admin to add the oracle\n vm.prank(mpo.admin());\n mpo.add(underlyings, oracles);\n emit log(\"added the oracle\");\n } else {\n emit log(\"found the oracle\");\n }\n\n // return the price denominated in W_NATIVE\n return mpo.price(tokenAddress);\n }\n\n // function testChapelEthBusdOraclePrice() public {\n // address baseToken = 0x7ef95a0FEE0Dd31b22626fA2e10Ee6A223F8a684; // USDT\n // address testedAssetTokenAddress = 0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7; // BUSD\n // assertTrue(getTokenTwapPrice(testedAssetTokenAddress, baseToken) > 0);\n // }\n}\n" + }, + "contracts/test/oracles/default/UniswapTwapPriceOracleV2Resolver.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"../../../oracles/default/UniswapTwapPriceOracleV2Root.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\nimport { UniswapTwapPriceOracleV2Resolver } from \"../../../oracles/default/UniswapTwapPriceOracleV2Resolver.sol\";\nimport { IUniswapV2Pair } from \"../../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\n\ncontract UniswapTwapOracleV2ResolverTest is BaseTest {\n UniswapTwapPriceOracleV2Root twapPriceOracleRoot;\n UniswapTwapPriceOracleV2Resolver resolver;\n IUniswapV2Factory uniswapV2Factory;\n MasterPriceOracle mpo;\n\n struct Observation {\n uint32 timestamp;\n uint256 price0Cumulative;\n uint256 price1Cumulative;\n }\n\n function afterForkSetUp() internal override {\n uniswapV2Factory = IUniswapV2Factory(ap.getAddress(\"IUniswapV2Factory\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function getTokenTwapPrice(address tokenAddress) internal view returns (uint256) {\n // return the price denominated in W_NATIVE\n return mpo.price(tokenAddress);\n }\n}\n" + }, + "contracts/test/oracles/RedstoneAdapterOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { RedstoneAdapterPriceOracle } from \"../../oracles/default/RedstoneAdapterPriceOracle.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract RedstoneAdapterOracleTest is BaseTest {\n MasterPriceOracle public mpo;\n RedstoneAdapterPriceOracle public oracle;\n address public redstoneOracleAddress;\n address MODE_USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address MODE_WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF;\n address MODE_WEETH = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n\n function afterForkSetUp() internal override {\n if (block.chainid == MODE_MAINNET) {\n redstoneOracleAddress = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256;\n }\n\n oracle = new RedstoneAdapterPriceOracle(redstoneOracleAddress);\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function testPrintPricesMode() public fork(MODE_MAINNET) {\n emit log_named_uint(\"ezETH price (18 dec)\", oracle.price(MODE_EZETH));\n emit log_named_uint(\"WBTC price (8 dec)\", oracle.price(MODE_WBTC));\n emit log_named_uint(\"weETH price (18 dec)\", oracle.price(MODE_WEETH));\n }\n\n function testPrintMpoPricesMode() public fork(MODE_MAINNET) {\n emit log_named_uint(\"weETH price (18 dec)\", mpo.price(MODE_WEETH));\n }\n}\n" + }, + "contracts/test/OraclesDecimalsScalingTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\ncontract OraclesDecimalsScalingTest is BaseTest {\n MasterPriceOracle mpo;\n PoolDirectory poolDirectory;\n address stable;\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n poolDirectory = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n stable = ap.getAddress(\"stableToken\");\n }\n\n function testOracleDecimalsBsc() public fork(BSC_MAINNET) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsArbitrum() public fork(ARBITRUM_ONE) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsPolygon() public fork(POLYGON_MAINNET) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsNeon() public fork(NEON_MAINNET) {\n vm.mockCall(stable, abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector), abi.encode(6));\n // SOL\n vm.mockCall(\n 0x5f38248f339Bf4e84A2caf4e4c0552862dC9F82a,\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector),\n abi.encode(9)\n );\n testOraclesDecimals();\n }\n\n function testOraclesDecimals() internal {\n if (address(poolDirectory) != address(0)) {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n address underlying = markets[j].underlying();\n\n if (isSkipped(underlying)) {\n emit log(\"the oracle for this underlying cannot be tested\");\n emit log_address(underlying);\n continue;\n }\n\n uint256 oraclePrice = mpo.price(underlying);\n uint256 scaledPrice = mpo.getUnderlyingPrice(markets[j]);\n\n uint8 decimals = IERC20MetadataUpgradeable(underlying).decimals();\n uint256 expectedScaledPrice = decimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - decimals))\n : uint256(oraclePrice) / (10 ** (decimals - 18));\n\n assertEq(scaledPrice, expectedScaledPrice, \"the comptroller expects prices to be scaled by 1e(36-decimals)\");\n }\n }\n }\n }\n\n function isSkipped(address token) internal pure returns (bool) {\n return token == 0x5f38248f339Bf4e84A2caf4e4c0552862dC9F82a; // SOL on neon, failing for unknwon reasons, works in HH\n }\n}\n" + }, + "contracts/test/PermissionedLiquidationsMarketTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\n\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ILiquidator } from \"../ILiquidator.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../liquidators/IFundsConversionStrategy.sol\";\n\ncontract PermissionedLiquidationsMarketTest is MarketsTest {\n ICErc20 wethMarket;\n ICErc20 usdtMarket;\n\n ICErc20 wethNativeMarket;\n ICErc20 usdcNativeMarket;\n ICErc20 usdtNativeMarket;\n ICErc20 modeNativeMarket;\n\n IonicComptroller pool;\n PoolLens lens;\n address borrower;\n address liquidator;\n IonicUniV3Liquidator uniV3liquidator;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n\n wethNativeMarket = ICErc20(0xDb8eE6D1114021A94A045956BBeeCF35d13a30F2);\n usdcNativeMarket = ICErc20(0xc53edEafb6D502DAEC5A7015D67936CEa0cD0F52);\n usdtNativeMarket = ICErc20(0x3120B4907851cc9D780eef9aF88ae4d5360175Fd);\n modeNativeMarket = ICErc20(0x4341620757Bee7EB4553912FaFC963e59C949147);\n\n pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n borrower = 0xcE6cEFa163468F730206688665516952bcf83B74;\n liquidator = 0xE000008459b74a91e306a47C808061DFA372000E;\n uniV3liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n vm.prank(ap.owner());\n ap.setAddress(\"PoolLens\", address(lens));\n }\n\n function testLiquidateNoThreshold() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateThresholdActive() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n vm.expectRevert(\"Health factor not low enough for non-permissioned liquidations\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n vm.stopPrank();\n }\n\n function testLiquidateHealthFactorLowerThanThreshold() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n // fast forward until position unhealthy enough\n vm.roll(block.number + 10000000);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateFromPythShouldRevert() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n emit log_named_uint(\"hf\", lens.getHealthFactor(0x0Ff7F5043DD39186c2DF04F81cfa95672B8A3994, pool));\n\n address targetContract = 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A;\n bytes\n memory data = hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000ff7f5043dd39186c2df04f81cfa95672b8a39940000000000000000000000000000000000000000000000000002fb8c3841c79600000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d2000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n vm.startPrank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n vm.expectRevert(\"invalid liquidation\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateFromPyth() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n emit log_named_uint(\"hf\", lens.getHealthFactor(0x0Ff7F5043DD39186c2DF04F81cfa95672B8A3994, pool));\n\n address targetContract = 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A;\n bytes\n memory data = hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000ff7f5043dd39186c2df04f81cfa95672b8a39940000000000000000000000000000000000000000000000000002fb8c3841c79600000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d2000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n vm.mockCall(\n address(uniV3liquidator.expressRelay()),\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(uniV3liquidator),\n abi.encode(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6)\n ),\n abi.encode(false)\n );\n\n vm.startPrank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n vm.expectRevert(\"invalid liquidation\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testPostUpgradeLiquidate() public debuggingOnly fork(MODE_MAINNET) {\n address borrower = 0xE10B38bbe359656066b3c4648DfEa7018711c35f;\n PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser(pool, borrower);\n\n for (uint i; i < assets.length; i++) {\n emit log_named_string(\"Asset Named\", assets[i].underlyingName);\n emit log_named_uint(\"Supply Balance\", assets[i].supplyBalance);\n emit log_named_uint(\"Borrow Balance\", assets[i].borrowBalance);\n emit log_named_uint(\"Liquidity\", assets[i].liquidity);\n emit log(\"----------------------------------------------------\");\n }\n\n emit log_named_uint(\"HF\", lens.getHealthFactor(borrower, pool));\n\n // vm.startPrank(0x344d9C4f488bb5519D390304457D64034618145C);\n\n // ERC20(0xd988097fb8612cc24eeC14542bC03424c656005f).approve(address(uniV3liquidator), 4000);\n\n // // ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n // // borrower: borrower,\n // // repayAmount: 4000,\n // // cErc20: ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),\n // // cTokenCollateral: wethMarket,\n // // flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n // // minProfitAmount: 0,\n // // redemptionStrategies: new IRedemptionStrategy[](0),\n // // strategyData: new bytes[](0),\n // // debtFundingStrategies: new IFundsConversionStrategy[](0),\n // // debtFundingStrategiesData: new bytes[](0)\n // // });\n // // uniV3liquidator.safeLiquidateToTokensWithFlashLoan(vars);\n\n // uniV3liquidator.safeLiquidate(borrower, 4000, ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038), wethMarket, 0);\n\n // vm.stopPrank();\n\n // emit log_named_uint(\"HF\", lens.getHealthFactor(borrower, pool));\n }\n\n function testUpgradeNativeMarket() public debuggingOnly fork(MODE_MAINNET) {\n _upgradeMarket(wethNativeMarket);\n _upgradeMarket(usdcNativeMarket);\n _upgradeMarket(usdtNativeMarket);\n _upgradeMarket(modeNativeMarket);\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n }\n\n struct CErc20StorageStruct {\n address ionicAdmin;\n string name;\n string symbol;\n uint8 decimals;\n address comptroller;\n address interestRateModel;\n uint256 adminFeeMantissa;\n uint256 ionicFeeMantissa;\n uint256 reserveFactorMantissa;\n uint256 accrualBlockNumber;\n uint256 borrowIndex;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalAdminFees;\n uint256 totalIonicFees;\n uint256 totalSupply;\n uint256 protocolSeizeShareMantissa;\n uint256 feeSeizeShareMantissa;\n address underlying;\n address ap;\n uint256 cash;\n uint256 totalBorrowsCurrent;\n uint256 balanceOfUnderlying;\n uint256 borrowBalanceCurrent;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 exchangeRateCurrent;\n uint256 totalUnderlyingSupplied;\n uint256 allowance;\n uint256 balanceOf;\n }\n\n function testStorageLayoutSafe() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n // Capture storage layout before upgrade\n CErc20StorageStruct memory storageDataBefore;\n CErc20StorageStruct memory storageDataAfter;\n\n address owner = 0xbF86588d7e20502f1b250561da775343Dfdb3250; // Use a valid spender address as needed\n\n storageDataBefore.ionicAdmin = wethMarket.ionicAdmin();\n storageDataBefore.name = wethMarket.name();\n storageDataBefore.symbol = wethMarket.symbol();\n storageDataBefore.decimals = wethMarket.decimals();\n storageDataBefore.comptroller = address(wethMarket.comptroller());\n storageDataBefore.interestRateModel = address(wethMarket.interestRateModel());\n storageDataBefore.adminFeeMantissa = wethMarket.adminFeeMantissa();\n storageDataBefore.ionicFeeMantissa = wethMarket.ionicFeeMantissa();\n storageDataBefore.reserveFactorMantissa = wethMarket.reserveFactorMantissa();\n storageDataBefore.accrualBlockNumber = wethMarket.accrualBlockNumber();\n storageDataBefore.borrowIndex = wethMarket.borrowIndex();\n storageDataBefore.totalBorrows = wethMarket.totalBorrows();\n storageDataBefore.totalReserves = wethMarket.totalReserves();\n storageDataBefore.totalAdminFees = wethMarket.totalAdminFees();\n storageDataBefore.totalIonicFees = wethMarket.totalIonicFees();\n storageDataBefore.totalSupply = wethMarket.totalSupply();\n storageDataBefore.underlying = wethMarket.underlying();\n storageDataBefore.cash = wethMarket.getCash();\n storageDataBefore.totalBorrowsCurrent = wethMarket.totalBorrowsCurrent();\n storageDataBefore.balanceOfUnderlying = wethMarket.balanceOfUnderlying(owner);\n storageDataBefore.borrowBalanceCurrent = wethMarket.borrowBalanceCurrent(owner);\n storageDataBefore.supplyRatePerBlock = wethMarket.supplyRatePerBlock();\n storageDataBefore.borrowRatePerBlock = wethMarket.borrowRatePerBlock();\n storageDataBefore.exchangeRateCurrent = wethMarket.exchangeRateCurrent();\n storageDataBefore.totalUnderlyingSupplied = wethMarket.getTotalUnderlyingSupplied();\n storageDataBefore.balanceOf = wethMarket.balanceOf(owner);\n storageDataBefore.protocolSeizeShareMantissa = wethMarket.protocolSeizeShareMantissa();\n storageDataBefore.feeSeizeShareMantissa = wethMarket.feeSeizeShareMantissa();\n\n // Upgrade the market\n _upgradeMarket(wethMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n storageDataAfter.ionicAdmin = wethMarket.ionicAdmin();\n storageDataAfter.name = wethMarket.name();\n storageDataAfter.symbol = wethMarket.symbol();\n storageDataAfter.decimals = wethMarket.decimals();\n storageDataAfter.comptroller = address(wethMarket.comptroller());\n storageDataAfter.interestRateModel = address(wethMarket.interestRateModel());\n storageDataAfter.adminFeeMantissa = wethMarket.adminFeeMantissa();\n storageDataAfter.ionicFeeMantissa = wethMarket.ionicFeeMantissa();\n storageDataAfter.reserveFactorMantissa = wethMarket.reserveFactorMantissa();\n storageDataAfter.accrualBlockNumber = wethMarket.accrualBlockNumber();\n storageDataAfter.borrowIndex = wethMarket.borrowIndex();\n storageDataAfter.totalBorrows = wethMarket.totalBorrows();\n storageDataAfter.totalReserves = wethMarket.totalReserves();\n storageDataAfter.totalAdminFees = wethMarket.totalAdminFees();\n storageDataAfter.totalIonicFees = wethMarket.totalIonicFees();\n storageDataAfter.totalSupply = wethMarket.totalSupply();\n storageDataAfter.underlying = wethMarket.underlying();\n storageDataAfter.cash = wethMarket.getCash();\n storageDataAfter.totalBorrowsCurrent = wethMarket.totalBorrowsCurrent();\n storageDataAfter.balanceOfUnderlying = wethMarket.balanceOfUnderlying(owner);\n storageDataAfter.borrowBalanceCurrent = wethMarket.borrowBalanceCurrent(owner);\n storageDataAfter.supplyRatePerBlock = wethMarket.supplyRatePerBlock();\n storageDataAfter.borrowRatePerBlock = wethMarket.borrowRatePerBlock();\n storageDataAfter.exchangeRateCurrent = wethMarket.exchangeRateCurrent();\n storageDataAfter.totalUnderlyingSupplied = wethMarket.getTotalUnderlyingSupplied();\n storageDataAfter.balanceOf = wethMarket.balanceOf(owner);\n storageDataAfter.protocolSeizeShareMantissa = wethMarket.protocolSeizeShareMantissa();\n storageDataAfter.feeSeizeShareMantissa = wethMarket.feeSeizeShareMantissa();\n\n emit log_named_address(\"Storage ionicAdmin (before)\", storageDataBefore.ionicAdmin);\n emit log_named_address(\"Storage ionicAdmin (after)\", storageDataAfter.ionicAdmin);\n\n emit log_named_string(\"Storage name (before)\", storageDataBefore.name);\n emit log_named_string(\"Storage name (after)\", storageDataAfter.name);\n\n emit log_named_string(\"Storage symbol (before)\", storageDataBefore.symbol);\n emit log_named_string(\"Storage symbol (after)\", storageDataAfter.symbol);\n\n emit log_named_uint(\"Storage decimals (before)\", storageDataBefore.decimals);\n emit log_named_uint(\"Storage decimals (after)\", storageDataAfter.decimals);\n\n emit log_named_address(\"Storage comptroller (before)\", storageDataBefore.comptroller);\n emit log_named_address(\"Storage comptroller (after)\", storageDataAfter.comptroller);\n\n emit log_named_address(\"Storage interestRateModel (before)\", storageDataBefore.interestRateModel);\n emit log_named_address(\"Storage interestRateModel (after)\", storageDataAfter.interestRateModel);\n\n emit log_named_uint(\"Storage adminFeeMantissa (before)\", storageDataBefore.adminFeeMantissa);\n emit log_named_uint(\"Storage adminFeeMantissa (after)\", storageDataAfter.adminFeeMantissa);\n\n emit log_named_uint(\"Storage ionicFeeMantissa (before)\", storageDataBefore.ionicFeeMantissa);\n emit log_named_uint(\"Storage ionicFeeMantissa (after)\", storageDataAfter.ionicFeeMantissa);\n\n emit log_named_uint(\"Storage reserveFactorMantissa (before)\", storageDataBefore.reserveFactorMantissa);\n emit log_named_uint(\"Storage reserveFactorMantissa (after)\", storageDataAfter.reserveFactorMantissa);\n\n emit log_named_uint(\"Storage accrualBlockNumber (before)\", storageDataBefore.accrualBlockNumber);\n emit log_named_uint(\"Storage accrualBlockNumber (after)\", storageDataAfter.accrualBlockNumber);\n\n emit log_named_uint(\"Storage borrowIndex (before)\", storageDataBefore.borrowIndex);\n emit log_named_uint(\"Storage borrowIndex (after)\", storageDataAfter.borrowIndex);\n\n emit log_named_uint(\"Storage totalBorrows (before)\", storageDataBefore.totalBorrows);\n emit log_named_uint(\"Storage totalBorrows (after)\", storageDataAfter.totalBorrows);\n\n emit log_named_uint(\"Storage totalReserves (before)\", storageDataBefore.totalReserves);\n emit log_named_uint(\"Storage totalReserves (after)\", storageDataAfter.totalReserves);\n\n emit log_named_uint(\"Storage totalAdminFees (before)\", storageDataBefore.totalAdminFees);\n emit log_named_uint(\"Storage totalAdminFees (after)\", storageDataAfter.totalAdminFees);\n\n emit log_named_uint(\"Storage totalIonicFees (before)\", storageDataBefore.totalIonicFees);\n emit log_named_uint(\"Storage totalIonicFees (after)\", storageDataAfter.totalIonicFees);\n\n emit log_named_uint(\"Storage totalSupply (before)\", storageDataBefore.totalSupply);\n emit log_named_uint(\"Storage totalSupply (after)\", storageDataAfter.totalSupply);\n\n emit log_named_uint(\"Storage protocolSeizeShareMantissa (before)\", storageDataBefore.protocolSeizeShareMantissa);\n emit log_named_uint(\"Storage protocolSeizeShareMantissa (after)\", storageDataAfter.protocolSeizeShareMantissa);\n\n emit log_named_uint(\"Storage feeSeizeShareMantissa (before)\", storageDataBefore.feeSeizeShareMantissa);\n emit log_named_uint(\"Storage feeSeizeShareMantissa (after)\", storageDataAfter.feeSeizeShareMantissa);\n\n emit log_named_address(\"Storage underlying (before)\", storageDataBefore.underlying);\n emit log_named_address(\"Storage underlying (after)\", storageDataAfter.underlying);\n\n emit log_named_uint(\"Storage cash (before)\", storageDataBefore.cash);\n emit log_named_uint(\"Storage cash (after)\", storageDataAfter.cash);\n\n emit log_named_uint(\"Storage totalBorrowsCurrent (before)\", storageDataBefore.totalBorrowsCurrent);\n emit log_named_uint(\"Storage totalBorrowsCurrent (after)\", storageDataAfter.totalBorrowsCurrent);\n\n emit log_named_uint(\"Storage balanceOfUnderlying (before)\", storageDataBefore.balanceOfUnderlying);\n emit log_named_uint(\"Storage balanceOfUnderlying (after)\", storageDataAfter.balanceOfUnderlying);\n\n emit log_named_uint(\"Storage borrowBalanceCurrent (before)\", storageDataBefore.borrowBalanceCurrent);\n emit log_named_uint(\"Storage borrowBalanceCurrent (after)\", storageDataAfter.borrowBalanceCurrent);\n\n emit log_named_uint(\"Storage supplyRatePerBlock (before)\", storageDataBefore.supplyRatePerBlock);\n emit log_named_uint(\"Storage supplyRatePerBlock (after)\", storageDataAfter.supplyRatePerBlock);\n\n emit log_named_uint(\"Storage borrowRatePerBlock (before)\", storageDataBefore.borrowRatePerBlock);\n emit log_named_uint(\"Storage borrowRatePerBlock (after)\", storageDataAfter.borrowRatePerBlock);\n\n emit log_named_uint(\"Storage exchangeRateCurrent (before)\", storageDataBefore.exchangeRateCurrent);\n emit log_named_uint(\"Storage exchangeRateCurrent (after)\", storageDataAfter.exchangeRateCurrent);\n\n emit log_named_uint(\"Storage totalUnderlyingSupplied (before)\", storageDataBefore.totalUnderlyingSupplied);\n emit log_named_uint(\"Storage totalUnderlyingSupplied (after)\", storageDataAfter.totalUnderlyingSupplied);\n\n emit log_named_uint(\"Storage allowance (before)\", storageDataBefore.allowance);\n emit log_named_uint(\"Storage allowance (after)\", storageDataAfter.allowance);\n\n emit log_named_uint(\"Storage balanceOf (before)\", storageDataBefore.balanceOf);\n emit log_named_uint(\"Storage balanceOf (after)\", storageDataAfter.balanceOf);\n\n emit log_named_address(\"Storage ap (before)\", storageDataBefore.ap);\n emit log_named_address(\"Storage ap (after)\", storageDataAfter.ap);\n\n assertEq(storageDataBefore.ionicAdmin, storageDataAfter.ionicAdmin, \"Mismatch in ionicAdmin\");\n assertEq(storageDataBefore.name, storageDataAfter.name, \"Mismatch in name\");\n assertEq(storageDataBefore.symbol, storageDataAfter.symbol, \"Mismatch in symbol\");\n assertEq(storageDataBefore.decimals, storageDataAfter.decimals, \"Mismatch in decimals\");\n assertEq(storageDataBefore.comptroller, storageDataAfter.comptroller, \"Mismatch in comptroller\");\n assertEq(storageDataBefore.interestRateModel, storageDataAfter.interestRateModel, \"Mismatch in interestRateModel\");\n assertEq(storageDataBefore.adminFeeMantissa, storageDataAfter.adminFeeMantissa, \"Mismatch in adminFeeMantissa\");\n assertEq(storageDataBefore.ionicFeeMantissa, storageDataAfter.ionicFeeMantissa, \"Mismatch in ionicFeeMantissa\");\n assertEq(\n storageDataBefore.reserveFactorMantissa,\n storageDataAfter.reserveFactorMantissa,\n \"Mismatch in reserveFactorMantissa\"\n );\n assertEq(\n storageDataBefore.accrualBlockNumber,\n storageDataAfter.accrualBlockNumber,\n \"Mismatch in accrualBlockNumber\"\n );\n assertEq(storageDataBefore.borrowIndex, storageDataAfter.borrowIndex, \"Mismatch in borrowIndex\");\n assertEq(storageDataBefore.totalBorrows, storageDataAfter.totalBorrows, \"Mismatch in totalBorrows\");\n assertEq(storageDataBefore.totalReserves, storageDataAfter.totalReserves, \"Mismatch in totalReserves\");\n assertEq(storageDataBefore.totalAdminFees, storageDataAfter.totalAdminFees, \"Mismatch in totalAdminFees\");\n assertEq(storageDataBefore.totalIonicFees, storageDataAfter.totalIonicFees, \"Mismatch in totalIonicFees\");\n assertEq(storageDataBefore.totalSupply, storageDataAfter.totalSupply, \"Mismatch in totalSupply\");\n assertEq(storageDataBefore.underlying, storageDataAfter.underlying, \"Mismatch in underlying\");\n assertEq(storageDataBefore.cash, storageDataAfter.cash, \"Mismatch in cash\");\n assertEq(\n storageDataBefore.totalBorrowsCurrent,\n storageDataAfter.totalBorrowsCurrent,\n \"Mismatch in totalBorrowsCurrent\"\n );\n assertEq(\n storageDataBefore.balanceOfUnderlying,\n storageDataAfter.balanceOfUnderlying,\n \"Mismatch in balanceOfUnderlying\"\n );\n assertEq(\n storageDataBefore.borrowBalanceCurrent,\n storageDataAfter.borrowBalanceCurrent,\n \"Mismatch in borrowBalanceCurrent\"\n );\n assertEq(\n storageDataBefore.supplyRatePerBlock,\n storageDataAfter.supplyRatePerBlock,\n \"Mismatch in supplyRatePerBlock\"\n );\n assertEq(\n storageDataBefore.borrowRatePerBlock,\n storageDataAfter.borrowRatePerBlock,\n \"Mismatch in borrowRatePerBlock\"\n );\n assertEq(\n storageDataBefore.exchangeRateCurrent,\n storageDataAfter.exchangeRateCurrent,\n \"Mismatch in exchangeRateCurrent\"\n );\n assertEq(\n storageDataBefore.totalUnderlyingSupplied,\n storageDataAfter.totalUnderlyingSupplied,\n \"Mismatch in totalUnderlyingSupplied\"\n );\n assertEq(storageDataBefore.balanceOf, storageDataAfter.balanceOf, \"Mismatch in balanceOf\");\n assertEq(\n storageDataBefore.protocolSeizeShareMantissa,\n storageDataAfter.protocolSeizeShareMantissa,\n \"Mismatch in protocolSeizeShareMantissa\"\n );\n assertEq(\n storageDataBefore.feeSeizeShareMantissa,\n storageDataAfter.feeSeizeShareMantissa,\n \"Mismatch in feeSeizeShareMantissa\"\n );\n }\n\n function testCurrentMarkets() public debuggingOnly forkAtBlock(MODE_MAINNET, 10785800) {\n address[] memory ionAddresses = new address[](10);\n\n _upgradeMarket(wethMarket);\n\n ionAddresses[0] = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n ionAddresses[1] = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n ionAddresses[2] = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n ionAddresses[3] = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n ionAddresses[4] = 0x59e710215d45F584f44c0FEe83DA6d43D762D857;\n ionAddresses[5] = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310;\n ionAddresses[6] = 0x49950319aBE7CE5c3A6C90698381b45989C99b46;\n ionAddresses[7] = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18;\n ionAddresses[8] = 0x9a9072302B775FfBd3Db79a7766E75Cf82bcaC0A;\n ionAddresses[9] = 0x19F245782b1258cf3e11Eda25784A378cC18c108;\n\n address ap;\n for (uint i = 0; i < ionAddresses.length; i++) {\n // ap = address(CTokenFirstExtension(ionAddresses[i]).ap());\n ap = address(CTokenFirstExtension(address(wethMarket)).ap());\n emit log_named_address(\"ap\", ap);\n }\n }\n}\n" + }, + "contracts/test/PoolCapsAndBlacklistsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./config/MarketsTest.t.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract PoolCapsAndBlacklistsTest is MarketsTest {\n Comptroller pool;\n ComptrollerFirstExtension asExtension;\n address borrower = 0x28C0208b7144B511C73586Bb07dE2100495e92f3; // ANKR account\n address otherSupplier = 0x2924973E3366690eA7aE3FCdcb2b4e136Cf7f8Cc; // Supplier of ankrBNBAnkrMkt\n ICErc20 ankrBNBAnkrMkt = ICErc20(0x71693C84486B37096192c9942852f542543639Bf);\n ICErc20 ankrBNBMkt = ICErc20(0xb2b01D6f953A28ba6C8f9E22986f5bDDb7653aEa);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n // ankr pool\n pool = Comptroller(payable(0x1851e32F34565cb95754310b031C5a2Fc0a8a905));\n asExtension = ComptrollerFirstExtension(address(pool));\n _upgradeExistingPool(address(pool));\n\n _upgradeMarket(ankrBNBMkt);\n _upgradeMarket(ankrBNBAnkrMkt);\n\n // just some logging\n {\n uint256 borrowedAnkr = ankrBNBMkt.borrowBalanceCurrent(borrower);\n emit log_named_uint(\"ankrBnb borrow balance\", borrowedAnkr);\n uint256 collateralAnkr = ankrBNBAnkrMkt.balanceOf(borrower);\n emit log_named_uint(\"ankrBnb collateral balance of ankrBNB-ANKR\", collateralAnkr);\n\n uint256 borrowedOther = ankrBNBMkt.borrowBalanceCurrent(otherSupplier);\n emit log_named_uint(\"Other supplier borrower balance\", borrowedOther);\n uint256 collateralOther = ankrBNBAnkrMkt.balanceOf(otherSupplier);\n emit log_named_uint(\"Other supplier collateral balance of ankrBNB-ANKR\", collateralOther);\n\n emit log(\"\");\n emit log(\"Before collateral caps\");\n {\n (, , uint256 liq, uint256 sf) = pool.getAccountLiquidity(borrower);\n emit log_named_uint(\"Liq for account 1 before setting BC\", liq); // 1366119859198693075092\n emit log_named_uint(\"Shortfall for account 1 before setting BC\", sf); // 0\n emit log(\"\");\n (, , uint256 liq1, uint256 sf1) = pool.getAccountLiquidity(otherSupplier);\n emit log_named_uint(\"Liq for account 2 before setting BC\", liq1); // 24108891649595017\n emit log_named_uint(\"Shortfall for account 2 before setting BC\", sf1); // 0\n\n assertGt(liq, 0, \"expected positive liquidity\");\n assertGt(liq1, 0, \"expected positive liquidity\");\n emit log(\"\");\n }\n }\n }\n\n // TODO test with the latest block and contracts and/or without the FSL\n function testBorrowCapForCollateralWhitelist() public debuggingOnly forkAtBlock(BSC_MAINNET, 27827185) {\n emit log(\"\");\n emit log(\"Borrow Caps Set\");\n {\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateral(address(ankrBNBMkt), address(ankrBNBAnkrMkt), 1);\n (, , uint256 liqAfter, uint256 sfAfter) = pool.getAccountLiquidity(borrower);\n emit log_named_uint(\"Liq for account 1 after setting BC\", liqAfter);\n emit log_named_uint(\"Shortfall for account 1 after setting BC\", sfAfter);\n (, , uint256 liq1After, uint256 sf1After) = pool.getAccountLiquidity(otherSupplier);\n emit log(\"\");\n emit log_named_uint(\"Liq for account 2 after setting BC\", liq1After);\n emit log_named_uint(\"Shortfall for account 2 after setting BC\", sf1After);\n emit log(\"\");\n\n assertGt(sfAfter, 0, \"expected some shortfall for ankr\");\n assertEq(liq1After, 24108891649595017, \"expected liquidity for account 2 to decrease\");\n }\n\n {\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateralWhitelist(address(ankrBNBMkt), address(ankrBNBAnkrMkt), borrower, true);\n\n emit log(\"\");\n (, , uint256 liqAfterWl, uint256 sfAfterWl) = pool.getAccountLiquidity(borrower);\n (, , uint256 liq1AfterWl, uint256 sf1AfterWl) = pool.getAccountLiquidity(otherSupplier);\n assertEq(sfAfterWl, 0, \"expected shortfall to go back to 0\");\n assertEq(liqAfterWl, 1366119859198693075092, \"expected liq to go back to original\");\n\n // expect liq for second (not whitelisted) account to stay reduced\n assertEq(liq1AfterWl, 24108891649595017, \"expected liq to go back to prev value\");\n }\n }\n\n function testBlacklistBorrowingAgainstCollateralWhitelist() public debuggingOnly fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n vm.prank(pool.admin());\n asExtension._blacklistBorrowingAgainstCollateral(address(ankrBNBMkt), address(ankrBNBAnkrMkt), true);\n\n (, , uint256 liquidityAfterBlacklist, uint256 shortFallAfterBlacklist) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertGt(liquidityBefore - liquidityAfterBlacklist, 0, \"should have lower liquidity after bl\");\n\n vm.prank(pool.admin());\n asExtension._blacklistBorrowingAgainstCollateralWhitelist(\n address(ankrBNBMkt),\n address(ankrBNBAnkrMkt),\n borrower,\n true\n );\n\n (, , uint256 liquidityAfterWhitelist, uint256 shortFallWhitelist) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertEq(shortFallWhitelist, shortFallBefore, \"should have the same sf after wl\");\n assertEq(liquidityAfterWhitelist, liquidityBefore, \"should have the same liquidity after wl\");\n }\n\n function testSupplyCapWhitelist() public fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.startPrank(pool.admin());\n asExtension._setMarketSupplyCaps(markets, asArray(1, 1));\n asExtension._setMintPaused(ankrBNBMkt, false);\n asExtension._setMintPaused(ankrBNBAnkrMkt, false);\n vm.stopPrank();\n\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityBefore, liquidityAfterCap, \"should have the same liquidity after cap\");\n assertEq(shortFallBefore, shortFallAfterCap, \"should have the same shortfall after cap\");\n\n vm.expectRevert(\"!supply cap\");\n pool.mintAllowed(address(ankrBNBMkt), borrower, 2);\n\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(ankrBNBMkt), borrower, true);\n\n require(pool.mintAllowed(address(ankrBNBMkt), borrower, 2) == 0, \"mint not allowed after cap whitelist\");\n }\n\n function testBorrowCapWhitelist() public fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.prank(pool.admin());\n asExtension._setMarketBorrowCaps(markets, asArray(1, 1));\n\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityBefore, liquidityAfterCap, \"should have the same liquidity after cap\");\n assertEq(shortFallBefore, shortFallAfterCap, \"should have the same shortfall after cap\");\n\n vm.expectRevert(\"!borrow:cap\");\n pool.borrowAllowed(address(ankrBNBMkt), borrower, 2);\n\n vm.prank(pool.admin());\n asExtension._borrowCapWhitelist(address(ankrBNBMkt), borrower, true);\n\n require(pool.borrowAllowed(address(ankrBNBMkt), borrower, 2) == 0, \"borrow not allowed after cap whitelist\");\n }\n\n function testSupplyCapValue() public debuggingOnly forkAtBlock(BSC_MAINNET, 27827185) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.prank(pool.admin());\n asExtension._setMarketSupplyCaps(markets, asArray(1, 1));\n\n {\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityAfterCap, 0, \"should have no liquidity after\");\n assertGt(shortFallAfterCap, 0, \"should have positive shortfall after\");\n }\n\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(markets[0]), borrower, true);\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(markets[1]), borrower, true);\n\n {\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityAfterCap, liquidityBefore, \"liquidity after whitelist should match before\");\n assertEq(shortFallAfterCap, shortFallBefore, \"shortfall after whitelist should match before\");\n }\n }\n}\n" + }, + "contracts/test/PoolDirectoryTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract PoolDirectoryTest is BaseTest {\n PoolDirectory fpd;\n\n function afterForkSetUp() internal override {\n address fpdAddress = ap.getAddress(\"PoolDirectory\");\n fpd = PoolDirectory(fpdAddress);\n\n // upgrade to the current changes impl\n {\n PoolDirectory newImpl = new PoolDirectory();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(fpdAddress));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n }\n\n function testDeprecatePool() public fork(BSC_MAINNET) {\n _testDeprecatePool();\n }\n\n function _testDeprecatePool() internal {\n PoolDirectory.Pool[] memory allPools = fpd.getAllPools();\n\n PoolDirectory.Pool memory poolToDeprecate;\n\n // BOMB pool https://app.midascapital.xyz/56/pool/0\n uint256 index = 0;\n\n poolToDeprecate = allPools[index];\n\n vm.prank(fpd.owner());\n fpd._deprecatePool(index);\n\n (, PoolDirectory.Pool[] memory allPoolsAfter) = fpd.getActivePools();\n\n bool poolStillThere = false;\n for (uint256 i = 0; i < allPoolsAfter.length; i++) {\n if (allPoolsAfter[i].comptroller == poolToDeprecate.comptroller) {\n poolStillThere = true;\n break;\n }\n }\n\n assertTrue(!poolStillThere, \"deprecated pool is still there\");\n }\n}\n" + }, + "contracts/test/PoolLensTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./config/BaseTest.t.sol\";\n\nimport { PoolLens } from \"../PoolLens.sol\";\nimport \"../compound/ComptrollerInterface.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\n\ncontract PoolLensTest is BaseTest {\n function testPolygonFPL() public debuggingOnly fork(POLYGON_MAINNET) {\n PoolLens fpl = PoolLens(0xD7225110D8F419b0E8Ad0A536977965E62fB5769);\n fpl.getPoolAssetsWithData(IonicComptroller(0xB08A309eFBFFa41f36A06b2D0C9a4629749b17a2));\n }\n\n function testModeFPL() public debuggingOnly fork(MODE_MAINNET) {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLens fpl = PoolLens(0x611a68618412c2e15A36e3e59C0b979746d87AB8);\n PoolLens.PoolAsset[] memory datas = fpl.getPoolAssetsWithData(pool);\n\n emit log_named_uint(\"ionicFee\", datas[0].ionicFee);\n emit log_named_uint(\"adminFee\", datas[0].adminFee);\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 totalUnderlyingSupplied = markets[i].getTotalUnderlyingSupplied();\n uint256 totalBorrows = markets[i].totalBorrows();\n uint256 totalReserves = markets[i].totalReserves();\n uint256 cash = markets[i].getCash();\n\n emit log(\"\");\n emit log(markets[i].symbol());\n emit log_named_uint(\"totalUnderlyingSupplied\", totalUnderlyingSupplied);\n emit log_named_uint(\"totalBorrows\", totalBorrows);\n emit log_named_uint(\"totalReserves\", totalReserves);\n emit log_named_uint(\"cash\", cash);\n emit log_named_uint(\"reserves + fees\", cash + totalBorrows - totalUnderlyingSupplied);\n\n JumpRateModel irm = JumpRateModel(markets[i].interestRateModel());\n\n emit log_named_uint(\"blocksPerYear\", irm.blocksPerYear());\n\n emit log_named_uint(\n \"borrow rate per year\",\n irm.blocksPerYear() * irm.getBorrowRate(cash, totalBorrows, totalReserves)\n );\n emit log_named_uint(\n \"supply rate per year\",\n irm.blocksPerYear() * irm.getSupplyRate(cash, totalBorrows, totalReserves, 0.1e18)\n );\n }\n }\n\n function testWhitelistsFPL() public debuggingOnly fork(BSC_CHAPEL) {\n PoolLens fpl = PoolLens(0x604805B587C939042120D2e22398f299547A130c);\n fpl.getSupplyCapsDataForPool(IonicComptroller(0x307BEc9d1368A459E9168fa6296C1e69025ab30f));\n }\n}\n" + }, + "contracts/test/ProtocolAdminTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ProtocolAdminTest is BaseTest {\n address public expectedAdmin;\n\n function afterForkSetUp() internal virtual override {}\n\n function _checkIfAdmin(address addr, string memory contractName) internal {\n emit log(\"\");\n emit log(contractName);\n assertEq(addr, expectedAdmin, \"not the same admin address\");\n }\n\n function _checkSafeOwnableAdmin(string memory contractName) internal {\n SafeOwnableUpgradeable ownable = SafeOwnableUpgradeable(ap.getAddress(contractName));\n if (address(ownable) != address(0)) {\n _checkIfAdmin(ownable.owner(), contractName);\n }\n }\n\n function _checkOwnableAdmin(string memory contractName) internal {\n Ownable ownable = Ownable(ap.getAddress(contractName));\n if (address(ownable) != address(0)) {\n _checkIfAdmin(ownable.owner(), contractName);\n }\n }\n\n function testModeProtocolAdmin() public debuggingOnly fork(MODE_MAINNET) {\n expectedAdmin = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2; // gnosis safe multisig contract\n _testProtocolAdmin();\n }\n\n function _testProtocolAdmin() internal {\n //expectedAdmin = ap.owner();\n // safe ownable\n _checkSafeOwnableAdmin(\"FeeDistributor\");\n _checkSafeOwnableAdmin(\"PoolDirectory\");\n _checkSafeOwnableAdmin(\"OptimizedVaultsRegistry\");\n _checkSafeOwnableAdmin(\"AnkrCertificateTokenPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpLinearPoolPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpStablePoolPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpTokenPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpTokenPriceOracleNTokens\");\n _checkSafeOwnableAdmin(\"BalancerRateProviderOracle\");\n _checkSafeOwnableAdmin(\"BNBxPriceOracle\");\n _checkSafeOwnableAdmin(\"CurveLpTokenPriceOracleNoRegistry\");\n _checkSafeOwnableAdmin(\"CurveV2LpTokenPriceOracleNoRegistry\");\n _checkSafeOwnableAdmin(\"CurveV2PriceOracle\");\n _checkSafeOwnableAdmin(\"ERC4626Oracle\");\n _checkSafeOwnableAdmin(\"GammaPoolUniswapV3PriceOracle\");\n _checkSafeOwnableAdmin(\"GammaPoolAlgebraPriceOracle\");\n _checkSafeOwnableAdmin(\"PythPriceOracle\");\n _checkSafeOwnableAdmin(\"SimplePriceOracle\");\n _checkSafeOwnableAdmin(\"SolidlyPriceOracle\");\n _checkSafeOwnableAdmin(\"StkBNBPriceOracle\");\n _checkSafeOwnableAdmin(\"WSTEthPriceOracle\");\n _checkSafeOwnableAdmin(\"NativeUSDPriceOracle\");\n\n // ownable 2 step\n _checkSafeOwnableAdmin(\"LiquidatorsRegistry\");\n _checkSafeOwnableAdmin(\"LeveredPositionFactory\");\n _checkSafeOwnableAdmin(\"OptimizedAPRVault\");\n\n _checkOwnableAdmin(\"DefaultProxyAdmin\");\n _checkOwnableAdmin(\"DiaPriceOracle\");\n _checkOwnableAdmin(\"PoolDirectory\");\n\n assertEq(MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")).admin(), expectedAdmin, \"mpo admin incorrect\");\n\n // check all the pool admins and the flywheels owners\n PoolDirectory poolDir = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n PoolDirectory.Pool[] memory pools = poolDir.getAllPools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n assertEq(pool.admin(), expectedAdmin, \"pool admin does not match\");\n\n address[] memory flywheels = pool.getRewardsDistributors();\n for (uint256 j = 0; j < flywheels.length; j++) {\n assertEq(Ownable(flywheels[j]).owner(), expectedAdmin, \"flywheel owner not the admin\");\n }\n }\n }\n}\n" + }, + "contracts/test/SafeOwnableUpgradeableTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract SomeOwnable is SafeOwnableUpgradeable {\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n}\n\ncontract SafeOwnableUpgradeableTest is BaseTest {\n function testSafeOwnableUpgradeable() public {\n SomeOwnable someOwnable = new SomeOwnable();\n // deploy as a proxy/implementation\n {\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(someOwnable),\n address(dpa),\n abi.encodeWithSelector(someOwnable.initialize.selector)\n );\n someOwnable = SomeOwnable(address(proxy));\n }\n\n address joe = address(1234);\n\n address initOwner = someOwnable.owner();\n assertEq(initOwner, address(this), \"owner init value\");\n\n someOwnable._setPendingOwner(joe);\n\n address currentOwner = someOwnable.owner();\n assertEq(currentOwner, address(this), \"owner should not change yet\");\n\n vm.prank(joe);\n someOwnable._acceptOwner();\n\n address ownerAfter = someOwnable.owner();\n\n assertEq(ownerAfter, joe, \"ownership transfer failed\");\n }\n}\n" + }, + "contracts/test/UpgradesBaseTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20RewardsDelegate } from \"../compound/CErc20RewardsDelegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nabstract contract UpgradesBaseTest is BaseTest {\n FeeDistributor internal ffd;\n ComptrollerFirstExtension internal poolExt;\n CTokenFirstExtension internal marketExt;\n\n function afterForkSetUp() internal virtual override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n poolExt = new ComptrollerFirstExtension();\n marketExt = new CTokenFirstExtension();\n }\n\n function _upgradePoolWithExtension(Unitroller asUnitroller) internal {\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\n\n // instantiate the new implementation\n Comptroller newComptrollerImplementation = new Comptroller();\n vm.startPrank(ffd.owner());\n address comptrollerImplementationAddress = address(newComptrollerImplementation);\n ffd._setLatestComptrollerImplementation(address(0), comptrollerImplementationAddress);\n // add the extension to the auto upgrade config\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = poolExt;\n extensions[1] = newComptrollerImplementation;\n ffd._setComptrollerExtensions(comptrollerImplementationAddress, extensions);\n vm.stopPrank();\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(\n DiamondExtension(comptrollerImplementationAddress),\n DiamondExtension(asUnitroller.comptrollerImplementation())\n );\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function _upgradeMarketWithExtension(ICErc20 market) internal {\n // instantiate the new implementation\n CErc20Delegate newImpl;\n bytes memory becomeImplData = \"\";\n if (compareStrings(\"CErc20Delegate\", market.contractType())) {\n newImpl = new CErc20Delegate();\n } else if (compareStrings(\"CErc20PluginDelegate\", market.contractType())) {\n newImpl = new CErc20PluginDelegate();\n becomeImplData = abi.encode(address(0));\n } else if (compareStrings(\"CErc20RewardsDelegate\", market.contractType())) {\n newImpl = new CErc20RewardsDelegate();\n becomeImplData = abi.encode(address(0));\n } else {\n newImpl = new CErc20PluginRewardsDelegate();\n becomeImplData = abi.encode(address(0));\n }\n\n // set the new delegate as the latest\n vm.startPrank(ffd.owner());\n ffd._setLatestCErc20Delegate(newImpl.delegateType(), address(newImpl), abi.encode(address(0)));\n\n // add the extension to the auto upgrade config\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = marketExt;\n cErc20DelegateExtensions[1] = newImpl;\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\n vm.stopPrank();\n\n vm.stopPrank();\n // upgrade to the new delegate\n vm.prank(address(ffd));\n market._setImplementationSafe(address(newImpl), becomeImplData);\n }\n}\n" + }, + "contracts/test/veION/contracts/Bribes/BribeRewards.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"forge-std/Test.sol\";\nimport \"../../../../veION/BribeRewards.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../../config/BaseTest.t.sol\";\nimport \"../../../../veION/Voter.sol\";\nimport \"../../../../oracles/MasterPriceOracle.sol\";\nimport { SimplePriceOracle } from \"../../../../oracles/default/SimplePriceOracle.sol\";\nimport \"../../../../veION/libraries/IonicTimeLibrary.sol\";\n\ncontract BribeRewardsTest is BaseTest {\n MockERC20 bribeTokenA;\n MockERC20 bribeTokenB;\n MockERC20 bribeTokenC;\n BribeRewards bribeRewards;\n SimplePriceOracle simpleOracle;\n address ve = address(0x123);\n address voter = address(0x456);\n address rewardToken = 0x18470019bF0E94611f15852F7e93cf5D65BC34CA;\n address lpTokenA = address(0x5);\n address lpTokenB = address(0x6);\n uint256 tokenId = 1;\n uint256 amount = 1000 ether;\n address user = address(0x789);\n\n function setUp() public {\n bribeRewards = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), ve)\n )\n )\n );\n\n address[] memory mockLpTokens = new address[](2);\n mockLpTokens[0] = lpTokenA;\n mockLpTokens[1] = lpTokenB;\n vm.mockCall(address(voter), abi.encodeWithSelector(IVoter.getAllLpRewardTokens.selector), abi.encode(mockLpTokens));\n\n bribeTokenA = new MockERC20(\"Bribe Token A\", \"BTA\", 18);\n bribeTokenB = new MockERC20(\"Bribe Token B\", \"BTB\", 18);\n bribeTokenC = new MockERC20(\"Bribe Token C\", \"BTC\", 18);\n\n address[] memory bribeTokens = new address[](3);\n bribeTokens[0] = address(bribeTokenA);\n bribeTokens[1] = address(bribeTokenB);\n bribeTokens[2] = address(bribeTokenC);\n\n for (uint256 i = 0; i < bribeTokens.length; i++) {\n vm.mockCall(\n address(voter),\n abi.encodeWithSelector(IVoter.isWhitelistedToken.selector, bribeTokens[i]),\n abi.encode(true)\n );\n\n vm.mockCall(ve, abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenId), abi.encode(user));\n }\n }\n\n function test_deposit_VoterCanDeposit() public {\n vm.prank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n\n uint256 balance = bribeRewards.balanceOf(tokenId, lpTokenA);\n assertEq(balance, amount, \"Balance should be equal to deposited amount\");\n uint256 totalSupply = bribeRewards.totalSupply(lpTokenA);\n assertEq(totalSupply, amount, \"Total supply should be equal to deposited amount\");\n }\n\n function test_withdraw_VoterCanWithdraw() public {\n vm.prank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n\n vm.prank(address(voter));\n bribeRewards.withdraw(lpTokenA, amount, tokenId);\n\n uint256 balance = bribeRewards.balanceOf(tokenId, lpTokenA);\n assertEq(balance, 0, \"Balance should be zero after withdrawal\");\n }\n\n function test_getReward_VoterCanGetReward() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1_000_000 ether);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(bribeTokenA);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n bribeRewards.getReward(tokenId, tokens);\n vm.stopPrank();\n\n uint256 lastEarned = bribeRewards.lastEarn(tokens[0], tokenId);\n assertEq(lastEarned, block.timestamp, \"Last earned timestamp should be updated\");\n }\n\n function test_earned_EarnedShouldBeCorrect() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n bribeRewards.deposit(lpTokenB, amount, tokenId);\n vm.stopPrank();\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n vm.warp(block.timestamp + 1 weeks);\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n emit log_named_uint(\"Epoch Start\", IonicTimeLibrary.epochStart(block.timestamp));\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 2e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 8e18);\n vm.warp(block.timestamp + 1 weeks);\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n emit log_named_uint(\"Epoch Start\", IonicTimeLibrary.epochStart(block.timestamp));\n\n uint256 earnedAmount = bribeRewards.earned(address(bribeTokenA), tokenId);\n emit log(\"--------------------------------------END EARNED--------------------------------------\");\n emit log_named_uint(\"Earned amount\", earnedAmount);\n\n assertEq(earnedAmount, 2000 ether, \"Earned amount should be 2000 ether\");\n }\n\n function test_earned_MultipleBribeRewardsSandbox() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenB.mint(address(this), 1_000_000 ether);\n bribeTokenB.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenC.mint(address(this), 1_000_000 ether);\n bribeTokenC.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n vm.warp(block.timestamp + 3 days);\n bribeRewards.deposit(lpTokenB, amount, tokenId);\n vm.stopPrank();\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\n console.log(\"----------------------------------------------------------------\");\n emit log_named_uint(\"Epoch Start\", epochStart);\n\n uint256 priorBalanceIndexA = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n uint256 priorBalanceIndexB = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenB, block.timestamp);\n BribeRewards.Checkpoint memory checkpointA = bribeRewards.getCheckpoint(tokenId, lpTokenA, priorBalanceIndexA);\n BribeRewards.Checkpoint memory checkpointB = bribeRewards.getCheckpoint(tokenId, lpTokenB, priorBalanceIndexB);\n\n emit log_named_uint(\"Prior Balance Index for lpTokenA\", priorBalanceIndexA);\n emit log_named_uint(\"Prior Balance Index for lpTokenB\", priorBalanceIndexB);\n\n emit log_named_uint(\"Checkpoint lpTokenA Timestamp\", checkpointA.timestamp);\n emit log_named_uint(\"Checkpoint lpTokenA BalanceOf\", checkpointA.balanceOf);\n emit log_named_uint(\"Checkpoint lpTokenB Timestamp\", checkpointB.timestamp);\n emit log_named_uint(\"Checkpoint lpTokenB BalanceOf\", checkpointB.balanceOf);\n\n uint256 tokenRewardsEpochA = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenA), epochStart);\n uint256 tokenRewardsEpochB = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenB), epochStart);\n uint256 tokenRewardsEpochC = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenC), epochStart);\n\n emit log_named_uint(\"Token Rewards for bribeTokenA in current epoch\", tokenRewardsEpochA);\n emit log_named_uint(\"Token Rewards for bribeTokenB in current epoch\", tokenRewardsEpochB);\n emit log_named_uint(\"Token Rewards for bribeTokenC in current epoch\", tokenRewardsEpochC);\n\n uint256 historicalPriceA = bribeRewards.historicalPrices(lpTokenA, epochStart);\n uint256 historicalPriceB = bribeRewards.historicalPrices(lpTokenB, epochStart);\n\n emit log_named_uint(\"Historical Price for lpTokenA in current epoch\", historicalPriceA);\n emit log_named_uint(\"Historical Price for lpTokenB in current epoch\", historicalPriceB);\n console.log(\"----------------------------------------------------------------\");\n\n vm.warp(block.timestamp + 4 days - 2);\n\n // uint256 earnedA = bribeRewards.earned(address(bribeTokenA), tokenId);\n // uint256 earnedB = bribeRewards.earned(address(bribeTokenB), tokenId);\n // uint256 earnedC = bribeRewards.earned(address(bribeTokenC), tokenId);\n\n // emit log_named_uint(\"Earned rewards for bribeTokenA\", earnedA);\n // emit log_named_uint(\"Earned rewards for bribeTokenB\", earnedB);\n // emit log_named_uint(\"Earned rewards for bribeTokenC\", earnedC);\n\n // START OF NEW EPOCH\n vm.warp(block.timestamp + 1); //604800\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2e18);\n\n vm.warp(block.timestamp + 3 days);\n vm.warp(block.timestamp + 4 days - 1);\n vm.warp(block.timestamp + 1);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2e18);\n\n vm.warp(block.timestamp + 7 days);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.1e18);\n\n vm.warp(block.timestamp + 7 days);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.2e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.2e18);\n vm.warp(block.timestamp + 7 days);\n\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18);\n\n vm.warp(block.timestamp + 7 days);\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18);\n\n vm.startPrank(address(voter));\n bribeRewards.withdraw(lpTokenA, 1000 ether, tokenId);\n bribeRewards.withdraw(lpTokenB, 1000 ether, tokenId);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 7 days);\n\n for (uint256 i = 0; i < 5; i++) {\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18 + (i * 0.1e18));\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18 + (i * 0.1e18));\n\n vm.warp(block.timestamp + 7 days);\n }\n\n uint256 earnedA = bribeRewards.earned(address(bribeTokenA), tokenId);\n emit log_named_uint(\"Earned rewards for bribeTokenA\", earnedA);\n\n assertEq(earnedA, 5999999999999999999996, \"EarnedA assertion incorrect\");\n\n uint256 priorBalanceIndex = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n emit log_named_uint(\"Prior Balance Index for current timestamp and lpTokenA\", priorBalanceIndex);\n BribeRewards.Checkpoint memory checkpoint = bribeRewards.getCheckpoint(tokenId, lpTokenA, priorBalanceIndex);\n emit log_named_uint(\"Prior Balance Index for current timestamp and lpTokenA\", priorBalanceIndex);\n emit log_named_uint(\"Checkpoint Timestamp\", checkpoint.timestamp);\n emit log_named_uint(\"Checkpoint BalanceOf\", checkpoint.balanceOf);\n }\n\n function test_earned_PriorBalanceIndexShouldRemainConstantIfDepositInSameEpoch() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenB.mint(address(this), 1_000_000 ether);\n bribeTokenB.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenC.mint(address(this), 1_000_000 ether);\n bribeTokenC.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenA, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenA, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 10 weeks);\n\n uint256 priorBalanceIndexA = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n uint256 priorBalanceIndexB = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenB, block.timestamp);\n\n emit log_named_uint(\"Prior Balance Index for lpTokenA\", priorBalanceIndexA);\n emit log_named_uint(\"Prior Balance Index for lpTokenB\", priorBalanceIndexB);\n\n assertEq(priorBalanceIndexA, 0, \"Prior Balance Index for lpTokenA should be 0\");\n assertEq(priorBalanceIndexB, 0, \"Prior Balance Index for lpTokenB should be 0\");\n }\n\n function test_earned_MultipleDepositors() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks); // Advance time by one epoch (assuming 1 week per epoch)\n }\n\n uint256 totalSupplyA = bribeRewards.totalSupply(lpTokenA);\n uint256 totalSupplyB = bribeRewards.totalSupply(lpTokenB);\n emit log_named_uint(\"Total Supply for lpTokenA\", totalSupplyA / 1e18);\n emit log_named_uint(\"Total Supply for lpTokenB\", totalSupplyB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n vm.startPrank(user);\n\n uint256 balanceA = bribeRewards.balanceOf(i, lpTokenA);\n uint256 balanceB = bribeRewards.balanceOf(i, lpTokenB);\n\n emit log_named_uint(\"Token ID\", i);\n emit log_named_uint(string(abi.encodePacked(\"Balance of user for lpTokenA\")), balanceA / 1e18);\n emit log_named_uint(string(abi.encodePacked(\"Balance of user for lpTokenB\")), balanceB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n vm.stopPrank();\n }\n\n uint256 totalBribeTokenA = bribeTokenA.balanceOf(address(bribeRewards));\n uint256 totalBribeTokenB = bribeTokenB.balanceOf(address(bribeRewards));\n uint256 totalBribeTokenC = bribeTokenC.balanceOf(address(bribeRewards));\n\n emit log_named_uint(\"Total Bribe Token A in Contract\", totalBribeTokenA / 1e18);\n emit log_named_uint(\"Total Bribe Token B in Contract\", totalBribeTokenB / 1e18);\n emit log_named_uint(\"Total Bribe Token C in Contract\", totalBribeTokenC / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n address randomUser = address(0x1234);\n uint256 tokenIdToMock = tokenIds[0];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdToMock),\n abi.encode(randomUser)\n );\n\n address[] memory rewardTokens = new address[](3);\n rewardTokens[0] = address(bribeTokenA);\n rewardTokens[1] = address(bribeTokenB);\n rewardTokens[2] = address(bribeTokenC);\n\n vm.prank(voter);\n bribeRewards.getReward(tokenIdToMock, rewardTokens);\n\n uint256 balanceForTokenIdToMockA = bribeRewards.balanceOf(tokenIdToMock, lpTokenA);\n uint256 balanceForTokenIdToMockB = bribeRewards.balanceOf(tokenIdToMock, lpTokenB);\n\n emit log_named_uint(\"Balance for tokenIdToMock for lpTokenA\", balanceForTokenIdToMockA / 1e18);\n emit log_named_uint(\"Balance for tokenIdToMock for lpTokenB\", balanceForTokenIdToMockB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n uint256 userBribeTokenABalance = bribeTokenA.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token A Balance after Redemption\", userBribeTokenABalance / 1e18);\n\n uint256 expectedRewardA = (totalBribeTokenA * 5) / 100;\n uint256 actualRewardA = userBribeTokenABalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token A)\", expectedRewardA / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token A\", actualRewardA / 1e18);\n\n assertApproxEqAbs(actualRewardA, expectedRewardA, 50 ether, \"Bribe Token A reward does not match expected value\");\n\n uint256 userBribeTokenBBalance = bribeTokenB.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token B Balance after Redemption\", userBribeTokenBBalance / 1e18);\n\n uint256 expectedRewardB = (totalBribeTokenB * 5) / 100;\n uint256 actualRewardB = userBribeTokenBBalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token B)\", expectedRewardB / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token B\", actualRewardB / 1e18);\n\n assertApproxEqAbs(actualRewardB, expectedRewardB, 50 ether, \"Bribe Token B reward does not match expected value\");\n\n uint256 userBribeTokenCBalance = bribeTokenC.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token C Balance after Redemption\", userBribeTokenCBalance / 1e18);\n\n uint256 expectedRewardC = (totalBribeTokenC * 5) / 100;\n uint256 actualRewardC = userBribeTokenCBalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token C)\", expectedRewardC / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token C\", actualRewardC / 1e18);\n\n assertApproxEqAbs(actualRewardC, expectedRewardC, 50 ether, \"Bribe Token C reward does not match expected value\");\n }\n\n function test_earned_UserWithdraws() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks); //\n }\n\n uint256 tokenIdToWithdraw = tokenIds[0];\n for (uint256 j = 0; j < lpTokens.length; j++) {\n address selectedLpToken = lpTokens[j];\n uint256 balanceBeforeWithdraw = bribeRewards.balanceOf(tokenIdToWithdraw, selectedLpToken);\n\n vm.prank(address(voter));\n bribeRewards.withdraw(selectedLpToken, balanceBeforeWithdraw, tokenIdToWithdraw);\n }\n uint256 tokenIdNotWithdrawn = tokenIds[1];\n\n uint256 earnedForTokenIdNotWithdrawn = bribeRewards.earned(address(bribeTokenA), tokenIdNotWithdrawn);\n emit log_named_uint(\"Earned for Bribe Token A for Token ID not withdrawn\", earnedForTokenIdNotWithdrawn / 1e18);\n\n uint256 totalEarnedABefore = bribeRewards.earned(address(bribeTokenA), tokenIdToWithdraw);\n emit log_named_uint(\"Total Earned for Bribe Token A after Withdraw\", totalEarnedABefore / 1e18);\n\n for (uint256 epoch = 0; epoch < 30; epoch++) {\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 totalEarnedAAfter = bribeRewards.earned(address(bribeTokenA), tokenIdToWithdraw);\n emit log_named_uint(\"Total Earned for Bribe Token A after timeskip\", totalEarnedAAfter / 1e18);\n\n assertEq(\n totalEarnedABefore,\n totalEarnedAAfter,\n \"Total earned for Bribe Token A should be the same before and after.\"\n );\n\n uint256 earnedForNotWithdrawn = bribeRewards.earned(address(bribeTokenA), tokenIdNotWithdrawn);\n emit log_named_uint(\"Earned for Bribe Token A for Token ID that didn't withdraw\", earnedForNotWithdrawn / 1e18);\n\n assertGt(\n earnedForNotWithdrawn,\n totalEarnedAAfter,\n \"Token ID that did not withdraw should have more earned than the token ID that withdrew.\"\n );\n }\n\n function test_earned_RewardCalculationResetsAfterCollectingReward() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 tokenIdThatClaims = tokenIds[0];\n uint256 tokenIdThatDontClaim = tokenIds[1];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdThatClaims),\n abi.encode(address(this))\n );\n\n address[] memory bribeTokens = new address[](3);\n bribeTokens[0] = address(bribeTokenA);\n bribeTokens[1] = address(bribeTokenB);\n bribeTokens[2] = address(bribeTokenC);\n vm.prank(address(voter));\n bribeRewards.getReward(tokenIdThatClaims, bribeTokens);\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 earnedAfterClaim = bribeRewards.earned(address(bribeTokenA), tokenIdThatClaims);\n emit log_named_uint(\"Earned for Bribe Token A after claiming and 10 more epochs\", earnedAfterClaim / 1e18);\n\n uint256 earnedNeverClaimed = bribeRewards.earned(address(bribeTokenA), tokenIdThatDontClaim);\n emit log_named_uint(\"Earned for Bribe Token A for user who never claimed\", earnedNeverClaimed / 1e18);\n\n assertGt(\n earnedNeverClaimed,\n earnedAfterClaim,\n \"User who never claimed should have more earned than the user who claimed.\"\n );\n }\n\n function test_earned_ClaimOnlyOneToken() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n address[] memory tokensToClaim = new address[](1);\n tokensToClaim[0] = address(bribeTokenA);\n\n uint256 tokenIdToClaim = tokenIds[0];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdToClaim),\n abi.encode(address(this))\n );\n\n vm.prank(address(voter));\n bribeRewards.getReward(tokenIdToClaim, tokensToClaim);\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 earnedBribeA = bribeRewards.earned(address(bribeTokenA), tokenIdToClaim);\n uint256 earnedBribeB = bribeRewards.earned(address(bribeTokenB), tokenIdToClaim);\n uint256 earnedBribeC = bribeRewards.earned(address(bribeTokenC), tokenIdToClaim);\n\n emit log_named_uint(\"Earned for Bribe Token A\", earnedBribeA / 1e18);\n emit log_named_uint(\"Earned for Bribe Token B\", earnedBribeB / 1e18);\n emit log_named_uint(\"Earned for Bribe Token C\", earnedBribeC / 1e18);\n\n assertGt(earnedBribeB, earnedBribeA, \"Bribe Token B earned should be greater than Bribe Token A earned.\");\n assertGt(earnedBribeC, earnedBribeA, \"Bribe Token C earned should be greater than Bribe Token A earned.\");\n }\n\n function _performDeposits(\n address[] memory lpTokens,\n uint256[] memory tokenIds,\n uint256 minDepositAmount,\n uint256 maxDepositAmount\n ) internal {\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n for (uint256 j = 0; j < lpTokens.length; j++) {\n address selectedLpToken = lpTokens[j];\n uint256 randomAmount = minDepositAmount +\n (uint256(keccak256(abi.encodePacked(block.timestamp, i, j))) % (maxDepositAmount - minDepositAmount));\n vm.prank(address(voter));\n bribeRewards.deposit(selectedLpToken, randomAmount, tokenIds[i]);\n }\n }\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/BalanceOfNFT.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract BalanceOfNFT is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpBase();\n baseTokenIdSingleLp = _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n }\n\n function test_balanceOfNFT_GetsBalanceIfLockExists() public {\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n assertEq(assets.length, 1, \"Assets array length should be 1\");\n assertEq(balances.length, 1, \"Balances array length should be 1\");\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n\n console.log(\"Lock start time test:\", lock.start);\n console.log(\"Lock end time test:\", lock.end);\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqAbs(\n balances[i],\n lockInput.tokenAmount / 2,\n 3e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_GivesMinimalBoostWhenLockMinimum() public {\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = MINTIME;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n (, , uint256[] memory boosts) = IveION(ve).balanceOfNFT(tokenId);\n\n assertEq(boosts[0], 1e18, \"Boost should match the lock input\");\n }\n\n function test_balanceOfNFT_GivesMaximumBoostWhenLockMaximum() public {\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = MAXTIME;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n (, , uint256[] memory boosts) = IveION(ve).balanceOfNFT(tokenId);\n\n assertApproxEqRel(boosts[0], 2e18, 0.01e18, \"Boost should match the lock input\");\n }\n\n function test_balanceOfNFT_GetsBalanceForMultiLPLock() public {\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInputMultiLP.tokenId\n );\n\n assertEq(assets.length, 2, \"Assets array length should be 1\");\n assertEq(balances.length, 2, \"Balances array length should be 1\");\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInputMultiLP.tokenAddresses[i], \"Asset address should match the lock input\");\n assertApproxEqRel(\n balances[i],\n lockInputMultiLP.tokenAmounts[i] / 2,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_BalanceDecreasesLinearlyWithTime() public {\n vm.warp(block.timestamp + 26 weeks);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(\n balances[i],\n lockInput.tokenAmount / 4,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_BalanceEventuallyGoesToZero() public {\n vm.warp(block.timestamp + 52 weeks);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], 0, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOFNFT_ShouldGiveEventBasedBoost() public {\n uint256 limitedBoost = 0.5e18;\n IveION(ve).toggleLimitedBoost(true);\n IveION(ve).setLimitedTimeBoost(limitedBoost);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(\n boosts[i],\n harness.exposed_calculateBoost(lock.end - lock.start) + limitedBoost,\n \"Boost should match the lock input\"\n );\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_ShouldGiveAeroVotingBasedBoost() public {\n address aeroVotingAddress = address(0x123);\n uint256 aeroVoterBoost = 1e18;\n address ionicPoolAddress = address(0x456);\n address veAEROAddress = address(0x789);\n\n IveION(ve).setAeroVoting(aeroVotingAddress);\n IveION(ve).setAeroVoterBoost(aeroVoterBoost);\n IveION(ve).setIonicPool(ionicPoolAddress);\n IveION(ve).setVeAERO(veAEROAddress);\n\n vm.mockCall(\n veAEROAddress,\n abi.encodeWithSelector(IAeroVotingEscrow(veAEROAddress).balanceOf.selector, user),\n abi.encode(1) // Mock that the user has 1 veAERO token\n );\n\n vm.mockCall(\n veAEROAddress,\n abi.encodeWithSelector(IAeroVotingEscrow(veAEROAddress).ownerToNFTokenIdList.selector, user, 0),\n abi.encode(1) // Mock that the tokenId list returns 1\n );\n\n vm.mockCall(\n aeroVotingAddress,\n abi.encodeWithSelector(IAeroVoter(aeroVotingAddress).votes.selector, 1, ionicPoolAddress),\n abi.encode(1e18) // Mock that the votes for the ionicPool is 1e18\n );\n\n vm.mockCall(\n aeroVotingAddress,\n abi.encodeWithSelector(IAeroVoter(aeroVotingAddress).weights.selector, ionicPoolAddress),\n abi.encode(1e18) // Mock that the weight of the ionicPool is 1e18\n );\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(\n boosts[i],\n harness.exposed_calculateBoost(lock.end - lock.start) + aeroVoterBoost,\n \"Boost should match the lock input\"\n );\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_ShouldGiveAeroVotingBasedBoostFork() public forkAtBlock(BASE_MAINNET, 22722980) {\n AeroBoostVars memory vars;\n vars.aeroVoterBoost = 1e18;\n vars.aeroVotingAddress = 0x16613524e02ad97eDfeF371bC883F2F5d6C480A5;\n vars.ionicPoolAddress = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n vars.veAEROAddress = 0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4;\n vars.AERO = 0x940181a94A35A4569E4529A3CDfB74e38FD98631;\n vars.lockAmount = 20_000_000 ether;\n\n vars.poolVote = new address[](1);\n vars.weights = new uint256[](1);\n vars.poolVote[0] = vars.ionicPoolAddress;\n vars.weights[0] = 1e18; // 100% of the vote\n\n IveION(ve).setAeroVoting(vars.aeroVotingAddress);\n IveION(ve).setAeroVoterBoost(vars.aeroVoterBoost);\n IveION(ve).setIonicPool(vars.ionicPoolAddress);\n IveION(ve).setVeAERO(vars.veAEROAddress);\n\n vars.aeroWhale = 0x6cDcb1C4A4D1C3C6d054b27AC5B77e89eAFb971d;\n vm.prank(vars.aeroWhale);\n IERC20(vars.AERO).transfer(baseUser, vars.lockAmount);\n\n vm.startPrank(baseUser);\n IERC20(vars.AERO).approve(vars.veAEROAddress, vars.lockAmount);\n vars.veAeroTokenId = IveAERO(vars.veAEROAddress).createLock(vars.lockAmount, 2 * 365 * 86400);\n IAEROVoter(vars.aeroVotingAddress).vote(vars.veAeroTokenId, vars.poolVote, vars.weights);\n vm.stopPrank();\n\n uint256 weight = IAEROVoter(vars.aeroVotingAddress).votes(vars.veAeroTokenId, vars.ionicPoolAddress);\n\n console.log(\"Pool weight\", weight);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n baseTokenIdSingleLp\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n baseTokenIdSingleLp,\n IveION(ve).s_lpType(assets[i])\n );\n assertGt(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_IfVeAEROContractSetAndUserHasNoVoteThenBoostUnaffected() public {\n address aeroVotingAddress = address(0x123);\n uint256 aeroVoterBoost = 1e18;\n address ionicPoolAddress = address(0x456);\n address veAEROAddress = address(0x789);\n\n IveION(ve).setAeroVoting(aeroVotingAddress);\n IveION(ve).setAeroVoterBoost(aeroVoterBoost);\n IveION(ve).setIonicPool(ionicPoolAddress);\n IveION(ve).setVeAERO(veAEROAddress);\n\n vm.mockCall(\n veAEROAddress,\n abi.encodeWithSelector(IAeroVotingEscrow(veAEROAddress).balanceOf.selector, user),\n abi.encode(0) // Mock that the user has 1 veAERO token\n );\n\n vm.mockCall(\n aeroVotingAddress,\n abi.encodeWithSelector(IAeroVoter(aeroVotingAddress).weights.selector, ionicPoolAddress),\n abi.encode(1e18) // Mock that the weight of the ionicPool is 1e18\n );\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_GetsBalanceForPermanentLock() public {\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_BalanceOfPermanentDoesNotDecay() public {\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n\n vm.warp(block.timestamp + 10 * 365 * 86400);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_GetsBalanceForPermanentLockWithDelegator() public {\n address delegator = address(0x2352);\n LockInfo memory delegatorInfo = _createLockInternal(delegator);\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n\n vm.startPrank(delegator);\n IveION(ve).lockPermanent(delegatorInfo.tokenAddress, delegatorInfo.tokenId);\n IveION(ve).delegate(\n delegatorInfo.tokenId,\n lockInput.tokenId,\n delegatorInfo.tokenAddress,\n delegatorInfo.tokenAmount\n );\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount * 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_GetsBalanceForPermanentWithDelegatee() public {\n address delegatee = address(0x2352);\n LockInfo memory delegateeInfo = _createLockInternal(delegatee);\n vm.prank(delegatee);\n IveION(ve).lockPermanent(delegateeInfo.tokenAddress, delegateeInfo.tokenId);\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n IveION(ve).delegate(lockInput.tokenId, delegateeInfo.tokenId, lockInput.tokenAddress, lockInput.tokenAmount);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertEq(balances[i], 0, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterIncreaseAmount() public {\n uint256 additionalAmount = 1000 * 1e18;\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(lockInput.tokenAddress, lockInput.tokenId, lockInput.tokenAmount, false);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(\n balances[i],\n lockInput.tokenAmount,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterLockAdditionalAsset() public {\n uint256 additionalAmount = 1000 * 1e18;\n modeBalancer8020IonEth.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), additionalAmount);\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n lockInput.duration,\n false\n );\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lock.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterIncreaseUnlockTime() public {\n vm.prank(user);\n IveION(ve).increaseUnlockTime(lockInput.tokenAddress, lockInput.tokenId, 2 * 365 * 86400);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lock.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterWithdraw() public {\n vm.prank(user);\n IveION(ve).withdraw(lockInput.tokenAddress, lockInput.tokenId);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lock.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], 0, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterMerge() public {\n vm.prank(user);\n IveION(ve).merge(lockInput.tokenId, lockInputMultiLP.tokenId);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], address(0), \"Asset address should be 0\");\n assertEq(balances[i], 0, \"Balance should be 0\");\n assertEq(boosts[i], 0, \"Boost should match the lock input\");\n }\n\n (address[] memory assetsMultiLP, uint256[] memory balancesMultiLP, uint256[] memory boostsMultiLP) = IveION(ve)\n .balanceOfNFT(lockInputMultiLP.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n IveION(ve).s_lpType(assetsMultiLP[0])\n );\n assertEq(assetsMultiLP[0], lockInputMultiLP.tokenAddresses[0], \"Asset address should match the lock input\");\n assertApproxEqRel(\n balancesMultiLP[0],\n lockInput.tokenAmount,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(\n boostsMultiLP[0],\n harness.exposed_calculateBoost(lock.end - lock.start),\n \"Boost should match the lock input\"\n );\n }\n\n function test_balanceOfNFT_BalanceChangesAfterSplit() public {\n IveION(ve).toggleSplit(address(0), true);\n vm.prank(user);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInput.tokenAddress,\n lockInput.tokenId,\n lockInput.tokenAmount / 2\n );\n\n (address[] memory assets1, uint256[] memory balances1, uint256[] memory boosts1) = IveION(ve).balanceOfNFT(\n tokenId1\n );\n (address[] memory assets2, uint256[] memory balances2, uint256[] memory boosts2) = IveION(ve).balanceOfNFT(\n tokenId2\n );\n\n for (uint256 i = 0; i < assets1.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets1[i])\n );\n assertEq(assets1[i], lock.tokenAddress, \"Asset address should be 0\");\n assertApproxEqRel(balances1[i], MINT_AMT / 4, 0.01e18, \"Balance should be 0\");\n assertEq(boosts1[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n\n for (uint256 i = 0; i < assets2.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets2[i])\n );\n assertEq(assets2[i], lock.tokenAddress, \"Asset address should be 0\");\n assertApproxEqRel(balances2[i], MINT_AMT / 4, 0.01e18, \"Balance should be 0\");\n assertEq(boosts2[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterUnlockPermanent() public {\n address delegatee = address(0x2352);\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n IveION(ve).unlockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], MINT_AMT, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterRemoveDelegation() public {\n address delegatee = address(0x2352);\n LockInfo memory delegateeInfo = _createLockInternal(delegatee);\n vm.prank(delegatee);\n IveION(ve).lockPermanent(delegateeInfo.tokenAddress, delegateeInfo.tokenId);\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n IveION(ve).delegate(lockInput.tokenId, delegateeInfo.tokenId, lockInput.tokenAddress, lockInput.tokenAmount);\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = delegateeInfo.tokenId;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = lockInput.tokenAmount;\n IveION(ve).removeDelegatees(lockInput.tokenId, toTokenIds, lockInput.tokenAddress, amounts);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertEq(balances[i], MINT_AMT, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_NonExistentTokenId() public {\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(23526);\n assertEq(assets.length, 0, \"Assets array should be empty\");\n assertEq(balances.length, 0, \"Balances array should be empty\");\n assertEq(boosts.length, 0, \"Boosts array should be empty\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/ClaimEmissions.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract ClaimEmissions is veIONTest {\n address alice;\n address bob;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n alice = address(0x8325);\n bob = address(0x2542);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(alice);\n }\n\n function setUp() public {\n _setUp();\n emit log(\"setUp function override is running\");\n }\n\n function test_claimEmissions_UserCanClaimEmissionsFromUnderlyingStake() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.warp(block.timestamp + 1 weeks);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n vm.prank(alice);\n IveION(ve).claimEmissions(address(ionMode5050LP));\n\n assertTrue(reward > 0, \"Reward should be greater than zero after 1 week\");\n }\n\n function test_claimEmissions_NoEmissionsToClaim() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(bob);\n vm.expectRevert(abi.encodeWithSignature(\"NoUnderlyingStake()\"));\n IveION(ve).claimEmissions(address(ionMode5050LP));\n }\n\n function test_claimEmissions_WithdrawThenClaim() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.warp(block.timestamp + 1 weeks);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n vm.startPrank(alice);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, lockInfoAlice.tokenId);\n IveION(ve).claimEmissions(address(ionMode5050LP));\n vm.stopPrank();\n\n address rewardToken = veloIonModeStakingStrategy.rewardToken();\n assertEq(IERC20(rewardToken).balanceOf(alice), reward, \"Alice should have gotten no reward\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/CreateLock.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract CreateLock is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n }\n\n function test_createLock_UserCanCreateLock() public {\n TestVars memory vars;\n vars.user = address(0x1234);\n\n LockInfo memory lockInput = _createLockInternal(vars.user);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress)\n );\n\n vars.lockedBalance_end_test = ((block.timestamp + lockInput.duration) / WEEK) * WEEK;\n vars.expectedSupply = lockInput.tokenAmount;\n vars.userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n vars.userEpoch\n );\n vars.ownerTokenIds = IveION(ve).getOwnedTokenIds(vars.user);\n vars.assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(lockInput.tokenAddress, actualLock.tokenAddress, \"Token address mismatch\");\n assertEq(lockInput.tokenAmount, actualLock.amount, \"Token amount mismatch\");\n assertEq(vars.lockedBalance_end_test, actualLock.end, \"Unlock time mismatch\");\n assertEq(false, actualLock.isPermanent, \"Lock should not be permanent\");\n assertEq(IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress)), actualLock.amount, \"Supply mismatch\");\n assertEq(vars.userEpoch, 1, \"User epoch mismatch\");\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertGt(userPoint.bias, 0, \"User point bias mismatch\");\n assertGt(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, 0, \"User point permanent mismatch\");\n assertEq(IveION(ve).s_tokenId(), lockInput.tokenId, \"Token ID mismatch\");\n assertEq(vars.ownerTokenIds.length, 1, \"Owner should have one token ID\");\n assertEq(vars.ownerTokenIds[0], lockInput.tokenId, \"Owner token ID mismatch\");\n assertEq(vars.assetsLocked.length, 1, \"Assets locked length mismatch\");\n assertEq(vars.assetsLocked[0], lockInput.tokenAddress, \"Assets locked address mismatch\");\n }\n\n function test_createLock_MinBoostIsApplied() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 180 * 86400;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLock = IveION(ve).getUserLock(\n tokenId,\n IveION(ve).s_lpType(tokenAddresses[0])\n );\n\n uint256 boost = actualLock.boost;\n assertEq(boost, 1e18, \"Boost mismatch\");\n }\n\n function test_createLock_MaxBoostIsApplied() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 2 * 365 * 86400;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLock = IveION(ve).getUserLock(\n tokenId,\n IveION(ve).s_lpType(tokenAddresses[0])\n );\n\n uint256 boost = actualLock.boost;\n assertApproxEqAbs(boost, 2e18, 1e16, \"Boost mismatch\");\n }\n\n function test_createLock_UserCanLockMultipleLP() public {\n TestVars memory vars;\n\n vars.user = address(0x1234);\n LockInfoMultiple memory lockInput = _createLockMultipleInternal(vars.user);\n\n for (uint256 i = 0; i < lockInput.tokenAddresses.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lb = IveION(ve).s_locked(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddresses[i])\n );\n uint256 unlockTime = ((block.timestamp + lockInput.durations[i]) / WEEK) * WEEK;\n\n assertEq(lb.tokenAddress, lockInput.tokenAddresses[i], \"Token address mismatch\");\n assertEq(lb.amount, lockInput.tokenAmounts[i], \"Token amount mismatch\");\n assertEq(lb.end, unlockTime, \"Unlock time mismatch\");\n }\n\n vars.expectedSupply = MINT_AMT;\n vars.userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddresses[0]));\n vars.ownerTokenIds = IveION(ve).getOwnedTokenIds(vars.user);\n vars.assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddresses[1])),\n vars.expectedSupply,\n \"Supply mismatch\"\n );\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddresses[0])),\n vars.expectedSupply,\n \"Supply mismatch\"\n );\n assertEq(vars.userEpoch, 1, \"User epoch mismatch\");\n assertEq(IveION(ve).s_tokenId(), lockInput.tokenId, \"Token ID mismatch\");\n assertEq(vars.ownerTokenIds.length, 1, \"Owner should have one token ID\");\n assertEq(vars.ownerTokenIds[0], lockInput.tokenId, \"Owner token ID mismatch\");\n assertEq(vars.assetsLocked.length, lockInput.tokenAddresses.length, \"Assets locked length mismatch\");\n for (uint256 i = 0; i < vars.assetsLocked.length; i++) {\n assertEq(vars.assetsLocked[i], lockInput.tokenAddresses[i], \"Assets locked address mismatch\");\n }\n }\n\n function test_createLock_StakeUnderlyingLP() public forkAtBlock(MODE_MAINNET, 16559826) {\n TestVars memory vars;\n\n address ionMode5050 = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n address veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n\n address[] memory whitelistedTokens = new address[](1);\n bool[] memory isWhitelistedTokens = new bool[](1);\n whitelistedTokens[0] = ionMode5050;\n isWhitelistedTokens[0] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n // Mint ModeVelodrome tokens to the user\n vars.user = address(0x5678);\n vars.amount = 10 ether;\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050).transfer(vars.user, vars.amount);\n\n // Approve veION contract to spend user's tokens\n vm.prank(vars.user);\n IERC20(ionMode5050).approve(address(ve), vars.amount);\n\n // Prepare parameters for createLock\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(ionMode5050);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vars.stakeUnderlying = new bool[](1);\n vars.stakeUnderlying[0] = true;\n\n // Create lock\n vm.prank(vars.user);\n IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, vars.stakeUnderlying);\n\n address stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(vars.user);\n uint256 stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n\n // Advance the blockchain by 1 week\n vm.warp(block.timestamp + 1 weeks);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n assertTrue(stakingWalletInstance != address(0), \"Staking Wallet Instance should not be zero address\");\n assertEq(stakingWalletInstanceBalance, vars.amount, \"Staking Wallet Instance Balance should match locked amount\");\n assertTrue(reward > 0, \"Reward should be greater than zero after 1 week\");\n }\n\n function test_createLock_StakeUnderlyingLPAndClaimRewards() public forkAtBlock(MODE_MAINNET, 16559826) {\n TestVars memory vars;\n\n address ionMode5050 = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n address veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n\n address[] memory whitelistedTokens = new address[](1);\n bool[] memory isWhitelistedTokens = new bool[](1);\n whitelistedTokens[0] = ionMode5050;\n isWhitelistedTokens[0] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n // Mint ModeVelodrome tokens to the user\n vars.user = address(0x5678);\n vars.amount = 10 ether;\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050).transfer(vars.user, vars.amount);\n\n // Approve veION contract to spend user's tokens\n vm.prank(vars.user);\n IERC20(ionMode5050).approve(address(ve), vars.amount);\n\n // Prepare parameters for createLock\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(ionMode5050);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vars.stakeUnderlying = new bool[](1);\n vars.stakeUnderlying[0] = true;\n\n // Create lock\n vm.prank(vars.user);\n IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, vars.stakeUnderlying);\n\n vm.warp(block.timestamp + 1 weeks);\n\n address stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(vars.user);\n uint256 stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n vm.prank(vars.user);\n IveION(ve).claimEmissions(vars.tokenAddresses[0]);\n\n stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n uint256 userRewardBalance = IERC20(IVeloIonModeStaking(veloGauge).rewardToken()).balanceOf(vars.user);\n\n assertEq(\n stakingWalletInstanceBalance,\n vars.amount,\n \"Staking Wallet Instance Balance After Claim should be the same\"\n );\n assertEq(reward, 0, \"Earned After Claim should be 0\");\n assertGt(userRewardBalance, reward, \"User Reward Balance should be the earned amount\");\n }\n\n function test_createLock_RevertsIfUnequalArrayLenghts() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](2);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAddresses[1] = address(modeBalancer8020IonEth);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"ArrayMismatch()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertsIfZeroAmount() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = 0;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAmount()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertsIfDurationTooShort() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 10 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooShort()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfDurationTooLong() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 3 * 365 * 86400;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooLong()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfAmountTooSmall() public {\n address user = address(0x1234);\n uint256 amount = 5e18; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"MinimumNotMet()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfTokenNotWhitelisted() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n\n // Deploy a new random MockERC20 token\n MockERC20 randomMockToken = new MockERC20(\"Random_Token\", \"RND\", 18);\n randomMockToken.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(randomMockToken);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n randomMockToken.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfDuplicateTokens() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 2000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](2);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAddresses[1] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](2);\n tokenAmounts[0] = amount / 2;\n tokenAmounts[1] = amount / 2;\n\n uint256[] memory durations = new uint256[](2);\n durations[0] = 52 weeks;\n durations[1] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"DuplicateAsset()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](2));\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Delegate.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Delegate is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n uint256 tokenId1;\n uint256 tokenId2;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n lockInput = _createLockInternal(user);\n IveION(ve).setVoter(address(this));\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n vm.stopPrank();\n\n (tokenId1, tokenId2) = (lockInput.tokenId, lockInputMultiLP.tokenId);\n }\n\n function test_delegation_UserCanDelegate() public {\n vm.prank(user);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(tokenId1, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenId2, veloLpType);\n\n uint256 amountDelegated = IveION(ve).s_delegations(tokenId1, tokenId2, veloLpType);\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenId1, veloLpType);\n bool foundDelegatee = false;\n for (uint256 i = 0; i < delegatees.length; i++) {\n if (delegatees[i] == tokenId2) {\n foundDelegatee = true;\n break;\n }\n }\n\n uint256[] memory delegators = IveION(ve).getDelegators(tokenId2, veloLpType);\n bool foundDelegator = false;\n for (uint256 i = 0; i < delegators.length; i++) {\n if (delegators[i] == tokenId1) {\n foundDelegator = true;\n break;\n }\n }\n\n uint256 userEpoch2 = IveION(ve).s_userPointEpoch(tokenId2, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint2 = IveION(ve).getUserPoint(\n tokenId2,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch2\n );\n\n uint256 userEpoch1 = IveION(ve).s_userPointEpoch(tokenId1, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint1 = IveION(ve).getUserPoint(\n tokenId1,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch1\n );\n\n assertEq(userPoint2.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint2.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint2.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint2.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint2.permanent, MINT_AMT, \"User point permanent mismatch\");\n assertEq(userPoint2.permanentDelegate, MINT_AMT, \"User point permanent delegate mismatch\");\n\n assertEq(userPoint1.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint1.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint1.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint1.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint1.permanent, 0, \"User point permanent mismatch\");\n assertEq(userPoint1.permanentDelegate, 0, \"User point permanent delegate mismatch\");\n\n assertEq(locked1.amount, 0, \"All voting power should have been delegated from this token\");\n assertEq(locked2.delegateAmount, MINT_AMT, \"All voting power should have been delegated to this token\");\n assertEq(amountDelegated, MINT_AMT, \"Delegated amount should be recorded\");\n assertTrue(foundDelegatee, \"tokenId2 found in list of tokenId1's delegatees\");\n assertTrue(foundDelegator, \"tokenId1 found in list of tokenId2's delegators\");\n }\n\n function test_delegation_NoDuplicateDelegateesOrDelegators() public {\n uint256 smallDelegation = 10e18;\n vm.startPrank(user);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n vm.stopPrank();\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenId1, veloLpType);\n assertEq(delegatees.length, 1, \"Should only be one delegeatee despite several delegations\");\n\n uint256[] memory delegators = IveION(ve).getDelegators(tokenId2, veloLpType);\n assertEq(delegators.length, 1, \"Should only be one delegator despite several delegations\");\n\n uint256 amountDelegated = IveION(ve).s_delegations(tokenId1, tokenId2, veloLpType);\n assertEq(amountDelegated, smallDelegation * 5, \"Should accumulate\");\n }\n\n function test_delegation_RevertIfNotOwner() public {\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n }\n\n function test_delegation_RevertIfAmountTooBig() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AmountTooBig()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT * 2);\n }\n\n function test_delegation_RevertIfNotPermanentLockFrom() public {\n vm.startPrank(user);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), tokenId1);\n vm.expectRevert(abi.encodeWithSignature(\"NotPermanentLock()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n }\n\n function test_delegation_RevertIfNotPermanentLockTo() public {\n vm.startPrank(user);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), tokenId2);\n vm.expectRevert(abi.encodeWithSignature(\"NotPermanentLock()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/IncreaseAmount.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract IncreaseAmount is veIONTest {\n address user;\n uint256 tokenId;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n }\n\n function test_increaseAmount_UserCanIncreaseLock() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n uint256 calculated_end = ((block.timestamp + lockInput.duration) / WEEK) * WEEK; // Update end time\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n uint256[] memory ownerTokenIds = IveION(ve).getOwnedTokenIds(user);\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(lockInput.tokenAmount + additionalAmount, actualLocked.amount, \"Lock amount should be increased\");\n assertEq(lockInput.tokenAddress, actualLocked.tokenAddress, \"Token address mismatch\");\n assertEq(calculated_end, actualLocked.end, \"Unlock time mismatch\");\n assertEq(false, actualLocked.isPermanent, \"Lock should not be permanent\");\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress)),\n actualLocked.amount + lockInputMultiLP.tokenAmounts[0],\n \"Supply mismatch\"\n );\n assertEq(userEpoch, 1, \"User epoch mismatch\");\n assertEq(lockInput.tokenId + 1, IveION(ve).s_tokenId(), \"Token ID mismatch\");\n assertEq(ownerTokenIds.length, 2, \"Owner should have one token ID\");\n assertEq(ownerTokenIds[0], lockInput.tokenId, \"Owner token ID mismatch\");\n assertEq(assetsLocked.length, 1, \"Assets locked length mismatch\");\n assertEq(assetsLocked[0], lockInput.tokenAddress, \"Assets locked address mismatch\");\n }\n\n function test_increaseAmountI_PermanentLock() public {\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n userEpoch\n );\n\n assertEq(lockInput.tokenAmount + additionalAmount, actualLocked.amount, \"Lock amount should be increased\");\n assertTrue(actualLocked.isPermanent, \"Lock should be permanent\");\n assertEq(\n lockInput.tokenAmount + additionalAmount,\n userPoint.permanent,\n \"Permanent Lock amount should be increased\"\n );\n }\n\n function test_increaseAmount_RevertIfAssetWhitelistedButNotLockedByUser() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeBalancer8020IonEth.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"NoLockFound()\"));\n IveION(ve).increaseAmount(address(modeBalancer8020IonEth), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmountI_RevertIfAssetWhitelistedLockedAndWithdrawnByUser() public {\n vm.warp(block.timestamp + lockInputMultiLP.durations[0]);\n vm.prank(user);\n IveION(ve).withdraw(lockInputMultiLP.tokenAddresses[0], lockInputMultiLP.tokenId);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeBalancer8020IonEth.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"NoLockFound()\"));\n IveION(ve).increaseAmount(lockInputMultiLP.tokenAddresses[0], lockInputMultiLP.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfNotOwner() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n address otherUser = address(0x9353);\n\n vm.prank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.prank(otherUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n }\n\n function test_increaseAmount_RevertIfValueIsZero() public {\n uint256 additionalAmount = 0;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAmount()\"));\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfTokenIdNonexistent() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n uint256 nonexistentToken = 3463;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), nonexistentToken, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfLockExpired() public {\n vm.warp(block.timestamp + lockInput.duration);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfTokenNotWhitelisted() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n MockERC20 randomMockToken = new MockERC20(\"MockToken\", \"MTK\", 18);\n randomMockToken.mint(user, additionalAmount);\n\n vm.startPrank(user);\n randomMockToken.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).increaseAmount(address(randomMockToken), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/IncreaseUnlockTime.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract IncreaseUnlockTime is veIONTest {\n address user;\n uint256 tokenId;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLp;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLp = _createLockMultipleInternal(user);\n }\n\n function test_increaseUnlockTime_UserCanIncreaseTime() public {\n uint256 newLockTime = 104 weeks;\n vm.prank(user);\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n uint256 expectedEndTime = ((block.timestamp + newLockTime) / WEEK) * WEEK;\n assertEq(expectedEndTime, actualLocked.end, \"Lock end time should be increased\");\n }\n\n function test_increaseUnlockTime_RevertIfNotOwner() public {\n uint256 newLockTime = 104 weeks;\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfLockPermanent() public {\n uint256 newLockTime = 104 weeks;\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n vm.stopPrank();\n }\n\n function test_increaseUnlockTime_RevertIfLockExpires() public {\n uint256 newLockTime = 104 weeks;\n vm.warp(block.timestamp + lockInput.duration);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfLockNonexistent() public {\n uint256 newLockTime = 104 weeks;\n uint256 amountToMint = 500 * 10 ** 18; // 500 tokens\n modeBalancer8020IonEth.mint(user, amountToMint);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), amountToMint);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseUnlockTime(address(modeBalancer8020IonEth), lockInput.tokenId, newLockTime);\n vm.stopPrank();\n }\n\n function test_increaseUnlockTime_RevertIfLockNotInFuture() public {\n uint256 newLockTime = 52 weeks;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationNotInFuture()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfLockTooLong() public {\n uint256 newLockTime = 120 weeks;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooLong()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfTokenNonexistent() public {\n uint256 newLockTime = 52 weeks;\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), 544, newLockTime);\n }\n\n function test_increaseUnlockTimeI_RevertIfUserWithdrewLock() public {\n uint256 newLockTime = 52 weeks;\n vm.startPrank(user);\n IveION(ve).withdraw(lockInputMultiLp.tokenAddresses[0], lockInputMultiLp.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInputMultiLp.tokenId, newLockTime);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/LockAdditionalAsset.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract LockAdditionalAsset is veIONTest {\n address user;\n uint256 tokenId;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function test_lockAdditionalAsset_UserCanLockAdditionalLp() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n\n vm.prank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n vm.prank(user);\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lockedBalancer = IveION(ve).getUserLock(\n lockInput.tokenId,\n balancerLpType\n );\n uint256 expectedEndTimeBalancer = ((block.timestamp + 26 weeks) / WEEK) * WEEK;\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lockedVelo = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE\n );\n uint256 expectedEndTimeVelo = ((block.timestamp + 52 weeks) / WEEK) * WEEK;\n\n assertEq(lockedBalancer.amount, additionalAmount, \"Total locked amount mismatch\");\n assertEq(lockedBalancer.end, expectedEndTimeBalancer, \"Lock end time should be increased balancer\");\n assertEq(lockedVelo.amount, lockInput.tokenAmount, \"Total locked amount mismatch\");\n assertEq(lockedVelo.end, expectedEndTimeVelo, \"Lock end time should be increased velo\");\n }\n\n function test_lockAdditionalAsset_RevertIfNotOwner() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n address randomUser = address(0x1345);\n\n vm.prank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.prank(randomUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n }\n\n function test_lockAdditionalAsset_RevertIfZeroAmount() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 0;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAmount()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfAlreadyVoted() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n IveION(ve).voting(lockInput.tokenId, true);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfDuplicateAsset() public {\n modeVelodrome5050IonMode.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"DuplicateAsset()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeVelodrome5050IonMode),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfMinimumNotMet() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 9 * 10 ** 18;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"MinimumNotMet()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfLockTooLong() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooLong()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 150 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfLockTooShort() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooShort()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 25 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionAsset_RevertIfTokenNotWhitelisted() public {\n MockERC20 randomToken = new MockERC20(\"Random Token\", \"RND\", 18);\n randomToken.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n randomToken.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).lockAdditionalAsset(address(randomToken), additionalAmount, lockInput.tokenId, 26 weeks, false);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/LockPermanent.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract LockPermanent is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n lockInput = _createLockInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function test_lockPermanent_UserCanLockPermanent() public {\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, veloLpType);\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n userEpoch\n );\n assertEq(\n lock.tokenAddress,\n address(modeVelodrome5050IonMode),\n \"Lock token address should match the expected address\"\n );\n assertEq(lock.amount, lockInput.tokenAmount, \"Lock amount should match the initial lock amount\");\n assertEq(lock.boost, harness.exposed_calculateBoost(MAXTIME), \"Lock boost should be calculated based on MAXTIME\");\n assertEq(lock.delegateAmount, 0, \"Lock delegate amount should be zero for a new permanent lock\");\n\n assertEq(lock.isPermanent, true, \"Lock should be permanent\");\n assertEq(lock.end, 0, \"Lock end time should be zero for permanent lock\");\n assertEq(userPoint.bias, 0, \"User point bias should be zero for permanent lock\");\n assertEq(userPoint.slope, 0, \"User point slope should be zero for permanent lock\");\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp should be current block timestamp\");\n assertEq(userPoint.blk, block.number, \"User point block number should be current block number\");\n assertEq(userPoint.permanent, lock.amount, \"User point permanent lock should match lock amount\");\n }\n\n function test_lockPermanent_RevertIfNotOwner() public {\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_lockPermanent_RevertIfPermanentLock() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n\n function test_lockPermanent_RevertIfLockExpired() public {\n vm.warp(block.timestamp + lockInput.duration);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_lockPermanent_RevertIfNoLockFound() public {\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), 933);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Merge.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Merge is veIONTest {\n address user;\n LockInfo lockInput_1;\n LockInfo lockInput_2;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput_1 = _createLockInternal(user);\n lockInput_2 = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function test_merge_UserCanMerge() public {\n vm.prank(user);\n IveION(ve).merge(lockInput_1.tokenId, lockInput_2.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLock = IveION(ve).getUserLock(\n lockInput_2.tokenId,\n veloLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory burnedLock = IveION(ve).getUserLock(\n lockInput_1.tokenId,\n veloLpType\n );\n\n assertEq(\n mergedLock.amount,\n lockInput_2.tokenAmount * 2,\n \"Merged lock amount should be the sum of the original locks\"\n );\n assertEq(burnedLock.amount, 0, \"First lock amount should be zero after merge\");\n assertEq(burnedLock.end, 0, \"First lock end time should be zero after merge\");\n\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).ownerOf(lockInput_1.tokenId);\n }\n\n function test_merge_UserCanMergeMultiLockIntoSingleLock() public {\n vm.prank(user);\n IveION(ve).merge(lockInputMultiLP.tokenId, lockInput_2.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockVelo = IveION(ve).getUserLock(\n lockInput_2.tokenId,\n veloLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockBalancer = IveION(ve).getUserLock(\n lockInput_2.tokenId,\n balancerLpType\n );\n\n assertEq(mergedLockVelo.amount, MINT_AMT * 2, \"Velo merged lock amount should be the sum of the original locks\");\n assertEq(\n mergedLockBalancer.amount,\n MINT_AMT,\n \"Balancer merged lock amount should be the sum of the original locks\"\n );\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInput_2.tokenId);\n bool foundVelo = false;\n bool foundBalancer = false;\n\n for (uint256 i = 0; i < assetsLocked.length; i++) {\n if (assetsLocked[i] == address(modeVelodrome5050IonMode)) {\n foundVelo = true;\n }\n if (assetsLocked[i] == address(modeBalancer8020IonEth)) {\n foundBalancer = true;\n }\n }\n\n assertTrue(foundVelo, \"Velo token should be in assetsLocked for lockInput_2\");\n assertTrue(foundBalancer, \"Balancer token should be in assetsLocked for lockInput_2\");\n }\n\n function test_merge_UserCanMergeSingleLockIntoMultiLock() public {\n vm.prank(user);\n IveION(ve).merge(lockInput_1.tokenId, lockInputMultiLP.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockVelo = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n veloLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockBalancer = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n balancerLpType\n );\n\n assertEq(mergedLockVelo.amount, MINT_AMT * 2, \"Velo merged lock amount should be the sum of the original locks\");\n assertEq(\n mergedLockBalancer.amount,\n MINT_AMT,\n \"Balancer merged lock amount should be the sum of the original locks\"\n );\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInputMultiLP.tokenId);\n bool foundVelo = false;\n bool foundBalancer = false;\n\n for (uint256 i = 0; i < assetsLocked.length; i++) {\n if (assetsLocked[i] == address(modeVelodrome5050IonMode)) {\n foundVelo = true;\n }\n if (assetsLocked[i] == address(modeBalancer8020IonEth)) {\n foundBalancer = true;\n }\n }\n\n assertTrue(foundVelo, \"Velo token should be in assetsLocked for lockInputMultiLP\");\n assertTrue(foundBalancer, \"Balancer token should be in assetsLocked for lockInputMultiLP\");\n }\n\n function test_merge_RevertIfNotOwnerOfFromToken() public {\n address randomUser = address(0x3524);\n LockInfo memory strangerLockInput = _createLockInternal(randomUser);\n\n vm.prank(randomUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).merge(lockInput_1.tokenId, strangerLockInput.tokenId);\n }\n\n function test_merge_RevertIfNotOwnerOfToToken() public {\n address randomUser = address(0x3524);\n LockInfo memory strangerLockInput = _createLockInternal(randomUser);\n\n vm.prank(randomUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).merge(strangerLockInput.tokenId, lockInput_1.tokenId);\n }\n\n function test_merge_RevertIfVoting() public {\n IveION(ve).voting(lockInput_1.tokenId, true);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).merge(lockInput_1.tokenId, lockInput_2.tokenId);\n }\n\n function test_merge_RevertIfSameToken() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"SameNFT()\"));\n IveION(ve).merge(lockInput_1.tokenId, lockInput_1.tokenId);\n }\n\n function test_merge_RevertIfEitherTokenDoesNotExist() public {\n uint256 nonExistentTokenId = 97959;\n\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).merge(nonExistentTokenId, lockInput_1.tokenId);\n\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).merge(lockInput_1.tokenId, nonExistentTokenId);\n }\n\n function test_merge_RevertIfToExpiredOrFromExpired() public {\n uint256 amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n uint256[] memory durations = new uint256[](1);\n durations[0] = 80 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n vm.warp(block.timestamp + 54 weeks);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).merge(tokenId, lockInput_1.tokenId);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).merge(lockInput_1.tokenId, tokenId);\n }\n\n function test_merge_RevertIfFromPermanentOrToPermanent() public {\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput_1.tokenAddress, lockInput_1.tokenId);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).merge(lockInput_1.tokenId, lockInput_2.tokenId);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).merge(lockInput_2.tokenId, lockInput_1.tokenId);\n }\n\n function test_merge_ShouldRecalculateBoostUsingEarlierStartAndLaterEnd() public {\n vm.warp(block.timestamp + 40 weeks);\n uint256 amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n uint256[] memory durations = new uint256[](1);\n durations[0] = 26 weeks;\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(\n lockInput_1.tokenId,\n veloLpType\n );\n uint256 expectedStart = locked1.start;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenId, veloLpType);\n uint256 expectedEnd = locked2.end;\n\n IveION(ve).merge(lockInput_1.tokenId, tokenId);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLock = IveION(ve).getUserLock(tokenId, veloLpType);\n\n assertEq(mergedLock.start, expectedStart, \"Merged lock should have the earlier start time\");\n assertEq(mergedLock.end, expectedEnd, \"Merged lock should have the later end time\");\n\n emit log_named_uint(\"boost\", mergedLock.boost);\n }\n\n function test_merge_IfToHasNoLockForParticularAssetStartShouldNotBeZero() public {\n uint256 amount = MINT_AMT;\n modeBalancer8020IonEth.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeBalancer8020IonEth);\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n uint256[] memory durations = new uint256[](1);\n durations[0] = 70 weeks;\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(\n lockInput_1.tokenId,\n veloLpType\n );\n uint256 expectedStart = locked1.start;\n uint256 expectedEnd = locked1.end;\n uint256 boost = locked1.boost;\n\n emit log_named_uint(\"locked1 start time\", locked1.start);\n emit log_named_uint(\"locked1 end time\", locked1.end);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), amount);\n uint256 secondTokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(secondTokenId, veloLpType);\n emit log_named_uint(\"locked2 start time\", locked2.start);\n emit log_named_uint(\"locked2 end time\", locked2.end);\n IveION(ve).merge(lockInput_1.tokenId, secondTokenId);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLock = IveION(ve).getUserLock(secondTokenId, veloLpType);\n\n emit log_named_uint(\"mergedLock start time\", mergedLock.start);\n emit log_named_uint(\"mergedLock end time\", mergedLock.end);\n assertEq(mergedLock.start, expectedStart, \"Merged lock should have the earlier start time\");\n assertEq(mergedLock.end, expectedEnd, \"Merged lock should have the later end time\");\n assertEq(mergedLock.boost, boost, \"Should maintain original boost\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/RemoveDelegateesAndRemoveDelegators.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract RemoveDelegateesAndRemoveDelegators is veIONTest {\n address cindy;\n address andy;\n LockInfo lockInputAlice;\n LockInfoMultiple lockInputBob;\n LockInfo lockInputCandy;\n LockInfo lockInputRalph;\n uint256 tokenIdAlice;\n uint256 tokenIdBob;\n uint256 tokenIdCandy;\n uint256 tokenIdRalph;\n\n function setUp() public {\n _setUp();\n cindy = address(0x1234);\n andy = address(0x3245);\n lockInputAlice = _createLockInternal(cindy);\n lockInputBob = _createLockMultipleInternal(cindy);\n lockInputCandy = _createLockInternal(andy);\n lockInputRalph = _createLockInternal(andy);\n IveION(ve).setVoter(address(this));\n\n (tokenIdAlice, tokenIdBob, tokenIdCandy, tokenIdRalph) = (\n lockInputAlice.tokenId,\n lockInputBob.tokenId,\n lockInputCandy.tokenId,\n lockInputRalph.tokenId\n );\n\n vm.startPrank(cindy);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdAlice);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdBob);\n IveION(ve).delegate(tokenIdAlice, tokenIdBob, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n\n vm.startPrank(andy);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdCandy);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdRalph);\n IveION(ve).delegate(tokenIdCandy, tokenIdRalph, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n }\n\n function test_removeDelegatees_UserCanRemoveDelegatees() public {\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = tokenIdBob;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(tokenIdAlice, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenIdBob, veloLpType);\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenIdAlice, veloLpType);\n uint256 amountDelegated = IveION(ve).s_delegations(tokenIdAlice, tokenIdBob, veloLpType);\n bool found = false;\n for (uint256 i = 0; i < delegatees.length; i++) {\n if (delegatees[i] == tokenIdBob) {\n found = true;\n break;\n }\n }\n\n uint256 userEpoch = IveION(ve).s_userPointEpoch(tokenIdBob, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n tokenIdBob,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch\n );\n\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, MINT_AMT, \"User point permanent mismatch\");\n assertEq(userPoint.permanentDelegate, 0, \"User point permanent delegate mismatch\");\n\n assertEq(locked1.amount, MINT_AMT, \"Voting power should be returned to the original token\");\n assertEq(locked2.delegateAmount, 0, \"Delegated voting power should be removed from the second token\");\n assertFalse(found, \"secondTokenId should not be in the list of delegatees after de-delegation\");\n assertEq(amountDelegated, 0, \"Delegated amount should be zero after de-delegation\");\n }\n\n function test_removeDelegatees_RemoveByTransfer() public {\n LockInfo memory lockInfoUser1 = _createLockInternal(address(0x1234));\n LockInfo memory lockInfoUser2 = _createLockInternal(address(0x5678));\n LockInfo memory lockInfoUser3 = _createLockInternal(address(0x9ABC));\n LockInfo memory lockInfoUser4 = _createLockInternal(address(0xDEF0));\n LockInfo memory lockInfoUser5 = _createLockInternal(address(0x1111));\n LockInfo memory lockInfoUser6 = _createLockInternal(address(0x2222));\n LockInfo memory lockInfoUser7 = _createLockInternal(address(0x3333));\n\n console.log(\"Token ID User 1:\", lockInfoUser1.tokenId);\n console.log(\"Token ID User 2:\", lockInfoUser2.tokenId);\n console.log(\"Token ID User 3:\", lockInfoUser3.tokenId);\n console.log(\"Token ID User 4:\", lockInfoUser4.tokenId);\n console.log(\"Token ID User 5:\", lockInfoUser5.tokenId);\n console.log(\"Token ID User 6:\", lockInfoUser6.tokenId);\n console.log(\"Token ID User 7:\", lockInfoUser7.tokenId);\n\n vm.startPrank(address(0x1234));\n IveION(ve).lockPermanent(lockInfoUser1.tokenAddress, lockInfoUser1.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x5678));\n IveION(ve).lockPermanent(lockInfoUser2.tokenAddress, lockInfoUser2.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x9ABC));\n IveION(ve).lockPermanent(lockInfoUser3.tokenAddress, lockInfoUser3.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0xDEF0));\n IveION(ve).lockPermanent(lockInfoUser4.tokenAddress, lockInfoUser4.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x1111));\n IveION(ve).lockPermanent(lockInfoUser5.tokenAddress, lockInfoUser5.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x2222));\n IveION(ve).lockPermanent(lockInfoUser6.tokenAddress, lockInfoUser6.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x3333));\n IveION(ve).lockPermanent(lockInfoUser7.tokenAddress, lockInfoUser7.tokenId);\n vm.stopPrank();\n\n vm.startPrank(cindy);\n IveION(ve).delegate(tokenIdBob, lockInfoUser1.tokenId, lockInfoUser1.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser2.tokenId, lockInfoUser2.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser3.tokenId, lockInfoUser3.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser4.tokenId, lockInfoUser4.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser5.tokenId, lockInfoUser5.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser6.tokenId, lockInfoUser6.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser7.tokenId, lockInfoUser7.tokenAddress, MINT_AMT / 7);\n vm.stopPrank();\n\n uint256[] memory delegateesBefore = IveION(ve).getDelegatees(tokenIdBob, veloLpType);\n console.log(\"Delegatees length before transfer:\", delegateesBefore.length);\n\n vm.prank(cindy);\n IveION(ve).transferFrom(cindy, address(0x9ABC), tokenIdBob);\n\n uint256[] memory delegateesAfter = IveION(ve).getDelegatees(tokenIdBob, veloLpType);\n console.log(\"Delegatees length after transfer:\", delegateesAfter.length);\n\n assertEq(delegateesBefore.length, 7, \"Expected 7 delegatees before transfer\");\n assertEq(delegateesAfter.length, 0, \"Expected 0 delegatees after transfer\");\n }\n\n function test_removeDelegatees_RemoveByTransferMultiLP() public {\n LockInfoMultiple memory lockInfoUser1 = _createLockMultipleInternal(cindy);\n LockInfoMultiple memory lockInfoUser2 = _createLockMultipleInternal(address(0x92365));\n\n vm.startPrank(address(0x92365));\n IveION(ve).lockPermanent(lockInfoUser2.tokenAddresses[0], lockInfoUser2.tokenId);\n IveION(ve).lockPermanent(lockInfoUser2.tokenAddresses[1], lockInfoUser2.tokenId);\n vm.stopPrank();\n\n vm.startPrank(cindy);\n IveION(ve).lockPermanent(lockInfoUser1.tokenAddresses[0], lockInfoUser1.tokenId);\n IveION(ve).lockPermanent(lockInfoUser1.tokenAddresses[1], lockInfoUser1.tokenId);\n vm.stopPrank();\n\n vm.startPrank(cindy);\n IveION(ve).delegate(lockInfoUser1.tokenId, lockInfoUser2.tokenId, lockInfoUser1.tokenAddresses[0], MINT_AMT / 5);\n IveION(ve).delegate(lockInfoUser1.tokenId, lockInfoUser2.tokenId, lockInfoUser1.tokenAddresses[1], MINT_AMT / 5);\n vm.stopPrank();\n\n uint256[] memory delegateesBeforeTransferVelo = IveION(ve).getDelegatees(lockInfoUser1.tokenId, veloLpType);\n assertEq(delegateesBeforeTransferVelo.length, 1, \"Expected 1 delegatee before transfer for velo LP type\");\n uint256[] memory delegateesBeforeTransferBalancer = IveION(ve).getDelegatees(lockInfoUser1.tokenId, balancerLpType);\n assertEq(delegateesBeforeTransferBalancer.length, 1, \"Expected 1 delegatee before transfer for balancer LP type\");\n\n vm.prank(cindy);\n IveION(ve).transferFrom(cindy, andy, lockInfoUser1.tokenId);\n\n uint256[] memory delegateesAfterTransferVelo = IveION(ve).getDelegatees(lockInfoUser1.tokenId, veloLpType);\n assertEq(delegateesAfterTransferVelo.length, 0, \"Expected 0 delegatees after transfer for velo LP type\");\n uint256[] memory delegateesAfterTransferBalancer = IveION(ve).getDelegatees(lockInfoUser1.tokenId, balancerLpType);\n assertEq(delegateesAfterTransferBalancer.length, 0, \"Expected 0 delegatees after transfer for balancer LP type\");\n }\n\n function test_removeDelegatees_RevertIfUnmatchedArrays() public {\n uint256[] memory toTokenIds = new uint256[](2);\n toTokenIds[0] = tokenIdBob;\n toTokenIds[1] = tokenIdBob;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"ArrayMismatch()\"));\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegatees_RevertIfNotOwner() public {\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = tokenIdBob;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(address(0x1413));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegatees_RevertIfNoDelegation() public {\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = tokenIdCandy;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"NoDelegationBetweenTokens(uint256,uint256)\", tokenIdAlice, tokenIdCandy));\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegators_UserCanRemoveDelegators() public {\n uint256[] memory fromTokenIds = new uint256[](1);\n fromTokenIds[0] = tokenIdAlice;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n IveION(ve).removeDelegators(fromTokenIds, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(tokenIdAlice, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenIdBob, veloLpType);\n\n uint256 amountDelegated = IveION(ve).s_delegations(tokenIdAlice, tokenIdBob, veloLpType);\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenIdAlice, veloLpType);\n bool foundDelegatee = false;\n for (uint256 i = 0; i < delegatees.length; i++) {\n if (delegatees[i] == tokenIdBob) {\n foundDelegatee = true;\n break;\n }\n }\n\n uint256[] memory delegators = IveION(ve).getDelegators(tokenIdBob, veloLpType);\n bool foundDelegator = false;\n for (uint256 i = 0; i < delegators.length; i++) {\n if (delegatees[i] == tokenIdBob) {\n foundDelegator = true;\n break;\n }\n }\n\n uint256 userEpoch = IveION(ve).s_userPointEpoch(tokenIdBob, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n tokenIdBob,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch\n );\n\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, MINT_AMT, \"User point permanent mismatch\");\n assertEq(userPoint.permanentDelegate, 0, \"User point permanent delegate mismatch\");\n\n assertEq(locked1.amount, MINT_AMT, \"Voting power should be returned to the original token\");\n assertEq(locked2.delegateAmount, 0, \"Delegated voting power should be removed from the second token\");\n assertFalse(foundDelegatee, \"bob token should not be in the list of delegatees for alice after de-delegation\");\n assertFalse(foundDelegator, \"alice token should not be in the list of delegators for bob after de-delegation\");\n assertEq(amountDelegated, 0, \"Delegated amount should be zero after de-delegation\");\n }\n\n function test_removeDelegators_RevertIfUnmatchedArrays() public {\n uint256[] memory fromTokenIDs = new uint256[](2);\n fromTokenIDs[0] = tokenIdAlice;\n fromTokenIDs[1] = tokenIdAlice;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"ArrayMismatch()\"));\n IveION(ve).removeDelegators(fromTokenIDs, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n }\n function test_removeDelegators_RevertIfNotOwner() public {\n uint256[] memory fromTokenIDs = new uint256[](1);\n fromTokenIDs[0] = tokenIdAlice;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).removeDelegators(fromTokenIDs, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegators_RevertIfNoDelegationBetweenTokens() public {\n uint256[] memory fromTokenIDs = new uint256[](1);\n fromTokenIDs[0] = tokenIdCandy;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"NoDelegationBetweenTokens(uint256,uint256)\", tokenIdCandy, tokenIdBob));\n IveION(ve).removeDelegators(fromTokenIDs, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Setters.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Setters is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function test_setAeroVoting() public {\n address newAeroVoting = address(0x123);\n IveION(ve).setAeroVoting(newAeroVoting);\n assertEq(IveION(ve).s_aeroVoting(), newAeroVoting, \"AeroVoting address should be updated\");\n }\n\n function test_setAeroVoting_revertIfInvalidAddress() public {\n address invalidAddress = address(0);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidAddress()\"));\n IveION(ve).setAeroVoting(invalidAddress);\n }\n\n function test_setAeroVoterBoost() public {\n uint256 newBoost = 500;\n IveION(ve).setAeroVoterBoost(newBoost);\n assertEq(IveION(ve).s_aeroVoterBoost(), newBoost, \"AeroVoterBoost should be updated\");\n }\n\n function test_setAeroVoterBoost_revertIfZeroBoost() public {\n uint256 zeroBoost = 0;\n vm.expectRevert(abi.encodeWithSignature(\"AeroBoostAmountMustBeGreaterThanZero()\"));\n IveION(ve).setAeroVoterBoost(zeroBoost);\n }\n\n function test_setMaxEarlyWithdrawFee() public {\n uint256 newFee = 100;\n IveION(ve).setMaxEarlyWithdrawFee(newFee);\n assertEq(IveION(ve).s_maxEarlyWithdrawFee(), newFee, \"MaxEarlyWithdrawFee should be updated\");\n }\n\n function test_setMaxEarlyWithdrawFee_revertIfZeroFee() public {\n uint256 zeroFee = 0;\n vm.expectRevert(abi.encodeWithSignature(\"MaxEarlyWithdrawFeeMustBeGreaterThanZero()\"));\n IveION(ve).setMaxEarlyWithdrawFee(zeroFee);\n }\n\n function test_setLpTokenType() public {\n address tokenAddress = address(0x456);\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IveION(ve).setLpTokenType(tokenAddress, lpType);\n assertEq(uint256(IveION(ve).s_lpType(tokenAddress)), uint256(lpType), \"LP token type should be updated\");\n }\n\n function test_setLpTokenType_revertIfInvalidTokenAddress() public {\n address invalidTokenAddress = address(0);\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidTokenAddress()\"));\n IveION(ve).setLpTokenType(invalidTokenAddress, lpType);\n }\n\n function test_setStakeStrategy() public {\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IStakeStrategy strategy = IStakeStrategy(address(0x789));\n IveION(ve).setStakeStrategy(lpType, strategy);\n assertEq(address(IveION(ve).s_stakeStrategy(lpType)), address(strategy), \"Stake strategy should be updated\");\n }\n\n function test_setStakeStrategy_revertIfInvalidStrategyAddress() public {\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IStakeStrategy invalidStrategy = IStakeStrategy(address(0));\n vm.expectRevert(abi.encodeWithSignature(\"InvalidStrategyAddress()\"));\n IveION(ve).setStakeStrategy(lpType, invalidStrategy);\n }\n\n function test_toggleLimitedBoost() public {\n IveION(ve).toggleLimitedBoost(true);\n assertTrue(IveION(ve).s_limitedBoostActive(), \"Limited boost should be active\");\n }\n\n function test_setLimitedTimeBoost() public {\n uint256 boostAmount = 1000;\n IveION(ve).setLimitedTimeBoost(boostAmount);\n assertEq(IveION(ve).s_limitedBoost(), boostAmount, \"Limited time boost should be updated\");\n }\n\n function test_setVoter() public {\n address newVoter = address(0xABC);\n IveION(ve).setVoter(newVoter);\n assertEq(IveION(ve).s_voter(), newVoter, \"Voter address should be updated\");\n }\n\n function test_setVoter_revertIfInvalidAddress() public {\n address invalidVoter = address(0);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidAddress()\"));\n IveION(ve).setVoter(invalidVoter);\n }\n\n function test_setMinimumLockAmount() public {\n address tokenAddress = address(0xDEF);\n uint256 minimumAmount = 100;\n IveION(ve).setLpTokenType(tokenAddress, veloLpType);\n IveION(ve).setMinimumLockAmount(tokenAddress, minimumAmount);\n assertEq(\n IveION(ve).s_minimumLockAmount(IveION(ve).s_lpType(tokenAddress)),\n minimumAmount,\n \"Minimum lock amount should be updated\"\n );\n }\n\n function test_setMinimumLockDuration() public {\n uint256 minimumDuration = 1 weeks;\n IveION(ve).setMinimumLockDuration(minimumDuration);\n assertEq(IveION(ve).s_minimumLockDuration(), minimumDuration, \"Minimum lock duration should be updated\");\n }\n\n function test_setMinimumLockDuration_revertIfZeroDuration() public {\n uint256 zeroDuration = 0;\n vm.expectRevert(abi.encodeWithSignature(\"MinimumLockDurationMustBeGreaterThanZero()\"));\n IveION(ve).setMinimumLockDuration(zeroDuration);\n }\n\n function test_setIonicPool() public {\n address newIonicPool = address(0xFED);\n IveION(ve).setIonicPool(newIonicPool);\n assertEq(IveION(ve).s_ionicPool(), newIonicPool, \"Ionic pool address should be updated\");\n }\n\n function test_setIonicPool_revertIfInvalidAddress() public {\n address invalidIonicPool = address(0);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidAddress()\"));\n IveION(ve).setIonicPool(invalidIonicPool);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Split.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Split is veIONTest {\n address user;\n LockInfoMultiple lockInputMultiLP;\n uint256 splitAmount;\n\n address alice;\n address bob;\n address cindy;\n address ralph;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n LockInfo lockInfoCindy;\n LockInfo lockInfoRalph;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n splitAmount = MINT_AMT / 2;\n IveION(ve).setVoter(address(this));\n vm.prank(IveION(ve).owner());\n IveION(ve).toggleSplit(user, true);\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n alice = address(0x8325);\n bob = address(0x2542);\n cindy = address(0x3423);\n ralph = address(0x2524);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n lockInfoCindy = _createLockInternalRealLP(cindy, true);\n lockInfoRalph = _createLockInternalRealLP(ralph, false);\n }\n\n function test_split_UserCanSplitAllLP() public {\n splitAmount = MINT_AMT - MINIMUM_LOCK_AMOUNT;\n vm.prank(user);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n address(modeVelodrome5050IonMode),\n lockInputMultiLP.tokenId,\n splitAmount\n );\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked1 = IveION(ve).getUserLock(tokenId1, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked1 = IveION(ve).getUserLock(\n tokenId1,\n balancerLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked2 = IveION(ve).getUserLock(tokenId2, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked2 = IveION(ve).getUserLock(\n tokenId2,\n balancerLpType\n );\n\n assertEq(IveION(ve).balanceOf(user), 2, \"User balance should be 2 after split\");\n assertEq(veloLocked1.amount, MINIMUM_LOCK_AMOUNT, \"First token's velo balance should be reduced by split amount\");\n assertEq(balancerLocked1.amount, MINT_AMT, \"First token's balancer should be unaffected\");\n assertEq(veloLocked2.amount, splitAmount, \"Second token's balance should be equal to split amount\");\n assertEq(balancerLocked2.amount, 0, \"Second token's balancer should be 0\");\n\n address[] memory assetsLocked1 = IveION(ve).getAssetsLocked(tokenId1);\n address[] memory assetsLocked2 = IveION(ve).getAssetsLocked(tokenId2);\n\n bool foundModeVeloInTokenId1 = false;\n for (uint256 i = 0; i < assetsLocked1.length; i++) {\n if (assetsLocked1[i] == address(modeVelodrome5050IonMode)) foundModeVeloInTokenId1 = true;\n }\n\n bool foundModeVeloInTokenId2 = false;\n for (uint256 i = 0; i < assetsLocked2.length; i++) {\n if (assetsLocked2[i] == address(modeVelodrome5050IonMode)) foundModeVeloInTokenId2 = true;\n }\n\n assertTrue(foundModeVeloInTokenId1, \"TokenId1 should still have the asset modeVelodrome5050IonMode\");\n assertTrue(foundModeVeloInTokenId2, \"TokenId2 should have the asset modeVelodrome5050IonMode\");\n }\n\n function test_split_UserCanSplitSomeLP() public {\n vm.prank(user);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n address(modeVelodrome5050IonMode),\n lockInputMultiLP.tokenId,\n splitAmount\n );\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked1 = IveION(ve).getUserLock(tokenId1, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked1 = IveION(ve).getUserLock(\n tokenId1,\n balancerLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked2 = IveION(ve).getUserLock(tokenId2, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked2 = IveION(ve).getUserLock(\n tokenId2,\n balancerLpType\n );\n\n assertEq(veloLocked1.amount, MINT_AMT / 2, \"First split lock amount should be half of the original\");\n assertEq(balancerLocked1.amount, MINT_AMT, \"Second split lock amount should be half of the original\");\n assertEq(veloLocked2.amount, MINT_AMT / 2, \"Second split lock amount should be half of the original\");\n assertEq(balancerLocked2.amount, 0, \"Second split lock amount should be half of the original\");\n }\n\n function test_split_UnderlyingStakeAlsoSplit() public forkAtBlock(MODE_MAINNET, 16559826) {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n uint256 splitAmt = 4e18;\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n splitAmt\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n splitAmt,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n\n vm.stopPrank();\n }\n\n function test_split_RevertIfAlreadyVoted() public {\n IveION(ve).voting(lockInputMultiLP.tokenId, true);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfSplitNotAllowedForUser() public {\n IveION(ve).toggleSplit(user, false);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"SplitNotAllowed()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_CanSplitNotAllowedForUserButAllowedGeneral() public {\n IveION(ve).toggleSplit(user, false);\n IveION(ve).toggleSplit(address(0), true);\n vm.prank(user);\n vm.expectEmit(false, false, false, false);\n emit IveIONStructsEnumsErrorsEvents.SplitCompleted(0, 0, 0, 0, address(0));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfNotOwner() public {\n vm.prank(address(0x9352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfLockExpired() public {\n vm.warp(block.timestamp + lockInputMultiLP.durations[0]);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfSplitTooSmall() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"SplitTooSmall()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, 0);\n }\n\n function test_split_RevertIfAmountTooBig() public {\n splitAmount = MINT_AMT * 2;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AmountTooBig()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfNotEnoughRemainingInOldToken() public {\n splitAmount = 995e18;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotEnoughRemainingAfterSplit()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/ToggleSplit.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract ToggleSplit is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function test_toggleSplit_CanToggleSpit() public {\n IveION(ve).toggleSplit(address(0), true);\n bool canSplit = IveION(ve).s_canSplit(address(0));\n assertTrue(canSplit, \"Splitting allowed\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/TransferVeION.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract TrasferVeION is veIONTest {\n address alice;\n address bob;\n address cindy;\n address ralph;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n LockInfo lockInfoCindy;\n LockInfo lockInfoRalph;\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n alice = address(0x8325);\n bob = address(0x2542);\n cindy = address(0x3423);\n ralph = address(0x2524);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n lockInfoCindy = _createLockInternalRealLP(cindy, true);\n lockInfoRalph = _createLockInternalRealLP(ralph, false);\n }\n\n function test_transfer_UnderlyingStakeShouldBeTransferredToReceipientWithNoStake()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n uint256 aliceCumulativeValueBefore = IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress);\n uint256 bobCumulativeValueBefore = IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress);\n\n address stakingWalletInstanceBefore = veloIonModeStakingStrategy.userStakingWallet(bob);\n assertTrue(stakingWalletInstanceBefore == address(0), \"Bob should start off not having a staking wallet\");\n\n vm.prank(alice);\n IveION(ve).transferFrom(alice, bob, lockInfoAlice.tokenId);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(bob);\n\n assertTrue(\n stakingWalletInstance != address(0),\n \"Bob should now have a staking wallet after being transferred a token that has a stake\"\n );\n assertEq(\n veloIonModeStakingStrategy.balanceOf(stakingWalletInstance),\n REAL_LP_LOCK_AMOUNT,\n \"Bob should have the tokens\"\n );\n\n uint256 aliceCumulativeValueAfter = IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress);\n uint256 bobCumulativeValueAfter = IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress);\n\n // Assert that Alice's cumulative value has decreased by the lock amount\n assertEq(\n aliceCumulativeValueAfter,\n aliceCumulativeValueBefore - REAL_LP_LOCK_AMOUNT,\n \"Alice's cumulative value should decrease by the lock amount\"\n );\n\n // Assert that Bob's cumulative value has increased by the lock amount\n assertEq(\n bobCumulativeValueAfter,\n bobCumulativeValueBefore + REAL_LP_LOCK_AMOUNT,\n \"Bob's cumulative value should increase by the lock amount\"\n );\n\n uint256[] memory aliceOwnedTokenIds = IveION(ve).getOwnedTokenIds(alice);\n uint256[] memory bobOwnedTokenIds = IveION(ve).getOwnedTokenIds(bob);\n\n // Assert that Alice no longer owns the token\n assertEq(aliceOwnedTokenIds.length, 0, \"Alice should not own any tokens after transfer\");\n\n // Assert that Bob now owns the token\n assertEq(bobOwnedTokenIds.length, 2, \"Bob should own one token after transfer\");\n assertEq(bobOwnedTokenIds[1], lockInfoAlice.tokenId, \"Bob should own the transferred token ID\");\n }\n\n function test_transfer_UnderlyingStakeShouldBeTransferredToRecipientWithStake()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n vm.prank(alice);\n IveION(ve).transferFrom(alice, cindy, lockInfoAlice.tokenId);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(cindy);\n\n assertTrue(stakingWalletInstance != address(0), \"Cindy should have a staking wallet\");\n assertEq(\n veloIonModeStakingStrategy.balanceOf(stakingWalletInstance),\n REAL_LP_LOCK_AMOUNT * 2,\n \"Cindy's stake should include hers and what was transferred to it\"\n );\n }\n\n function test_transfer_NoUnderlyingStakeInFrom() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.prank(bob);\n IveION(ve).transferFrom(bob, ralph, lockInfoBob.tokenId);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(ralph);\n\n assertTrue(stakingWalletInstance == address(0), \"Ralph should not have a staking wallet instance\");\n }\n\n function test_transfer_SplitThenTransfer() public forkAtBlock(MODE_MAINNET, 16559826) {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(bob);\n uint256 bobBalanceBefore = veloIonModeStakingStrategy.balanceOf(stakingWalletInstance);\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n REAL_LP_LOCK_AMOUNT / 2\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT / 2,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT / 2,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n\n IveION(ve).transferFrom(alice, bob, tokenId1);\n vm.stopPrank();\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(bob);\n\n assertEq(bobBalanceBefore, 0, \"Bob should start with no balance\");\n assertTrue(stakingWalletInstance != address(0), \"Bob should have a staking wallet\");\n assertEq(\n veloIonModeStakingStrategy.balanceOf(stakingWalletInstance),\n REAL_LP_LOCK_AMOUNT / 2,\n \"Bob's stake should include hers and what was transferred to it\"\n );\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/UnlockPermanent.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract UnlockPermanent is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n lockInput = _createLockInternal(user);\n IveION(ve).setVoter(address(this));\n\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_unlockPermanent_UserCanUnlockPermanent() public {\n vm.prank(user);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n uint256 endTime = ((block.timestamp + MAXTIME) / WEEK) * WEEK;\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n assertEq(locked.tokenAddress, lockInput.tokenAddress);\n assertEq(locked.amount, lockInput.tokenAmount, \"Amount should be reset to the original lock input value\");\n assertEq(locked.delegateAmount, 0, \"Delegate amount should be zero after unlocking permanent lock\");\n assertEq(locked.start, block.timestamp, \"Should get back the original start time\");\n assertEq(locked.end, endTime, \"Lock end time should be zero for permanent lock\");\n assertEq(locked.isPermanent, false, \"Lock should be permanent\");\n assertEq(\n locked.boost,\n harness.exposed_calculateBoost(MAXTIME),\n \"Boost should be zero after unlocking permanent lock\"\n );\n }\n\n function test_unlockPermanent_RevertIfNotOwner() public {\n vm.prank(address(0x0915));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_unlockPermanent_RevertIfNotPermanentLock() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotPermanentLock()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n }\n\n function test_unlockPermanent_RevertIfHasDelegatees() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n IveION(ve).delegate(lockInput.tokenId, lockInputMultiLP.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n vm.expectRevert(abi.encodeWithSignature(\"TokenHasDelegatees()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n\n function test_unlockPermanent_RevertIfHasDelegators() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n IveION(ve).delegate(lockInputMultiLP.tokenId, lockInput.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n vm.expectRevert(abi.encodeWithSignature(\"TokenHasDelegators()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/veIONFuzz.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract veIONFuzzing is veIONTest {\n address user;\n function setUp() public {\n _setUp();\n user = address(0x987);\n }\n\n function testFuzz_createLock_BoostShouldNeverBeAboveMaximum(uint256 _amount, uint256 _duration) public {\n _amount = bound(_amount, IveION(ve).s_minimumLockAmount(veloLpType), type(uint256).max);\n _duration = bound(_duration, IveION(ve).s_minimumLockDuration(), MAXTIME);\n\n modeVelodrome5050IonMode.mint(user, _amount);\n\n vm.prank(user);\n modeVelodrome5050IonMode.approve(address(ve), _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAmounts[0] = _amount;\n durations[0] = _duration;\n stakeUnderlying[0] = false;\n\n vm.startPrank(user);\n MockERC20(modeVelodrome5050IonMode).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n tokenId,\n IveION(ve).s_lpType(tokenAddresses[0])\n );\n\n uint256 maxBoost = 2e18;\n assertGe(maxBoost, lock.boost, \"Boost should never be above the maximum\");\n }\n\n function testFuzz_createLock_VotingPowerShouldBeAmountDepositedAtMost(uint256 _amount, uint256 _duration) public {\n _amount = bound(_amount, IveION(ve).s_minimumLockAmount(veloLpType), type(uint256).max);\n _duration = bound(_duration, IveION(ve).s_minimumLockDuration(), MAXTIME);\n\n modeVelodrome5050IonMode.mint(user, _amount);\n\n vm.prank(user);\n modeVelodrome5050IonMode.approve(address(ve), _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAmounts[0] = _amount;\n durations[0] = _duration;\n stakeUnderlying[0] = false;\n\n vm.startPrank(user);\n MockERC20(modeVelodrome5050IonMode).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n (, uint256[] memory balances, ) = IveION(ve).balanceOfNFT(tokenId);\n assertGe(_amount, balances[0], \"Boost should never be above the maximum\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/ViewFunctions.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract ViewFunctions is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function test_getUserLock() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(tokenId, lpType);\n assertEq(lock.amount, 0, \"Initial lock amount should be zero\");\n }\n\n function test_getOwnedTokenIds() public {\n address owner = address(this);\n uint256[] memory tokenIds = IveION(ve).getOwnedTokenIds(owner);\n assertEq(tokenIds.length, 0, \"Owner should initially have no token IDs\");\n }\n\n function test_getTotalEthValueOfTokens() public {\n address owner = address(this);\n address[] memory mockLpTokens = new address[](2);\n mockLpTokens[0] = address(0x987);\n mockLpTokens[1] = address(0x765);\n\n address voter = address(0x321);\n IveION(ve).setVoter(voter);\n\n vm.mockCall(address(voter), abi.encodeWithSelector(IVoter.getAllLpRewardTokens.selector), abi.encode(mockLpTokens));\n\n address mockMasterPriceOracle = address(0x653);\n vm.mockCall(\n address(ap),\n abi.encodeWithSelector(IAddressesProvider.getAddress.selector, \"MasterPriceOracle\"),\n abi.encode(mockMasterPriceOracle)\n );\n\n vm.mockCall(\n address(mockMasterPriceOracle),\n abi.encodeWithSelector(IMasterPriceOracle.price.selector, mockLpTokens[0]),\n abi.encode(10e18)\n );\n vm.mockCall(\n address(mockMasterPriceOracle),\n abi.encodeWithSelector(IMasterPriceOracle.price.selector, mockLpTokens[1]),\n abi.encode(5e18)\n );\n\n uint256 totalValue = IveION(ve).getTotalEthValueOfTokens(owner);\n\n assertEq(totalValue, 0, \"Initial total ETH value should be zero\");\n }\n\n function test_getAssetsLocked() public {\n uint256 tokenId = 1;\n address[] memory assets = IveION(ve).getAssetsLocked(tokenId);\n assertEq(assets.length, 0, \"Initially, no assets should be locked\");\n }\n\n function test_getDelegatees() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenId, lpType);\n assertEq(delegatees.length, 0, \"Initially, there should be no delegatees\");\n }\n\n function test_getDelegators() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n uint256[] memory delegators = IveION(ve).getDelegators(tokenId, lpType);\n assertEq(delegators.length, 0, \"Initially, there should be no delegators\");\n }\n\n function test_getUserPoint() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n uint256 epoch = 0;\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(tokenId, lpType, epoch);\n assertEq(userPoint.bias, 0, \"Initial user point bias should be zero\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Voting.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Voting is veIONTest {\n address user;\n LockInfo lockInput;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n }\n\n function test_voting_VotingCanBeSet() public {\n address voter = address(this);\n IveION(ve).setVoter(voter);\n uint256 tokenId = lockInput.tokenId;\n\n vm.prank(voter);\n IveION(ve).voting(tokenId, true);\n\n bool isVoted = IveION(ve).s_voted(tokenId);\n assertTrue(isVoted, \"Token should be marked as voted\");\n\n vm.prank(voter);\n IveION(ve).voting(tokenId, false);\n\n isVoted = IveION(ve).s_voted(tokenId);\n assertFalse(isVoted, \"Token should not be marked as voted\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Withdraw.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Withdraw is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n address alice;\n address bob;\n address cindy;\n address ralph;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n LockInfo lockInfoCindy;\n LockInfo lockInfoRalph;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n\n alice = address(0x8325);\n bob = address(0x2542);\n cindy = address(0x3423);\n ralph = address(0x2524);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n lockInfoCindy = _createLockInternalRealLP(cindy, true);\n lockInfoRalph = _createLockInternalRealLP(ralph, false);\n }\n\n function test_withdraw_UserCanWithdrawFinishedLock() public {\n vm.warp(block.timestamp + 52 weeks + 1);\n\n uint256 supplyBefore = IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress));\n uint256 cumulativeLPAmountBefore = IveION(ve).s_userCumulativeAssetValues(user, address(modeVelodrome5050IonMode));\n vm.prank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n\n uint256 cumulativeLPAmountAfter = IveION(ve).s_userCumulativeAssetValues(user, address(modeVelodrome5050IonMode));\n uint256 userBalanceAfterWithdraw = modeVelodrome5050IonMode.balanceOf(user);\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n userEpoch\n );\n uint256[] memory ownerTokenIds = IveION(ve).getOwnedTokenIds(user);\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(locked.amount, 0, \"Lock amount should be zero after withdrawal\");\n assertEq(locked.end, 0, \"Lock end time should be zero after withdrawal\");\n assertEq(userBalanceAfterWithdraw, lockInput.tokenAmount, \"User should receive the locked tokens back\");\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress)),\n supplyBefore - lockInput.tokenAmount,\n \"Supply mismatch\"\n );\n assertEq(userEpoch, 2, \"User epoch mismatch\");\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, 0, \"User point permanent mismatch\");\n assertEq(IveION(ve).s_tokenId(), 2, \"Token ID mismatch\");\n assertEq(ownerTokenIds.length, 1, \"Owner should have one token ID\");\n assertEq(assetsLocked.length, 0, \"Assets locked length mismatch\");\n assertEq(\n cumulativeLPAmountBefore - lockInput.tokenAmount,\n cumulativeLPAmountAfter,\n \"Cumulative amount should have decreased \"\n );\n }\n\n function test_withdraw_UserCanWithdrawEarly() public {\n address randomWallet = address(0x7890);\n uint256 mintAmount = 100000000000000000 ether; // Mint tokens so that penalty comes into effect\n modeVelodrome5050IonMode.mint(randomWallet, mintAmount);\n\n vm.warp(block.timestamp + 10 weeks);\n\n vm.prank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n\n uint256 userBalanceAfterWithdraw = modeVelodrome5050IonMode.balanceOf(user);\n assertEq(actualLocked.amount, 0, \"Lock amount should be zero after withdrawal\");\n assertEq(actualLocked.end, 0, \"Lock end time should be zero after withdrawal\");\n assertEq(\n userBalanceAfterWithdraw,\n (lockInput.tokenAmount * 20) / 100,\n \"User should receive 20% of the locked tokens back after withdraw penalty\"\n );\n }\n\n function test_withdraw_UserStakedUnderlying() public forkAtBlock(MODE_MAINNET, 16559826) {\n TestVars memory vars;\n\n address ionMode5050 = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n address veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n\n address[] memory whitelistedTokens = new address[](1);\n bool[] memory isWhitelistedTokens = new bool[](1);\n whitelistedTokens[0] = ionMode5050;\n isWhitelistedTokens[0] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n // Mint ModeVelodrome tokens to the user\n vars.user = address(0x5678);\n vars.amount = 10 ether;\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050).transfer(vars.user, vars.amount);\n\n // Approve veION contract to spend user's tokens\n vm.prank(vars.user);\n IERC20(ionMode5050).approve(address(ve), vars.amount);\n\n // Prepare parameters for createLock\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(ionMode5050);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vars.stakeUnderlying = new bool[](1);\n vars.stakeUnderlying[0] = true;\n\n // Create lock\n vm.prank(vars.user);\n uint256 tokenId = IveION(ve).createLock(\n vars.tokenAddresses,\n vars.tokenAmounts,\n vars.durations,\n vars.stakeUnderlying\n );\n\n // Advance the blockchain by 1 week\n vm.warp(block.timestamp + 1 weeks);\n\n address stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(vars.user);\n uint256 rewardEarned = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n // Withdraw the tokens\n vm.prank(vars.user);\n IveION(ve).withdraw(address(ionMode5050), tokenId);\n\n uint256 stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n uint256 userBalance = IERC20(ionMode5050).balanceOf(vars.user);\n address rewardToken = IVeloIonModeStaking(veloGauge).rewardToken();\n uint256 rewardBalance = IERC20(rewardToken).balanceOf(vars.user);\n\n assertEq(stakingWalletInstanceBalance, 0, \"Staking wallet balance should be zero after withdrawal\");\n assertEq(\n userBalance,\n 2e18,\n \"User's balance should be equal to the initial amount, minus the penalty after withdrawal\"\n );\n assertEq(rewardBalance, rewardEarned, \"User should have claimed some reward\");\n }\n\n function test_withdraw_WithdrawCorrectUnderlyingStakingAfterSplitAndTransfer()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n uint256 splitAmt = 4e18;\n uint256 originalTokenAmt = REAL_LP_LOCK_AMOUNT - 4e18;\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n splitAmt\n );\n\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT,\n \"Alice cumulative value should be the original locked amount\"\n );\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT,\n \"Bob cumulative value should be the original locked amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n splitAmt,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n IveION(ve).transferFrom(alice, bob, tokenId1);\n vm.stopPrank();\n\n uint256 cumulativeAssetBalancePostTransferAlice = splitAmt;\n uint256 cumulativeAssetBalancePostTransferBob = REAL_LP_LOCK_AMOUNT + originalTokenAmt;\n\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferAlice,\n \"Cumulative asset value for alice should drop post transfer\"\n );\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferBob,\n \"Cumulative asset value for bob should increase post transfer\"\n );\n\n address stakingWalletInstanceAlice = veloIonModeStakingStrategy.userStakingWallet(alice);\n address stakingWalletInstanceBob = veloIonModeStakingStrategy.userStakingWallet(bob);\n\n uint256 stakedBalanceAlice = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceAlice);\n uint256 stakedBalanceBob = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceBob);\n\n console.log(\"Staked Balance Alice:\", stakedBalanceAlice);\n console.log(\"Staked Balance Bob:\", stakedBalanceBob);\n\n assertEq(\n stakedBalanceAlice,\n splitAmt,\n \"Alice's staked balance should be equal to the original lock amount minus the split amount\"\n );\n\n assertEq(stakedBalanceBob, REAL_LP_LOCK_AMOUNT - splitAmt, \"Bob's staked balance should be zero before withdrawal\");\n\n vm.warp(block.timestamp + 52 weeks);\n\n vm.prank(bob);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId1);\n\n vm.prank(alice);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId2);\n\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferAlice - splitAmt,\n \"CumulativeAssetValue should be reduced post withdrawal for alice\"\n );\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferBob - originalTokenAmt,\n \"CumulativeAssetValue should be reduced post withdrawal for bob\"\n );\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(bob),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Bob's balance should be equal to the original lock amount minus the split amount\"\n );\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(alice),\n splitAmt,\n \"Alice's balance should be equal to the split amount\"\n );\n }\n\n function test_withdraw_WithdrawCorrectUnderlyingStakingAfterSplitThenTransferToUserWithUnderlyingStake()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n uint256 splitAmt = 4e18;\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n splitAmt\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n splitAmt,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n IveION(ve).transferFrom(alice, cindy, tokenId1);\n vm.stopPrank();\n\n address stakingWalletInstanceAlice = veloIonModeStakingStrategy.userStakingWallet(alice);\n address stakingWalletInstanceCindy = veloIonModeStakingStrategy.userStakingWallet(cindy);\n\n uint256 stakedBalanceAlice = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceAlice);\n uint256 stakedBalanceCindy = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceCindy);\n\n console.log(\"Staked Balance Alice:\", stakedBalanceAlice);\n console.log(\"Staked Balance Cindy:\", stakedBalanceCindy);\n\n assertEq(stakedBalanceAlice, splitAmt, \"Alice's staked balance should be the split amount\");\n\n assertEq(\n stakedBalanceCindy,\n REAL_LP_LOCK_AMOUNT + REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Cindy's staked balance should be equal to the original lock amount minus the split amount\"\n );\n\n vm.warp(block.timestamp + 52 weeks);\n\n vm.prank(cindy);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId1);\n\n vm.prank(alice);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId2);\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(cindy),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Bob's balance should be equal to the original lock amount minus the split amount\"\n );\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(alice),\n splitAmt,\n \"Alice's balance should be equal to the split amount\"\n );\n }\n\n function test_withdraw_MultiLpSplitTransferThenWithdraw() public forkAtBlock(MODE_MAINNET, 16559826) {\n IveION(ve).setMinimumLockAmount(address(ionWeth5050lPAero), 1);\n IveION(ve).setMinimumLockAmount(address(wethUSDC5050LP), 1);\n IveION(ve).toggleSplit(address(0), true);\n uint256 wethUSDCAmt = 2e16;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(ionMode5050LP);\n lpTokens[1] = address(wethUSDC5050LP);\n\n address[] memory users = new address[](4);\n users[0] = alice;\n users[1] = bob;\n users[2] = cindy;\n users[3] = ralph;\n\n console.log(\"Stakes before alice locks multi lp\");\n _logUnderlyingStake(users);\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050LP).transfer(alice, REAL_LP_LOCK_AMOUNT);\n vm.prank(0x98d34C7b004688F35b67Aa30D4dF5E67113f6B3D);\n IERC20(wethUSDC5050LP).transfer(alice, wethUSDCAmt);\n\n address[] memory tokenAddresses = new address[](2);\n uint256[] memory tokenAmounts = new uint256[](2);\n uint256[] memory durations = new uint256[](2);\n bool[] memory stakeUnderlying = new bool[](2);\n tokenAddresses[0] = address(ionMode5050LP);\n tokenAmounts[0] = REAL_LP_LOCK_AMOUNT;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = true;\n tokenAddresses[1] = address(wethUSDC5050LP);\n tokenAmounts[1] = wethUSDCAmt;\n durations[1] = 52 weeks;\n stakeUnderlying[1] = true;\n\n vm.startPrank(alice);\n IERC20(ionMode5050LP).approve(address(ve), REAL_LP_LOCK_AMOUNT);\n IERC20(wethUSDC5050LP).approve(address(ve), wethUSDCAmt);\n uint256 tokenId1 = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n console.log(\"Stakes after alice locks multi lp\");\n _logUnderlyingStake(users);\n\n vm.prank(alice);\n (, uint256 tokenId2) = IveION(ve).split(ionMode5050LP, tokenId1, 3e18);\n\n vm.prank(alice);\n (, uint256 tokenId3) = IveION(ve).split(wethUSDC5050LP, tokenId1, 1e16);\n\n console.log(\"Stakes after alice splits multi lp into one token with 3e18 ion-mode and 1e16 weth-usdc\");\n _logUnderlyingStake(users);\n\n uint256[] memory tokenIds = new uint256[](3);\n tokenIds[0] = tokenId1;\n tokenIds[1] = tokenId2;\n tokenIds[2] = tokenId3;\n\n vm.startPrank(alice);\n IveION(ve).transferFrom(alice, bob, tokenId1);\n IveION(ve).transferFrom(alice, cindy, tokenId2);\n IveION(ve).transferFrom(alice, ralph, tokenId3);\n vm.stopPrank();\n\n address stakingWalletInstanceIonMode = veloIonModeStakingStrategy.userStakingWallet(users[1]);\n address stakingWalletInstanceWethUsdc = veloWethUsdcStakingStrategy.userStakingWallet(users[1]);\n\n uint256 stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n uint256 stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n assertEq(stakedBalanceIonMode, 7e18, \"Underlying staked balance for bob updated ion-mode\");\n assertEq(stakedBalanceWethUsdc, 1e16, \"Underlying staked balance for bob updated weth-usdc\");\n\n console.log(\n \"Stakes after alice sends 7e18 ion-mode and 1e16 weth-usdc token to bob, 3e18 ion-mode token to cindy, 1e16 weth-usdc token to ralph\"\n );\n _logUnderlyingStake(users);\n\n vm.startPrank(bob);\n IveION(ve).withdraw(address(ionMode5050LP), tokenId1);\n IveION(ve).withdraw(address(wethUSDC5050LP), tokenId1);\n vm.stopPrank();\n\n vm.prank(cindy);\n IveION(ve).withdraw(address(ionMode5050LP), tokenId2);\n\n vm.prank(ralph);\n IveION(ve).withdraw(address(wethUSDC5050LP), tokenId3);\n\n console.log(\n \"bob withdraws 7e18 ion-mode, 1e16 weth-usdc, cindy withdraws ion-mode 3e18, ralph withdraws 1e16 weth-usdc\"\n );\n stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n assertEq(stakedBalanceIonMode, 0, \"Underlying staked balance for bob updated ion-mode\");\n assertEq(stakedBalanceWethUsdc, 0, \"Underlying staked balance for bob updated weth-usdc\");\n\n _logUnderlyingStake(users);\n // _logCumulativeAssetValues(users, lpTokens);\n // _logTokens(tokenIds, lpTokens);\n }\n\n function test_withdraw_RevertIfNotOwner() public {\n vm.prank(address(0x3523));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_withdraw_RevertIfVoting() public {\n IveION(ve).voting(lockInput.tokenId, true);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_withdraw_RevertIfPermanentLock() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n\n function test_withdraw_RevertIfTokenNotWhitelisted() public {\n MockERC20 randomMockToken = new MockERC20(\"Random_Token\", \"RND\", 18);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).withdraw(address(randomMockToken), lockInput.tokenId);\n }\n\n function test_withdraw_TokenShouldStillExistIfRemainingLP() public {\n vm.prank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n address owner = IveION(ve).ownerOf(lockInputMultiLP.tokenId);\n assertEq(owner, user, \"User should still own their token\");\n }\n\n function test_withdraw_TokenShouldBeBurntInAllLPRemoved() public {\n vm.startPrank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n IveION(ve).withdraw(address(modeBalancer8020IonEth), lockInputMultiLP.tokenId);\n vm.stopPrank();\n\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).ownerOf(lockInputMultiLP.tokenId);\n\n uint256[] memory ownerTokenIds = IveION(ve).getOwnedTokenIds(user);\n bool tokenIdFound = false;\n for (uint256 i = 0; i < ownerTokenIds.length; i++) {\n if (ownerTokenIds[i] == lockInputMultiLP.tokenId) {\n tokenIdFound = true;\n break;\n }\n }\n assertFalse(tokenIdFound, \"Token ID should be removed from user's owned tokens\");\n }\n\n function test_withdraw_WithdrawAssetNotOwnedButWhitelisted() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NoLockFound()\"));\n IveION(ve).withdraw(address(modeBalancer8020IonEth), lockInput.tokenId);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Withdrawals.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Withdrawals is veIONTest {\n address user;\n LockInfo lockInput;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n\n modeVelodrome5050IonMode.mint(address(0x1241), 20_000_000 ether);\n vm.prank(user);\n IveION(ve).withdraw(lockInput.tokenAddress, lockInput.tokenId);\n }\n\n function test_withdrawProtocolFees_SuccessfulWithdrawal() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n uint256 initialRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n uint256 initialProtocolFees = IveION(ve).s_protocolFees(IveION(ve).s_lpType(tokenAddress));\n\n IveION(ve).withdrawProtocolFees(tokenAddress, recipient);\n\n uint256 protocolFees = IveION(ve).s_protocolFees(IveION(ve).s_lpType(tokenAddress));\n assertEq(protocolFees, 0, \"Protocol fees should be zero after withdrawal\");\n\n uint256 finalRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n assertEq(\n finalRecipientBalance,\n initialRecipientBalance + initialProtocolFees,\n \"Recipient should receive the protocol fees\"\n );\n }\n\n function test_withdrawProtocolFees_NotOwner() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n\n vm.prank(user);\n vm.expectRevert(\"Ownable: caller is not the owner\");\n IveION(ve).withdrawProtocolFees(tokenAddress, recipient);\n }\n\n function test_withdrawDistributedFees_SuccessfulWithdrawal() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n uint256 initialRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n uint256 initialDistributedFees = IveION(ve).s_distributedFees(IveION(ve).s_lpType(tokenAddress));\n\n IveION(ve).withdrawDistributedFees(tokenAddress, recipient);\n\n uint256 distributedFees = IveION(ve).s_distributedFees(IveION(ve).s_lpType(tokenAddress));\n assertEq(distributedFees, 0, \"Distributed fees should be zero after withdrawal\");\n\n uint256 finalRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n assertEq(\n finalRecipientBalance,\n initialRecipientBalance + initialDistributedFees,\n \"Recipient should receive the distributed fees\"\n );\n }\n\n function test_withdrawDistributedFees_NotOwner() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n\n vm.prank(user);\n vm.expectRevert(\"Ownable: caller is not the owner\");\n IveION(ve).withdrawDistributedFees(tokenAddress, recipient);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/ClaimBribes.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../../../../veION/Voter.sol\";\nimport \"../../../../veION/BribeRewards.sol\";\nimport \"./utils/VoterUtils.sol\";\n\ncontract ClaimBribesTest is VoterTest {\n BribeRewards realBribeEthSupply;\n BribeRewards realBribeEthBorrow;\n MockERC20 bribeTokenA;\n MockERC20 bribeTokenB;\n MockERC20 bribeTokenC;\n\n function setUp() public {\n _setUp();\n bribeTokenA = new MockERC20(\"Bribe Token A\", \"BTA\", 18);\n bribeTokenB = new MockERC20(\"Bribe Token B\", \"BTB\", 18);\n\n realBribeEthSupply = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), address(ve))\n )\n )\n );\n\n realBribeEthBorrow = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), address(ve))\n )\n )\n );\n\n address[] memory rewardAccumulatorsForBribes = new address[](2);\n address[] memory bribes = new address[](2);\n\n rewardAccumulatorsForBribes[0] = voter.marketToRewardAccumulators(ethMarket, IVoter.MarketSide.Supply);\n rewardAccumulatorsForBribes[1] = voter.marketToRewardAccumulators(ethMarket, IVoter.MarketSide.Borrow);\n bribes[0] = address(realBribeEthSupply);\n bribes[1] = address(realBribeEthBorrow);\n\n voter.whitelistToken(address(bribeTokenA), true);\n voter.whitelistToken(address(bribeTokenB), true);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n }\n\n function test_claimBribes() public {\n // Mint and approve bribe tokens\n bribeTokenA.mint(address(this), 1000 ether);\n bribeTokenA.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenB.mint(address(this), 1000 ether);\n bribeTokenB.approve(address(realBribeEthSupply), 1000 ether);\n\n // Notify reward amounts\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n // Deposit bribes\n address[] memory tokens = new address[](2);\n tokens[0] = address(bribeTokenA);\n tokens[1] = address(bribeTokenB);\n\n vm.startPrank(address(voter));\n realBribeEthSupply.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthSupply.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n vm.stopPrank();\n\n // Claim bribes\n address[] memory bribes = new address[](1);\n bribes[0] = address(realBribeEthSupply);\n address[][] memory rewardTokens = new address[][](1);\n rewardTokens[0] = tokens;\n\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(user);\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n\n // Check balances\n uint256 balanceA = bribeTokenA.balanceOf(user);\n uint256 balanceB = bribeTokenB.balanceOf(user);\n\n assertEq(balanceA, 1000 ether, \"User should have claimed 1000 ether of bribeTokenA\");\n assertEq(balanceB, 1000 ether, \"User should have claimed 1000 ether of bribeTokenB\");\n }\n\n function test_claimBribesMultipleBribes() public {\n // Mint and approve bribe tokens for both bribe contracts\n bribeTokenA.mint(address(this), 2000 ether);\n bribeTokenA.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenA.approve(address(realBribeEthBorrow), 1000 ether);\n\n bribeTokenB.mint(address(this), 2000 ether);\n bribeTokenB.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenB.approve(address(realBribeEthBorrow), 1000 ether);\n\n // Notify reward amounts for both bribe contracts\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthBorrow.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthBorrow.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n realBribeEthBorrow.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthBorrow.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n // Deposit bribes into both bribe contracts\n address[] memory tokens = new address[](2);\n tokens[0] = address(bribeTokenA);\n tokens[1] = address(bribeTokenB);\n\n vm.startPrank(address(voter));\n realBribeEthSupply.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthSupply.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n realBribeEthBorrow.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthBorrow.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n vm.stopPrank();\n\n // Claim bribes from both bribe contracts\n address[] memory bribes = new address[](2);\n bribes[0] = address(realBribeEthSupply);\n bribes[1] = address(realBribeEthBorrow);\n address[][] memory rewardTokens = new address[][](2);\n rewardTokens[0] = tokens;\n rewardTokens[1] = tokens;\n\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(user);\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n\n // Check balances\n uint256 balanceA = bribeTokenA.balanceOf(user);\n uint256 balanceB = bribeTokenB.balanceOf(user);\n\n assertEq(balanceA, 2000 ether, \"User should have claimed 2000 ether of bribeTokenA\");\n assertEq(balanceB, 2000 ether, \"User should have claimed 2000 ether of bribeTokenB\");\n }\n\n function test_claimBribes_RevertIfNotOwner() public {\n address notOwner = address(0xABC);\n\n address[] memory bribes = new address[](2);\n bribes[0] = address(0x123); // Dummy address for bribe contract\n bribes[1] = address(0x456); // Dummy address for another bribe contract\n\n address[][] memory rewardTokens = new address[][](2);\n rewardTokens[0] = new address[](2);\n rewardTokens[0][0] = address(0x789); // Dummy address for reward token A\n rewardTokens[0][1] = address(0xABC); // Dummy address for reward token B\n\n rewardTokens[1] = new address[](2);\n rewardTokens[1][0] = address(0xDEF); // Dummy address for reward token A\n rewardTokens[1][1] = address(0xFED); // Dummy address for reward token B\n\n vm.startPrank(notOwner);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n vm.stopPrank();\n }\n\n function test_claimBribes_RevertIfUnequalLengths() public {\n address[] memory bribes = new address[](2);\n bribes[0] = address(0x123); // Dummy address for bribe contract\n bribes[1] = address(0x456); // Dummy address for another bribe contract\n\n address[][] memory rewardTokens = new address[][](1); // Intentionally unequal length\n rewardTokens[0] = new address[](2);\n rewardTokens[0][0] = address(0x789); // Dummy address for reward token A\n rewardTokens[0][1] = address(0xABC); // Dummy address for reward token B\n\n vm.startPrank(user);\n vm.expectRevert(abi.encodeWithSignature(\"UnequalLengths()\"));\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/DistributeRewards.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\nimport { PoolDirectory } from \"../../../../PoolDirectory.sol\";\nimport { EmissionsManager } from \"../../../../EmissionsManager.sol\";\nimport { IonicFlywheelCore } from \"../../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicFlywheel } from \"../../../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicFlywheelBorrow } from \"../../../../ionic/strategies/flywheel/IonicFlywheelBorrow.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IFlywheelBooster } from \"../../../../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../../../../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { IIonicFlywheelBorrowBooster } from \"../../../../ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol\";\nimport { IonicFlywheelBorrowBooster } from \"../../../../ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol\";\nimport { IonicFlywheelDynamicRewards } from \"../../../../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol\";\nimport { Comptroller } from \"../../../../compound/Comptroller.sol\";\nimport { RewardAccumulator } from \"../../../../veION/RewardAccumulator.sol\";\nimport { CErc20RewardsDelegate } from \"../../../../compound/CErc20RewardsDelegate.sol\";\n\ncontract DistributeRewards is VoterTest {\n address owner = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address ion = 0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5;\n address weth = 0x4200000000000000000000000000000000000006;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address ionWhale = 0x7862Ba142511eEf11a5a8b179DB4F53AC115AB59;\n address baseWETHWhale = 0x0250f06fc76297Fe28D0981F0566F1c0445B3cFE;\n address baseUSDCWhale = 0x0B0A5886664376F59C351ba3f598C8A8B4D0A6f3;\n address baseIonWethWhale = 0xf018B923bEbdef7a8124371B322D7E29a08c3198;\n address[] markets;\n address[] uniqMarkets;\n IVoter.MarketSide[] sides;\n IVoter.MarketSide[] borrowSides;\n IVoter.MarketSide[] supplySides;\n uint256[] weights;\n uint256 rewardAmount = 1_000_000 * 1e18;\n uint256 ONE = 1e18;\n address[] rewardAccumulators;\n address[] supplyRewardAccumulators;\n address[] borrowRewardAccumulators;\n\n CErc20RewardsDelegate ionUsdcMarket = CErc20RewardsDelegate(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0);\n PoolDirectory poolDirectory = PoolDirectory(0xE1A3006be645a80F206311d9f18C866c204bA02f);\n IonicFlywheel flywheelSupply;\n IonicFlywheelBorrow flywheelBorrow;\n IonicFlywheelDynamicRewards flywheelRewardsBorrow;\n IonicFlywheelDynamicRewards flywheelRewardsSupply;\n EmissionsManager emissionsManager;\n address protocalAddress = address(0x123);\n bytes bytecode = hex\"deadbeef\";\n IIonicFlywheelBorrowBooster flywheelBooster;\n uint32 constant ONE_WEEK = 1 weeks;\n Comptroller comptroller = Comptroller(0x05c9C6417F246600f8f5f49fcA9Ee991bfF73D13);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n markets = new address[](4);\n sides = new IVoter.MarketSide[](4);\n weights = new uint256[](4);\n\n markets[0] = ethMarket;\n sides[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n markets[1] = ethMarket;\n sides[1] = IVoter.MarketSide.Borrow;\n weights[1] = 100;\n\n markets[2] = btcMarket;\n sides[2] = IVoter.MarketSide.Supply;\n weights[2] = 100;\n\n markets[3] = btcMarket;\n sides[3] = IVoter.MarketSide.Borrow;\n weights[3] = 100;\n\n UniswapLpTokenPriceOracle uniswapLpTokenPriceOracleIonWeth = new UniswapLpTokenPriceOracle(address(weth));\n UniswapLpTokenPriceOracle uniswapLpTokenPriceOracleWethAero = new UniswapLpTokenPriceOracle(address(weth));\n address[] memory underlyings = new address[](2);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\n\n underlyings[0] = address(ionWeth5050lPAero);\n oracles[0] = BasePriceOracle(address(uniswapLpTokenPriceOracleIonWeth));\n underlyings[1] = address(wethAero5050LPAero);\n oracles[1] = BasePriceOracle(address(uniswapLpTokenPriceOracleWethAero));\n\n vm.prank(mpo.admin());\n mpo.add(underlyings, oracles);\n\n vm.startPrank(owner);\n emissionsManager = EmissionsManager(\n address(\n new TransparentUpgradeableProxy(\n address(new EmissionsManager()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n EmissionsManager.initialize.selector,\n poolDirectory,\n protocalAddress,\n ERC20(ion),\n 2500,\n bytecode\n )\n )\n )\n );\n\n emissionsManager.setVeIon(IveION(ve));\n\n // Deploy borrow flywheels\n flywheelBooster = new IonicFlywheelBorrowBooster();\n\n flywheelBorrow = IonicFlywheelBorrow(\n address(\n new TransparentUpgradeableProxy(\n address(new IonicFlywheelBorrow()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n IonicFlywheelCore.initialize.selector,\n ERC20(ion),\n IFlywheelRewards(address(0)),\n IFlywheelBooster(address(flywheelBooster)),\n owner\n )\n )\n )\n );\n // Deploy supply flywheels\n flywheelSupply = IonicFlywheel(\n address(\n new TransparentUpgradeableProxy(\n address(new IonicFlywheel()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n IonicFlywheelCore.initialize.selector,\n ERC20(ion),\n IFlywheelRewards(address(0)),\n IFlywheelBooster(address(0)),\n owner\n )\n )\n )\n );\n\n flywheelRewardsBorrow = new IonicFlywheelDynamicRewards(IonicFlywheelCore(address(flywheelBorrow)), ONE_WEEK);\n flywheelBorrow.setFlywheelRewards(IFlywheelRewards(address(flywheelRewardsBorrow)));\n\n flywheelRewardsSupply = new IonicFlywheelDynamicRewards(IonicFlywheelCore(address(flywheelSupply)), ONE_WEEK);\n flywheelSupply.setFlywheelRewards(IFlywheelRewards(address(flywheelRewardsSupply)));\n\n flywheelSupply.setEmissionsManager(emissionsManager);\n flywheelBorrow.setEmissionsManager(emissionsManager);\n flywheelSupply.updateFeeSettings(0, protocalAddress);\n flywheelBorrow.updateFeeSettings(0, protocalAddress);\n\n uniqMarkets = new address[](2);\n uniqMarkets[0] = markets[0];\n uniqMarkets[1] = markets[2];\n\n supplyRewardAccumulators = new address[](2);\n borrowRewardAccumulators = new address[](2);\n\n for (uint256 i = 0; i < uniqMarkets.length; i++) {\n flywheelBorrow.addStrategyForRewards(ERC20(uniqMarkets[i]));\n flywheelSupply.addStrategyForRewards(ERC20(uniqMarkets[i]));\n supplyRewardAccumulators[i] = voter.marketToRewardAccumulators(uniqMarkets[i], IVoter.MarketSide.Supply);\n borrowRewardAccumulators[i] = voter.marketToRewardAccumulators(uniqMarkets[i], IVoter.MarketSide.Borrow);\n }\n\n flywheelRewardsBorrow.setRewardAccumulators(uniqMarkets, borrowRewardAccumulators);\n flywheelRewardsSupply.setRewardAccumulators(uniqMarkets, supplyRewardAccumulators);\n vm.stopPrank();\n\n vm.startPrank(address(0));\n for (uint256 i = 0; i < uniqMarkets.length; i++) {\n RewardAccumulator(supplyRewardAccumulators[i]).approve(ion, address(flywheelRewardsSupply));\n RewardAccumulator(borrowRewardAccumulators[i]).approve(ion, address(flywheelRewardsBorrow));\n }\n vm.stopPrank();\n\n vm.startPrank(comptroller.admin());\n comptroller._addRewardsDistributor(address(flywheelBorrow));\n comptroller._addRewardsDistributor(address(flywheelSupply));\n vm.stopPrank();\n }\n\n function test_distributeRewards_RewardsCanBeDistributed() public forkAtBlock(BASE_MAINNET, 23248915) {\n vm.prank(baseUser);\n voter.vote(baseTokenIdSingleLp, markets, sides, weights);\n uint256 ionPrice = mpo.price(ion);\n uint256 wethPrice = mpo.price(weth);\n\n uint256 ionWethLpPrice = mpo.price(ionWeth5050lPAero);\n\n console.log(\"ION Price:\", ionPrice);\n console.log(\"WETH Price:\", wethPrice);\n console.log(\"ION-WETH LP Price:\", ionWethLpPrice);\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n uint256 expectedBalance = rewardAmount / 4;\n assertEq(ionBalance, expectedBalance, \"Each reward accumulator should have a quarter of the tokens\");\n }\n }\n\n function test_distributeRewards_MultiLPAndVoters() public forkAtBlock(BASE_MAINNET, 23248915) {\n address[] memory voters = new address[](20);\n uint256[] memory tokenIds = new uint256[](20);\n uint256 totalWeight = 0;\n for (uint256 i = 0; i < voters.length; i++) {\n voters[i] = address(uint160(uint256(keccak256(abi.encodePacked(i, block.timestamp)))));\n\n uint256 ionWethAmount = 10 + (uint256(keccak256(abi.encodePacked(i, block.timestamp))) % 11);\n uint256 wethAeroAmount = 10 + (uint256(keccak256(abi.encodePacked(i, block.timestamp, uint256(1)))) % 11);\n\n tokenIds[i] = _lockMultiLpFork(voters[i], ionWethAmount * 1e18, wethAeroAmount * 1e18);\n\n uint256[] memory weights = new uint256[](4);\n for (uint256 j = 0; j < weights.length; j++) {\n weights[j] = 1 + (uint256(keccak256(abi.encodePacked(j, block.timestamp, i))) % 100);\n totalWeight += weights[j];\n }\n _vote(voters[i], tokenIds[i], weights);\n }\n\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 marketWeightIonWeth = voter.weights(markets[i], sides[i], address(ionWeth5050lPAero));\n uint256 marketWeightWethAero = voter.weights(markets[i], sides[i], address(wethAero5050LPAero));\n console.log(\"-----------------------------------------------------\");\n console.log(\"Market:\", markets[i]);\n console.log(\"Side:\", uint256(sides[i]));\n console.log(\"Market Weight ION-WETH:\", marketWeightIonWeth);\n console.log(\"Market Weight WETH-AERO:\", marketWeightWethAero);\n }\n console.log(\"-----------------------------------------------------\");\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n uint256[] memory expectedBalances = new uint256[](4);\n expectedBalances[0] = 276676147359650479260798;\n expectedBalances[1] = 223767532575522266411076;\n expectedBalances[2] = 245411929366342403014352;\n expectedBalances[3] = 254144390698484851313772;\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n assertEq(ionBalance, expectedBalances[i], \"Each reward accumulator should have roughly a quarter\");\n }\n\n // Log the price of ION-WETH LP using mpo.price\n uint256 ionWethPrice = mpo.price(address(ionWeth5050lPAero));\n console.log(\"Price of ION-WETH LP:\", ionWethPrice);\n\n // Log the price of WETH-AERO LP using mpo.price\n uint256 wethAeroPrice = mpo.price(address(wethAero5050LPAero));\n console.log(\"Price of WETH-AERO LP:\", wethAeroPrice);\n }\n\n function test_claimRewards_RewardsCanBeClaimed() public forkAtBlock(BASE_MAINNET, 21579411) {\n vm.prank(baseUser);\n voter.vote(baseTokenIdSingleLp, markets, sides, weights);\n uint256 ionPrice = mpo.price(ion);\n uint256 wethPrice = mpo.price(weth);\n\n uint256 ionWethLpPrice = mpo.price(ionWeth5050lPAero);\n\n console.log(\"ION Price:\", ionPrice);\n console.log(\"WETH Price:\", wethPrice);\n console.log(\"ION-WETH LP Price:\", ionWethLpPrice);\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n uint256 expectedBalance = rewardAmount / 4;\n assertEq(ionBalance, expectedBalance, \"Each reward accumulator should have a quarter of the tokens\");\n }\n\n _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n\n vm.prank(baseWETHWhale);\n IERC20(weth).transfer(address(baseUser), ONE);\n\n uint256 ionBalanceBefore = IERC20(ion).balanceOf(address(baseUser));\n\n vm.startPrank(baseUser);\n IERC20(weth).approve(ethMarket, ONE);\n address[] memory marketToEnter;\n marketToEnter = new address[](2);\n marketToEnter[0] = ethMarket;\n marketToEnter[1] = btcMarket;\n\n comptroller.enterMarkets(marketToEnter);\n CErc20RewardsDelegate(ethMarket).mint(1e15);\n\n vm.stopPrank();\n vm.warp(voter.epochNext(block.timestamp));\n\n vm.startPrank(baseUser);\n flywheelSupply.accrue(ERC20(ethMarket), address(baseUser));\n\n flywheelSupply.claimRewards(address(baseUser));\n uint256 ionBalanceAfter = IERC20(ion).balanceOf(address(baseUser));\n uint256 rewardClaimed = ionBalanceAfter - ionBalanceBefore;\n uint256 ionwethBalanceAfter = IERC20(ethMarket).balanceOf(address(baseUser));\n uint256 ionwethTotalBalanceAfter = IERC20(ethMarket).totalSupply();\n assertEq(\n ionwethTotalBalanceAfter / ionwethBalanceAfter,\n rewardAmount / 4 / rewardClaimed,\n \"User should get his fair share of rewards\"\n );\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/mocks/MockBribeRewards.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.10;\n\nimport \"../../../../../veION/interfaces/IBribeRewards.sol\";\n\ncontract MockBribeRewards is IBribeRewards {\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external override {\n emit Deposit(msg.sender, tokenId, amount);\n }\n\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external override {\n emit Withdraw(msg.sender, tokenId, amount);\n }\n\n function notifyRewardAmount(address token, uint256 amount) external override {\n emit RewardNotification(msg.sender, token, block.timestamp, amount);\n }\n\n function getReward(uint256 tokenId, address[] memory tokens) external override {\n for (uint256 i = 0; i < tokens.length; i++) {\n emit RewardsClaimed(msg.sender, tokens[i], 0); // Assuming 0 as a placeholder for reward amount\n }\n }\n\n function getPriorBalanceIndex(\n uint256 tokenId,\n address lpToken,\n uint256 timestamp\n ) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n\n function earned(address token, uint256 tokenId) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Poke.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Poke is VoterTest {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n\n function setUp() public {\n _setUp();\n\n marketVote = new address[](1);\n marketVoteSide = new IVoter.MarketSide[](1);\n weights = new uint256[](1);\n marketVote[0] = ethMarket;\n marketVoteSide[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n vm.startPrank(user);\n voter.vote(voterTokenIdMultiLp, marketVote, marketVoteSide, weights);\n voter.vote(voterTokenIdSingleLp, marketVote, marketVoteSide, weights);\n vm.stopPrank();\n }\n\n function test_poke_UserCanPoke() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(initialVoteDetails.votes[i], finalVoteDetails.votes[i], \"Votes should decrease with time\");\n }\n\n assertEq(\n initialVoteDetails.marketVotes.length,\n finalVoteDetails.marketVotes.length,\n \"Market votes length should remain the same\"\n );\n assertEq(\n initialVoteDetails.marketVoteSides.length,\n finalVoteDetails.marketVoteSides.length,\n \"Market vote sides length should remain the same\"\n );\n assertGt(initialVoteDetails.usedWeight, finalVoteDetails.usedWeight, \"Used weight should decrease with time\");\n\n for (uint256 i = 0; i < initialVoteDetails.marketVotes.length; i++) {\n assertEq(\n initialVoteDetails.marketVotes[i],\n finalVoteDetails.marketVotes[i],\n \"Market votes should remain the same\"\n );\n assertEq(\n uint256(initialVoteDetails.marketVoteSides[i]),\n uint256(finalVoteDetails.marketVoteSides[i]),\n \"Market vote sides should remain the same\"\n );\n }\n\n // Log initial votes and used weight\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n // Log final votes and used weight\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n // Repeat test for balancer vote details\n IVoter.VoteDetails memory initialBalancerVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory finalBalancerVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n for (uint256 i = 0; i < initialBalancerVoteDetails.votes.length; i++) {\n assertGt(\n initialBalancerVoteDetails.votes[i],\n finalBalancerVoteDetails.votes[i],\n \"Balancer votes should decrease with time\"\n );\n }\n\n assertEq(\n initialBalancerVoteDetails.marketVotes.length,\n finalBalancerVoteDetails.marketVotes.length,\n \"Balancer votes length should remain the same\"\n );\n assertEq(\n initialBalancerVoteDetails.marketVoteSides.length,\n finalBalancerVoteDetails.marketVoteSides.length,\n \"Balancer vote sides length should remain the same\"\n );\n assertGt(\n initialBalancerVoteDetails.usedWeight,\n finalBalancerVoteDetails.usedWeight,\n \"Balancer used weight should decrease with time\"\n );\n\n for (uint256 i = 0; i < initialBalancerVoteDetails.marketVotes.length; i++) {\n assertEq(\n initialBalancerVoteDetails.marketVotes[i],\n finalBalancerVoteDetails.marketVotes[i],\n \"Balancer votes should remain the same\"\n );\n assertEq(\n uint256(initialBalancerVoteDetails.marketVoteSides[i]),\n uint256(finalBalancerVoteDetails.marketVoteSides[i]),\n \"Balancer vote sides should remain the same\"\n );\n }\n\n // Log initial balancer votes and used weight\n for (uint256 i = 0; i < initialBalancerVoteDetails.votes.length; i++) {\n console.log(\"Initial Balancer Votes for market\", i, \":\", initialBalancerVoteDetails.votes[i]);\n }\n console.log(\"Initial Balancer Used Weight:\", initialBalancerVoteDetails.usedWeight);\n\n // Log final balancer votes and used weight\n for (uint256 i = 0; i < finalBalancerVoteDetails.votes.length; i++) {\n console.log(\"Final Balancer Votes for market\", i, \":\", finalBalancerVoteDetails.votes[i]);\n }\n console.log(\"Final Balancer Used Weight:\", finalBalancerVoteDetails.usedWeight);\n }\n\n function test_poke_UserCanPokeSingleAsset() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(initialVoteDetails.votes[i], finalVoteDetails.votes[i]);\n }\n }\n\n function test_poke_RevertIfDistributeWindow() public {\n vm.warp(voter.epochVoteStart(block.timestamp));\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.poke(voterTokenIdSingleLp);\n }\n\n function test_poke_UntilExpiry() public {\n vm.warp(block.timestamp + 365 * 86400);\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n assertEq(finalVoteDetails.votes[i], 0, \"Final votes should be zero for each market\");\n }\n assertEq(finalVoteDetails.usedWeight, 0, \"Final used weight should be zero\");\n }\n\n function test_poke_AfterIncreaseAmount() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 additionalAmount = 1000 * 1e18; // Example amount to mint\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), voterTokenIdSingleLp, additionalAmount, false);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterIncreaseUnlock() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 additionalDuration = 70 weeks;\n vm.startPrank(user);\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), voterTokenIdSingleLp, additionalDuration);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterLockPermanent() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterUnlockPermanent() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterDelegation() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdSingleLp, voterTokenIdMultiLp, address(modeVelodrome5050IonMode), 500 ether);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterBeingDelegatedTo() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegatedAmount = 500 ether;\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdMultiLp, voterTokenIdSingleLp, address(modeVelodrome5050IonMode), delegatedAmount);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertEq(\n finalVoteDetails.votes[i],\n (voterLockInfoSingleLp.tokenAmount + delegatedAmount) * 2,\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertEq(\n finalVoteDetails.usedWeight,\n (voterLockInfoSingleLp.tokenAmount + delegatedAmount) * 2,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterRemoveDelegator() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegatedAmount = 500 ether;\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdMultiLp, voterTokenIdSingleLp, address(modeVelodrome5050IonMode), delegatedAmount);\n uint256[] memory multiLpArray = new uint256[](1);\n multiLpArray[0] = voterTokenIdMultiLp;\n uint256[] memory delegatedAmountArray = new uint256[](1);\n delegatedAmountArray[0] = delegatedAmount;\n IveION(ve).removeDelegators(\n multiLpArray,\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode),\n delegatedAmountArray\n );\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertEq(\n finalVoteDetails.votes[i],\n (voterLockInfoSingleLp.tokenAmount) * 2,\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertEq(\n finalVoteDetails.usedWeight,\n (voterLockInfoSingleLp.tokenAmount) * 2,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterRemoveDelegatee() external {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegateAmount = 1000 ether;\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdSingleLp, voterTokenIdMultiLp, address(modeVelodrome5050IonMode), delegateAmount);\n uint256[] memory singleLpArray = new uint256[](1);\n singleLpArray[0] = voterTokenIdMultiLp;\n uint256[] memory amountArray = new uint256[](1);\n amountArray[0] = delegateAmount;\n IveION(ve).removeDelegatees(voterTokenIdSingleLp, singleLpArray, address(modeVelodrome5050IonMode), amountArray);\n vm.stopPrank();\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n // assertEq(finalVoteDetails.votes.length, 0, \"Final vote details array length should be zero \");\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n // assertEq(finalVoteDetails.usedWeight, 0, \"Final used weight should be greater than initial used weight\");\n }\n\n function test_poke_AfterTransfer() external {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 10 weeks);\n\n vm.startPrank(user);\n IveION(ve).transferFrom(user, address(0x2352), voterTokenIdSingleLp);\n voter.poke(voterTokenIdSingleLp);\n vm.stopPrank();\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(\n initialVoteDetails.votes[i],\n finalVoteDetails.votes[i],\n \"Initial votes should be greater than final votes\"\n );\n }\n assertGt(\n initialVoteDetails.usedWeight,\n finalVoteDetails.usedWeight,\n \"Initial used weight should be greater than final used weight\"\n );\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Reset.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Reset is VoterTest {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n\n function setUp() public {\n _setUp();\n\n marketVote = new address[](1);\n marketVoteSide = new IVoter.MarketSide[](1);\n weights = new uint256[](1);\n marketVote[0] = ethMarket;\n marketVoteSide[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n vm.startPrank(user);\n voter.vote(voterTokenIdMultiLp, marketVote, marketVoteSide, weights);\n voter.vote(voterTokenIdSingleLp, marketVote, marketVoteSide, weights);\n vm.stopPrank();\n }\n\n function test_reset_UserCanResetSingleLpToken() public {\n vm.warp(block.timestamp + 1 weeks);\n vm.prank(user);\n voter.reset(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory resetVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n assertEq(resetVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", resetVoteDetails.usedWeight);\n assertEq(resetVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n }\n\n function test_reset_UserCanResetMultiLpToken() public {\n vm.warp(block.timestamp + 1 weeks);\n vm.prank(user);\n voter.reset(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory veloVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n IVoter.VoteDetails memory balancerVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeBalancer8020IonEth)\n );\n\n assertEq(veloVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", veloVoteDetails.usedWeight);\n assertEq(veloVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n\n assertEq(balancerVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", balancerVoteDetails.usedWeight);\n assertEq(balancerVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n }\n\n function test_reset_RevertIfSameEpoch() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVotedOrDeposited()\"));\n voter.reset(voterTokenIdSingleLp);\n }\n\n function test_reset_RevertIfDistributeWindow() public {\n vm.warp(voter.epochNext(block.timestamp));\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.reset(voterTokenIdSingleLp);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Setters.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Setters is VoterTest {\n function setUp() public {\n _setUp();\n }\n\n function testSetLpTokens() public {\n address[] memory newLpTokens = new address[](2);\n newLpTokens[0] = address(0x123);\n newLpTokens[1] = address(0x456);\n\n voter.setLpTokens(newLpTokens);\n\n address[] memory lpTokens = voter.getAllLpRewardTokens();\n assertEq(lpTokens.length, newLpTokens.length, \"LP tokens length mismatch\");\n for (uint256 i = 0; i < lpTokens.length; i++) {\n assertEq(lpTokens[i], newLpTokens[i], \"LP token mismatch\");\n }\n }\n\n function testSetLpTokensRevertEmptyArray() public {\n // Test revert case: setting empty LP tokens array\n address[] memory emptyLpTokens = new address[](0);\n vm.expectRevert(\"LpTokens array cannot be empty\");\n voter.setLpTokens(emptyLpTokens);\n }\n\n function testSetMpo() public {\n address newMpo = address(0x789);\n voter.setMpo(newMpo);\n\n assertEq(address(voter.mpo()), newMpo, \"MPO address mismatch\");\n }\n\n function testSetMpoRevertZeroAddress() public {\n // Test revert case: setting MPO to zero address\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAddress()\"));\n voter.setMpo(address(0));\n }\n\n function testSetGovernor() public {\n address newGovernor = address(0xABC);\n voter.setGovernor(newGovernor);\n\n assertEq(voter.governor(), newGovernor, \"Governor address mismatch\");\n }\n\n function testSetGovernorRevertZeroAddress() public {\n // Test revert case: setting Governor to zero address\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAddress()\"));\n voter.setGovernor(address(0));\n }\n\n function testSetMaxVotingNum() public {\n uint256 newMaxVotingNum = 25;\n voter.setMaxVotingNum(newMaxVotingNum);\n\n assertEq(voter.maxVotingNum(), newMaxVotingNum, \"Max voting number mismatch\");\n }\n\n function testSetMaxVotingNumRevertTooLow() public {\n // Test revert case: setting MaxVotingNum below minimum\n vm.expectRevert(abi.encodeWithSignature(\"MaximumVotingNumberTooLow()\"));\n voter.setMaxVotingNum(5);\n }\n\n function testSetMaxVotingNumRevertSameValue() public {\n uint256 newMaxVotingNum = 25;\n voter.setMaxVotingNum(newMaxVotingNum);\n\n // Test revert case: setting MaxVotingNum to the same value\n vm.expectRevert(abi.encodeWithSignature(\"SameValue()\"));\n voter.setMaxVotingNum(newMaxVotingNum);\n }\n\n function testWhitelistToken() public {\n address token = address(0xFED);\n voter.whitelistToken(token, true);\n\n assertTrue(voter.isWhitelistedToken(token), \"Token should be whitelisted\");\n }\n\n function testWhitelistNFT() public {\n uint256 tokenId = 1;\n voter.whitelistNFT(tokenId, true);\n\n assertTrue(voter.isWhitelistedNFT(tokenId), \"NFT should be whitelisted\");\n }\n\n function testAddMarkets() public {\n IVoter.Market[] memory newMarkets = new IVoter.Market[](2);\n newMarkets[0] = IVoter.Market(address(0x123), IVoter.MarketSide.Supply);\n newMarkets[1] = IVoter.Market(address(0x456), IVoter.MarketSide.Borrow);\n\n voter.addMarkets(newMarkets);\n\n assertEq(voter.marketsLength(), 6, \"Markets length mismatch\");\n (address marketAddress, IVoter.MarketSide marketSide) = voter.markets(4);\n assertEq(marketAddress, address(0x123), \"First market address mismatch\");\n assertEq(uint256(marketSide), uint256(IVoter.MarketSide.Supply), \"First market side mismatch\");\n\n (marketAddress, marketSide) = voter.markets(5);\n assertEq(marketAddress, address(0x456), \"Second market address mismatch\");\n assertEq(uint256(marketSide), uint256(IVoter.MarketSide.Borrow), \"Second market side mismatch\");\n }\n\n function testAddMarketsRevertMarketExists() public {\n IVoter.Market[] memory newMarkets = new IVoter.Market[](2);\n newMarkets[0] = IVoter.Market(address(0x123), IVoter.MarketSide.Supply);\n newMarkets[1] = IVoter.Market(address(0x456), IVoter.MarketSide.Borrow);\n\n voter.addMarkets(newMarkets);\n\n // Test revert case: adding an existing market\n vm.expectRevert(abi.encodeWithSignature(\"MarketAlreadyExists()\"));\n voter.addMarkets(newMarkets);\n }\n\n function testSetMarketRewardAccumulators() public {\n address[] memory marketAddresses = new address[](2);\n marketAddresses[0] = address(0x123);\n marketAddresses[1] = address(0x456);\n\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](2);\n marketSides[0] = IVoter.MarketSide.Supply;\n marketSides[1] = IVoter.MarketSide.Borrow;\n\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n assertEq(\n voter.marketToRewardAccumulators(address(0x123), IVoter.MarketSide.Supply),\n address(0x789),\n \"First reward accumulator mismatch\"\n );\n assertEq(\n voter.marketToRewardAccumulators(address(0x456), IVoter.MarketSide.Borrow),\n address(0xABC),\n \"Second reward accumulator mismatch\"\n );\n }\n\n function testSetMarketRewardAccumulatorsRevertMismatchedLengths() public {\n address[] memory marketAddresses = new address[](2);\n marketAddresses[0] = address(0x123);\n marketAddresses[1] = address(0x456);\n\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](2);\n marketSides[0] = IVoter.MarketSide.Supply;\n marketSides[1] = IVoter.MarketSide.Borrow;\n\n address[] memory shortRewardAccumulators = new address[](1);\n shortRewardAccumulators[0] = address(0x789);\n\n // Test revert case: mismatched array lengths\n vm.expectRevert(abi.encodeWithSignature(\"MismatchedArrayLengths()\"));\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, shortRewardAccumulators);\n }\n\n function testSetBribes() public {\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n address[] memory bribes = new address[](2);\n bribes[0] = address(0xDEF);\n bribes[1] = address(0xFED);\n\n voter.setBribes(rewardAccumulators, bribes);\n\n assertEq(voter.rewardAccumulatorToBribe(address(0x789)), address(0xDEF), \"First bribe mismatch\");\n assertEq(voter.rewardAccumulatorToBribe(address(0xABC)), address(0xFED), \"Second bribe mismatch\");\n }\n\n function testSetBribesRevertMismatchedLengths() public {\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n address[] memory shortBribes = new address[](1);\n shortBribes[0] = address(0xDEF);\n\n // Test revert case: mismatched array lengths\n vm.expectRevert(abi.encodeWithSignature(\"MismatchedArrayLengths()\"));\n voter.setBribes(rewardAccumulators, shortBribes);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/utils/VoterUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"../../../Utils.sol\";\nimport \"../../../../../veION/Voter.sol\";\nimport \"../mocks/MockBribeRewards.sol\";\nimport { IVoter } from \"../../../../../veION/interfaces/IVoter.sol\";\nimport { RewardAccumulator } from \"../../../../../veION/RewardAccumulator.sol\";\n\ncontract VoterTest is veIONTest {\n Voter voter;\n LockInfo voterLockInfoSingleLp;\n LockInfoMultiple voterLockInfoMultiLp;\n uint256 voterTokenIdSingleLp;\n uint256 voterTokenIdMultiLp;\n address user;\n\n address ethMarket;\n address btcMarket;\n\n MockBribeRewards bribeEthSupply;\n MockBribeRewards bribeEthBorrow;\n MockBribeRewards bribeBtcSupply;\n MockBribeRewards bribeBtcBorrow;\n\n MasterPriceOracle mpo;\n\n function _setUp() internal virtual override {\n super._setUp();\n ethMarket = _generateRandomAddress(1);\n btcMarket = _generateRandomAddress(2);\n\n address[] memory _tokens = new address[](2);\n _tokens[0] = address(modeVelodrome5050IonMode);\n _tokens[1] = address(modeBalancer8020IonEth);\n\n MasterPriceOracle _mpo = new MasterPriceOracle();\n MockERC20 mockIon = new MockERC20(\"Mock ION\", \"mION\", 18);\n address _rewardToken = address(mockIon);\n address _ve = address(ve);\n\n voter = Voter(\n address(\n new TransparentUpgradeableProxy(\n address(new Voter()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, _mpo, _rewardToken, _ve)\n )\n )\n );\n\n IVoter.Market[] memory dummyMarkets = new IVoter.Market[](4);\n dummyMarkets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\n dummyMarkets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\n dummyMarkets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\n dummyMarkets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\n voter.addMarkets(dummyMarkets);\n\n address[] memory marketAddresses = new address[](4);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\n address[] memory rewardAccumulators = new address[](4);\n marketAddresses[0] = ethMarket;\n marketSides[0] = IVoter.MarketSide.Supply;\n marketAddresses[1] = ethMarket;\n marketSides[1] = IVoter.MarketSide.Borrow;\n marketAddresses[2] = btcMarket;\n marketSides[2] = IVoter.MarketSide.Supply;\n marketAddresses[3] = btcMarket;\n marketSides[3] = IVoter.MarketSide.Borrow;\n\n for (uint i = 0; i < 4; i++) {\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\n rewardAccumulators[i] = address(newRewardAccumulator);\n }\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n bribeEthSupply = new MockBribeRewards();\n bribeEthBorrow = new MockBribeRewards();\n bribeBtcSupply = new MockBribeRewards();\n bribeBtcBorrow = new MockBribeRewards();\n\n address[] memory rewardAccumulatorsForBribes = new address[](4);\n address[] memory bribes = new address[](4);\n\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\n bribes[0] = address(bribeEthSupply);\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\n bribes[1] = address(bribeEthBorrow);\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\n bribes[2] = address(bribeBtcSupply);\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\n bribes[3] = address(bribeBtcBorrow);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n\n voter.setMaxVotingNum(20);\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(modeVelodrome5050IonMode);\n lpTokens[1] = address(modeBalancer8020IonEth);\n\n voter.setLpTokens(lpTokens);\n user = address(0x9523);\n vm.warp(block.timestamp + 10 * 365 days);\n\n voterLockInfoSingleLp = _createLockInternal(user);\n voterLockInfoMultiLp = _createLockMultipleInternal(user);\n\n voterTokenIdSingleLp = voterLockInfoSingleLp.tokenId;\n voterTokenIdMultiLp = voterLockInfoMultiLp.tokenId;\n\n IveION(ve).setVoter(address(voter));\n }\n\n function afterForkSetUp() internal virtual override {\n _afterForkSetUpBase();\n\n ethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\n btcMarket = 0x1De166df671AE6DB4C4C98903df88E8007593748;\n\n address[] memory _tokens = new address[](1);\n _tokens[0] = address(0x0FAc819628a7F612AbAc1CaD939768058cc0170c);\n\n mpo = MasterPriceOracle(0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4);\n IERC20 ion = IERC20(0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5);\n\n voter = Voter(\n address(\n new TransparentUpgradeableProxy(\n address(new Voter()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, mpo, address(ion), address(ve))\n )\n )\n );\n\n IVoter.Market[] memory markets = new IVoter.Market[](4);\n markets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\n markets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\n markets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\n markets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\n voter.addMarkets(markets);\n\n address[] memory marketAddresses = new address[](4);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\n address[] memory rewardAccumulators = new address[](4);\n marketAddresses[0] = ethMarket;\n marketSides[0] = IVoter.MarketSide.Supply;\n marketAddresses[1] = ethMarket;\n marketSides[1] = IVoter.MarketSide.Borrow;\n marketAddresses[2] = btcMarket;\n marketSides[2] = IVoter.MarketSide.Supply;\n marketAddresses[3] = btcMarket;\n marketSides[3] = IVoter.MarketSide.Borrow;\n\n for (uint i = 0; i < 4; i++) {\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\n rewardAccumulators[i] = address(newRewardAccumulator);\n }\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n bribeEthSupply = new MockBribeRewards();\n bribeEthBorrow = new MockBribeRewards();\n bribeBtcSupply = new MockBribeRewards();\n bribeBtcBorrow = new MockBribeRewards();\n address[] memory rewardAccumulatorsForBribes = new address[](4);\n address[] memory bribes = new address[](4);\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\n bribes[0] = address(bribeEthSupply);\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\n bribes[1] = address(bribeEthBorrow);\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\n bribes[2] = address(bribeBtcSupply);\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\n bribes[3] = address(bribeBtcBorrow);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n\n voter.setMaxVotingNum(20);\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(ionWeth5050lPAero);\n lpTokens[1] = address(wethAero5050LPAero);\n voter.setLpTokens(lpTokens);\n\n IveION(ve).setVoter(address(voter));\n\n baseTokenIdSingleLp = _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n }\n\n function _vote(address _user, uint256 _tokenId, uint256[] memory weights) internal {\n address[] memory selectedMarkets = new address[](4);\n IVoter.MarketSide[] memory selectedSides = new IVoter.MarketSide[](4);\n uint256[] memory selectedWeights = new uint256[](4);\n\n selectedMarkets[0] = ethMarket;\n selectedSides[0] = IVoter.MarketSide.Supply;\n selectedWeights[0] = weights[0];\n\n selectedMarkets[1] = btcMarket;\n selectedSides[1] = IVoter.MarketSide.Supply;\n selectedWeights[1] = weights[1];\n\n selectedMarkets[2] = ethMarket;\n selectedSides[2] = IVoter.MarketSide.Borrow;\n selectedWeights[2] = weights[2];\n\n selectedMarkets[3] = btcMarket;\n selectedSides[3] = IVoter.MarketSide.Borrow;\n selectedWeights[3] = weights[3];\n\n vm.prank(_user);\n voter.vote(_tokenId, selectedMarkets, selectedSides, selectedWeights);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Vote.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Vote is VoterTest {\n function setUp() public {\n _setUp();\n }\n\n function test_vote_UserCanVoteSingleLP() public {\n address[] memory _marketVote = new address[](2);\n IVoter.MarketSide[] memory _marketVoteSide = new IVoter.MarketSide[](2);\n uint256[] memory _weights = new uint256[](2);\n\n _marketVote[0] = ethMarket;\n _marketVoteSide[0] = IVoter.MarketSide.Supply;\n _weights[0] = 100;\n\n _marketVote[1] = btcMarket;\n _marketVoteSide[1] = IVoter.MarketSide.Borrow;\n _weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdSingleLp, _marketVote, _marketVoteSide, _weights);\n\n (, uint256[] memory votingLPBalances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory voteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 effectiveVotingPower = (votingLPBalances[0] * boosts[0]) / 1e18;\n uint256 totalWeight = _weights[0] + _weights[1];\n\n for (uint256 i = 0; i < voteDetails.marketVotes.length; i++) {\n assertEq(voteDetails.marketVotes[i], _marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetails.marketVoteSides[i]),\n uint256(_marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetails.votes[i],\n (effectiveVotingPower * _weights[i]) / totalWeight,\n \"User's vote should be in accordance with weight\"\n );\n }\n\n assertApproxEqRel(voteDetails.usedWeight, effectiveVotingPower, 0.001e18, \"Used weight should be all voting power\");\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeVelodrome5050IonMode)),\n (effectiveVotingPower * _weights[0]) / totalWeight,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeVelodrome5050IonMode)),\n (effectiveVotingPower * _weights[1]) / totalWeight,\n \"Weight for BTC market should be 200\"\n );\n }\n\n struct VoteLocalVars {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n uint256[] votingLPBalances;\n uint256[] boosts;\n address[] marketVotesVelo;\n IVoter.MarketSide[] marketVoteSidesVelo;\n uint256[] votesVelo;\n uint256 usedWeightVelo;\n address[] marketVotesBalancer;\n IVoter.MarketSide[] marketVoteSidesBalancer;\n uint256[] votesBalancer;\n uint256 usedWeightBalancer;\n uint256 effectiveVotingPowerVelo;\n uint256 totalWeightVelo;\n uint256 effectiveVotingPowerBalancer;\n uint256 totalWeightBalancer;\n }\n\n function test_vote_UserCanVoteMultiLP() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n (, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory voteDetailsVelo = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n IVoter.VoteDetails memory voteDetailsBalancer = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n console.log(\"==================================Velo LP Vote Details==================================:\");\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n console.log(\"===================VOTE====================\");\n console.log(\"Market:\", voteDetailsVelo.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsVelo.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsVelo.votes[i]);\n }\n console.log(\"Used Weight Velo:\", voteDetailsVelo.usedWeight);\n console.log(\"-----------------------------------------------------------------------------------------\");\n\n console.log(\"==================================Balancer LP Vote Details==================================:\");\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n console.log(\"===================VOTE====================\");\n console.log(\"Market:\", voteDetailsBalancer.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsBalancer.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsBalancer.votes[i]);\n }\n console.log(\"Used Weight Balancer:\", voteDetailsBalancer.usedWeight);\n\n vars.effectiveVotingPowerVelo = (vars.votingLPBalances[0] * vars.boosts[0]) / 1e18;\n vars.totalWeightVelo = vars.weights[0] + vars.weights[1];\n\n vars.effectiveVotingPowerBalancer = (vars.votingLPBalances[1] * vars.boosts[1]) / 1e18;\n vars.totalWeightBalancer = vars.weights[0] + vars.weights[1];\n\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n assertEq(voteDetailsVelo.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsVelo.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(voteDetailsVelo.votes[i], (vars.effectiveVotingPowerVelo * vars.weights[i]) / vars.totalWeightVelo);\n }\n\n assertApproxEqRel(\n voteDetailsVelo.usedWeight,\n vars.effectiveVotingPowerVelo,\n 0.001e18,\n \"Used weight should be all voting power\"\n );\n\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n assertEq(voteDetailsBalancer.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsBalancer.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetailsBalancer.votes[i],\n (vars.effectiveVotingPowerBalancer * vars.weights[i]) / vars.totalWeightBalancer\n );\n }\n\n assertApproxEqRel(\n voteDetailsBalancer.usedWeight,\n vars.effectiveVotingPowerBalancer,\n 0.001e18,\n \"Used weight should be all voting power\"\n );\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeVelodrome5050IonMode)),\n (vars.effectiveVotingPowerVelo * vars.weights[0]) / vars.totalWeightVelo,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeVelodrome5050IonMode)),\n (vars.effectiveVotingPowerVelo * vars.weights[1]) / vars.totalWeightVelo,\n \"Weight for BTC market should be 200\"\n );\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeBalancer8020IonEth)),\n (vars.effectiveVotingPowerBalancer * vars.weights[0]) / vars.totalWeightBalancer,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeBalancer8020IonEth)),\n (vars.effectiveVotingPowerBalancer * vars.weights[1]) / vars.totalWeightBalancer,\n \"Weight for BTC market should be 200\"\n );\n }\n\n function test_vote_VoteResetsAfterVotingForSameMarketsAgain() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.warp(block.timestamp + 14 * 86400);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 400;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 400;\n\n vm.startPrank(user);\n voter.reset(voterTokenIdMultiLp);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n vm.stopPrank();\n\n (, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory voteDetailsVelo = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n IVoter.VoteDetails memory voteDetailsBalancer = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n vars.effectiveVotingPowerVelo = (vars.votingLPBalances[0] * vars.boosts[0]) / 1e18;\n vars.totalWeightVelo = vars.weights[0] + vars.weights[1];\n\n vars.effectiveVotingPowerBalancer = (vars.votingLPBalances[1] * vars.boosts[1]) / 1e18;\n vars.totalWeightBalancer = vars.weights[0] + vars.weights[1];\n\n // Display vote details for Velodrome\n console.log(\"Velodrome Market Votes:\");\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n console.log(\"Market:\", voteDetailsVelo.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsVelo.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsVelo.votes[i]);\n assertEq(voteDetailsVelo.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsVelo.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(voteDetailsVelo.votes[i], (vars.effectiveVotingPowerVelo * vars.weights[i]) / vars.totalWeightVelo);\n }\n console.log(\"Used Weight for Velodrome:\", voteDetailsVelo.usedWeight);\n\n console.log(\"--------------------------------------------------------------\");\n // Display vote details for Balancer\n console.log(\"Balancer Market Votes:\");\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n console.log(\"Market:\", voteDetailsBalancer.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsBalancer.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsBalancer.votes[i]);\n\n assertEq(voteDetailsBalancer.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsBalancer.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetailsBalancer.votes[i],\n (vars.effectiveVotingPowerBalancer * vars.weights[i]) / vars.totalWeightBalancer\n );\n }\n console.log(\"Used Weight for Balancer:\", voteDetailsBalancer.usedWeight);\n }\n\n function test_vote_VoteThenDelegateShouldPokeAccordingly() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n address user2 = address(0x23512);\n LockInfo memory lockInfo2 = _createLockInternal(user2);\n\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n vm.prank(user2);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInfo2.tokenId);\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.prank(user2);\n voter.vote(lockInfo2.tokenId, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n IVoter.VoteDetails memory voteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n IVoter.VoteDetails memory voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 1\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 2\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"============================================================================\");\n\n vm.prank(user);\n IveION(ve).delegate(voterTokenIdMultiLp, lockInfo2.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n\n voteDetails = voter.getVoteDetails(voterTokenIdMultiLp, address(modeVelodrome5050IonMode));\n voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 3\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 4\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n\n assertEq(voteDetails.votes[0], 333333333333333333333, \"First market votes should be lower\");\n assertEq(voteDetails.votes[1], 666666666666666666666, \"Second market votes should be lower\");\n\n assertEq(voteDetails2.votes[0], 1000000000000000000000, \"First market votes should be higher\");\n assertEq(voteDetails2.votes[1], 2000000000000000000000, \"Second market votes should be higher\");\n\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = lockInfo2.tokenId;\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = type(uint256).max;\n\n vm.prank(user);\n IveION(ve).removeDelegatees(voterTokenIdMultiLp, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n // voter.poke(lockInfo2.tokenId);\n\n voteDetails = voter.getVoteDetails(voterTokenIdMultiLp, address(modeVelodrome5050IonMode));\n voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInfo2.tokenId\n );\n for (uint256 i; i < assets.length; i++) {\n console.log(\"Assets\", assets[i]);\n console.log(\"Balances\", balances[i]);\n console.log(\"Boosts\", boosts[i]);\n }\n\n // (assets, balances, boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n // for (uint256 i; i < assets.length; i++) {\n // console.log(\"Assets\", assets[i]);\n // console.log(\"Balances\", balances[i]);\n // console.log(\"Boosts\", boosts[i]);\n // }\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 5\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 6\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n\n assertEq(voteDetails.votes[0], 666666666666666666666, \"First market votes should be lower\");\n assertEq(voteDetails.votes[1], 1333333333333333333333, \"Second market votes should be lower\");\n\n assertEq(voteDetails2.votes[0], 666666666666666666666, \"First market votes should be higher\");\n assertEq(voteDetails2.votes[1], 1333333333333333333333, \"Second market votes should be higher\");\n }\n\n function test_vote_RevertIfSameEpoch() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 400;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 400;\n\n vm.startPrank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVotedOrDeposited()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n vm.stopPrank();\n }\n\n function test_vote_RevertIfDistributionWindow() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n uint256 epochNext = voter.epochNext(block.timestamp);\n vm.warp(epochNext);\n console.log(\"Current Timestamp:\", block.timestamp);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.warp(block.timestamp + 3601);\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_NotOwner() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfUnequalLengths() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](1); // Intentionally unequal length\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n // vars.marketVoteSide[1] is missing to create unequal lengths\n vars.weights[1] = 200;\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"UnequalLengths()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfTooManyPools() public {\n VoteLocalVars memory vars;\n\n // Set maxVotingNum to 10 for this test\n voter.setMaxVotingNum(10);\n\n vars.marketVote = new address[](11);\n vars.marketVoteSide = new IVoter.MarketSide[](11);\n vars.weights = new uint256[](11);\n\n for (uint256 i = 0; i < 11; i++) {\n vars.marketVote[i] = ethMarket;\n vars.marketVoteSide[i] = IVoter.MarketSide.Supply;\n vars.weights[i] = 100;\n }\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"TooManyPools()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfNotWhitelistedNFT() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vm.warp(IonicTimeLibrary.epochStart(block.timestamp) + 1 weeks - 0.75 hours);\n\n // Assume voterTokenIdSingleLp is not whitelisted\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotWhitelistedNFT()\"));\n voter.vote(voterTokenIdSingleLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfNoRewardAccumulator() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n // Use a market that does not have a reward accumulator set\n address nonExistentMarket = address(0xDEADBEEF);\n vars.marketVote[0] = nonExistentMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"RewardAccumulatorDoesNotExist(address)\", nonExistentMarket));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfRewardAccumulatorNotAlive() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n voter.toggleRewardAccumulatorAlive(vars.marketVote[0], vars.marketVoteSide[0], false);\n address accumulator = voter.marketToRewardAccumulators(vars.marketVote[0], vars.marketVoteSide[0]);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"RewardAccumulatorNotAlive(address)\", accumulator));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfZeroWeight() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 0; // Set weight to zero to trigger the revert\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroWeight()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n}\n" + }, + "contracts/test/veION/harness/veIONHarness.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\nimport \"../../../veION/veION.sol\";\n\n// This harness contract can be used for testing purposes.\ncontract veIONHarness is veION {\n constructor(uint256 _minimumLockDuration) {\n s_minimumLockDuration = _minimumLockDuration;\n }\n\n function exposed_calculateBoost(uint256 _duration) external view returns (uint256) {\n return _calculateBoost(_duration);\n }\n}\n" + }, + "contracts/test/veION/Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../config/BaseTest.t.sol\";\nimport \"../../veION/veION.sol\";\nimport \"../../veION/veIONFirstExtension.sol\";\nimport \"../../veION/veIONSecondExtension.sol\";\nimport \"../../veION/interfaces/IveION.sol\";\n// import \"../../veION/interfaces/IveIONCore.sol\";\nimport \"../../veION/stake/IStakeStrategy.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\nimport \"../../veION/stake/IStakeStrategy.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingWallet.sol\";\nimport \"../../veION/stake/velo/IVeloIonModeStaking.sol\";\nimport \"./harness/veIONHarness.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\ncontract veIONTest is BaseTest {\n using Strings for uint256;\n using Strings for bool;\n using Strings for address;\n\n address ve;\n address veFirstExtension;\n address veSecondExtension;\n MockERC20 modeVelodrome5050IonMode;\n MockERC20 modeBalancer8020IonEth;\n MockERC20 baseAerodrome5050IonWstEth;\n MockERC20 baseBalancer8020IonEth;\n MockERC20 optimismVelodrome5050IonOp;\n MockERC20 optimismBalancer8020IonEth;\n IveIONStructsEnumsErrorsEvents.LpTokenType veloLpType;\n IveIONStructsEnumsErrorsEvents.LpTokenType balancerLpType;\n VeloAeroStakingWallet veloStakingWalletImplementation;\n veIONHarness harness;\n\n address ionMode5050LP;\n address ionWeth5050lPAero;\n address wethAero5050LPAero;\n address veloGauge;\n VeloAeroStakingStrategy veloIonModeStakingStrategy;\n VeloAeroStakingStrategy veloWethUsdcStakingStrategy;\n address stakingWalletInstance;\n uint256 stakingWalletInstanceBalance;\n\n address wethUSDC5050LP;\n address wethUSDCGauge;\n\n // Base Fork Vars\n address baseUser;\n uint256 baseTokenIdSingleLp;\n\n uint256 internal constant MINT_AMT = 1000 ether;\n uint256 internal constant WEEK = 1 weeks;\n uint256 internal constant MAXTIME = 2 * 365 * 86400;\n uint256 internal constant MINTIME = 180 * 86400;\n uint256 internal constant EARLY_WITHDRAW_FEE = 0.8e18;\n uint256 internal constant MINIMUM_LOCK_AMOUNT = 10e18;\n uint256 internal constant REAL_LP_LOCK_AMOUNT = 10e18;\n\n function _setUp() internal virtual {\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n modeVelodrome5050IonMode = new MockERC20(\"Mode_Velodrome_5050_ION_MODE\", \"MV5050\", 18);\n modeBalancer8020IonEth = new MockERC20(\"Mode_Balancer_8020_ION_ETH\", \"MB8020\", 18);\n\n harness = new veIONHarness(MINTIME);\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n\n whitelistedTokens[0] = address(modeVelodrome5050IonMode);\n whitelistedTokens[1] = address(modeBalancer8020IonEth);\n\n for (uint i = 0; i < 2; i++) {\n isWhitelistedTokens[i] = true;\n }\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n\n IveION(ve).setLpTokenType(\n address(modeVelodrome5050IonMode),\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE\n );\n IveION(ve).setLpTokenType(\n address(modeBalancer8020IonEth),\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH\n );\n\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\n\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(modeVelodrome5050IonMode), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(modeBalancer8020IonEth), MINIMUM_LOCK_AMOUNT);\n }\n\n function _afterForkSetUpMode() internal {\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n ionMode5050LP = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n wethUSDC5050LP = 0x283bA4E204DFcB6381BCBf2cb5d0e765A2B57bC2;\n wethUSDCGauge = 0x98d34C7b004688F35b67Aa30D4dF5E67113f6B3D;\n\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n veloWethUsdcStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n wethUSDC5050LP,\n wethUSDCGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n whitelistedTokens[0] = ionMode5050LP;\n isWhitelistedTokens[0] = true;\n whitelistedTokens[1] = wethUSDC5050LP;\n isWhitelistedTokens[1] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n IveION(ve).setLpTokenType(wethUSDC5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH);\n\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n IveION(ve).setStakeStrategy(balancerLpType, IStakeStrategy(veloWethUsdcStakingStrategy));\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(ionMode5050LP), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(wethUSDC5050LP), MINIMUM_LOCK_AMOUNT);\n }\n\n function _afterForkSetUpBase() internal {\n baseUser = address(0x987);\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n harness = new veIONHarness(MINTIME);\n\n ionWeth5050lPAero = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n wethAero5050LPAero = 0x7f670f78B17dEC44d5Ef68a48740b6f8849cc2e6;\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n whitelistedTokens[0] = ionWeth5050lPAero;\n isWhitelistedTokens[0] = true;\n whitelistedTokens[1] = wethAero5050LPAero;\n isWhitelistedTokens[1] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(\n ionWeth5050lPAero,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Aerodrome_5050_ION_wstETH\n );\n IveION(ve).setLpTokenType(\n wethAero5050LPAero,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Balancer_8020_ION_ETH\n );\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(ionWeth5050lPAero), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(wethAero5050LPAero), MINIMUM_LOCK_AMOUNT);\n }\n\n function _lockSingleLPFork(address _user, uint256 _amount) internal returns (uint256) {\n address whale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\n vm.prank(whale);\n IERC20(ionWeth5050lPAero).transfer(_user, _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(ionWeth5050lPAero);\n tokenAmounts[0] = _amount;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = false;\n\n vm.startPrank(_user);\n IERC20(ionWeth5050lPAero).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return tokenId;\n }\n\n function _lockMultiLpFork(address _user, uint256 _amountIonWeth, uint256 _amountWethAERO) internal returns (uint256) {\n address ionWethWhale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\n address wethAEROWhale = 0x96a24aB830D4ec8b1F6f04Ceac104F1A3b211a01;\n\n vm.prank(ionWethWhale);\n IERC20(ionWeth5050lPAero).transfer(_user, _amountIonWeth);\n vm.prank(wethAEROWhale);\n IERC20(wethAero5050LPAero).transfer(_user, _amountWethAERO);\n\n address[] memory tokenAddresses = new address[](2);\n uint256[] memory tokenAmounts = new uint256[](2);\n uint256[] memory durations = new uint256[](2);\n bool[] memory stakeUnderlying = new bool[](2);\n tokenAddresses[0] = address(ionWeth5050lPAero);\n tokenAmounts[0] = _amountIonWeth;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = false;\n tokenAddresses[1] = address(wethAero5050LPAero);\n tokenAmounts[1] = _amountWethAERO;\n durations[1] = 52 weeks;\n stakeUnderlying[1] = false;\n\n vm.startPrank(_user);\n IERC20(ionWeth5050lPAero).approve(address(ve), _amountIonWeth);\n IERC20(wethAero5050LPAero).approve(address(ve), _amountWethAERO);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return tokenId;\n }\n\n function _createLockInternal(address user) internal returns (LockInfo memory) {\n TestVars memory vars;\n vars.user = user;\n vars.amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\n\n vm.startPrank(vars.user);\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\n vm.stopPrank();\n\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vm.startPrank(vars.user);\n uint256 tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](1));\n vm.stopPrank();\n\n return LockInfo(tokenId, vars.tokenAddresses[0], vars.tokenAmounts[0], vars.durations[0]);\n }\n\n function _createLockMultipleInternal(address user) internal returns (LockInfoMultiple memory) {\n TestVars memory vars;\n vars.user = user;\n\n vars.amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\n modeBalancer8020IonEth.mint(vars.user, vars.amount);\n\n vm.startPrank(vars.user);\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\n modeBalancer8020IonEth.approve(address(ve), vars.amount);\n vm.stopPrank();\n\n vars.tokenAddresses = new address[](2);\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\n vars.tokenAddresses[1] = address(modeBalancer8020IonEth);\n\n vars.tokenAmounts = new uint256[](2);\n vars.tokenAmounts[0] = vars.amount;\n vars.tokenAmounts[1] = vars.amount;\n\n vars.durations = new uint256[](2);\n vars.durations[0] = 52 weeks;\n vars.durations[1] = 52 weeks;\n\n vm.startPrank(vars.user);\n vars.tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](2));\n vm.stopPrank();\n\n return LockInfoMultiple(vars.tokenId, vars.tokenAddresses, vars.tokenAmounts, vars.durations);\n }\n\n function _createLockInternalRealLP(address _user, bool _stakeUnderlying) internal returns (LockInfo memory) {\n uint256 amountStaked = REAL_LP_LOCK_AMOUNT;\n address whale = 0x8ff8b21a0736738b25597D32d8f7cf658f39f157;\n vm.prank(whale);\n IERC20(ionMode5050LP).transfer(_user, amountStaked);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(ionMode5050LP);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amountStaked;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n bool[] memory stakeUnderlying = new bool[](1);\n stakeUnderlying[0] = _stakeUnderlying;\n\n vm.startPrank(_user);\n IERC20(ionMode5050LP).approve(address(ve), amountStaked);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return LockInfo(tokenId, tokenAddresses[0], tokenAmounts[0], durations[0]);\n }\n\n function _generateRandomAddress(uint256 seed) internal pure returns (address) {\n return address(uint160(uint256(keccak256(abi.encodePacked(seed)))));\n }\n\n function _logTokens(uint256[] memory tokenIds, address[] memory lpTokens) internal view {\n for (uint256 i = 0; i < tokenIds.length; i++) {\n for (uint256 j = 0; j < lpTokens.length; j++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n tokenIds[i],\n IveION(ve).s_lpType(lpTokens[j])\n );\n uint256 tokenId = i + 1;\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Token: \", lock.tokenAddress.toHexString()))\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Amount: \", lock.amount.toString()))\n );\n console.log(\n string(\n abi.encodePacked(\n \"Token ID \",\n tokenId.toString(),\n \" Locked Delegate Amount: \",\n lock.delegateAmount.toString()\n )\n )\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Start: \", lock.start.toString()))\n );\n console.log(string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked End: \", lock.end.toString())));\n console.log(\n string(\n abi.encodePacked(\n \"Token ID \",\n tokenId.toString(),\n \" Locked IsPermanent: \",\n lock.isPermanent ? \"true\" : \"false\"\n )\n )\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Boost: \", lock.boost.toString()))\n );\n console.log(\"--------------------------------------------------\");\n }\n console.log(\"====================================================\");\n }\n }\n\n function _logCumulativeAssetValues(address[] memory users, address[] memory lpTokens) internal view {\n console.log(\"-----------------------------------------------------------------\");\n for (uint256 i = 0; i < users.length; i++) {\n address user = users[i];\n console.log(\"Cumulative Asset Values for User:\", user);\n for (uint256 j = 0; j < lpTokens.length; j++) {\n console.log(\"Token:\", lpTokens[j], \"Value:\", IveION(ve).s_userCumulativeAssetValues(user, lpTokens[j]));\n }\n console.log(\"====================================================\");\n }\n }\n\n function _logUnderlyingStake(address[] memory users) internal view {\n console.log(\"-----------------------------------------------------------------\");\n for (uint256 i = 0; i < users.length; i++) {\n address user = users[i];\n console.log(\"Underlying Stakes For:\", user);\n address stakingWalletInstanceIonMode = veloIonModeStakingStrategy.userStakingWallet(user);\n uint256 stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n\n address stakingWalletInstanceWethUsdc = veloWethUsdcStakingStrategy.userStakingWallet(user);\n uint256 stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n console.log(\"Staked Balance Ion-Mode:\", stakedBalanceIonMode);\n console.log(\"Staked Balance Weth-Usdc:\", stakedBalanceWethUsdc);\n console.log(\"====================================================\");\n }\n }\n}\n\nstruct TestVars {\n address user;\n address user2;\n uint256 amount;\n address[] tokenAddresses;\n uint256[] tokenAmounts;\n uint256[] durations;\n bool[] stakeUnderlying;\n uint256 tokenId;\n uint256 secondTokenId;\n uint256 expectedSupply;\n uint256 userEpoch;\n uint256 globalEpoch;\n address lockedBalance_tokenAddress;\n uint256 lockedBalance_amount;\n uint256 delegated_lockedBalance_amount;\n uint256 lockedBalance_start;\n uint256 lockedBalance_end;\n bool lockedBalance_isPermanent;\n uint256 lockedBalance_boost;\n uint256 userPoint_bias;\n uint256 userPoint_slope;\n uint256 userPoint_ts;\n uint256 userPoint_blk;\n uint256 userPoint_permanent;\n uint256 userPoint_permanentDelegate;\n int128 globalPoint_bias;\n int128 globalPoint_slope;\n uint256 globalPoint_ts;\n uint256 globalPoint_blk;\n uint256 globalPoint_permanentLockBalance;\n uint256[] ownerTokenIds;\n address[] assetsLocked;\n uint256 tokenId_test;\n address lockedBalance_tokenAddress_test;\n uint256 lockedBalance_amount_test;\n uint256 lockedBalance_duration_test;\n uint256 lockedBalance_end_test;\n}\n\nstruct LockInfo {\n uint256 tokenId;\n address tokenAddress;\n uint256 tokenAmount;\n uint256 duration;\n}\n\nstruct LockInfoMultiple {\n uint256 tokenId;\n address[] tokenAddresses;\n uint256[] tokenAmounts;\n uint256[] durations;\n}\n\nstruct AeroBoostVars {\n uint256 aeroVoterBoost;\n address aeroVotingAddress;\n address ionicPoolAddress;\n address veAEROAddress;\n address AERO;\n uint256 lockAmount;\n address aeroWhale;\n uint256 veAeroTokenId;\n address[] poolVote;\n uint256[] weights;\n}\n\ninterface IveAERO {\n /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration`\n /// @param _value Amount to deposit\n /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week)\n /// @return TokenId of created veNFT\n function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256);\n}\n\ninterface IAEROVoter {\n /// @notice Called by users to vote for pools. Votes distributed proportionally based on weights.\n /// Can only vote or deposit into a managed NFT once per epoch.\n /// Can only vote for gauges that have not been killed.\n /// @dev Weights are distributed proportional to the sum of the weights in the array.\n /// Throws if length of _poolVote and _weights do not match.\n /// @param _tokenId Id of veNFT you are voting with.\n /// @param _poolVote Array of pools you are voting for.\n /// @param _weights Weights of pools.\n function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external;\n\n /// @notice Returns the number of votes for a given veNFT token ID and pool address.\n /// @param _tokenId The ID of the veNFT.\n /// @param _pool The address of the pool.\n /// @return The number of votes for the given token ID and pool.\n function votes(uint256 _tokenId, address _pool) external view returns (uint256);\n}\n" + }, + "contracts/utils/IMulticall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\n/// @title Multicall interface\n/// @notice Enables calling multiple methods in a single call to the contract\ninterface IMulticall {\n /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed\n /// @dev The `msg.value` should not be trusted for any method callable from multicall.\n /// @param data The encoded function data for each of the calls to make to this contract\n /// @return results The results from each of the calls passed in via data\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n}\n" + }, + "contracts/utils/IW_NATIVE.sol": { + "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity >=0.8.0;\n\ninterface IW_NATIVE {\n function deposit() external payable;\n\n function withdraw(uint256 amount) external;\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/utils/Multicall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\nimport \"./IMulticall.sol\";\n\n/// @title Multicall\n/// @notice Enables calling multiple methods in a single call to the contract\nabstract contract Multicall is IMulticall {\n /// @inheritdoc IMulticall\n function multicall(bytes[] calldata data) public payable virtual override returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n\n if (!success) {\n // Next 5 lines from https://ethereum.stackexchange.com/a/83577\n if (result.length < 68) revert();\n assembly {\n result := add(result, 0x04)\n }\n revert(abi.decode(result, (string)));\n }\n\n results[i] = result;\n }\n }\n}\n" + }, + "contracts/veION/BribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\n\n/**\n * @title BribeRewards Contract\n * @notice This contract allows veION to benefit from bribes when voting for various markets\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Duration of the reward period in seconds\n uint256 public constant DURATION = 7 days;\n /// @notice Address of the voter contract\n address public voter;\n /// @notice Address of the veION contract\n address public ve;\n /// @notice List of reward tokens\n address[] public rewards;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Mapping to check if an address is a reward token\n mapping(address => bool) public isReward;\n /// @notice Total supply of LP tokens for each reward token\n mapping(address => uint256) public totalSupply;\n /// @notice Balance of LP tokens for each tokenId and reward token\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\n /// @notice Rewards per epoch for each reward token\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\n /// @notice Last earned timestamp for each reward token and tokenId\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\n /// @notice A record of balance checkpoints for each account, by index\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\n /// @notice The number of checkpoints for each account\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\n /// @notice A record of balance checkpoints for each token, by index\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\n /// @notice The number of supply checkpoints for each token\n mapping(address => uint256) public supplyNumCheckpoints;\n /// @notice Historical prices for each reward token and epoch\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\n\n /**\n * @notice Modifier to restrict access to only the voter contract\n * @dev Ensures that the caller is the voter contract\n */\n modifier onlyVoter() {\n require(msg.sender == voter, \"Caller is not the voter\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\n * @dev This function is called only once during contract deployment\n * @param _voter The address of the voter contract\n * @param _ve The address of the veION contract\n */\n function initialize(address _voter, address _ve) public initializer {\n __ReentrancyGuard_init();\n __Ownable2Step_init();\n voter = _voter;\n ve = _ve;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IBribeRewards\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\n address sender = msg.sender;\n\n totalSupply[lpToken] += amount;\n balanceOf[tokenId][lpToken] += amount;\n\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\n _writeSupplyCheckpoint(lpToken);\n\n emit Deposit(sender, tokenId, amount);\n }\n\n /// @inheritdoc IBribeRewards\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\n address sender = msg.sender;\n\n totalSupply[lpToken] -= amount;\n balanceOf[tokenId][lpToken] -= amount;\n\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\n _writeSupplyCheckpoint(lpToken);\n\n emit Withdraw(sender, tokenId, amount);\n }\n\n /**\n * @inheritdoc IBribeRewards\n * @notice This function can accept any token, regardless of its whitelisting status.\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\n */\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\n address sender = msg.sender;\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\n\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\n _getReward(_owner, tokenId, tokens);\n }\n\n /// @inheritdoc IBribeRewards\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\n address sender = msg.sender;\n\n if (!isReward[token]) {\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\n isReward[token] = true;\n rewards.push(token);\n }\n\n _notifyRewardAmount(sender, token, amount);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @dev used with all getReward implementations\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\n // check if token whitelisted\n uint256 _length = tokens.length;\n for (uint256 i = 0; i < _length; i++) {\n uint256 _reward = earned(tokens[i], tokenId);\n lastEarn[tokens[i]][tokenId] = block.timestamp;\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\n\n emit RewardsClaimed(recipient, tokens[i], _reward);\n }\n }\n\n /**\n * @notice Writes a new checkpoint for a token's balance\n * @param tokenId The ID of the veION token\n * @param lpToken The LP token address\n * @param balance The balance to record\n */\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\n uint256 _timestamp = block.timestamp;\n\n if (\n _nCheckPoints > 0 &&\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\n IonicTimeLibrary.epochStart(_timestamp)\n ) {\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\n } else {\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\n }\n }\n\n /// @notice Writes a new checkpoint for total supply\n /// @param lpToken The LP token address\n function _writeSupplyCheckpoint(address lpToken) internal {\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\n uint256 _timestamp = block.timestamp;\n\n if (\n _nCheckPoints > 0 &&\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\n IonicTimeLibrary.epochStart(_timestamp)\n ) {\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\n } else {\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\n }\n }\n\n /// @dev used within all notifyRewardAmount implementations\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\n if (amount == 0) revert AmountCannotBeZero();\n IERC20(token).safeTransferFrom(sender, address(this), amount);\n\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\n tokenRewardsPerEpoch[token][epochStart] += amount;\n\n emit RewardNotification(sender, token, epochStart, amount);\n }\n\n /**\n * @notice Calculates the ETH value of a token amount at a specific epoch\n * @param amount The amount of tokens\n * @param lpToken The LP token address\n * @param epochTimestamp The timestamp of the epoch\n * @return The ETH value of the tokens\n */\n function _getTokenEthValueAt(\n uint256 amount,\n address lpToken,\n uint256 epochTimestamp\n ) internal view returns (uint256) {\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\n return ethValue;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Pure/View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @notice Returns the total number of reward tokens\n /// @return The length of the rewards array\n function rewardsListLength() external view returns (uint256) {\n return rewards.length;\n }\n\n /// @inheritdoc IBribeRewards\n function earned(address token, uint256 tokenId) public view returns (uint256) {\n EarnedVars memory vars;\n vars.totalReward = 0;\n address[] memory lpTokens = getAllLpRewardTokens();\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 j = 0; j < lpTokensLength; j++) {\n address lpToken = lpTokens[j];\n\n if (numCheckpoints[tokenId][lpToken] == 0) {\n continue;\n }\n\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\n\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\n\n if (vars.numEpochs > 0) {\n for (uint256 i = 0; i < vars.numEpochs; i++) {\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\n cp0 = checkpoints[tokenId][lpToken][vars.index];\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\n\n vars.supplyValue = 0;\n for (uint256 k = 0; k < lpTokensLength; k++) {\n address currentLpToken = lpTokens[k];\n uint256 supplyAmount = Math.max(\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\n 1\n );\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\n }\n if (vars.supplyValue > 0) {\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\n }\n vars.currTs += DURATION;\n }\n }\n }\n\n return vars.totalReward;\n }\n\n /// @notice Gets all LP tokens that can receive rewards\n /// @return Array of LP token addresses\n function getAllLpRewardTokens() public view returns (address[] memory) {\n return IVoter(voter).getAllLpRewardTokens();\n }\n\n /**\n * @notice Sets historical prices for LP tokens at specific epochs\n * @param epochTimestamp The timestamp of the epoch\n * @param lpToken The LP token address\n * @param price The price to set\n */\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\n historicalPrices[lpToken][epochStart] = price;\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\n }\n\n /**\n * @notice Gets a specific checkpoint for a token\n * @param tokenId The ID of the veION token\n * @param lpToken The LP token address\n * @param index The index of the checkpoint to retrieve\n * @return The checkpoint data\n */\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\n return checkpoints[tokenId][lpToken][index];\n }\n\n /// @inheritdoc IBribeRewards\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\n return (nCheckpoints - 1);\n }\n\n // Next check implicit zero balance\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\n return 0;\n }\n\n uint256 lower = 0;\n uint256 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\n if (cp.timestamp == timestamp) {\n return center;\n } else if (cp.timestamp < timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n\n /// @inheritdoc IBribeRewards\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\n return (nCheckpoints - 1);\n }\n\n // Next check implicit zero balance\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\n return 0;\n }\n\n uint256 lower = 0;\n uint256 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\n if (cp.timestamp == timestamp) {\n return center;\n } else if (cp.timestamp < timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n}\n" + }, + "contracts/veION/interfaces/IBribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IBribeRewards {\n /// @notice A checkpoint for marking balance\n struct Checkpoint {\n uint256 timestamp;\n uint256 balanceOf;\n }\n\n /// @notice A checkpoint for marking supply\n struct SupplyCheckpoint {\n uint256 timestamp;\n uint256 supply;\n }\n\n struct EarnedVars {\n uint256 totalReward;\n uint256 reward;\n uint256 supplyValue;\n uint256 epochBalanceValue;\n uint256 currTs;\n uint256 index;\n uint256 numEpochs;\n uint256 overallBalance;\n uint256 overallSupply;\n uint256 historicalPrice;\n }\n\n error InvalidReward();\n error Unauthorized();\n error InvalidGauge();\n error InvalidEscrowToken();\n error SingleTokenExpected();\n error InvalidVotingEscrow();\n error TokenNotWhitelisted();\n error AmountCannotBeZero();\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\n\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\n\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\n /// @dev Can only be called internally by authorized entities.\n /// @param lpToken Address of the liquidity pool token\n /// @param amount Amount to be deposited for the veNFT\n /// @param tokenId Unique identifier of the veNFT\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\n\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\n /// @dev Can only be called internally by authorized entities.\n /// @param lpToken Address of the liquidity pool token\n /// @param amount Amount to be withdrawn for the veNFT\n /// @param tokenId Unique identifier of the veNFT\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\n\n /// @notice Claim the rewards earned by a veNFT holder\n /// @param tokenId Unique identifier of the veNFT\n /// @param tokens Array of tokens to claim rewards for\n function getReward(uint256 tokenId, address[] memory tokens) external;\n\n /// @notice Notify the contract about new rewards for stakers\n /// @param token Address of the reward token\n /// @param amount Amount of the reward token to be added\n function notifyRewardAmount(address token, uint256 amount) external;\n\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\n /// @dev Timestamp must be in the past or present.\n /// @param tokenId The veNFT token ID to check\n /// @param lpToken Address of the liquidity pool token\n /// @param timestamp The timestamp to get the balance at\n /// @return The balance index at the given timestamp\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\n\n /// @notice Get the prior supply index at a specific timestamp\n /// @dev Timestamp must be in the past or present.\n /// @param timestamp The timestamp to get the supply index at\n /// @return The supply index at the given timestamp\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\n\n /// @notice Calculate the rewards earned for a specific token and veNFT\n /// @param token Address of the reward token\n /// @param tokenId Unique identifier of the veNFT\n /// @return Amount of the reward token earned\n function earned(address token, uint256 tokenId) external view returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport \"./IveIONCore.sol\";\nimport \"./IveIONFirstExtension.sol\";\nimport \"./IveIONSecondExtension.sol\";\n\n/// @title IveION Interface\n/// @notice Interface for veION contract\ninterface IveION is IveIONStructsEnumsErrorsEvents, IveIONCore, IveIONFirstExtension, IveIONSecondExtension {\n // Constants\n function PRECISION() external view returns (uint256);\n\n // State Variables\n function s_tokenId() external view returns (uint256);\n function s_limitedBoost() external view returns (uint256);\n function s_limitedBoostActive() external view returns (bool);\n function s_veAERO() external view returns (address);\n function s_aeroVoting() external view returns (address);\n function s_ionicPool() external view returns (address);\n function s_voter() external view returns (address);\n function s_aeroVoterBoost() external view returns (uint256);\n function s_minimumLockDuration() external view returns (uint256);\n function s_maxEarlyWithdrawFee() external view returns (uint256);\n function ap() external view returns (address);\n function implementation() external view returns (address);\n\n // Mappings\n function s_minimumLockAmount(LpTokenType lpTokenType) external view returns (uint256);\n function s_whitelistedToken(address token) external view returns (bool);\n function s_lpType(address token) external view returns (LpTokenType);\n function s_canSplit(address user) external view returns (bool);\n function s_locked(uint256 tokenId, LpTokenType lpTokenType) external view returns (LockedBalance memory);\n function s_userPointEpoch(uint256 tokenId, LpTokenType lpTokenType) external view returns (uint256);\n function s_userPointHistory(\n uint256 tokenId,\n LpTokenType lpTokenType,\n uint256 epoch\n ) external view returns (UserPoint memory);\n function s_voted(uint256 tokenId) external view returns (bool);\n function s_supply(LpTokenType lpTokenType) external view returns (uint256);\n function s_permanentLockBalance(LpTokenType lpTokenType) external view returns (uint256);\n function s_stakeStrategy(LpTokenType lpTokenType) external view returns (address);\n function s_underlyingStake(uint256 tokenId, address token) external view returns (uint256);\n function s_protocolFees(LpTokenType lpTokenType) external view returns (uint256);\n function s_distributedFees(LpTokenType lpTokenType) external view returns (uint256);\n function s_delegations(\n uint256 delegatorTokenId,\n uint256 delegateeTokenId,\n LpTokenType lpTokenType\n ) external view returns (uint256);\n function s_userCumulativeAssetValues(address user, address token) external view returns (uint256);\n function s_delegatorsBlocked(uint256 tokenId, address token) external view returns (bool);\n\n // Openzeppelin functions\n function transferFrom(address from, address to, uint256 tokenId) external;\n function ownerOf(uint256 tokenId) external returns (address);\n function owner() external returns (address);\n function balanceOf(address owner) external returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveIONCore.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\n\n/// @title IveION Interface\n/// @notice Interface for veION contract\ninterface IveIONCore {\n /**\n * @notice Creates a new lock for multiple tokens and assigns it to a specified address\n * @param _tokenAddress Array of token addresses to lock\n * @param _tokenAmount Array of token amounts to lock\n * @param _duration Array of lock durations\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\n * @param _to Address to assign the lock to\n * @return The ID of the newly created veNFT\n */\n function createLockFor(\n address[] memory _tokenAddress,\n uint256[] memory _tokenAmount,\n uint256[] memory _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) external returns (uint256);\n\n /**\n * @notice Creates a new lock for multiple tokens\n * @param _tokenAddress Array of token addresses to lock\n * @param _tokenAmount Array of token amounts to lock\n * @param _duration Array of lock durations\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\n * @return The ID of the newly created veNFT\n */\n function createLock(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying\n ) external returns (uint256);\n\n /**\n * @notice Increases the amount of tokens locked for a specific veNFT\n * @param _tokenAddress Address of the token to increase lock amount for\n * @param _tokenId ID of the veNFT\n * @param _tokenAmount Amount of tokens to add to the lock\n * @param _stakeUnderlying Whether to stake the underlying tokens\n */\n function increaseAmount(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n bool _stakeUnderlying\n ) external;\n\n /**\n * @notice Locks additional asset type for an existing veNFT\n * @param _tokenAddress Address of the new token to lock\n * @param _tokenAmount Amount of tokens to lock\n * @param _tokenId ID of the veNFT\n * @param _duration Duration of the lock\n * @param _stakeUnderlying Whether to stake the underlying tokens\n */\n function lockAdditionalAsset(\n address _tokenAddress,\n uint256 _tokenAmount,\n uint256 _tokenId,\n uint256 _duration,\n bool _stakeUnderlying\n ) external;\n\n /**\n * @notice Increases the lock duration for a specific token in a veNFT\n * @param _tokenAddress Address of the token\n * @param _tokenId ID of the veNFT\n * @param _lockDuration New lock duration to extend to\n */\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external;\n\n /**\n * @notice Delegates voting power from one veNFT to another.\n * @param fromTokenId The ID of the veNFT from which voting power is delegated.\n * @param toTokenId The ID of the veNFT to which voting power is delegated.\n * @param lpToken The address of the LP token associated with the delegation.\n * @param amount The amount of voting power to delegate.\n */\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external;\n\n /**\n * @notice Removes delegatees from a specific veNFT\n * @param fromTokenId ID of the veNFT from which delegatees are removed\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegatee\n */\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) external;\n\n /**\n * @notice Removes delegators from a specific veNFT\n * @param fromTokenIds Array of veNFT IDs that are delegators to be removed\n * @param toTokenId ID of the veNFT from which delegators are removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegator\n */\n function removeDelegators(\n uint256[] memory fromTokenIds,\n uint256 toTokenId,\n address lpToken,\n uint256[] memory amounts\n ) external;\n\n /**\n * @notice Locks a token permanently.\n * @param _tokenAddress The address of the token to lock.\n * @param _tokenId The ID of the token to lock.\n */\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Unlocks a permanently locked token.\n * @param _tokenAddress The address of the token to unlock.\n * @param _tokenId The ID of the token to unlock.\n */\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Updates voting status for a veNFT\n * @param _tokenId ID of the veNFT\n * @param _voting Voting status\n */\n function voting(uint256 _tokenId, bool _voting) external;\n\n /**\n * @notice Sets the implementation addresses for the veION contract extensions.\n * @dev This function can only be called by authorized entities.\n * @param _veIONFirstExtension The address of the first extension contract.\n * @param _veIONSecondExtension The address of the second extension contract.\n */\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external;\n}\n\n/// @title IAeroVotingEscrow Interface\n/// @notice Interface for Aero Voting Escrow contract\ninterface IAeroVotingEscrow {\n /**\n * @notice Returns the balance of the specified owner.\n * @param _owner The address of the owner.\n * @return The balance of the owner.\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Retrieves the token ID at a specific index for a given owner.\n * @param _owner The address of the owner.\n * @param _index The index of the token ID in the owner's list.\n * @return The token ID at the specified index.\n */\n function ownerToNFTokenIdList(address _owner, uint256 _index) external view returns (uint256);\n}\n\n/// @title IAeroVoter Interface\n/// @notice Interface for Aero Voter contract\ninterface IAeroVoter {\n /**\n * @notice Returns the list of pools voted for by a specific token ID.\n * @param tokenId The ID of the token.\n * @return An array of addresses representing the pools voted for.\n */\n function poolVote(uint256 tokenId) external view returns (address[] memory);\n\n /**\n * @notice Retrieves the weight of a specific pool.\n * @param pool The address of the pool.\n * @return The weight of the pool.\n */\n function weights(address pool) external view returns (uint256);\n\n /**\n * @notice Returns the number of votes a specific token ID has for a given pool.\n * @param tokenId The ID of the token.\n * @param pool The address of the pool.\n * @return The number of votes for the pool.\n */\n function votes(uint256 tokenId, address pool) external view returns (uint256);\n}\n\ninterface IAddressesProvider {\n function getAddress(string calldata id) external view returns (address);\n}\n\ninterface IMasterPriceOracle {\n function price(address underlying) external view returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\n\n/// @title IveION Interface First Extensions\n/// @notice Interface for veION contract\ninterface IveIONFirstExtension is IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Withdraws tokens associated with a specific token ID.\n * @param _tokenAddress The address of the token to withdraw.\n * @param _tokenId The ID of the token to withdraw.\n */\n function withdraw(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Merges two token IDs into one.\n * @param _from The ID of the token to merge from.\n * @param _to The ID of the token to merge into.\n */\n function merge(uint256 _from, uint256 _to) external;\n\n /**\n * @notice Splits a token into two separate tokens.\n * @param _tokenAddress The address of the token to split.\n * @param _from The ID of the token to split.\n * @param _splitAmount The amount to split from the original token.\n * @return _tokenId1 The ID of the first resulting token.\n * @return _tokenId2 The ID of the second resulting token.\n */\n function split(\n address _tokenAddress,\n uint256 _from,\n uint256 _splitAmount\n ) external returns (uint256 _tokenId1, uint256 _tokenId2);\n\n /**\n * @notice Claims emissions for a specific token.\n * @param _tokenAddress The address of the token for which to claim emissions.\n */\n function claimEmissions(address _tokenAddress) external;\n\n /**\n * @notice Allows or blocks delegators for a specific token ID.\n * @param _tokenId The ID of the token.\n * @param _tokenAddress The address of the token.\n * @param _blocked Boolean indicating if delegators are blocked.\n */\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external;\n\n /**\n * @notice Retrieves the balance of a specific NFT.\n * @param _tokenId The ID of the NFT.\n * @return _assets An array of asset addresses.\n * @return _balances An array of balances for each asset.\n * @return _boosts An array of boost values for each asset.\n */\n function balanceOfNFT(\n uint256 _tokenId\n ) external view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts);\n\n /**\n * @notice Retrieves the total ETH value of tokens owned by a specific address.\n * @param _owner The address of the owner.\n * @return totalValue The total ETH value of the tokens.\n */\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue);\n}\n" + }, + "contracts/veION/interfaces/IveIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\n\n/// @title IveION Interface Second Extension\n/// @notice Interface for veION contract\ninterface IveIONSecondExtension is IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Whitelists or removes tokens from the whitelist.\n * @param _tokens An array of token addresses to be whitelisted or removed.\n * @param _isWhitelisted An array of booleans indicating the whitelist status for each token.\n */\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external;\n\n /**\n * @notice Withdraws protocol fees for a specific token to a recipient address.\n * @param _tokenAddress The address of the token for which protocol fees are to be withdrawn.\n * @param _recipient The address to which the protocol fees will be sent.\n */\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external;\n\n /**\n * @notice Withdraws distributed fees for a specific token to a recipient address.\n * @param _tokenAddress The address of the token for which distributed fees are to be withdrawn.\n * @param _recipient The address to which the distributed fees will be sent.\n */\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external;\n\n /**\n * @notice Toggles the ability to split tokens for a specific account.\n * @param _account The address of the account.\n * @param _isAllowed Boolean indicating if splitting is allowed.\n */\n function toggleSplit(address _account, bool _isAllowed) external;\n\n /**\n * @notice Toggles the limited boost feature.\n * @param _isBoosted Boolean indicating if the boost is active.\n */\n function toggleLimitedBoost(bool _isBoosted) external;\n\n /**\n * @notice Sets the amount for a limited time boost.\n * @param _boostAmount The amount of the boost.\n */\n function setLimitedTimeBoost(uint256 _boostAmount) external;\n\n /**\n * @notice Sets the address of the voter.\n * @param _voter The address of the voter.\n */\n function setVoter(address _voter) external;\n\n /**\n * @notice Sets the minimum lock amount for a specific token.\n * @param _tokenAddress The address of the token.\n * @param _minimumAmount The minimum amount to lock.\n */\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external;\n\n /**\n * @notice Sets the minimum lock duration.\n * @param _minimumLockDuration The minimum duration for locking.\n */\n function setMinimumLockDuration(uint256 _minimumLockDuration) external;\n\n /**\n * @notice Sets the address of the Ionic Pool.\n * @param _ionicPool The address of the Ionic Pool.\n */\n function setIonicPool(address _ionicPool) external;\n\n /**\n * @notice Sets the address of the Aero Voting contract.\n * @param _aeroVoting The address of the Aero Voting contract.\n */\n function setAeroVoting(address _aeroVoting) external;\n\n /**\n * @notice Sets the boost amount for Aero Voter.\n * @param _aeroVoterBoost The boost amount for Aero Voter.\n */\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external;\n\n /**\n * @notice Sets the maximum early withdrawal fee.\n * @param _maxEarlyWithdrawFee The maximum fee for early withdrawal.\n */\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external;\n\n /**\n * @notice Sets the LP token type for a specific token.\n * @param _token The address of the token.\n * @param _type The LP token type.\n */\n function setLpTokenType(address _token, LpTokenType _type) external;\n\n /**\n * @notice Sets the stake strategy for a specific LP token type.\n * @param _lpType The LP token type.\n * @param _strategy The stake strategy.\n */\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external;\n\n /**\n * @notice Sets the address of the veAERO contract.\n * @param _veAERO The address of the veAERO contract.\n */\n function setVeAERO(address _veAERO) external;\n\n /**\n * @notice Retrieves the lock information for a specific user.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return A LockedBalance struct containing lock details.\n */\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory);\n\n /**\n * @notice Retrieves the token IDs owned by a specific address.\n * @param _owner The address of the owner.\n * @return An array of token IDs owned by the address.\n */\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the assets locked for a specific token ID.\n * @param _tokenId The ID of the token.\n * @return An array of addresses representing the locked assets.\n */\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory);\n\n /**\n * @notice Retrieves the delegatees for a specific token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return An array of delegatee IDs.\n */\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the delegators for a specific token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return An array of delegator IDs.\n */\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the user point for a specific token ID, LP token type, and epoch.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @param _epoch The epoch number.\n * @return A UserPoint struct containing user point details.\n */\n function getUserPoint(uint256 _tokenId, LpTokenType _lpType, uint256 _epoch) external view returns (UserPoint memory);\n}\n" + }, + "contracts/veION/interfaces/IveIONStructsEnumsErrorsEvents.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Structure representing a locked balance\n * @param tokenAddress Address of the token\n * @param amount Amount of tokens locked\n * @param delegateAmount Amount of tokens delegated\n * @param start Start time of the lock\n * @param end End time of the lock\n * @param isPermanent Indicates if the lock is permanent\n * @param boost Boost value for the lock\n */\n struct LockedBalance {\n address tokenAddress;\n uint256 amount;\n uint256 delegateAmount;\n uint256 start;\n uint256 end;\n bool isPermanent;\n uint256 boost;\n }\n\n /**\n * @notice Structure representing a delegation\n * @param amount Amount of tokens delegated\n * @param delegatee ID of the delegatee\n */\n struct Delegation {\n uint256 amount;\n uint256 delegatee;\n }\n\n /**\n * @notice Structure representing a user point\n * @param bias Bias value\n * @param slope Slope value, representing -dweight / dt\n * @param ts Timestamp of the point\n * @param blk Block number of the point\n * @param permanent Permanent value\n * @param permanentDelegate Permanent delegate value\n */\n struct UserPoint {\n uint256 bias;\n uint256 slope;\n uint256 ts;\n uint256 blk;\n uint256 permanent;\n uint256 permanentDelegate;\n }\n\n /**\n * @notice Structure representing a global point\n * @param bias Bias value\n * @param slope Slope value, representing -dweight / dt\n * @param ts Timestamp of the point\n * @param blk Block number of the point\n * @param permanentLockBalance Permanent lock balance\n */\n struct GlobalPoint {\n int128 bias;\n int128 slope;\n uint256 ts;\n uint256 blk;\n uint256 permanentLockBalance;\n }\n\n /**\n * @notice Structure representing a checkpoint\n * @param fromTimestamp Timestamp from which the checkpoint is valid\n * @param owner Address of the owner\n * @param delegatedBalance Balance that has been delegated\n * @param delegatee ID of the delegatee\n */\n struct Checkpoint {\n uint256 fromTimestamp;\n address owner;\n uint256 delegatedBalance;\n uint256 delegatee;\n }\n\n /**\n * @notice Enum representing deposit types\n */\n enum DepositType {\n DEPOSIT_FOR_TYPE,\n CREATE_LOCK_TYPE,\n INCREASE_LOCK_AMOUNT,\n INCREASE_UNLOCK_TIME,\n LOCK_ADDITIONAL\n }\n\n /**\n * @notice Enum representing LP token types\n */\n enum LpTokenType {\n Mode_Velodrome_5050_ION_MODE,\n Mode_Balancer_8020_ION_ETH,\n Base_Aerodrome_5050_ION_wstETH,\n Base_Balancer_8020_ION_ETH,\n Optimism_Velodrome_5050_ION_OP,\n Optimism_Balancer_8020_ION_ETH\n }\n\n error LockDurationNotInFuture();\n error ZeroAmount();\n error LockDurationTooLong();\n error TokenNotWhitelisted();\n error NotOwner();\n error AlreadyVoted();\n error PermanentLock();\n error NoLockFound();\n error LockExpired();\n error SameNFT();\n error SplitNotAllowed();\n error AmountTooBig();\n error NotPermanentLock();\n error TokenHasDelegatees();\n error TokenHasDelegators();\n error NotVoter();\n error MinimumNotMet();\n error ArrayMismatch();\n error LockDurationTooShort();\n error DuplicateAsset();\n error SplitTooSmall();\n error NotEnoughRemainingAfterSplit();\n error NoDelegationBetweenTokens(uint256 _tokenId1, uint256 _tokenId2);\n error NoUnderlyingStake();\n error NotAcceptingDelegators();\n error BoostAmountMustBeGreaterThanZero();\n error InvalidAddress();\n error MinimumAmountMustBeGreaterThanZero();\n error MinimumLockDurationMustBeGreaterThanZero();\n error AeroBoostAmountMustBeGreaterThanZero();\n error MaxEarlyWithdrawFeeMustBeGreaterThanZero();\n error InvalidTokenAddress();\n error InvalidStrategyAddress();\n error InvalidVeAEROAddress();\n\n event Deposit(\n address indexed provider,\n uint256 indexed tokenId,\n DepositType indexed depositType,\n uint256 value,\n uint256 locktime,\n uint256 ts\n );\n event Withdraw(address indexed provider, uint256 indexed tokenId, uint256 value, uint256 ts);\n event Supply(uint256 prevSupply, uint256 supply);\n event Delegated(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\n event DelegationRemoved(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\n event ProtocolFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\n event DistributedFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\n event SplitToggle(address indexed account, bool isAllowed);\n event LimitedBoostToggled(bool isBoosted);\n event LimitedTimeBoostSet(uint256 boostAmount);\n event VoterSet(address indexed newVoter);\n event AeroVotingSet(address indexed newAeroVoting);\n event AeroVoterBoostSet(uint256 newAeroVoterBoost);\n event TokensWhitelisted(address[] token, bool[] isWhitelisted);\n event LpTokenTypeSet(address indexed token, LpTokenType lpTokenType);\n event VeAEROSet(address indexed veAERO);\n event StakeStrategySet(LpTokenType indexed lpTokenType, address indexed strategy);\n event MinimumLockAmountSet(address indexed tokenAddress, uint256 minimumAmount);\n event MinimumLockDurationSet(uint256 minimumDuration);\n event IonicPoolSet(address indexed newIonicPool);\n event SplitCompleted(\n uint256 indexed fromTokenId,\n uint256 indexed tokenId1,\n uint256 indexed tokenId2,\n uint256 splitAmount,\n address tokenAddress\n );\n event MergeCompleted(\n uint256 indexed fromTokenId,\n uint256 indexed toTokenId,\n address[] assetsLocked,\n uint256 lengthOfAssets\n );\n event EmissionsClaimed(address indexed claimant, address indexed tokenAddress);\n event MaxEarlyWithdrawFeeSet(uint256 maxEarlyWithdrawFee);\n event PermanentLockCreated(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\n event PermanentLockRemoved(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\n event Voted(uint256 _tokenId, bool _voting);\n event DelegatorsBlocked(uint256 indexed _tokenId, address indexed _lpToken, bool _blocked);\n event Initialized(address indexed addressesProvider);\n event ExtensionsSet(address indexed _firstExtension, address indexed _secondExtension);\n}\n" + }, + "contracts/veION/interfaces/IVoter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\n/**\n * @title IVoter\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\n */\ninterface IVoter {\n /// @notice Error thrown when a user has already voted or deposited.\n error AlreadyVotedOrDeposited();\n\n /// @notice Error thrown when an action is attempted outside the distribution window.\n error DistributeWindow();\n\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\n error RewardAccumulatorDoesNotExist(address _pool);\n\n /// @notice Error thrown when a reward accumulator is not alive.\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\n\n /// @notice Error thrown when a market already exists.\n error MarketAlreadyExists();\n\n /// @notice Error thrown when the maximum voting number is too low.\n error MaximumVotingNumberTooLow();\n\n /// @notice Error thrown when array lengths do not match.\n error MismatchedArrayLengths();\n\n /// @notice Error thrown when there are non-zero votes.\n error NonZeroVotes();\n\n /// @notice Error thrown when the caller is not the owner.\n error NotOwner();\n\n /// @notice Error thrown when an action is attempted outside the distribution window.\n error NotDistributeWindow();\n\n /// @notice Error thrown when the caller is not the governor.\n error NotGovernor();\n\n /// @notice Error thrown when an NFT is not whitelisted.\n error NotWhitelistedNFT();\n\n /// @notice Error thrown when the same value is provided.\n error SameValue();\n\n /// @notice Error thrown when there are too many pools.\n error TooManyPools();\n\n /// @notice Error thrown when array lengths are unequal.\n error UnequalLengths();\n\n /// @notice Error thrown when an address is zero.\n error ZeroAddress();\n\n /// @notice Error thrown when the tokens array is empty.\n error TokensArrayEmpty();\n\n /// @notice Error thrown when the weight is zero.\n error ZeroWeight();\n\n /**\n * @notice Struct to store vote details.\n * @param marketVotes Array of market addresses voted for.\n * @param marketVoteSides Array of market sides voted for.\n * @param votes Array of vote weights.\n * @param usedWeight Total weight used in voting.\n */\n struct VoteDetails {\n address[] marketVotes;\n MarketSide[] marketVoteSides;\n uint256[] votes;\n uint256 usedWeight;\n }\n\n /**\n * @notice Struct to store market information.\n * @param marketAddress Address of the market.\n * @param side Side of the market (Supply or Borrow).\n */\n struct Market {\n address marketAddress;\n MarketSide side;\n }\n\n /**\n * @notice Struct to store variables used in voting.\n * @param totalWeight Total weight available for voting.\n * @param usedWeight Weight used in voting.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param rewardAccumulator Address of the reward accumulator.\n * @param marketWeight Weight of the market.\n * @param bribes Address of the bribes.\n */\n struct VoteVars {\n uint256 totalWeight;\n uint256 usedWeight;\n address market;\n MarketSide marketSide;\n address rewardAccumulator;\n uint256 marketWeight;\n address bribes;\n }\n\n /**\n * @notice Struct to store local variables used in voting.\n * @param sender Address of the sender.\n * @param timestamp Timestamp of the vote.\n * @param votingLPs Array of voting LP addresses.\n * @param votingLPBalances Array of voting LP balances.\n * @param boosts Array of boosts.\n */\n struct VoteLocalVars {\n address sender;\n uint256 timestamp;\n address[] votingLPs;\n uint256[] votingLPBalances;\n uint256[] boosts;\n }\n\n /**\n * @notice Enum to represent the side of a market.\n */\n enum MarketSide {\n Supply,\n Borrow\n }\n\n /**\n * @notice Event emitted when a vote is cast.\n * @param voter Address of the voter.\n * @param pool Address of the pool.\n * @param tokenId ID of the token.\n * @param weight Weight of the vote.\n * @param totalWeight Total weight of the vote.\n * @param timestamp Timestamp of the vote.\n */\n event Voted(\n address indexed voter,\n address indexed pool,\n uint256 indexed tokenId,\n uint256 weight,\n uint256 totalWeight,\n uint256 timestamp\n );\n\n /**\n * @notice Event emitted when a vote is abstained.\n * @param voter Address of the voter.\n * @param pool Address of the pool.\n * @param tokenId ID of the token.\n * @param weight Weight of the vote.\n * @param totalWeight Total weight of the vote.\n * @param timestamp Timestamp of the vote.\n */\n event Abstained(\n address indexed voter,\n address indexed pool,\n uint256 indexed tokenId,\n uint256 weight,\n uint256 totalWeight,\n uint256 timestamp\n );\n\n /**\n * @notice Event emitted when a reward is notified.\n * @param sender Address of the sender.\n * @param reward Address of the reward.\n * @param amount Amount of the reward.\n */\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\n\n /**\n * @notice Event emitted when a token is whitelisted.\n * @param whitelister Address of the whitelister.\n * @param token Address of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\n\n /**\n * @notice Event emitted when an NFT is whitelisted.\n * @param whitelister Address of the whitelister.\n * @param tokenId ID of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\n\n event LpTokensSet(address[] indexed lpTokens);\n event MpoSet(address indexed mpo);\n event GovernorSet(address indexed governor);\n event MarketsAdded(Market[] markets);\n event MarketRewardAccumulatorsSet(\n address[] indexed markets,\n MarketSide[] indexed marketSides,\n address[] indexed rewardAccumulators\n );\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\n\n /**\n * @notice Get the weight of a market.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param lpToken Address of the LP token.\n * @return The weight of the market.\n */\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\n\n /**\n * @notice Get the votes for a token.\n * @param tokenId ID of the token.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param lpToken Address of the LP token.\n * @return The votes for the token.\n */\n function votes(\n uint256 tokenId,\n address market,\n MarketSide marketSide,\n address lpToken\n ) external view returns (uint256);\n\n /**\n * @notice Get the used weights for a token.\n * @param tokenId ID of the token.\n * @param lpToken Address of the LP token.\n * @return The used weights for the token.\n */\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\n\n /**\n * @notice Get the last voted timestamp for a token.\n * @param tokenId ID of the token.\n * @return The last voted timestamp for the token.\n */\n function lastVoted(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Check if a token is whitelisted.\n * @param token Address of the token.\n * @return True if the token is whitelisted, false otherwise.\n */\n function isWhitelistedToken(address token) external view returns (bool);\n\n /**\n * @notice Check if an NFT is whitelisted.\n * @param tokenId ID of the token.\n * @return True if the NFT is whitelisted, false otherwise.\n */\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\n\n /**\n * @notice Get the address of the ve contract.\n * @return The address of the ve contract.\n */\n function ve() external view returns (address);\n\n /**\n * @notice Get the address of the governor.\n * @return The address of the governor.\n */\n function governor() external view returns (address);\n\n /**\n * @notice Update voting balances in voting rewards contracts.\n * @param _tokenId ID of veNFT whose balance you wish to update.\n */\n function poke(uint256 _tokenId) external;\n\n /**\n * @notice Vote for pools. Votes distributed proportionally based on weights.\n * @dev Can only vote or deposit into a managed NFT once per epoch.\n * Can only vote for gauges that have not been killed.\n * Throws if length of _poolVote and _weights do not match.\n * @param _tokenId ID of veNFT you are voting with.\n * @param _poolVote Array of pools you are voting for.\n * @param _marketVoteSide Array of market vote sides you are voting for.\n * @param _weights Weights of pools.\n */\n function vote(\n uint256 _tokenId,\n address[] calldata _poolVote,\n MarketSide[] calldata _marketVoteSide,\n uint256[] calldata _weights\n ) external;\n\n /**\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\n * @dev Cannot reset in the same epoch that you voted in.\n * Can vote or deposit into a managed NFT again after reset.\n * @param _tokenId ID of veNFT that you are resetting.\n */\n function reset(uint256 _tokenId) external;\n\n /**\n * @notice Distributes rewards to eligible markets.\n */\n function distributeRewards() external;\n\n /**\n * @notice Claim bribes for a given NFT.\n * @dev Utility to help batch bribe claims.\n * @param _bribes Array of BribeVotingReward contracts to collect from.\n * @param _tokens Array of tokens that are used as bribes.\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\n */\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\n\n /**\n * @notice Whitelist (or unwhitelist) token for use in bribes.\n * @dev Throws if not called by governor.\n * @param _token Address of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n function whitelistToken(address _token, bool _bool) external;\n\n /**\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\n * @dev Throws if not called by governor.\n * Throws if already whitelisted.\n * @param _tokenId ID of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\n\n /**\n * @notice Set the LP tokens.\n * @param _lpTokens Array of LP token addresses.\n */\n function setLpTokens(address[] memory _lpTokens) external;\n\n /**\n * @notice Set the Master Price Oracle (MPO) address.\n * @param _mpo Address of the Master Price Oracle.\n */\n function setMpo(address _mpo) external;\n\n /**\n * @notice Set a new governor.\n * @param _governor Address of the new governor.\n */\n function setGovernor(address _governor) external;\n\n /**\n * @notice Add new markets.\n * @param _markets Array of Market structs to be added.\n */\n function addMarkets(Market[] calldata _markets) external;\n\n /**\n * @notice Set reward accumulators for markets.\n * @param _markets Array of market addresses.\n * @param _marketSides Array of market sides.\n * @param _rewardAccumulators Array of reward accumulator addresses.\n */\n function setMarketRewardAccumulators(\n address[] calldata _markets,\n MarketSide[] calldata _marketSides,\n address[] calldata _rewardAccumulators\n ) external;\n\n /**\n * @notice Set bribes for reward accumulators.\n * @param _rewardAccumulators Array of reward accumulator addresses.\n * @param _bribes Array of bribe addresses.\n */\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\n\n /**\n * @notice Set the maximum number of votes.\n * @param _maxVotingNum Maximum number of votes allowed.\n */\n function setMaxVotingNum(uint256 _maxVotingNum) external;\n\n /**\n * @notice Toggle the alive status of a reward accumulator.\n * @param _market Address of the market.\n * @param _marketSide Side of the market.\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\n */\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\n\n /**\n * @notice Get the start of the epoch for a given timestamp.\n * @param _timestamp The timestamp to calculate the epoch start for.\n * @return The start of the epoch.\n */\n function epochStart(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the next epoch for a given timestamp.\n * @param _timestamp The timestamp to calculate the next epoch for.\n * @return The next epoch.\n */\n function epochNext(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the start of the voting period for a given timestamp.\n * @param _timestamp The timestamp to calculate the voting start for.\n * @return The start of the voting period.\n */\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the end of the voting period for a given timestamp.\n * @param _timestamp The timestamp to calculate the voting end for.\n * @return The end of the voting period.\n */\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the number of markets.\n * @return The number of markets.\n */\n function marketsLength() external view returns (uint256);\n\n /**\n * @notice Get all LP reward tokens.\n * @return An array of addresses representing all LP reward tokens.\n */\n function getAllLpRewardTokens() external view returns (address[] memory);\n\n /**\n * @notice Get vote details for a specific token ID and LP asset.\n * @param _tokenId The ID of the token.\n * @param _lpAsset The address of the LP asset.\n * @return A struct containing vote details.\n */\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\n}\n" + }, + "contracts/veION/libraries/BalanceLogicLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../interfaces/IveIONStructsEnumsErrorsEvents.sol\";\n\nlibrary BalanceLogicLibrary {\n uint256 internal constant _WEEK = 1 weeks;\n\n /// @notice Calculates the voting power for a given NFT at a specific time.\n /// @dev This function is compatible with the ERC20 `balanceOf` interface for Aragon.\n /// It retrieves the last user point before a specified timestamp and computes the voting power at that time.\n /// @param s_userPointEpoch Mapping of user point epochs for all tokens.\n /// @param s_userPointHistory Mapping of user point history for all tokens.\n /// @param _lpType The type of LP token associated with the NFT.\n /// @param _tokenId The ID of the NFT for which to calculate voting power.\n /// @param _t The epoch time at which to calculate the voting power.\n /// @param _isPermanent A boolean indicating if the lock is permanent.\n /// @return The calculated voting power of the user at the specified time.\n function balanceOfNFTAt(\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\n storage s_userPointHistory,\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\n uint256 _tokenId,\n uint256 _t,\n bool _isPermanent\n ) internal view returns (uint256) {\n uint256 _epoch = getPastUserPointIndex(s_userPointEpoch, s_userPointHistory, _lpType, _tokenId, _t);\n // epoch 0 is an empty point\n if (_epoch == 0) return 0;\n IveIONStructsEnumsErrorsEvents.UserPoint memory lastPoint = s_userPointHistory[_tokenId][_lpType][_epoch];\n if (_isPermanent) {\n return lastPoint.permanent + lastPoint.permanentDelegate;\n } else {\n uint256 reduction = lastPoint.slope * (_t - lastPoint.ts);\n if (reduction > lastPoint.bias) {\n lastPoint.bias = 0;\n } else {\n lastPoint.bias -= reduction;\n }\n return lastPoint.bias;\n }\n }\n\n /// @notice Binary search to get the user point index for a token id at or prior to a given timestamp\n /// @dev If a user point does not exist prior to the timestamp, this will return 0.\n /// @param s_userPointEpoch State of all user point epochs\n /// @param s_userPointHistory State of all user point history\n /// @param _tokenId .\n /// @param _timestamp .\n /// @return User point index\n function getPastUserPointIndex(\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\n storage s_userPointHistory,\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\n uint256 _tokenId,\n uint256 _timestamp\n ) internal view returns (uint256) {\n uint256 _userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (_userEpoch == 0) return 0;\n // First check most recent balance\n if (s_userPointHistory[_tokenId][_lpType][_userEpoch].ts <= _timestamp) return (_userEpoch);\n // Next check implicit zero balance\n if (s_userPointHistory[_tokenId][_lpType][1].ts > _timestamp) return 0;\n uint256 lower = 0;\n uint256 upper = _userEpoch;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n IveIONStructsEnumsErrorsEvents.UserPoint storage userPoint = s_userPointHistory[_tokenId][_lpType][center];\n if (userPoint.ts == _timestamp) {\n return center;\n } else if (userPoint.ts < _timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n}\n" + }, + "contracts/veION/libraries/IonicTimeLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nlibrary IonicTimeLibrary {\n uint256 internal constant _WEEK = 7 days;\n\n /// @dev Returns start of epoch based on current timestamp\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK);\n }\n }\n\n /// @dev Returns start of next epoch / end of current epoch\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + _WEEK;\n }\n }\n\n /// @dev Returns start of voting window\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + 1 hours;\n }\n }\n\n /// @dev Returns end of voting window / beginning of unrestricted voting window\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\n }\n }\n}\n" + }, + "contracts/veION/RewardAccumulator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract RewardAccumulator is Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize() external initializer {\n __Ownable2Step_init();\n }\n\n function approve(address _token, address _spender) external onlyOwner {\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\n }\n}\n" + }, + "contracts/veION/stake/IStakeStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\n/**\n * @title IStakeStrategy\n * @notice Interface for the VeloIonModeStakingModeReward contract.\n */\ninterface IStakeStrategy {\n /// @notice Emitted when the contract is initialized\n event Initialized(\n address indexed escrow,\n address indexed stakingToken,\n address indexed stakingContract,\n address stakingWalletImplementation\n );\n\n /// @notice Emitted when tokens are staked\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\n\n /// @notice Emitted when rewards are claimed\n event Claimed(address indexed from, address indexed veloWallet);\n\n /// @notice Emitted when tokens are withdrawn\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\n\n /// @notice Emitted when staking wallet is transferred\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\n\n /// @notice Emitted when escrow is set\n event EscrowSet(address indexed newEscrow);\n\n /// @notice Emitted when staking token is set\n event StakingTokenSet(address indexed newStakingToken);\n\n /// @notice Emitted when staking contract is set\n event StakingContractSet(address indexed newStakingContract);\n\n /// @notice Emitted when upgradeable beacon is set\n event UpgradeableBeaconSet(address indexed newBeacon);\n\n /**\n * @notice Stakes a specified amount of tokens from a given address.\n * @param _from The address from which tokens will be staked.\n * @param _amount The amount of tokens to stake.\n * @param _data Additional data that might be needed for staking.\n */\n function stake(address _from, uint256 _amount, bytes memory _data) external;\n\n /**\n * @notice Claims rewards for a given address.\n * @param _from The address for which to claim rewards.\n */\n function claim(address _from) external;\n\n /**\n * @notice Withdraws a specified amount of tokens for a given address.\n * @param _owner The address from which tokens will be withdrawn.\n * @param _amount The amount of tokens to withdraw.\n */\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\n\n /**\n * @notice Returns the current reward rate for the staking strategy.\n * @return The reward rate as a uint256.\n */\n function rewardRate() external view returns (uint256);\n\n /**\n * @notice Returns the period finish time for the staking strategy.\n * @return The period finish time as a uint256.\n */\n function periodFinish() external view returns (uint256);\n\n /**\n * @notice Returns the balance of a specific address.\n * @param account The address to query the balance of.\n * @return The balance as a uint256.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Returns the total supply of staked tokens.\n * @return The total supply as a uint256.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Returns the address of the reward token for the staking strategy.\n * @return The address of the reward token.\n */\n function rewardToken() external view returns (address);\n\n /**\n * @notice Returns the address of the staking contract.\n * @return The address of the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @notice Returns the address of the staking token.\n * @return The address of the staking token.\n */\n function stakingToken() external view returns (address);\n\n /**\n * @notice Returns the staking wallet address for a specific user.\n * @param user The address of the user.\n * @return The address of the user's staking wallet.\n */\n function userStakingWallet(address user) external view returns (address);\n\n /**\n * @notice Transfers the staking wallet from one user to another.\n * @param from The current owner of the staking wallet.\n * @param to The new owner of the staking wallet.\n */\n function transferStakingWallet(address from, address to, uint256 _amount) external;\n\n /**\n * @notice Sets the escrow address.\n * @param _escrow The address of the new escrow.\n */\n function setEscrow(address _escrow) external;\n\n /**\n * @notice Sets the staking token address.\n * @param _stakingToken The address of the new staking token.\n */\n function setStakingToken(address _stakingToken) external;\n\n /**\n * @notice Sets the staking contract address.\n * @param _stakingContract The address of the new staking contract.\n */\n function setStakingContract(address _stakingContract) external;\n\n /**\n * @notice Sets the address of the beacon.\n * @param _beacon The address of the new beacon contract.\n */\n function setUpgradeableBeacon(address _beacon) external;\n}\n" + }, + "contracts/veION/stake/IStakeWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IStakeWallet {\n /// @notice Emitted when tokens are staked\n event Staked(uint256 amount);\n\n /// @notice Emitted when rewards are claimed\n event Claimed(address indexed from, uint256 rewardAmount);\n\n /// @notice Emitted when tokens are withdrawn\n event Withdrawn(address indexed withdrawTo, uint256 amount);\n\n /**\n * @notice Stakes a specified amount of tokens according to the strategy.\n * @param amount The amount of tokens to stake.\n * @param data Additional data required for the staking strategy.\n */\n function stake(address from, uint256 amount, bytes memory data) external;\n\n /**\n * @notice Claims rewards for the caller.\n */\n function claim(address from) external;\n\n /**\n * @notice Withdraws a specified amount of staked tokens.\n * @param withdrawTo The address to withdraw tokens to.\n * @param amount The amount of tokens to withdraw.\n */\n function withdraw(address withdrawTo, uint256 amount) external;\n}\n" + }, + "contracts/veION/stake/velo/IVeloIonModeStaking.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IVeloIonModeStaking {\n event Deposit(address indexed from, address indexed to, uint256 amount);\n event Withdraw(address indexed from, uint256 amount);\n event NotifyReward(address indexed from, uint256 amount);\n event ClaimFees(uint256 claimed0, uint256 claimed1);\n event ClaimRewards(address indexed from, uint256 amount);\n\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\n function stakingToken() external view returns (address);\n\n /// @notice Address of the token (VELO v2) rewarded to stakers\n function rewardToken() external view returns (address);\n\n /// @notice Address of the Converter contract linked to the gauge\n function feeConverter() external view returns (address);\n\n /// @notice Address of the staking rewards factory that created this gauge\n function factory() external view returns (address);\n\n /// @notice Timestamp end of current rewards period\n function periodFinish() external view returns (uint256);\n\n /// @notice Current reward rate of rewardToken to distribute per second\n function rewardRate() external view returns (uint256);\n\n /// @notice Most recent timestamp contract has updated state\n function lastUpdateTime() external view returns (uint256);\n\n /// @notice Most recent stored value of rewardPerToken\n function rewardPerTokenStored() external view returns (uint256);\n\n /// @notice Amount of stakingToken deposited for rewards\n function totalSupply() external view returns (uint256);\n\n /// @notice Get the amount of stakingToken deposited by an account\n function balanceOf(address) external view returns (uint256);\n\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\n function userRewardPerTokenPaid(address) external view returns (uint256);\n\n /// @notice Cached amount of rewardToken earned for an account\n function rewards(address) external view returns (uint256);\n\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\n function rewardRateByEpoch(uint256) external view returns (uint256);\n\n /// @notice Get the current reward rate per unit of stakingToken deposited\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\n\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\n function lastTimeRewardApplicable() external view returns (uint256 _time);\n\n /// @notice Returns accrued balance to date from last claim / first deposit.\n function earned(address _account) external view returns (uint256 _earned);\n\n /// @notice Total amount of rewardToken to distribute for the current rewards period\n function left() external view returns (uint256 _left);\n\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\n /// @return _claimed0 Amount of Fees claimed in token0\n /// @return _claimed1 Amount of Fees claimed in token1\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\n\n /// @notice Retrieve rewards for an address.\n /// @dev Throws if not called by same address or voter.\n /// @param _account .\n function getReward(address _account) external;\n\n /// @notice Deposit LP tokens into gauge for msg.sender\n /// @param _amount .\n function deposit(uint256 _amount) external;\n\n /// @notice Deposit LP tokens into gauge for any user\n /// @param _amount .\n /// @param _recipient Recipient to give balance to\n function deposit(uint256 _amount, address _recipient) external;\n\n /// @notice Withdraw LP tokens for user\n /// @param _amount .\n function withdraw(uint256 _amount) external;\n\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\n /// If not 18 decimals, rewardRate may have rounding issues.\n function notifyRewardMatch(uint256 amount) external;\n\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\n /// If not 18 decimals, rewardRate may have rounding issues.\n function notifyRewardAmount(uint256 amount) external;\n}\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../IStakeStrategy.sol\";\nimport \"./VeloAeroStakingWallet.sol\";\nimport \"./IVeloIonModeStaking.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\nimport { UpgradeableBeacon } from \"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\";\n\n/**\n * @title VeloAeroStakingStrategy\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract VeloAeroStakingStrategy is IStakeStrategy, Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Address of the escrow responsible for managing staking operations\n address public escrow;\n /// @notice Address of the token being staked\n address public stakingToken;\n /// @notice Address of the contract where staking operations are executed\n address public stakingContract;\n /// @notice Address of beacon contract that manages wallet proxies\n UpgradeableBeacon public veloAeroBeacon;\n /// @notice Mapping of user addresses to their respective staking wallet addresses\n mapping(address => address) public userStakingWallet;\n\n /// @dev Modifier to restrict function access to only the escrow address\n modifier onlyEscrow() {\n require(msg.sender == escrow, \"Not authorized: Only escrow can call this function\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the staking strategy contract with necessary parameters\n * @dev This function can only be called once due to the initializer modifier\n * @param _escrow The address of the escrow responsible for staking operations\n * @param _stakingToken The address of the token to be staked\n * @param _stakingContract The address of the contract handling staking\n * @param _stakingWalletImplementation The address of the staking wallet implementation\n */\n function initialize(\n address _escrow,\n address _stakingToken,\n address _stakingContract,\n address _stakingWalletImplementation\n ) public initializer {\n __Ownable2Step_init();\n escrow = _escrow;\n stakingToken = _stakingToken;\n stakingContract = _stakingContract;\n\n veloAeroBeacon = new UpgradeableBeacon(_stakingWalletImplementation);\n veloAeroBeacon.transferOwnership(msg.sender);\n\n emit Initialized(_escrow, _stakingToken, _stakingContract, _stakingWalletImplementation);\n }\n\n /// @inheritdoc IStakeStrategy\n function stake(address _from, uint256 _amount, bytes memory _data) external override onlyEscrow {\n IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), _amount);\n\n address veloWallet = userStakingWallet[_from];\n if (veloWallet == address(0)) {\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\n veloWallet = address(newWallet);\n VeloAeroStakingWallet(veloWallet).initialize(IStakeStrategy(address(this)));\n userStakingWallet[_from] = veloWallet;\n }\n\n IERC20(stakingToken).approve(veloWallet, _amount);\n VeloAeroStakingWallet(veloWallet).stake(_from, _amount, _data);\n emit Staked(_from, _amount, veloWallet);\n }\n\n /// @inheritdoc IStakeStrategy\n function claim(address _from) external onlyEscrow {\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_from]);\n veloWallet.claim(_from);\n emit Claimed(_from, address(veloWallet));\n }\n\n /// @inheritdoc IStakeStrategy\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external onlyEscrow {\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_owner]);\n veloWallet.withdraw(_withdrawTo, _amount);\n emit Withdrawn(_owner, _withdrawTo, _amount);\n }\n\n /// @inheritdoc IStakeStrategy\n function transferStakingWallet(address _from, address _to, uint256 _amount) external onlyEscrow {\n address fromWallet = userStakingWallet[_from];\n address toWallet = userStakingWallet[_to];\n\n if (toWallet == address(0)) {\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\n toWallet = address(newWallet);\n VeloAeroStakingWallet(toWallet).initialize(IStakeStrategy(address(this)));\n userStakingWallet[_to] = toWallet;\n }\n\n VeloAeroStakingWallet(fromWallet).withdraw(address(this), _amount);\n IERC20(stakingToken).approve(address(toWallet), _amount);\n VeloAeroStakingWallet(toWallet).stake(_to, _amount, \"\");\n emit StakingWalletTransferred(_from, _to, _amount);\n }\n\n /// @inheritdoc IStakeStrategy\n function rewardRate() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).rewardRate();\n }\n\n /// @inheritdoc IStakeStrategy\n function periodFinish() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).periodFinish();\n }\n\n /// @inheritdoc IStakeStrategy\n function balanceOf(address account) public view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).balanceOf(account);\n }\n\n /// @inheritdoc IStakeStrategy\n function totalSupply() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).totalSupply();\n }\n\n /// @inheritdoc IStakeStrategy\n function rewardToken() public view returns (address) {\n return IVeloIonModeStaking(stakingContract).rewardToken();\n }\n\n /// @inheritdoc IStakeStrategy\n function setEscrow(address _escrow) external onlyOwner {\n require(_escrow != address(0), \"Invalid address\");\n escrow = _escrow;\n emit EscrowSet(_escrow);\n }\n\n /// @inheritdoc IStakeStrategy\n function setStakingToken(address _stakingToken) external onlyOwner {\n require(_stakingToken != address(0), \"Invalid address\");\n stakingToken = _stakingToken;\n emit StakingTokenSet(_stakingToken);\n }\n\n /// @inheritdoc IStakeStrategy\n function setStakingContract(address _stakingContract) external onlyOwner {\n require(_stakingContract != address(0), \"Invalid address\");\n stakingContract = _stakingContract;\n emit StakingContractSet(_stakingContract);\n }\n\n /// @inheritdoc IStakeStrategy\n function setUpgradeableBeacon(address _beacon) external onlyOwner {\n require(_beacon != address(0), \"Invalid address\");\n veloAeroBeacon = UpgradeableBeacon(_beacon);\n emit UpgradeableBeaconSet(_beacon);\n }\n}\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IStakeWallet } from \"../IStakeWallet.sol\";\nimport { IStakeStrategy } from \"../IStakeStrategy.sol\";\nimport { IVeloIonModeStaking } from \"./IVeloIonModeStaking.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title VeloAeroStakingWallet\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\n * @author Jourdan Dunkley \n */\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n IStakeStrategy public stakeStrategy;\n\n /// @dev Modifier to restrict function access to only the stake strategy contract\n modifier onlyStakeStrategy() {\n require(msg.sender == address(stakeStrategy), \"Not authorized: Only stake strategy can call this function\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the contract with a staking strategy\n * @dev Can only be called once due to initializer modifier\n * @param _stakeStrategy The address of the staking strategy contract\n */\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\n stakeStrategy = _stakeStrategy;\n }\n\n /// @inheritdoc IStakeWallet\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\n stakingToken.approve(address(stakingContract), _amount);\n stakingContract.deposit(_amount);\n emit Staked(_amount);\n }\n\n /// @inheritdoc IStakeWallet\n function claim(address _from) external onlyStakeStrategy {\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingContract.getReward(address(this));\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\n emit Claimed(_from, rewardAmount);\n }\n\n /// @inheritdoc IStakeWallet\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingContract.withdraw(_amount);\n stakingToken.safeTransfer(_withdrawTo, _amount);\n emit Withdrawn(_withdrawTo, _amount);\n }\n}\n" + }, + "contracts/veION/veION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IveIONCore, IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veION is Ownable2StepUpgradeable, ERC721Upgradeable, ReentrancyGuardUpgradeable, veIONStorage, IveIONCore {\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the veION contract with the given AddressesProvider.\n * @dev This function is called only once during the contract deployment.\n * It initializes the Ownable, ERC721, and ReentrancyGuard modules.\n * @param _ap The AddressesProvider contract used for address management.\n */\n function initialize(IAddressesProvider _ap) public initializer {\n __Ownable2Step_init();\n __ERC721_init(\"veION\", \"veION\");\n __ReentrancyGuard_init();\n ap = _ap;\n emit Initialized(address(_ap));\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONCore\n function createLockFor(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) external override nonReentrant returns (uint256) {\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _to);\n }\n\n /// @inheritdoc IveIONCore\n function createLock(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying\n ) external override nonReentrant returns (uint256) {\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _msgSender());\n }\n\n /// @inheritdoc IveIONCore\n function increaseAmount(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n bool _stakeUnderlying\n ) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_tokenAmount == 0) revert ZeroAmount();\n if (oldLocked.amount == 0) revert NoLockFound();\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\n\n if (oldLocked.isPermanent) s_permanentLockBalance[_lpType] += _tokenAmount;\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n _tokenAmount,\n 0,\n _stakeUnderlying,\n oldLocked,\n DepositType.INCREASE_LOCK_AMOUNT,\n _lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function lockAdditionalAsset(\n address _tokenAddress,\n uint256 _tokenAmount,\n uint256 _tokenId,\n uint256 _duration,\n bool _stakeUnderlying\n ) external nonReentrant {\n LpTokenType lpType = s_lpType[_tokenAddress];\n LockedBalance storage lockedBalance = s_locked[_tokenId][lpType];\n uint256 unlockTime = ((block.timestamp + _duration) / _WEEK) * _WEEK;\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_tokenAmount == 0) revert ZeroAmount();\n if (s_voted[_tokenId]) revert AlreadyVoted();\n if (!s_assetsLocked[_tokenId].add(_tokenAddress)) revert DuplicateAsset();\n if (_tokenAmount < s_minimumLockAmount[lpType]) revert MinimumNotMet();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n if (_duration < s_minimumLockDuration) revert LockDurationTooShort();\n\n if (lockedBalance.isPermanent) s_permanentLockBalance[lpType] += _tokenAmount;\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n _tokenAmount,\n unlockTime,\n _stakeUnderlying,\n lockedBalance,\n DepositType.LOCK_ADDITIONAL,\n lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n uint256 unlockTime = ((block.timestamp + _lockDuration) / _WEEK) * _WEEK; // Locktime is rounded down to weeks\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (oldLocked.isPermanent) revert PermanentLock();\n if (oldLocked.end <= block.timestamp) revert LockExpired();\n if (oldLocked.amount <= 0) revert NoLockFound();\n if (unlockTime <= oldLocked.end) revert LockDurationNotInFuture();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n 0,\n unlockTime,\n false,\n oldLocked,\n DepositType.INCREASE_UNLOCK_TIME,\n _lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external nonReentrant {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender()) revert NotOwner();\n if (amount > fromLocked.amount) revert AmountTooBig();\n if (!fromLocked.isPermanent) revert NotPermanentLock();\n if (!toLocked.isPermanent) revert NotPermanentLock();\n if (s_delegatorsBlocked[toTokenId][lpToken]) revert NotAcceptingDelegators();\n\n fromLocked.amount -= amount;\n toLocked.delegateAmount += amount;\n\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].add(toTokenId);\n s_delegators[toTokenId][lpType].add(fromTokenId);\n }\n\n s_delegations[fromTokenId][toTokenId][lpType] += amount;\n\n s_locked[fromTokenId][lpType] = fromLocked;\n s_locked[toTokenId][lpType] = toLocked;\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit Delegated(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /**\n * @dev Internal function to remove a delegation between two veNFTs.\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\n * @param toTokenId ID of the veNFT to which delegation is being removed.\n * @param lpToken Address of the LP token associated with the delegation.\n * @param amount Amount of delegation to remove.\n */\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\n\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\n ? s_delegations[fromTokenId][toTokenId][lpType]\n : amount;\n\n toLocked.delegateAmount -= amount;\n fromLocked.amount += amount;\n\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\n s_delegators[toTokenId][lpType].remove(fromTokenId);\n }\n\n s_locked[toTokenId][lpType] = toLocked;\n s_locked[fromTokenId][lpType] = fromLocked;\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /// @inheritdoc IveIONCore\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) public nonReentrant {\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 toTokenIdsLength = toTokenIds.length;\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONCore\n function removeDelegators(\n uint256[] memory fromTokenIds,\n uint256 toTokenId,\n address lpToken,\n uint256[] memory amounts\n ) external nonReentrant {\n if (fromTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 fromTokenIdsLength = fromTokenIds.length;\n for (uint256 i = 0; i < fromTokenIdsLength; i++) {\n _removeDelegation(fromTokenIds[i], toTokenId, lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONCore\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_newLocked.isPermanent) revert PermanentLock();\n if (_newLocked.end <= block.timestamp) revert LockExpired();\n if (_newLocked.amount <= 0) revert NoLockFound();\n\n s_permanentLockBalance[_lpType] += _newLocked.amount;\n _newLocked.end = 0;\n _newLocked.isPermanent = true;\n _newLocked.boost = _calculateBoost(_MAXTIME);\n\n s_locked[_tokenId][_lpType] = _newLocked;\n _checkpoint(_tokenId, _newLocked, _lpType);\n\n emit PermanentLockCreated(_tokenAddress, _tokenId, _newLocked.amount);\n }\n\n /// @inheritdoc IveIONCore\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (!_newLocked.isPermanent) revert NotPermanentLock();\n if (s_delegatees[_tokenId][_lpType].length() != 0) revert TokenHasDelegatees();\n if (s_delegators[_tokenId][_lpType].length() != 0) revert TokenHasDelegators();\n\n s_permanentLockBalance[_lpType] -= _newLocked.amount;\n _newLocked.end = ((block.timestamp + _MAXTIME) / _WEEK) * _WEEK;\n _newLocked.isPermanent = false;\n\n s_locked[_tokenId][_lpType] = _newLocked;\n _checkpoint(_tokenId, _newLocked, _lpType);\n\n emit PermanentLockRemoved(_tokenAddress, _tokenId, _newLocked.amount);\n }\n\n /**\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\n * @param tokenId Token ID to burn.\n */\n function _burn(uint256 tokenId) internal override {\n super._burn(tokenId);\n }\n\n /**\n * @notice Hook that is called before any token transfer. This includes minting\n * and burning. It updates the ownership mappings and handles delegation and\n * staking logic when transferring tokens between addresses.\n *\n * @param from The address which previously owned the token.\n * @param to The address that will receive the token.\n * @param tokenId The ID of the token being transferred.\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\n\n if (from != address(0) && to != address(0)) {\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType _lpType = s_lpType[asset];\n\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\n uint256[] memory amounts = new uint256[](delegatees.length);\n uint256 delegateesLength = delegatees.length;\n for (uint256 j = 0; j < delegateesLength; j++) {\n amounts[j] = type(uint256).max;\n }\n\n if (delegateesLength != 0) {\n removeDelegatees(tokenId, delegatees, asset, amounts);\n }\n\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\n if (amountStaked != 0) {\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\n }\n\n LockedBalance memory lock = s_locked[tokenId][_lpType];\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\n s_userCumulativeAssetValues[to][asset] += lock.amount;\n }\n }\n }\n\n /// @inheritdoc IveIONCore\n function voting(uint256 _tokenId, bool _voting) external {\n if (_msgSender() != s_voter) revert NotVoter();\n s_voted[_tokenId] = _voting;\n emit Voted(_tokenId, _voting);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n struct DepositVars {\n uint256 supplyBefore;\n uint256 totalLockTime;\n LockedBalance newLocked;\n address from;\n }\n\n /**\n * @notice Deposits tokens for a specific veNFT, updating its locked balance and boost.\n * @dev This function handles the deposit logic for veNFTs, including updating the locked balance,\n * calculating the boost based on the lock duration, and transferring tokens.\n * @param _tokenAddress The address of the token to deposit.\n * @param _tokenId The ID of the veNFT to deposit tokens for.\n * @param _tokenAmount The amount of tokens to deposit.\n * @param _unlockTime The time at which the lock will expire.\n * @param _stakeUnderlying A boolean indicating whether to stake the underlying tokens.\n * @param _oldLocked The previous locked balance of the veNFT.\n * @param _depositType The type of deposit being made.\n * @param _lpType The LP token type associated with the deposit.\n * @param _to The address to which the veNFT is assigned.\n */\n function _depositFor(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n uint256 _unlockTime,\n bool _stakeUnderlying,\n LockedBalance memory _oldLocked,\n DepositType _depositType,\n LpTokenType _lpType,\n address _to\n ) internal {\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\n\n DepositVars memory vars;\n vars.supplyBefore = s_supply[_lpType];\n s_supply[_lpType] = vars.supplyBefore + _tokenAmount;\n\n (\n vars.newLocked.tokenAddress,\n vars.newLocked.amount,\n vars.newLocked.start,\n vars.newLocked.end,\n vars.newLocked.isPermanent,\n vars.newLocked.boost\n ) = (\n _oldLocked.tokenAddress,\n _oldLocked.amount,\n _oldLocked.start,\n _oldLocked.end,\n _oldLocked.isPermanent,\n _oldLocked.boost\n );\n\n vars.newLocked.tokenAddress = _tokenAddress;\n vars.newLocked.amount += _tokenAmount;\n if (_unlockTime != 0) {\n if (vars.newLocked.start == 0) vars.newLocked.start = block.timestamp;\n vars.newLocked.end = _unlockTime;\n vars.totalLockTime = vars.newLocked.end - vars.newLocked.start;\n vars.newLocked.boost = _calculateBoost(vars.totalLockTime);\n }\n s_locked[_tokenId][_lpType] = vars.newLocked;\n\n _checkpoint(_tokenId, vars.newLocked, _lpType);\n\n vars.from = _msgSender();\n if (_tokenAmount != 0) {\n s_userCumulativeAssetValues[ownerOf(_tokenId)][_tokenAddress] += _tokenAmount;\n IERC20(_tokenAddress).safeTransferFrom(vars.from, address(this), _tokenAmount);\n (IStakeStrategy _stakeStrategy, bytes memory _stakeData) = _getStakeStrategy(_lpType);\n if (address(_stakeStrategy) != address(0) && _stakeUnderlying) {\n _handleTokenStake(_to, _tokenId, _tokenAddress, _tokenAmount, _stakeStrategy, _stakeData);\n }\n }\n\n emit Deposit(_to, _tokenId, _depositType, _tokenAmount, vars.newLocked.end, block.timestamp);\n emit Supply(vars.supplyBefore, s_supply[_lpType]);\n }\n\n /**\n * @notice Handles the staking of tokens using a specified staking strategy.\n * @param _to The address to which the stake is attributed.\n * @param _tokenId The ID of the token being staked.\n * @param _tokenAddress The address of the token being staked.\n * @param _tokenAmount The amount of tokens to stake.\n * @param _stakeStrategy The staking strategy to use.\n * @param _stakeData Additional data required for staking.\n */\n function _handleTokenStake(\n address _to,\n uint256 _tokenId,\n address _tokenAddress,\n uint256 _tokenAmount,\n IStakeStrategy _stakeStrategy,\n bytes memory _stakeData\n ) internal {\n IERC20(_tokenAddress).approve(address(_stakeStrategy), _tokenAmount);\n _stakeStrategy.stake(_to, _tokenAmount, _stakeData);\n s_underlyingStake[_tokenId][_tokenAddress] += _tokenAmount;\n }\n\n /**\n * @notice Updates the user point history and epoch for a given token and LP token type.\n * @param _tokenId The ID of the token.\n * @param _newLocked The new locked balance information.\n * @param _lpType The LP token type.\n */\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\n UserPoint memory uNew;\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\n\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\n uNew.slope = _newLocked.amount / _MAXTIME;\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\n }\n\n uNew.ts = block.timestamp;\n uNew.blk = block.number;\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n } else {\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n }\n }\n\n /**\n * @notice Creates a lock for multiple tokens with specified durations and staking options.\n * @param _tokenAddress Array of token addresses to lock.\n * @param _tokenAmount Array of token amounts to lock.\n * @param _duration Array of durations for each lock.\n * @param _stakeUnderlying Array of booleans indicating whether to stake the underlying tokens.\n * @param _to The address to which the lock is attributed.\n * @return The ID of the newly created lock.\n */\n function _createLock(\n address[] memory _tokenAddress,\n uint256[] memory _tokenAmount,\n uint256[] memory _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) internal returns (uint256) {\n uint256 _tokenId = ++s_tokenId;\n uint256 _length = _tokenAddress.length;\n _safeMint(_to, _tokenId);\n\n if (\n _tokenAddress.length != _tokenAmount.length ||\n _tokenAmount.length != _duration.length ||\n _duration.length != _stakeUnderlying.length\n ) {\n revert ArrayMismatch();\n }\n\n for (uint256 i = 0; i < _length; i++) {\n LpTokenType _lpType = s_lpType[_tokenAddress[i]];\n uint256 unlockTime = ((block.timestamp + _duration[i]) / _WEEK) * _WEEK;\n\n if (!s_assetsLocked[_tokenId].add(_tokenAddress[i])) revert DuplicateAsset();\n if (_tokenAmount[i] == 0) revert ZeroAmount();\n if (_duration[i] < s_minimumLockDuration) revert LockDurationTooShort();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n if (_tokenAmount[i] < s_minimumLockAmount[_lpType]) revert MinimumNotMet();\n\n _depositFor(\n _tokenAddress[i],\n _tokenId,\n _tokenAmount[i],\n unlockTime,\n _stakeUnderlying[i],\n s_locked[_tokenId][_lpType],\n DepositType.CREATE_LOCK_TYPE,\n _lpType,\n _to\n );\n }\n return _tokenId;\n }\n\n /**\n * @notice Calculates the boost for a given lock duration.\n * @param _duration The duration of the lock.\n * @return The calculated boost value.\n */\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\n uint256 minDuration = s_minimumLockDuration;\n uint256 maxDuration = _MAXTIME;\n uint256 minBoost = 1e18;\n uint256 maxBoost = 2e18;\n\n if (_duration <= minDuration) {\n return minBoost;\n } else if (_duration >= maxDuration) {\n return maxBoost;\n } else {\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\n }\n }\n\n /**\n * @notice Retrieves the staking strategy and data for a given LP token type.\n * @param _lpType The LP token type.\n * @return _stakeStrategy The staking strategy for the LP token type.\n * @return _stakeData The staking data for the LP token type.\n */\n function _getStakeStrategy(\n LpTokenType _lpType\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\n return (strategy, \"\");\n }\n\n /// @inheritdoc IveIONCore\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external onlyOwner {\n require(_veIONFirstExtension != address(0), \"Invalid First Extension Address\");\n require(_veIONSecondExtension != address(0), \"Invalid Second Extension Address\");\n require(_veIONFirstExtension != _veIONSecondExtension, \"Submitted Identical Addresses\");\n veIONFirstExtension = _veIONFirstExtension;\n veIONSecondExtension = _veIONSecondExtension;\n emit ExtensionsSet(_veIONFirstExtension, _veIONSecondExtension);\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external {\n address impl = veIONFirstExtension;\n require(impl != address(0), \"Implementation not set\");\n\n assembly {\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\n\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/veION/veIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\nimport { IveIONFirstExtension } from \"./interfaces/IveIONFirstExtension.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract First Extensions\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veIONFirstExtension is\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ReentrancyGuardUpgradeable,\n veIONStorage,\n IveIONFirstExtension\n{\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONFirstExtension\n function withdraw(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n address sender = _msgSender();\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (s_voted[_tokenId]) revert AlreadyVoted();\n if (oldLocked.isPermanent) revert PermanentLock();\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\n if (oldLocked.amount == 0 || !s_assetsLocked[_tokenId].contains(_tokenAddress)) revert NoLockFound();\n\n uint256 value = oldLocked.amount;\n s_userCumulativeAssetValues[sender][_tokenAddress] -= value;\n uint256 fee = 0;\n\n if (block.timestamp < oldLocked.end) {\n uint256 daysLocked = ((oldLocked.end - oldLocked.start) * 1e18) / 1 days;\n uint256 daysLeft = ((oldLocked.end - block.timestamp) * 1e18) / 1 days;\n uint256 timeFactor = (daysLeft * 1e18) / daysLocked;\n uint256 veLPLocked = s_supply[_lpType];\n uint256 LPInCirculation = IERC20(_tokenAddress).totalSupply();\n uint256 ratioFactor = 1e18 - (veLPLocked * 1e18) / LPInCirculation;\n fee = (timeFactor * ratioFactor * oldLocked.boost) / 1e36;\n if (fee > s_maxEarlyWithdrawFee) fee = s_maxEarlyWithdrawFee;\n fee = (value * fee) / 1e18;\n value -= fee;\n\n uint256 feeToDistribute = (fee * 75) / 100;\n uint256 feeToProtocol = fee - feeToDistribute;\n s_protocolFees[_lpType] += feeToProtocol;\n s_distributedFees[_lpType] += feeToDistribute;\n }\n\n s_locked[_tokenId][_lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\n s_assetsLocked[_tokenId].remove(_tokenAddress);\n uint256 supplyBefore = s_supply[_lpType];\n\n uint256 amountStaked = s_underlyingStake[_tokenId][_tokenAddress];\n if (amountStaked != 0) {\n (IStakeStrategy _stakeStrategy, ) = _getStakeStrategy(_lpType);\n if (address(_stakeStrategy) != address(0)) {\n _handleTokenWithdrawStake(sender, address(this), _tokenId, _tokenAddress, amountStaked, _stakeStrategy);\n }\n }\n\n s_supply[_lpType] = supplyBefore - oldLocked.amount;\n _checkpoint(_tokenId, LockedBalance(address(0), 0, 0, 0, 0, false, 0), _lpType);\n\n // Check if all LP types for this token have zero balance\n bool shouldBurn = true;\n address[] memory lockedAssets = s_assetsLocked[_tokenId].values();\n uint256 lockedAssetsLength = lockedAssets.length;\n for (uint256 i = 0; i < lockedAssetsLength; i++) {\n LpTokenType assetLpType = s_lpType[lockedAssets[i]];\n if (s_locked[_tokenId][assetLpType].amount > 0) {\n shouldBurn = false;\n break;\n }\n }\n\n if (shouldBurn) _burn(_tokenId);\n\n IERC20(_tokenAddress).safeTransfer(sender, value);\n emit Withdraw(sender, _tokenId, value, block.timestamp);\n emit Supply(supplyBefore, supplyBefore - oldLocked.amount);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function merge(uint256 _from, uint256 _to) external nonReentrant {\n if (_from == _to) revert SameNFT();\n if (s_voted[_from] || s_voted[_to]) revert AlreadyVoted();\n if (ownerOf(_from) != _msgSender()) revert NotOwner();\n if (ownerOf(_to) != _msgSender()) revert NotOwner();\n\n address[] memory assetsLocked = s_assetsLocked[_from].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType lpType = s_lpType[asset];\n\n LockedBalance memory oldLockedTo = s_locked[_to][lpType];\n LockedBalance memory oldLockedFrom = s_locked[_from][lpType];\n\n if (oldLockedTo.end != 0 && oldLockedTo.end <= block.timestamp) revert LockExpired();\n if (oldLockedFrom.end != 0 && oldLockedFrom.end <= block.timestamp) revert LockExpired();\n if (oldLockedFrom.isPermanent) revert PermanentLock();\n if (oldLockedTo.isPermanent) revert PermanentLock();\n\n LockedBalance memory newLockedTo;\n\n newLockedTo.tokenAddress = asset;\n newLockedTo.amount = oldLockedTo.amount + oldLockedFrom.amount;\n newLockedTo.start = oldLockedTo.start < oldLockedFrom.start && oldLockedTo.start != 0\n ? oldLockedTo.start\n : oldLockedFrom.start;\n newLockedTo.end = oldLockedTo.end > oldLockedFrom.end ? oldLockedTo.end : oldLockedFrom.end;\n newLockedTo.boost = _calculateBoost(newLockedTo.end - newLockedTo.start);\n\n s_locked[_from][lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\n _checkpoint(_from, LockedBalance(address(0), 0, 0, 0, 0, false, 0), lpType);\n s_locked[_to][lpType] = newLockedTo;\n _checkpoint(_to, newLockedTo, lpType);\n\n s_assetsLocked[_from].remove(asset);\n if (!s_assetsLocked[_to].contains(asset)) {\n s_assetsLocked[_to].add(asset);\n }\n\n if (s_underlyingStake[_from][asset] != 0) {\n s_underlyingStake[_to][asset] += s_underlyingStake[_from][asset];\n s_underlyingStake[_from][asset] = 0;\n }\n }\n _burn(_from);\n emit MergeCompleted(_from, _to, assetsLocked, assetsLocked.length);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function split(\n address _tokenAddress,\n uint256 _from,\n uint256 _splitAmount\n ) external nonReentrant returns (uint256 _tokenId1, uint256 _tokenId2) {\n address ownerFrom = _ownerOf(_from);\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_from][_lpType];\n uint256 minimumLockAmount = s_minimumLockAmount[_lpType];\n\n if (s_voted[_from]) revert AlreadyVoted();\n if (!s_canSplit[ownerFrom] && !s_canSplit[address(0)]) revert SplitNotAllowed();\n if (ownerFrom != _msgSender()) revert NotOwner();\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\n if (_splitAmount >= oldLocked.amount) revert AmountTooBig();\n if (_splitAmount < minimumLockAmount) revert SplitTooSmall();\n if (oldLocked.amount - _splitAmount < minimumLockAmount) revert NotEnoughRemainingAfterSplit();\n\n LockedBalance memory oldLockedTemp = oldLocked;\n\n oldLocked.amount -= _splitAmount;\n s_locked[_from][_lpType] = oldLocked;\n _checkpoint(_from, oldLocked, _lpType);\n\n LockedBalance memory splitLocked = oldLockedTemp;\n splitLocked.amount = _splitAmount;\n _tokenId2 = _createSplitVE(ownerFrom, splitLocked, _lpType, _tokenAddress);\n _tokenId1 = _from;\n\n if (s_underlyingStake[_from][_tokenAddress] != 0) {\n s_underlyingStake[_from][_tokenAddress] -= _splitAmount;\n s_underlyingStake[_tokenId2][_tokenAddress] = _splitAmount;\n }\n\n emit SplitCompleted(_from, _tokenId1, _tokenId2, _splitAmount, _tokenAddress);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function claimEmissions(address _tokenAddress) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n if (_stakeStrategy.userStakingWallet(_msgSender()) == address(0)) revert NoUnderlyingStake();\n _stakeStrategy.claim(_msgSender());\n emit EmissionsClaimed(_msgSender(), _tokenAddress);\n }\n\n /**\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\n * @param tokenId Token ID to burn.\n */\n function _burn(uint256 tokenId) internal override {\n super._burn(tokenId);\n }\n\n /**\n * @notice Hook that is called before any token transfer. This includes minting\n * and burning. It updates the ownership mappings and handles delegation and\n * staking logic when transferring tokens between addresses.\n *\n * @param from The address which previously owned the token.\n * @param to The address that will receive the token.\n * @param tokenId The ID of the token being transferred.\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\n\n if (from != address(0) && to != address(0)) {\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType _lpType = s_lpType[asset];\n\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\n uint256[] memory amounts = new uint256[](delegatees.length);\n uint256 delegateesLength = delegatees.length;\n for (uint256 j = 0; j < delegateesLength; j++) {\n amounts[j] = type(uint256).max;\n }\n\n if (delegateesLength != 0) {\n removeDelegatees(tokenId, delegatees, asset, amounts);\n }\n\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\n if (amountStaked != 0) {\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\n }\n\n LockedBalance memory lock = s_locked[tokenId][_lpType];\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\n s_userCumulativeAssetValues[to][asset] += lock.amount;\n }\n }\n }\n\n /**\n * @dev Internal function to remove a delegation between two veNFTs.\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\n * @param toTokenId ID of the veNFT to which delegation is being removed.\n * @param lpToken Address of the LP token associated with the delegation.\n * @param amount Amount of delegation to remove.\n */\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\n\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\n ? s_delegations[fromTokenId][toTokenId][lpType]\n : amount;\n\n toLocked.delegateAmount -= amount;\n fromLocked.amount += amount;\n\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\n s_delegators[toTokenId][lpType].remove(fromTokenId);\n }\n\n s_locked[toTokenId][lpType] = toLocked;\n s_locked[fromTokenId][lpType] = fromLocked;\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /**\n * @notice Removes delegatees from a specific veNFT\n * @param fromTokenId ID of the veNFT from which delegatees are removed\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegatee\n */\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) public nonReentrant {\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 toTokenIdsLength = toTokenIds.length;\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONFirstExtension\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external nonReentrant {\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n s_delegatorsBlocked[_tokenId][_tokenAddress] = _blocked;\n emit DelegatorsBlocked(_tokenId, _tokenAddress, _blocked);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /**\n * @notice Handles the withdrawal of staked tokens using a specified staking strategy.\n * @param _owner The address of the owner of the stake.\n * @param _withdrawTo The address to which the withdrawn tokens are sent.\n * @param _tokenId The ID of the token being withdrawn.\n * @param _tokenAddress The address of the token being withdrawn.\n * @param _tokenAmount The amount of tokens to withdraw.\n * @param _stakeStrategy The staking strategy to use for withdrawal.\n */\n function _handleTokenWithdrawStake(\n address _owner,\n address _withdrawTo,\n uint256 _tokenId,\n address _tokenAddress,\n uint256 _tokenAmount,\n IStakeStrategy _stakeStrategy\n ) internal {\n _stakeStrategy.claim(_owner);\n _stakeStrategy.withdraw(_owner, _withdrawTo, _tokenAmount);\n s_underlyingStake[_tokenId][_tokenAddress] -= _tokenAmount;\n }\n\n /**\n * @notice Updates the user point history and epoch for a given token and LP token type.\n * @param _tokenId The ID of the token.\n * @param _newLocked The new locked balance information.\n * @param _lpType The LP token type.\n */\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\n UserPoint memory uNew;\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\n\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\n uNew.slope = _newLocked.amount / _MAXTIME;\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\n }\n\n uNew.ts = block.timestamp;\n uNew.blk = block.number;\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n } else {\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n }\n }\n\n /**\n * @notice Calculates the boost for a given lock duration.\n * @param _duration The duration of the lock.\n * @return The calculated boost value.\n */\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\n uint256 minDuration = s_minimumLockDuration;\n uint256 maxDuration = _MAXTIME;\n uint256 minBoost = 1e18;\n uint256 maxBoost = 2e18;\n\n if (_duration <= minDuration) {\n return minBoost;\n } else if (_duration >= maxDuration) {\n return maxBoost;\n } else {\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\n }\n }\n\n /**\n * @notice Creates a new split veNFT with specified locked balance and LP token type.\n * @param _to The address to which the new veNFT is attributed.\n * @param _newLocked The locked balance information for the new veNFT.\n * @param _lpType The LP token type.\n * @param _tokenAddress The address of the token being locked.\n * @return _tokenId The ID of the newly created veNFT.\n */\n function _createSplitVE(\n address _to,\n LockedBalance memory _newLocked,\n LpTokenType _lpType,\n address _tokenAddress\n ) private returns (uint256 _tokenId) {\n _tokenId = ++s_tokenId;\n _safeMint(_to, _tokenId);\n s_locked[_tokenId][_lpType] = _newLocked;\n s_assetsLocked[_tokenId].add(_tokenAddress);\n _checkpoint(_tokenId, _newLocked, _lpType);\n }\n\n /**\n * @notice Retrieves the staking strategy and data for a given LP token type.\n * @param _lpType The LP token type.\n * @return _stakeStrategy The staking strategy for the LP token type.\n * @return _stakeData The staking data for the LP token type.\n */\n function _getStakeStrategy(\n LpTokenType _lpType\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\n return (strategy, \"\");\n }\n\n /**\n * @notice Calculates the total boost for a given token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return The total boost value.\n */\n function _getTotalBoost(uint256 _tokenId, LpTokenType _lpType) internal view returns (uint256) {\n uint256 totalBoost = s_locked[_tokenId][_lpType].boost;\n if (s_limitedBoostActive) totalBoost += s_limitedBoost;\n if (s_veAERO == address(0)) return totalBoost;\n\n address _owner = ownerOf(_tokenId);\n IAeroVoter aeroVoter = IAeroVoter(s_aeroVoting);\n IAeroVotingEscrow veAERO = IAeroVotingEscrow(s_veAERO);\n uint256 _balance = veAERO.balanceOf(_owner);\n for (uint256 i = 0; i < _balance; i++) {\n uint256 veAeroTokenId = veAERO.ownerToNFTokenIdList(_owner, i);\n uint256 weightToVoteRatio = (aeroVoter.votes(veAeroTokenId, s_ionicPool) * 1e18) / aeroVoter.weights(s_ionicPool);\n totalBoost += (s_aeroVoterBoost * weightToVoteRatio) / 1e18;\n }\n\n return totalBoost;\n }\n\n /**\n * @notice Retrieves the ETH price of a given token.\n * @dev Uses the MasterPriceOracle to fetch the price.\n * @param _token The address of the token for which the ETH price is requested.\n * @return The ETH price of the specified token.\n */\n function _getEthPrice(address _token) internal view returns (uint256) {\n IMasterPriceOracle mpo = IMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n return mpo.price(_token);\n }\n\n // // ╔═══════════════════════════════════════════════════════════════════════════╗\n // // ║ View Functions ║\n // // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONFirstExtension\n function balanceOfNFT(\n uint256 _tokenId\n ) public view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts) {\n address[] memory assetsLocked = s_assetsLocked[_tokenId].values();\n\n _assets = new address[](assetsLocked.length);\n _balances = new uint256[](assetsLocked.length);\n _boosts = new uint256[](assetsLocked.length);\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType lpType = s_lpType[asset];\n LockedBalance memory lockedBalance = s_locked[_tokenId][lpType];\n _boosts[i] = _getTotalBoost(_tokenId, lpType);\n _assets[i] = asset;\n _balances[i] = BalanceLogicLibrary.balanceOfNFTAt(\n s_userPointEpoch,\n s_userPointHistory,\n lpType,\n _tokenId,\n block.timestamp,\n lockedBalance.isPermanent\n );\n }\n\n return (_assets, _balances, _boosts);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\n IVoter voter = IVoter(s_voter);\n address[] memory lpTokens = voter.getAllLpRewardTokens();\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 i = 0; i < lpTokensLength; i++) {\n uint256 ethValue = (s_userCumulativeAssetValues[_owner][lpTokens[i]] * _getEthPrice(lpTokens[i])) / PRECISION;\n totalValue += ethValue;\n }\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external {\n address impl = veIONSecondExtension;\n require(impl != address(0), \"Implementation not set\");\n\n assembly {\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\n\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/veION/veIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\nimport { IveIONSecondExtension } from \"./interfaces/IveIONSecondExtension.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract Second Extension\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veIONSecondExtension is\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ReentrancyGuardUpgradeable,\n veIONStorage,\n IveIONSecondExtension\n{\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /// @inheritdoc IveIONSecondExtension\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external onlyOwner {\n require(_tokens.length == _isWhitelisted.length, \"Unequal Arrays\");\n for (uint256 i; i < _tokens.length; i++) s_whitelistedToken[_tokens[i]] = _isWhitelisted[i];\n emit TokensWhitelisted(_tokens, _isWhitelisted);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external onlyOwner {\n LpTokenType lpType = s_lpType[_tokenAddress];\n uint256 protocolFees = s_protocolFees[lpType];\n require(protocolFees > 0, \"No protocol fees available\");\n s_protocolFees[lpType] = 0;\n IERC20(_tokenAddress).safeTransfer(_recipient, protocolFees);\n emit ProtocolFeesWithdrawn(_tokenAddress, _recipient, protocolFees);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external onlyOwner {\n LpTokenType lpType = s_lpType[_tokenAddress];\n uint256 distributedFees = s_distributedFees[lpType];\n require(distributedFees > 0, \"No distributed fees available\");\n s_distributedFees[lpType] = 0;\n IERC20(_tokenAddress).safeTransfer(_recipient, distributedFees);\n emit DistributedFeesWithdrawn(_tokenAddress, _recipient, distributedFees);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Setter Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONSecondExtension\n function toggleSplit(address _account, bool _isAllowed) external onlyOwner {\n s_canSplit[_account] = _isAllowed;\n emit SplitToggle(_account, _isAllowed);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function toggleLimitedBoost(bool _isBoosted) external onlyOwner {\n s_limitedBoostActive = _isBoosted;\n emit LimitedBoostToggled(_isBoosted);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setLimitedTimeBoost(uint256 _boostAmount) external onlyOwner {\n if (_boostAmount <= 0) revert BoostAmountMustBeGreaterThanZero();\n s_limitedBoost = _boostAmount;\n emit LimitedTimeBoostSet(_boostAmount);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setVoter(address _voter) external onlyOwner {\n if (address(_voter) == address(0)) revert InvalidAddress();\n s_voter = _voter;\n emit VoterSet(_voter);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external onlyOwner {\n if (_minimumAmount <= 0) revert MinimumAmountMustBeGreaterThanZero();\n LpTokenType lpType = s_lpType[_tokenAddress];\n s_minimumLockAmount[lpType] = _minimumAmount;\n emit MinimumLockAmountSet(_tokenAddress, _minimumAmount);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMinimumLockDuration(uint256 _minimumLockDuration) external onlyOwner {\n if (_minimumLockDuration <= 0) revert MinimumLockDurationMustBeGreaterThanZero();\n s_minimumLockDuration = _minimumLockDuration;\n emit MinimumLockDurationSet(_minimumLockDuration);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setIonicPool(address _ionicPool) external onlyOwner {\n if (address(_ionicPool) == address(0)) revert InvalidAddress();\n s_ionicPool = _ionicPool;\n emit IonicPoolSet(_ionicPool);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setAeroVoting(address _aeroVoting) external onlyOwner {\n if (address(_aeroVoting) == address(0)) revert InvalidAddress();\n s_aeroVoting = _aeroVoting;\n emit AeroVotingSet(_aeroVoting);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external onlyOwner {\n if (_aeroVoterBoost <= 0) revert AeroBoostAmountMustBeGreaterThanZero();\n s_aeroVoterBoost = _aeroVoterBoost;\n emit AeroVoterBoostSet(_aeroVoterBoost);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external onlyOwner {\n if (_maxEarlyWithdrawFee <= 0) revert MaxEarlyWithdrawFeeMustBeGreaterThanZero();\n s_maxEarlyWithdrawFee = _maxEarlyWithdrawFee;\n emit MaxEarlyWithdrawFeeSet(_maxEarlyWithdrawFee);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setLpTokenType(address _token, LpTokenType _type) external onlyOwner {\n if (_token == address(0)) revert InvalidTokenAddress();\n s_lpType[_token] = _type;\n emit LpTokenTypeSet(_token, _type);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external onlyOwner {\n if (address(_strategy) == address(0)) revert InvalidStrategyAddress();\n s_stakeStrategy[_lpType] = IStakeStrategy(_strategy);\n emit StakeStrategySet(_lpType, address(_strategy));\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setVeAERO(address _veAERO) external onlyOwner {\n if (_veAERO == address(0)) revert InvalidVeAEROAddress();\n s_veAERO = _veAERO;\n emit VeAEROSet(_veAERO);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONSecondExtension\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory) {\n return s_locked[_tokenId][_lpType];\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory) {\n return s_ownerToTokenIds[_owner].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory) {\n return s_assetsLocked[_tokenId].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\n return s_delegatees[_tokenId][_lpType].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\n return s_delegators[_tokenId][_lpType].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getUserPoint(\n uint256 _tokenId,\n LpTokenType _lpType,\n uint256 _epoch\n ) external view returns (UserPoint memory) {\n return s_userPointHistory[_tokenId][_lpType][_epoch];\n }\n}\n" + }, + "contracts/veION/veIONStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./interfaces/IveIONStructsEnumsErrorsEvents.sol\";\n\nabstract contract veIONStorage is IveIONStructsEnumsErrorsEvents {\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Constants ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Represents the duration of one week in seconds.\n uint256 internal constant _WEEK = 1 weeks;\n /// @notice Represents the maximum lock time in seconds (2 years).\n uint256 internal constant _MAXTIME = 2 * 365 * 86400;\n /// @notice Precision used for calculations, set to 1e18.\n uint256 public constant PRECISION = 1e18;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice The current token ID counter.\n uint256 public s_tokenId;\n /// @notice The amount of limited boost available.\n uint256 public s_limitedBoost;\n /// @notice Indicates whether the limited boost is active.\n bool public s_limitedBoostActive;\n /// @notice Address of the veAERO contract.\n address public s_veAERO;\n /// @notice Address of the AeroVoting contract.\n address public s_aeroVoting;\n /// @notice Address of the Ionic Pool.\n address public s_ionicPool;\n /// @notice Address of the voter contract.\n address public s_voter;\n /// @notice The boost amount for AeroVoter.\n uint256 public s_aeroVoterBoost;\n /// @notice The minimum duration for locking.\n uint256 public s_minimumLockDuration;\n /// @notice The maximum fee for early withdrawal.\n uint256 public s_maxEarlyWithdrawFee;\n /// @notice The AddressesProvider contract used for address management.\n IAddressesProvider public ap;\n /// @notice The address of the logic contract for the veION first extension.\n address public veIONFirstExtension;\n /// @notice The address of the logic contract for the veION second extension.\n address public veIONSecondExtension;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @dev Maps LP token types to their minimum lock amounts.\n mapping(LpTokenType => uint256) public s_minimumLockAmount;\n /// @dev Maps token addresses to their whitelist status.\n mapping(address => bool) public s_whitelistedToken;\n /// @dev Maps token addresses to their corresponding LP token types.\n mapping(address => LpTokenType) public s_lpType;\n /// @dev Maps user addresses to their ability to split.\n mapping(address => bool) public s_canSplit;\n /// @dev Maps token IDs and LP token types to their locked balances.\n mapping(uint256 => mapping(LpTokenType => LockedBalance)) public s_locked;\n /// @dev Maps token IDs and LP token types to user epochs.\n mapping(uint256 => mapping(LpTokenType => uint256)) public s_userPointEpoch;\n /// @dev Maps token IDs and LP token types to user point history.\n mapping(uint256 => mapping(LpTokenType => UserPoint[1000000000])) public s_userPointHistory;\n /// @dev Maps token IDs to sets of locked asset addresses.\n mapping(uint256 => EnumerableSet.AddressSet) internal s_assetsLocked;\n /// @dev Maps token IDs to their voting status.\n mapping(uint256 => bool) public s_voted;\n /// @dev Maps LP token types to their total supply.\n mapping(LpTokenType => uint256) public s_supply;\n /// @dev Maps LP token types to their permanent lock balances.\n mapping(LpTokenType => uint256) public s_permanentLockBalance;\n /// @dev Maps LP token types to their underlying stake strategies.\n mapping(LpTokenType => IStakeStrategy) public s_stakeStrategy;\n /// @dev Maps token IDs and LP token addresses to their underlying stake amounts.\n mapping(uint256 => mapping(address => uint256)) public s_underlyingStake;\n /// @dev Maps LP token types to their protocol fees.\n mapping(LpTokenType => uint256) public s_protocolFees;\n /// @dev Maps LP token types to their distributed fees.\n mapping(LpTokenType => uint256) public s_distributedFees;\n /// @dev Maps delegators, delegatees, and LP token types to delegation amounts.\n mapping(uint256 => mapping(uint256 => mapping(LpTokenType => uint256))) public s_delegations;\n /// @dev Maps token IDs and LP token types to sets of delegatees.\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegatees;\n /// @dev Maps token IDs and LP token types to sets of delegators.\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegators;\n /// @dev Maps owner addresses to sets of token IDs they own.\n mapping(address => EnumerableSet.UintSet) internal s_ownerToTokenIds;\n /// @dev Maps user addresses and token addresses to cumulative asset values.\n mapping(address => mapping(address => uint256)) public s_userCumulativeAssetValues;\n /// @dev Maps token Id and lp onto delegator permissioning.\n mapping(uint256 => mapping(address => bool)) public s_delegatorsBlocked;\n\n uint256[50] private __gap;\n}\n" + }, + "contracts/veION/Voter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\nimport { IveION } from \"./interfaces/IveION.sol\";\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title Voter Contract\n * @notice This contract allows veION holders to vote for various markets\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract Voter is IVoter, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n ///@notice The ve token that governs these contracts\n address public ve;\n ///@notice Base token of ve contract\n address internal rewardToken;\n ///@notice Standard OZ IGovernor using ve for vote weights\n address public governor;\n ///@notice Master Price Oracle instance\n MasterPriceOracle public mpo;\n ///@notice List of LP tokens\n address[] public lpTokens;\n ///@notice Total Voting Weights for each address\n mapping(address => uint256) public totalWeight;\n ///@notice Maximum number of markets one voter can vote for at once\n uint256 public maxVotingNum;\n ///@notice Minimum value for maxVotingNum\n uint256 internal constant MIN_MAXVOTINGNUM = 10;\n ///@notice All markets viable for incentives\n Market[] public markets;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n ///@notice Mapping from Reward Accumulator to Bribes Voting Reward\n mapping(address => address) public rewardAccumulatorToBribe;\n ///@notice Mapping from Market to Market Side to LP Asset to weights\n mapping(address => mapping(MarketSide => mapping(address => uint256))) public weights;\n ///@notice Mapping from NFT to Pool to LP Asset to Votes\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public votes;\n ///@notice Mapping from NFT to Pool to LP Asset to Base Weights\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public baseWeights;\n ///@notice Mapping from NFT to List of markets voted for by NFT\n mapping(uint256 => mapping(address => address[])) public marketVote;\n ///@notice Mapping from NFT to List of market vote sides voted for by NFT\n mapping(uint256 => mapping(address => MarketSide[])) public marketVoteSide;\n ///@notice Mapping from NFT to Total voting weight of NFT\n mapping(uint256 => mapping(address => uint256)) public usedWeights;\n ///@notice Mapping from NFT to Timestamp of last vote (ensures single vote per epoch)\n mapping(uint256 => uint256) public lastVoted;\n ///@notice Mapping from Token to Whitelisted status\n mapping(address => bool) public isWhitelistedToken;\n ///@notice Mapping from TokenId to Whitelisted status\n mapping(uint256 => bool) public isWhitelistedNFT;\n ///@notice Mapping from Reward Accumulator to Liveness status\n mapping(address => bool) public isAlive;\n ///@notice Mapping from Market to Market Side to Reward Accumulator\n mapping(address => mapping(MarketSide => address)) public marketToRewardAccumulators;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Modifiers ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /**\n * @notice Modifier to ensure that the function is called only in a new epoch since the last vote.\n * @dev Reverts if the current epoch start time is less than or equal to the last voted timestamp for the given token ID.\n * Also reverts if the current time is within the vote distribution window.\n * @param _tokenId The ID of the veNFT to check the last voted timestamp.\n */\n modifier onlyNewEpoch(uint256 _tokenId) {\n if (IonicTimeLibrary.epochStart(block.timestamp) <= lastVoted[_tokenId]) revert AlreadyVotedOrDeposited();\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\n _;\n }\n\n /**\n * @notice Modifier to ensure that the function is called only by the governance address.\n * @dev Reverts if the caller is not the current governor.\n */\n modifier onlyGovernance() {\n if (msg.sender != governor) revert NotGovernor();\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the Voter contract with the specified parameters.\n * @dev Requires initialization with at least one reward token.\n * @param _tokens An array of token addresses to be whitelisted.\n * @param _mpo The MasterPriceOracle contract address.\n * @param _rewardToken The address of the reward token.\n * @param _ve The address of the veION contract.\n * @custom:reverts TokensArrayEmpty if the _tokens array is empty.\n */\n function initialize(\n address[] calldata _tokens,\n MasterPriceOracle _mpo,\n address _rewardToken,\n address _ve\n ) external initializer {\n __Ownable2Step_init();\n __ReentrancyGuard_init();\n uint256 _length = _tokens.length;\n if (_length == 0) revert TokensArrayEmpty();\n for (uint256 i = 0; i < _length; i++) {\n _whitelistToken(_tokens[i], true);\n }\n mpo = _mpo;\n rewardToken = _rewardToken;\n ve = _ve;\n governor = msg.sender;\n\n emit Initialized(_tokens, address(_mpo), _rewardToken, _ve, governor);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function vote(\n uint256 _tokenId,\n address[] calldata _marketVote,\n MarketSide[] calldata _marketVoteSide,\n uint256[] calldata _weights\n ) external nonReentrant onlyNewEpoch(_tokenId) {\n VoteLocalVars memory vars;\n vars.sender = msg.sender;\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != vars.sender) revert NotOwner();\n if (\n _marketVote.length != _marketVoteSide.length ||\n _marketVoteSide.length != _weights.length ||\n _weights.length != _marketVote.length\n ) revert UnequalLengths();\n if (_marketVote.length > maxVotingNum) revert TooManyPools();\n vars.timestamp = block.timestamp;\n if ((vars.timestamp > IonicTimeLibrary.epochVoteEnd(vars.timestamp)) && !isWhitelistedNFT[_tokenId])\n revert NotWhitelistedNFT();\n uint256 totalVoteWeight = 0;\n\n for (uint256 i = 0; i < _marketVote.length; i++) {\n totalVoteWeight += _weights[i];\n }\n for (uint256 i = 0; i < lpTokens.length; i++) {\n _reset(_tokenId, lpTokens[i]);\n }\n\n lastVoted[_tokenId] = vars.timestamp;\n (vars.votingLPs, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(_tokenId);\n for (uint256 j = 0; j < vars.votingLPs.length; j++) {\n _vote(\n _tokenId,\n vars.votingLPs[j],\n (vars.votingLPBalances[j] * vars.boosts[j]) / 1e18,\n _marketVote,\n _marketVoteSide,\n _weights,\n totalVoteWeight\n );\n }\n }\n\n /// @inheritdoc IVoter\n function poke(uint256 _tokenId) external nonReentrant {\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\n (address[] memory _votingLPs, uint256[] memory _votingLPBalances, uint256[] memory _boosts) = IveION(ve)\n .balanceOfNFT(_tokenId);\n\n for (uint256 i = 0; i < _votingLPs.length; i++) {\n uint256 effectiveBalance = (_votingLPBalances[i] * _boosts[i]) / 1e18;\n _poke(_tokenId, lpTokens[i], effectiveBalance);\n }\n }\n\n /// @inheritdoc IVoter\n function reset(uint256 _tokenId) public nonReentrant onlyNewEpoch(_tokenId) {\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != msg.sender) revert NotOwner();\n for (uint256 i = 0; i < lpTokens.length; i++) {\n _reset(_tokenId, lpTokens[i]);\n }\n }\n\n /// @inheritdoc IVoter\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external nonReentrant {\n if (_bribes.length != _tokens.length) revert UnequalLengths();\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n uint256 _length = _bribes.length;\n for (uint256 i = 0; i < _length; i++) {\n IBribeRewards(_bribes[i]).getReward(_tokenId, _tokens[i]);\n }\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Admin External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function distributeRewards() external onlyGovernance {\n if (block.timestamp <= IonicTimeLibrary.epochVoteEnd(block.timestamp)) revert NotDistributeWindow();\n uint256 _reward = IERC20(rewardToken).balanceOf(address(this));\n uint256 _totalLPValueETH = _calculateTotalLPValue();\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 _marketWeightETH = _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\n if (_marketWeightETH > 0) {\n IERC20(rewardToken).safeTransfer(\n marketToRewardAccumulators[markets[i].marketAddress][markets[i].side],\n (_reward * _marketWeightETH) / _totalLPValueETH\n );\n }\n }\n }\n\n /// @inheritdoc IVoter\n function whitelistToken(address _token, bool _bool) external onlyGovernance {\n _whitelistToken(_token, _bool);\n }\n\n /// @inheritdoc IVoter\n function whitelistNFT(uint256 _tokenId, bool _bool) external onlyGovernance {\n address _sender = msg.sender;\n isWhitelistedNFT[_tokenId] = _bool;\n emit WhitelistNFT(_sender, _tokenId, _bool);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /**\n * @notice Internal function to handle voting logic for a given token ID and voting asset.\n * @param _tokenId The ID of the token used for voting.\n * @param _votingAsset The address of the asset being used for voting.\n * @param _votingAssetBalance The balance of the voting asset.\n * @param _marketVote An array of market addresses to vote for.\n * @param _marketVoteSide An array of market sides corresponding to the markets.\n * @param _weights An array of weights for each market.\n * @param totalVoteWeight The total weight of the vote.\n */\n function _vote(\n uint256 _tokenId,\n address _votingAsset,\n uint256 _votingAssetBalance,\n address[] memory _marketVote,\n MarketSide[] memory _marketVoteSide,\n uint256[] memory _weights,\n uint256 totalVoteWeight\n ) internal {\n VoteVars memory vars;\n uint256 marketVoteLength = _marketVote.length;\n for (uint256 i = 0; i < marketVoteLength; i++) {\n vars.market = _marketVote[i];\n vars.marketSide = _marketVoteSide[i];\n vars.rewardAccumulator = marketToRewardAccumulators[vars.market][vars.marketSide];\n vars.bribes = rewardAccumulatorToBribe[vars.rewardAccumulator];\n if (_weights[i] == 0) revert ZeroWeight();\n if (vars.rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(vars.market);\n if (!isAlive[vars.rewardAccumulator]) revert RewardAccumulatorNotAlive(vars.rewardAccumulator);\n\n vars.marketWeight = (_weights[i] * _votingAssetBalance) / totalVoteWeight;\n if (votes[_tokenId][vars.market][vars.marketSide][_votingAsset] != 0) revert NonZeroVotes();\n\n marketVote[_tokenId][_votingAsset].push(vars.market);\n marketVoteSide[_tokenId][_votingAsset].push(vars.marketSide);\n\n weights[vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\n votes[_tokenId][vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\n baseWeights[_tokenId][vars.market][vars.marketSide][_votingAsset] = _weights[i];\n IBribeRewards(vars.bribes).deposit(_votingAsset, uint256(vars.marketWeight), _tokenId);\n vars.usedWeight += vars.marketWeight;\n vars.totalWeight += vars.marketWeight;\n emit Voted(\n msg.sender,\n vars.market,\n _tokenId,\n vars.marketWeight,\n weights[vars.market][vars.marketSide][_votingAsset],\n block.timestamp\n );\n }\n IveION(ve).voting(_tokenId, true);\n totalWeight[_votingAsset] += uint256(vars.totalWeight);\n usedWeights[_tokenId][_votingAsset] = uint256(vars.usedWeight);\n }\n\n /**\n * @notice Internal function to update voting balances for a given token ID and voting asset.\n * @param _tokenId The ID of the token whose voting balance is being updated.\n * @param _votingAsset The address of the asset being used for voting.\n * @param _votingAssetBalance The balance of the voting asset.\n */\n function _poke(uint256 _tokenId, address _votingAsset, uint256 _votingAssetBalance) internal {\n address[] memory _marketVote = marketVote[_tokenId][_votingAsset];\n MarketSide[] memory _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\n uint256 _marketCnt = _marketVote.length;\n uint256[] memory _weights = new uint256[](_marketCnt);\n uint256 totalVoteWeight = 0;\n\n for (uint256 i = 0; i < _marketCnt; i++) {\n _weights[i] = baseWeights[_tokenId][_marketVote[i]][_marketVoteSide[i]][_votingAsset];\n }\n\n for (uint256 i = 0; i < _marketVote.length; i++) {\n totalVoteWeight += _weights[i];\n }\n\n _reset(_tokenId, _votingAsset);\n _vote(_tokenId, _votingAsset, _votingAssetBalance, _marketVote, _marketVoteSide, _weights, totalVoteWeight);\n }\n\n /**\n * @notice Internal function to reset voting state for a given token ID and voting asset.\n * @param _tokenId The ID of the token whose voting state is being reset.\n * @param _votingAsset The address of the asset being used for voting.\n */\n function _reset(uint256 _tokenId, address _votingAsset) internal {\n address[] storage _marketVote = marketVote[_tokenId][_votingAsset];\n MarketSide[] storage _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\n uint256 _marketVoteCnt = _marketVote.length;\n\n for (uint256 i = 0; i < _marketVoteCnt; i++) {\n address _market = _marketVote[i];\n MarketSide _marketSide = _marketVoteSide[i];\n\n uint256 _votes = votes[_tokenId][_market][_marketSide][_votingAsset];\n if (_votes != 0) {\n weights[_market][_marketSide][_votingAsset] -= _votes;\n delete votes[_tokenId][_market][_marketSide][_votingAsset];\n IBribeRewards(rewardAccumulatorToBribe[marketToRewardAccumulators[_market][_marketSide]]).withdraw(\n _votingAsset,\n uint256(_votes),\n _tokenId\n );\n totalWeight[_votingAsset] -= _votes;\n emit Abstained(\n msg.sender,\n _market,\n _tokenId,\n _votes,\n weights[_market][_marketSide][_votingAsset],\n block.timestamp\n );\n }\n }\n usedWeights[_tokenId][_votingAsset] = 0;\n delete marketVote[_tokenId][_votingAsset];\n delete marketVoteSide[_tokenId][_votingAsset];\n IveION(ve).voting(_tokenId, false);\n }\n\n /**\n * @notice Internal function to whitelist or unwhitelist a token for use in bribes.\n * @param _token The address of the token to be whitelisted or unwhitelisted.\n * @param _bool Boolean indicating whether to whitelist (true) or unwhitelist (false) the token.\n */\n function _whitelistToken(address _token, bool _bool) internal {\n isWhitelistedToken[_token] = _bool;\n emit WhitelistToken(msg.sender, _token, _bool);\n }\n\n /**\n * @notice Internal function to calculate the ETH value of a given amount of LP tokens.\n * @param amount The amount of LP tokens.\n * @param lpToken The address of the LP token.\n * @return The ETH value of the given amount of LP tokens.\n */\n function _getTokenEthValue(uint256 amount, address lpToken) internal view returns (uint256) {\n uint256 tokenPriceInEth = mpo.price(lpToken); // Fetch price of 1 lpToken in ETH\n uint256 ethValue = amount * tokenPriceInEth;\n return ethValue;\n }\n\n /**\n * @notice Internal function to calculate the total ETH value of all LP tokens in the markets.\n * @return _totalLPValueETH The total ETH value of all LP tokens.\n */\n function _calculateTotalLPValue() internal view returns (uint256 _totalLPValueETH) {\n uint256 marketLength = markets.length;\n for (uint256 i = 0; i < marketLength; i++)\n _totalLPValueETH += _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\n }\n\n /**\n * @notice Internal function to calculate the ETH value of LP tokens for a specific market.\n * @param _market The address of the market.\n * @param _marketSide The side of the market.\n * @return _marketLPValueETH The ETH value of LP tokens for the specified market.\n */\n function _calculateMarketLPValue(\n address _market,\n MarketSide _marketSide\n ) internal view returns (uint256 _marketLPValueETH) {\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 i = 0; i < lpTokensLength; i++) {\n uint256 _lpAmount = weights[_market][_marketSide][lpTokens[i]];\n uint256 tokenEthValue = _getTokenEthValue(_lpAmount, lpTokens[i]);\n _marketLPValueETH += tokenEthValue;\n }\n }\n\n /**\n * @notice Internal function to check if a market exists.\n * @param _marketAddress The address of the market.\n * @param _marketSide The side of the market.\n * @return True if the market exists, false otherwise.\n */\n function _marketExists(address _marketAddress, MarketSide _marketSide) internal view returns (bool) {\n uint256 marketLength = markets.length;\n for (uint256 j = 0; j < marketLength; j++) {\n if (markets[j].marketAddress == _marketAddress && markets[j].side == _marketSide) {\n return true;\n }\n }\n return false;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Setter Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function setLpTokens(address[] memory _lpTokens) external onlyOwner {\n require(_lpTokens.length != 0, \"LpTokens array cannot be empty\");\n lpTokens = _lpTokens;\n emit LpTokensSet(_lpTokens);\n }\n\n /// @inheritdoc IVoter\n function setMpo(address _mpo) external onlyOwner {\n if (_mpo == address(0)) revert ZeroAddress();\n mpo = MasterPriceOracle(_mpo);\n emit MpoSet(_mpo);\n }\n\n /// @inheritdoc IVoter\n function setGovernor(address _governor) public onlyOwner {\n if (_governor == address(0)) revert ZeroAddress();\n governor = _governor;\n emit GovernorSet(_governor);\n }\n\n /// @inheritdoc IVoter\n function addMarkets(Market[] calldata _markets) external onlyGovernance {\n for (uint256 i = 0; i < _markets.length; i++) {\n Market memory newMarket = _markets[i];\n if (_marketExists(newMarket.marketAddress, newMarket.side)) revert MarketAlreadyExists();\n markets.push(newMarket);\n }\n emit MarketsAdded(_markets);\n }\n\n /// @inheritdoc IVoter\n function setMarketRewardAccumulators(\n address[] calldata _markets,\n MarketSide[] calldata _marketSides,\n address[] calldata _rewardAccumulators\n ) external onlyGovernance {\n uint256 _length = _markets.length;\n if (_marketSides.length != _length) revert MismatchedArrayLengths();\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\n for (uint256 i = 0; i < _length; i++) {\n marketToRewardAccumulators[_markets[i]][_marketSides[i]] = _rewardAccumulators[i];\n isAlive[_rewardAccumulators[i]] = true;\n }\n emit MarketRewardAccumulatorsSet(_markets, _marketSides, _rewardAccumulators);\n }\n\n /// @inheritdoc IVoter\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external onlyGovernance {\n uint256 _length = _bribes.length;\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\n for (uint256 i = 0; i < _length; i++) {\n rewardAccumulatorToBribe[_rewardAccumulators[i]] = _bribes[i];\n }\n emit BribesSet(_rewardAccumulators, _bribes);\n }\n\n /// @inheritdoc IVoter\n function setMaxVotingNum(uint256 _maxVotingNum) external onlyGovernance {\n if (_maxVotingNum < MIN_MAXVOTINGNUM) revert MaximumVotingNumberTooLow();\n if (_maxVotingNum == maxVotingNum) revert SameValue();\n maxVotingNum = _maxVotingNum;\n emit MaxVotingNumSet(_maxVotingNum);\n }\n\n /// @inheritdoc IVoter\n function toggleRewardAccumulatorAlive(\n address _market,\n MarketSide _marketSide,\n bool _isAlive\n ) external onlyGovernance {\n address _rewardAccumulator = marketToRewardAccumulators[_market][_marketSide];\n if (_rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(_market);\n isAlive[_rewardAccumulator] = _isAlive;\n emit RewardAccumulatorAliveToggled(_market, _marketSide, _isAlive);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Pure/View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function epochStart(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochStart(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochNext(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochNext(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochVoteStart(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochVoteEnd(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function marketsLength() external view returns (uint256) {\n return markets.length;\n }\n\n /// @inheritdoc IVoter\n function getAllLpRewardTokens() external view returns (address[] memory) {\n return lpTokens;\n }\n\n /// @inheritdoc IVoter\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory) {\n uint256 length = marketVote[_tokenId][_lpAsset].length;\n address[] memory _marketVotes = new address[](length);\n MarketSide[] memory _marketVoteSides = new MarketSide[](length);\n uint256[] memory _votes = new uint256[](length);\n\n for (uint256 i = 0; i < length; i++) {\n _marketVotes[i] = marketVote[_tokenId][_lpAsset][i];\n _marketVoteSides[i] = marketVoteSide[_tokenId][_lpAsset][i];\n _votes[i] = votes[_tokenId][_marketVotes[i]][_marketVoteSides[i]][_lpAsset];\n }\n\n uint256 _usedWeight = usedWeights[_tokenId][_lpAsset];\n\n return\n VoteDetails({\n marketVotes: _marketVotes,\n marketVoteSides: _marketVoteSides,\n votes: _votes,\n usedWeight: _usedWeight\n });\n }\n}\n" + }, + "ds-test/test.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.5.0;\n\ncontract DSTest {\n event log (string);\n event logs (bytes);\n\n event log_address (address);\n event log_bytes32 (bytes32);\n event log_int (int);\n event log_uint (uint);\n event log_bytes (bytes);\n event log_string (string);\n\n event log_named_address (string key, address val);\n event log_named_bytes32 (string key, bytes32 val);\n event log_named_decimal_int (string key, int val, uint decimals);\n event log_named_decimal_uint (string key, uint val, uint decimals);\n event log_named_int (string key, int val);\n event log_named_uint (string key, uint val);\n event log_named_bytes (string key, bytes val);\n event log_named_string (string key, string val);\n\n bool public IS_TEST = true;\n bool private _failed;\n\n address constant HEVM_ADDRESS =\n address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));\n\n modifier mayRevert() { _; }\n modifier testopts(string memory) { _; }\n\n function failed() public returns (bool) {\n if (_failed) {\n return _failed;\n } else {\n bool globalFailed = false;\n if (hasHEVMContext()) {\n (, bytes memory retdata) = HEVM_ADDRESS.call(\n abi.encodePacked(\n bytes4(keccak256(\"load(address,bytes32)\")),\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"))\n )\n );\n globalFailed = abi.decode(retdata, (bool));\n }\n return globalFailed;\n }\n }\n\n function fail() internal virtual {\n if (hasHEVMContext()) {\n (bool status, ) = HEVM_ADDRESS.call(\n abi.encodePacked(\n bytes4(keccak256(\"store(address,bytes32,bytes32)\")),\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"), bytes32(uint256(0x01)))\n )\n );\n status; // Silence compiler warnings\n }\n _failed = true;\n }\n\n function hasHEVMContext() internal view returns (bool) {\n uint256 hevmCodeSize = 0;\n assembly {\n hevmCodeSize := extcodesize(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D)\n }\n return hevmCodeSize > 0;\n }\n\n modifier logs_gas() {\n uint startGas = gasleft();\n _;\n uint endGas = gasleft();\n emit log_named_uint(\"gas\", startGas - endGas);\n }\n\n function assertTrue(bool condition) internal {\n if (!condition) {\n emit log(\"Error: Assertion Failed\");\n fail();\n }\n }\n\n function assertTrue(bool condition, string memory err) internal {\n if (!condition) {\n emit log_named_string(\"Error\", err);\n assertTrue(condition);\n }\n }\n\n function assertEq(address a, address b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [address]\");\n emit log_named_address(\" Left\", a);\n emit log_named_address(\" Right\", b);\n fail();\n }\n }\n function assertEq(address a, address b, string memory err) internal {\n if (a != b) {\n emit log_named_string (\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(bytes32 a, bytes32 b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [bytes32]\");\n emit log_named_bytes32(\" Left\", a);\n emit log_named_bytes32(\" Right\", b);\n fail();\n }\n }\n function assertEq(bytes32 a, bytes32 b, string memory err) internal {\n if (a != b) {\n emit log_named_string (\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEq32(bytes32 a, bytes32 b) internal {\n assertEq(a, b);\n }\n function assertEq32(bytes32 a, bytes32 b, string memory err) internal {\n assertEq(a, b, err);\n }\n\n function assertEq(int a, int b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n fail();\n }\n }\n function assertEq(int a, int b, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEq(uint a, uint b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n fail();\n }\n }\n function assertEq(uint a, uint b, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEqDecimal(int a, int b, uint decimals) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n fail();\n }\n }\n function assertEqDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEqDecimal(a, b, decimals);\n }\n }\n function assertEqDecimal(uint a, uint b, uint decimals) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n fail();\n }\n }\n function assertEqDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEqDecimal(a, b, decimals);\n }\n }\n\n function assertGt(uint a, uint b) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertGt(uint a, uint b, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGt(a, b);\n }\n }\n function assertGt(int a, int b) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertGt(int a, int b, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGt(a, b);\n }\n }\n function assertGtDecimal(int a, int b, uint decimals) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGtDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGtDecimal(a, b, decimals);\n }\n }\n function assertGtDecimal(uint a, uint b, uint decimals) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGtDecimal(a, b, decimals);\n }\n }\n\n function assertGe(uint a, uint b) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertGe(uint a, uint b, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGe(a, b);\n }\n }\n function assertGe(int a, int b) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertGe(int a, int b, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGe(a, b);\n }\n }\n function assertGeDecimal(int a, int b, uint decimals) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGeDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGeDecimal(a, b, decimals);\n }\n }\n function assertGeDecimal(uint a, uint b, uint decimals) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGeDecimal(a, b, decimals);\n }\n }\n\n function assertLt(uint a, uint b) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertLt(uint a, uint b, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLt(a, b);\n }\n }\n function assertLt(int a, int b) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertLt(int a, int b, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLt(a, b);\n }\n }\n function assertLtDecimal(int a, int b, uint decimals) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLtDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLtDecimal(a, b, decimals);\n }\n }\n function assertLtDecimal(uint a, uint b, uint decimals) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLtDecimal(a, b, decimals);\n }\n }\n\n function assertLe(uint a, uint b) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertLe(uint a, uint b, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLe(a, b);\n }\n }\n function assertLe(int a, int b) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertLe(int a, int b, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLe(a, b);\n }\n }\n function assertLeDecimal(int a, int b, uint decimals) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLeDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLeDecimal(a, b, decimals);\n }\n }\n function assertLeDecimal(uint a, uint b, uint decimals) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLeDecimal(a, b, decimals);\n }\n }\n\n function assertEq(string memory a, string memory b) internal {\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n emit log(\"Error: a == b not satisfied [string]\");\n emit log_named_string(\" Left\", a);\n emit log_named_string(\" Right\", b);\n fail();\n }\n }\n function assertEq(string memory a, string memory b, string memory err) internal {\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function checkEq0(bytes memory a, bytes memory b) internal pure returns (bool ok) {\n ok = true;\n if (a.length == b.length) {\n for (uint i = 0; i < a.length; i++) {\n if (a[i] != b[i]) {\n ok = false;\n }\n }\n } else {\n ok = false;\n }\n }\n function assertEq0(bytes memory a, bytes memory b) internal {\n if (!checkEq0(a, b)) {\n emit log(\"Error: a == b not satisfied [bytes]\");\n emit log_named_bytes(\" Left\", a);\n emit log_named_bytes(\" Right\", b);\n fail();\n }\n }\n function assertEq0(bytes memory a, bytes memory b, string memory err) internal {\n if (!checkEq0(a, b)) {\n emit log_named_string(\"Error\", err);\n assertEq0(a, b);\n }\n }\n}\n" + }, + "forge-std/Base.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {StdStorage} from \"./StdStorage.sol\";\nimport {Vm, VmSafe} from \"./Vm.sol\";\n\nabstract contract CommonBase {\n // Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.\n address internal constant VM_ADDRESS = address(uint160(uint256(keccak256(\"hevm cheat code\"))));\n // console.sol and console2.sol work by executing a staticcall to this address.\n address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67;\n // Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38.\n address internal constant DEFAULT_SENDER = address(uint160(uint256(keccak256(\"foundry default caller\"))));\n // Address of the test contract, deployed by the DEFAULT_SENDER.\n address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f;\n // Deterministic deployment address of the Multicall3 contract.\n address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11;\n\n uint256 internal constant UINT256_MAX =\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n Vm internal constant vm = Vm(VM_ADDRESS);\n StdStorage internal stdstore;\n}\n\nabstract contract TestBase is CommonBase {}\n\nabstract contract ScriptBase is CommonBase {\n // Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\n address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\n\n VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS);\n}\n" + }, + "forge-std/console.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nlibrary console {\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n function _sendLogPayload(bytes memory payload) private view {\n uint256 payloadLength = payload.length;\n address consoleAddress = CONSOLE_ADDRESS;\n /// @solidity memory-safe-assembly\n assembly {\n let payloadStart := add(payload, 32)\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n }\n }\n\n function log() internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n }\n\n function logInt(int p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int)\", p0));\n }\n\n function logUint(uint p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n }\n\n function logString(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function logBool(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function logAddress(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function logBytes(bytes memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n }\n\n function logBytes1(bytes1 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n }\n\n function logBytes2(bytes2 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n }\n\n function logBytes3(bytes3 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n }\n\n function logBytes4(bytes4 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n }\n\n function logBytes5(bytes5 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n }\n\n function logBytes6(bytes6 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n }\n\n function logBytes7(bytes7 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n }\n\n function logBytes8(bytes8 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n }\n\n function logBytes9(bytes9 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n }\n\n function logBytes10(bytes10 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n }\n\n function logBytes11(bytes11 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n }\n\n function logBytes12(bytes12 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n }\n\n function logBytes13(bytes13 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n }\n\n function logBytes14(bytes14 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n }\n\n function logBytes15(bytes15 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n }\n\n function logBytes16(bytes16 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n }\n\n function logBytes17(bytes17 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n }\n\n function logBytes18(bytes18 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n }\n\n function logBytes19(bytes19 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n }\n\n function logBytes20(bytes20 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n }\n\n function logBytes21(bytes21 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n }\n\n function logBytes22(bytes22 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n }\n\n function logBytes23(bytes23 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n }\n\n function logBytes24(bytes24 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n }\n\n function logBytes25(bytes25 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n }\n\n function logBytes26(bytes26 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n }\n\n function logBytes27(bytes27 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n }\n\n function logBytes28(bytes28 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n }\n\n function logBytes29(bytes29 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n }\n\n function logBytes30(bytes30 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n }\n\n function logBytes31(bytes31 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n }\n\n function logBytes32(bytes32 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n }\n\n function log(uint p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n }\n\n function log(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function log(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function log(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function log(uint p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint)\", p0, p1));\n }\n\n function log(uint p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string)\", p0, p1));\n }\n\n function log(uint p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool)\", p0, p1));\n }\n\n function log(uint p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address)\", p0, p1));\n }\n\n function log(string memory p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint)\", p0, p1));\n }\n\n function log(string memory p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n }\n\n function log(string memory p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n }\n\n function log(string memory p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n }\n\n function log(bool p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint)\", p0, p1));\n }\n\n function log(bool p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n }\n\n function log(bool p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n }\n\n function log(bool p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n }\n\n function log(address p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint)\", p0, p1));\n }\n\n function log(address p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n }\n\n function log(address p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n }\n\n function log(address p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n }\n\n function log(uint p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n }\n\n}" + }, + "forge-std/console2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\n/// @dev The original console.sol uses `int` and `uint` for computing function selectors, but it should\n/// use `int256` and `uint256`. This modified version fixes that. This version is recommended\n/// over `console.sol` if you don't need compatibility with Hardhat as the logs will show up in\n/// forge stack traces. If you do need compatibility with Hardhat, you must use `console.sol`.\n/// Reference: https://github.com/NomicFoundation/hardhat/issues/2178\nlibrary console2 {\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n function _sendLogPayload(bytes memory payload) private view {\n uint256 payloadLength = payload.length;\n address consoleAddress = CONSOLE_ADDRESS;\n /// @solidity memory-safe-assembly\n assembly {\n let payloadStart := add(payload, 32)\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n }\n }\n\n function log() internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n }\n\n function logInt(int256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n }\n\n function logUint(uint256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n }\n\n function logString(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function logBool(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function logAddress(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function logBytes(bytes memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n }\n\n function logBytes1(bytes1 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n }\n\n function logBytes2(bytes2 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n }\n\n function logBytes3(bytes3 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n }\n\n function logBytes4(bytes4 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n }\n\n function logBytes5(bytes5 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n }\n\n function logBytes6(bytes6 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n }\n\n function logBytes7(bytes7 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n }\n\n function logBytes8(bytes8 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n }\n\n function logBytes9(bytes9 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n }\n\n function logBytes10(bytes10 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n }\n\n function logBytes11(bytes11 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n }\n\n function logBytes12(bytes12 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n }\n\n function logBytes13(bytes13 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n }\n\n function logBytes14(bytes14 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n }\n\n function logBytes15(bytes15 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n }\n\n function logBytes16(bytes16 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n }\n\n function logBytes17(bytes17 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n }\n\n function logBytes18(bytes18 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n }\n\n function logBytes19(bytes19 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n }\n\n function logBytes20(bytes20 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n }\n\n function logBytes21(bytes21 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n }\n\n function logBytes22(bytes22 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n }\n\n function logBytes23(bytes23 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n }\n\n function logBytes24(bytes24 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n }\n\n function logBytes25(bytes25 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n }\n\n function logBytes26(bytes26 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n }\n\n function logBytes27(bytes27 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n }\n\n function logBytes28(bytes28 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n }\n\n function logBytes29(bytes29 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n }\n\n function logBytes30(bytes30 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n }\n\n function logBytes31(bytes31 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n }\n\n function logBytes32(bytes32 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n }\n\n function log(uint256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n }\n\n function log(int256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n }\n\n function log(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function log(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function log(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function log(uint256 p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256)\", p0, p1));\n }\n\n function log(uint256 p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string)\", p0, p1));\n }\n\n function log(uint256 p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool)\", p0, p1));\n }\n\n function log(uint256 p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address)\", p0, p1));\n }\n\n function log(string memory p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n }\n\n function log(string memory p0, int256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,int256)\", p0, p1));\n }\n\n function log(string memory p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n }\n\n function log(string memory p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n }\n\n function log(string memory p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n }\n\n function log(bool p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256)\", p0, p1));\n }\n\n function log(bool p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n }\n\n function log(bool p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n }\n\n function log(bool p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n }\n\n function log(address p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256)\", p0, p1));\n }\n\n function log(address p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n }\n\n function log(address p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n }\n\n function log(address p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n }\n\n}" + }, + "forge-std/interfaces/IMulticall3.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\ninterface IMulticall3 {\n struct Call {\n address target;\n bytes callData;\n }\n\n struct Call3 {\n address target;\n bool allowFailure;\n bytes callData;\n }\n\n struct Call3Value {\n address target;\n bool allowFailure;\n uint256 value;\n bytes callData;\n }\n\n struct Result {\n bool success;\n bytes returnData;\n }\n\n function aggregate(Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes[] memory returnData);\n\n function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData);\n\n function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData);\n\n function blockAndAggregate(Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\n\n function getBasefee() external view returns (uint256 basefee);\n\n function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash);\n\n function getBlockNumber() external view returns (uint256 blockNumber);\n\n function getChainId() external view returns (uint256 chainid);\n\n function getCurrentBlockCoinbase() external view returns (address coinbase);\n\n function getCurrentBlockDifficulty() external view returns (uint256 difficulty);\n\n function getCurrentBlockGasLimit() external view returns (uint256 gaslimit);\n\n function getCurrentBlockTimestamp() external view returns (uint256 timestamp);\n\n function getEthBalance(address addr) external view returns (uint256 balance);\n\n function getLastBlockHash() external view returns (bytes32 blockHash);\n\n function tryAggregate(bool requireSuccess, Call[] calldata calls)\n external\n payable\n returns (Result[] memory returnData);\n\n function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\n}\n" + }, + "forge-std/StdAssertions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {DSTest} from \"ds-test/test.sol\";\nimport {stdMath} from \"./StdMath.sol\";\n\nabstract contract StdAssertions is DSTest {\n event log_array(uint256[] val);\n event log_array(int256[] val);\n event log_array(address[] val);\n event log_named_array(string key, uint256[] val);\n event log_named_array(string key, int256[] val);\n event log_named_array(string key, address[] val);\n\n function fail(string memory err) internal virtual {\n emit log_named_string(\"Error\", err);\n fail();\n }\n\n function assertFalse(bool data) internal virtual {\n assertTrue(!data);\n }\n\n function assertFalse(bool data, string memory err) internal virtual {\n assertTrue(!data, err);\n }\n\n function assertEq(bool a, bool b) internal virtual {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [bool]\");\n emit log_named_string(\" Left\", a ? \"true\" : \"false\");\n emit log_named_string(\" Right\", b ? \"true\" : \"false\");\n fail();\n }\n }\n\n function assertEq(bool a, bool b, string memory err) internal virtual {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(bytes memory a, bytes memory b) internal virtual {\n assertEq0(a, b);\n }\n\n function assertEq(bytes memory a, bytes memory b, string memory err) internal virtual {\n assertEq0(a, b, err);\n }\n\n function assertEq(uint256[] memory a, uint256[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [uint[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(int256[] memory a, int256[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [int[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(address[] memory a, address[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [address[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(uint256[] memory a, uint256[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(int256[] memory a, int256[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(address[] memory a, address[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n // Legacy helper\n function assertEqUint(uint256 a, uint256 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta, string memory err) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbs(a, b, maxDelta);\n }\n }\n\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\n fail();\n }\n }\n\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\n }\n }\n\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta, string memory err) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbs(a, b, maxDelta);\n }\n }\n\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\n fail();\n }\n }\n\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\n }\n }\n\n function assertApproxEqRel(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100%\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRel(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n string memory err\n ) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRel(a, b, maxPercentDelta);\n }\n }\n\n function assertApproxEqRelDecimal(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n uint256 decimals\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRelDecimal(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n uint256 decimals,\n string memory err\n ) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\n }\n }\n\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta, string memory err) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRel(a, b, maxPercentDelta);\n }\n }\n\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\n }\n }\n\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB) internal virtual {\n assertEqCall(target, callDataA, target, callDataB, true);\n }\n\n function assertEqCall(address targetA, bytes memory callDataA, address targetB, bytes memory callDataB)\n internal\n virtual\n {\n assertEqCall(targetA, callDataA, targetB, callDataB, true);\n }\n\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB, bool strictRevertData)\n internal\n virtual\n {\n assertEqCall(target, callDataA, target, callDataB, strictRevertData);\n }\n\n function assertEqCall(\n address targetA,\n bytes memory callDataA,\n address targetB,\n bytes memory callDataB,\n bool strictRevertData\n ) internal virtual {\n (bool successA, bytes memory returnDataA) = address(targetA).call(callDataA);\n (bool successB, bytes memory returnDataB) = address(targetB).call(callDataB);\n\n if (successA && successB) {\n assertEq(returnDataA, returnDataB, \"Call return data does not match\");\n }\n\n if (!successA && !successB && strictRevertData) {\n assertEq(returnDataA, returnDataB, \"Call revert data does not match\");\n }\n\n if (!successA && successB) {\n emit log(\"Error: Calls were not equal\");\n emit log_named_bytes(\" Left call revert data\", returnDataA);\n emit log_named_bytes(\" Right call return data\", returnDataB);\n fail();\n }\n\n if (successA && !successB) {\n emit log(\"Error: Calls were not equal\");\n emit log_named_bytes(\" Left call return data\", returnDataA);\n emit log_named_bytes(\" Right call revert data\", returnDataB);\n fail();\n }\n }\n}\n" + }, + "forge-std/StdChains.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {VmSafe} from \"./Vm.sol\";\n\n/**\n * StdChains provides information about EVM compatible chains that can be used in scripts/tests.\n * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are\n * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of\n * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the\n * alias used in this contract, which can be found as the first argument to the\n * `setChainWithDefaultRpcUrl` call in the `initialize` function.\n *\n * There are two main ways to use this contract:\n * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or\n * `setChain(string memory chainAlias, Chain memory chain)`\n * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`.\n *\n * The first time either of those are used, chains are initialized with the default set of RPC URLs.\n * This is done in `initialize`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in\n * `defaultRpcUrls`.\n *\n * The `setChain` function is straightforward, and it simply saves off the given chain data.\n *\n * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say\n * we want to retrieve `mainnet`'s RPC URL:\n * - If you haven't set any mainnet chain info with `setChain`, you haven't specified that\n * chain in `foundry.toml` and no env var is set, the default data and RPC URL will be returned.\n * - If you have set a mainnet RPC URL in `foundry.toml` it will return that, if valid (e.g. if\n * a URL is given or if an environment variable is given and that environment variable exists).\n * Otherwise, the default data is returned.\n * - If you specified data with `setChain` it will return that.\n *\n * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults.\n */\nabstract contract StdChains {\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n bool private initialized;\n\n struct ChainData {\n string name;\n uint256 chainId;\n string rpcUrl;\n }\n\n struct Chain {\n // The chain name.\n string name;\n // The chain's Chain ID.\n uint256 chainId;\n // The chain's alias. (i.e. what gets specified in `foundry.toml`).\n string chainAlias;\n // A default RPC endpoint for this chain.\n // NOTE: This default RPC URL is included for convenience to facilitate quick tests and\n // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy\n // usage as you will be throttled and this is a disservice to others who need this endpoint.\n string rpcUrl;\n }\n\n // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data.\n mapping(string => Chain) private chains;\n // Maps from the chain's alias to it's default RPC URL.\n mapping(string => string) private defaultRpcUrls;\n // Maps from a chain ID to it's alias.\n mapping(uint256 => string) private idToAlias;\n\n bool private fallbackToDefaultRpcUrls = true;\n\n // The RPC URL will be fetched from config or defaultRpcUrls if possible.\n function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) {\n require(bytes(chainAlias).length != 0, \"StdChains getChain(string): Chain alias cannot be the empty string.\");\n\n initialize();\n chain = chains[chainAlias];\n require(\n chain.chainId != 0,\n string(abi.encodePacked(\"StdChains getChain(string): Chain with alias \\\"\", chainAlias, \"\\\" not found.\"))\n );\n\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\n }\n\n function getChain(uint256 chainId) internal virtual returns (Chain memory chain) {\n require(chainId != 0, \"StdChains getChain(uint256): Chain ID cannot be 0.\");\n initialize();\n string memory chainAlias = idToAlias[chainId];\n\n chain = chains[chainAlias];\n\n require(\n chain.chainId != 0,\n string(abi.encodePacked(\"StdChains getChain(uint256): Chain with ID \", vm.toString(chainId), \" not found.\"))\n );\n\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\n }\n\n // set chain info, with priority to argument's rpcUrl field.\n function setChain(string memory chainAlias, ChainData memory chain) internal virtual {\n require(\n bytes(chainAlias).length != 0,\n \"StdChains setChain(string,ChainData): Chain alias cannot be the empty string.\"\n );\n\n require(chain.chainId != 0, \"StdChains setChain(string,ChainData): Chain ID cannot be 0.\");\n\n initialize();\n string memory foundAlias = idToAlias[chain.chainId];\n\n require(\n bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)),\n string(\n abi.encodePacked(\n \"StdChains setChain(string,ChainData): Chain ID \",\n vm.toString(chain.chainId),\n \" already used by \\\"\",\n foundAlias,\n \"\\\".\"\n )\n )\n );\n\n uint256 oldChainId = chains[chainAlias].chainId;\n delete idToAlias[oldChainId];\n\n chains[chainAlias] =\n Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl});\n idToAlias[chain.chainId] = chainAlias;\n }\n\n // set chain info, with priority to argument's rpcUrl field.\n function setChain(string memory chainAlias, Chain memory chain) internal virtual {\n setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl}));\n }\n\n function _toUpper(string memory str) private pure returns (string memory) {\n bytes memory strb = bytes(str);\n bytes memory copy = new bytes(strb.length);\n for (uint256 i = 0; i < strb.length; i++) {\n bytes1 b = strb[i];\n if (b >= 0x61 && b <= 0x7A) {\n copy[i] = bytes1(uint8(b) - 32);\n } else {\n copy[i] = b;\n }\n }\n return string(copy);\n }\n\n // lookup rpcUrl, in descending order of priority:\n // current -> config (foundry.toml) -> environment variable -> default\n function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) private returns (Chain memory) {\n if (bytes(chain.rpcUrl).length == 0) {\n try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) {\n chain.rpcUrl = configRpcUrl;\n } catch (bytes memory err) {\n string memory envName = string(abi.encodePacked(_toUpper(chainAlias), \"_RPC_URL\"));\n if (fallbackToDefaultRpcUrls) {\n chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]);\n } else {\n chain.rpcUrl = vm.envString(envName);\n }\n // distinguish 'not found' from 'cannot read'\n bytes memory notFoundError =\n abi.encodeWithSignature(\"CheatCodeError\", string(abi.encodePacked(\"invalid rpc url \", chainAlias)));\n if (keccak256(notFoundError) != keccak256(err) || bytes(chain.rpcUrl).length == 0) {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, err), mload(err))\n }\n }\n }\n }\n return chain;\n }\n\n function setFallbackToDefaultRpcUrls(bool useDefault) internal {\n fallbackToDefaultRpcUrls = useDefault;\n }\n\n function initialize() private {\n if (initialized) return;\n\n initialized = true;\n\n // If adding an RPC here, make sure to test the default RPC URL in `testRpcs`\n setChainWithDefaultRpcUrl(\"anvil\", ChainData(\"Anvil\", 31337, \"http://127.0.0.1:8545\"));\n setChainWithDefaultRpcUrl(\n \"mainnet\", ChainData(\"Mainnet\", 1, \"https://mainnet.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\n \"goerli\", ChainData(\"Goerli\", 5, \"https://goerli.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\n \"sepolia\", ChainData(\"Sepolia\", 11155111, \"https://sepolia.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\"optimism\", ChainData(\"Optimism\", 10, \"https://mainnet.optimism.io\"));\n setChainWithDefaultRpcUrl(\"optimism_goerli\", ChainData(\"Optimism Goerli\", 420, \"https://goerli.optimism.io\"));\n setChainWithDefaultRpcUrl(\"arbitrum_one\", ChainData(\"Arbitrum One\", 42161, \"https://arb1.arbitrum.io/rpc\"));\n setChainWithDefaultRpcUrl(\n \"arbitrum_one_goerli\", ChainData(\"Arbitrum One Goerli\", 421613, \"https://goerli-rollup.arbitrum.io/rpc\")\n );\n setChainWithDefaultRpcUrl(\"arbitrum_nova\", ChainData(\"Arbitrum Nova\", 42170, \"https://nova.arbitrum.io/rpc\"));\n setChainWithDefaultRpcUrl(\"polygon\", ChainData(\"Polygon\", 137, \"https://polygon-rpc.com\"));\n setChainWithDefaultRpcUrl(\n \"polygon_mumbai\", ChainData(\"Polygon Mumbai\", 80001, \"https://rpc-mumbai.maticvigil.com\")\n );\n setChainWithDefaultRpcUrl(\"avalanche\", ChainData(\"Avalanche\", 43114, \"https://api.avax.network/ext/bc/C/rpc\"));\n setChainWithDefaultRpcUrl(\n \"avalanche_fuji\", ChainData(\"Avalanche Fuji\", 43113, \"https://api.avax-test.network/ext/bc/C/rpc\")\n );\n setChainWithDefaultRpcUrl(\n \"bnb_smart_chain\", ChainData(\"BNB Smart Chain\", 56, \"https://bsc-dataseed1.binance.org\")\n );\n setChainWithDefaultRpcUrl(\n \"bnb_smart_chain_testnet\",\n ChainData(\"BNB Smart Chain Testnet\", 97, \"https://rpc.ankr.com/bsc_testnet_chapel\")\n );\n setChainWithDefaultRpcUrl(\"gnosis_chain\", ChainData(\"Gnosis Chain\", 100, \"https://rpc.gnosischain.com\"));\n }\n\n // set chain info, with priority to chainAlias' rpc url in foundry.toml\n function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private {\n string memory rpcUrl = chain.rpcUrl;\n defaultRpcUrls[chainAlias] = rpcUrl;\n chain.rpcUrl = \"\";\n setChain(chainAlias, chain);\n chain.rpcUrl = rpcUrl; // restore argument\n }\n}\n" + }, + "forge-std/StdCheats.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\nimport {Vm} from \"./Vm.sol\";\n\nabstract contract StdCheatsSafe {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n bool private gasMeteringOff;\n\n // Data structures to parse Transaction objects from the broadcast artifact\n // that conform to EIP1559. The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct RawTx1559 {\n string[] arguments;\n address contractAddress;\n string contractName;\n // json value name = function\n string functionSig;\n bytes32 hash;\n // json value name = tx\n RawTx1559Detail txDetail;\n // json value name = type\n string opcode;\n }\n\n struct RawTx1559Detail {\n AccessList[] accessList;\n bytes data;\n address from;\n bytes gas;\n bytes nonce;\n address to;\n bytes txType;\n bytes value;\n }\n\n struct Tx1559 {\n string[] arguments;\n address contractAddress;\n string contractName;\n string functionSig;\n bytes32 hash;\n Tx1559Detail txDetail;\n string opcode;\n }\n\n struct Tx1559Detail {\n AccessList[] accessList;\n bytes data;\n address from;\n uint256 gas;\n uint256 nonce;\n address to;\n uint256 txType;\n uint256 value;\n }\n\n // Data structures to parse Transaction objects from the broadcast artifact\n // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct TxLegacy {\n string[] arguments;\n address contractAddress;\n string contractName;\n string functionSig;\n string hash;\n string opcode;\n TxDetailLegacy transaction;\n }\n\n struct TxDetailLegacy {\n AccessList[] accessList;\n uint256 chainId;\n bytes data;\n address from;\n uint256 gas;\n uint256 gasPrice;\n bytes32 hash;\n uint256 nonce;\n bytes1 opcode;\n bytes32 r;\n bytes32 s;\n uint256 txType;\n address to;\n uint8 v;\n uint256 value;\n }\n\n struct AccessList {\n address accessAddress;\n bytes32[] storageKeys;\n }\n\n // Data structures to parse Receipt objects from the broadcast artifact.\n // The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct RawReceipt {\n bytes32 blockHash;\n bytes blockNumber;\n address contractAddress;\n bytes cumulativeGasUsed;\n bytes effectiveGasPrice;\n address from;\n bytes gasUsed;\n RawReceiptLog[] logs;\n bytes logsBloom;\n bytes status;\n address to;\n bytes32 transactionHash;\n bytes transactionIndex;\n }\n\n struct Receipt {\n bytes32 blockHash;\n uint256 blockNumber;\n address contractAddress;\n uint256 cumulativeGasUsed;\n uint256 effectiveGasPrice;\n address from;\n uint256 gasUsed;\n ReceiptLog[] logs;\n bytes logsBloom;\n uint256 status;\n address to;\n bytes32 transactionHash;\n uint256 transactionIndex;\n }\n\n // Data structures to parse the entire broadcast artifact, assuming the\n // transactions conform to EIP1559.\n\n struct EIP1559ScriptArtifact {\n string[] libraries;\n string path;\n string[] pending;\n Receipt[] receipts;\n uint256 timestamp;\n Tx1559[] transactions;\n TxReturn[] txReturns;\n }\n\n struct RawEIP1559ScriptArtifact {\n string[] libraries;\n string path;\n string[] pending;\n RawReceipt[] receipts;\n TxReturn[] txReturns;\n uint256 timestamp;\n RawTx1559[] transactions;\n }\n\n struct RawReceiptLog {\n // json value = address\n address logAddress;\n bytes32 blockHash;\n bytes blockNumber;\n bytes data;\n bytes logIndex;\n bool removed;\n bytes32[] topics;\n bytes32 transactionHash;\n bytes transactionIndex;\n bytes transactionLogIndex;\n }\n\n struct ReceiptLog {\n // json value = address\n address logAddress;\n bytes32 blockHash;\n uint256 blockNumber;\n bytes data;\n uint256 logIndex;\n bytes32[] topics;\n uint256 transactionIndex;\n uint256 transactionLogIndex;\n bool removed;\n }\n\n struct TxReturn {\n string internalType;\n string value;\n }\n\n function assumeNoPrecompiles(address addr) internal virtual {\n // Assembly required since `block.chainid` was introduced in 0.8.0.\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n assumeNoPrecompiles(addr, chainId);\n }\n\n function assumeNoPrecompiles(address addr, uint256 chainId) internal pure virtual {\n // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific\n // address), but the same rationale for excluding them applies so we include those too.\n\n // These should be present on all EVM-compatible chains.\n vm.assume(addr < address(0x1) || addr > address(0x9));\n\n // forgefmt: disable-start\n if (chainId == 10 || chainId == 420) {\n // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21\n vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800));\n } else if (chainId == 42161 || chainId == 421613) {\n // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains\n vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068));\n } else if (chainId == 43114 || chainId == 43113) {\n // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59\n vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff));\n vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF));\n vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff));\n }\n // forgefmt: disable-end\n }\n\n function readEIP1559ScriptArtifact(string memory path)\n internal\n view\n virtual\n returns (EIP1559ScriptArtifact memory)\n {\n string memory data = vm.readFile(path);\n bytes memory parsedData = vm.parseJson(data);\n RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact));\n EIP1559ScriptArtifact memory artifact;\n artifact.libraries = rawArtifact.libraries;\n artifact.path = rawArtifact.path;\n artifact.timestamp = rawArtifact.timestamp;\n artifact.pending = rawArtifact.pending;\n artifact.txReturns = rawArtifact.txReturns;\n artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts);\n artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions);\n return artifact;\n }\n\n function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) {\n Tx1559[] memory txs = new Tx1559[](rawTxs.length);\n for (uint256 i; i < rawTxs.length; i++) {\n txs[i] = rawToConvertedEIPTx1559(rawTxs[i]);\n }\n return txs;\n }\n\n function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) {\n Tx1559 memory transaction;\n transaction.arguments = rawTx.arguments;\n transaction.contractName = rawTx.contractName;\n transaction.functionSig = rawTx.functionSig;\n transaction.hash = rawTx.hash;\n transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail);\n transaction.opcode = rawTx.opcode;\n return transaction;\n }\n\n function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail)\n internal\n pure\n virtual\n returns (Tx1559Detail memory)\n {\n Tx1559Detail memory txDetail;\n txDetail.data = rawDetail.data;\n txDetail.from = rawDetail.from;\n txDetail.to = rawDetail.to;\n txDetail.nonce = _bytesToUint(rawDetail.nonce);\n txDetail.txType = _bytesToUint(rawDetail.txType);\n txDetail.value = _bytesToUint(rawDetail.value);\n txDetail.gas = _bytesToUint(rawDetail.gas);\n txDetail.accessList = rawDetail.accessList;\n return txDetail;\n }\n\n function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) {\n string memory deployData = vm.readFile(path);\n bytes memory parsedDeployData = vm.parseJson(deployData, \".transactions\");\n RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[]));\n return rawToConvertedEIPTx1559s(rawTxs);\n }\n\n function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) {\n string memory deployData = vm.readFile(path);\n string memory key = string(abi.encodePacked(\".transactions[\", vm.toString(index), \"]\"));\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\n RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559));\n return rawToConvertedEIPTx1559(rawTx);\n }\n\n // Analogous to readTransactions, but for receipts.\n function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) {\n string memory deployData = vm.readFile(path);\n bytes memory parsedDeployData = vm.parseJson(deployData, \".receipts\");\n RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[]));\n return rawToConvertedReceipts(rawReceipts);\n }\n\n function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) {\n string memory deployData = vm.readFile(path);\n string memory key = string(abi.encodePacked(\".receipts[\", vm.toString(index), \"]\"));\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\n RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt));\n return rawToConvertedReceipt(rawReceipt);\n }\n\n function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) {\n Receipt[] memory receipts = new Receipt[](rawReceipts.length);\n for (uint256 i; i < rawReceipts.length; i++) {\n receipts[i] = rawToConvertedReceipt(rawReceipts[i]);\n }\n return receipts;\n }\n\n function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) {\n Receipt memory receipt;\n receipt.blockHash = rawReceipt.blockHash;\n receipt.to = rawReceipt.to;\n receipt.from = rawReceipt.from;\n receipt.contractAddress = rawReceipt.contractAddress;\n receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice);\n receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed);\n receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed);\n receipt.status = _bytesToUint(rawReceipt.status);\n receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex);\n receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber);\n receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs);\n receipt.logsBloom = rawReceipt.logsBloom;\n receipt.transactionHash = rawReceipt.transactionHash;\n return receipt;\n }\n\n function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs)\n internal\n pure\n virtual\n returns (ReceiptLog[] memory)\n {\n ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length);\n for (uint256 i; i < rawLogs.length; i++) {\n logs[i].logAddress = rawLogs[i].logAddress;\n logs[i].blockHash = rawLogs[i].blockHash;\n logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber);\n logs[i].data = rawLogs[i].data;\n logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex);\n logs[i].topics = rawLogs[i].topics;\n logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex);\n logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex);\n logs[i].removed = rawLogs[i].removed;\n }\n return logs;\n }\n\n // Deploy a contract by fetching the contract bytecode from\n // the artifacts directory\n // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))`\n function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) {\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,bytes): Deployment failed.\");\n }\n\n function deployCode(string memory what) internal virtual returns (address addr) {\n bytes memory bytecode = vm.getCode(what);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string): Deployment failed.\");\n }\n\n /// @dev deploy contract with value on construction\n function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) {\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,bytes,uint256): Deployment failed.\");\n }\n\n function deployCode(string memory what, uint256 val) internal virtual returns (address addr) {\n bytes memory bytecode = vm.getCode(what);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,uint256): Deployment failed.\");\n }\n\n // creates a labeled address and the corresponding private key\n function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) {\n privateKey = uint256(keccak256(abi.encodePacked(name)));\n addr = vm.addr(privateKey);\n vm.label(addr, name);\n }\n\n // creates a labeled address\n function makeAddr(string memory name) internal virtual returns (address addr) {\n (addr,) = makeAddrAndKey(name);\n }\n\n function deriveRememberKey(string memory mnemonic, uint32 index)\n internal\n virtual\n returns (address who, uint256 privateKey)\n {\n privateKey = vm.deriveKey(mnemonic, index);\n who = vm.rememberKey(privateKey);\n }\n\n function _bytesToUint(bytes memory b) private pure returns (uint256) {\n require(b.length <= 32, \"StdCheats _bytesToUint(bytes): Bytes length exceeds 32.\");\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\n }\n\n function isFork() internal view virtual returns (bool status) {\n try vm.activeFork() {\n status = true;\n } catch (bytes memory) {}\n }\n\n modifier skipWhenForking() {\n if (!isFork()) {\n _;\n }\n }\n\n modifier skipWhenNotForking() {\n if (isFork()) {\n _;\n }\n }\n\n modifier noGasMetering() {\n vm.pauseGasMetering();\n // To prevent turning gas monitoring back on with nested functions that use this modifier,\n // we check if gasMetering started in the off position. If it did, we don't want to turn\n // it back on until we exit the top level function that used the modifier\n //\n // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well.\n // funcA will have `gasStartedOff` as false, funcB will have it as true,\n // so we only turn metering back on at the end of the funcA\n bool gasStartedOff = gasMeteringOff;\n gasMeteringOff = true;\n\n _;\n\n // if gas metering was on when this modifier was called, turn it back on at the end\n if (!gasStartedOff) {\n gasMeteringOff = false;\n vm.resumeGasMetering();\n }\n }\n\n // a cheat for fuzzing addresses that are payable only\n // see https://github.com/foundry-rs/foundry/issues/3631\n function assumePayable(address addr) internal virtual {\n (bool success,) = payable(addr).call{value: 0}(\"\");\n vm.assume(success);\n }\n}\n\n// Wrappers around cheatcodes to avoid footguns\nabstract contract StdCheats is StdCheatsSafe {\n using stdStorage for StdStorage;\n\n StdStorage private stdstore;\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n // Skip forward or rewind time by the specified number of seconds\n function skip(uint256 time) internal virtual {\n vm.warp(block.timestamp + time);\n }\n\n function rewind(uint256 time) internal virtual {\n vm.warp(block.timestamp - time);\n }\n\n // Setup a prank from an address that has some ether\n function hoax(address msgSender) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.prank(msgSender);\n }\n\n function hoax(address msgSender, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.prank(msgSender);\n }\n\n function hoax(address msgSender, address origin) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.prank(msgSender, origin);\n }\n\n function hoax(address msgSender, address origin, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.prank(msgSender, origin);\n }\n\n // Start perpetual prank from an address that has some ether\n function startHoax(address msgSender) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.startPrank(msgSender);\n }\n\n function startHoax(address msgSender, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.startPrank(msgSender);\n }\n\n // Start perpetual prank from an address that has some ether\n // tx.origin is set to the origin parameter\n function startHoax(address msgSender, address origin) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.startPrank(msgSender, origin);\n }\n\n function startHoax(address msgSender, address origin, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.startPrank(msgSender, origin);\n }\n\n function changePrank(address msgSender) internal virtual {\n vm.stopPrank();\n vm.startPrank(msgSender);\n }\n\n // The same as Vm's `deal`\n // Use the alternative signature for ERC20 tokens\n function deal(address to, uint256 give) internal virtual {\n vm.deal(to, give);\n }\n\n // Set the balance of an account for any ERC20 token\n // Use the alternative signature to update `totalSupply`\n function deal(address token, address to, uint256 give) internal virtual {\n deal(token, to, give, false);\n }\n\n // Set the balance of an account for any ERC1155 token\n // Use the alternative signature to update `totalSupply`\n function dealERC1155(address token, address to, uint256 id, uint256 give) internal virtual {\n dealERC1155(token, to, id, give, false);\n }\n\n function deal(address token, address to, uint256 give, bool adjust) internal virtual {\n // get current balance\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n uint256 prevBal = abi.decode(balData, (uint256));\n\n // update balance\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give);\n\n // update total supply\n if (adjust) {\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0x18160ddd));\n uint256 totSup = abi.decode(totSupData, (uint256));\n if (give < prevBal) {\n totSup -= (prevBal - give);\n } else {\n totSup += (give - prevBal);\n }\n stdstore.target(token).sig(0x18160ddd).checked_write(totSup);\n }\n }\n\n function dealERC1155(address token, address to, uint256 id, uint256 give, bool adjust) internal virtual {\n // get current balance\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x00fdd58e, to, id));\n uint256 prevBal = abi.decode(balData, (uint256));\n\n // update balance\n stdstore.target(token).sig(0x00fdd58e).with_key(to).with_key(id).checked_write(give);\n\n // update total supply\n if (adjust) {\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0xbd85b039, id));\n require(\n totSupData.length != 0,\n \"StdCheats deal(address,address,uint,uint,bool): target contract is not ERC1155Supply.\"\n );\n uint256 totSup = abi.decode(totSupData, (uint256));\n if (give < prevBal) {\n totSup -= (prevBal - give);\n } else {\n totSup += (give - prevBal);\n }\n stdstore.target(token).sig(0xbd85b039).with_key(id).checked_write(totSup);\n }\n }\n\n function dealERC721(address token, address to, uint256 id) internal virtual {\n // check if token id is already minted and the actual owner.\n (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id));\n require(successMinted, \"StdCheats deal(address,address,uint,bool): id not minted.\");\n\n // get owner current balance\n (, bytes memory fromBalData) = token.call(abi.encodeWithSelector(0x70a08231, abi.decode(ownerData, (address))));\n uint256 fromPrevBal = abi.decode(fromBalData, (uint256));\n\n // get new user current balance\n (, bytes memory toBalData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n uint256 toPrevBal = abi.decode(toBalData, (uint256));\n\n // update balances\n stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal);\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal);\n\n // update owner\n stdstore.target(token).sig(0x6352211e).with_key(id).checked_write(to);\n }\n}\n" + }, + "forge-std/StdError.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test\npragma solidity >=0.6.2 <0.9.0;\n\nlibrary stdError {\n bytes public constant assertionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x01);\n bytes public constant arithmeticError = abi.encodeWithSignature(\"Panic(uint256)\", 0x11);\n bytes public constant divisionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x12);\n bytes public constant enumConversionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x21);\n bytes public constant encodeStorageError = abi.encodeWithSignature(\"Panic(uint256)\", 0x22);\n bytes public constant popError = abi.encodeWithSignature(\"Panic(uint256)\", 0x31);\n bytes public constant indexOOBError = abi.encodeWithSignature(\"Panic(uint256)\", 0x32);\n bytes public constant memOverflowError = abi.encodeWithSignature(\"Panic(uint256)\", 0x41);\n bytes public constant zeroVarError = abi.encodeWithSignature(\"Panic(uint256)\", 0x51);\n}\n" + }, + "forge-std/StdInvariant.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\ncontract StdInvariant {\n struct FuzzSelector {\n address addr;\n bytes4[] selectors;\n }\n\n address[] private _excludedContracts;\n address[] private _excludedSenders;\n address[] private _targetedContracts;\n address[] private _targetedSenders;\n\n string[] private _excludedArtifacts;\n string[] private _targetedArtifacts;\n\n FuzzSelector[] private _targetedArtifactSelectors;\n FuzzSelector[] private _targetedSelectors;\n\n // Functions for users:\n // These are intended to be called in tests.\n\n function excludeContract(address newExcludedContract_) internal {\n _excludedContracts.push(newExcludedContract_);\n }\n\n function excludeSender(address newExcludedSender_) internal {\n _excludedSenders.push(newExcludedSender_);\n }\n\n function excludeArtifact(string memory newExcludedArtifact_) internal {\n _excludedArtifacts.push(newExcludedArtifact_);\n }\n\n function targetArtifact(string memory newTargetedArtifact_) internal {\n _targetedArtifacts.push(newTargetedArtifact_);\n }\n\n function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal {\n _targetedArtifactSelectors.push(newTargetedArtifactSelector_);\n }\n\n function targetContract(address newTargetedContract_) internal {\n _targetedContracts.push(newTargetedContract_);\n }\n\n function targetSelector(FuzzSelector memory newTargetedSelector_) internal {\n _targetedSelectors.push(newTargetedSelector_);\n }\n\n function targetSender(address newTargetedSender_) internal {\n _targetedSenders.push(newTargetedSender_);\n }\n\n // Functions for forge:\n // These are called by forge to run invariant tests and don't need to be called in tests.\n\n function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) {\n excludedArtifacts_ = _excludedArtifacts;\n }\n\n function excludeContracts() public view returns (address[] memory excludedContracts_) {\n excludedContracts_ = _excludedContracts;\n }\n\n function excludeSenders() public view returns (address[] memory excludedSenders_) {\n excludedSenders_ = _excludedSenders;\n }\n\n function targetArtifacts() public view returns (string[] memory targetedArtifacts_) {\n targetedArtifacts_ = _targetedArtifacts;\n }\n\n function targetArtifactSelectors() public view returns (FuzzSelector[] memory targetedArtifactSelectors_) {\n targetedArtifactSelectors_ = _targetedArtifactSelectors;\n }\n\n function targetContracts() public view returns (address[] memory targetedContracts_) {\n targetedContracts_ = _targetedContracts;\n }\n\n function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) {\n targetedSelectors_ = _targetedSelectors;\n }\n\n function targetSenders() public view returns (address[] memory targetedSenders_) {\n targetedSenders_ = _targetedSenders;\n }\n}\n" + }, + "forge-std/StdJson.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {VmSafe} from \"./Vm.sol\";\n\n// Helpers for parsing and writing JSON files\n// To parse:\n// ```\n// using stdJson for string;\n// string memory json = vm.readFile(\"some_peth\");\n// json.parseUint(\"\");\n// ```\n// To write:\n// ```\n// using stdJson for string;\n// string memory json = \"deploymentArtifact\";\n// Contract contract = new Contract();\n// json.serialize(\"contractAddress\", address(contract));\n// json = json.serialize(\"deploymentTimes\", uint(1));\n// // store the stringified JSON to the 'json' variable we have been using as a key\n// // as we won't need it any longer\n// string memory json2 = \"finalArtifact\";\n// string memory final = json2.serialize(\"depArtifact\", json);\n// final.write(\"\");\n// ```\n\nlibrary stdJson {\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) {\n return vm.parseJson(json, key);\n }\n\n function readUint(string memory json, string memory key) internal returns (uint256) {\n return vm.parseJsonUint(json, key);\n }\n\n function readUintArray(string memory json, string memory key) internal returns (uint256[] memory) {\n return vm.parseJsonUintArray(json, key);\n }\n\n function readInt(string memory json, string memory key) internal returns (int256) {\n return vm.parseJsonInt(json, key);\n }\n\n function readIntArray(string memory json, string memory key) internal returns (int256[] memory) {\n return vm.parseJsonIntArray(json, key);\n }\n\n function readBytes32(string memory json, string memory key) internal returns (bytes32) {\n return vm.parseJsonBytes32(json, key);\n }\n\n function readBytes32Array(string memory json, string memory key) internal returns (bytes32[] memory) {\n return vm.parseJsonBytes32Array(json, key);\n }\n\n function readString(string memory json, string memory key) internal returns (string memory) {\n return vm.parseJsonString(json, key);\n }\n\n function readStringArray(string memory json, string memory key) internal returns (string[] memory) {\n return vm.parseJsonStringArray(json, key);\n }\n\n function readAddress(string memory json, string memory key) internal returns (address) {\n return vm.parseJsonAddress(json, key);\n }\n\n function readAddressArray(string memory json, string memory key) internal returns (address[] memory) {\n return vm.parseJsonAddressArray(json, key);\n }\n\n function readBool(string memory json, string memory key) internal returns (bool) {\n return vm.parseJsonBool(json, key);\n }\n\n function readBoolArray(string memory json, string memory key) internal returns (bool[] memory) {\n return vm.parseJsonBoolArray(json, key);\n }\n\n function readBytes(string memory json, string memory key) internal returns (bytes memory) {\n return vm.parseJsonBytes(json, key);\n }\n\n function readBytesArray(string memory json, string memory key) internal returns (bytes[] memory) {\n return vm.parseJsonBytesArray(json, key);\n }\n\n function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) {\n return vm.serializeBool(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bool[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBool(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) {\n return vm.serializeUint(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, uint256[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeUint(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) {\n return vm.serializeInt(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, int256[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeInt(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) {\n return vm.serializeAddress(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, address[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeAddress(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) {\n return vm.serializeBytes32(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes32[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBytes32(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) {\n return vm.serializeBytes(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBytes(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, string memory value)\n internal\n returns (string memory)\n {\n return vm.serializeString(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, string[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeString(jsonKey, key, value);\n }\n\n function write(string memory jsonKey, string memory path) internal {\n vm.writeJson(jsonKey, path);\n }\n\n function write(string memory jsonKey, string memory path, string memory valueKey) internal {\n vm.writeJson(jsonKey, path, valueKey);\n }\n}\n" + }, + "forge-std/StdMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nlibrary stdMath {\n int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968;\n\n function abs(int256 a) internal pure returns (uint256) {\n // Required or it will fail when `a = type(int256).min`\n if (a == INT256_MIN) {\n return 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n }\n\n return uint256(a > 0 ? a : -a);\n }\n\n function delta(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : b - a;\n }\n\n function delta(int256 a, int256 b) internal pure returns (uint256) {\n // a and b are of the same sign\n // this works thanks to two's complement, the left-most bit is the sign bit\n if ((a ^ b) > -1) {\n return delta(abs(a), abs(b));\n }\n\n // a and b are of opposite signs\n return abs(a) + abs(b);\n }\n\n function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 absDelta = delta(a, b);\n\n return absDelta * 1e18 / b;\n }\n\n function percentDelta(int256 a, int256 b) internal pure returns (uint256) {\n uint256 absDelta = delta(a, b);\n uint256 absB = abs(b);\n\n return absDelta * 1e18 / absB;\n }\n}\n" + }, + "forge-std/StdStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {Vm} from \"./Vm.sol\";\n\nstruct StdStorage {\n mapping(address => mapping(bytes4 => mapping(bytes32 => uint256))) slots;\n mapping(address => mapping(bytes4 => mapping(bytes32 => bool))) finds;\n bytes32[] _keys;\n bytes4 _sig;\n uint256 _depth;\n address _target;\n bytes32 _set;\n}\n\nlibrary stdStorageSafe {\n event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot);\n event WARNING_UninitedSlot(address who, uint256 slot);\n\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function sigs(string memory sigStr) internal pure returns (bytes4) {\n return bytes4(keccak256(bytes(sigStr)));\n }\n\n /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against\n // slot complexity:\n // if flat, will be bytes32(uint256(uint));\n // if map, will be keccak256(abi.encode(key, uint(slot)));\n // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))));\n // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth);\n function find(StdStorage storage self) internal returns (uint256) {\n address who = self._target;\n bytes4 fsig = self._sig;\n uint256 field_depth = self._depth;\n bytes32[] memory ins = self._keys;\n\n // calldata to test against\n if (self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n }\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n vm.record();\n bytes32 fdat;\n {\n (, bytes memory rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n\n (bytes32[] memory reads,) = vm.accesses(address(who));\n if (reads.length == 1) {\n bytes32 curr = vm.load(who, reads[0]);\n if (curr == bytes32(0)) {\n emit WARNING_UninitedSlot(who, uint256(reads[0]));\n }\n if (fdat != curr) {\n require(\n false,\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\n );\n }\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[0]));\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[0]);\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n } else if (reads.length > 1) {\n for (uint256 i = 0; i < reads.length; i++) {\n bytes32 prev = vm.load(who, reads[i]);\n if (prev == bytes32(0)) {\n emit WARNING_UninitedSlot(who, uint256(reads[i]));\n }\n // store\n vm.store(who, reads[i], bytes32(hex\"1337\"));\n bool success;\n bytes memory rdat;\n {\n (success, rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n\n if (success && fdat == bytes32(hex\"1337\")) {\n // we found which of the slots is the actual one\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[i]));\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[i]);\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n vm.store(who, reads[i], prev);\n break;\n }\n vm.store(who, reads[i], prev);\n }\n } else {\n revert(\"stdStorage find(StdStorage): No storage use detected for target.\");\n }\n\n require(\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))],\n \"stdStorage find(StdStorage): Slot(s) not found.\"\n );\n\n delete self._target;\n delete self._sig;\n delete self._keys;\n delete self._depth;\n\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n }\n\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n self._target = _target;\n return self;\n }\n\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n self._sig = _sig;\n return self;\n }\n\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n self._sig = sigs(_sig);\n return self;\n }\n\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n self._keys.push(bytes32(uint256(uint160(who))));\n return self;\n }\n\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n self._keys.push(bytes32(amt));\n return self;\n }\n\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n self._keys.push(key);\n return self;\n }\n\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n self._depth = _depth;\n return self;\n }\n\n function read(StdStorage storage self) private returns (bytes memory) {\n address t = self._target;\n uint256 s = find(self);\n return abi.encode(vm.load(t, bytes32(s)));\n }\n\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n return abi.decode(read(self), (bytes32));\n }\n\n function read_bool(StdStorage storage self) internal returns (bool) {\n int256 v = read_int(self);\n if (v == 0) return false;\n if (v == 1) return true;\n revert(\"stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool.\");\n }\n\n function read_address(StdStorage storage self) internal returns (address) {\n return abi.decode(read(self), (address));\n }\n\n function read_uint(StdStorage storage self) internal returns (uint256) {\n return abi.decode(read(self), (uint256));\n }\n\n function read_int(StdStorage storage self) internal returns (int256) {\n return abi.decode(read(self), (int256));\n }\n\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\n bytes32 out;\n\n uint256 max = b.length > 32 ? 32 : b.length;\n for (uint256 i = 0; i < max; i++) {\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n }\n return out;\n }\n\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\n bytes memory result = new bytes(b.length * 32);\n for (uint256 i = 0; i < b.length; i++) {\n bytes32 k = b[i];\n /// @solidity memory-safe-assembly\n assembly {\n mstore(add(result, add(32, mul(32, i))), k)\n }\n }\n\n return result;\n }\n}\n\nlibrary stdStorage {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function sigs(string memory sigStr) internal pure returns (bytes4) {\n return stdStorageSafe.sigs(sigStr);\n }\n\n function find(StdStorage storage self) internal returns (uint256) {\n return stdStorageSafe.find(self);\n }\n\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n return stdStorageSafe.target(self, _target);\n }\n\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n return stdStorageSafe.sig(self, _sig);\n }\n\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n return stdStorageSafe.sig(self, _sig);\n }\n\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, who);\n }\n\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, amt);\n }\n\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, key);\n }\n\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n return stdStorageSafe.depth(self, _depth);\n }\n\n function checked_write(StdStorage storage self, address who) internal {\n checked_write(self, bytes32(uint256(uint160(who))));\n }\n\n function checked_write(StdStorage storage self, uint256 amt) internal {\n checked_write(self, bytes32(amt));\n }\n\n function checked_write(StdStorage storage self, bool write) internal {\n bytes32 t;\n /// @solidity memory-safe-assembly\n assembly {\n t := write\n }\n checked_write(self, t);\n }\n\n function checked_write(StdStorage storage self, bytes32 set) internal {\n address who = self._target;\n bytes4 fsig = self._sig;\n uint256 field_depth = self._depth;\n bytes32[] memory ins = self._keys;\n\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n if (!self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n find(self);\n }\n bytes32 slot = bytes32(self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]);\n\n bytes32 fdat;\n {\n (, bytes memory rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n bytes32 curr = vm.load(who, slot);\n\n if (fdat != curr) {\n require(\n false,\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\n );\n }\n vm.store(who, slot, set);\n delete self._target;\n delete self._sig;\n delete self._keys;\n delete self._depth;\n }\n\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n return stdStorageSafe.read_bytes32(self);\n }\n\n function read_bool(StdStorage storage self) internal returns (bool) {\n return stdStorageSafe.read_bool(self);\n }\n\n function read_address(StdStorage storage self) internal returns (address) {\n return stdStorageSafe.read_address(self);\n }\n\n function read_uint(StdStorage storage self) internal returns (uint256) {\n return stdStorageSafe.read_uint(self);\n }\n\n function read_int(StdStorage storage self) internal returns (int256) {\n return stdStorageSafe.read_int(self);\n }\n\n // Private function so needs to be copied over\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\n bytes32 out;\n\n uint256 max = b.length > 32 ? 32 : b.length;\n for (uint256 i = 0; i < max; i++) {\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n }\n return out;\n }\n\n // Private function so needs to be copied over\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\n bytes memory result = new bytes(b.length * 32);\n for (uint256 i = 0; i < b.length; i++) {\n bytes32 k = b[i];\n /// @solidity memory-safe-assembly\n assembly {\n mstore(add(result, add(32, mul(32, i))), k)\n }\n }\n\n return result;\n }\n}\n" + }, + "forge-std/StdStyle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nimport {Vm} from \"./Vm.sol\";\n\nlibrary StdStyle {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n string constant RED = \"\\u001b[91m\";\n string constant GREEN = \"\\u001b[92m\";\n string constant YELLOW = \"\\u001b[93m\";\n string constant BLUE = \"\\u001b[94m\";\n string constant MAGENTA = \"\\u001b[95m\";\n string constant CYAN = \"\\u001b[96m\";\n string constant BOLD = \"\\u001b[1m\";\n string constant DIM = \"\\u001b[2m\";\n string constant ITALIC = \"\\u001b[3m\";\n string constant UNDERLINE = \"\\u001b[4m\";\n string constant INVERSE = \"\\u001b[7m\";\n string constant RESET = \"\\u001b[0m\";\n\n function styleConcat(string memory style, string memory self) private pure returns (string memory) {\n return string(abi.encodePacked(style, self, RESET));\n }\n\n function red(string memory self) internal pure returns (string memory) {\n return styleConcat(RED, self);\n }\n\n function red(uint256 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(int256 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(address self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(bool self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function redBytes(bytes memory self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function redBytes32(bytes32 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function green(string memory self) internal pure returns (string memory) {\n return styleConcat(GREEN, self);\n }\n\n function green(uint256 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(int256 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(address self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(bool self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function greenBytes(bytes memory self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function greenBytes32(bytes32 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function yellow(string memory self) internal pure returns (string memory) {\n return styleConcat(YELLOW, self);\n }\n\n function yellow(uint256 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(int256 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(address self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(bool self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellowBytes(bytes memory self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellowBytes32(bytes32 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function blue(string memory self) internal pure returns (string memory) {\n return styleConcat(BLUE, self);\n }\n\n function blue(uint256 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(int256 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(address self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(bool self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blueBytes(bytes memory self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blueBytes32(bytes32 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function magenta(string memory self) internal pure returns (string memory) {\n return styleConcat(MAGENTA, self);\n }\n\n function magenta(uint256 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(int256 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(address self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(bool self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magentaBytes(bytes memory self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magentaBytes32(bytes32 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function cyan(string memory self) internal pure returns (string memory) {\n return styleConcat(CYAN, self);\n }\n\n function cyan(uint256 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(int256 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(address self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(bool self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyanBytes(bytes memory self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyanBytes32(bytes32 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function bold(string memory self) internal pure returns (string memory) {\n return styleConcat(BOLD, self);\n }\n\n function bold(uint256 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(int256 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(address self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(bool self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function boldBytes(bytes memory self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function boldBytes32(bytes32 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function dim(string memory self) internal pure returns (string memory) {\n return styleConcat(DIM, self);\n }\n\n function dim(uint256 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(int256 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(address self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(bool self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dimBytes(bytes memory self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dimBytes32(bytes32 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function italic(string memory self) internal pure returns (string memory) {\n return styleConcat(ITALIC, self);\n }\n\n function italic(uint256 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(int256 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(address self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(bool self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italicBytes(bytes memory self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italicBytes32(bytes32 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function underline(string memory self) internal pure returns (string memory) {\n return styleConcat(UNDERLINE, self);\n }\n\n function underline(uint256 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(int256 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(address self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(bool self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underlineBytes(bytes memory self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underlineBytes32(bytes32 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function inverse(string memory self) internal pure returns (string memory) {\n return styleConcat(INVERSE, self);\n }\n\n function inverse(uint256 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(int256 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(address self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(bool self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverseBytes(bytes memory self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverseBytes32(bytes32 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n}\n" + }, + "forge-std/StdUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {IMulticall3} from \"./interfaces/IMulticall3.sol\";\n// TODO Remove import.\nimport {VmSafe} from \"./Vm.sol\";\n\nabstract contract StdUtils {\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n //////////////////////////////////////////////////////////////////////////*/\n\n IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11);\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;\n uint256 private constant INT256_MIN_ABS =\n 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n uint256 private constant UINT256_MAX =\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\n address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\n\n /*//////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) {\n require(min <= max, \"StdUtils bound(uint256,uint256,uint256): Max is less than min.\");\n // If x is between min and max, return x directly. This is to ensure that dictionary values\n // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188\n if (x >= min && x <= max) return x;\n\n uint256 size = max - min + 1;\n\n // If the value is 0, 1, 2, 3, warp that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side.\n // This helps ensure coverage of the min/max values.\n if (x <= 3 && size > x) return min + x;\n if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x);\n\n // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive.\n if (x > max) {\n uint256 diff = x - max;\n uint256 rem = diff % size;\n if (rem == 0) return max;\n result = min + rem - 1;\n } else if (x < min) {\n uint256 diff = min - x;\n uint256 rem = diff % size;\n if (rem == 0) return min;\n result = max - rem + 1;\n }\n }\n\n function bound(uint256 x, uint256 min, uint256 max) internal view virtual returns (uint256 result) {\n result = _bound(x, min, max);\n console2_log(\"Bound Result\", result);\n }\n\n function bound(int256 x, int256 min, int256 max) internal view virtual returns (int256 result) {\n require(min <= max, \"StdUtils bound(int256,int256,int256): Max is less than min.\");\n\n // Shifting all int256 values to uint256 to use _bound function. The range of two types are:\n // int256 : -(2**255) ~ (2**255 - 1)\n // uint256: 0 ~ (2**256 - 1)\n // So, add 2**255, INT256_MIN_ABS to the integer values.\n //\n // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow.\n // So, use `~uint256(x) + 1` instead.\n uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS);\n uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS);\n uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS);\n\n uint256 y = _bound(_x, _min, _max);\n\n // To move it back to int256 value, subtract INT256_MIN_ABS at here.\n result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS);\n console2_log(\"Bound result\", vm.toString(result));\n }\n\n function bytesToUint(bytes memory b) internal pure virtual returns (uint256) {\n require(b.length <= 32, \"StdUtils bytesToUint(bytes): Bytes length exceeds 32.\");\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\n }\n\n /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce\n /// @notice adapted from Solmate implementation (https://github.com/Rari-Capital/solmate/blob/main/src/utils/LibRLP.sol)\n function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) {\n // forgefmt: disable-start\n // The integer zero is treated as an empty byte string, and as a result it only has a length prefix, 0x80, computed via 0x80 + 0.\n // A one byte integer uses its own value as its length prefix, there is no additional \"0x80 + length\" prefix that comes before it.\n if (nonce == 0x00) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, bytes1(0x80))));\n if (nonce <= 0x7f) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, uint8(nonce))));\n\n // Nonces greater than 1 byte all follow a consistent encoding scheme, where each value is preceded by a prefix of 0x80 + length.\n if (nonce <= 2**8 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd7), bytes1(0x94), deployer, bytes1(0x81), uint8(nonce))));\n if (nonce <= 2**16 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd8), bytes1(0x94), deployer, bytes1(0x82), uint16(nonce))));\n if (nonce <= 2**24 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd9), bytes1(0x94), deployer, bytes1(0x83), uint24(nonce))));\n // forgefmt: disable-end\n\n // More details about RLP encoding can be found here: https://eth.wiki/fundamentals/rlp\n // 0xda = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x84 ++ nonce)\n // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)\n // 0x84 = 0x80 + 0x04 (0x04 = the bytes length of the nonce, 4 bytes, in hex)\n // We assume nobody can have a nonce large enough to require more than 32 bytes.\n return addressFromLast20Bytes(\n keccak256(abi.encodePacked(bytes1(0xda), bytes1(0x94), deployer, bytes1(0x84), uint32(nonce)))\n );\n }\n\n function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer)\n internal\n pure\n virtual\n returns (address)\n {\n return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, initcodeHash)));\n }\n\n /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer\n function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) {\n return computeCreate2Address(salt, initCodeHash, CREATE2_FACTORY);\n }\n\n /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\n function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) {\n return hashInitCode(creationCode, \"\");\n }\n\n /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\n /// @param args the ABI-encoded arguments to the constructor of C\n function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(creationCode, args));\n }\n\n // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses.\n function getTokenBalances(address token, address[] memory addresses)\n internal\n virtual\n returns (uint256[] memory balances)\n {\n uint256 tokenCodeSize;\n assembly {\n tokenCodeSize := extcodesize(token)\n }\n require(tokenCodeSize > 0, \"StdUtils getTokenBalances(address,address[]): Token address is not a contract.\");\n\n // ABI encode the aggregate call to Multicall3.\n uint256 length = addresses.length;\n IMulticall3.Call[] memory calls = new IMulticall3.Call[](length);\n for (uint256 i = 0; i < length; ++i) {\n // 0x70a08231 = bytes4(\"balanceOf(address)\"))\n calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))});\n }\n\n // Make the aggregate call.\n (, bytes[] memory returnData) = multicall.aggregate(calls);\n\n // ABI decode the return data and return the balances.\n balances = new uint256[](length);\n for (uint256 i = 0; i < length; ++i) {\n balances[i] = abi.decode(returnData[i], (uint256));\n }\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n PRIVATE FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) {\n return address(uint160(uint256(bytesValue)));\n }\n\n // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere.\n\n function console2_log(string memory p0, uint256 p1) private view {\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n status;\n }\n\n function console2_log(string memory p0, string memory p1) private view {\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n status;\n }\n}\n" + }, + "forge-std/Test.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\n// 💬 ABOUT\n// Standard Library's default Test\n\n// 🧩 MODULES\nimport {console} from \"./console.sol\";\nimport {console2} from \"./console2.sol\";\nimport {StdAssertions} from \"./StdAssertions.sol\";\nimport {StdChains} from \"./StdChains.sol\";\nimport {StdCheats} from \"./StdCheats.sol\";\nimport {stdError} from \"./StdError.sol\";\nimport {StdInvariant} from \"./StdInvariant.sol\";\nimport {stdJson} from \"./StdJson.sol\";\nimport {stdMath} from \"./StdMath.sol\";\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\nimport {StdUtils} from \"./StdUtils.sol\";\nimport {Vm} from \"./Vm.sol\";\nimport {StdStyle} from \"./StdStyle.sol\";\n\n// 📦 BOILERPLATE\nimport {TestBase} from \"./Base.sol\";\nimport {DSTest} from \"ds-test/test.sol\";\n\n// ⭐️ TEST\nabstract contract Test is DSTest, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils, TestBase {\n// Note: IS_TEST() must return true.\n// Note: Must have failure system, https://github.com/dapphub/ds-test/blob/cd98eff28324bfac652e63a239a60632a761790b/src/test.sol#L39-L76.\n}\n" + }, + "forge-std/Vm.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\n// Cheatcodes are marked as view/pure/none using the following rules:\n// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,\n// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure (you are modifying some state be it the EVM, interpreter, filesystem, etc),\n// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,\n// 3. Otherwise you're `pure`.\n\ninterface VmSafe {\n struct Log {\n bytes32[] topics;\n bytes data;\n address emitter;\n }\n\n struct Rpc {\n string key;\n string url;\n }\n\n struct FsMetadata {\n bool isDir;\n bool isSymlink;\n uint256 length;\n bool readOnly;\n uint256 modified;\n uint256 accessed;\n uint256 created;\n }\n\n // Loads a storage slot from an address\n function load(address target, bytes32 slot) external view returns (bytes32 data);\n // Signs data\n function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);\n // Gets the address for a given private key\n function addr(uint256 privateKey) external pure returns (address keyAddr);\n // Gets the nonce of an account\n function getNonce(address account) external view returns (uint64 nonce);\n // Performs a foreign function call via the terminal\n function ffi(string[] calldata commandInput) external returns (bytes memory result);\n // Sets environment variables\n function setEnv(string calldata name, string calldata value) external;\n // Reads environment variables, (name) => (value)\n function envBool(string calldata name) external view returns (bool value);\n function envUint(string calldata name) external view returns (uint256 value);\n function envInt(string calldata name) external view returns (int256 value);\n function envAddress(string calldata name) external view returns (address value);\n function envBytes32(string calldata name) external view returns (bytes32 value);\n function envString(string calldata name) external view returns (string memory value);\n function envBytes(string calldata name) external view returns (bytes memory value);\n // Reads environment variables as arrays\n function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);\n function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);\n function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);\n function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);\n function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);\n function envString(string calldata name, string calldata delim) external view returns (string[] memory value);\n function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);\n // Read environment variables with default value\n function envOr(string calldata name, bool defaultValue) external returns (bool value);\n function envOr(string calldata name, uint256 defaultValue) external returns (uint256 value);\n function envOr(string calldata name, int256 defaultValue) external returns (int256 value);\n function envOr(string calldata name, address defaultValue) external returns (address value);\n function envOr(string calldata name, bytes32 defaultValue) external returns (bytes32 value);\n function envOr(string calldata name, string calldata defaultValue) external returns (string memory value);\n function envOr(string calldata name, bytes calldata defaultValue) external returns (bytes memory value);\n // Read environment variables as arrays with default value\n function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)\n external\n returns (bool[] memory value);\n function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)\n external\n returns (uint256[] memory value);\n function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)\n external\n returns (int256[] memory value);\n function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)\n external\n returns (address[] memory value);\n function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)\n external\n returns (bytes32[] memory value);\n function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)\n external\n returns (string[] memory value);\n function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)\n external\n returns (bytes[] memory value);\n // Records all storage reads and writes\n function record() external;\n // Gets all accessed reads and write slot from a recording session, for a given address\n function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);\n // Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file\n function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);\n // Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file\n function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);\n // Labels an address in call traces\n function label(address account, string calldata newLabel) external;\n // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain\n function broadcast() external;\n // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain\n function broadcast(address signer) external;\n // Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain\n function broadcast(uint256 privateKey) external;\n // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain\n function startBroadcast() external;\n // Has all subsequent calls (at this call depth only) create transactions with the address provided that can later be signed and sent onchain\n function startBroadcast(address signer) external;\n // Has all subsequent calls (at this call depth only) create transactions with the private key provided that can later be signed and sent onchain\n function startBroadcast(uint256 privateKey) external;\n // Stops collecting onchain transactions\n function stopBroadcast() external;\n // Reads the entire content of file to string\n function readFile(string calldata path) external view returns (string memory data);\n // Reads the entire content of file as binary. Path is relative to the project root.\n function readFileBinary(string calldata path) external view returns (bytes memory data);\n // Get the path of the current project root\n function projectRoot() external view returns (string memory path);\n // Get the metadata for a file/directory\n function fsMetadata(string calldata fileOrDir) external returns (FsMetadata memory metadata);\n // Reads next line of file to string\n function readLine(string calldata path) external view returns (string memory line);\n // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.\n function writeFile(string calldata path, string calldata data) external;\n // Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.\n // Path is relative to the project root.\n function writeFileBinary(string calldata path, bytes calldata data) external;\n // Writes line to file, creating a file if it does not exist.\n function writeLine(string calldata path, string calldata data) external;\n // Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.\n function closeFile(string calldata path) external;\n // Removes file. This cheatcode will revert in the following situations, but is not limited to just these cases:\n // - Path points to a directory.\n // - The file doesn't exist.\n // - The user lacks permissions to remove the file.\n function removeFile(string calldata path) external;\n // Convert values to a string\n function toString(address value) external pure returns (string memory stringifiedValue);\n function toString(bytes calldata value) external pure returns (string memory stringifiedValue);\n function toString(bytes32 value) external pure returns (string memory stringifiedValue);\n function toString(bool value) external pure returns (string memory stringifiedValue);\n function toString(uint256 value) external pure returns (string memory stringifiedValue);\n function toString(int256 value) external pure returns (string memory stringifiedValue);\n // Convert values from a string\n function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);\n function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);\n function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);\n function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);\n function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);\n function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);\n // Record all the transaction logs\n function recordLogs() external;\n // Gets all the recorded logs\n function getRecordedLogs() external returns (Log[] memory logs);\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path m/44'/60'/0'/0/{index}\n function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at {derivationPath}{index}\n function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)\n external\n pure\n returns (uint256 privateKey);\n // Adds a private key to the local forge wallet and returns the address\n function rememberKey(uint256 privateKey) external returns (address keyAddr);\n //\n // parseJson\n //\n // ----\n // In case the returned value is a JSON object, it's encoded as a ABI-encoded tuple. As JSON objects\n // don't have the notion of ordered, but tuples do, they JSON object is encoded with it's fields ordered in\n // ALPHABETICAL order. That means that in order to successfully decode the tuple, we need to define a tuple that\n // encodes the fields in the same order, which is alphabetical. In the case of Solidity structs, they are encoded\n // as tuples, with the attributes in the order in which they are defined.\n // For example: json = { 'a': 1, 'b': 0xa4tb......3xs}\n // a: uint256\n // b: address\n // To decode that json, we need to define a struct or a tuple as follows:\n // struct json = { uint256 a; address b; }\n // If we defined a json struct with the opposite order, meaning placing the address b first, it would try to\n // decode the tuple in that order, and thus fail.\n // ----\n // Given a string of JSON, return it as ABI-encoded\n function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);\n function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);\n\n // The following parseJson cheatcodes will do type coercion, for the type that they indicate.\n // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12'\n // and hex numbers '0xEF'.\n // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not\n // a JSON object.\n function parseJsonUint(string calldata, string calldata) external returns (uint256);\n function parseJsonUintArray(string calldata, string calldata) external returns (uint256[] memory);\n function parseJsonInt(string calldata, string calldata) external returns (int256);\n function parseJsonIntArray(string calldata, string calldata) external returns (int256[] memory);\n function parseJsonBool(string calldata, string calldata) external returns (bool);\n function parseJsonBoolArray(string calldata, string calldata) external returns (bool[] memory);\n function parseJsonAddress(string calldata, string calldata) external returns (address);\n function parseJsonAddressArray(string calldata, string calldata) external returns (address[] memory);\n function parseJsonString(string calldata, string calldata) external returns (string memory);\n function parseJsonStringArray(string calldata, string calldata) external returns (string[] memory);\n function parseJsonBytes(string calldata, string calldata) external returns (bytes memory);\n function parseJsonBytesArray(string calldata, string calldata) external returns (bytes[] memory);\n function parseJsonBytes32(string calldata, string calldata) external returns (bytes32);\n function parseJsonBytes32Array(string calldata, string calldata) external returns (bytes32[] memory);\n\n // Serialize a key and value to a JSON object stored in-memory that can be later written to a file\n // It returns the stringified version of the specific JSON file up to that moment.\n function serializeBool(string calldata objectKey, string calldata valueKey, bool value)\n external\n returns (string memory json);\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)\n external\n returns (string memory json);\n function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)\n external\n returns (string memory json);\n function serializeAddress(string calldata objectKey, string calldata valueKey, address value)\n external\n returns (string memory json);\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)\n external\n returns (string memory json);\n function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)\n external\n returns (string memory json);\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)\n external\n returns (string memory json);\n\n function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)\n external\n returns (string memory json);\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)\n external\n returns (string memory json);\n function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)\n external\n returns (string memory json);\n function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)\n external\n returns (string memory json);\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)\n external\n returns (string memory json);\n function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)\n external\n returns (string memory json);\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)\n external\n returns (string memory json);\n\n //\n // writeJson\n //\n // ----\n // Write a serialized JSON object to a file. If the file exists, it will be overwritten.\n // Let's assume we want to write the following JSON to a file:\n //\n // { \"boolean\": true, \"number\": 342, \"object\": { \"title\": \"finally json serialization\" } }\n //\n // ```\n // string memory json1 = \"some key\";\n // vm.serializeBool(json1, \"boolean\", true);\n // vm.serializeBool(json1, \"number\", uint256(342));\n // json2 = \"some other key\";\n // string memory output = vm.serializeString(json2, \"title\", \"finally json serialization\");\n // string memory finalJson = vm.serialize(json1, \"object\", output);\n // vm.writeJson(finalJson, \"./output/example.json\");\n // ```\n // The critical insight is that every invocation of serialization will return the stringified version of the JSON\n // up to that point. That means we can construct arbitrary JSON objects and then use the return stringified version\n // to serialize them as values to another JSON object.\n //\n // json1 and json2 are simply keys used by the backend to keep track of the objects. So vm.serializeJson(json1,..)\n // will find the object in-memory that is keyed by \"some key\".\n function writeJson(string calldata json, string calldata path) external;\n // Write a serialized JSON object to an **existing** JSON file, replacing a value with key = \n // This is useful to replace a specific value of a JSON file, without having to parse the entire thing\n function writeJson(string calldata json, string calldata path, string calldata valueKey) external;\n // Returns the RPC url for the given alias\n function rpcUrl(string calldata rpcAlias) external view returns (string memory json);\n // Returns all rpc urls and their aliases `[alias, url][]`\n function rpcUrls() external view returns (string[2][] memory urls);\n // Returns all rpc urls and their aliases as structs.\n function rpcUrlStructs() external view returns (Rpc[] memory urls);\n // If the condition is false, discard this run's fuzz inputs and generate new ones.\n function assume(bool condition) external pure;\n // Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.\n function pauseGasMetering() external;\n // Resumes gas metering (i.e. gas usage is counted again). Noop if already on.\n function resumeGasMetering() external;\n}\n\ninterface Vm is VmSafe {\n // Sets block.timestamp\n function warp(uint256 newTimestamp) external;\n // Sets block.height\n function roll(uint256 newHeight) external;\n // Sets block.basefee\n function fee(uint256 newBasefee) external;\n // Sets block.difficulty\n function difficulty(uint256 newDifficulty) external;\n // Sets block.chainid\n function chainId(uint256 newChainId) external;\n // Stores a value to an address' storage slot.\n function store(address target, bytes32 slot, bytes32 value) external;\n // Sets the nonce of an account; must be higher than the current nonce of the account\n function setNonce(address account, uint64 newNonce) external;\n // Sets the *next* call's msg.sender to be the input address\n function prank(address msgSender) external;\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called\n function startPrank(address msgSender) external;\n // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input\n function prank(address msgSender, address txOrigin) external;\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input\n function startPrank(address msgSender, address txOrigin) external;\n // Resets subsequent calls' msg.sender to be `address(this)`\n function stopPrank() external;\n // Sets an address' balance\n function deal(address account, uint256 newBalance) external;\n // Sets an address' code\n function etch(address target, bytes calldata newRuntimeBytecode) external;\n // Expects an error on next call\n function expectRevert(bytes calldata revertData) external;\n function expectRevert(bytes4 revertData) external;\n function expectRevert() external;\n // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).\n // Call this function, then emit an event, then call a function. Internally after the call, we check if\n // logs were emitted in the expected order with the expected topics and data (as specified by the booleans)\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)\n external;\n // Mocks a call to an address, returning specified data.\n // Calldata can either be strict or a partial match, e.g. if you only\n // pass a Solidity selector to the expected calldata, then the entire Solidity\n // function will be mocked.\n function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;\n // Mocks a call to an address with a specific msg.value, returning specified data.\n // Calldata match takes precedence over msg.value in case of ambiguity.\n function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;\n // Clears all mocked calls\n function clearMockedCalls() external;\n // Expects a call to an address with the specified calldata.\n // Calldata can either be a strict or a partial match\n function expectCall(address callee, bytes calldata data) external;\n // Expects a call to an address with the specified msg.value and calldata\n function expectCall(address callee, uint256 msgValue, bytes calldata data) external;\n // Expect a call to an address with the specified msg.value, gas, and calldata.\n function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;\n // Expect a call to an address with the specified msg.value and calldata, and a *minimum* amount of gas.\n function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;\n // Sets block.coinbase\n function coinbase(address newCoinbase) external;\n // Snapshot the current state of the evm.\n // Returns the id of the snapshot that was created.\n // To revert a snapshot use `revertTo`\n function snapshot() external returns (uint256 snapshotId);\n // Revert the state of the EVM to a previous snapshot\n // Takes the snapshot id to revert to.\n // This deletes the snapshot and all snapshots taken after the given snapshot id.\n function revertTo(uint256 snapshotId) external returns (bool success);\n // Creates a new fork with the given endpoint and block and returns the identifier of the fork\n function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\n // Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork\n function createFork(string calldata urlOrAlias) external returns (uint256 forkId);\n // Creates a new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before the transaction,\n // and returns the identifier of the fork\n function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n // Creates _and_ also selects a new fork with the given endpoint and block and returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\n // Creates _and_ also selects new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before\n // the transaction, returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n // Creates _and_ also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);\n // Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.\n function selectFork(uint256 forkId) external;\n /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.\n function activeFork() external view returns (uint256 forkId);\n // Updates the currently active fork to given block number\n // This is similar to `roll` but for the currently active fork\n function rollFork(uint256 blockNumber) external;\n // Updates the currently active fork to given transaction\n // this will `rollFork` with the number of the block the transaction was mined in and replays all transaction mined before it in the block\n function rollFork(bytes32 txHash) external;\n // Updates the given fork to given block number\n function rollFork(uint256 forkId, uint256 blockNumber) external;\n // Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block\n function rollFork(uint256 forkId, bytes32 txHash) external;\n // Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\n // Meaning, changes made to the state of this account will be kept when switching forks\n function makePersistent(address account) external;\n function makePersistent(address account0, address account1) external;\n function makePersistent(address account0, address account1, address account2) external;\n function makePersistent(address[] calldata accounts) external;\n // Revokes persistent status from the address, previously added via `makePersistent`\n function revokePersistent(address account) external;\n function revokePersistent(address[] calldata accounts) external;\n // Returns true if the account is marked as persistent\n function isPersistent(address account) external view returns (bool persistent);\n // In forking mode, explicitly grant the given address cheatcode access\n function allowCheatcodes(address account) external;\n // Fetches the given transaction from the active fork and executes it on the current state\n function transact(bytes32 txHash) external;\n // Fetches the given transaction from the given fork and executes it on the current state\n function transact(uint256 forkId, bytes32 txHash) external;\n}\n" + }, + "ops/interfaces/IResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\nabstract contract Auth {\n event OwnerUpdated(address indexed user, address indexed newOwner);\n\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n address public owner;\n\n Authority public authority;\n\n constructor(address _owner, Authority _authority) {\n owner = _owner;\n authority = _authority;\n\n emit OwnerUpdated(msg.sender, _owner);\n emit AuthorityUpdated(msg.sender, _authority);\n }\n\n modifier requiresAuth() virtual {\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\n\n _;\n }\n\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\n }\n\n function setAuthority(Authority newAuthority) public virtual {\n // We check if the caller is the owner first because we want to ensure they can\n // always swap out the authority even if it's reverting or using up a lot of gas.\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\n\n authority = newAuthority;\n\n emit AuthorityUpdated(msg.sender, newAuthority);\n }\n\n function setOwner(address newOwner) public virtual requiresAuth {\n owner = newOwner;\n\n emit OwnerUpdated(msg.sender, newOwner);\n }\n}\n\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\ninterface Authority {\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n}\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {Auth, Authority} from \"../Auth.sol\";\n\n/// @notice Role based Authority that supports up to 256 roles.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\ncontract RolesAuthority is Auth, Authority {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\n\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\n\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\n\n /*//////////////////////////////////////////////////////////////\n ROLE/USER STORAGE\n //////////////////////////////////////////////////////////////*/\n\n mapping(address => bytes32) public getUserRoles;\n\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\n\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\n\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\n }\n\n function doesRoleHaveCapability(\n uint8 role,\n address target,\n bytes4 functionSig\n ) public view virtual returns (bool) {\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\n }\n\n /*//////////////////////////////////////////////////////////////\n AUTHORIZATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) public view virtual override returns (bool) {\n return\n isCapabilityPublic[target][functionSig] ||\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\n }\n\n /*//////////////////////////////////////////////////////////////\n ROLE CAPABILITY CONFIGURATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setPublicCapability(\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n isCapabilityPublic[target][functionSig] = enabled;\n\n emit PublicCapabilityUpdated(target, functionSig, enabled);\n }\n\n function setRoleCapability(\n uint8 role,\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\n } else {\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\n }\n\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\n }\n\n /*//////////////////////////////////////////////////////////////\n USER ROLE ASSIGNMENT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setUserRole(\n address user,\n uint8 role,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getUserRoles[user] |= bytes32(1 << role);\n } else {\n getUserRoles[user] &= ~bytes32(1 << role);\n }\n\n emit UserRoleUpdated(user, role, enabled);\n }\n}\n" + }, + "solmate/mixins/ERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"../utils/SafeTransferLib.sol\";\nimport {FixedPointMathLib} from \"../utils/FixedPointMathLib.sol\";\n\n/// @notice Minimal ERC4626 tokenized Vault implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\nabstract contract ERC4626 is ERC20 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /*//////////////////////////////////////////////////////////////\n IMMUTABLES\n //////////////////////////////////////////////////////////////*/\n\n ERC20 public immutable asset;\n\n constructor(\n ERC20 _asset,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol, _asset.decimals()) {\n asset = _asset;\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function totalAssets() public view virtual returns (uint256);\n\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\n }\n\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\n }\n\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n return convertToShares(assets);\n }\n\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\n }\n\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\n }\n\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n return convertToAssets(shares);\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf[owner]);\n }\n\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf[owner];\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL HOOKS LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\n}\n" + }, + "solmate/test/utils/DSTestPlus.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {DSTest} from \"ds-test/test.sol\";\n\nimport {Hevm} from \"./Hevm.sol\";\n\n/// @notice Extended testing framework for DappTools projects.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/test/utils/DSTestPlus.sol)\ncontract DSTestPlus is DSTest {\n Hevm internal constant hevm = Hevm(HEVM_ADDRESS);\n\n address internal constant DEAD_ADDRESS = 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF;\n\n string private checkpointLabel;\n uint256 private checkpointGasLeft = 1; // Start the slot warm.\n\n modifier brutalizeMemory(bytes memory brutalizeWith) {\n /// @solidity memory-safe-assembly\n assembly {\n // Fill the 64 bytes of scratch space with the data.\n pop(\n staticcall(\n gas(), // Pass along all the gas in the call.\n 0x04, // Call the identity precompile address.\n brutalizeWith, // Offset is the bytes' pointer.\n 64, // Copy enough to only fill the scratch space.\n 0, // Store the return value in the scratch space.\n 64 // Scratch space is only 64 bytes in size, we don't want to write further.\n )\n )\n\n let size := add(mload(brutalizeWith), 32) // Add 32 to include the 32 byte length slot.\n\n // Fill the free memory pointer's destination with the data.\n pop(\n staticcall(\n gas(), // Pass along all the gas in the call.\n 0x04, // Call the identity precompile address.\n brutalizeWith, // Offset is the bytes' pointer.\n size, // We want to pass the length of the bytes.\n mload(0x40), // Store the return value at the free memory pointer.\n size // Since the precompile just returns its input, we reuse size.\n )\n )\n }\n\n _;\n }\n\n function startMeasuringGas(string memory label) internal virtual {\n checkpointLabel = label;\n\n checkpointGasLeft = gasleft();\n }\n\n function stopMeasuringGas() internal virtual {\n uint256 checkpointGasLeft2 = gasleft();\n\n // Subtract 100 to account for the warm SLOAD in startMeasuringGas.\n uint256 gasDelta = checkpointGasLeft - checkpointGasLeft2 - 100;\n\n emit log_named_uint(string(abi.encodePacked(checkpointLabel, \" Gas\")), gasDelta);\n }\n\n function fail(string memory err) internal virtual {\n emit log_named_string(\"Error\", err);\n fail();\n }\n\n function assertFalse(bool data) internal virtual {\n assertTrue(!data);\n }\n\n function assertUint128Eq(uint128 a, uint128 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertUint64Eq(uint64 a, uint64 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertUint96Eq(uint96 a, uint96 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertUint32Eq(uint32 a, uint32 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertBoolEq(bool a, bool b) internal virtual {\n b ? assertTrue(a) : assertFalse(a);\n }\n\n function assertApproxEq(\n uint256 a,\n uint256 b,\n uint256 maxDelta\n ) internal virtual {\n uint256 delta = a > b ? a - b : b - a;\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Expected\", b);\n emit log_named_uint(\" Actual\", a);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertRelApproxEq(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100%\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too.\n\n uint256 percentDelta = ((a > b ? a - b : b - a) * 1e18) / b;\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Expected\", b);\n emit log_named_uint(\" Actual\", a);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertBytesEq(bytes memory a, bytes memory b) internal virtual {\n if (keccak256(a) != keccak256(b)) {\n emit log(\"Error: a == b not satisfied [bytes]\");\n emit log_named_bytes(\" Expected\", b);\n emit log_named_bytes(\" Actual\", a);\n fail();\n }\n }\n\n function assertUintArrayEq(uint256[] memory a, uint256[] memory b) internal virtual {\n require(a.length == b.length, \"LENGTH_MISMATCH\");\n\n for (uint256 i = 0; i < a.length; i++) {\n assertEq(a[i], b[i]);\n }\n }\n\n function bound(\n uint256 x,\n uint256 min,\n uint256 max\n ) internal virtual returns (uint256 result) {\n require(max >= min, \"MAX_LESS_THAN_MIN\");\n\n uint256 size = max - min;\n\n if (size == 0) result = min;\n else if (size == type(uint256).max) result = x;\n else {\n ++size; // Make max inclusive.\n uint256 mod = x % size;\n result = min + mod;\n }\n\n emit log_named_uint(\"Bound Result\", result);\n }\n\n function min3(\n uint256 a,\n uint256 b,\n uint256 c\n ) internal pure returns (uint256) {\n return a > b ? (b > c ? c : b) : (a > c ? c : a);\n }\n\n function min2(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? b : a;\n }\n}\n" + }, + "solmate/test/utils/Hevm.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface Hevm {\n /// @notice Sets the block timestamp.\n function warp(uint256) external;\n\n /// @notice Sets the block height.\n function roll(uint256) external;\n\n /// @notice Sets the block base fee.\n function fee(uint256) external;\n\n /// @notice Loads a storage slot from an address.\n function load(address, bytes32) external returns (bytes32);\n\n /// @notice Stores a value to an address' storage slot.\n function store(\n address,\n bytes32,\n bytes32\n ) external;\n\n /// @notice Signs a digest with a private key, returns v r s.\n function sign(uint256, bytes32)\n external\n returns (\n uint8,\n bytes32,\n bytes32\n );\n\n /// @notice Gets address for a given private key.\n function addr(uint256) external returns (address);\n\n /// @notice Performs a foreign function call via a terminal call.\n function ffi(string[] calldata) external returns (bytes memory);\n\n /// @notice Sets the next call's msg.sender to be the input address.\n function prank(address) external;\n\n /// @notice Sets all subsequent calls' msg.sender to be the input address until stopPrank is called.\n function startPrank(address) external;\n\n /// @notice Sets the next call's msg.sender to be the input address and the tx.origin to be the second input.\n function prank(address, address) external;\n\n /// @notice Sets all subsequent calls' msg.sender to be the input address and\n /// sets tx.origin to be the second address inputted until stopPrank is called.\n function startPrank(address, address) external;\n\n /// @notice Resets msg.sender to its original value before a prank.\n function stopPrank() external;\n\n /// @notice Sets an address' balance.\n function deal(address, uint256) external;\n\n /// @notice Sets an address' code.\n function etch(address, bytes calldata) external;\n\n /// @notice Expects an error from the next call.\n function expectRevert(bytes calldata) external;\n\n /// @notice Expects a revert from the next call.\n function expectRevert(bytes4) external;\n\n /// @notice Record all storage reads and writes.\n function record() external;\n\n /// @notice Gets all accessed reads and write slots from a recording session, for a given address.\n function accesses(address) external returns (bytes32[] memory reads, bytes32[] memory writes);\n\n /// @notice Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).\n /// @notice Call this function, then emit an event, then call a function. Internally after the call, we check\n /// if logs were emitted in the expected order with the expected topics and data as specified by the booleans.\n function expectEmit(\n bool,\n bool,\n bool,\n bool\n ) external;\n\n /// @notice Mocks the behavior of a contract call, setting the input and output for a function.\n /// @notice Calldata can either be strict or a partial match, e.g. if only passed\n /// a selector to the expected calldata, then the entire function will be mocked.\n function mockCall(\n address,\n bytes calldata,\n bytes calldata\n ) external;\n\n /// @notice Clears all mocked calls.\n function clearMockedCalls() external;\n\n /// @notice Expect a call to an address with the specified calldata.\n /// @notice Calldata can either be strict or a partial match.\n function expectCall(address, bytes calldata) external;\n\n /// @notice Fetches the contract bytecode from its artifact file.\n function getCode(string calldata) external returns (bytes memory);\n\n /// @notice Label an address in test traces.\n function label(address addr, string calldata label) external;\n\n /// @notice When fuzzing, generate new inputs if the input conditional is not met.\n function assume(bool) external;\n}\n" + }, + "solmate/test/utils/mocks/MockERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../../../tokens/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) ERC20(_name, _symbol, _decimals) {}\n\n function mint(address to, uint256 value) public virtual {\n _mint(to, value);\n }\n\n function burn(address from, uint256 value) public virtual {\n _burn(from, value);\n }\n}\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "solmate/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n // Mod x by y. Note this will return\n // 0 instead of reverting if y is zero.\n z := mod(x, y)\n }\n }\n\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n assembly {\n // Divide x by y. Note this will return\n // 0 instead of reverting if y is zero.\n r := div(x, y)\n }\n }\n\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n // Add 1 to x * y if x % y > 0. Note this will\n // return 0 instead of reverting if y is zero.\n z := add(gt(mod(x, y), 0), div(x, y))\n }\n }\n}\n" + }, + "solmate/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Safe unsigned integer casting library that reverts on overflow.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\nlibrary SafeCastLib {\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\n require(x < 1 << 248);\n\n y = uint248(x);\n }\n\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\n require(x < 1 << 224);\n\n y = uint224(x);\n }\n\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\n require(x < 1 << 192);\n\n y = uint192(x);\n }\n\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\n require(x < 1 << 160);\n\n y = uint160(x);\n }\n\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\n require(x < 1 << 128);\n\n y = uint128(x);\n }\n\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\n require(x < 1 << 96);\n\n y = uint96(x);\n }\n\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\n require(x < 1 << 64);\n\n y = uint64(x);\n }\n\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\n require(x < 1 << 32);\n\n y = uint32(x);\n }\n\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\n require(x < 1 << 24);\n\n y = uint24(x);\n }\n\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\n require(x < 1 << 16);\n\n y = uint16(x);\n }\n\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\n require(x < 1 << 8);\n\n y = uint8(x);\n }\n}\n" + }, + "solmate/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n /*//////////////////////////////////////////////////////////////\n ETH OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferETH(address to, uint256 amount) internal {\n bool success;\n\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n require(success, \"ETH_TRANSFER_FAILED\");\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferFrom(\n ERC20 token,\n address from,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FROM_FAILED\");\n }\n\n function safeTransfer(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FAILED\");\n }\n\n function safeApprove(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"APPROVE_FAILED\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/a198deba20a3c9464a98ef0313fee382.json b/packages/contracts/deployments/base/solcInputs/a198deba20a3c9464a98ef0313fee382.json new file mode 100644 index 0000000000..785a58550f --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/a198deba20a3c9464a98ef0313fee382.json @@ -0,0 +1,291 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./OwnableUpgradeable.sol\";\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership} and {acceptOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available all functions\r\n * from parent (Ownable).\r\n */\r\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\r\n function __Ownable2Step_init() internal onlyInitializing {\r\n __Ownable_init_unchained();\r\n }\r\n\r\n function __Ownable2Step_init_unchained() internal onlyInitializing {\r\n }\r\n address private _pendingOwner;\r\n\r\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Returns the address of the pending owner.\r\n */\r\n function pendingOwner() public view virtual returns (address) {\r\n return _pendingOwner;\r\n }\r\n\r\n /**\r\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual override onlyOwner {\r\n _pendingOwner = newOwner;\r\n emit OwnershipTransferStarted(owner(), newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual override {\r\n delete _pendingOwner;\r\n super._transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev The new owner accepts the ownership transfer.\r\n */\r\n function acceptOwnership() external {\r\n address sender = _msgSender();\r\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\r\n _transferOwnership(sender);\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../utils/ContextUpgradeable.sol\";\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n function __Ownable_init() internal onlyInitializing {\r\n __Ownable_init_unchained();\r\n }\r\n\r\n function __Ownable_init_unchained() internal onlyInitializing {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n _checkOwner();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if the sender is not the owner.\r\n */\r\n function _checkOwner() internal view virtual {\r\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions anymore. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby removing any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/interfaces/IERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"../token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\r\n\r\n/**\r\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\r\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\r\n *\r\n * _Available since v4.7._\r\n */\r\ninterface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {\r\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\r\n\r\n event Withdraw(\r\n address indexed sender,\r\n address indexed receiver,\r\n address indexed owner,\r\n uint256 assets,\r\n uint256 shares\r\n );\r\n\r\n /**\r\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\r\n *\r\n * - MUST be an ERC-20 token contract.\r\n * - MUST NOT revert.\r\n */\r\n function asset() external view returns (address assetTokenAddress);\r\n\r\n /**\r\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\r\n *\r\n * - SHOULD include any compounding that occurs from yield.\r\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\r\n * - MUST NOT revert.\r\n */\r\n function totalAssets() external view returns (uint256 totalManagedAssets);\r\n\r\n /**\r\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\r\n * scenario where all the conditions are met.\r\n *\r\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\r\n * - MUST NOT show any variations depending on the caller.\r\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\r\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\r\n * from.\r\n */\r\n function convertToShares(uint256 assets) external view returns (uint256 shares);\r\n\r\n /**\r\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\r\n * scenario where all the conditions are met.\r\n *\r\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\r\n * - MUST NOT show any variations depending on the caller.\r\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\r\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\r\n * from.\r\n */\r\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\r\n\r\n /**\r\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\r\n * through a deposit call.\r\n *\r\n * - MUST return a limited value if receiver is subject to some deposit limit.\r\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\r\n * - MUST NOT revert.\r\n */\r\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\r\n * current on-chain conditions.\r\n *\r\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\r\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\r\n * in the same transaction.\r\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\r\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\r\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\r\n */\r\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\r\n\r\n /**\r\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\r\n *\r\n * - MUST emit the Deposit event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\r\n * deposit execution, and are accounted for during deposit.\r\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\r\n * approving enough underlying tokens to the Vault contract, etc).\r\n *\r\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\r\n */\r\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\r\n\r\n /**\r\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\r\n * - MUST return a limited value if receiver is subject to some mint limit.\r\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\r\n * - MUST NOT revert.\r\n */\r\n function maxMint(address receiver) external view returns (uint256 maxShares);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\r\n * current on-chain conditions.\r\n *\r\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\r\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\r\n * same transaction.\r\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\r\n * would be accepted, regardless if the user has enough tokens approved, etc.\r\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\r\n */\r\n function previewMint(uint256 shares) external view returns (uint256 assets);\r\n\r\n /**\r\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\r\n *\r\n * - MUST emit the Deposit event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\r\n * execution, and are accounted for during mint.\r\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\r\n * approving enough underlying tokens to the Vault contract, etc).\r\n *\r\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\r\n */\r\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\r\n\r\n /**\r\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\r\n * Vault, through a withdraw call.\r\n *\r\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\r\n * - MUST NOT revert.\r\n */\r\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\r\n * given current on-chain conditions.\r\n *\r\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\r\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\r\n * called\r\n * in the same transaction.\r\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\r\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\r\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\r\n */\r\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\r\n\r\n /**\r\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\r\n *\r\n * - MUST emit the Withdraw event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\r\n * withdraw execution, and are accounted for during withdraw.\r\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\r\n * not having enough shares, etc).\r\n *\r\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\r\n * Those methods should be performed separately.\r\n */\r\n function withdraw(\r\n uint256 assets,\r\n address receiver,\r\n address owner\r\n ) external returns (uint256 shares);\r\n\r\n /**\r\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\r\n * through a redeem call.\r\n *\r\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\r\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\r\n * - MUST NOT revert.\r\n */\r\n function maxRedeem(address owner) external view returns (uint256 maxShares);\r\n\r\n /**\r\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\r\n * given current on-chain conditions.\r\n *\r\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\r\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\r\n * same transaction.\r\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\r\n * redemption would be accepted, regardless if the user has enough shares, etc.\r\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\r\n * - MUST NOT revert.\r\n *\r\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\r\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\r\n */\r\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\r\n\r\n /**\r\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\r\n *\r\n * - MUST emit the Withdraw event.\r\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\r\n * redeem execution, and are accounted for during redeem.\r\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\r\n * not having enough shares, etc).\r\n *\r\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\r\n * Those methods should be performed separately.\r\n */\r\n function redeem(\r\n uint256 shares,\r\n address receiver,\r\n address owner\r\n ) external returns (uint256 assets);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"../../utils/AddressUpgradeable.sol\";\r\n\r\n/**\r\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\r\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\r\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\r\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\r\n *\r\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\r\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\r\n * case an upgrade adds a module that needs to be initialized.\r\n *\r\n * For example:\r\n *\r\n * [.hljs-theme-light.nopadding]\r\n * ```\r\n * contract MyToken is ERC20Upgradeable {\r\n * function initialize() initializer public {\r\n * __ERC20_init(\"MyToken\", \"MTK\");\r\n * }\r\n * }\r\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\r\n * function initializeV2() reinitializer(2) public {\r\n * __ERC20Permit_init(\"MyToken\");\r\n * }\r\n * }\r\n * ```\r\n *\r\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\r\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\r\n *\r\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\r\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\r\n *\r\n * [CAUTION]\r\n * ====\r\n * Avoid leaving a contract uninitialized.\r\n *\r\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\r\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\r\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\r\n *\r\n * [.hljs-theme-light.nopadding]\r\n * ```\r\n * /// @custom:oz-upgrades-unsafe-allow constructor\r\n * constructor() {\r\n * _disableInitializers();\r\n * }\r\n * ```\r\n * ====\r\n */\r\nabstract contract Initializable {\r\n /**\r\n * @dev Indicates that the contract has been initialized.\r\n * @custom:oz-retyped-from bool\r\n */\r\n uint8 private _initialized;\r\n\r\n /**\r\n * @dev Indicates that the contract is in the process of being initialized.\r\n */\r\n bool private _initializing;\r\n\r\n /**\r\n * @dev Triggered when the contract has been initialized or reinitialized.\r\n */\r\n event Initialized(uint8 version);\r\n\r\n /**\r\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\r\n * `onlyInitializing` functions can be used to initialize parent contracts.\r\n *\r\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\r\n * constructor.\r\n *\r\n * Emits an {Initialized} event.\r\n */\r\n modifier initializer() {\r\n bool isTopLevelCall = !_initializing;\r\n require(\r\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\r\n \"Initializable: contract is already initialized\"\r\n );\r\n _initialized = 1;\r\n if (isTopLevelCall) {\r\n _initializing = true;\r\n }\r\n _;\r\n if (isTopLevelCall) {\r\n _initializing = false;\r\n emit Initialized(1);\r\n }\r\n }\r\n\r\n /**\r\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\r\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\r\n * used to initialize parent contracts.\r\n *\r\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\r\n * are added through upgrades and that require initialization.\r\n *\r\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\r\n * cannot be nested. If one is invoked in the context of another, execution will revert.\r\n *\r\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\r\n * a contract, executing them in the right order is up to the developer or operator.\r\n *\r\n * WARNING: setting the version to 255 will prevent any future reinitialization.\r\n *\r\n * Emits an {Initialized} event.\r\n */\r\n modifier reinitializer(uint8 version) {\r\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\r\n _initialized = version;\r\n _initializing = true;\r\n _;\r\n _initializing = false;\r\n emit Initialized(version);\r\n }\r\n\r\n /**\r\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\r\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\r\n */\r\n modifier onlyInitializing() {\r\n require(_initializing, \"Initializable: contract is not initializing\");\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\r\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\r\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\r\n * through proxies.\r\n *\r\n * Emits an {Initialized} event the first time it is successfully executed.\r\n */\r\n function _disableInitializers() internal virtual {\r\n require(!_initializing, \"Initializable: contract is initializing\");\r\n if (_initialized < type(uint8).max) {\r\n _initialized = type(uint8).max;\r\n emit Initialized(type(uint8).max);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Internal function that returns the initialized version. Returns `_initialized`\r\n */\r\n function _getInitializedVersion() internal view returns (uint8) {\r\n return _initialized;\r\n }\r\n\r\n /**\r\n * @dev Internal function that returns the initialized version. Returns `_initializing`\r\n */\r\n function _isInitializing() internal view returns (bool) {\r\n return _initializing;\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../utils/ContextUpgradeable.sol\";\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Contract module which allows children to implement an emergency stop\r\n * mechanism that can be triggered by an authorized account.\r\n *\r\n * This module is used through inheritance. It will make available the\r\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\r\n * the functions of your contract. Note that they will not be pausable by\r\n * simply including this module, only once the modifiers are put in place.\r\n */\r\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\r\n /**\r\n * @dev Emitted when the pause is triggered by `account`.\r\n */\r\n event Paused(address account);\r\n\r\n /**\r\n * @dev Emitted when the pause is lifted by `account`.\r\n */\r\n event Unpaused(address account);\r\n\r\n bool private _paused;\r\n\r\n /**\r\n * @dev Initializes the contract in unpaused state.\r\n */\r\n function __Pausable_init() internal onlyInitializing {\r\n __Pausable_init_unchained();\r\n }\r\n\r\n function __Pausable_init_unchained() internal onlyInitializing {\r\n _paused = false;\r\n }\r\n\r\n /**\r\n * @dev Modifier to make a function callable only when the contract is not paused.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must not be paused.\r\n */\r\n modifier whenNotPaused() {\r\n _requireNotPaused();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Modifier to make a function callable only when the contract is paused.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must be paused.\r\n */\r\n modifier whenPaused() {\r\n _requirePaused();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is paused, and false otherwise.\r\n */\r\n function paused() public view virtual returns (bool) {\r\n return _paused;\r\n }\r\n\r\n /**\r\n * @dev Throws if the contract is paused.\r\n */\r\n function _requireNotPaused() internal view virtual {\r\n require(!paused(), \"Pausable: paused\");\r\n }\r\n\r\n /**\r\n * @dev Throws if the contract is not paused.\r\n */\r\n function _requirePaused() internal view virtual {\r\n require(paused(), \"Pausable: not paused\");\r\n }\r\n\r\n /**\r\n * @dev Triggers stopped state.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must not be paused.\r\n */\r\n function _pause() internal virtual whenNotPaused {\r\n _paused = true;\r\n emit Paused(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Returns to normal state.\r\n *\r\n * Requirements:\r\n *\r\n * - The contract must be paused.\r\n */\r\n function _unpause() internal virtual whenPaused {\r\n _paused = false;\r\n emit Unpaused(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20Upgradeable.sol\";\r\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\r\nimport \"../../utils/ContextUpgradeable.sol\";\r\nimport \"../../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n * For a generic mechanism see {ERC20PresetMinterPauser}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\r\n * instead returning `false` on failure. This behavior is nonetheless\r\n * conventional and does not conflict with the expectations of ERC20\r\n * applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn't required by the specification.\r\n *\r\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See {IERC20-approve}.\r\n */\r\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\r\n mapping(address => uint256) private _balances;\r\n\r\n mapping(address => mapping(address => uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string private _name;\r\n string private _symbol;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}.\r\n *\r\n * The default value of {decimals} is 18. To select a different value for\r\n * {decimals} you should overload it.\r\n *\r\n * All two of these values are immutable: they can only be set once during\r\n * construction.\r\n */\r\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\r\n __ERC20_init_unchained(name_, symbol_);\r\n }\r\n\r\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\r\n * overridden;\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\r\n address owner = _msgSender();\r\n _transfer(owner, to, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\r\n * `transferFrom`. This is semantically equivalent to an infinite approval.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n address owner = _msgSender();\r\n _approve(owner, spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * NOTE: Does not update the allowance if the current allowance\r\n * is the maximum `uint256`.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` and `to` cannot be the zero address.\r\n * - `from` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``from``'s tokens of at least\r\n * `amount`.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n address spender = _msgSender();\r\n _spendAllowance(from, spender, amount);\r\n _transfer(from, to, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n address owner = _msgSender();\r\n _approve(owner, spender, allowance(owner, spender) + addedValue);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n address owner = _msgSender();\r\n uint256 currentAllowance = allowance(owner, spender);\r\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\r\n unchecked {\r\n _approve(owner, spender, currentAllowance - subtractedValue);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves `amount` of tokens from `from` to `to`.\r\n *\r\n * This internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `from` must have a balance of at least `amount`.\r\n */\r\n function _transfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {\r\n require(from != address(0), \"ERC20: transfer from the zero address\");\r\n require(to != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(from, to, amount);\r\n\r\n uint256 fromBalance = _balances[from];\r\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\r\n unchecked {\r\n _balances[from] = fromBalance - amount;\r\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\r\n // decrementing then incrementing.\r\n _balances[to] += amount;\r\n }\r\n\r\n emit Transfer(from, to, amount);\r\n\r\n _afterTokenTransfer(from, to, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply += amount;\r\n unchecked {\r\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\r\n _balances[account] += amount;\r\n }\r\n emit Transfer(address(0), account, amount);\r\n\r\n _afterTokenTransfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\r\n */\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n uint256 accountBalance = _balances[account];\r\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\r\n unchecked {\r\n _balances[account] = accountBalance - amount;\r\n // Overflow not possible: amount <= accountBalance <= totalSupply.\r\n _totalSupply -= amount;\r\n }\r\n\r\n emit Transfer(account, address(0), amount);\r\n\r\n _afterTokenTransfer(account, address(0), amount);\r\n }\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n */\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\r\n *\r\n * Does not update the allowance amount in case of infinite allowance.\r\n * Revert if not enough allowance is available.\r\n *\r\n * Might emit an {Approval} event.\r\n */\r\n function _spendAllowance(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n uint256 currentAllowance = allowance(owner, spender);\r\n if (currentAllowance != type(uint256).max) {\r\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\r\n unchecked {\r\n _approve(owner, spender, currentAllowance - amount);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * will be transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev Hook that is called after any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * has been transferred to `to`.\r\n * - when `from` is zero, `amount` tokens have been minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _afterTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[45] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n */\r\ninterface IERC20PermitUpgradeable {\r\n /**\r\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n * given ``owner``'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../ERC20Upgradeable.sol\";\r\nimport \"../utils/SafeERC20Upgradeable.sol\";\r\nimport \"../../../interfaces/IERC4626Upgradeable.sol\";\r\nimport \"../../../utils/math/MathUpgradeable.sol\";\r\nimport \"../../../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\r\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\r\n *\r\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\r\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\r\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\r\n * contract and not the \"assets\" token which is an independent contract.\r\n *\r\n * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of\r\n * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as\r\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\r\n *\r\n * _Available since v4.7._\r\n */\r\nabstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {\r\n using MathUpgradeable for uint256;\r\n\r\n IERC20Upgradeable private _asset;\r\n uint8 private _decimals;\r\n\r\n /**\r\n * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\r\n */\r\n function __ERC4626_init(IERC20Upgradeable asset_) internal onlyInitializing {\r\n __ERC4626_init_unchained(asset_);\r\n }\r\n\r\n function __ERC4626_init_unchained(IERC20Upgradeable asset_) internal onlyInitializing {\r\n (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\r\n _decimals = success ? assetDecimals : super.decimals();\r\n _asset = asset_;\r\n }\r\n\r\n /**\r\n * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\r\n */\r\n function _tryGetAssetDecimals(IERC20Upgradeable asset_) private returns (bool, uint8) {\r\n (bool success, bytes memory encodedDecimals) = address(asset_).call(\r\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector)\r\n );\r\n if (success && encodedDecimals.length >= 32) {\r\n uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\r\n if (returnedDecimals <= type(uint8).max) {\r\n return (true, uint8(returnedDecimals));\r\n }\r\n }\r\n return (false, 0);\r\n }\r\n\r\n /**\r\n * @dev Decimals are read from the underlying asset in the constructor and cached. If this fails (e.g., the asset\r\n * has not been created yet), the cached value is set to a default obtained by `super.decimals()` (which depends on\r\n * inheritance but is most likely 18). Override this function in order to set a guaranteed hardcoded value.\r\n * See {IERC20Metadata-decimals}.\r\n */\r\n function decimals() public view virtual override(IERC20MetadataUpgradeable, ERC20Upgradeable) returns (uint8) {\r\n return _decimals;\r\n }\r\n\r\n /** @dev See {IERC4626-asset}. */\r\n function asset() public view virtual override returns (address) {\r\n return address(_asset);\r\n }\r\n\r\n /** @dev See {IERC4626-totalAssets}. */\r\n function totalAssets() public view virtual override returns (uint256) {\r\n return _asset.balanceOf(address(this));\r\n }\r\n\r\n /** @dev See {IERC4626-convertToShares}. */\r\n function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {\r\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-convertToAssets}. */\r\n function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {\r\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-maxDeposit}. */\r\n function maxDeposit(address) public view virtual override returns (uint256) {\r\n return _isVaultCollateralized() ? type(uint256).max : 0;\r\n }\r\n\r\n /** @dev See {IERC4626-maxMint}. */\r\n function maxMint(address) public view virtual override returns (uint256) {\r\n return type(uint256).max;\r\n }\r\n\r\n /** @dev See {IERC4626-maxWithdraw}. */\r\n function maxWithdraw(address owner) public view virtual override returns (uint256) {\r\n return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-maxRedeem}. */\r\n function maxRedeem(address owner) public view virtual override returns (uint256) {\r\n return balanceOf(owner);\r\n }\r\n\r\n /** @dev See {IERC4626-previewDeposit}. */\r\n function previewDeposit(uint256 assets) public view virtual override returns (uint256) {\r\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-previewMint}. */\r\n function previewMint(uint256 shares) public view virtual override returns (uint256) {\r\n return _convertToAssets(shares, MathUpgradeable.Rounding.Up);\r\n }\r\n\r\n /** @dev See {IERC4626-previewWithdraw}. */\r\n function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {\r\n return _convertToShares(assets, MathUpgradeable.Rounding.Up);\r\n }\r\n\r\n /** @dev See {IERC4626-previewRedeem}. */\r\n function previewRedeem(uint256 shares) public view virtual override returns (uint256) {\r\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\r\n }\r\n\r\n /** @dev See {IERC4626-deposit}. */\r\n function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {\r\n require(assets <= maxDeposit(receiver), \"ERC4626: deposit more than max\");\r\n\r\n uint256 shares = previewDeposit(assets);\r\n _deposit(_msgSender(), receiver, assets, shares);\r\n\r\n return shares;\r\n }\r\n\r\n /** @dev See {IERC4626-mint}. */\r\n function mint(uint256 shares, address receiver) public virtual override returns (uint256) {\r\n require(shares <= maxMint(receiver), \"ERC4626: mint more than max\");\r\n\r\n uint256 assets = previewMint(shares);\r\n _deposit(_msgSender(), receiver, assets, shares);\r\n\r\n return assets;\r\n }\r\n\r\n /** @dev See {IERC4626-withdraw}. */\r\n function withdraw(\r\n uint256 assets,\r\n address receiver,\r\n address owner\r\n ) public virtual override returns (uint256) {\r\n require(assets <= maxWithdraw(owner), \"ERC4626: withdraw more than max\");\r\n\r\n uint256 shares = previewWithdraw(assets);\r\n _withdraw(_msgSender(), receiver, owner, assets, shares);\r\n\r\n return shares;\r\n }\r\n\r\n /** @dev See {IERC4626-redeem}. */\r\n function redeem(\r\n uint256 shares,\r\n address receiver,\r\n address owner\r\n ) public virtual override returns (uint256) {\r\n require(shares <= maxRedeem(owner), \"ERC4626: redeem more than max\");\r\n\r\n uint256 assets = previewRedeem(shares);\r\n _withdraw(_msgSender(), receiver, owner, assets, shares);\r\n\r\n return assets;\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from assets to shares) with support for rounding direction.\r\n *\r\n * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset\r\n * would represent an infinite amount of shares.\r\n */\r\n function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {\r\n uint256 supply = totalSupply();\r\n return\r\n (assets == 0 || supply == 0)\r\n ? _initialConvertToShares(assets, rounding)\r\n : assets.mulDiv(supply, totalAssets(), rounding);\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from assets to shares) to apply when the vault is empty.\r\n *\r\n * NOTE: Make sure to keep this function consistent with {_initialConvertToAssets} when overriding it.\r\n */\r\n function _initialConvertToShares(\r\n uint256 assets,\r\n MathUpgradeable.Rounding /*rounding*/\r\n ) internal view virtual returns (uint256 shares) {\r\n return assets;\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from shares to assets) with support for rounding direction.\r\n */\r\n function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {\r\n uint256 supply = totalSupply();\r\n return\r\n (supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);\r\n }\r\n\r\n /**\r\n * @dev Internal conversion function (from shares to assets) to apply when the vault is empty.\r\n *\r\n * NOTE: Make sure to keep this function consistent with {_initialConvertToShares} when overriding it.\r\n */\r\n function _initialConvertToAssets(\r\n uint256 shares,\r\n MathUpgradeable.Rounding /*rounding*/\r\n ) internal view virtual returns (uint256 assets) {\r\n return shares;\r\n }\r\n\r\n /**\r\n * @dev Deposit/mint common workflow.\r\n */\r\n function _deposit(\r\n address caller,\r\n address receiver,\r\n uint256 assets,\r\n uint256 shares\r\n ) internal virtual {\r\n // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the\r\n // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\r\n // calls the vault, which is assumed not malicious.\r\n //\r\n // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\r\n // assets are transferred and before the shares are minted, which is a valid state.\r\n // slither-disable-next-line reentrancy-no-eth\r\n SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(caller, receiver, assets, shares);\r\n }\r\n\r\n /**\r\n * @dev Withdraw/redeem common workflow.\r\n */\r\n function _withdraw(\r\n address caller,\r\n address receiver,\r\n address owner,\r\n uint256 assets,\r\n uint256 shares\r\n ) internal virtual {\r\n if (caller != owner) {\r\n _spendAllowance(owner, caller, shares);\r\n }\r\n\r\n // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\r\n // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\r\n // calls the vault, which is assumed not malicious.\r\n //\r\n // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\r\n // shares are burned and after the assets are transferred, which is a valid state.\r\n _burn(owner, shares);\r\n SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);\r\n\r\n emit Withdraw(caller, receiver, owner, assets, shares);\r\n }\r\n\r\n function _isVaultCollateralized() private view returns (bool) {\r\n return totalAssets() > 0 || totalSupply() == 0;\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[49] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20Upgradeable.sol\";\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n *\r\n * _Available since v4.1._\r\n */\r\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the symbol of the token.\r\n */\r\n function symbol() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the decimals places of the token.\r\n */\r\n function decimals() external view returns (uint8);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20Upgradeable {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20Upgradeable.sol\";\r\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\r\nimport \"../../../utils/AddressUpgradeable.sol\";\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20Upgradeable {\r\n using AddressUpgradeable for address;\r\n\r\n function safeTransfer(\r\n IERC20Upgradeable token,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n function safeTransferFrom(\r\n IERC20Upgradeable token,\r\n address from,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(\r\n IERC20Upgradeable token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n \"SafeERC20: approve from non-zero to non-zero allowance\"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n function safeIncreaseAllowance(\r\n IERC20Upgradeable token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n uint256 newAllowance = token.allowance(address(this), spender) + value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n\r\n function safeDecreaseAllowance(\r\n IERC20Upgradeable token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\r\n uint256 newAllowance = oldAllowance - value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n }\r\n\r\n function safePermit(\r\n IERC20PermitUpgradeable token,\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) internal {\r\n uint256 nonceBefore = token.nonces(owner);\r\n token.permit(owner, spender, value, deadline, v, r, s);\r\n uint256 nonceAfter = token.nonces(owner);\r\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\r\n if (returndata.length > 0) {\r\n // Return data is optional\r\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary AddressUpgradeable {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length > 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance >= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity ^0.8.0;\r\nimport \"../proxy/utils/Initializable.sol\";\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract ContextUpgradeable is Initializable {\r\n function __Context_init() internal onlyInitializing {\r\n }\r\n\r\n function __Context_init_unchained() internal onlyInitializing {\r\n }\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n\r\n /**\r\n * @dev This empty reserved space is put in place to allow future versions to add new\r\n * variables without shifting down storage in the inheritance chain.\r\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\r\n */\r\n uint256[50] private __gap;\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\r\n * `CREATE2` can be used to compute in advance the address where a smart\r\n * contract will be deployed, which allows for interesting new mechanisms known\r\n * as 'counterfactual interactions'.\r\n *\r\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\r\n * information.\r\n */\r\nlibrary Create2Upgradeable {\r\n /**\r\n * @dev Deploys a contract using `CREATE2`. The address where the contract\r\n * will be deployed can be known in advance via {computeAddress}.\r\n *\r\n * The bytecode for a contract can be obtained from Solidity with\r\n * `type(contractName).creationCode`.\r\n *\r\n * Requirements:\r\n *\r\n * - `bytecode` must not be empty.\r\n * - `salt` must have not been used for `bytecode` already.\r\n * - the factory must have a balance of at least `amount`.\r\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\r\n */\r\n function deploy(\r\n uint256 amount,\r\n bytes32 salt,\r\n bytes memory bytecode\r\n ) internal returns (address addr) {\r\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\r\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\r\n }\r\n require(addr != address(0), \"Create2: Failed on deploy\");\r\n }\r\n\r\n /**\r\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\r\n * `bytecodeHash` or `salt` will result in a new destination address.\r\n */\r\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\r\n return computeAddress(salt, bytecodeHash, address(this));\r\n }\r\n\r\n /**\r\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\r\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\r\n */\r\n function computeAddress(\r\n bytes32 salt,\r\n bytes32 bytecodeHash,\r\n address deployer\r\n ) internal pure returns (address addr) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let ptr := mload(0x40) // Get free memory pointer\r\n\r\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\r\n // |-------------------|---------------------------------------------------------------------------|\r\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\r\n // | salt | BBBBBBBBBBBBB...BB |\r\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\r\n // | 0xFF | FF |\r\n // |-------------------|---------------------------------------------------------------------------|\r\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\r\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\r\n\r\n mstore(add(ptr, 0x40), bytecodeHash)\r\n mstore(add(ptr, 0x20), salt)\r\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\r\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\r\n mstore8(start, 0xff)\r\n addr := keccak256(start, 85)\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard math utilities missing in the Solidity language.\r\n */\r\nlibrary MathUpgradeable {\r\n enum Rounding {\r\n Down, // Toward negative infinity\r\n Up, // Toward infinity\r\n Zero // Toward zero\r\n }\r\n\r\n /**\r\n * @dev Returns the largest of two numbers.\r\n */\r\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a > b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two numbers.\r\n */\r\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a < b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two numbers. The result is rounded towards\r\n * zero.\r\n */\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow.\r\n return (a & b) + (a ^ b) / 2;\r\n }\r\n\r\n /**\r\n * @dev Returns the ceiling of the division of two numbers.\r\n *\r\n * This differs from standard division with `/` in that it rounds up instead\r\n * of rounding down.\r\n */\r\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b - 1) / b can overflow on addition, so we distribute.\r\n return a == 0 ? 0 : (a - 1) / b + 1;\r\n }\r\n\r\n /**\r\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\r\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\r\n * with further edits by Uniswap Labs also under MIT license.\r\n */\r\n function mulDiv(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 result) {\r\n unchecked {\r\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\r\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\r\n // variables such that product = prod1 * 2^256 + prod0.\r\n uint256 prod0; // Least significant 256 bits of the product\r\n uint256 prod1; // Most significant 256 bits of the product\r\n assembly {\r\n let mm := mulmod(x, y, not(0))\r\n prod0 := mul(x, y)\r\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\r\n }\r\n\r\n // Handle non-overflow cases, 256 by 256 division.\r\n if (prod1 == 0) {\r\n return prod0 / denominator;\r\n }\r\n\r\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\r\n require(denominator > prod1);\r\n\r\n ///////////////////////////////////////////////\r\n // 512 by 256 division.\r\n ///////////////////////////////////////////////\r\n\r\n // Make division exact by subtracting the remainder from [prod1 prod0].\r\n uint256 remainder;\r\n assembly {\r\n // Compute remainder using mulmod.\r\n remainder := mulmod(x, y, denominator)\r\n\r\n // Subtract 256 bit number from 512 bit number.\r\n prod1 := sub(prod1, gt(remainder, prod0))\r\n prod0 := sub(prod0, remainder)\r\n }\r\n\r\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\r\n // See https://cs.stackexchange.com/q/138556/92363.\r\n\r\n // Does not overflow because the denominator cannot be zero at this stage in the function.\r\n uint256 twos = denominator & (~denominator + 1);\r\n assembly {\r\n // Divide denominator by twos.\r\n denominator := div(denominator, twos)\r\n\r\n // Divide [prod1 prod0] by twos.\r\n prod0 := div(prod0, twos)\r\n\r\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\r\n twos := add(div(sub(0, twos), twos), 1)\r\n }\r\n\r\n // Shift in bits from prod1 into prod0.\r\n prod0 |= prod1 * twos;\r\n\r\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\r\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\r\n // four bits. That is, denominator * inv = 1 mod 2^4.\r\n uint256 inverse = (3 * denominator) ^ 2;\r\n\r\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\r\n // in modular arithmetic, doubling the correct bits in each step.\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\r\n\r\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\r\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\r\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\r\n // is no longer required.\r\n result = prod0 * inverse;\r\n return result;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\r\n */\r\n function mulDiv(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator,\r\n Rounding rounding\r\n ) internal pure returns (uint256) {\r\n uint256 result = mulDiv(x, y, denominator);\r\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\r\n result += 1;\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\r\n *\r\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\r\n */\r\n function sqrt(uint256 a) internal pure returns (uint256) {\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\r\n //\r\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\r\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\r\n //\r\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\r\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\r\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\r\n //\r\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\r\n uint256 result = 1 << (log2(a) >> 1);\r\n\r\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\r\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\r\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\r\n // into the expected uint128 result.\r\n unchecked {\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n return min(result, a / result);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates sqrt(a), following the selected rounding direction.\r\n */\r\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = sqrt(a);\r\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 128;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 64;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 32;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 16;\r\n }\r\n if (value >> 8 > 0) {\r\n value >>= 8;\r\n result += 8;\r\n }\r\n if (value >> 4 > 0) {\r\n value >>= 4;\r\n result += 4;\r\n }\r\n if (value >> 2 > 0) {\r\n value >>= 2;\r\n result += 2;\r\n }\r\n if (value >> 1 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log2(value);\r\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >= 10**64) {\r\n value /= 10**64;\r\n result += 64;\r\n }\r\n if (value >= 10**32) {\r\n value /= 10**32;\r\n result += 32;\r\n }\r\n if (value >= 10**16) {\r\n value /= 10**16;\r\n result += 16;\r\n }\r\n if (value >= 10**8) {\r\n value /= 10**8;\r\n result += 8;\r\n }\r\n if (value >= 10**4) {\r\n value /= 10**4;\r\n result += 4;\r\n }\r\n if (value >= 10**2) {\r\n value /= 10**2;\r\n result += 2;\r\n }\r\n if (value >= 10**1) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log10(value);\r\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 256, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n *\r\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\r\n */\r\n function log256(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 16;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 8;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 4;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 2;\r\n }\r\n if (value >> 8 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log256(value);\r\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\r\n * proxy whose upgrades are fully controlled by the current implementation.\r\n */\r\ninterface IERC1822Proxiable {\r\n /**\r\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\r\n * address.\r\n *\r\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\r\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\r\n * function revert if invoked through a proxy.\r\n */\r\n function proxiableUUID() external view returns (bytes32);\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\r\n */\r\ninterface IBeacon {\r\n /**\r\n * @dev Must return an address that can be used as a delegate call target.\r\n *\r\n * {BeaconProxy} will check that this address is a contract.\r\n */\r\n function implementation() external view returns (address);\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../Proxy.sol\";\r\nimport \"./ERC1967Upgrade.sol\";\r\n\r\n/**\r\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\r\n * implementation address that can be changed. This address is stored in storage in the location specified by\r\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\r\n * implementation behind the proxy.\r\n */\r\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\r\n /**\r\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\r\n *\r\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\r\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\r\n */\r\n constructor(address _logic, bytes memory _data) payable {\r\n _upgradeToAndCall(_logic, _data, false);\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function _implementation() internal view virtual override returns (address impl) {\r\n return ERC1967Upgrade._getImplementation();\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"../beacon/IBeacon.sol\";\r\nimport \"../../interfaces/draft-IERC1822.sol\";\r\nimport \"../../utils/Address.sol\";\r\nimport \"../../utils/StorageSlot.sol\";\r\n\r\n/**\r\n * @dev This abstract contract provides getters and event emitting update functions for\r\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\r\n *\r\n * _Available since v4.1._\r\n *\r\n * @custom:oz-upgrades-unsafe-allow delegatecall\r\n */\r\nabstract contract ERC1967Upgrade {\r\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\r\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\r\n\r\n /**\r\n * @dev Storage slot with the address of the current implementation.\r\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\r\n * validated in the constructor.\r\n */\r\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r\n\r\n /**\r\n * @dev Emitted when the implementation is upgraded.\r\n */\r\n event Upgraded(address indexed implementation);\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function _getImplementation() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new address in the EIP1967 implementation slot.\r\n */\r\n function _setImplementation(address newImplementation) private {\r\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\r\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeTo(address newImplementation) internal {\r\n _setImplementation(newImplementation);\r\n emit Upgraded(newImplementation);\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade with additional setup call.\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeToAndCall(\r\n address newImplementation,\r\n bytes memory data,\r\n bool forceCall\r\n ) internal {\r\n _upgradeTo(newImplementation);\r\n if (data.length > 0 || forceCall) {\r\n Address.functionDelegateCall(newImplementation, data);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeToAndCallUUPS(\r\n address newImplementation,\r\n bytes memory data,\r\n bool forceCall\r\n ) internal {\r\n // Upgrades from old implementations will perform a rollback test. This test requires the new\r\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\r\n // this special case will break upgrade paths from old UUPS implementation to new ones.\r\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\r\n _setImplementation(newImplementation);\r\n } else {\r\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\r\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\r\n } catch {\r\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\r\n }\r\n _upgradeToAndCall(newImplementation, data, forceCall);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Storage slot with the admin of the contract.\r\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\r\n * validated in the constructor.\r\n */\r\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r\n\r\n /**\r\n * @dev Emitted when the admin account has changed.\r\n */\r\n event AdminChanged(address previousAdmin, address newAdmin);\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n */\r\n function _getAdmin() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new address in the EIP1967 admin slot.\r\n */\r\n function _setAdmin(address newAdmin) private {\r\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\r\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\r\n }\r\n\r\n /**\r\n * @dev Changes the admin of the proxy.\r\n *\r\n * Emits an {AdminChanged} event.\r\n */\r\n function _changeAdmin(address newAdmin) internal {\r\n emit AdminChanged(_getAdmin(), newAdmin);\r\n _setAdmin(newAdmin);\r\n }\r\n\r\n /**\r\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\r\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\r\n */\r\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\r\n\r\n /**\r\n * @dev Emitted when the beacon is upgraded.\r\n */\r\n event BeaconUpgraded(address indexed beacon);\r\n\r\n /**\r\n * @dev Returns the current beacon.\r\n */\r\n function _getBeacon() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new beacon in the EIP1967 beacon slot.\r\n */\r\n function _setBeacon(address newBeacon) private {\r\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\r\n require(\r\n Address.isContract(IBeacon(newBeacon).implementation()),\r\n \"ERC1967: beacon implementation is not a contract\"\r\n );\r\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\r\n }\r\n\r\n /**\r\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\r\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\r\n *\r\n * Emits a {BeaconUpgraded} event.\r\n */\r\n function _upgradeBeaconToAndCall(\r\n address newBeacon,\r\n bytes memory data,\r\n bool forceCall\r\n ) internal {\r\n _setBeacon(newBeacon);\r\n emit BeaconUpgraded(newBeacon);\r\n if (data.length > 0 || forceCall) {\r\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\r\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\r\n * be specified by overriding the virtual {_implementation} function.\r\n *\r\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\r\n * different contract through the {_delegate} function.\r\n *\r\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\r\n */\r\nabstract contract Proxy {\r\n /**\r\n * @dev Delegates the current call to `implementation`.\r\n *\r\n * This function does not return to its internal call site, it will return directly to the external caller.\r\n */\r\n function _delegate(address implementation) internal virtual {\r\n assembly {\r\n // Copy msg.data. We take full control of memory in this inline assembly\r\n // block because it will not return to Solidity code. We overwrite the\r\n // Solidity scratch pad at memory position 0.\r\n calldatacopy(0, 0, calldatasize())\r\n\r\n // Call the implementation.\r\n // out and outsize are 0 because we don't know the size yet.\r\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\r\n\r\n // Copy the returned data.\r\n returndatacopy(0, 0, returndatasize())\r\n\r\n switch result\r\n // delegatecall returns 0 on error.\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\r\n * and {_fallback} should delegate.\r\n */\r\n function _implementation() internal view virtual returns (address);\r\n\r\n /**\r\n * @dev Delegates the current call to the address returned by `_implementation()`.\r\n *\r\n * This function does not return to its internal call site, it will return directly to the external caller.\r\n */\r\n function _fallback() internal virtual {\r\n _beforeFallback();\r\n _delegate(_implementation());\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\r\n * function in the contract matches the call data.\r\n */\r\n fallback() external payable virtual {\r\n _fallback();\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\r\n * is empty.\r\n */\r\n receive() external payable virtual {\r\n _fallback();\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\r\n * call, or as part of the Solidity `fallback` or `receive` functions.\r\n *\r\n * If overridden should call `super._beforeFallback()`.\r\n */\r\n function _beforeFallback() internal virtual {}\r\n}\r\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../ERC1967/ERC1967Proxy.sol\";\r\n\r\n/**\r\n * @dev This contract implements a proxy that is upgradeable by an admin.\r\n *\r\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\r\n * clashing], which can potentially be used in an attack, this contract uses the\r\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\r\n * things that go hand in hand:\r\n *\r\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\r\n * that call matches one of the admin functions exposed by the proxy itself.\r\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\r\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\r\n * \"admin cannot fallback to proxy target\".\r\n *\r\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\r\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\r\n * to sudden errors when trying to call a function from the proxy implementation.\r\n *\r\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\r\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\r\n */\r\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\r\n /**\r\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\r\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\r\n */\r\n constructor(\r\n address _logic,\r\n address admin_,\r\n bytes memory _data\r\n ) payable ERC1967Proxy(_logic, _data) {\r\n _changeAdmin(admin_);\r\n }\r\n\r\n /**\r\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\r\n */\r\n modifier ifAdmin() {\r\n if (msg.sender == _getAdmin()) {\r\n _;\r\n } else {\r\n _fallback();\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\r\n *\r\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\r\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\r\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\r\n */\r\n function admin() external ifAdmin returns (address admin_) {\r\n admin_ = _getAdmin();\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\r\n *\r\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\r\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\r\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\r\n */\r\n function implementation() external ifAdmin returns (address implementation_) {\r\n implementation_ = _implementation();\r\n }\r\n\r\n /**\r\n * @dev Changes the admin of the proxy.\r\n *\r\n * Emits an {AdminChanged} event.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\r\n */\r\n function changeAdmin(address newAdmin) external virtual ifAdmin {\r\n _changeAdmin(newAdmin);\r\n }\r\n\r\n /**\r\n * @dev Upgrade the implementation of the proxy.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\r\n */\r\n function upgradeTo(address newImplementation) external ifAdmin {\r\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\r\n }\r\n\r\n /**\r\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\r\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\r\n * proxied contract.\r\n *\r\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\r\n */\r\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\r\n _upgradeToAndCall(newImplementation, data, true);\r\n }\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n */\r\n function _admin() internal view virtual returns (address) {\r\n return _getAdmin();\r\n }\r\n\r\n /**\r\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\r\n */\r\n function _beforeFallback() internal virtual override {\r\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\r\n super._beforeFallback();\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n */\r\ninterface IERC20Permit {\r\n /**\r\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n * given ``owner``'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n}\r\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20.sol\";\r\nimport \"../extensions/draft-IERC20Permit.sol\";\r\nimport \"../../../utils/Address.sol\";\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20 {\r\n using Address for address;\r\n\r\n function safeTransfer(\r\n IERC20 token,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n function safeTransferFrom(\r\n IERC20 token,\r\n address from,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n \"SafeERC20: approve from non-zero to non-zero allowance\"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n function safeIncreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n uint256 newAllowance = token.allowance(address(this), spender) + value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n\r\n function safeDecreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\r\n uint256 newAllowance = oldAllowance - value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n }\r\n\r\n function safePermit(\r\n IERC20Permit token,\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) internal {\r\n uint256 nonceBefore = token.nonces(owner);\r\n token.permit(owner, spender, value, deadline, v, r, s);\r\n uint256 nonceAfter = token.nonces(owner);\r\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\r\n if (returndata.length > 0) {\r\n // Return data is optional\r\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length > 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance >= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for reading and writing primitive types to specific storage slots.\r\n *\r\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\r\n * This library helps with reading and writing to such slots without the need for inline assembly.\r\n *\r\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\r\n *\r\n * Example usage to set ERC1967 implementation slot:\r\n * ```\r\n * contract ERC1967 {\r\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r\n *\r\n * function _getImplementation() internal view returns (address) {\r\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\r\n * }\r\n *\r\n * function _setImplementation(address newImplementation) internal {\r\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\r\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\r\n * }\r\n * }\r\n * ```\r\n *\r\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\r\n */\r\nlibrary StorageSlot {\r\n struct AddressSlot {\r\n address value;\r\n }\r\n\r\n struct BooleanSlot {\r\n bool value;\r\n }\r\n\r\n struct Bytes32Slot {\r\n bytes32 value;\r\n }\r\n\r\n struct Uint256Slot {\r\n uint256 value;\r\n }\r\n\r\n /**\r\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\r\n */\r\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\r\n */\r\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\r\n */\r\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\r\n */\r\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n}\r\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\r\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for managing\r\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\r\n * types.\r\n *\r\n * Sets have the following properties:\r\n *\r\n * - Elements are added, removed, and checked for existence in constant time\r\n * (O(1)).\r\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\r\n *\r\n * ```\r\n * contract Example {\r\n * // Add the library methods\r\n * using EnumerableSet for EnumerableSet.AddressSet;\r\n *\r\n * // Declare a set state variable\r\n * EnumerableSet.AddressSet private mySet;\r\n * }\r\n * ```\r\n *\r\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\r\n * and `uint256` (`UintSet`) are supported.\r\n *\r\n * [WARNING]\r\n * ====\r\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\r\n * unusable.\r\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\r\n *\r\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\r\n * array of EnumerableSet.\r\n * ====\r\n */\r\nlibrary EnumerableSet {\r\n // To implement this library for multiple types with as little code\r\n // repetition as possible, we write it in terms of a generic Set type with\r\n // bytes32 values.\r\n // The Set implementation uses private functions, and user-facing\r\n // implementations (such as AddressSet) are just wrappers around the\r\n // underlying Set.\r\n // This means that we can only create new EnumerableSets for types that fit\r\n // in bytes32.\r\n\r\n struct Set {\r\n // Storage of set values\r\n bytes32[] _values;\r\n // Position of the value in the `values` array, plus 1 because index 0\r\n // means a value is not in the set.\r\n mapping(bytes32 => uint256) _indexes;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function _add(Set storage set, bytes32 value) private returns (bool) {\r\n if (!_contains(set, value)) {\r\n set._values.push(value);\r\n // The value is stored at length-1, but we add 1 to all indexes\r\n // and use 0 as a sentinel value\r\n set._indexes[value] = set._values.length;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function _remove(Set storage set, bytes32 value) private returns (bool) {\r\n // We read and store the value's index to prevent multiple reads from the same storage slot\r\n uint256 valueIndex = set._indexes[value];\r\n\r\n if (valueIndex != 0) {\r\n // Equivalent to contains(set, value)\r\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\r\n // the array, and then remove the last element (sometimes called as 'swap and pop').\r\n // This modifies the order of the array, as noted in {at}.\r\n\r\n uint256 toDeleteIndex = valueIndex - 1;\r\n uint256 lastIndex = set._values.length - 1;\r\n\r\n if (lastIndex != toDeleteIndex) {\r\n bytes32 lastValue = set._values[lastIndex];\r\n\r\n // Move the last value to the index where the value to delete is\r\n set._values[toDeleteIndex] = lastValue;\r\n // Update the index for the moved value\r\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\r\n }\r\n\r\n // Delete the slot where the moved value was stored\r\n set._values.pop();\r\n\r\n // Delete the index for the deleted slot\r\n delete set._indexes[value];\r\n\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\r\n return set._indexes[value] != 0;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values on the set. O(1).\r\n */\r\n function _length(Set storage set) private view returns (uint256) {\r\n return set._values.length;\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\r\n return set._values[index];\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function _values(Set storage set) private view returns (bytes32[] memory) {\r\n return set._values;\r\n }\r\n\r\n // Bytes32Set\r\n\r\n struct Bytes32Set {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _add(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _remove(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\r\n return _contains(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(Bytes32Set storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\r\n return _at(set._inner, index);\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n bytes32[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // AddressSet\r\n\r\n struct AddressSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(AddressSet storage set, address value) internal returns (bool) {\r\n return _add(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(AddressSet storage set, address value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(AddressSet storage set, address value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(AddressSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\r\n return address(uint160(uint256(_at(set._inner, index))));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(AddressSet storage set) internal view returns (address[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n address[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // UintSet\r\n\r\n struct UintSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _add(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(UintSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\r\n return uint256(_at(set._inner, index));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(UintSet storage set) internal view returns (uint256[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n uint256[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nlibrary PrudentiaLib {\r\n struct PrudentiaConfig {\r\n address controller; // Adrastia Prudentia controller address\r\n uint8 offset; // Offset for delayed rate activation\r\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\r\n }\r\n}\r\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Careful Math\r\n * @author Compound\r\n * @notice Derived from OpenZeppelin's SafeMath library\r\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\r\n */\r\ncontract CarefulMath {\r\n /**\r\n * @dev Possible error codes that we can return\r\n */\r\n enum MathError {\r\n NO_ERROR,\r\n DIVISION_BY_ZERO,\r\n INTEGER_OVERFLOW,\r\n INTEGER_UNDERFLOW\r\n }\r\n\r\n /**\r\n * @dev Multiplies two numbers, returns an error on overflow.\r\n */\r\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n if (a == 0) {\r\n return (MathError.NO_ERROR, 0);\r\n }\r\n\r\n uint256 c;\r\n unchecked {\r\n c = a * b;\r\n }\r\n\r\n if (c / a != b) {\r\n return (MathError.INTEGER_OVERFLOW, 0);\r\n } else {\r\n return (MathError.NO_ERROR, c);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Integer division of two numbers, truncating the quotient.\r\n */\r\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n if (b == 0) {\r\n return (MathError.DIVISION_BY_ZERO, 0);\r\n }\r\n\r\n return (MathError.NO_ERROR, a / b);\r\n }\r\n\r\n /**\r\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\r\n */\r\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n if (b <= a) {\r\n return (MathError.NO_ERROR, a - b);\r\n } else {\r\n return (MathError.INTEGER_UNDERFLOW, 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Adds two numbers, returns an error on overflow.\r\n */\r\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\r\n uint256 c;\r\n unchecked {\r\n c = a + b;\r\n }\r\n\r\n if (c >= a) {\r\n return (MathError.NO_ERROR, c);\r\n } else {\r\n return (MathError.INTEGER_OVERFLOW, 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev add a and b and then subtract c\r\n */\r\n function addThenSubUInt(\r\n uint256 a,\r\n uint256 b,\r\n uint256 c\r\n ) internal pure returns (MathError, uint256) {\r\n (MathError err0, uint256 sum) = addUInt(a, b);\r\n\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, 0);\r\n }\r\n\r\n return subUInt(sum, c);\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CToken.sol\";\r\n\r\n/**\r\n * @title Compound's CErc20Delegate Contract\r\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\r\n * @author Compound\r\n */\r\ncontract CErc20Delegate is CErc20 {\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 3;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /**\r\n * @notice Called by the delegator on a delegate to initialize it for duty\r\n */\r\n function _becomeImplementation(bytes memory) public virtual override {\r\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 1;\r\n }\r\n\r\n function contractType() external pure virtual override returns (string memory) {\r\n return \"CErc20Delegate\";\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CErc20Delegate.sol\";\r\nimport \"./EIP20Interface.sol\";\r\n\r\ncontract CErc20RewardsDelegate is CErc20Delegate {\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 2;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n \r\n /// @notice A reward token claim function\r\n /// to be overridden for use cases where rewardToken needs to be pulled in\r\n function claim() external {}\r\n\r\n /// @notice token approval function\r\n function approve(address _token, address _spender) external {\r\n require(hasAdminRights(), \"!admin\");\r\n require(_token != underlying, \"!underlying\");\r\n\r\n EIP20Interface(_token).approve(_spender, type(uint256).max);\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 3;\r\n }\r\n\r\n function contractType() external pure override returns (string memory) {\r\n return \"CErc20RewardsDelegate\";\r\n }\r\n}\r\n" + }, + "contracts/compound/CErc20RewardsDelegateMorpho.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CErc20RewardsDelegate.sol\";\r\n\r\ncontract CErc20RewardsDelegateMorpho is CErc20Delegate {\r\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\r\n\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 1;\r\n\r\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\r\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\r\n\r\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\r\n functionSelectors[i] = superFunctionSelectors[i];\r\n }\r\n\r\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /**\r\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\r\n * @param rewardToken The reward strategy for which the rewards are being claimed.\r\n * @param claimable The amount of tokens to claim and forward.\r\n * @param proof The proof required to validate the claim.\r\n * @dev Only callable by the governance.\r\n */\r\n function claim(\r\n address morphoURD,\r\n address rewardToken,\r\n address distributor,\r\n uint256 claimable,\r\n bytes32[] memory proof\r\n ) external isAuthorized {\r\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\r\n EIP20Interface(rewardToken).approve(distributor, claimedAmount);\r\n IDistributor(distributor).distribute(rewardToken, claimedAmount);\r\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\r\n }\r\n\r\n function delegateType() public pure virtual override returns (uint8) {\r\n return 5;\r\n }\r\n}\r\n\r\ninterface IDistributor {\r\n function distribute(address _rewardToken, uint256 _amount) external;\r\n}\r\n\r\ninterface IMorphoClaim {\r\n function claim(\r\n address account,\r\n address reward,\r\n uint256 claimable,\r\n bytes32[] memory proof\r\n ) external returns (uint256 amount);\r\n}\r\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\r\nimport { Exponential } from \"./Exponential.sol\";\r\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\r\nimport { Unitroller } from \"./Unitroller.sol\";\r\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\r\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\r\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\n/**\r\n * @title Compound's Comptroller Contract\r\n * @author Compound\r\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\r\n */\r\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n /// @notice Emitted when an admin supports a market\r\n event MarketListed(ICErc20 cToken);\r\n\r\n /// @notice Emitted when an account enters a market\r\n event MarketEntered(ICErc20 cToken, address account);\r\n\r\n /// @notice Emitted when an account exits a market\r\n event MarketExited(ICErc20 cToken, address account);\r\n\r\n /// @notice Emitted when close factor is changed by admin\r\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\r\n\r\n /// @notice Emitted when a collateral factor is changed by admin\r\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\r\n\r\n /// @notice Emitted when liquidation incentive is changed by admin\r\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\r\n\r\n /// @notice Emitted when price oracle is changed\r\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\r\n\r\n /// @notice Emitted when the whitelist enforcement is changed\r\n event WhitelistEnforcementChanged(bool enforce);\r\n\r\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\r\n event AddedRewardsDistributor(address rewardsDistributor);\r\n\r\n // closeFactorMantissa must be strictly greater than this value\r\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\r\n\r\n // closeFactorMantissa must not exceed this value\r\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\r\n\r\n // No collateralFactorMantissa may exceed this value\r\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\r\n\r\n // liquidationIncentiveMantissa must be no less than this value\r\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\r\n\r\n // liquidationIncentiveMantissa must be no greater than this value\r\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\r\n\r\n modifier isAuthorized() {\r\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveSupplyCaps(\r\n address cToken\r\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\r\n return ComptrollerBase.effectiveSupplyCaps(cToken);\r\n }\r\n\r\n /**\r\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveBorrowCaps(\r\n address cToken\r\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\r\n return ComptrollerBase.effectiveBorrowCaps(cToken);\r\n }\r\n\r\n /*** Assets You Are In ***/\r\n\r\n /**\r\n * @notice Returns the assets an account has entered\r\n * @param account The address of the account to pull assets for\r\n * @return A dynamic list with the assets the account has entered\r\n */\r\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\r\n ICErc20[] memory assetsIn = accountAssets[account];\r\n\r\n return assetsIn;\r\n }\r\n\r\n /**\r\n * @notice Returns whether the given account is entered in the given asset\r\n * @param account The address of the account to check\r\n * @param cToken The cToken to check\r\n * @return True if the account is in the asset, otherwise false.\r\n */\r\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\r\n return markets[address(cToken)].accountMembership[account];\r\n }\r\n\r\n /**\r\n * @notice Add assets to be included in account liquidity calculation\r\n * @param cTokens The list of addresses of the cToken markets to be enabled\r\n * @return Success indicator for whether each corresponding market was entered\r\n */\r\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\r\n uint256 len = cTokens.length;\r\n\r\n uint256[] memory results = new uint256[](len);\r\n for (uint256 i = 0; i < len; i++) {\r\n ICErc20 cToken = ICErc20(cTokens[i]);\r\n\r\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\r\n * @param cToken The market to enter\r\n * @param borrower The address of the account to modify\r\n * @return Success indicator for whether the market was entered\r\n */\r\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\r\n Market storage marketToJoin = markets[address(cToken)];\r\n\r\n if (!marketToJoin.isListed) {\r\n // market is not listed, cannot join\r\n return Error.MARKET_NOT_LISTED;\r\n }\r\n\r\n if (marketToJoin.accountMembership[borrower] == true) {\r\n // already joined\r\n return Error.NO_ERROR;\r\n }\r\n\r\n // survived the gauntlet, add to list\r\n // NOTE: we store these somewhat redundantly as a significant optimization\r\n // this avoids having to iterate through the list for the most common use cases\r\n // that is, only when we need to perform liquidity checks\r\n // and not whenever we want to check if an account is in a particular market\r\n marketToJoin.accountMembership[borrower] = true;\r\n accountAssets[borrower].push(cToken);\r\n\r\n // Add to allBorrowers\r\n if (!borrowers[borrower]) {\r\n allBorrowers.push(borrower);\r\n borrowers[borrower] = true;\r\n borrowerIndexes[borrower] = allBorrowers.length - 1;\r\n }\r\n\r\n emit MarketEntered(cToken, borrower);\r\n\r\n return Error.NO_ERROR;\r\n }\r\n\r\n /**\r\n * @notice Removes asset from sender's account liquidity calculation\r\n * @dev Sender must not have an outstanding borrow balance in the asset,\r\n * or be providing necessary collateral for an outstanding borrow.\r\n * @param cTokenAddress The address of the asset to be removed\r\n * @return Whether or not the account successfully exited the market\r\n */\r\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\r\n // TODO\r\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\r\n\r\n ICErc20 cToken = ICErc20(cTokenAddress);\r\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\r\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\r\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\r\n\r\n /* Fail if the sender has a borrow balance */\r\n if (amountOwed != 0) {\r\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\r\n }\r\n\r\n /* Fail if the sender is not permitted to redeem all of their tokens */\r\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\r\n if (allowed != 0) {\r\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\r\n }\r\n\r\n Market storage marketToExit = markets[cTokenAddress];\r\n\r\n /* Return true if the sender is not already ‘in’ the market */\r\n if (!marketToExit.accountMembership[msg.sender]) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /* Set cToken account membership to false */\r\n delete marketToExit.accountMembership[msg.sender];\r\n\r\n /* Delete cToken from the account’s list of assets */\r\n // load into memory for faster iteration\r\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\r\n uint256 len = userAssetList.length;\r\n uint256 assetIndex = len;\r\n for (uint256 i = 0; i < len; i++) {\r\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\r\n assetIndex = i;\r\n break;\r\n }\r\n }\r\n\r\n // We *must* have found the asset in the list or our redundant data structure is broken\r\n assert(assetIndex < len);\r\n\r\n // copy last item in list to location of item to be removed, reduce length by 1\r\n ICErc20[] storage storedList = accountAssets[msg.sender];\r\n storedList[assetIndex] = storedList[storedList.length - 1];\r\n storedList.pop();\r\n\r\n // If the user has exited all markets, remove them from the `allBorrowers` array\r\n if (storedList.length == 0) {\r\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\r\n allBorrowers.pop(); // Reduce length by 1\r\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\r\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\r\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\r\n }\r\n\r\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /*** Policy Hooks ***/\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to mint tokens in the given market\r\n * @param cTokenAddress The market to verify the mint against\r\n * @param minter The account which would get the minted tokens\r\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\r\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\r\n\r\n // Make sure market is listed\r\n if (!markets[cTokenAddress].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Make sure minter is whitelisted\r\n if (enforceWhitelist && !whitelist[minter]) {\r\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\r\n }\r\n\r\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\r\n\r\n // Supply cap of 0 corresponds to unlimited supplying\r\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\r\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\r\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\r\n uint256 nonWhitelistedTotalSupply;\r\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\r\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\r\n\r\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreSupplierAction(cTokenAddress, minter);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to redeem tokens in the given market\r\n * @param cToken The market to verify the redeem against\r\n * @param redeemer The account which would redeem the tokens\r\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\r\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\r\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\r\n if (allowed != uint256(Error.NO_ERROR)) {\r\n return allowed;\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreSupplierAction(cToken, redeemer);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function redeemAllowedInternal(\r\n address cToken,\r\n address redeemer,\r\n uint256 redeemTokens\r\n ) internal view returns (uint256) {\r\n if (!markets[cToken].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\r\n if (!markets[cToken].accountMembership[redeemer]) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\r\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\r\n redeemer,\r\n ICErc20(cToken),\r\n redeemTokens,\r\n 0,\r\n 0\r\n );\r\n if (err != Error.NO_ERROR) {\r\n return uint256(err);\r\n }\r\n if (shortfall > 0) {\r\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates mint and reverts on rejection. May emit logs.\r\n * @param cToken Asset being minted\r\n * @param minter The address minting the tokens\r\n * @param actualMintAmount The amount of the underlying asset being minted\r\n * @param mintTokens The number of tokens being minted\r\n */\r\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\r\n // Add minter to suppliers mapping\r\n suppliers[minter] = true;\r\n\r\n // Keep the flywheel moving\r\n flywheelPostSupplierAction(cToken, minter);\r\n }\r\n\r\n /**\r\n * @notice Validates redeem and reverts on rejection. May emit logs.\r\n * @param cToken Asset being redeemed\r\n * @param redeemer The address redeeming the tokens\r\n * @param redeemAmount The amount of the underlying asset being redeemed\r\n * @param redeemTokens The number of tokens being redeemed\r\n */\r\n function redeemVerify(\r\n address cToken,\r\n address redeemer,\r\n uint256 redeemAmount,\r\n uint256 redeemTokens\r\n ) external override {\r\n require(markets[msg.sender].isListed, \"!market\");\r\n\r\n // Require tokens is zero or amount is also zero\r\n if (redeemTokens == 0 && redeemAmount > 0) {\r\n revert(\"!zero\");\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPostSupplierAction(cToken, redeemer);\r\n }\r\n\r\n function getMaxRedeemOrBorrow(\r\n address account,\r\n ICErc20 cTokenModify,\r\n bool isBorrow\r\n ) external view override returns (uint256) {\r\n address cToken = address(cTokenModify);\r\n // Accrue interest\r\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\r\n\r\n // Get account liquidity\r\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\r\n account,\r\n isBorrow ? cTokenModify : ICErc20(address(0)),\r\n 0,\r\n 0,\r\n 0\r\n );\r\n require(err == Error.NO_ERROR, \"!liquidity\");\r\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\r\n\r\n // Get max borrow/redeem\r\n uint256 maxBorrowOrRedeemAmount;\r\n\r\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\r\n // Max redeem = balance of underlying if not used as collateral\r\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\r\n } else {\r\n // Avoid \"stack too deep\" error by separating this logic\r\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\r\n\r\n // Redeem only: max out at underlying balance\r\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\r\n }\r\n\r\n // Get max borrow or redeem considering cToken liquidity\r\n uint256 cTokenLiquidity = cTokenModify.getCash();\r\n\r\n // Return the minimum of the two maximums\r\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\r\n }\r\n\r\n /**\r\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\r\n */\r\n function _getMaxRedeemOrBorrow(\r\n uint256 liquidity,\r\n ICErc20 cTokenModify,\r\n bool isBorrow\r\n ) internal view returns (uint256) {\r\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\r\n\r\n // Get the normalized price of the asset\r\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\r\n require(conversionFactor > 0, \"!oracle\");\r\n\r\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\r\n if (!isBorrow) {\r\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\r\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\r\n }\r\n\r\n // Get max borrow or redeem considering excess account liquidity\r\n return (liquidity * 1e18) / conversionFactor;\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\r\n * @param cToken The market to verify the borrow against\r\n * @param borrower The account which would borrow the asset\r\n * @param borrowAmount The amount of underlying the account would borrow\r\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\r\n\r\n // Make sure market is listed\r\n if (!markets[cToken].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n if (!markets[cToken].accountMembership[borrower]) {\r\n // only cTokens may call borrowAllowed if borrower not in market\r\n require(msg.sender == cToken, \"!ctoken\");\r\n\r\n // attempt to add borrower to the market\r\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\r\n if (err != Error.NO_ERROR) {\r\n return uint256(err);\r\n }\r\n\r\n // it should be impossible to break the important invariant\r\n assert(markets[cToken].accountMembership[borrower]);\r\n }\r\n\r\n // Make sure oracle price is available\r\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\r\n return uint256(Error.PRICE_ERROR);\r\n }\r\n\r\n // Make sure borrower is whitelisted\r\n if (enforceWhitelist && !whitelist[borrower]) {\r\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\r\n }\r\n\r\n uint256 borrowCap = effectiveBorrowCaps(cToken);\r\n\r\n // Borrow cap of 0 corresponds to unlimited borrowing\r\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\r\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\r\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\r\n uint256 nonWhitelistedTotalBorrows;\r\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\r\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\r\n\r\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreBorrowerAction(cToken, borrower);\r\n\r\n // Perform a hypothetical liquidity check to guard against shortfall\r\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\r\n if (err != uint256(Error.NO_ERROR)) {\r\n return err;\r\n }\r\n if (shortfall > 0) {\r\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates borrow the underlying asset of the given market\r\n * @param cToken The market to verify the borrow against\r\n * @param borrower The account which borrowed the asset\r\n */\r\n function borrowVerify(address cToken, address borrower) external override {\r\n // Keep the flywheel moving\r\n flywheelPostBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\r\n * @param cToken Asset whose underlying is being borrowed\r\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\r\n */\r\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\r\n // Check if min borrow exists\r\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\r\n\r\n if (minBorrowEth > 0) {\r\n // Get new underlying borrow balance of account for this cToken\r\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\r\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\r\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\r\n Exp({ mantissa: oraclePriceMantissa }),\r\n accountBorrowsNew\r\n );\r\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\r\n\r\n // Check against min borrow\r\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\r\n }\r\n\r\n // Return no error\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to repay a borrow in the given market\r\n * @param cToken The market to verify the repay against\r\n * @param payer The account which would repay the asset\r\n * @param borrower The account which would borrowed the asset\r\n * @param repayAmount The amount of the underlying asset the account would repay\r\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function repayBorrowAllowed(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external override returns (uint256) {\r\n // Make sure market is listed\r\n if (!markets[cToken].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreBorrowerAction(cToken, borrower);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates that blacklisted balances are updated after borrow repayment\r\n * @param cToken The market to verify the repay against\r\n * @param payer The account which repayed the asset\r\n * @param borrower The account which borrowed the asset\r\n * @param repayAmount The amount of the underlying asset the account repayed\r\n */\r\n function repayBorrowVerify(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external override {\r\n // Keep the flywheel moving\r\n flywheelPostBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Checks if the liquidation should be allowed to occur\r\n * @param cTokenBorrowed Asset which was borrowed by the borrower\r\n * @param cTokenCollateral Asset which was used as collateral and will be seized\r\n * @param liquidator The address repaying the borrow and seizing the collateral\r\n * @param borrower The address of the borrower\r\n * @param repayAmount The amount of underlying being repaid\r\n */\r\n function liquidateBorrowAllowed(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external override returns (uint256) {\r\n // Make sure markets are listed\r\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Get borrowers' underlying borrow balance\r\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\r\n\r\n /* allow accounts to be liquidated if the market is deprecated */\r\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\r\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\r\n } else {\r\n /* The borrower must have shortfall in order to be liquidateable */\r\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\r\n borrower,\r\n ICErc20(address(0)),\r\n 0,\r\n 0,\r\n 0\r\n );\r\n if (err != Error.NO_ERROR) {\r\n return uint256(err);\r\n }\r\n\r\n if (shortfall == 0) {\r\n return uint256(Error.INSUFFICIENT_SHORTFALL);\r\n }\r\n\r\n /* The liquidator may not repay more than what is allowed by the closeFactor */\r\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\r\n if (repayAmount > maxClose) {\r\n return uint256(Error.TOO_MUCH_REPAY);\r\n }\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Checks if the seizing of assets should be allowed to occur\r\n * @param cTokenCollateral Asset which was used as collateral and will be seized\r\n * @param cTokenBorrowed Asset which was borrowed by the borrower\r\n * @param liquidator The address repaying the borrow and seizing the collateral\r\n * @param borrower The address of the borrower\r\n * @param seizeTokens The number of collateral tokens to seize\r\n */\r\n function seizeAllowed(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!seizeGuardianPaused, \"!seize:paused\");\r\n\r\n // Make sure markets are listed\r\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\r\n return uint256(Error.MARKET_NOT_LISTED);\r\n }\r\n\r\n // Make sure cToken Comptrollers are identical\r\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\r\n return uint256(Error.COMPTROLLER_MISMATCH);\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Validates that blacklisted balances are updated after seizing of assets\r\n * @param cTokenCollateral Asset which was used as collateral and will be seized\r\n * @param cTokenBorrowed Asset which was borrowed by the borrower\r\n * @param liquidator The address repaying the borrow and seizing the collateral\r\n * @param borrower The address of the borrower\r\n * @param seizeTokens The number of collateral tokens to seize\r\n */\r\n function seizeVerify(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external override {\r\n // Keep the flywheel moving\r\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\r\n }\r\n\r\n /**\r\n * @notice Checks if the account should be allowed to transfer tokens in the given market\r\n * @param cToken The market to verify the transfer against\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n * @param transferTokens The number of cTokens to transfer\r\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\r\n */\r\n function transferAllowed(\r\n address cToken,\r\n address src,\r\n address dst,\r\n uint256 transferTokens\r\n ) external override returns (uint256) {\r\n // Pausing is a very serious situation - we revert to sound the alarms\r\n require(!transferGuardianPaused, \"!transfer:paused\");\r\n\r\n // Currently the only consideration is whether or not\r\n // the src is allowed to redeem this many tokens\r\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\r\n if (allowed != uint256(Error.NO_ERROR)) {\r\n return allowed;\r\n }\r\n\r\n // Keep the flywheel moving\r\n flywheelPreTransferAction(cToken, src, dst);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n\r\n /**\r\n * @notice Validates that blacklisted balances are updated after transfering assets\r\n * @param cToken The market to verify the transfer against\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n * @param transferTokens The number of cTokens to transfer\r\n */\r\n function transferVerify(\r\n address cToken,\r\n address src,\r\n address dst,\r\n uint256 transferTokens\r\n ) external override {\r\n\r\n // Keep the flywheel moving\r\n flywheelPostTransferAction(cToken, src, dst);\r\n }\r\n\r\n /*** Flywheel Hooks ***/\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\r\n * @param cToken The relevant market\r\n * @param supplier The minter/redeemer\r\n */\r\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving post-mint and post-redeem\r\n * @param cToken The relevant market\r\n * @param supplier The minter/redeemer\r\n */\r\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\r\n * @param cToken The relevant market\r\n * @param borrower The borrower\r\n */\r\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving post-borrow and post-repay\r\n * @param cToken The relevant market\r\n * @param borrower The borrower\r\n */\r\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\r\n * @param cToken The relevant market\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n */\r\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\r\n }\r\n\r\n /**\r\n * @notice Keeps the flywheel moving post-transfer and post-seize\r\n * @param cToken The relevant market\r\n * @param src The account which sources the tokens\r\n * @param dst The account which receives the tokens\r\n */\r\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\r\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\r\n }\r\n\r\n /*** Liquidity/Liquidation Calculations ***/\r\n\r\n /**\r\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\r\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\r\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\r\n */\r\n struct AccountLiquidityLocalVars {\r\n ICErc20 asset;\r\n uint256 sumCollateral;\r\n uint256 sumBorrowPlusEffects;\r\n uint256 cTokenBalance;\r\n uint256 borrowBalance;\r\n uint256 exchangeRateMantissa;\r\n uint256 oraclePriceMantissa;\r\n Exp collateralFactor;\r\n Exp exchangeRate;\r\n Exp oraclePrice;\r\n Exp tokensToDenom;\r\n uint256 borrowCapForCollateral;\r\n uint256 borrowedAssetPrice;\r\n uint256 assetAsCollateralValueCap;\r\n }\r\n\r\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\r\n (\r\n Error err,\r\n uint256 collateralValue,\r\n uint256 liquidity,\r\n uint256 shortfall\r\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\r\n return (uint256(err), collateralValue, liquidity, shortfall);\r\n }\r\n\r\n /**\r\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\r\n * @param cTokenModify The market to hypothetically redeem/borrow in\r\n * @param account The account to determine liquidity for\r\n * @param redeemTokens The number of tokens to hypothetically redeem\r\n * @param borrowAmount The amount of underlying to hypothetically borrow\r\n * @return (possible error code (semi-opaque),\r\n hypothetical account liquidity in excess of collateral requirements,\r\n * hypothetical account shortfall below collateral requirements)\r\n */\r\n function getHypotheticalAccountLiquidity(\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) public view returns (uint256, uint256, uint256, uint256) {\r\n (\r\n Error err,\r\n uint256 collateralValue,\r\n uint256 liquidity,\r\n uint256 shortfall\r\n ) = getHypotheticalAccountLiquidityInternal(\r\n account,\r\n ICErc20(cTokenModify),\r\n redeemTokens,\r\n borrowAmount,\r\n repayAmount\r\n );\r\n return (uint256(err), collateralValue, liquidity, shortfall);\r\n }\r\n\r\n /**\r\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\r\n * @param cTokenModify The market to hypothetically redeem/borrow in\r\n * @param account The account to determine liquidity for\r\n * @param redeemTokens The number of tokens to hypothetically redeem\r\n * @param borrowAmount The amount of underlying to hypothetically borrow\r\n * @return (possible error code,\r\n hypothetical account collateral value,\r\n hypothetical account liquidity in excess of collateral requirements,\r\n * hypothetical account shortfall below collateral requirements)\r\n */\r\n function getHypotheticalAccountLiquidityInternal(\r\n address account,\r\n ICErc20 cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) internal view returns (Error, uint256, uint256, uint256) {\r\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\r\n\r\n if (address(cTokenModify) != address(0)) {\r\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\r\n }\r\n\r\n // For each asset the account is in\r\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\r\n vars.asset = accountAssets[account][i];\r\n\r\n {\r\n // Read the balances and exchange rate from the cToken\r\n uint256 oErr;\r\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\r\n account\r\n );\r\n if (oErr != 0) {\r\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\r\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\r\n }\r\n }\r\n {\r\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\r\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\r\n\r\n // Get the normalized price of the asset\r\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\r\n if (vars.oraclePriceMantissa == 0) {\r\n return (Error.PRICE_ERROR, 0, 0, 0);\r\n }\r\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\r\n\r\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\r\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\r\n }\r\n {\r\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\r\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\r\n vars.asset,\r\n cTokenModify,\r\n redeemTokens > 0,\r\n account\r\n );\r\n\r\n // accumulate the collateral value to sumCollateral\r\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\r\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\r\n assetCollateralValue = vars.assetAsCollateralValueCap;\r\n vars.sumCollateral += assetCollateralValue;\r\n }\r\n\r\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\r\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\r\n vars.oraclePrice,\r\n vars.borrowBalance,\r\n vars.sumBorrowPlusEffects\r\n );\r\n\r\n // Calculate effects of interacting with cTokenModify\r\n if (vars.asset == cTokenModify) {\r\n // redeem effect\r\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\r\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\r\n vars.tokensToDenom,\r\n redeemTokens,\r\n vars.sumBorrowPlusEffects\r\n );\r\n\r\n // borrow effect\r\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\r\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\r\n vars.oraclePrice,\r\n borrowAmount,\r\n vars.sumBorrowPlusEffects\r\n );\r\n\r\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\r\n if (repayEffect >= vars.sumBorrowPlusEffects) {\r\n vars.sumBorrowPlusEffects = 0;\r\n } else {\r\n vars.sumBorrowPlusEffects -= repayEffect;\r\n }\r\n }\r\n }\r\n\r\n // These are safe, as the underflow condition is checked first\r\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\r\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\r\n } else {\r\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\r\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\r\n * @param cTokenBorrowed The address of the borrowed cToken\r\n * @param cTokenCollateral The address of the collateral cToken\r\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\r\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\r\n */\r\n function liquidateCalculateSeizeTokens(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n uint256 actualRepayAmount\r\n ) external view override returns (uint256, uint256) {\r\n /* Read oracle prices for borrowed and collateral markets */\r\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\r\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\r\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\r\n return (uint256(Error.PRICE_ERROR), 0);\r\n }\r\n\r\n /*\r\n * Get the exchange rate and calculate the number of collateral tokens to seize:\r\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\r\n * seizeTokens = seizeAmount / exchangeRate\r\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\r\n */\r\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\r\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\r\n uint256 seizeTokens;\r\n Exp memory numerator;\r\n Exp memory denominator;\r\n Exp memory ratio;\r\n\r\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\r\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\r\n\r\n /*\r\n * The liquidation penalty includes\r\n * - the liquidator incentive\r\n * - the protocol fees (Ionic admin fees)\r\n * - the market fee\r\n */\r\n Exp memory totalPenaltyMantissa = add_(\r\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\r\n Exp({ mantissa: feeSeizeShareMantissa })\r\n );\r\n\r\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\r\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\r\n ratio = div_(numerator, denominator);\r\n\r\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\r\n return (uint256(Error.NO_ERROR), seizeTokens);\r\n }\r\n\r\n /*** Admin Functions ***/\r\n\r\n /**\r\n * @notice Add a RewardsDistributor contracts.\r\n * @dev Admin function to add a RewardsDistributor contract\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _addRewardsDistributor(address distributor) external returns (uint256) {\r\n require(hasAdminRights(), \"!admin\");\r\n\r\n // Check marker method\r\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\r\n\r\n // Check for existing RewardsDistributor\r\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\r\n\r\n // Add RewardsDistributor to array\r\n rewardsDistributors.push(distributor);\r\n emit AddedRewardsDistributor(distributor);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the whitelist enforcement for the comptroller\r\n * @dev Admin function to set a new whitelist enforcement boolean\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\r\n }\r\n\r\n // Check if `enforceWhitelist` already equals `enforce`\r\n if (enforceWhitelist == enforce) {\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n // Set comptroller's `enforceWhitelist` to `enforce`\r\n enforceWhitelist = enforce;\r\n\r\n // Emit WhitelistEnforcementChanged(bool enforce);\r\n emit WhitelistEnforcementChanged(enforce);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the whitelist `statuses` for `suppliers`\r\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\r\n }\r\n\r\n // Set whitelist statuses for suppliers\r\n for (uint256 i = 0; i < suppliers.length; i++) {\r\n address supplier = suppliers[i];\r\n\r\n if (statuses[i]) {\r\n // If not already whitelisted, add to whitelist\r\n if (!whitelist[supplier]) {\r\n whitelist[supplier] = true;\r\n whitelistArray.push(supplier);\r\n whitelistIndexes[supplier] = whitelistArray.length - 1;\r\n }\r\n } else {\r\n // If whitelisted, remove from whitelist\r\n if (whitelist[supplier]) {\r\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\r\n whitelistArray.pop(); // Reduce length by 1\r\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\r\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\r\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\r\n }\r\n }\r\n }\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets a new price oracle for the comptroller\r\n * @dev Admin function to set a new price oracle\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\r\n }\r\n\r\n // Track the old oracle for the comptroller\r\n BasePriceOracle oldOracle = oracle;\r\n\r\n // Set comptroller's oracle to newOracle\r\n oracle = newOracle;\r\n\r\n // Emit NewPriceOracle(oldOracle, newOracle)\r\n emit NewPriceOracle(oldOracle, newOracle);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the closeFactor used when liquidating borrows\r\n * @dev Admin function to set closeFactor\r\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\r\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\r\n */\r\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\r\n }\r\n\r\n // Check limits\r\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\r\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\r\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\r\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\r\n }\r\n\r\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\r\n if (lessThanExp(highLimit, newCloseFactorExp)) {\r\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\r\n }\r\n\r\n // Set pool close factor to new close factor, remember old value\r\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\r\n closeFactorMantissa = newCloseFactorMantissa;\r\n\r\n // Emit event\r\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets the collateralFactor for a market\r\n * @dev Admin function to set per-market collateralFactor\r\n * @param cToken The market to set the factor on\r\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\r\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\r\n */\r\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\r\n }\r\n\r\n // Verify market is listed\r\n Market storage market = markets[address(cToken)];\r\n if (!market.isListed) {\r\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\r\n }\r\n\r\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\r\n\r\n // Check collateral factor <= 0.9\r\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\r\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\r\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\r\n }\r\n\r\n // If collateral factor != 0, fail if price == 0\r\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\r\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\r\n }\r\n\r\n // Set market's collateral factor to new collateral factor, remember old value\r\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\r\n market.collateralFactorMantissa = newCollateralFactorMantissa;\r\n\r\n // Emit event with asset, old collateral factor, and new collateral factor\r\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sets liquidationIncentive\r\n * @dev Admin function to set liquidationIncentive\r\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\r\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\r\n */\r\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\r\n }\r\n\r\n // Check de-scaled min <= newLiquidationIncentive <= max\r\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\r\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\r\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\r\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\r\n }\r\n\r\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\r\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\r\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\r\n }\r\n\r\n // Save current value for use in log\r\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\r\n\r\n // Set liquidation incentive to new incentive\r\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\r\n\r\n // Emit event with old incentive, new incentive\r\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Add the market to the markets mapping and set it as listed\r\n * @dev Admin function to set isListed and add support for the market\r\n * @param cToken The address of the market (token) to list\r\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\r\n */\r\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\r\n }\r\n\r\n // Is market already listed?\r\n if (markets[address(cToken)].isListed) {\r\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\r\n }\r\n\r\n // Check cToken.comptroller == this\r\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\r\n\r\n // Make sure market is not already listed\r\n address underlying = ICErc20(address(cToken)).underlying();\r\n\r\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\r\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\r\n }\r\n\r\n // List market and emit event\r\n Market storage market = markets[address(cToken)];\r\n market.isListed = true;\r\n market.collateralFactorMantissa = 0;\r\n allMarkets.push(cToken);\r\n cTokensByUnderlying[underlying] = cToken;\r\n emit MarketListed(cToken);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\r\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\r\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\r\n */\r\n function _deployMarket(\r\n uint8 delegateType,\r\n bytes calldata constructorData,\r\n bytes calldata becomeImplData,\r\n uint256 collateralFactorMantissa\r\n ) external returns (uint256) {\r\n // Check caller is admin\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\r\n }\r\n\r\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\r\n bool oldIonicAdminHasRights = ionicAdminHasRights;\r\n ionicAdminHasRights = true;\r\n\r\n // Deploy via Ionic admin\r\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\r\n // Reset Ionic admin rights to the original value\r\n ionicAdminHasRights = oldIonicAdminHasRights;\r\n // Support market here in the Comptroller\r\n uint256 err = _supportMarket(cToken);\r\n\r\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\r\n\r\n // Set collateral factor\r\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\r\n }\r\n\r\n function _becomeImplementation() external {\r\n require(msg.sender == address(this), \"!self call\");\r\n\r\n if (!_notEnteredInitialized) {\r\n _notEntered = true;\r\n _notEnteredInitialized = true;\r\n }\r\n }\r\n\r\n /*** Helper Functions ***/\r\n\r\n /**\r\n * @notice Returns true if the given cToken market has been deprecated\r\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\r\n * @param cToken The market to check if deprecated\r\n */\r\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\r\n return\r\n markets[address(cToken)].collateralFactorMantissa == 0 &&\r\n borrowGuardianPaused[address(cToken)] == true &&\r\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\r\n }\r\n\r\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\r\n return ComptrollerExtensionInterface(address(this));\r\n }\r\n\r\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\r\n uint8 fnsCount = 32;\r\n\r\n functionSelectors = new bytes4[](fnsCount);\r\n\r\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\r\n functionSelectors[--fnsCount] = this._deployMarket.selector;\r\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\r\n functionSelectors[--fnsCount] = this.checkMembership.selector;\r\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\r\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\r\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\r\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\r\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\r\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\r\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\r\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\r\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\r\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\r\n functionSelectors[--fnsCount] = this.exitMarket.selector;\r\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\r\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\r\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\r\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\r\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\r\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\r\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\r\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\r\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\r\n functionSelectors[--fnsCount] = this.mintVerify.selector;\r\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\r\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\r\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\r\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\r\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\r\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\r\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n }\r\n\r\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\r\n\r\n /**\r\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\r\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\r\n */\r\n function _beforeNonReentrant() external override {\r\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\r\n require(_notEntered, \"!reentered\");\r\n _notEntered = false;\r\n }\r\n\r\n /**\r\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\r\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\r\n */\r\n function _afterNonReentrant() external override {\r\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\r\n _notEntered = true; // get a gas-refund post-Istanbul\r\n }\r\n}\r\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\r\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\r\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\r\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\r\n\r\ninterface ComptrollerInterface {\r\n function isDeprecated(ICErc20 cToken) external view returns (bool);\r\n\r\n function _becomeImplementation() external;\r\n\r\n function _deployMarket(\r\n uint8 delegateType,\r\n bytes memory constructorData,\r\n bytes calldata becomeImplData,\r\n uint256 collateralFactorMantissa\r\n ) external returns (uint256);\r\n\r\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\r\n\r\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\r\n\r\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\r\n\r\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\r\n\r\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\r\n\r\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\r\n\r\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\r\n\r\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\r\n\r\n function _addRewardsDistributor(address distributor) external returns (uint256);\r\n\r\n function getHypotheticalAccountLiquidity(\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) external view returns (uint256, uint256, uint256, uint256);\r\n\r\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\r\n\r\n /*** Assets You Are In ***/\r\n\r\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\r\n\r\n function exitMarket(address cToken) external returns (uint256);\r\n\r\n /*** Policy Hooks ***/\r\n\r\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\r\n\r\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\r\n\r\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\r\n\r\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\r\n\r\n function borrowVerify(address cToken, address borrower) external;\r\n\r\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\r\n\r\n function repayBorrowAllowed(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external returns (uint256);\r\n\r\n function repayBorrowVerify(\r\n address cToken,\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external;\r\n\r\n function liquidateBorrowAllowed(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount\r\n ) external returns (uint256);\r\n\r\n function seizeAllowed(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external returns (uint256);\r\n \r\n function seizeVerify(\r\n address cTokenCollateral,\r\n address cTokenBorrowed,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external;\r\n\r\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\r\n \r\n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\r\n\r\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\r\n\r\n /*** Liquidity/Liquidation Calculations ***/\r\n\r\n function getAccountLiquidity(\r\n address account\r\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\r\n\r\n function liquidateCalculateSeizeTokens(\r\n address cTokenBorrowed,\r\n address cTokenCollateral,\r\n uint256 repayAmount\r\n ) external view returns (uint256, uint256);\r\n\r\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\r\n\r\n function _beforeNonReentrant() external;\r\n\r\n function _afterNonReentrant() external;\r\n\r\n /*** New supply and borrow cap view functions ***/\r\n\r\n /**\r\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\r\n\r\n /**\r\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\r\n}\r\n\r\ninterface ComptrollerStorageInterface {\r\n function admin() external view returns (address);\r\n\r\n function adminHasRights() external view returns (bool);\r\n\r\n function ionicAdmin() external view returns (address);\r\n\r\n function ionicAdminHasRights() external view returns (bool);\r\n\r\n function pendingAdmin() external view returns (address);\r\n\r\n function oracle() external view returns (BasePriceOracle);\r\n\r\n function pauseGuardian() external view returns (address);\r\n\r\n function closeFactorMantissa() external view returns (uint256);\r\n\r\n function liquidationIncentiveMantissa() external view returns (uint256);\r\n\r\n function isUserOfPool(address user) external view returns (bool);\r\n\r\n function whitelist(address account) external view returns (bool);\r\n\r\n function enforceWhitelist() external view returns (bool);\r\n\r\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\r\n\r\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\r\n\r\n function suppliers(address account) external view returns (bool);\r\n\r\n function cTokensByUnderlying(address) external view returns (address);\r\n\r\n /**\r\n * Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\r\n * `effectiveSupplyCaps` to get the correct supply cap.\r\n * @param cToken The address of the cToken.\r\n * @return The supply cap in the units of the underlying asset.\r\n */\r\n function supplyCaps(address cToken) external view returns (uint256);\r\n\r\n /**\r\n * Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\r\n * `effectiveBorrowCaps` to get the correct borrow cap.\r\n * @param cToken The address of the cToken.\r\n * @return The borrow cap in the units of the underlying asset.\r\n */\r\n function borrowCaps(address cToken) external view returns (uint256);\r\n\r\n function markets(address cToken) external view returns (bool, uint256);\r\n\r\n function accountAssets(address, uint256) external view returns (address);\r\n\r\n function borrowGuardianPaused(address cToken) external view returns (bool);\r\n\r\n function mintGuardianPaused(address cToken) external view returns (bool);\r\n\r\n function rewardsDistributors(uint256) external view returns (address);\r\n}\r\n\r\ninterface SFSRegister {\r\n function register(address _recipient) external returns (uint256 tokenId);\r\n}\r\n\r\ninterface ComptrollerExtensionInterface {\r\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\r\n\r\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\r\n\r\n function getAllMarkets() external view returns (ICErc20[] memory);\r\n\r\n function getAllBorrowers() external view returns (address[] memory);\r\n\r\n function getAllBorrowersCount() external view returns (uint256);\r\n\r\n function getPaginatedBorrowers(\r\n uint256 page,\r\n uint256 pageSize\r\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\r\n\r\n function getRewardsDistributors() external view returns (address[] memory);\r\n\r\n function getAccruingFlywheels() external view returns (address[] memory);\r\n\r\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\r\n\r\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\r\n\r\n function _setBorrowCapForCollateralWhitelist(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account,\r\n bool whitelisted\r\n ) external;\r\n\r\n function isBorrowCapForCollateralWhitelisted(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account\r\n ) external view returns (bool);\r\n\r\n function _blacklistBorrowingAgainstCollateral(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n bool blacklisted\r\n ) external;\r\n\r\n function _blacklistBorrowingAgainstCollateralWhitelist(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account,\r\n bool whitelisted\r\n ) external;\r\n\r\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\r\n address cTokenBorrow,\r\n address cTokenCollateral,\r\n address account\r\n ) external view returns (bool);\r\n\r\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\r\n\r\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\r\n\r\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\r\n\r\n function _removeFlywheel(address flywheelAddress) external returns (bool);\r\n\r\n function getWhitelist() external view returns (address[] memory);\r\n\r\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\r\n\r\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\r\n\r\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\r\n\r\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\r\n\r\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\r\n\r\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\r\n\r\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\r\n\r\n function _setTransferPaused(bool state) external returns (bool);\r\n\r\n function _setSeizePaused(bool state) external returns (bool);\r\n\r\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\r\n\r\n function getAssetAsCollateralValueCap(\r\n ICErc20 collateral,\r\n ICErc20 cTokenModify,\r\n bool redeeming,\r\n address account\r\n ) external view returns (uint256);\r\n\r\n function registerInSFS() external returns (uint256);\r\n}\r\n\r\ninterface ComptrollerPrudentiaCapsExtInterface {\r\n /**\r\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\r\n * @return The config.\r\n */\r\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\r\n\r\n /**\r\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\r\n * @return The config.\r\n */\r\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\r\n\r\n /**\r\n * @notice Sets the Adrastia Prudentia supply cap config.\r\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\r\n * @param newConfig The new config.\r\n */\r\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\r\n\r\n /**\r\n * @notice Sets the Adrastia Prudentia supply cap config.\r\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\r\n * @param newConfig The new config.\r\n */\r\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\r\n}\r\n\r\ninterface UnitrollerInterface {\r\n function comptrollerImplementation() external view returns (address);\r\n\r\n function _upgrade() external;\r\n\r\n function _acceptAdmin() external returns (uint256);\r\n\r\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\r\n\r\n function _toggleAdminRights(bool hasRights) external returns (uint256);\r\n}\r\n\r\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\r\n\r\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\r\n\r\ninterface IonicComptroller is\r\n ComptrollerInterface,\r\n ComptrollerExtensionInterface,\r\n UnitrollerInterface,\r\n ComptrollerStorageInterface\r\n{\r\n\r\n}\r\n\r\nabstract contract ComptrollerBase is ComptrollerV4Storage {\r\n /// @notice Indicator that this is a Comptroller contract (for inspection)\r\n bool public constant isComptroller = true;\r\n\r\n /**\r\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\r\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\r\n\r\n // Check if we're using Adrastia Prudentia for the supply cap\r\n if (capConfig.controller != address(0)) {\r\n // We have a controller, so we're using Adrastia Prudentia\r\n\r\n address underlyingToken = ICErc20(cToken).underlying();\r\n\r\n // Get the supply cap from Adrastia Prudentia\r\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\r\n\r\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\r\n // must scale the supply cap to get the correct amount\r\n\r\n int256 scaleByDecimals = 18;\r\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\r\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\r\n if (success && data.length == 32) {\r\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\r\n }\r\n\r\n scaleByDecimals += capConfig.decimalShift;\r\n\r\n if (scaleByDecimals >= 0) {\r\n // We're scaling up, so we need to multiply\r\n supplyCap *= 10 ** uint256(scaleByDecimals);\r\n } else {\r\n // We're scaling down, so we need to divide\r\n supplyCap /= 10 ** uint256(-scaleByDecimals);\r\n }\r\n } else {\r\n // We don't have a controller, so we're using the local supply cap\r\n\r\n // Get the supply cap from the local supply cap\r\n supplyCap = supplyCaps[cToken];\r\n }\r\n }\r\n\r\n /**\r\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\r\n * @param cToken The address of the cToken.\r\n */\r\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\r\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\r\n\r\n // Check if we're using Adrastia Prudentia for the borrow cap\r\n if (capConfig.controller != address(0)) {\r\n // We have a controller, so we're using Adrastia Prudentia\r\n\r\n address underlyingToken = ICErc20(cToken).underlying();\r\n\r\n // Get the borrow cap from Adrastia Prudentia\r\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\r\n\r\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\r\n // must scale the supply cap to get the correct amount\r\n\r\n int256 scaleByDecimals = 18;\r\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\r\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\r\n if (success && data.length == 32) {\r\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\r\n }\r\n\r\n scaleByDecimals += capConfig.decimalShift;\r\n\r\n if (scaleByDecimals >= 0) {\r\n // We're scaling up, so we need to multiply\r\n borrowCap *= 10 ** uint256(scaleByDecimals);\r\n } else {\r\n // We're scaling down, so we need to divide\r\n borrowCap /= 10 ** uint256(-scaleByDecimals);\r\n }\r\n } else {\r\n // We don't have a controller, so we're using the local borrow cap\r\n borrowCap = borrowCaps[cToken];\r\n }\r\n }\r\n}\r\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IFeeDistributor.sol\";\r\nimport \"../oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\r\n\r\ncontract UnitrollerAdminStorage {\r\n /*\r\n * Administrator for Ionic\r\n */\r\n address payable public ionicAdmin;\r\n\r\n /**\r\n * @notice Administrator for this contract\r\n */\r\n address public admin;\r\n\r\n /**\r\n * @notice Pending administrator for this contract\r\n */\r\n address public pendingAdmin;\r\n\r\n /**\r\n * @notice Whether or not the Ionic admin has admin rights\r\n */\r\n bool public ionicAdminHasRights = true;\r\n\r\n /**\r\n * @notice Whether or not the admin has admin rights\r\n */\r\n bool public adminHasRights = true;\r\n\r\n /**\r\n * @notice Returns a boolean indicating if the sender has admin rights\r\n */\r\n function hasAdminRights() internal view returns (bool) {\r\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\r\n }\r\n}\r\n\r\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\r\n /**\r\n * @notice Oracle which gives the price of any given asset\r\n */\r\n BasePriceOracle public oracle;\r\n\r\n /**\r\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\r\n */\r\n uint256 public closeFactorMantissa;\r\n\r\n /**\r\n * @notice Multiplier representing the discount on collateral that a liquidator receives\r\n */\r\n uint256 public liquidationIncentiveMantissa;\r\n\r\n /*\r\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\r\n */\r\n uint256 internal maxAssets;\r\n\r\n /**\r\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\r\n */\r\n mapping(address => ICErc20[]) public accountAssets;\r\n}\r\n\r\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\r\n struct Market {\r\n // Whether or not this market is listed\r\n bool isListed;\r\n // Multiplier representing the most one can borrow against their collateral in this market.\r\n // For instance, 0.9 to allow borrowing 90% of collateral value.\r\n // Must be between 0 and 1, and stored as a mantissa.\r\n uint256 collateralFactorMantissa;\r\n // Per-market mapping of \"accounts in this asset\"\r\n mapping(address => bool) accountMembership;\r\n }\r\n\r\n /**\r\n * @notice Official mapping of cTokens -> Market metadata\r\n * @dev Used e.g. to determine if a market is supported\r\n */\r\n mapping(address => Market) public markets;\r\n\r\n /// @notice A list of all markets\r\n ICErc20[] public allMarkets;\r\n\r\n /**\r\n * @dev Maps borrowers to booleans indicating if they have entered any markets\r\n */\r\n mapping(address => bool) internal borrowers;\r\n\r\n /// @notice A list of all borrowers who have entered markets\r\n address[] public allBorrowers;\r\n\r\n // Indexes of borrower account addresses in the `allBorrowers` array\r\n mapping(address => uint256) internal borrowerIndexes;\r\n\r\n /**\r\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\r\n */\r\n mapping(address => bool) public suppliers;\r\n\r\n /// @notice All cTokens addresses mapped by their underlying token addresses\r\n mapping(address => ICErc20) public cTokensByUnderlying;\r\n\r\n /// @notice Whether or not the supplier whitelist is enforced\r\n bool public enforceWhitelist;\r\n\r\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\r\n mapping(address => bool) public whitelist;\r\n\r\n /// @notice An array of all whitelisted accounts\r\n address[] public whitelistArray;\r\n\r\n // Indexes of account addresses in the `whitelistArray` array\r\n mapping(address => uint256) internal whitelistIndexes;\r\n\r\n /**\r\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\r\n * Actions which allow users to remove their own assets cannot be paused.\r\n * Liquidation / seizing / transfer can only be paused globally, not by market.\r\n */\r\n address public pauseGuardian;\r\n bool public _mintGuardianPaused;\r\n bool public _borrowGuardianPaused;\r\n bool public transferGuardianPaused;\r\n bool public seizeGuardianPaused;\r\n mapping(address => bool) public mintGuardianPaused;\r\n mapping(address => bool) public borrowGuardianPaused;\r\n}\r\n\r\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\r\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\r\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\r\n address public borrowCapGuardian;\r\n\r\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\r\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\r\n mapping(address => uint256) public borrowCaps;\r\n\r\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\r\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\r\n mapping(address => uint256) public supplyCaps;\r\n\r\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\r\n address[] public rewardsDistributors;\r\n\r\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\r\n bool internal _notEntered;\r\n\r\n /// @dev Whether or not _notEntered has been initialized\r\n bool internal _notEnteredInitialized;\r\n\r\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\r\n address[] public nonAccruingRewardsDistributors;\r\n\r\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\r\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\r\n\r\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\r\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\r\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\r\n mapping(address => mapping(address => EnumerableSet.AddressSet))\r\n internal borrowingAgainstCollateralBlacklistWhitelist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\r\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\r\n\r\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\r\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\r\n}\r\n\r\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\r\n /// @dev Adrastia Prudentia config for controlling borrow caps.\r\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\r\n\r\n /// @dev Adrastia Prudentia config for controlling supply caps.\r\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\r\n}\r\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\r\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\r\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\r\nimport { Exponential } from \"./Exponential.sol\";\r\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\r\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\r\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\r\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\r\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\r\n\r\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\r\nimport { PoolLens } from \"../PoolLens.sol\";\r\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\r\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\r\n\r\n/**\r\n * @title Compound's CErc20 Contract\r\n * @notice CTokens which wrap an EIP-20 underlying\r\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\r\n * @author Compound\r\n */\r\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\r\n modifier isAuthorized() {\r\n require(\r\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\r\n \"not authorized\"\r\n );\r\n _;\r\n }\r\n\r\n modifier isMinHFThresholdExceeded(address borrower) {\r\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\r\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\r\n\r\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\r\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\r\n _;\r\n } else {\r\n _;\r\n }\r\n }\r\n\r\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\r\n uint8 fnsCount = 13;\r\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\r\n functionSelectors[--fnsCount] = this.mint.selector;\r\n functionSelectors[--fnsCount] = this.redeem.selector;\r\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\r\n functionSelectors[--fnsCount] = this.borrow.selector;\r\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\r\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\r\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\r\n functionSelectors[--fnsCount] = this.getCash.selector;\r\n functionSelectors[--fnsCount] = this.seize.selector;\r\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\r\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\r\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\r\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return functionSelectors;\r\n }\r\n\r\n /*** User Interface ***/\r\n\r\n /**\r\n * @notice Sender supplies assets into the market and receives cTokens in exchange\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param mintAmount The amount of the underlying asset to supply\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n (uint256 err, ) = mintInternal(mintAmount);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for the underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemTokens The number of cTokens to redeem into underlying\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n return redeemInternal(redeemTokens);\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemAmount The amount of underlying to redeem\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n return redeemUnderlyingInternal(redeemAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender borrows assets from the protocol to their own address\r\n * @param borrowAmount The amount of the underlying asset to borrow\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n return borrowInternal(borrowAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender repays their own borrow\r\n * @param repayAmount The amount to repay\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n (uint256 err, ) = repayBorrowInternal(repayAmount);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice Sender repays a borrow belonging to borrower\r\n * @param borrower the account with the debt being payed off\r\n * @param repayAmount The amount to repay\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\r\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice The sender liquidates the borrowers collateral.\r\n * The collateral seized is transferred to the liquidator.\r\n * @param borrower The borrower of this cToken to be liquidated\r\n * @param repayAmount The amount of the underlying borrowed asset to repay\r\n * @param cTokenCollateral The market in which to seize collateral from the borrower\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function liquidateBorrow(\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\r\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\r\n return err;\r\n }\r\n\r\n /**\r\n * @notice Get cash balance of this cToken in the underlying asset\r\n * @return The quantity of underlying asset owned by this contract\r\n */\r\n function getCash() external view override returns (uint256) {\r\n return getCashInternal();\r\n }\r\n\r\n /**\r\n * @notice Transfers collateral tokens (this market) to the liquidator.\r\n * @dev Will fail unless called by another cToken during the process of liquidation.\r\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\r\n * @param liquidator The account receiving seized collateral\r\n * @param borrower The account having collateral seized\r\n * @param seizeTokens The number of cTokens to seize\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function seize(\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\r\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\r\n }\r\n\r\n function selfTransferOut(address to, uint256 amount) external override {\r\n require(msg.sender == address(this), \"!self\");\r\n doTransferOut(to, amount);\r\n }\r\n\r\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\r\n require(msg.sender == address(this), \"!self\");\r\n return doTransferIn(from, amount);\r\n }\r\n\r\n /**\r\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\r\n * @param withdrawAmount Amount of fees to withdraw\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\r\n }\r\n\r\n if (getCashInternal() < withdrawAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\r\n }\r\n\r\n if (withdrawAmount > totalIonicFees) {\r\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\r\n totalIonicFees = totalIonicFeesNew;\r\n\r\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n doTransferOut(address(ionicAdmin), withdrawAmount);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Accrues interest and reduces admin fees by transferring to admin\r\n * @param withdrawAmount Amount of fees to withdraw\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\r\n }\r\n\r\n // Fail gracefully if protocol has insufficient underlying cash\r\n if (getCashInternal() < withdrawAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\r\n }\r\n\r\n if (withdrawAmount > totalAdminFees) {\r\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n totalAdminFees = totalAdminFees - withdrawAmount;\r\n\r\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /*** Safe Token ***/\r\n\r\n /**\r\n * @notice Gets balance of this contract in terms of the underlying\r\n * @dev This excludes the value of the current message, if any\r\n * @return The quantity of underlying tokens owned by this contract\r\n */\r\n function getCashInternal() internal view virtual returns (uint256) {\r\n return EIP20Interface(underlying).balanceOf(address(this));\r\n }\r\n\r\n /**\r\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\r\n * This will revert due to insufficient balance or insufficient allowance.\r\n * This function returns the actual amount received,\r\n * which may be less than `amount` if there is a fee attached to the transfer.\r\n *\r\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\r\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\r\n */\r\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\r\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\r\n _callOptionalReturn(\r\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\r\n \"TOKEN_TRANSFER_IN_FAILED\"\r\n );\r\n\r\n // Calculate the amount that was *actually* transferred\r\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\r\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\r\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\r\n }\r\n\r\n /**\r\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\r\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\r\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\r\n * it is >= amount, this should not revert in normal conditions.\r\n *\r\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\r\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\r\n */\r\n function doTransferOut(address to, uint256 amount) internal virtual {\r\n _callOptionalReturn(\r\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\r\n \"TOKEN_TRANSFER_OUT_FAILED\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n * @param errorMessage The revert string to return on failure.\r\n */\r\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\r\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\r\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\r\n }\r\n\r\n /**\r\n * @notice Sender supplies assets into the market and receives cTokens in exchange\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param mintAmount The amount of the underlying asset to supply\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\r\n */\r\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\r\n return mintFresh(msg.sender, mintAmount);\r\n }\r\n\r\n struct MintLocalVars {\r\n Error err;\r\n MathError mathErr;\r\n uint256 exchangeRateMantissa;\r\n uint256 mintTokens;\r\n uint256 totalSupplyNew;\r\n uint256 accountTokensNew;\r\n uint256 actualMintAmount;\r\n }\r\n\r\n /**\r\n * @notice User supplies assets into the market and receives cTokens in exchange\r\n * @dev Assumes interest has already been accrued up to the current block\r\n * @param minter The address of the account which is supplying the assets\r\n * @param mintAmount The amount of the underlying asset to supply\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\r\n */\r\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\r\n /* Fail if mint not allowed */\r\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n MintLocalVars memory vars;\r\n\r\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\r\n\r\n // Check max supply\r\n // unused function\r\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\r\n } */\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /*\r\n * We call `doTransferIn` for the minter and the mintAmount.\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\r\n * side-effects occurred. The function returns the amount actually transferred,\r\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\r\n * of cash.\r\n */\r\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\r\n\r\n /*\r\n * We get the current exchange rate and calculate the number of cTokens to be minted:\r\n * mintTokens = actualMintAmount / exchangeRate\r\n */\r\n\r\n // mintTokens is rounded down here - correct\r\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\r\n vars.actualMintAmount,\r\n Exp({ mantissa: vars.exchangeRateMantissa })\r\n );\r\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\r\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\r\n\r\n /*\r\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\r\n * totalSupplyNew = totalSupply + mintTokens\r\n * accountTokensNew = accountTokens[minter] + mintTokens\r\n */\r\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\r\n\r\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\r\n\r\n /* We write previously calculated values into storage */\r\n totalSupply = vars.totalSupplyNew;\r\n accountTokens[minter] = vars.accountTokensNew;\r\n\r\n /* We emit a Mint event, and a Transfer event */\r\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\r\n emit Transfer(address(this), minter, vars.mintTokens);\r\n\r\n /* We call the defense hook */\r\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\r\n\r\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for the underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemTokens The number of cTokens to redeem into underlying\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\r\n return redeemFresh(msg.sender, redeemTokens, 0);\r\n }\r\n\r\n /**\r\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\r\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\r\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\r\n return redeemFresh(msg.sender, 0, redeemAmount);\r\n }\r\n\r\n struct RedeemLocalVars {\r\n Error err;\r\n MathError mathErr;\r\n uint256 exchangeRateMantissa;\r\n uint256 redeemTokens;\r\n uint256 redeemAmount;\r\n uint256 totalSupplyNew;\r\n uint256 accountTokensNew;\r\n }\r\n\r\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\r\n res = (x * 1e18) / y;\r\n if (x % y != 0) res += 1;\r\n }\r\n\r\n /**\r\n * @notice User redeems cTokens in exchange for the underlying asset\r\n * @dev Assumes interest has already been accrued up to the current block\r\n * @param redeemer The address of the account which is redeeming the tokens\r\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\r\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function redeemFresh(\r\n address redeemer,\r\n uint256 redeemTokensIn,\r\n uint256 redeemAmountIn\r\n ) internal returns (uint256) {\r\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\r\n\r\n RedeemLocalVars memory vars;\r\n\r\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\r\n\r\n if (redeemTokensIn > 0) {\r\n // don't allow dust tokens/assets to be left after\r\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\r\n\r\n /*\r\n * We calculate the exchange rate and the amount of underlying to be redeemed:\r\n * redeemTokens = redeemTokensIn\r\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\r\n */\r\n vars.redeemTokens = redeemTokensIn;\r\n\r\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\r\n Exp({ mantissa: vars.exchangeRateMantissa }),\r\n redeemTokensIn\r\n );\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n } else {\r\n if (redeemAmountIn == type(uint256).max) {\r\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\r\n }\r\n\r\n // don't allow dust tokens/assets to be left after\r\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\r\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\r\n\r\n /*\r\n * We get the current exchange rate and calculate the amount to be redeemed:\r\n * redeemTokens = redeemAmountIn / exchangeRate\r\n * redeemAmount = redeemAmountIn\r\n */\r\n\r\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\r\n\r\n // don't allow dust tokens/assets to be left after\r\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\r\n\r\n vars.redeemAmount = redeemAmountIn;\r\n }\r\n\r\n /* Fail if redeem not allowed */\r\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\r\n }\r\n\r\n /*\r\n * We calculate the new total supply and redeemer balance, checking for underflow:\r\n * totalSupplyNew = totalSupply - redeemTokens\r\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\r\n */\r\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n /* Fail gracefully if protocol has insufficient cash */\r\n if (getCashInternal() < vars.redeemAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We write previously calculated values into storage */\r\n totalSupply = vars.totalSupplyNew;\r\n accountTokens[redeemer] = vars.accountTokensNew;\r\n\r\n /*\r\n * We invoke doTransferOut for the redeemer and the redeemAmount.\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * On success, the cToken has redeemAmount less of cash.\r\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n */\r\n doTransferOut(redeemer, vars.redeemAmount);\r\n\r\n /* We emit a Transfer event, and a Redeem event */\r\n emit Transfer(redeemer, address(this), vars.redeemTokens);\r\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\r\n\r\n /* We call the defense hook */\r\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sender borrows assets from the protocol to their own address\r\n * @param borrowAmount The amount of the underlying asset to borrow\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\r\n return borrowFresh(msg.sender, borrowAmount);\r\n }\r\n\r\n struct BorrowLocalVars {\r\n MathError mathErr;\r\n uint256 accountBorrows;\r\n uint256 accountBorrowsNew;\r\n uint256 totalBorrowsNew;\r\n }\r\n\r\n /**\r\n * @notice Users borrow assets from the protocol to their own address\r\n * @param borrowAmount The amount of the underlying asset to borrow\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\r\n /* Fail if borrow not allowed */\r\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\r\n }\r\n\r\n /* Fail gracefully if protocol has insufficient underlying cash */\r\n uint256 cashPrior = getCashInternal();\r\n\r\n if (cashPrior < borrowAmount) {\r\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\r\n }\r\n\r\n BorrowLocalVars memory vars;\r\n\r\n /*\r\n * We calculate the new borrower and total borrow balances, failing on overflow:\r\n * accountBorrowsNew = accountBorrows + borrowAmount\r\n * totalBorrowsNew = totalBorrows + borrowAmount\r\n */\r\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\r\n\r\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(\r\n Error.MATH_ERROR,\r\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\r\n uint256(vars.mathErr)\r\n );\r\n }\r\n\r\n // Check min borrow for this user for this asset\r\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return\r\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We write the previously calculated values into storage */\r\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\r\n accountBorrows[borrower].interestIndex = borrowIndex;\r\n totalBorrows = vars.totalBorrowsNew;\r\n\r\n /*\r\n * We invoke doTransferOut for the borrower and the borrowAmount.\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * On success, the cToken borrowAmount less of cash.\r\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n */\r\n doTransferOut(borrower, borrowAmount);\r\n\r\n /* We emit a Borrow event */\r\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\r\n\r\n /* We call the defense hook */\r\n comptroller.borrowVerify(address(this), borrower);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Sender repays their own borrow\r\n * @param repayAmount The amount to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\r\n asCTokenExtension().accrueInterest();\r\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\r\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\r\n }\r\n\r\n /**\r\n * @notice Sender repays a borrow belonging to borrower\r\n * @param borrower the account with the debt being payed off\r\n * @param repayAmount The amount to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\r\n internal\r\n nonReentrant(false)\r\n returns (uint256, uint256)\r\n {\r\n asCTokenExtension().accrueInterest();\r\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\r\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\r\n }\r\n\r\n struct RepayBorrowLocalVars {\r\n Error err;\r\n MathError mathErr;\r\n uint256 repayAmount;\r\n uint256 borrowerIndex;\r\n uint256 accountBorrows;\r\n uint256 accountBorrowsNew;\r\n uint256 totalBorrowsNew;\r\n uint256 actualRepayAmount;\r\n }\r\n\r\n /**\r\n * @notice Borrows are repaid by another user (possibly the borrower).\r\n * @param payer the account paying off the borrow\r\n * @param borrower the account with the debt being payed off\r\n * @param repayAmount the amount of undelrying tokens being returned\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function repayBorrowFresh(\r\n address payer,\r\n address borrower,\r\n uint256 repayAmount\r\n ) internal returns (uint256, uint256) {\r\n /* Fail if repayBorrow not allowed */\r\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n RepayBorrowLocalVars memory vars;\r\n\r\n /* We remember the original borrowerIndex for verification purposes */\r\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\r\n\r\n /* We fetch the amount the borrower owes, with accumulated interest */\r\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\r\n\r\n /* If repayAmount == -1, repayAmount = accountBorrows */\r\n if (repayAmount == type(uint256).max) {\r\n vars.repayAmount = vars.accountBorrows;\r\n } else {\r\n vars.repayAmount = repayAmount;\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /*\r\n * We call doTransferIn for the payer and the repayAmount\r\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\r\n * On success, the cToken holds an additional repayAmount of cash.\r\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\r\n * it returns the amount actually transferred, in case of a fee.\r\n */\r\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\r\n\r\n /*\r\n * We calculate the new borrower and total borrow balances, failing on underflow:\r\n * accountBorrowsNew = accountBorrows - actualRepayAmount\r\n * totalBorrowsNew = totalBorrows - actualRepayAmount\r\n */\r\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\r\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\r\n\r\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\r\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\r\n\r\n /* We write the previously calculated values into storage */\r\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\r\n accountBorrows[borrower].interestIndex = borrowIndex;\r\n totalBorrows = vars.totalBorrowsNew;\r\n\r\n /* We emit a RepayBorrow event */\r\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\r\n\r\n /* We call the defense hook */\r\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\r\n\r\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\r\n }\r\n\r\n /**\r\n * @notice The sender liquidates the borrowers collateral.\r\n * The collateral seized is transferred to the liquidator.\r\n * @param borrower The borrower of this cToken to be liquidated\r\n * @param cTokenCollateral The market in which to seize collateral from the borrower\r\n * @param repayAmount The amount of the underlying borrowed asset to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function liquidateBorrowInternal(\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) internal nonReentrant(false) returns (uint256, uint256) {\r\n asCTokenExtension().accrueInterest();\r\n ICErc20(cTokenCollateral).accrueInterest();\r\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\r\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\r\n }\r\n\r\n /**\r\n * @notice The liquidator liquidates the borrowers collateral.\r\n * The collateral seized is transferred to the liquidator.\r\n * @param borrower The borrower of this cToken to be liquidated\r\n * @param liquidator The address repaying the borrow and seizing collateral\r\n * @param cTokenCollateral The market in which to seize collateral from the borrower\r\n * @param repayAmount The amount of the underlying borrowed asset to repay\r\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\r\n */\r\n function liquidateBorrowFresh(\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral\r\n ) internal returns (uint256, uint256) {\r\n /* Fail if liquidate not allowed */\r\n uint256 allowed = comptroller.liquidateBorrowAllowed(\r\n address(this),\r\n cTokenCollateral,\r\n liquidator,\r\n borrower,\r\n repayAmount\r\n );\r\n if (allowed != 0) {\r\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\r\n }\r\n\r\n /* Verify market's block number equals current block number */\r\n if (accrualBlockNumber != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n /* Verify cTokenCollateral market's block number equals current block number */\r\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\r\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\r\n }\r\n\r\n /* Fail if borrower = liquidator */\r\n if (borrower == liquidator) {\r\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\r\n }\r\n\r\n /* Fail if repayAmount = 0 */\r\n if (repayAmount == 0) {\r\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\r\n }\r\n\r\n /* Fail if repayAmount = -1 */\r\n if (repayAmount == type(uint256).max) {\r\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\r\n }\r\n\r\n /* Fail if repayBorrow fails */\r\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\r\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\r\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We calculate the number of collateral tokens that will be seized */\r\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\r\n address(this),\r\n cTokenCollateral,\r\n actualRepayAmount\r\n );\r\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\r\n\r\n /* Revert if borrower collateral token balance < seizeTokens */\r\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\r\n\r\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\r\n uint256 seizeError;\r\n if (cTokenCollateral == address(this)) {\r\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\r\n } else {\r\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\r\n }\r\n\r\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\r\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\r\n\r\n /* We emit a LiquidateBorrow event */\r\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\r\n\r\n /* We call the defense hook */\r\n // unused function\r\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\r\n\r\n return (uint256(Error.NO_ERROR), actualRepayAmount);\r\n }\r\n\r\n struct SeizeInternalLocalVars {\r\n MathError mathErr;\r\n uint256 borrowerTokensNew;\r\n uint256 liquidatorTokensNew;\r\n uint256 liquidatorSeizeTokens;\r\n uint256 protocolSeizeTokens;\r\n uint256 protocolSeizeAmount;\r\n uint256 exchangeRateMantissa;\r\n uint256 totalReservesNew;\r\n uint256 totalIonicFeeNew;\r\n uint256 totalSupplyNew;\r\n uint256 feeSeizeTokens;\r\n uint256 feeSeizeAmount;\r\n }\r\n\r\n /**\r\n * @notice Transfers collateral tokens (this market) to the liquidator.\r\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\r\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\r\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\r\n * @param liquidator The account receiving seized collateral\r\n * @param borrower The account having collateral seized\r\n * @param seizeTokens The number of cTokens to seize\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function seizeInternal(\r\n address seizerToken,\r\n address liquidator,\r\n address borrower,\r\n uint256 seizeTokens\r\n ) internal returns (uint256) {\r\n /* Fail if seize not allowed */\r\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\r\n if (allowed != 0) {\r\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\r\n }\r\n\r\n /* Fail if borrower = liquidator */\r\n if (borrower == liquidator) {\r\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\r\n }\r\n\r\n SeizeInternalLocalVars memory vars;\r\n\r\n /*\r\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\r\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\r\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\r\n */\r\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\r\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\r\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\r\n\r\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\r\n\r\n vars.protocolSeizeAmount = mul_ScalarTruncate(\r\n Exp({ mantissa: vars.exchangeRateMantissa }),\r\n vars.protocolSeizeTokens\r\n );\r\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\r\n\r\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\r\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\r\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\r\n\r\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\r\n if (vars.mathErr != MathError.NO_ERROR) {\r\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\r\n }\r\n\r\n /////////////////////////\r\n // EFFECTS & INTERACTIONS\r\n // (No safe failures beyond this point)\r\n\r\n /* We write the previously calculated values into storage */\r\n totalReserves = vars.totalReservesNew;\r\n totalSupply = vars.totalSupplyNew;\r\n totalIonicFees = vars.totalIonicFeeNew;\r\n\r\n accountTokens[borrower] = vars.borrowerTokensNew;\r\n accountTokens[liquidator] = vars.liquidatorTokensNew;\r\n\r\n /* Emit a Transfer event */\r\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\r\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\r\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\r\n\r\n /* We call the defense hook */\r\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function asCTokenExtension() internal view returns (ICErc20) {\r\n return ICErc20(address(this));\r\n }\r\n\r\n /*** Reentrancy Guard ***/\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n */\r\n modifier nonReentrant(bool localOnly) {\r\n _beforeNonReentrant(localOnly);\r\n _;\r\n _afterNonReentrant(localOnly);\r\n }\r\n\r\n /**\r\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\r\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\r\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\r\n */\r\n function _beforeNonReentrant(bool localOnly) private {\r\n require(_notEntered, \"re-entered\");\r\n if (!localOnly) comptroller._beforeNonReentrant();\r\n _notEntered = false;\r\n }\r\n\r\n /**\r\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\r\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\r\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\r\n */\r\n function _afterNonReentrant(bool localOnly) private {\r\n _notEntered = true; // get a gas-refund post-Istanbul\r\n if (!localOnly) comptroller._afterNonReentrant();\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n * @param errorMessage The revert string to return on failure.\r\n */\r\n function _functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.call(data);\r\n\r\n if (!success) {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n\r\n return returndata;\r\n }\r\n}\r\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\r\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\r\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\r\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\r\n\r\nabstract contract CTokenAdminStorage {\r\n /*\r\n * Administrator for Ionic\r\n */\r\n address payable public ionicAdmin;\r\n}\r\n\r\nabstract contract CErc20Storage is CTokenAdminStorage {\r\n /**\r\n * @dev Guard variable for re-entrancy checks\r\n */\r\n bool internal _notEntered;\r\n\r\n /**\r\n * @notice EIP-20 token name for this token\r\n */\r\n string public name;\r\n\r\n /**\r\n * @notice EIP-20 token symbol for this token\r\n */\r\n string public symbol;\r\n\r\n /**\r\n * @notice EIP-20 token decimals for this token\r\n */\r\n uint8 public decimals;\r\n\r\n /*\r\n * Maximum borrow rate that can ever be applied (.0005% / block)\r\n */\r\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\r\n\r\n /*\r\n * Maximum fraction of interest that can be set aside for reserves + fees\r\n */\r\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\r\n\r\n /**\r\n * @notice Contract which oversees inter-cToken operations\r\n */\r\n IonicComptroller public comptroller;\r\n\r\n /**\r\n * @notice Model which tells what the current interest rate should be\r\n */\r\n InterestRateModel public interestRateModel;\r\n\r\n /*\r\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\r\n */\r\n uint256 internal initialExchangeRateMantissa;\r\n\r\n /**\r\n * @notice Fraction of interest currently set aside for admin fees\r\n */\r\n uint256 public adminFeeMantissa;\r\n\r\n /**\r\n * @notice Fraction of interest currently set aside for Ionic fees\r\n */\r\n uint256 public ionicFeeMantissa;\r\n\r\n /**\r\n * @notice Fraction of interest currently set aside for reserves\r\n */\r\n uint256 public reserveFactorMantissa;\r\n\r\n /**\r\n * @notice Block number that interest was last accrued at\r\n */\r\n uint256 public accrualBlockNumber;\r\n\r\n /**\r\n * @notice Accumulator of the total earned interest rate since the opening of the market\r\n */\r\n uint256 public borrowIndex;\r\n\r\n /**\r\n * @notice Total amount of outstanding borrows of the underlying in this market\r\n */\r\n uint256 public totalBorrows;\r\n\r\n /**\r\n * @notice Total amount of reserves of the underlying held in this market\r\n */\r\n uint256 public totalReserves;\r\n\r\n /**\r\n * @notice Total amount of admin fees of the underlying held in this market\r\n */\r\n uint256 public totalAdminFees;\r\n\r\n /**\r\n * @notice Total amount of Ionic fees of the underlying held in this market\r\n */\r\n uint256 public totalIonicFees;\r\n\r\n /**\r\n * @notice Total number of tokens in circulation\r\n */\r\n uint256 public totalSupply;\r\n\r\n /*\r\n * Official record of token balances for each account\r\n */\r\n mapping(address => uint256) internal accountTokens;\r\n\r\n /*\r\n * Approved token transfer amounts on behalf of others\r\n */\r\n mapping(address => mapping(address => uint256)) internal transferAllowances;\r\n\r\n /**\r\n * @notice Container for borrow balance information\r\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\r\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\r\n */\r\n struct BorrowSnapshot {\r\n uint256 principal;\r\n uint256 interestIndex;\r\n }\r\n\r\n /*\r\n * Mapping of account addresses to outstanding borrow balances\r\n */\r\n mapping(address => BorrowSnapshot) internal accountBorrows;\r\n\r\n /*\r\n * Share of seized collateral that is added to reserves\r\n */\r\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\r\n\r\n /*\r\n * Share of seized collateral taken as fees\r\n */\r\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\r\n\r\n /**\r\n * @notice Underlying asset for this CToken\r\n */\r\n address public underlying;\r\n\r\n /**\r\n * @notice Addresses Provider\r\n */\r\n AddressesProvider public ap;\r\n}\r\n\r\nabstract contract CTokenBaseEvents {\r\n /* ERC20 */\r\n\r\n /**\r\n * @notice EIP20 Transfer event\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n\r\n /*** Admin Events ***/\r\n\r\n /**\r\n * @notice Event emitted when interestRateModel is changed\r\n */\r\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\r\n\r\n /**\r\n * @notice Event emitted when the reserve factor is changed\r\n */\r\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\r\n\r\n /**\r\n * @notice Event emitted when the admin fee is changed\r\n */\r\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\r\n\r\n /**\r\n * @notice Event emitted when the Ionic fee is changed\r\n */\r\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\r\n\r\n /**\r\n * @notice EIP20 Approval event\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n\r\n /**\r\n * @notice Event emitted when interest is accrued\r\n */\r\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\r\n}\r\n\r\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\r\n event Flash(address receiver, uint256 amount);\r\n}\r\n\r\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\r\n /*** Market Events ***/\r\n\r\n /**\r\n * @notice Event emitted when tokens are minted\r\n */\r\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\r\n\r\n /**\r\n * @notice Event emitted when tokens are redeemed\r\n */\r\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\r\n\r\n /**\r\n * @notice Event emitted when underlying is borrowed\r\n */\r\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\r\n\r\n /**\r\n * @notice Event emitted when a borrow is repaid\r\n */\r\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\r\n\r\n /**\r\n * @notice Event emitted when a borrow is liquidated\r\n */\r\n event LiquidateBorrow(\r\n address liquidator,\r\n address borrower,\r\n uint256 repayAmount,\r\n address cTokenCollateral,\r\n uint256 seizeTokens\r\n );\r\n\r\n /**\r\n * @notice Event emitted when the reserves are added\r\n */\r\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\r\n\r\n /**\r\n * @notice Event emitted when the reserves are reduced\r\n */\r\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\r\n}\r\n\r\ninterface CTokenFirstExtensionInterface {\r\n /*** User Interface ***/\r\n\r\n function transfer(address dst, uint256 amount) external returns (bool);\r\n\r\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\r\n\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n function balanceOf(address owner) external view returns (uint256);\r\n\r\n /*** Admin Functions ***/\r\n\r\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\r\n\r\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\r\n\r\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\r\n\r\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\r\n\r\n function borrowRatePerBlock() external view returns (uint256);\r\n\r\n function supplyRatePerBlock() external view returns (uint256);\r\n\r\n function exchangeRateCurrent() external view returns (uint256);\r\n\r\n function accrueInterest() external returns (uint256);\r\n\r\n function totalBorrowsCurrent() external view returns (uint256);\r\n\r\n function borrowBalanceCurrent(address account) external view returns (uint256);\r\n\r\n function getTotalUnderlyingSupplied() external view returns (uint256);\r\n\r\n function balanceOfUnderlying(address owner) external view returns (uint256);\r\n\r\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\r\n\r\n function flash(uint256 amount, bytes calldata data) external;\r\n\r\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\r\n\r\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\r\n\r\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\r\n\r\n function registerInSFS() external returns (uint256);\r\n}\r\n\r\ninterface CTokenSecondExtensionInterface {\r\n function mint(uint256 mintAmount) external returns (uint256);\r\n\r\n function redeem(uint256 redeemTokens) external returns (uint256);\r\n\r\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\r\n\r\n function borrow(uint256 borrowAmount) external returns (uint256);\r\n\r\n function repayBorrow(uint256 repayAmount) external returns (uint256);\r\n\r\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\r\n\r\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\r\n\r\n function getCash() external view returns (uint256);\r\n\r\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\r\n\r\n /*** Admin Functions ***/\r\n\r\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\r\n\r\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\r\n\r\n function selfTransferOut(address to, uint256 amount) external;\r\n\r\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\r\n}\r\n\r\ninterface CDelegatorInterface {\r\n function implementation() external view returns (address);\r\n\r\n /**\r\n * @notice Called by the admin to update the implementation of the delegator\r\n * @param implementation_ The address of the new implementation for delegation\r\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\r\n */\r\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\r\n\r\n /**\r\n * @dev upgrades the implementation if necessary\r\n */\r\n function _upgrade() external;\r\n}\r\n\r\ninterface CDelegateInterface {\r\n /**\r\n * @notice Called by the delegator on a delegate to initialize it for duty\r\n * @dev Should revert if any issues arise which make it unfit for delegation\r\n * @param data The encoded bytes data for any initialization\r\n */\r\n function _becomeImplementation(bytes calldata data) external;\r\n\r\n function delegateType() external pure returns (uint8);\r\n\r\n function contractType() external pure returns (string memory);\r\n}\r\n\r\nabstract contract CErc20AdminBase is CErc20Storage {\r\n /**\r\n * @notice Returns a boolean indicating if the sender has admin rights\r\n */\r\n function hasAdminRights() internal view returns (bool) {\r\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\r\n return\r\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\r\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\r\n }\r\n}\r\n\r\nabstract contract CErc20FirstExtensionBase is\r\n CErc20AdminBase,\r\n CTokenFirstExtensionEvents,\r\n CTokenFirstExtensionInterface\r\n{}\r\n\r\nabstract contract CTokenSecondExtensionBase is\r\n CErc20AdminBase,\r\n CTokenSecondExtensionEvents,\r\n CTokenSecondExtensionInterface,\r\n CDelegateInterface\r\n{}\r\n\r\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\r\n\r\ninterface CErc20StorageInterface {\r\n function admin() external view returns (address);\r\n\r\n function adminHasRights() external view returns (bool);\r\n\r\n function ionicAdmin() external view returns (address);\r\n\r\n function ionicAdminHasRights() external view returns (bool);\r\n\r\n function comptroller() external view returns (IonicComptroller);\r\n\r\n function name() external view returns (string memory);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function decimals() external view returns (uint8);\r\n\r\n function totalSupply() external view returns (uint256);\r\n\r\n function adminFeeMantissa() external view returns (uint256);\r\n\r\n function ionicFeeMantissa() external view returns (uint256);\r\n\r\n function reserveFactorMantissa() external view returns (uint256);\r\n\r\n function protocolSeizeShareMantissa() external view returns (uint256);\r\n\r\n function feeSeizeShareMantissa() external view returns (uint256);\r\n\r\n function totalReserves() external view returns (uint256);\r\n\r\n function totalAdminFees() external view returns (uint256);\r\n\r\n function totalIonicFees() external view returns (uint256);\r\n\r\n function totalBorrows() external view returns (uint256);\r\n\r\n function accrualBlockNumber() external view returns (uint256);\r\n\r\n function underlying() external view returns (address);\r\n\r\n function borrowIndex() external view returns (uint256);\r\n\r\n function interestRateModel() external view returns (address);\r\n}\r\n\r\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\r\n function plugin() external view returns (address);\r\n}\r\n\r\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\r\n function approve(address, address) external;\r\n}\r\n\r\ninterface ICErc20 is\r\n CErc20StorageInterface,\r\n CTokenSecondExtensionInterface,\r\n CTokenFirstExtensionInterface,\r\n CDelegatorInterface,\r\n CDelegateInterface\r\n{}\r\n\r\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\r\n function _updatePlugin(address _plugin) external;\r\n}\r\n\r\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\r\n" + }, + "contracts/compound/CTokenMinter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CToken.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\n\r\ncontract CTokenMinter is Initializable, OwnableUpgradeable {\r\n ICErc20 public collateralMarket;\r\n uint256 public startTime;\r\n uint256 public endTime;\r\n\r\n modifier onlyDuringMintWindow() {\r\n require(block.timestamp >= startTime && block.timestamp <= endTime, \"Minting not allowed at this time\");\r\n _;\r\n }\r\n\r\n function initialize(address _cTokenAddress, uint256 _startTime, uint256 _endTime) public initializer {\r\n require(_startTime < _endTime, \"Invalid time window\");\r\n __Ownable_init();\r\n collateralMarket = ICErc20(_cTokenAddress);\r\n startTime = _startTime;\r\n endTime = _endTime;\r\n }\r\n\r\n function mint(uint256 mintAmount) external onlyDuringMintWindow {\r\n // MINT LOGIC\r\n }\r\n\r\n function setMintWindow(uint256 _newStartTime, uint256 _newEndTime) external onlyOwner {\r\n require(_newStartTime < _newEndTime, \"Invalid time window\");\r\n startTime = _newStartTime;\r\n endTime = _newEndTime;\r\n }\r\n}\r\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.22;\r\n\r\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\r\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\r\n\r\ncontract CTokenOracleProtected is CErc20Storage {\r\n error InteractionNotAllowed();\r\n error CallerIsNotEOA();\r\n\r\n modifier onlyOracleApproved() {\r\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\r\n\r\n if (oracleAddress == address(0)) {\r\n _;\r\n return;\r\n }\r\n\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\r\n _;\r\n }\r\n\r\n modifier onlyOracleApprovedAllowEOA() {\r\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\r\n\r\n if (oracleAddress == address(0)) {\r\n _;\r\n return;\r\n }\r\n\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n oracle.validateBlacklistedAccountInteraction(msg.sender);\r\n if (tx.origin == msg.sender) {\r\n _;\r\n return;\r\n }\r\n\r\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\r\n _;\r\n }\r\n\r\n modifier onlyNotBlacklistedEOA() {\r\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\r\n\r\n if (oracleAddress == address(0)) {\r\n _;\r\n return;\r\n }\r\n\r\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\r\n if (msg.sender != tx.origin) {\r\n revert CallerIsNotEOA();\r\n }\r\n oracle.validateBlacklistedAccountInteraction(msg.sender);\r\n _;\r\n }\r\n}\r\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title ERC 20 Token Standard Interface\r\n * https://eips.ethereum.org/EIPS/eip-20\r\n */\r\ninterface EIP20Interface {\r\n function name() external view returns (string memory);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function decimals() external view returns (uint8);\r\n\r\n /**\r\n * @notice Get the total number of tokens in circulation\r\n * @return uint256 The supply of tokens\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @notice Gets the balance of the specified address\r\n * @param owner The address from which the balance will be retrieved\r\n * @return balance uint256 The balance\r\n */\r\n function balanceOf(address owner) external view returns (uint256 balance);\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n * @return success bool Whether or not the transfer succeeded\r\n */\r\n function transfer(address dst, uint256 amount) external returns (bool success);\r\n\r\n /**\r\n * @notice Transfer `amount` tokens from `src` to `dst`\r\n * @param src The address of the source account\r\n * @param dst The address of the destination account\r\n * @param amount The number of tokens to transfer\r\n * @return success bool Whether or not the transfer succeeded\r\n */\r\n function transferFrom(\r\n address src,\r\n address dst,\r\n uint256 amount\r\n ) external returns (bool success);\r\n\r\n /**\r\n * @notice Approve `spender` to transfer up to `amount` from `src`\r\n * @dev This will overwrite the approval amount for `spender`\r\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\r\n * @param spender The address of the account which may transfer tokens\r\n * @param amount The number of tokens that are approved (-1 means infinite)\r\n * @return success bool Whether or not the approval succeeded\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool success);\r\n\r\n /**\r\n * @notice Get the current allowance from `owner` for `spender`\r\n * @param owner The address of the account which owns the tokens to be spent\r\n * @param spender The address of the account which may transfer tokens\r\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256 remaining);\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n}\r\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\ncontract ComptrollerErrorReporter {\r\n enum Error {\r\n NO_ERROR,\r\n UNAUTHORIZED,\r\n COMPTROLLER_MISMATCH,\r\n INSUFFICIENT_SHORTFALL,\r\n INSUFFICIENT_LIQUIDITY,\r\n INVALID_CLOSE_FACTOR,\r\n INVALID_COLLATERAL_FACTOR,\r\n INVALID_LIQUIDATION_INCENTIVE,\r\n MARKET_NOT_LISTED,\r\n MARKET_ALREADY_LISTED,\r\n MATH_ERROR,\r\n NONZERO_BORROW_BALANCE,\r\n PRICE_ERROR,\r\n REJECTION,\r\n SNAPSHOT_ERROR,\r\n TOO_MANY_ASSETS,\r\n TOO_MUCH_REPAY,\r\n SUPPLIER_NOT_WHITELISTED,\r\n BORROW_BELOW_MIN,\r\n SUPPLY_ABOVE_MAX,\r\n NONZERO_TOTAL_SUPPLY\r\n }\r\n\r\n enum FailureInfo {\r\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\r\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\r\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\r\n EXIT_MARKET_BALANCE_OWED,\r\n EXIT_MARKET_REJECTION,\r\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\r\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\r\n SET_CLOSE_FACTOR_OWNER_CHECK,\r\n SET_CLOSE_FACTOR_VALIDATION,\r\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\r\n SET_COLLATERAL_FACTOR_NO_EXISTS,\r\n SET_COLLATERAL_FACTOR_VALIDATION,\r\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\r\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\r\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\r\n SET_PENDING_ADMIN_OWNER_CHECK,\r\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\r\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\r\n SET_PRICE_ORACLE_OWNER_CHECK,\r\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\r\n SET_WHITELIST_STATUS_OWNER_CHECK,\r\n SUPPORT_MARKET_EXISTS,\r\n SUPPORT_MARKET_OWNER_CHECK,\r\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\r\n UNSUPPORT_MARKET_OWNER_CHECK,\r\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\r\n UNSUPPORT_MARKET_IN_USE\r\n }\r\n\r\n /**\r\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\r\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\r\n **/\r\n event Failure(uint256 error, uint256 info, uint256 detail);\r\n\r\n /**\r\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\r\n */\r\n function fail(Error err, FailureInfo info) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), 0);\r\n\r\n return uint256(err);\r\n }\r\n\r\n /**\r\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\r\n */\r\n function failOpaque(\r\n Error err,\r\n FailureInfo info,\r\n uint256 opaqueError\r\n ) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), opaqueError);\r\n\r\n return uint256(err);\r\n }\r\n}\r\n\r\ncontract TokenErrorReporter {\r\n enum Error {\r\n NO_ERROR,\r\n UNAUTHORIZED,\r\n BAD_INPUT,\r\n COMPTROLLER_REJECTION,\r\n COMPTROLLER_CALCULATION_ERROR,\r\n INTEREST_RATE_MODEL_ERROR,\r\n INVALID_ACCOUNT_PAIR,\r\n INVALID_CLOSE_AMOUNT_REQUESTED,\r\n INVALID_COLLATERAL_FACTOR,\r\n MATH_ERROR,\r\n MARKET_NOT_FRESH,\r\n MARKET_NOT_LISTED,\r\n TOKEN_INSUFFICIENT_ALLOWANCE,\r\n TOKEN_INSUFFICIENT_BALANCE,\r\n TOKEN_INSUFFICIENT_CASH,\r\n TOKEN_TRANSFER_IN_FAILED,\r\n TOKEN_TRANSFER_OUT_FAILED,\r\n UTILIZATION_ABOVE_MAX\r\n }\r\n\r\n /*\r\n * Note: FailureInfo (but not Error) is kept in alphabetical order\r\n * This is because FailureInfo grows significantly faster, and\r\n * the order of Error has some meaning, while the order of FailureInfo\r\n * is entirely arbitrary.\r\n */\r\n enum FailureInfo {\r\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\r\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\r\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\r\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\r\n BORROW_ACCRUE_INTEREST_FAILED,\r\n BORROW_CASH_NOT_AVAILABLE,\r\n BORROW_FRESHNESS_CHECK,\r\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\r\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\r\n BORROW_MARKET_NOT_LISTED,\r\n BORROW_COMPTROLLER_REJECTION,\r\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\r\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\r\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\r\n LIQUIDATE_COMPTROLLER_REJECTION,\r\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\r\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\r\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\r\n LIQUIDATE_FRESHNESS_CHECK,\r\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\r\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\r\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\r\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\r\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\r\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\r\n LIQUIDATE_SEIZE_TOO_MUCH,\r\n MINT_ACCRUE_INTEREST_FAILED,\r\n MINT_COMPTROLLER_REJECTION,\r\n MINT_EXCHANGE_CALCULATION_FAILED,\r\n MINT_EXCHANGE_RATE_READ_FAILED,\r\n MINT_FRESHNESS_CHECK,\r\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\r\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\r\n MINT_TRANSFER_IN_FAILED,\r\n MINT_TRANSFER_IN_NOT_POSSIBLE,\r\n NEW_UTILIZATION_RATE_ABOVE_MAX,\r\n REDEEM_ACCRUE_INTEREST_FAILED,\r\n REDEEM_COMPTROLLER_REJECTION,\r\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\r\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\r\n REDEEM_EXCHANGE_RATE_READ_FAILED,\r\n REDEEM_FRESHNESS_CHECK,\r\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\r\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\r\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\r\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\r\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\r\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\r\n WITHDRAW_IONIC_FEES_VALIDATION,\r\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\r\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\r\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\r\n WITHDRAW_ADMIN_FEES_VALIDATION,\r\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\r\n REDUCE_RESERVES_ADMIN_CHECK,\r\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\r\n REDUCE_RESERVES_FRESH_CHECK,\r\n REDUCE_RESERVES_VALIDATION,\r\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\r\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\r\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\r\n REPAY_BORROW_COMPTROLLER_REJECTION,\r\n REPAY_BORROW_FRESHNESS_CHECK,\r\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\r\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\r\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\r\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\r\n SET_COLLATERAL_FACTOR_VALIDATION,\r\n SET_COMPTROLLER_OWNER_CHECK,\r\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\r\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\r\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\r\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\r\n SET_PENDING_ADMIN_OWNER_CHECK,\r\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\r\n SET_ADMIN_FEE_ADMIN_CHECK,\r\n SET_ADMIN_FEE_FRESH_CHECK,\r\n SET_ADMIN_FEE_BOUNDS_CHECK,\r\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\r\n SET_IONIC_FEE_FRESH_CHECK,\r\n SET_IONIC_FEE_BOUNDS_CHECK,\r\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\r\n SET_RESERVE_FACTOR_ADMIN_CHECK,\r\n SET_RESERVE_FACTOR_FRESH_CHECK,\r\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\r\n TRANSFER_COMPTROLLER_REJECTION,\r\n TRANSFER_NOT_ALLOWED,\r\n TRANSFER_NOT_ENOUGH,\r\n TRANSFER_TOO_MUCH,\r\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\r\n ADD_RESERVES_FRESH_CHECK,\r\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\r\n }\r\n\r\n /**\r\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\r\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\r\n **/\r\n event Failure(uint256 error, uint256 info, uint256 detail);\r\n\r\n /**\r\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\r\n */\r\n function fail(Error err, FailureInfo info) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), 0);\r\n\r\n return uint256(err);\r\n }\r\n\r\n /**\r\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\r\n */\r\n function failOpaque(\r\n Error err,\r\n FailureInfo info,\r\n uint256 opaqueError\r\n ) internal returns (uint256) {\r\n emit Failure(uint256(err), uint256(info), opaqueError);\r\n\r\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\r\n }\r\n}\r\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./CarefulMath.sol\";\r\nimport \"./ExponentialNoError.sol\";\r\n\r\n/**\r\n * @title Exponential module for storing fixed-precision decimals\r\n * @author Compound\r\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\r\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\r\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\r\n * `Exp({mantissa: 5100000000000000000})`.\r\n */\r\ncontract Exponential is CarefulMath, ExponentialNoError {\r\n /**\r\n * @dev Creates an exponential from numerator and denominator values.\r\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\r\n * or if `denom` is zero.\r\n */\r\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\r\n if (err1 != MathError.NO_ERROR) {\r\n return (err1, Exp({ mantissa: 0 }));\r\n }\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\r\n }\r\n\r\n /**\r\n * @dev Adds two exponentials, returning a new exponential.\r\n */\r\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\r\n\r\n return (error, Exp({ mantissa: result }));\r\n }\r\n\r\n /**\r\n * @dev Subtracts two exponentials, returning a new exponential.\r\n */\r\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\r\n\r\n return (error, Exp({ mantissa: result }));\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, returning a new Exp.\r\n */\r\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\r\n */\r\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\r\n (MathError err, Exp memory product) = mulScalar(a, scalar);\r\n if (err != MathError.NO_ERROR) {\r\n return (err, 0);\r\n }\r\n\r\n return (MathError.NO_ERROR, truncate(product));\r\n }\r\n\r\n /**\r\n * @dev Divide an Exp by a scalar, returning a new Exp.\r\n */\r\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\r\n }\r\n\r\n /**\r\n * @dev Divide a scalar by an Exp, returning a new Exp.\r\n */\r\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\r\n /*\r\n We are doing this as:\r\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\r\n\r\n How it works:\r\n Exp = a / b;\r\n Scalar = s;\r\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\r\n */\r\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n return getExp(numerator, divisor.mantissa);\r\n }\r\n\r\n /**\r\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\r\n */\r\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\r\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\r\n if (err != MathError.NO_ERROR) {\r\n return (err, 0);\r\n }\r\n\r\n return (MathError.NO_ERROR, truncate(fraction));\r\n }\r\n\r\n /**\r\n * @dev Multiplies two exponentials, returning a new exponential.\r\n */\r\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\r\n if (err0 != MathError.NO_ERROR) {\r\n return (err0, Exp({ mantissa: 0 }));\r\n }\r\n\r\n // We add half the scale before dividing so that we get rounding instead of truncation.\r\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\r\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\r\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\r\n if (err1 != MathError.NO_ERROR) {\r\n return (err1, Exp({ mantissa: 0 }));\r\n }\r\n\r\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\r\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\r\n assert(err2 == MathError.NO_ERROR);\r\n\r\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\r\n }\r\n\r\n /**\r\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\r\n */\r\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\r\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\r\n }\r\n\r\n /**\r\n * @dev Multiplies three exponentials, returning a new exponential.\r\n */\r\n function mulExp3(\r\n Exp memory a,\r\n Exp memory b,\r\n Exp memory c\r\n ) internal pure returns (MathError, Exp memory) {\r\n (MathError err, Exp memory ab) = mulExp(a, b);\r\n if (err != MathError.NO_ERROR) {\r\n return (err, ab);\r\n }\r\n return mulExp(ab, c);\r\n }\r\n\r\n /**\r\n * @dev Divides two exponentials, returning a new exponential.\r\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\r\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\r\n */\r\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\r\n return getExp(a.mantissa, b.mantissa);\r\n }\r\n}\r\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Exponential module for storing fixed-precision decimals\r\n * @author Compound\r\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\r\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\r\n * `Exp({mantissa: 5100000000000000000})`.\r\n */\r\ncontract ExponentialNoError {\r\n uint256 constant expScale = 1e18;\r\n uint256 constant doubleScale = 1e36;\r\n uint256 constant halfExpScale = expScale / 2;\r\n uint256 constant mantissaOne = expScale;\r\n\r\n struct Exp {\r\n uint256 mantissa;\r\n }\r\n\r\n struct Double {\r\n uint256 mantissa;\r\n }\r\n\r\n /**\r\n * @dev Truncates the given exp to a whole number value.\r\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\r\n */\r\n function truncate(Exp memory exp) internal pure returns (uint256) {\r\n // Note: We are not using careful math here as we're performing a division that cannot fail\r\n return exp.mantissa / expScale;\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\r\n */\r\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\r\n Exp memory product = mul_(a, scalar);\r\n return truncate(product);\r\n }\r\n\r\n /**\r\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\r\n */\r\n function mul_ScalarTruncateAddUInt(\r\n Exp memory a,\r\n uint256 scalar,\r\n uint256 addend\r\n ) internal pure returns (uint256) {\r\n Exp memory product = mul_(a, scalar);\r\n return add_(truncate(product), addend);\r\n }\r\n\r\n /**\r\n * @dev Checks if first Exp is less than second Exp.\r\n */\r\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\r\n return left.mantissa < right.mantissa;\r\n }\r\n\r\n /**\r\n * @dev Checks if left Exp <= right Exp.\r\n */\r\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\r\n return left.mantissa <= right.mantissa;\r\n }\r\n\r\n /**\r\n * @dev Checks if left Exp > right Exp.\r\n */\r\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\r\n return left.mantissa > right.mantissa;\r\n }\r\n\r\n /**\r\n * @dev returns true if Exp is exactly zero\r\n */\r\n function isZeroExp(Exp memory value) internal pure returns (bool) {\r\n return value.mantissa == 0;\r\n }\r\n\r\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\r\n require(n < 2**224, errorMessage);\r\n return uint224(n);\r\n }\r\n\r\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\r\n require(n < 2**32, errorMessage);\r\n return uint32(n);\r\n }\r\n\r\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return add_(a, b, \"addition overflow\");\r\n }\r\n\r\n function add_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c >= a, errorMessage);\r\n return c;\r\n }\r\n\r\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\r\n }\r\n\r\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub_(a, b, \"subtraction underflow\");\r\n }\r\n\r\n function sub_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b <= a, errorMessage);\r\n return a - b;\r\n }\r\n\r\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\r\n }\r\n\r\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: mul_(a.mantissa, b) });\r\n }\r\n\r\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\r\n return mul_(a, b.mantissa) / expScale;\r\n }\r\n\r\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\r\n }\r\n\r\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\r\n return Double({ mantissa: mul_(a.mantissa, b) });\r\n }\r\n\r\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\r\n return mul_(a, b.mantissa) / doubleScale;\r\n }\r\n\r\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mul_(a, b, \"multiplication overflow\");\r\n }\r\n\r\n function mul_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n if (a == 0 || b == 0) {\r\n return 0;\r\n }\r\n uint256 c = a * b;\r\n require(c / a == b, errorMessage);\r\n return c;\r\n }\r\n\r\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\r\n }\r\n\r\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\r\n return Exp({ mantissa: div_(a.mantissa, b) });\r\n }\r\n\r\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\r\n return div_(mul_(a, expScale), b.mantissa);\r\n }\r\n\r\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\r\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\r\n }\r\n\r\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\r\n return Double({ mantissa: div_(a.mantissa, b) });\r\n }\r\n\r\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\r\n return div_(mul_(a, doubleScale), b.mantissa);\r\n }\r\n\r\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div_(a, b, \"divide by zero\");\r\n }\r\n\r\n function div_(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b > 0, errorMessage);\r\n return a / b;\r\n }\r\n\r\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\r\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\r\n }\r\n}\r\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../ionic/AuthoritiesRegistry.sol\";\r\n\r\ninterface IFeeDistributor {\r\n function minBorrowEth() external view returns (uint256);\r\n\r\n function maxUtilizationRate() external view returns (uint256);\r\n\r\n function interestFeeRate() external view returns (uint256);\r\n\r\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\r\n\r\n function latestCErc20Delegate(uint8 delegateType)\r\n external\r\n view\r\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\r\n\r\n function latestPluginImplementation(address oldImplementation) external view returns (address);\r\n\r\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\r\n\r\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\r\n\r\n function deployCErc20(\r\n uint8 delegateType,\r\n bytes calldata constructorData,\r\n bytes calldata becomeImplData\r\n ) external returns (address);\r\n\r\n function canCall(\r\n address pool,\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) external view returns (bool);\r\n\r\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\r\n\r\n fallback() external payable;\r\n\r\n receive() external payable;\r\n}\r\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @title Compound's InterestRateModel Interface\r\n * @author Compound\r\n */\r\nabstract contract InterestRateModel {\r\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\r\n bool public constant isInterestRateModel = true;\r\n\r\n /**\r\n * @notice Calculates the current borrow interest rate per block\r\n * @param cash The total amount of cash the market has\r\n * @param borrows The total amount of borrows the market has outstanding\r\n * @param reserves The total amount of reserves the market has\r\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\r\n */\r\n function getBorrowRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves\r\n ) public view virtual returns (uint256);\r\n\r\n /**\r\n * @notice Calculates the current supply interest rate per block\r\n * @param cash The total amount of cash the market has\r\n * @param borrows The total amount of borrows the market has outstanding\r\n * @param reserves The total amount of reserves the market has\r\n * @param reserveFactorMantissa The current reserve factor the market has\r\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\r\n */\r\n function getSupplyRate(\r\n uint256 cash,\r\n uint256 borrows,\r\n uint256 reserves,\r\n uint256 reserveFactorMantissa\r\n ) public view virtual returns (uint256);\r\n}\r\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./ErrorReporter.sol\";\r\nimport \"./ComptrollerStorage.sol\";\r\nimport \"./Comptroller.sol\";\r\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\r\n\r\n/**\r\n * @title Unitroller\r\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\r\n * CTokens should reference this contract as their comptroller.\r\n */\r\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\r\n /**\r\n * @notice Event emitted when the admin rights are changed\r\n */\r\n event AdminRightsToggled(bool hasRights);\r\n\r\n /**\r\n * @notice Emitted when pendingAdmin is changed\r\n */\r\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\r\n\r\n /**\r\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\r\n */\r\n event NewAdmin(address oldAdmin, address newAdmin);\r\n\r\n constructor(address payable _ionicAdmin) {\r\n admin = msg.sender;\r\n ionicAdmin = _ionicAdmin;\r\n }\r\n\r\n /*** Admin Functions ***/\r\n\r\n /**\r\n * @notice Toggles admin rights.\r\n * @param hasRights Boolean indicating if the admin is to have rights.\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\r\n }\r\n\r\n // Check that rights have not already been set to the desired value\r\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\r\n\r\n adminHasRights = hasRights;\r\n emit AdminRightsToggled(hasRights);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\r\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\r\n * @param newPendingAdmin New pending admin.\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\r\n if (!hasAdminRights()) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\r\n }\r\n\r\n address oldPendingAdmin = pendingAdmin;\r\n pendingAdmin = newPendingAdmin;\r\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n /**\r\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\r\n * @dev Admin function for pending admin to accept role and update admin\r\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\r\n */\r\n function _acceptAdmin() public returns (uint256) {\r\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\r\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\r\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\r\n }\r\n\r\n // Save current values for inclusion in log\r\n address oldAdmin = admin;\r\n address oldPendingAdmin = pendingAdmin;\r\n\r\n admin = pendingAdmin;\r\n pendingAdmin = address(0);\r\n\r\n emit NewAdmin(oldAdmin, admin);\r\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\r\n\r\n return uint256(Error.NO_ERROR);\r\n }\r\n\r\n function comptrollerImplementation() public view returns (address) {\r\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\r\n }\r\n\r\n /**\r\n * @dev upgrades the implementation if necessary\r\n */\r\n function _upgrade() external {\r\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\r\n\r\n address currentImplementation = comptrollerImplementation();\r\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\r\n currentImplementation\r\n );\r\n\r\n _updateExtensions(latestComptrollerImplementation);\r\n\r\n if (currentImplementation != latestComptrollerImplementation) {\r\n // reinitialize\r\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\r\n }\r\n }\r\n\r\n function _functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.call(data);\r\n\r\n if (!success) {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n\r\n return returndata;\r\n }\r\n\r\n function _updateExtensions(address currentComptroller) internal {\r\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\r\n address[] memory currentExtensions = LibDiamond.listExtensions();\r\n\r\n // removed the current (old) extensions\r\n for (uint256 i = 0; i < currentExtensions.length; i++) {\r\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\r\n }\r\n // add the new extensions\r\n for (uint256 i = 0; i < latestExtensions.length; i++) {\r\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\r\n }\r\n }\r\n\r\n /**\r\n * @dev register a logic extension\r\n * @param extensionToAdd the extension whose functions are to be added\r\n * @param extensionToReplace the extension whose functions are to be removed/replaced\r\n */\r\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\r\n require(hasAdminRights(), \"!unauthorized\");\r\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\r\n }\r\n}\r\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.22;\r\n\r\ninterface IHypernativeOracle {\r\n function register(address account, bool isStrictMode) external;\r\n function validateForbiddenAccountInteraction(address sender) external view;\r\n function validateForbiddenContextInteraction(address origin, address sender) external view;\r\n function validateBlacklistedAccountInteraction(address sender) external;\r\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\r\npragma solidity ^0.8.0;\r\n\r\ninterface IExpressRelay {\r\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\r\n // This will return true if and only if it's being called while executing the auction winner(s) call.\r\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\r\n // @param permissionId The id that represents the action being gated\r\n // @return permissioned True if the permission is allowed, false otherwise\r\n function isPermissioned(\r\n address protocolFeeReceiver,\r\n bytes calldata permissionId\r\n ) external view returns (bool permissioned);\r\n}\r\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\r\npragma solidity ^0.8.0;\r\n\r\ninterface IExpressRelayFeeReceiver {\r\n // Receive the proceeds of an auction.\r\n // @param permissionKey The permission key where the auction was conducted on.\r\n function receiveAuctionProceedings(\r\n bytes calldata permissionKey\r\n ) external payable;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Callback for IUniswapV3PoolActions#flash\r\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\r\ninterface IUniswapV3FlashCallback {\r\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\r\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\r\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\r\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\r\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\r\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\r\n function uniswapV3FlashCallback(\r\n uint256 fee0,\r\n uint256 fee1,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IUniswapV3PoolActions.sol\";\r\n\r\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\r\n function token0() external view returns (address);\r\n\r\n function token1() external view returns (address);\r\n\r\n function fee() external view returns (uint24);\r\n\r\n function slot0()\r\n external\r\n view\r\n returns (\r\n uint160 sqrtPriceX96,\r\n int24 tick,\r\n uint16 observationIndex,\r\n uint16 observationCardinality,\r\n uint16 observationCardinalityNext,\r\n uint8 feeProtocol,\r\n bool unlocked\r\n );\r\n\r\n function liquidity() external view returns (uint128);\r\n\r\n function observe(uint32[] calldata secondsAgos)\r\n external\r\n view\r\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\r\n\r\n function observations(uint256 index)\r\n external\r\n view\r\n returns (\r\n uint32 blockTimestamp,\r\n int56 tickCumulative,\r\n uint160 liquidityCumulative,\r\n bool initialized\r\n );\r\n\r\n function tickBitmap(int16 wordPosition) external view returns (uint256);\r\n\r\n function ticks(int24 tick)\r\n external\r\n view\r\n returns (\r\n uint128 liquidityGross,\r\n int128 liquidityNet,\r\n uint256 feeGrowthOutside0X128,\r\n uint256 feeGrowthOutside1X128,\r\n int56 tickCumulativeOutside,\r\n uint160 secondsPerLiquidityOutsideX128,\r\n uint32 secondsOutside,\r\n bool initialized\r\n );\r\n\r\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\r\n\r\n function positions(bytes32 key)\r\n external\r\n view\r\n returns (\r\n uint128 _liquidity,\r\n uint256 feeGrowthInside0LastX128,\r\n uint256 feeGrowthInside1LastX128,\r\n uint128 tokensOwed0,\r\n uint128 tokensOwed1\r\n );\r\n}\r\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.5.0;\r\n\r\n/// @title Permissionless pool actions\r\n/// @notice Contains pool methods that can be called by anyone\r\ninterface IUniswapV3PoolActions {\r\n /// @notice Sets the initial price for the pool\r\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\r\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\r\n function initialize(uint160 sqrtPriceX96) external;\r\n\r\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\r\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\r\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\r\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\r\n /// @param recipient The address for which the liquidity will be created\r\n /// @param tickLower The lower tick of the position in which to add liquidity\r\n /// @param tickUpper The upper tick of the position in which to add liquidity\r\n /// @param amount The amount of liquidity to mint\r\n /// @param data Any data that should be passed through to the callback\r\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\r\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\r\n function mint(\r\n address recipient,\r\n int24 tickLower,\r\n int24 tickUpper,\r\n uint128 amount,\r\n bytes calldata data\r\n ) external returns (uint256 amount0, uint256 amount1);\r\n\r\n /// @notice Collects tokens owed to a position\r\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\r\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\r\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\r\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\r\n /// @param recipient The address which should receive the fees collected\r\n /// @param tickLower The lower tick of the position for which to collect fees\r\n /// @param tickUpper The upper tick of the position for which to collect fees\r\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\r\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\r\n /// @return amount0 The amount of fees collected in token0\r\n /// @return amount1 The amount of fees collected in token1\r\n function collect(\r\n address recipient,\r\n int24 tickLower,\r\n int24 tickUpper,\r\n uint128 amount0Requested,\r\n uint128 amount1Requested\r\n ) external returns (uint128 amount0, uint128 amount1);\r\n\r\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\r\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\r\n /// @dev Fees must be collected separately via a call to #collect\r\n /// @param tickLower The lower tick of the position for which to burn liquidity\r\n /// @param tickUpper The upper tick of the position for which to burn liquidity\r\n /// @param amount How much liquidity to burn\r\n /// @return amount0 The amount of token0 sent to the recipient\r\n /// @return amount1 The amount of token1 sent to the recipient\r\n function burn(\r\n int24 tickLower,\r\n int24 tickUpper,\r\n uint128 amount\r\n ) external returns (uint256 amount0, uint256 amount1);\r\n\r\n /// @notice Swap token0 for token1, or token1 for token0\r\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\r\n /// @param recipient The address to receive the output of the swap\r\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\r\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\r\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\r\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\r\n /// @param data Any data to be passed through to the callback\r\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\r\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\r\n function swap(\r\n address recipient,\r\n bool zeroForOne,\r\n int256 amountSpecified,\r\n uint160 sqrtPriceLimitX96,\r\n bytes calldata data\r\n ) external returns (int256 amount0, int256 amount1);\r\n\r\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\r\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\r\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\r\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\r\n /// @param recipient The address which will receive the token0 and token1 amounts\r\n /// @param amount0 The amount of token0 to send\r\n /// @param amount1 The amount of token1 to send\r\n /// @param data Any data to be passed through to the callback\r\n function flash(\r\n address recipient,\r\n uint256 amount0,\r\n uint256 amount1,\r\n bytes calldata data\r\n ) external;\r\n\r\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\r\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\r\n /// the input observationCardinalityNext.\r\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\r\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\r\n}\r\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\r\npragma solidity >=0.7.5;\r\npragma abicoder v2;\r\n\r\n/// @title Quoter Interface\r\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\r\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\r\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\r\ninterface IUniswapV3Quoter {\r\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\r\n /// @param path The path of the swap, i.e. each token pair and the pool fee\r\n /// @param amountIn The amount of the first token to swap\r\n /// @return amountOut The amount of the last token that would be received\r\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\r\n\r\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\r\n /// @param tokenIn The token being swapped in\r\n /// @param tokenOut The token being swapped out\r\n /// @param fee The fee of the token pool to consider for the pair\r\n /// @param amountIn The desired input amount\r\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\r\n /// @return amountOut The amount of `tokenOut` that would be received\r\n function quoteExactInputSingle(\r\n address tokenIn,\r\n address tokenOut,\r\n uint24 fee,\r\n uint256 amountIn,\r\n uint160 sqrtPriceLimitX96\r\n ) external returns (uint256 amountOut);\r\n\r\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\r\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\r\n /// @param amountOut The amount of the last token to receive\r\n /// @return amountIn The amount of first token required to be paid\r\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\r\n\r\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\r\n /// @param tokenIn The token being swapped in\r\n /// @param tokenOut The token being swapped out\r\n /// @param fee The fee of the token pool to consider for the pair\r\n /// @param amountOut The desired output amount\r\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\r\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\r\n function quoteExactOutputSingle(\r\n address tokenIn,\r\n address tokenOut,\r\n uint24 fee,\r\n uint256 amountOut,\r\n uint160 sqrtPriceLimitX96\r\n ) external returns (uint256 amountIn);\r\n}\r\n" + }, + "contracts/IEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\ninterface IEmissionsManager {\r\n error InvalidPoolDirectoryAaddress();\r\n error InvalidProtocolAddress();\r\n error InvalidRewardTokenAddress();\r\n error CollateralBasisPointsExceedMaximum();\r\n error InvalidVeIONAddress();\r\n error MaximumLimitExceeded();\r\n\r\n event Initialized(\r\n address indexed protocolAddress,\r\n address indexed rewardToken,\r\n uint256 collateralBp,\r\n bytes nonBlacklistableTargetBytecode\r\n );\r\n event VeIonSet(address indexed veIon);\r\n event CollateralBpSet(uint256 collateralBp);\r\n event NonBlacklistableAddressSet(address indexed user, bool isNonBlacklistable);\r\n event NonBlacklistableTargetBytecodeSet(bytes newBytecode);\r\n\r\n function isUserBlacklisted(address _user) external view returns (bool);\r\n function isUserBlacklistable(address _user) external view returns (bool);\r\n}\r\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\nimport \"./liquidators/IRedemptionStrategy.sol\";\r\nimport \"./liquidators/IFundsConversionStrategy.sol\";\r\n\r\ninterface ILiquidator {\r\n /**\r\n * borrower The borrower's Ethereum address.\r\n * repayAmount The amount to repay to liquidate the unhealthy loan.\r\n * cErc20 The borrowed CErc20 contract to repay.\r\n * cTokenCollateral The cToken collateral contract to be liquidated.\r\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\r\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\r\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\r\n */\r\n struct LiquidateToTokensWithFlashSwapVars {\r\n address borrower;\r\n uint256 repayAmount;\r\n ICErc20 cErc20;\r\n ICErc20 cTokenCollateral;\r\n address flashSwapContract;\r\n uint256 minProfitAmount;\r\n IRedemptionStrategy[] redemptionStrategies;\r\n bytes[] strategyData;\r\n IFundsConversionStrategy[] debtFundingStrategies;\r\n bytes[] debtFundingStrategiesData;\r\n }\r\n\r\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\r\n\r\n function safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external returns (uint256);\r\n\r\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\r\n external\r\n returns (uint256);\r\n\r\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\r\n\r\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\r\n external;\r\n\r\n function setExpressRelay(address _expressRelay) external;\r\n\r\n function setPoolLens(address _poolLens) external;\r\n\r\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\r\n}\r\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title AddressesProvider\r\n * @notice The Addresses Provider serves as a central storage of system internal and external\r\n * contract addresses that change between deploys and across chains\r\n * @author Veliko Minkov \r\n */\r\ncontract AddressesProvider is SafeOwnableUpgradeable {\r\n mapping(string => address) private _addresses;\r\n mapping(address => Contract) public plugins;\r\n mapping(address => Contract) public flywheelRewards;\r\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\r\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\r\n JarvisPool[] public jarvisPoolsConfig;\r\n CurveSwapPool[] public curveSwapPoolsConfig;\r\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\r\n\r\n /// @dev Initializer to set the admin that can set and change contracts addresses\r\n function initialize(address owner) public initializer {\r\n __SafeOwnable_init(owner);\r\n }\r\n\r\n /**\r\n * @dev The contract address and a string that uniquely identifies the contract's interface\r\n */\r\n struct Contract {\r\n address addr;\r\n string contractInterface;\r\n }\r\n\r\n struct RedemptionStrategy {\r\n address addr;\r\n string contractInterface;\r\n address outputToken;\r\n }\r\n\r\n struct FundingStrategy {\r\n address addr;\r\n string contractInterface;\r\n address inputToken;\r\n }\r\n\r\n struct JarvisPool {\r\n address syntheticToken;\r\n address collateralToken;\r\n address liquidityPool;\r\n uint256 expirationTime;\r\n }\r\n\r\n struct CurveSwapPool {\r\n address poolAddress;\r\n address[] coins;\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the flywheel for the reward token\r\n * @param rewardToken the reward token address\r\n * @param flywheelRewardsModule the flywheel rewards module address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setFlywheelRewards(\r\n address rewardToken,\r\n address flywheelRewardsModule,\r\n string calldata contractInterface\r\n ) public onlyOwner {\r\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\r\n * @param asset the asset address\r\n * @param plugin the ERC4626 plugin address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setPlugin(\r\n address asset,\r\n address plugin,\r\n string calldata contractInterface\r\n ) public onlyOwner {\r\n plugins[asset] = Contract(plugin, contractInterface);\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\r\n * @param asset the asset address\r\n * @param strategy redemption strategy address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setRedemptionStrategy(\r\n address asset,\r\n address strategy,\r\n string calldata contractInterface,\r\n address outputToken\r\n ) public onlyOwner {\r\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\r\n }\r\n\r\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\r\n return redemptionStrategiesConfig[asset];\r\n }\r\n\r\n /**\r\n * @dev sets the address and contract interface ID of the funding strategy for the asset\r\n * @param asset the asset address\r\n * @param strategy funding strategy address\r\n * @param contractInterface a string that uniquely identifies the contract's interface\r\n */\r\n function setFundingStrategy(\r\n address asset,\r\n address strategy,\r\n string calldata contractInterface,\r\n address inputToken\r\n ) public onlyOwner {\r\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\r\n }\r\n\r\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\r\n return fundingStrategiesConfig[asset];\r\n }\r\n\r\n /**\r\n * @dev configures the Jarvis pool of a Jarvis synthetic token\r\n * @param syntheticToken the synthetic token address\r\n * @param collateralToken the collateral token address\r\n * @param liquidityPool the liquidity pool address\r\n * @param expirationTime the operation expiration time\r\n */\r\n function setJarvisPool(\r\n address syntheticToken,\r\n address collateralToken,\r\n address liquidityPool,\r\n uint256 expirationTime\r\n ) public onlyOwner {\r\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\r\n }\r\n\r\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\r\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\r\n }\r\n\r\n /**\r\n * @dev Sets an address for an id replacing the address saved in the addresses map\r\n * @param id The id\r\n * @param newAddress The address to set\r\n */\r\n function setAddress(string calldata id, address newAddress) external onlyOwner {\r\n _addresses[id] = newAddress;\r\n }\r\n\r\n /**\r\n * @dev Returns an address by id\r\n * @return The address\r\n */\r\n function getAddress(string calldata id) public view returns (address) {\r\n return _addresses[id];\r\n }\r\n\r\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\r\n return curveSwapPoolsConfig;\r\n }\r\n\r\n function getJarvisPools() public view returns (JarvisPool[] memory) {\r\n return jarvisPoolsConfig;\r\n }\r\n\r\n function setBalancerPoolForTokens(\r\n address inputToken,\r\n address outputToken,\r\n address pool\r\n ) external onlyOwner {\r\n balancerPoolForTokens[inputToken][outputToken] = pool;\r\n }\r\n\r\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\r\n return balancerPoolForTokens[inputToken][outputToken];\r\n }\r\n}\r\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\r\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\r\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\r\n\r\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\r\n\r\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\r\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\r\n PoolRolesAuthority public poolAuthLogic;\r\n address public leveredPositionsFactory;\r\n bool public noAuthRequired;\r\n\r\n function initialize(address _leveredPositionsFactory) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n leveredPositionsFactory = _leveredPositionsFactory;\r\n poolAuthLogic = new PoolRolesAuthority();\r\n }\r\n\r\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\r\n leveredPositionsFactory = _leveredPositionsFactory;\r\n poolAuthLogic = new PoolRolesAuthority();\r\n // for Neon the auth is not required\r\n noAuthRequired = block.chainid == 245022934;\r\n }\r\n\r\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\r\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\r\n\r\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\r\n auth = PoolRolesAuthority(address(proxy));\r\n auth.initialize(address(this));\r\n poolsAuthorities[pool] = auth;\r\n\r\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\r\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\r\n // sets the registry owner as the auth owner\r\n reconfigureAuthority(pool);\r\n }\r\n\r\n function reconfigureAuthority(address poolAddress) public {\r\n IonicComptroller pool = IonicComptroller(poolAddress);\r\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\r\n\r\n if (msg.sender != poolAddress || address(auth) != address(0)) {\r\n require(address(auth) != address(0), \"no such authority\");\r\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\r\n\r\n auth.configureRegistryCapabilities();\r\n auth.configurePoolSupplierCapabilities(pool);\r\n auth.configurePoolBorrowerCapabilities(pool);\r\n // everyone can be a liquidator\r\n auth.configureOpenPoolLiquidatorCapabilities(pool);\r\n auth.configureLeveredPositionCapabilities(pool);\r\n\r\n if (auth.owner() != owner()) {\r\n auth.setOwner(owner());\r\n }\r\n }\r\n }\r\n\r\n function canCall(\r\n address pool,\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) external view returns (bool) {\r\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\r\n if (address(authorityForPool) == address(0)) {\r\n return noAuthRequired;\r\n } else {\r\n // allow only if an auth exists and it allows the action\r\n return authorityForPool.canCall(user, target, functionSig);\r\n }\r\n }\r\n\r\n function setUserRole(\r\n address pool,\r\n address user,\r\n uint8 role,\r\n bool enabled\r\n ) external {\r\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\r\n\r\n require(address(poolAuth) != address(0), \"auth does not exist\");\r\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\r\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\r\n\r\n poolAuth.setUserRole(user, role, enabled);\r\n }\r\n}\r\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\n/**\r\n * @notice a base contract for logic extensions that use the diamond pattern storage\r\n * to map the functions when looking up the extension contract to delegate to.\r\n */\r\nabstract contract DiamondExtension {\r\n /**\r\n * @return a list of all the function selectors that this logic extension exposes\r\n */\r\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\r\n}\r\n\r\n// When no function exists for function called\r\nerror FunctionNotFound(bytes4 _functionSelector);\r\n\r\n// When no extension exists for function called\r\nerror ExtensionNotFound(bytes4 _functionSelector);\r\n\r\n// When the function is already added\r\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\r\n\r\nabstract contract DiamondBase {\r\n /**\r\n * @dev register a logic extension\r\n * @param extensionToAdd the extension whose functions are to be added\r\n * @param extensionToReplace the extension whose functions are to be removed/replaced\r\n */\r\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\r\n\r\n function _listExtensions() public view returns (address[] memory) {\r\n return LibDiamond.listExtensions();\r\n }\r\n\r\n fallback() external {\r\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\r\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\r\n // Execute external function from extension using delegatecall and return any value.\r\n assembly {\r\n // copy function selector and any arguments\r\n calldatacopy(0, 0, calldatasize())\r\n // execute function call using the extension\r\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\r\n // get any return value\r\n returndatacopy(0, 0, returndatasize())\r\n // return any return value or error back to the caller\r\n switch result\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @notice a library to use in a contract, whose logic is extended with diamond extension\r\n */\r\nlibrary LibDiamond {\r\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\r\n\r\n struct Function {\r\n address extension;\r\n bytes4 selector;\r\n }\r\n\r\n struct LogicStorage {\r\n Function[] functions;\r\n address[] extensions;\r\n }\r\n\r\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\r\n return getExtensionForSelector(msgSig, diamondStorage());\r\n }\r\n\r\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\r\n bytes32 position = DIAMOND_STORAGE_POSITION;\r\n assembly {\r\n ds.slot := position\r\n }\r\n }\r\n\r\n function listExtensions() internal view returns (address[] memory) {\r\n return diamondStorage().extensions;\r\n }\r\n\r\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\r\n if (address(extensionToReplace) != address(0)) {\r\n removeExtension(extensionToReplace);\r\n }\r\n addExtension(extensionToAdd);\r\n }\r\n\r\n function removeExtension(DiamondExtension extension) internal {\r\n LogicStorage storage ds = diamondStorage();\r\n // remove all functions of the extension to replace\r\n removeExtensionFunctions(extension);\r\n for (uint8 i = 0; i < ds.extensions.length; i++) {\r\n if (ds.extensions[i] == address(extension)) {\r\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\r\n ds.extensions.pop();\r\n }\r\n }\r\n }\r\n\r\n function addExtension(DiamondExtension extension) internal {\r\n LogicStorage storage ds = diamondStorage();\r\n for (uint8 i = 0; i < ds.extensions.length; i++) {\r\n require(ds.extensions[i] != address(extension), \"extension already added\");\r\n }\r\n addExtensionFunctions(extension);\r\n ds.extensions.push(address(extension));\r\n }\r\n\r\n function removeExtensionFunctions(DiamondExtension extension) internal {\r\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\r\n LogicStorage storage ds = diamondStorage();\r\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\r\n bytes4 selectorToRemove = fnsToRemove[i];\r\n // must never fail\r\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\r\n // swap with the last element in the selectorAtIndex array and remove the last element\r\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\r\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\r\n ds.functions.pop();\r\n }\r\n }\r\n\r\n function addExtensionFunctions(DiamondExtension extension) internal {\r\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\r\n LogicStorage storage ds = diamondStorage();\r\n uint16 functionsCount = uint16(ds.functions.length);\r\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\r\n bytes4 selector = fnsToAdd[functionsIndex];\r\n address oldImplementation = getExtensionForSelector(selector, ds);\r\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\r\n ds.functions.push(Function(address(extension), selector));\r\n functionsCount++;\r\n }\r\n }\r\n\r\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\r\n uint256 fnsLen = ds.functions.length;\r\n for (uint256 i = 0; i < fnsLen; i++) {\r\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\r\n }\r\n\r\n return address(0);\r\n }\r\n\r\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\r\n uint16 fnsLen = uint16(ds.functions.length);\r\n for (uint16 i = 0; i < fnsLen; i++) {\r\n if (ds.functions[i].selector == selector) return i;\r\n }\r\n\r\n return type(uint16).max;\r\n }\r\n}\r\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\ninterface IFlashLoanReceiver {\r\n function receiveFlashLoan(\r\n address borrowedAsset,\r\n uint256 borrowedAmount,\r\n bytes calldata data\r\n ) external;\r\n}\r\n" + }, + "contracts/ionic/MorphoBribeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\nimport { IBribeRewards } from \"../veION/interfaces/IBribeRewards.sol\";\r\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport { OwnableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @title MorphoBribeDistributor\r\n * @dev This contract handles the distribution of bribe tokens to the Morpho protocol.\r\n */\r\ncontract MorphoBribeDistributor is OwnableUpgradeable {\r\n using SafeERC20 for IERC20;\r\n\r\n /// @notice Address of the Morpho market\r\n address public morphoMarket;\r\n /// @notice Address of the Morpho bribes contract\r\n address public morphoBribes;\r\n\r\n event Initialized(address indexed morphoMarket, address indexed morphoBribes);\r\n event Distributed(address indexed from, uint256 amount);\r\n event MorphoMarketSet(address indexed newMorphoMarket);\r\n event MorphoBribesSet(address indexed newMorphoBribes);\r\n event BribeTokenSet(address indexed newBribeToken);\r\n\r\n /**\r\n * @dev Modifier to restrict access to only the Morpho market\r\n */\r\n modifier onlyMorphoMarket() {\r\n require(msg.sender == morphoMarket, \"Caller is not the Morpho Market\");\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Initializes the MorphoBribeDistributor contract\r\n * @param _morphoMarket Address of the Morpho market\r\n * @param _morphoBribes Address of the Morpho bribes contract\r\n */\r\n function initialize(address _morphoMarket, address _morphoBribes) public initializer {\r\n __Ownable_init();\r\n morphoMarket = _morphoMarket;\r\n morphoBribes = _morphoBribes;\r\n emit Initialized(_morphoMarket, _morphoBribes);\r\n }\r\n\r\n /**\r\n * @notice Distributes bribe tokens to the Morpho bribes contract\r\n * @param _amount Amount of tokens to distribute\r\n */\r\n function distribute(address _rewardToken, uint256 _amount) external onlyMorphoMarket {\r\n IERC20(_rewardToken).safeTransferFrom(msg.sender, address(this), _amount);\r\n IERC20(_rewardToken).approve(morphoBribes, _amount);\r\n IBribeRewards(morphoBribes).notifyRewardAmount(_rewardToken, _amount);\r\n emit Distributed(msg.sender, _amount);\r\n }\r\n\r\n /**\r\n * @notice Sets the address of the Morpho market\r\n * @param _morphoMarket New address of the Morpho market\r\n */\r\n function setMorphoMarket(address _morphoMarket) external onlyOwner {\r\n morphoMarket = _morphoMarket;\r\n emit MorphoMarketSet(_morphoMarket);\r\n }\r\n\r\n /**\r\n * @notice Sets the address of the Morpho bribes contract\r\n * @param _morphoBribes New address of the Morpho bribes contract\r\n */\r\n function setMorphoBribes(address _morphoBribes) external onlyOwner {\r\n morphoBribes = _morphoBribes;\r\n emit MorphoBribesSet(_morphoBribes);\r\n }\r\n}\r\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\r\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\r\n\r\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\n\r\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\r\n constructor() RolesAuthority(address(0), Authority(address(0))) {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(address _owner) public initializer {\r\n owner = _owner;\r\n authority = this;\r\n }\r\n\r\n // up to 256 roles\r\n uint8 public constant REGISTRY_ROLE = 0;\r\n uint8 public constant SUPPLIER_ROLE = 1;\r\n uint8 public constant BORROWER_ROLE = 2;\r\n uint8 public constant LIQUIDATOR_ROLE = 3;\r\n uint8 public constant LEVERED_POSITION_ROLE = 4;\r\n\r\n function configureRegistryCapabilities() external requiresAuth {\r\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(\r\n REGISTRY_ROLE,\r\n address(this),\r\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\r\n true\r\n );\r\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\r\n }\r\n\r\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolSupplierCapabilities(pool, true);\r\n }\r\n\r\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolSupplierCapabilities(pool, false);\r\n }\r\n\r\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\r\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\r\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n bytes4[] memory selectors = getSupplierMarketSelectors();\r\n for (uint256 j = 0; j < selectors.length; j++) {\r\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\r\n }\r\n }\r\n }\r\n\r\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\r\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\r\n }\r\n\r\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\r\n uint8 fnsCount = 6;\r\n selectors = new bytes4[](fnsCount);\r\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\r\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\r\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\r\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\r\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\r\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\r\n\r\n require(fnsCount == 0, \"use the correct array length\");\r\n return selectors;\r\n }\r\n\r\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\r\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\r\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n bytes4[] memory selectors = getSupplierMarketSelectors();\r\n for (uint256 j = 0; j < selectors.length; j++) {\r\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\r\n }\r\n }\r\n }\r\n\r\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolBorrowerCapabilities(pool, true);\r\n }\r\n\r\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\r\n _setPublicPoolBorrowerCapabilities(pool, false);\r\n }\r\n\r\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\r\n }\r\n }\r\n\r\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\r\n // borrowers have the SUPPLIER_ROLE capabilities by default\r\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\r\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\r\n }\r\n }\r\n\r\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\r\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\r\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\r\n }\r\n }\r\n\r\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\r\n // TODO this leaves redeeming open for everyone\r\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\r\n }\r\n }\r\n\r\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\r\n ICErc20[] memory allMarkets = pool.getAllMarkets();\r\n for (uint256 i = 0; i < allMarkets.length; i++) {\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\r\n\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\r\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\n\r\n/**\r\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\r\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\r\n * that will shift the other.\r\n */\r\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\r\n /**\r\n * @notice Pending owner of this contract\r\n */\r\n address public pendingOwner;\r\n\r\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\r\n __Ownable_init();\r\n _transferOwnership(owner_);\r\n }\r\n\r\n struct AddressSlot {\r\n address value;\r\n }\r\n\r\n modifier onlyOwnerOrAdmin() {\r\n bool isOwner = owner() == _msgSender();\r\n if (!isOwner) {\r\n address admin = _getProxyAdmin();\r\n bool isAdmin = admin == _msgSender();\r\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\r\n }\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Emitted when pendingOwner is changed\r\n */\r\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\r\n\r\n /**\r\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\r\n */\r\n event NewOwner(address oldOwner, address newOwner);\r\n\r\n /**\r\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\r\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\r\n * @param newPendingOwner New pending owner.\r\n */\r\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\r\n // Save current value, if any, for inclusion in log\r\n address oldPendingOwner = pendingOwner;\r\n\r\n // Store pendingOwner with value newPendingOwner\r\n pendingOwner = newPendingOwner;\r\n\r\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\r\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\r\n }\r\n\r\n /**\r\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\r\n * @dev Owner function for pending owner to accept role and update owner\r\n */\r\n function _acceptOwner() public {\r\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\r\n require(msg.sender == pendingOwner, \"not the pending owner\");\r\n\r\n // Save current values for inclusion in log\r\n address oldOwner = owner();\r\n address oldPendingOwner = pendingOwner;\r\n\r\n // Store owner with value pendingOwner\r\n _transferOwnership(pendingOwner);\r\n\r\n // Clear the pending value\r\n pendingOwner = address(0);\r\n\r\n emit NewOwner(oldOwner, pendingOwner);\r\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\r\n }\r\n\r\n function renounceOwnership() public override onlyOwner {\r\n // do not remove this overriding fn\r\n revert(\"not used anymore\");\r\n }\r\n\r\n function transferOwnership(address newOwner) public override onlyOwner {\r\n emit NewPendingOwner(pendingOwner, newOwner);\r\n pendingOwner = newOwner;\r\n }\r\n\r\n function _getProxyAdmin() internal view returns (address admin) {\r\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r\n AddressSlot storage adminSlot;\r\n assembly {\r\n adminSlot.slot := _ADMIN_SLOT\r\n }\r\n admin = adminSlot.value;\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\n\r\n/**\r\n @title Balance Booster Module for Flywheel\r\n @notice Flywheel is a general framework for managing token incentives.\r\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\r\n\r\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \r\n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\r\n \r\n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\r\n\r\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\r\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\r\n*/\r\ninterface IFlywheelBooster {\r\n /**\r\n @notice calculate the boosted supply of a strategy.\r\n @param strategy the strategy to calculate boosted supply of\r\n @return the boosted supply\r\n */\r\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256);\r\n\r\n /**\r\n @notice calculate the boosted balance of a user in a given strategy.\r\n @param strategy the strategy to calculate boosted balance of\r\n @param user the user to calculate boosted balance of\r\n @return the boosted balance\r\n */\r\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256);\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\n\r\ninterface IIonicFlywheel {\r\n function isRewardsDistributor() external returns (bool);\r\n\r\n function isFlywheel() external returns (bool);\r\n\r\n function flywheelPreSupplierAction(address market, address supplier) external;\r\n\r\n function flywheelPostSupplierAction(address market, address supplier) external;\r\n\r\n function flywheelPreBorrowerAction(address market, address borrower) external;\r\n\r\n function flywheelPostBorrowerAction(address market, address borrower) external;\r\n\r\n function flywheelPreTransferAction(address market, address src, address dst) external;\r\n\r\n function flywheelPostTransferAction(address market, address src, address dst) external;\r\n\r\n function compAccrued(address user) external view returns (uint256);\r\n\r\n function addMarketForRewards(ERC20 strategy) external;\r\n\r\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\r\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\r\nimport { SafeCastLib } from \"solmate/utils/SafeCastLib.sol\";\r\n\r\nimport { IFlywheelRewards } from \"./rewards/IFlywheelRewards.sol\";\r\nimport { IFlywheelBooster } from \"./IFlywheelBooster.sol\";\r\nimport { IEmissionsManager } from \"../../../IEmissionsManager.sol\";\r\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\r\n\r\ncontract IonicFlywheelCore is Ownable2StepUpgradeable {\r\n using SafeTransferLib for ERC20;\r\n using SafeCastLib for uint256;\r\n\r\n /// @notice How much rewardsToken will be send to treasury\r\n uint256 public performanceFee;\r\n\r\n /// @notice Address that gets rewardsToken accrued by performanceFee\r\n address public feeRecipient;\r\n\r\n /// @notice The token to reward\r\n ERC20 public rewardToken;\r\n\r\n /// @notice append-only list of strategies added\r\n ERC20[] public allStrategies;\r\n\r\n /// @notice the rewards contract for managing streams\r\n IFlywheelRewards public flywheelRewards;\r\n\r\n /// @notice optional booster module for calculating virtual balances on strategies\r\n IFlywheelBooster public flywheelBooster;\r\n\r\n IEmissionsManager public emissionsManager;\r\n\r\n /// @notice The accrued but not yet transferred rewards for each user\r\n mapping(address => uint256) internal _rewardsAccrued;\r\n\r\n /// @notice The strategy index and last updated per strategy\r\n mapping(ERC20 => RewardsState) internal _strategyState;\r\n\r\n /// @notice user index per strategy\r\n mapping(ERC20 => mapping(address => uint224)) internal _userIndex;\r\n\r\n /// @notice user blacklisted supply per strategy\r\n mapping(ERC20 => mapping(address => uint256)) public userBlacklistedSupply;\r\n\r\n /// @notice blacklisted supply per strategy\r\n mapping(ERC20 => uint256) public blacklistedSupply;\r\n\r\n modifier onlyEmissionsManager() {\r\n require(address(emissionsManager) == msg.sender, \"!emissionsManager\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n _disableInitializers(); // Locks the implementation contract from being initialized\r\n }\r\n\r\n function initialize(\r\n ERC20 _rewardToken,\r\n IFlywheelRewards _flywheelRewards,\r\n IFlywheelBooster _flywheelBooster,\r\n address _owner\r\n ) public initializer {\r\n __Ownable2Step_init();\r\n\r\n rewardToken = _rewardToken;\r\n flywheelRewards = _flywheelRewards;\r\n flywheelBooster = _flywheelBooster;\r\n\r\n performanceFee = 10e16; // 10%\r\n feeRecipient = _owner;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n ACCRUE/CLAIM LOGIC\r\n ----------------------------------------------------------------*/\r\n\r\n /** \r\n @notice Emitted when a user's rewards accrue to a given strategy.\r\n @param strategy the updated rewards strategy\r\n @param user the user of the rewards\r\n @param rewardsDelta how many new rewards accrued to the user\r\n @param rewardsIndex the market index for rewards per token accrued\r\n */\r\n event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);\r\n\r\n /** \r\n @notice Emitted when a user claims accrued rewards.\r\n @param user the user of the rewards\r\n @param amount the amount of rewards claimed\r\n */\r\n event ClaimRewards(address indexed user, uint256 amount);\r\n\r\n /** \r\n @notice accrue rewards for a single user on a strategy\r\n @param strategy the strategy to accrue a user's rewards on\r\n @param user the user to be accrued\r\n @return the cumulative amount of rewards accrued to user (including prior)\r\n */\r\n function accrue(ERC20 strategy, address user) public returns (uint256) {\r\n (uint224 index, uint32 ts) = strategyState(strategy);\r\n RewardsState memory state = RewardsState(index, ts);\r\n\r\n if (state.index == 0) return 0;\r\n\r\n state = accrueStrategy(strategy, state);\r\n return accrueUser(strategy, user, state);\r\n }\r\n\r\n /** \r\n @notice accrue rewards for a two users on a strategy\r\n @param strategy the strategy to accrue a user's rewards on\r\n @param user the first user to be accrued\r\n @param user the second user to be accrued\r\n @return the cumulative amount of rewards accrued to the first user (including prior)\r\n @return the cumulative amount of rewards accrued to the second user (including prior)\r\n */\r\n function accrue(ERC20 strategy, address user, address secondUser) public returns (uint256, uint256) {\r\n (uint224 index, uint32 ts) = strategyState(strategy);\r\n RewardsState memory state = RewardsState(index, ts);\r\n\r\n if (state.index == 0) return (0, 0);\r\n\r\n state = accrueStrategy(strategy, state);\r\n return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));\r\n }\r\n\r\n /** \r\n @notice claim rewards for a given user\r\n @param user the user claiming rewards\r\n @dev this function is public, and all rewards transfer to the user\r\n */\r\n function claimRewards(address user) external {\r\n require(!emissionsManager.isUserBlacklisted(user), \"blacklisted\");\r\n require(!emissionsManager.isUserBlacklistable(user), \"blacklistable\");\r\n uint256 accrued = rewardsAccrued(user);\r\n\r\n if (accrued != 0) {\r\n _rewardsAccrued[user] = 0;\r\n\r\n rewardToken.safeTransferFrom(address(flywheelRewards), user, accrued);\r\n\r\n emit ClaimRewards(user, accrued);\r\n }\r\n }\r\n\r\n /** \r\n @notice take rewards for a given user\r\n @param user the user claiming rewards\r\n @param receiver the address that receives the rewards\r\n @dev this function is public, and all rewards transfer to the receiver\r\n */\r\n function takeRewardsFromUser(address user, address receiver) external onlyEmissionsManager {\r\n uint256 accrued = rewardsAccrued(user);\r\n\r\n if (accrued != 0) {\r\n _rewardsAccrued[user] = 0;\r\n\r\n rewardToken.safeTransferFrom(address(flywheelRewards), receiver, accrued);\r\n\r\n emit ClaimRewards(user, accrued);\r\n }\r\n }\r\n\r\n /** \r\n @notice set user balances to zero\r\n @param strategy strategy to whitelist user for\r\n @param user the user to be whitelisted\r\n @dev this function is public, and all user and strategy blacklisted supplies are reset\r\n */\r\n function whitelistUser(ERC20 strategy, address user) external onlyEmissionsManager {\r\n blacklistedSupply[strategy] -= userBlacklistedSupply[strategy][user];\r\n userBlacklistedSupply[strategy][user] = 0;\r\n }\r\n\r\n /** \r\n @notice update user blacklisted balances\r\n @param strategy strategy to update blacklisted balances\r\n @param user the user to be blacklisted\r\n @dev this function is public\r\n */\r\n function updateBlacklistBalances(ERC20 strategy, address user) external onlyEmissionsManager {\r\n _updateBlacklistBalances(strategy, user);\r\n }\r\n\r\n /** \r\n @notice update user blacklisted balances\r\n @param strategy strategy to update blacklisted balances\r\n @param user the user to be blacklisted\r\n @dev this function is private\r\n */\r\n function _updateBlacklistBalances(ERC20 strategy, address user) internal {\r\n if (emissionsManager.isUserBlacklisted(user)) {\r\n uint256 _oldUserBlacklistedSupply = userBlacklistedSupply[strategy][user];\r\n uint256 supplierTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedBalanceOf(ERC20(strategy), user)\r\n : ERC20(strategy).balanceOf(user);\r\n\r\n if (supplierTokens >= _oldUserBlacklistedSupply) {\r\n blacklistedSupply[strategy] += supplierTokens - _oldUserBlacklistedSupply;\r\n userBlacklistedSupply[strategy][user] = supplierTokens;\r\n } else {\r\n blacklistedSupply[strategy] -= _oldUserBlacklistedSupply - supplierTokens;\r\n userBlacklistedSupply[strategy][user] = supplierTokens;\r\n }\r\n }\r\n }\r\n /*----------------------------------------------------------------\r\n ADMIN LOGIC\r\n ----------------------------------------------------------------*/\r\n\r\n /** \r\n @notice Emitted when a new strategy is added to flywheel by the admin\r\n @param newStrategy the new added strategy\r\n */\r\n event AddStrategy(address indexed newStrategy);\r\n\r\n /// @notice initialize a new strategy\r\n function setEmissionsManager(IEmissionsManager _emissionsManager) external onlyOwner {\r\n emissionsManager = _emissionsManager;\r\n }\r\n\r\n /// @notice initialize a new strategy\r\n function addStrategyForRewards(ERC20 strategy) external onlyOwner {\r\n _addStrategyForRewards(strategy);\r\n }\r\n\r\n function _addStrategyForRewards(ERC20 strategy) internal {\r\n (uint224 index, ) = strategyState(strategy);\r\n require(index == 0, \"strategy\");\r\n _strategyState[strategy] = RewardsState({\r\n index: (10 ** rewardToken.decimals()).safeCastTo224(),\r\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\r\n });\r\n\r\n allStrategies.push(strategy);\r\n emit AddStrategy(address(strategy));\r\n }\r\n\r\n function getAllStrategies() external view returns (ERC20[] memory) {\r\n return allStrategies;\r\n }\r\n\r\n /** \r\n @notice Emitted when the rewards module changes\r\n @param newFlywheelRewards the new rewards module\r\n */\r\n event FlywheelRewardsUpdate(address indexed newFlywheelRewards);\r\n\r\n /// @notice swap out the flywheel rewards contract\r\n function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external onlyOwner {\r\n if (address(flywheelRewards) != address(0)) {\r\n uint256 oldRewardBalance = rewardToken.balanceOf(address(flywheelRewards));\r\n if (oldRewardBalance > 0) {\r\n rewardToken.safeTransferFrom(address(flywheelRewards), address(newFlywheelRewards), oldRewardBalance);\r\n }\r\n }\r\n\r\n flywheelRewards = newFlywheelRewards;\r\n\r\n emit FlywheelRewardsUpdate(address(newFlywheelRewards));\r\n }\r\n\r\n /** \r\n @notice Emitted when the booster module changes\r\n @param newBooster the new booster module\r\n */\r\n event FlywheelBoosterUpdate(address indexed newBooster);\r\n\r\n /// @notice swap out the flywheel booster contract\r\n function setBooster(IFlywheelBooster newBooster) external onlyOwner {\r\n flywheelBooster = newBooster;\r\n\r\n emit FlywheelBoosterUpdate(address(newBooster));\r\n }\r\n\r\n event UpdatedFeeSettings(\r\n uint256 oldPerformanceFee,\r\n uint256 newPerformanceFee,\r\n address oldFeeRecipient,\r\n address newFeeRecipient\r\n );\r\n\r\n /**\r\n * @notice Update performanceFee and/or feeRecipient\r\n * @dev Claim rewards first from the previous feeRecipient before changing it\r\n */\r\n function updateFeeSettings(uint256 _performanceFee, address _feeRecipient) external onlyOwner {\r\n _updateFeeSettings(_performanceFee, _feeRecipient);\r\n }\r\n\r\n function _updateFeeSettings(uint256 _performanceFee, address _feeRecipient) internal {\r\n emit UpdatedFeeSettings(performanceFee, _performanceFee, feeRecipient, _feeRecipient);\r\n\r\n if (feeRecipient != _feeRecipient) {\r\n _rewardsAccrued[_feeRecipient] += rewardsAccrued(feeRecipient);\r\n _rewardsAccrued[feeRecipient] = 0;\r\n }\r\n performanceFee = _performanceFee;\r\n feeRecipient = _feeRecipient;\r\n }\r\n\r\n /*----------------------------------------------------------------\r\n INTERNAL ACCOUNTING LOGIC\r\n ----------------------------------------------------------------*/\r\n\r\n struct RewardsState {\r\n /// @notice The strategy's last updated index\r\n uint224 index;\r\n /// @notice The timestamp the index was last updated at\r\n uint32 lastUpdatedTimestamp;\r\n }\r\n\r\n /// @notice accumulate global rewards on a strategy\r\n function accrueStrategy(\r\n ERC20 strategy,\r\n RewardsState memory state\r\n ) private returns (RewardsState memory rewardsState) {\r\n // calculate accrued rewards through module\r\n uint256 strategyRewardsAccrued = flywheelRewards.getAccruedRewards(strategy, state.lastUpdatedTimestamp);\r\n\r\n rewardsState = state;\r\n\r\n if (strategyRewardsAccrued > 0) {\r\n // use the booster or token supply to calculate reward index denominator\r\n uint256 supplyTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedTotalSupply(strategy) - blacklistedSupply[strategy]\r\n : strategy.totalSupply() - blacklistedSupply[strategy];\r\n\r\n // 100% = 100e16\r\n uint256 accruedFees = (strategyRewardsAccrued * performanceFee) / uint224(100e16);\r\n\r\n _rewardsAccrued[feeRecipient] += accruedFees;\r\n strategyRewardsAccrued -= accruedFees;\r\n\r\n uint224 deltaIndex;\r\n\r\n if (supplyTokens != 0)\r\n deltaIndex = ((strategyRewardsAccrued * (10 ** strategy.decimals())) / supplyTokens).safeCastTo224();\r\n\r\n // accumulate rewards per token onto the index, multiplied by fixed-point factor\r\n rewardsState = RewardsState({\r\n index: state.index + deltaIndex,\r\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\r\n });\r\n _strategyState[strategy] = rewardsState;\r\n }\r\n }\r\n\r\n /// @notice accumulate rewards on a strategy for a specific user\r\n function accrueUser(ERC20 strategy, address user, RewardsState memory state) private returns (uint256) {\r\n // load indices\r\n uint224 strategyIndex = state.index;\r\n uint224 supplierIndex = userIndex(strategy, user);\r\n\r\n // sync user index to global\r\n _userIndex[strategy][user] = strategyIndex;\r\n\r\n // if user hasn't yet accrued rewards, grant them interest from the strategy beginning if they have a balance\r\n // zero balances will have no effect other than syncing to global index\r\n if (supplierIndex == 0) {\r\n supplierIndex = (10 ** rewardToken.decimals()).safeCastTo224();\r\n }\r\n\r\n uint224 deltaIndex = strategyIndex - supplierIndex;\r\n // use the booster or token balance to calculate reward balance multiplier\r\n uint256 supplierTokens = address(flywheelBooster) != address(0)\r\n ? flywheelBooster.boostedBalanceOf(strategy, user) - userBlacklistedSupply[strategy][user]\r\n : strategy.balanceOf(user) - userBlacklistedSupply[strategy][user];\r\n\r\n // accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed\r\n uint256 supplierDelta = (deltaIndex * supplierTokens) / (10 ** strategy.decimals());\r\n uint256 supplierAccrued = rewardsAccrued(user) + supplierDelta;\r\n\r\n _rewardsAccrued[user] = supplierAccrued;\r\n\r\n emit AccrueRewards(strategy, user, supplierDelta, strategyIndex);\r\n\r\n return supplierAccrued;\r\n }\r\n\r\n function rewardsAccrued(address user) public virtual returns (uint256) {\r\n return _rewardsAccrued[user];\r\n }\r\n\r\n function userIndex(ERC20 strategy, address user) public virtual returns (uint224) {\r\n return _userIndex[strategy][user];\r\n }\r\n\r\n function strategyState(ERC20 strategy) public virtual returns (uint224 index, uint32 lastUpdatedTimestamp) {\r\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\r\nimport {IFlywheelRewards} from \"./IFlywheelRewards.sol\";\r\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\r\n\r\n/** \r\n @title Flywheel Reward Module\r\n @notice Determines how many rewards accrue to each strategy globally over a given time period.\r\n @dev approves the flywheel core for the reward token to allow balances to be managed by the module but claimed from core.\r\n*/\r\nabstract contract BaseFlywheelRewards is IFlywheelRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n /// @notice thrown when caller is not the flywheel\r\n error FlywheelError();\r\n\r\n /// @notice the reward token paid\r\n ERC20 public immutable override rewardToken;\r\n\r\n /// @notice the flywheel core contract\r\n IonicFlywheelCore public immutable override flywheel;\r\n\r\n constructor(IonicFlywheelCore _flywheel) {\r\n flywheel = _flywheel;\r\n ERC20 _rewardToken = _flywheel.rewardToken();\r\n rewardToken = _rewardToken;\r\n\r\n _rewardToken.safeApprove(address(_flywheel), type(uint256).max);\r\n }\r\n\r\n modifier onlyFlywheel() {\r\n if (msg.sender != address(flywheel)) revert FlywheelError();\r\n _;\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelInstantRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\r\nimport { BaseFlywheelRewards } from \"./BaseFlywheelRewards.sol\";\r\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\r\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\r\n\r\n/**\r\n * @title FlywheelInstantRewards\r\n * @author Jourdan DUnkley (https://github.com/jourdanDunkley)\r\n * @notice This contract handles the instant reward distribution for strategies.\r\n * It allows setting and transferring rewards for specific strategies.\r\n */\r\ncontract FlywheelInstantRewards is Auth, BaseFlywheelRewards {\r\n using SafeTransferLib for ERC20;\r\n\r\n event RewardsSet(ERC20 indexed strategy, uint256 amount);\r\n\r\n /// @notice Mapping to store the reward amount for each strategy.\r\n mapping(ERC20 => uint256) rewardAmount;\r\n /// @notice Mapping to track if a strategy has new rewards to be distributed.\r\n mapping(ERC20 => bool) rewardsNew;\r\n\r\n /**\r\n * @notice Constructor to initialize the FlywheelInstantRewards contract.\r\n * @param _flywheel The flywheel core contract.\r\n * @param _owner The owner of the contract.\r\n * @param _authority The authority contract for authentication.\r\n */\r\n constructor(\r\n IonicFlywheelCore _flywheel,\r\n address _owner,\r\n Authority _authority\r\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\r\n\r\n /**\r\n * @notice Set the reward amount for a specific strategy.\r\n * @param _amount The amount of rewards to be set for the strategy.\r\n * @param _strategy The strategy for which the rewards are being set.\r\n * @dev Requires authentication to execute.\r\n */\r\n function setRewards(ERC20 _strategy, uint256 _amount) external requiresAuth {\r\n rewardAmount[_strategy] = _amount;\r\n rewardsNew[_strategy] = true;\r\n rewardToken.safeTransferFrom(msg.sender, address(this), _amount);\r\n emit RewardsSet(_strategy, _amount);\r\n }\r\n\r\n /**\r\n * @notice Calculate and transfer accrued rewards to the flywheel core.\r\n * @param strategy The strategy to accrue rewards for.\r\n * @return amount The amount of tokens accrued and transferred.\r\n * @dev This function can only be called by the flywheel core.\r\n */\r\n function getAccruedRewards(\r\n ERC20 strategy,\r\n uint32 /* lastUpdatedTimestamp */\r\n ) external override onlyFlywheel returns (uint256 amount) {\r\n if (rewardsNew[strategy]) {\r\n amount = rewardAmount[strategy];\r\n rewardsNew[strategy] = false;\r\n } else {\r\n amount = 0;\r\n }\r\n }\r\n}\r\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.10;\r\n\r\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\r\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\r\n\r\n/**\r\n @title Rewards Module for Flywheel\r\n @notice Flywheel is a general framework for managing token incentives.\r\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\r\n\r\n The Rewards module is responsible for:\r\n * determining the ongoing reward amounts to entire strategies (core handles the logic for dividing among users)\r\n * actually holding rewards that are yet to be claimed\r\n\r\n The reward stream can follow arbitrary logic as long as the amount of rewards passed to flywheel core has been sent to this contract.\r\n\r\n Different module strategies include:\r\n * a static reward rate per second\r\n * a decaying reward rate\r\n * a dynamic just-in-time reward stream\r\n * liquid governance reward delegation (Curve Gauge style)\r\n\r\n SECURITY NOTE: The rewards strategy should be smooth and continuous, to prevent gaming the reward distribution by frontrunning.\r\n */\r\ninterface IFlywheelRewards {\r\n /**\r\n @notice calculate the rewards amount accrued to a strategy since the last update.\r\n @param strategy the strategy to accrue rewards for.\r\n @param lastUpdatedTimestamp the last time rewards were accrued for the strategy.\r\n @return rewards the amount of rewards accrued to the market\r\n */\r\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);\r\n\r\n /// @notice return the flywheel core address\r\n function flywheel() external view returns (IonicFlywheelCore);\r\n\r\n /// @notice return the reward token associated with flywheel core.\r\n function rewardToken() external view returns (ERC20);\r\n}\r\n" + }, + "contracts/ionic/strategies/IonicERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\r\n\r\nimport { PausableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol\";\r\nimport { ERC4626Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol\";\r\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\r\n\r\nabstract contract IonicERC4626 is SafeOwnableUpgradeable, PausableUpgradeable, ERC4626Upgradeable {\r\n using FixedPointMathLib for uint256;\r\n using SafeERC20Upgradeable for ERC20Upgradeable;\r\n\r\n /* ========== STATE VARIABLES ========== */\r\n\r\n uint256 public vaultShareHWM;\r\n uint256 public performanceFee;\r\n address public feeRecipient;\r\n\r\n /* ========== EVENTS ========== */\r\n\r\n event UpdatedFeeSettings(\r\n uint256 oldPerformanceFee,\r\n uint256 newPerformanceFee,\r\n address oldFeeRecipient,\r\n address newFeeRecipient\r\n );\r\n\r\n event UpdatedRewardsRecipient(address oldRewardsRecipient, address newRewardsRecipient);\r\n\r\n /* ========== INITIALIZER ========== */\r\n\r\n function __IonicER4626_init(ERC20Upgradeable asset_) internal onlyInitializing {\r\n __SafeOwnable_init(msg.sender);\r\n __Pausable_init();\r\n __Context_init();\r\n __ERC20_init(\r\n string(abi.encodePacked(\"Ionic \", asset_.name(), \" Vault\")),\r\n string(abi.encodePacked(\"iv\", asset_.symbol()))\r\n );\r\n __ERC4626_init(asset_);\r\n\r\n vaultShareHWM = 10 ** asset_.decimals();\r\n feeRecipient = msg.sender;\r\n }\r\n\r\n function _asset() internal view returns (ERC20Upgradeable) {\r\n return ERC20Upgradeable(super.asset());\r\n }\r\n\r\n /* ========== DEPOSIT/WITHDRAW FUNCTIONS ========== */\r\n\r\n function deposit(uint256 assets, address receiver) public override whenNotPaused returns (uint256 shares) {\r\n // Check for rounding error since we round down in previewDeposit.\r\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\r\n\r\n // Need to transfer before minting or ERC777s could reenter.\r\n _asset().safeTransferFrom(msg.sender, address(this), assets);\r\n\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(msg.sender, receiver, assets, shares);\r\n\r\n afterDeposit(assets, shares);\r\n }\r\n\r\n function mint(uint256 shares, address receiver) public override whenNotPaused returns (uint256 assets) {\r\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\r\n\r\n // Need to transfer before minting or ERC777s could reenter.\r\n _asset().safeTransferFrom(msg.sender, address(this), assets);\r\n\r\n _mint(receiver, shares);\r\n\r\n emit Deposit(msg.sender, receiver, assets, shares);\r\n\r\n afterDeposit(assets, shares);\r\n }\r\n\r\n function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {\r\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\r\n\r\n if (msg.sender != owner) {\r\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\r\n }\r\n\r\n if (!paused()) {\r\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\r\n\r\n beforeWithdraw(assets, shares);\r\n\r\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\r\n }\r\n\r\n _burn(owner, shares);\r\n\r\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\r\n\r\n _asset().safeTransfer(receiver, assets);\r\n }\r\n\r\n function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {\r\n if (msg.sender != owner) {\r\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\r\n }\r\n\r\n // Check for rounding error since we round down in previewRedeem.\r\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\r\n\r\n if (!paused()) {\r\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\r\n\r\n beforeWithdraw(assets, shares);\r\n\r\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\r\n }\r\n\r\n _burn(owner, shares);\r\n\r\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\r\n\r\n _asset().safeTransfer(receiver, assets);\r\n }\r\n\r\n /* ========== FEE FUNCTIONS ========== */\r\n\r\n /**\r\n * @notice Take the performance fee that has accrued since last fee harvest.\r\n * @dev Performance fee is based on a vault share high water mark value. If vault share value has increased above the\r\n * HWM in a fee period, issue fee shares to the vault equal to the performance fee.\r\n */\r\n function takePerformanceFee() external onlyOwner {\r\n require(feeRecipient != address(0), \"fee recipient not initialized\");\r\n\r\n uint256 currentAssets = totalAssets();\r\n uint256 shareValue = convertToAssets(10 ** _asset().decimals());\r\n\r\n require(shareValue > vaultShareHWM, \"shareValue !> vaultShareHWM\");\r\n // cache value\r\n uint256 supply = totalSupply();\r\n\r\n uint256 accruedPerformanceFee = (performanceFee * (shareValue - vaultShareHWM) * supply) / 1e36;\r\n _mint(feeRecipient, accruedPerformanceFee.mulDivDown(supply, (currentAssets - accruedPerformanceFee)));\r\n\r\n vaultShareHWM = convertToAssets(10 ** _asset().decimals());\r\n }\r\n\r\n /**\r\n * @notice Transfer accrued fees to rewards manager contract. Caller must be a registered keeper.\r\n * @dev We must make sure that feeRecipient is not address(0) before withdrawing fees\r\n */\r\n function withdrawAccruedFees() external onlyOwner {\r\n redeem(balanceOf(feeRecipient), feeRecipient, feeRecipient);\r\n }\r\n\r\n /**\r\n * @notice Update performanceFee and/or feeRecipient\r\n */\r\n function updateFeeSettings(uint256 newPerformanceFee, address newFeeRecipient) external onlyOwner {\r\n emit UpdatedFeeSettings(performanceFee, newPerformanceFee, feeRecipient, newFeeRecipient);\r\n\r\n performanceFee = newPerformanceFee;\r\n\r\n if (newFeeRecipient != feeRecipient) {\r\n if (feeRecipient != address(0)) {\r\n uint256 oldFees = balanceOf(feeRecipient);\r\n\r\n _burn(feeRecipient, oldFees);\r\n _approve(feeRecipient, owner(), 0);\r\n _mint(newFeeRecipient, oldFees);\r\n }\r\n\r\n _approve(newFeeRecipient, owner(), type(uint256).max);\r\n }\r\n\r\n feeRecipient = newFeeRecipient;\r\n }\r\n\r\n /* ========== EMERGENCY FUNCTIONS ========== */\r\n\r\n // Should withdraw all funds from the strategy and pause the contract\r\n function emergencyWithdrawAndPause() external virtual;\r\n\r\n function unpause() external virtual;\r\n\r\n function shutdown(address market) external onlyOwner whenPaused returns (uint256) {\r\n ERC20Upgradeable theAsset = _asset();\r\n uint256 endBalance = theAsset.balanceOf(address(this));\r\n theAsset.transfer(market, endBalance);\r\n return endBalance;\r\n }\r\n\r\n /* ========== INTERNAL HOOKS LOGIC ========== */\r\n\r\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual;\r\n\r\n function afterDeposit(uint256 assets, uint256 shares) internal virtual;\r\n}\r\n" + }, + "contracts/ionic/strategies/IonicMarketERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.22;\r\nimport { IonicERC4626, ERC20Upgradeable } from \"./IonicERC4626.sol\";\r\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\r\nimport { ComptrollerErrorReporter } from \"../../compound/ErrorReporter.sol\";\r\n\r\ninterface IonicFlywheelLensRouter_4626 {\r\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\r\n}\r\n\r\ncontract IonicMarketERC4626 is IonicERC4626 {\r\n using SafeERC20Upgradeable for ERC20Upgradeable;\r\n\r\n error IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error);\r\n\r\n // STATE VARIABLES\r\n address public rewardsRecipient;\r\n IonicFlywheelLensRouter_4626 public flywheelLensRouter;\r\n ICErc20 public cToken;\r\n\r\n function initialize(\r\n ERC20Upgradeable asset_,\r\n ICErc20 cToken_,\r\n address flywheelLensRouter_,\r\n address rewardsRecipient_\r\n ) public initializer {\r\n __IonicER4626_init(asset_);\r\n cToken = cToken_;\r\n rewardsRecipient = rewardsRecipient_;\r\n flywheelLensRouter = IonicFlywheelLensRouter_4626(flywheelLensRouter_);\r\n }\r\n\r\n /* ========== VIEW FUNCTIONS ========== */\r\n function totalAssets() public view virtual override returns (uint256) {\r\n return cToken.balanceOfUnderlying(address(this));\r\n }\r\n\r\n /// @notice maximum amount of underlying tokens that can be deposited into the underlying protocol\r\n function maxDeposit(address) public view override returns (uint256) {\r\n if (cToken.comptroller().mintGuardianPaused(address(cToken))) {\r\n return 0;\r\n }\r\n\r\n uint256 supplyCap = cToken.comptroller().supplyCaps(address(cToken));\r\n if (supplyCap != 0) {\r\n uint256 currentExchangeRate = cToken.exchangeRateCurrent();\r\n uint256 _totalSupply = cToken.totalSupply();\r\n uint256 totalSupplies = (_totalSupply * currentExchangeRate) / 1e18; /// exchange rate is scaled up by 1e18, so needs to be divided off to get accurate total supply\r\n\r\n // uint256 totalCash = MToken(address(mToken)).getCash();\r\n // uint256 totalBorrows = MToken(address(mToken)).totalBorrows();\r\n // uint256 totalReserves = MToken(address(mToken)).totalReserves();\r\n\r\n // // (Pseudocode) totalSupplies = totalCash + totalBorrows - totalReserves\r\n // uint256 totalSupplies = (totalCash + totalBorrows) - totalReserves;\r\n\r\n // supply cap is 3\r\n // total supplies is 1\r\n /// no room for additional supplies\r\n\r\n // supply cap is 3\r\n // total supplies is 0\r\n /// room for 1 additional supplies\r\n\r\n // supply cap is 4\r\n // total supplies is 1\r\n /// room for 1 additional supplies\r\n\r\n /// total supplies could exceed supply cap as interest accrues, need to handle this edge case\r\n /// going to subtract 2 from supply cap to account for rounding errors\r\n if (totalSupplies + 2 >= supplyCap) {\r\n return 0;\r\n }\r\n\r\n return supplyCap - totalSupplies - 2;\r\n }\r\n\r\n return type(uint256).max;\r\n }\r\n\r\n /// @notice Returns the maximum amount of tokens that can be supplied\r\n /// no way for this function to ever revert unless comptroller or mToken is broken\r\n /// @dev accrue interest must be called before this function is called, otherwise\r\n /// an outdated value will be fetched, and the returned value will be incorrect\r\n /// (greater than actual amount available to be minted will be returned)\r\n function maxMint(address) public view override returns (uint256) {\r\n uint256 mintAmount = maxDeposit(address(0));\r\n\r\n return mintAmount == type(uint256).max ? mintAmount : convertToShares(mintAmount);\r\n }\r\n\r\n /// @notice maximum amount of underlying tokens that can be withdrawn\r\n /// @param owner The address that owns the shares\r\n function maxWithdraw(address owner) public view override returns (uint256) {\r\n uint256 cash = cToken.getCash();\r\n uint256 assetsBalance = convertToAssets(balanceOf(owner));\r\n return cash < assetsBalance ? cash : assetsBalance;\r\n }\r\n\r\n /// @notice maximum amount of shares that can be withdrawn\r\n /// @param owner The address that owns the shares\r\n function maxRedeem(address owner) public view override returns (uint256) {\r\n uint256 cash = cToken.getCash();\r\n uint256 cashInShares = convertToShares(cash);\r\n uint256 shareBalance = balanceOf(owner);\r\n return cashInShares < shareBalance ? cashInShares : shareBalance;\r\n }\r\n\r\n /* ========== REWARDS FUNCTIONS ========== */\r\n\r\n function updateRewardsRecipient(address newRewardsRecipient) external onlyOwner {\r\n emit UpdatedRewardsRecipient(rewardsRecipient, newRewardsRecipient);\r\n rewardsRecipient = newRewardsRecipient;\r\n }\r\n\r\n function claimRewards() external {\r\n (address[] memory tokens, uint256[] memory amounts) = flywheelLensRouter.claimAllRewardTokens(address(this));\r\n for (uint256 i = 0; i < tokens.length; i++) {\r\n _asset().safeTransfer(rewardsRecipient, amounts[i]);\r\n }\r\n }\r\n\r\n /* ========== EMERGENCY FUNCTIONS ========== */\r\n\r\n // Should withdraw all funds from the strategy and pause the contract\r\n function emergencyWithdrawAndPause() external override onlyOwner {\r\n _pause();\r\n }\r\n\r\n function unpause() external override onlyOwner {\r\n _unpause();\r\n }\r\n\r\n /* ========== INTERNAL HOOKS LOGIC ========== */\r\n\r\n function beforeWithdraw(uint256 assets, uint256 /*shares*/) internal override {\r\n /// -----------------------------------------------------------------------\r\n /// Withdraw assets from Ionic\r\n /// -----------------------------------------------------------------------\r\n\r\n uint256 errorCode = cToken.redeemUnderlying(assets);\r\n if (errorCode != uint256(ComptrollerErrorReporter.Error.NO_ERROR)) {\r\n revert IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error(errorCode));\r\n }\r\n }\r\n\r\n function afterDeposit(uint256 assets, uint256 /*shares*/) internal override {\r\n /// -----------------------------------------------------------------------\r\n /// Deposit assets into Ionic\r\n /// -----------------------------------------------------------------------\r\n\r\n // approve to cToken\r\n _asset().safeApprove(address(cToken), assets);\r\n\r\n // deposit into cToken\r\n uint256 errorCode = cToken.mint(assets);\r\n if (errorCode != uint256(ComptrollerErrorReporter.Error.NO_ERROR)) {\r\n revert IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error(errorCode));\r\n }\r\n }\r\n}\r\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\n\r\nimport \"./liquidators/IRedemptionStrategy.sol\";\r\nimport \"./liquidators/IFundsConversionStrategy.sol\";\r\nimport \"./ILiquidator.sol\";\r\n\r\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\r\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\r\nimport \"./external/pyth/IExpressRelay.sol\";\r\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\r\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\r\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\r\n\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\n\r\nimport \"./PoolLens.sol\";\r\n\r\n/**\r\n * @title IonicUniV3Liquidator\r\n * @author Veliko Minkov (https://github.com/vminkov)\r\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\r\n */\r\ncontract IonicUniV3Liquidator is\r\n OwnableUpgradeable,\r\n ILiquidator,\r\n IUniswapV3FlashCallback,\r\n IExpressRelayFeeReceiver,\r\n IFlashLoanReceiver\r\n{\r\n using AddressUpgradeable for address payable;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\r\n /**\r\n * @dev Cached liquidator profit exchange source.\r\n * ERC20 token address or the zero address for NATIVE.\r\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\r\n */\r\n address private _liquidatorProfitExchangeSource;\r\n\r\n /**\r\n * @dev Cached flash swap amount.\r\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\r\n */\r\n uint256 private _flashSwapAmount;\r\n\r\n /**\r\n * @dev Cached flash swap token.\r\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\r\n */\r\n address private _flashSwapToken;\r\n\r\n address public W_NATIVE_ADDRESS;\r\n mapping(address => bool) public redemptionStrategiesWhitelist;\r\n IUniswapV3Quoter public quoter;\r\n\r\n /**\r\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\r\n */\r\n IExpressRelay public expressRelay;\r\n /**\r\n * @dev Pool Lens.\r\n */\r\n PoolLens public lens;\r\n /**\r\n * @dev Health Factor below which PER permissioning is bypassed.\r\n */\r\n uint256 public healthFactorThreshold;\r\n\r\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\r\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\r\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\r\n _;\r\n }\r\n\r\n function initialize(address _wtoken, address _quoter) external initializer {\r\n __Ownable_init();\r\n W_NATIVE_ADDRESS = _wtoken;\r\n quoter = IUniswapV3Quoter(_quoter);\r\n }\r\n\r\n /**\r\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\r\n * @param borrower The borrower's Ethereum address.\r\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\r\n * @param cErc20 The borrowed cErc20 to repay.\r\n * @param cTokenCollateral The cToken collateral to be liquidated.\r\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\r\n */\r\n function _safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) internal returns (uint256) {\r\n // Transfer tokens in, approve to cErc20, and liquidate borrow\r\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\r\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\r\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\r\n underlying.approve(address(cErc20), repayAmount);\r\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\r\n\r\n // Redeem seized cTokens for underlying asset\r\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n\r\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\r\n }\r\n\r\n function safeLiquidate(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\r\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\r\n }\r\n\r\n function safeLiquidatePyth(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n uint256 minOutputAmount\r\n ) external returns (uint256) {\r\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\r\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\r\n }\r\n\r\n function safeLiquidateWithAggregator(\r\n address borrower,\r\n uint256 repayAmount,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n address aggregatorTarget,\r\n bytes memory aggregatorData\r\n ) external {\r\n // Transfer tokens in, approve to cErc20, and liquidate borrow\r\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\r\n cErc20.flash(\r\n repayAmount,\r\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\r\n );\r\n }\r\n\r\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\r\n (\r\n address borrower,\r\n ICErc20 cErc20,\r\n ICErc20 cTokenCollateral,\r\n address aggregatorTarget,\r\n bytes memory aggregatorData,\r\n address liquidator\r\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\r\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\r\n underlyingBorrow.approve(address(cErc20), amount);\r\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\r\n\r\n // Redeem seized cTokens for underlying asset\r\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\r\n {\r\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\r\n\r\n // Call the aggregator\r\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\r\n (bool success, ) = aggregatorTarget.call(aggregatorData);\r\n require(success, \"Aggregator call failed\");\r\n }\r\n\r\n // receive profits\r\n {\r\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\r\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\r\n uint256 profitBorrow = receivedAmount - amount;\r\n if (profitBorrow > 0) {\r\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\r\n }\r\n\r\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\r\n if (profitCollateral > 0) {\r\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\r\n }\r\n }\r\n\r\n // pay back flashloan\r\n underlyingBorrow.approve(address(cErc20), amount);\r\n }\r\n\r\n /**\r\n * @dev Transfers seized funds to the sender.\r\n * @param erc20Contract The address of the token to transfer.\r\n * @param minOutputAmount The minimum amount to transfer.\r\n */\r\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\r\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\r\n uint256 seizedOutputAmount = token.balanceOf(address(this));\r\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\r\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\r\n\r\n return seizedOutputAmount;\r\n }\r\n\r\n function safeLiquidateToTokensWithFlashLoan(\r\n LiquidateToTokensWithFlashSwapVars calldata vars\r\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\r\n // Input validation\r\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\r\n\r\n // we want to calculate the needed flashSwapAmount on-chain to\r\n // avoid errors due to changing market conditions\r\n // between the time of calculating and including the tx in a block\r\n uint256 fundingAmount = vars.repayAmount;\r\n IERC20Upgradeable fundingToken;\r\n if (vars.debtFundingStrategies.length > 0) {\r\n require(\r\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\r\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\r\n );\r\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\r\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\r\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\r\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\r\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\r\n }\r\n } else {\r\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\r\n }\r\n\r\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\r\n _flashSwapAmount = fundingAmount;\r\n _flashSwapToken = address(fundingToken);\r\n\r\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\r\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\r\n flashSwapPool.flash(\r\n address(this),\r\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\r\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\r\n msg.data\r\n );\r\n\r\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\r\n }\r\n\r\n /**\r\n * @dev Receives NATIVE from liquidations and flashloans.\r\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\r\n */\r\n receive() external payable {\r\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\r\n }\r\n\r\n /**\r\n * @notice receiveAuctionProceedings function - receives native token from the express relay\r\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\r\n */\r\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\r\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\r\n }\r\n\r\n function withdrawAll() external onlyOwner {\r\n uint256 balance = address(this).balance;\r\n require(balance > 0, \"No Ether left to withdraw\");\r\n\r\n // Transfer all Ether to the owner\r\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\r\n require(sent, \"Failed to send Ether\");\r\n }\r\n\r\n /**\r\n * @dev Callback function for Uniswap flashloans.\r\n */\r\n\r\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\r\n uniswapV3FlashCallback(fee0, fee1, data);\r\n }\r\n\r\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\r\n uniswapV3FlashCallback(fee0, fee1, data);\r\n }\r\n\r\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\r\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\r\n // Decode params\r\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\r\n\r\n // Post token flashloan\r\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\r\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\r\n }\r\n\r\n /**\r\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\r\n */\r\n function postFlashLoanTokens(\r\n LiquidateToTokensWithFlashSwapVars memory vars,\r\n uint256 fee0,\r\n uint256 fee1\r\n ) private returns (address) {\r\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\r\n uint256 debtRepaymentAmount = _flashSwapAmount;\r\n\r\n if (vars.debtFundingStrategies.length > 0) {\r\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\r\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\r\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\r\n debtRepaymentToken,\r\n debtRepaymentAmount,\r\n vars.debtFundingStrategies[i - 1],\r\n vars.debtFundingStrategiesData[i - 1]\r\n );\r\n }\r\n }\r\n\r\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\r\n {\r\n address underlyingBorrow = vars.cErc20.underlying();\r\n require(\r\n address(debtRepaymentToken) == underlyingBorrow,\r\n \"the debt repayment funds should be converted to the underlying debt token\"\r\n );\r\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\r\n // Approve repayAmount to cErc20\r\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\r\n\r\n // Liquidate borrow\r\n require(\r\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\r\n \"Liquidation failed.\"\r\n );\r\n\r\n // Redeem seized cTokens for underlying asset\r\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\r\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\r\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\r\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\r\n }\r\n\r\n // Repay flashloan\r\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\r\n }\r\n\r\n /**\r\n * @dev Repays token flashloans.\r\n */\r\n function repayTokenFlashLoan(\r\n ICErc20 cTokenCollateral,\r\n IRedemptionStrategy[] memory redemptionStrategies,\r\n bytes[] memory strategyData,\r\n uint256 fee0,\r\n uint256 fee1\r\n ) private returns (address) {\r\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\r\n uint256 flashSwapReturnAmount = _flashSwapAmount;\r\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\r\n flashSwapReturnAmount += fee0;\r\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\r\n flashSwapReturnAmount += fee1;\r\n } else {\r\n revert(\"wrong pool or _flashSwapToken\");\r\n }\r\n\r\n // Swap cTokenCollateral for cErc20 via Uniswap\r\n // Check underlying collateral seized\r\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\r\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\r\n\r\n // Redeem custom collateral if liquidation strategy is set\r\n if (redemptionStrategies.length > 0) {\r\n require(\r\n redemptionStrategies.length == strategyData.length,\r\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\r\n );\r\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\r\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\r\n underlyingCollateral,\r\n underlyingCollateralSeized,\r\n redemptionStrategies[i],\r\n strategyData[i]\r\n );\r\n }\r\n\r\n // Check if we can repay directly one of the sides with collateral\r\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\r\n // Repay flashloan directly with collateral\r\n uint256 collateralRequired;\r\n if (address(underlyingCollateral) == _flashSwapToken) {\r\n // repay the borrowed asset directly\r\n collateralRequired = flashSwapReturnAmount;\r\n\r\n // Repay flashloan\r\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\r\n } else {\r\n // TODO swap within the same pool and then repay the FL to the pool\r\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\r\n\r\n {\r\n collateralRequired = quoter.quoteExactOutputSingle(\r\n zeroForOne ? pool.token0() : pool.token1(),\r\n zeroForOne ? pool.token1() : pool.token0(),\r\n pool.fee(),\r\n _flashSwapAmount,\r\n 0 // sqrtPriceLimitX96\r\n );\r\n }\r\n require(\r\n collateralRequired <= underlyingCollateralSeized,\r\n \"Token flashloan return amount greater than seized collateral.\"\r\n );\r\n\r\n // Repay flashloan\r\n pool.swap(\r\n address(pool),\r\n zeroForOne,\r\n int256(collateralRequired),\r\n 0, // sqrtPriceLimitX96\r\n \"\"\r\n );\r\n }\r\n\r\n return address(underlyingCollateral);\r\n } else {\r\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\r\n }\r\n }\r\n\r\n /**\r\n * @dev for security reasons only whitelisted redemption strategies may be used.\r\n * Each whitelisted redemption strategy has to be checked to not be able to\r\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\r\n */\r\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\r\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\r\n }\r\n\r\n /**\r\n * @dev for security reasons only whitelisted redemption strategies may be used.\r\n * Each whitelisted redemption strategy has to be checked to not be able to\r\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\r\n */\r\n function _whitelistRedemptionStrategies(\r\n IRedemptionStrategy[] calldata strategies,\r\n bool[] calldata whitelisted\r\n ) external onlyOwner {\r\n require(\r\n strategies.length > 0 && strategies.length == whitelisted.length,\r\n \"list of strategies empty or whitelist does not match its length\"\r\n );\r\n\r\n for (uint256 i = 0; i < strategies.length; i++) {\r\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\r\n }\r\n }\r\n\r\n function setExpressRelay(address _expressRelay) external onlyOwner {\r\n expressRelay = IExpressRelay(_expressRelay);\r\n }\r\n\r\n function setPoolLens(address _poolLens) external onlyOwner {\r\n lens = PoolLens(_poolLens);\r\n }\r\n\r\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\r\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\r\n healthFactorThreshold = _healthFactorThreshold;\r\n }\r\n\r\n /**\r\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\r\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\r\n */\r\n function redeemCustomCollateral(\r\n IERC20Upgradeable underlyingCollateral,\r\n uint256 underlyingCollateralSeized,\r\n IRedemptionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\r\n\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n function convertCustomFunds(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n IFundsConversionStrategy strategy,\r\n bytes memory strategyData\r\n ) private returns (IERC20Upgradeable, uint256) {\r\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\r\n\r\n bytes memory returndata = _functionDelegateCall(\r\n address(strategy),\r\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\r\n );\r\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\r\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\r\n */\r\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\r\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\r\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\r\n */\r\n function _verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n}\r\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"./IRedemptionStrategy.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\ninterface IFundsConversionStrategy is IRedemptionStrategy {\r\n function convert(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\r\n\r\n function estimateInputAmount(\r\n uint256 outputAmount,\r\n bytes memory strategyData\r\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\r\n}\r\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\n/**\r\n * @title IRedemptionStrategy\r\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ninterface IRedemptionStrategy {\r\n /**\r\n * @notice Redeems custom collateral `token` for an underlying token.\r\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\r\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\r\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\r\n * @return outputToken The underlying ERC20 token outputted.\r\n * @return outputAmount The quantity of underlying tokens outputted.\r\n */\r\n function redeem(\r\n IERC20Upgradeable inputToken,\r\n uint256 inputAmount,\r\n bytes memory strategyData\r\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\r\n\r\n function name() external view returns (string memory);\r\n}\r\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"../compound/CTokenInterfaces.sol\";\r\n\r\n/**\r\n * @title BasePriceOracle\r\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\r\n * @dev Implements the `PriceOracle` interface.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ninterface BasePriceOracle {\r\n /**\r\n * @notice Get the price of an underlying asset.\r\n * @param underlying The underlying asset to get the price of.\r\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\r\n * Zero means the price is unavailable.\r\n */\r\n function price(address underlying) external view returns (uint256);\r\n\r\n /**\r\n * @notice Get the underlying price of a cToken asset\r\n * @param cToken The cToken to get the underlying price of\r\n * @return The underlying asset price mantissa (scaled by 1e18).\r\n * Zero means the price is unavailable.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\r\n}\r\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\n\r\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\r\n\r\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\r\n\r\n/**\r\n * @title MasterPriceOracle\r\n * @notice Use a combination of price oracles.\r\n * @dev Implements `PriceOracle`.\r\n * @author David Lucid (https://github.com/davidlucid)\r\n */\r\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\r\n /**\r\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\r\n */\r\n mapping(address => BasePriceOracle) public oracles;\r\n\r\n /**\r\n * @dev Default/fallback `PriceOracle`.\r\n */\r\n BasePriceOracle public defaultOracle;\r\n\r\n /**\r\n * @dev The administrator of this `MasterPriceOracle`.\r\n */\r\n address public admin;\r\n\r\n /**\r\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n */\r\n bool internal noAdminOverwrite;\r\n\r\n /**\r\n * @dev The Wrapped native asset address.\r\n */\r\n address public wtoken;\r\n\r\n /**\r\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\r\n */\r\n mapping(address => BasePriceOracle) public fallbackOracles;\r\n\r\n /**\r\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n */\r\n function canAdminOverwrite() external view returns (bool) {\r\n return !noAdminOverwrite;\r\n }\r\n\r\n /**\r\n * @dev Event emitted when `admin` is changed.\r\n */\r\n event NewAdmin(address oldAdmin, address newAdmin);\r\n\r\n /**\r\n * @dev Event emitted when the default oracle is changed.\r\n */\r\n event NewDefaultOracle(address oldOracle, address newOracle);\r\n\r\n /**\r\n * @dev Event emitted when an underlying token's oracle is changed.\r\n */\r\n event NewOracle(address underlying, address oldOracle, address newOracle);\r\n\r\n /**\r\n * @dev Initialize state variables.\r\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\r\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\r\n * @param _defaultOracle The default `PriceOracle` contract to use.\r\n * @param _admin The admin who can assign oracles to underlying tokens.\r\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\r\n * @param _wtoken The Wrapped native asset address\r\n */\r\n function initialize(\r\n address[] memory underlyings,\r\n BasePriceOracle[] memory _oracles,\r\n BasePriceOracle _defaultOracle,\r\n address _admin,\r\n bool _canAdminOverwrite,\r\n address _wtoken\r\n ) external initializer {\r\n // Input validation\r\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\r\n\r\n // Initialize state variables\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n BasePriceOracle newOracle = _oracles[i];\r\n oracles[underlying] = newOracle;\r\n emit NewOracle(underlying, address(0), address(newOracle));\r\n }\r\n\r\n defaultOracle = _defaultOracle;\r\n admin = _admin;\r\n noAdminOverwrite = !_canAdminOverwrite;\r\n wtoken = _wtoken;\r\n }\r\n\r\n /**\r\n * @dev Sets `_oracles` for `underlyings`.\r\n */\r\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == _oracles.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // Assign oracles to underlying tokens\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n address oldOracle = address(oracles[underlying]);\r\n if (noAdminOverwrite)\r\n require(\r\n oldOracle == address(0),\r\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\r\n );\r\n BasePriceOracle newOracle = _oracles[i];\r\n oracles[underlying] = newOracle;\r\n emit NewOracle(underlying, oldOracle, address(newOracle));\r\n }\r\n }\r\n\r\n /**\r\n * @dev Sets `_oracles` for `underlyings`.\r\n */\r\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\r\n // Input validation\r\n require(\r\n underlyings.length > 0 && underlyings.length == _oracles.length,\r\n \"Lengths of both arrays must be equal and greater than 0.\"\r\n );\r\n\r\n // Assign oracles to underlying tokens\r\n for (uint256 i = 0; i < underlyings.length; i++) {\r\n address underlying = underlyings[i];\r\n address oldOracle = address(fallbackOracles[underlying]);\r\n if (noAdminOverwrite)\r\n require(\r\n oldOracle == address(0),\r\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\r\n );\r\n BasePriceOracle newOracle = _oracles[i];\r\n fallbackOracles[underlying] = newOracle;\r\n emit NewOracle(underlying, oldOracle, address(newOracle));\r\n }\r\n }\r\n\r\n /**\r\n * @dev Changes the default price oracle\r\n */\r\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\r\n BasePriceOracle oldOracle = defaultOracle;\r\n defaultOracle = newOracle;\r\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\r\n }\r\n\r\n /**\r\n * @dev Changes the admin and emits an event.\r\n */\r\n function changeAdmin(address newAdmin) external onlyAdmin {\r\n address oldAdmin = admin;\r\n admin = newAdmin;\r\n emit NewAdmin(oldAdmin, newAdmin);\r\n }\r\n\r\n /**\r\n * @dev Modifier that checks if `msg.sender == admin`.\r\n */\r\n modifier onlyAdmin() {\r\n require(msg.sender == admin, \"Sender is not the admin.\");\r\n _;\r\n }\r\n\r\n /**\r\n * @notice Returns the price in ETH of the token underlying `cToken`.\r\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\r\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\r\n */\r\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\r\n // Get underlying ERC20 token address\r\n address underlying = address(ICErc20(address(cToken)).underlying());\r\n\r\n if (underlying == wtoken) return 1e18;\r\n\r\n BasePriceOracle oracle = oracles[underlying];\r\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\r\n\r\n if (address(oracle) != address(0)) {\r\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\r\n if (underlyingPrice == 0) {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\r\n } else {\r\n return underlyingPrice;\r\n }\r\n } catch {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\r\n }\r\n } else {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\r\n }\r\n revert(\"Price oracle not found for this underlying token address.\");\r\n }\r\n\r\n /**\r\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\r\n */\r\n function price(address underlying) public view override returns (uint256) {\r\n // Return 1e18 for WETH\r\n if (underlying == wtoken) return 1e18;\r\n\r\n // Get underlying price from assigned oracle\r\n BasePriceOracle oracle = oracles[underlying];\r\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\r\n\r\n if (address(oracle) != address(0)) {\r\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\r\n if (underlyingPrice == 0) {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\r\n } else {\r\n return underlyingPrice;\r\n }\r\n } catch {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\r\n }\r\n } else {\r\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\r\n }\r\n revert(\"Price oracle not found for this underlying token address.\");\r\n }\r\n}\r\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\r\nimport { Unitroller } from \"./compound/Unitroller.sol\";\r\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\r\nimport \"./ionic/DiamondExtension.sol\";\r\n\r\n/**\r\n * @title PoolDirectory\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\r\n */\r\ncontract PoolDirectory is SafeOwnableUpgradeable {\r\n /**\r\n * @dev Initializes a deployer whitelist if desired.\r\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\r\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\r\n */\r\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\r\n __SafeOwnable_init(msg.sender);\r\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\r\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\r\n }\r\n\r\n /**\r\n * @dev Struct for a Ionic interest rate pool.\r\n */\r\n struct Pool {\r\n string name;\r\n address creator;\r\n address comptroller;\r\n uint256 blockPosted;\r\n uint256 timestampPosted;\r\n }\r\n\r\n /**\r\n * @dev Array of Ionic interest rate pools.\r\n */\r\n Pool[] public pools;\r\n\r\n /**\r\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\r\n */\r\n mapping(address => uint256[]) private _poolsByAccount;\r\n\r\n /**\r\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\r\n */\r\n mapping(address => bool) public poolExists;\r\n\r\n /**\r\n * @dev Emitted when a new Ionic pool is added to the directory.\r\n */\r\n event PoolRegistered(uint256 index, Pool pool);\r\n\r\n /**\r\n * @dev Booleans indicating if the deployer whitelist is enforced.\r\n */\r\n bool public enforceDeployerWhitelist;\r\n\r\n /**\r\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\r\n */\r\n mapping(address => bool) public deployerWhitelist;\r\n\r\n /**\r\n * @dev Controls if the deployer whitelist is to be enforced.\r\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\r\n */\r\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\r\n enforceDeployerWhitelist = enforce;\r\n }\r\n\r\n /**\r\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\r\n * @param deployers Array of Ethereum accounts to be whitelisted.\r\n * @param status Whether to add or remove the accounts.\r\n */\r\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\r\n require(deployers.length > 0, \"No deployers supplied.\");\r\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\r\n }\r\n\r\n /**\r\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\r\n * @param name The name of the pool.\r\n * @param comptroller The pool's Comptroller proxy contract address.\r\n * @return The index of the registered Ionic pool.\r\n */\r\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\r\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\r\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\r\n require(bytes(name).length <= 100, \"No pool name supplied.\");\r\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\r\n pools.push(pool);\r\n _poolsByAccount[msg.sender].push(pools.length - 1);\r\n poolExists[comptroller] = true;\r\n emit PoolRegistered(pools.length - 1, pool);\r\n return pools.length - 1;\r\n }\r\n\r\n function _deprecatePool(address comptroller) external onlyOwner {\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller == comptroller) {\r\n _deprecatePool(i);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n function _deprecatePool(uint256 index) public onlyOwner {\r\n Pool storage ionicPool = pools[index];\r\n\r\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\r\n\r\n // swap with the last pool of the creator and delete\r\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\r\n for (uint256 i = 0; i < creatorPools.length; i++) {\r\n if (creatorPools[i] == index) {\r\n creatorPools[i] = creatorPools[creatorPools.length - 1];\r\n creatorPools.pop();\r\n break;\r\n }\r\n }\r\n\r\n // leave it to true to deny the re-registering of the same pool\r\n poolExists[ionicPool.comptroller] = true;\r\n\r\n // nullify the storage\r\n ionicPool.comptroller = address(0);\r\n ionicPool.creator = address(0);\r\n ionicPool.name = \"\";\r\n ionicPool.blockPosted = 0;\r\n ionicPool.timestampPosted = 0;\r\n }\r\n\r\n /**\r\n * @dev Deploys a new Ionic pool and adds to the directory.\r\n * @param name The name of the pool.\r\n * @param implementation The Comptroller implementation contract address.\r\n * @param constructorData Encoded construction data for `Unitroller constructor()`\r\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\r\n * @param closeFactor The pool's close factor (scaled by 1e18).\r\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\r\n * @param priceOracle The pool's PriceOracle contract address.\r\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\r\n */\r\n function deployPool(\r\n string memory name,\r\n address implementation,\r\n bytes calldata constructorData,\r\n bool enforceWhitelist,\r\n uint256 closeFactor,\r\n uint256 liquidationIncentive,\r\n address priceOracle\r\n ) external returns (uint256, address) {\r\n // Input validation\r\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\r\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\r\n\r\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\r\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\r\n address proxy = Create2Upgradeable.deploy(\r\n 0,\r\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\r\n unitrollerCreationCode\r\n );\r\n\r\n // Setup the pool\r\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\r\n // Set up the extensions\r\n comptrollerProxy._upgrade();\r\n\r\n // Set pool parameters\r\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\r\n require(\r\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\r\n \"Failed to set pool liquidation incentive.\"\r\n );\r\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\r\n\r\n // Whitelist\r\n if (enforceWhitelist)\r\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\r\n\r\n // Make msg.sender the admin\r\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\r\n\r\n // Register the pool with this PoolDirectory\r\n return (_registerPool(name, proxy), proxy);\r\n }\r\n\r\n /**\r\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\r\n uint256 count = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) count++;\r\n }\r\n\r\n Pool[] memory activePools = new Pool[](count);\r\n uint256[] memory poolIds = new uint256[](count);\r\n\r\n uint256 index = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) {\r\n poolIds[index] = i;\r\n activePools[index] = pools[i];\r\n index++;\r\n }\r\n }\r\n\r\n return (poolIds, activePools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all Ionic pools' data.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getAllPools() public view returns (Pool[] memory) {\r\n uint256 count = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) count++;\r\n }\r\n\r\n Pool[] memory result = new Pool[](count);\r\n\r\n uint256 index = 0;\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n if (pools[i].comptroller != address(0)) {\r\n result[index++] = pools[i];\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all public Ionic pool indexes and data.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (enforceWhitelist) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory publicPools = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (enforceWhitelist) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n publicPools[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, publicPools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all public Ionic pool indexes and data.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\r\n if (!isUsing) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\r\n if (!isUsing) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n poolsOfUser[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, poolsOfUser);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\r\n */\r\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\r\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\r\n (, Pool[] memory activePools) = getActivePools();\r\n\r\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\r\n indexes[i] = _poolsByAccount[account][i];\r\n accountPools[i] = activePools[_poolsByAccount[account][i]];\r\n }\r\n\r\n return (indexes, accountPools);\r\n }\r\n\r\n /**\r\n * @notice Modify existing Ionic pool name.\r\n */\r\n function setPoolName(uint256 index, string calldata name) external {\r\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\r\n require(\r\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\r\n \"!permission\"\r\n );\r\n pools[index].name = name;\r\n }\r\n\r\n /**\r\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\r\n */\r\n mapping(address => bool) public adminWhitelist;\r\n\r\n /**\r\n * @dev used as salt for the creation of new pools\r\n */\r\n uint256 public poolsCounter;\r\n\r\n /**\r\n * @dev Event emitted when the admin whitelist is updated.\r\n */\r\n event AdminWhitelistUpdated(address[] admins, bool status);\r\n\r\n /**\r\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\r\n * @param admins Array of Ethereum accounts to be whitelisted.\r\n * @param status Whether to add or remove the accounts.\r\n */\r\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\r\n require(admins.length > 0, \"No admins supplied.\");\r\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\r\n emit AdminWhitelistUpdated(admins, status);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n\r\n try comptroller.admin() returns (address admin) {\r\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory publicPools = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n\r\n try comptroller.admin() returns (address admin) {\r\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n publicPools[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, publicPools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\r\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getVerifiedPoolsOfWhitelistedAccount(\r\n address account\r\n ) external view returns (uint256[] memory, Pool[] memory) {\r\n uint256 arrayLength = 0;\r\n (, Pool[] memory activePools) = getActivePools();\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n\r\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\r\n } catch {}\r\n\r\n arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < activePools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\r\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\r\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\r\n } catch {}\r\n\r\n indexes[index] = i;\r\n accountWhitelistedPools[index] = activePools[i];\r\n index++;\r\n }\r\n\r\n return (indexes, accountWhitelistedPools);\r\n }\r\n}\r\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.8.0;\r\n\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\r\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\r\n\r\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\r\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\r\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\r\n\r\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\r\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\r\n\r\n/**\r\n * @title PoolLens\r\n * @author David Lucid (https://github.com/davidlucid)\r\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\r\n */\r\ncontract PoolLens is Initializable {\r\n error ComptrollerError(uint256 errCode);\r\n\r\n /**\r\n * @notice Initialize the `PoolDirectory` contract object.\r\n * @param _directory The PoolDirectory\r\n * @param _name Name for the nativeToken\r\n * @param _symbol Symbol for the nativeToken\r\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\r\n * @param _hardcodedNames Harcoded name for these tokens\r\n * @param _hardcodedSymbols Harcoded symbol for these tokens\r\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\r\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\r\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\r\n */\r\n function initialize(\r\n PoolDirectory _directory,\r\n string memory _name,\r\n string memory _symbol,\r\n address[] memory _hardcodedAddresses,\r\n string[] memory _hardcodedNames,\r\n string[] memory _hardcodedSymbols,\r\n string[] memory _uniswapLPTokenNames,\r\n string[] memory _uniswapLPTokenSymbols,\r\n string[] memory _uniswapLPTokenDisplayNames\r\n ) public initializer {\r\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\r\n require(\r\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\r\n \"Hardcoded addresses lengths not equal.\"\r\n );\r\n require(\r\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\r\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\r\n \"Uniswap LP token names lengths not equal.\"\r\n );\r\n\r\n directory = _directory;\r\n name = _name;\r\n symbol = _symbol;\r\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\r\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\r\n }\r\n\r\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\r\n uniswapData.push(\r\n UniswapData({\r\n name: _uniswapLPTokenNames[i],\r\n symbol: _uniswapLPTokenSymbols[i],\r\n displayName: _uniswapLPTokenDisplayNames[i]\r\n })\r\n );\r\n }\r\n }\r\n\r\n string public name;\r\n string public symbol;\r\n\r\n struct TokenData {\r\n string name;\r\n string symbol;\r\n }\r\n mapping(address => TokenData) hardcoded;\r\n\r\n struct UniswapData {\r\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\r\n string symbol; // ie \"UNI-V2\" or \"SLP\"\r\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\r\n }\r\n UniswapData[] uniswapData;\r\n\r\n /**\r\n * @notice `PoolDirectory` contract object.\r\n */\r\n PoolDirectory public directory;\r\n\r\n /**\r\n * @dev Struct for Ionic pool summary data.\r\n */\r\n struct IonicPoolData {\r\n uint256 totalSupply;\r\n uint256 totalBorrow;\r\n address[] underlyingTokens;\r\n string[] underlyingSymbols;\r\n bool whitelistedAdmin;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPublicPoolsWithData()\r\n external\r\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\r\n {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\r\n return (indexes, publicPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPublicPoolsByVerificationWithData(\r\n bool whitelistedAdmin\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\r\n whitelistedAdmin\r\n );\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\r\n return (indexes, publicPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolsByAccountWithData(\r\n address account\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\r\n return (indexes, accountPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolsOIonicrWithData(\r\n address user\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\r\n return (indexes, userPools, data, errored);\r\n }\r\n\r\n /**\r\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\r\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\r\n bool[] memory errored = new bool[](pools.length);\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\r\n uint256 _totalSupply,\r\n uint256 _totalBorrow,\r\n address[] memory _underlyingTokens,\r\n string[] memory _underlyingSymbols,\r\n bool _whitelistedAdmin\r\n ) {\r\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\r\n } catch {\r\n errored[i] = true;\r\n }\r\n }\r\n\r\n return (data, errored);\r\n }\r\n\r\n /**\r\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\r\n */\r\n function getPoolSummary(\r\n IonicComptroller comptroller\r\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\r\n uint256 totalBorrow = 0;\r\n uint256 totalSupply = 0;\r\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\r\n address[] memory underlyingTokens = new address[](cTokens.length);\r\n string[] memory underlyingSymbols = new string[](cTokens.length);\r\n BasePriceOracle oracle = comptroller.oracle();\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n ICErc20 cToken = cTokens[i];\r\n (bool isListed, ) = comptroller.markets(address(cToken));\r\n if (!isListed) continue;\r\n cToken.accrueInterest();\r\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\r\n uint256 assetTotalSupply = cToken.getCash() +\r\n assetTotalBorrow -\r\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\r\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\r\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\r\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\r\n\r\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\r\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\r\n }\r\n\r\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\r\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\r\n }\r\n\r\n /**\r\n * @dev Struct for a Ionic pool asset.\r\n */\r\n struct PoolAsset {\r\n address cToken;\r\n address underlyingToken;\r\n string underlyingName;\r\n string underlyingSymbol;\r\n uint256 underlyingDecimals;\r\n uint256 underlyingBalance;\r\n uint256 supplyRatePerBlock;\r\n uint256 borrowRatePerBlock;\r\n uint256 totalSupply;\r\n uint256 totalBorrow;\r\n uint256 supplyBalance;\r\n uint256 borrowBalance;\r\n uint256 liquidity;\r\n bool membership;\r\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\r\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\r\n address oracle;\r\n uint256 collateralFactor;\r\n uint256 reserveFactor;\r\n uint256 adminFee;\r\n uint256 ionicFee;\r\n bool borrowGuardianPaused;\r\n bool mintGuardianPaused;\r\n }\r\n\r\n /**\r\n * @notice Returns data on the specified assets of the specified Ionic pool.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\r\n * @param cTokens The cToken contract addresses of the assets to query.\r\n * @param user The user for which to get account data.\r\n * @return An array of Ionic pool assets.\r\n */\r\n function getPoolAssetsWithData(\r\n IonicComptroller comptroller,\r\n ICErc20[] memory cTokens,\r\n address user\r\n ) internal returns (PoolAsset[] memory) {\r\n uint256 arrayLength = 0;\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\r\n if (isListed) arrayLength++;\r\n }\r\n\r\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\r\n uint256 index = 0;\r\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\r\n\r\n for (uint256 i = 0; i < cTokens.length; i++) {\r\n // Check if market is listed and get collateral factor\r\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\r\n if (!isListed) continue;\r\n\r\n // Start adding data to PoolAsset\r\n PoolAsset memory asset;\r\n ICErc20 cToken = cTokens[i];\r\n asset.cToken = address(cToken);\r\n\r\n cToken.accrueInterest();\r\n\r\n // Get underlying asset data\r\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\r\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\r\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\r\n asset.underlyingDecimals = underlying.decimals();\r\n asset.underlyingBalance = underlying.balanceOf(user);\r\n\r\n // Get cToken data\r\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\r\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\r\n asset.liquidity = cToken.getCash();\r\n asset.totalBorrow = cToken.totalBorrowsCurrent();\r\n asset.totalSupply =\r\n asset.liquidity +\r\n asset.totalBorrow -\r\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\r\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\r\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\r\n asset.membership = comptroller.checkMembership(user, cToken);\r\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\r\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\r\n\r\n // Get oracle for this cToken\r\n asset.oracle = address(oracle);\r\n\r\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\r\n asset.oracle = address(_oracle);\r\n } catch {}\r\n\r\n // More cToken data\r\n asset.collateralFactor = collateralFactorMantissa;\r\n asset.reserveFactor = cToken.reserveFactorMantissa();\r\n asset.adminFee = cToken.adminFeeMantissa();\r\n asset.ionicFee = cToken.ionicFeeMantissa();\r\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\r\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\r\n\r\n // Add to assets array and increment index\r\n detailedAssets[index] = asset;\r\n index++;\r\n }\r\n\r\n return (detailedAssets);\r\n }\r\n\r\n function getBorrowCapsPerCollateral(\r\n ICErc20 borrowedAsset,\r\n IonicComptroller comptroller\r\n )\r\n internal\r\n view\r\n returns (\r\n address[] memory collateral,\r\n uint256[] memory borrowCapsAgainstCollateral,\r\n bool[] memory borrowingBlacklistedAgainstCollateral\r\n )\r\n {\r\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\r\n\r\n collateral = new address[](poolMarkets.length);\r\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\r\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\r\n\r\n for (uint256 i = 0; i < poolMarkets.length; i++) {\r\n address collateralAddress = address(poolMarkets[i]);\r\n if (collateralAddress != address(borrowedAsset)) {\r\n collateral[i] = collateralAddress;\r\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\r\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\r\n address(borrowedAsset),\r\n collateralAddress\r\n );\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @notice Returns the `name` and `symbol` of `token`.\r\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\r\n * @param token An ERC20 token contract object.\r\n * @return The `name` and `symbol`.\r\n */\r\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\r\n // i.e. MKR is a DSToken and uses bytes32\r\n if (bytes(hardcoded[token].symbol).length != 0) {\r\n return (hardcoded[token].name, hardcoded[token].symbol);\r\n }\r\n\r\n // Get name and symbol from token contract\r\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\r\n string memory _name = tokenContract.name();\r\n string memory _symbol = tokenContract.symbol();\r\n\r\n return (_name, _symbol);\r\n }\r\n\r\n /**\r\n * @notice Returns the assets of the specified Ionic pool.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\r\n * @return An array of Ionic pool assets.\r\n */\r\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\r\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\r\n }\r\n\r\n /**\r\n * @dev Struct for a Ionic pool user.\r\n */\r\n struct IonicPoolUser {\r\n address account;\r\n uint256 totalBorrow;\r\n uint256 totalCollateral;\r\n uint256 health;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of PoolAsset for a specific user\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\r\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\r\n return assets;\r\n }\r\n\r\n /**\r\n * @notice returns the total supply cap for each asset in the pool\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\r\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\r\n\r\n address[] memory assets = new address[](poolMarkets.length);\r\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\r\n for (uint256 i = 0; i < poolMarkets.length; i++) {\r\n assets[i] = address(poolMarkets[i]);\r\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\r\n }\r\n\r\n return (assets, supplyCapsPerAsset);\r\n }\r\n\r\n /**\r\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getSupplyCapsDataForPool(\r\n IonicComptroller comptroller\r\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\r\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\r\n\r\n address[] memory assets = new address[](poolMarkets.length);\r\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\r\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\r\n for (uint256 i = 0; i < poolMarkets.length; i++) {\r\n assets[i] = address(poolMarkets[i]);\r\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\r\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\r\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\r\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\r\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\r\n }\r\n\r\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\r\n }\r\n\r\n /**\r\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getBorrowCapsForAsset(\r\n ICErc20 asset\r\n )\r\n public\r\n view\r\n returns (\r\n address[] memory collateral,\r\n uint256[] memory borrowCapsPerCollateral,\r\n bool[] memory collateralBlacklisted,\r\n uint256 totalBorrowCap\r\n )\r\n {\r\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\r\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\r\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\r\n }\r\n\r\n /**\r\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getBorrowCapsDataForAsset(\r\n ICErc20 asset\r\n )\r\n public\r\n view\r\n returns (\r\n address[] memory collateral,\r\n uint256[] memory borrowCapsPerCollateral,\r\n bool[] memory collateralBlacklisted,\r\n uint256 totalBorrowCap,\r\n uint256 nonWhitelistedTotalBorrows\r\n )\r\n {\r\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\r\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\r\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\r\n uint256 totalBorrows = asset.totalBorrowsCurrent();\r\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\r\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\r\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\r\n * Note that the whitelist does not have to be enforced.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n */\r\n function getWhitelistedPoolsByAccount(\r\n address account\r\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\r\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\r\n uint256 arrayLength = 0;\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n\r\n if (comptroller.whitelist(account)) arrayLength++;\r\n }\r\n\r\n uint256[] memory indexes = new uint256[](arrayLength);\r\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\r\n uint256 index = 0;\r\n\r\n for (uint256 i = 0; i < pools.length; i++) {\r\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\r\n\r\n if (comptroller.whitelist(account)) {\r\n indexes[index] = i;\r\n accountPools[index] = pools[i];\r\n index++;\r\n break;\r\n }\r\n }\r\n\r\n return (indexes, accountPools);\r\n }\r\n\r\n /**\r\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\r\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\r\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\r\n */\r\n function getWhitelistedPoolsByAccountWithData(\r\n address account\r\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\r\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\r\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\r\n return (indexes, accountPools, data, errored);\r\n }\r\n\r\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\r\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\r\n }\r\n\r\n function getHealthFactorHypothetical(\r\n IonicComptroller pool,\r\n address account,\r\n address cTokenModify,\r\n uint256 redeemTokens,\r\n uint256 borrowAmount,\r\n uint256 repayAmount\r\n ) public view returns (uint256) {\r\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\r\n account,\r\n cTokenModify,\r\n redeemTokens,\r\n borrowAmount,\r\n repayAmount\r\n );\r\n\r\n if (err != 0) revert ComptrollerError(err);\r\n\r\n if (shortfall > 0) {\r\n // HF < 1.0\r\n return (collateralValue * 1e18) / (collateralValue + shortfall);\r\n } else {\r\n // HF >= 1.0\r\n if (collateralValue <= liquidity) return type(uint256).max;\r\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/veION/interfaces/IBribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity 0.8.22;\r\n\r\ninterface IBribeRewards {\r\n /// @notice A checkpoint for marking balance\r\n struct Checkpoint {\r\n uint256 timestamp;\r\n uint256 balanceOf;\r\n }\r\n\r\n /// @notice A checkpoint for marking supply\r\n struct SupplyCheckpoint {\r\n uint256 timestamp;\r\n uint256 supply;\r\n }\r\n\r\n struct EarnedVars {\r\n uint256 totalReward;\r\n uint256 reward;\r\n uint256 supplyValue;\r\n uint256 epochBalanceValue;\r\n uint256 currTs;\r\n uint256 index;\r\n uint256 numEpochs;\r\n uint256 overallBalance;\r\n uint256 overallSupply;\r\n uint256 historicalPrice;\r\n }\r\n\r\n error InvalidReward();\r\n error Unauthorized();\r\n error InvalidGauge();\r\n error InvalidEscrowToken();\r\n error SingleTokenExpected();\r\n error InvalidVotingEscrow();\r\n error TokenNotWhitelisted();\r\n error AmountCannotBeZero();\r\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\r\n\r\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\r\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\r\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\r\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\r\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\r\n\r\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\r\n /// @dev Can only be called internally by authorized entities.\r\n /// @param lpToken Address of the liquidity pool token\r\n /// @param amount Amount to be deposited for the veNFT\r\n /// @param tokenId Unique identifier of the veNFT\r\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\r\n\r\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\r\n /// @dev Can only be called internally by authorized entities.\r\n /// @param lpToken Address of the liquidity pool token\r\n /// @param amount Amount to be withdrawn for the veNFT\r\n /// @param tokenId Unique identifier of the veNFT\r\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\r\n\r\n /// @notice Claim the rewards earned by a veNFT holder\r\n /// @param tokenId Unique identifier of the veNFT\r\n /// @param tokens Array of tokens to claim rewards for\r\n function getReward(uint256 tokenId, address[] memory tokens) external;\r\n\r\n /// @notice Notify the contract about new rewards for stakers\r\n /// @param token Address of the reward token\r\n /// @param amount Amount of the reward token to be added\r\n function notifyRewardAmount(address token, uint256 amount) external;\r\n\r\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\r\n /// @dev Timestamp must be in the past or present.\r\n /// @param tokenId The veNFT token ID to check\r\n /// @param lpToken Address of the liquidity pool token\r\n /// @param timestamp The timestamp to get the balance at\r\n /// @return The balance index at the given timestamp\r\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\r\n\r\n /// @notice Get the prior supply index at a specific timestamp\r\n /// @dev Timestamp must be in the past or present.\r\n /// @param timestamp The timestamp to get the supply index at\r\n /// @return The supply index at the given timestamp\r\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\r\n\r\n /// @notice Calculate the rewards earned for a specific token and veNFT\r\n /// @param token Address of the reward token\r\n /// @param tokenId Unique identifier of the veNFT\r\n /// @return Amount of the reward token earned\r\n function earned(address token, uint256 tokenId) external view returns (uint256);\r\n}\r\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\r\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\r\nabstract contract Auth {\r\n event OwnerUpdated(address indexed user, address indexed newOwner);\r\n\r\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\r\n\r\n address public owner;\r\n\r\n Authority public authority;\r\n\r\n constructor(address _owner, Authority _authority) {\r\n owner = _owner;\r\n authority = _authority;\r\n\r\n emit OwnerUpdated(msg.sender, _owner);\r\n emit AuthorityUpdated(msg.sender, _authority);\r\n }\r\n\r\n modifier requiresAuth() virtual {\r\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\r\n\r\n _;\r\n }\r\n\r\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\r\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\r\n\r\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\r\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\r\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\r\n }\r\n\r\n function setAuthority(Authority newAuthority) public virtual {\r\n // We check if the caller is the owner first because we want to ensure they can\r\n // always swap out the authority even if it's reverting or using up a lot of gas.\r\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\r\n\r\n authority = newAuthority;\r\n\r\n emit AuthorityUpdated(msg.sender, newAuthority);\r\n }\r\n\r\n function setOwner(address newOwner) public virtual requiresAuth {\r\n owner = newOwner;\r\n\r\n emit OwnerUpdated(msg.sender, newOwner);\r\n }\r\n}\r\n\r\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\r\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\r\ninterface Authority {\r\n function canCall(\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) external view returns (bool);\r\n}\r\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {Auth, Authority} from \"../Auth.sol\";\r\n\r\n/// @notice Role based Authority that supports up to 256 roles.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\r\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\r\ncontract RolesAuthority is Auth, Authority {\r\n /*//////////////////////////////////////////////////////////////\r\n EVENTS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\r\n\r\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\r\n\r\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n CONSTRUCTOR\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ROLE/USER STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n mapping(address => bytes32) public getUserRoles;\r\n\r\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\r\n\r\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\r\n\r\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\r\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\r\n }\r\n\r\n function doesRoleHaveCapability(\r\n uint8 role,\r\n address target,\r\n bytes4 functionSig\r\n ) public view virtual returns (bool) {\r\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n AUTHORIZATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function canCall(\r\n address user,\r\n address target,\r\n bytes4 functionSig\r\n ) public view virtual override returns (bool) {\r\n return\r\n isCapabilityPublic[target][functionSig] ||\r\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ROLE CAPABILITY CONFIGURATION LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function setPublicCapability(\r\n address target,\r\n bytes4 functionSig,\r\n bool enabled\r\n ) public virtual requiresAuth {\r\n isCapabilityPublic[target][functionSig] = enabled;\r\n\r\n emit PublicCapabilityUpdated(target, functionSig, enabled);\r\n }\r\n\r\n function setRoleCapability(\r\n uint8 role,\r\n address target,\r\n bytes4 functionSig,\r\n bool enabled\r\n ) public virtual requiresAuth {\r\n if (enabled) {\r\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\r\n } else {\r\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\r\n }\r\n\r\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n USER ROLE ASSIGNMENT LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function setUserRole(\r\n address user,\r\n uint8 role,\r\n bool enabled\r\n ) public virtual requiresAuth {\r\n if (enabled) {\r\n getUserRoles[user] |= bytes32(1 << role);\r\n } else {\r\n getUserRoles[user] &= ~bytes32(1 << role);\r\n }\r\n\r\n emit UserRoleUpdated(user, role, enabled);\r\n }\r\n}\r\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\r\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\r\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\r\nabstract contract ERC20 {\r\n /*//////////////////////////////////////////////////////////////\r\n EVENTS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 amount);\r\n\r\n event Approval(address indexed owner, address indexed spender, uint256 amount);\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n METADATA STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n string public name;\r\n\r\n string public symbol;\r\n\r\n uint8 public immutable decimals;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ERC20 STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n uint256 public totalSupply;\r\n\r\n mapping(address => uint256) public balanceOf;\r\n\r\n mapping(address => mapping(address => uint256)) public allowance;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n EIP-2612 STORAGE\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n uint256 internal immutable INITIAL_CHAIN_ID;\r\n\r\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\r\n\r\n mapping(address => uint256) public nonces;\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n CONSTRUCTOR\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n constructor(\r\n string memory _name,\r\n string memory _symbol,\r\n uint8 _decimals\r\n ) {\r\n name = _name;\r\n symbol = _symbol;\r\n decimals = _decimals;\r\n\r\n INITIAL_CHAIN_ID = block.chainid;\r\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ERC20 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function approve(address spender, uint256 amount) public virtual returns (bool) {\r\n allowance[msg.sender][spender] = amount;\r\n\r\n emit Approval(msg.sender, spender, amount);\r\n\r\n return true;\r\n }\r\n\r\n function transfer(address to, uint256 amount) public virtual returns (bool) {\r\n balanceOf[msg.sender] -= amount;\r\n\r\n // Cannot overflow because the sum of all user\r\n // balances can't exceed the max uint256 value.\r\n unchecked {\r\n balanceOf[to] += amount;\r\n }\r\n\r\n emit Transfer(msg.sender, to, amount);\r\n\r\n return true;\r\n }\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) public virtual returns (bool) {\r\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\r\n\r\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\r\n\r\n balanceOf[from] -= amount;\r\n\r\n // Cannot overflow because the sum of all user\r\n // balances can't exceed the max uint256 value.\r\n unchecked {\r\n balanceOf[to] += amount;\r\n }\r\n\r\n emit Transfer(from, to, amount);\r\n\r\n return true;\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n EIP-2612 LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) public virtual {\r\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\r\n\r\n // Unchecked because the only math done is incrementing\r\n // the owner's nonce which cannot realistically overflow.\r\n unchecked {\r\n address recoveredAddress = ecrecover(\r\n keccak256(\r\n abi.encodePacked(\r\n \"\\x19\\x01\",\r\n DOMAIN_SEPARATOR(),\r\n keccak256(\r\n abi.encode(\r\n keccak256(\r\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\r\n ),\r\n owner,\r\n spender,\r\n value,\r\n nonces[owner]++,\r\n deadline\r\n )\r\n )\r\n )\r\n ),\r\n v,\r\n r,\r\n s\r\n );\r\n\r\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\r\n\r\n allowance[recoveredAddress][spender] = value;\r\n }\r\n\r\n emit Approval(owner, spender, value);\r\n }\r\n\r\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\r\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\r\n }\r\n\r\n function computeDomainSeparator() internal view virtual returns (bytes32) {\r\n return\r\n keccak256(\r\n abi.encode(\r\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\r\n keccak256(bytes(name)),\r\n keccak256(\"1\"),\r\n block.chainid,\r\n address(this)\r\n )\r\n );\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n INTERNAL MINT/BURN LOGIC\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function _mint(address to, uint256 amount) internal virtual {\r\n totalSupply += amount;\r\n\r\n // Cannot overflow because the sum of all user\r\n // balances can't exceed the max uint256 value.\r\n unchecked {\r\n balanceOf[to] += amount;\r\n }\r\n\r\n emit Transfer(address(0), to, amount);\r\n }\r\n\r\n function _burn(address from, uint256 amount) internal virtual {\r\n balanceOf[from] -= amount;\r\n\r\n // Cannot underflow because a user's balance\r\n // will never be larger than the total supply.\r\n unchecked {\r\n totalSupply -= amount;\r\n }\r\n\r\n emit Transfer(from, address(0), amount);\r\n }\r\n}\r\n" + }, + "solmate/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Arithmetic library with operations for fixed-point numbers.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\r\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\r\nlibrary FixedPointMathLib {\r\n /*//////////////////////////////////////////////////////////////\r\n SIMPLIFIED FIXED POINT OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\r\n\r\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\r\n }\r\n\r\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\r\n }\r\n\r\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\r\n }\r\n\r\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\r\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n LOW LEVEL FIXED POINT OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function mulDivDown(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 z) {\r\n assembly {\r\n // Store x * y in z for now.\r\n z := mul(x, y)\r\n\r\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\r\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\r\n revert(0, 0)\r\n }\r\n\r\n // Divide z by the denominator.\r\n z := div(z, denominator)\r\n }\r\n }\r\n\r\n function mulDivUp(\r\n uint256 x,\r\n uint256 y,\r\n uint256 denominator\r\n ) internal pure returns (uint256 z) {\r\n assembly {\r\n // Store x * y in z for now.\r\n z := mul(x, y)\r\n\r\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\r\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\r\n revert(0, 0)\r\n }\r\n\r\n // First, divide z - 1 by the denominator and add 1.\r\n // We allow z - 1 to underflow if z is 0, because we multiply the\r\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\r\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\r\n }\r\n }\r\n\r\n function rpow(\r\n uint256 x,\r\n uint256 n,\r\n uint256 scalar\r\n ) internal pure returns (uint256 z) {\r\n assembly {\r\n switch x\r\n case 0 {\r\n switch n\r\n case 0 {\r\n // 0 ** 0 = 1\r\n z := scalar\r\n }\r\n default {\r\n // 0 ** n = 0\r\n z := 0\r\n }\r\n }\r\n default {\r\n switch mod(n, 2)\r\n case 0 {\r\n // If n is even, store scalar in z for now.\r\n z := scalar\r\n }\r\n default {\r\n // If n is odd, store x in z for now.\r\n z := x\r\n }\r\n\r\n // Shifting right by 1 is like dividing by 2.\r\n let half := shr(1, scalar)\r\n\r\n for {\r\n // Shift n right by 1 before looping to halve it.\r\n n := shr(1, n)\r\n } n {\r\n // Shift n right by 1 each iteration to halve it.\r\n n := shr(1, n)\r\n } {\r\n // Revert immediately if x ** 2 would overflow.\r\n // Equivalent to iszero(eq(div(xx, x), x)) here.\r\n if shr(128, x) {\r\n revert(0, 0)\r\n }\r\n\r\n // Store x squared.\r\n let xx := mul(x, x)\r\n\r\n // Round to the nearest number.\r\n let xxRound := add(xx, half)\r\n\r\n // Revert if xx + half overflowed.\r\n if lt(xxRound, xx) {\r\n revert(0, 0)\r\n }\r\n\r\n // Set x to scaled xxRound.\r\n x := div(xxRound, scalar)\r\n\r\n // If n is even:\r\n if mod(n, 2) {\r\n // Compute z * x.\r\n let zx := mul(z, x)\r\n\r\n // If z * x overflowed:\r\n if iszero(eq(div(zx, x), z)) {\r\n // Revert if x is non-zero.\r\n if iszero(iszero(x)) {\r\n revert(0, 0)\r\n }\r\n }\r\n\r\n // Round to the nearest number.\r\n let zxRound := add(zx, half)\r\n\r\n // Revert if zx + half overflowed.\r\n if lt(zxRound, zx) {\r\n revert(0, 0)\r\n }\r\n\r\n // Return properly scaled zxRound.\r\n z := div(zxRound, scalar)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n GENERAL NUMBER UTILITIES\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function sqrt(uint256 x) internal pure returns (uint256 z) {\r\n assembly {\r\n let y := x // We start y at x, which will help us make our initial estimate.\r\n\r\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\r\n\r\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\r\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\r\n\r\n // We check y >= 2^(k + 8) but shift right by k bits\r\n // each branch to ensure that if x >= 256, then y >= 256.\r\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\r\n y := shr(128, y)\r\n z := shl(64, z)\r\n }\r\n if iszero(lt(y, 0x1000000000000000000)) {\r\n y := shr(64, y)\r\n z := shl(32, z)\r\n }\r\n if iszero(lt(y, 0x10000000000)) {\r\n y := shr(32, y)\r\n z := shl(16, z)\r\n }\r\n if iszero(lt(y, 0x1000000)) {\r\n y := shr(16, y)\r\n z := shl(8, z)\r\n }\r\n\r\n // Goal was to get z*z*y within a small factor of x. More iterations could\r\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\r\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\r\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\r\n\r\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\r\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\r\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\r\n\r\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\r\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\r\n\r\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\r\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\r\n\r\n // There is no overflow risk here since y < 2^136 after the first branch above.\r\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\r\n\r\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n z := shr(1, add(z, div(x, z)))\r\n\r\n // If x+1 is a perfect square, the Babylonian method cycles between\r\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\r\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\r\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\r\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\r\n z := sub(z, lt(div(x, z), z))\r\n }\r\n }\r\n\r\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n assembly {\r\n // Mod x by y. Note this will return\r\n // 0 instead of reverting if y is zero.\r\n z := mod(x, y)\r\n }\r\n }\r\n\r\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\r\n assembly {\r\n // Divide x by y. Note this will return\r\n // 0 instead of reverting if y is zero.\r\n r := div(x, y)\r\n }\r\n }\r\n\r\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\r\n assembly {\r\n // Add 1 to x * y if x % y > 0. Note this will\r\n // return 0 instead of reverting if y is zero.\r\n z := add(gt(mod(x, y), 0), div(x, y))\r\n }\r\n }\r\n}\r\n" + }, + "solmate/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\n/// @notice Safe unsigned integer casting library that reverts on overflow.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\r\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\r\nlibrary SafeCastLib {\r\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\r\n require(x < 1 << 248);\r\n\r\n y = uint248(x);\r\n }\r\n\r\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\r\n require(x < 1 << 224);\r\n\r\n y = uint224(x);\r\n }\r\n\r\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\r\n require(x < 1 << 192);\r\n\r\n y = uint192(x);\r\n }\r\n\r\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\r\n require(x < 1 << 160);\r\n\r\n y = uint160(x);\r\n }\r\n\r\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\r\n require(x < 1 << 128);\r\n\r\n y = uint128(x);\r\n }\r\n\r\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\r\n require(x < 1 << 96);\r\n\r\n y = uint96(x);\r\n }\r\n\r\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\r\n require(x < 1 << 64);\r\n\r\n y = uint64(x);\r\n }\r\n\r\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\r\n require(x < 1 << 32);\r\n\r\n y = uint32(x);\r\n }\r\n\r\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\r\n require(x < 1 << 24);\r\n\r\n y = uint24(x);\r\n }\r\n\r\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\r\n require(x < 1 << 16);\r\n\r\n y = uint16(x);\r\n }\r\n\r\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\r\n require(x < 1 << 8);\r\n\r\n y = uint8(x);\r\n }\r\n}\r\n" + }, + "solmate/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\nimport {ERC20} from \"../tokens/ERC20.sol\";\r\n\r\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\r\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\r\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\r\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\r\nlibrary SafeTransferLib {\r\n /*//////////////////////////////////////////////////////////////\r\n ETH OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function safeTransferETH(address to, uint256 amount) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Transfer the ETH and store if it succeeded or not.\r\n success := call(gas(), to, amount, 0, 0, 0, 0)\r\n }\r\n\r\n require(success, \"ETH_TRANSFER_FAILED\");\r\n }\r\n\r\n /*//////////////////////////////////////////////////////////////\r\n ERC20 OPERATIONS\r\n //////////////////////////////////////////////////////////////*/\r\n\r\n function safeTransferFrom(\r\n ERC20 token,\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Get a pointer to some free memory.\r\n let freeMemoryPointer := mload(0x40)\r\n\r\n // Write the abi-encoded calldata into memory, beginning with the function selector.\r\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\r\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\r\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\r\n\r\n success := and(\r\n // Set success to whether the call reverted, if not we check it either\r\n // returned exactly 1 (can't just be non-zero data), or had no return data.\r\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\r\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\r\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\r\n // Counterintuitively, this call must be positioned second to the or() call in the\r\n // surrounding and() call or else returndatasize() will be zero during the computation.\r\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\r\n )\r\n }\r\n\r\n require(success, \"TRANSFER_FROM_FAILED\");\r\n }\r\n\r\n function safeTransfer(\r\n ERC20 token,\r\n address to,\r\n uint256 amount\r\n ) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Get a pointer to some free memory.\r\n let freeMemoryPointer := mload(0x40)\r\n\r\n // Write the abi-encoded calldata into memory, beginning with the function selector.\r\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\r\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\r\n\r\n success := and(\r\n // Set success to whether the call reverted, if not we check it either\r\n // returned exactly 1 (can't just be non-zero data), or had no return data.\r\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\r\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\r\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\r\n // Counterintuitively, this call must be positioned second to the or() call in the\r\n // surrounding and() call or else returndatasize() will be zero during the computation.\r\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\r\n )\r\n }\r\n\r\n require(success, \"TRANSFER_FAILED\");\r\n }\r\n\r\n function safeApprove(\r\n ERC20 token,\r\n address to,\r\n uint256 amount\r\n ) internal {\r\n bool success;\r\n\r\n assembly {\r\n // Get a pointer to some free memory.\r\n let freeMemoryPointer := mload(0x40)\r\n\r\n // Write the abi-encoded calldata into memory, beginning with the function selector.\r\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\r\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\r\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\r\n\r\n success := and(\r\n // Set success to whether the call reverted, if not we check it either\r\n // returned exactly 1 (can't just be non-zero data), or had no return data.\r\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\r\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\r\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\r\n // Counterintuitively, this call must be positioned second to the or() call in the\r\n // surrounding and() call or else returndatasize() will be zero during the computation.\r\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\r\n )\r\n }\r\n\r\n require(success, \"APPROVE_FAILED\");\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/b983f3d49ecb24251a5a4f735e4e3ec3.json b/packages/contracts/deployments/base/solcInputs/b983f3d49ecb24251a5a4f735e4e3ec3.json new file mode 100644 index 0000000000..d2bce1163b --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/b983f3d49ecb24251a5a4f735e4e3ec3.json @@ -0,0 +1,1143 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/interfaces/IERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20Upgradeable.sol\";\nimport \"../token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary ClonesUpgradeable {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(address implementation, bytes32 salt)\n internal\n view\n returns (address predicted)\n {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../interfaces/IERC4626Upgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\n *\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\n * contract and not the \"assets\" token which is an independent contract.\n *\n * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of\n * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\n *\n * _Available since v4.7._\n */\nabstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {\n using MathUpgradeable for uint256;\n\n IERC20Upgradeable private _asset;\n uint8 private _decimals;\n\n /**\n * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\n */\n function __ERC4626_init(IERC20Upgradeable asset_) internal onlyInitializing {\n __ERC4626_init_unchained(asset_);\n }\n\n function __ERC4626_init_unchained(IERC20Upgradeable asset_) internal onlyInitializing {\n (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\n _decimals = success ? assetDecimals : super.decimals();\n _asset = asset_;\n }\n\n /**\n * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\n */\n function _tryGetAssetDecimals(IERC20Upgradeable asset_) private returns (bool, uint8) {\n (bool success, bytes memory encodedDecimals) = address(asset_).call(\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector)\n );\n if (success && encodedDecimals.length >= 32) {\n uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\n if (returnedDecimals <= type(uint8).max) {\n return (true, uint8(returnedDecimals));\n }\n }\n return (false, 0);\n }\n\n /**\n * @dev Decimals are read from the underlying asset in the constructor and cached. If this fails (e.g., the asset\n * has not been created yet), the cached value is set to a default obtained by `super.decimals()` (which depends on\n * inheritance but is most likely 18). Override this function in order to set a guaranteed hardcoded value.\n * See {IERC20Metadata-decimals}.\n */\n function decimals() public view virtual override(IERC20MetadataUpgradeable, ERC20Upgradeable) returns (uint8) {\n return _decimals;\n }\n\n /** @dev See {IERC4626-asset}. */\n function asset() public view virtual override returns (address) {\n return address(_asset);\n }\n\n /** @dev See {IERC4626-totalAssets}. */\n function totalAssets() public view virtual override returns (uint256) {\n return _asset.balanceOf(address(this));\n }\n\n /** @dev See {IERC4626-convertToShares}. */\n function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-convertToAssets}. */\n function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-maxDeposit}. */\n function maxDeposit(address) public view virtual override returns (uint256) {\n return _isVaultCollateralized() ? type(uint256).max : 0;\n }\n\n /** @dev See {IERC4626-maxMint}. */\n function maxMint(address) public view virtual override returns (uint256) {\n return type(uint256).max;\n }\n\n /** @dev See {IERC4626-maxWithdraw}. */\n function maxWithdraw(address owner) public view virtual override returns (uint256) {\n return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-maxRedeem}. */\n function maxRedeem(address owner) public view virtual override returns (uint256) {\n return balanceOf(owner);\n }\n\n /** @dev See {IERC4626-previewDeposit}. */\n function previewDeposit(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-previewMint}. */\n function previewMint(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Up);\n }\n\n /** @dev See {IERC4626-previewWithdraw}. */\n function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Up);\n }\n\n /** @dev See {IERC4626-previewRedeem}. */\n function previewRedeem(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n /** @dev See {IERC4626-deposit}. */\n function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {\n require(assets <= maxDeposit(receiver), \"ERC4626: deposit more than max\");\n\n uint256 shares = previewDeposit(assets);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4626-mint}. */\n function mint(uint256 shares, address receiver) public virtual override returns (uint256) {\n require(shares <= maxMint(receiver), \"ERC4626: mint more than max\");\n\n uint256 assets = previewMint(shares);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return assets;\n }\n\n /** @dev See {IERC4626-withdraw}. */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(assets <= maxWithdraw(owner), \"ERC4626: withdraw more than max\");\n\n uint256 shares = previewWithdraw(assets);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4626-redeem}. */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(shares <= maxRedeem(owner), \"ERC4626: redeem more than max\");\n\n uint256 assets = previewRedeem(shares);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) with support for rounding direction.\n *\n * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset\n * would represent an infinite amount of shares.\n */\n function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {\n uint256 supply = totalSupply();\n return\n (assets == 0 || supply == 0)\n ? _initialConvertToShares(assets, rounding)\n : assets.mulDiv(supply, totalAssets(), rounding);\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) to apply when the vault is empty.\n *\n * NOTE: Make sure to keep this function consistent with {_initialConvertToAssets} when overriding it.\n */\n function _initialConvertToShares(\n uint256 assets,\n MathUpgradeable.Rounding /*rounding*/\n ) internal view virtual returns (uint256 shares) {\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) with support for rounding direction.\n */\n function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {\n uint256 supply = totalSupply();\n return\n (supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) to apply when the vault is empty.\n *\n * NOTE: Make sure to keep this function consistent with {_initialConvertToShares} when overriding it.\n */\n function _initialConvertToAssets(\n uint256 shares,\n MathUpgradeable.Rounding /*rounding*/\n ) internal view virtual returns (uint256 assets) {\n return shares;\n }\n\n /**\n * @dev Deposit/mint common workflow.\n */\n function _deposit(\n address caller,\n address receiver,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the\n // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\n // assets are transferred and before the shares are minted, which is a valid state.\n // slither-disable-next-line reentrancy-no-eth\n SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);\n _mint(receiver, shares);\n\n emit Deposit(caller, receiver, assets, shares);\n }\n\n /**\n * @dev Withdraw/redeem common workflow.\n */\n function _withdraw(\n address caller,\n address receiver,\n address owner,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n if (caller != owner) {\n _spendAllowance(owner, caller, shares);\n }\n\n // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\n // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\n // shares are burned and after the assets are transferred, which is a valid state.\n _burn(owner, shares);\n SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);\n\n emit Withdraw(caller, receiver, owner, assets, shares);\n }\n\n function _isVaultCollateralized() private view returns (bool) {\n return totalAssets() > 0 || totalSupply() == 0;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any (single) token transfer. This includes minting and burning.\n * See {_beforeConsecutiveTokenTransfer}.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any (single) transfer of tokens. This includes minting and burning.\n * See {_afterConsecutiveTokenTransfer}.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called before \"consecutive token transfers\" as defined in ERC2309 and implemented in\n * {ERC721Consecutive}.\n * Calling conditions are similar to {_beforeTokenTransfer}.\n */\n function _beforeConsecutiveTokenTransfer(\n address from,\n address to,\n uint256, /*first*/\n uint96 size\n ) internal virtual {\n if (from != address(0)) {\n _balances[from] -= size;\n }\n if (to != address(0)) {\n _balances[to] += size;\n }\n }\n\n /**\n * @dev Hook that is called after \"consecutive token transfers\" as defined in ERC2309 and implemented in\n * {ERC721Consecutive}.\n * Calling conditions are similar to {_afterTokenTransfer}.\n */\n function _afterConsecutiveTokenTransfer(\n address, /*from*/\n address, /*to*/\n uint256, /*first*/\n uint96 /*size*/\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2Upgradeable {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n */\n constructor(address beacon, bytes memory data) payable {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../../access/Ownable.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\n _implementation = newImplementation;\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/AbstractPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./PythStructs.sol\";\nimport \"./IPyth.sol\";\nimport \"./PythErrors.sol\";\n\nabstract contract AbstractPyth is IPyth {\n /// @notice Returns the price feed with given id.\n /// @dev Reverts if the price does not exist.\n /// @param id The Pyth Price Feed ID of which to fetch the PriceFeed.\n function queryPriceFeed(\n bytes32 id\n ) public view virtual returns (PythStructs.PriceFeed memory priceFeed);\n\n /// @notice Returns true if a price feed with the given id exists.\n /// @param id The Pyth Price Feed ID of which to check its existence.\n function priceFeedExists(\n bytes32 id\n ) public view virtual returns (bool exists);\n\n function getValidTimePeriod()\n public\n view\n virtual\n override\n returns (uint validTimePeriod);\n\n function getPrice(\n bytes32 id\n ) external view virtual override returns (PythStructs.Price memory price) {\n return getPriceNoOlderThan(id, getValidTimePeriod());\n }\n\n function getEmaPrice(\n bytes32 id\n ) external view virtual override returns (PythStructs.Price memory price) {\n return getEmaPriceNoOlderThan(id, getValidTimePeriod());\n }\n\n function getPriceUnsafe(\n bytes32 id\n ) public view virtual override returns (PythStructs.Price memory price) {\n PythStructs.PriceFeed memory priceFeed = queryPriceFeed(id);\n return priceFeed.price;\n }\n\n function getPriceNoOlderThan(\n bytes32 id,\n uint age\n ) public view virtual override returns (PythStructs.Price memory price) {\n price = getPriceUnsafe(id);\n\n if (diff(block.timestamp, price.publishTime) > age)\n revert PythErrors.StalePrice();\n\n return price;\n }\n\n function getEmaPriceUnsafe(\n bytes32 id\n ) public view virtual override returns (PythStructs.Price memory price) {\n PythStructs.PriceFeed memory priceFeed = queryPriceFeed(id);\n return priceFeed.emaPrice;\n }\n\n function getEmaPriceNoOlderThan(\n bytes32 id,\n uint age\n ) public view virtual override returns (PythStructs.Price memory price) {\n price = getEmaPriceUnsafe(id);\n\n if (diff(block.timestamp, price.publishTime) > age)\n revert PythErrors.StalePrice();\n\n return price;\n }\n\n function diff(uint x, uint y) internal pure returns (uint) {\n if (x > y) {\n return x - y;\n } else {\n return y - x;\n }\n }\n\n // Access modifier is overridden to public to be able to call it locally.\n function updatePriceFeeds(\n bytes[] calldata updateData\n ) public payable virtual override;\n\n function updatePriceFeedsIfNecessary(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64[] calldata publishTimes\n ) external payable virtual override {\n if (priceIds.length != publishTimes.length)\n revert PythErrors.InvalidArgument();\n\n for (uint i = 0; i < priceIds.length; i++) {\n if (\n !priceFeedExists(priceIds[i]) ||\n queryPriceFeed(priceIds[i]).price.publishTime < publishTimes[i]\n ) {\n updatePriceFeeds(updateData);\n return;\n }\n }\n\n revert PythErrors.NoFreshUpdate();\n }\n\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n )\n external\n payable\n virtual\n override\n returns (PythStructs.PriceFeed[] memory priceFeeds);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./PythStructs.sol\";\nimport \"./IPythEvents.sol\";\n\n/// @title Consume prices from the Pyth Network (https://pyth.network/).\n/// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely.\n/// @author Pyth Data Association\ninterface IPyth is IPythEvents {\n /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time\n function getValidTimePeriod() external view returns (uint validTimePeriod);\n\n /// @notice Returns the price and confidence interval.\n /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.\n /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPrice(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price and confidence interval.\n /// @dev Reverts if the EMA price is not available.\n /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPrice(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the price of a price feed without any sanity checks.\n /// @dev This function returns the most recent price update in this contract without any recency checks.\n /// This function is unsafe as the returned price update may be arbitrarily far in the past.\n ///\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\n /// sufficiently recent for their application. If you are considering using this function, it may be\n /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPriceUnsafe(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the price that is no older than `age` seconds of the current time.\n /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\n /// recently.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getPriceNoOlderThan(\n bytes32 id,\n uint age\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.\n /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.\n /// However, if the price is not recent this function returns the latest available price.\n ///\n /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that\n /// the returned price is recent or useful for any particular application.\n ///\n /// Users of this function should check the `publishTime` in the price to ensure that the returned price is\n /// sufficiently recent for their application. If you are considering using this function, it may be\n /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPriceUnsafe(\n bytes32 id\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds\n /// of the current time.\n /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in\n /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently\n /// recently.\n /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.\n function getEmaPriceNoOlderThan(\n bytes32 id,\n uint age\n ) external view returns (PythStructs.Price memory price);\n\n /// @notice Update price feeds with given update messages.\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n /// Prices will be updated if they are more recent than the current stored prices.\n /// The call will succeed even if the update is not the most recent.\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.\n /// @param updateData Array of price update data.\n function updatePriceFeeds(bytes[] calldata updateData) external payable;\n\n /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is\n /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the\n /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.\n ///\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n ///\n /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime\n /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have\n /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.\n /// Otherwise, it calls updatePriceFeeds method to update the prices.\n ///\n /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.\n /// @param updateData Array of price update data.\n /// @param priceIds Array of price ids.\n /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`\n function updatePriceFeedsIfNecessary(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64[] calldata publishTimes\n ) external payable;\n\n /// @notice Returns the required fee to update an array of price updates.\n /// @param updateData Array of price update data.\n /// @return feeAmount The required fee in Wei.\n function getUpdateFee(\n bytes[] calldata updateData\n ) external view returns (uint feeAmount);\n\n /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published\n /// within `minPublishTime` and `maxPublishTime`.\n ///\n /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;\n /// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain.\n ///\n /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling\n /// `getUpdateFee` with the length of the `updateData` array.\n ///\n ///\n /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is\n /// no update for any of the given `priceIds` within the given time range.\n /// @param updateData Array of price update data.\n /// @param priceIds Array of price ids.\n /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.\n /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.\n /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/IPythEvents.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @title IPythEvents contains the events that Pyth contract emits.\n/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.\ninterface IPythEvents {\n /// @dev Emitted when the price feed with `id` has received a fresh update.\n /// @param id The Pyth Price Feed ID.\n /// @param publishTime Publish time of the given price update.\n /// @param price Price of the given price update.\n /// @param conf Confidence interval of the given price update.\n event PriceFeedUpdate(\n bytes32 indexed id,\n uint64 publishTime,\n int64 price,\n uint64 conf\n );\n\n /// @dev Emitted when a batch price update is processed successfully.\n /// @param chainId ID of the source chain that the batch price update comes from.\n /// @param sequenceNumber Sequence number of the batch price update.\n event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/MockPyth.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./AbstractPyth.sol\";\nimport \"./PythStructs.sol\";\nimport \"./PythErrors.sol\";\n\ncontract MockPyth is AbstractPyth {\n mapping(bytes32 => PythStructs.PriceFeed) priceFeeds;\n uint64 sequenceNumber;\n\n uint singleUpdateFeeInWei;\n uint validTimePeriod;\n\n constructor(uint _validTimePeriod, uint _singleUpdateFeeInWei) {\n singleUpdateFeeInWei = _singleUpdateFeeInWei;\n validTimePeriod = _validTimePeriod;\n }\n\n function queryPriceFeed(\n bytes32 id\n ) public view override returns (PythStructs.PriceFeed memory priceFeed) {\n if (priceFeeds[id].id == 0) revert PythErrors.PriceFeedNotFound();\n return priceFeeds[id];\n }\n\n function priceFeedExists(bytes32 id) public view override returns (bool) {\n return (priceFeeds[id].id != 0);\n }\n\n function getValidTimePeriod() public view override returns (uint) {\n return validTimePeriod;\n }\n\n // Takes an array of encoded price feeds and stores them.\n // You can create this data either by calling createPriceFeedData or\n // by using web3.js or ethers abi utilities.\n function updatePriceFeeds(\n bytes[] calldata updateData\n ) public payable override {\n uint requiredFee = getUpdateFee(updateData);\n if (msg.value < requiredFee) revert PythErrors.InsufficientFee();\n\n // Chain ID is id of the source chain that the price update comes from. Since it is just a mock contract\n // We set it to 1.\n uint16 chainId = 1;\n\n for (uint i = 0; i < updateData.length; i++) {\n PythStructs.PriceFeed memory priceFeed = abi.decode(\n updateData[i],\n (PythStructs.PriceFeed)\n );\n\n uint lastPublishTime = priceFeeds[priceFeed.id].price.publishTime;\n\n if (lastPublishTime < priceFeed.price.publishTime) {\n // Price information is more recent than the existing price information.\n priceFeeds[priceFeed.id] = priceFeed;\n emit PriceFeedUpdate(\n priceFeed.id,\n uint64(lastPublishTime),\n priceFeed.price.price,\n priceFeed.price.conf\n );\n }\n }\n\n // In the real contract, the input of this function contains multiple batches that each contain multiple prices.\n // This event is emitted when a batch is processed. In this mock contract we consider there is only one batch of prices.\n // Each batch has (chainId, sequenceNumber) as it's unique identifier. Here chainId is set to 1 and an increasing sequence number is used.\n emit BatchPriceFeedUpdate(chainId, sequenceNumber);\n sequenceNumber += 1;\n }\n\n function getUpdateFee(\n bytes[] calldata updateData\n ) public view override returns (uint feeAmount) {\n return singleUpdateFeeInWei * updateData.length;\n }\n\n function parsePriceFeedUpdates(\n bytes[] calldata updateData,\n bytes32[] calldata priceIds,\n uint64 minPublishTime,\n uint64 maxPublishTime\n ) external payable override returns (PythStructs.PriceFeed[] memory feeds) {\n uint requiredFee = getUpdateFee(updateData);\n if (msg.value < requiredFee) revert PythErrors.InsufficientFee();\n\n feeds = new PythStructs.PriceFeed[](priceIds.length);\n\n for (uint i = 0; i < priceIds.length; i++) {\n for (uint j = 0; j < updateData.length; j++) {\n feeds[i] = abi.decode(updateData[j], (PythStructs.PriceFeed));\n\n if (feeds[i].id == priceIds[i]) {\n uint publishTime = feeds[i].price.publishTime;\n if (\n minPublishTime <= publishTime &&\n publishTime <= maxPublishTime\n ) {\n break;\n } else {\n feeds[i].id = 0;\n }\n }\n }\n\n if (feeds[i].id != priceIds[i])\n revert PythErrors.PriceFeedNotFoundWithinRange();\n }\n }\n\n function createPriceFeedUpdateData(\n bytes32 id,\n int64 price,\n uint64 conf,\n int32 expo,\n int64 emaPrice,\n uint64 emaConf,\n uint64 publishTime\n ) public pure returns (bytes memory priceFeedData) {\n PythStructs.PriceFeed memory priceFeed;\n\n priceFeed.id = id;\n\n priceFeed.price.price = price;\n priceFeed.price.conf = conf;\n priceFeed.price.expo = expo;\n priceFeed.price.publishTime = publishTime;\n\n priceFeed.emaPrice.price = emaPrice;\n priceFeed.emaPrice.conf = emaConf;\n priceFeed.emaPrice.expo = expo;\n priceFeed.emaPrice.publishTime = publishTime;\n\n priceFeedData = abi.encode(priceFeed);\n }\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythErrors.sol": { + "content": "// SPDX-License-Identifier: Apache 2\n\npragma solidity ^0.8.0;\n\nlibrary PythErrors {\n // Function arguments are invalid (e.g., the arguments lengths mismatch)\n error InvalidArgument();\n // Update data is coming from an invalid data source.\n error InvalidUpdateDataSource();\n // Update data is invalid (e.g., deserialization error)\n error InvalidUpdateData();\n // Insufficient fee is paid to the method.\n error InsufficientFee();\n // There is no fresh update, whereas expected fresh updates.\n error NoFreshUpdate();\n // There is no price feed found within the given range or it does not exists.\n error PriceFeedNotFoundWithinRange();\n // Price feed not found or it is not pushed on-chain yet.\n error PriceFeedNotFound();\n // Requested price is stale.\n error StalePrice();\n // Given message is not a valid Wormhole VAA.\n error InvalidWormholeVaa();\n // Governance message is invalid (e.g., deserialization error).\n error InvalidGovernanceMessage();\n // Governance message is not for this contract.\n error InvalidGovernanceTarget();\n // Governance message is coming from an invalid data source.\n error InvalidGovernanceDataSource();\n // Governance message is old.\n error OldGovernanceMessage();\n}\n" + }, + "@pythnetwork/pyth-sdk-solidity/PythStructs.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\ncontract PythStructs {\n // A price with a degree of uncertainty, represented as a price +- a confidence interval.\n //\n // The confidence interval roughly corresponds to the standard error of a normal distribution.\n // Both the price and confidence are stored in a fixed-point numeric representation,\n // `x * (10^expo)`, where `expo` is the exponent.\n //\n // Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how\n // to how this price safely.\n struct Price {\n // Price\n int64 price;\n // Confidence interval around the price\n uint64 conf;\n // Price exponent\n int32 expo;\n // Unix timestamp describing when the price was published\n uint publishTime;\n }\n\n // PriceFeed represents a current aggregate price from pyth publisher feeds.\n struct PriceFeed {\n // The price ID.\n bytes32 id;\n // Latest available price\n Price price;\n // Latest available exponentially-weighted moving average price\n Price emaPrice;\n }\n}\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/IRateComputer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\n/**\n * @title IRateComputer\n * @notice An interface that defines a contract that computes rates.\n */\ninterface IRateComputer {\n /// @notice Computes the rate for a token.\n /// @param token The address of the token to compute the rate for.\n /// @return rate The rate for the token.\n function computeRate(address token) external view returns (uint64);\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nlibrary PrudentiaLib {\n struct PrudentiaConfig {\n address controller; // Adrastia Prudentia controller address\n uint8 offset; // Offset for delayed rate activation\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\n }\n}\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Careful Math\n * @author Compound\n * @notice Derived from OpenZeppelin's SafeMath library\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\n */\ncontract CarefulMath {\n /**\n * @dev Possible error codes that we can return\n */\n enum MathError {\n NO_ERROR,\n DIVISION_BY_ZERO,\n INTEGER_OVERFLOW,\n INTEGER_UNDERFLOW\n }\n\n /**\n * @dev Multiplies two numbers, returns an error on overflow.\n */\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (a == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n uint256 c;\n unchecked {\n c = a * b;\n }\n\n if (c / a != b) {\n return (MathError.INTEGER_OVERFLOW, 0);\n } else {\n return (MathError.NO_ERROR, c);\n }\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b == 0) {\n return (MathError.DIVISION_BY_ZERO, 0);\n }\n\n return (MathError.NO_ERROR, a / b);\n }\n\n /**\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\n */\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b <= a) {\n return (MathError.NO_ERROR, a - b);\n } else {\n return (MathError.INTEGER_UNDERFLOW, 0);\n }\n }\n\n /**\n * @dev Adds two numbers, returns an error on overflow.\n */\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n uint256 c;\n unchecked {\n c = a + b;\n }\n\n if (c >= a) {\n return (MathError.NO_ERROR, c);\n } else {\n return (MathError.INTEGER_OVERFLOW, 0);\n }\n }\n\n /**\n * @dev add a and b and then subtract c\n */\n function addThenSubUInt(\n uint256 a,\n uint256 b,\n uint256 c\n ) internal pure returns (MathError, uint256) {\n (MathError err0, uint256 sum) = addUInt(a, b);\n\n if (err0 != MathError.NO_ERROR) {\n return (err0, 0);\n }\n\n return subUInt(sum, c);\n }\n}\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\n\n/**\n * @title Compound's CErc20Delegate Contract\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\n * @author Compound\n */\ncontract CErc20Delegate is CErc20 {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 3;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n */\n function _becomeImplementation(bytes memory) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 1;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20Delegate\";\n }\n}\n" + }, + "contracts/compound/CErc20Delegator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ComptrollerInterface.sol\";\nimport \"./InterestRateModel.sol\";\nimport \"../ionic/DiamondExtension.sol\";\nimport { CErc20DelegatorBase, CDelegateInterface } from \"./CTokenInterfaces.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\n\n/**\n * @title Compound's CErc20Delegator Contract\n * @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Compound\n */\ncontract CErc20Delegator is CErc20DelegatorBase, DiamondBase {\n /**\n * @notice Emitted when implementation is changed\n */\n event NewImplementation(address oldImplementation, address newImplementation);\n\n /**\n * @notice Initialize the new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param ionicAdmin_ The FeeDistributor contract address.\n * @param interestRateModel_ The address of the interest rate model\n * @param name_ ERC-20 name of this token\n * @param symbol_ ERC-20 symbol of this token\n */\n constructor(\n address underlying_,\n IonicComptroller comptroller_,\n address payable ionicAdmin_,\n InterestRateModel interestRateModel_,\n string memory name_,\n string memory symbol_,\n uint256 reserveFactorMantissa_,\n uint256 adminFeeMantissa_\n ) {\n require(msg.sender == ionicAdmin_, \"!admin\");\n uint8 decimals_ = EIP20Interface(underlying_).decimals();\n {\n ionicAdmin = ionicAdmin_;\n\n // Set initial exchange rate\n initialExchangeRateMantissa = 0.2e18;\n\n // Set the comptroller\n comptroller = comptroller_;\n\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\n accrualBlockNumber = block.number;\n borrowIndex = 1e18;\n\n // Set the interest rate model (depends on block number / borrow index)\n require(interestRateModel_.isInterestRateModel(), \"!notIrm\");\n interestRateModel = interestRateModel_;\n emit NewMarketInterestRateModel(InterestRateModel(address(0)), interestRateModel_);\n\n name = name_;\n symbol = symbol_;\n decimals = decimals_;\n\n // Set reserve factor\n // Check newReserveFactor ≤ maxReserveFactor\n require(\n reserveFactorMantissa_ + adminFeeMantissa + ionicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\n \"!rf:set\"\n );\n reserveFactorMantissa = reserveFactorMantissa_;\n emit NewReserveFactor(0, reserveFactorMantissa_);\n\n // Set admin fee\n // Sanitize adminFeeMantissa_\n if (adminFeeMantissa_ == type(uint256).max) adminFeeMantissa_ = adminFeeMantissa;\n // Get latest Ionic fee\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\n require(\n reserveFactorMantissa + adminFeeMantissa_ + newIonicFeeMantissa <= reserveFactorPlusFeesMaxMantissa,\n \"!adminFee:set\"\n );\n adminFeeMantissa = adminFeeMantissa_;\n emit NewAdminFee(0, adminFeeMantissa_);\n ionicFeeMantissa = newIonicFeeMantissa;\n emit NewIonicFee(0, newIonicFeeMantissa);\n\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\n _notEntered = true;\n }\n\n // Set underlying and sanity check it\n underlying = underlying_;\n EIP20Interface(underlying).totalSupply();\n }\n\n function implementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"delegateType()\"))));\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external override {\n // Check admin rights\n require(hasAdminRights(), \"!admin\");\n\n // Set implementation\n _setImplementationInternal(implementation_, becomeImplementationData);\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self or admin\");\n\n (bool success, bytes memory data) = address(this).staticcall(abi.encodeWithSignature(\"delegateType()\"));\n require(success, \"no delegate type\");\n\n uint8 currentDelegateType = abi.decode(data, (uint8));\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = IFeeDistributor(ionicAdmin)\n .latestCErc20Delegate(currentDelegateType);\n\n address currentDelegate = implementation();\n if (currentDelegate != latestCErc20Delegate) {\n _setImplementationInternal(latestCErc20Delegate, becomeImplementationData);\n } else {\n // only update the extensions without reinitializing with becomeImplementationData\n _updateExtensions(currentDelegate);\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(msg.sender == address(ionicAdmin), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n\n /**\n * @dev Internal function to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationInternal(address implementation_, bytes memory becomeImplementationData) internal {\n address delegateBefore = implementation();\n _updateExtensions(implementation_);\n\n _functionCall(\n address(this),\n abi.encodeWithSelector(CDelegateInterface._becomeImplementation.selector, becomeImplementationData),\n \"!become impl\"\n );\n\n emit NewImplementation(delegateBefore, implementation_);\n }\n\n function _updateExtensions(address newDelegate) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getCErc20DelegateExtensions(newDelegate);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CErc20PluginDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\nimport \"./IERC4626.sol\";\nimport \"../external/uniswap/IUniswapV2Pair.sol\";\n\n/**\n * @title Rari's CErc20Plugin's Contract\n * @notice CToken which outsources token logic to a plugin\n * @author Joey Santoro\n *\n * CErc20PluginDelegate deposits and withdraws from a plugin contract\n * It is also capable of delegating reward functionality to a PluginRewardsDistributor\n */\ncontract CErc20PluginDelegate is CErc20Delegate {\n event NewPluginImplementation(address oldImpl, address newImpl);\n\n /**\n * @notice Plugin address\n */\n IERC4626 public plugin;\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.plugin.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._updatePlugin.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Delegate interface to become the implementation\n * @param data The encoded arguments for becoming\n */\n function _becomeImplementation(bytes memory data) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _becomeImplementation\");\n\n address _plugin = abi.decode(data, (address));\n\n if (_plugin == address(0) && address(plugin) != address(0)) {\n // if no new plugin address is given, use the latest implementation\n _plugin = IFeeDistributor(ionicAdmin).latestPluginImplementation(address(plugin));\n }\n\n if (_plugin != address(0) && _plugin != address(plugin)) {\n _updatePlugin(_plugin);\n }\n }\n\n /**\n * @notice Update the plugin implementation to a whitelisted implementation\n * @param _plugin The address of the plugin implementation to use\n */\n function _updatePlugin(address _plugin) public {\n require(msg.sender == address(this) || hasAdminRights(), \"only self and admins can call _updatePlugin\");\n\n address oldImplementation = address(plugin) != address(0) ? address(plugin) : _plugin;\n\n if (address(plugin) != address(0) && plugin.balanceOf(address(this)) != 0) {\n plugin.redeem(plugin.balanceOf(address(this)), address(this), address(this));\n }\n\n plugin = IERC4626(_plugin);\n\n EIP20Interface(underlying).approve(_plugin, type(uint256).max);\n\n uint256 amount = EIP20Interface(underlying).balanceOf(address(this));\n if (amount != 0) {\n deposit(amount);\n }\n\n emit NewPluginImplementation(oldImplementation, _plugin);\n }\n\n /*** CToken Overrides ***/\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of the plugin in terms of the underlying\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view override returns (uint256) {\n return plugin.previewRedeem(plugin.balanceOf(address(this)));\n }\n\n /**\n * @notice Transfer the underlying to the cToken and trigger a deposit\n * @param from Address to transfer funds from\n * @param amount Amount of underlying to transfer\n * @return The actual amount that is transferred\n */\n function doTransferIn(address from, uint256 amount) internal override returns (uint256) {\n // Perform the EIP-20 transfer in\n require(EIP20Interface(underlying).transferFrom(from, address(this), amount), \"send\");\n\n deposit(amount);\n return amount;\n }\n\n function deposit(uint256 amount) internal {\n plugin.deposit(amount, address(this));\n }\n\n /**\n * @notice Transfer the underlying from plugin to destination\n * @param to Address to transfer funds to\n * @param amount Amount of underlying to transfer\n */\n function doTransferOut(address to, uint256 amount) internal override {\n plugin.withdraw(amount, to, address(this));\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 2;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20PluginDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20PluginRewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20PluginDelegate.sol\";\n\ncontract CErc20PluginRewardsDelegate is CErc20PluginDelegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying && _token != address(plugin), \"!token\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 4;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20PluginRewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\n\ncontract CErc20RewardsDelegate is CErc20Delegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n \n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying, \"!underlying\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 3;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20RewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegateMorpho.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20RewardsDelegate.sol\";\n\ncontract CErc20RewardsDelegateMorpho is CErc20Delegate {\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 1;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\n * @param rewardToken The reward strategy for which the rewards are being claimed.\n * @param claimable The amount of tokens to claim and forward.\n * @param proof The proof required to validate the claim.\n * @dev Only callable by the governance.\n */\n function claim(\n address morphoURD,\n address rewardToken,\n address distributor,\n uint256 claimable,\n bytes32[] memory proof\n ) external isAuthorized {\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\n EIP20Interface(rewardToken).approve(distributor, claimedAmount);\n IDistributor(distributor).distribute(rewardToken, claimedAmount);\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 5;\n }\n}\n\ninterface IDistributor {\n function distribute(address _rewardToken, uint256 _amount) external;\n}\n\ninterface IMorphoClaim {\n function claim(\n address account,\n address reward,\n uint256 claimable,\n bytes32[] memory proof\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./Unitroller.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\n */\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when an admin supports a market\n event MarketListed(ICErc20 cToken);\n\n /// @notice Emitted when an account enters a market\n event MarketEntered(ICErc20 cToken, address account);\n\n /// @notice Emitted when an account exits a market\n event MarketExited(ICErc20 cToken, address account);\n\n /// @notice Emitted when close factor is changed by admin\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\n\n /// @notice Emitted when a collateral factor is changed by admin\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\n\n /// @notice Emitted when liquidation incentive is changed by admin\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\n\n /// @notice Emitted when price oracle is changed\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\n\n /// @notice Emitted when the whitelist enforcement is changed\n event WhitelistEnforcementChanged(bool enforce);\n\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\n event AddedRewardsDistributor(address rewardsDistributor);\n\n // closeFactorMantissa must be strictly greater than this value\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\n\n // closeFactorMantissa must not exceed this value\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\n\n // No collateralFactorMantissa may exceed this value\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\n\n // liquidationIncentiveMantissa must be no less than this value\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\n\n // liquidationIncentiveMantissa must be no greater than this value\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\n\n modifier isAuthorized() {\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\n _;\n }\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\n return ComptrollerBase.effectiveSupplyCaps(cToken);\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\n return ComptrollerBase.effectiveBorrowCaps(cToken);\n }\n\n /*** Assets You Are In ***/\n\n /**\n * @notice Returns the assets an account has entered\n * @param account The address of the account to pull assets for\n * @return A dynamic list with the assets the account has entered\n */\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\n ICErc20[] memory assetsIn = accountAssets[account];\n\n return assetsIn;\n }\n\n /**\n * @notice Returns whether the given account is entered in the given asset\n * @param account The address of the account to check\n * @param cToken The cToken to check\n * @return True if the account is in the asset, otherwise false.\n */\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\n return markets[address(cToken)].accountMembership[account];\n }\n\n /**\n * @notice Add assets to be included in account liquidity calculation\n * @param cTokens The list of addresses of the cToken markets to be enabled\n * @return Success indicator for whether each corresponding market was entered\n */\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\n uint256 len = cTokens.length;\n\n uint256[] memory results = new uint256[](len);\n for (uint256 i = 0; i < len; i++) {\n ICErc20 cToken = ICErc20(cTokens[i]);\n\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\n }\n\n return results;\n }\n\n /**\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\n * @param cToken The market to enter\n * @param borrower The address of the account to modify\n * @return Success indicator for whether the market was entered\n */\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\n Market storage marketToJoin = markets[address(cToken)];\n\n if (!marketToJoin.isListed) {\n // market is not listed, cannot join\n return Error.MARKET_NOT_LISTED;\n }\n\n if (marketToJoin.accountMembership[borrower] == true) {\n // already joined\n return Error.NO_ERROR;\n }\n\n // survived the gauntlet, add to list\n // NOTE: we store these somewhat redundantly as a significant optimization\n // this avoids having to iterate through the list for the most common use cases\n // that is, only when we need to perform liquidity checks\n // and not whenever we want to check if an account is in a particular market\n marketToJoin.accountMembership[borrower] = true;\n accountAssets[borrower].push(cToken);\n\n // Add to allBorrowers\n if (!borrowers[borrower]) {\n allBorrowers.push(borrower);\n borrowers[borrower] = true;\n borrowerIndexes[borrower] = allBorrowers.length - 1;\n }\n\n emit MarketEntered(cToken, borrower);\n\n return Error.NO_ERROR;\n }\n\n /**\n * @notice Removes asset from sender's account liquidity calculation\n * @dev Sender must not have an outstanding borrow balance in the asset,\n * or be providing necessary collateral for an outstanding borrow.\n * @param cTokenAddress The address of the asset to be removed\n * @return Whether or not the account successfully exited the market\n */\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\n // TODO\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\n\n ICErc20 cToken = ICErc20(cTokenAddress);\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\n\n /* Fail if the sender has a borrow balance */\n if (amountOwed != 0) {\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\n }\n\n /* Fail if the sender is not permitted to redeem all of their tokens */\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\n if (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\n }\n\n Market storage marketToExit = markets[cTokenAddress];\n\n /* Return true if the sender is not already ‘in’ the market */\n if (!marketToExit.accountMembership[msg.sender]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Set cToken account membership to false */\n delete marketToExit.accountMembership[msg.sender];\n\n /* Delete cToken from the account’s list of assets */\n // load into memory for faster iteration\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\n uint256 len = userAssetList.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n ICErc20[] storage storedList = accountAssets[msg.sender];\n storedList[assetIndex] = storedList[storedList.length - 1];\n storedList.pop();\n\n // If the user has exited all markets, remove them from the `allBorrowers` array\n if (storedList.length == 0) {\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\n allBorrowers.pop(); // Reduce length by 1\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\n }\n\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Policy Hooks ***/\n\n /**\n * @notice Checks if the account should be allowed to mint tokens in the given market\n * @param cTokenAddress The market to verify the mint against\n * @param minter The account which would get the minted tokens\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\n\n // Make sure market is listed\n if (!markets[cTokenAddress].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure minter is whitelisted\n if (enforceWhitelist && !whitelist[minter]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\n\n // Supply cap of 0 corresponds to unlimited supplying\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\n uint256 nonWhitelistedTotalSupply;\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\n\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cTokenAddress, minter);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to redeem tokens in the given market\n * @param cToken The market to verify the redeem against\n * @param redeemer The account which would redeem the tokens\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cToken, redeemer);\n\n return uint256(Error.NO_ERROR);\n }\n\n function redeemAllowedInternal(\n address cToken,\n address redeemer,\n uint256 redeemTokens\n ) internal view returns (uint256) {\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\n if (!markets[cToken].accountMembership[redeemer]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n redeemer,\n ICErc20(cToken),\n redeemTokens,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates mint and reverts on rejection. May emit logs.\n * @param cToken Asset being minted\n * @param minter The address minting the tokens\n * @param actualMintAmount The amount of the underlying asset being minted\n * @param mintTokens The number of tokens being minted\n */\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\n // Add minter to suppliers mapping\n suppliers[minter] = true;\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, minter);\n }\n\n /**\n * @notice Validates redeem and reverts on rejection. May emit logs.\n * @param cToken Asset being redeemed\n * @param redeemer The address redeeming the tokens\n * @param redeemAmount The amount of the underlying asset being redeemed\n * @param redeemTokens The number of tokens being redeemed\n */\n function redeemVerify(\n address cToken,\n address redeemer,\n uint256 redeemAmount,\n uint256 redeemTokens\n ) external override {\n require(markets[msg.sender].isListed, \"!market\");\n\n // Require tokens is zero or amount is also zero\n if (redeemTokens == 0 && redeemAmount > 0) {\n revert(\"!zero\");\n }\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, redeemer);\n }\n\n function getMaxRedeemOrBorrow(\n address account,\n ICErc20 cTokenModify,\n bool isBorrow\n ) external view override returns (uint256) {\n address cToken = address(cTokenModify);\n // Accrue interest\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\n\n // Get account liquidity\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n isBorrow ? cTokenModify : ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n require(err == Error.NO_ERROR, \"!liquidity\");\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\n\n // Get max borrow/redeem\n uint256 maxBorrowOrRedeemAmount;\n\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\n // Max redeem = balance of underlying if not used as collateral\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\n } else {\n // Avoid \"stack too deep\" error by separating this logic\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\n\n // Redeem only: max out at underlying balance\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\n }\n\n // Get max borrow or redeem considering cToken liquidity\n uint256 cTokenLiquidity = cTokenModify.getCash();\n\n // Return the minimum of the two maximums\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\n }\n\n /**\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\n */\n function _getMaxRedeemOrBorrow(\n uint256 liquidity,\n ICErc20 cTokenModify,\n bool isBorrow\n ) internal view returns (uint256) {\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\n\n // Get the normalized price of the asset\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\n require(conversionFactor > 0, \"!oracle\");\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n if (!isBorrow) {\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\n }\n\n // Get max borrow or redeem considering excess account liquidity\n return (liquidity * 1e18) / conversionFactor;\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which would borrow the asset\n * @param borrowAmount The amount of underlying the account would borrow\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\n\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n if (!markets[cToken].accountMembership[borrower]) {\n // only cTokens may call borrowAllowed if borrower not in market\n require(msg.sender == cToken, \"!ctoken\");\n\n // attempt to add borrower to the market\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n // it should be impossible to break the important invariant\n assert(markets[cToken].accountMembership[borrower]);\n }\n\n // Make sure oracle price is available\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\n return uint256(Error.PRICE_ERROR);\n }\n\n // Make sure borrower is whitelisted\n if (enforceWhitelist && !whitelist[borrower]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 borrowCap = effectiveBorrowCaps(cToken);\n\n // Borrow cap of 0 corresponds to unlimited borrowing\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\n uint256 nonWhitelistedTotalBorrows;\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n // Perform a hypothetical liquidity check to guard against shortfall\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\n if (err != uint256(Error.NO_ERROR)) {\n return err;\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which borrowed the asset\n */\n function borrowVerify(address cToken, address borrower) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken Asset whose underlying is being borrowed\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\n */\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\n // Check if min borrow exists\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\n\n if (minBorrowEth > 0) {\n // Get new underlying borrow balance of account for this cToken\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\n Exp({ mantissa: oraclePriceMantissa }),\n accountBorrowsNew\n );\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\n\n // Check against min borrow\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\n }\n\n // Return no error\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to repay a borrow in the given market\n * @param cToken The market to verify the repay against\n * @param payer The account which would repay the asset\n * @param borrower The account which would borrowed the asset\n * @param repayAmount The amount of the underlying asset the account would repay\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after borrow repayment\n * @param cToken The market to verify the repay against\n * @param payer The account which repayed the asset\n * @param borrower The account which borrowed the asset\n * @param repayAmount The amount of the underlying asset the account repayed\n */\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the liquidation should be allowed to occur\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param repayAmount The amount of underlying being repaid\n */\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure markets are listed\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Get borrowers' underlying borrow balance\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\n\n /* allow accounts to be liquidated if the market is deprecated */\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\n } else {\n /* The borrower must have shortfall in order to be liquidateable */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n borrower,\n ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n if (shortfall == 0) {\n return uint256(Error.INSUFFICIENT_SHORTFALL);\n }\n\n /* The liquidator may not repay more than what is allowed by the closeFactor */\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\n if (repayAmount > maxClose) {\n return uint256(Error.TOO_MUCH_REPAY);\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the seizing of assets should be allowed to occur\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!seizeGuardianPaused, \"!seize:paused\");\n\n // Make sure markets are listed\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure cToken Comptrollers are identical\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\n return uint256(Error.COMPTROLLER_MISMATCH);\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after seizing of assets\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override {\n // Keep the flywheel moving\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\n }\n\n /**\n * @notice Checks if the account should be allowed to transfer tokens in the given market\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function transferAllowed(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!transferGuardianPaused, \"!transfer:paused\");\n\n // Currently the only consideration is whether or not\n // the src is allowed to redeem this many tokens\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cToken, src, dst);\n\n return uint256(Error.NO_ERROR);\n }\n\n\n /**\n * @notice Validates that blacklisted balances are updated after transfering assets\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n */\n function transferVerify(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override {\n\n // Keep the flywheel moving\n flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Flywheel Hooks ***/\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving post-mint and post-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving post-borrow and post-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\n }\n\n /**\n * @notice Keeps the flywheel moving post-transfer and post-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Liquidity/Liquidation Calculations ***/\n\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountLiquidityLocalVars {\n ICErc20 asset;\n uint256 sumCollateral;\n uint256 sumBorrowPlusEffects;\n uint256 cTokenBalance;\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n uint256 oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n uint256 borrowCapForCollateral;\n uint256 borrowedAssetPrice;\n uint256 assetAsCollateralValueCap;\n }\n\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code (semi-opaque),\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(\n account,\n ICErc20(cTokenModify),\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code,\n hypothetical account collateral value,\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidityInternal(\n address account,\n ICErc20 cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) internal view returns (Error, uint256, uint256, uint256) {\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\n\n if (address(cTokenModify) != address(0)) {\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n }\n\n // For each asset the account is in\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\n vars.asset = accountAssets[account][i];\n\n {\n // Read the balances and exchange rate from the cToken\n uint256 oErr;\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\n account\n );\n if (oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\n }\n }\n {\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\n if (vars.oraclePriceMantissa == 0) {\n return (Error.PRICE_ERROR, 0, 0, 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n }\n {\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\n vars.asset,\n cTokenModify,\n redeemTokens > 0,\n account\n );\n\n // accumulate the collateral value to sumCollateral\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\n assetCollateralValue = vars.assetAsCollateralValueCap;\n vars.sumCollateral += assetCollateralValue;\n }\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n\n // Calculate effects of interacting with cTokenModify\n if (vars.asset == cTokenModify) {\n // redeem effect\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.tokensToDenom,\n redeemTokens,\n vars.sumBorrowPlusEffects\n );\n\n // borrow effect\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n borrowAmount,\n vars.sumBorrowPlusEffects\n );\n\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\n if (repayEffect >= vars.sumBorrowPlusEffects) {\n vars.sumBorrowPlusEffects = 0;\n } else {\n vars.sumBorrowPlusEffects -= repayEffect;\n }\n }\n }\n\n // These are safe, as the underflow condition is checked first\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\n } else {\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\n }\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\n * @param cTokenBorrowed The address of the borrowed cToken\n * @param cTokenCollateral The address of the collateral cToken\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view override returns (uint256, uint256) {\n /* Read oracle prices for borrowed and collateral markets */\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\n return (uint256(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\n uint256 seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\n\n /*\n * The liquidation penalty includes\n * - the liquidator incentive\n * - the protocol fees (Ionic admin fees)\n * - the market fee\n */\n Exp memory totalPenaltyMantissa = add_(\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\n Exp({ mantissa: feeSeizeShareMantissa })\n );\n\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n return (uint256(Error.NO_ERROR), seizeTokens);\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Add a RewardsDistributor contracts.\n * @dev Admin function to add a RewardsDistributor contract\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addRewardsDistributor(address distributor) external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n\n // Check marker method\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\n\n // Check for existing RewardsDistributor\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\n\n // Add RewardsDistributor to array\n rewardsDistributors.push(distributor);\n emit AddedRewardsDistributor(distributor);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist enforcement for the comptroller\n * @dev Admin function to set a new whitelist enforcement boolean\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\n }\n\n // Check if `enforceWhitelist` already equals `enforce`\n if (enforceWhitelist == enforce) {\n return uint256(Error.NO_ERROR);\n }\n\n // Set comptroller's `enforceWhitelist` to `enforce`\n enforceWhitelist = enforce;\n\n // Emit WhitelistEnforcementChanged(bool enforce);\n emit WhitelistEnforcementChanged(enforce);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist `statuses` for `suppliers`\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\n }\n\n // Set whitelist statuses for suppliers\n for (uint256 i = 0; i < suppliers.length; i++) {\n address supplier = suppliers[i];\n\n if (statuses[i]) {\n // If not already whitelisted, add to whitelist\n if (!whitelist[supplier]) {\n whitelist[supplier] = true;\n whitelistArray.push(supplier);\n whitelistIndexes[supplier] = whitelistArray.length - 1;\n }\n } else {\n // If whitelisted, remove from whitelist\n if (whitelist[supplier]) {\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\n whitelistArray.pop(); // Reduce length by 1\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\n }\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new price oracle for the comptroller\n * @dev Admin function to set a new price oracle\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\n }\n\n // Track the old oracle for the comptroller\n BasePriceOracle oldOracle = oracle;\n\n // Set comptroller's oracle to newOracle\n oracle = newOracle;\n\n // Emit NewPriceOracle(oldOracle, newOracle)\n emit NewPriceOracle(oldOracle, newOracle);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the closeFactor used when liquidating borrows\n * @dev Admin function to set closeFactor\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\n }\n\n // Check limits\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\n if (lessThanExp(highLimit, newCloseFactorExp)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n // Set pool close factor to new close factor, remember old value\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\n closeFactorMantissa = newCloseFactorMantissa;\n\n // Emit event\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the collateralFactor for a market\n * @dev Admin function to set per-market collateralFactor\n * @param cToken The market to set the factor on\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\n }\n\n // Verify market is listed\n Market storage market = markets[address(cToken)];\n if (!market.isListed) {\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\n }\n\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\n\n // Check collateral factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\n }\n\n // If collateral factor != 0, fail if price == 0\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\n }\n\n // Set market's collateral factor to new collateral factor, remember old value\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\n market.collateralFactorMantissa = newCollateralFactorMantissa;\n\n // Emit event with asset, old collateral factor, and new collateral factor\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets liquidationIncentive\n * @dev Admin function to set liquidationIncentive\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\n }\n\n // Check de-scaled min <= newLiquidationIncentive <= max\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n // Save current value for use in log\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\n\n // Set liquidation incentive to new incentive\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\n\n // Emit event with old incentive, new incentive\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Add the market to the markets mapping and set it as listed\n * @dev Admin function to set isListed and add support for the market\n * @param cToken The address of the market (token) to list\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Is market already listed?\n if (markets[address(cToken)].isListed) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // Check cToken.comptroller == this\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\n\n // Make sure market is not already listed\n address underlying = ICErc20(address(cToken)).underlying();\n\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // List market and emit event\n Market storage market = markets[address(cToken)];\n market.isListed = true;\n market.collateralFactorMantissa = 0;\n allMarkets.push(cToken);\n cTokensByUnderlying[underlying] = cToken;\n emit MarketListed(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _deployMarket(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\n bool oldIonicAdminHasRights = ionicAdminHasRights;\n ionicAdminHasRights = true;\n\n // Deploy via Ionic admin\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\n // Reset Ionic admin rights to the original value\n ionicAdminHasRights = oldIonicAdminHasRights;\n // Support market here in the Comptroller\n uint256 err = _supportMarket(cToken);\n\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\n\n // Set collateral factor\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\n }\n\n function _becomeImplementation() external {\n require(msg.sender == address(this), \"!self call\");\n\n if (!_notEnteredInitialized) {\n _notEntered = true;\n _notEnteredInitialized = true;\n }\n }\n\n /*** Helper Functions ***/\n\n /**\n * @notice Returns true if the given cToken market has been deprecated\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\n * @param cToken The market to check if deprecated\n */\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\n return\n markets[address(cToken)].collateralFactorMantissa == 0 &&\n borrowGuardianPaused[address(cToken)] == true &&\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\n }\n\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\n return ComptrollerExtensionInterface(address(this));\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 36;\n\n functionSelectors = new bytes4[](fnsCount);\n\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\n functionSelectors[--fnsCount] = this._deployMarket.selector;\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\n functionSelectors[--fnsCount] = this.checkMembership.selector;\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\n functionSelectors[--fnsCount] = this.exitMarket.selector;\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\n functionSelectors[--fnsCount] = this.mintVerify.selector;\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\n functionSelectors[--fnsCount] = this.borrowVerify.selector;\n functionSelectors[--fnsCount] = this.repayBorrowVerify.selector;\n functionSelectors[--fnsCount] = this.seizeVerify.selector;\n functionSelectors[--fnsCount] = this.transferVerify.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n /**\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _beforeNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\n require(_notEntered, \"!reentered\");\n _notEntered = false;\n }\n\n /**\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _afterNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n}\n" + }, + "contracts/compound/ComptrollerFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, SFSRegister } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract ComptrollerFirstExtension is\n DiamondExtension,\n ComptrollerBase,\n ComptrollerExtensionInterface,\n ComptrollerErrorReporter\n{\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when supply cap for a cToken is changed\n event NewSupplyCap(ICErc20 indexed cToken, uint256 newSupplyCap);\n\n /// @notice Emitted when borrow cap for a cToken is changed\n event NewBorrowCap(ICErc20 indexed cToken, uint256 newBorrowCap);\n\n /// @notice Emitted when borrow cap guardian is changed\n event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian);\n\n /// @notice Emitted when pause guardian is changed\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\n\n /// @notice Emitted when an action is paused globally\n event ActionPaused(string action, bool pauseState);\n\n /// @notice Emitted when an action is paused on a market\n event MarketActionPaused(ICErc20 cToken, string action, bool pauseState);\n\n /// @notice Emitted when an admin unsupports a market\n event MarketUnlisted(ICErc20 cToken);\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 33;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.addNonAccruingFlywheel.selector;\n functionSelectors[--fnsCount] = this._setMarketSupplyCaps.selector;\n functionSelectors[--fnsCount] = this._setMarketBorrowCaps.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateralWhitelist.selector;\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateralWhitelist.selector;\n functionSelectors[--fnsCount] = this._supplyCapWhitelist.selector;\n functionSelectors[--fnsCount] = this._borrowCapWhitelist.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapGuardian.selector;\n functionSelectors[--fnsCount] = this._setPauseGuardian.selector;\n functionSelectors[--fnsCount] = this._setMintPaused.selector;\n functionSelectors[--fnsCount] = this._setBorrowPaused.selector;\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\n functionSelectors[--fnsCount] = this._unsupportMarket.selector;\n functionSelectors[--fnsCount] = this.getAllMarkets.selector;\n functionSelectors[--fnsCount] = this.getAllBorrowers.selector;\n functionSelectors[--fnsCount] = this.getAllBorrowersCount.selector;\n functionSelectors[--fnsCount] = this.getPaginatedBorrowers.selector;\n functionSelectors[--fnsCount] = this.getWhitelist.selector;\n functionSelectors[--fnsCount] = this.getRewardsDistributors.selector;\n functionSelectors[--fnsCount] = this.isUserOfPool.selector;\n functionSelectors[--fnsCount] = this.getAccruingFlywheels.selector;\n functionSelectors[--fnsCount] = this._removeFlywheel.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapForCollateral.selector;\n functionSelectors[--fnsCount] = this._blacklistBorrowingAgainstCollateral.selector;\n functionSelectors[--fnsCount] = this.isBorrowCapForCollateralWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isBlacklistBorrowingAgainstCollateralWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isSupplyCapWhitelisted.selector;\n functionSelectors[--fnsCount] = this.isBorrowCapWhitelisted.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedSuppliersSupply.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedBorrowersBorrows.selector;\n functionSelectors[--fnsCount] = this.getAssetAsCollateralValueCap.selector;\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /**\n * @notice Returns true if the accruing flyhwheel was found and replaced\n * @dev Adds a flywheel to the non-accruing list and if already in the accruing, removes it from that list\n * @param flywheelAddress The address of the flywheel to add to the non-accruing\n */\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool) {\n require(hasAdminRights(), \"!admin\");\n require(flywheelAddress != address(0), \"!flywheel\");\n\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\n require(flywheelAddress != nonAccruingRewardsDistributors[i], \"!alreadyadded\");\n }\n\n // add it to the non-accruing\n nonAccruingRewardsDistributors.push(flywheelAddress);\n\n // remove it from the accruing\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\n if (flywheelAddress == rewardsDistributors[i]) {\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\n rewardsDistributors.pop();\n return true;\n }\n }\n\n return false;\n }\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256) {\n if (address(collateral) == address(cTokenModify) && !redeeming) {\n // the collateral asset counts as 0 liquidity when borrowed\n return 0;\n }\n\n uint256 assetAsCollateralValueCap = type(uint256).max;\n if (address(cTokenModify) != address(0)) {\n // if the borrowed asset is blacklisted against this collateral & account is not whitelisted\n if (\n borrowingAgainstCollateralBlacklist[address(cTokenModify)][address(collateral)] &&\n !borrowingAgainstCollateralBlacklistWhitelist[address(cTokenModify)][address(collateral)].contains(account)\n ) {\n assetAsCollateralValueCap = 0;\n } else {\n // for each user the value of this kind of collateral is capped regardless of the amount borrowed\n // denominated in the borrowed asset\n uint256 borrowCapForCollateral = borrowCapForCollateral[address(cTokenModify)][address(collateral)];\n // check if set to any value & account is not whitelisted\n if (\n borrowCapForCollateral != 0 &&\n !borrowCapForCollateralWhitelist[address(cTokenModify)][address(collateral)].contains(account)\n ) {\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n // this asset usage as collateral is capped at the native value of the borrow cap\n assetAsCollateralValueCap = (borrowCapForCollateral * borrowedAssetPrice) / 1e18;\n }\n }\n }\n\n uint256 supplyCap = effectiveSupplyCaps(address(collateral));\n\n // if there is any supply cap, don't allow donations to the market/plugin to go around it\n if (supplyCap > 0 && !supplyCapWhitelist[address(collateral)].contains(account)) {\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateral);\n uint256 supplyCapValue = (supplyCap * collateralAssetPrice) / 1e18;\n supplyCapValue = (supplyCapValue * markets[address(collateral)].collateralFactorMantissa) / 1e18;\n if (supplyCapValue < assetAsCollateralValueCap) assetAsCollateralValueCap = supplyCapValue;\n }\n\n return assetAsCollateralValueCap;\n }\n\n /**\n * @notice Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert.\n * @dev Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying.\n * @param cTokens The addresses of the markets (tokens) to change the supply caps for\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.\n */\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n uint256 numMarkets = cTokens.length;\n uint256 numSupplyCaps = newSupplyCaps.length;\n\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \"!input\");\n\n for (uint256 i = 0; i < numMarkets; i++) {\n supplyCaps[address(cTokens[i])] = newSupplyCaps[i];\n emit NewSupplyCap(cTokens[i], newSupplyCaps[i]);\n }\n }\n\n /**\n * @notice Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert.\n * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing.\n * @param cTokens The addresses of the markets (tokens) to change the borrow caps for\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.\n */\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n uint256 numMarkets = cTokens.length;\n uint256 numBorrowCaps = newBorrowCaps.length;\n\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \"!input\");\n\n for (uint256 i = 0; i < numMarkets; i++) {\n borrowCaps[address(cTokens[i])] = newBorrowCaps[i];\n emit NewBorrowCap(cTokens[i], newBorrowCaps[i]);\n }\n }\n\n /**\n * @notice Admin function to change the Borrow Cap Guardian\n * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian\n */\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external {\n require(msg.sender == admin, \"!admin\");\n\n // Save current value for inclusion in log\n address oldBorrowCapGuardian = borrowCapGuardian;\n\n // Store borrowCapGuardian with value newBorrowCapGuardian\n borrowCapGuardian = newBorrowCapGuardian;\n\n // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)\n emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);\n }\n\n /**\n * @notice Admin function to change the Pause Guardian\n * @param newPauseGuardian The address of the new Pause Guardian\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _setPauseGuardian(address newPauseGuardian) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK);\n }\n\n // Save current value for inclusion in log\n address oldPauseGuardian = pauseGuardian;\n\n // Store pauseGuardian with value newPauseGuardian\n pauseGuardian = newPauseGuardian;\n\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\n emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);\n\n return uint256(Error.NO_ERROR);\n }\n\n function _setMintPaused(ICErc20 cToken, bool state) public returns (bool) {\n require(markets[address(cToken)].isListed, \"!market\");\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n mintGuardianPaused[address(cToken)] = state;\n emit MarketActionPaused(cToken, \"Mint\", state);\n return state;\n }\n\n function _setBorrowPaused(ICErc20 cToken, bool state) public returns (bool) {\n require(markets[address(cToken)].isListed, \"!market\");\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n borrowGuardianPaused[address(cToken)] = state;\n emit MarketActionPaused(cToken, \"Borrow\", state);\n return state;\n }\n\n function _setTransferPaused(bool state) public returns (bool) {\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n transferGuardianPaused = state;\n emit ActionPaused(\"Transfer\", state);\n return state;\n }\n\n function _setSeizePaused(bool state) public returns (bool) {\n require(msg.sender == pauseGuardian || hasAdminRights(), \"!guardian\");\n require(hasAdminRights() || state == true, \"!admin\");\n\n seizeGuardianPaused = state;\n emit ActionPaused(\"Seize\", state);\n return state;\n }\n\n /**\n * @notice Removed a market from the markets mapping and sets it as unlisted\n * @dev Admin function unset isListed and collateralFactorMantissa and unadd support for the market\n * @param cToken The address of the market (token) to unlist\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _unsupportMarket(ICErc20 cToken) external returns (uint256) {\n // Check admin rights\n if (!hasAdminRights()) return fail(Error.UNAUTHORIZED, FailureInfo.UNSUPPORT_MARKET_OWNER_CHECK);\n\n // Check if market is already unlisted\n if (!markets[address(cToken)].isListed)\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNSUPPORT_MARKET_DOES_NOT_EXIST);\n\n // Check if market is in use\n if (cToken.totalSupply() > 0) return fail(Error.NONZERO_TOTAL_SUPPLY, FailureInfo.UNSUPPORT_MARKET_IN_USE);\n\n // Unlist market\n delete markets[address(cToken)];\n\n /* Delete cToken from allMarkets */\n // load into memory for faster iteration\n ICErc20[] memory _allMarkets = allMarkets;\n uint256 len = _allMarkets.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (_allMarkets[i] == cToken) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n allMarkets[assetIndex] = allMarkets[allMarkets.length - 1];\n allMarkets.pop();\n\n cTokensByUnderlying[ICErc20(address(cToken)).underlying()] = ICErc20(address(0));\n emit MarketUnlisted(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) public {\n require(hasAdminRights(), \"!admin\");\n borrowCapForCollateral[cTokenBorrow][cTokenCollateral] = borrowCap;\n }\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].add(account);\n else borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\n }\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) public view returns (bool) {\n return borrowCapForCollateralWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\n }\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n borrowingAgainstCollateralBlacklist[cTokenBorrow][cTokenCollateral] = blacklisted;\n }\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].add(account);\n else borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].remove(account);\n }\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) public view returns (bool) {\n return borrowingAgainstCollateralBlacklistWhitelist[cTokenBorrow][cTokenCollateral].contains(account);\n }\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) supplyCapWhitelist[cToken].add(account);\n else supplyCapWhitelist[cToken].remove(account);\n }\n\n function isSupplyCapWhitelisted(address cToken, address account) public view returns (bool) {\n return supplyCapWhitelist[cToken].contains(account);\n }\n\n function getWhitelistedSuppliersSupply(address cToken) public view returns (uint256 supplied) {\n address[] memory whitelistedSuppliers = supplyCapWhitelist[cToken].values();\n for (uint256 i = 0; i < whitelistedSuppliers.length; i++) {\n supplied += ICErc20(cToken).balanceOfUnderlying(whitelistedSuppliers[i]);\n }\n }\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) public {\n require(hasAdminRights(), \"!admin\");\n\n if (whitelisted) borrowCapWhitelist[cToken].add(account);\n else borrowCapWhitelist[cToken].remove(account);\n }\n\n function isBorrowCapWhitelisted(address cToken, address account) public view returns (bool) {\n return borrowCapWhitelist[cToken].contains(account);\n }\n\n function getWhitelistedBorrowersBorrows(address cToken) public view returns (uint256 borrowed) {\n address[] memory whitelistedBorrowers = borrowCapWhitelist[cToken].values();\n for (uint256 i = 0; i < whitelistedBorrowers.length; i++) {\n borrowed += ICErc20(cToken).borrowBalanceCurrent(whitelistedBorrowers[i]);\n }\n }\n\n /**\n * @notice Return all of the markets\n * @dev The automatic getter may be used to access an individual market.\n * @return The list of market addresses\n */\n function getAllMarkets() public view returns (ICErc20[] memory) {\n return allMarkets;\n }\n\n /**\n * @notice Return all of the borrowers\n * @dev The automatic getter may be used to access an individual borrower.\n * @return The list of borrower account addresses\n */\n function getAllBorrowers() public view returns (address[] memory) {\n return allBorrowers;\n }\n\n function getAllBorrowersCount() public view returns (uint256) {\n return allBorrowers.length;\n }\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) public view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) {\n uint256 allBorrowersCount = allBorrowers.length;\n if (allBorrowersCount == 0) {\n return (0, new address[](0));\n }\n\n if (pageSize == 0) pageSize = 300;\n uint256 currentPageSize = pageSize;\n uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize;\n\n _totalPages = allBorrowersCount / pageSize;\n if (sizeOfPageFromRemainder > 0) {\n _totalPages++;\n if (page + 1 == _totalPages) {\n currentPageSize = sizeOfPageFromRemainder;\n }\n }\n\n if (page + 1 > _totalPages) {\n return (_totalPages, new address[](0));\n }\n\n uint256 offset = page * pageSize;\n _pageOfBorrowers = new address[](currentPageSize);\n for (uint256 i = 0; i < currentPageSize; i++) {\n _pageOfBorrowers[i] = allBorrowers[i + offset];\n }\n }\n\n /**\n * @notice Return all of the whitelist\n * @dev The automatic getter may be used to access an individual whitelist status.\n * @return The list of borrower account addresses\n */\n function getWhitelist() external view returns (address[] memory) {\n return whitelistArray;\n }\n\n /**\n * @notice Returns an array of all accruing and non-accruing flywheels\n */\n function getRewardsDistributors() external view returns (address[] memory) {\n address[] memory allFlywheels = new address[](rewardsDistributors.length + nonAccruingRewardsDistributors.length);\n\n uint8 i = 0;\n while (i < rewardsDistributors.length) {\n allFlywheels[i] = rewardsDistributors[i];\n i++;\n }\n uint8 j = 0;\n while (j < nonAccruingRewardsDistributors.length) {\n allFlywheels[i + j] = nonAccruingRewardsDistributors[j];\n j++;\n }\n\n return allFlywheels;\n }\n\n function getAccruingFlywheels() external view returns (address[] memory) {\n return rewardsDistributors;\n }\n\n /**\n * @dev Removes a flywheel from the accruing or non-accruing array\n * @param flywheelAddress The address of the flywheel to remove from the accruing or non-accruing array\n * @return true if the flywheel was found and removed\n */\n function _removeFlywheel(address flywheelAddress) external returns (bool) {\n require(hasAdminRights(), \"!admin\");\n require(flywheelAddress != address(0), \"!flywheel\");\n\n // remove it from the accruing\n for (uint256 i = 0; i < rewardsDistributors.length; i++) {\n if (flywheelAddress == rewardsDistributors[i]) {\n rewardsDistributors[i] = rewardsDistributors[rewardsDistributors.length - 1];\n rewardsDistributors.pop();\n return true;\n }\n }\n\n // or remove it from the non-accruing\n for (uint256 i = 0; i < nonAccruingRewardsDistributors.length; i++) {\n if (flywheelAddress == nonAccruingRewardsDistributors[i]) {\n nonAccruingRewardsDistributors[i] = nonAccruingRewardsDistributors[nonAccruingRewardsDistributors.length - 1];\n nonAccruingRewardsDistributors.pop();\n return true;\n }\n }\n\n return false;\n }\n\n function isUserOfPool(address user) external view returns (bool) {\n for (uint256 i = 0; i < allMarkets.length; i++) {\n address marketAddress = address(allMarkets[i]);\n if (markets[marketAddress].accountMembership[user]) {\n return true;\n }\n }\n\n return false;\n }\n\n function registerInSFS() external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\n\n for (uint256 i = 0; i < allMarkets.length; i++) {\n allMarkets[i].registerInSFS();\n }\n\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\n }\n}\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\ninterface ComptrollerInterface {\n function isDeprecated(ICErc20 cToken) external view returns (bool);\n\n function _becomeImplementation() external;\n\n function _deployMarket(\n uint8 delegateType,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\n\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\n\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _addRewardsDistributor(address distributor) external returns (uint256);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) external view returns (uint256, uint256, uint256, uint256);\n\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\n\n /*** Assets You Are In ***/\n\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cToken) external returns (uint256);\n\n /*** Policy Hooks ***/\n\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\n\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\n\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\n\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\n\n function borrowVerify(address cToken, address borrower) external;\n\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\n\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external;\n\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n \n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external;\n\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\n \n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\n\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\n\n /*** Liquidity/Liquidation Calculations ***/\n\n function getAccountLiquidity(\n address account\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\n\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 repayAmount\n ) external view returns (uint256, uint256);\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n function _beforeNonReentrant() external;\n\n function _afterNonReentrant() external;\n\n /*** New supply and borrow cap view functions ***/\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\n}\n\ninterface ComptrollerStorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function pendingAdmin() external view returns (address);\n\n function oracle() external view returns (BasePriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function enforceWhitelist() external view returns (bool);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function suppliers(address account) external view returns (bool);\n\n function cTokensByUnderlying(address) external view returns (address);\n\n /**\n * Gets the supply cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\n * `effectiveSupplyCaps` to get the correct supply cap.\n * @param cToken The address of the cToken.\n * @return The supply cap in the units of the underlying asset.\n */\n function supplyCaps(address cToken) external view returns (uint256);\n\n /**\n * Gets the borrow cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\n * `effectiveBorrowCaps` to get the correct borrow cap.\n * @param cToken The address of the cToken.\n * @return The borrow cap in the units of the underlying asset.\n */\n function borrowCaps(address cToken) external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function accountAssets(address, uint256) external view returns (address);\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function rewardsDistributors(uint256) external view returns (address);\n}\n\ninterface SFSRegister {\n function register(address _recipient) external returns (uint256 tokenId);\n}\n\ninterface ComptrollerExtensionInterface {\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function getAllBorrowersCount() external view returns (uint256);\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAccruingFlywheels() external view returns (address[] memory);\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) external;\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _removeFlywheel(address flywheelAddress) external returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\n\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\n\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\n\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\n\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\n\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setTransferPaused(bool state) external returns (bool);\n\n function _setSeizePaused(bool state) external returns (bool);\n\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\n * @return The config.\n */\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\n * @return The config.\n */\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\n * @param newConfig The new config.\n */\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\n * @param newConfig The new config.\n */\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n}\n\ninterface UnitrollerInterface {\n function comptrollerImplementation() external view returns (address);\n\n function _upgrade() external;\n\n function _acceptAdmin() external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n\n function _toggleAdminRights(bool hasRights) external returns (uint256);\n}\n\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\n\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\n\ninterface IonicComptroller is\n ComptrollerInterface,\n ComptrollerExtensionInterface,\n UnitrollerInterface,\n ComptrollerStorageInterface\n{\n\n}\n\nabstract contract ComptrollerBase is ComptrollerV4Storage {\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n bool public constant isComptroller = true;\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\n\n // Check if we're using Adrastia Prudentia for the supply cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the supply cap from Adrastia Prudentia\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n supplyCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n supplyCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local supply cap\n\n // Get the supply cap from the local supply cap\n supplyCap = supplyCaps[cToken];\n }\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\n\n // Check if we're using Adrastia Prudentia for the borrow cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the borrow cap from Adrastia Prudentia\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n borrowCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n borrowCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local borrow cap\n borrowCap = borrowCaps[cToken];\n }\n }\n}\n" + }, + "contracts/compound/ComptrollerPrudentiaCapsExt.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerPrudentiaCapsExtInterface, ComptrollerBase } from \"./ComptrollerInterface.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\n/**\n * @title ComptrollerPrudentiaCapsExt\n * @author Tyler Loewen (TRILEZ SOFTWARE INC. dba. Adrastia)\n * @notice A diamond extension that allows the Comptroller to use Adrastia Prudentia to control supply and borrow caps.\n */\ncontract ComptrollerPrudentiaCapsExt is DiamondExtension, ComptrollerBase, ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Emitted when the Adrastia Prudentia supply cap config is changed.\n * @param oldConfig The old config.\n * @param newConfig The new config.\n */\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n /**\n * @notice Emitted when the Adrastia Prudentia borrow cap config is changed.\n * @param oldConfig The old config.\n * @param newConfig The new config.\n */\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n PrudentiaLib.PrudentiaConfig memory oldConfig = supplyCapConfig;\n supplyCapConfig = newConfig;\n\n emit NewSupplyCapConfig(oldConfig, newConfig);\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external {\n require(msg.sender == admin || msg.sender == borrowCapGuardian, \"!admin\");\n\n PrudentiaLib.PrudentiaConfig memory oldConfig = borrowCapConfig;\n borrowCapConfig = newConfig;\n\n emit NewBorrowCapConfig(oldConfig, newConfig);\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\n return borrowCapConfig;\n }\n\n /// @inheritdoc ComptrollerPrudentiaCapsExtInterface\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory) {\n return supplyCapConfig;\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 4;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this._setSupplyCapConfig.selector;\n functionSelectors[--fnsCount] = this._setBorrowCapConfig.selector;\n functionSelectors[--fnsCount] = this.getBorrowCapConfig.selector;\n functionSelectors[--fnsCount] = this.getSupplyCapConfig.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IFeeDistributor.sol\";\nimport \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract UnitrollerAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n\n /**\n * @notice Administrator for this contract\n */\n address public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address public pendingAdmin;\n\n /**\n * @notice Whether or not the Ionic admin has admin rights\n */\n bool public ionicAdminHasRights = true;\n\n /**\n * @notice Whether or not the admin has admin rights\n */\n bool public adminHasRights = true;\n\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\n }\n}\n\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\n /**\n * @notice Oracle which gives the price of any given asset\n */\n BasePriceOracle public oracle;\n\n /**\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\n */\n uint256 public closeFactorMantissa;\n\n /**\n * @notice Multiplier representing the discount on collateral that a liquidator receives\n */\n uint256 public liquidationIncentiveMantissa;\n\n /*\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\n */\n uint256 internal maxAssets;\n\n /**\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\n */\n mapping(address => ICErc20[]) public accountAssets;\n}\n\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\n struct Market {\n // Whether or not this market is listed\n bool isListed;\n // Multiplier representing the most one can borrow against their collateral in this market.\n // For instance, 0.9 to allow borrowing 90% of collateral value.\n // Must be between 0 and 1, and stored as a mantissa.\n uint256 collateralFactorMantissa;\n // Per-market mapping of \"accounts in this asset\"\n mapping(address => bool) accountMembership;\n }\n\n /**\n * @notice Official mapping of cTokens -> Market metadata\n * @dev Used e.g. to determine if a market is supported\n */\n mapping(address => Market) public markets;\n\n /// @notice A list of all markets\n ICErc20[] public allMarkets;\n\n /**\n * @dev Maps borrowers to booleans indicating if they have entered any markets\n */\n mapping(address => bool) internal borrowers;\n\n /// @notice A list of all borrowers who have entered markets\n address[] public allBorrowers;\n\n // Indexes of borrower account addresses in the `allBorrowers` array\n mapping(address => uint256) internal borrowerIndexes;\n\n /**\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\n */\n mapping(address => bool) public suppliers;\n\n /// @notice All cTokens addresses mapped by their underlying token addresses\n mapping(address => ICErc20) public cTokensByUnderlying;\n\n /// @notice Whether or not the supplier whitelist is enforced\n bool public enforceWhitelist;\n\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\n mapping(address => bool) public whitelist;\n\n /// @notice An array of all whitelisted accounts\n address[] public whitelistArray;\n\n // Indexes of account addresses in the `whitelistArray` array\n mapping(address => uint256) internal whitelistIndexes;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n * Actions which allow users to remove their own assets cannot be paused.\n * Liquidation / seizing / transfer can only be paused globally, not by market.\n */\n address public pauseGuardian;\n bool public _mintGuardianPaused;\n bool public _borrowGuardianPaused;\n bool public transferGuardianPaused;\n bool public seizeGuardianPaused;\n mapping(address => bool) public mintGuardianPaused;\n mapping(address => bool) public borrowGuardianPaused;\n}\n\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\n address public borrowCapGuardian;\n\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\n mapping(address => uint256) public borrowCaps;\n\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\n mapping(address => uint256) public supplyCaps;\n\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\n address[] public rewardsDistributors;\n\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\n bool internal _notEntered;\n\n /// @dev Whether or not _notEntered has been initialized\n bool internal _notEnteredInitialized;\n\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\n address[] public nonAccruingRewardsDistributors;\n\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\n\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => mapping(address => EnumerableSet.AddressSet))\n internal borrowingAgainstCollateralBlacklistWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\n}\n\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\n /// @dev Adrastia Prudentia config for controlling borrow caps.\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\n\n /// @dev Adrastia Prudentia config for controlling supply caps.\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\n}\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\n/**\n * @title Compound's CErc20 Contract\n * @notice CTokens which wrap an EIP-20 underlying\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\n * @author Compound\n */\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n modifier isMinHFThresholdExceeded(address borrower) {\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\n _;\n } else {\n _;\n }\n }\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 13;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.mint.selector;\n functionSelectors[--fnsCount] = this.redeem.selector;\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\n functionSelectors[--fnsCount] = this.borrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\n functionSelectors[--fnsCount] = this.getCash.selector;\n functionSelectors[--fnsCount] = this.seize.selector;\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemInternal(redeemTokens);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemUnderlyingInternal(redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return borrowInternal(borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\n return err;\n }\n\n /**\n * @notice Get cash balance of this cToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view override returns (uint256) {\n return getCashInternal();\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another cToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\n }\n\n function selfTransferOut(address to, uint256 amount) external override {\n require(msg.sender == address(this), \"!self\");\n doTransferOut(to, amount);\n }\n\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\n require(msg.sender == address(this), \"!self\");\n return doTransferIn(from, amount);\n }\n\n /**\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\n }\n\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalIonicFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\n totalIonicFees = totalIonicFeesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(address(ionicAdmin), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces admin fees by transferring to admin\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalAdminFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n totalAdminFees = totalAdminFees - withdrawAmount;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view virtual returns (uint256) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\n \"TOKEN_TRANSFER_IN_FAILED\"\n );\n\n // Calculate the amount that was *actually* transferred\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address to, uint256 amount) internal virtual {\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\n \"TOKEN_TRANSFER_OUT_FAILED\"\n );\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n struct MintLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 mintTokens;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n uint256 actualMintAmount;\n }\n\n /**\n * @notice User supplies assets into the market and receives cTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\n /* Fail if mint not allowed */\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n // Check max supply\n // unused function\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n } */\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of cTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n // mintTokens is rounded down here - correct\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\n\n /*\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\n\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, 0, redeemAmount);\n }\n\n struct RedeemLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 redeemTokens;\n uint256 redeemAmount;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n }\n\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\n res = (x * 1e18) / y;\n if (x % y != 0) res += 1;\n }\n\n /**\n * @notice User redeems cTokens in exchange for the underlying asset\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemFresh(\n address redeemer,\n uint256 redeemTokensIn,\n uint256 redeemAmountIn\n ) internal returns (uint256) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\n\n RedeemLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n if (redeemTokensIn > 0) {\n // don't allow dust tokens/assets to be left after\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\n\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n } else {\n if (redeemAmountIn == type(uint256).max) {\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\n }\n\n // don't allow dust tokens/assets to be left after\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\n\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\n\n // don't allow dust tokens/assets to be left after\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashInternal() < vars.redeemAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the redeemer and the redeemAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(redeemer, vars.redeemAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\n\n /* We call the defense hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(msg.sender, borrowAmount);\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n }\n\n /**\n * @notice Users borrow assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\n /* Fail if borrow not allowed */\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\n }\n\n /* Fail gracefully if protocol has insufficient underlying cash */\n uint256 cashPrior = getCashInternal();\n\n if (cashPrior < borrowAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n uint256(vars.mathErr)\n );\n }\n\n // Check min borrow for this user for this asset\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the borrower and the borrowAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(borrower, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.borrowVerify(address(this), borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\n internal\n nonReentrant(false)\n returns (uint256, uint256)\n {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint256 repayAmount;\n uint256 borrowerIndex;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n uint256 actualRepayAmount;\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer the account paying off the borrow\n * @param borrower the account with the debt being payed off\n * @param repayAmount the amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(\n address payer,\n address borrower,\n uint256 repayAmount\n ) internal returns (uint256, uint256) {\n /* Fail if repayBorrow not allowed */\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == type(uint256).max) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\n\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n ICErc20(cTokenCollateral).accrueInterest();\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal returns (uint256, uint256) {\n /* Fail if liquidate not allowed */\n uint256 allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n cTokenCollateral,\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify cTokenCollateral market's block number equals current block number */\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == type(uint256).max) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n cTokenCollateral,\n actualRepayAmount\n );\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint256 seizeError;\n if (cTokenCollateral == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\n\n /* We call the defense hook */\n // unused function\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\n\n return (uint256(Error.NO_ERROR), actualRepayAmount);\n }\n\n struct SeizeInternalLocalVars {\n MathError mathErr;\n uint256 borrowerTokensNew;\n uint256 liquidatorTokensNew;\n uint256 liquidatorSeizeTokens;\n uint256 protocolSeizeTokens;\n uint256 protocolSeizeAmount;\n uint256 exchangeRateMantissa;\n uint256 totalReservesNew;\n uint256 totalIonicFeeNew;\n uint256 totalSupplyNew;\n uint256 feeSeizeTokens;\n uint256 feeSeizeAmount;\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) internal returns (uint256) {\n /* Fail if seize not allowed */\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n SeizeInternalLocalVars memory vars;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\n }\n\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n vars.protocolSeizeAmount = mul_ScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n vars.protocolSeizeTokens\n );\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\n\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\n\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n totalReserves = vars.totalReservesNew;\n totalSupply = vars.totalSupplyNew;\n totalIonicFees = vars.totalIonicFeeNew;\n\n accountTokens[borrower] = vars.borrowerTokensNew;\n accountTokens[liquidator] = vars.liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\n\n /* We call the defense hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n function asCTokenExtension() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CTokenFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { IFlashLoanReceiver } from \"../ionic/IFlashLoanReceiver.sol\";\nimport { CErc20FirstExtensionBase, CTokenFirstExtensionInterface, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { SFSRegister } from \"./ComptrollerInterface.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport { Multicall } from \"../utils/Multicall.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenFirstExtension is\n CTokenOracleProtected,\n CErc20FirstExtensionBase,\n TokenErrorReporter,\n Exponential,\n DiamondExtension,\n Multicall\n{\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 25;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.transfer.selector;\n functionSelectors[--fnsCount] = this.transferFrom.selector;\n functionSelectors[--fnsCount] = this.allowance.selector;\n functionSelectors[--fnsCount] = this.approve.selector;\n functionSelectors[--fnsCount] = this.balanceOf.selector;\n functionSelectors[--fnsCount] = this._setAdminFee.selector;\n functionSelectors[--fnsCount] = this._setInterestRateModel.selector;\n functionSelectors[--fnsCount] = this._setNameAndSymbol.selector;\n functionSelectors[--fnsCount] = this._setAddressesProvider.selector;\n functionSelectors[--fnsCount] = this._setReserveFactor.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlock.selector;\n functionSelectors[--fnsCount] = this.borrowRatePerBlock.selector;\n functionSelectors[--fnsCount] = this.exchangeRateCurrent.selector;\n functionSelectors[--fnsCount] = this.accrueInterest.selector;\n functionSelectors[--fnsCount] = this.totalBorrowsCurrent.selector;\n functionSelectors[--fnsCount] = this.balanceOfUnderlying.selector;\n functionSelectors[--fnsCount] = this.multicall.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterDeposit.selector;\n functionSelectors[--fnsCount] = this.supplyRatePerBlockAfterWithdraw.selector;\n functionSelectors[--fnsCount] = this.borrowRatePerBlockAfterBorrow.selector;\n functionSelectors[--fnsCount] = this.getTotalUnderlyingSupplied.selector;\n functionSelectors[--fnsCount] = this.flash.selector;\n functionSelectors[--fnsCount] = this.getAccountSnapshot.selector;\n functionSelectors[--fnsCount] = this.borrowBalanceCurrent.selector;\n functionSelectors[--fnsCount] = this.registerInSFS.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function getTotalUnderlyingSupplied() public view override returns (uint256) {\n // (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees))\n return asCToken().getCash() + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees);\n }\n\n /* ERC20 fns */\n /**\n * @notice Transfer `tokens` tokens from `src` to `dst` by `spender`\n * @dev Called by both `transfer` and `transferFrom` internally\n * @param spender The address of the account performing the transfer\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param tokens The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferTokens(address spender, address src, address dst, uint256 tokens) internal returns (uint256) {\n /* Fail if transfer not allowed */\n uint256 allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Do not allow self-transfers */\n if (src == dst) {\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n /* Get the allowance, infinite for the account owner */\n uint256 startingAllowance = 0;\n if (spender == src) {\n startingAllowance = type(uint256).max;\n } else {\n startingAllowance = transferAllowances[src][spender];\n }\n\n /* Do the calculations, checking for {under,over}flow */\n MathError mathErr;\n uint256 allowanceNew;\n uint256 srcTokensNew;\n uint256 dstTokensNew;\n\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n (mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\n }\n\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n accountTokens[src] = srcTokensNew;\n accountTokens[dst] = dstTokensNew;\n\n /* Eat some of the allowance (if necessary) */\n if (startingAllowance != type(uint256).max) {\n transferAllowances[src][spender] = allowanceNew;\n }\n\n /* We emit a Transfer event */\n emit Transfer(src, dst, tokens);\n\n /* We call the defense hook */\n comptroller.transferVerify(address(this), src, dst, tokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(\n address dst,\n uint256 amount\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) public override nonReentrant(false) isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n return transferTokens(msg.sender, src, dst, amount) == uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(\n address spender,\n uint256 amount\n ) public override isAuthorized onlyOracleApprovedAllowEOA returns (bool) {\n address src = msg.sender;\n transferAllowances[src][spender] = amount;\n emit Approval(src, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) public view override returns (uint256) {\n return transferAllowances[owner][spender];\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) public view override returns (uint256) {\n return accountTokens[owner];\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice updates the cToken ERC20 name and symbol\n * @dev Admin function to update the cToken ERC20 name and symbol\n * @param _name the new ERC20 token name to use\n * @param _symbol the new ERC20 token symbol to use\n */\n function _setNameAndSymbol(string calldata _name, string calldata _symbol) external {\n // Check caller is admin\n require(hasAdminRights(), \"!admin\");\n\n // Set ERC20 name and symbol\n name = _name;\n symbol = _symbol;\n }\n\n function _setAddressesProvider(address _ap) external {\n // Check caller is admin\n require(hasAdminRights(), \"!admin\");\n\n ap = AddressesProvider(_ap);\n }\n\n /**\n * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n * @dev Admin function to accrue interest and set a new reserve factor\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setReserveFactor(\n uint256 newReserveFactorMantissa\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);\n }\n\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\n }\n\n // Check newReserveFactor ≤ maxReserveFactor\n if (newReserveFactorMantissa + adminFeeMantissa + ionicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\n }\n\n uint256 oldReserveFactorMantissa = reserveFactorMantissa;\n reserveFactorMantissa = newReserveFactorMantissa;\n\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice accrues interest and sets a new admin fee for the protocol using _setAdminFeeFresh\n * @dev Admin function to accrue interest and set a new admin fee\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setAdminFee(\n uint256 newAdminFeeMantissa\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_ADMIN_FEE_FRESH_CHECK);\n }\n\n // Sanitize newAdminFeeMantissa\n if (newAdminFeeMantissa == type(uint256).max) newAdminFeeMantissa = adminFeeMantissa;\n\n // Get latest Ionic fee\n uint256 newIonicFeeMantissa = IFeeDistributor(ionicAdmin).interestFeeRate();\n\n // Check reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa ≤ reserveFactorPlusFeesMaxMantissa\n if (reserveFactorMantissa + newAdminFeeMantissa + newIonicFeeMantissa > reserveFactorPlusFeesMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_ADMIN_FEE_BOUNDS_CHECK);\n }\n\n // If setting admin fee\n if (adminFeeMantissa != newAdminFeeMantissa) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_ADMIN_FEE_ADMIN_CHECK);\n }\n\n // Set admin fee\n uint256 oldAdminFeeMantissa = adminFeeMantissa;\n adminFeeMantissa = newAdminFeeMantissa;\n\n // Emit event\n emit NewAdminFee(oldAdminFeeMantissa, newAdminFeeMantissa);\n }\n\n // If setting Ionic fee\n if (ionicFeeMantissa != newIonicFeeMantissa) {\n // Set Ionic fee\n uint256 oldIonicFeeMantissa = ionicFeeMantissa;\n ionicFeeMantissa = newIonicFeeMantissa;\n\n // Emit event\n emit NewIonicFee(oldIonicFeeMantissa, newIonicFeeMantissa);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice accrues interest and updates the interest rate model using _setInterestRateModelFresh\n * @dev Admin function to accrue interest and update the interest rate model\n * @param newInterestRateModel the new interest rate model to use\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setInterestRateModel(\n InterestRateModel newInterestRateModel\n ) public override nonReentrant(false) returns (uint256) {\n accrueInterest();\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_INTEREST_RATE_MODEL_OWNER_CHECK);\n }\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\n }\n\n require(newInterestRateModel.isInterestRateModel(), \"!notIrm\");\n\n InterestRateModel oldInterestRateModel = interestRateModel;\n interestRateModel = newInterestRateModel;\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this cToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() public view override returns (uint256) {\n return\n interestRateModel.getBorrowRate(\n asCToken().getCash(),\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees\n );\n }\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) public view returns (uint256) {\n uint256 cash = asCToken().getCash();\n require(cash >= borrowAmount, \"market cash not enough\");\n\n return\n interestRateModel.getBorrowRate(\n cash - borrowAmount,\n totalBorrows + borrowAmount,\n totalReserves + totalAdminFees + totalIonicFees\n );\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this cToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() public view override returns (uint256) {\n return\n interestRateModel.getSupplyRate(\n asCToken().getCash(),\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256) {\n return\n interestRateModel.getSupplyRate(\n asCToken().getCash() + mintAmount,\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256) {\n uint256 cash = asCToken().getCash();\n require(cash >= withdrawAmount, \"market cash not enough\");\n return\n interestRateModel.getSupplyRate(\n cash - withdrawAmount,\n totalBorrows,\n totalReserves + totalAdminFees + totalIonicFees,\n reserveFactorMantissa + ionicFeeMantissa + adminFeeMantissa\n );\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public view override returns (uint256) {\n if (block.number == accrualBlockNumber) {\n return\n _exchangeRateHypothetical(\n totalSupply,\n initialExchangeRateMantissa,\n asCToken().getCash(),\n totalBorrows,\n totalReserves,\n totalAdminFees,\n totalIonicFees\n );\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n\n return\n _exchangeRateHypothetical(\n accrual.totalSupply,\n initialExchangeRateMantissa,\n cashPrior,\n accrual.totalBorrows,\n accrual.totalReserves,\n accrual.totalAdminFees,\n accrual.totalIonicFees\n );\n }\n }\n\n function _exchangeRateHypothetical(\n uint256 _totalSupply,\n uint256 _initialExchangeRateMantissa,\n uint256 _totalCash,\n uint256 _totalBorrows,\n uint256 _totalReserves,\n uint256 _totalAdminFees,\n uint256 _totalIonicFees\n ) internal pure returns (uint256) {\n if (_totalSupply == 0) {\n /*\n * If there are no tokens minted:\n * exchangeRate = initialExchangeRate\n */\n return _initialExchangeRateMantissa;\n } else {\n /*\n * Otherwise:\n * exchangeRate = (totalCash + totalBorrows - (totalReserves + totalIonicFees + totalAdminFees)) / totalSupply\n */\n uint256 cashPlusBorrowsMinusReserves;\n Exp memory exchangeRate;\n MathError mathErr;\n\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(\n _totalCash,\n _totalBorrows,\n _totalReserves + _totalAdminFees + _totalIonicFees\n );\n require(mathErr == MathError.NO_ERROR, \"!addThenSubUInt overflow check failed\");\n\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\n require(mathErr == MathError.NO_ERROR, \"!getExp overflow check failed\");\n\n return exchangeRate.mantissa;\n }\n }\n\n struct InterestAccrual {\n uint256 accrualBlockNumber;\n uint256 borrowIndex;\n uint256 totalSupply;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalIonicFees;\n uint256 totalAdminFees;\n uint256 interestAccumulated;\n }\n\n function _accrueInterestHypothetical(\n uint256 blockNumber,\n uint256 cashPrior\n ) internal view returns (InterestAccrual memory accrual) {\n uint256 totalFees = totalAdminFees + totalIonicFees;\n uint256 borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, totalBorrows, totalReserves + totalFees);\n if (borrowRateMantissa > borrowRateMaxMantissa) {\n if (cashPrior > totalFees) revert(\"!borrowRate\");\n else borrowRateMantissa = borrowRateMaxMantissa;\n }\n (MathError mathErr, uint256 blockDelta) = subUInt(blockNumber, accrualBlockNumber);\n require(mathErr == MathError.NO_ERROR, \"!blockDelta\");\n\n /*\n * Calculate the interest accumulated into borrows and reserves and the new index:\n * simpleInterestFactor = borrowRate * blockDelta\n * interestAccumulated = simpleInterestFactor * totalBorrows\n * totalBorrowsNew = interestAccumulated + totalBorrows\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\n * totalIonicFeesNew = interestAccumulated * ionicFee + totalIonicFees\n * totalAdminFeesNew = interestAccumulated * adminFee + totalAdminFees\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\n */\n\n accrual.accrualBlockNumber = blockNumber;\n accrual.totalSupply = totalSupply;\n Exp memory simpleInterestFactor = mul_(Exp({ mantissa: borrowRateMantissa }), blockDelta);\n accrual.interestAccumulated = mul_ScalarTruncate(simpleInterestFactor, totalBorrows);\n accrual.totalBorrows = accrual.interestAccumulated + totalBorrows;\n accrual.totalReserves = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: reserveFactorMantissa }),\n accrual.interestAccumulated,\n totalReserves\n );\n accrual.totalIonicFees = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: ionicFeeMantissa }),\n accrual.interestAccumulated,\n totalIonicFees\n );\n accrual.totalAdminFees = mul_ScalarTruncateAddUInt(\n Exp({ mantissa: adminFeeMantissa }),\n accrual.interestAccumulated,\n totalAdminFees\n );\n accrual.borrowIndex = mul_ScalarTruncateAddUInt(simpleInterestFactor, borrowIndex, borrowIndex);\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() public override returns (uint256) {\n /* Remember the initial block number */\n uint256 currentBlockNumber = block.number;\n\n /* Short-circuit accumulating 0 interest */\n if (accrualBlockNumber == currentBlockNumber) {\n return uint256(Error.NO_ERROR);\n }\n\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(currentBlockNumber, cashPrior);\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n accrualBlockNumber = currentBlockNumber;\n borrowIndex = accrual.borrowIndex;\n totalBorrows = accrual.totalBorrows;\n totalReserves = accrual.totalReserves;\n totalIonicFees = accrual.totalIonicFees;\n totalAdminFees = accrual.totalAdminFees;\n emit AccrueInterest(cashPrior, accrual.interestAccumulated, borrowIndex, totalBorrows);\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external view override returns (uint256) {\n if (accrualBlockNumber == block.number) {\n return totalBorrows;\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n return accrual.totalBorrows;\n }\n }\n\n /**\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view override returns (uint256, uint256, uint256, uint256) {\n uint256 cTokenBalance = accountTokens[account];\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n\n borrowBalance = borrowBalanceCurrent(account);\n\n exchangeRateMantissa = exchangeRateCurrent();\n\n return (uint256(Error.NO_ERROR), cTokenBalance, borrowBalance, exchangeRateMantissa);\n }\n\n /**\n * @notice calculate the borrowIndex and the account's borrow balance using the fresh borrowIndex\n * @param account The address whose balance should be calculated after recalculating the borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) public view override returns (uint256) {\n uint256 _borrowIndex;\n if (accrualBlockNumber == block.number) {\n _borrowIndex = borrowIndex;\n } else {\n uint256 cashPrior = asCToken().getCash();\n InterestAccrual memory accrual = _accrueInterestHypothetical(block.number, cashPrior);\n _borrowIndex = accrual.borrowIndex;\n }\n\n /* Note: we do not assert that the market is up to date */\n MathError mathErr;\n uint256 principalTimesIndex;\n uint256 result;\n\n /* Get borrowBalance and borrowIndex */\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\n\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\n */\n if (borrowSnapshot.principal == 0) {\n return 0;\n }\n\n /* Calculate new borrow balance using the interest index:\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\n */\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, _borrowIndex);\n require(mathErr == MathError.NO_ERROR, \"!mulUInt overflow check failed\");\n\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\n require(mathErr == MathError.NO_ERROR, \"!divUInt overflow check failed\");\n\n return result;\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external view override returns (uint256) {\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\n (MathError mErr, uint256 balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\n require(mErr == MathError.NO_ERROR, \"!balance\");\n return balance;\n }\n\n function flash(uint256 amount, bytes calldata data) public override isAuthorized onlyOracleApprovedAllowEOA {\n accrueInterest();\n\n totalBorrows += amount;\n asCToken().selfTransferOut(msg.sender, amount);\n\n IFlashLoanReceiver(msg.sender).receiveFlashLoan(underlying, amount, data);\n\n asCToken().selfTransferIn(msg.sender, amount);\n totalBorrows -= amount;\n\n emit Flash(msg.sender, amount);\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n function asCToken() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n function multicall(\n bytes[] calldata data\n ) public payable override(CTokenFirstExtensionInterface, Multicall) returns (bytes[] memory results) {\n return Multicall.multicall(data);\n }\n\n function registerInSFS() external returns (uint256) {\n require(hasAdminRights() || msg.sender == address(comptroller), \"!admin\");\n SFSRegister sfsContract = SFSRegister(0x8680CEaBcb9b56913c519c069Add6Bc3494B7020);\n return sfsContract.register(0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2);\n }\n}\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\n\nabstract contract CTokenAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n}\n\nabstract contract CErc20Storage is CTokenAdminStorage {\n /**\n * @dev Guard variable for re-entrancy checks\n */\n bool internal _notEntered;\n\n /**\n * @notice EIP-20 token name for this token\n */\n string public name;\n\n /**\n * @notice EIP-20 token symbol for this token\n */\n string public symbol;\n\n /**\n * @notice EIP-20 token decimals for this token\n */\n uint8 public decimals;\n\n /*\n * Maximum borrow rate that can ever be applied (.0005% / block)\n */\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\n\n /*\n * Maximum fraction of interest that can be set aside for reserves + fees\n */\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\n\n /**\n * @notice Contract which oversees inter-cToken operations\n */\n IonicComptroller public comptroller;\n\n /**\n * @notice Model which tells what the current interest rate should be\n */\n InterestRateModel public interestRateModel;\n\n /*\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\n */\n uint256 internal initialExchangeRateMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for admin fees\n */\n uint256 public adminFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for Ionic fees\n */\n uint256 public ionicFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for reserves\n */\n uint256 public reserveFactorMantissa;\n\n /**\n * @notice Block number that interest was last accrued at\n */\n uint256 public accrualBlockNumber;\n\n /**\n * @notice Accumulator of the total earned interest rate since the opening of the market\n */\n uint256 public borrowIndex;\n\n /**\n * @notice Total amount of outstanding borrows of the underlying in this market\n */\n uint256 public totalBorrows;\n\n /**\n * @notice Total amount of reserves of the underlying held in this market\n */\n uint256 public totalReserves;\n\n /**\n * @notice Total amount of admin fees of the underlying held in this market\n */\n uint256 public totalAdminFees;\n\n /**\n * @notice Total amount of Ionic fees of the underlying held in this market\n */\n uint256 public totalIonicFees;\n\n /**\n * @notice Total number of tokens in circulation\n */\n uint256 public totalSupply;\n\n /*\n * Official record of token balances for each account\n */\n mapping(address => uint256) internal accountTokens;\n\n /*\n * Approved token transfer amounts on behalf of others\n */\n mapping(address => mapping(address => uint256)) internal transferAllowances;\n\n /**\n * @notice Container for borrow balance information\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n */\n struct BorrowSnapshot {\n uint256 principal;\n uint256 interestIndex;\n }\n\n /*\n * Mapping of account addresses to outstanding borrow balances\n */\n mapping(address => BorrowSnapshot) internal accountBorrows;\n\n /*\n * Share of seized collateral that is added to reserves\n */\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\n\n /*\n * Share of seized collateral taken as fees\n */\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\n\n /**\n * @notice Underlying asset for this CToken\n */\n address public underlying;\n\n /**\n * @notice Addresses Provider\n */\n AddressesProvider public ap;\n}\n\nabstract contract CTokenBaseEvents {\n /* ERC20 */\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the admin fee is changed\n */\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\n\n /**\n * @notice Event emitted when the Ionic fee is changed\n */\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\n}\n\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\n event Flash(address receiver, uint256 amount);\n}\n\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral,\n uint256 seizeTokens\n );\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\n}\n\ninterface CTokenFirstExtensionInterface {\n /*** User Interface ***/\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n /*** Admin Functions ***/\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\n\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function exchangeRateCurrent() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function totalBorrowsCurrent() external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external view returns (uint256);\n\n function getTotalUnderlyingSupplied() external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external view returns (uint256);\n\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n\n function flash(uint256 amount, bytes calldata data) external;\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface CTokenSecondExtensionInterface {\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\n\n /*** Admin Functions ***/\n\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\n\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\n\n function selfTransferOut(address to, uint256 amount) external;\n\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\n}\n\ninterface CDelegatorInterface {\n function implementation() external view returns (address);\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external;\n}\n\ninterface CDelegateInterface {\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @dev Should revert if any issues arise which make it unfit for delegation\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes calldata data) external;\n\n function delegateType() external pure returns (uint8);\n\n function contractType() external pure returns (string memory);\n}\n\nabstract contract CErc20AdminBase is CErc20Storage {\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\n return\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\n }\n}\n\nabstract contract CErc20FirstExtensionBase is\n CErc20AdminBase,\n CTokenFirstExtensionEvents,\n CTokenFirstExtensionInterface\n{}\n\nabstract contract CTokenSecondExtensionBase is\n CErc20AdminBase,\n CTokenSecondExtensionEvents,\n CTokenSecondExtensionInterface,\n CDelegateInterface\n{}\n\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\n\ninterface CErc20StorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function comptroller() external view returns (IonicComptroller);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function accrualBlockNumber() external view returns (uint256);\n\n function underlying() external view returns (address);\n\n function borrowIndex() external view returns (uint256);\n\n function interestRateModel() external view returns (address);\n}\n\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\n function plugin() external view returns (address);\n}\n\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\n function approve(address, address) external;\n}\n\ninterface ICErc20 is\n CErc20StorageInterface,\n CTokenSecondExtensionInterface,\n CTokenFirstExtensionInterface,\n CDelegatorInterface,\n CDelegateInterface\n{}\n\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\n function _updatePlugin(address _plugin) external;\n}\n\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\n" + }, + "contracts/compound/CTokenMinter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\ncontract CTokenMinter is Initializable, OwnableUpgradeable {\n ICErc20 public collateralMarket;\n uint256 public startTime;\n uint256 public endTime;\n\n modifier onlyDuringMintWindow() {\n require(block.timestamp >= startTime && block.timestamp <= endTime, \"Minting not allowed at this time\");\n _;\n }\n\n function initialize(address _cTokenAddress, uint256 _startTime, uint256 _endTime) public initializer {\n require(_startTime < _endTime, \"Invalid time window\");\n __Ownable_init();\n collateralMarket = ICErc20(_cTokenAddress);\n startTime = _startTime;\n endTime = _endTime;\n }\n\n function mint(uint256 mintAmount) external onlyDuringMintWindow {\n // MINT LOGIC\n }\n\n function setMintWindow(uint256 _newStartTime, uint256 _newEndTime) external onlyOwner {\n require(_newStartTime < _newEndTime, \"Invalid time window\");\n startTime = _newStartTime;\n endTime = _newEndTime;\n }\n}\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenOracleProtected is CErc20Storage {\n error InteractionNotAllowed();\n error CallerIsNotEOA();\n\n modifier onlyOracleApproved() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyOracleApprovedAllowEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n if (tx.origin == msg.sender) {\n _;\n return;\n }\n\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyNotBlacklistedEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n if (msg.sender != tx.origin) {\n revert CallerIsNotEOA();\n }\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n _;\n }\n}\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title ERC 20 Token Standard Interface\n * https://eips.ethereum.org/EIPS/eip-20\n */\ninterface EIP20Interface {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n /**\n * @notice Get the total number of tokens in circulation\n * @return uint256 The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance uint256 The balance\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool success);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return success bool Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ncontract ComptrollerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n COMPTROLLER_MISMATCH,\n INSUFFICIENT_SHORTFALL,\n INSUFFICIENT_LIQUIDITY,\n INVALID_CLOSE_FACTOR,\n INVALID_COLLATERAL_FACTOR,\n INVALID_LIQUIDATION_INCENTIVE,\n MARKET_NOT_LISTED,\n MARKET_ALREADY_LISTED,\n MATH_ERROR,\n NONZERO_BORROW_BALANCE,\n PRICE_ERROR,\n REJECTION,\n SNAPSHOT_ERROR,\n TOO_MANY_ASSETS,\n TOO_MUCH_REPAY,\n SUPPLIER_NOT_WHITELISTED,\n BORROW_BELOW_MIN,\n SUPPLY_ABOVE_MAX,\n NONZERO_TOTAL_SUPPLY\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\n EXIT_MARKET_BALANCE_OWED,\n EXIT_MARKET_REJECTION,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\n SET_CLOSE_FACTOR_OWNER_CHECK,\n SET_CLOSE_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_NO_EXISTS,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_PRICE_ORACLE_OWNER_CHECK,\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\n SET_WHITELIST_STATUS_OWNER_CHECK,\n SUPPORT_MARKET_EXISTS,\n SUPPORT_MARKET_OWNER_CHECK,\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\n UNSUPPORT_MARKET_OWNER_CHECK,\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\n UNSUPPORT_MARKET_IN_USE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return uint256(err);\n }\n}\n\ncontract TokenErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n BAD_INPUT,\n COMPTROLLER_REJECTION,\n COMPTROLLER_CALCULATION_ERROR,\n INTEREST_RATE_MODEL_ERROR,\n INVALID_ACCOUNT_PAIR,\n INVALID_CLOSE_AMOUNT_REQUESTED,\n INVALID_COLLATERAL_FACTOR,\n MATH_ERROR,\n MARKET_NOT_FRESH,\n MARKET_NOT_LISTED,\n TOKEN_INSUFFICIENT_ALLOWANCE,\n TOKEN_INSUFFICIENT_BALANCE,\n TOKEN_INSUFFICIENT_CASH,\n TOKEN_TRANSFER_IN_FAILED,\n TOKEN_TRANSFER_OUT_FAILED,\n UTILIZATION_ABOVE_MAX\n }\n\n /*\n * Note: FailureInfo (but not Error) is kept in alphabetical order\n * This is because FailureInfo grows significantly faster, and\n * the order of Error has some meaning, while the order of FailureInfo\n * is entirely arbitrary.\n */\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n BORROW_ACCRUE_INTEREST_FAILED,\n BORROW_CASH_NOT_AVAILABLE,\n BORROW_FRESHNESS_CHECK,\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n BORROW_MARKET_NOT_LISTED,\n BORROW_COMPTROLLER_REJECTION,\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n LIQUIDATE_COMPTROLLER_REJECTION,\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n LIQUIDATE_FRESHNESS_CHECK,\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_ACCRUE_INTEREST_FAILED,\n MINT_COMPTROLLER_REJECTION,\n MINT_EXCHANGE_CALCULATION_FAILED,\n MINT_EXCHANGE_RATE_READ_FAILED,\n MINT_FRESHNESS_CHECK,\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n MINT_TRANSFER_IN_FAILED,\n MINT_TRANSFER_IN_NOT_POSSIBLE,\n NEW_UTILIZATION_RATE_ABOVE_MAX,\n REDEEM_ACCRUE_INTEREST_FAILED,\n REDEEM_COMPTROLLER_REJECTION,\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\n REDEEM_EXCHANGE_RATE_READ_FAILED,\n REDEEM_FRESHNESS_CHECK,\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\n WITHDRAW_IONIC_FEES_VALIDATION,\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\n WITHDRAW_ADMIN_FEES_VALIDATION,\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\n REDUCE_RESERVES_ADMIN_CHECK,\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\n REDUCE_RESERVES_FRESH_CHECK,\n REDUCE_RESERVES_VALIDATION,\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_COMPTROLLER_REJECTION,\n REPAY_BORROW_FRESHNESS_CHECK,\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COMPTROLLER_OWNER_CHECK,\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\n SET_ADMIN_FEE_ADMIN_CHECK,\n SET_ADMIN_FEE_FRESH_CHECK,\n SET_ADMIN_FEE_BOUNDS_CHECK,\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\n SET_IONIC_FEE_FRESH_CHECK,\n SET_IONIC_FEE_BOUNDS_CHECK,\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\n SET_RESERVE_FACTOR_ADMIN_CHECK,\n SET_RESERVE_FACTOR_FRESH_CHECK,\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\n TRANSFER_COMPTROLLER_REJECTION,\n TRANSFER_NOT_ALLOWED,\n TRANSFER_NOT_ENOUGH,\n TRANSFER_TOO_MUCH,\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\n ADD_RESERVES_FRESH_CHECK,\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\n }\n}\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CarefulMath.sol\";\nimport \"./ExponentialNoError.sol\";\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract Exponential is CarefulMath, ExponentialNoError {\n /**\n * @dev Creates an exponential from numerator and denominator values.\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\n * or if `denom` is zero.\n */\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\n }\n\n /**\n * @dev Adds two exponentials, returning a new exponential.\n */\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Subtracts two exponentials, returning a new exponential.\n */\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, returning a new Exp.\n */\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(product));\n }\n\n /**\n * @dev Divide an Exp by a scalar, returning a new Exp.\n */\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\n }\n\n /**\n * @dev Divide a scalar by an Exp, returning a new Exp.\n */\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\n /*\n We are doing this as:\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\n\n How it works:\n Exp = a / b;\n Scalar = s;\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\n */\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n return getExp(numerator, divisor.mantissa);\n }\n\n /**\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\n */\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(fraction));\n }\n\n /**\n * @dev Multiplies two exponentials, returning a new exponential.\n */\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n // We add half the scale before dividing so that we get rounding instead of truncation.\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\n assert(err2 == MathError.NO_ERROR);\n\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\n }\n\n /**\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\n */\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\n }\n\n /**\n * @dev Multiplies three exponentials, returning a new exponential.\n */\n function mulExp3(\n Exp memory a,\n Exp memory b,\n Exp memory c\n ) internal pure returns (MathError, Exp memory) {\n (MathError err, Exp memory ab) = mulExp(a, b);\n if (err != MathError.NO_ERROR) {\n return (err, ab);\n }\n return mulExp(ab, c);\n }\n\n /**\n * @dev Divides two exponentials, returning a new exponential.\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\n */\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n return getExp(a.mantissa, b.mantissa);\n }\n}\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract ExponentialNoError {\n uint256 constant expScale = 1e18;\n uint256 constant doubleScale = 1e36;\n uint256 constant halfExpScale = expScale / 2;\n uint256 constant mantissaOne = expScale;\n\n struct Exp {\n uint256 mantissa;\n }\n\n struct Double {\n uint256 mantissa;\n }\n\n /**\n * @dev Truncates the given exp to a whole number value.\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\n */\n function truncate(Exp memory exp) internal pure returns (uint256) {\n // Note: We are not using careful math here as we're performing a division that cannot fail\n return exp.mantissa / expScale;\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return truncate(product);\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mul_ScalarTruncateAddUInt(\n Exp memory a,\n uint256 scalar,\n uint256 addend\n ) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return add_(truncate(product), addend);\n }\n\n /**\n * @dev Checks if first Exp is less than second Exp.\n */\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa < right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp <= right Exp.\n */\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa <= right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp > right Exp.\n */\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa > right.mantissa;\n }\n\n /**\n * @dev returns true if Exp is exactly zero\n */\n function isZeroExp(Exp memory value) internal pure returns (bool) {\n return value.mantissa == 0;\n }\n\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\n require(n < 2**224, errorMessage);\n return uint224(n);\n }\n\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2**32, errorMessage);\n return uint32(n);\n }\n\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\n return add_(a, b, \"addition overflow\");\n }\n\n function add_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub_(a, b, \"subtraction underflow\");\n }\n\n function sub_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\n }\n\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / expScale;\n }\n\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\n }\n\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / doubleScale;\n }\n\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\n return mul_(a, b, \"multiplication overflow\");\n }\n\n function mul_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n if (a == 0 || b == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n return c;\n }\n\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\n }\n\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return div_(mul_(a, expScale), b.mantissa);\n }\n\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\n }\n\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\n return div_(mul_(a, doubleScale), b.mantissa);\n }\n\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\n return div_(a, b, \"divide by zero\");\n }\n\n function div_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\n }\n}\n" + }, + "contracts/compound/IERC4626.sol": { + "content": "pragma solidity >=0.8.0;\npragma experimental ABIEncoderV2;\n\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\n\ninterface IERC4626 is EIP20Interface {\n /*----------------------------------------------------------------\n Events\n ----------------------------------------------------------------*/\n\n event Deposit(address indexed from, address indexed to, uint256 value);\n\n event Withdraw(address indexed from, address indexed to, uint256 value);\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n /**\n @notice Deposit a specific amount of underlying tokens.\n @param underlyingAmount The amount of the underlying token to deposit.\n @param to The address to receive shares corresponding to the deposit\n @return shares The shares in the vault credited to `to`\n */\n function deposit(uint256 underlyingAmount, address to) external returns (uint256 shares);\n\n /**\n @notice Mint an exact amount of shares for a variable amount of underlying tokens.\n @param shareAmount The amount of vault shares to mint.\n @param to The address to receive shares corresponding to the mint.\n @return underlyingAmount The amount of the underlying tokens deposited from the mint call.\n */\n function mint(uint256 shareAmount, address to) external returns (uint256 underlyingAmount);\n\n /**\n @notice Withdraw a specific amount of underlying tokens.\n @param underlyingAmount The amount of the underlying token to withdraw.\n @param to The address to receive underlying corresponding to the withdrawal.\n @param from The address to burn shares from corresponding to the withdrawal.\n @return shares The shares in the vault burned from sender\n */\n function withdraw(\n uint256 underlyingAmount,\n address to,\n address from\n ) external returns (uint256 shares);\n\n /**\n @notice Redeem a specific amount of shares for underlying tokens.\n @param shareAmount The amount of shares to redeem.\n @param to The address to receive underlying corresponding to the redemption.\n @param from The address to burn shares from corresponding to the redemption.\n @return value The underlying amount transferred to `to`.\n */\n function redeem(\n uint256 shareAmount,\n address to,\n address from\n ) external returns (uint256 value);\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n /** \n @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n @return the address of the asset\n */\n function asset() external view returns (address);\n\n /** \n @notice Returns a user's Vault balance in underlying tokens.\n @param user The user to get the underlying balance of.\n @return balance The user's Vault balance in underlying tokens.\n */\n function balanceOfUnderlying(address user) external view returns (uint256 balance);\n\n /** \n @notice Calculates the total amount of underlying tokens the Vault manages.\n @return The total amount of underlying tokens the Vault manages.\n */\n function totalAssets() external view returns (uint256);\n\n /** \n @notice Returns the value in underlying terms of one vault token. \n */\n function exchangeRate() external view returns (uint256);\n\n /**\n @notice Returns the amount of vault tokens that would be obtained if depositing a given amount of underlying tokens in a `deposit` call.\n @param underlyingAmount the input amount of underlying tokens\n @return shareAmount the corresponding amount of shares out from a deposit call with `underlyingAmount` in\n */\n function previewDeposit(uint256 underlyingAmount) external view returns (uint256 shareAmount);\n\n /**\n @notice Returns the amount of underlying tokens that would be deposited if minting a given amount of shares in a `mint` call.\n @param shareAmount the amount of shares from a mint call.\n @return underlyingAmount the amount of underlying tokens corresponding to the mint call\n */\n function previewMint(uint256 shareAmount) external view returns (uint256 underlyingAmount);\n\n /**\n @notice Returns the amount of vault tokens that would be burned if withdrawing a given amount of underlying tokens in a `withdraw` call.\n @param underlyingAmount the input amount of underlying tokens\n @return shareAmount the corresponding amount of shares out from a withdraw call with `underlyingAmount` in\n */\n function previewWithdraw(uint256 underlyingAmount) external view returns (uint256 shareAmount);\n\n /**\n @notice Returns the amount of underlying tokens that would be obtained if redeeming a given amount of shares in a `redeem` call.\n @param shareAmount the amount of shares from a redeem call.\n @return underlyingAmount the amount of underlying tokens corresponding to the redeem call\n */\n function previewRedeem(uint256 shareAmount) external view returns (uint256 underlyingAmount);\n}\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../ionic/AuthoritiesRegistry.sol\";\n\ninterface IFeeDistributor {\n function minBorrowEth() external view returns (uint256);\n\n function maxUtilizationRate() external view returns (uint256);\n\n function interestFeeRate() external view returns (uint256);\n\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\n\n function latestCErc20Delegate(uint8 delegateType)\n external\n view\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\n\n function latestPluginImplementation(address oldImplementation) external view returns (address);\n\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\n\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address);\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\n\n fallback() external payable;\n\n receive() external payable;\n}\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's InterestRateModel Interface\n * @author Compound\n */\nabstract contract InterestRateModel {\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n bool public constant isInterestRateModel = true;\n\n /**\n * @notice Calculates the current borrow interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view virtual returns (uint256);\n\n /**\n * @notice Calculates the current supply interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @param reserveFactorMantissa The current reserve factor the market has\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual returns (uint256);\n}\n" + }, + "contracts/compound/JumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./InterestRateModel.sol\";\n\n/**\n * @title Compound's JumpRateModel Contract\n * @author Compound\n */\ncontract JumpRateModel is InterestRateModel {\n event NewInterestParams(\n uint256 baseRatePerBlock,\n uint256 multiplierPerBlock,\n uint256 jumpMultiplierPerBlock,\n uint256 kink\n );\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint256 public blocksPerYear;\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint256 public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint256 public baseRatePerBlock;\n\n /**\n * @notice The multiplierPerBlock after hitting a specified utilization point\n */\n uint256 public jumpMultiplierPerBlock;\n\n /**\n * @notice The utilization point at which the jump multiplier is applied\n */\n uint256 public kink;\n\n /**\n * @notice Construct an interest rate model\n * @param _blocksPerYear The approximate number of blocks per year\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\n * @param kink_ The utilization point at which the jump multiplier is applied\n */\n constructor(\n uint256 _blocksPerYear,\n uint256 baseRatePerYear,\n uint256 multiplierPerYear,\n uint256 jumpMultiplierPerYear,\n uint256 kink_\n ) {\n blocksPerYear = _blocksPerYear;\n baseRatePerBlock = baseRatePerYear / blocksPerYear;\n multiplierPerBlock = multiplierPerYear / blocksPerYear;\n jumpMultiplierPerBlock = jumpMultiplierPerYear / blocksPerYear;\n kink = kink_;\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return (borrows * 1e18) / (cash + borrows - reserves);\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n uint256 util = utilizationRate(cash, borrows, reserves);\n\n if (util <= kink) {\n return ((util * multiplierPerBlock) / 1e18) + baseRatePerBlock;\n } else {\n uint256 normalRate = ((kink * multiplierPerBlock) / 1e18) + baseRatePerBlock;\n uint256 excessUtil = util - kink;\n return ((excessUtil * jumpMultiplierPerBlock) / 1e18) + normalRate;\n }\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\n }\n}\n" + }, + "contracts/compound/PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\n\nabstract contract PriceOracle {\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\n bool public constant isPriceOracle = true;\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view virtual returns (uint256);\n}\n" + }, + "contracts/compound/SafeMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol\n// Subject to the MIT license.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot underflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction underflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot underflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers.\n * Reverts on division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers.\n * Reverts with custom message on division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ErrorReporter.sol\";\nimport \"./ComptrollerStorage.sol\";\nimport \"./Comptroller.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\n\n/**\n * @title Unitroller\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\n * CTokens should reference this contract as their comptroller.\n */\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\n /**\n * @notice Event emitted when the admin rights are changed\n */\n event AdminRightsToggled(bool hasRights);\n\n /**\n * @notice Emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n constructor(address payable _ionicAdmin) {\n admin = msg.sender;\n ionicAdmin = _ionicAdmin;\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Toggles admin rights.\n * @param hasRights Boolean indicating if the admin is to have rights.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\n }\n\n // Check that rights have not already been set to the desired value\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\n\n adminHasRights = hasRights;\n emit AdminRightsToggled(hasRights);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @param newPendingAdmin New pending admin.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\n }\n\n address oldPendingAdmin = pendingAdmin;\n pendingAdmin = newPendingAdmin;\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n * @dev Admin function for pending admin to accept role and update admin\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint256) {\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n admin = pendingAdmin;\n pendingAdmin = address(0);\n\n emit NewAdmin(oldAdmin, admin);\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n function comptrollerImplementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n\n address currentImplementation = comptrollerImplementation();\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\n currentImplementation\n );\n\n _updateExtensions(latestComptrollerImplementation);\n\n if (currentImplementation != latestComptrollerImplementation) {\n // reinitialize\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function _updateExtensions(address currentComptroller) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(hasAdminRights(), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/EmissionsManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IonicFlywheelCore } from \"./ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { IEmissionsManager } from \"./IEmissionsManager.sol\";\nimport { IveION } from \"./veION/interfaces/IveION.sol\";\n\ninterface Oracle {\n function getUnderlyingPrice(address) external returns (uint256);\n}\n\ncontract EmissionsManager is IEmissionsManager, Ownable2StepUpgradeable {\n using SafeTransferLib for ERC20;\n\n address public protocolAddress;\n uint256 public collateralBp;\n PoolDirectory public fpd;\n ERC20 public rewardToken;\n address public veION;\n\n bytes public nonBlacklistableTargetBytecode;\n mapping(address => bool) public isBlacklisted;\n mapping(address => bool) public nonBlacklistable;\n\n uint256 public constant MAXIMUM_BASIS_POINTS = 10_000;\n uint256 public constant BLACKLISTER_SHARE = 80;\n uint256 public constant PROTOCOL_SHARE = 20;\n\n modifier onlyBlacklistableBytecode(address _addr) {\n bytes memory code = _addr.code;\n require(keccak256(code) != keccak256(nonBlacklistableTargetBytecode), \"Non-blacklistable bytecode\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize(\n PoolDirectory _fpd,\n address _protocolAddress,\n ERC20 _rewardToken,\n uint256 _collateralBp,\n bytes memory _nonBlacklistableTargetBytecode\n ) public initializer {\n if (address(_fpd) == address(0)) revert InvalidPoolDirectoryAaddress();\n if (_protocolAddress == address(0)) revert InvalidProtocolAddress();\n if (address(_rewardToken) == address(0)) revert InvalidRewardTokenAddress();\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert CollateralBasisPointsExceedMaximum();\n\n __Ownable2Step_init();\n protocolAddress = _protocolAddress;\n fpd = _fpd;\n rewardToken = _rewardToken;\n collateralBp = _collateralBp;\n nonBlacklistableTargetBytecode = _nonBlacklistableTargetBytecode;\n\n emit Initialized(_protocolAddress, address(_rewardToken), _collateralBp, _nonBlacklistableTargetBytecode);\n }\n\n function setVeIon(IveION _veIon) external onlyOwner {\n if (address(_veIon) == address(0)) revert InvalidVeIONAddress();\n veION = address(_veIon);\n emit VeIonSet(address(_veIon));\n }\n\n function setCollateralBp(uint256 _collateralBp) external onlyOwner {\n if (_collateralBp >= MAXIMUM_BASIS_POINTS) revert MaximumLimitExceeded();\n collateralBp = _collateralBp;\n emit CollateralBpSet(_collateralBp);\n }\n\n function setNonBlacklistableAddress(address _user, bool _isNonBlacklistable) external onlyOwner {\n nonBlacklistable[_user] = _isNonBlacklistable;\n emit NonBlacklistableAddressSet(_user, _isNonBlacklistable);\n }\n\n function setNonBlacklistableTargetBytecode(bytes memory _newBytecode) external onlyOwner {\n nonBlacklistableTargetBytecode = _newBytecode;\n emit NonBlacklistableTargetBytecodeSet(_newBytecode);\n }\n\n function setProtocolAddress(address _newProtocolAddress) external onlyOwner {\n require(_newProtocolAddress != address(0), \"Invalid address\");\n protocolAddress = _newProtocolAddress;\n }\n\n function _getUserTotalCollateral(address _user) internal view returns (uint256) {\n uint256 totalColateralInETH = 0;\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n BasePriceOracle oracle = comptroller.oracle();\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n uint256 cTokensLength = cTokens.length;\n for (uint256 j = 0; j < cTokensLength; j++) {\n uint256 supplyBalance = cTokens[j].balanceOfUnderlying(_user);\n if (supplyBalance > 0) {\n uint256 collateralInETH = (supplyBalance * oracle.getUnderlyingPrice(cTokens[j])) / 1e18;\n totalColateralInETH += collateralInETH;\n }\n }\n }\n return totalColateralInETH;\n }\n\n function getUserTotalCollateral(address _user) external view returns (uint256) {\n return _getUserTotalCollateral(_user);\n }\n\n function _checkCollateralRatio(address _user) internal view returns (bool) {\n uint256 userCollateralValue = _getUserTotalCollateral(_user);\n if (userCollateralValue == 0) return true;\n uint256 userLPValue = IveION(veION).getTotalEthValueOfTokens(_user);\n if ((userLPValue * MAXIMUM_BASIS_POINTS) / userCollateralValue >= collateralBp) {\n return true;\n } else return false;\n }\n\n function reportUser(address _user) external onlyBlacklistableBytecode(_user) {\n require(!nonBlacklistable[_user], \"Non-blacklistable user\");\n require(!isBlacklisted[_user], \"Already blacklisted\");\n require(!_checkCollateralRatio(_user), \"LP balance above threshold\");\n isBlacklisted[_user] = true;\n _blacklistUserAndClaimEmissions(_user);\n }\n\n function whitelistUser(address _user) external {\n require(isBlacklisted[_user], \"Already whitelisted\");\n require(_checkCollateralRatio(_user), \"LP balance below threshold\");\n isBlacklisted[_user] = false;\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n uint256 cTokensLength = cTokens.length;\n for (uint256 j = 0; j < cTokensLength; j++) {\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n uint256 flywheelAddressesLength = flywheelAddresses.length;\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\n flywheel.whitelistUser(ERC20(address(cTokens[j])), _user);\n flywheel.accrue(ERC20(address(cTokens[j])), _user);\n }\n }\n }\n }\n }\n\n function isUserBlacklisted(address _user) external view returns (bool) {\n return isBlacklisted[_user];\n }\n\n function isUserBlacklistable(address _user) external view returns (bool) {\n if (nonBlacklistable[_user] || keccak256(_user.code) == keccak256(nonBlacklistableTargetBytecode)) {\n return false;\n }\n return !_checkCollateralRatio(_user) && !isBlacklisted[_user];\n }\n\n function _blacklistUserAndClaimEmissions(address user) internal {\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(address(this));\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n uint256 poolsLength = pools.length;\n for (uint256 i = 0; i < poolsLength; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ERC20[] memory markets;\n {\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\n uint256 cerc20sLength = cerc20s.length;\n markets = new ERC20[](cerc20sLength);\n for (uint256 j = 0; j < cerc20sLength; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n }\n\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n uint256 flywheelAddressesLength = flywheelAddresses.length;\n for (uint256 k = 0; k < flywheelAddressesLength; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == address(rewardToken)) {\n uint256 marketsLength = markets.length;\n for (uint256 m = 0; m < marketsLength; m++) {\n flywheel.accrue(markets[m], user);\n flywheel.updateBlacklistBalances(markets[m], user);\n }\n flywheel.takeRewardsFromUser(user, address(this));\n }\n }\n }\n\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(address(this));\n uint256 totalClaimed = balanceAfter - balanceBefore;\n if (totalClaimed > 0) {\n rewardToken.safeTransfer(msg.sender, (totalClaimed * BLACKLISTER_SHARE) / 100);\n rewardToken.safeTransfer(protocolAddress, (totalClaimed * PROTOCOL_SHARE) / 100);\n }\n }\n}\n" + }, + "contracts/external/aerodrome/IAerodromeRouter.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.10;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20_Router {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IWETH is IERC20_Router {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n\ninterface IRouter_Aerodrome {\n struct Route {\n address from;\n address to;\n bool stable;\n address factory;\n }\n\n error ETHTransferFailed();\n error Expired();\n error InsufficientAmount();\n error InsufficientAmountA();\n error InsufficientAmountB();\n error InsufficientAmountADesired();\n error InsufficientAmountBDesired();\n error InsufficientAmountAOptimal();\n error InsufficientLiquidity();\n error InsufficientOutputAmount();\n error InvalidAmountInForETHDeposit();\n error InvalidTokenInForETHDeposit();\n error InvalidPath();\n error InvalidRouteA();\n error InvalidRouteB();\n error OnlyWETH();\n error PoolDoesNotExist();\n error PoolFactoryDoesNotExist();\n error SameAddresses();\n error ZeroAddress();\n\n /// @notice Address of FactoryRegistry.sol\n function factoryRegistry() external view returns (address);\n\n /// @notice Address of Protocol PoolFactory.sol\n function defaultFactory() external view returns (address);\n\n /// @notice Address of Voter.sol\n function voter() external view returns (address);\n\n /// @notice Interface of WETH contract used for WETH => ETH wrapping/unwrapping\n function weth() external view returns (IWETH);\n\n /// @dev Represents Ether. Used by zapper to determine whether to return assets as ETH/WETH.\n function ETHER() external view returns (address);\n\n /// @dev Struct containing information necessary to zap in and out of pools\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable Stable or volatile pool\n /// @param factory factory of pool\n /// @param amountOutMinA Minimum amount expected from swap leg of zap via routesA\n /// @param amountOutMinB Minimum amount expected from swap leg of zap via routesB\n /// @param amountAMin Minimum amount of tokenA expected from liquidity leg of zap\n /// @param amountBMin Minimum amount of tokenB expected from liquidity leg of zap\n struct Zap {\n address tokenA;\n address tokenB;\n bool stable;\n address factory;\n uint256 amountOutMinA;\n uint256 amountOutMinB;\n uint256 amountAMin;\n uint256 amountBMin;\n }\n\n /// @notice Sort two tokens by which address value is less than the other\n /// @param tokenA Address of token to sort\n /// @param tokenB Address of token to sort\n /// @return token0 Lower address value between tokenA and tokenB\n /// @return token1 Higher address value between tokenA and tokenB\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\n\n /// @notice Calculate the address of a pool by its' factory.\n /// Used by all Router functions containing a `Route[]` or `_factory` argument.\n /// Reverts if _factory is not approved by the FactoryRegistry\n /// @dev Returns a randomly generated address for a nonexistent pool\n /// @param tokenA Address of token to query\n /// @param tokenB Address of token to query\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of factory which created the pool\n function poolFor(address tokenA, address tokenB, bool stable, address _factory) external view returns (address pool);\n\n /// @notice Fetch and sort the reserves for a pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @return reserveA Amount of reserves of the sorted token A\n /// @return reserveB Amount of reserves of the sorted token B\n function getReserves(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory\n ) external view returns (uint256 reserveA, uint256 reserveB);\n\n /// @notice Perform chained getAmountOut calculations on any number of pools\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\n\n // **** ADD LIQUIDITY ****\n\n /// @notice Quote the amount deposited into a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function quoteAddLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 amountADesired,\n uint256 amountBDesired\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Quote the amount of liquidity removed from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param _factory Address of PoolFactory for tokenA and tokenB\n /// @param liquidity Amount of liquidity to remove\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function quoteRemoveLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 liquidity\n ) external view returns (uint256 amountA, uint256 amountB);\n\n /// @notice Add liquidity of two tokens to a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @param amountAMin Minimum amount of tokenA to deposit\n /// @param amountBMin Minimum amount of tokenB to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountTokenDesired Amount of token desired to deposit\n /// @param amountTokenMin Minimum amount of token to deposit\n /// @param amountETHMin Minimum amount of ETH to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to add liquidity\n /// @return amountToken Amount of token to actually deposit\n /// @return amountETH Amount of tokenETH to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidityETH(\n address token,\n bool stable,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n // **** REMOVE LIQUIDITY ****\n\n /// @notice Remove liquidity of two tokens from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountAMin Minimum amount of tokenA to receive\n /// @param amountBMin Minimum amount of tokenB to receive\n /// @param to Recipient of tokens received\n /// @param deadline Deadline to remove liquidity\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function removeLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountToken Amount of token received\n /// @return amountETH Amount of ETH received\n function removeLiquidityETH(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountETH Amount of ETH received\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n // **** SWAP ****\n\n /// @notice Swap one token for another\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap ETH for a token\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactETHForTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n /// @notice Swap a token for WETH (returned as ETH)\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap one token for another without slippage protection\n /// @return amounts Array of amounts to swap per route\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function UNSAFE_swapExactTokensForTokens(\n uint256[] memory amounts,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory);\n\n // **** SWAP (supporting fee-on-transfer tokens) ****\n\n /// @notice Swap one token for another supporting fee-on-transfer tokens\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external;\n\n /// @notice Swap ETH for a token supporting fee-on-transfer tokens\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable;\n\n /// @notice Swap a token for WETH (returned as ETH) supporting fee-on-transfer tokens\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external;\n\n /// @notice Zap a token A into a pool (B, C). (A can be equal to B or C).\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\n /// Slippage is required for the initial swap.\n /// Additional slippage may be required when adding liquidity as the\n /// price of the token may have changed.\n /// @param tokenIn Token you are zapping in from (i.e. input token).\n /// @param amountInA Amount of input token you wish to send down routesA\n /// @param amountInB Amount of input token you wish to send down routesB\n /// @param zapInPool Contains zap struct information. See Zap struct.\n /// @param routesA Route used to convert input token to tokenA\n /// @param routesB Route used to convert input token to tokenB\n /// @param to Address you wish to mint liquidity to.\n /// @param stake Auto-stake liquidity in corresponding gauge.\n /// @return liquidity Amount of LP tokens created from zapping in.\n function zapIn(\n address tokenIn,\n uint256 amountInA,\n uint256 amountInB,\n Zap calldata zapInPool,\n Route[] calldata routesA,\n Route[] calldata routesB,\n address to,\n bool stake\n ) external payable returns (uint256 liquidity);\n\n /// @notice Zap out a pool (B, C) into A.\n /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc).\n /// Slippage is required for the removal of liquidity.\n /// Additional slippage may be required on the swap as the\n /// price of the token may have changed.\n /// @param tokenOut Token you are zapping out to (i.e. output token).\n /// @param liquidity Amount of liquidity you wish to remove.\n /// @param zapOutPool Contains zap struct information. See Zap struct.\n /// @param routesA Route used to convert tokenA into output token.\n /// @param routesB Route used to convert tokenB into output token.\n function zapOut(\n address tokenOut,\n uint256 liquidity,\n Zap calldata zapOutPool,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external;\n\n /// @notice Used to generate params required for zapping in.\n /// Zap in => remove liquidity then swap.\n /// Apply slippage to expected swap values to account for changes in reserves in between.\n /// @dev Output token refers to the token you want to zap in from.\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable .\n /// @param _factory .\n /// @param amountInA Amount of input token you wish to send down routesA\n /// @param amountInB Amount of input token you wish to send down routesB\n /// @param routesA Route used to convert input token to tokenA\n /// @param routesB Route used to convert input token to tokenB\n /// @return amountOutMinA Minimum output expected from swapping input token to tokenA.\n /// @return amountOutMinB Minimum output expected from swapping input token to tokenB.\n /// @return amountAMin Minimum amount of tokenA expected from depositing liquidity.\n /// @return amountBMin Minimum amount of tokenB expected from depositing liquidity.\n function generateZapInParams(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 amountInA,\n uint256 amountInB,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\n\n /// @notice Used to generate params required for zapping out.\n /// Zap out => swap then add liquidity.\n /// Apply slippage to expected liquidity values to account for changes in reserves in between.\n /// @dev Output token refers to the token you want to zap out of.\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable .\n /// @param _factory .\n /// @param liquidity Amount of liquidity being zapped out of into a given output token.\n /// @param routesA Route used to convert tokenA into output token.\n /// @param routesB Route used to convert tokenB into output token.\n /// @return amountOutMinA Minimum output expected from swapping tokenA into output token.\n /// @return amountOutMinB Minimum output expected from swapping tokenB into output token.\n /// @return amountAMin Minimum amount of tokenA expected from withdrawing liquidity.\n /// @return amountBMin Minimum amount of tokenB expected from withdrawing liquidity.\n function generateZapOutParams(\n address tokenA,\n address tokenB,\n bool stable,\n address _factory,\n uint256 liquidity,\n Route[] calldata routesA,\n Route[] calldata routesB\n ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin);\n\n /// @notice Used by zapper to determine appropriate ratio of A to B to deposit liquidity. Assumes stable pool.\n /// @dev Returns stable liquidity ratio of B to (A + B).\n /// E.g. if ratio is 0.4, it means there is more of A than there is of B.\n /// Therefore you should deposit more of token A than B.\n /// @param tokenA tokenA of stable pool you are zapping into.\n /// @param tokenB tokenB of stable pool you are zapping into.\n /// @param factory Factory that created stable pool.\n /// @return ratio Ratio of token0 to token1 required to deposit into zap.\n function quoteStableLiquidityRatio(\n address tokenA,\n address tokenB,\n address factory\n ) external view returns (uint256 ratio);\n}\n" + }, + "contracts/external/aerodrome/IAerodromeSwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.10;\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via CL\ninterface ISwapRouter_Aerodrome {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n int24 tickSpacing;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n int24 tickSpacing;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/external/algebra/IAlgebraSwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IAlgebraPoolActions#swap\n/// @notice Any contract that calls IAlgebraPoolActions#swap must implement this interface\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\n/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces\ninterface IAlgebraSwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a AlgebraPool deployed by the canonical AlgebraFactory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call\n function algebraSwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/algebra/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\nimport \"./IAlgebraSwapCallback.sol\";\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Algebra\n/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:\n/// https://github.com/Uniswap/v3-periphery\ninterface IAlgebraSwapRouter is IAlgebraSwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 limitSqrtPrice;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 limitSqrtPrice;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @dev Unlike standard swaps, handles transferring from user before the actual swap.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingleSupportingFeeOnTransferTokens(ExactInputSingleParams calldata params)\n external\n returns (uint256 amountOut);\n}\n" + }, + "contracts/external/api3/IProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IProxy {\n function read() external view returns (int224 value, uint32 timestamp);\n\n function api3ServerV1() external view returns (address);\n}\n" + }, + "contracts/external/chainlink/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n // getRoundData and latestRoundData should both raise \"No data present\"\n // if they do not have data to report, instead of returning unset values\n // which could be misinterpreted as actual reported values.\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n" + }, + "contracts/external/compound/IComptroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./IPriceOracle.sol\";\nimport \"./ICToken.sol\";\nimport \"./IUnitroller.sol\";\nimport \"./IRewardsDistributor.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n */\ninterface IComptroller {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function oracle() external view returns (IPriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function getAssetsIn(address account) external view returns (ICToken[] memory);\n\n function checkMembership(address account, ICToken cToken) external view returns (bool);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n )\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n function getAccountLiquidity(address account)\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n function _setPriceOracle(IPriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICToken market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _become(IUnitroller unitroller) external;\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAllMarkets() external view returns (ICToken[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function suppliers(address account) external view returns (bool);\n\n function supplyCaps(address cToken) external view returns (uint256);\n\n function borrowCaps(address cToken) external view returns (uint256);\n\n function enforceWhitelist() external view returns (bool);\n\n function enterMarkets(address[] memory cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cTokenAddress) external returns (uint256);\n\n function autoImplementation() external view returns (bool);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _toggleAutoImplementations(bool enabled) external returns (uint256);\n\n function _deployMarket(\n bool isCEther,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getMaxRedeemOrBorrow(\n address account,\n ICToken cTokenModify,\n bool isBorrow\n ) external view returns (uint256);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function isDeprecated(ICToken cToken) external view returns (bool);\n\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n}\n" + }, + "contracts/external/compound/ICToken.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's CToken Contract\n * @notice Abstract base for CTokens\n * @author Compound\n */\ninterface ICToken {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function symbol() external view returns (string memory);\n\n function comptroller() external view returns (address);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function isCToken() external view returns (bool);\n\n function isCEther() external view returns (bool);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external returns (uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function totalBorrowsCurrent() external returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function borrowBalanceStored(address account) external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external returns (uint256);\n\n function exchangeRateCurrent() external returns (uint256);\n\n function exchangeRateStored() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n}\n" + }, + "contracts/external/compound/IPriceOracle.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./ICToken.sol\";\n\ninterface IPriceOracle {\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICToken cToken) external view returns (uint256);\n}\n" + }, + "contracts/external/compound/IRewardsDistributor.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\nimport \"./ICToken.sol\";\n\n/**\n * @title RewardsDistributor\n * @author Compound\n */\ninterface IRewardsDistributor {\n /// @dev The token to reward (i.e., COMP)\n function rewardToken() external view returns (address);\n\n /// @notice The portion of compRate that each market currently receives\n function compSupplySpeeds(address) external view returns (uint256);\n\n /// @notice The portion of compRate that each market currently receives\n function compBorrowSpeeds(address) external view returns (uint256);\n\n /// @notice The COMP accrued but not yet transferred to each user\n function compAccrued(address) external view returns (uint256);\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @dev Called by the Comptroller\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) external;\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @dev Called by the Comptroller\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\n\n /**\n * @notice Returns an array of all markets.\n */\n function getAllMarkets() external view returns (ICToken[] memory);\n}\n" + }, + "contracts/external/compound/IUnitroller.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity >=0.8.0;\n\n/**\n * @title ComptrollerCore\n * @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.\n * CTokens should reference this contract as their comptroller.\n */\ninterface IUnitroller {\n function _setPendingImplementation(address newPendingImplementation) external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n}\n" + }, + "contracts/external/curve/ICurvePool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ICurvePool is IERC20Upgradeable {\n function get_virtual_price() external view returns (uint256);\n\n function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 min_amount) external;\n\n function calc_withdraw_one_coin(uint256 _burn_amount, int128 i) external view returns (uint256);\n\n function add_liquidity(uint256[2] calldata _amounts, uint256 _min_mint_amount) external returns (uint256);\n\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);\n\n function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256);\n\n function coins(uint256 index) external view returns (address);\n\n function lp_token() external view returns (address);\n}\n" + }, + "contracts/external/curve/ICurveV2Pool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICurvePool } from \"./ICurvePool.sol\";\n\ninterface ICurveV2Pool is ICurvePool {\n function price_oracle() external view returns (uint256);\n\n function lp_price() external view returns (uint256);\n\n function coins(uint256 arg0) external view returns (address);\n}\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\ninterface IHypernativeOracle {\n function register(address account, bool isStrictMode) external;\n function validateForbiddenAccountInteraction(address sender) external view;\n function validateForbiddenContextInteraction(address origin, address sender) external view;\n function validateBlacklistedAccountInteraction(address sender) external;\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelay {\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\n // This will return true if and only if it's being called while executing the auction winner(s) call.\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\n // @param permissionId The id that represents the action being gated\n // @return permissioned True if the permission is allowed, false otherwise\n function isPermissioned(\n address protocolFeeReceiver,\n bytes calldata permissionId\n ) external view returns (bool permissioned);\n}\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelayFeeReceiver {\n // Receive the proceeds of an auction.\n // @param permissionKey The permission key where the auction was conducted on.\n function receiveAuctionProceedings(\n bytes calldata permissionKey\n ) external payable;\n}\n" + }, + "contracts/external/redstone/IRedstoneOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IRedstoneOracle {\n function priceOf(address asset) external view returns (uint256);\n\n function priceOfETH() external view returns (uint256);\n\n function getDataFeedIdForAsset(address asset) external view returns (bytes32);\n\n function getDataFeedIds() external view returns (bytes32[] memory dataFeedIds);\n}\n" + }, + "contracts/external/uniswap/FullMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// From Uniswap3 Core\n\n// Updated to Solidity 0.8 by Midas Capital:\n// * Rewrite unary negation of denominator, which is a uint\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\n\npragma solidity ^0.8.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = denominator & (~denominator + 1);\n\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" + }, + "contracts/external/uniswap/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface ISwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n function exactInput(ExactInputParams calldata params) external returns (uint256 amountOut);\n\n function exactOutputSingle(ExactOutputSingleParams calldata params) external returns (uint256 amountIn);\n\n function exactOutput(ExactOutputParams calldata params) external returns (uint256 amountIn);\n\n function factory() external returns (address);\n\n function multicall(uint256 deadline, bytes[] calldata data) external payable returns (bytes[] memory);\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Callee.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Callee {\n function uniswapV2Call(\n address sender,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Pair.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (\n uint112 reserve0,\n uint112 reserve1,\n uint32 blockTimestampLast\n );\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Router01.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n )\n external\n returns (\n uint256 amountA,\n uint256 amountB,\n uint256 liquidity\n );\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function swapTokensForExactETH(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapETHForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) external pure returns (uint256 amountB);\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountIn);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\n}\n" + }, + "contracts/external/uniswap/IUniswapV2Router02.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV2Router01.sol\";\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV3PoolActions.sol\";\n\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function fee() external view returns (uint24);\n\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n function liquidity() external view returns (uint128);\n\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\n\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 liquidityCumulative,\n bool initialized\n );\n\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolImmutables.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" + }, + "contracts/external/uniswap/IUniswapV3SwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IV3SwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport './IUniswapV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IV3SwapRouter is IUniswapV3SwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,\n /// and swap the entire amount, enabling contracts to send tokens before calling this function.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// that may remain in the router after the swap.\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// that may remain in the router after the swap.\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IQuoter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.8.0 <0.9.0;\n\ninterface IQuoter {\n function estimateMaxSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) external view returns (uint256);\n\n function estimateMinSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) external view returns (uint256);\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\n/// @title Quoter Interface\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\ninterface IUniswapV3Quoter {\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee\n /// @param amountIn The amount of the first token to swap\n /// @return amountOut The amount of the last token that would be received\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\n\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountIn The desired input amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountOut The amount of `tokenOut` that would be received\n function quoteExactInputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountIn,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountOut);\n\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\n /// @param amountOut The amount of the last token to receive\n /// @return amountIn The amount of first token required to be paid\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\n\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountOut The desired output amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\n function quoteExactOutputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountOut,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountIn);\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/BitMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title BitMath\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\nlibrary BitMath {\n /// @notice Returns the index of the most significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\n /// @param x the value for which to compute the most significant bit, must be greater than 0\n /// @return r the index of the most significant bit\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n if (x >= 0x100000000000000000000000000000000) {\n x >>= 128;\n r += 128;\n }\n if (x >= 0x10000000000000000) {\n x >>= 64;\n r += 64;\n }\n if (x >= 0x100000000) {\n x >>= 32;\n r += 32;\n }\n if (x >= 0x10000) {\n x >>= 16;\n r += 16;\n }\n if (x >= 0x100) {\n x >>= 8;\n r += 8;\n }\n if (x >= 0x10) {\n x >>= 4;\n r += 4;\n }\n if (x >= 0x4) {\n x >>= 2;\n r += 2;\n }\n if (x >= 0x2) r += 1;\n }\n\n /// @notice Returns the index of the least significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\n /// @param x the value for which to compute the least significant bit, must be greater than 0\n /// @return r the index of the least significant bit\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n r = 255;\n if (x & type(uint128).max > 0) {\n r -= 128;\n } else {\n x >>= 128;\n }\n if (x & type(uint64).max > 0) {\n r -= 64;\n } else {\n x >>= 64;\n }\n if (x & type(uint32).max > 0) {\n r -= 32;\n } else {\n x >>= 32;\n }\n if (x & type(uint16).max > 0) {\n r -= 16;\n } else {\n x >>= 16;\n }\n if (x & type(uint8).max > 0) {\n r -= 8;\n } else {\n x >>= 8;\n }\n if (x & 0xf > 0) {\n r -= 4;\n } else {\n x >>= 4;\n }\n if (x & 0x3 > 0) {\n r -= 2;\n } else {\n x >>= 2;\n }\n if (x & 0x1 > 0) r -= 1;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/FixedPoint96.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000; // 2^96\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/LiquidityMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Math library for liquidity\nlibrary LiquidityMath {\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\n /// @param x The liquidity before change\n /// @param y The delta by which liquidity should be changed\n /// @return z The liquidity delta\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\n if (y < 0) {\n require((z = x - uint128(-y)) < x, \"LS\");\n } else {\n require((z = x + uint128(y)) >= x, \"LA\");\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/LowGasSafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.0;\n\n/// @title Optimized overflow and underflow safe math operations\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\nlibrary LowGasSafeMath {\n /// @notice Returns x + y, reverts if sum overflows uint256\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x);\n }\n\n /// @notice Returns x - y, reverts if underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x);\n }\n\n /// @notice Returns x * y, reverts if overflows\n /// @param x The multiplicand\n /// @param y The multiplier\n /// @return z The product of x and y\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(x == 0 || (z = x * y) / x == y);\n }\n\n /// @notice Returns x + y, reverts if overflows or underflows\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x + y) >= x == (y >= 0));\n }\n\n /// @notice Returns x - y, reverts if overflows or underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x - y) <= x == (y >= 0));\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SqrtPriceMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./LowGasSafeMath.sol\";\nimport \"./SafeCast.sol\";\n\nimport \"../../FullMath.sol\";\nimport \"./UnsafeMath.sol\";\nimport \"./FixedPoint96.sol\";\nimport \"./BitMath.sol\";\n\n/// @title Functions based on Q64.96 sqrt price and liquidity\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\nlibrary SqrtPriceMath {\n using LowGasSafeMath for uint256;\n using SafeCast for uint256;\n\n /// @notice Gets the next sqrt price given a delta of token0\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\n /// price less in order to not send too much output.\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token0 to add or remove from virtual reserves\n /// @param add Whether to add or remove the amount of token0\n /// @return The price after adding or removing amount, depending on add\n function getNextSqrtPriceFromAmount0RoundingUp(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\n if (amount == 0) return sqrtPX96;\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n\n bool overflow = false;\n if (numerator1 != 0 && sqrtPX96 != 0)\n overflow = uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(sqrtPX96)) >= 254;\n\n if (add) {\n uint256 product;\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\n uint256 denominator = numerator1 + product;\n if (denominator >= numerator1) {\n // always fits in 160 bits\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\n }\n }\n\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\n } else {\n uint256 product;\n // if the product overflows, we know the denominator underflows\n // in addition, we must check that the denominator does not underflow\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\n product = overflow ? FullMath.mulDivRoundingUp(amount, sqrtPX96, uint256(liquidity)) : product;\n numerator1 = overflow ? FixedPoint96.Q96 : numerator1;\n uint256 denominator = numerator1 - product;\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\n }\n }\n\n /// @notice Gets the next sqrt price given a delta of token1\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\n /// price less in order to not send too much output.\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token1 to add, or remove, from virtual reserves\n /// @param add Whether to add, or remove, the amount of token1\n /// @return The price after adding or removing `amount`\n function getNextSqrtPriceFromAmount1RoundingDown(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\n // in both cases, avoid a mulDiv for most inputs\n if (add) {\n uint256 quotient = (\n amount <= type(uint160).max\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\n );\n\n return uint256(sqrtPX96).add(quotient).toUint160();\n } else {\n uint256 quotient = (\n amount <= type(uint160).max\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\n );\n\n require(sqrtPX96 > quotient);\n // always fits 160 bits\n return uint160(sqrtPX96 - quotient);\n }\n }\n\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountIn How much of token0, or token1, is being swapped in\n /// @param zeroForOne Whether the amount in is token0 or token1\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\n function getNextSqrtPriceFromInput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountIn,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we don't pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\n }\n\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\n /// @param sqrtPX96 The starting price before accounting for the output amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountOut How much of token0, or token1, is being swapped out\n /// @param zeroForOne Whether the amount out is token0 or token1\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\n function getNextSqrtPriceFromOutput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountOut,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\n }\n\n /// @notice Gets the amount0 delta between two prices\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up or down\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\n require(sqrtRatioAX96 > 0);\n\n bool overflow = false;\n if (numerator1 != 0 && numerator2 != 0)\n overflow =\n uint256(BitMath.mostSignificantBit(numerator1)) + uint256(BitMath.mostSignificantBit(numerator2)) >= 254;\n\n if (overflow) {\n return\n roundUp\n ? FullMath.mulDivRoundingUp(\n FullMath.mulDivRoundingUp(uint256(liquidity), numerator2, sqrtRatioBX96),\n FixedPoint96.Q96,\n sqrtRatioAX96\n )\n : FullMath.mulDiv(\n FullMath.mulDiv(uint256(liquidity), numerator2, sqrtRatioBX96),\n FixedPoint96.Q96,\n sqrtRatioAX96\n );\n } else {\n return\n roundUp\n ? UnsafeMath.divRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), sqrtRatioAX96)\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\n }\n }\n\n /// @notice Gets the amount1 delta between two prices\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up, or down\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n roundUp\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n /// @notice Helper that gets signed token0 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount0) {\n return\n liquidity < 0\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n\n /// @notice Helper that gets signed token1 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount1) {\n return\n liquidity < 0\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/SwapMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"../../FullMath.sol\";\nimport \"./SqrtPriceMath.sol\";\n\n/// @title Computes the result of a swap within ticks\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\nlibrary SwapMath {\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\n /// @param liquidity The usable liquidity\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\n /// @return feeAmount The amount of input that will be taken as a fee\n function computeSwapStep(\n uint160 sqrtRatioCurrentX96,\n uint160 sqrtRatioTargetX96,\n uint128 liquidity,\n int256 amountRemaining,\n uint24 feePips,\n bool zeroForOne\n )\n internal\n pure\n returns (\n uint160 sqrtRatioNextX96,\n uint256 amountIn,\n uint256 amountOut,\n uint256 feeAmount\n )\n {\n require(zeroForOne == sqrtRatioCurrentX96 >= sqrtRatioTargetX96, \"SPD\");\n bool exactIn = amountRemaining >= 0;\n\n if (exactIn) {\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\n amountIn = zeroForOne\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\n sqrtRatioCurrentX96,\n liquidity,\n amountRemainingLessFee,\n zeroForOne\n );\n } else {\n amountOut = zeroForOne\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\n\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\n sqrtRatioCurrentX96,\n liquidity,\n uint256(-amountRemaining),\n zeroForOne\n );\n }\n\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\n\n // get the input/output amounts\n if (zeroForOne) {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\n } else {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\n }\n\n // cap the output amount to not exceed the remaining output amount\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\n amountOut = uint256(-amountRemaining);\n }\n\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\n // we didn't reach the target, so take the remainder of the maximum input as fee\n feeAmount = uint256(amountRemaining) - amountIn;\n } else {\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/Tick.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./LowGasSafeMath.sol\";\nimport \"./SafeCast.sol\";\n\nimport \"../../TickMath.sol\";\nimport \"./LiquidityMath.sol\";\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\n\n/// Ithil to modify it, since it does not have access to storage arrays\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// Ithil: only use it with lower = self[tickLower] and upper = self[tickUpper]\n /// @param lower The info of the lower tick boundary of the position\n /// @param upper The info of the upper tick boundary of the position\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n Tick.Info memory lower,\n Tick.Info memory upper,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal pure returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// Ithil: always use with info = self[tick]\n /// @param info The info tick that will be updated\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n Tick.Info memory info,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal pure returns (bool flipped) {\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, \"LO\");\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param info The result of the mapping containing all tick information for initialized ticks\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n Tick.Info memory info,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal pure returns (int128 liquidityNet) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/TickBitmap.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\nimport \"./BitMath.sol\";\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n /// @dev simply divides @param tick by 256 with remainder: tick = wordPos * 256 + bitPos\n function position(int24 tick) internal pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(int8(tick % 256));\n }\n\n /// Written by Ithil\n function computeWordPos(\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal pure returns (int16 wordPos) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n (wordPos, ) = lte ? position(compressed) : position(compressed + 1);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param selfResult The result of the mapping in which to flip the tick (Ithil modified)\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n uint256 selfResult,\n int24 tick,\n int24 tickSpacing\n ) internal pure {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n selfResult ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param selfResult The result of the mapping in which to compute the next initialized tick (Ithil modified)\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n uint256 selfResult,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal pure returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = selfResult & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(uint24(bitPos) - uint24(BitMath.mostSignificantBit(masked)))) * tickSpacing\n : (compressed - int24(uint24(bitPos))) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = selfResult & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(uint24(BitMath.leastSignificantBit(masked) - bitPos))) * tickSpacing\n : (compressed + 1 + int24(uint24(type(uint8).max - bitPos))) * tickSpacing;\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/libraries/UnsafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Math functions that do not check inputs or outputs\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\nlibrary UnsafeMath {\n /// @notice Returns ceil(x / y)\n /// @dev division by 0 has unspecified behavior, and must be checked externally\n /// @param x The dividend\n /// @param y The divisor\n /// @return z The quotient, ceil(x / y)\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n z := add(div(x, y), gt(mod(x, y), 0))\n }\n }\n}\n" + }, + "contracts/external/uniswap/quoter/Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\npragma experimental ABIEncoderV2;\n\nimport \"../IUniswapV3Factory.sol\";\nimport \"./interfaces/IQuoter.sol\";\nimport \"./UniswapV3Quoter.sol\";\n\ncontract Quoter is IQuoter, UniswapV3Quoter {\n IUniswapV3Factory internal uniV3Factory; // TODO should it be immutable?\n\n constructor(address _uniV3Factory) {\n uniV3Factory = IUniswapV3Factory(_uniV3Factory);\n }\n\n // This should be equal to quoteExactInputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\n // todo: add price limit\n function estimateMaxSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) public view override returns (uint256) {\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\n\n return _estimateOutputSingle(_toToken, _fromToken, _amount, pool);\n }\n\n // This should be equal to quoteExactOutputSingle(_fromToken, _toToken, _poolFee, _amount, 0)\n // todo: add price limit\n function estimateMinSwapUniswapV3(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n uint24 _poolFee\n ) public view override returns (uint256) {\n address pool = uniV3Factory.getPool(_fromToken, _toToken, _poolFee);\n\n return _estimateInputSingle(_fromToken, _toToken, _amount, pool);\n }\n\n // todo: add price limit\n function _estimateOutputSingle(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n address _pool\n ) internal view returns (uint256 amountOut) {\n bool zeroForOne = _fromToken > _toToken;\n // todo: price limit?\n (int256 amount0, int256 amount1) = quoteSwap(\n _pool,\n int256(_amount),\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\n zeroForOne\n );\n if (zeroForOne) amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\n else amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\n }\n\n // todo: add price limit\n function _estimateInputSingle(\n address _fromToken,\n address _toToken,\n uint256 _amount,\n address _pool\n ) internal view returns (uint256 amountOut) {\n bool zeroForOne = _fromToken < _toToken;\n // todo: price limit?\n (int256 amount0, int256 amount1) = quoteSwap(\n _pool,\n -int256(_amount),\n zeroForOne ? (TickMath.MIN_SQRT_RATIO + 1) : (TickMath.MAX_SQRT_RATIO - 1),\n zeroForOne\n );\n if (zeroForOne) amountOut = amount0 > 0 ? uint256(amount0) : uint256(-amount0);\n else amountOut = amount1 > 0 ? uint256(amount1) : uint256(-amount1);\n }\n\n function doesPoolExist(address _token0, address _token1) external view returns (bool) {\n // try 0.05%\n address pool = uniV3Factory.getPool(_token0, _token1, 500);\n if (pool != address(0)) return true;\n\n // try 0.3%\n pool = uniV3Factory.getPool(_token0, _token1, 3000);\n if (pool != address(0)) return true;\n\n // try 1%\n pool = uniV3Factory.getPool(_token0, _token1, 10000);\n if (pool != address(0)) return true;\n else return false;\n }\n}\n" + }, + "contracts/external/uniswap/quoter/UniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.6;\n\nimport \"./libraries/LowGasSafeMath.sol\";\nimport \"./libraries/SafeCast.sol\";\nimport \"./libraries/Tick.sol\";\nimport \"./libraries/TickBitmap.sol\";\n\nimport \"../FullMath.sol\";\nimport \"../TickMath.sol\";\nimport \"./libraries/LiquidityMath.sol\";\nimport \"./libraries/SqrtPriceMath.sol\";\nimport \"./libraries/SwapMath.sol\";\n\nimport \"./interfaces/IUniswapV3Quoter.sol\";\nimport \"../IUniswapV3Pool.sol\";\nimport \"../IUniswapV3PoolImmutables.sol\";\n\ncontract UniswapV3Quoter {\n using LowGasSafeMath for int256;\n using SafeCast for uint256;\n using Tick for mapping(int24 => Tick.Info);\n\n struct PoolState {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the tick spacing\n int24 tickSpacing;\n // the pool's fee\n uint24 fee;\n // the pool's liquidity\n uint128 liquidity;\n // whether the pool is locked\n bool unlocked;\n }\n\n // accumulated protocol fees in token0/token1 units\n struct ProtocolFees {\n uint128 token0;\n uint128 token1;\n }\n\n // the top level state of the swap, the results of which are recorded in storage at the end\n struct SwapState {\n // the amount remaining to be swapped in/out of the input/output asset\n int256 amountSpecifiedRemaining;\n // the amount already swapped out/in of the output/input asset\n int256 amountCalculated;\n // current sqrt(price)\n uint160 sqrtPriceX96;\n // the tick associated with the current price\n int24 tick;\n // the current liquidity in range\n uint128 liquidity;\n }\n\n struct StepComputations {\n // the price at the beginning of the step\n uint160 sqrtPriceStartX96;\n // the next tick to swap to from the current tick in the swap direction\n int24 tickNext;\n // whether tickNext is initialized or not\n bool initialized;\n // sqrt(price) for the next tick (1/0)\n uint160 sqrtPriceNextX96;\n // how much is being swapped in in this step\n uint256 amountIn;\n // how much is being swapped out\n uint256 amountOut;\n // how much fee is being paid in\n uint256 feeAmount;\n }\n\n struct InitialState {\n address poolAddress;\n PoolState poolState;\n uint256 feeGrowthGlobal0X128;\n uint256 feeGrowthGlobal1X128;\n }\n\n struct NextTickPassage {\n int24 tick;\n int24 tickSpacing;\n }\n\n function fetchState(address _pool) internal view returns (PoolState memory poolState) {\n IUniswapV3Pool pool = IUniswapV3Pool(_pool);\n (uint160 sqrtPriceX96, int24 tick, , , , , bool unlocked) = pool.slot0(); // external call\n uint128 liquidity = pool.liquidity(); // external call\n int24 tickSpacing = IUniswapV3PoolImmutables(_pool).tickSpacing(); // external call\n uint24 fee = IUniswapV3PoolImmutables(_pool).fee(); // external call\n poolState = PoolState(sqrtPriceX96, tick, tickSpacing, fee, liquidity, unlocked);\n }\n\n function setInitialState(\n PoolState memory initialPoolState,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne\n )\n internal\n pure\n returns (\n SwapState memory state,\n uint128 liquidity,\n uint160 sqrtPriceX96\n )\n {\n liquidity = initialPoolState.liquidity;\n\n sqrtPriceX96 = initialPoolState.sqrtPriceX96;\n\n require(\n zeroForOne\n ? sqrtPriceLimitX96 < initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\n : sqrtPriceLimitX96 > initialPoolState.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\n \"SPL\"\n );\n\n state = SwapState({\n amountSpecifiedRemaining: amountSpecified,\n amountCalculated: 0,\n sqrtPriceX96: initialPoolState.sqrtPriceX96,\n tick: initialPoolState.tick,\n liquidity: 0 // to be modified after initialization\n });\n }\n\n function getNextTickAndPrice(\n int24 tickSpacing,\n int24 currentTick,\n IUniswapV3Pool pool,\n bool zeroForOne\n )\n internal\n view\n returns (\n int24 tickNext,\n bool initialized,\n uint160 sqrtPriceNextX96\n )\n {\n int24 compressed = currentTick / tickSpacing;\n if (!zeroForOne) compressed++;\n if (currentTick < 0 && currentTick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n uint256 selfResult = pool.tickBitmap(int16(compressed >> 8)); // external call\n\n (tickNext, initialized) = TickBitmap.nextInitializedTickWithinOneWord(\n selfResult,\n currentTick,\n tickSpacing,\n zeroForOne\n );\n\n if (tickNext < TickMath.MIN_TICK) {\n tickNext = TickMath.MIN_TICK;\n } else if (tickNext > TickMath.MAX_TICK) {\n tickNext = TickMath.MAX_TICK;\n }\n sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(tickNext);\n }\n\n function processSwapWithinTick(\n IUniswapV3Pool pool,\n PoolState memory initialPoolState,\n SwapState memory state,\n uint160 firstSqrtPriceX96,\n uint128 firstLiquidity,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne,\n bool exactAmount\n )\n internal\n view\n returns (\n uint160 sqrtPriceNextX96,\n uint160 finalSqrtPriceX96,\n uint128 finalLiquidity\n )\n {\n StepComputations memory step;\n\n step.sqrtPriceStartX96 = firstSqrtPriceX96;\n\n (step.tickNext, step.initialized, sqrtPriceNextX96) = getNextTickAndPrice(\n initialPoolState.tickSpacing,\n state.tick,\n pool,\n zeroForOne\n );\n\n (finalSqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\n firstSqrtPriceX96,\n (zeroForOne ? sqrtPriceNextX96 < sqrtPriceLimitX96 : sqrtPriceNextX96 > sqrtPriceLimitX96)\n ? sqrtPriceLimitX96\n : sqrtPriceNextX96,\n firstLiquidity,\n state.amountSpecifiedRemaining,\n initialPoolState.fee,\n zeroForOne\n );\n\n if (exactAmount) {\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\n } else {\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\n }\n\n if (finalSqrtPriceX96 == sqrtPriceNextX96) {\n if (step.initialized) {\n (, int128 liquidityNet, , , , , , ) = pool.ticks(step.tickNext);\n if (zeroForOne) liquidityNet = -liquidityNet;\n finalLiquidity = LiquidityMath.addDelta(firstLiquidity, liquidityNet);\n }\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\n } else if (finalSqrtPriceX96 != step.sqrtPriceStartX96) {\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\n state.tick = TickMath.getTickAtSqrtRatio(finalSqrtPriceX96);\n }\n }\n\n function returnedAmount(\n SwapState memory state,\n int256 amountSpecified,\n bool zeroForOne\n ) internal pure returns (int256 amount0, int256 amount1) {\n if (amountSpecified > 0) {\n (amount0, amount1) = zeroForOne\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\n } else {\n (amount0, amount1) = zeroForOne\n ? (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining)\n : (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated);\n }\n }\n\n function quoteSwap(\n address poolAddress,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bool zeroForOne\n ) internal view returns (int256 amount0, int256 amount1) {\n bool exactAmount = amountSpecified > 0;\n\n PoolState memory initialPoolState = fetchState(poolAddress);\n uint160 sqrtPriceNextX96;\n\n (SwapState memory state, uint128 liquidity, uint160 sqrtPriceX96) = setInitialState(\n initialPoolState,\n amountSpecified,\n sqrtPriceLimitX96,\n zeroForOne\n );\n\n while (state.amountSpecifiedRemaining != 0 && sqrtPriceX96 != sqrtPriceLimitX96)\n (sqrtPriceNextX96, sqrtPriceX96, liquidity) = processSwapWithinTick(\n IUniswapV3Pool(poolAddress),\n initialPoolState,\n state,\n sqrtPriceX96,\n liquidity,\n sqrtPriceLimitX96,\n zeroForOne,\n exactAmount\n );\n\n (amount0, amount1) = returnedAmount(state, amountSpecified, zeroForOne);\n }\n}\n" + }, + "contracts/external/uniswap/TickMath.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\n// From Uniswap3 Core\n\n// Updated to Solidity 0.8 by Midas Capital:\n// * Cast MAX_TICK to int256 before casting to uint\n// * Wrapped function bodies with \"unchecked {}\" so as to not add any extra gas costs\n\npragma solidity ^0.8.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n unchecked {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), \"T\");\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n unchecked {\n // second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, \"R\");\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n }\n}\n" + }, + "contracts/external/uniswap/UniswapV2Library.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV2Pair.sol\";\nimport \"./IUniswapV2Factory.sol\";\n\nlibrary UniswapV2Library {\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n require(tokenA != tokenB, \"UniswapV2Library: IDENTICAL_ADDRESSES\");\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), \"UniswapV2Library: ZERO_ADDRESS\");\n }\n\n function pairFor(\n address factory,\n address tokenA,\n address tokenB\n ) internal view returns (address pair) {\n return IUniswapV2Factory(factory).getPair(tokenA, tokenB);\n }\n\n // fetches and sorts the reserves for a pair\n function getReserves(\n address factory,\n address tokenA,\n address tokenB\n ) internal view returns (uint256 reserveA, uint256 reserveB) {\n (address token0, ) = sortTokens(tokenA, tokenB);\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n }\n\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) internal pure returns (uint256 amountB) {\n require(amountA > 0, \"UniswapV2Library: INSUFFICIENT_AMOUNT\");\n require(reserveA > 0 && reserveB > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n amountB = (amountA * reserveB) / reserveA;\n }\n\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut,\n uint8 flashSwapFee\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * (10000 - flashSwapFee);\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = reserveIn * 10000 + amountInWithFee;\n amountOut = numerator / denominator;\n }\n\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut,\n uint8 flashSwapFee\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * 10000;\n uint256 denominator = (reserveOut - amountOut) * (10000 - flashSwapFee);\n amountIn = numerator / denominator + 1;\n }\n\n // performs chained getAmountOut calculations on any number of pairs\n function getAmountsOut(\n address factory,\n uint256 amountIn,\n address[] memory path,\n uint8 flashSwapFee\n ) internal view returns (uint256[] memory amounts) {\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n amounts = new uint256[](path.length);\n amounts[0] = amountIn;\n for (uint256 i; i < path.length - 1; i++) {\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i], path[i + 1]);\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut, flashSwapFee);\n }\n }\n\n // performs chained getAmountIn calculations on any number of pairs\n function getAmountsIn(\n address factory,\n uint256 amountOut,\n address[] memory path,\n uint8 flashSwapFee\n ) internal view returns (uint256[] memory amounts) {\n require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n amounts = new uint256[](path.length);\n amounts[amounts.length - 1] = amountOut;\n for (uint256 i = path.length - 1; i > 0; i--) {\n (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i - 1], path[i]);\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut, flashSwapFee);\n }\n }\n}\n" + }, + "contracts/external/velodrome/IVelodromeRouter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IRouter_Velodrome {\n struct Route {\n address from;\n address to;\n bool stable;\n }\n\n error ETHTransferFailed();\n error Expired();\n error InsufficientAmount();\n error InsufficientAmountA();\n error InsufficientAmountB();\n error InsufficientAmountADesired();\n error InsufficientAmountBDesired();\n error InsufficientLiquidity();\n error InsufficientOutputAmount();\n error InvalidPath();\n error OnlyWETH();\n error SameAddresses();\n error ZeroAddress();\n\n /// @notice Address of Velodrome v2 pool factory\n function factory() external view returns (address);\n\n /// @notice Address of Velodrome v2 pool implementation\n function poolImplementation() external view returns (address);\n\n /// @notice Sort two tokens by which address value is less than the other\n /// @param tokenA Address of token to sort\n /// @param tokenB Address of token to sort\n /// @return token0 Lower address value between tokenA and tokenB\n /// @return token1 Higher address value between tokenA and tokenB\n function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);\n\n /// @notice Calculate the address of a pool by its' factory.\n /// @dev Returns a randomly generated address for a nonexistent pool\n /// @param tokenA Address of token to query\n /// @param tokenB Address of token to query\n /// @param stable True if pool is stable, false if volatile\n function poolFor(address tokenA, address tokenB, bool stable) external view returns (address pool);\n\n /// @notice Fetch and sort the reserves for a pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @return reserveA Amount of reserves of the sorted token A\n /// @return reserveB Amount of reserves of the sorted token B\n function getReserves(\n address tokenA,\n address tokenB,\n bool stable\n ) external view returns (uint256 reserveA, uint256 reserveB);\n\n /// @notice Perform chained getAmountOut calculations on any number of pools\n function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts);\n\n // **** ADD LIQUIDITY ****\n\n /// @notice Quote the amount deposited into a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function quoteAddLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired\n ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Quote the amount of liquidity removed from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function quoteRemoveLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity\n ) external view returns (uint256 amountA, uint256 amountB);\n\n /// @notice Add liquidity of two tokens to a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountADesired Amount of tokenA desired to deposit\n /// @param amountBDesired Amount of tokenB desired to deposit\n /// @param amountAMin Minimum amount of tokenA to deposit\n /// @param amountBMin Minimum amount of tokenB to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountA Amount of tokenA to actually deposit\n /// @return amountB Amount of tokenB to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param amountTokenDesired Amount of token desired to deposit\n /// @param amountTokenMin Minimum amount of token to deposit\n /// @param amountETHMin Minimum amount of ETH to deposit\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to add liquidity\n /// @return amountToken Amount of token to actually deposit\n /// @return amountETH Amount of tokenETH to actually deposit\n /// @return liquidity Amount of liquidity token returned from deposit\n function addLiquidityETH(\n address token,\n bool stable,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n // **** REMOVE LIQUIDITY ****\n\n /// @notice Remove liquidity of two tokens from a Pool\n /// @param tokenA .\n /// @param tokenB .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountAMin Minimum amount of tokenA to receive\n /// @param amountBMin Minimum amount of tokenB to receive\n /// @param to Recipient of tokens received\n /// @param deadline Deadline to remove liquidity\n /// @return amountA Amount of tokenA received\n /// @return amountB Amount of tokenB received\n function removeLiquidity(\n address tokenA,\n address tokenB,\n bool stable,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountToken Amount of token received\n /// @return amountETH Amount of ETH received\n function removeLiquidityETH(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool\n /// @param token .\n /// @param stable True if pool is stable, false if volatile\n /// @param liquidity Amount of liquidity to remove\n /// @param amountTokenMin Minimum amount of token to receive\n /// @param amountETHMin Minimum amount of ETH to receive\n /// @param to Recipient of liquidity token\n /// @param deadline Deadline to receive liquidity\n /// @return amountETH Amount of ETH received\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n bool stable,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n /// @notice Swap one token for another\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n /// @notice Swap ETH for a token\n /// @param amountOutMin Minimum amount of desired token received\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactETHForTokens(\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n /// @notice Swap a token for WETH (returned as ETH)\n /// @param amountIn Amount of token in\n /// @param amountOutMin Minimum amount of desired ETH\n /// @param routes Array of trade routes used in the swap\n /// @param to Recipient of the tokens received\n /// @param deadline Deadline to receive tokens\n /// @return amounts Array of amounts returned per route\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n Route[] calldata routes,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n" + }, + "contracts/FeeDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { CErc20Delegator } from \"./compound/CErc20Delegator.sol\";\nimport { CErc20PluginDelegate } from \"./compound/CErc20PluginDelegate.sol\";\nimport { SafeOwnableUpgradeable } from \"./ionic/SafeOwnableUpgradeable.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { DiamondExtension, DiamondBase } from \"./ionic/DiamondExtension.sol\";\nimport { AuthoritiesRegistry } from \"./ionic/AuthoritiesRegistry.sol\";\n\ncontract FeeDistributorStorage {\n struct CDelegateUpgradeData {\n address implementation;\n bytes becomeImplementationData;\n }\n\n /**\n * @notice Maps Unitroller (Comptroller proxy) addresses to the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n * @dev A value of 0 means unset whereas a negative value means 0.\n */\n mapping(address => int256) public customInterestFeeRates;\n\n /**\n * @dev Latest Comptroller implementation for each existing implementation.\n */\n mapping(address => address) internal _latestComptrollerImplementation;\n\n /**\n * @dev Latest CErc20Delegate implementation for each existing implementation.\n */\n mapping(uint8 => CDelegateUpgradeData) internal _latestCErc20Delegate;\n\n /**\n * @dev Latest Plugin implementation for each existing implementation.\n */\n mapping(address => address) internal _latestPluginImplementation;\n\n mapping(address => DiamondExtension[]) public comptrollerExtensions;\n\n mapping(address => DiamondExtension[]) public cErc20DelegateExtensions;\n\n AuthoritiesRegistry public authoritiesRegistry;\n\n /**\n * @dev used as salt for the creation of new markets\n */\n uint256 public marketsCounter;\n\n /**\n * @dev Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\n */\n uint256 public minBorrowEth;\n\n /**\n * @dev Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\n * No longer used as of `Rari-Capital/compound-protocol` version `fuse-v1.1.0`.\n */\n uint256 public maxUtilizationRate;\n\n /**\n * @notice The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n uint256 public defaultInterestFeeRate;\n}\n\n/**\n * @title FeeDistributor\n * @author David Lucid (https://github.com/davidlucid)\n * @notice FeeDistributor controls and receives protocol fees from Ionic pools and relays admin actions to Ionic pools.\n */\ncontract FeeDistributor is SafeOwnableUpgradeable, FeeDistributorStorage {\n using AddressUpgradeable for address;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @dev Initializer that sets initial values of state variables.\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function initialize(uint256 _defaultInterestFeeRate) public initializer {\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n __SafeOwnable_init(msg.sender);\n defaultInterestFeeRate = _defaultInterestFeeRate;\n maxUtilizationRate = type(uint256).max;\n }\n\n function reinitialize(AuthoritiesRegistry _ar) public onlyOwnerOrAdmin {\n authoritiesRegistry = _ar;\n }\n\n /**\n * @dev Sets the default proportion of Ionic pool interest taken as a protocol fee.\n * @param _defaultInterestFeeRate The default proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function _setDefaultInterestFeeRate(uint256 _defaultInterestFeeRate) external onlyOwner {\n require(_defaultInterestFeeRate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n defaultInterestFeeRate = _defaultInterestFeeRate;\n }\n\n /**\n * @dev Withdraws accrued fees on interest.\n * @param erc20Contract The ERC20 token address to withdraw. Set to the zero address to withdraw ETH.\n */\n function _withdrawAssets(address erc20Contract) external {\n if (erc20Contract == address(0)) {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No balance available to withdraw.\");\n (bool success, ) = owner().call{ value: balance }(\"\");\n require(success, \"Failed to transfer ETH balance to msg.sender.\");\n } else {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 balance = token.balanceOf(address(this));\n require(balance > 0, \"No token balance available to withdraw.\");\n token.safeTransfer(owner(), balance);\n }\n }\n\n /**\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\n * @param _minBorrowEth Minimum borrow balance (in ETH) per user per Ionic pool asset (only checked on new borrows, not redemptions).\n * @param _maxUtilizationRate Maximum utilization rate (scaled by 1e18) for Ionic pool assets (only checked on new borrows, not redemptions).\n */\n function _setPoolLimits(uint256 _minBorrowEth, uint256 _maxUtilizationRate) external onlyOwner {\n minBorrowEth = _minBorrowEth;\n maxUtilizationRate = _maxUtilizationRate;\n }\n\n function getMinBorrowEth(ICErc20 _ctoken) public view returns (uint256) {\n (, , uint256 borrowBalance, ) = _ctoken.getAccountSnapshot(_msgSender());\n if (borrowBalance == 0) return minBorrowEth;\n IonicComptroller comptroller = IonicComptroller(address(_ctoken.comptroller()));\n BasePriceOracle oracle = comptroller.oracle();\n uint256 underlyingPriceEth = oracle.price(ICErc20(address(_ctoken)).underlying());\n uint256 underlyingDecimals = _ctoken.decimals();\n uint256 borrowBalanceEth = (underlyingPriceEth * borrowBalance) / 10 ** underlyingDecimals;\n if (borrowBalanceEth > minBorrowEth) {\n return 0;\n }\n return minBorrowEth - borrowBalanceEth;\n }\n\n /**\n * @dev Receives native fees.\n */\n receive() external payable {}\n\n /**\n * @dev Sends data to a contract.\n * @param targets The contracts to which `data` will be sent.\n * @param data The data to be sent to each of `targets`.\n */\n function _callPool(address[] calldata targets, bytes[] calldata data) external onlyOwner {\n require(targets.length > 0 && targets.length == data.length, \"Array lengths must be equal and greater than 0.\");\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data[i]);\n }\n\n /**\n * @dev Sends data to a contract.\n * @param targets The contracts to which `data` will be sent.\n * @param data The data to be sent to each of `targets`.\n */\n function _callPool(address[] calldata targets, bytes calldata data) external onlyOwner {\n require(targets.length > 0, \"No target addresses specified.\");\n for (uint256 i = 0; i < targets.length; i++) targets[i].functionCall(data);\n }\n\n /**\n * @dev Deploys a CToken for an underlying ERC20\n * @param constructorData Encoded construction data for `CToken initialize()`\n */\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address) {\n // Make sure comptroller == msg.sender\n (address underlying, address comptroller) = abi.decode(constructorData[0:64], (address, address));\n require(comptroller == msg.sender, \"Comptroller is not sender.\");\n\n // Deploy CErc20Delegator using msg.sender, underlying, and block.number as a salt\n bytes32 salt = keccak256(abi.encodePacked(msg.sender, underlying, ++marketsCounter));\n\n bytes memory cErc20DelegatorCreationCode = abi.encodePacked(type(CErc20Delegator).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(0, salt, cErc20DelegatorCreationCode);\n\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\n DiamondExtension delegateAsExtension = DiamondExtension(data.implementation);\n // register the first extension\n DiamondBase(proxy)._registerExtension(delegateAsExtension, DiamondExtension(address(0)));\n // derive and configure the other extensions\n DiamondExtension[] memory ctokenExts = cErc20DelegateExtensions[address(delegateAsExtension)];\n for (uint256 i = 0; i < ctokenExts.length; i++) {\n if (ctokenExts[i] == delegateAsExtension) continue;\n DiamondBase(proxy)._registerExtension(ctokenExts[i], DiamondExtension(address(0)));\n }\n CErc20PluginDelegate(address(proxy))._becomeImplementation(becomeImplData);\n\n return proxy;\n }\n\n /**\n * @dev Latest Comptroller implementation for each existing implementation.\n */\n function latestComptrollerImplementation(address oldImplementation) external view returns (address) {\n return\n _latestComptrollerImplementation[oldImplementation] != address(0)\n ? _latestComptrollerImplementation[oldImplementation]\n : oldImplementation;\n }\n\n /**\n * @dev Sets the latest `Comptroller` upgrade implementation address.\n * @param oldImplementation The old `Comptroller` implementation address to upgrade from.\n * @param newImplementation Latest `Comptroller` implementation address.\n */\n function _setLatestComptrollerImplementation(\n address oldImplementation,\n address newImplementation\n ) external onlyOwner {\n _latestComptrollerImplementation[oldImplementation] = newImplementation;\n }\n\n /**\n * @dev Latest CErc20Delegate implementation for each existing implementation.\n */\n function latestCErc20Delegate(uint8 delegateType) external view returns (address, bytes memory) {\n CDelegateUpgradeData memory data = _latestCErc20Delegate[delegateType];\n bytes memory emptyBytes;\n return\n data.implementation != address(0)\n ? (data.implementation, data.becomeImplementationData)\n : (address(0), emptyBytes);\n }\n\n /**\n * @dev Sets the latest `CErc20Delegate` upgrade implementation address and data.\n * @param delegateType The old `CErc20Delegate` implementation address to upgrade from.\n * @param newImplementation Latest `CErc20Delegate` implementation address.\n * @param becomeImplementationData Data passed to the new implementation via `becomeImplementation` after upgrade.\n */\n function _setLatestCErc20Delegate(\n uint8 delegateType,\n address newImplementation,\n bytes calldata becomeImplementationData\n ) external onlyOwner {\n _latestCErc20Delegate[delegateType] = CDelegateUpgradeData(newImplementation, becomeImplementationData);\n }\n\n /**\n * @dev Latest Plugin implementation for each existing implementation.\n */\n function latestPluginImplementation(address oldImplementation) external view returns (address) {\n return\n _latestPluginImplementation[oldImplementation] != address(0)\n ? _latestPluginImplementation[oldImplementation]\n : oldImplementation;\n }\n\n /**\n * @dev Sets the latest plugin upgrade implementation address.\n * @param oldImplementation The old plugin implementation address to upgrade from.\n * @param newImplementation Latest plugin implementation address.\n */\n function _setLatestPluginImplementation(address oldImplementation, address newImplementation) external onlyOwner {\n _latestPluginImplementation[oldImplementation] = newImplementation;\n }\n\n /**\n * @dev Upgrades a plugin of a CErc20PluginDelegate market to the latest implementation\n * @param cDelegator the proxy address\n * @return if the plugin was upgraded or not\n */\n function _upgradePluginToLatestImplementation(address cDelegator) external onlyOwner returns (bool) {\n CErc20PluginDelegate market = CErc20PluginDelegate(cDelegator);\n\n address oldPluginAddress = address(market.plugin());\n market._updatePlugin(_latestPluginImplementation[oldPluginAddress]);\n address newPluginAddress = address(market.plugin());\n\n return newPluginAddress != oldPluginAddress;\n }\n\n /**\n * @notice Returns the proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function interestFeeRate() external view returns (uint256) {\n (bool success, bytes memory data) = msg.sender.staticcall(abi.encodeWithSignature(\"comptroller()\"));\n\n if (success && data.length == 32) {\n address comptroller = abi.decode(data, (address));\n int256 customRate = customInterestFeeRates[comptroller];\n if (customRate > 0) return uint256(customRate);\n if (customRate < 0) return 0;\n }\n\n return defaultInterestFeeRate;\n }\n\n /**\n * @dev Sets the proportion of Ionic pool interest taken as a protocol fee.\n * @param comptroller The Unitroller (Comptroller proxy) address.\n * @param rate The proportion of Ionic pool interest taken as a protocol fee (scaled by 1e18).\n */\n function _setCustomInterestFeeRate(address comptroller, int256 rate) external onlyOwner {\n require(rate <= 1e18, \"Interest fee rate cannot be more than 100%.\");\n customInterestFeeRates[comptroller] = rate;\n }\n\n function getComptrollerExtensions(address comptroller) external view returns (DiamondExtension[] memory) {\n return comptrollerExtensions[comptroller];\n }\n\n function _setComptrollerExtensions(address comptroller, DiamondExtension[] calldata extensions) external onlyOwner {\n comptrollerExtensions[comptroller] = extensions;\n }\n\n function _registerComptrollerExtension(\n address payable pool,\n DiamondExtension extensionToAdd,\n DiamondExtension extensionToReplace\n ) external onlyOwner {\n DiamondBase(pool)._registerExtension(extensionToAdd, extensionToReplace);\n }\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (DiamondExtension[] memory) {\n return cErc20DelegateExtensions[cErc20Delegate];\n }\n\n function _setCErc20DelegateExtensions(\n address cErc20Delegate,\n DiamondExtension[] calldata extensions\n ) external onlyOwner {\n cErc20DelegateExtensions[cErc20Delegate] = extensions;\n }\n\n function autoUpgradePool(IonicComptroller pool) external onlyOwner {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n // auto upgrade the pool\n pool._upgrade();\n\n for (uint8 i = 0; i < markets.length; i++) {\n // upgrade the market\n markets[i]._upgrade();\n }\n }\n\n function canCall(address pool, address user, address target, bytes4 functionSig) external view returns (bool) {\n return authoritiesRegistry.canCall(pool, user, target, functionSig);\n }\n}\n" + }, + "contracts/GlobalPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\ninterface IPoolDirectory {\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n function getActivePools() external view returns (uint256, Pool[] memory);\n}\n\ncontract GlobalPauser is Ownable2Step {\n IPoolDirectory public poolDirectory;\n mapping(address => bool) public pauseGuardian;\n\n modifier onlyPauseGuardian() {\n require(pauseGuardian[msg.sender], \"!guardian\");\n _;\n }\n\n constructor(address _poolDirectory) Ownable2Step() {\n poolDirectory = IPoolDirectory(_poolDirectory);\n }\n\n function setPauseGuardian(address _pauseGuardian, bool _isPauseGuardian) external onlyOwner {\n pauseGuardian[_pauseGuardian] = _isPauseGuardian;\n }\n\n function pauseAll() external onlyPauseGuardian {\n (, IPoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n if (!isPaused) {\n IonicComptroller(pools[i].comptroller)._setBorrowPaused(markets[j], true);\n }\n\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n if (!isPaused) {\n IonicComptroller(pools[i].comptroller)._setMintPaused(markets[j], true);\n }\n }\n }\n }\n}\n" + }, + "contracts/IEmissionsManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IEmissionsManager {\n error InvalidPoolDirectoryAaddress();\n error InvalidProtocolAddress();\n error InvalidRewardTokenAddress();\n error CollateralBasisPointsExceedMaximum();\n error InvalidVeIONAddress();\n error MaximumLimitExceeded();\n\n event Initialized(\n address indexed protocolAddress,\n address indexed rewardToken,\n uint256 collateralBp,\n bytes nonBlacklistableTargetBytecode\n );\n event VeIonSet(address indexed veIon);\n event CollateralBpSet(uint256 collateralBp);\n event NonBlacklistableAddressSet(address indexed user, bool isNonBlacklistable);\n event NonBlacklistableTargetBytecodeSet(bytes newBytecode);\n\n function isUserBlacklisted(address _user) external view returns (bool);\n function isUserBlacklistable(address _user) external view returns (bool);\n}\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\n\ninterface ILiquidator {\n /**\n * borrower The borrower's Ethereum address.\n * repayAmount The amount to repay to liquidate the unhealthy loan.\n * cErc20 The borrowed CErc20 contract to repay.\n * cTokenCollateral The cToken collateral contract to be liquidated.\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\n */\n struct LiquidateToTokensWithFlashSwapVars {\n address borrower;\n uint256 repayAmount;\n ICErc20 cErc20;\n ICErc20 cTokenCollateral;\n address flashSwapContract;\n uint256 minProfitAmount;\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] strategyData;\n IFundsConversionStrategy[] debtFundingStrategies;\n bytes[] debtFundingStrategiesData;\n }\n\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256);\n\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\n external\n returns (uint256);\n\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\n\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\n external;\n\n function setExpressRelay(address _expressRelay) external;\n\n function setPoolLens(address _poolLens) external;\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\n}\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title AddressesProvider\n * @notice The Addresses Provider serves as a central storage of system internal and external\n * contract addresses that change between deploys and across chains\n * @author Veliko Minkov \n */\ncontract AddressesProvider is SafeOwnableUpgradeable {\n mapping(string => address) private _addresses;\n mapping(address => Contract) public plugins;\n mapping(address => Contract) public flywheelRewards;\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\n JarvisPool[] public jarvisPoolsConfig;\n CurveSwapPool[] public curveSwapPoolsConfig;\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\n\n /// @dev Initializer to set the admin that can set and change contracts addresses\n function initialize(address owner) public initializer {\n __SafeOwnable_init(owner);\n }\n\n /**\n * @dev The contract address and a string that uniquely identifies the contract's interface\n */\n struct Contract {\n address addr;\n string contractInterface;\n }\n\n struct RedemptionStrategy {\n address addr;\n string contractInterface;\n address outputToken;\n }\n\n struct FundingStrategy {\n address addr;\n string contractInterface;\n address inputToken;\n }\n\n struct JarvisPool {\n address syntheticToken;\n address collateralToken;\n address liquidityPool;\n uint256 expirationTime;\n }\n\n struct CurveSwapPool {\n address poolAddress;\n address[] coins;\n }\n\n /**\n * @dev sets the address and contract interface ID of the flywheel for the reward token\n * @param rewardToken the reward token address\n * @param flywheelRewardsModule the flywheel rewards module address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFlywheelRewards(\n address rewardToken,\n address flywheelRewardsModule,\n string calldata contractInterface\n ) public onlyOwner {\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\n * @param asset the asset address\n * @param plugin the ERC4626 plugin address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setPlugin(\n address asset,\n address plugin,\n string calldata contractInterface\n ) public onlyOwner {\n plugins[asset] = Contract(plugin, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\n * @param asset the asset address\n * @param strategy redemption strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setRedemptionStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address outputToken\n ) public onlyOwner {\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\n }\n\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\n return redemptionStrategiesConfig[asset];\n }\n\n /**\n * @dev sets the address and contract interface ID of the funding strategy for the asset\n * @param asset the asset address\n * @param strategy funding strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFundingStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address inputToken\n ) public onlyOwner {\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\n }\n\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\n return fundingStrategiesConfig[asset];\n }\n\n /**\n * @dev configures the Jarvis pool of a Jarvis synthetic token\n * @param syntheticToken the synthetic token address\n * @param collateralToken the collateral token address\n * @param liquidityPool the liquidity pool address\n * @param expirationTime the operation expiration time\n */\n function setJarvisPool(\n address syntheticToken,\n address collateralToken,\n address liquidityPool,\n uint256 expirationTime\n ) public onlyOwner {\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\n }\n\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\n }\n\n /**\n * @dev Sets an address for an id replacing the address saved in the addresses map\n * @param id The id\n * @param newAddress The address to set\n */\n function setAddress(string calldata id, address newAddress) external onlyOwner {\n _addresses[id] = newAddress;\n }\n\n /**\n * @dev Returns an address by id\n * @return The address\n */\n function getAddress(string calldata id) public view returns (address) {\n return _addresses[id];\n }\n\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\n return curveSwapPoolsConfig;\n }\n\n function getJarvisPools() public view returns (JarvisPool[] memory) {\n return jarvisPoolsConfig;\n }\n\n function setBalancerPoolForTokens(\n address inputToken,\n address outputToken,\n address pool\n ) external onlyOwner {\n balancerPoolForTokens[inputToken][outputToken] = pool;\n }\n\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\n return balancerPoolForTokens[inputToken][outputToken];\n }\n}\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\n PoolRolesAuthority public poolAuthLogic;\n address public leveredPositionsFactory;\n bool public noAuthRequired;\n\n function initialize(address _leveredPositionsFactory) public initializer {\n __SafeOwnable_init(msg.sender);\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n }\n\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n // for Neon the auth is not required\n noAuthRequired = block.chainid == 245022934;\n }\n\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\n\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\n auth = PoolRolesAuthority(address(proxy));\n auth.initialize(address(this));\n poolsAuthorities[pool] = auth;\n\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\n // sets the registry owner as the auth owner\n reconfigureAuthority(pool);\n }\n\n function reconfigureAuthority(address poolAddress) public {\n IonicComptroller pool = IonicComptroller(poolAddress);\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\n\n if (msg.sender != poolAddress || address(auth) != address(0)) {\n require(address(auth) != address(0), \"no such authority\");\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\n\n auth.configureRegistryCapabilities();\n auth.configurePoolSupplierCapabilities(pool);\n auth.configurePoolBorrowerCapabilities(pool);\n // everyone can be a liquidator\n auth.configureOpenPoolLiquidatorCapabilities(pool);\n auth.configureLeveredPositionCapabilities(pool);\n\n if (auth.owner() != owner()) {\n auth.setOwner(owner());\n }\n }\n }\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool) {\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\n if (address(authorityForPool) == address(0)) {\n return noAuthRequired;\n } else {\n // allow only if an auth exists and it allows the action\n return authorityForPool.canCall(user, target, functionSig);\n }\n }\n\n function setUserRole(\n address pool,\n address user,\n uint8 role,\n bool enabled\n ) external {\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\n\n require(address(poolAuth) != address(0), \"auth does not exist\");\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\n\n poolAuth.setUserRole(user, role, enabled);\n }\n}\n" + }, + "contracts/ionic/CollateralSwap.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable2Step } from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\nimport { IFlashLoanReceiver } from \"./IFlashLoanReceiver.sol\";\nimport { Exponential } from \"../compound/Exponential.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\ncontract CollateralSwap is Ownable2Step, Exponential, IFlashLoanReceiver {\n using SafeERC20 for IERC20;\n\n uint256 public feeBps;\n address public feeRecipient;\n IonicComptroller public comptroller;\n mapping(address => bool) public allowedSwapTargets;\n\n error SwapCollateralFailed();\n error TransferFailed(address market, address user, address target);\n error MintFailed(address market, uint256 errorCode);\n error RedeemFailed(address market, uint256 errorCode);\n error InvalidFlashloanCaller(address caller);\n error InvalidSwapTarget(address target);\n\n constructor(\n uint256 _feeBps,\n address _feeRecipient,\n address _comptroller,\n address[] memory _allowedSwapTargets\n ) Ownable2Step() {\n feeBps = _feeBps;\n feeRecipient = _feeRecipient;\n comptroller = IonicComptroller(_comptroller);\n for (uint256 i = 0; i < _allowedSwapTargets.length; i++) {\n allowedSwapTargets[_allowedSwapTargets[i]] = true;\n }\n }\n\n // ADMIN FUNCTIONS\n\n function setFeeBps(uint256 _feeBps) public onlyOwner {\n feeBps = _feeBps;\n }\n\n function setFeeRecipient(address _feeRecipient) public onlyOwner {\n feeRecipient = _feeRecipient;\n }\n\n function setAllowedSwapTarget(address _target, bool _allowed) public onlyOwner {\n allowedSwapTargets[_target] = _allowed;\n }\n\n function sweep(address token) public onlyOwner {\n IERC20(token).safeTransfer(owner(), IERC20(token).balanceOf(address(this)));\n }\n\n // PUBLIC FUNCTIONS\n\n function swapCollateral(\n uint256 amountUnderlying,\n ICErc20 oldCollateralMarket,\n ICErc20 newCollateralMarket,\n address swapTarget,\n bytes calldata swapData\n ) public {\n oldCollateralMarket.flash(\n amountUnderlying,\n abi.encode(msg.sender, oldCollateralMarket, newCollateralMarket, swapTarget, swapData)\n );\n }\n\n function receiveFlashLoan(address borrowedAsset, uint256 borrowedAmount, bytes calldata data) external {\n // make sure the caller is a valid market\n {\n ICErc20[] memory markets = comptroller.getAllMarkets();\n bool isAllowed = false;\n for (uint256 i = 0; i < markets.length; i++) {\n if (msg.sender == address(markets[i])) {\n isAllowed = true;\n break;\n }\n }\n if (!isAllowed) {\n revert InvalidFlashloanCaller(msg.sender);\n }\n }\n\n (\n address borrower,\n ICErc20 oldCollateralMarket,\n ICErc20 newCollateralMarket,\n address swapTarget,\n bytes memory swapData\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes));\n\n // swap the collateral\n {\n if (!allowedSwapTargets[swapTarget]) {\n revert InvalidSwapTarget(swapTarget);\n }\n IERC20(borrowedAsset).approve(swapTarget, borrowedAmount);\n (bool success, ) = swapTarget.call(swapData);\n if (!success) {\n revert SwapCollateralFailed();\n }\n }\n\n // mint the new collateral\n {\n IERC20 newCollateralAsset = IERC20(newCollateralMarket.underlying());\n uint256 outputAmount = newCollateralAsset.balanceOf(address(this));\n uint256 fee = (outputAmount * feeBps) / 10_000;\n outputAmount -= fee;\n if (fee > 0) {\n newCollateralAsset.safeTransfer(feeRecipient, fee);\n }\n newCollateralAsset.approve(address(newCollateralMarket), outputAmount);\n uint256 mintResult = newCollateralMarket.mint(outputAmount);\n if (mintResult != 0) {\n revert MintFailed(address(newCollateralMarket), mintResult);\n }\n }\n\n // transfer the new collateral to the borrower\n {\n uint256 cTokenBalance = IERC20(address(newCollateralMarket)).balanceOf(address(this));\n IERC20(address(newCollateralMarket)).safeTransfer(borrower, cTokenBalance);\n }\n\n // withdraw the old collateral\n {\n (MathError mErr, uint256 amountCTokensToSwap) = divScalarByExpTruncate(\n borrowedAmount,\n Exp({ mantissa: oldCollateralMarket.exchangeRateCurrent() })\n );\n require(mErr == MathError.NO_ERROR, \"exchange rate error\");\n bool transferStatus = oldCollateralMarket.transferFrom(borrower, address(this), amountCTokensToSwap + 1);\n if (!transferStatus) {\n revert TransferFailed(address(oldCollateralMarket), borrower, address(this));\n }\n uint256 redeemResult = oldCollateralMarket.redeemUnderlying(type(uint256).max);\n if (redeemResult != 0) {\n revert RedeemFailed(address(oldCollateralMarket), redeemResult);\n }\n IERC20(borrowedAsset).approve(address(oldCollateralMarket), borrowedAmount);\n }\n // flashloan gets paid back from redeemed collateral\n }\n}\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @notice a base contract for logic extensions that use the diamond pattern storage\n * to map the functions when looking up the extension contract to delegate to.\n */\nabstract contract DiamondExtension {\n /**\n * @return a list of all the function selectors that this logic extension exposes\n */\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\n}\n\n// When no function exists for function called\nerror FunctionNotFound(bytes4 _functionSelector);\n\n// When no extension exists for function called\nerror ExtensionNotFound(bytes4 _functionSelector);\n\n// When the function is already added\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\n\nabstract contract DiamondBase {\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\n\n function _listExtensions() public view returns (address[] memory) {\n return LibDiamond.listExtensions();\n }\n\n fallback() external {\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n\n/**\n * @notice a library to use in a contract, whose logic is extended with diamond extension\n */\nlibrary LibDiamond {\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\n\n struct Function {\n address extension;\n bytes4 selector;\n }\n\n struct LogicStorage {\n Function[] functions;\n address[] extensions;\n }\n\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\n return getExtensionForSelector(msgSig, diamondStorage());\n }\n\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n assembly {\n ds.slot := position\n }\n }\n\n function listExtensions() internal view returns (address[] memory) {\n return diamondStorage().extensions;\n }\n\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\n if (address(extensionToReplace) != address(0)) {\n removeExtension(extensionToReplace);\n }\n addExtension(extensionToAdd);\n }\n\n function removeExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n // remove all functions of the extension to replace\n removeExtensionFunctions(extension);\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n if (ds.extensions[i] == address(extension)) {\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\n ds.extensions.pop();\n }\n }\n }\n\n function addExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n require(ds.extensions[i] != address(extension), \"extension already added\");\n }\n addExtensionFunctions(extension);\n ds.extensions.push(address(extension));\n }\n\n function removeExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\n bytes4 selectorToRemove = fnsToRemove[i];\n // must never fail\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\n // swap with the last element in the selectorAtIndex array and remove the last element\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\n ds.functions.pop();\n }\n }\n\n function addExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n uint16 functionsCount = uint16(ds.functions.length);\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\n bytes4 selector = fnsToAdd[functionsIndex];\n address oldImplementation = getExtensionForSelector(selector, ds);\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\n ds.functions.push(Function(address(extension), selector));\n functionsCount++;\n }\n }\n\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\n uint256 fnsLen = ds.functions.length;\n for (uint256 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\n }\n\n return address(0);\n }\n\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\n uint16 fnsLen = uint16(ds.functions.length);\n for (uint16 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return i;\n }\n\n return type(uint16).max;\n }\n}\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ninterface IFlashLoanReceiver {\n function receiveFlashLoan(\n address borrowedAsset,\n uint256 borrowedAmount,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/ionic/irms/AdjustableJumpRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../../compound/InterestRateModel.sol\";\nimport \"../../compound/SafeMath.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title Compound's JumpRateModel Contract\n * @author Compound\n */\n\nstruct InterestRateModelParams {\n uint256 blocksPerYear; // The approximate number of blocks per year\n uint256 baseRatePerYear; // The approximate target base APR, as a mantissa (scaled by 1e18)\n uint256 multiplierPerYear; // The rate of increase in interest rate wrt utilization (scaled by 1e18)\n uint256 jumpMultiplierPerYear; // The multiplierPerBlock after hitting a specified utilization point\n uint256 kink; // The utilization point at which the jump multiplier is applied\n}\n\ncontract AdjustableJumpRateModel is Ownable, InterestRateModel {\n using SafeMath for uint256;\n\n event NewInterestParams(\n uint256 baseRatePerBlock,\n uint256 multiplierPerBlock,\n uint256 jumpMultiplierPerBlock,\n uint256 kink\n );\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint256 public blocksPerYear;\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint256 public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint256 public baseRatePerBlock;\n\n /**\n * @notice The multiplierPerBlock after hitting a specified utilization point\n */\n uint256 public jumpMultiplierPerBlock;\n\n /**\n * @notice The utilization point at which the jump multiplier is applied\n */\n uint256 public kink;\n\n /**\n * @notice Initialise an interest rate model\n */\n\n constructor(InterestRateModelParams memory params) {\n blocksPerYear = params.blocksPerYear;\n baseRatePerBlock = params.baseRatePerYear.div(blocksPerYear);\n multiplierPerBlock = params.multiplierPerYear.div(blocksPerYear);\n jumpMultiplierPerBlock = params.jumpMultiplierPerYear.div(blocksPerYear);\n kink = params.kink;\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\n }\n\n function _setIrmParameters(InterestRateModelParams memory params) public onlyOwner {\n blocksPerYear = params.blocksPerYear;\n baseRatePerBlock = params.baseRatePerYear.div(blocksPerYear);\n multiplierPerBlock = params.multiplierPerYear.div(blocksPerYear);\n jumpMultiplierPerBlock = params.jumpMultiplierPerYear.div(blocksPerYear);\n kink = params.kink;\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n uint256 util = utilizationRate(cash, borrows, reserves);\n\n if (util <= kink) {\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n } else {\n uint256 normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n uint256 excessUtil = util.sub(kink);\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\n }\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = uint256(1e18).sub(reserveFactorMantissa);\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\n }\n}\n" + }, + "contracts/ionic/irms/PrudentiaInterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\n\nimport { IRateComputer } from \"adrastia-periphery/rates/IRateComputer.sol\";\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\n/**\n * @title Adrastia Prudentia Interest Rate Model\n * @author TRILEZ SOFTWARE INC.\n */\ncontract PrudentiaInterestRateModel is InterestRateModel {\n using Math for uint256;\n\n /**\n * @notice The address of the underlying token for which the interest rate model calculates rates.\n */\n address public immutable underlyingToken;\n\n /**\n * @notice The address of the Adrastia Prudentia interest rate controller.\n */\n IRateComputer public immutable rateController;\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model.\n */\n uint256 public immutable blocksPerYear;\n\n /**\n * @notice Construct a new interest rate model that reads from an Adrastia Prudentia interest rate controller.\n *\n * @param blocksPerYear_ The approximate number of blocks per year that is assumed by the interest rate model.\n * @param underlyingToken_ The address of the underlying token for which the interest rate model calculates rates.\n * @param rateController_ The address of the Adrastia Prudentia interest rate controller.\n */\n constructor(\n uint256 blocksPerYear_,\n address underlyingToken_,\n IRateComputer rateController_\n ) {\n if (underlyingToken_ == address(0)) {\n revert(\"PrudentiaInterestRateModel: underlyingToken is the zero address\");\n }\n if (address(rateController_) == address(0)) {\n revert(\"PrudentiaInterestRateModel: rateController is the zero address\");\n }\n\n blocksPerYear = blocksPerYear_;\n underlyingToken = underlyingToken_;\n rateController = rateController_;\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`.\n *\n * @param cash The amount of cash in the market.\n * @param borrows The amount of borrows in the market.\n * @param reserves The amount of reserves in the market.\n *\n * @return The utilization rate as a mantissa between [0, 1e18].\n */\n function utilizationRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public pure returns (uint256) {\n uint256 total = cash + borrows - reserves;\n if (total == 0) {\n // Utilization rate is zero when nothing is available (prevents division by zero)\n return 0;\n }\n\n return (borrows * 1e18) / total;\n }\n\n /**\n * @notice Calculates the current borrow rate per block by reading the current rate from the Adrastia Prudentia\n * interest rate controller.\n *\n * @param cash Not used.\n * @param borrows Not used.\n * @param reserves Not used.\n *\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18).\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view override returns (uint256) {\n // Silence unused variable warnings\n cash;\n borrows;\n reserves;\n\n uint256 annualRate = rateController.computeRate(underlyingToken);\n\n return annualRate.ceilDiv(blocksPerYear); // Convert the annual rate to a per-block rate, rounding up\n }\n\n /**\n * @notice Calculates the current supply rate per block.\n *\n * @param cash The amount of cash in the market.\n * @param borrows The amount of borrows in the market.\n * @param reserves The amount of reserves in the market.\n * @param reserveFactorMantissa The current reserve factor for the market.\n *\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18).\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual override returns (uint256) {\n uint256 oneMinusReserveFactor = 1e18 - reserveFactorMantissa;\n uint256 borrowRate = getBorrowRate(cash, borrows, reserves);\n uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18;\n\n return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18;\n }\n}\n" + }, + "contracts/ionic/levered/ILeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ILeveredPositionFactoryStorage {\n function feeDistributor() external view returns (IFeeDistributor);\n\n function liquidatorsRegistry() external view returns (ILiquidatorsRegistry);\n\n function blocksPerYear() external view returns (uint256);\n\n function owner() external view returns (address);\n}\n\ninterface ILeveredPositionFactoryBase {\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external;\n\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external;\n}\n\ninterface ILeveredPositionFactoryFirstExtension {\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\n\n function getMinBorrowNative() external view returns (uint256);\n\n function removeClosedPosition(address closedPosition) external returns (bool removed);\n\n function closeAndRemoveUserPosition(LeveredPosition position) external returns (bool);\n\n function getPositionsByAccount(address account) external view returns (address[] memory, bool[] memory);\n\n function getAccountsWithOpenPositions() external view returns (address[] memory);\n\n function getWhitelistedCollateralMarkets() external view returns (address[] memory);\n\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory);\n\n function getPositionsExtension(bytes4 msgSig) external view returns (address);\n\n function _setPositionsExtension(bytes4 msgSig, address extension) external;\n}\n\ninterface ILeveredPositionFactorySecondExtension {\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) external returns (LeveredPosition);\n\n function createAndFundPosition(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount\n ) external returns (LeveredPosition);\n\n function createAndFundPositionAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount,\n uint256 _leverageRatio\n ) external returns (LeveredPosition);\n}\n\ninterface ILeveredPositionFactoryExtension is\n ILeveredPositionFactoryFirstExtension,\n ILeveredPositionFactorySecondExtension\n{}\n\ninterface ILeveredPositionFactory is\n ILeveredPositionFactoryStorage,\n ILeveredPositionFactoryBase,\n ILeveredPositionFactoryExtension\n{}\n" + }, + "contracts/ionic/levered/LeveredPosition.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { IFlashLoanReceiver } from \"../IFlashLoanReceiver.sol\";\nimport { IonicFlywheel } from \"../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { LeveredPositionStorage } from \"./LeveredPositionStorage.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFlywheelLensRouter_LP {\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\n}\n\ncontract LeveredPosition is LeveredPositionStorage, IFlashLoanReceiver {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n error OnlyWhenClosed();\n error NotPositionOwner();\n error OnlyFactoryOwner();\n error AssetNotRescuable();\n error RepayFlashLoanFailed(address asset, uint256 currentBalance, uint256 repayAmount);\n\n error ConvertFundsFailed();\n error ExitFailed(uint256 errorCode);\n error RedeemFailed(uint256 errorCode);\n error SupplyCollateralFailed(uint256 errorCode);\n error BorrowStableFailed(uint256 errorCode);\n error RepayBorrowFailed(uint256 errorCode);\n error RedeemCollateralFailed(uint256 errorCode);\n error ExtNotFound(bytes4 _functionSelector);\n\n constructor(\n address _positionOwner,\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket\n ) LeveredPositionStorage(_positionOwner) {\n IonicComptroller collateralPool = _collateralMarket.comptroller();\n IonicComptroller stablePool = _stableMarket.comptroller();\n require(collateralPool == stablePool, \"markets pools differ\");\n pool = collateralPool;\n\n collateralMarket = _collateralMarket;\n collateralAsset = IERC20Upgradeable(_collateralMarket.underlying());\n stableMarket = _stableMarket;\n stableAsset = IERC20Upgradeable(_stableMarket.underlying());\n\n factory = ILeveredPositionFactory(msg.sender);\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n function fundPosition(IERC20Upgradeable fundingAsset, uint256 amount) public {\n fundingAsset.safeTransferFrom(msg.sender, address(this), amount);\n _supplyCollateral(fundingAsset);\n\n if (!pool.checkMembership(address(this), collateralMarket)) {\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(collateralMarket);\n pool.enterMarkets(cTokens);\n }\n }\n\n function closePosition() public returns (uint256) {\n return closePosition(msg.sender);\n }\n\n function closePosition(address withdrawTo) public returns (uint256 withdrawAmount) {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n _leverDown(1e18);\n\n // calling accrue and exit allows to redeem the full underlying balance\n collateralMarket.accrueInterest();\n uint256 errorCode = pool.exitMarket(address(collateralMarket));\n if (errorCode != 0) revert ExitFailed(errorCode);\n\n // redeem all cTokens should leave no dust\n errorCode = collateralMarket.redeem(collateralMarket.balanceOf(address(this)));\n if (errorCode != 0) revert RedeemFailed(errorCode);\n\n if (stableAsset.balanceOf(address(this)) > 0) {\n // convert all overborrowed leftovers/profits to the collateral asset\n convertAllTo(stableAsset, collateralAsset);\n }\n\n // withdraw the redeemed collateral\n withdrawAmount = collateralAsset.balanceOf(address(this));\n collateralAsset.safeTransfer(withdrawTo, withdrawAmount);\n }\n\n function adjustLeverageRatio(uint256 targetRatioMantissa) public returns (uint256) {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n // anything under 1x means removing the leverage\n if (targetRatioMantissa <= 1e18) _leverDown(1e18);\n\n if (getCurrentLeverageRatio() < targetRatioMantissa) _leverUp(targetRatioMantissa);\n else _leverDown(targetRatioMantissa);\n\n // return the de facto achieved ratio\n return getCurrentLeverageRatio();\n }\n\n function receiveFlashLoan(address assetAddress, uint256 borrowedAmount, bytes calldata data) external override {\n if (msg.sender == address(collateralMarket)) {\n // increasing the leverage ratio\n uint256 stableBorrowAmount = abi.decode(data, (uint256));\n _leverUpPostFL(stableBorrowAmount);\n uint256 positionCollateralBalance = collateralAsset.balanceOf(address(this));\n if (positionCollateralBalance < borrowedAmount)\n revert RepayFlashLoanFailed(address(collateralAsset), positionCollateralBalance, borrowedAmount);\n } else if (msg.sender == address(stableMarket)) {\n // decreasing the leverage ratio\n uint256 amountToRedeem = abi.decode(data, (uint256));\n _leverDownPostFL(borrowedAmount, amountToRedeem);\n uint256 positionStableBalance = stableAsset.balanceOf(address(this));\n if (positionStableBalance < borrowedAmount)\n revert RepayFlashLoanFailed(address(stableAsset), positionStableBalance, borrowedAmount);\n } else {\n revert(\"!fl not from either markets\");\n }\n\n // repay FL\n IERC20Upgradeable(assetAddress).approve(msg.sender, borrowedAmount);\n }\n\n function withdrawStableLeftovers(address withdrawTo) public returns (uint256) {\n if (msg.sender != positionOwner) revert NotPositionOwner();\n if (!isPositionClosed()) revert OnlyWhenClosed();\n\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\n stableAsset.safeTransfer(withdrawTo, stableLeftovers);\n return stableLeftovers;\n }\n\n function claimRewards() public {\n claimRewards(msg.sender);\n }\n\n function claimRewards(address withdrawTo) public {\n if (msg.sender != positionOwner && msg.sender != address(factory)) revert NotPositionOwner();\n\n address[] memory flywheels = pool.getRewardsDistributors();\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\n fw.accrue(ERC20(address(collateralMarket)), address(this));\n fw.accrue(ERC20(address(stableMarket)), address(this));\n fw.claimRewards(address(this));\n ERC20 rewardToken = fw.rewardToken();\n uint256 rewardsAccrued = rewardToken.balanceOf(address(this));\n if (rewardsAccrued > 0) {\n rewardToken.transfer(withdrawTo, rewardsAccrued);\n }\n }\n }\n\n function rescueTokens(IERC20Upgradeable asset) external {\n if (msg.sender != factory.owner()) revert OnlyFactoryOwner();\n if (asset == stableAsset || asset == collateralAsset) revert AssetNotRescuable();\n\n asset.transfer(positionOwner, asset.balanceOf(address(this)));\n }\n\n function claimRewardsFromRouter(address _flr) external returns (address[] memory, uint256[] memory) {\n IFlywheelLensRouter_LP flr = IFlywheelLensRouter_LP(_flr);\n (address[] memory rewardTokens, uint256[] memory rewards) = flr.claimAllRewardTokens(address(this));\n for (uint256 i = 0; i < rewardTokens.length; i++) {\n IERC20Upgradeable(rewardTokens[i]).safeTransfer(positionOwner, rewards[i]);\n }\n return (rewardTokens, rewards);\n }\n\n fallback() external {\n address extension = factory.getPositionsExtension(msg.sig);\n if (extension == address(0)) revert ExtNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n function getAccruedRewards()\n external\n returns (\n /*view*/\n ERC20[] memory rewardTokens,\n uint256[] memory amounts\n )\n {\n address[] memory flywheels = pool.getRewardsDistributors();\n\n rewardTokens = new ERC20[](flywheels.length);\n amounts = new uint256[](flywheels.length);\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n IonicFlywheel fw = IonicFlywheel(flywheels[i]);\n fw.accrue(ERC20(address(collateralMarket)), address(this));\n fw.accrue(ERC20(address(stableMarket)), address(this));\n rewardTokens[i] = fw.rewardToken();\n amounts[i] = fw.rewardsAccrued(address(this));\n }\n }\n\n function getCurrentLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n BasePriceOracle oracle = pool.oracle();\n\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\n\n uint256 debtValue = 0;\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n if (debtAmount > 0) {\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\n }\n\n // TODO check if positionValue > debtValue\n // s / ( s - b )\n return (positionValue * 1e18) / (positionValue - debtValue);\n }\n\n function getMinLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n BasePriceOracle oracle = pool.oracle();\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 minStableBorrowAmount = (factory.getMinBorrowNative() * 1e18) / borrowedAssetPrice;\n return _getLeverageRatioAfterBorrow(minStableBorrowAmount, positionSupplyAmount, 0);\n }\n\n function getMaxLeverageRatio() public view returns (uint256) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n if (positionSupplyAmount == 0) return 0;\n\n uint256 maxBorrow = pool.getMaxRedeemOrBorrow(address(this), stableMarket, true);\n uint256 positionBorrowAmount = stableMarket.borrowBalanceCurrent(address(this));\n return _getLeverageRatioAfterBorrow(maxBorrow, positionSupplyAmount, positionBorrowAmount);\n }\n\n function _getLeverageRatioAfterBorrow(\n uint256 newBorrowsAmount,\n uint256 positionSupplyAmount,\n uint256 positionBorrowAmount\n ) internal view returns (uint256 r) {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n uint256 currentBorrowsValue = (positionBorrowAmount * stableAssetPrice) / 1e18;\n uint256 newBorrowsValue = (newBorrowsAmount * stableAssetPrice) / 1e18;\n uint256 positionValue = (positionSupplyAmount * collateralAssetPrice) / 1e18;\n\n // accounting for swaps slippage\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\n {\n // add 10 bps just to not go under the min borrow value\n assumedSlippage += 10;\n }\n uint256 topUpCollateralValue = (newBorrowsValue * 10000) / (10000 + assumedSlippage);\n\n int256 s = int256(positionValue);\n int256 b = int256(currentBorrowsValue);\n int256 x = int256(topUpCollateralValue);\n\n r = uint256(((s + x) * 1e18) / (s + x - b - int256(newBorrowsValue)));\n }\n\n function isPositionClosed() public view returns (bool) {\n return collateralMarket.balanceOfUnderlying(address(this)) == 0;\n }\n\n function getEquityAmount() external view returns (uint256 equityAmount) {\n BasePriceOracle oracle = pool.oracle();\n uint256 borrowedAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n uint256 positionValue = (collateralAssetPrice * positionSupplyAmount) / 1e18;\n\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n uint256 debtValue = (borrowedAssetPrice * debtAmount) / 1e18;\n\n uint256 equityValue = positionValue - debtValue;\n equityAmount = (equityValue * 1e18) / collateralAssetPrice;\n }\n\n function getSupplyAmountDelta(uint256 targetRatio) public view returns (uint256, uint256) {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n uint256 currentRatio = getCurrentLeverageRatio();\n bool up = targetRatio > currentRatio;\n return _getSupplyAmountDelta(up, targetRatio, collateralAssetPrice, stableAssetPrice);\n }\n\n function _getSupplyAmountDelta(\n bool up,\n uint256 targetRatio,\n uint256 collateralAssetPrice,\n uint256 borrowedAssetPrice\n ) internal view returns (uint256 supplyDelta, uint256 borrowsDelta) {\n uint256 positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(this));\n uint256 debtAmount = stableMarket.borrowBalanceCurrent(address(this));\n uint256 assumedSlippage;\n if (up) assumedSlippage = factory.liquidatorsRegistry().getSlippage(stableAsset, collateralAsset);\n else assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\n uint256 slippageFactor = (1e18 * (10000 + assumedSlippage)) / 10000;\n\n uint256 supplyValueDeltaAbs;\n {\n // s = supply value before\n // b = borrow value before\n // r = target ratio after\n // c = borrow value coefficient to account for the slippage\n int256 s = int256((collateralAssetPrice * positionSupplyAmount) / 1e18);\n int256 b = int256((borrowedAssetPrice * debtAmount) / 1e18);\n int256 r = int256(targetRatio);\n int256 r1 = r - 1e18;\n int256 c = int256(slippageFactor);\n\n // some math magic here\n // https://www.wolframalpha.com/input?i2d=true&i=r%3D%5C%2840%29Divide%5B%5C%2840%29s%2Bx%5C%2841%29%2C%5C%2840%29s%2Bx-b-c*x%5C%2841%29%5D+%5C%2841%29+solve+for+x\n\n // x = supplyValueDelta\n int256 supplyValueDelta = (((r1 * s) - (b * r)) * 1e18) / ((c * r) - (1e18 * r1));\n supplyValueDeltaAbs = uint256((supplyValueDelta < 0) ? -supplyValueDelta : supplyValueDelta);\n }\n\n supplyDelta = (supplyValueDeltaAbs * 1e18) / collateralAssetPrice;\n borrowsDelta = (supplyValueDeltaAbs * 1e18) / borrowedAssetPrice;\n\n if (up) {\n // stables to borrow = c * x\n borrowsDelta = (borrowsDelta * slippageFactor) / 1e18;\n } else {\n // amount to redeem = c * x\n supplyDelta = (supplyDelta * slippageFactor) / 1e18;\n }\n }\n\n /*----------------------------------------------------------------\n Internal Functions\n ----------------------------------------------------------------*/\n\n function _supplyCollateral(IERC20Upgradeable fundingAsset) internal returns (uint256 amountToSupply) {\n // in case the funding is with a different asset\n if (address(collateralAsset) != address(fundingAsset)) {\n // swap for collateral asset\n convertAllTo(fundingAsset, collateralAsset);\n }\n\n // supply the collateral\n amountToSupply = collateralAsset.balanceOf(address(this));\n collateralAsset.approve(address(collateralMarket), amountToSupply);\n uint256 errorCode = collateralMarket.mint(amountToSupply);\n if (errorCode != 0) revert SupplyCollateralFailed(errorCode);\n }\n\n // @dev flash loan the needed amount, then borrow stables and swap them for the amount needed to repay the FL\n function _leverUp(uint256 targetRatio) internal {\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n (uint256 flashLoanCollateralAmount, uint256 stableToBorrow) = _getSupplyAmountDelta(\n true,\n targetRatio,\n collateralAssetPrice,\n stableAssetPrice\n );\n\n collateralMarket.flash(flashLoanCollateralAmount, abi.encode(stableToBorrow));\n // the execution will first receive a callback to receiveFlashLoan()\n // then it continues from here\n\n // all stables are swapped for collateral to repay the FL\n uint256 collateralLeftovers = collateralAsset.balanceOf(address(this));\n if (collateralLeftovers > 0) {\n collateralAsset.approve(address(collateralMarket), collateralLeftovers);\n collateralMarket.mint(collateralLeftovers);\n }\n }\n\n // @dev supply the flash loaned collateral and then borrow stables with it\n function _leverUpPostFL(uint256 stableToBorrow) internal {\n // supply the flash loaned collateral\n _supplyCollateral(collateralAsset);\n\n // borrow stables that will be swapped to repay the FL\n uint256 errorCode = stableMarket.borrow(stableToBorrow);\n if (errorCode != 0) revert BorrowStableFailed(errorCode);\n\n // swap for the FL asset\n convertAllTo(stableAsset, collateralAsset);\n }\n\n // @dev redeems the supplied collateral by first repaying the debt with which it was levered\n function _leverDown(uint256 targetRatio) internal {\n uint256 amountToRedeem;\n uint256 borrowsToRepay;\n\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(collateralMarket);\n\n if (targetRatio <= 1e18) {\n // if max levering down, then derive the amount to redeem from the debt to be repaid\n borrowsToRepay = stableMarket.borrowBalanceCurrent(address(this));\n uint256 borrowsToRepayValueScaled = borrowsToRepay * stableAssetPrice;\n // accounting for swaps slippage\n uint256 assumedSlippage = factory.liquidatorsRegistry().getSlippage(collateralAsset, stableAsset);\n uint256 amountToRedeemValueScaled = (borrowsToRepayValueScaled * (10000 + assumedSlippage)) / 10000;\n amountToRedeem = amountToRedeemValueScaled / collateralAssetPrice;\n // round up when dividing in order to redeem enough (otherwise calcs could be exploited)\n if (amountToRedeemValueScaled % collateralAssetPrice > 0) amountToRedeem += 1;\n } else {\n // else derive the debt to be repaid from the amount to redeem\n (amountToRedeem, borrowsToRepay) = _getSupplyAmountDelta(\n false,\n targetRatio,\n collateralAssetPrice,\n stableAssetPrice\n );\n // the slippage is already accounted for in _getSupplyAmountDelta\n }\n\n if (borrowsToRepay > 0) {\n ICErc20(address(stableMarket)).flash(borrowsToRepay, abi.encode(amountToRedeem));\n // the execution will first receive a callback to receiveFlashLoan()\n // then it continues from here\n }\n\n // all the redeemed collateral is swapped for stables to repay the FL\n uint256 stableLeftovers = stableAsset.balanceOf(address(this));\n if (stableLeftovers > 0) {\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\n if (borrowBalance > 0) {\n // whatever is smaller\n uint256 amountToRepay = borrowBalance > stableLeftovers ? stableLeftovers : borrowBalance;\n stableAsset.approve(address(stableMarket), amountToRepay);\n stableMarket.repayBorrow(amountToRepay);\n }\n }\n }\n\n function _leverDownPostFL(uint256 _flashLoanedCollateral, uint256 _amountToRedeem) internal {\n // repay the borrows\n uint256 borrowBalance = stableMarket.borrowBalanceCurrent(address(this));\n uint256 repayAmount = _flashLoanedCollateral < borrowBalance ? _flashLoanedCollateral : borrowBalance;\n stableAsset.approve(address(stableMarket), repayAmount);\n uint256 errorCode = stableMarket.repayBorrow(repayAmount);\n if (errorCode != 0) revert RepayBorrowFailed(errorCode);\n\n // redeem the corresponding amount needed to repay the FL\n errorCode = collateralMarket.redeemUnderlying(_amountToRedeem);\n if (errorCode != 0) revert RedeemCollateralFailed(errorCode);\n\n // swap for the FL asset\n convertAllTo(collateralAsset, stableAsset);\n }\n\n function convertAllTo(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) private returns (uint256 outputAmount) {\n uint256 inputAmount = inputToken.balanceOf(address(this));\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = factory\n .getRedemptionStrategies(inputToken, outputToken);\n\n if (redemptionStrategies.length == 0) revert ConvertFundsFailed();\n\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\n bytes memory strategyData = strategiesData[i];\n (outputToken, outputAmount) = convertCustomFunds(inputToken, inputAmount, redemptionStrategy, strategyData);\n inputAmount = outputAmount;\n inputToken = outputToken;\n }\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { DiamondBase, DiamondExtension, LibDiamond } from \"../../ionic/DiamondExtension.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactory is LeveredPositionFactoryStorage, DiamondBase {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /*----------------------------------------------------------------\n Constructor\n ----------------------------------------------------------------*/\n\n constructor(IFeeDistributor _feeDistributor, ILiquidatorsRegistry _registry, uint256 _blocksPerYear) {\n feeDistributor = _feeDistributor;\n liquidatorsRegistry = _registry;\n blocksPerYear = _blocksPerYear;\n }\n\n /*----------------------------------------------------------------\n Admin Functions\n ----------------------------------------------------------------*/\n\n function _setPairWhitelisted(ICErc20 _collateralMarket, ICErc20 _stableMarket, bool _whitelisted) external onlyOwner {\n require(_collateralMarket.comptroller() == _stableMarket.comptroller(), \"markets not of the same pool\");\n\n if (_whitelisted) {\n collateralMarkets.add(address(_collateralMarket));\n borrowableMarketsByCollateral[_collateralMarket].add(address(_stableMarket));\n } else {\n borrowableMarketsByCollateral[_collateralMarket].remove(address(_stableMarket));\n if (borrowableMarketsByCollateral[_collateralMarket].length() == 0)\n collateralMarkets.remove(address(_collateralMarket));\n }\n }\n\n function _setLiquidatorsRegistry(ILiquidatorsRegistry _liquidatorsRegistry) external onlyOwner {\n liquidatorsRegistry = _liquidatorsRegistry;\n }\n\n function _registerExtension(\n DiamondExtension extensionToAdd,\n DiamondExtension extensionToReplace\n ) public override onlyOwner {\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryFirstExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { ILeveredPositionFactoryFirstExtension } from \"./ILeveredPositionFactory.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactoryFirstExtension is\n LeveredPositionFactoryStorage,\n DiamondExtension,\n ILeveredPositionFactoryFirstExtension\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n error PairNotWhitelisted();\n error NoSuchPosition();\n error PositionNotClosed();\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 10;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.removeClosedPosition.selector;\n functionSelectors[--fnsCount] = this.closeAndRemoveUserPosition.selector;\n functionSelectors[--fnsCount] = this.getMinBorrowNative.selector;\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.getBorrowableMarketsByCollateral.selector;\n functionSelectors[--fnsCount] = this.getWhitelistedCollateralMarkets.selector;\n functionSelectors[--fnsCount] = this.getAccountsWithOpenPositions.selector;\n functionSelectors[--fnsCount] = this.getPositionsByAccount.selector;\n functionSelectors[--fnsCount] = this.getPositionsExtension.selector;\n functionSelectors[--fnsCount] = this._setPositionsExtension.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n // @return true if removed, otherwise false\n function removeClosedPosition(address closedPosition) external returns (bool) {\n return _removeClosedPosition(closedPosition, msg.sender);\n }\n\n function closeAndRemoveUserPosition(LeveredPosition position) external onlyOwner returns (bool) {\n address positionOwner = position.positionOwner();\n position.closePosition(positionOwner);\n return _removeClosedPosition(address(position), positionOwner);\n }\n\n function _removeClosedPosition(address closedPosition, address positionOwner) internal returns (bool removed) {\n EnumerableSet.AddressSet storage userPositions = positionsByAccount[positionOwner];\n if (!userPositions.contains(closedPosition)) revert NoSuchPosition();\n if (!LeveredPosition(closedPosition).isPositionClosed()) revert PositionNotClosed();\n\n removed = userPositions.remove(closedPosition);\n if (userPositions.length() == 0) accountsWithOpenPositions.remove(positionOwner);\n }\n\n function _setPositionsExtension(bytes4 msgSig, address extension) external onlyOwner {\n _positionsExtensions[msgSig] = extension;\n }\n\n /*----------------------------------------------------------------\n View Functions\n ----------------------------------------------------------------*/\n\n function getMinBorrowNative() external view returns (uint256) {\n return feeDistributor.minBorrowEth();\n }\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\n return liquidatorsRegistry.getRedemptionStrategies(inputToken, outputToken);\n }\n\n function getPositionsByAccount(\n address account\n ) external view returns (address[] memory positions, bool[] memory closed) {\n positions = positionsByAccount[account].values();\n closed = new bool[](positions.length);\n for (uint256 i = 0; i < positions.length; i++) {\n closed[i] = LeveredPosition(positions[i]).isPositionClosed();\n }\n }\n\n function getAccountsWithOpenPositions() external view returns (address[] memory) {\n return accountsWithOpenPositions.values();\n }\n\n function getWhitelistedCollateralMarkets() external view returns (address[] memory) {\n return collateralMarkets.values();\n }\n\n function getBorrowableMarketsByCollateral(ICErc20 _collateralMarket) external view returns (address[] memory) {\n return borrowableMarketsByCollateral[_collateralMarket].values();\n }\n\n function getPositionsExtension(bytes4 msgSig) external view returns (address) {\n return _positionsExtensions[msgSig];\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactorySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport { LeveredPositionFactoryStorage } from \"./LeveredPositionFactoryStorage.sol\";\nimport { ILeveredPositionFactorySecondExtension } from \"./ILeveredPositionFactory.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { IComptroller, IPriceOracle } from \"../../external/compound/IComptroller.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { AuthoritiesRegistry } from \"../AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../PoolRolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract LeveredPositionFactorySecondExtension is\n LeveredPositionFactoryStorage,\n DiamondExtension,\n ILeveredPositionFactorySecondExtension\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n error PairNotWhitelisted();\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 3;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.createPosition.selector;\n functionSelectors[--fnsCount] = this.createAndFundPosition.selector;\n functionSelectors[--fnsCount] = this.createAndFundPositionAtRatio.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*----------------------------------------------------------------\n Mutable Functions\n ----------------------------------------------------------------*/\n\n function createPosition(ICErc20 _collateralMarket, ICErc20 _stableMarket) public returns (LeveredPosition) {\n if (!borrowableMarketsByCollateral[_collateralMarket].contains(address(_stableMarket))) revert PairNotWhitelisted();\n\n LeveredPosition position = new LeveredPosition(msg.sender, _collateralMarket, _stableMarket);\n\n accountsWithOpenPositions.add(msg.sender);\n positionsByAccount[msg.sender].add(address(position));\n\n AuthoritiesRegistry authoritiesRegistry = feeDistributor.authoritiesRegistry();\n address poolAddress = address(_collateralMarket.comptroller());\n PoolRolesAuthority poolAuth = authoritiesRegistry.poolsAuthorities(poolAddress);\n if (address(poolAuth) != address(0)) {\n authoritiesRegistry.setUserRole(poolAddress, address(position), poolAuth.LEVERED_POSITION_ROLE(), true);\n }\n\n return position;\n }\n\n function createAndFundPosition(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount\n ) public returns (LeveredPosition) {\n LeveredPosition position = createPosition(_collateralMarket, _stableMarket);\n _fundingAsset.safeTransferFrom(msg.sender, address(this), _fundingAmount);\n _fundingAsset.approve(address(position), _fundingAmount);\n position.fundPosition(_fundingAsset, _fundingAmount);\n return position;\n }\n\n function createAndFundPositionAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n IERC20Upgradeable _fundingAsset,\n uint256 _fundingAmount,\n uint256 _leverageRatio\n ) external returns (LeveredPosition) {\n LeveredPosition position = createAndFundPosition(_collateralMarket, _stableMarket, _fundingAsset, _fundingAmount);\n if (_leverageRatio > 1e18) {\n position.adjustLeverageRatio(_leverageRatio);\n }\n return position;\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionFactoryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\nimport { IFeeDistributor } from \"../../compound/IFeeDistributor.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nabstract contract LeveredPositionFactoryStorage is SafeOwnable {\n EnumerableSet.AddressSet internal accountsWithOpenPositions;\n mapping(address => EnumerableSet.AddressSet) internal positionsByAccount;\n EnumerableSet.AddressSet internal collateralMarkets;\n mapping(ICErc20 => EnumerableSet.AddressSet) internal borrowableMarketsByCollateral;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) private __unused;\n\n IFeeDistributor public feeDistributor;\n ILiquidatorsRegistry public liquidatorsRegistry;\n uint256 public blocksPerYear;\n\n mapping(bytes4 => address) internal _positionsExtensions;\n}\n" + }, + "contracts/ionic/levered/LeveredPositionsLens.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { LeveredPosition } from \"./LeveredPosition.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\ncontract LeveredPositionsLens is Initializable {\n ILeveredPositionFactory public factory;\n\n function initialize(ILeveredPositionFactory _factory) external initializer {\n factory = _factory;\n }\n\n function reinitialize(ILeveredPositionFactory _factory) external reinitializer(2) {\n factory = _factory;\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns lists of the market addresses, names and symbols of the underlying assets of those collateral markets that are whitelisted\n function getCollateralMarkets()\n external\n view\n returns (\n address[] memory markets,\n IonicComptroller[] memory poolOfMarket,\n address[] memory underlyings,\n uint256[] memory underlyingPrices,\n string[] memory names,\n string[] memory symbols,\n uint8[] memory decimals,\n uint256[] memory totalUnderlyingSupplied,\n uint256[] memory ratesPerBlock\n )\n {\n markets = factory.getWhitelistedCollateralMarkets();\n poolOfMarket = new IonicComptroller[](markets.length);\n underlyings = new address[](markets.length);\n underlyingPrices = new uint256[](markets.length);\n names = new string[](markets.length);\n symbols = new string[](markets.length);\n totalUnderlyingSupplied = new uint256[](markets.length);\n decimals = new uint8[](markets.length);\n ratesPerBlock = new uint256[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = ICErc20(markets[i]);\n poolOfMarket[i] = market.comptroller();\n underlyingPrices[i] = BasePriceOracle(poolOfMarket[i].oracle()).getUnderlyingPrice(market);\n underlyings[i] = market.underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyings[i]);\n names[i] = underlying.name();\n symbols[i] = underlying.symbol();\n decimals[i] = underlying.decimals();\n totalUnderlyingSupplied[i] = market.getTotalUnderlyingSupplied();\n ratesPerBlock[i] = market.supplyRatePerBlock();\n }\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns the Rate for the chosen borrowable at the specified leverage ratio and supply amount\n function getBorrowRateAtRatio(\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n uint256 _equityAmount,\n uint256 _targetLeverageRatio\n ) external view returns (uint256) {\n IonicComptroller pool = IonicComptroller(_stableMarket.comptroller());\n BasePriceOracle oracle = pool.oracle();\n uint256 stableAssetPrice = oracle.getUnderlyingPrice(_stableMarket);\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\n\n uint256 borrowAmount = ((_targetLeverageRatio - 1e18) * _equityAmount * collateralAssetPrice) /\n (stableAssetPrice * 1e18);\n return _stableMarket.borrowRatePerBlockAfterBorrow(borrowAmount) * factory.blocksPerYear();\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n /// @dev returns lists of the market addresses, names, symbols and the current Rate for each Borrowable asset\n function getBorrowableMarketsAndRates(\n ICErc20 _collateralMarket\n )\n external\n view\n returns (\n address[] memory markets,\n address[] memory underlyings,\n uint256[] memory underlyingsPrices,\n string[] memory names,\n string[] memory symbols,\n uint256[] memory rates,\n uint8[] memory decimals\n )\n {\n markets = factory.getBorrowableMarketsByCollateral(_collateralMarket);\n underlyings = new address[](markets.length);\n names = new string[](markets.length);\n symbols = new string[](markets.length);\n rates = new uint256[](markets.length);\n decimals = new uint8[](markets.length);\n underlyingsPrices = new uint256[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = ICErc20(markets[i]);\n address underlyingAddress = market.underlying();\n underlyings[i] = underlyingAddress;\n ERC20Upgradeable underlying = ERC20Upgradeable(underlyingAddress);\n names[i] = underlying.name();\n symbols[i] = underlying.symbol();\n rates[i] = market.borrowRatePerBlock();\n decimals[i] = underlying.decimals();\n underlyingsPrices[i] = market.comptroller().oracle().getUnderlyingPrice(market);\n }\n }\n\n /// @notice this is a lens fn, it is not intended to be used on-chain\n function getNetAPY(\n uint256 _supplyAPY,\n uint256 _supplyAmount,\n ICErc20 _collateralMarket,\n ICErc20 _stableMarket,\n uint256 _targetLeverageRatio\n ) public view returns (int256 netAPY) {\n if (_supplyAmount == 0 || _targetLeverageRatio <= 1e18) return 0;\n\n IonicComptroller pool = IonicComptroller(_collateralMarket.comptroller());\n BasePriceOracle oracle = pool.oracle();\n // TODO the calcs can be implemented without using collateralAssetPrice\n uint256 collateralAssetPrice = oracle.getUnderlyingPrice(_collateralMarket);\n\n // total collateral = base collateral + levered collateral\n uint256 totalCollateral = (_supplyAmount * _targetLeverageRatio) / 1e18;\n uint256 yieldFromTotalSupplyScaled = _supplyAPY * totalCollateral;\n int256 yieldValueScaled = int256((yieldFromTotalSupplyScaled * collateralAssetPrice) / 1e18);\n\n uint256 borrowedValueScaled = (totalCollateral - _supplyAmount) * collateralAssetPrice;\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\n int256 borrowInterestValueScaled = int256((_borrowRate * borrowedValueScaled) / 1e18);\n\n int256 netValueDiffScaled = yieldValueScaled - borrowInterestValueScaled;\n\n netAPY = ((netValueDiffScaled / int256(collateralAssetPrice)) * 1e18) / int256(_supplyAmount);\n }\n\n function getPositionsInfo(\n LeveredPosition[] calldata positions,\n uint256[] calldata supplyApys\n ) external view returns (PositionInfo[] memory infos) {\n infos = new PositionInfo[](positions.length);\n for (uint256 i = 0; i < positions.length; i++) {\n infos[i] = getPositionInfo(positions[i], supplyApys[i]);\n }\n }\n\n function getLeverageRatioAfterFunding(LeveredPosition pos, uint256 newFunding) public view returns (uint256) {\n uint256 equityAmount = pos.getEquityAmount();\n if (equityAmount == 0 && newFunding == 0) return 0;\n\n uint256 suppliedCollateralCurrent = pos.collateralMarket().balanceOfUnderlying(address(pos));\n return ((suppliedCollateralCurrent + newFunding) * 1e18) / (equityAmount + newFunding);\n }\n\n function getNetApyForPositionAfterFunding(\n LeveredPosition pos,\n uint256 supplyAPY,\n uint256 newFunding\n ) public view returns (int256) {\n return\n getNetAPY(\n supplyAPY,\n pos.getEquityAmount() + newFunding,\n pos.collateralMarket(),\n pos.stableMarket(),\n getLeverageRatioAfterFunding(pos, newFunding)\n );\n }\n\n function getNetApyForPosition(LeveredPosition pos, uint256 supplyAPY) public view returns (int256) {\n return getNetApyForPositionAfterFunding(pos, supplyAPY, 0);\n }\n\n struct PositionInfo {\n uint256 collateralAssetPrice;\n uint256 borrowedAssetPrice;\n uint256 positionSupplyAmount;\n uint256 positionValue;\n uint256 debtAmount;\n uint256 debtValue;\n uint256 equityAmount;\n uint256 equityValue;\n int256 currentApy;\n uint256 debtRatio;\n uint256 liquidationThreshold;\n uint256 safetyBuffer;\n }\n\n function getPositionInfo(LeveredPosition pos, uint256 supplyApy) public view returns (PositionInfo memory info) {\n ICErc20 collateralMarket = pos.collateralMarket();\n IonicComptroller pool = pos.pool();\n info.collateralAssetPrice = pool.oracle().getUnderlyingPrice(collateralMarket);\n {\n info.positionSupplyAmount = collateralMarket.balanceOfUnderlying(address(pos));\n info.positionValue = (info.collateralAssetPrice * info.positionSupplyAmount) / 1e18;\n info.currentApy = getNetApyForPosition(pos, supplyApy);\n }\n\n {\n ICErc20 stableMarket = pos.stableMarket();\n info.borrowedAssetPrice = pool.oracle().getUnderlyingPrice(stableMarket);\n info.debtAmount = stableMarket.borrowBalanceCurrent(address(pos));\n info.debtValue = (info.borrowedAssetPrice * info.debtAmount) / 1e18;\n info.equityValue = info.positionValue - info.debtValue;\n info.debtRatio = info.positionValue == 0 ? 0 : (info.debtValue * 1e18) / info.positionValue;\n info.equityAmount = (info.equityValue * 1e18) / info.collateralAssetPrice;\n }\n\n {\n (, uint256 collateralFactor) = pool.markets(address(collateralMarket));\n info.liquidationThreshold = collateralFactor;\n info.safetyBuffer = collateralFactor - info.debtRatio;\n }\n }\n}\n" + }, + "contracts/ionic/levered/LeveredPositionStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { ILeveredPositionFactory } from \"./ILeveredPositionFactory.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract LeveredPositionStorage {\n address public immutable positionOwner;\n ILeveredPositionFactory public factory;\n\n ICErc20 public collateralMarket;\n ICErc20 public stableMarket;\n IonicComptroller public pool;\n\n IERC20Upgradeable public collateralAsset;\n IERC20Upgradeable public stableAsset;\n\n constructor(address _positionOwner) {\n positionOwner = _positionOwner;\n }\n}\n" + }, + "contracts/ionic/MorphoBribeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IBribeRewards } from \"../veION/interfaces/IBribeRewards.sol\";\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { OwnableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\n/**\n * @title MorphoBribeDistributor\n * @dev This contract handles the distribution of bribe tokens to the Morpho protocol.\n */\ncontract MorphoBribeDistributor is OwnableUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Address of the Morpho market\n address public morphoMarket;\n /// @notice Address of the Morpho bribes contract\n address public morphoBribes;\n\n event Initialized(address indexed morphoMarket, address indexed morphoBribes);\n event Distributed(address indexed from, uint256 amount);\n event MorphoMarketSet(address indexed newMorphoMarket);\n event MorphoBribesSet(address indexed newMorphoBribes);\n event BribeTokenSet(address indexed newBribeToken);\n\n /**\n * @dev Modifier to restrict access to only the Morpho market\n */\n modifier onlyMorphoMarket() {\n require(msg.sender == morphoMarket, \"Caller is not the Morpho Market\");\n _;\n }\n\n /**\n * @notice Initializes the MorphoBribeDistributor contract\n * @param _morphoMarket Address of the Morpho market\n * @param _morphoBribes Address of the Morpho bribes contract\n */\n function initialize(address _morphoMarket, address _morphoBribes) public initializer {\n __Ownable_init();\n morphoMarket = _morphoMarket;\n morphoBribes = _morphoBribes;\n emit Initialized(_morphoMarket, _morphoBribes);\n }\n\n /**\n * @notice Distributes bribe tokens to the Morpho bribes contract\n * @param _amount Amount of tokens to distribute\n */\n function distribute(address _rewardToken, uint256 _amount) external onlyMorphoMarket {\n IERC20(_rewardToken).safeTransferFrom(msg.sender, address(this), _amount);\n IERC20(_rewardToken).approve(morphoBribes, _amount);\n IBribeRewards(morphoBribes).notifyRewardAmount(_rewardToken, _amount);\n emit Distributed(msg.sender, _amount);\n }\n\n /**\n * @notice Sets the address of the Morpho market\n * @param _morphoMarket New address of the Morpho market\n */\n function setMorphoMarket(address _morphoMarket) external onlyOwner {\n morphoMarket = _morphoMarket;\n emit MorphoMarketSet(_morphoMarket);\n }\n\n /**\n * @notice Sets the address of the Morpho bribes contract\n * @param _morphoBribes New address of the Morpho bribes contract\n */\n function setMorphoBribes(address _morphoBribes) external onlyOwner {\n morphoBribes = _morphoBribes;\n emit MorphoBribesSet(_morphoBribes);\n }\n}\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\n\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\n constructor() RolesAuthority(address(0), Authority(address(0))) {\n _disableInitializers();\n }\n\n function initialize(address _owner) public initializer {\n owner = _owner;\n authority = this;\n }\n\n // up to 256 roles\n uint8 public constant REGISTRY_ROLE = 0;\n uint8 public constant SUPPLIER_ROLE = 1;\n uint8 public constant BORROWER_ROLE = 2;\n uint8 public constant LIQUIDATOR_ROLE = 3;\n uint8 public constant LEVERED_POSITION_ROLE = 4;\n\n function configureRegistryCapabilities() external requiresAuth {\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\n true\n );\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\n }\n\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, true);\n }\n\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, false);\n }\n\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\n }\n }\n }\n\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\n }\n\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\n uint8 fnsCount = 6;\n selectors = new bytes4[](fnsCount);\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return selectors;\n }\n\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\n }\n }\n }\n\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, true);\n }\n\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, false);\n }\n\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\n }\n }\n\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n // borrowers have the SUPPLIER_ROLE capabilities by default\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n // TODO this leaves redeeming open for everyone\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\n\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n}\n" + }, + "contracts/ionic/SafeOwnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\nabstract contract SafeOwnable is Ownable2Step {\n function renounceOwnership() public override onlyOwner {\n revert(\"renounce ownership not allowed\");\n }\n}\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\n/**\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\n * that will shift the other.\n */\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\n /**\n * @notice Pending owner of this contract\n */\n address public pendingOwner;\n\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\n __Ownable_init();\n _transferOwnership(owner_);\n }\n\n struct AddressSlot {\n address value;\n }\n\n modifier onlyOwnerOrAdmin() {\n bool isOwner = owner() == _msgSender();\n if (!isOwner) {\n address admin = _getProxyAdmin();\n bool isAdmin = admin == _msgSender();\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\n }\n _;\n }\n\n /**\n * @notice Emitted when pendingOwner is changed\n */\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\n\n /**\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\n */\n event NewOwner(address oldOwner, address newOwner);\n\n /**\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @param newPendingOwner New pending owner.\n */\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\n // Save current value, if any, for inclusion in log\n address oldPendingOwner = pendingOwner;\n\n // Store pendingOwner with value newPendingOwner\n pendingOwner = newPendingOwner;\n\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\n }\n\n /**\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\n * @dev Owner function for pending owner to accept role and update owner\n */\n function _acceptOwner() public {\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\n require(msg.sender == pendingOwner, \"not the pending owner\");\n\n // Save current values for inclusion in log\n address oldOwner = owner();\n address oldPendingOwner = pendingOwner;\n\n // Store owner with value pendingOwner\n _transferOwnership(pendingOwner);\n\n // Clear the pending value\n pendingOwner = address(0);\n\n emit NewOwner(oldOwner, pendingOwner);\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\n }\n\n function renounceOwnership() public override onlyOwner {\n // do not remove this overriding fn\n revert(\"not used anymore\");\n }\n\n function transferOwnership(address newOwner) public override onlyOwner {\n emit NewPendingOwner(pendingOwner, newOwner);\n pendingOwner = newOwner;\n }\n\n function _getProxyAdmin() internal view returns (address admin) {\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n AddressSlot storage adminSlot;\n assembly {\n adminSlot.slot := _ADMIN_SLOT\n }\n admin = adminSlot.value;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\n/**\n @title Balance Booster Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\n \n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\n\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\n*/\ninterface IFlywheelBooster {\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256);\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ninterface IIonicFlywheel {\n function isRewardsDistributor() external returns (bool);\n\n function isFlywheel() external returns (bool);\n\n function flywheelPreSupplierAction(address market, address supplier) external;\n\n function flywheelPostSupplierAction(address market, address supplier) external;\n\n function flywheelPreBorrowerAction(address market, address borrower) external;\n\n function flywheelPostBorrowerAction(address market, address borrower) external;\n\n function flywheelPreTransferAction(address market, address src, address dst) external;\n\n function flywheelPostTransferAction(address market, address src, address dst) external;\n\n function compAccrued(address user) external view returns (uint256);\n\n function addMarketForRewards(ERC20 strategy) external;\n\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\n/**\n @title Balance Booster Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Booster module is an optional module for virtually boosting or otherwise transforming user balances. \n If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.\n \n Boosting logic can be associated with referrals, vote-escrow, or other strategies.\n\n SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.\n This prevents gaming of the reward calculation function by using manipulated balances when accruing.\n*/\ninterface IIonicFlywheelBorrowBooster {\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256);\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256);\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport \"./IIonicFlywheel.sol\";\n\ncontract IonicFlywheel is IonicFlywheelCore, IIonicFlywheel {\n bool public constant isRewardsDistributor = true;\n bool public constant isFlywheel = true;\n\n function flywheelPreSupplierAction(address market, address supplier) external {\n accrue(ERC20(market), supplier);\n }\n\n function flywheelPostSupplierAction(address market, address supplier) external {\n _updateBlacklistBalances(ERC20(market), supplier);\n }\n\n function flywheelPreBorrowerAction(address market, address borrower) external {}\n\n function flywheelPostBorrowerAction(address market, address borrower) external {}\n\n function flywheelPreTransferAction(address market, address src, address dst) external {\n accrue(ERC20(market), src, dst);\n }\n\n function flywheelPostTransferAction(address market, address src, address dst) external {\n _updateBlacklistBalances(ERC20(market), src);\n _updateBlacklistBalances(ERC20(market), dst);\n }\n\n function compAccrued(address user) external view returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrow.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport \"./IIonicFlywheel.sol\";\n\ncontract IonicFlywheelBorrow is IonicFlywheelCore, IIonicFlywheel {\n bool public constant isRewardsDistributor = true;\n bool public constant isFlywheel = true;\n\n function flywheelPreSupplierAction(address market, address supplier) external {}\n\n function flywheelPostSupplierAction(address market, address supplier) external {}\n\n function flywheelPreBorrowerAction(address market, address borrower) external {\n accrue(ERC20(market), borrower);\n }\n\n function flywheelPostBorrowerAction(address market, address borrower) external {\n _updateBlacklistBalances(ERC20(market), borrower);\n }\n\n function flywheelPreTransferAction(address market, address src, address dst) external {}\n\n function flywheelPostTransferAction(address market, address src, address dst) external {}\n\n function compAccrued(address user) external view returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function addMarketForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function marketState(ERC20 strategy) external view returns (uint224, uint32) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport \"./IIonicFlywheelBorrowBooster.sol\";\n\ncontract IonicFlywheelBorrowBooster is IIonicFlywheelBorrowBooster {\n string public constant BOOSTER_TYPE = \"FlywheelBorrowBooster\";\n\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ICErc20 strategy) external view returns (uint256) {\n return strategy.totalBorrows();\n }\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ICErc20 strategy, address user) external view returns (uint256) {\n return strategy.borrowBalanceCurrent(user);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\nimport { SafeCastLib } from \"solmate/utils/SafeCastLib.sol\";\n\nimport { IFlywheelRewards } from \"./rewards/IFlywheelRewards.sol\";\nimport { IFlywheelBooster } from \"./IFlywheelBooster.sol\";\nimport { IEmissionsManager } from \"../../../IEmissionsManager.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\n\ncontract IonicFlywheelCore is Ownable2StepUpgradeable {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n /// @notice How much rewardsToken will be send to treasury\n uint256 public performanceFee;\n\n /// @notice Address that gets rewardsToken accrued by performanceFee\n address public feeRecipient;\n\n /// @notice The token to reward\n ERC20 public rewardToken;\n\n /// @notice append-only list of strategies added\n ERC20[] public allStrategies;\n\n /// @notice the rewards contract for managing streams\n IFlywheelRewards public flywheelRewards;\n\n /// @notice optional booster module for calculating virtual balances on strategies\n IFlywheelBooster public flywheelBooster;\n\n IEmissionsManager public emissionsManager;\n\n /// @notice The accrued but not yet transferred rewards for each user\n mapping(address => uint256) internal _rewardsAccrued;\n\n /// @notice The strategy index and last updated per strategy\n mapping(ERC20 => RewardsState) internal _strategyState;\n\n /// @notice user index per strategy\n mapping(ERC20 => mapping(address => uint224)) internal _userIndex;\n\n /// @notice user blacklisted supply per strategy\n mapping(ERC20 => mapping(address => uint256)) public userBlacklistedSupply;\n\n /// @notice blacklisted supply per strategy\n mapping(ERC20 => uint256) public blacklistedSupply;\n\n modifier onlyEmissionsManager() {\n require(address(emissionsManager) == msg.sender, \"!emissionsManager\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize(\n ERC20 _rewardToken,\n IFlywheelRewards _flywheelRewards,\n IFlywheelBooster _flywheelBooster,\n address _owner\n ) public initializer {\n __Ownable2Step_init();\n\n rewardToken = _rewardToken;\n flywheelRewards = _flywheelRewards;\n flywheelBooster = _flywheelBooster;\n\n performanceFee = 10e16; // 10%\n feeRecipient = _owner;\n }\n\n /*----------------------------------------------------------------\n ACCRUE/CLAIM LOGIC\n ----------------------------------------------------------------*/\n\n /** \n @notice Emitted when a user's rewards accrue to a given strategy.\n @param strategy the updated rewards strategy\n @param user the user of the rewards\n @param rewardsDelta how many new rewards accrued to the user\n @param rewardsIndex the market index for rewards per token accrued\n */\n event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);\n\n /** \n @notice Emitted when a user claims accrued rewards.\n @param user the user of the rewards\n @param amount the amount of rewards claimed\n */\n event ClaimRewards(address indexed user, uint256 amount);\n\n /** \n @notice accrue rewards for a single user on a strategy\n @param strategy the strategy to accrue a user's rewards on\n @param user the user to be accrued\n @return the cumulative amount of rewards accrued to user (including prior)\n */\n function accrue(ERC20 strategy, address user) public returns (uint256) {\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n\n if (state.index == 0) return 0;\n\n state = accrueStrategy(strategy, state);\n return accrueUser(strategy, user, state);\n }\n\n /** \n @notice accrue rewards for a two users on a strategy\n @param strategy the strategy to accrue a user's rewards on\n @param user the first user to be accrued\n @param user the second user to be accrued\n @return the cumulative amount of rewards accrued to the first user (including prior)\n @return the cumulative amount of rewards accrued to the second user (including prior)\n */\n function accrue(ERC20 strategy, address user, address secondUser) public returns (uint256, uint256) {\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n\n if (state.index == 0) return (0, 0);\n\n state = accrueStrategy(strategy, state);\n return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));\n }\n\n /** \n @notice claim rewards for a given user\n @param user the user claiming rewards\n @dev this function is public, and all rewards transfer to the user\n */\n function claimRewards(address user) external {\n require(!emissionsManager.isUserBlacklisted(user), \"blacklisted\");\n require(!emissionsManager.isUserBlacklistable(user), \"blacklistable\");\n uint256 accrued = rewardsAccrued(user);\n\n if (accrued != 0) {\n _rewardsAccrued[user] = 0;\n\n rewardToken.safeTransferFrom(address(flywheelRewards), user, accrued);\n\n emit ClaimRewards(user, accrued);\n }\n }\n\n /** \n @notice take rewards for a given user\n @param user the user claiming rewards\n @param receiver the address that receives the rewards\n @dev this function is public, and all rewards transfer to the receiver\n */\n function takeRewardsFromUser(address user, address receiver) external onlyEmissionsManager {\n uint256 accrued = rewardsAccrued(user);\n\n if (accrued != 0) {\n _rewardsAccrued[user] = 0;\n\n rewardToken.safeTransferFrom(address(flywheelRewards), receiver, accrued);\n\n emit ClaimRewards(user, accrued);\n }\n }\n\n /** \n @notice set user balances to zero\n @param strategy strategy to whitelist user for\n @param user the user to be whitelisted\n @dev this function is public, and all user and strategy blacklisted supplies are reset\n */\n function whitelistUser(ERC20 strategy, address user) external onlyEmissionsManager {\n blacklistedSupply[strategy] -= userBlacklistedSupply[strategy][user];\n userBlacklistedSupply[strategy][user] = 0;\n (uint224 index, uint32 ts) = strategyState(strategy);\n RewardsState memory state = RewardsState(index, ts);\n state = accrueStrategy(strategy, state);\n _userIndex[strategy][user] = state.index;\n }\n\n /** \n @notice update user blacklisted balances\n @param strategy strategy to update blacklisted balances\n @param user the user to be blacklisted\n @dev this function is public\n */\n function updateBlacklistBalances(ERC20 strategy, address user) external onlyEmissionsManager {\n _updateBlacklistBalances(strategy, user);\n }\n\n /** \n @notice update user blacklisted balances\n @param strategy strategy to update blacklisted balances\n @param user the user to be blacklisted\n @dev this function is private\n */\n function _updateBlacklistBalances(ERC20 strategy, address user) internal {\n if (emissionsManager.isUserBlacklisted(user)) {\n uint256 _oldUserBlacklistedSupply = userBlacklistedSupply[strategy][user];\n uint256 supplierTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedBalanceOf(ERC20(strategy), user)\n : ERC20(strategy).balanceOf(user);\n\n if (supplierTokens >= _oldUserBlacklistedSupply) {\n blacklistedSupply[strategy] += supplierTokens - _oldUserBlacklistedSupply;\n userBlacklistedSupply[strategy][user] = supplierTokens;\n } else {\n blacklistedSupply[strategy] -= _oldUserBlacklistedSupply - supplierTokens;\n userBlacklistedSupply[strategy][user] = supplierTokens;\n }\n }\n }\n /*----------------------------------------------------------------\n ADMIN LOGIC\n ----------------------------------------------------------------*/\n\n /** \n @notice Emitted when a new strategy is added to flywheel by the admin\n @param newStrategy the new added strategy\n */\n event AddStrategy(address indexed newStrategy);\n\n /// @notice initialize a new strategy\n function setEmissionsManager(IEmissionsManager _emissionsManager) external onlyOwner {\n emissionsManager = _emissionsManager;\n }\n\n /// @notice initialize a new strategy\n function addStrategyForRewards(ERC20 strategy) external onlyOwner {\n _addStrategyForRewards(strategy);\n }\n\n function _addStrategyForRewards(ERC20 strategy) internal {\n (uint224 index, ) = strategyState(strategy);\n require(index == 0, \"strategy\");\n _strategyState[strategy] = RewardsState({\n index: (10 ** rewardToken.decimals()).safeCastTo224(),\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\n });\n\n allStrategies.push(strategy);\n emit AddStrategy(address(strategy));\n }\n\n function getAllStrategies() external view returns (ERC20[] memory) {\n return allStrategies;\n }\n\n /** \n @notice Emitted when the rewards module changes\n @param newFlywheelRewards the new rewards module\n */\n event FlywheelRewardsUpdate(address indexed newFlywheelRewards);\n\n /// @notice swap out the flywheel rewards contract\n function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external onlyOwner {\n if (address(flywheelRewards) != address(0)) {\n uint256 oldRewardBalance = rewardToken.balanceOf(address(flywheelRewards));\n if (oldRewardBalance > 0) {\n rewardToken.safeTransferFrom(address(flywheelRewards), address(newFlywheelRewards), oldRewardBalance);\n }\n }\n\n flywheelRewards = newFlywheelRewards;\n\n emit FlywheelRewardsUpdate(address(newFlywheelRewards));\n }\n\n /** \n @notice Emitted when the booster module changes\n @param newBooster the new booster module\n */\n event FlywheelBoosterUpdate(address indexed newBooster);\n\n /// @notice swap out the flywheel booster contract\n function setBooster(IFlywheelBooster newBooster) external onlyOwner {\n flywheelBooster = newBooster;\n\n emit FlywheelBoosterUpdate(address(newBooster));\n }\n\n event UpdatedFeeSettings(\n uint256 oldPerformanceFee,\n uint256 newPerformanceFee,\n address oldFeeRecipient,\n address newFeeRecipient\n );\n\n /**\n * @notice Update performanceFee and/or feeRecipient\n * @dev Claim rewards first from the previous feeRecipient before changing it\n */\n function updateFeeSettings(uint256 _performanceFee, address _feeRecipient) external onlyOwner {\n _updateFeeSettings(_performanceFee, _feeRecipient);\n }\n\n function _updateFeeSettings(uint256 _performanceFee, address _feeRecipient) internal {\n emit UpdatedFeeSettings(performanceFee, _performanceFee, feeRecipient, _feeRecipient);\n\n if (feeRecipient != _feeRecipient) {\n _rewardsAccrued[_feeRecipient] += rewardsAccrued(feeRecipient);\n _rewardsAccrued[feeRecipient] = 0;\n }\n performanceFee = _performanceFee;\n feeRecipient = _feeRecipient;\n }\n\n /*----------------------------------------------------------------\n INTERNAL ACCOUNTING LOGIC\n ----------------------------------------------------------------*/\n\n struct RewardsState {\n /// @notice The strategy's last updated index\n uint224 index;\n /// @notice The timestamp the index was last updated at\n uint32 lastUpdatedTimestamp;\n }\n\n /// @notice accumulate global rewards on a strategy\n function accrueStrategy(\n ERC20 strategy,\n RewardsState memory state\n ) private returns (RewardsState memory rewardsState) {\n // calculate accrued rewards through module\n uint256 strategyRewardsAccrued = flywheelRewards.getAccruedRewards(strategy, state.lastUpdatedTimestamp);\n\n rewardsState = state;\n\n if (strategyRewardsAccrued > 0) {\n // use the booster or token supply to calculate reward index denominator\n uint256 supplyTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedTotalSupply(strategy) - blacklistedSupply[strategy]\n : strategy.totalSupply() - blacklistedSupply[strategy];\n\n // 100% = 100e16\n uint256 accruedFees = (strategyRewardsAccrued * performanceFee) / uint224(100e16);\n\n _rewardsAccrued[feeRecipient] += accruedFees;\n strategyRewardsAccrued -= accruedFees;\n\n uint224 deltaIndex;\n\n if (supplyTokens != 0)\n deltaIndex = ((strategyRewardsAccrued * (10 ** strategy.decimals())) / supplyTokens).safeCastTo224();\n\n // accumulate rewards per token onto the index, multiplied by fixed-point factor\n rewardsState = RewardsState({\n index: state.index + deltaIndex,\n lastUpdatedTimestamp: block.timestamp.safeCastTo32()\n });\n _strategyState[strategy] = rewardsState;\n }\n }\n\n /// @notice accumulate rewards on a strategy for a specific user\n function accrueUser(ERC20 strategy, address user, RewardsState memory state) private returns (uint256) {\n // load indices\n uint224 strategyIndex = state.index;\n uint224 supplierIndex = userIndex(strategy, user);\n\n // sync user index to global\n _userIndex[strategy][user] = strategyIndex;\n\n // if user hasn't yet accrued rewards, grant them interest from the strategy beginning if they have a balance\n // zero balances will have no effect other than syncing to global index\n if (supplierIndex == 0) {\n supplierIndex = (10 ** rewardToken.decimals()).safeCastTo224();\n }\n\n uint224 deltaIndex = strategyIndex - supplierIndex;\n // use the booster or token balance to calculate reward balance multiplier\n uint256 supplierTokens = address(flywheelBooster) != address(0)\n ? flywheelBooster.boostedBalanceOf(strategy, user) - userBlacklistedSupply[strategy][user]\n : strategy.balanceOf(user) - userBlacklistedSupply[strategy][user];\n\n // accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed\n uint256 supplierDelta = (deltaIndex * supplierTokens) / (10 ** strategy.decimals());\n uint256 supplierAccrued = rewardsAccrued(user) + supplierDelta;\n\n _rewardsAccrued[user] = supplierAccrued;\n\n emit AccrueRewards(strategy, user, supplierDelta, strategyIndex);\n\n return supplierAccrued;\n }\n\n function rewardsAccrued(address user) public virtual returns (uint256) {\n return _rewardsAccrued[user];\n }\n\n function userIndex(ERC20 strategy, address user) public virtual returns (uint224) {\n return _userIndex[strategy][user];\n }\n\n function strategyState(ERC20 strategy) public virtual returns (uint224 index, uint32 lastUpdatedTimestamp) {\n return (_strategyState[strategy].index, _strategyState[strategy].lastUpdatedTimestamp);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IonicFlywheelLensRouter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\nimport { IonicFlywheelCore } from \"./IonicFlywheelCore.sol\";\nimport { IonicComptroller } from \"../../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { PoolDirectory } from \"../../../PoolDirectory.sol\";\n\ninterface IPriceOracle_IFLR {\n function getUnderlyingPrice(ERC20 cToken) external view returns (uint256);\n\n function price(address underlying) external view returns (uint256);\n}\n\ncontract IonicFlywheelLensRouter {\n PoolDirectory public fpd;\n\n constructor(PoolDirectory _fpd) {\n fpd = _fpd;\n }\n\n struct MarketRewardsInfo {\n /// @dev comptroller oracle price of market underlying\n uint256 underlyingPrice;\n ICErc20 market;\n RewardsInfo[] rewardsInfo;\n }\n\n struct RewardsInfo {\n /// @dev rewards in `rewardToken` paid per underlying staked token in `market` per second\n uint256 rewardSpeedPerSecondPerToken;\n /// @dev comptroller oracle price of reward token\n uint256 rewardTokenPrice;\n /// @dev APR scaled by 1e18. Calculated as rewardSpeedPerSecondPerToken * rewardTokenPrice * 365.25 days / underlyingPrice * 1e18 / market.exchangeRate\n uint256 formattedAPR;\n address flywheel;\n address rewardToken;\n }\n\n function getPoolMarketRewardsInfo(IonicComptroller comptroller) external returns (MarketRewardsInfo[] memory) {\n ICErc20[] memory markets = comptroller.getAllMarkets();\n return _getMarketRewardsInfo(markets, comptroller);\n }\n\n function getMarketRewardsInfo(ICErc20[] memory markets) external returns (MarketRewardsInfo[] memory) {\n IonicComptroller pool;\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 asMarket = ICErc20(address(markets[i]));\n if (address(pool) == address(0)) pool = asMarket.comptroller();\n else require(asMarket.comptroller() == pool);\n }\n return _getMarketRewardsInfo(markets, pool);\n }\n\n function _getMarketRewardsInfo(ICErc20[] memory markets, IonicComptroller comptroller)\n internal\n returns (MarketRewardsInfo[] memory)\n {\n if (address(comptroller) == address(0) || markets.length == 0) return new MarketRewardsInfo[](0);\n\n address[] memory flywheels = comptroller.getAccruingFlywheels();\n address[] memory rewardTokens = new address[](flywheels.length);\n uint256[] memory rewardTokenPrices = new uint256[](flywheels.length);\n uint256[] memory rewardTokenDecimals = new uint256[](flywheels.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n MarketRewardsInfo[] memory infoList = new MarketRewardsInfo[](markets.length);\n for (uint256 i = 0; i < markets.length; i++) {\n RewardsInfo[] memory rewardsInfo = new RewardsInfo[](flywheels.length);\n\n ICErc20 market = ICErc20(address(markets[i]));\n uint256 price = oracle.price(market.underlying()); // scaled to 1e18\n\n if (i == 0) {\n for (uint256 j = 0; j < flywheels.length; j++) {\n ERC20 rewardToken = IonicFlywheelCore(flywheels[j]).rewardToken();\n rewardTokens[j] = address(rewardToken);\n rewardTokenPrices[j] = oracle.price(address(rewardToken)); // scaled to 1e18\n rewardTokenDecimals[j] = uint256(rewardToken.decimals());\n }\n }\n\n for (uint256 j = 0; j < flywheels.length; j++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\n\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\n flywheel,\n market,\n rewardTokenDecimals[j]\n );\n uint256 apr = getApr(\n rewardSpeedPerSecondPerToken,\n rewardTokenPrices[j],\n price, \n market.exchangeRateCurrent(),\n address(flywheel.flywheelBooster()) != address(0)\n );\n\n rewardsInfo[j] = RewardsInfo({\n rewardSpeedPerSecondPerToken: rewardSpeedPerSecondPerToken, // scaled in 1e18\n rewardTokenPrice: rewardTokenPrices[j],\n formattedAPR: apr, // scaled in 1e18\n flywheel: address(flywheel),\n rewardToken: rewardTokens[j]\n });\n }\n\n infoList[i] = MarketRewardsInfo({ market: market, rewardsInfo: rewardsInfo, underlyingPrice: price });\n }\n\n return infoList;\n }\n\n function scaleIndexDiff(uint256 indexDiff, uint256 decimals) internal pure returns (uint256) {\n return decimals <= 18 ? uint256(indexDiff) * (10**(18 - decimals)) : uint256(indexDiff) / (10**(decimals - 18));\n }\n\n function getRewardSpeedPerSecondPerToken(\n IonicFlywheelCore flywheel,\n ICErc20 market,\n uint256 decimals\n ) internal returns (uint256 rewardSpeedPerSecondPerToken) {\n ERC20 strategy = ERC20(address(market));\n (uint224 indexBefore, uint32 lastUpdatedTimestampBefore) = flywheel.strategyState(strategy);\n flywheel.accrue(strategy, address(0));\n (uint224 indexAfter, uint32 lastUpdatedTimestampAfter) = flywheel.strategyState(strategy);\n if (lastUpdatedTimestampAfter > lastUpdatedTimestampBefore) {\n rewardSpeedPerSecondPerToken =\n scaleIndexDiff((indexAfter - indexBefore), decimals) /\n (lastUpdatedTimestampAfter - lastUpdatedTimestampBefore);\n }\n }\n\n function getApr(\n uint256 rewardSpeedPerSecondPerToken,\n uint256 rewardTokenPrice,\n uint256 underlyingPrice,\n uint256 exchangeRate,\n bool isBorrow\n ) internal pure returns (uint256) {\n if (rewardSpeedPerSecondPerToken == 0) return 0;\n uint256 nativeSpeedPerSecondPerCToken = rewardSpeedPerSecondPerToken * rewardTokenPrice; // scaled to 1e36\n uint256 nativeSpeedPerYearPerCToken = nativeSpeedPerSecondPerCToken * 365.25 days; // scaled to 1e36\n uint256 assetSpeedPerYearPerCToken = nativeSpeedPerYearPerCToken / underlyingPrice; // scaled to 1e18\n uint256 assetSpeedPerYearPerCTokenScaled = assetSpeedPerYearPerCToken * 1e18; // scaled to 1e36\n uint256 apr = assetSpeedPerYearPerCTokenScaled;\n if (!isBorrow) {\n // if not borrowing, use exchange rate to scale\n apr = assetSpeedPerYearPerCTokenScaled / exchangeRate; // scaled to 1e18\n } else {\n apr = assetSpeedPerYearPerCTokenScaled / 1e18; // scaled to 1e18\n }\n return apr;\n }\n\n function getRewardsAprForMarket(ICErc20 market) internal returns (int256 totalMarketRewardsApr) {\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n uint256 underlyingPrice = oracle.getUnderlyingPrice(market);\n\n address[] memory flywheels = comptroller.getAccruingFlywheels();\n for (uint256 j = 0; j < flywheels.length; j++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheels[j]);\n ERC20 rewardToken = flywheel.rewardToken();\n\n uint256 rewardSpeedPerSecondPerToken = getRewardSpeedPerSecondPerToken(\n flywheel,\n market,\n uint256(rewardToken.decimals())\n );\n\n uint256 marketApr = getApr(\n rewardSpeedPerSecondPerToken,\n oracle.price(address(rewardToken)),\n underlyingPrice,\n market.exchangeRateCurrent(),\n address(flywheel.flywheelBooster()) != address(0)\n );\n\n totalMarketRewardsApr += int256(marketApr);\n }\n }\n\n function getUserNetValueDeltaForMarket(\n address user,\n ICErc20 market,\n int256 offchainApr,\n int256 blocksPerYear\n ) internal returns (int256) {\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n int256 netApr = getRewardsAprForMarket(market) +\n getUserInterestAprForMarket(user, market, blocksPerYear) +\n offchainApr;\n return (netApr * int256(market.balanceOfUnderlying(user)) * int256(oracle.getUnderlyingPrice(market))) / 1e36;\n }\n\n function getUserInterestAprForMarket(\n address user,\n ICErc20 market,\n int256 blocksPerYear\n ) internal returns (int256) {\n uint256 borrows = market.borrowBalanceCurrent(user);\n uint256 supplied = market.balanceOfUnderlying(user);\n uint256 supplyRatePerBlock = market.supplyRatePerBlock();\n uint256 borrowRatePerBlock = market.borrowRatePerBlock();\n\n IonicComptroller comptroller = market.comptroller();\n BasePriceOracle oracle = comptroller.oracle();\n uint256 assetPrice = oracle.getUnderlyingPrice(market);\n uint256 collateralValue = (supplied * assetPrice) / 1e18;\n uint256 borrowsValue = (borrows * assetPrice) / 1e18;\n\n uint256 yieldValuePerBlock = collateralValue * supplyRatePerBlock;\n uint256 interestOwedValuePerBlock = borrowsValue * borrowRatePerBlock;\n\n if (collateralValue == 0) return 0;\n return ((int256(yieldValuePerBlock) - int256(interestOwedValuePerBlock)) * blocksPerYear) / int256(collateralValue);\n }\n\n struct AdjustedUserNetAprVars {\n int256 userNetAssetsValue;\n int256 userNetValueDelta;\n BasePriceOracle oracle;\n ICErc20[] markets;\n IonicComptroller pool;\n }\n\n function getAdjustedUserNetApr(\n address user,\n int256 blocksPerYear,\n address[] memory offchainRewardsAprMarkets,\n int256[] memory offchainRewardsAprs\n ) public returns (int256) {\n AdjustedUserNetAprVars memory vars;\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n vars.oracle = pool.oracle();\n vars.markets = pool.getAllMarkets();\n for (uint256 j = 0; j < vars.markets.length; j++) {\n int256 offchainRewardsApr = 0;\n for (uint256 k = 0; k < offchainRewardsAprMarkets.length; k++) {\n if (offchainRewardsAprMarkets[k] == address(vars.markets[j])) offchainRewardsApr = offchainRewardsAprs[k];\n }\n vars.userNetAssetsValue +=\n int256(vars.markets[j].balanceOfUnderlying(user) * vars.oracle.getUnderlyingPrice(vars.markets[j])) /\n 1e18;\n vars.userNetValueDelta += getUserNetValueDeltaForMarket(\n user,\n vars.markets[j],\n offchainRewardsApr,\n blocksPerYear\n );\n }\n }\n\n if (vars.userNetAssetsValue == 0) return 0;\n else return (vars.userNetValueDelta * 1e18) / vars.userNetAssetsValue;\n }\n\n function getUserNetApr(address user, int256 blocksPerYear) external returns (int256) {\n address[] memory emptyAddrArray = new address[](0);\n int256[] memory emptyIntArray = new int256[](0);\n return getAdjustedUserNetApr(user, blocksPerYear, emptyAddrArray, emptyIntArray);\n }\n\n function getAllRewardTokens() public view returns (address[] memory uniqueRewardTokens) {\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n uint256 rewardTokensCounter;\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address[] memory fws = pool.getRewardsDistributors();\n\n rewardTokensCounter += fws.length;\n }\n\n address[] memory rewardTokens = new address[](rewardTokensCounter);\n\n uint256 uniqueRewardTokensCounter = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address[] memory fws = pool.getRewardsDistributors();\n\n for (uint256 j = 0; j < fws.length; j++) {\n address rwToken = address(IonicFlywheelCore(fws[j]).rewardToken());\n if (rwToken == address(0)) break;\n\n bool added;\n for (uint256 k = 0; k < rewardTokens.length; k++) {\n if (rwToken == rewardTokens[k]) {\n added = true;\n break;\n }\n }\n if (!added) rewardTokens[uniqueRewardTokensCounter++] = rwToken;\n }\n }\n\n uniqueRewardTokens = new address[](uniqueRewardTokensCounter);\n for (uint256 i = 0; i < uniqueRewardTokensCounter; i++) {\n uniqueRewardTokens[i] = rewardTokens[i];\n }\n }\n\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory) {\n address[] memory rewardTokens = getAllRewardTokens();\n uint256[] memory rewardsClaimedForToken = new uint256[](rewardTokens.length);\n\n for (uint256 i = 0; i < rewardTokens.length; i++) {\n rewardsClaimedForToken[i] = claimRewardsOfRewardToken(user, rewardTokens[i]);\n }\n\n return (rewardTokens, rewardsClaimedForToken);\n }\n\n function claimRewardsOfRewardToken(address user, address rewardToken) public returns (uint256 rewardsClaimed) {\n uint256 balanceBefore = ERC20(rewardToken).balanceOf(user);\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ERC20[] memory markets;\n {\n ICErc20[] memory cerc20s = pool.getAllMarkets();\n markets = new ERC20[](cerc20s.length);\n for (uint256 j = 0; j < cerc20s.length; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n }\n\n address[] memory flywheelAddresses = pool.getAccruingFlywheels();\n for (uint256 k = 0; k < flywheelAddresses.length; k++) {\n IonicFlywheelCore flywheel = IonicFlywheelCore(flywheelAddresses[k]);\n if (address(flywheel.rewardToken()) == rewardToken) {\n for (uint256 m = 0; m < markets.length; m++) {\n flywheel.accrue(markets[m], user);\n }\n flywheel.claimRewards(user);\n }\n }\n }\n\n uint256 balanceAfter = ERC20(rewardToken).balanceOf(user);\n return balanceAfter - balanceBefore;\n }\n\n function claimRewardsForMarket(\n address user,\n ERC20 market,\n IonicFlywheelCore[] calldata flywheels,\n bool[] calldata accrue\n )\n external\n returns (\n IonicFlywheelCore[] memory,\n address[] memory rewardTokens,\n uint256[] memory rewards\n )\n {\n uint256 size = flywheels.length;\n rewards = new uint256[](size);\n rewardTokens = new address[](size);\n\n for (uint256 i = 0; i < size; i++) {\n uint256 newRewards;\n if (accrue[i]) {\n newRewards = flywheels[i].accrue(market, user);\n } else {\n newRewards = flywheels[i].rewardsAccrued(user);\n }\n\n // Take the max, because rewards are cumulative.\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\n\n flywheels[i].claimRewards(user);\n rewardTokens[i] = address(flywheels[i].rewardToken());\n }\n\n return (flywheels, rewardTokens, rewards);\n }\n\n function claimRewardsForPool(address user, IonicComptroller comptroller)\n public\n returns (\n IonicFlywheelCore[] memory,\n address[] memory,\n uint256[] memory\n )\n {\n ICErc20[] memory cerc20s = comptroller.getAllMarkets();\n ERC20[] memory markets = new ERC20[](cerc20s.length);\n address[] memory flywheelAddresses = comptroller.getAccruingFlywheels();\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](flywheelAddresses.length);\n bool[] memory accrue = new bool[](flywheelAddresses.length);\n\n for (uint256 j = 0; j < flywheelAddresses.length; j++) {\n flywheels[j] = IonicFlywheelCore(flywheelAddresses[j]);\n accrue[j] = true;\n }\n\n for (uint256 j = 0; j < cerc20s.length; j++) {\n markets[j] = ERC20(address(cerc20s[j]));\n }\n\n return claimRewardsForMarkets(user, markets, flywheels, accrue);\n }\n\n function claimRewardsForMarkets(\n address user,\n ERC20[] memory markets,\n IonicFlywheelCore[] memory flywheels,\n bool[] memory accrue\n )\n public\n returns (\n IonicFlywheelCore[] memory,\n address[] memory rewardTokens,\n uint256[] memory rewards\n )\n {\n rewards = new uint256[](flywheels.length);\n rewardTokens = new address[](flywheels.length);\n\n for (uint256 i = 0; i < flywheels.length; i++) {\n for (uint256 j = 0; j < markets.length; j++) {\n ERC20 market = markets[j];\n\n uint256 newRewards;\n if (accrue[i]) {\n newRewards = flywheels[i].accrue(market, user);\n } else {\n newRewards = flywheels[i].rewardsAccrued(user);\n }\n\n // Take the max, because rewards are cumulative.\n rewards[i] = rewards[i] >= newRewards ? rewards[i] : newRewards;\n }\n\n flywheels[i].claimRewards(user);\n rewardTokens[i] = address(flywheels[i].rewardToken());\n }\n\n return (flywheels, rewardTokens, rewards);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/LooplessFlywheelBooster.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"./IFlywheelBooster.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\ncontract LooplessFlywheelBooster is IFlywheelBooster {\n string public constant BOOSTER_TYPE = \"LooplessFlywheelBooster\";\n\n /**\n @notice calculate the boosted supply of a strategy.\n @param strategy the strategy to calculate boosted supply of\n @return the boosted supply\n */\n function boostedTotalSupply(ERC20 strategy) external view returns (uint256) {\n return strategy.totalSupply();\n }\n\n /**\n @notice calculate the boosted balance of a user in a given strategy.\n @param strategy the strategy to calculate boosted balance of\n @param user the user to calculate boosted balance of\n @return the boosted balance\n */\n function boostedBalanceOf(ERC20 strategy, address user) external view returns (uint256) {\n uint256 cTokensBalance = strategy.balanceOf(user);\n ICErc20 asMarket = ICErc20(address(strategy));\n uint256 cTokensBorrow = (asMarket.borrowBalanceCurrent(user) * 1e18) / asMarket.exchangeRateCurrent();\n return (cTokensBalance > cTokensBorrow) ? cTokensBalance - cTokensBorrow : 0;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/BaseFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {IFlywheelRewards} from \"./IFlywheelRewards.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/** \n @title Flywheel Reward Module\n @notice Determines how many rewards accrue to each strategy globally over a given time period.\n @dev approves the flywheel core for the reward token to allow balances to be managed by the module but claimed from core.\n*/\nabstract contract BaseFlywheelRewards is IFlywheelRewards {\n using SafeTransferLib for ERC20;\n\n /// @notice thrown when caller is not the flywheel\n error FlywheelError();\n\n /// @notice the reward token paid\n ERC20 public immutable override rewardToken;\n\n /// @notice the flywheel core contract\n IonicFlywheelCore public immutable override flywheel;\n\n constructor(IonicFlywheelCore _flywheel) {\n flywheel = _flywheel;\n ERC20 _rewardToken = _flywheel.rewardToken();\n rewardToken = _rewardToken;\n\n _rewardToken.safeApprove(address(_flywheel), type(uint256).max);\n }\n\n modifier onlyFlywheel() {\n if (msg.sender != address(flywheel)) revert FlywheelError();\n _;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\nimport {SafeTransferLib, ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {SafeCastLib} from \"solmate/utils/SafeCastLib.sol\";\n\n/** \n @title Flywheel Dynamic Reward Stream\n @notice Determines rewards based on a dynamic reward stream.\n Rewards are transferred linearly over a \"rewards cycle\" to prevent gaming the reward distribution. \n The reward source can be arbitrary logic, but most common is to \"pass through\" rewards from some other source.\n The getNextCycleRewards() hook should also transfer the next cycle's rewards to this contract to ensure proper accounting.\n*/\nabstract contract FlywheelDynamicRewards is BaseFlywheelRewards {\n using SafeTransferLib for ERC20;\n using SafeCastLib for uint256;\n\n event NewRewardsCycle(uint32 indexed start, uint32 indexed end, uint192 reward);\n\n /// @notice the length of a rewards cycle\n uint32 public immutable rewardsCycleLength;\n\n struct RewardsCycle {\n uint32 start;\n uint32 end;\n uint192 reward;\n }\n\n mapping(ERC20 => RewardsCycle) public rewardsCycle;\n\n constructor(IonicFlywheelCore _flywheel, uint32 _rewardsCycleLength) BaseFlywheelRewards(_flywheel) {\n rewardsCycleLength = _rewardsCycleLength;\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param strategy the strategy to accrue rewards for\n @return amount the amount of tokens accrued and transferred\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\n external\n override\n onlyFlywheel\n returns (uint256 amount)\n {\n RewardsCycle memory cycle = rewardsCycle[strategy];\n\n uint32 timestamp = block.timestamp.safeCastTo32();\n\n uint32 latest = timestamp >= cycle.end ? cycle.end : timestamp;\n uint32 earliest = lastUpdatedTimestamp <= cycle.start ? cycle.start : lastUpdatedTimestamp;\n if (cycle.end != 0) {\n amount = (cycle.reward * (latest - earliest)) / (cycle.end - cycle.start);\n assert(amount <= cycle.reward); // should never happen because latest <= cycle.end and earliest >= cycle.start\n }\n // if cycle has ended, reset cycle and transfer all available\n if (timestamp >= cycle.end) {\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\n uint192 rewards = getNextCycleRewards(strategy);\n\n // reset for next cycle\n rewardsCycle[strategy] = RewardsCycle({start: timestamp, end: end, reward: rewards});\n\n emit NewRewardsCycle(timestamp, end, rewards);\n }\n }\n\n function getNextCycleRewards(ERC20 strategy) internal virtual returns (uint192);\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelInstantRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { BaseFlywheelRewards } from \"./BaseFlywheelRewards.sol\";\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\n\n/**\n * @title FlywheelInstantRewards\n * @author Jourdan DUnkley (https://github.com/jourdanDunkley)\n * @notice This contract handles the instant reward distribution for strategies.\n * It allows setting and transferring rewards for specific strategies.\n */\ncontract FlywheelInstantRewards is Auth, BaseFlywheelRewards {\n using SafeTransferLib for ERC20;\n\n event RewardsSet(ERC20 indexed strategy, uint256 amount);\n\n /// @notice Mapping to store the reward amount for each strategy.\n mapping(ERC20 => uint256) rewardAmount;\n /// @notice Mapping to track if a strategy has new rewards to be distributed.\n mapping(ERC20 => bool) rewardsNew;\n\n /**\n * @notice Constructor to initialize the FlywheelInstantRewards contract.\n * @param _flywheel The flywheel core contract.\n * @param _owner The owner of the contract.\n * @param _authority The authority contract for authentication.\n */\n constructor(\n IonicFlywheelCore _flywheel,\n address _owner,\n Authority _authority\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\n\n /**\n * @notice Set the reward amount for a specific strategy.\n * @param _amount The amount of rewards to be set for the strategy.\n * @param _strategy The strategy for which the rewards are being set.\n * @dev Requires authentication to execute.\n */\n function setRewards(ERC20 _strategy, uint256 _amount) external requiresAuth {\n rewardAmount[_strategy] = _amount;\n rewardsNew[_strategy] = true;\n rewardToken.safeTransferFrom(msg.sender, address(this), _amount);\n emit RewardsSet(_strategy, _amount);\n }\n\n /**\n * @notice Calculate and transfer accrued rewards to the flywheel core.\n * @param strategy The strategy to accrue rewards for.\n * @return amount The amount of tokens accrued and transferred.\n * @dev This function can only be called by the flywheel core.\n */\n function getAccruedRewards(\n ERC20 strategy,\n uint32 /* lastUpdatedTimestamp */\n ) external override onlyFlywheel returns (uint256 amount) {\n if (rewardsNew[strategy]) {\n amount = rewardAmount[strategy];\n rewardsNew[strategy] = false;\n } else {\n amount = 0;\n }\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {Auth, Authority} from \"solmate/auth/Auth.sol\";\nimport {BaseFlywheelRewards} from \"./BaseFlywheelRewards.sol\";\nimport {ERC20} from \"solmate/utils/SafeTransferLib.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/** \n @title Flywheel Static Reward Stream\n @notice Determines rewards per strategy based on a fixed reward rate per second\n*/\ncontract FlywheelStaticRewards is Auth, BaseFlywheelRewards {\n event RewardsInfoUpdate(ERC20 indexed strategy, uint224 rewardsPerSecond, uint32 rewardsEndTimestamp);\n\n struct RewardsInfo {\n /// @notice Rewards per second\n uint224 rewardsPerSecond;\n /// @notice The timestamp the rewards end at\n /// @dev use 0 to specify no end\n uint32 rewardsEndTimestamp;\n }\n\n /// @notice rewards info per strategy\n mapping(ERC20 => RewardsInfo) public rewardsInfo;\n\n constructor(\n IonicFlywheelCore _flywheel,\n address _owner,\n Authority _authority\n ) Auth(_owner, _authority) BaseFlywheelRewards(_flywheel) {}\n\n /**\n @notice set rewards per second and rewards end time for Fei Rewards\n @param strategy the strategy to accrue rewards for\n @param rewards the rewards info for the strategy\n */\n function setRewardsInfo(ERC20 strategy, RewardsInfo calldata rewards) external requiresAuth {\n rewardsInfo[strategy] = rewards;\n emit RewardsInfoUpdate(strategy, rewards.rewardsPerSecond, rewards.rewardsEndTimestamp);\n }\n\n /**\n @notice calculate and transfer accrued rewards to flywheel core\n @param strategy the strategy to accrue rewards for\n @param lastUpdatedTimestamp the last updated time for strategy\n @return amount the amount of tokens accrued and transferred\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp)\n external\n view\n override\n onlyFlywheel\n returns (uint256 amount)\n {\n RewardsInfo memory rewards = rewardsInfo[strategy];\n\n uint256 elapsed;\n if (rewards.rewardsEndTimestamp == 0 || rewards.rewardsEndTimestamp > block.timestamp) {\n elapsed = block.timestamp - lastUpdatedTimestamp;\n } else if (rewards.rewardsEndTimestamp > lastUpdatedTimestamp) {\n elapsed = rewards.rewardsEndTimestamp - lastUpdatedTimestamp;\n }\n\n amount = rewards.rewardsPerSecond * elapsed;\n }\n}" + }, + "contracts/ionic/strategies/flywheel/rewards/IFlywheelRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\nimport {IonicFlywheelCore} from \"../IonicFlywheelCore.sol\";\n\n/**\n @title Rewards Module for Flywheel\n @notice Flywheel is a general framework for managing token incentives.\n It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.\n\n The Rewards module is responsible for:\n * determining the ongoing reward amounts to entire strategies (core handles the logic for dividing among users)\n * actually holding rewards that are yet to be claimed\n\n The reward stream can follow arbitrary logic as long as the amount of rewards passed to flywheel core has been sent to this contract.\n\n Different module strategies include:\n * a static reward rate per second\n * a decaying reward rate\n * a dynamic just-in-time reward stream\n * liquid governance reward delegation (Curve Gauge style)\n\n SECURITY NOTE: The rewards strategy should be smooth and continuous, to prevent gaming the reward distribution by frontrunning.\n */\ninterface IFlywheelRewards {\n /**\n @notice calculate the rewards amount accrued to a strategy since the last update.\n @param strategy the strategy to accrue rewards for.\n @param lastUpdatedTimestamp the last time rewards were accrued for the strategy.\n @return rewards the amount of rewards accrued to the market\n */\n function getAccruedRewards(ERC20 strategy, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);\n\n /// @notice return the flywheel core address\n function flywheel() external view returns (IonicFlywheelCore);\n\n /// @notice return the reward token associated with flywheel core.\n function rewardToken() external view returns (ERC20);\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { FlywheelDynamicRewards } from \"./FlywheelDynamicRewards.sol\";\nimport { IonicFlywheelCore } from \"../IonicFlywheelCore.sol\";\nimport { SafeTransferLib, ERC20 } from \"solmate/utils/SafeTransferLib.sol\";\n\ncontract IonicFlywheelDynamicRewards is FlywheelDynamicRewards {\n using SafeTransferLib for ERC20;\n\n address public owner;\n mapping(address => address) public rewardAccumulators;\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"You are not the owner\");\n _;\n }\n\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\n FlywheelDynamicRewards(_flywheel, _cycleLength)\n {\n owner = msg.sender;\n }\n\n function setRewardAccumulators(address[] memory _strategies, address[] memory _rewardAccumulators) external onlyOwner {\n uint256 _length = _strategies.length;\n require(_rewardAccumulators.length == _length, \"parameters\");\n for (uint256 i = 0; i < _length; i++) {\n rewardAccumulators[_strategies[i]] = _rewardAccumulators[i];\n }\n }\n\n function getNextCycleRewards(ERC20 strategy)\n internal\n override\n returns (uint192)\n {\n address rewardAccumulator = rewardAccumulators[address(strategy)];\n uint256 rewardAmount = rewardToken.balanceOf(rewardAccumulator);\n if (rewardAmount != 0) {\n rewardToken.safeTransferFrom(\n rewardAccumulator,\n address(this),\n rewardAmount\n );\n }\n return uint192(rewardAmount);\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport \"./FlywheelDynamicRewards.sol\";\n\ninterface ICERC20 {\n function plugin() external returns (address);\n}\n\ninterface IPlugin_FDR {\n function claimRewards() external;\n}\n\n/** \n @title Ionic Flywheel Dynamic Reward Stream\n @notice Determines rewards based on reward cycle\n Each cycle, claims rewards on the plugin before getting the reward amount\n*/\ncontract IonicFlywheelDynamicRewardsPlugin is FlywheelDynamicRewards {\n using SafeTransferLib for ERC20;\n\n constructor(IonicFlywheelCore _flywheel, uint32 _cycleLength)\n FlywheelDynamicRewards(_flywheel, _cycleLength)\n {}\n\n function getNextCycleRewards(ERC20 strategy)\n internal\n override\n returns (uint192)\n {\n IPlugin_FDR plugin = IPlugin_FDR(ICERC20(address(strategy)).plugin());\n try plugin.claimRewards() {} catch {}\n\n uint256 rewardAmount = rewardToken.balanceOf(address(strategy));\n if (rewardAmount != 0) {\n rewardToken.safeTransferFrom(\n address(strategy),\n address(this),\n rewardAmount\n );\n }\n return uint192(rewardAmount);\n }\n}" + }, + "contracts/ionic/strategies/IonicERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\nimport { PausableUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol\";\nimport { ERC4626Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nabstract contract IonicERC4626 is SafeOwnableUpgradeable, PausableUpgradeable, ERC4626Upgradeable {\n using FixedPointMathLib for uint256;\n using SafeERC20Upgradeable for ERC20Upgradeable;\n\n /* ========== STATE VARIABLES ========== */\n\n uint256 public vaultShareHWM;\n uint256 public performanceFee;\n address public feeRecipient;\n\n /* ========== EVENTS ========== */\n\n event UpdatedFeeSettings(\n uint256 oldPerformanceFee,\n uint256 newPerformanceFee,\n address oldFeeRecipient,\n address newFeeRecipient\n );\n\n event UpdatedRewardsRecipient(address oldRewardsRecipient, address newRewardsRecipient);\n\n /* ========== INITIALIZER ========== */\n\n function __IonicER4626_init(ERC20Upgradeable asset_) internal onlyInitializing {\n __SafeOwnable_init(msg.sender);\n __Pausable_init();\n __Context_init();\n __ERC20_init(\n string(abi.encodePacked(\"Ionic \", asset_.name(), \" Vault\")),\n string(abi.encodePacked(\"iv\", asset_.symbol()))\n );\n __ERC4626_init(asset_);\n\n vaultShareHWM = 10 ** asset_.decimals();\n feeRecipient = msg.sender;\n }\n\n function _asset() internal view returns (ERC20Upgradeable) {\n return ERC20Upgradeable(super.asset());\n }\n\n /* ========== DEPOSIT/WITHDRAW FUNCTIONS ========== */\n\n function deposit(uint256 assets, address receiver) public override whenNotPaused returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n _asset().safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public override whenNotPaused returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n _asset().safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\n }\n\n if (!paused()) {\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\n\n beforeWithdraw(assets, shares);\n\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\n }\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n _asset().safeTransfer(receiver, assets);\n }\n\n function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance(owner, msg.sender); // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) _approve(owner, msg.sender, allowed - shares);\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n if (!paused()) {\n uint256 balanceBeforeWithdraw = _asset().balanceOf(address(this));\n\n beforeWithdraw(assets, shares);\n\n assets = _asset().balanceOf(address(this)) - balanceBeforeWithdraw;\n }\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n _asset().safeTransfer(receiver, assets);\n }\n\n /* ========== FEE FUNCTIONS ========== */\n\n /**\n * @notice Take the performance fee that has accrued since last fee harvest.\n * @dev Performance fee is based on a vault share high water mark value. If vault share value has increased above the\n * HWM in a fee period, issue fee shares to the vault equal to the performance fee.\n */\n function takePerformanceFee() external onlyOwner {\n require(feeRecipient != address(0), \"fee recipient not initialized\");\n\n uint256 currentAssets = totalAssets();\n uint256 shareValue = convertToAssets(10 ** _asset().decimals());\n\n require(shareValue > vaultShareHWM, \"shareValue !> vaultShareHWM\");\n // cache value\n uint256 supply = totalSupply();\n\n uint256 accruedPerformanceFee = (performanceFee * (shareValue - vaultShareHWM) * supply) / 1e36;\n _mint(feeRecipient, accruedPerformanceFee.mulDivDown(supply, (currentAssets - accruedPerformanceFee)));\n\n vaultShareHWM = convertToAssets(10 ** _asset().decimals());\n }\n\n /**\n * @notice Transfer accrued fees to rewards manager contract. Caller must be a registered keeper.\n * @dev We must make sure that feeRecipient is not address(0) before withdrawing fees\n */\n function withdrawAccruedFees() external onlyOwner {\n redeem(balanceOf(feeRecipient), feeRecipient, feeRecipient);\n }\n\n /**\n * @notice Update performanceFee and/or feeRecipient\n */\n function updateFeeSettings(uint256 newPerformanceFee, address newFeeRecipient) external onlyOwner {\n emit UpdatedFeeSettings(performanceFee, newPerformanceFee, feeRecipient, newFeeRecipient);\n\n performanceFee = newPerformanceFee;\n\n if (newFeeRecipient != feeRecipient) {\n if (feeRecipient != address(0)) {\n uint256 oldFees = balanceOf(feeRecipient);\n\n _burn(feeRecipient, oldFees);\n _approve(feeRecipient, owner(), 0);\n _mint(newFeeRecipient, oldFees);\n }\n\n _approve(newFeeRecipient, owner(), type(uint256).max);\n }\n\n feeRecipient = newFeeRecipient;\n }\n\n /* ========== EMERGENCY FUNCTIONS ========== */\n\n // Should withdraw all funds from the strategy and pause the contract\n function emergencyWithdrawAndPause() external virtual;\n\n function unpause() external virtual;\n\n function shutdown(address market) external onlyOwner whenPaused returns (uint256) {\n ERC20Upgradeable theAsset = _asset();\n uint256 endBalance = theAsset.balanceOf(address(this));\n theAsset.transfer(market, endBalance);\n return endBalance;\n }\n\n /* ========== INTERNAL HOOKS LOGIC ========== */\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual;\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual;\n}\n" + }, + "contracts/ionic/strategies/IonicMarketERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\nimport { IonicERC4626, ERC20Upgradeable } from \"./IonicERC4626.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"../../compound/ErrorReporter.sol\";\n\ninterface IonicFlywheelLensRouter_4626 {\n function claimAllRewardTokens(address user) external returns (address[] memory, uint256[] memory);\n}\n\ncontract IonicMarketERC4626 is IonicERC4626 {\n using SafeERC20Upgradeable for ERC20Upgradeable;\n\n error IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error);\n\n // STATE VARIABLES\n address public rewardsRecipient;\n IonicFlywheelLensRouter_4626 public flywheelLensRouter;\n ICErc20 public cToken;\n\n function initialize(\n ERC20Upgradeable asset_,\n ICErc20 cToken_,\n address flywheelLensRouter_,\n address rewardsRecipient_\n ) public initializer {\n __IonicER4626_init(asset_);\n cToken = cToken_;\n rewardsRecipient = rewardsRecipient_;\n flywheelLensRouter = IonicFlywheelLensRouter_4626(flywheelLensRouter_);\n }\n\n /* ========== VIEW FUNCTIONS ========== */\n function totalAssets() public view virtual override returns (uint256) {\n return cToken.balanceOfUnderlying(address(this));\n }\n\n /// @notice maximum amount of underlying tokens that can be deposited into the underlying protocol\n function maxDeposit(address) public view override returns (uint256) {\n if (cToken.comptroller().mintGuardianPaused(address(cToken))) {\n return 0;\n }\n\n uint256 supplyCap = cToken.comptroller().supplyCaps(address(cToken));\n if (supplyCap != 0) {\n uint256 currentExchangeRate = cToken.exchangeRateCurrent();\n uint256 _totalSupply = cToken.totalSupply();\n uint256 totalSupplies = (_totalSupply * currentExchangeRate) / 1e18; /// exchange rate is scaled up by 1e18, so needs to be divided off to get accurate total supply\n\n // uint256 totalCash = MToken(address(mToken)).getCash();\n // uint256 totalBorrows = MToken(address(mToken)).totalBorrows();\n // uint256 totalReserves = MToken(address(mToken)).totalReserves();\n\n // // (Pseudocode) totalSupplies = totalCash + totalBorrows - totalReserves\n // uint256 totalSupplies = (totalCash + totalBorrows) - totalReserves;\n\n // supply cap is 3\n // total supplies is 1\n /// no room for additional supplies\n\n // supply cap is 3\n // total supplies is 0\n /// room for 1 additional supplies\n\n // supply cap is 4\n // total supplies is 1\n /// room for 1 additional supplies\n\n /// total supplies could exceed supply cap as interest accrues, need to handle this edge case\n /// going to subtract 2 from supply cap to account for rounding errors\n if (totalSupplies + 2 >= supplyCap) {\n return 0;\n }\n\n return supplyCap - totalSupplies - 2;\n }\n\n return type(uint256).max;\n }\n\n /// @notice Returns the maximum amount of tokens that can be supplied\n /// no way for this function to ever revert unless comptroller or mToken is broken\n /// @dev accrue interest must be called before this function is called, otherwise\n /// an outdated value will be fetched, and the returned value will be incorrect\n /// (greater than actual amount available to be minted will be returned)\n function maxMint(address) public view override returns (uint256) {\n uint256 mintAmount = maxDeposit(address(0));\n\n return mintAmount == type(uint256).max ? mintAmount : convertToShares(mintAmount);\n }\n\n /// @notice maximum amount of underlying tokens that can be withdrawn\n /// @param owner The address that owns the shares\n function maxWithdraw(address owner) public view override returns (uint256) {\n uint256 cash = cToken.getCash();\n uint256 assetsBalance = convertToAssets(balanceOf(owner));\n return cash < assetsBalance ? cash : assetsBalance;\n }\n\n /// @notice maximum amount of shares that can be withdrawn\n /// @param owner The address that owns the shares\n function maxRedeem(address owner) public view override returns (uint256) {\n uint256 cash = cToken.getCash();\n uint256 cashInShares = convertToShares(cash);\n uint256 shareBalance = balanceOf(owner);\n return cashInShares < shareBalance ? cashInShares : shareBalance;\n }\n\n /* ========== REWARDS FUNCTIONS ========== */\n\n function updateRewardsRecipient(address newRewardsRecipient) external onlyOwner {\n emit UpdatedRewardsRecipient(rewardsRecipient, newRewardsRecipient);\n rewardsRecipient = newRewardsRecipient;\n }\n\n function claimRewards() external {\n (address[] memory tokens, uint256[] memory amounts) = flywheelLensRouter.claimAllRewardTokens(address(this));\n for (uint256 i = 0; i < tokens.length; i++) {\n _asset().safeTransfer(rewardsRecipient, amounts[i]);\n }\n }\n\n /* ========== EMERGENCY FUNCTIONS ========== */\n\n // Should withdraw all funds from the strategy and pause the contract\n function emergencyWithdrawAndPause() external override onlyOwner {\n _pause();\n }\n\n function unpause() external override onlyOwner {\n _unpause();\n }\n\n /* ========== INTERNAL HOOKS LOGIC ========== */\n\n function beforeWithdraw(uint256 assets, uint256 /*shares*/) internal override {\n /// -----------------------------------------------------------------------\n /// Withdraw assets from Ionic\n /// -----------------------------------------------------------------------\n\n uint256 errorCode = cToken.redeemUnderlying(assets);\n if (errorCode != uint256(ComptrollerErrorReporter.Error.NO_ERROR)) {\n revert IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error(errorCode));\n }\n }\n\n function afterDeposit(uint256 assets, uint256 /*shares*/) internal override {\n /// -----------------------------------------------------------------------\n /// Deposit assets into Ionic\n /// -----------------------------------------------------------------------\n\n // approve to cToken\n _asset().safeApprove(address(cToken), assets);\n\n // deposit into cToken\n uint256 errorCode = cToken.mint(assets);\n if (errorCode != uint256(ComptrollerErrorReporter.Error.NO_ERROR)) {\n revert IonicMarketERC4626__CompoundError(ComptrollerErrorReporter.Error(errorCode));\n }\n }\n}\n" + }, + "contracts/ionic/strategies/MockERC4626.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\n/**\n * @title Mock ERC4626 Contract\n * @notice ERC4626 wrapper for Tribe Token\n * @author carlomazzaferro\n *\n */\ncontract MockERC4626 is ERC4626 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /**\n @notice Creates a new Vault that accepts a specific underlying token.\n @param _asset The ERC20 compliant token the Vault should accept.\n */\n constructor(ERC20 _asset)\n ERC4626(\n _asset,\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", _asset.symbol()))\n )\n {}\n\n /* ========== VIEWS ========== */\n\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\n /// @return The total amount of underlying tokens the Vault holds.\n function totalAssets() public view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @notice Calculates the total amount of underlying tokens the user holds.\n /// @return The total amount of underlying tokens the user holds.\n function balanceOfUnderlying(address account) public view returns (uint256) {\n return convertToAssets(balanceOf[account]);\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function afterDeposit(uint256 amount, uint256) internal override {}\n\n function beforeWithdraw(uint256, uint256 shares) internal override {}\n}\n" + }, + "contracts/ionic/strategies/MockERC4626Dynamic.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { IonicFlywheelCore } from \"./flywheel/IonicFlywheelCore.sol\";\n\n/**\n * @title Mock ERC4626 Contract\n * @notice ERC4626 wrapper for Tribe Token\n * @author carlomazzaferro\n *\n */\ncontract MockERC4626Dynamic is ERC4626 {\n using FixedPointMathLib for uint256;\n\n /* ========== STATE VARIABLES ========== */\n IonicFlywheelCore public immutable flywheel;\n\n /* ========== INITIALIZER ========== */\n\n /**\n @notice Initializes the Vault.\n @param _asset The ERC20 compliant token the Vault should accept.\n @param _flywheel Flywheel to pull in rewardsToken\n */\n constructor(ERC20 _asset, IonicFlywheelCore _flywheel)\n ERC4626(\n _asset,\n string(abi.encodePacked(\"Midas \", _asset.name(), \" Vault\")),\n string(abi.encodePacked(\"mv\", _asset.symbol()))\n )\n {\n flywheel = _flywheel;\n }\n\n /* ========== VIEWS ========== */\n\n /// @notice Calculates the total amount of underlying tokens the Vault holds.\n /// @return The total amount of underlying tokens the Vault holds.\n function totalAssets() public view override returns (uint256) {\n return asset.balanceOf(address(this));\n }\n\n /// @notice Calculates the total amount of underlying tokens the user holds.\n /// @return The total amount of underlying tokens the user holds.\n function balanceOfUnderlying(address account) public view returns (uint256) {\n return convertToAssets(balanceOf[account]);\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function afterDeposit(uint256 amount, uint256) internal override {}\n\n function beforeWithdraw(uint256, uint256 shares) internal override {}\n}\n" + }, + "contracts/IonicLiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./utils/IW_NATIVE.sol\";\n\nimport \"./external/uniswap/IUniswapV2Router02.sol\";\nimport \"./external/uniswap/IUniswapV2Pair.sol\";\nimport \"./external/uniswap/IUniswapV2Callee.sol\";\nimport \"./external/uniswap/UniswapV2Library.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicLiquidator\n * @author David Lucid (https://github.com/davidlucid)\n * @notice IonicLiquidator safely liquidates unhealthy borrowers (with flashloan support).\n * @dev Do not transfer NATIVE or tokens directly to this address. Only send NATIVE here when using a method, and only approve tokens for transfer to here when using a method. Direct NATIVE transfers will be rejected and direct token transfers will be lost.\n */\ncontract IonicLiquidator is OwnableUpgradeable, ILiquidator, IUniswapV2Callee, IExpressRelayFeeReceiver {\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n\n /**\n * @dev W_NATIVE contract address.\n */\n address public W_NATIVE_ADDRESS;\n\n /**\n * @dev UniswapV2Router02 contract object. (Is interchangable with any UniV2 forks)\n */\n IUniswapV2Router02 public UNISWAP_V2_ROUTER_02;\n\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n mapping(address => bool) public redemptionStrategiesWhitelist;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n /**\n * @dev Percentage of the flash swap fee, measured in basis points.\n */\n uint8 public flashSwapFee;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _uniswapV2router, uint8 _flashSwapFee) external initializer {\n __Ownable_init();\n require(_uniswapV2router != address(0), \"_uniswapV2router not defined.\");\n W_NATIVE_ADDRESS = _wtoken;\n UNISWAP_V2_ROUTER_02 = IUniswapV2Router02(_uniswapV2router);\n flashSwapFee = _flashSwapFee;\n }\n\n function _becomeImplementation(bytes calldata data) external {}\n\n /**\n * @dev Internal function to approve unlimited tokens of `erc20Contract` to `to`.\n */\n function safeApprove(IERC20Upgradeable token, address to, uint256 minAmount) private {\n uint256 allowance = token.allowance(address(this), to);\n\n if (allowance < minAmount) {\n if (allowance > 0) token.safeApprove(to, 0);\n token.safeApprove(to, type(uint256).max);\n }\n }\n\n /**\n * @dev Internal function to approve\n */\n function justApprove(IERC20Upgradeable token, address to, uint256 amount) private {\n token.approve(to, amount);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n justApprove(underlying, address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan, confirming that at least `minProfitAmount` in NATIVE profit is seized.\n * @param vars @see LiquidateToTokensWithFlashSwapVars.\n */\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV2Pair flashSwapPair = IUniswapV2Pair(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPair.token0() == address(fundingToken);\n flashSwapPair.swap(\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n address(this),\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n function uniswapV2Call(address, uint256, uint256, bytes calldata data) public override {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars);\n }\n\n /**\n * @dev Callback function for PCS flashloans.\n */\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uniswapV2Call(sender, amount0, amount1, data);\n }\n\n function moraswapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uniswapV2Call(sender, amount0, amount1, data);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(LiquidateToTokensWithFlashSwapVars memory vars) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n justApprove(IERC20Upgradeable(underlyingBorrow), address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData\n ) private returns (address) {\n // Calculate flashloan return amount\n uint256 flashSwapReturnAmount = (_flashSwapAmount * 10000) / (10000 - flashSwapFee);\n if ((_flashSwapAmount * 10000) % (10000 - flashSwapFee) > 0) flashSwapReturnAmount++; // Round up if division resulted in a remainder\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n IUniswapV2Pair pair = IUniswapV2Pair(msg.sender);\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pair.token0() || address(underlyingCollateral) == pair.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay amount for the borrow side\n collateralRequired = flashSwapReturnAmount;\n } else {\n // repay amount for the non-borrow side\n collateralRequired = UniswapV2Library.getAmountsIn(\n UNISWAP_V2_ROUTER_02.factory(),\n _flashSwapAmount, //flashSwapReturnAmount,\n array(address(underlyingCollateral), _flashSwapToken),\n flashSwapFee\n )[0];\n }\n\n // Repay flashloan\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n require(\n underlyingCollateral.transfer(msg.sender, collateralRequired),\n \"Failed to repay token flashloan on borrow side.\"\n );\n\n return address(underlyingCollateral);\n } else {\n // exchange the collateral to W_NATIVE to repay the borrow side\n uint256 wethRequired;\n if (_flashSwapToken == W_NATIVE_ADDRESS) {\n wethRequired = flashSwapReturnAmount;\n } else {\n // Get W_NATIVE required to repay flashloan\n wethRequired = UniswapV2Library.getAmountsIn(\n UNISWAP_V2_ROUTER_02.factory(),\n flashSwapReturnAmount,\n array(W_NATIVE_ADDRESS, _flashSwapToken),\n flashSwapFee\n )[0];\n }\n\n if (address(underlyingCollateral) != W_NATIVE_ADDRESS) {\n // Approve to Uniswap router\n justApprove(underlyingCollateral, address(UNISWAP_V2_ROUTER_02), underlyingCollateralSeized);\n\n // Swap collateral tokens for W_NATIVE to be repaid via Uniswap router\n UNISWAP_V2_ROUTER_02.swapTokensForExactTokens(\n wethRequired,\n underlyingCollateralSeized,\n array(address(underlyingCollateral), W_NATIVE_ADDRESS),\n address(this),\n block.timestamp\n );\n }\n\n // Repay flashloan\n require(\n wethRequired <= IERC20Upgradeable(W_NATIVE_ADDRESS).balanceOf(address(this)),\n \"Not enough W_NATIVE exchanged from seized collateral to repay flashloan.\"\n );\n require(\n IW_NATIVE(W_NATIVE_ADDRESS).transfer(msg.sender, wethRequired),\n \"Failed to repay Uniswap flashloan with W_NATIVE exchanged from seized collateral.\"\n );\n\n // Return the profited token (underlying collateral if same as exchangeProfitTo; otherwise, W_NATIVE)\n return address(underlyingCollateral);\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n\n /**\n * @dev Returns an array containing the parameters supplied.\n */\n function array(address a, address b) private pure returns (address[] memory) {\n address[] memory arr = new address[](2);\n arr[0] = a;\n arr[1] = b;\n return arr;\n }\n}\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicUniV3Liquidator\n * @author Veliko Minkov (https://github.com/vminkov)\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\n */\ncontract IonicUniV3Liquidator is\n OwnableUpgradeable,\n ILiquidator,\n IUniswapV3FlashCallback,\n IExpressRelayFeeReceiver,\n IFlashLoanReceiver\n{\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n\n address public W_NATIVE_ADDRESS;\n mapping(address => bool) public redemptionStrategiesWhitelist;\n IUniswapV3Quoter public quoter;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _quoter) external initializer {\n __Ownable_init();\n W_NATIVE_ADDRESS = _wtoken;\n quoter = IUniswapV3Quoter(_quoter);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n underlying.approve(address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\n flashSwapPool.flash(\n address(this),\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(\n LiquidateToTokensWithFlashSwapVars memory vars,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\n uint256 flashSwapReturnAmount = _flashSwapAmount;\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\n flashSwapReturnAmount += fee0;\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\n flashSwapReturnAmount += fee1;\n } else {\n revert(\"wrong pool or _flashSwapToken\");\n }\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay the borrowed asset directly\n collateralRequired = flashSwapReturnAmount;\n\n // Repay flashloan\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\n } else {\n // TODO swap within the same pool and then repay the FL to the pool\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\n\n {\n collateralRequired = quoter.quoteExactOutputSingle(\n zeroForOne ? pool.token0() : pool.token1(),\n zeroForOne ? pool.token1() : pool.token0(),\n pool.fee(),\n _flashSwapAmount,\n 0 // sqrtPriceLimitX96\n );\n }\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n\n // Repay flashloan\n pool.swap(\n address(pool),\n zeroForOne,\n int256(collateralRequired),\n 0, // sqrtPriceLimitX96\n \"\"\n );\n }\n\n return address(underlyingCollateral);\n } else {\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/liquidators/AerodromeCLLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { ISwapRouter_Aerodrome } from \"../external/aerodrome/IAerodromeSwapRouter.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\ncontract AerodromeCLLiquidator is IRedemptionStrategy {\n /**\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\n * @param inputToken Address of the token\n * @param inputAmount input amount\n * @param strategyData context specific data like input token, pool address and tx expiratio period\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (\n ,\n address _outputToken,\n ISwapRouter_Aerodrome swapRouter,\n address _unwrappedInput,\n address _unwrappedOutput,\n int24 _tickSpacing\n ) = abi.decode(strategyData, (address, address, ISwapRouter_Aerodrome, address, address, int24));\n if (_unwrappedOutput != address(0)) {\n outputToken = IERC20Upgradeable(_unwrappedOutput);\n } else {\n outputToken = IERC20Upgradeable(_outputToken);\n }\n\n if (_unwrappedInput != address(0)) {\n inputToken.approve(address(inputToken), inputAmount);\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n inputToken = IERC20Upgradeable(_unwrappedInput);\n }\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n outputAmount = swapRouter.exactInputSingle(\n ISwapRouter_Aerodrome.ExactInputSingleParams(\n address(inputToken),\n address(outputToken),\n _tickSpacing,\n address(this),\n block.timestamp,\n inputAmount,\n 0,\n 0\n )\n );\n\n if (_unwrappedOutput != address(0)) {\n IERC20Upgradeable(_unwrappedOutput).approve(address(_outputToken), outputAmount);\n IERC4626(_outputToken).deposit(outputAmount, address(this));\n outputAmount = IERC4626(_unwrappedOutput).balanceOf(address(this));\n outputToken = IERC20Upgradeable(_outputToken);\n }\n }\n\n function name() public pure virtual override returns (string memory) {\n return \"AerodromeCLLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/AerodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\n\n/**\n * @title AerodromeV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Aerodrome V2 router for use as a step in a liquidation.\n */\ncontract AerodromeV2Liquidator {\n function _swap(IRouter_Aerodrome router, uint256 inputAmount, IRouter_Aerodrome.Route[] memory swapPath) internal {\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"AerodromeV2Liquidator\";\n }\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IRouter_Aerodrome router, IRouter_Aerodrome.Route[] memory swapPath) = abi.decode(\n strategyData,\n (IRouter_Aerodrome, IRouter_Aerodrome.Route[])\n );\n require(\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\n \"Invalid AerodromeV2Liquidator swap path.\"\n );\n\n // Swap underlying tokens\n inputToken.approve(address(router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\n outputAmount = outputToken.balanceOf(address(this));\n }\n}\n" + }, + "contracts/liquidators/AlgebraSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"../external/algebra/ISwapRouter.sol\";\n\n/**\n * @title AlgebraSwapLiquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Algebra router for use as a step in a liquidation.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract AlgebraSwapLiquidator is IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (address _outputToken, IAlgebraSwapRouter swapRouter) = abi.decode(strategyData, (address, IAlgebraSwapRouter));\n outputToken = IERC20Upgradeable(_outputToken);\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n IAlgebraSwapRouter.ExactInputSingleParams memory params = IAlgebraSwapRouter.ExactInputSingleParams(\n address(inputToken),\n _outputToken,\n address(this),\n block.timestamp,\n inputAmount,\n 0, // amountOutMinimum\n 0 // limitSqrtPrice\n );\n\n outputAmount = swapRouter.exactInputSingle(params);\n }\n\n function name() public pure returns (string memory) {\n return \"AlgebraSwapLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/BaseUniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\n\nimport \"./IRedemptionStrategy.sol\";\n\nabstract contract BaseUniswapV2Liquidator is IRedemptionStrategy {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\n strategyData,\n (IUniswapV2Router02, address[])\n );\n require(swapPath.length >= 2 && swapPath[0] == address(inputToken), \"Invalid UniswapLiquidator swap path.\");\n\n // Swap underlying tokens\n inputToken.approve(address(uniswapV2Router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(uniswapV2Router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1]);\n outputAmount = outputToken.balanceOf(address(this));\n }\n\n function _swap(IUniswapV2Router02 uniswapV2Router, uint256 inputAmount, address[] memory swapPath) internal virtual;\n}\n" + }, + "contracts/liquidators/CurveSwapLiquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport \"../external/curve/ICurvePool.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\nimport \"./IRedemptionStrategy.sol\";\n\nimport \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\n\n/**\n * @title CurveSwapLiquidator\n * @notice Swaps seized token collateral via Curve as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract CurveSwapLiquidator is IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable, uint256) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\n address outputTokenAddress,\n address _unwrappedInput,\n address _unwrappedOutput\n ) = abi.decode(strategyData, (CurveV2LpTokenPriceOracleNoRegistry, address, address, address));\n\n if (_unwrappedOutput != address(0)) {\n outputToken = IERC20Upgradeable(_unwrappedOutput);\n } else {\n outputToken = IERC20Upgradeable(outputTokenAddress);\n }\n\n if (_unwrappedInput != address(0)) {\n inputToken.approve(address(inputToken), inputAmount);\n inputAmount = IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n inputToken = IERC20Upgradeable(_unwrappedInput);\n }\n\n address inputTokenAddress = address(inputToken);\n\n ICurvePool curvePool;\n int128 i;\n int128 j;\n if (address(curveV2Oracle) != address(0)) {\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, address(outputToken));\n }\n require(address(curvePool) != address(0), \"!curve pool\");\n\n inputToken.approve(address(curvePool), inputAmount);\n outputAmount = curvePool.exchange(i, j, inputAmount, 0);\n\n if (_unwrappedOutput != address(0)) {\n IERC20Upgradeable(_unwrappedOutput).approve(address(outputTokenAddress), outputAmount);\n IERC4626(outputTokenAddress).deposit(outputAmount, address(this));\n outputToken = IERC20Upgradeable(outputTokenAddress);\n }\n\n outputAmount = outputToken.balanceOf(address(this));\n return (outputToken, outputAmount);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"CurveSwapLiquidator\";\n }\n}\n" + }, + "contracts/liquidators/CurveSwapLiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CurveSwapLiquidator.sol\";\nimport \"./IFundsConversionStrategy.sol\";\n\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\ncontract CurveSwapLiquidatorFunder is CurveSwapLiquidator, IFundsConversionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable, uint256) {\n ICurvePool curvePool;\n int128 i;\n int128 j;\n {\n (\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle,\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle,\n address inputTokenAddress,\n address outputTokenAddress,\n\n ) = abi.decode(\n strategyData,\n (CurveLpTokenPriceOracleNoRegistry, CurveV2LpTokenPriceOracleNoRegistry, address, address, address)\n );\n\n if (address(curveV2Oracle) != address(0)) {\n (curvePool, i, j) = curveV2Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\n }\n if (address(curvePool) == address(0)) {\n (curvePool, i, j) = curveV1Oracle.getPoolForSwap(inputTokenAddress, outputTokenAddress);\n }\n }\n require(address(curvePool) != address(0), \"!curve pool\");\n\n IERC20MetadataUpgradeable inputMetadataToken = IERC20MetadataUpgradeable(curvePool.coins(uint256(int256(i))));\n uint256 inputAmountGuesstimate = guesstimateInputAmount(curvePool, i, j, inputMetadataToken, outputAmount);\n uint256 inputAmount = binSearch(\n curvePool,\n i,\n j,\n (70 * inputAmountGuesstimate) / 100,\n (130 * inputAmountGuesstimate) / 100,\n outputAmount\n );\n\n return (inputMetadataToken, inputAmount);\n }\n\n function guesstimateInputAmount(\n ICurvePool curvePool,\n int128 i,\n int128 j,\n IERC20MetadataUpgradeable inputMetadataToken,\n uint256 outputAmount\n ) internal view returns (uint256) {\n uint256 oneInputToken = 10 ** inputMetadataToken.decimals();\n uint256 outputTokensForOneInputToken = curvePool.get_dy(i, j, oneInputToken);\n // inputAmount / outputAmount = oneInputToken / outputTokensForOneInputToken\n uint256 inputAmount = (outputAmount * oneInputToken) / outputTokensForOneInputToken;\n return inputAmount;\n }\n\n function binSearch(\n ICurvePool curvePool,\n int128 i,\n int128 j,\n uint256 low,\n uint256 high,\n uint256 value\n ) internal view returns (uint256) {\n if (low >= high) return low;\n\n uint256 mid = (low + high) / 2;\n uint256 outputAmount = curvePool.get_dy(i, j, mid);\n if (outputAmount == 0) revert(\"output amount 0\");\n // output can be up to 10% in excess\n if (outputAmount >= value && outputAmount <= (11 * value) / 10) return mid;\n else if (outputAmount > value) {\n return binSearch(curvePool, i, j, low, mid, value);\n } else {\n return binSearch(curvePool, i, j, mid, high, value);\n }\n }\n\n function name() public pure override(CurveSwapLiquidator, IRedemptionStrategy) returns (string memory) {\n return \"CurveSwapLiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/ERC4626Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\n\n/**\n * @title ERC4626Liquidator\n * @notice Redeems ERC4626 assets and optionally swaps them via Uniswap V2 router for use as a step in a liquidation.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract ERC4626Liquidator is IRedemptionStrategy {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IERC20Upgradeable _outputToken, uint24 fee, ISwapRouter swapRouter, address[] memory underlyingTokens, ) = abi\n .decode(strategyData, (IERC20Upgradeable, uint24, ISwapRouter, address[], Quoter));\n\n if (underlyingTokens.length == 1) {\n // If there is only one underlying token, we can just redeem it directly\n require(\n address(_outputToken) == underlyingTokens[0],\n \"ERC4626Liquidator: output token does not match underlying token\"\n );\n\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n outputAmount = IERC20Upgradeable(_outputToken).balanceOf(address(this));\n\n return (_outputToken, outputAmount);\n } else {\n // NOTE: for Sommelier, the underlying tokens can be fetched from the Sommelier contract\n // E.g. https://etherscan.io/address/0x6b7f87279982d919bbf85182ddeab179b366d8f2#readContract#F20\n IERC4626(address(inputToken)).redeem(inputAmount, address(this), address(this));\n\n // for each token, we need to swap it for the output token\n for (uint256 i = 0; i < underlyingTokens.length; i++) {\n // do nothing if the token is the output token\n if (underlyingTokens[i] == address(_outputToken)) {\n continue;\n }\n if (IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)) == 0) {\n continue;\n }\n _swap(\n underlyingTokens[i],\n IERC20Upgradeable(underlyingTokens[i]).balanceOf(address(this)),\n address(_outputToken),\n swapRouter,\n fee\n );\n }\n outputAmount = _outputToken.balanceOf(address(this));\n return (_outputToken, outputAmount);\n }\n }\n\n function _swap(\n address inputToken,\n uint256 inputAmount,\n address outputToken,\n ISwapRouter swapRouter,\n uint24 fee\n ) internal returns (uint256 outputAmount) {\n IERC20Upgradeable(inputToken).approve(address(swapRouter), inputAmount);\n\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams(\n address(inputToken),\n outputToken,\n fee,\n address(this),\n block.timestamp,\n inputAmount,\n 0,\n 0\n );\n outputAmount = swapRouter.exactInputSingle(params);\n }\n\n function name() public pure returns (string memory) {\n return \"ERC4626Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFundsConversionStrategy is IRedemptionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\n}\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @title IRedemptionStrategy\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function name() external view returns (string memory);\n}\n" + }, + "contracts/liquidators/KimUniV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./BaseUniswapV2Liquidator.sol\";\n\ncontract KimUniV2Liquidator is BaseUniswapV2Liquidator {\n function _swap(\n IUniswapV2Router02 uniswapV2Router,\n uint256 inputAmount,\n address[] memory swapPath\n ) internal override {\n uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n inputAmount,\n 0,\n swapPath,\n address(this),\n address(0), // referrer\n block.timestamp\n );\n }\n\n function name() public pure virtual returns (string memory) {\n return \"KimUniV2Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/registry/ILiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ILiquidatorsRegistryStorage {\n function redemptionStrategiesByName(string memory name) external view returns (IRedemptionStrategy);\n\n function redemptionStrategiesByTokens(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy);\n\n function defaultOutputToken(IERC20Upgradeable inputToken) external view returns (IERC20Upgradeable);\n\n function owner() external view returns (address);\n\n function uniswapV3Fees(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external view returns (uint24);\n\n function customUniV3Router(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (address);\n}\n\ninterface ILiquidatorsRegistryExtension {\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory);\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData);\n\n function getRedemptionStrategy(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IRedemptionStrategy strategy, bytes memory strategyData);\n\n function getAllRedemptionStrategies() external view returns (address[] memory);\n\n function getSlippage(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (uint256 slippage);\n\n function swap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256);\n\n function amountOutAndSlippageOfSwap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256 outputAmount, uint256 slippage);\n}\n\ninterface ILiquidatorsRegistrySecondExtension {\n function getAllPairsStrategies()\n external\n view\n returns (\n IRedemptionStrategy[] memory strategies,\n IERC20Upgradeable[] memory inputTokens,\n IERC20Upgradeable[] memory outputTokens\n );\n\n function pairsStrategiesMatch(\n IRedemptionStrategy[] calldata configStrategies,\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens\n ) external view returns (bool);\n\n function uniswapPairsFeesMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n uint256[] calldata configFees\n ) external view returns (bool);\n\n function uniswapPairsRoutersMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n address[] calldata configRouters\n ) external view returns (bool);\n\n function _setRedemptionStrategy(\n IRedemptionStrategy strategy,\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external;\n\n function _setRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external;\n\n function _resetRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external;\n\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external;\n\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external;\n\n function _setUniswapV3Fees(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint24[] calldata fees\n ) external;\n\n function _setUniswapV3Routers(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n address[] calldata routers\n ) external;\n\n function _setSlippages(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint256[] calldata slippages\n ) external;\n\n function optimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (IERC20Upgradeable[] memory);\n\n function _setOptimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken,\n IERC20Upgradeable[] calldata optimalPath\n ) external;\n\n function wrappedToUnwrapped4626(address wrapped) external view returns (address);\n\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external;\n\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24);\n\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external;\n\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool);\n\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external;\n}\n\ninterface ILiquidatorsRegistry is\n ILiquidatorsRegistryExtension,\n ILiquidatorsRegistrySecondExtension,\n ILiquidatorsRegistryStorage\n{}\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistry.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../../ionic/DiamondExtension.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\nimport \"./LiquidatorsRegistryExtension.sol\";\n\ncontract LiquidatorsRegistry is LiquidatorsRegistryStorage, DiamondBase {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(AddressesProvider _ap) SafeOwnable() {\n ap = _ap;\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace)\n public\n override\n onlyOwner\n {\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n\n function asExtension() public view returns (LiquidatorsRegistryExtension) {\n return LiquidatorsRegistryExtension(address(this));\n }\n}\n" + }, + "contracts/liquidators/registry/LiquidatorsRegistryExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"./ILiquidatorsRegistry.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\n\nimport \"../IRedemptionStrategy.sol\";\nimport \"../../ionic/DiamondExtension.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\n\nimport { IRouter_Aerodrome as IAerodromeV2Router } from \"../../external/aerodrome/IAerodromeRouter.sol\";\nimport { IRouter_Velodrome as IVelodromeV2Router } from \"../../external/velodrome/IVelodromeRouter.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract LiquidatorsRegistryExtension is LiquidatorsRegistryStorage, DiamondExtension, ILiquidatorsRegistryExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n error NoRedemptionPath();\n error OutputTokenMismatch();\n\n event SlippageUpdated(\n IERC20Upgradeable indexed from,\n IERC20Upgradeable indexed to,\n uint256 prevValue,\n uint256 newValue\n );\n\n // @notice maximum slippage in swaps, in bps\n uint256 public constant MAX_SLIPPAGE = 900; // 9%\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 7;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.getRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this.getInputTokensByOutputToken.selector;\n functionSelectors[--fnsCount] = this.swap.selector;\n functionSelectors[--fnsCount] = this.getAllRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.amountOutAndSlippageOfSwap.selector;\n functionSelectors[--fnsCount] = this.getSlippage.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function getSlippage(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) external view returns (uint256 slippage) {\n slippage = conversionSlippage[inputToken][outputToken];\n // TODO slippage == 0 should be allowed\n if (slippage == 0) return MAX_SLIPPAGE;\n }\n\n function getAllRedemptionStrategies() public view returns (address[] memory) {\n return redemptionStrategies.values();\n }\n\n function amountOutAndSlippageOfSwap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) external returns (uint256 outputAmount, uint256 slippage) {\n if (inputAmount == 0) return (0, 0);\n\n outputAmount = swap(inputToken, inputAmount, outputToken);\n if (outputAmount == 0) return (0, 0);\n\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n uint256 inputTokenPrice = mpo.price(address(inputToken));\n uint256 outputTokenPrice = mpo.price(address(outputToken));\n\n uint256 inputTokensValue = inputAmount * toScaledPrice(inputTokenPrice, inputToken);\n uint256 outputTokensValue = outputAmount * toScaledPrice(outputTokenPrice, outputToken);\n\n if (outputTokensValue < inputTokensValue) {\n slippage = ((inputTokensValue - outputTokensValue) * 10000) / inputTokensValue;\n }\n // min slippage should be non-zero\n // just in case of rounding errors\n slippage += 1;\n\n // cache the slippage\n uint256 prevValue = conversionSlippage[inputToken][outputToken];\n if (prevValue == 0 || block.timestamp - conversionSlippageUpdated[inputToken][outputToken] > 5000) {\n emit SlippageUpdated(inputToken, outputToken, prevValue, slippage);\n\n conversionSlippage[inputToken][outputToken] = slippage;\n conversionSlippageUpdated[inputToken][outputToken] = block.timestamp;\n }\n }\n\n /// @dev returns price scaled to 1e36 - decimals\n function toScaledPrice(uint256 unscaledPrice, IERC20Upgradeable token) internal view returns (uint256) {\n uint256 tokenDecimals = uint256(ERC20Upgradeable(address(token)).decimals());\n return\n tokenDecimals <= 18\n ? uint256(unscaledPrice) * (10 ** (18 - tokenDecimals))\n : uint256(unscaledPrice) / (10 ** (tokenDecimals - 18));\n }\n\n function swap(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken\n ) public returns (uint256 outputAmount) {\n inputToken.safeTransferFrom(msg.sender, address(this), inputAmount);\n outputAmount = convertAllTo(inputToken, outputToken);\n outputToken.safeTransfer(msg.sender, outputAmount);\n }\n\n function convertAllTo(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) private returns (uint256) {\n uint256 inputAmount = inputToken.balanceOf(address(this));\n (IRedemptionStrategy[] memory redemptionStrategies, bytes[] memory strategiesData) = getRedemptionStrategies(\n inputToken,\n outputToken\n );\n\n if (redemptionStrategies.length == 0) revert NoRedemptionPath();\n\n IERC20Upgradeable swapInputToken = inputToken;\n uint256 swapInputAmount = inputAmount;\n for (uint256 i = 0; i < redemptionStrategies.length; i++) {\n IRedemptionStrategy redemptionStrategy = redemptionStrategies[i];\n bytes memory strategyData = strategiesData[i];\n (IERC20Upgradeable swapOutputToken, uint256 swapOutputAmount) = convertCustomFunds(\n swapInputToken,\n swapInputAmount,\n redemptionStrategy,\n strategyData\n );\n swapInputAmount = swapOutputAmount;\n swapInputToken = swapOutputToken;\n }\n\n if (swapInputToken != outputToken) revert OutputTokenMismatch();\n return outputToken.balanceOf(address(this));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n\n function getInputTokensByOutputToken(IERC20Upgradeable outputToken) external view returns (address[] memory) {\n return inputTokensByOutputToken[outputToken].values();\n }\n\n function getRedemptionStrategies(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public view returns (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) {\n IERC20Upgradeable tokenToRedeem = inputToken;\n IERC20Upgradeable targetOutputToken = outputToken;\n IRedemptionStrategy[] memory strategiesTemp = new IRedemptionStrategy[](10);\n bytes[] memory strategiesDataTemp = new bytes[](10);\n IERC20Upgradeable[] memory tokenPath = new IERC20Upgradeable[](10);\n IERC20Upgradeable[] memory optimalPath = new IERC20Upgradeable[](0);\n uint256 optimalPathIterator = 0;\n\n uint256 k = 0;\n while (tokenToRedeem != targetOutputToken) {\n IERC20Upgradeable nextRedeemedToken;\n IRedemptionStrategy directStrategy = redemptionStrategiesByTokens[tokenToRedeem][targetOutputToken];\n if (address(directStrategy) != address(0)) {\n nextRedeemedToken = targetOutputToken;\n } else {\n // check if an optimal path is preconfigured\n if (optimalPath.length == 0 && _optimalSwapPath[tokenToRedeem][targetOutputToken].length != 0) {\n optimalPath = _optimalSwapPath[tokenToRedeem][targetOutputToken];\n }\n if (optimalPath.length != 0 && optimalPathIterator < optimalPath.length) {\n nextRedeemedToken = optimalPath[optimalPathIterator++];\n } else {\n // else if no optimal path is available, use the default\n nextRedeemedToken = defaultOutputToken[tokenToRedeem];\n }\n }\n\n // check if going in an endless loop\n for (uint256 i = 0; i < tokenPath.length; i++) {\n if (nextRedeemedToken == tokenPath[i]) break;\n }\n\n (IRedemptionStrategy strategy, bytes memory strategyData) = getRedemptionStrategy(\n tokenToRedeem,\n nextRedeemedToken\n );\n if (address(strategy) == address(0)) break;\n\n strategiesTemp[k] = strategy;\n strategiesDataTemp[k] = strategyData;\n tokenPath[k] = nextRedeemedToken;\n tokenToRedeem = nextRedeemedToken;\n\n k++;\n if (k == 10) break;\n }\n\n strategies = new IRedemptionStrategy[](k);\n strategiesData = new bytes[](k);\n\n for (uint8 i = 0; i < k; i++) {\n strategies[i] = strategiesTemp[i];\n strategiesData[i] = strategiesDataTemp[i];\n }\n }\n\n function getRedemptionStrategy(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public view returns (IRedemptionStrategy strategy, bytes memory strategyData) {\n strategy = redemptionStrategiesByTokens[inputToken][outputToken];\n\n if (isStrategy(strategy, \"UniswapV2LiquidatorFunder\") || isStrategy(strategy, \"KimUniV2Liquidator\")) {\n strategyData = uniswapV2LiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"UniswapV3LiquidatorFunder\")) {\n strategyData = uniswapV3LiquidatorFunderData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AlgebraSwapLiquidator\")) {\n strategyData = algebraSwapLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AerodromeV2Liquidator\")) {\n strategyData = aerodromeV2LiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"AerodromeCLLiquidator\")) {\n strategyData = aerodromeCLLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"CurveSwapLiquidator\")) {\n strategyData = curveSwapLiquidatorData(inputToken, outputToken);\n } else if (isStrategy(strategy, \"VelodromeV2Liquidator\")) {\n strategyData = velodromeV2LiquidatorData(inputToken, outputToken);\n } else {\n revert(\"no strategy data\");\n }\n }\n\n function isStrategy(IRedemptionStrategy strategy, string memory name) internal view returns (bool) {\n return address(strategy) != address(0) && address(strategy) == address(redemptionStrategiesByName[name]);\n }\n\n function pickPreferredToken(address[] memory tokens, address strategyOutputToken) internal view returns (address) {\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == strategyOutputToken) return strategyOutputToken;\n }\n address wnative = ap.getAddress(\"wtoken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wnative) return wnative;\n }\n address stableToken = ap.getAddress(\"stableToken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == stableToken) return stableToken;\n }\n address wbtc = ap.getAddress(\"wBTCToken\");\n for (uint256 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wbtc) return wbtc;\n }\n return tokens[0];\n }\n\n function getUniswapV3Router(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (address) {\n address customRouter = customUniV3Router[inputToken][outputToken];\n if (customRouter == address(0)) {\n customRouter = customUniV3Router[outputToken][inputToken];\n }\n\n if (customRouter != address(0)) {\n return customRouter;\n } else {\n // get asset specific router or default\n return ap.getAddress(\"UNISWAP_V3_ROUTER\");\n }\n }\n\n function getUniswapV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"IUniswapV2Router02\");\n }\n\n function getAerodromeV2Router(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"AERODROME_V2_ROUTER\");\n }\n\n function getAerodromeCLRouter(IERC20Upgradeable inputToken) internal view returns (address) {\n // get asset specific router or default\n return ap.getAddress(\"AERODROME_CL_ROUTER\");\n }\n\n function uniswapV3LiquidatorFunderData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n uint24 fee = uniswapV3Fees[inputToken][outputToken];\n if (fee == 0) fee = uniswapV3Fees[outputToken][inputToken];\n if (fee == 0) fee = 500;\n\n address router = getUniswapV3Router(inputToken, outputToken);\n strategyData = abi.encode(inputToken, outputToken, fee, router, ap.getAddress(\"Quoter\"));\n }\n\n function getWrappedToUnwrapped4626(IERC20Upgradeable inputToken) internal view returns (address) {\n return _wrappedToUnwrapped4626[address(inputToken)];\n }\n\n function getAeroCLTickSpacing(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (int24) {\n int24 tickSpacing = _aeroCLTickSpacings[address(inputToken)][address(outputToken)];\n if (tickSpacing == 0) {\n tickSpacing = 1;\n }\n return tickSpacing;\n }\n\n function aeroV2IsStable(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) internal view returns (bool) {\n return _aeroV2IsStable[address(inputToken)][address(outputToken)];\n }\n\n function uniswapV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IERC20Upgradeable[] memory swapPath = new IERC20Upgradeable[](2);\n swapPath[0] = inputToken;\n swapPath[1] = outputToken;\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\n }\n\n function aerodromeV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IAerodromeV2Router.Route[] memory swapPath = new IAerodromeV2Router.Route[](1);\n swapPath[0] = IAerodromeV2Router.Route({\n from: address(inputToken),\n to: address(outputToken),\n stable: aeroV2IsStable(inputToken, outputToken),\n factory: ap.getAddress(\"AERODROME_V2_FACTORY\")\n });\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\n }\n\n function aerodromeCLLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(\n inputToken,\n outputToken,\n getAerodromeCLRouter(inputToken),\n getWrappedToUnwrapped4626(inputToken),\n getWrappedToUnwrapped4626(outputToken),\n getAeroCLTickSpacing(inputToken, outputToken)\n );\n }\n\n function algebraSwapLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(outputToken, ap.getAddress(\"ALGEBRA_SWAP_ROUTER\"));\n }\n\n function curveSwapLiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n strategyData = abi.encode(\n ap.getAddress(\"CURVE_V2_ORACLE_NO_REGISTRY\"),\n outputToken,\n getWrappedToUnwrapped4626(inputToken),\n getWrappedToUnwrapped4626(outputToken)\n );\n }\n\n function velodromeV2LiquidatorData(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) internal view returns (bytes memory strategyData) {\n IVelodromeV2Router.Route[] memory swapPath = new IVelodromeV2Router.Route[](1);\n swapPath[0] = IVelodromeV2Router.Route({\n from: address(inputToken),\n to: address(outputToken),\n stable: aeroV2IsStable(inputToken, outputToken)\n });\n strategyData = abi.encode(getAerodromeV2Router(inputToken), swapPath);\n }\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistrySecondExtension.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"./ILiquidatorsRegistry.sol\";\nimport \"./LiquidatorsRegistryStorage.sol\";\n\nimport \"../../ionic/DiamondExtension.sol\";\n\ncontract LiquidatorsRegistrySecondExtension is\n LiquidatorsRegistryStorage,\n DiamondExtension,\n ILiquidatorsRegistrySecondExtension\n{\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function _getExtensionFunctions() external pure override returns (bytes4[] memory) {\n uint8 fnsCount = 20;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getAllPairsStrategies.selector;\n functionSelectors[--fnsCount] = this.pairsStrategiesMatch.selector;\n functionSelectors[--fnsCount] = this.uniswapPairsFeesMatch.selector;\n functionSelectors[--fnsCount] = this.uniswapPairsRoutersMatch.selector;\n functionSelectors[--fnsCount] = this._setSlippages.selector;\n functionSelectors[--fnsCount] = this._setUniswapV3Fees.selector;\n functionSelectors[--fnsCount] = this._setUniswapV3Routers.selector;\n functionSelectors[--fnsCount] = this._setDefaultOutputToken.selector;\n functionSelectors[--fnsCount] = this._setRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this._setRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this._removeRedemptionStrategy.selector;\n functionSelectors[--fnsCount] = this._resetRedemptionStrategies.selector;\n functionSelectors[--fnsCount] = this.optimalSwapPath.selector;\n functionSelectors[--fnsCount] = this._setOptimalSwapPath.selector;\n functionSelectors[--fnsCount] = this.wrappedToUnwrapped4626.selector;\n functionSelectors[--fnsCount] = this.aeroCLTickSpacings.selector;\n functionSelectors[--fnsCount] = this.aeroV2IsStable.selector;\n functionSelectors[--fnsCount] = this._setWrappedToUnwrapped4626.selector;\n functionSelectors[--fnsCount] = this._setAeroCLTickSpacings.selector;\n functionSelectors[--fnsCount] = this._setAeroV2IsStable.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n function _setSlippages(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint256[] calldata slippages\n ) external onlyOwner {\n require(slippages.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < slippages.length; i++) {\n conversionSlippage[inputTokens[i]][outputTokens[i]] = slippages[i];\n }\n }\n\n function _setUniswapV3Fees(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n uint24[] calldata fees\n ) external onlyOwner {\n require(fees.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < fees.length; i++) {\n uniswapV3Fees[inputTokens[i]][outputTokens[i]] = fees[i];\n }\n }\n\n function _setUniswapV3Routers(\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens,\n address[] calldata routers\n ) external onlyOwner {\n require(routers.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n for (uint256 i = 0; i < routers.length; i++) {\n customUniV3Router[inputTokens[i]][outputTokens[i]] = routers[i];\n }\n }\n\n function _setDefaultOutputToken(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken) external onlyOwner {\n defaultOutputToken[inputToken] = outputToken;\n }\n\n function _setRedemptionStrategy(\n IRedemptionStrategy strategy,\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken\n ) public onlyOwner {\n string memory name = strategy.name();\n IRedemptionStrategy oldStrategy = redemptionStrategiesByName[name];\n\n redemptionStrategiesByTokens[inputToken][outputToken] = strategy;\n redemptionStrategiesByName[name] = strategy;\n\n redemptionStrategies.remove(address(oldStrategy));\n redemptionStrategies.add(address(strategy));\n\n if (defaultOutputToken[inputToken] == IERC20Upgradeable(address(0))) {\n defaultOutputToken[inputToken] = outputToken;\n }\n inputTokensByOutputToken[outputToken].add(address(inputToken));\n outputTokensSet.add(address(outputToken));\n }\n\n function _setRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external onlyOwner {\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n for (uint256 i = 0; i < strategies.length; i++) {\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\n }\n }\n\n function _resetRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n IERC20Upgradeable[] calldata inputTokens,\n IERC20Upgradeable[] calldata outputTokens\n ) external onlyOwner {\n require(strategies.length == inputTokens.length && inputTokens.length == outputTokens.length, \"!arrays len\");\n\n // empty the input/output token mappings/sets\n address[] memory _outputTokens = outputTokensSet.values();\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\n }\n outputTokensSet.remove(_outputTokens[i]);\n }\n\n // empty the strategies mappings/sets\n address[] memory _currentStrategies = redemptionStrategies.values();\n for (uint256 i = 0; i < _currentStrategies.length; i++) {\n IRedemptionStrategy _currentStrategy = IRedemptionStrategy(_currentStrategies[i]);\n string memory _name = _currentStrategy.name();\n redemptionStrategiesByName[_name] = IRedemptionStrategy(address(0));\n redemptionStrategies.remove(_currentStrategies[i]);\n }\n\n // write the new strategies and their tokens configs\n for (uint256 i = 0; i < strategies.length; i++) {\n _setRedemptionStrategy(strategies[i], inputTokens[i], outputTokens[i]);\n }\n }\n\n function _removeRedemptionStrategy(IRedemptionStrategy strategyToRemove) external onlyOwner {\n // check all the input/output tokens if they match the strategy to remove\n address[] memory _outputTokens = outputTokensSet.values();\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n IRedemptionStrategy _currentStrategy = redemptionStrategiesByTokens[_inputToken][_outputToken];\n\n // only nullify the input/output tokens config if the strategy matches\n if (_currentStrategy == strategyToRemove) {\n redemptionStrategiesByTokens[_inputToken][_outputToken] = IRedemptionStrategy(address(0));\n inputTokensByOutputToken[_outputToken].remove(_inputTokens[j]);\n if (defaultOutputToken[_inputToken] == _outputToken) {\n defaultOutputToken[_inputToken] = IERC20Upgradeable(address(0));\n }\n }\n }\n if (inputTokensByOutputToken[_outputToken].length() == 0) {\n outputTokensSet.remove(address(_outputToken));\n }\n }\n\n redemptionStrategiesByName[strategyToRemove.name()] = IRedemptionStrategy(address(0));\n redemptionStrategies.remove(address(strategyToRemove));\n }\n\n function uniswapPairsFeesMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n uint256[] calldata configFees\n ) external view returns (bool) {\n // find a match for each config fee\n for (uint256 i = 0; i < configFees.length; i++) {\n if (uniswapV3Fees[configInputTokens[i]][configOutputTokens[i]] != configFees[i]) return false;\n }\n\n return true;\n }\n\n function uniswapPairsRoutersMatch(\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens,\n address[] calldata configRouters\n ) external view returns (bool) {\n // find a match for each config router\n for (uint256 i = 0; i < configRouters.length; i++) {\n if (customUniV3Router[configInputTokens[i]][configOutputTokens[i]] != configRouters[i]) return false;\n }\n\n return true;\n }\n\n function pairsStrategiesMatch(\n IRedemptionStrategy[] calldata configStrategies,\n IERC20Upgradeable[] calldata configInputTokens,\n IERC20Upgradeable[] calldata configOutputTokens\n ) external view returns (bool) {\n (\n IRedemptionStrategy[] memory onChainStrategies,\n IERC20Upgradeable[] memory onChainInputTokens,\n IERC20Upgradeable[] memory onChainOutputTokens\n ) = getAllPairsStrategies();\n // find a match for each config strategy\n for (uint256 i = 0; i < configStrategies.length; i++) {\n bool foundMatch = false;\n for (uint256 j = 0; j < onChainStrategies.length; j++) {\n if (\n onChainStrategies[j] == configStrategies[i] &&\n onChainInputTokens[j] == configInputTokens[i] &&\n onChainOutputTokens[j] == configOutputTokens[i]\n ) {\n foundMatch = true;\n break;\n }\n }\n if (!foundMatch) return false;\n }\n\n // find a match for each on-chain strategy\n for (uint256 i = 0; i < onChainStrategies.length; i++) {\n bool foundMatch = false;\n for (uint256 j = 0; j < configStrategies.length; j++) {\n if (\n onChainStrategies[i] == configStrategies[j] &&\n onChainInputTokens[i] == configInputTokens[j] &&\n onChainOutputTokens[i] == configOutputTokens[j]\n ) {\n foundMatch = true;\n break;\n }\n }\n if (!foundMatch) return false;\n }\n\n return true;\n }\n\n function getAllPairsStrategies()\n public\n view\n returns (\n IRedemptionStrategy[] memory strategies,\n IERC20Upgradeable[] memory inputTokens,\n IERC20Upgradeable[] memory outputTokens\n )\n {\n address[] memory _outputTokens = outputTokensSet.values();\n uint256 pairsCounter = 0;\n\n {\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n pairsCounter += _inputTokens.length;\n }\n\n strategies = new IRedemptionStrategy[](pairsCounter);\n inputTokens = new IERC20Upgradeable[](pairsCounter);\n outputTokens = new IERC20Upgradeable[](pairsCounter);\n }\n\n pairsCounter = 0;\n for (uint256 i = 0; i < _outputTokens.length; i++) {\n IERC20Upgradeable _outputToken = IERC20Upgradeable(_outputTokens[i]);\n address[] memory _inputTokens = inputTokensByOutputToken[_outputToken].values();\n for (uint256 j = 0; j < _inputTokens.length; j++) {\n IERC20Upgradeable _inputToken = IERC20Upgradeable(_inputTokens[j]);\n strategies[pairsCounter] = redemptionStrategiesByTokens[_inputToken][_outputToken];\n inputTokens[pairsCounter] = _inputToken;\n outputTokens[pairsCounter] = _outputToken;\n pairsCounter++;\n }\n }\n }\n\n function optimalSwapPath(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken)\n external\n view\n returns (IERC20Upgradeable[] memory)\n {\n return _optimalSwapPath[inputToken][outputToken];\n }\n\n function _setOptimalSwapPath(\n IERC20Upgradeable inputToken,\n IERC20Upgradeable outputToken,\n IERC20Upgradeable[] calldata optimalPath\n ) external onlyOwner {\n _optimalSwapPath[inputToken][outputToken] = optimalPath;\n }\n\n function wrappedToUnwrapped4626(address wrapped) external view returns (address) {\n return _wrappedToUnwrapped4626[wrapped];\n }\n\n function aeroCLTickSpacings(address inputToken, address outputToken) external view returns (int24) {\n return _aeroCLTickSpacings[inputToken][outputToken];\n }\n\n function aeroV2IsStable(address inputToken, address outputToken) external view returns (bool) {\n return _aeroV2IsStable[inputToken][outputToken];\n }\n\n function _setWrappedToUnwrapped4626(address wrapped, address unwrapped) external onlyOwner {\n _wrappedToUnwrapped4626[wrapped] = unwrapped;\n }\n\n function _setAeroCLTickSpacings(address inputToken, address outputToken, int24 tickSpacing) external onlyOwner {\n _aeroCLTickSpacings[inputToken][outputToken] = tickSpacing;\n }\n\n function _setAeroV2IsStable(address inputToken, address outputToken, bool isStable) external onlyOwner {\n _aeroV2IsStable[inputToken][outputToken] = isStable;\n }\n}" + }, + "contracts/liquidators/registry/LiquidatorsRegistryStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"../IRedemptionStrategy.sol\";\nimport { SafeOwnable } from \"../../ionic/SafeOwnable.sol\";\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nabstract contract LiquidatorsRegistryStorage is SafeOwnable {\n AddressesProvider public ap;\n\n EnumerableSet.AddressSet internal redemptionStrategies;\n mapping(string => IRedemptionStrategy) public redemptionStrategiesByName;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IRedemptionStrategy)) public redemptionStrategiesByTokens;\n mapping(IERC20Upgradeable => IERC20Upgradeable) public defaultOutputToken;\n mapping(IERC20Upgradeable => EnumerableSet.AddressSet) internal inputTokensByOutputToken;\n EnumerableSet.AddressSet internal outputTokensSet;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippage;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint256)) internal conversionSlippageUpdated;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => uint24)) public uniswapV3Fees;\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => address)) public customUniV3Router;\n\n mapping(IERC20Upgradeable => mapping(IERC20Upgradeable => IERC20Upgradeable[])) internal _optimalSwapPath;\n mapping(address => address) internal _wrappedToUnwrapped4626;\n mapping(address => mapping(address => int24)) internal _aeroCLTickSpacings;\n mapping(address => mapping(address => bool)) internal _aeroV2IsStable;\n}" + }, + "contracts/liquidators/UniswapV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./BaseUniswapV2Liquidator.sol\";\n\n/**\n * @title UniswapV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Uniswap V2 router for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapV2Liquidator is BaseUniswapV2Liquidator {\n function _swap(\n IUniswapV2Router02 uniswapV2Router,\n uint256 inputAmount,\n address[] memory swapPath\n ) internal override {\n uniswapV2Router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"UniswapV2Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV2LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { UniswapV2Liquidator } from \"./UniswapV2Liquidator.sol\";\nimport \"./IFundsConversionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"../external/uniswap/IUniswapV2Router02.sol\";\n\ncontract UniswapV2LiquidatorFunder is UniswapV2Liquidator, IFundsConversionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount) {\n (IUniswapV2Router02 uniswapV2Router, address[] memory swapPath) = abi.decode(\n strategyData,\n (IUniswapV2Router02, address[])\n );\n require(swapPath.length >= 2, \"Invalid UniswapLiquidator swap path.\");\n\n uint256[] memory amounts = uniswapV2Router.getAmountsIn(outputAmount, swapPath);\n\n inputAmount = amounts[0];\n inputToken = IERC20Upgradeable(swapPath[0]);\n }\n\n function name() public pure override(UniswapV2Liquidator, IRedemptionStrategy) returns (string memory) {\n return \"UniswapV2LiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport { IV3SwapRouter } from \"../external/uniswap/IV3SwapRouter.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract UniswapV3Liquidator is IRedemptionStrategy {\n /**\n * @dev Redeems `inputToken` for `outputToken` where `inputAmount` < `outputAmount`\n * @param inputToken Address of the token\n * @param inputAmount input amount\n * @param strategyData context specific data like input token, pool address and tx expiratio period\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n (, address _outputToken, uint24 fee, IV3SwapRouter swapRouter, ) = abi.decode(\n strategyData,\n (address, address, uint24, IV3SwapRouter, address)\n );\n outputToken = IERC20Upgradeable(_outputToken);\n\n inputToken.approve(address(swapRouter), inputAmount);\n\n outputAmount = swapRouter.exactInputSingle(\n IV3SwapRouter.ExactInputSingleParams(\n address(inputToken),\n _outputToken,\n fee,\n address(this),\n inputAmount,\n 0,\n 0\n )\n );\n }\n\n function name() public pure virtual override returns (string memory) {\n return \"UniswapV3Liquidator\";\n }\n}\n" + }, + "contracts/liquidators/UniswapV3LiquidatorFunder.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { IFundsConversionStrategy } from \"./IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"./IRedemptionStrategy.sol\";\nimport \"./UniswapV3Liquidator.sol\";\n\nimport { Quoter } from \"../external/uniswap/quoter/Quoter.sol\";\n\ncontract UniswapV3LiquidatorFunder is UniswapV3Liquidator, IFundsConversionStrategy {\n using FixedPointMathLib for uint256;\n\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external override returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n /**\n * @dev Estimates the needed input amount of the input token for the conversion to return the desired output amount.\n * @param outputAmount the desired output amount\n * @param strategyData the input token\n */\n function estimateInputAmount(uint256 outputAmount, bytes memory strategyData)\n external\n view\n returns (IERC20Upgradeable inputToken, uint256 inputAmount)\n {\n (address _inputToken, address _outputToken, uint24 fee, , Quoter quoter) = abi.decode(\n strategyData,\n (address, address, uint24, IV3SwapRouter, Quoter)\n );\n\n inputAmount = quoter.estimateMinSwapUniswapV3(_inputToken, _outputToken, outputAmount, fee);\n inputToken = IERC20Upgradeable(_inputToken);\n }\n\n function name() public pure override(UniswapV3Liquidator, IRedemptionStrategy) returns (string memory) {\n return \"UniswapV3LiquidatorFunder\";\n }\n}\n" + }, + "contracts/liquidators/VelodromeV2Liquidator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\n\n/**\n * @title VelodromeV2Liquidator\n * @notice Exchanges seized token collateral for underlying tokens via a Velodrome V2 router for use as a step in a liquidation.\n */\ncontract VelodromeV2Liquidator {\n function _swap(IRouter_Velodrome router, uint256 inputAmount, IRouter_Velodrome.Route[] memory swapPath) internal {\n router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp);\n }\n\n function name() public pure virtual returns (string memory) {\n return \"VelodromeV2Liquidator\";\n }\n\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n return _convert(inputToken, inputAmount, strategyData);\n }\n\n function _convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) {\n // Get Uniswap router and path\n (IRouter_Velodrome router, IRouter_Velodrome.Route[] memory swapPath) = abi.decode(\n strategyData,\n (IRouter_Velodrome, IRouter_Velodrome.Route[])\n );\n require(\n swapPath.length >= 1 && swapPath[0].from == address(inputToken),\n \"Invalid VelodromeV2Liquidator swap path.\"\n );\n\n // Swap underlying tokens\n inputToken.approve(address(router), inputAmount);\n\n // call the relevant fn depending on the uni v2 fork specifics\n _swap(router, inputAmount, swapPath);\n\n // Get new collateral\n outputToken = IERC20Upgradeable(swapPath[swapPath.length - 1].to);\n outputAmount = outputToken.balanceOf(address(this));\n }\n}\n" + }, + "contracts/oracles/1337/MockPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title MockPriceOracle\n * @notice Returns mocked prices from a Chainlink-like oracle. Used for local dev only\n * @dev Implements `PriceOracle`.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract MockPriceOracle is BasePriceOracle {\n /**\n * @notice The maximum number of seconds elapsed since the round was last updated before the price is considered stale. If set to 0, no limit is enforced.\n */\n uint256 public maxSecondsBeforePriceIsStale;\n\n /**\n * @dev Constructor to set `maxSecondsBeforePriceIsStale` as well as all Chainlink price feeds.\n */\n constructor(uint256 _maxSecondsBeforePriceIsStale) {\n // Set maxSecondsBeforePriceIsStale\n maxSecondsBeforePriceIsStale = _maxSecondsBeforePriceIsStale;\n }\n\n /**\n * @dev Returns a boolean indicating if a price feed exists for the underlying asset.\n */\n\n function hasPriceFeed(address underlying) external pure returns (bool) {\n return true;\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n */\n\n function random() private view returns (uint256) {\n uint256 r = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 99;\n r = r + 1;\n return r;\n }\n\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) return 1e18;\n\n int256 tokenEthPrice = 1;\n uint256 r = random();\n\n return ((uint256(tokenEthPrice) * 1e18) / r) / 1e18;\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n return 1e18;\n }\n}\n" + }, + "contracts/oracles/1337/MockRevertPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title MockRevertPriceOracle\n * @notice Mocks a failing price oracle. Used for testing purposes only\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract MockRevertPriceOracle is BasePriceOracle {\n constructor() {}\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n revert(\"MockPriceOracle: price function is failing.\");\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n revert(\"MockPriceOracle: getUnderlyingPrice function is failing.\");\n }\n}\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../compound/CTokenInterfaces.sol\";\n\n/**\n * @title BasePriceOracle\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\n * @dev Implements the `PriceOracle` interface.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface BasePriceOracle {\n /**\n * @notice Get the price of an underlying asset.\n * @param underlying The underlying asset to get the price of.\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function price(address underlying) external view returns (uint256);\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\n}\n" + }, + "contracts/oracles/default/AerodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface BasePrices {\n function getManyRatesWithConnectors(\n uint8 src_len,\n address[] memory connectors\n ) external view returns (uint256[] memory rates);\n}\n\ncontract AerodromePriceOracle is BasePriceOracle {\n BasePrices immutable prices;\n address constant WETH = 0x4200000000000000000000000000000000000006;\n\n constructor(address _prices) {\n prices = BasePrices(_prices);\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n address[] memory connectors = new address[](2);\n connectors[0] = token;\n connectors[1] = WETH;\n return prices.getManyRatesWithConnectors(1, connectors)[0];\n }\n}\n" + }, + "contracts/oracles/default/API3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IProxy } from \"../../external/api3/IProxy.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title API3PriceOracle\n * @notice Returns prices from Api3.\n * @dev Implements `PriceOracle`.\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n */\ncontract API3PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => IProxy) public proxies;\n\n /**\n * @notice Chainlink NATIVE/USD price feed contracts.\n */\n address public NATIVE_TOKEN_USD_PRICE_FEED;\n\n /**\n * @notice The USD Token of the chain\n */\n address public USD_TOKEN;\n\n /**\n * @dev Constructor to set wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\n __SafeOwnable_init(msg.sender);\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Constructor to set wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function reinitialize(address _usdToken, address nativeTokenUsd) public onlyOwnerOrAdmin {\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\n */\n function setPriceFeeds(address[] memory underlyings, address[] memory feeds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n proxies[underlying] = IProxy(feeds[i]);\n }\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n IProxy proxy = proxies[underlying];\n require(address(proxy) != address(0), \"No API3 price feed found for this underlying ERC20 token.\");\n\n uint256 nativeTokenUsdPrice;\n\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\n // get the USDX/USD price from the MPO\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\n } else {\n (int224 nativeTokenUsdPrice224, ) = IProxy(NATIVE_TOKEN_USD_PRICE_FEED).read();\n if (nativeTokenUsdPrice224 <= 0) {\n revert(\"API3PriceOracle: native token price <= 0\");\n }\n nativeTokenUsdPrice = uint256(uint224(nativeTokenUsdPrice224));\n }\n (int224 tokenUsdPrice, ) = proxy.read();\n\n if (tokenUsdPrice <= 0) {\n revert(\"API3PriceOracle: token price <= 0\");\n }\n\n return (uint256(uint224(tokenUsdPrice)) * 1e18) / nativeTokenUsdPrice;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ChainlinkPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/chainlink/AggregatorV3Interface.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title ChainlinkPriceOracleV2\n * @notice Returns prices from Chainlink.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract ChainlinkPriceOracleV2 is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => AggregatorV3Interface) public priceFeeds;\n\n /**\n * @notice Maps ERC20 token addresses to enums indicating the base currency of the feed.\n */\n mapping(address => FeedBaseCurrency) public feedBaseCurrencies;\n\n /**\n * @notice Enum indicating the base currency of a Chainlink price feed.\n * @dev ETH is interchangeable with the nativeToken of the current chain.\n */\n enum FeedBaseCurrency {\n ETH,\n USD\n }\n\n /**\n * @notice Chainlink NATIVE/USD price feed contracts.\n */\n address public NATIVE_TOKEN_USD_PRICE_FEED;\n\n /**\n * @notice The USD Token of the chain\n */\n address public USD_TOKEN;\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n * @param _usdToken The Wrapped native asset address\n * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token.\n */\n function initialize(address _usdToken, address nativeTokenUsd) public initializer {\n __SafeOwnable_init(msg.sender);\n USD_TOKEN = _usdToken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The Chainlink price feed contract addresses for each of `underlyings`.\n * @param baseCurrency The currency in which `feeds` are based.\n */\n function setPriceFeeds(\n address[] memory underlyings,\n address[] memory feeds,\n FeedBaseCurrency baseCurrency\n ) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeeds[underlying] = AggregatorV3Interface(feeds[i]);\n feedBaseCurrencies[underlying] = baseCurrency;\n }\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/ETH price from Chainlink\n AggregatorV3Interface feed = priceFeeds[underlying];\n require(address(feed) != address(0), \"No Chainlink price feed found for this underlying ERC20 token.\");\n FeedBaseCurrency baseCurrency = feedBaseCurrencies[underlying];\n\n if (baseCurrency == FeedBaseCurrency.ETH) {\n (, int256 tokenEthPrice, , , ) = feed.latestRoundData();\n return tokenEthPrice >= 0 ? (uint256(tokenEthPrice) * 1e18) / (10 ** uint256(feed.decimals())) : 0;\n } else if (baseCurrency == FeedBaseCurrency.USD) {\n int256 nativeTokenUsdPrice;\n uint8 usdPriceDecimals;\n\n if (NATIVE_TOKEN_USD_PRICE_FEED == address(0)) {\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n nativeTokenUsdPrice = int256(1e36 / usdNativeTokenPrice); // 18 decimals\n usdPriceDecimals = 18;\n } else {\n (, nativeTokenUsdPrice, , , ) = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).latestRoundData();\n if (nativeTokenUsdPrice <= 0) return 0;\n usdPriceDecimals = AggregatorV3Interface(NATIVE_TOKEN_USD_PRICE_FEED).decimals();\n }\n (, int256 tokenUsdPrice, , , ) = feed.latestRoundData();\n\n return\n tokenUsdPrice >= 0\n ? ((uint256(tokenUsdPrice) * 1e18 * (10 ** uint256(usdPriceDecimals))) / (10 ** uint256(feed.decimals()))) /\n uint256(nativeTokenUsdPrice)\n : 0;\n } else {\n revert(\"unknown base currency\");\n }\n }\n\n /**\n * @notice Returns the price in of `underlying` either in USD or the native token (implements `BasePriceOracle`).\n * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE this will return a price denominated in USD otherwise in the native token\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ConcentratedLiquidityBasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"../../external/uniswap/FullMath.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title ConcentratedLiquidityBasePriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice ConcentratedLiquidityBasePriceOracle is an abstract price oracle for concentrated liquidty (UniV3-like) pairs.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\nabstract contract ConcentratedLiquidityBasePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to asset configs.\n */\n mapping(address => AssetConfig) public poolFeeds;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool public canAdminOverwrite;\n\n struct AssetConfig {\n address poolAddress;\n uint256 twapWindow;\n address baseToken;\n }\n\n address public WTOKEN;\n address[] public SUPPORTED_BASE_TOKENS;\n\n function initialize(address _wtoken, address[] memory _supportedBaseTokens) public initializer {\n __SafeOwnable_init(msg.sender);\n WTOKEN = _wtoken;\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param assetConfig The asset configuration which includes pool address and twap window.\n */\n function setPoolFeeds(address[] memory underlyings, AssetConfig[] memory assetConfig) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == assetConfig.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/config\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set asset config for underlying\n require(\n assetConfig[i].baseToken == WTOKEN || _isBaseTokenSupported(assetConfig[i].baseToken),\n \"Base token must be supported\"\n );\n poolFeeds[underlying] = assetConfig[i];\n }\n }\n\n /**\n * @notice Get the token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for WTOKEN)\n * @return Price denominated in NATIVE (scaled by 1e18)\n */\n function price(address underlying) external view returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in NATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in NATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the price for a token from Uniswap v3\n */\n function _price(address token) internal view virtual returns (uint256);\n\n function getPriceX96FromSqrtPriceX96(\n address token0,\n address priceToken,\n uint160 sqrtPriceX96\n ) public pure returns (uint256 price_) {\n price_ = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, uint256(2 ** (96 * 2)) / 1e18);\n if (token0 != priceToken) price_ = 1e36 / price_;\n }\n\n function _isBaseTokenSupported(address token) internal view returns (bool) {\n for (uint256 i = 0; i < SUPPORTED_BASE_TOKENS.length; i++) {\n if (SUPPORTED_BASE_TOKENS[i] == token) {\n return true;\n }\n }\n return false;\n }\n\n function _setSupportedBaseTokens(address[] memory _supportedBaseTokens) external onlyOwner {\n SUPPORTED_BASE_TOKENS = _supportedBaseTokens;\n }\n\n function getSupportedBaseTokens() external view returns (address[] memory) {\n return SUPPORTED_BASE_TOKENS;\n }\n\n function scalePrices(address baseToken, address token, uint256 tokenPrice) internal view returns (uint256) {\n uint256 baseTokenDecimals;\n uint256 tokenPriceScaled;\n\n if (baseToken == address(0) || baseToken == WTOKEN) {\n baseTokenDecimals = 18;\n } else {\n baseTokenDecimals = uint256(ERC20Upgradeable(baseToken).decimals());\n }\n\n uint256 baseNativePrice = BasePriceOracle(msg.sender).price(baseToken);\n\n // scale tokenPrice by 1e18\n uint256 tokenDecimals = uint256(ERC20Upgradeable(token).decimals());\n if (baseTokenDecimals > tokenDecimals) {\n tokenPriceScaled = tokenPrice / (10 ** (baseTokenDecimals - tokenDecimals));\n } else if (baseTokenDecimals < tokenDecimals) {\n tokenPriceScaled = tokenPrice * (10 ** (tokenDecimals - baseTokenDecimals));\n } else {\n tokenPriceScaled = tokenPrice;\n }\n return (tokenPriceScaled * baseNativePrice) / 1e18;\n }\n}\n" + }, + "contracts/oracles/default/CurveLpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\n\nimport \"../../external/curve/ICurvePool.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracleNoRegistry\n * @author David Lucid (https://github.com/davidlucid)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract CurveLpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @dev Maps Curve LP token addresses to underlying token addresses.\n */\n mapping(address => address[]) public underlyingTokens;\n\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolOf;\n\n address[] public lpTokens;\n\n /**\n * @dev Initializes an array of LP tokens and pools if desired.\n * @param _lpTokens Array of LP token addresses.\n * @param _pools Array of pool addresses.\n * @param _poolUnderlyings The underlying token addresses of a pool\n */\n function initialize(\n address[] memory _lpTokens,\n address[] memory _pools,\n address[][] memory _poolUnderlyings\n ) public initializer {\n require(\n _lpTokens.length == _pools.length && _lpTokens.length == _poolUnderlyings.length,\n \"No LP tokens supplied or array lengths not equal.\"\n );\n\n __SafeOwnable_init(msg.sender);\n for (uint256 i = 0; i < _lpTokens.length; i++) {\n poolOf[_lpTokens[i]] = _pools[i];\n underlyingTokens[_lpTokens[i]] = _poolUnderlyings[i];\n }\n }\n\n function getAllLPTokens() public view returns (address[] memory) {\n return lpTokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < lpTokens.length; i++) {\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), 0, 0);\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token/ETH price from Curve, with 18 decimals of precision.\n * Source: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/CurveOracle.sol\n * @param lpToken The LP token contract address for price retrieval.\n */\n function _price(address lpToken) internal view returns (uint256) {\n address pool = poolOf[lpToken];\n require(pool != address(0), \"LP token is not registered.\");\n address[] memory tokens = underlyingTokens[lpToken];\n uint256 minPx = type(uint256).max;\n uint256 n = tokens.length;\n\n for (uint256 i = 0; i < n; i++) {\n address ulToken = tokens[i];\n uint256 tokenPx = BasePriceOracle(msg.sender).price(ulToken);\n if (tokenPx < minPx) minPx = tokenPx;\n }\n\n require(minPx != type(uint256).max, \"No minimum underlying token price found.\");\n return (minPx * ICurvePool(pool).get_virtual_price()) / 1e18; // Use min underlying token prices\n }\n\n /**\n * @dev Register the pool given LP token address and set the pool info.\n * @param _lpToken LP token to find the corresponding pool.\n * @param _pool Pool address.\n * @param _underlyings Underlying addresses.\n */\n function registerPool(\n address _lpToken,\n address _pool,\n address[] memory _underlyings\n ) external onlyOwner {\n poolOf[_lpToken] = _pool;\n underlyingTokens[_lpToken] = _underlyings;\n\n bool skip = false;\n for (uint256 j = 0; j < lpTokens.length; j++) {\n if (lpTokens[j] == _lpToken) {\n skip = true;\n break;\n }\n }\n if (!skip) lpTokens.push(_lpToken);\n }\n\n /**\n * @dev getter for the underlying tokens\n * @param lpToken the LP token address.\n * @return _underlyings Underlying addresses.\n */\n function getUnderlyingTokens(address lpToken) public view returns (address[] memory) {\n return underlyingTokens[lpToken];\n }\n}\n" + }, + "contracts/oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\n\nimport \"../../external/curve/ICurveV2Pool.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\n */\ncontract CurveV2LpTokenPriceOracleNoRegistry is SafeOwnableUpgradeable, BasePriceOracle {\n address public usdToken;\n MasterPriceOracle public masterPriceOracle;\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolOf;\n\n address[] public lpTokens;\n\n /**\n * @dev Initializes an array of LP tokens and pools if desired.\n * @param _lpTokens Array of LP token addresses.\n * @param _pools Array of pool addresses.\n */\n function initialize(address[] memory _lpTokens, address[] memory _pools) public initializer {\n require(_lpTokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\n __SafeOwnable_init(msg.sender);\n\n for (uint256 i = 0; i < _pools.length; i++) {\n poolOf[_lpTokens[i]] = _pools[i];\n }\n }\n\n function getAllLPTokens() public view returns (address[] memory) {\n return lpTokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < lpTokens.length; i++) {\n ICurvePool pool = ICurvePool(poolOf[lpTokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), int128(0), int128(0));\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\n * @param lpToken The LP token contract address for price retrieval.\n */\n function _price(address lpToken) internal view returns (uint256) {\n address pool = poolOf[lpToken];\n require(address(pool) != address(0), \"LP token is not registered.\");\n\n address baseToken = ICurvePool(pool).coins(0);\n uint256 lpPrice = ICurveV2Pool(pool).lp_price();\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n return (lpPrice * baseTokenPrice) / 10**18;\n }\n\n /**\n * @dev Register the pool given LP token address and set the pool info.\n * @param _lpToken LP token to find the corresponding pool.\n * @param _pool Pool address.\n */\n function registerPool(address _lpToken, address _pool) external onlyOwner {\n address pool = poolOf[_lpToken];\n require(pool == address(0), \"This LP token is already registered.\");\n poolOf[_lpToken] = _pool;\n\n bool skip = false;\n for (uint256 j = 0; j < lpTokens.length; j++) {\n if (lpTokens[j] == _lpToken) {\n skip = true;\n break;\n }\n }\n if (!skip) lpTokens.push(_lpToken);\n }\n}\n" + }, + "contracts/oracles/default/CurveV2PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { EIP20Interface } from \"../../compound/EIP20Interface.sol\";\n\nimport \"../../external/curve/ICurveV2Pool.sol\";\n\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title CurveLpTokenPriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice CurveLpTokenPriceOracleNoRegistry is a price oracle for Curve V2 LP tokens (using the sender as a root oracle).\n * @dev Implements the `PriceOracle` interface used by Midas pools (and Compound v2).\n */\ncontract CurveV2PriceOracle is SafeOwnableUpgradeable, BasePriceOracle {\n /**\n * @dev Maps Curve LP token addresses to pool addresses.\n */\n mapping(address => address) public poolFor;\n\n address[] public tokens;\n\n /**\n * @dev Initializes an array of tokens and pools if desired.\n * @param _tokens Array of token addresses.\n * @param _pools Array of pool addresses.\n */\n function initialize(address[] memory _tokens, address[] memory _pools) public initializer {\n require(_tokens.length == _pools.length, \"No LP tokens supplied or array lengths not equal.\");\n __SafeOwnable_init(msg.sender);\n\n for (uint256 i = 0; i < _pools.length; i++) {\n try ICurvePool(_pools[i]).coins(2) returns (address) {\n revert(\"!only two token pools\");\n } catch {\n // ignore error\n }\n\n poolFor[_tokens[i]] = _pools[i];\n }\n }\n\n function getAllSupportedTokens() public view returns (address[] memory) {\n return tokens;\n }\n\n function getPoolForSwap(address inputToken, address outputToken)\n public\n view\n returns (\n ICurvePool,\n int128,\n int128\n )\n {\n for (uint256 i = 0; i < tokens.length; i++) {\n ICurvePool pool = ICurvePool(poolFor[tokens[i]]);\n int128 inputIndex = -1;\n int128 outputIndex = -1;\n int128 j = 0;\n while (true) {\n try pool.coins(uint256(uint128(j))) returns (address coin) {\n if (coin == inputToken) inputIndex = j;\n else if (coin == outputToken) outputIndex = j;\n j++;\n } catch {\n break;\n }\n\n if (outputIndex > -1 && inputIndex > -1) {\n return (pool, inputIndex, outputIndex);\n }\n }\n }\n\n return (ICurvePool(address(0)), int128(0), int128(0));\n }\n\n /**\n * @notice Get the LP token price price for an underlying token address.\n * @param underlying The underlying token address for which to get the price (set to zero address for ETH).\n * @return Price denominated in ETH (scaled by 1e18).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10**uint256(EIP20Interface(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token price from Curve, with 18 decimals of precision.\n * @param token The LP token contract address for price retrieval.\n */\n function _price(address token) internal view returns (uint256) {\n address pool = poolFor[token];\n require(address(pool) != address(0), \"Token is not registered.\");\n\n address baseToken;\n // Returns always coin(1) / coin(0) [ e.g. USDC (1) / eUSDC (1) ]\n uint256 exchangeRate = ICurveV2Pool(pool).price_oracle();\n\n if (ICurvePool(pool).coins(0) == token) {\n baseToken = ICurvePool(pool).coins(1);\n // USDC / ETH\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n // USDC / ETH * eUSDC / USDC = eUSDC / ETH\n return (baseTokenPrice * 10**18) / exchangeRate;\n } else {\n // if coin(1) is eUSDC, exchangeRate is USDC / eUSDC\n baseToken = ICurvePool(pool).coins(0);\n // USDC / ETH\n uint256 baseTokenPrice = BasePriceOracle(msg.sender).price(baseToken);\n // (USDC / ETH) * (1 / (USDC / eUSDC)) = eUSDC / ETH\n return (baseTokenPrice * exchangeRate) / 10**18;\n }\n }\n\n /**\n * @dev Register the pool given token address and set the pool info.\n * @param _token token to find the corresponding pool.\n * @param _pool Pool address.\n */\n function registerPool(address _token, address _pool) external onlyOwner {\n try ICurvePool(_pool).coins(2) returns (address) {\n revert(\"!only two token pools\");\n } catch {\n // ignore error\n }\n\n address pool = poolFor[_token];\n require(pool == address(0), \"This LP token is already registered.\");\n poolFor[_token] = _pool;\n\n bool skip = false;\n for (uint256 j = 0; j < tokens.length; j++) {\n if (tokens[j] == _token) {\n skip = true;\n break;\n }\n }\n if (!skip) tokens.push(_token);\n }\n}\n" + }, + "contracts/oracles/default/DiaPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IPriceOracle } from \"../../external/compound/IPriceOracle.sol\";\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\n\ninterface DIAOracleV2 {\n function getValue(string memory key) external view returns (uint128, uint128);\n}\n\n/**\n * @title DiaPriceOracle\n * @notice Returns prices from DIA.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract DiaPriceOracle is BasePriceOracle {\n struct DiaOracle {\n DIAOracleV2 feed;\n string key;\n }\n\n /**\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\n */\n mapping(address => DiaOracle) public priceFeeds;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool public immutable CAN_ADMIN_OVERWRITE;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public immutable WTOKEN;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n DIAOracleV2 public immutable NATIVE_TOKEN_USD_PRICE_FEED;\n string public NATIVE_TOKEN_USD_KEY;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n MasterPriceOracle public immutable MASTER_PRICE_ORACLE;\n address public immutable USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n constructor(\n address _admin,\n bool canAdminOverwrite,\n address wtoken,\n DIAOracleV2 nativeTokenUsd,\n string memory nativeTokenUsdKey,\n MasterPriceOracle masterPriceOracle,\n address usdToken\n ) {\n admin = _admin;\n CAN_ADMIN_OVERWRITE = canAdminOverwrite;\n WTOKEN = wtoken;\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\n NATIVE_TOKEN_USD_KEY = nativeTokenUsdKey;\n MASTER_PRICE_ORACLE = masterPriceOracle;\n USD_TOKEN = usdToken;\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feeds The DIA price feed contract addresses for each of `underlyings`.\n * @param keys The keys for each of `underlyings`, in the format \"ETH/USD\" for example\n */\n function setPriceFeeds(\n address[] memory underlyings,\n DIAOracleV2[] memory feeds,\n string[] memory keys\n ) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feeds.length && underlyings.length == keys.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n\n // Check for existing oracle if !canAdminOverwrite\n if (!CAN_ADMIN_OVERWRITE)\n require(\n address(priceFeeds[underlying].feed) == address(0),\n \"Admin cannot overwrite existing assignments of price feeds to underlying tokens.\"\n );\n\n // Set feed and base currency\n priceFeeds[underlying] = DiaOracle({ feed: feeds[i], key: keys[i] });\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals!\n */\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for WTOKEN\n if (underlying == WTOKEN || underlying == address(0)) return 1e18;\n\n // Get token/Native price from Oracle\n DiaOracle memory feed = priceFeeds[underlying];\n require(address(feed.feed) != address(0), \"No oracle price feed found for this underlying ERC20 token.\");\n\n if (address(NATIVE_TOKEN_USD_PRICE_FEED) == address(0)) {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = MASTER_PRICE_ORACLE.price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\n } else {\n (uint128 nativeTokenUsdPrice, ) = NATIVE_TOKEN_USD_PRICE_FEED.getValue(NATIVE_TOKEN_USD_KEY);\n if (nativeTokenUsdPrice <= 0) return 0;\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/ERC4626Oracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IERC4626 } from \"../../compound/IERC4626.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\ncontract ERC4626Oracle is SafeOwnableUpgradeable, BasePriceOracle {\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @dev Fetches the fair LP token/ETH price from Balancer, with 18 decimals of precision.\n */\n function _price(address underlying) internal view virtual returns (uint256) {\n IERC4626 vault = IERC4626(underlying);\n address asset = vault.asset();\n uint256 redeemAmount = vault.previewRedeem(10 ** vault.decimals());\n uint256 underlyingPrice = BasePriceOracle(msg.sender).price(asset);\n return (redeemAmount * underlyingPrice) / 10 ** ERC20Upgradeable(asset).decimals();\n }\n}\n" + }, + "contracts/oracles/default/FixedNativePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title FixedEthPriceOracle\n * @notice Returns fixed prices of 1 denominated in the chain's native token for all tokens (expected to be used under a `MasterPriceOracle`).\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract FixedNativePriceOracle is BasePriceOracle {\n /**\n * @dev Returns the price in native token of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return 1e18;\n }\n\n /**\n * @notice Returns the price in native token of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in native token of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n return 1e18;\n }\n}\n" + }, + "contracts/oracles/default/FixedTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title FixedTokenPriceOracle\n * @notice Returns token prices using the prices for another token.\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract FixedTokenPriceOracle is BasePriceOracle {\n /**\n * @dev The token to base prices on.\n */\n address public immutable baseToken;\n\n /**\n * @dev Sets the token to base prices on.\n */\n constructor(address _baseToken) {\n baseToken = _baseToken;\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return BasePriceOracle(msg.sender).price(baseToken);\n }\n}\n" + }, + "contracts/oracles/default/PreferredPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\nimport \"../MasterPriceOracle.sol\";\nimport \"../default/ChainlinkPriceOracleV2.sol\";\n\n/**\n * @title PreferredPriceOracle\n * @notice Returns prices from MasterPriceOracle, ChainlinkPriceOracleV2, or prices from a tertiary oracle (in order of preference).\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract PreferredPriceOracle is BasePriceOracle {\n /**\n * @dev The primary `MasterPriceOracle`.\n */\n MasterPriceOracle public masterOracle;\n\n /**\n * @dev The secondary `ChainlinkPriceOracleV2`.\n */\n ChainlinkPriceOracleV2 public chainlinkOracleV2;\n\n /**\n * @dev The tertiary `PriceOracle`.\n */\n BasePriceOracle public tertiaryOracle;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Constructor to set the primary `MasterPriceOracle`, the secondary `ChainlinkPriceOracleV2`, and the tertiary `PriceOracle`.\n */\n constructor(\n MasterPriceOracle _masterOracle,\n ChainlinkPriceOracleV2 _chainlinkOracleV2,\n BasePriceOracle _tertiaryOracle,\n address _wtoken\n ) {\n require(address(_masterOracle) != address(0), \"MasterPriceOracle not set.\");\n require(address(_chainlinkOracleV2) != address(0), \"ChainlinkPriceOracleV2 not set.\");\n require(address(_tertiaryOracle) != address(0), \"Tertiary price oracle not set.\");\n masterOracle = _masterOracle;\n chainlinkOracleV2 = _chainlinkOracleV2;\n tertiaryOracle = _tertiaryOracle;\n wtoken = _wtoken;\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Try to get MasterPriceOracle price\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.price(underlying);\n\n // Try to get ChainlinkPriceOracleV2 price\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0)) return chainlinkOracleV2.price(underlying);\n\n // Otherwise, get price from tertiary oracle\n return BasePriceOracle(address(tertiaryOracle)).price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = cToken.underlying();\n\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Try to get MasterPriceOracle price\n if (address(masterOracle.oracles(underlying)) != address(0)) return masterOracle.getUnderlyingPrice(cToken);\n\n // Try to get ChainlinkPriceOracleV2 price\n if (address(chainlinkOracleV2.priceFeeds(underlying)) != address(0))\n return chainlinkOracleV2.getUnderlyingPrice(cToken);\n\n // Otherwise, get price from tertiary oracle\n return tertiaryOracle.getUnderlyingPrice(cToken);\n }\n}\n" + }, + "contracts/oracles/default/PythPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title PythPriceOracle\n * @notice Returns prices from Pyth.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract PythPriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to Pyth price IDs.\n */\n mapping(address => bytes32) public priceFeedIds;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n bytes32 public NATIVE_TOKEN_USD_FEED;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n\n IPyth public PYTH;\n\n function initialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public initializer {\n __SafeOwnable_init(msg.sender);\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n }\n\n function reinitialize(address pythAddress, bytes32 nativeTokenUsdFeed, address usdToken) public onlyOwnerOrAdmin {\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feedIds The Pyth Network feed IDs`.\n */\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feedIds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeedIds[underlying] = feedIds[i];\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/native price from Oracle\n bytes32 feed = priceFeedIds[underlying];\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\n\n if (NATIVE_TOKEN_USD_FEED == \"\") {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\n return\n tokenUsdPrice.price >= 0 ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\n } else {\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\n if (nativeTokenUsdPrice <= 0) return 0;\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/PythPriceOracleDmBTC.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { MasterPriceOracle } from \"../MasterPriceOracle.sol\";\nimport { BasePriceOracle, ICErc20 } from \"../BasePriceOracle.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/IPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { SafeOwnableUpgradeable } from \"../../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title PythPriceOracle\n * @notice Returns prices from Pyth.\n * @dev Implements `PriceOracle`.\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\n */\ncontract PythPriceOracleDmBTC is BasePriceOracle, SafeOwnableUpgradeable {\n /**\n * @notice Maps ERC20 token addresses to Pyth price IDs.\n */\n mapping(address => bytes32) public priceFeedIds;\n\n /**\n * @notice DIA NATIVE/USD price feed contracts.\n */\n bytes32 public NATIVE_TOKEN_USD_FEED;\n\n /**\n * @notice MasterPriceOracle for backup for USD price.\n */\n address public USD_TOKEN; // token to use as USD price (i.e. USDC)\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n\n IPyth public PYTH;\n\n address public DMBTC;\n\n function initialize(\n address pythAddress,\n bytes32 nativeTokenUsdFeed,\n address usdToken,\n address dmBTC\n ) public initializer {\n __SafeOwnable_init(msg.sender);\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n DMBTC = dmBTC;\n }\n\n function reinitialize(\n address pythAddress,\n bytes32 nativeTokenUsdFeed,\n address usdToken,\n address dmBTC\n ) public onlyOwnerOrAdmin {\n NATIVE_TOKEN_USD_FEED = nativeTokenUsdFeed;\n USD_TOKEN = usdToken;\n PYTH = IPyth(pythAddress);\n DMBTC = dmBTC;\n }\n\n /**\n * @dev Admin-only function to set price feeds.\n * @param underlyings Underlying token addresses for which to set price feeds.\n * @param feedIds The Pyth Network feed IDs`.\n */\n function setPriceFeeds(address[] memory underlyings, bytes32[] memory feedIds) external onlyOwner {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == feedIds.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // For each token/feed\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n // Set feed and base currency\n priceFeedIds[underlying] = feedIds[i];\n }\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n * Assumes price feeds are 8 decimals (TODO: doublecheck)\n */\n function _price(address underlying) internal view returns (uint256) {\n // Get token/native price from Oracle\n bytes32 feed = priceFeedIds[underlying];\n require(feed != \"\", \"No oracle price feed found for this underlying ERC20 token.\");\n uint256 normalizedPrice;\n if (NATIVE_TOKEN_USD_FEED == \"\") {\n // Get price from MasterPriceOracle\n uint256 usdNativeTokenPrice = BasePriceOracle(msg.sender).price(USD_TOKEN);\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals -- TODO: doublecheck\n PythStructs.Price memory tokenUsdPrice = PYTH.getPriceUnsafe(feed); // 8 decimals --- TODO: doublecheck\n normalizedPrice = tokenUsdPrice.price >= 0\n ? (uint256(uint64(tokenUsdPrice.price)) * 1e28) / uint256(nativeTokenUsdPrice)\n : 0;\n } else {\n uint128 nativeTokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(NATIVE_TOKEN_USD_FEED).price));\n if (nativeTokenUsdPrice <= 0) return 0;\n uint128 tokenUsdPrice = uint128(uint64(PYTH.getPriceUnsafe(feed).price));\n normalizedPrice = tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\n }\n if (underlying == DMBTC) {\n return normalizedPrice / 100000;\n }\n return normalizedPrice;\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n // Get price\n uint256 oraclePrice = _price(underlying);\n\n // Format and return price\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracle is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWeETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracleWeETH is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // special case for wrsETH\n // if input is wrsETH, we need to get the price of rsETH\n if (underlying == 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A) {\n underlying = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n }\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/RedstoneAdapterPriceOracleWrsETH.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/redstone/IRedstoneOracle.sol\";\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title RedstoneAdapterPriceOracle\n * @notice Returns prices from Redstone.\n * @dev Implements `BasePriceOracle`.\n * @author Veliko Minkov (https://github.com/vminkov)\n */\ncontract RedstoneAdapterPriceOracleWrsETH is BasePriceOracle {\n /**\n * @notice The Redstone oracle contract\n */\n IRedstoneOracle public REDSTONE_ORACLE;\n\n /**\n * @dev Constructor to set admin, wtoken address and native token USD price feed address\n * @param redstoneOracle The Redstone oracle contract address\n */\n constructor(address redstoneOracle) {\n REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle);\n }\n\n /**\n * @notice Internal function returning the price in of `underlying`.\n * @dev will return a price denominated in the native token\n */\n function _price(address underlying) internal view returns (uint256) {\n // special case for wrsETH\n // if input is wrsETH, we need to get the price of rsETH\n if (underlying == 0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd) {\n underlying = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\n }\n uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying);\n uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH();\n return (priceInUsd * 1e18) / priceOfNativeInUsd;\n }\n\n /**\n * @notice Returns the price in of `underlying` either in the\n * native token (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in WNATIVE of the token underlying `cToken`.\n * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying token address\n address underlying = cToken.underlying();\n\n uint256 oraclePrice = _price(underlying);\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n}\n" + }, + "contracts/oracles/default/SimplePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport \"../../ionic/SafeOwnableUpgradeable.sol\";\n\ncontract SimplePriceOracle is BasePriceOracle, SafeOwnableUpgradeable {\n mapping(address => uint256) prices;\n event PricePosted(\n address asset,\n uint256 previousPriceMantissa,\n uint256 requestedPriceMantissa,\n uint256 newPriceMantissa\n );\n\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n\n function getUnderlyingPrice(ICErc20 cToken) public view override returns (uint256) {\n if (compareStrings(cToken.symbol(), \"cETH\")) {\n return 1e18;\n } else {\n address underlying = ICErc20(address(cToken)).underlying();\n uint256 oraclePrice = prices[underlying];\n\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\n return\n underlyingDecimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - underlyingDecimals))\n : uint256(oraclePrice) / (10 ** (underlyingDecimals - 18));\n }\n }\n\n function setUnderlyingPrice(ICErc20 cToken, uint256 underlyingPriceMantissa) public onlyOwner {\n address asset = ICErc20(address(cToken)).underlying();\n emit PricePosted(asset, prices[asset], underlyingPriceMantissa, underlyingPriceMantissa);\n prices[asset] = underlyingPriceMantissa;\n }\n\n function setDirectPrice(address asset, uint256 _price) public onlyOwner {\n emit PricePosted(asset, prices[asset], _price, _price);\n prices[asset] = _price;\n }\n\n function price(address underlying) external view returns (uint256) {\n return prices[address(underlying)];\n }\n\n // v1 price oracle interface for use as backing of proxy\n function assetPrices(address asset) external view returns (uint256) {\n return prices[asset];\n }\n\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n}\n" + }, + "contracts/oracles/default/UniswapLikeLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"../BasePriceOracle.sol\";\n\n/**\n * @title UniswapLpTokenPriceOracle\n * @author David Lucid (https://github.com/davidlucid)\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\nabstract contract UniswapLikeLpTokenPriceOracle is BasePriceOracle {\n /**\n * @dev wtoken contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\n */\n constructor(address _wtoken) {\n wtoken = _wtoken;\n }\n\n function _price(address token) internal view virtual returns (uint256);\n\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying) * 1e18) / (10 ** uint256(ERC20Upgradeable(underlying).decimals()));\n }\n\n /**\n * @dev Fast square root function.\n * Implementation from: https://github.com/Uniswap/uniswap-lib/commit/99f3f28770640ba1bb1ff460ac7c5292fb8291a0\n * Original implementation: https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687\n */\n function sqrt(uint256 x) internal pure returns (uint256) {\n if (x == 0) return 0;\n uint256 xx = x;\n uint256 r = 1;\n\n if (xx >= 0x100000000000000000000000000000000) {\n xx >>= 128;\n r <<= 64;\n }\n if (xx >= 0x10000000000000000) {\n xx >>= 64;\n r <<= 32;\n }\n if (xx >= 0x100000000) {\n xx >>= 32;\n r <<= 16;\n }\n if (xx >= 0x10000) {\n xx >>= 16;\n r <<= 8;\n }\n if (xx >= 0x100) {\n xx >>= 8;\n r <<= 4;\n }\n if (xx >= 0x10) {\n xx >>= 4;\n r <<= 2;\n }\n if (xx >= 0x8) {\n r <<= 1;\n }\n\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return (r < r1 ? r : r1);\n }\n}\n" + }, + "contracts/oracles/default/UniswapLpTokenPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport { UniswapLikeLpTokenPriceOracle } from \"./UniswapLikeLpTokenPriceOracle.sol\";\n\n/**\n * @title UniswapLpTokenPriceOracle\n * @author David Lucid (https://github.com/davidlucid)\n * @notice UniswapLpTokenPriceOracle is a price oracle for Uniswap (and SushiSwap) LP tokens.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract UniswapLpTokenPriceOracle is UniswapLikeLpTokenPriceOracle {\n /**\n * @dev Fetches the fair LP token/ETH price from Uniswap, with 18 decimals of precision.\n */\n constructor(address _wtoken) UniswapLikeLpTokenPriceOracle(_wtoken) {}\n\n function _price(address token) internal view virtual override returns (uint256) {\n IUniswapV2Pair pair = IUniswapV2Pair(token);\n uint256 totalSupply = pair.totalSupply();\n if (totalSupply == 0) return 0;\n (uint256 r0, uint256 r1, ) = pair.getReserves();\n\n r0 = r0 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token0()).decimals()));\n r1 = r1 * 10 ** (18 - uint256(ERC20Upgradeable(pair.token1()).decimals()));\n\n address token0 = pair.token0();\n address token1 = pair.token1();\n\n // Get fair price of non-WETH token (underlying the pair) in terms of ETH\n uint256 token0FairPrice = token0 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token0);\n uint256 token1FairPrice = token1 == wtoken ? 1e18 : BasePriceOracle(msg.sender).price(token1);\n\n // Implementation from https://github.com/AlphaFinanceLab/homora-v2/blob/e643392d582c81f6695136971cff4b685dcd2859/contracts/oracle/UniswapV2Oracle.sol#L18\n uint256 sqrtK = (sqrt(r0 * r1) * (2 ** 112)) / totalSupply;\n return (((sqrtK * 2 * sqrt(token0FairPrice)) / (2 ** 56)) * sqrt(token1FairPrice)) / (2 ** 56);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../BasePriceOracle.sol\";\nimport \"./UniswapTwapPriceOracleV2Root.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\n * @dev Implements `PriceOracle` and `BasePriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2 is Initializable, BasePriceOracle {\n /**\n * @dev wtoken token contract address.\n */\n address public wtoken;\n\n /**\n * @dev UniswapTwapPriceOracleV2Root contract address.\n */\n UniswapTwapPriceOracleV2Root public rootOracle;\n\n /**\n * @dev UniswapV2Factory contract address.\n */\n address public uniswapV2Factory;\n\n /**\n * @dev The token on which to base TWAPs (its price must be available via `msg.sender`).\n */\n address public baseToken;\n\n /**\n * @dev Initalize that sets the UniswapTwapPriceOracleV2Root, UniswapV2Factory, and base token.\n * @param _rootOracle Sets `UniswapTwapPriceOracleV2Root`\n * @param _uniswapV2Factory Sets `UniswapV2Factory`\n * @param _baseToken The token on which to base TWAPs (its price must be available via `msg.sender`).\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address _rootOracle,\n address _uniswapV2Factory,\n address _baseToken,\n address _wtoken\n ) external initializer {\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\n require(_uniswapV2Factory != address(0), \"UniswapV2Factory not defined.\");\n rootOracle = UniswapTwapPriceOracleV2Root(_rootOracle);\n uniswapV2Factory = _uniswapV2Factory;\n wtoken = _wtoken;\n baseToken = _baseToken == address(0) ? address(wtoken) : _baseToken;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = cToken.underlying();\n\n // Get price, format, and return\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n return (_price(underlying) * 1e18) / baseUnit;\n }\n\n /**\n * @dev Internal function returning the price in ETH of `underlying`.\n */\n function _price(address underlying) internal view returns (uint256) {\n // Return 1e18 for wtoken\n if (underlying == wtoken) return 1e18;\n\n // Return root oracle ERC20/ETH TWAP\n uint256 twap = rootOracle.price(underlying, baseToken, uniswapV2Factory);\n return\n baseToken == address(wtoken)\n ? twap\n : (twap * BasePriceOracle(msg.sender).price(baseToken)) /\n (10 ** uint256(ERC20Upgradeable(baseToken).decimals()));\n }\n\n /**\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Factory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol\";\n\nimport \"./UniswapTwapPriceOracleV2.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2Factory\n * @notice Deploys and catalogs UniswapTwapPriceOracleV2 contracts.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2Factory {\n /**\n * @dev WETH token contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev `UniswapTwapPriceOracleV2Root` contract address.\n */\n address public immutable rootOracle;\n\n /**\n * @dev Implementation address for the `UniswapV3TwapPriceOracleV2`.\n */\n address public immutable logic;\n\n /**\n * @notice Maps `UniswapV2Factory` contracts to base tokens to `UniswapTwapPriceOracleV2` contract addresses.\n */\n mapping(address => mapping(address => UniswapTwapPriceOracleV2)) public oracles;\n\n /**\n * @dev Constructor that sets the `UniswapTwapPriceOracleV2Root` and `UniswapTwapPriceOracleV2` implementation contract.\n */\n constructor(address _rootOracle, address _logic, address _wtoken) {\n require(_rootOracle != address(0), \"UniswapTwapPriceOracleV2Root not defined.\");\n require(_logic != address(0), \"UniswapTwapPriceOracleV2 implementation/logic contract not defined.\");\n rootOracle = _rootOracle;\n logic = _logic;\n wtoken = _wtoken;\n }\n\n /**\n * @notice Deploys a `UniswapTwapPriceOracleV2`.\n * @param uniswapV2Factory The `UniswapV2Factory` contract of the pairs for which this oracle will be used.\n * @param baseToken The base token of the pairs for which this oracle will be used.\n */\n function deploy(address uniswapV2Factory, address baseToken) external returns (address) {\n // Input validation\n if (baseToken == address(0)) baseToken = address(wtoken);\n\n // Return existing oracle if present\n address currentOracle = address(oracles[uniswapV2Factory][baseToken]);\n if (currentOracle != address(0)) return currentOracle;\n\n // Deploy oracle\n bytes32 salt = keccak256(abi.encodePacked(uniswapV2Factory, baseToken));\n address oracle = ClonesUpgradeable.cloneDeterministic(logic, salt);\n UniswapTwapPriceOracleV2(oracle).initialize(rootOracle, uniswapV2Factory, baseToken, wtoken);\n\n // Set oracle in state\n oracles[uniswapV2Factory][baseToken] = UniswapTwapPriceOracleV2(oracle);\n\n // Return oracle address\n return oracle;\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Resolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IResolver } from \"ops/interfaces/IResolver.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"./UniswapTwapPriceOracleV2Root.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract UniswapTwapPriceOracleV2Resolver is IResolver, Ownable {\n struct PairConfig {\n address pair;\n address baseToken;\n uint256 minPeriod;\n uint256 deviationThreshold;\n }\n\n // need to store as arrays for the UniswapTwapPriceOracleV2Root workable functions\n address[] pairs;\n address[] baseTokens;\n uint256[] minPeriods;\n uint256[] deviationThresholds;\n\n UniswapTwapPriceOracleV2Root public root;\n uint256 public lastUpdate;\n\n constructor(PairConfig[] memory _pairConfigs, UniswapTwapPriceOracleV2Root _root) {\n for (uint256 i = 0; i < _pairConfigs.length; i++) {\n pairs[i] = _pairConfigs[i].pair;\n baseTokens[i] = _pairConfigs[i].baseToken;\n minPeriods[i] = _pairConfigs[i].minPeriod;\n deviationThresholds[i] = _pairConfigs[i].deviationThreshold;\n }\n root = _root;\n }\n\n function getPairs() external view returns (PairConfig[] memory) {\n PairConfig[] memory pairConfigs = new PairConfig[](pairs.length);\n for (uint256 i = 0; i < pairs.length; i++) {\n PairConfig memory pairConfig = PairConfig({\n pair: pairs[i],\n baseToken: baseTokens[i],\n minPeriod: minPeriods[i],\n deviationThreshold: deviationThresholds[i]\n });\n pairConfigs[i] = pairConfig;\n }\n return pairConfigs;\n }\n\n function changeRoot(UniswapTwapPriceOracleV2Root _root) external onlyOwner {\n root = _root;\n }\n\n function removeFromPairs(uint256 index) external onlyOwner {\n if (index >= pairs.length) return;\n\n for (uint256 i = index; i < pairs.length - 1; i++) {\n pairs[i] = pairs[i + 1];\n baseTokens[i] = baseTokens[i + 1];\n minPeriods[i] = minPeriods[i + 1];\n deviationThresholds[i] = deviationThresholds[i + 1];\n }\n pairs.pop();\n baseTokens.pop();\n minPeriods.pop();\n deviationThresholds.pop();\n }\n\n function addPair(PairConfig calldata pair) external onlyOwner {\n pairs.push(pair.pair);\n baseTokens.push(pair.baseToken);\n minPeriods.push(pair.minPeriod);\n deviationThresholds.push(pair.deviationThreshold);\n }\n\n function getWorkablePairs() public view returns (address[] memory) {\n bool[] memory workable = root.workable(pairs, baseTokens, minPeriods, deviationThresholds);\n uint256 workableCount = 0;\n for (uint256 i = 0; i < workable.length; i += 1) {\n if (workable[i]) {\n workableCount += 1;\n }\n }\n\n address[] memory workablePairs = new address[](workableCount);\n uint256 j = 0;\n\n for (uint256 i = 0; i < workable.length; i++) {\n if (workable[i]) {\n workablePairs[j++] = pairs[i];\n }\n }\n return workablePairs;\n }\n\n function updatePairs(address[] calldata workablePairs) external {\n if (workablePairs.length == 0) return;\n root.update(workablePairs);\n }\n\n function checker() external view override returns (bool canExec, bytes memory execPayload) {\n address[] memory workablePairs = getWorkablePairs();\n if (workablePairs.length == 0) {\n return (false, bytes(\"No workable pairs\"));\n }\n\n canExec = true;\n execPayload = abi.encodeWithSelector(this.updatePairs.selector, workablePairs);\n }\n}\n" + }, + "contracts/oracles/default/UniswapTwapPriceOracleV2Root.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport \"../../external/uniswap/IUniswapV2Factory.sol\";\n\n/**\n * @title UniswapTwapPriceOracleV2Root\n * @notice Stores cumulative prices and returns TWAPs for assets on Uniswap V2 pairs.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract UniswapTwapPriceOracleV2Root {\n /**\n * @dev wtoken token contract address.\n */\n address public immutable wtoken;\n\n /**\n * @dev Minimum TWAP interval.\n */\n uint256 public constant MIN_TWAP_TIME = 15 minutes;\n\n /**\n * @dev Constructor to set wtoken address\n */\n constructor(address _wtoken) {\n wtoken = _wtoken;\n }\n\n /**\n * @dev Return the TWAP value price0. Revert if TWAP time range is not within the threshold.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The pair to query for price0.\n */\n function price0TWAP(address pair) internal view returns (uint256) {\n uint256 length = observationCount[pair];\n require(length > 0, \"No length-1 TWAP observation.\");\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\n require(length > 1, \"No length-2 TWAP observation.\");\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\n }\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\n uint256 currPx0Cumu = currentPx0Cumu(pair);\n unchecked {\n return (currPx0Cumu - lastObservation.price0Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\n }\n }\n\n /**\n * @dev Return the TWAP value price1. Revert if TWAP time range is not within the threshold.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The pair to query for price1.\n */\n function price1TWAP(address pair) internal view returns (uint256) {\n uint256 length = observationCount[pair];\n require(length > 0, \"No length-1 TWAP observation.\");\n Observation memory lastObservation = observations[pair][(length - 1) % OBSERVATION_BUFFER];\n if (lastObservation.timestamp > block.timestamp - MIN_TWAP_TIME) {\n require(length > 1, \"No length-2 TWAP observation.\");\n lastObservation = observations[pair][(length - 2) % OBSERVATION_BUFFER];\n }\n uint256 elapsedTime = block.timestamp - lastObservation.timestamp;\n require(elapsedTime >= MIN_TWAP_TIME, \"Bad TWAP time.\");\n uint256 currPx1Cumu = currentPx1Cumu(pair);\n unchecked {\n return (currPx1Cumu - lastObservation.price1Cumulative) / (block.timestamp - lastObservation.timestamp); // overflow is desired\n }\n }\n\n /**\n * @dev Return the current price0 cumulative value on Uniswap.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The uniswap pair to query for price0 cumulative value.\n */\n function currentPx0Cumu(address pair) internal view returns (uint256 px0Cumu) {\n uint32 currTime = uint32(block.timestamp);\n px0Cumu = IUniswapV2Pair(pair).price0CumulativeLast();\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n if (lastTime != block.timestamp) {\n unchecked {\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\n px0Cumu += uint256((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired\n }\n }\n }\n\n /**\n * @dev Return the current price1 cumulative value on Uniswap.\n * Copied from: https://github.com/AlphaFinanceLab/homora-v2/blob/master/contracts/oracle/BaseKP3ROracle.sol\n * @param pair The uniswap pair to query for price1 cumulative value.\n */\n function currentPx1Cumu(address pair) internal view returns (uint256 px1Cumu) {\n uint32 currTime = uint32(block.timestamp);\n px1Cumu = IUniswapV2Pair(pair).price1CumulativeLast();\n (uint256 reserve0, uint256 reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n if (lastTime != currTime) {\n unchecked {\n uint32 timeElapsed = currTime - lastTime; // overflow is desired\n px1Cumu += uint256((reserve0 << 112) / reserve1) * timeElapsed; // overflow is desired\n }\n }\n }\n\n /**\n * @dev Returns the price of `underlying` in terms of `baseToken` given `factory`.\n */\n function price(address underlying, address baseToken, address factory) external view returns (uint256) {\n // Return ERC20/ETH TWAP\n address pair = IUniswapV2Factory(factory).getPair(underlying, baseToken);\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n return (((underlying < baseToken ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\n }\n\n /**\n * @dev Struct for cumulative price observations.\n */\n struct Observation {\n uint32 timestamp;\n uint256 price0Cumulative;\n uint256 price1Cumulative;\n }\n\n /**\n * @dev Length after which observations roll over to index 0.\n */\n uint8 public constant OBSERVATION_BUFFER = 4;\n\n /**\n * @dev Total observation count for each pair.\n */\n mapping(address => uint256) public observationCount;\n\n /**\n * @dev Array of cumulative price observations for each pair.\n */\n mapping(address => Observation[OBSERVATION_BUFFER]) public observations;\n\n /// @notice Get pairs for token combinations.\n function pairsFor(\n address[] calldata tokenA,\n address[] calldata tokenB,\n address factory\n ) external view returns (address[] memory) {\n require(\n tokenA.length > 0 && tokenA.length == tokenB.length,\n \"Token array lengths must be equal and greater than 0.\"\n );\n address[] memory pairs = new address[](tokenA.length);\n for (uint256 i = 0; i < tokenA.length; i++) pairs[i] = IUniswapV2Factory(factory).getPair(tokenA[i], tokenB[i]);\n return pairs;\n }\n\n /// @notice Check which of multiple pairs are workable/updatable.\n function workable(\n address[] calldata pairs,\n address[] calldata baseTokens,\n uint256[] calldata minPeriods,\n uint256[] calldata deviationThresholds\n ) external view returns (bool[] memory) {\n require(\n pairs.length > 0 &&\n pairs.length == baseTokens.length &&\n pairs.length == minPeriods.length &&\n pairs.length == deviationThresholds.length,\n \"Array lengths must be equal and greater than 0.\"\n );\n bool[] memory answers = new bool[](pairs.length);\n for (uint256 i = 0; i < pairs.length; i++)\n answers[i] = _workable(pairs[i], baseTokens[i], minPeriods[i], deviationThresholds[i]);\n return answers;\n }\n\n /// @dev Internal function to check if a pair is workable (updateable AND reserves have changed AND deviation threshold is satisfied).\n function _workable(\n address pair,\n address baseToken,\n uint256 minPeriod,\n uint256 deviationThreshold\n ) internal view returns (bool) {\n // Workable if:\n // 1) We have no observations\n // 2) The elapsed time since the last observation is > minPeriod AND reserves have changed AND deviation threshold is satisfied\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n if (observationCount[pair] <= 0) return true;\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n return\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\n (minPeriod >= MIN_TWAP_TIME ? minPeriod : MIN_TWAP_TIME) &&\n lastTime != observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp &&\n _deviation(pair, baseToken) >= deviationThreshold;\n }\n\n /// @dev Internal function to check if a pair's spot price's deviation from its TWAP price as a ratio scaled by 1e18\n function _deviation(address pair, address baseToken) internal view returns (uint256) {\n // Get token base unit\n address token0 = IUniswapV2Pair(pair).token0();\n bool useToken0Price = token0 != baseToken;\n address underlying = useToken0Price ? token0 : IUniswapV2Pair(pair).token1();\n uint256 baseUnit = 10 ** uint256(ERC20Upgradeable(underlying).decimals());\n\n // Get TWAP price\n uint256 twapPrice = (((useToken0Price ? price0TWAP(pair) : price1TWAP(pair)) / (2 ** 56)) * baseUnit) / (2 ** 56); // Scaled by 1e18, not 2 ** 112\n\n // Get spot price\n (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();\n uint256 spotPrice = useToken0Price ? (reserve1 * baseUnit) / reserve0 : (reserve0 * baseUnit) / reserve1;\n\n // Get ratio and return deviation\n uint256 ratio = (spotPrice * 1e18) / twapPrice;\n return ratio >= 1e18 ? ratio - 1e18 : 1e18 - ratio;\n }\n\n /// @dev Internal function to check if a pair is updatable at all.\n function _updateable(address pair) internal view returns (bool) {\n // Updateable if:\n // 1) We have no observations\n // 2) The elapsed time since the last observation is > MIN_TWAP_TIME\n // Note that we loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n return\n observationCount[pair] <= 0 ||\n (block.timestamp - observations[pair][(observationCount[pair] - 1) % OBSERVATION_BUFFER].timestamp) >\n MIN_TWAP_TIME;\n }\n\n /// @notice Update one pair.\n function update(address pair) external {\n require(_update(pair), \"Failed to update pair.\");\n }\n\n /// @notice Update multiple pairs at once.\n function update(address[] calldata pairs) external {\n bool worked = false;\n for (uint256 i = 0; i < pairs.length; i++) if (_update(pairs[i])) worked = true;\n require(worked, \"No pairs can be updated (yet).\");\n }\n\n /// @dev Internal function to update a single pair.\n function _update(address pair) internal returns (bool) {\n // Check if workable\n if (!_updateable(pair)) return false;\n\n // Get cumulative price(s)\n uint256 price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();\n uint256 price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();\n\n // Loop observationCount[pair] around OBSERVATION_BUFFER so we don't waste gas on new storage slots\n (, , uint32 lastTime) = IUniswapV2Pair(pair).getReserves();\n observations[pair][observationCount[pair] % OBSERVATION_BUFFER] = Observation(\n lastTime,\n price0Cumulative,\n price1Cumulative\n );\n observationCount[pair]++;\n return true;\n }\n}\n" + }, + "contracts/oracles/default/UniswapV3PriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../BasePriceOracle.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { ConcentratedLiquidityBasePriceOracle } from \"./ConcentratedLiquidityBasePriceOracle.sol\";\n\nimport \"../../external/uniswap/TickMath.sol\";\nimport \"../../external/uniswap/FullMath.sol\";\nimport \"../../external/uniswap/IUniswapV3Pool.sol\";\n\n/**\n * @title UniswapV3PriceOracle\n * @author Carlo Mazzaferro (https://github.com/carlomazzaferro)\n * @notice UniswapV3PriceOracle is a price oracle for Uniswap V3 pairs.\n * @dev Implements the `PriceOracle` interface used by Ionic pools (and Compound v2).\n */\ncontract UniswapV3PriceOracle is ConcentratedLiquidityBasePriceOracle {\n /**\n * @dev Fetches the price for a token from Algebra pools.\n */\n\n function _price(address token) internal view override returns (uint256) {\n uint32[] memory secondsAgos = new uint32[](2);\n uint256 twapWindow = poolFeeds[token].twapWindow;\n address baseToken = poolFeeds[token].baseToken;\n\n secondsAgos[0] = uint32(twapWindow);\n secondsAgos[1] = 0;\n\n IUniswapV3Pool pool = IUniswapV3Pool(poolFeeds[token].poolAddress);\n (int56[] memory tickCumulatives, ) = pool.observe(secondsAgos);\n\n int24 tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int56(int256(twapWindow)));\n uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(tick);\n\n uint256 tokenPrice = getPriceX96FromSqrtPriceX96(pool.token0(), token, sqrtPriceX96);\n return scalePrices(baseToken, token, tokenPrice);\n }\n}\n" + }, + "contracts/oracles/default/VelodromePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface Prices {\n function getRateToEth(address srcToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\n}\n\ncontract VelodromePriceOracle is BasePriceOracle {\n Prices immutable prices;\n\n constructor(address _prices) {\n prices = Prices(_prices);\n }\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return prices.getRateToEth(token, false);\n }\n}\n" + }, + "contracts/oracles/default/VelodromePriceOracleFraxtal.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../BasePriceOracle.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface Prices_Fraxtal {\n function getRate(address srcToken, address dstToken, bool useSrcWrappers) external view returns (uint256 weightedRate);\n}\n\ncontract VelodromePriceOracleFraxtal is BasePriceOracle {\n Prices_Fraxtal immutable prices;\n\n constructor(address _prices) {\n prices = Prices_Fraxtal(_prices);\n }\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n * @param underlying The underlying token address for which to get the price.\n * @return Price denominated in ETH (scaled by 1e18)\n */\n function price(address underlying) external view override returns (uint256) {\n return _price(underlying);\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n address underlying = cToken.underlying();\n // Comptroller needs prices to be scaled by 1e(36 - decimals)\n // Since `_price` returns prices scaled by 18 decimals, we must scale them by 1e(36 - 18 - decimals)\n return (_price(underlying));\n }\n\n /**\n * @notice Fetches the token/ETH price, with 18 decimals of precision.\n */\n function _price(address token) internal view returns (uint256) {\n return prices.getRate(token, 0xFC00000000000000000000000000000000000006, false);\n }\n}\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\n\n/**\n * @title MasterPriceOracle\n * @notice Use a combination of price oracles.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public oracles;\n\n /**\n * @dev Default/fallback `PriceOracle`.\n */\n BasePriceOracle public defaultOracle;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool internal noAdminOverwrite;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public fallbackOracles;\n\n /**\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n function canAdminOverwrite() external view returns (bool) {\n return !noAdminOverwrite;\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Event emitted when the default oracle is changed.\n */\n event NewDefaultOracle(address oldOracle, address newOracle);\n\n /**\n * @dev Event emitted when an underlying token's oracle is changed.\n */\n event NewOracle(address underlying, address oldOracle, address newOracle);\n\n /**\n * @dev Initialize state variables.\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\n * @param _defaultOracle The default `PriceOracle` contract to use.\n * @param _admin The admin who can assign oracles to underlying tokens.\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address[] memory underlyings,\n BasePriceOracle[] memory _oracles,\n BasePriceOracle _defaultOracle,\n address _admin,\n bool _canAdminOverwrite,\n address _wtoken\n ) external initializer {\n // Input validation\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\n\n // Initialize state variables\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, address(0), address(newOracle));\n }\n\n defaultOracle = _defaultOracle;\n admin = _admin;\n noAdminOverwrite = !_canAdminOverwrite;\n wtoken = _wtoken;\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(oracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(fallbackOracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n fallbackOracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Changes the default price oracle\n */\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\n BasePriceOracle oldOracle = defaultOracle;\n defaultOracle = newOracle;\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = address(ICErc20(address(cToken)).underlying());\n\n if (underlying == wtoken) return 1e18;\n\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n\n /**\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) public view override returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == wtoken) return 1e18;\n\n // Get underlying price from assigned oracle\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n}\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./compound/Unitroller.sol\";\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\nimport \"./ionic/DiamondExtension.sol\";\n\n/**\n * @title PoolDirectory\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\n */\ncontract PoolDirectory is SafeOwnableUpgradeable {\n /**\n * @dev Initializes a deployer whitelist if desired.\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\n */\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\n __SafeOwnable_init(msg.sender);\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\n }\n\n /**\n * @dev Struct for a Ionic interest rate pool.\n */\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n /**\n * @dev Array of Ionic interest rate pools.\n */\n Pool[] public pools;\n\n /**\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\n */\n mapping(address => uint256[]) private _poolsByAccount;\n\n /**\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\n */\n mapping(address => bool) public poolExists;\n\n /**\n * @dev Emitted when a new Ionic pool is added to the directory.\n */\n event PoolRegistered(uint256 index, Pool pool);\n\n /**\n * @dev Booleans indicating if the deployer whitelist is enforced.\n */\n bool public enforceDeployerWhitelist;\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\n */\n mapping(address => bool) public deployerWhitelist;\n\n /**\n * @dev Controls if the deployer whitelist is to be enforced.\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\n */\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\n enforceDeployerWhitelist = enforce;\n }\n\n /**\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\n * @param deployers Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\n require(deployers.length > 0, \"No deployers supplied.\");\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\n }\n\n /**\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\n * @param name The name of the pool.\n * @param comptroller The pool's Comptroller proxy contract address.\n * @return The index of the registered Ionic pool.\n */\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\n require(bytes(name).length <= 100, \"No pool name supplied.\");\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n _poolsByAccount[msg.sender].push(pools.length - 1);\n poolExists[comptroller] = true;\n emit PoolRegistered(pools.length - 1, pool);\n return pools.length - 1;\n }\n\n function _deprecatePool(address comptroller) external onlyOwner {\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller == comptroller) {\n _deprecatePool(i);\n break;\n }\n }\n }\n\n function _deprecatePool(uint256 index) public onlyOwner {\n Pool storage ionicPool = pools[index];\n\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\n\n // swap with the last pool of the creator and delete\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\n for (uint256 i = 0; i < creatorPools.length; i++) {\n if (creatorPools[i] == index) {\n creatorPools[i] = creatorPools[creatorPools.length - 1];\n creatorPools.pop();\n break;\n }\n }\n\n // leave it to true to deny the re-registering of the same pool\n poolExists[ionicPool.comptroller] = true;\n\n // nullify the storage\n ionicPool.comptroller = address(0);\n ionicPool.creator = address(0);\n ionicPool.name = \"\";\n ionicPool.blockPosted = 0;\n ionicPool.timestampPosted = 0;\n }\n\n /**\n * @dev Deploys a new Ionic pool and adds to the directory.\n * @param name The name of the pool.\n * @param implementation The Comptroller implementation contract address.\n * @param constructorData Encoded construction data for `Unitroller constructor()`\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\n * @param closeFactor The pool's close factor (scaled by 1e18).\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\n * @param priceOracle The pool's PriceOracle contract address.\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\n */\n function deployPool(\n string memory name,\n address implementation,\n bytes calldata constructorData,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive,\n address priceOracle\n ) external returns (uint256, address) {\n // Input validation\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\n\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(\n 0,\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\n unitrollerCreationCode\n );\n\n // Setup the pool\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\n // Set up the extensions\n comptrollerProxy._upgrade();\n\n // Set pool parameters\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\n require(\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\n \"Failed to set pool liquidation incentive.\"\n );\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\n\n // Whitelist\n if (enforceWhitelist)\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\n\n // Make msg.sender the admin\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\n\n // Register the pool with this PoolDirectory\n return (_registerPool(name, proxy), proxy);\n }\n\n /**\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory activePools = new Pool[](count);\n uint256[] memory poolIds = new uint256[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n poolIds[index] = i;\n activePools[index] = pools[i];\n index++;\n }\n }\n\n return (poolIds, activePools);\n }\n\n /**\n * @notice Returns arrays of all Ionic pools' data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getAllPools() public view returns (Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory result = new Pool[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n result[index++] = pools[i];\n }\n }\n\n return result;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n indexes[index] = i;\n poolsOfUser[index] = activePools[i];\n index++;\n }\n\n return (indexes, poolsOfUser);\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\n */\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\n (, Pool[] memory activePools) = getActivePools();\n\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\n indexes[i] = _poolsByAccount[account][i];\n accountPools[i] = activePools[_poolsByAccount[account][i]];\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Modify existing Ionic pool name.\n */\n function setPoolName(uint256 index, string calldata name) external {\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\n require(\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\n \"!permission\"\n );\n pools[index].name = name;\n }\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\n */\n mapping(address => bool) public adminWhitelist;\n\n /**\n * @dev used as salt for the creation of new pools\n */\n uint256 public poolsCounter;\n\n /**\n * @dev Event emitted when the admin whitelist is updated.\n */\n event AdminWhitelistUpdated(address[] admins, bool status);\n\n /**\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\n * @param admins Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\n require(admins.length > 0, \"No admins supplied.\");\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\n emit AdminWhitelistUpdated(admins, status);\n }\n\n /**\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getVerifiedPoolsOfWhitelistedAccount(\n address account\n ) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n indexes[index] = i;\n accountWhitelistedPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, accountWhitelistedPools);\n }\n}\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\n\n/**\n * @title PoolLens\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLens is Initializable {\n error ComptrollerError(uint256 errCode);\n\n /**\n * @notice Initialize the `PoolDirectory` contract object.\n * @param _directory The PoolDirectory\n * @param _name Name for the nativeToken\n * @param _symbol Symbol for the nativeToken\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\n * @param _hardcodedNames Harcoded name for these tokens\n * @param _hardcodedSymbols Harcoded symbol for these tokens\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\n */\n function initialize(\n PoolDirectory _directory,\n string memory _name,\n string memory _symbol,\n address[] memory _hardcodedAddresses,\n string[] memory _hardcodedNames,\n string[] memory _hardcodedSymbols,\n string[] memory _uniswapLPTokenNames,\n string[] memory _uniswapLPTokenSymbols,\n string[] memory _uniswapLPTokenDisplayNames\n ) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n require(\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\n \"Hardcoded addresses lengths not equal.\"\n );\n require(\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\n \"Uniswap LP token names lengths not equal.\"\n );\n\n directory = _directory;\n name = _name;\n symbol = _symbol;\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\n }\n\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\n uniswapData.push(\n UniswapData({\n name: _uniswapLPTokenNames[i],\n symbol: _uniswapLPTokenSymbols[i],\n displayName: _uniswapLPTokenDisplayNames[i]\n })\n );\n }\n }\n\n string public name;\n string public symbol;\n\n struct TokenData {\n string name;\n string symbol;\n }\n mapping(address => TokenData) hardcoded;\n\n struct UniswapData {\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\n string symbol; // ie \"UNI-V2\" or \"SLP\"\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\n }\n UniswapData[] uniswapData;\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @dev Struct for Ionic pool summary data.\n */\n struct IonicPoolData {\n uint256 totalSupply;\n uint256 totalBorrow;\n address[] underlyingTokens;\n string[] underlyingSymbols;\n bool whitelistedAdmin;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsWithData()\n external\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\n {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsByVerificationWithData(\n bool whitelistedAdmin\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\n whitelistedAdmin\n );\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsOIonicrWithData(\n address user\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\n return (indexes, userPools, data, errored);\n }\n\n /**\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\n bool[] memory errored = new bool[](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\n uint256 _totalSupply,\n uint256 _totalBorrow,\n address[] memory _underlyingTokens,\n string[] memory _underlyingSymbols,\n bool _whitelistedAdmin\n ) {\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\n } catch {\n errored[i] = true;\n }\n }\n\n return (data, errored);\n }\n\n /**\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\n */\n function getPoolSummary(\n IonicComptroller comptroller\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\n uint256 totalBorrow = 0;\n uint256 totalSupply = 0;\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n address[] memory underlyingTokens = new address[](cTokens.length);\n string[] memory underlyingSymbols = new string[](cTokens.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n cToken.accrueInterest();\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\n uint256 assetTotalSupply = cToken.getCash() +\n assetTotalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\n\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\n }\n\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\n }\n\n /**\n * @dev Struct for a Ionic pool asset.\n */\n struct PoolAsset {\n address cToken;\n address underlyingToken;\n string underlyingName;\n string underlyingSymbol;\n uint256 underlyingDecimals;\n uint256 underlyingBalance;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 totalSupply;\n uint256 totalBorrow;\n uint256 supplyBalance;\n uint256 borrowBalance;\n uint256 liquidity;\n bool membership;\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\n address oracle;\n uint256 collateralFactor;\n uint256 reserveFactor;\n uint256 adminFee;\n uint256 ionicFee;\n bool borrowGuardianPaused;\n bool mintGuardianPaused;\n }\n\n /**\n * @notice Returns data on the specified assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\n * @param cTokens The cToken contract addresses of the assets to query.\n * @param user The user for which to get account data.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(\n IonicComptroller comptroller,\n ICErc20[] memory cTokens,\n address user\n ) internal returns (PoolAsset[] memory) {\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\n if (isListed) arrayLength++;\n }\n\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\n uint256 index = 0;\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n // Check if market is listed and get collateral factor\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\n if (!isListed) continue;\n\n // Start adding data to PoolAsset\n PoolAsset memory asset;\n ICErc20 cToken = cTokens[i];\n asset.cToken = address(cToken);\n\n cToken.accrueInterest();\n\n // Get underlying asset data\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\n asset.underlyingDecimals = underlying.decimals();\n asset.underlyingBalance = underlying.balanceOf(user);\n\n // Get cToken data\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\n asset.liquidity = cToken.getCash();\n asset.totalBorrow = cToken.totalBorrowsCurrent();\n asset.totalSupply =\n asset.liquidity +\n asset.totalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\n asset.membership = comptroller.checkMembership(user, cToken);\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\n\n // Get oracle for this cToken\n asset.oracle = address(oracle);\n\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\n asset.oracle = address(_oracle);\n } catch {}\n\n // More cToken data\n asset.collateralFactor = collateralFactorMantissa;\n asset.reserveFactor = cToken.reserveFactorMantissa();\n asset.adminFee = cToken.adminFeeMantissa();\n asset.ionicFee = cToken.ionicFeeMantissa();\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\n\n // Add to assets array and increment index\n detailedAssets[index] = asset;\n index++;\n }\n\n return (detailedAssets);\n }\n\n function getBorrowCapsPerCollateral(\n ICErc20 borrowedAsset,\n IonicComptroller comptroller\n )\n internal\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsAgainstCollateral,\n bool[] memory borrowingBlacklistedAgainstCollateral\n )\n {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n collateral = new address[](poolMarkets.length);\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\n\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n address collateralAddress = address(poolMarkets[i]);\n if (collateralAddress != address(borrowedAsset)) {\n collateral[i] = collateralAddress;\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\n address(borrowedAsset),\n collateralAddress\n );\n }\n }\n }\n\n /**\n * @notice Returns the `name` and `symbol` of `token`.\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\n * @param token An ERC20 token contract object.\n * @return The `name` and `symbol`.\n */\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\n // i.e. MKR is a DSToken and uses bytes32\n if (bytes(hardcoded[token].symbol).length != 0) {\n return (hardcoded[token].name, hardcoded[token].symbol);\n }\n\n // Get name and symbol from token contract\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\n string memory _name = tokenContract.name();\n string memory _symbol = tokenContract.symbol();\n\n return (_name, _symbol);\n }\n\n /**\n * @notice Returns the assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\n }\n\n /**\n * @dev Struct for a Ionic pool user.\n */\n struct IonicPoolUser {\n address account;\n uint256 totalBorrow;\n uint256 totalCollateral;\n uint256 health;\n }\n\n /**\n * @notice Returns arrays of PoolAsset for a specific user\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\n return assets;\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n }\n\n return (assets, supplyCapsPerAsset);\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsDataForPool(\n IonicComptroller comptroller\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\n }\n\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\n }\n\n /**\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n }\n\n /**\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsDataForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap,\n uint256 nonWhitelistedTotalBorrows\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n uint256 totalBorrows = asset.totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\n * Note that the whitelist does not have to be enforced.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getWhitelistedPoolsByAccount(\n address account\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) {\n indexes[index] = i;\n accountPools[index] = pools[i];\n index++;\n break;\n }\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getWhitelistedPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\n }\n\n function getHealthFactorHypothetical(\n IonicComptroller pool,\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\n account,\n cTokenModify,\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n\n if (err != 0) revert ComptrollerError(err);\n\n if (shortfall > 0) {\n // HF < 1.0\n return (collateralValue * 1e18) / (collateralValue + shortfall);\n } else {\n // HF >= 1.0\n if (collateralValue <= liquidity) return type(uint256).max;\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\n }\n }\n}\n" + }, + "contracts/PoolLensSecondary.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport { IUniswapV2Pair } from \"./external/uniswap/IUniswapV2Pair.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\n\ninterface IRewardsDistributor_PLS {\n function rewardToken() external view returns (address);\n\n function compSupplySpeeds(address) external view returns (uint256);\n\n function compBorrowSpeeds(address) external view returns (uint256);\n\n function compAccrued(address) external view returns (uint256);\n\n function flywheelPreSupplierAction(address cToken, address supplier) external;\n\n function flywheelPreBorrowerAction(address cToken, address borrower) external;\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n}\n\n/**\n * @title PoolLensSecondary\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLensSecondary returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLensSecondary is Initializable {\n /**\n * @notice Constructor to set the `PoolDirectory` contract object.\n */\n function initialize(PoolDirectory _directory) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n directory = _directory;\n }\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @notice Struct for ownership over a CToken.\n */\n struct CTokenOwnership {\n address cToken;\n address admin;\n bool adminHasRights;\n bool ionicAdminHasRights;\n }\n\n /**\n * @notice Returns the admin, admin rights, Ionic admin (constant), Ionic admin rights, and an array of cTokens with differing properties.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolOwnership(\n IonicComptroller comptroller\n ) external view returns (address, bool, bool, CTokenOwnership[] memory) {\n // Get pool ownership\n address comptrollerAdmin = comptroller.admin();\n bool comptrollerAdminHasRights = comptroller.adminHasRights();\n bool comptrollerIonicAdminHasRights = comptroller.ionicAdminHasRights();\n\n // Get cToken ownership\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n\n address cTokenAdmin;\n try cToken.admin() returns (address _cTokenAdmin) {\n cTokenAdmin = _cTokenAdmin;\n } catch {\n continue;\n }\n bool cTokenAdminHasRights = cToken.adminHasRights();\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\n\n // If outlier, push to array\n if (\n cTokenAdmin != comptrollerAdmin ||\n cTokenAdminHasRights != comptrollerAdminHasRights ||\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\n ) arrayLength++;\n }\n\n CTokenOwnership[] memory outliers = new CTokenOwnership[](arrayLength);\n uint256 arrayIndex = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n\n address cTokenAdmin;\n try cToken.admin() returns (address _cTokenAdmin) {\n cTokenAdmin = _cTokenAdmin;\n } catch {\n continue;\n }\n bool cTokenAdminHasRights = cToken.adminHasRights();\n bool cTokenIonicAdminHasRights = cToken.ionicAdminHasRights();\n\n // If outlier, push to array and increment array index\n if (\n cTokenAdmin != comptrollerAdmin ||\n cTokenAdminHasRights != comptrollerAdminHasRights ||\n cTokenIonicAdminHasRights != comptrollerIonicAdminHasRights\n ) {\n outliers[arrayIndex] = CTokenOwnership(\n address(cToken),\n cTokenAdmin,\n cTokenAdminHasRights,\n cTokenIonicAdminHasRights\n );\n arrayIndex++;\n }\n }\n\n return (comptrollerAdmin, comptrollerAdminHasRights, comptrollerIonicAdminHasRights, outliers);\n }\n\n /**\n * @notice Determine the maximum redeem amount of a cToken.\n * @param cTokenModify The market to hypothetically redeem in.\n * @param account The account to determine liquidity for.\n * @return Maximum redeem amount.\n */\n function getMaxRedeem(address account, ICErc20 cTokenModify) external returns (uint256) {\n return getMaxRedeemOrBorrow(account, cTokenModify, false);\n }\n\n /**\n * @notice Determine the maximum borrow amount of a cToken.\n * @param cTokenModify The market to hypothetically borrow in.\n * @param account The account to determine liquidity for.\n * @return Maximum borrow amount.\n */\n function getMaxBorrow(address account, ICErc20 cTokenModify) external returns (uint256) {\n return getMaxRedeemOrBorrow(account, cTokenModify, true);\n }\n\n /**\n * @dev Internal function to determine the maximum borrow/redeem amount of a cToken.\n * @param cTokenModify The market to hypothetically borrow/redeem in.\n * @param account The account to determine liquidity for.\n * @return Maximum borrow/redeem amount.\n */\n function getMaxRedeemOrBorrow(address account, ICErc20 cTokenModify, bool isBorrow) internal returns (uint256) {\n IonicComptroller comptroller = IonicComptroller(cTokenModify.comptroller());\n return comptroller.getMaxRedeemOrBorrow(account, cTokenModify, isBorrow);\n }\n\n /**\n * @notice Returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\n * @param comptroller The Ionic pool Comptroller to check.\n */\n function getRewardSpeedsByPool(\n IonicComptroller comptroller\n ) public view returns (ICErc20[] memory, address[] memory, address[] memory, uint256[][] memory, uint256[][] memory) {\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n address[] memory distributors;\n\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n distributors = _distributors;\n } catch {\n distributors = new address[](0);\n }\n\n address[] memory rewardTokens = new address[](distributors.length);\n uint256[][] memory supplySpeeds = new uint256[][](allMarkets.length);\n uint256[][] memory borrowSpeeds = new uint256[][](allMarkets.length);\n\n // Get reward tokens for each distributor\n for (uint256 i = 0; i < distributors.length; i++) {\n rewardTokens[i] = IRewardsDistributor_PLS(distributors[i]).rewardToken();\n }\n\n // Get reward speeds for each market for each distributor\n for (uint256 i = 0; i < allMarkets.length; i++) {\n address cToken = address(allMarkets[i]);\n supplySpeeds[i] = new uint256[](distributors.length);\n borrowSpeeds[i] = new uint256[](distributors.length);\n\n for (uint256 j = 0; j < distributors.length; j++) {\n IRewardsDistributor_PLS distributor = IRewardsDistributor_PLS(distributors[j]);\n supplySpeeds[i][j] = distributor.compSupplySpeeds(cToken);\n borrowSpeeds[i][j] = distributor.compBorrowSpeeds(cToken);\n }\n }\n\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\n }\n\n /**\n * @notice For each `Comptroller`, returns an array of all markets, an array of all `RewardsDistributor` contracts, an array of reward token addresses for each `RewardsDistributor`, an array of supply speeds for each distributor for each, and their borrow speeds.\n * @param comptrollers The Ionic pool Comptrollers to check.\n */\n function getRewardSpeedsByPools(\n IonicComptroller[] memory comptrollers\n )\n external\n view\n returns (ICErc20[][] memory, address[][] memory, address[][] memory, uint256[][][] memory, uint256[][][] memory)\n {\n ICErc20[][] memory allMarkets = new ICErc20[][](comptrollers.length);\n address[][] memory distributors = new address[][](comptrollers.length);\n address[][] memory rewardTokens = new address[][](comptrollers.length);\n uint256[][][] memory supplySpeeds = new uint256[][][](comptrollers.length);\n uint256[][][] memory borrowSpeeds = new uint256[][][](comptrollers.length);\n for (uint256 i = 0; i < comptrollers.length; i++)\n (allMarkets[i], distributors[i], rewardTokens[i], supplySpeeds[i], borrowSpeeds[i]) = getRewardSpeedsByPool(\n comptrollers[i]\n );\n return (allMarkets, distributors, rewardTokens, supplySpeeds, borrowSpeeds);\n }\n\n /**\n * @notice Returns unaccrued rewards by `holder` from `cToken` on `distributor`.\n * @param holder The address to check.\n * @param distributor The RewardsDistributor to check.\n * @param cToken The CToken to check.\n * @return Unaccrued (unclaimed) supply-side rewards and unaccrued (unclaimed) borrow-side rewards.\n */\n function getUnaccruedRewards(\n address holder,\n IRewardsDistributor_PLS distributor,\n ICErc20 cToken\n ) internal returns (uint256, uint256) {\n // Get unaccrued supply rewards\n uint256 compAccruedPrior = distributor.compAccrued(holder);\n distributor.flywheelPreSupplierAction(address(cToken), holder);\n uint256 supplyRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\n\n // Get unaccrued borrow rewards\n compAccruedPrior = distributor.compAccrued(holder);\n distributor.flywheelPreBorrowerAction(address(cToken), holder);\n uint256 borrowRewardsUnaccrued = distributor.compAccrued(holder) - compAccruedPrior;\n\n // Return both\n return (supplyRewardsUnaccrued, borrowRewardsUnaccrued);\n }\n\n /**\n * @notice Returns all unclaimed rewards accrued by the `holder` on `distributors`.\n * @param holder The address to check.\n * @param distributors The `RewardsDistributor` contracts to check.\n * @return For each of `distributors`: total quantity of unclaimed rewards, array of cTokens, array of unaccrued (unclaimed) supply-side and borrow-side rewards per cToken, and quantity of funds available in the distributor.\n */\n function getUnclaimedRewardsByDistributors(\n address holder,\n IRewardsDistributor_PLS[] memory distributors\n ) external returns (address[] memory, uint256[] memory, ICErc20[][] memory, uint256[2][][] memory, uint256[] memory) {\n address[] memory rewardTokens = new address[](distributors.length);\n uint256[] memory compUnclaimedTotal = new uint256[](distributors.length);\n ICErc20[][] memory allMarkets = new ICErc20[][](distributors.length);\n uint256[2][][] memory rewardsUnaccrued = new uint256[2][][](distributors.length);\n uint256[] memory distributorFunds = new uint256[](distributors.length);\n\n for (uint256 i = 0; i < distributors.length; i++) {\n IRewardsDistributor_PLS distributor = distributors[i];\n rewardTokens[i] = distributor.rewardToken();\n allMarkets[i] = distributor.getAllMarkets();\n rewardsUnaccrued[i] = new uint256[2][](allMarkets[i].length);\n for (uint256 j = 0; j < allMarkets[i].length; j++)\n (rewardsUnaccrued[i][j][0], rewardsUnaccrued[i][j][1]) = getUnaccruedRewards(\n holder,\n distributor,\n allMarkets[i][j]\n );\n compUnclaimedTotal[i] = distributor.compAccrued(holder);\n distributorFunds[i] = IERC20Upgradeable(rewardTokens[i]).balanceOf(address(distributor));\n }\n\n return (rewardTokens, compUnclaimedTotal, allMarkets, rewardsUnaccrued, distributorFunds);\n }\n\n /**\n * @notice Returns arrays of indexes, `Comptroller` proxy contracts, and `RewardsDistributor` contracts for Ionic pools supplied to by `account`.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getRewardsDistributorsBySupplier(\n address supplier\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\n // Get array length\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n try IonicComptroller(pools[i].comptroller).suppliers(supplier) returns (bool isSupplier) {\n if (isSupplier) arrayLength++;\n } catch {}\n }\n\n // Build array\n uint256[] memory indexes = new uint256[](arrayLength);\n IonicComptroller[] memory comptrollers = new IonicComptroller[](arrayLength);\n address[][] memory distributors = new address[][](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n try comptroller.suppliers(supplier) returns (bool isSupplier) {\n if (isSupplier) {\n indexes[index] = i;\n comptrollers[index] = comptroller;\n\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n distributors[index] = _distributors;\n } catch {}\n\n index++;\n }\n } catch {}\n }\n\n // Return distributors\n return (indexes, comptrollers, distributors);\n }\n\n /**\n * @notice The returned list of flywheels contains address(0) for flywheels for which the user has no rewards to claim\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getFlywheelsToClaim(\n address user\n ) external view returns (uint256[] memory, IonicComptroller[] memory, address[][] memory) {\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n\n IonicComptroller[] memory comptrollers = new IonicComptroller[](pools.length);\n address[][] memory distributors = new address[][](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n try comptroller.getRewardsDistributors() returns (address[] memory _distributors) {\n comptrollers[i] = comptroller;\n distributors[i] = flywheelsWithRewardsForPoolUser(user, _distributors);\n } catch {}\n }\n\n return (poolIds, comptrollers, distributors);\n }\n\n function flywheelsWithRewardsForPoolUser(\n address user,\n address[] memory _distributors\n ) internal view returns (address[] memory) {\n address[] memory distributors = new address[](_distributors.length);\n for (uint256 j = 0; j < _distributors.length; j++) {\n if (IRewardsDistributor_PLS(_distributors[j]).compAccrued(user) > 0) {\n distributors[j] = _distributors[j];\n }\n }\n\n return distributors;\n }\n}\n" + }, + "contracts/test/abstracts/AbstractAssetTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { AbstractERC4626Test } from \"./AbstractERC4626Test.sol\";\nimport { ITestConfigStorage } from \"./ITestConfigStorage.sol\";\n\ncontract AbstractAssetTest is BaseTest {\n AbstractERC4626Test public test;\n ITestConfigStorage public testConfigStorage;\n\n function setUpTestContract(bytes calldata testConfig) public virtual {\n // test._setUp(MockERC20(address(IBeefyVault(testConfig.beefyVault).want())).symbol(), testConfig);\n }\n\n function runTest(function() external testFn) public {\n if (shouldRunForChain(block.chainid)) {\n for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\n this.setUpTestContract(testConfigStorage.getTestConfig(i));\n testFn();\n }\n }\n }\n\n function testInitializedValues() public virtual {\n // for (uint8 i; i < testConfigStorage.getTestConfigLength(); i++) {\n // this.setUpTestContract(testConfigs[i]);\n // test.testInitializedValues(asset.name(), asset.symbol());\n // }\n }\n\n function testPreviewDepositAndMintReturnTheSameValue() public {\n this.runTest(test.testPreviewDepositAndMintReturnTheSameValue);\n }\n\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\n this.runTest(test.testPreviewWithdrawAndRedeemReturnTheSameValue);\n }\n\n function testDeposit() public {\n this.runTest(test.testDeposit);\n }\n\n function testDepositWithIncreasedVaultValue() public virtual {\n this.runTest(test.testDepositWithIncreasedVaultValue);\n }\n\n function testDepositWithDecreasedVaultValue() public virtual {\n this.runTest(test.testDepositWithDecreasedVaultValue);\n }\n\n function testMultipleDeposit() public {\n this.runTest(test.testMultipleDeposit);\n }\n\n function testMint() public {\n this.runTest(test.testMint);\n }\n\n function testMultipleMint() public {\n this.runTest(test.testMultipleMint);\n }\n\n function testWithdraw() public {\n this.runTest(test.testWithdraw);\n }\n\n function testWithdrawWithIncreasedVaultValue() public virtual {\n this.runTest(test.testWithdrawWithIncreasedVaultValue);\n }\n\n function testWithdrawWithDecreasedVaultValue() public virtual {\n this.runTest(test.testWithdrawWithDecreasedVaultValue);\n }\n\n function testMultipleWithdraw() public {\n this.runTest(test.testMultipleWithdraw);\n }\n\n function testRedeem() public {\n this.runTest(test.testRedeem);\n }\n\n function testMultipleRedeem() public {\n this.runTest(test.testMultipleRedeem);\n }\n\n function testPauseContract() public {\n this.runTest(test.testPauseContract);\n }\n\n function testEmergencyWithdrawAndPause() public {\n this.runTest(test.testEmergencyWithdrawAndPause);\n }\n\n function testEmergencyWithdrawAndRedeem() public {\n this.runTest(test.testEmergencyWithdrawAndRedeem);\n }\n}\n" + }, + "contracts/test/abstracts/AbstractERC4626Test.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../helpers/WithPool.sol\";\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { IonicERC4626 } from \"../../ionic/strategies/IonicERC4626.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Authority } from \"solmate/auth/Auth.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\n\nabstract contract AbstractERC4626Test is WithPool {\n using FixedPointMathLib for uint256;\n\n IonicERC4626 plugin;\n\n string testPreFix;\n\n uint256 public depositAmount = 100e18;\n uint256 BPS_DENOMINATOR = 10_000;\n\n uint256 initialStrategyBalance;\n uint256 initialStrategySupply;\n\n constructor() {\n _forkAtBlock(uint128(block.chainid), block.number);\n }\n\n function _setUp(string memory _testPreFix, bytes calldata data) public virtual;\n\n function deposit(address _owner, uint256 amount) public {\n vm.startPrank(_owner);\n underlyingToken.approve(address(plugin), amount);\n plugin.deposit(amount, _owner);\n vm.stopPrank();\n }\n\n function sendUnderlyingToken(uint256 amount, address recipient) public {\n deal(address(underlyingToken), recipient, amount);\n }\n\n function increaseAssetsInVault() public virtual {}\n\n function decreaseAssetsInVault() public virtual {}\n\n function getDepositShares() public view virtual returns (uint256);\n\n function getStrategyBalance() public view virtual returns (uint256);\n\n function getExpectedDepositShares() public view virtual returns (uint256);\n\n function testInitializedValues(string memory assetName, string memory assetSymbol) public virtual {\n assertEq(\n plugin.name(),\n string(abi.encodePacked(\"Midas \", assetName, \" Vault\")),\n string(abi.encodePacked(\"!name \", testPreFix))\n );\n assertEq(\n plugin.symbol(),\n string(abi.encodePacked(\"mv\", assetSymbol)),\n string(abi.encodePacked(\"!symbol \", testPreFix))\n );\n assertEq(address(plugin.asset()), address(underlyingToken), string(abi.encodePacked(\"!asset \", testPreFix)));\n // assertEq(\n // address(BeefyERC4626(address(plugin)).beefyVault()),\n // address(beefyVault),\n // string(abi.encodePacked(\"!beefyVault \", testPreFix))\n // );\n }\n\n function testPreviewDepositAndMintReturnTheSameValue() public {\n uint256 returnedShares = plugin.previewDeposit(depositAmount);\n assertApproxEqAbs(\n plugin.previewMint(returnedShares),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!previewMint \", testPreFix))\n );\n }\n\n function testPreviewWithdrawAndRedeemReturnTheSameValue() public {\n deposit(address(this), depositAmount);\n uint256 withdrawalAmount = 10e18;\n uint256 reqShares = plugin.previewWithdraw(withdrawalAmount);\n assertApproxEqAbs(\n plugin.previewRedeem(reqShares),\n withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!previewRedeem \", testPreFix))\n );\n }\n\n function testDeposit() public virtual {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShares \", testPreFix))\n );\n }\n\n function testDepositWithIncreasedVaultValue() public {\n // lpDepositor just mints the exact amount of depositShares as the user deposits in assets\n uint256 oldExpectedDepositShare = this.getExpectedDepositShares();\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n // Increase the share price\n increaseAssetsInVault();\n\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n\n sendUnderlyingToken(depositAmount, address(this));\n deposit(address(this), depositAmount);\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n oldExpected4626Shares + previewErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!previewShares == oldExpectedShares \", testPreFix))\n );\n\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(\n previewErc4626Shares,\n oldExpected4626Shares,\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\n );\n assertApproxEqAbs(\n previewErc4626Shares,\n expected4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!previewShares == expectedShares \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n oldExpectedDepositShare + expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares \", testPreFix))\n );\n }\n\n function testDepositWithDecreasedVaultValue() public {\n // THIS TEST WILL ALWAYS FAIL\n // A transfer out of the lpStaker will always fail.\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\n /* =============== ACTUAL TEST =============== */\n /*\n uint256 oldExpecteDepositShares = depositAmount;\n uint256 oldExpected4626Shares = plugin.previewDeposit(depositAmount);\n deposit(address(this), depositAmount);\n // Decrease the share price\n decreaseAssetsInVault();\n uint256 expectedDepositShare = depositAmount;\n uint256 previewErc4626Shares = plugin.previewDeposit(depositAmount);\n uint256 expected4626Shares = depositAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n sendUnderlyingToken(depositAmount, address(this));\n deposit(address(this), depositAmount);\n // Test that we minted the correct amount of token\n assertApproxEqAbs(plugin.balanceOf(address(this)), oldExpected4626Shares + previewErc4626Shares);\n // Test that we got less shares on the second mint after assets in the vault increased\n assertGt(previewErc4626Shares, oldExpected4626Shares, \"!new shares > old Shares\");\n assertApproxEqAbs(previewErc4626Shares, expected4626Shares, \"!previewShares == expectedShares\");\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(this.getDepositShares(), oldExpecteDepositShares + expectedDepositShare);\n */\n }\n\n function testMultipleDeposit() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 expectedErc4626Shares = plugin.previewDeposit(depositAmount);\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount * 2,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n depositAmount * 2,\n plugin.totalAssets(),\n uint256(10),\n string(abi.encodePacked(\"Total Assets should be same as sum of deposited amounts \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n uint256(10),\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(1))),\n uint256(10),\n string(abi.encodePacked(\"Underlying token balance should be same as deposited amount \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares address(this) \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n expectedErc4626Shares,\n uint256(10),\n string(abi.encodePacked(\"!expectedShares address(1) \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n expectedErc4626Shares * 2,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare * 2,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n\n // DotDot ERC4626 should not have underlyingToken after deposit\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testMint() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\n\n underlyingToken.approve(address(plugin), depositAmount);\n plugin.mint(mintAmount, address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n }\n\n function testMultipleMint() public {\n uint256 expectedDepositShare = this.getExpectedDepositShares();\n uint256 mintAmount = plugin.previewDeposit(depositAmount);\n\n underlyingToken.approve(address(plugin), depositAmount);\n plugin.mint(mintAmount, address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n plugin.totalAssets(),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.convertToAssets(plugin.balanceOf(address(this))),\n depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare,\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n vm.startPrank(address(1));\n underlyingToken.approve(address(plugin), depositAmount);\n sendUnderlyingToken(depositAmount, address(1));\n plugin.mint(mintAmount, address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n this.getStrategyBalance(),\n initialStrategyBalance + depositAmount + depositAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.transfer \", testPreFix))\n );\n\n // Test that the balance view calls work\n assertApproxEqAbs(\n depositAmount + depositAmount,\n plugin.totalAssets(),\n uint256(10),\n string(abi.encodePacked(\"!2.totalAssets \", testPreFix))\n );\n assertApproxEqAbs(\n depositAmount,\n plugin.convertToAssets(plugin.balanceOf(address(1))),\n uint256(10),\n string(abi.encodePacked(\"!2.balOfUnderlying \", testPreFix))\n );\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.mint \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalSupply(),\n mintAmount + mintAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n expectedDepositShare * 2,\n uint256(10),\n string(abi.encodePacked(\"!2.depositShare \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 2,\n uint256(2),\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n vm.stopPrank();\n }\n\n function testWithdraw() public virtual {\n uint256 depositShares = this.getExpectedDepositShares();\n\n uint256 withdrawalAmount = 10e18;\n\n deposit(address(this), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\n );\n assertTrue(underlyingToken.balanceOf(address(plugin)) <= 1, string(abi.encodePacked(\"!0 \", testPreFix)));\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\n );\n }\n\n function testWithdrawWithIncreasedVaultValue() public virtual {\n uint256 depositShareBal = this.getExpectedDepositShares();\n\n deposit(address(this), depositAmount);\n\n uint256 withdrawalAmount = 10e18;\n\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Increase the share price\n increaseAssetsInVault();\n\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded),\n uint256(10),\n string(abi.encodePacked(\"!mint \", testPreFix))\n );\n\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(\n expectedErc4626SharesNeeded,\n oldExpectedErc4626SharesNeeded,\n string(abi.encodePacked(\"!new shares < old Shares \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShareBal - (oldExpectedDepositSharesNeeded + ExpectedDepositSharesNeeded),\n uint256(10),\n string(abi.encodePacked(\"!depositShare \", testPreFix))\n );\n }\n\n function testWithdrawWithDecreasedVaultValue() public {\n // THIS TEST WILL ALWAYS FAIL\n // A transfer out of the lpStaker will always fail.\n // There also doesnt seem another way to reduce the balance of lpStaker so we cant test this scenario\n /* =============== ACTUAL TEST =============== */\n /*\n sendUnderlyingToken(depositAmount, address(this));\n uint256 depositShares = this.getExpectedDepositShares();\n deposit(address(this), depositAmount);\n uint256 withdrawalAmount = 10e18;\n uint256 oldExpectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 oldExpectedDepositSharesNeeded = oldExpectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n // Increase the share price\n decreaseAssetsInVault();\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n plugin.withdraw(withdrawalAmount, address(this), address(this));\n // Test that we minted the correct amount of token\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - (oldExpectedErc4626SharesNeeded + expectedErc4626SharesNeeded)\n );\n // Test that we got less shares on the second mint after assets in the vault increased\n assertLe(expectedErc4626SharesNeeded, oldExpectedErc4626SharesNeeded, \"!new shares < old Shares\");\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShareBal - (oldExpectedDepositSharesNeeded + expectedDepositSharesNeeded)\n );\n */\n }\n\n function testMultipleWithdraw() public virtual {\n uint256 depositShares = this.getExpectedDepositShares() * 2;\n\n uint256 withdrawalAmount = 10e18;\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n uint256 ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(\n this.getDepositShares(),\n plugin.totalSupply()\n );\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.user asset bal\", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n depositAmount * 2 - expectedErc4626SharesNeeded,\n plugin.totalSupply(),\n 10,\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 1,\n 1,\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n uint256 totalSupplyBefore = depositAmount * 2 - expectedErc4626SharesNeeded;\n depositShares = depositShares - ExpectedDepositSharesNeeded;\n assetBalBefore = underlyingToken.balanceOf(address(1));\n erc4626BalBefore = plugin.balanceOf(address(1));\n expectedErc4626SharesNeeded = plugin.previewWithdraw(withdrawalAmount);\n ExpectedDepositSharesNeeded = expectedErc4626SharesNeeded.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n vm.prank(address(1));\n plugin.withdraw(10e18, address(1), address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(1)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n totalSupplyBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n erc4626BalBefore - expectedErc4626SharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\n );\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n 2,\n 2,\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testRedeem() public virtual {\n uint256 depositShares = this.getExpectedDepositShares();\n\n uint256 withdrawalAmount = 10e18;\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n\n deposit(address(this), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!dotDot share balance \", testPreFix))\n );\n }\n\n function testMultipleRedeem() public virtual {\n uint256 depositShares = this.getExpectedDepositShares() * 2;\n\n uint256 withdrawalAmount = 10e18;\n uint256 redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n\n deposit(address(this), depositAmount);\n\n sendUnderlyingToken(depositAmount, address(1));\n deposit(address(1), depositAmount);\n\n uint256 assetBalBefore = underlyingToken.balanceOf(address(this));\n uint256 erc4626BalBefore = plugin.balanceOf(address(this));\n uint256 ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n\n plugin.withdraw(10e18, address(this), address(this));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n depositAmount * 2 - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!1.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!1.dotDot share balance \", testPreFix))\n );\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 1,\n string(abi.encodePacked(\"1.DotDot erc4626 locked amount checking \", testPreFix))\n );\n\n uint256 totalSupplyBefore = depositAmount * 2 - redeemAmount;\n depositShares -= ExpectedDepositSharesNeeded;\n redeemAmount = plugin.previewWithdraw(withdrawalAmount);\n assetBalBefore = underlyingToken.balanceOf(address(1));\n erc4626BalBefore = plugin.balanceOf(address(1));\n ExpectedDepositSharesNeeded = redeemAmount.mulDivUp(this.getDepositShares(), plugin.totalSupply());\n vm.prank(address(1));\n plugin.withdraw(10e18, address(1), address(1));\n\n // Test that the actual transfers worked\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(1)),\n assetBalBefore + withdrawalAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.user asset bal \", testPreFix))\n );\n\n // Test that the balance view calls work\n // I just couldnt not calculate this properly. i was for some reason always ~ 1 BPS off\n // uint256 expectedAssetsAfter = depositAmount - (ExpectedDepositSharesNeeded + (ExpectedDepositSharesNeeded / 1000));\n //assertApproxEqAbs(plugin.totalAssets(), expectedAssetsAfter, \"!erc4626 asset bal\");\n assertApproxEqAbs(\n plugin.totalSupply(),\n totalSupplyBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.totalSupply \", testPreFix))\n );\n\n // Test that we burned the right amount of shares\n assertApproxEqAbs(\n plugin.balanceOf(address(1)),\n erc4626BalBefore - redeemAmount,\n uint256(10),\n string(abi.encodePacked(\"!2.erc4626 supply \", testPreFix))\n );\n\n // Test that the ERC4626 holds the expected amount of dotDot shares\n assertApproxEqAbs(\n this.getDepositShares(),\n depositShares - ExpectedDepositSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!2.dotDot share balance \", testPreFix))\n );\n assertTrue(\n underlyingToken.balanceOf(address(plugin)) <= 2,\n string(abi.encodePacked(\"2.DotDot erc4626 locked amount checking \", testPreFix))\n );\n }\n\n function testPauseContract() public {\n uint256 withdrawAmount = 1e18;\n\n deposit(address(this), depositAmount);\n\n vm.warp(block.timestamp + 10);\n\n plugin.emergencyWithdrawAndPause();\n\n underlyingToken.approve(address(plugin), depositAmount);\n vm.expectRevert(\"Pausable: paused\");\n plugin.deposit(depositAmount, address(this));\n\n vm.expectRevert(\"Pausable: paused\");\n plugin.mint(depositAmount, address(this));\n\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n plugin.withdraw(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount,\n uint256(10),\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\n );\n\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\n plugin.redeem(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - withdrawAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount + expectedAssets,\n uint256(10),\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\n );\n }\n\n function testEmergencyWithdrawAndPause() public virtual {\n deposit(address(this), depositAmount);\n\n uint256 expectedBal = plugin.previewRedeem(depositAmount);\n assertEq(underlyingToken.balanceOf(address(plugin)), 0, string(abi.encodePacked(\"!init 0 \", testPreFix)));\n\n plugin.emergencyWithdrawAndPause();\n\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(plugin)),\n expectedBal,\n uint256(10),\n string(abi.encodePacked(\"!withdraws underlying \", testPreFix))\n );\n assertApproxEqAbs(\n plugin.totalAssets(),\n expectedBal,\n uint256(10),\n string(abi.encodePacked(\"!totalAssets == expectedBal \", testPreFix))\n );\n }\n\n function testEmergencyWithdrawAndRedeem() public {\n uint256 withdrawAmount = 1e18;\n\n deposit(address(this), depositAmount);\n\n vm.warp(block.timestamp + 10);\n\n plugin.emergencyWithdrawAndPause();\n\n uint256 expectedSharesNeeded = withdrawAmount.mulDivDown(plugin.totalSupply(), plugin.totalAssets());\n plugin.withdraw(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!withdraw share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount,\n uint256(10),\n string(abi.encodePacked(\"!withdraw asset bal \", testPreFix))\n );\n\n uint256 expectedAssets = withdrawAmount.mulDivUp(plugin.totalAssets(), plugin.totalSupply());\n plugin.redeem(withdrawAmount, address(this), address(this));\n\n assertApproxEqAbs(\n plugin.balanceOf(address(this)),\n depositAmount - withdrawAmount - expectedSharesNeeded,\n uint256(10),\n string(abi.encodePacked(\"!redeem share bal \", testPreFix))\n );\n assertApproxEqAbs(\n underlyingToken.balanceOf(address(this)),\n withdrawAmount + expectedAssets,\n uint256(10),\n string(abi.encodePacked(\"!redeem asset bal \", testPreFix))\n );\n }\n}\n" + }, + "contracts/test/abstracts/ITestConfigStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ITestConfigStorage {\n function getTestConfig(uint256 i) external view returns (bytes memory);\n\n function getTestConfigLength() external view returns (uint256);\n}\n" + }, + "contracts/test/AccountLiquidityTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract AccountLiquidityTest is UpgradesBaseTest {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLensSecondary lens2 = PoolLensSecondary(0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154);\n\n ICErc20 wethMarket;\n ICErc20 usdcMarket;\n ICErc20 usdtMarket;\n ICErc20 wbtcMarket;\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == MODE_MAINNET) {\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdcMarket = ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n wbtcMarket = ICErc20(0xd70254C3baD29504789714A7c69d60Ec1127375C);\n } else {\n ICErc20[] memory markets = pool.getAllMarkets();\n wethMarket = markets[0];\n usdcMarket = markets[1];\n }\n }\n\n function testModeAccountLiquidity() public debuggingOnly fork(MODE_MAINNET) {\n _testAccountLiquidity(0x0C387030a5D3AcDcde1A8DDaF26df31BbC1CE763);\n }\n\n function _testAccountLiquidity(address borrower) internal {\n (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(borrower);\n\n emit log(\"\");\n emit log_named_address(\"user\", borrower);\n emit log_named_uint(\"collateralValue\", collateralValue);\n if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n }\n\n function testUserMaxWithdraw() public debuggingOnly forkAtBlock(MODE_MAINNET, 5890823) {\n address user = 0xBf891E7eFCC98A8239385D3172bA10AD593c7886;\n\n Unitroller asUnitroller = Unitroller(payable(address(pool)));\n _upgradePoolWithExtension(asUnitroller);\n\n {\n _testAccountLiquidity(user);\n\n uint256 maxRedeem = lens2.getMaxRedeem(user, wethMarket);\n emit log_named_uint(\"maxRedeem\", maxRedeem);\n\n bool isMember = pool.checkMembership(user, wethMarket);\n emit log(isMember ? \"is member\" : \"NOT A MEMBER\");\n }\n //vm.rollFork(5891795);\n // redeemed before liquidation at 5890822\n\n // before withdraw call at block 5890821\n // user: 0xBf891E7eFCC98A8239385D3172bA10AD593c7886\n // collateralValue: 156238264982770748812\n // liquidity: 16428491404549045373\n // maxRedeem: 23469273435070064818\n // is member\n\n // user calls withdraw with max(uint256) at block 5890822\n // user: 0xBf891E7eFCC98A8239385D3172bA10AD593c7886\n // collateralValue: 139809773853485792955\n // SHORTFALL: 257892668904\n // maxRedeem: 0\n // is member\n\n // liquidated at 5890902\n // https://explorer.mode.network/tx/0x424fd0504e7afb00382c6dcd25a2efdefd96c005c2333112be450fc7bd98cc88\n }\n}\n" + }, + "contracts/test/AccrueInterestTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\n\nstruct AccrualDiff {\n uint256 borrowIndex;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalIonicFees;\n uint256 totalAdminFees;\n}\n\ncontract AccrueInterestTest is UpgradesBaseTest {\n // fork before the accrue interest refactoring\n function testAccrueInterest() public debuggingOnly forkAtBlock(BSC_MAINNET, 26032460) {\n address busdMarketAddress = 0xa7213deB44f570646Ea955771Cc7f39B58841363;\n address wbnbMarketAddress = 0x57a64a77f8E4cFbFDcd22D5551F52D675cc5A956;\n\n _testAccrueInterest(wbnbMarketAddress);\n }\n\n function _testAccrueInterest(address marketAddress) internal {\n //CErc20Delegate market = CErc20Delegate(marketAddress);\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(marketAddress);\n ICErc20 market = ICErc20(marketAddress);\n\n uint256 adminFeeMantissa = market.adminFeeMantissa();\n uint256 ionicFeeMantissa = market.ionicFeeMantissa();\n uint256 reserveFactorMantissa = market.reserveFactorMantissa();\n\n // test with the logic before the refactoring\n\n AccrualDiff memory diffBefore;\n // accrue at the latest block in order to have an equal/comparable accrual period\n marketAsExt.accrueInterest();\n {\n CTokenFirstExtension.InterestAccrual memory accrualDataBefore;\n CTokenFirstExtension.InterestAccrual memory accrualDataAfter;\n\n accrualDataBefore.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataBefore.borrowIndex = marketAsExt.borrowIndex();\n accrualDataBefore.totalBorrows = marketAsExt.totalBorrows();\n accrualDataBefore.totalReserves = marketAsExt.totalReserves();\n accrualDataBefore.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataBefore.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataBefore.totalSupply = marketAsExt.totalSupply();\n\n vm.roll(block.number + 1e6); // move 1M blocks forward\n marketAsExt.accrueInterest();\n\n accrualDataAfter.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataAfter.borrowIndex = marketAsExt.borrowIndex();\n accrualDataAfter.totalBorrows = marketAsExt.totalBorrows();\n accrualDataAfter.totalReserves = marketAsExt.totalReserves();\n accrualDataAfter.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataAfter.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataAfter.totalSupply = marketAsExt.totalSupply();\n\n assertEq(\n accrualDataBefore.accrualBlockNumber,\n accrualDataAfter.accrualBlockNumber - 1e6,\n \"!total supply old impl\"\n );\n assertLt(accrualDataBefore.borrowIndex, accrualDataAfter.borrowIndex, \"!borrow index old impl\");\n assertLt(accrualDataBefore.totalBorrows, accrualDataAfter.totalBorrows, \"!total borrows old impl\");\n if (reserveFactorMantissa > 0) {\n assertLt(accrualDataBefore.totalReserves, accrualDataAfter.totalReserves, \"!total reserves old impl\");\n }\n if (ionicFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalIonicFees, accrualDataAfter.totalIonicFees, \"!total ionic fees old impl\");\n }\n if (adminFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalAdminFees, accrualDataAfter.totalAdminFees, \"!total admin fees old impl\");\n }\n assertEq(accrualDataBefore.totalSupply, accrualDataAfter.totalSupply, \"!total supply old impl\");\n\n diffBefore.borrowIndex = accrualDataAfter.borrowIndex - accrualDataBefore.borrowIndex;\n diffBefore.totalBorrows = accrualDataAfter.totalBorrows - accrualDataBefore.totalBorrows;\n diffBefore.totalReserves = accrualDataAfter.totalReserves - accrualDataBefore.totalReserves;\n diffBefore.totalIonicFees = accrualDataAfter.totalIonicFees - accrualDataBefore.totalIonicFees;\n diffBefore.totalAdminFees = accrualDataAfter.totalAdminFees - accrualDataBefore.totalAdminFees;\n }\n\n // test with the logic after the refactoring\n vm.rollFork(26032460);\n afterForkSetUp();\n _upgradeMarketWithExtension(market);\n\n AccrualDiff memory diffAfter;\n // accrue at the latest block in order to have an equal/comparable accrual period\n marketAsExt.accrueInterest();\n {\n CTokenFirstExtension.InterestAccrual memory accrualDataBefore;\n CTokenFirstExtension.InterestAccrual memory accrualDataAfter;\n\n accrualDataBefore.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataBefore.borrowIndex = marketAsExt.borrowIndex();\n accrualDataBefore.totalBorrows = marketAsExt.totalBorrows();\n accrualDataBefore.totalReserves = marketAsExt.totalReserves();\n accrualDataBefore.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataBefore.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataBefore.totalSupply = marketAsExt.totalSupply();\n\n vm.roll(block.number + 1e6); // move 1M blocks forward\n marketAsExt.accrueInterest();\n\n accrualDataAfter.accrualBlockNumber = marketAsExt.accrualBlockNumber();\n accrualDataAfter.borrowIndex = marketAsExt.borrowIndex();\n accrualDataAfter.totalBorrows = marketAsExt.totalBorrows();\n accrualDataAfter.totalReserves = marketAsExt.totalReserves();\n accrualDataAfter.totalIonicFees = marketAsExt.totalIonicFees();\n accrualDataAfter.totalAdminFees = marketAsExt.totalAdminFees();\n accrualDataAfter.totalSupply = marketAsExt.totalSupply();\n\n assertEq(\n accrualDataBefore.accrualBlockNumber,\n accrualDataAfter.accrualBlockNumber - 1e6,\n \"!total supply old impl\"\n );\n assertLt(accrualDataBefore.borrowIndex, accrualDataAfter.borrowIndex, \"!borrow index new impl\");\n assertLt(accrualDataBefore.totalBorrows, accrualDataAfter.totalBorrows, \"!total borrows new impl\");\n if (reserveFactorMantissa > 0) {\n assertLt(accrualDataBefore.totalReserves, accrualDataAfter.totalReserves, \"!total reserves new impl\");\n }\n if (ionicFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalIonicFees, accrualDataAfter.totalIonicFees, \"!total ionic fees new impl\");\n }\n if (adminFeeMantissa > 0) {\n assertLt(accrualDataBefore.totalAdminFees, accrualDataAfter.totalAdminFees, \"!total admin fees new impl\");\n }\n assertEq(accrualDataBefore.totalSupply, accrualDataAfter.totalSupply, \"!total supply new impl\");\n\n diffAfter.borrowIndex = accrualDataAfter.borrowIndex - accrualDataBefore.borrowIndex;\n diffAfter.totalBorrows = accrualDataAfter.totalBorrows - accrualDataBefore.totalBorrows;\n diffAfter.totalReserves = accrualDataAfter.totalReserves - accrualDataBefore.totalReserves;\n diffAfter.totalIonicFees = accrualDataAfter.totalIonicFees - accrualDataBefore.totalIonicFees;\n diffAfter.totalAdminFees = accrualDataAfter.totalAdminFees - accrualDataBefore.totalAdminFees;\n }\n\n assertEq(diffBefore.borrowIndex, diffAfter.borrowIndex, \"!borrowIndexDiff\");\n assertEq(diffBefore.totalBorrows, diffAfter.totalBorrows, \"!totalBorrowsDiff\");\n assertEq(diffBefore.totalReserves, diffAfter.totalReserves, \"!totalReservesDiff\");\n assertEq(diffBefore.totalIonicFees, diffAfter.totalIonicFees, \"!totalIonicFeesDiff\");\n assertEq(diffBefore.totalAdminFees, diffAfter.totalAdminFees, \"!totalAdminFeesDiff\");\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testMintGated() public fork(POLYGON_MAINNET) {\n address newMarket = 0x71A7037a42D0fB9F905a76B7D16846b2EACC59Aa;\n address assetWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n // approve spending\n vm.startPrank(assetWhale);\n IERC20Upgradeable(CErc20Delegate(newMarket).underlying()).approve(newMarket, 1e6);\n require(CErc20Delegate(newMarket).mint(1e6) == 0, \"!mint failed\");\n vm.stopPrank();\n }\n\n function testDeployCToken() public debuggingOnly fork(POLYGON_MAINNET) {\n CErc20Delegate cErc20Delegate = new CErc20Delegate();\n IonicComptroller pool = IonicComptroller(0x69617fE545804BcDfE853626B4C8EF23475Ac54B);\n emit log_named_address(\"admin\", pool.admin());\n pool.adminHasRights();\n vm.startPrank(0x9308dddeC9B5cCd8a2685A46E913C892FE31C826);\n pool._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(0xb5DFABd7fF7F83BAB83995E72A52B97ABb7bcf63),\n 0x69617fE545804BcDfE853626B4C8EF23475Ac54B,\n payable(address(0x62E27eA8d0389390039277CFfD83Ca18ce9B2D9c)),\n InterestRateModel(address(0xA433B7d3a8A87D8fd40dA68A424007Dd8a21Ce41)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(0),\n uint256(0)\n ),\n \"\",\n 0.72e18\n );\n vm.stopPrank();\n // _functionCall(0xC40119C7269A5FA813d878BF83d14E3462fC8Fde, hex\"8f93bfba\", \"raw liquidation failed\");\n }\n\n function testDeployNeonPool() public debuggingOnly fork(NEON_MAINNET) {\n PoolDirectory poolDirectory = PoolDirectory(0x297a15F615aCdf87580af1Fc497EE57424975Dae);\n FeeDistributor ionicAdmin = FeeDistributor(payable(0x62E27eA8d0389390039277CFfD83Ca18ce9B2D9c));\n Comptroller tempComptroller = new Comptroller();\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n vm.prank(ionicAdmin.owner());\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))), // FD\n false,\n 0.1e18,\n 1.1e18,\n 0xBAAb9986A7002ad67cb5a9C1761210C2Cdd98BFa // MPO\n );\n }\n}\n" + }, + "contracts/test/AnyLiquidationTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { IonicLiquidator, ILiquidator } from \"../IonicLiquidator.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport { ICurvePool } from \"../external/curve/ICurvePool.sol\";\nimport { IFundsConversionStrategy } from \"../liquidators/IFundsConversionStrategy.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { IUniswapV2Router02 } from \"../external/uniswap/IUniswapV2Router02.sol\";\nimport { IUniswapV2Pair } from \"../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../external/uniswap/IUniswapV2Factory.sol\";\n\ncontract AnyLiquidationTest is BaseTest {\n IonicLiquidator fsl;\n address uniswapRouter;\n mapping(address => address) assetSpecificRouters;\n\n IFundsConversionStrategy[] fundingStrategies;\n bytes[] fundingDatas;\n\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] redemptionDatas;\n\n IUniswapV2Pair mostLiquidPair1;\n IUniswapV2Pair mostLiquidPair2;\n\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\n\n function upgradeAp() internal {\n AddressesProvider newImpl = new AddressesProvider();\n newImpl.initialize(address(this));\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ap)));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uniswapRouter = ap.getAddress(\"IUniswapV2Router02\");\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\n\n if (block.chainid == BSC_MAINNET) {\n mostLiquidPair1 = IUniswapV2Pair(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16); // WBNB-BUSD\n mostLiquidPair2 = IUniswapV2Pair(0x61EB789d75A95CAa3fF50ed7E47b96c132fEc082); // WBNB-BTCB\n fsl = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n // fsl = new IonicLiquidator();\n // fsl.initialize(\n // ap.getAddress(\"wtoken\"),\n // uniswapRouter,\n // ap.getAddress(\"stableToken\"),\n // ap.getAddress(\"wBTCToken\"),\n // \"0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5\",\n // 25\n // );\n\n // TODO configure in the AP?\n address bnbx = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\n address apeSwapRouter = 0xcF0feBd3f17CEf5b47b0cD257aCf6025c5BFf3b7;\n assetSpecificRouters[bnbx] = apeSwapRouter;\n } else if (block.chainid == POLYGON_MAINNET) {\n mostLiquidPair1 = IUniswapV2Pair(0x6e7a5FAFcec6BB1e78bAE2A1F0B612012BF14827); // USDC/WMATIC\n mostLiquidPair2 = IUniswapV2Pair(0x369582d2010B6eD950B571F4101e3bB9b554876F); // SAND/WMATIC\n fsl = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n // fsl = new IonicLiquidator();\n // fsl.initialize(\n // ap.getAddress(\"wtoken\"),\n // uniswapRouter,\n // ap.getAddress(\"stableToken\"),\n // ap.getAddress(\"wBTCToken\"),\n // \"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f\",\n // 30\n // );\n }\n }\n\n function testSpecificRandom() public debuggingOnly {\n testPolygonAnyLiquidation(14341);\n // testPolygonAnyLiquidation(101);\n }\n\n function testBscAnyLiquidation(uint256 random) public fork(BSC_MAINNET) {\n vm.assume(random > 100 && random < type(uint64).max);\n doTestAnyLiquidation(random);\n }\n\n function testPolygonAnyLiquidation(uint256 random) public fork(POLYGON_MAINNET) {\n vm.assume(random > 100 && random < type(uint64).max);\n doTestAnyLiquidation(random);\n }\n\n struct LiquidationData {\n IRedemptionStrategy[] strategies;\n bytes[] redemptionDatas;\n ICErc20[] markets;\n address[] borrowers;\n IonicLiquidator liquidator;\n IFundsConversionStrategy[] fundingStrategies;\n bytes[] fundingDatas;\n ICErc20 debtMarket;\n ICErc20 collateralMarket;\n IonicComptroller comptroller;\n address borrower;\n uint256 repayAmount;\n address flashSwapFundingToken;\n IUniswapV2Pair flashSwapPair;\n }\n\n function getPoolAndBorrower(\n uint256 random,\n PoolDirectory.Pool[] memory pools\n ) internal view returns (IonicComptroller, address) {\n if (pools.length == 0) revert(\"no pools to pick from\");\n\n uint256 i = random % pools.length; // random pool\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n address bscBombPool = 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459;\n if (address(comptroller) == bscBombPool) {\n // we don't want to deal with the bomb liquidations\n return (IonicComptroller(address(0)), address(0));\n }\n\n address[] memory borrowers = comptroller.getAllBorrowers();\n\n if (borrowers.length == 0) {\n return (IonicComptroller(address(0)), address(0));\n } else {\n uint256 k = random % borrowers.length; // random borrower\n address borrower = borrowers[k];\n\n return (comptroller, borrower);\n }\n }\n\n function setUpDebtAndCollateralMarkets(\n uint256 random,\n LiquidationData memory vars\n ) internal returns (ICErc20 debtMarket, ICErc20 collateralMarket, uint256 borrowAmount) {\n // find a debt market in which the borrower has borrowed\n for (uint256 m = 0; m < vars.markets.length; m++) {\n uint256 marketIndexWithOffset = (random + m) % vars.markets.length;\n ICErc20 randomMarket = vars.markets[marketIndexWithOffset];\n borrowAmount = randomMarket.borrowBalanceCurrent(vars.borrower);\n if (borrowAmount > 0) {\n debtMarket = ICErc20(address(randomMarket));\n break;\n }\n }\n\n if (address(debtMarket) != address(0)) {\n emit log(\"debt market is\");\n emit log_address(address(debtMarket));\n\n uint256 shortfall = 0;\n // reduce the price of the collateral for each market where the borrower has supplied\n // until there is shortfall for which to be liquidated\n for (uint256 m = 0; m < vars.markets.length; m++) {\n uint256 marketIndexWithOffset = (random - m) % vars.markets.length;\n ICErc20 randomMarket = vars.markets[marketIndexWithOffset];\n uint256 borrowerCollateral = randomMarket.balanceOf(vars.borrower);\n if (borrowerCollateral > 0) {\n if (address(randomMarket) == address(debtMarket)) continue;\n\n // the collateral prices change\n BasePriceOracle mpo = vars.comptroller.oracle();\n uint256 priceCollateral = mpo.getUnderlyingPrice(randomMarket);\n vm.mockCall(\n address(mpo),\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, randomMarket),\n abi.encode(priceCollateral / 5)\n );\n\n uint256 collateralValue = borrowerCollateral * (priceCollateral / 5);\n uint256 borrowValue = borrowAmount * mpo.getUnderlyingPrice(debtMarket);\n\n if (collateralValue < borrowValue) {\n emit log(\"collateral position too small\");\n continue;\n }\n\n (, , , shortfall) = vars.comptroller.getAccountLiquidity(vars.borrower);\n if (shortfall == 0) {\n emit log(\"collateral still enough\");\n continue;\n } else {\n emit log(\"has shortfall\");\n collateralMarket = ICErc20(address(randomMarket));\n break;\n }\n }\n }\n if (shortfall == 0) {\n return (ICErc20(address(0)), ICErc20(address(0)), 0);\n }\n }\n }\n\n function doTestAnyLiquidation(uint256 random) internal {\n LiquidationData memory vars;\n vars.liquidator = fsl;\n\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(ap.getAddress(\"PoolDirectory\")).getActivePools();\n\n uint256 initRandom = random;\n while (true) {\n // get a random pool and a random borrower from it\n (vars.comptroller, vars.borrower) = getPoolAndBorrower(random, pools);\n\n if (address(vars.comptroller) != address(0) && vars.borrower != address(0)) {\n // find a market in which the borrower has debt and reduce his collateral price\n vars.markets = vars.comptroller.getAllMarkets();\n (vars.debtMarket, vars.collateralMarket, vars.repayAmount) = setUpDebtAndCollateralMarkets(random, vars);\n\n if (address(vars.debtMarket) != address(0) && address(vars.collateralMarket) != address(0)) {\n if (vars.debtMarket.underlying() != ap.getAddress(\"wtoken\")) {\n emit log(\"found testable markets at random number\");\n emit log_uint(random);\n break;\n }\n }\n }\n // fail gracefully when there are no positions to liquidate\n if (random - initRandom < 100) return;\n random++;\n }\n\n vars.repayAmount = vars.repayAmount / 100;\n liquidateSpecificPosition(vars);\n }\n\n function liquidateSpecificPosition(LiquidationData memory vars) internal {\n emit log(\"debt and collateral markets\");\n emit log_address(address(vars.debtMarket));\n emit log_address(address(vars.collateralMarket));\n\n // prepare the liquidation\n\n // add funding strategies\n {\n address debtTokenToFund = vars.debtMarket.underlying();\n uint256 i = 0;\n while (true) {\n emit log(\"funding token\");\n emit log_address(debtTokenToFund);\n if (i++ > 10) revert(\"endless loop bad\");\n\n AddressesProvider.FundingStrategy memory strategy = ap.getFundingStrategy(debtTokenToFund);\n if (strategy.addr == address(0)) break;\n\n debtTokenToFund = addFundingStrategy(\n vars,\n IFundsConversionStrategy(strategy.addr),\n debtTokenToFund,\n strategy.contractInterface,\n strategy.inputToken\n );\n }\n\n vars.flashSwapFundingToken = debtTokenToFund;\n if (vars.flashSwapFundingToken != ap.getAddress(\"wtoken\")) {\n IUniswapV2Router02 router = IUniswapV2Router02(uniswapRouter);\n address pairAddress = IUniswapV2Factory(router.factory()).getPair(\n vars.flashSwapFundingToken,\n ap.getAddress(\"wtoken\")\n );\n if (pairAddress != address(0)) {\n vars.flashSwapPair = IUniswapV2Pair(pairAddress);\n } else {\n revert(\"no pair for flash swap funding\");\n }\n } else {\n vars.flashSwapPair = IUniswapV2Pair(mostLiquidPair1);\n }\n\n vars.fundingStrategies = fundingStrategies;\n vars.fundingDatas = fundingDatas;\n }\n\n emit log(\"flash swap funding token is\");\n emit log_address(vars.flashSwapFundingToken);\n\n address exchangeCollateralTo = vars.flashSwapFundingToken;\n\n // add the redemption strategies\n if (exchangeCollateralTo != address(0)) {\n address collateralTokenToRedeem = vars.collateralMarket.underlying();\n while (collateralTokenToRedeem != exchangeCollateralTo) {\n // TODO\n AddressesProvider.RedemptionStrategy memory strategy = ap.getRedemptionStrategy(collateralTokenToRedeem);\n if (strategy.addr == address(0)) break;\n collateralTokenToRedeem = addRedemptionStrategy(\n vars,\n IRedemptionStrategy(strategy.addr),\n strategy.contractInterface,\n collateralTokenToRedeem,\n strategy.outputToken\n );\n }\n vars.redemptionDatas = redemptionDatas;\n vars.strategies = redemptionStrategies;\n }\n\n // liquidate\n vm.prank(ap.owner());\n try\n vars.liquidator.safeLiquidateToTokensWithFlashLoan(\n ILiquidator.LiquidateToTokensWithFlashSwapVars(\n vars.borrower,\n vars.repayAmount,\n ICErc20(address(vars.debtMarket)),\n ICErc20(address(vars.collateralMarket)),\n address(vars.flashSwapPair),\n 0,\n vars.strategies,\n vars.redemptionDatas,\n vars.fundingStrategies,\n vars.fundingDatas\n )\n )\n {\n // noop\n } catch Error(string memory reason) {\n if (compareStrings(reason, \"Number of tokens less than minimum limit\")) {\n emit log(\"jarvis pool failing, that's ok\");\n } else {\n revert(reason);\n }\n }\n }\n\n function getUniswapV2Router(address inputToken) internal view returns (address) {\n address router = assetSpecificRouters[inputToken];\n return router != address(0) ? router : uniswapRouter;\n }\n\n function toggleFlashSwapPair(LiquidationData memory vars) internal view {\n if (address(vars.flashSwapPair) == address(mostLiquidPair1)) {\n vars.flashSwapPair = mostLiquidPair2;\n } else {\n vars.flashSwapPair = mostLiquidPair1;\n }\n }\n\n function addRedemptionStrategy(\n LiquidationData memory vars,\n IRedemptionStrategy strategy,\n string memory strategyContract,\n address inputToken,\n address strategyOutputToken\n ) internal returns (address) {\n address outputToken;\n bytes memory strategyData;\n\n if (compareStrings(strategyContract, \"CurveLpTokenLiquidatorNoRegistry\")) {\n address[] memory underlyingTokens = curveV1Oracle.getUnderlyingTokens(inputToken);\n (address preferredOutputToken, uint8 outputTokenIndex) = pickPreferredToken(\n underlyingTokens,\n strategyOutputToken\n );\n emit log(\"preferred token\");\n emit log_address(preferredOutputToken);\n emit log_uint(outputTokenIndex);\n outputToken = preferredOutputToken;\n if (outputToken == address(0) || outputToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n outputToken = ap.getAddress(\"wtoken\");\n }\n\n strategyData = abi.encode(preferredOutputToken, ap.getAddress(\"wtoken\"), address(curveV1Oracle));\n } else if (compareStrings(strategyContract, \"SaddleLpTokenLiquidator\")) {\n address[] memory underlyingTokens = curveV1Oracle.getUnderlyingTokens(inputToken);\n (address preferredOutputToken, ) = pickPreferredToken(underlyingTokens, strategyOutputToken);\n outputToken = preferredOutputToken;\n if (outputToken == address(0) || outputToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n outputToken = ap.getAddress(\"wtoken\");\n }\n strategyData = abi.encode(preferredOutputToken, curveV1Oracle, ap.getAddress(\"wtoken\"));\n } else if (\n compareStrings(strategyContract, \"UniswapLpTokenLiquidator\") ||\n compareStrings(strategyContract, \"GelatoGUniLiquidator\")\n ) {\n IUniswapV2Pair pair = IUniswapV2Pair(inputToken);\n address[] memory swapToken0Path;\n address[] memory swapToken1Path;\n\n if (pair.token0() == strategyOutputToken) {\n swapToken0Path = new address[](0);\n swapToken1Path = new address[](2);\n\n swapToken1Path[0] = pair.token1();\n swapToken1Path[1] = pair.token0();\n outputToken = swapToken1Path[1];\n } else {\n swapToken0Path = new address[](2);\n swapToken1Path = new address[](0);\n\n swapToken0Path[0] = pair.token0();\n swapToken0Path[1] = pair.token1();\n outputToken = swapToken0Path[1];\n }\n\n strategyData = abi.encode(uniswapRouter, swapToken0Path, swapToken1Path);\n\n if (address(vars.flashSwapPair) == address(pair)) {\n emit log(\"toggling the flashswap pair\");\n emit log_address(address(pair));\n toggleFlashSwapPair(vars);\n }\n } else if (compareStrings(strategyContract, \"UniswapV2LiquidatorFunder\")) {\n outputToken = strategyOutputToken;\n\n address[] memory swapPath = new address[](2);\n swapPath[0] = inputToken;\n swapPath[1] = outputToken;\n\n strategyData = abi.encode(getUniswapV2Router(inputToken), swapPath);\n } else if (compareStrings(strategyContract, \"JarvisLiquidatorFunder\")) {\n AddressesProvider.JarvisPool[] memory pools = ap.getJarvisPools();\n for (uint256 i = 0; i < pools.length; i++) {\n AddressesProvider.JarvisPool memory pool = pools[i];\n if (pool.syntheticToken == inputToken) {\n strategyData = abi.encode(pool.syntheticToken, pool.liquidityPool, pool.expirationTime);\n outputToken = pool.collateralToken;\n break;\n }\n }\n } else if (compareStrings(strategyContract, \"CurveSwapLiquidator\")) {\n outputToken = strategyOutputToken;\n strategyData = abi.encode(curveV1Oracle, curveV2Oracle, inputToken, outputToken, ap.getAddress(\"wtoken\"));\n } else if (compareStrings(strategyContract, \"BalancerLpTokenLiquidator\")) {\n outputToken = strategyOutputToken;\n strategyData = abi.encode(outputToken);\n } else if (compareStrings(strategyContract, \"XBombLiquidatorFunder\")) {\n outputToken = strategyOutputToken;\n address xbomb = inputToken;\n address bomb = outputToken;\n strategyData = abi.encode(inputToken, xbomb, bomb);\n } else if (compareStrings(strategyContract, \"AlgebraSwapLiquidator\")) {\n address ALGEBRA_SWAP_ROUTER = 0x327Dd3208f0bCF590A66110aCB6e5e6941A4EfA0;\n outputToken = strategyOutputToken;\n strategyData = abi.encode(outputToken, ALGEBRA_SWAP_ROUTER);\n } else {\n emit log(strategyContract);\n emit log_address(address(strategy));\n revert(\"unknown collateral\");\n }\n\n vm.prank(vars.liquidator.owner());\n vars.liquidator._whitelistRedemptionStrategy(strategy, true);\n redemptionStrategies.push(strategy);\n redemptionDatas.push(strategyData);\n\n assertEq(outputToken, strategyOutputToken, \"!expected output token\");\n return outputToken;\n }\n\n // function getCurvePoolUnderlyingTokens(address lpTokenAddress) internal view returns (address[] memory) {\n // ICurvePool curvePool = ICurvePool(lpTokenAddress);\n // uint8 i = 0;\n // while (true) {\n // try curvePool.coins(i) {\n // i++;\n // } catch {\n // break;\n // }\n // }\n // address[] memory tokens = new address[](i);\n // for (uint8 j = 0; j < i; j++) {\n // tokens[j] = curvePool.coins(j);\n // }\n // return tokens;\n // }\n\n function pickPreferredToken(\n address[] memory tokens,\n address strategyOutputToken\n ) internal view returns (address, uint8) {\n address wtoken = ap.getAddress(\"wtoken\");\n address stable = ap.getAddress(\"stableToken\");\n address wbtc = ap.getAddress(\"wBTCToken\");\n\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == strategyOutputToken) return (strategyOutputToken, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wtoken) return (wtoken, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == stable) return (stable, i);\n }\n for (uint8 i = 0; i < tokens.length; i++) {\n if (tokens[i] == wbtc) return (wbtc, i);\n }\n return (tokens[0], 0);\n }\n\n function addFundingStrategy(\n LiquidationData memory vars,\n IFundsConversionStrategy strategy,\n address debtToken,\n string memory strategyContract,\n address strategyInputToken\n ) internal returns (address) {\n address inputToken;\n bytes memory strategyData;\n\n if (compareStrings(strategyContract, \"JarvisLiquidatorFunder\")) {\n AddressesProvider.JarvisPool[] memory pools = ap.getJarvisPools();\n for (uint256 i = 0; i < pools.length; i++) {\n AddressesProvider.JarvisPool memory pool = pools[i];\n if (pool.syntheticToken == debtToken) {\n strategyData = abi.encode(pool.collateralToken, pool.liquidityPool, pool.expirationTime);\n inputToken = pool.collateralToken;\n break;\n }\n }\n\n // } else if (compareStrings(strategyContract, \"SomeOtherFunder\")) {\n // bytes memory strategyData = abi.encode(strategySpecificParams);\n // (IERC20Upgradeable inputToken, uint256 inputAmount) = IFundsConversionStrategy(addr).estimateInputAmount(10**(debtToken.decimals()), strategyData);\n // fundingStrategies.push(new SomeOtherFunder());\n // return inputToken;\n } else if (compareStrings(strategyContract, \"CurveSwapLiquidatorFunder\")) {\n inputToken = strategyInputToken;\n strategyData = abi.encode(curveV1Oracle, curveV2Oracle, inputToken, debtToken, ap.getAddress(\"wtoken\"));\n } else if (compareStrings(strategyContract, \"UniswapV3LiquidatorFunder\")) {\n inputToken = strategyInputToken;\n\n uint24 fee = 1000;\n address quoter = ap.getAddress(\"Quoter\");\n address swapRouter;\n {\n // TODO\n // polygon config // 0x1F98431c8aD98523631AE4a59f267346ea31F984\n address polygonSwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\n swapRouter = polygonSwapRouter;\n fee = 500;\n }\n\n strategyData = abi.encode(inputToken, debtToken, fee, swapRouter, quoter);\n } else {\n emit log(strategyContract);\n emit log_address(debtToken);\n revert(\"unknown debt token\");\n }\n\n fundingDatas.push(strategyData);\n\n vm.prank(vars.liquidator.owner());\n vars.liquidator._whitelistRedemptionStrategy(strategy, true);\n fundingStrategies.push(strategy);\n\n assertEq(strategyInputToken, inputToken, \"!expected input token\");\n return inputToken;\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testRawLiquidation() public debuggingOnly fork(MODE_MAINNET) {\n vm.prank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n _functionCall(\n 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A,\n hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000fda4ac09a12c10fae30e429f4d6b47c9a83c87e00000000000000000000000000000000000000000000000001797af2fe6e167700000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005ca3fd2c285c4138185ef1bda7573d415020f3c80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n \"raw liquidation failed\"\n );\n }\n}\n" + }, + "contracts/test/AuthoritiesRegistryTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport \"../ionic/AuthoritiesRegistry.sol\";\nimport \"./helpers/WithPool.sol\";\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\ncontract AuthoritiesRegistryTest is WithPool {\n AuthoritiesRegistry registry;\n\n function afterForkSetUp() internal override {\n registry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\n if (address(registry) == address(0)) {\n address proxyAdmin = address(999);\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), proxyAdmin, \"\");\n registry = AuthoritiesRegistry(address(proxy));\n registry.initialize(address(1023));\n }\n\n super.setUpWithPool(\n MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")),\n ERC20Upgradeable(ap.getAddress(\"wtoken\"))\n );\n\n setUpPool(\"auth-reg-test\", false, 0.1e18, 1.1e18);\n }\n\n function testRegistry() public fork(POLYGON_MAINNET) {\n PoolRolesAuthority auth;\n\n vm.prank(address(555));\n vm.expectRevert(\"Ownable: caller is not the owner\");\n auth = registry.createPoolAuthority(address(comptroller));\n\n vm.prank(registry.owner());\n auth = registry.createPoolAuthority(address(comptroller));\n\n assertEq(auth.owner(), registry.owner(), \"!same owner\");\n }\n\n function testAuthReconfigurePermissions() public fork(POLYGON_MAINNET) {\n vm.prank(registry.owner());\n PoolRolesAuthority auth = registry.createPoolAuthority(address(comptroller));\n\n vm.prank(address(8283));\n vm.expectRevert(\"not owner or pool\");\n registry.reconfigureAuthority(address(comptroller));\n\n vm.prank(registry.owner());\n registry.reconfigureAuthority(address(comptroller));\n }\n\n function upgradeRegistry() internal {\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(registry)));\n AuthoritiesRegistry newImpl = new AuthoritiesRegistry();\n vm.startPrank(dpa.owner());\n dpa.upgradeAndCall(\n proxy,\n address(newImpl),\n abi.encodeWithSelector(AuthoritiesRegistry.reinitialize.selector, registry.leveredPositionsFactory())\n );\n vm.stopPrank();\n }\n\n function upgradeAuth(PoolRolesAuthority auth) internal {\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(auth)));\n PoolRolesAuthority newImpl = new PoolRolesAuthority();\n vm.prank(dpa.owner());\n dpa.upgrade(proxy, address(newImpl));\n }\n\n function testAuthPermissions() public debuggingOnly fork(BSC_CHAPEL) {\n address pool = 0xa4bc2fCF2F9d87EB349f74f8729024F92A030330;\n registry = AuthoritiesRegistry(0xa5E190Fa38F325617381e835da8b2DB2D12cE5eb);\n //upgradeRegistry();\n\n PoolRolesAuthority auth = PoolRolesAuthority(0xFe5AfFFC8b55A2d139cb2ef76699C8B58c1EA299);\n //upgradeAuth(auth);\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(auth)));\n\n vm.prank(address(dpa));\n emit log_named_address(\"proxy.implementation\", proxy.implementation());\n\n emit log_named_address(\"registry.poolAuthLogic\", address(registry.poolAuthLogic()));\n //vm.prank(registry.owner());\n //registry.reconfigureAuthority(pool);\n\n bool isReg = auth.doesUserHaveRole(address(registry), auth.REGISTRY_ROLE());\n assertEq(isReg, true, \"!not registry role\");\n\n bool canCall = auth.canCall(address(registry), address(auth), RolesAuthority.setUserRole.selector);\n assertEq(canCall, true, \"!cannot call setUserRol\");\n }\n}\n" + }, + "contracts/test/caps/AdrastiaPrudentiaCapsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\nimport { ComptrollerPrudentiaCapsExt, DiamondExtension } from \"../../compound/ComptrollerPrudentiaCapsExt.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { ComptrollerV4Storage } from \"../../compound/ComptrollerStorage.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\nimport { PrudentiaLib } from \"../../adrastia/PrudentiaLib.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MockPriceOracle } from \"../../oracles/1337/MockPriceOracle.sol\";\n\nimport \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\nabstract contract HistoricalRates is IHistoricalRates {\n struct BufferMetadata {\n uint8 start;\n uint8 end;\n uint8 size;\n uint8 maxSize;\n bool pauseUpdates; // Note: this is left for extentions, but is not used in this contract.\n }\n\n /// @notice Event emitted when a rate buffer's capacity is increased past the initial capacity.\n /// @dev Buffer initialization does not emit an event.\n /// @param token The token for which the rate buffer's capacity was increased.\n /// @param oldCapacity The previous capacity of the rate buffer.\n /// @param newCapacity The new capacity of the rate buffer.\n event RatesCapacityIncreased(address indexed token, uint256 oldCapacity, uint256 newCapacity);\n\n /// @notice Event emitted when a rate buffer's capacity is initialized.\n /// @param token The token for which the rate buffer's capacity was initialized.\n /// @param capacity The capacity of the rate buffer.\n event RatesCapacityInitialized(address indexed token, uint256 capacity);\n\n /// @notice Event emitted when a new rate is pushed to the rate buffer.\n /// @param token The token for which the rate was pushed.\n /// @param target The target rate.\n /// @param current The current rate, which may be different from the target rate if the rate change is capped.\n /// @param timestamp The timestamp at which the rate was pushed.\n event RateUpdated(address indexed token, uint256 target, uint256 current, uint256 timestamp);\n\n /// @notice An error that is thrown if we try to initialize a rate buffer that has already been initialized.\n /// @param token The token for which we tried to initialize the rate buffer.\n error BufferAlreadyInitialized(address token);\n\n /// @notice An error that is thrown if we try to retrieve a rate at an invalid index.\n /// @param token The token for which we tried to retrieve the rate.\n /// @param index The index of the rate that we tried to retrieve.\n /// @param size The size of the rate buffer.\n error InvalidIndex(address token, uint256 index, uint256 size);\n\n /// @notice An error that is thrown if we try to decrease the capacity of a rate buffer.\n /// @param token The token for which we tried to decrease the capacity of the rate buffer.\n /// @param amount The capacity that we tried to decrease the rate buffer to.\n /// @param currentCapacity The current capacity of the rate buffer.\n error CapacityCannotBeDecreased(address token, uint256 amount, uint256 currentCapacity);\n\n /// @notice An error that is thrown if we try to increase the capacity of a rate buffer past the maximum capacity.\n /// @param token The token for which we tried to increase the capacity of the rate buffer.\n /// @param amount The capacity that we tried to increase the rate buffer to.\n /// @param maxCapacity The maximum capacity of the rate buffer.\n error CapacityTooLarge(address token, uint256 amount, uint256 maxCapacity);\n\n /// @notice An error that is thrown if we try to retrieve more rates than are available in the rate buffer.\n /// @param token The token for which we tried to retrieve the rates.\n /// @param size The size of the rate buffer.\n /// @param minSizeRequired The minimum size of the rate buffer that we require.\n error InsufficientData(address token, uint256 size, uint256 minSizeRequired);\n\n /// @notice The initial capacity of the rate buffer.\n uint8 internal immutable initialBufferCardinality;\n\n /// @notice Maps a token to its metadata.\n mapping(address => BufferMetadata) internal rateBufferMetadata;\n\n /// @notice Maps a token to a buffer of rates.\n mapping(address => RateLibrary.Rate[]) internal rateBuffers;\n\n /**\n * @notice Constructs the HistoricalRates contract with a specified initial buffer capacity.\n * @param initialBufferCardinality_ The initial capacity of the rate buffer.\n */\n constructor(uint8 initialBufferCardinality_) {\n initialBufferCardinality = initialBufferCardinality_;\n }\n\n /// @inheritdoc IHistoricalRates\n function getRateAt(address token, uint256 index) external view virtual override returns (RateLibrary.Rate memory) {\n BufferMetadata memory meta = rateBufferMetadata[token];\n\n if (index >= meta.size) {\n revert InvalidIndex(token, index, meta.size);\n }\n\n uint256 bufferIndex = meta.end < index ? meta.end + meta.size - index : meta.end - index;\n\n return rateBuffers[token][bufferIndex];\n }\n\n /// @inheritdoc IHistoricalRates\n function getRates(address token, uint256 amount) external view virtual override returns (RateLibrary.Rate[] memory) {\n return _getRates(token, amount, 0, 1);\n }\n\n /// @inheritdoc IHistoricalRates\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view virtual override returns (RateLibrary.Rate[] memory) {\n return _getRates(token, amount, offset, increment);\n }\n\n /// @inheritdoc IHistoricalRates\n function getRatesCount(address token) external view override returns (uint256) {\n return rateBufferMetadata[token].size;\n }\n\n /// @inheritdoc IHistoricalRates\n function getRatesCapacity(address token) external view virtual override returns (uint256) {\n uint256 maxSize = rateBufferMetadata[token].maxSize;\n if (maxSize == 0) return initialBufferCardinality;\n\n return maxSize;\n }\n\n /// @param amount The new capacity of rates for the token. Must be greater than the current capacity, but\n /// less than 256.\n /// @inheritdoc IHistoricalRates\n function setRatesCapacity(address token, uint256 amount) external virtual {\n _setRatesCapacity(token, amount);\n }\n\n /**\n * @dev Internal function to set the capacity of the rate buffer for a token.\n * @param token The token for which to set the new capacity.\n * @param amount The new capacity of rates for the token. Must be greater than the current capacity, but\n * less than 256.\n */\n function _setRatesCapacity(address token, uint256 amount) internal virtual {\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n if (amount < meta.maxSize) revert CapacityCannotBeDecreased(token, amount, meta.maxSize);\n if (amount > type(uint8).max) revert CapacityTooLarge(token, amount, type(uint8).max);\n\n RateLibrary.Rate[] storage rateBuffer = rateBuffers[token];\n\n // Add new slots to the buffer\n uint256 capacityToAdd = amount - meta.maxSize;\n for (uint256 i = 0; i < capacityToAdd; ++i) {\n // Push a dummy rate with non-zero values to put most of the gas cost on the caller\n rateBuffer.push(RateLibrary.Rate({ target: 1, current: 1, timestamp: 1 }));\n }\n\n if (meta.maxSize != amount) {\n emit RatesCapacityIncreased(token, meta.maxSize, amount);\n\n // Update the metadata\n meta.maxSize = uint8(amount);\n }\n }\n\n /**\n * @dev Internal function to get historical rates with specified amount, offset, and increment.\n * @param token The token for which to retrieve the rates.\n * @param amount The number of historical rates to retrieve.\n * @param offset The number of rates to skip before starting to collect the rates.\n * @param increment The step size between the rates to collect.\n * @return observations An array of Rate structs containing the retrieved historical rates.\n */\n function _getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) internal view virtual returns (RateLibrary.Rate[] memory) {\n if (amount == 0) return new RateLibrary.Rate[](0);\n\n BufferMetadata memory meta = rateBufferMetadata[token];\n if (meta.size <= (amount - 1) * increment + offset)\n revert InsufficientData(token, meta.size, (amount - 1) * increment + offset + 1);\n\n RateLibrary.Rate[] memory observations = new RateLibrary.Rate[](amount);\n\n uint256 count = 0;\n\n for (\n uint256 i = meta.end < offset ? meta.end + meta.size - offset : meta.end - offset;\n count < amount;\n i = (i < increment) ? (i + meta.size) - increment : i - increment\n ) {\n observations[count++] = rateBuffers[token][i];\n }\n\n return observations;\n }\n\n /**\n * @dev Internal function to initialize rate buffers for a token.\n * @param token The token for which to initialize the rate buffer.\n */\n function initializeBuffers(address token) internal virtual {\n if (rateBuffers[token].length != 0) {\n revert BufferAlreadyInitialized(token);\n }\n\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n // Initialize the buffers\n RateLibrary.Rate[] storage observationBuffer = rateBuffers[token];\n\n for (uint256 i = 0; i < initialBufferCardinality; ++i) {\n observationBuffer.push();\n }\n\n // Initialize the metadata\n meta.start = 0;\n meta.end = 0;\n meta.size = 0;\n meta.maxSize = initialBufferCardinality;\n meta.pauseUpdates = false;\n\n emit RatesCapacityInitialized(token, meta.maxSize);\n }\n\n /**\n * @dev Internal function to push a new rate data into the rate buffer and update metadata accordingly.\n * @param token The token for which to push the new rate data.\n * @param rate The Rate struct containing target rate, current rate, and timestamp data to be pushed.\n */\n function push(address token, RateLibrary.Rate memory rate) internal virtual {\n BufferMetadata storage meta = rateBufferMetadata[token];\n\n if (meta.size == 0) {\n if (meta.maxSize == 0) {\n // Initialize the buffers\n initializeBuffers(token);\n }\n } else {\n meta.end = (meta.end + 1) % meta.maxSize;\n }\n\n rateBuffers[token][meta.end] = rate;\n\n emit RateUpdated(token, rate.target, rate.current, block.timestamp);\n\n if (meta.size < meta.maxSize && meta.end == meta.size) {\n // We are at the end of the array and we have not yet filled it\n meta.size++;\n } else {\n // start was just overwritten\n meta.start = (meta.start + 1) % meta.size;\n }\n }\n}\n\ncontract PrudentiaStub is HistoricalRates {\n constructor() HistoricalRates(2) {}\n\n function stubPush(address underlyingToken, uint64 rate) public {\n push(underlyingToken, RateLibrary.Rate({ target: rate, current: rate, timestamp: uint32(block.timestamp) }));\n }\n}\n\ncontract AdrastiaPrudentiaCapsTest is BaseTest {\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicComptroller comptroller;\n\n InterestRateModel interestModel;\n MockPriceOracle priceOracle;\n\n MockERC20 underlyingToken1;\n ICErc20 cToken1;\n\n MockERC20 underlyingToken2;\n ICErc20 cToken2;\n\n MockERC20 underlyingToken3;\n ICErc20 cToken3;\n\n CErc20Delegate cErc20Delegate;\n\n PrudentiaStub prudentia;\n\n function setUp() public {\n // Deploy admin contracts\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n\n // Deploy comptroller logic\n Comptroller comptrollerLogic = new Comptroller();\n\n // Deploy underlying tokens\n underlyingToken1 = new MockERC20(\"UnderlyingToken1\", \"UT1\", 18);\n underlyingToken1.mint(address(this), 1000000e18); // 1M tokens\n underlyingToken2 = new MockERC20(\"UnderlyingToken2\", \"UT2\", 18);\n underlyingToken2.mint(address(this), 1000000e18); // 1M tokens\n underlyingToken3 = new MockERC20(\"UnderlyingToken3\", \"UT3\", 6);\n underlyingToken3.mint(address(this), 1000000e6); // 1M tokens\n\n // Deploy cToken delegates\n cErc20Delegate = new CErc20Delegate();\n\n // Deploy price oracle\n priceOracle = new MockPriceOracle(10);\n\n // Deploy IRM\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n\n // Deploy comptroller\n address[] memory unitroller = new address[](1);\n unitroller[0] = address(comptrollerLogic);\n address[] memory addressZero = new address[](1);\n addressZero[0] = address(0);\n bool[] memory boolTrue = new bool[](1);\n boolTrue[0] = true;\n bool[] memory boolFalse = new bool[](1);\n boolFalse[0] = false;\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(comptrollerLogic));\n DiamondExtension[] memory extensions = new DiamondExtension[](3);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = new ComptrollerPrudentiaCapsExt();\n extensions[2] = comptrollerLogic;\n ionicAdmin._setComptrollerExtensions(address(comptrollerLogic), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\", // name\n address(comptrollerLogic), // implementation address\n abi.encode(payable(address(ionicAdmin))), // constructor args\n false, // whitelist enforcement\n 0.1e18, // close factor = 10%\n 1.1e18, // liquidation incentive = 110%\n address(priceOracle) // price oracle\n );\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n newAr.setUserRole(comptrollerAddress, address(ionicAdmin), poolAuth.SUPPLIER_ROLE(), true);\n\n // Setup CErc20Delegate whitelist\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](1);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n address[] memory oldCErc20Implementations = new address[](1);\n oldCErc20Implementations[0] = address(0);\n address[] memory newCErc20Implementations = new address[](1);\n newCErc20Implementations[0] = address(cErc20Delegate);\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n\n // Deploy cToken1\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken1), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 1\", // cToken name\n \"CT1\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Deploy cToken2\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken2), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 2\", // cToken name\n \"CT2\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Deploy cToken3\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken3), // underlying token\n comptroller, // comptroller\n payable(address(ionicAdmin)), // admin\n InterestRateModel(address(interestModel)), // interest rate model\n \"cToken 3\", // cToken name\n \"CT3\", // cToken symbol\n uint256(1), // reserve factor\n uint256(0) // admin fee\n ),\n \"\",\n 0.9e18 // collateral factor = 90%\n );\n\n // Store the cToken addresses\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n assertEq(allMarkets.length, 3);\n cToken1 = allMarkets[0];\n cToken2 = allMarkets[1];\n cToken3 = allMarkets[2];\n\n // Deploy Prudentia\n prudentia = new PrudentiaStub();\n }\n\n function test_NativeCaps_UnrestrictedSupply() public {\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), 0); // No supply cap set (unrestricted)\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n }\n\n function test_NativeCaps_RestrictedSupply() public {\n uint256 cap = 9999e18; // supply cap of 9,999\n uint256 mintAmount = 10000e18; // mint of 10,000\n\n // Set a native supply cap for cToken1\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = cap;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cTokens[0])), supplyCaps[0]);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_NativeCaps_UnrestrictedBorrow() public {\n assertEq(comptroller.effectiveBorrowCaps(address(cToken1)), 0); // No borrow cap set (unrestricted)\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Borrow\n cToken2.borrow(1000e18); // Borrow 1,000 cToken2\n }\n\n function test_NativeCaps_RestrictedBorrow() public {\n uint256 cap = 999e18; // borrow cap of 999\n uint256 borrowAmount = 1000e18; // borrow of 1,000\n\n // Set a native borrow cap for cToken2\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = cap;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cTokens[0])), borrowCaps[0]);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0\n */\n\n function test_Prudentia_Supply_Unrestricted() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Supply cap\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_MissingRate_WithRateConfiguredForAnotherCToken() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken2\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted supply cap for cToken2\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken2)), 0); // Unrestricted\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_WithRateConfiguredForAnotherCToken() public {\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken1\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted borrow cap for cToken1\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken1)), 0); // Unrestricted\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and a decimal shift of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_DecShiftPos1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e19);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e19);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e19);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e19);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and a decimal shift of -1\n */\n\n function test_Prudentia_Supply_Unrestricted_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_DecShiftNeg1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e17);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e17);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e17);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e17);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n * Prudentia caps tests with an offset of 0 and using a cToken with the underlying token having 6 decimals\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e6);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 0, using a cToken with the underlying token having 6 decimals,\n * and a decimalShift of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 10000 / 10; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals_DecShiftPos1() public {\n uint64 cap = 1000 / 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: 1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e7);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 0, using a cToken with the underlying token having 6 decimals,\n * and a decimalShift of -1\n */\n\n function test_Prudentia_Supply_Unrestricted_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), cap); // Unrestricted\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_LessThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 9999e6; // mint of 9,999\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(mintAmount); // Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), mintAmount);\n }\n\n function test_Prudentia_Supply_GreaterThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 10000 * 10; // supply cap of 10,000\n uint256 mintAmount = 10001e6; // mint of 10,001\n\n // Set a native supply cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia supply cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Mint\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken3.mint(mintAmount); // FAIL: Mint\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 0);\n }\n\n function test_Prudentia_Borrow_LessThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_Unrestricted_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e6; // borrow of 999\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), cap); // Unrestricted\n\n // Borrow\n cToken3.borrow(borrowAmount); // Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6 - borrowAmount);\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_6UnderlyingDecimals_DecShiftNeg1() public {\n uint64 cap = 1000 * 10; // borrow cap of 1,000\n uint256 borrowAmount = 1001e6; // borrow of 1,001\n\n // Set a native borrow cap for cToken3\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken3;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken3\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken3.approve(address(cToken3), type(uint256).max); // Approve max\n cToken3.mint(10000e6); // Mint 10,000 cToken3\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 0, decimalShift: -1 })\n );\n\n // Set Prudentia borrow cap for cToken3\n prudentia.stubPush(address(underlyingToken3), cap);\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken3)), uint256(cap) * 1e5);\n\n // Borrow\n vm.expectRevert();\n cToken3.borrow(borrowAmount); // FAIL: Borrow\n\n assertEq(underlyingToken3.balanceOf(address(cToken3)), 10000e6);\n }\n\n /*\n * Prudentia caps tests with an offset of 1\n */\n\n function test_Prudentia_Supply_Unrestricted_Offset1() public {\n uint64 cap = 0; // Unrestricted supply cap\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // Unrestricted cap at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), cap); // Unrestricted\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_MissingRate_Offset1() public {\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a supply cap for cToken1 at index 1 (the offset)\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n vm.expectRevert();\n comptroller.effectiveSupplyCaps(address(cToken1)); // FAIL: Missing rate\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Supply_LessThanCap_Offset1() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 9999e18; // mint of 9,999\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(mintAmount); // Mint\n }\n\n function test_Prudentia_Supply_GreaterThanCap_Offset1() public {\n uint64 cap = 10000; // supply cap of 10,000\n uint256 mintAmount = 10001e18; // mint of 10,001\n\n // Set a native supply cap for cToken1\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken1;\n uint256[] memory supplyCaps = new uint256[](1);\n supplyCaps[0] = 1;\n comptroller._setMarketSupplyCaps(cTokens, supplyCaps);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia supply cap for cToken1\n prudentia.stubPush(address(underlyingToken1), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken1), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveSupplyCaps(address(cToken1)), uint256(cap) * 1e18);\n\n // Mint\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n vm.expectRevert();\n cToken1.mint(mintAmount); // FAIL: Mint\n }\n\n function test_Prudentia_Borrow_LessThanCap_Offset1() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_Unrestricted_Offset1() public {\n uint64 cap = 0; // Unrestricted borrow cap\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 1); // Highly restrictive cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), cap); // Unrestricted\n\n // Borrow\n cToken2.borrow(borrowAmount); // Borrow\n }\n\n function test_Prudentia_Borrow_MissingRate_Offset1() public {\n uint256 borrowAmount = 999e18; // borrow of 999\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Note: Prudentia doesn't have a borrow cap for cToken2 at index 1 (the offset)\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n vm.expectRevert();\n comptroller.effectiveBorrowCaps(address(cToken2)); // FAIL: Missing rate\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n function test_Prudentia_Borrow_GreaterThanCap_Offset1() public {\n uint64 cap = 1000; // borrow cap of 1,000\n uint256 borrowAmount = 1001e18; // borrow of 1,001\n\n // Set a native borrow cap for cToken2\n // This should be ignored since we're using Prudentia\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = cToken2;\n uint256[] memory borrowCaps = new uint256[](1);\n borrowCaps[0] = 1;\n comptroller._setMarketBorrowCaps(cTokens, borrowCaps);\n\n // Mint cToken1 and cToken2\n underlyingToken1.approve(address(cToken1), type(uint256).max); // Approve max\n cToken1.mint(10000e18); // Mint 10,000 cToken1\n underlyingToken2.approve(address(cToken2), type(uint256).max); // Approve max\n cToken2.mint(10000e18); // Mint 10,000 cToken2\n\n // Use cToken1 as collateral\n address[] memory enterMarkets = new address[](1);\n enterMarkets[0] = address(cToken1);\n comptroller.enterMarkets(enterMarkets);\n\n // Enable Prudentia\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(\n PrudentiaLib.PrudentiaConfig({ controller: address(prudentia), offset: 1, decimalShift: 0 })\n );\n\n // Set Prudentia borrow cap for cToken2\n prudentia.stubPush(address(underlyingToken2), cap); // The cap we're using at index 1 (this should be used)\n prudentia.stubPush(address(underlyingToken2), 0); // Unrestricted cap at index 0. If this cap is used, the test should fail.\n\n assertEq(comptroller.effectiveBorrowCaps(address(cToken2)), uint256(cap) * 1e18);\n\n // Borrow\n vm.expectRevert();\n cToken2.borrow(borrowAmount); // FAIL: Borrow\n }\n\n /*\n Additional ComptrollerPrudentiaCapsExt tests\n */\n\n event NewBorrowCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n event NewSupplyCapConfig(PrudentiaLib.PrudentiaConfig oldConfig, PrudentiaLib.PrudentiaConfig newConfig);\n\n function test_Prudentia_SupplyCapConfig() public {\n PrudentiaLib.PrudentiaConfig memory oldConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(0),\n offset: 0,\n decimalShift: 0\n });\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Setup expectation of the following event\n vm.expectEmit(false, false, false, true);\n emit NewSupplyCapConfig(oldConfig, newConfig);\n\n // Set supply cap config\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(newConfig);\n\n // Get the supply cap config\n PrudentiaLib.PrudentiaConfig memory current = ComptrollerPrudentiaCapsExt(address(comptroller))\n .getSupplyCapConfig();\n\n assertEq(newConfig.controller, current.controller, \"controller\");\n assertEq(newConfig.offset, current.offset, \"offset\");\n }\n\n function test_Prudentia_BorrowCapConfig() public {\n PrudentiaLib.PrudentiaConfig memory oldConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(0),\n offset: 0,\n decimalShift: 0\n });\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Setup expectation of the following event\n vm.expectEmit(false, false, false, true);\n emit NewBorrowCapConfig(oldConfig, newConfig);\n\n // Set borrow cap config\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(newConfig);\n\n // Get the borrow cap config\n PrudentiaLib.PrudentiaConfig memory current = ComptrollerPrudentiaCapsExt(address(comptroller))\n .getBorrowCapConfig();\n\n assertEq(newConfig.controller, current.controller, \"controller\");\n assertEq(newConfig.offset, current.offset, \"offset\");\n }\n\n function test_Prudentia_SetSupplyCapConfig_OnlyAdmin() public {\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Set supply cap config\n vm.prank(address(7));\n vm.expectRevert(\"!admin\");\n ComptrollerPrudentiaCapsExt(address(comptroller))._setSupplyCapConfig(newConfig);\n }\n\n function test_Prudentia_SetBorrowCapConfig_OnlyAdmin() public {\n PrudentiaLib.PrudentiaConfig memory newConfig = PrudentiaLib.PrudentiaConfig({\n controller: address(prudentia),\n offset: 0,\n decimalShift: 0\n });\n\n // Set supply cap config\n vm.prank(address(7));\n vm.expectRevert(\"!admin\");\n ComptrollerPrudentiaCapsExt(address(comptroller))._setBorrowCapConfig(newConfig);\n }\n}\n" + }, + "contracts/test/CollateralSwapTest.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CollateralSwap } from \"../ionic/CollateralSwap.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\n\ncontract CollateralSwapTest is UpgradesBaseTest {\n ICErc20 wethMarket = ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3);\n ICErc20 usdcMarket = ICErc20(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0);\n ICErc20 ezETHMarket = ICErc20(0x079f84161642D81aaFb67966123C9949F9284bf5);\n ICErc20 cbETHMarket = ICErc20(0x9c201024A62466F9157b2dAaDda9326207ADDd29);\n PoolLens lens = PoolLens(0x6ec80f9aCd960b568932696C0F0bE06FBfCd175a);\n CollateralSwap swap;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n _upgradeMarketWithExtension(wethMarket);\n _upgradeMarketWithExtension(ezETHMarket);\n _upgradeMarketWithExtension(cbETHMarket);\n _upgradeMarketWithExtension(usdcMarket);\n swap = new CollateralSwap(0, msg.sender, address(wethMarket.comptroller()), new address[](0));\n emit log_named_address(\"swap address: \", address(swap));\n }\n\n function test_collateralSwap_works_noBorrows() public debuggingOnly forkAtBlock(BASE_MAINNET, 20754244) {\n address ionwethWhale = 0x753E909D68921388b8fB4E471D155ff73c735ebC;\n address swapTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE;\n swap.setAllowedSwapTarget(swapTarget, true);\n uint256 healthFactor = lens.getHealthFactor(0x753E909D68921388b8fB4E471D155ff73c735ebC, wethMarket.comptroller());\n emit log_named_uint(\"health factor before: \", healthFactor);\n bytes memory swapData = abi.encodePacked(\n hex\"5fd9ae2ea41bd686f6e5326450d10ac2dc733b837ae20fb0aaf871e87b4a9227171918ab00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000a0cb889707d426a7a386870a03bc70d1b0697598000000000000000000000000000000000000000000000000000000001d42cce300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000005696f6e6963000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000a6d96e7f4d7b96cfe42185df61e64d255c12dff0000000000000000000000000a6d96e7f4d7b96cfe42185df61e64d255c12dff0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000000002d02dd2e34e182400000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000084eedd56e100000000000000000000000042000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000b85da6a0970f0000000000000000000000000000000000000000000000000001ccea209179a9000000000000000000000000d5ee82d18f63f0b82df91a6ae73b74cfda57144e000000000000000000000000000000000000000000000000000000000000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000000000000000000000002cda88b1c1c076b00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa490411a32000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a99000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a990000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae00000000000000000000000000000000000000000000000002cda88b1c1c076b000000000000000000000000000000000000000000000000000000001d42cce3000000000000000000000000000000000000000000000000000000001d68714c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab3000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000004d69971ccd4a636c403a3c1b00c85e99bb9b5606000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000002cda88b1c1c076b000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e4200000000000000000000000000000000000006000064b79dd08ea68a908a97220c76d19a6aa9cbde437600002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002449f865422000000000000000000000000b79dd08ea68a908a97220c76d19a6aa9cbde437600000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000000c1a09d5d0445047da3ab4994262b22404288a3b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002eb79dd08ea68a908a97220c76d19a6aa9cbde4376000001833589fcd6edb6e08f4c7c32d4f71b54bda029130000260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e85000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a0000000000000000000000000000000000000000000000000000000001d68714c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f865422000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n vm.startPrank(ionwethWhale);\n wethMarket.approve(address(swap), 1e18);\n swap.swapCollateral(1e18, wethMarket, usdcMarket, swapTarget, swapData);\n vm.stopPrank();\n healthFactor = lens.getHealthFactor(0x753E909D68921388b8fB4E471D155ff73c735ebC, wethMarket.comptroller());\n emit log_named_uint(\"health factor after: \", healthFactor);\n }\n\n function test_collateralSwap_worksWithBorrows() public debuggingOnly forkAtBlock(BASE_MAINNET, 20874971) {\n address ionezEthWhale = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address swapTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE;\n swap.setAllowedSwapTarget(swapTarget, true);\n bytes memory swapData = abi.encodePacked(\n hex\"4666fc80a7f78b3a1e00f74ab91e766714a7b7390c173e43f2f65d7c74bda18ff1e067dd00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000d6bbde9174b1cdaa358d2cf4d57d1a9f7178fbff000000000000000000000000000000000000000000000000003625685b773877000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000002416092f143378750bb29b79ed961ab195cceea50000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000000000000000000000000000000000000000000000000039afc19de8c3ba00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000aa490411a32000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a99000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000002416092f143378750bb29b79ed961ab195cceea50000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a990000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000039afc19de8c3ba000000000000000000000000000000000000000000000000003625685b77387700000000000000000000000000000000000000000000000000366b101e2d34e40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab3000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb0000000000000000000000004c98e9c2439c0d4621c62fee2fed6d042fa8c57000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000039afc19de8c3ba000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e2416092f143378750bb29b79ed961ab195cceea5000064420000000000000000000000000000000000000600000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002449f865422000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104e5b07cdb000000000000000000000000257fcbae4ac6b26a02e4fc5e1a11e4174b5ce39500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dec876911cbe9428265af0d12132c52ee8642a9900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e42000000000000000000000000000000000000060000642ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e850000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a000000000000000000000000000000000000000000000000000366b101e2d34e400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f8654220000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec2200000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f990000000000000000000000002ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec220000000000000000000000001231deb6f5749ef6ce6943a275a1d3e7486f4eae0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n (uint256 error, uint256 balance, uint256 borrowBalance, uint256 exchangeRateMantissa) = ezETHMarket\n .getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"ezETH error: \", error);\n emit log_named_uint(\"ezETH balance: \", balance);\n emit log_named_uint(\"ezETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"ezETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n (error, balance, borrowBalance, exchangeRateMantissa) = cbETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"cbETH error: \", error);\n emit log_named_uint(\"cbETH balance: \", balance);\n emit log_named_uint(\"cbETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"cbETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n vm.startPrank(ionezEthWhale);\n ezETHMarket.approve(address(swap), type(uint256).max);\n uint256 healthFactor = lens.getHealthFactor(ionezEthWhale, ezETHMarket.comptroller());\n emit log_named_uint(\"health factor before: \", healthFactor);\n swap.swapCollateral(16237319785333690, ezETHMarket, cbETHMarket, swapTarget, swapData);\n healthFactor = lens.getHealthFactor(ionezEthWhale, ezETHMarket.comptroller());\n emit log_named_uint(\"health factor after: \", healthFactor);\n vm.stopPrank();\n\n (error, balance, borrowBalance, exchangeRateMantissa) = ezETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"ezETH error: \", error);\n emit log_named_uint(\"ezETH balance: \", balance);\n emit log_named_uint(\"ezETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"ezETH exchangeRateMantissa: \", exchangeRateMantissa);\n\n (error, balance, borrowBalance, exchangeRateMantissa) = cbETHMarket.getAccountSnapshot(ionezEthWhale);\n emit log_named_uint(\"cbETH error: \", error);\n emit log_named_uint(\"cbETH balance: \", balance);\n emit log_named_uint(\"cbETH borrowBalance: \", borrowBalance);\n emit log_named_uint(\"cbETH exchangeRateMantissa: \", exchangeRateMantissa);\n }\n}\n" + }, + "contracts/test/ComptrollerTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"../compound/ErrorReporter.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\n\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract ComptrollerTest is BaseTest {\n IonicComptroller internal comptroller;\n IonicFlywheel internal flywheel;\n address internal nonOwner = address(0x2222);\n\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n function setUp() public {\n {\n Unitroller proxy = new Unitroller(payable(address(this)));\n proxy._registerExtension(new Comptroller(), DiamondExtension(address(0)));\n comptroller = IonicComptroller(address(proxy));\n }\n {\n ERC20 rewardToken = new MockERC20(\"RewardToken\", \"RT\", 18);\n IonicFlywheel impl = new IonicFlywheel();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(dpa), \"\");\n flywheel = IonicFlywheel(address(proxy));\n flywheel.initialize(rewardToken, IFlywheelRewards(address(2)), IFlywheelBooster(address(3)), address(this));\n }\n }\n\n function test__setFlywheel() external {\n vm.prank(comptroller.admin());\n comptroller._addRewardsDistributor(address(flywheel));\n assertEq(comptroller.rewardsDistributors(0), address(flywheel));\n }\n\n function test__setFlywheelRevertsIfNonOwner() external {\n vm.startPrank(nonOwner);\n vm.expectRevert(\"!admin\");\n comptroller._addRewardsDistributor(address(flywheel));\n }\n\n function testBscInflationProtection() public debuggingOnly fork(BSC_MAINNET) {\n _testInflationProtection();\n }\n\n function testPolygonInflationProtection() public debuggingOnly fork(POLYGON_MAINNET) {\n _testInflationProtection();\n }\n\n function testModeInflationProtection() public debuggingOnly fork(MODE_MAINNET) {\n _testInflationProtection();\n }\n\n function _testInflationProtection() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n PoolDirectory.Pool[] memory pools = fpd.getAllPools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = pool.getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n uint256 totalSupply = market.totalSupply();\n if (totalSupply > 0) {\n if (totalSupply < 1000) {\n emit log_named_address(\"low ts market\", address(markets[j]));\n emit log_named_uint(\"ts\", totalSupply);\n } else {\n assertEq(\n pool.redeemAllowed(address(markets[j]), address(0), totalSupply - 980),\n uint256(ComptrollerErrorReporter.Error.REJECTION),\n \"low ts not rejected\"\n );\n }\n }\n }\n }\n }\n}\n" + }, + "contracts/test/config/BaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Vm.sol\";\nimport \"forge-std/Test.sol\";\nimport \"forge-std/console.sol\";\n\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\n\nabstract contract BaseTest is Test {\n uint128 constant ETHEREUM_MAINNET = 1;\n uint128 constant BSC_MAINNET = 56;\n uint128 constant POLYGON_MAINNET = 137;\n uint128 constant ARBITRUM_ONE = 42161;\n\n uint128 constant BSC_CHAPEL = 97;\n uint128 constant NEON_MAINNET = 245022934;\n uint128 constant LINEA_MAINNET = 59144;\n uint128 constant ZKEVM_MAINNET = 1101;\n uint128 constant MODE_MAINNET = 34443;\n uint128 constant BASE_MAINNET = 8453;\n uint128 constant LISK_MAINNET = 1135;\n\n // taken from ERC1967Upgrade\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n AddressesProvider public ap;\n ProxyAdmin public dpa;\n\n mapping(uint128 => uint256) private forkIds;\n\n constructor() {\n configureAddressesProvider(0);\n }\n\n uint256 constant CRITICAL = 100;\n uint256 constant NORMAL = 90;\n uint256 constant LOW = 80;\n\n modifier importance(uint256 testImportance) {\n uint256 runLevel = NORMAL;\n\n try vm.envUint(\"TEST_RUN_LEVEL\") returns (uint256 level) {\n runLevel = level;\n } catch {\n emit log(\"failed to get env param TEST_RUN_LEVEL\");\n }\n\n if (testImportance >= runLevel) {\n _;\n } else {\n emit log(\"not running the test\");\n }\n }\n\n modifier debuggingOnly() {\n try vm.envBool(\"LOCAL_FORGE_ENV\") returns (bool run) {\n if (run) _;\n } catch {\n emit log(\"skipping this test in the CI/CD - add LOCAL_FORGE_ENV=true to your .env file to run locally\");\n }\n }\n\n modifier fork(uint128 chainid) {\n if (shouldRunForChain(chainid)) {\n _forkAtBlock(chainid, 0);\n _;\n }\n }\n\n modifier forkAtBlock(uint128 chainid, uint256 blockNumber) {\n if (shouldRunForChain(chainid)) {\n _forkAtBlock(chainid, blockNumber);\n _;\n }\n }\n\n modifier whenForking() {\n try vm.activeFork() returns (uint256) {\n _;\n } catch {}\n }\n\n function shouldRunForChain(uint256 chainid) internal returns (bool) {\n bool run = true;\n try vm.envUint(\"TEST_RUN_CHAINID\") returns (uint256 envChainId) {\n run = envChainId == chainid;\n } catch {\n emit log(\"failed to get env param TEST_RUN_CHAINID\");\n }\n return run;\n }\n\n function _forkAtBlock(uint128 chainid, uint256 blockNumber) internal {\n if (block.chainid != chainid) {\n if (blockNumber != 0) {\n vm.selectFork(getArchiveForkId(chainid));\n vm.rollFork(blockNumber);\n } else {\n vm.selectFork(getForkId(chainid));\n }\n }\n configureAddressesProvider(chainid);\n afterForkSetUp();\n }\n\n function getForkId(uint128 chainid, bool archive) private returns (uint256) {\n return archive ? getForkId(chainid) : getArchiveForkId(chainid);\n }\n\n function getForkId(uint128 chainid) private returns (uint256) {\n if (forkIds[chainid] == 0) {\n if (chainid == BSC_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc\")) + 100;\n } else if (chainid == BSC_CHAPEL) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"bsc_chapel\")) + 100;\n } else if (chainid == POLYGON_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"polygon\")) + 100;\n } else if (chainid == NEON_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"neon\")) + 100;\n } else if (chainid == ARBITRUM_ONE) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"arbitrum\")) + 100;\n } else if (chainid == ETHEREUM_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"ethereum\")) + 100;\n } else if (chainid == LINEA_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"linea\")) + 100;\n } else if (chainid == ZKEVM_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"zkevm\")) + 100;\n } else if (chainid == MODE_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"mode\")) + 100;\n } else if (chainid == BASE_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"base\")) + 100;\n } else if (chainid == LISK_MAINNET) {\n forkIds[chainid] = vm.createFork(vm.rpcUrl(\"lisk\")) + 100;\n }\n }\n\n return forkIds[chainid] - 100;\n }\n\n function getArchiveForkId(uint128 chainid) private returns (uint256) {\n // store the archive rpc urls in the forkIds mapping at an offset\n uint128 chainidWithOffset = chainid + type(uint64).max;\n if (forkIds[chainidWithOffset] == 0) {\n if (chainid == BSC_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_archive\")) + 100;\n } else if (chainid == BSC_CHAPEL) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"bsc_chapel_archive\")) + 100;\n } else if (chainid == POLYGON_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"polygon_archive\")) + 100;\n } else if (chainid == NEON_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"neon_archive\")) + 100;\n } else if (chainid == ARBITRUM_ONE) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"arbitrum_archive\")) + 100;\n } else if (chainid == ETHEREUM_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"ethereum_archive\")) + 100;\n } else if (chainid == LINEA_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"linea_archive\")) + 100;\n } else if (chainid == ZKEVM_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"zkevm_archive\")) + 100;\n } else if (chainid == MODE_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"mode_archive\")) + 100;\n } else if (chainid == BASE_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"base_archive\")) + 100;\n } else if (chainid == LISK_MAINNET) {\n forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl(\"lisk_archive\")) + 100;\n }\n }\n return forkIds[chainidWithOffset] - 100;\n }\n\n function afterForkSetUp() internal virtual {}\n\n function configureAddressesProvider(uint128 chainid) private {\n if (chainid == BSC_MAINNET) {\n ap = AddressesProvider(address(0));\n } else if (chainid == BSC_CHAPEL) {\n ap = AddressesProvider(0x3dc8CE9f581e49B9E5304CF580940ad341F64c3f);\n } else if (block.chainid == POLYGON_MAINNET) {\n ap = AddressesProvider(0xE31baC0B582AA248c0017F87F24087cEa7A55E26);\n } else if (chainid == NEON_MAINNET) {\n ap = AddressesProvider(0xF4C60F6ac6b3AF54044757a1a54D76EEe28244CE);\n } else if (chainid == ARBITRUM_ONE) {\n ap = AddressesProvider(0x3B12BA992259Fb3855C4E1D452a754dCa2E276fC);\n } else if (chainid == LINEA_MAINNET) {\n ap = AddressesProvider(0x914694DA0bED80e74ef1a28029f016119782C0f1);\n } else if (chainid == ZKEVM_MAINNET) {\n ap = AddressesProvider(0x27aA55A3D55959261e119d75256aadAB79aE897C);\n } else if (chainid == MODE_MAINNET) {\n ap = AddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n } else if (chainid == BASE_MAINNET) {\n ap = AddressesProvider(0xcD4D7c8e2bA627684a9B18F7fe88239341D3ba5c);\n } else {\n dpa = new ProxyAdmin();\n AddressesProvider logic = new AddressesProvider();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(logic),\n address(dpa),\n abi.encodeWithSelector(ap.initialize.selector, address(this))\n );\n ap = AddressesProvider(address(proxy));\n ap.setAddress(\"DefaultProxyAdmin\", address(dpa));\n }\n dpa = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n if (ap.owner() == address(0)) {\n ap.initialize(address(this));\n }\n if (ap.getAddress(\"deployer\") == address(0)) {\n vm.prank(ap.owner());\n ap.setAddress(\"deployer\", 0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n }\n }\n\n function diff(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a > b) {\n return a - b;\n } else {\n return b - a;\n }\n }\n\n function compareStrings(string memory a, string memory b) public pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n\n function asArray(address value) public pure returns (address[] memory) {\n address[] memory array = new address[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(address value0, address value1) public pure returns (address[] memory) {\n address[] memory array = new address[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(address value0, address value1, address value2) public pure returns (address[] memory) {\n address[] memory array = new address[](3);\n array[0] = value0;\n array[1] = value1;\n array[2] = value2;\n return array;\n }\n\n function asArray(bool value) public pure returns (bool[] memory) {\n bool[] memory array = new bool[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(uint256 value0, uint256 value1) public pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(uint256 value) public pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(bytes memory value) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](1);\n array[0] = value;\n return array;\n }\n\n function asArray(bytes memory value0, bytes memory value1) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](2);\n array[0] = value0;\n array[1] = value1;\n return array;\n }\n\n function asArray(bytes memory value0, bytes memory value1, bytes memory value2) public pure returns (bytes[] memory) {\n bytes[] memory array = new bytes[](3);\n array[0] = value0;\n array[1] = value1;\n array[2] = value2;\n return array;\n }\n\n function sqrt(uint256 x) public pure returns (uint256) {\n if (x == 0) return 0;\n uint256 xx = x;\n uint256 r = 1;\n\n if (xx >= 0x100000000000000000000000000000000) {\n xx >>= 128;\n r <<= 64;\n }\n if (xx >= 0x10000000000000000) {\n xx >>= 64;\n r <<= 32;\n }\n if (xx >= 0x100000000) {\n xx >>= 32;\n r <<= 16;\n }\n if (xx >= 0x10000) {\n xx >>= 16;\n r <<= 8;\n }\n if (xx >= 0x100) {\n xx >>= 8;\n r <<= 4;\n }\n if (xx >= 0x10) {\n xx >>= 4;\n r <<= 2;\n }\n if (xx >= 0x8) {\n r <<= 1;\n }\n\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return (r < r1 ? r : r1);\n }\n}\n" + }, + "contracts/test/config/MarketsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./BaseTest.t.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\nimport { CErc20RewardsDelegate } from \"../../compound/CErc20RewardsDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\nimport { DiamondExtension } from \"../../ionic/DiamondExtension.sol\";\nimport { CTokenFirstExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract MarketsTest is BaseTest {\n FeeDistributor internal ffd;\n\n CErc20Delegate internal cErc20Delegate;\n CErc20PluginDelegate internal cErc20PluginDelegate;\n CErc20RewardsDelegate internal cErc20RewardsDelegate;\n CErc20PluginRewardsDelegate internal cErc20PluginRewardsDelegate;\n CTokenFirstExtension internal newCTokenExtension;\n\n address payable internal latestComptrollerImplementation;\n ComptrollerFirstExtension internal comptrollerExtension;\n\n function afterForkSetUp() internal virtual override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n upgradeFfd();\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20RewardsDelegate = new CErc20RewardsDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n newCTokenExtension = new CTokenFirstExtension();\n\n comptrollerExtension = new ComptrollerFirstExtension();\n Comptroller newComptrollerImplementation = new Comptroller();\n latestComptrollerImplementation = payable(address(newComptrollerImplementation));\n }\n\n function upgradeFfd() internal {\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffd)));\n bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n if (address(ffd.authoritiesRegistry()) == address(0)) {\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n vm.prank(ffd.owner());\n ffd.reinitialize(newAr);\n }\n }\n\n function _prepareCTokenUpgrade(ICErc20 market) internal returns (address) {\n address implBefore = market.implementation();\n //emit log(\"implementation before\");\n //emit log_address(implBefore);\n\n CErc20Delegate newImpl;\n if (market.delegateType() == 1) {\n newImpl = cErc20Delegate;\n } else if (market.delegateType() == 2) {\n newImpl = cErc20PluginDelegate;\n } else if (market.delegateType() == 3) {\n newImpl = cErc20RewardsDelegate;\n } else {\n newImpl = cErc20PluginRewardsDelegate;\n }\n\n // set the new ctoken delegate as the latest\n uint8 delegateType = market.delegateType();\n vm.prank(ffd.owner());\n ffd._setLatestCErc20Delegate(delegateType, address(newImpl), abi.encode(address(0)));\n\n // add the extension to the auto upgrade config\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = DiamondExtension(newImpl);\n cErc20DelegateExtensions[1] = newCTokenExtension;\n vm.prank(ffd.owner());\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\n\n return address(newImpl);\n }\n\n function _upgradeMarket(ICErc20 market) internal {\n address newDelegate = _prepareCTokenUpgrade(market);\n\n bytes memory becomeImplData = (address(newDelegate) == address(cErc20Delegate))\n ? bytes(\"\")\n : abi.encode(address(0));\n vm.prank(market.ionicAdmin());\n market._setImplementationSafe(newDelegate, becomeImplData);\n }\n\n function _prepareComptrollerUpgrade(address oldCompImpl) internal {\n vm.startPrank(ffd.owner());\n ffd._setLatestComptrollerImplementation(oldCompImpl, latestComptrollerImplementation);\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = comptrollerExtension;\n extensions[1] = Comptroller(latestComptrollerImplementation);\n ffd._setComptrollerExtensions(latestComptrollerImplementation, extensions);\n vm.stopPrank();\n }\n\n function _upgradeExistingPool(address poolAddress) internal {\n Unitroller asUnitroller = Unitroller(payable(poolAddress));\n // change the implementation to the new that can add extensions\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\n\n _prepareComptrollerUpgrade(oldComptrollerImplementation);\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/ContractsUpgradesTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ComptrollerFirstExtension, DiamondExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract ContractsUpgradesTest is BaseTest {\n function testPoolDirectoryUpgrade() public fork(BSC_MAINNET) {\n address contractToTest = ap.getAddress(\"PoolDirectory\"); // PoolDirectory proxy\n\n // before upgrade\n PoolDirectory fpdBefore = PoolDirectory(contractToTest);\n PoolDirectory.Pool[] memory poolsBefore = fpdBefore.getAllPools();\n address ownerBefore = fpdBefore.owner();\n emit log_address(ownerBefore);\n\n uint256 lenBefore = poolsBefore.length;\n emit log_uint(lenBefore);\n\n // upgrade\n {\n PoolDirectory newImpl = new PoolDirectory();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(contractToTest));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n // after upgrade\n PoolDirectory fpd = PoolDirectory(contractToTest);\n address ownerAfter = fpd.owner();\n emit log_address(ownerAfter);\n\n (, PoolDirectory.Pool[] memory poolsAfter) = fpd.getActivePools();\n uint256 lenAfter = poolsAfter.length;\n emit log_uint(poolsAfter.length);\n\n assertEq(lenBefore, lenAfter, \"pools count does not match\");\n assertEq(ownerBefore, ownerAfter, \"owner mismatch\");\n }\n\n function testFeeDistributorUpgrade() public fork(BSC_MAINNET) {\n // TODO use an already deployed market\n CErc20Delegate oldCercDelegate = new CErc20Delegate();\n\n // before upgrade\n FeeDistributor ffdProxy = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n uint256 marketsCounterBefore = ffdProxy.marketsCounter();\n address ownerBefore = ffdProxy.owner();\n\n (address latestCErc20DelegateBefore, ) = ffdProxy.latestCErc20Delegate(oldCercDelegate.delegateType());\n\n emit log_uint(marketsCounterBefore);\n emit log_address(ownerBefore);\n\n // upgrade\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ffdProxy)));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n\n // after upgrade\n FeeDistributor ffd = FeeDistributor(payable(address(ffdProxy)));\n\n uint256 marketsCounterAfter = ffd.marketsCounter();\n address ownerAfter = ffd.owner();\n (address latestCErc20DelegateAfter, ) = ffd.latestCErc20Delegate(oldCercDelegate.delegateType());\n\n emit log_uint(marketsCounterAfter);\n emit log_address(ownerAfter);\n\n assertEq(latestCErc20DelegateBefore, latestCErc20DelegateAfter, \"latest delegates do not match\");\n assertEq(marketsCounterBefore, marketsCounterAfter, \"markets counter does not match\");\n\n assertEq(ownerBefore, ownerAfter, \"owner mismatch\");\n }\n\n function testMarketsLatestImplementationsChapel() public fork(BSC_CHAPEL) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsBsc() public fork(BSC_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsPolygon() public fork(POLYGON_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsArbitrum() public fork(ARBITRUM_ONE) {\n _testMarketsLatestImplementations();\n }\n\n function testMarketsLatestImplementationsEth() public fork(ETHEREUM_MAINNET) {\n _testMarketsLatestImplementations();\n }\n\n function _testMarketsLatestImplementations() internal {\n FeeDistributor ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n if (address(fpd) != address(0)) {\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = pool.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n\n uint8 currentDelegateType = market.delegateType();\n (address upgradeToImpl, ) = ffd.latestCErc20Delegate(currentDelegateType);\n\n address currentImpl = market.implementation();\n if (currentImpl != upgradeToImpl) emit log_address(address(market));\n assertEq(currentImpl, upgradeToImpl, \"market needs to be upgraded\");\n\n DiamondBase asBase = DiamondBase(address(markets[j]));\n try asBase._listExtensions() returns (address[] memory extensions) {\n assertEq(extensions.length, 2, \"market is missing an extension\");\n } catch {\n emit log(\"market that is not yet upgraded to the extensions upgrade\");\n emit log_address(address(market));\n emit log(\"implementation\");\n emit log_address(currentImpl);\n emit log(\"pool\");\n emit log_address(pools[i].comptroller);\n emit log(\"\");\n }\n }\n }\n }\n }\n\n function testPauseGuardiansBsc() public debuggingOnly fork(BSC_MAINNET) {\n _testPauseGuardians();\n }\n\n // TODO redeploy to polygon to fix\n function testPauseGuardiansPolygon() public debuggingOnly fork(POLYGON_MAINNET) {\n _testPauseGuardians();\n }\n\n function _testPauseGuardians() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n address deployer = ap.getAddress(\"deployer\");\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n address pauseGuardian = pool.pauseGuardian();\n if (pauseGuardian != address(0) && pauseGuardian != deployer) {\n emit log_named_address(\"pool\", address(pool));\n emit log_named_address(\"unknown pause guardian\", pauseGuardian);\n emit log(\"\");\n }\n }\n }\n}\n" + }, + "contracts/test/DeployMarkets.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Test.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { IonicFlywheelDynamicRewardsPlugin } from \"../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewardsPlugin.sol\";\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ICErc20, ICErc20Plugin, ICErc20PluginRewards } from \"../compound/CTokenInterfaces.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AuthoritiesRegistry } from \"../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport { MockPriceOracle } from \"../oracles/1337/MockPriceOracle.sol\";\nimport { MockERC4626 } from \"../ionic/strategies/MockERC4626.sol\";\nimport { MockERC4626Dynamic } from \"../ionic/strategies/MockERC4626Dynamic.sol\";\n\ncontract DeployMarketsTest is Test {\n MockERC20 underlyingToken;\n MockERC20 rewardToken;\n\n JumpRateModel interestModel;\n IonicComptroller comptroller;\n\n CErc20Delegate cErc20Delegate;\n CErc20PluginDelegate cErc20PluginDelegate;\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\n\n MockERC4626 mockERC4626;\n MockERC4626Dynamic mockERC4626Dynamic;\n\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicFlywheelDynamicRewardsPlugin rewards;\n\n address[] markets;\n bool[] t;\n bool[] f;\n IonicFlywheelCore[] flywheelsToClaim;\n\n function setUpBaseContracts() public {\n underlyingToken = new MockERC20(\"UnderlyingToken\", \"UT\", 18);\n rewardToken = new MockERC20(\"RewardToken\", \"RT\", 18);\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n }\n\n function setUpExtensions() public {\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = cErc20Delegate;\n cErc20DelegateExtensions[1] = new CTokenFirstExtension();\n ionicAdmin._setCErc20DelegateExtensions(address(0), cErc20DelegateExtensions);\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n\n cErc20DelegateExtensions[0] = cErc20PluginDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\n\n cErc20DelegateExtensions[0] = cErc20PluginRewardsDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\n\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginDelegate.delegateType(),\n address(cErc20PluginDelegate),\n abi.encode(address(0))\n );\n\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginRewardsDelegate.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0))\n );\n }\n\n function setUpPool() public {\n underlyingToken.mint(address(this), 100e36);\n\n MockPriceOracle priceOracle = new MockPriceOracle(10);\n Comptroller tempComptroller = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))),\n false,\n 0.1e18,\n 1.1e18,\n address(priceOracle)\n );\n\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n newAr.setUserRole(comptrollerAddress, address(ionicAdmin), poolAuth.SUPPLIER_ROLE(), true);\n }\n\n function setUp() public {\n setUpBaseContracts();\n setUpPool();\n setUpExtensions();\n vm.roll(1);\n }\n\n function testDeployCErc20Delegate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n require(cToken.mint(10e18) == 0, \"mint failed\");\n assertEq(cToken.totalSupply(), 10e18 * 5);\n assertEq(underlyingToken.balanceOf(address(cToken)), 10e18);\n }\n\n function testDeployCErc20PluginDelegate() public {\n mockERC4626 = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(mockERC4626),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(mockERC4626), \"!plugin == erc4626\");\n\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n cToken.mint(10e18);\n assertEq(cToken.totalSupply(), 10e18 * 5);\n assertEq(mockERC4626.balanceOf(address(cToken)), 10e18);\n assertEq(underlyingToken.balanceOf(address(mockERC4626)), 10e18);\n }\n\n function testDeployCErc20PluginRewardsDelegate() public {\n IonicFlywheelCore impl = new IonicFlywheelCore();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n IonicFlywheelCore flywheel = IonicFlywheelCore(address(proxy));\n flywheel.initialize(underlyingToken, IFlywheelRewards(address(0)), IFlywheelBooster(address(0)), address(this));\n IonicFlywheelCore asFlywheelCore = IonicFlywheelCore(address(flywheel));\n rewards = new IonicFlywheelDynamicRewardsPlugin(asFlywheelCore, 1);\n flywheel.setFlywheelRewards(rewards);\n\n mockERC4626Dynamic = new MockERC4626Dynamic(ERC20(address(underlyingToken)), asFlywheelCore);\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginRewardsDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(address(mockERC4626Dynamic), address(flywheel), address(underlyingToken)),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20PluginRewards cToken = ICErc20PluginRewards(address(allMarkets[allMarkets.length - 1]));\n\n flywheel.addStrategyForRewards(ERC20(address(cToken)));\n\n assertEq(address(cToken.plugin()), address(mockERC4626Dynamic), \"!plugin == erc4626\");\n assertEq(underlyingToken.allowance(address(cToken), address(mockERC4626Dynamic)), type(uint256).max);\n assertEq(underlyingToken.allowance(address(cToken), address(flywheel)), 0);\n\n cToken.approve(address(rewardToken), address(flywheel));\n assertEq(rewardToken.allowance(address(cToken), address(flywheel)), type(uint256).max);\n\n underlyingToken.approve(address(cToken), 1e36);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n cToken.mint(10000000);\n assertEq(cToken.totalSupply(), 10000000 * 5);\n assertEq(mockERC4626Dynamic.balanceOf(address(cToken)), 10000000);\n assertEq(underlyingToken.balanceOf(address(mockERC4626Dynamic)), 10000000);\n }\n\n function testAutoImplementationCErc20Delegate() public {\n mockERC4626 = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(mockERC4626),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(mockERC4626), \"!plugin == erc4626\");\n\n address implBefore = cToken.implementation();\n // just testing to replace the plugin delegate with the plugin rewards delegate\n ionicAdmin._setLatestCErc20Delegate(\n cToken.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0)) // should trigger use of latest implementation\n );\n\n // run the upgrade\n vm.prank(ionicAdmin.owner());\n ionicAdmin.autoUpgradePool(comptroller);\n\n address implAfter = cToken.implementation();\n\n assertEq(implBefore, address(cErc20PluginDelegate), \"the old impl should be the plugin delegate\");\n assertEq(implAfter, address(cErc20PluginRewardsDelegate), \"the new impl should be the plugin rewards delegate\");\n }\n\n function testAutoImplementationPlugin() public {\n MockERC4626 pluginA = new MockERC4626(ERC20(address(underlyingToken)));\n MockERC4626 pluginB = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(pluginA),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(pluginA), \"!plugin == erc4626\");\n\n address pluginImplBefore = address(cToken.plugin());\n ionicAdmin._setLatestPluginImplementation(address(pluginA), address(pluginB));\n ionicAdmin._upgradePluginToLatestImplementation(address(cToken));\n address pluginImplAfter = address(cToken.plugin());\n\n assertEq(pluginImplBefore, address(pluginA), \"the old impl should be the A plugin\");\n assertEq(pluginImplAfter, address(pluginB), \"the new impl should be the B plugin\");\n }\n\n function testAutoImplementationCErc20PluginDelegate() public {\n MockERC4626 pluginA = new MockERC4626(ERC20(address(underlyingToken)));\n MockERC4626 pluginB = new MockERC4626(ERC20(address(underlyingToken)));\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(pluginA),\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20Plugin cToken = ICErc20Plugin(address(allMarkets[allMarkets.length - 1]));\n\n assertEq(address(cToken.plugin()), address(pluginA), \"!plugin == erc4626\");\n\n address pluginImplBefore = address(cToken.plugin());\n address implBefore = cToken.implementation();\n uint8 delegateType = cToken.delegateType();\n\n // just testing to replace the plugin delegate with the plugin rewards delegate\n ionicAdmin._setLatestCErc20Delegate(\n delegateType,\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0)) // should trigger use of latest implementation\n );\n ionicAdmin._setLatestPluginImplementation(address(pluginA), address(pluginB));\n\n // run the upgrade\n vm.prank(ionicAdmin.owner());\n ionicAdmin.autoUpgradePool(comptroller);\n\n address pluginImplAfter = address(cToken.plugin());\n address implAfter = cToken.implementation();\n\n assertEq(pluginImplBefore, address(pluginA), \"the old impl should be the A plugin\");\n assertEq(pluginImplAfter, address(pluginB), \"the new impl should be the B plugin\");\n assertEq(implBefore, address(cErc20PluginDelegate), \"the old impl should be the plugin delegate\");\n assertEq(implAfter, address(cErc20PluginRewardsDelegate), \"the new impl should be the plugin rewards delegate\");\n }\n\n function testInflateExchangeRate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n // mint just 2 wei\n underlyingToken.approve(address(cToken), 1e36);\n cToken.mint(2);\n assertEq(cToken.totalSupply(), 10);\n assertEq(underlyingToken.balanceOf(address(cToken)), 2, \"!total supply 2\");\n\n uint256 exchRateBefore = cToken.exchangeRateCurrent();\n emit log_named_uint(\"exch rate\", exchRateBefore);\n assertEq(exchRateBefore, 2e17, \"!default exch rate\");\n\n // donate\n underlyingToken.transfer(address(cToken), 1e36);\n\n uint256 exchRateAfter = cToken.exchangeRateCurrent();\n emit log_named_uint(\"exch rate after\", exchRateAfter);\n assertGt(exchRateAfter, 1e30, \"!inflated exch rate\");\n\n // the market should own 1e36 + 2 underlying assets\n assertEq(underlyingToken.balanceOf(address(cToken)), 1e36 + 2, \"!total underlying\");\n\n // 50% + 1\n uint256 errCode = cToken.redeemUnderlying(0.5e36 + 2);\n assertEq(errCode, 0, \"!redeem underlying\");\n\n assertEq(cToken.totalSupply(), 0, \"!should have redeemed all ctokens for 50% + 1 of the underlying\");\n }\n\n function testSupplyCapInflatedExchangeRate() public {\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n ICErc20 cToken = allMarkets[allMarkets.length - 1];\n assertEq(cToken.name(), \"cUnderlyingToken\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cToken);\n comptroller.enterMarkets(cTokens);\n vm.roll(1);\n\n // mint 1e18\n underlyingToken.approve(address(cToken), 1e18);\n cToken.mint(1e18);\n assertEq(cToken.totalSupply(), 5 * 1e18, \"!total supply 5\");\n assertEq(underlyingToken.balanceOf(address(cToken)), 1e18, \"!market underlying balance 1\");\n\n (, , uint256 liqBefore, uint256 sfBefore) = comptroller.getAccountLiquidity(address(this));\n\n uint256[] memory caps = new uint256[](1);\n caps[0] = 25e18;\n ICErc20[] memory marketArray = new ICErc20[](1);\n marketArray[0] = cToken;\n vm.prank(comptroller.admin());\n comptroller._setMarketSupplyCaps(marketArray, caps);\n\n // donate 100e18\n underlyingToken.transfer(address(cToken), 100e18);\n assertEq(underlyingToken.balanceOf(address(cToken)), 101e18, \"!market balance 101\");\n assertEq(cToken.balanceOfUnderlying(address(this)), 101e18, \"!user balance 101\");\n\n (, , uint256 liqAfter, uint256 sfAfter) = comptroller.getAccountLiquidity(address(this));\n emit log_named_uint(\"liqBefore\", liqBefore);\n emit log_named_uint(\"liqAfter\", liqAfter);\n\n assertEq(liqAfter / liqBefore, 25, \"liquidity should increase only 25x\");\n }\n}\n" + }, + "contracts/test/DevTesting.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport \"./config/BaseTest.t.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ISwapRouter } from \"../external/uniswap/ISwapRouter.sol\";\nimport { RedstoneAdapterPriceOracle } from \"../oracles/default/RedstoneAdapterPriceOracle.sol\";\nimport { RedstoneAdapterPriceOracleWrsETH } from \"../oracles/default/RedstoneAdapterPriceOracleWrsETH.sol\";\nimport { RedstoneAdapterPriceOracleWeETH } from \"../oracles/default/RedstoneAdapterPriceOracleWeETH.sol\";\nimport { MasterPriceOracle, BasePriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { LeveredPositionsLens } from \"../ionic/levered/LeveredPositionsLens.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { ILeveredPositionFactory } from \"../ionic/levered/ILeveredPositionFactory.sol\";\nimport { LeveredPositionFactoryFirstExtension } from \"../ionic/levered/LeveredPositionFactoryFirstExtension.sol\";\nimport { LeveredPositionFactorySecondExtension } from \"../ionic/levered/LeveredPositionFactorySecondExtension.sol\";\nimport { LeveredPositionFactory } from \"../ionic/levered/LeveredPositionFactory.sol\";\nimport { LeveredPositionStorage } from \"../ionic/levered/LeveredPositionStorage.sol\";\nimport { LeveredPosition } from \"../ionic/levered/LeveredPosition.sol\";\n// import { IonicComptroller, ICErc20, ERC20, IPriceOracle_IFLR } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AlgebraSwapLiquidator } from \"../liquidators/AlgebraSwapLiquidator.sol\";\nimport { AerodromeV2Liquidator } from \"../liquidators/AerodromeV2Liquidator.sol\";\nimport { AerodromeCLLiquidator } from \"../liquidators/AerodromeCLLiquidator.sol\";\nimport { CurveSwapLiquidator } from \"../liquidators/CurveSwapLiquidator.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\nimport { IRouter_Aerodrome } from \"../external/aerodrome/IAerodromeRouter.sol\";\nimport { VelodromeV2Liquidator } from \"../liquidators/VelodromeV2Liquidator.sol\";\nimport { IRouter_Velodrome } from \"../external/velodrome/IVelodromeRouter.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { VoterLens } from \"../veION/VoterLens.sol\";\nimport { IonicFlywheelDynamicRewards } from \"../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { FlywheelDynamicRewards } from \"../ionic/strategies/flywheel/rewards/FlywheelDynamicRewards.sol\";\nimport { Voter } from \"../veION/Voter.sol\";\nimport { veION } from \"../veION/veION.sol\";\nimport { veIONFirstExtension } from \"../veION/veIONFirstExtension.sol\";\nimport { veIONSecondExtension } from \"../veION/veIONSecondExtension.sol\";\nimport { BribeRewards } from \"../veION/BribeRewards.sol\";\nimport { IonicFlywheelLensRouter } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { IVoter } from \"../veION/interfaces/IVoter.sol\";\n\nimport \"forge-std/console.sol\";\n\nstruct HealthFactorVars {\n uint256 usdcSupplied;\n uint256 wethSupplied;\n uint256 ezEthSuppled;\n uint256 stoneSupplied;\n uint256 wbtcSupplied;\n uint256 weEthSupplied;\n uint256 merlinBTCSupplied;\n uint256 usdcBorrowed;\n uint256 wethBorrowed;\n uint256 ezEthBorrowed;\n uint256 stoneBorrowed;\n uint256 wbtcBorrowed;\n uint256 weEthBorrowed;\n uint256 merlinBTCBorrowed;\n ICErc20 testCToken;\n address testUnderlying;\n uint256 amountBorrow;\n}\n\ninterface IClaimRewards {\n function claimRewardsForPool(address user, address pool) external;\n}\n\ncontract DevTesting is BaseTest {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLensSecondary lens2 = PoolLensSecondary(0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154);\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n LeveredPositionsLens levPosLens;\n\n address deployer = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address multisig = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2;\n\n ICErc20 wethMarket;\n ICErc20 usdcMarket;\n ICErc20 usdtMarket;\n ICErc20 wbtcMarket;\n ICErc20 ezEthMarket;\n ICErc20 stoneMarket;\n ICErc20 weEthMarket;\n ICErc20 merlinBTCMarket;\n\n // mode mainnet assets\n address WETH = 0x4200000000000000000000000000000000000006;\n address USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address USDT = 0xf0F161fDA2712DB8b566946122a5af183995e2eD;\n address WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF;\n address UNI = 0x3e7eF8f50246f725885102E8238CBba33F276747;\n address SNX = 0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3;\n address LINK = 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb;\n address DAI = 0xE7798f023fC62146e8Aa1b36Da45fb70855a77Ea;\n address BAL = 0xD08a2917653d4E460893203471f0000826fb4034;\n address AAVE = 0x7c6b91D9Be155A6Db01f749217d76fF02A7227F2;\n address weETH = 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A;\n address merlinBTC = 0x59889b7021243dB5B1e065385F918316cD90D46c;\n IERC20Upgradeable wsuperOETH = IERC20Upgradeable(0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6);\n IERC20Upgradeable superOETH = IERC20Upgradeable(0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == MODE_MAINNET) {\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdcMarket = ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n wbtcMarket = ICErc20(0xd70254C3baD29504789714A7c69d60Ec1127375C);\n ezEthMarket = ICErc20(0x59e710215d45F584f44c0FEe83DA6d43D762D857);\n stoneMarket = ICErc20(0x959FA710CCBb22c7Ce1e59Da82A247e686629310);\n weEthMarket = ICErc20(0xA0D844742B4abbbc43d8931a6Edb00C56325aA18);\n merlinBTCMarket = ICErc20(0x19F245782b1258cf3e11Eda25784A378cC18c108);\n ICErc20[] memory markets = pool.getAllMarkets();\n wethMarket = markets[0];\n usdcMarket = markets[1];\n } else {}\n levPosLens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function testModePoolBorrowers() public debuggingOnly fork(MODE_MAINNET) {\n emit log_named_array(\"borrowers\", pool.getAllBorrowers());\n }\n\n function testGetTotalMarketVotes() public debuggingOnly fork(MODE_MAINNET) {\n // Deploy a new instance of VoterLens\n VoterLens lens = new VoterLens();\n\n lens.initialize(\n 0x141F7f2aa313Ff4C60Dd58fDe493aA2048170429,\n PoolDirectory(0x39C353Cf9041CcF467A04d0e78B63d961E81458a)\n );\n\n lens.setMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n lens.setVeIONAddress(0x2Abd9eB57Fb7727138f4181B68DA0426B7fd47e8);\n\n uint256 totalMarketVotes = lens.getTotalMarketVotes();\n emit log_named_uint(\"Total Market Votes Value in ETH\", totalMarketVotes);\n }\n\n function testGetAllMarketVotes() public debuggingOnly fork(MODE_MAINNET) {\n VoterLens lens = VoterLens(0x0286bf00b6f6Cc45D2bd7e8C2e728B1DF2854c7D);\n address lpAsset = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n\n VoterLens.MarketVoteInfo[] memory marketVotes = lens.getAllMarketVotes(lpAsset);\n emit log_named_uint(\"MarketVoteInfo array length\", marketVotes.length);\n\n for (uint256 i = 0; i < marketVotes.length; i++) {\n emit log_named_address(\"Market\", marketVotes[i].market);\n emit log_named_uint(\"Votes\", marketVotes[i].votes);\n emit log_named_uint(\"Votes Value in ETH\", marketVotes[i].votesValueInEth);\n }\n }\n\n function testLockOnLisk() public debuggingOnly fork(LISK_MAINNET) {\n address veIONAddress = 0x6136BeC00Ba7C6d44BB10ee8683C792a0F8cDd6a;\n\n address[] memory tokenAddress = new address[](1);\n tokenAddress[0] = 0x076d0CD6228B042aA28E1E6A0894Cf6C97abc23b;\n\n uint256[] memory tokenAmount = new uint256[](1);\n tokenAmount[0] = 3024400000000000000;\n\n uint256[] memory duration = new uint256[](1);\n duration[0] = 15552000;\n\n bool[] memory stakeUnderlying = new bool[](1);\n stakeUnderlying[0] = true;\n\n veION veionContract = veION(veIONAddress);\n vm.prank(0x89bf9BAaeE2d451477CF850fE4c0d89bb796B1aD);\n uint256 tokenId = veionContract.createLock(tokenAddress, tokenAmount, duration, stakeUnderlying);\n\n emit log_named_uint(\"Created veION lock with tokenId\", tokenId);\n }\n\n function testModeLiquidationShortfall() public debuggingOnly fork(MODE_MAINNET) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(\n 0xa75F9C8246f7269279bE4c969e7Bc6Eb619cC204\n );\n\n emit log_named_uint(\"err\", err);\n emit log_named_uint(\"collateralValue\", collateralValue);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n }\n\n function testModeHealthFactor() public debuggingOnly fork(MODE_MAINNET) {\n address rahul = 0x5A9e792143bf2708b4765C144451dCa54f559a19;\n\n uint256 wethSupplied = wethMarket.balanceOfUnderlying(rahul);\n uint256 usdcSupplied = usdcMarket.balanceOfUnderlying(rahul);\n uint256 usdtSupplied = usdtMarket.balanceOfUnderlying(rahul);\n uint256 wbtcSupplied = wbtcMarket.balanceOfUnderlying(rahul);\n // emit log_named_uint(\"wethSupplied\", wethSupplied);\n emit log_named_uint(\"usdcSupplied\", usdcSupplied);\n emit log_named_uint(\"usdtSupplied\", usdtSupplied);\n emit log_named_uint(\"wbtcSupplied\", wbtcSupplied);\n emit log_named_uint(\"value of wethSupplied\", wethSupplied * pool.oracle().getUnderlyingPrice(wethMarket));\n emit log_named_uint(\"value of usdcSupplied\", usdcSupplied * pool.oracle().getUnderlyingPrice(usdcMarket));\n emit log_named_uint(\"value of usdtSupplied\", usdtSupplied * pool.oracle().getUnderlyingPrice(usdtMarket));\n emit log_named_uint(\"value of wbtcSupplied\", wbtcSupplied * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n PoolLens newImpl = new PoolLens();\n // TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(lens)));\n // vm.prank(dpa.owner());\n // proxy.upgradeTo(address(newImpl));\n\n uint256 hf = newImpl.getHealthFactor(rahul, pool);\n\n emit log_named_uint(\"hf\", hf);\n }\n\n function testVoterLens() public debuggingOnly fork(BASE_MAINNET) {\n // VoterLens lens = new VoterLens();\n // lens.initialize(\n // 0x141F7f2aa313Ff4C60Dd58fDe493aA2048170429,\n // PoolDirectory(0x39C353Cf9041CcF467A04d0e78B63d961E81458a)\n // );\n\n // lens.setMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n VoterLens lens = VoterLens(0xFEF51b9B5a1050B2bBE52A39cC356dfCEE79D87B);\n\n VoterLens.IncentiveInfo[] memory info = lens.getAllIncentivesForBribes();\n emit log_named_uint(\"IncentiveInfo array length\", info.length);\n for (uint256 i = 0; i < info.length; i++) {\n emit log_named_address(\"Market\", info[i].market);\n emit log_named_address(\"Bribe Supply\", info[i].bribeSupply);\n emit log_named_address(\"Bribe Borrow\", info[i].bribeBorrow);\n\n for (uint256 j = 0; j < info[i].rewardsSupply.length; j++) {\n emit log_named_address(\"Reward Supply\", info[i].rewardsSupply[j]);\n emit log_named_uint(\"Reward Supply Amount\", info[i].rewardsSupplyAmounts[j]);\n emit log_named_uint(\"Reward Supply Amount Value\", info[i].rewardsSupplyETHValues[j]);\n }\n\n for (uint256 j = 0; j < info[i].rewardsBorrow.length; j++) {\n emit log_named_address(\"Reward Borrow\", info[i].rewardsBorrow[j]);\n emit log_named_uint(\"Reward Borrow Amount\", info[i].rewardsBorrowAmounts[j]);\n emit log_named_uint(\"Reward Borrow Amount Value\", info[i].rewardsBorrowETHValues[j]);\n }\n emit log(\"-----------------------------------------------------------\");\n }\n }\n\n function testNewVoterLens() public debuggingOnly fork(BASE_MAINNET) {\n VoterLens lens = new VoterLens();\n lens.initialize(\n 0x669A6F5421dA53696fa06f1043CF127d380f6EB9,\n PoolDirectory(0xE1A3006be645a80F206311d9f18C866c204bA02f)\n );\n\n lens.setMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n lens.setVeIONAddress(0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27);\n\n VoterLens.UserBribes[] memory userBribes = lens.getUserBribeRewards(0x2273B2Fb1664f100C07CDAa25Afd1CD0DA3C7437);\n emit log_named_uint(\"UserBribes array length\", userBribes.length);\n for (uint256 i = 0; i < userBribes.length; i++) {\n emit log_named_uint(\"TokenId\", userBribes[i].tokenId);\n emit log_named_address(\"Market\", userBribes[i].market);\n emit log_named_address(\"Bribe\", userBribes[i].bribe);\n emit log_named_address(\"Reward\", userBribes[i].reward);\n emit log_named_uint(\"Earned\", userBribes[i].earned);\n }\n }\n\n function testUserFlywheelRewards1() public debuggingOnly forkAtBlock(BASE_MAINNET, 26840321) {\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards2() public debuggingOnly forkAtBlock(BASE_MAINNET, 26904044) {\n emit log(\"Distribution into reward accumulator\");\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards3() public debuggingOnly forkAtBlock(BASE_MAINNET, 26920527) {\n emit log(\"Right before rewards pulled into flywheel rewards\");\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards4() public debuggingOnly forkAtBlock(BASE_MAINNET, 26920528) {\n emit log(\"Rewards pulled into flywheel rewards\");\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards5() public debuggingOnly forkAtBlock(BASE_MAINNET, 26931538) {\n emit log(\"First deposit after rewards pulled into flywheel rewards\");\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards6() public debuggingOnly forkAtBlock(BASE_MAINNET, 27123016) {\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards7() public debuggingOnly forkAtBlock(BASE_MAINNET, 27208871) {\n emit log(\"Another Distribution\");\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards8() public debuggingOnly forkAtBlock(BASE_MAINNET, 27703171) {\n emit log(\"Right before user whitelists himself\");\n executeFlywheelRewardsTest();\n }\n\n function testUserFlywheelRewards9() public debuggingOnly forkAtBlock(BASE_MAINNET, 27703172) {\n emit log(\"User whitelists himself\");\n executeFlywheelRewardsTest();\n }\n\n function testUserBribeClaims() public debuggingOnly fork(BASE_MAINNET) {\n address user = 0x2273B2Fb1664f100C07CDAa25Afd1CD0DA3C7437;\n Voter voter = Voter(0x669A6F5421dA53696fa06f1043CF127d380f6EB9);\n\n address[] memory _bribes = new address[](1);\n _bribes[0] = 0x4c63d1bcC6c67b9DE3DBf96f8e18eD9440400e6a;\n\n address[][] memory _tokens = new address[][](1);\n _tokens[0] = new address[](1);\n\n _tokens[0][0] = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n\n vm.prank(user);\n voter.claimBribes(_bribes, _tokens, 38);\n }\n\n function testUserBribeRewards() public debuggingOnly fork(BASE_MAINNET) {\n address user = 0x249025bD74e42fAecb5f7c63B889f511581a8546;\n VoterLens voterLens = VoterLens(0xFEF51b9B5a1050B2bBE52A39cC356dfCEE79D87B); // Replace with actual VoterLens contract address\n Voter voter = Voter(0x669A6F5421dA53696fa06f1043CF127d380f6EB9);\n veION ve = veION(0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27);\n address lpAsset = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n\n VoterLens.UserBribes[] memory userBribes = voterLens.getUserBribeRewards(user);\n\n emit log(\"User Bribe Rewards:\");\n for (uint256 i = 0; i < userBribes.length; i++) {\n emit log_named_uint(\"Token ID\", userBribes[i].tokenId);\n emit log_named_address(\"Market\", userBribes[i].market);\n emit log_named_address(\"Bribe\", userBribes[i].bribe);\n emit log_named_address(\"Reward\", userBribes[i].reward);\n emit log_named_uint(\"Earned\", userBribes[i].earned);\n emit log(\"-----------------------------------------------------------\");\n }\n }\n\n function testUserEmissions() public debuggingOnly fork(BASE_MAINNET) {\n address user = 0x5321d7296fe0e7Cae533a090DcDA6E00F0499df0;\n IClaimRewards lens = IClaimRewards(0xB1402333b12fc066C3D7F55d37944D5e281a3e8B);\n\n lens.claimRewardsForPool(user, 0x05c9C6417F246600f8f5f49fcA9Ee991bfF73D13);\n }\n\n struct BribeRewardVars {\n address user;\n Voter voter;\n veION ve;\n address lpAsset;\n uint256[] ownedTokenIds;\n uint256 currentTimestamp;\n }\n\n function testSingleBribeReward() public debuggingOnly fork(BASE_MAINNET) {\n BribeRewardVars memory vars;\n vars.user = 0x249025bD74e42fAecb5f7c63B889f511581a8546;\n vars.voter = Voter(0x669A6F5421dA53696fa06f1043CF127d380f6EB9);\n vars.ve = veION(0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27);\n vars.lpAsset = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n\n vars.ownedTokenIds = veIONSecondExtension(address(vars.ve)).getOwnedTokenIds(vars.user);\n vars.currentTimestamp = vars.voter.epochStart(block.timestamp);\n emit log_named_uint(\"Current Timestamp\", vars.currentTimestamp);\n\n emit log(\"Vote Details for User:\");\n for (uint256 j = 0; j < vars.ownedTokenIds.length; j++) {\n Voter.VoteDetails memory voteDetails = vars.voter.getVoteDetails(vars.ownedTokenIds[j], vars.lpAsset);\n emit log_named_uint(\"Token ID\", vars.ownedTokenIds[j]);\n for (uint256 i = 0; i < voteDetails.marketVotes.length; i++) {\n emit log_named_address(\"Market Voted\", voteDetails.marketVotes[i]);\n emit log_named_uint(\"Market Side\", uint256(voteDetails.marketVoteSides[i]));\n emit log_named_uint(\"Votes\", voteDetails.votes[i]);\n emit log_named_uint(\"Used Weight\", voteDetails.usedWeight);\n address rewardAccumulator = vars.voter.marketToRewardAccumulators(\n voteDetails.marketVotes[i],\n voteDetails.marketVoteSides[i]\n );\n address bribeRewards = vars.voter.rewardAccumulatorToBribe(rewardAccumulator);\n BribeRewards bribe = BribeRewards(bribeRewards);\n\n emit log_named_address(\"Bribe\", address(bribe));\n BribeRewards.Checkpoint memory cp = bribe.getCheckpoint(vars.ownedTokenIds[j], vars.lpAsset, 0);\n emit log_named_uint(\"Checkpoint Timestamp\", cp.timestamp);\n emit log_named_uint(\"Checkpoint Balance Of\", cp.balanceOf);\n\n uint256 voteTimestamp = vars.voter.epochStart(cp.timestamp);\n emit log_named_uint(\"Vote Timestamp\", voteTimestamp);\n emit log_named_uint(\"Difference between timestamps\", vars.currentTimestamp - voteTimestamp);\n uint256 rewardsLength = bribe.rewardsListLength();\n for (uint256 k = 0; k < rewardsLength; k++) {\n address rewardToken = bribe.rewards(k);\n uint256 earnedAmount = bribe.earned(rewardToken, vars.ownedTokenIds[j]);\n emit log_named_address(\"Reward Token\", rewardToken);\n emit log_named_uint(\"Earned Amount\", earnedAmount);\n }\n }\n emit log(\"-----------------------------------------------------------\");\n }\n }\n\n function testUserBribes() public debuggingOnly fork(BASE_MAINNET) {\n address user = 0x249025bD74e42fAecb5f7c63B889f511581a8546;\n VoterLens voterLens = VoterLens(0xFEF51b9B5a1050B2bBE52A39cC356dfCEE79D87B); // Replace with actual VoterLens contract address\n Voter voter = Voter(0x669A6F5421dA53696fa06f1043CF127d380f6EB9);\n veION ve = veION(0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27);\n address lpAsset = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n\n VoterLens.IncentiveInfo[] memory incentives = voterLens.getAllIncentivesForBribes();\n\n emit log(\"Incentive Information:\");\n for (uint256 i = 0; i < incentives.length; i++) {\n if (\n (incentives[i].bribeSupply != address(0) && incentives[i].rewardsSupply.length > 0) ||\n (incentives[i].bribeBorrow != address(0) && incentives[i].rewardsBorrow.length > 0)\n ) {\n emit log_named_address(\"Market\", incentives[i].market);\n if (incentives[i].bribeSupply != address(0)) {\n emit log_named_address(\"Bribe Supply\", incentives[i].bribeSupply);\n for (uint256 j = 0; j < incentives[i].rewardsSupply.length; j++) {\n emit log_named_address(\"Reward Supply\", incentives[i].rewardsSupply[j]);\n emit log_named_uint(\"Reward Supply Amount\", incentives[i].rewardsSupplyAmounts[j]);\n emit log_named_uint(\"Reward Supply ETH Value\", incentives[i].rewardsSupplyETHValues[j]);\n }\n }\n if (incentives[i].bribeBorrow != address(0)) {\n emit log_named_address(\"Bribe Borrow\", incentives[i].bribeBorrow);\n for (uint256 j = 0; j < incentives[i].rewardsBorrow.length; j++) {\n emit log_named_address(\"Reward Borrow\", incentives[i].rewardsBorrow[j]);\n emit log_named_uint(\"Reward Borrow Amount\", incentives[i].rewardsBorrowAmounts[j]);\n emit log_named_uint(\"Reward Borrow ETH Value\", incentives[i].rewardsBorrowETHValues[j]);\n }\n }\n emit log(\"-----------------------------------------------------------\");\n }\n }\n\n uint256[] memory ownedTokenIds = veIONSecondExtension(address(ve)).getOwnedTokenIds(user);\n\n emit log(\"Owned Token IDs for User:\");\n for (uint256 i = 0; i < ownedTokenIds.length; i++) {\n emit log_named_uint(\"Token ID\", ownedTokenIds[i]);\n }\n emit log(\"-----------------------------------------------------------\");\n\n // Fetch the vote details for each token ID owned by the user\n emit log(\"Vote Details for User:\");\n for (uint256 j = 0; j < ownedTokenIds.length; j++) {\n Voter.VoteDetails memory voteDetails = voter.getVoteDetails(ownedTokenIds[j], lpAsset);\n emit log_named_uint(\"Token ID\", ownedTokenIds[j]);\n for (uint256 i = 0; i < voteDetails.marketVotes.length; i++) {\n emit log_named_address(\"Market Voted\", voteDetails.marketVotes[i]);\n emit log_named_uint(\"Market Side\", uint256(voteDetails.marketVoteSides[i]));\n emit log_named_uint(\"Votes\", voteDetails.votes[i]);\n emit log_named_uint(\"Used Weight\", voteDetails.usedWeight);\n }\n emit log(\"-----------------------------------------------------------\");\n }\n\n BribeRewards bribe = BribeRewards(0x4c63d1bcC6c67b9DE3DBf96f8e18eD9440400e6a);\n uint256[] memory votingTokens = new uint256[](2);\n votingTokens[0] = 15;\n votingTokens[1] = 38;\n\n for (uint256 i = 0; i < votingTokens.length; i++) {\n uint256 earnedAmount = bribe.earned(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, votingTokens[i]);\n emit log_named_uint(\"Earned Amount for Token ID\", votingTokens[i]);\n emit log_named_uint(\"Earned Amount\", earnedAmount);\n }\n }\n\n function testVoteUser() public debuggingOnly forkAtBlock(BASE_MAINNET, 28365448) {\n address[] memory markets = new address[](1);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](1);\n uint256[] memory weights = new uint256[](1);\n\n address user = 0x249025bD74e42fAecb5f7c63B889f511581a8546;\n veION ve = veION(0x8865E0678E3b1BD0F5302e4C178a4B576F6aAA27);\n\n uint256[] memory ownedTokenIds = veIONSecondExtension(address(ve)).getOwnedTokenIds(user);\n\n emit log(\"Owned Token IDs for User:\");\n for (uint256 i = 0; i < ownedTokenIds.length; i++) {\n emit log_named_uint(\"Token ID\", ownedTokenIds[i]);\n }\n emit log(\"-----------------------------------------------------------\");\n\n Voter voter = Voter(0x669A6F5421dA53696fa06f1043CF127d380f6EB9);\n\n markets[0] = 0x9c2A4f9c5471fd36bE3BBd8437A33935107215A1;\n marketSides[0] = IVoter.MarketSide(0);\n weights[0] = 100;\n\n for (uint256 i = 0; i < ownedTokenIds.length; i++) {\n vm.startPrank(user);\n voter.reset(ownedTokenIds[i]);\n voter.vote(ownedTokenIds[i], markets, marketSides, weights);\n vm.stopPrank();\n }\n }\n\n function testBribeIncentives() public debuggingOnly forkAtBlock(MODE_MAINNET, 21084461) {\n VoterLens voterLens = VoterLens(0x0286bf00b6f6Cc45D2bd7e8C2e728B1DF2854c7D); // Replace with actual VoterLens contract address\n VoterLens.IncentiveInfo[] memory incentives = voterLens.getAllIncentivesForBribes();\n\n emit log(\"Incentive Information:\");\n for (uint256 i = 0; i < incentives.length; i++) {\n if (\n (incentives[i].bribeSupply != address(0) && incentives[i].rewardsSupply.length > 0) ||\n (incentives[i].bribeBorrow != address(0) && incentives[i].rewardsBorrow.length > 0)\n ) {\n emit log_named_address(\"Market\", incentives[i].market);\n if (incentives[i].bribeSupply != address(0)) {\n emit log_named_address(\"Bribe Supply\", incentives[i].bribeSupply);\n for (uint256 j = 0; j < incentives[i].rewardsSupply.length; j++) {\n emit log_named_address(\"Reward Supply\", incentives[i].rewardsSupply[j]);\n emit log_named_uint(\"Reward Supply Amount\", incentives[i].rewardsSupplyAmounts[j]);\n emit log_named_uint(\"Reward Supply ETH Value\", incentives[i].rewardsSupplyETHValues[j]);\n }\n }\n if (incentives[i].bribeBorrow != address(0)) {\n emit log_named_address(\"Bribe Borrow\", incentives[i].bribeBorrow);\n for (uint256 j = 0; j < incentives[i].rewardsBorrow.length; j++) {\n emit log_named_address(\"Reward Borrow\", incentives[i].rewardsBorrow[j]);\n emit log_named_uint(\"Reward Borrow Amount\", incentives[i].rewardsBorrowAmounts[j]);\n emit log_named_uint(\"Reward Borrow ETH Value\", incentives[i].rewardsBorrowETHValues[j]);\n }\n }\n emit log(\"-----------------------------------------------------------\");\n }\n }\n }\n\n struct FlywheelTestVars {\n address ion;\n address solMarket;\n address user;\n IonicFlywheel ionFlywheel;\n IonicFlywheelDynamicRewards ionFlywheelRewards;\n address rewardAccumulator;\n uint256 ionBalance;\n uint256 ionFlywheelRewardsBalance;\n uint256 userBlacklistedSupply;\n uint256 totalBlacklistedSupply;\n uint256 compAccrued;\n uint224 userIndex;\n uint224 marketStateIndex;\n uint32 marketStateLastUpdatedTimestamp;\n uint256 totalSupply;\n uint256 solMarketBalance;\n uint32 rewardsCycleStart;\n uint32 rewardsCycleEnd;\n uint192 rewardsCycleReward;\n }\n\n function executeFlywheelRewardsTest() internal {\n FlywheelTestVars memory vars;\n\n vars.ion = 0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5;\n vars.solMarket = 0xbd06905590b6E1b6Ac979Fc477A0AebB58d52371;\n vars.user = 0x54494827316C7C6627908A9261AB13Ac0A5222E3;\n vars.ionFlywheel = IonicFlywheel(0x1f7DF29E614105e5869b4f03Ecc034a087C2Ab5f);\n vars.ionFlywheelRewards = IonicFlywheelDynamicRewards(0x7Faf51cfF9ed26AD5BD071685F684B0D1338d163);\n\n emit log(\"-----------------------------------------------------------\");\n vars.rewardAccumulator = vars.ionFlywheelRewards.rewardAccumulators(vars.solMarket);\n emit log_named_address(\"Reward Accumulator for solMarket\", vars.rewardAccumulator);\n\n vars.ionBalance = ERC20(vars.ion).balanceOf(vars.rewardAccumulator);\n emit log_named_uint(\"ION Balance of Reward Accumulator\", vars.ionBalance);\n\n vars.totalBlacklistedSupply = vars.ionFlywheel.blacklistedSupply(ERC20(vars.solMarket));\n emit log_named_uint(\"Total Blacklisted Supply of solMarket\", vars.totalBlacklistedSupply);\n\n vars.ionFlywheelRewardsBalance = ERC20(vars.ion).balanceOf(address(vars.ionFlywheelRewards));\n emit log_named_uint(\"ION Balance of Flywheel Rewards\", vars.ionFlywheelRewardsBalance);\n\n vars.userBlacklistedSupply = vars.ionFlywheel.userBlacklistedSupply(ERC20(vars.solMarket), vars.user);\n emit log_named_uint(\"User Blacklisted Supply\", vars.userBlacklistedSupply);\n\n vars.compAccrued = vars.ionFlywheel.compAccrued(vars.user);\n emit log_named_uint(\"Comp Accrued\", vars.compAccrued);\n\n vars.userIndex = vars.ionFlywheel.userIndex(ERC20(vars.solMarket), vars.user);\n emit log_named_uint(\"User Index\", vars.userIndex);\n\n (vars.marketStateIndex, vars.marketStateLastUpdatedTimestamp) = vars.ionFlywheel.marketState(ERC20(vars.solMarket));\n emit log_named_uint(\"Market State Index\", vars.marketStateIndex);\n emit log_named_uint(\"Market State Last Updated Timestamp\", vars.marketStateLastUpdatedTimestamp);\n\n vars.totalSupply = ERC20(vars.solMarket).totalSupply();\n emit log_named_uint(\"Total Supply of solMarket\", vars.totalSupply);\n\n vars.solMarketBalance = ERC20(vars.solMarket).balanceOf(vars.user);\n emit log_named_uint(\"solMarket Balance of User\", vars.solMarketBalance);\n\n // Retrieve the rewards cycle for the solMarket strategy\n (vars.rewardsCycleStart, vars.rewardsCycleEnd, vars.rewardsCycleReward) = vars.ionFlywheelRewards.rewardsCycle(\n ERC20(vars.solMarket)\n );\n\n // Log the rewards cycle details\n emit log_named_uint(\"Rewards Cycle Start\", vars.rewardsCycleStart);\n emit log_named_uint(\"Rewards Cycle End\", vars.rewardsCycleEnd);\n emit log_named_uint(\"Rewards Cycle Reward\", vars.rewardsCycleReward);\n\n uint32 rewardsCycleLength = vars.ionFlywheelRewards.rewardsCycleLength();\n emit log_named_uint(\"Rewards Cycle Length\", rewardsCycleLength);\n }\n\n function testQuickHF() public debuggingOnly forkAtBlock(MODE_MAINNET, 11831371) {\n address rahul = 0xf1bAeb439b8eF5043E069af0C8C8145963ebc3f8;\n\n uint256 hf = lens.getHealthFactor(rahul, pool);\n uint256 hf2 = lens.getHealthFactor(rahul, IonicComptroller(0x8Fb3D4a94D0aA5D6EDaAC3Ed82B59a27f56d923a));\n\n emit log_named_uint(\"hf\", hf);\n emit log_named_uint(\"hf2\", hf2);\n }\n\n function testQuickLiquidation() public debuggingOnly forkAtBlock(MODE_MAINNET, 12018198) {\n address user = 0xf1bAeb439b8eF5043E069af0C8C8145963ebc3f8;\n address whale = 0xaaEd68a3875F6BDbD44f70418dd16082870De8A0;\n address borrowedAsset = 0x80137510979822322193FC997d400D5A6C747bf7;\n uint256 repayAmount = 1968810267461862;\n address collateralToSeizeCToken = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address borrowedAssetCToken = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310;\n\n IonicUniV3Liquidator uniV3liquidator = IonicUniV3Liquidator(payable(0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A));\n\n emit log_named_address(\"univ3liq\", address(uniV3liquidator));\n emit log_named_address(\"express relay\", address(uniV3liquidator.expressRelay()));\n\n vm.mockCall(\n address(uniV3liquidator.expressRelay()),\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(uniV3liquidator),\n abi.encode(user)\n ),\n abi.encode(true)\n );\n\n vm.startPrank(whale);\n ERC20(borrowedAsset).approve(address(uniV3liquidator), type(uint256).max);\n uniV3liquidator.safeLiquidate(user, repayAmount, ICErc20(borrowedAssetCToken), ICErc20(collateralToSeizeCToken), 0);\n vm.stopPrank();\n }\n\n function testQuickAssets() public debuggingOnly forkAtBlock(MODE_MAINNET, 12314870) {\n address user = 0x5BDB1Fb5d0F841f4eb88D537bED0DD674fA88D7c;\n IonicComptroller comptroller = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n IonicComptroller comptroller2 = IonicComptroller(0x8Fb3D4a94D0aA5D6EDaAC3Ed82B59a27f56d923a);\n\n uint256 hf = lens.getHealthFactor(user, comptroller);\n uint256 hf2 = lens.getHealthFactor(user, comptroller2);\n\n PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser(comptroller, user);\n PoolLens.PoolAsset[] memory assets2 = lens.getPoolAssetsByUser(comptroller2, user);\n\n emit log(\"<---------------------------------MAIN MARKETS--------------------------------->\");\n emit log_named_uint(\"hf\", hf);\n for (uint i; i < assets.length; i++) {\n emit log(\"====================================================\");\n emit log_named_string(\"name\", assets[i].underlyingName);\n emit log_named_address(\"ctoken\", assets[i].cToken);\n emit log_named_address(\"underlying\", assets[i].underlyingToken);\n emit log_named_uint(\"supplyBalance\", assets[i].supplyBalance);\n emit log_named_uint(\"borrowBalance\", assets[i].borrowBalance);\n emit log_named_uint(\"underlyingPrice\", assets[i].underlyingPrice);\n emit log_named_uint(\"exchange rate\", assets[i].exchangeRate);\n }\n\n emit log(\"<---------------------------------NATIVE MARKETS--------------------------------->\");\n emit log_named_uint(\"hf\", hf2);\n for (uint i; i < assets2.length; i++) {\n emit log(\"====================================================\");\n emit log_named_string(\"name\", assets2[i].underlyingName);\n emit log_named_address(\"ctoken\", assets2[i].cToken);\n emit log_named_address(\"underlying\", assets2[i].underlyingToken);\n emit log_named_uint(\"supplyBalance\", assets2[i].supplyBalance);\n emit log_named_uint(\"borrowBalance\", assets2[i].borrowBalance);\n emit log_named_uint(\"underlyingPrice\", assets2[i].underlyingPrice);\n }\n }\n\n function testNetAprMode() public debuggingOnly forkAtBlock(MODE_MAINNET, 8479829) {\n address user = 0x30D5047e839f079bDE1Ab16b34668f57391DacB3;\n int256 blocks = 30 * 24 * 365 * 60;\n IonicFlywheelLensRouter lensRouter = new IonicFlywheelLensRouter(\n PoolDirectory(0x39C353Cf9041CcF467A04d0e78B63d961E81458a)\n );\n int256 apr = lensRouter.getUserNetApr(user, blocks);\n\n emit log_named_int(\"apr\", apr);\n }\n\n function testModeUsdcBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(usdcMarket);\n }\n\n function testHypotheticalPosition() public debuggingOnly forkAtBlock(MODE_MAINNET, 8028296) {\n HealthFactorVars memory vars;\n\n address wolfy = 0x7d922bf0975424b3371074f54cC784AF738Dac0D;\n address usdcWhale = 0x70FF197c32E922700d3ff2483D250c645979855d;\n address wbtcWhale = 0xBD8CCf3ebE4CC2D57962cdC2756B143ce0135a6B;\n address wethWhale = 0xD746A2a6048C5D3AFF5766a8c4A0C8cFD2311745;\n\n address whale = wbtcWhale;\n vars.testCToken = wethMarket;\n vars.testUnderlying = WETH;\n vars.amountBorrow = 1e18 / 2;\n\n address[] memory cTokens = new address[](1);\n\n vm.startPrank(usdcWhale);\n ERC20(USDC).transfer(wolfy, ERC20(USDC).balanceOf(usdcWhale));\n vm.stopPrank();\n\n vm.startPrank(wbtcWhale);\n ERC20(WBTC).transfer(wolfy, ERC20(WBTC).balanceOf(wbtcWhale));\n vm.stopPrank();\n\n vm.startPrank(wethWhale);\n ERC20(WETH).transfer(wolfy, ERC20(WETH).balanceOf(wethWhale));\n vm.stopPrank();\n\n // emit log_named_uint(\"USDC balance\", ERC20(USDC).balanceOf(wolfy));\n // emit log_named_uint(\"WBTC balance\", ERC20(WBTC).balanceOf(wolfy));\n // emit log_named_uint(\"WETH balance\", ERC20(WETH).balanceOf(wolfy));\n\n vm.startPrank(wolfy);\n\n ERC20(USDC).approve(address(usdcMarket), ERC20(USDC).balanceOf(wolfy));\n usdcMarket.mint(ERC20(USDC).balanceOf(wolfy));\n cTokens[0] = address(usdcMarket);\n pool.enterMarkets(cTokens);\n\n ERC20(WBTC).approve(address(wbtcMarket), ERC20(WBTC).balanceOf(wolfy));\n wbtcMarket.mint(ERC20(WBTC).balanceOf(wolfy));\n cTokens[0] = address(wbtcMarket);\n pool.enterMarkets(cTokens);\n\n ERC20(WETH).approve(address(wethMarket), ERC20(WETH).balanceOf(wolfy));\n wethMarket.mint(ERC20(WETH).balanceOf(wolfy));\n cTokens[0] = address(wethMarket);\n pool.enterMarkets(cTokens);\n\n wethMarket.borrow(1e18);\n\n vm.stopPrank();\n\n vars.usdcSupplied = usdcMarket.balanceOfUnderlying(wolfy);\n vars.wethSupplied = wethMarket.balanceOfUnderlying(wolfy);\n vars.ezEthSuppled = ezEthMarket.balanceOfUnderlying(wolfy);\n vars.stoneSupplied = stoneMarket.balanceOfUnderlying(wolfy);\n vars.wbtcSupplied = wbtcMarket.balanceOfUnderlying(wolfy);\n vars.weEthSupplied = weEthMarket.balanceOfUnderlying(wolfy);\n vars.merlinBTCSupplied = merlinBTCMarket.balanceOfUnderlying(wolfy);\n\n vars.usdcBorrowed = usdcMarket.borrowBalanceCurrent(wolfy);\n vars.wethBorrowed = wethMarket.borrowBalanceCurrent(wolfy);\n vars.ezEthBorrowed = ezEthMarket.borrowBalanceCurrent(wolfy);\n vars.stoneBorrowed = stoneMarket.borrowBalanceCurrent(wolfy);\n vars.wbtcBorrowed = wbtcMarket.borrowBalanceCurrent(wolfy);\n vars.weEthBorrowed = weEthMarket.borrowBalanceCurrent(wolfy);\n vars.merlinBTCBorrowed = merlinBTCMarket.borrowBalanceCurrent(wolfy);\n\n emit log_named_uint(\"usdcSupplied\", vars.usdcSupplied);\n emit log_named_uint(\"wethSupplied\", vars.wethSupplied);\n emit log_named_uint(\"ezEthSupplied\", vars.ezEthSuppled);\n emit log_named_uint(\"stoneSupplied\", vars.stoneSupplied);\n emit log_named_uint(\"wbtcSupplied\", vars.wbtcSupplied);\n emit log_named_uint(\"weEthSupplied\", vars.weEthSupplied);\n emit log_named_uint(\"merlinBTCSupplied\", vars.merlinBTCSupplied);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"usdcBorrowed\", vars.usdcBorrowed);\n emit log_named_uint(\"wethBorrowed\", vars.wethBorrowed);\n emit log_named_uint(\"ezEthBorrowed\", vars.ezEthBorrowed);\n emit log_named_uint(\"stoneBorrowed\", vars.stoneBorrowed);\n emit log_named_uint(\"wbtcBorrowed\", vars.wbtcBorrowed);\n emit log_named_uint(\"weEthBorrowed\", vars.weEthBorrowed);\n emit log_named_uint(\"merlinBTCBorrowed\", vars.merlinBTCBorrowed);\n\n // emit log_named_uint(\"value of usdcSupplied\", vars.usdcSupplied * pool.oracle().getUnderlyingPrice(usdcMarket));\n // emit log_named_uint(\"value of wethSupplied\", vars.wethSupplied * pool.oracle().getUnderlyingPrice(wethMarket));\n // emit log_named_uint(\"value of ezEthSupplied\", vars.ezEthSuppled * pool.oracle().getUnderlyingPrice(ezEthMarket));\n // emit log_named_uint(\"value of stoneSupplied\", vars.stoneSupplied * pool.oracle().getUnderlyingPrice(stoneMarket));\n // emit log_named_uint(\"value of wbtcSupplied\", vars.wbtcSupplied * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n // emit log_named_uint(\"value of usdcBorrowed\", vars.usdcBorrowed * pool.oracle().getUnderlyingPrice(usdcMarket));\n // emit log_named_uint(\"value of wethBorrowed\", vars.wethBorrowed * pool.oracle().getUnderlyingPrice(wethMarket));\n // emit log_named_uint(\"value of ezEthBorrowed\", vars.ezEthBorrowed * pool.oracle().getUnderlyingPrice(ezEthMarket));\n // emit log_named_uint(\"value of stoneBorrowed\", vars.stoneBorrowed * pool.oracle().getUnderlyingPrice(stoneMarket));\n // emit log_named_uint(\"value of wbtcBorrowed\", vars.wbtcBorrowed * pool.oracle().getUnderlyingPrice(wbtcMarket));\n\n vm.startPrank(whale);\n ERC20(vars.testUnderlying).transfer(wolfy, ERC20(vars.testUnderlying).balanceOf(whale));\n vm.stopPrank();\n\n uint256 hf = lens.getHealthFactor(wolfy, pool);\n uint256 hypothetical = lens.getHealthFactorHypothetical(\n pool,\n wolfy,\n address(vars.testCToken),\n 0,\n 0,\n vars.amountBorrow\n );\n\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(wolfy);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"Collateral Value Before\", collateralValue);\n emit log_named_uint(\"Liquidity Before\", liquidity);\n emit log_named_uint(\"hf before\", hf);\n emit log_named_uint(\"hypothetical hf\", hypothetical);\n\n vm.startPrank(wolfy);\n ERC20(vars.testUnderlying).approve(address(vars.testCToken), vars.amountBorrow);\n vars.testCToken.repayBorrow(vars.amountBorrow);\n vm.stopPrank();\n\n uint256 hfAfter = lens.getHealthFactor(wolfy, pool);\n (err, collateralValue, liquidity, shortfall) = pool.getAccountLiquidity(wolfy);\n\n emit log_named_uint(\"-------------------------------------------------\", 0);\n emit log_named_uint(\"Collateral Value After\", collateralValue);\n emit log_named_uint(\"Liquidity After\", liquidity);\n emit log_named_uint(\"hf after\", hfAfter);\n emit log_named_uint(\"user balance after\", ERC20(vars.testUnderlying).balanceOf(wolfy));\n emit log_named_uint(\"new borrow balance after repay\", vars.testCToken.borrowBalanceCurrent(wolfy));\n }\n\n function testModeUsdtBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(usdtMarket);\n }\n\n function testModeWethBorrowCaps() public debuggingOnly fork(MODE_MAINNET) {\n _testModeBorrowCaps(wethMarket);\n wethMarket.accrueInterest();\n _testModeBorrowCaps(wethMarket);\n }\n\n function _testModeBorrowCaps(ICErc20 market) internal {\n uint256 borrowCapUsdc = pool.borrowCaps(address(market));\n uint256 totalBorrowsCurrent = market.totalBorrowsCurrent();\n\n uint256 wethBorrowAmount = 154753148031252;\n console.log(\"borrowCapUsdc %e\", borrowCapUsdc);\n console.log(\"totalBorrowsCurrent %e\", totalBorrowsCurrent);\n console.log(\"new totalBorrowsCurrent %e\", totalBorrowsCurrent + wethBorrowAmount);\n }\n\n function testMarketMember() public debuggingOnly fork(MODE_MAINNET) {\n address rahul = 0x5A9e792143bf2708b4765C144451dCa54f559a19;\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint256 i = 0; i < markets.length; i++) {\n if (pool.checkMembership(rahul, markets[i])) {\n emit log(\"is a member\");\n } else {\n emit log(\"NOT a member\");\n }\n }\n }\n\n function testGetCashError() public debuggingOnly fork(MODE_MAINNET) {\n ICErc20 market = ICErc20(0x49950319aBE7CE5c3A6C90698381b45989C99b46);\n market.getCash();\n }\n\n function testWrsEthBalanceOfError() public debuggingOnly fork(MODE_MAINNET) {\n address wrsEthMarketAddress = 0x49950319aBE7CE5c3A6C90698381b45989C99b46;\n ERC20 wrsEth = ERC20(0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd);\n wrsEth.balanceOf(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n }\n\n function testModeRepay() public debuggingOnly fork(MODE_MAINNET) {\n address user = 0x1A3C4E9B49e4fc595fB7e5f723159bA73a9426e7;\n ICErc20 market = usdcMarket;\n ERC20 asset = ERC20(market.underlying());\n\n uint256 borrowBalance = market.borrowBalanceCurrent(user);\n emit log_named_uint(\"borrowBalance\", borrowBalance);\n\n vm.startPrank(user);\n asset.approve(address(market), borrowBalance);\n uint256 err = market.repayBorrow(borrowBalance / 2);\n\n emit log_named_uint(\"error\", err);\n }\n\n function testAssetsPrices() public debuggingOnly fork(MODE_MAINNET) {\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n emit log_named_uint(\"WETH price\", mpo.price(WETH));\n emit log_named_uint(\"USDC price\", mpo.price(USDC));\n emit log_named_uint(\"USDT price\", mpo.price(USDT));\n emit log_named_uint(\"UNI price\", mpo.price(UNI));\n emit log_named_uint(\"SNX price\", mpo.price(SNX));\n emit log_named_uint(\"LINK price\", mpo.price(LINK));\n emit log_named_uint(\"DAI price\", mpo.price(DAI));\n emit log_named_uint(\"BAL price\", mpo.price(BAL));\n emit log_named_uint(\"AAVE price\", mpo.price(AAVE));\n emit log_named_uint(\"WBTC price\", mpo.price(WBTC));\n }\n\n function testDeployedMarkets() public debuggingOnly fork(MODE_MAINNET) {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint8 i = 0; i < markets.length; i++) {\n emit log_named_address(\"market\", address(markets[i]));\n emit log(markets[i].symbol());\n emit log(markets[i].name());\n }\n }\n\n function testDisableCollateralUsdc() public debuggingOnly fork(MODE_MAINNET) {\n address user = 0xF70CBE91fB1b1AfdeB3C45Fb8CDD2E1249b5b75E;\n address usdcMarketAddr = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n\n vm.startPrank(user);\n\n uint256 borrowed = ICErc20(usdcMarketAddr).borrowBalanceCurrent(user);\n\n emit log_named_uint(\"borrowed\", borrowed);\n\n pool.exitMarket(usdcMarketAddr);\n }\n\n function testBorrowRateAtRatio() public debuggingOnly fork(MODE_MAINNET) {\n uint256 rate = levPosLens.getBorrowRateAtRatio(wethMarket, ezEthMarket, 9988992945501686, 2e18);\n emit log_named_uint(\"borrow rate at ratio\", rate);\n }\n\n function testAssetAsCollateralCap() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ezEthWhale = 0x2344F131B07E6AFd943b0901C55898573F0d1561;\n\n vm.startPrank(multisig);\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_EZETH,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic Renzo Restaked ETH\",\n \"ionezETH\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 ezEthMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(ezEthMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(ezEthMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(ezEthWhale);\n ERC20(MODE_EZETH).approve(address(ezEthMarket), 1e36);\n errCode = ezEthMarket.mint(1e18);\n require(errCode == 0, \"should be unable to supply\");\n }\n\n function testNewStoneMarketCapped() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_STONE = 0x80137510979822322193FC997d400D5A6C747bf7;\n address stoneWhale = 0x76486cbED5216C82d26Ee60113E48E06C189541A;\n\n address redstoneOracleAddress = 0x63A1531a06F0Ac597a0DfA5A516a37073c3E1e0a;\n RedstoneAdapterPriceOracle oracle = RedstoneAdapterPriceOracle(redstoneOracleAddress);\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(mpo.admin());\n mpo.add(asArray(MODE_STONE), oracles);\n\n vm.startPrank(multisig);\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_STONE,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic StakeStone Ether\",\n \"ionSTONE\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 stoneMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(stoneMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(stoneMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(stoneWhale);\n ERC20(MODE_STONE).approve(address(stoneMarket), 1e36);\n vm.expectRevert(\"not authorized\");\n errCode = stoneMarket.mint(1e18);\n //require(errCode != 0, \"should be unable to supply\");\n }\n\n function testRegisterSFS() public debuggingOnly fork(MODE_MAINNET) {\n emit log_named_address(\"pool admin\", pool.admin());\n\n vm.startPrank(multisig);\n pool.registerInSFS();\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint8 i = 0; i < markets.length; i++) {\n markets[i].registerInSFS();\n }\n }\n\n function upgradePool() internal {\n ComptrollerFirstExtension newComptrollerExtension = new ComptrollerFirstExtension();\n\n Unitroller asUnitroller = Unitroller(payable(address(pool)));\n\n // upgrade to the new comptroller extension\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(newComptrollerExtension, DiamondExtension(asUnitroller._listExtensions()[1]));\n\n //asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function testModeBorrowRate() public fork(MODE_MAINNET) {\n //ICErc20[] memory markets = pool.getAllMarkets();\n\n IonicComptroller pool = ezEthMarket.comptroller();\n vm.prank(pool.admin());\n ezEthMarket._setInterestRateModel(JumpRateModel(0x413aD59b80b1632988d478115a466bdF9B26743a));\n\n JumpRateModel discRateModel = JumpRateModel(ezEthMarket.interestRateModel());\n\n uint256 borrows = 200e18;\n uint256 cash = 5000e18 - borrows;\n uint256 reserves = 1e18;\n uint256 rate = discRateModel.getBorrowRate(cash, borrows, reserves);\n\n emit log_named_uint(\"rate per year %e\", rate * discRateModel.blocksPerYear());\n }\n\n function testModeFetchBorrowers() public fork(MODE_MAINNET) {\n // address[] memory borrowers = pool.getAllBorrowers();\n // emit log_named_uint(\"borrowers.len\", borrowers.length);\n\n //upgradePool();\n\n (uint256 totalPages, address[] memory borrowersPage) = pool.getPaginatedBorrowers(1, 0);\n\n emit log_named_uint(\"total pages with 300 size (default)\", totalPages);\n\n (totalPages, borrowersPage) = pool.getPaginatedBorrowers(totalPages - 1, 50);\n emit log_named_array(\"last page of 300 borrowers\", borrowersPage);\n\n (totalPages, borrowersPage) = pool.getPaginatedBorrowers(1, 50);\n emit log_named_uint(\"total pages with 50 size\", totalPages);\n emit log_named_array(\"page of 50 borrowers\", borrowersPage);\n\n // for (uint256 i = 0; i < borrowers.length; i++) {\n // (\n // uint256 error,\n // uint256 collateralValue,\n // uint256 liquidity,\n // uint256 shortfall\n // ) = pool.getAccountLiquidity(borrowers[i]);\n //\n // emit log(\"\");\n // emit log_named_address(\"user\", borrowers[i]);\n // emit log_named_uint(\"collateralValue\", collateralValue);\n // if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n // if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n // }\n }\n\n function testModeAccountLiquidity() public debuggingOnly fork(MODE_MAINNET) {\n _testAccountLiquidity(0x0C387030a5D3AcDcde1A8DDaF26df31BbC1CE763);\n }\n\n function _testAccountLiquidity(address borrower) internal {\n (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(borrower);\n\n emit log(\"\");\n emit log_named_address(\"user\", borrower);\n emit log_named_uint(\"collateralValue\", collateralValue);\n if (liquidity > 0) emit log_named_uint(\"liquidity\", liquidity);\n if (shortfall > 0) emit log_named_uint(\"SHORTFALL\", shortfall);\n }\n\n function testModeDeployMarket() public debuggingOnly fork(MODE_MAINNET) {\n address MODE_WEETH = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n address weEthWhale = 0x6e55a90772B92f17f87Be04F9562f3faafd0cc38;\n\n vm.startPrank(pool.admin());\n uint256 errCode = pool._deployMarket(\n 1, //delegateType\n abi.encode(\n MODE_WEETH,\n address(pool),\n ap.getAddress(\"FeeDistributor\"),\n 0x21a455cEd9C79BC523D4E340c2B97521F4217817, // irm - jump rate model on mode\n \"Ionic Wrapped eETH\",\n \"ionweETH\",\n 0.10e18,\n 0.10e18\n ),\n \"\",\n 0.70e18\n );\n vm.stopPrank();\n require(errCode == 0, \"error deploying market\");\n\n ICErc20[] memory markets = pool.getAllMarkets();\n ICErc20 weEthMarket = markets[markets.length - 1];\n\n // uint256 cap = pool.getAssetAsCollateralValueCap(weEthMarket, usdcMarket, false, deployer);\n uint256 cap = pool.supplyCaps(address(weEthMarket));\n require(cap == 0, \"non-zero cap\");\n\n vm.startPrank(weEthWhale);\n ERC20(MODE_WEETH).approve(address(weEthMarket), 1e36);\n errCode = weEthMarket.mint(0.01e18);\n require(errCode == 0, \"should be unable to supply\");\n }\n\n function testModeWrsETH() public debuggingOnly forkAtBlock(MODE_MAINNET, 6635923) {\n address wrsEth = 0x4186BFC76E2E237523CBC30FD220FE055156b41F;\n RedstoneAdapterPriceOracleWrsETH oracle = new RedstoneAdapterPriceOracleWrsETH(\n 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256\n );\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(multisig);\n mpo.add(asArray(wrsEth), oracles);\n\n uint256 price = mpo.price(wrsEth);\n emit log_named_uint(\"price of wrsEth\", price);\n }\n\n function testModeWeETH() public debuggingOnly forkAtBlock(MODE_MAINNET, 6861468) {\n address weEth = 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A;\n RedstoneAdapterPriceOracleWeETH oracle = new RedstoneAdapterPriceOracleWeETH(\n 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256\n );\n MasterPriceOracle mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n vm.prank(multisig);\n mpo.add(asArray(weEth), oracles);\n\n uint256 price = mpo.price(weEth);\n emit log_named_uint(\"price of weEth\", price);\n assertEq(price, 1036212437077011599);\n }\n\n function testPERLiquidation() public debuggingOnly forkAtBlock(MODE_MAINNET, 10255413) {\n vm.prank(0x5Cc070844E98F4ceC5f2fBE1592fB1ed73aB7b48);\n _functionCall(\n 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A,\n hex\"20b72325000000000000000000000000f28570694a6c9cd0494955966ae75af61abf5a0700000000000000000000000000000000000000000000000001bc1214ed792fbb0000000000000000000000004341620757bee7eb4553912fafc963e59c949147000000000000000000000000c53edeafb6d502daec5a7015d67936cea0cd0f520000000000000000000000000000000000000000000000000000000000000000\",\n \"error in call\"\n );\n }\n\n function testCtokenUpgrade() public debuggingOnly forkAtBlock(MODE_MAINNET, 10255413) {\n CErc20PluginRewardsDelegate newImpl = new CErc20PluginRewardsDelegate();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(wethMarket)));\n\n (uint256[] memory poolIds, PoolDirectory.Pool[] memory pools) = PoolDirectory(\n 0x39C353Cf9041CcF467A04d0e78B63d961E81458a\n ).getActivePools();\n\n emit log_named_uint(\"First Pool ID\", poolIds[0]);\n emit log_named_uint(\"First Pool ID\", poolIds[1]);\n emit log_named_string(\"First Pool Address\", pools[0].name);\n emit log_named_string(\"First Pool Address\", pools[0].name);\n emit log_named_address(\"First Pool Address\", pools[0].creator);\n emit log_named_address(\"First Pool Address\", pools[1].creator);\n emit log_named_address(\"First Pool Address\", pools[0].comptroller);\n emit log_named_address(\"First Pool Address\", pools[1].comptroller);\n //bytes32 bytesAtSlot = vm.load(address(proxy), 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);\n //address admin = address(uint160(uint256(bytesAtSlot)));\n //vm.prank(admin);\n //proxy.upgradeTo(address(newImpl));\n\n //vm.prank(dpa.owner());\n //proxy.upgradeTo(address(newImpl));\n }\n\n function testAerodromeV2Liquidator() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n AerodromeV2Liquidator liquidator = new AerodromeV2Liquidator();\n IERC20Upgradeable hyUSD = IERC20Upgradeable(0xCc7FF230365bD730eE4B352cC2492CEdAC49383e);\n IERC20Upgradeable eUSD = IERC20Upgradeable(0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4);\n IERC20Upgradeable usdc = IERC20Upgradeable(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);\n address hyusdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address usdcWhale = 0xaac391f166f33CdaEfaa4AfA6616A3BEA66B694d;\n address eusdWhale = 0xEE8Bd6594E046d72D592ac0e278E3CA179b8f189;\n address aerodromeV2Router = 0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43;\n\n vm.startPrank(eusdWhale);\n eUSD.transfer(address(liquidator), 1000 ether);\n IRouter_Aerodrome.Route[] memory path = new IRouter_Aerodrome.Route[](1);\n path[0] = IRouter_Aerodrome.Route({\n from: address(eUSD),\n to: address(usdc),\n stable: true,\n factory: 0x420DD381b31aEf6683db6B902084cB0FFECe40Da\n });\n liquidator.redeem(eUSD, 1000 ether, abi.encode(aerodromeV2Router, path));\n emit log_named_uint(\"usdc received\", usdc.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidator() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n AerodromeCLLiquidator liquidator = new AerodromeCLLiquidator();\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address superOETHWhale = 0xF1010eE787Ee588766b441d7cC397b40DdFB17a3;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n vm.startPrank(superOETHWhale);\n superOETH.transfer(address(liquidator), 1 ether);\n liquidator.redeem(superOETH, 1 ether, abi.encode(address(superOETH), address(weth), int24(1), aerodromeCLRouter));\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidatorWrap() public debuggingOnly forkAtBlock(BASE_MAINNET, 20203998) {\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address wethWhale = 0x751b77C43643a63362Ab024d466fcC1d75354295;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n AerodromeCLLiquidator liquidator = AerodromeCLLiquidator(0xb50De36105F6053006306553AB54e77224818B9B);\n\n vm.startPrank(wethWhale);\n weth.transfer(address(liquidator), 1 ether);\n liquidator.redeem(\n weth,\n 1 ether,\n abi.encode(address(weth), address(wsuperOETH), aerodromeCLRouter, address(0), address(superOETH), 1)\n );\n emit log_named_uint(\"wsuperOETH received\", wsuperOETH.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testAerodromeCLLiquidatorUnwrap() public debuggingOnly forkAtBlock(BASE_MAINNET, 19968360) {\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address wsuperOethWhale = 0x0EEaCD4c475040463389d15EAd034d1291b008b1;\n address aerodromeCLRouter = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\n\n AerodromeCLLiquidator liquidator = new AerodromeCLLiquidator();\n\n vm.startPrank(wsuperOethWhale);\n wsuperOETH.transfer(address(liquidator), 1 ether);\n liquidator.redeem(\n wsuperOETH,\n 1 ether,\n abi.encode(address(wsuperOETH), address(weth), aerodromeCLRouter, address(superOETH), address(0), 1)\n );\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testCurveSwapLiquidatorUSDCtowUSDM() public debuggingOnly forkAtBlock(BASE_MAINNET, 20237792) {\n address _pool = 0x63Eb7846642630456707C3efBb50A03c79B89D81;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address usdm = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\n address wUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812;\n address usdcWhale = 0x134575ff75F9882ca905EE1D78C9340C091d6056;\n CurveV2LpTokenPriceOracleNoRegistry oracle = new CurveV2LpTokenPriceOracleNoRegistry();\n CurveSwapLiquidator liquidator = new CurveSwapLiquidator();\n vm.prank(oracle.owner());\n oracle.registerPool(_pool, _pool);\n vm.prank(usdcWhale);\n IERC20Upgradeable(usdc).transfer(address(liquidator), 100e6);\n liquidator.redeem(IERC20Upgradeable(usdc), 100e6, abi.encode(oracle, wUSDM, address(0), usdm));\n emit log_named_uint(\"wUSDM received\", IERC20Upgradeable(wUSDM).balanceOf(address(liquidator)));\n }\n\n function testCurveSwapLiquidatorwUSDMtoUSDC() public debuggingOnly forkAtBlock(BASE_MAINNET, 20237792) {\n address _pool = 0x63Eb7846642630456707C3efBb50A03c79B89D81;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address usdm = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\n address wUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812;\n address wusdmWhale = 0x9b8b04B6f82cD5e1dae58cA3614d445F93DeFc5c;\n CurveV2LpTokenPriceOracleNoRegistry oracle = new CurveV2LpTokenPriceOracleNoRegistry();\n CurveSwapLiquidator liquidator = new CurveSwapLiquidator();\n vm.prank(oracle.owner());\n oracle.registerPool(_pool, _pool);\n\n vm.startPrank(wusdmWhale);\n IERC20Upgradeable(wUSDM).transfer(address(liquidator), 30 ether);\n liquidator.redeem(IERC20Upgradeable(wUSDM), 30 ether, abi.encode(oracle, usdc, usdm, address(0)));\n emit log_named_uint(\"usdc received\", IERC20Upgradeable(usdc).balanceOf(address(liquidator)));\n }\n\n function testKimLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 13579406) {\n address weth = 0x4200000000000000000000000000000000000006;\n address usdc = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address kimRouter = 0xAc48FcF1049668B285f3dC72483DF5Ae2162f7e8;\n address wethWhale = 0xe9b14a1Be94E70900EDdF1E22A4cB8c56aC9e10a;\n AlgebraSwapLiquidator liquidator = AlgebraSwapLiquidator(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\n vm.startPrank(wethWhale);\n IERC20Upgradeable(weth).transfer(address(liquidator), 2018770577362160);\n liquidator.redeem(IERC20Upgradeable(weth), 2018770577362160, abi.encode(usdc, kimRouter));\n emit log_named_uint(\"usdc received\", IERC20Upgradeable(usdc).balanceOf(address(liquidator)));\n }\n\n function testVelodromeV2Liquidator_mode_usdcToWeth() public debuggingOnly forkAtBlock(MODE_MAINNET, 13881743) {\n VelodromeV2Liquidator liquidator = new VelodromeV2Liquidator();\n IERC20Upgradeable usdc = IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f);\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n address usdcWhale = 0xFd1D36995d76c0F75bbe4637C84C06E4A68bBB3a;\n\n address veloRouter = 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45;\n\n vm.startPrank(usdcWhale);\n usdc.transfer(address(liquidator), 1000 * 10e6);\n IRouter_Velodrome.Route[] memory path = new IRouter_Velodrome.Route[](1);\n path[0] = IRouter_Velodrome.Route({ from: address(usdc), to: address(weth), stable: false });\n liquidator.redeem(usdc, 1000 * 10e6, abi.encode(veloRouter, path));\n emit log_named_uint(\"weth received\", weth.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function testVelodromeV2Liquidator_mode_wethToUSDC() public debuggingOnly forkAtBlock(MODE_MAINNET, 13881743) {\n VelodromeV2Liquidator liquidator = new VelodromeV2Liquidator();\n IERC20Upgradeable weth = IERC20Upgradeable(0x4200000000000000000000000000000000000006);\n IERC20Upgradeable usdc = IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f);\n address wethWhale = 0xe9b14a1Be94E70900EDdF1E22A4cB8c56aC9e10a;\n\n address veloRouter = 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45;\n\n vm.startPrank(wethWhale);\n weth.transfer(address(liquidator), 1 ether);\n IRouter_Velodrome.Route[] memory path = new IRouter_Velodrome.Route[](1);\n path[0] = IRouter_Velodrome.Route({ from: address(weth), to: address(usdc), stable: false });\n\n liquidator.redeem(weth, 1 ether, abi.encode(veloRouter, path));\n emit log_named_uint(\"usdc received\", usdc.balanceOf(address(liquidator)));\n vm.stopPrank();\n }\n\n function test_claimRewardFromLeveredPosition() public debuggingOnly fork(BASE_MAINNET) {\n LeveredPosition position = LeveredPosition(\n 0x3a0eA2C577b0e0f2CAaEcC2b8fF8fF1850267ba2 // 20 days old\n );\n ILeveredPositionFactory factory = position.factory();\n\n vm.prank(address(factory));\n LeveredPosition dummy = new LeveredPosition(\n msg.sender,\n ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3),\n ICErc20(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0)\n );\n emit log_named_address(\"dummy\", address(dummy));\n\n vm.startPrank(factory.owner());\n DiamondBase(address(factory))._registerExtension(\n new LeveredPositionFactoryFirstExtension(),\n DiamondExtension(0x115455f15ef67e298F012F225B606D3c4Daa1d60)\n );\n factory._setPositionsExtension(LeveredPosition.claimRewardsFromRouter.selector, address(dummy));\n vm.stopPrank();\n\n {\n // mock the usdz call\n vm.mockCall(\n 0x04D5ddf5f3a8939889F11E97f8c4BB48317F1938,\n abi.encodeWithSelector(IERC20Upgradeable.balanceOf.selector),\n abi.encode(53307671999615298341926)\n );\n }\n\n vm.startPrank(0xC13110d04f22ed464Cb72A620fF8163585358Ff9);\n (address[] memory rewardTokens, uint256[] memory rewards) = position.claimRewardsFromRouter(\n 0xB1402333b12fc066C3D7F55d37944D5e281a3e8B\n );\n emit log_named_uint(\"reward tokens\", rewardTokens.length);\n emit log_named_uint(\"rewards\", rewards.length);\n vm.stopPrank();\n }\n\n function test_liquidateWithAggregator() public debuggingOnly forkAtBlock(MODE_MAINNET, 15435970) {\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(0x50F13EC4B68c9522260d3ccd4F19826679B3Ce5C));\n emit log_named_address(\"liquidator\", address(liquidator));\n address cErc20 = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18; // weEth\n address cTokenCollateral = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038; // usdc\n uint256 repayAmount = 843900759317990;\n address borrower = 0x1Bec4f239F1Ec11FD8DC7B31A8fea7A5bA5a9Aa4;\n address aggregatorTarget = 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE; // lifi\n // 0xd988097fb8612cc24eeC14542bC03424c656005f usdc\n // 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A weeth\n bytes memory aggregatorData = vm.parseBytes(\n \"0x4666fc800d27477c9a16fe2929353656c1222839791dbe26e815e7533f731ea9a6b919bb00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000050f13ec4b68c9522260d3ccd4f19826679b3ce5c0000000000000000000000000000000000000000000000000002ff85fb26dbe8000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307830303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000000007e15eb462cdc67cf92af1f7102465a8f8c7848740000000000000000000000007e15eb462cdc67cf92af1f7102465a8f8c784874000000000000000000000000d988097fb8612cc24eec14542bc03424c656005f00000000000000000000000004c0599ae5a44757c0af6f9ec3b93da8976c150a000000000000000000000000000000000000000000000000000000000027891800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000f283bd37f90001d988097fb8612cc24eec14542bc03424c656005f000104c0599ae5a44757c0af6f9ec3b93da8976c150a0327891807030361590977620147ae00019b57dca972db5d8866c630554acdbdfe58b2659c000000011231deb6f5749ef6ce6943a275a1d3e7486f4eae59725ade04010205000601020203000205000100010400ff0000000000000000000000000053e85d00f2c6578a1205b842255ab9df9d05374425ba258e510faca5ab7ff941a1584bdd2174c94dd988097fb8612cc24eec14542bc03424c656005f4200000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000\"\n );\n\n emit log_named_uint(\n \"before collateral\",\n IERC20Upgradeable(ICErc20(cTokenCollateral).underlying()).balanceOf(address(this))\n );\n emit log_named_uint(\"before borrow\", IERC20Upgradeable(ICErc20(cErc20).underlying()).balanceOf(address(this)));\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidator.safeLiquidateWithAggregator(\n borrower,\n repayAmount,\n ICErc20(cErc20),\n ICErc20(cTokenCollateral),\n aggregatorTarget,\n aggregatorData\n );\n vm.stopPrank();\n\n emit log_named_uint(\n \"profit collateral\",\n IERC20Upgradeable(ICErc20(cTokenCollateral).underlying()).balanceOf(address(this))\n );\n emit log_named_uint(\"profit borrow\", IERC20Upgradeable(ICErc20(cErc20).underlying()).balanceOf(address(this)));\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testRawCall() public debuggingOnly forkAtBlock(BASE_MAINNET, 20569373) {\n address caller = 0xC13110d04f22ed464Cb72A620fF8163585358Ff9;\n address target = 0x180272dDf5767C771b3a8d37A2DC6cA507aaa1d9;\n\n ILeveredPositionFactory factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n ILiquidatorsRegistry registry = factory.liquidatorsRegistry();\n\n AerodromeCLLiquidator aerodomeClLiquidator = new AerodromeCLLiquidator();\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(WETH);\n IERC20Upgradeable outputToken = wsuperOETH;\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategy(aerodomeClLiquidator, inputToken, outputToken);\n registry._setRedemptionStrategy(aerodomeClLiquidator, outputToken, inputToken);\n vm.stopPrank();\n\n bytes memory data = hex\"c393d0e3\";\n vm.prank(caller);\n _functionCall(target, data, \"raw call failed\");\n\n uint256 superOETHBalance = superOETH.balanceOf(target);\n emit log_named_uint(\"balance of levered position\", superOETHBalance);\n }\n}\n" + }, + "contracts/test/EmissionsManager/EmissionsManagerTest.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"../config/BaseTest.t.sol\";\nimport \"../../EmissionsManager.sol\";\nimport \"../../PoolDirectory.sol\";\nimport \"./mocks/MockVeION.sol\";\nimport \"./mocks/MockPoolDirectory.sol\";\nimport \"./mocks/MockIonicComptroller.sol\";\nimport \"./mocks/MockOracle.sol\";\nimport \"./mocks/MockIonicFlywheelCore.sol\";\nimport \"./mocks/MockICErc20.sol\";\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../../veION/interfaces/IveION.sol\";\n\ncontract EmissionsManagerTest is BaseTest {\n MockPoolDirectory poolDirectory;\n MockIonicComptroller comptroller;\n MockICErc20 mockAsset;\n MockVeION mockVeION;\n MockOracle oracle;\n MockIonicFlywheelCore ionicFlywheelCore;\n\n EmissionsManager emissionsManager;\n MockERC20 rewardToken;\n\n address user = address(0x123);\n address reporter = address(0x124);\n address flywheelRewards = address(0x125);\n address protocolAddress = address(0x456);\n uint256 collateralBp = 250; // Example value\n bytes nonBlacklistableBytecode = hex\"deadbeef\";\n\n function setUp() public {\n mockAsset = new MockICErc20();\n mockAsset.setBalanceOfUnderlying(user, 1e18);\n\n oracle = new MockOracle();\n oracle.setUnderlyingPrice(ICErc20(address(mockAsset)), 100);\n\n // Deploy a mock ERC20 reward token\n //rewardToken = new MockERC20();\n rewardToken = new MockERC20(\"ION\", \"ION\", 18);\n\n // Deploy the IonicFlywheelCore mock\n ionicFlywheelCore = new MockIonicFlywheelCore();\n ionicFlywheelCore.setRewardToken(address(rewardToken));\n\n // Deploy the Comptroller mock\n comptroller = new MockIonicComptroller();\n comptroller.setAssetsIn(address(mockAsset));\n comptroller.setOracle(address(oracle));\n comptroller.setFlywheel(address(ionicFlywheelCore));\n\n // Deploy the PoolDirectory mock\n poolDirectory = new MockPoolDirectory();\n poolDirectory.setActivePools(address(comptroller));\n\n emissionsManager = EmissionsManager(\n address(\n new TransparentUpgradeableProxy(\n address(new EmissionsManager()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n emissionsManager.initialize.selector,\n PoolDirectory(address(poolDirectory)),\n protocolAddress,\n rewardToken,\n collateralBp,\n nonBlacklistableBytecode\n )\n )\n )\n );\n mockVeION = new MockVeION();\n mockVeION.setMockTotalEthValueOfTokens(user, 1);\n emissionsManager.setVeIon(IveION(address(mockVeION)));\n }\n\n function test_Initialize() public {\n assertEq(emissionsManager.protocolAddress(), protocolAddress, \"Protocol address mismatch\");\n\n assertEq(emissionsManager.collateralBp(), collateralBp, \"Collateral basis points mismatch\");\n\n assertEq(address(emissionsManager.rewardToken()), address(rewardToken), \"Reward token mismatch\");\n }\n\n function test_setVeIon_OwnerCanSetVeIonAddress() public {\n IveION veIONMock = IveION(address(new MockVeION()));\n\n emissionsManager.setVeIon(veIONMock);\n\n assertEq(address(emissionsManager.veION()), address(veIONMock), \"veION address mismatch\");\n }\n\n function test_setCollateralBp_OwnerCanSetCollateralBp() public {\n uint256 newCollateralBp = 2_500;\n\n emissionsManager.setCollateralBp(newCollateralBp);\n\n assertEq(emissionsManager.collateralBp(), newCollateralBp, \"Collateral basis points not updated\");\n }\n\n function test_setNonBlacklistableAddress_OwnerCanSetNonBlacklistableAddress() public {\n emissionsManager.setNonBlacklistableAddress(user, true);\n\n assertTrue(emissionsManager.nonBlacklistable(user), \"User should be non-blacklistable\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n assertFalse(emissionsManager.nonBlacklistable(user), \"User should be blacklistable\");\n }\n\n function test_setNonBlacklistableTargetBytecode_OwnerCanSetNonBlacklistableTargetBytecode() public {\n bytes memory bytecode = hex\"deadbeef\";\n\n emissionsManager.setNonBlacklistableTargetBytecode(bytecode);\n\n assertEq(emissionsManager.nonBlacklistableTargetBytecode(), bytecode, \"Non-blacklistable target bytecode mismatch\");\n }\n\n function test_reportUser_ReporterCanReportUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n emissionsManager.setNonBlacklistableAddress(user, false);\n assertEq(rewardToken.balanceOf(address(ionicFlywheelCore)), 0);\n\n ionicFlywheelCore.setFlywheelRewards(flywheelRewards);\n rewardToken.mint(flywheelRewards, 1e18);\n vm.prank(flywheelRewards);\n rewardToken.approve(address(ionicFlywheelCore), 1e18);\n\n assertEq(rewardToken.balanceOf(flywheelRewards), 1e18);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n assertEq(rewardToken.balanceOf(flywheelRewards), 0);\n assertEq(rewardToken.balanceOf(reporter), 8e17);\n assertEq(rewardToken.balanceOf(protocolAddress), 2e17);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n }\n\n function test_reportUser_ReporterCantReportUserWithLPBalanceAboveThreshold() public {\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n vm.prank(reporter);\n vm.expectRevert(\"LP balance above threshold\");\n emissionsManager.reportUser(user);\n }\n\n function test_reportUser_ReporterCantReportAlreadyBlacklistedUser() public {\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n vm.prank(reporter);\n vm.expectRevert(\"Already blacklisted\");\n emissionsManager.reportUser(user);\n }\n\n function test_reportUser_ReporterCantReportNonBlacklistableBytecode() public {\n emissionsManager.setNonBlacklistableTargetBytecode(address(mockAsset).code);\n\n vm.prank(reporter);\n vm.expectRevert(\"Non-blacklistable bytecode\");\n emissionsManager.reportUser(address(mockAsset));\n }\n\n function test_reportUser_ReporterCantReportNonBlacklistableUser() public {\n emissionsManager.setNonBlacklistableAddress(user, true);\n\n vm.prank(reporter);\n vm.expectRevert(\"Non-blacklistable user\");\n emissionsManager.reportUser(user);\n }\n\n function test_whitelistUser_ReporterCanWhitelistBlacklistedUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n emissionsManager.whitelistUser(user);\n\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should be whitelisted\");\n }\n\n function test_whitelistUser_ReporterCantWhitelistUserWithLpBalanceBelowThreshold() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n vm.expectRevert(\"LP balance below threshold\");\n emissionsManager.whitelistUser(user);\n }\n\n function test_whitelistUser_ReporterCantWhitelistAlreadyWhitelistedUser() public {\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should not be blacklisted initially\");\n\n emissionsManager.setNonBlacklistableAddress(user, false);\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertTrue(emissionsManager.isUserBlacklisted(user), \"User should be blacklisted\");\n\n mockVeION.setMockTotalEthValueOfTokens(user, 1e18);\n emissionsManager.whitelistUser(user);\n\n assertFalse(emissionsManager.isUserBlacklisted(user), \"User should be whitelisted\");\n\n vm.expectRevert(\"Already whitelisted\");\n emissionsManager.whitelistUser(user);\n }\n\n function test_isUserBlacklistable_AlreadyBlacklistedUserCantBeBlacklistable() public {\n assertTrue(emissionsManager.isUserBlacklistable(user), \"User should be blacklistable\");\n\n vm.prank(reporter);\n emissionsManager.reportUser(user);\n\n assertFalse(emissionsManager.isUserBlacklistable(user), \"User shouldn't be blacklistable\");\n }\n}\n" + }, + "contracts/test/EmissionsManager/mocks/MockICErc20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ncontract MockICErc20 {\n mapping(address => uint256) public balances;\n\n\n function setBalanceOfUnderlying(address _user, uint256 _balance) public {\n balances[_user] = _balance;\n }\n function balanceOfUnderlying(address _user) public view returns (uint256) {\n return balances[_user];\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicComptroller.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { IonicFlywheelCore } from \"../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\ncontract MockIonicComptroller {\n address public oracle;\n address public asset;\n address public flywheel;\n\n // Allows setting mock eth values for testing purposes\n function setOracle(address _oracle) external {\n oracle = _oracle;\n }\n\n function setAssetsIn(address _asset) external {\n asset = _asset;\n }\n\n function setFlywheel(address _flywheel) external {\n flywheel = _flywheel;\n }\n function getAssetsIn(address _user) public view returns (ICErc20[] memory) {\n ICErc20[] memory assets = new ICErc20[](1); \n assets[0] = ICErc20(asset); \n return assets;\n }\n\n function getAllMarkets() public view returns (ICErc20[] memory) {\n ICErc20[] memory assets = new ICErc20[](1); \n assets[0] = ICErc20(asset); \n return assets;\n }\n\n function getAccruingFlywheels() public view returns (IonicFlywheelCore[] memory) {\n IonicFlywheelCore[] memory flywheels = new IonicFlywheelCore[](1); \n flywheels[0] = IonicFlywheelCore(flywheel); \n return flywheels;\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockIonicFlywheelCore.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { SafeTransferLib } from \"solmate/utils/SafeTransferLib.sol\";\n\n\ncontract MockIonicFlywheelCore {\n using SafeTransferLib for ERC20;\n\n address public rewardToken;\n address public flywheelRewards;\n function setRewardToken(address _rewardToken) public {\n rewardToken = _rewardToken;\n }\n\n function setFlywheelRewards(address _flywheelRewards) public {\n flywheelRewards = _flywheelRewards;\n }\n\n function updateBlacklistBalances(ERC20 _market, address _user) external {}\n\n function accrue(ERC20 _market, address _user) public returns (uint256) {\n return 0;\n }\n\n function takeRewardsFromUser(address _user, address _receiver) external { \n uint256 balance = ERC20(rewardToken).balanceOf(address(flywheelRewards));\n ERC20(rewardToken).safeTransferFrom(address(flywheelRewards), _receiver, balance);\n }\n function whitelistUser(ERC20 strategy, address user) external {}\n\n}" + }, + "contracts/test/EmissionsManager/mocks/MockOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\ncontract MockOracle {\n mapping(ICErc20 => uint256) public prices;\n\n function setUnderlyingPrice(ICErc20 _tokenAddress, uint256 _price) public {\n prices[_tokenAddress] = _price;\n }\n function getUnderlyingPrice(ICErc20 _tokenAddress) public view returns (uint256) {\n return prices[_tokenAddress];\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockPoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nstruct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n}\n\ncontract MockPoolDirectory {\n\n Pool[] public pools;\n\n // Allows setting mock eth values for testing purposes\n function setActivePools(address comptroller) external {\n Pool memory pool = Pool(\"Test Pool\", msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n }\n\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory activeIds = new uint256[](1);\n Pool[] memory activePools = new Pool[](1);\n activePools[0] = pools[0];\n return (activeIds, activePools);\n }\n}" + }, + "contracts/test/EmissionsManager/mocks/MockVeION.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ncontract MockVeION /* is */ {\n mapping(address => uint256) public ethValues;\n\n // Allows setting mock eth values for testing purposes\n function setMockTotalEthValueOfTokens(address _owner, uint256 _value) external {\n ethValues[_owner] = _value;\n }\n\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\n return ethValues[_owner];\n }\n}" + }, + "contracts/test/ExtensionsTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\n\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract MockComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getFirstMarketSymbol() public view returns (string memory) {\n return allMarkets[0].symbol();\n }\n\n function _setTransferPaused(bool) public returns (bool) {\n return false;\n }\n\n function _setSeizePaused(bool) public returns (bool) {\n return false;\n }\n\n // a dummy fn to test if the replacement of extension fns works\n function getSecondMarketSymbol() public view returns (string memory) {\n return allMarkets[1].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 4;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this._setTransferPaused.selector;\n functionSelectors[--fnsCount] = this._setSeizePaused.selector;\n functionSelectors[--fnsCount] = this.getFirstMarketSymbol.selector;\n functionSelectors[--fnsCount] = this.getSecondMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract MockSecondComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getThirdMarketSymbol() public view returns (string memory) {\n return allMarkets[2].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 1;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getThirdMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract MockThirdComptrollerExtension is DiamondExtension, ComptrollerV3Storage {\n function getFourthMarketSymbol() public view returns (string memory) {\n return allMarkets[3].symbol();\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 1;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.getFourthMarketSymbol.selector;\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n}\n\ncontract ExtensionsTest is MarketsTest {\n MockComptrollerExtension internal mockExtension;\n MockSecondComptrollerExtension internal second;\n MockThirdComptrollerExtension internal third;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n mockExtension = new MockComptrollerExtension();\n second = new MockSecondComptrollerExtension();\n third = new MockThirdComptrollerExtension();\n }\n\n function testExtensionReplace() public debuggingOnly fork(BSC_MAINNET) {\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\n _upgradeExistingPool(jFiatPoolAddress);\n\n // replace the first extension with the mock\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, mockExtension, comptrollerExtension);\n\n // assert that the replacement worked\n MockComptrollerExtension asMockExtension = MockComptrollerExtension(jFiatPoolAddress);\n emit log(asMockExtension.getSecondMarketSymbol());\n assertEq(asMockExtension.getSecondMarketSymbol(), \"fETH-1\", \"market symbol does not match\");\n\n // add a second mock extension\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, second, DiamondExtension(address(0)));\n\n // add again the third, removing the second\n vm.prank(ffd.owner());\n ffd._registerComptrollerExtension(jFiatPoolAddress, third, second);\n\n // assert that it worked\n DiamondBase asBase = DiamondBase(jFiatPoolAddress);\n address[] memory currentExtensions = asBase._listExtensions();\n assertEq(currentExtensions.length, 2, \"extensions count does not match\");\n assertEq(currentExtensions[0], address(mockExtension), \"!first\");\n assertEq(currentExtensions[1], address(third), \"!second\");\n }\n\n function testNewPoolExtensions() public fork(BSC_MAINNET) {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n _prepareComptrollerUpgrade(address(0));\n\n // deploy a pool that will have an extension registered automatically\n {\n (, address poolAddress) = fpd.deployPool(\n \"just-a-test2\",\n latestComptrollerImplementation,\n abi.encode(payable(address(ffd))),\n false,\n 0.1e18,\n 1.1e18,\n ap.getAddress(\"MasterPriceOracle\")\n );\n\n address[] memory initExtensionsAfter = DiamondBase(payable(poolAddress))._listExtensions();\n assertEq(initExtensionsAfter.length, 1, \"remove this if the ffd config is set up\");\n assertEq(initExtensionsAfter[0], address(comptrollerExtension), \"first extension is not the CFE\");\n }\n }\n\n function testMulticallMarket() public fork(BSC_MAINNET) {\n uint8 random = uint8(block.timestamp % 256);\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(pools[random % pools.length].comptroller);\n ICErc20[] memory markets = somePool.getAllMarkets();\n\n if (markets.length == 0) return;\n\n ICErc20 someMarket = markets[random % markets.length];\n\n emit log(\"pool\");\n emit log_address(address(somePool));\n emit log(\"market\");\n emit log_address(address(someMarket));\n\n vm.roll(block.number + 1);\n\n bytes memory blockNumberBeforeCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\n bytes memory accrueInterestCall = abi.encodeWithSelector(someMarket.accrueInterest.selector);\n bytes memory blockNumberAfterCall = abi.encodeWithSelector(someMarket.accrualBlockNumber.selector);\n bytes[] memory results = someMarket.multicall(\n asArray(blockNumberBeforeCall, accrueInterestCall, blockNumberAfterCall)\n );\n uint256 blockNumberBefore = abi.decode(results[0], (uint256));\n uint256 blockNumberAfter = abi.decode(results[2], (uint256));\n\n assertGt(blockNumberAfter, blockNumberBefore, \"did not accrue?\");\n }\n\n function testBscExistingCTokenExtensionUpgrade() public fork(BSC_MAINNET) {\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\n }\n\n function testArbitrumExistingCTokenExtensionUpgrade() public fork(ARBITRUM_ONE) {\n _testAllPoolsAllMarketsCTokenExtensionUpgrade();\n }\n\n function _testAllPoolsAllMarketsCTokenExtensionUpgrade() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n _testPoolAllMarketsExtensionUpgrade(pools[i].comptroller);\n }\n }\n\n function _testPoolAllMarketsExtensionUpgrade(address poolAddress) internal {\n ComptrollerFirstExtension somePool = ComptrollerFirstExtension(poolAddress);\n\n ICErc20[] memory markets = somePool.getAllMarkets();\n\n if (markets.length == 0) return;\n\n for (uint256 j = 0; j < markets.length; j++) {\n ICErc20 someMarket = markets[j];\n CErc20Delegator asDelegator = CErc20Delegator(address(someMarket));\n\n emit log(\"pool\");\n emit log_address(address(somePool));\n emit log(\"market\");\n emit log_address(address(someMarket));\n\n try this._testExistingCTokenExtensionUpgrade(asDelegator) {} catch Error(string memory reason) {\n address plugin = address(CErc20PluginDelegate(address(asDelegator)).plugin());\n emit log(\"plugin\");\n emit log_address(plugin);\n\n address latestPlugin = ffd.latestPluginImplementation(plugin);\n emit log(\"latest plugin impl\");\n emit log_address(latestPlugin);\n\n revert(reason);\n }\n }\n }\n\n function _testExistingCTokenExtensionUpgrade(CErc20Delegator asDelegator) public {\n uint256 totalSupplyBefore = asDelegator.totalSupply();\n if (totalSupplyBefore == 0) return; // total supply should be non-zero\n\n // TODO\n _upgradeMarket(ICErc20(address(asDelegator)));\n\n // check if the extension was added\n address[] memory extensions = asDelegator._listExtensions();\n assertEq(extensions.length, 1, \"the first extension should be added\");\n assertEq(extensions[0], address(newCTokenExtension), \"the first extension should be the only extension\");\n\n // check if the storage is read from the same place\n uint256 totalSupplyAfter = asDelegator.totalSupply();\n assertGt(totalSupplyAfter, 0, \"total supply should be non-zero\");\n assertEq(totalSupplyAfter, totalSupplyBefore, \"total supply should be the same\");\n }\n\n function testBscComptrollerExtensions() public debuggingOnly fork(BSC_MAINNET) {\n _testComptrollersExtensions();\n }\n\n function testPolygonComptrollerExtensions() public debuggingOnly fork(POLYGON_MAINNET) {\n _testComptrollersExtensions();\n }\n\n function testChapelComptrollerExtensions() public debuggingOnly fork(BSC_CHAPEL) {\n _testComptrollersExtensions();\n }\n\n function testArbitrumComptrollerExtensions() public debuggingOnly fork(ARBITRUM_ONE) {\n _testComptrollersExtensions();\n }\n\n function _testComptrollersExtensions() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n address payable asPayable = payable(pools[i].comptroller);\n DiamondBase asBase = DiamondBase(asPayable);\n address[] memory extensions = asBase._listExtensions();\n assertEq(extensions.length, 1, \"each pool should have the first extension\");\n }\n }\n\n function testBulkAutoUpgrade() public debuggingOnly fork(POLYGON_MAINNET) {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n vm.prank(ffd.owner());\n ffd.autoUpgradePool(IonicComptroller(pools[i].comptroller));\n }\n }\n\n function testPolygonTotalUnderlyingSupplied() public debuggingOnly fork(POLYGON_MAINNET) {\n _testTotalUnderlyingSupplied();\n }\n\n function testBscTotalUnderlyingSupplied() public debuggingOnly fork(BSC_MAINNET) {\n _testTotalUnderlyingSupplied();\n }\n\n function _testTotalUnderlyingSupplied() internal {\n PoolDirectory fpd = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n\n (, PoolDirectory.Pool[] memory pools) = fpd.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n // if (pools[i].comptroller == 0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459) continue;\n // if (pools[i].comptroller == 0xD265ff7e5487E9DD556a4BB900ccA6D087Eb3AD2) continue;\n ComptrollerFirstExtension poolExt = ComptrollerFirstExtension(pools[i].comptroller);\n\n ICErc20[] memory markets = poolExt.getAllMarkets();\n for (uint8 k = 0; k < markets.length; k++) {\n CErc20Delegate market = CErc20Delegate(address(markets[k]));\n // emit log(market.contractType());\n // emit log_named_address(\"impl\", market.implementation());\n CTokenFirstExtension marketAsExt = CTokenFirstExtension(address(markets[k]));\n marketAsExt.getTotalUnderlyingSupplied();\n }\n }\n }\n\n function testDelegateType() public debuggingOnly fork(POLYGON_MAINNET) {\n emit log(CErc20Delegate(0x587906620D627fe75C4d1288C6A584089780959c).contractType());\n }\n}\n" + }, + "contracts/test/GlobalPauser.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport \"./config/BaseTest.t.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { IComptroller } from \"../external/compound/IComptroller.sol\";\nimport { GlobalPauser } from \"../GlobalPauser.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport \"forge-std/console.sol\";\n\ncontract GlobalPauserTest is BaseTest {\n address public poolDirectory = 0x39C353Cf9041CcF467A04d0e78B63d961E81458a;\n address public pauseGuardian = 0xD9677b0eeafdCe6BF322d9774Bb65B1f42cF0404;\n address public multisig = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2;\n GlobalPauser public pauser; // = GlobalPauser(0xe646D8Be18e545244C5E79F121202f75FA3880c8);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n pauser = new GlobalPauser(poolDirectory);\n pauser.setPauseGuardian(pauseGuardian, true);\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(poolDirectory).getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n vm.prank(IonicComptroller(pools[i].comptroller).admin());\n IonicComptroller(pools[i].comptroller)._setPauseGuardian(address(pauser));\n }\n }\n\n function testPauseNotGuardian(address sender) public debuggingOnly forkAtBlock(MODE_MAINNET, 9269895) {\n vm.assume(sender != pauseGuardian);\n vm.expectRevert(bytes(\"!guardian\"));\n pauser.pauseAll();\n }\n\n function testPauseAll() public debuggingOnly forkAtBlock(MODE_MAINNET, 9269895) {\n (, PoolDirectory.Pool[] memory pools) = PoolDirectory(poolDirectory).getActivePools();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n assertEq(isPaused, false);\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n assertEq(isPaused, false);\n }\n }\n vm.prank(pauseGuardian);\n pauser.pauseAll();\n for (uint256 i = 0; i < pools.length; i++) {\n ICErc20[] memory markets = IonicComptroller(pools[i].comptroller).getAllMarkets();\n for (uint256 j = 0; j < markets.length; j++) {\n bool isPaused = IonicComptroller(pools[i].comptroller).borrowGuardianPaused(address(markets[j]));\n assertEq(isPaused, true);\n isPaused = IonicComptroller(pools[i].comptroller).mintGuardianPaused(address(markets[j]));\n assertEq(isPaused, true);\n }\n }\n }\n}\n" + }, + "contracts/test/helpers/WithPool.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.4.23;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\n\nimport { JumpRateModel } from \"../../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { Comptroller } from \"../../compound/Comptroller.sol\";\nimport { CErc20PluginDelegate } from \"../../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20Delegate } from \"../../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../../compound/CErc20Delegator.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { InterestRateModel } from \"../../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../../PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { ERC4626 } from \"solmate/mixins/ERC4626.sol\";\nimport { PoolLens } from \"../../PoolLens.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../../compound/ComptrollerFirstExtension.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract WithPool is BaseTest {\n ERC20Upgradeable public underlyingToken;\n CErc20Delegate cErc20Delegate;\n CErc20PluginDelegate cErc20PluginDelegate;\n CErc20PluginRewardsDelegate cErc20PluginRewardsDelegate;\n\n IonicComptroller comptroller;\n Comptroller newComptroller;\n JumpRateModel interestModel;\n\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n MasterPriceOracle priceOracle;\n PoolLens poolLens;\n\n address[] markets;\n bool[] t;\n bool[] f;\n address[] newImplementation;\n address[] hardcodedAddresses;\n string[] hardcodedNames;\n\n function setUpWithPool(MasterPriceOracle _masterPriceOracle, ERC20Upgradeable _underlyingToken) public {\n priceOracle = _masterPriceOracle;\n underlyingToken = _underlyingToken;\n\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n if (address(ionicAdmin) != address(0)) {\n // upgrade\n {\n FeeDistributor newImpl = new FeeDistributor();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(ionicAdmin)));\n bytes32 bytesAtSlot = vm.load(\n address(proxy),\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\n );\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n } else {\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1e16);\n }\n\n {\n vm.prank(ionicAdmin.owner());\n ionicAdmin._setPendingOwner(address(this));\n ionicAdmin._acceptOwner();\n }\n setUpBaseContracts();\n setUpExtensions();\n }\n\n function setUpExtensions() internal {\n cErc20Delegate = new CErc20Delegate();\n cErc20PluginDelegate = new CErc20PluginDelegate();\n cErc20PluginRewardsDelegate = new CErc20PluginRewardsDelegate();\n\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), \"\");\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginDelegate.delegateType(),\n address(cErc20PluginDelegate),\n abi.encode(address(0))\n );\n ionicAdmin._setLatestCErc20Delegate(\n cErc20PluginRewardsDelegate.delegateType(),\n address(cErc20PluginRewardsDelegate),\n abi.encode(address(0))\n );\n\n cErc20DelegateExtensions[1] = cErc20Delegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n cErc20DelegateExtensions[1] = cErc20PluginDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginDelegate), cErc20DelegateExtensions);\n cErc20DelegateExtensions[1] = cErc20PluginRewardsDelegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20PluginRewardsDelegate), cErc20DelegateExtensions);\n }\n\n function setUpBaseContracts() internal {\n interestModel = new JumpRateModel(2343665, 1e18, 1e18, 4e18, 0.8e18);\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n\n poolLens = new PoolLens();\n poolLens.initialize(\n poolDirectory,\n \"Pool\",\n \"lens\",\n hardcodedAddresses,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames,\n hardcodedNames\n );\n }\n\n function setUpPool(\n string memory name,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive\n ) public {\n Comptroller newComptrollerImplementation = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(newComptrollerImplementation));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = newComptrollerImplementation;\n ionicAdmin._setComptrollerExtensions(address(newComptrollerImplementation), extensions);\n\n (, address comptrollerAddress) = poolDirectory.deployPool(\n name,\n address(newComptrollerImplementation),\n abi.encode(payable(address(ionicAdmin))),\n enforceWhitelist,\n closeFactor,\n liquidationIncentive,\n address(priceOracle)\n );\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, address(this), poolAuth.BORROWER_ROLE(), true);\n }\n\n function upgradePool(address pool) internal {\n Comptroller newComptrollerImplementation = new Comptroller();\n\n Unitroller asUnitroller = Unitroller(payable(pool));\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(\n newComptrollerImplementation,\n DiamondExtension(asUnitroller.comptrollerImplementation())\n );\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function deployCErc20Delegate(\n address _underlyingToken,\n bytes memory name,\n bytes memory symbol,\n uint256 _collateralFactorMantissa\n ) public {\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n _underlyingToken,\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n name,\n symbol,\n uint256(1),\n uint256(0)\n ),\n \"\",\n _collateralFactorMantissa\n );\n }\n\n function deployCErc20PluginDelegate(address _erc4626, uint256 _collateralFactorMantissa) public {\n comptroller._deployMarket(\n cErc20PluginDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(_erc4626),\n _collateralFactorMantissa\n );\n }\n\n function deployCErc20PluginRewardsDelegate(address _mockERC4626Dynamic, uint256 _collateralFactorMantissa) public {\n comptroller._deployMarket(\n cErc20PluginRewardsDelegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"cUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n abi.encode(_mockERC4626Dynamic),\n _collateralFactorMantissa\n );\n }\n}\n" + }, + "contracts/test/irm/AdjustableJumpRateModelTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { AdjustableJumpRateModel, InterestRateModelParams } from \"../../ionic/irms/AdjustableJumpRateModel.sol\";\n\ncontract InterestRateModelTest is BaseTest {\n AdjustableJumpRateModel adjustableJumpRateModel;\n InterestRateModelParams params;\n InterestRateModelParams newParams;\n\n function setUp() public {\n params = InterestRateModelParams({\n blocksPerYear: 10512000,\n baseRatePerYear: 0.5e16,\n multiplierPerYear: 0.18e18,\n jumpMultiplierPerYear: 4e18,\n kink: 0.8e18\n });\n adjustableJumpRateModel = new AdjustableJumpRateModel(params);\n }\n\n function testUpdateJrmParams() public {\n assertEq(adjustableJumpRateModel.blocksPerYear(), params.blocksPerYear);\n assertEq(adjustableJumpRateModel.baseRatePerBlock(), params.baseRatePerYear / params.blocksPerYear);\n\n newParams = InterestRateModelParams({\n blocksPerYear: 512000,\n baseRatePerYear: 0.7e16,\n multiplierPerYear: 0.18e18,\n jumpMultiplierPerYear: 4e18,\n kink: 0.8e18\n });\n\n adjustableJumpRateModel._setIrmParameters(newParams);\n vm.roll(1);\n\n assertEq(adjustableJumpRateModel.blocksPerYear(), newParams.blocksPerYear);\n assertEq(adjustableJumpRateModel.baseRatePerBlock(), newParams.baseRatePerYear / newParams.blocksPerYear);\n }\n}\n" + }, + "contracts/test/irm/PrudentiaIrmTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport { IRateComputer } from \"adrastia-periphery/rates/IRateComputer.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\nimport { PrudentiaInterestRateModel } from \"../../ionic/irms/PrudentiaInterestRateModel.sol\";\n\ncontract MockRateComputer is IRateComputer {\n mapping(address => uint64) public rates;\n\n function computeRate(address token) external view override returns (uint64) {\n return rates[token];\n }\n\n function setRate(address token, uint64 rate) public {\n rates[token] = rate;\n }\n}\n\ncontract PrudentiaIrmTest is BaseTest {\n using Math for uint64;\n\n MockRateComputer rateComputer;\n address token;\n PrudentiaInterestRateModel irm;\n uint256 blocksPerYear;\n\n function setUp() public {\n rateComputer = new MockRateComputer();\n token = address(0x1);\n blocksPerYear = 10512000;\n irm = new PrudentiaInterestRateModel(blocksPerYear, token, rateComputer);\n }\n\n function test_utilizationRate_zeroTotal() public {\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 0);\n }\n\n function test_utilizationRate_zero() public {\n uint256 cash = 100;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 0);\n }\n\n function test_utilizationRate_50() public {\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 5e17);\n }\n\n function test_utilizationRate_100() public {\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.utilizationRate(cash, borrows, reserves), 1e18);\n }\n\n function test_getBorrowRate_100_a() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_100_b() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_50() public {\n uint64 rate = 5e17;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_1() public {\n uint64 rate = 1e16;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_0() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getBorrowRate_1mantissa() public {\n uint64 rate = 1;\n rateComputer.setRate(token, rate);\n\n // These should have no effect\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n\n assertEq(irm.getBorrowRate(cash, borrows, reserves), 1); // Rounds up to 1. We don't want to return 0.\n }\n\n function test_getSupplyRate_100_100util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), rate.ceilDiv(blocksPerYear));\n }\n\n function test_getSupplyRate_100_50util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), rate.ceilDiv(blocksPerYear) / 2);\n }\n\n function test_getSupplyRate_100_1util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 99;\n uint256 borrows = 1;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), rate.ceilDiv(blocksPerYear) / 100);\n }\n\n function test_getSupplyRate_100_0util() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 0;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_0util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 0;\n uint256 borrows = 0;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_100util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 0;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_50util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 50;\n uint256 borrows = 50;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_0_1util() public {\n uint64 rate = 0;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 99;\n uint256 borrows = 1;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 0;\n\n assertEq(irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa), 0);\n }\n\n function test_getSupplyRate_100_50util_10rf() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 0;\n uint256 reserveFactorMantissa = 1e17;\n\n assertEq(\n irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa),\n (uint256(rate.ceilDiv(blocksPerYear) / 2) * (1e18 - reserveFactorMantissa)) / 1e18\n );\n }\n\n function test_getSupplyRate_100_50util_10rf_10reserves() public {\n uint64 rate = 1e18;\n rateComputer.setRate(token, rate);\n\n uint256 cash = 100;\n uint256 borrows = 100;\n uint256 reserves = 10;\n cash += reserves;\n uint256 reserveFactorMantissa = 1e17;\n\n assertEq(\n irm.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa),\n (uint256(rate.ceilDiv(blocksPerYear) / 2) * (1e18 - reserveFactorMantissa)) / 1e18\n );\n }\n}\n" + }, + "contracts/test/LatestImplementationWhitelisted.t.sol": { + "content": "pragma solidity ^0.8.0;\n\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IERC4626 } from \"../compound/IERC4626.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract LatestImplementationWhitelisted is BaseTest {\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n address[] poolsImplementationsSet;\n address[] marketsImplementationsSet;\n address[] pluginsSet;\n\n function testBscImplementations() public fork(BSC_MAINNET) {\n testPoolImplementations();\n testMarketImplementations();\n testPluginImplementations();\n }\n\n function testPolygonImplementations() public fork(POLYGON_MAINNET) {\n testPoolImplementations();\n testMarketImplementations();\n testPluginImplementations();\n }\n\n function afterForkSetUp() internal override {\n poolDirectory = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n ionicAdmin = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n }\n\n function testPoolImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n address implementation = comptroller.comptrollerImplementation();\n\n bool added = false;\n for (uint8 k = 0; k < poolsImplementationsSet.length; k++) {\n if (poolsImplementationsSet[k] == implementation) {\n added = true;\n }\n }\n\n if (!added) poolsImplementationsSet.push(implementation);\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < poolsImplementationsSet.length; k++) {\n emit log_address(poolsImplementationsSet[k]);\n\n address latestImpl = ionicAdmin.latestComptrollerImplementation(poolsImplementationsSet[k]);\n assertTrue(poolsImplementationsSet[k] == latestImpl, \"some pool is not upgraded the latest impl\");\n }\n }\n\n function testMarketImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n ICErc20 market = markets[j];\n address implementation = market.implementation();\n\n bool added = false;\n for (uint8 k = 0; k < marketsImplementationsSet.length; k++) {\n if (marketsImplementationsSet[k] == implementation) {\n added = true;\n }\n }\n\n if (!added) marketsImplementationsSet.push(implementation);\n }\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < marketsImplementationsSet.length; k++) {\n emit log_address(marketsImplementationsSet[k]);\n (address latestCErc20Delegate, bytes memory becomeImplementationData) = ionicAdmin.latestCErc20Delegate(\n CErc20Delegate(marketsImplementationsSet[k]).delegateType()\n );\n\n assertTrue(marketsImplementationsSet[k] == latestCErc20Delegate, \"some markets need to be upgraded\");\n }\n }\n\n function testPluginImplementations() internal {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(payable(pools[i].comptroller));\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n CErc20PluginDelegate delegate = CErc20PluginDelegate(address(markets[j]));\n\n address plugin;\n try delegate.plugin() returns (IERC4626 _plugin) {\n plugin = address(_plugin);\n } catch {\n continue;\n }\n\n bool added = false;\n for (uint8 k = 0; k < pluginsSet.length; k++) {\n if (pluginsSet[k] == plugin) {\n added = true;\n }\n }\n\n if (!added) pluginsSet.push(plugin);\n }\n }\n\n emit log(\"listing the set\");\n for (uint8 k = 0; k < pluginsSet.length; k++) {\n address latestPluginImpl = ionicAdmin.latestPluginImplementation(pluginsSet[k]);\n\n emit log_address(pluginsSet[k]);\n\n assertTrue(pluginsSet[k] == latestPluginImpl, \"some plugin is not upgraded to the latest impl\");\n }\n }\n}\n" + }, + "contracts/test/LeveredPositionTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest, BaseTest } from \"./config/MarketsTest.t.sol\";\nimport { DiamondBase, DiamondExtension } from \"../ionic/DiamondExtension.sol\";\n\nimport { LeveredPosition } from \"../ionic/levered/LeveredPosition.sol\";\nimport { LeveredPositionFactory, IFeeDistributor } from \"../ionic/levered/LeveredPositionFactory.sol\";\nimport { AlgebraSwapLiquidator } from \"../liquidators/AlgebraSwapLiquidator.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { AerodromeCLLiquidator } from \"../liquidators/AerodromeCLLiquidator.sol\";\nimport { AerodromeV2Liquidator } from \"../liquidators/AerodromeV2Liquidator.sol\";\n\nimport { LeveredPositionFactoryFirstExtension } from \"../ionic/levered/LeveredPositionFactoryFirstExtension.sol\";\nimport { LeveredPositionFactorySecondExtension } from \"../ionic/levered/LeveredPositionFactorySecondExtension.sol\";\nimport { ILeveredPositionFactory } from \"../ionic/levered/ILeveredPositionFactory.sol\";\nimport { LeveredPositionsLens } from \"../ionic/levered/LeveredPositionsLens.sol\";\nimport { LiquidatorsRegistry } from \"../liquidators/registry/LiquidatorsRegistry.sol\";\nimport { LiquidatorsRegistryExtension } from \"../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { SafeOwnable } from \"../ionic/SafeOwnable.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ncontract LeveredPositionLensTest is BaseTest {\n LeveredPositionsLens lens;\n ILeveredPositionFactory factory;\n\n function afterForkSetUp() internal override {\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n emit log_named_address(\"factory\", address(factory));\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n // lens = new LeveredPositionsLens();\n // lens.initialize(factory);\n }\n\n function testLPLens() public debuggingOnly fork(BSC_CHAPEL) {\n _testLPLens();\n }\n\n function _testLPLens() internal {\n address[] memory positions;\n bool[] memory closed;\n (positions, closed) = factory.getPositionsByAccount(0xb6c11605e971ab46B9BE4fDC48C9650A257075db);\n\n // address[] memory accounts = factory.getAccountsWithOpenPositions();\n // for (uint256 i = 0; i < accounts.length; i++) {\n // (positions, closed) = factory.getPositionsByAccount(accounts[i]);\n // if (positions.length > 0) break;\n // }\n\n uint256[] memory apys = new uint256[](positions.length);\n LeveredPosition[] memory pos = new LeveredPosition[](positions.length);\n for (uint256 j = 0; j < positions.length; j++) {\n apys[j] = 1e17;\n\n if (address(0) == positions[j]) revert(\"zero pos address\");\n pos[j] = LeveredPosition(positions[j]);\n }\n\n LeveredPositionsLens.PositionInfo[] memory infos = lens.getPositionsInfo(pos, apys);\n\n for (uint256 k = 0; k < infos.length; k++) {\n emit log_named_address(\"address\", address(pos[k]));\n emit log_named_uint(\"positionSupplyAmount\", infos[k].positionSupplyAmount);\n emit log_named_uint(\"positionValue\", infos[k].positionValue);\n emit log_named_uint(\"debtAmount\", infos[k].debtAmount);\n emit log_named_uint(\"debtValue\", infos[k].debtValue);\n emit log_named_uint(\"equityValue\", infos[k].equityValue);\n emit log_named_uint(\"equityAmount\", infos[k].equityAmount);\n emit log_named_int(\"currentApy\", infos[k].currentApy);\n emit log_named_uint(\"debtRatio\", infos[k].debtRatio);\n emit log_named_uint(\"liquidationThreshold\", infos[k].liquidationThreshold);\n emit log_named_uint(\"safetyBuffer\", infos[k].safetyBuffer);\n\n emit log(\"\");\n }\n }\n\n function testPrintLeveredPositions() public debuggingOnly fork(POLYGON_MAINNET) {\n address[] memory accounts = factory.getAccountsWithOpenPositions();\n\n emit log_named_array(\"accounts\", accounts);\n\n for (uint256 j = 0; j < accounts.length; j++) {\n address[] memory positions;\n bool[] memory closed;\n (positions, closed) = factory.getPositionsByAccount(accounts[j]);\n emit log_named_array(\"positions\", positions);\n //emit log_named_array(\"closed\", closed);\n }\n }\n\n function testScenarioLeverageFailed() public debuggingOnly forkAtBlock(MODE_MAINNET, 10672173) {\n address USER = 0x95Ce459B20586cf44ee6d295C4f28e1a134CF529;\n // IERC20Upgradeable(0x4200000000000000000000000000000000000006).approve(\n // address(factory),\n // 100000 ether\n // );\n vm.prank(ap.owner());\n ap.setAddress(\"IUniswapV2Router02\", 0x3a63171DD9BebF4D07BC782FECC7eb0b890C2A45);\n vm.startPrank(USER);\n LeveredPosition position = factory.createAndFundPositionAtRatio(\n ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),\n IERC20Upgradeable(0x4200000000000000000000000000000000000006),\n 16754252276537996590,\n 3000000000000000000\n );\n emit log_named_address(\"position\", address(position));\n\n // vm.stopPrank();\n // ILiquidatorsRegistry registry = factory.liquidatorsRegistry();\n // vm.startPrank(registry.owner());\n // registry._setRedemptionStrategy(\n // new UniswapV3LiquidatorFunder(),\n // IERC20Upgradeable(0xd988097fb8612cc24eeC14542bC03424c656005f),\n // IERC20Upgradeable(0x4200000000000000000000000000000000000006)\n // );\n // vm.stopPrank();\n // vm.startPrank(USER);\n\n vm.roll(10673509);\n position.adjustLeverageRatio(3000000000000000000);\n\n // vm.roll(10852409);\n // position.adjustLeverageRatio(3000000000000000000);\n\n // vm.roll(11268772);\n // position.adjustLeverageRatio(3000000000000000000);\n vm.stopPrank();\n }\n}\n\ncontract LeveredPositionFactoryTest is BaseTest {\n ILeveredPositionFactory factory;\n LeveredPositionsLens lens;\n\n function afterForkSetUp() internal override {\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function testChapelNetApy() public debuggingOnly fork(BSC_CHAPEL) {\n ICErc20 _stableMarket = ICErc20(address(1)); // DAI\n\n uint256 borrowRate = 5.2e16; // 5.2%\n vm.mockCall(\n address(_stableMarket),\n abi.encodeWithSelector(_stableMarket.borrowRatePerBlock.selector),\n abi.encode(borrowRate / factory.blocksPerYear())\n );\n\n uint256 _borrowRate = _stableMarket.borrowRatePerBlock() * factory.blocksPerYear();\n emit log_named_uint(\"_borrowRate\", _borrowRate);\n\n int256 netApy = lens.getNetAPY(\n 2.7e16, // 2.7%\n 1e18, // supply amount\n ICErc20(address(0)), // BOMB\n _stableMarket,\n 2e18 // ratio\n );\n\n emit log_named_int(\"net apy\", netApy);\n\n // boosted APY = 2x 2.7% = 5.4 % of the equity\n // borrow APR = 5.2%\n // diff = 5.4 - 5.2 = 0.2%\n assertApproxEqRel(netApy, 0.2e16, 1e12, \"!net apy\");\n }\n}\n\nabstract contract LeveredPositionTest is MarketsTest {\n ICErc20 collateralMarket;\n ICErc20 stableMarket;\n ILeveredPositionFactory factory;\n ILiquidatorsRegistry registry;\n LeveredPosition position;\n LeveredPositionsLens lens;\n\n uint256 minLevRatio;\n uint256 maxLevRatio;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n\n factory = ILeveredPositionFactory(ap.getAddress(\"LeveredPositionFactory\"));\n registry = factory.liquidatorsRegistry();\n {\n // upgrade the registry\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n\n vm.startPrank(registry.owner());\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory oldExts = asBase._listExtensions();\n\n if (oldExts.length == 1) {\n asBase._registerExtension(newExt1, DiamondExtension(oldExts[0]));\n asBase._registerExtension(newExt2, DiamondExtension(address(0)));\n } else if (oldExts.length == 2) {\n asBase._registerExtension(newExt1, DiamondExtension(oldExts[0]));\n asBase._registerExtension(newExt2, DiamondExtension(oldExts[1]));\n }\n vm.stopPrank();\n }\n\n lens = LeveredPositionsLens(ap.getAddress(\"LeveredPositionsLens\"));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function upgradePoolAndMarkets() internal {\n _upgradeExistingPool(address(collateralMarket.comptroller()));\n _upgradeMarket(collateralMarket);\n _upgradeMarket(stableMarket);\n }\n\n function _unpauseMarkets(address collat, address stable) internal {\n ComptrollerFirstExtension asExtension = ComptrollerFirstExtension(address(ICErc20(stable).comptroller()));\n vm.startPrank(asExtension.admin());\n asExtension._setMintPaused(ICErc20(collat), false);\n asExtension._setMintPaused(ICErc20(stable), false);\n asExtension._setBorrowPaused(ICErc20(stable), false);\n vm.stopPrank();\n }\n\n function _configurePairAndLiquidator(address _collat, address _stable, IRedemptionStrategy _liquidator) internal {\n _configurePair(_collat, _stable);\n _configureTwoWayLiquidator(_collat, _stable, _liquidator);\n }\n\n function _configurePair(address _collat, address _stable) internal {\n collateralMarket = ICErc20(_collat);\n stableMarket = ICErc20(_stable);\n\n //upgradePoolAndMarkets();\n //_unpauseMarkets(_collat, _stable);\n vm.prank(factory.owner());\n factory._setPairWhitelisted(collateralMarket, stableMarket, true);\n }\n\n function _whitelistTestUser(address user) internal {\n address pool = address(collateralMarket.comptroller());\n PoolRolesAuthority pra = ffd.authoritiesRegistry().poolsAuthorities(pool);\n\n vm.startPrank(pra.owner());\n pra.setUserRole(user, pra.BORROWER_ROLE(), true);\n vm.stopPrank();\n }\n\n function _configureTwoWayLiquidator(\n address inputMarket,\n address outputMarket,\n IRedemptionStrategy strategy\n ) internal {\n IERC20Upgradeable inputToken = underlying(inputMarket);\n IERC20Upgradeable outputToken = underlying(outputMarket);\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategy(strategy, inputToken, outputToken);\n registry._setRedemptionStrategy(strategy, outputToken, inputToken);\n vm.stopPrank();\n }\n\n function underlying(address market) internal view returns (IERC20Upgradeable) {\n return IERC20Upgradeable(ICErc20(market).underlying());\n }\n\n struct Liquidator {\n IERC20Upgradeable inputToken;\n IERC20Upgradeable outputToken;\n IRedemptionStrategy strategy;\n }\n\n function _configureMultipleLiquidators(Liquidator[] memory liquidators) internal {\n IRedemptionStrategy[] memory strategies = new IRedemptionStrategy[](liquidators.length);\n IERC20Upgradeable[] memory inputTokens = new IERC20Upgradeable[](liquidators.length);\n IERC20Upgradeable[] memory outputTokens = new IERC20Upgradeable[](liquidators.length);\n for (uint256 i = 0; i < liquidators.length; i++) {\n strategies[i] = liquidators[i].strategy;\n inputTokens[i] = liquidators[i].inputToken;\n outputTokens[i] = liquidators[i].outputToken;\n }\n vm.startPrank(registry.owner());\n registry._setRedemptionStrategies(strategies, inputTokens, outputTokens);\n vm.stopPrank();\n }\n\n function _fundMarketAndSelf(ICErc20 market, address whale) internal {\n IERC20Upgradeable token = IERC20Upgradeable(market.underlying());\n\n if (whale == address(0)) {\n whale = address(911);\n //vm.deal(address(token), whale, 100e18);\n }\n\n uint256 allTokens = token.balanceOf(whale);\n vm.prank(whale);\n token.transfer(address(this), allTokens / 20);\n\n if (market.getCash() < allTokens / 2) {\n _whitelistTestUser(whale);\n vm.startPrank(whale);\n token.approve(address(market), allTokens / 2);\n market.mint(allTokens / 2);\n vm.stopPrank();\n }\n }\n\n function _openLeveredPosition(\n address _positionOwner,\n uint256 _depositAmount\n ) internal returns (LeveredPosition _position, uint256 _maxRatio, uint256 _minRatio) {\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n collateralToken.transfer(_positionOwner, _depositAmount);\n\n vm.startPrank(_positionOwner);\n collateralToken.approve(address(factory), _depositAmount);\n _position = factory.createAndFundPosition(collateralMarket, stableMarket, collateralToken, _depositAmount);\n vm.stopPrank();\n\n _maxRatio = _position.getMaxLeverageRatio();\n emit log_named_uint(\"max ratio\", _maxRatio);\n _minRatio = _position.getMinLeverageRatio();\n emit log_named_uint(\"min ratio\", _minRatio);\n\n assertGt(_maxRatio, _minRatio, \"max ratio <= min ratio\");\n }\n\n function testOpenLeveredPosition() public virtual whenForking {\n assertApproxEqRel(position.getCurrentLeverageRatio(), 1e18, 4e16, \"initial leverage ratio should be 1.0 (1e18)\");\n }\n\n function testAnyLeverageRatio(uint64 ratioDiff) public debuggingOnly whenForking {\n // ratioDiff is between 0 and 2^64 ~= 18.446e18\n uint256 targetLeverageRatio = 1e18 + uint256(ratioDiff);\n emit log_named_uint(\"fuzz max ratio\", maxLevRatio);\n emit log_named_uint(\"fuzz min ratio\", minLevRatio);\n emit log_named_uint(\"target ratio\", targetLeverageRatio);\n vm.assume(targetLeverageRatio < maxLevRatio);\n vm.assume(minLevRatio < targetLeverageRatio);\n\n uint256 borrowedAssetPrice = stableMarket.comptroller().oracle().getUnderlyingPrice(stableMarket);\n (uint256 sd, uint256 bd) = position.getSupplyAmountDelta(targetLeverageRatio);\n emit log_named_uint(\"borrows delta val\", (bd * borrowedAssetPrice) / 1e18);\n emit log_named_uint(\"min borrow value\", ffd.getMinBorrowEth(stableMarket));\n\n uint256 equityAmount = position.getEquityAmount();\n emit log_named_uint(\"equity amount\", equityAmount);\n\n uint256 currentLeverageRatio = position.getCurrentLeverageRatio();\n emit log_named_uint(\"current ratio\", currentLeverageRatio);\n\n uint256 leverageRatioRealized = position.adjustLeverageRatio(targetLeverageRatio);\n emit log_named_uint(\"equity amount\", position.getEquityAmount());\n assertApproxEqRel(leverageRatioRealized, targetLeverageRatio, 4e16, \"target ratio not matching\");\n }\n\n function testMinMaxLeverageRatio() public whenForking {\n assertGt(maxLevRatio, minLevRatio, \"max ratio <= min ratio\");\n\n // attempting to adjust to minLevRatio - 0.01 should fail\n vm.expectRevert(abi.encodeWithSelector(LeveredPosition.BorrowStableFailed.selector, 0x3fa));\n position.adjustLeverageRatio((minLevRatio + 1e18) / 2);\n // just testing\n position.adjustLeverageRatio(maxLevRatio);\n // but adjusting to the minLevRatio + 0.01 should succeed\n position.adjustLeverageRatio(minLevRatio + 0.01e18);\n }\n\n function testMaxLeverageRatio() public whenForking {\n uint256 _equityAmount = position.getEquityAmount();\n uint256 rate = lens.getBorrowRateAtRatio(collateralMarket, stableMarket, _equityAmount, maxLevRatio);\n emit log_named_uint(\"borrow rate at max ratio\", rate);\n\n position.adjustLeverageRatio(maxLevRatio);\n assertApproxEqRel(position.getCurrentLeverageRatio(), maxLevRatio, 4e16, \"target max ratio not matching\");\n }\n\n function testRewardsAccruedClaimed() public whenForking {\n address[] memory flywheels = position.pool().getRewardsDistributors();\n if (flywheels.length > 0) {\n vm.warp(block.timestamp + 60 * 60 * 24);\n vm.roll(block.number + 10000);\n\n (ERC20[] memory rewardTokens, uint256[] memory amounts) = position.getAccruedRewards();\n\n ERC20 rewardToken;\n bool atLeastOneAccrued = false;\n for (uint256 i = 0; i < amounts.length; i++) {\n atLeastOneAccrued = amounts[i] > 0;\n if (atLeastOneAccrued) {\n rewardToken = rewardTokens[i];\n emit log_named_address(\"accrued from reward token\", address(rewardTokens[i]));\n break;\n }\n }\n\n assertEq(atLeastOneAccrued, true, \"!should have accrued at least one reward token\");\n\n if (atLeastOneAccrued) {\n uint256 rewardsBalanceBefore = rewardToken.balanceOf(address(this));\n position.claimRewards();\n uint256 rewardsBalanceAfter = rewardToken.balanceOf(address(this));\n assertGt(rewardsBalanceAfter - rewardsBalanceBefore, 0, \"should have claimed some rewards\");\n }\n } else {\n emit log(\"no flywheels/rewards for the pair pool\");\n }\n }\n\n function testLeverMaxDown() public whenForking {\n IERC20Upgradeable stableAsset = IERC20Upgradeable(stableMarket.underlying());\n IERC20Upgradeable collateralAsset = IERC20Upgradeable(collateralMarket.underlying());\n uint256 startingEquity = position.getEquityAmount();\n\n uint256 leverageRatioRealized = position.adjustLeverageRatio(maxLevRatio);\n assertApproxEqRel(leverageRatioRealized, maxLevRatio, 4e16, \"target ratio not matching\");\n\n // decrease the ratio in 10 equal steps\n uint256 ratioDiffStep = (maxLevRatio - 1e18) / 9;\n while (leverageRatioRealized > 1e18) {\n uint256 targetLeverDownRatio = leverageRatioRealized - ratioDiffStep;\n if (targetLeverDownRatio < minLevRatio) targetLeverDownRatio = 1e18;\n leverageRatioRealized = position.adjustLeverageRatio(targetLeverDownRatio);\n assertApproxEqRel(leverageRatioRealized, targetLeverDownRatio, 3e16, \"target lever down ratio not matching\");\n }\n\n uint256 withdrawAmount = position.closePosition();\n emit log_named_uint(\"withdraw amount\", withdrawAmount);\n assertApproxEqRel(startingEquity, withdrawAmount, 5e16, \"!withdraw amount\");\n\n assertEq(position.getEquityAmount(), 0, \"!nonzero equity amount\");\n assertEq(position.getCurrentLeverageRatio(), 0, \"!nonzero leverage ratio\");\n }\n}\n\ncontract WmaticMaticXLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 500e18;\n\n address wmaticMarket = 0xCb8D7c2690536d3444Da3d207f62A939483c8A93;\n address maticxMarket = 0x6ebdbEe1a509247B4A3ac3b73a43bd434C52C7c2;\n address wmaticWhale = 0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97;\n address maticxWhale = 0x72f0275444F2aF8dBf13F78D54A8D3aD7b6E68db;\n\n _configurePair(wmaticMarket, maticxMarket);\n _fundMarketAndSelf(ICErc20(wmaticMarket), wmaticWhale);\n _fundMarketAndSelf(ICErc20(maticxMarket), maticxWhale);\n\n // call amountOutAndSlippageOfSwap to cache the slippage\n {\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n IERC20Upgradeable stableToken = IERC20Upgradeable(stableMarket.underlying());\n\n vm.startPrank(wmaticWhale);\n collateralToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(collateralToken, 100e18, stableToken);\n vm.stopPrank();\n vm.startPrank(maticxWhale);\n stableToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(stableToken, 100e18, collateralToken);\n vm.stopPrank();\n\n emit log_named_uint(\"slippage coll->stable\", registry.getSlippage(collateralToken, stableToken));\n emit log_named_uint(\"slippage stable->coll\", registry.getSlippage(stableToken, collateralToken));\n }\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract StkBnbWBnbLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BSC_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 2e18;\n\n address stkBnbMarket = 0xAcfbf93d8fD1A9869bAb2328669dDba33296a421;\n address wbnbMarket = 0x3Af258d24EBdC03127ED6cEb8e58cA90835fbca5;\n address stkBnbWhale = 0x84b78452A97C5afDa1400943333F691448069A29; // algebra pool\n address wbnbWhale = 0x84b78452A97C5afDa1400943333F691448069A29; // algebra pool\n\n AlgebraSwapLiquidator liquidator = new AlgebraSwapLiquidator();\n _configurePairAndLiquidator(stkBnbMarket, wbnbMarket, liquidator);\n _fundMarketAndSelf(ICErc20(stkBnbMarket), stkBnbWhale);\n _fundMarketAndSelf(ICErc20(wbnbMarket), wbnbWhale);\n\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n collateralToken.transfer(address(this), depositAmount);\n collateralToken.approve(address(factory), depositAmount);\n position = factory.createAndFundPosition(collateralMarket, stableMarket, collateralToken, depositAmount);\n }\n}\n\ninterface TwoBrl {\n function minter() external view returns (address);\n\n function mint(address payable _to, uint256 _value) external returns (bool);\n}\n\ncontract Jbrl2BrlLeveredPositionTest is LeveredPositionTest {\n IonicComptroller pool;\n ComptrollerFirstExtension asExtension;\n\n function setUp() public fork(BSC_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1000e18;\n\n address twoBrlMarket = 0xf0a2852958aD041a9Fb35c312605482Ca3Ec17ba; // 2brl as collateral\n address jBrlMarket = 0x82A3103bc306293227B756f7554AfAeE82F8ab7a; // jbrl as borrowable\n address payable twoBrlWhale = payable(address(177)); // empty account\n address jBrlWhale = 0xA0695f78AF837F570bcc50f53e58Cda300798B65; // solidly pair BRZ-JBRL\n\n TwoBrl twoBrl = TwoBrl(ICErc20(twoBrlMarket).underlying());\n vm.prank(twoBrl.minter());\n twoBrl.mint(twoBrlWhale, depositAmount * 100);\n\n _configurePair(twoBrlMarket, jBrlMarket);\n _fundMarketAndSelf(ICErc20(twoBrlMarket), twoBrlWhale);\n _fundMarketAndSelf(ICErc20(jBrlMarket), jBrlWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract BombWbnbLeveredPositionTest is LeveredPositionTest {\n uint256 depositAmount = 100e18;\n address whale = 0xe7B7dF67C1fe053f1C6B965826d3bFF19603c482;\n address wbnbWhale = 0x57E30beb8054B248CE301FeabfD0c74677Fa40f0;\n uint256 ratioOnCreation = 1.0e18;\n uint256 minBorrowNative = 1e17;\n\n function setUp() public fork(BSC_CHAPEL) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n vm.mockCall(\n address(ffd),\n abi.encodeWithSelector(IFeeDistributor.minBorrowEth.selector),\n abi.encode(minBorrowNative)\n );\n\n address xMarket = 0x9B6E1039103812E0dcC1100a158e4a68014b2571; // BOMB\n address yMarket = 0x9dD00920f5B74A31177cbaB834AB0904703c31B1; // WBNB\n\n collateralMarket = ICErc20(xMarket);\n stableMarket = ICErc20(yMarket);\n\n //upgradePoolAndMarkets();\n\n IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());\n IERC20Upgradeable stableToken = IERC20Upgradeable(stableMarket.underlying());\n // call amountOutAndSlippageOfSwap to cache the slippage\n {\n vm.startPrank(whale);\n collateralToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(collateralToken, 1e18, stableToken);\n collateralToken.transfer(address(this), depositAmount);\n vm.stopPrank();\n\n vm.startPrank(wbnbWhale);\n stableToken.approve(address(registry), 1e36);\n registry.amountOutAndSlippageOfSwap(stableToken, 1e18, collateralToken);\n vm.stopPrank();\n }\n\n vm.prank(whale);\n collateralToken.transfer(address(this), depositAmount);\n\n collateralToken.approve(address(factory), depositAmount);\n position = factory.createAndFundPositionAtRatio(\n collateralMarket,\n stableMarket,\n collateralToken,\n depositAmount,\n ratioOnCreation\n );\n\n maxLevRatio = position.getMaxLeverageRatio();\n minLevRatio = position.getMinLeverageRatio();\n\n vm.label(address(position), \"Levered Position\");\n }\n}\n\ncontract PearlWUsdrWUsdrUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 0.000002e18;\n\n address lpTokenMarket = 0x06F61E22ef144f1cC4550D40ffbF681CB1C3aCAF;\n address wusdrMarket = 0x26EA46e975778662f98dAa0E7a12858dA9139262;\n address lpTokenWhale = 0x03Fa7A2628D63985bDFe07B95d4026663ED96065;\n address wUsdrWhale = 0x8711a1a52c34EDe8E61eF40496ab2618a8F6EA4B;\n\n _configurePair(lpTokenMarket, wusdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(wusdrMarket), wUsdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWUsdrUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 0.000002e18;\n\n address lpTokenMarket = 0x06F61E22ef144f1cC4550D40ffbF681CB1C3aCAF;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x03Fa7A2628D63985bDFe07B95d4026663ED96065;\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdcUsdcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 10e9;\n\n // LP token underlying 0xD17cb0f162f133e339C0BbFc18c36c357E681D6b\n address lpTokenMarket = 0x83DF24fE1B1eBF38048B91ffc4a8De0bAa88b891;\n address usdcMarket = 0x71A7037a42D0fB9F905a76B7D16846b2EACC59Aa;\n address lpTokenWhale = 0x97Bd59A8202F8263C2eC39cf6cF6B438D0B45876; // Thena Gauge\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrUsdcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 10e9;\n\n // LP token underlying 0xD17cb0f162f133e339C0BbFc18c36c357E681D6b\n address lpTokenMarket = 0x83DF24fE1B1eBF38048B91ffc4a8De0bAa88b891;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x97Bd59A8202F8263C2eC39cf6cF6B438D0B45876; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrDaiUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 2e18;\n\n // LP token underlying 0xBD02973b441Aa83c8EecEA158b98B5984bb1036E\n address lpTokenMarket = 0xBcE30B4D78cEb9a75A1Aa62156529c3592b3F08b;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x85Fa2331040933A02b154579fAbE6A6a5A765279; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrTngblUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.02e18;\n\n // LP token underlying 0x0Edc235693C20943780b76D79DD763236E94C751\n address lpTokenMarket = 0x2E870Aeee3D9d1eA29Ec93d2c0A99A4e0D5EB697;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0xdaeF32cA8D699015fcFB2884F6902fFCebE51c5b; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWbtcUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.000000071325342755e18;\n\n // LP token underlying 0xb95E1C22dd965FafE926b2A793e9D6757b6613F4\n address lpTokenMarket = 0xffc8c8d747E52fAfbf973c64Bab10d38A6902c46;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x39976f6328ebA2a3C860b7DE5cF2c1bB41581FB8; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrWethUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.004081e18;\n\n // LP token underlying 0x343D9a8D2Bc6A62390aEc764bb5b900C4B039127\n address lpTokenMarket = 0x343D9a8D2Bc6A62390aEc764bb5b900C4B039127;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0x7D02A8b758791A03319102f81bF61E220F73e43D; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract PearlUsdrMaticUsdrLpLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 0.05e18;\n\n // LP token underlying vAMM-WMATIC/USDR\n address lpTokenMarket = 0xfacEdA4f9731797102f040380aD5e234c92d1942;\n address usdrMarket = 0x1F11940B239D129dE0e5D30A3E59089af5Ecd6ed;\n address lpTokenWhale = 0xdA0AfBeEEBef6dA2F060237D35cab759b99B13B6; // Thena Gauge\n address usdrWhale = 0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265; // wUSDR contract\n\n _configurePair(lpTokenMarket, usdrMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdrMarket), usdrWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashAUsdcCashLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n upgradeRegistry();\n\n uint256 depositAmount = 300e18;\n\n // LP token underlying xCASH-USDC\n address lpTokenMarket = 0x1D2A7078a404ab970f951d5A6dbECD9e24838FB6;\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address lpTokenWhale = 0x35a499c15b4dDCf7e98628D415346B9795CCa80d;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n\n _configurePair(lpTokenMarket, cashMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroUsdcAUsdcCashLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 700e18;\n\n // LP token underlying xCASH-USDC\n address lpTokenMarket = 0x1D2A7078a404ab970f951d5A6dbECD9e24838FB6;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address lpTokenWhale = 0x35a499c15b4dDCf7e98628D415346B9795CCa80d;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroUsdcAUsdcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xUSDC-WETH05\n address lpTokenMarket = 0xC7cA03A0bE1dBAc350E5BfE5050fC5af6406490E;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(lpTokenMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashUsdcLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 300e18;\n\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address usdcMarket = 0x38EbA94210bCEf3F9231E1764EE230abC14D1cbc;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(cashMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroCashAUsdcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xUSDC-WETH05\n address lpTokenMarket = 0xC7cA03A0bE1dBAc350E5BfE5050fC5af6406490E;\n address cashMarket = 0xf69207CFDe6228A1e15A34F2b0c4fDe0845D9eBa;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address cashWhale = 0x88C522E526E5Eea8d636fd6805cA7fEB488780D0;\n\n _configurePair(lpTokenMarket, cashMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(cashMarket), cashWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract RetroWethAWbtcWethLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n // LP token underlying xWBTC-WETH05\n address lpTokenMarket = 0xCB1a06eff3459078c26516ae3a1dB44A61D2DbCA;\n address wethMarket = 0x2469B23354cb7cA50b798663Ec5812Bf28d15e9e;\n address lpTokenWhale = 0x38e481367E0c50f4166AD2A1C9fde0E3c662CFBa;\n address wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\n\n _configurePair(lpTokenMarket, wethMarket);\n _fundMarketAndSelf(ICErc20(lpTokenMarket), lpTokenWhale);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract DavosUsdcDusdLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(POLYGON_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 500e18;\n\n address dusdMarket = 0xE70d09dA78900A0429ee70b35200F70A30d7d2B9;\n address usdcMarket = 0x14787e50578d8c606C3d57bDbA53dD65Fd665449;\n address dusdWhale = 0xE69a1876bdACfa7A7a4F6D531BE2FDE843D2165C;\n address usdcWhale = 0x5a52E96BAcdaBb82fd05763E25335261B270Efcb;\n\n _configurePair(dusdMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(dusdMarket), dusdWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWethUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e17;\n\n address wethMarket = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDCMarket = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n address wethWhale = 0x7380511493DD4c2f1dD75E9CCe5bD52C787D4B51;\n address USDCWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDCMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n _configurePair(wethMarket, USDCMarket);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n _fundMarketAndSelf(ICErc20(USDCMarket), USDCWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWethUSDTLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n address wethMarket = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDTMarket = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n address wethWhale = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address USDTWhale = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDTMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n\n _configurePair(wethMarket, USDTMarket);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n _fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWbtcUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e6;\n\n address wbtcMarket = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDCMarket = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n address wbtcWhale = 0x3f3429D28438Cc14133966820b8A9Ea61Cf1D4F0;\n address USDCWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDCMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n IERC20Upgradeable token = IERC20Upgradeable(ICErc20(wbtcMarket).underlying());\n\n _configurePair(wbtcMarket, USDCMarket);\n\n uint256 allTokens = token.balanceOf(wbtcWhale);\n\n vm.prank(wbtcWhale);\n token.transfer(address(this), allTokens);\n vm.stopPrank();\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract ModeWbtcUSDTLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(MODE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e6;\n\n address wbtcMarket = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDTMarket = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n address wbtcWhale = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n address USDTWhale = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(USDTMarket);\n\n uint256[] memory newBorrowCaps = new uint256[](1);\n newBorrowCaps[0] = 1e36;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());\n\n vm.prank(comptroller.admin());\n comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);\n vm.stopPrank();\n\n _configurePair(wbtcMarket, USDTMarket);\n _fundMarketAndSelf(ICErc20(wbtcMarket), wbtcWhale);\n _fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract HyUSDUSDCLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 20e18;\n\n address hyUsdMarket = 0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe;\n address usdcMarket = 0xa900A17a49Bc4D442bA7F72c39FA2108865671f0;\n address hyUsdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address usdcWhale = 0x70FF197c32E922700d3ff2483D250c645979855d;\n\n {\n IERC20Upgradeable x = IERC20Upgradeable(ICErc20(hyUsdMarket).underlying());\n IERC20Upgradeable y = IERC20Upgradeable(ICErc20(usdcMarket).underlying());\n IERC20Upgradeable[] memory xToYPath = new IERC20Upgradeable[](2);\n IERC20Upgradeable[] memory yToXPath = new IERC20Upgradeable[](2);\n\n IERC20Upgradeable eUSD = IERC20Upgradeable(0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4);\n xToYPath[0] = eUSD;\n yToXPath[0] = eUSD;\n xToYPath[1] = y;\n yToXPath[1] = x;\n\n vm.startPrank(registry.owner());\n registry._setOptimalSwapPath(IERC20Upgradeable(x), IERC20Upgradeable(y), xToYPath);\n registry._setOptimalSwapPath(IERC20Upgradeable(y), IERC20Upgradeable(x), yToXPath);\n vm.stopPrank();\n }\n\n // IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePair(hyUsdMarket, usdcMarket);\n _fundMarketAndSelf(ICErc20(hyUsdMarket), hyUsdWhale);\n _fundMarketAndSelf(ICErc20(usdcMarket), usdcWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract HyUSDeUSDLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n upgradeRegistry();\n\n uint256 depositAmount = 20e18;\n\n address hyUsdMarket = 0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe;\n address eUsdMarket = 0x9c2A4f9c5471fd36bE3BBd8437A33935107215A1;\n address hyUsdWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address eUsdWhale = 0xa9E0588E82E9Ee1440f7e5375970a429D09646c1;\n AerodromeV2Liquidator aerodomeV2Liquidator = AerodromeV2Liquidator(0xD46b85409C43571145206B11D370A62AaeB22475);\n\n // IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePairAndLiquidator(hyUsdMarket, eUsdMarket, IRedemptionStrategy(address(aerodomeV2Liquidator)));\n _fundMarketAndSelf(ICErc20(hyUsdMarket), hyUsdWhale);\n _fundMarketAndSelf(ICErc20(eUsdMarket), eUsdWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\ncontract WSuperOETHWETHLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(BASE_MAINNET) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n address wsuperOeth = 0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6;\n address weth = 0x4200000000000000000000000000000000000006;\n\n uint256 depositAmount = 1e18;\n\n address wsuperOethMarket = 0xC462eb5587062e2f2391990b8609D2428d8Cf598;\n address wethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\n address wsuperOethWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address wethWhale = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n\n IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());\n ICErc20[] memory cTokens = new ICErc20[](1);\n cTokens[0] = ICErc20(wethMarket);\n\n uint256[] memory newSupplyCaps = new uint256[](1);\n newSupplyCaps[0] = 1e36;\n vm.prank(comptroller.admin());\n comptroller._setMarketSupplyCaps(cTokens, newSupplyCaps);\n\n AerodromeCLLiquidator aerodomeClLiquidator = new AerodromeCLLiquidator();\n vm.prank(registry.owner());\n registry._setWrappedToUnwrapped4626(address(wsuperOeth), address(0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3));\n // vm.prank(aerodomeClLiquidator.owner());\n // emit log_named_address(\"wsuperOeth\", address(wsuperOeth));\n // aerodomeClLiquidator.setWrappedToUnwrapped(\n // address(wsuperOeth),\n // 0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3\n // );\n _configurePairAndLiquidator(wsuperOethMarket, wethMarket, IRedemptionStrategy(address(aerodomeClLiquidator)));\n _fundMarketAndSelf(ICErc20(wsuperOethMarket), wsuperOethWhale);\n _fundMarketAndSelf(ICErc20(wethMarket), wethWhale);\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n\n/*\ncontract XYLeveredPositionTest is LeveredPositionTest {\n function setUp() public fork(X_CHAIN_ID) {}\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n uint256 depositAmount = 1e18;\n\n address xMarket = 0x...1;\n address yMarket = 0x...2;\n address xWhale = 0x...3;\n address yWhale = 0x...4;\n\n IRedemptionStrategy liquidator = new IRedemptionStrategy();\n _configurePairAndLiquidator(xMarket, yMarket, liquidator);\n _fundMarketAndSelf(ICErc20(xMarket), xWhale);\n _fundMarketAndSelf(ICErc20(yMarket), yWhale);\n\n (position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);\n }\n}\n*/\n" + }, + "contracts/test/liquidators/AlgebraSwapLiquidatorTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport \"../../liquidators/AlgebraSwapLiquidator.sol\";\n\ncontract AlgebraSwapLiquidatorTest is BaseTest {\n AlgebraSwapLiquidator public liquidator;\n address algebraSwapRouter = 0x327Dd3208f0bCF590A66110aCB6e5e6941A4EfA0;\n address ankrBnbAddress = 0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827;\n address wbnbAddress = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n uint256 inputAmount = 1e18;\n\n function afterForkSetUp() internal override {\n liquidator = new AlgebraSwapLiquidator();\n }\n\n function testAlgebraAnkrBnbWbnb() public fork(BSC_MAINNET) {\n address ankrBnbWhale = 0x366B523317Cc95B1a4D30b33f8637882825C5E23;\n\n IERC20Upgradeable ankr = IERC20Upgradeable(ankrBnbAddress);\n vm.prank(ankrBnbWhale);\n ankr.transfer(address(liquidator), 1e18);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n ankr,\n inputAmount,\n abi.encode(wbnbAddress, algebraSwapRouter)\n );\n\n assertEq(address(outputToken), wbnbAddress, \"!wbnb output\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"!wbnb amount\");\n }\n\n function testAlgebraWbnbAnkrBnb() public fork(BSC_MAINNET) {\n address wbnbWhale = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\n\n IERC20Upgradeable wbnb = IERC20Upgradeable(wbnbAddress);\n vm.prank(wbnbWhale);\n wbnb.transfer(address(liquidator), 1e18);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n wbnb,\n inputAmount,\n abi.encode(ankrBnbAddress, algebraSwapRouter)\n );\n\n assertEq(address(outputToken), ankrBnbAddress, \"!ankrbnb output\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"!ankrbnb amount\");\n }\n\n function testModeKimV4RedemptionStrategy() public fork(MODE_MAINNET) {\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ezEthWhale = 0x2344F131B07E6AFd943b0901C55898573F0d1561;\n address kimV4Router = 0xAc48FcF1049668B285f3dC72483DF5Ae2162f7e8;\n address modeWETH = ap.getAddress(\"wtoken\");\n\n IERC20Upgradeable ezETH = IERC20Upgradeable(MODE_EZETH);\n vm.prank(ezEthWhale);\n ezETH.transfer(address(liquidator), 1e18);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n ezETH,\n inputAmount,\n abi.encode(modeWETH, kimV4Router)\n );\n\n assertEq(address(outputToken), modeWETH, \"!WETH output token\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"!weth amount\");\n }\n}\n" + }, + "contracts/test/liquidators/CurveSwapLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\n\nimport { CurveLpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveLpTokenPriceOracleNoRegistry.sol\";\nimport { CurveV2LpTokenPriceOracleNoRegistry } from \"../../oracles/default/CurveV2LpTokenPriceOracleNoRegistry.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract CurveSwapLiquidatorTest is BaseTest {\n CurveSwapLiquidatorFunder private csl;\n address private maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\n address private val3EPSAddress = 0x5b5bD8913D766D005859CE002533D4838B0Ebbb5;\n\n address private lpTokenMai3EPS = 0x80D00D2c8d920a9253c3D65BA901250a55011b37;\n address private poolAddress = 0x68354c6E8Bbd020F9dE81EAf57ea5424ba9ef322;\n\n CurveLpTokenPriceOracleNoRegistry curveV1Oracle;\n CurveV2LpTokenPriceOracleNoRegistry curveV2Oracle;\n\n function afterForkSetUp() internal override {\n csl = new CurveSwapLiquidatorFunder();\n curveV1Oracle = CurveLpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveLpTokenPriceOracleNoRegistry\"));\n curveV2Oracle = CurveV2LpTokenPriceOracleNoRegistry(ap.getAddress(\"CurveV2LpTokenPriceOracleNoRegistry\"));\n\n if (address(curveV1Oracle) == address(0)) {\n address[][] memory _poolUnderlyings = new address[][](1);\n _poolUnderlyings[0] = asArray(maiAddress, val3EPSAddress);\n curveV1Oracle = new CurveLpTokenPriceOracleNoRegistry();\n curveV1Oracle.initialize(asArray(lpTokenMai3EPS), asArray(poolAddress), _poolUnderlyings);\n }\n }\n\n // Curve pools need to be configured in the CurveV1 or CurveV2 oracles\n // We have not deployed CurveV2 oracle yet\n function testSwapCurveV1UsdtUsdc() public debuggingOnly fork(ARBITRUM_ONE) {\n address usdtAddress = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;\n address usdcAddress = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\n address usdtWhale = 0xB38e8c17e38363aF6EbdCb3dAE12e0243582891D; // binance\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(usdtAddress);\n uint256 inputAmount = 150e6;\n\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, usdtAddress, usdcAddress, ap.getAddress(\"wtoken\"));\n\n vm.prank(usdtWhale);\n inputToken.transfer(address(csl), inputAmount);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\n\n assertEq(address(outputToken), usdcAddress, \"output token does not match\");\n assertApproxEqAbs(outputAmount, inputAmount, 1e5, \"output amount does not match\");\n }\n\n function testSwapCurveV2EspBnbxBnb() public fork(BSC_MAINNET) {\n address bnbxAddress = 0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275;\n address wbnb = ap.getAddress(\"wtoken\");\n address bnbxWhale = 0x4eE98B27eeF58844E460922eC9Da7C05D32F284A;\n\n IERC20Upgradeable inputToken = IERC20Upgradeable(bnbxAddress);\n uint256 inputAmount = 3e18;\n\n bytes memory data = abi.encode(curveV1Oracle, curveV2Oracle, bnbxAddress, wbnb, wbnb);\n\n vm.prank(bnbxWhale);\n inputToken.transfer(address(csl), inputAmount);\n\n (IERC20Upgradeable outputToken, uint256 outputAmount) = csl.redeem(inputToken, inputAmount, data);\n\n assertEq(address(outputToken), wbnb, \"output token does not match\");\n assertApproxEqRel(outputAmount, inputAmount, 8e16, \"output amount does not match\");\n }\n\n function testRedeemMAI() public fork(BSC_MAINNET) {\n ICurvePool curvePool = ICurvePool(poolAddress);\n\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\n\n uint256 inputAmount = 1e10;\n\n uint256 maiForVal3EPS = curvePool.get_dy(0, 1, inputAmount);\n emit log_uint(maiForVal3EPS);\n\n dealMai(address(csl), inputAmount);\n\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\n (IERC20Upgradeable shouldBeVal3EPS, uint256 outputAmount) = csl.redeem(\n IERC20Upgradeable(maiAddress),\n inputAmount,\n data\n );\n assertEq(address(shouldBeVal3EPS), val3EPSAddress, \"output token does not match\");\n\n assertEq(maiForVal3EPS, outputAmount, \"output amount does not match\");\n }\n\n function testEstimateInputAmount() public fork(BSC_MAINNET) {\n ICurvePool curvePool = ICurvePool(poolAddress);\n\n assertEq(maiAddress, curvePool.coins(0), \"coin 0 must be MAI\");\n assertEq(val3EPSAddress, curvePool.coins(1), \"coin 1 must be val3EPS\");\n\n bytes memory data = abi.encode(curveV1Oracle, address(0), maiAddress, val3EPSAddress, ap.getAddress(\"wtoken\"));\n\n (IERC20Upgradeable inputToken, uint256 inputAmount) = csl.estimateInputAmount(2e10, data);\n\n emit log(\"input\");\n emit log_uint(inputAmount);\n emit log_address(address(inputToken));\n uint256 shouldBeAround2e10 = curvePool.get_dy(1, 0, inputAmount);\n emit log(\"should be around 2e10\");\n emit log_uint(shouldBeAround2e10);\n assertTrue(shouldBeAround2e10 >= 20e9 && shouldBeAround2e10 <= 23e9, \"rough estimate didn't work\");\n }\n\n function dealMai(address to, uint256 amount) internal {\n address whale = 0xc412eCccaa35621cFCbAdA4ce203e3Ef78c4114a; // anyswap\n vm.prank(whale);\n IERC20Upgradeable(maiAddress).transfer(to, amount);\n }\n}\n" + }, + "contracts/test/liquidators/IonicLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\nimport { IonicLiquidator, ILiquidator } from \"../../IonicLiquidator.sol\";\nimport { IonicUniV3Liquidator } from \"../../IonicUniV3Liquidator.sol\";\nimport { ICurvePool } from \"../../external/curve/ICurvePool.sol\";\nimport { CurveSwapLiquidatorFunder } from \"../../liquidators/CurveSwapLiquidatorFunder.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport \"../../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { Unitroller } from \"../../compound/Unitroller.sol\";\nimport { BasePriceOracle } from \"../../oracles/BasePriceOracle.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport { UpgradesBaseTest } from \"../UpgradesBaseTest.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { ProxyAdmin } from \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport { PoolLens } from \"../../PoolLens.sol\";\n\ncontract MockRedemptionStrategy is IRedemptionStrategy {\n function redeem(IERC20Upgradeable, uint256, bytes memory) external returns (IERC20Upgradeable, uint256) {\n return (IERC20Upgradeable(address(0)), 1);\n }\n\n function name() public pure returns (string memory) {\n return \"MockRedemptionStrategy\";\n }\n}\n\ncontract IonicLiquidatorTest is UpgradesBaseTest {\n ILiquidator liquidator;\n address uniswapRouter;\n address swapRouter;\n IUniswapV3Quoter quoter;\n address usdcWhale;\n address wethWhale;\n address poolAddress;\n address uniV3PooForFlash;\n uint256 usdcMarketIndex;\n uint256 wethMarketIndex;\n\n AuthoritiesRegistry authRegistry;\n ILiquidatorsRegistry liquidatorsRegistry;\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n if (block.chainid == BSC_MAINNET) {\n uniswapRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n } else if (block.chainid == POLYGON_MAINNET) {\n uniswapRouter = 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff;\n swapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n quoter = IUniswapV3Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD; // aave reserve\n wethWhale = 0x1eED63EfBA5f81D95bfe37d82C8E736b974F477b;\n poolAddress = 0x22A705DEC988410A959B8b17C8c23E33c121580b; // Retro stables pool\n uniV3PooForFlash = 0xA374094527e1673A86dE625aa59517c5dE346d32; // usdc-wmatic\n usdcMarketIndex = 3;\n wethMarketIndex = 5;\n } else if (block.chainid == MODE_MAINNET) {\n uniswapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\n // uniswapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\n // swapRouter = 0xC9Adff795f46105E53be9bbf14221b1C9919EE25; // sup router\n swapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router\n //quoter = IUniswapV3Quoter(0x7Fd569b2021850fbA53887dd07736010aCBFc787); // other sup quoter?\n quoter = IUniswapV3Quoter(0x5E6AEbab1AD525f5336Bd12E6847b851531F72ba); // sup quoter\n usdcWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79; // vault\n wethWhale = 0xF4C85269240C1D447309fA602A90ac23F1CB0Dc0;\n poolAddress = 0xFB3323E24743Caf4ADD0fDCCFB268565c0685556;\n //uniV3PooForFlash = 0x293f2B2c17f8cEa4db346D87Ef5712C9dd0491EF; // kim weth-usdc pool\n uniV3PooForFlash = 0x047CF4b081ee80d2928cb2ce3F3C4964e26eB0B9; // kim usdt-usdc pool\n // uniV3PooForFlash = 0xf2e9C024F1C0B7a2a4ea11243C2D86A7b38DD72f; // sup univ2 0x34a1E3Db82f669f8cF88135422AfD80e4f70701A\n usdcMarketIndex = 1;\n wethMarketIndex = 0;\n // weth 0x4200000000000000000000000000000000000006\n // usdc 0xd988097fb8612cc24eeC14542bC03424c656005f\n }\n\n // vm.prank(ap.owner());\n // ap.setAddress(\"IUniswapV2Router02\", uniswapRouter);\n vm.prank(ap.owner());\n ap.setAddress(\"UNISWAP_V3_ROUTER\", uniswapRouter);\n\n authRegistry = AuthoritiesRegistry(ap.getAddress(\"AuthoritiesRegistry\"));\n liquidatorsRegistry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\n liquidator = IonicLiquidator(payable(ap.getAddress(\"IonicLiquidator\")));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(liquidatorsRegistry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(liquidatorsRegistry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function testBsc() public fork(BSC_MAINNET) {\n testUpgrade();\n }\n\n function testPolygon() public fork(POLYGON_MAINNET) {\n testUpgrade();\n }\n\n function testUpgrade() internal {\n // in case these slots start to get used, please redeploy the FSL\n // with a larger storage gap to protect the owner variable of OwnableUpgradeable\n // from being overwritten by the IonicLiquidator storage\n for (uint256 i = 40; i < 51; i++) {\n address atSloti = address(uint160(uint256(vm.load(address(liquidator), bytes32(i)))));\n assertEq(\n atSloti,\n address(0),\n \"replace the FSL proxy/storage contract with a new one before the owner variable is overwritten\"\n );\n }\n }\n\n function testSpecificLiquidation() public debuggingOnly fork(MODE_MAINNET) {\n address borrower = 0x5834a3AAFA83A53822B313994Bb554d8E8c215dF;\n address debtMarketAddr = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n address collateralMarketAddr = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n\n liquidator = ILiquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars;\n vars.borrower = borrower;\n vars.cErc20 = ICErc20(debtMarketAddr);\n vars.cTokenCollateral = ICErc20(collateralMarketAddr);\n vars.repayAmount = 0x408c7a4d7c4092;\n vars.flashSwapContract = 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc;\n vars.minProfitAmount = 0;\n vars.redemptionStrategies = new IRedemptionStrategy[](1);\n vars.strategyData = new bytes[](1);\n vars.debtFundingStrategies = new IFundsConversionStrategy[](0);\n vars.debtFundingStrategiesData = new bytes[](0);\n\n vars.redemptionStrategies[0] = IFundsConversionStrategy(0x5cA3fd2c285C4138185Ef1BdA7573D415020F3C8);\n vars.strategyData[\n 0\n ] = hex\"0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000ac48fcf1049668b285f3dc72483df5ae2162f7e8\";\n\n liquidator.safeLiquidateToTokensWithFlashLoan(vars);\n }\n\n function testWithdrawalLiquidator() public debuggingOnly fork(MODE_MAINNET) {\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.prank(0x4200000000000000000000000000000000000016);\n (bool success, ) = address(liquidatorV3).call{ value: 1 ether }(\"\");\n require(success, \"transfer of funds failed\");\n\n uint256 beforeBalance = liquidatorV3.owner().balance;\n\n vm.prank(liquidatorV3.owner());\n liquidatorV3.withdrawAll();\n\n emit log_named_uint(\"balance of liquidator\", liquidatorV3.owner().balance);\n\n assertEq(liquidatorV3.owner().balance, beforeBalance + 1 ether);\n assertEq(address(liquidatorV3).balance, 0);\n }\n\n function testLiquidateAfterUpgradeLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\n // upgrade IonicLiquidator\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidatorV3.setPoolLens(address(lens));\n liquidatorV3.setHealthFactorThreshold(1e18);\n vm.stopPrank();\n\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf before\", healthFactor);\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: 0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d,\n repayAmount: 1134537086250983,\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n minProfitAmount: 0,\n redemptionStrategies: new IRedemptionStrategy[](0),\n strategyData: new bytes[](0),\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n });\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf after\", healthFactorAfter);\n }\n\n function testLiquidateAfterUpgradeLiquidatorExpressRelay() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {\n // upgrade IonicLiquidator\n TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();\n IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n PoolLens lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n address expressRelay = makeAddr(\"expressRelay\");\n\n ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress(\"DefaultProxyAdmin\"));\n\n vm.startPrank(proxyAdmin.owner());\n proxyAdmin.upgrade(proxyV3, address(implV3));\n vm.stopPrank();\n\n vm.startPrank(0x1155b614971f16758C92c4890eD338C9e3ede6b7);\n liquidatorV3.setPoolLens(address(lens));\n liquidatorV3.setHealthFactorThreshold(95e16);\n liquidatorV3.setExpressRelay(expressRelay);\n vm.stopPrank();\n\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n (, , uint256 liquidity, uint256 shortfall) = pool.getAccountLiquidity(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n emit log_named_uint(\"liquidity\", liquidity);\n emit log_named_uint(\"shortfall\", shortfall);\n\n uint256 healthFactor = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf before\", healthFactor);\n\n address borrower = address(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d);\n\n ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: borrower,\n repayAmount: 1134537086250983,\n cErc20: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n cTokenCollateral: ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2),\n flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n minProfitAmount: 0,\n redemptionStrategies: new IRedemptionStrategy[](0),\n strategyData: new bytes[](0),\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n });\n\n vm.mockCall(\n expressRelay,\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(liquidatorV3),\n abi.encode(borrower)\n ),\n abi.encode(false)\n );\n vm.expectRevert(\"invalid liquidation\");\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n vm.mockCall(\n expressRelay,\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(liquidatorV3),\n abi.encode(borrower)\n ),\n abi.encode(true)\n );\n liquidatorV3.safeLiquidateToTokensWithFlashLoan(vars);\n\n uint256 healthFactorAfter = lens.getHealthFactor(0x92eA6902C5023CC632e3Fd84dE7CcA6b98FE853d, pool);\n emit log_named_uint(\"hf after\", healthFactorAfter);\n }\n\n // TODO test with marginal shortfall for liquidation penalty errors\n function _testLiquidatorLiquidate(address contractForFlashSwap) internal {\n IonicComptroller pool = IonicComptroller(poolAddress);\n // _upgradePoolWithExtension(Unitroller(payable(poolAddress)));\n //upgradeRegistry();\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.prank(pool.admin());\n pool._setBorrowCapForCollateral(address(usdcMarket), address(wethMarket), 1e36);\n }\n\n {\n vm.prank(pool.admin());\n pool._borrowCapWhitelist(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038, address(this), true);\n }\n\n {\n vm.prank(wethWhale);\n weth.transfer(address(this), 0.1e18);\n\n weth.approve(address(wethMarket), 1e36);\n require(wethMarket.mint(0.1e18) == 0, \"mint weth failed\");\n pool.enterMarkets(asArray(address(usdcMarket), address(wethMarket)));\n }\n\n {\n vm.startPrank(usdcWhale);\n usdc.approve(address(usdcMarket), 2e36);\n require(usdcMarket.mint(70e6) == 0, \"mint usdc failed\");\n vm.stopPrank();\n }\n\n {\n require(usdcMarket.borrow(50e6) == 0, \"borrow usdc failed\");\n\n // the collateral prices change\n BasePriceOracle mpo = pool.oracle();\n uint256 priceCollateral = mpo.getUnderlyingPrice(wethMarket);\n vm.mockCall(\n address(mpo),\n abi.encodeWithSelector(mpo.getUnderlyingPrice.selector, wethMarket),\n abi.encode(priceCollateral / 10)\n );\n }\n\n (IRedemptionStrategy[] memory strategies, bytes[] memory strategiesData) = liquidatorsRegistry\n .getRedemptionStrategies(weth, usdc);\n\n uint256 seizedAmount = liquidator.safeLiquidateToTokensWithFlashLoan(\n ILiquidator.LiquidateToTokensWithFlashSwapVars({\n borrower: address(this),\n repayAmount: 10e6,\n cErc20: usdcMarket,\n cTokenCollateral: wethMarket,\n flashSwapContract: contractForFlashSwap,\n minProfitAmount: 6,\n redemptionStrategies: strategies,\n strategyData: strategiesData,\n debtFundingStrategies: new IFundsConversionStrategy[](0),\n debtFundingStrategiesData: new bytes[](0)\n })\n );\n\n emit log_named_uint(\"seized amount\", seizedAmount);\n require(seizedAmount > 0, \"didn't seize any assets\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV2LiquidatorFunderTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport { UniswapV2LiquidatorFunder } from \"../../liquidators/UniswapV2LiquidatorFunder.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract UniswapV2LiquidatorFunderTest is BaseTest {\n address maiAddress;\n address usdcAddress;\n UniswapV2LiquidatorFunder uv2lf;\n address uniswapV2Router;\n\n function afterForkSetUp() internal override {\n uv2lf = new UniswapV2LiquidatorFunder();\n uniswapV2Router = ap.getAddress(\"IUniswapV2Router02\");\n usdcAddress = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n maiAddress = 0x3F56e0c36d275367b8C502090EDF38289b3dEa0d;\n }\n\n function testConvertUsdcMai() public fork(BSC_MAINNET) {\n address[] memory swapPath = new address[](2);\n swapPath[0] = maiAddress;\n swapPath[1] = usdcAddress;\n bytes memory strategyData = abi.encode(uniswapV2Router, swapPath);\n\n uint256 outputUsdcExpected = 1e10;\n (IERC20Upgradeable inputToken, uint256 inputMaiRequired) = uv2lf.estimateInputAmount(\n outputUsdcExpected,\n strategyData\n );\n\n assertApproxEqAbs(inputMaiRequired, outputUsdcExpected, 1e9);\n assertEq(address(inputToken), maiAddress, \"!mai address\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV3LiquidatorFunderTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { IonicLiquidator } from \"../../IonicLiquidator.sol\";\nimport { IUniswapV2Pair } from \"../../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../../external/uniswap/IUniswapV2Factory.sol\";\nimport { IUniswapV3Factory } from \"../../external/uniswap/IUniswapV3Factory.sol\";\nimport { Quoter } from \"../../external/uniswap/quoter/Quoter.sol\";\nimport { IUniswapV3Pool } from \"../../external/uniswap/IUniswapV3Pool.sol\";\nimport { ISwapRouter } from \"../../external/uniswap/ISwapRouter.sol\";\nimport { IComptroller } from \"../../external/compound/IComptroller.sol\";\nimport { IUniswapV2Router02 } from \"../../external/uniswap/IUniswapV2Router02.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract UniswapV3LiquidatorFunderTest is BaseTest {\n UniswapV3LiquidatorFunder private uniswapv3Liquidator;\n\n IERC20Upgradeable parToken;\n IERC20Upgradeable usdcToken;\n address univ3SwapRouter;\n uint256 poolFee;\n Quoter quoter;\n MasterPriceOracle mpo;\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n\n if (block.chainid == POLYGON_MAINNET) {\n quoter = new Quoter(0x1F98431c8aD98523631AE4a59f267346ea31F984);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n parToken = IERC20Upgradeable(0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128); // PAR, 18 decimals\n usdcToken = IERC20Upgradeable(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174); // USDC, 6 decimals\n poolFee = 500;\n }\n uniswapv3Liquidator = new UniswapV3LiquidatorFunder();\n }\n\n function testUniV3ParUsdcRedeem() public fork(POLYGON_MAINNET) {\n uint256 parInputAmount = 10000e18;\n address parTokenWhale = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; // Balancer V2\n\n vm.prank(parTokenWhale);\n parToken.transfer(address(uniswapv3Liquidator), parInputAmount);\n\n bytes memory data = abi.encode(parToken, usdcToken, poolFee, ISwapRouter(univ3SwapRouter), quoter);\n (IERC20Upgradeable outputToken, uint256 outputAmount) = uniswapv3Liquidator.redeem(parToken, parInputAmount, data);\n\n uint256 inputValue = (parInputAmount * mpo.price(address(parToken))) / 1e18;\n uint256 outputValue = (outputAmount * mpo.price(address(usdcToken))) / 1e6;\n\n assertEq(address(outputToken), address(usdcToken), \"!out tok\");\n assertApproxEqRel(inputValue, outputValue, 1e16, \"!out amount\");\n }\n}\n" + }, + "contracts/test/liquidators/UniswapV3LiquidatorTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IonicUniV3Liquidator, IUniswapV3Pool, ILiquidator } from \"../../IonicUniV3Liquidator.sol\";\nimport \"../../external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IRedemptionStrategy } from \"../../liquidators/IRedemptionStrategy.sol\";\nimport { ILiquidatorsRegistry } from \"../../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IUniswapV2Router02 } from \"../../external/uniswap/IUniswapV2Router02.sol\";\nimport { IUniswapV3Factory } from \"../../external/uniswap/IUniswapV3Factory.sol\";\nimport { UniswapV2LiquidatorFunder } from \"../../liquidators/UniswapV2LiquidatorFunder.sol\";\nimport { UniswapV3LiquidatorFunder } from \"../../liquidators/UniswapV3LiquidatorFunder.sol\";\nimport { KimUniV2Liquidator } from \"../../liquidators/KimUniV2Liquidator.sol\";\n\nimport { IFundsConversionStrategy } from \"../../liquidators/IFundsConversionStrategy.sol\";\nimport { ICErc20 } from \"../../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../../compound/ComptrollerInterface.sol\";\nimport { AuthoritiesRegistry } from \"../../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../../ionic/PoolRolesAuthority.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\nimport \"./IonicLiquidatorTest.sol\";\n\ncontract UniswapV3LiquidatorTest is IonicLiquidatorTest {\n function testPolygonUniV3LiquidatorLiquidate() public fork(POLYGON_MAINNET) {\n IonicUniV3Liquidator _liquidator = new IonicUniV3Liquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), address(quoter));\n liquidator = _liquidator;\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testModeUniV3LiquidatorLiquidate() public debuggingOnly fork(MODE_MAINNET) {\n IonicUniV3Liquidator _liquidator = new IonicUniV3Liquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), address(quoter));\n liquidator = _liquidator;\n\n IonicComptroller pool = IonicComptroller(poolAddress);\n {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.startPrank(liquidatorsRegistry.owner());\n IRedemptionStrategy strategy = new UniswapV3LiquidatorFunder();\n liquidatorsRegistry._setRedemptionStrategy(strategy, weth, usdc);\n vm.stopPrank();\n vm.prank(OwnableUpgradeable(address(liquidator)).owner());\n liquidator._whitelistRedemptionStrategy(strategy, true);\n }\n }\n\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testModeKimUniV2Liquidator() public fork(MODE_MAINNET) {\n IonicLiquidator _liquidator = new IonicLiquidator();\n _liquidator.initialize(ap.getAddress(\"wtoken\"), ap.getAddress(\"IUniswapV2Router02\"), 30);\n liquidator = _liquidator;\n liquidator.setPoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n liquidator.setHealthFactorThreshold(1e18);\n\n IonicComptroller pool = IonicComptroller(poolAddress);\n {\n ICErc20[] memory markets = pool.getAllMarkets();\n\n ICErc20 usdcMarket = markets[usdcMarketIndex];\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcMarket.underlying());\n ICErc20 wethMarket = markets[wethMarketIndex];\n IERC20Upgradeable weth = IERC20Upgradeable(wethMarket.underlying());\n {\n emit log_named_address(\"usdc market\", address(usdcMarket));\n emit log_named_address(\"weth market\", address(wethMarket));\n emit log_named_address(\"usdc underlying\", usdcMarket.underlying());\n emit log_named_address(\"weth underlying\", wethMarket.underlying());\n vm.startPrank(liquidatorsRegistry.owner());\n IRedemptionStrategy strategy = KimUniV2Liquidator(0x6aC17D406a820fa464fFdc0940FCa7E60b3b36B7);\n liquidatorsRegistry._setRedemptionStrategy(strategy, weth, usdc);\n vm.stopPrank();\n liquidator._whitelistRedemptionStrategy(strategy, true);\n }\n }\n\n _testLiquidatorLiquidate(uniV3PooForFlash);\n }\n\n function testUniV3PoolForFee() public debuggingOnly fork(MODE_MAINNET) {\n address wethAddr = 0x4200000000000000000000000000000000000006;\n address usdcAddr = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n IERC20Upgradeable usdc = IERC20Upgradeable(usdcAddr);\n IERC20Upgradeable weth = IERC20Upgradeable(wethAddr);\n\n IUniswapV2Router02 kimRouter = IUniswapV2Router02(0x5D61c537393cf21893BE619E36fC94cd73C77DD3);\n address factoryAddress;\n //factory = kimRouter.factory();\n factoryAddress = 0xC33Ce0058004d44E7e1F366E5797A578fDF38584;\n IUniswapV3Factory factory = IUniswapV3Factory(factoryAddress);\n address pool;\n\n uint256 feeConfig = liquidatorsRegistry.uniswapV3Fees(usdc, weth);\n emit log_named_uint(\"feeConfig\", feeConfig);\n\n if (feeConfig == 0) {\n pool = factory.getPool(wethAddr, usdcAddr, uint24(feeConfig));\n emit log_named_address(\"Pool at fee 0\", pool);\n }\n\n pool = factory.getPool(wethAddr, usdcAddr, 500);\n emit log_named_address(\"Pool at fee 500\", pool);\n }\n}\n" + }, + "contracts/test/LiquidatorsRegistryTest.t.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport { LiquidatorsRegistry } from \"../liquidators/registry/LiquidatorsRegistry.sol\";\nimport { LiquidatorsRegistryExtension } from \"../liquidators/registry/LiquidatorsRegistryExtension.sol\";\nimport { LiquidatorsRegistrySecondExtension } from \"../liquidators/registry/LiquidatorsRegistrySecondExtension.sol\";\nimport { ILiquidatorsRegistry } from \"../liquidators/registry/ILiquidatorsRegistry.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport \"../ionic/DiamondExtension.sol\";\nimport { SafeOwnable } from \"../ionic/SafeOwnable.sol\";\n\ncontract LiquidatorsRegistryTest is BaseTest {\n ILiquidatorsRegistry registry;\n\n // all-chains\n IERC20Upgradeable stable;\n IERC20Upgradeable wtoken;\n MasterPriceOracle mpo;\n\n // chapel\n IERC20Upgradeable chapelBomb = IERC20Upgradeable(0xe45589fBad3A1FB90F5b2A8A3E8958a8BAB5f768);\n IERC20Upgradeable chapelTUsd = IERC20Upgradeable(0x4f1885D25eF219D3D4Fa064809D6D4985FAb9A0b);\n IERC20Upgradeable chapelTDai = IERC20Upgradeable(0x8870f7102F1DcB1c35b01af10f1baF1B00aD6805);\n\n // bsc\n IERC20Upgradeable wbnbBusdLpToken = IERC20Upgradeable(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16);\n IERC20Upgradeable usdcBusdCakeLpToken = IERC20Upgradeable(0x2354ef4DF11afacb85a5C7f98B624072ECcddbB1);\n IERC20Upgradeable ankrAnkrBnbGammaLpToken = IERC20Upgradeable(0x3f8f3caefF393B1994a9968E835Fd38eCba6C1be);\n\n // polygon\n IERC20Upgradeable usdr3CrvCurveLpToken = IERC20Upgradeable(0xa138341185a9D0429B0021A11FB717B225e13e1F);\n IERC20Upgradeable maticxBbaBalancerStableLpToken = IERC20Upgradeable(0xb20fC01D21A50d2C734C4a1262B4404d41fA7BF0);\n IERC20Upgradeable stMaticBbaBalancerStableLpToken = IERC20Upgradeable(0x216690738Aac4aa0C4770253CA26a28f0115c595);\n IERC20Upgradeable mimoParBalancerWeightedLpToken = IERC20Upgradeable(0x82d7f08026e21c7713CfAd1071df7C8271B17Eae);\n\n function afterForkSetUp() internal override {\n registry = ILiquidatorsRegistry(ap.getAddress(\"LiquidatorsRegistry\"));\n stable = IERC20Upgradeable(ap.getAddress(\"stableToken\"));\n wtoken = IERC20Upgradeable(ap.getAddress(\"wtoken\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function upgradeRegistry() internal {\n DiamondBase asBase = DiamondBase(address(registry));\n address[] memory exts = asBase._listExtensions();\n LiquidatorsRegistryExtension newExt1 = new LiquidatorsRegistryExtension();\n LiquidatorsRegistrySecondExtension newExt2 = new LiquidatorsRegistrySecondExtension();\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt1, DiamondExtension(exts[0]));\n vm.prank(SafeOwnable(address(registry)).owner());\n asBase._registerExtension(newExt2, DiamondExtension(exts[1]));\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function testResetStrategies() public debuggingOnly fork(BSC_CHAPEL) {\n upgradeRegistry();\n\n IRedemptionStrategy[] memory strategiesConfig = new IRedemptionStrategy[](3);\n IERC20Upgradeable[] memory inputTokensConfig = new IERC20Upgradeable[](3);\n IERC20Upgradeable[] memory outputTokensConfig = new IERC20Upgradeable[](3);\n {\n strategiesConfig[0] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[1] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[2] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n inputTokensConfig[0] = IERC20Upgradeable(chapelBomb);\n inputTokensConfig[1] = IERC20Upgradeable(chapelTUsd);\n inputTokensConfig[2] = IERC20Upgradeable(chapelTDai);\n outputTokensConfig[0] = IERC20Upgradeable(chapelTUsd);\n outputTokensConfig[1] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[2] = IERC20Upgradeable(chapelBomb);\n }\n\n bool matchingBefore = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingBefore, false, \"should not match prior\");\n\n vm.prank(ap.getAddress(\"deployer\"));\n registry._resetRedemptionStrategies(strategiesConfig, inputTokensConfig, outputTokensConfig);\n\n bool matchingAfter = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingAfter, true, \"should match after\");\n }\n\n function testResetDuplicatingStrategies() public debuggingOnly fork(BSC_CHAPEL) {\n upgradeRegistry();\n\n IRedemptionStrategy[] memory strategiesConfig = new IRedemptionStrategy[](4);\n IERC20Upgradeable[] memory inputTokensConfig = new IERC20Upgradeable[](4);\n IERC20Upgradeable[] memory outputTokensConfig = new IERC20Upgradeable[](4);\n {\n strategiesConfig[0] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[1] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[2] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n strategiesConfig[3] = IRedemptionStrategy(0xC875a8D8E8a593953115131697a788faEAa37109);\n inputTokensConfig[0] = IERC20Upgradeable(chapelBomb);\n inputTokensConfig[1] = IERC20Upgradeable(chapelTUsd);\n inputTokensConfig[2] = IERC20Upgradeable(chapelTDai);\n inputTokensConfig[3] = IERC20Upgradeable(chapelTDai);\n outputTokensConfig[0] = IERC20Upgradeable(chapelTUsd);\n outputTokensConfig[1] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[2] = IERC20Upgradeable(chapelBomb);\n outputTokensConfig[3] = IERC20Upgradeable(chapelBomb);\n }\n\n bool matchingBefore = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingBefore, false, \"should not match prior\");\n\n vm.prank(ap.getAddress(\"deployer\"));\n registry._resetRedemptionStrategies(strategiesConfig, inputTokensConfig, outputTokensConfig);\n\n bool matchingAfter = registry.pairsStrategiesMatch(strategiesConfig, inputTokensConfig, outputTokensConfig);\n assertEq(matchingAfter, true, \"should match after\");\n }\n\n function testRedemptionPathChapel() public debuggingOnly fork(BSC_CHAPEL) {\n emit log(\"bomb tusd\");\n emit log(registry.redemptionStrategiesByTokens(chapelBomb, chapelTDai).name());\n emit log(\"tusd bomb\");\n emit log(registry.redemptionStrategiesByTokens(chapelTDai, chapelBomb).name());\n\n (IRedemptionStrategy strategy, bytes memory strategyData) = registry.getRedemptionStrategy(chapelBomb, chapelTDai);\n }\n\n function testInputTokensChapel() public debuggingOnly fork(BSC_CHAPEL) {\n address[] memory inputTokens = registry.getInputTokensByOutputToken(chapelBomb);\n\n emit log_named_array(\"inputs\", inputTokens);\n }\n\n function testInputTokensBsc() public debuggingOnly fork(BSC_MAINNET) {\n address[] memory inputTokens = registry.getInputTokensByOutputToken(stable);\n\n emit log_named_array(\"inputs\", inputTokens);\n }\n\n function _swap(\n address whale,\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IERC20Upgradeable outputToken,\n uint256 tolerance\n ) internal {\n vm.startPrank(whale);\n inputToken.approve(address(registry), inputAmount);\n (uint256 swappedAmountOut, uint256 slippage) = registry.amountOutAndSlippageOfSwap(\n inputToken,\n inputAmount,\n outputToken\n );\n vm.stopPrank();\n\n emit log_named_uint(\"received\", swappedAmountOut);\n assertLt(slippage, tolerance, \"slippage too high\");\n }\n\n function testSwappingUniLpBsc() public fork(BSC_MAINNET) {\n address lpTokenWhale = 0x14B2e8329b8e06BCD524eb114E23fAbD21910109;\n\n IERC20Upgradeable inputToken = usdcBusdCakeLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = stable;\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingGammaLpBsc() public fork(BSC_MAINNET) {\n address lpTokenWhale = 0xd44ad81474d075c3Bf0307830977A5804BfC0bc7; // thena gauge\n\n IERC20Upgradeable inputToken = ankrAnkrBnbGammaLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = wtoken;\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingBalancerStableLpPolygon() public fork(POLYGON_MAINNET) {\n // TODO: run deployment to fix the liquidation path and set the balancer liquidator data\n address lpTokenWhale = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; // balancer gauge\n\n // maticx-wmatic aave boosted\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = wtoken;\n\n _swap(lpTokenWhale, maticxBbaBalancerStableLpToken, inputAmount, outputToken, 1e16);\n\n // stmatic-wmatic aave boosted\n _swap(lpTokenWhale, stMaticBbaBalancerStableLpToken, inputAmount, outputToken, 1e16);\n }\n\n function testSwappingBalancerWeightedLpPolygon() public fork(POLYGON_MAINNET) {\n address lpTokenWhale = 0xbB60ADbe38B4e6ab7fb0f9546C2C1b665B86af11; // mimo staker\n\n IERC20Upgradeable inputToken = mimoParBalancerWeightedLpToken;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = IERC20Upgradeable(0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128); // PAR\n\n _swap(lpTokenWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n\n address tusdWhale = 0x161FbE0943Af4A39a50262026A81a243B635982d; // old XBombSwap\n address tdaiWhale = 0xd816eb4660615BBF080ddf425F28ea4AF30d04D5; // old XBombSwap\n address bombWhale = 0xd816eb4660615BBF080ddf425F28ea4AF30d04D5; // old XBombSwap\n\n function testSwappingBombTDaiChapel() public debuggingOnly fork(BSC_CHAPEL) {\n IERC20Upgradeable inputToken = chapelBomb;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = chapelTDai;\n\n _swap(bombWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n\n function testSwappingTUsdBombChapel() public debuggingOnly fork(BSC_CHAPEL) {\n IERC20Upgradeable inputToken = chapelTUsd;\n uint256 inputAmount = 1e18;\n IERC20Upgradeable outputToken = chapelBomb;\n\n _swap(tusdWhale, inputToken, inputAmount, outputToken, 5e16);\n }\n}\n" + }, + "contracts/test/LiquidityMining.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"forge-std/Vm.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { Auth, Authority } from \"solmate/auth/Auth.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { FlywheelStaticRewards } from \"../ionic/strategies/flywheel/rewards/FlywheelStaticRewards.sol\";\nimport { IFlywheelBooster } from \"../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20 } from \"../compound/CToken.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { AuthoritiesRegistry } from \"../ionic/AuthoritiesRegistry.sol\";\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\n\nimport { MockPriceOracle } from \"../oracles/1337/MockPriceOracle.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { IonicFlywheelLensRouter } from \"../ionic/strategies/flywheel/IonicFlywheelLensRouter.sol\";\nimport { IonicFlywheel } from \"../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicFlywheelCore } from \"../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract LiquidityMiningTest is BaseTest {\n MockERC20 underlyingToken;\n MockERC20 rewardToken;\n\n JumpRateModel interestModel;\n IonicComptroller comptroller;\n CErc20Delegate cErc20Delegate;\n ICErc20 cErc20;\n FeeDistributor ionicAdmin;\n PoolDirectory poolDirectory;\n\n IonicFlywheel flywheel;\n FlywheelStaticRewards rewards;\n IonicFlywheelLensRouter flywheelClaimer;\n\n address user = address(1337);\n\n uint8 baseDecimal;\n uint8 rewardDecimal;\n\n address[] markets;\n IonicFlywheelCore[] flywheelsToClaim;\n\n function setUpBaseContracts(uint8 _baseDecimal, uint8 _rewardDecimal) public {\n baseDecimal = _baseDecimal;\n rewardDecimal = _rewardDecimal;\n underlyingToken = new MockERC20(\"UnderlyingToken\", \"UT\", baseDecimal);\n rewardToken = new MockERC20(\"RewardToken\", \"RT\", rewardDecimal);\n interestModel = new JumpRateModel(2343665, 1 * 10**baseDecimal, 1 * 10**baseDecimal, 4 * 10**baseDecimal, 0.8e18);\n ionicAdmin = new FeeDistributor();\n ionicAdmin.initialize(1 * 10**(baseDecimal - 2));\n poolDirectory = new PoolDirectory();\n poolDirectory.initialize(false, new address[](0));\n cErc20Delegate = new CErc20Delegate();\n // set the new delegate as the latest\n ionicAdmin._setLatestCErc20Delegate(cErc20Delegate.delegateType(), address(cErc20Delegate), abi.encode(address(0)));\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = new CTokenFirstExtension();\n cErc20DelegateExtensions[1] = cErc20Delegate;\n ionicAdmin._setCErc20DelegateExtensions(address(cErc20Delegate), cErc20DelegateExtensions);\n }\n\n function setUpPoolAndMarket() public {\n MockPriceOracle priceOracle = new MockPriceOracle(10);\n Comptroller tempComptroller = new Comptroller();\n ionicAdmin._setLatestComptrollerImplementation(address(0), address(tempComptroller));\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = new ComptrollerFirstExtension();\n extensions[1] = tempComptroller;\n ionicAdmin._setComptrollerExtensions(address(tempComptroller), extensions);\n (, address comptrollerAddress) = poolDirectory.deployPool(\n \"TestPool\",\n address(tempComptroller),\n abi.encode(payable(address(ionicAdmin))),\n false,\n 0.1e18,\n 1.1e18,\n address(priceOracle)\n );\n\n Unitroller(payable(comptrollerAddress))._acceptAdmin();\n comptroller = IonicComptroller(comptrollerAddress);\n\n AuthoritiesRegistry impl = new AuthoritiesRegistry();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(1), \"\");\n AuthoritiesRegistry newAr = AuthoritiesRegistry(address(proxy));\n newAr.initialize(address(321));\n ionicAdmin.reinitialize(newAr);\n PoolRolesAuthority poolAuth = newAr.createPoolAuthority(comptrollerAddress);\n newAr.setUserRole(comptrollerAddress, user, poolAuth.BORROWER_ROLE(), true);\n\n vm.roll(1);\n comptroller._deployMarket(\n cErc20Delegate.delegateType(),\n abi.encode(\n address(underlyingToken),\n comptroller,\n payable(address(ionicAdmin)),\n InterestRateModel(address(interestModel)),\n \"CUnderlyingToken\",\n \"CUT\",\n uint256(1),\n uint256(0)\n ),\n \"\",\n 0.9e18\n );\n\n ICErc20[] memory allMarkets = comptroller.getAllMarkets();\n cErc20 = allMarkets[allMarkets.length - 1];\n }\n\n function setUpFlywheel() public {\n IonicFlywheel impl = new IonicFlywheel();\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(impl), address(dpa), \"\");\n flywheel = IonicFlywheel(address(proxy));\n flywheel.initialize(rewardToken, FlywheelStaticRewards(address(0)), IFlywheelBooster(address(0)), address(this));\n rewards = new FlywheelStaticRewards(IonicFlywheelCore(address(flywheel)), address(this), Authority(address(0)));\n flywheel.setFlywheelRewards(rewards);\n\n flywheelClaimer = new IonicFlywheelLensRouter(poolDirectory);\n\n flywheel.addStrategyForRewards(ERC20(address(cErc20)));\n\n // add flywheel as rewardsDistributor to call flywheelPreBorrowAction / flywheelPreSupplyAction\n require(comptroller._addRewardsDistributor(address(flywheel)) == 0);\n\n // seed rewards to flywheel\n rewardToken.mint(address(rewards), 100 * 10**rewardDecimal);\n\n // Start reward distribution at 1 token per second\n rewards.setRewardsInfo(\n ERC20(address(cErc20)),\n FlywheelStaticRewards.RewardsInfo({ rewardsPerSecond: uint224(1 * 10**rewardDecimal), rewardsEndTimestamp: 0 })\n );\n\n // preparation for a later call\n flywheelsToClaim.push(IonicFlywheelCore(address(flywheel)));\n }\n\n function _initialize(uint8 _baseDecimal, uint8 _rewardDecimal) internal {\n setUpBaseContracts(_baseDecimal, _rewardDecimal);\n setUpPoolAndMarket();\n setUpFlywheel();\n deposit(1 * 10**_baseDecimal);\n vm.warp(block.timestamp + 1);\n }\n\n function deposit(uint256 _amount) public {\n underlyingToken.mint(user, _amount);\n vm.startPrank(user);\n underlyingToken.approve(address(cErc20), _amount);\n comptroller.enterMarkets(markets);\n cErc20.mint(_amount);\n vm.stopPrank();\n }\n\n function _testIntegration() internal {\n uint256 percentFee = flywheel.performanceFee();\n uint224 percent100 = 100e16; //flywheel.ONE();\n\n // store expected rewards per token (1 token per second over total supply)\n uint256 rewardsPerTokenPlusFee = (1 * 10**rewardDecimal * 1 * 10**baseDecimal) / cErc20.totalSupply();\n uint256 rewardsPerTokenForFee = (rewardsPerTokenPlusFee * percentFee) / percent100;\n uint256 rewardsPerToken = rewardsPerTokenPlusFee - rewardsPerTokenForFee;\n\n // store expected user rewards (user balance times reward per second over 1 token)\n uint256 userRewards = (rewardsPerToken * cErc20.balanceOf(user)) / (1 * 10**baseDecimal);\n\n ERC20 asErc20 = ERC20(address(cErc20));\n // accrue rewards and check against expected\n assertEq(flywheel.accrue(asErc20, user), userRewards, \"!accrue amount\");\n\n // check market index\n (uint224 index, ) = flywheel.strategyState(asErc20);\n assertEq(index, 10**rewardDecimal + rewardsPerToken, \"!index\");\n\n // claim and check user balance\n flywheelClaimer.claimRewardsForMarket(user, asErc20, flywheelsToClaim, asArray(true));\n assertEq(rewardToken.balanceOf(user), userRewards, \"!user rewards\");\n\n // mint more tokens by user and rerun test\n deposit(1 * 10**baseDecimal);\n\n // for next test, advance 10 seconds instead of 1 (multiply expectations by 10)\n vm.warp(block.timestamp + 10);\n\n uint256 rewardsPerToken2PlusFee = (1 * 10**rewardDecimal * 1 * 10**baseDecimal) / cErc20.totalSupply();\n uint256 rewardsPerToken2ForFee = (rewardsPerToken2PlusFee * percentFee) / percent100;\n uint256 rewardsPerToken2 = rewardsPerToken2PlusFee - rewardsPerToken2ForFee;\n\n uint256 userRewards2 = (10 * (rewardsPerToken2 * cErc20.balanceOf(user))) / (1 * 10**baseDecimal);\n\n // accrue all unclaimed rewards and claim them\n flywheelClaimer.claimRewardsForMarket(user, asErc20, flywheelsToClaim, asArray(true));\n\n emit log_named_uint(\"userRewards\", userRewards);\n emit log_named_uint(\"userRewards2\", userRewards2);\n // user balance should accumulate from both rewards\n assertEq(rewardToken.balanceOf(user), userRewards + userRewards2, \"balance mismatch\");\n }\n\n function testIntegrationRewardStandard(uint8 i, uint8 j) public {\n vm.assume(i > 1);\n vm.assume(j > 1);\n vm.assume(i < 19);\n vm.assume(j < 19);\n\n _initialize(i, j);\n _testIntegration();\n }\n}\n" + }, + "contracts/test/MaxBorrowTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./helpers/WithPool.sol\";\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolLensSecondary } from \"../PoolLensSecondary.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract MockAsset is MockERC20 {\n constructor() MockERC20(\"test\", \"test\", 8) {}\n\n function deposit() external payable {}\n}\n\ncontract MaxBorrowTest is WithPool {\n address usdcWhale = 0x625E7708f30cA75bfd92586e17077590C60eb4cD;\n address daiWhale = 0x06959153B974D0D5fDfd87D561db6d8d4FA0bb0B;\n\n struct LiquidationData {\n address[] cTokens;\n ICErc20[] allMarkets;\n MockAsset usdc;\n MockAsset dai;\n }\n\n function afterForkSetUp() internal override {\n super.setUpWithPool(\n MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")),\n ERC20Upgradeable(ap.getAddress(\"wtoken\"))\n );\n\n if (block.chainid == POLYGON_MAINNET) {\n vm.prank(0x369582d2010B6eD950B571F4101e3bB9b554876F); // SAND/WMATIC\n MockERC20(address(underlyingToken)).transfer(address(this), 100e18);\n setUpPool(\"polygon-test\", false, 0.1e18, 1.1e18);\n } else if (block.chainid == BSC_MAINNET) {\n deal(address(underlyingToken), address(this), 100e18);\n setUpPool(\"bsc-test\", false, 0.1e18, 1.1e18);\n }\n }\n\n // TODO redeploy to polygon to fix\n function testMaxBorrow() public fork(POLYGON_MAINNET) {\n PoolLensSecondary poolLensSecondary = new PoolLensSecondary();\n poolLensSecondary.initialize(poolDirectory);\n\n LiquidationData memory vars;\n vm.roll(1);\n vars.usdc = MockAsset(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n vars.dai = MockAsset(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063);\n\n deployCErc20Delegate(address(vars.usdc), \"USDC\", \"usdc\", 0.9e18);\n deployCErc20Delegate(address(vars.dai), \"DAI\", \"dai\", 0.9e18);\n\n vars.allMarkets = comptroller.getAllMarkets();\n\n CErc20Delegate cToken = CErc20Delegate(address(vars.allMarkets[0]));\n\n CErc20Delegate cDaiToken = CErc20Delegate(address(vars.allMarkets[1]));\n\n vars.cTokens = new address[](1);\n\n address accountOne = address(1);\n PoolRolesAuthority pra = ionicAdmin.authoritiesRegistry().poolsAuthorities(address(comptroller));\n\n vm.startPrank(pra.owner());\n pra.setUserRole(accountOne, pra.BORROWER_ROLE(), true);\n vm.stopPrank();\n\n vm.prank(usdcWhale);\n MockERC20(address(vars.usdc)).transfer(accountOne, 10000e6);\n\n vm.prank(daiWhale);\n MockERC20(address(vars.dai)).transfer(accountOne, 10000e18);\n\n // Account One Supply\n {\n emit log(\"Account One Supply\");\n vm.startPrank(accountOne);\n vars.usdc.approve(address(cToken), 1e36);\n cToken.mint(1e6);\n vars.cTokens[0] = address(cToken);\n comptroller.enterMarkets(vars.cTokens);\n\n vars.dai.approve(address(cDaiToken), 1e36);\n cDaiToken.mint(1e18);\n vars.cTokens[0] = address(cDaiToken);\n comptroller.enterMarkets(vars.cTokens);\n\n vm.stopPrank();\n assertEq(cToken.totalSupply(), 1e6 * 5);\n assertEq(cDaiToken.totalSupply(), 1e18 * 5);\n\n uint256 maxBorrow = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n uint256 maxDaiBorrow = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cDaiToken)));\n assertApproxEqAbs((maxBorrow * 1e18) / 10**cToken.decimals(), maxDaiBorrow, uint256(1e16), \"!max borrow\");\n }\n\n // borrow cap for collateral test\n {\n vm.prank(comptroller.admin());\n comptroller._setBorrowCapForCollateral(address(cToken), address(cDaiToken), 0.5e6);\n }\n\n uint256 maxBorrowAfterBorrowCap = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n assertApproxEqAbs(maxBorrowAfterBorrowCap, 0.5e6, uint256(1e5), \"!max borrow\");\n\n // blacklist\n {\n vm.prank(comptroller.admin());\n comptroller._blacklistBorrowingAgainstCollateral(address(cToken), address(cDaiToken), true);\n }\n\n uint256 maxBorrowAfterBlacklist = poolLensSecondary.getMaxBorrow(accountOne, ICErc20(address(cToken)));\n assertEq(maxBorrowAfterBlacklist, 0, \"!blacklist\");\n }\n\n // TODO test with the latest block and contracts and/or without the FSL\n function testBorrowCapPerCollateral() public debuggingOnly forkAtBlock(BSC_MAINNET, 23761190) {\n address payable jFiatPoolAddress = payable(0x31d76A64Bc8BbEffb601fac5884372DEF910F044);\n\n address poolAddress = jFiatPoolAddress;\n Comptroller pool = Comptroller(poolAddress);\n\n ComptrollerFirstExtension asExtension = ComptrollerFirstExtension(poolAddress);\n address[] memory borrowers = asExtension.getAllBorrowers();\n address someBorrower = borrowers[1];\n\n ICErc20[] memory markets = asExtension.getAllMarkets();\n for (uint256 i = 0; i < markets.length; i++) {\n ICErc20 market = markets[i];\n uint256 borrowed = market.borrowBalanceCurrent(someBorrower);\n if (borrowed > 0) {\n emit log(\"borrower has borrowed\");\n emit log_uint(borrowed);\n emit log(\"from market\");\n emit log_address(address(market));\n emit log_uint(i);\n emit log(\"\");\n }\n\n uint256 collateral = market.balanceOf(someBorrower);\n if (collateral > 0) {\n emit log(\"has collateral\");\n emit log_uint(collateral);\n emit log(\"in market\");\n emit log_address(address(market));\n emit log_uint(i);\n emit log(\"\");\n }\n }\n\n ICErc20 marketToBorrow = markets[0];\n ICErc20 cappedCollateralMarket = markets[6];\n uint256 borrowAmount = marketToBorrow.borrowBalanceCurrent(someBorrower);\n\n {\n (uint256 errBefore, , uint256 liquidityBefore, uint256 shortfallBefore) = pool.getHypotheticalAccountLiquidity(\n someBorrower,\n address(marketToBorrow),\n 0,\n borrowAmount,\n 0\n );\n emit log(\"errBefore\");\n emit log_uint(errBefore);\n emit log(\"liquidityBefore\");\n emit log_uint(liquidityBefore);\n emit log(\"shortfallBefore\");\n emit log_uint(shortfallBefore);\n\n assertGt(liquidityBefore, 0, \"expected positive liquidity\");\n }\n\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateral(address(marketToBorrow), address(cappedCollateralMarket), 1);\n emit log(\"\");\n\n (uint256 errAfter, , uint256 liquidityAfter, uint256 shortfallAfter) = pool.getHypotheticalAccountLiquidity(\n someBorrower,\n address(marketToBorrow),\n 0,\n borrowAmount,\n 0\n );\n emit log(\"errAfter\");\n emit log_uint(errAfter);\n emit log(\"liquidityAfter\");\n emit log_uint(liquidityAfter);\n emit log(\"shortfallAfter\");\n emit log_uint(shortfallAfter);\n\n assertGt(shortfallAfter, 0, \"expected some shortfall\");\n }\n}\n" + }, + "contracts/test/MinBorrowTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ncontract MinBorrowTest is BaseTest {\n FeeDistributor ffd;\n\n function afterForkSetUp() internal override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n }\n\n function testMinBorrow() public fork(BSC_MAINNET) {\n IERC20Upgradeable usdc = IERC20Upgradeable(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20Upgradeable busd = IERC20Upgradeable(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n ICErc20 usdcMarket = ICErc20(0x16B8da195CdC7F380B333bf6cF2f0f33c1061755);\n ICErc20 busdMarket = ICErc20(0x3BCb7dbBe729B24bE6c660B3e8ADD1Cb352e371D);\n IonicComptroller comptroller = usdcMarket.comptroller();\n deal(address(usdc), address(this), 10000e18);\n deal(address(busd), address(1), 10000e18);\n\n usdc.approve(address(usdcMarket), 1e36);\n usdcMarket.mint(1000e18);\n\n vm.startPrank(address(1));\n busd.approve(address(busdMarket), 1e36);\n busdMarket.mint(1000e18);\n vm.stopPrank();\n\n // the 0 liquidity base min borrow amount\n uint256 baseMinBorrowEth = ffd.minBorrowEth();\n\n address[] memory cTokens = new address[](2);\n cTokens[0] = address(usdcMarket);\n cTokens[1] = address(busdMarket);\n comptroller.enterMarkets(cTokens);\n\n uint256 minBorrowEth = ffd.getMinBorrowEth(busdMarket);\n assertEq(minBorrowEth, baseMinBorrowEth, \"!minBorrowEth for default min borrow eth\");\n\n busdMarket.borrow(300e18);\n\n minBorrowEth = ffd.getMinBorrowEth(busdMarket);\n assertEq(minBorrowEth, 0, \"!minBorrowEth after borrowing less amount than min amount\");\n }\n}\n" + }, + "contracts/test/OracleProtectedTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { UpgradesBaseTest } from \"./UpgradesBaseTest.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { CTokenFirstExtension, DiamondExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { InterestRateModel } from \"../compound/InterestRateModel.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\ncontract MockOraclePasses is IHypernativeOracle {\n function register(address account, bool isStrictMode) external pure {}\n\n function validateForbiddenAccountInteraction(address sender) external pure {}\n\n function validateForbiddenContextInteraction(address origin, address sender) external pure {}\n\n function validateBlacklistedAccountInteraction(address sender) external pure {}\n}\n\ncontract MockOracleFails is IHypernativeOracle {\n error InteractionNotAllowed();\n function register(address account, bool isStrictMode) external pure {}\n\n function validateForbiddenAccountInteraction(address sender) external pure {\n revert InteractionNotAllowed();\n }\n\n function validateForbiddenContextInteraction(address origin, address sender) external pure {\n revert InteractionNotAllowed(); \n }\n\n function validateBlacklistedAccountInteraction(address sender) external pure {\n revert InteractionNotAllowed();\n }\n}\n\ncontract OracleProtectedTest is UpgradesBaseTest {\n error InteractionNotAllowed();\n ICErc20 market = ICErc20(0x49420311B518f3d0c94e897592014de53831cfA3);\n address admin = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n IHypernativeOracle oraclePasses;\n IHypernativeOracle oracleFails;\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n _upgradeMarketWithExtension(market);\n oraclePasses = new MockOraclePasses();\n oracleFails = new MockOracleFails();\n }\n\n function test_mint_failsForBlacklisted() public debuggingOnly forkAtBlock(BASE_MAINNET, 20538729) {\n CTokenFirstExtension asExt = CTokenFirstExtension(address(market)); \n // Set up the oracle\n vm.startPrank(admin);\n ap.setAddress(\"HYPERNATIVE_ORACLE\", address(oracleFails));\n vm.stopPrank();\n \n // Try to mint\n address user = address(0x1234);\n uint256 mintAmount = 1e18;\n deal(asExt.underlying(), user, mintAmount);\n \n vm.startPrank(user);\n ICErc20(asExt.underlying()).approve(address(asExt), mintAmount);\n \n vm.expectRevert(InteractionNotAllowed.selector);\n market.mint(mintAmount);\n vm.stopPrank();\n\n // Set up the oracle to pass\n vm.prank(admin);\n ap.setAddress(\"HYPERNATIVE_ORACLE\", address(oraclePasses));\n\n vm.startPrank(user);\n market.mint(mintAmount);\n vm.stopPrank();\n\n // check balances\n assertGt(market.balanceOf(user), 0);\n }\n}\n" + }, + "contracts/test/oracles/default/ChainlinkOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\n\ncontract ChainlinkOraclesTest is BaseTest {\n ChainlinkPriceOracleV2 oracle;\n\n address usdcPolygon = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;\n address usdtPolygon = 0xc2132D05D31c914a87C6611C10748AEb04B58e8F;\n address usdcFeedPolygon = 0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7;\n address usdtFeedPolygon = 0x0A6513e40db6EB1b165753AD52E80663aeA50545;\n\n address jBRLBsc = 0x316622977073BBC3dF32E7d2A9B3c77596a0a603;\n address jBRLFeedBsc = 0x5cb1Cb3eA5FB46de1CE1D0F3BaDB3212e8d8eF48;\n address usdcBsc = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n address usdtBsc = 0x55d398326f99059fF775485246999027B3197955;\n address usdtFeedBsc = 0xB97Ad0E74fa7d920791E90258A6E2085088b4320;\n address usdcFeedBsc = 0x51597f405303C4377E36123cBc172b13269EA163;\n ICErc20 usdcMarketBsc = ICErc20(0x8D5bE2768c335e88b71E4e913189AEE7104f01B4);\n ICErc20 usdtMarketBsc = ICErc20(0x1F73754c135d5B9fDE674806f43AeDfA2c7eaDb5);\n\n function afterForkSetUp() internal override {\n oracle = ChainlinkPriceOracleV2(ap.getAddress(\"ChainlinkPriceOracleV2\"));\n }\n\n function setUpOracleFeed(address testedTokenAddress, address aggregatorAddress) internal {\n address[] memory underlyings = new address[](1);\n underlyings[0] = testedTokenAddress;\n address[] memory aggregators = new address[](1);\n aggregators[0] = aggregatorAddress;\n\n vm.prank(oracle.owner());\n oracle.setPriceFeeds(underlyings, aggregators, ChainlinkPriceOracleV2.FeedBaseCurrency.USD);\n }\n\n function testJBRLPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(jBRLBsc, jBRLFeedBsc);\n assert(oracle.price(jBRLBsc) > 0);\n }\n\n function testBSCChainlinkUSDCPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdcBsc, usdcFeedBsc);\n uint256 price = oracle.price(usdcBsc);\n uint256 underlyingPrice = oracle.getUnderlyingPrice(usdcMarketBsc);\n assertEq(price, underlyingPrice);\n }\n\n function testBSCChainlinkUSDTPrice() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdtBsc, usdtFeedBsc);\n uint256 price = oracle.price(usdtBsc);\n uint256 underlyingPrice = oracle.getUnderlyingPrice(usdtMarketBsc);\n assertEq(price, underlyingPrice);\n }\n\n function testUsdcUsdtDeviationBsc() public fork(BSC_MAINNET) {\n setUpOracleFeed(usdtBsc, usdtFeedBsc);\n setUpOracleFeed(usdcBsc, usdcFeedBsc);\n\n uint256 usdtPrice = oracle.getUnderlyingPrice(usdtMarketBsc);\n uint256 usdcPrice = oracle.getUnderlyingPrice(usdcMarketBsc);\n\n assertApproxEqAbs(usdtPrice, usdcPrice, 1e16, \"usd prices differ too much\");\n }\n\n function testUsdcUsdtDeviationPolygon() public fork(POLYGON_MAINNET) {\n setUpOracleFeed(usdtPolygon, usdtFeedPolygon);\n setUpOracleFeed(usdcPolygon, usdcFeedPolygon);\n\n uint256 usdtPrice = oracle.price(usdtPolygon);\n uint256 usdcPrice = oracle.price(usdcPolygon);\n\n assertApproxEqAbs(usdtPrice, usdcPrice, 1e16, \"usd prices differ too much\");\n }\n}\n" + }, + "contracts/test/oracles/default/ERC4626OracleAndLiquidatorTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { ERC4626Oracle } from \"../../../oracles/default/ERC4626Oracle.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { IERC4626 } from \"../../../compound/IERC4626.sol\";\nimport { ChainlinkPriceOracleV2 } from \"../../../oracles/default/ChainlinkPriceOracleV2.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\n\nimport { IUniswapV3Factory } from \"../../../external/uniswap/IUniswapV3Factory.sol\";\nimport { Quoter } from \"../../../external/uniswap/quoter/Quoter.sol\";\nimport { IUniswapV3Pool } from \"../../../external/uniswap/IUniswapV3Pool.sol\";\nimport { ISwapRouter } from \"../../../external/uniswap/ISwapRouter.sol\";\nimport { ERC4626Liquidator } from \"../../../liquidators/ERC4626Liquidator.sol\";\n\ncontract ERC4626OracleAndLiquidatorTest is BaseTest {\n // TODO: refactor this into oracle and liquidator tests once oracles are deployed\n // TODO: refactor oracle set up using the address provider\n\n MasterPriceOracle mpo;\n ChainlinkPriceOracleV2 chainlinkOracle;\n ERC4626Oracle erc4626Oracle;\n\n IERC20Upgradeable wethToken;\n IERC20Upgradeable wbtcToken;\n IERC20Upgradeable daiToken;\n IERC20Upgradeable usdcToken;\n IERC20Upgradeable usdtToken;\n\n address nativeUsdPriceFeed;\n address usdcEthPriceFeed;\n address wbtcEthPriceFeed;\n\n IERC4626 erc4626Vault;\n address[] underlyingTokens;\n ERC4626Liquidator liquidator;\n\n address usdcMarketAddress;\n address univ3SwapRouter;\n\n uint256 poolFee;\n\n Quoter quoter;\n\n address holder;\n\n function setUpErc4626Oracle() public {\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n erc4626Oracle = new ERC4626Oracle();\n vm.prank(erc4626Oracle.owner());\n erc4626Oracle.initialize();\n oracles[0] = erc4626Oracle;\n vm.prank(mpo.admin());\n mpo.add(asArray(address(erc4626Vault)), oracles);\n }\n\n function setUpBaseOracles() public {\n setUpMpoAndAddresses();\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\n chainlinkOracle = new ChainlinkPriceOracleV2();\n chainlinkOracle.initialize(address(usdcToken), nativeUsdPriceFeed);\n vm.prank(chainlinkOracle.owner());\n chainlinkOracle.setPriceFeeds(\n asArray(address(usdcToken), address(wbtcToken)),\n asArray(usdcEthPriceFeed, wbtcEthPriceFeed),\n ChainlinkPriceOracleV2.FeedBaseCurrency.ETH\n );\n oracles[0] = BasePriceOracle(address(chainlinkOracle));\n oracles[1] = BasePriceOracle(address(chainlinkOracle));\n\n vm.prank(mpo.admin());\n mpo.add(asArray(address(usdcToken), address(wbtcToken)), oracles);\n }\n\n function setUpMpoAndAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n usdcToken = IERC20Upgradeable(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n daiToken = IERC20Upgradeable(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n usdtToken = IERC20Upgradeable(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n wbtcToken = IERC20Upgradeable(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n wethToken = IERC20Upgradeable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n nativeUsdPriceFeed = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;\n usdcEthPriceFeed = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4;\n wbtcEthPriceFeed = 0xdeb288F737066589598e9214E782fa5A8eD689e8;\n\n address[] memory assets = new address[](0);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\n mpo = new MasterPriceOracle();\n mpo.initialize(assets, oracles, BasePriceOracle(address(0)), address(this), true, address(wethToken));\n }\n }\n\n function setupRealYieldStrategyUsdAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n underlyingTokens = asArray(address(usdcToken), address(daiToken), address(usdtToken)); // USDC, 6 decimals\n poolFee = 10;\n erc4626Vault = IERC4626(0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E); // USDC-DAI-USDT Real Yield\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n holder = 0x3541Fda19b09769A938EB2A5f5154b01aE5b0869;\n }\n liquidator = new ERC4626Liquidator();\n }\n\n function setupEthBtcStrategyAddresses() public {\n if (block.chainid == ETHEREUM_MAINNET) {\n underlyingTokens = asArray(address(usdcToken), address(wbtcToken), address(wethToken));\n poolFee = 500;\n erc4626Vault = IERC4626(0x6b7f87279982d919Bbf85182DDeAB179B366D8f2); // ETH-BTC trend\n quoter = new Quoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n univ3SwapRouter = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n holder = 0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3;\n }\n liquidator = new ERC4626Liquidator();\n }\n\n function testRealYieldErc4626PriceOracle() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupRealYieldStrategyUsdAddresses();\n setUpErc4626Oracle();\n\n uint256 priceRealYieldUsdc = mpo.price(address(erc4626Vault));\n uint256 priceUsdc = mpo.price(address(usdcToken));\n\n // Approximate only -- these should not match.\n assertApproxEqRel(priceRealYieldUsdc, priceUsdc, 3e16, \"!diff > 3%\");\n }\n\n function testRealYieldUsdErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupRealYieldStrategyUsdAddresses();\n setUpErc4626Oracle();\n executeTestRedemptionStrategy(usdcToken);\n }\n\n function testEthBtcMomementumErc4626RedemptionStrategy() public fork(ETHEREUM_MAINNET) {\n setUpBaseOracles();\n setupEthBtcStrategyAddresses();\n setUpErc4626Oracle();\n executeTestRedemptionStrategy(wethToken);\n }\n\n function executeTestRedemptionStrategy(IERC20Upgradeable _outputToken) internal {\n uint256 balance = erc4626Vault.balanceOf(holder);\n assertTrue(balance > 0);\n\n // impersonate the holder\n vm.prank(holder);\n\n // fund the liquidator so it can redeem the tokens\n erc4626Vault.transfer(address(liquidator), balance);\n\n bytes memory data = abi.encode(address(_outputToken), poolFee, univ3SwapRouter, underlyingTokens, quoter);\n\n // redeem the underlying reward token\n (IERC20Upgradeable outputToken, uint256 outputAmount) = liquidator.redeem(\n IERC20Upgradeable(address(erc4626Vault)),\n balance,\n data\n );\n\n // ensure the output token is the expected token\n assertEq(address(outputToken), address(_outputToken));\n\n uint256 liquidatorBalance = _outputToken.balanceOf(address(liquidator));\n // get the redeemed value of the erc4626 token\n uint256 redeemValue = (mpo.price(address(erc4626Vault)) * balance) / 1e18;\n // get the redeemed value of the output token\n uint256 redeemOutputTokenValue = (mpo.price(address(_outputToken)) * liquidatorBalance) /\n 10 ** ERC20Upgradeable(address(_outputToken)).decimals();\n // ensure they are approximately equal\n assertApproxEqRel(redeemValue, redeemOutputTokenValue, 3e16, \"!diff > 3%\");\n\n uint256 maxVal = redeemValue > redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\n uint256 minVal = redeemValue < redeemOutputTokenValue ? redeemValue : redeemOutputTokenValue;\n\n uint256 absoluteDifference = maxVal - minVal;\n uint256 percentageDifference = (absoluteDifference * 10000) / maxVal; // Multiplied by 10000 for 2 decimal places of precision\n\n // log the differences\n emit log_named_uint(\"redeemOutputTokenValue\", redeemOutputTokenValue);\n emit log_named_uint(\"redeemValue\", redeemValue);\n emit log_named_uint(\"base 1000 diff\", percentageDifference);\n }\n}\n" + }, + "contracts/test/oracles/default/MasterPriceOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"../../../compound/CTokenInterfaces.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { MockRevertPriceOracle } from \"../../../oracles/1337/MockRevertPriceOracle.sol\";\n\ncontract MasterPriceOracleTest is BaseTest {\n MasterPriceOracle mpo;\n SimplePriceOracle mainOracle;\n SimplePriceOracle fallbackOracle;\n MockRevertPriceOracle revertingOracle;\n ICErc20 mockCToken;\n address someAdminAccount = address(94949);\n address ezETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address ionezETH = 0x59e710215d45F584f44c0FEe83DA6d43D762D857;\n\n function afterForkSetUp() internal override {\n MasterPriceOracle newMpo = new MasterPriceOracle();\n SimplePriceOracle defaultOracle = new SimplePriceOracle();\n\n address[] memory underlyings = new address[](0);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](0);\n\n vm.prank(someAdminAccount);\n newMpo.initialize(underlyings, oracles, defaultOracle, someAdminAccount, true, address(0));\n\n mpo = newMpo;\n\n SimplePriceOracle impl = new SimplePriceOracle();\n vm.prank(address(someAdminAccount));\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(impl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n mainOracle = SimplePriceOracle(address(proxy));\n\n SimplePriceOracle fallbackImpl = new SimplePriceOracle();\n vm.prank(address(someAdminAccount));\n TransparentUpgradeableProxy fallbackProxy = new TransparentUpgradeableProxy(\n address(fallbackImpl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n fallbackOracle = SimplePriceOracle(address(fallbackProxy));\n\n vm.startPrank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 2000);\n fallbackOracle.setDirectPrice(ezETH, 2000);\n vm.stopPrank();\n\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(mainOracle);\n BasePriceOracle[] memory fallbackOraclesToAdd = new BasePriceOracle[](1);\n fallbackOraclesToAdd[0] = BasePriceOracle(fallbackOracle);\n\n vm.startPrank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n mpo.addFallbacks(tokens, fallbackOraclesToAdd);\n vm.stopPrank();\n\n revertingOracle = new MockRevertPriceOracle();\n }\n\n function testGetUnderlyingPrice() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenZero() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 0);\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenZeroAddressOracle() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(0x0000000000000000000000000000000000000000);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testGetUnderlyingPriceWhenOracleReverts() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(revertingOracle);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.getUnderlyingPrice(ICErc20(ionezETH));\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPrice() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenZero() public fork(MODE_MAINNET) {\n vm.prank(someAdminAccount);\n mainOracle.setDirectPrice(ezETH, 0);\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenZeroAddressOracle() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(0x0000000000000000000000000000000000000000);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n\n function testPriceWhenOracleReverts() public fork(MODE_MAINNET) {\n address[] memory tokens = new address[](1);\n tokens[0] = ezETH;\n\n BasePriceOracle[] memory oraclesToAdd = new BasePriceOracle[](1);\n oraclesToAdd[0] = BasePriceOracle(revertingOracle);\n\n vm.prank(someAdminAccount);\n mpo.add(tokens, oraclesToAdd);\n\n uint256 price = mpo.price(ezETH);\n assertEq(price, 2000, \"Price should match the mock price\");\n }\n}\n" + }, + "contracts/test/oracles/default/PythPriceOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PythPriceOracle } from \"../../../oracles/default/PythPriceOracle.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { IPyth } from \"@pythnetwork/pyth-sdk-solidity/MockPyth.sol\";\nimport { PythStructs } from \"@pythnetwork/pyth-sdk-solidity/PythStructs.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\n\ncontract PythPriceOracleTest is BaseTest {\n PythPriceOracle oracle;\n IPyth pythOracle;\n MasterPriceOracle mpo;\n\n address stable;\n address wtoken;\n address wbtc;\n\n address neonPyth = 0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5;\n address lineaPyth = 0xA2aa501b19aff244D90cc15a4Cf739D2725B5729;\n address polygonPyth = 0xff1a0f4744e8582DF1aE09D5611b887B6a12925C;\n address zkevmPyth = 0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65;\n\n bytes32 ethUsdTokenPriceFeed = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;\n bytes32 btcUsdTokenPriceFeed = 0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43;\n bytes32 neonUsdTokenPriceFeed = 0xd82183dd487bef3208a227bb25d748930db58862c5121198e723ed0976eb92b7;\n bytes32 maticUsdTokenPriceFeed = 0x5de33a9112c2b700b8d30b8a3402c103578ccfa2765696471cc672bd5cf6ac52;\n bytes32 usdcUsdTokenPriceFeed = 0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a;\n\n function afterForkSetUp() internal override {\n stable = ap.getAddress(\"stableToken\");\n wtoken = ap.getAddress(\"wtoken\");\n wbtc = ap.getAddress(\"wBTCToken\");\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n oracle = new PythPriceOracle();\n\n // create an array of bytes to pass to the oracle\n bytes32[] memory feedIds = new bytes32[](2);\n feedIds[0] = usdcUsdTokenPriceFeed;\n feedIds[1] = btcUsdTokenPriceFeed;\n vm.startPrank(mpo.admin());\n\n if (block.chainid == NEON_MAINNET) {\n oracle.initialize(neonPyth, neonUsdTokenPriceFeed, stable);\n } else if (block.chainid == LINEA_MAINNET) {\n oracle.initialize(lineaPyth, ethUsdTokenPriceFeed, stable);\n } else if (block.chainid == POLYGON_MAINNET) {\n oracle.initialize(polygonPyth, maticUsdTokenPriceFeed, stable);\n } else if (block.chainid == ZKEVM_MAINNET) {\n oracle.initialize(zkevmPyth, ethUsdTokenPriceFeed, stable);\n } else {\n revert(\"Unsupported chain\");\n }\n oracle.setPriceFeeds(asArray(stable, wbtc), feedIds);\n vm.stopPrank();\n }\n\n function testPolygonTokenPrice() public debuggingOnly fork(POLYGON_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(polygonPyth).getPriceUnsafe(maticUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n\n function testLineaTokenPrice() public debuggingOnly fork(LINEA_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(lineaPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e17);\n }\n\n function testNeonTokenPrice() public debuggingOnly fork(NEON_MAINNET) {\n PythStructs.Price memory pythPriceNeon = IPyth(neonPyth).getPriceUnsafe(neonUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPriceNeon.price)));\n emit log_named_uint(\"updated\", pythPriceNeon.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n PythStructs.Price memory pythPrice = IPyth(neonPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n\n function testZkEvmTokenPrice() public fork(ZKEVM_MAINNET) {\n PythStructs.Price memory pythPrice = IPyth(zkevmPyth).getPriceUnsafe(btcUsdTokenPriceFeed);\n emit log_named_uint(\"price\", uint256(uint64(pythPrice.price)));\n emit log_named_uint(\"updated\", pythPrice.publishTime);\n emit log_named_uint(\"ts\", block.timestamp);\n\n uint256 price = oracle.price(wbtc);\n uint256 priceMpo = mpo.price(wbtc);\n assertApproxEqRel(price, priceMpo, 1e16);\n }\n}\n" + }, + "contracts/test/oracles/default/SimplePriceOracleTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { SimplePriceOracle } from \"../../../oracles/default/SimplePriceOracle.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract SimplePriceOracleTest is BaseTest {\n SimplePriceOracle oracle;\n MasterPriceOracle mpo;\n address someAdminAccount = address(94949);\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n SimplePriceOracle impl = new SimplePriceOracle();\n\n vm.prank(someAdminAccount);\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(impl),\n address(dpa),\n abi.encodePacked(impl.initialize.selector)\n );\n oracle = SimplePriceOracle(address(proxy));\n }\n\n function testSimplePO() public fork(BSC_MAINNET) {\n vm.expectRevert(\"Ownable: caller is not the owner\");\n oracle.setDirectPrice(address(1), 1);\n\n vm.prank(someAdminAccount);\n oracle.setDirectPrice(address(1), 1);\n }\n}\n" + }, + "contracts/test/oracles/default/TwapOraclesBaseTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { UniswapTwapPriceOracleV2Factory } from \"../../../oracles/default/UniswapTwapPriceOracleV2Factory.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"../../../oracles/default/UniswapTwapPriceOracleV2Root.sol\";\nimport { UniswapTwapPriceOracleV2 } from \"../../../oracles/default/UniswapTwapPriceOracleV2.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\nimport { BasePriceOracle } from \"../../../oracles/BasePriceOracle.sol\";\nimport { IUniswapV2Pair } from \"../../../external/uniswap/IUniswapV2Pair.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\n\ncontract TwapOraclesBaseTest is BaseTest {\n IUniswapV2Factory uniswapV2Factory;\n UniswapTwapPriceOracleV2Factory twapPriceOracleFactory;\n MasterPriceOracle mpo;\n\n function afterForkSetUp() internal override {\n uniswapV2Factory = IUniswapV2Factory(ap.getAddress(\"IUniswapV2Factory\"));\n twapPriceOracleFactory = UniswapTwapPriceOracleV2Factory(ap.getAddress(\"UniswapTwapPriceOracleV2Factory\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n // BOMB\n function testBombTwapOraclePrice() public fork(BSC_MAINNET) {\n address baseToken = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c; // WBTC\n address testedAssetTokenAddress = 0x522348779DCb2911539e76A1042aA922F9C47Ee3; // BOMB\n\n assertTrue(getTokenTwapPrice(testedAssetTokenAddress, baseToken) > 0);\n }\n\n function getTokenTwapPrice(address tokenAddress, address baseTokenAddress) internal returns (uint256) {\n address testedPairAddress = uniswapV2Factory.getPair(tokenAddress, baseTokenAddress);\n\n // trigger a price update\n UniswapTwapPriceOracleV2Root twapOracleRoot = UniswapTwapPriceOracleV2Root(twapPriceOracleFactory.rootOracle());\n address[] memory pairs = new address[](1);\n pairs[0] = testedPairAddress;\n twapOracleRoot.update(pairs);\n\n // check if the base toke oracle is present in the master price oracle\n if (address(mpo.oracles(tokenAddress)) == address(0)) {\n // deploy or get the base token twap oracle\n address oracleAddress = twapPriceOracleFactory.deploy(address(uniswapV2Factory), baseTokenAddress);\n UniswapTwapPriceOracleV2 oracle = UniswapTwapPriceOracleV2(oracleAddress);\n // add the new twap oracle to the master oracle\n address[] memory underlyings = new address[](1);\n underlyings[0] = tokenAddress;\n BasePriceOracle[] memory oracles = new BasePriceOracle[](1);\n oracles[0] = oracle;\n // impersonate the admin to add the oracle\n vm.prank(mpo.admin());\n mpo.add(underlyings, oracles);\n emit log(\"added the oracle\");\n } else {\n emit log(\"found the oracle\");\n }\n\n // return the price denominated in W_NATIVE\n return mpo.price(tokenAddress);\n }\n\n // function testChapelEthBusdOraclePrice() public {\n // address baseToken = 0x7ef95a0FEE0Dd31b22626fA2e10Ee6A223F8a684; // USDT\n // address testedAssetTokenAddress = 0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7; // BUSD\n // assertTrue(getTokenTwapPrice(testedAssetTokenAddress, baseToken) > 0);\n // }\n}\n" + }, + "contracts/test/oracles/default/UniswapTwapPriceOracleV2Resolver.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MasterPriceOracle } from \"../../../oracles/MasterPriceOracle.sol\";\nimport { UniswapTwapPriceOracleV2Root } from \"../../../oracles/default/UniswapTwapPriceOracleV2Root.sol\";\nimport { IUniswapV2Factory } from \"../../../external/uniswap/IUniswapV2Factory.sol\";\nimport { UniswapTwapPriceOracleV2Resolver } from \"../../../oracles/default/UniswapTwapPriceOracleV2Resolver.sol\";\nimport { IUniswapV2Pair } from \"../../../external/uniswap/IUniswapV2Pair.sol\";\n\nimport { BaseTest } from \"../../config/BaseTest.t.sol\";\n\ncontract UniswapTwapOracleV2ResolverTest is BaseTest {\n UniswapTwapPriceOracleV2Root twapPriceOracleRoot;\n UniswapTwapPriceOracleV2Resolver resolver;\n IUniswapV2Factory uniswapV2Factory;\n MasterPriceOracle mpo;\n\n struct Observation {\n uint32 timestamp;\n uint256 price0Cumulative;\n uint256 price1Cumulative;\n }\n\n function afterForkSetUp() internal override {\n uniswapV2Factory = IUniswapV2Factory(ap.getAddress(\"IUniswapV2Factory\"));\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function getTokenTwapPrice(address tokenAddress) internal view returns (uint256) {\n // return the price denominated in W_NATIVE\n return mpo.price(tokenAddress);\n }\n}\n" + }, + "contracts/test/oracles/RedstoneAdapterOracleTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { MasterPriceOracle } from \"../../oracles/MasterPriceOracle.sol\";\nimport { RedstoneAdapterPriceOracle } from \"../../oracles/default/RedstoneAdapterPriceOracle.sol\";\n\nimport { BaseTest } from \"../config/BaseTest.t.sol\";\n\ncontract RedstoneAdapterOracleTest is BaseTest {\n MasterPriceOracle public mpo;\n RedstoneAdapterPriceOracle public oracle;\n address public redstoneOracleAddress;\n address MODE_USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f;\n address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5;\n address MODE_WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF;\n address MODE_WEETH = 0x028227c4dd1e5419d11Bb6fa6e661920c519D4F5;\n\n function afterForkSetUp() internal override {\n if (block.chainid == MODE_MAINNET) {\n redstoneOracleAddress = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256;\n }\n\n oracle = new RedstoneAdapterPriceOracle(redstoneOracleAddress);\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n }\n\n function testPrintPricesMode() public fork(MODE_MAINNET) {\n emit log_named_uint(\"ezETH price (18 dec)\", oracle.price(MODE_EZETH));\n emit log_named_uint(\"WBTC price (8 dec)\", oracle.price(MODE_WBTC));\n emit log_named_uint(\"weETH price (18 dec)\", oracle.price(MODE_WEETH));\n }\n\n function testPrintMpoPricesMode() public fork(MODE_MAINNET) {\n emit log_named_uint(\"weETH price (18 dec)\", mpo.price(MODE_WEETH));\n }\n}\n" + }, + "contracts/test/OraclesDecimalsScalingTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\ncontract OraclesDecimalsScalingTest is BaseTest {\n MasterPriceOracle mpo;\n PoolDirectory poolDirectory;\n address stable;\n\n function afterForkSetUp() internal override {\n mpo = MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n poolDirectory = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n stable = ap.getAddress(\"stableToken\");\n }\n\n function testOracleDecimalsBsc() public fork(BSC_MAINNET) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsArbitrum() public fork(ARBITRUM_ONE) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsPolygon() public fork(POLYGON_MAINNET) {\n testOraclesDecimals();\n }\n\n function testOracleDecimalsNeon() public fork(NEON_MAINNET) {\n vm.mockCall(stable, abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector), abi.encode(6));\n // SOL\n vm.mockCall(\n 0x5f38248f339Bf4e84A2caf4e4c0552862dC9F82a,\n abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector),\n abi.encode(9)\n );\n testOraclesDecimals();\n }\n\n function testOraclesDecimals() internal {\n if (address(poolDirectory) != address(0)) {\n (, PoolDirectory.Pool[] memory pools) = poolDirectory.getActivePools();\n\n for (uint8 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n ICErc20[] memory markets = comptroller.getAllMarkets();\n for (uint8 j = 0; j < markets.length; j++) {\n address underlying = markets[j].underlying();\n\n if (isSkipped(underlying)) {\n emit log(\"the oracle for this underlying cannot be tested\");\n emit log_address(underlying);\n continue;\n }\n\n uint256 oraclePrice = mpo.price(underlying);\n uint256 scaledPrice = mpo.getUnderlyingPrice(markets[j]);\n\n uint8 decimals = IERC20MetadataUpgradeable(underlying).decimals();\n uint256 expectedScaledPrice = decimals <= 18\n ? uint256(oraclePrice) * (10 ** (18 - decimals))\n : uint256(oraclePrice) / (10 ** (decimals - 18));\n\n assertEq(scaledPrice, expectedScaledPrice, \"the comptroller expects prices to be scaled by 1e(36-decimals)\");\n }\n }\n }\n }\n\n function isSkipped(address token) internal pure returns (bool) {\n return token == 0x5f38248f339Bf4e84A2caf4e4c0552862dC9F82a; // SOL on neon, failing for unknwon reasons, works in HH\n }\n}\n" + }, + "contracts/test/PermissionedLiquidationsMarketTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { MarketsTest } from \"./config/MarketsTest.t.sol\";\n\nimport { DiamondExtension, DiamondBase } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { ComptrollerV3Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ILiquidator } from \"../ILiquidator.sol\";\n\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IRedemptionStrategy } from \"../liquidators/IRedemptionStrategy.sol\";\nimport { IFundsConversionStrategy } from \"../liquidators/IFundsConversionStrategy.sol\";\n\ncontract PermissionedLiquidationsMarketTest is MarketsTest {\n ICErc20 wethMarket;\n ICErc20 usdtMarket;\n\n ICErc20 wethNativeMarket;\n ICErc20 usdcNativeMarket;\n ICErc20 usdtNativeMarket;\n ICErc20 modeNativeMarket;\n\n IonicComptroller pool;\n PoolLens lens;\n address borrower;\n address liquidator;\n IonicUniV3Liquidator uniV3liquidator;\n\n function afterForkSetUp() internal virtual override {\n super.afterForkSetUp();\n\n wethMarket = ICErc20(0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2);\n usdtMarket = ICErc20(0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3);\n\n wethNativeMarket = ICErc20(0xDb8eE6D1114021A94A045956BBeeCF35d13a30F2);\n usdcNativeMarket = ICErc20(0xc53edEafb6D502DAEC5A7015D67936CEa0cD0F52);\n usdtNativeMarket = ICErc20(0x3120B4907851cc9D780eef9aF88ae4d5360175Fd);\n modeNativeMarket = ICErc20(0x4341620757Bee7EB4553912FaFC963e59C949147);\n\n pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n lens = PoolLens(0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6);\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n borrower = 0xcE6cEFa163468F730206688665516952bcf83B74;\n liquidator = 0xE000008459b74a91e306a47C808061DFA372000E;\n uniV3liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n vm.prank(ap.owner());\n ap.setAddress(\"PoolLens\", address(lens));\n }\n\n function testLiquidateNoThreshold() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateThresholdActive() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n vm.expectRevert(\"Health factor not low enough for non-permissioned liquidations\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n vm.stopPrank();\n }\n\n function testLiquidateHealthFactorLowerThanThreshold() public debuggingOnly forkAtBlock(MODE_MAINNET, 10455052) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(usdtMarket.ionicAdmin());\n CTokenFirstExtension(address(usdtMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n // fast forward until position unhealthy enough\n vm.roll(block.number + 10000000);\n\n address targetContract = 0x927ae5509688eA6B992ba41Ecd1d49a6e7d69109;\n bytes\n memory data = hex\"a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002dd0b94812f2eea03a49869f95e1b5868c6f3206ee3d3002417bfdfbc000000000000000000000000ce6cefa163468f730206688665516952bcf83b740001000000000000000000000000000000000000000000000000000000006d3171ea02000000000000000000000000000000000000000000000000000000003698b8f5f0f161fda2712db8b566946122a5af183995e2ed02b702ce183b4e1faa574834715e5d4a6378d0eed3092be717340023c9e14c1bb12cb3ecbcfd3c3fb038000004a6afed9507f0f161fda2712db8b566946122a5af183995e2ed06000000000000000000000000000000000000000000000000000000003698b8f50109f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000000000000009f0f161fda2712db8b566946122a5af183995e2ed000044095ea7b300000000000000000000000094812f2eea03a49869f95e1b5868c6f3206ee3d3000000000000000000000000000000000000000000000000000000003698b8f50a94812f2eea03a49869f95e1b5868c6f3206ee3d3000024f5e3c462000000000000000000000000ce6cefa163468f730206688665516952bcf83b74002000000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d20771ef7eda2be775e5a7aa8afd02c45f059833e9d20a71ef7eda2be775e5a7aa8afd02c45f059833e9d2000004db006a7500000742000000000000000000000000000000000000060100468cc91df6f669cae6cdce766995bd7874052fbc0000000000000000000000000000000000000000000000000000000000000000010107d988097fb8612cc24eec14542bc03424c656005f0100ee8291dd97611a064a7db0e8c9252d851674e20100000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000009a07f0f161fda2712db8b566946122a5af183995e2ed0100a1c6800788482ba0eeb85f47322bb789986ee2f30000000000000000000000000000000000000000000000000000000000000000000107d988097fb8612cc24eec14542bc03424c656005f0100468cc91df6f669cae6cdce766995bd7874052fbc00000000000000000000000000000000000000000000000000000000000000000001000000000000\";\n\n vm.startPrank(liquidator);\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateFromPythShouldRevert() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n emit log_named_uint(\"hf\", lens.getHealthFactor(0x0Ff7F5043DD39186c2DF04F81cfa95672B8A3994, pool));\n\n address targetContract = 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A;\n bytes\n memory data = hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000ff7f5043dd39186c2df04f81cfa95672b8a39940000000000000000000000000000000000000000000000000002fb8c3841c79600000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d2000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n vm.startPrank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n vm.expectRevert(\"invalid liquidation\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testLiquidateFromPyth() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n vm.prank(uniV3liquidator.owner());\n uniV3liquidator.setHealthFactorThreshold(.98 * 1e18);\n\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n emit log_named_uint(\"hf\", lens.getHealthFactor(0x0Ff7F5043DD39186c2DF04F81cfa95672B8A3994, pool));\n\n address targetContract = 0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A;\n bytes\n memory data = hex\"55e9e8fe00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000ff7f5043dd39186c2df04f81cfa95672b8a39940000000000000000000000000000000000000000000000000002fb8c3841c79600000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d200000000000000000000000071ef7eda2be775e5a7aa8afd02c45f059833e9d2000000000000000000000000468cc91df6f669cae6cdce766995bd7874052fbc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n vm.mockCall(\n address(uniV3liquidator.expressRelay()),\n abi.encodeWithSelector(\n bytes4(keccak256(\"isPermissioned(address,bytes)\")),\n address(uniV3liquidator),\n abi.encode(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6)\n ),\n abi.encode(false)\n );\n\n vm.startPrank(0x1110DECC92083fbcae218a8478F75B2Ad1b9AEe6);\n vm.expectRevert(\"invalid liquidation\");\n (bool success, bytes memory returnData) = targetContract.call(data);\n require(success, \"Transaction failed\");\n vm.stopPrank();\n }\n\n function testPostUpgradeLiquidate() public debuggingOnly fork(MODE_MAINNET) {\n address borrower = 0xE10B38bbe359656066b3c4648DfEa7018711c35f;\n PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser(pool, borrower);\n\n for (uint i; i < assets.length; i++) {\n emit log_named_string(\"Asset Named\", assets[i].underlyingName);\n emit log_named_uint(\"Supply Balance\", assets[i].supplyBalance);\n emit log_named_uint(\"Borrow Balance\", assets[i].borrowBalance);\n emit log_named_uint(\"Liquidity\", assets[i].liquidity);\n emit log(\"----------------------------------------------------\");\n }\n\n emit log_named_uint(\"HF\", lens.getHealthFactor(borrower, pool));\n\n // vm.startPrank(0x344d9C4f488bb5519D390304457D64034618145C);\n\n // ERC20(0xd988097fb8612cc24eeC14542bC03424c656005f).approve(address(uniV3liquidator), 4000);\n\n // // ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({\n // // borrower: borrower,\n // // repayAmount: 4000,\n // // cErc20: ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),\n // // cTokenCollateral: wethMarket,\n // // flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,\n // // minProfitAmount: 0,\n // // redemptionStrategies: new IRedemptionStrategy[](0),\n // // strategyData: new bytes[](0),\n // // debtFundingStrategies: new IFundsConversionStrategy[](0),\n // // debtFundingStrategiesData: new bytes[](0)\n // // });\n // // uniV3liquidator.safeLiquidateToTokensWithFlashLoan(vars);\n\n // uniV3liquidator.safeLiquidate(borrower, 4000, ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038), wethMarket, 0);\n\n // vm.stopPrank();\n\n // emit log_named_uint(\"HF\", lens.getHealthFactor(borrower, pool));\n }\n\n function testUpgradeNativeMarket() public debuggingOnly fork(MODE_MAINNET) {\n _upgradeMarket(wethNativeMarket);\n _upgradeMarket(usdcNativeMarket);\n _upgradeMarket(usdtNativeMarket);\n _upgradeMarket(modeNativeMarket);\n _upgradeMarket(wethMarket);\n _upgradeMarket(usdtMarket);\n }\n\n struct CErc20StorageStruct {\n address ionicAdmin;\n string name;\n string symbol;\n uint8 decimals;\n address comptroller;\n address interestRateModel;\n uint256 adminFeeMantissa;\n uint256 ionicFeeMantissa;\n uint256 reserveFactorMantissa;\n uint256 accrualBlockNumber;\n uint256 borrowIndex;\n uint256 totalBorrows;\n uint256 totalReserves;\n uint256 totalAdminFees;\n uint256 totalIonicFees;\n uint256 totalSupply;\n uint256 protocolSeizeShareMantissa;\n uint256 feeSeizeShareMantissa;\n address underlying;\n address ap;\n uint256 cash;\n uint256 totalBorrowsCurrent;\n uint256 balanceOfUnderlying;\n uint256 borrowBalanceCurrent;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 exchangeRateCurrent;\n uint256 totalUnderlyingSupplied;\n uint256 allowance;\n uint256 balanceOf;\n }\n\n function testStorageLayoutSafe() public debuggingOnly forkAtBlock(MODE_MAINNET, 10352583) {\n // Capture storage layout before upgrade\n CErc20StorageStruct memory storageDataBefore;\n CErc20StorageStruct memory storageDataAfter;\n\n address owner = 0xbF86588d7e20502f1b250561da775343Dfdb3250; // Use a valid spender address as needed\n\n storageDataBefore.ionicAdmin = wethMarket.ionicAdmin();\n storageDataBefore.name = wethMarket.name();\n storageDataBefore.symbol = wethMarket.symbol();\n storageDataBefore.decimals = wethMarket.decimals();\n storageDataBefore.comptroller = address(wethMarket.comptroller());\n storageDataBefore.interestRateModel = address(wethMarket.interestRateModel());\n storageDataBefore.adminFeeMantissa = wethMarket.adminFeeMantissa();\n storageDataBefore.ionicFeeMantissa = wethMarket.ionicFeeMantissa();\n storageDataBefore.reserveFactorMantissa = wethMarket.reserveFactorMantissa();\n storageDataBefore.accrualBlockNumber = wethMarket.accrualBlockNumber();\n storageDataBefore.borrowIndex = wethMarket.borrowIndex();\n storageDataBefore.totalBorrows = wethMarket.totalBorrows();\n storageDataBefore.totalReserves = wethMarket.totalReserves();\n storageDataBefore.totalAdminFees = wethMarket.totalAdminFees();\n storageDataBefore.totalIonicFees = wethMarket.totalIonicFees();\n storageDataBefore.totalSupply = wethMarket.totalSupply();\n storageDataBefore.underlying = wethMarket.underlying();\n storageDataBefore.cash = wethMarket.getCash();\n storageDataBefore.totalBorrowsCurrent = wethMarket.totalBorrowsCurrent();\n storageDataBefore.balanceOfUnderlying = wethMarket.balanceOfUnderlying(owner);\n storageDataBefore.borrowBalanceCurrent = wethMarket.borrowBalanceCurrent(owner);\n storageDataBefore.supplyRatePerBlock = wethMarket.supplyRatePerBlock();\n storageDataBefore.borrowRatePerBlock = wethMarket.borrowRatePerBlock();\n storageDataBefore.exchangeRateCurrent = wethMarket.exchangeRateCurrent();\n storageDataBefore.totalUnderlyingSupplied = wethMarket.getTotalUnderlyingSupplied();\n storageDataBefore.balanceOf = wethMarket.balanceOf(owner);\n storageDataBefore.protocolSeizeShareMantissa = wethMarket.protocolSeizeShareMantissa();\n storageDataBefore.feeSeizeShareMantissa = wethMarket.feeSeizeShareMantissa();\n\n // Upgrade the market\n _upgradeMarket(wethMarket);\n\n vm.prank(wethMarket.ionicAdmin());\n CTokenFirstExtension(address(wethMarket))._setAddressesProvider(0xb0033576a9E444Dd801d5B69e1b63DBC459A6115);\n\n storageDataAfter.ionicAdmin = wethMarket.ionicAdmin();\n storageDataAfter.name = wethMarket.name();\n storageDataAfter.symbol = wethMarket.symbol();\n storageDataAfter.decimals = wethMarket.decimals();\n storageDataAfter.comptroller = address(wethMarket.comptroller());\n storageDataAfter.interestRateModel = address(wethMarket.interestRateModel());\n storageDataAfter.adminFeeMantissa = wethMarket.adminFeeMantissa();\n storageDataAfter.ionicFeeMantissa = wethMarket.ionicFeeMantissa();\n storageDataAfter.reserveFactorMantissa = wethMarket.reserveFactorMantissa();\n storageDataAfter.accrualBlockNumber = wethMarket.accrualBlockNumber();\n storageDataAfter.borrowIndex = wethMarket.borrowIndex();\n storageDataAfter.totalBorrows = wethMarket.totalBorrows();\n storageDataAfter.totalReserves = wethMarket.totalReserves();\n storageDataAfter.totalAdminFees = wethMarket.totalAdminFees();\n storageDataAfter.totalIonicFees = wethMarket.totalIonicFees();\n storageDataAfter.totalSupply = wethMarket.totalSupply();\n storageDataAfter.underlying = wethMarket.underlying();\n storageDataAfter.cash = wethMarket.getCash();\n storageDataAfter.totalBorrowsCurrent = wethMarket.totalBorrowsCurrent();\n storageDataAfter.balanceOfUnderlying = wethMarket.balanceOfUnderlying(owner);\n storageDataAfter.borrowBalanceCurrent = wethMarket.borrowBalanceCurrent(owner);\n storageDataAfter.supplyRatePerBlock = wethMarket.supplyRatePerBlock();\n storageDataAfter.borrowRatePerBlock = wethMarket.borrowRatePerBlock();\n storageDataAfter.exchangeRateCurrent = wethMarket.exchangeRateCurrent();\n storageDataAfter.totalUnderlyingSupplied = wethMarket.getTotalUnderlyingSupplied();\n storageDataAfter.balanceOf = wethMarket.balanceOf(owner);\n storageDataAfter.protocolSeizeShareMantissa = wethMarket.protocolSeizeShareMantissa();\n storageDataAfter.feeSeizeShareMantissa = wethMarket.feeSeizeShareMantissa();\n\n emit log_named_address(\"Storage ionicAdmin (before)\", storageDataBefore.ionicAdmin);\n emit log_named_address(\"Storage ionicAdmin (after)\", storageDataAfter.ionicAdmin);\n\n emit log_named_string(\"Storage name (before)\", storageDataBefore.name);\n emit log_named_string(\"Storage name (after)\", storageDataAfter.name);\n\n emit log_named_string(\"Storage symbol (before)\", storageDataBefore.symbol);\n emit log_named_string(\"Storage symbol (after)\", storageDataAfter.symbol);\n\n emit log_named_uint(\"Storage decimals (before)\", storageDataBefore.decimals);\n emit log_named_uint(\"Storage decimals (after)\", storageDataAfter.decimals);\n\n emit log_named_address(\"Storage comptroller (before)\", storageDataBefore.comptroller);\n emit log_named_address(\"Storage comptroller (after)\", storageDataAfter.comptroller);\n\n emit log_named_address(\"Storage interestRateModel (before)\", storageDataBefore.interestRateModel);\n emit log_named_address(\"Storage interestRateModel (after)\", storageDataAfter.interestRateModel);\n\n emit log_named_uint(\"Storage adminFeeMantissa (before)\", storageDataBefore.adminFeeMantissa);\n emit log_named_uint(\"Storage adminFeeMantissa (after)\", storageDataAfter.adminFeeMantissa);\n\n emit log_named_uint(\"Storage ionicFeeMantissa (before)\", storageDataBefore.ionicFeeMantissa);\n emit log_named_uint(\"Storage ionicFeeMantissa (after)\", storageDataAfter.ionicFeeMantissa);\n\n emit log_named_uint(\"Storage reserveFactorMantissa (before)\", storageDataBefore.reserveFactorMantissa);\n emit log_named_uint(\"Storage reserveFactorMantissa (after)\", storageDataAfter.reserveFactorMantissa);\n\n emit log_named_uint(\"Storage accrualBlockNumber (before)\", storageDataBefore.accrualBlockNumber);\n emit log_named_uint(\"Storage accrualBlockNumber (after)\", storageDataAfter.accrualBlockNumber);\n\n emit log_named_uint(\"Storage borrowIndex (before)\", storageDataBefore.borrowIndex);\n emit log_named_uint(\"Storage borrowIndex (after)\", storageDataAfter.borrowIndex);\n\n emit log_named_uint(\"Storage totalBorrows (before)\", storageDataBefore.totalBorrows);\n emit log_named_uint(\"Storage totalBorrows (after)\", storageDataAfter.totalBorrows);\n\n emit log_named_uint(\"Storage totalReserves (before)\", storageDataBefore.totalReserves);\n emit log_named_uint(\"Storage totalReserves (after)\", storageDataAfter.totalReserves);\n\n emit log_named_uint(\"Storage totalAdminFees (before)\", storageDataBefore.totalAdminFees);\n emit log_named_uint(\"Storage totalAdminFees (after)\", storageDataAfter.totalAdminFees);\n\n emit log_named_uint(\"Storage totalIonicFees (before)\", storageDataBefore.totalIonicFees);\n emit log_named_uint(\"Storage totalIonicFees (after)\", storageDataAfter.totalIonicFees);\n\n emit log_named_uint(\"Storage totalSupply (before)\", storageDataBefore.totalSupply);\n emit log_named_uint(\"Storage totalSupply (after)\", storageDataAfter.totalSupply);\n\n emit log_named_uint(\"Storage protocolSeizeShareMantissa (before)\", storageDataBefore.protocolSeizeShareMantissa);\n emit log_named_uint(\"Storage protocolSeizeShareMantissa (after)\", storageDataAfter.protocolSeizeShareMantissa);\n\n emit log_named_uint(\"Storage feeSeizeShareMantissa (before)\", storageDataBefore.feeSeizeShareMantissa);\n emit log_named_uint(\"Storage feeSeizeShareMantissa (after)\", storageDataAfter.feeSeizeShareMantissa);\n\n emit log_named_address(\"Storage underlying (before)\", storageDataBefore.underlying);\n emit log_named_address(\"Storage underlying (after)\", storageDataAfter.underlying);\n\n emit log_named_uint(\"Storage cash (before)\", storageDataBefore.cash);\n emit log_named_uint(\"Storage cash (after)\", storageDataAfter.cash);\n\n emit log_named_uint(\"Storage totalBorrowsCurrent (before)\", storageDataBefore.totalBorrowsCurrent);\n emit log_named_uint(\"Storage totalBorrowsCurrent (after)\", storageDataAfter.totalBorrowsCurrent);\n\n emit log_named_uint(\"Storage balanceOfUnderlying (before)\", storageDataBefore.balanceOfUnderlying);\n emit log_named_uint(\"Storage balanceOfUnderlying (after)\", storageDataAfter.balanceOfUnderlying);\n\n emit log_named_uint(\"Storage borrowBalanceCurrent (before)\", storageDataBefore.borrowBalanceCurrent);\n emit log_named_uint(\"Storage borrowBalanceCurrent (after)\", storageDataAfter.borrowBalanceCurrent);\n\n emit log_named_uint(\"Storage supplyRatePerBlock (before)\", storageDataBefore.supplyRatePerBlock);\n emit log_named_uint(\"Storage supplyRatePerBlock (after)\", storageDataAfter.supplyRatePerBlock);\n\n emit log_named_uint(\"Storage borrowRatePerBlock (before)\", storageDataBefore.borrowRatePerBlock);\n emit log_named_uint(\"Storage borrowRatePerBlock (after)\", storageDataAfter.borrowRatePerBlock);\n\n emit log_named_uint(\"Storage exchangeRateCurrent (before)\", storageDataBefore.exchangeRateCurrent);\n emit log_named_uint(\"Storage exchangeRateCurrent (after)\", storageDataAfter.exchangeRateCurrent);\n\n emit log_named_uint(\"Storage totalUnderlyingSupplied (before)\", storageDataBefore.totalUnderlyingSupplied);\n emit log_named_uint(\"Storage totalUnderlyingSupplied (after)\", storageDataAfter.totalUnderlyingSupplied);\n\n emit log_named_uint(\"Storage allowance (before)\", storageDataBefore.allowance);\n emit log_named_uint(\"Storage allowance (after)\", storageDataAfter.allowance);\n\n emit log_named_uint(\"Storage balanceOf (before)\", storageDataBefore.balanceOf);\n emit log_named_uint(\"Storage balanceOf (after)\", storageDataAfter.balanceOf);\n\n emit log_named_address(\"Storage ap (before)\", storageDataBefore.ap);\n emit log_named_address(\"Storage ap (after)\", storageDataAfter.ap);\n\n assertEq(storageDataBefore.ionicAdmin, storageDataAfter.ionicAdmin, \"Mismatch in ionicAdmin\");\n assertEq(storageDataBefore.name, storageDataAfter.name, \"Mismatch in name\");\n assertEq(storageDataBefore.symbol, storageDataAfter.symbol, \"Mismatch in symbol\");\n assertEq(storageDataBefore.decimals, storageDataAfter.decimals, \"Mismatch in decimals\");\n assertEq(storageDataBefore.comptroller, storageDataAfter.comptroller, \"Mismatch in comptroller\");\n assertEq(storageDataBefore.interestRateModel, storageDataAfter.interestRateModel, \"Mismatch in interestRateModel\");\n assertEq(storageDataBefore.adminFeeMantissa, storageDataAfter.adminFeeMantissa, \"Mismatch in adminFeeMantissa\");\n assertEq(storageDataBefore.ionicFeeMantissa, storageDataAfter.ionicFeeMantissa, \"Mismatch in ionicFeeMantissa\");\n assertEq(\n storageDataBefore.reserveFactorMantissa,\n storageDataAfter.reserveFactorMantissa,\n \"Mismatch in reserveFactorMantissa\"\n );\n assertEq(\n storageDataBefore.accrualBlockNumber,\n storageDataAfter.accrualBlockNumber,\n \"Mismatch in accrualBlockNumber\"\n );\n assertEq(storageDataBefore.borrowIndex, storageDataAfter.borrowIndex, \"Mismatch in borrowIndex\");\n assertEq(storageDataBefore.totalBorrows, storageDataAfter.totalBorrows, \"Mismatch in totalBorrows\");\n assertEq(storageDataBefore.totalReserves, storageDataAfter.totalReserves, \"Mismatch in totalReserves\");\n assertEq(storageDataBefore.totalAdminFees, storageDataAfter.totalAdminFees, \"Mismatch in totalAdminFees\");\n assertEq(storageDataBefore.totalIonicFees, storageDataAfter.totalIonicFees, \"Mismatch in totalIonicFees\");\n assertEq(storageDataBefore.totalSupply, storageDataAfter.totalSupply, \"Mismatch in totalSupply\");\n assertEq(storageDataBefore.underlying, storageDataAfter.underlying, \"Mismatch in underlying\");\n assertEq(storageDataBefore.cash, storageDataAfter.cash, \"Mismatch in cash\");\n assertEq(\n storageDataBefore.totalBorrowsCurrent,\n storageDataAfter.totalBorrowsCurrent,\n \"Mismatch in totalBorrowsCurrent\"\n );\n assertEq(\n storageDataBefore.balanceOfUnderlying,\n storageDataAfter.balanceOfUnderlying,\n \"Mismatch in balanceOfUnderlying\"\n );\n assertEq(\n storageDataBefore.borrowBalanceCurrent,\n storageDataAfter.borrowBalanceCurrent,\n \"Mismatch in borrowBalanceCurrent\"\n );\n assertEq(\n storageDataBefore.supplyRatePerBlock,\n storageDataAfter.supplyRatePerBlock,\n \"Mismatch in supplyRatePerBlock\"\n );\n assertEq(\n storageDataBefore.borrowRatePerBlock,\n storageDataAfter.borrowRatePerBlock,\n \"Mismatch in borrowRatePerBlock\"\n );\n assertEq(\n storageDataBefore.exchangeRateCurrent,\n storageDataAfter.exchangeRateCurrent,\n \"Mismatch in exchangeRateCurrent\"\n );\n assertEq(\n storageDataBefore.totalUnderlyingSupplied,\n storageDataAfter.totalUnderlyingSupplied,\n \"Mismatch in totalUnderlyingSupplied\"\n );\n assertEq(storageDataBefore.balanceOf, storageDataAfter.balanceOf, \"Mismatch in balanceOf\");\n assertEq(\n storageDataBefore.protocolSeizeShareMantissa,\n storageDataAfter.protocolSeizeShareMantissa,\n \"Mismatch in protocolSeizeShareMantissa\"\n );\n assertEq(\n storageDataBefore.feeSeizeShareMantissa,\n storageDataAfter.feeSeizeShareMantissa,\n \"Mismatch in feeSeizeShareMantissa\"\n );\n }\n\n function testCurrentMarkets() public debuggingOnly forkAtBlock(MODE_MAINNET, 10785800) {\n address[] memory ionAddresses = new address[](10);\n\n _upgradeMarket(wethMarket);\n\n ionAddresses[0] = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2;\n ionAddresses[1] = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038;\n ionAddresses[2] = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3;\n ionAddresses[3] = 0xd70254C3baD29504789714A7c69d60Ec1127375C;\n ionAddresses[4] = 0x59e710215d45F584f44c0FEe83DA6d43D762D857;\n ionAddresses[5] = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310;\n ionAddresses[6] = 0x49950319aBE7CE5c3A6C90698381b45989C99b46;\n ionAddresses[7] = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18;\n ionAddresses[8] = 0x9a9072302B775FfBd3Db79a7766E75Cf82bcaC0A;\n ionAddresses[9] = 0x19F245782b1258cf3e11Eda25784A378cC18c108;\n\n address ap;\n for (uint i = 0; i < ionAddresses.length; i++) {\n // ap = address(CTokenFirstExtension(ionAddresses[i]).ap());\n ap = address(CTokenFirstExtension(address(wethMarket)).ap());\n emit log_named_address(\"ap\", ap);\n }\n }\n}\n" + }, + "contracts/test/PoolCapsAndBlacklistsTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./config/MarketsTest.t.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\ncontract PoolCapsAndBlacklistsTest is MarketsTest {\n Comptroller pool;\n ComptrollerFirstExtension asExtension;\n address borrower = 0x28C0208b7144B511C73586Bb07dE2100495e92f3; // ANKR account\n address otherSupplier = 0x2924973E3366690eA7aE3FCdcb2b4e136Cf7f8Cc; // Supplier of ankrBNBAnkrMkt\n ICErc20 ankrBNBAnkrMkt = ICErc20(0x71693C84486B37096192c9942852f542543639Bf);\n ICErc20 ankrBNBMkt = ICErc20(0xb2b01D6f953A28ba6C8f9E22986f5bDDb7653aEa);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n // ankr pool\n pool = Comptroller(payable(0x1851e32F34565cb95754310b031C5a2Fc0a8a905));\n asExtension = ComptrollerFirstExtension(address(pool));\n _upgradeExistingPool(address(pool));\n\n _upgradeMarket(ankrBNBMkt);\n _upgradeMarket(ankrBNBAnkrMkt);\n\n // just some logging\n {\n uint256 borrowedAnkr = ankrBNBMkt.borrowBalanceCurrent(borrower);\n emit log_named_uint(\"ankrBnb borrow balance\", borrowedAnkr);\n uint256 collateralAnkr = ankrBNBAnkrMkt.balanceOf(borrower);\n emit log_named_uint(\"ankrBnb collateral balance of ankrBNB-ANKR\", collateralAnkr);\n\n uint256 borrowedOther = ankrBNBMkt.borrowBalanceCurrent(otherSupplier);\n emit log_named_uint(\"Other supplier borrower balance\", borrowedOther);\n uint256 collateralOther = ankrBNBAnkrMkt.balanceOf(otherSupplier);\n emit log_named_uint(\"Other supplier collateral balance of ankrBNB-ANKR\", collateralOther);\n\n emit log(\"\");\n emit log(\"Before collateral caps\");\n {\n (, , uint256 liq, uint256 sf) = pool.getAccountLiquidity(borrower);\n emit log_named_uint(\"Liq for account 1 before setting BC\", liq); // 1366119859198693075092\n emit log_named_uint(\"Shortfall for account 1 before setting BC\", sf); // 0\n emit log(\"\");\n (, , uint256 liq1, uint256 sf1) = pool.getAccountLiquidity(otherSupplier);\n emit log_named_uint(\"Liq for account 2 before setting BC\", liq1); // 24108891649595017\n emit log_named_uint(\"Shortfall for account 2 before setting BC\", sf1); // 0\n\n assertGt(liq, 0, \"expected positive liquidity\");\n assertGt(liq1, 0, \"expected positive liquidity\");\n emit log(\"\");\n }\n }\n }\n\n // TODO test with the latest block and contracts and/or without the FSL\n function testBorrowCapForCollateralWhitelist() public debuggingOnly forkAtBlock(BSC_MAINNET, 27827185) {\n emit log(\"\");\n emit log(\"Borrow Caps Set\");\n {\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateral(address(ankrBNBMkt), address(ankrBNBAnkrMkt), 1);\n (, , uint256 liqAfter, uint256 sfAfter) = pool.getAccountLiquidity(borrower);\n emit log_named_uint(\"Liq for account 1 after setting BC\", liqAfter);\n emit log_named_uint(\"Shortfall for account 1 after setting BC\", sfAfter);\n (, , uint256 liq1After, uint256 sf1After) = pool.getAccountLiquidity(otherSupplier);\n emit log(\"\");\n emit log_named_uint(\"Liq for account 2 after setting BC\", liq1After);\n emit log_named_uint(\"Shortfall for account 2 after setting BC\", sf1After);\n emit log(\"\");\n\n assertGt(sfAfter, 0, \"expected some shortfall for ankr\");\n assertEq(liq1After, 24108891649595017, \"expected liquidity for account 2 to decrease\");\n }\n\n {\n vm.prank(pool.admin());\n asExtension._setBorrowCapForCollateralWhitelist(address(ankrBNBMkt), address(ankrBNBAnkrMkt), borrower, true);\n\n emit log(\"\");\n (, , uint256 liqAfterWl, uint256 sfAfterWl) = pool.getAccountLiquidity(borrower);\n (, , uint256 liq1AfterWl, uint256 sf1AfterWl) = pool.getAccountLiquidity(otherSupplier);\n assertEq(sfAfterWl, 0, \"expected shortfall to go back to 0\");\n assertEq(liqAfterWl, 1366119859198693075092, \"expected liq to go back to original\");\n\n // expect liq for second (not whitelisted) account to stay reduced\n assertEq(liq1AfterWl, 24108891649595017, \"expected liq to go back to prev value\");\n }\n }\n\n function testBlacklistBorrowingAgainstCollateralWhitelist() public debuggingOnly fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n vm.prank(pool.admin());\n asExtension._blacklistBorrowingAgainstCollateral(address(ankrBNBMkt), address(ankrBNBAnkrMkt), true);\n\n (, , uint256 liquidityAfterBlacklist, uint256 shortFallAfterBlacklist) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertGt(liquidityBefore - liquidityAfterBlacklist, 0, \"should have lower liquidity after bl\");\n\n vm.prank(pool.admin());\n asExtension._blacklistBorrowingAgainstCollateralWhitelist(\n address(ankrBNBMkt),\n address(ankrBNBAnkrMkt),\n borrower,\n true\n );\n\n (, , uint256 liquidityAfterWhitelist, uint256 shortFallWhitelist) = pool.getHypotheticalAccountLiquidity(\n borrower,\n address(ankrBNBMkt),\n 0,\n 0,\n 0\n );\n assertEq(shortFallWhitelist, shortFallBefore, \"should have the same sf after wl\");\n assertEq(liquidityAfterWhitelist, liquidityBefore, \"should have the same liquidity after wl\");\n }\n\n function testSupplyCapWhitelist() public fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.startPrank(pool.admin());\n asExtension._setMarketSupplyCaps(markets, asArray(1, 1));\n asExtension._setMintPaused(ankrBNBMkt, false);\n asExtension._setMintPaused(ankrBNBAnkrMkt, false);\n vm.stopPrank();\n\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityBefore, liquidityAfterCap, \"should have the same liquidity after cap\");\n assertEq(shortFallBefore, shortFallAfterCap, \"should have the same shortfall after cap\");\n\n vm.expectRevert(\"!supply cap\");\n pool.mintAllowed(address(ankrBNBMkt), borrower, 2);\n\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(ankrBNBMkt), borrower, true);\n\n require(pool.mintAllowed(address(ankrBNBMkt), borrower, 2) == 0, \"mint not allowed after cap whitelist\");\n }\n\n function testBorrowCapWhitelist() public fork(BSC_MAINNET) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.prank(pool.admin());\n asExtension._setMarketBorrowCaps(markets, asArray(1, 1));\n\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityBefore, liquidityAfterCap, \"should have the same liquidity after cap\");\n assertEq(shortFallBefore, shortFallAfterCap, \"should have the same shortfall after cap\");\n\n vm.expectRevert(\"!borrow:cap\");\n pool.borrowAllowed(address(ankrBNBMkt), borrower, 2);\n\n vm.prank(pool.admin());\n asExtension._borrowCapWhitelist(address(ankrBNBMkt), borrower, true);\n\n require(pool.borrowAllowed(address(ankrBNBMkt), borrower, 2) == 0, \"borrow not allowed after cap whitelist\");\n }\n\n function testSupplyCapValue() public debuggingOnly forkAtBlock(BSC_MAINNET, 27827185) {\n (, , uint256 liquidityBefore, uint256 shortFallBefore) = pool.getAccountLiquidity(borrower);\n assertEq(shortFallBefore, 0, \"should have no shortfall before\");\n assertGt(liquidityBefore, 0, \"should have positive liquidity before\");\n\n ICErc20[] memory markets = new ICErc20[](2);\n markets[0] = ankrBNBMkt;\n markets[1] = ankrBNBAnkrMkt;\n\n vm.prank(pool.admin());\n asExtension._setMarketSupplyCaps(markets, asArray(1, 1));\n\n {\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityAfterCap, 0, \"should have no liquidity after\");\n assertGt(shortFallAfterCap, 0, \"should have positive shortfall after\");\n }\n\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(markets[0]), borrower, true);\n vm.prank(pool.admin());\n asExtension._supplyCapWhitelist(address(markets[1]), borrower, true);\n\n {\n (, , uint256 liquidityAfterCap, uint256 shortFallAfterCap) = pool.getAccountLiquidity(borrower);\n assertEq(liquidityAfterCap, liquidityBefore, \"liquidity after whitelist should match before\");\n assertEq(shortFallAfterCap, shortFallBefore, \"shortfall after whitelist should match before\");\n }\n }\n}\n" + }, + "contracts/test/PoolDirectoryTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\ncontract PoolDirectoryTest is BaseTest {\n PoolDirectory fpd;\n\n function afterForkSetUp() internal override {\n address fpdAddress = ap.getAddress(\"PoolDirectory\");\n fpd = PoolDirectory(fpdAddress);\n\n // upgrade to the current changes impl\n {\n PoolDirectory newImpl = new PoolDirectory();\n TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(fpdAddress));\n bytes32 bytesAtSlot = vm.load(address(proxy), _ADMIN_SLOT);\n address admin = address(uint160(uint256(bytesAtSlot)));\n vm.prank(admin);\n proxy.upgradeTo(address(newImpl));\n }\n }\n\n function testDeprecatePool() public fork(BSC_MAINNET) {\n _testDeprecatePool();\n }\n\n function _testDeprecatePool() internal {\n PoolDirectory.Pool[] memory allPools = fpd.getAllPools();\n\n PoolDirectory.Pool memory poolToDeprecate;\n\n // BOMB pool https://app.midascapital.xyz/56/pool/0\n uint256 index = 0;\n\n poolToDeprecate = allPools[index];\n\n vm.prank(fpd.owner());\n fpd._deprecatePool(index);\n\n (, PoolDirectory.Pool[] memory allPoolsAfter) = fpd.getActivePools();\n\n bool poolStillThere = false;\n for (uint256 i = 0; i < allPoolsAfter.length; i++) {\n if (allPoolsAfter[i].comptroller == poolToDeprecate.comptroller) {\n poolStillThere = true;\n break;\n }\n }\n\n assertTrue(!poolStillThere, \"deprecated pool is still there\");\n }\n}\n" + }, + "contracts/test/PoolLensTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./config/BaseTest.t.sol\";\n\nimport { PoolLens } from \"../PoolLens.sol\";\nimport \"../compound/ComptrollerInterface.sol\";\nimport { JumpRateModel } from \"../compound/JumpRateModel.sol\";\n\ncontract PoolLensTest is BaseTest {\n function testPolygonFPL() public debuggingOnly fork(POLYGON_MAINNET) {\n PoolLens fpl = PoolLens(0xD7225110D8F419b0E8Ad0A536977965E62fB5769);\n fpl.getPoolAssetsWithData(IonicComptroller(0xB08A309eFBFFa41f36A06b2D0C9a4629749b17a2));\n }\n\n function testModeFPL() public debuggingOnly fork(MODE_MAINNET) {\n IonicComptroller pool = IonicComptroller(0xFB3323E24743Caf4ADD0fDCCFB268565c0685556);\n PoolLens fpl = PoolLens(0x611a68618412c2e15A36e3e59C0b979746d87AB8);\n PoolLens.PoolAsset[] memory datas = fpl.getPoolAssetsWithData(pool);\n\n emit log_named_uint(\"ionicFee\", datas[0].ionicFee);\n emit log_named_uint(\"adminFee\", datas[0].adminFee);\n\n ICErc20[] memory markets = pool.getAllMarkets();\n\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 totalUnderlyingSupplied = markets[i].getTotalUnderlyingSupplied();\n uint256 totalBorrows = markets[i].totalBorrows();\n uint256 totalReserves = markets[i].totalReserves();\n uint256 cash = markets[i].getCash();\n\n emit log(\"\");\n emit log(markets[i].symbol());\n emit log_named_uint(\"totalUnderlyingSupplied\", totalUnderlyingSupplied);\n emit log_named_uint(\"totalBorrows\", totalBorrows);\n emit log_named_uint(\"totalReserves\", totalReserves);\n emit log_named_uint(\"cash\", cash);\n emit log_named_uint(\"reserves + fees\", cash + totalBorrows - totalUnderlyingSupplied);\n\n JumpRateModel irm = JumpRateModel(markets[i].interestRateModel());\n\n emit log_named_uint(\"blocksPerYear\", irm.blocksPerYear());\n\n emit log_named_uint(\n \"borrow rate per year\",\n irm.blocksPerYear() * irm.getBorrowRate(cash, totalBorrows, totalReserves)\n );\n emit log_named_uint(\n \"supply rate per year\",\n irm.blocksPerYear() * irm.getSupplyRate(cash, totalBorrows, totalReserves, 0.1e18)\n );\n }\n }\n\n function testWhitelistsFPL() public debuggingOnly fork(BSC_CHAPEL) {\n PoolLens fpl = PoolLens(0x604805B587C939042120D2e22398f299547A130c);\n fpl.getSupplyCapsDataForPool(IonicComptroller(0x307BEc9d1368A459E9168fa6296C1e69025ab30f));\n }\n}\n" + }, + "contracts/test/ProtocolAdminTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { PoolDirectory } from \"../PoolDirectory.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ProtocolAdminTest is BaseTest {\n address public expectedAdmin;\n\n function afterForkSetUp() internal virtual override {}\n\n function _checkIfAdmin(address addr, string memory contractName) internal {\n emit log(\"\");\n emit log(contractName);\n assertEq(addr, expectedAdmin, \"not the same admin address\");\n }\n\n function _checkSafeOwnableAdmin(string memory contractName) internal {\n SafeOwnableUpgradeable ownable = SafeOwnableUpgradeable(ap.getAddress(contractName));\n if (address(ownable) != address(0)) {\n _checkIfAdmin(ownable.owner(), contractName);\n }\n }\n\n function _checkOwnableAdmin(string memory contractName) internal {\n Ownable ownable = Ownable(ap.getAddress(contractName));\n if (address(ownable) != address(0)) {\n _checkIfAdmin(ownable.owner(), contractName);\n }\n }\n\n function testModeProtocolAdmin() public debuggingOnly fork(MODE_MAINNET) {\n expectedAdmin = 0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2; // gnosis safe multisig contract\n _testProtocolAdmin();\n }\n\n function _testProtocolAdmin() internal {\n //expectedAdmin = ap.owner();\n // safe ownable\n _checkSafeOwnableAdmin(\"FeeDistributor\");\n _checkSafeOwnableAdmin(\"PoolDirectory\");\n _checkSafeOwnableAdmin(\"OptimizedVaultsRegistry\");\n _checkSafeOwnableAdmin(\"AnkrCertificateTokenPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpLinearPoolPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpStablePoolPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpTokenPriceOracle\");\n _checkSafeOwnableAdmin(\"BalancerLpTokenPriceOracleNTokens\");\n _checkSafeOwnableAdmin(\"BalancerRateProviderOracle\");\n _checkSafeOwnableAdmin(\"BNBxPriceOracle\");\n _checkSafeOwnableAdmin(\"CurveLpTokenPriceOracleNoRegistry\");\n _checkSafeOwnableAdmin(\"CurveV2LpTokenPriceOracleNoRegistry\");\n _checkSafeOwnableAdmin(\"CurveV2PriceOracle\");\n _checkSafeOwnableAdmin(\"ERC4626Oracle\");\n _checkSafeOwnableAdmin(\"GammaPoolUniswapV3PriceOracle\");\n _checkSafeOwnableAdmin(\"GammaPoolAlgebraPriceOracle\");\n _checkSafeOwnableAdmin(\"PythPriceOracle\");\n _checkSafeOwnableAdmin(\"SimplePriceOracle\");\n _checkSafeOwnableAdmin(\"SolidlyPriceOracle\");\n _checkSafeOwnableAdmin(\"StkBNBPriceOracle\");\n _checkSafeOwnableAdmin(\"WSTEthPriceOracle\");\n _checkSafeOwnableAdmin(\"NativeUSDPriceOracle\");\n\n // ownable 2 step\n _checkSafeOwnableAdmin(\"LiquidatorsRegistry\");\n _checkSafeOwnableAdmin(\"LeveredPositionFactory\");\n _checkSafeOwnableAdmin(\"OptimizedAPRVault\");\n\n _checkOwnableAdmin(\"DefaultProxyAdmin\");\n _checkOwnableAdmin(\"DiaPriceOracle\");\n _checkOwnableAdmin(\"PoolDirectory\");\n\n assertEq(MasterPriceOracle(ap.getAddress(\"MasterPriceOracle\")).admin(), expectedAdmin, \"mpo admin incorrect\");\n\n // check all the pool admins and the flywheels owners\n PoolDirectory poolDir = PoolDirectory(ap.getAddress(\"PoolDirectory\"));\n PoolDirectory.Pool[] memory pools = poolDir.getAllPools();\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller pool = IonicComptroller(pools[i].comptroller);\n assertEq(pool.admin(), expectedAdmin, \"pool admin does not match\");\n\n address[] memory flywheels = pool.getRewardsDistributors();\n for (uint256 j = 0; j < flywheels.length; j++) {\n assertEq(Ownable(flywheels[j]).owner(), expectedAdmin, \"flywheel owner not the admin\");\n }\n }\n }\n}\n" + }, + "contracts/test/SafeOwnableUpgradeableTest.t.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract SomeOwnable is SafeOwnableUpgradeable {\n function initialize() public initializer {\n __SafeOwnable_init(msg.sender);\n }\n}\n\ncontract SafeOwnableUpgradeableTest is BaseTest {\n function testSafeOwnableUpgradeable() public {\n SomeOwnable someOwnable = new SomeOwnable();\n // deploy as a proxy/implementation\n {\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(\n address(someOwnable),\n address(dpa),\n abi.encodeWithSelector(someOwnable.initialize.selector)\n );\n someOwnable = SomeOwnable(address(proxy));\n }\n\n address joe = address(1234);\n\n address initOwner = someOwnable.owner();\n assertEq(initOwner, address(this), \"owner init value\");\n\n someOwnable._setPendingOwner(joe);\n\n address currentOwner = someOwnable.owner();\n assertEq(currentOwner, address(this), \"owner should not change yet\");\n\n vm.prank(joe);\n someOwnable._acceptOwner();\n\n address ownerAfter = someOwnable.owner();\n\n assertEq(ownerAfter, joe, \"ownership transfer failed\");\n }\n}\n" + }, + "contracts/test/UpgradesBaseTest.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport { FeeDistributor } from \"../FeeDistributor.sol\";\nimport { Comptroller } from \"../compound/Comptroller.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerFirstExtension } from \"../compound/ComptrollerFirstExtension.sol\";\nimport { CTokenFirstExtension } from \"../compound/CTokenFirstExtension.sol\";\nimport { Unitroller } from \"../compound/Unitroller.sol\";\nimport { CErc20Delegate } from \"../compound/CErc20Delegate.sol\";\nimport { CErc20Delegator } from \"../compound/CErc20Delegator.sol\";\nimport { CErc20PluginDelegate } from \"../compound/CErc20PluginDelegate.sol\";\nimport { CErc20PluginRewardsDelegate } from \"../compound/CErc20PluginRewardsDelegate.sol\";\nimport { CErc20RewardsDelegate } from \"../compound/CErc20RewardsDelegate.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BaseTest } from \"./config/BaseTest.t.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\nabstract contract UpgradesBaseTest is BaseTest {\n FeeDistributor internal ffd;\n ComptrollerFirstExtension internal poolExt;\n CTokenFirstExtension internal marketExt;\n\n function afterForkSetUp() internal virtual override {\n ffd = FeeDistributor(payable(ap.getAddress(\"FeeDistributor\")));\n poolExt = new ComptrollerFirstExtension();\n marketExt = new CTokenFirstExtension();\n }\n\n function _upgradePoolWithExtension(Unitroller asUnitroller) internal {\n address oldComptrollerImplementation = asUnitroller.comptrollerImplementation();\n\n // instantiate the new implementation\n Comptroller newComptrollerImplementation = new Comptroller();\n vm.startPrank(ffd.owner());\n address comptrollerImplementationAddress = address(newComptrollerImplementation);\n ffd._setLatestComptrollerImplementation(address(0), comptrollerImplementationAddress);\n // add the extension to the auto upgrade config\n DiamondExtension[] memory extensions = new DiamondExtension[](2);\n extensions[0] = poolExt;\n extensions[1] = newComptrollerImplementation;\n ffd._setComptrollerExtensions(comptrollerImplementationAddress, extensions);\n vm.stopPrank();\n\n // upgrade to the new comptroller\n vm.startPrank(asUnitroller.admin());\n asUnitroller._registerExtension(\n DiamondExtension(comptrollerImplementationAddress),\n DiamondExtension(asUnitroller.comptrollerImplementation())\n );\n asUnitroller._upgrade();\n vm.stopPrank();\n }\n\n function _upgradeMarketWithExtension(ICErc20 market) internal {\n // instantiate the new implementation\n CErc20Delegate newImpl;\n bytes memory becomeImplData = \"\";\n if (compareStrings(\"CErc20Delegate\", market.contractType())) {\n newImpl = new CErc20Delegate();\n } else if (compareStrings(\"CErc20PluginDelegate\", market.contractType())) {\n newImpl = new CErc20PluginDelegate();\n becomeImplData = abi.encode(address(0));\n } else if (compareStrings(\"CErc20RewardsDelegate\", market.contractType())) {\n newImpl = new CErc20RewardsDelegate();\n becomeImplData = abi.encode(address(0));\n } else {\n newImpl = new CErc20PluginRewardsDelegate();\n becomeImplData = abi.encode(address(0));\n }\n\n // set the new delegate as the latest\n vm.startPrank(ffd.owner());\n ffd._setLatestCErc20Delegate(newImpl.delegateType(), address(newImpl), abi.encode(address(0)));\n\n // add the extension to the auto upgrade config\n DiamondExtension[] memory cErc20DelegateExtensions = new DiamondExtension[](2);\n cErc20DelegateExtensions[0] = marketExt;\n cErc20DelegateExtensions[1] = newImpl;\n ffd._setCErc20DelegateExtensions(address(newImpl), cErc20DelegateExtensions);\n vm.stopPrank();\n\n vm.stopPrank();\n // upgrade to the new delegate\n vm.prank(address(ffd));\n market._setImplementationSafe(address(newImpl), becomeImplData);\n }\n}\n" + }, + "contracts/test/veION/contracts/Bribes/BribeRewards.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"forge-std/Test.sol\";\nimport \"../../../../veION/BribeRewards.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../../config/BaseTest.t.sol\";\nimport \"../../../../veION/Voter.sol\";\nimport \"../../../../oracles/MasterPriceOracle.sol\";\nimport { SimplePriceOracle } from \"../../../../oracles/default/SimplePriceOracle.sol\";\nimport \"../../../../veION/libraries/IonicTimeLibrary.sol\";\n\ncontract BribeRewardsTest is BaseTest {\n MockERC20 bribeTokenA;\n MockERC20 bribeTokenB;\n MockERC20 bribeTokenC;\n BribeRewards bribeRewards;\n SimplePriceOracle simpleOracle;\n address ve = address(0x123);\n address voter = address(0x456);\n address rewardToken = 0x18470019bF0E94611f15852F7e93cf5D65BC34CA;\n address lpTokenA = address(0x5);\n address lpTokenB = address(0x6);\n uint256 tokenId = 1;\n uint256 amount = 1000 ether;\n address user = address(0x789);\n\n function setUp() public {\n bribeRewards = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), ve)\n )\n )\n );\n\n address[] memory mockLpTokens = new address[](2);\n mockLpTokens[0] = lpTokenA;\n mockLpTokens[1] = lpTokenB;\n vm.mockCall(address(voter), abi.encodeWithSelector(IVoter.getAllLpRewardTokens.selector), abi.encode(mockLpTokens));\n\n bribeTokenA = new MockERC20(\"Bribe Token A\", \"BTA\", 18);\n bribeTokenB = new MockERC20(\"Bribe Token B\", \"BTB\", 18);\n bribeTokenC = new MockERC20(\"Bribe Token C\", \"BTC\", 18);\n\n address[] memory bribeTokens = new address[](3);\n bribeTokens[0] = address(bribeTokenA);\n bribeTokens[1] = address(bribeTokenB);\n bribeTokens[2] = address(bribeTokenC);\n\n for (uint256 i = 0; i < bribeTokens.length; i++) {\n vm.mockCall(\n address(voter),\n abi.encodeWithSelector(IVoter.isWhitelistedToken.selector, bribeTokens[i]),\n abi.encode(true)\n );\n\n vm.mockCall(ve, abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenId), abi.encode(user));\n }\n }\n\n function test_deposit_VoterCanDeposit() public {\n vm.prank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n\n uint256 balance = bribeRewards.balanceOf(tokenId, lpTokenA);\n assertEq(balance, amount, \"Balance should be equal to deposited amount\");\n uint256 totalSupply = bribeRewards.totalSupply(lpTokenA);\n assertEq(totalSupply, amount, \"Total supply should be equal to deposited amount\");\n }\n\n function test_withdraw_VoterCanWithdraw() public {\n vm.prank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n\n vm.prank(address(voter));\n bribeRewards.withdraw(lpTokenA, amount, tokenId);\n\n uint256 balance = bribeRewards.balanceOf(tokenId, lpTokenA);\n assertEq(balance, 0, \"Balance should be zero after withdrawal\");\n }\n\n function test_getReward_VoterCanGetReward() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1_000_000 ether);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(bribeTokenA);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n bribeRewards.getReward(tokenId, tokens);\n vm.stopPrank();\n\n uint256 lastEarned = bribeRewards.lastEarn(tokens[0], tokenId);\n assertEq(lastEarned, block.timestamp, \"Last earned timestamp should be updated\");\n }\n\n function test_earned_EarnedShouldBeCorrect() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n bribeRewards.deposit(lpTokenB, amount, tokenId);\n vm.stopPrank();\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n vm.warp(block.timestamp + 1 weeks);\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n emit log_named_uint(\"Epoch Start\", IonicTimeLibrary.epochStart(block.timestamp));\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 2e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 8e18);\n vm.warp(block.timestamp + 1 weeks);\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n emit log_named_uint(\"Epoch Start\", IonicTimeLibrary.epochStart(block.timestamp));\n\n uint256 earnedAmount = bribeRewards.earned(address(bribeTokenA), tokenId);\n emit log(\"--------------------------------------END EARNED--------------------------------------\");\n emit log_named_uint(\"Earned amount\", earnedAmount);\n\n assertEq(earnedAmount, 2000 ether, \"Earned amount should be 2000 ether\");\n }\n\n function test_earned_MultipleBribeRewardsSandbox() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenB.mint(address(this), 1_000_000 ether);\n bribeTokenB.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenC.mint(address(this), 1_000_000 ether);\n bribeTokenC.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n vm.warp(block.timestamp + 3 days);\n bribeRewards.deposit(lpTokenB, amount, tokenId);\n vm.stopPrank();\n\n emit log_named_uint(\"Current Timestamp\", block.timestamp);\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\n console.log(\"----------------------------------------------------------------\");\n emit log_named_uint(\"Epoch Start\", epochStart);\n\n uint256 priorBalanceIndexA = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n uint256 priorBalanceIndexB = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenB, block.timestamp);\n BribeRewards.Checkpoint memory checkpointA = bribeRewards.getCheckpoint(tokenId, lpTokenA, priorBalanceIndexA);\n BribeRewards.Checkpoint memory checkpointB = bribeRewards.getCheckpoint(tokenId, lpTokenB, priorBalanceIndexB);\n\n emit log_named_uint(\"Prior Balance Index for lpTokenA\", priorBalanceIndexA);\n emit log_named_uint(\"Prior Balance Index for lpTokenB\", priorBalanceIndexB);\n\n emit log_named_uint(\"Checkpoint lpTokenA Timestamp\", checkpointA.timestamp);\n emit log_named_uint(\"Checkpoint lpTokenA BalanceOf\", checkpointA.balanceOf);\n emit log_named_uint(\"Checkpoint lpTokenB Timestamp\", checkpointB.timestamp);\n emit log_named_uint(\"Checkpoint lpTokenB BalanceOf\", checkpointB.balanceOf);\n\n uint256 tokenRewardsEpochA = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenA), epochStart);\n uint256 tokenRewardsEpochB = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenB), epochStart);\n uint256 tokenRewardsEpochC = bribeRewards.tokenRewardsPerEpoch(address(bribeTokenC), epochStart);\n\n emit log_named_uint(\"Token Rewards for bribeTokenA in current epoch\", tokenRewardsEpochA);\n emit log_named_uint(\"Token Rewards for bribeTokenB in current epoch\", tokenRewardsEpochB);\n emit log_named_uint(\"Token Rewards for bribeTokenC in current epoch\", tokenRewardsEpochC);\n\n uint256 historicalPriceA = bribeRewards.historicalPrices(lpTokenA, epochStart);\n uint256 historicalPriceB = bribeRewards.historicalPrices(lpTokenB, epochStart);\n\n emit log_named_uint(\"Historical Price for lpTokenA in current epoch\", historicalPriceA);\n emit log_named_uint(\"Historical Price for lpTokenB in current epoch\", historicalPriceB);\n console.log(\"----------------------------------------------------------------\");\n\n vm.warp(block.timestamp + 4 days - 2);\n\n // uint256 earnedA = bribeRewards.earned(address(bribeTokenA), tokenId);\n // uint256 earnedB = bribeRewards.earned(address(bribeTokenB), tokenId);\n // uint256 earnedC = bribeRewards.earned(address(bribeTokenC), tokenId);\n\n // emit log_named_uint(\"Earned rewards for bribeTokenA\", earnedA);\n // emit log_named_uint(\"Earned rewards for bribeTokenB\", earnedB);\n // emit log_named_uint(\"Earned rewards for bribeTokenC\", earnedC);\n\n // START OF NEW EPOCH\n vm.warp(block.timestamp + 1); //604800\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2e18);\n\n vm.warp(block.timestamp + 3 days);\n vm.warp(block.timestamp + 4 days - 1);\n vm.warp(block.timestamp + 1);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2e18);\n\n vm.warp(block.timestamp + 7 days);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.1e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.1e18);\n\n vm.warp(block.timestamp + 7 days);\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.2e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.2e18);\n vm.warp(block.timestamp + 7 days);\n\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18);\n\n vm.warp(block.timestamp + 7 days);\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18);\n\n vm.startPrank(address(voter));\n bribeRewards.withdraw(lpTokenA, 1000 ether, tokenId);\n bribeRewards.withdraw(lpTokenB, 1000 ether, tokenId);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 7 days);\n\n for (uint256 i = 0; i < 5; i++) {\n emit log_named_uint(\"Block Timestamp\", block.timestamp);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 1.3e18 + (i * 0.1e18));\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 2.3e18 + (i * 0.1e18));\n\n vm.warp(block.timestamp + 7 days);\n }\n\n uint256 earnedA = bribeRewards.earned(address(bribeTokenA), tokenId);\n emit log_named_uint(\"Earned rewards for bribeTokenA\", earnedA);\n\n assertEq(earnedA, 5999999999999999999996, \"EarnedA assertion incorrect\");\n\n uint256 priorBalanceIndex = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n emit log_named_uint(\"Prior Balance Index for current timestamp and lpTokenA\", priorBalanceIndex);\n BribeRewards.Checkpoint memory checkpoint = bribeRewards.getCheckpoint(tokenId, lpTokenA, priorBalanceIndex);\n emit log_named_uint(\"Prior Balance Index for current timestamp and lpTokenA\", priorBalanceIndex);\n emit log_named_uint(\"Checkpoint Timestamp\", checkpoint.timestamp);\n emit log_named_uint(\"Checkpoint BalanceOf\", checkpoint.balanceOf);\n }\n\n function test_earned_PriorBalanceIndexShouldRemainConstantIfDepositInSameEpoch() public {\n bribeTokenA.mint(address(this), 1_000_000 ether);\n bribeTokenA.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenB.mint(address(this), 1_000_000 ether);\n bribeTokenB.approve(address(bribeRewards), 1_000_000 ether);\n bribeTokenC.mint(address(this), 1_000_000 ether);\n bribeTokenC.approve(address(bribeRewards), 1_000_000 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 1000 ether);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.startPrank(address(voter));\n bribeRewards.deposit(lpTokenA, amount, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenA, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenA, amount / 2, tokenId);\n vm.warp(block.timestamp + 1 days);\n bribeRewards.deposit(lpTokenB, amount / 2, tokenId);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 10 weeks);\n\n uint256 priorBalanceIndexA = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenA, block.timestamp);\n uint256 priorBalanceIndexB = bribeRewards.getPriorBalanceIndex(tokenId, lpTokenB, block.timestamp);\n\n emit log_named_uint(\"Prior Balance Index for lpTokenA\", priorBalanceIndexA);\n emit log_named_uint(\"Prior Balance Index for lpTokenB\", priorBalanceIndexB);\n\n assertEq(priorBalanceIndexA, 0, \"Prior Balance Index for lpTokenA should be 0\");\n assertEq(priorBalanceIndexB, 0, \"Prior Balance Index for lpTokenB should be 0\");\n }\n\n function test_earned_MultipleDepositors() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks); // Advance time by one epoch (assuming 1 week per epoch)\n }\n\n uint256 totalSupplyA = bribeRewards.totalSupply(lpTokenA);\n uint256 totalSupplyB = bribeRewards.totalSupply(lpTokenB);\n emit log_named_uint(\"Total Supply for lpTokenA\", totalSupplyA / 1e18);\n emit log_named_uint(\"Total Supply for lpTokenB\", totalSupplyB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n vm.startPrank(user);\n\n uint256 balanceA = bribeRewards.balanceOf(i, lpTokenA);\n uint256 balanceB = bribeRewards.balanceOf(i, lpTokenB);\n\n emit log_named_uint(\"Token ID\", i);\n emit log_named_uint(string(abi.encodePacked(\"Balance of user for lpTokenA\")), balanceA / 1e18);\n emit log_named_uint(string(abi.encodePacked(\"Balance of user for lpTokenB\")), balanceB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n vm.stopPrank();\n }\n\n uint256 totalBribeTokenA = bribeTokenA.balanceOf(address(bribeRewards));\n uint256 totalBribeTokenB = bribeTokenB.balanceOf(address(bribeRewards));\n uint256 totalBribeTokenC = bribeTokenC.balanceOf(address(bribeRewards));\n\n emit log_named_uint(\"Total Bribe Token A in Contract\", totalBribeTokenA / 1e18);\n emit log_named_uint(\"Total Bribe Token B in Contract\", totalBribeTokenB / 1e18);\n emit log_named_uint(\"Total Bribe Token C in Contract\", totalBribeTokenC / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n address randomUser = address(0x1234);\n uint256 tokenIdToMock = tokenIds[0];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdToMock),\n abi.encode(randomUser)\n );\n\n address[] memory rewardTokens = new address[](3);\n rewardTokens[0] = address(bribeTokenA);\n rewardTokens[1] = address(bribeTokenB);\n rewardTokens[2] = address(bribeTokenC);\n\n vm.prank(voter);\n bribeRewards.getReward(tokenIdToMock, rewardTokens);\n\n uint256 balanceForTokenIdToMockA = bribeRewards.balanceOf(tokenIdToMock, lpTokenA);\n uint256 balanceForTokenIdToMockB = bribeRewards.balanceOf(tokenIdToMock, lpTokenB);\n\n emit log_named_uint(\"Balance for tokenIdToMock for lpTokenA\", balanceForTokenIdToMockA / 1e18);\n emit log_named_uint(\"Balance for tokenIdToMock for lpTokenB\", balanceForTokenIdToMockB / 1e18);\n emit log(\"----------------------------------------------------------------\");\n\n uint256 userBribeTokenABalance = bribeTokenA.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token A Balance after Redemption\", userBribeTokenABalance / 1e18);\n\n uint256 expectedRewardA = (totalBribeTokenA * 5) / 100;\n uint256 actualRewardA = userBribeTokenABalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token A)\", expectedRewardA / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token A\", actualRewardA / 1e18);\n\n assertApproxEqAbs(actualRewardA, expectedRewardA, 50 ether, \"Bribe Token A reward does not match expected value\");\n\n uint256 userBribeTokenBBalance = bribeTokenB.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token B Balance after Redemption\", userBribeTokenBBalance / 1e18);\n\n uint256 expectedRewardB = (totalBribeTokenB * 5) / 100;\n uint256 actualRewardB = userBribeTokenBBalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token B)\", expectedRewardB / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token B\", actualRewardB / 1e18);\n\n assertApproxEqAbs(actualRewardB, expectedRewardB, 50 ether, \"Bribe Token B reward does not match expected value\");\n\n uint256 userBribeTokenCBalance = bribeTokenC.balanceOf(randomUser);\n emit log_named_uint(\"User Bribe Token C Balance after Redemption\", userBribeTokenCBalance / 1e18);\n\n uint256 expectedRewardC = (totalBribeTokenC * 5) / 100;\n uint256 actualRewardC = userBribeTokenCBalance;\n\n emit log_named_uint(\"Expected Reward for User (5% of Total Bribe Token C)\", expectedRewardC / 1e18);\n emit log_named_uint(\"Actual Reward for User for Bribe Token C\", actualRewardC / 1e18);\n\n assertApproxEqAbs(actualRewardC, expectedRewardC, 50 ether, \"Bribe Token C reward does not match expected value\");\n }\n\n function test_earned_UserWithdraws() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks); //\n }\n\n uint256 tokenIdToWithdraw = tokenIds[0];\n for (uint256 j = 0; j < lpTokens.length; j++) {\n address selectedLpToken = lpTokens[j];\n uint256 balanceBeforeWithdraw = bribeRewards.balanceOf(tokenIdToWithdraw, selectedLpToken);\n\n vm.prank(address(voter));\n bribeRewards.withdraw(selectedLpToken, balanceBeforeWithdraw, tokenIdToWithdraw);\n }\n uint256 tokenIdNotWithdrawn = tokenIds[1];\n\n uint256 earnedForTokenIdNotWithdrawn = bribeRewards.earned(address(bribeTokenA), tokenIdNotWithdrawn);\n emit log_named_uint(\"Earned for Bribe Token A for Token ID not withdrawn\", earnedForTokenIdNotWithdrawn / 1e18);\n\n uint256 totalEarnedABefore = bribeRewards.earned(address(bribeTokenA), tokenIdToWithdraw);\n emit log_named_uint(\"Total Earned for Bribe Token A after Withdraw\", totalEarnedABefore / 1e18);\n\n for (uint256 epoch = 0; epoch < 30; epoch++) {\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 totalEarnedAAfter = bribeRewards.earned(address(bribeTokenA), tokenIdToWithdraw);\n emit log_named_uint(\"Total Earned for Bribe Token A after timeskip\", totalEarnedAAfter / 1e18);\n\n assertEq(\n totalEarnedABefore,\n totalEarnedAAfter,\n \"Total earned for Bribe Token A should be the same before and after.\"\n );\n\n uint256 earnedForNotWithdrawn = bribeRewards.earned(address(bribeTokenA), tokenIdNotWithdrawn);\n emit log_named_uint(\"Earned for Bribe Token A for Token ID that didn't withdraw\", earnedForNotWithdrawn / 1e18);\n\n assertGt(\n earnedForNotWithdrawn,\n totalEarnedAAfter,\n \"Token ID that did not withdraw should have more earned than the token ID that withdrew.\"\n );\n }\n\n function test_earned_RewardCalculationResetsAfterCollectingReward() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 tokenIdThatClaims = tokenIds[0];\n uint256 tokenIdThatDontClaim = tokenIds[1];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdThatClaims),\n abi.encode(address(this))\n );\n\n address[] memory bribeTokens = new address[](3);\n bribeTokens[0] = address(bribeTokenA);\n bribeTokens[1] = address(bribeTokenB);\n bribeTokens[2] = address(bribeTokenC);\n vm.prank(address(voter));\n bribeRewards.getReward(tokenIdThatClaims, bribeTokens);\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 earnedAfterClaim = bribeRewards.earned(address(bribeTokenA), tokenIdThatClaims);\n emit log_named_uint(\"Earned for Bribe Token A after claiming and 10 more epochs\", earnedAfterClaim / 1e18);\n\n uint256 earnedNeverClaimed = bribeRewards.earned(address(bribeTokenA), tokenIdThatDontClaim);\n emit log_named_uint(\"Earned for Bribe Token A for user who never claimed\", earnedNeverClaimed / 1e18);\n\n assertGt(\n earnedNeverClaimed,\n earnedAfterClaim,\n \"User who never claimed should have more earned than the user who claimed.\"\n );\n }\n\n function test_earned_ClaimOnlyOneToken() public {\n bribeTokenA.mint(address(this), type(uint256).max);\n bribeTokenB.mint(address(this), type(uint256).max);\n bribeTokenC.mint(address(this), type(uint256).max);\n bribeTokenA.approve(address(bribeRewards), type(uint256).max);\n bribeTokenB.approve(address(bribeRewards), type(uint256).max);\n bribeTokenC.approve(address(bribeRewards), type(uint256).max);\n\n uint256 numEpochs = 10;\n uint256 numTokenIds = 20;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n uint256[] memory tokenIds = new uint256[](numTokenIds);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n tokenIds[i] = i;\n }\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n address[] memory tokensToClaim = new address[](1);\n tokensToClaim[0] = address(bribeTokenA);\n\n uint256 tokenIdToClaim = tokenIds[0];\n\n vm.mockCall(\n address(ve),\n abi.encodeWithSelector(ERC721Upgradeable.ownerOf.selector, tokenIdToClaim),\n abi.encode(address(this))\n );\n\n vm.prank(address(voter));\n bribeRewards.getReward(tokenIdToClaim, tokensToClaim);\n\n for (uint256 epoch = 0; epoch < numEpochs; epoch++) {\n _performDeposits(lpTokens, tokenIds, 1 ether, 100 ether);\n\n bribeRewards.notifyRewardAmount(address(bribeTokenA), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenB), 100 ether);\n bribeRewards.notifyRewardAmount(address(bribeTokenC), 100 ether);\n\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenA, 3e18);\n bribeRewards.setHistoricalPrices(block.timestamp, lpTokenB, 5e18);\n\n vm.warp(block.timestamp + 1 weeks);\n }\n\n uint256 earnedBribeA = bribeRewards.earned(address(bribeTokenA), tokenIdToClaim);\n uint256 earnedBribeB = bribeRewards.earned(address(bribeTokenB), tokenIdToClaim);\n uint256 earnedBribeC = bribeRewards.earned(address(bribeTokenC), tokenIdToClaim);\n\n emit log_named_uint(\"Earned for Bribe Token A\", earnedBribeA / 1e18);\n emit log_named_uint(\"Earned for Bribe Token B\", earnedBribeB / 1e18);\n emit log_named_uint(\"Earned for Bribe Token C\", earnedBribeC / 1e18);\n\n assertGt(earnedBribeB, earnedBribeA, \"Bribe Token B earned should be greater than Bribe Token A earned.\");\n assertGt(earnedBribeC, earnedBribeA, \"Bribe Token C earned should be greater than Bribe Token A earned.\");\n }\n\n function _performDeposits(\n address[] memory lpTokens,\n uint256[] memory tokenIds,\n uint256 minDepositAmount,\n uint256 maxDepositAmount\n ) internal {\n lpTokens[0] = lpTokenA;\n lpTokens[1] = lpTokenB;\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n for (uint256 j = 0; j < lpTokens.length; j++) {\n address selectedLpToken = lpTokens[j];\n uint256 randomAmount = minDepositAmount +\n (uint256(keccak256(abi.encodePacked(block.timestamp, i, j))) % (maxDepositAmount - minDepositAmount));\n vm.prank(address(voter));\n bribeRewards.deposit(selectedLpToken, randomAmount, tokenIds[i]);\n }\n }\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/BalanceOfNFT.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract BalanceOfNFT is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpBase();\n baseTokenIdSingleLp = _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n }\n\n function test_balanceOfNFT_GetsBalanceIfLockExists() public {\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n assertEq(assets.length, 1, \"Assets array length should be 1\");\n assertEq(balances.length, 1, \"Balances array length should be 1\");\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n\n console.log(\"Lock start time test:\", lock.start);\n console.log(\"Lock end time test:\", lock.end);\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqAbs(\n balances[i],\n lockInput.tokenAmount / 2,\n 3e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_GivesMinimalBoostWhenLockMinimum() public {\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = MINTIME;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n (, , uint256[] memory boosts) = IveION(ve).balanceOfNFT(tokenId);\n\n assertEq(boosts[0], 1e18, \"Boost should match the lock input\");\n }\n\n function test_balanceOfNFT_GivesMaximumBoostWhenLockMaximum() public {\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = MAXTIME;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n (, , uint256[] memory boosts) = IveION(ve).balanceOfNFT(tokenId);\n\n assertApproxEqRel(boosts[0], 2e18, 0.01e18, \"Boost should match the lock input\");\n }\n\n function test_balanceOfNFT_GetsBalanceForMultiLPLock() public {\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInputMultiLP.tokenId\n );\n\n assertEq(assets.length, 2, \"Assets array length should be 1\");\n assertEq(balances.length, 2, \"Balances array length should be 1\");\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInputMultiLP.tokenAddresses[i], \"Asset address should match the lock input\");\n assertApproxEqRel(\n balances[i],\n lockInputMultiLP.tokenAmounts[i] / 2,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_BalanceDecreasesLinearlyWithTime() public {\n vm.warp(block.timestamp + 26 weeks);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(\n balances[i],\n lockInput.tokenAmount / 4,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_BalanceEventuallyGoesToZero() public {\n vm.warp(block.timestamp + 52 weeks);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], 0, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOFNFT_ShouldGiveEventBasedBoost() public {\n uint256 limitedBoost = 0.5e18;\n IveION(ve).toggleLimitedBoost(true);\n IveION(ve).setLimitedTimeBoost(limitedBoost);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(\n boosts[i],\n harness.exposed_calculateBoost(lock.end - lock.start) + limitedBoost,\n \"Boost should match the lock input\"\n );\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_ShouldGiveAeroVotingBasedBoost() public {\n address aeroVotingAddress = address(0x123);\n uint256 aeroVoterBoost = 1e18;\n address ionicPoolAddress = address(0x456);\n address veAEROAddress = address(0x789);\n\n IveION(ve).setAeroVoting(aeroVotingAddress);\n IveION(ve).setAeroVoterBoost(aeroVoterBoost);\n IveION(ve).setIonicPool(ionicPoolAddress);\n IveION(ve).setVeAERO(veAEROAddress);\n\n vm.mockCall(\n veAEROAddress,\n abi.encodeWithSelector(IAeroVotingEscrow(veAEROAddress).balanceOf.selector, user),\n abi.encode(1) // Mock that the user has 1 veAERO token\n );\n\n vm.mockCall(\n veAEROAddress,\n abi.encodeWithSelector(IAeroVotingEscrow(veAEROAddress).ownerToNFTokenIdList.selector, user, 0),\n abi.encode(1) // Mock that the tokenId list returns 1\n );\n\n vm.mockCall(\n aeroVotingAddress,\n abi.encodeWithSelector(IAeroVoter(aeroVotingAddress).votes.selector, 1, ionicPoolAddress),\n abi.encode(1e18) // Mock that the votes for the ionicPool is 1e18\n );\n\n vm.mockCall(\n aeroVotingAddress,\n abi.encodeWithSelector(IAeroVoter(aeroVotingAddress).weights.selector, ionicPoolAddress),\n abi.encode(1e18) // Mock that the weight of the ionicPool is 1e18\n );\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(\n boosts[i],\n harness.exposed_calculateBoost(lock.end - lock.start) + aeroVoterBoost,\n \"Boost should match the lock input\"\n );\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_ShouldGiveAeroVotingBasedBoostFork() public forkAtBlock(BASE_MAINNET, 22722980) {\n AeroBoostVars memory vars;\n vars.aeroVoterBoost = 1e18;\n vars.aeroVotingAddress = 0x16613524e02ad97eDfeF371bC883F2F5d6C480A5;\n vars.ionicPoolAddress = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n vars.veAEROAddress = 0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4;\n vars.AERO = 0x940181a94A35A4569E4529A3CDfB74e38FD98631;\n vars.lockAmount = 20_000_000 ether;\n\n vars.poolVote = new address[](1);\n vars.weights = new uint256[](1);\n vars.poolVote[0] = vars.ionicPoolAddress;\n vars.weights[0] = 1e18; // 100% of the vote\n\n IveION(ve).setAeroVoting(vars.aeroVotingAddress);\n IveION(ve).setAeroVoterBoost(vars.aeroVoterBoost);\n IveION(ve).setIonicPool(vars.ionicPoolAddress);\n IveION(ve).setVeAERO(vars.veAEROAddress);\n\n vars.aeroWhale = 0x6cDcb1C4A4D1C3C6d054b27AC5B77e89eAFb971d;\n vm.prank(vars.aeroWhale);\n IERC20(vars.AERO).transfer(baseUser, vars.lockAmount);\n\n vm.startPrank(baseUser);\n IERC20(vars.AERO).approve(vars.veAEROAddress, vars.lockAmount);\n vars.veAeroTokenId = IveAERO(vars.veAEROAddress).createLock(vars.lockAmount, 2 * 365 * 86400);\n IAEROVoter(vars.aeroVotingAddress).vote(vars.veAeroTokenId, vars.poolVote, vars.weights);\n vm.stopPrank();\n\n uint256 weight = IAEROVoter(vars.aeroVotingAddress).votes(vars.veAeroTokenId, vars.ionicPoolAddress);\n\n console.log(\"Pool weight\", weight);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n baseTokenIdSingleLp\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n baseTokenIdSingleLp,\n IveION(ve).s_lpType(assets[i])\n );\n assertGt(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_IfVeAEROContractSetAndUserHasNoVoteThenBoostUnaffected() public {\n address aeroVotingAddress = address(0x123);\n uint256 aeroVoterBoost = 1e18;\n address ionicPoolAddress = address(0x456);\n address veAEROAddress = address(0x789);\n\n IveION(ve).setAeroVoting(aeroVotingAddress);\n IveION(ve).setAeroVoterBoost(aeroVoterBoost);\n IveION(ve).setIonicPool(ionicPoolAddress);\n IveION(ve).setVeAERO(veAEROAddress);\n\n vm.mockCall(\n veAEROAddress,\n abi.encodeWithSelector(IAeroVotingEscrow(veAEROAddress).balanceOf.selector, user),\n abi.encode(0) // Mock that the user has 1 veAERO token\n );\n\n vm.mockCall(\n aeroVotingAddress,\n abi.encodeWithSelector(IAeroVoter(aeroVotingAddress).weights.selector, ionicPoolAddress),\n abi.encode(1e18) // Mock that the weight of the ionicPool is 1e18\n );\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_GetsBalanceForPermanentLock() public {\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_BalanceOfPermanentDoesNotDecay() public {\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n\n vm.warp(block.timestamp + 10 * 365 * 86400);\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n\n console.log(\"Lock\", i);\n console.log(\"Asset:\", assets[i]);\n console.log(\"Balance:\", balances[i]);\n console.log(\"Boost:\", boosts[i]);\n }\n }\n\n function test_balanceOfNFT_GetsBalanceForPermanentLockWithDelegator() public {\n address delegator = address(0x2352);\n LockInfo memory delegatorInfo = _createLockInternal(delegator);\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n\n vm.startPrank(delegator);\n IveION(ve).lockPermanent(delegatorInfo.tokenAddress, delegatorInfo.tokenId);\n IveION(ve).delegate(\n delegatorInfo.tokenId,\n lockInput.tokenId,\n delegatorInfo.tokenAddress,\n delegatorInfo.tokenAmount\n );\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount * 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_GetsBalanceForPermanentWithDelegatee() public {\n address delegatee = address(0x2352);\n LockInfo memory delegateeInfo = _createLockInternal(delegatee);\n vm.prank(delegatee);\n IveION(ve).lockPermanent(delegateeInfo.tokenAddress, delegateeInfo.tokenId);\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n IveION(ve).delegate(lockInput.tokenId, delegateeInfo.tokenId, lockInput.tokenAddress, lockInput.tokenAmount);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertEq(balances[i], 0, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterIncreaseAmount() public {\n uint256 additionalAmount = 1000 * 1e18;\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(lockInput.tokenAddress, lockInput.tokenId, lockInput.tokenAmount, false);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(\n balances[i],\n lockInput.tokenAmount,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterLockAdditionalAsset() public {\n uint256 additionalAmount = 1000 * 1e18;\n modeBalancer8020IonEth.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), additionalAmount);\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n lockInput.duration,\n false\n );\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lock.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount / 2, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterIncreaseUnlockTime() public {\n vm.prank(user);\n IveION(ve).increaseUnlockTime(lockInput.tokenAddress, lockInput.tokenId, 2 * 365 * 86400);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lock.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], lock.amount, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterWithdraw() public {\n vm.prank(user);\n IveION(ve).withdraw(lockInput.tokenAddress, lockInput.tokenId);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], lock.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], 0, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterMerge() public {\n vm.prank(user);\n IveION(ve).merge(lockInput.tokenId, lockInputMultiLP.tokenId);\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets[i])\n );\n assertEq(assets[i], address(0), \"Asset address should be 0\");\n assertEq(balances[i], 0, \"Balance should be 0\");\n assertEq(boosts[i], 0, \"Boost should match the lock input\");\n }\n\n (address[] memory assetsMultiLP, uint256[] memory balancesMultiLP, uint256[] memory boostsMultiLP) = IveION(ve)\n .balanceOfNFT(lockInputMultiLP.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n IveION(ve).s_lpType(assetsMultiLP[0])\n );\n assertEq(assetsMultiLP[0], lockInputMultiLP.tokenAddresses[0], \"Asset address should match the lock input\");\n assertApproxEqRel(\n balancesMultiLP[0],\n lockInput.tokenAmount,\n 0.01e18,\n \"Balance should approximately match the lock input\"\n );\n assertEq(\n boostsMultiLP[0],\n harness.exposed_calculateBoost(lock.end - lock.start),\n \"Boost should match the lock input\"\n );\n }\n\n function test_balanceOfNFT_BalanceChangesAfterSplit() public {\n IveION(ve).toggleSplit(address(0), true);\n vm.prank(user);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInput.tokenAddress,\n lockInput.tokenId,\n lockInput.tokenAmount / 2\n );\n\n (address[] memory assets1, uint256[] memory balances1, uint256[] memory boosts1) = IveION(ve).balanceOfNFT(\n tokenId1\n );\n (address[] memory assets2, uint256[] memory balances2, uint256[] memory boosts2) = IveION(ve).balanceOfNFT(\n tokenId2\n );\n\n for (uint256 i = 0; i < assets1.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets1[i])\n );\n assertEq(assets1[i], lock.tokenAddress, \"Asset address should be 0\");\n assertApproxEqRel(balances1[i], MINT_AMT / 4, 0.01e18, \"Balance should be 0\");\n assertEq(boosts1[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n\n for (uint256 i = 0; i < assets2.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(assets2[i])\n );\n assertEq(assets2[i], lock.tokenAddress, \"Asset address should be 0\");\n assertApproxEqRel(balances2[i], MINT_AMT / 4, 0.01e18, \"Balance should be 0\");\n assertEq(boosts2[i], harness.exposed_calculateBoost(lock.end - lock.start), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterUnlockPermanent() public {\n address delegatee = address(0x2352);\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n IveION(ve).unlockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertApproxEqRel(balances[i], MINT_AMT, 0.01e18, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_BalanceChangesAfterRemoveDelegation() public {\n address delegatee = address(0x2352);\n LockInfo memory delegateeInfo = _createLockInternal(delegatee);\n vm.prank(delegatee);\n IveION(ve).lockPermanent(delegateeInfo.tokenAddress, delegateeInfo.tokenId);\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n IveION(ve).delegate(lockInput.tokenId, delegateeInfo.tokenId, lockInput.tokenAddress, lockInput.tokenAmount);\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = delegateeInfo.tokenId;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = lockInput.tokenAmount;\n IveION(ve).removeDelegatees(lockInput.tokenId, toTokenIds, lockInput.tokenAddress, amounts);\n vm.stopPrank();\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInput.tokenId\n );\n\n for (uint256 i = 0; i < assets.length; i++) {\n assertEq(assets[i], lockInput.tokenAddress, \"Asset address should match the lock input\");\n assertEq(balances[i], MINT_AMT, \"Balance should approximately match the lock input\");\n assertEq(boosts[i], harness.exposed_calculateBoost(MAXTIME), \"Boost should match the lock input\");\n }\n }\n\n function test_balanceOfNFT_NonExistentTokenId() public {\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(23526);\n assertEq(assets.length, 0, \"Assets array should be empty\");\n assertEq(balances.length, 0, \"Balances array should be empty\");\n assertEq(boosts.length, 0, \"Boosts array should be empty\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/ClaimEmissions.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract ClaimEmissions is veIONTest {\n address alice;\n address bob;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n alice = address(0x8325);\n bob = address(0x2542);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(alice);\n }\n\n function setUp() public {\n _setUp();\n emit log(\"setUp function override is running\");\n }\n\n function test_claimEmissions_UserCanClaimEmissionsFromUnderlyingStake() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.warp(block.timestamp + 1 weeks);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n vm.prank(alice);\n IveION(ve).claimEmissions(address(ionMode5050LP));\n\n assertTrue(reward > 0, \"Reward should be greater than zero after 1 week\");\n }\n\n function test_claimEmissions_NoEmissionsToClaim() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(bob);\n vm.expectRevert(abi.encodeWithSignature(\"NoUnderlyingStake()\"));\n IveION(ve).claimEmissions(address(ionMode5050LP));\n }\n\n function test_claimEmissions_WithdrawThenClaim() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.warp(block.timestamp + 1 weeks);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n vm.startPrank(alice);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, lockInfoAlice.tokenId);\n IveION(ve).claimEmissions(address(ionMode5050LP));\n vm.stopPrank();\n\n address rewardToken = veloIonModeStakingStrategy.rewardToken();\n assertEq(IERC20(rewardToken).balanceOf(alice), reward, \"Alice should have gotten no reward\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/CreateLock.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract CreateLock is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n }\n\n function test_createLock_UserCanCreateLock() public {\n TestVars memory vars;\n vars.user = address(0x1234);\n\n LockInfo memory lockInput = _createLockInternal(vars.user);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLock = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress)\n );\n\n vars.lockedBalance_end_test = ((block.timestamp + lockInput.duration) / WEEK) * WEEK;\n vars.expectedSupply = lockInput.tokenAmount;\n vars.userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n vars.userEpoch\n );\n vars.ownerTokenIds = IveION(ve).getOwnedTokenIds(vars.user);\n vars.assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(lockInput.tokenAddress, actualLock.tokenAddress, \"Token address mismatch\");\n assertEq(lockInput.tokenAmount, actualLock.amount, \"Token amount mismatch\");\n assertEq(vars.lockedBalance_end_test, actualLock.end, \"Unlock time mismatch\");\n assertEq(false, actualLock.isPermanent, \"Lock should not be permanent\");\n assertEq(IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress)), actualLock.amount, \"Supply mismatch\");\n assertEq(vars.userEpoch, 1, \"User epoch mismatch\");\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertGt(userPoint.bias, 0, \"User point bias mismatch\");\n assertGt(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, 0, \"User point permanent mismatch\");\n assertEq(IveION(ve).s_tokenId(), lockInput.tokenId, \"Token ID mismatch\");\n assertEq(vars.ownerTokenIds.length, 1, \"Owner should have one token ID\");\n assertEq(vars.ownerTokenIds[0], lockInput.tokenId, \"Owner token ID mismatch\");\n assertEq(vars.assetsLocked.length, 1, \"Assets locked length mismatch\");\n assertEq(vars.assetsLocked[0], lockInput.tokenAddress, \"Assets locked address mismatch\");\n }\n\n function test_createLock_MinBoostIsApplied() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 180 * 86400;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLock = IveION(ve).getUserLock(\n tokenId,\n IveION(ve).s_lpType(tokenAddresses[0])\n );\n\n uint256 boost = actualLock.boost;\n assertEq(boost, 1e18, \"Boost mismatch\");\n }\n\n function test_createLock_MaxBoostIsApplied() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 2 * 365 * 86400;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLock = IveION(ve).getUserLock(\n tokenId,\n IveION(ve).s_lpType(tokenAddresses[0])\n );\n\n uint256 boost = actualLock.boost;\n assertApproxEqAbs(boost, 2e18, 1e16, \"Boost mismatch\");\n }\n\n function test_createLock_UserCanLockMultipleLP() public {\n TestVars memory vars;\n\n vars.user = address(0x1234);\n LockInfoMultiple memory lockInput = _createLockMultipleInternal(vars.user);\n\n for (uint256 i = 0; i < lockInput.tokenAddresses.length; i++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lb = IveION(ve).s_locked(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddresses[i])\n );\n uint256 unlockTime = ((block.timestamp + lockInput.durations[i]) / WEEK) * WEEK;\n\n assertEq(lb.tokenAddress, lockInput.tokenAddresses[i], \"Token address mismatch\");\n assertEq(lb.amount, lockInput.tokenAmounts[i], \"Token amount mismatch\");\n assertEq(lb.end, unlockTime, \"Unlock time mismatch\");\n }\n\n vars.expectedSupply = MINT_AMT;\n vars.userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddresses[0]));\n vars.ownerTokenIds = IveION(ve).getOwnedTokenIds(vars.user);\n vars.assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddresses[1])),\n vars.expectedSupply,\n \"Supply mismatch\"\n );\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddresses[0])),\n vars.expectedSupply,\n \"Supply mismatch\"\n );\n assertEq(vars.userEpoch, 1, \"User epoch mismatch\");\n assertEq(IveION(ve).s_tokenId(), lockInput.tokenId, \"Token ID mismatch\");\n assertEq(vars.ownerTokenIds.length, 1, \"Owner should have one token ID\");\n assertEq(vars.ownerTokenIds[0], lockInput.tokenId, \"Owner token ID mismatch\");\n assertEq(vars.assetsLocked.length, lockInput.tokenAddresses.length, \"Assets locked length mismatch\");\n for (uint256 i = 0; i < vars.assetsLocked.length; i++) {\n assertEq(vars.assetsLocked[i], lockInput.tokenAddresses[i], \"Assets locked address mismatch\");\n }\n }\n\n function test_createLock_StakeUnderlyingLP() public forkAtBlock(MODE_MAINNET, 16559826) {\n TestVars memory vars;\n\n address ionMode5050 = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n address veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n\n address[] memory whitelistedTokens = new address[](1);\n bool[] memory isWhitelistedTokens = new bool[](1);\n whitelistedTokens[0] = ionMode5050;\n isWhitelistedTokens[0] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n // Mint ModeVelodrome tokens to the user\n vars.user = address(0x5678);\n vars.amount = 10 ether;\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050).transfer(vars.user, vars.amount);\n\n // Approve veION contract to spend user's tokens\n vm.prank(vars.user);\n IERC20(ionMode5050).approve(address(ve), vars.amount);\n\n // Prepare parameters for createLock\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(ionMode5050);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vars.stakeUnderlying = new bool[](1);\n vars.stakeUnderlying[0] = true;\n\n // Create lock\n vm.prank(vars.user);\n IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, vars.stakeUnderlying);\n\n address stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(vars.user);\n uint256 stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n\n // Advance the blockchain by 1 week\n vm.warp(block.timestamp + 1 weeks);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n assertTrue(stakingWalletInstance != address(0), \"Staking Wallet Instance should not be zero address\");\n assertEq(stakingWalletInstanceBalance, vars.amount, \"Staking Wallet Instance Balance should match locked amount\");\n assertTrue(reward > 0, \"Reward should be greater than zero after 1 week\");\n }\n\n function test_createLock_StakeUnderlyingLPAndClaimRewards() public forkAtBlock(MODE_MAINNET, 16559826) {\n TestVars memory vars;\n\n address ionMode5050 = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n address veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n\n address[] memory whitelistedTokens = new address[](1);\n bool[] memory isWhitelistedTokens = new bool[](1);\n whitelistedTokens[0] = ionMode5050;\n isWhitelistedTokens[0] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n // Mint ModeVelodrome tokens to the user\n vars.user = address(0x5678);\n vars.amount = 10 ether;\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050).transfer(vars.user, vars.amount);\n\n // Approve veION contract to spend user's tokens\n vm.prank(vars.user);\n IERC20(ionMode5050).approve(address(ve), vars.amount);\n\n // Prepare parameters for createLock\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(ionMode5050);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vars.stakeUnderlying = new bool[](1);\n vars.stakeUnderlying[0] = true;\n\n // Create lock\n vm.prank(vars.user);\n IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, vars.stakeUnderlying);\n\n vm.warp(block.timestamp + 1 weeks);\n\n address stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(vars.user);\n uint256 stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n uint256 reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n vm.prank(vars.user);\n IveION(ve).claimEmissions(vars.tokenAddresses[0]);\n\n stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n reward = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n uint256 userRewardBalance = IERC20(IVeloIonModeStaking(veloGauge).rewardToken()).balanceOf(vars.user);\n\n assertEq(\n stakingWalletInstanceBalance,\n vars.amount,\n \"Staking Wallet Instance Balance After Claim should be the same\"\n );\n assertEq(reward, 0, \"Earned After Claim should be 0\");\n assertGt(userRewardBalance, reward, \"User Reward Balance should be the earned amount\");\n }\n\n function test_createLock_RevertsIfUnequalArrayLenghts() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](2);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAddresses[1] = address(modeBalancer8020IonEth);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"ArrayMismatch()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertsIfZeroAmount() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = 0;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAmount()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertsIfDurationTooShort() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 10 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooShort()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfDurationTooLong() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 3 * 365 * 86400;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooLong()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfAmountTooSmall() public {\n address user = address(0x1234);\n uint256 amount = 5e18; // 1000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"MinimumNotMet()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfTokenNotWhitelisted() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 1000 tokens\n\n // Deploy a new random MockERC20 token\n MockERC20 randomMockToken = new MockERC20(\"Random_Token\", \"RND\", 18);\n randomMockToken.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(randomMockToken);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n vm.startPrank(user);\n randomMockToken.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n }\n\n function test_createLock_RevertIfDuplicateTokens() public {\n address user = address(0x1234);\n uint256 amount = MINT_AMT; // 2000 tokens\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](2);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAddresses[1] = address(modeVelodrome5050IonMode);\n\n uint256[] memory tokenAmounts = new uint256[](2);\n tokenAmounts[0] = amount / 2;\n tokenAmounts[1] = amount / 2;\n\n uint256[] memory durations = new uint256[](2);\n durations[0] = 52 weeks;\n durations[1] = 52 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n vm.expectRevert(abi.encodeWithSignature(\"DuplicateAsset()\"));\n IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](2));\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Delegate.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Delegate is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n uint256 tokenId1;\n uint256 tokenId2;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n lockInput = _createLockInternal(user);\n IveION(ve).setVoter(address(this));\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n vm.stopPrank();\n\n (tokenId1, tokenId2) = (lockInput.tokenId, lockInputMultiLP.tokenId);\n }\n\n function test_delegation_UserCanDelegate() public {\n vm.prank(user);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(tokenId1, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenId2, veloLpType);\n\n uint256 amountDelegated = IveION(ve).s_delegations(tokenId1, tokenId2, veloLpType);\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenId1, veloLpType);\n bool foundDelegatee = false;\n for (uint256 i = 0; i < delegatees.length; i++) {\n if (delegatees[i] == tokenId2) {\n foundDelegatee = true;\n break;\n }\n }\n\n uint256[] memory delegators = IveION(ve).getDelegators(tokenId2, veloLpType);\n bool foundDelegator = false;\n for (uint256 i = 0; i < delegators.length; i++) {\n if (delegators[i] == tokenId1) {\n foundDelegator = true;\n break;\n }\n }\n\n uint256 userEpoch2 = IveION(ve).s_userPointEpoch(tokenId2, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint2 = IveION(ve).getUserPoint(\n tokenId2,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch2\n );\n\n uint256 userEpoch1 = IveION(ve).s_userPointEpoch(tokenId1, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint1 = IveION(ve).getUserPoint(\n tokenId1,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch1\n );\n\n assertEq(userPoint2.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint2.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint2.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint2.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint2.permanent, MINT_AMT, \"User point permanent mismatch\");\n assertEq(userPoint2.permanentDelegate, MINT_AMT, \"User point permanent delegate mismatch\");\n\n assertEq(userPoint1.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint1.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint1.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint1.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint1.permanent, 0, \"User point permanent mismatch\");\n assertEq(userPoint1.permanentDelegate, 0, \"User point permanent delegate mismatch\");\n\n assertEq(locked1.amount, 0, \"All voting power should have been delegated from this token\");\n assertEq(locked2.delegateAmount, MINT_AMT, \"All voting power should have been delegated to this token\");\n assertEq(amountDelegated, MINT_AMT, \"Delegated amount should be recorded\");\n assertTrue(foundDelegatee, \"tokenId2 found in list of tokenId1's delegatees\");\n assertTrue(foundDelegator, \"tokenId1 found in list of tokenId2's delegators\");\n }\n\n function test_delegation_NoDuplicateDelegateesOrDelegators() public {\n uint256 smallDelegation = 10e18;\n vm.startPrank(user);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), smallDelegation);\n vm.stopPrank();\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenId1, veloLpType);\n assertEq(delegatees.length, 1, \"Should only be one delegeatee despite several delegations\");\n\n uint256[] memory delegators = IveION(ve).getDelegators(tokenId2, veloLpType);\n assertEq(delegators.length, 1, \"Should only be one delegator despite several delegations\");\n\n uint256 amountDelegated = IveION(ve).s_delegations(tokenId1, tokenId2, veloLpType);\n assertEq(amountDelegated, smallDelegation * 5, \"Should accumulate\");\n }\n\n function test_delegation_RevertIfNotOwner() public {\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n }\n\n function test_delegation_RevertIfAmountTooBig() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AmountTooBig()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT * 2);\n }\n\n function test_delegation_RevertIfNotPermanentLockFrom() public {\n vm.startPrank(user);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), tokenId1);\n vm.expectRevert(abi.encodeWithSignature(\"NotPermanentLock()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n }\n\n function test_delegation_RevertIfNotPermanentLockTo() public {\n vm.startPrank(user);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), tokenId2);\n vm.expectRevert(abi.encodeWithSignature(\"NotPermanentLock()\"));\n IveION(ve).delegate(tokenId1, tokenId2, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/IncreaseAmount.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract IncreaseAmount is veIONTest {\n address user;\n uint256 tokenId;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n }\n\n function test_increaseAmount_UserCanIncreaseLock() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n uint256 calculated_end = ((block.timestamp + lockInput.duration) / WEEK) * WEEK; // Update end time\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n uint256[] memory ownerTokenIds = IveION(ve).getOwnedTokenIds(user);\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(lockInput.tokenAmount + additionalAmount, actualLocked.amount, \"Lock amount should be increased\");\n assertEq(lockInput.tokenAddress, actualLocked.tokenAddress, \"Token address mismatch\");\n assertEq(calculated_end, actualLocked.end, \"Unlock time mismatch\");\n assertEq(false, actualLocked.isPermanent, \"Lock should not be permanent\");\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress)),\n actualLocked.amount + lockInputMultiLP.tokenAmounts[0],\n \"Supply mismatch\"\n );\n assertEq(userEpoch, 1, \"User epoch mismatch\");\n assertEq(lockInput.tokenId + 1, IveION(ve).s_tokenId(), \"Token ID mismatch\");\n assertEq(ownerTokenIds.length, 2, \"Owner should have one token ID\");\n assertEq(ownerTokenIds[0], lockInput.tokenId, \"Owner token ID mismatch\");\n assertEq(assetsLocked.length, 1, \"Assets locked length mismatch\");\n assertEq(assetsLocked[0], lockInput.tokenAddress, \"Assets locked address mismatch\");\n }\n\n function test_increaseAmountI_PermanentLock() public {\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n userEpoch\n );\n\n assertEq(lockInput.tokenAmount + additionalAmount, actualLocked.amount, \"Lock amount should be increased\");\n assertTrue(actualLocked.isPermanent, \"Lock should be permanent\");\n assertEq(\n lockInput.tokenAmount + additionalAmount,\n userPoint.permanent,\n \"Permanent Lock amount should be increased\"\n );\n }\n\n function test_increaseAmount_RevertIfAssetWhitelistedButNotLockedByUser() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeBalancer8020IonEth.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"NoLockFound()\"));\n IveION(ve).increaseAmount(address(modeBalancer8020IonEth), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmountI_RevertIfAssetWhitelistedLockedAndWithdrawnByUser() public {\n vm.warp(block.timestamp + lockInputMultiLP.durations[0]);\n vm.prank(user);\n IveION(ve).withdraw(lockInputMultiLP.tokenAddresses[0], lockInputMultiLP.tokenId);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeBalancer8020IonEth.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"NoLockFound()\"));\n IveION(ve).increaseAmount(lockInputMultiLP.tokenAddresses[0], lockInputMultiLP.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfNotOwner() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n address otherUser = address(0x9353);\n\n vm.prank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.prank(otherUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n }\n\n function test_increaseAmount_RevertIfValueIsZero() public {\n uint256 additionalAmount = 0;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAmount()\"));\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfTokenIdNonexistent() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n uint256 nonexistentToken = 3463;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), nonexistentToken, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfLockExpired() public {\n vm.warp(block.timestamp + lockInput.duration);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n\n function test_increaseAmount_RevertIfTokenNotWhitelisted() public {\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n MockERC20 randomMockToken = new MockERC20(\"MockToken\", \"MTK\", 18);\n randomMockToken.mint(user, additionalAmount);\n\n vm.startPrank(user);\n randomMockToken.approve(address(ve), additionalAmount);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).increaseAmount(address(randomMockToken), lockInput.tokenId, additionalAmount, false);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/IncreaseUnlockTime.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract IncreaseUnlockTime is veIONTest {\n address user;\n uint256 tokenId;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLp;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLp = _createLockMultipleInternal(user);\n }\n\n function test_increaseUnlockTime_UserCanIncreaseTime() public {\n uint256 newLockTime = 104 weeks;\n vm.prank(user);\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n uint256 expectedEndTime = ((block.timestamp + newLockTime) / WEEK) * WEEK;\n assertEq(expectedEndTime, actualLocked.end, \"Lock end time should be increased\");\n }\n\n function test_increaseUnlockTime_RevertIfNotOwner() public {\n uint256 newLockTime = 104 weeks;\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfLockPermanent() public {\n uint256 newLockTime = 104 weeks;\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n vm.stopPrank();\n }\n\n function test_increaseUnlockTime_RevertIfLockExpires() public {\n uint256 newLockTime = 104 weeks;\n vm.warp(block.timestamp + lockInput.duration);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfLockNonexistent() public {\n uint256 newLockTime = 104 weeks;\n uint256 amountToMint = 500 * 10 ** 18; // 500 tokens\n modeBalancer8020IonEth.mint(user, amountToMint);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), amountToMint);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseUnlockTime(address(modeBalancer8020IonEth), lockInput.tokenId, newLockTime);\n vm.stopPrank();\n }\n\n function test_increaseUnlockTime_RevertIfLockNotInFuture() public {\n uint256 newLockTime = 52 weeks;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationNotInFuture()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfLockTooLong() public {\n uint256 newLockTime = 120 weeks;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooLong()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInput.tokenId, newLockTime);\n }\n\n function test_increaseUnlockTime_RevertIfTokenNonexistent() public {\n uint256 newLockTime = 52 weeks;\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), 544, newLockTime);\n }\n\n function test_increaseUnlockTimeI_RevertIfUserWithdrewLock() public {\n uint256 newLockTime = 52 weeks;\n vm.startPrank(user);\n IveION(ve).withdraw(lockInputMultiLp.tokenAddresses[0], lockInputMultiLp.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), lockInputMultiLp.tokenId, newLockTime);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/LockAdditionalAsset.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract LockAdditionalAsset is veIONTest {\n address user;\n uint256 tokenId;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function test_lockAdditionalAsset_UserCanLockAdditionalLp() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n\n vm.prank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n vm.prank(user);\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lockedBalancer = IveION(ve).getUserLock(\n lockInput.tokenId,\n balancerLpType\n );\n uint256 expectedEndTimeBalancer = ((block.timestamp + 26 weeks) / WEEK) * WEEK;\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lockedVelo = IveION(ve).getUserLock(\n lockInput.tokenId,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE\n );\n uint256 expectedEndTimeVelo = ((block.timestamp + 52 weeks) / WEEK) * WEEK;\n\n assertEq(lockedBalancer.amount, additionalAmount, \"Total locked amount mismatch\");\n assertEq(lockedBalancer.end, expectedEndTimeBalancer, \"Lock end time should be increased balancer\");\n assertEq(lockedVelo.amount, lockInput.tokenAmount, \"Total locked amount mismatch\");\n assertEq(lockedVelo.end, expectedEndTimeVelo, \"Lock end time should be increased velo\");\n }\n\n function test_lockAdditionalAsset_RevertIfNotOwner() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18; // 500 tokens\n address randomUser = address(0x1345);\n\n vm.prank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.prank(randomUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n }\n\n function test_lockAdditionalAsset_RevertIfZeroAmount() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 0;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAmount()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfAlreadyVoted() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n IveION(ve).voting(lockInput.tokenId, true);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfDuplicateAsset() public {\n modeVelodrome5050IonMode.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"DuplicateAsset()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeVelodrome5050IonMode),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfMinimumNotMet() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 9 * 10 ** 18;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"MinimumNotMet()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 26 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfLockTooLong() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooLong()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 150 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionalAsset_RevertIfLockTooShort() public {\n modeBalancer8020IonEth.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"LockDurationTooShort()\"));\n IveION(ve).lockAdditionalAsset(\n address(modeBalancer8020IonEth),\n additionalAmount,\n lockInput.tokenId,\n 25 weeks,\n false\n );\n vm.stopPrank();\n }\n\n function test_lockAdditionAsset_RevertIfTokenNotWhitelisted() public {\n MockERC20 randomToken = new MockERC20(\"Random Token\", \"RND\", 18);\n randomToken.mint(user, lockInput.tokenAmount);\n uint256 additionalAmount = 500 * 10 ** 18;\n\n vm.startPrank(user);\n randomToken.approve(address(ve), lockInput.tokenAmount);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).lockAdditionalAsset(address(randomToken), additionalAmount, lockInput.tokenId, 26 weeks, false);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/LockPermanent.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract LockPermanent is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n lockInput = _createLockInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function test_lockPermanent_UserCanLockPermanent() public {\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, veloLpType);\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n userEpoch\n );\n assertEq(\n lock.tokenAddress,\n address(modeVelodrome5050IonMode),\n \"Lock token address should match the expected address\"\n );\n assertEq(lock.amount, lockInput.tokenAmount, \"Lock amount should match the initial lock amount\");\n assertEq(lock.boost, harness.exposed_calculateBoost(MAXTIME), \"Lock boost should be calculated based on MAXTIME\");\n assertEq(lock.delegateAmount, 0, \"Lock delegate amount should be zero for a new permanent lock\");\n\n assertEq(lock.isPermanent, true, \"Lock should be permanent\");\n assertEq(lock.end, 0, \"Lock end time should be zero for permanent lock\");\n assertEq(userPoint.bias, 0, \"User point bias should be zero for permanent lock\");\n assertEq(userPoint.slope, 0, \"User point slope should be zero for permanent lock\");\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp should be current block timestamp\");\n assertEq(userPoint.blk, block.number, \"User point block number should be current block number\");\n assertEq(userPoint.permanent, lock.amount, \"User point permanent lock should match lock amount\");\n }\n\n function test_lockPermanent_RevertIfNotOwner() public {\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_lockPermanent_RevertIfPermanentLock() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n\n function test_lockPermanent_RevertIfLockExpired() public {\n vm.warp(block.timestamp + lockInput.duration);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_lockPermanent_RevertIfNoLockFound() public {\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), 933);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Merge.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Merge is veIONTest {\n address user;\n LockInfo lockInput_1;\n LockInfo lockInput_2;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput_1 = _createLockInternal(user);\n lockInput_2 = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function test_merge_UserCanMerge() public {\n vm.prank(user);\n IveION(ve).merge(lockInput_1.tokenId, lockInput_2.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLock = IveION(ve).getUserLock(\n lockInput_2.tokenId,\n veloLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory burnedLock = IveION(ve).getUserLock(\n lockInput_1.tokenId,\n veloLpType\n );\n\n assertEq(\n mergedLock.amount,\n lockInput_2.tokenAmount * 2,\n \"Merged lock amount should be the sum of the original locks\"\n );\n assertEq(burnedLock.amount, 0, \"First lock amount should be zero after merge\");\n assertEq(burnedLock.end, 0, \"First lock end time should be zero after merge\");\n\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).ownerOf(lockInput_1.tokenId);\n }\n\n function test_merge_UserCanMergeMultiLockIntoSingleLock() public {\n vm.prank(user);\n IveION(ve).merge(lockInputMultiLP.tokenId, lockInput_2.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockVelo = IveION(ve).getUserLock(\n lockInput_2.tokenId,\n veloLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockBalancer = IveION(ve).getUserLock(\n lockInput_2.tokenId,\n balancerLpType\n );\n\n assertEq(mergedLockVelo.amount, MINT_AMT * 2, \"Velo merged lock amount should be the sum of the original locks\");\n assertEq(\n mergedLockBalancer.amount,\n MINT_AMT,\n \"Balancer merged lock amount should be the sum of the original locks\"\n );\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInput_2.tokenId);\n bool foundVelo = false;\n bool foundBalancer = false;\n\n for (uint256 i = 0; i < assetsLocked.length; i++) {\n if (assetsLocked[i] == address(modeVelodrome5050IonMode)) {\n foundVelo = true;\n }\n if (assetsLocked[i] == address(modeBalancer8020IonEth)) {\n foundBalancer = true;\n }\n }\n\n assertTrue(foundVelo, \"Velo token should be in assetsLocked for lockInput_2\");\n assertTrue(foundBalancer, \"Balancer token should be in assetsLocked for lockInput_2\");\n }\n\n function test_merge_UserCanMergeSingleLockIntoMultiLock() public {\n vm.prank(user);\n IveION(ve).merge(lockInput_1.tokenId, lockInputMultiLP.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockVelo = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n veloLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLockBalancer = IveION(ve).getUserLock(\n lockInputMultiLP.tokenId,\n balancerLpType\n );\n\n assertEq(mergedLockVelo.amount, MINT_AMT * 2, \"Velo merged lock amount should be the sum of the original locks\");\n assertEq(\n mergedLockBalancer.amount,\n MINT_AMT,\n \"Balancer merged lock amount should be the sum of the original locks\"\n );\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInputMultiLP.tokenId);\n bool foundVelo = false;\n bool foundBalancer = false;\n\n for (uint256 i = 0; i < assetsLocked.length; i++) {\n if (assetsLocked[i] == address(modeVelodrome5050IonMode)) {\n foundVelo = true;\n }\n if (assetsLocked[i] == address(modeBalancer8020IonEth)) {\n foundBalancer = true;\n }\n }\n\n assertTrue(foundVelo, \"Velo token should be in assetsLocked for lockInputMultiLP\");\n assertTrue(foundBalancer, \"Balancer token should be in assetsLocked for lockInputMultiLP\");\n }\n\n function test_merge_RevertIfNotOwnerOfFromToken() public {\n address randomUser = address(0x3524);\n LockInfo memory strangerLockInput = _createLockInternal(randomUser);\n\n vm.prank(randomUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).merge(lockInput_1.tokenId, strangerLockInput.tokenId);\n }\n\n function test_merge_RevertIfNotOwnerOfToToken() public {\n address randomUser = address(0x3524);\n LockInfo memory strangerLockInput = _createLockInternal(randomUser);\n\n vm.prank(randomUser);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).merge(strangerLockInput.tokenId, lockInput_1.tokenId);\n }\n\n function test_merge_RevertIfVoting() public {\n IveION(ve).voting(lockInput_1.tokenId, true);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).merge(lockInput_1.tokenId, lockInput_2.tokenId);\n }\n\n function test_merge_RevertIfSameToken() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"SameNFT()\"));\n IveION(ve).merge(lockInput_1.tokenId, lockInput_1.tokenId);\n }\n\n function test_merge_RevertIfEitherTokenDoesNotExist() public {\n uint256 nonExistentTokenId = 97959;\n\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).merge(nonExistentTokenId, lockInput_1.tokenId);\n\n vm.prank(user);\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).merge(lockInput_1.tokenId, nonExistentTokenId);\n }\n\n function test_merge_RevertIfToExpiredOrFromExpired() public {\n uint256 amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n uint256[] memory durations = new uint256[](1);\n durations[0] = 80 weeks;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n vm.stopPrank();\n\n vm.warp(block.timestamp + 54 weeks);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).merge(tokenId, lockInput_1.tokenId);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).merge(lockInput_1.tokenId, tokenId);\n }\n\n function test_merge_RevertIfFromPermanentOrToPermanent() public {\n vm.prank(user);\n IveION(ve).lockPermanent(lockInput_1.tokenAddress, lockInput_1.tokenId);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).merge(lockInput_1.tokenId, lockInput_2.tokenId);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).merge(lockInput_2.tokenId, lockInput_1.tokenId);\n }\n\n function test_merge_ShouldRecalculateBoostUsingEarlierStartAndLaterEnd() public {\n vm.warp(block.timestamp + 40 weeks);\n uint256 amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n uint256[] memory durations = new uint256[](1);\n durations[0] = 26 weeks;\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(\n lockInput_1.tokenId,\n veloLpType\n );\n uint256 expectedStart = locked1.start;\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenId, veloLpType);\n uint256 expectedEnd = locked2.end;\n\n IveION(ve).merge(lockInput_1.tokenId, tokenId);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLock = IveION(ve).getUserLock(tokenId, veloLpType);\n\n assertEq(mergedLock.start, expectedStart, \"Merged lock should have the earlier start time\");\n assertEq(mergedLock.end, expectedEnd, \"Merged lock should have the later end time\");\n\n emit log_named_uint(\"boost\", mergedLock.boost);\n }\n\n function test_merge_IfToHasNoLockForParticularAssetStartShouldNotBeZero() public {\n uint256 amount = MINT_AMT;\n modeBalancer8020IonEth.mint(user, amount);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(modeBalancer8020IonEth);\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amount;\n uint256[] memory durations = new uint256[](1);\n durations[0] = 70 weeks;\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(\n lockInput_1.tokenId,\n veloLpType\n );\n uint256 expectedStart = locked1.start;\n uint256 expectedEnd = locked1.end;\n uint256 boost = locked1.boost;\n\n emit log_named_uint(\"locked1 start time\", locked1.start);\n emit log_named_uint(\"locked1 end time\", locked1.end);\n\n vm.startPrank(user);\n modeBalancer8020IonEth.approve(address(ve), amount);\n uint256 secondTokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, new bool[](1));\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(secondTokenId, veloLpType);\n emit log_named_uint(\"locked2 start time\", locked2.start);\n emit log_named_uint(\"locked2 end time\", locked2.end);\n IveION(ve).merge(lockInput_1.tokenId, secondTokenId);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory mergedLock = IveION(ve).getUserLock(secondTokenId, veloLpType);\n\n emit log_named_uint(\"mergedLock start time\", mergedLock.start);\n emit log_named_uint(\"mergedLock end time\", mergedLock.end);\n assertEq(mergedLock.start, expectedStart, \"Merged lock should have the earlier start time\");\n assertEq(mergedLock.end, expectedEnd, \"Merged lock should have the later end time\");\n assertEq(mergedLock.boost, boost, \"Should maintain original boost\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/RemoveDelegateesAndRemoveDelegators.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract RemoveDelegateesAndRemoveDelegators is veIONTest {\n address cindy;\n address andy;\n LockInfo lockInputAlice;\n LockInfoMultiple lockInputBob;\n LockInfo lockInputCandy;\n LockInfo lockInputRalph;\n uint256 tokenIdAlice;\n uint256 tokenIdBob;\n uint256 tokenIdCandy;\n uint256 tokenIdRalph;\n\n function setUp() public {\n _setUp();\n cindy = address(0x1234);\n andy = address(0x3245);\n lockInputAlice = _createLockInternal(cindy);\n lockInputBob = _createLockMultipleInternal(cindy);\n lockInputCandy = _createLockInternal(andy);\n lockInputRalph = _createLockInternal(andy);\n IveION(ve).setVoter(address(this));\n\n (tokenIdAlice, tokenIdBob, tokenIdCandy, tokenIdRalph) = (\n lockInputAlice.tokenId,\n lockInputBob.tokenId,\n lockInputCandy.tokenId,\n lockInputRalph.tokenId\n );\n\n vm.startPrank(cindy);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdAlice);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdBob);\n IveION(ve).delegate(tokenIdAlice, tokenIdBob, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n\n vm.startPrank(andy);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdCandy);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), tokenIdRalph);\n IveION(ve).delegate(tokenIdCandy, tokenIdRalph, address(modeVelodrome5050IonMode), MINT_AMT);\n vm.stopPrank();\n }\n\n function test_removeDelegatees_UserCanRemoveDelegatees() public {\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = tokenIdBob;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(tokenIdAlice, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenIdBob, veloLpType);\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenIdAlice, veloLpType);\n uint256 amountDelegated = IveION(ve).s_delegations(tokenIdAlice, tokenIdBob, veloLpType);\n bool found = false;\n for (uint256 i = 0; i < delegatees.length; i++) {\n if (delegatees[i] == tokenIdBob) {\n found = true;\n break;\n }\n }\n\n uint256 userEpoch = IveION(ve).s_userPointEpoch(tokenIdBob, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n tokenIdBob,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch\n );\n\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, MINT_AMT, \"User point permanent mismatch\");\n assertEq(userPoint.permanentDelegate, 0, \"User point permanent delegate mismatch\");\n\n assertEq(locked1.amount, MINT_AMT, \"Voting power should be returned to the original token\");\n assertEq(locked2.delegateAmount, 0, \"Delegated voting power should be removed from the second token\");\n assertFalse(found, \"secondTokenId should not be in the list of delegatees after de-delegation\");\n assertEq(amountDelegated, 0, \"Delegated amount should be zero after de-delegation\");\n }\n\n function test_removeDelegatees_RemoveByTransfer() public {\n LockInfo memory lockInfoUser1 = _createLockInternal(address(0x1234));\n LockInfo memory lockInfoUser2 = _createLockInternal(address(0x5678));\n LockInfo memory lockInfoUser3 = _createLockInternal(address(0x9ABC));\n LockInfo memory lockInfoUser4 = _createLockInternal(address(0xDEF0));\n LockInfo memory lockInfoUser5 = _createLockInternal(address(0x1111));\n LockInfo memory lockInfoUser6 = _createLockInternal(address(0x2222));\n LockInfo memory lockInfoUser7 = _createLockInternal(address(0x3333));\n\n console.log(\"Token ID User 1:\", lockInfoUser1.tokenId);\n console.log(\"Token ID User 2:\", lockInfoUser2.tokenId);\n console.log(\"Token ID User 3:\", lockInfoUser3.tokenId);\n console.log(\"Token ID User 4:\", lockInfoUser4.tokenId);\n console.log(\"Token ID User 5:\", lockInfoUser5.tokenId);\n console.log(\"Token ID User 6:\", lockInfoUser6.tokenId);\n console.log(\"Token ID User 7:\", lockInfoUser7.tokenId);\n\n vm.startPrank(address(0x1234));\n IveION(ve).lockPermanent(lockInfoUser1.tokenAddress, lockInfoUser1.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x5678));\n IveION(ve).lockPermanent(lockInfoUser2.tokenAddress, lockInfoUser2.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x9ABC));\n IveION(ve).lockPermanent(lockInfoUser3.tokenAddress, lockInfoUser3.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0xDEF0));\n IveION(ve).lockPermanent(lockInfoUser4.tokenAddress, lockInfoUser4.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x1111));\n IveION(ve).lockPermanent(lockInfoUser5.tokenAddress, lockInfoUser5.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x2222));\n IveION(ve).lockPermanent(lockInfoUser6.tokenAddress, lockInfoUser6.tokenId);\n vm.stopPrank();\n\n vm.startPrank(address(0x3333));\n IveION(ve).lockPermanent(lockInfoUser7.tokenAddress, lockInfoUser7.tokenId);\n vm.stopPrank();\n\n vm.startPrank(cindy);\n IveION(ve).delegate(tokenIdBob, lockInfoUser1.tokenId, lockInfoUser1.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser2.tokenId, lockInfoUser2.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser3.tokenId, lockInfoUser3.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser4.tokenId, lockInfoUser4.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser5.tokenId, lockInfoUser5.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser6.tokenId, lockInfoUser6.tokenAddress, MINT_AMT / 7);\n IveION(ve).delegate(tokenIdBob, lockInfoUser7.tokenId, lockInfoUser7.tokenAddress, MINT_AMT / 7);\n vm.stopPrank();\n\n uint256[] memory delegateesBefore = IveION(ve).getDelegatees(tokenIdBob, veloLpType);\n console.log(\"Delegatees length before transfer:\", delegateesBefore.length);\n\n vm.prank(cindy);\n IveION(ve).transferFrom(cindy, address(0x9ABC), tokenIdBob);\n\n uint256[] memory delegateesAfter = IveION(ve).getDelegatees(tokenIdBob, veloLpType);\n console.log(\"Delegatees length after transfer:\", delegateesAfter.length);\n\n assertEq(delegateesBefore.length, 7, \"Expected 7 delegatees before transfer\");\n assertEq(delegateesAfter.length, 0, \"Expected 0 delegatees after transfer\");\n }\n\n function test_removeDelegatees_RemoveByTransferMultiLP() public {\n LockInfoMultiple memory lockInfoUser1 = _createLockMultipleInternal(cindy);\n LockInfoMultiple memory lockInfoUser2 = _createLockMultipleInternal(address(0x92365));\n\n vm.startPrank(address(0x92365));\n IveION(ve).lockPermanent(lockInfoUser2.tokenAddresses[0], lockInfoUser2.tokenId);\n IveION(ve).lockPermanent(lockInfoUser2.tokenAddresses[1], lockInfoUser2.tokenId);\n vm.stopPrank();\n\n vm.startPrank(cindy);\n IveION(ve).lockPermanent(lockInfoUser1.tokenAddresses[0], lockInfoUser1.tokenId);\n IveION(ve).lockPermanent(lockInfoUser1.tokenAddresses[1], lockInfoUser1.tokenId);\n vm.stopPrank();\n\n vm.startPrank(cindy);\n IveION(ve).delegate(lockInfoUser1.tokenId, lockInfoUser2.tokenId, lockInfoUser1.tokenAddresses[0], MINT_AMT / 5);\n IveION(ve).delegate(lockInfoUser1.tokenId, lockInfoUser2.tokenId, lockInfoUser1.tokenAddresses[1], MINT_AMT / 5);\n vm.stopPrank();\n\n uint256[] memory delegateesBeforeTransferVelo = IveION(ve).getDelegatees(lockInfoUser1.tokenId, veloLpType);\n assertEq(delegateesBeforeTransferVelo.length, 1, \"Expected 1 delegatee before transfer for velo LP type\");\n uint256[] memory delegateesBeforeTransferBalancer = IveION(ve).getDelegatees(lockInfoUser1.tokenId, balancerLpType);\n assertEq(delegateesBeforeTransferBalancer.length, 1, \"Expected 1 delegatee before transfer for balancer LP type\");\n\n vm.prank(cindy);\n IveION(ve).transferFrom(cindy, andy, lockInfoUser1.tokenId);\n\n uint256[] memory delegateesAfterTransferVelo = IveION(ve).getDelegatees(lockInfoUser1.tokenId, veloLpType);\n assertEq(delegateesAfterTransferVelo.length, 0, \"Expected 0 delegatees after transfer for velo LP type\");\n uint256[] memory delegateesAfterTransferBalancer = IveION(ve).getDelegatees(lockInfoUser1.tokenId, balancerLpType);\n assertEq(delegateesAfterTransferBalancer.length, 0, \"Expected 0 delegatees after transfer for balancer LP type\");\n }\n\n function test_removeDelegatees_RevertIfUnmatchedArrays() public {\n uint256[] memory toTokenIds = new uint256[](2);\n toTokenIds[0] = tokenIdBob;\n toTokenIds[1] = tokenIdBob;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"ArrayMismatch()\"));\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegatees_RevertIfNotOwner() public {\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = tokenIdBob;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(address(0x1413));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegatees_RevertIfNoDelegation() public {\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = tokenIdCandy;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"NoDelegationBetweenTokens(uint256,uint256)\", tokenIdAlice, tokenIdCandy));\n IveION(ve).removeDelegatees(tokenIdAlice, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegators_UserCanRemoveDelegators() public {\n uint256[] memory fromTokenIds = new uint256[](1);\n fromTokenIds[0] = tokenIdAlice;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n IveION(ve).removeDelegators(fromTokenIds, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked1 = IveION(ve).getUserLock(tokenIdAlice, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked2 = IveION(ve).getUserLock(tokenIdBob, veloLpType);\n\n uint256 amountDelegated = IveION(ve).s_delegations(tokenIdAlice, tokenIdBob, veloLpType);\n\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenIdAlice, veloLpType);\n bool foundDelegatee = false;\n for (uint256 i = 0; i < delegatees.length; i++) {\n if (delegatees[i] == tokenIdBob) {\n foundDelegatee = true;\n break;\n }\n }\n\n uint256[] memory delegators = IveION(ve).getDelegators(tokenIdBob, veloLpType);\n bool foundDelegator = false;\n for (uint256 i = 0; i < delegators.length; i++) {\n if (delegatees[i] == tokenIdBob) {\n foundDelegator = true;\n break;\n }\n }\n\n uint256 userEpoch = IveION(ve).s_userPointEpoch(tokenIdBob, IveION(ve).s_lpType(address(modeVelodrome5050IonMode)));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n tokenIdBob,\n IveION(ve).s_lpType(address(modeVelodrome5050IonMode)),\n userEpoch\n );\n\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, MINT_AMT, \"User point permanent mismatch\");\n assertEq(userPoint.permanentDelegate, 0, \"User point permanent delegate mismatch\");\n\n assertEq(locked1.amount, MINT_AMT, \"Voting power should be returned to the original token\");\n assertEq(locked2.delegateAmount, 0, \"Delegated voting power should be removed from the second token\");\n assertFalse(foundDelegatee, \"bob token should not be in the list of delegatees for alice after de-delegation\");\n assertFalse(foundDelegator, \"alice token should not be in the list of delegators for bob after de-delegation\");\n assertEq(amountDelegated, 0, \"Delegated amount should be zero after de-delegation\");\n }\n\n function test_removeDelegators_RevertIfUnmatchedArrays() public {\n uint256[] memory fromTokenIDs = new uint256[](2);\n fromTokenIDs[0] = tokenIdAlice;\n fromTokenIDs[1] = tokenIdAlice;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"ArrayMismatch()\"));\n IveION(ve).removeDelegators(fromTokenIDs, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n }\n function test_removeDelegators_RevertIfNotOwner() public {\n uint256[] memory fromTokenIDs = new uint256[](1);\n fromTokenIDs[0] = tokenIdAlice;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).removeDelegators(fromTokenIDs, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n }\n\n function test_removeDelegators_RevertIfNoDelegationBetweenTokens() public {\n uint256[] memory fromTokenIDs = new uint256[](1);\n fromTokenIDs[0] = tokenIdCandy;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = MINT_AMT;\n\n vm.prank(cindy);\n vm.expectRevert(abi.encodeWithSignature(\"NoDelegationBetweenTokens(uint256,uint256)\", tokenIdCandy, tokenIdBob));\n IveION(ve).removeDelegators(fromTokenIDs, tokenIdBob, address(modeVelodrome5050IonMode), amounts);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Setters.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Setters is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function test_setAeroVoting() public {\n address newAeroVoting = address(0x123);\n IveION(ve).setAeroVoting(newAeroVoting);\n assertEq(IveION(ve).s_aeroVoting(), newAeroVoting, \"AeroVoting address should be updated\");\n }\n\n function test_setAeroVoting_revertIfInvalidAddress() public {\n address invalidAddress = address(0);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidAddress()\"));\n IveION(ve).setAeroVoting(invalidAddress);\n }\n\n function test_setAeroVoterBoost() public {\n uint256 newBoost = 500;\n IveION(ve).setAeroVoterBoost(newBoost);\n assertEq(IveION(ve).s_aeroVoterBoost(), newBoost, \"AeroVoterBoost should be updated\");\n }\n\n function test_setAeroVoterBoost_revertIfZeroBoost() public {\n uint256 zeroBoost = 0;\n vm.expectRevert(abi.encodeWithSignature(\"AeroBoostAmountMustBeGreaterThanZero()\"));\n IveION(ve).setAeroVoterBoost(zeroBoost);\n }\n\n function test_setMaxEarlyWithdrawFee() public {\n uint256 newFee = 100;\n IveION(ve).setMaxEarlyWithdrawFee(newFee);\n assertEq(IveION(ve).s_maxEarlyWithdrawFee(), newFee, \"MaxEarlyWithdrawFee should be updated\");\n }\n\n function test_setMaxEarlyWithdrawFee_revertIfZeroFee() public {\n uint256 zeroFee = 0;\n vm.expectRevert(abi.encodeWithSignature(\"MaxEarlyWithdrawFeeMustBeGreaterThanZero()\"));\n IveION(ve).setMaxEarlyWithdrawFee(zeroFee);\n }\n\n function test_setLpTokenType() public {\n address tokenAddress = address(0x456);\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IveION(ve).setLpTokenType(tokenAddress, lpType);\n assertEq(uint256(IveION(ve).s_lpType(tokenAddress)), uint256(lpType), \"LP token type should be updated\");\n }\n\n function test_setLpTokenType_revertIfInvalidTokenAddress() public {\n address invalidTokenAddress = address(0);\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidTokenAddress()\"));\n IveION(ve).setLpTokenType(invalidTokenAddress, lpType);\n }\n\n function test_setStakeStrategy() public {\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IStakeStrategy strategy = IStakeStrategy(address(0x789));\n IveION(ve).setStakeStrategy(lpType, strategy);\n assertEq(address(IveION(ve).s_stakeStrategy(lpType)), address(strategy), \"Stake strategy should be updated\");\n }\n\n function test_setStakeStrategy_revertIfInvalidStrategyAddress() public {\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IStakeStrategy invalidStrategy = IStakeStrategy(address(0));\n vm.expectRevert(abi.encodeWithSignature(\"InvalidStrategyAddress()\"));\n IveION(ve).setStakeStrategy(lpType, invalidStrategy);\n }\n\n function test_toggleLimitedBoost() public {\n IveION(ve).toggleLimitedBoost(true);\n assertTrue(IveION(ve).s_limitedBoostActive(), \"Limited boost should be active\");\n }\n\n function test_setLimitedTimeBoost() public {\n uint256 boostAmount = 1000;\n IveION(ve).setLimitedTimeBoost(boostAmount);\n assertEq(IveION(ve).s_limitedBoost(), boostAmount, \"Limited time boost should be updated\");\n }\n\n function test_setVoter() public {\n address newVoter = address(0xABC);\n IveION(ve).setVoter(newVoter);\n assertEq(IveION(ve).s_voter(), newVoter, \"Voter address should be updated\");\n }\n\n function test_setVoter_revertIfInvalidAddress() public {\n address invalidVoter = address(0);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidAddress()\"));\n IveION(ve).setVoter(invalidVoter);\n }\n\n function test_setMinimumLockAmount() public {\n address tokenAddress = address(0xDEF);\n uint256 minimumAmount = 100;\n IveION(ve).setLpTokenType(tokenAddress, veloLpType);\n IveION(ve).setMinimumLockAmount(tokenAddress, minimumAmount);\n assertEq(\n IveION(ve).s_minimumLockAmount(IveION(ve).s_lpType(tokenAddress)),\n minimumAmount,\n \"Minimum lock amount should be updated\"\n );\n }\n\n function test_setMinimumLockDuration() public {\n uint256 minimumDuration = 1 weeks;\n IveION(ve).setMinimumLockDuration(minimumDuration);\n assertEq(IveION(ve).s_minimumLockDuration(), minimumDuration, \"Minimum lock duration should be updated\");\n }\n\n function test_setMinimumLockDuration_revertIfZeroDuration() public {\n uint256 zeroDuration = 0;\n vm.expectRevert(abi.encodeWithSignature(\"MinimumLockDurationMustBeGreaterThanZero()\"));\n IveION(ve).setMinimumLockDuration(zeroDuration);\n }\n\n function test_setIonicPool() public {\n address newIonicPool = address(0xFED);\n IveION(ve).setIonicPool(newIonicPool);\n assertEq(IveION(ve).s_ionicPool(), newIonicPool, \"Ionic pool address should be updated\");\n }\n\n function test_setIonicPool_revertIfInvalidAddress() public {\n address invalidIonicPool = address(0);\n vm.expectRevert(abi.encodeWithSignature(\"InvalidAddress()\"));\n IveION(ve).setIonicPool(invalidIonicPool);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Split.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Split is veIONTest {\n address user;\n LockInfoMultiple lockInputMultiLP;\n uint256 splitAmount;\n\n address alice;\n address bob;\n address cindy;\n address ralph;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n LockInfo lockInfoCindy;\n LockInfo lockInfoRalph;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n splitAmount = MINT_AMT / 2;\n IveION(ve).setVoter(address(this));\n vm.prank(IveION(ve).owner());\n IveION(ve).toggleSplit(user, true);\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n alice = address(0x8325);\n bob = address(0x2542);\n cindy = address(0x3423);\n ralph = address(0x2524);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n lockInfoCindy = _createLockInternalRealLP(cindy, true);\n lockInfoRalph = _createLockInternalRealLP(ralph, false);\n }\n\n function test_split_UserCanSplitAllLP() public {\n splitAmount = MINT_AMT - MINIMUM_LOCK_AMOUNT;\n vm.prank(user);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n address(modeVelodrome5050IonMode),\n lockInputMultiLP.tokenId,\n splitAmount\n );\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked1 = IveION(ve).getUserLock(tokenId1, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked1 = IveION(ve).getUserLock(\n tokenId1,\n balancerLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked2 = IveION(ve).getUserLock(tokenId2, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked2 = IveION(ve).getUserLock(\n tokenId2,\n balancerLpType\n );\n\n assertEq(IveION(ve).balanceOf(user), 2, \"User balance should be 2 after split\");\n assertEq(veloLocked1.amount, MINIMUM_LOCK_AMOUNT, \"First token's velo balance should be reduced by split amount\");\n assertEq(balancerLocked1.amount, MINT_AMT, \"First token's balancer should be unaffected\");\n assertEq(veloLocked2.amount, splitAmount, \"Second token's balance should be equal to split amount\");\n assertEq(balancerLocked2.amount, 0, \"Second token's balancer should be 0\");\n\n address[] memory assetsLocked1 = IveION(ve).getAssetsLocked(tokenId1);\n address[] memory assetsLocked2 = IveION(ve).getAssetsLocked(tokenId2);\n\n bool foundModeVeloInTokenId1 = false;\n for (uint256 i = 0; i < assetsLocked1.length; i++) {\n if (assetsLocked1[i] == address(modeVelodrome5050IonMode)) foundModeVeloInTokenId1 = true;\n }\n\n bool foundModeVeloInTokenId2 = false;\n for (uint256 i = 0; i < assetsLocked2.length; i++) {\n if (assetsLocked2[i] == address(modeVelodrome5050IonMode)) foundModeVeloInTokenId2 = true;\n }\n\n assertTrue(foundModeVeloInTokenId1, \"TokenId1 should still have the asset modeVelodrome5050IonMode\");\n assertTrue(foundModeVeloInTokenId2, \"TokenId2 should have the asset modeVelodrome5050IonMode\");\n }\n\n function test_split_UserCanSplitSomeLP() public {\n vm.prank(user);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n address(modeVelodrome5050IonMode),\n lockInputMultiLP.tokenId,\n splitAmount\n );\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked1 = IveION(ve).getUserLock(tokenId1, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked1 = IveION(ve).getUserLock(\n tokenId1,\n balancerLpType\n );\n IveIONStructsEnumsErrorsEvents.LockedBalance memory veloLocked2 = IveION(ve).getUserLock(tokenId2, veloLpType);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory balancerLocked2 = IveION(ve).getUserLock(\n tokenId2,\n balancerLpType\n );\n\n assertEq(veloLocked1.amount, MINT_AMT / 2, \"First split lock amount should be half of the original\");\n assertEq(balancerLocked1.amount, MINT_AMT, \"Second split lock amount should be half of the original\");\n assertEq(veloLocked2.amount, MINT_AMT / 2, \"Second split lock amount should be half of the original\");\n assertEq(balancerLocked2.amount, 0, \"Second split lock amount should be half of the original\");\n }\n\n function test_split_UnderlyingStakeAlsoSplit() public forkAtBlock(MODE_MAINNET, 16559826) {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n uint256 splitAmt = 4e18;\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n splitAmt\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n splitAmt,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n\n vm.stopPrank();\n }\n\n function test_split_RevertIfAlreadyVoted() public {\n IveION(ve).voting(lockInputMultiLP.tokenId, true);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfSplitNotAllowedForUser() public {\n IveION(ve).toggleSplit(user, false);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"SplitNotAllowed()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_CanSplitNotAllowedForUserButAllowedGeneral() public {\n IveION(ve).toggleSplit(user, false);\n IveION(ve).toggleSplit(address(0), true);\n vm.prank(user);\n vm.expectEmit(false, false, false, false);\n emit IveIONStructsEnumsErrorsEvents.SplitCompleted(0, 0, 0, 0, address(0));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfNotOwner() public {\n vm.prank(address(0x9352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfLockExpired() public {\n vm.warp(block.timestamp + lockInputMultiLP.durations[0]);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"LockExpired()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfSplitTooSmall() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"SplitTooSmall()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, 0);\n }\n\n function test_split_RevertIfAmountTooBig() public {\n splitAmount = MINT_AMT * 2;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AmountTooBig()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n\n function test_split_RevertIfNotEnoughRemainingInOldToken() public {\n splitAmount = 995e18;\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotEnoughRemainingAfterSplit()\"));\n IveION(ve).split(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId, splitAmount);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/ToggleSplit.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract ToggleSplit is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function test_toggleSplit_CanToggleSpit() public {\n IveION(ve).toggleSplit(address(0), true);\n bool canSplit = IveION(ve).s_canSplit(address(0));\n assertTrue(canSplit, \"Splitting allowed\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/TransferVeION.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract TrasferVeION is veIONTest {\n address alice;\n address bob;\n address cindy;\n address ralph;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n LockInfo lockInfoCindy;\n LockInfo lockInfoRalph;\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n alice = address(0x8325);\n bob = address(0x2542);\n cindy = address(0x3423);\n ralph = address(0x2524);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n lockInfoCindy = _createLockInternalRealLP(cindy, true);\n lockInfoRalph = _createLockInternalRealLP(ralph, false);\n }\n\n function test_transfer_UnderlyingStakeShouldBeTransferredToReceipientWithNoStake()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n uint256 aliceCumulativeValueBefore = IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress);\n uint256 bobCumulativeValueBefore = IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress);\n\n address stakingWalletInstanceBefore = veloIonModeStakingStrategy.userStakingWallet(bob);\n assertTrue(stakingWalletInstanceBefore == address(0), \"Bob should start off not having a staking wallet\");\n\n vm.prank(alice);\n IveION(ve).transferFrom(alice, bob, lockInfoAlice.tokenId);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(bob);\n\n assertTrue(\n stakingWalletInstance != address(0),\n \"Bob should now have a staking wallet after being transferred a token that has a stake\"\n );\n assertEq(\n veloIonModeStakingStrategy.balanceOf(stakingWalletInstance),\n REAL_LP_LOCK_AMOUNT,\n \"Bob should have the tokens\"\n );\n\n uint256 aliceCumulativeValueAfter = IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress);\n uint256 bobCumulativeValueAfter = IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress);\n\n // Assert that Alice's cumulative value has decreased by the lock amount\n assertEq(\n aliceCumulativeValueAfter,\n aliceCumulativeValueBefore - REAL_LP_LOCK_AMOUNT,\n \"Alice's cumulative value should decrease by the lock amount\"\n );\n\n // Assert that Bob's cumulative value has increased by the lock amount\n assertEq(\n bobCumulativeValueAfter,\n bobCumulativeValueBefore + REAL_LP_LOCK_AMOUNT,\n \"Bob's cumulative value should increase by the lock amount\"\n );\n\n uint256[] memory aliceOwnedTokenIds = IveION(ve).getOwnedTokenIds(alice);\n uint256[] memory bobOwnedTokenIds = IveION(ve).getOwnedTokenIds(bob);\n\n // Assert that Alice no longer owns the token\n assertEq(aliceOwnedTokenIds.length, 0, \"Alice should not own any tokens after transfer\");\n\n // Assert that Bob now owns the token\n assertEq(bobOwnedTokenIds.length, 2, \"Bob should own one token after transfer\");\n assertEq(bobOwnedTokenIds[1], lockInfoAlice.tokenId, \"Bob should own the transferred token ID\");\n }\n\n function test_transfer_UnderlyingStakeShouldBeTransferredToRecipientWithStake()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n vm.prank(alice);\n IveION(ve).transferFrom(alice, cindy, lockInfoAlice.tokenId);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(cindy);\n\n assertTrue(stakingWalletInstance != address(0), \"Cindy should have a staking wallet\");\n assertEq(\n veloIonModeStakingStrategy.balanceOf(stakingWalletInstance),\n REAL_LP_LOCK_AMOUNT * 2,\n \"Cindy's stake should include hers and what was transferred to it\"\n );\n }\n\n function test_transfer_NoUnderlyingStakeInFrom() public forkAtBlock(MODE_MAINNET, 16559826) {\n vm.prank(bob);\n IveION(ve).transferFrom(bob, ralph, lockInfoBob.tokenId);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(ralph);\n\n assertTrue(stakingWalletInstance == address(0), \"Ralph should not have a staking wallet instance\");\n }\n\n function test_transfer_SplitThenTransfer() public forkAtBlock(MODE_MAINNET, 16559826) {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(bob);\n uint256 bobBalanceBefore = veloIonModeStakingStrategy.balanceOf(stakingWalletInstance);\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n REAL_LP_LOCK_AMOUNT / 2\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT / 2,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT / 2,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n\n IveION(ve).transferFrom(alice, bob, tokenId1);\n vm.stopPrank();\n\n stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(bob);\n\n assertEq(bobBalanceBefore, 0, \"Bob should start with no balance\");\n assertTrue(stakingWalletInstance != address(0), \"Bob should have a staking wallet\");\n assertEq(\n veloIonModeStakingStrategy.balanceOf(stakingWalletInstance),\n REAL_LP_LOCK_AMOUNT / 2,\n \"Bob's stake should include hers and what was transferred to it\"\n );\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/UnlockPermanent.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract UnlockPermanent is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInputMultiLP = _createLockMultipleInternal(user);\n lockInput = _createLockInternal(user);\n IveION(ve).setVoter(address(this));\n\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_unlockPermanent_UserCanUnlockPermanent() public {\n vm.prank(user);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n uint256 endTime = ((block.timestamp + MAXTIME) / WEEK) * WEEK;\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n assertEq(locked.tokenAddress, lockInput.tokenAddress);\n assertEq(locked.amount, lockInput.tokenAmount, \"Amount should be reset to the original lock input value\");\n assertEq(locked.delegateAmount, 0, \"Delegate amount should be zero after unlocking permanent lock\");\n assertEq(locked.start, block.timestamp, \"Should get back the original start time\");\n assertEq(locked.end, endTime, \"Lock end time should be zero for permanent lock\");\n assertEq(locked.isPermanent, false, \"Lock should be permanent\");\n assertEq(\n locked.boost,\n harness.exposed_calculateBoost(MAXTIME),\n \"Boost should be zero after unlocking permanent lock\"\n );\n }\n\n function test_unlockPermanent_RevertIfNotOwner() public {\n vm.prank(address(0x0915));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_unlockPermanent_RevertIfNotPermanentLock() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotPermanentLock()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n }\n\n function test_unlockPermanent_RevertIfHasDelegatees() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n IveION(ve).delegate(lockInput.tokenId, lockInputMultiLP.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n vm.expectRevert(abi.encodeWithSignature(\"TokenHasDelegatees()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n\n function test_unlockPermanent_RevertIfHasDelegators() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n IveION(ve).delegate(lockInputMultiLP.tokenId, lockInput.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n vm.expectRevert(abi.encodeWithSignature(\"TokenHasDelegators()\"));\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/veIONFuzz.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract veIONFuzzing is veIONTest {\n address user;\n function setUp() public {\n _setUp();\n user = address(0x987);\n }\n\n function testFuzz_createLock_BoostShouldNeverBeAboveMaximum(uint256 _amount, uint256 _duration) public {\n _amount = bound(_amount, IveION(ve).s_minimumLockAmount(veloLpType), type(uint256).max);\n _duration = bound(_duration, IveION(ve).s_minimumLockDuration(), MAXTIME);\n\n modeVelodrome5050IonMode.mint(user, _amount);\n\n vm.prank(user);\n modeVelodrome5050IonMode.approve(address(ve), _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAmounts[0] = _amount;\n durations[0] = _duration;\n stakeUnderlying[0] = false;\n\n vm.startPrank(user);\n MockERC20(modeVelodrome5050IonMode).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n tokenId,\n IveION(ve).s_lpType(tokenAddresses[0])\n );\n\n uint256 maxBoost = 2e18;\n assertGe(maxBoost, lock.boost, \"Boost should never be above the maximum\");\n }\n\n function testFuzz_createLock_VotingPowerShouldBeAmountDepositedAtMost(uint256 _amount, uint256 _duration) public {\n _amount = bound(_amount, IveION(ve).s_minimumLockAmount(veloLpType), type(uint256).max);\n _duration = bound(_duration, IveION(ve).s_minimumLockDuration(), MAXTIME);\n\n modeVelodrome5050IonMode.mint(user, _amount);\n\n vm.prank(user);\n modeVelodrome5050IonMode.approve(address(ve), _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(modeVelodrome5050IonMode);\n tokenAmounts[0] = _amount;\n durations[0] = _duration;\n stakeUnderlying[0] = false;\n\n vm.startPrank(user);\n MockERC20(modeVelodrome5050IonMode).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n (, uint256[] memory balances, ) = IveION(ve).balanceOfNFT(tokenId);\n assertGe(_amount, balances[0], \"Boost should never be above the maximum\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/ViewFunctions.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract ViewFunctions is veIONTest {\n function setUp() public {\n _setUp();\n }\n\n function test_getUserLock() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(tokenId, lpType);\n assertEq(lock.amount, 0, \"Initial lock amount should be zero\");\n }\n\n function test_getOwnedTokenIds() public {\n address owner = address(this);\n uint256[] memory tokenIds = IveION(ve).getOwnedTokenIds(owner);\n assertEq(tokenIds.length, 0, \"Owner should initially have no token IDs\");\n }\n\n function test_getTotalEthValueOfTokens() public {\n address owner = address(this);\n address[] memory mockLpTokens = new address[](2);\n mockLpTokens[0] = address(0x987);\n mockLpTokens[1] = address(0x765);\n\n address voter = address(0x321);\n IveION(ve).setVoter(voter);\n\n vm.mockCall(address(voter), abi.encodeWithSelector(IVoter.getAllLpRewardTokens.selector), abi.encode(mockLpTokens));\n\n address mockMasterPriceOracle = address(0x653);\n vm.mockCall(\n address(ap),\n abi.encodeWithSelector(IAddressesProvider.getAddress.selector, \"MasterPriceOracle\"),\n abi.encode(mockMasterPriceOracle)\n );\n\n vm.mockCall(\n address(mockMasterPriceOracle),\n abi.encodeWithSelector(IMasterPriceOracle.price.selector, mockLpTokens[0]),\n abi.encode(10e18)\n );\n vm.mockCall(\n address(mockMasterPriceOracle),\n abi.encodeWithSelector(IMasterPriceOracle.price.selector, mockLpTokens[1]),\n abi.encode(5e18)\n );\n\n uint256 totalValue = IveION(ve).getTotalEthValueOfTokens(owner);\n\n assertEq(totalValue, 0, \"Initial total ETH value should be zero\");\n }\n\n function test_getAssetsLocked() public {\n uint256 tokenId = 1;\n address[] memory assets = IveION(ve).getAssetsLocked(tokenId);\n assertEq(assets.length, 0, \"Initially, no assets should be locked\");\n }\n\n function test_getDelegatees() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n uint256[] memory delegatees = IveION(ve).getDelegatees(tokenId, lpType);\n assertEq(delegatees.length, 0, \"Initially, there should be no delegatees\");\n }\n\n function test_getDelegators() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n uint256[] memory delegators = IveION(ve).getDelegators(tokenId, lpType);\n assertEq(delegators.length, 0, \"Initially, there should be no delegators\");\n }\n\n function test_getUserPoint() public {\n uint256 tokenId = 1;\n IveIONStructsEnumsErrorsEvents.LpTokenType lpType = IveIONStructsEnumsErrorsEvents.LpTokenType(1);\n uint256 epoch = 0;\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(tokenId, lpType, epoch);\n assertEq(userPoint.bias, 0, \"Initial user point bias should be zero\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Voting.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Voting is veIONTest {\n address user;\n LockInfo lockInput;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n }\n\n function test_voting_VotingCanBeSet() public {\n address voter = address(this);\n IveION(ve).setVoter(voter);\n uint256 tokenId = lockInput.tokenId;\n\n vm.prank(voter);\n IveION(ve).voting(tokenId, true);\n\n bool isVoted = IveION(ve).s_voted(tokenId);\n assertTrue(isVoted, \"Token should be marked as voted\");\n\n vm.prank(voter);\n IveION(ve).voting(tokenId, false);\n\n isVoted = IveION(ve).s_voted(tokenId);\n assertFalse(isVoted, \"Token should not be marked as voted\");\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Withdraw.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Withdraw is veIONTest {\n address user;\n LockInfo lockInput;\n LockInfoMultiple lockInputMultiLP;\n\n address alice;\n address bob;\n address cindy;\n address ralph;\n LockInfo lockInfoAlice;\n LockInfo lockInfoBob;\n LockInfo lockInfoCindy;\n LockInfo lockInfoRalph;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n lockInputMultiLP = _createLockMultipleInternal(user);\n IveION(ve).setVoter(address(this));\n }\n\n function afterForkSetUp() internal override {\n _afterForkSetUpMode();\n\n alice = address(0x8325);\n bob = address(0x2542);\n cindy = address(0x3423);\n ralph = address(0x2524);\n lockInfoAlice = _createLockInternalRealLP(alice, true);\n lockInfoBob = _createLockInternalRealLP(bob, false);\n lockInfoCindy = _createLockInternalRealLP(cindy, true);\n lockInfoRalph = _createLockInternalRealLP(ralph, false);\n }\n\n function test_withdraw_UserCanWithdrawFinishedLock() public {\n vm.warp(block.timestamp + 52 weeks + 1);\n\n uint256 supplyBefore = IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress));\n uint256 cumulativeLPAmountBefore = IveION(ve).s_userCumulativeAssetValues(user, address(modeVelodrome5050IonMode));\n vm.prank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory locked = IveION(ve).getUserLock(lockInput.tokenId, veloLpType);\n\n uint256 cumulativeLPAmountAfter = IveION(ve).s_userCumulativeAssetValues(user, address(modeVelodrome5050IonMode));\n uint256 userBalanceAfterWithdraw = modeVelodrome5050IonMode.balanceOf(user);\n uint256 userEpoch = IveION(ve).s_userPointEpoch(lockInput.tokenId, IveION(ve).s_lpType(lockInput.tokenAddress));\n IveIONStructsEnumsErrorsEvents.UserPoint memory userPoint = IveION(ve).getUserPoint(\n lockInput.tokenId,\n IveION(ve).s_lpType(lockInput.tokenAddress),\n userEpoch\n );\n uint256[] memory ownerTokenIds = IveION(ve).getOwnedTokenIds(user);\n address[] memory assetsLocked = IveION(ve).getAssetsLocked(lockInput.tokenId);\n\n assertEq(locked.amount, 0, \"Lock amount should be zero after withdrawal\");\n assertEq(locked.end, 0, \"Lock end time should be zero after withdrawal\");\n assertEq(userBalanceAfterWithdraw, lockInput.tokenAmount, \"User should receive the locked tokens back\");\n assertEq(\n IveION(ve).s_supply(IveION(ve).s_lpType(lockInput.tokenAddress)),\n supplyBefore - lockInput.tokenAmount,\n \"Supply mismatch\"\n );\n assertEq(userEpoch, 2, \"User epoch mismatch\");\n assertEq(userPoint.ts, block.timestamp, \"User point timestamp mismatch\");\n assertEq(userPoint.blk, block.number, \"User point block number mismatch\");\n assertEq(userPoint.bias, 0, \"User point bias mismatch\");\n assertEq(userPoint.slope, 0, \"User point slope mismatch\");\n assertEq(userPoint.permanent, 0, \"User point permanent mismatch\");\n assertEq(IveION(ve).s_tokenId(), 2, \"Token ID mismatch\");\n assertEq(ownerTokenIds.length, 1, \"Owner should have one token ID\");\n assertEq(assetsLocked.length, 0, \"Assets locked length mismatch\");\n assertEq(\n cumulativeLPAmountBefore - lockInput.tokenAmount,\n cumulativeLPAmountAfter,\n \"Cumulative amount should have decreased \"\n );\n }\n\n function test_withdraw_UserCanWithdrawEarly() public {\n address randomWallet = address(0x7890);\n uint256 mintAmount = 100000000000000000 ether; // Mint tokens so that penalty comes into effect\n modeVelodrome5050IonMode.mint(randomWallet, mintAmount);\n\n vm.warp(block.timestamp + 10 weeks);\n\n vm.prank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n\n IveIONStructsEnumsErrorsEvents.LockedBalance memory actualLocked = IveION(ve).getUserLock(\n lockInput.tokenId,\n veloLpType\n );\n\n uint256 userBalanceAfterWithdraw = modeVelodrome5050IonMode.balanceOf(user);\n assertEq(actualLocked.amount, 0, \"Lock amount should be zero after withdrawal\");\n assertEq(actualLocked.end, 0, \"Lock end time should be zero after withdrawal\");\n assertEq(\n userBalanceAfterWithdraw,\n (lockInput.tokenAmount * 20) / 100,\n \"User should receive 20% of the locked tokens back after withdraw penalty\"\n );\n }\n\n function test_withdraw_UserStakedUnderlying() public forkAtBlock(MODE_MAINNET, 16559826) {\n TestVars memory vars;\n\n address ionMode5050 = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n address veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n\n address[] memory whitelistedTokens = new address[](1);\n bool[] memory isWhitelistedTokens = new bool[](1);\n whitelistedTokens[0] = ionMode5050;\n isWhitelistedTokens[0] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n // Mint ModeVelodrome tokens to the user\n vars.user = address(0x5678);\n vars.amount = 10 ether;\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050).transfer(vars.user, vars.amount);\n\n // Approve veION contract to spend user's tokens\n vm.prank(vars.user);\n IERC20(ionMode5050).approve(address(ve), vars.amount);\n\n // Prepare parameters for createLock\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(ionMode5050);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vars.stakeUnderlying = new bool[](1);\n vars.stakeUnderlying[0] = true;\n\n // Create lock\n vm.prank(vars.user);\n uint256 tokenId = IveION(ve).createLock(\n vars.tokenAddresses,\n vars.tokenAmounts,\n vars.durations,\n vars.stakeUnderlying\n );\n\n // Advance the blockchain by 1 week\n vm.warp(block.timestamp + 1 weeks);\n\n address stakingWalletInstance = veloIonModeStakingStrategy.userStakingWallet(vars.user);\n uint256 rewardEarned = IVeloIonModeStaking(veloGauge).earned(stakingWalletInstance);\n\n // Withdraw the tokens\n vm.prank(vars.user);\n IveION(ve).withdraw(address(ionMode5050), tokenId);\n\n uint256 stakingWalletInstanceBalance = IVeloIonModeStaking(veloGauge).balanceOf(stakingWalletInstance);\n uint256 userBalance = IERC20(ionMode5050).balanceOf(vars.user);\n address rewardToken = IVeloIonModeStaking(veloGauge).rewardToken();\n uint256 rewardBalance = IERC20(rewardToken).balanceOf(vars.user);\n\n assertEq(stakingWalletInstanceBalance, 0, \"Staking wallet balance should be zero after withdrawal\");\n assertEq(\n userBalance,\n 2e18,\n \"User's balance should be equal to the initial amount, minus the penalty after withdrawal\"\n );\n assertEq(rewardBalance, rewardEarned, \"User should have claimed some reward\");\n }\n\n function test_withdraw_WithdrawCorrectUnderlyingStakingAfterSplitAndTransfer()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n uint256 splitAmt = 4e18;\n uint256 originalTokenAmt = REAL_LP_LOCK_AMOUNT - 4e18;\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n splitAmt\n );\n\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT,\n \"Alice cumulative value should be the original locked amount\"\n );\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT,\n \"Bob cumulative value should be the original locked amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n splitAmt,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n IveION(ve).transferFrom(alice, bob, tokenId1);\n vm.stopPrank();\n\n uint256 cumulativeAssetBalancePostTransferAlice = splitAmt;\n uint256 cumulativeAssetBalancePostTransferBob = REAL_LP_LOCK_AMOUNT + originalTokenAmt;\n\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferAlice,\n \"Cumulative asset value for alice should drop post transfer\"\n );\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferBob,\n \"Cumulative asset value for bob should increase post transfer\"\n );\n\n address stakingWalletInstanceAlice = veloIonModeStakingStrategy.userStakingWallet(alice);\n address stakingWalletInstanceBob = veloIonModeStakingStrategy.userStakingWallet(bob);\n\n uint256 stakedBalanceAlice = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceAlice);\n uint256 stakedBalanceBob = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceBob);\n\n console.log(\"Staked Balance Alice:\", stakedBalanceAlice);\n console.log(\"Staked Balance Bob:\", stakedBalanceBob);\n\n assertEq(\n stakedBalanceAlice,\n splitAmt,\n \"Alice's staked balance should be equal to the original lock amount minus the split amount\"\n );\n\n assertEq(stakedBalanceBob, REAL_LP_LOCK_AMOUNT - splitAmt, \"Bob's staked balance should be zero before withdrawal\");\n\n vm.warp(block.timestamp + 52 weeks);\n\n vm.prank(bob);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId1);\n\n vm.prank(alice);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId2);\n\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(alice, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferAlice - splitAmt,\n \"CumulativeAssetValue should be reduced post withdrawal for alice\"\n );\n assertEq(\n IveION(ve).s_userCumulativeAssetValues(bob, lockInfoAlice.tokenAddress),\n cumulativeAssetBalancePostTransferBob - originalTokenAmt,\n \"CumulativeAssetValue should be reduced post withdrawal for bob\"\n );\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(bob),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Bob's balance should be equal to the original lock amount minus the split amount\"\n );\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(alice),\n splitAmt,\n \"Alice's balance should be equal to the split amount\"\n );\n }\n\n function test_withdraw_WithdrawCorrectUnderlyingStakingAfterSplitThenTransferToUserWithUnderlyingStake()\n public\n forkAtBlock(MODE_MAINNET, 16559826)\n {\n IveION(ve).toggleSplit(address(0), true);\n IveION(ve).setMinimumLockAmount(lockInfoAlice.tokenAddress, 1e18);\n\n uint256 splitAmt = 4e18;\n\n vm.startPrank(alice);\n (uint256 tokenId1, uint256 tokenId2) = IveION(ve).split(\n lockInfoAlice.tokenAddress,\n lockInfoAlice.tokenId,\n splitAmt\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId1, lockInfoAlice.tokenAddress),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Underlying stake for tokenId1 should be half of the original lock amount\"\n );\n\n assertEq(\n IveION(ve).s_underlyingStake(tokenId2, lockInfoAlice.tokenAddress),\n splitAmt,\n \"Underlying stake for tokenId2 should be half of the original lock amount\"\n );\n IveION(ve).transferFrom(alice, cindy, tokenId1);\n vm.stopPrank();\n\n address stakingWalletInstanceAlice = veloIonModeStakingStrategy.userStakingWallet(alice);\n address stakingWalletInstanceCindy = veloIonModeStakingStrategy.userStakingWallet(cindy);\n\n uint256 stakedBalanceAlice = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceAlice);\n uint256 stakedBalanceCindy = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceCindy);\n\n console.log(\"Staked Balance Alice:\", stakedBalanceAlice);\n console.log(\"Staked Balance Cindy:\", stakedBalanceCindy);\n\n assertEq(stakedBalanceAlice, splitAmt, \"Alice's staked balance should be the split amount\");\n\n assertEq(\n stakedBalanceCindy,\n REAL_LP_LOCK_AMOUNT + REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Cindy's staked balance should be equal to the original lock amount minus the split amount\"\n );\n\n vm.warp(block.timestamp + 52 weeks);\n\n vm.prank(cindy);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId1);\n\n vm.prank(alice);\n IveION(ve).withdraw(lockInfoAlice.tokenAddress, tokenId2);\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(cindy),\n REAL_LP_LOCK_AMOUNT - splitAmt,\n \"Bob's balance should be equal to the original lock amount minus the split amount\"\n );\n\n assertEq(\n IERC20(lockInfoAlice.tokenAddress).balanceOf(alice),\n splitAmt,\n \"Alice's balance should be equal to the split amount\"\n );\n }\n\n function test_withdraw_MultiLpSplitTransferThenWithdraw() public forkAtBlock(MODE_MAINNET, 16559826) {\n IveION(ve).setMinimumLockAmount(address(ionWeth5050lPAero), 1);\n IveION(ve).setMinimumLockAmount(address(wethUSDC5050LP), 1);\n IveION(ve).toggleSplit(address(0), true);\n uint256 wethUSDCAmt = 2e16;\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(ionMode5050LP);\n lpTokens[1] = address(wethUSDC5050LP);\n\n address[] memory users = new address[](4);\n users[0] = alice;\n users[1] = bob;\n users[2] = cindy;\n users[3] = ralph;\n\n console.log(\"Stakes before alice locks multi lp\");\n _logUnderlyingStake(users);\n\n vm.prank(0x8034857f8A467624BaF973de28026CEB9A2fF5F1);\n IERC20(ionMode5050LP).transfer(alice, REAL_LP_LOCK_AMOUNT);\n vm.prank(0x98d34C7b004688F35b67Aa30D4dF5E67113f6B3D);\n IERC20(wethUSDC5050LP).transfer(alice, wethUSDCAmt);\n\n address[] memory tokenAddresses = new address[](2);\n uint256[] memory tokenAmounts = new uint256[](2);\n uint256[] memory durations = new uint256[](2);\n bool[] memory stakeUnderlying = new bool[](2);\n tokenAddresses[0] = address(ionMode5050LP);\n tokenAmounts[0] = REAL_LP_LOCK_AMOUNT;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = true;\n tokenAddresses[1] = address(wethUSDC5050LP);\n tokenAmounts[1] = wethUSDCAmt;\n durations[1] = 52 weeks;\n stakeUnderlying[1] = true;\n\n vm.startPrank(alice);\n IERC20(ionMode5050LP).approve(address(ve), REAL_LP_LOCK_AMOUNT);\n IERC20(wethUSDC5050LP).approve(address(ve), wethUSDCAmt);\n uint256 tokenId1 = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n console.log(\"Stakes after alice locks multi lp\");\n _logUnderlyingStake(users);\n\n vm.prank(alice);\n (, uint256 tokenId2) = IveION(ve).split(ionMode5050LP, tokenId1, 3e18);\n\n vm.prank(alice);\n (, uint256 tokenId3) = IveION(ve).split(wethUSDC5050LP, tokenId1, 1e16);\n\n console.log(\"Stakes after alice splits multi lp into one token with 3e18 ion-mode and 1e16 weth-usdc\");\n _logUnderlyingStake(users);\n\n uint256[] memory tokenIds = new uint256[](3);\n tokenIds[0] = tokenId1;\n tokenIds[1] = tokenId2;\n tokenIds[2] = tokenId3;\n\n vm.startPrank(alice);\n IveION(ve).transferFrom(alice, bob, tokenId1);\n IveION(ve).transferFrom(alice, cindy, tokenId2);\n IveION(ve).transferFrom(alice, ralph, tokenId3);\n vm.stopPrank();\n\n address stakingWalletInstanceIonMode = veloIonModeStakingStrategy.userStakingWallet(users[1]);\n address stakingWalletInstanceWethUsdc = veloWethUsdcStakingStrategy.userStakingWallet(users[1]);\n\n uint256 stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n uint256 stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n assertEq(stakedBalanceIonMode, 7e18, \"Underlying staked balance for bob updated ion-mode\");\n assertEq(stakedBalanceWethUsdc, 1e16, \"Underlying staked balance for bob updated weth-usdc\");\n\n console.log(\n \"Stakes after alice sends 7e18 ion-mode and 1e16 weth-usdc token to bob, 3e18 ion-mode token to cindy, 1e16 weth-usdc token to ralph\"\n );\n _logUnderlyingStake(users);\n\n vm.startPrank(bob);\n IveION(ve).withdraw(address(ionMode5050LP), tokenId1);\n IveION(ve).withdraw(address(wethUSDC5050LP), tokenId1);\n vm.stopPrank();\n\n vm.prank(cindy);\n IveION(ve).withdraw(address(ionMode5050LP), tokenId2);\n\n vm.prank(ralph);\n IveION(ve).withdraw(address(wethUSDC5050LP), tokenId3);\n\n console.log(\n \"bob withdraws 7e18 ion-mode, 1e16 weth-usdc, cindy withdraws ion-mode 3e18, ralph withdraws 1e16 weth-usdc\"\n );\n stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n assertEq(stakedBalanceIonMode, 0, \"Underlying staked balance for bob updated ion-mode\");\n assertEq(stakedBalanceWethUsdc, 0, \"Underlying staked balance for bob updated weth-usdc\");\n\n _logUnderlyingStake(users);\n // _logCumulativeAssetValues(users, lpTokens);\n // _logTokens(tokenIds, lpTokens);\n }\n\n function test_withdraw_RevertIfNotOwner() public {\n vm.prank(address(0x3523));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_withdraw_RevertIfVoting() public {\n IveION(ve).voting(lockInput.tokenId, true);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVoted()\"));\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n }\n\n function test_withdraw_RevertIfPermanentLock() public {\n vm.startPrank(user);\n IveION(ve).lockPermanent(lockInput.tokenAddress, lockInput.tokenId);\n vm.expectRevert(abi.encodeWithSignature(\"PermanentLock()\"));\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInput.tokenId);\n vm.stopPrank();\n }\n\n function test_withdraw_RevertIfTokenNotWhitelisted() public {\n MockERC20 randomMockToken = new MockERC20(\"Random_Token\", \"RND\", 18);\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"TokenNotWhitelisted()\"));\n IveION(ve).withdraw(address(randomMockToken), lockInput.tokenId);\n }\n\n function test_withdraw_TokenShouldStillExistIfRemainingLP() public {\n vm.prank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n address owner = IveION(ve).ownerOf(lockInputMultiLP.tokenId);\n assertEq(owner, user, \"User should still own their token\");\n }\n\n function test_withdraw_TokenShouldBeBurntInAllLPRemoved() public {\n vm.startPrank(user);\n IveION(ve).withdraw(address(modeVelodrome5050IonMode), lockInputMultiLP.tokenId);\n IveION(ve).withdraw(address(modeBalancer8020IonEth), lockInputMultiLP.tokenId);\n vm.stopPrank();\n\n vm.expectRevert(\"ERC721: invalid token ID\");\n IveION(ve).ownerOf(lockInputMultiLP.tokenId);\n\n uint256[] memory ownerTokenIds = IveION(ve).getOwnedTokenIds(user);\n bool tokenIdFound = false;\n for (uint256 i = 0; i < ownerTokenIds.length; i++) {\n if (ownerTokenIds[i] == lockInputMultiLP.tokenId) {\n tokenIdFound = true;\n break;\n }\n }\n assertFalse(tokenIdFound, \"Token ID should be removed from user's owned tokens\");\n }\n\n function test_withdraw_WithdrawAssetNotOwnedButWhitelisted() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NoLockFound()\"));\n IveION(ve).withdraw(address(modeBalancer8020IonEth), lockInput.tokenId);\n }\n}\n" + }, + "contracts/test/veION/contracts/veION/Withdrawals.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"../../Utils.sol\";\n\ncontract Withdrawals is veIONTest {\n address user;\n LockInfo lockInput;\n\n function setUp() public {\n _setUp();\n user = address(0x1234);\n lockInput = _createLockInternal(user);\n\n modeVelodrome5050IonMode.mint(address(0x1241), 20_000_000 ether);\n vm.prank(user);\n IveION(ve).withdraw(lockInput.tokenAddress, lockInput.tokenId);\n }\n\n function test_withdrawProtocolFees_SuccessfulWithdrawal() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n uint256 initialRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n uint256 initialProtocolFees = IveION(ve).s_protocolFees(IveION(ve).s_lpType(tokenAddress));\n\n IveION(ve).withdrawProtocolFees(tokenAddress, recipient);\n\n uint256 protocolFees = IveION(ve).s_protocolFees(IveION(ve).s_lpType(tokenAddress));\n assertEq(protocolFees, 0, \"Protocol fees should be zero after withdrawal\");\n\n uint256 finalRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n assertEq(\n finalRecipientBalance,\n initialRecipientBalance + initialProtocolFees,\n \"Recipient should receive the protocol fees\"\n );\n }\n\n function test_withdrawProtocolFees_NotOwner() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n\n vm.prank(user);\n vm.expectRevert(\"Ownable: caller is not the owner\");\n IveION(ve).withdrawProtocolFees(tokenAddress, recipient);\n }\n\n function test_withdrawDistributedFees_SuccessfulWithdrawal() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n uint256 initialRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n uint256 initialDistributedFees = IveION(ve).s_distributedFees(IveION(ve).s_lpType(tokenAddress));\n\n IveION(ve).withdrawDistributedFees(tokenAddress, recipient);\n\n uint256 distributedFees = IveION(ve).s_distributedFees(IveION(ve).s_lpType(tokenAddress));\n assertEq(distributedFees, 0, \"Distributed fees should be zero after withdrawal\");\n\n uint256 finalRecipientBalance = IERC20(tokenAddress).balanceOf(recipient);\n assertEq(\n finalRecipientBalance,\n initialRecipientBalance + initialDistributedFees,\n \"Recipient should receive the distributed fees\"\n );\n }\n\n function test_withdrawDistributedFees_NotOwner() public {\n address recipient = address(0x5678);\n address tokenAddress = lockInput.tokenAddress;\n\n vm.prank(user);\n vm.expectRevert(\"Ownable: caller is not the owner\");\n IveION(ve).withdrawDistributedFees(tokenAddress, recipient);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/ClaimBribes.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../../../../veION/Voter.sol\";\nimport \"../../../../veION/BribeRewards.sol\";\nimport \"./utils/VoterUtils.sol\";\n\ncontract ClaimBribesTest is VoterTest {\n BribeRewards realBribeEthSupply;\n BribeRewards realBribeEthBorrow;\n MockERC20 bribeTokenA;\n MockERC20 bribeTokenB;\n MockERC20 bribeTokenC;\n\n function setUp() public {\n _setUp();\n bribeTokenA = new MockERC20(\"Bribe Token A\", \"BTA\", 18);\n bribeTokenB = new MockERC20(\"Bribe Token B\", \"BTB\", 18);\n\n realBribeEthSupply = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), address(ve))\n )\n )\n );\n\n realBribeEthBorrow = BribeRewards(\n address(\n new TransparentUpgradeableProxy(\n address(new BribeRewards()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(BribeRewards.initialize.selector, address(voter), address(ve))\n )\n )\n );\n\n address[] memory rewardAccumulatorsForBribes = new address[](2);\n address[] memory bribes = new address[](2);\n\n rewardAccumulatorsForBribes[0] = voter.marketToRewardAccumulators(ethMarket, IVoter.MarketSide.Supply);\n rewardAccumulatorsForBribes[1] = voter.marketToRewardAccumulators(ethMarket, IVoter.MarketSide.Borrow);\n bribes[0] = address(realBribeEthSupply);\n bribes[1] = address(realBribeEthBorrow);\n\n voter.whitelistToken(address(bribeTokenA), true);\n voter.whitelistToken(address(bribeTokenB), true);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n }\n\n function test_claimBribes() public {\n // Mint and approve bribe tokens\n bribeTokenA.mint(address(this), 1000 ether);\n bribeTokenA.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenB.mint(address(this), 1000 ether);\n bribeTokenB.approve(address(realBribeEthSupply), 1000 ether);\n\n // Notify reward amounts\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n // Deposit bribes\n address[] memory tokens = new address[](2);\n tokens[0] = address(bribeTokenA);\n tokens[1] = address(bribeTokenB);\n\n vm.startPrank(address(voter));\n realBribeEthSupply.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthSupply.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n vm.stopPrank();\n\n // Claim bribes\n address[] memory bribes = new address[](1);\n bribes[0] = address(realBribeEthSupply);\n address[][] memory rewardTokens = new address[][](1);\n rewardTokens[0] = tokens;\n\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(user);\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n\n // Check balances\n uint256 balanceA = bribeTokenA.balanceOf(user);\n uint256 balanceB = bribeTokenB.balanceOf(user);\n\n assertEq(balanceA, 1000 ether, \"User should have claimed 1000 ether of bribeTokenA\");\n assertEq(balanceB, 1000 ether, \"User should have claimed 1000 ether of bribeTokenB\");\n }\n\n function test_claimBribesMultipleBribes() public {\n // Mint and approve bribe tokens for both bribe contracts\n bribeTokenA.mint(address(this), 2000 ether);\n bribeTokenA.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenA.approve(address(realBribeEthBorrow), 1000 ether);\n\n bribeTokenB.mint(address(this), 2000 ether);\n bribeTokenB.approve(address(realBribeEthSupply), 1000 ether);\n bribeTokenB.approve(address(realBribeEthBorrow), 1000 ether);\n\n // Notify reward amounts for both bribe contracts\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthSupply.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthBorrow.notifyRewardAmount(address(bribeTokenA), 1000 ether);\n realBribeEthBorrow.notifyRewardAmount(address(bribeTokenB), 1000 ether);\n\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthSupply.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n realBribeEthBorrow.setHistoricalPrices(block.timestamp, address(modeVelodrome5050IonMode), 3e18);\n realBribeEthBorrow.setHistoricalPrices(block.timestamp, address(modeBalancer8020IonEth), 5e18);\n\n // Deposit bribes into both bribe contracts\n address[] memory tokens = new address[](2);\n tokens[0] = address(bribeTokenA);\n tokens[1] = address(bribeTokenB);\n\n vm.startPrank(address(voter));\n realBribeEthSupply.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthSupply.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n realBribeEthBorrow.deposit(address(modeVelodrome5050IonMode), 1000 ether, voterTokenIdSingleLp);\n realBribeEthBorrow.deposit(address(modeBalancer8020IonEth), 1000 ether, voterTokenIdSingleLp);\n vm.stopPrank();\n\n // Claim bribes from both bribe contracts\n address[] memory bribes = new address[](2);\n bribes[0] = address(realBribeEthSupply);\n bribes[1] = address(realBribeEthBorrow);\n address[][] memory rewardTokens = new address[][](2);\n rewardTokens[0] = tokens;\n rewardTokens[1] = tokens;\n\n vm.warp(block.timestamp + 1 weeks);\n\n vm.prank(user);\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n\n // Check balances\n uint256 balanceA = bribeTokenA.balanceOf(user);\n uint256 balanceB = bribeTokenB.balanceOf(user);\n\n assertEq(balanceA, 2000 ether, \"User should have claimed 2000 ether of bribeTokenA\");\n assertEq(balanceB, 2000 ether, \"User should have claimed 2000 ether of bribeTokenB\");\n }\n\n function test_claimBribes_RevertIfNotOwner() public {\n address notOwner = address(0xABC);\n\n address[] memory bribes = new address[](2);\n bribes[0] = address(0x123); // Dummy address for bribe contract\n bribes[1] = address(0x456); // Dummy address for another bribe contract\n\n address[][] memory rewardTokens = new address[][](2);\n rewardTokens[0] = new address[](2);\n rewardTokens[0][0] = address(0x789); // Dummy address for reward token A\n rewardTokens[0][1] = address(0xABC); // Dummy address for reward token B\n\n rewardTokens[1] = new address[](2);\n rewardTokens[1][0] = address(0xDEF); // Dummy address for reward token A\n rewardTokens[1][1] = address(0xFED); // Dummy address for reward token B\n\n vm.startPrank(notOwner);\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n vm.stopPrank();\n }\n\n function test_claimBribes_RevertIfUnequalLengths() public {\n address[] memory bribes = new address[](2);\n bribes[0] = address(0x123); // Dummy address for bribe contract\n bribes[1] = address(0x456); // Dummy address for another bribe contract\n\n address[][] memory rewardTokens = new address[][](1); // Intentionally unequal length\n rewardTokens[0] = new address[](2);\n rewardTokens[0][0] = address(0x789); // Dummy address for reward token A\n rewardTokens[0][1] = address(0xABC); // Dummy address for reward token B\n\n vm.startPrank(user);\n vm.expectRevert(abi.encodeWithSignature(\"UnequalLengths()\"));\n voter.claimBribes(bribes, rewardTokens, voterTokenIdSingleLp);\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/DistributeRewards.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\nimport { PoolDirectory } from \"../../../../PoolDirectory.sol\";\nimport { EmissionsManager } from \"../../../../EmissionsManager.sol\";\nimport { IonicFlywheelCore } from \"../../../../ionic/strategies/flywheel/IonicFlywheelCore.sol\";\nimport { IonicFlywheel } from \"../../../../ionic/strategies/flywheel/IonicFlywheel.sol\";\nimport { IonicFlywheelBorrow } from \"../../../../ionic/strategies/flywheel/IonicFlywheelBorrow.sol\";\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\nimport { IFlywheelBooster } from \"../../../../ionic/strategies/flywheel/IFlywheelBooster.sol\";\nimport { IFlywheelRewards } from \"../../../../ionic/strategies/flywheel/rewards/IFlywheelRewards.sol\";\nimport { IIonicFlywheelBorrowBooster } from \"../../../../ionic/strategies/flywheel/IIonicFlywheelBorrowBooster.sol\";\nimport { IonicFlywheelBorrowBooster } from \"../../../../ionic/strategies/flywheel/IonicFlywheelBorrowBooster.sol\";\nimport { IonicFlywheelDynamicRewards } from \"../../../../ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.sol\";\nimport { Comptroller } from \"../../../../compound/Comptroller.sol\";\nimport { RewardAccumulator } from \"../../../../veION/RewardAccumulator.sol\";\nimport { CErc20RewardsDelegate } from \"../../../../compound/CErc20RewardsDelegate.sol\";\n\ncontract DistributeRewards is VoterTest {\n address owner = 0x1155b614971f16758C92c4890eD338C9e3ede6b7;\n address ion = 0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5;\n address weth = 0x4200000000000000000000000000000000000006;\n address usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n address ionWhale = 0x7862Ba142511eEf11a5a8b179DB4F53AC115AB59;\n address baseWETHWhale = 0x0250f06fc76297Fe28D0981F0566F1c0445B3cFE;\n address baseUSDCWhale = 0x0B0A5886664376F59C351ba3f598C8A8B4D0A6f3;\n address baseIonWethWhale = 0xf018B923bEbdef7a8124371B322D7E29a08c3198;\n address[] markets;\n address[] uniqMarkets;\n IVoter.MarketSide[] sides;\n IVoter.MarketSide[] borrowSides;\n IVoter.MarketSide[] supplySides;\n uint256[] weights;\n uint256 rewardAmount = 1_000_000 * 1e18;\n uint256 ONE = 1e18;\n address[] rewardAccumulators;\n address[] supplyRewardAccumulators;\n address[] borrowRewardAccumulators;\n\n CErc20RewardsDelegate ionUsdcMarket = CErc20RewardsDelegate(0xa900A17a49Bc4D442bA7F72c39FA2108865671f0);\n PoolDirectory poolDirectory = PoolDirectory(0xE1A3006be645a80F206311d9f18C866c204bA02f);\n IonicFlywheel flywheelSupply;\n IonicFlywheelBorrow flywheelBorrow;\n IonicFlywheelDynamicRewards flywheelRewardsBorrow;\n IonicFlywheelDynamicRewards flywheelRewardsSupply;\n EmissionsManager emissionsManager;\n address protocalAddress = address(0x123);\n bytes bytecode = hex\"deadbeef\";\n IIonicFlywheelBorrowBooster flywheelBooster;\n uint32 constant ONE_WEEK = 1 weeks;\n Comptroller comptroller = Comptroller(0x05c9C6417F246600f8f5f49fcA9Ee991bfF73D13);\n\n function afterForkSetUp() internal override {\n super.afterForkSetUp();\n\n markets = new address[](4);\n sides = new IVoter.MarketSide[](4);\n weights = new uint256[](4);\n\n markets[0] = ethMarket;\n sides[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n markets[1] = ethMarket;\n sides[1] = IVoter.MarketSide.Borrow;\n weights[1] = 100;\n\n markets[2] = btcMarket;\n sides[2] = IVoter.MarketSide.Supply;\n weights[2] = 100;\n\n markets[3] = btcMarket;\n sides[3] = IVoter.MarketSide.Borrow;\n weights[3] = 100;\n\n UniswapLpTokenPriceOracle uniswapLpTokenPriceOracleIonWeth = new UniswapLpTokenPriceOracle(address(weth));\n UniswapLpTokenPriceOracle uniswapLpTokenPriceOracleWethAero = new UniswapLpTokenPriceOracle(address(weth));\n address[] memory underlyings = new address[](2);\n BasePriceOracle[] memory oracles = new BasePriceOracle[](2);\n\n underlyings[0] = address(ionWeth5050lPAero);\n oracles[0] = BasePriceOracle(address(uniswapLpTokenPriceOracleIonWeth));\n underlyings[1] = address(wethAero5050LPAero);\n oracles[1] = BasePriceOracle(address(uniswapLpTokenPriceOracleWethAero));\n\n vm.prank(mpo.admin());\n mpo.add(underlyings, oracles);\n\n vm.startPrank(owner);\n emissionsManager = EmissionsManager(\n address(\n new TransparentUpgradeableProxy(\n address(new EmissionsManager()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n EmissionsManager.initialize.selector,\n poolDirectory,\n protocalAddress,\n ERC20(ion),\n 2500,\n bytecode\n )\n )\n )\n );\n\n emissionsManager.setVeIon(IveION(ve));\n\n // Deploy borrow flywheels\n flywheelBooster = new IonicFlywheelBorrowBooster();\n\n flywheelBorrow = IonicFlywheelBorrow(\n address(\n new TransparentUpgradeableProxy(\n address(new IonicFlywheelBorrow()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n IonicFlywheelCore.initialize.selector,\n ERC20(ion),\n IFlywheelRewards(address(0)),\n IFlywheelBooster(address(flywheelBooster)),\n owner\n )\n )\n )\n );\n // Deploy supply flywheels\n flywheelSupply = IonicFlywheel(\n address(\n new TransparentUpgradeableProxy(\n address(new IonicFlywheel()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n IonicFlywheelCore.initialize.selector,\n ERC20(ion),\n IFlywheelRewards(address(0)),\n IFlywheelBooster(address(0)),\n owner\n )\n )\n )\n );\n\n flywheelRewardsBorrow = new IonicFlywheelDynamicRewards(IonicFlywheelCore(address(flywheelBorrow)), ONE_WEEK);\n flywheelBorrow.setFlywheelRewards(IFlywheelRewards(address(flywheelRewardsBorrow)));\n\n flywheelRewardsSupply = new IonicFlywheelDynamicRewards(IonicFlywheelCore(address(flywheelSupply)), ONE_WEEK);\n flywheelSupply.setFlywheelRewards(IFlywheelRewards(address(flywheelRewardsSupply)));\n\n flywheelSupply.setEmissionsManager(emissionsManager);\n flywheelBorrow.setEmissionsManager(emissionsManager);\n flywheelSupply.updateFeeSettings(0, protocalAddress);\n flywheelBorrow.updateFeeSettings(0, protocalAddress);\n\n uniqMarkets = new address[](2);\n uniqMarkets[0] = markets[0];\n uniqMarkets[1] = markets[2];\n\n supplyRewardAccumulators = new address[](2);\n borrowRewardAccumulators = new address[](2);\n\n for (uint256 i = 0; i < uniqMarkets.length; i++) {\n flywheelBorrow.addStrategyForRewards(ERC20(uniqMarkets[i]));\n flywheelSupply.addStrategyForRewards(ERC20(uniqMarkets[i]));\n supplyRewardAccumulators[i] = voter.marketToRewardAccumulators(uniqMarkets[i], IVoter.MarketSide.Supply);\n borrowRewardAccumulators[i] = voter.marketToRewardAccumulators(uniqMarkets[i], IVoter.MarketSide.Borrow);\n }\n\n flywheelRewardsBorrow.setRewardAccumulators(uniqMarkets, borrowRewardAccumulators);\n flywheelRewardsSupply.setRewardAccumulators(uniqMarkets, supplyRewardAccumulators);\n vm.stopPrank();\n\n vm.startPrank(address(0));\n for (uint256 i = 0; i < uniqMarkets.length; i++) {\n RewardAccumulator(supplyRewardAccumulators[i]).approve(ion, address(flywheelRewardsSupply));\n RewardAccumulator(borrowRewardAccumulators[i]).approve(ion, address(flywheelRewardsBorrow));\n }\n vm.stopPrank();\n\n vm.startPrank(comptroller.admin());\n comptroller._addRewardsDistributor(address(flywheelBorrow));\n comptroller._addRewardsDistributor(address(flywheelSupply));\n vm.stopPrank();\n }\n\n function test_distributeRewards_RewardsCanBeDistributed() public forkAtBlock(BASE_MAINNET, 23248915) {\n vm.prank(baseUser);\n voter.vote(baseTokenIdSingleLp, markets, sides, weights);\n uint256 ionPrice = mpo.price(ion);\n uint256 wethPrice = mpo.price(weth);\n\n uint256 ionWethLpPrice = mpo.price(ionWeth5050lPAero);\n\n console.log(\"ION Price:\", ionPrice);\n console.log(\"WETH Price:\", wethPrice);\n console.log(\"ION-WETH LP Price:\", ionWethLpPrice);\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n uint256 expectedBalance = rewardAmount / 4;\n assertEq(ionBalance, expectedBalance, \"Each reward accumulator should have a quarter of the tokens\");\n }\n }\n\n function test_distributeRewards_MultiLPAndVoters() public forkAtBlock(BASE_MAINNET, 23248915) {\n address[] memory voters = new address[](20);\n uint256[] memory tokenIds = new uint256[](20);\n uint256 totalWeight = 0;\n for (uint256 i = 0; i < voters.length; i++) {\n voters[i] = address(uint160(uint256(keccak256(abi.encodePacked(i, block.timestamp)))));\n\n uint256 ionWethAmount = 10 + (uint256(keccak256(abi.encodePacked(i, block.timestamp))) % 11);\n uint256 wethAeroAmount = 10 + (uint256(keccak256(abi.encodePacked(i, block.timestamp, uint256(1)))) % 11);\n\n tokenIds[i] = _lockMultiLpFork(voters[i], ionWethAmount * 1e18, wethAeroAmount * 1e18);\n\n uint256[] memory weights = new uint256[](4);\n for (uint256 j = 0; j < weights.length; j++) {\n weights[j] = 1 + (uint256(keccak256(abi.encodePacked(j, block.timestamp, i))) % 100);\n totalWeight += weights[j];\n }\n _vote(voters[i], tokenIds[i], weights);\n }\n\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 marketWeightIonWeth = voter.weights(markets[i], sides[i], address(ionWeth5050lPAero));\n uint256 marketWeightWethAero = voter.weights(markets[i], sides[i], address(wethAero5050LPAero));\n console.log(\"-----------------------------------------------------\");\n console.log(\"Market:\", markets[i]);\n console.log(\"Side:\", uint256(sides[i]));\n console.log(\"Market Weight ION-WETH:\", marketWeightIonWeth);\n console.log(\"Market Weight WETH-AERO:\", marketWeightWethAero);\n }\n console.log(\"-----------------------------------------------------\");\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n uint256[] memory expectedBalances = new uint256[](4);\n expectedBalances[0] = 276676147359650479260798;\n expectedBalances[1] = 223767532575522266411076;\n expectedBalances[2] = 245411929366342403014352;\n expectedBalances[3] = 254144390698484851313772;\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n assertEq(ionBalance, expectedBalances[i], \"Each reward accumulator should have roughly a quarter\");\n }\n\n // Log the price of ION-WETH LP using mpo.price\n uint256 ionWethPrice = mpo.price(address(ionWeth5050lPAero));\n console.log(\"Price of ION-WETH LP:\", ionWethPrice);\n\n // Log the price of WETH-AERO LP using mpo.price\n uint256 wethAeroPrice = mpo.price(address(wethAero5050LPAero));\n console.log(\"Price of WETH-AERO LP:\", wethAeroPrice);\n }\n\n function test_claimRewards_RewardsCanBeClaimed() public forkAtBlock(BASE_MAINNET, 21579411) {\n vm.prank(baseUser);\n voter.vote(baseTokenIdSingleLp, markets, sides, weights);\n uint256 ionPrice = mpo.price(ion);\n uint256 wethPrice = mpo.price(weth);\n\n uint256 ionWethLpPrice = mpo.price(ionWeth5050lPAero);\n\n console.log(\"ION Price:\", ionPrice);\n console.log(\"WETH Price:\", wethPrice);\n console.log(\"ION-WETH LP Price:\", ionWethLpPrice);\n\n vm.warp(voter.epochVoteEnd(block.timestamp) + 1);\n\n vm.prank(ionWhale);\n IERC20(ion).transfer(address(voter), rewardAmount);\n voter.distributeRewards();\n\n for (uint256 i = 0; i < markets.length; i++) {\n address rewardAccumulator = voter.marketToRewardAccumulators(markets[i], sides[i]);\n uint256 ionBalance = IERC20(ion).balanceOf(rewardAccumulator);\n console.log(\"ION Balance for Reward Accumulator\", rewardAccumulator, \":\", ionBalance);\n\n uint256 expectedBalance = rewardAmount / 4;\n assertEq(ionBalance, expectedBalance, \"Each reward accumulator should have a quarter of the tokens\");\n }\n\n _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n\n vm.prank(baseWETHWhale);\n IERC20(weth).transfer(address(baseUser), ONE);\n\n uint256 ionBalanceBefore = IERC20(ion).balanceOf(address(baseUser));\n\n vm.startPrank(baseUser);\n IERC20(weth).approve(ethMarket, ONE);\n address[] memory marketToEnter;\n marketToEnter = new address[](2);\n marketToEnter[0] = ethMarket;\n marketToEnter[1] = btcMarket;\n\n comptroller.enterMarkets(marketToEnter);\n CErc20RewardsDelegate(ethMarket).mint(1e15);\n\n vm.stopPrank();\n vm.warp(voter.epochNext(block.timestamp));\n\n vm.startPrank(baseUser);\n flywheelSupply.accrue(ERC20(ethMarket), address(baseUser));\n\n flywheelSupply.claimRewards(address(baseUser));\n uint256 ionBalanceAfter = IERC20(ion).balanceOf(address(baseUser));\n uint256 rewardClaimed = ionBalanceAfter - ionBalanceBefore;\n uint256 ionwethBalanceAfter = IERC20(ethMarket).balanceOf(address(baseUser));\n uint256 ionwethTotalBalanceAfter = IERC20(ethMarket).totalSupply();\n assertEq(\n ionwethTotalBalanceAfter / ionwethBalanceAfter,\n rewardAmount / 4 / rewardClaimed,\n \"User should get his fair share of rewards\"\n );\n vm.stopPrank();\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/mocks/MockBribeRewards.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.10;\n\nimport \"../../../../../veION/interfaces/IBribeRewards.sol\";\n\ncontract MockBribeRewards is IBribeRewards {\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external override {\n emit Deposit(msg.sender, tokenId, amount);\n }\n\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external override {\n emit Withdraw(msg.sender, tokenId, amount);\n }\n\n function notifyRewardAmount(address token, uint256 amount) external override {\n emit RewardNotification(msg.sender, token, block.timestamp, amount);\n }\n\n function getReward(uint256 tokenId, address[] memory tokens) external override {\n for (uint256 i = 0; i < tokens.length; i++) {\n emit RewardsClaimed(msg.sender, tokens[i], 0); // Assuming 0 as a placeholder for reward amount\n }\n }\n\n function getPriorBalanceIndex(\n uint256 tokenId,\n address lpToken,\n uint256 timestamp\n ) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n\n function earned(address token, uint256 tokenId) external view override returns (uint256) {\n return 0; // Placeholder return value\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Poke.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Poke is VoterTest {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n\n function setUp() public {\n _setUp();\n\n marketVote = new address[](1);\n marketVoteSide = new IVoter.MarketSide[](1);\n weights = new uint256[](1);\n marketVote[0] = ethMarket;\n marketVoteSide[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n vm.startPrank(user);\n voter.vote(voterTokenIdMultiLp, marketVote, marketVoteSide, weights);\n voter.vote(voterTokenIdSingleLp, marketVote, marketVoteSide, weights);\n vm.stopPrank();\n }\n\n function test_poke_UserCanPoke() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(initialVoteDetails.votes[i], finalVoteDetails.votes[i], \"Votes should decrease with time\");\n }\n\n assertEq(\n initialVoteDetails.marketVotes.length,\n finalVoteDetails.marketVotes.length,\n \"Market votes length should remain the same\"\n );\n assertEq(\n initialVoteDetails.marketVoteSides.length,\n finalVoteDetails.marketVoteSides.length,\n \"Market vote sides length should remain the same\"\n );\n assertGt(initialVoteDetails.usedWeight, finalVoteDetails.usedWeight, \"Used weight should decrease with time\");\n\n for (uint256 i = 0; i < initialVoteDetails.marketVotes.length; i++) {\n assertEq(\n initialVoteDetails.marketVotes[i],\n finalVoteDetails.marketVotes[i],\n \"Market votes should remain the same\"\n );\n assertEq(\n uint256(initialVoteDetails.marketVoteSides[i]),\n uint256(finalVoteDetails.marketVoteSides[i]),\n \"Market vote sides should remain the same\"\n );\n }\n\n // Log initial votes and used weight\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n // Log final votes and used weight\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n // Repeat test for balancer vote details\n IVoter.VoteDetails memory initialBalancerVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory finalBalancerVoteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n for (uint256 i = 0; i < initialBalancerVoteDetails.votes.length; i++) {\n assertGt(\n initialBalancerVoteDetails.votes[i],\n finalBalancerVoteDetails.votes[i],\n \"Balancer votes should decrease with time\"\n );\n }\n\n assertEq(\n initialBalancerVoteDetails.marketVotes.length,\n finalBalancerVoteDetails.marketVotes.length,\n \"Balancer votes length should remain the same\"\n );\n assertEq(\n initialBalancerVoteDetails.marketVoteSides.length,\n finalBalancerVoteDetails.marketVoteSides.length,\n \"Balancer vote sides length should remain the same\"\n );\n assertGt(\n initialBalancerVoteDetails.usedWeight,\n finalBalancerVoteDetails.usedWeight,\n \"Balancer used weight should decrease with time\"\n );\n\n for (uint256 i = 0; i < initialBalancerVoteDetails.marketVotes.length; i++) {\n assertEq(\n initialBalancerVoteDetails.marketVotes[i],\n finalBalancerVoteDetails.marketVotes[i],\n \"Balancer votes should remain the same\"\n );\n assertEq(\n uint256(initialBalancerVoteDetails.marketVoteSides[i]),\n uint256(finalBalancerVoteDetails.marketVoteSides[i]),\n \"Balancer vote sides should remain the same\"\n );\n }\n\n // Log initial balancer votes and used weight\n for (uint256 i = 0; i < initialBalancerVoteDetails.votes.length; i++) {\n console.log(\"Initial Balancer Votes for market\", i, \":\", initialBalancerVoteDetails.votes[i]);\n }\n console.log(\"Initial Balancer Used Weight:\", initialBalancerVoteDetails.usedWeight);\n\n // Log final balancer votes and used weight\n for (uint256 i = 0; i < finalBalancerVoteDetails.votes.length; i++) {\n console.log(\"Final Balancer Votes for market\", i, \":\", finalBalancerVoteDetails.votes[i]);\n }\n console.log(\"Final Balancer Used Weight:\", finalBalancerVoteDetails.usedWeight);\n }\n\n function test_poke_UserCanPokeSingleAsset() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 4 weeks);\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(initialVoteDetails.votes[i], finalVoteDetails.votes[i]);\n }\n }\n\n function test_poke_RevertIfDistributeWindow() public {\n vm.warp(voter.epochVoteStart(block.timestamp));\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.poke(voterTokenIdSingleLp);\n }\n\n function test_poke_UntilExpiry() public {\n vm.warp(block.timestamp + 365 * 86400);\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n assertEq(finalVoteDetails.votes[i], 0, \"Final votes should be zero for each market\");\n }\n assertEq(finalVoteDetails.usedWeight, 0, \"Final used weight should be zero\");\n }\n\n function test_poke_AfterIncreaseAmount() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 additionalAmount = 1000 * 1e18; // Example amount to mint\n modeVelodrome5050IonMode.mint(user, additionalAmount);\n\n vm.startPrank(user);\n modeVelodrome5050IonMode.approve(address(ve), additionalAmount);\n IveION(ve).increaseAmount(address(modeVelodrome5050IonMode), voterTokenIdSingleLp, additionalAmount, false);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterIncreaseUnlock() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 additionalDuration = 70 weeks;\n vm.startPrank(user);\n IveION(ve).increaseUnlockTime(address(modeVelodrome5050IonMode), voterTokenIdSingleLp, additionalDuration);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterLockPermanent() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterUnlockPermanent() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).unlockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n vm.stopPrank();\n\n vm.warp(block.timestamp + 4 weeks);\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterDelegation() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdSingleLp, voterTokenIdMultiLp, address(modeVelodrome5050IonMode), 500 ether);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertGt(\n finalVoteDetails.votes[i],\n initialVoteDetails.votes[i],\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertGt(\n finalVoteDetails.usedWeight,\n initialVoteDetails.usedWeight,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterBeingDelegatedTo() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegatedAmount = 500 ether;\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdMultiLp, voterTokenIdSingleLp, address(modeVelodrome5050IonMode), delegatedAmount);\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertEq(\n finalVoteDetails.votes[i],\n (voterLockInfoSingleLp.tokenAmount + delegatedAmount) * 2,\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertEq(\n finalVoteDetails.usedWeight,\n (voterLockInfoSingleLp.tokenAmount + delegatedAmount) * 2,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterRemoveDelegator() public {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegatedAmount = 500 ether;\n\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdMultiLp, voterTokenIdSingleLp, address(modeVelodrome5050IonMode), delegatedAmount);\n uint256[] memory multiLpArray = new uint256[](1);\n multiLpArray[0] = voterTokenIdMultiLp;\n uint256[] memory delegatedAmountArray = new uint256[](1);\n delegatedAmountArray[0] = delegatedAmount;\n IveION(ve).removeDelegators(\n multiLpArray,\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode),\n delegatedAmountArray\n );\n vm.stopPrank();\n\n voter.poke(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n assertEq(\n finalVoteDetails.votes[i],\n (voterLockInfoSingleLp.tokenAmount) * 2,\n \"Final votes should be greater than initial votes\"\n );\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n assertEq(\n finalVoteDetails.usedWeight,\n (voterLockInfoSingleLp.tokenAmount) * 2,\n \"Final used weight should be greater than initial used weight\"\n );\n }\n\n function test_poke_AfterRemoveDelegatee() external {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 delegateAmount = 1000 ether;\n vm.startPrank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdSingleLp);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n IveION(ve).delegate(voterTokenIdSingleLp, voterTokenIdMultiLp, address(modeVelodrome5050IonMode), delegateAmount);\n uint256[] memory singleLpArray = new uint256[](1);\n singleLpArray[0] = voterTokenIdMultiLp;\n uint256[] memory amountArray = new uint256[](1);\n amountArray[0] = delegateAmount;\n IveION(ve).removeDelegatees(voterTokenIdSingleLp, singleLpArray, address(modeVelodrome5050IonMode), amountArray);\n vm.stopPrank();\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n // assertEq(finalVoteDetails.votes.length, 0, \"Final vote details array length should be zero \");\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n // assertEq(finalVoteDetails.usedWeight, 0, \"Final used weight should be greater than initial used weight\");\n }\n\n function test_poke_AfterTransfer() external {\n IVoter.VoteDetails memory initialVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n vm.warp(block.timestamp + 10 weeks);\n\n vm.startPrank(user);\n IveION(ve).transferFrom(user, address(0x2352), voterTokenIdSingleLp);\n voter.poke(voterTokenIdSingleLp);\n vm.stopPrank();\n\n IVoter.VoteDetails memory finalVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n console.log(\"Initial Market Votes for market\", i, \":\", initialVoteDetails.votes[i]);\n }\n console.log(\"Initial Used Weight:\", initialVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < finalVoteDetails.votes.length; i++) {\n console.log(\"Final Market Votes for market\", i, \":\", finalVoteDetails.votes[i]);\n }\n console.log(\"Final Used Weight:\", finalVoteDetails.usedWeight);\n\n for (uint256 i = 0; i < initialVoteDetails.votes.length; i++) {\n assertGt(\n initialVoteDetails.votes[i],\n finalVoteDetails.votes[i],\n \"Initial votes should be greater than final votes\"\n );\n }\n assertGt(\n initialVoteDetails.usedWeight,\n finalVoteDetails.usedWeight,\n \"Initial used weight should be greater than final used weight\"\n );\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Reset.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Reset is VoterTest {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n\n function setUp() public {\n _setUp();\n\n marketVote = new address[](1);\n marketVoteSide = new IVoter.MarketSide[](1);\n weights = new uint256[](1);\n marketVote[0] = ethMarket;\n marketVoteSide[0] = IVoter.MarketSide.Supply;\n weights[0] = 100;\n\n vm.startPrank(user);\n voter.vote(voterTokenIdMultiLp, marketVote, marketVoteSide, weights);\n voter.vote(voterTokenIdSingleLp, marketVote, marketVoteSide, weights);\n vm.stopPrank();\n }\n\n function test_reset_UserCanResetSingleLpToken() public {\n vm.warp(block.timestamp + 1 weeks);\n vm.prank(user);\n voter.reset(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory resetVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n assertEq(resetVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", resetVoteDetails.usedWeight);\n assertEq(resetVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n }\n\n function test_reset_UserCanResetMultiLpToken() public {\n vm.warp(block.timestamp + 1 weeks);\n vm.prank(user);\n voter.reset(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory veloVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n IVoter.VoteDetails memory balancerVoteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeBalancer8020IonEth)\n );\n\n assertEq(veloVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", veloVoteDetails.usedWeight);\n assertEq(veloVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n\n assertEq(balancerVoteDetails.votes.length, 0, \"Vote length should be reset to 0\");\n console.log(\"Reset Used Weight:\", balancerVoteDetails.usedWeight);\n assertEq(balancerVoteDetails.usedWeight, 0, \"Used weight should be reset to 0\");\n }\n\n function test_reset_RevertIfSameEpoch() public {\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVotedOrDeposited()\"));\n voter.reset(voterTokenIdSingleLp);\n }\n\n function test_reset_RevertIfDistributeWindow() public {\n vm.warp(voter.epochNext(block.timestamp));\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.reset(voterTokenIdSingleLp);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Setters.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Setters is VoterTest {\n function setUp() public {\n _setUp();\n }\n\n function testSetLpTokens() public {\n address[] memory newLpTokens = new address[](2);\n newLpTokens[0] = address(0x123);\n newLpTokens[1] = address(0x456);\n\n voter.setLpTokens(newLpTokens);\n\n address[] memory lpTokens = voter.getAllLpRewardTokens();\n assertEq(lpTokens.length, newLpTokens.length, \"LP tokens length mismatch\");\n for (uint256 i = 0; i < lpTokens.length; i++) {\n assertEq(lpTokens[i], newLpTokens[i], \"LP token mismatch\");\n }\n }\n\n function testSetLpTokensRevertEmptyArray() public {\n // Test revert case: setting empty LP tokens array\n address[] memory emptyLpTokens = new address[](0);\n vm.expectRevert(\"LpTokens array cannot be empty\");\n voter.setLpTokens(emptyLpTokens);\n }\n\n function testSetMpo() public {\n address newMpo = address(0x789);\n voter.setMpo(newMpo);\n\n assertEq(address(voter.mpo()), newMpo, \"MPO address mismatch\");\n }\n\n function testSetMpoRevertZeroAddress() public {\n // Test revert case: setting MPO to zero address\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAddress()\"));\n voter.setMpo(address(0));\n }\n\n function testSetGovernor() public {\n address newGovernor = address(0xABC);\n voter.setGovernor(newGovernor);\n\n assertEq(voter.governor(), newGovernor, \"Governor address mismatch\");\n }\n\n function testSetGovernorRevertZeroAddress() public {\n // Test revert case: setting Governor to zero address\n vm.expectRevert(abi.encodeWithSignature(\"ZeroAddress()\"));\n voter.setGovernor(address(0));\n }\n\n function testSetMaxVotingNum() public {\n uint256 newMaxVotingNum = 25;\n voter.setMaxVotingNum(newMaxVotingNum);\n\n assertEq(voter.maxVotingNum(), newMaxVotingNum, \"Max voting number mismatch\");\n }\n\n function testSetMaxVotingNumRevertTooLow() public {\n // Test revert case: setting MaxVotingNum below minimum\n vm.expectRevert(abi.encodeWithSignature(\"MaximumVotingNumberTooLow()\"));\n voter.setMaxVotingNum(5);\n }\n\n function testSetMaxVotingNumRevertSameValue() public {\n uint256 newMaxVotingNum = 25;\n voter.setMaxVotingNum(newMaxVotingNum);\n\n // Test revert case: setting MaxVotingNum to the same value\n vm.expectRevert(abi.encodeWithSignature(\"SameValue()\"));\n voter.setMaxVotingNum(newMaxVotingNum);\n }\n\n function testWhitelistToken() public {\n address token = address(0xFED);\n voter.whitelistToken(token, true);\n\n assertTrue(voter.isWhitelistedToken(token), \"Token should be whitelisted\");\n }\n\n function testWhitelistNFT() public {\n uint256 tokenId = 1;\n voter.whitelistNFT(tokenId, true);\n\n assertTrue(voter.isWhitelistedNFT(tokenId), \"NFT should be whitelisted\");\n }\n\n function testAddMarkets() public {\n IVoter.Market[] memory newMarkets = new IVoter.Market[](2);\n newMarkets[0] = IVoter.Market(address(0x123), IVoter.MarketSide.Supply);\n newMarkets[1] = IVoter.Market(address(0x456), IVoter.MarketSide.Borrow);\n\n voter.addMarkets(newMarkets);\n\n assertEq(voter.marketsLength(), 6, \"Markets length mismatch\");\n (address marketAddress, IVoter.MarketSide marketSide) = voter.markets(4);\n assertEq(marketAddress, address(0x123), \"First market address mismatch\");\n assertEq(uint256(marketSide), uint256(IVoter.MarketSide.Supply), \"First market side mismatch\");\n\n (marketAddress, marketSide) = voter.markets(5);\n assertEq(marketAddress, address(0x456), \"Second market address mismatch\");\n assertEq(uint256(marketSide), uint256(IVoter.MarketSide.Borrow), \"Second market side mismatch\");\n }\n\n function testAddMarketsRevertMarketExists() public {\n IVoter.Market[] memory newMarkets = new IVoter.Market[](2);\n newMarkets[0] = IVoter.Market(address(0x123), IVoter.MarketSide.Supply);\n newMarkets[1] = IVoter.Market(address(0x456), IVoter.MarketSide.Borrow);\n\n voter.addMarkets(newMarkets);\n\n // Test revert case: adding an existing market\n vm.expectRevert(abi.encodeWithSignature(\"MarketAlreadyExists()\"));\n voter.addMarkets(newMarkets);\n }\n\n function testSetMarketRewardAccumulators() public {\n address[] memory marketAddresses = new address[](2);\n marketAddresses[0] = address(0x123);\n marketAddresses[1] = address(0x456);\n\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](2);\n marketSides[0] = IVoter.MarketSide.Supply;\n marketSides[1] = IVoter.MarketSide.Borrow;\n\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n assertEq(\n voter.marketToRewardAccumulators(address(0x123), IVoter.MarketSide.Supply),\n address(0x789),\n \"First reward accumulator mismatch\"\n );\n assertEq(\n voter.marketToRewardAccumulators(address(0x456), IVoter.MarketSide.Borrow),\n address(0xABC),\n \"Second reward accumulator mismatch\"\n );\n }\n\n function testSetMarketRewardAccumulatorsRevertMismatchedLengths() public {\n address[] memory marketAddresses = new address[](2);\n marketAddresses[0] = address(0x123);\n marketAddresses[1] = address(0x456);\n\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](2);\n marketSides[0] = IVoter.MarketSide.Supply;\n marketSides[1] = IVoter.MarketSide.Borrow;\n\n address[] memory shortRewardAccumulators = new address[](1);\n shortRewardAccumulators[0] = address(0x789);\n\n // Test revert case: mismatched array lengths\n vm.expectRevert(abi.encodeWithSignature(\"MismatchedArrayLengths()\"));\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, shortRewardAccumulators);\n }\n\n function testSetBribes() public {\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n address[] memory bribes = new address[](2);\n bribes[0] = address(0xDEF);\n bribes[1] = address(0xFED);\n\n voter.setBribes(rewardAccumulators, bribes);\n\n assertEq(voter.rewardAccumulatorToBribe(address(0x789)), address(0xDEF), \"First bribe mismatch\");\n assertEq(voter.rewardAccumulatorToBribe(address(0xABC)), address(0xFED), \"Second bribe mismatch\");\n }\n\n function testSetBribesRevertMismatchedLengths() public {\n address[] memory rewardAccumulators = new address[](2);\n rewardAccumulators[0] = address(0x789);\n rewardAccumulators[1] = address(0xABC);\n\n address[] memory shortBribes = new address[](1);\n shortBribes[0] = address(0xDEF);\n\n // Test revert case: mismatched array lengths\n vm.expectRevert(abi.encodeWithSignature(\"MismatchedArrayLengths()\"));\n voter.setBribes(rewardAccumulators, shortBribes);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/utils/VoterUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"../../../Utils.sol\";\nimport \"../../../../../veION/Voter.sol\";\nimport \"../mocks/MockBribeRewards.sol\";\nimport { IVoter } from \"../../../../../veION/interfaces/IVoter.sol\";\nimport { RewardAccumulator } from \"../../../../../veION/RewardAccumulator.sol\";\n\ncontract VoterTest is veIONTest {\n Voter voter;\n LockInfo voterLockInfoSingleLp;\n LockInfoMultiple voterLockInfoMultiLp;\n uint256 voterTokenIdSingleLp;\n uint256 voterTokenIdMultiLp;\n address user;\n\n address ethMarket;\n address btcMarket;\n\n MockBribeRewards bribeEthSupply;\n MockBribeRewards bribeEthBorrow;\n MockBribeRewards bribeBtcSupply;\n MockBribeRewards bribeBtcBorrow;\n\n MasterPriceOracle mpo;\n\n function _setUp() internal virtual override {\n super._setUp();\n ethMarket = _generateRandomAddress(1);\n btcMarket = _generateRandomAddress(2);\n\n address[] memory _tokens = new address[](2);\n _tokens[0] = address(modeVelodrome5050IonMode);\n _tokens[1] = address(modeBalancer8020IonEth);\n\n MasterPriceOracle _mpo = new MasterPriceOracle();\n MockERC20 mockIon = new MockERC20(\"Mock ION\", \"mION\", 18);\n address _rewardToken = address(mockIon);\n address _ve = address(ve);\n\n voter = Voter(\n address(\n new TransparentUpgradeableProxy(\n address(new Voter()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, _mpo, _rewardToken, _ve)\n )\n )\n );\n\n IVoter.Market[] memory dummyMarkets = new IVoter.Market[](4);\n dummyMarkets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\n dummyMarkets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\n dummyMarkets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\n dummyMarkets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\n voter.addMarkets(dummyMarkets);\n\n address[] memory marketAddresses = new address[](4);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\n address[] memory rewardAccumulators = new address[](4);\n marketAddresses[0] = ethMarket;\n marketSides[0] = IVoter.MarketSide.Supply;\n marketAddresses[1] = ethMarket;\n marketSides[1] = IVoter.MarketSide.Borrow;\n marketAddresses[2] = btcMarket;\n marketSides[2] = IVoter.MarketSide.Supply;\n marketAddresses[3] = btcMarket;\n marketSides[3] = IVoter.MarketSide.Borrow;\n\n for (uint i = 0; i < 4; i++) {\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\n rewardAccumulators[i] = address(newRewardAccumulator);\n }\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n bribeEthSupply = new MockBribeRewards();\n bribeEthBorrow = new MockBribeRewards();\n bribeBtcSupply = new MockBribeRewards();\n bribeBtcBorrow = new MockBribeRewards();\n\n address[] memory rewardAccumulatorsForBribes = new address[](4);\n address[] memory bribes = new address[](4);\n\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\n bribes[0] = address(bribeEthSupply);\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\n bribes[1] = address(bribeEthBorrow);\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\n bribes[2] = address(bribeBtcSupply);\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\n bribes[3] = address(bribeBtcBorrow);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n\n voter.setMaxVotingNum(20);\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(modeVelodrome5050IonMode);\n lpTokens[1] = address(modeBalancer8020IonEth);\n\n voter.setLpTokens(lpTokens);\n user = address(0x9523);\n vm.warp(block.timestamp + 10 * 365 days);\n\n voterLockInfoSingleLp = _createLockInternal(user);\n voterLockInfoMultiLp = _createLockMultipleInternal(user);\n\n voterTokenIdSingleLp = voterLockInfoSingleLp.tokenId;\n voterTokenIdMultiLp = voterLockInfoMultiLp.tokenId;\n\n IveION(ve).setVoter(address(voter));\n }\n\n function afterForkSetUp() internal virtual override {\n _afterForkSetUpBase();\n\n ethMarket = 0x49420311B518f3d0c94e897592014de53831cfA3;\n btcMarket = 0x1De166df671AE6DB4C4C98903df88E8007593748;\n\n address[] memory _tokens = new address[](1);\n _tokens[0] = address(0x0FAc819628a7F612AbAc1CaD939768058cc0170c);\n\n mpo = MasterPriceOracle(0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4);\n IERC20 ion = IERC20(0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5);\n\n voter = Voter(\n address(\n new TransparentUpgradeableProxy(\n address(new Voter()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(Voter.initialize.selector, _tokens, mpo, address(ion), address(ve))\n )\n )\n );\n\n IVoter.Market[] memory markets = new IVoter.Market[](4);\n markets[0] = IVoter.Market(ethMarket, IVoter.MarketSide.Supply);\n markets[1] = IVoter.Market(ethMarket, IVoter.MarketSide.Borrow);\n markets[2] = IVoter.Market(btcMarket, IVoter.MarketSide.Supply);\n markets[3] = IVoter.Market(btcMarket, IVoter.MarketSide.Borrow);\n voter.addMarkets(markets);\n\n address[] memory marketAddresses = new address[](4);\n IVoter.MarketSide[] memory marketSides = new IVoter.MarketSide[](4);\n address[] memory rewardAccumulators = new address[](4);\n marketAddresses[0] = ethMarket;\n marketSides[0] = IVoter.MarketSide.Supply;\n marketAddresses[1] = ethMarket;\n marketSides[1] = IVoter.MarketSide.Borrow;\n marketAddresses[2] = btcMarket;\n marketSides[2] = IVoter.MarketSide.Supply;\n marketAddresses[3] = btcMarket;\n marketSides[3] = IVoter.MarketSide.Borrow;\n\n for (uint i = 0; i < 4; i++) {\n RewardAccumulator newRewardAccumulator = new RewardAccumulator();\n rewardAccumulators[i] = address(newRewardAccumulator);\n }\n\n voter.setMarketRewardAccumulators(marketAddresses, marketSides, rewardAccumulators);\n\n bribeEthSupply = new MockBribeRewards();\n bribeEthBorrow = new MockBribeRewards();\n bribeBtcSupply = new MockBribeRewards();\n bribeBtcBorrow = new MockBribeRewards();\n address[] memory rewardAccumulatorsForBribes = new address[](4);\n address[] memory bribes = new address[](4);\n rewardAccumulatorsForBribes[0] = rewardAccumulators[0];\n bribes[0] = address(bribeEthSupply);\n rewardAccumulatorsForBribes[1] = rewardAccumulators[1];\n bribes[1] = address(bribeEthBorrow);\n rewardAccumulatorsForBribes[2] = rewardAccumulators[2];\n bribes[2] = address(bribeBtcSupply);\n rewardAccumulatorsForBribes[3] = rewardAccumulators[3];\n bribes[3] = address(bribeBtcBorrow);\n voter.setBribes(rewardAccumulatorsForBribes, bribes);\n\n voter.setMaxVotingNum(20);\n\n address[] memory lpTokens = new address[](2);\n lpTokens[0] = address(ionWeth5050lPAero);\n lpTokens[1] = address(wethAero5050LPAero);\n voter.setLpTokens(lpTokens);\n\n IveION(ve).setVoter(address(voter));\n\n baseTokenIdSingleLp = _lockSingleLPFork(baseUser, REAL_LP_LOCK_AMOUNT);\n }\n\n function _vote(address _user, uint256 _tokenId, uint256[] memory weights) internal {\n address[] memory selectedMarkets = new address[](4);\n IVoter.MarketSide[] memory selectedSides = new IVoter.MarketSide[](4);\n uint256[] memory selectedWeights = new uint256[](4);\n\n selectedMarkets[0] = ethMarket;\n selectedSides[0] = IVoter.MarketSide.Supply;\n selectedWeights[0] = weights[0];\n\n selectedMarkets[1] = btcMarket;\n selectedSides[1] = IVoter.MarketSide.Supply;\n selectedWeights[1] = weights[1];\n\n selectedMarkets[2] = ethMarket;\n selectedSides[2] = IVoter.MarketSide.Borrow;\n selectedWeights[2] = weights[2];\n\n selectedMarkets[3] = btcMarket;\n selectedSides[3] = IVoter.MarketSide.Borrow;\n selectedWeights[3] = weights[3];\n\n vm.prank(_user);\n voter.vote(_tokenId, selectedMarkets, selectedSides, selectedWeights);\n }\n}\n" + }, + "contracts/test/veION/contracts/Voter/Vote.t.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport \"./utils/VoterUtils.sol\";\nimport { UniswapLpTokenPriceOracle } from \"../../../../oracles/default/UniswapLpTokenPriceOracle.sol\";\nimport { BasePriceOracle } from \"../../../../oracles/BasePriceOracle.sol\";\n\ncontract Vote is VoterTest {\n function setUp() public {\n _setUp();\n }\n\n function test_vote_UserCanVoteSingleLP() public {\n address[] memory _marketVote = new address[](2);\n IVoter.MarketSide[] memory _marketVoteSide = new IVoter.MarketSide[](2);\n uint256[] memory _weights = new uint256[](2);\n\n _marketVote[0] = ethMarket;\n _marketVoteSide[0] = IVoter.MarketSide.Supply;\n _weights[0] = 100;\n\n _marketVote[1] = btcMarket;\n _marketVoteSide[1] = IVoter.MarketSide.Borrow;\n _weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdSingleLp, _marketVote, _marketVoteSide, _weights);\n\n (, uint256[] memory votingLPBalances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(voterTokenIdSingleLp);\n\n IVoter.VoteDetails memory voteDetails = voter.getVoteDetails(\n voterTokenIdSingleLp,\n address(modeVelodrome5050IonMode)\n );\n\n uint256 effectiveVotingPower = (votingLPBalances[0] * boosts[0]) / 1e18;\n uint256 totalWeight = _weights[0] + _weights[1];\n\n for (uint256 i = 0; i < voteDetails.marketVotes.length; i++) {\n assertEq(voteDetails.marketVotes[i], _marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetails.marketVoteSides[i]),\n uint256(_marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetails.votes[i],\n (effectiveVotingPower * _weights[i]) / totalWeight,\n \"User's vote should be in accordance with weight\"\n );\n }\n\n assertApproxEqRel(voteDetails.usedWeight, effectiveVotingPower, 0.001e18, \"Used weight should be all voting power\");\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeVelodrome5050IonMode)),\n (effectiveVotingPower * _weights[0]) / totalWeight,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeVelodrome5050IonMode)),\n (effectiveVotingPower * _weights[1]) / totalWeight,\n \"Weight for BTC market should be 200\"\n );\n }\n\n struct VoteLocalVars {\n address[] marketVote;\n IVoter.MarketSide[] marketVoteSide;\n uint256[] weights;\n uint256[] votingLPBalances;\n uint256[] boosts;\n address[] marketVotesVelo;\n IVoter.MarketSide[] marketVoteSidesVelo;\n uint256[] votesVelo;\n uint256 usedWeightVelo;\n address[] marketVotesBalancer;\n IVoter.MarketSide[] marketVoteSidesBalancer;\n uint256[] votesBalancer;\n uint256 usedWeightBalancer;\n uint256 effectiveVotingPowerVelo;\n uint256 totalWeightVelo;\n uint256 effectiveVotingPowerBalancer;\n uint256 totalWeightBalancer;\n }\n\n function test_vote_UserCanVoteMultiLP() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n (, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory voteDetailsVelo = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n IVoter.VoteDetails memory voteDetailsBalancer = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n console.log(\"==================================Velo LP Vote Details==================================:\");\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n console.log(\"===================VOTE====================\");\n console.log(\"Market:\", voteDetailsVelo.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsVelo.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsVelo.votes[i]);\n }\n console.log(\"Used Weight Velo:\", voteDetailsVelo.usedWeight);\n console.log(\"-----------------------------------------------------------------------------------------\");\n\n console.log(\"==================================Balancer LP Vote Details==================================:\");\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n console.log(\"===================VOTE====================\");\n console.log(\"Market:\", voteDetailsBalancer.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsBalancer.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsBalancer.votes[i]);\n }\n console.log(\"Used Weight Balancer:\", voteDetailsBalancer.usedWeight);\n\n vars.effectiveVotingPowerVelo = (vars.votingLPBalances[0] * vars.boosts[0]) / 1e18;\n vars.totalWeightVelo = vars.weights[0] + vars.weights[1];\n\n vars.effectiveVotingPowerBalancer = (vars.votingLPBalances[1] * vars.boosts[1]) / 1e18;\n vars.totalWeightBalancer = vars.weights[0] + vars.weights[1];\n\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n assertEq(voteDetailsVelo.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsVelo.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(voteDetailsVelo.votes[i], (vars.effectiveVotingPowerVelo * vars.weights[i]) / vars.totalWeightVelo);\n }\n\n assertApproxEqRel(\n voteDetailsVelo.usedWeight,\n vars.effectiveVotingPowerVelo,\n 0.001e18,\n \"Used weight should be all voting power\"\n );\n\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n assertEq(voteDetailsBalancer.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsBalancer.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetailsBalancer.votes[i],\n (vars.effectiveVotingPowerBalancer * vars.weights[i]) / vars.totalWeightBalancer\n );\n }\n\n assertApproxEqRel(\n voteDetailsBalancer.usedWeight,\n vars.effectiveVotingPowerBalancer,\n 0.001e18,\n \"Used weight should be all voting power\"\n );\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeVelodrome5050IonMode)),\n (vars.effectiveVotingPowerVelo * vars.weights[0]) / vars.totalWeightVelo,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeVelodrome5050IonMode)),\n (vars.effectiveVotingPowerVelo * vars.weights[1]) / vars.totalWeightVelo,\n \"Weight for BTC market should be 200\"\n );\n\n assertEq(\n voter.weights(ethMarket, IVoter.MarketSide.Supply, address(modeBalancer8020IonEth)),\n (vars.effectiveVotingPowerBalancer * vars.weights[0]) / vars.totalWeightBalancer,\n \"Weight for ETH market should be 100\"\n );\n assertEq(\n voter.weights(btcMarket, IVoter.MarketSide.Borrow, address(modeBalancer8020IonEth)),\n (vars.effectiveVotingPowerBalancer * vars.weights[1]) / vars.totalWeightBalancer,\n \"Weight for BTC market should be 200\"\n );\n }\n\n function test_vote_VoteResetsAfterVotingForSameMarketsAgain() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.warp(block.timestamp + 14 * 86400);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 400;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 400;\n\n vm.startPrank(user);\n voter.reset(voterTokenIdMultiLp);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n vm.stopPrank();\n\n (, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n\n IVoter.VoteDetails memory voteDetailsVelo = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n\n IVoter.VoteDetails memory voteDetailsBalancer = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeBalancer8020IonEth)\n );\n\n vars.effectiveVotingPowerVelo = (vars.votingLPBalances[0] * vars.boosts[0]) / 1e18;\n vars.totalWeightVelo = vars.weights[0] + vars.weights[1];\n\n vars.effectiveVotingPowerBalancer = (vars.votingLPBalances[1] * vars.boosts[1]) / 1e18;\n vars.totalWeightBalancer = vars.weights[0] + vars.weights[1];\n\n // Display vote details for Velodrome\n console.log(\"Velodrome Market Votes:\");\n for (uint256 i = 0; i < voteDetailsVelo.marketVotes.length; i++) {\n console.log(\"Market:\", voteDetailsVelo.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsVelo.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsVelo.votes[i]);\n assertEq(voteDetailsVelo.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsVelo.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(voteDetailsVelo.votes[i], (vars.effectiveVotingPowerVelo * vars.weights[i]) / vars.totalWeightVelo);\n }\n console.log(\"Used Weight for Velodrome:\", voteDetailsVelo.usedWeight);\n\n console.log(\"--------------------------------------------------------------\");\n // Display vote details for Balancer\n console.log(\"Balancer Market Votes:\");\n for (uint256 i = 0; i < voteDetailsBalancer.marketVotes.length; i++) {\n console.log(\"Market:\", voteDetailsBalancer.marketVotes[i]);\n console.log(\"Market Side:\", uint256(voteDetailsBalancer.marketVoteSides[i]));\n console.log(\"Votes:\", voteDetailsBalancer.votes[i]);\n\n assertEq(voteDetailsBalancer.marketVotes[i], vars.marketVote[i], \"Market Vote should be applied\");\n assertEq(\n uint256(voteDetailsBalancer.marketVoteSides[i]),\n uint256(vars.marketVoteSide[i]),\n \"Market Vote Side should be applied\"\n );\n assertEq(\n voteDetailsBalancer.votes[i],\n (vars.effectiveVotingPowerBalancer * vars.weights[i]) / vars.totalWeightBalancer\n );\n }\n console.log(\"Used Weight for Balancer:\", voteDetailsBalancer.usedWeight);\n }\n\n function test_vote_VoteThenDelegateShouldPokeAccordingly() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n address user2 = address(0x23512);\n LockInfo memory lockInfo2 = _createLockInternal(user2);\n\n vm.prank(user);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), voterTokenIdMultiLp);\n vm.prank(user2);\n IveION(ve).lockPermanent(address(modeVelodrome5050IonMode), lockInfo2.tokenId);\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.prank(user2);\n voter.vote(lockInfo2.tokenId, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n IVoter.VoteDetails memory voteDetails = voter.getVoteDetails(\n voterTokenIdMultiLp,\n address(modeVelodrome5050IonMode)\n );\n IVoter.VoteDetails memory voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 1\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 2\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"============================================================================\");\n\n vm.prank(user);\n IveION(ve).delegate(voterTokenIdMultiLp, lockInfo2.tokenId, address(modeVelodrome5050IonMode), MINT_AMT / 2);\n\n voteDetails = voter.getVoteDetails(voterTokenIdMultiLp, address(modeVelodrome5050IonMode));\n voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 3\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 4\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n\n assertEq(voteDetails.votes[0], 333333333333333333333, \"First market votes should be lower\");\n assertEq(voteDetails.votes[1], 666666666666666666666, \"Second market votes should be lower\");\n\n assertEq(voteDetails2.votes[0], 1000000000000000000000, \"First market votes should be higher\");\n assertEq(voteDetails2.votes[1], 2000000000000000000000, \"Second market votes should be higher\");\n\n uint256[] memory toTokenIds = new uint256[](1);\n toTokenIds[0] = lockInfo2.tokenId;\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = type(uint256).max;\n\n vm.prank(user);\n IveION(ve).removeDelegatees(voterTokenIdMultiLp, toTokenIds, address(modeVelodrome5050IonMode), amounts);\n // voter.poke(lockInfo2.tokenId);\n\n voteDetails = voter.getVoteDetails(voterTokenIdMultiLp, address(modeVelodrome5050IonMode));\n voteDetails2 = voter.getVoteDetails(lockInfo2.tokenId, address(modeVelodrome5050IonMode));\n\n (address[] memory assets, uint256[] memory balances, uint256[] memory boosts) = IveION(ve).balanceOfNFT(\n lockInfo2.tokenId\n );\n for (uint256 i; i < assets.length; i++) {\n console.log(\"Assets\", assets[i]);\n console.log(\"Balances\", balances[i]);\n console.log(\"Boosts\", boosts[i]);\n }\n\n // (assets, balances, boosts) = IveION(ve).balanceOfNFT(voterTokenIdMultiLp);\n // for (uint256 i; i < assets.length; i++) {\n // console.log(\"Assets\", assets[i]);\n // console.log(\"Balances\", balances[i]);\n // console.log(\"Boosts\", boosts[i]);\n // }\n\n for (uint256 i; i < voteDetails.marketVotes.length; i++) {\n console.log(\"Market Votes 5\");\n console.log(\"Market Vote\", voteDetails.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails.votes[i]);\n console.log(\"---------------------------------------\");\n }\n console.log(\"======================================\");\n for (uint256 i; i < voteDetails2.marketVotes.length; i++) {\n console.log(\"Market Votes 6\");\n console.log(\"Market Vote\", voteDetails2.marketVotes[i]);\n console.log(\"Market Vote Side\", uint256(voteDetails2.marketVoteSides[i]));\n console.log(\"Weight\", voteDetails2.votes[i]);\n console.log(\"---------------------------------------\");\n }\n\n assertEq(voteDetails.votes[0], 666666666666666666666, \"First market votes should be lower\");\n assertEq(voteDetails.votes[1], 1333333333333333333333, \"Second market votes should be lower\");\n\n assertEq(voteDetails2.votes[0], 666666666666666666666, \"First market votes should be higher\");\n assertEq(voteDetails2.votes[1], 1333333333333333333333, \"Second market votes should be higher\");\n }\n\n function test_vote_RevertIfSameEpoch() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 400;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 400;\n\n vm.startPrank(user);\n vm.expectRevert(abi.encodeWithSignature(\"AlreadyVotedOrDeposited()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n vm.stopPrank();\n }\n\n function test_vote_RevertIfDistributionWindow() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n uint256 epochNext = voter.epochNext(block.timestamp);\n vm.warp(epochNext);\n console.log(\"Current Timestamp:\", block.timestamp);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"DistributeWindow()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n\n vm.warp(block.timestamp + 3601);\n vm.prank(user);\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_NotOwner() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](2);\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n vars.marketVoteSide[1] = IVoter.MarketSide.Borrow;\n vars.weights[1] = 200;\n\n vm.prank(address(0x2352));\n vm.expectRevert(abi.encodeWithSignature(\"NotOwner()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfUnequalLengths() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](2);\n vars.marketVoteSide = new IVoter.MarketSide[](1); // Intentionally unequal length\n vars.weights = new uint256[](2);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vars.marketVote[1] = btcMarket;\n // vars.marketVoteSide[1] is missing to create unequal lengths\n vars.weights[1] = 200;\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"UnequalLengths()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfTooManyPools() public {\n VoteLocalVars memory vars;\n\n // Set maxVotingNum to 10 for this test\n voter.setMaxVotingNum(10);\n\n vars.marketVote = new address[](11);\n vars.marketVoteSide = new IVoter.MarketSide[](11);\n vars.weights = new uint256[](11);\n\n for (uint256 i = 0; i < 11; i++) {\n vars.marketVote[i] = ethMarket;\n vars.marketVoteSide[i] = IVoter.MarketSide.Supply;\n vars.weights[i] = 100;\n }\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"TooManyPools()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfNotWhitelistedNFT() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vm.warp(IonicTimeLibrary.epochStart(block.timestamp) + 1 weeks - 0.75 hours);\n\n // Assume voterTokenIdSingleLp is not whitelisted\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"NotWhitelistedNFT()\"));\n voter.vote(voterTokenIdSingleLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfNoRewardAccumulator() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n // Use a market that does not have a reward accumulator set\n address nonExistentMarket = address(0xDEADBEEF);\n vars.marketVote[0] = nonExistentMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"RewardAccumulatorDoesNotExist(address)\", nonExistentMarket));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfRewardAccumulatorNotAlive() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 100;\n\n voter.toggleRewardAccumulatorAlive(vars.marketVote[0], vars.marketVoteSide[0], false);\n address accumulator = voter.marketToRewardAccumulators(vars.marketVote[0], vars.marketVoteSide[0]);\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"RewardAccumulatorNotAlive(address)\", accumulator));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n\n function test_vote_RevertIfZeroWeight() public {\n VoteLocalVars memory vars;\n\n vars.marketVote = new address[](1);\n vars.marketVoteSide = new IVoter.MarketSide[](1);\n vars.weights = new uint256[](1);\n\n vars.marketVote[0] = ethMarket;\n vars.marketVoteSide[0] = IVoter.MarketSide.Supply;\n vars.weights[0] = 0; // Set weight to zero to trigger the revert\n\n vm.prank(user);\n vm.expectRevert(abi.encodeWithSignature(\"ZeroWeight()\"));\n voter.vote(voterTokenIdMultiLp, vars.marketVote, vars.marketVoteSide, vars.weights);\n }\n}\n" + }, + "contracts/test/veION/harness/veIONHarness.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\nimport \"../../../veION/veION.sol\";\n\n// This harness contract can be used for testing purposes.\ncontract veIONHarness is veION {\n constructor(uint256 _minimumLockDuration) {\n s_minimumLockDuration = _minimumLockDuration;\n }\n\n function exposed_calculateBoost(uint256 _duration) external view returns (uint256) {\n return _calculateBoost(_duration);\n }\n}\n" + }, + "contracts/test/veION/Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\nimport { MockERC20 } from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport \"../config/BaseTest.t.sol\";\nimport \"../../veION/veION.sol\";\nimport \"../../veION/veIONFirstExtension.sol\";\nimport \"../../veION/veIONSecondExtension.sol\";\nimport \"../../veION/interfaces/IveION.sol\";\n// import \"../../veION/interfaces/IveIONCore.sol\";\nimport \"../../veION/stake/IStakeStrategy.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\nimport \"../../veION/stake/IStakeStrategy.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { AddressesProvider } from \"../../ionic/AddressesProvider.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingStrategy.sol\";\nimport \"../../veION/stake/velo/VeloAeroStakingWallet.sol\";\nimport \"../../veION/stake/velo/IVeloIonModeStaking.sol\";\nimport \"./harness/veIONHarness.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\ncontract veIONTest is BaseTest {\n using Strings for uint256;\n using Strings for bool;\n using Strings for address;\n\n address ve;\n address veFirstExtension;\n address veSecondExtension;\n MockERC20 modeVelodrome5050IonMode;\n MockERC20 modeBalancer8020IonEth;\n MockERC20 baseAerodrome5050IonWstEth;\n MockERC20 baseBalancer8020IonEth;\n MockERC20 optimismVelodrome5050IonOp;\n MockERC20 optimismBalancer8020IonEth;\n IveIONStructsEnumsErrorsEvents.LpTokenType veloLpType;\n IveIONStructsEnumsErrorsEvents.LpTokenType balancerLpType;\n VeloAeroStakingWallet veloStakingWalletImplementation;\n veIONHarness harness;\n\n address ionMode5050LP;\n address ionWeth5050lPAero;\n address wethAero5050LPAero;\n address veloGauge;\n VeloAeroStakingStrategy veloIonModeStakingStrategy;\n VeloAeroStakingStrategy veloWethUsdcStakingStrategy;\n address stakingWalletInstance;\n uint256 stakingWalletInstanceBalance;\n\n address wethUSDC5050LP;\n address wethUSDCGauge;\n\n // Base Fork Vars\n address baseUser;\n uint256 baseTokenIdSingleLp;\n\n uint256 internal constant MINT_AMT = 1000 ether;\n uint256 internal constant WEEK = 1 weeks;\n uint256 internal constant MAXTIME = 2 * 365 * 86400;\n uint256 internal constant MINTIME = 180 * 86400;\n uint256 internal constant EARLY_WITHDRAW_FEE = 0.8e18;\n uint256 internal constant MINIMUM_LOCK_AMOUNT = 10e18;\n uint256 internal constant REAL_LP_LOCK_AMOUNT = 10e18;\n\n function _setUp() internal virtual {\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n modeVelodrome5050IonMode = new MockERC20(\"Mode_Velodrome_5050_ION_MODE\", \"MV5050\", 18);\n modeBalancer8020IonEth = new MockERC20(\"Mode_Balancer_8020_ION_ETH\", \"MB8020\", 18);\n\n harness = new veIONHarness(MINTIME);\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n\n whitelistedTokens[0] = address(modeVelodrome5050IonMode);\n whitelistedTokens[1] = address(modeBalancer8020IonEth);\n\n for (uint i = 0; i < 2; i++) {\n isWhitelistedTokens[i] = true;\n }\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n\n IveION(ve).setLpTokenType(\n address(modeVelodrome5050IonMode),\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE\n );\n IveION(ve).setLpTokenType(\n address(modeBalancer8020IonEth),\n IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH\n );\n\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\n\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(modeVelodrome5050IonMode), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(modeBalancer8020IonEth), MINIMUM_LOCK_AMOUNT);\n }\n\n function _afterForkSetUpMode() internal {\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n ionMode5050LP = 0x690A74d2eC0175a69C0962B309E03021C0b5002E;\n veloGauge = 0x8EE410cC13948e7e684ebACb36b552e2c2A125fC;\n\n wethUSDC5050LP = 0x283bA4E204DFcB6381BCBf2cb5d0e765A2B57bC2;\n wethUSDCGauge = 0x98d34C7b004688F35b67Aa30D4dF5E67113f6B3D;\n\n veloStakingWalletImplementation = new VeloAeroStakingWallet();\n\n veloIonModeStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n ionMode5050LP,\n veloGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n veloWethUsdcStakingStrategy = VeloAeroStakingStrategy(\n address(\n new TransparentUpgradeableProxy(\n address(new VeloAeroStakingStrategy()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(\n VeloAeroStakingStrategy.initialize.selector,\n address(ve),\n wethUSDC5050LP,\n wethUSDCGauge,\n address(veloStakingWalletImplementation)\n )\n )\n )\n );\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n whitelistedTokens[0] = ionMode5050LP;\n isWhitelistedTokens[0] = true;\n whitelistedTokens[1] = wethUSDC5050LP;\n isWhitelistedTokens[1] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(ionMode5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE);\n IveION(ve).setLpTokenType(wethUSDC5050LP, IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH);\n\n veloLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Velodrome_5050_ION_MODE;\n balancerLpType = IveIONStructsEnumsErrorsEvents.LpTokenType.Mode_Balancer_8020_ION_ETH;\n\n IveION(ve).setStakeStrategy(veloLpType, IStakeStrategy(veloIonModeStakingStrategy));\n IveION(ve).setStakeStrategy(balancerLpType, IStakeStrategy(veloWethUsdcStakingStrategy));\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(ionMode5050LP), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(wethUSDC5050LP), MINIMUM_LOCK_AMOUNT);\n }\n\n function _afterForkSetUpBase() internal {\n baseUser = address(0x987);\n ve = address(\n new TransparentUpgradeableProxy(\n address(new veION()),\n address(new ProxyAdmin()),\n abi.encodeWithSelector(veION.initialize.selector, address(ap))\n )\n );\n\n veFirstExtension = address(new veIONFirstExtension());\n veSecondExtension = address(new veIONSecondExtension());\n IveIONCore(ve).setExtensions(veFirstExtension, veSecondExtension);\n\n harness = new veIONHarness(MINTIME);\n\n ionWeth5050lPAero = 0x0FAc819628a7F612AbAc1CaD939768058cc0170c;\n wethAero5050LPAero = 0x7f670f78B17dEC44d5Ef68a48740b6f8849cc2e6;\n\n address[] memory whitelistedTokens = new address[](2);\n bool[] memory isWhitelistedTokens = new bool[](2);\n whitelistedTokens[0] = ionWeth5050lPAero;\n isWhitelistedTokens[0] = true;\n whitelistedTokens[1] = wethAero5050LPAero;\n isWhitelistedTokens[1] = true;\n\n IveION(ve).whitelistTokens(whitelistedTokens, isWhitelistedTokens);\n IveION(ve).setLpTokenType(\n ionWeth5050lPAero,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Aerodrome_5050_ION_wstETH\n );\n IveION(ve).setLpTokenType(\n wethAero5050LPAero,\n IveIONStructsEnumsErrorsEvents.LpTokenType.Base_Balancer_8020_ION_ETH\n );\n\n IveION(ve).setMaxEarlyWithdrawFee(EARLY_WITHDRAW_FEE);\n IveION(ve).setMinimumLockDuration(MINTIME);\n IveION(ve).setMinimumLockAmount(address(ionWeth5050lPAero), MINIMUM_LOCK_AMOUNT);\n IveION(ve).setMinimumLockAmount(address(wethAero5050LPAero), MINIMUM_LOCK_AMOUNT);\n }\n\n function _lockSingleLPFork(address _user, uint256 _amount) internal returns (uint256) {\n address whale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\n vm.prank(whale);\n IERC20(ionWeth5050lPAero).transfer(_user, _amount);\n\n address[] memory tokenAddresses = new address[](1);\n uint256[] memory tokenAmounts = new uint256[](1);\n uint256[] memory durations = new uint256[](1);\n bool[] memory stakeUnderlying = new bool[](1);\n tokenAddresses[0] = address(ionWeth5050lPAero);\n tokenAmounts[0] = _amount;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = false;\n\n vm.startPrank(_user);\n IERC20(ionWeth5050lPAero).approve(address(ve), _amount);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return tokenId;\n }\n\n function _lockMultiLpFork(address _user, uint256 _amountIonWeth, uint256 _amountWethAERO) internal returns (uint256) {\n address ionWethWhale = 0x9b42e5F8c45222b2715F804968251c747c588fd7;\n address wethAEROWhale = 0x96a24aB830D4ec8b1F6f04Ceac104F1A3b211a01;\n\n vm.prank(ionWethWhale);\n IERC20(ionWeth5050lPAero).transfer(_user, _amountIonWeth);\n vm.prank(wethAEROWhale);\n IERC20(wethAero5050LPAero).transfer(_user, _amountWethAERO);\n\n address[] memory tokenAddresses = new address[](2);\n uint256[] memory tokenAmounts = new uint256[](2);\n uint256[] memory durations = new uint256[](2);\n bool[] memory stakeUnderlying = new bool[](2);\n tokenAddresses[0] = address(ionWeth5050lPAero);\n tokenAmounts[0] = _amountIonWeth;\n durations[0] = 52 weeks;\n stakeUnderlying[0] = false;\n tokenAddresses[1] = address(wethAero5050LPAero);\n tokenAmounts[1] = _amountWethAERO;\n durations[1] = 52 weeks;\n stakeUnderlying[1] = false;\n\n vm.startPrank(_user);\n IERC20(ionWeth5050lPAero).approve(address(ve), _amountIonWeth);\n IERC20(wethAero5050LPAero).approve(address(ve), _amountWethAERO);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return tokenId;\n }\n\n function _createLockInternal(address user) internal returns (LockInfo memory) {\n TestVars memory vars;\n vars.user = user;\n vars.amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\n\n vm.startPrank(vars.user);\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\n vm.stopPrank();\n\n vars.tokenAddresses = new address[](1);\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\n\n vars.tokenAmounts = new uint256[](1);\n vars.tokenAmounts[0] = vars.amount;\n\n vars.durations = new uint256[](1);\n vars.durations[0] = 52 weeks;\n\n vm.startPrank(vars.user);\n uint256 tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](1));\n vm.stopPrank();\n\n return LockInfo(tokenId, vars.tokenAddresses[0], vars.tokenAmounts[0], vars.durations[0]);\n }\n\n function _createLockMultipleInternal(address user) internal returns (LockInfoMultiple memory) {\n TestVars memory vars;\n vars.user = user;\n\n vars.amount = MINT_AMT;\n modeVelodrome5050IonMode.mint(vars.user, vars.amount);\n modeBalancer8020IonEth.mint(vars.user, vars.amount);\n\n vm.startPrank(vars.user);\n modeVelodrome5050IonMode.approve(address(ve), vars.amount);\n modeBalancer8020IonEth.approve(address(ve), vars.amount);\n vm.stopPrank();\n\n vars.tokenAddresses = new address[](2);\n vars.tokenAddresses[0] = address(modeVelodrome5050IonMode);\n vars.tokenAddresses[1] = address(modeBalancer8020IonEth);\n\n vars.tokenAmounts = new uint256[](2);\n vars.tokenAmounts[0] = vars.amount;\n vars.tokenAmounts[1] = vars.amount;\n\n vars.durations = new uint256[](2);\n vars.durations[0] = 52 weeks;\n vars.durations[1] = 52 weeks;\n\n vm.startPrank(vars.user);\n vars.tokenId = IveION(ve).createLock(vars.tokenAddresses, vars.tokenAmounts, vars.durations, new bool[](2));\n vm.stopPrank();\n\n return LockInfoMultiple(vars.tokenId, vars.tokenAddresses, vars.tokenAmounts, vars.durations);\n }\n\n function _createLockInternalRealLP(address _user, bool _stakeUnderlying) internal returns (LockInfo memory) {\n uint256 amountStaked = REAL_LP_LOCK_AMOUNT;\n address whale = 0x8ff8b21a0736738b25597D32d8f7cf658f39f157;\n vm.prank(whale);\n IERC20(ionMode5050LP).transfer(_user, amountStaked);\n\n address[] memory tokenAddresses = new address[](1);\n tokenAddresses[0] = address(ionMode5050LP);\n\n uint256[] memory tokenAmounts = new uint256[](1);\n tokenAmounts[0] = amountStaked;\n\n uint256[] memory durations = new uint256[](1);\n durations[0] = 52 weeks;\n\n bool[] memory stakeUnderlying = new bool[](1);\n stakeUnderlying[0] = _stakeUnderlying;\n\n vm.startPrank(_user);\n IERC20(ionMode5050LP).approve(address(ve), amountStaked);\n uint256 tokenId = IveION(ve).createLock(tokenAddresses, tokenAmounts, durations, stakeUnderlying);\n vm.stopPrank();\n\n return LockInfo(tokenId, tokenAddresses[0], tokenAmounts[0], durations[0]);\n }\n\n function _generateRandomAddress(uint256 seed) internal pure returns (address) {\n return address(uint160(uint256(keccak256(abi.encodePacked(seed)))));\n }\n\n function _logTokens(uint256[] memory tokenIds, address[] memory lpTokens) internal view {\n for (uint256 i = 0; i < tokenIds.length; i++) {\n for (uint256 j = 0; j < lpTokens.length; j++) {\n IveIONStructsEnumsErrorsEvents.LockedBalance memory lock = IveION(ve).getUserLock(\n tokenIds[i],\n IveION(ve).s_lpType(lpTokens[j])\n );\n uint256 tokenId = i + 1;\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Token: \", lock.tokenAddress.toHexString()))\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Amount: \", lock.amount.toString()))\n );\n console.log(\n string(\n abi.encodePacked(\n \"Token ID \",\n tokenId.toString(),\n \" Locked Delegate Amount: \",\n lock.delegateAmount.toString()\n )\n )\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Start: \", lock.start.toString()))\n );\n console.log(string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked End: \", lock.end.toString())));\n console.log(\n string(\n abi.encodePacked(\n \"Token ID \",\n tokenId.toString(),\n \" Locked IsPermanent: \",\n lock.isPermanent ? \"true\" : \"false\"\n )\n )\n );\n console.log(\n string(abi.encodePacked(\"Token ID \", tokenId.toString(), \" Locked Boost: \", lock.boost.toString()))\n );\n console.log(\"--------------------------------------------------\");\n }\n console.log(\"====================================================\");\n }\n }\n\n function _logCumulativeAssetValues(address[] memory users, address[] memory lpTokens) internal view {\n console.log(\"-----------------------------------------------------------------\");\n for (uint256 i = 0; i < users.length; i++) {\n address user = users[i];\n console.log(\"Cumulative Asset Values for User:\", user);\n for (uint256 j = 0; j < lpTokens.length; j++) {\n console.log(\"Token:\", lpTokens[j], \"Value:\", IveION(ve).s_userCumulativeAssetValues(user, lpTokens[j]));\n }\n console.log(\"====================================================\");\n }\n }\n\n function _logUnderlyingStake(address[] memory users) internal view {\n console.log(\"-----------------------------------------------------------------\");\n for (uint256 i = 0; i < users.length; i++) {\n address user = users[i];\n console.log(\"Underlying Stakes For:\", user);\n address stakingWalletInstanceIonMode = veloIonModeStakingStrategy.userStakingWallet(user);\n uint256 stakedBalanceIonMode = veloIonModeStakingStrategy.balanceOf(stakingWalletInstanceIonMode);\n\n address stakingWalletInstanceWethUsdc = veloWethUsdcStakingStrategy.userStakingWallet(user);\n uint256 stakedBalanceWethUsdc = veloWethUsdcStakingStrategy.balanceOf(stakingWalletInstanceWethUsdc);\n\n console.log(\"Staked Balance Ion-Mode:\", stakedBalanceIonMode);\n console.log(\"Staked Balance Weth-Usdc:\", stakedBalanceWethUsdc);\n console.log(\"====================================================\");\n }\n }\n}\n\nstruct TestVars {\n address user;\n address user2;\n uint256 amount;\n address[] tokenAddresses;\n uint256[] tokenAmounts;\n uint256[] durations;\n bool[] stakeUnderlying;\n uint256 tokenId;\n uint256 secondTokenId;\n uint256 expectedSupply;\n uint256 userEpoch;\n uint256 globalEpoch;\n address lockedBalance_tokenAddress;\n uint256 lockedBalance_amount;\n uint256 delegated_lockedBalance_amount;\n uint256 lockedBalance_start;\n uint256 lockedBalance_end;\n bool lockedBalance_isPermanent;\n uint256 lockedBalance_boost;\n uint256 userPoint_bias;\n uint256 userPoint_slope;\n uint256 userPoint_ts;\n uint256 userPoint_blk;\n uint256 userPoint_permanent;\n uint256 userPoint_permanentDelegate;\n int128 globalPoint_bias;\n int128 globalPoint_slope;\n uint256 globalPoint_ts;\n uint256 globalPoint_blk;\n uint256 globalPoint_permanentLockBalance;\n uint256[] ownerTokenIds;\n address[] assetsLocked;\n uint256 tokenId_test;\n address lockedBalance_tokenAddress_test;\n uint256 lockedBalance_amount_test;\n uint256 lockedBalance_duration_test;\n uint256 lockedBalance_end_test;\n}\n\nstruct LockInfo {\n uint256 tokenId;\n address tokenAddress;\n uint256 tokenAmount;\n uint256 duration;\n}\n\nstruct LockInfoMultiple {\n uint256 tokenId;\n address[] tokenAddresses;\n uint256[] tokenAmounts;\n uint256[] durations;\n}\n\nstruct AeroBoostVars {\n uint256 aeroVoterBoost;\n address aeroVotingAddress;\n address ionicPoolAddress;\n address veAEROAddress;\n address AERO;\n uint256 lockAmount;\n address aeroWhale;\n uint256 veAeroTokenId;\n address[] poolVote;\n uint256[] weights;\n}\n\ninterface IveAERO {\n /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration`\n /// @param _value Amount to deposit\n /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week)\n /// @return TokenId of created veNFT\n function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256);\n}\n\ninterface IAEROVoter {\n /// @notice Called by users to vote for pools. Votes distributed proportionally based on weights.\n /// Can only vote or deposit into a managed NFT once per epoch.\n /// Can only vote for gauges that have not been killed.\n /// @dev Weights are distributed proportional to the sum of the weights in the array.\n /// Throws if length of _poolVote and _weights do not match.\n /// @param _tokenId Id of veNFT you are voting with.\n /// @param _poolVote Array of pools you are voting for.\n /// @param _weights Weights of pools.\n function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external;\n\n /// @notice Returns the number of votes for a given veNFT token ID and pool address.\n /// @param _tokenId The ID of the veNFT.\n /// @param _pool The address of the pool.\n /// @return The number of votes for the given token ID and pool.\n function votes(uint256 _tokenId, address _pool) external view returns (uint256);\n}\n" + }, + "contracts/utils/IMulticall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\n/// @title Multicall interface\n/// @notice Enables calling multiple methods in a single call to the contract\ninterface IMulticall {\n /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed\n /// @dev The `msg.value` should not be trusted for any method callable from multicall.\n /// @param data The encoded function data for each of the calls to make to this contract\n /// @return results The results from each of the calls passed in via data\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n}\n" + }, + "contracts/utils/IW_NATIVE.sol": { + "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity >=0.8.0;\n\ninterface IW_NATIVE {\n function deposit() external payable;\n\n function withdraw(uint256 amount) external;\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/utils/Multicall.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.0;\n\nimport \"./IMulticall.sol\";\n\n/// @title Multicall\n/// @notice Enables calling multiple methods in a single call to the contract\nabstract contract Multicall is IMulticall {\n /// @inheritdoc IMulticall\n function multicall(bytes[] calldata data) public payable virtual override returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n\n if (!success) {\n // Next 5 lines from https://ethereum.stackexchange.com/a/83577\n if (result.length < 68) revert();\n assembly {\n result := add(result, 0x04)\n }\n revert(abi.decode(result, (string)));\n }\n\n results[i] = result;\n }\n }\n}\n" + }, + "contracts/veION/BribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\n\n/**\n * @title BribeRewards Contract\n * @notice This contract allows veION to benefit from bribes when voting for various markets\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract BribeRewards is IBribeRewards, ReentrancyGuardUpgradeable, Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Duration of the reward period in seconds\n uint256 public constant DURATION = 7 days;\n /// @notice Address of the voter contract\n address public voter;\n /// @notice Address of the veION contract\n address public ve;\n /// @notice List of reward tokens\n address[] public rewards;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Mapping to check if an address is a reward token\n mapping(address => bool) public isReward;\n /// @notice Total supply of LP tokens for each reward token\n mapping(address => uint256) public totalSupply;\n /// @notice Balance of LP tokens for each tokenId and reward token\n mapping(uint256 => mapping(address => uint256)) public balanceOf;\n /// @notice Rewards per epoch for each reward token\n mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;\n /// @notice Last earned timestamp for each reward token and tokenId\n mapping(address => mapping(uint256 => uint256)) public lastEarn;\n /// @notice A record of balance checkpoints for each account, by index\n mapping(uint256 => mapping(address => mapping(uint256 => Checkpoint))) public checkpoints;\n /// @notice The number of checkpoints for each account\n mapping(uint256 => mapping(address => uint256)) public numCheckpoints;\n /// @notice A record of balance checkpoints for each token, by index\n mapping(uint256 => mapping(address => SupplyCheckpoint)) public supplyCheckpoints;\n /// @notice The number of supply checkpoints for each token\n mapping(address => uint256) public supplyNumCheckpoints;\n /// @notice Historical prices for each reward token and epoch\n mapping(address => mapping(uint256 => uint256)) public historicalPrices;\n\n /**\n * @notice Modifier to restrict access to only the voter contract\n * @dev Ensures that the caller is the voter contract\n */\n modifier onlyVoter() {\n require(msg.sender == voter, \"Caller is not the voter\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the BribeRewards contract with the voter and veION addresses\n * @dev This function is called only once during contract deployment\n * @param _voter The address of the voter contract\n * @param _ve The address of the veION contract\n */\n function initialize(address _voter, address _ve) public initializer {\n __ReentrancyGuard_init();\n __Ownable2Step_init();\n voter = _voter;\n ve = _ve;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IBribeRewards\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\n address sender = msg.sender;\n\n totalSupply[lpToken] += amount;\n balanceOf[tokenId][lpToken] += amount;\n\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\n _writeSupplyCheckpoint(lpToken);\n\n emit Deposit(sender, tokenId, amount);\n }\n\n /// @inheritdoc IBribeRewards\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external onlyVoter {\n address sender = msg.sender;\n\n totalSupply[lpToken] -= amount;\n balanceOf[tokenId][lpToken] -= amount;\n\n _writeCheckpoint(tokenId, lpToken, balanceOf[tokenId][lpToken]);\n _writeSupplyCheckpoint(lpToken);\n\n emit Withdraw(sender, tokenId, amount);\n }\n\n /**\n * @inheritdoc IBribeRewards\n * @notice This function can accept any token, regardless of its whitelisting status.\n * @dev If we were to check the whitelisting status, it could prevent tokens that were initially whitelisted and later de-whitelisted from having their rewards claimed, leading to unclaimable rewards.\n */\n function getReward(uint256 tokenId, address[] memory tokens) external nonReentrant onlyVoter {\n address sender = msg.sender;\n if (ERC721Upgradeable(ve).ownerOf(tokenId) != sender && sender != voter) revert Unauthorized();\n\n address _owner = ERC721Upgradeable(ve).ownerOf(tokenId);\n _getReward(_owner, tokenId, tokens);\n }\n\n /// @inheritdoc IBribeRewards\n function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {\n address sender = msg.sender;\n\n if (!isReward[token]) {\n if (!IVoter(voter).isWhitelistedToken(token)) revert TokenNotWhitelisted();\n isReward[token] = true;\n rewards.push(token);\n }\n\n _notifyRewardAmount(sender, token, amount);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @dev used with all getReward implementations\n function _getReward(address recipient, uint256 tokenId, address[] memory tokens) internal {\n // check if token whitelisted\n uint256 _length = tokens.length;\n for (uint256 i = 0; i < _length; i++) {\n uint256 _reward = earned(tokens[i], tokenId);\n lastEarn[tokens[i]][tokenId] = block.timestamp;\n if (_reward > 0) IERC20(tokens[i]).safeTransfer(recipient, _reward);\n\n emit RewardsClaimed(recipient, tokens[i], _reward);\n }\n }\n\n /**\n * @notice Writes a new checkpoint for a token's balance\n * @param tokenId The ID of the veION token\n * @param lpToken The LP token address\n * @param balance The balance to record\n */\n function _writeCheckpoint(uint256 tokenId, address lpToken, uint256 balance) internal {\n uint256 _nCheckPoints = numCheckpoints[tokenId][lpToken];\n uint256 _timestamp = block.timestamp;\n\n if (\n _nCheckPoints > 0 &&\n IonicTimeLibrary.epochStart(checkpoints[tokenId][lpToken][_nCheckPoints - 1].timestamp) ==\n IonicTimeLibrary.epochStart(_timestamp)\n ) {\n checkpoints[tokenId][lpToken][_nCheckPoints - 1] = Checkpoint(_timestamp, balance);\n } else {\n checkpoints[tokenId][lpToken][_nCheckPoints] = Checkpoint(_timestamp, balance);\n numCheckpoints[tokenId][lpToken] = _nCheckPoints + 1;\n }\n }\n\n /// @notice Writes a new checkpoint for total supply\n /// @param lpToken The LP token address\n function _writeSupplyCheckpoint(address lpToken) internal {\n uint256 _nCheckPoints = supplyNumCheckpoints[lpToken];\n uint256 _timestamp = block.timestamp;\n\n if (\n _nCheckPoints > 0 &&\n IonicTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1][lpToken].timestamp) ==\n IonicTimeLibrary.epochStart(_timestamp)\n ) {\n supplyCheckpoints[_nCheckPoints - 1][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\n } else {\n supplyCheckpoints[_nCheckPoints][lpToken] = SupplyCheckpoint(_timestamp, totalSupply[lpToken]);\n supplyNumCheckpoints[lpToken] = _nCheckPoints + 1;\n }\n }\n\n /// @dev used within all notifyRewardAmount implementations\n function _notifyRewardAmount(address sender, address token, uint256 amount) internal {\n if (amount == 0) revert AmountCannotBeZero();\n IERC20(token).safeTransferFrom(sender, address(this), amount);\n\n uint256 epochStart = IonicTimeLibrary.epochStart(block.timestamp);\n tokenRewardsPerEpoch[token][epochStart] += amount;\n\n emit RewardNotification(sender, token, epochStart, amount);\n }\n\n /**\n * @notice Calculates the ETH value of a token amount at a specific epoch\n * @param amount The amount of tokens\n * @param lpToken The LP token address\n * @param epochTimestamp The timestamp of the epoch\n * @return The ETH value of the tokens\n */\n function _getTokenEthValueAt(\n uint256 amount,\n address lpToken,\n uint256 epochTimestamp\n ) internal view returns (uint256) {\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\n if (historicalPrices[lpToken][epochStart] == 0) revert HistoricalPriceNotSet(lpToken, epochStart);\n uint256 _priceAtTimestamp = historicalPrices[lpToken][epochStart];\n uint256 ethValue = (amount * _priceAtTimestamp) / 1e18;\n return ethValue;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Pure/View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @notice Returns the total number of reward tokens\n /// @return The length of the rewards array\n function rewardsListLength() external view returns (uint256) {\n return rewards.length;\n }\n\n /// @inheritdoc IBribeRewards\n function earned(address token, uint256 tokenId) public view returns (uint256) {\n EarnedVars memory vars;\n vars.totalReward = 0;\n address[] memory lpTokens = getAllLpRewardTokens();\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 j = 0; j < lpTokensLength; j++) {\n address lpToken = lpTokens[j];\n\n if (numCheckpoints[tokenId][lpToken] == 0) {\n continue;\n }\n\n vars.currTs = IonicTimeLibrary.epochStart(lastEarn[token][tokenId]);\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs);\n Checkpoint memory cp0 = checkpoints[tokenId][lpToken][vars.index];\n\n vars.currTs = Math.max(vars.currTs, IonicTimeLibrary.epochStart(cp0.timestamp));\n vars.numEpochs = (IonicTimeLibrary.epochStart(block.timestamp) - vars.currTs) / DURATION;\n\n if (vars.numEpochs > 0) {\n for (uint256 i = 0; i < vars.numEpochs; i++) {\n vars.index = getPriorBalanceIndex(tokenId, lpToken, vars.currTs + DURATION - 1);\n cp0 = checkpoints[tokenId][lpToken][vars.index];\n vars.epochBalanceValue = _getTokenEthValueAt(cp0.balanceOf, lpToken, vars.currTs);\n\n vars.supplyValue = 0;\n for (uint256 k = 0; k < lpTokensLength; k++) {\n address currentLpToken = lpTokens[k];\n uint256 supplyAmount = Math.max(\n supplyCheckpoints[getPriorSupplyIndex(vars.currTs + DURATION - 1, currentLpToken)][currentLpToken].supply,\n 1\n );\n vars.supplyValue += _getTokenEthValueAt(supplyAmount, currentLpToken, vars.currTs);\n }\n if (vars.supplyValue > 0) {\n vars.totalReward += (vars.epochBalanceValue * tokenRewardsPerEpoch[token][vars.currTs]) / vars.supplyValue;\n }\n vars.currTs += DURATION;\n }\n }\n }\n\n return vars.totalReward;\n }\n\n /// @notice Gets all LP tokens that can receive rewards\n /// @return Array of LP token addresses\n function getAllLpRewardTokens() public view returns (address[] memory) {\n return IVoter(voter).getAllLpRewardTokens();\n }\n\n /**\n * @notice Sets historical prices for LP tokens at specific epochs\n * @param epochTimestamp The timestamp of the epoch\n * @param lpToken The LP token address\n * @param price The price to set\n */\n function setHistoricalPrices(uint256 epochTimestamp, address lpToken, uint256 price) external onlyOwner {\n uint256 epochStart = IonicTimeLibrary.epochStart(epochTimestamp);\n historicalPrices[lpToken][epochStart] = price;\n emit HistoricalPriceSet(epochTimestamp, lpToken, price);\n }\n\n /**\n * @notice Gets a specific checkpoint for a token\n * @param tokenId The ID of the veION token\n * @param lpToken The LP token address\n * @param index The index of the checkpoint to retrieve\n * @return The checkpoint data\n */\n function getCheckpoint(uint256 tokenId, address lpToken, uint256 index) external view returns (Checkpoint memory) {\n return checkpoints[tokenId][lpToken][index];\n }\n\n /// @inheritdoc IBribeRewards\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) public view returns (uint256) {\n uint256 nCheckpoints = numCheckpoints[tokenId][lpToken];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[tokenId][lpToken][nCheckpoints - 1].timestamp <= timestamp) {\n return (nCheckpoints - 1);\n }\n\n // Next check implicit zero balance\n if (checkpoints[tokenId][lpToken][0].timestamp > timestamp) {\n return 0;\n }\n\n uint256 lower = 0;\n uint256 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[tokenId][lpToken][center];\n if (cp.timestamp == timestamp) {\n return center;\n } else if (cp.timestamp < timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n\n /// @inheritdoc IBribeRewards\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) public view returns (uint256) {\n uint256 nCheckpoints = supplyNumCheckpoints[lpToken];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (supplyCheckpoints[nCheckpoints - 1][lpToken].timestamp <= timestamp) {\n return (nCheckpoints - 1);\n }\n\n // Next check implicit zero balance\n if (supplyCheckpoints[0][lpToken].timestamp > timestamp) {\n return 0;\n }\n\n uint256 lower = 0;\n uint256 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n SupplyCheckpoint memory cp = supplyCheckpoints[center][lpToken];\n if (cp.timestamp == timestamp) {\n return center;\n } else if (cp.timestamp < timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n}\n" + }, + "contracts/veION/interfaces/IBribeRewards.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IBribeRewards {\n /// @notice A checkpoint for marking balance\n struct Checkpoint {\n uint256 timestamp;\n uint256 balanceOf;\n }\n\n /// @notice A checkpoint for marking supply\n struct SupplyCheckpoint {\n uint256 timestamp;\n uint256 supply;\n }\n\n struct EarnedVars {\n uint256 totalReward;\n uint256 reward;\n uint256 supplyValue;\n uint256 epochBalanceValue;\n uint256 currTs;\n uint256 index;\n uint256 numEpochs;\n uint256 overallBalance;\n uint256 overallSupply;\n uint256 historicalPrice;\n }\n\n error InvalidReward();\n error Unauthorized();\n error InvalidGauge();\n error InvalidEscrowToken();\n error SingleTokenExpected();\n error InvalidVotingEscrow();\n error TokenNotWhitelisted();\n error AmountCannotBeZero();\n error HistoricalPriceNotSet(address lpToken, uint256 epochStart);\n\n event Deposit(address indexed user, uint256 indexed tokenId, uint256 amount);\n event Withdraw(address indexed user, uint256 indexed tokenId, uint256 amount);\n event RewardNotification(address indexed user, address indexed rewardToken, uint256 indexed epoch, uint256 amount);\n event RewardsClaimed(address indexed user, address indexed rewardToken, uint256 amount);\n event HistoricalPriceSet(uint256 indexed epochTimestamp, address indexed lpToken, uint256 price);\n\n /// @notice Deposit an amount into the bribe rewards contract for a specific veNFT\n /// @dev Can only be called internally by authorized entities.\n /// @param lpToken Address of the liquidity pool token\n /// @param amount Amount to be deposited for the veNFT\n /// @param tokenId Unique identifier of the veNFT\n function deposit(address lpToken, uint256 amount, uint256 tokenId) external;\n\n /// @notice Withdraw an amount from the bribe rewards contract for a specific veNFT\n /// @dev Can only be called internally by authorized entities.\n /// @param lpToken Address of the liquidity pool token\n /// @param amount Amount to be withdrawn for the veNFT\n /// @param tokenId Unique identifier of the veNFT\n function withdraw(address lpToken, uint256 amount, uint256 tokenId) external;\n\n /// @notice Claim the rewards earned by a veNFT holder\n /// @param tokenId Unique identifier of the veNFT\n /// @param tokens Array of tokens to claim rewards for\n function getReward(uint256 tokenId, address[] memory tokens) external;\n\n /// @notice Notify the contract about new rewards for stakers\n /// @param token Address of the reward token\n /// @param amount Amount of the reward token to be added\n function notifyRewardAmount(address token, uint256 amount) external;\n\n /// @notice Get the prior balance index for a veNFT at a specific timestamp\n /// @dev Timestamp must be in the past or present.\n /// @param tokenId The veNFT token ID to check\n /// @param lpToken Address of the liquidity pool token\n /// @param timestamp The timestamp to get the balance at\n /// @return The balance index at the given timestamp\n function getPriorBalanceIndex(uint256 tokenId, address lpToken, uint256 timestamp) external view returns (uint256);\n\n /// @notice Get the prior supply index at a specific timestamp\n /// @dev Timestamp must be in the past or present.\n /// @param timestamp The timestamp to get the supply index at\n /// @return The supply index at the given timestamp\n function getPriorSupplyIndex(uint256 timestamp, address lpToken) external view returns (uint256);\n\n /// @notice Calculate the rewards earned for a specific token and veNFT\n /// @param token Address of the reward token\n /// @param tokenId Unique identifier of the veNFT\n /// @return Amount of the reward token earned\n function earned(address token, uint256 tokenId) external view returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport \"./IveIONCore.sol\";\nimport \"./IveIONFirstExtension.sol\";\nimport \"./IveIONSecondExtension.sol\";\n\n/// @title IveION Interface\n/// @notice Interface for veION contract\ninterface IveION is IveIONStructsEnumsErrorsEvents, IveIONCore, IveIONFirstExtension, IveIONSecondExtension {\n // Constants\n function PRECISION() external view returns (uint256);\n\n // State Variables\n function s_tokenId() external view returns (uint256);\n function s_limitedBoost() external view returns (uint256);\n function s_limitedBoostActive() external view returns (bool);\n function s_veAERO() external view returns (address);\n function s_aeroVoting() external view returns (address);\n function s_ionicPool() external view returns (address);\n function s_voter() external view returns (address);\n function s_aeroVoterBoost() external view returns (uint256);\n function s_minimumLockDuration() external view returns (uint256);\n function s_maxEarlyWithdrawFee() external view returns (uint256);\n function ap() external view returns (address);\n function implementation() external view returns (address);\n\n // Mappings\n function s_minimumLockAmount(LpTokenType lpTokenType) external view returns (uint256);\n function s_whitelistedToken(address token) external view returns (bool);\n function s_lpType(address token) external view returns (LpTokenType);\n function s_canSplit(address user) external view returns (bool);\n function s_locked(uint256 tokenId, LpTokenType lpTokenType) external view returns (LockedBalance memory);\n function s_userPointEpoch(uint256 tokenId, LpTokenType lpTokenType) external view returns (uint256);\n function s_userPointHistory(\n uint256 tokenId,\n LpTokenType lpTokenType,\n uint256 epoch\n ) external view returns (UserPoint memory);\n function s_voted(uint256 tokenId) external view returns (bool);\n function s_supply(LpTokenType lpTokenType) external view returns (uint256);\n function s_permanentLockBalance(LpTokenType lpTokenType) external view returns (uint256);\n function s_stakeStrategy(LpTokenType lpTokenType) external view returns (address);\n function s_underlyingStake(uint256 tokenId, address token) external view returns (uint256);\n function s_protocolFees(LpTokenType lpTokenType) external view returns (uint256);\n function s_distributedFees(LpTokenType lpTokenType) external view returns (uint256);\n function s_delegations(\n uint256 delegatorTokenId,\n uint256 delegateeTokenId,\n LpTokenType lpTokenType\n ) external view returns (uint256);\n function s_userCumulativeAssetValues(address user, address token) external view returns (uint256);\n function s_delegatorsBlocked(uint256 tokenId, address token) external view returns (bool);\n\n // Openzeppelin functions\n function transferFrom(address from, address to, uint256 tokenId) external;\n function ownerOf(uint256 tokenId) external returns (address);\n function owner() external returns (address);\n function balanceOf(address owner) external returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveIONCore.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\n\n/// @title IveION Interface\n/// @notice Interface for veION contract\ninterface IveIONCore {\n /**\n * @notice Creates a new lock for multiple tokens and assigns it to a specified address\n * @param _tokenAddress Array of token addresses to lock\n * @param _tokenAmount Array of token amounts to lock\n * @param _duration Array of lock durations\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\n * @param _to Address to assign the lock to\n * @return The ID of the newly created veNFT\n */\n function createLockFor(\n address[] memory _tokenAddress,\n uint256[] memory _tokenAmount,\n uint256[] memory _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) external returns (uint256);\n\n /**\n * @notice Creates a new lock for multiple tokens\n * @param _tokenAddress Array of token addresses to lock\n * @param _tokenAmount Array of token amounts to lock\n * @param _duration Array of lock durations\n * @param _stakeUnderlying Array of booleans indicating whether to stake underlying tokens\n * @return The ID of the newly created veNFT\n */\n function createLock(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying\n ) external returns (uint256);\n\n /**\n * @notice Increases the amount of tokens locked for a specific veNFT\n * @param _tokenAddress Address of the token to increase lock amount for\n * @param _tokenId ID of the veNFT\n * @param _tokenAmount Amount of tokens to add to the lock\n * @param _stakeUnderlying Whether to stake the underlying tokens\n */\n function increaseAmount(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n bool _stakeUnderlying\n ) external;\n\n /**\n * @notice Locks additional asset type for an existing veNFT\n * @param _tokenAddress Address of the new token to lock\n * @param _tokenAmount Amount of tokens to lock\n * @param _tokenId ID of the veNFT\n * @param _duration Duration of the lock\n * @param _stakeUnderlying Whether to stake the underlying tokens\n */\n function lockAdditionalAsset(\n address _tokenAddress,\n uint256 _tokenAmount,\n uint256 _tokenId,\n uint256 _duration,\n bool _stakeUnderlying\n ) external;\n\n /**\n * @notice Increases the lock duration for a specific token in a veNFT\n * @param _tokenAddress Address of the token\n * @param _tokenId ID of the veNFT\n * @param _lockDuration New lock duration to extend to\n */\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external;\n\n /**\n * @notice Delegates voting power from one veNFT to another.\n * @param fromTokenId The ID of the veNFT from which voting power is delegated.\n * @param toTokenId The ID of the veNFT to which voting power is delegated.\n * @param lpToken The address of the LP token associated with the delegation.\n * @param amount The amount of voting power to delegate.\n */\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external;\n\n /**\n * @notice Removes delegatees from a specific veNFT\n * @param fromTokenId ID of the veNFT from which delegatees are removed\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegatee\n */\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) external;\n\n /**\n * @notice Removes delegators from a specific veNFT\n * @param fromTokenIds Array of veNFT IDs that are delegators to be removed\n * @param toTokenId ID of the veNFT from which delegators are removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegator\n */\n function removeDelegators(\n uint256[] memory fromTokenIds,\n uint256 toTokenId,\n address lpToken,\n uint256[] memory amounts\n ) external;\n\n /**\n * @notice Locks a token permanently.\n * @param _tokenAddress The address of the token to lock.\n * @param _tokenId The ID of the token to lock.\n */\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Unlocks a permanently locked token.\n * @param _tokenAddress The address of the token to unlock.\n * @param _tokenId The ID of the token to unlock.\n */\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Updates voting status for a veNFT\n * @param _tokenId ID of the veNFT\n * @param _voting Voting status\n */\n function voting(uint256 _tokenId, bool _voting) external;\n\n /**\n * @notice Sets the implementation addresses for the veION contract extensions.\n * @dev This function can only be called by authorized entities.\n * @param _veIONFirstExtension The address of the first extension contract.\n * @param _veIONSecondExtension The address of the second extension contract.\n */\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external;\n}\n\n/// @title IAeroVotingEscrow Interface\n/// @notice Interface for Aero Voting Escrow contract\ninterface IAeroVotingEscrow {\n /**\n * @notice Returns the balance of the specified owner.\n * @param _owner The address of the owner.\n * @return The balance of the owner.\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Retrieves the token ID at a specific index for a given owner.\n * @param _owner The address of the owner.\n * @param _index The index of the token ID in the owner's list.\n * @return The token ID at the specified index.\n */\n function ownerToNFTokenIdList(address _owner, uint256 _index) external view returns (uint256);\n}\n\n/// @title IAeroVoter Interface\n/// @notice Interface for Aero Voter contract\ninterface IAeroVoter {\n /**\n * @notice Returns the list of pools voted for by a specific token ID.\n * @param tokenId The ID of the token.\n * @return An array of addresses representing the pools voted for.\n */\n function poolVote(uint256 tokenId) external view returns (address[] memory);\n\n /**\n * @notice Retrieves the weight of a specific pool.\n * @param pool The address of the pool.\n * @return The weight of the pool.\n */\n function weights(address pool) external view returns (uint256);\n\n /**\n * @notice Returns the number of votes a specific token ID has for a given pool.\n * @param tokenId The ID of the token.\n * @param pool The address of the pool.\n * @return The number of votes for the pool.\n */\n function votes(uint256 tokenId, address pool) external view returns (uint256);\n}\n\ninterface IAddressesProvider {\n function getAddress(string calldata id) external view returns (address);\n}\n\ninterface IMasterPriceOracle {\n function price(address underlying) external view returns (uint256);\n}\n" + }, + "contracts/veION/interfaces/IveIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\n\n/// @title IveION Interface First Extensions\n/// @notice Interface for veION contract\ninterface IveIONFirstExtension is IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Withdraws tokens associated with a specific token ID.\n * @param _tokenAddress The address of the token to withdraw.\n * @param _tokenId The ID of the token to withdraw.\n */\n function withdraw(address _tokenAddress, uint256 _tokenId) external;\n\n /**\n * @notice Merges two token IDs into one.\n * @param _from The ID of the token to merge from.\n * @param _to The ID of the token to merge into.\n */\n function merge(uint256 _from, uint256 _to) external;\n\n /**\n * @notice Splits a token into two separate tokens.\n * @param _tokenAddress The address of the token to split.\n * @param _from The ID of the token to split.\n * @param _splitAmount The amount to split from the original token.\n * @return _tokenId1 The ID of the first resulting token.\n * @return _tokenId2 The ID of the second resulting token.\n */\n function split(\n address _tokenAddress,\n uint256 _from,\n uint256 _splitAmount\n ) external returns (uint256 _tokenId1, uint256 _tokenId2);\n\n /**\n * @notice Claims emissions for a specific token.\n * @param _tokenAddress The address of the token for which to claim emissions.\n */\n function claimEmissions(address _tokenAddress) external;\n\n /**\n * @notice Allows or blocks delegators for a specific token ID.\n * @param _tokenId The ID of the token.\n * @param _tokenAddress The address of the token.\n * @param _blocked Boolean indicating if delegators are blocked.\n */\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external;\n\n /**\n * @notice Retrieves the balance of a specific NFT.\n * @param _tokenId The ID of the NFT.\n * @return _assets An array of asset addresses.\n * @return _balances An array of balances for each asset.\n * @return _boosts An array of boost values for each asset.\n */\n function balanceOfNFT(\n uint256 _tokenId\n ) external view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts);\n\n /**\n * @notice Retrieves the total ETH value of tokens owned by a specific address.\n * @param _owner The address of the owner.\n * @return totalValue The total ETH value of the tokens.\n */\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue);\n}\n" + }, + "contracts/veION/interfaces/IveIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../stake/IStakeStrategy.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./IveIONStructsEnumsErrorsEvents.sol\";\n\n/// @title IveION Interface Second Extension\n/// @notice Interface for veION contract\ninterface IveIONSecondExtension is IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Whitelists or removes tokens from the whitelist.\n * @param _tokens An array of token addresses to be whitelisted or removed.\n * @param _isWhitelisted An array of booleans indicating the whitelist status for each token.\n */\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external;\n\n /**\n * @notice Withdraws protocol fees for a specific token to a recipient address.\n * @param _tokenAddress The address of the token for which protocol fees are to be withdrawn.\n * @param _recipient The address to which the protocol fees will be sent.\n */\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external;\n\n /**\n * @notice Withdraws distributed fees for a specific token to a recipient address.\n * @param _tokenAddress The address of the token for which distributed fees are to be withdrawn.\n * @param _recipient The address to which the distributed fees will be sent.\n */\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external;\n\n /**\n * @notice Toggles the ability to split tokens for a specific account.\n * @param _account The address of the account.\n * @param _isAllowed Boolean indicating if splitting is allowed.\n */\n function toggleSplit(address _account, bool _isAllowed) external;\n\n /**\n * @notice Toggles the limited boost feature.\n * @param _isBoosted Boolean indicating if the boost is active.\n */\n function toggleLimitedBoost(bool _isBoosted) external;\n\n /**\n * @notice Sets the amount for a limited time boost.\n * @param _boostAmount The amount of the boost.\n */\n function setLimitedTimeBoost(uint256 _boostAmount) external;\n\n /**\n * @notice Sets the address of the voter.\n * @param _voter The address of the voter.\n */\n function setVoter(address _voter) external;\n\n /**\n * @notice Sets the minimum lock amount for a specific token.\n * @param _tokenAddress The address of the token.\n * @param _minimumAmount The minimum amount to lock.\n */\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external;\n\n /**\n * @notice Sets the minimum lock duration.\n * @param _minimumLockDuration The minimum duration for locking.\n */\n function setMinimumLockDuration(uint256 _minimumLockDuration) external;\n\n /**\n * @notice Sets the address of the Ionic Pool.\n * @param _ionicPool The address of the Ionic Pool.\n */\n function setIonicPool(address _ionicPool) external;\n\n /**\n * @notice Sets the address of the Aero Voting contract.\n * @param _aeroVoting The address of the Aero Voting contract.\n */\n function setAeroVoting(address _aeroVoting) external;\n\n /**\n * @notice Sets the boost amount for Aero Voter.\n * @param _aeroVoterBoost The boost amount for Aero Voter.\n */\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external;\n\n /**\n * @notice Sets the maximum early withdrawal fee.\n * @param _maxEarlyWithdrawFee The maximum fee for early withdrawal.\n */\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external;\n\n /**\n * @notice Sets the LP token type for a specific token.\n * @param _token The address of the token.\n * @param _type The LP token type.\n */\n function setLpTokenType(address _token, LpTokenType _type) external;\n\n /**\n * @notice Sets the stake strategy for a specific LP token type.\n * @param _lpType The LP token type.\n * @param _strategy The stake strategy.\n */\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external;\n\n /**\n * @notice Sets the address of the veAERO contract.\n * @param _veAERO The address of the veAERO contract.\n */\n function setVeAERO(address _veAERO) external;\n\n /**\n * @notice Retrieves the lock information for a specific user.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return A LockedBalance struct containing lock details.\n */\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory);\n\n /**\n * @notice Retrieves the token IDs owned by a specific address.\n * @param _owner The address of the owner.\n * @return An array of token IDs owned by the address.\n */\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the assets locked for a specific token ID.\n * @param _tokenId The ID of the token.\n * @return An array of addresses representing the locked assets.\n */\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory);\n\n /**\n * @notice Retrieves the delegatees for a specific token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return An array of delegatee IDs.\n */\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the delegators for a specific token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return An array of delegator IDs.\n */\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory);\n\n /**\n * @notice Retrieves the user point for a specific token ID, LP token type, and epoch.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @param _epoch The epoch number.\n * @return A UserPoint struct containing user point details.\n */\n function getUserPoint(uint256 _tokenId, LpTokenType _lpType, uint256 _epoch) external view returns (UserPoint memory);\n}\n" + }, + "contracts/veION/interfaces/IveIONStructsEnumsErrorsEvents.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IveIONStructsEnumsErrorsEvents {\n /**\n * @notice Structure representing a locked balance\n * @param tokenAddress Address of the token\n * @param amount Amount of tokens locked\n * @param delegateAmount Amount of tokens delegated\n * @param start Start time of the lock\n * @param end End time of the lock\n * @param isPermanent Indicates if the lock is permanent\n * @param boost Boost value for the lock\n */\n struct LockedBalance {\n address tokenAddress;\n uint256 amount;\n uint256 delegateAmount;\n uint256 start;\n uint256 end;\n bool isPermanent;\n uint256 boost;\n }\n\n /**\n * @notice Structure representing a delegation\n * @param amount Amount of tokens delegated\n * @param delegatee ID of the delegatee\n */\n struct Delegation {\n uint256 amount;\n uint256 delegatee;\n }\n\n /**\n * @notice Structure representing a user point\n * @param bias Bias value\n * @param slope Slope value, representing -dweight / dt\n * @param ts Timestamp of the point\n * @param blk Block number of the point\n * @param permanent Permanent value\n * @param permanentDelegate Permanent delegate value\n */\n struct UserPoint {\n uint256 bias;\n uint256 slope;\n uint256 ts;\n uint256 blk;\n uint256 permanent;\n uint256 permanentDelegate;\n }\n\n /**\n * @notice Structure representing a global point\n * @param bias Bias value\n * @param slope Slope value, representing -dweight / dt\n * @param ts Timestamp of the point\n * @param blk Block number of the point\n * @param permanentLockBalance Permanent lock balance\n */\n struct GlobalPoint {\n int128 bias;\n int128 slope;\n uint256 ts;\n uint256 blk;\n uint256 permanentLockBalance;\n }\n\n /**\n * @notice Structure representing a checkpoint\n * @param fromTimestamp Timestamp from which the checkpoint is valid\n * @param owner Address of the owner\n * @param delegatedBalance Balance that has been delegated\n * @param delegatee ID of the delegatee\n */\n struct Checkpoint {\n uint256 fromTimestamp;\n address owner;\n uint256 delegatedBalance;\n uint256 delegatee;\n }\n\n /**\n * @notice Enum representing deposit types\n */\n enum DepositType {\n DEPOSIT_FOR_TYPE,\n CREATE_LOCK_TYPE,\n INCREASE_LOCK_AMOUNT,\n INCREASE_UNLOCK_TIME,\n LOCK_ADDITIONAL\n }\n\n /**\n * @notice Enum representing LP token types\n */\n enum LpTokenType {\n Mode_Velodrome_5050_ION_MODE,\n Mode_Balancer_8020_ION_ETH,\n Base_Aerodrome_5050_ION_wstETH,\n Base_Balancer_8020_ION_ETH,\n Optimism_Velodrome_5050_ION_OP,\n Optimism_Balancer_8020_ION_ETH\n }\n\n error LockDurationNotInFuture();\n error ZeroAmount();\n error LockDurationTooLong();\n error TokenNotWhitelisted();\n error NotOwner();\n error AlreadyVoted();\n error PermanentLock();\n error NoLockFound();\n error LockExpired();\n error SameNFT();\n error SplitNotAllowed();\n error AmountTooBig();\n error NotPermanentLock();\n error TokenHasDelegatees();\n error TokenHasDelegators();\n error NotVoter();\n error MinimumNotMet();\n error ArrayMismatch();\n error LockDurationTooShort();\n error DuplicateAsset();\n error SplitTooSmall();\n error NotEnoughRemainingAfterSplit();\n error NoDelegationBetweenTokens(uint256 _tokenId1, uint256 _tokenId2);\n error NoUnderlyingStake();\n error NotAcceptingDelegators();\n error BoostAmountMustBeGreaterThanZero();\n error InvalidAddress();\n error MinimumAmountMustBeGreaterThanZero();\n error MinimumLockDurationMustBeGreaterThanZero();\n error AeroBoostAmountMustBeGreaterThanZero();\n error MaxEarlyWithdrawFeeMustBeGreaterThanZero();\n error InvalidTokenAddress();\n error InvalidStrategyAddress();\n error InvalidVeAEROAddress();\n\n event Deposit(\n address indexed provider,\n uint256 indexed tokenId,\n DepositType indexed depositType,\n uint256 value,\n uint256 locktime,\n uint256 ts\n );\n event Withdraw(address indexed provider, uint256 indexed tokenId, uint256 value, uint256 ts);\n event Supply(uint256 prevSupply, uint256 supply);\n event Delegated(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\n event DelegationRemoved(uint256 indexed fromTokenId, uint256 indexed toTokenId, address lpToken, uint256 amount);\n event ProtocolFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\n event DistributedFeesWithdrawn(address indexed tokenAddress, address indexed recipient, uint256 amount);\n event SplitToggle(address indexed account, bool isAllowed);\n event LimitedBoostToggled(bool isBoosted);\n event LimitedTimeBoostSet(uint256 boostAmount);\n event VoterSet(address indexed newVoter);\n event AeroVotingSet(address indexed newAeroVoting);\n event AeroVoterBoostSet(uint256 newAeroVoterBoost);\n event TokensWhitelisted(address[] token, bool[] isWhitelisted);\n event LpTokenTypeSet(address indexed token, LpTokenType lpTokenType);\n event VeAEROSet(address indexed veAERO);\n event StakeStrategySet(LpTokenType indexed lpTokenType, address indexed strategy);\n event MinimumLockAmountSet(address indexed tokenAddress, uint256 minimumAmount);\n event MinimumLockDurationSet(uint256 minimumDuration);\n event IonicPoolSet(address indexed newIonicPool);\n event SplitCompleted(\n uint256 indexed fromTokenId,\n uint256 indexed tokenId1,\n uint256 indexed tokenId2,\n uint256 splitAmount,\n address tokenAddress\n );\n event MergeCompleted(\n uint256 indexed fromTokenId,\n uint256 indexed toTokenId,\n address[] assetsLocked,\n uint256 lengthOfAssets\n );\n event EmissionsClaimed(address indexed claimant, address indexed tokenAddress);\n event MaxEarlyWithdrawFeeSet(uint256 maxEarlyWithdrawFee);\n event PermanentLockCreated(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\n event PermanentLockRemoved(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);\n event Voted(uint256 _tokenId, bool _voting);\n event DelegatorsBlocked(uint256 indexed _tokenId, address indexed _lpToken, bool _blocked);\n event Initialized(address indexed addressesProvider);\n event ExtensionsSet(address indexed _firstExtension, address indexed _secondExtension);\n}\n" + }, + "contracts/veION/interfaces/IVoter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\n/**\n * @title IVoter\n * @notice Interface for the Voter contract, which manages voting and reward distribution.\n */\ninterface IVoter {\n /// @notice Error thrown when a user has already voted or deposited.\n error AlreadyVotedOrDeposited();\n\n /// @notice Error thrown when an action is attempted outside the distribution window.\n error DistributeWindow();\n\n /// @notice Error thrown when a reward accumulator does not exist for a given pool.\n error RewardAccumulatorDoesNotExist(address _pool);\n\n /// @notice Error thrown when a reward accumulator is not alive.\n error RewardAccumulatorNotAlive(address _rewardAccumulator);\n\n /// @notice Error thrown when a market already exists.\n error MarketAlreadyExists();\n\n /// @notice Error thrown when the maximum voting number is too low.\n error MaximumVotingNumberTooLow();\n\n /// @notice Error thrown when array lengths do not match.\n error MismatchedArrayLengths();\n\n /// @notice Error thrown when there are non-zero votes.\n error NonZeroVotes();\n\n /// @notice Error thrown when the caller is not the owner.\n error NotOwner();\n\n /// @notice Error thrown when an action is attempted outside the distribution window.\n error NotDistributeWindow();\n\n /// @notice Error thrown when the caller is not the governor.\n error NotGovernor();\n\n /// @notice Error thrown when an NFT is not whitelisted.\n error NotWhitelistedNFT();\n\n /// @notice Error thrown when the same value is provided.\n error SameValue();\n\n /// @notice Error thrown when there are too many pools.\n error TooManyPools();\n\n /// @notice Error thrown when array lengths are unequal.\n error UnequalLengths();\n\n /// @notice Error thrown when an address is zero.\n error ZeroAddress();\n\n /// @notice Error thrown when the tokens array is empty.\n error TokensArrayEmpty();\n\n /// @notice Error thrown when the weight is zero.\n error ZeroWeight();\n\n /**\n * @notice Struct to store vote details.\n * @param marketVotes Array of market addresses voted for.\n * @param marketVoteSides Array of market sides voted for.\n * @param votes Array of vote weights.\n * @param usedWeight Total weight used in voting.\n */\n struct VoteDetails {\n address[] marketVotes;\n MarketSide[] marketVoteSides;\n uint256[] votes;\n uint256 usedWeight;\n }\n\n /**\n * @notice Struct to store market information.\n * @param marketAddress Address of the market.\n * @param side Side of the market (Supply or Borrow).\n */\n struct Market {\n address marketAddress;\n MarketSide side;\n }\n\n /**\n * @notice Struct to store variables used in voting.\n * @param totalWeight Total weight available for voting.\n * @param usedWeight Weight used in voting.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param rewardAccumulator Address of the reward accumulator.\n * @param marketWeight Weight of the market.\n * @param bribes Address of the bribes.\n */\n struct VoteVars {\n uint256 totalWeight;\n uint256 usedWeight;\n address market;\n MarketSide marketSide;\n address rewardAccumulator;\n uint256 marketWeight;\n address bribes;\n }\n\n /**\n * @notice Struct to store local variables used in voting.\n * @param sender Address of the sender.\n * @param timestamp Timestamp of the vote.\n * @param votingLPs Array of voting LP addresses.\n * @param votingLPBalances Array of voting LP balances.\n * @param boosts Array of boosts.\n */\n struct VoteLocalVars {\n address sender;\n uint256 timestamp;\n address[] votingLPs;\n uint256[] votingLPBalances;\n uint256[] boosts;\n }\n\n /**\n * @notice Enum to represent the side of a market.\n */\n enum MarketSide {\n Supply,\n Borrow\n }\n\n /**\n * @notice Event emitted when a vote is cast.\n * @param voter Address of the voter.\n * @param pool Address of the pool.\n * @param tokenId ID of the token.\n * @param weight Weight of the vote.\n * @param totalWeight Total weight of the vote.\n * @param timestamp Timestamp of the vote.\n */\n event Voted(\n address indexed voter,\n address indexed pool,\n uint256 indexed tokenId,\n uint256 weight,\n uint256 totalWeight,\n uint256 timestamp\n );\n\n /**\n * @notice Event emitted when a vote is abstained.\n * @param voter Address of the voter.\n * @param pool Address of the pool.\n * @param tokenId ID of the token.\n * @param weight Weight of the vote.\n * @param totalWeight Total weight of the vote.\n * @param timestamp Timestamp of the vote.\n */\n event Abstained(\n address indexed voter,\n address indexed pool,\n uint256 indexed tokenId,\n uint256 weight,\n uint256 totalWeight,\n uint256 timestamp\n );\n\n /**\n * @notice Event emitted when a reward is notified.\n * @param sender Address of the sender.\n * @param reward Address of the reward.\n * @param amount Amount of the reward.\n */\n event NotifyReward(address indexed sender, address indexed reward, uint256 amount);\n\n /**\n * @notice Event emitted when a token is whitelisted.\n * @param whitelister Address of the whitelister.\n * @param token Address of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool);\n\n /**\n * @notice Event emitted when an NFT is whitelisted.\n * @param whitelister Address of the whitelister.\n * @param tokenId ID of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool);\n\n event LpTokensSet(address[] indexed lpTokens);\n event MpoSet(address indexed mpo);\n event GovernorSet(address indexed governor);\n event MarketsAdded(Market[] markets);\n event MarketRewardAccumulatorsSet(\n address[] indexed markets,\n MarketSide[] indexed marketSides,\n address[] indexed rewardAccumulators\n );\n event BribesSet(address[] indexed rewardAccumulators, address[] indexed bribes);\n event MaxVotingNumSet(uint256 indexed maxVotingNum);\n event RewardAccumulatorAliveToggled(address indexed market, MarketSide indexed marketSide, bool isAlive);\n event Initialized(address[] tokens, address mpo, address rewardToken, address ve, address governor);\n event DistributionTimelockAliveToggled(bool isAlive);\n\n /**\n * @notice Get the weight of a market.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param lpToken Address of the LP token.\n * @return The weight of the market.\n */\n function weights(address market, MarketSide marketSide, address lpToken) external view returns (uint256);\n\n /**\n * @notice Get the votes for a token.\n * @param tokenId ID of the token.\n * @param market Address of the market.\n * @param marketSide Side of the market.\n * @param lpToken Address of the LP token.\n * @return The votes for the token.\n */\n function votes(\n uint256 tokenId,\n address market,\n MarketSide marketSide,\n address lpToken\n ) external view returns (uint256);\n\n /**\n * @notice Get the used weights for a token.\n * @param tokenId ID of the token.\n * @param lpToken Address of the LP token.\n * @return The used weights for the token.\n */\n function usedWeights(uint256 tokenId, address lpToken) external view returns (uint256);\n\n /**\n * @notice Get the last voted timestamp for a token.\n * @param tokenId ID of the token.\n * @return The last voted timestamp for the token.\n */\n function lastVoted(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Check if a token is whitelisted.\n * @param token Address of the token.\n * @return True if the token is whitelisted, false otherwise.\n */\n function isWhitelistedToken(address token) external view returns (bool);\n\n /**\n * @notice Check if an NFT is whitelisted.\n * @param tokenId ID of the token.\n * @return True if the NFT is whitelisted, false otherwise.\n */\n function isWhitelistedNFT(uint256 tokenId) external view returns (bool);\n\n /**\n * @notice Get the address of the ve contract.\n * @return The address of the ve contract.\n */\n function ve() external view returns (address);\n\n /**\n * @notice Get the address of the governor.\n * @return The address of the governor.\n */\n function governor() external view returns (address);\n\n /**\n * @notice Update voting balances in voting rewards contracts.\n * @param _tokenId ID of veNFT whose balance you wish to update.\n */\n function poke(uint256 _tokenId) external;\n\n /**\n * @notice Vote for pools. Votes distributed proportionally based on weights.\n * @dev Can only vote or deposit into a managed NFT once per epoch.\n * Can only vote for gauges that have not been killed.\n * Throws if length of _poolVote and _weights do not match.\n * @param _tokenId ID of veNFT you are voting with.\n * @param _poolVote Array of pools you are voting for.\n * @param _marketVoteSide Array of market vote sides you are voting for.\n * @param _weights Weights of pools.\n */\n function vote(\n uint256 _tokenId,\n address[] calldata _poolVote,\n MarketSide[] calldata _marketVoteSide,\n uint256[] calldata _weights\n ) external;\n\n /**\n * @notice Reset voting state. Required if you wish to make changes to veNFT state.\n * @dev Cannot reset in the same epoch that you voted in.\n * Can vote or deposit into a managed NFT again after reset.\n * @param _tokenId ID of veNFT that you are resetting.\n */\n function reset(uint256 _tokenId) external;\n\n /**\n * @notice Distributes rewards to eligible markets.\n */\n function distributeRewards() external;\n\n /**\n * @notice Claim bribes for a given NFT.\n * @dev Utility to help batch bribe claims.\n * @param _bribes Array of BribeVotingReward contracts to collect from.\n * @param _tokens Array of tokens that are used as bribes.\n * @param _tokenId ID of veNFT that you wish to claim bribes for.\n */\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external;\n\n /**\n * @notice Whitelist (or unwhitelist) token for use in bribes.\n * @dev Throws if not called by governor.\n * @param _token Address of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n function whitelistToken(address _token, bool _bool) external;\n\n /**\n * @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip.\n * @dev Throws if not called by governor.\n * Throws if already whitelisted.\n * @param _tokenId ID of the token.\n * @param _bool Boolean indicating whitelist status.\n */\n function whitelistNFT(uint256 _tokenId, bool _bool) external;\n\n /**\n * @notice Set the LP tokens.\n * @param _lpTokens Array of LP token addresses.\n */\n function setLpTokens(address[] memory _lpTokens) external;\n\n /**\n * @notice Set the Master Price Oracle (MPO) address.\n * @param _mpo Address of the Master Price Oracle.\n */\n function setMpo(address _mpo) external;\n\n /**\n * @notice Set a new governor.\n * @param _governor Address of the new governor.\n */\n function setGovernor(address _governor) external;\n\n /**\n * @notice Add new markets.\n * @param _markets Array of Market structs to be added.\n */\n function addMarkets(Market[] calldata _markets) external;\n\n /**\n * @notice Set reward accumulators for markets.\n * @param _markets Array of market addresses.\n * @param _marketSides Array of market sides.\n * @param _rewardAccumulators Array of reward accumulator addresses.\n */\n function setMarketRewardAccumulators(\n address[] calldata _markets,\n MarketSide[] calldata _marketSides,\n address[] calldata _rewardAccumulators\n ) external;\n\n /**\n * @notice Set bribes for reward accumulators.\n * @param _rewardAccumulators Array of reward accumulator addresses.\n * @param _bribes Array of bribe addresses.\n */\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external;\n\n /**\n * @notice Set the maximum number of votes.\n * @param _maxVotingNum Maximum number of votes allowed.\n */\n function setMaxVotingNum(uint256 _maxVotingNum) external;\n\n /**\n * @notice Toggle the alive status of a reward accumulator.\n * @param _market Address of the market.\n * @param _marketSide Side of the market.\n * @param _isAlive Boolean indicating if the reward accumulator is alive.\n */\n function toggleRewardAccumulatorAlive(address _market, MarketSide _marketSide, bool _isAlive) external;\n\n /**\n * @notice Toggle the alive status of a timelock on distributing rewards.\n * @param _isAlive Boolean indicating if the timelock is alive.\n */\n function toggleDistributionTimelockAlive(bool _isAlive) external;\n\n /**\n * @notice Get the start of the epoch for a given timestamp.\n * @param _timestamp The timestamp to calculate the epoch start for.\n * @return The start of the epoch.\n */\n function epochStart(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the next epoch for a given timestamp.\n * @param _timestamp The timestamp to calculate the next epoch for.\n * @return The next epoch.\n */\n function epochNext(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the start of the voting period for a given timestamp.\n * @param _timestamp The timestamp to calculate the voting start for.\n * @return The start of the voting period.\n */\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the end of the voting period for a given timestamp.\n * @param _timestamp The timestamp to calculate the voting end for.\n * @return The end of the voting period.\n */\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256);\n\n /**\n * @notice Get the number of markets.\n * @return The number of markets.\n */\n function marketsLength() external view returns (uint256);\n\n /**\n * @notice Get all LP reward tokens.\n * @return An array of addresses representing all LP reward tokens.\n */\n function getAllLpRewardTokens() external view returns (address[] memory);\n\n /**\n * @notice Get vote details for a specific token ID and LP asset.\n * @param _tokenId The ID of the token.\n * @param _lpAsset The address of the LP asset.\n * @return A struct containing vote details.\n */\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory);\n}\n" + }, + "contracts/veION/libraries/BalanceLogicLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../interfaces/IveIONStructsEnumsErrorsEvents.sol\";\n\nlibrary BalanceLogicLibrary {\n uint256 internal constant _WEEK = 1 weeks;\n\n /// @notice Calculates the voting power for a given NFT at a specific time.\n /// @dev This function is compatible with the ERC20 `balanceOf` interface for Aragon.\n /// It retrieves the last user point before a specified timestamp and computes the voting power at that time.\n /// @param s_userPointEpoch Mapping of user point epochs for all tokens.\n /// @param s_userPointHistory Mapping of user point history for all tokens.\n /// @param _lpType The type of LP token associated with the NFT.\n /// @param _tokenId The ID of the NFT for which to calculate voting power.\n /// @param _t The epoch time at which to calculate the voting power.\n /// @param _isPermanent A boolean indicating if the lock is permanent.\n /// @return The calculated voting power of the user at the specified time.\n function balanceOfNFTAt(\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\n storage s_userPointHistory,\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\n uint256 _tokenId,\n uint256 _t,\n bool _isPermanent\n ) internal view returns (uint256) {\n uint256 _epoch = getPastUserPointIndex(s_userPointEpoch, s_userPointHistory, _lpType, _tokenId, _t);\n // epoch 0 is an empty point\n if (_epoch == 0) return 0;\n IveIONStructsEnumsErrorsEvents.UserPoint memory lastPoint = s_userPointHistory[_tokenId][_lpType][_epoch];\n if (_isPermanent) {\n return lastPoint.permanent + lastPoint.permanentDelegate;\n } else {\n uint256 reduction = lastPoint.slope * (_t - lastPoint.ts);\n if (reduction > lastPoint.bias) {\n lastPoint.bias = 0;\n } else {\n lastPoint.bias -= reduction;\n }\n return lastPoint.bias;\n }\n }\n\n /// @notice Binary search to get the user point index for a token id at or prior to a given timestamp\n /// @dev If a user point does not exist prior to the timestamp, this will return 0.\n /// @param s_userPointEpoch State of all user point epochs\n /// @param s_userPointHistory State of all user point history\n /// @param _tokenId .\n /// @param _timestamp .\n /// @return User point index\n function getPastUserPointIndex(\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => uint256)) storage s_userPointEpoch,\n mapping(uint256 => mapping(IveIONStructsEnumsErrorsEvents.LpTokenType => IveIONStructsEnumsErrorsEvents.UserPoint[1000000000]))\n storage s_userPointHistory,\n IveIONStructsEnumsErrorsEvents.LpTokenType _lpType,\n uint256 _tokenId,\n uint256 _timestamp\n ) internal view returns (uint256) {\n uint256 _userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (_userEpoch == 0) return 0;\n // First check most recent balance\n if (s_userPointHistory[_tokenId][_lpType][_userEpoch].ts <= _timestamp) return (_userEpoch);\n // Next check implicit zero balance\n if (s_userPointHistory[_tokenId][_lpType][1].ts > _timestamp) return 0;\n uint256 lower = 0;\n uint256 upper = _userEpoch;\n while (upper > lower) {\n uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n IveIONStructsEnumsErrorsEvents.UserPoint storage userPoint = s_userPointHistory[_tokenId][_lpType][center];\n if (userPoint.ts == _timestamp) {\n return center;\n } else if (userPoint.ts < _timestamp) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return lower;\n }\n}\n" + }, + "contracts/veION/libraries/IonicTimeLibrary.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nlibrary IonicTimeLibrary {\n uint256 internal constant _WEEK = 7 days;\n\n /// @dev Returns start of epoch based on current timestamp\n function epochStart(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK);\n }\n }\n\n /// @dev Returns start of next epoch / end of current epoch\n function epochNext(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + _WEEK;\n }\n }\n\n /// @dev Returns start of voting window\n function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + 1 hours;\n }\n }\n\n /// @dev Returns end of voting window / beginning of unrestricted voting window\n function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {\n unchecked {\n return timestamp - (timestamp % _WEEK) + _WEEK - 12 hours;\n }\n }\n}\n" + }, + "contracts/veION/RewardAccumulator.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract RewardAccumulator is Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n function initialize() external initializer {\n __Ownable2Step_init();\n }\n\n function approve(address _token, address _spender) external onlyOwner {\n IERC20(_token).safeIncreaseAllowance(_spender, type(uint256).max);\n }\n}\n" + }, + "contracts/veION/stake/IStakeStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\n/**\n * @title IStakeStrategy\n * @notice Interface for the VeloIonModeStakingModeReward contract.\n */\ninterface IStakeStrategy {\n /// @notice Emitted when the contract is initialized\n event Initialized(\n address indexed escrow,\n address indexed stakingToken,\n address indexed stakingContract,\n address stakingWalletImplementation\n );\n\n /// @notice Emitted when tokens are staked\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\n\n /// @notice Emitted when rewards are claimed\n event Claimed(address indexed from, address indexed veloWallet);\n\n /// @notice Emitted when tokens are withdrawn\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\n\n /// @notice Emitted when staking wallet is transferred\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\n\n /// @notice Emitted when escrow is set\n event EscrowSet(address indexed newEscrow);\n\n /// @notice Emitted when staking token is set\n event StakingTokenSet(address indexed newStakingToken);\n\n /// @notice Emitted when staking contract is set\n event StakingContractSet(address indexed newStakingContract);\n\n /// @notice Emitted when upgradeable beacon is set\n event UpgradeableBeaconSet(address indexed newBeacon);\n\n /**\n * @notice Stakes a specified amount of tokens from a given address.\n * @param _from The address from which tokens will be staked.\n * @param _amount The amount of tokens to stake.\n * @param _data Additional data that might be needed for staking.\n */\n function stake(address _from, uint256 _amount, bytes memory _data) external;\n\n /**\n * @notice Claims rewards for a given address.\n * @param _from The address for which to claim rewards.\n */\n function claim(address _from) external;\n\n /**\n * @notice Withdraws a specified amount of tokens for a given address.\n * @param _owner The address from which tokens will be withdrawn.\n * @param _amount The amount of tokens to withdraw.\n */\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\n\n /**\n * @notice Returns the current reward rate for the staking strategy.\n * @return The reward rate as a uint256.\n */\n function rewardRate() external view returns (uint256);\n\n /**\n * @notice Returns the period finish time for the staking strategy.\n * @return The period finish time as a uint256.\n */\n function periodFinish() external view returns (uint256);\n\n /**\n * @notice Returns the balance of a specific address.\n * @param account The address to query the balance of.\n * @return The balance as a uint256.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Returns the total supply of staked tokens.\n * @return The total supply as a uint256.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Returns the address of the reward token for the staking strategy.\n * @return The address of the reward token.\n */\n function rewardToken() external view returns (address);\n\n /**\n * @notice Returns the address of the staking contract.\n * @return The address of the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @notice Returns the address of the staking token.\n * @return The address of the staking token.\n */\n function stakingToken() external view returns (address);\n\n /**\n * @notice Returns the staking wallet address for a specific user.\n * @param user The address of the user.\n * @return The address of the user's staking wallet.\n */\n function userStakingWallet(address user) external view returns (address);\n\n /**\n * @notice Transfers the staking wallet from one user to another.\n * @param from The current owner of the staking wallet.\n * @param to The new owner of the staking wallet.\n */\n function transferStakingWallet(address from, address to, uint256 _amount) external;\n\n /**\n * @notice Sets the escrow address.\n * @param _escrow The address of the new escrow.\n */\n function setEscrow(address _escrow) external;\n\n /**\n * @notice Sets the staking token address.\n * @param _stakingToken The address of the new staking token.\n */\n function setStakingToken(address _stakingToken) external;\n\n /**\n * @notice Sets the staking contract address.\n * @param _stakingContract The address of the new staking contract.\n */\n function setStakingContract(address _stakingContract) external;\n\n /**\n * @notice Sets the address of the beacon.\n * @param _beacon The address of the new beacon contract.\n */\n function setUpgradeableBeacon(address _beacon) external;\n}\n" + }, + "contracts/veION/stake/IStakeWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IStakeWallet {\n /// @notice Emitted when tokens are staked\n event Staked(uint256 amount);\n\n /// @notice Emitted when rewards are claimed\n event Claimed(address indexed from, uint256 rewardAmount);\n\n /// @notice Emitted when tokens are withdrawn\n event Withdrawn(address indexed withdrawTo, uint256 amount);\n\n /**\n * @notice Stakes a specified amount of tokens according to the strategy.\n * @param amount The amount of tokens to stake.\n * @param data Additional data required for the staking strategy.\n */\n function stake(address from, uint256 amount, bytes memory data) external;\n\n /**\n * @notice Claims rewards for the caller.\n */\n function claim(address from) external;\n\n /**\n * @notice Withdraws a specified amount of staked tokens.\n * @param withdrawTo The address to withdraw tokens to.\n * @param amount The amount of tokens to withdraw.\n */\n function withdraw(address withdrawTo, uint256 amount) external;\n}\n" + }, + "contracts/veION/stake/velo/IVeloIonModeStaking.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\ninterface IVeloIonModeStaking {\n event Deposit(address indexed from, address indexed to, uint256 amount);\n event Withdraw(address indexed from, uint256 amount);\n event NotifyReward(address indexed from, uint256 amount);\n event ClaimFees(uint256 claimed0, uint256 claimed1);\n event ClaimRewards(address indexed from, uint256 amount);\n\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\n function stakingToken() external view returns (address);\n\n /// @notice Address of the token (VELO v2) rewarded to stakers\n function rewardToken() external view returns (address);\n\n /// @notice Address of the Converter contract linked to the gauge\n function feeConverter() external view returns (address);\n\n /// @notice Address of the staking rewards factory that created this gauge\n function factory() external view returns (address);\n\n /// @notice Timestamp end of current rewards period\n function periodFinish() external view returns (uint256);\n\n /// @notice Current reward rate of rewardToken to distribute per second\n function rewardRate() external view returns (uint256);\n\n /// @notice Most recent timestamp contract has updated state\n function lastUpdateTime() external view returns (uint256);\n\n /// @notice Most recent stored value of rewardPerToken\n function rewardPerTokenStored() external view returns (uint256);\n\n /// @notice Amount of stakingToken deposited for rewards\n function totalSupply() external view returns (uint256);\n\n /// @notice Get the amount of stakingToken deposited by an account\n function balanceOf(address) external view returns (uint256);\n\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\n function userRewardPerTokenPaid(address) external view returns (uint256);\n\n /// @notice Cached amount of rewardToken earned for an account\n function rewards(address) external view returns (uint256);\n\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\n function rewardRateByEpoch(uint256) external view returns (uint256);\n\n /// @notice Get the current reward rate per unit of stakingToken deposited\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\n\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\n function lastTimeRewardApplicable() external view returns (uint256 _time);\n\n /// @notice Returns accrued balance to date from last claim / first deposit.\n function earned(address _account) external view returns (uint256 _earned);\n\n /// @notice Total amount of rewardToken to distribute for the current rewards period\n function left() external view returns (uint256 _left);\n\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\n /// @return _claimed0 Amount of Fees claimed in token0\n /// @return _claimed1 Amount of Fees claimed in token1\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\n\n /// @notice Retrieve rewards for an address.\n /// @dev Throws if not called by same address or voter.\n /// @param _account .\n function getReward(address _account) external;\n\n /// @notice Deposit LP tokens into gauge for msg.sender\n /// @param _amount .\n function deposit(uint256 _amount) external;\n\n /// @notice Deposit LP tokens into gauge for any user\n /// @param _amount .\n /// @param _recipient Recipient to give balance to\n function deposit(uint256 _amount, address _recipient) external;\n\n /// @notice Withdraw LP tokens for user\n /// @param _amount .\n function withdraw(uint256 _amount) external;\n\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\n /// If not 18 decimals, rewardRate may have rounding issues.\n function notifyRewardMatch(uint256 amount) external;\n\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\n /// If not 18 decimals, rewardRate may have rounding issues.\n function notifyRewardAmount(uint256 amount) external;\n}\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"../IStakeStrategy.sol\";\nimport \"./VeloAeroStakingWallet.sol\";\nimport \"./IVeloIonModeStaking.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\nimport { UpgradeableBeacon } from \"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\";\n\n/**\n * @title VeloAeroStakingStrategy\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract VeloAeroStakingStrategy is IStakeStrategy, Ownable2StepUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Address of the escrow responsible for managing staking operations\n address public escrow;\n /// @notice Address of the token being staked\n address public stakingToken;\n /// @notice Address of the contract where staking operations are executed\n address public stakingContract;\n /// @notice Address of beacon contract that manages wallet proxies\n UpgradeableBeacon public veloAeroBeacon;\n /// @notice Mapping of user addresses to their respective staking wallet addresses\n mapping(address => address) public userStakingWallet;\n\n /// @dev Modifier to restrict function access to only the escrow address\n modifier onlyEscrow() {\n require(msg.sender == escrow, \"Not authorized: Only escrow can call this function\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the staking strategy contract with necessary parameters\n * @dev This function can only be called once due to the initializer modifier\n * @param _escrow The address of the escrow responsible for staking operations\n * @param _stakingToken The address of the token to be staked\n * @param _stakingContract The address of the contract handling staking\n * @param _stakingWalletImplementation The address of the staking wallet implementation\n */\n function initialize(\n address _escrow,\n address _stakingToken,\n address _stakingContract,\n address _stakingWalletImplementation\n ) public initializer {\n __Ownable2Step_init();\n escrow = _escrow;\n stakingToken = _stakingToken;\n stakingContract = _stakingContract;\n\n veloAeroBeacon = new UpgradeableBeacon(_stakingWalletImplementation);\n veloAeroBeacon.transferOwnership(msg.sender);\n\n emit Initialized(_escrow, _stakingToken, _stakingContract, _stakingWalletImplementation);\n }\n\n /// @inheritdoc IStakeStrategy\n function stake(address _from, uint256 _amount, bytes memory _data) external override onlyEscrow {\n IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), _amount);\n\n address veloWallet = userStakingWallet[_from];\n if (veloWallet == address(0)) {\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\n veloWallet = address(newWallet);\n VeloAeroStakingWallet(veloWallet).initialize(IStakeStrategy(address(this)));\n userStakingWallet[_from] = veloWallet;\n }\n\n IERC20(stakingToken).approve(veloWallet, _amount);\n VeloAeroStakingWallet(veloWallet).stake(_from, _amount, _data);\n emit Staked(_from, _amount, veloWallet);\n }\n\n /// @inheritdoc IStakeStrategy\n function claim(address _from) external onlyEscrow {\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_from]);\n veloWallet.claim(_from);\n emit Claimed(_from, address(veloWallet));\n }\n\n /// @inheritdoc IStakeStrategy\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external onlyEscrow {\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_owner]);\n veloWallet.withdraw(_withdrawTo, _amount);\n emit Withdrawn(_owner, _withdrawTo, _amount);\n }\n\n /// @inheritdoc IStakeStrategy\n function transferStakingWallet(address _from, address _to, uint256 _amount) external onlyEscrow {\n address fromWallet = userStakingWallet[_from];\n address toWallet = userStakingWallet[_to];\n\n if (toWallet == address(0)) {\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \"\");\n toWallet = address(newWallet);\n VeloAeroStakingWallet(toWallet).initialize(IStakeStrategy(address(this)));\n userStakingWallet[_to] = toWallet;\n }\n\n VeloAeroStakingWallet(fromWallet).withdraw(address(this), _amount);\n IERC20(stakingToken).approve(address(toWallet), _amount);\n VeloAeroStakingWallet(toWallet).stake(_to, _amount, \"\");\n emit StakingWalletTransferred(_from, _to, _amount);\n }\n\n /// @inheritdoc IStakeStrategy\n function rewardRate() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).rewardRate();\n }\n\n /// @inheritdoc IStakeStrategy\n function periodFinish() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).periodFinish();\n }\n\n /// @inheritdoc IStakeStrategy\n function balanceOf(address account) public view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).balanceOf(account);\n }\n\n /// @inheritdoc IStakeStrategy\n function totalSupply() external view override returns (uint256) {\n return IVeloIonModeStaking(stakingContract).totalSupply();\n }\n\n /// @inheritdoc IStakeStrategy\n function rewardToken() public view returns (address) {\n return IVeloIonModeStaking(stakingContract).rewardToken();\n }\n\n /// @inheritdoc IStakeStrategy\n function setEscrow(address _escrow) external onlyOwner {\n require(_escrow != address(0), \"Invalid address\");\n escrow = _escrow;\n emit EscrowSet(_escrow);\n }\n\n /// @inheritdoc IStakeStrategy\n function setStakingToken(address _stakingToken) external onlyOwner {\n require(_stakingToken != address(0), \"Invalid address\");\n stakingToken = _stakingToken;\n emit StakingTokenSet(_stakingToken);\n }\n\n /// @inheritdoc IStakeStrategy\n function setStakingContract(address _stakingContract) external onlyOwner {\n require(_stakingContract != address(0), \"Invalid address\");\n stakingContract = _stakingContract;\n emit StakingContractSet(_stakingContract);\n }\n\n /// @inheritdoc IStakeStrategy\n function setUpgradeableBeacon(address _beacon) external onlyOwner {\n require(_beacon != address(0), \"Invalid address\");\n veloAeroBeacon = UpgradeableBeacon(_beacon);\n emit UpgradeableBeaconSet(_beacon);\n }\n}\n" + }, + "contracts/veION/stake/velo/VeloAeroStakingWallet.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IStakeWallet } from \"../IStakeWallet.sol\";\nimport { IStakeStrategy } from \"../IStakeStrategy.sol\";\nimport { IVeloIonModeStaking } from \"./IVeloIonModeStaking.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport { Initializable } from \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title VeloAeroStakingWallet\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\n * @author Jourdan Dunkley \n */\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n IStakeStrategy public stakeStrategy;\n\n /// @dev Modifier to restrict function access to only the stake strategy contract\n modifier onlyStakeStrategy() {\n require(msg.sender == address(stakeStrategy), \"Not authorized: Only stake strategy can call this function\");\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the contract with a staking strategy\n * @dev Can only be called once due to initializer modifier\n * @param _stakeStrategy The address of the staking strategy contract\n */\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\n stakeStrategy = _stakeStrategy;\n }\n\n /// @inheritdoc IStakeWallet\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\n stakingToken.approve(address(stakingContract), _amount);\n stakingContract.deposit(_amount);\n emit Staked(_amount);\n }\n\n /// @inheritdoc IStakeWallet\n function claim(address _from) external onlyStakeStrategy {\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingContract.getReward(address(this));\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\n emit Claimed(_from, rewardAmount);\n }\n\n /// @inheritdoc IStakeWallet\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\n\n stakingContract.withdraw(_amount);\n stakingToken.safeTransfer(_withdrawTo, _amount);\n emit Withdrawn(_withdrawTo, _amount);\n }\n}\n" + }, + "contracts/veION/veION.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IveIONCore, IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veION is Ownable2StepUpgradeable, ERC721Upgradeable, ReentrancyGuardUpgradeable, veIONStorage, IveIONCore {\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the veION contract with the given AddressesProvider.\n * @dev This function is called only once during the contract deployment.\n * It initializes the Ownable, ERC721, and ReentrancyGuard modules.\n * @param _ap The AddressesProvider contract used for address management.\n */\n function initialize(IAddressesProvider _ap) public initializer {\n __Ownable2Step_init();\n __ERC721_init(\"veION\", \"veION\");\n __ReentrancyGuard_init();\n ap = _ap;\n emit Initialized(address(_ap));\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONCore\n function createLockFor(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) external override nonReentrant returns (uint256) {\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _to);\n }\n\n /// @inheritdoc IveIONCore\n function createLock(\n address[] calldata _tokenAddress,\n uint256[] calldata _tokenAmount,\n uint256[] calldata _duration,\n bool[] memory _stakeUnderlying\n ) external override nonReentrant returns (uint256) {\n return _createLock(_tokenAddress, _tokenAmount, _duration, _stakeUnderlying, _msgSender());\n }\n\n /// @inheritdoc IveIONCore\n function increaseAmount(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n bool _stakeUnderlying\n ) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_tokenAmount == 0) revert ZeroAmount();\n if (oldLocked.amount == 0) revert NoLockFound();\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\n\n if (oldLocked.isPermanent) s_permanentLockBalance[_lpType] += _tokenAmount;\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n _tokenAmount,\n 0,\n _stakeUnderlying,\n oldLocked,\n DepositType.INCREASE_LOCK_AMOUNT,\n _lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function lockAdditionalAsset(\n address _tokenAddress,\n uint256 _tokenAmount,\n uint256 _tokenId,\n uint256 _duration,\n bool _stakeUnderlying\n ) external nonReentrant {\n LpTokenType lpType = s_lpType[_tokenAddress];\n LockedBalance storage lockedBalance = s_locked[_tokenId][lpType];\n uint256 unlockTime = ((block.timestamp + _duration) / _WEEK) * _WEEK;\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_tokenAmount == 0) revert ZeroAmount();\n if (s_voted[_tokenId]) revert AlreadyVoted();\n if (!s_assetsLocked[_tokenId].add(_tokenAddress)) revert DuplicateAsset();\n if (_tokenAmount < s_minimumLockAmount[lpType]) revert MinimumNotMet();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n if (_duration < s_minimumLockDuration) revert LockDurationTooShort();\n\n if (lockedBalance.isPermanent) s_permanentLockBalance[lpType] += _tokenAmount;\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n _tokenAmount,\n unlockTime,\n _stakeUnderlying,\n lockedBalance,\n DepositType.LOCK_ADDITIONAL,\n lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function increaseUnlockTime(address _tokenAddress, uint256 _tokenId, uint256 _lockDuration) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n uint256 unlockTime = ((block.timestamp + _lockDuration) / _WEEK) * _WEEK; // Locktime is rounded down to weeks\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (oldLocked.isPermanent) revert PermanentLock();\n if (oldLocked.end <= block.timestamp) revert LockExpired();\n if (oldLocked.amount <= 0) revert NoLockFound();\n if (unlockTime <= oldLocked.end) revert LockDurationNotInFuture();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n\n _depositFor(\n _tokenAddress,\n _tokenId,\n 0,\n unlockTime,\n false,\n oldLocked,\n DepositType.INCREASE_UNLOCK_TIME,\n _lpType,\n _msgSender()\n );\n }\n\n /// @inheritdoc IveIONCore\n function delegate(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) external nonReentrant {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender()) revert NotOwner();\n if (amount > fromLocked.amount) revert AmountTooBig();\n if (!fromLocked.isPermanent) revert NotPermanentLock();\n if (!toLocked.isPermanent) revert NotPermanentLock();\n if (s_delegatorsBlocked[toTokenId][lpToken]) revert NotAcceptingDelegators();\n\n fromLocked.amount -= amount;\n toLocked.delegateAmount += amount;\n\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].add(toTokenId);\n s_delegators[toTokenId][lpType].add(fromTokenId);\n }\n\n s_delegations[fromTokenId][toTokenId][lpType] += amount;\n\n s_locked[fromTokenId][lpType] = fromLocked;\n s_locked[toTokenId][lpType] = toLocked;\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit Delegated(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /**\n * @dev Internal function to remove a delegation between two veNFTs.\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\n * @param toTokenId ID of the veNFT to which delegation is being removed.\n * @param lpToken Address of the LP token associated with the delegation.\n * @param amount Amount of delegation to remove.\n */\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\n\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\n ? s_delegations[fromTokenId][toTokenId][lpType]\n : amount;\n\n toLocked.delegateAmount -= amount;\n fromLocked.amount += amount;\n\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\n s_delegators[toTokenId][lpType].remove(fromTokenId);\n }\n\n s_locked[toTokenId][lpType] = toLocked;\n s_locked[fromTokenId][lpType] = fromLocked;\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /// @inheritdoc IveIONCore\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) public nonReentrant {\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 toTokenIdsLength = toTokenIds.length;\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONCore\n function removeDelegators(\n uint256[] memory fromTokenIds,\n uint256 toTokenId,\n address lpToken,\n uint256[] memory amounts\n ) external nonReentrant {\n if (fromTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 fromTokenIdsLength = fromTokenIds.length;\n for (uint256 i = 0; i < fromTokenIdsLength; i++) {\n _removeDelegation(fromTokenIds[i], toTokenId, lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONCore\n function lockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (_newLocked.isPermanent) revert PermanentLock();\n if (_newLocked.end <= block.timestamp) revert LockExpired();\n if (_newLocked.amount <= 0) revert NoLockFound();\n\n s_permanentLockBalance[_lpType] += _newLocked.amount;\n _newLocked.end = 0;\n _newLocked.isPermanent = true;\n _newLocked.boost = _calculateBoost(_MAXTIME);\n\n s_locked[_tokenId][_lpType] = _newLocked;\n _checkpoint(_tokenId, _newLocked, _lpType);\n\n emit PermanentLockCreated(_tokenAddress, _tokenId, _newLocked.amount);\n }\n\n /// @inheritdoc IveIONCore\n function unlockPermanent(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory _newLocked = s_locked[_tokenId][_lpType];\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (!_newLocked.isPermanent) revert NotPermanentLock();\n if (s_delegatees[_tokenId][_lpType].length() != 0) revert TokenHasDelegatees();\n if (s_delegators[_tokenId][_lpType].length() != 0) revert TokenHasDelegators();\n\n s_permanentLockBalance[_lpType] -= _newLocked.amount;\n _newLocked.end = ((block.timestamp + _MAXTIME) / _WEEK) * _WEEK;\n _newLocked.isPermanent = false;\n\n s_locked[_tokenId][_lpType] = _newLocked;\n _checkpoint(_tokenId, _newLocked, _lpType);\n\n emit PermanentLockRemoved(_tokenAddress, _tokenId, _newLocked.amount);\n }\n\n /**\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\n * @param tokenId Token ID to burn.\n */\n function _burn(uint256 tokenId) internal override {\n super._burn(tokenId);\n }\n\n /**\n * @notice Hook that is called before any token transfer. This includes minting\n * and burning. It updates the ownership mappings and handles delegation and\n * staking logic when transferring tokens between addresses.\n *\n * @param from The address which previously owned the token.\n * @param to The address that will receive the token.\n * @param tokenId The ID of the token being transferred.\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\n\n if (from != address(0) && to != address(0)) {\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType _lpType = s_lpType[asset];\n\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\n uint256[] memory amounts = new uint256[](delegatees.length);\n uint256 delegateesLength = delegatees.length;\n for (uint256 j = 0; j < delegateesLength; j++) {\n amounts[j] = type(uint256).max;\n }\n\n if (delegateesLength != 0) {\n removeDelegatees(tokenId, delegatees, asset, amounts);\n }\n\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\n if (amountStaked != 0) {\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\n }\n\n LockedBalance memory lock = s_locked[tokenId][_lpType];\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\n s_userCumulativeAssetValues[to][asset] += lock.amount;\n }\n }\n }\n\n /// @inheritdoc IveIONCore\n function voting(uint256 _tokenId, bool _voting) external {\n if (_msgSender() != s_voter) revert NotVoter();\n s_voted[_tokenId] = _voting;\n emit Voted(_tokenId, _voting);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n struct DepositVars {\n uint256 supplyBefore;\n uint256 totalLockTime;\n LockedBalance newLocked;\n address from;\n }\n\n /**\n * @notice Deposits tokens for a specific veNFT, updating its locked balance and boost.\n * @dev This function handles the deposit logic for veNFTs, including updating the locked balance,\n * calculating the boost based on the lock duration, and transferring tokens.\n * @param _tokenAddress The address of the token to deposit.\n * @param _tokenId The ID of the veNFT to deposit tokens for.\n * @param _tokenAmount The amount of tokens to deposit.\n * @param _unlockTime The time at which the lock will expire.\n * @param _stakeUnderlying A boolean indicating whether to stake the underlying tokens.\n * @param _oldLocked The previous locked balance of the veNFT.\n * @param _depositType The type of deposit being made.\n * @param _lpType The LP token type associated with the deposit.\n * @param _to The address to which the veNFT is assigned.\n */\n function _depositFor(\n address _tokenAddress,\n uint256 _tokenId,\n uint256 _tokenAmount,\n uint256 _unlockTime,\n bool _stakeUnderlying,\n LockedBalance memory _oldLocked,\n DepositType _depositType,\n LpTokenType _lpType,\n address _to\n ) internal {\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\n\n DepositVars memory vars;\n vars.supplyBefore = s_supply[_lpType];\n s_supply[_lpType] = vars.supplyBefore + _tokenAmount;\n\n (\n vars.newLocked.tokenAddress,\n vars.newLocked.amount,\n vars.newLocked.start,\n vars.newLocked.end,\n vars.newLocked.isPermanent,\n vars.newLocked.boost\n ) = (\n _oldLocked.tokenAddress,\n _oldLocked.amount,\n _oldLocked.start,\n _oldLocked.end,\n _oldLocked.isPermanent,\n _oldLocked.boost\n );\n\n vars.newLocked.tokenAddress = _tokenAddress;\n vars.newLocked.amount += _tokenAmount;\n if (_unlockTime != 0) {\n if (vars.newLocked.start == 0) vars.newLocked.start = block.timestamp;\n vars.newLocked.end = _unlockTime;\n vars.totalLockTime = vars.newLocked.end - vars.newLocked.start;\n vars.newLocked.boost = _calculateBoost(vars.totalLockTime);\n }\n s_locked[_tokenId][_lpType] = vars.newLocked;\n\n _checkpoint(_tokenId, vars.newLocked, _lpType);\n\n vars.from = _msgSender();\n if (_tokenAmount != 0) {\n s_userCumulativeAssetValues[ownerOf(_tokenId)][_tokenAddress] += _tokenAmount;\n IERC20(_tokenAddress).safeTransferFrom(vars.from, address(this), _tokenAmount);\n (IStakeStrategy _stakeStrategy, bytes memory _stakeData) = _getStakeStrategy(_lpType);\n if (address(_stakeStrategy) != address(0) && _stakeUnderlying) {\n _handleTokenStake(_to, _tokenId, _tokenAddress, _tokenAmount, _stakeStrategy, _stakeData);\n }\n }\n\n emit Deposit(_to, _tokenId, _depositType, _tokenAmount, vars.newLocked.end, block.timestamp);\n emit Supply(vars.supplyBefore, s_supply[_lpType]);\n }\n\n /**\n * @notice Handles the staking of tokens using a specified staking strategy.\n * @param _to The address to which the stake is attributed.\n * @param _tokenId The ID of the token being staked.\n * @param _tokenAddress The address of the token being staked.\n * @param _tokenAmount The amount of tokens to stake.\n * @param _stakeStrategy The staking strategy to use.\n * @param _stakeData Additional data required for staking.\n */\n function _handleTokenStake(\n address _to,\n uint256 _tokenId,\n address _tokenAddress,\n uint256 _tokenAmount,\n IStakeStrategy _stakeStrategy,\n bytes memory _stakeData\n ) internal {\n IERC20(_tokenAddress).approve(address(_stakeStrategy), _tokenAmount);\n _stakeStrategy.stake(_to, _tokenAmount, _stakeData);\n s_underlyingStake[_tokenId][_tokenAddress] += _tokenAmount;\n }\n\n /**\n * @notice Updates the user point history and epoch for a given token and LP token type.\n * @param _tokenId The ID of the token.\n * @param _newLocked The new locked balance information.\n * @param _lpType The LP token type.\n */\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\n UserPoint memory uNew;\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\n\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\n uNew.slope = _newLocked.amount / _MAXTIME;\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\n }\n\n uNew.ts = block.timestamp;\n uNew.blk = block.number;\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n } else {\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n }\n }\n\n /**\n * @notice Creates a lock for multiple tokens with specified durations and staking options.\n * @param _tokenAddress Array of token addresses to lock.\n * @param _tokenAmount Array of token amounts to lock.\n * @param _duration Array of durations for each lock.\n * @param _stakeUnderlying Array of booleans indicating whether to stake the underlying tokens.\n * @param _to The address to which the lock is attributed.\n * @return The ID of the newly created lock.\n */\n function _createLock(\n address[] memory _tokenAddress,\n uint256[] memory _tokenAmount,\n uint256[] memory _duration,\n bool[] memory _stakeUnderlying,\n address _to\n ) internal returns (uint256) {\n uint256 _tokenId = ++s_tokenId;\n uint256 _length = _tokenAddress.length;\n _safeMint(_to, _tokenId);\n\n if (\n _tokenAddress.length != _tokenAmount.length ||\n _tokenAmount.length != _duration.length ||\n _duration.length != _stakeUnderlying.length\n ) {\n revert ArrayMismatch();\n }\n\n for (uint256 i = 0; i < _length; i++) {\n LpTokenType _lpType = s_lpType[_tokenAddress[i]];\n uint256 unlockTime = ((block.timestamp + _duration[i]) / _WEEK) * _WEEK;\n\n if (!s_assetsLocked[_tokenId].add(_tokenAddress[i])) revert DuplicateAsset();\n if (_tokenAmount[i] == 0) revert ZeroAmount();\n if (_duration[i] < s_minimumLockDuration) revert LockDurationTooShort();\n if (unlockTime > block.timestamp + _MAXTIME) revert LockDurationTooLong();\n if (_tokenAmount[i] < s_minimumLockAmount[_lpType]) revert MinimumNotMet();\n\n _depositFor(\n _tokenAddress[i],\n _tokenId,\n _tokenAmount[i],\n unlockTime,\n _stakeUnderlying[i],\n s_locked[_tokenId][_lpType],\n DepositType.CREATE_LOCK_TYPE,\n _lpType,\n _to\n );\n }\n return _tokenId;\n }\n\n /**\n * @notice Calculates the boost for a given lock duration.\n * @param _duration The duration of the lock.\n * @return The calculated boost value.\n */\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\n uint256 minDuration = s_minimumLockDuration;\n uint256 maxDuration = _MAXTIME;\n uint256 minBoost = 1e18;\n uint256 maxBoost = 2e18;\n\n if (_duration <= minDuration) {\n return minBoost;\n } else if (_duration >= maxDuration) {\n return maxBoost;\n } else {\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\n }\n }\n\n /**\n * @notice Retrieves the staking strategy and data for a given LP token type.\n * @param _lpType The LP token type.\n * @return _stakeStrategy The staking strategy for the LP token type.\n * @return _stakeData The staking data for the LP token type.\n */\n function _getStakeStrategy(\n LpTokenType _lpType\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\n return (strategy, \"\");\n }\n\n /// @inheritdoc IveIONCore\n function setExtensions(address _veIONFirstExtension, address _veIONSecondExtension) external onlyOwner {\n require(_veIONFirstExtension != address(0), \"Invalid First Extension Address\");\n require(_veIONSecondExtension != address(0), \"Invalid Second Extension Address\");\n require(_veIONFirstExtension != _veIONSecondExtension, \"Submitted Identical Addresses\");\n veIONFirstExtension = _veIONFirstExtension;\n veIONSecondExtension = _veIONSecondExtension;\n emit ExtensionsSet(_veIONFirstExtension, _veIONSecondExtension);\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external {\n address impl = veIONFirstExtension;\n require(impl != address(0), \"Implementation not set\");\n\n assembly {\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\n\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/veION/veIONFirstExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\nimport { IveIONFirstExtension } from \"./interfaces/IveIONFirstExtension.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract First Extensions\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veIONFirstExtension is\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ReentrancyGuardUpgradeable,\n veIONStorage,\n IveIONFirstExtension\n{\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONFirstExtension\n function withdraw(address _tokenAddress, uint256 _tokenId) external nonReentrant {\n address sender = _msgSender();\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_tokenId][_lpType];\n\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n if (s_voted[_tokenId]) revert AlreadyVoted();\n if (oldLocked.isPermanent) revert PermanentLock();\n if (!s_whitelistedToken[_tokenAddress]) revert TokenNotWhitelisted();\n if (oldLocked.amount == 0 || !s_assetsLocked[_tokenId].contains(_tokenAddress)) revert NoLockFound();\n\n uint256 value = oldLocked.amount;\n s_userCumulativeAssetValues[sender][_tokenAddress] -= value;\n uint256 fee = 0;\n\n if (block.timestamp < oldLocked.end) {\n uint256 daysLocked = ((oldLocked.end - oldLocked.start) * 1e18) / 1 days;\n uint256 daysLeft = ((oldLocked.end - block.timestamp) * 1e18) / 1 days;\n uint256 timeFactor = (daysLeft * 1e18) / daysLocked;\n uint256 veLPLocked = s_supply[_lpType];\n uint256 LPInCirculation = IERC20(_tokenAddress).totalSupply();\n uint256 ratioFactor = 1e18 - (veLPLocked * 1e18) / LPInCirculation;\n fee = (timeFactor * ratioFactor * oldLocked.boost) / 1e36;\n if (fee > s_maxEarlyWithdrawFee) fee = s_maxEarlyWithdrawFee;\n fee = (value * fee) / 1e18;\n value -= fee;\n\n uint256 feeToDistribute = (fee * 75) / 100;\n uint256 feeToProtocol = fee - feeToDistribute;\n s_protocolFees[_lpType] += feeToProtocol;\n s_distributedFees[_lpType] += feeToDistribute;\n }\n\n s_locked[_tokenId][_lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\n s_assetsLocked[_tokenId].remove(_tokenAddress);\n uint256 supplyBefore = s_supply[_lpType];\n\n uint256 amountStaked = s_underlyingStake[_tokenId][_tokenAddress];\n if (amountStaked != 0) {\n (IStakeStrategy _stakeStrategy, ) = _getStakeStrategy(_lpType);\n if (address(_stakeStrategy) != address(0)) {\n _handleTokenWithdrawStake(sender, address(this), _tokenId, _tokenAddress, amountStaked, _stakeStrategy);\n }\n }\n\n s_supply[_lpType] = supplyBefore - oldLocked.amount;\n _checkpoint(_tokenId, LockedBalance(address(0), 0, 0, 0, 0, false, 0), _lpType);\n\n // Check if all LP types for this token have zero balance\n bool shouldBurn = true;\n address[] memory lockedAssets = s_assetsLocked[_tokenId].values();\n uint256 lockedAssetsLength = lockedAssets.length;\n for (uint256 i = 0; i < lockedAssetsLength; i++) {\n LpTokenType assetLpType = s_lpType[lockedAssets[i]];\n if (s_locked[_tokenId][assetLpType].amount > 0) {\n shouldBurn = false;\n break;\n }\n }\n\n if (shouldBurn) _burn(_tokenId);\n\n IERC20(_tokenAddress).safeTransfer(sender, value);\n emit Withdraw(sender, _tokenId, value, block.timestamp);\n emit Supply(supplyBefore, supplyBefore - oldLocked.amount);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function merge(uint256 _from, uint256 _to) external nonReentrant {\n if (_from == _to) revert SameNFT();\n if (s_voted[_from] || s_voted[_to]) revert AlreadyVoted();\n if (ownerOf(_from) != _msgSender()) revert NotOwner();\n if (ownerOf(_to) != _msgSender()) revert NotOwner();\n\n address[] memory assetsLocked = s_assetsLocked[_from].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType lpType = s_lpType[asset];\n\n LockedBalance memory oldLockedTo = s_locked[_to][lpType];\n LockedBalance memory oldLockedFrom = s_locked[_from][lpType];\n\n if (oldLockedTo.end != 0 && oldLockedTo.end <= block.timestamp) revert LockExpired();\n if (oldLockedFrom.end != 0 && oldLockedFrom.end <= block.timestamp) revert LockExpired();\n if (oldLockedFrom.isPermanent) revert PermanentLock();\n if (oldLockedTo.isPermanent) revert PermanentLock();\n\n LockedBalance memory newLockedTo;\n\n newLockedTo.tokenAddress = asset;\n newLockedTo.amount = oldLockedTo.amount + oldLockedFrom.amount;\n newLockedTo.start = oldLockedTo.start < oldLockedFrom.start && oldLockedTo.start != 0\n ? oldLockedTo.start\n : oldLockedFrom.start;\n newLockedTo.end = oldLockedTo.end > oldLockedFrom.end ? oldLockedTo.end : oldLockedFrom.end;\n newLockedTo.boost = _calculateBoost(newLockedTo.end - newLockedTo.start);\n\n s_locked[_from][lpType] = LockedBalance(address(0), 0, 0, 0, 0, false, 0);\n _checkpoint(_from, LockedBalance(address(0), 0, 0, 0, 0, false, 0), lpType);\n s_locked[_to][lpType] = newLockedTo;\n _checkpoint(_to, newLockedTo, lpType);\n\n s_assetsLocked[_from].remove(asset);\n if (!s_assetsLocked[_to].contains(asset)) {\n s_assetsLocked[_to].add(asset);\n }\n\n if (s_underlyingStake[_from][asset] != 0) {\n s_underlyingStake[_to][asset] += s_underlyingStake[_from][asset];\n s_underlyingStake[_from][asset] = 0;\n }\n }\n _burn(_from);\n emit MergeCompleted(_from, _to, assetsLocked, assetsLocked.length);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function split(\n address _tokenAddress,\n uint256 _from,\n uint256 _splitAmount\n ) external nonReentrant returns (uint256 _tokenId1, uint256 _tokenId2) {\n address ownerFrom = _ownerOf(_from);\n LpTokenType _lpType = s_lpType[_tokenAddress];\n LockedBalance memory oldLocked = s_locked[_from][_lpType];\n uint256 minimumLockAmount = s_minimumLockAmount[_lpType];\n\n if (s_voted[_from]) revert AlreadyVoted();\n if (!s_canSplit[ownerFrom] && !s_canSplit[address(0)]) revert SplitNotAllowed();\n if (ownerFrom != _msgSender()) revert NotOwner();\n if (oldLocked.end <= block.timestamp && !oldLocked.isPermanent) revert LockExpired();\n if (_splitAmount >= oldLocked.amount) revert AmountTooBig();\n if (_splitAmount < minimumLockAmount) revert SplitTooSmall();\n if (oldLocked.amount - _splitAmount < minimumLockAmount) revert NotEnoughRemainingAfterSplit();\n\n LockedBalance memory oldLockedTemp = oldLocked;\n\n oldLocked.amount -= _splitAmount;\n s_locked[_from][_lpType] = oldLocked;\n _checkpoint(_from, oldLocked, _lpType);\n\n LockedBalance memory splitLocked = oldLockedTemp;\n splitLocked.amount = _splitAmount;\n _tokenId2 = _createSplitVE(ownerFrom, splitLocked, _lpType, _tokenAddress);\n _tokenId1 = _from;\n\n if (s_underlyingStake[_from][_tokenAddress] != 0) {\n s_underlyingStake[_from][_tokenAddress] -= _splitAmount;\n s_underlyingStake[_tokenId2][_tokenAddress] = _splitAmount;\n }\n\n emit SplitCompleted(_from, _tokenId1, _tokenId2, _splitAmount, _tokenAddress);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function claimEmissions(address _tokenAddress) external nonReentrant {\n LpTokenType _lpType = s_lpType[_tokenAddress];\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n if (_stakeStrategy.userStakingWallet(_msgSender()) == address(0)) revert NoUnderlyingStake();\n _stakeStrategy.claim(_msgSender());\n emit EmissionsClaimed(_msgSender(), _tokenAddress);\n }\n\n /**\n * @notice Overrides the _burn function from ERC721 to include additional logic for bridging.\n * @param tokenId Token ID to burn.\n */\n function _burn(uint256 tokenId) internal override {\n super._burn(tokenId);\n }\n\n /**\n * @notice Hook that is called before any token transfer. This includes minting\n * and burning. It updates the ownership mappings and handles delegation and\n * staking logic when transferring tokens between addresses.\n *\n * @param from The address which previously owned the token.\n * @param to The address that will receive the token.\n * @param tokenId The ID of the token being transferred.\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from != address(0)) s_ownerToTokenIds[from].remove(tokenId);\n if (to != address(0)) s_ownerToTokenIds[to].add(tokenId);\n\n if (from != address(0) && to != address(0)) {\n address[] memory assetsLocked = s_assetsLocked[tokenId].values();\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType _lpType = s_lpType[asset];\n\n uint256[] memory delegatees = s_delegatees[tokenId][_lpType].values();\n uint256[] memory amounts = new uint256[](delegatees.length);\n uint256 delegateesLength = delegatees.length;\n for (uint256 j = 0; j < delegateesLength; j++) {\n amounts[j] = type(uint256).max;\n }\n\n if (delegateesLength != 0) {\n removeDelegatees(tokenId, delegatees, asset, amounts);\n }\n\n uint256 amountStaked = s_underlyingStake[tokenId][asset];\n if (amountStaked != 0) {\n IStakeStrategy _stakeStrategy = s_stakeStrategy[_lpType];\n _stakeStrategy.transferStakingWallet(from, to, amountStaked);\n }\n\n LockedBalance memory lock = s_locked[tokenId][_lpType];\n s_userCumulativeAssetValues[from][asset] -= lock.amount;\n s_userCumulativeAssetValues[to][asset] += lock.amount;\n }\n }\n }\n\n /**\n * @dev Internal function to remove a delegation between two veNFTs.\n * @param fromTokenId ID of the veNFT from which delegation is being removed.\n * @param toTokenId ID of the veNFT to which delegation is being removed.\n * @param lpToken Address of the LP token associated with the delegation.\n * @param amount Amount of delegation to remove.\n */\n function _removeDelegation(uint256 fromTokenId, uint256 toTokenId, address lpToken, uint256 amount) internal {\n LpTokenType lpType = s_lpType[lpToken];\n LockedBalance memory fromLocked = s_locked[fromTokenId][lpType];\n LockedBalance memory toLocked = s_locked[toTokenId][lpType];\n\n if (ownerOf(fromTokenId) != _msgSender() && ownerOf(toTokenId) != _msgSender()) revert NotOwner();\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) revert NoDelegationBetweenTokens(fromTokenId, toTokenId);\n\n amount = amount > s_delegations[fromTokenId][toTokenId][lpType]\n ? s_delegations[fromTokenId][toTokenId][lpType]\n : amount;\n\n toLocked.delegateAmount -= amount;\n fromLocked.amount += amount;\n\n s_delegations[fromTokenId][toTokenId][lpType] -= amount;\n if (s_delegations[fromTokenId][toTokenId][lpType] == 0) {\n s_delegatees[fromTokenId][lpType].remove(toTokenId);\n s_delegators[toTokenId][lpType].remove(fromTokenId);\n }\n\n s_locked[toTokenId][lpType] = toLocked;\n s_locked[fromTokenId][lpType] = fromLocked;\n _checkpoint(toTokenId, s_locked[toTokenId][lpType], lpType);\n _checkpoint(fromTokenId, s_locked[fromTokenId][lpType], lpType);\n\n if (s_voted[toTokenId]) IVoter(s_voter).poke(toTokenId);\n if (s_voted[fromTokenId]) IVoter(s_voter).poke(fromTokenId);\n\n emit DelegationRemoved(fromTokenId, toTokenId, lpToken, amount);\n }\n\n /**\n * @notice Removes delegatees from a specific veNFT\n * @param fromTokenId ID of the veNFT from which delegatees are removed\n * @param toTokenIds Array of veNFT IDs that are delegatees to be removed\n * @param lpToken Address of the LP token associated with the delegation\n * @param amounts Array of amounts of voting power to remove from each delegatee\n */\n function removeDelegatees(\n uint256 fromTokenId,\n uint256[] memory toTokenIds,\n address lpToken,\n uint256[] memory amounts\n ) public nonReentrant {\n if (toTokenIds.length != amounts.length) revert ArrayMismatch();\n uint256 toTokenIdsLength = toTokenIds.length;\n for (uint256 i = 0; i < toTokenIdsLength; i++) {\n _removeDelegation(fromTokenId, toTokenIds[i], lpToken, amounts[i]);\n }\n }\n\n /// @inheritdoc IveIONFirstExtension\n function allowDelegators(uint256 _tokenId, address _tokenAddress, bool _blocked) external nonReentrant {\n if (ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n s_delegatorsBlocked[_tokenId][_tokenAddress] = _blocked;\n emit DelegatorsBlocked(_tokenId, _tokenAddress, _blocked);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /**\n * @notice Handles the withdrawal of staked tokens using a specified staking strategy.\n * @param _owner The address of the owner of the stake.\n * @param _withdrawTo The address to which the withdrawn tokens are sent.\n * @param _tokenId The ID of the token being withdrawn.\n * @param _tokenAddress The address of the token being withdrawn.\n * @param _tokenAmount The amount of tokens to withdraw.\n * @param _stakeStrategy The staking strategy to use for withdrawal.\n */\n function _handleTokenWithdrawStake(\n address _owner,\n address _withdrawTo,\n uint256 _tokenId,\n address _tokenAddress,\n uint256 _tokenAmount,\n IStakeStrategy _stakeStrategy\n ) internal {\n _stakeStrategy.claim(_owner);\n _stakeStrategy.withdraw(_owner, _withdrawTo, _tokenAmount);\n s_underlyingStake[_tokenId][_tokenAddress] -= _tokenAmount;\n }\n\n /**\n * @notice Updates the user point history and epoch for a given token and LP token type.\n * @param _tokenId The ID of the token.\n * @param _newLocked The new locked balance information.\n * @param _lpType The LP token type.\n */\n function _checkpoint(uint256 _tokenId, LockedBalance memory _newLocked, LpTokenType _lpType) internal {\n UserPoint memory uNew;\n uNew.permanent = _newLocked.isPermanent ? _newLocked.amount : 0;\n uNew.permanentDelegate = _newLocked.isPermanent ? _newLocked.delegateAmount : 0;\n\n if (_newLocked.end > block.timestamp && _newLocked.amount > 0) {\n uNew.slope = _newLocked.amount / _MAXTIME;\n uNew.bias = uNew.slope * (_newLocked.end - block.timestamp);\n }\n\n uNew.ts = block.timestamp;\n uNew.blk = block.number;\n uint256 userEpoch = s_userPointEpoch[_tokenId][_lpType];\n if (userEpoch != 0 && s_userPointHistory[_tokenId][_lpType][userEpoch].ts == block.timestamp) {\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n } else {\n s_userPointEpoch[_tokenId][_lpType] = ++userEpoch;\n s_userPointHistory[_tokenId][_lpType][userEpoch] = uNew;\n }\n }\n\n /**\n * @notice Calculates the boost for a given lock duration.\n * @param _duration The duration of the lock.\n * @return The calculated boost value.\n */\n function _calculateBoost(uint256 _duration) internal view returns (uint256) {\n uint256 minDuration = s_minimumLockDuration;\n uint256 maxDuration = _MAXTIME;\n uint256 minBoost = 1e18;\n uint256 maxBoost = 2e18;\n\n if (_duration <= minDuration) {\n return minBoost;\n } else if (_duration >= maxDuration) {\n return maxBoost;\n } else {\n return minBoost + ((_duration - minDuration) * (maxBoost - minBoost)) / (maxDuration - minDuration);\n }\n }\n\n /**\n * @notice Creates a new split veNFT with specified locked balance and LP token type.\n * @param _to The address to which the new veNFT is attributed.\n * @param _newLocked The locked balance information for the new veNFT.\n * @param _lpType The LP token type.\n * @param _tokenAddress The address of the token being locked.\n * @return _tokenId The ID of the newly created veNFT.\n */\n function _createSplitVE(\n address _to,\n LockedBalance memory _newLocked,\n LpTokenType _lpType,\n address _tokenAddress\n ) private returns (uint256 _tokenId) {\n _tokenId = ++s_tokenId;\n _safeMint(_to, _tokenId);\n s_locked[_tokenId][_lpType] = _newLocked;\n s_assetsLocked[_tokenId].add(_tokenAddress);\n _checkpoint(_tokenId, _newLocked, _lpType);\n }\n\n /**\n * @notice Retrieves the staking strategy and data for a given LP token type.\n * @param _lpType The LP token type.\n * @return _stakeStrategy The staking strategy for the LP token type.\n * @return _stakeData The staking data for the LP token type.\n */\n function _getStakeStrategy(\n LpTokenType _lpType\n ) internal view returns (IStakeStrategy _stakeStrategy, bytes memory _stakeData) {\n IStakeStrategy strategy = s_stakeStrategy[_lpType];\n return (strategy, \"\");\n }\n\n /**\n * @notice Calculates the total boost for a given token ID and LP token type.\n * @param _tokenId The ID of the token.\n * @param _lpType The LP token type.\n * @return The total boost value.\n */\n function _getTotalBoost(uint256 _tokenId, LpTokenType _lpType) internal view returns (uint256) {\n uint256 totalBoost = s_locked[_tokenId][_lpType].boost;\n if (s_limitedBoostActive) totalBoost += s_limitedBoost;\n if (s_veAERO == address(0)) return totalBoost;\n\n address _owner = ownerOf(_tokenId);\n IAeroVoter aeroVoter = IAeroVoter(s_aeroVoting);\n IAeroVotingEscrow veAERO = IAeroVotingEscrow(s_veAERO);\n uint256 _balance = veAERO.balanceOf(_owner);\n for (uint256 i = 0; i < _balance; i++) {\n uint256 veAeroTokenId = veAERO.ownerToNFTokenIdList(_owner, i);\n uint256 weightToVoteRatio = (aeroVoter.votes(veAeroTokenId, s_ionicPool) * 1e18) / aeroVoter.weights(s_ionicPool);\n totalBoost += (s_aeroVoterBoost * weightToVoteRatio) / 1e18;\n }\n\n return totalBoost;\n }\n\n /**\n * @notice Retrieves the ETH price of a given token.\n * @dev Uses the MasterPriceOracle to fetch the price.\n * @param _token The address of the token for which the ETH price is requested.\n * @return The ETH price of the specified token.\n */\n function _getEthPrice(address _token) internal view returns (uint256) {\n IMasterPriceOracle mpo = IMasterPriceOracle(ap.getAddress(\"MasterPriceOracle\"));\n return mpo.price(_token);\n }\n\n // // ╔═══════════════════════════════════════════════════════════════════════════╗\n // // ║ View Functions ║\n // // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONFirstExtension\n function balanceOfNFT(\n uint256 _tokenId\n ) public view returns (address[] memory _assets, uint256[] memory _balances, uint256[] memory _boosts) {\n address[] memory assetsLocked = s_assetsLocked[_tokenId].values();\n\n _assets = new address[](assetsLocked.length);\n _balances = new uint256[](assetsLocked.length);\n _boosts = new uint256[](assetsLocked.length);\n uint256 assetsLockedLength = assetsLocked.length;\n for (uint256 i = 0; i < assetsLockedLength; i++) {\n address asset = assetsLocked[i];\n LpTokenType lpType = s_lpType[asset];\n LockedBalance memory lockedBalance = s_locked[_tokenId][lpType];\n _boosts[i] = _getTotalBoost(_tokenId, lpType);\n _assets[i] = asset;\n _balances[i] = BalanceLogicLibrary.balanceOfNFTAt(\n s_userPointEpoch,\n s_userPointHistory,\n lpType,\n _tokenId,\n block.timestamp,\n lockedBalance.isPermanent\n );\n }\n\n return (_assets, _balances, _boosts);\n }\n\n /// @inheritdoc IveIONFirstExtension\n function getTotalEthValueOfTokens(address _owner) external view returns (uint256 totalValue) {\n IVoter voter = IVoter(s_voter);\n address[] memory lpTokens = voter.getAllLpRewardTokens();\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 i = 0; i < lpTokensLength; i++) {\n uint256 ethValue = (s_userCumulativeAssetValues[_owner][lpTokens[i]] * _getEthPrice(lpTokens[i])) / PRECISION;\n totalValue += ethValue;\n }\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external {\n address impl = veIONSecondExtension;\n require(impl != address(0), \"Implementation not set\");\n\n assembly {\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)\n\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/veION/veIONSecondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { IMasterPriceOracle, IAeroVotingEscrow, IAeroVoter } from \"./interfaces/IveIONCore.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\nimport { veIONStorage } from \"./veIONStorage.sol\";\nimport { BalanceLogicLibrary } from \"./libraries/BalanceLogicLibrary.sol\";\nimport { IveIONSecondExtension } from \"./interfaces/IveIONSecondExtension.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\n\n/**\n * @title veION Contract Second Extension\n * @notice This contract manages the veION framework, enabling the staking and management LP tokens for voting power.\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract veIONSecondExtension is\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ReentrancyGuardUpgradeable,\n veIONStorage,\n IveIONSecondExtension\n{\n using EnumerableSet for EnumerableSet.UintSet;\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /// @inheritdoc IveIONSecondExtension\n function whitelistTokens(address[] memory _tokens, bool[] memory _isWhitelisted) external onlyOwner {\n require(_tokens.length == _isWhitelisted.length, \"Unequal Arrays\");\n for (uint256 i; i < _tokens.length; i++) s_whitelistedToken[_tokens[i]] = _isWhitelisted[i];\n emit TokensWhitelisted(_tokens, _isWhitelisted);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function withdrawProtocolFees(address _tokenAddress, address _recipient) external onlyOwner {\n LpTokenType lpType = s_lpType[_tokenAddress];\n uint256 protocolFees = s_protocolFees[lpType];\n require(protocolFees > 0, \"No protocol fees available\");\n s_protocolFees[lpType] = 0;\n IERC20(_tokenAddress).safeTransfer(_recipient, protocolFees);\n emit ProtocolFeesWithdrawn(_tokenAddress, _recipient, protocolFees);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function withdrawDistributedFees(address _tokenAddress, address _recipient) external onlyOwner {\n LpTokenType lpType = s_lpType[_tokenAddress];\n uint256 distributedFees = s_distributedFees[lpType];\n require(distributedFees > 0, \"No distributed fees available\");\n s_distributedFees[lpType] = 0;\n IERC20(_tokenAddress).safeTransfer(_recipient, distributedFees);\n emit DistributedFeesWithdrawn(_tokenAddress, _recipient, distributedFees);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Setter Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONSecondExtension\n function toggleSplit(address _account, bool _isAllowed) external onlyOwner {\n s_canSplit[_account] = _isAllowed;\n emit SplitToggle(_account, _isAllowed);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function toggleLimitedBoost(bool _isBoosted) external onlyOwner {\n s_limitedBoostActive = _isBoosted;\n emit LimitedBoostToggled(_isBoosted);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setLimitedTimeBoost(uint256 _boostAmount) external onlyOwner {\n if (_boostAmount <= 0) revert BoostAmountMustBeGreaterThanZero();\n s_limitedBoost = _boostAmount;\n emit LimitedTimeBoostSet(_boostAmount);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setVoter(address _voter) external onlyOwner {\n if (address(_voter) == address(0)) revert InvalidAddress();\n s_voter = _voter;\n emit VoterSet(_voter);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMinimumLockAmount(address _tokenAddress, uint256 _minimumAmount) external onlyOwner {\n if (_minimumAmount <= 0) revert MinimumAmountMustBeGreaterThanZero();\n LpTokenType lpType = s_lpType[_tokenAddress];\n s_minimumLockAmount[lpType] = _minimumAmount;\n emit MinimumLockAmountSet(_tokenAddress, _minimumAmount);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMinimumLockDuration(uint256 _minimumLockDuration) external onlyOwner {\n if (_minimumLockDuration <= 0) revert MinimumLockDurationMustBeGreaterThanZero();\n s_minimumLockDuration = _minimumLockDuration;\n emit MinimumLockDurationSet(_minimumLockDuration);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setIonicPool(address _ionicPool) external onlyOwner {\n if (address(_ionicPool) == address(0)) revert InvalidAddress();\n s_ionicPool = _ionicPool;\n emit IonicPoolSet(_ionicPool);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setAeroVoting(address _aeroVoting) external onlyOwner {\n if (address(_aeroVoting) == address(0)) revert InvalidAddress();\n s_aeroVoting = _aeroVoting;\n emit AeroVotingSet(_aeroVoting);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setAeroVoterBoost(uint256 _aeroVoterBoost) external onlyOwner {\n if (_aeroVoterBoost <= 0) revert AeroBoostAmountMustBeGreaterThanZero();\n s_aeroVoterBoost = _aeroVoterBoost;\n emit AeroVoterBoostSet(_aeroVoterBoost);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setMaxEarlyWithdrawFee(uint256 _maxEarlyWithdrawFee) external onlyOwner {\n if (_maxEarlyWithdrawFee <= 0) revert MaxEarlyWithdrawFeeMustBeGreaterThanZero();\n s_maxEarlyWithdrawFee = _maxEarlyWithdrawFee;\n emit MaxEarlyWithdrawFeeSet(_maxEarlyWithdrawFee);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setLpTokenType(address _token, LpTokenType _type) external onlyOwner {\n if (_token == address(0)) revert InvalidTokenAddress();\n s_lpType[_token] = _type;\n emit LpTokenTypeSet(_token, _type);\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setStakeStrategy(LpTokenType _lpType, IStakeStrategy _strategy) external onlyOwner {\n if (address(_strategy) == address(0)) revert InvalidStrategyAddress();\n s_stakeStrategy[_lpType] = IStakeStrategy(_strategy);\n emit StakeStrategySet(_lpType, address(_strategy));\n }\n\n /// @inheritdoc IveIONSecondExtension\n function setVeAERO(address _veAERO) external onlyOwner {\n if (_veAERO == address(0)) revert InvalidVeAEROAddress();\n s_veAERO = _veAERO;\n emit VeAEROSet(_veAERO);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IveIONSecondExtension\n function getUserLock(uint256 _tokenId, LpTokenType _lpType) external view returns (LockedBalance memory) {\n return s_locked[_tokenId][_lpType];\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getOwnedTokenIds(address _owner) external view returns (uint256[] memory) {\n return s_ownerToTokenIds[_owner].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getAssetsLocked(uint256 _tokenId) external view returns (address[] memory) {\n return s_assetsLocked[_tokenId].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getDelegatees(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\n return s_delegatees[_tokenId][_lpType].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getDelegators(uint256 _tokenId, LpTokenType _lpType) external view returns (uint256[] memory) {\n return s_delegators[_tokenId][_lpType].values();\n }\n\n /// @inheritdoc IveIONSecondExtension\n function getUserPoint(\n uint256 _tokenId,\n LpTokenType _lpType,\n uint256 _epoch\n ) external view returns (UserPoint memory) {\n return s_userPointHistory[_tokenId][_lpType][_epoch];\n }\n}\n" + }, + "contracts/veION/veIONStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { IAddressesProvider } from \"./interfaces/IveIONCore.sol\";\nimport { IStakeStrategy } from \"./stake/IStakeStrategy.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { IveIONStructsEnumsErrorsEvents } from \"./interfaces/IveIONStructsEnumsErrorsEvents.sol\";\n\nabstract contract veIONStorage is IveIONStructsEnumsErrorsEvents {\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Constants ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice Represents the duration of one week in seconds.\n uint256 internal constant _WEEK = 1 weeks;\n /// @notice Represents the maximum lock time in seconds (2 years).\n uint256 internal constant _MAXTIME = 2 * 365 * 86400;\n /// @notice Precision used for calculations, set to 1e18.\n uint256 public constant PRECISION = 1e18;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @notice The current token ID counter.\n uint256 public s_tokenId;\n /// @notice The amount of limited boost available.\n uint256 public s_limitedBoost;\n /// @notice Indicates whether the limited boost is active.\n bool public s_limitedBoostActive;\n /// @notice Address of the veAERO contract.\n address public s_veAERO;\n /// @notice Address of the AeroVoting contract.\n address public s_aeroVoting;\n /// @notice Address of the Ionic Pool.\n address public s_ionicPool;\n /// @notice Address of the voter contract.\n address public s_voter;\n /// @notice The boost amount for AeroVoter.\n uint256 public s_aeroVoterBoost;\n /// @notice The minimum duration for locking.\n uint256 public s_minimumLockDuration;\n /// @notice The maximum fee for early withdrawal.\n uint256 public s_maxEarlyWithdrawFee;\n /// @notice The AddressesProvider contract used for address management.\n IAddressesProvider public ap;\n /// @notice The address of the logic contract for the veION first extension.\n address public veIONFirstExtension;\n /// @notice The address of the logic contract for the veION second extension.\n address public veIONSecondExtension;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /// @dev Maps LP token types to their minimum lock amounts.\n mapping(LpTokenType => uint256) public s_minimumLockAmount;\n /// @dev Maps token addresses to their whitelist status.\n mapping(address => bool) public s_whitelistedToken;\n /// @dev Maps token addresses to their corresponding LP token types.\n mapping(address => LpTokenType) public s_lpType;\n /// @dev Maps user addresses to their ability to split.\n mapping(address => bool) public s_canSplit;\n /// @dev Maps token IDs and LP token types to their locked balances.\n mapping(uint256 => mapping(LpTokenType => LockedBalance)) public s_locked;\n /// @dev Maps token IDs and LP token types to user epochs.\n mapping(uint256 => mapping(LpTokenType => uint256)) public s_userPointEpoch;\n /// @dev Maps token IDs and LP token types to user point history.\n mapping(uint256 => mapping(LpTokenType => UserPoint[1000000000])) public s_userPointHistory;\n /// @dev Maps token IDs to sets of locked asset addresses.\n mapping(uint256 => EnumerableSet.AddressSet) internal s_assetsLocked;\n /// @dev Maps token IDs to their voting status.\n mapping(uint256 => bool) public s_voted;\n /// @dev Maps LP token types to their total supply.\n mapping(LpTokenType => uint256) public s_supply;\n /// @dev Maps LP token types to their permanent lock balances.\n mapping(LpTokenType => uint256) public s_permanentLockBalance;\n /// @dev Maps LP token types to their underlying stake strategies.\n mapping(LpTokenType => IStakeStrategy) public s_stakeStrategy;\n /// @dev Maps token IDs and LP token addresses to their underlying stake amounts.\n mapping(uint256 => mapping(address => uint256)) public s_underlyingStake;\n /// @dev Maps LP token types to their protocol fees.\n mapping(LpTokenType => uint256) public s_protocolFees;\n /// @dev Maps LP token types to their distributed fees.\n mapping(LpTokenType => uint256) public s_distributedFees;\n /// @dev Maps delegators, delegatees, and LP token types to delegation amounts.\n mapping(uint256 => mapping(uint256 => mapping(LpTokenType => uint256))) public s_delegations;\n /// @dev Maps token IDs and LP token types to sets of delegatees.\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegatees;\n /// @dev Maps token IDs and LP token types to sets of delegators.\n mapping(uint256 => mapping(LpTokenType => EnumerableSet.UintSet)) internal s_delegators;\n /// @dev Maps owner addresses to sets of token IDs they own.\n mapping(address => EnumerableSet.UintSet) internal s_ownerToTokenIds;\n /// @dev Maps user addresses and token addresses to cumulative asset values.\n mapping(address => mapping(address => uint256)) public s_userCumulativeAssetValues;\n /// @dev Maps token Id and lp onto delegator permissioning.\n mapping(uint256 => mapping(address => bool)) public s_delegatorsBlocked;\n\n uint256[50] private __gap;\n}\n" + }, + "contracts/veION/Voter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IVoter } from \"./interfaces/IVoter.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IonicTimeLibrary } from \"./libraries/IonicTimeLibrary.sol\";\nimport { IveION } from \"./interfaces/IveION.sol\";\nimport { IBribeRewards } from \"./interfaces/IBribeRewards.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { MasterPriceOracle } from \"../oracles/MasterPriceOracle.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title Voter Contract\n * @notice This contract allows veION holders to vote for various markets\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\n */\ncontract Voter is IVoter, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ State Variables ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n ///@notice The ve token that governs these contracts\n address public ve;\n ///@notice Base token of ve contract\n address internal rewardToken;\n ///@notice Standard OZ IGovernor using ve for vote weights\n address public governor;\n ///@notice Master Price Oracle instance\n MasterPriceOracle public mpo;\n ///@notice List of LP tokens\n address[] public lpTokens;\n ///@notice Total Voting Weights for each address\n mapping(address => uint256) public totalWeight;\n ///@notice Maximum number of markets one voter can vote for at once\n uint256 public maxVotingNum;\n ///@notice Minimum value for maxVotingNum\n uint256 internal constant MIN_MAXVOTINGNUM = 10;\n ///@notice All markets viable for incentives\n Market[] public markets;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Mappings ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n ///@notice Mapping from Reward Accumulator to Bribes Voting Reward\n mapping(address => address) public rewardAccumulatorToBribe;\n ///@notice Mapping from Market to Market Side to LP Asset to weights\n mapping(address => mapping(MarketSide => mapping(address => uint256))) public weights;\n ///@notice Mapping from NFT to Pool to LP Asset to Votes\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public votes;\n ///@notice Mapping from NFT to Pool to LP Asset to Base Weights\n mapping(uint256 => mapping(address => mapping(MarketSide => mapping(address => uint256)))) public baseWeights;\n ///@notice Mapping from NFT to List of markets voted for by NFT\n mapping(uint256 => mapping(address => address[])) public marketVote;\n ///@notice Mapping from NFT to List of market vote sides voted for by NFT\n mapping(uint256 => mapping(address => MarketSide[])) public marketVoteSide;\n ///@notice Mapping from NFT to Total voting weight of NFT\n mapping(uint256 => mapping(address => uint256)) public usedWeights;\n ///@notice Mapping from NFT to Timestamp of last vote (ensures single vote per epoch)\n mapping(uint256 => uint256) public lastVoted;\n ///@notice Mapping from Token to Whitelisted status\n mapping(address => bool) public isWhitelistedToken;\n ///@notice Mapping from TokenId to Whitelisted status\n mapping(uint256 => bool) public isWhitelistedNFT;\n ///@notice Mapping from Reward Accumulator to Liveness status\n mapping(address => bool) public isAlive;\n ///@notice Mapping from Market to Market Side to Reward Accumulator\n mapping(address => mapping(MarketSide => address)) public marketToRewardAccumulators;\n\n bool distributionTimelockAlive;\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Modifiers ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n /**\n * @notice Modifier to ensure that the function is called only in a new epoch since the last vote.\n * @dev Reverts if the current epoch start time is less than or equal to the last voted timestamp for the given token ID.\n * Also reverts if the current time is within the vote distribution window.\n * @param _tokenId The ID of the veNFT to check the last voted timestamp.\n */\n modifier onlyNewEpoch(uint256 _tokenId) {\n if (IonicTimeLibrary.epochStart(block.timestamp) <= lastVoted[_tokenId]) revert AlreadyVotedOrDeposited();\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\n _;\n }\n\n /**\n * @notice Modifier to ensure that the function is called only by the governance address.\n * @dev Reverts if the caller is not the current governor.\n */\n modifier onlyGovernance() {\n if (msg.sender != governor) revert NotGovernor();\n _;\n }\n\n constructor() {\n _disableInitializers(); // Locks the implementation contract from being initialized\n }\n\n /**\n * @notice Initializes the Voter contract with the specified parameters.\n * @dev Requires initialization with at least one reward token.\n * @param _tokens An array of token addresses to be whitelisted.\n * @param _mpo The MasterPriceOracle contract address.\n * @param _rewardToken The address of the reward token.\n * @param _ve The address of the veION contract.\n * @custom:reverts TokensArrayEmpty if the _tokens array is empty.\n */\n function initialize(\n address[] calldata _tokens,\n MasterPriceOracle _mpo,\n address _rewardToken,\n address _ve\n ) external initializer {\n __Ownable2Step_init();\n __ReentrancyGuard_init();\n uint256 _length = _tokens.length;\n if (_length == 0) revert TokensArrayEmpty();\n for (uint256 i = 0; i < _length; i++) {\n _whitelistToken(_tokens[i], true);\n }\n mpo = _mpo;\n rewardToken = _rewardToken;\n ve = _ve;\n governor = msg.sender;\n\n emit Initialized(_tokens, address(_mpo), _rewardToken, _ve, governor);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function vote(\n uint256 _tokenId,\n address[] calldata _marketVote,\n MarketSide[] calldata _marketVoteSide,\n uint256[] calldata _weights\n ) external nonReentrant onlyNewEpoch(_tokenId) {\n VoteLocalVars memory vars;\n vars.sender = msg.sender;\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != vars.sender) revert NotOwner();\n if (\n _marketVote.length != _marketVoteSide.length ||\n _marketVoteSide.length != _weights.length ||\n _weights.length != _marketVote.length\n ) revert UnequalLengths();\n if (_marketVote.length > maxVotingNum) revert TooManyPools();\n vars.timestamp = block.timestamp;\n if ((vars.timestamp > IonicTimeLibrary.epochVoteEnd(vars.timestamp)) && !isWhitelistedNFT[_tokenId])\n revert NotWhitelistedNFT();\n uint256 totalVoteWeight = 0;\n\n for (uint256 i = 0; i < _marketVote.length; i++) {\n totalVoteWeight += _weights[i];\n }\n for (uint256 i = 0; i < lpTokens.length; i++) {\n _reset(_tokenId, lpTokens[i]);\n }\n\n lastVoted[_tokenId] = vars.timestamp;\n (vars.votingLPs, vars.votingLPBalances, vars.boosts) = IveION(ve).balanceOfNFT(_tokenId);\n for (uint256 j = 0; j < vars.votingLPs.length; j++) {\n _vote(\n _tokenId,\n vars.votingLPs[j],\n (vars.votingLPBalances[j] * vars.boosts[j]) / 1e18,\n _marketVote,\n _marketVoteSide,\n _weights,\n totalVoteWeight\n );\n }\n }\n\n /// @inheritdoc IVoter\n function poke(uint256 _tokenId) external nonReentrant {\n if (block.timestamp <= IonicTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow();\n (address[] memory _votingLPs, uint256[] memory _votingLPBalances, uint256[] memory _boosts) = IveION(ve)\n .balanceOfNFT(_tokenId);\n\n for (uint256 i = 0; i < _votingLPs.length; i++) {\n uint256 effectiveBalance = (_votingLPBalances[i] * _boosts[i]) / 1e18;\n _poke(_tokenId, lpTokens[i], effectiveBalance);\n }\n }\n\n /// @inheritdoc IVoter\n function reset(uint256 _tokenId) public nonReentrant onlyNewEpoch(_tokenId) {\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != msg.sender) revert NotOwner();\n for (uint256 i = 0; i < lpTokens.length; i++) {\n _reset(_tokenId, lpTokens[i]);\n }\n }\n\n /// @inheritdoc IVoter\n function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external nonReentrant {\n if (_bribes.length != _tokens.length) revert UnequalLengths();\n if (ERC721Upgradeable(ve).ownerOf(_tokenId) != _msgSender()) revert NotOwner();\n uint256 _length = _bribes.length;\n for (uint256 i = 0; i < _length; i++) {\n IBribeRewards(_bribes[i]).getReward(_tokenId, _tokens[i]);\n }\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Admin External Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function distributeRewards() external onlyGovernance {\n if (distributionTimelockAlive && block.timestamp <= IonicTimeLibrary.epochVoteEnd(block.timestamp)) revert NotDistributeWindow();\n uint256 _reward = IERC20(rewardToken).balanceOf(address(this));\n uint256 _totalLPValueETH = _calculateTotalLPValue();\n for (uint256 i = 0; i < markets.length; i++) {\n uint256 _marketWeightETH = _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\n if (_marketWeightETH > 0) {\n IERC20(rewardToken).safeTransfer(\n marketToRewardAccumulators[markets[i].marketAddress][markets[i].side],\n (_reward * _marketWeightETH) / _totalLPValueETH\n );\n }\n }\n }\n\n /// @inheritdoc IVoter\n function whitelistToken(address _token, bool _bool) external onlyGovernance {\n _whitelistToken(_token, _bool);\n }\n\n /// @inheritdoc IVoter\n function whitelistNFT(uint256 _tokenId, bool _bool) external onlyGovernance {\n address _sender = msg.sender;\n isWhitelistedNFT[_tokenId] = _bool;\n emit WhitelistNFT(_sender, _tokenId, _bool);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Internal Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /**\n * @notice Internal function to handle voting logic for a given token ID and voting asset.\n * @param _tokenId The ID of the token used for voting.\n * @param _votingAsset The address of the asset being used for voting.\n * @param _votingAssetBalance The balance of the voting asset.\n * @param _marketVote An array of market addresses to vote for.\n * @param _marketVoteSide An array of market sides corresponding to the markets.\n * @param _weights An array of weights for each market.\n * @param totalVoteWeight The total weight of the vote.\n */\n function _vote(\n uint256 _tokenId,\n address _votingAsset,\n uint256 _votingAssetBalance,\n address[] memory _marketVote,\n MarketSide[] memory _marketVoteSide,\n uint256[] memory _weights,\n uint256 totalVoteWeight\n ) internal {\n VoteVars memory vars;\n uint256 marketVoteLength = _marketVote.length;\n for (uint256 i = 0; i < marketVoteLength; i++) {\n vars.market = _marketVote[i];\n vars.marketSide = _marketVoteSide[i];\n vars.rewardAccumulator = marketToRewardAccumulators[vars.market][vars.marketSide];\n vars.bribes = rewardAccumulatorToBribe[vars.rewardAccumulator];\n if (_weights[i] == 0) revert ZeroWeight();\n if (vars.rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(vars.market);\n if (!isAlive[vars.rewardAccumulator]) revert RewardAccumulatorNotAlive(vars.rewardAccumulator);\n\n vars.marketWeight = (_weights[i] * _votingAssetBalance) / totalVoteWeight;\n if (votes[_tokenId][vars.market][vars.marketSide][_votingAsset] != 0) revert NonZeroVotes();\n\n marketVote[_tokenId][_votingAsset].push(vars.market);\n marketVoteSide[_tokenId][_votingAsset].push(vars.marketSide);\n\n weights[vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\n votes[_tokenId][vars.market][vars.marketSide][_votingAsset] += vars.marketWeight;\n baseWeights[_tokenId][vars.market][vars.marketSide][_votingAsset] = _weights[i];\n IBribeRewards(vars.bribes).deposit(_votingAsset, uint256(vars.marketWeight), _tokenId);\n vars.usedWeight += vars.marketWeight;\n vars.totalWeight += vars.marketWeight;\n emit Voted(\n msg.sender,\n vars.market,\n _tokenId,\n vars.marketWeight,\n weights[vars.market][vars.marketSide][_votingAsset],\n block.timestamp\n );\n }\n IveION(ve).voting(_tokenId, true);\n totalWeight[_votingAsset] += uint256(vars.totalWeight);\n usedWeights[_tokenId][_votingAsset] = uint256(vars.usedWeight);\n }\n\n /**\n * @notice Internal function to update voting balances for a given token ID and voting asset.\n * @param _tokenId The ID of the token whose voting balance is being updated.\n * @param _votingAsset The address of the asset being used for voting.\n * @param _votingAssetBalance The balance of the voting asset.\n */\n function _poke(uint256 _tokenId, address _votingAsset, uint256 _votingAssetBalance) internal {\n address[] memory _marketVote = marketVote[_tokenId][_votingAsset];\n MarketSide[] memory _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\n uint256 _marketCnt = _marketVote.length;\n uint256[] memory _weights = new uint256[](_marketCnt);\n uint256 totalVoteWeight = 0;\n\n for (uint256 i = 0; i < _marketCnt; i++) {\n _weights[i] = baseWeights[_tokenId][_marketVote[i]][_marketVoteSide[i]][_votingAsset];\n }\n\n for (uint256 i = 0; i < _marketVote.length; i++) {\n totalVoteWeight += _weights[i];\n }\n\n _reset(_tokenId, _votingAsset);\n _vote(_tokenId, _votingAsset, _votingAssetBalance, _marketVote, _marketVoteSide, _weights, totalVoteWeight);\n }\n\n /**\n * @notice Internal function to reset voting state for a given token ID and voting asset.\n * @param _tokenId The ID of the token whose voting state is being reset.\n * @param _votingAsset The address of the asset being used for voting.\n */\n function _reset(uint256 _tokenId, address _votingAsset) internal {\n address[] storage _marketVote = marketVote[_tokenId][_votingAsset];\n MarketSide[] storage _marketVoteSide = marketVoteSide[_tokenId][_votingAsset];\n uint256 _marketVoteCnt = _marketVote.length;\n\n for (uint256 i = 0; i < _marketVoteCnt; i++) {\n address _market = _marketVote[i];\n MarketSide _marketSide = _marketVoteSide[i];\n\n uint256 _votes = votes[_tokenId][_market][_marketSide][_votingAsset];\n if (_votes != 0) {\n weights[_market][_marketSide][_votingAsset] -= _votes;\n delete votes[_tokenId][_market][_marketSide][_votingAsset];\n IBribeRewards(rewardAccumulatorToBribe[marketToRewardAccumulators[_market][_marketSide]]).withdraw(\n _votingAsset,\n uint256(_votes),\n _tokenId\n );\n totalWeight[_votingAsset] -= _votes;\n emit Abstained(\n msg.sender,\n _market,\n _tokenId,\n _votes,\n weights[_market][_marketSide][_votingAsset],\n block.timestamp\n );\n }\n }\n usedWeights[_tokenId][_votingAsset] = 0;\n delete marketVote[_tokenId][_votingAsset];\n delete marketVoteSide[_tokenId][_votingAsset];\n IveION(ve).voting(_tokenId, false);\n }\n\n /**\n * @notice Internal function to whitelist or unwhitelist a token for use in bribes.\n * @param _token The address of the token to be whitelisted or unwhitelisted.\n * @param _bool Boolean indicating whether to whitelist (true) or unwhitelist (false) the token.\n */\n function _whitelistToken(address _token, bool _bool) internal {\n isWhitelistedToken[_token] = _bool;\n emit WhitelistToken(msg.sender, _token, _bool);\n }\n\n /**\n * @notice Internal function to calculate the ETH value of a given amount of LP tokens.\n * @param amount The amount of LP tokens.\n * @param lpToken The address of the LP token.\n * @return The ETH value of the given amount of LP tokens.\n */\n function _getTokenEthValue(uint256 amount, address lpToken) internal view returns (uint256) {\n uint256 tokenPriceInEth = mpo.price(lpToken); // Fetch price of 1 lpToken in ETH\n uint256 ethValue = amount * tokenPriceInEth;\n return ethValue;\n }\n\n /**\n * @notice Internal function to calculate the total ETH value of all LP tokens in the markets.\n * @return _totalLPValueETH The total ETH value of all LP tokens.\n */\n function _calculateTotalLPValue() internal view returns (uint256 _totalLPValueETH) {\n uint256 marketLength = markets.length;\n for (uint256 i = 0; i < marketLength; i++)\n _totalLPValueETH += _calculateMarketLPValue(markets[i].marketAddress, markets[i].side);\n }\n\n /**\n * @notice Internal function to calculate the ETH value of LP tokens for a specific market.\n * @param _market The address of the market.\n * @param _marketSide The side of the market.\n * @return _marketLPValueETH The ETH value of LP tokens for the specified market.\n */\n function _calculateMarketLPValue(\n address _market,\n MarketSide _marketSide\n ) internal view returns (uint256 _marketLPValueETH) {\n uint256 lpTokensLength = lpTokens.length;\n for (uint256 i = 0; i < lpTokensLength; i++) {\n uint256 _lpAmount = weights[_market][_marketSide][lpTokens[i]];\n uint256 tokenEthValue = _getTokenEthValue(_lpAmount, lpTokens[i]);\n _marketLPValueETH += tokenEthValue;\n }\n }\n\n /**\n * @notice Internal function to check if a market exists.\n * @param _marketAddress The address of the market.\n * @param _marketSide The side of the market.\n * @return True if the market exists, false otherwise.\n */\n function _marketExists(address _marketAddress, MarketSide _marketSide) internal view returns (bool) {\n uint256 marketLength = markets.length;\n for (uint256 j = 0; j < marketLength; j++) {\n if (markets[j].marketAddress == _marketAddress && markets[j].side == _marketSide) {\n return true;\n }\n }\n return false;\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Setter Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function setLpTokens(address[] memory _lpTokens) external onlyOwner {\n require(_lpTokens.length != 0, \"LpTokens array cannot be empty\");\n lpTokens = _lpTokens;\n emit LpTokensSet(_lpTokens);\n }\n\n /// @inheritdoc IVoter\n function setMpo(address _mpo) external onlyOwner {\n if (_mpo == address(0)) revert ZeroAddress();\n mpo = MasterPriceOracle(_mpo);\n emit MpoSet(_mpo);\n }\n\n /// @inheritdoc IVoter\n function setGovernor(address _governor) public onlyOwner {\n if (_governor == address(0)) revert ZeroAddress();\n governor = _governor;\n emit GovernorSet(_governor);\n }\n\n /// @inheritdoc IVoter\n function addMarkets(Market[] calldata _markets) external onlyGovernance {\n for (uint256 i = 0; i < _markets.length; i++) {\n Market memory newMarket = _markets[i];\n if (_marketExists(newMarket.marketAddress, newMarket.side)) revert MarketAlreadyExists();\n markets.push(newMarket);\n }\n emit MarketsAdded(_markets);\n }\n\n /// @inheritdoc IVoter\n function setMarketRewardAccumulators(\n address[] calldata _markets,\n MarketSide[] calldata _marketSides,\n address[] calldata _rewardAccumulators\n ) external onlyGovernance {\n uint256 _length = _markets.length;\n if (_marketSides.length != _length) revert MismatchedArrayLengths();\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\n for (uint256 i = 0; i < _length; i++) {\n marketToRewardAccumulators[_markets[i]][_marketSides[i]] = _rewardAccumulators[i];\n isAlive[_rewardAccumulators[i]] = true;\n }\n emit MarketRewardAccumulatorsSet(_markets, _marketSides, _rewardAccumulators);\n }\n\n /// @inheritdoc IVoter\n function setBribes(address[] calldata _rewardAccumulators, address[] calldata _bribes) external onlyGovernance {\n uint256 _length = _bribes.length;\n if (_rewardAccumulators.length != _length) revert MismatchedArrayLengths();\n for (uint256 i = 0; i < _length; i++) {\n rewardAccumulatorToBribe[_rewardAccumulators[i]] = _bribes[i];\n }\n emit BribesSet(_rewardAccumulators, _bribes);\n }\n\n /// @inheritdoc IVoter\n function setMaxVotingNum(uint256 _maxVotingNum) external onlyGovernance {\n if (_maxVotingNum < MIN_MAXVOTINGNUM) revert MaximumVotingNumberTooLow();\n if (_maxVotingNum == maxVotingNum) revert SameValue();\n maxVotingNum = _maxVotingNum;\n emit MaxVotingNumSet(_maxVotingNum);\n }\n\n /// @inheritdoc IVoter\n function toggleRewardAccumulatorAlive(\n address _market,\n MarketSide _marketSide,\n bool _isAlive\n ) external onlyGovernance {\n address _rewardAccumulator = marketToRewardAccumulators[_market][_marketSide];\n if (_rewardAccumulator == address(0)) revert RewardAccumulatorDoesNotExist(_market);\n isAlive[_rewardAccumulator] = _isAlive;\n emit RewardAccumulatorAliveToggled(_market, _marketSide, _isAlive);\n }\n\n /// @inheritdoc IVoter\n function toggleDistributionTimelockAlive(bool _isAlive) external onlyGovernance {\n distributionTimelockAlive = _isAlive;\n emit DistributionTimelockAliveToggled(_isAlive);\n }\n\n // ╔═══════════════════════════════════════════════════════════════════════════╗\n // ║ Pure/View Functions ║\n // ╚═══════════════════════════════════════════════════════════════════════════╝\n\n /// @inheritdoc IVoter\n function epochStart(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochStart(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochNext(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochNext(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochVoteStart(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochVoteStart(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function epochVoteEnd(uint256 _timestamp) external pure returns (uint256) {\n return IonicTimeLibrary.epochVoteEnd(_timestamp);\n }\n\n /// @inheritdoc IVoter\n function marketsLength() external view returns (uint256) {\n return markets.length;\n }\n\n /// @inheritdoc IVoter\n function getAllLpRewardTokens() external view returns (address[] memory) {\n return lpTokens;\n }\n\n /// @inheritdoc IVoter\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (VoteDetails memory) {\n uint256 length = marketVote[_tokenId][_lpAsset].length;\n address[] memory _marketVotes = new address[](length);\n MarketSide[] memory _marketVoteSides = new MarketSide[](length);\n uint256[] memory _votes = new uint256[](length);\n\n for (uint256 i = 0; i < length; i++) {\n _marketVotes[i] = marketVote[_tokenId][_lpAsset][i];\n _marketVoteSides[i] = marketVoteSide[_tokenId][_lpAsset][i];\n _votes[i] = votes[_tokenId][_marketVotes[i]][_marketVoteSides[i]][_lpAsset];\n }\n\n uint256 _usedWeight = usedWeights[_tokenId][_lpAsset];\n\n return\n VoteDetails({\n marketVotes: _marketVotes,\n marketVoteSides: _marketVoteSides,\n votes: _votes,\n usedWeight: _usedWeight\n });\n }\n}\n" + }, + "contracts/veION/VoterLens.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.22;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"./interfaces/IVoter.sol\";\nimport \"../PoolDirectory.sol\";\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\nimport { ComptrollerExtensionInterface } from \"../compound/ComptrollerInterface.sol\";\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\";\nimport { veIONSecondExtension } from \"./veIONSecondExtension.sol\";\nimport { Voter } from \"./Voter.sol\";\n\ncontract VoterLens is Initializable, Ownable2StepUpgradeable {\n struct BribeInfo {\n address market;\n address bribeSupply;\n address bribeBorrow;\n }\n\n struct MarketVoteInfo {\n address market;\n IVoter.MarketSide side;\n uint256 votes;\n uint256 votesValueInEth;\n }\n\n struct IncentiveInfo {\n address market;\n address bribeSupply;\n address[] rewardsSupply;\n uint256[] rewardsSupplyAmounts;\n uint256[] rewardsSupplyETHValues;\n address bribeBorrow;\n address[] rewardsBorrow;\n uint256[] rewardsBorrowAmounts;\n uint256[] rewardsBorrowETHValues;\n }\n\n address voter;\n PoolDirectory poolDirectory;\n IMasterPriceOracle mpo;\n uint256 constant PRECISION = 1e18;\n address veIONAddress;\n\n function initialize(address _voter, PoolDirectory _poolDirectory) public initializer {\n voter = _voter;\n poolDirectory = _poolDirectory;\n __Ownable2Step_init();\n }\n\n function getAllBribes() public view returns (BribeInfo[] memory _bribeInfo) {\n uint256 count = 0;\n uint256 totalMarketsLength = 0;\n (, PoolDirectory.Pool[] memory activePools) = poolDirectory.getActivePools();\n\n for (uint256 i = 0; i < activePools.length; i++) {\n ComptrollerExtensionInterface comptroller = ComptrollerExtensionInterface(activePools[i].comptroller);\n ICErc20[] memory markets = comptroller.getAllMarkets();\n totalMarketsLength += markets.length;\n }\n\n _bribeInfo = new BribeInfo[](totalMarketsLength);\n\n for (uint256 i = 0; i < activePools.length; i++) {\n ComptrollerExtensionInterface comptroller = ComptrollerExtensionInterface(activePools[i].comptroller);\n ICErc20[] memory markets = comptroller.getAllMarkets();\n\n for (uint256 j = 0; j < markets.length; j++) {\n address rewardAccumulatorSupply = IVoterView(voter).marketToRewardAccumulators(\n address(markets[j]),\n IVoter.MarketSide.Supply\n );\n address rewardAccumulatorBorrow = IVoterView(voter).marketToRewardAccumulators(\n address(markets[j]),\n IVoter.MarketSide.Borrow\n );\n\n address bribeSupply = IVoterView(voter).rewardAccumulatorToBribe(rewardAccumulatorSupply);\n address bribeBorrow = IVoterView(voter).rewardAccumulatorToBribe(rewardAccumulatorBorrow);\n\n _bribeInfo[count] = BribeInfo({\n market: address(markets[j]),\n bribeSupply: bribeSupply,\n bribeBorrow: bribeBorrow\n });\n count++;\n }\n }\n }\n\n function getAllIncentivesForBribes() external view returns (IncentiveInfo[] memory _incentiveInfo) {\n BribeInfo[] memory _bribeInfo = getAllBribes();\n _incentiveInfo = new IncentiveInfo[](_bribeInfo.length);\n for (uint256 i; i < _bribeInfo.length; i++) {\n _incentiveInfo[i].market = _bribeInfo[i].market;\n if (_bribeInfo[i].bribeSupply != address(0)) {\n _incentiveInfo[i].bribeSupply = _bribeInfo[i].bribeSupply;\n uint256 supplyRewardsLength = IBribeRewardsView(_bribeInfo[i].bribeSupply).rewardsListLength();\n _incentiveInfo[i].rewardsSupply = new address[](supplyRewardsLength);\n _incentiveInfo[i].rewardsSupplyAmounts = new uint256[](supplyRewardsLength);\n _incentiveInfo[i].rewardsSupplyETHValues = new uint256[](supplyRewardsLength);\n for (uint256 j; j < supplyRewardsLength; j++) {\n _incentiveInfo[i].rewardsSupply[j] = IBribeRewardsView(_bribeInfo[i].bribeSupply).rewards(j);\n _incentiveInfo[i].rewardsSupplyAmounts[j] = ERC20(_incentiveInfo[i].rewardsSupply[j]).balanceOf(\n _bribeInfo[i].bribeSupply\n );\n\n uint256 tokenPrice = mpo.price(_incentiveInfo[i].rewardsSupply[j]);\n\n if (tokenPrice != 0) {\n uint256 decimals = ERC20(_incentiveInfo[i].rewardsSupply[j]).decimals();\n _incentiveInfo[i].rewardsSupplyETHValues[j] =\n (_incentiveInfo[i].rewardsSupplyAmounts[j] * 10 ** (18 - decimals) * tokenPrice) /\n PRECISION;\n }\n }\n }\n\n if (_bribeInfo[i].bribeBorrow != address(0)) {\n _incentiveInfo[i].bribeBorrow = _bribeInfo[i].bribeBorrow;\n uint256 borrowRewardsLength = IBribeRewardsView(_bribeInfo[i].bribeBorrow).rewardsListLength();\n _incentiveInfo[i].rewardsBorrow = new address[](borrowRewardsLength);\n _incentiveInfo[i].rewardsBorrowAmounts = new uint256[](borrowRewardsLength);\n _incentiveInfo[i].rewardsBorrowETHValues = new uint256[](borrowRewardsLength);\n for (uint256 j; j < borrowRewardsLength; j++) {\n _incentiveInfo[i].rewardsBorrow[j] = IBribeRewardsView(_bribeInfo[i].bribeBorrow).rewards(j);\n _incentiveInfo[i].rewardsBorrowAmounts[j] = ERC20(_incentiveInfo[i].rewardsBorrow[j]).balanceOf(\n _bribeInfo[i].bribeBorrow\n );\n\n uint256 tokenPrice = mpo.price(_incentiveInfo[i].rewardsBorrow[j]);\n\n if (tokenPrice != 0) {\n uint256 decimals = (ERC20(_incentiveInfo[i].rewardsBorrow[j])).decimals();\n _incentiveInfo[i].rewardsBorrowETHValues[j] =\n (_incentiveInfo[i].rewardsBorrowAmounts[j] * 10 ** (18 - decimals) * tokenPrice) /\n PRECISION;\n }\n }\n }\n }\n }\n\n struct UserBribes {\n uint256 tokenId;\n address market;\n address bribe;\n address reward;\n uint256 earned;\n }\n\n struct UserBribeVars {\n uint256[] userTokens;\n address[] lpTokens;\n uint256 count;\n IVoter.VoteDetails voteDetails;\n address rewardAccumulator;\n address bribeRewards;\n uint256 bribesLength;\n address reward;\n uint256 rewardEarned;\n }\n\n function getUserBribeRewards(address _user) external view returns (UserBribes[] memory _userBribes) {\n UserBribeVars memory vars;\n vars.userTokens = veIONSecondExtension(veIONAddress).getOwnedTokenIds(_user);\n vars.lpTokens = Voter(voter).getAllLpRewardTokens();\n vars.count = 0;\n\n for (uint256 i = 0; i < vars.userTokens.length; i++) {\n for (uint256 j = 0; j < vars.lpTokens.length; j++) {\n vars.voteDetails = IVoterView(voter).getVoteDetails(vars.userTokens[i], vars.lpTokens[j]);\n for (uint256 k; k < vars.voteDetails.marketVotes.length; k++) {\n vars.rewardAccumulator = IVoterView(voter).marketToRewardAccumulators(\n vars.voteDetails.marketVotes[k],\n vars.voteDetails.marketVoteSides[k]\n );\n vars.bribeRewards = IVoterView(voter).rewardAccumulatorToBribe(vars.rewardAccumulator);\n vars.bribesLength = IBribeRewardsView(vars.bribeRewards).rewardsListLength();\n for (uint256 x; x < vars.bribesLength; x++) {\n vars.reward = IBribeRewardsView(vars.bribeRewards).rewards(x);\n vars.rewardEarned = IBribeRewardsView(vars.bribeRewards).earned(vars.reward, vars.userTokens[i]);\n if (vars.rewardEarned != 0) vars.count++;\n }\n }\n }\n }\n\n _userBribes = new UserBribes[](vars.count);\n vars.count = 0;\n for (uint256 i = 0; i < vars.userTokens.length; i++) {\n for (uint256 j = 0; j < vars.lpTokens.length; j++) {\n vars.voteDetails = IVoterView(voter).getVoteDetails(vars.userTokens[i], vars.lpTokens[j]);\n for (uint256 k; k < vars.voteDetails.marketVotes.length; k++) {\n vars.rewardAccumulator = IVoterView(voter).marketToRewardAccumulators(\n vars.voteDetails.marketVotes[k],\n vars.voteDetails.marketVoteSides[k]\n );\n vars.bribeRewards = IVoterView(voter).rewardAccumulatorToBribe(vars.rewardAccumulator);\n vars.bribesLength = IBribeRewardsView(vars.bribeRewards).rewardsListLength();\n for (uint256 x; x < vars.bribesLength; x++) {\n vars.reward = IBribeRewardsView(vars.bribeRewards).rewards(x);\n vars.rewardEarned = IBribeRewardsView(vars.bribeRewards).earned(vars.reward, vars.userTokens[i]);\n if (vars.rewardEarned != 0) {\n _userBribes[vars.count].tokenId = vars.userTokens[i];\n _userBribes[vars.count].market = vars.voteDetails.marketVotes[k];\n _userBribes[vars.count].bribe = vars.bribeRewards;\n _userBribes[vars.count].reward = vars.reward;\n _userBribes[vars.count].earned = vars.rewardEarned;\n\n vars.count++;\n }\n }\n }\n }\n }\n }\n\n function getAllMarketVotes(address lp) public view returns (MarketVoteInfo[] memory _marketVoteInfo) {\n uint256 marketsLength = IVoter(voter).marketsLength();\n _marketVoteInfo = new MarketVoteInfo[](marketsLength);\n for (uint256 i; i < marketsLength; i++) {\n IVoter.Market memory _market = IVoterView(voter).markets(i);\n _marketVoteInfo[i].market = _market.marketAddress;\n _marketVoteInfo[i].side = _market.side;\n _marketVoteInfo[i].votes = IVoterView(voter).weights(_market.marketAddress, _market.side, lp);\n\n _marketVoteInfo[i].votesValueInEth =\n (_marketVoteInfo[i].votes * 10 ** (18 - ERC20(lp).decimals()) * mpo.price(lp)) /\n PRECISION;\n }\n }\n\n function getTotalMarketVotes() external view returns (uint256 _total) {\n address[] memory lpTokens = IVoter(voter).getAllLpRewardTokens();\n for (uint256 i = 0; i < lpTokens.length; i++) {\n MarketVoteInfo[] memory marketVotes = getAllMarketVotes(lpTokens[i]);\n for (uint256 j = 0; j < marketVotes.length; j++) {\n _total += marketVotes[j].votesValueInEth;\n }\n }\n }\n\n function setMasterPriceOracle(address _masterPriceOracle) external onlyOwner {\n mpo = IMasterPriceOracle(_masterPriceOracle);\n }\n\n function setVeIONAddress(address _veIONAddress) external onlyOwner {\n veIONAddress = _veIONAddress;\n }\n}\n\ninterface IVoterView {\n function rewardAccumulatorToBribe(address rewardAccumulator) external view returns (address);\n function marketToRewardAccumulators(address market, IVoter.MarketSide marketSide) external view returns (address);\n function marketVote(uint256 tokenId, address lpAsset) external view returns (address[] memory);\n function marketVoteSide(uint256 tokenId, address lpAsset) external view returns (IVoter.MarketSide[] memory);\n function getVoteDetails(uint256 _tokenId, address _lpAsset) external view returns (IVoter.VoteDetails memory);\n function markets(uint256 index) external view returns (IVoter.Market memory);\n function weights(address market, IVoter.MarketSide marketSide, address lp) external view returns (uint256);\n}\n\ninterface IBribeRewardsView {\n function rewards(uint256 index) external view returns (address);\n function rewardsListLength() external view returns (uint256);\n function earned(address token, uint256 tokenId) external view returns (uint256);\n}\n\ninterface IMasterPriceOracle {\n function price(address underlying) external view returns (uint256);\n}\n" + }, + "ds-test/test.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.5.0;\n\ncontract DSTest {\n event log (string);\n event logs (bytes);\n\n event log_address (address);\n event log_bytes32 (bytes32);\n event log_int (int);\n event log_uint (uint);\n event log_bytes (bytes);\n event log_string (string);\n\n event log_named_address (string key, address val);\n event log_named_bytes32 (string key, bytes32 val);\n event log_named_decimal_int (string key, int val, uint decimals);\n event log_named_decimal_uint (string key, uint val, uint decimals);\n event log_named_int (string key, int val);\n event log_named_uint (string key, uint val);\n event log_named_bytes (string key, bytes val);\n event log_named_string (string key, string val);\n\n bool public IS_TEST = true;\n bool private _failed;\n\n address constant HEVM_ADDRESS =\n address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));\n\n modifier mayRevert() { _; }\n modifier testopts(string memory) { _; }\n\n function failed() public returns (bool) {\n if (_failed) {\n return _failed;\n } else {\n bool globalFailed = false;\n if (hasHEVMContext()) {\n (, bytes memory retdata) = HEVM_ADDRESS.call(\n abi.encodePacked(\n bytes4(keccak256(\"load(address,bytes32)\")),\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"))\n )\n );\n globalFailed = abi.decode(retdata, (bool));\n }\n return globalFailed;\n }\n }\n\n function fail() internal virtual {\n if (hasHEVMContext()) {\n (bool status, ) = HEVM_ADDRESS.call(\n abi.encodePacked(\n bytes4(keccak256(\"store(address,bytes32,bytes32)\")),\n abi.encode(HEVM_ADDRESS, bytes32(\"failed\"), bytes32(uint256(0x01)))\n )\n );\n status; // Silence compiler warnings\n }\n _failed = true;\n }\n\n function hasHEVMContext() internal view returns (bool) {\n uint256 hevmCodeSize = 0;\n assembly {\n hevmCodeSize := extcodesize(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D)\n }\n return hevmCodeSize > 0;\n }\n\n modifier logs_gas() {\n uint startGas = gasleft();\n _;\n uint endGas = gasleft();\n emit log_named_uint(\"gas\", startGas - endGas);\n }\n\n function assertTrue(bool condition) internal {\n if (!condition) {\n emit log(\"Error: Assertion Failed\");\n fail();\n }\n }\n\n function assertTrue(bool condition, string memory err) internal {\n if (!condition) {\n emit log_named_string(\"Error\", err);\n assertTrue(condition);\n }\n }\n\n function assertEq(address a, address b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [address]\");\n emit log_named_address(\" Left\", a);\n emit log_named_address(\" Right\", b);\n fail();\n }\n }\n function assertEq(address a, address b, string memory err) internal {\n if (a != b) {\n emit log_named_string (\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(bytes32 a, bytes32 b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [bytes32]\");\n emit log_named_bytes32(\" Left\", a);\n emit log_named_bytes32(\" Right\", b);\n fail();\n }\n }\n function assertEq(bytes32 a, bytes32 b, string memory err) internal {\n if (a != b) {\n emit log_named_string (\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEq32(bytes32 a, bytes32 b) internal {\n assertEq(a, b);\n }\n function assertEq32(bytes32 a, bytes32 b, string memory err) internal {\n assertEq(a, b, err);\n }\n\n function assertEq(int a, int b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n fail();\n }\n }\n function assertEq(int a, int b, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEq(uint a, uint b) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n fail();\n }\n }\n function assertEq(uint a, uint b, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n function assertEqDecimal(int a, int b, uint decimals) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n fail();\n }\n }\n function assertEqDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEqDecimal(a, b, decimals);\n }\n }\n function assertEqDecimal(uint a, uint b, uint decimals) internal {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n fail();\n }\n }\n function assertEqDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEqDecimal(a, b, decimals);\n }\n }\n\n function assertGt(uint a, uint b) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertGt(uint a, uint b, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGt(a, b);\n }\n }\n function assertGt(int a, int b) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertGt(int a, int b, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGt(a, b);\n }\n }\n function assertGtDecimal(int a, int b, uint decimals) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGtDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGtDecimal(a, b, decimals);\n }\n }\n function assertGtDecimal(uint a, uint b, uint decimals) internal {\n if (a <= b) {\n emit log(\"Error: a > b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a <= b) {\n emit log_named_string(\"Error\", err);\n assertGtDecimal(a, b, decimals);\n }\n }\n\n function assertGe(uint a, uint b) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertGe(uint a, uint b, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGe(a, b);\n }\n }\n function assertGe(int a, int b) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertGe(int a, int b, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGe(a, b);\n }\n }\n function assertGeDecimal(int a, int b, uint decimals) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGeDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGeDecimal(a, b, decimals);\n }\n }\n function assertGeDecimal(uint a, uint b, uint decimals) internal {\n if (a < b) {\n emit log(\"Error: a >= b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertGeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a < b) {\n emit log_named_string(\"Error\", err);\n assertGeDecimal(a, b, decimals);\n }\n }\n\n function assertLt(uint a, uint b) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertLt(uint a, uint b, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLt(a, b);\n }\n }\n function assertLt(int a, int b) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertLt(int a, int b, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLt(a, b);\n }\n }\n function assertLtDecimal(int a, int b, uint decimals) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLtDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLtDecimal(a, b, decimals);\n }\n }\n function assertLtDecimal(uint a, uint b, uint decimals) internal {\n if (a >= b) {\n emit log(\"Error: a < b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a >= b) {\n emit log_named_string(\"Error\", err);\n assertLtDecimal(a, b, decimals);\n }\n }\n\n function assertLe(uint a, uint b) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [uint]\");\n emit log_named_uint(\" Value a\", a);\n emit log_named_uint(\" Value b\", b);\n fail();\n }\n }\n function assertLe(uint a, uint b, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLe(a, b);\n }\n }\n function assertLe(int a, int b) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [int]\");\n emit log_named_int(\" Value a\", a);\n emit log_named_int(\" Value b\", b);\n fail();\n }\n }\n function assertLe(int a, int b, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLe(a, b);\n }\n }\n function assertLeDecimal(int a, int b, uint decimals) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [decimal int]\");\n emit log_named_decimal_int(\" Value a\", a, decimals);\n emit log_named_decimal_int(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLeDecimal(int a, int b, uint decimals, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLeDecimal(a, b, decimals);\n }\n }\n function assertLeDecimal(uint a, uint b, uint decimals) internal {\n if (a > b) {\n emit log(\"Error: a <= b not satisfied [decimal uint]\");\n emit log_named_decimal_uint(\" Value a\", a, decimals);\n emit log_named_decimal_uint(\" Value b\", b, decimals);\n fail();\n }\n }\n function assertLeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n if (a > b) {\n emit log_named_string(\"Error\", err);\n assertLeDecimal(a, b, decimals);\n }\n }\n\n function assertEq(string memory a, string memory b) internal {\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n emit log(\"Error: a == b not satisfied [string]\");\n emit log_named_string(\" Left\", a);\n emit log_named_string(\" Right\", b);\n fail();\n }\n }\n function assertEq(string memory a, string memory b, string memory err) internal {\n if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function checkEq0(bytes memory a, bytes memory b) internal pure returns (bool ok) {\n ok = true;\n if (a.length == b.length) {\n for (uint i = 0; i < a.length; i++) {\n if (a[i] != b[i]) {\n ok = false;\n }\n }\n } else {\n ok = false;\n }\n }\n function assertEq0(bytes memory a, bytes memory b) internal {\n if (!checkEq0(a, b)) {\n emit log(\"Error: a == b not satisfied [bytes]\");\n emit log_named_bytes(\" Left\", a);\n emit log_named_bytes(\" Right\", b);\n fail();\n }\n }\n function assertEq0(bytes memory a, bytes memory b, string memory err) internal {\n if (!checkEq0(a, b)) {\n emit log_named_string(\"Error\", err);\n assertEq0(a, b);\n }\n }\n}\n" + }, + "forge-std/Base.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {StdStorage} from \"./StdStorage.sol\";\nimport {Vm, VmSafe} from \"./Vm.sol\";\n\nabstract contract CommonBase {\n // Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.\n address internal constant VM_ADDRESS = address(uint160(uint256(keccak256(\"hevm cheat code\"))));\n // console.sol and console2.sol work by executing a staticcall to this address.\n address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67;\n // Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38.\n address internal constant DEFAULT_SENDER = address(uint160(uint256(keccak256(\"foundry default caller\"))));\n // Address of the test contract, deployed by the DEFAULT_SENDER.\n address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f;\n // Deterministic deployment address of the Multicall3 contract.\n address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11;\n\n uint256 internal constant UINT256_MAX =\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n Vm internal constant vm = Vm(VM_ADDRESS);\n StdStorage internal stdstore;\n}\n\nabstract contract TestBase is CommonBase {}\n\nabstract contract ScriptBase is CommonBase {\n // Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\n address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\n\n VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS);\n}\n" + }, + "forge-std/console.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nlibrary console {\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n function _sendLogPayload(bytes memory payload) private view {\n uint256 payloadLength = payload.length;\n address consoleAddress = CONSOLE_ADDRESS;\n /// @solidity memory-safe-assembly\n assembly {\n let payloadStart := add(payload, 32)\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n }\n }\n\n function log() internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n }\n\n function logInt(int p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int)\", p0));\n }\n\n function logUint(uint p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n }\n\n function logString(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function logBool(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function logAddress(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function logBytes(bytes memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n }\n\n function logBytes1(bytes1 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n }\n\n function logBytes2(bytes2 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n }\n\n function logBytes3(bytes3 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n }\n\n function logBytes4(bytes4 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n }\n\n function logBytes5(bytes5 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n }\n\n function logBytes6(bytes6 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n }\n\n function logBytes7(bytes7 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n }\n\n function logBytes8(bytes8 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n }\n\n function logBytes9(bytes9 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n }\n\n function logBytes10(bytes10 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n }\n\n function logBytes11(bytes11 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n }\n\n function logBytes12(bytes12 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n }\n\n function logBytes13(bytes13 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n }\n\n function logBytes14(bytes14 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n }\n\n function logBytes15(bytes15 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n }\n\n function logBytes16(bytes16 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n }\n\n function logBytes17(bytes17 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n }\n\n function logBytes18(bytes18 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n }\n\n function logBytes19(bytes19 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n }\n\n function logBytes20(bytes20 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n }\n\n function logBytes21(bytes21 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n }\n\n function logBytes22(bytes22 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n }\n\n function logBytes23(bytes23 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n }\n\n function logBytes24(bytes24 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n }\n\n function logBytes25(bytes25 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n }\n\n function logBytes26(bytes26 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n }\n\n function logBytes27(bytes27 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n }\n\n function logBytes28(bytes28 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n }\n\n function logBytes29(bytes29 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n }\n\n function logBytes30(bytes30 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n }\n\n function logBytes31(bytes31 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n }\n\n function logBytes32(bytes32 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n }\n\n function log(uint p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n }\n\n function log(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function log(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function log(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function log(uint p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint)\", p0, p1));\n }\n\n function log(uint p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string)\", p0, p1));\n }\n\n function log(uint p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool)\", p0, p1));\n }\n\n function log(uint p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address)\", p0, p1));\n }\n\n function log(string memory p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint)\", p0, p1));\n }\n\n function log(string memory p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n }\n\n function log(string memory p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n }\n\n function log(string memory p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n }\n\n function log(bool p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint)\", p0, p1));\n }\n\n function log(bool p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n }\n\n function log(bool p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n }\n\n function log(bool p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n }\n\n function log(address p0, uint p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint)\", p0, p1));\n }\n\n function log(address p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n }\n\n function log(address p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n }\n\n function log(address p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n }\n\n function log(uint p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool)\", p0, p1, p2));\n }\n\n function log(uint p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool)\", p0, p1, p2));\n }\n\n function log(address p0, uint p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, uint p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n }\n\n function log(uint p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, uint p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n }\n\n}" + }, + "forge-std/console2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\n/// @dev The original console.sol uses `int` and `uint` for computing function selectors, but it should\n/// use `int256` and `uint256`. This modified version fixes that. This version is recommended\n/// over `console.sol` if you don't need compatibility with Hardhat as the logs will show up in\n/// forge stack traces. If you do need compatibility with Hardhat, you must use `console.sol`.\n/// Reference: https://github.com/NomicFoundation/hardhat/issues/2178\nlibrary console2 {\n address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n function _sendLogPayload(bytes memory payload) private view {\n uint256 payloadLength = payload.length;\n address consoleAddress = CONSOLE_ADDRESS;\n /// @solidity memory-safe-assembly\n assembly {\n let payloadStart := add(payload, 32)\n let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n }\n }\n\n function log() internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n }\n\n function logInt(int256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n }\n\n function logUint(uint256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n }\n\n function logString(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function logBool(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function logAddress(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function logBytes(bytes memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n }\n\n function logBytes1(bytes1 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n }\n\n function logBytes2(bytes2 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n }\n\n function logBytes3(bytes3 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n }\n\n function logBytes4(bytes4 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n }\n\n function logBytes5(bytes5 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n }\n\n function logBytes6(bytes6 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n }\n\n function logBytes7(bytes7 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n }\n\n function logBytes8(bytes8 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n }\n\n function logBytes9(bytes9 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n }\n\n function logBytes10(bytes10 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n }\n\n function logBytes11(bytes11 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n }\n\n function logBytes12(bytes12 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n }\n\n function logBytes13(bytes13 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n }\n\n function logBytes14(bytes14 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n }\n\n function logBytes15(bytes15 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n }\n\n function logBytes16(bytes16 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n }\n\n function logBytes17(bytes17 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n }\n\n function logBytes18(bytes18 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n }\n\n function logBytes19(bytes19 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n }\n\n function logBytes20(bytes20 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n }\n\n function logBytes21(bytes21 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n }\n\n function logBytes22(bytes22 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n }\n\n function logBytes23(bytes23 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n }\n\n function logBytes24(bytes24 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n }\n\n function logBytes25(bytes25 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n }\n\n function logBytes26(bytes26 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n }\n\n function logBytes27(bytes27 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n }\n\n function logBytes28(bytes28 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n }\n\n function logBytes29(bytes29 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n }\n\n function logBytes30(bytes30 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n }\n\n function logBytes31(bytes31 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n }\n\n function logBytes32(bytes32 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n }\n\n function log(uint256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n }\n\n function log(int256 p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n }\n\n function log(string memory p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n }\n\n function log(bool p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n }\n\n function log(address p0) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n }\n\n function log(uint256 p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256)\", p0, p1));\n }\n\n function log(uint256 p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string)\", p0, p1));\n }\n\n function log(uint256 p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool)\", p0, p1));\n }\n\n function log(uint256 p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address)\", p0, p1));\n }\n\n function log(string memory p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n }\n\n function log(string memory p0, int256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,int256)\", p0, p1));\n }\n\n function log(string memory p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n }\n\n function log(string memory p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n }\n\n function log(string memory p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n }\n\n function log(bool p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256)\", p0, p1));\n }\n\n function log(bool p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n }\n\n function log(bool p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n }\n\n function log(bool p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n }\n\n function log(address p0, uint256 p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256)\", p0, p1));\n }\n\n function log(address p0, string memory p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n }\n\n function log(address p0, bool p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n }\n\n function log(address p0, address p1) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool)\", p0, p1, p2));\n }\n\n function log(uint256 p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n }\n\n function log(string memory p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n }\n\n function log(bool p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool)\", p0, p1, p2));\n }\n\n function log(address p0, uint256 p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n }\n\n function log(address p0, string memory p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n }\n\n function log(address p0, bool p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, uint256 p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, string memory p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, bool p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n }\n\n function log(address p0, address p1, address p2) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(uint256 p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(string memory p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(bool p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, uint256 p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, string memory p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, bool p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, uint256 p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, string memory p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, bool p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, uint256 p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint256)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, string memory p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, bool p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n }\n\n function log(address p0, address p1, address p2, address p3) internal view {\n _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n }\n\n}" + }, + "forge-std/interfaces/IMulticall3.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\ninterface IMulticall3 {\n struct Call {\n address target;\n bytes callData;\n }\n\n struct Call3 {\n address target;\n bool allowFailure;\n bytes callData;\n }\n\n struct Call3Value {\n address target;\n bool allowFailure;\n uint256 value;\n bytes callData;\n }\n\n struct Result {\n bool success;\n bytes returnData;\n }\n\n function aggregate(Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes[] memory returnData);\n\n function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData);\n\n function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData);\n\n function blockAndAggregate(Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\n\n function getBasefee() external view returns (uint256 basefee);\n\n function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash);\n\n function getBlockNumber() external view returns (uint256 blockNumber);\n\n function getChainId() external view returns (uint256 chainid);\n\n function getCurrentBlockCoinbase() external view returns (address coinbase);\n\n function getCurrentBlockDifficulty() external view returns (uint256 difficulty);\n\n function getCurrentBlockGasLimit() external view returns (uint256 gaslimit);\n\n function getCurrentBlockTimestamp() external view returns (uint256 timestamp);\n\n function getEthBalance(address addr) external view returns (uint256 balance);\n\n function getLastBlockHash() external view returns (bytes32 blockHash);\n\n function tryAggregate(bool requireSuccess, Call[] calldata calls)\n external\n payable\n returns (Result[] memory returnData);\n\n function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)\n external\n payable\n returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);\n}\n" + }, + "forge-std/StdAssertions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {DSTest} from \"ds-test/test.sol\";\nimport {stdMath} from \"./StdMath.sol\";\n\nabstract contract StdAssertions is DSTest {\n event log_array(uint256[] val);\n event log_array(int256[] val);\n event log_array(address[] val);\n event log_named_array(string key, uint256[] val);\n event log_named_array(string key, int256[] val);\n event log_named_array(string key, address[] val);\n\n function fail(string memory err) internal virtual {\n emit log_named_string(\"Error\", err);\n fail();\n }\n\n function assertFalse(bool data) internal virtual {\n assertTrue(!data);\n }\n\n function assertFalse(bool data, string memory err) internal virtual {\n assertTrue(!data, err);\n }\n\n function assertEq(bool a, bool b) internal virtual {\n if (a != b) {\n emit log(\"Error: a == b not satisfied [bool]\");\n emit log_named_string(\" Left\", a ? \"true\" : \"false\");\n emit log_named_string(\" Right\", b ? \"true\" : \"false\");\n fail();\n }\n }\n\n function assertEq(bool a, bool b, string memory err) internal virtual {\n if (a != b) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(bytes memory a, bytes memory b) internal virtual {\n assertEq0(a, b);\n }\n\n function assertEq(bytes memory a, bytes memory b, string memory err) internal virtual {\n assertEq0(a, b, err);\n }\n\n function assertEq(uint256[] memory a, uint256[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [uint[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(int256[] memory a, int256[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [int[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(address[] memory a, address[] memory b) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log(\"Error: a == b not satisfied [address[]]\");\n emit log_named_array(\" Left\", a);\n emit log_named_array(\" Right\", b);\n fail();\n }\n }\n\n function assertEq(uint256[] memory a, uint256[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(int256[] memory a, int256[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n function assertEq(address[] memory a, address[] memory b, string memory err) internal virtual {\n if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n emit log_named_string(\"Error\", err);\n assertEq(a, b);\n }\n }\n\n // Legacy helper\n function assertEqUint(uint256 a, uint256 b) internal virtual {\n assertEq(uint256(a), uint256(b));\n }\n\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta, string memory err) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbs(a, b, maxDelta);\n }\n }\n\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\n fail();\n }\n }\n\n function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\n }\n }\n\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n emit log_named_uint(\" Max Delta\", maxDelta);\n emit log_named_uint(\" Delta\", delta);\n fail();\n }\n }\n\n function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta, string memory err) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbs(a, b, maxDelta);\n }\n }\n\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals) internal virtual {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max Delta\", maxDelta, decimals);\n emit log_named_decimal_uint(\" Delta\", delta, decimals);\n fail();\n }\n }\n\n function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n uint256 delta = stdMath.delta(a, b);\n\n if (delta > maxDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqAbsDecimal(a, b, maxDelta, decimals);\n }\n }\n\n function assertApproxEqRel(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100%\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_uint(\" Left\", a);\n emit log_named_uint(\" Right\", b);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRel(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n string memory err\n ) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRel(a, b, maxPercentDelta);\n }\n }\n\n function assertApproxEqRelDecimal(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n uint256 decimals\n ) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [uint]\");\n emit log_named_decimal_uint(\" Left\", a, decimals);\n emit log_named_decimal_uint(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRelDecimal(\n uint256 a,\n uint256 b,\n uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n uint256 decimals,\n string memory err\n ) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\n }\n }\n\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_int(\" Left\", a);\n emit log_named_int(\" Right\", b);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta, string memory err) internal virtual {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRel(a, b, maxPercentDelta);\n }\n }\n\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals) internal virtual {\n if (b == 0) return assertEq(a, b); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log(\"Error: a ~= b not satisfied [int]\");\n emit log_named_decimal_int(\" Left\", a, decimals);\n emit log_named_decimal_int(\" Right\", b, decimals);\n emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n emit log_named_decimal_uint(\" % Delta\", percentDelta, 18);\n fail();\n }\n }\n\n function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals, string memory err)\n internal\n virtual\n {\n if (b == 0) return assertEq(a, b, err); // If the left is 0, right must be too.\n\n uint256 percentDelta = stdMath.percentDelta(a, b);\n\n if (percentDelta > maxPercentDelta) {\n emit log_named_string(\"Error\", err);\n assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals);\n }\n }\n\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB) internal virtual {\n assertEqCall(target, callDataA, target, callDataB, true);\n }\n\n function assertEqCall(address targetA, bytes memory callDataA, address targetB, bytes memory callDataB)\n internal\n virtual\n {\n assertEqCall(targetA, callDataA, targetB, callDataB, true);\n }\n\n function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB, bool strictRevertData)\n internal\n virtual\n {\n assertEqCall(target, callDataA, target, callDataB, strictRevertData);\n }\n\n function assertEqCall(\n address targetA,\n bytes memory callDataA,\n address targetB,\n bytes memory callDataB,\n bool strictRevertData\n ) internal virtual {\n (bool successA, bytes memory returnDataA) = address(targetA).call(callDataA);\n (bool successB, bytes memory returnDataB) = address(targetB).call(callDataB);\n\n if (successA && successB) {\n assertEq(returnDataA, returnDataB, \"Call return data does not match\");\n }\n\n if (!successA && !successB && strictRevertData) {\n assertEq(returnDataA, returnDataB, \"Call revert data does not match\");\n }\n\n if (!successA && successB) {\n emit log(\"Error: Calls were not equal\");\n emit log_named_bytes(\" Left call revert data\", returnDataA);\n emit log_named_bytes(\" Right call return data\", returnDataB);\n fail();\n }\n\n if (successA && !successB) {\n emit log(\"Error: Calls were not equal\");\n emit log_named_bytes(\" Left call return data\", returnDataA);\n emit log_named_bytes(\" Right call revert data\", returnDataB);\n fail();\n }\n }\n}\n" + }, + "forge-std/StdChains.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {VmSafe} from \"./Vm.sol\";\n\n/**\n * StdChains provides information about EVM compatible chains that can be used in scripts/tests.\n * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are\n * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of\n * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the\n * alias used in this contract, which can be found as the first argument to the\n * `setChainWithDefaultRpcUrl` call in the `initialize` function.\n *\n * There are two main ways to use this contract:\n * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or\n * `setChain(string memory chainAlias, Chain memory chain)`\n * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`.\n *\n * The first time either of those are used, chains are initialized with the default set of RPC URLs.\n * This is done in `initialize`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in\n * `defaultRpcUrls`.\n *\n * The `setChain` function is straightforward, and it simply saves off the given chain data.\n *\n * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say\n * we want to retrieve `mainnet`'s RPC URL:\n * - If you haven't set any mainnet chain info with `setChain`, you haven't specified that\n * chain in `foundry.toml` and no env var is set, the default data and RPC URL will be returned.\n * - If you have set a mainnet RPC URL in `foundry.toml` it will return that, if valid (e.g. if\n * a URL is given or if an environment variable is given and that environment variable exists).\n * Otherwise, the default data is returned.\n * - If you specified data with `setChain` it will return that.\n *\n * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults.\n */\nabstract contract StdChains {\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n bool private initialized;\n\n struct ChainData {\n string name;\n uint256 chainId;\n string rpcUrl;\n }\n\n struct Chain {\n // The chain name.\n string name;\n // The chain's Chain ID.\n uint256 chainId;\n // The chain's alias. (i.e. what gets specified in `foundry.toml`).\n string chainAlias;\n // A default RPC endpoint for this chain.\n // NOTE: This default RPC URL is included for convenience to facilitate quick tests and\n // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy\n // usage as you will be throttled and this is a disservice to others who need this endpoint.\n string rpcUrl;\n }\n\n // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data.\n mapping(string => Chain) private chains;\n // Maps from the chain's alias to it's default RPC URL.\n mapping(string => string) private defaultRpcUrls;\n // Maps from a chain ID to it's alias.\n mapping(uint256 => string) private idToAlias;\n\n bool private fallbackToDefaultRpcUrls = true;\n\n // The RPC URL will be fetched from config or defaultRpcUrls if possible.\n function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) {\n require(bytes(chainAlias).length != 0, \"StdChains getChain(string): Chain alias cannot be the empty string.\");\n\n initialize();\n chain = chains[chainAlias];\n require(\n chain.chainId != 0,\n string(abi.encodePacked(\"StdChains getChain(string): Chain with alias \\\"\", chainAlias, \"\\\" not found.\"))\n );\n\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\n }\n\n function getChain(uint256 chainId) internal virtual returns (Chain memory chain) {\n require(chainId != 0, \"StdChains getChain(uint256): Chain ID cannot be 0.\");\n initialize();\n string memory chainAlias = idToAlias[chainId];\n\n chain = chains[chainAlias];\n\n require(\n chain.chainId != 0,\n string(abi.encodePacked(\"StdChains getChain(uint256): Chain with ID \", vm.toString(chainId), \" not found.\"))\n );\n\n chain = getChainWithUpdatedRpcUrl(chainAlias, chain);\n }\n\n // set chain info, with priority to argument's rpcUrl field.\n function setChain(string memory chainAlias, ChainData memory chain) internal virtual {\n require(\n bytes(chainAlias).length != 0,\n \"StdChains setChain(string,ChainData): Chain alias cannot be the empty string.\"\n );\n\n require(chain.chainId != 0, \"StdChains setChain(string,ChainData): Chain ID cannot be 0.\");\n\n initialize();\n string memory foundAlias = idToAlias[chain.chainId];\n\n require(\n bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)),\n string(\n abi.encodePacked(\n \"StdChains setChain(string,ChainData): Chain ID \",\n vm.toString(chain.chainId),\n \" already used by \\\"\",\n foundAlias,\n \"\\\".\"\n )\n )\n );\n\n uint256 oldChainId = chains[chainAlias].chainId;\n delete idToAlias[oldChainId];\n\n chains[chainAlias] =\n Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl});\n idToAlias[chain.chainId] = chainAlias;\n }\n\n // set chain info, with priority to argument's rpcUrl field.\n function setChain(string memory chainAlias, Chain memory chain) internal virtual {\n setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl}));\n }\n\n function _toUpper(string memory str) private pure returns (string memory) {\n bytes memory strb = bytes(str);\n bytes memory copy = new bytes(strb.length);\n for (uint256 i = 0; i < strb.length; i++) {\n bytes1 b = strb[i];\n if (b >= 0x61 && b <= 0x7A) {\n copy[i] = bytes1(uint8(b) - 32);\n } else {\n copy[i] = b;\n }\n }\n return string(copy);\n }\n\n // lookup rpcUrl, in descending order of priority:\n // current -> config (foundry.toml) -> environment variable -> default\n function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) private returns (Chain memory) {\n if (bytes(chain.rpcUrl).length == 0) {\n try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) {\n chain.rpcUrl = configRpcUrl;\n } catch (bytes memory err) {\n string memory envName = string(abi.encodePacked(_toUpper(chainAlias), \"_RPC_URL\"));\n if (fallbackToDefaultRpcUrls) {\n chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]);\n } else {\n chain.rpcUrl = vm.envString(envName);\n }\n // distinguish 'not found' from 'cannot read'\n bytes memory notFoundError =\n abi.encodeWithSignature(\"CheatCodeError\", string(abi.encodePacked(\"invalid rpc url \", chainAlias)));\n if (keccak256(notFoundError) != keccak256(err) || bytes(chain.rpcUrl).length == 0) {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, err), mload(err))\n }\n }\n }\n }\n return chain;\n }\n\n function setFallbackToDefaultRpcUrls(bool useDefault) internal {\n fallbackToDefaultRpcUrls = useDefault;\n }\n\n function initialize() private {\n if (initialized) return;\n\n initialized = true;\n\n // If adding an RPC here, make sure to test the default RPC URL in `testRpcs`\n setChainWithDefaultRpcUrl(\"anvil\", ChainData(\"Anvil\", 31337, \"http://127.0.0.1:8545\"));\n setChainWithDefaultRpcUrl(\n \"mainnet\", ChainData(\"Mainnet\", 1, \"https://mainnet.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\n \"goerli\", ChainData(\"Goerli\", 5, \"https://goerli.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\n \"sepolia\", ChainData(\"Sepolia\", 11155111, \"https://sepolia.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b\")\n );\n setChainWithDefaultRpcUrl(\"optimism\", ChainData(\"Optimism\", 10, \"https://mainnet.optimism.io\"));\n setChainWithDefaultRpcUrl(\"optimism_goerli\", ChainData(\"Optimism Goerli\", 420, \"https://goerli.optimism.io\"));\n setChainWithDefaultRpcUrl(\"arbitrum_one\", ChainData(\"Arbitrum One\", 42161, \"https://arb1.arbitrum.io/rpc\"));\n setChainWithDefaultRpcUrl(\n \"arbitrum_one_goerli\", ChainData(\"Arbitrum One Goerli\", 421613, \"https://goerli-rollup.arbitrum.io/rpc\")\n );\n setChainWithDefaultRpcUrl(\"arbitrum_nova\", ChainData(\"Arbitrum Nova\", 42170, \"https://nova.arbitrum.io/rpc\"));\n setChainWithDefaultRpcUrl(\"polygon\", ChainData(\"Polygon\", 137, \"https://polygon-rpc.com\"));\n setChainWithDefaultRpcUrl(\n \"polygon_mumbai\", ChainData(\"Polygon Mumbai\", 80001, \"https://rpc-mumbai.maticvigil.com\")\n );\n setChainWithDefaultRpcUrl(\"avalanche\", ChainData(\"Avalanche\", 43114, \"https://api.avax.network/ext/bc/C/rpc\"));\n setChainWithDefaultRpcUrl(\n \"avalanche_fuji\", ChainData(\"Avalanche Fuji\", 43113, \"https://api.avax-test.network/ext/bc/C/rpc\")\n );\n setChainWithDefaultRpcUrl(\n \"bnb_smart_chain\", ChainData(\"BNB Smart Chain\", 56, \"https://bsc-dataseed1.binance.org\")\n );\n setChainWithDefaultRpcUrl(\n \"bnb_smart_chain_testnet\",\n ChainData(\"BNB Smart Chain Testnet\", 97, \"https://rpc.ankr.com/bsc_testnet_chapel\")\n );\n setChainWithDefaultRpcUrl(\"gnosis_chain\", ChainData(\"Gnosis Chain\", 100, \"https://rpc.gnosischain.com\"));\n }\n\n // set chain info, with priority to chainAlias' rpc url in foundry.toml\n function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private {\n string memory rpcUrl = chain.rpcUrl;\n defaultRpcUrls[chainAlias] = rpcUrl;\n chain.rpcUrl = \"\";\n setChain(chainAlias, chain);\n chain.rpcUrl = rpcUrl; // restore argument\n }\n}\n" + }, + "forge-std/StdCheats.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\nimport {Vm} from \"./Vm.sol\";\n\nabstract contract StdCheatsSafe {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n bool private gasMeteringOff;\n\n // Data structures to parse Transaction objects from the broadcast artifact\n // that conform to EIP1559. The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct RawTx1559 {\n string[] arguments;\n address contractAddress;\n string contractName;\n // json value name = function\n string functionSig;\n bytes32 hash;\n // json value name = tx\n RawTx1559Detail txDetail;\n // json value name = type\n string opcode;\n }\n\n struct RawTx1559Detail {\n AccessList[] accessList;\n bytes data;\n address from;\n bytes gas;\n bytes nonce;\n address to;\n bytes txType;\n bytes value;\n }\n\n struct Tx1559 {\n string[] arguments;\n address contractAddress;\n string contractName;\n string functionSig;\n bytes32 hash;\n Tx1559Detail txDetail;\n string opcode;\n }\n\n struct Tx1559Detail {\n AccessList[] accessList;\n bytes data;\n address from;\n uint256 gas;\n uint256 nonce;\n address to;\n uint256 txType;\n uint256 value;\n }\n\n // Data structures to parse Transaction objects from the broadcast artifact\n // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct TxLegacy {\n string[] arguments;\n address contractAddress;\n string contractName;\n string functionSig;\n string hash;\n string opcode;\n TxDetailLegacy transaction;\n }\n\n struct TxDetailLegacy {\n AccessList[] accessList;\n uint256 chainId;\n bytes data;\n address from;\n uint256 gas;\n uint256 gasPrice;\n bytes32 hash;\n uint256 nonce;\n bytes1 opcode;\n bytes32 r;\n bytes32 s;\n uint256 txType;\n address to;\n uint8 v;\n uint256 value;\n }\n\n struct AccessList {\n address accessAddress;\n bytes32[] storageKeys;\n }\n\n // Data structures to parse Receipt objects from the broadcast artifact.\n // The Raw structs is what is parsed from the JSON\n // and then converted to the one that is used by the user for better UX.\n\n struct RawReceipt {\n bytes32 blockHash;\n bytes blockNumber;\n address contractAddress;\n bytes cumulativeGasUsed;\n bytes effectiveGasPrice;\n address from;\n bytes gasUsed;\n RawReceiptLog[] logs;\n bytes logsBloom;\n bytes status;\n address to;\n bytes32 transactionHash;\n bytes transactionIndex;\n }\n\n struct Receipt {\n bytes32 blockHash;\n uint256 blockNumber;\n address contractAddress;\n uint256 cumulativeGasUsed;\n uint256 effectiveGasPrice;\n address from;\n uint256 gasUsed;\n ReceiptLog[] logs;\n bytes logsBloom;\n uint256 status;\n address to;\n bytes32 transactionHash;\n uint256 transactionIndex;\n }\n\n // Data structures to parse the entire broadcast artifact, assuming the\n // transactions conform to EIP1559.\n\n struct EIP1559ScriptArtifact {\n string[] libraries;\n string path;\n string[] pending;\n Receipt[] receipts;\n uint256 timestamp;\n Tx1559[] transactions;\n TxReturn[] txReturns;\n }\n\n struct RawEIP1559ScriptArtifact {\n string[] libraries;\n string path;\n string[] pending;\n RawReceipt[] receipts;\n TxReturn[] txReturns;\n uint256 timestamp;\n RawTx1559[] transactions;\n }\n\n struct RawReceiptLog {\n // json value = address\n address logAddress;\n bytes32 blockHash;\n bytes blockNumber;\n bytes data;\n bytes logIndex;\n bool removed;\n bytes32[] topics;\n bytes32 transactionHash;\n bytes transactionIndex;\n bytes transactionLogIndex;\n }\n\n struct ReceiptLog {\n // json value = address\n address logAddress;\n bytes32 blockHash;\n uint256 blockNumber;\n bytes data;\n uint256 logIndex;\n bytes32[] topics;\n uint256 transactionIndex;\n uint256 transactionLogIndex;\n bool removed;\n }\n\n struct TxReturn {\n string internalType;\n string value;\n }\n\n function assumeNoPrecompiles(address addr) internal virtual {\n // Assembly required since `block.chainid` was introduced in 0.8.0.\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n assumeNoPrecompiles(addr, chainId);\n }\n\n function assumeNoPrecompiles(address addr, uint256 chainId) internal pure virtual {\n // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific\n // address), but the same rationale for excluding them applies so we include those too.\n\n // These should be present on all EVM-compatible chains.\n vm.assume(addr < address(0x1) || addr > address(0x9));\n\n // forgefmt: disable-start\n if (chainId == 10 || chainId == 420) {\n // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21\n vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800));\n } else if (chainId == 42161 || chainId == 421613) {\n // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains\n vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068));\n } else if (chainId == 43114 || chainId == 43113) {\n // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59\n vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff));\n vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF));\n vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff));\n }\n // forgefmt: disable-end\n }\n\n function readEIP1559ScriptArtifact(string memory path)\n internal\n view\n virtual\n returns (EIP1559ScriptArtifact memory)\n {\n string memory data = vm.readFile(path);\n bytes memory parsedData = vm.parseJson(data);\n RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact));\n EIP1559ScriptArtifact memory artifact;\n artifact.libraries = rawArtifact.libraries;\n artifact.path = rawArtifact.path;\n artifact.timestamp = rawArtifact.timestamp;\n artifact.pending = rawArtifact.pending;\n artifact.txReturns = rawArtifact.txReturns;\n artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts);\n artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions);\n return artifact;\n }\n\n function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) {\n Tx1559[] memory txs = new Tx1559[](rawTxs.length);\n for (uint256 i; i < rawTxs.length; i++) {\n txs[i] = rawToConvertedEIPTx1559(rawTxs[i]);\n }\n return txs;\n }\n\n function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) {\n Tx1559 memory transaction;\n transaction.arguments = rawTx.arguments;\n transaction.contractName = rawTx.contractName;\n transaction.functionSig = rawTx.functionSig;\n transaction.hash = rawTx.hash;\n transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail);\n transaction.opcode = rawTx.opcode;\n return transaction;\n }\n\n function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail)\n internal\n pure\n virtual\n returns (Tx1559Detail memory)\n {\n Tx1559Detail memory txDetail;\n txDetail.data = rawDetail.data;\n txDetail.from = rawDetail.from;\n txDetail.to = rawDetail.to;\n txDetail.nonce = _bytesToUint(rawDetail.nonce);\n txDetail.txType = _bytesToUint(rawDetail.txType);\n txDetail.value = _bytesToUint(rawDetail.value);\n txDetail.gas = _bytesToUint(rawDetail.gas);\n txDetail.accessList = rawDetail.accessList;\n return txDetail;\n }\n\n function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) {\n string memory deployData = vm.readFile(path);\n bytes memory parsedDeployData = vm.parseJson(deployData, \".transactions\");\n RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[]));\n return rawToConvertedEIPTx1559s(rawTxs);\n }\n\n function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) {\n string memory deployData = vm.readFile(path);\n string memory key = string(abi.encodePacked(\".transactions[\", vm.toString(index), \"]\"));\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\n RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559));\n return rawToConvertedEIPTx1559(rawTx);\n }\n\n // Analogous to readTransactions, but for receipts.\n function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) {\n string memory deployData = vm.readFile(path);\n bytes memory parsedDeployData = vm.parseJson(deployData, \".receipts\");\n RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[]));\n return rawToConvertedReceipts(rawReceipts);\n }\n\n function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) {\n string memory deployData = vm.readFile(path);\n string memory key = string(abi.encodePacked(\".receipts[\", vm.toString(index), \"]\"));\n bytes memory parsedDeployData = vm.parseJson(deployData, key);\n RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt));\n return rawToConvertedReceipt(rawReceipt);\n }\n\n function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) {\n Receipt[] memory receipts = new Receipt[](rawReceipts.length);\n for (uint256 i; i < rawReceipts.length; i++) {\n receipts[i] = rawToConvertedReceipt(rawReceipts[i]);\n }\n return receipts;\n }\n\n function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) {\n Receipt memory receipt;\n receipt.blockHash = rawReceipt.blockHash;\n receipt.to = rawReceipt.to;\n receipt.from = rawReceipt.from;\n receipt.contractAddress = rawReceipt.contractAddress;\n receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice);\n receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed);\n receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed);\n receipt.status = _bytesToUint(rawReceipt.status);\n receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex);\n receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber);\n receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs);\n receipt.logsBloom = rawReceipt.logsBloom;\n receipt.transactionHash = rawReceipt.transactionHash;\n return receipt;\n }\n\n function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs)\n internal\n pure\n virtual\n returns (ReceiptLog[] memory)\n {\n ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length);\n for (uint256 i; i < rawLogs.length; i++) {\n logs[i].logAddress = rawLogs[i].logAddress;\n logs[i].blockHash = rawLogs[i].blockHash;\n logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber);\n logs[i].data = rawLogs[i].data;\n logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex);\n logs[i].topics = rawLogs[i].topics;\n logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex);\n logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex);\n logs[i].removed = rawLogs[i].removed;\n }\n return logs;\n }\n\n // Deploy a contract by fetching the contract bytecode from\n // the artifacts directory\n // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))`\n function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) {\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,bytes): Deployment failed.\");\n }\n\n function deployCode(string memory what) internal virtual returns (address addr) {\n bytes memory bytecode = vm.getCode(what);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(0, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string): Deployment failed.\");\n }\n\n /// @dev deploy contract with value on construction\n function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) {\n bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,bytes,uint256): Deployment failed.\");\n }\n\n function deployCode(string memory what, uint256 val) internal virtual returns (address addr) {\n bytes memory bytecode = vm.getCode(what);\n /// @solidity memory-safe-assembly\n assembly {\n addr := create(val, add(bytecode, 0x20), mload(bytecode))\n }\n\n require(addr != address(0), \"StdCheats deployCode(string,uint256): Deployment failed.\");\n }\n\n // creates a labeled address and the corresponding private key\n function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) {\n privateKey = uint256(keccak256(abi.encodePacked(name)));\n addr = vm.addr(privateKey);\n vm.label(addr, name);\n }\n\n // creates a labeled address\n function makeAddr(string memory name) internal virtual returns (address addr) {\n (addr,) = makeAddrAndKey(name);\n }\n\n function deriveRememberKey(string memory mnemonic, uint32 index)\n internal\n virtual\n returns (address who, uint256 privateKey)\n {\n privateKey = vm.deriveKey(mnemonic, index);\n who = vm.rememberKey(privateKey);\n }\n\n function _bytesToUint(bytes memory b) private pure returns (uint256) {\n require(b.length <= 32, \"StdCheats _bytesToUint(bytes): Bytes length exceeds 32.\");\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\n }\n\n function isFork() internal view virtual returns (bool status) {\n try vm.activeFork() {\n status = true;\n } catch (bytes memory) {}\n }\n\n modifier skipWhenForking() {\n if (!isFork()) {\n _;\n }\n }\n\n modifier skipWhenNotForking() {\n if (isFork()) {\n _;\n }\n }\n\n modifier noGasMetering() {\n vm.pauseGasMetering();\n // To prevent turning gas monitoring back on with nested functions that use this modifier,\n // we check if gasMetering started in the off position. If it did, we don't want to turn\n // it back on until we exit the top level function that used the modifier\n //\n // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well.\n // funcA will have `gasStartedOff` as false, funcB will have it as true,\n // so we only turn metering back on at the end of the funcA\n bool gasStartedOff = gasMeteringOff;\n gasMeteringOff = true;\n\n _;\n\n // if gas metering was on when this modifier was called, turn it back on at the end\n if (!gasStartedOff) {\n gasMeteringOff = false;\n vm.resumeGasMetering();\n }\n }\n\n // a cheat for fuzzing addresses that are payable only\n // see https://github.com/foundry-rs/foundry/issues/3631\n function assumePayable(address addr) internal virtual {\n (bool success,) = payable(addr).call{value: 0}(\"\");\n vm.assume(success);\n }\n}\n\n// Wrappers around cheatcodes to avoid footguns\nabstract contract StdCheats is StdCheatsSafe {\n using stdStorage for StdStorage;\n\n StdStorage private stdstore;\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n // Skip forward or rewind time by the specified number of seconds\n function skip(uint256 time) internal virtual {\n vm.warp(block.timestamp + time);\n }\n\n function rewind(uint256 time) internal virtual {\n vm.warp(block.timestamp - time);\n }\n\n // Setup a prank from an address that has some ether\n function hoax(address msgSender) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.prank(msgSender);\n }\n\n function hoax(address msgSender, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.prank(msgSender);\n }\n\n function hoax(address msgSender, address origin) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.prank(msgSender, origin);\n }\n\n function hoax(address msgSender, address origin, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.prank(msgSender, origin);\n }\n\n // Start perpetual prank from an address that has some ether\n function startHoax(address msgSender) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.startPrank(msgSender);\n }\n\n function startHoax(address msgSender, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.startPrank(msgSender);\n }\n\n // Start perpetual prank from an address that has some ether\n // tx.origin is set to the origin parameter\n function startHoax(address msgSender, address origin) internal virtual {\n vm.deal(msgSender, 1 << 128);\n vm.startPrank(msgSender, origin);\n }\n\n function startHoax(address msgSender, address origin, uint256 give) internal virtual {\n vm.deal(msgSender, give);\n vm.startPrank(msgSender, origin);\n }\n\n function changePrank(address msgSender) internal virtual {\n vm.stopPrank();\n vm.startPrank(msgSender);\n }\n\n // The same as Vm's `deal`\n // Use the alternative signature for ERC20 tokens\n function deal(address to, uint256 give) internal virtual {\n vm.deal(to, give);\n }\n\n // Set the balance of an account for any ERC20 token\n // Use the alternative signature to update `totalSupply`\n function deal(address token, address to, uint256 give) internal virtual {\n deal(token, to, give, false);\n }\n\n // Set the balance of an account for any ERC1155 token\n // Use the alternative signature to update `totalSupply`\n function dealERC1155(address token, address to, uint256 id, uint256 give) internal virtual {\n dealERC1155(token, to, id, give, false);\n }\n\n function deal(address token, address to, uint256 give, bool adjust) internal virtual {\n // get current balance\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n uint256 prevBal = abi.decode(balData, (uint256));\n\n // update balance\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give);\n\n // update total supply\n if (adjust) {\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0x18160ddd));\n uint256 totSup = abi.decode(totSupData, (uint256));\n if (give < prevBal) {\n totSup -= (prevBal - give);\n } else {\n totSup += (give - prevBal);\n }\n stdstore.target(token).sig(0x18160ddd).checked_write(totSup);\n }\n }\n\n function dealERC1155(address token, address to, uint256 id, uint256 give, bool adjust) internal virtual {\n // get current balance\n (, bytes memory balData) = token.call(abi.encodeWithSelector(0x00fdd58e, to, id));\n uint256 prevBal = abi.decode(balData, (uint256));\n\n // update balance\n stdstore.target(token).sig(0x00fdd58e).with_key(to).with_key(id).checked_write(give);\n\n // update total supply\n if (adjust) {\n (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0xbd85b039, id));\n require(\n totSupData.length != 0,\n \"StdCheats deal(address,address,uint,uint,bool): target contract is not ERC1155Supply.\"\n );\n uint256 totSup = abi.decode(totSupData, (uint256));\n if (give < prevBal) {\n totSup -= (prevBal - give);\n } else {\n totSup += (give - prevBal);\n }\n stdstore.target(token).sig(0xbd85b039).with_key(id).checked_write(totSup);\n }\n }\n\n function dealERC721(address token, address to, uint256 id) internal virtual {\n // check if token id is already minted and the actual owner.\n (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id));\n require(successMinted, \"StdCheats deal(address,address,uint,bool): id not minted.\");\n\n // get owner current balance\n (, bytes memory fromBalData) = token.call(abi.encodeWithSelector(0x70a08231, abi.decode(ownerData, (address))));\n uint256 fromPrevBal = abi.decode(fromBalData, (uint256));\n\n // get new user current balance\n (, bytes memory toBalData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n uint256 toPrevBal = abi.decode(toBalData, (uint256));\n\n // update balances\n stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal);\n stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal);\n\n // update owner\n stdstore.target(token).sig(0x6352211e).with_key(id).checked_write(to);\n }\n}\n" + }, + "forge-std/StdError.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test\npragma solidity >=0.6.2 <0.9.0;\n\nlibrary stdError {\n bytes public constant assertionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x01);\n bytes public constant arithmeticError = abi.encodeWithSignature(\"Panic(uint256)\", 0x11);\n bytes public constant divisionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x12);\n bytes public constant enumConversionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x21);\n bytes public constant encodeStorageError = abi.encodeWithSignature(\"Panic(uint256)\", 0x22);\n bytes public constant popError = abi.encodeWithSignature(\"Panic(uint256)\", 0x31);\n bytes public constant indexOOBError = abi.encodeWithSignature(\"Panic(uint256)\", 0x32);\n bytes public constant memOverflowError = abi.encodeWithSignature(\"Panic(uint256)\", 0x41);\n bytes public constant zeroVarError = abi.encodeWithSignature(\"Panic(uint256)\", 0x51);\n}\n" + }, + "forge-std/StdInvariant.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\ncontract StdInvariant {\n struct FuzzSelector {\n address addr;\n bytes4[] selectors;\n }\n\n address[] private _excludedContracts;\n address[] private _excludedSenders;\n address[] private _targetedContracts;\n address[] private _targetedSenders;\n\n string[] private _excludedArtifacts;\n string[] private _targetedArtifacts;\n\n FuzzSelector[] private _targetedArtifactSelectors;\n FuzzSelector[] private _targetedSelectors;\n\n // Functions for users:\n // These are intended to be called in tests.\n\n function excludeContract(address newExcludedContract_) internal {\n _excludedContracts.push(newExcludedContract_);\n }\n\n function excludeSender(address newExcludedSender_) internal {\n _excludedSenders.push(newExcludedSender_);\n }\n\n function excludeArtifact(string memory newExcludedArtifact_) internal {\n _excludedArtifacts.push(newExcludedArtifact_);\n }\n\n function targetArtifact(string memory newTargetedArtifact_) internal {\n _targetedArtifacts.push(newTargetedArtifact_);\n }\n\n function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal {\n _targetedArtifactSelectors.push(newTargetedArtifactSelector_);\n }\n\n function targetContract(address newTargetedContract_) internal {\n _targetedContracts.push(newTargetedContract_);\n }\n\n function targetSelector(FuzzSelector memory newTargetedSelector_) internal {\n _targetedSelectors.push(newTargetedSelector_);\n }\n\n function targetSender(address newTargetedSender_) internal {\n _targetedSenders.push(newTargetedSender_);\n }\n\n // Functions for forge:\n // These are called by forge to run invariant tests and don't need to be called in tests.\n\n function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) {\n excludedArtifacts_ = _excludedArtifacts;\n }\n\n function excludeContracts() public view returns (address[] memory excludedContracts_) {\n excludedContracts_ = _excludedContracts;\n }\n\n function excludeSenders() public view returns (address[] memory excludedSenders_) {\n excludedSenders_ = _excludedSenders;\n }\n\n function targetArtifacts() public view returns (string[] memory targetedArtifacts_) {\n targetedArtifacts_ = _targetedArtifacts;\n }\n\n function targetArtifactSelectors() public view returns (FuzzSelector[] memory targetedArtifactSelectors_) {\n targetedArtifactSelectors_ = _targetedArtifactSelectors;\n }\n\n function targetContracts() public view returns (address[] memory targetedContracts_) {\n targetedContracts_ = _targetedContracts;\n }\n\n function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) {\n targetedSelectors_ = _targetedSelectors;\n }\n\n function targetSenders() public view returns (address[] memory targetedSenders_) {\n targetedSenders_ = _targetedSenders;\n }\n}\n" + }, + "forge-std/StdJson.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {VmSafe} from \"./Vm.sol\";\n\n// Helpers for parsing and writing JSON files\n// To parse:\n// ```\n// using stdJson for string;\n// string memory json = vm.readFile(\"some_peth\");\n// json.parseUint(\"\");\n// ```\n// To write:\n// ```\n// using stdJson for string;\n// string memory json = \"deploymentArtifact\";\n// Contract contract = new Contract();\n// json.serialize(\"contractAddress\", address(contract));\n// json = json.serialize(\"deploymentTimes\", uint(1));\n// // store the stringified JSON to the 'json' variable we have been using as a key\n// // as we won't need it any longer\n// string memory json2 = \"finalArtifact\";\n// string memory final = json2.serialize(\"depArtifact\", json);\n// final.write(\"\");\n// ```\n\nlibrary stdJson {\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) {\n return vm.parseJson(json, key);\n }\n\n function readUint(string memory json, string memory key) internal returns (uint256) {\n return vm.parseJsonUint(json, key);\n }\n\n function readUintArray(string memory json, string memory key) internal returns (uint256[] memory) {\n return vm.parseJsonUintArray(json, key);\n }\n\n function readInt(string memory json, string memory key) internal returns (int256) {\n return vm.parseJsonInt(json, key);\n }\n\n function readIntArray(string memory json, string memory key) internal returns (int256[] memory) {\n return vm.parseJsonIntArray(json, key);\n }\n\n function readBytes32(string memory json, string memory key) internal returns (bytes32) {\n return vm.parseJsonBytes32(json, key);\n }\n\n function readBytes32Array(string memory json, string memory key) internal returns (bytes32[] memory) {\n return vm.parseJsonBytes32Array(json, key);\n }\n\n function readString(string memory json, string memory key) internal returns (string memory) {\n return vm.parseJsonString(json, key);\n }\n\n function readStringArray(string memory json, string memory key) internal returns (string[] memory) {\n return vm.parseJsonStringArray(json, key);\n }\n\n function readAddress(string memory json, string memory key) internal returns (address) {\n return vm.parseJsonAddress(json, key);\n }\n\n function readAddressArray(string memory json, string memory key) internal returns (address[] memory) {\n return vm.parseJsonAddressArray(json, key);\n }\n\n function readBool(string memory json, string memory key) internal returns (bool) {\n return vm.parseJsonBool(json, key);\n }\n\n function readBoolArray(string memory json, string memory key) internal returns (bool[] memory) {\n return vm.parseJsonBoolArray(json, key);\n }\n\n function readBytes(string memory json, string memory key) internal returns (bytes memory) {\n return vm.parseJsonBytes(json, key);\n }\n\n function readBytesArray(string memory json, string memory key) internal returns (bytes[] memory) {\n return vm.parseJsonBytesArray(json, key);\n }\n\n function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) {\n return vm.serializeBool(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bool[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBool(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) {\n return vm.serializeUint(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, uint256[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeUint(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) {\n return vm.serializeInt(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, int256[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeInt(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) {\n return vm.serializeAddress(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, address[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeAddress(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) {\n return vm.serializeBytes32(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes32[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBytes32(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) {\n return vm.serializeBytes(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, bytes[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeBytes(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, string memory value)\n internal\n returns (string memory)\n {\n return vm.serializeString(jsonKey, key, value);\n }\n\n function serialize(string memory jsonKey, string memory key, string[] memory value)\n internal\n returns (string memory)\n {\n return vm.serializeString(jsonKey, key, value);\n }\n\n function write(string memory jsonKey, string memory path) internal {\n vm.writeJson(jsonKey, path);\n }\n\n function write(string memory jsonKey, string memory path, string memory valueKey) internal {\n vm.writeJson(jsonKey, path, valueKey);\n }\n}\n" + }, + "forge-std/StdMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nlibrary stdMath {\n int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968;\n\n function abs(int256 a) internal pure returns (uint256) {\n // Required or it will fail when `a = type(int256).min`\n if (a == INT256_MIN) {\n return 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n }\n\n return uint256(a > 0 ? a : -a);\n }\n\n function delta(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : b - a;\n }\n\n function delta(int256 a, int256 b) internal pure returns (uint256) {\n // a and b are of the same sign\n // this works thanks to two's complement, the left-most bit is the sign bit\n if ((a ^ b) > -1) {\n return delta(abs(a), abs(b));\n }\n\n // a and b are of opposite signs\n return abs(a) + abs(b);\n }\n\n function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 absDelta = delta(a, b);\n\n return absDelta * 1e18 / b;\n }\n\n function percentDelta(int256 a, int256 b) internal pure returns (uint256) {\n uint256 absDelta = delta(a, b);\n uint256 absB = abs(b);\n\n return absDelta * 1e18 / absB;\n }\n}\n" + }, + "forge-std/StdStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\nimport {Vm} from \"./Vm.sol\";\n\nstruct StdStorage {\n mapping(address => mapping(bytes4 => mapping(bytes32 => uint256))) slots;\n mapping(address => mapping(bytes4 => mapping(bytes32 => bool))) finds;\n bytes32[] _keys;\n bytes4 _sig;\n uint256 _depth;\n address _target;\n bytes32 _set;\n}\n\nlibrary stdStorageSafe {\n event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot);\n event WARNING_UninitedSlot(address who, uint256 slot);\n\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function sigs(string memory sigStr) internal pure returns (bytes4) {\n return bytes4(keccak256(bytes(sigStr)));\n }\n\n /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against\n // slot complexity:\n // if flat, will be bytes32(uint256(uint));\n // if map, will be keccak256(abi.encode(key, uint(slot)));\n // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))));\n // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth);\n function find(StdStorage storage self) internal returns (uint256) {\n address who = self._target;\n bytes4 fsig = self._sig;\n uint256 field_depth = self._depth;\n bytes32[] memory ins = self._keys;\n\n // calldata to test against\n if (self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n }\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n vm.record();\n bytes32 fdat;\n {\n (, bytes memory rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n\n (bytes32[] memory reads,) = vm.accesses(address(who));\n if (reads.length == 1) {\n bytes32 curr = vm.load(who, reads[0]);\n if (curr == bytes32(0)) {\n emit WARNING_UninitedSlot(who, uint256(reads[0]));\n }\n if (fdat != curr) {\n require(\n false,\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\n );\n }\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[0]));\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[0]);\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n } else if (reads.length > 1) {\n for (uint256 i = 0; i < reads.length; i++) {\n bytes32 prev = vm.load(who, reads[i]);\n if (prev == bytes32(0)) {\n emit WARNING_UninitedSlot(who, uint256(reads[i]));\n }\n // store\n vm.store(who, reads[i], bytes32(hex\"1337\"));\n bool success;\n bytes memory rdat;\n {\n (success, rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n\n if (success && fdat == bytes32(hex\"1337\")) {\n // we found which of the slots is the actual one\n emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[i]));\n self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[i]);\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n vm.store(who, reads[i], prev);\n break;\n }\n vm.store(who, reads[i], prev);\n }\n } else {\n revert(\"stdStorage find(StdStorage): No storage use detected for target.\");\n }\n\n require(\n self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))],\n \"stdStorage find(StdStorage): Slot(s) not found.\"\n );\n\n delete self._target;\n delete self._sig;\n delete self._keys;\n delete self._depth;\n\n return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n }\n\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n self._target = _target;\n return self;\n }\n\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n self._sig = _sig;\n return self;\n }\n\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n self._sig = sigs(_sig);\n return self;\n }\n\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n self._keys.push(bytes32(uint256(uint160(who))));\n return self;\n }\n\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n self._keys.push(bytes32(amt));\n return self;\n }\n\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n self._keys.push(key);\n return self;\n }\n\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n self._depth = _depth;\n return self;\n }\n\n function read(StdStorage storage self) private returns (bytes memory) {\n address t = self._target;\n uint256 s = find(self);\n return abi.encode(vm.load(t, bytes32(s)));\n }\n\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n return abi.decode(read(self), (bytes32));\n }\n\n function read_bool(StdStorage storage self) internal returns (bool) {\n int256 v = read_int(self);\n if (v == 0) return false;\n if (v == 1) return true;\n revert(\"stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool.\");\n }\n\n function read_address(StdStorage storage self) internal returns (address) {\n return abi.decode(read(self), (address));\n }\n\n function read_uint(StdStorage storage self) internal returns (uint256) {\n return abi.decode(read(self), (uint256));\n }\n\n function read_int(StdStorage storage self) internal returns (int256) {\n return abi.decode(read(self), (int256));\n }\n\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\n bytes32 out;\n\n uint256 max = b.length > 32 ? 32 : b.length;\n for (uint256 i = 0; i < max; i++) {\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n }\n return out;\n }\n\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\n bytes memory result = new bytes(b.length * 32);\n for (uint256 i = 0; i < b.length; i++) {\n bytes32 k = b[i];\n /// @solidity memory-safe-assembly\n assembly {\n mstore(add(result, add(32, mul(32, i))), k)\n }\n }\n\n return result;\n }\n}\n\nlibrary stdStorage {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n function sigs(string memory sigStr) internal pure returns (bytes4) {\n return stdStorageSafe.sigs(sigStr);\n }\n\n function find(StdStorage storage self) internal returns (uint256) {\n return stdStorageSafe.find(self);\n }\n\n function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n return stdStorageSafe.target(self, _target);\n }\n\n function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n return stdStorageSafe.sig(self, _sig);\n }\n\n function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n return stdStorageSafe.sig(self, _sig);\n }\n\n function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, who);\n }\n\n function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, amt);\n }\n\n function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n return stdStorageSafe.with_key(self, key);\n }\n\n function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n return stdStorageSafe.depth(self, _depth);\n }\n\n function checked_write(StdStorage storage self, address who) internal {\n checked_write(self, bytes32(uint256(uint160(who))));\n }\n\n function checked_write(StdStorage storage self, uint256 amt) internal {\n checked_write(self, bytes32(amt));\n }\n\n function checked_write(StdStorage storage self, bool write) internal {\n bytes32 t;\n /// @solidity memory-safe-assembly\n assembly {\n t := write\n }\n checked_write(self, t);\n }\n\n function checked_write(StdStorage storage self, bytes32 set) internal {\n address who = self._target;\n bytes4 fsig = self._sig;\n uint256 field_depth = self._depth;\n bytes32[] memory ins = self._keys;\n\n bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n if (!self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n find(self);\n }\n bytes32 slot = bytes32(self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]);\n\n bytes32 fdat;\n {\n (, bytes memory rdat) = who.staticcall(cald);\n fdat = bytesToBytes32(rdat, 32 * field_depth);\n }\n bytes32 curr = vm.load(who, slot);\n\n if (fdat != curr) {\n require(\n false,\n \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\"\n );\n }\n vm.store(who, slot, set);\n delete self._target;\n delete self._sig;\n delete self._keys;\n delete self._depth;\n }\n\n function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n return stdStorageSafe.read_bytes32(self);\n }\n\n function read_bool(StdStorage storage self) internal returns (bool) {\n return stdStorageSafe.read_bool(self);\n }\n\n function read_address(StdStorage storage self) internal returns (address) {\n return stdStorageSafe.read_address(self);\n }\n\n function read_uint(StdStorage storage self) internal returns (uint256) {\n return stdStorageSafe.read_uint(self);\n }\n\n function read_int(StdStorage storage self) internal returns (int256) {\n return stdStorageSafe.read_int(self);\n }\n\n // Private function so needs to be copied over\n function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) {\n bytes32 out;\n\n uint256 max = b.length > 32 ? 32 : b.length;\n for (uint256 i = 0; i < max; i++) {\n out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n }\n return out;\n }\n\n // Private function so needs to be copied over\n function flatten(bytes32[] memory b) private pure returns (bytes memory) {\n bytes memory result = new bytes(b.length * 32);\n for (uint256 i = 0; i < b.length; i++) {\n bytes32 k = b[i];\n /// @solidity memory-safe-assembly\n assembly {\n mstore(add(result, add(32, mul(32, i))), k)\n }\n }\n\n return result;\n }\n}\n" + }, + "forge-std/StdStyle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nimport {Vm} from \"./Vm.sol\";\n\nlibrary StdStyle {\n Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n string constant RED = \"\\u001b[91m\";\n string constant GREEN = \"\\u001b[92m\";\n string constant YELLOW = \"\\u001b[93m\";\n string constant BLUE = \"\\u001b[94m\";\n string constant MAGENTA = \"\\u001b[95m\";\n string constant CYAN = \"\\u001b[96m\";\n string constant BOLD = \"\\u001b[1m\";\n string constant DIM = \"\\u001b[2m\";\n string constant ITALIC = \"\\u001b[3m\";\n string constant UNDERLINE = \"\\u001b[4m\";\n string constant INVERSE = \"\\u001b[7m\";\n string constant RESET = \"\\u001b[0m\";\n\n function styleConcat(string memory style, string memory self) private pure returns (string memory) {\n return string(abi.encodePacked(style, self, RESET));\n }\n\n function red(string memory self) internal pure returns (string memory) {\n return styleConcat(RED, self);\n }\n\n function red(uint256 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(int256 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(address self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function red(bool self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function redBytes(bytes memory self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function redBytes32(bytes32 self) internal pure returns (string memory) {\n return red(vm.toString(self));\n }\n\n function green(string memory self) internal pure returns (string memory) {\n return styleConcat(GREEN, self);\n }\n\n function green(uint256 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(int256 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(address self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function green(bool self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function greenBytes(bytes memory self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function greenBytes32(bytes32 self) internal pure returns (string memory) {\n return green(vm.toString(self));\n }\n\n function yellow(string memory self) internal pure returns (string memory) {\n return styleConcat(YELLOW, self);\n }\n\n function yellow(uint256 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(int256 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(address self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellow(bool self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellowBytes(bytes memory self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function yellowBytes32(bytes32 self) internal pure returns (string memory) {\n return yellow(vm.toString(self));\n }\n\n function blue(string memory self) internal pure returns (string memory) {\n return styleConcat(BLUE, self);\n }\n\n function blue(uint256 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(int256 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(address self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blue(bool self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blueBytes(bytes memory self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function blueBytes32(bytes32 self) internal pure returns (string memory) {\n return blue(vm.toString(self));\n }\n\n function magenta(string memory self) internal pure returns (string memory) {\n return styleConcat(MAGENTA, self);\n }\n\n function magenta(uint256 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(int256 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(address self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magenta(bool self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magentaBytes(bytes memory self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function magentaBytes32(bytes32 self) internal pure returns (string memory) {\n return magenta(vm.toString(self));\n }\n\n function cyan(string memory self) internal pure returns (string memory) {\n return styleConcat(CYAN, self);\n }\n\n function cyan(uint256 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(int256 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(address self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyan(bool self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyanBytes(bytes memory self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function cyanBytes32(bytes32 self) internal pure returns (string memory) {\n return cyan(vm.toString(self));\n }\n\n function bold(string memory self) internal pure returns (string memory) {\n return styleConcat(BOLD, self);\n }\n\n function bold(uint256 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(int256 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(address self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function bold(bool self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function boldBytes(bytes memory self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function boldBytes32(bytes32 self) internal pure returns (string memory) {\n return bold(vm.toString(self));\n }\n\n function dim(string memory self) internal pure returns (string memory) {\n return styleConcat(DIM, self);\n }\n\n function dim(uint256 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(int256 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(address self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dim(bool self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dimBytes(bytes memory self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function dimBytes32(bytes32 self) internal pure returns (string memory) {\n return dim(vm.toString(self));\n }\n\n function italic(string memory self) internal pure returns (string memory) {\n return styleConcat(ITALIC, self);\n }\n\n function italic(uint256 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(int256 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(address self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italic(bool self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italicBytes(bytes memory self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function italicBytes32(bytes32 self) internal pure returns (string memory) {\n return italic(vm.toString(self));\n }\n\n function underline(string memory self) internal pure returns (string memory) {\n return styleConcat(UNDERLINE, self);\n }\n\n function underline(uint256 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(int256 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(address self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underline(bool self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underlineBytes(bytes memory self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function underlineBytes32(bytes32 self) internal pure returns (string memory) {\n return underline(vm.toString(self));\n }\n\n function inverse(string memory self) internal pure returns (string memory) {\n return styleConcat(INVERSE, self);\n }\n\n function inverse(uint256 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(int256 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(address self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverse(bool self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverseBytes(bytes memory self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n\n function inverseBytes32(bytes32 self) internal pure returns (string memory) {\n return inverse(vm.toString(self));\n }\n}\n" + }, + "forge-std/StdUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nimport {IMulticall3} from \"./interfaces/IMulticall3.sol\";\n// TODO Remove import.\nimport {VmSafe} from \"./Vm.sol\";\n\nabstract contract StdUtils {\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n //////////////////////////////////////////////////////////////////////////*/\n\n IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11);\n VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;\n uint256 private constant INT256_MIN_ABS =\n 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n uint256 private constant UINT256_MAX =\n 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.\n address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;\n\n /*//////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) {\n require(min <= max, \"StdUtils bound(uint256,uint256,uint256): Max is less than min.\");\n // If x is between min and max, return x directly. This is to ensure that dictionary values\n // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188\n if (x >= min && x <= max) return x;\n\n uint256 size = max - min + 1;\n\n // If the value is 0, 1, 2, 3, warp that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side.\n // This helps ensure coverage of the min/max values.\n if (x <= 3 && size > x) return min + x;\n if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x);\n\n // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive.\n if (x > max) {\n uint256 diff = x - max;\n uint256 rem = diff % size;\n if (rem == 0) return max;\n result = min + rem - 1;\n } else if (x < min) {\n uint256 diff = min - x;\n uint256 rem = diff % size;\n if (rem == 0) return min;\n result = max - rem + 1;\n }\n }\n\n function bound(uint256 x, uint256 min, uint256 max) internal view virtual returns (uint256 result) {\n result = _bound(x, min, max);\n console2_log(\"Bound Result\", result);\n }\n\n function bound(int256 x, int256 min, int256 max) internal view virtual returns (int256 result) {\n require(min <= max, \"StdUtils bound(int256,int256,int256): Max is less than min.\");\n\n // Shifting all int256 values to uint256 to use _bound function. The range of two types are:\n // int256 : -(2**255) ~ (2**255 - 1)\n // uint256: 0 ~ (2**256 - 1)\n // So, add 2**255, INT256_MIN_ABS to the integer values.\n //\n // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow.\n // So, use `~uint256(x) + 1` instead.\n uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS);\n uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS);\n uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS);\n\n uint256 y = _bound(_x, _min, _max);\n\n // To move it back to int256 value, subtract INT256_MIN_ABS at here.\n result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS);\n console2_log(\"Bound result\", vm.toString(result));\n }\n\n function bytesToUint(bytes memory b) internal pure virtual returns (uint256) {\n require(b.length <= 32, \"StdUtils bytesToUint(bytes): Bytes length exceeds 32.\");\n return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256));\n }\n\n /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce\n /// @notice adapted from Solmate implementation (https://github.com/Rari-Capital/solmate/blob/main/src/utils/LibRLP.sol)\n function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) {\n // forgefmt: disable-start\n // The integer zero is treated as an empty byte string, and as a result it only has a length prefix, 0x80, computed via 0x80 + 0.\n // A one byte integer uses its own value as its length prefix, there is no additional \"0x80 + length\" prefix that comes before it.\n if (nonce == 0x00) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, bytes1(0x80))));\n if (nonce <= 0x7f) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, uint8(nonce))));\n\n // Nonces greater than 1 byte all follow a consistent encoding scheme, where each value is preceded by a prefix of 0x80 + length.\n if (nonce <= 2**8 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd7), bytes1(0x94), deployer, bytes1(0x81), uint8(nonce))));\n if (nonce <= 2**16 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd8), bytes1(0x94), deployer, bytes1(0x82), uint16(nonce))));\n if (nonce <= 2**24 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd9), bytes1(0x94), deployer, bytes1(0x83), uint24(nonce))));\n // forgefmt: disable-end\n\n // More details about RLP encoding can be found here: https://eth.wiki/fundamentals/rlp\n // 0xda = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x84 ++ nonce)\n // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)\n // 0x84 = 0x80 + 0x04 (0x04 = the bytes length of the nonce, 4 bytes, in hex)\n // We assume nobody can have a nonce large enough to require more than 32 bytes.\n return addressFromLast20Bytes(\n keccak256(abi.encodePacked(bytes1(0xda), bytes1(0x94), deployer, bytes1(0x84), uint32(nonce)))\n );\n }\n\n function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer)\n internal\n pure\n virtual\n returns (address)\n {\n return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, initcodeHash)));\n }\n\n /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer\n function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) {\n return computeCreate2Address(salt, initCodeHash, CREATE2_FACTORY);\n }\n\n /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\n function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) {\n return hashInitCode(creationCode, \"\");\n }\n\n /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2\n /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode\n /// @param args the ABI-encoded arguments to the constructor of C\n function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(creationCode, args));\n }\n\n // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses.\n function getTokenBalances(address token, address[] memory addresses)\n internal\n virtual\n returns (uint256[] memory balances)\n {\n uint256 tokenCodeSize;\n assembly {\n tokenCodeSize := extcodesize(token)\n }\n require(tokenCodeSize > 0, \"StdUtils getTokenBalances(address,address[]): Token address is not a contract.\");\n\n // ABI encode the aggregate call to Multicall3.\n uint256 length = addresses.length;\n IMulticall3.Call[] memory calls = new IMulticall3.Call[](length);\n for (uint256 i = 0; i < length; ++i) {\n // 0x70a08231 = bytes4(\"balanceOf(address)\"))\n calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))});\n }\n\n // Make the aggregate call.\n (, bytes[] memory returnData) = multicall.aggregate(calls);\n\n // ABI decode the return data and return the balances.\n balances = new uint256[](length);\n for (uint256 i = 0; i < length; ++i) {\n balances[i] = abi.decode(returnData[i], (uint256));\n }\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n PRIVATE FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) {\n return address(uint160(uint256(bytesValue)));\n }\n\n // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere.\n\n function console2_log(string memory p0, uint256 p1) private view {\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n status;\n }\n\n function console2_log(string memory p0, string memory p1) private view {\n (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n status;\n }\n}\n" + }, + "forge-std/Test.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\n// 💬 ABOUT\n// Standard Library's default Test\n\n// 🧩 MODULES\nimport {console} from \"./console.sol\";\nimport {console2} from \"./console2.sol\";\nimport {StdAssertions} from \"./StdAssertions.sol\";\nimport {StdChains} from \"./StdChains.sol\";\nimport {StdCheats} from \"./StdCheats.sol\";\nimport {stdError} from \"./StdError.sol\";\nimport {StdInvariant} from \"./StdInvariant.sol\";\nimport {stdJson} from \"./StdJson.sol\";\nimport {stdMath} from \"./StdMath.sol\";\nimport {StdStorage, stdStorage} from \"./StdStorage.sol\";\nimport {StdUtils} from \"./StdUtils.sol\";\nimport {Vm} from \"./Vm.sol\";\nimport {StdStyle} from \"./StdStyle.sol\";\n\n// 📦 BOILERPLATE\nimport {TestBase} from \"./Base.sol\";\nimport {DSTest} from \"ds-test/test.sol\";\n\n// ⭐️ TEST\nabstract contract Test is DSTest, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils, TestBase {\n// Note: IS_TEST() must return true.\n// Note: Must have failure system, https://github.com/dapphub/ds-test/blob/cd98eff28324bfac652e63a239a60632a761790b/src/test.sol#L39-L76.\n}\n" + }, + "forge-std/Vm.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\n// Cheatcodes are marked as view/pure/none using the following rules:\n// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,\n// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure (you are modifying some state be it the EVM, interpreter, filesystem, etc),\n// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,\n// 3. Otherwise you're `pure`.\n\ninterface VmSafe {\n struct Log {\n bytes32[] topics;\n bytes data;\n address emitter;\n }\n\n struct Rpc {\n string key;\n string url;\n }\n\n struct FsMetadata {\n bool isDir;\n bool isSymlink;\n uint256 length;\n bool readOnly;\n uint256 modified;\n uint256 accessed;\n uint256 created;\n }\n\n // Loads a storage slot from an address\n function load(address target, bytes32 slot) external view returns (bytes32 data);\n // Signs data\n function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);\n // Gets the address for a given private key\n function addr(uint256 privateKey) external pure returns (address keyAddr);\n // Gets the nonce of an account\n function getNonce(address account) external view returns (uint64 nonce);\n // Performs a foreign function call via the terminal\n function ffi(string[] calldata commandInput) external returns (bytes memory result);\n // Sets environment variables\n function setEnv(string calldata name, string calldata value) external;\n // Reads environment variables, (name) => (value)\n function envBool(string calldata name) external view returns (bool value);\n function envUint(string calldata name) external view returns (uint256 value);\n function envInt(string calldata name) external view returns (int256 value);\n function envAddress(string calldata name) external view returns (address value);\n function envBytes32(string calldata name) external view returns (bytes32 value);\n function envString(string calldata name) external view returns (string memory value);\n function envBytes(string calldata name) external view returns (bytes memory value);\n // Reads environment variables as arrays\n function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);\n function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);\n function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);\n function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);\n function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);\n function envString(string calldata name, string calldata delim) external view returns (string[] memory value);\n function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);\n // Read environment variables with default value\n function envOr(string calldata name, bool defaultValue) external returns (bool value);\n function envOr(string calldata name, uint256 defaultValue) external returns (uint256 value);\n function envOr(string calldata name, int256 defaultValue) external returns (int256 value);\n function envOr(string calldata name, address defaultValue) external returns (address value);\n function envOr(string calldata name, bytes32 defaultValue) external returns (bytes32 value);\n function envOr(string calldata name, string calldata defaultValue) external returns (string memory value);\n function envOr(string calldata name, bytes calldata defaultValue) external returns (bytes memory value);\n // Read environment variables as arrays with default value\n function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)\n external\n returns (bool[] memory value);\n function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)\n external\n returns (uint256[] memory value);\n function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)\n external\n returns (int256[] memory value);\n function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)\n external\n returns (address[] memory value);\n function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)\n external\n returns (bytes32[] memory value);\n function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)\n external\n returns (string[] memory value);\n function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)\n external\n returns (bytes[] memory value);\n // Records all storage reads and writes\n function record() external;\n // Gets all accessed reads and write slot from a recording session, for a given address\n function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);\n // Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file\n function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);\n // Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file\n function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);\n // Labels an address in call traces\n function label(address account, string calldata newLabel) external;\n // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain\n function broadcast() external;\n // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain\n function broadcast(address signer) external;\n // Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain\n function broadcast(uint256 privateKey) external;\n // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain\n function startBroadcast() external;\n // Has all subsequent calls (at this call depth only) create transactions with the address provided that can later be signed and sent onchain\n function startBroadcast(address signer) external;\n // Has all subsequent calls (at this call depth only) create transactions with the private key provided that can later be signed and sent onchain\n function startBroadcast(uint256 privateKey) external;\n // Stops collecting onchain transactions\n function stopBroadcast() external;\n // Reads the entire content of file to string\n function readFile(string calldata path) external view returns (string memory data);\n // Reads the entire content of file as binary. Path is relative to the project root.\n function readFileBinary(string calldata path) external view returns (bytes memory data);\n // Get the path of the current project root\n function projectRoot() external view returns (string memory path);\n // Get the metadata for a file/directory\n function fsMetadata(string calldata fileOrDir) external returns (FsMetadata memory metadata);\n // Reads next line of file to string\n function readLine(string calldata path) external view returns (string memory line);\n // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.\n function writeFile(string calldata path, string calldata data) external;\n // Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.\n // Path is relative to the project root.\n function writeFileBinary(string calldata path, bytes calldata data) external;\n // Writes line to file, creating a file if it does not exist.\n function writeLine(string calldata path, string calldata data) external;\n // Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.\n function closeFile(string calldata path) external;\n // Removes file. This cheatcode will revert in the following situations, but is not limited to just these cases:\n // - Path points to a directory.\n // - The file doesn't exist.\n // - The user lacks permissions to remove the file.\n function removeFile(string calldata path) external;\n // Convert values to a string\n function toString(address value) external pure returns (string memory stringifiedValue);\n function toString(bytes calldata value) external pure returns (string memory stringifiedValue);\n function toString(bytes32 value) external pure returns (string memory stringifiedValue);\n function toString(bool value) external pure returns (string memory stringifiedValue);\n function toString(uint256 value) external pure returns (string memory stringifiedValue);\n function toString(int256 value) external pure returns (string memory stringifiedValue);\n // Convert values from a string\n function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);\n function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);\n function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);\n function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);\n function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);\n function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);\n // Record all the transaction logs\n function recordLogs() external;\n // Gets all the recorded logs\n function getRecordedLogs() external returns (Log[] memory logs);\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path m/44'/60'/0'/0/{index}\n function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);\n // Derive a private key from a provided mnenomic string (or mnenomic file path) at {derivationPath}{index}\n function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)\n external\n pure\n returns (uint256 privateKey);\n // Adds a private key to the local forge wallet and returns the address\n function rememberKey(uint256 privateKey) external returns (address keyAddr);\n //\n // parseJson\n //\n // ----\n // In case the returned value is a JSON object, it's encoded as a ABI-encoded tuple. As JSON objects\n // don't have the notion of ordered, but tuples do, they JSON object is encoded with it's fields ordered in\n // ALPHABETICAL order. That means that in order to successfully decode the tuple, we need to define a tuple that\n // encodes the fields in the same order, which is alphabetical. In the case of Solidity structs, they are encoded\n // as tuples, with the attributes in the order in which they are defined.\n // For example: json = { 'a': 1, 'b': 0xa4tb......3xs}\n // a: uint256\n // b: address\n // To decode that json, we need to define a struct or a tuple as follows:\n // struct json = { uint256 a; address b; }\n // If we defined a json struct with the opposite order, meaning placing the address b first, it would try to\n // decode the tuple in that order, and thus fail.\n // ----\n // Given a string of JSON, return it as ABI-encoded\n function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);\n function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);\n\n // The following parseJson cheatcodes will do type coercion, for the type that they indicate.\n // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12'\n // and hex numbers '0xEF'.\n // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not\n // a JSON object.\n function parseJsonUint(string calldata, string calldata) external returns (uint256);\n function parseJsonUintArray(string calldata, string calldata) external returns (uint256[] memory);\n function parseJsonInt(string calldata, string calldata) external returns (int256);\n function parseJsonIntArray(string calldata, string calldata) external returns (int256[] memory);\n function parseJsonBool(string calldata, string calldata) external returns (bool);\n function parseJsonBoolArray(string calldata, string calldata) external returns (bool[] memory);\n function parseJsonAddress(string calldata, string calldata) external returns (address);\n function parseJsonAddressArray(string calldata, string calldata) external returns (address[] memory);\n function parseJsonString(string calldata, string calldata) external returns (string memory);\n function parseJsonStringArray(string calldata, string calldata) external returns (string[] memory);\n function parseJsonBytes(string calldata, string calldata) external returns (bytes memory);\n function parseJsonBytesArray(string calldata, string calldata) external returns (bytes[] memory);\n function parseJsonBytes32(string calldata, string calldata) external returns (bytes32);\n function parseJsonBytes32Array(string calldata, string calldata) external returns (bytes32[] memory);\n\n // Serialize a key and value to a JSON object stored in-memory that can be later written to a file\n // It returns the stringified version of the specific JSON file up to that moment.\n function serializeBool(string calldata objectKey, string calldata valueKey, bool value)\n external\n returns (string memory json);\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)\n external\n returns (string memory json);\n function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)\n external\n returns (string memory json);\n function serializeAddress(string calldata objectKey, string calldata valueKey, address value)\n external\n returns (string memory json);\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)\n external\n returns (string memory json);\n function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)\n external\n returns (string memory json);\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)\n external\n returns (string memory json);\n\n function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)\n external\n returns (string memory json);\n function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)\n external\n returns (string memory json);\n function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)\n external\n returns (string memory json);\n function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)\n external\n returns (string memory json);\n function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)\n external\n returns (string memory json);\n function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)\n external\n returns (string memory json);\n function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)\n external\n returns (string memory json);\n\n //\n // writeJson\n //\n // ----\n // Write a serialized JSON object to a file. If the file exists, it will be overwritten.\n // Let's assume we want to write the following JSON to a file:\n //\n // { \"boolean\": true, \"number\": 342, \"object\": { \"title\": \"finally json serialization\" } }\n //\n // ```\n // string memory json1 = \"some key\";\n // vm.serializeBool(json1, \"boolean\", true);\n // vm.serializeBool(json1, \"number\", uint256(342));\n // json2 = \"some other key\";\n // string memory output = vm.serializeString(json2, \"title\", \"finally json serialization\");\n // string memory finalJson = vm.serialize(json1, \"object\", output);\n // vm.writeJson(finalJson, \"./output/example.json\");\n // ```\n // The critical insight is that every invocation of serialization will return the stringified version of the JSON\n // up to that point. That means we can construct arbitrary JSON objects and then use the return stringified version\n // to serialize them as values to another JSON object.\n //\n // json1 and json2 are simply keys used by the backend to keep track of the objects. So vm.serializeJson(json1,..)\n // will find the object in-memory that is keyed by \"some key\".\n function writeJson(string calldata json, string calldata path) external;\n // Write a serialized JSON object to an **existing** JSON file, replacing a value with key = \n // This is useful to replace a specific value of a JSON file, without having to parse the entire thing\n function writeJson(string calldata json, string calldata path, string calldata valueKey) external;\n // Returns the RPC url for the given alias\n function rpcUrl(string calldata rpcAlias) external view returns (string memory json);\n // Returns all rpc urls and their aliases `[alias, url][]`\n function rpcUrls() external view returns (string[2][] memory urls);\n // Returns all rpc urls and their aliases as structs.\n function rpcUrlStructs() external view returns (Rpc[] memory urls);\n // If the condition is false, discard this run's fuzz inputs and generate new ones.\n function assume(bool condition) external pure;\n // Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.\n function pauseGasMetering() external;\n // Resumes gas metering (i.e. gas usage is counted again). Noop if already on.\n function resumeGasMetering() external;\n}\n\ninterface Vm is VmSafe {\n // Sets block.timestamp\n function warp(uint256 newTimestamp) external;\n // Sets block.height\n function roll(uint256 newHeight) external;\n // Sets block.basefee\n function fee(uint256 newBasefee) external;\n // Sets block.difficulty\n function difficulty(uint256 newDifficulty) external;\n // Sets block.chainid\n function chainId(uint256 newChainId) external;\n // Stores a value to an address' storage slot.\n function store(address target, bytes32 slot, bytes32 value) external;\n // Sets the nonce of an account; must be higher than the current nonce of the account\n function setNonce(address account, uint64 newNonce) external;\n // Sets the *next* call's msg.sender to be the input address\n function prank(address msgSender) external;\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called\n function startPrank(address msgSender) external;\n // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input\n function prank(address msgSender, address txOrigin) external;\n // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input\n function startPrank(address msgSender, address txOrigin) external;\n // Resets subsequent calls' msg.sender to be `address(this)`\n function stopPrank() external;\n // Sets an address' balance\n function deal(address account, uint256 newBalance) external;\n // Sets an address' code\n function etch(address target, bytes calldata newRuntimeBytecode) external;\n // Expects an error on next call\n function expectRevert(bytes calldata revertData) external;\n function expectRevert(bytes4 revertData) external;\n function expectRevert() external;\n // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).\n // Call this function, then emit an event, then call a function. Internally after the call, we check if\n // logs were emitted in the expected order with the expected topics and data (as specified by the booleans)\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;\n function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)\n external;\n // Mocks a call to an address, returning specified data.\n // Calldata can either be strict or a partial match, e.g. if you only\n // pass a Solidity selector to the expected calldata, then the entire Solidity\n // function will be mocked.\n function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;\n // Mocks a call to an address with a specific msg.value, returning specified data.\n // Calldata match takes precedence over msg.value in case of ambiguity.\n function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;\n // Clears all mocked calls\n function clearMockedCalls() external;\n // Expects a call to an address with the specified calldata.\n // Calldata can either be a strict or a partial match\n function expectCall(address callee, bytes calldata data) external;\n // Expects a call to an address with the specified msg.value and calldata\n function expectCall(address callee, uint256 msgValue, bytes calldata data) external;\n // Expect a call to an address with the specified msg.value, gas, and calldata.\n function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;\n // Expect a call to an address with the specified msg.value and calldata, and a *minimum* amount of gas.\n function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;\n // Sets block.coinbase\n function coinbase(address newCoinbase) external;\n // Snapshot the current state of the evm.\n // Returns the id of the snapshot that was created.\n // To revert a snapshot use `revertTo`\n function snapshot() external returns (uint256 snapshotId);\n // Revert the state of the EVM to a previous snapshot\n // Takes the snapshot id to revert to.\n // This deletes the snapshot and all snapshots taken after the given snapshot id.\n function revertTo(uint256 snapshotId) external returns (bool success);\n // Creates a new fork with the given endpoint and block and returns the identifier of the fork\n function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\n // Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork\n function createFork(string calldata urlOrAlias) external returns (uint256 forkId);\n // Creates a new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before the transaction,\n // and returns the identifier of the fork\n function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n // Creates _and_ also selects a new fork with the given endpoint and block and returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);\n // Creates _and_ also selects new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before\n // the transaction, returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n // Creates _and_ also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork\n function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);\n // Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.\n function selectFork(uint256 forkId) external;\n /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.\n function activeFork() external view returns (uint256 forkId);\n // Updates the currently active fork to given block number\n // This is similar to `roll` but for the currently active fork\n function rollFork(uint256 blockNumber) external;\n // Updates the currently active fork to given transaction\n // this will `rollFork` with the number of the block the transaction was mined in and replays all transaction mined before it in the block\n function rollFork(bytes32 txHash) external;\n // Updates the given fork to given block number\n function rollFork(uint256 forkId, uint256 blockNumber) external;\n // Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block\n function rollFork(uint256 forkId, bytes32 txHash) external;\n // Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\n // Meaning, changes made to the state of this account will be kept when switching forks\n function makePersistent(address account) external;\n function makePersistent(address account0, address account1) external;\n function makePersistent(address account0, address account1, address account2) external;\n function makePersistent(address[] calldata accounts) external;\n // Revokes persistent status from the address, previously added via `makePersistent`\n function revokePersistent(address account) external;\n function revokePersistent(address[] calldata accounts) external;\n // Returns true if the account is marked as persistent\n function isPersistent(address account) external view returns (bool persistent);\n // In forking mode, explicitly grant the given address cheatcode access\n function allowCheatcodes(address account) external;\n // Fetches the given transaction from the active fork and executes it on the current state\n function transact(bytes32 txHash) external;\n // Fetches the given transaction from the given fork and executes it on the current state\n function transact(uint256 forkId, bytes32 txHash) external;\n}\n" + }, + "ops/interfaces/IResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IResolver {\n function checker()\n external\n view\n returns (bool canExec, bytes memory execPayload);\n}\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\nabstract contract Auth {\n event OwnerUpdated(address indexed user, address indexed newOwner);\n\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n address public owner;\n\n Authority public authority;\n\n constructor(address _owner, Authority _authority) {\n owner = _owner;\n authority = _authority;\n\n emit OwnerUpdated(msg.sender, _owner);\n emit AuthorityUpdated(msg.sender, _authority);\n }\n\n modifier requiresAuth() virtual {\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\n\n _;\n }\n\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\n }\n\n function setAuthority(Authority newAuthority) public virtual {\n // We check if the caller is the owner first because we want to ensure they can\n // always swap out the authority even if it's reverting or using up a lot of gas.\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\n\n authority = newAuthority;\n\n emit AuthorityUpdated(msg.sender, newAuthority);\n }\n\n function setOwner(address newOwner) public virtual requiresAuth {\n owner = newOwner;\n\n emit OwnerUpdated(msg.sender, newOwner);\n }\n}\n\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\ninterface Authority {\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n}\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {Auth, Authority} from \"../Auth.sol\";\n\n/// @notice Role based Authority that supports up to 256 roles.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\ncontract RolesAuthority is Auth, Authority {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\n\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\n\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\n\n /*//////////////////////////////////////////////////////////////\n ROLE/USER STORAGE\n //////////////////////////////////////////////////////////////*/\n\n mapping(address => bytes32) public getUserRoles;\n\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\n\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\n\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\n }\n\n function doesRoleHaveCapability(\n uint8 role,\n address target,\n bytes4 functionSig\n ) public view virtual returns (bool) {\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\n }\n\n /*//////////////////////////////////////////////////////////////\n AUTHORIZATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) public view virtual override returns (bool) {\n return\n isCapabilityPublic[target][functionSig] ||\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\n }\n\n /*//////////////////////////////////////////////////////////////\n ROLE CAPABILITY CONFIGURATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setPublicCapability(\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n isCapabilityPublic[target][functionSig] = enabled;\n\n emit PublicCapabilityUpdated(target, functionSig, enabled);\n }\n\n function setRoleCapability(\n uint8 role,\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\n } else {\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\n }\n\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\n }\n\n /*//////////////////////////////////////////////////////////////\n USER ROLE ASSIGNMENT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setUserRole(\n address user,\n uint8 role,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getUserRoles[user] |= bytes32(1 << role);\n } else {\n getUserRoles[user] &= ~bytes32(1 << role);\n }\n\n emit UserRoleUpdated(user, role, enabled);\n }\n}\n" + }, + "solmate/mixins/ERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"../utils/SafeTransferLib.sol\";\nimport {FixedPointMathLib} from \"../utils/FixedPointMathLib.sol\";\n\n/// @notice Minimal ERC4626 tokenized Vault implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\nabstract contract ERC4626 is ERC20 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /*//////////////////////////////////////////////////////////////\n IMMUTABLES\n //////////////////////////////////////////////////////////////*/\n\n ERC20 public immutable asset;\n\n constructor(\n ERC20 _asset,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol, _asset.decimals()) {\n asset = _asset;\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function totalAssets() public view virtual returns (uint256);\n\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\n }\n\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\n }\n\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n return convertToShares(assets);\n }\n\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\n }\n\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\n }\n\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n return convertToAssets(shares);\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf[owner]);\n }\n\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf[owner];\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL HOOKS LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\n}\n" + }, + "solmate/test/utils/mocks/MockERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../../../tokens/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) ERC20(_name, _symbol, _decimals) {}\n\n function mint(address to, uint256 value) public virtual {\n _mint(to, value);\n }\n\n function burn(address from, uint256 value) public virtual {\n _burn(from, value);\n }\n}\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "solmate/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // Divide z by the denominator.\n z := div(z, denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n assembly {\n // Store x * y in z for now.\n z := mul(x, y)\n\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\n revert(0, 0)\n }\n\n // First, divide z - 1 by the denominator and add 1.\n // We allow z - 1 to underflow if z is 0, because we multiply the\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n // Mod x by y. Note this will return\n // 0 instead of reverting if y is zero.\n z := mod(x, y)\n }\n }\n\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n assembly {\n // Divide x by y. Note this will return\n // 0 instead of reverting if y is zero.\n r := div(x, y)\n }\n }\n\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n // Add 1 to x * y if x % y > 0. Note this will\n // return 0 instead of reverting if y is zero.\n z := add(gt(mod(x, y), 0), div(x, y))\n }\n }\n}\n" + }, + "solmate/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Safe unsigned integer casting library that reverts on overflow.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\nlibrary SafeCastLib {\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\n require(x < 1 << 248);\n\n y = uint248(x);\n }\n\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\n require(x < 1 << 224);\n\n y = uint224(x);\n }\n\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\n require(x < 1 << 192);\n\n y = uint192(x);\n }\n\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\n require(x < 1 << 160);\n\n y = uint160(x);\n }\n\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\n require(x < 1 << 128);\n\n y = uint128(x);\n }\n\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\n require(x < 1 << 96);\n\n y = uint96(x);\n }\n\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\n require(x < 1 << 64);\n\n y = uint64(x);\n }\n\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\n require(x < 1 << 32);\n\n y = uint32(x);\n }\n\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\n require(x < 1 << 24);\n\n y = uint24(x);\n }\n\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\n require(x < 1 << 16);\n\n y = uint16(x);\n }\n\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\n require(x < 1 << 8);\n\n y = uint8(x);\n }\n}\n" + }, + "solmate/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n /*//////////////////////////////////////////////////////////////\n ETH OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferETH(address to, uint256 amount) internal {\n bool success;\n\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n require(success, \"ETH_TRANSFER_FAILED\");\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferFrom(\n ERC20 token,\n address from,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FROM_FAILED\");\n }\n\n function safeTransfer(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FAILED\");\n }\n\n function safeApprove(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"APPROVE_FAILED\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/base/solcInputs/cced3e52758ae203017b84aa51adae9b.json b/packages/contracts/deployments/base/solcInputs/cced3e52758ae203017b84aa51adae9b.json new file mode 100644 index 0000000000..2b66ea9d92 --- /dev/null +++ b/packages/contracts/deployments/base/solcInputs/cced3e52758ae203017b84aa51adae9b.json @@ -0,0 +1,225 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2Upgradeable {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "adrastia-periphery/rates/IHistoricalRates.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\nimport \"./RateLibrary.sol\";\n\n/**\n * @title IHistoricalRates\n * @notice An interface that defines a contract that stores historical rates.\n */\ninterface IHistoricalRates {\n /// @notice Gets an rate for a token at a specific index.\n /// @param token The address of the token to get the rates for.\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\n /// index contains the oldest rate (uses reverse chronological ordering).\n /// @return rate The rate for the token at the specified index.\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the latest rates for a token.\n /// @param token The address of the token to get the rates for.\n /// @param amount The number of rates to get.\n /// @param offset The index of the first rate to get (default: 0).\n /// @param increment The increment between rates to get (default: 1).\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\n function getRates(\n address token,\n uint256 amount,\n uint256 offset,\n uint256 increment\n ) external view returns (RateLibrary.Rate[] memory);\n\n /// @notice Gets the number of rates for a token.\n /// @param token The address of the token to get the number of rates for.\n /// @return count The number of rates for the token.\n function getRatesCount(address token) external view returns (uint256);\n\n /// @notice Gets the capacity of rates for a token.\n /// @param token The address of the token to get the capacity of rates for.\n /// @return capacity The capacity of rates for the token.\n function getRatesCapacity(address token) external view returns (uint256);\n\n /// @notice Sets the capacity of rates for a token.\n /// @param token The address of the token to set the capacity of rates for.\n /// @param amount The new capacity of rates for the token.\n function setRatesCapacity(address token, uint256 amount) external;\n}\n" + }, + "adrastia-periphery/rates/RateLibrary.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.5.0 <0.9.0;\n\npragma experimental ABIEncoderV2;\n\nlibrary RateLibrary {\n struct Rate {\n uint64 target;\n uint64 current;\n uint32 timestamp;\n }\n}\n" + }, + "contracts/adrastia/PrudentiaLib.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nlibrary PrudentiaLib {\n struct PrudentiaConfig {\n address controller; // Adrastia Prudentia controller address\n uint8 offset; // Offset for delayed rate activation\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\n }\n}\n" + }, + "contracts/compound/CarefulMath.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Careful Math\n * @author Compound\n * @notice Derived from OpenZeppelin's SafeMath library\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\n */\ncontract CarefulMath {\n /**\n * @dev Possible error codes that we can return\n */\n enum MathError {\n NO_ERROR,\n DIVISION_BY_ZERO,\n INTEGER_OVERFLOW,\n INTEGER_UNDERFLOW\n }\n\n /**\n * @dev Multiplies two numbers, returns an error on overflow.\n */\n function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (a == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n uint256 c;\n unchecked {\n c = a * b;\n }\n\n if (c / a != b) {\n return (MathError.INTEGER_OVERFLOW, 0);\n } else {\n return (MathError.NO_ERROR, c);\n }\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b == 0) {\n return (MathError.DIVISION_BY_ZERO, 0);\n }\n\n return (MathError.NO_ERROR, a / b);\n }\n\n /**\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\n */\n function subUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n if (b <= a) {\n return (MathError.NO_ERROR, a - b);\n } else {\n return (MathError.INTEGER_UNDERFLOW, 0);\n }\n }\n\n /**\n * @dev Adds two numbers, returns an error on overflow.\n */\n function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {\n uint256 c;\n unchecked {\n c = a + b;\n }\n\n if (c >= a) {\n return (MathError.NO_ERROR, c);\n } else {\n return (MathError.INTEGER_OVERFLOW, 0);\n }\n }\n\n /**\n * @dev add a and b and then subtract c\n */\n function addThenSubUInt(\n uint256 a,\n uint256 b,\n uint256 c\n ) internal pure returns (MathError, uint256) {\n (MathError err0, uint256 sum) = addUInt(a, b);\n\n if (err0 != MathError.NO_ERROR) {\n return (err0, 0);\n }\n\n return subUInt(sum, c);\n }\n}\n" + }, + "contracts/compound/CErc20Delegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CToken.sol\";\n\n/**\n * @title Compound's CErc20Delegate Contract\n * @notice CTokens which wrap an EIP-20 underlying and are delegated to\n * @author Compound\n */\ncontract CErc20Delegate is CErc20 {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 3;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.contractType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.delegateType.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this._becomeImplementation.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n */\n function _becomeImplementation(bytes memory) public virtual override {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 1;\n }\n\n function contractType() external pure virtual override returns (string memory) {\n return \"CErc20Delegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20Delegate.sol\";\nimport \"./EIP20Interface.sol\";\n\ncontract CErc20RewardsDelegate is CErc20Delegate {\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 2;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n \n /// @notice A reward token claim function\n /// to be overridden for use cases where rewardToken needs to be pulled in\n function claim() external {}\n\n /// @notice token approval function\n function approve(address _token, address _spender) external {\n require(hasAdminRights(), \"!admin\");\n require(_token != underlying, \"!underlying\");\n\n EIP20Interface(_token).approve(_spender, type(uint256).max);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 3;\n }\n\n function contractType() external pure override returns (string memory) {\n return \"CErc20RewardsDelegate\";\n }\n}\n" + }, + "contracts/compound/CErc20RewardsDelegateMorpho.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CErc20RewardsDelegate.sol\";\n\ncontract CErc20RewardsDelegateMorpho is CErc20Delegate {\n event RewardsClaimedAndSet(address indexed account, address indexed reward, uint256 claimedAmount);\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 1;\n\n bytes4[] memory superFunctionSelectors = super._getExtensionFunctions();\n functionSelectors = new bytes4[](superFunctionSelectors.length + fnsCount);\n\n for (uint256 i = 0; i < superFunctionSelectors.length; i++) {\n functionSelectors[i] = superFunctionSelectors[i];\n }\n\n functionSelectors[--fnsCount + superFunctionSelectors.length] = this.claim.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /**\n * @notice Claims the reward tokens from the Morpho contract and forwards them to the FlywheelRewards contract.\n * @param rewardToken The reward strategy for which the rewards are being claimed.\n * @param claimable The amount of tokens to claim and forward.\n * @param proof The proof required to validate the claim.\n * @dev Only callable by the governance.\n */\n function claim(address rewardToken, uint256 claimable, bytes32[] memory proof) external {\n uint256 claimedAmount = IMorphoClaim(morphoURD).claim(address(this), rewardToken, claimable, proof);\n EIP20Interface(rewardToken).transfer(comptroller.admin(), claimedAmount);\n emit RewardsClaimedAndSet(address(this), rewardToken, claimedAmount);\n }\n\n function delegateType() public pure virtual override returns (uint8) {\n return 5;\n }\n}\n\ninterface IMorphoClaim {\n function claim(\n address account,\n address reward,\n uint256 claimable,\n bytes32[] memory proof\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/compound/Comptroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { ComptrollerErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./Unitroller.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { IIonicFlywheel } from \"../ionic/strategies/flywheel/IIonicFlywheel.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerExtensionInterface, ComptrollerBase, ComptrollerInterface } from \"./ComptrollerInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/**\n * @title Compound's Comptroller Contract\n * @author Compound\n * @dev This contract should not to be deployed alone; instead, deploy `Unitroller` (proxy contract) on top of this `Comptroller` (logic/implementation contract).\n */\ncontract Comptroller is ComptrollerBase, ComptrollerInterface, ComptrollerErrorReporter, Exponential, DiamondExtension {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice Emitted when an admin supports a market\n event MarketListed(ICErc20 cToken);\n\n /// @notice Emitted when an account enters a market\n event MarketEntered(ICErc20 cToken, address account);\n\n /// @notice Emitted when an account exits a market\n event MarketExited(ICErc20 cToken, address account);\n\n /// @notice Emitted when close factor is changed by admin\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\n\n /// @notice Emitted when a collateral factor is changed by admin\n event NewCollateralFactor(ICErc20 cToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\n\n /// @notice Emitted when liquidation incentive is changed by admin\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\n\n /// @notice Emitted when price oracle is changed\n event NewPriceOracle(BasePriceOracle oldPriceOracle, BasePriceOracle newPriceOracle);\n\n /// @notice Emitted when the whitelist enforcement is changed\n event WhitelistEnforcementChanged(bool enforce);\n\n /// @notice Emitted when a new RewardsDistributor contract is added to hooks\n event AddedRewardsDistributor(address rewardsDistributor);\n\n // closeFactorMantissa must be strictly greater than this value\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\n\n // closeFactorMantissa must not exceed this value\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\n\n // No collateralFactorMantissa may exceed this value\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\n\n // liquidationIncentiveMantissa must be no less than this value\n uint256 internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0\n\n // liquidationIncentiveMantissa must be no greater than this value\n uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5\n\n modifier isAuthorized() {\n require(IFeeDistributor(ionicAdmin).canCall(address(this), msg.sender, address(this), msg.sig), \"not authorized\");\n _;\n }\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 supplyCap) {\n return ComptrollerBase.effectiveSupplyCaps(cToken);\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(\n address cToken\n ) public view override(ComptrollerBase, ComptrollerInterface) returns (uint256 borrowCap) {\n return ComptrollerBase.effectiveBorrowCaps(cToken);\n }\n\n /*** Assets You Are In ***/\n\n /**\n * @notice Returns the assets an account has entered\n * @param account The address of the account to pull assets for\n * @return A dynamic list with the assets the account has entered\n */\n function getAssetsIn(address account) external view returns (ICErc20[] memory) {\n ICErc20[] memory assetsIn = accountAssets[account];\n\n return assetsIn;\n }\n\n /**\n * @notice Returns whether the given account is entered in the given asset\n * @param account The address of the account to check\n * @param cToken The cToken to check\n * @return True if the account is in the asset, otherwise false.\n */\n function checkMembership(address account, ICErc20 cToken) external view returns (bool) {\n return markets[address(cToken)].accountMembership[account];\n }\n\n /**\n * @notice Add assets to be included in account liquidity calculation\n * @param cTokens The list of addresses of the cToken markets to be enabled\n * @return Success indicator for whether each corresponding market was entered\n */\n function enterMarkets(address[] memory cTokens) public override isAuthorized returns (uint256[] memory) {\n uint256 len = cTokens.length;\n\n uint256[] memory results = new uint256[](len);\n for (uint256 i = 0; i < len; i++) {\n ICErc20 cToken = ICErc20(cTokens[i]);\n\n results[i] = uint256(addToMarketInternal(cToken, msg.sender));\n }\n\n return results;\n }\n\n /**\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\n * @param cToken The market to enter\n * @param borrower The address of the account to modify\n * @return Success indicator for whether the market was entered\n */\n function addToMarketInternal(ICErc20 cToken, address borrower) internal returns (Error) {\n Market storage marketToJoin = markets[address(cToken)];\n\n if (!marketToJoin.isListed) {\n // market is not listed, cannot join\n return Error.MARKET_NOT_LISTED;\n }\n\n if (marketToJoin.accountMembership[borrower] == true) {\n // already joined\n return Error.NO_ERROR;\n }\n\n // survived the gauntlet, add to list\n // NOTE: we store these somewhat redundantly as a significant optimization\n // this avoids having to iterate through the list for the most common use cases\n // that is, only when we need to perform liquidity checks\n // and not whenever we want to check if an account is in a particular market\n marketToJoin.accountMembership[borrower] = true;\n accountAssets[borrower].push(cToken);\n\n // Add to allBorrowers\n if (!borrowers[borrower]) {\n allBorrowers.push(borrower);\n borrowers[borrower] = true;\n borrowerIndexes[borrower] = allBorrowers.length - 1;\n }\n\n emit MarketEntered(cToken, borrower);\n\n return Error.NO_ERROR;\n }\n\n /**\n * @notice Removes asset from sender's account liquidity calculation\n * @dev Sender must not have an outstanding borrow balance in the asset,\n * or be providing necessary collateral for an outstanding borrow.\n * @param cTokenAddress The address of the asset to be removed\n * @return Whether or not the account successfully exited the market\n */\n function exitMarket(address cTokenAddress) external override isAuthorized returns (uint256) {\n // TODO\n require(markets[cTokenAddress].isListed, \"!Comptroller:exitMarket\");\n\n ICErc20 cToken = ICErc20(cTokenAddress);\n /* Get sender tokensHeld and amountOwed underlying from the cToken */\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = cToken.getAccountSnapshot(msg.sender);\n require(oErr == 0, \"!exitMarket\"); // semi-opaque error code\n\n /* Fail if the sender has a borrow balance */\n if (amountOwed != 0) {\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\n }\n\n /* Fail if the sender is not permitted to redeem all of their tokens */\n uint256 allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\n if (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\n }\n\n Market storage marketToExit = markets[cTokenAddress];\n\n /* Return true if the sender is not already ‘in’ the market */\n if (!marketToExit.accountMembership[msg.sender]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Set cToken account membership to false */\n delete marketToExit.accountMembership[msg.sender];\n\n /* Delete cToken from the account’s list of assets */\n // load into memory for faster iteration\n ICErc20[] memory userAssetList = accountAssets[msg.sender];\n uint256 len = userAssetList.length;\n uint256 assetIndex = len;\n for (uint256 i = 0; i < len; i++) {\n if (userAssetList[i] == ICErc20(cTokenAddress)) {\n assetIndex = i;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(assetIndex < len);\n\n // copy last item in list to location of item to be removed, reduce length by 1\n ICErc20[] storage storedList = accountAssets[msg.sender];\n storedList[assetIndex] = storedList[storedList.length - 1];\n storedList.pop();\n\n // If the user has exited all markets, remove them from the `allBorrowers` array\n if (storedList.length == 0) {\n allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed\n allBorrowers.pop(); // Reduce length by 1\n borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index\n borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund\n borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)\n }\n\n emit MarketExited(ICErc20(cTokenAddress), msg.sender);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Policy Hooks ***/\n\n /**\n * @notice Checks if the account should be allowed to mint tokens in the given market\n * @param cTokenAddress The market to verify the mint against\n * @param minter The account which would get the minted tokens\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function mintAllowed(address cTokenAddress, address minter, uint256 mintAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!mintGuardianPaused[cTokenAddress], \"!mint:paused\");\n\n // Make sure market is listed\n if (!markets[cTokenAddress].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure minter is whitelisted\n if (enforceWhitelist && !whitelist[minter]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 supplyCap = effectiveSupplyCaps(cTokenAddress);\n\n // Supply cap of 0 corresponds to unlimited supplying\n if (supplyCap != 0 && !supplyCapWhitelist[cTokenAddress].contains(minter)) {\n uint256 totalUnderlyingSupply = ICErc20(cTokenAddress).getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = asComptrollerExtension().getWhitelistedSuppliersSupply(cTokenAddress);\n uint256 nonWhitelistedTotalSupply;\n if (whitelistedSuppliersSupply >= totalUnderlyingSupply) nonWhitelistedTotalSupply = 0;\n else nonWhitelistedTotalSupply = totalUnderlyingSupply - whitelistedSuppliersSupply;\n\n require(nonWhitelistedTotalSupply + mintAmount < supplyCap, \"!supply cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cTokenAddress, minter);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to redeem tokens in the given market\n * @param cToken The market to verify the redeem against\n * @param redeemer The account which would redeem the tokens\n * @param redeemTokens The number of cTokens to exchange for the underlying asset in the market\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external override returns (uint256) {\n uint256 allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreSupplierAction(cToken, redeemer);\n\n return uint256(Error.NO_ERROR);\n }\n\n function redeemAllowedInternal(\n address cToken,\n address redeemer,\n uint256 redeemTokens\n ) internal view returns (uint256) {\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\n if (!markets[cToken].accountMembership[redeemer]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n redeemer,\n ICErc20(cToken),\n redeemTokens,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates mint and reverts on rejection. May emit logs.\n * @param cToken Asset being minted\n * @param minter The address minting the tokens\n * @param actualMintAmount The amount of the underlying asset being minted\n * @param mintTokens The number of tokens being minted\n */\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\n // Add minter to suppliers mapping\n suppliers[minter] = true;\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, minter);\n }\n\n /**\n * @notice Validates redeem and reverts on rejection. May emit logs.\n * @param cToken Asset being redeemed\n * @param redeemer The address redeeming the tokens\n * @param redeemAmount The amount of the underlying asset being redeemed\n * @param redeemTokens The number of tokens being redeemed\n */\n function redeemVerify(\n address cToken,\n address redeemer,\n uint256 redeemAmount,\n uint256 redeemTokens\n ) external override {\n require(markets[msg.sender].isListed, \"!market\");\n\n // Require tokens is zero or amount is also zero\n if (redeemTokens == 0 && redeemAmount > 0) {\n revert(\"!zero\");\n }\n\n // Keep the flywheel moving\n flywheelPostSupplierAction(cToken, redeemer);\n }\n\n function getMaxRedeemOrBorrow(\n address account,\n ICErc20 cTokenModify,\n bool isBorrow\n ) external view override returns (uint256) {\n address cToken = address(cTokenModify);\n // Accrue interest\n uint256 balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);\n\n // Get account liquidity\n (Error err, , uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n isBorrow ? cTokenModify : ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n require(err == Error.NO_ERROR, \"!liquidity\");\n if (shortfall > 0) return 0; // Shortfall, so no more borrow/redeem\n\n // Get max borrow/redeem\n uint256 maxBorrowOrRedeemAmount;\n\n if (!isBorrow && !markets[cToken].accountMembership[account]) {\n // Max redeem = balance of underlying if not used as collateral\n maxBorrowOrRedeemAmount = balanceOfUnderlying;\n } else {\n // Avoid \"stack too deep\" error by separating this logic\n maxBorrowOrRedeemAmount = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);\n\n // Redeem only: max out at underlying balance\n if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;\n }\n\n // Get max borrow or redeem considering cToken liquidity\n uint256 cTokenLiquidity = cTokenModify.getCash();\n\n // Return the minimum of the two maximums\n return maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity;\n }\n\n /**\n * @dev Portion of the logic in `getMaxRedeemOrBorrow` above separated to avoid \"stack too deep\" errors.\n */\n function _getMaxRedeemOrBorrow(\n uint256 liquidity,\n ICErc20 cTokenModify,\n bool isBorrow\n ) internal view returns (uint256) {\n if (liquidity == 0) return 0; // No available account liquidity, so no more borrow/redeem\n\n // Get the normalized price of the asset\n uint256 conversionFactor = oracle.getUnderlyingPrice(cTokenModify);\n require(conversionFactor > 0, \"!oracle\");\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n if (!isBorrow) {\n uint256 collateralFactorMantissa = markets[address(cTokenModify)].collateralFactorMantissa;\n conversionFactor = (collateralFactorMantissa * conversionFactor) / 1e18;\n }\n\n // Get max borrow or redeem considering excess account liquidity\n return (liquidity * 1e18) / conversionFactor;\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which would borrow the asset\n * @param borrowAmount The amount of underlying the account would borrow\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!borrowGuardianPaused[cToken], \"!borrow:paused\");\n\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n if (!markets[cToken].accountMembership[borrower]) {\n // only cTokens may call borrowAllowed if borrower not in market\n require(msg.sender == cToken, \"!ctoken\");\n\n // attempt to add borrower to the market\n Error err = addToMarketInternal(ICErc20(msg.sender), borrower);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n // it should be impossible to break the important invariant\n assert(markets[cToken].accountMembership[borrower]);\n }\n\n // Make sure oracle price is available\n if (oracle.getUnderlyingPrice(ICErc20(cToken)) == 0) {\n return uint256(Error.PRICE_ERROR);\n }\n\n // Make sure borrower is whitelisted\n if (enforceWhitelist && !whitelist[borrower]) {\n return uint256(Error.SUPPLIER_NOT_WHITELISTED);\n }\n\n uint256 borrowCap = effectiveBorrowCaps(cToken);\n\n // Borrow cap of 0 corresponds to unlimited borrowing\n if (borrowCap != 0 && !borrowCapWhitelist[cToken].contains(borrower)) {\n uint256 totalBorrows = ICErc20(cToken).totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = asComptrollerExtension().getWhitelistedBorrowersBorrows(cToken);\n uint256 nonWhitelistedTotalBorrows;\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n\n require(nonWhitelistedTotalBorrows + borrowAmount < borrowCap, \"!borrow:cap\");\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n // Perform a hypothetical liquidity check to guard against shortfall\n (uint256 err, , , uint256 shortfall) = this.getHypotheticalAccountLiquidity(borrower, cToken, 0, borrowAmount, 0);\n if (err != uint256(Error.NO_ERROR)) {\n return err;\n }\n if (shortfall > 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates borrow the underlying asset of the given market\n * @param cToken The market to verify the borrow against\n * @param borrower The account which borrowed the asset\n */\n function borrowVerify(address cToken, address borrower) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param cToken Asset whose underlying is being borrowed\n * @param accountBorrowsNew The user's new borrow balance of the underlying asset\n */\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view override returns (uint256) {\n // Check if min borrow exists\n uint256 minBorrowEth = IFeeDistributor(ionicAdmin).minBorrowEth();\n\n if (minBorrowEth > 0) {\n // Get new underlying borrow balance of account for this cToken\n uint256 oraclePriceMantissa = oracle.getUnderlyingPrice(ICErc20(cToken));\n if (oraclePriceMantissa == 0) return uint256(Error.PRICE_ERROR);\n (MathError mathErr, uint256 borrowBalanceEth) = mulScalarTruncate(\n Exp({ mantissa: oraclePriceMantissa }),\n accountBorrowsNew\n );\n if (mathErr != MathError.NO_ERROR) return uint256(Error.MATH_ERROR);\n\n // Check against min borrow\n if (borrowBalanceEth < minBorrowEth) return uint256(Error.BORROW_BELOW_MIN);\n }\n\n // Return no error\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the account should be allowed to repay a borrow in the given market\n * @param cToken The market to verify the repay against\n * @param payer The account which would repay the asset\n * @param borrower The account which would borrowed the asset\n * @param repayAmount The amount of the underlying asset the account would repay\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure market is listed\n if (!markets[cToken].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Keep the flywheel moving\n flywheelPreBorrowerAction(cToken, borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after borrow repayment\n * @param cToken The market to verify the repay against\n * @param payer The account which repayed the asset\n * @param borrower The account which borrowed the asset\n * @param repayAmount The amount of the underlying asset the account repayed\n */\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external override {\n // Keep the flywheel moving\n flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Checks if the liquidation should be allowed to occur\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param repayAmount The amount of underlying being repaid\n */\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external override returns (uint256) {\n // Make sure markets are listed\n if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Get borrowers' underlying borrow balance\n uint256 borrowBalance = ICErc20(cTokenBorrowed).borrowBalanceCurrent(borrower);\n\n /* allow accounts to be liquidated if the market is deprecated */\n if (isDeprecated(ICErc20(cTokenBorrowed))) {\n require(borrowBalance >= repayAmount, \"!borrow>repay\");\n } else {\n /* The borrower must have shortfall in order to be liquidateable */\n (Error err, , , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n borrower,\n ICErc20(address(0)),\n 0,\n 0,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n\n if (shortfall == 0) {\n return uint256(Error.INSUFFICIENT_SHORTFALL);\n }\n\n /* The liquidator may not repay more than what is allowed by the closeFactor */\n uint256 maxClose = mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance);\n if (repayAmount > maxClose) {\n return uint256(Error.TOO_MUCH_REPAY);\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Checks if the seizing of assets should be allowed to occur\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!seizeGuardianPaused, \"!seize:paused\");\n\n // Make sure markets are listed\n if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {\n return uint256(Error.MARKET_NOT_LISTED);\n }\n\n // Make sure cToken Comptrollers are identical\n if (ICErc20(cTokenCollateral).comptroller() != ICErc20(cTokenBorrowed).comptroller()) {\n return uint256(Error.COMPTROLLER_MISMATCH);\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cTokenCollateral, borrower, liquidator);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates that blacklisted balances are updated after seizing of assets\n * @param cTokenCollateral Asset which was used as collateral and will be seized\n * @param cTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override {\n // Keep the flywheel moving\n flywheelPostTransferAction(cTokenCollateral, borrower, liquidator);\n }\n\n /**\n * @notice Checks if the account should be allowed to transfer tokens in the given market\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function transferAllowed(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!transferGuardianPaused, \"!transfer:paused\");\n\n // Currently the only consideration is whether or not\n // the src is allowed to redeem this many tokens\n uint256 allowed = redeemAllowedInternal(cToken, src, transferTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n flywheelPreTransferAction(cToken, src, dst);\n\n return uint256(Error.NO_ERROR);\n }\n\n\n /**\n * @notice Validates that blacklisted balances are updated after transfering assets\n * @param cToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of cTokens to transfer\n */\n function transferVerify(\n address cToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external override {\n\n // Keep the flywheel moving\n flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Flywheel Hooks ***/\n\n /**\n * @notice Keeps the flywheel moving pre-mint and pre-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPreSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving post-mint and post-redeem\n * @param cToken The relevant market\n * @param supplier The minter/redeemer\n */\n function flywheelPostSupplierAction(address cToken, address supplier) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostSupplierAction(cToken, supplier);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-borrow and pre-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPreBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving post-borrow and post-repay\n * @param cToken The relevant market\n * @param borrower The borrower\n */\n function flywheelPostBorrowerAction(address cToken, address borrower) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostBorrowerAction(cToken, borrower);\n }\n\n /**\n * @notice Keeps the flywheel moving pre-transfer and pre-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPreTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPreTransferAction(cToken, src, dst);\n }\n\n /**\n * @notice Keeps the flywheel moving post-transfer and post-seize\n * @param cToken The relevant market\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n */\n function flywheelPostTransferAction(address cToken, address src, address dst) internal {\n for (uint256 i = 0; i < rewardsDistributors.length; i++)\n IIonicFlywheel(rewardsDistributors[i]).flywheelPostTransferAction(cToken, src, dst);\n }\n\n /*** Liquidity/Liquidation Calculations ***/\n\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\n * Note that `cTokenBalance` is the number of cTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountLiquidityLocalVars {\n ICErc20 asset;\n uint256 sumCollateral;\n uint256 sumBorrowPlusEffects;\n uint256 cTokenBalance;\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n uint256 oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n uint256 borrowCapForCollateral;\n uint256 borrowedAssetPrice;\n uint256 assetAsCollateralValueCap;\n }\n\n function getAccountLiquidity(address account) public view override returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(account, ICErc20(address(0)), 0, 0, 0);\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code (semi-opaque),\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256, uint256, uint256, uint256) {\n (\n Error err,\n uint256 collateralValue,\n uint256 liquidity,\n uint256 shortfall\n ) = getHypotheticalAccountLiquidityInternal(\n account,\n ICErc20(cTokenModify),\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n return (uint256(err), collateralValue, liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param cTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code,\n hypothetical account collateral value,\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidityInternal(\n address account,\n ICErc20 cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) internal view returns (Error, uint256, uint256, uint256) {\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\n\n if (address(cTokenModify) != address(0)) {\n vars.borrowedAssetPrice = oracle.getUnderlyingPrice(cTokenModify);\n }\n\n // For each asset the account is in\n for (uint256 i = 0; i < accountAssets[account].length; i++) {\n vars.asset = accountAssets[account][i];\n\n {\n // Read the balances and exchange rate from the cToken\n uint256 oErr;\n (oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vars.asset.getAccountSnapshot(\n account\n );\n if (oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (Error.SNAPSHOT_ERROR, 0, 0, 0);\n }\n }\n {\n vars.collateralFactor = Exp({ mantissa: markets[address(vars.asset)].collateralFactorMantissa });\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(vars.asset);\n if (vars.oraclePriceMantissa == 0) {\n return (Error.PRICE_ERROR, 0, 0, 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> ether (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n }\n {\n // Exclude the asset-to-be-borrowed from the liquidity, except for when redeeming\n vars.assetAsCollateralValueCap = asComptrollerExtension().getAssetAsCollateralValueCap(\n vars.asset,\n cTokenModify,\n redeemTokens > 0,\n account\n );\n\n // accumulate the collateral value to sumCollateral\n uint256 assetCollateralValue = mul_ScalarTruncate(vars.tokensToDenom, vars.cTokenBalance);\n if (assetCollateralValue > vars.assetAsCollateralValueCap)\n assetCollateralValue = vars.assetAsCollateralValueCap;\n vars.sumCollateral += assetCollateralValue;\n }\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n\n // Calculate effects of interacting with cTokenModify\n if (vars.asset == cTokenModify) {\n // redeem effect\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.tokensToDenom,\n redeemTokens,\n vars.sumBorrowPlusEffects\n );\n\n // borrow effect\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n borrowAmount,\n vars.sumBorrowPlusEffects\n );\n\n uint256 repayEffect = mul_ScalarTruncate(vars.oraclePrice, repayAmount);\n if (repayEffect >= vars.sumBorrowPlusEffects) {\n vars.sumBorrowPlusEffects = 0;\n } else {\n vars.sumBorrowPlusEffects -= repayEffect;\n }\n }\n }\n\n // These are safe, as the underflow condition is checked first\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\n return (Error.NO_ERROR, vars.sumCollateral, vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\n } else {\n return (Error.NO_ERROR, vars.sumCollateral, 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\n }\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in cToken.liquidateBorrowFresh)\n * @param cTokenBorrowed The address of the borrowed cToken\n * @param cTokenCollateral The address of the collateral cToken\n * @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens\n * @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view override returns (uint256, uint256) {\n /* Read oracle prices for borrowed and collateral markets */\n uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenBorrowed));\n uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(ICErc20(cTokenCollateral));\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\n return (uint256(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n ICErc20 collateralCToken = ICErc20(cTokenCollateral);\n uint256 exchangeRateMantissa = collateralCToken.exchangeRateCurrent();\n uint256 seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n uint256 protocolSeizeShareMantissa = collateralCToken.protocolSeizeShareMantissa();\n uint256 feeSeizeShareMantissa = collateralCToken.feeSeizeShareMantissa();\n\n /*\n * The liquidation penalty includes\n * - the liquidator incentive\n * - the protocol fees (Ionic admin fees)\n * - the market fee\n */\n Exp memory totalPenaltyMantissa = add_(\n add_(Exp({ mantissa: liquidationIncentiveMantissa }), Exp({ mantissa: protocolSeizeShareMantissa })),\n Exp({ mantissa: feeSeizeShareMantissa })\n );\n\n numerator = mul_(totalPenaltyMantissa, Exp({ mantissa: priceBorrowedMantissa }));\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n return (uint256(Error.NO_ERROR), seizeTokens);\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Add a RewardsDistributor contracts.\n * @dev Admin function to add a RewardsDistributor contract\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addRewardsDistributor(address distributor) external returns (uint256) {\n require(hasAdminRights(), \"!admin\");\n\n // Check marker method\n require(IIonicFlywheel(distributor).isRewardsDistributor(), \"!isRewardsDistributor\");\n\n // Check for existing RewardsDistributor\n for (uint256 i = 0; i < rewardsDistributors.length; i++) require(distributor != rewardsDistributors[i], \"!added\");\n\n // Add RewardsDistributor to array\n rewardsDistributors.push(distributor);\n emit AddedRewardsDistributor(distributor);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist enforcement for the comptroller\n * @dev Admin function to set a new whitelist enforcement boolean\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistEnforcement(bool enforce) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_ENFORCEMENT_OWNER_CHECK);\n }\n\n // Check if `enforceWhitelist` already equals `enforce`\n if (enforceWhitelist == enforce) {\n return uint256(Error.NO_ERROR);\n }\n\n // Set comptroller's `enforceWhitelist` to `enforce`\n enforceWhitelist = enforce;\n\n // Emit WhitelistEnforcementChanged(bool enforce);\n emit WhitelistEnforcementChanged(enforce);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the whitelist `statuses` for `suppliers`\n * @dev Admin function to set the whitelist `statuses` for `suppliers`\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_WHITELIST_STATUS_OWNER_CHECK);\n }\n\n // Set whitelist statuses for suppliers\n for (uint256 i = 0; i < suppliers.length; i++) {\n address supplier = suppliers[i];\n\n if (statuses[i]) {\n // If not already whitelisted, add to whitelist\n if (!whitelist[supplier]) {\n whitelist[supplier] = true;\n whitelistArray.push(supplier);\n whitelistIndexes[supplier] = whitelistArray.length - 1;\n }\n } else {\n // If whitelisted, remove from whitelist\n if (whitelist[supplier]) {\n whitelistArray[whitelistIndexes[supplier]] = whitelistArray[whitelistArray.length - 1]; // Copy last item in list to location of item to be removed\n whitelistArray.pop(); // Reduce length by 1\n whitelistIndexes[whitelistArray[whitelistIndexes[supplier]]] = whitelistIndexes[supplier]; // Set whitelist index of moved item to correct index\n whitelistIndexes[supplier] = 0; // Reset supplier whitelist index to 0 for a gas refund\n whitelist[supplier] = false; // Tell the contract that the supplier is no longer whitelisted\n }\n }\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new price oracle for the comptroller\n * @dev Admin function to set a new price oracle\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPriceOracle(BasePriceOracle newOracle) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);\n }\n\n // Track the old oracle for the comptroller\n BasePriceOracle oldOracle = oracle;\n\n // Set comptroller's oracle to newOracle\n oracle = newOracle;\n\n // Emit NewPriceOracle(oldOracle, newOracle)\n emit NewPriceOracle(oldOracle, newOracle);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the closeFactor used when liquidating borrows\n * @dev Admin function to set closeFactor\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);\n }\n\n // Check limits\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\n if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\n if (lessThanExp(highLimit, newCloseFactorExp)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n // Set pool close factor to new close factor, remember old value\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\n closeFactorMantissa = newCloseFactorMantissa;\n\n // Emit event\n emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the collateralFactor for a market\n * @dev Admin function to set per-market collateralFactor\n * @param cToken The market to set the factor on\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCollateralFactor(ICErc20 cToken, uint256 newCollateralFactorMantissa) public returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);\n }\n\n // Verify market is listed\n Market storage market = markets[address(cToken)];\n if (!market.isListed) {\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS);\n }\n\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\n\n // Check collateral factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\n }\n\n // If collateral factor != 0, fail if price == 0\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) {\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\n }\n\n // Set market's collateral factor to new collateral factor, remember old value\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\n market.collateralFactorMantissa = newCollateralFactorMantissa;\n\n // Emit event with asset, old collateral factor, and new collateral factor\n emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets liquidationIncentive\n * @dev Admin function to set liquidationIncentive\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\n * @return uint 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);\n }\n\n // Check de-scaled min <= newLiquidationIncentive <= max\n Exp memory newLiquidationIncentive = Exp({ mantissa: newLiquidationIncentiveMantissa });\n Exp memory minLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMinMantissa });\n if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n Exp memory maxLiquidationIncentive = Exp({ mantissa: liquidationIncentiveMaxMantissa });\n if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {\n return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);\n }\n\n // Save current value for use in log\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\n\n // Set liquidation incentive to new incentive\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\n\n // Emit event with old incentive, new incentive\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Add the market to the markets mapping and set it as listed\n * @dev Admin function to set isListed and add support for the market\n * @param cToken The address of the market (token) to list\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _supportMarket(ICErc20 cToken) internal returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Is market already listed?\n if (markets[address(cToken)].isListed) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // Check cToken.comptroller == this\n require(address(cToken.comptroller()) == address(this), \"!comptroller\");\n\n // Make sure market is not already listed\n address underlying = ICErc20(address(cToken)).underlying();\n\n if (address(cTokensByUnderlying[underlying]) != address(0)) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n // List market and emit event\n Market storage market = markets[address(cToken)];\n market.isListed = true;\n market.collateralFactorMantissa = 0;\n allMarkets.push(cToken);\n cTokensByUnderlying[underlying] = cToken;\n emit MarketListed(cToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Deploy cToken, add the market to the markets mapping, and set it as listed and set the collateral factor\n * @dev Admin function to deploy cToken, set isListed, and add support for the market and set the collateral factor\n * @return uint 0=success, otherwise a failure. (See enum Error for details)\n */\n function _deployMarket(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256) {\n // Check caller is admin\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);\n }\n\n // Temporarily enable Ionic admin rights for asset deployment (storing the original value)\n bool oldIonicAdminHasRights = ionicAdminHasRights;\n ionicAdminHasRights = true;\n\n // Deploy via Ionic admin\n ICErc20 cToken = ICErc20(IFeeDistributor(ionicAdmin).deployCErc20(delegateType, constructorData, becomeImplData));\n // Reset Ionic admin rights to the original value\n ionicAdminHasRights = oldIonicAdminHasRights;\n // Support market here in the Comptroller\n uint256 err = _supportMarket(cToken);\n\n IFeeDistributor(ionicAdmin).authoritiesRegistry().reconfigureAuthority(address(this));\n\n // Set collateral factor\n return err == uint256(Error.NO_ERROR) ? _setCollateralFactor(cToken, collateralFactorMantissa) : err;\n }\n\n function _becomeImplementation() external {\n require(msg.sender == address(this), \"!self call\");\n\n if (!_notEnteredInitialized) {\n _notEntered = true;\n _notEnteredInitialized = true;\n }\n }\n\n /*** Helper Functions ***/\n\n /**\n * @notice Returns true if the given cToken market has been deprecated\n * @dev All borrows in a deprecated cToken market can be immediately liquidated\n * @param cToken The market to check if deprecated\n */\n function isDeprecated(ICErc20 cToken) public view returns (bool) {\n return\n markets[address(cToken)].collateralFactorMantissa == 0 &&\n borrowGuardianPaused[address(cToken)] == true &&\n add_(add_(cToken.reserveFactorMantissa(), cToken.adminFeeMantissa()), cToken.ionicFeeMantissa()) == 1e18;\n }\n\n function asComptrollerExtension() internal view returns (ComptrollerExtensionInterface) {\n return ComptrollerExtensionInterface(address(this));\n }\n\n function _getExtensionFunctions() external pure virtual override returns (bytes4[] memory functionSelectors) {\n uint8 fnsCount = 32;\n\n functionSelectors = new bytes4[](fnsCount);\n\n functionSelectors[--fnsCount] = this.isDeprecated.selector;\n functionSelectors[--fnsCount] = this._deployMarket.selector;\n functionSelectors[--fnsCount] = this.getAssetsIn.selector;\n functionSelectors[--fnsCount] = this.checkMembership.selector;\n functionSelectors[--fnsCount] = this._setPriceOracle.selector;\n functionSelectors[--fnsCount] = this._setCloseFactor.selector;\n functionSelectors[--fnsCount] = this._setCollateralFactor.selector;\n functionSelectors[--fnsCount] = this._setLiquidationIncentive.selector;\n functionSelectors[--fnsCount] = this._setWhitelistEnforcement.selector;\n functionSelectors[--fnsCount] = this._setWhitelistStatuses.selector;\n functionSelectors[--fnsCount] = this._addRewardsDistributor.selector;\n functionSelectors[--fnsCount] = this.getHypotheticalAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.getMaxRedeemOrBorrow.selector;\n functionSelectors[--fnsCount] = this.enterMarkets.selector;\n functionSelectors[--fnsCount] = this.exitMarket.selector;\n functionSelectors[--fnsCount] = this.mintAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemAllowed.selector;\n functionSelectors[--fnsCount] = this.redeemVerify.selector;\n functionSelectors[--fnsCount] = this.borrowAllowed.selector;\n functionSelectors[--fnsCount] = this.borrowWithinLimits.selector;\n functionSelectors[--fnsCount] = this.repayBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrowAllowed.selector;\n functionSelectors[--fnsCount] = this.seizeAllowed.selector;\n functionSelectors[--fnsCount] = this.transferAllowed.selector;\n functionSelectors[--fnsCount] = this.mintVerify.selector;\n functionSelectors[--fnsCount] = this.getAccountLiquidity.selector;\n functionSelectors[--fnsCount] = this.liquidateCalculateSeizeTokens.selector;\n functionSelectors[--fnsCount] = this._beforeNonReentrant.selector;\n functionSelectors[--fnsCount] = this._afterNonReentrant.selector;\n functionSelectors[--fnsCount] = this._becomeImplementation.selector;\n functionSelectors[--fnsCount] = this.effectiveSupplyCaps.selector;\n functionSelectors[--fnsCount] = this.effectiveBorrowCaps.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n }\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n /**\n * @dev Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _beforeNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_beforeNonReentrant\");\n require(_notEntered, \"!reentered\");\n _notEntered = false;\n }\n\n /**\n * @dev Called by cTokens after a non-reentrant function for pool-wide reentrancy prevention.\n * Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream.\n */\n function _afterNonReentrant() external override {\n require(markets[msg.sender].isListed, \"!Comptroller:_afterNonReentrant\");\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n}\n" + }, + "contracts/compound/ComptrollerInterface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { BasePriceOracle } from \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { DiamondExtension } from \"../ionic/DiamondExtension.sol\";\nimport { ComptrollerV4Storage } from \"../compound/ComptrollerStorage.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\nimport { IHistoricalRates } from \"adrastia-periphery/rates/IHistoricalRates.sol\";\n\ninterface ComptrollerInterface {\n function isDeprecated(ICErc20 cToken) external view returns (bool);\n\n function _becomeImplementation() external;\n\n function _deployMarket(\n uint8 delegateType,\n bytes memory constructorData,\n bytes calldata becomeImplData,\n uint256 collateralFactorMantissa\n ) external returns (uint256);\n\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\n\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\n\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\n\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\n\n function _addRewardsDistributor(address distributor) external returns (uint256);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) external view returns (uint256, uint256, uint256, uint256);\n\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\n\n /*** Assets You Are In ***/\n\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\n\n function exitMarket(address cToken) external returns (uint256);\n\n /*** Policy Hooks ***/\n\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\n\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\n\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\n\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\n\n function borrowVerify(address cToken, address borrower) external;\n\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\n\n function repayBorrowAllowed(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowVerify(\n address cToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external;\n\n function liquidateBorrowAllowed(\n address cTokenBorrowed,\n address cTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function seizeAllowed(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n \n function seizeVerify(\n address cTokenCollateral,\n address cTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external;\n\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\n \n function transferVerify(address cToken, address src, address dst, uint256 transferTokens) external;\n\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\n\n /*** Liquidity/Liquidation Calculations ***/\n\n function getAccountLiquidity(\n address account\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\n\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 repayAmount\n ) external view returns (uint256, uint256);\n\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\n\n function _beforeNonReentrant() external;\n\n function _afterNonReentrant() external;\n\n /*** New supply and borrow cap view functions ***/\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\n}\n\ninterface ComptrollerStorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function pendingAdmin() external view returns (address);\n\n function oracle() external view returns (BasePriceOracle);\n\n function pauseGuardian() external view returns (address);\n\n function closeFactorMantissa() external view returns (uint256);\n\n function liquidationIncentiveMantissa() external view returns (uint256);\n\n function isUserOfPool(address user) external view returns (bool);\n\n function whitelist(address account) external view returns (bool);\n\n function enforceWhitelist() external view returns (bool);\n\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\n\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\n\n function suppliers(address account) external view returns (bool);\n\n function cTokensByUnderlying(address) external view returns (address);\n\n /**\n * Gets the supply cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\n * `effectiveSupplyCaps` to get the correct supply cap.\n * @param cToken The address of the cToken.\n * @return The supply cap in the units of the underlying asset.\n */\n function supplyCaps(address cToken) external view returns (uint256);\n\n /**\n * Gets the borrow cap of a cToken in the units of the underlying asset.\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\n * `effectiveBorrowCaps` to get the correct borrow cap.\n * @param cToken The address of the cToken.\n * @return The borrow cap in the units of the underlying asset.\n */\n function borrowCaps(address cToken) external view returns (uint256);\n\n function markets(address cToken) external view returns (bool, uint256);\n\n function accountAssets(address, uint256) external view returns (address);\n\n function borrowGuardianPaused(address cToken) external view returns (bool);\n\n function mintGuardianPaused(address cToken) external view returns (bool);\n\n function rewardsDistributors(uint256) external view returns (address);\n}\n\ninterface SFSRegister {\n function register(address _recipient) external returns (uint256 tokenId);\n}\n\ninterface ComptrollerExtensionInterface {\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\n\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\n\n function getAllMarkets() external view returns (ICErc20[] memory);\n\n function getAllBorrowers() external view returns (address[] memory);\n\n function getAllBorrowersCount() external view returns (uint256);\n\n function getPaginatedBorrowers(\n uint256 page,\n uint256 pageSize\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\n\n function getRewardsDistributors() external view returns (address[] memory);\n\n function getAccruingFlywheels() external view returns (address[] memory);\n\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\n\n function _setBorrowCapForCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBorrowCapForCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function _blacklistBorrowingAgainstCollateral(\n address cTokenBorrow,\n address cTokenCollateral,\n bool blacklisted\n ) external;\n\n function _blacklistBorrowingAgainstCollateralWhitelist(\n address cTokenBorrow,\n address cTokenCollateral,\n address account,\n bool whitelisted\n ) external;\n\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\n address cTokenBorrow,\n address cTokenCollateral,\n address account\n ) external view returns (bool);\n\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\n\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\n\n function _removeFlywheel(address flywheelAddress) external returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\n\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\n\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\n\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\n\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\n\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\n\n function _setTransferPaused(bool state) external returns (bool);\n\n function _setSeizePaused(bool state) external returns (bool);\n\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\n\n function getAssetAsCollateralValueCap(\n ICErc20 collateral,\n ICErc20 cTokenModify,\n bool redeeming,\n address account\n ) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface ComptrollerPrudentiaCapsExtInterface {\n /**\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\n * @return The config.\n */\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\n * @return The config.\n */\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\n * @param newConfig The new config.\n */\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n\n /**\n * @notice Sets the Adrastia Prudentia supply cap config.\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\n * @param newConfig The new config.\n */\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\n}\n\ninterface UnitrollerInterface {\n function comptrollerImplementation() external view returns (address);\n\n function _upgrade() external;\n\n function _acceptAdmin() external returns (uint256);\n\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n\n function _toggleAdminRights(bool hasRights) external returns (uint256);\n}\n\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\n\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\n\ninterface IonicComptroller is\n ComptrollerInterface,\n ComptrollerExtensionInterface,\n UnitrollerInterface,\n ComptrollerStorageInterface\n{\n\n}\n\nabstract contract ComptrollerBase is ComptrollerV4Storage {\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n bool public constant isComptroller = true;\n\n /**\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\n\n // Check if we're using Adrastia Prudentia for the supply cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the supply cap from Adrastia Prudentia\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n supplyCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n supplyCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local supply cap\n\n // Get the supply cap from the local supply cap\n supplyCap = supplyCaps[cToken];\n }\n }\n\n /**\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\n * @param cToken The address of the cToken.\n */\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\n\n // Check if we're using Adrastia Prudentia for the borrow cap\n if (capConfig.controller != address(0)) {\n // We have a controller, so we're using Adrastia Prudentia\n\n address underlyingToken = ICErc20(cToken).underlying();\n\n // Get the borrow cap from Adrastia Prudentia\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\n\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\n // must scale the supply cap to get the correct amount\n\n int256 scaleByDecimals = 18;\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\"decimals()\"));\n if (success && data.length == 32) {\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\n }\n\n scaleByDecimals += capConfig.decimalShift;\n\n if (scaleByDecimals >= 0) {\n // We're scaling up, so we need to multiply\n borrowCap *= 10 ** uint256(scaleByDecimals);\n } else {\n // We're scaling down, so we need to divide\n borrowCap /= 10 ** uint256(-scaleByDecimals);\n }\n } else {\n // We don't have a controller, so we're using the local borrow cap\n borrowCap = borrowCaps[cToken];\n }\n }\n}\n" + }, + "contracts/compound/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IFeeDistributor.sol\";\nimport \"../oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { PrudentiaLib } from \"../adrastia/PrudentiaLib.sol\";\n\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract UnitrollerAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n\n /**\n * @notice Administrator for this contract\n */\n address public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address public pendingAdmin;\n\n /**\n * @notice Whether or not the Ionic admin has admin rights\n */\n bool public ionicAdminHasRights = true;\n\n /**\n * @notice Whether or not the admin has admin rights\n */\n bool public adminHasRights = true;\n\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\n }\n}\n\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\n /**\n * @notice Oracle which gives the price of any given asset\n */\n BasePriceOracle public oracle;\n\n /**\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\n */\n uint256 public closeFactorMantissa;\n\n /**\n * @notice Multiplier representing the discount on collateral that a liquidator receives\n */\n uint256 public liquidationIncentiveMantissa;\n\n /*\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\n */\n uint256 internal maxAssets;\n\n /**\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\n */\n mapping(address => ICErc20[]) public accountAssets;\n}\n\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\n struct Market {\n // Whether or not this market is listed\n bool isListed;\n // Multiplier representing the most one can borrow against their collateral in this market.\n // For instance, 0.9 to allow borrowing 90% of collateral value.\n // Must be between 0 and 1, and stored as a mantissa.\n uint256 collateralFactorMantissa;\n // Per-market mapping of \"accounts in this asset\"\n mapping(address => bool) accountMembership;\n }\n\n /**\n * @notice Official mapping of cTokens -> Market metadata\n * @dev Used e.g. to determine if a market is supported\n */\n mapping(address => Market) public markets;\n\n /// @notice A list of all markets\n ICErc20[] public allMarkets;\n\n /**\n * @dev Maps borrowers to booleans indicating if they have entered any markets\n */\n mapping(address => bool) internal borrowers;\n\n /// @notice A list of all borrowers who have entered markets\n address[] public allBorrowers;\n\n // Indexes of borrower account addresses in the `allBorrowers` array\n mapping(address => uint256) internal borrowerIndexes;\n\n /**\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\n */\n mapping(address => bool) public suppliers;\n\n /// @notice All cTokens addresses mapped by their underlying token addresses\n mapping(address => ICErc20) public cTokensByUnderlying;\n\n /// @notice Whether or not the supplier whitelist is enforced\n bool public enforceWhitelist;\n\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\n mapping(address => bool) public whitelist;\n\n /// @notice An array of all whitelisted accounts\n address[] public whitelistArray;\n\n // Indexes of account addresses in the `whitelistArray` array\n mapping(address => uint256) internal whitelistIndexes;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n * Actions which allow users to remove their own assets cannot be paused.\n * Liquidation / seizing / transfer can only be paused globally, not by market.\n */\n address public pauseGuardian;\n bool public _mintGuardianPaused;\n bool public _borrowGuardianPaused;\n bool public transferGuardianPaused;\n bool public seizeGuardianPaused;\n mapping(address => bool) public mintGuardianPaused;\n mapping(address => bool) public borrowGuardianPaused;\n}\n\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\n address public borrowCapGuardian;\n\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\n mapping(address => uint256) public borrowCaps;\n\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\n mapping(address => uint256) public supplyCaps;\n\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\n address[] public rewardsDistributors;\n\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\n bool internal _notEntered;\n\n /// @dev Whether or not _notEntered has been initialized\n bool internal _notEnteredInitialized;\n\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\n address[] public nonAccruingRewardsDistributors;\n\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\n\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => mapping(address => EnumerableSet.AddressSet))\n internal borrowingAgainstCollateralBlacklistWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\n\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\n}\n\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\n /// @dev Adrastia Prudentia config for controlling borrow caps.\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\n\n /// @dev Adrastia Prudentia config for controlling supply caps.\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\n}\n" + }, + "contracts/compound/CToken.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { CTokenSecondExtensionBase, ICErc20 } from \"./CTokenInterfaces.sol\";\nimport { TokenErrorReporter } from \"./ErrorReporter.sol\";\nimport { Exponential } from \"./Exponential.sol\";\nimport { EIP20Interface } from \"./EIP20Interface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { IFeeDistributor } from \"./IFeeDistributor.sol\";\nimport { CTokenOracleProtected } from \"./CTokenOracleProtected.sol\";\n\nimport { DiamondExtension, LibDiamond } from \"../ionic/DiamondExtension.sol\";\nimport { PoolLens } from \"../PoolLens.sol\";\nimport { IonicUniV3Liquidator } from \"../IonicUniV3Liquidator.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\n/**\n * @title Compound's CErc20 Contract\n * @notice CTokens which wrap an EIP-20 underlying\n * @dev This contract should not to be deployed on its own; instead, deploy `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).\n * @author Compound\n */\nabstract contract CErc20 is CTokenOracleProtected, CTokenSecondExtensionBase, TokenErrorReporter, Exponential, DiamondExtension {\n modifier isAuthorized() {\n require(\n IFeeDistributor(ionicAdmin).canCall(address(comptroller), msg.sender, address(this), msg.sig),\n \"not authorized\"\n );\n _;\n }\n\n modifier isMinHFThresholdExceeded(address borrower) {\n PoolLens lens = PoolLens(ap.getAddress(\"PoolLens\"));\n IonicUniV3Liquidator liquidator = IonicUniV3Liquidator(payable(ap.getAddress(\"IonicUniV3Liquidator\")));\n\n if (lens.getHealthFactor(borrower, comptroller) > liquidator.healthFactorThreshold()) {\n require(msg.sender == address(liquidator), \"Health factor not low enough for non-permissioned liquidations\");\n _;\n } else {\n _;\n }\n }\n\n function _getExtensionFunctions() public pure virtual override returns (bytes4[] memory) {\n uint8 fnsCount = 13;\n bytes4[] memory functionSelectors = new bytes4[](fnsCount);\n functionSelectors[--fnsCount] = this.mint.selector;\n functionSelectors[--fnsCount] = this.redeem.selector;\n functionSelectors[--fnsCount] = this.redeemUnderlying.selector;\n functionSelectors[--fnsCount] = this.borrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrow.selector;\n functionSelectors[--fnsCount] = this.repayBorrowBehalf.selector;\n functionSelectors[--fnsCount] = this.liquidateBorrow.selector;\n functionSelectors[--fnsCount] = this.getCash.selector;\n functionSelectors[--fnsCount] = this.seize.selector;\n functionSelectors[--fnsCount] = this.selfTransferOut.selector;\n functionSelectors[--fnsCount] = this.selfTransferIn.selector;\n functionSelectors[--fnsCount] = this._withdrawIonicFees.selector;\n functionSelectors[--fnsCount] = this._withdrawAdminFees.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return functionSelectors;\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint256 mintAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint256 redeemTokens) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemInternal(redeemTokens);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint256 redeemAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return redeemUnderlyingInternal(redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint256 borrowAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n return borrowInternal(borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external override isAuthorized onlyOracleApprovedAllowEOA returns (uint256) {\n (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external override isAuthorized onlyOracleApprovedAllowEOA isMinHFThresholdExceeded(borrower) returns (uint256) {\n (uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);\n return err;\n }\n\n /**\n * @notice Get cash balance of this cToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view override returns (uint256) {\n return getCashInternal();\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another cToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seize(\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external override nonReentrant(true) onlyOracleApprovedAllowEOA returns (uint256) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\n }\n\n function selfTransferOut(address to, uint256 amount) external override {\n require(msg.sender == address(this), \"!self\");\n doTransferOut(to, amount);\n }\n\n function selfTransferIn(address from, uint256 amount) external override returns (uint256) {\n require(msg.sender == address(this), \"!self\");\n return doTransferIn(from, amount);\n }\n\n /**\n * @notice Accrues interest and reduces Ionic fees by transferring to Ionic\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawIonicFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_IONIC_FEES_FRESH_CHECK);\n }\n\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalIonicFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_IONIC_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n uint256 totalIonicFeesNew = totalIonicFees - withdrawAmount;\n totalIonicFees = totalIonicFeesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(address(ionicAdmin), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces admin fees by transferring to admin\n * @param withdrawAmount Amount of fees to withdraw\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _withdrawAdminFees(uint256 withdrawAmount) external override nonReentrant(false) onlyOracleApproved returns (uint256) {\n asCTokenExtension().accrueInterest();\n\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashInternal() < withdrawAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);\n }\n\n if (withdrawAmount > totalAdminFees) {\n return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n totalAdminFees = totalAdminFees - withdrawAmount;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(ComptrollerV3Storage(address(comptroller)).admin(), withdrawAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashInternal() internal view virtual returns (uint256) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint256 amount) internal virtual returns (uint256) {\n uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transferFrom.selector, from, address(this), amount),\n \"TOKEN_TRANSFER_IN_FAILED\"\n );\n\n // Calculate the amount that was *actually* transferred\n uint256 balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address to, uint256 amount) internal virtual {\n _callOptionalReturn(\n abi.encodeWithSelector(EIP20Interface.transfer.selector, to, amount),\n \"TOKEN_TRANSFER_OUT_FAILED\"\n );\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _callOptionalReturn(bytes memory data, string memory errorMessage) internal {\n bytes memory returndata = _functionCall(underlying, data, errorMessage);\n if (returndata.length > 0) require(abi.decode(returndata, (bool)), errorMessage);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives cTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint256 mintAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n struct MintLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 mintTokens;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n uint256 actualMintAmount;\n }\n\n /**\n * @notice User supplies assets into the market and receives cTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint256 mintAmount) internal returns (uint256, uint256) {\n /* Fail if mint not allowed */\n uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n // Check max supply\n // unused function\n /* allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n } */\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the cToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of cTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n // mintTokens is rounded down here - correct\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n require(vars.mathErr == MathError.NO_ERROR, \"MINT_EXCHANGE_CALCULATION_FAILED\");\n require(vars.mintTokens > 0, \"MINT_ZERO_CTOKENS_REJECTED\");\n\n /*\n * We calculate the new total supply of cTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n vars.totalSupplyNew = totalSupply + vars.mintTokens;\n\n vars.accountTokensNew = accountTokens[minter] + vars.mintTokens;\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint256(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of cTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemInternal(uint256 redeemTokens) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to receive from redeeming cTokens\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlyingInternal(uint256 redeemAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(msg.sender, 0, redeemAmount);\n }\n\n struct RedeemLocalVars {\n Error err;\n MathError mathErr;\n uint256 exchangeRateMantissa;\n uint256 redeemTokens;\n uint256 redeemAmount;\n uint256 totalSupplyNew;\n uint256 accountTokensNew;\n }\n\n function divRoundUp(uint256 x, uint256 y) internal pure returns (uint256 res) {\n res = (x * 1e18) / y;\n if (x % y != 0) res += 1;\n }\n\n /**\n * @notice User redeems cTokens in exchange for the underlying asset\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemFresh(\n address redeemer,\n uint256 redeemTokensIn,\n uint256 redeemAmountIn\n ) internal returns (uint256) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"!redeem tokens or amount\");\n\n RedeemLocalVars memory vars;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n if (redeemTokensIn > 0) {\n // don't allow dust tokens/assets to be left after\n if (totalSupply - redeemTokensIn < 5000) redeemTokensIn = totalSupply;\n\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n } else {\n if (redeemAmountIn == type(uint256).max) {\n redeemAmountIn = comptroller.getMaxRedeemOrBorrow(redeemer, ICErc20(address(this)), false);\n }\n\n // don't allow dust tokens/assets to be left after\n uint256 totalUnderlyingSupplied = asCTokenExtension().getTotalUnderlyingSupplied();\n if (totalUnderlyingSupplied - redeemAmountIn < 1000) redeemAmountIn = totalUnderlyingSupplied;\n\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n vars.redeemTokens = divRoundUp(redeemAmountIn, vars.exchangeRateMantissa);\n\n // don't allow dust tokens/assets to be left after\n if (totalSupply - vars.redeemTokens < 1000) vars.redeemTokens = totalSupply;\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint256 allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashInternal() < vars.redeemAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the redeemer and the redeemAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(redeemer, vars.redeemAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);\n\n /* We call the defense hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowInternal(uint256 borrowAmount) internal nonReentrant(false) returns (uint256) {\n asCTokenExtension().accrueInterest();\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(msg.sender, borrowAmount);\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n }\n\n /**\n * @notice Users borrow assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrowFresh(address borrower, uint256 borrowAmount) internal returns (uint256) {\n /* Fail if borrow not allowed */\n uint256 allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);\n }\n\n /* Fail gracefully if protocol has insufficient underlying cash */\n uint256 cashPrior = getCashInternal();\n\n if (cashPrior < borrowAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE);\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n uint256(vars.mathErr)\n );\n }\n\n // Check min borrow for this user for this asset\n allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);\n }\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n if (vars.mathErr != MathError.NO_ERROR) {\n return\n failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the borrower and the borrowAmount.\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(borrower, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.borrowVerify(address(this), borrower);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint256 repayAmount) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint256 repayAmount)\n internal\n nonReentrant(false)\n returns (uint256, uint256)\n {\n asCTokenExtension().accrueInterest();\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint256 repayAmount;\n uint256 borrowerIndex;\n uint256 accountBorrows;\n uint256 accountBorrowsNew;\n uint256 totalBorrowsNew;\n uint256 actualRepayAmount;\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer the account paying off the borrow\n * @param borrower the account with the debt being payed off\n * @param repayAmount the amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(\n address payer,\n address borrower,\n uint256 repayAmount\n ) internal returns (uint256, uint256) {\n /* Fail if repayBorrow not allowed */\n uint256 allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n vars.accountBorrows = asCTokenExtension().borrowBalanceCurrent(borrower);\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == type(uint256).max) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The cToken must handle variations between ERC-20 and ETH underlying.\n * On success, the cToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED\");\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n require(vars.mathErr == MathError.NO_ERROR, \"REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED\");\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount);\n\n return (uint256(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal nonReentrant(false) returns (uint256, uint256) {\n asCTokenExtension().accrueInterest();\n ICErc20(cTokenCollateral).accrueInterest();\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this cToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param cTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) internal returns (uint256, uint256) {\n /* Fail if liquidate not allowed */\n uint256 allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n cTokenCollateral,\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify cTokenCollateral market's block number equals current block number */\n if (CErc20(cTokenCollateral).accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == type(uint256).max) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n cTokenCollateral,\n actualRepayAmount\n );\n require(amountSeizeError == uint256(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(ICErc20(cTokenCollateral).balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint256 seizeError;\n if (cTokenCollateral == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = CErc20(cTokenCollateral).seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint256(Error.NO_ERROR), \"!seize\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, cTokenCollateral, seizeTokens);\n\n /* We call the defense hook */\n // unused function\n // comptroller.liquidateBorrowVerify(address(this), cTokenCollateral, liquidator, borrower, actualRepayAmount, seizeTokens);\n\n return (uint256(Error.NO_ERROR), actualRepayAmount);\n }\n\n struct SeizeInternalLocalVars {\n MathError mathErr;\n uint256 borrowerTokensNew;\n uint256 liquidatorTokensNew;\n uint256 liquidatorSeizeTokens;\n uint256 protocolSeizeTokens;\n uint256 protocolSeizeAmount;\n uint256 exchangeRateMantissa;\n uint256 totalReservesNew;\n uint256 totalIonicFeeNew;\n uint256 totalSupplyNew;\n uint256 feeSeizeTokens;\n uint256 feeSeizeAmount;\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.\n * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of cTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) internal returns (uint256) {\n /* Fail if seize not allowed */\n uint256 allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n SeizeInternalLocalVars memory vars;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint256(vars.mathErr));\n }\n\n vars.protocolSeizeTokens = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa }));\n vars.feeSeizeTokens = mul_(seizeTokens, Exp({ mantissa: feeSeizeShareMantissa }));\n vars.liquidatorSeizeTokens = seizeTokens - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n\n vars.exchangeRateMantissa = asCTokenExtension().exchangeRateCurrent();\n\n vars.protocolSeizeAmount = mul_ScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n vars.protocolSeizeTokens\n );\n vars.feeSeizeAmount = mul_ScalarTruncate(Exp({ mantissa: vars.exchangeRateMantissa }), vars.feeSeizeTokens);\n\n vars.totalReservesNew = totalReserves + vars.protocolSeizeAmount;\n vars.totalSupplyNew = totalSupply - vars.protocolSeizeTokens - vars.feeSeizeTokens;\n vars.totalIonicFeeNew = totalIonicFees + vars.feeSeizeAmount;\n\n (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens);\n if (vars.mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint256(vars.mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n totalReserves = vars.totalReservesNew;\n totalSupply = vars.totalSupplyNew;\n totalIonicFees = vars.totalIonicFeeNew;\n\n accountTokens[borrower] = vars.borrowerTokensNew;\n accountTokens[liquidator] = vars.liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens);\n emit Transfer(borrower, address(this), vars.protocolSeizeTokens);\n emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew);\n\n /* We call the defense hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint256(Error.NO_ERROR);\n }\n\n function asCTokenExtension() internal view returns (ICErc20) {\n return ICErc20(address(this));\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant(bool localOnly) {\n _beforeNonReentrant(localOnly);\n _;\n _afterNonReentrant(localOnly);\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit.\n */\n function _beforeNonReentrant(bool localOnly) private {\n require(_notEntered, \"re-entered\");\n if (!localOnly) comptroller._beforeNonReentrant();\n _notEntered = false;\n }\n\n /**\n * @dev Split off from `nonReentrant` to keep contract below the 24 KB size limit.\n * Saves space because function modifier code is \"inlined\" into every function with the modifier).\n * In this specific case, the optimization saves around 150 bytes of that valuable 24 KB limit.\n */\n function _afterNonReentrant(bool localOnly) private {\n _notEntered = true; // get a gas-refund post-Istanbul\n if (!localOnly) comptroller._afterNonReentrant();\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n * @param data The call data (encoded using abi.encode or one of its variants).\n * @param errorMessage The revert string to return on failure.\n */\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n}\n" + }, + "contracts/compound/CTokenInterfaces.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller } from \"./ComptrollerInterface.sol\";\nimport { InterestRateModel } from \"./InterestRateModel.sol\";\nimport { ComptrollerV3Storage } from \"./ComptrollerStorage.sol\";\nimport { AddressesProvider } from \"../ionic/AddressesProvider.sol\";\n\nabstract contract CTokenAdminStorage {\n /*\n * Administrator for Ionic\n */\n address payable public ionicAdmin;\n}\n\nabstract contract CErc20Storage is CTokenAdminStorage {\n /**\n * @dev Guard variable for re-entrancy checks\n */\n bool internal _notEntered;\n\n /**\n * @notice EIP-20 token name for this token\n */\n string public name;\n\n /**\n * @notice EIP-20 token symbol for this token\n */\n string public symbol;\n\n /**\n * @notice EIP-20 token decimals for this token\n */\n uint8 public decimals;\n\n /*\n * Maximum borrow rate that can ever be applied (.0005% / block)\n */\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\n\n /*\n * Maximum fraction of interest that can be set aside for reserves + fees\n */\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\n\n /**\n * @notice Contract which oversees inter-cToken operations\n */\n IonicComptroller public comptroller;\n\n /**\n * @notice Model which tells what the current interest rate should be\n */\n InterestRateModel public interestRateModel;\n\n /*\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\n */\n uint256 internal initialExchangeRateMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for admin fees\n */\n uint256 public adminFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for Ionic fees\n */\n uint256 public ionicFeeMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for reserves\n */\n uint256 public reserveFactorMantissa;\n\n /**\n * @notice Block number that interest was last accrued at\n */\n uint256 public accrualBlockNumber;\n\n /**\n * @notice Accumulator of the total earned interest rate since the opening of the market\n */\n uint256 public borrowIndex;\n\n /**\n * @notice Total amount of outstanding borrows of the underlying in this market\n */\n uint256 public totalBorrows;\n\n /**\n * @notice Total amount of reserves of the underlying held in this market\n */\n uint256 public totalReserves;\n\n /**\n * @notice Total amount of admin fees of the underlying held in this market\n */\n uint256 public totalAdminFees;\n\n /**\n * @notice Total amount of Ionic fees of the underlying held in this market\n */\n uint256 public totalIonicFees;\n\n /**\n * @notice Total number of tokens in circulation\n */\n uint256 public totalSupply;\n\n /*\n * Official record of token balances for each account\n */\n mapping(address => uint256) internal accountTokens;\n\n /*\n * Approved token transfer amounts on behalf of others\n */\n mapping(address => mapping(address => uint256)) internal transferAllowances;\n\n /**\n * @notice Container for borrow balance information\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n */\n struct BorrowSnapshot {\n uint256 principal;\n uint256 interestIndex;\n }\n\n /*\n * Mapping of account addresses to outstanding borrow balances\n */\n mapping(address => BorrowSnapshot) internal accountBorrows;\n\n /*\n * Share of seized collateral that is added to reserves\n */\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\n\n /*\n * Share of seized collateral taken as fees\n */\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\n\n /**\n * @notice Underlying asset for this CToken\n */\n address public underlying;\n\n /**\n * @notice Addresses Provider\n */\n AddressesProvider public ap;\n\n /**\n * @notice Morpho Universal Rewards Distributor\n */\n address public morphoURD;\n\n /**\n * @notice Permissioned cTokenMinter\n */\n address public cTokenMinter;\n}\n\nabstract contract CTokenBaseEvents {\n /* ERC20 */\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the admin fee is changed\n */\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\n\n /**\n * @notice Event emitted when the Ionic fee is changed\n */\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\n}\n\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\n event Flash(address receiver, uint256 amount);\n}\n\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral,\n uint256 seizeTokens\n );\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\n}\n\ninterface CTokenFirstExtensionInterface {\n /*** User Interface ***/\n\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n /*** Admin Functions ***/\n\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\n\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\n\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\n\n function borrowRatePerBlock() external view returns (uint256);\n\n function supplyRatePerBlock() external view returns (uint256);\n\n function exchangeRateCurrent() external view returns (uint256);\n\n function accrueInterest() external returns (uint256);\n\n function totalBorrowsCurrent() external view returns (uint256);\n\n function borrowBalanceCurrent(address account) external view returns (uint256);\n\n function getTotalUnderlyingSupplied() external view returns (uint256);\n\n function balanceOfUnderlying(address owner) external view returns (uint256);\n\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n\n function flash(uint256 amount, bytes calldata data) external;\n\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\n\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\n\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\n\n function registerInSFS() external returns (uint256);\n}\n\ninterface CTokenSecondExtensionInterface {\n function mint(uint256 mintAmount) external returns (uint256);\n\n function redeem(uint256 redeemTokens) external returns (uint256);\n\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n function borrow(uint256 borrowAmount) external returns (uint256);\n\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external returns (uint256);\n\n function getCash() external view returns (uint256);\n\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\n\n /*** Admin Functions ***/\n\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\n\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\n\n function selfTransferOut(address to, uint256 amount) external;\n\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\n}\n\ninterface CDelegatorInterface {\n function implementation() external view returns (address);\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external;\n}\n\ninterface CDelegateInterface {\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @dev Should revert if any issues arise which make it unfit for delegation\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes calldata data) external;\n\n function delegateType() external pure returns (uint8);\n\n function contractType() external pure returns (string memory);\n}\n\nabstract contract CErc20AdminBase is CErc20Storage {\n /**\n * @notice Returns a boolean indicating if the sender has admin rights\n */\n function hasAdminRights() internal view returns (bool) {\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\n return\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\n }\n}\n\nabstract contract CErc20FirstExtensionBase is\n CErc20AdminBase,\n CTokenFirstExtensionEvents,\n CTokenFirstExtensionInterface\n{}\n\nabstract contract CTokenSecondExtensionBase is\n CErc20AdminBase,\n CTokenSecondExtensionEvents,\n CTokenSecondExtensionInterface,\n CDelegateInterface\n{}\n\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\n\ninterface CErc20StorageInterface {\n function admin() external view returns (address);\n\n function adminHasRights() external view returns (bool);\n\n function ionicAdmin() external view returns (address);\n\n function ionicAdminHasRights() external view returns (bool);\n\n function comptroller() external view returns (IonicComptroller);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function adminFeeMantissa() external view returns (uint256);\n\n function ionicFeeMantissa() external view returns (uint256);\n\n function reserveFactorMantissa() external view returns (uint256);\n\n function protocolSeizeShareMantissa() external view returns (uint256);\n\n function feeSeizeShareMantissa() external view returns (uint256);\n\n function totalReserves() external view returns (uint256);\n\n function totalAdminFees() external view returns (uint256);\n\n function totalIonicFees() external view returns (uint256);\n\n function totalBorrows() external view returns (uint256);\n\n function accrualBlockNumber() external view returns (uint256);\n\n function underlying() external view returns (address);\n\n function borrowIndex() external view returns (uint256);\n\n function interestRateModel() external view returns (address);\n}\n\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\n function plugin() external view returns (address);\n}\n\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\n function approve(address, address) external;\n}\n\ninterface ICErc20 is\n CErc20StorageInterface,\n CTokenSecondExtensionInterface,\n CTokenFirstExtensionInterface,\n CDelegatorInterface,\n CDelegateInterface\n{}\n\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\n function _updatePlugin(address _plugin) external;\n}\n\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\n" + }, + "contracts/compound/CTokenOracleProtected.sol": { + "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport { CErc20Storage } from \"./CTokenInterfaces.sol\";\nimport { IHypernativeOracle } from \"../external/hypernative/interfaces/IHypernativeOracle.sol\";\n\ncontract CTokenOracleProtected is CErc20Storage {\n error InteractionNotAllowed();\n error CallerIsNotEOA();\n\n modifier onlyOracleApproved() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyOracleApprovedAllowEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n if (tx.origin == msg.sender) {\n _;\n return;\n }\n\n oracle.validateForbiddenContextInteraction(tx.origin, msg.sender);\n _;\n }\n\n modifier onlyNotBlacklistedEOA() {\n address oracleAddress = ap.getAddress(\"HYPERNATIVE_ORACLE\");\n\n if (oracleAddress == address(0)) {\n _;\n return;\n }\n\n IHypernativeOracle oracle = IHypernativeOracle(oracleAddress);\n if (msg.sender != tx.origin) {\n revert CallerIsNotEOA();\n }\n oracle.validateBlacklistedAccountInteraction(msg.sender);\n _;\n }\n}\n" + }, + "contracts/compound/EIP20Interface.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title ERC 20 Token Standard Interface\n * https://eips.ethereum.org/EIPS/eip-20\n */\ninterface EIP20Interface {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n /**\n * @notice Get the total number of tokens in circulation\n * @return uint256 The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance uint256 The balance\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success bool Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) external returns (bool success);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return success bool Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining uint256 The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "contracts/compound/ErrorReporter.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ncontract ComptrollerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n COMPTROLLER_MISMATCH,\n INSUFFICIENT_SHORTFALL,\n INSUFFICIENT_LIQUIDITY,\n INVALID_CLOSE_FACTOR,\n INVALID_COLLATERAL_FACTOR,\n INVALID_LIQUIDATION_INCENTIVE,\n MARKET_NOT_LISTED,\n MARKET_ALREADY_LISTED,\n MATH_ERROR,\n NONZERO_BORROW_BALANCE,\n PRICE_ERROR,\n REJECTION,\n SNAPSHOT_ERROR,\n TOO_MANY_ASSETS,\n TOO_MUCH_REPAY,\n SUPPLIER_NOT_WHITELISTED,\n BORROW_BELOW_MIN,\n SUPPLY_ABOVE_MAX,\n NONZERO_TOTAL_SUPPLY\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n ADD_REWARDS_DISTRIBUTOR_OWNER_CHECK,\n EXIT_MARKET_BALANCE_OWED,\n EXIT_MARKET_REJECTION,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n TOGGLE_AUTO_IMPLEMENTATIONS_ENABLED_OWNER_CHECK,\n SET_CLOSE_FACTOR_OWNER_CHECK,\n SET_CLOSE_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_NO_EXISTS,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_CONTRACT_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_PRICE_ORACLE_OWNER_CHECK,\n SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,\n SET_WHITELIST_STATUS_OWNER_CHECK,\n SUPPORT_MARKET_EXISTS,\n SUPPORT_MARKET_OWNER_CHECK,\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\n UNSUPPORT_MARKET_OWNER_CHECK,\n UNSUPPORT_MARKET_DOES_NOT_EXIST,\n UNSUPPORT_MARKET_IN_USE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return uint256(err);\n }\n}\n\ncontract TokenErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n BAD_INPUT,\n COMPTROLLER_REJECTION,\n COMPTROLLER_CALCULATION_ERROR,\n INTEREST_RATE_MODEL_ERROR,\n INVALID_ACCOUNT_PAIR,\n INVALID_CLOSE_AMOUNT_REQUESTED,\n INVALID_COLLATERAL_FACTOR,\n MATH_ERROR,\n MARKET_NOT_FRESH,\n MARKET_NOT_LISTED,\n TOKEN_INSUFFICIENT_ALLOWANCE,\n TOKEN_INSUFFICIENT_BALANCE,\n TOKEN_INSUFFICIENT_CASH,\n TOKEN_TRANSFER_IN_FAILED,\n TOKEN_TRANSFER_OUT_FAILED,\n UTILIZATION_ABOVE_MAX\n }\n\n /*\n * Note: FailureInfo (but not Error) is kept in alphabetical order\n * This is because FailureInfo grows significantly faster, and\n * the order of Error has some meaning, while the order of FailureInfo\n * is entirely arbitrary.\n */\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_IONIC_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED,\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n BORROW_ACCRUE_INTEREST_FAILED,\n BORROW_CASH_NOT_AVAILABLE,\n BORROW_FRESHNESS_CHECK,\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n BORROW_MARKET_NOT_LISTED,\n BORROW_COMPTROLLER_REJECTION,\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n LIQUIDATE_COMPTROLLER_REJECTION,\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n LIQUIDATE_FRESHNESS_CHECK,\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_ACCRUE_INTEREST_FAILED,\n MINT_COMPTROLLER_REJECTION,\n MINT_EXCHANGE_CALCULATION_FAILED,\n MINT_EXCHANGE_RATE_READ_FAILED,\n MINT_FRESHNESS_CHECK,\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n MINT_TRANSFER_IN_FAILED,\n MINT_TRANSFER_IN_NOT_POSSIBLE,\n NEW_UTILIZATION_RATE_ABOVE_MAX,\n REDEEM_ACCRUE_INTEREST_FAILED,\n REDEEM_COMPTROLLER_REJECTION,\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\n REDEEM_EXCHANGE_RATE_READ_FAILED,\n REDEEM_FRESHNESS_CHECK,\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\n WITHDRAW_IONIC_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_IONIC_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_IONIC_FEES_FRESH_CHECK,\n WITHDRAW_IONIC_FEES_VALIDATION,\n WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,\n WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,\n WITHDRAW_ADMIN_FEES_FRESH_CHECK,\n WITHDRAW_ADMIN_FEES_VALIDATION,\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\n REDUCE_RESERVES_ADMIN_CHECK,\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\n REDUCE_RESERVES_FRESH_CHECK,\n REDUCE_RESERVES_VALIDATION,\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_COMPTROLLER_REJECTION,\n REPAY_BORROW_FRESHNESS_CHECK,\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COMPTROLLER_OWNER_CHECK,\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\n TOGGLE_ADMIN_RIGHTS_OWNER_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,\n SET_ADMIN_FEE_ADMIN_CHECK,\n SET_ADMIN_FEE_FRESH_CHECK,\n SET_ADMIN_FEE_BOUNDS_CHECK,\n SET_IONIC_FEE_ACCRUE_INTEREST_FAILED,\n SET_IONIC_FEE_FRESH_CHECK,\n SET_IONIC_FEE_BOUNDS_CHECK,\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\n SET_RESERVE_FACTOR_ADMIN_CHECK,\n SET_RESERVE_FACTOR_FRESH_CHECK,\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\n TRANSFER_COMPTROLLER_REJECTION,\n TRANSFER_NOT_ALLOWED,\n TRANSFER_NOT_ENOUGH,\n TRANSFER_TOO_MUCH,\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\n ADD_RESERVES_FRESH_CHECK,\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint256 error, uint256 info, uint256 detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), 0);\n\n return uint256(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(\n Error err,\n FailureInfo info,\n uint256 opaqueError\n ) internal returns (uint256) {\n emit Failure(uint256(err), uint256(info), opaqueError);\n\n return err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint256(err);\n }\n}\n" + }, + "contracts/compound/Exponential.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./CarefulMath.sol\";\nimport \"./ExponentialNoError.sol\";\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract Exponential is CarefulMath, ExponentialNoError {\n /**\n * @dev Creates an exponential from numerator and denominator values.\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\n * or if `denom` is zero.\n */\n function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n (MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\n }\n\n /**\n * @dev Adds two exponentials, returning a new exponential.\n */\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Subtracts two exponentials, returning a new exponential.\n */\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint256 result) = subUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, returning a new Exp.\n */\n function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mulScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(product));\n }\n\n /**\n * @dev Divide an Exp by a scalar, returning a new Exp.\n */\n function divScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 descaledMantissa) = divUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\n }\n\n /**\n * @dev Divide a scalar by an Exp, returning a new Exp.\n */\n function divScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\n /*\n We are doing this as:\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\n\n How it works:\n Exp = a / b;\n Scalar = s;\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\n */\n (MathError err0, uint256 numerator) = mulUInt(expScale, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n return getExp(numerator, divisor.mantissa);\n }\n\n /**\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\n */\n function divScalarByExpTruncate(uint256 scalar, Exp memory divisor) internal pure returns (MathError, uint256) {\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(fraction));\n }\n\n /**\n * @dev Multiplies two exponentials, returning a new exponential.\n */\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint256 doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n // We add half the scale before dividing so that we get rounding instead of truncation.\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\n (MathError err1, uint256 doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n (MathError err2, uint256 product) = divUInt(doubleScaledProductWithHalfScale, expScale);\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\n assert(err2 == MathError.NO_ERROR);\n\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\n }\n\n /**\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\n */\n function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\n }\n\n /**\n * @dev Multiplies three exponentials, returning a new exponential.\n */\n function mulExp3(\n Exp memory a,\n Exp memory b,\n Exp memory c\n ) internal pure returns (MathError, Exp memory) {\n (MathError err, Exp memory ab) = mulExp(a, b);\n if (err != MathError.NO_ERROR) {\n return (err, ab);\n }\n return mulExp(ab, c);\n }\n\n /**\n * @dev Divides two exponentials, returning a new exponential.\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\n */\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n return getExp(a.mantissa, b.mantissa);\n }\n}\n" + }, + "contracts/compound/ExponentialNoError.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract ExponentialNoError {\n uint256 constant expScale = 1e18;\n uint256 constant doubleScale = 1e36;\n uint256 constant halfExpScale = expScale / 2;\n uint256 constant mantissaOne = expScale;\n\n struct Exp {\n uint256 mantissa;\n }\n\n struct Double {\n uint256 mantissa;\n }\n\n /**\n * @dev Truncates the given exp to a whole number value.\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\n */\n function truncate(Exp memory exp) internal pure returns (uint256) {\n // Note: We are not using careful math here as we're performing a division that cannot fail\n return exp.mantissa / expScale;\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return truncate(product);\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mul_ScalarTruncateAddUInt(\n Exp memory a,\n uint256 scalar,\n uint256 addend\n ) internal pure returns (uint256) {\n Exp memory product = mul_(a, scalar);\n return add_(truncate(product), addend);\n }\n\n /**\n * @dev Checks if first Exp is less than second Exp.\n */\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa < right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp <= right Exp.\n */\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa <= right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp > right Exp.\n */\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa > right.mantissa;\n }\n\n /**\n * @dev returns true if Exp is exactly zero\n */\n function isZeroExp(Exp memory value) internal pure returns (bool) {\n return value.mantissa == 0;\n }\n\n function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {\n require(n < 2**224, errorMessage);\n return uint224(n);\n }\n\n function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2**32, errorMessage);\n return uint32(n);\n }\n\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(uint256 a, uint256 b) internal pure returns (uint256) {\n return add_(a, b, \"addition overflow\");\n }\n\n function add_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub_(a, b, \"subtraction underflow\");\n }\n\n function sub_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\n }\n\n function mul_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / expScale;\n }\n\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\n }\n\n function mul_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint256 a, Double memory b) internal pure returns (uint256) {\n return mul_(a, b.mantissa) / doubleScale;\n }\n\n function mul_(uint256 a, uint256 b) internal pure returns (uint256) {\n return mul_(a, b, \"multiplication overflow\");\n }\n\n function mul_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n if (a == 0 || b == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, errorMessage);\n return c;\n }\n\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\n }\n\n function div_(Exp memory a, uint256 b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Exp memory b) internal pure returns (uint256) {\n return div_(mul_(a, expScale), b.mantissa);\n }\n\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\n }\n\n function div_(Double memory a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint256 a, Double memory b) internal pure returns (uint256) {\n return div_(mul_(a, doubleScale), b.mantissa);\n }\n\n function div_(uint256 a, uint256 b) internal pure returns (uint256) {\n return div_(a, b, \"divide by zero\");\n }\n\n function div_(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n function fraction(uint256 a, uint256 b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\n }\n}\n" + }, + "contracts/compound/IFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../ionic/AuthoritiesRegistry.sol\";\n\ninterface IFeeDistributor {\n function minBorrowEth() external view returns (uint256);\n\n function maxUtilizationRate() external view returns (uint256);\n\n function interestFeeRate() external view returns (uint256);\n\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\n\n function latestCErc20Delegate(uint8 delegateType)\n external\n view\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\n\n function latestPluginImplementation(address oldImplementation) external view returns (address);\n\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\n\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\n\n function deployCErc20(\n uint8 delegateType,\n bytes calldata constructorData,\n bytes calldata becomeImplData\n ) external returns (address);\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\n\n fallback() external payable;\n\n receive() external payable;\n}\n" + }, + "contracts/compound/InterestRateModel.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @title Compound's InterestRateModel Interface\n * @author Compound\n */\nabstract contract InterestRateModel {\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n bool public constant isInterestRateModel = true;\n\n /**\n * @notice Calculates the current borrow interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\n */\n function getBorrowRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves\n ) public view virtual returns (uint256);\n\n /**\n * @notice Calculates the current supply interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amount of reserves the market has\n * @param reserveFactorMantissa The current reserve factor the market has\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\n */\n function getSupplyRate(\n uint256 cash,\n uint256 borrows,\n uint256 reserves,\n uint256 reserveFactorMantissa\n ) public view virtual returns (uint256);\n}\n" + }, + "contracts/compound/Unitroller.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./ErrorReporter.sol\";\nimport \"./ComptrollerStorage.sol\";\nimport \"./Comptroller.sol\";\nimport { DiamondExtension, DiamondBase, LibDiamond } from \"../ionic/DiamondExtension.sol\";\n\n/**\n * @title Unitroller\n * @dev Storage for the comptroller is at this address, while execution is delegated via the Diamond Extensions\n * CTokens should reference this contract as their comptroller.\n */\ncontract Unitroller is ComptrollerV3Storage, ComptrollerErrorReporter, DiamondBase {\n /**\n * @notice Event emitted when the admin rights are changed\n */\n event AdminRightsToggled(bool hasRights);\n\n /**\n * @notice Emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n constructor(address payable _ionicAdmin) {\n admin = msg.sender;\n ionicAdmin = _ionicAdmin;\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Toggles admin rights.\n * @param hasRights Boolean indicating if the admin is to have rights.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _toggleAdminRights(bool hasRights) external returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.TOGGLE_ADMIN_RIGHTS_OWNER_CHECK);\n }\n\n // Check that rights have not already been set to the desired value\n if (adminHasRights == hasRights) return uint256(Error.NO_ERROR);\n\n adminHasRights = hasRights;\n emit AdminRightsToggled(hasRights);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @param newPendingAdmin New pending admin.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\n if (!hasAdminRights()) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\n }\n\n address oldPendingAdmin = pendingAdmin;\n pendingAdmin = newPendingAdmin;\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n * @dev Admin function for pending admin to accept role and update admin\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint256) {\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\n if (msg.sender != pendingAdmin || msg.sender == address(0)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n admin = pendingAdmin;\n pendingAdmin = address(0);\n\n emit NewAdmin(oldAdmin, admin);\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n\n return uint256(Error.NO_ERROR);\n }\n\n function comptrollerImplementation() public view returns (address) {\n return LibDiamond.getExtensionForFunction(bytes4(keccak256(bytes(\"_deployMarket(uint8,bytes,bytes,uint256)\"))));\n }\n\n /**\n * @dev upgrades the implementation if necessary\n */\n function _upgrade() external {\n require(msg.sender == address(this) || hasAdminRights(), \"!self || !admin\");\n\n address currentImplementation = comptrollerImplementation();\n address latestComptrollerImplementation = IFeeDistributor(ionicAdmin).latestComptrollerImplementation(\n currentImplementation\n );\n\n _updateExtensions(latestComptrollerImplementation);\n\n if (currentImplementation != latestComptrollerImplementation) {\n // reinitialize\n _functionCall(address(this), abi.encodeWithSignature(\"_becomeImplementation()\"), \"!become impl\");\n }\n }\n\n function _functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.call(data);\n\n if (!success) {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n\n return returndata;\n }\n\n function _updateExtensions(address currentComptroller) internal {\n address[] memory latestExtensions = IFeeDistributor(ionicAdmin).getComptrollerExtensions(currentComptroller);\n address[] memory currentExtensions = LibDiamond.listExtensions();\n\n // removed the current (old) extensions\n for (uint256 i = 0; i < currentExtensions.length; i++) {\n LibDiamond.removeExtension(DiamondExtension(currentExtensions[i]));\n }\n // add the new extensions\n for (uint256 i = 0; i < latestExtensions.length; i++) {\n LibDiamond.addExtension(DiamondExtension(latestExtensions[i]));\n }\n }\n\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external override {\n require(hasAdminRights(), \"!unauthorized\");\n LibDiamond.registerExtension(extensionToAdd, extensionToReplace);\n }\n}\n" + }, + "contracts/external/hypernative/interfaces/IHypernativeOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\ninterface IHypernativeOracle {\n function register(address account, bool isStrictMode) external;\n function validateForbiddenAccountInteraction(address sender) external view;\n function validateForbiddenContextInteraction(address origin, address sender) external view;\n function validateBlacklistedAccountInteraction(address sender) external;\n}" + }, + "contracts/external/pyth/IExpressRelay.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelay {\n // Check if the combination of protocol and permissionKey is allowed within this transaction.\n // This will return true if and only if it's being called while executing the auction winner(s) call.\n // @param protocolFeeReceiver The address of the protocol that is gating an action behind this permission\n // @param permissionId The id that represents the action being gated\n // @return permissioned True if the permission is allowed, false otherwise\n function isPermissioned(\n address protocolFeeReceiver,\n bytes calldata permissionId\n ) external view returns (bool permissioned);\n}\n" + }, + "contracts/external/pyth/IExpressRelayFeeReceiver.sol": { + "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.0;\n\ninterface IExpressRelayFeeReceiver {\n // Receive the proceeds of an auction.\n // @param permissionKey The permission key where the auction was conducted on.\n function receiveAuctionProceedings(\n bytes calldata permissionKey\n ) external payable;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3FlashCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"./IUniswapV3PoolActions.sol\";\n\ninterface IUniswapV3Pool is IUniswapV3PoolActions {\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function fee() external view returns (uint24);\n\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n function liquidity() external view returns (uint128);\n\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);\n\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 liquidityCumulative,\n bool initialized\n );\n\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n}\n" + }, + "contracts/external/uniswap/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" + }, + "contracts/external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\n/// @title Quoter Interface\n/// @notice Supports quoting the calculated amounts from exact input or exact output swaps\n/// @dev These functions are not marked view because they rely on calling non-view functions and reverting\n/// to compute the result. They are also not gas efficient and should not be called on-chain.\ninterface IUniswapV3Quoter {\n /// @notice Returns the amount out received for a given exact input swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee\n /// @param amountIn The amount of the first token to swap\n /// @return amountOut The amount of the last token that would be received\n function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);\n\n /// @notice Returns the amount out received for a given exact input but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountIn The desired input amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountOut The amount of `tokenOut` that would be received\n function quoteExactInputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountIn,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountOut);\n\n /// @notice Returns the amount in required for a given exact output swap without executing the swap\n /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order\n /// @param amountOut The amount of the last token to receive\n /// @return amountIn The amount of first token required to be paid\n function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);\n\n /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool\n /// @param tokenIn The token being swapped in\n /// @param tokenOut The token being swapped out\n /// @param fee The fee of the token pool to consider for the pair\n /// @param amountOut The desired output amount\n /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap\n /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`\n function quoteExactOutputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountOut,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountIn);\n}\n" + }, + "contracts/ILiquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\n\ninterface ILiquidator {\n /**\n * borrower The borrower's Ethereum address.\n * repayAmount The amount to repay to liquidate the unhealthy loan.\n * cErc20 The borrowed CErc20 contract to repay.\n * cTokenCollateral The cToken collateral contract to be liquidated.\n * minProfitAmount The minimum amount of profit required for execution (in terms of `exchangeProfitTo`). Reverts if this condition is not met.\n * redemptionStrategies The IRedemptionStrategy contracts to use, if any, to redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * strategyData The data for the chosen IRedemptionStrategy contracts, if any.\n */\n struct LiquidateToTokensWithFlashSwapVars {\n address borrower;\n uint256 repayAmount;\n ICErc20 cErc20;\n ICErc20 cTokenCollateral;\n address flashSwapContract;\n uint256 minProfitAmount;\n IRedemptionStrategy[] redemptionStrategies;\n bytes[] strategyData;\n IFundsConversionStrategy[] debtFundingStrategies;\n bytes[] debtFundingStrategiesData;\n }\n\n function redemptionStrategiesWhitelist(address strategy) external view returns (bool);\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256);\n\n function safeLiquidateToTokensWithFlashLoan(LiquidateToTokensWithFlashSwapVars calldata vars)\n external\n returns (uint256);\n\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external;\n\n function _whitelistRedemptionStrategies(IRedemptionStrategy[] calldata strategies, bool[] calldata whitelisted)\n external;\n\n function setExpressRelay(address _expressRelay) external;\n\n function setPoolLens(address _poolLens) external;\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external;\n}\n" + }, + "contracts/ionic/AddressesProvider.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\n\n/**\n * @title AddressesProvider\n * @notice The Addresses Provider serves as a central storage of system internal and external\n * contract addresses that change between deploys and across chains\n * @author Veliko Minkov \n */\ncontract AddressesProvider is SafeOwnableUpgradeable {\n mapping(string => address) private _addresses;\n mapping(address => Contract) public plugins;\n mapping(address => Contract) public flywheelRewards;\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\n JarvisPool[] public jarvisPoolsConfig;\n CurveSwapPool[] public curveSwapPoolsConfig;\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\n\n /// @dev Initializer to set the admin that can set and change contracts addresses\n function initialize(address owner) public initializer {\n __SafeOwnable_init(owner);\n }\n\n /**\n * @dev The contract address and a string that uniquely identifies the contract's interface\n */\n struct Contract {\n address addr;\n string contractInterface;\n }\n\n struct RedemptionStrategy {\n address addr;\n string contractInterface;\n address outputToken;\n }\n\n struct FundingStrategy {\n address addr;\n string contractInterface;\n address inputToken;\n }\n\n struct JarvisPool {\n address syntheticToken;\n address collateralToken;\n address liquidityPool;\n uint256 expirationTime;\n }\n\n struct CurveSwapPool {\n address poolAddress;\n address[] coins;\n }\n\n /**\n * @dev sets the address and contract interface ID of the flywheel for the reward token\n * @param rewardToken the reward token address\n * @param flywheelRewardsModule the flywheel rewards module address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFlywheelRewards(\n address rewardToken,\n address flywheelRewardsModule,\n string calldata contractInterface\n ) public onlyOwner {\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\n * @param asset the asset address\n * @param plugin the ERC4626 plugin address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setPlugin(\n address asset,\n address plugin,\n string calldata contractInterface\n ) public onlyOwner {\n plugins[asset] = Contract(plugin, contractInterface);\n }\n\n /**\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\n * @param asset the asset address\n * @param strategy redemption strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setRedemptionStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address outputToken\n ) public onlyOwner {\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\n }\n\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\n return redemptionStrategiesConfig[asset];\n }\n\n /**\n * @dev sets the address and contract interface ID of the funding strategy for the asset\n * @param asset the asset address\n * @param strategy funding strategy address\n * @param contractInterface a string that uniquely identifies the contract's interface\n */\n function setFundingStrategy(\n address asset,\n address strategy,\n string calldata contractInterface,\n address inputToken\n ) public onlyOwner {\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\n }\n\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\n return fundingStrategiesConfig[asset];\n }\n\n /**\n * @dev configures the Jarvis pool of a Jarvis synthetic token\n * @param syntheticToken the synthetic token address\n * @param collateralToken the collateral token address\n * @param liquidityPool the liquidity pool address\n * @param expirationTime the operation expiration time\n */\n function setJarvisPool(\n address syntheticToken,\n address collateralToken,\n address liquidityPool,\n uint256 expirationTime\n ) public onlyOwner {\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\n }\n\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\n }\n\n /**\n * @dev Sets an address for an id replacing the address saved in the addresses map\n * @param id The id\n * @param newAddress The address to set\n */\n function setAddress(string calldata id, address newAddress) external onlyOwner {\n _addresses[id] = newAddress;\n }\n\n /**\n * @dev Returns an address by id\n * @return The address\n */\n function getAddress(string calldata id) public view returns (address) {\n return _addresses[id];\n }\n\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\n return curveSwapPoolsConfig;\n }\n\n function getJarvisPools() public view returns (JarvisPool[] memory) {\n return jarvisPoolsConfig;\n }\n\n function setBalancerPoolForTokens(\n address inputToken,\n address outputToken,\n address pool\n ) external onlyOwner {\n balancerPoolForTokens[inputToken][outputToken] = pool;\n }\n\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\n return balancerPoolForTokens[inputToken][outputToken];\n }\n}\n" + }, + "contracts/ionic/AuthoritiesRegistry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { PoolRolesAuthority } from \"../ionic/PoolRolesAuthority.sol\";\nimport { SafeOwnableUpgradeable } from \"../ionic/SafeOwnableUpgradeable.sol\";\nimport { IonicComptroller } from \"../compound/ComptrollerInterface.sol\";\n\nimport { TransparentUpgradeableProxy } from \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\n PoolRolesAuthority public poolAuthLogic;\n address public leveredPositionsFactory;\n bool public noAuthRequired;\n\n function initialize(address _leveredPositionsFactory) public initializer {\n __SafeOwnable_init(msg.sender);\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n }\n\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\n leveredPositionsFactory = _leveredPositionsFactory;\n poolAuthLogic = new PoolRolesAuthority();\n // for Neon the auth is not required\n noAuthRequired = block.chainid == 245022934;\n }\n\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\n require(address(poolsAuthorities[pool]) == address(0), \"already created\");\n\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \"\");\n auth = PoolRolesAuthority(address(proxy));\n auth.initialize(address(this));\n poolsAuthorities[pool] = auth;\n\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\n // sets the registry owner as the auth owner\n reconfigureAuthority(pool);\n }\n\n function reconfigureAuthority(address poolAddress) public {\n IonicComptroller pool = IonicComptroller(poolAddress);\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\n\n if (msg.sender != poolAddress || address(auth) != address(0)) {\n require(address(auth) != address(0), \"no such authority\");\n require(msg.sender == owner() || msg.sender == poolAddress, \"not owner or pool\");\n\n auth.configureRegistryCapabilities();\n auth.configurePoolSupplierCapabilities(pool);\n auth.configurePoolBorrowerCapabilities(pool);\n // everyone can be a liquidator\n auth.configureOpenPoolLiquidatorCapabilities(pool);\n auth.configureLeveredPositionCapabilities(pool);\n\n if (auth.owner() != owner()) {\n auth.setOwner(owner());\n }\n }\n }\n\n function canCall(\n address pool,\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool) {\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\n if (address(authorityForPool) == address(0)) {\n return noAuthRequired;\n } else {\n // allow only if an auth exists and it allows the action\n return authorityForPool.canCall(user, target, functionSig);\n }\n }\n\n function setUserRole(\n address pool,\n address user,\n uint8 role,\n bool enabled\n ) external {\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\n\n require(address(poolAuth) != address(0), \"auth does not exist\");\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \"not owner or factory\");\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \"only lev pos role\");\n\n poolAuth.setUserRole(user, role, enabled);\n }\n}\n" + }, + "contracts/ionic/DiamondExtension.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\n/**\n * @notice a base contract for logic extensions that use the diamond pattern storage\n * to map the functions when looking up the extension contract to delegate to.\n */\nabstract contract DiamondExtension {\n /**\n * @return a list of all the function selectors that this logic extension exposes\n */\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\n}\n\n// When no function exists for function called\nerror FunctionNotFound(bytes4 _functionSelector);\n\n// When no extension exists for function called\nerror ExtensionNotFound(bytes4 _functionSelector);\n\n// When the function is already added\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\n\nabstract contract DiamondBase {\n /**\n * @dev register a logic extension\n * @param extensionToAdd the extension whose functions are to be added\n * @param extensionToReplace the extension whose functions are to be removed/replaced\n */\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\n\n function _listExtensions() public view returns (address[] memory) {\n return LibDiamond.listExtensions();\n }\n\n fallback() external {\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\n // Execute external function from extension using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the extension\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n\n/**\n * @notice a library to use in a contract, whose logic is extended with diamond extension\n */\nlibrary LibDiamond {\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.extensions.diamond.storage\");\n\n struct Function {\n address extension;\n bytes4 selector;\n }\n\n struct LogicStorage {\n Function[] functions;\n address[] extensions;\n }\n\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\n return getExtensionForSelector(msgSig, diamondStorage());\n }\n\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n assembly {\n ds.slot := position\n }\n }\n\n function listExtensions() internal view returns (address[] memory) {\n return diamondStorage().extensions;\n }\n\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\n if (address(extensionToReplace) != address(0)) {\n removeExtension(extensionToReplace);\n }\n addExtension(extensionToAdd);\n }\n\n function removeExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n // remove all functions of the extension to replace\n removeExtensionFunctions(extension);\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n if (ds.extensions[i] == address(extension)) {\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\n ds.extensions.pop();\n }\n }\n }\n\n function addExtension(DiamondExtension extension) internal {\n LogicStorage storage ds = diamondStorage();\n for (uint8 i = 0; i < ds.extensions.length; i++) {\n require(ds.extensions[i] != address(extension), \"extension already added\");\n }\n addExtensionFunctions(extension);\n ds.extensions.push(address(extension));\n }\n\n function removeExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\n bytes4 selectorToRemove = fnsToRemove[i];\n // must never fail\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\n // swap with the last element in the selectorAtIndex array and remove the last element\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\n ds.functions.pop();\n }\n }\n\n function addExtensionFunctions(DiamondExtension extension) internal {\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\n LogicStorage storage ds = diamondStorage();\n uint16 functionsCount = uint16(ds.functions.length);\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\n bytes4 selector = fnsToAdd[functionsIndex];\n address oldImplementation = getExtensionForSelector(selector, ds);\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\n ds.functions.push(Function(address(extension), selector));\n functionsCount++;\n }\n }\n\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\n uint256 fnsLen = ds.functions.length;\n for (uint256 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\n }\n\n return address(0);\n }\n\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\n uint16 fnsLen = uint16(ds.functions.length);\n for (uint16 i = 0; i < fnsLen; i++) {\n if (ds.functions[i].selector == selector) return i;\n }\n\n return type(uint16).max;\n }\n}\n" + }, + "contracts/ionic/IFlashLoanReceiver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ninterface IFlashLoanReceiver {\n function receiveFlashLoan(\n address borrowedAsset,\n uint256 borrowedAmount,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/ionic/PoolRolesAuthority.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport { IonicComptroller, ComptrollerInterface } from \"../compound/ComptrollerInterface.sol\";\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \"../compound/CTokenInterfaces.sol\";\n\nimport { RolesAuthority, Authority } from \"solmate/auth/authorities/RolesAuthority.sol\";\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\n constructor() RolesAuthority(address(0), Authority(address(0))) {\n _disableInitializers();\n }\n\n function initialize(address _owner) public initializer {\n owner = _owner;\n authority = this;\n }\n\n // up to 256 roles\n uint8 public constant REGISTRY_ROLE = 0;\n uint8 public constant SUPPLIER_ROLE = 1;\n uint8 public constant BORROWER_ROLE = 2;\n uint8 public constant LIQUIDATOR_ROLE = 3;\n uint8 public constant LEVERED_POSITION_ROLE = 4;\n\n function configureRegistryCapabilities() external requiresAuth {\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\n true\n );\n setRoleCapability(\n REGISTRY_ROLE,\n address(this),\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\n true\n );\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\n }\n\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, true);\n }\n\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolSupplierCapabilities(pool, false);\n }\n\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\n }\n }\n }\n\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\n }\n\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\n uint8 fnsCount = 6;\n selectors = new bytes4[](fnsCount);\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\n\n require(fnsCount == 0, \"use the correct array length\");\n return selectors;\n }\n\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n bytes4[] memory selectors = getSupplierMarketSelectors();\n for (uint256 j = 0; j < selectors.length; j++) {\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\n }\n }\n }\n\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, true);\n }\n\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n _setPublicPoolBorrowerCapabilities(pool, false);\n }\n\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\n }\n }\n\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\n // borrowers have the SUPPLIER_ROLE capabilities by default\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\n // TODO this leaves redeeming open for everyone\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n }\n }\n\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\n ICErc20[] memory allMarkets = pool.getAllMarkets();\n for (uint256 i = 0; i < allMarkets.length; i++) {\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\n\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\n }\n }\n}\n" + }, + "contracts/ionic/SafeOwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\n\n/**\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\n * that will shift the other.\n */\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\n /**\n * @notice Pending owner of this contract\n */\n address public pendingOwner;\n\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\n __Ownable_init();\n _transferOwnership(owner_);\n }\n\n struct AddressSlot {\n address value;\n }\n\n modifier onlyOwnerOrAdmin() {\n bool isOwner = owner() == _msgSender();\n if (!isOwner) {\n address admin = _getProxyAdmin();\n bool isAdmin = admin == _msgSender();\n require(isAdmin, \"Ownable: caller is neither the owner nor the admin\");\n }\n _;\n }\n\n /**\n * @notice Emitted when pendingOwner is changed\n */\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\n\n /**\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\n */\n event NewOwner(address oldOwner, address newOwner);\n\n /**\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\n * @param newPendingOwner New pending owner.\n */\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\n // Save current value, if any, for inclusion in log\n address oldPendingOwner = pendingOwner;\n\n // Store pendingOwner with value newPendingOwner\n pendingOwner = newPendingOwner;\n\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\n }\n\n /**\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\n * @dev Owner function for pending owner to accept role and update owner\n */\n function _acceptOwner() public {\n // Check caller is pendingOwner and pendingOwner ≠ address(0)\n require(msg.sender == pendingOwner, \"not the pending owner\");\n\n // Save current values for inclusion in log\n address oldOwner = owner();\n address oldPendingOwner = pendingOwner;\n\n // Store owner with value pendingOwner\n _transferOwnership(pendingOwner);\n\n // Clear the pending value\n pendingOwner = address(0);\n\n emit NewOwner(oldOwner, pendingOwner);\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\n }\n\n function renounceOwnership() public override onlyOwner {\n // do not remove this overriding fn\n revert(\"not used anymore\");\n }\n\n function transferOwnership(address newOwner) public override onlyOwner {\n emit NewPendingOwner(pendingOwner, newOwner);\n pendingOwner = newOwner;\n }\n\n function _getProxyAdmin() internal view returns (address admin) {\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n AddressSlot storage adminSlot;\n assembly {\n adminSlot.slot := _ADMIN_SLOT\n }\n admin = adminSlot.value;\n }\n}\n" + }, + "contracts/ionic/strategies/flywheel/IIonicFlywheel.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.10;\n\nimport { ERC20 } from \"solmate/tokens/ERC20.sol\";\n\ninterface IIonicFlywheel {\n function isRewardsDistributor() external returns (bool);\n\n function isFlywheel() external returns (bool);\n\n function flywheelPreSupplierAction(address market, address supplier) external;\n\n function flywheelPostSupplierAction(address market, address supplier) external;\n\n function flywheelPreBorrowerAction(address market, address borrower) external;\n\n function flywheelPostBorrowerAction(address market, address borrower) external;\n\n function flywheelPreTransferAction(address market, address src, address dst) external;\n\n function flywheelPostTransferAction(address market, address src, address dst) external;\n\n function compAccrued(address user) external view returns (uint256);\n\n function addMarketForRewards(ERC20 strategy) external;\n\n function marketState(ERC20 strategy) external view returns (uint224 index, uint32 lastUpdatedTimestamp);\n}\n" + }, + "contracts/IonicUniV3Liquidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport \"./liquidators/IRedemptionStrategy.sol\";\nimport \"./liquidators/IFundsConversionStrategy.sol\";\nimport \"./ILiquidator.sol\";\n\nimport \"./external/uniswap/IUniswapV3FlashCallback.sol\";\nimport \"./external/uniswap/IUniswapV3Pool.sol\";\nimport \"./external/pyth/IExpressRelay.sol\";\nimport \"./external/pyth/IExpressRelayFeeReceiver.sol\";\nimport { IUniswapV3Quoter } from \"./external/uniswap/quoter/interfaces/IUniswapV3Quoter.sol\";\nimport { IFlashLoanReceiver } from \"./ionic/IFlashLoanReceiver.sol\";\n\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport \"./PoolLens.sol\";\n\n/**\n * @title IonicUniV3Liquidator\n * @author Veliko Minkov (https://github.com/vminkov)\n * @notice IonicUniV3Liquidator liquidates unhealthy borrowers with flashloan support.\n */\ncontract IonicUniV3Liquidator is\n OwnableUpgradeable,\n ILiquidator,\n IUniswapV3FlashCallback,\n IExpressRelayFeeReceiver,\n IFlashLoanReceiver\n{\n using AddressUpgradeable for address payable;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n event VaultReceivedETH(address sender, uint256 amount, bytes permissionKey);\n /**\n * @dev Cached liquidator profit exchange source.\n * ERC20 token address or the zero address for NATIVE.\n * For use in `safeLiquidateToTokensWithFlashLoan` after it is set by `postFlashLoanTokens`.\n */\n address private _liquidatorProfitExchangeSource;\n\n /**\n * @dev Cached flash swap amount.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n uint256 private _flashSwapAmount;\n\n /**\n * @dev Cached flash swap token.\n * For use in `repayTokenFlashLoan` after it is set by `safeLiquidateToTokensWithFlashLoan`.\n */\n address private _flashSwapToken;\n\n address public W_NATIVE_ADDRESS;\n mapping(address => bool) public redemptionStrategiesWhitelist;\n IUniswapV3Quoter public quoter;\n\n /**\n * @dev Addres of Pyth Express Relay for preventing value leakage in liquidations.\n */\n IExpressRelay public expressRelay;\n /**\n * @dev Pool Lens.\n */\n PoolLens public lens;\n /**\n * @dev Health Factor below which PER permissioning is bypassed.\n */\n uint256 public healthFactorThreshold;\n\n modifier onlyLowHF(address borrower, ICErc20 cToken) {\n uint256 currentHealthFactor = lens.getHealthFactor(borrower, cToken.comptroller());\n require(currentHealthFactor < healthFactorThreshold, \"HF not low enough, reserving for PYTH\");\n _;\n }\n\n function initialize(address _wtoken, address _quoter) external initializer {\n __Ownable_init();\n W_NATIVE_ADDRESS = _wtoken;\n quoter = IUniswapV3Quoter(_quoter);\n }\n\n /**\n * @notice Safely liquidate an unhealthy loan (using capital from the sender), confirming that at least `minOutputAmount` in collateral is seized (or outputted by exchange if applicable).\n * @param borrower The borrower's Ethereum address.\n * @param repayAmount The amount to repay to liquidate the unhealthy loan.\n * @param cErc20 The borrowed cErc20 to repay.\n * @param cTokenCollateral The cToken collateral to be liquidated.\n * @param minOutputAmount The minimum amount of collateral to seize (or the minimum exchange output if applicable) required for execution. Reverts if this condition is not met.\n */\n function _safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) internal returns (uint256) {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n IERC20Upgradeable underlying = IERC20Upgradeable(cErc20.underlying());\n underlying.safeTransferFrom(msg.sender, address(this), repayAmount);\n underlying.approve(address(cErc20), repayAmount);\n require(cErc20.liquidateBorrow(borrower, repayAmount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n\n return transferSeizedFunds(address(cTokenCollateral.underlying()), minOutputAmount);\n }\n\n function safeLiquidate(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external onlyLowHF(borrower, cTokenCollateral) returns (uint256) {\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidatePyth(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n uint256 minOutputAmount\n ) external returns (uint256) {\n require(expressRelay.isPermissioned(address(this), abi.encode(borrower)), \"invalid liquidation\");\n return _safeLiquidate(borrower, repayAmount, cErc20, cTokenCollateral, minOutputAmount);\n }\n\n function safeLiquidateWithAggregator(\n address borrower,\n uint256 repayAmount,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData\n ) external {\n // Transfer tokens in, approve to cErc20, and liquidate borrow\n require(repayAmount > 0, \"Repay amount (transaction value) must be greater than 0.\");\n cErc20.flash(\n repayAmount,\n abi.encode(borrower, cErc20, cTokenCollateral, aggregatorTarget, aggregatorData, msg.sender)\n );\n }\n\n function receiveFlashLoan(address _underlyingBorrow, uint256 amount, bytes calldata data) external {\n (\n address borrower,\n ICErc20 cErc20,\n ICErc20 cTokenCollateral,\n address aggregatorTarget,\n bytes memory aggregatorData,\n address liquidator\n ) = abi.decode(data, (address, ICErc20, ICErc20, address, bytes, address));\n IERC20Upgradeable underlyingBorrow = IERC20Upgradeable(_underlyingBorrow);\n underlyingBorrow.approve(address(cErc20), amount);\n require(cErc20.liquidateBorrow(borrower, amount, address(cTokenCollateral)) == 0, \"Liquidation failed.\");\n\n // Redeem seized cTokens for underlying asset\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(cTokenCollateral.underlying());\n {\n uint256 seizedCTokenAmount = cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n uint256 underlyingCollateralRedeemed = underlyingCollateral.balanceOf(address(this));\n\n // Call the aggregator\n underlyingCollateral.approve(aggregatorTarget, underlyingCollateralRedeemed);\n (bool success, ) = aggregatorTarget.call(aggregatorData);\n require(success, \"Aggregator call failed\");\n }\n\n // receive profits\n {\n uint256 receivedAmount = underlyingBorrow.balanceOf(address(this));\n require(receivedAmount >= amount, \"Not received enough collateral after swap.\");\n uint256 profitBorrow = receivedAmount - amount;\n if (profitBorrow > 0) {\n underlyingBorrow.safeTransfer(liquidator, profitBorrow);\n }\n\n uint256 profitCollateral = underlyingCollateral.balanceOf(address(this));\n if (profitCollateral > 0) {\n underlyingCollateral.safeTransfer(liquidator, profitCollateral);\n }\n }\n\n // pay back flashloan\n underlyingBorrow.approve(address(cErc20), amount);\n }\n\n /**\n * @dev Transfers seized funds to the sender.\n * @param erc20Contract The address of the token to transfer.\n * @param minOutputAmount The minimum amount to transfer.\n */\n function transferSeizedFunds(address erc20Contract, uint256 minOutputAmount) internal returns (uint256) {\n IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);\n uint256 seizedOutputAmount = token.balanceOf(address(this));\n require(seizedOutputAmount >= minOutputAmount, \"Minimum token output amount not satified.\");\n if (seizedOutputAmount > 0) token.safeTransfer(msg.sender, seizedOutputAmount);\n\n return seizedOutputAmount;\n }\n\n function safeLiquidateToTokensWithFlashLoan(\n LiquidateToTokensWithFlashSwapVars calldata vars\n ) external onlyLowHF(vars.borrower, vars.cTokenCollateral) returns (uint256) {\n // Input validation\n require(vars.repayAmount > 0, \"Repay amount must be greater than 0.\");\n\n // we want to calculate the needed flashSwapAmount on-chain to\n // avoid errors due to changing market conditions\n // between the time of calculating and including the tx in a block\n uint256 fundingAmount = vars.repayAmount;\n IERC20Upgradeable fundingToken;\n if (vars.debtFundingStrategies.length > 0) {\n require(\n vars.debtFundingStrategies.length == vars.debtFundingStrategiesData.length,\n \"Funding IFundsConversionStrategy contract array and strategy data bytes array must be the same length.\"\n );\n // estimate the initial (flash-swapped token) input from the expected output (debt token)\n for (uint256 i = 0; i < vars.debtFundingStrategies.length; i++) {\n bytes memory strategyData = vars.debtFundingStrategiesData[i];\n IFundsConversionStrategy fcs = vars.debtFundingStrategies[i];\n (fundingToken, fundingAmount) = fcs.estimateInputAmount(fundingAmount, strategyData);\n }\n } else {\n fundingToken = IERC20Upgradeable(ICErc20(address(vars.cErc20)).underlying());\n }\n\n // the last outputs from estimateInputAmount are the ones to be flash-swapped\n _flashSwapAmount = fundingAmount;\n _flashSwapToken = address(fundingToken);\n\n IUniswapV3Pool flashSwapPool = IUniswapV3Pool(vars.flashSwapContract);\n bool token0IsFlashSwapFundingToken = flashSwapPool.token0() == address(fundingToken);\n flashSwapPool.flash(\n address(this),\n token0IsFlashSwapFundingToken ? fundingAmount : 0,\n !token0IsFlashSwapFundingToken ? fundingAmount : 0,\n msg.data\n );\n\n return transferSeizedFunds(_liquidatorProfitExchangeSource, vars.minProfitAmount);\n }\n\n /**\n * @dev Receives NATIVE from liquidations and flashloans.\n * Requires that `msg.sender` is W_NATIVE, a CToken, or a Uniswap V2 Router, or another contract.\n */\n receive() external payable {\n require(payable(msg.sender).isContract(), \"Sender is not a contract.\");\n }\n\n /**\n * @notice receiveAuctionProceedings function - receives native token from the express relay\n * You can use permission key to distribute the received funds to users who got liquidated, LPs, etc...\n */\n function receiveAuctionProceedings(bytes calldata permissionKey) external payable {\n emit VaultReceivedETH(msg.sender, msg.value, permissionKey);\n }\n\n function withdrawAll() external onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"No Ether left to withdraw\");\n\n // Transfer all Ether to the owner\n (bool sent, ) = msg.sender.call{ value: balance }(\"\");\n require(sent, \"Failed to send Ether\");\n }\n\n /**\n * @dev Callback function for Uniswap flashloans.\n */\n\n function supV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uniswapV3FlashCallback(fee0, fee1, data);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n // Liquidate unhealthy borrow, exchange seized collateral, return flashloaned funds, and exchange profit\n // Decode params\n LiquidateToTokensWithFlashSwapVars memory vars = abi.decode(data[4:], (LiquidateToTokensWithFlashSwapVars));\n\n // Post token flashloan\n // Cache liquidation profit token (or the zero address for NATIVE) for use as source for exchange later\n _liquidatorProfitExchangeSource = postFlashLoanTokens(vars, fee0, fee1);\n }\n\n /**\n * @dev Liquidate unhealthy token borrow, exchange seized collateral, return flashloaned funds, and exchange profit.\n */\n function postFlashLoanTokens(\n LiquidateToTokensWithFlashSwapVars memory vars,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IERC20Upgradeable debtRepaymentToken = IERC20Upgradeable(_flashSwapToken);\n uint256 debtRepaymentAmount = _flashSwapAmount;\n\n if (vars.debtFundingStrategies.length > 0) {\n // loop backwards to convert the initial (flash-swapped token) input to the final expected output (debt token)\n for (uint256 i = vars.debtFundingStrategies.length; i > 0; i--) {\n (debtRepaymentToken, debtRepaymentAmount) = convertCustomFunds(\n debtRepaymentToken,\n debtRepaymentAmount,\n vars.debtFundingStrategies[i - 1],\n vars.debtFundingStrategiesData[i - 1]\n );\n }\n }\n\n // Approve the debt repayment transfer, liquidate and redeem the seized collateral\n {\n address underlyingBorrow = vars.cErc20.underlying();\n require(\n address(debtRepaymentToken) == underlyingBorrow,\n \"the debt repayment funds should be converted to the underlying debt token\"\n );\n require(debtRepaymentAmount >= vars.repayAmount, \"debt repayment amount not enough\");\n // Approve repayAmount to cErc20\n IERC20Upgradeable(underlyingBorrow).approve(address(vars.cErc20), vars.repayAmount);\n\n // Liquidate borrow\n require(\n vars.cErc20.liquidateBorrow(vars.borrower, vars.repayAmount, address(vars.cTokenCollateral)) == 0,\n \"Liquidation failed.\"\n );\n\n // Redeem seized cTokens for underlying asset\n uint256 seizedCTokenAmount = vars.cTokenCollateral.balanceOf(address(this));\n require(seizedCTokenAmount > 0, \"No cTokens seized.\");\n uint256 redeemResult = vars.cTokenCollateral.redeem(seizedCTokenAmount);\n require(redeemResult == 0, \"Error calling redeeming seized cToken: error code not equal to 0\");\n }\n\n // Repay flashloan\n return repayTokenFlashLoan(vars.cTokenCollateral, vars.redemptionStrategies, vars.strategyData, fee0, fee1);\n }\n\n /**\n * @dev Repays token flashloans.\n */\n function repayTokenFlashLoan(\n ICErc20 cTokenCollateral,\n IRedemptionStrategy[] memory redemptionStrategies,\n bytes[] memory strategyData,\n uint256 fee0,\n uint256 fee1\n ) private returns (address) {\n IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);\n uint256 flashSwapReturnAmount = _flashSwapAmount;\n if (IUniswapV3Pool(msg.sender).token0() == _flashSwapToken) {\n flashSwapReturnAmount += fee0;\n } else if (IUniswapV3Pool(msg.sender).token1() == _flashSwapToken) {\n flashSwapReturnAmount += fee1;\n } else {\n revert(\"wrong pool or _flashSwapToken\");\n }\n\n // Swap cTokenCollateral for cErc20 via Uniswap\n // Check underlying collateral seized\n IERC20Upgradeable underlyingCollateral = IERC20Upgradeable(ICErc20(address(cTokenCollateral)).underlying());\n uint256 underlyingCollateralSeized = underlyingCollateral.balanceOf(address(this));\n\n // Redeem custom collateral if liquidation strategy is set\n if (redemptionStrategies.length > 0) {\n require(\n redemptionStrategies.length == strategyData.length,\n \"IRedemptionStrategy contract array and strategy data bytes array mnust the the same length.\"\n );\n for (uint256 i = 0; i < redemptionStrategies.length; i++)\n (underlyingCollateral, underlyingCollateralSeized) = redeemCustomCollateral(\n underlyingCollateral,\n underlyingCollateralSeized,\n redemptionStrategies[i],\n strategyData[i]\n );\n }\n\n // Check if we can repay directly one of the sides with collateral\n if (address(underlyingCollateral) == pool.token0() || address(underlyingCollateral) == pool.token1()) {\n // Repay flashloan directly with collateral\n uint256 collateralRequired;\n if (address(underlyingCollateral) == _flashSwapToken) {\n // repay the borrowed asset directly\n collateralRequired = flashSwapReturnAmount;\n\n // Repay flashloan\n IERC20Upgradeable(_flashSwapToken).transfer(address(pool), flashSwapReturnAmount);\n } else {\n // TODO swap within the same pool and then repay the FL to the pool\n bool zeroForOne = address(underlyingCollateral) == pool.token0();\n\n {\n collateralRequired = quoter.quoteExactOutputSingle(\n zeroForOne ? pool.token0() : pool.token1(),\n zeroForOne ? pool.token1() : pool.token0(),\n pool.fee(),\n _flashSwapAmount,\n 0 // sqrtPriceLimitX96\n );\n }\n require(\n collateralRequired <= underlyingCollateralSeized,\n \"Token flashloan return amount greater than seized collateral.\"\n );\n\n // Repay flashloan\n pool.swap(\n address(pool),\n zeroForOne,\n int256(collateralRequired),\n 0, // sqrtPriceLimitX96\n \"\"\n );\n }\n\n return address(underlyingCollateral);\n } else {\n revert(\"the redemptions strategy did not swap to the flash swapped pool assets\");\n }\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategy(IRedemptionStrategy strategy, bool whitelisted) external onlyOwner {\n redemptionStrategiesWhitelist[address(strategy)] = whitelisted;\n }\n\n /**\n * @dev for security reasons only whitelisted redemption strategies may be used.\n * Each whitelisted redemption strategy has to be checked to not be able to\n * call `selfdestruct` with the `delegatecall` call in `redeemCustomCollateral`\n */\n function _whitelistRedemptionStrategies(\n IRedemptionStrategy[] calldata strategies,\n bool[] calldata whitelisted\n ) external onlyOwner {\n require(\n strategies.length > 0 && strategies.length == whitelisted.length,\n \"list of strategies empty or whitelist does not match its length\"\n );\n\n for (uint256 i = 0; i < strategies.length; i++) {\n redemptionStrategiesWhitelist[address(strategies[i])] = whitelisted[i];\n }\n }\n\n function setExpressRelay(address _expressRelay) external onlyOwner {\n expressRelay = IExpressRelay(_expressRelay);\n }\n\n function setPoolLens(address _poolLens) external onlyOwner {\n lens = PoolLens(_poolLens);\n }\n\n function setHealthFactorThreshold(uint256 _healthFactorThreshold) external onlyOwner {\n require(_healthFactorThreshold <= 1e18, \"Invalid Health Factor Threshold\");\n healthFactorThreshold = _healthFactorThreshold;\n }\n\n /**\n * @dev Redeem \"special\" collateral tokens (before swapping the output for borrowed tokens to be repaid via Uniswap).\n * Public visibility because we have to call this function externally if called from a payable IonicLiquidator function (for some reason delegatecall fails when called with msg.value > 0).\n */\n function redeemCustomCollateral(\n IERC20Upgradeable underlyingCollateral,\n uint256 underlyingCollateralSeized,\n IRedemptionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.redeem.selector, underlyingCollateral, underlyingCollateralSeized, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n function convertCustomFunds(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n IFundsConversionStrategy strategy,\n bytes memory strategyData\n ) private returns (IERC20Upgradeable, uint256) {\n require(redemptionStrategiesWhitelist[address(strategy)], \"only whitelisted redemption strategies can be used\");\n\n bytes memory returndata = _functionDelegateCall(\n address(strategy),\n abi.encodeWithSelector(strategy.convert.selector, inputToken, inputAmount, strategyData)\n );\n return abi.decode(returndata, (IERC20Upgradeable, uint256));\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L37\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Used by `_functionDelegateCall` to verify the result of a delegate call.\n * Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/contracts/blob/cb4774ace1cb84f2662fa47c573780aab937628b/contracts/utils/MulticallUpgradeable.sol#L45\n */\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) private pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/liquidators/IFundsConversionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"./IRedemptionStrategy.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IFundsConversionStrategy is IRedemptionStrategy {\n function convert(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function estimateInputAmount(\n uint256 outputAmount,\n bytes memory strategyData\n ) external view returns (IERC20Upgradeable inputToken, uint256 inputAmount);\n}\n" + }, + "contracts/liquidators/IRedemptionStrategy.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @title IRedemptionStrategy\n * @notice Redeems seized wrapped token collateral for an underlying token for use as a step in a liquidation.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface IRedemptionStrategy {\n /**\n * @notice Redeems custom collateral `token` for an underlying token.\n * @param inputToken The input wrapped token to be redeemed for an underlying token.\n * @param inputAmount The amount of the input wrapped token to be redeemed for an underlying token.\n * @param strategyData The ABI-encoded data to be used in the redemption strategy logic.\n * @return outputToken The underlying ERC20 token outputted.\n * @return outputAmount The quantity of underlying tokens outputted.\n */\n function redeem(\n IERC20Upgradeable inputToken,\n uint256 inputAmount,\n bytes memory strategyData\n ) external returns (IERC20Upgradeable outputToken, uint256 outputAmount);\n\n function name() external view returns (string memory);\n}\n" + }, + "contracts/oracles/BasePriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"../compound/CTokenInterfaces.sol\";\n\n/**\n * @title BasePriceOracle\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\n * @dev Implements the `PriceOracle` interface.\n * @author David Lucid (https://github.com/davidlucid)\n */\ninterface BasePriceOracle {\n /**\n * @notice Get the price of an underlying asset.\n * @param underlying The underlying asset to get the price of.\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function price(address underlying) external view returns (uint256);\n\n /**\n * @notice Get the underlying price of a cToken asset\n * @param cToken The cToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\n}\n" + }, + "contracts/oracles/MasterPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\nimport { ICErc20 } from \"../compound/CTokenInterfaces.sol\";\n\nimport { BasePriceOracle } from \"./BasePriceOracle.sol\";\n\n/**\n * @title MasterPriceOracle\n * @notice Use a combination of price oracles.\n * @dev Implements `PriceOracle`.\n * @author David Lucid (https://github.com/davidlucid)\n */\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public oracles;\n\n /**\n * @dev Default/fallback `PriceOracle`.\n */\n BasePriceOracle public defaultOracle;\n\n /**\n * @dev The administrator of this `MasterPriceOracle`.\n */\n address public admin;\n\n /**\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n bool internal noAdminOverwrite;\n\n /**\n * @dev The Wrapped native asset address.\n */\n address public wtoken;\n\n /**\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\n */\n mapping(address => BasePriceOracle) public fallbackOracles;\n\n /**\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\n */\n function canAdminOverwrite() external view returns (bool) {\n return !noAdminOverwrite;\n }\n\n /**\n * @dev Event emitted when `admin` is changed.\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @dev Event emitted when the default oracle is changed.\n */\n event NewDefaultOracle(address oldOracle, address newOracle);\n\n /**\n * @dev Event emitted when an underlying token's oracle is changed.\n */\n event NewOracle(address underlying, address oldOracle, address newOracle);\n\n /**\n * @dev Initialize state variables.\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\n * @param _defaultOracle The default `PriceOracle` contract to use.\n * @param _admin The admin who can assign oracles to underlying tokens.\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\n * @param _wtoken The Wrapped native asset address\n */\n function initialize(\n address[] memory underlyings,\n BasePriceOracle[] memory _oracles,\n BasePriceOracle _defaultOracle,\n address _admin,\n bool _canAdminOverwrite,\n address _wtoken\n ) external initializer {\n // Input validation\n require(underlyings.length == _oracles.length, \"Lengths of both arrays must be equal.\");\n\n // Initialize state variables\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, address(0), address(newOracle));\n }\n\n defaultOracle = _defaultOracle;\n admin = _admin;\n noAdminOverwrite = !_canAdminOverwrite;\n wtoken = _wtoken;\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(oracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n oracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Sets `_oracles` for `underlyings`.\n */\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\n // Input validation\n require(\n underlyings.length > 0 && underlyings.length == _oracles.length,\n \"Lengths of both arrays must be equal and greater than 0.\"\n );\n\n // Assign oracles to underlying tokens\n for (uint256 i = 0; i < underlyings.length; i++) {\n address underlying = underlyings[i];\n address oldOracle = address(fallbackOracles[underlying]);\n if (noAdminOverwrite)\n require(\n oldOracle == address(0),\n \"Admin cannot overwrite existing assignments of oracles to underlying tokens.\"\n );\n BasePriceOracle newOracle = _oracles[i];\n fallbackOracles[underlying] = newOracle;\n emit NewOracle(underlying, oldOracle, address(newOracle));\n }\n }\n\n /**\n * @dev Changes the default price oracle\n */\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\n BasePriceOracle oldOracle = defaultOracle;\n defaultOracle = newOracle;\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\n }\n\n /**\n * @dev Changes the admin and emits an event.\n */\n function changeAdmin(address newAdmin) external onlyAdmin {\n address oldAdmin = admin;\n admin = newAdmin;\n emit NewAdmin(oldAdmin, newAdmin);\n }\n\n /**\n * @dev Modifier that checks if `msg.sender == admin`.\n */\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Sender is not the admin.\");\n _;\n }\n\n /**\n * @notice Returns the price in ETH of the token underlying `cToken`.\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\n */\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\n // Get underlying ERC20 token address\n address underlying = address(ICErc20(address(cToken)).underlying());\n\n if (underlying == wtoken) return 1e18;\n\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n\n /**\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\n */\n function price(address underlying) public view override returns (uint256) {\n // Return 1e18 for WETH\n if (underlying == wtoken) return 1e18;\n\n // Get underlying price from assigned oracle\n BasePriceOracle oracle = oracles[underlying];\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\n\n if (address(oracle) != address(0)) {\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\n if (underlyingPrice == 0) {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n } else {\n return underlyingPrice;\n }\n } catch {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n } else {\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\n }\n revert(\"Price oracle not found for this underlying token address.\");\n }\n}\n" + }, + "contracts/PoolDirectory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/utils/Create2Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { Unitroller } from \"./compound/Unitroller.sol\";\nimport \"./ionic/SafeOwnableUpgradeable.sol\";\nimport \"./ionic/DiamondExtension.sol\";\n\n/**\n * @title PoolDirectory\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolDirectory is a directory for Ionic interest rate pools.\n */\ncontract PoolDirectory is SafeOwnableUpgradeable {\n /**\n * @dev Initializes a deployer whitelist if desired.\n * @param _enforceDeployerWhitelist Boolean indicating if the deployer whitelist is to be enforced.\n * @param _deployerWhitelist Array of Ethereum accounts to be whitelisted.\n */\n function initialize(bool _enforceDeployerWhitelist, address[] memory _deployerWhitelist) public initializer {\n __SafeOwnable_init(msg.sender);\n enforceDeployerWhitelist = _enforceDeployerWhitelist;\n for (uint256 i = 0; i < _deployerWhitelist.length; i++) deployerWhitelist[_deployerWhitelist[i]] = true;\n }\n\n /**\n * @dev Struct for a Ionic interest rate pool.\n */\n struct Pool {\n string name;\n address creator;\n address comptroller;\n uint256 blockPosted;\n uint256 timestampPosted;\n }\n\n /**\n * @dev Array of Ionic interest rate pools.\n */\n Pool[] public pools;\n\n /**\n * @dev Maps Ethereum accounts to arrays of Ionic pool indexes.\n */\n mapping(address => uint256[]) private _poolsByAccount;\n\n /**\n * @dev Maps Ionic pool Comptroller addresses to bools indicating if they have been registered via the directory.\n */\n mapping(address => bool) public poolExists;\n\n /**\n * @dev Emitted when a new Ionic pool is added to the directory.\n */\n event PoolRegistered(uint256 index, Pool pool);\n\n /**\n * @dev Booleans indicating if the deployer whitelist is enforced.\n */\n bool public enforceDeployerWhitelist;\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.\n */\n mapping(address => bool) public deployerWhitelist;\n\n /**\n * @dev Controls if the deployer whitelist is to be enforced.\n * @param enforce Boolean indicating if the deployer whitelist is to be enforced.\n */\n function _setDeployerWhitelistEnforcement(bool enforce) external onlyOwner {\n enforceDeployerWhitelist = enforce;\n }\n\n /**\n * @dev Adds/removes Ethereum accounts to the deployer whitelist.\n * @param deployers Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editDeployerWhitelist(address[] calldata deployers, bool status) external onlyOwner {\n require(deployers.length > 0, \"No deployers supplied.\");\n for (uint256 i = 0; i < deployers.length; i++) deployerWhitelist[deployers[i]] = status;\n }\n\n /**\n * @dev Adds a new Ionic pool to the directory (without checking msg.sender).\n * @param name The name of the pool.\n * @param comptroller The pool's Comptroller proxy contract address.\n * @return The index of the registered Ionic pool.\n */\n function _registerPool(string memory name, address comptroller) internal returns (uint256) {\n require(!poolExists[comptroller], \"Pool already exists in the directory.\");\n require(!enforceDeployerWhitelist || deployerWhitelist[msg.sender], \"Sender is not on deployer whitelist.\");\n require(bytes(name).length <= 100, \"No pool name supplied.\");\n Pool memory pool = Pool(name, msg.sender, comptroller, block.number, block.timestamp);\n pools.push(pool);\n _poolsByAccount[msg.sender].push(pools.length - 1);\n poolExists[comptroller] = true;\n emit PoolRegistered(pools.length - 1, pool);\n return pools.length - 1;\n }\n\n function _deprecatePool(address comptroller) external onlyOwner {\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller == comptroller) {\n _deprecatePool(i);\n break;\n }\n }\n }\n\n function _deprecatePool(uint256 index) public onlyOwner {\n Pool storage ionicPool = pools[index];\n\n require(ionicPool.comptroller != address(0), \"pool already deprecated\");\n\n // swap with the last pool of the creator and delete\n uint256[] storage creatorPools = _poolsByAccount[ionicPool.creator];\n for (uint256 i = 0; i < creatorPools.length; i++) {\n if (creatorPools[i] == index) {\n creatorPools[i] = creatorPools[creatorPools.length - 1];\n creatorPools.pop();\n break;\n }\n }\n\n // leave it to true to deny the re-registering of the same pool\n poolExists[ionicPool.comptroller] = true;\n\n // nullify the storage\n ionicPool.comptroller = address(0);\n ionicPool.creator = address(0);\n ionicPool.name = \"\";\n ionicPool.blockPosted = 0;\n ionicPool.timestampPosted = 0;\n }\n\n /**\n * @dev Deploys a new Ionic pool and adds to the directory.\n * @param name The name of the pool.\n * @param implementation The Comptroller implementation contract address.\n * @param constructorData Encoded construction data for `Unitroller constructor()`\n * @param enforceWhitelist Boolean indicating if the pool's supplier/borrower whitelist is to be enforced.\n * @param closeFactor The pool's close factor (scaled by 1e18).\n * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18).\n * @param priceOracle The pool's PriceOracle contract address.\n * @return Index of the registered Ionic pool and the Unitroller proxy address.\n */\n function deployPool(\n string memory name,\n address implementation,\n bytes calldata constructorData,\n bool enforceWhitelist,\n uint256 closeFactor,\n uint256 liquidationIncentive,\n address priceOracle\n ) external returns (uint256, address) {\n // Input validation\n require(implementation != address(0), \"No Comptroller implementation contract address specified.\");\n require(priceOracle != address(0), \"No PriceOracle contract address specified.\");\n\n // Deploy Unitroller using msg.sender, name, and block.number as a salt\n bytes memory unitrollerCreationCode = abi.encodePacked(type(Unitroller).creationCode, constructorData);\n address proxy = Create2Upgradeable.deploy(\n 0,\n keccak256(abi.encodePacked(msg.sender, name, ++poolsCounter)),\n unitrollerCreationCode\n );\n\n // Setup the pool\n IonicComptroller comptrollerProxy = IonicComptroller(proxy);\n // Set up the extensions\n comptrollerProxy._upgrade();\n\n // Set pool parameters\n require(comptrollerProxy._setCloseFactor(closeFactor) == 0, \"Failed to set pool close factor.\");\n require(\n comptrollerProxy._setLiquidationIncentive(liquidationIncentive) == 0,\n \"Failed to set pool liquidation incentive.\"\n );\n require(comptrollerProxy._setPriceOracle(BasePriceOracle(priceOracle)) == 0, \"Failed to set pool price oracle.\");\n\n // Whitelist\n if (enforceWhitelist)\n require(comptrollerProxy._setWhitelistEnforcement(true) == 0, \"Failed to enforce supplier/borrower whitelist.\");\n\n // Make msg.sender the admin\n require(comptrollerProxy._setPendingAdmin(msg.sender) == 0, \"Failed to set pending admin on Unitroller.\");\n\n // Register the pool with this PoolDirectory\n return (_registerPool(name, proxy), proxy);\n }\n\n /**\n * @notice Returns `ids` and directory information of all non-deprecated Ionic pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getActivePools() public view returns (uint256[] memory, Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory activePools = new Pool[](count);\n uint256[] memory poolIds = new uint256[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n poolIds[index] = i;\n activePools[index] = pools[i];\n index++;\n }\n }\n\n return (poolIds, activePools);\n }\n\n /**\n * @notice Returns arrays of all Ionic pools' data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getAllPools() public view returns (Pool[] memory) {\n uint256 count = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) count++;\n }\n\n Pool[] memory result = new Pool[](count);\n\n uint256 index = 0;\n for (uint256 i = 0; i < pools.length; i++) {\n if (pools[i].comptroller != address(0)) {\n result[index++] = pools[i];\n }\n }\n\n return result;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPools() external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).enforceWhitelist() returns (bool enforceWhitelist) {\n if (enforceWhitelist) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes and data.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolsOfUser(address user) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory poolsOfUser = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n try IonicComptroller(activePools[i].comptroller).isUserOfPool(user) returns (bool isUsing) {\n if (!isUsing) continue;\n } catch {}\n\n indexes[index] = i;\n poolsOfUser[index] = activePools[i];\n index++;\n }\n\n return (indexes, poolsOfUser);\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data created by `account`.\n */\n function getPoolsByAccount(address account) external view returns (uint256[] memory, Pool[] memory) {\n uint256[] memory indexes = new uint256[](_poolsByAccount[account].length);\n Pool[] memory accountPools = new Pool[](_poolsByAccount[account].length);\n (, Pool[] memory activePools) = getActivePools();\n\n for (uint256 i = 0; i < _poolsByAccount[account].length; i++) {\n indexes[i] = _poolsByAccount[account][i];\n accountPools[i] = activePools[_poolsByAccount[account][i]];\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Modify existing Ionic pool name.\n */\n function setPoolName(uint256 index, string calldata name) external {\n IonicComptroller _comptroller = IonicComptroller(pools[index].comptroller);\n require(\n (msg.sender == _comptroller.admin() && _comptroller.adminHasRights()) || msg.sender == owner(),\n \"!permission\"\n );\n pools[index].name = name;\n }\n\n /**\n * @dev Maps Ethereum accounts to booleans indicating if they are a whitelisted admin.\n */\n mapping(address => bool) public adminWhitelist;\n\n /**\n * @dev used as salt for the creation of new pools\n */\n uint256 public poolsCounter;\n\n /**\n * @dev Event emitted when the admin whitelist is updated.\n */\n event AdminWhitelistUpdated(address[] admins, bool status);\n\n /**\n * @dev Adds/removes Ethereum accounts to the admin whitelist.\n * @param admins Array of Ethereum accounts to be whitelisted.\n * @param status Whether to add or remove the accounts.\n */\n function _editAdminWhitelist(address[] calldata admins, bool status) external onlyOwner {\n require(admins.length > 0, \"No admins supplied.\");\n for (uint256 i = 0; i < admins.length; i++) adminWhitelist[admins[i]] = status;\n emit AdminWhitelistUpdated(admins, status);\n }\n\n /**\n * @notice Returns arrays of all Ionic pool indexes and data with whitelisted admins.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPublicPoolsByVerification(bool whitelistedAdmin) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory publicPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.admin() returns (address admin) {\n if (whitelistedAdmin != adminWhitelist[admin]) continue;\n } catch {}\n\n indexes[index] = i;\n publicPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, publicPools);\n }\n\n /**\n * @notice Returns arrays of all verified Ionic pool indexes and data for which the account is whitelisted\n * @param account who is whitelisted in the returned verified whitelist-enabled pools.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getVerifiedPoolsOfWhitelistedAccount(\n address account\n ) external view returns (uint256[] memory, Pool[] memory) {\n uint256 arrayLength = 0;\n (, Pool[] memory activePools) = getActivePools();\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n Pool[] memory accountWhitelistedPools = new Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < activePools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(activePools[i].comptroller);\n try comptroller.enforceWhitelist() returns (bool enforceWhitelist) {\n if (!enforceWhitelist || !comptroller.whitelist(account)) continue;\n } catch {}\n\n indexes[index] = i;\n accountWhitelistedPools[index] = activePools[i];\n index++;\n }\n\n return (indexes, accountWhitelistedPools);\n }\n}\n" + }, + "contracts/PoolLens.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\";\n\nimport { IonicComptroller } from \"./compound/ComptrollerInterface.sol\";\nimport { BasePriceOracle } from \"./oracles/BasePriceOracle.sol\";\nimport { ICErc20 } from \"./compound/CTokenInterfaces.sol\";\n\nimport { PoolDirectory } from \"./PoolDirectory.sol\";\nimport { MasterPriceOracle } from \"./oracles/MasterPriceOracle.sol\";\n\n/**\n * @title PoolLens\n * @author David Lucid (https://github.com/davidlucid)\n * @notice PoolLens returns data on Ionic interest rate pools in mass for viewing by dApps, bots, etc.\n */\ncontract PoolLens is Initializable {\n error ComptrollerError(uint256 errCode);\n\n /**\n * @notice Initialize the `PoolDirectory` contract object.\n * @param _directory The PoolDirectory\n * @param _name Name for the nativeToken\n * @param _symbol Symbol for the nativeToken\n * @param _hardcodedAddresses Underlying token addresses for a token like maker which are DSToken and/or use bytes32 for `symbol`\n * @param _hardcodedNames Harcoded name for these tokens\n * @param _hardcodedSymbols Harcoded symbol for these tokens\n * @param _uniswapLPTokenNames Harcoded names for underlying uniswap LpToken\n * @param _uniswapLPTokenSymbols Harcoded symbols for underlying uniswap LpToken\n * @param _uniswapLPTokenDisplayNames Harcoded display names for underlying uniswap LpToken\n */\n function initialize(\n PoolDirectory _directory,\n string memory _name,\n string memory _symbol,\n address[] memory _hardcodedAddresses,\n string[] memory _hardcodedNames,\n string[] memory _hardcodedSymbols,\n string[] memory _uniswapLPTokenNames,\n string[] memory _uniswapLPTokenSymbols,\n string[] memory _uniswapLPTokenDisplayNames\n ) public initializer {\n require(address(_directory) != address(0), \"PoolDirectory instance cannot be the zero address.\");\n require(\n _hardcodedAddresses.length == _hardcodedNames.length && _hardcodedAddresses.length == _hardcodedSymbols.length,\n \"Hardcoded addresses lengths not equal.\"\n );\n require(\n _uniswapLPTokenNames.length == _uniswapLPTokenSymbols.length &&\n _uniswapLPTokenNames.length == _uniswapLPTokenDisplayNames.length,\n \"Uniswap LP token names lengths not equal.\"\n );\n\n directory = _directory;\n name = _name;\n symbol = _symbol;\n for (uint256 i = 0; i < _hardcodedAddresses.length; i++) {\n hardcoded[_hardcodedAddresses[i]] = TokenData({ name: _hardcodedNames[i], symbol: _hardcodedSymbols[i] });\n }\n\n for (uint256 i = 0; i < _uniswapLPTokenNames.length; i++) {\n uniswapData.push(\n UniswapData({\n name: _uniswapLPTokenNames[i],\n symbol: _uniswapLPTokenSymbols[i],\n displayName: _uniswapLPTokenDisplayNames[i]\n })\n );\n }\n }\n\n string public name;\n string public symbol;\n\n struct TokenData {\n string name;\n string symbol;\n }\n mapping(address => TokenData) hardcoded;\n\n struct UniswapData {\n string name; // ie \"Uniswap V2\" or \"SushiSwap LP Token\"\n string symbol; // ie \"UNI-V2\" or \"SLP\"\n string displayName; // ie \"SushiSwap\" or \"Uniswap\"\n }\n UniswapData[] uniswapData;\n\n /**\n * @notice `PoolDirectory` contract object.\n */\n PoolDirectory public directory;\n\n /**\n * @dev Struct for Ionic pool summary data.\n */\n struct IonicPoolData {\n uint256 totalSupply;\n uint256 totalBorrow;\n address[] underlyingTokens;\n string[] underlyingSymbols;\n bool whitelistedAdmin;\n }\n\n /**\n * @notice Returns arrays of all public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsWithData()\n external\n returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory)\n {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPools();\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of all whitelisted public Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPublicPoolsByVerificationWithData(\n bool whitelistedAdmin\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory publicPools) = directory.getPublicPoolsByVerification(\n whitelistedAdmin\n );\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(publicPools);\n return (indexes, publicPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools created by `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = directory.getPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools used by `user`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsOIonicrWithData(\n address user\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory userPools) = directory.getPoolsOfUser(user);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(userPools);\n return (indexes, userPools, data, errored);\n }\n\n /**\n * @notice Internal function returning arrays of requested Ionic pool indexes, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getPoolsData(PoolDirectory.Pool[] memory pools) internal returns (IonicPoolData[] memory, bool[] memory) {\n IonicPoolData[] memory data = new IonicPoolData[](pools.length);\n bool[] memory errored = new bool[](pools.length);\n\n for (uint256 i = 0; i < pools.length; i++) {\n try this.getPoolSummary(IonicComptroller(pools[i].comptroller)) returns (\n uint256 _totalSupply,\n uint256 _totalBorrow,\n address[] memory _underlyingTokens,\n string[] memory _underlyingSymbols,\n bool _whitelistedAdmin\n ) {\n data[i] = IonicPoolData(_totalSupply, _totalBorrow, _underlyingTokens, _underlyingSymbols, _whitelistedAdmin);\n } catch {\n errored[i] = true;\n }\n }\n\n return (data, errored);\n }\n\n /**\n * @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.\n */\n function getPoolSummary(\n IonicComptroller comptroller\n ) external returns (uint256, uint256, address[] memory, string[] memory, bool) {\n uint256 totalBorrow = 0;\n uint256 totalSupply = 0;\n ICErc20[] memory cTokens = comptroller.getAllMarkets();\n address[] memory underlyingTokens = new address[](cTokens.length);\n string[] memory underlyingSymbols = new string[](cTokens.length);\n BasePriceOracle oracle = comptroller.oracle();\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n ICErc20 cToken = cTokens[i];\n (bool isListed, ) = comptroller.markets(address(cToken));\n if (!isListed) continue;\n cToken.accrueInterest();\n uint256 assetTotalBorrow = cToken.totalBorrowsCurrent();\n uint256 assetTotalSupply = cToken.getCash() +\n assetTotalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n uint256 underlyingPrice = oracle.getUnderlyingPrice(cToken);\n totalBorrow = totalBorrow + (assetTotalBorrow * underlyingPrice) / 1e18;\n totalSupply = totalSupply + (assetTotalSupply * underlyingPrice) / 1e18;\n\n underlyingTokens[i] = ICErc20(address(cToken)).underlying();\n (, underlyingSymbols[i]) = getTokenNameAndSymbol(underlyingTokens[i]);\n }\n\n bool whitelistedAdmin = directory.adminWhitelist(comptroller.admin());\n return (totalSupply, totalBorrow, underlyingTokens, underlyingSymbols, whitelistedAdmin);\n }\n\n /**\n * @dev Struct for a Ionic pool asset.\n */\n struct PoolAsset {\n address cToken;\n address underlyingToken;\n string underlyingName;\n string underlyingSymbol;\n uint256 underlyingDecimals;\n uint256 underlyingBalance;\n uint256 supplyRatePerBlock;\n uint256 borrowRatePerBlock;\n uint256 totalSupply;\n uint256 totalBorrow;\n uint256 supplyBalance;\n uint256 borrowBalance;\n uint256 liquidity;\n bool membership;\n uint256 exchangeRate; // Price of cTokens in terms of underlying tokens\n uint256 underlyingPrice; // Price of underlying tokens in ETH (scaled by 1e18)\n address oracle;\n uint256 collateralFactor;\n uint256 reserveFactor;\n uint256 adminFee;\n uint256 ionicFee;\n bool borrowGuardianPaused;\n bool mintGuardianPaused;\n }\n\n /**\n * @notice Returns data on the specified assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract address of the Ionic pool.\n * @param cTokens The cToken contract addresses of the assets to query.\n * @param user The user for which to get account data.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(\n IonicComptroller comptroller,\n ICErc20[] memory cTokens,\n address user\n ) internal returns (PoolAsset[] memory) {\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n (bool isListed, ) = comptroller.markets(address(cTokens[i]));\n if (isListed) arrayLength++;\n }\n\n PoolAsset[] memory detailedAssets = new PoolAsset[](arrayLength);\n uint256 index = 0;\n BasePriceOracle oracle = BasePriceOracle(address(comptroller.oracle()));\n\n for (uint256 i = 0; i < cTokens.length; i++) {\n // Check if market is listed and get collateral factor\n (bool isListed, uint256 collateralFactorMantissa) = comptroller.markets(address(cTokens[i]));\n if (!isListed) continue;\n\n // Start adding data to PoolAsset\n PoolAsset memory asset;\n ICErc20 cToken = cTokens[i];\n asset.cToken = address(cToken);\n\n cToken.accrueInterest();\n\n // Get underlying asset data\n asset.underlyingToken = ICErc20(address(cToken)).underlying();\n ERC20Upgradeable underlying = ERC20Upgradeable(asset.underlyingToken);\n (asset.underlyingName, asset.underlyingSymbol) = getTokenNameAndSymbol(asset.underlyingToken);\n asset.underlyingDecimals = underlying.decimals();\n asset.underlyingBalance = underlying.balanceOf(user);\n\n // Get cToken data\n asset.supplyRatePerBlock = cToken.supplyRatePerBlock();\n asset.borrowRatePerBlock = cToken.borrowRatePerBlock();\n asset.liquidity = cToken.getCash();\n asset.totalBorrow = cToken.totalBorrowsCurrent();\n asset.totalSupply =\n asset.liquidity +\n asset.totalBorrow -\n (cToken.totalReserves() + cToken.totalAdminFees() + cToken.totalIonicFees());\n asset.supplyBalance = cToken.balanceOfUnderlying(user);\n asset.borrowBalance = cToken.borrowBalanceCurrent(user);\n asset.membership = comptroller.checkMembership(user, cToken);\n asset.exchangeRate = cToken.exchangeRateCurrent(); // We would use exchangeRateCurrent but we already accrue interest above\n asset.underlyingPrice = oracle.price(asset.underlyingToken);\n\n // Get oracle for this cToken\n asset.oracle = address(oracle);\n\n try MasterPriceOracle(asset.oracle).oracles(asset.underlyingToken) returns (BasePriceOracle _oracle) {\n asset.oracle = address(_oracle);\n } catch {}\n\n // More cToken data\n asset.collateralFactor = collateralFactorMantissa;\n asset.reserveFactor = cToken.reserveFactorMantissa();\n asset.adminFee = cToken.adminFeeMantissa();\n asset.ionicFee = cToken.ionicFeeMantissa();\n asset.borrowGuardianPaused = comptroller.borrowGuardianPaused(address(cToken));\n asset.mintGuardianPaused = comptroller.mintGuardianPaused(address(cToken));\n\n // Add to assets array and increment index\n detailedAssets[index] = asset;\n index++;\n }\n\n return (detailedAssets);\n }\n\n function getBorrowCapsPerCollateral(\n ICErc20 borrowedAsset,\n IonicComptroller comptroller\n )\n internal\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsAgainstCollateral,\n bool[] memory borrowingBlacklistedAgainstCollateral\n )\n {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n collateral = new address[](poolMarkets.length);\n borrowCapsAgainstCollateral = new uint256[](poolMarkets.length);\n borrowingBlacklistedAgainstCollateral = new bool[](poolMarkets.length);\n\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n address collateralAddress = address(poolMarkets[i]);\n if (collateralAddress != address(borrowedAsset)) {\n collateral[i] = collateralAddress;\n borrowCapsAgainstCollateral[i] = comptroller.borrowCapForCollateral(address(borrowedAsset), collateralAddress);\n borrowingBlacklistedAgainstCollateral[i] = comptroller.borrowingAgainstCollateralBlacklist(\n address(borrowedAsset),\n collateralAddress\n );\n }\n }\n }\n\n /**\n * @notice Returns the `name` and `symbol` of `token`.\n * Supports Uniswap V2 and SushiSwap LP tokens as well as MKR.\n * @param token An ERC20 token contract object.\n * @return The `name` and `symbol`.\n */\n function getTokenNameAndSymbol(address token) internal view returns (string memory, string memory) {\n // i.e. MKR is a DSToken and uses bytes32\n if (bytes(hardcoded[token].symbol).length != 0) {\n return (hardcoded[token].name, hardcoded[token].symbol);\n }\n\n // Get name and symbol from token contract\n ERC20Upgradeable tokenContract = ERC20Upgradeable(token);\n string memory _name = tokenContract.name();\n string memory _symbol = tokenContract.symbol();\n\n return (_name, _symbol);\n }\n\n /**\n * @notice Returns the assets of the specified Ionic pool.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n * @param comptroller The Comptroller proxy contract of the Ionic pool.\n * @return An array of Ionic pool assets.\n */\n function getPoolAssetsWithData(IonicComptroller comptroller) external returns (PoolAsset[] memory) {\n return getPoolAssetsWithData(comptroller, comptroller.getAllMarkets(), msg.sender);\n }\n\n /**\n * @dev Struct for a Ionic pool user.\n */\n struct IonicPoolUser {\n address account;\n uint256 totalBorrow;\n uint256 totalCollateral;\n uint256 health;\n }\n\n /**\n * @notice Returns arrays of PoolAsset for a specific user\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getPoolAssetsByUser(IonicComptroller comptroller, address user) public returns (PoolAsset[] memory) {\n PoolAsset[] memory assets = getPoolAssetsWithData(comptroller, comptroller.getAssetsIn(user), user);\n return assets;\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsForPool(IonicComptroller comptroller) public view returns (address[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n }\n\n return (assets, supplyCapsPerAsset);\n }\n\n /**\n * @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getSupplyCapsDataForPool(\n IonicComptroller comptroller\n ) public view returns (address[] memory, uint256[] memory, uint256[] memory) {\n ICErc20[] memory poolMarkets = comptroller.getAllMarkets();\n\n address[] memory assets = new address[](poolMarkets.length);\n uint256[] memory supplyCapsPerAsset = new uint256[](poolMarkets.length);\n uint256[] memory nonWhitelistedTotalSupply = new uint256[](poolMarkets.length);\n for (uint256 i = 0; i < poolMarkets.length; i++) {\n assets[i] = address(poolMarkets[i]);\n supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps(assets[i]);\n uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied();\n uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply(assets[i]);\n if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0;\n else nonWhitelistedTotalSupply[i] = assetTotalSupplied - whitelistedSuppliersSupply;\n }\n\n return (assets, supplyCapsPerAsset, nonWhitelistedTotalSupply);\n }\n\n /**\n * @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n }\n\n /**\n * @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getBorrowCapsDataForAsset(\n ICErc20 asset\n )\n public\n view\n returns (\n address[] memory collateral,\n uint256[] memory borrowCapsPerCollateral,\n bool[] memory collateralBlacklisted,\n uint256 totalBorrowCap,\n uint256 nonWhitelistedTotalBorrows\n )\n {\n IonicComptroller comptroller = IonicComptroller(asset.comptroller());\n (collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral(asset, comptroller);\n totalBorrowCap = comptroller.effectiveBorrowCaps(address(asset));\n uint256 totalBorrows = asset.totalBorrowsCurrent();\n uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows(address(asset));\n if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0;\n else nonWhitelistedTotalBorrows = totalBorrows - whitelistedBorrowersBorrows;\n }\n\n /**\n * @notice Returns arrays of Ionic pool indexes and data with a whitelist containing `account`.\n * Note that the whitelist does not have to be enforced.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n */\n function getWhitelistedPoolsByAccount(\n address account\n ) public view returns (uint256[] memory, PoolDirectory.Pool[] memory) {\n (, PoolDirectory.Pool[] memory pools) = directory.getActivePools();\n uint256 arrayLength = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) arrayLength++;\n }\n\n uint256[] memory indexes = new uint256[](arrayLength);\n PoolDirectory.Pool[] memory accountPools = new PoolDirectory.Pool[](arrayLength);\n uint256 index = 0;\n\n for (uint256 i = 0; i < pools.length; i++) {\n IonicComptroller comptroller = IonicComptroller(pools[i].comptroller);\n\n if (comptroller.whitelist(account)) {\n indexes[index] = i;\n accountPools[index] = pools[i];\n index++;\n break;\n }\n }\n\n return (indexes, accountPools);\n }\n\n /**\n * @notice Returns arrays of the indexes of Ionic pools with a whitelist containing `account`, data, total supply balances (in ETH), total borrow balances (in ETH), arrays of underlying token addresses, arrays of underlying asset symbols, and booleans indicating if retrieving each pool's data failed.\n * @dev This function is not designed to be called in a transaction: it is too gas-intensive.\n * Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.\n */\n function getWhitelistedPoolsByAccountWithData(\n address account\n ) external returns (uint256[] memory, PoolDirectory.Pool[] memory, IonicPoolData[] memory, bool[] memory) {\n (uint256[] memory indexes, PoolDirectory.Pool[] memory accountPools) = getWhitelistedPoolsByAccount(account);\n (IonicPoolData[] memory data, bool[] memory errored) = getPoolsData(accountPools);\n return (indexes, accountPools, data, errored);\n }\n\n function getHealthFactor(address user, IonicComptroller pool) external view returns (uint256) {\n return getHealthFactorHypothetical(pool, user, address(0), 0, 0, 0);\n }\n\n function getHealthFactorHypothetical(\n IonicComptroller pool,\n address account,\n address cTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount,\n uint256 repayAmount\n ) public view returns (uint256) {\n (uint256 err, uint256 collateralValue, uint256 liquidity, uint256 shortfall) = pool.getHypotheticalAccountLiquidity(\n account,\n cTokenModify,\n redeemTokens,\n borrowAmount,\n repayAmount\n );\n\n if (err != 0) revert ComptrollerError(err);\n\n if (shortfall > 0) {\n // HF < 1.0\n return (collateralValue * 1e18) / (collateralValue + shortfall);\n } else {\n // HF >= 1.0\n if (collateralValue <= liquidity) return type(uint256).max;\n else return (collateralValue * 1e18) / (collateralValue - liquidity);\n }\n }\n}\n" + }, + "solmate/auth/Auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\nabstract contract Auth {\n event OwnerUpdated(address indexed user, address indexed newOwner);\n\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n address public owner;\n\n Authority public authority;\n\n constructor(address _owner, Authority _authority) {\n owner = _owner;\n authority = _authority;\n\n emit OwnerUpdated(msg.sender, _owner);\n emit AuthorityUpdated(msg.sender, _authority);\n }\n\n modifier requiresAuth() virtual {\n require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\n\n _;\n }\n\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\n }\n\n function setAuthority(Authority newAuthority) public virtual {\n // We check if the caller is the owner first because we want to ensure they can\n // always swap out the authority even if it's reverting or using up a lot of gas.\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\n\n authority = newAuthority;\n\n emit AuthorityUpdated(msg.sender, newAuthority);\n }\n\n function setOwner(address newOwner) public virtual requiresAuth {\n owner = newOwner;\n\n emit OwnerUpdated(msg.sender, newOwner);\n }\n}\n\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\ninterface Authority {\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) external view returns (bool);\n}\n" + }, + "solmate/auth/authorities/RolesAuthority.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {Auth, Authority} from \"../Auth.sol\";\n\n/// @notice Role based Authority that supports up to 256 roles.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\ncontract RolesAuthority is Auth, Authority {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\n\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\n\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\n\n /*//////////////////////////////////////////////////////////////\n ROLE/USER STORAGE\n //////////////////////////////////////////////////////////////*/\n\n mapping(address => bytes32) public getUserRoles;\n\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\n\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\n\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\n }\n\n function doesRoleHaveCapability(\n uint8 role,\n address target,\n bytes4 functionSig\n ) public view virtual returns (bool) {\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\n }\n\n /*//////////////////////////////////////////////////////////////\n AUTHORIZATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function canCall(\n address user,\n address target,\n bytes4 functionSig\n ) public view virtual override returns (bool) {\n return\n isCapabilityPublic[target][functionSig] ||\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\n }\n\n /*//////////////////////////////////////////////////////////////\n ROLE CAPABILITY CONFIGURATION LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setPublicCapability(\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n isCapabilityPublic[target][functionSig] = enabled;\n\n emit PublicCapabilityUpdated(target, functionSig, enabled);\n }\n\n function setRoleCapability(\n uint8 role,\n address target,\n bytes4 functionSig,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\n } else {\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\n }\n\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\n }\n\n /*//////////////////////////////////////////////////////////////\n USER ROLE ASSIGNMENT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function setUserRole(\n address user,\n uint8 role,\n bool enabled\n ) public virtual requiresAuth {\n if (enabled) {\n getUserRoles[user] |= bytes32(1 << role);\n } else {\n getUserRoles[user] &= ~bytes32(1 << role);\n }\n\n emit UserRoleUpdated(user, role, enabled);\n }\n}\n" + }, + "solmate/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/DefaultProxyAdmin.json b/packages/contracts/deployments/mode/DefaultProxyAdmin.json index 12764ec141..880a1971fb 100644 --- a/packages/contracts/deployments/mode/DefaultProxyAdmin.json +++ b/packages/contracts/deployments/mode/DefaultProxyAdmin.json @@ -1,5 +1,5 @@ { - "address": "0xaF9cc7599DEFd86226e0f3A6810c4976E4a10f83", + "address": "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", "abi": [ { "inputs": [ @@ -162,38 +162,40 @@ "type": "function" } ], - "transactionHash": "0xffc4fc1c4af8b346383b9f1ce921e3bc25b9c423b8455b08af69e81f8a431ec6", + "transactionHash": "0xe4c3d7c25d99f5cd176b3750d4982de92b6ca7fa1234b0f9d8037ce00f773c2d", "receipt": { "to": null, - "from": "0x1155b614971f16758C92c4890eD338C9e3ede6b7", - "contractAddress": "0xaF9cc7599DEFd86226e0f3A6810c4976E4a10f83", - "transactionIndex": 3, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", + "transactionIndex": 1, "gasUsed": "644163", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000200000000000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000040020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa4e6a50a6f0f9253fb9dfd05c10969c91f12bee995c70ae060cea1980ce16a1f", - "transactionHash": "0xffc4fc1c4af8b346383b9f1ce921e3bc25b9c423b8455b08af69e81f8a431ec6", + "logsBloom": "0x00000000000000000000000000000000000000000000000020800000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000040000000800000800000000000000000000000000000000400000004000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7a23156594ae93efcc69d1b0035fde647e983372f9aab72ada60f0613f9ce1ce", + "transactionHash": "0xe4c3d7c25d99f5cd176b3750d4982de92b6ca7fa1234b0f9d8037ce00f773c2d", "logs": [ { - "transactionIndex": 3, - "blockNumber": 12944797, - "transactionHash": "0xffc4fc1c4af8b346383b9f1ce921e3bc25b9c423b8455b08af69e81f8a431ec6", - "address": "0xaF9cc7599DEFd86226e0f3A6810c4976E4a10f83", + "transactionIndex": 1, + "blockNumber": 19228328, + "transactionHash": "0xe4c3d7c25d99f5cd176b3750d4982de92b6ca7fa1234b0f9d8037ce00f773c2d", + "address": "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000001155b614971f16758c92c4890ed338c9e3ede6b7" + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" ], "data": "0x", - "logIndex": 24, - "blockHash": "0xa4e6a50a6f0f9253fb9dfd05c10969c91f12bee995c70ae060cea1980ce16a1f" + "logIndex": 0, + "blockHash": "0x7a23156594ae93efcc69d1b0035fde647e983372f9aab72ada60f0613f9ce1ce" } ], - "blockNumber": 12944797, - "cumulativeGasUsed": "1334901", + "blockNumber": 19228328, + "cumulativeGasUsed": "699238", "status": 1, "byzantium": true }, - "args": ["0x1155b614971f16758C92c4890eD338C9e3ede6b7"], + "args": [ + "0x7d922bf0975424b3371074f54cC784AF738Dac0D" + ], "numDeployments": 1, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialOwner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeProxyAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"name\":\"getProxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"name\":\"getProxyImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\",\"kind\":\"dev\",\"methods\":{\"changeProxyAdmin(address,address)\":{\"details\":\"Changes the admin of `proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `proxy`.\"},\"getProxyAdmin(address)\":{\"details\":\"Returns the current admin of `proxy`. Requirements: - This contract must be the admin of `proxy`.\"},\"getProxyImplementation(address)\":{\"details\":\"Returns the current implementation of `proxy`. Requirements: - This contract must be the admin of `proxy`.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"upgrade(address,address)\":{\"details\":\"Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. Requirements: - This contract must be the admin of `proxy`.\"},\"upgradeAndCall(address,address,bytes)\":{\"details\":\"Upgrades `proxy` to `implementation` and calls a function on the new implementation. See {TransparentUpgradeableProxy-upgradeToAndCall}. Requirements: - This contract must be the admin of `proxy`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol\":\"ProxyAdmin\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor (address initialOwner) {\\n _transferOwnership(initialOwner);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x9b2bbba5bb04f53f277739c1cdff896ba8b3bf591cfc4eab2098c655e8ac251e\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./TransparentUpgradeableProxy.sol\\\";\\nimport \\\"../../access/Ownable.sol\\\";\\n\\n/**\\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\\n */\\ncontract ProxyAdmin is Ownable {\\n\\n constructor (address initialOwner) Ownable(initialOwner) {}\\n\\n /**\\n * @dev Returns the current implementation of `proxy`.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"implementation()\\\")) == 0x5c60da1b\\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\\\"5c60da1b\\\");\\n require(success);\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * @dev Returns the current admin of `proxy`.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"admin()\\\")) == 0xf851a440\\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\\\"f851a440\\\");\\n require(success);\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * @dev Changes the admin of `proxy` to `newAdmin`.\\n *\\n * Requirements:\\n *\\n * - This contract must be the current admin of `proxy`.\\n */\\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\\n proxy.changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\\n proxy.upgradeTo(implementation);\\n }\\n\\n /**\\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function upgradeAndCall(\\n TransparentUpgradeableProxy proxy,\\n address implementation,\\n bytes memory data\\n ) public payable virtual onlyOwner {\\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\\n }\\n}\\n\",\"keccak256\":\"0x754888b9c9ab5525343460b0a4fa2e2f4fca9b6a7e0e7ddea4154e2b1182a45d\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", diff --git a/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E.json b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E.json new file mode 100644 index 0000000000..d2733409b3 --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E.json @@ -0,0 +1,899 @@ +{ + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newEscrow", + "type": "address" + } + ], + "name": "EscrowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "escrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingWalletImplementation", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingContract", + "type": "address" + } + ], + "name": "StakingContractSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingToken", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakingWalletTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBeacon", + "type": "address" + } + ], + "name": "UpgradeableBeaconSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "withdrawTo", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "escrow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingWalletImplementation", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + } + ], + "name": "setEscrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + } + ], + "name": "setStakingContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + } + ], + "name": "setStakingToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_beacon", + "type": "address" + } + ], + "name": "setUpgradeableBeacon", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakingToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferStakingWallet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userStakingWallet", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veloAeroBeacon", + "outputs": [ + { + "internalType": "contract UpgradeableBeacon", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_withdrawTo", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "transactionIndex": 2, + "gasUsed": "1117183", + "logsBloom": "0x00000000000000000000000000000002400000040000000020800000040000000000000000000000000000000800000000000000000000000000000000000000000000000040000400002000000002000001000000000000000200000004000400000000020000000000000800000a00040000800000000000100000000000440000000000000000000000000000000000000000000080000080000000800000000000000000000000000000000400000000000000000100000008004000200000000020000000000000000000044000001000000400000004000000020020000000000000000000000000000000000000000000000000000000000000010100", + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76", + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000048e40a02e932bcd81626c38a2276d0bcb20bbcfb" + ], + "data": "0x", + "logIndex": 26, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 27, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0x051bD9001a5546504b4852f162de72A58421feC7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e5d0ae222c40e719c45be2ade421f91a345ae000" + ], + "data": "0x", + "logIndex": 28, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0x051bD9001a5546504b4852f162de72A58421feC7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x000000000000000000000000e5d0ae222c40e719c45be2ade421f91a345ae000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 29, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f", + "0x0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8", + "0x000000000000000000000000690a74d2ec0175a69c0962b309e03021c0b5002e", + "0x0000000000000000000000008ff8b21a0736738b25597d32d8f7cf658f39f157" + ], + "data": "0x000000000000000000000000eefbcd99d5bff6fbd3ab8bce659d31b2b9443a3f", + "logIndex": 30, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 31, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031504094cd6ec0cea87884d0dab439afe3ed93bf", + "logIndex": 32, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + } + ], + "blockNumber": 19228367, + "cumulativeGasUsed": "1888888", + "status": 1, + "byzantium": true + }, + "args": [ + "0x48e40A02e932bcD81626C38A2276d0Bcb20BBcfb", + "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", + "0xf8c8765e0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8000000000000000000000000690a74d2ec0175a69c0962b309e03021c0b5002e0000000000000000000000008ff8b21a0736738b25597d32d8f7cf658f39f157000000000000000000000000eefbcd99d5bff6fbd3ab8bce659d31b2b9443a3f" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x2Abd9eB57Fb7727138f4181B68DA0426B7fd47e8", + "0x690A74d2eC0175a69C0962B309E03021C0b5002E", + "0x8ff8b21a0736738b25597D32d8f7cf658f39f157", + "0xEEFBcD99d5Bff6FBd3AB8Bce659d31B2b9443a3f" + ] + }, + "implementation": "0x48e40A02e932bcD81626C38A2276d0Bcb20BBcfb", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E_Implementation.json b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E_Implementation.json new file mode 100644 index 0000000000..7b0bd0a884 --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E_Implementation.json @@ -0,0 +1,978 @@ +{ + "address": "0x48e40A02e932bcD81626C38A2276d0Bcb20BBcfb", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newEscrow", + "type": "address" + } + ], + "name": "EscrowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "escrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingWalletImplementation", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingContract", + "type": "address" + } + ], + "name": "StakingContractSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingToken", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakingWalletTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBeacon", + "type": "address" + } + ], + "name": "UpgradeableBeaconSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "withdrawTo", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "escrow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingWalletImplementation", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + } + ], + "name": "setEscrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + } + ], + "name": "setStakingContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + } + ], + "name": "setStakingToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_beacon", + "type": "address" + } + ], + "name": "setUpgradeableBeacon", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakingToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferStakingWallet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userStakingWallet", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veloAeroBeacon", + "outputs": [ + { + "internalType": "contract UpgradeableBeacon", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_withdrawTo", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6ce452dd5096927ec415945ce34b5ffb5392ba49810b1f517649f7022b6fcb6e", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x48e40A02e932bcD81626C38A2276d0Bcb20BBcfb", + "transactionIndex": 3, + "gasUsed": "2159447", + "logsBloom": "0x00000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000", + "blockHash": "0x837ef5ecb36f68c06a9ac2eb7c09a8ae0a799e055ea71761c8e69d86ffcbb744", + "transactionHash": "0x6ce452dd5096927ec415945ce34b5ffb5392ba49810b1f517649f7022b6fcb6e", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 19228364, + "transactionHash": "0x6ce452dd5096927ec415945ce34b5ffb5392ba49810b1f517649f7022b6fcb6e", + "address": "0x48e40A02e932bcD81626C38A2276d0Bcb20BBcfb", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 12, + "blockHash": "0x837ef5ecb36f68c06a9ac2eb7c09a8ae0a799e055ea71761c8e69d86ffcbb744" + } + ], + "blockNumber": 19228364, + "cumulativeGasUsed": "2495441", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"veloWallet\",\"type\":\"address\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newEscrow\",\"type\":\"address\"}],\"name\":\"EscrowSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"escrow\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"stakingToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"stakingContract\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"stakingWalletImplementation\",\"type\":\"address\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"veloWallet\",\"type\":\"address\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newStakingContract\",\"type\":\"address\"}],\"name\":\"StakingContractSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newStakingToken\",\"type\":\"address\"}],\"name\":\"StakingTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakingWalletTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBeacon\",\"type\":\"address\"}],\"name\":\"UpgradeableBeaconSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"withdrawTo\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"escrow\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_escrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingWalletImplementation\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"periodFinish\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_escrow\",\"type\":\"address\"}],\"name\":\"setEscrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stakingContract\",\"type\":\"address\"}],\"name\":\"setStakingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stakingToken\",\"type\":\"address\"}],\"name\":\"setStakingToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_beacon\",\"type\":\"address\"}],\"name\":\"setUpgradeableBeacon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferStakingWallet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userStakingWallet\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veloAeroBeacon\",\"outputs\":[{\"internalType\":\"contract UpgradeableBeacon\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_withdrawTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"balanceOf(address)\":{\"params\":{\"account\":\"The address to query the balance of.\"},\"returns\":{\"_0\":\"The balance as a uint256.\"}},\"claim(address)\":{\"params\":{\"_from\":\"The address for which to claim rewards.\"}},\"initialize(address,address,address,address)\":{\"details\":\"This function can only be called once due to the initializer modifier\",\"params\":{\"_escrow\":\"The address of the escrow responsible for staking operations\",\"_stakingContract\":\"The address of the contract handling staking\",\"_stakingToken\":\"The address of the token to be staked\",\"_stakingWalletImplementation\":\"The address of the staking wallet implementation\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"periodFinish()\":{\"returns\":{\"_0\":\"The period finish time as a uint256.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardRate()\":{\"returns\":{\"_0\":\"The reward rate as a uint256.\"}},\"rewardToken()\":{\"returns\":{\"_0\":\"The address of the reward token.\"}},\"setEscrow(address)\":{\"params\":{\"_escrow\":\"The address of the new escrow.\"}},\"setStakingContract(address)\":{\"params\":{\"_stakingContract\":\"The address of the new staking contract.\"}},\"setStakingToken(address)\":{\"params\":{\"_stakingToken\":\"The address of the new staking token.\"}},\"setUpgradeableBeacon(address)\":{\"params\":{\"_beacon\":\"The address of the new beacon contract.\"}},\"stake(address,uint256,bytes)\":{\"params\":{\"_amount\":\"The amount of tokens to stake.\",\"_data\":\"Additional data that might be needed for staking.\",\"_from\":\"The address from which tokens will be staked.\"}},\"totalSupply()\":{\"returns\":{\"_0\":\"The total supply as a uint256.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"transferStakingWallet(address,address,uint256)\":{\"params\":{\"from\":\"The current owner of the staking wallet.\",\"to\":\"The new owner of the staking wallet.\"}},\"withdraw(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of tokens to withdraw.\",\"_owner\":\"The address from which tokens will be withdrawn.\"}}},\"title\":\"VeloAeroStakingStrategy\",\"version\":1},\"userdoc\":{\"events\":{\"Claimed(address,address)\":{\"notice\":\"Emitted when rewards are claimed\"},\"EscrowSet(address)\":{\"notice\":\"Emitted when escrow is set\"},\"Initialized(address,address,address,address)\":{\"notice\":\"Emitted when the contract is initialized\"},\"Staked(address,uint256,address)\":{\"notice\":\"Emitted when tokens are staked\"},\"StakingContractSet(address)\":{\"notice\":\"Emitted when staking contract is set\"},\"StakingTokenSet(address)\":{\"notice\":\"Emitted when staking token is set\"},\"StakingWalletTransferred(address,address,uint256)\":{\"notice\":\"Emitted when staking wallet is transferred\"},\"UpgradeableBeaconSet(address)\":{\"notice\":\"Emitted when upgradeable beacon is set\"},\"Withdrawn(address,address,uint256)\":{\"notice\":\"Emitted when tokens are withdrawn\"}},\"kind\":\"user\",\"methods\":{\"balanceOf(address)\":{\"notice\":\"Returns the balance of a specific address.\"},\"claim(address)\":{\"notice\":\"Claims rewards for a given address.\"},\"escrow()\":{\"notice\":\"Address of the escrow responsible for managing staking operations\"},\"initialize(address,address,address,address)\":{\"notice\":\"Initializes the staking strategy contract with necessary parameters\"},\"periodFinish()\":{\"notice\":\"Returns the period finish time for the staking strategy.\"},\"rewardRate()\":{\"notice\":\"Returns the current reward rate for the staking strategy.\"},\"rewardToken()\":{\"notice\":\"Returns the address of the reward token for the staking strategy.\"},\"setEscrow(address)\":{\"notice\":\"Sets the escrow address.\"},\"setStakingContract(address)\":{\"notice\":\"Sets the staking contract address.\"},\"setStakingToken(address)\":{\"notice\":\"Sets the staking token address.\"},\"setUpgradeableBeacon(address)\":{\"notice\":\"Sets the address of the beacon.\"},\"stake(address,uint256,bytes)\":{\"notice\":\"Stakes a specified amount of tokens from a given address.\"},\"stakingContract()\":{\"notice\":\"Address of the contract where staking operations are executed\"},\"stakingToken()\":{\"notice\":\"Address of the token being staked\"},\"totalSupply()\":{\"notice\":\"Returns the total supply of staked tokens.\"},\"transferStakingWallet(address,address,uint256)\":{\"notice\":\"Transfers the staking wallet from one user to another.\"},\"userStakingWallet(address)\":{\"notice\":\"Mapping of user addresses to their respective staking wallet addresses\"},\"veloAeroBeacon()\":{\"notice\":\"Address of beacon contract that manages wallet proxies\"},\"withdraw(address,address,uint256)\":{\"notice\":\"Withdraws a specified amount of tokens for a given address.\"}},\"notice\":\"Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/stake/velo/VeloAeroStakingStrategy.sol\":\"VeloAeroStakingStrategy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xffeed6b3cac845b2af4afb30d87cecbd45dec3c408360c157a3db08e28b45043\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20PermitUpgradeable {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xa4ef4473f068f5f97b73e442f554e4464a581c2200c23181287b4c8eee5de777\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20Upgradeable.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20PermitUpgradeable.sol\\\";\\r\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20Upgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20Upgradeable token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20Upgradeable token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20PermitUpgradeable token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5735e7a8ab4d99d6cbef359228e76c7c2057f13f9a22d014458951409ea30f7c\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/Context.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract Ownable is Context {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n constructor() {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xee2b6bc803215b66037612da0fe9f23ec3c99ff89db4ff05449a8df17c9befc5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\r\\n * proxy whose upgrades are fully controlled by the current implementation.\\r\\n */\\r\\ninterface IERC1822Proxiable {\\r\\n /**\\r\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\r\\n * address.\\r\\n *\\r\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\r\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\r\\n * function revert if invoked through a proxy.\\r\\n */\\r\\n function proxiableUUID() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xe768c5863db91751a70d25c9dac899ec5078c6bacfbc02878652e454aa416b9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../beacon/IBeacon.sol\\\";\\r\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\r\\nimport \\\"../../utils/Address.sol\\\";\\r\\nimport \\\"../../utils/StorageSlot.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This abstract contract provides getters and event emitting update functions for\\r\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\r\\n *\\r\\n * _Available since v4.1._\\r\\n *\\r\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\r\\n */\\r\\nabstract contract ERC1967Upgrade {\\r\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\r\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\r\\n\\r\\n /**\\r\\n * @dev Storage slot with the address of the current implementation.\\r\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\r\\n * validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the implementation is upgraded.\\r\\n */\\r\\n event Upgraded(address indexed implementation);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address.\\r\\n */\\r\\n function _getImplementation() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new address in the EIP1967 implementation slot.\\r\\n */\\r\\n function _setImplementation(address newImplementation) private {\\r\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\r\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeTo(address newImplementation) internal {\\r\\n _setImplementation(newImplementation);\\r\\n emit Upgraded(newImplementation);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade with additional setup call.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeToAndCall(\\r\\n address newImplementation,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n _upgradeTo(newImplementation);\\r\\n if (data.length > 0 || forceCall) {\\r\\n Address.functionDelegateCall(newImplementation, data);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeToAndCallUUPS(\\r\\n address newImplementation,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\r\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\r\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\r\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\r\\n _setImplementation(newImplementation);\\r\\n } else {\\r\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\r\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\r\\n } catch {\\r\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\r\\n }\\r\\n _upgradeToAndCall(newImplementation, data, forceCall);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Storage slot with the admin of the contract.\\r\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\r\\n * validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the admin account has changed.\\r\\n */\\r\\n event AdminChanged(address previousAdmin, address newAdmin);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current admin.\\r\\n */\\r\\n function _getAdmin() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new address in the EIP1967 admin slot.\\r\\n */\\r\\n function _setAdmin(address newAdmin) private {\\r\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\r\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the admin of the proxy.\\r\\n *\\r\\n * Emits an {AdminChanged} event.\\r\\n */\\r\\n function _changeAdmin(address newAdmin) internal {\\r\\n emit AdminChanged(_getAdmin(), newAdmin);\\r\\n _setAdmin(newAdmin);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\r\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the beacon is upgraded.\\r\\n */\\r\\n event BeaconUpgraded(address indexed beacon);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current beacon.\\r\\n */\\r\\n function _getBeacon() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\r\\n */\\r\\n function _setBeacon(address newBeacon) private {\\r\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\r\\n require(\\r\\n Address.isContract(IBeacon(newBeacon).implementation()),\\r\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\r\\n );\\r\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\r\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\r\\n *\\r\\n * Emits a {BeaconUpgraded} event.\\r\\n */\\r\\n function _upgradeBeaconToAndCall(\\r\\n address newBeacon,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n _setBeacon(newBeacon);\\r\\n emit BeaconUpgraded(newBeacon);\\r\\n if (data.length > 0 || forceCall) {\\r\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb9b4ac05179724cbcb7621bdab336a09eb32d07e07b425e0216263ad80388145\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\r\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\r\\n * be specified by overriding the virtual {_implementation} function.\\r\\n *\\r\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\r\\n * different contract through the {_delegate} function.\\r\\n *\\r\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\r\\n */\\r\\nabstract contract Proxy {\\r\\n /**\\r\\n * @dev Delegates the current call to `implementation`.\\r\\n *\\r\\n * This function does not return to its internal call site, it will return directly to the external caller.\\r\\n */\\r\\n function _delegate(address implementation) internal virtual {\\r\\n assembly {\\r\\n // Copy msg.data. We take full control of memory in this inline assembly\\r\\n // block because it will not return to Solidity code. We overwrite the\\r\\n // Solidity scratch pad at memory position 0.\\r\\n calldatacopy(0, 0, calldatasize())\\r\\n\\r\\n // Call the implementation.\\r\\n // out and outsize are 0 because we don't know the size yet.\\r\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\r\\n\\r\\n // Copy the returned data.\\r\\n returndatacopy(0, 0, returndatasize())\\r\\n\\r\\n switch result\\r\\n // delegatecall returns 0 on error.\\r\\n case 0 {\\r\\n revert(0, returndatasize())\\r\\n }\\r\\n default {\\r\\n return(0, returndatasize())\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\r\\n * and {_fallback} should delegate.\\r\\n */\\r\\n function _implementation() internal view virtual returns (address);\\r\\n\\r\\n /**\\r\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\r\\n *\\r\\n * This function does not return to its internal call site, it will return directly to the external caller.\\r\\n */\\r\\n function _fallback() internal virtual {\\r\\n _beforeFallback();\\r\\n _delegate(_implementation());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\r\\n * function in the contract matches the call data.\\r\\n */\\r\\n fallback() external payable virtual {\\r\\n _fallback();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\r\\n * is empty.\\r\\n */\\r\\n receive() external payable virtual {\\r\\n _fallback();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\r\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\r\\n *\\r\\n * If overridden should call `super._beforeFallback()`.\\r\\n */\\r\\n function _beforeFallback() internal virtual {}\\r\\n}\\r\\n\",\"keccak256\":\"0x62c6b919abeeb4c9146ffbb325fc03b5f2d55a29b8e719b8ff62daab48123565\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IBeacon.sol\\\";\\r\\nimport \\\"../Proxy.sol\\\";\\r\\nimport \\\"../ERC1967/ERC1967Upgrade.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\\r\\n *\\r\\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\\r\\n * conflict with the storage layout of the implementation behind the proxy.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\\r\\n /**\\r\\n * @dev Initializes the proxy with `beacon`.\\r\\n *\\r\\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\\r\\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\\r\\n * constructor.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `beacon` must be a contract with the interface {IBeacon}.\\r\\n */\\r\\n constructor(address beacon, bytes memory data) payable {\\r\\n _upgradeBeaconToAndCall(beacon, data, false);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current beacon address.\\r\\n */\\r\\n function _beacon() internal view virtual returns (address) {\\r\\n return _getBeacon();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address of the associated beacon.\\r\\n */\\r\\n function _implementation() internal view virtual override returns (address) {\\r\\n return IBeacon(_getBeacon()).implementation();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\\r\\n *\\r\\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `beacon` must be a contract.\\r\\n * - The implementation returned by `beacon` must be a contract.\\r\\n */\\r\\n function _setBeacon(address beacon, bytes memory data) internal virtual {\\r\\n _upgradeBeaconToAndCall(beacon, data, false);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8e6523f96ae0050f3de4c1bf1a6d635459e2c5bc83991bdfbeae9d11e3dee152\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\r\\n */\\r\\ninterface IBeacon {\\r\\n /**\\r\\n * @dev Must return an address that can be used as a delegate call target.\\r\\n *\\r\\n * {BeaconProxy} will check that this address is a contract.\\r\\n */\\r\\n function implementation() external view returns (address);\\r\\n}\\r\\n\",\"keccak256\":\"0xd3effc3ce6d1c85e1aae2ba5c6f28434c2eef52e1fc48b15096a176dcfee5853\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IBeacon.sol\\\";\\r\\nimport \\\"../../access/Ownable.sol\\\";\\r\\nimport \\\"../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\\r\\n * implementation contract, which is where they will delegate all function calls.\\r\\n *\\r\\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\\r\\n */\\r\\ncontract UpgradeableBeacon is IBeacon, Ownable {\\r\\n address private _implementation;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the implementation returned by the beacon is changed.\\r\\n */\\r\\n event Upgraded(address indexed implementation);\\r\\n\\r\\n /**\\r\\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\\r\\n * beacon.\\r\\n */\\r\\n constructor(address implementation_) {\\r\\n _setImplementation(implementation_);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address.\\r\\n */\\r\\n function implementation() public view virtual override returns (address) {\\r\\n return _implementation;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Upgrades the beacon to a new implementation.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - msg.sender must be the owner of the contract.\\r\\n * - `newImplementation` must be a contract.\\r\\n */\\r\\n function upgradeTo(address newImplementation) public virtual onlyOwner {\\r\\n _setImplementation(newImplementation);\\r\\n emit Upgraded(newImplementation);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Sets the implementation contract address for this beacon\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `newImplementation` must be a contract.\\r\\n */\\r\\n function _setImplementation(address newImplementation) private {\\r\\n require(Address.isContract(newImplementation), \\\"UpgradeableBeacon: implementation is not a contract\\\");\\r\\n _implementation = newImplementation;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x96d52f844533def4977d87f5b21e2352a27d8796ea9bf11a4a44691cae275de8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract Context {\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x81d5fc973a522c8909d60be6a201869d46aa47b030b8813f60616404628c2b94\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Library for reading and writing primitive types to specific storage slots.\\r\\n *\\r\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\r\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\r\\n *\\r\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\r\\n *\\r\\n * Example usage to set ERC1967 implementation slot:\\r\\n * ```\\r\\n * contract ERC1967 {\\r\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\r\\n *\\r\\n * function _getImplementation() internal view returns (address) {\\r\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\r\\n * }\\r\\n *\\r\\n * function _setImplementation(address newImplementation) internal {\\r\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\r\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\r\\n */\\r\\nlibrary StorageSlot {\\r\\n struct AddressSlot {\\r\\n address value;\\r\\n }\\r\\n\\r\\n struct BooleanSlot {\\r\\n bool value;\\r\\n }\\r\\n\\r\\n struct Bytes32Slot {\\r\\n bytes32 value;\\r\\n }\\r\\n\\r\\n struct Uint256Slot {\\r\\n uint256 value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\r\\n */\\r\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\r\\n */\\r\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\r\\n */\\r\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\r\\n */\\r\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb61a2a836d1e25029f013b03fa606fb6bcea10a9cc93ee2eb85d47b389d18c74\",\"license\":\"MIT\"},\"contracts/veION/stake/IStakeStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IStakeStrategy\\r\\n * @notice Interface for the VeloIonModeStakingModeReward contract.\\r\\n */\\r\\ninterface IStakeStrategy {\\r\\n /// @notice Emitted when the contract is initialized\\r\\n event Initialized(\\r\\n address indexed escrow,\\r\\n address indexed stakingToken,\\r\\n address indexed stakingContract,\\r\\n address stakingWalletImplementation\\r\\n );\\r\\n\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when staking wallet is transferred\\r\\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when escrow is set\\r\\n event EscrowSet(address indexed newEscrow);\\r\\n\\r\\n /// @notice Emitted when staking token is set\\r\\n event StakingTokenSet(address indexed newStakingToken);\\r\\n\\r\\n /// @notice Emitted when staking contract is set\\r\\n event StakingContractSet(address indexed newStakingContract);\\r\\n\\r\\n /// @notice Emitted when upgradeable beacon is set\\r\\n event UpgradeableBeaconSet(address indexed newBeacon);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens from a given address.\\r\\n * @param _from The address from which tokens will be staked.\\r\\n * @param _amount The amount of tokens to stake.\\r\\n * @param _data Additional data that might be needed for staking.\\r\\n */\\r\\n function stake(address _from, uint256 _amount, bytes memory _data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for a given address.\\r\\n * @param _from The address for which to claim rewards.\\r\\n */\\r\\n function claim(address _from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of tokens for a given address.\\r\\n * @param _owner The address from which tokens will be withdrawn.\\r\\n * @param _amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Returns the current reward rate for the staking strategy.\\r\\n * @return The reward rate as a uint256.\\r\\n */\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the period finish time for the staking strategy.\\r\\n * @return The period finish time as a uint256.\\r\\n */\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the balance of a specific address.\\r\\n * @param account The address to query the balance of.\\r\\n * @return The balance as a uint256.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the total supply of staked tokens.\\r\\n * @return The total supply as a uint256.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the reward token for the staking strategy.\\r\\n * @return The address of the reward token.\\r\\n */\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking contract.\\r\\n * @return The address of the staking contract.\\r\\n */\\r\\n function stakingContract() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking token.\\r\\n * @return The address of the staking token.\\r\\n */\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the staking wallet address for a specific user.\\r\\n * @param user The address of the user.\\r\\n * @return The address of the user's staking wallet.\\r\\n */\\r\\n function userStakingWallet(address user) external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Transfers the staking wallet from one user to another.\\r\\n * @param from The current owner of the staking wallet.\\r\\n * @param to The new owner of the staking wallet.\\r\\n */\\r\\n function transferStakingWallet(address from, address to, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the escrow address.\\r\\n * @param _escrow The address of the new escrow.\\r\\n */\\r\\n function setEscrow(address _escrow) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking token address.\\r\\n * @param _stakingToken The address of the new staking token.\\r\\n */\\r\\n function setStakingToken(address _stakingToken) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking contract address.\\r\\n * @param _stakingContract The address of the new staking contract.\\r\\n */\\r\\n function setStakingContract(address _stakingContract) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the beacon.\\r\\n * @param _beacon The address of the new beacon contract.\\r\\n */\\r\\n function setUpgradeableBeacon(address _beacon) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x69d7a60ae3df2ead3b3afaa32ae9b6ea4df13ef65c7c375babe7be2e5457fc8b\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/IStakeWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IStakeWallet {\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(uint256 amount);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, uint256 rewardAmount);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens according to the strategy.\\r\\n * @param amount The amount of tokens to stake.\\r\\n * @param data Additional data required for the staking strategy.\\r\\n */\\r\\n function stake(address from, uint256 amount, bytes memory data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for the caller.\\r\\n */\\r\\n function claim(address from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of staked tokens.\\r\\n * @param withdrawTo The address to withdraw tokens to.\\r\\n * @param amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address withdrawTo, uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa1145156b33d804afb421beb12e8c1fc19416e9d1d4b815d7b698fd97564ef42\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/IVeloIonModeStaking.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IVeloIonModeStaking {\\r\\n event Deposit(address indexed from, address indexed to, uint256 amount);\\r\\n event Withdraw(address indexed from, uint256 amount);\\r\\n event NotifyReward(address indexed from, uint256 amount);\\r\\n event ClaimFees(uint256 claimed0, uint256 claimed1);\\r\\n event ClaimRewards(address indexed from, uint256 amount);\\r\\n\\r\\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the token (VELO v2) rewarded to stakers\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the Converter contract linked to the gauge\\r\\n function feeConverter() external view returns (address);\\r\\n\\r\\n /// @notice Address of the staking rewards factory that created this gauge\\r\\n function factory() external view returns (address);\\r\\n\\r\\n /// @notice Timestamp end of current rewards period\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /// @notice Current reward rate of rewardToken to distribute per second\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent timestamp contract has updated state\\r\\n function lastUpdateTime() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent stored value of rewardPerToken\\r\\n function rewardPerTokenStored() external view returns (uint256);\\r\\n\\r\\n /// @notice Amount of stakingToken deposited for rewards\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /// @notice Get the amount of stakingToken deposited by an account\\r\\n function balanceOf(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\\r\\n function userRewardPerTokenPaid(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached amount of rewardToken earned for an account\\r\\n function rewards(address) external view returns (uint256);\\r\\n\\r\\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\\r\\n function rewardRateByEpoch(uint256) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the current reward rate per unit of stakingToken deposited\\r\\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\\r\\n\\r\\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\\r\\n function lastTimeRewardApplicable() external view returns (uint256 _time);\\r\\n\\r\\n /// @notice Returns accrued balance to date from last claim / first deposit.\\r\\n function earned(address _account) external view returns (uint256 _earned);\\r\\n\\r\\n /// @notice Total amount of rewardToken to distribute for the current rewards period\\r\\n function left() external view returns (uint256 _left);\\r\\n\\r\\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\\r\\n /// @return _claimed0 Amount of Fees claimed in token0\\r\\n /// @return _claimed1 Amount of Fees claimed in token1\\r\\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\\r\\n\\r\\n /// @notice Retrieve rewards for an address.\\r\\n /// @dev Throws if not called by same address or voter.\\r\\n /// @param _account .\\r\\n function getReward(address _account) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for msg.sender\\r\\n /// @param _amount .\\r\\n function deposit(uint256 _amount) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for any user\\r\\n /// @param _amount .\\r\\n /// @param _recipient Recipient to give balance to\\r\\n function deposit(uint256 _amount, address _recipient) external;\\r\\n\\r\\n /// @notice Withdraw LP tokens for user\\r\\n /// @param _amount .\\r\\n function withdraw(uint256 _amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardMatch(uint256 amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardAmount(uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x23f5c8711c247d772dc1dd96417a335a99857bcd8e3dbe9a96d14ac8f5038262\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/VeloAeroStakingStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport \\\"../IStakeStrategy.sol\\\";\\r\\nimport \\\"./VeloAeroStakingWallet.sol\\\";\\r\\nimport \\\"./IVeloIonModeStaking.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { BeaconProxy } from \\\"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\\\";\\r\\nimport { UpgradeableBeacon } from \\\"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title VeloAeroStakingStrategy\\r\\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract VeloAeroStakingStrategy is IStakeStrategy, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n /// @notice Address of the escrow responsible for managing staking operations\\r\\n address public escrow;\\r\\n /// @notice Address of the token being staked\\r\\n address public stakingToken;\\r\\n /// @notice Address of the contract where staking operations are executed\\r\\n address public stakingContract;\\r\\n /// @notice Address of beacon contract that manages wallet proxies\\r\\n UpgradeableBeacon public veloAeroBeacon;\\r\\n /// @notice Mapping of user addresses to their respective staking wallet addresses\\r\\n mapping(address => address) public userStakingWallet;\\r\\n\\r\\n /// @dev Modifier to restrict function access to only the escrow address\\r\\n modifier onlyEscrow() {\\r\\n require(msg.sender == escrow, \\\"Not authorized: Only escrow can call this function\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the staking strategy contract with necessary parameters\\r\\n * @dev This function can only be called once due to the initializer modifier\\r\\n * @param _escrow The address of the escrow responsible for staking operations\\r\\n * @param _stakingToken The address of the token to be staked\\r\\n * @param _stakingContract The address of the contract handling staking\\r\\n * @param _stakingWalletImplementation The address of the staking wallet implementation\\r\\n */\\r\\n function initialize(\\r\\n address _escrow,\\r\\n address _stakingToken,\\r\\n address _stakingContract,\\r\\n address _stakingWalletImplementation\\r\\n ) public initializer {\\r\\n __Ownable2Step_init();\\r\\n escrow = _escrow;\\r\\n stakingToken = _stakingToken;\\r\\n stakingContract = _stakingContract;\\r\\n\\r\\n veloAeroBeacon = new UpgradeableBeacon(_stakingWalletImplementation);\\r\\n veloAeroBeacon.transferOwnership(msg.sender);\\r\\n\\r\\n emit Initialized(_escrow, _stakingToken, _stakingContract, _stakingWalletImplementation);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function stake(address _from, uint256 _amount, bytes memory _data) external override onlyEscrow {\\r\\n IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), _amount);\\r\\n\\r\\n address veloWallet = userStakingWallet[_from];\\r\\n if (veloWallet == address(0)) {\\r\\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \\\"\\\");\\r\\n veloWallet = address(newWallet);\\r\\n VeloAeroStakingWallet(veloWallet).initialize(IStakeStrategy(address(this)));\\r\\n userStakingWallet[_from] = veloWallet;\\r\\n }\\r\\n\\r\\n IERC20(stakingToken).approve(veloWallet, _amount);\\r\\n VeloAeroStakingWallet(veloWallet).stake(_from, _amount, _data);\\r\\n emit Staked(_from, _amount, veloWallet);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function claim(address _from) external onlyEscrow {\\r\\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_from]);\\r\\n veloWallet.claim(_from);\\r\\n emit Claimed(_from, address(veloWallet));\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external onlyEscrow {\\r\\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_owner]);\\r\\n veloWallet.withdraw(_withdrawTo, _amount);\\r\\n emit Withdrawn(_owner, _withdrawTo, _amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function transferStakingWallet(address _from, address _to, uint256 _amount) external onlyEscrow {\\r\\n address fromWallet = userStakingWallet[_from];\\r\\n address toWallet = userStakingWallet[_to];\\r\\n\\r\\n if (toWallet == address(0)) {\\r\\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \\\"\\\");\\r\\n toWallet = address(newWallet);\\r\\n VeloAeroStakingWallet(toWallet).initialize(IStakeStrategy(address(this)));\\r\\n userStakingWallet[_to] = toWallet;\\r\\n }\\r\\n\\r\\n VeloAeroStakingWallet(fromWallet).withdraw(address(this), _amount);\\r\\n IERC20(stakingToken).approve(address(toWallet), _amount);\\r\\n VeloAeroStakingWallet(toWallet).stake(_to, _amount, \\\"\\\");\\r\\n emit StakingWalletTransferred(_from, _to, _amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function rewardRate() external view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).rewardRate();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function periodFinish() external view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).periodFinish();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function balanceOf(address account) public view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).balanceOf(account);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function totalSupply() external view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).totalSupply();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function rewardToken() public view returns (address) {\\r\\n return IVeloIonModeStaking(stakingContract).rewardToken();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setEscrow(address _escrow) external onlyOwner {\\r\\n require(_escrow != address(0), \\\"Invalid address\\\");\\r\\n escrow = _escrow;\\r\\n emit EscrowSet(_escrow);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setStakingToken(address _stakingToken) external onlyOwner {\\r\\n require(_stakingToken != address(0), \\\"Invalid address\\\");\\r\\n stakingToken = _stakingToken;\\r\\n emit StakingTokenSet(_stakingToken);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setStakingContract(address _stakingContract) external onlyOwner {\\r\\n require(_stakingContract != address(0), \\\"Invalid address\\\");\\r\\n stakingContract = _stakingContract;\\r\\n emit StakingContractSet(_stakingContract);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setUpgradeableBeacon(address _beacon) external onlyOwner {\\r\\n require(_beacon != address(0), \\\"Invalid address\\\");\\r\\n veloAeroBeacon = UpgradeableBeacon(_beacon);\\r\\n emit UpgradeableBeaconSet(_beacon);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x01b4a448f460c30d749a5723c949c788d95846b4d290fb510623ca064c23ba59\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/VeloAeroStakingWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { IStakeWallet } from \\\"../IStakeWallet.sol\\\";\\r\\nimport { IStakeStrategy } from \\\"../IStakeStrategy.sol\\\";\\r\\nimport { IVeloIonModeStaking } from \\\"./IVeloIonModeStaking.sol\\\";\\r\\nimport { IERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\nimport { SafeERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\r\\nimport { Initializable } from \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title VeloAeroStakingWallet\\r\\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\\r\\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\\r\\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\\r\\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\\r\\n * @author Jourdan Dunkley \\r\\n */\\r\\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\\r\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\r\\n IStakeStrategy public stakeStrategy;\\r\\n\\r\\n /// @dev Modifier to restrict function access to only the stake strategy contract\\r\\n modifier onlyStakeStrategy() {\\r\\n require(msg.sender == address(stakeStrategy), \\\"Not authorized: Only stake strategy can call this function\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the contract with a staking strategy\\r\\n * @dev Can only be called once due to initializer modifier\\r\\n * @param _stakeStrategy The address of the staking strategy contract\\r\\n */\\r\\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\\r\\n stakeStrategy = _stakeStrategy;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\\r\\n stakingToken.approve(address(stakingContract), _amount);\\r\\n stakingContract.deposit(_amount);\\r\\n emit Staked(_amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function claim(address _from) external onlyStakeStrategy {\\r\\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.getReward(address(this));\\r\\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\\r\\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\\r\\n emit Claimed(_from, rewardAmount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.withdraw(_amount);\\r\\n stakingToken.safeTransfer(_withdrawTo, _amount);\\r\\n emit Withdrawn(_withdrawTo, _amount);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5d95949d0e7ba07afe3cfbe991cbf6ec8b8877d10181886ba8cdbf896e914ff7\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6125ae806100ed6000396000f3fe60806040523480156200001157600080fd5b5060043610620001755760003560e01c8063c10c354611620000d3578063ee3fd2231162000086578063ee3fd223146200030a578063ee99205c1462000321578063f2cdf2261462000335578063f2fde38b1462000349578063f7c618c11462000360578063f8c8765e146200036a57600080fd5b8063c10c35461462000295578063d9caed1214620002ac578063e2fdcc1714620002c3578063e30c397814620002d7578063e31d753114620002e9578063ebe2b12b146200030057600080fd5b806372f702f3116200012c57806372f702f314620001ff57806379ba5097146200022c5780637b0a47ee14620002365780638da5cb5b14620002405780639dd373b91462000252578063ae919173146200026957600080fd5b806318160ddd146200017a5780631e83409a14620001975780631e9b12ef14620001b05780633e12170f14620001c757806370a0823114620001de578063715018a614620001f5575b600080fd5b6200018462000381565b6040519081526020015b60405180910390f35b620001ae620001a836600462001650565b620003f7565b005b620001ae620001c136600462001650565b620004dc565b620001ae620001d83660046200168d565b62000559565b62000184620001ef36600462001650565b620007e2565b620001ae6200085a565b60985462000213906001600160a01b031681565b6040516001600160a01b0390911681526020016200018e565b620001ae62000872565b62000184620008f0565b6033546001600160a01b031662000213565b620001ae6200026336600462001650565b6200093b565b620002136200027a36600462001650565b609b602052600090815260409020546001600160a01b031681565b620001ae620002a636600462001650565b620009b8565b620001ae620002bd36600462001766565b62000a35565b60975462000213906001600160a01b031681565b6065546001600160a01b031662000213565b620001ae620002fa36600462001766565b62000b21565b6200018462000e0c565b620001ae6200031b36600462001650565b62000e57565b60995462000213906001600160a01b031681565b609a5462000213906001600160a01b031681565b620001ae6200035a36600462001650565b62000ed4565b6200021362000f48565b620001ae6200037b366004620017ac565b62000fb9565b609954604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001811565b905090565b6097546001600160a01b031633146200042d5760405162461bcd60e51b815260040162000424906200182b565b60405180910390fd5b6001600160a01b038181166000818152609b602052604090819020549051630f41a04d60e11b81526004810192909252909116908190631e83409a90602401600060405180830381600087803b1580156200048757600080fd5b505af11580156200049c573d6000803e3d6000fd5b50506040516001600160a01b038085169350851691507f89309c9b2aeaffbdce717113df9427298b20448c05919bf889e05f8c3094254b90600090a35050565b620004e662001209565b6001600160a01b0381166200050f5760405162461bcd60e51b815260040162000424906200187d565b609880546001600160a01b0319166001600160a01b0383169081179091556040517f9904a32444ae0eb0bae2045baf588aa248f03f4fef600c18afd1d7e751614af890600090a250565b6097546001600160a01b03163314620005865760405162461bcd60e51b815260040162000424906200182b565b609854620005a0906001600160a01b031633308562001265565b6001600160a01b038084166000908152609b60205260409020541680620006ad57609a546040516000916001600160a01b031690620005df906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f0801580156200061b573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b1580156200066457600080fd5b505af115801562000679573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60985460405163095ea7b360e01b81526001600160a01b038381166004830152602482018690529091169063095ea7b3906044016020604051808303816000875af115801562000701573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007279190620018a6565b50604051633e12170f60e01b81526001600160a01b03821690633e12170f906200075a908790879087906004016200191e565b600060405180830381600087803b1580156200077557600080fd5b505af11580156200078a573d6000803e3d6000fd5b50505050806001600160a01b0316846001600160a01b03167f9f9e4044c5742cca66ca090b21552bac14645e68bad7a92364a9d9ff18111a1c85604051620007d491815260200190565b60405180910390a350505050565b6099546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa1580156200082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000854919062001811565b92915050565b6200086462001209565b620008706000620012c7565b565b60655433906001600160a01b03168114620008e25760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840162000424565b620008ed81620012c7565b50565b60995460408051633d8523f760e11b815290516000926001600160a01b031691637b0a47ee9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b6200094562001209565b6001600160a01b0381166200096e5760405162461bcd60e51b815260040162000424906200187d565b609980546001600160a01b0319166001600160a01b0383169081179091556040517f1253844b0fff3da7dd2829de816c9b4f94c238cf2bf6eb72c02c7d6f2b53beac90600090a250565b620009c262001209565b6001600160a01b038116620009eb5760405162461bcd60e51b815260040162000424906200187d565b609780546001600160a01b0319166001600160a01b0383169081179091556040517fa585aec3a6cb0e1a084ed18c7638024e40cc3e3ea815166e2cb6fc17d7f1392b90600090a250565b6097546001600160a01b0316331462000a625760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038381166000908152609b60205260409081902054905163f3fef3a360e01b8152848316600482015260248101849052911690819063f3fef3a390604401600060405180830381600087803b15801562000ac257600080fd5b505af115801562000ad7573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb84604051620007d491815260200190565b6097546001600160a01b0316331462000b4e5760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038084166000908152609b602052604080822054858416835291205490821691168062000c6857609a546040516000916001600160a01b03169062000b9a906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f08015801562000bd6573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b15801562000c1f57600080fd5b505af115801562000c34573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60405163f3fef3a360e01b8152306004820152602481018490526001600160a01b0383169063f3fef3a390604401600060405180830381600087803b15801562000cb157600080fd5b505af115801562000cc6573d6000803e3d6000fd5b505060985460405163095ea7b360e01b81526001600160a01b03858116600483015260248201889052909116925063095ea7b391506044016020604051808303816000875af115801562000d1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d449190620018a6565b50604051633e12170f60e01b81526001600160a01b038581166004830152602482018590526060604483015260006064830152821690633e12170f90608401600060405180830381600087803b15801562000d9e57600080fd5b505af115801562000db3573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b03167fdd0cdc1bea06c790fb371c8acc5b948f282e5872429ce2bc5971f5b5c6d76b6c8560405162000dfd91815260200190565b60405180910390a35050505050565b6099546040805163ebe2b12b60e01b815290516000926001600160a01b03169163ebe2b12b9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b62000e6162001209565b6001600160a01b03811662000e8a5760405162461bcd60e51b815260040162000424906200187d565b609a80546001600160a01b0319166001600160a01b0383169081179091556040517fa922f30fc35aecb996d111c48db797fadceb5a048e693f841e0c4f339bb0326490600090a250565b62000ede62001209565b606580546001600160a01b0383166001600160a01b0319909116811790915562000f106033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6099546040805163f7c618c160e01b815290516000926001600160a01b03169163f7c618c19160048083019260209291908290030181865afa15801562000f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001950565b600054610100900460ff161580801562000fda5750600054600160ff909116105b8062000ff65750303b15801562000ff6575060005460ff166001145b6200105b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840162000424565b6000805460ff1916600117905580156200107f576000805461ff0019166101001790555b62001089620012e2565b609780546001600160a01b038088166001600160a01b0319928316179092556098805487841690831617905560998054928616929091169190911790556040518290620010d6906200162c565b6001600160a01b039091168152602001604051809103906000f08015801562001103573d6000803e3d6000fd5b50609a80546001600160a01b0319166001600160a01b0392909216918217905560405163f2fde38b60e01b815233600482015263f2fde38b90602401600060405180830381600087803b1580156200115a57600080fd5b505af11580156200116f573d6000803e3d6000fd5b50506040516001600160a01b038581168252808716935087811692508816907f3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f9060200160405180910390a4801562001202576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6033546001600160a01b03163314620008705760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000424565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052620012c190859062001316565b50505050565b606580546001600160a01b0319169055620008ed81620013f4565b600054610100900460ff166200130c5760405162461bcd60e51b8152600401620004249062001970565b6200087062001446565b60006200136d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200147b9092919063ffffffff16565b805190915015620013ef57808060200190518101906200138e9190620018a6565b620013ef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000424565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620014705760405162461bcd60e51b8152600401620004249062001970565b6200087033620012c7565b60606200148c848460008562001494565b949350505050565b606082471015620014f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000424565b600080866001600160a01b03168587604051620015159190620019bb565b60006040518083038185875af1925050503d806000811462001554576040519150601f19603f3d011682016040523d82523d6000602084013e62001559565b606091505b50915091506200156c8783838762001577565b979650505050505050565b60608315620015eb578251600003620015e3576001600160a01b0385163b620015e35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000424565b50816200148c565b6200148c8383815115620016025781518083602001fd5b8060405162461bcd60e51b8152600401620004249190620019d9565b6106cc80620019ef83390190565b6104be80620020bb83390190565b6001600160a01b0381168114620008ed57600080fd5b6000602082840312156200166357600080fd5b813562001670816200163a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620016a357600080fd5b8335620016b0816200163a565b925060208401359150604084013567ffffffffffffffff80821115620016d557600080fd5b818601915086601f830112620016ea57600080fd5b813581811115620016ff57620016ff62001677565b604051601f8201601f19908116603f011681019083821181831017156200172a576200172a62001677565b816040528281528960208487010111156200174457600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6000806000606084860312156200177c57600080fd5b833562001789816200163a565b925060208401356200179b816200163a565b929592945050506040919091013590565b60008060008060808587031215620017c357600080fd5b8435620017d0816200163a565b93506020850135620017e2816200163a565b92506040850135620017f4816200163a565b9150606085013562001806816200163a565b939692955090935050565b6000602082840312156200182457600080fd5b5051919050565b60208082526032908201527f4e6f7420617574686f72697a65643a204f6e6c7920657363726f772063616e2060408201527131b0b636103a3434b990333ab731ba34b7b760711b606082015260800190565b6020808252600f908201526e496e76616c6964206164647265737360881b604082015260600190565b600060208284031215620018b957600080fd5b815180151581146200167057600080fd5b60005b83811015620018e7578181015183820152602001620018cd565b50506000910152565b600081518084526200190a816020860160208601620018ca565b601f01601f19169290920160200192915050565b60018060a01b0384168152826020820152606060408201526000620019476060830184620018f0565b95945050505050565b6000602082840312156200196357600080fd5b815162001670816200163a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251620019cf818460208701620018ca565b9190910192915050565b602081526000620016706020830184620018f056fe60806040526040516106cc3803806106cc83398101604081905261002291610420565b61002e82826000610035565b505061054a565b61003e836100f6565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100f1576100ef836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e991906104e0565b8361027a565b505b505050565b6001600160a01b0381163b6101605760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101d4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c591906104e0565b6001600160a01b03163b151590565b6102395760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610157565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392909216919091179055565b606061029f83836040518060600160405280602781526020016106a5602791396102a6565b9392505050565b6060600080856001600160a01b0316856040516102c391906104fb565b600060405180830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b5090925090506103158683838761031f565b9695505050505050565b6060831561038e578251600003610387576001600160a01b0385163b6103875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610157565b5081610398565b61039883836103a0565b949350505050565b8151156103b05781518083602001fd5b8060405162461bcd60e51b81526004016101579190610517565b80516001600160a01b03811681146103e157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156104175781810151838201526020016103ff565b50506000910152565b6000806040838503121561043357600080fd5b61043c836103ca565b60208401519092506001600160401b038082111561045957600080fd5b818501915085601f83011261046d57600080fd5b81518181111561047f5761047f6103e6565b604051601f8201601f19908116603f011681019083821181831017156104a7576104a76103e6565b816040528281528860208487010111156104c057600080fd5b6104d18360208301602088016103fc565b80955050505050509250929050565b6000602082840312156104f257600080fd5b61029f826103ca565b6000825161050d8184602087016103fc565b9190910192915050565b60208152600082518060208401526105368160408501602087016103fc565b601f01601f19169190910160400192915050565b61014c806105596000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b6100c2565b565b600061005c7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bd91906100e6565b905090565b3660008037600080366000845af43d6000803e8080156100e1573d6000f35b3d6000fd5b6000602082840312156100f857600080fd5b81516001600160a01b038116811461010f57600080fd5b939250505056fea26469706673582212200fdbd93def38e5cbcee033f760da77fe3d36b8bf06a75256372b980f4ae5bd5064736f6c63430008160033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506040516104be3803806104be83398101604081905261002f9161013a565b61003833610047565b61004181610097565b5061016a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381163b6101185760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000606482015260840160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561014c57600080fd5b81516001600160a01b038116811461016357600080fd5b9392505050565b610345806101796000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a3660046102df565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f61010e565b6000546001600160a01b031661007e565b61006f6100c13660046102df565b610122565b6100ce6101a0565b6100d7816101fa565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6101166101a0565b610120600061028f565b565b61012a6101a0565b6001600160a01b0381166101945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61019d8161028f565b50565b6000546001600160a01b031633146101205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018b565b6001600160a01b0381163b61026d5760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f6044820152721b881a5cc81b9bdd08184818dbdb9d1c9858dd606a1b606482015260840161018b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102f157600080fd5b81356001600160a01b038116811461030857600080fd5b939250505056fea264697066735822122061aafe9c0974224ae4f98e82cd84eb5427d380f755f81ef0957872ad1c509caf64736f6c63430008160033a2646970667358221220a4ecceefd2f10c7205105791c80f873ce0775dd7c8fd219175fd7aa9768aae8164736f6c63430008160033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620001755760003560e01c8063c10c354611620000d3578063ee3fd2231162000086578063ee3fd223146200030a578063ee99205c1462000321578063f2cdf2261462000335578063f2fde38b1462000349578063f7c618c11462000360578063f8c8765e146200036a57600080fd5b8063c10c35461462000295578063d9caed1214620002ac578063e2fdcc1714620002c3578063e30c397814620002d7578063e31d753114620002e9578063ebe2b12b146200030057600080fd5b806372f702f3116200012c57806372f702f314620001ff57806379ba5097146200022c5780637b0a47ee14620002365780638da5cb5b14620002405780639dd373b91462000252578063ae919173146200026957600080fd5b806318160ddd146200017a5780631e83409a14620001975780631e9b12ef14620001b05780633e12170f14620001c757806370a0823114620001de578063715018a614620001f5575b600080fd5b6200018462000381565b6040519081526020015b60405180910390f35b620001ae620001a836600462001650565b620003f7565b005b620001ae620001c136600462001650565b620004dc565b620001ae620001d83660046200168d565b62000559565b62000184620001ef36600462001650565b620007e2565b620001ae6200085a565b60985462000213906001600160a01b031681565b6040516001600160a01b0390911681526020016200018e565b620001ae62000872565b62000184620008f0565b6033546001600160a01b031662000213565b620001ae6200026336600462001650565b6200093b565b620002136200027a36600462001650565b609b602052600090815260409020546001600160a01b031681565b620001ae620002a636600462001650565b620009b8565b620001ae620002bd36600462001766565b62000a35565b60975462000213906001600160a01b031681565b6065546001600160a01b031662000213565b620001ae620002fa36600462001766565b62000b21565b6200018462000e0c565b620001ae6200031b36600462001650565b62000e57565b60995462000213906001600160a01b031681565b609a5462000213906001600160a01b031681565b620001ae6200035a36600462001650565b62000ed4565b6200021362000f48565b620001ae6200037b366004620017ac565b62000fb9565b609954604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001811565b905090565b6097546001600160a01b031633146200042d5760405162461bcd60e51b815260040162000424906200182b565b60405180910390fd5b6001600160a01b038181166000818152609b602052604090819020549051630f41a04d60e11b81526004810192909252909116908190631e83409a90602401600060405180830381600087803b1580156200048757600080fd5b505af11580156200049c573d6000803e3d6000fd5b50506040516001600160a01b038085169350851691507f89309c9b2aeaffbdce717113df9427298b20448c05919bf889e05f8c3094254b90600090a35050565b620004e662001209565b6001600160a01b0381166200050f5760405162461bcd60e51b815260040162000424906200187d565b609880546001600160a01b0319166001600160a01b0383169081179091556040517f9904a32444ae0eb0bae2045baf588aa248f03f4fef600c18afd1d7e751614af890600090a250565b6097546001600160a01b03163314620005865760405162461bcd60e51b815260040162000424906200182b565b609854620005a0906001600160a01b031633308562001265565b6001600160a01b038084166000908152609b60205260409020541680620006ad57609a546040516000916001600160a01b031690620005df906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f0801580156200061b573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b1580156200066457600080fd5b505af115801562000679573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60985460405163095ea7b360e01b81526001600160a01b038381166004830152602482018690529091169063095ea7b3906044016020604051808303816000875af115801562000701573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007279190620018a6565b50604051633e12170f60e01b81526001600160a01b03821690633e12170f906200075a908790879087906004016200191e565b600060405180830381600087803b1580156200077557600080fd5b505af11580156200078a573d6000803e3d6000fd5b50505050806001600160a01b0316846001600160a01b03167f9f9e4044c5742cca66ca090b21552bac14645e68bad7a92364a9d9ff18111a1c85604051620007d491815260200190565b60405180910390a350505050565b6099546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa1580156200082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000854919062001811565b92915050565b6200086462001209565b620008706000620012c7565b565b60655433906001600160a01b03168114620008e25760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840162000424565b620008ed81620012c7565b50565b60995460408051633d8523f760e11b815290516000926001600160a01b031691637b0a47ee9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b6200094562001209565b6001600160a01b0381166200096e5760405162461bcd60e51b815260040162000424906200187d565b609980546001600160a01b0319166001600160a01b0383169081179091556040517f1253844b0fff3da7dd2829de816c9b4f94c238cf2bf6eb72c02c7d6f2b53beac90600090a250565b620009c262001209565b6001600160a01b038116620009eb5760405162461bcd60e51b815260040162000424906200187d565b609780546001600160a01b0319166001600160a01b0383169081179091556040517fa585aec3a6cb0e1a084ed18c7638024e40cc3e3ea815166e2cb6fc17d7f1392b90600090a250565b6097546001600160a01b0316331462000a625760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038381166000908152609b60205260409081902054905163f3fef3a360e01b8152848316600482015260248101849052911690819063f3fef3a390604401600060405180830381600087803b15801562000ac257600080fd5b505af115801562000ad7573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb84604051620007d491815260200190565b6097546001600160a01b0316331462000b4e5760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038084166000908152609b602052604080822054858416835291205490821691168062000c6857609a546040516000916001600160a01b03169062000b9a906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f08015801562000bd6573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b15801562000c1f57600080fd5b505af115801562000c34573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60405163f3fef3a360e01b8152306004820152602481018490526001600160a01b0383169063f3fef3a390604401600060405180830381600087803b15801562000cb157600080fd5b505af115801562000cc6573d6000803e3d6000fd5b505060985460405163095ea7b360e01b81526001600160a01b03858116600483015260248201889052909116925063095ea7b391506044016020604051808303816000875af115801562000d1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d449190620018a6565b50604051633e12170f60e01b81526001600160a01b038581166004830152602482018590526060604483015260006064830152821690633e12170f90608401600060405180830381600087803b15801562000d9e57600080fd5b505af115801562000db3573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b03167fdd0cdc1bea06c790fb371c8acc5b948f282e5872429ce2bc5971f5b5c6d76b6c8560405162000dfd91815260200190565b60405180910390a35050505050565b6099546040805163ebe2b12b60e01b815290516000926001600160a01b03169163ebe2b12b9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b62000e6162001209565b6001600160a01b03811662000e8a5760405162461bcd60e51b815260040162000424906200187d565b609a80546001600160a01b0319166001600160a01b0383169081179091556040517fa922f30fc35aecb996d111c48db797fadceb5a048e693f841e0c4f339bb0326490600090a250565b62000ede62001209565b606580546001600160a01b0383166001600160a01b0319909116811790915562000f106033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6099546040805163f7c618c160e01b815290516000926001600160a01b03169163f7c618c19160048083019260209291908290030181865afa15801562000f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001950565b600054610100900460ff161580801562000fda5750600054600160ff909116105b8062000ff65750303b15801562000ff6575060005460ff166001145b6200105b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840162000424565b6000805460ff1916600117905580156200107f576000805461ff0019166101001790555b62001089620012e2565b609780546001600160a01b038088166001600160a01b0319928316179092556098805487841690831617905560998054928616929091169190911790556040518290620010d6906200162c565b6001600160a01b039091168152602001604051809103906000f08015801562001103573d6000803e3d6000fd5b50609a80546001600160a01b0319166001600160a01b0392909216918217905560405163f2fde38b60e01b815233600482015263f2fde38b90602401600060405180830381600087803b1580156200115a57600080fd5b505af11580156200116f573d6000803e3d6000fd5b50506040516001600160a01b038581168252808716935087811692508816907f3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f9060200160405180910390a4801562001202576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6033546001600160a01b03163314620008705760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000424565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052620012c190859062001316565b50505050565b606580546001600160a01b0319169055620008ed81620013f4565b600054610100900460ff166200130c5760405162461bcd60e51b8152600401620004249062001970565b6200087062001446565b60006200136d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200147b9092919063ffffffff16565b805190915015620013ef57808060200190518101906200138e9190620018a6565b620013ef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000424565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620014705760405162461bcd60e51b8152600401620004249062001970565b6200087033620012c7565b60606200148c848460008562001494565b949350505050565b606082471015620014f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000424565b600080866001600160a01b03168587604051620015159190620019bb565b60006040518083038185875af1925050503d806000811462001554576040519150601f19603f3d011682016040523d82523d6000602084013e62001559565b606091505b50915091506200156c8783838762001577565b979650505050505050565b60608315620015eb578251600003620015e3576001600160a01b0385163b620015e35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000424565b50816200148c565b6200148c8383815115620016025781518083602001fd5b8060405162461bcd60e51b8152600401620004249190620019d9565b6106cc80620019ef83390190565b6104be80620020bb83390190565b6001600160a01b0381168114620008ed57600080fd5b6000602082840312156200166357600080fd5b813562001670816200163a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620016a357600080fd5b8335620016b0816200163a565b925060208401359150604084013567ffffffffffffffff80821115620016d557600080fd5b818601915086601f830112620016ea57600080fd5b813581811115620016ff57620016ff62001677565b604051601f8201601f19908116603f011681019083821181831017156200172a576200172a62001677565b816040528281528960208487010111156200174457600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6000806000606084860312156200177c57600080fd5b833562001789816200163a565b925060208401356200179b816200163a565b929592945050506040919091013590565b60008060008060808587031215620017c357600080fd5b8435620017d0816200163a565b93506020850135620017e2816200163a565b92506040850135620017f4816200163a565b9150606085013562001806816200163a565b939692955090935050565b6000602082840312156200182457600080fd5b5051919050565b60208082526032908201527f4e6f7420617574686f72697a65643a204f6e6c7920657363726f772063616e2060408201527131b0b636103a3434b990333ab731ba34b7b760711b606082015260800190565b6020808252600f908201526e496e76616c6964206164647265737360881b604082015260600190565b600060208284031215620018b957600080fd5b815180151581146200167057600080fd5b60005b83811015620018e7578181015183820152602001620018cd565b50506000910152565b600081518084526200190a816020860160208601620018ca565b601f01601f19169290920160200192915050565b60018060a01b0384168152826020820152606060408201526000620019476060830184620018f0565b95945050505050565b6000602082840312156200196357600080fd5b815162001670816200163a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251620019cf818460208701620018ca565b9190910192915050565b602081526000620016706020830184620018f056fe60806040526040516106cc3803806106cc83398101604081905261002291610420565b61002e82826000610035565b505061054a565b61003e836100f6565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100f1576100ef836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e991906104e0565b8361027a565b505b505050565b6001600160a01b0381163b6101605760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101d4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c591906104e0565b6001600160a01b03163b151590565b6102395760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610157565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392909216919091179055565b606061029f83836040518060600160405280602781526020016106a5602791396102a6565b9392505050565b6060600080856001600160a01b0316856040516102c391906104fb565b600060405180830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b5090925090506103158683838761031f565b9695505050505050565b6060831561038e578251600003610387576001600160a01b0385163b6103875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610157565b5081610398565b61039883836103a0565b949350505050565b8151156103b05781518083602001fd5b8060405162461bcd60e51b81526004016101579190610517565b80516001600160a01b03811681146103e157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156104175781810151838201526020016103ff565b50506000910152565b6000806040838503121561043357600080fd5b61043c836103ca565b60208401519092506001600160401b038082111561045957600080fd5b818501915085601f83011261046d57600080fd5b81518181111561047f5761047f6103e6565b604051601f8201601f19908116603f011681019083821181831017156104a7576104a76103e6565b816040528281528860208487010111156104c057600080fd5b6104d18360208301602088016103fc565b80955050505050509250929050565b6000602082840312156104f257600080fd5b61029f826103ca565b6000825161050d8184602087016103fc565b9190910192915050565b60208152600082518060208401526105368160408501602087016103fc565b601f01601f19169190910160400192915050565b61014c806105596000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b6100c2565b565b600061005c7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bd91906100e6565b905090565b3660008037600080366000845af43d6000803e8080156100e1573d6000f35b3d6000fd5b6000602082840312156100f857600080fd5b81516001600160a01b038116811461010f57600080fd5b939250505056fea26469706673582212200fdbd93def38e5cbcee033f760da77fe3d36b8bf06a75256372b980f4ae5bd5064736f6c63430008160033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506040516104be3803806104be83398101604081905261002f9161013a565b61003833610047565b61004181610097565b5061016a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381163b6101185760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000606482015260840160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561014c57600080fd5b81516001600160a01b038116811461016357600080fd5b9392505050565b610345806101796000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a3660046102df565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f61010e565b6000546001600160a01b031661007e565b61006f6100c13660046102df565b610122565b6100ce6101a0565b6100d7816101fa565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6101166101a0565b610120600061028f565b565b61012a6101a0565b6001600160a01b0381166101945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61019d8161028f565b50565b6000546001600160a01b031633146101205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018b565b6001600160a01b0381163b61026d5760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f6044820152721b881a5cc81b9bdd08184818dbdb9d1c9858dd606a1b606482015260840161018b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102f157600080fd5b81356001600160a01b038116811461030857600080fd5b939250505056fea264697066735822122061aafe9c0974224ae4f98e82cd84eb5427d380f755f81ef0957872ad1c509caf64736f6c63430008160033a2646970667358221220a4ecceefd2f10c7205105791c80f873ce0775dd7c8fd219175fd7aa9768aae8164736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "balanceOf(address)": { + "params": { + "account": "The address to query the balance of." + }, + "returns": { + "_0": "The balance as a uint256." + } + }, + "claim(address)": { + "params": { + "_from": "The address for which to claim rewards." + } + }, + "initialize(address,address,address,address)": { + "details": "This function can only be called once due to the initializer modifier", + "params": { + "_escrow": "The address of the escrow responsible for staking operations", + "_stakingContract": "The address of the contract handling staking", + "_stakingToken": "The address of the token to be staked", + "_stakingWalletImplementation": "The address of the staking wallet implementation" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "periodFinish()": { + "returns": { + "_0": "The period finish time as a uint256." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardRate()": { + "returns": { + "_0": "The reward rate as a uint256." + } + }, + "rewardToken()": { + "returns": { + "_0": "The address of the reward token." + } + }, + "setEscrow(address)": { + "params": { + "_escrow": "The address of the new escrow." + } + }, + "setStakingContract(address)": { + "params": { + "_stakingContract": "The address of the new staking contract." + } + }, + "setStakingToken(address)": { + "params": { + "_stakingToken": "The address of the new staking token." + } + }, + "setUpgradeableBeacon(address)": { + "params": { + "_beacon": "The address of the new beacon contract." + } + }, + "stake(address,uint256,bytes)": { + "params": { + "_amount": "The amount of tokens to stake.", + "_data": "Additional data that might be needed for staking.", + "_from": "The address from which tokens will be staked." + } + }, + "totalSupply()": { + "returns": { + "_0": "The total supply as a uint256." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "transferStakingWallet(address,address,uint256)": { + "params": { + "from": "The current owner of the staking wallet.", + "to": "The new owner of the staking wallet." + } + }, + "withdraw(address,address,uint256)": { + "params": { + "_amount": "The amount of tokens to withdraw.", + "_owner": "The address from which tokens will be withdrawn." + } + } + }, + "title": "VeloAeroStakingStrategy", + "version": 1 + }, + "userdoc": { + "events": { + "Claimed(address,address)": { + "notice": "Emitted when rewards are claimed" + }, + "EscrowSet(address)": { + "notice": "Emitted when escrow is set" + }, + "Initialized(address,address,address,address)": { + "notice": "Emitted when the contract is initialized" + }, + "Staked(address,uint256,address)": { + "notice": "Emitted when tokens are staked" + }, + "StakingContractSet(address)": { + "notice": "Emitted when staking contract is set" + }, + "StakingTokenSet(address)": { + "notice": "Emitted when staking token is set" + }, + "StakingWalletTransferred(address,address,uint256)": { + "notice": "Emitted when staking wallet is transferred" + }, + "UpgradeableBeaconSet(address)": { + "notice": "Emitted when upgradeable beacon is set" + }, + "Withdrawn(address,address,uint256)": { + "notice": "Emitted when tokens are withdrawn" + } + }, + "kind": "user", + "methods": { + "balanceOf(address)": { + "notice": "Returns the balance of a specific address." + }, + "claim(address)": { + "notice": "Claims rewards for a given address." + }, + "escrow()": { + "notice": "Address of the escrow responsible for managing staking operations" + }, + "initialize(address,address,address,address)": { + "notice": "Initializes the staking strategy contract with necessary parameters" + }, + "periodFinish()": { + "notice": "Returns the period finish time for the staking strategy." + }, + "rewardRate()": { + "notice": "Returns the current reward rate for the staking strategy." + }, + "rewardToken()": { + "notice": "Returns the address of the reward token for the staking strategy." + }, + "setEscrow(address)": { + "notice": "Sets the escrow address." + }, + "setStakingContract(address)": { + "notice": "Sets the staking contract address." + }, + "setStakingToken(address)": { + "notice": "Sets the staking token address." + }, + "setUpgradeableBeacon(address)": { + "notice": "Sets the address of the beacon." + }, + "stake(address,uint256,bytes)": { + "notice": "Stakes a specified amount of tokens from a given address." + }, + "stakingContract()": { + "notice": "Address of the contract where staking operations are executed" + }, + "stakingToken()": { + "notice": "Address of the token being staked" + }, + "totalSupply()": { + "notice": "Returns the total supply of staked tokens." + }, + "transferStakingWallet(address,address,uint256)": { + "notice": "Transfers the staking wallet from one user to another." + }, + "userStakingWallet(address)": { + "notice": "Mapping of user addresses to their respective staking wallet addresses" + }, + "veloAeroBeacon()": { + "notice": "Address of beacon contract that manages wallet proxies" + }, + "withdraw(address,address,uint256)": { + "notice": "Withdraws a specified amount of tokens for a given address." + } + }, + "notice": "Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 109566, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "escrow", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 109569, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "stakingToken", + "offset": 0, + "slot": "152", + "type": "t_address" + }, + { + "astId": 109572, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "stakingContract", + "offset": 0, + "slot": "153", + "type": "t_address" + }, + { + "astId": 109576, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "veloAeroBeacon", + "offset": 0, + "slot": "154", + "type": "t_contract(UpgradeableBeacon)8851" + }, + { + "astId": 109581, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "userStakingWallet", + "offset": 0, + "slot": "155", + "type": "t_mapping(t_address,t_address)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(UpgradeableBeacon)8851": { + "encoding": "inplace", + "label": "contract UpgradeableBeacon", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E_Proxy.json b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E_Proxy.json new file mode 100644 index 0000000000..9b1de4d38a --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0x690A74d2eC0175a69C0962B309E03021C0b5002E_Proxy.json @@ -0,0 +1,304 @@ +{ + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "transactionIndex": 2, + "gasUsed": "1117183", + "logsBloom": "0x00000000000000000000000000000002400000040000000020800000040000000000000000000000000000000800000000000000000000000000000000000000000000000040000400002000000002000001000000000000000200000004000400000000020000000000000800000a00040000800000000000100000000000440000000000000000000000000000000000000000000080000080000000800000000000000000000000000000000400000000000000000100000008004000200000000020000000000000000000044000001000000400000004000000020020000000000000000000000000000000000000000000000000000000000000010100", + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76", + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000048e40a02e932bcd81626c38a2276d0bcb20bbcfb" + ], + "data": "0x", + "logIndex": 26, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 27, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0x051bD9001a5546504b4852f162de72A58421feC7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e5d0ae222c40e719c45be2ade421f91a345ae000" + ], + "data": "0x", + "logIndex": 28, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0x051bD9001a5546504b4852f162de72A58421feC7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x000000000000000000000000e5d0ae222c40e719c45be2ade421f91a345ae000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 29, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f", + "0x0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8", + "0x000000000000000000000000690a74d2ec0175a69c0962b309e03021c0b5002e", + "0x0000000000000000000000008ff8b21a0736738b25597d32d8f7cf658f39f157" + ], + "data": "0x000000000000000000000000eefbcd99d5bff6fbd3ab8bce659d31b2b9443a3f", + "logIndex": 30, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 31, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + }, + { + "transactionIndex": 2, + "blockNumber": 19228367, + "transactionHash": "0xeb8955ac37759e2d7b3089136297133b582dabca75f690661bea9f687aaf758c", + "address": "0xE5d0AE222c40e719c45Be2ade421F91a345AE000", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031504094cd6ec0cea87884d0dab439afe3ed93bf", + "logIndex": 32, + "blockHash": "0x1073aa08e2f36518859e5c142747d4159364a87d6e3f50ee337842a53a3cfa76" + } + ], + "blockNumber": 19228367, + "cumulativeGasUsed": "1888888", + "status": 1, + "byzantium": true + }, + "args": [ + "0x48e40A02e932bcD81626C38A2276d0Bcb20BBcfb", + "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", + "0xf8c8765e0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8000000000000000000000000690a74d2ec0175a69c0962b309e03021c0b5002e0000000000000000000000008ff8b21a0736738b25597d32d8f7cf658f39f157000000000000000000000000eefbcd99d5bff6fbd3ab8bce659d31b2b9443a3f" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a.json b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a.json new file mode 100644 index 0000000000..fd9c859fb7 --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a.json @@ -0,0 +1,899 @@ +{ + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newEscrow", + "type": "address" + } + ], + "name": "EscrowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "escrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingWalletImplementation", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingContract", + "type": "address" + } + ], + "name": "StakingContractSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingToken", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakingWalletTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBeacon", + "type": "address" + } + ], + "name": "UpgradeableBeaconSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "withdrawTo", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "escrow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingWalletImplementation", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + } + ], + "name": "setEscrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + } + ], + "name": "setStakingContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + } + ], + "name": "setStakingToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_beacon", + "type": "address" + } + ], + "name": "setUpgradeableBeacon", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakingToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferStakingWallet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userStakingWallet", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veloAeroBeacon", + "outputs": [ + { + "internalType": "contract UpgradeableBeacon", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_withdrawTo", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "transactionIndex": 1, + "gasUsed": "1117195", + "logsBloom": "0x04000000000000000000000000000000400000000000000120800000000000800000000040000000004020000800800000000000000000400000000000000000000000000000000000000000000002000001000000000000000000000000000400000000020000000000000800020800000000800000000000000000000000440000000000010000000000000000000000000000000080000000000000800000000000000000000100000000010400000000000000000080000008004000000000000021000000002000000000040000001000000400000004000002000020000000000000000000000000000000000000000000000000000080020000000000", + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb", + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000e64c8ea3e0541bf5157e711171e3ca6a3727d87a" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x0007731b29f44eeb2a0B1718E7A26F74E01013e1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000012f4e2e2f81048faddf2f8e193fddc3eb9d1ecb4" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x0007731b29f44eeb2a0B1718E7A26F74E01013e1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x00000000000000000000000012f4e2e2f81048faddf2f8e193fddc3eb9d1ecb4", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 3, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f", + "0x0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8", + "0x000000000000000000000000c6a394952c097004f83d2dfb61715d245a38735a", + "0x0000000000000000000000003f385fedd141f57323dd91aa735c7243382831d8" + ], + "data": "0x000000000000000000000000bb226852e6c3023614acfb7a42d22687acf96769", + "logIndex": 4, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 5, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031504094cd6ec0cea87884d0dab439afe3ed93bf", + "logIndex": 6, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + } + ], + "blockNumber": 19228339, + "cumulativeGasUsed": "1161082", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE64C8ea3E0541Bf5157E711171e3ca6a3727d87a", + "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", + "0xf8c8765e0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8000000000000000000000000c6a394952c097004f83d2dfb61715d245a38735a0000000000000000000000003f385fedd141f57323dd91aa735c7243382831d8000000000000000000000000bb226852e6c3023614acfb7a42d22687acf96769" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "execute": { + "methodName": "initialize", + "args": [ + "0x2Abd9eB57Fb7727138f4181B68DA0426B7fd47e8", + "0xC6A394952c097004F83d2dfB61715d245A38735a", + "0x3f385FeDd141F57323dD91aA735C7243382831D8", + "0xbB226852e6c3023614aCfb7a42d22687Acf96769" + ] + }, + "implementation": "0xE64C8ea3E0541Bf5157E711171e3ca6a3727d87a", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a_Implementation.json b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a_Implementation.json new file mode 100644 index 0000000000..1cbd063e00 --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a_Implementation.json @@ -0,0 +1,978 @@ +{ + "address": "0xE64C8ea3E0541Bf5157E711171e3ca6a3727d87a", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newEscrow", + "type": "address" + } + ], + "name": "EscrowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "escrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingWalletImplementation", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "veloWallet", + "type": "address" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingContract", + "type": "address" + } + ], + "name": "StakingContractSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newStakingToken", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakingWalletTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newBeacon", + "type": "address" + } + ], + "name": "UpgradeableBeaconSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "withdrawTo", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "escrow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingWalletImplementation", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_escrow", + "type": "address" + } + ], + "name": "setEscrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingContract", + "type": "address" + } + ], + "name": "setStakingContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + } + ], + "name": "setStakingToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_beacon", + "type": "address" + } + ], + "name": "setUpgradeableBeacon", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakingToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferStakingWallet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userStakingWallet", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veloAeroBeacon", + "outputs": [ + { + "internalType": "contract UpgradeableBeacon", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_withdrawTo", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x917d34e9023f21ffd4e92a103cd183da751b175e3858937816fbf77a9448793c", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xE64C8ea3E0541Bf5157E711171e3ca6a3727d87a", + "transactionIndex": 2, + "gasUsed": "2159447", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000008000000000000000400000000000000000000800000000000000000001000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb741252762bd5f01d92646dff32bf7f92bfa7ddaa4b83803f26eaba716af945d", + "transactionHash": "0x917d34e9023f21ffd4e92a103cd183da751b175e3858937816fbf77a9448793c", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 19228337, + "transactionHash": "0x917d34e9023f21ffd4e92a103cd183da751b175e3858937816fbf77a9448793c", + "address": "0xE64C8ea3E0541Bf5157E711171e3ca6a3727d87a", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 7, + "blockHash": "0xb741252762bd5f01d92646dff32bf7f92bfa7ddaa4b83803f26eaba716af945d" + } + ], + "blockNumber": 19228337, + "cumulativeGasUsed": "2490224", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"veloWallet\",\"type\":\"address\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newEscrow\",\"type\":\"address\"}],\"name\":\"EscrowSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"escrow\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"stakingToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"stakingContract\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"stakingWalletImplementation\",\"type\":\"address\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"veloWallet\",\"type\":\"address\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newStakingContract\",\"type\":\"address\"}],\"name\":\"StakingContractSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newStakingToken\",\"type\":\"address\"}],\"name\":\"StakingTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakingWalletTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBeacon\",\"type\":\"address\"}],\"name\":\"UpgradeableBeaconSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"withdrawTo\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"escrow\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_escrow\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingWalletImplementation\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"periodFinish\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_escrow\",\"type\":\"address\"}],\"name\":\"setEscrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stakingContract\",\"type\":\"address\"}],\"name\":\"setStakingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stakingToken\",\"type\":\"address\"}],\"name\":\"setStakingToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_beacon\",\"type\":\"address\"}],\"name\":\"setUpgradeableBeacon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferStakingWallet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userStakingWallet\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veloAeroBeacon\",\"outputs\":[{\"internalType\":\"contract UpgradeableBeacon\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_withdrawTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley (https://github.com/jourdanDunkley)\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"balanceOf(address)\":{\"params\":{\"account\":\"The address to query the balance of.\"},\"returns\":{\"_0\":\"The balance as a uint256.\"}},\"claim(address)\":{\"params\":{\"_from\":\"The address for which to claim rewards.\"}},\"initialize(address,address,address,address)\":{\"details\":\"This function can only be called once due to the initializer modifier\",\"params\":{\"_escrow\":\"The address of the escrow responsible for staking operations\",\"_stakingContract\":\"The address of the contract handling staking\",\"_stakingToken\":\"The address of the token to be staked\",\"_stakingWalletImplementation\":\"The address of the staking wallet implementation\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"periodFinish()\":{\"returns\":{\"_0\":\"The period finish time as a uint256.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"rewardRate()\":{\"returns\":{\"_0\":\"The reward rate as a uint256.\"}},\"rewardToken()\":{\"returns\":{\"_0\":\"The address of the reward token.\"}},\"setEscrow(address)\":{\"params\":{\"_escrow\":\"The address of the new escrow.\"}},\"setStakingContract(address)\":{\"params\":{\"_stakingContract\":\"The address of the new staking contract.\"}},\"setStakingToken(address)\":{\"params\":{\"_stakingToken\":\"The address of the new staking token.\"}},\"setUpgradeableBeacon(address)\":{\"params\":{\"_beacon\":\"The address of the new beacon contract.\"}},\"stake(address,uint256,bytes)\":{\"params\":{\"_amount\":\"The amount of tokens to stake.\",\"_data\":\"Additional data that might be needed for staking.\",\"_from\":\"The address from which tokens will be staked.\"}},\"totalSupply()\":{\"returns\":{\"_0\":\"The total supply as a uint256.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"transferStakingWallet(address,address,uint256)\":{\"params\":{\"from\":\"The current owner of the staking wallet.\",\"to\":\"The new owner of the staking wallet.\"}},\"withdraw(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of tokens to withdraw.\",\"_owner\":\"The address from which tokens will be withdrawn.\"}}},\"title\":\"VeloAeroStakingStrategy\",\"version\":1},\"userdoc\":{\"events\":{\"Claimed(address,address)\":{\"notice\":\"Emitted when rewards are claimed\"},\"EscrowSet(address)\":{\"notice\":\"Emitted when escrow is set\"},\"Initialized(address,address,address,address)\":{\"notice\":\"Emitted when the contract is initialized\"},\"Staked(address,uint256,address)\":{\"notice\":\"Emitted when tokens are staked\"},\"StakingContractSet(address)\":{\"notice\":\"Emitted when staking contract is set\"},\"StakingTokenSet(address)\":{\"notice\":\"Emitted when staking token is set\"},\"StakingWalletTransferred(address,address,uint256)\":{\"notice\":\"Emitted when staking wallet is transferred\"},\"UpgradeableBeaconSet(address)\":{\"notice\":\"Emitted when upgradeable beacon is set\"},\"Withdrawn(address,address,uint256)\":{\"notice\":\"Emitted when tokens are withdrawn\"}},\"kind\":\"user\",\"methods\":{\"balanceOf(address)\":{\"notice\":\"Returns the balance of a specific address.\"},\"claim(address)\":{\"notice\":\"Claims rewards for a given address.\"},\"escrow()\":{\"notice\":\"Address of the escrow responsible for managing staking operations\"},\"initialize(address,address,address,address)\":{\"notice\":\"Initializes the staking strategy contract with necessary parameters\"},\"periodFinish()\":{\"notice\":\"Returns the period finish time for the staking strategy.\"},\"rewardRate()\":{\"notice\":\"Returns the current reward rate for the staking strategy.\"},\"rewardToken()\":{\"notice\":\"Returns the address of the reward token for the staking strategy.\"},\"setEscrow(address)\":{\"notice\":\"Sets the escrow address.\"},\"setStakingContract(address)\":{\"notice\":\"Sets the staking contract address.\"},\"setStakingToken(address)\":{\"notice\":\"Sets the staking token address.\"},\"setUpgradeableBeacon(address)\":{\"notice\":\"Sets the address of the beacon.\"},\"stake(address,uint256,bytes)\":{\"notice\":\"Stakes a specified amount of tokens from a given address.\"},\"stakingContract()\":{\"notice\":\"Address of the contract where staking operations are executed\"},\"stakingToken()\":{\"notice\":\"Address of the token being staked\"},\"totalSupply()\":{\"notice\":\"Returns the total supply of staked tokens.\"},\"transferStakingWallet(address,address,uint256)\":{\"notice\":\"Transfers the staking wallet from one user to another.\"},\"userStakingWallet(address)\":{\"notice\":\"Mapping of user addresses to their respective staking wallet addresses\"},\"veloAeroBeacon()\":{\"notice\":\"Address of beacon contract that manages wallet proxies\"},\"withdraw(address,address,uint256)\":{\"notice\":\"Withdraws a specified amount of tokens for a given address.\"}},\"notice\":\"Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/stake/velo/VeloAeroStakingStrategy.sol\":\"VeloAeroStakingStrategy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./OwnableUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available all functions\\r\\n * from parent (Ownable).\\r\\n */\\r\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\r\\n function __Ownable2Step_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n address private _pendingOwner;\\r\\n\\r\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the pending owner.\\r\\n */\\r\\n function pendingOwner() public view virtual returns (address) {\\r\\n return _pendingOwner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\r\\n _pendingOwner = newOwner;\\r\\n emit OwnershipTransferStarted(owner(), newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual override {\\r\\n delete _pendingOwner;\\r\\n super._transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The new owner accepts the ownership transfer.\\r\\n */\\r\\n function acceptOwnership() external {\\r\\n address sender = _msgSender();\\r\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\r\\n _transferOwnership(sender);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xc02ae28ae149c0475b5b98088ecc53b1b6310d906506c5522f598f02d88f9131\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n function __Ownable_init() internal onlyInitializing {\\r\\n __Ownable_init_unchained();\\r\\n }\\r\\n\\r\\n function __Ownable_init_unchained() internal onlyInitializing {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[49] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0xcf4a2c2c1a8b1570ee9a7059c218de1efbc9050239b1111dcfc24081391d11b7\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xffeed6b3cac845b2af4afb30d87cecbd45dec3c408360c157a3db08e28b45043\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20PermitUpgradeable {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xa4ef4473f068f5f97b73e442f554e4464a581c2200c23181287b4c8eee5de777\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20Upgradeable.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20PermitUpgradeable.sol\\\";\\r\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20Upgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20Upgradeable token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20Upgradeable token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20PermitUpgradeable token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5735e7a8ab4d99d6cbef359228e76c7c2057f13f9a22d014458951409ea30f7c\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract ContextUpgradeable is Initializable {\\r\\n function __Context_init() internal onlyInitializing {\\r\\n }\\r\\n\\r\\n function __Context_init_unchained() internal onlyInitializing {\\r\\n }\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This empty reserved space is put in place to allow future versions to add new\\r\\n * variables without shifting down storage in the inheritance chain.\\r\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\r\\n */\\r\\n uint256[50] private __gap;\\r\\n}\\r\\n\",\"keccak256\":\"0x7ca50b2db181b128c3c202f67bbc2fc189628f41a8643027c445facc907a10b6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../utils/Context.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev Contract module which provides a basic access control mechanism, where\\r\\n * there is an account (an owner) that can be granted exclusive access to\\r\\n * specific functions.\\r\\n *\\r\\n * By default, the owner account will be the one that deploys the contract. This\\r\\n * can later be changed with {transferOwnership}.\\r\\n *\\r\\n * This module is used through inheritance. It will make available the modifier\\r\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\r\\n * the owner.\\r\\n */\\r\\nabstract contract Ownable is Context {\\r\\n address private _owner;\\r\\n\\r\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\r\\n\\r\\n /**\\r\\n * @dev Initializes the contract setting the deployer as the initial owner.\\r\\n */\\r\\n constructor() {\\r\\n _transferOwnership(_msgSender());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if called by any account other than the owner.\\r\\n */\\r\\n modifier onlyOwner() {\\r\\n _checkOwner();\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the address of the current owner.\\r\\n */\\r\\n function owner() public view virtual returns (address) {\\r\\n return _owner;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Throws if the sender is not the owner.\\r\\n */\\r\\n function _checkOwner() internal view virtual {\\r\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Leaves the contract without owner. It will not be possible to call\\r\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\r\\n *\\r\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\r\\n * thereby removing any functionality that is only available to the owner.\\r\\n */\\r\\n function renounceOwnership() public virtual onlyOwner {\\r\\n _transferOwnership(address(0));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Can only be called by the current owner.\\r\\n */\\r\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\r\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\r\\n _transferOwnership(newOwner);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\r\\n * Internal function without access restriction.\\r\\n */\\r\\n function _transferOwnership(address newOwner) internal virtual {\\r\\n address oldOwner = _owner;\\r\\n _owner = newOwner;\\r\\n emit OwnershipTransferred(oldOwner, newOwner);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xee2b6bc803215b66037612da0fe9f23ec3c99ff89db4ff05449a8df17c9befc5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\r\\n * proxy whose upgrades are fully controlled by the current implementation.\\r\\n */\\r\\ninterface IERC1822Proxiable {\\r\\n /**\\r\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\r\\n * address.\\r\\n *\\r\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\r\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\r\\n * function revert if invoked through a proxy.\\r\\n */\\r\\n function proxiableUUID() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xe768c5863db91751a70d25c9dac899ec5078c6bacfbc02878652e454aa416b9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../beacon/IBeacon.sol\\\";\\r\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\r\\nimport \\\"../../utils/Address.sol\\\";\\r\\nimport \\\"../../utils/StorageSlot.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This abstract contract provides getters and event emitting update functions for\\r\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\r\\n *\\r\\n * _Available since v4.1._\\r\\n *\\r\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\r\\n */\\r\\nabstract contract ERC1967Upgrade {\\r\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\r\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\r\\n\\r\\n /**\\r\\n * @dev Storage slot with the address of the current implementation.\\r\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\r\\n * validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the implementation is upgraded.\\r\\n */\\r\\n event Upgraded(address indexed implementation);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address.\\r\\n */\\r\\n function _getImplementation() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new address in the EIP1967 implementation slot.\\r\\n */\\r\\n function _setImplementation(address newImplementation) private {\\r\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\r\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeTo(address newImplementation) internal {\\r\\n _setImplementation(newImplementation);\\r\\n emit Upgraded(newImplementation);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade with additional setup call.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeToAndCall(\\r\\n address newImplementation,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n _upgradeTo(newImplementation);\\r\\n if (data.length > 0 || forceCall) {\\r\\n Address.functionDelegateCall(newImplementation, data);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n */\\r\\n function _upgradeToAndCallUUPS(\\r\\n address newImplementation,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\r\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\r\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\r\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\r\\n _setImplementation(newImplementation);\\r\\n } else {\\r\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\r\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\r\\n } catch {\\r\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\r\\n }\\r\\n _upgradeToAndCall(newImplementation, data, forceCall);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Storage slot with the admin of the contract.\\r\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\r\\n * validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the admin account has changed.\\r\\n */\\r\\n event AdminChanged(address previousAdmin, address newAdmin);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current admin.\\r\\n */\\r\\n function _getAdmin() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new address in the EIP1967 admin slot.\\r\\n */\\r\\n function _setAdmin(address newAdmin) private {\\r\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\r\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the admin of the proxy.\\r\\n *\\r\\n * Emits an {AdminChanged} event.\\r\\n */\\r\\n function _changeAdmin(address newAdmin) internal {\\r\\n emit AdminChanged(_getAdmin(), newAdmin);\\r\\n _setAdmin(newAdmin);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\r\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\r\\n */\\r\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the beacon is upgraded.\\r\\n */\\r\\n event BeaconUpgraded(address indexed beacon);\\r\\n\\r\\n /**\\r\\n * @dev Returns the current beacon.\\r\\n */\\r\\n function _getBeacon() internal view returns (address) {\\r\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\r\\n */\\r\\n function _setBeacon(address newBeacon) private {\\r\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\r\\n require(\\r\\n Address.isContract(IBeacon(newBeacon).implementation()),\\r\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\r\\n );\\r\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\r\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\r\\n *\\r\\n * Emits a {BeaconUpgraded} event.\\r\\n */\\r\\n function _upgradeBeaconToAndCall(\\r\\n address newBeacon,\\r\\n bytes memory data,\\r\\n bool forceCall\\r\\n ) internal {\\r\\n _setBeacon(newBeacon);\\r\\n emit BeaconUpgraded(newBeacon);\\r\\n if (data.length > 0 || forceCall) {\\r\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb9b4ac05179724cbcb7621bdab336a09eb32d07e07b425e0216263ad80388145\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\r\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\r\\n * be specified by overriding the virtual {_implementation} function.\\r\\n *\\r\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\r\\n * different contract through the {_delegate} function.\\r\\n *\\r\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\r\\n */\\r\\nabstract contract Proxy {\\r\\n /**\\r\\n * @dev Delegates the current call to `implementation`.\\r\\n *\\r\\n * This function does not return to its internal call site, it will return directly to the external caller.\\r\\n */\\r\\n function _delegate(address implementation) internal virtual {\\r\\n assembly {\\r\\n // Copy msg.data. We take full control of memory in this inline assembly\\r\\n // block because it will not return to Solidity code. We overwrite the\\r\\n // Solidity scratch pad at memory position 0.\\r\\n calldatacopy(0, 0, calldatasize())\\r\\n\\r\\n // Call the implementation.\\r\\n // out and outsize are 0 because we don't know the size yet.\\r\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\r\\n\\r\\n // Copy the returned data.\\r\\n returndatacopy(0, 0, returndatasize())\\r\\n\\r\\n switch result\\r\\n // delegatecall returns 0 on error.\\r\\n case 0 {\\r\\n revert(0, returndatasize())\\r\\n }\\r\\n default {\\r\\n return(0, returndatasize())\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\r\\n * and {_fallback} should delegate.\\r\\n */\\r\\n function _implementation() internal view virtual returns (address);\\r\\n\\r\\n /**\\r\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\r\\n *\\r\\n * This function does not return to its internal call site, it will return directly to the external caller.\\r\\n */\\r\\n function _fallback() internal virtual {\\r\\n _beforeFallback();\\r\\n _delegate(_implementation());\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\r\\n * function in the contract matches the call data.\\r\\n */\\r\\n fallback() external payable virtual {\\r\\n _fallback();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\r\\n * is empty.\\r\\n */\\r\\n receive() external payable virtual {\\r\\n _fallback();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\r\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\r\\n *\\r\\n * If overridden should call `super._beforeFallback()`.\\r\\n */\\r\\n function _beforeFallback() internal virtual {}\\r\\n}\\r\\n\",\"keccak256\":\"0x62c6b919abeeb4c9146ffbb325fc03b5f2d55a29b8e719b8ff62daab48123565\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IBeacon.sol\\\";\\r\\nimport \\\"../Proxy.sol\\\";\\r\\nimport \\\"../ERC1967/ERC1967Upgrade.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\\r\\n *\\r\\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\\r\\n * conflict with the storage layout of the implementation behind the proxy.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\\r\\n /**\\r\\n * @dev Initializes the proxy with `beacon`.\\r\\n *\\r\\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\\r\\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\\r\\n * constructor.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `beacon` must be a contract with the interface {IBeacon}.\\r\\n */\\r\\n constructor(address beacon, bytes memory data) payable {\\r\\n _upgradeBeaconToAndCall(beacon, data, false);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current beacon address.\\r\\n */\\r\\n function _beacon() internal view virtual returns (address) {\\r\\n return _getBeacon();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address of the associated beacon.\\r\\n */\\r\\n function _implementation() internal view virtual override returns (address) {\\r\\n return IBeacon(_getBeacon()).implementation();\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\\r\\n *\\r\\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `beacon` must be a contract.\\r\\n * - The implementation returned by `beacon` must be a contract.\\r\\n */\\r\\n function _setBeacon(address beacon, bytes memory data) internal virtual {\\r\\n _upgradeBeaconToAndCall(beacon, data, false);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8e6523f96ae0050f3de4c1bf1a6d635459e2c5bc83991bdfbeae9d11e3dee152\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\r\\n */\\r\\ninterface IBeacon {\\r\\n /**\\r\\n * @dev Must return an address that can be used as a delegate call target.\\r\\n *\\r\\n * {BeaconProxy} will check that this address is a contract.\\r\\n */\\r\\n function implementation() external view returns (address);\\r\\n}\\r\\n\",\"keccak256\":\"0xd3effc3ce6d1c85e1aae2ba5c6f28434c2eef52e1fc48b15096a176dcfee5853\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./IBeacon.sol\\\";\\r\\nimport \\\"../../access/Ownable.sol\\\";\\r\\nimport \\\"../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\\r\\n * implementation contract, which is where they will delegate all function calls.\\r\\n *\\r\\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\\r\\n */\\r\\ncontract UpgradeableBeacon is IBeacon, Ownable {\\r\\n address private _implementation;\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the implementation returned by the beacon is changed.\\r\\n */\\r\\n event Upgraded(address indexed implementation);\\r\\n\\r\\n /**\\r\\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\\r\\n * beacon.\\r\\n */\\r\\n constructor(address implementation_) {\\r\\n _setImplementation(implementation_);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns the current implementation address.\\r\\n */\\r\\n function implementation() public view virtual override returns (address) {\\r\\n return _implementation;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Upgrades the beacon to a new implementation.\\r\\n *\\r\\n * Emits an {Upgraded} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - msg.sender must be the owner of the contract.\\r\\n * - `newImplementation` must be a contract.\\r\\n */\\r\\n function upgradeTo(address newImplementation) public virtual onlyOwner {\\r\\n _setImplementation(newImplementation);\\r\\n emit Upgraded(newImplementation);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Sets the implementation contract address for this beacon\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `newImplementation` must be a contract.\\r\\n */\\r\\n function _setImplementation(address newImplementation) private {\\r\\n require(Address.isContract(newImplementation), \\\"UpgradeableBeacon: implementation is not a contract\\\");\\r\\n _implementation = newImplementation;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x96d52f844533def4977d87f5b21e2352a27d8796ea9bf11a4a44691cae275de8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20 {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xdd286f7283325eb12ee50e41dac6be9665262e827b66f4f8952111ff77b6a130\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20Permit {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0x86bd9e04dbee51fb3a9370279a0177e9da874a858dfb2c25a405171aa5ae2030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\r\\nimport \\\"../../../utils/Address.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20 {\\r\\n using Address for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20 token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20 token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20 token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20Permit token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x9c3c43ba6e81d44ca93d32e97e0d5b9d64eb7346b7a3921e6ce9648f4b70f815\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary Address {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a delegate call.\\r\\n *\\r\\n * _Available since v3.4._\\r\\n */\\r\\n function functionDelegateCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb7ed49cc8c6b941c4b0f07556eef72cedbce73d60c79d54cc82f6bbe7e061fb5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Provides information about the current execution context, including the\\r\\n * sender of the transaction and its data. While these are generally available\\r\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\r\\n * manner, since when dealing with meta-transactions the account sending and\\r\\n * paying for execution may not be the actual sender (as far as an application\\r\\n * is concerned).\\r\\n *\\r\\n * This contract is only required for intermediate, library-like contracts.\\r\\n */\\r\\nabstract contract Context {\\r\\n function _msgSender() internal view virtual returns (address) {\\r\\n return msg.sender;\\r\\n }\\r\\n\\r\\n function _msgData() internal view virtual returns (bytes calldata) {\\r\\n return msg.data;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x81d5fc973a522c8909d60be6a201869d46aa47b030b8813f60616404628c2b94\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Library for reading and writing primitive types to specific storage slots.\\r\\n *\\r\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\r\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\r\\n *\\r\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\r\\n *\\r\\n * Example usage to set ERC1967 implementation slot:\\r\\n * ```\\r\\n * contract ERC1967 {\\r\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\r\\n *\\r\\n * function _getImplementation() internal view returns (address) {\\r\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\r\\n * }\\r\\n *\\r\\n * function _setImplementation(address newImplementation) internal {\\r\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\r\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\r\\n */\\r\\nlibrary StorageSlot {\\r\\n struct AddressSlot {\\r\\n address value;\\r\\n }\\r\\n\\r\\n struct BooleanSlot {\\r\\n bool value;\\r\\n }\\r\\n\\r\\n struct Bytes32Slot {\\r\\n bytes32 value;\\r\\n }\\r\\n\\r\\n struct Uint256Slot {\\r\\n uint256 value;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\r\\n */\\r\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\r\\n */\\r\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\r\\n */\\r\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\r\\n */\\r\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n r.slot := slot\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xb61a2a836d1e25029f013b03fa606fb6bcea10a9cc93ee2eb85d47b389d18c74\",\"license\":\"MIT\"},\"contracts/veION/stake/IStakeStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IStakeStrategy\\r\\n * @notice Interface for the VeloIonModeStakingModeReward contract.\\r\\n */\\r\\ninterface IStakeStrategy {\\r\\n /// @notice Emitted when the contract is initialized\\r\\n event Initialized(\\r\\n address indexed escrow,\\r\\n address indexed stakingToken,\\r\\n address indexed stakingContract,\\r\\n address stakingWalletImplementation\\r\\n );\\r\\n\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when staking wallet is transferred\\r\\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when escrow is set\\r\\n event EscrowSet(address indexed newEscrow);\\r\\n\\r\\n /// @notice Emitted when staking token is set\\r\\n event StakingTokenSet(address indexed newStakingToken);\\r\\n\\r\\n /// @notice Emitted when staking contract is set\\r\\n event StakingContractSet(address indexed newStakingContract);\\r\\n\\r\\n /// @notice Emitted when upgradeable beacon is set\\r\\n event UpgradeableBeaconSet(address indexed newBeacon);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens from a given address.\\r\\n * @param _from The address from which tokens will be staked.\\r\\n * @param _amount The amount of tokens to stake.\\r\\n * @param _data Additional data that might be needed for staking.\\r\\n */\\r\\n function stake(address _from, uint256 _amount, bytes memory _data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for a given address.\\r\\n * @param _from The address for which to claim rewards.\\r\\n */\\r\\n function claim(address _from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of tokens for a given address.\\r\\n * @param _owner The address from which tokens will be withdrawn.\\r\\n * @param _amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Returns the current reward rate for the staking strategy.\\r\\n * @return The reward rate as a uint256.\\r\\n */\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the period finish time for the staking strategy.\\r\\n * @return The period finish time as a uint256.\\r\\n */\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the balance of a specific address.\\r\\n * @param account The address to query the balance of.\\r\\n * @return The balance as a uint256.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the total supply of staked tokens.\\r\\n * @return The total supply as a uint256.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the reward token for the staking strategy.\\r\\n * @return The address of the reward token.\\r\\n */\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking contract.\\r\\n * @return The address of the staking contract.\\r\\n */\\r\\n function stakingContract() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking token.\\r\\n * @return The address of the staking token.\\r\\n */\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the staking wallet address for a specific user.\\r\\n * @param user The address of the user.\\r\\n * @return The address of the user's staking wallet.\\r\\n */\\r\\n function userStakingWallet(address user) external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Transfers the staking wallet from one user to another.\\r\\n * @param from The current owner of the staking wallet.\\r\\n * @param to The new owner of the staking wallet.\\r\\n */\\r\\n function transferStakingWallet(address from, address to, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the escrow address.\\r\\n * @param _escrow The address of the new escrow.\\r\\n */\\r\\n function setEscrow(address _escrow) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking token address.\\r\\n * @param _stakingToken The address of the new staking token.\\r\\n */\\r\\n function setStakingToken(address _stakingToken) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking contract address.\\r\\n * @param _stakingContract The address of the new staking contract.\\r\\n */\\r\\n function setStakingContract(address _stakingContract) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the beacon.\\r\\n * @param _beacon The address of the new beacon contract.\\r\\n */\\r\\n function setUpgradeableBeacon(address _beacon) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x69d7a60ae3df2ead3b3afaa32ae9b6ea4df13ef65c7c375babe7be2e5457fc8b\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/IStakeWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IStakeWallet {\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(uint256 amount);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, uint256 rewardAmount);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens according to the strategy.\\r\\n * @param amount The amount of tokens to stake.\\r\\n * @param data Additional data required for the staking strategy.\\r\\n */\\r\\n function stake(address from, uint256 amount, bytes memory data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for the caller.\\r\\n */\\r\\n function claim(address from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of staked tokens.\\r\\n * @param withdrawTo The address to withdraw tokens to.\\r\\n * @param amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address withdrawTo, uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa1145156b33d804afb421beb12e8c1fc19416e9d1d4b815d7b698fd97564ef42\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/IVeloIonModeStaking.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IVeloIonModeStaking {\\r\\n event Deposit(address indexed from, address indexed to, uint256 amount);\\r\\n event Withdraw(address indexed from, uint256 amount);\\r\\n event NotifyReward(address indexed from, uint256 amount);\\r\\n event ClaimFees(uint256 claimed0, uint256 claimed1);\\r\\n event ClaimRewards(address indexed from, uint256 amount);\\r\\n\\r\\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the token (VELO v2) rewarded to stakers\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the Converter contract linked to the gauge\\r\\n function feeConverter() external view returns (address);\\r\\n\\r\\n /// @notice Address of the staking rewards factory that created this gauge\\r\\n function factory() external view returns (address);\\r\\n\\r\\n /// @notice Timestamp end of current rewards period\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /// @notice Current reward rate of rewardToken to distribute per second\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent timestamp contract has updated state\\r\\n function lastUpdateTime() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent stored value of rewardPerToken\\r\\n function rewardPerTokenStored() external view returns (uint256);\\r\\n\\r\\n /// @notice Amount of stakingToken deposited for rewards\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /// @notice Get the amount of stakingToken deposited by an account\\r\\n function balanceOf(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\\r\\n function userRewardPerTokenPaid(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached amount of rewardToken earned for an account\\r\\n function rewards(address) external view returns (uint256);\\r\\n\\r\\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\\r\\n function rewardRateByEpoch(uint256) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the current reward rate per unit of stakingToken deposited\\r\\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\\r\\n\\r\\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\\r\\n function lastTimeRewardApplicable() external view returns (uint256 _time);\\r\\n\\r\\n /// @notice Returns accrued balance to date from last claim / first deposit.\\r\\n function earned(address _account) external view returns (uint256 _earned);\\r\\n\\r\\n /// @notice Total amount of rewardToken to distribute for the current rewards period\\r\\n function left() external view returns (uint256 _left);\\r\\n\\r\\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\\r\\n /// @return _claimed0 Amount of Fees claimed in token0\\r\\n /// @return _claimed1 Amount of Fees claimed in token1\\r\\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\\r\\n\\r\\n /// @notice Retrieve rewards for an address.\\r\\n /// @dev Throws if not called by same address or voter.\\r\\n /// @param _account .\\r\\n function getReward(address _account) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for msg.sender\\r\\n /// @param _amount .\\r\\n function deposit(uint256 _amount) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for any user\\r\\n /// @param _amount .\\r\\n /// @param _recipient Recipient to give balance to\\r\\n function deposit(uint256 _amount, address _recipient) external;\\r\\n\\r\\n /// @notice Withdraw LP tokens for user\\r\\n /// @param _amount .\\r\\n function withdraw(uint256 _amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardMatch(uint256 amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardAmount(uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x23f5c8711c247d772dc1dd96417a335a99857bcd8e3dbe9a96d14ac8f5038262\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/VeloAeroStakingStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport \\\"../IStakeStrategy.sol\\\";\\r\\nimport \\\"./VeloAeroStakingWallet.sol\\\";\\r\\nimport \\\"./IVeloIonModeStaking.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport { Ownable2StepUpgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol\\\";\\r\\nimport { BeaconProxy } from \\\"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\\\";\\r\\nimport { UpgradeableBeacon } from \\\"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title VeloAeroStakingStrategy\\r\\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\\r\\n * @author Jourdan Dunkley (https://github.com/jourdanDunkley)\\r\\n */\\r\\ncontract VeloAeroStakingStrategy is IStakeStrategy, Ownable2StepUpgradeable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n /// @notice Address of the escrow responsible for managing staking operations\\r\\n address public escrow;\\r\\n /// @notice Address of the token being staked\\r\\n address public stakingToken;\\r\\n /// @notice Address of the contract where staking operations are executed\\r\\n address public stakingContract;\\r\\n /// @notice Address of beacon contract that manages wallet proxies\\r\\n UpgradeableBeacon public veloAeroBeacon;\\r\\n /// @notice Mapping of user addresses to their respective staking wallet addresses\\r\\n mapping(address => address) public userStakingWallet;\\r\\n\\r\\n /// @dev Modifier to restrict function access to only the escrow address\\r\\n modifier onlyEscrow() {\\r\\n require(msg.sender == escrow, \\\"Not authorized: Only escrow can call this function\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the staking strategy contract with necessary parameters\\r\\n * @dev This function can only be called once due to the initializer modifier\\r\\n * @param _escrow The address of the escrow responsible for staking operations\\r\\n * @param _stakingToken The address of the token to be staked\\r\\n * @param _stakingContract The address of the contract handling staking\\r\\n * @param _stakingWalletImplementation The address of the staking wallet implementation\\r\\n */\\r\\n function initialize(\\r\\n address _escrow,\\r\\n address _stakingToken,\\r\\n address _stakingContract,\\r\\n address _stakingWalletImplementation\\r\\n ) public initializer {\\r\\n __Ownable2Step_init();\\r\\n escrow = _escrow;\\r\\n stakingToken = _stakingToken;\\r\\n stakingContract = _stakingContract;\\r\\n\\r\\n veloAeroBeacon = new UpgradeableBeacon(_stakingWalletImplementation);\\r\\n veloAeroBeacon.transferOwnership(msg.sender);\\r\\n\\r\\n emit Initialized(_escrow, _stakingToken, _stakingContract, _stakingWalletImplementation);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function stake(address _from, uint256 _amount, bytes memory _data) external override onlyEscrow {\\r\\n IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), _amount);\\r\\n\\r\\n address veloWallet = userStakingWallet[_from];\\r\\n if (veloWallet == address(0)) {\\r\\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \\\"\\\");\\r\\n veloWallet = address(newWallet);\\r\\n VeloAeroStakingWallet(veloWallet).initialize(IStakeStrategy(address(this)));\\r\\n userStakingWallet[_from] = veloWallet;\\r\\n }\\r\\n\\r\\n IERC20(stakingToken).approve(veloWallet, _amount);\\r\\n VeloAeroStakingWallet(veloWallet).stake(_from, _amount, _data);\\r\\n emit Staked(_from, _amount, veloWallet);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function claim(address _from) external onlyEscrow {\\r\\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_from]);\\r\\n veloWallet.claim(_from);\\r\\n emit Claimed(_from, address(veloWallet));\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external onlyEscrow {\\r\\n VeloAeroStakingWallet veloWallet = VeloAeroStakingWallet(userStakingWallet[_owner]);\\r\\n veloWallet.withdraw(_withdrawTo, _amount);\\r\\n emit Withdrawn(_owner, _withdrawTo, _amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function transferStakingWallet(address _from, address _to, uint256 _amount) external onlyEscrow {\\r\\n address fromWallet = userStakingWallet[_from];\\r\\n address toWallet = userStakingWallet[_to];\\r\\n\\r\\n if (toWallet == address(0)) {\\r\\n BeaconProxy newWallet = new BeaconProxy(address(veloAeroBeacon), \\\"\\\");\\r\\n toWallet = address(newWallet);\\r\\n VeloAeroStakingWallet(toWallet).initialize(IStakeStrategy(address(this)));\\r\\n userStakingWallet[_to] = toWallet;\\r\\n }\\r\\n\\r\\n VeloAeroStakingWallet(fromWallet).withdraw(address(this), _amount);\\r\\n IERC20(stakingToken).approve(address(toWallet), _amount);\\r\\n VeloAeroStakingWallet(toWallet).stake(_to, _amount, \\\"\\\");\\r\\n emit StakingWalletTransferred(_from, _to, _amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function rewardRate() external view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).rewardRate();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function periodFinish() external view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).periodFinish();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function balanceOf(address account) public view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).balanceOf(account);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function totalSupply() external view override returns (uint256) {\\r\\n return IVeloIonModeStaking(stakingContract).totalSupply();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function rewardToken() public view returns (address) {\\r\\n return IVeloIonModeStaking(stakingContract).rewardToken();\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setEscrow(address _escrow) external onlyOwner {\\r\\n require(_escrow != address(0), \\\"Invalid address\\\");\\r\\n escrow = _escrow;\\r\\n emit EscrowSet(_escrow);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setStakingToken(address _stakingToken) external onlyOwner {\\r\\n require(_stakingToken != address(0), \\\"Invalid address\\\");\\r\\n stakingToken = _stakingToken;\\r\\n emit StakingTokenSet(_stakingToken);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setStakingContract(address _stakingContract) external onlyOwner {\\r\\n require(_stakingContract != address(0), \\\"Invalid address\\\");\\r\\n stakingContract = _stakingContract;\\r\\n emit StakingContractSet(_stakingContract);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeStrategy\\r\\n function setUpgradeableBeacon(address _beacon) external onlyOwner {\\r\\n require(_beacon != address(0), \\\"Invalid address\\\");\\r\\n veloAeroBeacon = UpgradeableBeacon(_beacon);\\r\\n emit UpgradeableBeaconSet(_beacon);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x01b4a448f460c30d749a5723c949c788d95846b4d290fb510623ca064c23ba59\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/VeloAeroStakingWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { IStakeWallet } from \\\"../IStakeWallet.sol\\\";\\r\\nimport { IStakeStrategy } from \\\"../IStakeStrategy.sol\\\";\\r\\nimport { IVeloIonModeStaking } from \\\"./IVeloIonModeStaking.sol\\\";\\r\\nimport { IERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\nimport { SafeERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\r\\nimport { Initializable } from \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title VeloAeroStakingWallet\\r\\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\\r\\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\\r\\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\\r\\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\\r\\n * @author Jourdan Dunkley \\r\\n */\\r\\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\\r\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\r\\n IStakeStrategy public stakeStrategy;\\r\\n\\r\\n /// @dev Modifier to restrict function access to only the stake strategy contract\\r\\n modifier onlyStakeStrategy() {\\r\\n require(msg.sender == address(stakeStrategy), \\\"Not authorized: Only stake strategy can call this function\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the contract with a staking strategy\\r\\n * @dev Can only be called once due to initializer modifier\\r\\n * @param _stakeStrategy The address of the staking strategy contract\\r\\n */\\r\\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\\r\\n stakeStrategy = _stakeStrategy;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\\r\\n stakingToken.approve(address(stakingContract), _amount);\\r\\n stakingContract.deposit(_amount);\\r\\n emit Staked(_amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function claim(address _from) external onlyStakeStrategy {\\r\\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.getReward(address(this));\\r\\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\\r\\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\\r\\n emit Claimed(_from, rewardAmount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.withdraw(_amount);\\r\\n stakingToken.safeTransfer(_withdrawTo, _amount);\\r\\n emit Withdrawn(_withdrawTo, _amount);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5d95949d0e7ba07afe3cfbe991cbf6ec8b8877d10181886ba8cdbf896e914ff7\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6125ae806100ed6000396000f3fe60806040523480156200001157600080fd5b5060043610620001755760003560e01c8063c10c354611620000d3578063ee3fd2231162000086578063ee3fd223146200030a578063ee99205c1462000321578063f2cdf2261462000335578063f2fde38b1462000349578063f7c618c11462000360578063f8c8765e146200036a57600080fd5b8063c10c35461462000295578063d9caed1214620002ac578063e2fdcc1714620002c3578063e30c397814620002d7578063e31d753114620002e9578063ebe2b12b146200030057600080fd5b806372f702f3116200012c57806372f702f314620001ff57806379ba5097146200022c5780637b0a47ee14620002365780638da5cb5b14620002405780639dd373b91462000252578063ae919173146200026957600080fd5b806318160ddd146200017a5780631e83409a14620001975780631e9b12ef14620001b05780633e12170f14620001c757806370a0823114620001de578063715018a614620001f5575b600080fd5b6200018462000381565b6040519081526020015b60405180910390f35b620001ae620001a836600462001650565b620003f7565b005b620001ae620001c136600462001650565b620004dc565b620001ae620001d83660046200168d565b62000559565b62000184620001ef36600462001650565b620007e2565b620001ae6200085a565b60985462000213906001600160a01b031681565b6040516001600160a01b0390911681526020016200018e565b620001ae62000872565b62000184620008f0565b6033546001600160a01b031662000213565b620001ae6200026336600462001650565b6200093b565b620002136200027a36600462001650565b609b602052600090815260409020546001600160a01b031681565b620001ae620002a636600462001650565b620009b8565b620001ae620002bd36600462001766565b62000a35565b60975462000213906001600160a01b031681565b6065546001600160a01b031662000213565b620001ae620002fa36600462001766565b62000b21565b6200018462000e0c565b620001ae6200031b36600462001650565b62000e57565b60995462000213906001600160a01b031681565b609a5462000213906001600160a01b031681565b620001ae6200035a36600462001650565b62000ed4565b6200021362000f48565b620001ae6200037b366004620017ac565b62000fb9565b609954604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001811565b905090565b6097546001600160a01b031633146200042d5760405162461bcd60e51b815260040162000424906200182b565b60405180910390fd5b6001600160a01b038181166000818152609b602052604090819020549051630f41a04d60e11b81526004810192909252909116908190631e83409a90602401600060405180830381600087803b1580156200048757600080fd5b505af11580156200049c573d6000803e3d6000fd5b50506040516001600160a01b038085169350851691507f89309c9b2aeaffbdce717113df9427298b20448c05919bf889e05f8c3094254b90600090a35050565b620004e662001209565b6001600160a01b0381166200050f5760405162461bcd60e51b815260040162000424906200187d565b609880546001600160a01b0319166001600160a01b0383169081179091556040517f9904a32444ae0eb0bae2045baf588aa248f03f4fef600c18afd1d7e751614af890600090a250565b6097546001600160a01b03163314620005865760405162461bcd60e51b815260040162000424906200182b565b609854620005a0906001600160a01b031633308562001265565b6001600160a01b038084166000908152609b60205260409020541680620006ad57609a546040516000916001600160a01b031690620005df906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f0801580156200061b573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b1580156200066457600080fd5b505af115801562000679573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60985460405163095ea7b360e01b81526001600160a01b038381166004830152602482018690529091169063095ea7b3906044016020604051808303816000875af115801562000701573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007279190620018a6565b50604051633e12170f60e01b81526001600160a01b03821690633e12170f906200075a908790879087906004016200191e565b600060405180830381600087803b1580156200077557600080fd5b505af11580156200078a573d6000803e3d6000fd5b50505050806001600160a01b0316846001600160a01b03167f9f9e4044c5742cca66ca090b21552bac14645e68bad7a92364a9d9ff18111a1c85604051620007d491815260200190565b60405180910390a350505050565b6099546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa1580156200082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000854919062001811565b92915050565b6200086462001209565b620008706000620012c7565b565b60655433906001600160a01b03168114620008e25760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840162000424565b620008ed81620012c7565b50565b60995460408051633d8523f760e11b815290516000926001600160a01b031691637b0a47ee9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b6200094562001209565b6001600160a01b0381166200096e5760405162461bcd60e51b815260040162000424906200187d565b609980546001600160a01b0319166001600160a01b0383169081179091556040517f1253844b0fff3da7dd2829de816c9b4f94c238cf2bf6eb72c02c7d6f2b53beac90600090a250565b620009c262001209565b6001600160a01b038116620009eb5760405162461bcd60e51b815260040162000424906200187d565b609780546001600160a01b0319166001600160a01b0383169081179091556040517fa585aec3a6cb0e1a084ed18c7638024e40cc3e3ea815166e2cb6fc17d7f1392b90600090a250565b6097546001600160a01b0316331462000a625760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038381166000908152609b60205260409081902054905163f3fef3a360e01b8152848316600482015260248101849052911690819063f3fef3a390604401600060405180830381600087803b15801562000ac257600080fd5b505af115801562000ad7573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb84604051620007d491815260200190565b6097546001600160a01b0316331462000b4e5760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038084166000908152609b602052604080822054858416835291205490821691168062000c6857609a546040516000916001600160a01b03169062000b9a906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f08015801562000bd6573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b15801562000c1f57600080fd5b505af115801562000c34573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60405163f3fef3a360e01b8152306004820152602481018490526001600160a01b0383169063f3fef3a390604401600060405180830381600087803b15801562000cb157600080fd5b505af115801562000cc6573d6000803e3d6000fd5b505060985460405163095ea7b360e01b81526001600160a01b03858116600483015260248201889052909116925063095ea7b391506044016020604051808303816000875af115801562000d1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d449190620018a6565b50604051633e12170f60e01b81526001600160a01b038581166004830152602482018590526060604483015260006064830152821690633e12170f90608401600060405180830381600087803b15801562000d9e57600080fd5b505af115801562000db3573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b03167fdd0cdc1bea06c790fb371c8acc5b948f282e5872429ce2bc5971f5b5c6d76b6c8560405162000dfd91815260200190565b60405180910390a35050505050565b6099546040805163ebe2b12b60e01b815290516000926001600160a01b03169163ebe2b12b9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b62000e6162001209565b6001600160a01b03811662000e8a5760405162461bcd60e51b815260040162000424906200187d565b609a80546001600160a01b0319166001600160a01b0383169081179091556040517fa922f30fc35aecb996d111c48db797fadceb5a048e693f841e0c4f339bb0326490600090a250565b62000ede62001209565b606580546001600160a01b0383166001600160a01b0319909116811790915562000f106033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6099546040805163f7c618c160e01b815290516000926001600160a01b03169163f7c618c19160048083019260209291908290030181865afa15801562000f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001950565b600054610100900460ff161580801562000fda5750600054600160ff909116105b8062000ff65750303b15801562000ff6575060005460ff166001145b6200105b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840162000424565b6000805460ff1916600117905580156200107f576000805461ff0019166101001790555b62001089620012e2565b609780546001600160a01b038088166001600160a01b0319928316179092556098805487841690831617905560998054928616929091169190911790556040518290620010d6906200162c565b6001600160a01b039091168152602001604051809103906000f08015801562001103573d6000803e3d6000fd5b50609a80546001600160a01b0319166001600160a01b0392909216918217905560405163f2fde38b60e01b815233600482015263f2fde38b90602401600060405180830381600087803b1580156200115a57600080fd5b505af11580156200116f573d6000803e3d6000fd5b50506040516001600160a01b038581168252808716935087811692508816907f3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f9060200160405180910390a4801562001202576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6033546001600160a01b03163314620008705760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000424565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052620012c190859062001316565b50505050565b606580546001600160a01b0319169055620008ed81620013f4565b600054610100900460ff166200130c5760405162461bcd60e51b8152600401620004249062001970565b6200087062001446565b60006200136d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200147b9092919063ffffffff16565b805190915015620013ef57808060200190518101906200138e9190620018a6565b620013ef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000424565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620014705760405162461bcd60e51b8152600401620004249062001970565b6200087033620012c7565b60606200148c848460008562001494565b949350505050565b606082471015620014f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000424565b600080866001600160a01b03168587604051620015159190620019bb565b60006040518083038185875af1925050503d806000811462001554576040519150601f19603f3d011682016040523d82523d6000602084013e62001559565b606091505b50915091506200156c8783838762001577565b979650505050505050565b60608315620015eb578251600003620015e3576001600160a01b0385163b620015e35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000424565b50816200148c565b6200148c8383815115620016025781518083602001fd5b8060405162461bcd60e51b8152600401620004249190620019d9565b6106cc80620019ef83390190565b6104be80620020bb83390190565b6001600160a01b0381168114620008ed57600080fd5b6000602082840312156200166357600080fd5b813562001670816200163a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620016a357600080fd5b8335620016b0816200163a565b925060208401359150604084013567ffffffffffffffff80821115620016d557600080fd5b818601915086601f830112620016ea57600080fd5b813581811115620016ff57620016ff62001677565b604051601f8201601f19908116603f011681019083821181831017156200172a576200172a62001677565b816040528281528960208487010111156200174457600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6000806000606084860312156200177c57600080fd5b833562001789816200163a565b925060208401356200179b816200163a565b929592945050506040919091013590565b60008060008060808587031215620017c357600080fd5b8435620017d0816200163a565b93506020850135620017e2816200163a565b92506040850135620017f4816200163a565b9150606085013562001806816200163a565b939692955090935050565b6000602082840312156200182457600080fd5b5051919050565b60208082526032908201527f4e6f7420617574686f72697a65643a204f6e6c7920657363726f772063616e2060408201527131b0b636103a3434b990333ab731ba34b7b760711b606082015260800190565b6020808252600f908201526e496e76616c6964206164647265737360881b604082015260600190565b600060208284031215620018b957600080fd5b815180151581146200167057600080fd5b60005b83811015620018e7578181015183820152602001620018cd565b50506000910152565b600081518084526200190a816020860160208601620018ca565b601f01601f19169290920160200192915050565b60018060a01b0384168152826020820152606060408201526000620019476060830184620018f0565b95945050505050565b6000602082840312156200196357600080fd5b815162001670816200163a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251620019cf818460208701620018ca565b9190910192915050565b602081526000620016706020830184620018f056fe60806040526040516106cc3803806106cc83398101604081905261002291610420565b61002e82826000610035565b505061054a565b61003e836100f6565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100f1576100ef836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e991906104e0565b8361027a565b505b505050565b6001600160a01b0381163b6101605760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101d4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c591906104e0565b6001600160a01b03163b151590565b6102395760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610157565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392909216919091179055565b606061029f83836040518060600160405280602781526020016106a5602791396102a6565b9392505050565b6060600080856001600160a01b0316856040516102c391906104fb565b600060405180830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b5090925090506103158683838761031f565b9695505050505050565b6060831561038e578251600003610387576001600160a01b0385163b6103875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610157565b5081610398565b61039883836103a0565b949350505050565b8151156103b05781518083602001fd5b8060405162461bcd60e51b81526004016101579190610517565b80516001600160a01b03811681146103e157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156104175781810151838201526020016103ff565b50506000910152565b6000806040838503121561043357600080fd5b61043c836103ca565b60208401519092506001600160401b038082111561045957600080fd5b818501915085601f83011261046d57600080fd5b81518181111561047f5761047f6103e6565b604051601f8201601f19908116603f011681019083821181831017156104a7576104a76103e6565b816040528281528860208487010111156104c057600080fd5b6104d18360208301602088016103fc565b80955050505050509250929050565b6000602082840312156104f257600080fd5b61029f826103ca565b6000825161050d8184602087016103fc565b9190910192915050565b60208152600082518060208401526105368160408501602087016103fc565b601f01601f19169190910160400192915050565b61014c806105596000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b6100c2565b565b600061005c7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bd91906100e6565b905090565b3660008037600080366000845af43d6000803e8080156100e1573d6000f35b3d6000fd5b6000602082840312156100f857600080fd5b81516001600160a01b038116811461010f57600080fd5b939250505056fea26469706673582212200fdbd93def38e5cbcee033f760da77fe3d36b8bf06a75256372b980f4ae5bd5064736f6c63430008160033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506040516104be3803806104be83398101604081905261002f9161013a565b61003833610047565b61004181610097565b5061016a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381163b6101185760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000606482015260840160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561014c57600080fd5b81516001600160a01b038116811461016357600080fd5b9392505050565b610345806101796000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a3660046102df565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f61010e565b6000546001600160a01b031661007e565b61006f6100c13660046102df565b610122565b6100ce6101a0565b6100d7816101fa565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6101166101a0565b610120600061028f565b565b61012a6101a0565b6001600160a01b0381166101945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61019d8161028f565b50565b6000546001600160a01b031633146101205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018b565b6001600160a01b0381163b61026d5760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f6044820152721b881a5cc81b9bdd08184818dbdb9d1c9858dd606a1b606482015260840161018b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102f157600080fd5b81356001600160a01b038116811461030857600080fd5b939250505056fea264697066735822122061aafe9c0974224ae4f98e82cd84eb5427d380f755f81ef0957872ad1c509caf64736f6c63430008160033a2646970667358221220a4ecceefd2f10c7205105791c80f873ce0775dd7c8fd219175fd7aa9768aae8164736f6c63430008160033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620001755760003560e01c8063c10c354611620000d3578063ee3fd2231162000086578063ee3fd223146200030a578063ee99205c1462000321578063f2cdf2261462000335578063f2fde38b1462000349578063f7c618c11462000360578063f8c8765e146200036a57600080fd5b8063c10c35461462000295578063d9caed1214620002ac578063e2fdcc1714620002c3578063e30c397814620002d7578063e31d753114620002e9578063ebe2b12b146200030057600080fd5b806372f702f3116200012c57806372f702f314620001ff57806379ba5097146200022c5780637b0a47ee14620002365780638da5cb5b14620002405780639dd373b91462000252578063ae919173146200026957600080fd5b806318160ddd146200017a5780631e83409a14620001975780631e9b12ef14620001b05780633e12170f14620001c757806370a0823114620001de578063715018a614620001f5575b600080fd5b6200018462000381565b6040519081526020015b60405180910390f35b620001ae620001a836600462001650565b620003f7565b005b620001ae620001c136600462001650565b620004dc565b620001ae620001d83660046200168d565b62000559565b62000184620001ef36600462001650565b620007e2565b620001ae6200085a565b60985462000213906001600160a01b031681565b6040516001600160a01b0390911681526020016200018e565b620001ae62000872565b62000184620008f0565b6033546001600160a01b031662000213565b620001ae6200026336600462001650565b6200093b565b620002136200027a36600462001650565b609b602052600090815260409020546001600160a01b031681565b620001ae620002a636600462001650565b620009b8565b620001ae620002bd36600462001766565b62000a35565b60975462000213906001600160a01b031681565b6065546001600160a01b031662000213565b620001ae620002fa36600462001766565b62000b21565b6200018462000e0c565b620001ae6200031b36600462001650565b62000e57565b60995462000213906001600160a01b031681565b609a5462000213906001600160a01b031681565b620001ae6200035a36600462001650565b62000ed4565b6200021362000f48565b620001ae6200037b366004620017ac565b62000fb9565b609954604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001811565b905090565b6097546001600160a01b031633146200042d5760405162461bcd60e51b815260040162000424906200182b565b60405180910390fd5b6001600160a01b038181166000818152609b602052604090819020549051630f41a04d60e11b81526004810192909252909116908190631e83409a90602401600060405180830381600087803b1580156200048757600080fd5b505af11580156200049c573d6000803e3d6000fd5b50506040516001600160a01b038085169350851691507f89309c9b2aeaffbdce717113df9427298b20448c05919bf889e05f8c3094254b90600090a35050565b620004e662001209565b6001600160a01b0381166200050f5760405162461bcd60e51b815260040162000424906200187d565b609880546001600160a01b0319166001600160a01b0383169081179091556040517f9904a32444ae0eb0bae2045baf588aa248f03f4fef600c18afd1d7e751614af890600090a250565b6097546001600160a01b03163314620005865760405162461bcd60e51b815260040162000424906200182b565b609854620005a0906001600160a01b031633308562001265565b6001600160a01b038084166000908152609b60205260409020541680620006ad57609a546040516000916001600160a01b031690620005df906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f0801580156200061b573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b1580156200066457600080fd5b505af115801562000679573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60985460405163095ea7b360e01b81526001600160a01b038381166004830152602482018690529091169063095ea7b3906044016020604051808303816000875af115801562000701573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007279190620018a6565b50604051633e12170f60e01b81526001600160a01b03821690633e12170f906200075a908790879087906004016200191e565b600060405180830381600087803b1580156200077557600080fd5b505af11580156200078a573d6000803e3d6000fd5b50505050806001600160a01b0316846001600160a01b03167f9f9e4044c5742cca66ca090b21552bac14645e68bad7a92364a9d9ff18111a1c85604051620007d491815260200190565b60405180910390a350505050565b6099546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa1580156200082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000854919062001811565b92915050565b6200086462001209565b620008706000620012c7565b565b60655433906001600160a01b03168114620008e25760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840162000424565b620008ed81620012c7565b50565b60995460408051633d8523f760e11b815290516000926001600160a01b031691637b0a47ee9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b6200094562001209565b6001600160a01b0381166200096e5760405162461bcd60e51b815260040162000424906200187d565b609980546001600160a01b0319166001600160a01b0383169081179091556040517f1253844b0fff3da7dd2829de816c9b4f94c238cf2bf6eb72c02c7d6f2b53beac90600090a250565b620009c262001209565b6001600160a01b038116620009eb5760405162461bcd60e51b815260040162000424906200187d565b609780546001600160a01b0319166001600160a01b0383169081179091556040517fa585aec3a6cb0e1a084ed18c7638024e40cc3e3ea815166e2cb6fc17d7f1392b90600090a250565b6097546001600160a01b0316331462000a625760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038381166000908152609b60205260409081902054905163f3fef3a360e01b8152848316600482015260248101849052911690819063f3fef3a390604401600060405180830381600087803b15801562000ac257600080fd5b505af115801562000ad7573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb84604051620007d491815260200190565b6097546001600160a01b0316331462000b4e5760405162461bcd60e51b815260040162000424906200182b565b6001600160a01b038084166000908152609b602052604080822054858416835291205490821691168062000c6857609a546040516000916001600160a01b03169062000b9a906200161e565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f08015801562000bd6573d6000803e3d6000fd5b5060405163189acdbd60e31b81523060048201529092508291506001600160a01b0382169063c4d66de890602401600060405180830381600087803b15801562000c1f57600080fd5b505af115801562000c34573d6000803e3d6000fd5b505050506001600160a01b038581166000908152609b6020526040902080546001600160a01b031916918416919091179055505b60405163f3fef3a360e01b8152306004820152602481018490526001600160a01b0383169063f3fef3a390604401600060405180830381600087803b15801562000cb157600080fd5b505af115801562000cc6573d6000803e3d6000fd5b505060985460405163095ea7b360e01b81526001600160a01b03858116600483015260248201889052909116925063095ea7b391506044016020604051808303816000875af115801562000d1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d449190620018a6565b50604051633e12170f60e01b81526001600160a01b038581166004830152602482018590526060604483015260006064830152821690633e12170f90608401600060405180830381600087803b15801562000d9e57600080fd5b505af115801562000db3573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b03167fdd0cdc1bea06c790fb371c8acc5b948f282e5872429ce2bc5971f5b5c6d76b6c8560405162000dfd91815260200190565b60405180910390a35050505050565b6099546040805163ebe2b12b60e01b815290516000926001600160a01b03169163ebe2b12b9160048083019260209291908290030181865afa158015620003cc573d6000803e3d6000fd5b62000e6162001209565b6001600160a01b03811662000e8a5760405162461bcd60e51b815260040162000424906200187d565b609a80546001600160a01b0319166001600160a01b0383169081179091556040517fa922f30fc35aecb996d111c48db797fadceb5a048e693f841e0c4f339bb0326490600090a250565b62000ede62001209565b606580546001600160a01b0383166001600160a01b0319909116811790915562000f106033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6099546040805163f7c618c160e01b815290516000926001600160a01b03169163f7c618c19160048083019260209291908290030181865afa15801562000f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f2919062001950565b600054610100900460ff161580801562000fda5750600054600160ff909116105b8062000ff65750303b15801562000ff6575060005460ff166001145b6200105b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840162000424565b6000805460ff1916600117905580156200107f576000805461ff0019166101001790555b62001089620012e2565b609780546001600160a01b038088166001600160a01b0319928316179092556098805487841690831617905560998054928616929091169190911790556040518290620010d6906200162c565b6001600160a01b039091168152602001604051809103906000f08015801562001103573d6000803e3d6000fd5b50609a80546001600160a01b0319166001600160a01b0392909216918217905560405163f2fde38b60e01b815233600482015263f2fde38b90602401600060405180830381600087803b1580156200115a57600080fd5b505af11580156200116f573d6000803e3d6000fd5b50506040516001600160a01b038581168252808716935087811692508816907f3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f9060200160405180910390a4801562001202576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6033546001600160a01b03163314620008705760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000424565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052620012c190859062001316565b50505050565b606580546001600160a01b0319169055620008ed81620013f4565b600054610100900460ff166200130c5760405162461bcd60e51b8152600401620004249062001970565b6200087062001446565b60006200136d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200147b9092919063ffffffff16565b805190915015620013ef57808060200190518101906200138e9190620018a6565b620013ef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000424565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620014705760405162461bcd60e51b8152600401620004249062001970565b6200087033620012c7565b60606200148c848460008562001494565b949350505050565b606082471015620014f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000424565b600080866001600160a01b03168587604051620015159190620019bb565b60006040518083038185875af1925050503d806000811462001554576040519150601f19603f3d011682016040523d82523d6000602084013e62001559565b606091505b50915091506200156c8783838762001577565b979650505050505050565b60608315620015eb578251600003620015e3576001600160a01b0385163b620015e35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000424565b50816200148c565b6200148c8383815115620016025781518083602001fd5b8060405162461bcd60e51b8152600401620004249190620019d9565b6106cc80620019ef83390190565b6104be80620020bb83390190565b6001600160a01b0381168114620008ed57600080fd5b6000602082840312156200166357600080fd5b813562001670816200163a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620016a357600080fd5b8335620016b0816200163a565b925060208401359150604084013567ffffffffffffffff80821115620016d557600080fd5b818601915086601f830112620016ea57600080fd5b813581811115620016ff57620016ff62001677565b604051601f8201601f19908116603f011681019083821181831017156200172a576200172a62001677565b816040528281528960208487010111156200174457600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6000806000606084860312156200177c57600080fd5b833562001789816200163a565b925060208401356200179b816200163a565b929592945050506040919091013590565b60008060008060808587031215620017c357600080fd5b8435620017d0816200163a565b93506020850135620017e2816200163a565b92506040850135620017f4816200163a565b9150606085013562001806816200163a565b939692955090935050565b6000602082840312156200182457600080fd5b5051919050565b60208082526032908201527f4e6f7420617574686f72697a65643a204f6e6c7920657363726f772063616e2060408201527131b0b636103a3434b990333ab731ba34b7b760711b606082015260800190565b6020808252600f908201526e496e76616c6964206164647265737360881b604082015260600190565b600060208284031215620018b957600080fd5b815180151581146200167057600080fd5b60005b83811015620018e7578181015183820152602001620018cd565b50506000910152565b600081518084526200190a816020860160208601620018ca565b601f01601f19169290920160200192915050565b60018060a01b0384168152826020820152606060408201526000620019476060830184620018f0565b95945050505050565b6000602082840312156200196357600080fd5b815162001670816200163a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251620019cf818460208701620018ca565b9190910192915050565b602081526000620016706020830184620018f056fe60806040526040516106cc3803806106cc83398101604081905261002291610420565b61002e82826000610035565b505061054a565b61003e836100f6565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100f1576100ef836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e991906104e0565b8361027a565b505b505050565b6001600160a01b0381163b6101605760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101d4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c591906104e0565b6001600160a01b03163b151590565b6102395760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610157565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392909216919091179055565b606061029f83836040518060600160405280602781526020016106a5602791396102a6565b9392505050565b6060600080856001600160a01b0316856040516102c391906104fb565b600060405180830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b5090925090506103158683838761031f565b9695505050505050565b6060831561038e578251600003610387576001600160a01b0385163b6103875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610157565b5081610398565b61039883836103a0565b949350505050565b8151156103b05781518083602001fd5b8060405162461bcd60e51b81526004016101579190610517565b80516001600160a01b03811681146103e157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156104175781810151838201526020016103ff565b50506000910152565b6000806040838503121561043357600080fd5b61043c836103ca565b60208401519092506001600160401b038082111561045957600080fd5b818501915085601f83011261046d57600080fd5b81518181111561047f5761047f6103e6565b604051601f8201601f19908116603f011681019083821181831017156104a7576104a76103e6565b816040528281528860208487010111156104c057600080fd5b6104d18360208301602088016103fc565b80955050505050509250929050565b6000602082840312156104f257600080fd5b61029f826103ca565b6000825161050d8184602087016103fc565b9190910192915050565b60208152600082518060208401526105368160408501602087016103fc565b601f01601f19169190910160400192915050565b61014c806105596000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b6100c2565b565b600061005c7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bd91906100e6565b905090565b3660008037600080366000845af43d6000803e8080156100e1573d6000f35b3d6000fd5b6000602082840312156100f857600080fd5b81516001600160a01b038116811461010f57600080fd5b939250505056fea26469706673582212200fdbd93def38e5cbcee033f760da77fe3d36b8bf06a75256372b980f4ae5bd5064736f6c63430008160033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506040516104be3803806104be83398101604081905261002f9161013a565b61003833610047565b61004181610097565b5061016a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381163b6101185760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000606482015260840160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561014c57600080fd5b81516001600160a01b038116811461016357600080fd5b9392505050565b610345806101796000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a3660046102df565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f61010e565b6000546001600160a01b031661007e565b61006f6100c13660046102df565b610122565b6100ce6101a0565b6100d7816101fa565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6101166101a0565b610120600061028f565b565b61012a6101a0565b6001600160a01b0381166101945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61019d8161028f565b50565b6000546001600160a01b031633146101205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018b565b6001600160a01b0381163b61026d5760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f6044820152721b881a5cc81b9bdd08184818dbdb9d1c9858dd606a1b606482015260840161018b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102f157600080fd5b81356001600160a01b038116811461030857600080fd5b939250505056fea264697066735822122061aafe9c0974224ae4f98e82cd84eb5427d380f755f81ef0957872ad1c509caf64736f6c63430008160033a2646970667358221220a4ecceefd2f10c7205105791c80f873ce0775dd7c8fd219175fd7aa9768aae8164736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley (https://github.com/jourdanDunkley)", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "balanceOf(address)": { + "params": { + "account": "The address to query the balance of." + }, + "returns": { + "_0": "The balance as a uint256." + } + }, + "claim(address)": { + "params": { + "_from": "The address for which to claim rewards." + } + }, + "initialize(address,address,address,address)": { + "details": "This function can only be called once due to the initializer modifier", + "params": { + "_escrow": "The address of the escrow responsible for staking operations", + "_stakingContract": "The address of the contract handling staking", + "_stakingToken": "The address of the token to be staked", + "_stakingWalletImplementation": "The address of the staking wallet implementation" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "periodFinish()": { + "returns": { + "_0": "The period finish time as a uint256." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "rewardRate()": { + "returns": { + "_0": "The reward rate as a uint256." + } + }, + "rewardToken()": { + "returns": { + "_0": "The address of the reward token." + } + }, + "setEscrow(address)": { + "params": { + "_escrow": "The address of the new escrow." + } + }, + "setStakingContract(address)": { + "params": { + "_stakingContract": "The address of the new staking contract." + } + }, + "setStakingToken(address)": { + "params": { + "_stakingToken": "The address of the new staking token." + } + }, + "setUpgradeableBeacon(address)": { + "params": { + "_beacon": "The address of the new beacon contract." + } + }, + "stake(address,uint256,bytes)": { + "params": { + "_amount": "The amount of tokens to stake.", + "_data": "Additional data that might be needed for staking.", + "_from": "The address from which tokens will be staked." + } + }, + "totalSupply()": { + "returns": { + "_0": "The total supply as a uint256." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "transferStakingWallet(address,address,uint256)": { + "params": { + "from": "The current owner of the staking wallet.", + "to": "The new owner of the staking wallet." + } + }, + "withdraw(address,address,uint256)": { + "params": { + "_amount": "The amount of tokens to withdraw.", + "_owner": "The address from which tokens will be withdrawn." + } + } + }, + "title": "VeloAeroStakingStrategy", + "version": 1 + }, + "userdoc": { + "events": { + "Claimed(address,address)": { + "notice": "Emitted when rewards are claimed" + }, + "EscrowSet(address)": { + "notice": "Emitted when escrow is set" + }, + "Initialized(address,address,address,address)": { + "notice": "Emitted when the contract is initialized" + }, + "Staked(address,uint256,address)": { + "notice": "Emitted when tokens are staked" + }, + "StakingContractSet(address)": { + "notice": "Emitted when staking contract is set" + }, + "StakingTokenSet(address)": { + "notice": "Emitted when staking token is set" + }, + "StakingWalletTransferred(address,address,uint256)": { + "notice": "Emitted when staking wallet is transferred" + }, + "UpgradeableBeaconSet(address)": { + "notice": "Emitted when upgradeable beacon is set" + }, + "Withdrawn(address,address,uint256)": { + "notice": "Emitted when tokens are withdrawn" + } + }, + "kind": "user", + "methods": { + "balanceOf(address)": { + "notice": "Returns the balance of a specific address." + }, + "claim(address)": { + "notice": "Claims rewards for a given address." + }, + "escrow()": { + "notice": "Address of the escrow responsible for managing staking operations" + }, + "initialize(address,address,address,address)": { + "notice": "Initializes the staking strategy contract with necessary parameters" + }, + "periodFinish()": { + "notice": "Returns the period finish time for the staking strategy." + }, + "rewardRate()": { + "notice": "Returns the current reward rate for the staking strategy." + }, + "rewardToken()": { + "notice": "Returns the address of the reward token for the staking strategy." + }, + "setEscrow(address)": { + "notice": "Sets the escrow address." + }, + "setStakingContract(address)": { + "notice": "Sets the staking contract address." + }, + "setStakingToken(address)": { + "notice": "Sets the staking token address." + }, + "setUpgradeableBeacon(address)": { + "notice": "Sets the address of the beacon." + }, + "stake(address,uint256,bytes)": { + "notice": "Stakes a specified amount of tokens from a given address." + }, + "stakingContract()": { + "notice": "Address of the contract where staking operations are executed" + }, + "stakingToken()": { + "notice": "Address of the token being staked" + }, + "totalSupply()": { + "notice": "Returns the total supply of staked tokens." + }, + "transferStakingWallet(address,address,uint256)": { + "notice": "Transfers the staking wallet from one user to another." + }, + "userStakingWallet(address)": { + "notice": "Mapping of user addresses to their respective staking wallet addresses" + }, + "veloAeroBeacon()": { + "notice": "Address of beacon contract that manages wallet proxies" + }, + "withdraw(address,address,uint256)": { + "notice": "Withdraws a specified amount of tokens for a given address." + } + }, + "notice": "Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6909, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2967, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3087, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 2876, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 2955, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 109566, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "escrow", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 109569, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "stakingToken", + "offset": 0, + "slot": "152", + "type": "t_address" + }, + { + "astId": 109572, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "stakingContract", + "offset": 0, + "slot": "153", + "type": "t_address" + }, + { + "astId": 109576, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "veloAeroBeacon", + "offset": 0, + "slot": "154", + "type": "t_contract(UpgradeableBeacon)8851" + }, + { + "astId": 109581, + "contract": "contracts/veION/stake/velo/VeloAeroStakingStrategy.sol:VeloAeroStakingStrategy", + "label": "userStakingWallet", + "offset": 0, + "slot": "155", + "type": "t_mapping(t_address,t_address)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(UpgradeableBeacon)8851": { + "encoding": "inplace", + "label": "contract UpgradeableBeacon", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a_Proxy.json b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a_Proxy.json new file mode 100644 index 0000000000..e546d34404 --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingStrategy_0xC6A394952c097004F83d2dfB61715d245A38735a_Proxy.json @@ -0,0 +1,304 @@ +{ + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "transactionIndex": 1, + "gasUsed": "1117195", + "logsBloom": "0x04000000000000000000000000000000400000000000000120800000000000800000000040000000004020000800800000000000000000400000000000000000000000000000000000000000000002000001000000000000000000000000000400000000020000000000000800020800000000800000000000000000000000440000000000010000000000000000000000000000000080000000000000800000000000000000000100000000010400000000000000000080000008004000000000000021000000002000000000040000001000000400000004000002000020000000000000000000000000000000000000000000000000000080020000000000", + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb", + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000e64c8ea3e0541bf5157e711171e3ca6a3727d87a" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x0007731b29f44eeb2a0B1718E7A26F74E01013e1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000012f4e2e2f81048faddf2f8e193fddc3eb9d1ecb4" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x0007731b29f44eeb2a0B1718E7A26F74E01013e1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x00000000000000000000000012f4e2e2f81048faddf2f8e193fddc3eb9d1ecb4", + "0x0000000000000000000000007d922bf0975424b3371074f54cc784af738dac0d" + ], + "data": "0x", + "logIndex": 3, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x3514319b7a526ad5f1f42edf0c1df25fa0ea2ae054779987fbe636f164515e2f", + "0x0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8", + "0x000000000000000000000000c6a394952c097004f83d2dfb61715d245a38735a", + "0x0000000000000000000000003f385fedd141f57323dd91aa735c7243382831d8" + ], + "data": "0x000000000000000000000000bb226852e6c3023614acfb7a42d22687acf96769", + "logIndex": 4, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 5, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + }, + { + "transactionIndex": 1, + "blockNumber": 19228339, + "transactionHash": "0x76dc646b1e673a436fdc91dd8e523d8550349cf3361dd2ff967551fd35b6d8ab", + "address": "0x12F4E2E2F81048faddf2F8e193fDdC3eB9d1ECb4", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031504094cd6ec0cea87884d0dab439afe3ed93bf", + "logIndex": 6, + "blockHash": "0xc425a8f254b40ad8093dd9ab0cc1533fe73eeb6357d68d8dfa089e1e76b8dfbb" + } + ], + "blockNumber": 19228339, + "cumulativeGasUsed": "1161082", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE64C8ea3E0541Bf5157E711171e3ca6a3727d87a", + "0x31504094CD6Ec0cEa87884D0dAb439afE3ed93BF", + "0xf8c8765e0000000000000000000000002abd9eb57fb7727138f4181b68da0426b7fd47e8000000000000000000000000c6a394952c097004f83d2dfb61715d245a38735a0000000000000000000000003f385fedd141f57323dd91aa735c7243382831d8000000000000000000000000bb226852e6c3023614acfb7a42d22687acf96769" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingWallet_0x690A74d2eC0175a69C0962B309E03021C0b5002E.json b/packages/contracts/deployments/mode/VeloAeroStakingWallet_0x690A74d2eC0175a69C0962B309E03021C0b5002E.json new file mode 100644 index 0000000000..21b9d351fa --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingWallet_0x690A74d2eC0175a69C0962B309E03021C0b5002E.json @@ -0,0 +1,296 @@ +{ + "address": "0xEEFBcD99d5Bff6FBd3AB8Bce659d31B2b9443a3f", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardAmount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawTo", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IStakeStrategy", + "name": "_stakeStrategy", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakeStrategy", + "outputs": [ + { + "internalType": "contract IStakeStrategy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_withdrawTo", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x911327792eb88af0409750166a1319206b3e80097ea3eb1d7dc2b2e6d5055277", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xEEFBcD99d5Bff6FBd3AB8Bce659d31B2b9443a3f", + "transactionIndex": 1, + "gasUsed": "861154", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000200000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf88a33d56dc9455eeeb427feb63bed1264847ac5918e0c4596d0cead55fd1bef", + "transactionHash": "0x911327792eb88af0409750166a1319206b3e80097ea3eb1d7dc2b2e6d5055277", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 19228351, + "transactionHash": "0x911327792eb88af0409750166a1319206b3e80097ea3eb1d7dc2b2e6d5055277", + "address": "0xEEFBcD99d5Bff6FBd3AB8Bce659d31B2b9443a3f", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 0, + "blockHash": "0xf88a33d56dc9455eeeb427feb63bed1264847ac5918e0c4596d0cead55fd1bef" + } + ], + "blockNumber": 19228351, + "cumulativeGasUsed": "905041", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"withdrawTo\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IStakeStrategy\",\"name\":\"_stakeStrategy\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakeStrategy\",\"outputs\":[{\"internalType\":\"contract IStakeStrategy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_withdrawTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley \",\"details\":\"This contract allows staking and claiming rewards with a specific staking strategy.The staking strategy is set during contract deployment and can only be called by the strategy.The contract is designed to be used with the Velodrome/Aerodrome style LP.\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"initialize(address)\":{\"details\":\"Can only be called once due to initializer modifier\",\"params\":{\"_stakeStrategy\":\"The address of the staking strategy contract\"}},\"stake(address,uint256,bytes)\":{\"params\":{\"amount\":\"The amount of tokens to stake.\",\"data\":\"Additional data required for the staking strategy.\"}},\"withdraw(address,uint256)\":{\"params\":{\"amount\":\"The amount of tokens to withdraw.\",\"withdrawTo\":\"The address to withdraw tokens to.\"}}},\"title\":\"VeloAeroStakingWallet\",\"version\":1},\"userdoc\":{\"events\":{\"Claimed(address,uint256)\":{\"notice\":\"Emitted when rewards are claimed\"},\"Staked(uint256)\":{\"notice\":\"Emitted when tokens are staked\"},\"Withdrawn(address,uint256)\":{\"notice\":\"Emitted when tokens are withdrawn\"}},\"kind\":\"user\",\"methods\":{\"claim(address)\":{\"notice\":\"Claims rewards for the caller.\"},\"initialize(address)\":{\"notice\":\"Initializes the contract with a staking strategy\"},\"stake(address,uint256,bytes)\":{\"notice\":\"Stakes a specified amount of tokens according to the strategy.\"},\"withdraw(address,uint256)\":{\"notice\":\"Withdraws a specified amount of staked tokens.\"}},\"notice\":\"Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/stake/velo/VeloAeroStakingWallet.sol\":\"VeloAeroStakingWallet\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xffeed6b3cac845b2af4afb30d87cecbd45dec3c408360c157a3db08e28b45043\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20PermitUpgradeable {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xa4ef4473f068f5f97b73e442f554e4464a581c2200c23181287b4c8eee5de777\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20Upgradeable.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20PermitUpgradeable.sol\\\";\\r\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20Upgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20Upgradeable token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20Upgradeable token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20PermitUpgradeable token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5735e7a8ab4d99d6cbef359228e76c7c2057f13f9a22d014458951409ea30f7c\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"contracts/veION/stake/IStakeStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IStakeStrategy\\r\\n * @notice Interface for the VeloIonModeStakingModeReward contract.\\r\\n */\\r\\ninterface IStakeStrategy {\\r\\n /// @notice Emitted when the contract is initialized\\r\\n event Initialized(\\r\\n address indexed escrow,\\r\\n address indexed stakingToken,\\r\\n address indexed stakingContract,\\r\\n address stakingWalletImplementation\\r\\n );\\r\\n\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when staking wallet is transferred\\r\\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when escrow is set\\r\\n event EscrowSet(address indexed newEscrow);\\r\\n\\r\\n /// @notice Emitted when staking token is set\\r\\n event StakingTokenSet(address indexed newStakingToken);\\r\\n\\r\\n /// @notice Emitted when staking contract is set\\r\\n event StakingContractSet(address indexed newStakingContract);\\r\\n\\r\\n /// @notice Emitted when upgradeable beacon is set\\r\\n event UpgradeableBeaconSet(address indexed newBeacon);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens from a given address.\\r\\n * @param _from The address from which tokens will be staked.\\r\\n * @param _amount The amount of tokens to stake.\\r\\n * @param _data Additional data that might be needed for staking.\\r\\n */\\r\\n function stake(address _from, uint256 _amount, bytes memory _data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for a given address.\\r\\n * @param _from The address for which to claim rewards.\\r\\n */\\r\\n function claim(address _from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of tokens for a given address.\\r\\n * @param _owner The address from which tokens will be withdrawn.\\r\\n * @param _amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Returns the current reward rate for the staking strategy.\\r\\n * @return The reward rate as a uint256.\\r\\n */\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the period finish time for the staking strategy.\\r\\n * @return The period finish time as a uint256.\\r\\n */\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the balance of a specific address.\\r\\n * @param account The address to query the balance of.\\r\\n * @return The balance as a uint256.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the total supply of staked tokens.\\r\\n * @return The total supply as a uint256.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the reward token for the staking strategy.\\r\\n * @return The address of the reward token.\\r\\n */\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking contract.\\r\\n * @return The address of the staking contract.\\r\\n */\\r\\n function stakingContract() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking token.\\r\\n * @return The address of the staking token.\\r\\n */\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the staking wallet address for a specific user.\\r\\n * @param user The address of the user.\\r\\n * @return The address of the user's staking wallet.\\r\\n */\\r\\n function userStakingWallet(address user) external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Transfers the staking wallet from one user to another.\\r\\n * @param from The current owner of the staking wallet.\\r\\n * @param to The new owner of the staking wallet.\\r\\n */\\r\\n function transferStakingWallet(address from, address to, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the escrow address.\\r\\n * @param _escrow The address of the new escrow.\\r\\n */\\r\\n function setEscrow(address _escrow) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking token address.\\r\\n * @param _stakingToken The address of the new staking token.\\r\\n */\\r\\n function setStakingToken(address _stakingToken) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking contract address.\\r\\n * @param _stakingContract The address of the new staking contract.\\r\\n */\\r\\n function setStakingContract(address _stakingContract) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the beacon.\\r\\n * @param _beacon The address of the new beacon contract.\\r\\n */\\r\\n function setUpgradeableBeacon(address _beacon) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x69d7a60ae3df2ead3b3afaa32ae9b6ea4df13ef65c7c375babe7be2e5457fc8b\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/IStakeWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IStakeWallet {\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(uint256 amount);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, uint256 rewardAmount);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens according to the strategy.\\r\\n * @param amount The amount of tokens to stake.\\r\\n * @param data Additional data required for the staking strategy.\\r\\n */\\r\\n function stake(address from, uint256 amount, bytes memory data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for the caller.\\r\\n */\\r\\n function claim(address from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of staked tokens.\\r\\n * @param withdrawTo The address to withdraw tokens to.\\r\\n * @param amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address withdrawTo, uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa1145156b33d804afb421beb12e8c1fc19416e9d1d4b815d7b698fd97564ef42\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/IVeloIonModeStaking.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IVeloIonModeStaking {\\r\\n event Deposit(address indexed from, address indexed to, uint256 amount);\\r\\n event Withdraw(address indexed from, uint256 amount);\\r\\n event NotifyReward(address indexed from, uint256 amount);\\r\\n event ClaimFees(uint256 claimed0, uint256 claimed1);\\r\\n event ClaimRewards(address indexed from, uint256 amount);\\r\\n\\r\\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the token (VELO v2) rewarded to stakers\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the Converter contract linked to the gauge\\r\\n function feeConverter() external view returns (address);\\r\\n\\r\\n /// @notice Address of the staking rewards factory that created this gauge\\r\\n function factory() external view returns (address);\\r\\n\\r\\n /// @notice Timestamp end of current rewards period\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /// @notice Current reward rate of rewardToken to distribute per second\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent timestamp contract has updated state\\r\\n function lastUpdateTime() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent stored value of rewardPerToken\\r\\n function rewardPerTokenStored() external view returns (uint256);\\r\\n\\r\\n /// @notice Amount of stakingToken deposited for rewards\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /// @notice Get the amount of stakingToken deposited by an account\\r\\n function balanceOf(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\\r\\n function userRewardPerTokenPaid(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached amount of rewardToken earned for an account\\r\\n function rewards(address) external view returns (uint256);\\r\\n\\r\\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\\r\\n function rewardRateByEpoch(uint256) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the current reward rate per unit of stakingToken deposited\\r\\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\\r\\n\\r\\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\\r\\n function lastTimeRewardApplicable() external view returns (uint256 _time);\\r\\n\\r\\n /// @notice Returns accrued balance to date from last claim / first deposit.\\r\\n function earned(address _account) external view returns (uint256 _earned);\\r\\n\\r\\n /// @notice Total amount of rewardToken to distribute for the current rewards period\\r\\n function left() external view returns (uint256 _left);\\r\\n\\r\\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\\r\\n /// @return _claimed0 Amount of Fees claimed in token0\\r\\n /// @return _claimed1 Amount of Fees claimed in token1\\r\\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\\r\\n\\r\\n /// @notice Retrieve rewards for an address.\\r\\n /// @dev Throws if not called by same address or voter.\\r\\n /// @param _account .\\r\\n function getReward(address _account) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for msg.sender\\r\\n /// @param _amount .\\r\\n function deposit(uint256 _amount) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for any user\\r\\n /// @param _amount .\\r\\n /// @param _recipient Recipient to give balance to\\r\\n function deposit(uint256 _amount, address _recipient) external;\\r\\n\\r\\n /// @notice Withdraw LP tokens for user\\r\\n /// @param _amount .\\r\\n function withdraw(uint256 _amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardMatch(uint256 amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardAmount(uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x23f5c8711c247d772dc1dd96417a335a99857bcd8e3dbe9a96d14ac8f5038262\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/VeloAeroStakingWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { IStakeWallet } from \\\"../IStakeWallet.sol\\\";\\r\\nimport { IStakeStrategy } from \\\"../IStakeStrategy.sol\\\";\\r\\nimport { IVeloIonModeStaking } from \\\"./IVeloIonModeStaking.sol\\\";\\r\\nimport { IERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\nimport { SafeERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\r\\nimport { Initializable } from \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title VeloAeroStakingWallet\\r\\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\\r\\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\\r\\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\\r\\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\\r\\n * @author Jourdan Dunkley \\r\\n */\\r\\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\\r\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\r\\n IStakeStrategy public stakeStrategy;\\r\\n\\r\\n /// @dev Modifier to restrict function access to only the stake strategy contract\\r\\n modifier onlyStakeStrategy() {\\r\\n require(msg.sender == address(stakeStrategy), \\\"Not authorized: Only stake strategy can call this function\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the contract with a staking strategy\\r\\n * @dev Can only be called once due to initializer modifier\\r\\n * @param _stakeStrategy The address of the staking strategy contract\\r\\n */\\r\\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\\r\\n stakeStrategy = _stakeStrategy;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\\r\\n stakingToken.approve(address(stakingContract), _amount);\\r\\n stakingContract.deposit(_amount);\\r\\n emit Staked(_amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function claim(address _from) external onlyStakeStrategy {\\r\\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.getReward(address(this));\\r\\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\\r\\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\\r\\n emit Claimed(_from, rewardAmount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.withdraw(_amount);\\r\\n stakingToken.safeTransfer(_withdrawTo, _amount);\\r\\n emit Withdrawn(_withdrawTo, _amount);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5d95949d0e7ba07afe3cfbe991cbf6ec8b8877d10181886ba8cdbf896e914ff7\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b610e23806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631e83409a1461005c5780633e12170f14610071578063766c737214610084578063c4d66de8146100b9578063f3fef3a3146100cc575b600080fd5b61006f61006a366004610b92565b6100df565b005b61006f61007f366004610bcc565b610330565b60005461009d906201000090046001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006f6100c7366004610b92565b610577565b61006f6100da366004610c99565b6106a3565b6000546201000090046001600160a01b031633146101185760405162461bcd60e51b815260040161010f90610cc5565b60405180910390fd5b60008060029054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561016c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101909190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020a9190610d22565b604051630c00007b60e41b81523060048201529091506001600160a01b0382169063c00007b090602401600060405180830381600087803b15801561024e57600080fd5b505af1158015610262573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03851691506370a0823190602401602060405180830381865afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190610d3f565b90506102e76001600160a01b0384168583610872565b836001600160a01b03167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161032291815260200190565b60405180910390a250505050565b6000546201000090046001600160a01b031633146103605760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d89190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561042e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104529190610d22565b90506104696001600160a01b0383163330876108da565b60405163095ea7b360e01b81526001600160a01b0382811660048301526024820186905283169063095ea7b3906044016020604051808303816000875af11580156104b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dc9190610d58565b5060405163b6b55f2560e01b8152600481018590526001600160a01b0382169063b6b55f2590602401600060405180830381600087803b15801561051f57600080fd5b505af1158015610533573d6000803e3d6000fd5b505050507feebbaa86c348cb664e392b180fd0ff2e1998af9fa833ef69a778cb0b42d3ca278460405161056891815260200190565b60405180910390a15050505050565b600054610100900460ff16158080156105975750600054600160ff909116105b806105b15750303b1580156105b1575060005460ff166001145b6106145760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161010f565b6000805460ff191660011790558015610637576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b03851602179055801561069f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6000546201000090046001600160a01b031633146106d35760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b9190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c59190610d22565b604051632e1a7d4d60e01b8152600481018590529091506001600160a01b03821690632e1a7d4d90602401600060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b50610837925050506001600160a01b0383168585610872565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58460405161032291815260200190565b6040516001600160a01b0383166024820152604481018290526108d590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610918565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526109129085906323b872dd60e01b9060840161089e565b50505050565b600061096d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109ea9092919063ffffffff16565b8051909150156108d5578080602001905181019061098b9190610d58565b6108d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161010f565b60606109f98484600085610a01565b949350505050565b606082471015610a625760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161010f565b600080866001600160a01b03168587604051610a7e9190610d9e565b60006040518083038185875af1925050503d8060008114610abb576040519150601f19603f3d011682016040523d82523d6000602084013e610ac0565b606091505b5091509150610ad187838387610adc565b979650505050505050565b60608315610b4b578251600003610b44576001600160a01b0385163b610b445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161010f565b50816109f9565b6109f98383815115610b605781518083602001fd5b8060405162461bcd60e51b815260040161010f9190610dba565b6001600160a01b0381168114610b8f57600080fd5b50565b600060208284031215610ba457600080fd5b8135610baf81610b7a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610be157600080fd5b8335610bec81610b7a565b925060208401359150604084013567ffffffffffffffff80821115610c1057600080fd5b818601915086601f830112610c2457600080fd5b813581811115610c3657610c36610bb6565b604051601f8201601f19908116603f01168101908382118183101715610c5e57610c5e610bb6565b81604052828152896020848701011115610c7757600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60008060408385031215610cac57600080fd5b8235610cb781610b7a565b946020939093013593505050565b6020808252603a908201527f4e6f7420617574686f72697a65643a204f6e6c79207374616b6520737472617460408201527f6567792063616e2063616c6c20746869732066756e6374696f6e000000000000606082015260800190565b600060208284031215610d3457600080fd5b8151610baf81610b7a565b600060208284031215610d5157600080fd5b5051919050565b600060208284031215610d6a57600080fd5b81518015158114610baf57600080fd5b60005b83811015610d95578181015183820152602001610d7d565b50506000910152565b60008251610db0818460208701610d7a565b9190910192915050565b6020815260008251806020840152610dd9816040850160208701610d7a565b601f01601f1916919091016040019291505056fea264697066735822122028b00a85895fd51bc12e2cec8a0377cef289ee51bad945abac89ef209d1366df64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631e83409a1461005c5780633e12170f14610071578063766c737214610084578063c4d66de8146100b9578063f3fef3a3146100cc575b600080fd5b61006f61006a366004610b92565b6100df565b005b61006f61007f366004610bcc565b610330565b60005461009d906201000090046001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006f6100c7366004610b92565b610577565b61006f6100da366004610c99565b6106a3565b6000546201000090046001600160a01b031633146101185760405162461bcd60e51b815260040161010f90610cc5565b60405180910390fd5b60008060029054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561016c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101909190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020a9190610d22565b604051630c00007b60e41b81523060048201529091506001600160a01b0382169063c00007b090602401600060405180830381600087803b15801561024e57600080fd5b505af1158015610262573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03851691506370a0823190602401602060405180830381865afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190610d3f565b90506102e76001600160a01b0384168583610872565b836001600160a01b03167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161032291815260200190565b60405180910390a250505050565b6000546201000090046001600160a01b031633146103605760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d89190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561042e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104529190610d22565b90506104696001600160a01b0383163330876108da565b60405163095ea7b360e01b81526001600160a01b0382811660048301526024820186905283169063095ea7b3906044016020604051808303816000875af11580156104b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dc9190610d58565b5060405163b6b55f2560e01b8152600481018590526001600160a01b0382169063b6b55f2590602401600060405180830381600087803b15801561051f57600080fd5b505af1158015610533573d6000803e3d6000fd5b505050507feebbaa86c348cb664e392b180fd0ff2e1998af9fa833ef69a778cb0b42d3ca278460405161056891815260200190565b60405180910390a15050505050565b600054610100900460ff16158080156105975750600054600160ff909116105b806105b15750303b1580156105b1575060005460ff166001145b6106145760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161010f565b6000805460ff191660011790558015610637576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b03851602179055801561069f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6000546201000090046001600160a01b031633146106d35760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b9190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c59190610d22565b604051632e1a7d4d60e01b8152600481018590529091506001600160a01b03821690632e1a7d4d90602401600060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b50610837925050506001600160a01b0383168585610872565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58460405161032291815260200190565b6040516001600160a01b0383166024820152604481018290526108d590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610918565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526109129085906323b872dd60e01b9060840161089e565b50505050565b600061096d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109ea9092919063ffffffff16565b8051909150156108d5578080602001905181019061098b9190610d58565b6108d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161010f565b60606109f98484600085610a01565b949350505050565b606082471015610a625760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161010f565b600080866001600160a01b03168587604051610a7e9190610d9e565b60006040518083038185875af1925050503d8060008114610abb576040519150601f19603f3d011682016040523d82523d6000602084013e610ac0565b606091505b5091509150610ad187838387610adc565b979650505050505050565b60608315610b4b578251600003610b44576001600160a01b0385163b610b445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161010f565b50816109f9565b6109f98383815115610b605781518083602001fd5b8060405162461bcd60e51b815260040161010f9190610dba565b6001600160a01b0381168114610b8f57600080fd5b50565b600060208284031215610ba457600080fd5b8135610baf81610b7a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610be157600080fd5b8335610bec81610b7a565b925060208401359150604084013567ffffffffffffffff80821115610c1057600080fd5b818601915086601f830112610c2457600080fd5b813581811115610c3657610c36610bb6565b604051601f8201601f19908116603f01168101908382118183101715610c5e57610c5e610bb6565b81604052828152896020848701011115610c7757600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60008060408385031215610cac57600080fd5b8235610cb781610b7a565b946020939093013593505050565b6020808252603a908201527f4e6f7420617574686f72697a65643a204f6e6c79207374616b6520737472617460408201527f6567792063616e2063616c6c20746869732066756e6374696f6e000000000000606082015260800190565b600060208284031215610d3457600080fd5b8151610baf81610b7a565b600060208284031215610d5157600080fd5b5051919050565b600060208284031215610d6a57600080fd5b81518015158114610baf57600080fd5b60005b83811015610d95578181015183820152602001610d7d565b50506000910152565b60008251610db0818460208701610d7a565b9190910192915050565b6020815260008251806020840152610dd9816040850160208701610d7a565b601f01601f1916919091016040019291505056fea264697066735822122028b00a85895fd51bc12e2cec8a0377cef289ee51bad945abac89ef209d1366df64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley ", + "details": "This contract allows staking and claiming rewards with a specific staking strategy.The staking strategy is set during contract deployment and can only be called by the strategy.The contract is designed to be used with the Velodrome/Aerodrome style LP.", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "initialize(address)": { + "details": "Can only be called once due to initializer modifier", + "params": { + "_stakeStrategy": "The address of the staking strategy contract" + } + }, + "stake(address,uint256,bytes)": { + "params": { + "amount": "The amount of tokens to stake.", + "data": "Additional data required for the staking strategy." + } + }, + "withdraw(address,uint256)": { + "params": { + "amount": "The amount of tokens to withdraw.", + "withdrawTo": "The address to withdraw tokens to." + } + } + }, + "title": "VeloAeroStakingWallet", + "version": 1 + }, + "userdoc": { + "events": { + "Claimed(address,uint256)": { + "notice": "Emitted when rewards are claimed" + }, + "Staked(uint256)": { + "notice": "Emitted when tokens are staked" + }, + "Withdrawn(address,uint256)": { + "notice": "Emitted when tokens are withdrawn" + } + }, + "kind": "user", + "methods": { + "claim(address)": { + "notice": "Claims rewards for the caller." + }, + "initialize(address)": { + "notice": "Initializes the contract with a staking strategy" + }, + "stake(address,uint256,bytes)": { + "notice": "Stakes a specified amount of tokens according to the strategy." + }, + "withdraw(address,uint256)": { + "notice": "Withdraws a specified amount of staked tokens." + } + }, + "notice": "Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/stake/velo/VeloAeroStakingWallet.sol:VeloAeroStakingWallet", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/stake/velo/VeloAeroStakingWallet.sol:VeloAeroStakingWallet", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 110139, + "contract": "contracts/veION/stake/velo/VeloAeroStakingWallet.sol:VeloAeroStakingWallet", + "label": "stakeStrategy", + "offset": 2, + "slot": "0", + "type": "t_contract(IStakeStrategy)109301" + } + ], + "types": { + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IStakeStrategy)109301": { + "encoding": "inplace", + "label": "contract IStakeStrategy", + "numberOfBytes": "20" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mode/VeloAeroStakingWallet_0xC6A394952c097004F83d2dfB61715d245A38735a.json b/packages/contracts/deployments/mode/VeloAeroStakingWallet_0xC6A394952c097004F83d2dfB61715d245A38735a.json new file mode 100644 index 0000000000..30c0328919 --- /dev/null +++ b/packages/contracts/deployments/mode/VeloAeroStakingWallet_0xC6A394952c097004F83d2dfB61715d245A38735a.json @@ -0,0 +1,296 @@ +{ + "address": "0xbB226852e6c3023614aCfb7a42d22687Acf96769", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardAmount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawTo", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IStakeStrategy", + "name": "_stakeStrategy", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakeStrategy", + "outputs": [ + { + "internalType": "contract IStakeStrategy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_withdrawTo", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xcdf1f471a09ba01f45b45b3c6de1ab81907c0440a30f230f747cb891d946a2f4", + "receipt": { + "to": null, + "from": "0x7d922bf0975424b3371074f54cC784AF738Dac0D", + "contractAddress": "0xbB226852e6c3023614aCfb7a42d22687Acf96769", + "transactionIndex": 1, + "gasUsed": "861154", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7d4cbf04380aa359ce5f5c2e296f40ad05f5c1b0fc99be2f0ed9e72b7a810b12", + "transactionHash": "0xcdf1f471a09ba01f45b45b3c6de1ab81907c0440a30f230f747cb891d946a2f4", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 19227715, + "transactionHash": "0xcdf1f471a09ba01f45b45b3c6de1ab81907c0440a30f230f747cb891d946a2f4", + "address": "0xbB226852e6c3023614aCfb7a42d22687Acf96769", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 0, + "blockHash": "0x7d4cbf04380aa359ce5f5c2e296f40ad05f5c1b0fc99be2f0ed9e72b7a810b12" + } + ], + "blockNumber": 19227715, + "cumulativeGasUsed": "916229", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0366741513880e85aaa5abbf67624948", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"withdrawTo\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IStakeStrategy\",\"name\":\"_stakeStrategy\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakeStrategy\",\"outputs\":[{\"internalType\":\"contract IStakeStrategy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_withdrawTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jourdan Dunkley \",\"details\":\"This contract allows staking and claiming rewards with a specific staking strategy.The staking strategy is set during contract deployment and can only be called by the strategy.The contract is designed to be used with the Velodrome/Aerodrome style LP.\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"initialize(address)\":{\"details\":\"Can only be called once due to initializer modifier\",\"params\":{\"_stakeStrategy\":\"The address of the staking strategy contract\"}},\"stake(address,uint256,bytes)\":{\"params\":{\"amount\":\"The amount of tokens to stake.\",\"data\":\"Additional data required for the staking strategy.\"}},\"withdraw(address,uint256)\":{\"params\":{\"amount\":\"The amount of tokens to withdraw.\",\"withdrawTo\":\"The address to withdraw tokens to.\"}}},\"title\":\"VeloAeroStakingWallet\",\"version\":1},\"userdoc\":{\"events\":{\"Claimed(address,uint256)\":{\"notice\":\"Emitted when rewards are claimed\"},\"Staked(uint256)\":{\"notice\":\"Emitted when tokens are staked\"},\"Withdrawn(address,uint256)\":{\"notice\":\"Emitted when tokens are withdrawn\"}},\"kind\":\"user\",\"methods\":{\"claim(address)\":{\"notice\":\"Claims rewards for the caller.\"},\"initialize(address)\":{\"notice\":\"Initializes the contract with a staking strategy\"},\"stake(address,uint256,bytes)\":{\"notice\":\"Stakes a specified amount of tokens according to the strategy.\"},\"withdraw(address,uint256)\":{\"notice\":\"Withdraws a specified amount of staked tokens.\"}},\"notice\":\"Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/veION/stake/velo/VeloAeroStakingWallet.sol\":\"VeloAeroStakingWallet\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\r\\n\\r\\npragma solidity ^0.8.2;\\r\\n\\r\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\r\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\r\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\r\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\r\\n *\\r\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\r\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\r\\n * case an upgrade adds a module that needs to be initialized.\\r\\n *\\r\\n * For example:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * contract MyToken is ERC20Upgradeable {\\r\\n * function initialize() initializer public {\\r\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\r\\n * }\\r\\n * }\\r\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\r\\n * function initializeV2() reinitializer(2) public {\\r\\n * __ERC20Permit_init(\\\"MyToken\\\");\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\r\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\r\\n *\\r\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\r\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\r\\n *\\r\\n * [CAUTION]\\r\\n * ====\\r\\n * Avoid leaving a contract uninitialized.\\r\\n *\\r\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\r\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\r\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\r\\n *\\r\\n * [.hljs-theme-light.nopadding]\\r\\n * ```\\r\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\r\\n * constructor() {\\r\\n * _disableInitializers();\\r\\n * }\\r\\n * ```\\r\\n * ====\\r\\n */\\r\\nabstract contract Initializable {\\r\\n /**\\r\\n * @dev Indicates that the contract has been initialized.\\r\\n * @custom:oz-retyped-from bool\\r\\n */\\r\\n uint8 private _initialized;\\r\\n\\r\\n /**\\r\\n * @dev Indicates that the contract is in the process of being initialized.\\r\\n */\\r\\n bool private _initializing;\\r\\n\\r\\n /**\\r\\n * @dev Triggered when the contract has been initialized or reinitialized.\\r\\n */\\r\\n event Initialized(uint8 version);\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\r\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\r\\n *\\r\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\r\\n * constructor.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier initializer() {\\r\\n bool isTopLevelCall = !_initializing;\\r\\n require(\\r\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\r\\n \\\"Initializable: contract is already initialized\\\"\\r\\n );\\r\\n _initialized = 1;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = true;\\r\\n }\\r\\n _;\\r\\n if (isTopLevelCall) {\\r\\n _initializing = false;\\r\\n emit Initialized(1);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\r\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\r\\n * used to initialize parent contracts.\\r\\n *\\r\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\r\\n * are added through upgrades and that require initialization.\\r\\n *\\r\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\r\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\r\\n *\\r\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\r\\n * a contract, executing them in the right order is up to the developer or operator.\\r\\n *\\r\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\r\\n *\\r\\n * Emits an {Initialized} event.\\r\\n */\\r\\n modifier reinitializer(uint8 version) {\\r\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\r\\n _initialized = version;\\r\\n _initializing = true;\\r\\n _;\\r\\n _initializing = false;\\r\\n emit Initialized(version);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\r\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\r\\n */\\r\\n modifier onlyInitializing() {\\r\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\r\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\r\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\r\\n * through proxies.\\r\\n *\\r\\n * Emits an {Initialized} event the first time it is successfully executed.\\r\\n */\\r\\n function _disableInitializers() internal virtual {\\r\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\r\\n if (_initialized < type(uint8).max) {\\r\\n _initialized = type(uint8).max;\\r\\n emit Initialized(type(uint8).max);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\r\\n */\\r\\n function _getInitializedVersion() internal view returns (uint8) {\\r\\n return _initialized;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\r\\n */\\r\\n function _isInitializing() internal view returns (bool) {\\r\\n return _initializing;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x4603e2f1403e437820665af135e9675c80e81aa005e360318b8e640ca2624658\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\r\\n */\\r\\ninterface IERC20Upgradeable {\\r\\n /**\\r\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\r\\n * another (`to`).\\r\\n *\\r\\n * Note that `value` may be zero.\\r\\n */\\r\\n event Transfer(address indexed from, address indexed to, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\r\\n * a call to {approve}. `value` is the new allowance.\\r\\n */\\r\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens in existence.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the amount of tokens owned by `account`.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transfer(address to, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Returns the remaining number of tokens that `spender` will be\\r\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\r\\n * zero by default.\\r\\n *\\r\\n * This value changes when {approve} or {transferFrom} are called.\\r\\n */\\r\\n function allowance(address owner, address spender) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\r\\n * that someone may use both the old and the new allowance by unfortunate\\r\\n * transaction ordering. One possible solution to mitigate this race\\r\\n * condition is to first reduce the spender's allowance to 0 and set the\\r\\n * desired value afterwards:\\r\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n */\\r\\n function approve(address spender, uint256 amount) external returns (bool);\\r\\n\\r\\n /**\\r\\n * @dev Moves `amount` tokens from `from` to `to` using the\\r\\n * allowance mechanism. `amount` is then deducted from the caller's\\r\\n * allowance.\\r\\n *\\r\\n * Returns a boolean value indicating whether the operation succeeded.\\r\\n *\\r\\n * Emits a {Transfer} event.\\r\\n */\\r\\n function transferFrom(\\r\\n address from,\\r\\n address to,\\r\\n uint256 amount\\r\\n ) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0xffeed6b3cac845b2af4afb30d87cecbd45dec3c408360c157a3db08e28b45043\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\n/**\\r\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\r\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\r\\n *\\r\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\r\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\r\\n * need to send a transaction, and thus is not required to hold Ether at all.\\r\\n */\\r\\ninterface IERC20PermitUpgradeable {\\r\\n /**\\r\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\r\\n * given ``owner``'s signed approval.\\r\\n *\\r\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\r\\n * ordering also apply here.\\r\\n *\\r\\n * Emits an {Approval} event.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `spender` cannot be the zero address.\\r\\n * - `deadline` must be a timestamp in the future.\\r\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\r\\n * over the EIP712-formatted function arguments.\\r\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\r\\n *\\r\\n * For more information on the signature format, see the\\r\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\r\\n * section].\\r\\n */\\r\\n function permit(\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) external;\\r\\n\\r\\n /**\\r\\n * @dev Returns the current nonce for `owner`. This value must be\\r\\n * included whenever a signature is generated for {permit}.\\r\\n *\\r\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\r\\n * prevents a signature from being used multiple times.\\r\\n */\\r\\n function nonces(address owner) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\r\\n */\\r\\n // solhint-disable-next-line func-name-mixedcase\\r\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\r\\n}\\r\\n\",\"keccak256\":\"0xa4ef4473f068f5f97b73e442f554e4464a581c2200c23181287b4c8eee5de777\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\r\\n\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"../IERC20Upgradeable.sol\\\";\\r\\nimport \\\"../extensions/draft-IERC20PermitUpgradeable.sol\\\";\\r\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SafeERC20\\r\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\r\\n * contract returns false). Tokens that return no value (and instead revert or\\r\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\r\\n * successful.\\r\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\r\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\r\\n */\\r\\nlibrary SafeERC20Upgradeable {\\r\\n using AddressUpgradeable for address;\\r\\n\\r\\n function safeTransfer(\\r\\n IERC20Upgradeable token,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\r\\n }\\r\\n\\r\\n function safeTransferFrom(\\r\\n IERC20Upgradeable token,\\r\\n address from,\\r\\n address to,\\r\\n uint256 value\\r\\n ) internal {\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Deprecated. This function has issues similar to the ones found in\\r\\n * {IERC20-approve}, and its usage is discouraged.\\r\\n *\\r\\n * Whenever possible, use {safeIncreaseAllowance} and\\r\\n * {safeDecreaseAllowance} instead.\\r\\n */\\r\\n function safeApprove(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n // safeApprove should only be called when setting an initial allowance,\\r\\n // or when resetting it to zero. To increase and decrease it, use\\r\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\r\\n require(\\r\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\r\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\r\\n );\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\r\\n }\\r\\n\\r\\n function safeIncreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n\\r\\n function safeDecreaseAllowance(\\r\\n IERC20Upgradeable token,\\r\\n address spender,\\r\\n uint256 value\\r\\n ) internal {\\r\\n unchecked {\\r\\n uint256 oldAllowance = token.allowance(address(this), spender);\\r\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\r\\n uint256 newAllowance = oldAllowance - value;\\r\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\r\\n }\\r\\n }\\r\\n\\r\\n function safePermit(\\r\\n IERC20PermitUpgradeable token,\\r\\n address owner,\\r\\n address spender,\\r\\n uint256 value,\\r\\n uint256 deadline,\\r\\n uint8 v,\\r\\n bytes32 r,\\r\\n bytes32 s\\r\\n ) internal {\\r\\n uint256 nonceBefore = token.nonces(owner);\\r\\n token.permit(owner, spender, value, deadline, v, r, s);\\r\\n uint256 nonceAfter = token.nonces(owner);\\r\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\r\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\r\\n * @param token The token targeted by the call.\\r\\n * @param data The call data (encoded using abi.encode or one of its variants).\\r\\n */\\r\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\r\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\r\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\r\\n // the target address contains contract code and also asserts for success in the low-level call.\\r\\n\\r\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\r\\n if (returndata.length > 0) {\\r\\n // Return data is optional\\r\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5735e7a8ab4d99d6cbef359228e76c7c2057f13f9a22d014458951409ea30f7c\",\"license\":\"MIT\"},\"@openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\n/**\\r\\n * @dev Collection of functions related to the address type\\r\\n */\\r\\nlibrary AddressUpgradeable {\\r\\n /**\\r\\n * @dev Returns true if `account` is a contract.\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * It is unsafe to assume that an address for which this function returns\\r\\n * false is an externally-owned account (EOA) and not a contract.\\r\\n *\\r\\n * Among others, `isContract` will return false for the following\\r\\n * types of addresses:\\r\\n *\\r\\n * - an externally-owned account\\r\\n * - a contract in construction\\r\\n * - an address where a contract will be created\\r\\n * - an address where a contract lived, but was destroyed\\r\\n * ====\\r\\n *\\r\\n * [IMPORTANT]\\r\\n * ====\\r\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\r\\n *\\r\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\r\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\r\\n * constructor.\\r\\n * ====\\r\\n */\\r\\n function isContract(address account) internal view returns (bool) {\\r\\n // This method relies on extcodesize/address.code.length, which returns 0\\r\\n // for contracts in construction, since the code is only stored at the end\\r\\n // of the constructor execution.\\r\\n\\r\\n return account.code.length > 0;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\r\\n * `recipient`, forwarding all available gas and reverting on errors.\\r\\n *\\r\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\r\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\r\\n * imposed by `transfer`, making them unable to receive funds via\\r\\n * `transfer`. {sendValue} removes this limitation.\\r\\n *\\r\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\r\\n *\\r\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\r\\n * taken to not create reentrancy vulnerabilities. Consider using\\r\\n * {ReentrancyGuard} or the\\r\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\r\\n */\\r\\n function sendValue(address payable recipient, uint256 amount) internal {\\r\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\r\\n\\r\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\r\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Performs a Solidity function call using a low level `call`. A\\r\\n * plain `call` is an unsafe replacement for a function call: use this\\r\\n * function instead.\\r\\n *\\r\\n * If `target` reverts with a revert reason, it is bubbled up by this\\r\\n * function (like regular Solidity function calls).\\r\\n *\\r\\n * Returns the raw returned data. To convert to the expected return value,\\r\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - `target` must be a contract.\\r\\n * - calling `target` with `data` must not revert.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\r\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, 0, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but also transferring `value` wei to `target`.\\r\\n *\\r\\n * Requirements:\\r\\n *\\r\\n * - the calling contract must have an ETH balance of at least `value`.\\r\\n * - the called Solidity function must be `payable`.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value\\r\\n ) internal returns (bytes memory) {\\r\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\r\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\r\\n *\\r\\n * _Available since v3.1._\\r\\n */\\r\\n function functionCallWithValue(\\r\\n address target,\\r\\n bytes memory data,\\r\\n uint256 value,\\r\\n string memory errorMessage\\r\\n ) internal returns (bytes memory) {\\r\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\r\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\r\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\r\\n * but performing a static call.\\r\\n *\\r\\n * _Available since v3.3._\\r\\n */\\r\\n function functionStaticCall(\\r\\n address target,\\r\\n bytes memory data,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n (bool success, bytes memory returndata) = target.staticcall(data);\\r\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\r\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\r\\n *\\r\\n * _Available since v4.8._\\r\\n */\\r\\n function verifyCallResultFromTarget(\\r\\n address target,\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal view returns (bytes memory) {\\r\\n if (success) {\\r\\n if (returndata.length == 0) {\\r\\n // only check isContract if the call was successful and the return data is empty\\r\\n // otherwise we already know that it was a contract\\r\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\r\\n }\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\r\\n * revert reason or using the provided one.\\r\\n *\\r\\n * _Available since v4.3._\\r\\n */\\r\\n function verifyCallResult(\\r\\n bool success,\\r\\n bytes memory returndata,\\r\\n string memory errorMessage\\r\\n ) internal pure returns (bytes memory) {\\r\\n if (success) {\\r\\n return returndata;\\r\\n } else {\\r\\n _revert(returndata, errorMessage);\\r\\n }\\r\\n }\\r\\n\\r\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\r\\n // Look for revert reason and bubble it up if present\\r\\n if (returndata.length > 0) {\\r\\n // The easiest way to bubble the revert reason is using memory via assembly\\r\\n /// @solidity memory-safe-assembly\\r\\n assembly {\\r\\n let returndata_size := mload(returndata)\\r\\n revert(add(32, returndata), returndata_size)\\r\\n }\\r\\n } else {\\r\\n revert(errorMessage);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x7c08bea8e975fa8e5e635a7753a9442b3d58f501c3a9951df8eb45581054228d\",\"license\":\"MIT\"},\"contracts/veION/stake/IStakeStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\n/**\\r\\n * @title IStakeStrategy\\r\\n * @notice Interface for the VeloIonModeStakingModeReward contract.\\r\\n */\\r\\ninterface IStakeStrategy {\\r\\n /// @notice Emitted when the contract is initialized\\r\\n event Initialized(\\r\\n address indexed escrow,\\r\\n address indexed stakingToken,\\r\\n address indexed stakingContract,\\r\\n address stakingWalletImplementation\\r\\n );\\r\\n\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(address indexed from, uint256 amount, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, address indexed veloWallet);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed owner, address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when staking wallet is transferred\\r\\n event StakingWalletTransferred(address indexed from, address indexed to, uint256 amount);\\r\\n\\r\\n /// @notice Emitted when escrow is set\\r\\n event EscrowSet(address indexed newEscrow);\\r\\n\\r\\n /// @notice Emitted when staking token is set\\r\\n event StakingTokenSet(address indexed newStakingToken);\\r\\n\\r\\n /// @notice Emitted when staking contract is set\\r\\n event StakingContractSet(address indexed newStakingContract);\\r\\n\\r\\n /// @notice Emitted when upgradeable beacon is set\\r\\n event UpgradeableBeaconSet(address indexed newBeacon);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens from a given address.\\r\\n * @param _from The address from which tokens will be staked.\\r\\n * @param _amount The amount of tokens to stake.\\r\\n * @param _data Additional data that might be needed for staking.\\r\\n */\\r\\n function stake(address _from, uint256 _amount, bytes memory _data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for a given address.\\r\\n * @param _from The address for which to claim rewards.\\r\\n */\\r\\n function claim(address _from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of tokens for a given address.\\r\\n * @param _owner The address from which tokens will be withdrawn.\\r\\n * @param _amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address _owner, address _withdrawTo, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Returns the current reward rate for the staking strategy.\\r\\n * @return The reward rate as a uint256.\\r\\n */\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the period finish time for the staking strategy.\\r\\n * @return The period finish time as a uint256.\\r\\n */\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the balance of a specific address.\\r\\n * @param account The address to query the balance of.\\r\\n * @return The balance as a uint256.\\r\\n */\\r\\n function balanceOf(address account) external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the total supply of staked tokens.\\r\\n * @return The total supply as a uint256.\\r\\n */\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the reward token for the staking strategy.\\r\\n * @return The address of the reward token.\\r\\n */\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking contract.\\r\\n * @return The address of the staking contract.\\r\\n */\\r\\n function stakingContract() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the address of the staking token.\\r\\n * @return The address of the staking token.\\r\\n */\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Returns the staking wallet address for a specific user.\\r\\n * @param user The address of the user.\\r\\n * @return The address of the user's staking wallet.\\r\\n */\\r\\n function userStakingWallet(address user) external view returns (address);\\r\\n\\r\\n /**\\r\\n * @notice Transfers the staking wallet from one user to another.\\r\\n * @param from The current owner of the staking wallet.\\r\\n * @param to The new owner of the staking wallet.\\r\\n */\\r\\n function transferStakingWallet(address from, address to, uint256 _amount) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the escrow address.\\r\\n * @param _escrow The address of the new escrow.\\r\\n */\\r\\n function setEscrow(address _escrow) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking token address.\\r\\n * @param _stakingToken The address of the new staking token.\\r\\n */\\r\\n function setStakingToken(address _stakingToken) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the staking contract address.\\r\\n * @param _stakingContract The address of the new staking contract.\\r\\n */\\r\\n function setStakingContract(address _stakingContract) external;\\r\\n\\r\\n /**\\r\\n * @notice Sets the address of the beacon.\\r\\n * @param _beacon The address of the new beacon contract.\\r\\n */\\r\\n function setUpgradeableBeacon(address _beacon) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x69d7a60ae3df2ead3b3afaa32ae9b6ea4df13ef65c7c375babe7be2e5457fc8b\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/IStakeWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IStakeWallet {\\r\\n /// @notice Emitted when tokens are staked\\r\\n event Staked(uint256 amount);\\r\\n\\r\\n /// @notice Emitted when rewards are claimed\\r\\n event Claimed(address indexed from, uint256 rewardAmount);\\r\\n\\r\\n /// @notice Emitted when tokens are withdrawn\\r\\n event Withdrawn(address indexed withdrawTo, uint256 amount);\\r\\n\\r\\n /**\\r\\n * @notice Stakes a specified amount of tokens according to the strategy.\\r\\n * @param amount The amount of tokens to stake.\\r\\n * @param data Additional data required for the staking strategy.\\r\\n */\\r\\n function stake(address from, uint256 amount, bytes memory data) external;\\r\\n\\r\\n /**\\r\\n * @notice Claims rewards for the caller.\\r\\n */\\r\\n function claim(address from) external;\\r\\n\\r\\n /**\\r\\n * @notice Withdraws a specified amount of staked tokens.\\r\\n * @param withdrawTo The address to withdraw tokens to.\\r\\n * @param amount The amount of tokens to withdraw.\\r\\n */\\r\\n function withdraw(address withdrawTo, uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa1145156b33d804afb421beb12e8c1fc19416e9d1d4b815d7b698fd97564ef42\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/IVeloIonModeStaking.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\ninterface IVeloIonModeStaking {\\r\\n event Deposit(address indexed from, address indexed to, uint256 amount);\\r\\n event Withdraw(address indexed from, uint256 amount);\\r\\n event NotifyReward(address indexed from, uint256 amount);\\r\\n event ClaimFees(uint256 claimed0, uint256 claimed1);\\r\\n event ClaimRewards(address indexed from, uint256 amount);\\r\\n\\r\\n /// @notice Address of the pool LP token which is deposited (staked) for rewards\\r\\n function stakingToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the token (VELO v2) rewarded to stakers\\r\\n function rewardToken() external view returns (address);\\r\\n\\r\\n /// @notice Address of the Converter contract linked to the gauge\\r\\n function feeConverter() external view returns (address);\\r\\n\\r\\n /// @notice Address of the staking rewards factory that created this gauge\\r\\n function factory() external view returns (address);\\r\\n\\r\\n /// @notice Timestamp end of current rewards period\\r\\n function periodFinish() external view returns (uint256);\\r\\n\\r\\n /// @notice Current reward rate of rewardToken to distribute per second\\r\\n function rewardRate() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent timestamp contract has updated state\\r\\n function lastUpdateTime() external view returns (uint256);\\r\\n\\r\\n /// @notice Most recent stored value of rewardPerToken\\r\\n function rewardPerTokenStored() external view returns (uint256);\\r\\n\\r\\n /// @notice Amount of stakingToken deposited for rewards\\r\\n function totalSupply() external view returns (uint256);\\r\\n\\r\\n /// @notice Get the amount of stakingToken deposited by an account\\r\\n function balanceOf(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached rewardPerTokenStored for an account based on their most recent action\\r\\n function userRewardPerTokenPaid(address) external view returns (uint256);\\r\\n\\r\\n /// @notice Cached amount of rewardToken earned for an account\\r\\n function rewards(address) external view returns (uint256);\\r\\n\\r\\n /// @notice View to see the rewardRate given the timestamp of the start of the epoch\\r\\n function rewardRateByEpoch(uint256) external view returns (uint256);\\r\\n\\r\\n /// @notice Get the current reward rate per unit of stakingToken deposited\\r\\n function rewardPerToken() external view returns (uint256 _rewardPerToken);\\r\\n\\r\\n /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended\\r\\n function lastTimeRewardApplicable() external view returns (uint256 _time);\\r\\n\\r\\n /// @notice Returns accrued balance to date from last claim / first deposit.\\r\\n function earned(address _account) external view returns (uint256 _earned);\\r\\n\\r\\n /// @notice Total amount of rewardToken to distribute for the current rewards period\\r\\n function left() external view returns (uint256 _left);\\r\\n\\r\\n /// @notice Claims accrued Fees from Pool and distributes them to the Converter\\r\\n /// @return _claimed0 Amount of Fees claimed in token0\\r\\n /// @return _claimed1 Amount of Fees claimed in token1\\r\\n function claimFees() external returns (uint256 _claimed0, uint256 _claimed1);\\r\\n\\r\\n /// @notice Retrieve rewards for an address.\\r\\n /// @dev Throws if not called by same address or voter.\\r\\n /// @param _account .\\r\\n function getReward(address _account) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for msg.sender\\r\\n /// @param _amount .\\r\\n function deposit(uint256 _amount) external;\\r\\n\\r\\n /// @notice Deposit LP tokens into gauge for any user\\r\\n /// @param _amount .\\r\\n /// @param _recipient Recipient to give balance to\\r\\n function deposit(uint256 _amount, address _recipient) external;\\r\\n\\r\\n /// @notice Withdraw LP tokens for user\\r\\n /// @param _amount .\\r\\n function withdraw(uint256 _amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardMatch(uint256 amount) external;\\r\\n\\r\\n /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals.\\r\\n /// If not 18 decimals, rewardRate may have rounding issues.\\r\\n function notifyRewardAmount(uint256 amount) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x23f5c8711c247d772dc1dd96417a335a99857bcd8e3dbe9a96d14ac8f5038262\",\"license\":\"UNLICENSED\"},\"contracts/veION/stake/velo/VeloAeroStakingWallet.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.22;\\r\\n\\r\\nimport { IStakeWallet } from \\\"../IStakeWallet.sol\\\";\\r\\nimport { IStakeStrategy } from \\\"../IStakeStrategy.sol\\\";\\r\\nimport { IVeloIonModeStaking } from \\\"./IVeloIonModeStaking.sol\\\";\\r\\nimport { IERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\\\";\\r\\nimport { SafeERC20Upgradeable } from \\\"@openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\r\\nimport { Initializable } from \\\"@openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title VeloAeroStakingWallet\\r\\n * @notice Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.\\r\\n * @dev This contract allows staking and claiming rewards with a specific staking strategy.\\r\\n * @dev The staking strategy is set during contract deployment and can only be called by the strategy.\\r\\n * @dev The contract is designed to be used with the Velodrome/Aerodrome style LP.\\r\\n * @author Jourdan Dunkley \\r\\n */\\r\\ncontract VeloAeroStakingWallet is IStakeWallet, Initializable {\\r\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\r\\n IStakeStrategy public stakeStrategy;\\r\\n\\r\\n /// @dev Modifier to restrict function access to only the stake strategy contract\\r\\n modifier onlyStakeStrategy() {\\r\\n require(msg.sender == address(stakeStrategy), \\\"Not authorized: Only stake strategy can call this function\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n constructor() {\\r\\n _disableInitializers(); // Locks the implementation contract from being initialized\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Initializes the contract with a staking strategy\\r\\n * @dev Can only be called once due to initializer modifier\\r\\n * @param _stakeStrategy The address of the staking strategy contract\\r\\n */\\r\\n function initialize(IStakeStrategy _stakeStrategy) external initializer {\\r\\n stakeStrategy = _stakeStrategy;\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function stake(address /* _from */, uint256 _amount, bytes memory /* _data */) external override onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingToken.safeTransferFrom(msg.sender, address(this), _amount);\\r\\n stakingToken.approve(address(stakingContract), _amount);\\r\\n stakingContract.deposit(_amount);\\r\\n emit Staked(_amount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function claim(address _from) external onlyStakeStrategy {\\r\\n IERC20Upgradeable rewardToken = IERC20Upgradeable(stakeStrategy.rewardToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.getReward(address(this));\\r\\n uint256 rewardAmount = rewardToken.balanceOf(address(this));\\r\\n IERC20Upgradeable(rewardToken).safeTransfer(_from, rewardAmount);\\r\\n emit Claimed(_from, rewardAmount);\\r\\n }\\r\\n\\r\\n /// @inheritdoc IStakeWallet\\r\\n function withdraw(address _withdrawTo, uint256 _amount) external onlyStakeStrategy {\\r\\n IERC20Upgradeable stakingToken = IERC20Upgradeable(stakeStrategy.stakingToken());\\r\\n IVeloIonModeStaking stakingContract = IVeloIonModeStaking(stakeStrategy.stakingContract());\\r\\n\\r\\n stakingContract.withdraw(_amount);\\r\\n stakingToken.safeTransfer(_withdrawTo, _amount);\\r\\n emit Withdrawn(_withdrawTo, _amount);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x5d95949d0e7ba07afe3cfbe991cbf6ec8b8877d10181886ba8cdbf896e914ff7\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b610e23806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631e83409a1461005c5780633e12170f14610071578063766c737214610084578063c4d66de8146100b9578063f3fef3a3146100cc575b600080fd5b61006f61006a366004610b92565b6100df565b005b61006f61007f366004610bcc565b610330565b60005461009d906201000090046001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006f6100c7366004610b92565b610577565b61006f6100da366004610c99565b6106a3565b6000546201000090046001600160a01b031633146101185760405162461bcd60e51b815260040161010f90610cc5565b60405180910390fd5b60008060029054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561016c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101909190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020a9190610d22565b604051630c00007b60e41b81523060048201529091506001600160a01b0382169063c00007b090602401600060405180830381600087803b15801561024e57600080fd5b505af1158015610262573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03851691506370a0823190602401602060405180830381865afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190610d3f565b90506102e76001600160a01b0384168583610872565b836001600160a01b03167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161032291815260200190565b60405180910390a250505050565b6000546201000090046001600160a01b031633146103605760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d89190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561042e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104529190610d22565b90506104696001600160a01b0383163330876108da565b60405163095ea7b360e01b81526001600160a01b0382811660048301526024820186905283169063095ea7b3906044016020604051808303816000875af11580156104b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dc9190610d58565b5060405163b6b55f2560e01b8152600481018590526001600160a01b0382169063b6b55f2590602401600060405180830381600087803b15801561051f57600080fd5b505af1158015610533573d6000803e3d6000fd5b505050507feebbaa86c348cb664e392b180fd0ff2e1998af9fa833ef69a778cb0b42d3ca278460405161056891815260200190565b60405180910390a15050505050565b600054610100900460ff16158080156105975750600054600160ff909116105b806105b15750303b1580156105b1575060005460ff166001145b6106145760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161010f565b6000805460ff191660011790558015610637576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b03851602179055801561069f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6000546201000090046001600160a01b031633146106d35760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b9190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c59190610d22565b604051632e1a7d4d60e01b8152600481018590529091506001600160a01b03821690632e1a7d4d90602401600060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b50610837925050506001600160a01b0383168585610872565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58460405161032291815260200190565b6040516001600160a01b0383166024820152604481018290526108d590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610918565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526109129085906323b872dd60e01b9060840161089e565b50505050565b600061096d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109ea9092919063ffffffff16565b8051909150156108d5578080602001905181019061098b9190610d58565b6108d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161010f565b60606109f98484600085610a01565b949350505050565b606082471015610a625760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161010f565b600080866001600160a01b03168587604051610a7e9190610d9e565b60006040518083038185875af1925050503d8060008114610abb576040519150601f19603f3d011682016040523d82523d6000602084013e610ac0565b606091505b5091509150610ad187838387610adc565b979650505050505050565b60608315610b4b578251600003610b44576001600160a01b0385163b610b445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161010f565b50816109f9565b6109f98383815115610b605781518083602001fd5b8060405162461bcd60e51b815260040161010f9190610dba565b6001600160a01b0381168114610b8f57600080fd5b50565b600060208284031215610ba457600080fd5b8135610baf81610b7a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610be157600080fd5b8335610bec81610b7a565b925060208401359150604084013567ffffffffffffffff80821115610c1057600080fd5b818601915086601f830112610c2457600080fd5b813581811115610c3657610c36610bb6565b604051601f8201601f19908116603f01168101908382118183101715610c5e57610c5e610bb6565b81604052828152896020848701011115610c7757600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60008060408385031215610cac57600080fd5b8235610cb781610b7a565b946020939093013593505050565b6020808252603a908201527f4e6f7420617574686f72697a65643a204f6e6c79207374616b6520737472617460408201527f6567792063616e2063616c6c20746869732066756e6374696f6e000000000000606082015260800190565b600060208284031215610d3457600080fd5b8151610baf81610b7a565b600060208284031215610d5157600080fd5b5051919050565b600060208284031215610d6a57600080fd5b81518015158114610baf57600080fd5b60005b83811015610d95578181015183820152602001610d7d565b50506000910152565b60008251610db0818460208701610d7a565b9190910192915050565b6020815260008251806020840152610dd9816040850160208701610d7a565b601f01601f1916919091016040019291505056fea264697066735822122028b00a85895fd51bc12e2cec8a0377cef289ee51bad945abac89ef209d1366df64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631e83409a1461005c5780633e12170f14610071578063766c737214610084578063c4d66de8146100b9578063f3fef3a3146100cc575b600080fd5b61006f61006a366004610b92565b6100df565b005b61006f61007f366004610bcc565b610330565b60005461009d906201000090046001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006f6100c7366004610b92565b610577565b61006f6100da366004610c99565b6106a3565b6000546201000090046001600160a01b031633146101185760405162461bcd60e51b815260040161010f90610cc5565b60405180910390fd5b60008060029054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561016c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101909190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020a9190610d22565b604051630c00007b60e41b81523060048201529091506001600160a01b0382169063c00007b090602401600060405180830381600087803b15801561024e57600080fd5b505af1158015610262573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03851691506370a0823190602401602060405180830381865afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190610d3f565b90506102e76001600160a01b0384168583610872565b836001600160a01b03167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161032291815260200190565b60405180910390a250505050565b6000546201000090046001600160a01b031633146103605760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d89190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561042e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104529190610d22565b90506104696001600160a01b0383163330876108da565b60405163095ea7b360e01b81526001600160a01b0382811660048301526024820186905283169063095ea7b3906044016020604051808303816000875af11580156104b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dc9190610d58565b5060405163b6b55f2560e01b8152600481018590526001600160a01b0382169063b6b55f2590602401600060405180830381600087803b15801561051f57600080fd5b505af1158015610533573d6000803e3d6000fd5b505050507feebbaa86c348cb664e392b180fd0ff2e1998af9fa833ef69a778cb0b42d3ca278460405161056891815260200190565b60405180910390a15050505050565b600054610100900460ff16158080156105975750600054600160ff909116105b806105b15750303b1580156105b1575060005460ff166001145b6106145760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161010f565b6000805460ff191660011790558015610637576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b03851602179055801561069f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6000546201000090046001600160a01b031633146106d35760405162461bcd60e51b815260040161010f90610cc5565b60008060029054906101000a90046001600160a01b03166001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b9190610d22565b905060008060029054906101000a90046001600160a01b03166001600160a01b031663ee99205c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c59190610d22565b604051632e1a7d4d60e01b8152600481018590529091506001600160a01b03821690632e1a7d4d90602401600060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b50610837925050506001600160a01b0383168585610872565b836001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58460405161032291815260200190565b6040516001600160a01b0383166024820152604481018290526108d590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610918565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526109129085906323b872dd60e01b9060840161089e565b50505050565b600061096d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109ea9092919063ffffffff16565b8051909150156108d5578080602001905181019061098b9190610d58565b6108d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161010f565b60606109f98484600085610a01565b949350505050565b606082471015610a625760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161010f565b600080866001600160a01b03168587604051610a7e9190610d9e565b60006040518083038185875af1925050503d8060008114610abb576040519150601f19603f3d011682016040523d82523d6000602084013e610ac0565b606091505b5091509150610ad187838387610adc565b979650505050505050565b60608315610b4b578251600003610b44576001600160a01b0385163b610b445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161010f565b50816109f9565b6109f98383815115610b605781518083602001fd5b8060405162461bcd60e51b815260040161010f9190610dba565b6001600160a01b0381168114610b8f57600080fd5b50565b600060208284031215610ba457600080fd5b8135610baf81610b7a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610be157600080fd5b8335610bec81610b7a565b925060208401359150604084013567ffffffffffffffff80821115610c1057600080fd5b818601915086601f830112610c2457600080fd5b813581811115610c3657610c36610bb6565b604051601f8201601f19908116603f01168101908382118183101715610c5e57610c5e610bb6565b81604052828152896020848701011115610c7757600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60008060408385031215610cac57600080fd5b8235610cb781610b7a565b946020939093013593505050565b6020808252603a908201527f4e6f7420617574686f72697a65643a204f6e6c79207374616b6520737472617460408201527f6567792063616e2063616c6c20746869732066756e6374696f6e000000000000606082015260800190565b600060208284031215610d3457600080fd5b8151610baf81610b7a565b600060208284031215610d5157600080fd5b5051919050565b600060208284031215610d6a57600080fd5b81518015158114610baf57600080fd5b60005b83811015610d95578181015183820152602001610d7d565b50506000910152565b60008251610db0818460208701610d7a565b9190910192915050565b6020815260008251806020840152610dd9816040850160208701610d7a565b601f01601f1916919091016040019291505056fea264697066735822122028b00a85895fd51bc12e2cec8a0377cef289ee51bad945abac89ef209d1366df64736f6c63430008160033", + "devdoc": { + "author": "Jourdan Dunkley ", + "details": "This contract allows staking and claiming rewards with a specific staking strategy.The staking strategy is set during contract deployment and can only be called by the strategy.The contract is designed to be used with the Velodrome/Aerodrome style LP.", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "initialize(address)": { + "details": "Can only be called once due to initializer modifier", + "params": { + "_stakeStrategy": "The address of the staking strategy contract" + } + }, + "stake(address,uint256,bytes)": { + "params": { + "amount": "The amount of tokens to stake.", + "data": "Additional data required for the staking strategy." + } + }, + "withdraw(address,uint256)": { + "params": { + "amount": "The amount of tokens to withdraw.", + "withdrawTo": "The address to withdraw tokens to." + } + } + }, + "title": "VeloAeroStakingWallet", + "version": 1 + }, + "userdoc": { + "events": { + "Claimed(address,uint256)": { + "notice": "Emitted when rewards are claimed" + }, + "Staked(uint256)": { + "notice": "Emitted when tokens are staked" + }, + "Withdrawn(address,uint256)": { + "notice": "Emitted when tokens are withdrawn" + } + }, + "kind": "user", + "methods": { + "claim(address)": { + "notice": "Claims rewards for the caller." + }, + "initialize(address)": { + "notice": "Initializes the contract with a staking strategy" + }, + "stake(address,uint256,bytes)": { + "notice": "Stakes a specified amount of tokens according to the strategy." + }, + "withdraw(address,uint256)": { + "notice": "Withdraws a specified amount of staked tokens." + } + }, + "notice": "Staking interface for usage in veION when staking Velodrome/Aerodrome style LP.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3343, + "contract": "contracts/veION/stake/velo/VeloAeroStakingWallet.sol:VeloAeroStakingWallet", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3346, + "contract": "contracts/veION/stake/velo/VeloAeroStakingWallet.sol:VeloAeroStakingWallet", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 110139, + "contract": "contracts/veION/stake/velo/VeloAeroStakingWallet.sol:VeloAeroStakingWallet", + "label": "stakeStrategy", + "offset": 2, + "slot": "0", + "type": "t_contract(IStakeStrategy)109301" + } + ], + "types": { + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IStakeStrategy)109301": { + "encoding": "inplace", + "label": "contract IStakeStrategy", + "numberOfBytes": "20" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/foundry.toml b/packages/contracts/foundry.toml index ff0dc558e6..24e70c034c 100644 --- a/packages/contracts/foundry.toml +++ b/packages/contracts/foundry.toml @@ -12,9 +12,11 @@ evm_version = 'shanghai' [rpc_endpoints] mode = "${MODE_MAINNET_RPC_URL}" base = "${BASE_MAINNET_RPC_URL}" +lisk = "${LISK_MAINNET_RPC_URL}" mode_archive = "${MODE_MAINNET_ARCHIVE_RPC_URL}" base_archive = "${BASE_MAINNET_ARCHIVE_RPC_URL}" +lisk_archive = "${LISK_MAINNET_ARCHIVE_RPC_URL}" # See more config options https://github.com/gakonst/foundry/tree/master/config diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index d4ffbc774a..a11a84096a 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -19,11 +19,6 @@ const accounts = [ return this.toString(); }; -subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (_, __, runSuper) => { - const paths = await runSuper(); - return paths.filter((p: string) => !p.endsWith(".t.sol")); -}); - const config: HardhatUserConfig = { namedAccounts: { deployer: { default: 0 }, diff --git a/packages/contracts/lib/devtools b/packages/contracts/lib/devtools deleted file mode 160000 index d4850c3c74..0000000000 --- a/packages/contracts/lib/devtools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d4850c3c740e0de07352757b67ccff66931102ed diff --git a/packages/contracts/remappings.txt b/packages/contracts/remappings.txt index 94f7e505d1..13458ed0ee 100644 --- a/packages/contracts/remappings.txt +++ b/packages/contracts/remappings.txt @@ -4,7 +4,4 @@ solidity-bytes-utils/=lib/solidity-bytes-utils/ @openzeppelin-contracts-upgradeable=lib/openzeppelin-contracts-upgradeable/ @pythnetwork/pyth-sdk-solidity/=lib/pyth-sdk-solidity/ @pythnetwork/express-relay-sdk-solidity/=lib/pyth-crosschain/express_relay/sdk/solidity -adrastia-periphery/=lib/adrastia-periphery/contracts/ -@layerzerolabs/oapp-evm/=lib/devtools/packages/oapp-evm/ -@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol -@layerzerolabs/lz-evm-messagelib-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/messagelib \ No newline at end of file +adrastia-periphery/=lib/adrastia-periphery/contracts/ \ No newline at end of file diff --git a/packages/contracts/tasks/auth/user.ts b/packages/contracts/tasks/auth/user.ts index 7f75fb0d8d..a3cc98efad 100644 --- a/packages/contracts/tasks/auth/user.ts +++ b/packages/contracts/tasks/auth/user.ts @@ -1,12 +1,14 @@ import { task, types } from "hardhat/config"; import { Address, zeroAddress } from "viem"; +import { prepareAndLogTransaction } from "../../chainDeploy/helpers/logging"; enum Roles { REGISTRY_ROLE, SUPPLIER_ROLE, BORROWER_ROLE, LIQUIDATOR_ROLE, - LEVERED_POSITION_ROLE + LEVERED_POSITION_ROLE, + CLAIMER_ROLE } task("auth:set-user-role", "Sets the role of a new user") @@ -32,8 +34,70 @@ task("auth:set-user-role", "Sets the role of a new user") console.log(`User ${user} already has ${Roles[role]} role for pool ${pool}`); return; } else { - const tx = await authRegistry.write.setUserRole([pool, user, role, enabled]); - await publicClient.waitForTransactionReceipt({ hash: tx }); - console.log(`Set user ${user} role: ${Roles[role]} pool ${pool}: ${tx} to ${enabled}`); + if (1) { + await prepareAndLogTransaction({ + contractInstance: authRegistry, + functionName: "setUserRole", + args: [pool, user, role, enabled], + description: `Setting user ${user} role: ${Roles[role]} for pool ${pool} to ${enabled}`, + inputs: [ + { internalType: "address", name: "pool", type: "address" }, + { internalType: "address", name: "user", type: "address" }, + { internalType: "uint8", name: "role", type: "uint8" }, + { internalType: "bool", name: "enabled", type: "bool" } + ] + }); + } else { + const tx = await authRegistry.write.setUserRole([pool, user, role, enabled]); + await publicClient.waitForTransactionReceipt({ hash: tx }); + console.log(`Set user ${user} role: ${Roles[role]} pool ${pool}: ${tx} to ${enabled}`); + } + } + }); + +task("auth:set-role-capability", "Sets the capability of a role") + .addParam("pool", "Address of pool", undefined, types.string) + .addParam("role", "Enum of the role to use", undefined, types.int) + .addParam("target", "Address of the target contract", undefined, types.string) + .addParam("functionSig", "Function signature to set capability for", undefined, types.string) + .addParam("enabled", "If the capability should be enabled or not", undefined, types.boolean) + .setAction(async ({ pool, role, target, functionSig, enabled }, { viem, deployments }) => { + const publicClient = await viem.getPublicClient(); + console.log({ pool, role: Roles[role], target, functionSig, enabled }); + const authRegistry = await viem.getContractAt( + "AuthoritiesRegistry", + (await deployments.get("AuthoritiesRegistry")).address as Address + ); + const poolAuthAddress = await authRegistry.read.poolsAuthorities([pool]); + if (poolAuthAddress === zeroAddress) { + console.log(`Pool authority for pool ${pool} does not exist`); + return; + } + const poolAuth = await viem.getContractAt("PoolRolesAuthority", poolAuthAddress); + const currentCapability = await poolAuth.read.doesRoleHaveCapability([role, target, functionSig]); + if (currentCapability === enabled) { + console.log(`Role ${Roles[role]} already has capability for function ${functionSig} on target ${target}`); + return; + } else { + if (1) { + await prepareAndLogTransaction({ + contractInstance: poolAuth, + functionName: "setRoleCapability", + args: [role, target, functionSig, enabled], + description: `Updating role capability for function ${functionSig} on target ${target}`, + inputs: [ + { internalType: "uint8", name: "role", type: "uint8" }, + { internalType: "address", name: "target", type: "address" }, + { internalType: "bytes4", name: "functionSig", type: "bytes4" }, + { internalType: "bool", name: "enabled", type: "bool" } + ] + }); + } else { + const tx = await poolAuth.write.setRoleCapability([role, target, functionSig, enabled]); + await publicClient.waitForTransactionReceipt({ hash: tx }); + console.log( + `Set role ${Roles[role]} capability for function ${functionSig} on target ${target} to ${enabled}: ${tx}` + ); + } } }); diff --git a/packages/contracts/tasks/chain-specific/base/index.ts b/packages/contracts/tasks/chain-specific/base/index.ts index c5376f6bee..a278a887bf 100644 --- a/packages/contracts/tasks/chain-specific/base/index.ts +++ b/packages/contracts/tasks/chain-specific/base/index.ts @@ -9,8 +9,11 @@ import "./oracle"; import "./hypernative"; import "./erc4626"; import "./veION"; +import "./morpho"; export const COMPTROLLER = "0x05c9C6417F246600f8f5f49fcA9Ee991bfF73D13"; +export const COMPTROLLER_MORPHO_IONIC = "0x4F339cF257717C056D88D0a3027063CE5b639470"; +export const COMPTROLLER_MORPHO_SEAMLESS = "0x1dF19214691076A3A92C9545D52a9d6c486E6699"; export const ION = "0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5"; export const eUSD = "0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4"; @@ -41,4 +44,3 @@ export const uSUI_MARKET = "0xAa255Cf8e294BD7fcAB21897C0791e50C99BAc69"; export const sUSDz_MARKET = "0xf64bfd19DdCB2Bb54e6f976a233d0A9400ed84eA"; export const fBOMB_MARKET = "0xd333681242F376f9005d1208ff946C3EE73eD659"; export const KLIMA_MARKET = "0x600D660440f15EeADbC3fc1403375e04b318F07e"; - diff --git a/packages/contracts/tasks/chain-specific/base/markets.ts b/packages/contracts/tasks/chain-specific/base/markets.ts index 5541dcd7c9..06c1ab634f 100644 --- a/packages/contracts/tasks/chain-specific/base/markets.ts +++ b/packages/contracts/tasks/chain-specific/base/markets.ts @@ -1,45 +1,69 @@ import { task } from "hardhat/config"; import { base } from "@ionicprotocol/chains"; import { assetSymbols } from "@ionicprotocol/types"; -import { COMPTROLLER } from "."; +import { COMPTROLLER, COMPTROLLER_MORPHO_IONIC, COMPTROLLER_MORPHO_SEAMLESS } from "."; import { Address, zeroAddress } from "viem"; import { prepareAndLogTransaction } from "../../../chainDeploy/helpers/logging"; import { getMarketInfo } from "../../market"; -task("markets:deploy:base:new", "deploy base market").setAction(async (_, { viem, run }) => { - const assetsToDeploy: string[] = [assetSymbols.mBASIS]; - for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) { - console.log("Deploying market for ", asset.symbol, asset.name); - await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait 10 seconds - - if (!asset.underlying || !asset.symbol) { - throw new Error("Invalid asset"); - } - await run("market:deploy", { - signer: "deployer", - cf: "0", - underlying: asset.underlying, - comptroller: COMPTROLLER, - symbol: "ion" + asset.symbol, - name: `Ionic ${asset.name}` - }); - const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER); - const cToken = await pool.read.cTokensByUnderlying([asset.underlying]); - console.log(`Deployed ${asset.symbol} at ${cToken}`); +task("markets:deploy:base:new", "deploy base market").setAction( + async (_, { viem, run, deployments, getNamedAccounts }) => { + const { deployer } = await getNamedAccounts(); + const assetsToDeploy: string[] = [assetSymbols.mBASIS]; + for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) { + console.log("Deploying market for ", asset.symbol, asset.name); + await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait 10 seconds - if (cToken !== zeroAddress) { - await run("market:set-supply-cap", { - market: cToken, - maxSupply: asset.initialSupplyCap + if (!asset.underlying || !asset.symbol) { + throw new Error("Invalid asset"); + } + await run("market:deploy", { + signer: "deployer", + cf: "0", + underlying: asset.underlying, + comptroller: COMPTROLLER, + symbol: "ion" + asset.symbol, + name: `Ionic ${asset.name}` }); + const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER); + const cToken = await pool.read.cTokensByUnderlying([asset.underlying]); + console.log(`Deployed ${asset.symbol} at ${cToken}`); - await run("market:set-borrow-cap", { - market: cToken, - maxBorrow: asset.initialBorrowCap - }); + if (cToken !== zeroAddress) { + const asExt = await viem.getContractAt("CTokenFirstExtension", cToken); + const admin = await pool.read.admin(); + const ap = await deployments.get("AddressesProvider"); + if (admin.toLowerCase() !== deployer.toLowerCase()) { + await prepareAndLogTransaction({ + contractInstance: asExt, + functionName: "_setAddressesProvider", + args: [ap.address as Address], + description: "Set Addresses Provider", + inputs: [ + { + internalType: "address", + name: "_ap", + type: "address" + } + ] + }); + } else { + await asExt.write._setAddressesProvider([ap.address as Address]); + } + + await run("market:set-supply-cap", { + market: cToken, + maxSupply: asset.initialSupplyCap + }); + + await run("market:set-borrow-cap", { + market: cToken, + maxBorrow: asset.initialBorrowCap + }); + } } } -}); +); task("base:set-caps:new", "one time setup").setAction(async (_, { viem, run, getNamedAccounts, deployments }) => { const { deployer } = await getNamedAccounts(); @@ -98,3 +122,122 @@ task("market:set-cf:base:new", "Sets CF on a market").setAction(async (_, { viem task("base:get-market-info", "get market info").setAction(async (_, { viem, run }) => { await getMarketInfo(viem, COMPTROLLER); }); + +task("markets:deploy:base:morpho-seamless", "deploy base market").setAction( + async (_, { viem, run, deployments, getNamedAccounts }) => { + const { deployer } = await getNamedAccounts(); + const assetsToDeploy: string[] = [assetSymbols.smUSDC /*assetSymbols.USDC, assetSymbols.ETH*/]; + for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) { + const marketName = `Ionic ${asset.name} Morpho (Seamless)`; + const marketSymbol = `ion${asset.symbol}.morpho.seamless`; + console.log("Deploying market for", asset.symbol, asset.name, marketSymbol, marketName); + await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait 10 seconds + + if (!asset.underlying || !asset.symbol) { + throw new Error("Invalid asset"); + } + await run("market:deploy", { + signer: "deployer", + cf: "0", + underlying: asset.underlying, + comptroller: COMPTROLLER_MORPHO_SEAMLESS, + symbol: marketSymbol, + name: marketName + }); + const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER_MORPHO_SEAMLESS); + const cToken = await pool.read.cTokensByUnderlying([asset.underlying]); + console.log(`Deployed ${asset.symbol} at ${cToken}`); + + if (cToken !== zeroAddress) { + const asExt = await viem.getContractAt("CTokenFirstExtension", cToken); + const admin = await pool.read.admin(); + const ap = await deployments.get("AddressesProvider"); + if (admin.toLowerCase() !== deployer.toLowerCase()) { + await prepareAndLogTransaction({ + contractInstance: asExt, + functionName: "_setAddressesProvider", + args: [ap.address as Address], + description: "Set Addresses Provider", + inputs: [ + { + internalType: "address", + name: "_ap", + type: "address" + } + ] + }); + } else { + await asExt.write._setAddressesProvider([ap.address as Address]); + } + + await run("market:set-supply-cap", { + market: cToken, + maxSupply: asset.initialSupplyCap + }); + + await run("market:set-borrow-cap", { + market: cToken, + maxBorrow: asset.initialBorrowCap + }); + } + } + } +); + +task("base:set-caps:morpho-seamless", "one time setup").setAction( + async (_, { viem, run, getNamedAccounts, deployments }) => { + const { deployer } = await getNamedAccounts(); + const assetsToDeploy: string[] = [assetSymbols.smUSDC, assetSymbols.USDC]; + for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) { + const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER_MORPHO_SEAMLESS); + const cToken = await pool.read.cTokensByUnderlying([asset.underlying]); + const asExt = await viem.getContractAt("CTokenFirstExtension", cToken); + const admin = await pool.read.admin(); + const ap = await deployments.get("AddressesProvider"); + if (admin.toLowerCase() !== deployer.toLowerCase()) { + await prepareAndLogTransaction({ + contractInstance: asExt, + functionName: "_setAddressesProvider", + args: [ap.address as Address], + description: "Set Addresses Provider", + inputs: [ + { + internalType: "address", + name: "_ap", + type: "address" + } + ] + }); + } else { + await asExt.write._setAddressesProvider([ap.address as Address]); + } + + await run("market:set-borrow-cap", { + market: cToken, + maxBorrow: asset.initialBorrowCap + }); + + await run("market:set-supply-cap", { + market: cToken, + maxSupply: asset.initialSupplyCap + }); + } + } +); + +task("market:set-cf:base:morpho-seamless", "Sets CF on a market").setAction(async (_, { viem, run }) => { + for (const asset of base.assets.filter((asset) => + [assetSymbols.smUSDC, assetSymbols.USDC].includes(asset.symbol as any) + )) { + const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER_MORPHO_SEAMLESS); + const cToken = await pool.read.cTokensByUnderlying([asset.underlying]); + console.log("cToken: ", cToken, asset.symbol); + + if (asset.initialCf) { + await run("market:set:ltv", { + marketAddress: cToken, + ltv: asset.initialCf + }); + } + } +}); \ No newline at end of file diff --git a/packages/contracts/tasks/chain-specific/base/morpho.ts b/packages/contracts/tasks/chain-specific/base/morpho.ts new file mode 100644 index 0000000000..9d1b4b54d2 --- /dev/null +++ b/packages/contracts/tasks/chain-specific/base/morpho.ts @@ -0,0 +1,65 @@ +import { task, types } from "hardhat/config"; +import { COMPTROLLER_MORPHO_IONIC } from "."; +import { Address, encodeAbiParameters, parseAbiParameters, zeroAddress } from "viem"; +import { base } from "@ionicprotocol/chains"; +import { assetSymbols } from "@ionicprotocol/types"; + +import { chainIdtoChain } from "@ionicprotocol/chains"; +import { prepareAndLogTransaction } from "../../../chainDeploy/helpers/logging"; + +task("base:morpho:upgrade", "one time setup").setAction(async (_, { viem, run, deployments, getNamedAccounts }) => { + const { deployer } = await getNamedAccounts(); + const erc20MorphoDel = await deployments.deploy("CErc20RewardsDelegateMorpho", { + from: deployer, + args: [], + log: true, + waitConfirmations: 1 + }); + console.log("CErc20RewardsDelegateMorpho: ", erc20MorphoDel.address); + + const assetToUpgrade = assetSymbols.ionicWETH; + + const delegate = await deployments.get("CErc20RewardsDelegateMorpho"); + + const comptroller = await viem.getContractAt("IonicComptroller", COMPTROLLER_MORPHO_IONIC); + const asset = base.assets.find((asset) => asset.symbol === assetToUpgrade); + if (!asset) { + throw `Asset ${assetToUpgrade} not found`; + } + const cToken = await comptroller.read.cTokensByUnderlying([asset.underlying]); + await run("market:upgrade:safe", { + marketAddress: cToken, + implementationAddress: delegate.address as Address + }); +}); + +task("base:morpho:deploy-distributor", "one time setup") + .addParam("morphoMarket", "Morpho CToken", undefined, types.string) + .addParam("morphoBribes", "Morpho Bribe Contract", undefined, types.string) + .setAction(async (taskArgs, { deployments, getNamedAccounts }) => { + const { deployer } = await getNamedAccounts(); + + let morphoBribeDistributor; + try { + console.log("Deploying Morpho Bribe Distributor..."); + + morphoBribeDistributor = await deployments.deploy(`MorphoBribeDistributor_${taskArgs.morphoMarket}`, { + contract: "MorphoBribeDistributor", + from: deployer, + log: true, + proxy: { + proxyContract: "OpenZeppelinTransparentProxy", + execute: { + init: { + methodName: "initialize", + args: [taskArgs.morphoMarket, taskArgs.morphoBribes] + } + } + } + }); + + console.log(`Morpho Bribe Distributor deployed at: ${morphoBribeDistributor.address}`); + } catch (error) { + console.error("Error deploying Morpho Bribe Distributor:", error); + } + }); diff --git a/packages/contracts/tasks/market/deploy.ts b/packages/contracts/tasks/market/deploy.ts index 0a0f031ad2..f1f8f27299 100644 --- a/packages/contracts/tasks/market/deploy.ts +++ b/packages/contracts/tasks/market/deploy.ts @@ -1,5 +1,5 @@ import { task, types } from "hardhat/config"; -import { Address, encodeAbiParameters, parseAbiParameters, parseEther } from "viem"; +import { Address, encodeAbiParameters, Hash, parseAbiParameters, parseEther, zeroAddress } from "viem"; import { MarketConfig } from "../../chainDeploy"; import { prepareAndLogTransaction } from "../../chainDeploy/helpers/logging"; @@ -108,3 +108,187 @@ task("market:deploy", "deploy market") } } }); + +task("market:deploy-morpho", "deploy market") + .addParam("signer", "Named account to use for tx", "deployer", types.string) + .addParam("cf", "Collateral factor", "80", types.string) + .addParam("underlying", "Asset token address", undefined, types.string) + .addParam("comptroller", "Comptroller address", undefined, types.string) + .addParam("symbol", "CToken symbol", undefined, types.string) + .addParam("name", "CToken name", undefined, types.string) + .addOptionalParam("initialSupplyCap", "Initial supply cap", undefined, types.string) + .addOptionalParam("initialBorrowCap", "Initial borrow cap", undefined, types.string) + .setAction(async (taskArgs, { viem, deployments, getNamedAccounts, getChainId }) => { + const { deployer } = await getNamedAccounts(); + const chainId = parseInt(await getChainId()); + const publicClient = await viem.getPublicClient({ chain: chainIdtoChain[chainId] }); + const walletClient = await viem.getWalletClient(deployer as Address, { chain: chainIdtoChain[chainId] }); + const comptroller = await viem.getContractAt("IonicComptroller", taskArgs.comptroller as Address, { + client: { public: publicClient, wallet: walletClient } + }); + + const becomeImplementationData = encodeAbiParameters(parseAbiParameters("address"), [zeroAddress]); + const delegateType = 5; + const implementationData = "0x00"; + + const fuseFeeDistributor = await viem.getContractAt( + "FeeDistributor", + (await deployments.get("FeeDistributor")).address as Address, + { client: { public: publicClient, wallet: walletClient } } + ); + let tx: Hash; + + const cTokenFirstExtension = await deployments.deploy("CTokenFirstExtension", { + contract: "CTokenFirstExtension", + from: deployer, + args: [], + log: true + }); + if (cTokenFirstExtension.transactionHash) + await publicClient.waitForTransactionReceipt({ hash: cTokenFirstExtension.transactionHash as Hash }); + console.log("CTokenFirstExtension", cTokenFirstExtension.address); + + const erc20DelMorpho = await deployments.deploy("CErc20RewardsDelegateMorpho", { + from: deployer, + args: [], + log: true, + waitConfirmations: 1 + }); + if (erc20DelMorpho.transactionHash) + await publicClient.waitForTransactionReceipt({ hash: erc20DelMorpho.transactionHash as Hash }); + console.log("CErc20RewardsDelegateMorpho: ", erc20DelMorpho.address); + + tx = await fuseFeeDistributor.write._setCErc20DelegateExtensions([ + erc20DelMorpho.address as Address, + [erc20DelMorpho.address as Address, cTokenFirstExtension.address as Address] + ]); + await publicClient.waitForTransactionReceipt({ hash: tx }); + console.log(`configured the extensions for the CErc20DelegateMorpho ${erc20DelMorpho.address}`); + + tx = await fuseFeeDistributor.write._setLatestCErc20Delegate([ + delegateType, + erc20DelMorpho.address as Address, + becomeImplementationData + ]); + await publicClient.waitForTransactionReceipt({ hash: tx }); + console.log(`Set the latest CErc20DelegateMorpho implementation to ${erc20DelMorpho.address}`); + + const config: MarketConfig = { + underlying: taskArgs.underlying, + comptroller: comptroller.address, + adminFee: 10, + collateralFactor: parseInt(taskArgs.cf), + interestRateModel: (await deployments.get("JumpRateModel")).address as Address, + reserveFactor: 10, + bypassPriceFeedCheck: true, + feeDistributor: (await deployments.get("FeeDistributor")).address as Address, + symbol: taskArgs.symbol, + name: taskArgs.name + }; + + const reserveFactorBN = parseEther((config.reserveFactor / 100).toString()); + const adminFeeBN = parseEther((config.adminFee / 100).toString()); + const collateralFactorBN = parseEther((config.collateralFactor / 100).toString()); + + console.log("collateralFactorBN", collateralFactorBN.toString()); + console.log("constructor params: ", [ + config.underlying, + config.comptroller, + config.feeDistributor, + config.interestRateModel, + config.name, + config.symbol, + reserveFactorBN, + adminFeeBN + ]); + const constructorData = encodeAbiParameters( + parseAbiParameters("address,address,address,address,string,string,uint256,uint256"), + [ + config.underlying, + config.comptroller, + config.feeDistributor, + config.interestRateModel, + config.name, + config.symbol, + reserveFactorBN, + adminFeeBN + ] + ); + console.log("constructorData", constructorData); + + const owner = (await comptroller.read.admin()) as Address; + // Test Transaction + const errorCode = await comptroller.simulate._deployMarket( + [delegateType, constructorData, implementationData, collateralFactorBN], + { account: owner } + ); + if (errorCode.result !== 0n) { + throw `Unable to _deployMarket: ${errorCode.result}`; + } + if (owner.toLowerCase() !== deployer.toLowerCase()) { + await prepareAndLogTransaction({ + contractInstance: comptroller, + functionName: "_deployMarket", + args: [delegateType, constructorData, implementationData, collateralFactorBN], + description: `Deploy market for ${config.underlying}`, + inputs: [ + { internalType: "uint8", name: "delegateType", type: "uint8" }, + { internalType: "bytes", name: "constructorData", type: "bytes" }, + { internalType: "bytes", name: "implementationData", type: "bytes" }, + { internalType: "uint256", name: "collateralFactor", type: "uint256" } + ] + }); + } else { + // Make actual Transaction + const tx = await comptroller.write._deployMarket([ + delegateType, + constructorData, + implementationData, + collateralFactorBN + ]); + console.log("tx", tx); + + // Recreate Address of Deployed Market + const receipt = await publicClient.waitForTransactionReceipt({ hash: tx }); + if (receipt.status !== "success") { + throw `Failed to deploy market for ${config.underlying}`; + } + } + }); + +task("market:deploy-morpho-bribe-distributor", "Deploy MorphoBribeDistributor") + .addParam("morphoMarket", "Address of the Morpho market", undefined, types.string) + .addParam("morphoBribes", "Address of the Morpho bribes", undefined, types.string) + .setAction(async (taskArgs, { deployments, getNamedAccounts, viem }) => { + const { deployer } = await getNamedAccounts(); + const publicClient = await viem.getPublicClient(); + + const morphoBribeDistributorDeployment = await deployments.deploy("MorphoBribeDistributor", { + contract: "MorphoBribeDistributor", + from: deployer, + proxy: { + proxyContract: "OpenZeppelinTransparentProxy", + execute: { + init: { + methodName: "initialize", + args: [taskArgs.morphoMarket, taskArgs.morphoBribes] + } + }, + owner: deployer + }, + log: true, + waitConfirmations: 1 + }); + + console.log("MorphoBribeDistributor deployed at:", morphoBribeDistributorDeployment.address); + + // Verify the deployment + if (morphoBribeDistributorDeployment.transactionHash) { + const receipt = await publicClient.waitForTransactionReceipt({ + hash: morphoBribeDistributorDeployment.transactionHash as `0x${string}` + }); + if (receipt.status !== "success") { + throw `Failed to deploy MorphoBribeDistributor for ${taskArgs.morphoMarket}`; + } + } + }); diff --git a/packages/contracts/tasks/pool/admin/create.ts b/packages/contracts/tasks/pool/admin/create.ts index 43cc0bcafd..6613259492 100644 --- a/packages/contracts/tasks/pool/admin/create.ts +++ b/packages/contracts/tasks/pool/admin/create.ts @@ -167,6 +167,29 @@ task("pool:create:metalL2").setAction(async ({}, { run, deployments }) => { }); }); +task("pool:create:base:morpho-ionic").setAction(async ({}, { run, deployments }) => { + const mpo = await deployments.get("MasterPriceOracle"); + await run("pool:create", { + name: "Base Morpho Market (Ionic)", + creator: "deployer", + priceOracle: mpo.address, // MPO + closeFactor: "50", + liquidationIncentive: "8", + enforceWhitelist: "false" + }); +}); + +task("pool:create:base:morpho-seamless").setAction(async ({}, { run, deployments }) => { + const mpo = await deployments.get("MasterPriceOracle"); + await run("pool:create", { + name: "Base Morpho Pool (Seamless)", + creator: "deployer", + priceOracle: mpo.address, // MPO + closeFactor: "50", + liquidationIncentive: "8", + enforceWhitelist: "false" + }); +}); task("pool:create", "Create pool if does not exist") .addParam("name", "Name of the pool to be created", undefined, types.string) diff --git a/packages/sdk/deployments/base.json b/packages/sdk/deployments/base.json index cc82380132..66f63e590d 100644 --- a/packages/sdk/deployments/base.json +++ b/packages/sdk/deployments/base.json @@ -41,6 +41,15 @@ "BribeRewards_0x00626ad5300653549c71f5472C0EEe3Dff76587f_Proxy": { "address": "0xF261FE42877c5255Ce051B10604c5ECED5675e91" }, + "BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb": { + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3" + }, + "BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Implementation": { + "address": "0x1bdE1474083BE208EB3671FED03872D504ab1f08" + }, + "BribeRewards_0x074d80556a4B178A4048fCbCcC544eF09aE8cceb_Proxy": { + "address": "0xD8D8b973d18C27274d3c875351A7FDb7330574c3" + }, "BribeRewards_0x098100F2a25BdF4Fc1912d19FcA7851fbB8B06a6": { "address": "0x2824878a54db92117C4084AE7F264B529F1AE581" }, @@ -185,6 +194,15 @@ "BribeRewards_0x36ed47D6B56dc3b1d121373C68623E7650DD18Ff_Proxy": { "address": "0x0f5B2776e27fC127FabB274e26ab5828eF9c899f" }, + "BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B": { + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88" + }, + "BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Implementation": { + "address": "0x61F501Eb77C4962b712238c39e653508a042dA64" + }, + "BribeRewards_0x377d79ff86Fe97020677781b3C651f03e4535F3B_Proxy": { + "address": "0x2889A4F7DBeA8AA8e8C98249D00C0e1383b22E88" + }, "BribeRewards_0x40D2405b39314E6610b04dac3Ebf9A666b167c77": { "address": "0x4A5C33694Ae0036e41B2631760D60c10685f6783" }, @@ -194,6 +212,15 @@ "BribeRewards_0x40D2405b39314E6610b04dac3Ebf9A666b167c77_Proxy": { "address": "0x4A5C33694Ae0036e41B2631760D60c10685f6783" }, + "BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea": { + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35" + }, + "BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Implementation": { + "address": "0x723eB1B00A8Da4B184f65f55ABA4bC558A381D5B" + }, + "BribeRewards_0x475438f4e5d482B49A923B41E95d3856423946Ea_Proxy": { + "address": "0xbf33dac18ADBD8247569F253713Ea984B79F8F35" + }, "BribeRewards_0x4e036F071E256b233Eb3cD91996e288800e72BD9": { "address": "0x5D6284d0C0FD49d8a6d6B0A2f663171Ad3E331fC" }, @@ -221,6 +248,15 @@ "BribeRewards_0x59aFE660D15aFa776E44B304e2d3cAC9426139C8_Proxy": { "address": "0xbD399f53860A4703888BE1d0568634A92C555635" }, + "BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6": { + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131" + }, + "BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Implementation": { + "address": "0xD292Fefc0B637d602C5ee11618DFbF8F756F3F30" + }, + "BribeRewards_0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6_Proxy": { + "address": "0xAEFB6a051668AE64f5D49eCF54650D26a14Be131" + }, "BribeRewards_0x613674F3f9876F950C33189493a31371C9C6d44a": { "address": "0xDc9154a54b230f9940c11467922f9A18131fDd08" }, @@ -239,6 +275,15 @@ "BribeRewards_0x6b6f728Ab4D874dbD63b2c7306eAF4CD40728550_Proxy": { "address": "0x826848C3d57C2396E4Ad8eEA1Ec0539240f7812c" }, + "BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88": { + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0" + }, + "BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Implementation": { + "address": "0x3E1ae0Dd5a4b0802db10027b425994bB437Dc935" + }, + "BribeRewards_0x7028317c36e4940451B4F7486dF4A13181f27a88_Proxy": { + "address": "0xCEe9d123C53a83530CB1bCF1564500d7cE8Bd2F0" + }, "BribeRewards_0x707a1514BD31179347c578dcD425048e083Cd549": { "address": "0xced65fAB0D5875080EfE864be13465535a4edf4C" }, @@ -266,6 +311,15 @@ "BribeRewards_0x78234BDEcB57f4286A156a34E71FFf20df3D40D6_Proxy": { "address": "0x2b1C33f8ac8D6ffe95f028F567F7aA1C669e7757" }, + "BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59": { + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE" + }, + "BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Implementation": { + "address": "0x29b35f3Fca158Fd2853aEF591c67Be3eBE736b54" + }, + "BribeRewards_0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59_Proxy": { + "address": "0xB57aB65B8885E9524b0ECd933B0B3A49B01a99DE" + }, "BribeRewards_0x7e6D5f59CBc8c3A5745E10DcAd2419e12294a245": { "address": "0x0A8fF053Add537db8096222eEb8Dd7619301f053" }, @@ -293,6 +347,15 @@ "BribeRewards_0x86a1E25cf68CB0e6F63B11B3c900Fb706aD735e8_Proxy": { "address": "0xAd4DE67285Fa0A2Ce94a5fA9680C940163459716" }, + "BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945": { + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85" + }, + "BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Implementation": { + "address": "0x71f2b15c8c4518038f07752A9FC882623859011b" + }, + "BribeRewards_0x8944281718FD7f811b9E739a54A9340490344945_Proxy": { + "address": "0x477eD2d5A6938d330FC4bd4e6A8ad3aB2f0AcE85" + }, "BribeRewards_0x8Ec87cC92b732bFa25cE6e9383b649C72d850532": { "address": "0xcEB871f37Eef41078f0F97F0B701b22955d02414" }, @@ -302,6 +365,15 @@ "BribeRewards_0x8Ec87cC92b732bFa25cE6e9383b649C72d850532_Proxy": { "address": "0xcEB871f37Eef41078f0F97F0B701b22955d02414" }, + "BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810": { + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618" + }, + "BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Implementation": { + "address": "0xa047d852476F9F8aC04b336C230a1f1085568C57" + }, + "BribeRewards_0x91dA39E66033b2F460F937301A1B09fcf2633810_Proxy": { + "address": "0x84D0Fb659b2eA9A11B3e53561bFB148638912618" + }, "BribeRewards_0x9E8D3cE2725Fb02390bB3856DeA86d7Dd28a0480": { "address": "0xE3a82B7Aa9e18B3A64f41370701F11C27aD33b38" }, @@ -374,6 +446,15 @@ "BribeRewards_0xD4c9420a9e67E78CbFa1CD75E63f1048cB77BC18_Proxy": { "address": "0x639A5072401caaf58f6037d467C9CE90256Fee55" }, + "BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38": { + "address": "0x21D595170F2125D87194581222c97cD75FB0A573" + }, + "BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Implementation": { + "address": "0xA95312BAEb4C96699331988cEBaF5798e5233610" + }, + "BribeRewards_0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38_Proxy": { + "address": "0x21D595170F2125D87194581222c97cD75FB0A573" + }, "BribeRewards_0xE546d9BFa50De74029623c3F6F90C7Dc885E34EA": { "address": "0x9ec895A1a054024FaA9d2DA5441BA17B0A9dfD73" }, @@ -401,6 +482,15 @@ "BribeRewards_0xb7edC0d7e000cBAB5FE73d727A190DF39ab76912_Proxy": { "address": "0xF38FF722a0Ade059bc4E4282Ff45C8Ff9368024e" }, + "BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D": { + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7" + }, + "BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Implementation": { + "address": "0x414E7b43B8b82aDf0B02c84E9EC02Aa82d87b2aA" + }, + "BribeRewards_0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D_Proxy": { + "address": "0xc314Fd7A9c115dAbd87c6EBbd355E3dFE37aFBa7" + }, "BribeRewards_0xbB69e2D41c0f935dFb4cc16B44aa4F1F28079E3b": { "address": "0xdf0e282C820Dc28Ad9C7B608FCB6191ABDe882ff" }, @@ -530,6 +620,9 @@ "CErc20RewardsDelegate": { "address": "0xfceEA832b549F2A2e0881C8DB8B42e358C7a0889" }, + "CErc20RewardsDelegateMorpho": { + "address": "0x13197fdb0A96Ff25E3455D77b1a75f65e3B03CFe" + }, "CTokenFirstExtension": { "address": "0x4661DBCf8EB11801F438f8019B160F3Cb9B5d817" }, @@ -555,13 +648,13 @@ "address": "0xF9fc8e7C5dAf707f18f06E04916Ff315B01326Da" }, "Comptroller": { - "address": "0xc63Ee58A68C22BFd7900ab5C3eB94D0f3d1442e9" + "address": "0x7E98caf24A84ae15Fb5De8C5f1C4D261c3Cf9833" }, "ComptrollerFirstExtension": { - "address": "0x0C7d81F299dD96bF01432dE64f262E48AfF4F5ea" + "address": "0xC35a8090c13879438E3bF6aC5f1DCFD0Ef6f34c0" }, "ComptrollerPrudentiaCapsExt": { - "address": "0x3C1c62d04ccA26DCD17e670325cd435541625daD" + "address": "0xD22130E50EC505acEc884C7842b62f5baa6131a0" }, "CurveSwapLiquidator": { "address": "0xa1452e5557CdEf25D88deFE06De12B45fC8eEA30" @@ -722,6 +815,24 @@ "MasterPriceOracle_Proxy": { "address": "0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4" }, + "MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e": { + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae" + }, + "MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Implementation": { + "address": "0xDE621F25bF616124E0548137e6dadAe98a3B9124" + }, + "MorphoBribeDistributor_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_Proxy": { + "address": "0xfDeAd85B8cB849B74cbd096fC75fca44bC3687Ae" + }, + "MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808": { + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1" + }, + "MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Implementation": { + "address": "0xB98c673F7973a996FB9106B7d1D21E5B7b0A888a" + }, + "MorphoBribeDistributor_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_Proxy": { + "address": "0xEe08Ae76396BfA2BE259694e00C4098b381d43D1" + }, "OptimizedVaultsRegistry": { "address": "0xA90f1c28F8Bc9C92113e54d0b7d007647Ee216a4" }, @@ -974,6 +1085,42 @@ "RewardAccumulator_0x84341B650598002d427570298564d6701733c805_1_Proxy": { "address": "0x40D2405b39314E6610b04dac3Ebf9A666b167c77" }, + "RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0": { + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59" + }, + "RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Implementation": { + "address": "0x01A22FA4CE003a3BC515d22F781D6ebc74d1F35c" + }, + "RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_0_Proxy": { + "address": "0x7B2b412EB8Fe68bcee3e2f6dE658A1Bd8c0d7A59" + }, + "RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1": { + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb" + }, + "RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Implementation": { + "address": "0xEeCD18A73d60D672c53E90Bb98A27fe20308B4DF" + }, + "RewardAccumulator_0x92eEE1851828057c6613a78F776fA2eEA35F45dB_1_Proxy": { + "address": "0x074d80556a4B178A4048fCbCcC544eF09aE8cceb" + }, + "RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0": { + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B" + }, + "RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Implementation": { + "address": "0x24C24e2Ef6e21eea711E317c4BfCc49484312EC8" + }, + "RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_0_Proxy": { + "address": "0x377d79ff86Fe97020677781b3C651f03e4535F3B" + }, + "RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1": { + "address": "0x8944281718FD7f811b9E739a54A9340490344945" + }, + "RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Implementation": { + "address": "0x60aA0b6A627923AE0fCf1a9F9D0B603b4C207b1f" + }, + "RewardAccumulator_0x99810c254bA9e359ffD269986f36E3E6b996BA59_1_Proxy": { + "address": "0x8944281718FD7f811b9E739a54A9340490344945" + }, "RewardAccumulator_0x9D62e30c6cB7964C99314DCf5F847e36Fcb29ca9_0": { "address": "0xd2B4d357fecB763832B26b9edB44aE2954E6Ca2d" }, @@ -1046,6 +1193,24 @@ "RewardAccumulator_0xAa255Cf8e294BD7fcAB21897C0791e50C99BAc69_1_Proxy": { "address": "0x0e1Af910f1c6C232B90d40490D972E79a0F861e5" }, + "RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0": { + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38" + }, + "RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Implementation": { + "address": "0x0b3F497C3331Fb05A4ca67d2B19fC965540c0592" + }, + "RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_0_Proxy": { + "address": "0xE2eB8ecD92D3E47D04cb95e9edD427382b98ac38" + }, + "RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1": { + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D" + }, + "RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Implementation": { + "address": "0x4A224B4D23A275c8DD29cFF2D831060D3D2c538c" + }, + "RewardAccumulator_0xB68Eb52A33374cD8512d8021fDE3b6871a62C52e_1_Proxy": { + "address": "0xb8bEE9AB9d407A3D0b013F6AE5EE546DE6F8587D" + }, "RewardAccumulator_0xC462eb5587062e2f2391990b8609D2428d8Cf598_0": { "address": "0x268a6dC79883Ae61b51feeD1799a99dB1FA0Aa34" }, @@ -1100,6 +1265,24 @@ "RewardAccumulator_0xF1bbECD6aCF648540eb79588Df692c6b2F0fbc09_1_Proxy": { "address": "0x81078080a054015bea7Abb35ec9c18cDb08b099E" }, + "RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0": { + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810" + }, + "RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Implementation": { + "address": "0xF88598F2b0Ea367F47d38Bb08daF528F1910a86f" + }, + "RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_0_Proxy": { + "address": "0x91dA39E66033b2F460F937301A1B09fcf2633810" + }, + "RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1": { + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88" + }, + "RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Implementation": { + "address": "0xF38131Eb77Fdf23CA78e4f736107e5CF8f2f0dd2" + }, + "RewardAccumulator_0xa2403211F91D4be497F54ce620Ab8e1dA770d808_1_Proxy": { + "address": "0x7028317c36e4940451B4F7486dF4A13181f27a88" + }, "RewardAccumulator_0xa4442b665d4c6DBC6ea43137B336e3089f05626C_0": { "address": "0x4e036F071E256b233Eb3cD91996e288800e72BD9" }, @@ -1154,6 +1337,24 @@ "RewardAccumulator_0xbd06905590b6E1b6Ac979Fc477A0AebB58d52371_1_Proxy": { "address": "0x12daB6B398D9b645c8Fae77ad20E546C8979b96F" }, + "RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0": { + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea" + }, + "RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Implementation": { + "address": "0x41BD53ff41C7fb8E18bFf1bD7Ef224E1aD4bf152" + }, + "RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_0_Proxy": { + "address": "0x475438f4e5d482B49A923B41E95d3856423946Ea" + }, + "RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1": { + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6" + }, + "RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Implementation": { + "address": "0x1f6B5f4b7cf9f4dD84db5fC009b58F9C3F726986" + }, + "RewardAccumulator_0xc598Ec6BE9f0329Ff6b16EAEf39e461B38Ce2E91_1_Proxy": { + "address": "0x5bcf17454844D4ae3DDE5e14Bf87fA4e16492Fc6" + }, "RewardAccumulator_0xd3181806b89CA82cfA45d2E0807ae3C707BD752F_0": { "address": "0xe5968baC664d53407059AF796f349803dB2f55aa" }, @@ -1284,7 +1485,7 @@ "address": "0xFEF51b9B5a1050B2bBE52A39cC356dfCEE79D87B" }, "VoterLens_Implementation": { - "address": "0xd23933c6ceFbDdEF0902252Cb13A0E7371C5c5A9" + "address": "0x682E491d804Fa22a2fd77Bd0Ce0861Ad17df3d60" }, "VoterLens_Proxy": { "address": "0xFEF51b9B5a1050B2bBE52A39cC356dfCEE79D87B" diff --git a/packages/sdk/deployments/mode.json b/packages/sdk/deployments/mode.json index ee334aa91f..cf410d9561 100644 --- a/packages/sdk/deployments/mode.json +++ b/packages/sdk/deployments/mode.json @@ -1062,4 +1062,4 @@ "address": "0xb750c43F9338313c7A8af6922dcA1910Ee3583c8" } } -} \ No newline at end of file +} diff --git a/packages/sdk/src/generated.ts b/packages/sdk/src/generated.ts index b24a6fa714..1436abfd9f 100644 --- a/packages/sdk/src/generated.ts +++ b/packages/sdk/src/generated.ts @@ -7218,6 +7218,7 @@ export const cErc20RewardsDelegateAbi = [ { type: "error", inputs: [], name: "InteractionNotAllowed" } ] as const; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CErc20RewardsDelegateMorpho ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -8867,6 +8868,7 @@ export const cTokenFirstExtensionInterfaceAbi = [ } ] as const; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CTokenMinter ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -29863,7 +29865,7 @@ export const iMasterPriceOracleAbi = [ ] as const; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// IMessageLibManager +// IMorphoClaim ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// export const iMessageLibManagerAbi = [ @@ -48509,6 +48511,10 @@ export const morphoBribeDistributorAbi = [ } ] as const; +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// MorphoBribeDistributor +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Multicall ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/packages/types/src/enums.ts b/packages/types/src/enums.ts index 7748da8eb1..97866ec92d 100644 --- a/packages/types/src/enums.ts +++ b/packages/types/src/enums.ts @@ -227,6 +227,7 @@ export enum assetSymbols { mBASIS = "mBASIS", msETH = "msETH", msUSD = "msUSD", + smUSDC = "smUSDC", // optimism OP = "OP", diff --git a/packages/ui/components/dialogs/ManageMarket/Swap.tsx b/packages/ui/components/dialogs/ManageMarket/Swap.tsx index 5bb8723c17..ae0dee26aa 100644 --- a/packages/ui/components/dialogs/ManageMarket/Swap.tsx +++ b/packages/ui/components/dialogs/ManageMarket/Swap.tsx @@ -27,7 +27,7 @@ import ResultHandler from '../../ResultHandler'; import type { GetBalanceData } from 'wagmi/query'; -import { wethAbi } from '@ionicprotocol/sdk'; +import { iwethAbi } from '@ionicprotocol/sdk'; export type SwapProps = { close: () => void; @@ -82,7 +82,7 @@ export default function Swap({ ); const queryClient = useQueryClient(); const WTokenContract = useMemo< - GetContractReturnType | undefined + GetContractReturnType | undefined >(() => { if (!currentSdk || !address) { return undefined; @@ -90,7 +90,7 @@ export default function Swap({ return getContract({ address: currentSdk.chainSpecificAddresses.W_TOKEN as Address, - abi: wethAbi, + abi: iwethAbi, client: currentSdk.walletClient! }) as any; }, [address, currentSdk]); diff --git a/packages/ui/components/dialogs/ManageMarket/tabs/BorrowTab.tsx b/packages/ui/components/dialogs/ManageMarket/tabs/BorrowTab.tsx index 9e25997321..36a0d40909 100644 --- a/packages/ui/components/dialogs/ManageMarket/tabs/BorrowTab.tsx +++ b/packages/ui/components/dialogs/ManageMarket/tabs/BorrowTab.tsx @@ -66,23 +66,16 @@ const BorrowTab = ({ comptrollerAddress }); - const { isLoadingPredictedHealthFactor, healthFactor, hfpStatus } = useHealth( - { - comptrollerAddress, - cToken: selectedMarketData.cToken, - activeTab: 'borrow', - amount: amountAsBInt, - exchangeRate: selectedMarketData.exchangeRate, - decimals: selectedMarketData.underlyingDecimals - } - ); + const { healthFactor, hfpStatus } = useHealth({ + comptrollerAddress, + cToken: selectedMarketData.cToken, + activeTab: 'borrow', + amount: amountAsBInt, + exchangeRate: selectedMarketData.exchangeRate, + decimals: selectedMarketData.underlyingDecimals + }); - const isDisabled = - !amount || - amountAsBInt === 0n || - isLoadingPredictedHealthFactor || - hfpStatus === HFPStatus.CRITICAL || - hfpStatus === HFPStatus.UNKNOWN; + const isDisabled = !amount || amountAsBInt === 0n; useEffect(() => { setPredictionAmount(amountAsBInt); diff --git a/packages/ui/components/dialogs/ManageMarket/tabs/WithdrawTab.tsx b/packages/ui/components/dialogs/ManageMarket/tabs/WithdrawTab.tsx index 2ede489661..24dea4c62d 100644 --- a/packages/ui/components/dialogs/ManageMarket/tabs/WithdrawTab.tsx +++ b/packages/ui/components/dialogs/ManageMarket/tabs/WithdrawTab.tsx @@ -63,23 +63,21 @@ const WithdrawTab = ({ chainId }); - const { isLoadingPredictedHealthFactor, healthFactor, hfpStatus } = useHealth( - { - comptrollerAddress, - cToken: selectedMarketData.cToken, - activeTab: 'withdraw', - amount: amountAsBInt, - exchangeRate: selectedMarketData.exchangeRate, - decimals: selectedMarketData.underlyingDecimals - } - ); + const { healthFactor, hfpStatus } = useHealth({ + comptrollerAddress, + cToken: selectedMarketData.cToken, + activeTab: 'withdraw', + amount: amountAsBInt, + exchangeRate: selectedMarketData.exchangeRate, + decimals: selectedMarketData.underlyingDecimals + }); const isDisabled = !amount || amountAsBInt === 0n || - isLoadingPredictedHealthFactor || - hfpStatus === HFPStatus.CRITICAL || - hfpStatus === HFPStatus.UNKNOWN; + // isLoadingPredictedHealthFactor || + // hfpStatus === HFPStatus.UNKNOWN || + hfpStatus === HFPStatus.CRITICAL; useEffect(() => { setPredictionAmount(amountAsBInt); diff --git a/packages/ui/components/markets/PoolToggle.tsx b/packages/ui/components/markets/PoolToggle.tsx index 1cc912e460..ac066f6971 100644 --- a/packages/ui/components/markets/PoolToggle.tsx +++ b/packages/ui/components/markets/PoolToggle.tsx @@ -84,7 +84,13 @@ const PoolToggle = ({ chain, pool, hiddenPools = [] }: PoolToggleProps) => { )} - {isDeprecated ? 'Deprecated' : isNative ? 'Native' : 'Main'} + {isDeprecated + ? 'Deprecated' + : isNative + ? 'Native' + : poolConfig.shortName + ? poolConfig.shortName + : 'Main'} ); diff --git a/packages/ui/constants/index.ts b/packages/ui/constants/index.ts index adb4798416..1f5e83779c 100644 --- a/packages/ui/constants/index.ts +++ b/packages/ui/constants/index.ts @@ -177,6 +177,7 @@ type PoolParams = { id: string; name: string; assets: string[]; + shortName?: string; }[]; vaults?: { id: string; @@ -205,7 +206,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: [ 'USDC', 'WETH', @@ -236,6 +237,12 @@ export const pools: Record = { 'fBOMB', 'KLIMA' ] + }, + { + id: '3', + name: 'Morpho Seamless', + assets: ['smUSDC', 'USDC'], + shortName: 'Morpho Seamless' } ] // vaults: [ @@ -300,7 +307,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: [ 'USDC', 'USDT', @@ -326,7 +333,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['USDC', 'USDT', 'WETH', 'WBTC', 'tBTC', 'SOV'] } ] @@ -341,7 +348,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['FRAX', 'wfrxETH', 'insfrxETH', 'sfrxETH', 'sFRAX', 'FXS'] } ] @@ -356,7 +363,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WETH', 'USDC', 'USDT', 'WBTC', 'LSK'] } ] @@ -371,7 +378,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WETH'] } ] @@ -386,7 +393,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WETH'] } ] @@ -401,7 +408,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WETH'] } ] @@ -416,7 +423,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WETH', 'USDe', 'rswETH', 'weETH'] } ] @@ -428,7 +435,7 @@ export const pools: Record = { text: 'text-white', border: 'border-camp', logo: '/img/logo/CAMP.png', - pools: [{ id: '0', name: 'Main Pool', assets: ['WETH'] }] + pools: [{ id: '0', name: 'Main', assets: ['WETH'] }] }, [ozeantest.chainId]: { arrow: 'ffffff', @@ -442,7 +449,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WUSDX'] } ] @@ -457,7 +464,7 @@ export const pools: Record = { pools: [ { id: '0', - name: 'Main Pool', + name: 'Main', assets: ['WETH', 'USDC', 'ASTR'] } ] diff --git a/packages/ui/hooks/market/useMarketData.ts b/packages/ui/hooks/market/useMarketData.ts index 3480cbd58c..6af99c25bd 100644 --- a/packages/ui/hooks/market/useMarketData.ts +++ b/packages/ui/hooks/market/useMarketData.ts @@ -129,8 +129,12 @@ export const useMarketData = ( const marketData = useMemo(() => { if (!assets) return []; + const selectedPoolData = Object.values(pools[+chain].pools).find( + (pool) => pool.id === selectedPool + ); + if (!selectedPoolData) return []; - const transformedData = pools[+chain].pools[+selectedPool].assets + const transformedData = selectedPoolData.assets .map((symbol: string) => { const asset = assets.find((a) => a.underlyingSymbol === symbol); if (!asset) return null; diff --git a/packages/ui/public/img/symbols/32/color/ionicusdc.png b/packages/ui/public/img/symbols/32/color/ionicusdc.png new file mode 100644 index 0000000000..890779068c Binary files /dev/null and b/packages/ui/public/img/symbols/32/color/ionicusdc.png differ diff --git a/packages/ui/public/img/symbols/32/color/ionicweth.png b/packages/ui/public/img/symbols/32/color/ionicweth.png new file mode 100644 index 0000000000..c58f7e099e Binary files /dev/null and b/packages/ui/public/img/symbols/32/color/ionicweth.png differ diff --git a/packages/ui/public/img/symbols/32/color/smusdc.png b/packages/ui/public/img/symbols/32/color/smusdc.png new file mode 100644 index 0000000000..890779068c Binary files /dev/null and b/packages/ui/public/img/symbols/32/color/smusdc.png differ